diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 689e14c1..3a2ac481 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -3,30 +3,67 @@ name: Commit Build on: push: branches: - - master + - '**' tags-ignore: - - v* + - '**' jobs: - build: + buildLinux: runs-on: ubuntu-latest steps: - - uses: rlespinasse/github-slug-action@v3.x - - - uses: actions/checkout@v2 - + - name: Make Slugs + uses: rlespinasse/github-slug-action@v4.4.1 + + - name: Checkout + uses: actions/checkout@v3.3.0 + - name: Build run: | export TZ='America/Los_Angeles' sudo apt-get install libncurses-dev - make - make clean + sudo apt-get install srecord + make dist rm -rf .git* - + + - name: List Output + run: | + cd Binary + ls -l + find -type f -exec md5sum '{}' \; + - name: Upload Artifact - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3.1.1 with: - name: RomWBW-${{env.GITHUB_REF_SLUG}}-${{env.GITHUB_SHA_SHORT}} + name: RomWBW-${{env.GITHUB_SHA_SHORT}}-Linux path: . + + buildMacOS: + runs-on: macOS-latest + + steps: + - name: Make Slugs + uses: rlespinasse/github-slug-action@v4.4.1 + + - name: Checkout + uses: actions/checkout@v3.3.0 + + - name: Build + run: | + export TZ='America/Los_Angeles' + brew install srecord + make dist + rm -rf .git* + + - name: List Output + run: | + cd Binary + ls -l + find . -type f -exec md5 -r -- '{}' +; + + - name: Upload Artifact + uses: actions/upload-artifact@v3.1.1 + with: + name: RomWBW-${{env.GITHUB_SHA_SHORT}}-MacOS + path: . \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e5fbaaf..1c842d01 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,9 @@ name: Release Build on: - release: - types: published + push: + tags: + - '**' jobs: build: @@ -10,42 +11,93 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - + - name: Checkout + uses: actions/checkout@v3.3.0 + - name: Create Package Label run: | + echo GITHUB_REF: "$GITHUB_REF" LABEL=`echo "$GITHUB_REF" | sed "s|^refs/tags/||"` - echo "::set-env name=PKGLBL::$LABEL" - - - name: Display Diagnostics - run: | + echo "PKGLBL=$LABEL" >> $GITHUB_ENV echo PKGLBL: "$PKGLBL" echo Upload URL: "${{github.event.release.upload_url}}" echo GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" - + - name: Build run: | + export TZ='America/Los_Angeles' sudo apt-get install libncurses-dev - make - make clean + sudo apt-get install srecord + make dist rm -rf .git* - - name: Upload Artifact - uses: actions/upload-artifact@v1 - with: - name: RomWBW-${{env.PKGLBL}}-Package - path: . - - name: Create Package Archive run: | - zip -r Package.zip . - - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + zip -r RomWBW-${{env.PKGLBL}}-Package.zip . + + - name: Attach Package Archive + uses: wwarthen/actions/packages/automatic-releases@built-packages with: - upload_url: ${{github.event.release.upload_url}} - asset_path: Package.zip - asset_name: RomWBW-${{env.PKGLBL}}-Package.zip - asset_content_type: application/zip \ No newline at end of file + repo_token: "${{ secrets.GITHUB_TOKEN }}" + draft: true + prerelease: true + title: "RomWBW Development SnapShot ${{env.PKGLBL}}" + files: | + RomWBW-${{env.PKGLBL}}-Package.zip + +# - name: Upload Package Archive +# uses: AButler/upload-release-assets@v2.0.2 +# with: +# repo-token: ${{ secrets.GITHUB_TOKEN }} +# files: | +# RomWBW-${{env.PKGLBL}}-Package.zip + + +# - name: Post SnapShot +# uses: docker://antonyurchenko/git-release:latest +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# RELEASE_NAME_PREFIX: "Development SnapShot Release " +# CHANGELOG_FILE: "none" +# with: +# args: | +# RomWBW-SnapShot-Package.zip + +# - name: Post SnapShot +# uses: cb80/pubrel@latest +# with: +# replace: true +# files: | +# RomWBW-SnapShot-Package.zip + +# - name: Post SnapShot +# uses: wwarthen/actions/packages/automatic-releases@built-packages +# with: +# repo_token: "${{ secrets.GITHUB_TOKEN }}" +# prerelease: true +# title: "RomWBW Development SnapShot ${{env.GITHUB_REF_SLUG}}" +# files: | +# RomWBW-SnapShot-Package.zip + +# - name: Remove Older Releases +# uses: wwarthen/delete-release-action@v1.2 +# with: +# release-drop: true +# release-keep-count: 0 +# release-drop-tag: true +# pre-release-drop: false +# pre-release-keep-count: 0 +# pre-release-drop-tag: true +# draft-drop: true +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +# - name: Remove Older Releases +# uses: s00d/delete-older-releases@0.2.1 +# with: +# keep_latest: 1 +## delete_tag_pattern: beta # defaults to "" +# delete_type: 'release' +# delete_branch: 'main' +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 4782ed5c..bbedf387 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ Binary/**/*.mym Binary/**/*.pt3 +!Binary/cpnos-wbw.sys Source/**/eeprom Source/Apps/Assign.com @@ -49,6 +50,9 @@ Source/Images/blankhd Source/Prop/Spin/ParPortProp.list Source/Prop/Spin/PropIO.list Source/Prop/Spin/PropIO2.list +Source/Prop/ParPortProp.list +Source/Prop/PropIO.list +Source/Prop/PropIO2.list Source/ZPM3/bnkbios3.spr Source/ZPM3/gencpm.com Source/ZPM3/gencpm.com @@ -73,24 +77,34 @@ Tools/unix/zx/zx !Source/ver.lib !Source/Apps/FAT/FAT.COM +!Source/Apps/ZMP/zmpx.com +!Source/Apps/ZMD/zmdsubs.rel +!Source/Apps/Test/vdctest/font.asm !Source/BPBIOS/bpbuild.com !Source/BPBIOS/movp112.com +!Source/BPBIOS/*.lib !Source/BPBIOS/Z34RCP11/cledinst.com !Source/BPBIOS/Z34RCP11/cledsave.com -!Source/Fonts -!Source/Images/**/*.[Cc][Oo][Mm] -!Source/RomDsk/**/*.[Cc][Oo][Mm] +!Source/Fonts/* +!Source/Images/** +!Source/RomDsk/** !Source/UBIOS/FSFAT.BIN !Source/UBIOS/UNA-BIOS.BIN !Source/ZCCP/*.[Cc][Oo][Mm] !Source/ZCPR-DJ/*.[Cc][Oo][Mm] !Source/ZPM3/*.[Cc][Oo][Mm] !Source/ZSDOS/*.[Cc][Oo][Mm] -!Tools/cpm/bin -!Tools/unix/zx -!Tools/zx +!Source/ZRC/*.bin +!Source/ZZRC/*.bin +!Source/ZZRC/*.hex +!Tools/cpm/** +!Tools/unix/zx/* +!Tools/zx/* Source/ZPM3/gencpm.com Source/ZPM3/startzpm.com Source/ZPM3/zccp.com Source/ZPM3/zpmldr.com +Source/ZPM3/genbnk.dat + +Source/ZSDOS/zsdos.err \ No newline at end of file diff --git a/Binary/Apps/Clean.cmd b/Binary/Apps/Clean.cmd index 1427d697..2c3c648e 100644 --- a/Binary/Apps/Clean.cmd +++ b/Binary/Apps/Clean.cmd @@ -2,5 +2,11 @@ setlocal if exist *.com del *.com +if exist *.ovr del *.ovr +if exist *.doc del *.doc +if exist *.hlp del *.hlp if exist Tunes\*.pt? del Tunes\*.pt? if exist Tunes\*.mym del Tunes\*.mym +if exist Tunes\*.vgm del Tunes\*.vgm + +pushd Test && call Clean || exit /b 1 & popd diff --git a/Binary/Apps/Makefile b/Binary/Apps/Makefile index cfa80100..940d9ae2 100644 --- a/Binary/Apps/Makefile +++ b/Binary/Apps/Makefile @@ -1,10 +1,11 @@ TOOLS = ../../Tools -MOREDIFF := $(shell $(TOOLS)/unix/casefn.sh *.com Tunes/*) +MOREDIFF := $(shell $(TOOLS)/unix/casefn.sh *.com) +SUBDIRS = Test include $(TOOLS)/Makefile.inc all:: mkdir -p Tunes -clobber:: - rm -f *.bin *.com *.img *.rom *.pdf *.log *.eeprom *.COM *.BIN Tunes/*.mym Tunes/*.pt? +clean:: + @rm -f *.bin *.com *.img *.rom *.pdf *.log *.eeprom *.ovr *.hlp *.doc *.COM *.BIN Tunes/*.mym Tunes/*.pt? Tunes/*.vgm diff --git a/Binary/Apps/ReadMe.txt b/Binary/Apps/ReadMe.txt index 6fb4ccf8..1c8781b5 100644 --- a/Binary/Apps/ReadMe.txt +++ b/Binary/Apps/ReadMe.txt @@ -11,4 +11,11 @@ are specific to RomWBW. The source for these applications is found in the Source\Apps directory of the distribution. The Tunes subdirectory contains some sample ProTracker and MYM sound -files that can be played by the TUNE application. \ No newline at end of file +files that can be played by the TUNE application. + +All of these files are already included in the pre-built boot disk +images. They are also included on the ROM disk except for +FAT.COM, TUNE.COM, and the sample tune files in the Tunes directory. + +If you upgrade your ROM to a new version, you should also copy +these files over to any hard disk images you are using. \ No newline at end of file diff --git a/Binary/Apps/Test/Clean.cmd b/Binary/Apps/Test/Clean.cmd new file mode 100644 index 00000000..c79d414b --- /dev/null +++ b/Binary/Apps/Test/Clean.cmd @@ -0,0 +1,4 @@ +@echo off +setlocal + +if exist *.com del *.com diff --git a/Binary/Apps/Test/Makefile b/Binary/Apps/Test/Makefile new file mode 100644 index 00000000..8fc553ae --- /dev/null +++ b/Binary/Apps/Test/Makefile @@ -0,0 +1,7 @@ +TOOLS = ../../../Tools +MOREDIFF := $(shell $(TOOLS)/unix/casefn.sh *.com) + +include $(TOOLS)/Makefile.inc + +clean:: + @rm -f *.com diff --git a/Binary/Apps/Test/ReadMe.txt b/Binary/Apps/Test/ReadMe.txt new file mode 100644 index 00000000..5532ae80 --- /dev/null +++ b/Binary/Apps/Test/ReadMe.txt @@ -0,0 +1,16 @@ +*********************************************************************** +*** *** +*** R o m W B W *** +*** *** +*** Z80/Z180 System Software *** +*** *** +*********************************************************************** + +This directory contains various hardware test application files that +are specific to RomWBW. The source for these applications is found +in the Source\Apps\Test directory of the distribution. + +These files are included on the pre-built disk images in user area 2. + +N.B., these files may be specific to certain hardware. They should +be used as directred by the instructions for your specific hardware. \ No newline at end of file diff --git a/Binary/Apps/Tunes/ReadMe.txt b/Binary/Apps/Tunes/ReadMe.txt index 366efefe..3c41d421 100644 --- a/Binary/Apps/Tunes/ReadMe.txt +++ b/Binary/Apps/Tunes/ReadMe.txt @@ -7,4 +7,4 @@ *********************************************************************** This directory contains some sample ProTracker and MYM sound -files that can be played by the TUNE application. \ No newline at end of file +files that can be played by the TUNE or VGMPLAY application. \ No newline at end of file diff --git a/Binary/CPM3/Clean.cmd b/Binary/CPM3/Clean.cmd new file mode 100644 index 00000000..c909fdae --- /dev/null +++ b/Binary/CPM3/Clean.cmd @@ -0,0 +1,11 @@ +@echo off +setlocal + +if exist *.spr del *.spr +if exist *.com del *.com +if exist *.sys del *.sys +if exist *.pat del *.pat +if exist *.dat del *.dat +if exist *.1st del *.1st +if exist *.spr del *.spr +if exist *.pat del *.pat diff --git a/Binary/CPM3/Makefile b/Binary/CPM3/Makefile new file mode 100644 index 00000000..bf98e7ac --- /dev/null +++ b/Binary/CPM3/Makefile @@ -0,0 +1,7 @@ +TOOLS = ../../Tools +MOREDIFF := $(shell $(TOOLS)/unix/casefn.sh *.spr) + +include $(TOOLS)/Makefile.inc + +clean:: + @rm -f *.spr *.com *.sys *.dat cpm3fix.pat readme.1st diff --git a/Binary/CPM3/ReadMe.txt b/Binary/CPM3/ReadMe.txt new file mode 100644 index 00000000..18f1ecb3 --- /dev/null +++ b/Binary/CPM3/ReadMe.txt @@ -0,0 +1,17 @@ +*********************************************************************** +*** *** +*** R o m W B W *** +*** *** +*** Z80/Z180 System Software *** +*** *** +*********************************************************************** + +This directory contains the CP/M 3 system files for the RomWBW CP/M 3 +adaptation. All of these files are already included on the CP/M 3 +boot disk images. However if you are creating a CP/M 3 boot disk +manually, you should copy all of these files to the boot disk. + +These files should also be copied to any CP/M 3 boot disks on your +system when you upgrade your ROM firmware. Some of these files +*must* match the version of the RomWBW firmware you are using for +proper operation of your system. \ No newline at end of file diff --git a/Binary/Clean.cmd b/Binary/Clean.cmd index b0b248d8..8116314a 100644 --- a/Binary/Clean.cmd +++ b/Binary/Clean.cmd @@ -2,11 +2,15 @@ setlocal if exist *.bin del *.bin +if exist *.dat del *.dat if exist *.com del *.com if exist *.img del *.img if exist *.rom del *.rom +if exist *.hex del *.hex +if exist *.upd del *.upd if exist *.pdf del *.pdf -if exist *.log del *.log if exist *.eeprom del *.eeprom -setlocal & cd Apps && call Clean || exit /b 1 & endlocal +pushd Apps && call Clean || exit /b 1 & popd +pushd CPM3 && call Clean || exit /b 1 & popd +pushd ZPM3 && call Clean || exit /b 1 & popd diff --git a/Binary/DiskList.txt b/Binary/DiskList.txt deleted file mode 100644 index 8ecedd63..00000000 --- a/Binary/DiskList.txt +++ /dev/null @@ -1,167 +0,0 @@ -*********************************************************************** -*** *** -*** 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. - -RomWBW includes a set of disk images that are ready to copy onto -a floppy or hard/CF/SD disk. You can use your modern computer -(Windows/Linux/Mac) to copy the disk image file onto your disk -media. The disk media will then be ready to use in your RomWBW -System. - -A description of the disk images is provided later in this file. -For more information on the creatioin of these images including -instructions for customizing them or creating your own, refer to -the ReadMe.txt file in the Source\Images directory. - -Installing Images ------------------ - -The following instructions apply to Windows computers. Alternatively, -you can use the "dd" command on Linux or Mac. - -First of all, a MAJOR WARNING!!!! The tools described below are -quite capable of obliterating your running Windows system drive. Use -with extreme caution and make sure you have backups. - -To install a floppy image on floppy media, you can use the tool -called RaWriteWin. This tool is included in the Tools directory of -the distribution. This tool will write your floppy image (fd_xxx.img) -to a floppy disk using a raw block transfer. The tool is GUI based -and it's operation is self explanatory. - -To install a hard disk image on a CF card or SD card, you must have -the appropriate media card slot on your computer. If you do, you can -use the tool called Win32DiskImager. This tool is also included in -the Tools directory of the distribution. It will write your -hard disk image (hd_xxx.img) to the designated media card. This tool -is also GUI based and self explanatory. - -The use of the SIMH emulator is outside of the scope of this document. -However, if you use SIMH, you will find that you can attach the hard -disk images to the emulator with lines such as the following in your -SIMH configuration file: - - | attach hdsk0 hd_cpm22.img - | set hdsk0 format=HDSK - | set hdsk0 geom=T:2048/N:256/S:512 - | set hdsk0 wrtenb - -Making Disk Images Bootable ---------------------------- - -The Operating System disk images below are ready to boot by the -RomWBW Boot Loader. However, if you update your RomWBW ROM, then -you should also update the system tracks of your bootable disk -images. You would use SYSCOPY to do this. SYSCOPY can also be -used to make a disk bootable if it is not already bootable. - -You would use a command like the following to make drive C bootable: - - | B>SYSCOPY C:=CPM.SYS - -The system file to use depends on the operating system you are trying -to boot from the slice you are initializing with SYSCOPY: - - CP/M 2.2 - cpm.sys - ZSDOS 1.1 - zsys.sys - CP/M 3 - cpmldr.sys - ZPM3 - cpmldr.sys - -Slices ------- - -A RomWBW CP/M filesystem is fixed at 8MB. This is because it is the -largest size filesystem supported by all common CP/M variants. Since -all modern hard disks (including SD Cards and CF Cards) are much -larger than 8MB, RomWBW supports the concept of "slices". This -simply means that you can concatenate multiple CP/M filesystems (up -to 256 of them) on a single physical hard disk and RomWBW will allow -you to assign drive letters to them and treat them as multiple -independent CP/M drives. - -With the exception of the hd_combo image, each of the disk images -includes a single CP/M file system (i.e., a single slice). However, -you can easily create a multi-slice disk image by merely concatenating -multiple images together. For example, if you wanted to create a 2 -slice disk image that has ZSDOS in the first slice and Wordstar in -the second slice, you could use the following command from a Windows -command prompt: - - | C:\RomWBW\Binary>copy /b hd_zsdos.img + hd_ws.img hd_multi.img - -You can now write hd_multi.img onto your SD or CF Card and you will -have ZSDOS in the first slice and Wordstar in the second slice. - -The hd_combo disk image is an example of this. It contains several -slices in one image file. The contents of this special disk image -are described below. - -The concept of slices applies ONLY to hard disks. Floppy disks are -not large enough to support multiple slices. - -Disk Image Contents -------------------- - -What follows is a brief description of the contents of the -disk images automatically provided in the RomWBW distribution. -Note that all of the OS images include the RomWBW custom -support apps. - -cpm22 - DRI CP/M 2.2 (Bootable Floppy and Hard Disk) - - Standard DRI CP/M 2.2 distribution files along with a few commonly - used utilities. - -zsdos - ZCPR1 + ZSDOS 1.1 (Bootable Floppy and Hard Disk) - - Contains ZCPR1 and ZSDOS 1.1. This is roughly equivalent to the - ROM boot contents, but provides a full set of the applications - and related files that would not all fit on the ROM drive. - -nzcom - NZCOM (Bootable Floppy and Hard Disk) - - Standard NZCOM distribution. Note that you will need to run the - NZCOM setup before this will run properly. You will need - to refer to the NZCOM documentation. - -cpm3 - DRI CP/M3 (Bootable Floppy and Hard Disk) - - Standard DRI CP/M 3 adaptation for RomWBW that is ready to run. - It can be started by running CPMLDR. - -zpm3 - ZPM3 (Bootable Floppy and Hard Disk) - - Simeon Cran's ZCPR 3 compatible OS for CP/M 3 adapted for RomWBW and - ready to run. It can be started by running CPMLDR (which seems - wrong, but ZPMLDR is somewhat broken). - -ws4 - WordStar 4 (Floppy and Hard Disk) - - Micropro Wordstar 4 full distribution. This image is not bootable - and is intended to be added as an additional slice to an OS image. - -bp - BPBIOS (Hard Disk only) - - Adaptation of BPBIOS for RomWBW. This is NOT complete and NOT - useable in it's current state. - -combo - Multi-Boot Combination (Bootable Hard Disk) - - A pre-created combo image that contains the following slices. The - slices are identical to the individual images listed above. - - Slice 0: cpm22 (bootable) - Slice 1: zsdos (bootable) - Slice 2: nzcom (bootable) - Slice 3: cpm3 (bootable) - Slice 4: zpm3 (bootable) - Slice 5: ws4 (not bootable) diff --git a/Binary/Makefile b/Binary/Makefile index c856d1b8..f4d4bec4 100644 --- a/Binary/Makefile +++ b/Binary/Makefile @@ -1,8 +1,8 @@ TOOLS = ../Tools MOREDIFF := $(shell $(TOOLS)/unix/casefn.sh *.img *.rom *.com *.eeprom) -SUBDIRS = Apps +SUBDIRS = Apps CPM3 ZPM3 include $(TOOLS)/Makefile.inc -clobber:: - rm -f *.bin *.com *.img *.rom *.pdf *.log *.eeprom +clean:: + @rm -f *.bin *.com *.img *.rom *.upd *.hex *.pdf *.log *.eeprom *.dat diff --git a/Binary/ReadMe.txt b/Binary/ReadMe.txt index 70156630..f4222ed9 100644 --- a/Binary/ReadMe.txt +++ b/Binary/ReadMe.txt @@ -42,6 +42,15 @@ MK4_custom.rom will be added to this directory. Documentation of the pre-built ROM Images is contained in the RomList.txt file in this directory. +ROM Firmware Update Images (_.upd) +------------------------------------- + +The files with a ".upd" extension are binary images identical to the +.rom files, but they only have the first 128K bytes. The first 128K +is the system image without the ROM disk contents. These files can be +used to update the system image without modifying the ROM disk +contents. Refer to the RomWBW User Guide for more information. + ROM Executable Images (_.com) --------------------------------------- @@ -66,8 +75,8 @@ 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) ------------------------------- +Disk Images (fd_*.img, hd_*.img, psys.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, @@ -87,10 +96,18 @@ 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. +Likewise, the hd512_*.img and hd1k_*.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: The hd512_*.img files are equivalent to the hd_*.img +files in previous distributions. The hd1k_*.img files +contained a revised file system format that increases the +maximum number of CP/M directory entries from 512 to 1024. +Refer to the ReadMe.txt in the Source/Images directory +for details. Documentation of the pre-built disk images is contained in the DiskList.txt file in this directory. @@ -100,6 +117,12 @@ the BuildImages.cmd script in the Source directory. Additional information on how to generate custom disk images is found in the Source\Images ReadMe.txt file. +The psys.img file contains a full implementation of the UCSD p-System +for the Z80 running under RomWBW. This image file must be placed on +disk media by itself (not appended or concatenated with hd*.img files. +Refer to the Source/pSys/ReadMe.txt file for more information on the +p-System implementation. + Propeller ROM Images (*.eeprom) ------------------------------- diff --git a/Binary/RomList.txt b/Binary/RomList.txt deleted file mode 100644 index 128e400e..00000000 --- a/Binary/RomList.txt +++ /dev/null @@ -1,218 +0,0 @@ -*********************************************************************** -*** *** -*** 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 - SBC SimH SBC_simh.rom - Zeta V1 ZETA_std.rom - Zeta V2 ZETA2_std.rom - N8 N8_std.rom - Mark IV MK4_std.rom - RC2014 w/ Z80 RCZ80_std.rom - RC2014 w/ Z180 RCZ180_nat.rom (native Z180 memory addressing) - RC2014 w/ Z180 RCZ180_ext.rom (external 512K RAM/ROM module) - SC-series SC126, SC130 - Easy Z80 EZZ180_std.rom - Dyno DYNO_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. - -WARNING: In a few cases the .com file is too big to load. If you get -a message like "Full" or "BAD LOAD" when trying to load one of the -.com files, it is too big. In these cases, you will not be able to -test the ROM prior to programming it. - -All of the standard ROM Images are configured for: - - 512KB ROM Disk - - 512KB RAM Disk - - 38.4Kbps baud serial console (*) - - Auto-discovery of all serial ports - -* RC2014 and Stephen Cousins' kits run at 115,200Kbps baud - -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 (SBC_std.rom): - - CPU speed is detected at startup - - Console on onboard UART serial port at 38400 baud - - 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. - -SBC (SBC_simh.rom): - - SBC variant customized to run under SimH - - Implments two emulated SimH hard disk images - - Uses SimH RTC - -ZETA (ZETA_std.rom): - - CPU speed is detected at startup - - Console on onboard UART serial port at 38400 baud - - 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. - -ZETA2 (ZETA2_std.rom): - - CPU speed is detected at startup - - Console on onboard UART serial port at 38400 baud - - 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. - - Uses CTC to generate periodic timer interrupts. - - 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 (N8_std.rom): - - CPU speed is detected at startup - - Console on Z180 onboard primary ASCI serial port at 38400 baud - - 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 (MK4_std.rom): - - CPU speed is detected at startup - - Console on Z180 onboard primary ASCI serial port at 38400 baud - - 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. - -RCZ80 (RCZ80_std.rom): - - Assumes CPU oscillator of 7.3728 MHz - - Requires 512K RAM/ROM module - - Auto detects Serial I/O Module (ACIA) and Dual Serial - Module (SIO/2). Either one may be used. - - Console on whichever serial module is installed, - but will use the SIO/2 if both are installed. Baud - rate is determined by hardware, but normally 115200. - - Includes support for RC2014 Compact Flash Module - - Support for RC2014 PPIDE Module may be enabled in config - - Support for Scott Baker SIO board may be enabled in config - - Support for Scott Baker floppy controllers (SMC & WDC) may - be enabled in config - -RCZ80 w/ KIO (RCZ80_kio.rom): - - Assumes CPU oscillator of 7.3728 MHz - - Requires 512K RAM/ROM module - - Requires KIO module - - Console on KIO primary serial port at 115200 baud - - Includes support for RC2014 Compact Flash Module - - Includes support for RC2014 PPIDE Module - - Support for Scott Baker SIO board may be enabled in config - - Support for Scott Baker floppy controllers (SMC & WDC) may - be enabled in config - -RCZ180 (RCZ180_nat.rom & RCZ180_ext.rom): - - Assumes CPU oscillator of 18.432 MHz - - Console on Z180 onboard primary ASCI serial port at 115200 baud - - Includes support for RC2014 Compact Flash Module - - Includes support for RC2014 PPIDE Module - - Support for alternative serial modules may be enabled in config - - Support for Scott Baker floppy controllers (SMC & WDC) may - be enabled in config - - You must pick the _nat or _ext variant depending on which - memory module you are using: - - RCZ180_nat.rom uses the built-in Z180 memory manager - for use with memory modules allow direct physical - addressing of memory, such as the SC119 - - RCZ180_ext.rom uses external bank management to access - memory, such as the 512K RAM/ROM module. - -SCZ180 (SCZ180_126.rom, SCZ180_130.rom, SCZ180_131.rom): - - Assumes CPU oscillator of 18.432 MHz - - Console on Z180 onboard primary ASCI serial port at 115200 baud - - Includes support for RC2014 Compact Flash Module - - Includes support for RC2014 PPIDE Module - - Support for alternative serial modules may be enabled in config - - Support for Scott Baker floppy controllers (SMC & WDC) may - be enabled in config - - The 3 different variants of SCZ180 are provided to match the - 3 corresponding systems (SC126, SC130, and SC131) designed by - Stephen Cousins. - -EZZ80 (EZZ80_std.rom): - - Assumes CPU oscillator of 10.000 MHz - - Console on primary SIO serial port at 115200 baud - - Includes support for on-board SIO - - Includes support for RC2014 Compact Flash Module - - Includes support for RC2014 PPIDE Module - -DYNO (DYNO_std.rom): - - Assumes CPU oscillator of 18.432 MHz - - Console on Z180 onboard serial ports at 38400 baud - - Includes support for BQ4842 RTC - - Includes support for onboard PPIDE - - Support for Dyno floppy controllers may be enabled in config diff --git a/Binary/ZPM3/Clean.cmd b/Binary/ZPM3/Clean.cmd new file mode 100644 index 00000000..116507c8 --- /dev/null +++ b/Binary/ZPM3/Clean.cmd @@ -0,0 +1,10 @@ +@echo off +setlocal + +if exist *.spr del *.spr +if exist *.com del *.com +if exist *.sys del *.sys +if exist *.pat del *.pat +if exist *.dat del *.dat +if exist *.zpm del *.zpm +if exist *.spr del *.spr diff --git a/Binary/ZPM3/Makefile b/Binary/ZPM3/Makefile new file mode 100644 index 00000000..95e533a1 --- /dev/null +++ b/Binary/ZPM3/Makefile @@ -0,0 +1,7 @@ +TOOLS = ../../Tools +MOREDIFF := $(shell $(TOOLS)/unix/casefn.sh *.spr) + +include $(TOOLS)/Makefile.inc + +clean:: + @rm -f *.spr *.com *.sys *.dat *.zpm diff --git a/Binary/ZPM3/ReadMe.txt b/Binary/ZPM3/ReadMe.txt new file mode 100644 index 00000000..dcdef396 --- /dev/null +++ b/Binary/ZPM3/ReadMe.txt @@ -0,0 +1,17 @@ +*********************************************************************** +*** *** +*** R o m W B W *** +*** *** +*** Z80/Z180 System Software *** +*** *** +*********************************************************************** + +This directory contains the ZPM3 system files for the RomWBW ZPM3 +adaptation. All of these files are already included on the ZPM3 +boot disk images. However if you are creating a CP/M 3 boot disk +manually, you should copy all of these files to the boot disk. + +These files should also be copied to any ZPM3 boot disks on your +system when you upgrade your ROM firmware. Some of these files +*must* match the version of the RomWBW firmware you are using for +proper operation of your system. \ No newline at end of file diff --git a/Binary/cpnos-wbw.sys b/Binary/cpnos-wbw.sys new file mode 100644 index 00000000..f0bdc137 Binary files /dev/null and b/Binary/cpnos-wbw.sys differ diff --git a/Build.cmd b/Build.cmd new file mode 100644 index 00000000..99a09b02 --- /dev/null +++ b/Build.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +pushd Source && call Build %* || exit /b & popd + +if "%*" == "" pause diff --git a/Clean.cmd b/Clean.cmd new file mode 100644 index 00000000..3c7b25e2 --- /dev/null +++ b/Clean.cmd @@ -0,0 +1,5 @@ +@echo off +setlocal + +pushd Binary && call Clean || exit /b 1 & popd +pushd Source && call Clean || exit /b 1 & popd diff --git a/Doc/ChangeLog.txt b/Doc/ChangeLog.txt index 5ddd4e80..606a6621 100644 --- a/Doc/ChangeLog.txt +++ b/Doc/ChangeLog.txt @@ -1,3 +1,100 @@ +Version 3.2 +----------- +- WBW: Version bump for release + +Version 3.1.1 +------------- +- WBW: Version bumped due to pervasive changes +- WBW: Preliminary hard disk partition support (backward compatible) +- WBW: Change Propeller VGA signal timings to 60Hz refresh +- WBW: Enhanced SYSTEM RESET function to allow a warm start back to boot loader +- C?O: Add DUART driver +- WBW: Early Z280 support (requires 512K RAM/ROM board) +- HCS: ZRC memory manager support +- S?K: Support for Tiny Z80 by Sergey +- E?B: Support for v6 YM/AY sound card +- C?M: Support for RCBus bus PropIO V2 +- W?S: Updated FLASH software to v1.3.4 +- PMS: Preliminary support for writing to FLASH ROMs +- PMS: Creation of process to update ROM system area w/o updating ROM disk contents +- PMS: Added "updater.asm" which allows uploading and updating ROM in one step +- WBW: Support for Z280 w/ native memory and interrupt mode 3 +- WBW: Support for Z280 UART (interrupt driven only in interrupt mode 3) +- WBW: Add support Z80-512K (watchdog and LED) +- WBW: Add support for ZZ80MB address map +- PLS: Add support for Z180 invalid opcode trap +- WBW: Add support for ZZRCC +- WBW: Allow selection of RAM/ROM disk individually in build +- WBW: Support 256KB ROM size +- WBW: CP/M 3 RTC support is now complete (reads and writes RTC date/time) +- WBW: Add config to allow swapping logical order of MT011 SPI ports +- WBW: COPY.COM updated from v1.72 -> v1.73 throughout distribution +- D?M: CP/NET for CP/M 2.2 and CP/M 3 (requires MT011) +- D?M: SD driver fixes for MT011 +- J?C: Added FIND application from Jay Cotton +- PMS: Preliminary support for I2C-based DS1307 clock +- WBW: FD driver auto hardware detect (thanks Alan Cox) +- D?N: Added support for TMS V9958 VDU +- D?N: Added support for MSX keyboard +- D?N: Added support for RP5C01 RTC +- L?N: Slightly enhanced ZCPRD&J w/ a couple bug fixes +- L?N: UNZIPZ4 which handles most modern ZIP file compression algorithms +- AJL: Preliminary support for MBC systems +- WBW: Added preliminary support for DSKYng +- WBW: Elevated MBC to a platform +- WBW: Added support for MBC user LEDs +- PMS: Early DMA support +- W?S: Updated FLASH software to v1.3.5 (supports 128KB A29010B, 512KB A29040B) +- DDW: Support for DSKYng capabitlities +- WBW: Added Phil Summers' ROM Updater into ROM Loader +- AJL: Added ramtest app (requires SBC and MBC for now) +- L?N: Provided SCOPY, XSUB01, and EX applications +- WBW: Added support for MBC FDC to FDU application +- WBW: Added support for MBC FDC to HBIOS +- WBW: Refactored make process +- WBW: Added ROM verification to boot process +- WBW: Added Z80 instruction test apps to user area 5 in CP/M & ZSDOS +- WBW: Add support for LINC sound card +- WBW: Add interrupt receive support to UART driver +- PMS: Add XModem transfer within Debug Monitor +- PMS & AJL: Add DMAMON test application +- PMS: Add ZMP adaptation +- LWN: Substantial BPBIOS cleanup +- AJL: Add ZMD adaptation +- D?T: Substantial update to TastyBasic incuding a .COM executable +- PMS: Added VGM audio file player +- WBW: ZPMLDR and ZPM3 fixes, credit to Lars Nelson for finding ZPM3 source! +- DDW: Add support for MBC sound card +- WBW: Add support for "romless" booting +- L?N: Fixes for ZCPR-D&J (buffer overflow, default drive/user) +- J?P: Add support for DS1501 RTC +- LLS: Added a user defined mode for SD Card interfaces (not complete) +- L?N: Updated ZDE to v1.8 including time stamp preservation fixes +- D?M: Minor update to CP/NET client files, fix to CPNBOOT +- WBW: Added p-System IV.0 Z80 implementation +- WBW: Hacked SURVEY to work around bank switching crash + +Version 3.1 +----------- +- WBW: Refactored ROM Loader +- WBW: INTRTC periodic timer based clock +- WBW: FDISK80 updated to allow reserving up to 256 slices +- WBW: Added support dual 16C550 UART on RCBus platform +- WBW: Made .com images smaller (contain only Z-System now) +- WBW: Support automatic clock hardware detection and fallback +- WBW: Support use of CTC for SIO baud rate divisors +- WBW: Updated IDE and PPIDE drivers to improve old CF Card compatibility +- WBW: Support TIMER mode in CTC driver +- DEN: Added sound driver support +- DEN: Added SN76489 sound chip driver +- M?O: RomWBW Disk Catalog document +- DEN: Updated TMS to optionally trigger SYSTIMER interrupt (TMSTIMENABLE) +- J?M: Updated KERMIT applications with VT100 terminal support +- A?C: Added support for EPFDC +- PMS: Added AY driver with new sound API support +- DEN: Allow immediate autoboot startup +- DEN: Support for floppy device count parameter + Version 3.0.1 ------------- - WBW: Increase XModem timeout waiting for host to start sending @@ -20,8 +117,8 @@ Version 2.9.2 - WBW: Support two SIO modules w/ auto-detection - PMS: Support ECB USB-FIFO board - WBW: Fixed ASSIGN issue with incorrect DPB selection -- WBW: Add RC2014 Z180 AY sound support to TUNE app -- WBW: Add RC2014 AY sound support to AY driver +- WBW: Add RCBus Z180 AY sound support to TUNE app +- WBW: Add RCBus AY sound support to AY driver - WBW: Add SC126 platform - WBW: Config files cleanup - WBW: Add interrupt support to ASCI driver @@ -40,7 +137,7 @@ Version 2.9.2 - PMS: Add sound support to NASCOM BASIC - WBW: Updated FAT to add MD and FORMAT commands - WBW: Add CP/M 3 (experimental) -- M?T: Support Shift register SPI WIZNET for RC2014 +- M?T: Support Shift register SPI WIZNET for RCBus - PLS: Added seconds register in HBIOS - WBW: More flexible table-driven config in TUNE.COM - PMS: Added timer support for Zilog Peripherals ECB Board @@ -68,7 +165,7 @@ Version 2.9.2 Version 2.9.1 ------------- -- E?B: Added support for RC2014 RTC +- E?B: Added support for RCBus RTC - WBW: Converted PTXPLAY to TUNE (now plays PT2/PT3/MYM sounds files) - WBW: Updated Win32DiskImager to v1.0 - WBW: Implemented character attributes on Propeller based consoles @@ -78,7 +175,7 @@ Version 2.9.1 - WBW: Update default IOBYTE so that LST:=LPT: by default - WBW: Fixed missing drive/head setup for writes in PPIDE - WBW: Fixed XModem HBIOS console driver for file send operations -- WBW: Preliminary support for RC180 platform (Z180 module in RC2014) +- WBW: Preliminary support for RC180 platform (Z180 module in RCBus) - WBW: Added NZCOM distribution files to third slice of hard disk image - WBW: Fixed getnum32 bug in MODE command (found by Phil Summers) - PMS: Added serial support for Zilog Peripherals Baord @@ -90,32 +187,32 @@ Version 2.9.1 - PMS: Added Forth, Nascom BASIC, and Tasty BASIC to ROM - PMS: Refactored ROM Loader to support more ROM images, now table driven - WBW: Refactored DSKY code -- SK: Initial support for Easy Z80 +- S?K: Initial support for Easy Z80 - PMS: Enhance VDU driver to support alternative screen dimensions - WBW: DDT and DDTZ modified to use RST 30 instead of RST 38 to avoid conflicts with IM 1 interrupts - WBW: Added timer interrupt support for CTC under Zeta 2 and Easy Z80 - WBW: Support LBA style access in floppy driver - WBW: Added beta version of FAT filesystem utility (copy, dir, del, ren) -- SCC: Added support for native memory addressing on Z180-based RC2014 +- SCC: Added support for native memory addressing on Z180-based RCBus - PMS: Dynamically discover and display processor type at boot - J?L: Added German keyboard support to PPK and KBD drivers Version 2.9.0 ------------- - WBW: Implemented multi-sector I/O in all disk drivers -- WBW: Added support for RC2014 SMB Floppy controller modules (SMC and WDC) +- WBW: Added support for RCBus SMB Floppy controller modules (SMC and WDC) - WBW: New function dispatching for character/disk/video drivers -- WBW: Updated FDU app to support RC2014 floppy controllers +- WBW: Updated FDU app to support RCBus floppy controllers - WBW: Added TIMER app to display system timer value - WBW: Refactored interrupt management code - WBW: Added PTXPLAY application and sample tunes Version 2.8.6 ------------- -- WBW: Added support for RC2014 (SIO and ACIA drivers primarily) +- WBW: Added support for RCBus (SIO and ACIA drivers primarily) - WBW: Automatically detect and run PROFILE.SUB on boot drive if it exists - WBW: Fixed Dual SD Board detection -- WBW: Added console support to XModem (for RC2014 primarily) +- WBW: Added console support to XModem (for RCBus primarily) - E?B: Fixed IDE/PPIDE when used with non-CF drives - WBW: Patched SUBMIT.COM so that it always puts temp file on A: for immediate execution - WBW: Accommodate spin up time for true IDE hard disks (IDE or PPIDE) @@ -268,7 +365,7 @@ Version 2.0 - DWG: Entire new suite of Apps written in Aztec C - DWG: BANKER.COM - displays bank identification and version information - DWG: CPMNAME.COM - displays CBIOS header data and SYSCFG data, names and vaues -- DWG: CHARS.COM - displays ascii map as reference +- DWG: CHARS.COM - displays ascii map as reference - DWG: CLS.COM - clears screen - DWG: LABEL.COM - displays and changes drive labels for drives with reserved tracks - DWG: MAP.COM - like old map command, displays drives and logical unit labels and changes LU values @@ -300,7 +397,7 @@ Version 1.5.1 - WBW: Added ZSDOS clock drivers (see Support\Clock) - WBW: Overhaul of ZSystem ROM Disk (see Doc\ZSystem.txt) - WBW: Update PropIO ANSI emulation for compatiblity with ASSIGN -- DWG: Added version tags to all applications, and IDENT program to +- DWG: Added version tags to all applications, and IDENT program to check version of utilities. - DWG: Added MULTIFMT program which prepares new media for use by initializing the metadata and clearing the directory sectors of @@ -310,8 +407,8 @@ Version 1.5.1 - DWG: ANALYSE and HELLO programs removed from ROM due space concerns - DWG: Additional macro librarties added supporting program identification (IDENTITY.LIB/ASM) and access to drive metadata (METADATA.LIB/ASM), - and realtime selection of logical units from within new application - programs (LOGICALS.LIB/ASM). + and realtime selection of logical units from within new application + programs (LOGICALS.LIB/ASM). - DWG: Added TERM_VT52 for VDU compatbility, all apps now compliant - DGG: Contributed Linux build (see Doc\BuildLinux.txt) @@ -339,7 +436,7 @@ Version 1.4 - DWG: Add various .SUB files used for application maintenance - DWG: Enhanced utility building .SUB files to only contain libs utilitized - DWG: Add BUILD.SUB to build all applications and DEVFILES.LBR -- DWG: Add/update RMAC macro libraries used in Apps - +- DWG: Add/update RMAC macro libraries used in Apps - - DWG: BIOSHDR, STDLIB, STRCPY, STRLEN, CPMBIOS, CPMBDOS, TERMINAL, HARDWARE, - DWG: CPMAPPL, GLOBALS, ATOI, LUBIND, APPLVERS, MEMORY(memcpy,memset), PORTAB - DWG: Add/Repair BIOS support for Boot Drive login during CP/M Coldstart @@ -358,7 +455,7 @@ Version 1.4 - DWG: Add LABEL utility to insert label into drive/slice metadata - DWG: Add 16 char label field to metadata - DWG: ASSIGN utility displays and manipulates DPH/DPB & logical unit parameters -- DWG/WBW: Collaborated on design of Logical Unit DPH enhancemnt +- DWG/WBW: Collaborated on design of Logical Unit DPH enhancemnt - WBW: Proposed MAP utility functionality - WBW: Implement slice selection API for DSK devices - WBW: Record boot drive in config memory at load time diff --git a/Doc/Contrib/Flash4.txt b/Doc/Contrib/Flash4.txt deleted file mode 100644 index 327f8c84..00000000 --- a/Doc/Contrib/Flash4.txt +++ /dev/null @@ -1,186 +0,0 @@ - - FLASH4 (c) 2014 William R Sowerbutts - http://sowerbutts.com/8bit/ - -= Warning = - -FLASH4 has been tested and confirmed working on: - * N8VEM SBCv2 - * N8VEM N8-2312 - * N8VEM Mark IV SBC - * DX-Designs P112 - * ZETA SBC v2 - -However it remains somewhat experimental. If it works for you, please let me -know. If it breaks please also let me know so I can fix it! - - -= Introduction = - -FLASH4 is a CP/M program which can read, write and verify Flash ROM contents to -or from an image file stored on a CP/M filesystem. It is intended for in-system -programming of Flash ROM chips on Z80 and Z180 systems. - -FLASH4 aims to support a range of Flash ROM chips. Ideally I would like to -support all Flash ROM chips that are in use in Z80/Z180 N8VEM machines. If -FLASH4 does not support your chip please let me know and I will try to add -support. - -When writing to the Flash ROM chip, FLASH4 will only reprogram the sectors -whose contents have changed. This helps to reduce wear on the flash memory, -makes the reprogram operation faster, and reduces the risk of leaving the -system unbootable if power fails during a reprogramming operation. FLASH4 -always performs a full verify operation after writing to the chip to confirm -that the correct data has been loaded. - -FLASH4 is reasonably fast. Reprogramming and verifying every sector on a 512KB -SST 39F040 chip takes 21 seconds on my Mark IV SBC, versus 45 seconds to -perform the same task using a USB MiniPro TL866 EEPROM programmer under Linux -on my PC. If only a subset of sectors require reprogramming FLASH4 will be -even faster. - -FLASH4 works with binary ROM image files, it does not support Intel Hex format -files. Hex files can be easily converted to or from binaries using "hex2bin" or -the "srec_cat" program from SRecord: - - $ srec_cat image.hex -intel -fill 0xFF 0 0x80000 -output image.bin -binary - $ srec_cat image.bin -binary -output image.hex -intel - -FLASH4 can use several different methods to access the Flash ROM chip. The best -available method is determined automatically at run time. Alternatively you may -provide a command-line option to force the use of a specific method. - -The first two methods use bank switching to map sections of the ROM into the -CPU address space. FLASH4 will detect the presence of RomWBW or UNA BIOS and -use the bank switching methods they provide. - -On P112 systems the P112 B/P BIOS is detected and P112 bank switching is used. - -If no bank switching method can be auto-detected, and the system has a Z180 -CPU, FLASH4 will use the Z180 DMA engine to access the Flash ROM chip. This -does not require any bank switching but it is slower and will not work on all -platforms. - -Z180 DMA access requires the flash ROM to be linearly mapped into the lower -region of physical memory, as it is on the Mark IV SBC (for example). The -N8-2312 has additional memory mapping hardware, consequently Z180 DMA access on -the N8-2312 is NOT SUPPORTED and if forced will corrupt the contents of RAM; -use one of the supported bank switching methods instead. - -Z180 DMA access requires the Z180 CPU I/O base control register configured to -locate the internal I/O addresses at 0x40 (ie ICR bits IOA7, IOA6 = 0, 1). - - -= Usage = - -The three basic operations are: - - FLASH4 WRITE filename [options] - -This will rewrite the flash ROM contents from the named file. The file size -must exactly match the size of the ROM chip. After the write operation, a -verify operation will be performed automatically. - - FLASH4 VERIFY filename [options] - -This will read out the flash ROM contents and report if it matches the contents -of the named file. The file size must exactly match the size of the ROM chip. - - FLASH4 READ filename [options] - -This will read out the entire flash ROM contents and write it to the named -file. - -If your ROM chip is larger than the image you wish to write, use the "/PARTIAL" -(or "/P") command line option. To avoid accidentally flashing the wrong file, -the image file must be an exact multiple of 32KB in length. The portion of the -ROM not occupied by the image file is left either unmodified or erased. - -If you are using an ROM/EPROM/EEPROM chip which cannot be programmed in-system, -FLASH4 will not be able to recognise it, however the software can still -usefully READ and VERIFY the chip. Use the "/ROM" command line option to enable -"READ" or "VERIFY" mode with unrecognised chips. This mode assumes a 512K ROM -is fitted; smaller ROMs will be treated as a 512K ROM with the data repated -multiple times -- with a 256K chip the data is repeated twice, four times for a -128K chip, etc. - -One of the following optional command line arguments may be specified at the -end of the command line to force FLASH4 to use a particular method to access -the flash ROM chip: - -BIOS interfaces: - /ROMWBW For ROMWBW BIOS version 2.6 and later - /ROMWBWOLD For ROMWBW BIOS version 2.5 and earlier - /UNABIOS For UNA BIOS - -Direct hardware interfaces: - /Z180DMA For Z180 DMA - /P112 For DX-Designs P112 - /N8VEMSBC For N8VEM SBC (v1, v2), Zeta (v1) SBC - -If no option is specified FLASH4 attempts to determine the best available -method automatically. - - -= Supported chips and features = - -FLASH4 will interrogate your flash ROM chip to identify it automatically. -FLASH4 assumes that you have a single flash ROM device and it is located at the -bottom of the physical memory map. - -FLASH4 does not support setting or resetting the protection bits on individual -sectors within Flash ROM devices. If your Flash ROM chip has protected sectors -you will need to unprotect them by other means before FLASH4 can erase and -reprogram them. - -AT29C series chips employ an optional "software data protection" feature. This -is supported by FLASH4 and is left activated after programming the chip to -prevent accidental reprogramming of sectors. - -The following chips are supported: - - AT29F010 - AT29F040 - M29F010 - M29F040 - MX29F040 - SST 39F010 - SST 39F020 - SST 39F040 - AT29C512 - AT29C040 - AT29C010 - AT29C020 - -The following chips are supported but have unequal sector sizes; FLASH4 will -only erase and reprogram the entire chip at once rather than its normal -sector-by-sector operation: - - AT49F001NT - AT49F001N - AT49F002N - AT49F002NT - AT49F040 - -If you use a flash ROM chip that is not listed above please email me -(will@sowerbutts.com) and I will try to add support for it. - - -= Compiling = - -The software is written in a mix of C and assembler. It builds using the SDCC -toolchain and the SRecord tools. A Makefile is provided to build the executable -in Linux and I imagine it can be easily modified to build in Windows. - -You may need to adjust the path to the SDCC libraries in the Makefile if your -sdcc installation is not in /usr/local - - -= License = - -FLASH4 is licensed under the The GNU General Public License version 3 (see -included "LICENSE.txt" file). - -FLASH4 is provided with NO WARRANTY. In no event will the author be liable for -any damages. Use of this program is at your own risk. May cause rifts in space -and time. diff --git a/Doc/Contrib/How to Make Disk Images in Linux with DD Command.pdf b/Doc/Contrib/How to Make Disk Images in Linux with DD Command.pdf new file mode 100644 index 00000000..d2c6835c Binary files /dev/null and b/Doc/Contrib/How to Make Disk Images in Linux with DD Command.pdf differ diff --git a/Doc/Contrib/Microsoft NASCOM BASIC.docx b/Doc/Contrib/Microsoft NASCOM BASIC.docx index 68af9472..ca100dd6 100644 Binary files a/Doc/Contrib/Microsoft NASCOM BASIC.docx and b/Doc/Contrib/Microsoft NASCOM BASIC.docx differ diff --git a/Doc/Contrib/PPI_Bus.txt b/Doc/Contrib/PPI_Bus.txt new file mode 100644 index 00000000..7b5fa7d9 --- /dev/null +++ b/Doc/Contrib/PPI_Bus.txt @@ -0,0 +1,39 @@ + +PPI Signal PPIDE PPISD DSKY DSKYNG (PROTO) DSKYNG (FINAL) +---------- ----- ----- ----- ----- ----- +PA0 <>D0 >ID0 <>D0 <>D0 +PA1 <>D1 >ID1 <>D1 <>D1 +PA2 <>D2 >ID2 <>D2 <>D2 +PA3 <>D3 >ID3 <>D3 <>D3 +PA4 <>D4 >ID4 /SHUTDOWN <>D4 <>D4 +PA5 <>D5 >ID5 /DECODE <>D5 <>D5 +PA6 <>D6 >ID6 HEXA/CODEB <>D6 <>D6 +PA7 <>D7 >ID7 DAT_COMING <>D7 <>D7 + +PB0 <>D8 +D9 +D10 +D11 +D12 +D13 +D14 + +PB7 <>D15 DA0 >MOSI >COL0 >A0 >A0 +PC1 >DA1 >CLK >COL1 >/WR +PC2 >DA2 >COL2 >/RD +PC3 >CS0* >COL3 >CS&* >CS&* +PC4 >CS1* >/CS >CS&* >CS&* +PC5 >DIOW* >/WR +PC6 >DIOR* >/WR >/RD +PC7 >RESET* >MODE >RESET >RESET + +* Inverted by adapter ++ Pullup +& Both signals must be asserted + +Compatibility: + +- PPISD & DSKY +- PPIDE & DSKYNG +- PPISD & DSKYNG diff --git a/Doc/DDTZ.doc b/Doc/DDTZ.doc deleted file mode 100644 index 46da2d3b..00000000 --- a/Doc/DDTZ.doc +++ /dev/null @@ -1,564 +0,0 @@ - - DDTZ v2.7 - by C.B. Falconer - edited by George A. Havach - -Introduction: -============ -DDTZ v2.7 is a complete replacement for DDT, Digital Research's -famous Dynamic Debugging Tool, with improved functionality, bug -extermination, and full Z80 support. In general, DDTZ is fully -compatible with the original utility, but it has extra and -extended commands and many fewer quirks. All Z80-specific -instructions can be (dis)assembled, though in Intel rather then -Zilog format. Furthermore, DDTZ will correctly trace ('T' and 'U' -commands) both 8080 and Z80 instructions, depending on which CPU -is operating. On startup, the program announces which CPU it is -running on. - -DDTZ v2.7 now handles the 64180 added opcodes. It does NOT test -for a 64180 CPU, since this cannot be done without executing -illegal Z80 instructions, which in turn will crash some -simulators. However v2.7 does not execute any 64180 instructions -internally, only in the subject program. - -This issue supplies the "M" version assembled, to avoid errors -when switching between MSDOS and CPM systems. The command table -is updated accordingly. Most CPM users are also MSDOS users, but -not vice-versa. - -The program is invoked by typing - - ddtz -or - ddtz [d:]filespec - -In the second form, DDTZ will load the specified file into -memory starting at 0100H, unless it's a .HEX file that sets its -own load address. Besides reporting the NEXT free address and -the PC (program counter) after a successful load, DDTZ also shows -the number of memory pages needed for a SAVE. Instead of having -to write all this down, just use the 'X' command at any time to -redisplay these three values for the current application. - -NOTE: loading more code above the NEXT pointer revises these - values. - -As in DDT, when a program is loaded above the area holding the -'A' and 'U' (and now 'W') command code, these commands are -disabled, and the extra memory is released to the user. Thus, -DDTZ can occupy as little as 3K total memory space. Unlike DDT, -however, DDTZ will not overwrite itself or the system on program -loads (except .HEX files). - -At initialization, the stack pointer (SP) points to a return to -DDTZ, just like for the CCP. Thus, programs that normally return -to the CCP will be returned to DDTZ. The 'B' command -reinitializes this condition. - - -The intercept vector copies the BDOS version number, etc., so -an object program does not know that DDTZ is running (except -for BIOS-BDOS vector size). Thus, programs that check the version -number should execute correctly under DDTZ. - -All input parameters can now be entered in any of three formats: - - (1) hexadecimal (as in DDT), - (2) decimal, by adding a leading '#' character, - (3) ASCII, by enclosing between either single or double - quotes; either one or two characters are allowed. - -Leading blanks in command lines and parameters are absorbed. -Either a comma or a (single) space is a valid delimiter. -Either uppercase or lowercase input is accepted. - -The default command (for anything not otherwise recognizable) -is 'H'. This allows convenient calculation, along with the other -features described below. So, to convert a number, just enter -it! - -As in DDT, the prompt character is '-', and the only error -message is the query ('?'), which generally kicks you back to -command mode. - -New Commands (Over DDT): -======================= - -NOTE: letters in parenthesis, e.g. "(U)", show the equivalent - command for DDTZM version (compatible with MSDOS debug). - - @ Sets or shows (with no parameter) the internally stored - "base" value. Also used with the 'S' and 'D' commands as - an optional parameter (though without the '@') to display - memory from an arbitrary base marker (offset). When set to - zero (the default), it does not affect any screen displays. - - B B)egin: resets the USER stack pointer to its initial value, - such that any program that exits by an RET will return to - DDTZ. DDTZ provides a default stack space of - approximately 24 bytes for user programs. - - C C)ompare first_address,last_address,against_address: shows - all the byte differences between two memory areas, in the - format - - XXXX aa YYYY bb - - where XXXX and YYYY are the comparative memory addresses, - and aa and bb are the corresponding byte values. Can be - used to verify the identity of two files by first - loading them into different memory areas with the 'R' - command (see below). - - - W Write: stores the modified memory area to disk under the - (K) filename specified by the 'I' command, overwriting the - original file from which it was loaded (the user is queried - before doing so). By default, the image of memory from - 0100H through the "NEXT" value -1 is saved. "K first_addr, - last_address" overrides this and allows writing ANY memory - area to a file. Almost a necessity for CPM 3.0 (no SAVE!). - K)eep on DDTZ - - X eXamine: redisplays the "NEXT PC SAVE" report at any time. - (Q) Q)uery size on DDTZ. - - S S)earch first_address, last_addr, value: searches the - (W) specified memory area for the value (a 16-bit word, not a - byte) and shows the locations of all such. Very useful for - finding CALL's or JMP's to a particular address, etc. - W)here on DDTZ - - Y Y)our_option parm1,parm2,address: executes an arbitrary - routine at the specified address, with the BC and DE - registers set to parm1 and parm2, respectively. - - Z Displays (but does not alter) the Z80's alternate register - set, including the index registers (disabled if running on - an 8080). On Z80's, automatically included as the last - part of the display by the 'X' command. - - -Based (Offset) Displays: -======================= - -The 'D' and 'E' commands can use a stored base value (offset), -as set by the '@' command. The current @ value may be -overridden for a single execution of these commands by adding the -base as an extra parameter in the command line. The effect is -to add this value to the first/last address and display -accordingly. The address listing on the left becomes XXXX:YYYY, -where XXXX is the offset address and YYYY is the actual memory -address being displayed. For example, if you have a data area -located at 42B7H and wish to preserve easy access, just enter -"@42b7". Now, "d0,3f" will dump memory starting at 4237H. - - -Further Changes from DDT: -======================== - - A A)ssemble now accepts the full Z80 as well as 8080 - instruction set, although it expects them in Intel rather - than Zilog format (see notes below under the 'L' - command). When in doubt, see the mnemnonic list below. - - D D)isplay or D)ump will accept an optional third parameter - to set the base value for a single execution only. Format - has been cleaned up. - - H H)ex_arithmetic on two values also shows their - difference in decimal. With only one value, converts to - hexadecimal, decimal, and ASCII (low-order byte only). - - - N N)ame now allows drive specification (d:...) and sets up - (I) the complete command line, including both FCB's (at - addresses 005CH and 006CH). The tail (stored at 0081H up) - is NOT upshifted. - I)nput on DDTZ - - U U)nassemble now displays the raw hexcode, especially handy - (L) when examining non-code areas. Intel (8080 style) mnemonics - are used, so some disassembled instructions may look - strange. E.g., the Z80's 'IN B,(C)' and 'OUT (C),B' become - 'INP B' and 'OUTP B', respectively; 'LD (nnnn),BC' becomes - 'SBCD nnnn', 'ADD IX, BC' becomes 'DADX B', and 'JP (IX)' - becomes 'PCIX'. - L)ist on DDTZ - - L L)oad now permits loading a file into memory with an - (R) offset, which is added to the default load address of - 0100H. When reading in a .HEX file with a preset bias, - the 'R' command will not transfer control to an invalid - execution point. Another execution of the 'R' command will - reread the input file, e.g.: - - n blah - l - ...modify the code and generally mess about... - l - - The original file is reloaded, and the modifications are - removed. - R)ead on DDTZ - - E E)nter, like D)isplay, now accepts an optional second - (S) parameter to set the base value for a single execution - only. - S)ubstitute or S)et on DDTZ - - T T)rap/trace on termination now shows the complete CPU - state. Traps and traces no longer lock up when a user RST - 7 instruction is executed. Tracing of BDOS/BIOS calls is - heavily trun cated, avoiding clutter and preventing system - crashes. - -NOTE: Most of the UNDOCUMENTED Z80 op-codes are handled. Others - can crash the system. - - R R)egisters also shows what two-byte values the HL and SP - (X) registers are actually pointing to. On Z80's, displays the - alternate register set. - eX)amine on DDTZ - -NOTE: Any use of the 'W' or 'L' command resets the system DMA - transfer address to the standard default value of 0080H. - - -; This is the output of DDTZ when disassembling OPTYPE.TRY -NOP LDA 06A4 MOV M,H -LXI B,06A4 DCX SP MOV M,L -STAX B INR A HLT -INX B DCR A MOV M,A -INR B MVI A,20 MOV A,B -DCR B CMC MOV A,C -MVI B,20 MOV B,B MOV A,D -RLC MOV B,C MOV A,E -EXAF MOV B,D MOV A,H -DAD B MOV B,E MOV A,L -LDAX B MOV B,H MOV A,M -DCX B MOV B,L MOV A,A -INR C MOV B,M ADD B -DCR C MOV B,A ADD C -MVI C,20 MOV C,B ADD D -RRC MOV C,C ADD E -DJNZ 0134 MOV C,D ADD H -LXI D,06A4 MOV C,E ADD L -STAX D MOV C,H ADD M -INX D MOV C,L ADD A -INR D MOV C,M ADC B -DCR D MOV C,A ADC C -MVI D,20 MOV D,B ADC D -RAL MOV D,C ADC E -JR 0134 MOV D,D ADC H -DAD D MOV D,E ADC L -LDAX D MOV D,H ADC M -DCX D MOV D,L ADC A -INR E MOV D,M SUB B -DCR E MOV D,A SUB C -MVI E,20 MOV E,B SUB D -RAR MOV E,C SUB E -JRNZ 0134 MOV E,D SUB H -LXI H,06A4 MOV E,E SUB L -SHLD 06A4 MOV E,H SUB M -INX H MOV E,L SUB A -INR H MOV E,M SBB B -DCR H MOV E,A SBB C -MVI H,20 MOV H,B SBB D -DAA MOV H,C SBB E -JRZ 0134 MOV H,D SBB H -DAD H MOV H,E SBB L -LHLD 06A4 MOV H,H SBB M -DCX H MOV H,L SBB A -INR L MOV H,M ANA B -DCR L MOV H,A ANA C -MVI L,20 MOV L,B ANA D -CMA MOV L,C ANA E -JRNC 0134 MOV L,D ANA H -LXI SP,06A4 MOV L,E ANA L -STA 06A4 MOV L,H ANA M -INX SP MOV L,L ANA A -INR M MOV L,M XRA B -DCR M MOV L,A XRA C -MVI M,20 MOV M,B XRA D -STC MOV M,C XRA E -JRC 0134 MOV M,D XRA H -DAD SP MOV M,E XRA L - - -XRA M JPE 06A4 SLAR M -XRA A XCHG SLAR A -ORA B CPE 06A4 SRAR B -ORA C XRI 20 SRAR C -ORA D RST 5 SRAR D -ORA E RP SRAR E -ORA H POP PSW SRAR H -ORA L JP 06A4 SRAR L -ORA M DI SRAR M -ORA A CP 06A4 SRAR A -CMP B PUSH PSW SLLR B -CMP C ORI 20 SLLR C -CMP D RST 6 SLLR D -CMP E RM SLLR E -CMP H SPHL SLLR H -CMP L JM 06A4 SLLR L -CMP M EI SLLR M -CMP A CM 06A4 SLLR A -RNZ CPI 20 SRLR B -POP B RST 7 SRLR C -JNZ 06A4 RLCR B SRLR D -JMP 06A4 RLCR C SRLR E -CNZ 06A4 RLCR D SRLR H -PUSH B RLCR E SRLR L -ADI 20 RLCR H SRLR M -RST 0 RLCR L SRLR A -RZ RLCR M BIT 0,B -RET RLCR A BIT 0,C -JZ 06A4 RRCR B BIT 0,D -CZ 06A4 RRCR C BIT 0,E -CALL 06A4 RRCR D BIT 0,H -ACI 20 RRCR E BIT 0,L -RST 1 RRCR H BIT 0,M -RNC RRCR L BIT 0,A -POP D RRCR M BIT 1,B -JNC 06A4 RRCR A BIT 1,C -OUT 20 RALR B BIT 1,D -CNC 06A4 RALR C BIT 1,E -PUSH D RALR D BIT 1,H -SUI 20 RALR E BIT 1,L -RST 2 RALR H BIT 1,M -RC RALR L BIT 1,A -EXX RALR M BIT 2,B -JC 06A4 RALR A BIT 2,C -IN 20 RARR B BIT 2,D -CC 06A4 RARR C BIT 2,E -SBI 20 RARR D BIT 2,H -RST 3 RARR E BIT 2,L -RPO RARR H BIT 2,M -POP H RARR L BIT 2,A -JPO 06A4 RARR M BIT 3,B -XTHL RARR A BIT 3,C -CPO 06A4 SLAR B BIT 3,D -PUSH H SLAR C BIT 3,E -ANI 20 SLAR D BIT 3,H -RST 4 SLAR E BIT 3,L -RPE SLAR H BIT 3,M -PCHL SLAR L BIT 3,A - - -BIT 4,B RES 3,D SET 2,H -BIT 4,C RES 3,E SET 2,L -BIT 4,D RES 3,H SET 2,M -BIT 4,E RES 3,L SET 2,A -BIT 4,H RES 3,M SET 3,B -BIT 4,L RES 3,A SET 3,C -BIT 4,M RES 4,B SET 3,D -BIT 4,A RES 4,C SET 3,E -BIT 5,B RES 4,D SET 3,H -BIT 5,C RES 4,E SET 3,L -BIT 5,D RES 4,H SET 3,M -BIT 5,E RES 4,L SET 3,A -BIT 5,H RES 4,M SET 4,B -BIT 5,L RES 4,A SET 4,C -BIT 5,M RES 5,B SET 4,D -BIT 5,A RES 5,C SET 4,E -BIT 6,B RES 5,D SET 4,H -BIT 6,C RES 5,E SET 4,L -BIT 6,D RES 5,H SET 4,M -BIT 6,E RES 5,L SET 4,A -BIT 6,H RES 5,M SET 5,B -BIT 6,L RES 5,A SET 5,C -BIT 6,M RES 6,B SET 5,D -BIT 6,A RES 6,C SET 5,E -BIT 7,B RES 6,D SET 5,H -BIT 7,C RES 6,E SET 5,L -BIT 7,D RES 6,H SET 5,M -BIT 7,E RES 6,L SET 5,A -BIT 7,H RES 6,M SET 6,B -BIT 7,L RES 6,A SET 6,C -BIT 7,M RES 7,B SET 6,D -BIT 7,A RES 7,C SET 6,E -RES 0,B RES 7,D SET 6,H -RES 0,C RES 7,E SET 6,L -RES 0,D RES 7,H SET 6,M -RES 0,E RES 7,L SET 6,A -RES 0,H RES 7,M SET 7,B -RES 0,L RES 7,A SET 7,C -RES 0,M SET 0,B SET 7,D -RES 0,A SET 0,C SET 7,E -RES 1,B SET 0,D SET 7,H -RES 1,C SET 0,E SET 7,L -RES 1,D SET 0,H SET 7,M -RES 1,E SET 0,L SET 7,A -RES 1,H SET 0,M DADX B -RES 1,L SET 0,A DADX D -RES 1,M SET 1,B LXI X,06A4 -RES 1,A SET 1,C SIXD 06A4 -RES 2,B SET 1,D INX X -RES 2,C SET 1,E DADX X -RES 2,D SET 1,H LIXD 06A4 -RES 2,E SET 1,L DCX X -RES 2,H SET 1,M INR [X+05] -RES 2,L SET 1,A DCR [X+05] -RES 2,M SET 2,B MVI [X+05],20 -RES 2,A SET 2,C DADX SP -RES 3,B SET 2,D MOV B,[X+05] -RES 3,C SET 2,E MOV C,[X+05] - - -MOV D,[X+05] DSBC B DADY B -MOV E,[X+05] SBCD 06A4 DADY D -MOV H,[X+05] NEG LXI Y,06A4 -MOV L,[X+05] RETN SIYD 06A4 -MOV [X+05],B IM0 INX Y -MOV [X+05],C LDIA DADY Y -MOV [X+05],D INP C LIYD 06A4 -MOV [X+05],E OUTP C DCX Y -MOV [X+05],H DADC B INR [Y+05] -MOV [X+05],L LBCD 06A4 DCR [Y+05] -MOV [X+05],A RETI MVI [Y+05],2 -MOV A,[X+05] LDRA DADY SP -ADD [X+05] INP D MOV B,[Y+05] -ADC [X+05] OUTP D MOV C,[Y+05] -SUB [X+05] DSBC D MOV D,[Y+05] -SBB [X+05] SDED 06A4 MOV E,[Y+05] -ANA [X+05] IM1 MOV H,[Y+05] -XRA [X+05] LDAI MOV L,[Y+05] -ORA [X+05] INP E MOV [Y+05],B -CMP [X+05] OUTP E MOV [Y+05],C -POP X DADC D MOV [Y+05],D -XTIX LDED 06A4 MOV [Y+05],E -PUSH X IM2 MOV [Y+05],H -PCIX LDAR MOV [Y+05],L -SPIX INP H MOV [Y+05],A -RLCR [X+05] OUTP H MOV A,[Y+05] -RRCR [X+05] DSBC H ADD [Y+05] -RALR [X+05] shld 06A4 ADC [Y+05] -RARR [X+05] RRD SUB [Y+05] -SLAR [X+05] INP L SBB [Y+05] -SRAR [X+05] OUTP L ANA [Y+05] -SRLR [X+05] DADC H XRA [Y+05] -BIT 0,[X+05] lhld 06A4 ORA [Y+05] -BIT 1,[X+05] RLD CMP [Y+05] -BIT 2,[X+05] INP M POP Y -BIT 3,[X+05] OUTP M XTIY -BIT 4,[X+05] DSBC SP PUSH Y -BIT 5,[X+05] SSPD 06A4 PCIY -BIT 6,[X+05] INP A SPIY -BIT 7,[X+05] OUTP A RLCR [Y+05] -RES 0,[X+05] DADC SP RRCR [Y+05] -RES 1,[X+05] LSPD 06A4 RALR [Y+05] -RES 2,[X+05] LDI RARR [Y+05] -RES 3,[X+05] CCI SLAR [Y+05] -RES 4,[X+05] INI SRAR [Y+05] -RES 5,[X+05] OTI SRLR [Y+05] -RES 6,[X+05] LDD BIT 0,[Y+05] -RES 7,[X+05] CCD BIT 1,[Y+05] -SET 0,[X+05] IND BIT 2,[Y+05] -SET 1,[X+05] OTD BIT 3,[Y+05] -SET 2,[X+05] LDIR BIT 4,[Y+05] -SET 3,[X+05] CCIR BIT 5,[Y+05] -SET 4,[X+05] INIR BIT 6,[Y+05] -SET 5,[X+05] OTIR BIT 7,[Y+05] -SET 6,[X+05] LDDR RES 0,[Y+05] -SET 7,[X+05] CCDR RES 1,[Y+05] -INP B INDR RES 2,[Y+05] -OUTP B OTDR RES 3,[Y+05] - - -RES 4,[Y+05] SET 0,[Y+05] SET 4,[Y+05] -RES 5,[Y+05] SET 1,[Y+05] SET 5,[Y+05] -RES 6,[Y+05] SET 2,[Y+05] SET 6,[Y+05] -RES 7,[Y+05] SET 3,[Y+05] SET 7,[Y+05] - -; These are the result of disassembling 64180OPS.TRY -; These opcodes are available ONLY on the 64180 CPU -; DDTZ will both assemble and disassemble these. -IN0 B,20 TST E MLT B -OUT0 20,B IN0 H,20 MLT D -TST B OUT0 20,H TSTI 20 -IN0 C,20 TST H MLT H -OUT0 20,C IN0 L,20 TSIO 20 -TST C OUT0 20,L SLP -IN0 D,20 TST L MLT SP -OUT0 20,D TST M OTIM -TST D IN0 A,20 OTDM -IN0 E,20 OUT0 20,A OIMR -OUT0 20,E TST A ODMR - -; The following are UNDOCUMENTED z80 opcodes from XTDOPS.TRY. -; DDTZ will disassemble these, but will not assemble them. -; They use xh/xl (or yh/yl) as separate byte registers. -; Use these at your own risk. -INRX H ACXR H MOVY H,B -DCRX H ACXR L MOVY H,C -MVIX H,20 SUXR H MOVY H,D -INRX L SUXR L MOVY H,E -DCRX L SBXR H MOVY H,A -MVIX L,20 SBXR L MOVY L,B -MOVX B,H NDXR H MOVY L,C -MOVX B,L NDXR L MOVY L,D -MOVX C,H XRXR H MOVY L,E -MOVX C,L XRXR L MOVY L,A -MOVX D,H ORXR H MOVY A,H -MOVX D,L ORXR L MOVY A,L -MOVX E,H CPXR H ADYR H -MOVX E,L CPXR L ADYR L -MOVX H,B INRY H ACYR H -MOVX H,C DCRY H ACYR L -MOVX H,D MVIY H,20 SUYR H -MOVX H,E INRY L SUYR L -MOVX H,A DCRY L SBYR H -MOVX L,B MVIY L,20 SBYR L -MOVX L,C MOVY B,H NDYR H -MOVX L,D MOVY B,L NDYR L -MOVX L,E MOVY C,H XRYR H -MOVX L,A MOVY C,L XRYR L -MOVX A,H MOVY D,H ORYR H -MOVX A,L MOVY D,L ORYR L -ADXR H MOVY E,H CPYR H -ADXR L MOVY E,L CPYR L - - -Command Summary: -=============== - -DDTZM command DDTZ command -============= ============ -@ (base) -A)ssemble first_address A -B)egin {i.e., initialize stack and return} B -C)ompare first_address,last_address,against_address C -D)ump first_address[,last_address[,base]] D -E)nter_in_memory first_address[,base] S)ubstitute -F)ill first_address,last_address,value F -G)o_to [address][,trap1[,trap2]] G -H)ex_arithmetic value1(,value2) H -L)oad_file (offset) R)ead -M)ove first_address,last_address,destination M -N)nput FCBs_command_line I)nput -Q)uit (not avail) -R)egister examine/change [register|flag] X)amine -S)earch first_address,last_address,word W)hereis -T)race_execution [count] T - Untrace_execution [count] (i.e. do count instr) U)ntrace -U)nassemble_code first_address[,last_address] L)ist code -W)rite [first_address,last_address] K)eep -X)amine {i.e. display memory parameters for application} Q)uery -Y)our_option BC:=parm1,DE:=parm2,call_address Y -Z)80_register_display Z - - -If you find this program useful, contributions will be gratefully -accepted and will encourage further development and release of -useful CPM programs. My practice is to include source. - -C.B. Falconer -680 Hartford Turnpike, -Hamden, Conn. 06517 (203) 281-1438 - -DDTZ and its associated documentation and other files are -copyright (c) 1980-1988 by C.B. Falconer. They may be freely -copied and used for non-commercial purposes ONLY. -ôÙ \ No newline at end of file diff --git a/Doc/FDU.txt b/Doc/FDU.txt deleted file mode 100644 index d67fe1fe..00000000 --- a/Doc/FDU.txt +++ /dev/null @@ -1,514 +0,0 @@ -================================================================ -Floppy Disk Utility (FDU) v5.3 for RetroBrew Computers -Disk IO / Zeta / Dual-IDE / N8 / RC2014 / SmallZ80 / Dyno -================================================================ - -Updated January 5, 2020 -by Wayne Warthen (wwarthen@gmail.com) - -Application to test the hardware functionality of the Floppy -Disk Controller (FDC) on the ECB DISK I/O, DISK I/O V3, ZETA -SBC, Dual IDE w/ Floppy, or N8 board. - -The intent is to provide a testbed that allows direct testing -of all possible media types and modes of access. The -application supports read, write, and format by sector, track, -and disk as well as a random read/write test. - -The application supports access modes of polling, interrupt, -INT/WAIT, and DRQ/WAIT. At present, it supports 3.5" media at -DD (720KB) and HD (1.44MB) capacities. It also now supports -5.25" media (720KB and 1.2MB) and 8" media (1.11MB) as well. -Additional media will be added when I have time and access to -required hardware. Not all modes are supported on all -platforms and some modes are experimental in all cases. - -In many ways this application is merely reinventing the wheel -and performs functionality similar to existing applications, -but I have not seen any other applications for RetroBrew -Computers hardware that provide this range of functionality. - -While the application is now almost entirely new code, I would -like to acknowledge that much was derived from the previous -work of Andrew Lynch and Dan Werner. I also want to credit -Sergio Gimenez with testing the 5.25" drive support and Jim -Harre with testing the 8" drive support. Support for Zeta 2 -comes from Segey Kiselev. Thanks! - -General Usage -------------- - -In general, usage is self explanatory. At invocation, you -must select the floppy disk controller (FDC) that you are -using. Subsequently, the main menu allows you to set the -unit, media, and mode to test. These settings MUST match your -situation. Read, write, format, and verify functions are -provided. A sub-menu will allow you to choose sector, track, -disk, or random tests. - -The verify function requires a little explanation. It will -take the contents of the current in-memory disk buffer, save -it, and compare it to the selected sectors. So, you must -ensure that the sectors to be verified already have been -written with the same pattern as the buffer contains. I -typically init the buffer to a pattern, write the pattern to -the entire disk, then verify the entire disk. - -Another submenu is provided for FDC commands. This sub-menu -allows you to send low-level commands directly to FDC. You -*must* know what you are doing to use this sub-menu. For -example, in order to read a sector using this sub-menu, you -will need to perform specify, seek, sense int, and read -commands specifying correct values (nothing is value checked -in this menu). - -Required Hardware/BIOS ----------------------- - -Of course, the starting point is to have a supported hardware -configuration. The following Z80 / Z180 based CPU boards are -supported: - - - SBC V1/2 - - Zeta - - Zeta 2 - - N8 - - Mark IV - - RC2014 w/ SMC - - RC2014 w/ WDC - - SmallZ80 - - Dyno - -You must be using either a RomWBW or UBA based OS version. - -You must have one of the following floppy disk controllers: - - - Disk IO ECB Board FDC - - Disk IO 3 ECB Board FDC - - Dual-IDE ECB Board FDC - - Zeta SBC onboard FDC - - Zeta 2 SBC onboard FDC - - N8 SBC onboard FDC - - RC2014 Scott Baker SMC-based Floppy Module - - RC2014 Scott Baker WDC-based Floppy Module - -Finally, you will need a floppy drive connected via an -appropriate cable: - -Disk IO - no twist in cable, drive unit 0/1 must be selected by jumper on drive -DISK IO 3, Zeta, Zeta 2, RC2014, Dyno - cable with twist, unit 0 after twist, unit 1 before twist -DIDE, N8, Mark IV, SmallZ80 - cable with twist, unit 0 before twist, unit 1 after twist - -Note that FDU does not utilize your systems ROM or OS to -access the floppy system. FDU interacts directly with -hardware. Upon exit, you may need to reset your OS to get the -floppy system back into a state that is expected. - -The Disk I/O should be jumpered as follows: - -J1: depends on use of interrupt modes (see interrupt modes below) -J2: pins 1-2, & 3-4 jumpered -J3: hardware dependent timing for DMA mode (see DMA modes below) -J4: pins 2-3 jumpered -J5: off -J6: pins 2-3 jumpered -J7: pins 2-3 jumpered -J8: off -J9: off -J10: off -J11: off -J12: off - -Note that J1 can be left on even when not using interrupt -modes. As long as the BIOS is OK with it, that is fine. Note -also that J3 is only relevant for DMA modes, but also can be -left in place when using other modes. - -The Disk I/O 3 board should be jumpered at the default settings: - -JP2: 3-4 -JP3: 1-2 for int mode support, otherwise no jumper -JP4: 1-2, 3-4 -JP5: 1-2 -JP6: 1-2 -JP7: 1-2, 3-4 - -Zeta & Zeta 2 do not have any relevant jumper settings. The -hardwired I/O ranges are assumed in the code. - -The Dual-IDE board should be jumpered as follows: - -K3 (DT/R or /RD): /RD -P5 (bd ID): 1-2, 3-4 (for $20-$3F port range) - -There are no specific N8 jumper settings, but the default -I/O range starting at $80 is assumed in the published code. - -The RC2014 Scott Baker SMC-based floppy module should be jumpered -for I/O base address 0x50 (SV1: 11-12), JP1 (TS) shorted, -JP2 (/FAULT) shorted, JP3 (MINI): 2-3, JP4 (/DC/RDY): 2-3. - -The RC2014 Scott Baker WDC-based floppy module should be jumpered -for I/O base address 0x50 (SV1: 11-12), JP1 (/DACK): 1-2, -JP2 (TC): 2-3. - -SmallZ80 does not have any relevant jumper settings. The -hardwired I/O ranges are assumed in the code. - -Dyno does not have any relevant jumper settings. The -hardwired I/O ranges are assumed in the code. - -Modes of Operation ------------------- - -You can select the following test modes. Please refer to the -chart that follows to determine which modes should work with -combinations of Z80 CPU speed and media format. - -WARNING: In general, only the polling mode is considered fully -reliable. The other modes are basically experimental and -should only be used if you know exactly what you are doing. - -Polling: Traditional polled input/output. Works well and very -reliable with robust timeouts and good error recovery. Also, -the slowest performance which precludes it from being used -with 1.44MB floppy on a 4MHz Z80. This is definitely the mode -you want to get working before any others. It does not require -J1 (interrupt enable) on DISK I/O and does not care about the -setting of J3. - -Interrupt: Relies on FDC interrupts to determine when a byte -is ready to be read/written. It does *not* implement a -timeout during disk operations. For example, if there is no -disk in the drive, this mode will just hang until a disk is -inserted. This mode *requires* that the host has interrupts -active using interrupt mode 1 (IM1) and interrupts attached to -the FDC controller. The BIOS must be configured to handle -these interrupts safely. - -Fast Interrupt: Same as above, but sacrifices additional -reliability for faster operation. This mode will allow a -1.44MB floppy to work with a 4MHz Z80 CPU. However, if any -errors occur (even a transient read error which is not -unusual), this mode will hang. The same FDC interrupt -requirements as above are required. - -INT/WAIT: Same as Fast Interrupt, but uses CPU wait instead of -actual interrupt. This mode is exclusive to the original Disk -IO board. It is subject to all the same issues as Fast -Interrupt, but does not need J1 shorted. J3 is irrelevant. - -DRQ/WAIT: Uses pseudo DMA to handle input/output. Does not -require that interrupts (J1) be enabled on the DISK I/O. -However, it is subject to all of the same reliability issues -as "Fast Interrupt". This mode is exclusive to the original -Disk IO board. At present, the mode is *not* implemented! - -The chart below attempts to describe the combinations that -work for me. By far, the most reliable mode is Polling, but -it requires 8MHz CPU for HD disks. - -DRQ/WAIT --------------------------------+ -INT/WAIT -----------------------------+ | -Fast Interrupt --------------------+ | | -Interrupt ----------------------+ | | | -Polling ---------------------+ | | | | - | | | | | -CPU Speed --------------+ | | | | | - | | | | | | - | | | | | | - -3.5" DD (720K) ------ 4MHz Y Y Y Y X - 8MHz+ Y Y Y Y X - -3.5" HD (1.44M) ----- 4MHz N N Y Y X - 8MHz+ Y Y Y Y X - -5.25" DD (360K) ----- 4MHz Y Y Y Y X - 8MHz+ Y Y Y Y X - -5.25" HD (1.2M) ----- 4MHz N N Y Y X - 8MHz+ Y Y Y Y X - -8" DD (1.11M) ------- 4MHz N N Y Y X - 8MHz+ Y Y Y Y X - -Y = Yes, works -N = No, does not work -X = Experimental, probably won't work - -Tracing -------- - -Command/result activity to/from the FDC will be written out if -the trace setting is changed from '00' to '01' in setup. -Additionally, if a command failure is detected on any command, -that specific comand and results are written regardless of the -trace setting. - -The format of the line written is: -: --> [] - -For example, this is the output of a normal read operation: -READ: 46 01 00 00 01 02 09 1B FF --> 01 00 00 00 00 02 02 [OK] - -Please refer to the i8272 data sheet for information on the -command and result bytes. - -Note that the sense interrupt command can return a non-OK -result. This is completely normal in some cases. It is -necessary to "poll" the drive for seek status using sense -interrupt. If there is nothing to report, then the result -will be INVALID COMMAND. Additionally, during a recalibrate -operation, it may be necessary to issue the command twice -because the command will only step the drive 77 times looking -for track 0, but the head may be up to 80 tracks away. In -this case, the first recalibrate fails, but the second should -succeed. Here is what this would look like if trace is turned -on: - -RECALIBRATE: 07 01 --> [OK] -SENSE INTERRUPT: 08 --> 80 [INVALID COMMAND] - ... - ... - ... -SENSE INTERRUPT: 08 --> 80 [INVALID COMMAND] -SENSE INTERRUPT: 08 --> 71 00 [ABNORMAL TERMINATION] -RECALIBRATE: 07 01 --> [OK] -SENSE INTERRUPT: 08 --> 21 00 [OK] - -Another example is when the FDC has just been reset. In this -case, you will see up to 4 disk change errors. Again these -are not a real problem and to be expected. - -When tracing is turned off, the application tries to be -intelligent about error reporting. The specific errors from -sense interrupt documented above will be suppressed because -they are not a real problem. All other errors will be -displayed. - -Error Handling --------------- - -There is no automated error retry logic. This is very -intentional since the point is to expose the controller and -drive activity. Any error detected will result in a prompt to -abort, retry, or continue. Note that some number of errors is -considered normal for this technology. An occasional error -would not necessarily be considered a problem. - -CPU Speed ---------- - -Starting with v5.0, the application adjusts it's timing loops -to the actual system CPU speed by querying the BIOS for the -current CPU speed. - -Interleave ----------- - -The format command now allows the specification of a sector -interleave. It is almost always the case that the optimal -interleave will be 2 (meaning 2:1). - -360K Media ----------- - -The 360K media definition should work well for true 360K -drives. However, it will generally not work with 1.2M -drives. This is because these drives spin at 360RPM instead -of the 300RPM speed of true 360K drives. Additionally, 1.2M -drives are 80 tracks and 360K drives are 40 tracks and, so -far, there is no mechanism in FD to "double step" as a way to -use 40 track media in 80 track drives. - -With this said, it is possible to configure some 1.2M 5.25" -drives to automatically spin down to 300RPM based on a density -select signal (DENSEL). This signal is asserted by FD for -360K media, so IF you have configured your drive to react to -this signal correctly, you will be able to use the 360K media -defintion. Most 1.2M 5.25" drives are NOT configured this way -by default. TEAC drives are generally easy to modify and have -been tested by the author and do work in this manner. Note -that this does not address the issue of double stepping above; -you will just be using the first 40 of 80 tracks. - -Support -------- - -I am happy to answer questions as fast and well as I am able. -Best contact is wwarthen@gmail.com or post something on the -RetroBrew Computers Forum -https://www.retrobrewcomputers.org/forum/. - -Changes -------- - -WW 8/12/2011 - -Removed call to pulse TC in the FDC initialization after -determining that it periodically caused the FDC to write bad -sectors. I am mystified by this, but definitely found it to -be true. Will revisit at some point -- probably a timing -issue between puslsing TC and whatever happens next. - -Non-DMA mode was being set incorrectly for FAST-DMA mode. It -was set for non-DMA even though we were doing DMA. It is -interesting that it worked fine anyway. Fixed it anyway. - -DIO_SETMEDIA was not clearing DCD_DSKRDY as it should. Fixed. - -WW 8/26/2011: v1.1 - -Added support for Zeta. Note that INT/WAIT and DRQ/WAIT are -not available on Zeta. Note that Zeta provides the ability to -perform a reset of the FDC independent of a full CPU reset. -This is VERY useful and the FDC is reset anytime a drive reset -is required. - -Added INT/WAIT support. - -WW 8/28/2011: V1.2 - -All changes in this version are Zeta specific. Fixed FDC -reset logic and motor status display for Zeta (code from -Sergey). - -Modified Zeta disk change display to include it in the command -output line. This makes more sense because a command must be -issued to select the desired drive first. You can use the -SENSE INT command id you want to check the disk change value -at any time. It will also be displayed with any other command -output display. - -WW 9/1/2011: V1.3 - -Added CPUFREQ configuration setting to tune delays based on -cpu speed. The build app is set for 8MHz which also seems to -work well for 4MHz CPU's. Faster CPU speeds will probably -require tuning this setting. - -WW 9/5/2011: V1.4 - -Changed the polling execution routines to utilize CPUFREQ -variable to optimize timeout counter. Most importantly, this -should allow the use of faster CPUs (like 20MHz). - -WW 9/19/2011: V1.5 - -Zeta changes only. Added a call to FDC RESET after any -command failure. This solves an issue where the drive remains -selected if a command error occurs. Also added FDC RESET to -FDC CONTROL menu. - -WW 10/7/2011: V2.0 - -Added support for DIDE. Only supports polling IO and it does -not appear any other modes are possible given the hardware -constraints. - -WW 10/13/2011: V2.1 - -Modified to support N8. N8 is essentially identical to Dual -IDE. The only real change is the IO addresses. In theory, I -should be able to support true DMA on N8 and will work on that. - -WW 10/20/2011: v2.2 - -I had some problems with the results being read were sometimes -missing a byte. Fixed this by taking a more strict approach -to watching the MSR for the exact bits that are expected. - -WW 10/22/2011: V2.3 - -After spending a few days trying to track down an intermittent -data corruption issue with my Dual IDE board, I added a verify -function. This helped me isolate the problem very nicely -(turned out to be interference from the bus monitor). - -WW 11/25/2011: V2.4 - -Preliminary support for DISKIO V3. Basically just assumed -that it operates just like the Zeta. Needs to be verified -with real hardware as soon as I can. - -WW 1/9/2012: V2.5 - -Modified program termination to use CP/M reset call so that a -warm start is done and all drives are logged out. This is -important because media may have been formatted during the -program execution. - -WW 2/6/2012: v2.6 - -Added support for 5.25" drives as tested by Sergio. - -WW 4/5/2012: v2.7 - -Added support for 8" drives as tested by Jim Harre. - -WW 4/6/2012: v2.7a - -Fixed issue with media selection menu to remove duplicate -entries. - -WW 4/8/2012: v2.7b - -Corrected the handling of the density select signal. - -WW 5/22/2012: v2.8 - -Added new media definitions (5.25", 320K). - -WW 6/1/2012: v2.9 - -Added interleave capability on format. - -WW 6/5/2012: v3.0 - -Documentation cleanup. - -WW 7/1/2012: v3.1 - -Modified head load time (HLT) for 8" media based on YD-180 -spec. Now set to 50ms. - -WW 6/17/2013: v3.2 - -Cleaned up SRT, HLT, and HUT values. - -SK 2/10/2015: v3.3 - -Added Zeta SBC v2 support (Sergey Kiselev) - -WW 3/25/2015: v4.0 - -Renamed from FDTST --> FD - -WW 9/2/2017: v5.0 - -Renamed from FD to FDU. -Added runtime selection of FDC hardware. -Added runtime timing adjustment. - -WW 12/16/2017: v5.1 - -Improved polling version of read/write to fix occasional overrun errors. - -WW 1/8/2018: v5.2 - -Added support for RC2014 hardware: - - Scott Baker SMC 9266 FDC module - - Scott Baker WDC 37C65 FDC module - -WW 9/5/2018: v5.3 - - Removed use of pulsing TC to end R/W operations after one sector and - instead set EOT = R (sector number) so that after desired sector is - read, R/W stops with end of cylinder error which is a documented - method for controling number of sectors R/W. This specific termination - condition is no longer considered an error, but a successful end of - operation. - - Added support for SmallZ80 - -WW 5/1/2020: v5.4 - - Added support for Dyno (based on work by Steve Garcia) diff --git a/Doc/Hard Disk Anatomy.pdf b/Doc/Hard Disk Anatomy.pdf index 54bf0ad5..a65a9912 100644 Binary files a/Doc/Hard Disk Anatomy.pdf and b/Doc/Hard Disk Anatomy.pdf differ diff --git a/Doc/Microsoft Basic-80 Reference Manual v5.0.pdf b/Doc/Microsoft Basic-80 Reference Manual v5.0.pdf new file mode 100644 index 00000000..fd80b52e Binary files /dev/null and b/Doc/Microsoft Basic-80 Reference Manual v5.0.pdf differ diff --git a/Doc/ReadMe.txt b/Doc/ReadMe.txt index 276003d6..4b393291 100644 --- a/Doc/ReadMe.txt +++ b/Doc/ReadMe.txt @@ -10,6 +10,26 @@ This directory ("Doc") is part of the RomWBW System Software distribution archive. It contains documentation for components of the system. +ChangeLog.txt +------------- + +Log of changes in RomWBW by version. + + +RomWBW User Guide ("RomWBW User Guide.pdf") +RomWBW System Guide ("RomWBW System Guide.pdf") +RomWBW Applications ("RomWBW Applications.pdf") +RomWBW ROM Applications ("RomWBW ROM Applications.pdf") +RomWBW Disk Catalog ("RomWBW Disk Catalog.pdf") +RomWBW Errata ("RomWBW Errata.pdf") +------------------------------------------------------- + +Documentation set for RomWBW. The primary document is the +User Guide. The System Guide explains internal system operation +and has a reference for the HBIOS API. Use of included tools +and utilities are detailed in the Applications and +ROM Applications documents. + CPM Manual ("CPM Manual.pdf") ----------------------------- @@ -43,12 +63,6 @@ The operational manual for John Coffman's hard disk partitioning program. This program is included in RomWBW as FDISK80. -Floppy Disk Utility Documentation ("FDU.tst") ---------------------------------------------- - -Operational documentation for the RomWBW FDU application. - - Hard Disk Anatomy ("Hard Disk Anatomy.pdf") ------------------------------------------- @@ -61,22 +75,6 @@ NZCOM User's Manual ("NZCOM Users Manual.pdf") NZCOM operating system operation manual. -RomWBW Architecture ("RomWBW Architecture.pdf") ------------------------------------------------ - -Document describing the architecture of the RomWBW HBIOS. It -includes reference information for the HBIOS calls. - - -Z180 ASCI Baud Rate Options ("Z180 ASCI Baud Rate Options.pdf") ---------------------------------------------------------------- - -The Z180 processor's ASCI serial ports have a limited set of -baud rate divisors. These divisors are relative to the CPU -clock rate. This document provides a list of the possible -baud rates for typical CPU clock rates. - - ZCPR Manual ("ZCPR Manual.pdf") ------------------------------- @@ -85,11 +83,54 @@ 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. +ZCPR D&J Manual ("ZCPR-DJ.doc") +------------------------------- + +ZCPR D&J User Manual. This manual supplements the ZCPR Manual. + ZSDOS Manual ("ZSDOS Manual.pdf") --------------------------------- -ZSDOS is the DOS portion of Z-System. This is the manual fo ZSDOS +ZSDOS is the DOS portion of Z-System. This is the manual for 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 +RomWBW distribution. + +Microsoft Basic-80 Reference Manual v5.0 (Microsoft Basic-80 Reference Manual v5.0.pdf) +--------------------------------------------------------------------------------------- + +Official manual for Microsoft BASIC as included in RomWBW. + + +QP/M 2.7 Installation Guide and Supplements ("qpm27.pdf") +QP/M 2.7 Interface Guide ("qdos27.pdf") +QP/M 2.7 Features and Facilities ("qcp27.pdf") +-------------------------------------------- + +Official documentation set for QP/M 2.7 from original QP/M distribution. + + +SIO+CTC Baud Rate Options (SIO+CTC Baud Rate Options.pdf) +--------------------------------------------------------- + +Documents possible baud rates available based on different baud +clock rates for Zilog SIO using CTC for baud rate clock generation. + + +Z180 ASCI Baud Rate Options ("Z180 ASCI Baud Rate Options.pdf") +--------------------------------------------------------------- + +The Z180 processor's ASCI serial ports have a limited set of +baud rate divisors. These divisors are relative to the CPU +clock rate. This document provides a list of the possible +baud rates for typical CPU clock rates. + + +UCSD p-System Users Manual ("UCSD p-System Users Manual.pdf") +------------------------------------------------------------- + +Official user manual for p-System operating system included with +RomWBW. + +--WBW 5:18 PM 3/16/2023 \ No newline at end of file diff --git a/Doc/RomWBW Applications.pdf b/Doc/RomWBW Applications.pdf index 82a473c6..67c5db63 100644 Binary files a/Doc/RomWBW Applications.pdf and b/Doc/RomWBW Applications.pdf differ diff --git a/Doc/RomWBW Architecture.pdf b/Doc/RomWBW Architecture.pdf deleted file mode 100644 index 17f32e51..00000000 Binary files a/Doc/RomWBW Architecture.pdf and /dev/null differ diff --git a/Doc/RomWBW Disk Catalog.pdf b/Doc/RomWBW Disk Catalog.pdf new file mode 100644 index 00000000..b60545b7 Binary files /dev/null and b/Doc/RomWBW Disk Catalog.pdf differ diff --git a/Doc/RomWBW Errata.pdf b/Doc/RomWBW Errata.pdf new file mode 100644 index 00000000..72a81260 Binary files /dev/null and b/Doc/RomWBW Errata.pdf differ diff --git a/Doc/RomWBW Getting Started.pdf b/Doc/RomWBW Getting Started.pdf deleted file mode 100644 index f89297fb..00000000 Binary files a/Doc/RomWBW Getting Started.pdf and /dev/null differ diff --git a/Doc/RomWBW ROM Applications.pdf b/Doc/RomWBW ROM Applications.pdf new file mode 100644 index 00000000..f6fe2a1a Binary files /dev/null and b/Doc/RomWBW ROM Applications.pdf differ diff --git a/Doc/RomWBW System Guide.pdf b/Doc/RomWBW System Guide.pdf new file mode 100644 index 00000000..9125b545 Binary files /dev/null and b/Doc/RomWBW System Guide.pdf differ diff --git a/Doc/RomWBW User Guide.pdf b/Doc/RomWBW User Guide.pdf new file mode 100644 index 00000000..1f1ba8a9 Binary files /dev/null and b/Doc/RomWBW User Guide.pdf differ diff --git a/Doc/SIO+CTC Baud Rate Options.pdf b/Doc/SIO+CTC Baud Rate Options.pdf new file mode 100644 index 00000000..781a29af Binary files /dev/null and b/Doc/SIO+CTC Baud Rate Options.pdf differ diff --git a/Doc/Testing Notes.txt b/Doc/Testing Notes.txt index e0b73f67..9175409f 100644 --- a/Doc/Testing Notes.txt +++ b/Doc/Testing Notes.txt @@ -23,7 +23,7 @@ Zeta 2 (X) - Test FD driver - Test FDU app -RC2014 (X) +RCBus (X) ------ - Test SIO driver (Serial Module) - Test ACIA driver (Dual Serial Module) @@ -40,7 +40,7 @@ N8-2312 (X) - Test FDU app - Test TMS driver (video & kbd) -N8-2511 ( ) +N8-2511 (X) ------- - Test ASCI driver - Test SD driver (Juha mode) @@ -139,27 +139,6 @@ GENERAL (X) - ASSIGN app - MODE app - SYSCOPY app -- OSLDR app - FDU app - FDISK80 app - TUNE app - -RESULTS -------- -- Missing HBIOS startup banner (X) -- PANIC while printing Serial device inventory (X) -- Unexpected interrupt signals not handled well (X) -- Fix IT_??? usage (X) -- Fix HB_DI/HB_EI in PEEK/POKE/BNKCPY (X) -- Fix SIMH timer interrupt setup (X) -- Move DI/EI in PEEK/POKE/BNKCPY to API layer? (X) -- RETI vs. JP in page zero when INTMODE = 0 (X) -- Check interrupt stack space (X) -- If an early INT fires, we return with INTs enabled (not good) (X) -- PPPCON init should display ANSI 80x25 or similar (X) -- Add INT MODE X message to early boot messages (X) -- OSLDR fails when LDDS is loaded (X) -- Add "!!!" to force assembly error as needed ( ) -- TIMER app should check for HBIOS active (X) -- Halt system after bad interrupt??? ( ) -- Adapt and bundle PLAYER.COM (X) diff --git a/Doc/UCSD p-System Users Manual.pdf b/Doc/UCSD p-System Users Manual.pdf new file mode 100644 index 00000000..5affaf78 Binary files /dev/null and b/Doc/UCSD p-System Users Manual.pdf differ diff --git a/Doc/Z180 ASCI Baud Rate Options.pdf b/Doc/Z180 ASCI Baud Rate Options.pdf index 0786fcbe..9e48d821 100644 Binary files a/Doc/Z180 ASCI Baud Rate Options.pdf and b/Doc/Z180 ASCI Baud Rate Options.pdf differ diff --git a/Doc/ZCPR-DJ.doc b/Doc/ZCPR-DJ.doc new file mode 100644 index 00000000..decc5830 --- /dev/null +++ b/Doc/ZCPR-DJ.doc @@ -0,0 +1,765 @@ +A Personal Note +=============== + +Somehow, I've managed to get by for the last 14 years using just ZCPR. +But like some of you, I have fiddled with the standard ZCPR and +modified it to suit my tastes. As I added new commands or enriched old +ones, I've always remained compatible with existing programs, all the +BDOS replacements, and, most important of all, stayed within the 800H +space allocation of the original Digital Research CCP. Here are the +fruits of my labors, I hope you enjoy this CCP replacement as much as I +do. + + Don Kirkpatrick + 17595 S.W. Pheasant Lane + Beaverton, Oregon 97006 + + + +Introduction +============ + +This console replacement is designed to run under CP/M 2.2 or any of +the 2.2 BDOS replacements. It requires a Z80 or better. If you are +running DRI's CCP or older versions of ZCPR1, this program is a +significant improvement. If you are running ZCPR3, CP/M 3.0, CP/M +Plus, or MP/M, this will probably be a disappointment. + +If you are familiar with ZCPR3, you will recognize many of the +enhancements here: comments on a command line, search path for the .com +file, drive/user change with simple du:, CLEVEL3 command processing, +proper SUBMIT file facility, and so on. Nothing has been removed from +DRI's CCP, only new features added. AND IT ALL STILL FITS IN THE +ORIGINAL 800H, THE SAME SPACE AS THE DIGITAL RESEARCH FIVE COMMAND +CCP. + +Many of the standard commands have been enhanced. For example, TYPE +and LIST now have options to turn on or off page breaks. Moreover, the +console check for abort has been improved. + +Two commands have been added for use in submit files - SAK and BELL. +These commands allow you to pause or ring the bell during submit file +execution. + +Before you install this version of ZCPR onto your boot disks, try it by +running it as a .com file. Just edit the few customizing options and +assemble the source. After you decide it really is better, load it +onto your boot track and make it your standard. Complete instructions +are located at the end of this document. + +The complete built-in command list is: + + DIR - directory command enhanced to list optionally all user areas + REN - standard rename command + USER- move to new user number area on same drive + SAVE- save specified number of TPA pages or records in a file + TYPE- display a file on the console with optional page break pauses + LIST- print command plus optional form feed insertion + PAGE- send form feed to list device + ERA - standard file erase command + ERAQ- file erase with confirmation query at each file + DFU - set default user number for .com search path + BELL- send a bell character to the console + SAK - pause until a key is struck on the console (Strike Any Key) + SCL - toggle multiple commands per line (Single Command on a Line) + GET - load a file into the TPA at any specified location + JUMP- process command tail and execute program at specified address + GO - process command tail and execute program loaded at 100H + PEEK- display hexadecimal byte string starting with specified address + POKE- load hexadecimal byte string starting with specified address + BOOT- execute BIOS cold boot routine + + +Filename Processing +=================== + +The standard ZCPR3 du: drive/user file specification has been +implemented. Any filename can be in the du:fn.ft form. For example: + + A>era c4:junk*.* + +erases files on the C drive, user area 4 without leaving drive A user +0. When a user number is found in a filename, that user number is +placed in S1 of the default FCB. Bit 7 of S1 is set to inform the +program using the FCB a user number was found. + +The * in an ambiguous file name has been improved. Now a trailing * +causes the remainder of the ambiguous name to be filled with '?', not +just the fn field. For example: + + A>era c4:junk* + +is the same as the example above. Previously, junk* was defined as +'junk????. '. If you need the ft field blank, type 'junk*.'. The +question mark still works as a single character wild card. + + +Command Line Processing +======================= + +The current user number is included as part of the command prompt for +all non-zero user numbers. The prompt is of the form du>, for example +A2> or B10>. If the SUPRES equate is true, the user number is +suppressed for user 0 only. + +Multiple commands are typed on a single line separated by a command +separator character. Occasionally, you need to type the separator +character in a command tail. The SCL command toggles the multiple +command enable. The CMDCHR equate determines the command separator +character. A ';' has been chosen as the separator character in this +distribution version. + +Comments are allowed on a command line. When the comment separator +character is encountered as the first character of a command, the +remainder of the line is ignored. The COMCHR equate determines the +comment separator character. A ';' has been chosen as the separator +character in this distribution version. Here is an example containing +comments and multiple commands on a single line: + + A>get 100 junk;peek 100;;this is a comment. + A>;this is also a comment. + +There exists a built-in search path for transient commands. First, the +current drive/user is searched. Next, the current drive/default user +is searched. Last, drive A/default user is searched. The DEFUSR +equate determines the default user number, currently set to user 0 in +this distribution version. The default user is temporarily changed +with the DFU command. If a drive is specified in the transient +command, the current and default user areas on the specified drive are +searched. If a user number is specified, that user area on the current +and default drive are searched. If both the drive and user number are +specified, no search is performed. The same drive/user area is never +searched twice. + +Transient commands are always "called." If a program terminates via a +return rather than a warm boot, subsequent multiple commands on the +command line are executed. Any program exiting by a warm boot reloads +ZCPR and the subsequent commands lost. + +A default command can be placed in the command buffer and control +passed to ZCPR for processing. The only thing required, besides +placing the command in the buffer and jumping to CPRLOC, is to +initialize the command character counter at the start of the buffer. +The procedure is compatible with the original DRI CCP default command +processing. If ZCPR is entered at CPRLOC+3 jump, default command +processing is suppressed. Either way, register C must contain a valid +drive/user, just like the original CCP. + + +Submit File Processing +====================== + +A basic design choice had to be made in the design of ZCPR concerning +the execution of submit files. The original CCP had a problem. It +ALWAYS looked for the $$$.SUB file on drive A and the submit program +would place it on the current default drive. When the you were logged +onto drive B and you issued a submit command, the $$$.SUB was placed on +drive B and not executed. + +After much debate it was decided to have ZCPR perform the same type of +function as CCP (look for the $$$.SUB file on drive A), but the problem +with SUBMIT.COM still exists. Hence, RGF designed SuperSUB and RLC +took his SuperSUB and designed SUB from it; both programs are set up to +allow the selection at assembly time of creating the $$$.SUB on the +default drive or on drive A. If you don't have one of these newer +submit programs, a procedure for patching the standard SUBMIT.COM has +been included at the end. + +The fixed drive choice permits a submit file to contain a series of +commands exactly as they would be entered from a CP/M console. This +permits things like: + + A>dir + A>b: + B>dir + +to be executed, even though the currently default drive is changed +during execution. If the $$$.SUB file were present on the default +drive, the above series of commands would not work. ZCPR would be +looking for $$$.SUB on the default drive, and switching default drives +without moving the $$$.SUB file would cause processing to abort. Note +that the same problem occurs if the user number of the $$$.SUB file is +not predefined. ZCPR assumes that the $$$.SUB file is located on user 0 +of drive A. + +The trick of using the $ flag returned by the BDOS disk reset is used +to speed the search for a $*.* file on drive A. This trick will not +work if the $$$.SUB file were located on another drive. + +The '>' prompt character is replaced by a special character while a +submit file is in execution. The SPRMPT equate defines this special +character, currently set to '$' in this distribution version. + + +Command Syntax +============== + +Multiple commands can be placed on one line. If the comment character +is encountered where a command should start, the rest of the line is +ignored. Any command can be renamed by editing the command table. +Command names can be up to eight characters long and are terminated by +bit 7 high. If there is a conflict between an internal ZCPR command +and a transient program of the same name, the internal command is +executed. Type the command with the du: included if the external +transient command is the one desired. Here is a complete alphabetized +list of all the resident commands with their syntax: + +============================================================================= + +Command: BELL + +Function: To ring terminal bell. + +Forms: BELL + +Options: None. + +Uses: This command is designed to be placed in a submit file to + ring the bell to indicate significant checkpoints. + +============================================================================= + +Command: BOOT + +Function: To execute BIOS cold boot routine. + +Forms: BOOT + +Options: REBOOT equate controls the inclusion/exclusion of this command. + +Uses: Reboots the system without pushing the reset button. The + cold boot entry point in the BIOS must be supported for this + command to work. + +============================================================================= + +Command: DFU + +Function: To set the Default User Number for transient commands. + +Forms: DFU + +Options: DEFUSR equate defines the default user choice until this + command is entered. + + NUMBASE equate defines the character that specifies a + hexadecimal number. The distribution version is set to 'H'. + +Uses: The default user area is searched after a transient command + cannot be found in the current user area. If the transient + command still has not been found, the default user on the + default drive is searched last. The new default user number + is in decimal, but hexadecimal numbers are entered by + appending an 'H'. The next warm boot will restore the + original default user number. + +============================================================================= + +Command: DIR + +Function: To display a directory listing of the files on a drive. + +Forms: DIR Display the DIR files + DIR S Display the SYS files + DIR B Display both DIR and SYS files + DIR A Display both DIR and SYS files for all user areas + +Options: TWOCOL equate controls the number of columns in the display. + Forty-column terminals are limited to two-column displays. + + WIDE equate controls the spacing between the columns and + change the horizontal width of a directory display. + + FENCE equate specifies the character separator between the + directory columns. + + USRDLM equate specifies the character between the user number + and the filename. + + USRFLG, SYSFLG, and SOFLG equates specify the command line + tail character that control the display of system and + non-system files. + +Uses: Displays a directory listing of files in specific drive/user + area. + +============================================================================= + +Command: ERA + +Function: To erase files. + +Forms: ERA + +Options: None. + +Uses: Deletes files. Names of erased files are displayed. + +============================================================================= + +Command: ERAQ + +Function: To erase files with individual query. + +Forms: ERAQ + ? y File erased + ? File not erased + +Options: None. + +Uses: Deletes a subset of a set of ambiguously specified files. + Any answer other than 'Y' (either case) will cause the file + to be skipped and not erased. + +============================================================================= + +Command: GET + +Function: To load the specified file from disk to the specified address. + +Forms: GET + +Options: None. + +Uses: Loads a file into the TPA for patching purposes. This command + searches for the specified file along the same search path as + the transient command loader. + + +============================================================================= + +Command: GO + +Function: To call the program in the TPA without loading from disk. + +Forms: GO + +Options: None. + +Uses: Most useful to rerun a program already loaded into the TPA. + Saves time and wear on disk drives. The command tail is + entered exactly as it would appear if GO were replaced by the + program name. Same as JUMP 100H, but more convenient, + especially when used with parameters for programs like STAT. + +============================================================================= + +Command: JUMP + +Function: To call the program at a specified address. + +Forms: JUMP + +Options: None. + +Uses: Executes code not located at 100H. For example, JUMP 0 + warm boots. The code must already reside at the specified + address. + +============================================================================= + +Command: LIST + +Function: To print specified file on list device. +- +Forms: LIST Print file + LIST P Print file without default paging + +Options: NLINEP equate determines the number of lines per page. + + FFKILL equate controls the suppression of form feeds before + printable text. + + PGDFLG equate determines the command line tail character that + toggles the default form feed insertion every NLINEP lines. + + NOSTAT equate controls the use of the BIOS list status call. + +Uses: Prints files with/without pagination on LST: device. A + listing is aborted by a console ^C. Any submit file in + process is terminated and control is returned gracefully to + the console prompt. + +============================================================================= + +Command: PAGE + +Function: To eject a page on list device via a form feed. + +Forms: PAGE + +Options: NOSTAT equate controls the use of the BIOS list status call. + +Uses: Sends a form feed to the LST: device. The page eject can + be aborted by a console ^C if the system hangs because the + printer is not ready. If aborted, any submit file in process + is terminated and control is returned gracefully to the + console prompt. + +============================================================================= + +Command: PEEK + +Function: To display hex values beginning at a specified address. + +Forms: PEEK [] + +Options: None. + +Uses: Displays hexadecimal values anywhere in the entire address + space. The maximum value for is 0FFH, but the + default is 256. + +============================================================================= + +Command: POKE + +Function: To poke a string of hex values into a set of consecutive + addresses. + +Forms: POKE [...] + +Options: None. + +Uses: Modifies values anywhere in the entire address space. Each + represents one byte and is separated from the next + by a space. The number of are limited only by the + size of the command line buffer. The address is incremented + for each . Excellent for hand patching code. + +============================================================================= + +Command: REN + +Function: To change the name of an existing file. + +Forms: REN = + REN = Existing + Delete? y File deleted + +Options: None. + +Uses: Changes the names of files. Any du: on is ignored; + the optional du: is on . If there already exists a + , the console is queried for conformation. Any + response except 'Y' (either case) aborts the command, kills + any submit file in process, and returns gracefully to the + command prompt. + +============================================================================= + +Command: SAK + +Function: To pause until a key is struck. + +Forms: SAK + ? + +Options: None. + +Uses: Pauses a submit file until a keystroke is entered. Any + character other than a ^C will resume execution. A ^C kills + the submit file, any commands remaining on the command the + line are ignored, and control returns gracefully to the + prompt. + +============================================================================= + +Command: SAVE + +Function: To save the contents of TPA onto disk as a file. + +Forms: SAVE + SAVE R + +Options: RECFLG equate determines the command tail character that + specifies records rather than pages. + + NUMBASE equate defines the character that specifies a + hexadecimal number. The distribution version is set to 'H'. + +Uses: Saves the TPA to a file. Records are 128 bytes long, pages + are 256 bytes long. Number of pages or records is in + decimal, but a hexadecimal number is entered by appending an + 'H'. Saved area begins at 100H. + +============================================================================= + +Command: SCL + +Function: To force ZCPR to parse only a single command per line. + +Forms: SCL + +Options: MULTPL equate determines the inclusion/exclusion of this + command and whether or not multiple commands are allowed. + + CMDCHR equate determines the character separating multiple + commands. + +Uses: Some transient commands require the command separator in the + command tail. This command turns off multiple command + parsing so the entire command tail is sent to the transient + program. Multiple command format is reset at the next warm + boot. SCL toggles. + +============================================================================= + +Command: TYPE + +Function: To display specified file on console. + +Forms: TYPE Display file + TYPE P Display file without default paging + +Options: NLINES equate determines the number of lines per screen. + + FFKILL equate controls the suppression of form feeds before + printable text. + + PGDFLG equate determines the command line tail character that + toggles the default form feed insertion every NLINEP lines. + +Uses: Displays files with/without pagination on CON: device. A + display is aborted by a console ^C. If aborted, any submit + file in process terminates and control returns gracefully to + the console prompt. When page breaks are enabled, any + console character except ^C will display the next page of + text. + +============================================================================= + +Command: USER + +Function: To change current user number. + +Forms: USER + +Options: SUPRES equate controls the display of the user number in the + prompt when the user number is zero. + + MAXUSR equate controls the maximum allowable user number. + + NUMBASE equate defines the character that specifies a + hexadecimal number. The distribution version is set to 'H'. + +Uses: This command changes the current user number. The new user + number is in decimal, but a hexadecimal number is entered by + appending an 'H'. This command has been retained for + compatibility purposes only. It is far easier to change + disk/user by typing du:. + +============================================================================= + + +Error Messages +============== + +If any error is encountered as a command line is being parsed, a +message will be printed and, for serious errors, the remainder of the +line is ignored. Below is a complete list of all ZCPR error messages. +Any error message encountered that is not on this list came from some +program other than ZCPR. + +"?" + + An error was detected in the command. The an item on the command + line was not what was expected. The command line is echoed up to + the position where the error was detected, as close as can be + determined, and the "?" printed. Any commands remaining on the + command the line are ignored and any $$$.SUB file erased. + +"Full" + + If ZCPR was attempting to load a transient program, one of two + things has gone wrong: either the program is so large that it won't + fit into the TPA or a read error was returned from the BDOS. If + ZCPR was attempting to save a file, the BDOS write call returned + failure. Either the disk or the directory is full. Any commands + remaining on the command line are ignored and any $$$.SUB file + erased. + +"No File" + + No file could be found matching the filename specified in the + command. This message is also be printed if the BDOS read command + returns failure. If ZCPR was looking for a transient command, any + commands remaining on the command line are ignored and any $$$.SUB + file erased. + +"Name Error" + + The specified filename has a user number larger than the allowable + maximum or an ambiguous filename was entered where only an + unambiguous filename is permitted. Any commands remaining on the + command line are ignored and any $$$.SUB file erased. + +"Delete?" + + Not really an error, but there already exists a file with the same + name as the requested new name in the REN command. Any response + except 'Y' (either case) aborts the command, any commands remaining + on the command line are ignored, and any $$$.SUB file erased. + +"All?" + + Not really an error, but a check to verify that all files on the + drive/user area are to be erased. Any response except 'Y' (either + case) aborts the command and any commands remaining on the command + line are ignored. + + +Installation Instructions +========================= + +1) The first task is to determine the location of your BDOS because you + MUST set the P2DOS equate to this value. If you do not know the + location of your BDOS, use ZCPRDEMO to find it. If you do not + already have ZCPRDEMO.COM, assemble ZCPR with the TEST equate true + to make it. A bootstrap loader will be included and you can run the + .com file. This program assembles without errors using Microsoft's + M80/L80: + + A>m80 =zcpr + A>l80 zcpr,zcprdemo/n/e + + Other assemblers can be used, but ZCPR.MAC will probably require + editing to convert it to a form compatible. The major decision in + converting is to determine how the .PHASE pseudo is to be handled. + Probably the best solution to the .PHASE is to generate a .hex + file and load it with an offset using DDT/SID/ZSID. Consult the + "r" command in the DDT/SID/ZSID manaul. + + Run ZCPRDEMO and peek at low memory: + + A>zcprdemo + A' to a '<'. This + tells you the special debug version of ZCPR is running. See the + debug section at the end for details. Address 0 contains a jump 3 + beyond the start of the BIOS and address 5 contains a jump 6 beyond + the start of the BDOS. + + Be careful if you attempt to execute a transient program from + ZCPRDEMO. Some transient programs, like NSWP, return rather than + warm boot when done. These programs don't know that ZCPRDEMO is at + address 8000H rather than just under the BDOS. If they overwrite + ZCPRDEMO, then the return is to random code. Of course, this is not + a problem when ZCPR is installed just under the BDOS. + +2) You MUST edit the code to place your BDOS/P2DOS/Z80DOS/ZRDOS start + address in the P2DOS equate. Set COMLD true (and TEST false if you + set it true in step 1 above) and make ZCPR.COM. A bootstrap loader + will be included. + + Assuming you successfully assemble it, just type "zcpr" to run it. + However, every time there is a warm boot, it will be replaced by + the boot track CCP. If you like what you see, place a copy on the + boot track to make it available all the time. + +3) Reassemble, this time with COMLD false to make ZCPRNBLD.COM (ZCPR + No Boot LoaDer). + +4) Run SYSGEN to load a copy of the boot track into memory. + + B>; Sample terminal session for integrating ZCPR + B>sysgen + SYSGEN VER 2.2 + SOURCE DRIVE NAME (OR RETURN TO SKIP)a + SOURCE ON A, THEN TYPE RETURN + FUNCTION COMPLETE + DESTINATION DRIVE NAME (OR RETURN TO REBOOT) + + +5) Run SAVE to save a track image to a file (eg: SAVE 32 BOOTFILE). + The number on the save command depends on the size of your boot + track loader; it can be as small as 31 and as large as 44. If you + have extra disk space or are not sure, play it safe and use 44. + + B>save 44 cpm56.com <-- We now have a SYSGEN image of CP/M + +6) Find the location of the stock CCP by peeking at the boot file. It + is normally located at address 980H in the file. Using ZCPR: + + B>zcpr <-- Reload zcpr.com version + B>get 100 cpm56.com + + and search for the start of the console processor: + + B>peek 980 + 0980 C3 xx xx C3 xx xx 7F 00 43 4F 50 59 52 49 47 48 + 0990 54 20 ... + + If you don't find the start of the CCP at 980H, don't be + discouraged. It is there, but at a higher address. Keep looking. + +7) When you find the location of the CCP, patch it with the new ZCPR + image. + + B>get 980 zcprnbld.com + +8) Place the new file onto the boot track of a test disk, not your + original, using SYSGEN, and try it out. + + B>sysgen + SYSGEN VER 2.2 + SOURCE DRIVE NAME (OR RETURN TO SKIP) <-- Use memory image + DESTINATION DRIVE NAME (OR RETURN TO REBOOT)b <-- Load onto drive B + DESTINATION ON B, THEN TYPE RETURN + FUNCTION COMPLETE + DESTINATION DRIVE NAME (OR RETURN TO REBOOT) + + You should now have a ZCPR system boot disk. Notice you did all + your work on drive B so you wouldn't destroy the original. + + + +This may seem like a great number of steps, but each is only a single +CP/M command line, total time is only 5 minutes or so after you get +ZCPR to run as a .com file. + + +Debugging ZCPR +============== + +Special provisions have been make to ease the debugging of ZCPR. +Setting the TEST equate true causes the assembler to build a version of +ZCPR that executes in the TPA. This allows the use of a debugger like +DDT, ZSID, or Z8E to load and monitor execution. To identify the debug +version, the prompt character is changed from '>' to '<' when it runs. + +CPRLOC for the test version is 8000H. A bootstrap loader is included +at the beginning to move the image to this address. Do not try to set +a breakpoint until after the loader has moved ZCPR. The easiest way to +accomplish this is to single-step through the loader and then set your +breakpoints. Change the execution address to something lower if 8000H +does not leave enough space for the debugger. + +A small amount of code is also added at the end of the debug version to +compute the BIOS list status and cold boot entry points at run time. +This permits the demo version to execute properly without setting the +BDOS location equate. + +Patching SUBMIT.COM +=================== + +SUBMIT.COM is patched to run with ZCPR by the following procedure. +This is recommended if the user does not have one of the newer public +domain versions of submit. This patch simply makes SUBMIT.COM always +place the $$$.SUB file on drive A. Illustrative terminal session +follows: + + A>get 100 submit.com;peek 5bb 2 + 05BB 00 24 <-- Patch is at 5BB Hex + A>poke 5bb 1 <-- Change 0 (default drive) to 1 (drive A) + A>peek 5b0 20 <-- Let's check just to make sure + 05B0 00 00 00 00 00 00 30 30 31 20 24 01 24 24 24 20 + 05C0 20 20 20 20 53 55 42 00 00 00 1A 1A 1A 1A 1A 1A + A>save 5 newsubmt.com <-- Save new SUBMIT.COM file + +Pretty simple, huh? +ny error message encountered that is not on this list came from some +prog \ No newline at end of file diff --git a/Doc/qcp27.pdf b/Doc/qcp27.pdf new file mode 100644 index 00000000..56f4996b Binary files /dev/null and b/Doc/qcp27.pdf differ diff --git a/Doc/qdos27.pdf b/Doc/qdos27.pdf new file mode 100644 index 00000000..10723a0c Binary files /dev/null and b/Doc/qdos27.pdf differ diff --git a/Doc/qpm27.pdf b/Doc/qpm27.pdf new file mode 100644 index 00000000..116b5c66 Binary files /dev/null and b/Doc/qpm27.pdf differ diff --git a/Makefile b/Makefile index 44d7847e..0f5dc20d 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,19 @@ all: - cd Tools/unix ; make - cd Source ; make - cd Source/Images ; make + $(MAKE) --directory Tools + $(MAKE) --directory Source clean: - cd Tools/unix ; make clean - cd Source ; make clean - cd Binary ; make clean + $(MAKE) --directory Tools clean + $(MAKE) --directory Source clean + $(MAKE) --directory Binary clean + rm -f make.log -clobber: - cd Tools/unix ; make clobber - cd Source ; make clobber - cd Binary ; make clobber - rm -f typescript +clobber: clean diff: - cd Source ; make diff + $(MAKE) --directory Source diff +dist: + $(MAKE) ROM_PLATFORM=dist 2>&1 | tee make.log + $(MAKE) --directory Source clean + $(MAKE) --directory Tools clean diff --git a/ReadMe.md b/ReadMe.md index aeb09db1..102b2457 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,69 +1,60 @@ -# RomWBW -## Z80/Z180 System Software -Version 3.0.1 -Monday 30 March 2020 - -Wayne Warthen - -### Download - - - [RomWBW Distribution - Package](https://github.com/wwarthen/RomWBW/releases) - -### Related Pages - - - [RomWBW Architecture - Document](https://www.retrobrewcomputers.org/lib/exe/fetch.php?media=software:firmwareos:romwbw:romwbw_architecture.pdf) - - [RomWBW - Applications](https://www.retrobrewcomputers.org/doku.php?id=software:firmwareos:romwbw:apps) - - [RomWBW - Errata](https://www.retrobrewcomputers.org/doku.php?id=software:firmwareos:romwbw:errata) +**RomWBW ReadMe** \ +Version 3.2 \ +Wayne Warthen ([wwarthen@gmail.com](mailto:wwarthen@gmail.com)) \ +18 Mar 2023 # Overview -RomWBW provides a complete software system for a wide variety of -hobbyist Z80/Z180 CPU-based systems produced by these developer +RomWBW software provides a complete, commercial quality implementation +of CP/M (and workalike) operating systems and applications for modern +Z80/180/280 retro-computing hardware systems. A wide variety of +platforms are supported including those produced by these developer communities: - - [RetroBrew Computers](https://www.retrobrewcomputers.org) - - [RC2014](https://rc2014.co.uk) - - [retro-comp](https://groups.google.com/forum/#!forum/retro-comp) +- [RetroBrew Computers](https://www.retrobrewcomputers.org) +- [RC2014](https://rc2014.co.uk), + [RC2014-Z80](https://groups.google.com/g/rc2014-z80) +- [retro-comp](https://groups.google.com/forum/#!forum/retro-comp) +- [Small Computer Central](https://smallcomputercentral.com/) General features include: - - Banked memory services for several banking designs - - Disk drivers for RAM, ROM, Floppy, IDE, CF, and SD - - Serial drivers including UART (16550-like), ASCI, ACIA, SIO - - Video drivers including TMS9918, SY6545, MOS8563, HD6445 - - Real time clock drivers including DS1322, BQ4845 - - Multiple OS support including CP/M 2.2, ZSDOS, CP/M 3, ZPM3 - - Built-in VT-100 terminal emulation support +- Banked memory services for several banking designs +- Disk drivers for RAM, ROM, Floppy, IDE, CF, and SD +- Serial drivers including UART (16550-like), ASCI, ACIA, SIO +- Video drivers including TMS9918, SY6545, MOS8563, HD6445 +- Keyboard (PS/2) drivers via VT8242 or PPI interfaces +- Real time clock drivers including DS1302, BQ4845 +- OSes: CP/M 2.2, ZSDOS, CP/M 3, NZ-COM, ZPM3, QPM, p-System, and + FreeRTOS +- Built-in VT-100 terminal emulation support RomWBW is distributed as both source code and pre-built ROM and disk images. Some of the provided software can be launched directly from the ROM firmware itself: - - System Monitor - - Operating Systems (CP/M 2.2, ZSDOS) - - ROM BASIC (Nascom BASIC and Tasty BASIC) - - ROM Forth +- System Monitor +- Operating Systems (CP/M 2.2, ZSDOS) +- ROM BASIC (Nascom BASIC and Tasty BASIC) +- ROM Forth A dynamic disk drive letter assignment mechanism allows mapping operating system drive letters to any available disk media. -Additionally, mass media devices (IDE Disk, CF Card, SD Card) support +Additionally, mass storage devices (IDE Disk, CF Card, SD Card) support the use of multiple slices (up to 256 per device). Each slice contains a complete CP/M filesystem and can be mapped independently to any drive letter. This overcomes the inherent size limitations in legacy OSes and allows up to 2GB of accessible storage on a single device. -The pre-built ROM firmware images are generally optimal for most users. +The pre-built ROM firmware images are generally suitable for most users. However, it is also very easy to modify and build custom ROM images that fully tailor the firmware to your specific preferences. All tools -required to build custom ROM firmware are included – no need to install -assemblers, etc. Any modern computer running Windows, Linux, or MacOS -can be used. +required to build custom ROM firmware under Windows are included – no +need to install assemblers, etc. The firmware can also be built using +Linux or MacOS after confirming a few standard tools have been +installed. Multiple disk images are provided in the distribution. Most disk images contain a complete, bootable, ready-to-run implementation of a specific @@ -72,1099 +63,180 @@ with a full operating system implementation. If you use this disk image, you can easily pick whichever operating system you want to boot without changing media. -# Installation - -The latest RomWBW distribution downloads are maintained on GitHub in the -[RomWBW Repository](https://github.com/wwarthen/RomWBW). The fully-built -distributions are found on the [releases -page](https://github.com/wwarthen/RomWBW/releases) of the repository. On -this page, you will probably see both pre-releases as well as normal -releases. Unless you have a specific reason, I suggest you stick to the -most recent normal release (not pre-release). Expand the “Assets†-drop-down for the release you want to download, then select the asset -named RomWBW-vX.X.X-Package.zip. The Package asset includes all -pre-built ROM and Disk images as well as full source code. The other -assets are Source Code only and do not have the pre-built ROM or disk -images. - -The pre-built ROM images will automatically detect and support a -reasonable range of devices including serial ports, video adapters, -on-board disk interfaces, and PropIO/ParPortProp boards without building -a custom ROM. The distribution is a .zip archive. After downloading it -to a working directory on your modern computer (Windows/Linux/Mac) use -any zip tool to extract the contents of the archive. - -In general, you will just program your system’s ROM chip with the -appropriate ROM image from the RomWBW distribution. Depending on how you -got your system, you may have already been provided with a -pre-programmed ROM chip. If so, use that initially. Otherwise, you will -need to use a ROM programmer to initially program your ROM chip. Please -refer to the documentation that came with your ROM programmer for more -information. Once you have a running RomWBW system, you can generally -update your ROM to a newer version in-situ with an included ROM Flashing -tool (Will Sowerbutts’ FLASH application) as described in the Upgrading -section below. - -Looking at the extracted distribution archive, You will see that the -distribution is broken up into a few sub-directories. The Binary -directory contains the pre-built ROM and disk images. The ROM image -files all end in “.româ€. Based on the table below, **carefully** pick -the appropriate ROM image for your hardware. - -| Platform | ROM Image File | Baud | Description | -| --------- | --------------- | -----: | ----------------------------------------------- | -| SBC | SBC\_std.rom | 38400 | RetroBrew SBC v1 or v2 ECB Z80 | -| Zeta V1 | ZETA\_std.rom | 38400 | RetroBrew Zeta V1 Z80, ParPortProp (optional) | -| Zeta V2 | ZETA2\_std.rom | 38400 | RetroBrew Zeta V2 Z80, ParPortProp (optional) | -| N8 | N8\_std.rom | 38400 | RetroBrew N8 Z180, date code \>= 2312 | -| Mark IV | MK4\_std.rom | 38400 | RetroBrew Mark IV ECB Z180 | -| RC Z80 | RCZ80\_std.rom | 115200 | RC2014 w/ Z80 CPU, requires 512K RAM/ROM module | -| RC Z180\* | RCZ180\_ext.rom | 115200 | RC2014 w/ Z180 CPU & 512K banked RAM/ROM module | -| RC Z180\* | RCZ180\_nat.rom | 115200 | RC2014 w/ Z180 CPU & 512K native RAM/ROM module | -| Easy Z80 | EZZ80\_std.rom | 115200 | Sergey Kiselev’s Easy Z80 | -| SC126 | SCZ180\_126.rom | 115200 | Stephen Cousin’s SC126 Z180 | -| SC130 | SCZ180\_130.rom | 115200 | Stephen Cousin’s SC130 Z180 | -| SC131 | SCZ180\_131.rom | 115200 | Stephen Cousin’s SC131 Z180 | -| Dyno | DYNO\_std.rom | 38400 | Steve Garcia’s Z180 Dyno Computer | - -\*The RC2014 Z180 requires a separate RAM/ROM memory module. There are -two types of these modules and you must pick the ROM for your type of -memory module. The “ext†ROM supports Spencer’s official 512K RAM/ROM -banked memory module. The “nat†ROM supports any of the third-party Z180 -native memory modules. - -RomWBW will automatically attempt to detect and support typical add-on -components for each of the systems supported. More information on the -required system configuration and optional supported components for each -ROM is found in the file called “RomList.txt†in the Binary directory. -All pre-built ROM images are simple 512KB binary images. If your system -utilizes a larger ROM chip, you can just program the image into the -first 512KB of the ROM. - -Connect a serial terminal or computer with terminal emulation software -to the primary serial port of your CPU board. You may need to refer to -your hardware provider’s documentation for details. A null-modem -connection may be required. Set the baud rate as indicated in the table -above. Set the line characteristics to 8 data bits, 1 stop bit, no -parity, and no flow control. If possible, 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, application, or -boot from a disk device. - -Initially, you should try the ROM boot options. By selecting either CP/M -2.2 or Z-System, the selected operating system will be loaded from ROM -and you will see the a `B>` disk prompt. In this scenario, A: will be an -empty RAM disk and B: will refer to your ROM disk containing some common -applications. This provides a simple environment for learning to use -your system. Be aware that files saved to the RAM disk (A:) will -disappear at the next power on (RAM is generally not persistent). Also -note that attempts to save files to the ROM disk (B:) will fail because -ROM is not writable. - -# General Usage - -Each of the operating systems and ROM applications included with RomWBW -are sophisticated tools in their own right. It is not reasonable to -document their usage here. However, you will find complete manuals in -PDF format in the Doc directory of the distribution. The intention of -this section is to document the RomWBW specific enhancements to these -operating systems. - -## Inbuilt ROM Applications - -In addition to CP/M 2.2 and Z-System, there are several ROM applications -that can be launched directly from ROM. These applications are not -hosted by an operating system and so they are unable to save files to -disk devices. - -The following ROM applications are available at the boot loader prompt: - -| Application | | -| ----------- | ------------------------------------------------------ | -| Monitor | Z80 system debug monitor w/ Intel Hex loader | -| Forth | Brad Rodriguez’s ANSI compatible Forth language | -| Basic | Nascom 8K BASIC language | -| Tasty BASIC | Dimitri Theuling’s Tiny BASIC implementation | -| Play | A simple video game (requires ANSI terminal emulation) | - -In general, the command to exit these applications and restart the -system is `BYE`. The exceptions are the Monitor which uses `B` and Play -which uses `Q`. - -Space is available in the ROM image for the inclusion of other software. -Any inbuilt application can be set up to launch automatically at -startup. - -## Devices and Units - -In order to support a wide variety of hardware, RomWBW HBIOS uses a -modular approach to implementing device drivers and presenting devices -to the operating system. In general, all devices are classified as one -of the following: - - - Disk (Hard Disk, CF Card, SD Card, RAM/ROM Disk, etc.) - - Character (Serial Ports, Parallel Ports, etc.) - - Video (Video Display/Keyboard Interfaces) - - RTC/NVRAM (Real Time Clock, Non-volatile RAM) - -HBIOS uses the concept of unit numbers to present a complex set of -hardware devices to the operating system. As an example, a typical -system might have a ROM Disk, RAM Disk, Floppy Drives, and Disk Drives. -All of these are considered Disk devices and are presented to the -operating system as generic block devices. This means that the operating -system does not need to understand the difference between a floppy drive -and a ROM disk. - -As RomWBW boots, it assigns a unit number to each device. This unit -number is used by the operating system to refer to the device. It is, -therefore, important to know the unit number assigned to each device. -This information is displayed in the unit summary table at startup. Here -is an example: - - Unit Device Type Capacity/Mode - ---------- ---------- ---------------- -------------------- - Char 0 UART0: RS-232 38400,8,N,1 - Char 1 UART1: RS-232 38400,8,N,1 - Disk 0 MD1: RAM Disk 384KB,LBA - Disk 1 MD0: ROM Disk 384KB,LBA - Disk 2 FD0: Floppy Disk 3.5",DS/HD,CHS - Disk 3 FD1: Floppy Disk 3.5",DS/HD,CHS - Disk 4 IDE0: CompactFlash 3815MB,LBA - Disk 5 IDE1: Hard Disk -- - Disk 6 PRPSD0: SD Card 1886MB,LBA - Video 0 CVDU0: CRT Text,80x25 - -In this example, you can see that the system has a total of 7 Disk Units -numbered 0-6. There are also 2 Character Units and 1 Video Unit. The -table shows the unit numbers assigned to each of the devices. Notice how -the unit numbers are assigned sequentially regardless of the specific -device. - -There may or may not be media in the disk devices listed. For example, -the floppy disk devices (Disk Units 2 & 3) may not have a floppy in the -drive. Also note that Disk Unit 4 shows a disk capacity, but Disk Unit 5 -does not. This is because the PPIDE interface of the system supports up -to two drives, but there is only one actual drive attached. A unit -number is assigned to all possible devices regardless of whether they -have actual media installed at boot time. - -Note that Character Unit 0 is **always** the initial system console by -definition. - -If your system has an RTC/NVRAM device, it will not be listed in the -unit summary table. Since only a single RTC/NVRAM device can exist in -one system, unit numbers are not required nor used for this type of -device. - -## Drive Letter Assignment - -In legacy CP/M-type operating systems, drive letters were generally -mapped to disk drives in a completely fixed way. For example, drive A: -would **always** refer to the first floppy drive. Since RomWBW supports -a wide variety of hardware configurations, it implements a much more -flexible drive letter assignment mechanism so that any drive letter can -be assigned to any disk device. - -At boot, you will notice that RomWBW automatically assigns drive letters -to the available disk devices. These assignments are displayed during -the startup of the selected operating system. Additionally, you can -review the current drive assignments at any time using the `ASSIGN` -command. CP/M 3 and ZPM3 do not automatically display the assignments at -startup, but you can use `ASSIGN` do display them. - -The drive letter assignments **do not** change during an OS session -unless you use the `ASSIGN` command yourself to do it. Additionally, the -assignments at boot will stay the same on each boot as long as you do -not make changes to your hardware configuration. Note that the -assignments **are** dependent on the media currently inserted in hard -disk drives. So, notice that if you insert or remove an SD Card or CF -Card, the drive assignments will change. Since drive letter assignments -can change, you must be careful when doing destructive things like using -`CLRDIR` to make sure the drive letter you use is referring to the -desired media. - -When performing a ROM boot of an operating system, note that A: will be -your RAM disk and B: will be your ROM disk. When performing a disk boot, -the disk you are booting from will be assigned to A: and the rest of the -drive letters will be offset to accommodate this. This is done because -most legacy operating systems expect that A: will be the boot drive. - -## Slices - -The vintage operating systems included with RomWBW were produced at a -time when mass storage devices were quite small. CP/M 2.2 could only -handle filesystems up to 8MB. In order to achieve compatibility across -all of the operating systems supported by RomWBW, the hard disk -filesystem format used is 8MB. This ensures any filesystem will be -accessible to any of the operating systems. - -Since storage devices today are quite large, RomWBW implements a -mechanism called slicing to allow up to 256 8MB filesystems on a single -large storage device. This allows up to 2GB of usable space on a single -media. You can think of slices as a way to refer to any of the first 256 -8MB chunks of space on a single media. - -Of course, the problem is that CP/M-like operating systems have only 16 -drive letters (A:-P:) available. Under the covers, RomWBW allows you to -use any drive letter to refer to any slice of any media. The `ASSIGN` -command is allows you to view or change the drive letter mappings at any -time. At startup, the operating system will automatically allocate a -reasonable number of drive letters to the available storage devices. The -allocation will depend on the number of large storage devices available -at boot. For example, if you have only one hard disk type media, you -will see that 8 drive letters are assigned to the first 8 slices of that -media. If you have two large storage devices, you will see that each -device is allocated four drive letters. - -Referring to slices within a storage device is done by appending a : -** where ** is the device relative slice number from 0-255. For -example, if you have an IDE device, it will show up as IDE0: in the boot -messages meaning the first IDE device. To refer to the fourth slice of -IDE0, you would type “IDE0:3â€. Here are some examples: - -| | | -| -------- | ---------------------------- | -| `IDE0:0` | First slice of disk in IDE0 | -| `IDE0:` | First slice of disk in IDE0 | -| `IDE0:3` | Fourth slice of disk in IDE0 | - -So, if I wanted to use drive letter L: to refer to the fourth slice of -IDE0, I could use the command `ASSIGN L:=IDE0:3`. There are a couple of -rules to be aware of when assigning drive letters. First, you may only -refer to a specific device/slice with one drive letter. Said another -way, you cannot have multiple drive letters referring to a single -device/slice at the same time. Second, there must always be a drive -assigned to A:. Any attempt to violate these rules will be blocked by -the `ASSIGN` command. - -Unlike MS-DOS partitions, slices are not allocated – there is no -partitioning for slices. Think of every hard disk type device as having -a pre-allocated set of 256 8MB slices at the start of the media. You can -refer to any of them simply by assigning a drive letter. RomWBW will not -check to see if there is anything else on the hard disk in the slice you -are referring to, nor will it verify that the hard disk media is large -enough to have a slice at the location you refer to. If you attempt to -write past the end of your media, you will get an I/O error displayed, -so you will know if you make a mistake. There is no tracking of your use -of slices – you will need to keep track of your use of slices yourself. - -Nothing automatically initializes a slice as a file system. You must do -that yourself using `CLRDIR`. Since `CLRDIR` works on drive letters, -make absolutely sure you know what media and slice are assigned to that -drive letter before using `CLRDIR`. - -While it is probably obvious, you cannot use slices on any media less -than 8MB in size. Specifically, you cannot slice RAM disks, ROM disks, -floppy disks, etc. - -# RomWBW Custom Applications - -The operation of the RomWBW hosted operating systems is enhanced through -several custom applications. These applications are functional on all of -the OS variants included with RomWBW. - -The following custom applications are found on the ROM disk and are, -therefore, globally available. - -| Application | Description | -| ----------- | ---------------------------------------------------------------------------------------------------- | -| ASSIGN | Add, change, and delete drive letter assignments. Use ASSIGN /? for usage instructions. | -| SYSCOPY | Copy system image to a device to make it bootable. Use SYSCOPY with no parms for usage instructions. | -| MODE | Reconfigures serial ports dynamically. | -| FDU | Format and test floppy disks. Menu driven interface. | -| FORMAT | Will someday be a command line tool to format floppy disks. Currently does nothing\! | -| XM | XModem file transfer program adapted to hardware. Automatically uses primary serial port on system. | -| FLASH | Will Sowerbutts’ in-situ ROM programming utility. | -| FDISK80 | John Coffman’s Z80 hard disk partitioning tool. See documentation in Doc directory. | -| TALK | Direct console I/O to a specified character device. | -| RTC | Manage and test the Real Time Clock hardware. | -| TIMER | Display value of running periodic system timer. | -| INTTEST | Test interrupt vector hooking. | - -Some custom applications do not fit on the ROM disk. They are found on -the disk image files or the individual files can be found in the -Binary\\Apps directory of the distribution. - -| Application | Description | -| ----------- | ----------------------------------------------------------- | -| TUNE | Play .PT2, .PT3, .MYM audio files. | -| FAT | Access MS-DOS FAT filesystems from RomWBW (based on FatFs). | - -Additional documentation on all of these applications can be found in -“RomWBW Applications.pdf†in the Doc directory of the distribution. - -# Using Disks - -## ROM & RAM Disks - -RomWBW utilizes a portion of the ROM and RAM memory in your system to -implement small memory-based disks. - -The RAM disk provides a small CP/M filesystem that you can use for the -temporary storage of files. Unless your system has a battery backed -mechanism for persisting your RAM contents, the RAM disk contents will -be lost at each power-off. However, the RAM disk is an excellent choice -for storing temporary files because it is very fast. - -Like the RAM disk, the ROM disk also provides a small CP/M filesystem, -but it’s contents are static – they are part of the ROM. As such, you -cannot save files to the ROM disk. Any attempt to do this will result in -a disk I/O error. The contents of the ROM disk have been chosen to -provide a core set of tools and applications that are helpful for either -CP/M 2.2 or ZSDOS. Since ZSDOS is CP/M 2.2 compatible, this works fairly -well. However, you will find some files on the ROM disk that will work -with ZSDOS, but will not work on CP/M 2.2. For example, `LDDS`, which -loads the ZSDOS date/time stamper will only run on ZSDOS. - -## Disk Devices - -While the RAM/ROM disks provide a functional system, they are not useful -in the long term because you cannot save data across power cycles. They -are also constrained by limited space. - -The systems supported by RomWBW all have the ability to use persistent -disk media. A wide variety of disk devices are supported including -floppy drives, hard disks, CF Cards, and SD Cards. Some systems have -disk interfaces built-in, while others will require add-in cards. You -will need to refer to the documentation for your system for your -specific options. - -In the RomWBW boot messages, you will see hardware discovery messages. -If you have a disk drive interface, you should see messages listing -device types like FD:, IDE:, PPIDE:, SD:. Additionally, you will see -messages indicating the media that has been found on the interfaces. As -an example, here are the messages you might see if you have an IDE -interface in your system with a single CF Card inserted in the primary -side of the interface: - - IDE: IO=0x80 MODE=MK4 - IDE0: 8-BIT LBA BLOCKS=0x00773800 SIZE=3815MB - IDE1: NO MEDIA - -The messages you see will vary depending on your hardware and the media -you have installed. But, they will all have the same general format as -the example above. - -Once your your system has working disk devices, you can boot an -operating system and the operating system will have access to the media. -At the boot loader prompt, select either either CP/M 2.2 or Z-System to -boot from ROM. As the operating system starts up, you should see a list -of drive letters assigned to the disk media you have installed. Here is -an example of this: - - Configuring Drives... - - A:=MD1:0 - B:=MD0:0 - C:=IDE0:0 - D:=IDE0:1 - -You will probably see more drive letters than this. The drive letter -assignment process is described above in the Drive Letter Assignment -section. Be aware that RomWBW will only assign drive letters to disk -interfaces that actually have media in them. If you do not see drive -letters assigned as expected, refer to the prior system boot messages to -ensure media has been detected in the interface. Actually, there is one -exception to this rule: floppy drives will be assigned a drive letter -regardless of whether there is any media inserted at boot. - -Notice how each drive letter refers back to a specific disk hardware -interface like IDE0. This is important as it is telling you what each -drive letter refers to. Also notice that mass storage disks (like IDE) -will normally have multiple drive letters assigned. The extra drive -letters refer to additional “slices†on the disk. The concept of slices -is described above in the Slices section. - -Once you are seeing drive letters referring to your disk media, you can -follow the instructions below to begin using the disk media with the -operating system. Your disk media **must** be initialized prior to being -used. There are two ways to initialize your media for use. - -One option is to initialize the media in-place using your RomWBW system. -This process is described below under Disk Initialization. In this -scenario, you will need to subsequently copy any files you want to use -onto the newly initialized disk (see Transferring Files). - -Alternatively, you can use your modern Windows, Linux, or Mac computer -to copy a disk image onto the disk media. RomWBW comes with a variety of -disk images that are ready to use and have a much more complete set of -files than you will find on the ROM disk. This process is covered below -under Disk Images. - -## Disk Initialization - -To use a disk device, you will need to initialize the directory of the -filesystem. On RomWBW, the initialization is done using the CLRDIR -application. For example if your C: drive has been assigned to a storage -device, you would use `CLRDIR C:` to initialize C: and prepare it hold -files. Note that CLRDIR will prompt you for confirmation and you must -respond with a **capital** ‘Y’ to confirm. Once `CLDIR` has completed, -you can copy files onto the drive, for example `COPY *.* C:`. Be very -careful to pay attention to your drive letter assignments prior to -running `CLRDIR` to avoid accidentally wiping out a filesystem that has -data on it. - -Running `CLRDIR` on a disk device is roughly equivalent to running -FORMAT on MS-DOS. Note that unlike MS-DOS you do **not** partition your -mass storage device. CP/M knows nothing about disk partitions. You may -notice a partitioning application on your ROM disk (FDISK80), but this -is strictly for an advanced technique of adding an MS-DOS FAT filesystem -to your media in addition to the CP/M area. Do not use FDISK80 unless -you are specifically attempting to add an MS-DOS FAT filesystem to your -media. - -If you are using a floppy drive, you will need to physically format your -floppy disk prior to use. This is only required for floppy disks, not -hard disk, CF Cards, or SD Cards, etc. To format a floppy drive, you can -use the interactive application `FDU`. FDU is not terribly user -friendly, but is generally documented in the file “FDU.txt†found in the -Doc directory of the distribution. It is not necessary to run `CLRDIR` -on a floppy disk after physically formatting it – the directory is -cleared as part of the formatting. - -Once you have initialized a disk device and copied your desired files -onto it, you may want to make the disk bootable. On CP/M filesystems, -you must perform one additional step to make a disk bootable. -Specifically, you need to place a copy of the operating system on the -system tracks of the disk. This is done using the `SYSCOPY` command. -Let’s say you have prepared drive C: by initializing it with `CLRDIR` -and copied some files onto it. You can now make C: bootable by running -the following command: - -`B>SYSCOPY C:=B:ZSYS.SYS` - -This command means: copy the Z-System operating system onto the system -tracks of drive C:. In this example, it is assumed that you have booted -from ROM, so B: is the ROM disk drive. Additionally, this example -assumes you want the Z-System operating system to be booted from C:. If -you want CP/M 2.2 instead, you would replace `B:ZSYS.SYS` with -`B:CPM.SYS`. Here is a full example of this process. - - B>SYSCOPY C:=B:ZSYS.SYS - - SYSCOPY v2.0 for RomWBW CP/M, 17-Feb-2020 (CP/M 2 Mode) - Copyright 2020, Wayne Warthen, GNU GPL v3 - - Transfer system image from B:ZSYS.SYS to C: (Y/N)? Y - Reading image... Writing image... Done - -Once this process succeeds, you will be able to boot directly to the -disk from the boot loader prompt. See the instructions in Booting Disks -for details on this. - -## Disk Images - -As mentioned previously, RomWBW includes a variety of disk images that -contain a full set of applications for the operating systems supported. -It is generally easier to use these disk images instead of copying all -the files over using XModem. You use your modern computer (Windows, -Linux, MacOS) to place the disk image onto the disk media, then just -move the media over to your system. In this scenario you **do not** run -`CLRDIR` or `SYSCOPY` on the drive(s). The directory is prepared and the -disk is already bootable, if it is an operating system boot disk image. - -To copy the disk image files onto your actual media (floppy disk, CF -Card, SD Card, etc.), you need to use an image writing utility on your -modern computer. Your modern computer will need to have an appropriate -interface or slot that accepts the media. To actually copy the image, -you can use the `dd` command on Linux or MacOS. On Windows, in the -“Tools†directory of the distribution there are two tools you can use. -For floppy media, you can use RawWriteWin and for hard disk media, you -can use Win32DiskImager. In all cases, the image file should be written -to the media starting at the very first block or sector of the media. -This will **destroy** any other data on the media. +By design, RomWBW isolates all of the hardware specific functions in the +ROM chip itself. The ROM provides a hardware abstraction layer such that +all of the operating systems and applications on a disk will run on any +RomWBW-based system. To put it simply, you can take a disk (or CF/SD +Card) and move it between systems transparently. + +A tool is provided that allows you to access a FAT-12/16/32 filesystem. +The FAT filesystem may be coresident on the same disk media as RomWBW +slices or on stand-alone media. This makes exchanging files with modern +OSes such as Windows, MacOS, and Linux very easy. + +# Acquiring RomWBW + +The [RomWBW Repository](https://github.com/wwarthen/RomWBW) on GitHub is +the official distribution location for all project source and +documentation. The fully-built distribution releases are available on +the [RomWBW Releases Page](https://github.com/wwarthen/RomWBW/releases) +of the repository. On this page, you will normally see a Development +Snapshot as well as recent stable releases. Unless you have a specific +reason, I suggest you stick to the most recent stable release. Expand +the “Assets†drop-down for the release you want to download, then select +the asset named RomWBW-vX.X.X-Package.zip. The Package asset includes +all pre-built ROM and Disk images as well as full source code. The other +assets contain only source code and do not have the pre-built ROM or +disk images. -The disk image files are found in the Binary directory of the -distribution. Floppy disk images are prefixed with “fd\_†and hard disk -images are prefixed with “hd\_â€. The floppy images are specifically for -1.44M floppy media only. Each disk image has the complete set of normal -applications and tools distributed with the associated operating system -or application suite. - -The following table shows the disk image files available. Note that the -images in the “Hard†column are fine for use on CF Cards, SD Cards, as -well as real spinning hard disks. - -| Floppy | Hard | Description | -| ------------- | ------------- | ---------------------------- | -| fd\_cpm22.img | hd\_cpm22.img | DRI CP/M 2.2 boot disk | -| fd\_zsdos.img | hd\_zsdos.img | ZSDOS 1.1 boot disk | -| fd\_nzcom.img | hd\_nzcom.img | NZCOM boot disk | -| fd\_cpm3 | hd\_cpm3.img | DRI CP/M 3 boot disk | -| fd\_zpm3 | hd\_zpm3.img | ZPM3 boot disk | -| fd\_ws4 | hd\_ws4.img | WordStar v4 application disk | - -In addition to the disk images above, there is also a special hard disk -image called hd\_combo.img. This image contains all of the images above, -but in a single image with 6 slices. At the boot loader prompt, you can -choose a disk with the combo image, then select the specific slice you -want. This allows a single disk to have all of the possible operating -system options. - -This is the layout of the hd\_combo disk image: - -| Slice | Description | -| ------- | ---------------------------- | -| Slice 0 | DRI CP/M 2.2 boot disk | -| Slice 1 | ZSDOS 1.1 boot disk | -| Slice 2 | NZCOM boot disk | -| Slice 3 | DRI CP/M 3 boot disk | -| Slice 4 | ZPM3 boot disk | -| Slice 5 | WordStar v4 application disk | - -Note that unlike the ROM firmware, you do **not** need to choose a disk -image specific to your hardware. Because the RomWBW firmware provides a -hardware abstraction layer, all hard disk images will work on all -hardware variations. Yes, this means you can remove an SD Card from one -system and put it in a different system. The only constraint is that the -applications on the disk media must be up to date with the firmware on -the system being used. - -All of the disk images that indicate they are bootable (boot disk) will -boot from disk as is. You do not need to run `SYSCOPY` on them to make -them bootable. However, if you upgrade your ROM, you should use -`SYSCOPY` to update the system tracks. - -## Booting Disks - -When starting your system, following the hardware initialization, you -will see the Boot Loader prompt. In addition, to the ROM boot options, -you will see another line listing the Disk boot options. This line lists -the disk devices that you can choose to boot directly. - -You will notice that you do not have an option to boot a drive letter -here (like C:). This is because the operating system is not yet loaded. -When you ran `SYSCOPY` previously, remember that C: was assigned to -IDE0:0 which means device IDE0, slice 0. So, to boot the disk that you -just setup with `SYSCOPY`, you would choose option 2. You will then be -prompted for the slice on IDE0 that you want to boot. For now, just -press enter to choose slice 0. Once you are familiar with slices, you -can `SYSCOPY` and boot alternate slices. Here is what you would see when -booting to a disk device: - - MARK IV Boot Loader - - ROM: (M)onitor (C)P/M (Z)-System (F)orth (B)ASIC (T)-BASIC (P)LAY (U)SER ROM - Disk: (0)MD1 (1)MD0 (2)IDE0 (3)IDE1 - - Boot Selection? 2 Slice(0-9)[0]? - - Booting Disk Unit 2, Slice 0... - - Reading disk information... - Loc=D000 End=FE00 Ent=E600 Label=Unlabeled Drive - - Loading... - -Following this, you would see the normal operating system startup -messages. However, your operating system prompt will be `A>` and when -you look at the drive letter assignments, you should see that A: has -been assigned to the disk you selected to boot. - -If you receive the error message “Disk not bootable\!â€, you have either -failed to properly run `SYSCOPY` on the target disk or you have selected -the wrong disk/slice. - -Note that although MD1 (RAM disk) and MD0 (ROM disk) drives are listed -in the Disk boot line, they are not “bootable†disks because they have -no system tracks on them. Attempting to boot to one of them, will fail -with a “Disk not bootable\!†error message and return to the loader -prompt. - -# Operating Systems - -One of the primary goals of RomWBW is to expose a set of generic -hardware functions that make it easy to adapt operating systems to any -hardware supported by RomWBW. As a result, there are now 5 operating -systems that have been adapted to run under RomWBW. The adaptations are -identical for all hardware supported by RomWBW because RomWBW hides all -hardware specifics from the operating system. - -Note that all of the operating systems included with RomWBW support the -same basic filesystem format. As a result, a formatted filesystem will -be accessible to any operating system. The only possible issue is that -if you turn on date/time stamping using the newer OSes, the older OSes -will not understand this. Files will not be corrupted, but the date/time -stamps may be lost. - -The following sections briefly describe the operating system options -currently available. - -## Digital Research CP/M 2.2 - -This is the most widely used variant of the Digital Research operating -system. It has the most basic feature set, but is essentially the -compatibility metric for all other CP/M-like operating systems including -all of those listed below. The Doc directory contains a manual for CP/M -usage (“CPM Manual.pdfâ€). If you are new to the CP/M world, I would -recommend using this CP/M variant to start with simply because it is the -most stable and you are less likely to encounter problems. - -### Notes - - - The original versions of DDT, DDTZ, and ZSID used the RST 38 vector - which conflicts with interrupt mode 1 use of this vector. The DDT, - DDTZ, and ZSID applications in RomWBW have been modified to use RTS - 30 to avoid this issue. - - - Z-System applications will not run under CP/M 2.2. For example, the - `LDDS` date stamper with not run. - -## ZSDOS 1.1 - -ZSDOS is the most popular non-DRI CP/M “clone†which is generally -referred to as Z-System. Z-System is intended to be an enhanced version -of CP/M and should run all CP/M 2.2 applications. It is optimized for -the Z80 CPU (as opposed to 8080 for CP/M) and has some significant -improvements such as date/time stamping of files. For further -information on the RomWBW implementation of Z-System, see the wiki page -[Z-System -Notes](https://www.retrobrewcomputers.org/doku.php?id=software:firmwareos:romwbw:zsystem). -Additionally, the official documentation for Z-System is included in the -RomWBW distribution Doc directory (“ZSDOS Manual.pdf†and “ZCPR -Manual.pdfâ€). - -### Notes - - - Although most CP/M 2.2 applications will run under Z-System, some - may not work as expected. The best example is PIP which is not aware - of the ZSDOS paths and will fail in some scenarios (use `COPY` - instead). - -## NZCOM Automatic Z-System - -NZCOM is a much further refined version of Z-System (ZCPR 3.4). NZCOM -was sold as an enhancement for existing users of CP/M 2.2 or ZSDOS. For -this reason, (by design) NZCOM does not provide a way to boot directly -from disk. Rather, it is loaded after the system boots into a host OS. -On the RomWBW NZCOM disk images, the boot OS is ZSDOS 1.1. After you -configure NZCOM, you can add a `PROFILE.SUB` file to automatically -launch NZCOM at boot. - -NZCOM is not pre-configured. You must run through a simple configuration -process before loading it. Run MKZCM to do this. - -NZCOM has substantially more functionality than CP/M or basic Z-System. -It is important to read the the “NZCOM Users Manual.pdf†file in the -RomWBW Doc directory. - -### Notes - - - There is no `DIR` command, you must use `SDZ` instead. If you don’t - like this, look into the ALIAS facility. - -## Digital Research CP/M 3 - -This is the Digital Research follow-up product to their very popular -CP/M 2.2 operating system. While highly compatible with CP/M 2.2, it -features many enhancements. It makes direct use of banked memory to -increase the user program space (TPA). It also has a new suite of -support tools and help system. - -Note that to make a CP/M 3 boot disk, you actually place CPMLDR.SYS on -the system tracks of the disk. You do not place CPM3.SYS on the system -tracks. `CPMLDR.SYS` chain loads `CPM3.SYS`. - -### Notes - - - The `DATE` command cannot yet be used to **set** the RTC. The RTC is - used to read the current date/time for file stamping, etc. You can - use the `RTC` app to set the RTC clock. - -## Simeon Cran’s ZPM3 - -ZPM3 is an interesting combination of the features of both CP/M 3 and -ZCPR 3. Essentially, it has the features of and compatibility with both. - -Like CP/M 3, to make ZPM3 boot disk, you put CPMLDR.SYS on the system -tracks of the disk. - -### Notes - - - `ZPMLDR` is included with ZPM3, but it is not working correctly. - - - The ZPM operating system is contained in the file called CPM3.SYS - which is confusing, but it is the author’s intended way of using - ZPM3. - -## FreeRTOS - -Phillip Stevens has ported FreeRTOS to run under RomWBW. FreeRTOS is not -provided in the RomWBW distribution. FreeRTOS is available under the -[MIT licence](https://www.freertos.org/a00114.html) and further general -information is available at -[FreeRTOS](https://www.freertos.org/RTOS.html). - -You can also contact Phillip for detailed information on the Z180 -implementation of FreeRTOS for RomWBW. -[feilipu](https://github.com/feilipu) - -# Transferring Files - -Transferring files between your modern computer and your RomWBW system -can be achieved in a variety of ways. The most common of these are -described below. All of these have a certain degree of complexity and I -encourage new users to use the available community forums to seek -assistance as needed. - -## Serial Port Transfers - -RomWBW provides an serial file transfer program called XModem that has -been adapted to run under RomWBW hardware. The program is called `XM` -and is on your ROM disk as well as all of the pre-built disk images. - -You can type `XM` by itself to get usage information. In general, you -will run `XM` with parameters to indicate you want to send or receive a -file on your RomWBW system. Then, you will use your modern computers -terminal program to complete the process. - -The `XM` application generally tries to detect the hardware you are -using and adapt to it. However, you must ensure that you have a reliable -serial connection. You must also ensure that the speed of the connection -is not too fast for XModem to service. Alternatively, you can ensure -that hardware flow control is working properly. - -There is an odd interaction between XModem and partner terminal programs -that can occur. Essentially, after launching `XM`, you must start the -protocol on your modern computer fairly quickly (usually in about 20 -seconds or so). So, if you do not pick a file on your modern computer -quickly enough, you will find that the transfer completes about 16K, -then hangs. The interaction that causes this is beyond the scope of this -document. - -## Disk Image Transfers - -It is possible to pass disk images between your RomWBW system and your -modern computer. This assumes you have an appropriate media slot on your -modern computer for the media you want to use (CF Card, SD Card, or -floppy drive). - -The general process to get files from your modern computer to a RomWBW -computer is: - -1. Use `cpmtools` on your modern computer to create a RomWBW CP/M - filesystem image. - -2. Insert your RomWBW media (CF Card, SD Card, or floppy disk) in your - modern computer. - -3. Use a disk imaging tool to copy the RomWBW filesystem image onto the - media. - -4. Move the media back to the RomWBW computer. - -This process is a little complicated, but it has the benefit of allowing -you to get a lot of files over to your RomWBW system quickly and with -little chance of corruption. - -The process can be run in reverse to get files from your RomWBW computer -to a modern computer. - -The exact use of these tools is a bit too much for this document, but -the tools are all included in the RomWBW distribution along with usage -documents. - -Note that the build scripts for RomWBW create the default disk images -supplied with RomWBW. It is relatively easy to customize the contents of -the disk images that are part of RomWBW. This is described in more -detail in the Source\\Images directory of the distribution. - -## FAT Filesystem Transfers - -RomWBW provides a mechanism that allows it to read and write files on a -FAT formatted disk. This means that you can generally use your modern -computer to make an SD Card or CF Card with a standard FAT32 filesystem -on it, then place that media in your RomWBW computer and access the -files. - -When formatting the media on your modern computer, be sure to pick the -FAT filesystem. NTFS and other filesystems will not work. - -On your RomWBW computer you can use the `FAT` application to access the -FAT media. The `FAT` application allows you to read files, write files, -list a directory, and erase files on the FAT media. It can handle -subdirectories as well. It will only see 8.3 character filenames -however. Longer filenames will show up as a truncated version. - -The `FAT` application is not on your ROM disk because it is too large to -fit. You will find it on all of the pre-built disk images as well as in -the Binary\\Apps directory of the distribution. - -For advanced users, it is possible to create a hybrid disk that contains -CP/M slices at the beginning and a FAT filesystem after. Such a hybrid -disk can be used to boot an operating system and still have access to -FAT files on the FAT portion of the disk. David Reese has prepared a -document describing how to do this. It is called -“SC126\_How-To\_No\_2\_Preparing\_an\_SD\_Card\_for\_Use\_with\_SC126\_Rev\_1-5.pdf†-and can be found in the Doc\\Contrib directory of the distribution. - -# Startup Command Processing - -Each of the operating systems supported by RomWBW provide a mechanism to -run commands at boot. This is similar to the AUTOEXEC.BAT files from -MS-DOS. - -With the exception of ZPM3, all operating systems will look for a file -called `PROFILE.SUB` on the system drive at boot. If it is found, it -will be processed as a standard CP/M submit file. You can read about the -use of the SUBMIT facility in the CP/M manuals included in the RomWBW -distribution. Note that the boot disk must also have a copy of -`SUBMIT.EXE`. - -In the case of ZPM3, the file called `STARTZPM.COM` will be run at boot. -To customize this file, you use the ZCPR ALIAS facility. You will need -to refer to ZCPR documentation for more information on the ALIAS -facility. - -Note that the automatic startup processing generally requires booting to -a disk drive. Since the ROM disk is not writable, there is no simple way -to add/edit a `PROFILE.SUB` file there. If you want to customize your -ROM and add a `PROFILE.SUB` file to the ROM Disk, it will work, but is a -lot harder than using a boot disk. - -# ROM Customization +All source code and distributions are maintained on GitHub. Code +contributions are very welcome. -The pre-built ROM images are configured for the basic capabilities of -each platform. Additionally, some of the typical add-on hardware for -each platform will be automatically detected and used. If you want to go -beyond this, RomWBW provides a very flexible configuration mechanism -based on configuration files. Creating a customized ROM requires running -a build script, but it is quite easy to do. +# Installation & Operation -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 and disk images. There are build scripts for -Windows, Linux, and MacOS to accommodate virtually all users. All -required build tools (compilers, assemblers, etc.) are included in the -distribution, so it is not necessary to setup a build environment on -your computer. +In general, installation of RomWBW on your platform is very simple. You +just need to program your ROM with the correct ROM image from the RomWBW +distribution. Subsequently, you can write disk images on your disk +drives (IDE disk, CF Card, SD Card, etc.) which then provides even more +functionality. -The process for building a custom ROM is documented in the ReadMe.txt -file in the Source directory of the distribution. +Complete instructions for installation and operation of RomWBW are found +in the [RomWBW User +Guide](https://github.com/wwarthen/RomWBW/raw/Doc/RomWBW%20User%20Guide.pdf). -For those who are interested in more than basic system customization, -note that all source code is provided (including the operating systems). -Modification of the source code is considered an expert level task and -is left to the reader to pursue. +## Documentation -Note that the ROM customization process does not apply to UNA. All UNA -customization is performed within the ROM setup script. +Documentation for RomWBW includes: -# UNA Hardware BIOS +- [RomWBW User + Guide](https://github.com/wwarthen/RomWBW/raw/Doc/RomWBW%20User%20Guide.pdf) +- [RomWBW System + Guide](https://github.com/wwarthen/RomWBW/raw/Doc/RomWBW%20System%20Guide.pdf) +- [RomWBW + Applications](https://github.com/wwarthen/RomWBW/raw/Doc/RomWBW%20Applications.pdf) +- [RomWBW ROM + Applications](https://github.com/wwarthen/RomWBW/raw/Doc/RomWBW%20ROM%20Applications.pdf) +- [RomWBW + Errata](https://github.com/wwarthen/RomWBW/raw/Doc/RomWBW%20Errata.pdf) -John Coffman has produced a new generation of hardware BIOS called UNA. -The standard RomWBW distribution includes it’s own hardware BIOS. -However, RomWBW can alternatively be constructed with UNA as the -hardware BIOS portion of the ROM. If you wish to use 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. +# Acknowledgments -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 -the 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. +I want to acknowledge that a great deal of the code and inspiration for +RomWBW has been provided by or derived from the work of others in the +RetroBrew Computers Community. I sincerely appreciate all of their +contributions. The list below is probably missing many names – please +let me know if I missed you! -While John is likely to enhance UNA over time, there are currently a few -things that UNA does not support: +- Andrew Lynch started it all when he created the N8VEM Z80 SBC which + became the first platform RomWBW supported. Some of his original code + can still be found in RomWBW. - - Floppy Drives - - Terminal Emulation - - Zeta 1, N8, RC2014, Easy Z80, and Dyno Systems - - Some older support boards +- Dan Werner wrote much of the code from which RomWBW was originally + derived and he has always been a great source of knowledge and advice. -The UNA version embedded in RomWBW is the latest production release of -UNA. RomWBW will be updated with John’s upcoming UNA release with -support for VGA3 as soon as it reaches production status. +- Douglas Goodall contributed code, time, testing, and advice in “the + early daysâ€. He created an entire suite of application programs to + enhance the use of RomWBW. Unfortunately, they have become unusable + due to internal changes within RomWBW. As of RomWBW 2.6, these + applications are no longer provided. -Please refer to the [UNA BIOS Firmware -Page](https://www.retrobrewcomputers.org/doku.php?id=software:firmwareos:una:start) -for more information on UNA. +- Sergey Kiselev created several hardware platforms for RomWBW including + the very popular Zeta. -# Upgrading +- David Giles created support for the Z180 CSIO which is now included SD + Card driver. -Upgrading to a newer release of RomWBW is essentially just a matter of -updating the ROM chip in your system. If you have spare ROM chips for -your system and a ROM programmer, it is always safest to retain your -existing, working ROM chip and program a new one with the new firmware. -If the new one fails to boot, you can easily return to the known working -ROM. +- Phil Summers contributed the Forth and BASIC adaptations in ROM, the + AY-3-8910 sound driver, DMA support, and a long list of general code + and documentation enhancements. -Prior to attempting to reprogram your actual ROM chip, you may wish to -“try†the upgrade. With RomWBW, you can upload a new system image -executable and load it from the command line. For each ROM image file -(.rom) in the Binary directory, you will also find a corresponding -application file (.com). For example, for SBC\_std.rom, there is also an -SBC\_std.com file. You can upload the .com file to your system using -XModem, then simply run the .com file. You will see your system go -through the normal startup process just like it was started from ROM. -However, your ROM has not been updated and the next time you boot your -system, it will revert to the system image contained in ROM. +- Ed Brindley contributed some of the code that supports the RCBus + platform. -There are two restrictions to be aware of related to loading a system -image as a .com application. First, this is only supported under -Z-System and CP/M 2.2. You must boot into one of these OSes before -attempting to launch the .com file. Second, you may find that you are -unable to load the .com file because it is too large to fit in available -application RAM (TPA). Your only recourse in this situation is to build -a custom ROM with fewer features. +- Spencer Owen created the RC2014 series of hobbyist kit computers which + has exponentially increased RomWBW usage. Some of his kits include + RomWBW. -If you do not have easy access to a ROM programmer, it is usually -possible to reprogram your system ROM using the FLASH utility from Will -Sowerbutts. This application, called FLASH.COM, can be found on the ROM -drive of any running system. In this case, you would need to transfer -the new ROM image (.rom) over to your system using XModem (or one of the -other mechanisms described in the Transferring Files section). The ROM -image is too large to fit on your RAM drive, so you will need to -transfer it to a larger storage drive. Once the ROM image is on your -system, you can use the FLASH application to update your ROM. The -following is a typical example of transferring ROM image using XModem -and flashing the chip in-situ. +- Stephen Cousins has likewise created a series of hobbyist kit + computers at Small Computer Central and is distributing RomWBW with + many of them. - E>xm r rom.img - - XMODEM v12.5 - 07/13/86 - RBC, 28-Aug-2019 [WBW], ASCI - - Receiving: E0:ROM.IMG - 7312k available for uploads - File open - ready to receive - To cancel: Ctrl-X, pause, Ctrl-X - - Thanks for the upload - - E>flash write rom.img - FLASH4 by Will Sowerbutts version 1.2.3 - - Using RomWBW (v2.6+) bank switching. - Flash memory chip ID is 0xBFB7: 39F040 - Flash memory has 128 sectors of 4096 bytes, total 512KB - Write complete: Reprogrammed 2/128 sectors. - Verify (128 sectors) complete: OK! +- Alan Cox has contributed some driver code and has provided a great + deal of advice. -Obviously, there is some risk to this approach since any issues with the -programming or ROM image could result in a non-functional system. +- The CP/NET client files were developed by Douglas Miller. -To confirm your ROM chip has been successfully updated, restart your -system and boot an operating system from ROM. Do not boot from a disk -device yet. Review the boot messages to see if any issues have occurred. +- Phillip Stevens contributed support for FreeRTOS. -Once you are satisfied that the ROM is working well, you will need to -update the system images and RomWBW custom applications on your disk -drives. The system images and custom applications are matched to the -RomWBW ROM firmware in use. If you attempt to boot a disk or run -applications that have not been updated to match the current ROM -firmware, you are likely to have odd problems. +- Curt Mayer contributed the original Linux / MacOS build process. -The simplest way to update your disk media is to just use your modern -computer to overwrite the entire media with the latest disk image of -your choice. This process is described below in the Disk Images section. -If you wish to update existing disk media in your system, you need to -perform the following steps. +- UNA BIOS and FDISK80 are the products of John Coffman. -If the disk is bootable, you need to update the system tracks of the -disk. This is done using a SYSCOPY command such as `SYSCOPY -C:=B:ZSYS.SYS`. For a ZSDOS boot disk, use ZSYS.SYS. For a CP/M 2.2 -disk, use CPM.SYS. For a CP/M 3 or ZPM3 disk, use CPMLDR.SYS. CPMLDR.SYS -is not provided on the ROM disk, so you will need to upload it from the -distribution. +- FLASH4 is a product of Will Sowerbutts. -Finally, if you have copies of any of the RomWBW custom applications on -your hard disk, you need to update them with the latest copies. The -following applications are found on your ROM disk. Use COPY to copy them -over any older versions of the app on your disk: +- CLRDIR is a product of Max Scane. - - ASSIGN.COM - - SYSCOPY.COM - - MODE.COM - - FDU.COM (was FDTST.COM) - - FORMAT.COM - - XM.COM - - FLASH.COM - - FDISK80.COM - - TALK.COM - - RTC.COM - - TIMER.COM - - INTTEST.COM +- Tasty Basic is a product of Dimitri Theulings. -For example: `B>COPY ASSIGN.COM C:` +- Dean Netherton contributed the sound driver interface and the SN76489 + sound driver. -Some RomWBW custom applications are too large to fit on the ROM disk. If -you are using any of these you will need to transfer them to your system -and then update all copies. These applications are found in the -Binary\\Apps directory of the distribution and in all of the disk -images. +- The RomWBW Disk Catalog document was produced by Mykl Orders. - - FAT.COM - - TUNE.COM +Contributions of all kinds to RomWBW are very welcome. -# RomWBW Distribution +# Licensing -All source code and distributions are maintained on GitHub. Code -contributions are very welcome. +RomWBW 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. -[RomWBW GitHub -Repository](https://github.com/wwarthen/RomWBW%7Chttps://github.com/wwarthen/RomWBW) +RomWBW 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. -## Distribution Directory Layout +You should have received a copy of the GNU General Public License along +with RomWBW. If not, see . -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: +Portions of RomWBW were created by, contributed by, or derived from the +work of others. It is believed that these works are being used in +accordance with the intentions and/or licensing of their creators. -| Application | Description | -| ----------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| 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â€. | -| Doc | Contains various detailed documentation including the operating systems, RomWBW architecture, etc. | -| 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. | +If anyone feels their work is being used outside of its intended +licensing, please notify: -# Acknowledgments +> Wayne Warthen +> -While I have heavily modified much of the code, I want to acknowledge -that much of the work is derived from the work of others in the -RetroBrew Computers Community 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\!). +RomWBW is an aggregate work. It is composed of many individual, +standalone programs that are distributed as a whole to function as a +cohesive system. Each program may have its own licensing which may be +different from other programs within the aggregate. -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. +In some cases, a single program (e.g., CP/M Operating System) is +composed of multiple components with different licenses. It is believed +that in all such cases the licenses are compatible with GPL version 3. - - David Giles contributed support for the CSIO support in the SD Card - driver. - - Ed Brindley contributed some of the code that supports the RC2014 - platform. - - Phil Summers contributed Forth and BASIC in ROM as well as a long - list of general code enhancements. - - Phillip Stevens contributed support for FreeRTOS. - - Curt Mayer contributed the Linux / MacOS build process. - - UNA BIOS and FDISK80 is a product of John Coffman. - - FLASH4 is a product of Will Sowerbutts. +RomWBW encourages code contributions from others. Contributors may +assert their own copyright in their contributions by annotating the +contributed source code appropriately. Contributors are further +encouraged to submit their contributions via the RomWBW source code +control system to ensure their contributions are clearly documented. -Contributions of all kinds to RomWBW are very welcome. +All contributions to RomWBW are subject to this license. # Getting Assistance The best way to get assistance with RomWBW or any aspect of the -RetroBrew Computers projects is via the community forums: +RetroBrew Computers projects is via one of the community forums: - - [RetroBrew Computers - Forum](https://www.retrobrewcomputers.org/forum/) - - [RC2014 Google - Group](https://groups.google.com/forum/#!forum/rc2014-z80) - - [retro-comp Google - Group](https://groups.google.com/forum/#!forum/retro-comp) +- [RetroBrew Computers Forum](https://www.retrobrewcomputers.org/forum/) +- [RC2014 Google + Group](https://groups.google.com/forum/#!forum/rc2014-z80) +- [retro-comp Google + Group](https://groups.google.com/forum/#!forum/retro-comp) Submission of issues and bugs are welcome at the [RomWBW GitHub Repository](https://github.com/wwarthen/RomWBW). diff --git a/ReadMe.txt b/ReadMe.txt index 95e32039..4cdca439 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,31 +1,22 @@ -RomWBW +RomWBW ReadMe +Wayne Warthen (wwarthen@gmail.com) +18 Mar 2023 -Z80/Z180 System Software -Version 3.0.1 -Monday 30 March 2020 -Wayne Warthen wwarthen@gmail.com +OVERVIEW -Download -- RomWBW Distribution Package - -Related Pages - -- RomWBW Architecture Document -- RomWBW Applications -- RomWBW Errata - -Overview - -RomWBW provides a complete software system for a wide variety of -hobbyist Z80/Z180 CPU-based systems produced by these developer +RomWBW software provides a complete, commercial quality implementation +of CP/M (and workalike) operating systems and applications for modern +Z80/180/280 retro-computing hardware systems. A wide variety of +platforms are supported including those produced by these developer communities: - RetroBrew Computers -- RC2014 +- RC2014, RC2014-Z80 - retro-comp +- Small Computer Central General features include: @@ -33,8 +24,10 @@ General features include: - Disk drivers for RAM, ROM, Floppy, IDE, CF, and SD - Serial drivers including UART (16550-like), ASCI, ACIA, SIO - Video drivers including TMS9918, SY6545, MOS8563, HD6445 -- Real time clock drivers including DS1322, BQ4845 -- Multiple OS support including CP/M 2.2, ZSDOS, CP/M 3, ZPM3 +- Keyboard (PS/2) drivers via VT8242 or PPI interfaces +- Real time clock drivers including DS1302, BQ4845 +- OSes: CP/M 2.2, ZSDOS, CP/M 3, NZ-COM, ZPM3, QPM, p-System, and + FreeRTOS - Built-in VT-100 terminal emulation support RomWBW is distributed as both source code and pre-built ROM and disk @@ -48,18 +41,19 @@ ROM firmware itself: A dynamic disk drive letter assignment mechanism allows mapping operating system drive letters to any available disk media. -Additionally, mass media devices (IDE Disk, CF Card, SD Card) support +Additionally, mass storage devices (IDE Disk, CF Card, SD Card) support the use of multiple slices (up to 256 per device). Each slice contains a complete CP/M filesystem and can be mapped independently to any drive letter. This overcomes the inherent size limitations in legacy OSes and allows up to 2GB of accessible storage on a single device. -The pre-built ROM firmware images are generally optimal for most users. +The pre-built ROM firmware images are generally suitable for most users. However, it is also very easy to modify and build custom ROM images that fully tailor the firmware to your specific preferences. All tools -required to build custom ROM firmware are included – no need to install -assemblers, etc. Any modern computer running Windows, Linux, or MacOS -can be used. +required to build custom ROM firmware under Windows are included – no +need to install assemblers, etc. The firmware can also be built using +Linux or MacOS after confirming a few standard tools have been +installed. Multiple disk images are provided in the distribution. Most disk images contain a complete, bootable, ready-to-run implementation of a specific @@ -68,1128 +62,183 @@ with a full operating system implementation. If you use this disk image, you can easily pick whichever operating system you want to boot without changing media. -Installation - -The latest RomWBW distribution downloads are maintained on GitHub in the -RomWBW Repository. The fully-built distributions are found on the -releases page of the repository. On this page, you will probably see -both pre-releases as well as normal releases. Unless you have a specific -reason, I suggest you stick to the most recent normal release (not -pre-release). Expand the “Assets†drop-down for the release you want to -download, then select the asset named RomWBW-vX.X.X-Package.zip. The -Package asset includes all pre-built ROM and Disk images as well as full -source code. The other assets are Source Code only and do not have the -pre-built ROM or disk images. - -The pre-built ROM images will automatically detect and support a -reasonable range of devices including serial ports, video adapters, -on-board disk interfaces, and PropIO/ParPortProp boards without building -a custom ROM. The distribution is a .zip archive. After downloading it -to a working directory on your modern computer (Windows/Linux/Mac) use -any zip tool to extract the contents of the archive. - -In general, you will just program your system’s ROM chip with the -appropriate ROM image from the RomWBW distribution. Depending on how you -got your system, you may have already been provided with a -pre-programmed ROM chip. If so, use that initially. Otherwise, you will -need to use a ROM programmer to initially program your ROM chip. Please -refer to the documentation that came with your ROM programmer for more -information. Once you have a running RomWBW system, you can generally -update your ROM to a newer version in-situ with an included ROM Flashing -tool (Will Sowerbutts’ FLASH application) as described in the Upgrading -section below. - -Looking at the extracted distribution archive, You will see that the -distribution is broken up into a few sub-directories. The Binary -directory contains the pre-built ROM and disk images. The ROM image -files all end in “.româ€. Based on the table below, carefully pick the -appropriate ROM image for your hardware. - - ------------------------------------------------------------------------- - Platform ROM Image File Baud Description - ---------- ----------------- -------- ----------------------------------- - SBC SBC_std.rom 38400 RetroBrew SBC v1 or v2 ECB Z80 - - Zeta V1 ZETA_std.rom 38400 RetroBrew Zeta V1 Z80, ParPortProp - (optional) - - Zeta V2 ZETA2_std.rom 38400 RetroBrew Zeta V2 Z80, ParPortProp - (optional) - - N8 N8_std.rom 38400 RetroBrew N8 Z180, date code >= - 2312 - - Mark IV MK4_std.rom 38400 RetroBrew Mark IV ECB Z180 - - RC Z80 RCZ80_std.rom 115200 RC2014 w/ Z80 CPU, requires 512K - RAM/ROM module - - RC Z180* RCZ180_ext.rom 115200 RC2014 w/ Z180 CPU & 512K banked - RAM/ROM module - - RC Z180* RCZ180_nat.rom 115200 RC2014 w/ Z180 CPU & 512K native - RAM/ROM module - - Easy Z80 EZZ80_std.rom 115200 Sergey Kiselev’s Easy Z80 - - SC126 SCZ180_126.rom 115200 Stephen Cousin’s SC126 Z180 - - SC130 SCZ180_130.rom 115200 Stephen Cousin’s SC130 Z180 - - SC131 SCZ180_131.rom 115200 Stephen Cousin’s SC131 Z180 - - Dyno DYNO_std.rom 38400 Steve Garcia’s Z180 Dyno Computer - ------------------------------------------------------------------------- - -*The RC2014 Z180 requires a separate RAM/ROM memory module. There are -two types of these modules and you must pick the ROM for your type of -memory module. The “ext†ROM supports Spencer’s official 512K RAM/ROM -banked memory module. The “nat†ROM supports any of the third-party Z180 -native memory modules. - -RomWBW will automatically attempt to detect and support typical add-on -components for each of the systems supported. More information on the -required system configuration and optional supported components for each -ROM is found in the file called “RomList.txt†in the Binary directory. -All pre-built ROM images are simple 512KB binary images. If your system -utilizes a larger ROM chip, you can just program the image into the -first 512KB of the ROM. - -Connect a serial terminal or computer with terminal emulation software -to the primary serial port of your CPU board. You may need to refer to -your hardware provider’s documentation for details. A null-modem -connection may be required. Set the baud rate as indicated in the table -above. Set the line characteristics to 8 data bits, 1 stop bit, no -parity, and no flow control. If possible, 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, application, or -boot from a disk device. - -Initially, you should try the ROM boot options. By selecting either CP/M -2.2 or Z-System, the selected operating system will be loaded from ROM -and you will see the a B> disk prompt. In this scenario, A: will be an -empty RAM disk and B: will refer to your ROM disk containing some common -applications. This provides a simple environment for learning to use -your system. Be aware that files saved to the RAM disk (A:) will -disappear at the next power on (RAM is generally not persistent). Also -note that attempts to save files to the ROM disk (B:) will fail because -ROM is not writable. - -General Usage - -Each of the operating systems and ROM applications included with RomWBW -are sophisticated tools in their own right. It is not reasonable to -document their usage here. However, you will find complete manuals in -PDF format in the Doc directory of the distribution. The intention of -this section is to document the RomWBW specific enhancements to these -operating systems. - -Inbuilt ROM Applications - -In addition to CP/M 2.2 and Z-System, there are several ROM applications -that can be launched directly from ROM. These applications are not -hosted by an operating system and so they are unable to save files to -disk devices. - -The following ROM applications are available at the boot loader prompt: - - Application - ------------- -------------------------------------------------------- - Monitor Z80 system debug monitor w/ Intel Hex loader - Forth Brad Rodriguez’s ANSI compatible Forth language - Basic Nascom 8K BASIC language - Tasty BASIC Dimitri Theuling’s Tiny BASIC implementation - Play A simple video game (requires ANSI terminal emulation) - -In general, the command to exit these applications and restart the -system is BYE. The exceptions are the Monitor which uses B and Play -which uses Q. - -Space is available in the ROM image for the inclusion of other software. -Any inbuilt application can be set up to launch automatically at -startup. - -Devices and Units - -In order to support a wide variety of hardware, RomWBW HBIOS uses a -modular approach to implementing device drivers and presenting devices -to the operating system. In general, all devices are classified as one -of the following: - -- Disk (Hard Disk, CF Card, SD Card, RAM/ROM Disk, etc.) -- Character (Serial Ports, Parallel Ports, etc.) -- Video (Video Display/Keyboard Interfaces) -- RTC/NVRAM (Real Time Clock, Non-volatile RAM) - -HBIOS uses the concept of unit numbers to present a complex set of -hardware devices to the operating system. As an example, a typical -system might have a ROM Disk, RAM Disk, Floppy Drives, and Disk Drives. -All of these are considered Disk devices and are presented to the -operating system as generic block devices. This means that the operating -system does not need to understand the difference between a floppy drive -and a ROM disk. - -As RomWBW boots, it assigns a unit number to each device. This unit -number is used by the operating system to refer to the device. It is, -therefore, important to know the unit number assigned to each device. -This information is displayed in the unit summary table at startup. Here -is an example: - - Unit Device Type Capacity/Mode - ---------- ---------- ---------------- -------------------- - Char 0 UART0: RS-232 38400,8,N,1 - Char 1 UART1: RS-232 38400,8,N,1 - Disk 0 MD1: RAM Disk 384KB,LBA - Disk 1 MD0: ROM Disk 384KB,LBA - Disk 2 FD0: Floppy Disk 3.5",DS/HD,CHS - Disk 3 FD1: Floppy Disk 3.5",DS/HD,CHS - Disk 4 IDE0: CompactFlash 3815MB,LBA - Disk 5 IDE1: Hard Disk -- - Disk 6 PRPSD0: SD Card 1886MB,LBA - Video 0 CVDU0: CRT Text,80x25 - -In this example, you can see that the system has a total of 7 Disk Units -numbered 0-6. There are also 2 Character Units and 1 Video Unit. The -table shows the unit numbers assigned to each of the devices. Notice how -the unit numbers are assigned sequentially regardless of the specific -device. - -There may or may not be media in the disk devices listed. For example, -the floppy disk devices (Disk Units 2 & 3) may not have a floppy in the -drive. Also note that Disk Unit 4 shows a disk capacity, but Disk Unit 5 -does not. This is because the PPIDE interface of the system supports up -to two drives, but there is only one actual drive attached. A unit -number is assigned to all possible devices regardless of whether they -have actual media installed at boot time. - -Note that Character Unit 0 is always the initial system console by -definition. - -If your system has an RTC/NVRAM device, it will not be listed in the -unit summary table. Since only a single RTC/NVRAM device can exist in -one system, unit numbers are not required nor used for this type of -device. - -Drive Letter Assignment - -In legacy CP/M-type operating systems, drive letters were generally -mapped to disk drives in a completely fixed way. For example, drive A: -would always refer to the first floppy drive. Since RomWBW supports a -wide variety of hardware configurations, it implements a much more -flexible drive letter assignment mechanism so that any drive letter can -be assigned to any disk device. - -At boot, you will notice that RomWBW automatically assigns drive letters -to the available disk devices. These assignments are displayed during -the startup of the selected operating system. Additionally, you can -review the current drive assignments at any time using the ASSIGN -command. CP/M 3 and ZPM3 do not automatically display the assignments at -startup, but you can use ASSIGN do display them. - -The drive letter assignments do not change during an OS session unless -you use the ASSIGN command yourself to do it. Additionally, the -assignments at boot will stay the same on each boot as long as you do -not make changes to your hardware configuration. Note that the -assignments are dependent on the media currently inserted in hard disk -drives. So, notice that if you insert or remove an SD Card or CF Card, -the drive assignments will change. Since drive letter assignments can -change, you must be careful when doing destructive things like using -CLRDIR to make sure the drive letter you use is referring to the desired -media. - -When performing a ROM boot of an operating system, note that A: will be -your RAM disk and B: will be your ROM disk. When performing a disk boot, -the disk you are booting from will be assigned to A: and the rest of the -drive letters will be offset to accommodate this. This is done because -most legacy operating systems expect that A: will be the boot drive. - -Slices - -The vintage operating systems included with RomWBW were produced at a -time when mass storage devices were quite small. CP/M 2.2 could only -handle filesystems up to 8MB. In order to achieve compatibility across -all of the operating systems supported by RomWBW, the hard disk -filesystem format used is 8MB. This ensures any filesystem will be -accessible to any of the operating systems. - -Since storage devices today are quite large, RomWBW implements a -mechanism called slicing to allow up to 256 8MB filesystems on a single -large storage device. This allows up to 2GB of usable space on a single -media. You can think of slices as a way to refer to any of the first 256 -8MB chunks of space on a single media. - -Of course, the problem is that CP/M-like operating systems have only 16 -drive letters (A:-P:) available. Under the covers, RomWBW allows you to -use any drive letter to refer to any slice of any media. The ASSIGN -command is allows you to view or change the drive letter mappings at any -time. At startup, the operating system will automatically allocate a -reasonable number of drive letters to the available storage devices. The -allocation will depend on the number of large storage devices available -at boot. For example, if you have only one hard disk type media, you -will see that 8 drive letters are assigned to the first 8 slices of that -media. If you have two large storage devices, you will see that each -device is allocated four drive letters. - -Referring to slices within a storage device is done by appending a : -where is the device relative slice number from 0-255. For example, if -you have an IDE device, it will show up as IDE0: in the boot messages -meaning the first IDE device. To refer to the fourth slice of IDE0, you -would type “IDE0:3â€. Here are some examples: - - -------- ------------------------------ - IDE0:0 First slice of disk in IDE0 - IDE0: First slice of disk in IDE0 - IDE0:3 Fourth slice of disk in IDE0 - -------- ------------------------------ - -So, if I wanted to use drive letter L: to refer to the fourth slice of -IDE0, I could use the command ASSIGN L:=IDE0:3. There are a couple of -rules to be aware of when assigning drive letters. First, you may only -refer to a specific device/slice with one drive letter. Said another -way, you cannot have multiple drive letters referring to a single -device/slice at the same time. Second, there must always be a drive -assigned to A:. Any attempt to violate these rules will be blocked by -the ASSIGN command. - -Unlike MS-DOS partitions, slices are not allocated – there is no -partitioning for slices. Think of every hard disk type device as having -a pre-allocated set of 256 8MB slices at the start of the media. You can -refer to any of them simply by assigning a drive letter. RomWBW will not -check to see if there is anything else on the hard disk in the slice you -are referring to, nor will it verify that the hard disk media is large -enough to have a slice at the location you refer to. If you attempt to -write past the end of your media, you will get an I/O error displayed, -so you will know if you make a mistake. There is no tracking of your use -of slices – you will need to keep track of your use of slices yourself. - -Nothing automatically initializes a slice as a file system. You must do -that yourself using CLRDIR. Since CLRDIR works on drive letters, make -absolutely sure you know what media and slice are assigned to that drive -letter before using CLRDIR. - -While it is probably obvious, you cannot use slices on any media less -than 8MB in size. Specifically, you cannot slice RAM disks, ROM disks, -floppy disks, etc. - -RomWBW Custom Applications - -The operation of the RomWBW hosted operating systems is enhanced through -several custom applications. These applications are functional on all of -the OS variants included with RomWBW. - -The following custom applications are found on the ROM disk and are, -therefore, globally available. - - ----------------------------------------------------------------------------- - Application Description - ------------- --------------------------------------------------------------- - ASSIGN Add, change, and delete drive letter assignments. Use ASSIGN /? - for usage instructions. - - SYSCOPY Copy system image to a device to make it bootable. Use SYSCOPY - with no parms for usage instructions. - - MODE Reconfigures serial ports dynamically. - - FDU Format and test floppy disks. Menu driven interface. - - FORMAT Will someday be a command line tool to format floppy disks. - Currently does nothing! - - XM XModem file transfer program adapted to hardware. Automatically - uses primary serial port on system. - - FLASH Will Sowerbutts’ in-situ ROM programming utility. - - FDISK80 John Coffman’s Z80 hard disk partitioning tool. See - documentation in Doc directory. - - TALK Direct console I/O to a specified character device. - - RTC Manage and test the Real Time Clock hardware. - - TIMER Display value of running periodic system timer. - - INTTEST Test interrupt vector hooking. - ----------------------------------------------------------------------------- - -Some custom applications do not fit on the ROM disk. They are found on -the disk image files or the individual files can be found in the -Binary\Apps directory of the distribution. - - Application Description - ------------- ------------------------------------------------------------- - TUNE Play .PT2, .PT3, .MYM audio files. - FAT Access MS-DOS FAT filesystems from RomWBW (based on FatFs). - -Additional documentation on all of these applications can be found in -“RomWBW Applications.pdf†in the Doc directory of the distribution. - -Using Disks - -ROM & RAM Disks - -RomWBW utilizes a portion of the ROM and RAM memory in your system to -implement small memory-based disks. - -The RAM disk provides a small CP/M filesystem that you can use for the -temporary storage of files. Unless your system has a battery backed -mechanism for persisting your RAM contents, the RAM disk contents will -be lost at each power-off. However, the RAM disk is an excellent choice -for storing temporary files because it is very fast. - -Like the RAM disk, the ROM disk also provides a small CP/M filesystem, -but it’s contents are static – they are part of the ROM. As such, you -cannot save files to the ROM disk. Any attempt to do this will result in -a disk I/O error. The contents of the ROM disk have been chosen to -provide a core set of tools and applications that are helpful for either -CP/M 2.2 or ZSDOS. Since ZSDOS is CP/M 2.2 compatible, this works fairly -well. However, you will find some files on the ROM disk that will work -with ZSDOS, but will not work on CP/M 2.2. For example, LDDS, which -loads the ZSDOS date/time stamper will only run on ZSDOS. - -Disk Devices - -While the RAM/ROM disks provide a functional system, they are not useful -in the long term because you cannot save data across power cycles. They -are also constrained by limited space. - -The systems supported by RomWBW all have the ability to use persistent -disk media. A wide variety of disk devices are supported including -floppy drives, hard disks, CF Cards, and SD Cards. Some systems have -disk interfaces built-in, while others will require add-in cards. You -will need to refer to the documentation for your system for your -specific options. - -In the RomWBW boot messages, you will see hardware discovery messages. -If you have a disk drive interface, you should see messages listing -device types like FD:, IDE:, PPIDE:, SD:. Additionally, you will see -messages indicating the media that has been found on the interfaces. As -an example, here are the messages you might see if you have an IDE -interface in your system with a single CF Card inserted in the primary -side of the interface: - - IDE: IO=0x80 MODE=MK4 - IDE0: 8-BIT LBA BLOCKS=0x00773800 SIZE=3815MB - IDE1: NO MEDIA - -The messages you see will vary depending on your hardware and the media -you have installed. But, they will all have the same general format as -the example above. - -Once your your system has working disk devices, you can boot an -operating system and the operating system will have access to the media. -At the boot loader prompt, select either either CP/M 2.2 or Z-System to -boot from ROM. As the operating system starts up, you should see a list -of drive letters assigned to the disk media you have installed. Here is -an example of this: - - Configuring Drives... - - A:=MD1:0 - B:=MD0:0 - C:=IDE0:0 - D:=IDE0:1 - -You will probably see more drive letters than this. The drive letter -assignment process is described above in the Drive Letter Assignment -section. Be aware that RomWBW will only assign drive letters to disk -interfaces that actually have media in them. If you do not see drive -letters assigned as expected, refer to the prior system boot messages to -ensure media has been detected in the interface. Actually, there is one -exception to this rule: floppy drives will be assigned a drive letter -regardless of whether there is any media inserted at boot. - -Notice how each drive letter refers back to a specific disk hardware -interface like IDE0. This is important as it is telling you what each -drive letter refers to. Also notice that mass storage disks (like IDE) -will normally have multiple drive letters assigned. The extra drive -letters refer to additional “slices†on the disk. The concept of slices -is described above in the Slices section. - -Once you are seeing drive letters referring to your disk media, you can -follow the instructions below to begin using the disk media with the -operating system. Your disk media must be initialized prior to being -used. There are two ways to initialize your media for use. - -One option is to initialize the media in-place using your RomWBW system. -This process is described below under Disk Initialization. In this -scenario, you will need to subsequently copy any files you want to use -onto the newly initialized disk (see Transferring Files). - -Alternatively, you can use your modern Windows, Linux, or Mac computer -to copy a disk image onto the disk media. RomWBW comes with a variety of -disk images that are ready to use and have a much more complete set of -files than you will find on the ROM disk. This process is covered below -under Disk Images. - -Disk Initialization - -To use a disk device, you will need to initialize the directory of the -filesystem. On RomWBW, the initialization is done using the CLRDIR -application. For example if your C: drive has been assigned to a storage -device, you would use CLRDIR C: to initialize C: and prepare it hold -files. Note that CLRDIR will prompt you for confirmation and you must -respond with a capital ‘Y’ to confirm. Once CLDIR has completed, you can -copy files onto the drive, for example COPY *.* C:. Be very careful to -pay attention to your drive letter assignments prior to running CLRDIR -to avoid accidentally wiping out a filesystem that has data on it. - -Running CLRDIR on a disk device is roughly equivalent to running FORMAT -on MS-DOS. Note that unlike MS-DOS you do not partition your mass -storage device. CP/M knows nothing about disk partitions. You may notice -a partitioning application on your ROM disk (FDISK80), but this is -strictly for an advanced technique of adding an MS-DOS FAT filesystem to -your media in addition to the CP/M area. Do not use FDISK80 unless you -are specifically attempting to add an MS-DOS FAT filesystem to your -media. - -If you are using a floppy drive, you will need to physically format your -floppy disk prior to use. This is only required for floppy disks, not -hard disk, CF Cards, or SD Cards, etc. To format a floppy drive, you can -use the interactive application FDU. FDU is not terribly user friendly, -but is generally documented in the file “FDU.txt†found in the Doc -directory of the distribution. It is not necessary to run CLRDIR on a -floppy disk after physically formatting it – the directory is cleared as -part of the formatting. - -Once you have initialized a disk device and copied your desired files -onto it, you may want to make the disk bootable. On CP/M filesystems, -you must perform one additional step to make a disk bootable. -Specifically, you need to place a copy of the operating system on the -system tracks of the disk. This is done using the SYSCOPY command. Let’s -say you have prepared drive C: by initializing it with CLRDIR and copied -some files onto it. You can now make C: bootable by running the -following command: - -B>SYSCOPY C:=B:ZSYS.SYS - -This command means: copy the Z-System operating system onto the system -tracks of drive C:. In this example, it is assumed that you have booted -from ROM, so B: is the ROM disk drive. Additionally, this example -assumes you want the Z-System operating system to be booted from C:. If -you want CP/M 2.2 instead, you would replace B:ZSYS.SYS with B:CPM.SYS. -Here is a full example of this process. - - B>SYSCOPY C:=B:ZSYS.SYS - - SYSCOPY v2.0 for RomWBW CP/M, 17-Feb-2020 (CP/M 2 Mode) - Copyright 2020, Wayne Warthen, GNU GPL v3 - - Transfer system image from B:ZSYS.SYS to C: (Y/N)? Y - Reading image... Writing image... Done - -Once this process succeeds, you will be able to boot directly to the -disk from the boot loader prompt. See the instructions in Booting Disks -for details on this. - -Disk Images - -As mentioned previously, RomWBW includes a variety of disk images that -contain a full set of applications for the operating systems supported. -It is generally easier to use these disk images instead of copying all -the files over using XModem. You use your modern computer (Windows, -Linux, MacOS) to place the disk image onto the disk media, then just -move the media over to your system. In this scenario you do not run -CLRDIR or SYSCOPY on the drive(s). The directory is prepared and the -disk is already bootable, if it is an operating system boot disk image. - -To copy the disk image files onto your actual media (floppy disk, CF -Card, SD Card, etc.), you need to use an image writing utility on your -modern computer. Your modern computer will need to have an appropriate -interface or slot that accepts the media. To actually copy the image, -you can use the dd command on Linux or MacOS. On Windows, in the “Tools†-directory of the distribution there are two tools you can use. For -floppy media, you can use RawWriteWin and for hard disk media, you can -use Win32DiskImager. In all cases, the image file should be written to -the media starting at the very first block or sector of the media. This -will destroy any other data on the media. - -The disk image files are found in the Binary directory of the -distribution. Floppy disk images are prefixed with “fd_†and hard disk -images are prefixed with “hd_â€. The floppy images are specifically for -1.44M floppy media only. Each disk image has the complete set of normal -applications and tools distributed with the associated operating system -or application suite. - -The following table shows the disk image files available. Note that the -images in the “Hard†column are fine for use on CF Cards, SD Cards, as -well as real spinning hard disks. - - Floppy Hard Description - -------------- -------------- ------------------------------ - fd_cpm22.img hd_cpm22.img DRI CP/M 2.2 boot disk - fd_zsdos.img hd_zsdos.img ZSDOS 1.1 boot disk - fd_nzcom.img hd_nzcom.img NZCOM boot disk - fd_cpm3 hd_cpm3.img DRI CP/M 3 boot disk - fd_zpm3 hd_zpm3.img ZPM3 boot disk - fd_ws4 hd_ws4.img WordStar v4 application disk - -In addition to the disk images above, there is also a special hard disk -image called hd_combo.img. This image contains all of the images above, -but in a single image with 6 slices. At the boot loader prompt, you can -choose a disk with the combo image, then select the specific slice you -want. This allows a single disk to have all of the possible operating -system options. - -This is the layout of the hd_combo disk image: - - Slice Description - --------- ------------------------------ - Slice 0 DRI CP/M 2.2 boot disk - Slice 1 ZSDOS 1.1 boot disk - Slice 2 NZCOM boot disk - Slice 3 DRI CP/M 3 boot disk - Slice 4 ZPM3 boot disk - Slice 5 WordStar v4 application disk - -Note that unlike the ROM firmware, you do not need to choose a disk -image specific to your hardware. Because the RomWBW firmware provides a -hardware abstraction layer, all hard disk images will work on all -hardware variations. Yes, this means you can remove an SD Card from one -system and put it in a different system. The only constraint is that the -applications on the disk media must be up to date with the firmware on -the system being used. - -All of the disk images that indicate they are bootable (boot disk) will -boot from disk as is. You do not need to run SYSCOPY on them to make -them bootable. However, if you upgrade your ROM, you should use SYSCOPY -to update the system tracks. - -Booting Disks - -When starting your system, following the hardware initialization, you -will see the Boot Loader prompt. In addition, to the ROM boot options, -you will see another line listing the Disk boot options. This line lists -the disk devices that you can choose to boot directly. - -You will notice that you do not have an option to boot a drive letter -here (like C:). This is because the operating system is not yet loaded. -When you ran SYSCOPY previously, remember that C: was assigned to IDE0:0 -which means device IDE0, slice 0. So, to boot the disk that you just -setup with SYSCOPY, you would choose option 2. You will then be prompted -for the slice on IDE0 that you want to boot. For now, just press enter -to choose slice 0. Once you are familiar with slices, you can SYSCOPY -and boot alternate slices. Here is what you would see when booting to a -disk device: - - MARK IV Boot Loader - - ROM: (M)onitor (C)P/M (Z)-System (F)orth (B)ASIC (T)-BASIC (P)LAY (U)SER ROM - Disk: (0)MD1 (1)MD0 (2)IDE0 (3)IDE1 - - Boot Selection? 2 Slice(0-9)[0]? - - Booting Disk Unit 2, Slice 0... - - Reading disk information... - Loc=D000 End=FE00 Ent=E600 Label=Unlabeled Drive - - Loading... - -Following this, you would see the normal operating system startup -messages. However, your operating system prompt will be A> and when you -look at the drive letter assignments, you should see that A: has been -assigned to the disk you selected to boot. - -If you receive the error message “Disk not bootable!â€, you have either -failed to properly run SYSCOPY on the target disk or you have selected -the wrong disk/slice. - -Note that although MD1 (RAM disk) and MD0 (ROM disk) drives are listed -in the Disk boot line, they are not “bootable†disks because they have -no system tracks on them. Attempting to boot to one of them, will fail -with a “Disk not bootable!†error message and return to the loader -prompt. - -Operating Systems - -One of the primary goals of RomWBW is to expose a set of generic -hardware functions that make it easy to adapt operating systems to any -hardware supported by RomWBW. As a result, there are now 5 operating -systems that have been adapted to run under RomWBW. The adaptations are -identical for all hardware supported by RomWBW because RomWBW hides all -hardware specifics from the operating system. - -Note that all of the operating systems included with RomWBW support the -same basic filesystem format. As a result, a formatted filesystem will -be accessible to any operating system. The only possible issue is that -if you turn on date/time stamping using the newer OSes, the older OSes -will not understand this. Files will not be corrupted, but the date/time -stamps may be lost. - -The following sections briefly describe the operating system options -currently available. - -Digital Research CP/M 2.2 +By design, RomWBW isolates all of the hardware specific functions in the +ROM chip itself. The ROM provides a hardware abstraction layer such that +all of the operating systems and applications on a disk will run on any +RomWBW-based system. To put it simply, you can take a disk (or CF/SD +Card) and move it between systems transparently. -This is the most widely used variant of the Digital Research operating -system. It has the most basic feature set, but is essentially the -compatibility metric for all other CP/M-like operating systems including -all of those listed below. The Doc directory contains a manual for CP/M -usage (“CPM Manual.pdfâ€). If you are new to the CP/M world, I would -recommend using this CP/M variant to start with simply because it is the -most stable and you are less likely to encounter problems. +A tool is provided that allows you to access a FAT-12/16/32 filesystem. +The FAT filesystem may be coresident on the same disk media as RomWBW +slices or on stand-alone media. This makes exchanging files with modern +OSes such as Windows, MacOS, and Linux very easy. -Notes -- The original versions of DDT, DDTZ, and ZSID used the RST 38 vector - which conflicts with interrupt mode 1 use of this vector. The DDT, - DDTZ, and ZSID applications in RomWBW have been modified to use RTS - 30 to avoid this issue. -- Z-System applications will not run under CP/M 2.2. For example, the - LDDS date stamper with not run. +ACQUIRING ROMWBW -ZSDOS 1.1 -ZSDOS is the most popular non-DRI CP/M “clone†which is generally -referred to as Z-System. Z-System is intended to be an enhanced version -of CP/M and should run all CP/M 2.2 applications. It is optimized for -the Z80 CPU (as opposed to 8080 for CP/M) and has some significant -improvements such as date/time stamping of files. For further -information on the RomWBW implementation of Z-System, see the wiki page -Z-System Notes. Additionally, the official documentation for Z-System is -included in the RomWBW distribution Doc directory (“ZSDOS Manual.pdf†-and “ZCPR Manual.pdfâ€). +The RomWBW Repository on GitHub is the official distribution location +for all project source and documentation. The fully-built distribution +releases are available on the RomWBW Releases Page of the repository. On +this page, you will normally see a Development Snapshot as well as +recent stable releases. Unless you have a specific reason, I suggest you +stick to the most recent stable release. Expand the “Assets†drop-down +for the release you want to download, then select the asset named +RomWBW-vX.X.X-Package.zip. The Package asset includes all pre-built ROM +and Disk images as well as full source code. The other assets contain +only source code and do not have the pre-built ROM or disk images. -Notes +All source code and distributions are maintained on GitHub. Code +contributions are very welcome. -- Although most CP/M 2.2 applications will run under Z-System, some - may not work as expected. The best example is PIP which is not aware - of the ZSDOS paths and will fail in some scenarios (use COPY - instead). -NZCOM Automatic Z-System -NZCOM is a much further refined version of Z-System (ZCPR 3.4). NZCOM -was sold as an enhancement for existing users of CP/M 2.2 or ZSDOS. For -this reason, (by design) NZCOM does not provide a way to boot directly -from disk. Rather, it is loaded after the system boots into a host OS. -On the RomWBW NZCOM disk images, the boot OS is ZSDOS 1.1. After you -configure NZCOM, you can add a PROFILE.SUB file to automatically launch -NZCOM at boot. +INSTALLATION & OPERATION -NZCOM is not pre-configured. You must run through a simple configuration -process before loading it. Run MKZCM to do this. -NZCOM has substantially more functionality than CP/M or basic Z-System. -It is important to read the the “NZCOM Users Manual.pdf†file in the -RomWBW Doc directory. +In general, installation of RomWBW on your platform is very simple. You +just need to program your ROM with the correct ROM image from the RomWBW +distribution. Subsequently, you can write disk images on your disk +drives (IDE disk, CF Card, SD Card, etc.) which then provides even more +functionality. -Notes +Complete instructions for installation and operation of RomWBW are found +in the RomWBW User Guide. -- There is no DIR command, you must use SDZ instead. If you don’t like - this, look into the ALIAS facility. -Digital Research CP/M 3 +Documentation -This is the Digital Research follow-up product to their very popular -CP/M 2.2 operating system. While highly compatible with CP/M 2.2, it -features many enhancements. It makes direct use of banked memory to -increase the user program space (TPA). It also has a new suite of -support tools and help system. +Documentation for RomWBW includes: -Note that to make a CP/M 3 boot disk, you actually place CPMLDR.SYS on -the system tracks of the disk. You do not place CPM3.SYS on the system -tracks. CPMLDR.SYS chain loads CPM3.SYS. +- RomWBW User Guide +- RomWBW System Guide +- RomWBW Applications +- RomWBW ROM Applications +- RomWBW Errata -Notes -- The DATE command cannot yet be used to set the RTC. The RTC is used - to read the current date/time for file stamping, etc. You can use - the RTC app to set the RTC clock. -Simeon Cran’s ZPM3 +ACKNOWLEDGMENTS -ZPM3 is an interesting combination of the features of both CP/M 3 and -ZCPR 3. Essentially, it has the features of and compatibility with both. -Like CP/M 3, to make ZPM3 boot disk, you put CPMLDR.SYS on the system -tracks of the disk. +I want to acknowledge that a great deal of the code and inspiration for +RomWBW has been provided by or derived from the work of others in the +RetroBrew Computers Community. I sincerely appreciate all of their +contributions. The list below is probably missing many names – please +let me know if I missed you! -Notes +- Andrew Lynch started it all when he created the N8VEM Z80 SBC which + became the first platform RomWBW supported. Some of his original + code can still be found in RomWBW. -- ZPMLDR is included with ZPM3, but it is not working correctly. +- Dan Werner wrote much of the code from which RomWBW was originally + derived and he has always been a great source of knowledge and + advice. -- The ZPM operating system is contained in the file called CPM3.SYS - which is confusing, but it is the author’s intended way of using - ZPM3. +- Douglas Goodall contributed code, time, testing, and advice in “the + early daysâ€. He created an entire suite of application programs to + enhance the use of RomWBW. Unfortunately, they have become unusable + due to internal changes within RomWBW. As of RomWBW 2.6, these + applications are no longer provided. -FreeRTOS +- Sergey Kiselev created several hardware platforms for RomWBW + including the very popular Zeta. -Phillip Stevens has ported FreeRTOS to run under RomWBW. FreeRTOS is not -provided in the RomWBW distribution. FreeRTOS is available under the MIT -licence and further general information is available at FreeRTOS. +- David Giles created support for the Z180 CSIO which is now included + SD Card driver. -You can also contact Phillip for detailed information on the Z180 -implementation of FreeRTOS for RomWBW. feilipu +- Phil Summers contributed the Forth and BASIC adaptations in ROM, the + AY-3-8910 sound driver, DMA support, and a long list of general code + and documentation enhancements. -Transferring Files +- Ed Brindley contributed some of the code that supports the RCBus + platform. -Transferring files between your modern computer and your RomWBW system -can be achieved in a variety of ways. The most common of these are -described below. All of these have a certain degree of complexity and I -encourage new users to use the available community forums to seek -assistance as needed. +- Spencer Owen created the RC2014 series of hobbyist kit computers + which has exponentially increased RomWBW usage. Some of his kits + include RomWBW. -Serial Port Transfers +- Stephen Cousins has likewise created a series of hobbyist kit + computers at Small Computer Central and is distributing RomWBW with + many of them. -RomWBW provides an serial file transfer program called XModem that has -been adapted to run under RomWBW hardware. The program is called XM and -is on your ROM disk as well as all of the pre-built disk images. +- Alan Cox has contributed some driver code and has provided a great + deal of advice. -You can type XM by itself to get usage information. In general, you will -run XM with parameters to indicate you want to send or receive a file on -your RomWBW system. Then, you will use your modern computers terminal -program to complete the process. +- The CP/NET client files were developed by Douglas Miller. -The XM application generally tries to detect the hardware you are using -and adapt to it. However, you must ensure that you have a reliable -serial connection. You must also ensure that the speed of the connection -is not too fast for XModem to service. Alternatively, you can ensure -that hardware flow control is working properly. +- Phillip Stevens contributed support for FreeRTOS. -There is an odd interaction between XModem and partner terminal programs -that can occur. Essentially, after launching XM, you must start the -protocol on your modern computer fairly quickly (usually in about 20 -seconds or so). So, if you do not pick a file on your modern computer -quickly enough, you will find that the transfer completes about 16K, -then hangs. The interaction that causes this is beyond the scope of this -document. +- Curt Mayer contributed the original Linux / MacOS build process. -Disk Image Transfers +- UNA BIOS and FDISK80 are the products of John Coffman. -It is possible to pass disk images between your RomWBW system and your -modern computer. This assumes you have an appropriate media slot on your -modern computer for the media you want to use (CF Card, SD Card, or -floppy drive). +- FLASH4 is a product of Will Sowerbutts. -The general process to get files from your modern computer to a RomWBW -computer is: +- CLRDIR is a product of Max Scane. -1. Use cpmtools on your modern computer to create a RomWBW CP/M - filesystem image. +- Tasty Basic is a product of Dimitri Theulings. -2. Insert your RomWBW media (CF Card, SD Card, or floppy disk) in your - modern computer. +- Dean Netherton contributed the sound driver interface and the + SN76489 sound driver. -3. Use a disk imaging tool to copy the RomWBW filesystem image onto the - media. +- The RomWBW Disk Catalog document was produced by Mykl Orders. -4. Move the media back to the RomWBW computer. +Contributions of all kinds to RomWBW are very welcome. -This process is a little complicated, but it has the benefit of allowing -you to get a lot of files over to your RomWBW system quickly and with -little chance of corruption. -The process can be run in reverse to get files from your RomWBW computer -to a modern computer. -The exact use of these tools is a bit too much for this document, but -the tools are all included in the RomWBW distribution along with usage -documents. +LICENSING -Note that the build scripts for RomWBW create the default disk images -supplied with RomWBW. It is relatively easy to customize the contents of -the disk images that are part of RomWBW. This is described in more -detail in the Source\Images directory of the distribution. - -FAT Filesystem Transfers - -RomWBW provides a mechanism that allows it to read and write files on a -FAT formatted disk. This means that you can generally use your modern -computer to make an SD Card or CF Card with a standard FAT32 filesystem -on it, then place that media in your RomWBW computer and access the -files. - -When formatting the media on your modern computer, be sure to pick the -FAT filesystem. NTFS and other filesystems will not work. - -On your RomWBW computer you can use the FAT application to access the -FAT media. The FAT application allows you to read files, write files, -list a directory, and erase files on the FAT media. It can handle -subdirectories as well. It will only see 8.3 character filenames -however. Longer filenames will show up as a truncated version. - -The FAT application is not on your ROM disk because it is too large to -fit. You will find it on all of the pre-built disk images as well as in -the Binary\Apps directory of the distribution. - -For advanced users, it is possible to create a hybrid disk that contains -CP/M slices at the beginning and a FAT filesystem after. Such a hybrid -disk can be used to boot an operating system and still have access to -FAT files on the FAT portion of the disk. David Reese has prepared a -document describing how to do this. It is called -“SC126_How-To_No_2_Preparing_an_SD_Card_for_Use_with_SC126_Rev_1-5.pdf†-and can be found in the Doc\Contrib directory of the distribution. - -Startup Command Processing - -Each of the operating systems supported by RomWBW provide a mechanism to -run commands at boot. This is similar to the AUTOEXEC.BAT files from -MS-DOS. - -With the exception of ZPM3, all operating systems will look for a file -called PROFILE.SUB on the system drive at boot. If it is found, it will -be processed as a standard CP/M submit file. You can read about the use -of the SUBMIT facility in the CP/M manuals included in the RomWBW -distribution. Note that the boot disk must also have a copy of -SUBMIT.EXE. - -In the case of ZPM3, the file called STARTZPM.COM will be run at boot. -To customize this file, you use the ZCPR ALIAS facility. You will need -to refer to ZCPR documentation for more information on the ALIAS -facility. - -Note that the automatic startup processing generally requires booting to -a disk drive. Since the ROM disk is not writable, there is no simple way -to add/edit a PROFILE.SUB file there. If you want to customize your ROM -and add a PROFILE.SUB file to the ROM Disk, it will work, but is a lot -harder than using a boot disk. - -ROM Customization - -The pre-built ROM images are configured for the basic capabilities of -each platform. Additionally, some of the typical add-on hardware for -each platform will be automatically detected and used. If you want to go -beyond this, RomWBW provides a very flexible configuration mechanism -based on configuration files. Creating a customized ROM requires running -a build script, but it is quite easy to do. - -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 and disk images. There are build scripts for -Windows, Linux, and MacOS to accommodate virtually all users. All -required build tools (compilers, assemblers, etc.) are included in the -distribution, so it is not necessary to setup a build environment on -your computer. - -The process for building a custom ROM is documented in the ReadMe.txt -file in the Source directory of the distribution. - -For those who are interested in more than basic system customization, -note that all source code is provided (including the operating systems). -Modification of the source code is considered an expert level task and -is left to the reader to pursue. - -Note that the ROM customization process does not apply to UNA. All UNA -customization is performed within the ROM setup script. - -UNA Hardware BIOS - -John Coffman has produced a new generation of hardware BIOS called UNA. -The standard RomWBW distribution includes it’s own hardware BIOS. -However, RomWBW can alternatively be constructed with UNA as the -hardware BIOS portion of the ROM. If you wish to use 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. - -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 -the 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 -- Terminal Emulation -- Zeta 1, N8, RC2014, Easy Z80, and Dyno Systems -- Some older support boards - -The UNA version embedded in RomWBW is the latest production release of -UNA. RomWBW will be updated with John’s upcoming UNA release with -support for VGA3 as soon as it reaches production status. - -Please refer to the UNA BIOS Firmware Page for more information on UNA. - -Upgrading - -Upgrading to a newer release of RomWBW is essentially just a matter of -updating the ROM chip in your system. If you have spare ROM chips for -your system and a ROM programmer, it is always safest to retain your -existing, working ROM chip and program a new one with the new firmware. -If the new one fails to boot, you can easily return to the known working -ROM. - -Prior to attempting to reprogram your actual ROM chip, you may wish to -“try†the upgrade. With RomWBW, you can upload a new system image -executable and load it from the command line. For each ROM image file -(.rom) in the Binary directory, you will also find a corresponding -application file (.com). For example, for SBC_std.rom, there is also an -SBC_std.com file. You can upload the .com file to your system using -XModem, then simply run the .com file. You will see your system go -through the normal startup process just like it was started from ROM. -However, your ROM has not been updated and the next time you boot your -system, it will revert to the system image contained in ROM. - -There are two restrictions to be aware of related to loading a system -image as a .com application. First, this is only supported under -Z-System and CP/M 2.2. You must boot into one of these OSes before -attempting to launch the .com file. Second, you may find that you are -unable to load the .com file because it is too large to fit in available -application RAM (TPA). Your only recourse in this situation is to build -a custom ROM with fewer features. - -If you do not have easy access to a ROM programmer, it is usually -possible to reprogram your system ROM using the FLASH utility from Will -Sowerbutts. This application, called FLASH.COM, can be found on the ROM -drive of any running system. In this case, you would need to transfer -the new ROM image (.rom) over to your system using XModem (or one of the -other mechanisms described in the Transferring Files section). The ROM -image is too large to fit on your RAM drive, so you will need to -transfer it to a larger storage drive. Once the ROM image is on your -system, you can use the FLASH application to update your ROM. The -following is a typical example of transferring ROM image using XModem -and flashing the chip in-situ. - - E>xm r rom.img - - XMODEM v12.5 - 07/13/86 - RBC, 28-Aug-2019 [WBW], ASCI - - Receiving: E0:ROM.IMG - 7312k available for uploads - File open - ready to receive - To cancel: Ctrl-X, pause, Ctrl-X - - Thanks for the upload - - E>flash write rom.img - FLASH4 by Will Sowerbutts version 1.2.3 - - Using RomWBW (v2.6+) bank switching. - Flash memory chip ID is 0xBFB7: 39F040 - Flash memory has 128 sectors of 4096 bytes, total 512KB - Write complete: Reprogrammed 2/128 sectors. - Verify (128 sectors) complete: OK! - -Obviously, there is some risk to this approach since any issues with the -programming or ROM image could result in a non-functional system. - -To confirm your ROM chip has been successfully updated, restart your -system and boot an operating system from ROM. Do not boot from a disk -device yet. Review the boot messages to see if any issues have occurred. - -Once you are satisfied that the ROM is working well, you will need to -update the system images and RomWBW custom applications on your disk -drives. The system images and custom applications are matched to the -RomWBW ROM firmware in use. If you attempt to boot a disk or run -applications that have not been updated to match the current ROM -firmware, you are likely to have odd problems. - -The simplest way to update your disk media is to just use your modern -computer to overwrite the entire media with the latest disk image of -your choice. This process is described below in the Disk Images section. -If you wish to update existing disk media in your system, you need to -perform the following steps. - -If the disk is bootable, you need to update the system tracks of the -disk. This is done using a SYSCOPY command such as -SYSCOPY C:=B:ZSYS.SYS. For a ZSDOS boot disk, use ZSYS.SYS. For a CP/M -2.2 disk, use CPM.SYS. For a CP/M 3 or ZPM3 disk, use CPMLDR.SYS. -CPMLDR.SYS is not provided on the ROM disk, so you will need to upload -it from the distribution. - -Finally, if you have copies of any of the RomWBW custom applications on -your hard disk, you need to update them with the latest copies. The -following applications are found on your ROM disk. Use COPY to copy them -over any older versions of the app on your disk: - -- ASSIGN.COM -- SYSCOPY.COM -- MODE.COM -- FDU.COM (was FDTST.COM) -- FORMAT.COM -- XM.COM -- FLASH.COM -- FDISK80.COM -- TALK.COM -- RTC.COM -- TIMER.COM -- INTTEST.COM - -For example: B>COPY ASSIGN.COM C: - -Some RomWBW custom applications are too large to fit on the ROM disk. If -you are using any of these you will need to transfer them to your system -and then update all copies. These applications are found in the -Binary\Apps directory of the distribution and in all of the disk images. - -- FAT.COM -- TUNE.COM - -RomWBW Distribution -All source code and distributions are maintained on GitHub. Code -contributions are very welcome. +RomWBW 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. -RomWBW GitHub Repository +RomWBW 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. -Distribution Directory Layout +You should have received a copy of the GNU General Public License along +with RomWBW. If not, see https://www.gnu.org/licenses/. -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: +Portions of RomWBW were created by, contributed by, or derived from the +work of others. It is believed that these works are being used in +accordance with the intentions and/or licensing of their creators. - -------------------------------------------------------------------------- - Application Description - ------------- ------------------------------------------------------------ - 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â€. +If anyone feels their work is being used outside of its intended +licensing, please notify: - Doc Contains various detailed documentation including the - operating systems, RomWBW architecture, etc. + Wayne Warthen + wwarthen@gmail.com - Source Contains the source code files used to build the software - and ROM images. +RomWBW is an aggregate work. It is composed of many individual, +standalone programs that are distributed as a whole to function as a +cohesive system. Each program may have its own licensing which may be +different from other programs within the aggregate. - Tools Contains the MS Windows programs that are used by the build - process or that may be useful in setting up your system. - -------------------------------------------------------------------------- +In some cases, a single program (e.g., CP/M Operating System) is +composed of multiple components with different licenses. It is believed +that in all such cases the licenses are compatible with GPL version 3. -Acknowledgments +RomWBW encourages code contributions from others. Contributors may +assert their own copyright in their contributions by annotating the +contributed source code appropriately. Contributors are further +encouraged to submit their contributions via the RomWBW source code +control system to ensure their contributions are clearly documented. -While I have heavily modified much of the code, I want to acknowledge -that much of the work is derived from the work of others in the -RetroBrew Computers Community 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!). +All contributions to RomWBW are subject to this license. -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 contributed support for the CSIO support in the SD Card - driver. -- Ed Brindley contributed some of the code that supports the RC2014 - platform. -- Phil Summers contributed Forth and BASIC in ROM as well as a long - list of general code enhancements. -- Phillip Stevens contributed support for FreeRTOS. -- Curt Mayer contributed the Linux / MacOS build process. -- UNA BIOS and FDISK80 is a product of John Coffman. -- FLASH4 is a product of Will Sowerbutts. -Contributions of all kinds to RomWBW are very welcome. +GETTING ASSISTANCE -Getting Assistance The best way to get assistance with RomWBW or any aspect of the -RetroBrew Computers projects is via the community forums: +RetroBrew Computers projects is via one of the community forums: - RetroBrew Computers Forum - RC2014 Google Group diff --git a/Readme.unix b/Readme.unix deleted file mode 100644 index 710487c6..00000000 --- a/Readme.unix +++ /dev/null @@ -1,49 +0,0 @@ -this tree now contains makefiles and tools to build on Linux and MacosX -Linux is rather more thoroughly tested compared to os-x. - -to get here, TASM and the propeller generation tools needed to be replaced, -and since the unix filesystem is usually case-sensitive, and CP/M and windows -are not, the cpm tools were made case-insensitive. - -TASM was replaced with uz80as, which implements a subset of TASM and fixes some -bugs. however, I needed to add some functionality to make it build the sources -as they exist in this tree. in particular, one thing to be very careful of is -that TASM is not entirely consistent with respect to the .DS directive. -it's usually a bad idea to mix .DS, .FILL, .DB with .ORG. - .DS n is best thought of as .ORG $ + n - .ORG changes the memory pointer, but does not change the file output point. - it works a lot more like M80, SLR* .phase - -it assumes that you have some standard system tools and libraries installed -specifically: gcc, gnu make, libncurses - -to build: - cd to the top directory and type make. - -heavy use is made of make's include facility and pattern rules. -the master rule set is in Tools/Makefile.inc. changes here will affect -almost every Makefile, and where exceptions are needed, the overrides are -applied in the lower Makefiles. - -these tools can run a windows-linux regression test, where all the binaries are -compared to a baseline windows build. - -Credit: - - uz80as was written by Jorge Giner Cordero, jorge.giner@hotmail.com, - and the original source can be found at https://github.com/jorgicor/uz80as - - the propeller tools use bstc and openspin, parallax tools from - http://www.fnarfbargle.com/bst.html https://github.com/parallaxinc/OpenSpin - note that bst is not open source or even currently maintained, so I could - not generate a version for 64 bit osx. - - cpmtools were the most current I could find, and it has been hacked to do - case-insensitivity. these are not marked, and are not extensive. - - zx is from distributed version, and also has local hacks for case insensitivity. - both zx and cpmtools ship with an overly complicated makefile generation system - and this is ignored. - - this whole linux build framework is the work of Curt Mayer, curt@zen-room.org. - use it for whatever you like; this is not my day job. diff --git a/Source/Apps/Assign.asm b/Source/Apps/Assign.asm deleted file mode 100644 index 86498fb8..00000000 --- a/Source/Apps/Assign.asm +++ /dev/null @@ -1,1899 +0,0 @@ -;=============================================================================== -; ASSIGN - Display and/or modify drive letter assignments -; -;=============================================================================== -; -; Author: Wayne Warthen (wwarthen@gmail.com) -;_______________________________________________________________________________ -; -; Usage: -; ASSIGN D:[=[{D:|[]:[]}]][,...] -; ex: ASSIGN (display all active drive assignments) -; ASSIGN /? (display version and usage) -; ASSIGN /L (display all possible devices) -; ASSIGN C:=D: (swaps C: and D:) -; ASSIGN C:=FD0: (assign C: to floppy unit 0) -; ASSIGN C:=IDE0:1 (assign C: to IDE unit0, slice 1) -; ASSIGN C:= (unassign C:) -;_______________________________________________________________________________ -; -; Change Log: -; 2016-03-21 [WBW] Updated for HBIOS 2.8 -; 2016-04-08 [WBW] Determine key memory addresses dynamically -; 2019-08-07 [WBW] Fixed DPB selection error -; 2019-11-17 [WBW] Added preliminary CP/M 3 support -; 2019-12-24 [WBW] Fixed location of BIOS save area -;_______________________________________________________________________________ -; -; ToDo: -; 1) Do something to prevent assigning slices when device does not support them -; 2) ASSIGN C: causes drive map to be reinstalled unnecessarily -;_______________________________________________________________________________ -; -;=============================================================================== -; Definitions -;=============================================================================== -; -stksiz .equ $40 ; Working stack size -; -restart .equ $0000 ; CP/M restart vector -bdos .equ $0005 ; BDOS invocation vector -; -stamp .equ $40 ; loc of RomWBW CBIOS zero page stamp -; -rmj .equ 3 ; CBIOS version - major -rmn .equ 0 ; CBIOS version - minor -; -;=============================================================================== -; Code Section -;=============================================================================== -; - .org $100 -; - ; relocate to high memory - ld hl,image - ld de,$8000 - ld bc,modsize - ldir - jp start -; -image .equ $ -; - .org $8000 -; -start: -; - ; setup stack (save old value) - ld (stksav),sp ; save stack - ld sp,stack ; set new stack -; - ; initialization - call init ; initialize - jr nz,exit ; abort if init fails -; - ; do the real work - call process ; parse and process command line - jr nz,exit ; done if error or no action -; - ; perform table integrity check - call valid - jr nz,exit -; - ; install the new drive map if changes were made - ld a,(modcnt) ; get the mod count - or a ; set flags - call nz,install ; install new drive map -; -exit: ; clean up and return to command processor - call crlf ; formatting - ld sp,(stksav) ; restore stack - jp restart ; return to CP/M via restart - ret ; return to CP/M w/o restart -; -; Initialization -; -init: -; - ; locate start of cbios (function jump table) - ld hl,(restart+1) ; load address of CP/M restart vector - ld de,-3 ; adjustment for start of table - add hl,de ; HL now has start of table - ld (bioloc),hl ; save it -; - ; get CP/M version and save it - ld c,$0C ; function number - call bdos ; do it, HL := version - ld (cpmver),hl ; save it - ld a,l ; low byte - cp $30 ; CP/M 3.0? -; - ; get location of config data and verify integrity - ld hl,stamp ; HL := adr or RomWBW zero page stamp - ld a,(hl) ; get first byte of RomWBW marker - cp 'W' ; match? - jp nz,errinv ; abort with invalid config block - inc hl ; next byte (marker byte 2) - ld a,(hl) ; load it - cp ~'W' ; match? - jp nz,errinv ; abort with invalid config block - inc hl ; next byte (major/minor version) - ld a,(hl) ; load it - cp rmj << 4 | rmn ; match? - jp nz,errver ; abort with invalid os version - inc hl ; bump past - inc hl ; ... version info -; - ; dereference HL to point to CBIOS extension data - ld a,(hl) ; dereference HL - inc hl ; ... to point to - ld h,(hl) ; ... ROMWBW config data block - ld l,a ; ... in CBIOS -; - ; skip device map address - inc hl ; bump two bytes - inc hl ; ... past device map address entry -; - ; get location of drive map - ld e,(hl) ; dereference HL - inc hl ; ... into DE to get - ld d,(hl) ; ... drive map pointer - inc hl ; skip past drive map pointer - ld (maploc),de ; and save it -; - ; get location of dpbmap - ld e,(hl) ; dereference HL - inc hl ; ... into DE to get - ld d,(hl) ; ... DPB map pointer - ld (dpbloc),de ; and save it -; - ; test for CP/M 3 and branch if so - ld a,(cpmver) ; low byte of cpm version - cp $30 ; CP/M 3.0? - jp nc,initcpm3 ; handle CP/M 3.0 or greater -; - ; make a local working copy of the drive map - ld hl,(maploc) ; copy from CBIOS drive map - ld de,mapwrk ; copy to working drive map - dec hl ; point to entry count - ld a,(hl) ; get entry count - inc hl ; restore hl pointer to drive map start - add a,a ; multiple a by - add a,a ; ... size of entries (4 bytes each) - ld c,a ; set BC := 0A - ld b,0 ; ... so BC is length to copy - ldir ; do the copy -; - ; determine end of CBIOS (assume HBIOS for now) - ld hl,($FFFE) ; get proxy start address - ld (bioend),hl ; save as CBIOS end address -; - ; check for UNA (UBIOS) - ld a,($FFFD) ; fixed location of UNA API vector - cp $C3 ; jp instruction? - jr nz,initx ; if not, not UNA - ld hl,($FFFE) ; get jp address - ld a,(hl) ; get byte at target address - cp $FD ; first byte of UNA push ix instruction - jr nz,initx ; if not, not UNA - inc hl ; point to next byte - ld a,(hl) ; get next byte - cp $E5 ; second byte of UNA push ix instruction - jr nz,initx ; if not, not UNA - ld hl,unamod ; point to UNA mode flag - ld (hl),$FF ; set UNA mode flag - ld c,$F1 ; UNA func: Get HMA - rst 08 ; call UNA, HL := UNA proxy start address - ld (bioend),hl ; save as CBIOS end address -; -initx: - ; compute size of CBIOS - ld hl,(bioend) ; HL := end address - ld de,(bioloc) ; DE := starting address - xor a ; clear carry - sbc hl,de ; subtract to get size in HL - ld (biosiz),hl ; and save it -; - ; establish heap limit - ld hl,(bioend) ; HL := end of CBIOS address - ld de,-$40 ; allow 40 bytes for CBIOS stack - add hl,de ; adjust - ld (heaplim),hl ; save it -; -#if 0 - ld a,' ' - call crlf - ld bc,(bioloc) - call prthexword - call prtchr - ld bc,(bioend) - call prthexword - call prtchr - ld bc,(maploc) - call prthexword - call prtchr - ld bc,(heaplim) - call prthexword - -#endif -; - ; return success - xor a ; signal success - ret ; return -; -; CP/M 3 initialization -; -initcpm3: - ld hl,(bioloc) - ld de,22*3 ; offset of DRVTBL func - add hl,de ; HL := DRVTBL func - call jphl ; do it, HL := DRVTBL adr - ld (drvtbl),hl ; save it -; - ; switch to sysbnk - ld hl,(bioloc) - ld de,27*3 ; offset of SELMEM func - add hl,de ; HL := SELMEM func - ld a,0 ; bank 0 is system bank - call jphl -; - ; copy CP/M 3 drvtbl to drvmap working copy - ld hl,(drvtbl) ; get drive table in HL - ld de,mapwrk ; DE := working drive map - ld b,16 -initc2: - push hl ; save drvtbl entry adr - ld a,(hl) ; deref HL to get DPH adr - inc hl ; ... - ld h,(hl) ; ... - ld l,a ; ... - ld a,l ; check for - or h ; ... zero - jr nz,initc3 ; if not zero, copy entry - inc de ; ... else bump past unit field - jr initc4 ; ... and continue without copying -initc3: - dec hl ; back up to - dec hl ; ... unit - ld a,(hl) ; get unit from drvtbl - ld (de),a ; save unit to drvmap - inc hl ; bump to slice - inc de ; bump to slice - ld a,(hl) ; get slice from drvtbl - ld (de),a ; save slice to drvmap -initc4: - inc de ; bump past slice - inc de ; skip - inc de ; ... dph - pop hl ; back to drvtbl entry - inc hl ; bump to - inc hl ; ... next drvtbl entry - djnz initc2 -; - ; switch back to tpabnk - ld hl,(bioloc) - ld de,27*3 ; offset of SELMEM func - add hl,de ; HL := SELMEM func - ld a,1 ; bank 1 is tpa bank - call jphl -; - ; return success - xor a ; signal success - ret ; return -; -; Process command line -; -process: -; - ; look for start of parms - ld hl,$81 ; point to start of parm area (past len byte) - call nonblank ; skip to next non-blank char - jp z,showall ; no parms, show all active assignments -; - ; check for special option, introduced by a "/" - cp '/' ; start of usage request? - jp z,option ; yes, handle option -; -process0: -; - sub 'A' ; make it binary - ld (dstdrv),a ; save it as destination drive - inc hl ; next char - ld a,(hl) ; get it - cp ':' ; is it ':' as expected? - jp nz,errprm ; error if not - inc hl ; skip ':' - call nonblank ; skip possible blanks - cp '=' ; proper delimiter? - jr z,process1 ; yes, continue - - ld de,drvshow ; show the drive - ld a,(dstdrv) ; load the drive - jr process4 ; do it -; -process1: ; handle other side of '=' -; - inc hl ; skip '=' - call nonblank ; skip blanks as needed - ld de,drvdel ; assume a drive delete - jp z,process4 ; continue to processing - cp ',' ; comma? - jp z,process4 ; continue to processing - call getalpha ; gobble all alpha characters - dec b ; decrement num chars parsed - jr nz,process2 ; more than 1 char, handle as device name -; - ; handle as drive swap - cp ':' ; check for mandatory trailing colon - jp nz,errprm ; handle unexpected character - inc hl ; skip ':' - ld a,(tmpstr) ; get the drive letter - sub 'A' ; make it binary - ld (srcdrv),a ; assume it is a src drv and save it - ld de,drvswap ; put routine to call in DE - jr process4 ; and continue -; -process2: ; handle a device/slice assignment -; - call getnum ; get number from buffer - jp c,errnum ; abort on overflow - cp 16 ; compare to max - jp nc,errnum ; abort if too high - ld (unit),a ; save it as unit num - ld a,(hl) ; get terminating char - cp ':' ; check for mandatory colon - jp nz,errprm ; handle unexpected character - inc hl ; skip past colon - call getnum ; get number from buffer - jp c,errnum ; abort on overflow - ld (slice),a ; save it as slice num - ld de,drvmap ; put routine to call in DE - jr process4 ; and continue -; -process4: ; check for terminating null or comma -; - call nonblank ; skip possible blanks - jr z,process5 ; null terminator OK - cp ',' ; check for comma - jr z,process5 ; also OK - jp errprm ; otherwise parm error -; -process5: ; do the processing -; - ex de,hl ; move routine to call to HL - push de ; save command string pointer - call jphl ; do the work - pop hl ; recover command string pointer - ret nz ; abort on error - ld a,(hl) ; get the current cmd string char - or a ; set flags - ret z ; if null, we are done - inc hl ; otherwise, skip comma - call nonblank ; and possible blanks after comma - ret z ; get out if nothing more - jp process0 ; we have more work, loop -; -; Handle special options -; -option: -; - inc hl ; next char - ld a,(hl) ; get it - cp '?' ; is it a '?' as expected? - jp z,usage ; yes, display usage - cp 'L' ; is it a 'L', display device list? - jp z,devlist ; yes, display device list - jp errprm ; anything else is an error -; -usage: -; - call crlf ; formatting - ld de,msgban1 ; point to version message part 1 - call prtstr ; print it - ld a,(unamod) ; get UNA flag - or a ; set flags - ld de,msghb ; point to HBIOS mode message - call z,prtstr ; if not UNA, say so - ld de,msgub ; point to UBIOS mode message - call nz,prtstr ; if UNA, say so - call crlf ; formatting - ld de,msgban2 ; point to version message part 2 - call prtstr ; print it - call crlf2 ; blank line - ld de,msguse ; point to usage message - call prtstr ; print it - or $FF ; signal no action performed - ret ; and return -; -devlist: -; - ld a,(unamod) ; get UNA mode flag - or a ; set flags - jr nz,devlstu ; do UNA mode dev list -; - ld b,$F8 ; hbios func: sysget - ld c,$10 ; sysget subfunc: diocnt - rst 08 ; call hbios, E := device count - ld b,e ; use device count for loop count - ld c,0 ; use C for device index -devlist1: - call crlf ; formatting - ld de,indent ; indent - call prtstr ; ... to look nice - push bc ; preserve loop control - ld a,c ; device to A - call prtdev ; print device mnemonic - ld a,':' ; colon for device/unit format - call prtchr ; print it - pop bc ; restore loop control - inc c ; next device index - djnz devlist1 ; loop as needed - or $FF ; signal no action taken - ret ; done -; -devlstu: - ; UNA mode device list - ld b,0 ; use unit 0 to get count - ld c,$48 ; una func: get disk type - ld l,0 ; preset unit count to zero - rst 08 ; call una, b is assumed to be untouched!!! - ld a,l ; unit count to a - or a ; set flags - ret z ; no units, return - ld b,l ; unit count to b - ld c,0 ; init unit index -devlstu1: - call crlf ; formatting - ld de,indent ; indent - call prtstr ; ... to look nice - push bc ; save loop control vars - ld a,c ; put unit num in A - push af ; save it - call prtdevu ; print the device name - pop af ; restore unit num - call prtdecb ; print unit num - ld a,':' ; colon delimiter - call prtchr ; print it - pop bc ; restore loop control - inc c ; next drive - djnz devlstu1 ; loop as needed - ret ; return -; -; Install the new drive map into CBIOS -; -install: - ld a,(cpmver) ; low byte of CP/M version - cp $30 ; CP/M 3.0? - jp nc,instcpm3 ; handle CP/M 3.0 or greater -; - ; capture CBIOS snapshot and stack frame for error recovery - ld hl,(bioloc) ; start of CBIOS - ld de,$1000 ; save it here - ld bc,(biosiz) ; size of CBIOS - ldir ; save it - ld (xstksav),sp ; save stack frame - ; clear CBIOS buffer area - ld hl,(maploc) ; start fill at drive map - ld a,(bioend + 1) ; msb of CBIOS end address to A -install1: - ld e,0 ; fill with null - ld (hl),e ; fill next byte - inc hl ; point to next byte - cp h ; is H == msb of CBIOS end address? - jr nz,install1 ; if not, loop -; - ; determine the drive map entry count - ld hl,mapwrk - ld c,0 - ld b,16 -install2: - ld a,$FF - cp (hl) - jr z,install3 - ld e,c ; remember high water mark -install3: - inc hl - inc hl - inc hl - inc hl - inc c - djnz install2 - inc e ; convert from max value to count -; - ; record entry count in CBIOS - ld hl,(maploc) ; start of map - dec hl ; backup to entry count - ld (hl),e ; record count -; - ; copy map - ld a,e ; A := entry count - add a,a ; multiply by size - add a,a ; ... of entry (4 bytes) - ld c,a ; put in C for count - ld b,0 ; msb of count is always zero - ld hl,mapwrk ; source of copy is work map - ld de,(maploc) ; target is CBIOS map loc - ldir ; do it -; - ; set start of memory allocation heap - ld (heaptop),de ; DE has next byte available -; - ; allocate directory buffer - ld hl,128 ; size of directory buffer - call alloc ; allocate the space - jp c,instovf ; handle overflow error - ld (dirbuf),hl ; ... and save in dirbuf -; -dph_init: -; -; iterate through drive map to build dph entries dynamically -; - ; setup for dph build loop - ld hl,(maploc) ; 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: - ; no DPH if drive not assigned - ld a,(hl) - cp $FF - jr nz,dph_init2 - ld de,0 ; not assigned, use DPH pointer of zero - jr dph_init3 -; -dph_init2: - ld a,(hl) ; unit to A - push bc ; save loop control - push hl ; save drive map pointer - ld hl,16 ; size of a DPH structure - call alloc ; allocate space for dph - jp c,instovf ; handle overflow error - push hl ; save DPH location - push hl ; move DPH location - pop de ; ... to DE - call makdph ; make the DPH, unit in A from above - pop de ; restore DPH pointer to DE - pop hl ; restore drive map pointer to HL - pop bc ; restore loop control -; -dph_init3: - inc hl ; bump to slice loc - inc hl ; bump to DPH pointer lsb - ld (hl),e ; save lsb - inc hl ; bump to DPH pointer msb - ld (hl),d ; save msb - inc hl ; bump to start of next drive map entry - inc c ; next drive index - djnz dph_init1 ; loop as needed -; - ; display free memory - call crlf2 - ld de,indent - call prtstr - ld hl,(heaplim) ; subtract high water - ld de,(heaptop) ; ... from top of cbios - or a ; ... with cf clear - sbc hl,de ; ... so hl gets bytes free - call prtdecw ; print it - ld de,msgmem ; add description - call prtstr ; and print it -; - call drvrst ; perform BDOS drive reset -; - xor a ; signal success - ret ; done -; -makdph: -; -; make a dph at address in de for dev/unit in a -; - push de ; save incoming dph address -; - ld c,a ; save incoming dev/unit - ld a,(unamod) ; get UNA mode flag - or a ; set flags - ld a,c ; restore incoming dev/unit - jr nz,makdphuna ; do UNA mode - jr makdphwbw ; do WBW mode -; -makdphuna: ; determine appropriate dpb (WBW mode) - ld b,a ; unit num to b - ld c,$48 ; una func: get disk type - rst 08 ; call una - ld a,d ; move disk type to a -; - ; derive dpb address based on disk type - cp $40 ; ram/rom drive? - jr z,makdphuna1 ; handle ram/rom drive if so -; cp $?? ; floppy drive? -; jr z,xxxxx ; handle floppy - ld e,4 ; assume hard disk - jr makdph0 ; continue -; -makdphuna1: ; handle ram/rom - ld c,$45 ; una func: get disk info - ld de,$9000 ; 512 byte buffer *** fix!!! *** - rst 08 ; call una - bit 7,b ; test ram drive bit - ld e,1 ; assume rom - jr z,makdph0 ; not set, rom drive, continue - ld e,2 ; otherwise, must be ram drive - jr makdph0 ; continue -; -makdphwbw: ; determine appropriate dpb (WBW mode, unit number in A) -; - ld c,a ; unit number to C - ld b,$17 ; HBIOS: Report Device Info - rst 08 ; call HBIOS, return w/ device type in D, physical unit in E - ld a,d ; device type to A - cp $00 ; ram/rom? - jr nz,makdph00 ; if not, skip ahead to other types - ld a,e ; physical unit number to A - ld e,1 ; assume rom - cp $00 ; rom? - jr z,makdph0 ; yes, jump ahead - ld e,2 ; otherwise ram - jr makdph0 ; jump ahead -makdph00: - ld e,6 ; assume floppy - cp $10 ; floppy? - jr z,makdph0 ; yes, jump ahead - ld e,3 ; assume ram floppy - cp $20 ; ram floppy? - jr z,makdph0 ; yes, jump ahead - ld e,4 ; everything else is assumed to be hard disk - jr makdph0 ; yes, jump ahead -; -makdph0: - ld hl,(dpbloc) ; point to start of dpb table in CBIOS - ld a,e ; get index of target DPB to A - add a,a ; each entry is two bytes - call addhl ; add offset for desired DPB address - ld e,(hl) ; dereference HL - inc hl ; into DE, so DE - ld d,(hl) ; has address of target DPB -; -makdph1: -; - ; build the dph - pop hl ; hl := start of dph - ld a,8 ; size of dph reserved area - call addhl ; 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: - ; DE = address of CKS or ALS buf to allocate - ; HL = address of field in DPH to get allocated address - push hl ; save DPH field ptr - pop bc ; into BC -; - ; HL := alloc size, DE bumped - ex de,hl - ld e,(hl) ; get size to allocate - inc hl ; ... - ld d,(hl) ; ... into HL - inc hl ; and bump DE - ex de,hl -; - ; check for size of zero, special case - ld a,h ; check to see - or l ; ... if hl is zero - jr z,makdph3 ; if so, jump ahead using hl as address -; - ; allocate memory - call alloc ; do the allocation - jp c,instovf ; bail out on overflow - -makdph3: - ; swap hl and bc - push bc ; bc -> (sp) - ex (sp),hl ; (sp) -> hl, hl -> (sp) - pop bc ; (sp) -> bc -; - ; save allocated address - 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 -; -; -; -instcpm3: -; - ; switch to sysbnk - ld hl,(bioloc) - ld de,27*3 ; offset of SELMEM func - add hl,de ; HL := SELMEM func - ld a,0 ; bank 0 is system bank - call jphl -; - ; copy drvmap working copy to CP/M 3 drvtbl - ld hl,(drvtbl) ; get drvtbl address - ld a,(hl) ; deref HL to get DPH0 adr - inc hl ; ... - ld h,(hl) ; ... - ld l,a ; ... - ld (dphadr),hl ; save starting dphadr - - - ld hl,(drvtbl) ; get drive table in HL - ld de,mapwrk ; DE := working drive map - ld b,16 -instc1: - ld a,(de) ; get unit field of mapwrk - inc a ; test for $FF - jr nz,instc2 ; if used, do copy - xor a ; zero accum - ld (hl),a ; zero lsb of drvtbl entry adr - inc hl ; move to msb - ld (hl),a ; zero msb of drvtbl entry adr - inc hl ; bump to start of next drvtbl entry - inc de ; bump to next mapwrk entry - inc de ; ... - inc de ; ... - inc de ; ... - jr instc3 ; resume loop without copy -; -instc2: - push hl ; save drvtbl entry adr - push de ; save mapwrk entry adr - ld de,(dphadr) ; get cur dph adr - ld (hl),e ; save dph adr to drvtbl - inc hl ; ... - ld (hl),d ; ... - ex de,hl ; dph adr to HL - pop de ; restore mapwrk entry adr - dec hl ; backup to unit - dec hl ; ... - ld a,(de) ; get unit from mapwrk - ld (hl),a ; put unit into DPH field - inc de ; bump to slice field of mapwrk - inc hl ; bump to slice field of DPH field - ld a,(de) ; get slice from mapwrk - ld (hl),a ; put slice into DPH field - inc de ; bump to next mapwrk entry - inc de ; ... - inc de ; ... - pop hl ; back to drvtbl entry - inc hl ; bump to - inc hl ; ... next drvtbl entry -instc3: - push hl ; save drvtbl entry adr - push de ; save mapwrk entry adr - ld hl,(dphadr) ; get cur dph address - ld de,$23 ; size of xdph - add hl,de ; bump to next dph - ld (dphadr),hl ; save it - pop de ; recover mapwrk entry adr - pop hl ; recover drvtbl entry adr - djnz instc1 -; - ; switch back to tpabnk - ld hl,(bioloc) - ld de,27*3 ; offset of SELMEM func - add hl,de ; HL := SELMEM func - ld a,1 ; bank 1 is tpa bank - call jphl -; - call drvrst ; perform BDOS drive reset -; - xor a ; signal success - ret -; -; Handle overflow error in installation -; -instovf: - ; restore stack frame and CBIOS image - ld sp,(xstksav) ; restore stack frame - ld hl,$1000 ; start of CBIOS image buffer - ld de,(bioloc) ; start of CBIOS - ld bc,(biosiz) ; size of CBIOS - ldir ; restore it - jp errovf -; -; Allocate HL bytes from heap -; Return pointer to allocated memory in HL -; On overflow error, C set -; -alloc: - push de ; save de so we can use it for work reg - ld de,(heaptop) ; get current heap top - push de ; and save for return value - add hl,de ; add requested space, hl := new heap top - jr c,allocx ; test for cpu memory space overflow - ld de,(heaplim) ; load de with heap limit - ex de,hl ; de=new heaptop, hl=heaplim - sbc hl,de ; heaplim - heaptop - jr c,allocx ; c set on overflow error - ; allocation succeeded, commit new heaptop - ld (heaptop),de ; save new heaptop -allocx: - pop hl ; return value to hl - pop de ; recover de - ret -; -; Scan drive map table for integrity -; Currently just checks for multiple drive -; letters referencing a single file system -; -valid: - ld hl,mapwrk ; point to working drive map table - ld b,16 - 1 ; loop one less times than num entries -; - ; check that drive A: is assigned - ld a,$FF ; value that indicates unassigned - cp (hl) ; compare to A: value - jp z,errnoa ; handle failure -; -valid1: ; outer loop -; call crlf - push hl ; save pointer - push bc ; save loop control - call valid2 ; do the inner loop - pop bc ; restore loop control - pop hl ; restore pointer - jp z,errint ; validation error - ld a,4 ; 4 bytes per entry - call addhl ; bump to next entry - djnz valid1 ; loop until done - xor a ; signal OK - ret ; done -; -valid2: ; setup for inner loop - push hl ; save HL - ld a,4 ; 4 bytes per entry - call addhl ; point to entry following - pop de ; de points to comparison entry -; -valid3: ; inner loop - ; bypass unassigned drives (only need to test 1) - ld a,(hl) ; get first drive unit in A - cp $FF ; unassigned? - jr z,valid4 ; yes, skip -; - ; compare unit/slice values - ld a,(de) ; first byte to A - cp (hl) ; compare - jr nz,valid4 ; if not equal, continue loop - inc de ; bump DE to next byte - inc hl ; bump HL to next byte - ld a,(de) ; first byte to A - cp (hl) ; compare - ret z ; both bytes equal, return signalling problem - dec de ; point DE back to first byte of comparison entry - dec hl ; point HL back -; -valid4: ; no match, loop - inc hl - inc hl ; bump HL - inc hl ; ... to - inc hl ; ... next entry - or $FF ; no match - djnz valid3 ; loop as appropriate - ret -; -; Show a specific drive assignment -; -drvshow: - ld a,(dstdrv) ; get the drive num - call chkdrv ; valid drive letter? - ret nz ; abort if not - call showone ; show it - xor a ; signal success - ret ; done -; -; Delete (unassign) drive -; -drvdel: - ld a,(dstdrv) ; get the dest drive (to be unassigned) - call chkdrv ; valid drive letter? - ret nz ; abort if not - ; point to correct entry in drive map - ld hl,mapwrk ; point to working drive map - ld a,(dstdrv) ; get drive letter to remove - rlca ; calc table offset - rlca ; ... as drive num * 4 - call addhl ; get final table offset - ; wipe out the drive letter - ld a,$FF ; dev/unit := $FF (unassigned) - ld (hl),a ; do it - xor a ; zero accum - inc hl ; slice := 0 - ld (hl),a ; do it - inc hl ; DPH pointer lsb := 0 - ld (hl),a ; do it - inc hl ; DPH pointer msb := 0 - ld (hl),a ; do it - ; done - ld a,(dstdrv) ; get the destination - call showone ; show it - ld hl,modcnt ; point to mod count - inc (hl) ; increment it - xor a ; signal success - ret -; -; Swap the source and destination drive letters -; -drvswap: - ld a,(dstdrv) ; get the destination drive - call chkdrv ; valid drive? - ret nz ; abort if not - ld a,(srcdrv) ; get the source drive - call chkdrv ; valid drive? - ret nz ; abort if not - ld hl,(drives) ; load source/dest in DE - ld a,h ; put source drive num in a - cp l ; compare to the dest drive num - jp z,errswp ; Invalid swap request, src == dest -; - ; Get pointer to source drive table entry - ld hl,mapwrk - ld a,(srcdrv) - rlca - rlca - call addhl - ld (srcptr),hl -; - ; Get pointer to destination drive table entry - ld hl,mapwrk - ld a,(dstdrv) - rlca - rlca - call addhl - ld (dstptr),hl -; - ; 1) dest -> temp - ld hl,(dstptr) - ld de,tmpent - ld bc,4 - ldir -; - ; 2) source -> dest - ld hl,(srcptr) - ld de,(dstptr) - ld bc,4 - ldir -; - ; 3) temp -> source - ld hl,tmpent - ld de,(srcptr) - ld bc,4 - ldir -; - ; print the results - ld a,(dstdrv) ; get the destination - call showone ; show it - ld a,(srcdrv) ; get the source drive - call showone ; show it -; - ld hl,modcnt ; point to mod count - inc (hl) ; increment it - xor a ; signal success - ret ; exit -; -; Assign drive to specified unit/slice -; -drvmap: - ; check for UNA mode - ld a,(unamod) ; get UNA mode flag - or a ; set flags - jr nz,drvmapu ; do UNA mode drvmap -; - ; determine device code by scanning for string - ld b,16 ; device table always has 16 entries - ld c,0 ; c is used to track table entry num - ld de,tmpstr ; de points to specified device name - ld hl,devtbl ; hl points to first entry of devtbl -; -drvmap1: ; loop through device table looking for a match - push hl ; save device table entry pointer - ld a,(hl) ; dereference HL - inc hl ; ... to point to - ld h,(hl) ; ... string - ld l,a ; ... in device table - push de ; save string pointer - push bc ; save loop control stuff - call strcmp ; compare strings - pop bc ; restore loop control stuff - pop de ; restore de - pop hl ; restore table entry pointer - jr z,drvmap2 ; match, continue - inc hl ; bump to next - inc hl ; device table pointer - inc c ; keep track of table entry num - djnz drvmap1 ; and loop - jp errdev -; -drvmap2: - ; convert index to device type id - ld a,c ; index to accum - rlca ; move it to upper nibble - rlca ; ... - rlca ; ... - rlca ; ... - ld (device),a ; save as device id -; - ; loop thru hbios units looking for device type/unit match - ld b,$F8 ; hbios func: sysget - ld c,$10 ; sysget subfunc: diocnt - rst 08 ; call hbios, E := device count - ld b,e ; use device count for loop count - ld c,0 ; use C for device index -drvmap3: - push bc ; preserve loop control - ld b,$17 ; hbios func: diodevice - rst 08 ; call hbios, D := device, E := unit - pop bc ; restore loop control - ld a,(device) - cp d - jr nz,drvmap4 - ld a,(unit) - cp e - jr z,drvmap5 ; match, continue, C = BIOS unit -drvmap4: - ; continue looping - inc c - djnz drvmap3 - jp errdev ; invalid device specified -; -drvmap5: - ; check for valid unit (supported by BIOS) - push bc ; save unit - ld a,c ; unit to A - call chkdev ; check validity - pop bc ; restore unit - ret nz ; bail out on error - - ; resolve the CBIOS DPH table entry - ld a,(dstdrv) ; dest drv num to A - call chkdrv ; valid drive? - ret nz ; abort if invalid - ld hl,mapwrk ; point to start of drive map - rlca ; multiply by - rlca ; ... entry size of 4 - call addhl ; adjust HL to point to entry - ld (dstptr),hl ; save it -; - ; shove updated unit/slice into the entry - ld (hl),c ; save unit byte - inc hl ; bump to next byte - ld a,(slice) - ld (hl),a ; save slice -; - ; finish up - ld a,(dstdrv) ; get the destination drive - call showone ; show it's new value - ld hl,modcnt ; point to mod count - inc (hl) ; increment it - xor a ; signal success - ret ; exit -; -; UNA mode drive mapping -; -drvmapu: -; - ; verify the device nmeumonic - ld a,(unit) ; get unit specified - ld b,a ; put in b - ld d,0 ; preset type to 0 - ld c,$48 ; una func: get disk type - rst 08 ; call una, b is assumed to be untouched!!! - ld a,d ; resultant device type to a - cp $40 ; RAM/ROM - jr z,drvmapu0 ; special case for RAM/ROM - ld de,udevide ; assume IDE - cp $41 ; IDE? - jr z,drvmapu1 ; do compare - ld de,udevppide ; assume PPIDE - cp $42 ; PPIDE? - jr z,drvmapu1 ; do compare - ld de,udevsd ; assume SD - cp $43 ; SD? - jr z,drvmapu1 ; do compare - ld de,udevdsd ; assume DSD - cp $44 ; DSD? - jr z,drvmapu1 ; do compare - jp errdev ; error, invalid device name -; -drvmapu0: - ; handle RAM/ROM - ld a,(unit) ; get unit specified - ld b,a ; unit num to B - ld c,$45 ; UNA func: get disk info - ld de,$9000 ; 512 byte buffer *** FIX!!! *** - rst 08 ; call UNA - bit 7,b ; test RAM drive bit - ld de,udevrom ; assume ROM - jr z,drvmapu1 ; do compare - ld de,udevram ; assume RAM - jr drvmapu1 ; do compare - jp errdev ; error, invalid device name -; -drvmapu1: - ld hl,tmpstr ; point HL to specified device name - call strcmp ; compare - jp nz,errdev ; no match, invalid device name -; - ; check for valid unit (supported by BIOS) - ld a,(unit) ; get specified unit - call chkdevu ; check validity - jp nz,errdev ; invalid device specified -; - ; resolve the CBIOS DPH table entry - ld a,(dstdrv) ; dest drv num to A - call chkdrv ; valid drive? - ret nz ; abort if invalid - ld hl,mapwrk ; point to start of drive map - rlca ; multiply by - rlca ; ... entry size of 4 - call addhl ; adjust HL to point to entry - ld (dstptr),hl ; save it -; - ; shove updated unit/slice into the entry - ld a,(unit) ; get specified unit - ld (hl),a ; save it - inc hl ; next byte is slice - ld a,(slice) ; get specified slice - ld (hl),a ; save it -; - ; finish up - ld a,(dstdrv) ; get the destination drive - call showone ; show it's new value - ld hl,modcnt ; point to mod count - inc (hl) ; increment it - xor a ; signal success - ret -; -; Display all active drive letter assignments -; -showall: - ld b,16 ; 16 drives possible - ld c,0 ; map index (drive letter) -; - ld a,b ; load count - or $FF ; signal no action - ret z ; bail out if zero -; -showall1: ; loop - ld a,c ; - push bc ; save loop control - call showass - pop bc ; restore loop control - inc c - djnz showall1 - or $FF - ret -; -; Display drive letter assignment IF it is assigned -; Drive num in A -; -showass: -; - ; setup HL to point to desired entry in table - ld c,a ; save incoming drive in C - ld hl,mapwrk ; HL = address of drive map - rlca - rlca - call addhl ; HL = address of drive map table entry - ld a,(hl) ; get unit value - cp $FF ; compare to unassigned value - ld a,c ; recover original drive num - ret z ; bail out if unassigned drive - ; fall thru to display drive -; -; Display drive letter assignment for the drive num in A -; -showone: -; - push af ; save the incoming drive num -; - call crlf ; formatting -; - ld de,indent ; indent - call prtstr ; ... to look nice -; - ; setup HL to point to desired entry in table - pop af - push af - ld hl,mapwrk ; HL = address of drive map - rlca - rlca - call addhl ; HL = address of drive map table entry - pop af -; - ; render the drive letter based on table index - add a,'A' ; convert to alpha - call prtchr ; print it - ld a,':' ; conventional color after drive letter - call prtchr ; print it - ld a,'=' ; use '=' to represent assignment - call prtchr ; print it -; - ; render the map entry - ld a,(hl) ; load unit - cp $FF ; empty? - ret z ; yes, bypass - push hl ; preserve HL - call prtdev ; print device mnemonic - ld a,':' ; colon for device/unit format - call prtchr ; print it - pop hl ; recover HL - inc hl ; point to slice num - ld a,(hl) ; load slice num - call prtdecb ; print it -; - ret -; -; Force BDOS to reset (logout) all drives -; -drvrst: - ld c,$0D ; BDOS Reset Disk function - call bdos ; do it -; - ld c,$25 ; BDOS Reset Multiple Drives - ld de,$FFFF ; all drives - call bdos ; do it -; - xor a ; signal success - ret -; -; Print device mnemonic based on device number in A -; -prtdev: - ld e,a ; stash incoming device num in E - ld a,(unamod) ; get UNA mode flag - or a ; set flags - ld a,e ; put device num back - jr nz,prtdevu ; print device in UNA mode - ld b,$17 ; hbios func: diodevice - ld c,a ; unit to C - rst 08 ; call hbios, D := device, E := unit - push de ; save results - ld a,d ; device to A - rrca ; isolate high nibble (device) - rrca ; ... - rrca ; ... - rrca ; ... into low nibble - and $0F ; mask out undesired bits - push hl ; save HL - add a,a ; multiple A by two for word table - ld hl,devtbl ; point to start of device name table - call addhl ; 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 prtstr ; print the device nmemonic - pop hl ; restore HL - pop de ; get device/unit data back - ld a,e ; device id to a - call prtdecb ; print it - ret ; done -; -prtdevu: - push bc - push de - push hl -; - ; UNA mode version of print device - ld b,a ; B := unit num - push bc ; save for later - ld c,$48 ; UNA func: get disk type - rst 08 ; call UNA - ld a,d ; disk type to A - pop bc ; get unit num back in C -; - ; pick string based on disk type - cp $40 ; RAM/ROM? - jr z,prtdevu1 ; if so, handle it - cp $41 ; IDE? - ld de,udevide ; load string - jr z,prtdevu2 ; if IDE, print and return - cp $42 ; PPIDE? - ld de,udevppide ; load string - jr z,prtdevu2 ; if PPIDE, print and return - cp $43 ; SD? - ld de,udevsd ; load string - jr z,prtdevu2 ; if SD, print and return - cp $44 ; DSD? - ld de,udevdsd ; load string - jr z,prtdevu2 ; if DSD, print and return - ld de,udevunk ; load string for unknown - jr prtdevu2 ; and print it -; -prtdevu1: - ; handle RAM/ROM - push bc ; save unit num - ld c,$45 ; UNA func: get disk info - ld de,$9000 ; 512 byte buffer *** FIX!!! *** - rst 08 ; call UNA - bit 7,b ; test RAM drive bit - pop bc ; restore unit num - ld de,udevrom ; load string - jr z,prtdevu2 ; print and return - ld de,udevram ; load string - jr prtdevu2 ; print and return -; -prtdevu2: - call prtstr ; print the device nmemonic - ld a,b ; get the unit num back - call prtdecb ; append it - pop hl - pop de - pop bc - ret -; -; Check that specified drive num is valid -; -chkdrv: - cp 16 ; max of 16 drive letters - jp nc,errdrv ; handle bad drive - cp a ; set Z to signal good - ret ; and return -; -; Check that the unit value in A is valid -; according to active BIOS support. -; -; -chkdev: ; HBIOS variant - push af ; save incoming unit - ld b,$F8 ; hbios func: sysget - ld c,$10 ; sysget subfunc: diocnt - rst 08 ; call hbios, E := device count - pop af ; restore incoming unit - cp e ; compare to unit count - jp nc,errdev ; if too high, error -; - ; get device/unit info - ld b,$17 ; hbios func: diodevice - ld c,a ; unit to C - rst 08 ; call hbios, D := device, E := unit - ld a,d ; device to A -; - ; check slice support - cp $30 ; A has device/unit, in hard disk range? - jr c,chkdev1 ; if not hard disk, check slice val - xor a ; otherwise, signal OK - ret -; -chkdev1: ; not a hard disk, make sure slice == 0 - ld a,(slice) ; get specified slice - or a ; set flags - jp nz,errslc ; invalid slice error - xor a ; signal OK - ret -; -chkdevu: ; UNA variant - ld b,a ; put in b - ld d,0 ; preset type to 0 - ld c,$48 ; una func: get disk type - rst 08 ; call una - ld a,d ; resultant device type to a - or a ; set flags - jp z,errdev ; invalid if 0 -; - ; check for slice support, if required - cp $40 ; ram/rom? - jr z,chkdevu1 ; yes, check for slice -; cp $?? ; floppy? -; jr z,chkdevu1 ; yes, check for slice - xor a ; otherwise signal success - ret ; and return -; -chkdevu1: - ld a,(slice) ; get specified slice - or a ; set flags - jp nz,errslc ; invalid slice error - xor a ; otherwise, signal OK - ret ; and return -; -; Print character in A without destroying any registers -; -prtchr: - push bc ; save registers - push de - push hl - ld e,a ; character to print in E - ld c,$02 ; BDOS function to output a character - call bdos ; do it - pop hl ; restore registers - pop de - pop bc - ret -; -prtdot: -; - ; shortcut to print a dot preserving all regs - push af ; save af - ld a,'.' ; load dot char - call prtchr ; print it - pop af ; restore af - ret ; done -; -; Print a zero terminated string at (HL) without destroying any registers -; -prtstr: - push de -; -prtstr1: - ld a,(de) ; get next char - or a - jr z,prtstr2 - call prtchr - inc de - jr prtstr1 -; -prtstr2: - pop de ; restore registers - ret -; -; Print the value in A in hex without destroying any registers -; -prthex: - push af ; save AF - push de ; save DE - call hexascii ; convert value in A to hex chars in DE - ld a,d ; get the high order hex char - call prtchr ; print it - ld a,e ; get the low order hex char - call prtchr ; print it - pop de ; restore DE - pop af ; restore AF - ret ; done -; -; print the hex word value in bc -; -prthexword: - push af - ld a,b - call prthex - ld a,c - call prthex - pop af - ret -; -; Convert binary value in A to ascii hex characters in DE -; -hexascii: - ld d,a ; save A in D - call hexconv ; convert low nibble of A to hex - ld e,a ; save it in E - ld a,d ; get original value back - rlca ; rotate high order nibble to low bits - rlca - rlca - rlca - call hexconv ; convert nibble - ld d,a ; save it in D - ret ; done -; -; Convert low nibble of A to ascii hex -; -hexconv: - and $0F ; low nibble only - add a,$90 - daa - adc a,$40 - daa - ret -; -; Print value of A or HL in decimal with leading zero suppression -; Use prtdecb for A or prtdecw for HL -; -prtdecb: - push hl - ld h,0 - ld l,a - call prtdecw ; print it - pop hl - ret -; -prtdecw: - push af - push bc - push de - push hl - call prtdec0 - pop hl - pop de - pop bc - pop af - ret -; -prtdec0: - ld e,'0' - ld bc,-10000 - call prtdec1 - ld bc,-1000 - call prtdec1 - ld bc,-100 - call prtdec1 - ld c,-10 - call prtdec1 - ld e,0 - ld c,-1 -prtdec1: - ld a,'0' - 1 -prtdec2: - inc a - add hl,bc - jr c,prtdec2 - sbc hl,bc - cp e - ret z - ld e,0 - call prtchr - ret -; -; Start a new line -; -crlf2: - call crlf ; two of them -crlf: - push af ; preserve AF - ld a,13 ; - call prtchr ; print it - ld a,10 ; - call prtchr ; print it - pop af ; restore AF - ret -; -; Get the next non-blank character from (HL). -; -nonblank: - ld a,(hl) ; load next character - or a ; string ends with a null - ret z ; if null, return pointing to null - cp ' ' ; check for blank - ret nz ; return if not blank - inc hl ; if blank, increment character pointer - jr nonblank ; and loop -; -; Check character at (DE) for delimiter. -; -delim: or a - ret z - cp ' ' ; blank - ret z - jr c,delim1 ; handle control characters - cp '=' ; equal - ret z - cp '_' ; underscore - ret z - cp '.' ; period - ret z - cp ':' ; colon - ret z - cp $3B ; semicolon - ret z - cp '<' ; less than - ret z - cp '>' ; greater than - ret -delim1: - ; treat control chars as delimiters - xor a ; set Z - ret ; return -; -; Get alpha chars and save in tmpstr -; return with terminating char in A and flags set -; return with num chars in B -; -getalpha: -; - ld de,tmpstr ; location to save chars - ld b,0 ; length counter -; -getalpha1: - ld a,(hl) ; get active char - cp 'A' ; check for start of alpha range - jr c,getalpha2 ; not alpha, get out - cp 'Z' + 1 ; check for end of alpha range - jr nc,getalpha2 ; not alpha, get out - ; handle alpha char - inc hl ; increment buffer ptr - ld (de),a ; save it - inc de ; inc string pointer - inc b ; inc string length - ld a,b ; put length in A - cp 8 ; max length? - jr z,getalpha2 ; if max, get out - jr getalpha1 ; and loop -; -getalpha2: ; non-alpha, clean up and return - xor a ; clear accum - ld (de),a ; terminate string - ld a,(hl) ; recover terminating char - or a ; set flags - ret ; and done -; -; Get numeric chars and convert to number returned in A -; Carry flag set on overflow -; -getnum: - ld c,0 ; C is working register -getnum1: - ld a,(hl) ; get the active char - cp '0' ; compare to ascii '0' - jr c,getnum2 ; abort if below - cp '9' + 1 ; compare to ascii '9' - jr nc,getnum2 ; abort if above\ -; - ; valid digit, add new digit to C - ld a,c ; get working value to A - rlca ; multiply by 10 - ret c ; overflow, return with carry set - rlca ; ... - ret c ; overflow, return with carry set - add a,c ; ... - ret c ; overflow, return with carry set - rlca ; ... - ret c ; overflow, return with carry set - ld c,a ; back to C - ld a,(hl) ; get new digit - sub '0' ; make binary - add a,c ; add in working value - ret c ; overflow, return with carry set - ld c,a ; back to C -; - inc hl ; bump to next char - jr getnum1 ; loop -; -getnum2: ; return result - ld a,c ; return result in A - or a ; with flags set, CF is cleared - ret -; -; Compare null terminated strings at HL & DE -; If equal return with Z set, else NZ -; -strcmp: -; - ld a,(de) ; get current source char - cp (hl) ; compare to current dest char - ret nz ; compare failed, return with NZ - or a ; set flags - ret z ; end of string, match, return with Z set - inc de ; point to next char in source - inc hl ; point to next char in dest - jr strcmp ; loop till done -; -; Invoke CBIOS function -; The CBIOS function offset must be stored in the byte -; following the call instruction. ex: -; call cbios -; .db $0C ; offset of CONOUT CBIOS function -; -cbios: - ex (sp),hl - ld a,(hl) ; get the function offset - inc hl ; point past value following call instruction - ex (sp),hl ; put address back at top of stack and recover HL - ld hl,(bioloc) ; address of CBIOS function table to HL - call addhl ; determine specific function address - jp (hl) ; invoke CBIOS -; -; Add the value in A to HL (HL := HL + A) -; -addhl: - add a,l ; A := A + L - ld l,a ; Put result back in L - ret nc ; if no carry, we are done - inc h ; if carry, increment H - ret ; and return -; -; Jump indirect to address in HL -; -jphl: - jp (hl) -; -; Errors -; -erruse: ; command usage error (syntax) - ld de,msguse - jr err -; -errprm: ; command parameter error (syntax) - ld de,msgprm - jr err -; -errinv: ; invalid CBIOS, zp signature not found - ld de,msginv - jr err -; -errver: ; CBIOS version is not as expected - ld de,msgver - jr err -; -errdrv: ; Invalid drive letter specified - push af - call crlf - ld de,msgdrv1 - call prtstr - pop af - add a,'A' - call prtchr - ld de,msgdrv2 - jr err1 -; -errswp: ; invalid drive swap request - ld de,msgswp - jr err -; -errdev: ; invalid device name - ld de,msgdev - jr err -; -errslc: ; invalid slice - ld de,msgslc - jr err -; -errtyp: ; invalid device assignment request (not a hard disk device type) - ld de,msgtyp - jr err -; -errnum: ; invalid number parsed, overflow - ld de,msgnum - jr err -; -errint: ; DPH table integrity error (multiple drives ref one filesystem) - ld de,msgint - jr err -; -errnoa: ; No A: drive assignment - ld de,msgnoa - jr err -; -errovf: ; CBIOS disk buffer overflow - ld de,msgovf - jr err -; -errdos: ; handle BDOS errors - push af ; save return code - call crlf ; newline - ld de,msgdos ; load - call prtstr ; and print error string - pop af ; recover return code - call prthex ; print error code - jr err2 -; -err: ; print error string and return error signal - call crlf2 ; print double newline -; -err1: ; without the leading crlf - call prtstr ; print error string -; -err2: ; without the string -; call crlf ; print newline - or $FF ; signal error - ret ; done -; -;=============================================================================== -; Storage Section -;=============================================================================== -; -; -bioloc .dw 0 ; CBIOS starting address -bioend .dw 0 ; CBIOS ending address -biosiz .dw 0 ; CBIOS size (in bytes) -maploc .dw 0 ; location of CBIOS drive map table -dpbloc .dw 0 ; location of CBIOS DPB map table -cpmver .dw 0 ; CP/M version -drvtbl .dw 0 ; CP/M 3 drive table address -dphadr .dw 0 ; CP/M 3 working value for DPH -; -drives: -dstdrv .db 0 ; destination drive -srcdrv .db 0 ; source drive -device .db 0 ; source device -unit .db 0 ; source unit -slice .db 0 ; source slice -; -unamod .db 0 ; $FF indicates UNA UBIOS active -modcnt .db 0 ; count of drive map modifications -; -srcptr .dw 0 ; source pointer for copy -dstptr .dw 0 ; destination pointer for copy -tmpent .fill 4,0 ; space to save a table entry -tmpstr .fill 9,0 ; temporary string of up to 8 chars, zero term -; -heaptop .dw 0 ; current address of top of heap memory -heaplim .dw 0 ; heap limit address -; -dirbuf .dw 0 ; directory buffer location -; -mapwrk .fill (4 * 16),$FF ; working copy of drive map -; -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 "?",0 -dev00 .db "MD",0 -dev01 .db "FD",0 -dev02 .db "RAMF",0 -dev03 .db "IDE",0 -dev04 .db "ATAPI",0 -dev05 .db "PPIDE",0 -dev06 .db "SD",0 -dev07 .db "PRPSD",0 -dev08 .db "PPPSD",0 -dev09 .db "HDSK",0 -dev10 .equ devunk -dev11 .equ devunk -dev12 .equ devunk -dev13 .equ devunk -dev14 .equ devunk -dev15 .equ devunk -; -devcnt .equ 10 ; 10 devices defined -; -udevram .db "RAM",0 -udevrom .db "ROM",0 -udevide .db "IDE",0 -udevppide .db "PPIDE",0 -udevsd .db "SD",0 -udevdsd .db "DSD",0 -udevunk .db "UNK",0 -; -stksav .dw 0 ; stack pointer saved at start -xstksav .dw 0 ; temp stack save for error recovery - .fill stksiz,0 ; stack -stack .equ $ ; stack top -; -; Messages -; -indent .db " ",0 -msgban1 .db "ASSIGN v1.1a for RomWBW CP/M, 24-Dec-2019",0 -msghb .db " (HBIOS Mode)",0 -msgub .db " (UBIOS Mode)",0 -msgban2 .db "Copyright 2019, Wayne Warthen, GNU GPL v3",0 -msguse .db "Usage: ASSIGN D:[=[{D:|[]:[]}]][,...]",13,10 - .db " ex. ASSIGN (display all active assignments)",13,10 - .db " ASSIGN /? (display version and usage)",13,10 - .db " ASSIGN /L (display all possible devices)",13,10 - .db " ASSIGN C:=D: (swaps C: and D:)",13,10 - .db " ASSIGN C:=FD0: (assign C: to floppy unit 0)",13,10 - .db " ASSIGN C:=IDE0:1 (assign C: to IDE unit0, slice 1)",13,10 - .db " ASSIGN C:= (unassign C:)",0 -msgprm .db "Parameter error (ASSIGN /? for usage)",0 -msginv .db "Unexpected CBIOS (signature missing)",0 -msgver .db "Unexpected CBIOS version",0 -msgdrv1 .db "Invalid drive letter (",0 -msgdrv2 .db ":)",0 -msgswp .db "Invalid drive swap request",0 -msgdev .db "Invalid device name (ASSIGN /L for device list)",0 -msgslc .db "Specified device does not support slices",0 -msgnum .db "Unit or slice number invalid",0 -msgovf .db "Disk buffer exceeded in CBIOS, aborted",0 -msgtyp .db "Only hard drive devices can be reassigned",0 -msgint .db "Multiple drive letters reference one filesystem, aborting!",0 -msgnoa .db "Drive A: is unassigned, aborting!",0 -msgdos .db "DOS error, return code=0x",0 -msgmem .db " Disk Buffer Bytes Free",0 -; -modsize .equ $ - start -; - .end diff --git a/Source/Apps/Build.cmd b/Source/Apps/Build.cmd index 794aee0d..1396ca29 100644 --- a/Source/Apps/Build.cmd +++ b/Source/Apps/Build.cmd @@ -4,45 +4,47 @@ setlocal set TOOLS=../../Tools set APPBIN=..\..\Binary\Apps -set PATH=%TOOLS%\tasm32;%TOOLS%\zx;%PATH% +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%PATH% set TASMTABS=%TOOLS%\tasm32 -set ZXBINDIR=%TOOLS%/cpm/bin/ -set ZXLIBDIR=%TOOLS%/cpm/lib/ -set ZXINCDIR=%TOOLS%/cpm/include/ - -call :asm SysCopy || goto :eof -call :asm Assign || goto :eof -call :asm Format || goto :eof -call :asm Talk || goto :eof -call :asm Mode || goto :eof -call :asm RTC || goto :eof -call :asm Timer || goto :eof -call :asm180 IntTest || goto :eof - -zx Z80ASM -SYSGEN/F - -zx MAC SURVEY.ASM -$PO -zx MLOAD25 -SURVEY.COM=SURVEY.HEX - -setlocal & cd XM && call Build || exit /b 1 & endlocal -setlocal & cd FDU && call Build || exit /b 1 & endlocal -setlocal & cd Tune && call Build || exit /b 1 & endlocal -setlocal & cd FAT && call Build || exit /b 1 & endlocal - -copy *.com %APPBIN%\ +set CPMDIR80=%TOOLS%/cpm/ + +call :asm syscopy || exit /b +call :asm assign || exit /b +call :asm format || exit /b +call :asm talk || exit /b +call :asm mode || exit /b +call :asm rtc || exit /b +call :asm timer || exit /b +call :asm rtchb || exit /b + +zxcc Z80ASM -SYSGEN/F || exit /b + +pushd XM && call Build || exit /b & popd +pushd FDU && call Build || exit /b & popd +pushd Tune && call Build || exit /b & popd +pushd FAT && call Build || exit /b & popd +pushd Test && call Build || exit /b & popd +pushd ZMP && call Build || exit /b & popd +pushd ZMD && call Build || exit /b & popd +pushd Dev && call Build || exit /b & popd +pushd VGM && call Build || exit /b & popd +pushd cpuspd && call Build || exit /b & popd +pushd Survey && call Build || exit /b & popd + +copy *.com %APPBIN%\ || exit /b goto :eof :asm echo. echo Building %1... -tasm -t80 -g3 -fFF %1.asm %1.com %1.lst +tasm -t80 -g3 -fFF %1.asm %1.com %1.lst || exit /b goto :eof :asm180 echo. echo Building %1... -tasm -t180 -g3 -fFF %1.asm %1.com %1.lst +tasm -t180 -g3 -fFF %1.asm %1.com %1.lst || exit /b goto :eof diff --git a/Source/Apps/Clean.cmd b/Source/Apps/Clean.cmd index 70b6dcee..e60ceb53 100644 --- a/Source/Apps/Clean.cmd +++ b/Source/Apps/Clean.cmd @@ -7,7 +7,14 @@ if exist *.lst del *.lst if exist *.hex del *.hex if exist *.prn del *.prn -setlocal & cd XM && call Clean || exit /b 1 & endlocal -setlocal & cd FDU && call Clean || exit /b 1 & endlocal -setlocal & cd Tune && call Clean || exit /b 1 & endlocal -setlocal & cd FAT && call Clean || exit /b 1 & endlocal +pushd XM && call Clean || exit /b 1 & popd +pushd FDU && call Clean || exit /b 1 & popd +pushd Tune && call Clean || exit /b 1 & popd +pushd FAT && call Clean || exit /b 1 & popd +pushd Test && call Clean || exit /b 1 & popd +pushd ZMP && call Clean || exit /b 1 & popd +pushd ZMD && call Clean || exit /b 1 & popd +pushd Dev && call Clean || exit /b 1 & popd +pushd VGM && call Clean || exit /b 1 & popd +pushd cpuspd && call Clean || exit /b 1 & popd +pushd Survey && call Clean || exit /b 1 & popd diff --git a/Source/Apps/Dev/Build.cmd b/Source/Apps/Dev/Build.cmd new file mode 100644 index 00000000..b63e6163 --- /dev/null +++ b/Source/Apps/Dev/Build.cmd @@ -0,0 +1,14 @@ +@echo off +setlocal + +set TOOLS=../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +echo Building Dev... +tasm -t80 -g3 -fFF dev.asm dev.com %dev.lst || exit /b + +copy /Y dev.com ..\..\..\Binary\Apps\ || exit /b +rem copy /Y *.ovr ..\..\..\Binary\Apps\ || exit /b +rem copy /Y *.hlp ..\..\..\Binary\Apps\ || exit /b +rem copy /Y *.doc ..\..\..\Binary\Apps\ || exit /b diff --git a/Source/Apps/Dev/Clean.cmd b/Source/Apps/Dev/Clean.cmd new file mode 100644 index 00000000..00648f91 --- /dev/null +++ b/Source/Apps/Dev/Clean.cmd @@ -0,0 +1,7 @@ +@echo off +setlocal + +if exist dev.com del dev.com +if exist *.hex del *.hex +if exist *.lst del *.lst +if exist *.zip del *.zip diff --git a/Source/Apps/Dev/Makefile b/Source/Apps/Dev/Makefile new file mode 100644 index 00000000..3bbbacf0 --- /dev/null +++ b/Source/Apps/Dev/Makefile @@ -0,0 +1,10 @@ +OBJECTS = dev.com +#DOCS = dev.txt +DEST = ../../../Binary/Apps +DOCDEST = ../../../Binary/Apps +TOOLS = ../../../Tools +include $(TOOLS)/Makefile.inc + +%.com: USETASM=1 + + diff --git a/Source/Apps/Dev/ReadMe.txt b/Source/Apps/Dev/ReadMe.txt new file mode 100644 index 00000000..60301781 --- /dev/null +++ b/Source/Apps/Dev/ReadMe.txt @@ -0,0 +1 @@ +THE DEV DIRECTORY IS A SKELETON DIRECTORY TO AID SETTING UP A BUILD PROCESS FOR A NEW PROGRAM diff --git a/Source/Apps/Dev/dev.asm b/Source/Apps/Dev/dev.asm new file mode 100644 index 00000000..e368b628 --- /dev/null +++ b/Source/Apps/Dev/dev.asm @@ -0,0 +1,32 @@ +;=============================================================================== +; Dev - Developement Stub +;=============================================================================== +; +; AUTHOR: +; +; Usage: +; +;_______________________________________________________________________________ +; +; Change Log: +; +;_______________________________________________________________________________ +; +; ToDo: +; +;_______________________________________________________________________________ +; +;=============================================================================== +; Definitions +;=============================================================================== +; +; +;=============================================================================== +; Code Section +;=============================================================================== +; +; + .org $100 + ret + .end + diff --git a/Source/Apps/FAT/Build.cmd b/Source/Apps/FAT/Build.cmd index 34e25577..235b1874 100644 --- a/Source/Apps/FAT/Build.cmd +++ b/Source/Apps/FAT/Build.cmd @@ -4,4 +4,4 @@ setlocal REM FAT.com is currently distributed as a binary application, so REM it is not built here. -copy /Y FAT.com ..\..\..\Binary\Apps\ +copy /Y fat.com ..\..\..\Binary\Apps\ || exit /b diff --git a/Source/Apps/FAT/FAT.com b/Source/Apps/FAT/FAT.com deleted file mode 100644 index 1dd7dcca..00000000 Binary files a/Source/Apps/FAT/FAT.com and /dev/null differ diff --git a/Source/Apps/FAT/Makefile b/Source/Apps/FAT/Makefile index 245385f2..2aef1f19 100644 --- a/Source/Apps/FAT/Makefile +++ b/Source/Apps/FAT/Makefile @@ -1,5 +1,5 @@ -OBJECTS = FAT.com -NODELETE = FAT.com +OBJECTS = fat.com +NODELETE = fat.com DEST = ../../../Binary/Apps TOOLS=../../../Tools diff --git a/Source/Apps/FAT/ReadMe.txt b/Source/Apps/FAT/ReadMe.txt index ad06db72..02f84de3 100644 --- a/Source/Apps/FAT/ReadMe.txt +++ b/Source/Apps/FAT/ReadMe.txt @@ -1,7 +1,7 @@ RomWBW HBIOS CP/M FAT Utility ("FAT.COM") Author: Wayne Warthen -Updated: 11-Oct-2019 +Updated: 12-Apr-2021 Application to manipulate and exchange files with a FAT (DOS) filesystem. Runs on any HBIOS hosted CP/M implementation. @@ -47,7 +47,7 @@ NOTES: "C:README.TXT" refers to CP/M file README.TXT on CP/M drive C "README.TXT" refers to CP/M file README.TXT on current CP/M drive - - Files with SYS, HIDDEN, or R/O only attributes are not given + - FAT files with SYS, HIDDEN, or R/O only attributes are not given any special treatment. Such files are found and processed like any other file. However, any attempt to write to a read-only file will fail and the application will abort. @@ -70,7 +70,7 @@ BUILD NOTES: - Application is based on FatFs. FatFs source is included. - - SDCC compiler is required to build (v3.9.0 known working). + - SDCC compiler is required to build (v4.0.0 known working). - ZX CP/M emulator is required to build (from RomWBW distribution). @@ -88,6 +88,8 @@ TO DO: - Do something intelligent with R/O and SYS files on FAT + - Support UNA + HISTORY: 2-May-2019: v0.9 (beta) initial release 7-May-2019: v0.9.1 (beta) added REN and DEL @@ -98,4 +100,5 @@ HISTORY: 10-Oct-2019: v0.9.6 (beta) added FORMAT 11-Oct-2019: v0.9.7 (beta) fix FORMAT to use existing partition table entries add attributes to directory listing + 12-Apr-2021: v0.9.8 (beta) support CP/NET drives diff --git a/Source/Apps/FAT/fat.com b/Source/Apps/FAT/fat.com new file mode 100644 index 00000000..688faa99 Binary files /dev/null and b/Source/Apps/FAT/fat.com differ diff --git a/Source/Apps/FDU/Build.cmd b/Source/Apps/FDU/Build.cmd index a7b9b9dd..e7bb0742 100644 --- a/Source/Apps/FDU/Build.cmd +++ b/Source/Apps/FDU/Build.cmd @@ -5,9 +5,7 @@ set TOOLS=../../../Tools set PATH=%TOOLS%\tasm32;%PATH% set TASMTABS=%TOOLS%\tasm32 -tasm -t80 -b -fFF FDU.asm FDU.com FDU.lst +tasm -t80 -b -fFF fdu.asm fdu.com fdu.lst || exit /b -if errorlevel 1 goto :eof - -copy /Y FDU.com ..\..\..\Binary\Apps\ -copy /Y FDU.txt ..\..\..\Doc\ \ No newline at end of file +copy /Y fdu.com ..\..\..\Binary\Apps\ || exit /b +copy /Y fdu.doc ..\..\..\Binary\Apps\ || exit /b diff --git a/Source/Apps/FDU/FDU.asm b/Source/Apps/FDU/FDU.asm deleted file mode 100644 index da176f06..00000000 --- a/Source/Apps/FDU/FDU.asm +++ /dev/null @@ -1,4613 +0,0 @@ -;=============================================================================== -; FDU - FLOPPY DISK UTILITY PROGRAM FOR RETROBREW COMPUTERS -;=============================================================================== -; -; AUTHOR: WAYNE WARTHEN (DERIVED FROM FDCMON BY ANDREW LYNCH & DAN WERNER) -;_______________________________________________________________________________ -; -; CHANGELOG: -; 2011-08-05: v1.0 INITIAL RELEASE -; 2011-08-25: v1.1 SUPPORT ZETA -; SUPPORT INT/WAIT -; 2011-08-28: v1.2 FIX ZETA RESET LOGIC (from Sergey) -; FIX ZETA MOTOR DISPLAY (from Sergey) -; NEW ZETA DISK CHANGE DISPLAY -; 2011-09-01: V1.3 ADDED CONFIGURABLE CPU FREQUENCY FOR DELAYS -; 2011-09-05: V1.4 USE CPU FREQUENCY FOR POLLING TIMEOUT -; 2011-09-19: V1.5 IMPROVED USE OF FDC RESET ON ZETA -; ADDED FDC RESET TO FDC CONTROL MENU -; 2011-09-24: V1.5a MINOR CORRECTION TO POLLING ROUTINE TO AVOID OVERRUN -; 2011-10-07: V2.0 PRELIMINARY SUPPORT FOR DUAL IDE -; 2011-10-13: V2.1 PRELIMINARY SUPPORT FOR N8 -; 2011-10-20: V2.2 INCLUDE BUSY & NDMA BITS IN RESULTS BYTE READY CHECKING -; 2011-10-22: V2.3 ADDED VERIFY FUNCTION -; 2011-11-25: V2.4 ADDED SUPPORT FOR DISKIO V3 -; 2012-01-09: V2.5 WARM START CP/M AT TERMINATION TO LOGOUT ALL DRIVES -; 2012-01-09: V2.6 EXPERIMENTAL SUPPORT FOR 5 1/4" DRIVES -; 2012-04-05: V2.7 SUPPORT FOR 8" DRIVES -; 2012-04-06: V2.7a FIXED MEDIA SELECTION MENU (DUPLICATE ENTRIES) -; 2012-04-08: V2.7b HANDLE DENSITY SELECT PROPERLY -; 2012-05-22: V2.8 ADDED NEW MEDIA DEFINITIONS (5.25", 320K) -; 2012-06-01: V2.9 ADDED INTERLEAVE CAPABILITY IN FORMAT COMMAND -; 2012-06-05: V3.0 DOCUMENTATION CLEANUP -; 2012-07-01: V3.1 MODIFY HLT FOR 8" MEDIA (50ms PER YD-180 SPEC) -; 2013-06-17: V3.2 CLEANED UP THE SRT, HLT, AND HUT VALUES -; 2015-02-10: V3.3 ADDED ZETA SBC V2 SUPPORT (SERGEY KISELEV) -; 2015-03-25: V4.0 RENAMED APP FDTST --> FD -; 2017-09-02: V5.0 RENAMED APP TO FDU (FLOPPY DISK UTILITY) -; DYNAMIC FDC SELECTION AT STARTUP -; DYNAMIC CPU SPEED ADJUSTMENT -; 2017-12-16: V5.1 IMPROVED POLLING READ/WRITE PERFORMANCE -; 2018-01-08: V5.2 ADDED RC2014 SUPPORT FOR: -; - SCOTT BAKER (SMB) SMC 9266 FDC -; - SCOTT BAKER (SMB) WDC 37C65 FDC -; 2018-09-05: v5.3 ADDED SUPPORT FOR SMALLZ80 -; - USE EOT=R TO END R/W AFTER ONE SECTOR INSTEAD -; OF USING PULSE TC -; 2020-01-05: V5.4 ADDED SUPPORT FOR DYNO FDC -; -;_______________________________________________________________________________ -; -; BUILDING: -; CAN BE BUILT WITH TASM LIKE THIS: -; TASM -t80 -b -fFF FDU.ASM FDU.COM FDU.LST -; -; TODO: -; 1) CURRENT TRACK IS UPDATED EVEN IF SEEK FAILS! (DEFER, RECOVERS AUTOMATICALLY) -; 2) CLEAN UP UTILITY ROUTINES (DEFER, NOT IMPORTANT) -; 3) TIGHTEN UP THE TIMING LOOPS (DEFER, LOW PRIORITY, WORKING FINE AS IS) -; 4) MOVE STX EVALUATION TO DIO LEVEL? (NOT SURE..., LOW PRIORITY) -; 5) ALLOW TO ABORT AT PROMPTS -; 6) ALLOW TO ABORT OPERATION IN PROGRESS -; 7) MOVE CONTINUE PROMPT TO A SEPARATE ROUTINE -; -;_______________________________________________________________________________ -; -; -FALSE .EQU 0 -TRUE .EQU ~FALSE -; -; FDC ID -; -FDC_DIO .EQU 0 -FDC_DIO3 .EQU 1 -FDC_ZETA .EQU 2 -FDC_ZETA2 .EQU 3 -FDC_DIDE .EQU 4 -FDC_N8 .EQU 5 -FDC_RCSMC .EQU 6 -FDC_RCWDC .EQU 7 -FDC_SMZ80 .EQU 8 -FDC_DYNO .EQU 9 -; -; FDC MODE -; -_DIO .EQU $01 ; CUSTOM FOR DIO BOARD -_DIO3 .EQU $02 ; CUSTOM FOR DIO3 BOARD -_ZETA .EQU $04 ; CUSTOM FOR ZETA -_RCSMC .EQU $08 ; CUSTOM FOR RC2014 SMB SMC MODULE -_PCAT .EQU $10 ; PC/AT MODE IN NEWER CONTROLLERS -; -;=============================================================================== -; MAIN PROGRAM PROCEDURE -;=============================================================================== -; - .ORG 00100H - - ; SAVE PREVIOUS STACK POINTER, AND SWITCH TO OUR STACK - LD (STACKSAV),SP - LD SP,STACK - - ; GENERAL INITIALIZATION (BIOS & SPEED DETECTION) - CALL INIT - JR NZ,EXIT - - ; SELECT FD CONTROLLER - CALL NEWLINE - CALL FDCSEL - JR NZ,EXIT - - ; SETUP FOR DEFAULT MEDIA AND RUN THE MAIN MENU - CALL DIO_SETMEDIA - LD HL,MM_INFO - CALL RUNMENU - -EXIT: - LD C,00H ; CP/M SYSTEM RESET (WARM START) - CALL 0005H ; RETURN TO CP/M - - ; CLEAN UP AND RETURN TO OS - CALL NEWLINE - LD SP,(STACKSAV) - RET - - HALT ; SHOULD NEVER GET HERE - -; -;=============================================================================== -; FD CONTROLLER SELECTION -;=============================================================================== -; -INIT: - ; DISPLAY PROGRAM STARTUP BANNER - CALL NEWLINE - LD DE,STR_BANNER - CALL WRITESTR - - ; UNA UBIOS DETECTION... - LD A,($FFFD) ; FIXED LOCATION OF UNA API VECTOR - CP $C3 ; JP INSTRUCTION? - JR NZ,INIT1 ; IF NOT, NOT UNA - LD HL,($FFFE) ; GET JP ADDRESS - LD A,(HL) ; GET BYTE AT TARGET ADDRESS - CP $FD ; FIRST BYTE OF UNA PUSH IX INSTRUCTION - JR NZ,INIT1 ; IF NOT, NOT UNA - INC HL ; POINT TO NEXT BYTE - LD A,(HL) ; GET NEXT BYTE - CP $E5 ; SECOND BYTE OF UNA PUSH IX INSTRUCTION - JR NZ,INIT1 ; IF NOT, NOT UNA - LD DE,STR_UBIOS ; POINT TO UBIOS TAG - CALL WRITESTR ; AND DISPLAY IT - - ; GET CPU SPEED FROM UBIOS - LD C,0F8H ; UNA BIOS GET PHI FUNCTION - RST 08 ; RETURNS SPEED IN HZ IN DE:HL - LD B,4 ; DIVIDE MHZ IN DE:HL BY 100000H -INIT0: - SRL D ; ... TO GET APPROX CPU SPEED IN - RR E ; ...MHZ. THROW AWAY HL, AND - DJNZ INIT0 ; ...RIGHT SHIFT DE BY 4. - INC E ; FIX UP FOR VALUE TRUNCATION - LD A,E ; PUT IN A - LD (CPUSPD),A ; SAVE IT - JR INIT3 ; AND DONE - -INIT1: - ; ROMWBW HBIOS DETECTION - LD HL,(0FFFEH) ; HL := ADR OR ROMWBW HBIOS IDENT - LD A,(HL) ; GET FIRST BYTE OF ROMWBW MARKER - CP 'W' ; MATCH? - JP NZ,INIT2 ; ABORT WITH INVALID CONFIG BLOCK - INC HL ; NEXT BYTE (MARKER BYTE 2) - LD A,(HL) ; LOAD IT - CP ~'W' ; MATCH? - JP NZ,INIT2 ; ABORT WITH INVALID CONFIG BLOCK - LD DE,STR_HBIOS ; POINT TO HBIOS TAG - CALL WRITESTR ; AND DISPLAY IT - - ; GET CPU SPEED FROM HBIOS - LD B,0F8H ; HBIOS SYSGET FUNCTION 0XF8 - LD C,0F0H ; CPUINFO SUBFUNCTION 0XF0 - RST 08 ; DO IT, L := CPU SPEED IN MHZ - LD A,L ; MOVE IT TO A - LD (CPUSPD),A ; SAVE IT - JR INIT3 ; AND DONE - -INIT2: - ;; NO KNOWN BIOS DETECTED, BAIL OUT W/ ERROR - ;LD DE,STR_BIOERR - ;CALL WRITESTR - ;OR 0FFH - ;RET - LD A,20 - LD (CPUSPD),A - -INIT3: - ; COMPUTE CPU SCALER FOR DELAY LOOPS - LD A,(CPUSPD) - CP 3 ; TEST FOR <= 2 (SPECIAL HANDLING) - JR C,INIT4 ; IF <= 2, SPECIAL PROCESSING - SUB 2 ; ADJUST AS REQUIRED BY DELAY FUNCTIONS - JR INIT5 ; AND CONTINUE -INIT4: - LD A,1 ; USE THE MIN VALUE OF 1 -INIT5: - LD (CPUSCL),A ; UPDATE CPU SCALER VALUE - - ; REMAINDER OF BANNER - CALL NEWLINE - LD DE,STR_BANNER2 - CALL WRITESTR - - ; INITIALIZATION DONE - XOR A - RET - -STR_BANNER .DB "Floppy Disk Utility (FDU) v5.4, 05-jAN-2020$" -STR_BANNER2 .DB "Copyright (C) 2020, Wayne Warthen, GNU GPL v3","$" -STR_HBIOS .DB " [HBIOS]$" -STR_UBIOS .DB " [UBIOS]$" -; -STR_BIOERR .DB "\r\n\r\n*** Unknown BIOS ***\r\n$" -; -CPUSPD .DB 20 ; DEFAULT TO SAFE (HIGH) VALUE -CPUSCL .DB 0 ; CPU SPEED DELAY SCALER (COMPUTED) - -; -;=============================================================================== -; FD CONTROLLER SELECTION -;=============================================================================== -; -FDCSEL: - ; PROMPT - LD DE,FSS_MENU - CALL WRITESTR -; -FDCSEL1: - CALL GETKEYUC - CP 'X' ; EXIT? - JR NZ,FDCSEL2 ; IF NOT, CONTINUE - OR 0FFH ; ELSE SET NZ FOR EXIT REQUEST - RET ; AND RETURN -; -FDCSEL2: - SUB 'A' ; ASCII -> BINARY - CP FDCCNT ; TOO HIGH? - JR NC,FDCSEL1 ; IF SO, TRY AGAIN -; - ; SAVE SELECTED FDC IDENTIFIER - LD (FDCID),A ; RECORD THE FDC ID - RLCA ; TIMES 4 - RLCA ; ... FOR 4 BYTE ENTRIES - LD HL,FDCTBL ; POINT TO FDC INSTANCE TABLE - CALL ADDHLA ; OFFSET TO DESRIED ENTRY, A TRASHED - LD E,(HL) ; LOAD LABEL PTR INTO DE - INC HL ; ... - LD D,(HL) ; ... - LD (FDCLBL),DE ; SAVE LABEL PTR - INC HL ; BUMP TO CFG POINTER - LD E,(HL) ; LOAD CFG PTR INTO DE - INC HL ; ... - LD D,(HL) ; ... - LD (FDCCFG),DE ; SAVE CFG PTR - LD IY,(FDCCFG) ; AND INIT A WORKING COPY - LD A,(IY+CFG_MODE) ; GET MODE BITMAP BYTE - LD (FDCBM),A ; SAVE IT TO ACTIVE WORKING COPY -; - LD DE,(FDCLBL) ; GET LABEL POINTER - CALL WRITESTR ; AND DISPLAY IT -; - XOR A ; SIGNAL SUCCESS - RET ; DONE -; -; TABLE OF FDC CONTROLLERS -; -FDCTBL: ; LABEL CONFIG DATA - ; ----- ----------- - .DW STR_DIO, CFG_DIO - .DW STR_DIO3, CFG_DIO3 - .DW STR_ZETA, CFG_ZETA - .DW STR_ZETA2, CFG_ZETA2 - .DW STR_DIDE, CFG_DIDE - .DW STR_N8, CFG_N8 - .DW STR_RCSMC, CFG_RCSMC - .DW STR_RCWDC, CFG_RCWDC - .DW STR_SMZ80, CFG_SMZ80 - .DW STR_DYNO, CFG_DYNO -FDCCNT .EQU ($-FDCTBL)/4 ; FD CONTROLLER COUNT -; -; FDC LABEL STRINGS -; -STR_DIO .TEXT "DISKIO$" -STR_DIO3 .TEXT "DISKIO3$" -STR_ZETA .TEXT "ZETA$" -STR_ZETA2 .TEXT "ZETA2$" -STR_DIDE .TEXT "D-IDE$" -STR_N8 .TEXT "N8$" -STR_RCSMC .TEXT "RC-SMC$" -STR_RCWDC .TEXT "RC-WDC$" -STR_SMZ80 .TEXT "SMZ80$" -STR_DYNO .TEXT "DYNO$" -; -; FDC CONFIGURATION BLOCKS -; -CFG_MSR .EQU 0 -CFG_DATA .EQU 1 -CFG_DIR .EQU 2 -CFG_DOR .EQU 3 -CFG_DCR .EQU 4 -CFG_DACK .EQU 5 -CFG_TC .EQU 6 -CFG_DMA .EQU 7 -CFG_MODE .EQU 8 -; -CFG_DIO: - .DB 036H ; FDC MAIN STATUS REGISTER - .DB 037H ; FDC DATA PORT - .DB 038H ; DATA INPUT REGISTER - .DB 03AH ; DIGITAL OUTPUT REGISTER (LATCH) - .DB 0FFH ; DCR - .DB 0FFH ; DACK - .DB 0FFH ; TERMINAL COUNT (W/ DACK) - .DB 03CH ; PSEUDO DMA DATA PORT - .DB _DIO ; MODE= -CFG_DIO3: - .DB 036H ; FDC MAIN STATUS REGISTER - .DB 037H ; FDC DATA PORT - .DB 038H ; DATA INPUT REGISTER - .DB 03AH ; DIGITAL OUTPUT REGISTER (LATCH) - .DB 0FFH ; DCR - .DB 0FFH ; DACK - .DB 0FFH ; TERMINAL COUNT (W/ DACK) - .DB 03CH ; PSEUDO DMA DATA PORT - .DB _DIO3 ; MODE= -CFG_ZETA: - .DB 036H ; FDC MAIN STATUS REGISTER - .DB 037H ; FDC DATA PORT - .DB 038H ; DATA INPUT REGISTER - .DB 03AH ; DIGITAL OUTPUT REGISTER (LATCH) - .DB 0FFH ; DCR - .DB 0FFH ; DACK - .DB 0FFH ; TERMINAL COUNT (W/ DACK) - .DB 03CH ; PSEUDO DMA DATA PORT - .DB _ZETA ; MODE= -; -CFG_ZETA2: - .DB 030H ; FDC MAIN STATUS REGISTER - .DB 031H ; FDC DATA PORT - .DB 0FFH ; DATA INPUT REGISTER - .DB 038H ; DIGITAL OUTPUT REGISTER - .DB 028H ; CONFIGURATION CONTROL REGISTER - .DB 0FFH ; DACK - .DB 038H ; TERMINAL COUNT (W/ DACK) - .DB 0FFH ; NOT USED BY ZETA SBC V2 - .DB _PCAT ; MODE= -; -CFG_DIDE: - .DB 02AH ; FDC MAIN STATUS REGISTER - .DB 02BH ; FDC DATA PORT - .DB 0FFH ; DATA INPUT REGISTER - .DB 02CH ; DOR - .DB 02DH ; DCR - .DB 03CH ; DACK - .DB 03DH ; TERMINAL COUNT (W/ DACK) - .DB 0FFH ; NOT USED BY DIDE - .DB _PCAT ; MODE= -; -CFG_N8: - .DB 08CH ; FDC MAIN STATUS REGISTER - .DB 08DH ; FDC DATA PORT - .DB 0FFH ; DATA INPUT REGISTER - .DB 092H ; DOR - .DB 091H ; DCR - .DB 090H ; DACK - .DB 093H ; TERMINAL COUNT (W/ DACK) - .DB 0FFH ; NOT USED BY N8 - .DB _PCAT ; MODE= -; -CFG_RCSMC: - .DB 050H ; FDC MAIN STATUS REGISTER - .DB 051H ; FDC DATA PORT - .DB 0FFH ; DATA INPUT REGISTER - .DB 058H ; DIGITAL OUTPUT REGISTER (LATCH) - .DB 0FFH ; DCR - .DB 0FFH ; DACK - .DB 0FFH ; TERMINAL COUNT (W/ DACK) - .DB 0FFH ; PSEUDO DMA DATA PORT - .DB _RCSMC ; MODE= -; -CFG_RCWDC: - .DB 050H ; FDC MAIN STATUS REGISTER - .DB 051H ; FDC DATA PORT - .DB 0FFH ; DATA INPUT REGISTER - .DB 058H ; DIGITAL OUTPUT REGISTER (LATCH) - .DB 048H ; DCR - .DB 0FFH ; DACK - .DB 058H ; TERMINAL COUNT (W/ DACK) - .DB 0FFH ; PSEUDO DMA DATA PORT - .DB _PCAT ; MODE= -; -CFG_SMZ80: - .DB 044H ; FDC MAIN STATUS REGISTER - .DB 045H ; FDC DATA PORT - .DB 0FFH ; DATA INPUT REGISTER - .DB 042H ; DIGITAL OUTPUT REGISTER (LATCH) - .DB 047H ; DCR - .DB 0FFH ; DACK - .DB 0FFH ; TERMINAL COUNT (W/ DACK) - .DB 0FFH ; PSEUDO DMA DATA PORT - .DB _PCAT ; MODE= -; -CFG_DYNO: - .DB 084H ; FDC MAIN STATUS REGISTER - .DB 085H ; FDC DATA PORT - .DB 0FFH ; DATA INPUT REGISTER - .DB 086H ; DIGITAL OUTPUT REGISTER (LATCH) - .DB 087H ; DCR - .DB 0FFH ; DACK - .DB 086H ; TERMINAL COUNT (W/ DACK) - .DB 0FFH ; PSEUDO DMA DATA PORT - .DB _PCAT ; MODE= -; -FDCID .DB 0 ; FDC IDENTIFIER (0 INDEXED) -FDCBM .DB 0 ; FDC ID BITMAP -FDCLBL .DW 0 ; POINTER TO ACTIVE FDC LABEL STRING -FDCCFG .DW 0 ; POINTER TO ACTIVE CFG DATA -; -FSS_MENU: - .TEXT "\r\n" - .TEXT "SELECT FLOPPY DISK CONTROLLER:\r\n" - .TEXT " (A) Disk IO ECB Board\r\n" - .TEXT " (B) Disk IO 3 ECB Board\r\n" - .TEXT " (C) Zeta SBC Onboard FDC\r\n" - .TEXT " (D) Zeta 2 SBC Onboard FDC\r\n" - .TEXT " (E) Dual IDE ECB Board\r\n" - .TEXT " (F) N8 Onboard FDC\r\n" - .TEXT " (G) RC2014 SMC (SMB)\r\n" - .TEXT " (H) RC2014 WDC (SMB)\r\n" - .TEXT " (I) SmallZ80 Expansion\r\n" - .TEXT " (J) Dyno-Card FDC, D1030\r\n" - .TEXT " (X) Exit\r\n" - .TEXT "=== OPTION ===> $\r\n" -; -;=============================================================================== -; MAIN MENU -;=============================================================================== -; -; MAIN MENU DATA -; -MM_TABLE .DB 'S' \ .DW MMS_SETUP, MM_SETUP -MM_ENTSIZ .EQU $ - MM_TABLE - .DB 'R' \ .DW MMS_READ, MM_READ - .DB 'W' \ .DW MMS_WRITE, MM_WRITE - .DB 'F' \ .DW MMS_FORMAT, MM_FORMAT - .DB 'V' \ .DW MMS_VERIFY, MM_VERIFY - .DB 'I' \ .DW MMS_INITBUF, MM_INITBUF - .DB 'D' \ .DW MMS_DUMPBUF, MM_DUMPBUF - .DB 'C' \ .DW MMS_FDCMENU, MM_FDCMENU - .DB 'X' \ .DW MMS_EXIT, 0000H -MM_COUNT .EQU (($ - MM_TABLE) / MM_ENTSIZ) ; # ENTRIES IN TABLE -MM_INFO: .DW MM_DRAW - .DW MM_TABLE - .DB MM_ENTSIZ - .DB MM_COUNT -; -; MAIN MENU DISPLAY STRINGS -; -STR_MAINMENU: - .TEXT "=======================<< FDU MAIN MENU >>======================\r\n" -; .TEXT "(S)ETUP: UNIT=XX MEDIA=XXXXXX MODE=XXXXXXXXXX TRACE=XX\r\n" - .TEXT "(S)ETUP: UNIT=" -MV_UNIT .TEXT "XX" - .TEXT " MEDIA=" -MV_MED .TEXT "XXXXXX" - .TEXT " MODE=" -MV_MODE .TEXT "XXXXXXXXXX" - .TEXT " TRACE=" -MV_TRC .TEXT "XX" - .TEXT "\r\n" - .TEXT "----------------------------------------------------------------\r\n" - .TEXT "(R)EAD (W)RITE (F)ORMAT (V)ERIFY\r\n" - .TEXT "(I)NIT BUFFER (D)UMP BUFFER FDC (C)MDS E(X)IT\r\n" - .TEXT "=== OPTION ===> $\r\n" -; -MMS_SETUP: .TEXT "SETUP$" -MMS_READ: .TEXT "READ$" -MMS_WRITE: .TEXT "WRITE$" -MMS_FORMAT: .TEXT "FORMAT$" -MMS_VERIFY: .TEXT "VERIFY$" -MMS_INITBUF: .TEXT "INITIALIZE BUFFER$" -MMS_DUMPBUF: .TEXT "DUMP BUFFER$" -MMS_FDCMENU: .TEXT "FDC MENU$" -MMS_EXIT: .TEXT "EXIT$" -; -; MAIN MENU DRAW PROCEDURE -; -MM_DRAW: - CALL NEWLINE - CALL NEWLINE - - ; UPDATE FDC LABEL - LD DE,STR_MAINMENU + 5 - LD A,' ' - LD (DE),A - INC DE - LD HL,(FDCLBL) - CALL COPYSTR - LD A,' ' - LD (DE),A - - ; UPDATE UNIT - LD DE,MV_UNIT - LD A,(DCD_UNIT) - CALL HEXSTRBYTE - - ; UPDATE MEDIA - LD DE,(MDB_LABEL) - LD HL,MV_MED - CALL STRCPY - - ; UPDATE MODE - LD A,(DCD_MD) - RLA - LD E,A - LD D,0 - LD HL,MDT - ADD HL,DE - LD E,(HL) - INC HL - LD D,(HL) - EX DE,HL - LD E,(HL) - INC HL - LD D,(HL) - LD HL,MV_MODE - CALL STRCPY - - ; UPDATE TRACE - LD DE,MV_TRC - LD A,(DCD_TRACE) - CALL HEXSTRBYTE - - ; DISPLAY THE MENU - LD DE,STR_MAINMENU - CALL WRITESTR - - RET -; -; MAIN MENU FUNCTIONS -; -MM_SETUP: - CALL MM_GETSETUP - CALL DIO_SETMEDIA - RET - -MM_READ: - LD A,DOP_READ - LD (DCD_DOP),A - CALL MM_GETTGT - CALL MM_GETTGTPARMS - CALL MMOP_PROC - RET - -MM_WRITE: - LD A,DOP_WRITE - LD (DCD_DOP),A - CALL MM_GETTGT - CALL MM_GETTGTPARMS - CALL MMOP_PROC - RET - -MM_FORMAT: - LD A,DOP_FORMAT - LD (DCD_DOP),A - CALL MM_GETTGT - CALL MM_GETTGTPARMS - CALL MM_GETINTRLV - CALL MMOP_PROC - RET - -MM_VERIFY: - LD A,DOP_VERIFY - LD (DCD_DOP),A - CALL MM_GETTGT - CALL MM_GETTGTPARMS - CALL MM_SETVFYBUF - CALL MMOP_PROC - RET - -MM_INITBUF: - CALL PC_SPACE - LD DE,MMPS_IBOPT - CALL WRITESTR -MM_IBKEY: - CALL GETKEYUC - CP 'P' ; PATTERN - JP Z,MM_IBPAT - CP 'F' ; FILL - JP Z,MM_IBFILL - JP MM_IBKEY -MM_IBPAT: - LD DE,MMBS_PATTERN - CALL PC_SPACE - CALL WRITESTR - CALL MM_GETPATTERN - LD HL,BUFFER - LD DE,BUFSIZ - LD A,(DCD_PATTERN) - LD B,A - CALL PAT_BUFFER - RET -MM_IBFILL: - LD DE,MMBS_FILL - CALL WRITESTR - CALL PC_SPACE - CALL MM_GETFILL - LD HL,BUFFER - LD DE,BUFSIZ - LD A,(DCD_FILL) - LD B,A - CALL FILL_BUFFER - RET - -MM_DUMPBUF: - LD HL,BUFFER ; SET ADDRESS TO DUMP - LD DE,BUFFER ; SET END ADDRESS - INC D ; - INC D ; - CALL DUMP_BUFFER ; DUMP BUFFER TO CONSOLE - RET - -MM_FDCMENU: - CALL DIO_INIT - CALL FDCMENU - CALL DIO_TERM - RET -; -; MAIN MENU SUPPORT FUNCTIONS -; -MM_GETSETUP: - LD DE,MMP_UNIT - LD HL,DCD_UNIT - LD BC,0003H - CALL GETHEXBYTERNG - - CALL MM_MEDIALIST - LD DE,MMP_MEDIA - LD HL,DCD_MT - LD B,0 - LD A,MIT_ENTCNT - DEC A - LD C,A - CALL GETHEXBYTERNG - -MM_GETMODE: - CALL MM_MODELIST - LD DE,MMP_MODE - LD HL,DCD_MD - LD B,0 - LD A,MDT_ENTCNT - DEC A - LD C,A - CALL GETHEXBYTERNG - - ; VALIDATE MODE AGAINST CURRENT FDC - INC A ; PREP VALUE FOR LOOP - LD B,A ; PUT IN LOOP COUNTER - XOR A ; CLEAR A - SCF ; SET CF -MM_GETMODE1: - RLA ; ROTATE BIT ONE POSITION - DJNZ MM_GETMODE1 ; UNTIL BIT SET FOR MODE SPECIFIED - PUSH AF ; SAVE IT - LD A,(FDCID) ; A := FDC ID - LD HL,MD_MAP ; HL := START OF MODE MAP - CALL ADDHLA ; OFFSET TO CORRECT ENTRY FOR FDC - POP AF ; RECOVER MODE BIT VALUE - AND (HL) ; MASK WITH MODE MAP OF FDC - JR NZ,MM_TRACE ; NON-ZERO IS A MODE MATCH FOR FDC, CONTINUE - LD DE,MM_MODEERR ; INVALID MODE FOR FDC ERROR MESSAGE - CALL WRITESTR - JR MM_GETMODE - -MM_TRACE: - LD DE,MMP_TRACE - LD HL,DCD_TRACE - LD BC,0001H - CALL GETHEXBYTERNG - - RET - -MM_GETFILL: - LD DE,MMP_FILL - LD HL,DCD_FILL - CALL GETHEXBYTE - RET - -MM_GETPATTERN: - LD DE,MMP_PATTERN - LD HL,DCD_PATTERN - CALL GETHEXBYTE - RET - -MM_GETTGT: - CALL PC_SPACE - LD A,(DCD_DOP) - LD DE,MMPS_TGTF - CP DOP_FORMAT - JP Z,MM_GETTGT0 - LD DE,MMPS_TGTRW -MM_GETTGT0: - CALL WRITESTR -MM_GETTGT1: - CALL GETKEYUC - - LD B,MMT_TRACK - LD DE,MMTS_TRACK - CP 'T' - JP Z,MM_GETTGT3 - LD B,MMT_DISK - LD DE,MMTS_DISK - CP 'D' - JP Z,MM_GETTGT3 - ; FORMAT CANNOT DO THE NEXT ONES (GETTGT2 CHECKS FOR THIS) - LD B,MMT_SECTOR - LD DE,MMTS_SECTOR - CP 'S' - JP Z,MM_GETTGT2 - LD B,MMT_RANDOM - LD DE,MMTS_RANDOM - CP 'R' - JP Z,MM_GETTGT2 - JP MM_GETTGT1 -MM_GETTGT2: ; PREVENT FORMAT FROM USING SECTOR OR RANDOM FUNCTIONS - LD A,(DCD_DOP) - CP DOP_FORMAT - JP Z,MM_GETTGT1 -MM_GETTGT3: - LD A,B - LD (MMD_TGT),A - CALL WRITESTR - RET - -MM_GETTGTPARMS: - LD A,(MMD_TGT) - CP MMT_DISK - JP Z,MM_GETTGTPARMS1 - CP MMT_RANDOM - JP Z,MM_GETTGTPARMS1 - CALL MM_GETTRACK - CALL MM_GETHEAD - LD A,(MMD_TGT) - CP MMT_TRACK - JP Z,MM_GETTGTPARMS1 - CALL MM_GETSECTOR - JP MM_GETTGTPARMSX -MM_GETTGTPARMS1: - LD A,1 ; FIX UP THE SECTOR VALUE TO BE 1 IF NOT SINGLE SECTOR MODE - LD (DCD_SECTOR),A -MM_GETTGTPARMSX: - RET - -MM_GETTRACK: - LD DE,MMP_TRACK - LD HL,DCD_TRACK - LD B,0 - LD A,(MDB_NUMCYL) - DEC A - LD C,A - CALL GETHEXBYTERNG - RET - -MM_GETHEAD: - LD DE,MMP_HEAD - LD HL,DCD_HEAD - LD B,0 - LD A,(MDB_NUMHD) - DEC A - LD C,A - CALL GETHEXBYTERNG - RET - -MM_GETSECTOR: - LD DE,MMP_SECTOR - LD HL,DCD_SECTOR - LD A,(MDB_SOT) - LD B,A - LD A,(MDB_EOT) - LD C,A - CALL GETHEXBYTERNG - RET - -MM_GETINTRLV: - LD DE,MMP_INTRLV - LD HL,DCD_INTRLV - LD B,1 - LD A,(MDB_NUMSEC) - LD C,A - CALL GETHEXBYTERNG - RET - -MM_MEDIALIST: - LD HL,MIT - LD B,MIT_ENTCNT - LD C,0 -MM_MEDIALISTLOOP: - CALL NEWLINE - LD A,C - CALL PRTHEXBYTE - CALL PC_COLON - CALL PC_SPACE - PUSH HL - - LD A,(HL) ; HL = ENTRY VALUE - INC HL ; " - LD H,(HL) ; " - LD L,A ; " - - INC HL - INC HL - - LD A,(HL) ; HL = ENTRY VALUE - INC HL ; " - LD D,(HL) ; " - LD E,A ; " - - CALL WRITESTR - - POP HL - INC HL - INC HL - INC C - DJNZ MM_MEDIALISTLOOP - RET - -MM_MODELIST: - LD HL,MDT - LD B,MDT_ENTCNT - LD C,0 -MM_MODELISTLOOP: - CALL NEWLINE - LD A,C - CALL PRTHEXBYTE - CALL PC_COLON - CALL PC_SPACE - PUSH HL - - LD A,(HL) ; HL = ENTRY VALUE - INC HL ; " - LD H,(HL) ; " - LD L,A ; " - - INC HL - INC HL - - LD A,(HL) ; HL = ENTRY VALUE - INC HL ; " - LD D,(HL) ; " - LD E,A ; " - - CALL WRITESTR - - POP HL - INC HL - INC HL - INC C - DJNZ MM_MODELISTLOOP - RET - -MM_SETVFYBUF: - LD HL,BUFFER - LD DE,VFYBUF - LD BC,BUFSIZ - LDIR - RET -; -; MAIN MENU PROMPTS -; -MMP_FILL .TEXT "FILL VALUE$" -MMP_PATTERN .TEXT "PATTERN START VALUE$" -MMP_UNIT .TEXT "UNIT$" -MMP_TRACE .TEXT "TRACE LEVEL$" -MMP_TRACK .TEXT "TRACK$" -MMP_HEAD .TEXT "HEAD$" -MMP_SECTOR .TEXT "SECTOR$" -MMP_MEDIA .TEXT "MEDIA$" -MMP_MODE .TEXT "MODE$" -MMP_INTRLV .TEXT "INTERLEAVE$" -; -; MAIN MENU TARGET -; -MMT_SECTOR .EQU 'S' ; PERFORM OPERATION ON ONE SECTOR -MMT_TRACK .EQU 'T' ; PERFORM OPERATION ON ONE TRACK -MMT_DISK .EQU 'D' ; PERFORM OPERATION ON ENTIRE DISK -MMT_RANDOM .EQU 'R' ; PERFORM OPERATION ON RANDOM SECTORS -; -; MAIN MENU TARGET STRINGS -; -MMTS_SECTOR .TEXT "SECTOR$" -MMTS_TRACK .TEXT "TRACK$" -MMTS_DISK .TEXT "DISK$" -MMTS_RANDOM .TEXT "RANDOM$" -; -; MAIN MENU DATA -; -MMD_TGT .DB MMT_SECTOR -; -; MAIN MENU PROMPT STRINGS -; -MMPS_TGTRW .TEXT "(S)ECTOR, (T)RACK, (D)ISK, (R)ANDOM ===> $" -MMPS_TGTF .TEXT "(T)RACK, (D)ISK ===> $" -MMPS_IBOPT .TEXT "(P)ATTERN, (F)ILL ===> $" -; -; MAIN MENU BUFFER OPTIONS -; -MMBS_PATTERN .TEXT "PATTERN$" -MMBS_FILL .TEXT "FILL$" -; -; -; -MM_MODEERR .TEXT "\r\n\r\n*** SELECTED MODE NOT SUPPORTED ON HARDWARE ***\r\n$" -; -;________________________________________________________________________________________________________________________________ -; -; MAIN MENU OPERATIONS -;________________________________________________________________________________________________________________________________ -; -MMOP_PROC: - CALL NEWLINE - CALL NEWLINE - - LD A,FALSE - LD (DCD_ABORT),A - - CALL DIO_INIT - - LD A,(MMD_TGT) - CP MMT_DISK - JP Z,MMOP_PROCDISK - CP MMT_TRACK - JP Z,MMOP_PROCTRK - CP MMT_SECTOR - JP Z,MMOP_PROCSEC - CP MMT_RANDOM - JP Z,MMOP_PROCRND - - JP MMOP_PROCX - -MMOP_PROCDISK: - CALL MMOP_DISK - JP MMOP_PROCX - -MMOP_PROCTRK: - CALL MMOP_TRACK - JP MMOP_PROCX - -MMOP_PROCSEC: - CALL MMOP_SECTOR - JP MMOP_PROCX - -MMOP_PROCRND: - CALL MMOP_RANDOM - JP MMOP_PROCX - -MMOP_PROCX: - CALL DIO_TERM - RET - -MMOP_DISK: - LD A,0 - LD (DCD_TRACK),A - LD (DCD_HEAD),A -MMOP_DISK1: - LD A,(DCD_ABORT) - CP TRUE - JP Z,MMOP_DISKX - - CALL MMOP_TRACK - - LD A,(MDB_NUMHD) - LD C,A - LD A,(DCD_HEAD) ; INC HEAD - INC A - LD (DCD_HEAD),A - CP C ; # OF HEADS - JP NZ,MMOP_DISK1 ; LOOP IF LESS THAN # OF HEADS - LD A,0 ; RESET HEAD - LD (DCD_HEAD),A ; AND FALL THROUGH TO INC TRACK - - LD A,(MDB_NUMCYL) - LD C,A - LD A,(DCD_TRACK) ; INC TRACK - INC A - LD (DCD_TRACK),A - CP C ; # OF TRACKS - JP NZ,MMOP_DISK1 -MMOP_DISKX: - LD A,0 ; RESET TRACK TO A VALID VALUE - LD (DCD_TRACK),A - RET - -MMOP_TRACK: - LD A,(DCD_DOP) ; SPECIAL CASE, FORMAT IS TRACK-AT-A-TIME - CP DOP_FORMAT - JP Z,MMOP_TRACKFMT - - LD A,(MDB_SOT) - LD (DCD_SECTOR),A -MMOP_TRACK1: - LD A,(DCD_ABORT) - CP TRUE - JP Z,MMOP_TRACKX - - CALL DIO_RUN - - LD A,(MDB_EOT) - LD C,A - INC C ; ONE MORE THAN EOT - LD A,(DCD_SECTOR) ; INC SECTOR - INC A - LD (DCD_SECTOR),A - CP C ; > MAX SECTOR? - JP NZ,MMOP_TRACK1 - JP MMOP_TRACKX - -MMOP_TRACKFMT: - CALL DIO_RUN - JP MMOP_TRACKX - -MMOP_TRACKX: - LD A,(MDB_SOT) ; RESET SECTOR TO A VALID VALUE - LD (DCD_SECTOR),A - RET - -MMOP_SECTOR: - CALL DIO_RUN - RET - -MMOP_RANDOM: - LD B,20H ; READ 20H SECTORS RANDOMLY - -MMOP_RANDOM0: - LD A,(DCD_ABORT) - CP TRUE - JP Z,MMOP_RANDOMX - - PUSH BC - -MMOP_RANDOM1: ; GENERATE RANDOM TRACK - LD A,(MDB_NUMCYL) - LD C,A - CALL RNDBYTE - AND 7FH ; USE 7 BITS FOR UP TO 128 TRACKS - CP C ; MAX TRACK IS 4F + 1 = 50H - JP P,MMOP_RANDOM1 - LD (DCD_TRACK),A - - ; GENERATE RANDOM HEAD - CALL RNDBYTE - AND 01H ; JUST USE LOW ORDER BIT - LD (DCD_HEAD),A - -MMOP_RANDOM2: ; GENERATE RANDOM SECTOR - LD A,(MDB_EOT) - LD C,A - INC C ; ONE MORE THEN MAX SECTOR - CALL RNDBYTE - AND 1FH ; USE 5 BITS FOR UP TO 32 SECTORS - CP C ; MAX SECTOR NUM IS 9 + 1 = 0AH - JP P,MMOP_RANDOM2 - CP 00H ; SECTOR NUM STARTS AT 1, DON'T ALLOW ZERO - JP Z,MMOP_RANDOM2 - LD (DCD_SECTOR),A - - CALL DIO_RUN - - POP BC - DJNZ MMOP_RANDOM0 - -MMOP_RANDOMX: - RET - -; -;=============================================================================== -; DISK INPUT/OUTPUT SERVICES, DEVICE INDEPENDENT (LOGICAL) ACCESS TO STORAGE -; TRANSLATES BETWEEN LOGICAL AND PHYSICAL DEVICE OPERATIONS -;=============================================================================== -; -; -STR_CONTINUE: - .TEXT "CONTINUE? (A)BORT, (R)ETRY, (I)GNORE ===> $" -; -DIO_SETMEDIA: - ; INITIZLIZE THE MEDIA DESCRIPTION BLOCK - ; FILL IN MDB BASED ON USER SELECTION - LD A,(DCD_MT) ; A = MEDIA ID (OFFSET IN MEDIA INDEX TABLE) - ADD A,A ; * 2 (2 BYTES PER ENTRY) - LD H,0 ; MOVE IT TO HL - LD L,A ; " - LD DE,MIT ; DE = START OF MEDIA INDEX TABLE - ADD HL,DE ; ADD HL TO DE, HL NOW POINTS TO DESIRED ENTRY - LD A,(HL) ; HL = ENTRY VALUE - INC HL ; " - LD H,(HL) ; " - LD L,A ; " - LD DE,MDB ; HL = SOURCE, DE = DESTINATION - LD BC,MDB_LEN ; BC = BYTES TO COPY - LDIR ; COPY ENTRY TO FCD - - LD A,FALSE ; SET DRIVE READY TO FALSE! - LD (DCD_DSKRDY),A ; " - RET -; -DIO_INIT: - ; UPDATE DRIVE SELECTTION - LD A,(FCD_DS) ; GET THE CURRENT DRIVE SELECTION - LD B,A ; SAVE IN B - LD A,(DCD_UNIT) ; GET THE NEW DRIVE SELECTION - CP B ; CHANGED? - ; WE NEED TO SET DRIVE STATUS TO NOT READY IFF IT CHANGED - JP Z,DIO_INIT1 ; DO NOT RESET DRIVE STATUS! - LD (FCD_DS),A ; UPDATE FCD_DS TO NEW VALUE - LD A,FALSE ; SET DRIVE READY TO FALSE! - LD (DCD_DSKRDY),A ; " - -DIO_INIT1: - ; INITIALIZE TRACE SETTING - LD A,(DCD_TRACE) - LD (FCD_TRACE),A - - LD HL,MDB_FCD ; HL = SOURCE - LD DE,FCD ; DE = DESTINATION - LD BC,FCD_LEN ; BC = BYTES TO COPY - LDIR ; BYTES COPY FROM MDB TO FCD - - LD A,0 ; ASSUME DMA (NON-DMA = 0) - LD (FCD_ND),A - LD A,(DCD_MD) - CP MD_DRQWAIT - JP Z,DIO_INIT2 ; YES, DMA NEEDED, DO IT - - LD A,1 ; SET TO NON-DMA (NDMA = 1) - LD (FCD_ND),A - -DIO_INIT2: - CALL FC_INIT - CALL FC_MOTORON - RET - -DIO_TERM: - CALL FC_MOTOROFF - RET -; -; DIO_CLRDSKCHG -; -DIO_CLRDSKCHG: - ; PROCESS ANY PENDING DISK CHANGE NOTIFICATIONS - LD B,5 -DIO_CLRDSKCHG1: - PUSH BC - CALL FC_SENSEINT - POP BC - CALL DIO_CHKFC - CP FRC_DSKCHG - RET NZ - DJNZ DIO_CLRDSKCHG1 - RET -; -; DIO_WTSEEK -; -; WAIT FOR PENDING SEEK OPERATION TO COMPLETE BY POLLING SENSEINT -; AND WAITING FOR ABTERM OR OK. -; -DIO_WTSEEK: - LD BC,1000H -; LD BC,20H ; *DEBUG* -; LD BC,1H ; *DEBUG* -DIO_WTSEEKLOOP: - PUSH BC - CALL FC_SENSEINT - POP BC - - LD A,(FST_RC) ; CHECK RC - CP FRC_ABTERM ; ABTERM = DONE - RET Z - CP FRC_OK ; OK = DONE - RET Z - - DEC BC ; CHECK LOOP COUNTER IN BC - LD A,B ; " - OR C ; " - JP NZ,DIO_WTSEEKLOOP ; LOOP UNTIL COUNTER EXHAUSTED - -DIO_DRIVERESET: - CALL NEWLINE - CALL NEWLINE - LD DE,STR_DRIVERESET - CALL WRITESTR - - CALL FC_RESETFDC - - CALL DIO_CLRDSKCHG - CALL DIO_CHKFC - CP FRC_INVCMD ; INVALID COMMAND IS CORRECT RESPONSE HERE - JP NZ,DIO_NORESP - - ; CONTINUE RESET SEQUENCE WITH 'SPECIFY' COMMAND - CALL FC_SPECIFY - CALL DIO_CHKFC - JP NZ,DIO_NORESP - - CALL FC_RECAL - CALL DIO_CHKFC - JP NZ,DIO_NORESP - - ; CAREFUL... FIRST RECAL MAY FAIL TO REACH TRACK 0 - ; SO WE ALLOW FOR A SECOND TRY IN CASE OF A FAILURE - CALL DIO_WTSEEK - CALL DIO_CHKFC - JP Z,DIO_DRIVERESET1 - - ; SECOND TRY, ONLY IF NEEDED - CALL FC_RECAL - CALL DIO_CHKFC - JP NZ,DIO_NORESP - - CALL DIO_WTSEEK - CALL DIO_CHKFC - JP NZ,DIO_NORESP - JP DIO_DRIVERESET1 - -DIO_NORESP: - CALL NEWLINE - LD DE,STR_NORESP - CALL WRITESTR - RET - -DIO_DRIVERESET1: - LD A,TRUE - LD (DCD_DSKRDY),A - - LD A,0 - LD (DCD_CURTRK),A - - RET - -DIO_CHKFC: - LD A,(FST_RC) - OR A - RET - -DIO_RUN: - LD A,(DCD_DSKRDY) - CP TRUE - JP Z,DIO_RUN0 - - CALL DIO_DRIVERESET - LD A,(DCD_DSKRDY) - CP TRUE - JP NZ,DIO_RUNERR ; DRIVERESET FAILED! - -DIO_RUN0: - CALL DIO_PROGRESS - - ; COPY PARMS OVER - LD A,(DCD_UNIT) - LD (FCD_DS),A - - LD A,(DCD_TRACE) - LD (FCD_TRACE),A - - LD A,(DCD_TRACK) - LD (FCD_C),A - - LD A,(DCD_HEAD) - LD (FCD_H),A - - LD A,(DCD_SECTOR) - LD (FCD_R),A - - LD A,(DCD_INTRLV) - LD (FCD_X),A - - ; FIX: COMBINE WITH DCD_TRACK SETUP ABOVE? - LD A,(DCD_CURTRK) - LD B,A - LD A,(DCD_TRACK) - CP B - JP Z,DIO_RUN1 ; SKIP SEEK IF POSSIBLE - - ; SEEK AND WAIT FOR COMPLETE - CALL FC_SEEK - CALL DIO_CHKFC - JP NZ,DIO_RUNERR - - CALL DIO_WTSEEK - CALL DIO_CHKFC - JP NZ,DIO_RUNERR - - ; RECORD CURRENT TRACK - ; FIX: SHOULD NOT ASSUME SEEK REQUEST SUCCEEDED (FC_READID?) - LD A,(DCD_TRACK) - LD (DCD_CURTRK),A - -DIO_RUN1: - LD A,(DCD_DOP) - - CP DOP_READ - JP Z,DIO_RUNREAD - - CP DOP_WRITE - JP Z,DIO_RUNWRITE - - CP DOP_FORMAT - JP Z,DIO_RUNFORMAT - - CP DOP_VERIFY - JP Z,DIO_RUNVERIFY - - JP DIO_RUNX - -DIO_RUNREAD: - CALL FC_READ - JP DIO_RUNCHK - -DIO_RUNWRITE: - CALL FC_WRITE - JP DIO_RUNCHK - -DIO_RUNFORMAT: - CALL FC_FMTTRK - JP DIO_RUNCHK - -DIO_RUNVERIFY: - CALL FC_READ - JP DIO_RUNCHK - -DIO_RUNCHK: - LD A,(FST_RC) - OR A - CP FRC_OK - JP NZ,DIO_RUNERR ; HANDLE I/O ERROR - LD A,(DCD_DOP) - CP DOP_VERIFY - JP NZ,DIO_RUNX ; NOT VERIFY, ALL DONE - CALL DIO_VERIFY - LD A,(FST_RC) - OR A - CP FRC_OK - JP NZ,DIO_RUNERR ; HANDLE VERIFY ERROR - JP DIO_RUNX - -DIO_RUNERR: - LD A,FALSE - LD (DCD_DSKRDY),A - CALL FC_RESETFDC ; FIX... - CALL NEWLINE - LD DE,STR_CONTINUE ; ABORT/RETRY/IGNORE PROMPT - CALL WRITESTR - -DIO_RUNERR1: - CALL GETKEYUC - - CP 'A' - JP Z,DIO_ABORT - CP 'R' - JP Z,DIO_RETRY - CP 'I' - JP Z,DIO_IGNORE - - JP DIO_RUNERR1 - -DIO_ABORT: - LD DE,DIOCS_ABORT - CALL WRITESTR - LD A,TRUE - LD (DCD_ABORT),A - JP DIO_RUNX - -DIO_RETRY: - LD DE,DIOCS_RETRY - CALL WRITESTR - JP DIO_RUN - -DIO_IGNORE: - LD DE,DIOCS_IGNORE - CALL WRITESTR - JP DIO_RUNX - -DIO_RUNX: - RET - -DIO_PROGRESS: - LD A,(NEWLINE_USED) - OR A - JP Z,DIO_PROGRESS1 - CALL NEWLINE - LD A,0 - LD (NEWLINE_USED),A - -DIO_PROGRESS1: - CALL PC_CR - LD DE,STR_PROGRESS - CALL WRITESTR - CALL PC_COLON - CALL PC_SPACE - LD DE,DPL_TRACK - CALL WRITESTR - CALL PC_EQUAL - LD A,(DCD_TRACK) - CALL PRTHEXBYTE - CALL PC_SPACE - LD DE,DPL_HEAD - CALL WRITESTR - CALL PC_EQUAL - LD A,(DCD_HEAD) - CALL PRTHEXBYTE - CALL PC_SPACE - LD DE,DPL_SECTOR - CALL WRITESTR - CALL PC_EQUAL - LD A,(DCD_SECTOR) - CALL PRTHEXBYTE - - RET - -DIO_VERIFY: - LD HL,BUFFER - LD DE,VFYBUF - LD BC,BUFSIZ - -DIO_VERIFY1: - LD A,(DE) - CP (HL) - JP NZ,DIO_VERIFY2 - INC DE - INC HL - DEC BC - LD A,B - OR C - JP NZ,DIO_VERIFY1 - RET - -DIO_VERIFY2: - PUSH DE - - CALL NEWLINE - LD DE,STR_MISMATCH - CALL WRITESTR - POP DE - LD A,D - SUB VFYBUF >> 8 - CALL PRTHEXBYTE - LD A,E - CALL PRTHEXBYTE - LD A,FRC_MISMATCH - LD (FST_RC),A - RET -; -; CONTINUE PROMPT OPTION STRINGS -; -DIOCS_ABORT .TEXT "ABORT$" -DIOCS_RETRY .TEXT "RETRY$" -DIOCS_IGNORE .TEXT "IGNORE$" -; -; DISK PROGRESS LABELS -; -DPL_TRACK .TEXT "TRACK$" -DPL_HEAD .TEXT "HEAD$" -DPL_SECTOR .TEXT "SECTOR$" -; -; DISK OPERATIONS -; -DOP_READ .EQU 0 ; READ OPERATION -DOP_WRITE .EQU 1 ; WRITE OPERATION -DOP_FORMAT .EQU 2 ; FORMAT OPERATION -DOP_VERIFY .EQU 3 ; VERIFY OPERATION -; -; DEVICE CONTROL DATA -; -DCD_FILL .DB 0E5H ; DEFAULT TO E5 (EMPTY DIRECTORY BYTE) -DCD_PATTERN .DB 000H ; DEFAULT TO 00 -DCD_TRACE .DB 000H ; TRACE LEVEL -DCD_UNIT .DB 000H ; DEFAULT UNIT = 0 -DCD_SECTOR .DB 001H ; DEFAULT SECTOR = 1 -DCD_HEAD .DB 000H ; DEFAULT HEAD = 0 -DCD_TRACK .DB 000H ; DEFAULT TRACK = 0 -DCD_INTRLV .DB 002H ; DEFAULT INTERLEAVE = 2 -DCD_DOP .DB DOP_READ ; DEFAULT OP = READ -DCD_MT .DB MT_PC720 ; DEFAULT FLOPPY DEVICE = PC720 -DCD_MD .DB MD_POLL ; DEFAULT MODE = POLL -; -; DEVICE CONTROL DATA (PRIVATE) -; -DCD_DSKRDY .DB FALSE ; 0 = NOT RDY, 1 = RDY -DCD_ABORT .DB FALSE ; 0 = CONT, 1 = ABORT -DCD_CURTRK .DB 0FFH ; CURRENT TRACK, FF = UNKNOWN -; -; MODES -; -MD_POLL .EQU 0 -MD_INT .EQU 1 -MD_INTFAST .EQU 2 -MD_INTWAIT .EQU 3 -MD_DRQWAIT .EQU 4 -; -; MODE MAPPING -; BIT IS SET FOR ALLOWED MODES PER FDC -; -MD_MAP: - .DB %00011111 ; DIO POLL,INT,INTFAST,INTWAIT,DRQWAIT - .DB %00000111 ; DIO3 POLL,INT,INTFAST - .DB %00000111 ; ZETA POLL,INT,INTFAST - .DB %00000001 ; ZETA2 POLL - .DB %00000001 ; DIDE POLL - .DB %00000001 ; N8 POLL - .DB %00000001 ; RCSMC POLL - .DB %00000001 ; RCWDC POLL - .DB %00000001 ; SMZ80 POLL - .DB %00000001 ; DYNO POLL -; -; MEDIA DESCRIPTION BLOCK -; -MDB: -MDB_LABEL .DW 000H ; ADDRESS OF MEDIA LABEL -MDB_DESC .DW 000H ; ADDRESS OF MEDIA DESCRIPTION -MDB_NUMCYL .DB 000H ; NUMBER OF CYLINDERS -MDB_NUMHD .DB 000H ; NUMBER OF HEADS -MDB_NUMSEC .DB 000H ; NUMBER OF SECTORS -MDB_SOT .DB 000H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) -MDB_FCD: ; FLOPPY CONFIGURATION DATA (PUBLIC) MANAGED AS A "BLOCK", MUST MATCH FCB BELOW -MDB_EOT ; END OF TRACK SECTOR (SAME AS SC SINCE SOT ALWAYS 1) -MDB_SC .DB 000H ; SECTOR COUNT -MDB_SECSZ .DW 000H ; SECTOR SIZE IN BYTES -MDB_GPL .DB 000H ; GAP LENGTH (R/W) -MDB_GPLF .DB 000H ; GAP LENGTH (FORMAT) -MDB_SRTHUT .DB 000H ; STEP RATE, IBM PS/2 CALLS FOR 3ms, 0DH = 3ms SRT, HEAD UNLOAD TIME -MDB_HLT .DB 000H ; HEAD LOAD TIME, IBM PS/2 CALLS FOR 15ms 08H = 16ms HUT -MDB_DORA .DB 000H ; OPERATIONS REGISTER VALUE FOR MEDIA -MDB_DORB .DB 000H ; OPERATIONS REGISTER VALUE FOR MEDIA -MDB_DORC .DB 000H ; OPERATIONS REGISTER VALUE FOR MEDIA -MDB_DORD .DB 000H ; OPERATIONS REGISTER VALUE FOR MEDIA -MDB_DCR .DB 000H ; CONTROL REGISTER VALUE FOR MEDIA -MDB_LEN .EQU $ - MDB -; -MDT: ; MODE TABLE - .DW MTB_POLL - .DW MTB_INT - .DW MTB_INTFAST - .DW MTB_INTWAIT - .DW MTB_DRQWAIT -MDT_ENTCNT .EQU (($ - MDT) / 2) -; -MTB_POLL .DW MTL_POLL ; ADDRESS OF MODE LABEL - .DW MTS_POLL ; ADDRESS OF MODE DESCRIPTION -MTL_POLL .TEXT "POLL $" -MTS_POLL .TEXT "POLLING (RECOMMENDED)$" -; -MTB_INT .DW MTL_INT ; ADDRESS OF MODE LABEL - .DW MTS_INT ; ADDRESS OF MODE DESCRIPTION -MTL_INT .TEXT "INT $" -MTS_INT .TEXT "INTERRUPT (!!! READ MANUAL !!!)$" -; -MTB_INTFAST .DW MTL_INTFAST ; ADDRESS OF MODE LABEL - .DW MTS_INTFAST ; ADDRESS OF MODE DESCRIPTION -MTL_INTFAST .TEXT "INT-FAST $" -MTS_INTFAST .TEXT "FAST INTERRUPT (!!! READ MANUAL !!!)$" -; -MTB_INTWAIT .DW MTL_INTWAIT ; ADDRESS OF MODE LABEL - .DW MTS_INTWAIT ; ADDRESS OF MODE DESCRIPTION -MTL_INTWAIT .TEXT "INT/WAIT $" -MTS_INTWAIT .TEXT "INT/WAIT (!!! READ MANUAL !!!)$" -; -MTB_DRQWAIT .DW MTL_DRQWAIT ; ADDRESS OF MODE LABEL - .DW MTS_DRQWAIT ; ADDRESS OF MODE DESCRIPTION -MTL_DRQWAIT .TEXT "DRQ/WAIT $" -MTS_DRQWAIT .TEXT "DRQ/WAIT (!!! NOT YET IMPLEMENTED!!!)$" -; -; MEDIA TYPE INFORMATION -; -MT_PC720 .EQU 0 -MT_PC144 .EQU 1 -MT_PC320 .EQU 2 -MT_PC360 .EQU 3 -MT_PC120 .EQU 4 -MT_PC111 .EQU 5 -; -MIT: ; MEDIA INDEX TABLE - .DW MDB_PC720 - .DW MDB_PC144 - .DW MDB_PC320 - .DW MDB_PC360 - .DW MDB_PC120 - .DW MDB_PC111 -MIT_ENTCNT .EQU (($ - MIT) / 2) -; -; Specify Command: -; +-----+-----+-----+-----+-----+-----+-----+-----+-----+ -; |Byte | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | -; +-----+-----+-----+-----+-----+-----+-----+-----+-----+ -; | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | -; | 1 | ----- STEP RATE ----- | -- HEAD UNLOAD TIME - | -; | 2 | ------------ HEAD LOAD TIME ----------- | NDM | -; +-----+-----+-----+-----+-----+-----+-----+-----+-----+ -; -; -; Step Rate (milliseconds): Head Unload Time (milliseconds): Head Load Time (milliseconds): -; +------+------+------+------+------+ +------+------+------+------+------+ +------+------+------+------+------+ -; | | BITRATE | | | BITRATE | | | BITRATE | -; | VAL | 1.0M | 500K | 300K | 250K | | VAL | 1.0M | 500K | 300K | 250K | | VAL | 1.0M | 500K | 300K | 250K | -; +------+------+------+------+------+ +------+------+------+------+------+ +------+------+------+------+------+ -; | 0 | 8.0 | 16.0 | 26.7 | 32.0 | | 0 | 128 | 256 | 426 | 512 | | 0 | 128 | 256 | 426 | 512 | -; | 1 | 7.5 | 15.0 | 25.0 | 30.0 | | 1 | 8 | 16 | 26.7 | 32 | | 1 | 1 | 2 | 3.3 | 4 | -; | 2 | 7.0 | 14.0 | 23.3 | 28.0 | | 2 | 16 | 32 | 53.3 | 64 | | 2 | 2 | 4 | 6.7 | 8 | -; | ... | ... | ... | ... | ... | | ... | ... | ... | ... | ... | | ... | ... | ... | ... | ... | -; | 14 | 1.0 | 2.0 | 3.3 | 4.0 | | 14 | 112 | 224 | 373 | 448 | | 126 | 126 | 252 | 420 | 504 | -; | 15 | 0.5 | 1.0 | 1.7 | 2.0 | | 15 | 120 | 240 | 400 | 480 | | 127 | 127 | 254 | 423 | 508 | -; +------+------+------+------+------+ +------+------+------+------+------+ +------+------+------+------+------+ -; -; IBM PS/2 CALLS FOR: -; STEP RATE: 3ms (6ms FOR ALL 41mm OR 720K DRIVES) -; HEAD LOAD TIME: 15ms -; -; STATIC CONFIGURATION, NEVER CHANGES (PRIVATE) -; -MDB_PC720 .DW DTL_PC720 ; ADDRESS OF MEDIA LABEL - .DW DTS_PC720 ; ADDRESS OF MEDIA DESCRIPTION - .DB 050H ; NUMBER OF CYLINDERS - .DB 002H ; NUMBER OF HEADS - .DB 009H ; NUMBER OF SECTORS - .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) -FCB_PC720 .DB 009H ; SECTOR COUNT - .DW 200H ; SECTOR SIZE IN BYTES - .DB 02AH ; GAP LENGTH (R/W) - .DB 050H ; GAP LENGTH (FORMAT) - .DB (13 << 4) | 0 ; SRT = 6ms, HUT = 512ms - .DB 4 ; HLT = 16ms - .DB DORA_BR250 ; OPERATIONS REGISTER VALUE - .DB DORB_BR250 ; OPERATIONS REGISTER VALUE - .DB DORC_BR250 ; OPERATIONS REGISTER VALUE - .DB DORD_BR250 ; OPERATIONS REGISTER VALUE - .DB DCR_BR250 ; CONTROL REGISTER VALUE - .IF (($ - MDB_PC720) != MDB_LEN) - .ECHO "*** FCB SIZE ERROR!!! ***\n" - .ENDIF -DTL_PC720 .TEXT "720KB $" -DTS_PC720 .TEXT "3.5\" 720KB - 9 SECTORS, 2 SIDES, 80 TRACKS, DOUBLE DENSITY$" -; -MDB_PC144 .DW DTL_PC144 ; ADDRESS OF MEDIA LABEL - .DW DTS_PC144 ; ADDRESS OF MEDIA DESCRIPTION - .DB 050H ; NUMBER OF CYLINDERS - .DB 002H ; NUMBER OF HEADS - .DB 012H ; NUMBER OF SECTORS - .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) -FCB_PC144 .DB 012H ; SECTOR COUNT - .DW 200H ; SECTOR SIZE IN BYTES - .DB 01BH ; GAP LENGTH (R/W) - .DB 06CH ; GAP LENGTH (FORMAT) - .DB (13 << 4) | 0 ; SRT = 3ms, HUT = 256ms - .DB 8 ; HLT = 16ms - .DB DORA_BR500 ; OPERATIONS REGISTER VALUE - .DB DORB_BR500 ; OPERATIONS REGISTER VALUE - .DB DORC_BR500 ; OPERATIONS REGISTER VALUE - .DB DORD_BR500 ; OPERATIONS REGISTER VALUE - .DB DCR_BR500 ; CONTROL REGISTER VALUE - .IF (($ - MDB_PC144) != MDB_LEN) - .ECHO "*** FCB SIZE ERROR!!! ***\n" - .ENDIF -DTL_PC144 .TEXT "1.44MB$" -DTS_PC144 .TEXT "3.5\" 1.44MB - 18 SECTORS, 2 SIDES, 80 TRACKS, HIGH DENSITY$" -; -MDB_PC320 .DW DTL_PC320 ; ADDRESS OF MEDIA LABEL - .DW DTS_PC320 ; ADDRESS OF MEDIA DESCRIPTION - .DB 028H ; NUMBER OF CYLINDERS - .DB 002H ; NUMBER OF HEADS - .DB 008H ; NUMBER OF SECTORS - .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) -FCB_PC320 .DB 008H ; SECTOR COUNT - .DW 200H ; SECTOR SIZE IN BYTES - .DB 02AH ; GAP LENGTH (R/W) - .DB 050H ; GAP LENGTH (FORMAT) - .DB (13 << 4) | 0 ; SRT = 6ms, HUT = 512ms - .DB 4 ; HLT = 16ms - .DB DORA_BR250 ; OPERATIONS REGISTER VALUE - .DB DORB_BR250 ; OPERATIONS REGISTER VALUE - .DB DORC_BR250 ; OPERATIONS REGISTER VALUE - .DB DORD_BR250 ; OPERATIONS REGISTER VALUE - .DB DCR_BR250 ; CONTROL REGISTER VALUE - .IF (($ - MDB_PC320) != MDB_LEN) - .ECHO "*** FCB SIZE ERROR!!! ***\n" - .ENDIF -DTL_PC320 .TEXT "320KB $" -DTS_PC320 .TEXT "5.25\" 320KB - 8 SECTORS, 2 SIDES, 40 TRACKS, DOUBLE DENSITY$" -; -MDB_PC360 .DW DTL_PC360 ; ADDRESS OF MEDIA LABEL - .DW DTS_PC360 ; ADDRESS OF MEDIA DESCRIPTION - .DB 028H ; NUMBER OF CYLINDERS - .DB 002H ; NUMBER OF HEADS - .DB 009H ; NUMBER OF SECTORS - .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) -FCB_PC360 .DB 009H ; SECTOR COUNT - .DW 200H ; SECTOR SIZE IN BYTES - .DB 02AH ; GAP LENGTH (R/W) - .DB 050H ; GAP LENGTH (FORMAT) - .DB (13 << 4) | 0 ; SRT = 6ms, HUT = 512ms - .DB 4 ; HLT = 16ms - .DB DORA_BR250 ; OPERATIONS REGISTER VALUE - .DB DORB_BR250 ; OPERATIONS REGISTER VALUE - .DB DORC_BR250 ; OPERATIONS REGISTER VALUE - .DB DORD_BR250 ; OPERATIONS REGISTER VALUE - .DB DCR_BR250 ; CONTROL REGISTER VALUE - .IF (($ - MDB_PC360) != MDB_LEN) - .ECHO "*** FCB SIZE ERROR!!! ***\n" - .ENDIF -DTL_PC360 .TEXT "360KB $" -DTS_PC360 .TEXT "5.25\" 360KB - 9 SECTORS, 2 SIDES, 40 TRACKS, DOUBLE DENSITY$" -; -MDB_PC120 .DW DTL_PC120 ; ADDRESS OF MEDIA LABEL - .DW DTS_PC120 ; ADDRESS OF MEDIA DESCRIPTION - .DB 050H ; NUMBER OF CYLINDERS - .DB 002H ; NUMBER OF HEADS - .DB 00FH ; NUMBER OF SECTORS - .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) -FCB_PC120 .DB 00FH ; SECTOR COUNT - .DW 200H ; SECTOR SIZE IN BYTES - .DB 01BH ; GAP LENGTH (R/W) - .DB 054H ; GAP LENGTH (FORMAT) - .DB (10 << 4) | 0 ; SRT = 6ms, HUT = 256ms - .DB 8 ; HLT = 16ms - .DB DORA_BR500 ; OPERATIONS REGISTER VALUE - .DB DORB_BR500 ; OPERATIONS REGISTER VALUE - .DB DORC_BR500 ; OPERATIONS REGISTER VALUE - .DB DORD_BR500 ; OPERATIONS REGISTER VALUE - .DB DCR_BR500 ; CONTROL REGISTER VALUE - .IF (($ - MDB_PC120) != MDB_LEN) - .ECHO "*** FCB SIZE ERROR!!! ***\n" - .ENDIF -DTL_PC120 .TEXT "1.2MB $" -DTS_PC120 .TEXT "5.25\" 1.2MB - 15 SECTORS, 2 SIDES, 80 TRACKS, HIGH DENSITY$" -; -MDB_PC111 .DW DTL_PC111 ; ADDRESS OF MEDIA LABEL - .DW DTS_PC111 ; ADDRESS OF MEDIA DESCRIPTION - .DB 04DH ; NUMBER OF CYLINDERS - .DB 002H ; NUMBER OF HEADS - .DB 00FH ; NUMBER OF SECTORS - .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) -FCB_PC111 .DB 00FH ; SECTOR COUNT - .DW 200H ; SECTOR SIZE IN BYTES - .DB 01BH ; GAP LENGTH (R/W) - .DB 054H ; GAP LENGTH (FORMAT) - .DB (13 << 4) | 0 ; SRT = 3ms, HUT = 256ms - .DB 25 ; HLT = 50ms - .DB DORA_BR500 ; OPERATIONS REGISTER VALUE - .DB DORB_BR500 ; OPERATIONS REGISTER VALUE - .DB DORC_BR500 ; OPERATIONS REGISTER VALUE - .DB DORD_BR500 ; OPERATIONS REGISTER VALUE - .DB DCR_BR500 ; CONTROL REGISTER VALUE - .IF (($ - MDB_PC111) != MDB_LEN) - .ECHO "*** FCB SIZE ERROR!!! ***\n" - .ENDIF -DTL_PC111 .TEXT "1.11MB$" -DTS_PC111 .TEXT "8\" 1.11MB - 15 SECTORS, 2 SIDES, 77 TRACKS, DOUBLE DENSITY$" -; -;=============================================================================== -; FLOPPY DISK CONTROL MENU (DIRECT MENU INTERFACE TO FDC & RELATED HARDWARE) -;=============================================================================== -; -; FDC MENU DATA -; -FM_TABLE .DB 'R' \ .DW FMS_READ, FM_READ -FM_ENTSIZ .EQU $ - FM_TABLE - .DB 'D' \ .DW FMS_READDEL, FM_READDEL - .DB 'W' \ .DW FMS_WRITE, FM_WRITE - .DB 'E' \ .DW FMS_WRITEDEL, FM_WRITEDEL - .DB 'T' \ .DW FMS_READTRK, FM_READTRK - .DB 'I' \ .DW FMS_READID, FM_READID - .DB 'F' \ .DW FMS_FMTTRK, FM_FMTTRK - .DB 'Q' \ .DW FMS_SCANEQ, FM_SCANEQ - .DB 'L' \ .DW FMS_SCANLOEQ, FM_SCANLOEQ - .DB 'H' \ .DW FMS_SCANHIEQ, FM_SCANHIEQ - .DB 'C' \ .DW FMS_RECAL, FM_RECAL - .DB 'N' \ .DW FMS_SENSEINT, FM_SENSEINT - .DB 'P' \ .DW FMS_SPECIFY, FM_SPECIFY - .DB 'V' \ .DW FMS_DRVSTAT, FM_DRVSTAT - .DB 'S' \ .DW FMS_SEEK, FM_SEEK - .DB 'O' \ .DW FMS_VERSION, FM_VERSION - .DB 'U' \ .DW FMS_PULSETC, FM_PULSETC - .DB 'A' \ .DW FMS_DOR, FM_DOR - .DB 'M' \ .DW FMS_MOTOR, FM_MOTOR - .DB 'Z' \ .DW FMS_FDCRESET, FM_FDCRESET - .DB 'X' \ .DW FMS_EXIT, 0000H -FM_COUNT .EQU (($ - FM_TABLE) / FM_ENTSIZ) ; # ENTRIES IN TABLE -FM_INFO: .DW FM_DRAW - .DW FM_TABLE - .DB FM_ENTSIZ - .DB FM_COUNT -; -; FDC COMMAND MENU STRINGS -; -STR_FDCMENU: -; .TEXT "===================<< FDU FDC COMMAND MENU >>======= [MSR=XX] ==\r\n" - .TEXT "===================<< FDU FDC COMMAND MENU >>======= [MSR=" -MV_MSR .TEXT "XX" - .TEXT "] ==\r\n" - .TEXT "(R)EAD READ (D)EL (W)RITE WRITE D(E)L\r\n" - .TEXT "READ (T)RK READ (I)D (F)ORMAT SCAN E(Q)\r\n" - .TEXT "SCAN (L)O/EQ SCAN (H)I/EQ RE(C)AL SE(N)SE INT\r\n" - .TEXT "S(P)ECIFY DRI(V)E STAT (S)EEK VERSI(O)N\r\n" -; .TEXT "P(U)LSE TC L(A)TCH:XX (M)OTOR:XXX FDC RESET (Z)\r\n" - .TEXT "P(U)LSE TC L(A)TCH:" -MV_LAT .TEXT "XX" - .TEXT " (M)OTOR:" -MV_MOT .TEXT "XXX" - .TEXT " FDC RESET (Z)" - .TEXT "\r\n" - .TEXT "E(X)IT\r\n" - .TEXT "=== OPTION ===> $" -; -FMS_NOP .TEXT "NOP$" -FMS_READ .TEXT "READ$" -FMS_READDEL .TEXT "READ DELETED$" -FMS_WRITE .TEXT "WRITE$" -FMS_WRITEDEL .TEXT "WRITE DELETED$" -FMS_READTRK .TEXT "READ TRACK$" -FMS_READID .TEXT "READ ID$" -FMS_FMTTRK .TEXT "FORMAT TRACK$" -FMS_SCANEQ .TEXT "SCAN EQUAL$" -FMS_SCANLOEQ .TEXT "SCAN LOW OR EQUAL$" -FMS_SCANHIEQ .TEXT "SCAN HIGH OR EQUAL$" -FMS_RECAL .TEXT "RECALIBRATE$" -FMS_SENSEINT .TEXT "SENSE INTERRUPT$" -FMS_SPECIFY .TEXT "SPECIFY$" -FMS_DRVSTAT .TEXT "DRIVE STATUS$" -FMS_SEEK .TEXT "SEEK$" -FMS_VERSION .TEXT "VERSION$" -FMS_PULSETC .TEXT "PULSE TC$" -FMS_DOR .TEXT "DOR$" -FMS_MOTOR .TEXT "MOTOR$" -FMS_FDCRESET .TEXT "FDC RESET$" -FMS_EXIT .TEXT "EXIT$" -; -; ENTRY POINT FOR FDCMENU -; -FDCMENU: - LD A,01H - LD (FCD_TRACE),A ; FORCE TRACING OF ALL FDC COMMANDS - LD HL,FM_INFO - CALL RUNMENU - RET -; -; FDCMENU DRAW PROCEDURE -; -FM_DRAW: - CALL NEWLINE - CALL NEWLINE - - ; UPDATE MOTOR STATUS - LD HL,FDCBM - LD A,(HL) - AND _DIO - JR NZ,FM_DRAW0A - LD A,(HL) - AND _ZETA | _DIO3 - JR NZ,FM_DRAW0B - LD A,(HL) - AND _PCAT - JR NZ,FM_DRAW0C - LD A,(HL) - AND _RCSMC - JR NZ,FM_DRAW0D - JR FM_DRAW3 -FM_DRAW0A: ; DIO - LD A,(FST_DOR) - AND 00000010B - XOR 00000010B - JR FM_DRAW1 -FM_DRAW0B: ; ZETA, DIO3 - LD A,(FST_DOR) - AND 00000010B - JR FM_DRAW1 -FM_DRAW0C: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO - LD A,(FST_DOR) - AND 11110000B - JR FM_DRAW1 -FM_DRAW0D: ; RCSMC - LD A,(FST_DOR) - AND 00000110B - JR FM_DRAW1 -FM_DRAW1: - LD DE,STR_ON - JP NZ,FM_DRAW2 - LD DE,STR_OFF -FM_DRAW2: - LD HL,MV_MOT - CALL STRCPY -FM_DRAW3: - - ; UPDATE MSR VALUE - LD DE,MV_MSR - LD C,(IY+CFG_MSR) - IN A,(C) - CALL HEXSTRBYTE - - ; UPDATE FST_DOR VALUE - LD DE,MV_LAT - LD A,(FST_DOR) - CALL HEXSTRBYTE - - ; DISPLAY THE MENU - LD DE,STR_FDCMENU - CALL WRITESTR - - RET -; -; FDCMENU FUNCTIONS -; -FM_READ: - CALL FM_GETTHS - CALL FC_READ - RET - -FM_READDEL: - CALL FM_GETTHS - CALL FC_READDEL - RET - -FM_WRITE: - CALL FM_GETTHS - CALL FC_WRITE - RET - -FM_WRITEDEL: - CALL FM_GETTHS - CALL FC_WRITEDEL - RET - -FM_READTRK: - CALL FM_GETTHS - CALL FC_READTRK - RET - -FM_READID: - CALL FM_GETHEAD - CALL FC_READID - RET - -FM_FMTTRK: - CALL FM_GETTRK - CALL FM_GETHEAD - CALL FC_FMTTRK - RET - -FM_SCANEQ: - JP FM_NOTIMPL ; NOT IMPLEMENTED! - CALL FM_GETTHS - CALL FC_SCANEQ - RET - -FM_SCANLOEQ: - JP FM_NOTIMPL ; NOT IMPLEMENTED! - CALL FM_GETTHS - CALL FC_SCANLOEQ - RET - -FM_SCANHIEQ: - JP FM_NOTIMPL ; NOT IMPLEMENTED! - CALL FM_GETTHS - CALL FC_SCANHIEQ - RET - -FM_RECAL: - LD A,0 ; UPDATE CYLINDER FOR FUTURE CALLS - LD (FCD_C),A ; FIX: NOT IN THE RIGHT PLACE - CALL FC_RECAL - RET - -FM_SENSEINT: - CALL FC_SENSEINT - RET - -FM_SPECIFY: - CALL FC_SPECIFY - RET - -FM_DRVSTAT: - CALL FM_GETHEAD - CALL FC_DRVSTAT - RET - -FM_SEEK: - CALL FM_GETTRK - CALL FC_SEEK - RET - -FM_VERSION: - CALL FC_VERSION - RET - -FM_PULSETC: - CALL NEWLINE - CALL FC_PULSETC - RET - -FM_DOR: - CALL FM_GETDOR - CALL FC_SETDOR - RET - -FM_MOTOR: - ; TOGGLE MOTOR STATE - LD HL,FDCBM - LD A,(HL) - AND _DIO - JR NZ,FM_MOTOR0A - LD A,(HL) - AND _ZETA | _DIO3 - JR NZ,FM_MOTOR0B - LD A,(HL) - AND _PCAT - JR NZ,FM_MOTOR0C - LD A,(HL) - AND _RCSMC - JR NZ,FM_MOTOR0D - RET -FM_MOTOR0A: ; DIO - LD A,(FST_DOR) - AND 00000010B - XOR 00000010B - JR FM_MOTOR1 -FM_MOTOR0B: ; ZETA, DIO3 - LD A,(FST_DOR) - AND 00000010B - JR FM_MOTOR1 -FM_MOTOR0C: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO - LD A,(FST_DOR) - AND 11110000B - JR FM_MOTOR1 -FM_MOTOR0D: ; RCSMC - LD A,(FST_DOR) - AND 00000110B - JR FM_MOTOR1 -FM_MOTOR1: - JP Z,FC_MOTORON - JP FC_MOTOROFF - -FM_FDCRESET: - CALL NEWLINE - LD A,(FDCID) - CP FDC_DIO ; RESET NOT POSSIBLE ON DIO - JP NZ,FC_RESETFDC - LD DE,FCS_NORES - JP WRITESTR - -FM_NOTIMPL: - CALL PC_SPACE ; NOT IMPLEMENTED - LD DE,STR_NOTIMPL - CALL WRITESTR - RET - -FM_GETTHS: - CALL FM_GETTRK - CALL FM_GETHEAD - CALL FM_GETSEC - RET - -FM_GETTRK: - LD DE,FCPP_TRK - LD HL,FCD_C - CALL GETHEXBYTE - RET - -FM_GETHEAD: - LD DE,FCPP_HEAD - LD HL,FCD_H - CALL GETHEXBYTE - RET - -FM_GETSEC: - LD DE,FCPP_SEC - LD HL,FCD_R - CALL GETHEXBYTE - RET - -FM_GETDOR: - LD DE,FCPP_DOR - LD HL,FST_DOR - CALL GETHEXBYTE - RET -; -FCS_NORES .TEXT "\r\n*** RESET NOT SUPORTED BY HARDWARE ***$" -; -;=============================================================================== -; FLOPPY DISK CONTROL SERVICES (PHYSICAL DEVICE CONTROL FOR FDC HARDWARE) -;=============================================================================== -; -; FDC RESULT CODES -; -FRC_OK .EQU 0 ; 00 -FRC_NOTIMPL .EQU -01H ; FF -FRC_CMDERR .EQU -02H ; FE -FRC_ERROR .EQU -03H ; FD -FRC_ABORT .EQU -04H ; FC -FRC_BUFMAX .EQU -05H ; FB -FRC_ABTERM .EQU -08H ; F8 -FRC_INVCMD .EQU -09H ; F7 -FRC_DSKCHG .EQU -0AH ; F6 -FRC_ENDCYL .EQU -0BH ; F5 -FRC_DATAERR .EQU -0CH ; F4 -FRC_OVERRUN .EQU -0DH ; F3 -FRC_NODATA .EQU -0EH ; F2 -FRC_NOTWRIT .EQU -0FH ; F1 -FRC_MISADR .EQU -10H ; F0 -FRC_TOFDCRDY .EQU -11H ; EF -FRC_TOSNDCMD .EQU -12H ; EE -FRC_TOGETRES .EQU -13H ; ED -FRC_TOEXEC .EQU -14H ; EC -FRC_TOSEEKWT .EQU -15H ; EB -FRC_MISMATCH .EQU -16H ; EA -; -; FDC STATUS CODE STRINGS -; -FSS_OK .TEXT "OK$" -FSS_NOTIMPL .TEXT "NOT IMPLEMENTED$" -FSS_CMDERR .TEXT "COMMAND ERROR$" -FSS_ERROR .TEXT "ERROR$" -FSS_ABORT .TEXT "ABORT$" -FSS_BUFMAX .TEXT "BUFFER EXCEEDED$" -FSS_ABTERM .TEXT "ABNORMAL TERMINATION$" -FSS_INVCMD .TEXT "INVALID COMMAND$" -FSS_DSKCHG .TEXT "DISK CHANGE$" -FSS_ENDCYL .TEXT "END OF CYLINDER$" -FSS_DATAERR .TEXT "DATA ERROR$" -FSS_OVERRUN .TEXT "OVERRUN$" -FSS_NODATA .TEXT "NO DATA$" -FSS_NOTWRIT .TEXT "NOT WRITABLE$" -FSS_MISADR .TEXT "MISSING ADDRESS MARK$" -FSS_TOFDCRDY .TEXT "FDC READY TIMEOUT$" -FSS_TOSNDCMD .TEXT "SENDCMD TIMEOUT$" -FSS_TOGETRES .TEXT "GET RESULTS TIMEOUT$" -FSS_TOEXEC .TEXT "EXEC TIMEOUT$" -FSS_TOSEEKWT .TEXT "SEEK WAIT TIMEOUT$" -; -; FDC STATUS STRING TABLE -; -FSST: .DB FRC_OK \ .DW FSS_OK -FSST_ENTSIZ .EQU $ - FSST - .DB FRC_NOTIMPL \ .DW FSS_NOTIMPL - .DB FRC_CMDERR \ .DW FSS_CMDERR - .DB FRC_ERROR \ .DW FSS_ERROR - .DB FRC_ABORT \ .DW FSS_ABORT - .DB FRC_BUFMAX \ .DW FSS_BUFMAX - .DB FRC_ABTERM \ .DW FSS_ABTERM - .DB FRC_INVCMD \ .DW FSS_INVCMD - .DB FRC_DSKCHG \ .DW FSS_DSKCHG - .DB FRC_ENDCYL \ .DW FSS_ENDCYL - .DB FRC_DATAERR \ .DW FSS_DATAERR - .DB FRC_OVERRUN \ .DW FSS_OVERRUN - .DB FRC_NODATA \ .DW FSS_NODATA - .DB FRC_NOTWRIT \ .DW FSS_NOTWRIT - .DB FRC_MISADR \ .DW FSS_MISADR - .DB FRC_TOFDCRDY \ .DW FSS_TOFDCRDY - .DB FRC_TOSNDCMD \ .DW FSS_TOSNDCMD - .DB FRC_TOGETRES \ .DW FSS_TOGETRES - .DB FRC_TOEXEC \ .DW FSS_TOEXEC - .DB FRC_TOSEEKWT \ .DW FSS_TOSEEKWT -FSST_COUNT .EQU (($ - FSST) / FSST_ENTSIZ) ; # ENTRIES IN TABLE -; -; FDC COMMAND PHASE -; -FCP_CMD .DB 000H ; INPUT: COMMAND CODE -FCP_BUFLEN .DB 00H -FCP_BUF .FILL 10H -FCP_BUFSIZ .EQU $-FCP_BUF -FCP_XFRCNT .DW 00H ; BYTES TRANSFERRED DURING COMMAND PHASE -; -; FDC EXECUTION PHASE -; -FXP_XR .DW 00H ; INPUT: ADDRESS OF EXECUTION ROUTINE TO INVOKE -FXP_TO .DB 00H ; TIMEOUT COUNTDOWN TIMER USED IN SOME VARIATIONS -FXP_ITER .DB 00H ; LOOP ITERATION COUNTER (MUST IMMEDIATELY FOLLOW FXP_TO) -FXP_A .DB 00H ; LAST VALUE OF REG A RECORDED DURING EXECUTION -FXP_BC .DW 00H ; LAST VALUE OF REG BC RECORDED DURING EXECUTION -FXP_DE .DW 00H ; LAST VALUE OF REG DE RECORDED DURING EXECUTION -FXP_HL .DW 00H ; LAST VALUE OF REG HL RECORDED DURING EXECUTION -FXP_BUFLEN .DB 00H -FXP_BUF .FILL 50H ; USED FOR CERTAIN EXEC ROUTINES (FORMAT TRACK) -FXP_BUFSIZ .EQU $-FXP_BUF -; -; FDC STATUS -; -FST_RC .DB 00H -FST_MSR .DB 00H -FST_DOR .DB 00H -; -; FDC RESULTS BUFFER -; -FRB_LEN .DB 00H -FRB -FRB_ST0 -FRB_ST3 .DB 0 -FRB_ST1 -FRB_PCN .DB 0 -FRB_ST2 .DB 0 -FRB_C .DB 0 -FRB_H .DB 0 -FRB_R .DB 0 -FRB_N .DB 0 - .FILL 10H ; ALLOWS EXTRA CHARACTERS TO BE RETREIEVED -FRB_SIZ .EQU $-FRB -; -; FDC COMMANDS -; -CMD_READ .EQU 00000110B ; ST0,ST1,ST2,C,H,R,N -CMD_READDEL .EQU 00001100B ; ST0,ST1,ST2,C,H,R,N -CMD_WRITE .EQU 00000101B ; ST0,ST1,ST2,C,H,R,N -CMD_WRITEDEL .EQU 00001001B ; ST0,ST1,ST2,C,H,R,N -CMD_READTRK .EQU 00000010B ; ST0,ST1,ST2,C,H,R,N -CMD_READID .EQU 00001010B ; ST0,ST1,ST2,C,H,R,N -CMD_FMTTRK .EQU 00001101B ; ST0,ST1,ST2,C,H,R,N -CMD_SCANEQ .EQU 00010001B ; ST0,ST1,ST2,C,H,R,N -CMD_SCANLOEQ .EQU 00011001B ; ST0,ST1,ST2,C,H,R,N -CMD_SCANHIEQ .EQU 00011101B ; ST0,ST1,ST2,C,H,R,N -CMD_RECAL .EQU 00000111B ; -CMD_SENSEINT .EQU 00001000B ; ST0,PCN -CMD_SPECIFY .EQU 00000011B ; -CMD_DRVSTAT .EQU 00000100B ; ST3 -CMD_SEEK .EQU 00001111B ; -CMD_VERSION .EQU 00010000B ; ST0 -; -; FDC COMMAND DATA -; -FCD: ; FLOPPY CONFIGURATION DATA (PUBLIC) MANAGED AS A "BLOCK", SEE FCB BELOW -FCD_EOT ; END OF TRACK SECTOR (SAME AS SC SINCE SOT ALWAYS 1) -FCD_SC .DB 000H ; SECTOR COUNT -FCD_SECSZ .DW 000H ; SECTOR SIZE IN BYTES -FCD_GPL .DB 000H ; GAP LENGTH (R/W) -FCD_GPLF .DB 000H ; GAP LENGTH (FORMAT) -FCD_SRTHUT .DB 000H ; STEP RATE, IBM PS/2 CALLS FOR 3ms, 0DH = 3ms SRT, HEAD UNLOAD TIME -FCD_HLT .DB 000H ; HEAD LOAD TIME, IBM PS/2 CALLS FOR 15ms 08H = 16ms HUT -FCD_DORA .DB 000H ; DEFAULT DOR VALUE FOR MEDIA -FCD_DORB .DB 000H ; DEFAULT DOR VALUE FOR MEDIA -FCD_DORC .DB 000H ; DEFAULT DOR VALUE FOR MEDIA -FCD_DORD .DB 000H ; DEFAULT DOR VALUE FOR MEDIA -FCD_DCR .DB 000H ; DOR VALUE FOR MEDIA -FCD_LEN .EQU $ - FCD - ; DYNAMICALLY MANAGED (PUBLIC) -FCD_DS .DB 001H ; DRIVE SELECT (UNIT NUMBER 0-3) -FCD_C .DB 000H ; CYLINDER -FCD_H .DB 000H ; HEAD -FCD_R .DB 001H ; RECORD -FCD_D .DB 0E5H ; FORMAT DATA FILL BYTE -FCD_X .DB 002H ; FORMAT INTERLEAVE FACTOR (1...N) -FCD_ND .DB 000H ; DMA, 0=DMA, 1=NON-DMA - ; STATIC CONFIGURATION, NEVER CHANGES (PRIVATE) -FCD_SOT .DB 001H ; STARTING SECTOR NUMBER OF TRACK -FCD_MT .DB 000H ; MULTI-TRACK, WE DON'T USE, SET TO 0 -FCD_MFM .DB 001H ; MFM, 0=FM, 1=MFM, WE USE MFM ALWAYS -FCD_SK .DB 000H ; SKIP MODE, WE DON'T USE, SET TO 0 -FCD_N .DB 002H ; SECTOR SIZE, N=2 FOR 512 BYTES -FCD_DTL .DB 0FFH ; DATA LENGTH (WHEN N=0, SET TO FF OTHERWISE) -FCD_STP .DB 001H ; SECTOR SCAN TYPE, 1=CONTIG, 2=ALTERNATING - ; CONTROL STUFF (PUBLIC) -FCD_TRACE .DB 00H ; TRACE LEVEL -; -; -; FDC CMD PARM PROMPTS -; -FCPP_TRK .TEXT "TRACK$" -FCPP_HEAD .TEXT "HEAD$" -FCPP_SEC .TEXT "SECTOR$" -FCPP_DOR .TEXT "DOR$" -; -; FDC EXECUTION ROUTINE JUMP TABLE -; -FXRJ_NOP: JP FXR_NOP -FXRJ_READ: JP FXR_READ -FXRJ_READDEL: JP FXR_READDEL -FXRJ_WRITE: JP FXR_WRITE -FXRJ_WRITEDEL: JP FXR_WRITEDEL -FXRJ_READTRK: JP FXR_READTRK -FXRJ_READID: JP FXR_READID -FXRJ_FMTTRK: JP FXR_FMTTRK -FXRJ_SCANEQ: JP FXR_SCANEQ -FXRJ_SCANLOEQ: JP FXR_SCANLOEQ -FXRJ_SCANHIEQ: JP FXR_SCANHIEQ -FXRJ_RECAL: JP FXR_RECAL -FXRJ_SENSEINT: JP FXR_SENSEINT -FXRJ_SPECIFY: JP FXR_SPECIFY -FXRJ_DRVSTAT: JP FXR_DRVSTAT -FXRJ_SEEK: JP FXR_SEEK -FXRJ_VERSION JP FXR_VERSION -; -; FDC COMMAND STRINGS -; -FCS_NOP: .TEXT "NOP$" -FCS_READ: .TEXT "READ$" -FCS_READDEL: .TEXT "READ DELETED$" -FCS_WRITE: .TEXT "WRITE$" -FCS_WRITEDEL: .TEXT "WRITE DELETED$" -FCS_READTRK: .TEXT "READ TRACK$" -FCS_READID: .TEXT "READ ID$" -FCS_FMTTRK: .TEXT "FORMAT TRACK$" -FCS_SCANEQ: .TEXT "SCAN EQUAL$" -FCS_SCANLOEQ: .TEXT "SCAN LOW OR EQUAL$" -FCS_SCANHIEQ: .TEXT "SCAN HIGH OR EQUAL$" -FCS_RECAL: .TEXT "RECALIBRATE$" -FCS_SENSEINT: .TEXT "SENSE INTERRUPT$" -FCS_SPECIFY: .TEXT "SPECIFY$" -FCS_DRVSTAT: .TEXT "DRIVE STATUS$" -FCS_SEEK: .TEXT "SEEK$" -FCS_VERSION: .TEXT "VERSION$" -; -; FDC COMMAND TABLE -; -FCT .DB CMD_READ \ .DW FCS_READ, FXRJ_READ -FCT_ENTSIZ .EQU $ - FCT - .DB CMD_READDEL \ .DW FCS_READDEL, FXRJ_READDEL - .DB CMD_WRITE \ .DW FCS_WRITE, FXRJ_WRITE - .DB CMD_WRITEDEL \ .DW FCS_WRITEDEL, FXRJ_WRITEDEL - .DB CMD_READTRK \ .DW FCS_READTRK, FXRJ_READTRK - .DB CMD_READID \ .DW FCS_READID, FXRJ_READID - .DB CMD_FMTTRK \ .DW FCS_FMTTRK, FXRJ_FMTTRK - .DB CMD_SCANEQ \ .DW FCS_SCANEQ, FXRJ_SCANEQ - .DB CMD_SCANLOEQ \ .DW FCS_SCANLOEQ, FXRJ_SCANLOEQ - .DB CMD_SCANHIEQ \ .DW FCS_SCANHIEQ, FXRJ_SCANHIEQ - .DB CMD_RECAL \ .DW FCS_RECAL, FXRJ_RECAL - .DB CMD_SENSEINT \ .DW FCS_SENSEINT, FXRJ_SENSEINT - .DB CMD_SPECIFY \ .DW FCS_SPECIFY, FXRJ_SPECIFY - .DB CMD_DRVSTAT \ .DW FCS_DRVSTAT, FXRJ_DRVSTAT - .DB CMD_SEEK \ .DW FCS_SEEK, FXRJ_SEEK - .DB CMD_VERSION \ .DW FCS_VERSION, FXRJ_VERSION -FCT_COUNT .EQU (($ - FCT) / FCT_ENTSIZ) ; # ENTRIES IN TABLE -; -; ENTRY POINTS FOR FDC COMMANDS -; -FC_READ: - LD A,CMD_READ - LD B,0FFH ; MT & MFM & SK & CMD BITS - LD (FCP_CMD),A - LD HL,FXR_READ - LD (FXP_XR),HL - CALL FC_SETUPIO - CALL FC_CMDPROC - RET - -FC_READDEL: - LD A,CMD_READDEL - LD B,0FFH ; MT & MFM & SK & CMD BITS - LD (FCP_CMD),A - LD HL,FXR_READDEL - LD (FXP_XR),HL - CALL FC_SETUPIO - CALL FC_CMDPROC - RET - -FC_WRITE: - LD A,CMD_WRITE - LD B,0DFH ; MT & MFM & CMD BITS - LD (FCP_CMD),A - LD HL,FXR_WRITE - LD (FXP_XR),HL - CALL FC_SETUPIO - CALL FC_CMDPROC - RET - -FC_WRITEDEL: - LD A,CMD_WRITEDEL - LD B,0DFH ; MT & MFM & CMD BITS - LD (FCP_CMD),A - LD HL,FXR_WRITEDEL - LD (FXP_XR),HL - CALL FC_SETUPIO - CALL FC_CMDPROC - RET - -FC_READTRK: - LD A,CMD_READTRK - LD B,07FH ; MFM & SK & CMD BITS - LD (FCP_CMD),A - LD HL,FXR_READTRK - LD (FXP_XR),HL - CALL FC_SETUPIO - CALL FC_CMDPROC - RET - -FC_READID: - LD A,CMD_READID - LD B,05FH ; MFM & CMD BITS - LD (FCP_CMD),A - LD HL,FXR_READID - LD (FXP_XR),HL - CALL FC_SETUPCMD - CALL FC_CMDPROC - RET - -FC_FMTTRK: - LD A,CMD_FMTTRK - LD B,05FH ; MFM & CMD BITS - LD (FCP_CMD),A - LD HL,FXR_FMTTRK - LD (FXP_XR),HL - CALL FC_SETUPFMT - CALL FC_CMDPROC - RET - -FC_SCANEQ: - LD A,CMD_SCANEQ - LD B,0FFH ; MT & MFM & SK & CMD BITS - LD (FCP_CMD),A - LD HL,FXR_SCANEQ - LD (FXP_XR),HL - CALL FC_SETUPSCAN - CALL FC_CMDPROC - RET - -FC_SCANLOEQ: - LD A,CMD_SCANLOEQ - LD B,0FFH ; MT & MFM & SK & CMD BITS - LD (FCP_CMD),A - LD HL,FXR_SCANLOEQ - LD (FXP_XR),HL - CALL FC_SETUPSCAN - CALL FC_CMDPROC - RET - -FC_SCANHIEQ: - LD A,CMD_SCANHIEQ - LD B,0FFH ; MT & MFM & SK & CMD BITS - LD (FCP_CMD),A - LD HL,FXR_SCANHIEQ - LD (FXP_XR),HL - CALL FC_SETUPSCAN - CALL FC_CMDPROC - RET - -FC_RECAL: - LD A,CMD_RECAL - LD B,01FH ; CMD BITS ONLY - LD (FCP_CMD),A - LD HL,FXR_RECAL - LD (FXP_XR),HL - CALL FC_SETUPSEEK ; SPECIALIZATION OF SEEK - LD A,2 ; GENERIC COMMAND, BUT JUST FIRST COMMAND CODE - LD (FCP_BUFLEN),A - CALL FC_CMDPROC - RET - -FC_SENSEINT: - LD A,CMD_SENSEINT - LD B,01FH ; CMD BITS ONLY - LD (FCP_CMD),A - LD HL,FXR_SENSEINT - LD (FXP_XR),HL - CALL FC_SETUPCMD - LD A,1 ; GENERIC COMMAND, BUT JUST FIRST COMMAND CODE - LD (FCP_BUFLEN),A - CALL FC_CMDPROC - RET - -FC_SPECIFY: - LD A,CMD_SPECIFY - LD B,01FH ; CMD BITS ONLY - LD (FCP_CMD),A - LD HL,FXR_SPECIFY - LD (FXP_XR),HL - CALL FC_SETUPSPECIFY - CALL FC_CMDPROC - RET - -FC_DRVSTAT: - LD A,CMD_DRVSTAT - LD B,01FH ; CMD BITS ONLY - LD (FCP_CMD),A - LD HL,FXR_DRVSTAT - LD (FXP_XR),HL - CALL FC_SETUPCMD - CALL FC_CMDPROC - RET - -FC_SEEK: - LD A,CMD_SEEK - LD B,01FH ; CMD BITS ONLY - LD (FCP_CMD),A - LD HL,FXR_SEEK - LD (FXP_XR),HL - CALL FC_SETUPSEEK - CALL FC_CMDPROC - RET - -FC_VERSION: - LD A,CMD_VERSION - LD B,01FH ; CMD BITS ONLY - LD (FCP_CMD),A - LD HL,FXR_VERSION - LD (FXP_XR),HL - CALL FC_SETUPCMD - LD A,1 ; GENERIC COMMAND, BUT JUST FIRST COMMAND CODE - LD (FCP_BUFLEN),A - CALL FC_CMDPROC - RET -; -; HELPER FUNCTIONS TO SETUP CMDBUF -; -FC_SETUPCMD: - PUSH BC ; B CONTAINS BIT MASK TO USE FOR FIRST BYTE - ; SO THAT WE CAN MASK OFF BITS THAT ARE NOT - ; USED FOR CERTAIN COMMANDS - LD DE,FCP_BUF - - AND 01FH ; REMOVE ANY EXTRANEOUS BITS FROM COMMAND BYTE - LD C,A ; SAVE THE COMMAND - LD A,(FCD_MT) ; GET MT BIT - AND 01H ; MASK TO REMOVE IRRELEVANT BITS FOR SAFETY - RLA ; MAKE ROOM FOR MFM - LD B,A ; SAVE WHAT WE HAVE SO FAR IN B - LD A,(FCD_MFM) ; GET MFM BIT - AND 01H ; MASK TO REMOVE IRRELEVANT BITS FOR SAFETY - OR B ; COMBINE WITH SAVED - RLA ; MAKE ROOM FOR SK - LD B,A ; SAVE WHAT WE HAVE SO FAR IN B - LD A,(FCD_SK) ; GET SK BIT - AND 01H ; MASK TO REMOVE IRRELEVANT BITS FOR SAFETY - OR B ; COMBINE WITH SAVED - RLA ; MAKE ROOM FOR THE COMMAND BITS - RLA - RLA - RLA - RLA - LD B,C ; RECOVER THE COMMAND VALUE - OR B ; COMBINE WITH SAVED - POP BC ; GET THE BIT MASK FOR FIRST BYTE - AND B ; APPLY IT - LD (DE),A ; SAVE THE BYTE - INC DE - - LD A,(FCD_H) ; START WITH HDS - AND 01H ; MASK TO REMOVE IRRELEVANT BITS FOR SAFETY - RLA ; MAKE ROOM FOR DS BITS - RLA ; - LD B,A ; SAVE WHAT WE HAVE SO FAR IN B - LD A,(FCD_DS) ; GET DS VALUE - AND 03H ; MASK TO REMOVE IRRELEVANT BITS FOR SAFETY - OR B ; COMBINE WITH SAVED - LD (DE),A ; SAVE THE BYTE - INC DE - - LD A,2 ; THIS IS A 2 BYTE COMMAND STRING - LD (FCP_BUFLEN),A - - RET - -FC_SETUPIO: - CALL FC_SETUPCMD - - LD A,(FCD_C) - LD (DE),A - INC DE - - LD A,(FCD_H) - LD (DE),A - INC DE - - LD A,(FCD_R) - LD (DE),A - INC DE - - LD A,(FCD_N) - LD (DE),A - INC DE - - ; V5.3, USE EOT=R TO R/W ONLY ONE SECTOR - ;LD A,(FCD_EOT) - LD A,(FCD_R) - LD (DE),A - INC DE - - LD A,(FCD_GPL) - LD (DE),A - INC DE - - LD A,(FCD_DTL) - LD (DE),A - INC DE - - LD A,9 - LD (FCP_BUFLEN),A - - RET - -FC_SETUPFMT: - CALL FC_SETUPCMD - - LD A,(FCD_N) - LD (DE),A - INC DE - - LD A,(FCD_SC) - LD (DE),A - INC DE - - LD A,(FCD_GPLF) - LD (DE),A - INC DE - - LD A,(FCD_D) - LD (DE),A - INC DE - - LD A,6 - LD (FCP_BUFLEN),A - -; SETUP FORMAT BUFFER WITH SECTOR ID INFO FOR ENTIRE TRACK - (C,H,S,N) FOR EACH SECTOR -; INTERLEAVE AS REQUESTED -; -; B = CURRENT INTERLEAVE PASS STARTING SECTOR ID -; C = CURRENT SECTOR ID -; H = INTERLEAVE STEP -; L = LAST SECTOR ID + 1 -; DE = BUFFER POINTER -; - - PUSH DE - PUSH HL - - ; COMPUTE INTERLEAVE STEP - LD H,-1 - LD A,(FCD_X) - LD B,A - LD A,(FCD_SC) -LOOP: - INC H - SUB B - JR NC,LOOP - - LD DE,FXP_BUF ; DE POINTS TO START OF BUFFER - - LD A,(FCD_SOT) ; GET FIRST SECTOR ID - LD B,A ; B = FIRST SECTOR ID FOR CURRENT INTERLEAVE PASS - LD C,A ; C = SECTOR ID - - LD A,(FCD_SC) ; NUM SECTORS TO SET UP - ADD A,C - LD L,A ; L = LAST SECTOR ID + 1 - -FC_SETUPFMT1: - ; CYLINDER - LD A,(FCD_C) - LD (DE),A - INC DE - - ; HEAD - LD A,(FCD_H) - LD (DE),A - INC DE - - ; SECTOR ID - LD A,C - LD (DE),A - INC DE - - ; SECTOR SIZE - LD A,(FCD_N) - LD (DE),A - INC DE - - ; INC SECTOR ID BY INTERLEAVE STEP - LD A,H - ADD A,C - LD C,A - - ; LOOP IF WE HAVE NOT GOTTEN PAST LAST SECTOR ID - CP L - JP M,FC_SETUPFMT1 - - ; SETUP FOR NEXT INTERLEAVE PASS - INC B - LD C,B - - ; LOOP IF WE ARE NOT DONE - LD A,H - CP C - JP P,FC_SETUPFMT1 - - ; DONE, FINALIZE BUFFER - LD A,(FCD_SC) ; GET SECTOR COUNT - RLCA ; MULTIPLY BY 4 - RLCA - LD (FXP_BUFLEN),A ; STORE AS BUFFER LENGTH - - POP HL - POP DE - RET - -FC_SETUPSCAN: - CALL FC_SETUPIO ; START WITH GENERIC IO CMD - - LD DE,FCP_BUF+8 ; REPLACE DTL WITH STP - LD A,(FCD_STP) - LD (DE),A - - RET - -FC_SETUPSEEK: - CALL FC_SETUPCMD ; START WITH GENERIC IO CMD - - LD A,(FCD_C) - LD (DE),A - INC DE - - LD DE,FCP_BUF ; REMOVE EXTRANEOUS BITS FROM CC0 - LD A,(DE) - AND 0FH - LD (DE),A - - LD A,3 - LD (FCP_BUFLEN),A - - RET - -FC_SETUPSPECIFY: - CALL FC_SETUPCMD - DEC DE ; BACKUP 1 BYTE, WE ONLY WANT FIRST BYTE - - LD A,(FCD_SRTHUT) - LD (DE),A ; SAVE THE BYTE - INC DE - - LD A,(FCD_HLT) - AND 07FH - RLA - LD B,A - LD A,(FCD_ND) - AND 01H - OR B - LD (DE),A ; SAVE THE BYTE - INC DE - - LD A,3 - LD (FCP_BUFLEN),A - - RET -; -; MAIN FDC COMMAND PROCESSOR -; -FC_CMDPROC: - CALL FOP - CALL FC_PRTRESULTS - RET -; -; FDC SEQUENCE INITIALIZATION -; -FC_INIT: - LD HL,FDCBM - LD A,(HL) - AND _DIO - JR NZ,FC_INIT1 - LD A,(HL) - AND _ZETA | _DIO3 - JR NZ,FC_INIT2 - LD A,(HL) - AND _PCAT - JR NZ,FC_INIT3 - LD A,(HL) - AND _RCSMC - JR NZ,FC_INIT4 - RET -FC_INIT1: ; DIO - LD A,(FCD_DORA) - JR FC_INIT5 -FC_INIT2: ; ZETA, DIO3 - LD A,(FCD_DORB) - JR FC_INIT5 -FC_INIT3: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO - LD A,(FCD_DORC) - JR FC_INIT5 -FC_INIT4: ; WDSMC - LD A,(FCD_DORD) - JR FC_INIT5 - -FC_INIT5: - LD (FST_DOR),A - CALL FC_SETDOR - RET -; -; SET FST_DOR -; -FC_SETDOR: - PUSH AF - LD A,(FST_DOR) - LD C,(IY+CFG_DOR) - OUT (C),A - POP AF - RET -; -; RESET FDC BY PULSING BIT 7 OF DOR LOW -; NOTE: DIO HARDWARE HAS NO MECHANISM TO PULSE RESET VIA SOFTWARE -; -FC_RESETFDC: - LD C,(IY+CFG_DOR) - LD HL,FDCBM - LD A,(HL) - AND _ZETA | _DIO3 | _RCSMC - JR NZ,FC_RESETFDC1 - LD A,(HL) - AND _PCAT - JR NZ,FC_RESETFDC2 - RET -FC_RESETFDC1: ; ZETA, DIO3, RCSMC - LD A,(FST_DOR) - PUSH AF - RES 7,A - OUT (C),A - CALL DELAY - POP AF - OUT (C),A - JR FC_RESETFDC3 -FC_RESETFDC2: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO - LD A,0 - OUT (C),A - LD A,(FST_DOR) - OUT (C),A - JR FC_RESETFDC3 -FC_RESETFDC3: - LD DE,156 ; DELAY: 16us * 156 = 2.5ms - CALL VDELAY - - RET -; -; PULSE TERMCT TO TERMINATE ANY ACTIVE EXECUTION PHASE -; -FC_PULSETC: - ; V5.3, USE EOT=R TO R/W ONLY ONE SECTOR - ;LD A,(FDCBM) - ;AND _PCAT - ;JR NZ,FC_PULSETC1 - ;; NOT DIDE, N8, ZETA2, RCSMC, SMZ80 - ;LD C,(IY+CFG_DOR) - ;LD A,(FST_DOR) - ;SET 0,A - ;OUT (C),A - ;RES 0,A - ;OUT (C),A - ;JR FC_PULSETC2 -;FC_PULSETC1: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO - ;LD C,(IY+CFG_TC) - ;IN A,(C) - ;JR FC_PULSETC2 -;FC_PULSETC2: - RET -; -; SET FST_DOR FOR MOTOR CONTROL ON -; -FC_MOTORON: - LD HL,FDCBM - LD A,(HL) - AND _DIO - JR NZ,FC_MOTORON1 - LD A,(HL) - AND _ZETA | _DIO3 - JR NZ,FC_MOTORON2 - LD A,(HL) - AND _PCAT - JR NZ,FC_MOTORON3 - LD A,(HL) - AND _RCSMC - JR NZ,FC_MOTORON4 - RET -FC_MOTORON1: ; DIO - LD HL,FST_DOR ; POINT TO FDC_DOR - RES 1,(HL) ; SET MOTOR ON - JR FC_MOTORON5 -FC_MOTORON2: ; ZETA, DIO3 - LD HL,FST_DOR ; POINT TO FDC_DOR - SET 1,(HL) - JR FC_MOTORON5 -FC_MOTORON3: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO - LD HL,FST_DOR ; POINT TO FDC_DOR - LD A,(HL) ; START WITH CURRENT DOR - AND 11111100B ; GET RID OF ANY ACTIVE DS BITS - LD C,A ; SAVE IT FOR NOW - LD A,(FCD_DS) ; NOW GET CURRENT DS - LD B,A ; PUT IN B FOR LATER - OR C ; COMBINE WITH SAVED DOR - LD C,A ; RE-SAVE IT - INC B ; SET UP B AS LOOP COUNTER (DS + 1) - LD A,00001000B ; STARTING BIT PATTERN FOR MOTOR -FC_MOTORON3A: - RLA ; SHIFT LEFT - DJNZ FC_MOTORON3A ; DS TIMES - OR C ; COMBINE WITH SAVED - LD (HL),A ; COMMIT THE NEW VALUE TO FST_DOR - JR FC_MOTORON5 -FC_MOTORON4: ; RCSMC - LD A,(FCD_DS) ; GET CURRENT DS - LD C,00000010B ; ASSUME MOTORA (BIT 1) - OR A ; TEST FOR DS 0 - JR Z,FC_MOTORON4A ; IF SO, CONTINUE W/ MOTORA - LD C,00000100B ; OTHERWISE, MOTORB (BIT 2) -FC_MOTORON4A: - LD A,(FST_DOR) ; GET CURRENT DOR VALUE - OR C ; APPLY NEW MOTOR BIT - LD (FST_DOR),A ; COMMIT NEW VALUE - JR FC_MOTORON5 -FC_MOTORON5: - CALL FC_SETDOR ; OUTPUT TO CONTROLLER - CALL LDELAY ; WAIT 1/2 SEC ON MOTOR START FOR SPIN-UP - LD A,(FDCBM) - AND _PCAT - RET Z - LD A,(FCD_DCR) - LD C,(IY+CFG_DCR) - OUT (C),A - RET -; -; SET FST_DOR FOR MOTOR CONTROL OFF -; -FC_MOTOROFF: - LD HL,FDCBM - LD A,(HL) - AND _DIO - JR NZ,FC_MOTOROFF1 - LD A,(HL) - AND _ZETA | _DIO3 - JR NZ,FC_MOTOROFF2 - LD A,(HL) - AND _PCAT - JR NZ,FC_MOTOROFF3 - LD A,(HL) - AND _RCSMC - JR NZ,FC_MOTOROFF4 - RET -FC_MOTOROFF1: ; DIO - LD HL,FST_DOR ; POINT TO FDC_DOR - SET 1,(HL) ; SET MOTOR OFF - JR FC_MOTOROFF5 -FC_MOTOROFF2: ; ZETA, DIO3 - LD HL,FST_DOR ; POINT TO FDC_DOR - RES 1,(HL) - JR FC_MOTOROFF5 -FC_MOTOROFF3: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO - LD HL,FST_DOR ; POINT TO FDC_DOR - LD A,DORC_INIT - LD (HL),A - JR FC_MOTOROFF5 -FC_MOTOROFF4: ; RCSMC - LD HL,FST_DOR ; POINT TO FDC_DOR - RES 1,(HL) ; CLEAR MOTORA - RES 2,(HL) ; CLEAR MOTORB - JR FC_MOTOROFF5 - -FC_MOTOROFF5: - CALL FC_SETDOR ; OUTPUT TO CONTROLLER - RET -; -;=============================================================================== -; FDC OPERATIONS -;=============================================================================== -; -FOP: -; -; INITIALIZATION -; - LD A,0 - LD (FRB_LEN),A - - LD A,FRC_OK - LD (FST_RC),A - - LD B,0 ; B IS LOOP COUNTER - LD C,(IY+CFG_MSR) ; SET C TO MSR PORT -FOP_CLR1: - CALL DELAY ; FDC MAY TAKE UP TO 12us TO UPDATE MSR - IN A,(C) ; GET STATUS - LD (FST_MSR),A ; SAVE IT FOR POTENTIAL LATER DIAGNOSIS - AND 0C0H ; ISOLATE HIGH NIBBLE, RQM/DIO/EXM/CB - CP 0C0H ; LOOKING FOR RQM=1, DIO=1, BYTES PENDING - JP NZ,FOP_CMD1 ; NO BYTES PENDING, GO TO NEXT PHASE - INC C ; SWITCH TO DATA PORT - IN A,(C) ; GET THE PENDING BYTE AND DISCARD - DEC C ; SWITCH BACK TO MSR PORT - DJNZ FOP_CLR1 ; KEEP CHECKING TILL COUNTER EXHAUSTER - JP FOP_TOFDCRDY ; OTHERWISE, TIMEOUT -; -; SEND COMMAND -; -FOP_CMD1: - LD HL,FCP_BUF - LD A,(FCP_BUFLEN) - LD D,A ; D = CMD BYTES TO SEND - -FOP_CMD2: ; START OF LOOP TO SEND NEXT BYTE - LD B,0 ; B IS LOOP COUNTER - -FOP_CMD4: ; START OF STATUS LOOP, WAIT FOR FDC TO BE READY FOR BYTE - CALL DELAY ; FDC MAY TAKE UP TO 12us TO UPDATE MSR - ; TYPICAL MSR TRANSITIONS: 80 10 90 90 - LD C,(IY+CFG_MSR) ; SET C TO MSR PORT - IN A,(C) ; READ MAIN STATUS REGISTER - LD (FST_MSR),A ; SAVE IT FOR POTENTIAL LATER DIAGNOSIS - AND 0C0H ; ISOLATE RQM/DIO - CP 080H ; LOOKING FOR RQM=1, DIO=0 (FDC READY FOR A BYTE) - JP Z,FOP_CMD6 ; GOOD, GO TO SEND BYTE - CP 0C0H ; HMMMM... RQM=1 & DIO=1, FDC WANTS TO SEND US DATA, UNEXPECTED - JP Z,FOP_RES ; GO IMMEDIATELY TO RESULTS??? - DJNZ FOP_CMD4 ; LOOP TILL COUNTER EXHAUSTED - JP FOP_TOSNDCMD ; COUNTER EXHAUSTED, TIMEOUT / EXIT - -FOP_CMD6: ; SEND NEXT BYTE - LD A,(HL) ; POINT TO NEXT BYTE TO SEND - LD C,(IY+CFG_DATA) ; SET C TO DATA PORT - OUT (C),A ; PUSH IT TO FDC - INC HL ; INCREMENT POINTER FOR NEXT TIME - DEC D ; DECREMENT NUM BYTES LEFT TO SEND - JP NZ,FOP_CMD2 ; DO NEXT BYTE - -; -; EXECUTION PHASE -; -FOP_X1: - LD HL,(FXP_XR) ; LOAD THE EXECUTION ROUTINE ADDRESS - CALL JPHL ; CALL INDIRECTLY VIA HL - - LD A,(FST_RC) ; CURRENT RESULT CODE - ;CALL PC_SPACE - ;CALL PRTHEXBYTE - CP FRC_OK ; ERROR? - RET NZ ; IF SO, ALL DONE - -; JP FOP_RES ; CONTINUE WITH GETRESULTS - -; -; RESULTS PHASE -; -FOP_RES: - LD B,0 ; B = BYTES RECEIVED - LD HL,FRB_LEN ; POINT TO BUFFER LENGTH - LD (HL),B ; UPDATE NUMBER OF BYTES RECEIVED - LD HL,FRB ; POINT TO RECEIVE BUFFER - -FOP_RES0: - LD DE,0 ; DE IS LOOP COUNTER - LD C,(IY+CFG_MSR) ; SET C TO MSR PORT - -FOP_RES1: - CALL DELAY ; FDC MAY TAKE UP TO 12us TO UPDATE MSR - IN A,(C) ; READ MAIN STATUS REGISTER - ;CALL PC_SPACE - ;CALL PRTHEXBYTE - LD (FST_MSR),A ; SAVE IT FOR POTENTIAL LATER DIAGNOSIS - AND $F0 ; REMOVE SEEK BITS - CP $D0 ; LOOKING FOR RQM=1, DIO=1, BUSY=1 (FDC BYTE PENDING) - JR Z,FOP_RES2 ; GOOD, GO TO RECEIVE BYTE - CP $80 ; DONE? - JR Z,FOP_EVAL ; IF SO, GO TO EVAL - DEC DE - LD A,D - OR E - JP NZ,FOP_RES1 - JP FOP_TOGETRES ; OTHERWISE TIMEOUT ERROR - -FOP_RES2: ; PROCESS NEXT PENDING BYTE - LD A,FRB_SIZ ; GET BUF SIZE - CP B ; REACHED MAX? - JP Z,FOP_BUFMAX ; HANDLE BUF MAX/EXIT - INC C ; SWITCH TO DATA PORT - IN A,(C) ; GET THE BYTE - DEC C ; SWITCH TO MSR PORT - LD (HL),A ; SAVE VALUE - INC HL ; INCREMENT BUF POS - INC B ; INCREMENT BYTES RECEIVED - PUSH HL ; SAVE HL - LD HL,FRB_LEN ; POINT TO BUFFER LENGTH - LD (HL),B ; UPDATE NUMBER OF BYTES RECEIVED - POP HL ; RESTORE HL - JR FOP_RES0 ; CONTINUE READ LOOP - -; -; EXIT POINTS -; -FOP_NOTIMPL: - LD A,FRC_NOTIMPL - JP FOP_ERR - -FOP_CMDERR: - LD A,FRC_CMDERR - JP FOP_ERR - -FOP_ERROR: - LD A,FRC_ERROR - JP FOP_ERR - -FOP_ABORT: - LD A,FRC_ABORT - JP FOP_ERR - -FOP_BUFMAX: - LD A,FRC_BUFMAX - JP FOP_ERR - -FOP_TOFDCRDY: - LD A,FRC_TOFDCRDY - JP FOP_ERR - -FOP_TOSNDCMD: - LD A,FRC_TOSNDCMD - JP FOP_ERR - -FOP_TOGETRES: - LD A,FRC_TOGETRES - JP FOP_ERR - -FOP_TOEXEC: - LD A,FRC_TOEXEC - JP FOP_ERR - -FOP_ERR: - LD (FST_RC),A - -FOP_EVAL: - LD A,(FCP_CMD) - ; DRVSTAT IS WEIRD, HAS ONLY ST3, NOTHING TO EVAL - CP CMD_DRVSTAT - JP Z,FOP_EXIT - ; DO WE HAVE ST0? - LD A,(FRB_LEN) - CP 1 - JP M,FOP_EXIT - -FOP_EVALST0: - LD A,(FRB_ST0) - AND 11000000B - CP 01000000B ; ABTERM - JR Z,FOP_ABTERM - CP 10000000B ; INVCMD - JR Z,FOP_INVCMD - CP 11000000B ; DSKCHG - JR Z,FOP_DSKCHG - JR FOP_EXIT - -FOP_ABTERM: - ; SENSEINT DOES NOT USE ST1 - LD A,(FCP_CMD) - CP CMD_SENSEINT - JR Z,FOP_ABTERM1 - ; DO WE HAVE ST1? - LD A,(FRB_LEN) - CP 2 - JP M,FOP_ABTERM1 - JR FOP_EVALST1 -FOP_ABTERM1: ; NO FURTHER DATA, SET FST TO ABTERM - LD A,FRC_ABTERM - JP FOP_SETFST - -FOP_INVCMD: - LD A,FRC_INVCMD - JP FOP_SETFST - -FOP_DSKCHG: - LD A,FRC_DSKCHG - JP FOP_SETFST - -FOP_EVALST1: - LD A,(FRB_ST1) - BIT 7,A - JP NZ,FOP_ENDCYL - BIT 5,A - JP NZ,FOP_DATAERR - BIT 4,A - JP NZ,FOP_OVERRUN - BIT 2,A - JP NZ,FOP_NODATA - BIT 1,A - JP NZ,FOP_NOTWRIT - BIT 0,A - JP NZ,FOP_MISADR - JP FOP_EXIT - -FOP_ENDCYL: - ; V5.3, USE EOT=R TO R/W ONLY ONE SECTOR - ;LD A,FRC_ENDCYL - ;JP FOP_SETFST - JP FOP_EXIT - -FOP_DATAERR: - LD A,FRC_DATAERR - JP FOP_SETFST - -FOP_OVERRUN: - LD A,FRC_OVERRUN - JP FOP_SETFST - -FOP_NODATA: - LD A,FRC_NODATA - JP FOP_SETFST - -FOP_NOTWRIT: - LD A,FRC_NOTWRIT - JP FOP_SETFST - -FOP_MISADR: - LD A,FRC_MISADR - JP FOP_SETFST - -FOP_SETFST: - LD (FST_RC),A - -FOP_EXIT: - RET - -; -; EXECUTION ROUTINES -; -FXR_READID: - JP FXRX - -FXR_READ: - LD HL,BUFFER ; POINT TO SECTOR BUFFER START - LD DE,(FCD_SECSZ) - - LD A,(DCD_MD) ; FIX: SHOULD NOT BE USING DCD HERE - CP MD_POLL - JP Z,FXRR - CP MD_INT - JP Z,IFXRR - CP MD_INTFAST - JP Z,FFXRR - CP MD_INTWAIT - JP Z,WFXRR - CP MD_DRQWAIT - JP Z,WFXRR - JP FXR_NOTIMPL - -FXR_WRITE: - LD HL,BUFFER ; POINT TO SECTOR BUFFER START - LD DE,(FCD_SECSZ) - - LD A,(DCD_MD) ; FIX: SHOULD NOT BE USING DCD HERE - CP MD_POLL - JP Z,FXRW - CP MD_INT - JP Z,IFXRW - CP MD_INTFAST - JP Z,FFXRW - CP MD_INTWAIT - JP Z,WFXRW - CP MD_DRQWAIT - JP Z,WFXRW - JP FXR_NOTIMPL - -FXR_FMTTRK: - LD HL,FXP_BUF ; POINT TO BUFFER START - LD D,0 - LD A,(FXP_BUFLEN) ; GET BYTE COUNT TO WRITE - LD E,A - - LD A,(DCD_MD) ; FIX: SHOULD NOT BE USING DCD HERE - CP MD_POLL - JP Z,FXRW - CP MD_INT - JP Z,IFXRW - CP MD_INTFAST - JP Z,IFXRW ; CAN'T USE FFXRW BECAUSE IT IS NOT 512 BYTES - CP MD_INTWAIT - JP Z,WFXRW - CP MD_DRQWAIT - JP Z,WFXRW - JP FXR_NOTIMPL - -FXR_NOTIMPL: -FXR_READDEL: -FXR_WRITEDEL: -FXR_READTRK: -FXR_SCANEQ: -FXR_SCANLOEQ: -FXR_SCANHIEQ: - LD A,FRC_NOTIMPL - LD (FST_RC),A - ; FALL THROUGH TO RET BELOW -FXR_NOP: -FXR_RECAL: -FXR_SENSEINT: -FXR_SPECIFY: -FXR_DRVSTAT: -FXR_SEEK: -FXR_VERSION: - RET -; -; NULL EXECUTION, NO DATA TO READ/WRITE (USED BY READID) -; -FXRX: - LD DE,1000H ; DE IS LOOP COUNTER, 4096 ITERATIONS OF 25ms - LD C,(IY+CFG_MSR) ; SET C TO MSR PORT -FXRX1: - CALL DELAY - IN A,(C) ; GET MSR - ;AND 0E0H ; ISOLATE RQM/DIO/EXM - CP $D0 ; WE WANT RQM=1,DIO=1,EXM=0 (READY TO READ A BYTE W/ EXEC INACTIVE) - JP Z,FXR_END ; GOT IT, EXIT CLEAN - DEC DE ; DECREMENT COUNTER (16 BIT) - LD A,D ; CHECK FOR ZERO - OR E ; " - JR NZ,FXRX1 ; NOT ZERO YET, KEEP CHECKING - JP FXR_TO ; OTHERWISE, TIMEOUT ERROR - RET - -; -; READ DATA -; -FXRR: LD A,E ; LOW BYTE OF COUNT TO ACCUM - OR A ; TEST FOR ZERO - JR Z,FXRR1 ; IF ZERO, DO NOT ADJUST ITERATIONS - INC D ; OTHERWISE, ITERATIONS IS ONE MORE THAN HIGH BYTE -FXRR1: LD B,E ; LOW BYTE OF COUNT TO B - LD A,D ; HIGH BYTE OF COUNT - LD (FXP_ITER),A ; ... IS ITERATION COUNT - LD A,(CPUSPD) ; CPU SPEED SCALER - LD (FXP_TO),A ; SAVE IT AS OUTER LOOP TIMEOUT - LD IX,FXP_TO ; (IX) IS FXP_TO, (IX+1) IS FCP_ITER - LD C,(IY+CFG_DATA) ; SET C TO DATA PORT - LD DE,0 - DI ; DISABLE INTERRUPTS TO AVOID OVERRUN -FXRR2: DEC C ; [04] SET C TO MSR PORT -FXRR3: LD DE,0 ; [10] TIMEOUT COUNTER -FXRR4: IN A,(C) ; [12] GET MSR - CP $F0 ; [07] BYTE READY? - JR Z,FXRR5 ; [12/7] GET IT - ;LD (FST_MSR),A ; [13] *DEBUG* SAVE MSR FOR LATER - DEC E ; [04] DEC LSB OF INNER TIMEOUT COUNTER - JR NZ,FXRR4 ; [12/7] LOOP IF LSB IS NOT EXHAUSTED - CP $D0 ; [07] IF RQM=1, DIO=1, EXM=0, CB=1, EXECUTION ABORTED - JP Z,FXR_ABORT ; [10] IF NOT SET, EXECUTION ABORTED - DEC D ; [04] DEC MSB OF INNER TIMEOUT COUNTER - JR NZ,FXRR4 ; [12/7] LOOP IF MSB IS NOT EXHAUSTED - DEC (IX) ; [23] DECREMENT OUTER LOOP COUNTER - JR NZ,FXRR3 ; [12/7] LOOP IF NOT EXHAUSTED - JP FXR_TO ; [10] OTHERWISE, HANDLE TIMEOUT -FXRR5: INC C ; [04] POINT TO DATA PORT - INI ; [16] (HL) := (C), HL++, B-- - JR NZ,FXRR2 ; [12/7] LOOP - DEC (IX+1) ; [23] DECREMENT ITERATION COUNT - JR NZ,FXRR2 ; [12] IF MORE ITERATIONS, LOOP - JP FXR_END ; [10] ELSE DONE - -; -; INT READ DATA - SAFE VERSION -; HANDLES FDC ERRORS, BUT NO TIMEOUT -; - ; AVOID RETURN FROM HALT IN PROBLEMATIC ADDRESS RANGE XX30-XX3F!!! - .IF ((($ & 0F0H) == 20H) | (($ & 0F0H) == 30H)) - .FILL (($ & 0FF00H) + 40H) - $ - ; .ORG (($ & 0FF00H) + 40H) - .ENDIF -; -IFXRR: - DI - LD C,(IY+CFG_MSR) ; SET C TO MSR PORT -IFXRR2: - EI -IFXRRX .EQU $ - IFXRR - HALT - IN A,(C) - BIT 5,A - JP Z,FXR_ABORT - INC C ; SWITCH C TO DATA PORT - INI - DEC C ; SWITCH C BACK TO MSR PORT - DEC DE - LD A,E - OR D - JP NZ,IFXRR2 - JP FXR_END -; -; INT READ DATA - FAST VERSION -; FIXED SECTOR SIZE OF 512 BYTES -; HANGS ON FDC ERRORS, NO TIMEOUT -; - ; AVOID RETURN FROM HALT IN PROBLEMATIC ADDRESS RANGE XX30-XX3F!!! - .IF ((($ & 0F0H) == 20H) | (($ & 0F0H) == 30H)) - .FILL (($ & 0FF00H) + 40H) - $ - ; .ORG (($ & 0FF00H) + 40H) - .ENDIF -; -FFXRR: - DI - LD C,(IY+CFG_DATA) ; SET C TO DATA PORT FOR INI -FFXRR2 EI - HALT -FFXRRX1 .EQU $ - FFXRR - INI - JP NZ,FFXRR2 -FFXRR3 EI - HALT -FFXRRX2 .EQU $ - FFXRR - INI - JP NZ,FFXRR3 - JP FXR_END -; -; WAIT READ DATA -; HANGS ON FDC ERRORS, NO TIMEOUT -; -WFXRR: - DI - LD C,(IY+CFG_DMA) -WFXRR2: - INI ; GET PENDING BYTE - DEC DE ; DECREMENT BYTE COUNT - LD A,D - OR E - JP NZ,WFXRR2 ; IF NOT ZERO, REPEAT LOOP - JP FXR_END ; CLEAN EXIT - -; -; WRITE DATA -; -FXRW: LD A,E ; LOW BYTE OF COUNT TO ACCUM - OR A ; TEST FOR ZERO - JR Z,FXRW1 ; IF ZERO, DO NOT ADJUST ITERATIONS - INC D ; OTHERWISE, ITERATIONS IS ONE MORE THAN HIGH BYTE -FXRW1: LD B,E ; LOW BYTE OF COUNT TO B - LD A,D ; HIGH BYTE OF COUNT - LD (FXP_ITER),A ; ... IS ITERATION COUNT - LD A,(CPUSPD) ; CPU SPEED SCALER - LD (FXP_TO),A ; SAVE IT AS OUTER LOOP TIMEOUT - LD IX,FXP_TO ; (IX) IS FXP_TO, (IX+1) IS FCP_ITER - LD C,(IY+CFG_DATA) ; SET C TO DATA PORT - LD DE,0 - DI ; DISABLE INTERRUPTS TO AVOID OVERRUN -FXRW2: DEC C ; [04] SET C TO MSR PORT -FXRW3: LD DE,0 ; [10] TIMEOUT COUNTER -FXRW4: IN A,(C) ; [12] GET MSR - CP $B0 ; [07] BYTE READY? - JR Z,FXRW5 ; [12/7] GET IT - ;LD (FST_MSR),A ; [13] *DEBUG* SAVE MSR FOR LATER - DEC E ; [04] DEC LSB OF INNER TIMEOUT COUNTER - JR NZ,FXRW4 ; [12/7] LOOP IF LSB IS NOT EXHAUSTED - CP $D0 ; [07] IF RQM=1, DIO=1, EXM=0, CB=1, EXECUTION ABORTED - JP Z,FXR_ABORT ; [10] IF NOT SET, EXECUTION ABORTED - DEC D ; [04] DEC MSB OF INNER TIMEOUT COUNTER - JR NZ,FXRW4 ; [12/7] LOOP IF MSB IS NOT EXHAUSTED - DEC (IX) ; [23] DECREMENT OUTER LOOP COUNTER - JR NZ,FXRW3 ; [12/7] LOOP IF NOT EXHAUSTED - JP FXR_TO ; [10] OTHERWISE, HANDLE TIMEOUT -FXRW5: INC C ; [04] POINT TO DATA PORT - OUTI ; [16] (C) := (HL), HL++, B-- - JR NZ,FXRW2 ; [12/7] LOOP - DEC (IX+1) ; [23] DECREMENT ITERATION COUNT - JR NZ,FXRW2 ; [12] IF MORE ITERATIONS, GO DO IT - JP FXR_END ; [10] ELSE DONE - - - -; -; INT WRITE DATA - SAFE VERSION -; HANDLES FDC ERRORS, BUT NO TIMEOUT -; - ; AVOID RETURN FROM HALT IN PROBLEMATIC ADDRESS RANGE XX30-XX3F!!! - .IF ((($ & 0F0H) == 20H) | (($ & 0F0H) == 30H)) - .FILL (($ & 0FF00H) + 40H) - $ - ; .ORG (($ & 0FF00H) + 40H) - .ENDIF -; -IFXRW: - DI - LD C,(IY+CFG_MSR) ; SET C TO MSR PORT -IFXRW2: EI - HALT - IN A,(C) - BIT 5,A - JP Z,FXR_ABORT - INC C ; SWITCH TO DATA PORT - OUTI - DEC C ; SWITCH BACK TO MSR PORT - DEC DE - LD A,E - OR D - JP NZ,IFXRW2 - JP FXR_END -; -; INT WRITE DATA - FAST VERSION -; FIXED SECTOR SIZE OF 512 BYTES -; HANGS ON FDC ERRORS, NO TIMEOUT -; - ; AVOID RETURN FROM HALT IN PROBLEMATIC ADDRESS RANGE XX30-XX3F!!! - .IF ((($ & 0F0H) == 20H) | (($ & 0F0H) == 30H)) - .FILL (($ & 0FF00H) + 40H) - $ - ; .ORG (($ & 0FF00H) + 40H) - .ENDIF -; -FFXRW: - DI - LD C,(IY+CFG_DATA) ; SET C TO DATA PORT -FFXRW2 EI - HALT - OUTI - JP NZ,FFXRW2 -FFXRW3 EI - HALT - OUTI - JP NZ,FFXRW3 - JP FXR_END -; -; WAIT WRITE DATA -; HANGS ON FDC ERRORS, NO TIMEOUT -; -WFXRW: - DI - LD C,(IY+CFG_DMA) -WFXRW2: - OUTI ; WRITE IT 16ts - DEC DE ; DECREMENT BYTE COUNT 6ts - LD A,D ; 4ts - OR E ; 4ts - JP NZ,WFXRW2 ; IF NOT ZERO, REPEAT LOOP 10ts = 40 - JP FXR_END ; CLEAN EXIT - -; -; COMMON COMPLETION CODE FOR ALL EXECUTION ROUTINES -; - -FXR_TO: - ; SAVE CURRENT MSR VALUE - ;LD C,(IY+CFG_MSR) ; SET C TO MSR PORT - ;IN A,(C) - LD (FST_MSR),A - ; SET ERROR AND GET OUT W/O PULSING TC - LD A,FRC_TOEXEC - LD (FST_RC),A - JR FXR_END2 - -FXR_ABORT: - ; SAVE CURRENT MSR VALUE - ;LD C,(IY+CFG_MSR) ; SET C TO MSR PORT - ;IN A,(C) - LD (FST_MSR),A - ; LET RESULTS PHASE HANDLE ERROR, DO NOT PULSE TC, COMMAND ALREADY TERMINATED - ;LD A,FRC_ABORT - ;LD (FST_RC),A - JR FXR_END2 - -FXR_END: - ; SAVE CURRENT MSR VALUE - ;LD C,(IY+CFG_MSR) ; SET C TO MSR PORT - ;IN A,(C) - LD (FST_MSR),A - ; DO NOT PULSE TC AT END OF FORMAT OR READID, THOSE COMMANDS SELF-TERMINATE - ;LD A,(FCP_CMD) - ;CP CMD_FMTTRK - ;JR Z,FXR_END2 - ;CP CMD_READID - ;JR Z,FXR_END2 - - CALL FC_PULSETC - -FXR_END2: -#IF 0 - LD (FXP_A),A - LD (FXP_BC),BC - LD (FXP_DE),DE - LD (FXP_HL),HL - - CALL FXR_DUMP -#ENDIF - - EI ; I/O FINISHED, INTS BACK ON - RET - -; -;=============================================================================== -; COMMAND PROCESSING STATUS DISPLAY -;=============================================================================== -; -; PRINT STATUS -; -FC_PRTFST: - PUSH AF - PUSH BC - PUSH DE - PUSH HL - LD A,(FST_RC) ; A GETS FST_RC - LD B,FSST_COUNT ; B GETS TABLE ENTRY COUNT - LD HL,FSST - LD DE,FSST_ENTSIZ ; TABLE ENTRY LENGTH - -FC_PRTFST0: ; START OF LOOP - LD C,(HL) - CP C - JP Z,FC_PRTFST1 ; FOUND CODE - - ADD HL,DE ; POINT TO NEXT ENTRY - DJNZ FC_PRTFST0 ; CHECK NEXT ENTRY TILL COUNT IS ZERO - - ; NO MATCHING ENTRY, PRINT THE HEX VALUE - CALL PC_SPACE - CALL PC_LBKT - CALL PRTHEXBYTE - CALL PC_RBKT - JP FC_PRTFSTX - -FC_PRTFST1: ; ENTRY FOUND, PRINT IT - CALL PC_SPACE - INC HL - LD E,(HL) - INC HL - LD D,(HL) - CALL PC_LBKT - CALL WRITESTR - CALL PC_RBKT - -FC_PRTFSTX: - POP HL - POP DE - POP BC - POP AF - RET -; -; PRINT COMMAND -; -FC_PRTCMD: - PUSH AF - PUSH BC - PUSH DE - PUSH HL - LD A,(FCP_CMD) ; A GETS THE COMMAND CODE - LD B,FCT_COUNT ; B GETS TABLE ENTRY COUNT - LD HL,FCT - LD DE,FCT_ENTSIZ ; TABLE ENTRY LENGTH - -FCPC_LOOP: ; START OF LOOP - LD C,(HL) - CP C - JP Z,FCPC_MATCH ; FOUND CODE - - ADD HL,DE ; POINT TO NEXT ENTRY - DJNZ FCPC_LOOP ; CHECK NEXT ENTRY TILL COUNT IS ZERO - - ; NO MATCHING ENTRY, PRINT THE HEX VALUE - CALL PC_SPACE - CALL PC_LBKT - CALL PRTHEXBYTE - CALL PC_RBKT - JP FCPC_EXIT - -FCPC_MATCH: ; ENTRY FOUND, PRINT IT - INC HL - LD E,(HL) - INC HL - LD D,(HL) - CALL WRITESTR - -FCPC_EXIT: - POP HL - POP DE - POP BC - POP AF - RET -; -; PRINT RESULTS -; -FC_PRTRESULTS: - ; IF TRACE IS SET, FORCE PRINT RESULTS - LD A,(FCD_TRACE) - OR A - JP NZ,FCPR2 - - ; IF RC=OK, GET OUT, NOTHING TO PRINT - LD A,(FST_RC) - CP FRC_OK - RET Z - - ; SPECIAL CASE, DON'T PRINT IF SENSEINT & INVCMD/DSK CHG/ABTERM - LD A,(FCP_CMD) - CP CMD_SENSEINT - JP NZ,FCPR2 - - LD A,(FST_RC) - CP FRC_INVCMD - JP Z,FCPR_EXIT - CP FRC_DSKCHG - JP Z,FCPR_EXIT - CP FRC_ABTERM - JP Z,FCPR_EXIT - JP FCPR_EXIT - -FCPR2: - CALL NEWLINE - - CALL FC_PRTCMD - CALL PC_COLON - - LD A,(FCP_BUFLEN) - LD DE,FCP_BUF - CALL PRTHEXBUF - - LD DE,STR_ARROW - CALL WRITESTR - - LD A,(FRB_LEN) - LD DE,FRB - CALL PRTHEXBUF - - LD A,(FDCBM) - AND _ZETA | _DIO3 - JR Z,FCPR3 - LD DE,STR_DSKCHG - CALL WRITESTR - LD C,(IY+CFG_DIR) - IN A,(C) - AND 01H - CALL PRTHEXBYTE - -FCPR3: - LD A,(FST_RC) - CALL FC_PRTFST - -FCPR_EXIT: - RET -; -; DUMP EXECUTION INFO -; -FXR_DUMP: - CALL NEWLINE - LD DE,STR_OP - CALL WRITESTR - CALL PC_COLON - LD DE,STR_MSR - CALL WRITESTR - LD A,(FST_MSR) - CALL PRTHEXBYTE - - LD DE,STR_A - CALL WRITESTR - LD A,(FXP_A) - CALL PRTHEXBYTE - - LD DE,STR_BC - CALL WRITESTR - LD BC,(FXP_BC) - LD A,B - CALL PRTHEXBYTE - LD A,C - CALL PRTHEXBYTE - - LD DE,STR_DE - CALL WRITESTR - LD BC,(FXP_DE) - LD A,B - CALL PRTHEXBYTE - LD A,C - CALL PRTHEXBYTE - - LD DE,STR_HL - CALL WRITESTR - LD BC,(FXP_HL) - LD A,B - CALL PRTHEXBYTE - LD A,C - CALL PRTHEXBYTE - - LD DE,STR_ITER - CALL WRITESTR - LD A,(FXP_ITER) - CALL PRTHEXBYTE - - LD DE,STR_TO - CALL WRITESTR - LD A,(FXP_TO) - CALL PRTHEXBYTE - - RET -; -; DOR BITS (3AH) -; -; DISKIO 250KBPS 500KBPS -; ------- ------- ------- -;D7 /DC/RDY 1 (N/A) 1 (N/A) -;D6 /REDWC (DENSITY) 0 (DD) 1 (HD) -;D5 P0* (PRECOMP BIT 0) 1 \ 0 \ -;D4 P1* (PRECOMP BIT 1) 0 (125NS) 1 (125NS) -;D3 P2* (PRECOMP BIT 2) 0 / 0 / -;D2 MINI (BITRATE) 1 (250KBPS) 0 (500KBPS) -;D1 /MOTOR (ACTIVE LO) 1 (OFF) 1 (OFF) -;D0 TC (TERMINAL COUNT) 0 (OFF) 0 (OFF) -; -; *NOTE: FOR 9229 DATA SEPARATOR USED IN DISKIO, VALUE OF PRECOMP BITS CHANGES WITH MINI -; IF MINI=1 (250KBPS), USE 001 FOR 125NS PRECOMP, IF MINI=0, USE 010 FOR 125NS PRECOMP -; -DORA_BR250 .EQU 10100110B ; 250KBPS -DORA_BR500 .EQU 11010010B ; 500KBPS -; -DORA_INIT .EQU DORA_BR250 -; -; ZETA/DISKIO3 250KBPS 500KBPS -; ------------ ------- ------- -;D7 /FDC_RST 1 (RUN) 1 (RUN) -;D6 DENSEL 1 (DD) 0 (HD) -;D5 P0 (PRECOMP BIT 0) 1 \ 1 \ -;D4 P1 (PRECOMP BIT 1) 0 (125NS) 0 (125NS) -;D3 P2 (PRECOMP BIT 2) 0 / 0 / -;D2 MINI (BITRATE) 1 (250KBPS) 0 (500KBPS) -;D1 MOTOR 0 (OFF) 0 (OFF) -;D0 TC 0 (OFF) 0 (OFF) -; -; MOTOR AND DENSITY SELECT ARE INVERTED ON ZETA/DISKIO3 -; -DORB_BR250 .EQU 11100100B ; 250KBPS -DORB_BR500 .EQU 10100000B ; 500KBPS -; -DORB_INIT .EQU DORB_BR250 -; -; *** DIDE/N8/ZETA2/RCWDC/SMZ80/DYNO *** -; -DORC_INIT .EQU 00001100B ; SOFT RESET INACTIVE, DMA ENABLED -; -DORC_BR250 .EQU DORC_INIT -DORC_BR500 .EQU DORC_INIT -; -; *** RCSMC *** -; -DORD_BR250 .EQU 10100000B ; 250KBPS -DORD_BR500 .EQU 11100000B ; 500KBPS -; -DORD_INIT .EQU DORB_BR250 -; -; DCR (ONLY APPLIES TO DIDE, N8, AND ZETA2) -; -DCR_BR250 .EQU 01H ; 250KBPS -DCR_BR500 .EQU 00H ; 500KBPS -; -;=============================================================================== -; GENERAL UTILITY ROUTINES -;=============================================================================== -; -; INITIALIZE BUFFER WITH FILLER BYTE -; HL = ADDRESS OF BUFFER -; DE = SIZE OF BUFFER -; B = FILLER BYTE VALUE -; -FILL_BUFFER: - LD A,B - LD (HL),A - INC HL - DEC DE - LD A,D - OR E - JP NZ,FILL_BUFFER - RET -; -; INITIALIZE BUFFER WITH PATTERN -; HL = ADDRESS OF BUFFER -; DE = SIZE OF BUFFER -; B = STARTING BYTE VALUE -; -PAT_BUFFER: - LD A,B - LD (HL),A - INC HL - DEC DE - INC B - LD A,D - OR E - JP NZ,PAT_BUFFER - RET -; -; PRINT A BLOCK OF MEMORY NICELY FORMATTED -; -DUMP_BUFFER: - CALL NEWLINE ; -BLKRD: - CALL PHL ; PRINT START LOCATION - LD C,16 ; SET FOR 16 LOCS - PUSH HL ; SAVE STARTING HL -NXTONE: - LD A,(HL) ; GET BYTE - CALL PRTHEXBYTE ; PRINT IT - CALL PC_SPACE ; -UPDH: - INC HL ; POINT NEXT - DEC C ; DEC. LOC COUNT - JR NZ,NXTONE ; IF LINE NOT DONE - ; NOW PRINT 'DECODED' DATA TO RIGHT OF DUMP -PCRLF: - CALL PC_SPACE ; SPACE IT - LD C,16 ; SET FOR 16 CHARS - POP HL ; GET BACK START -PCRLF0: - LD A,(HL) ; GET BYTE - AND 060H ; SEE IF A 'DOT' - LD A,(HL) ; O.K. TO GET - JR NZ,PDOT ; -DOT: - LD A,2EH ; LOAD A DOT -PDOT: - CALL COUT ; PRINT IT - INC HL ; - LD A,D ; - CP H ; - JR NZ,UPDH1 ; - LD A,E ; - CP L ; - JP Z,DUMP_END ; -; -;IF BLOCK NOT DUMPED, DO NEXT CHARACTER OR LINE -UPDH1: - DEC C ; DEC. CHAR COUNT - JR NZ,PCRLF0 ; DO NEXT -CONTD: - CALL NEWLINE ; - JP BLKRD ; - -DUMP_END: - RET ; -; -; UTILITY PROCS TO PRINT SINGLE CHARACTERS -; -PC_SPACE: - PUSH AF ; Store AF - LD A,' ' ; LOAD A "SPACE" - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -PC_HYPHEN: - PUSH AF ; Store AF - LD A,'-' ; LOAD A COLON - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -PC_COLON: - PUSH AF ; Store AF - LD A,':' ; LOAD A COLON - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -PC_EQUAL: - PUSH AF ; Store AF - LD A,'=' ; LOAD A COLON - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -PC_CR: - PUSH AF ; Store AF - LD A,CHR_CR ; LOAD A - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -PC_LF: - PUSH AF ; Store AF - LD A,CHR_LF ; LOAD A - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -PC_LBKT: - PUSH AF ; Store AF - LD A,'[' ; LOAD A COLON - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -PC_RBKT: - PUSH AF ; Store AF - LD A,']' ; LOAD A COLON - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -PC_LPAREN: - PUSH AF ; Store AF - LD A,'(' ; LOAD A COLON - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - - -PC_RPAREN: - PUSH AF ; Store AF - LD A,')' ; LOAD A COLON - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -PC_BS: - PUSH AF ; Store AF - LD A,CHR_BS ; LOAD A - CALL COUT ; SCREEN IT - POP AF ; RESTORE AF - RET ; DONE - -NEWLINE_USED .DB 1 -NEWLINE: - CALL PC_CR - CALL PC_LF - LD A,1 - PUSH AF - LD (NEWLINE_USED),A - POP AF ; RESTORE AF - RET ; DONE - -COPYSTR: - LD A,(HL) - CP '$' - RET Z - LDI - JR COPYSTR - -; -;__COUT_________________________________________________________________________________________________________________________ -; -; PRINT CONTENTS OF A -;________________________________________________________________________________________________________________________________ -; -COUT: - PUSH BC ; - PUSH AF ; - PUSH HL ; - PUSH DE ; - - LD C,2 ; BDOS FUNC: CONSOLE WRITE CHAR - LD E,A ; CHARACTER TO E - CALL $0005 ; CALL BDOS - - 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 PRTHEXBYTE ; DO HEX OUT ROUTINE - LD A,L ; GET LOW BYTE - CALL PRTHEXBYTE ; HEX IT - CALL PC_SPACE ; - RET ; DONE -; -; GET A LINE BUFFER WITH 2 HEX CHARS, HL=ADDRESS OF LINE BUFFER -; EXIT WITH C = NUMBER OF CHARS, C=0 MEANS NOTHING ENTERED -; -GETLNHEX: - LD C,0 ; C = CHAR COUNT -GLH_LOOP: - CALL GETKEYUC - OR A - JP Z,GLH_LOOP - CP CHR_CR - JP Z,GLH_CHK - CP CHR_BS - JP Z,GLH_BS - CP '0' - JP M,GLH_LOOP - CP '9' + 1 - JP M,GLH_APPEND - CP 'A' - JP M,GLH_LOOP - CP 'F' + 1 - JP M,GLH_APPEND - JP GLH_LOOP -GLH_BS: - LD A,C - OR A - JP Z,GLH_LOOP - CALL PC_BS - CALL PC_SPACE - CALL PC_BS - DEC C - DEC HL - JP GLH_LOOP -GLH_APPEND: - LD B,A - LD A,C - CP 2 - JP P,GLH_LOOP - LD A,B - CALL COUT - LD (HL),A - INC C - INC HL - JP GLH_LOOP -GLH_CHK: - LD A,C - CP 2 - JP Z,GLH_EXIT - CP 0 - JP Z,GLH_EXIT - JP GLH_LOOP -GLH_EXIT: - RET -; -;__HEXIN__________________________________________________________________________________________________________________________ -; -; GET ONE BYTE OF HEX DATA FROM BUFFER IN HL, RETURN IN A -;________________________________________________________________________________________________________________________________ -; -HEXIN: - PUSH BC ; SAVE BC REGS. - CALL NIBL ; DO A NIBBLE - RLC A ; MOVE FIRST BYTE UPPER NIBBLE - RLC A ; - RLC A ; - RLC A ; - LD B,A ; SAVE ROTATED BYTE - CALL NIBL ; DO NEXT NIBBLE - ADD A,B ; COMBINE NIBBLES IN ACC. - POP BC ; RESTORE BC - RET ; DONE -NIBL: - LD A,(HL) ; GET K.B. DATA - INC HL ; INC KB POINTER - CP 40H ; TEST FOR ALPHA - JR NC,ALPH ; - AND 0FH ; GET THE BITS - RET ; -ALPH: - AND 0FH ; GET THE BITS - ADD A,09H ; MAKE IT HEX A-F - RET ; -; -; COPY A $ TERMINATED STRING FROM ADDRESS IN DE TO ADDRESS IN HL -; DE = ADDRESS OF SOURCE STRING -; LH = ADDRESS OF TARGET LOCATION -; -STRCPY: - LD A,(DE) - CP '$' - JP Z,STRCPYX - LD (HL),A - INC HL - INC DE - JP STRCPY - -STRCPYX: - RET -; -; GET A HEX BYTE VALUE FROM THE USER -; WILL UPDATE STORED VALUE, EMPTY RESPONSE LEAVES VALUE ALONE -; DE = ADDRESS OF PROMPT STRING -; HL = ADDRESS OF VALUE -; BC = HI/BO ALLOWABLE RANGE OF VALID VALUES -; -GHB_PROMPTP .DW 0 -GHB_RANGE .DW 0 -GHB_VALUEP .DW 0 -GHB_CLEAR .DB " \b\b$" - -GETHEXBYTE: - LD BC,000FFH -GETHEXBYTERNG: - LD (GHB_PROMPTP),DE - LD (GHB_RANGE),BC - LD (GHB_VALUEP),HL - CALL NEWLINE -GHB_LOOP: - CALL PC_CR - LD DE,STR_ENTER - CALL WRITESTR - CALL PC_SPACE - LD DE,(GHB_PROMPTP) - CALL WRITESTR - CALL PC_SPACE - LD BC,(GHB_RANGE) - CALL PC_LBKT - LD A,B - CALL PRTHEXBYTE - CALL PC_HYPHEN - LD A,C - CALL PRTHEXBYTE - CALL PC_RBKT - CALL PC_SPACE - CALL PC_LPAREN - LD HL,(GHB_VALUEP) - LD A,(HL) - CALL PRTHEXBYTE - CALL PC_RPAREN - CALL PC_COLON - CALL PC_SPACE - LD DE,GHB_CLEAR - CALL WRITESTR - LD HL,KEYBUF - CALL GETLNHEX - LD A,C - CP 0 ; RETAIN CURRENT VALUE - JP Z,GHB_EXIT - CP 2 ; INPUT LOOKS OK, UPDATE IT - JP Z,GHB_CHK - JP GHB_LOOP ; ANYTHING ELSE, BAD INPUT, DO OVER -GHB_CHK: - LD HL,KEYBUF - CALL HEXIN - LD BC,(GHB_RANGE) - CP B - JP C,GHB_LOOP - CP C - JP Z,GHB_OK - JP NC,GHB_LOOP -GHB_OK: - LD HL,(GHB_VALUEP) - LD (HL),A -GHB_EXIT: - RET - -; -; PRINT THE HEX BYTE VALUE IN A -; -HEXSTRBUF .TEXT "XX$" -; -PRTHEXBYTE: - PUSH AF - PUSH DE - LD DE,HEXSTRBUF - CALL HEXSTRBYTE - LD A,'$' - LD (DE),A - LD DE,HEXSTRBUF - CALL WRITESTR - POP DE - POP AF - RET -; -; PRINT THE HEX WORD VALUE IN BC -; -PRTHEXWORD: - PUSH AF - LD A,B - CALL PRTHEXBYTE - LD A,C - CALL PRTHEXBYTE - POP AF - RET -; -; CONVERT VALUE IN A TO A 2 CHARACTER HEX STRING AT DE -; -HEXCHR .TEXT "0123456789ABCDEF" -; -HEXSTRBYTE: - PUSH BC - PUSH HL - PUSH AF - LD BC,0 - RRA - RRA - RRA - RRA - AND 0FH - LD C,A - LD HL,HEXCHR - ADD HL,BC - LD A,(HL) - LD (DE),A - INC DE - POP AF - PUSH AF - LD BC,0 - AND 0FH - LD C,A - LD HL,HEXCHR - ADD HL,BC - LD A,(HL) - LD (DE),A - INC DE - POP AF - POP HL - POP BC - RET -; -; CONVERT VALUE IN BC TO A 4 CHARACTER HEX STRING AT DE -; -HEXSTRWORD: - LD A,B - CALL HEXSTRBYTE - LD A,C - CALL HEXSTRBYTE - RET - -; -; PRINT A BYTE BUFFER IN HEX POINTED TO BY DE -; REGISTER A HAS SIZE OF BUFFER -; -PRTHEXBUF: - CP 0 ; EMPTY BUFFER? - JP Z,PRTHEXBUF2 - - LD B,A -PRTHEXBUF1: - CALL PC_SPACE - LD A,(DE) - CALL PRTHEXBYTE - INC DE - DJNZ PRTHEXBUF1 - JP PRTHEXBUFX - -PRTHEXBUF2: - CALL PC_SPACE - LD DE,STR_EMPTY - CALL WRITESTR - -PRTHEXBUFX: - RET -; -; JP TO ADDRESS IN HL IN HEX POINTED TO BY DE -; MOSTLY USEFUL TO PERFORM AN INDIRECT CALL LIKE: -; LD HL,xxxx -; CALL JPHL -; -JPHL JP (HL) -; -; GENERATE A RANDOM BYTE -; -; RETURNS PSEUDO RANDOM 8 BIT NUMBER IN A. ONLY AFFECTS A. -; (SEED) IS THE BYTE FROM WHICH THE NUMBER IS GENERATED AND MUST BE -; INITIALIZED TO A NON ZERO VALUE OR THIS FUNCTION WILL ALWAYS RETURN -; ZERO. -; -RB_SEED .DB 1 ; RNDBYTE SEED (MUST NOT BE ZERO) -; -RNDBYTE: - LD A,(RB_SEED) ; GET SEED - AND 0B8H ; MASK NON-FEEDBACK BITS - SCF ; SET CARRY - JP PO,RB_NC ; SKIP CLEAR IF ODD - CCF ; COMPLEMENT CARRY (CLEAR IT) -RB_NC LD A,(RB_SEED) ; GET SEED BACK - RLA ; ROTATE CARRY INTO BYTE - LD (RB_SEED),A ; SAVE BACK FOR NEXT - RET ; DONE -; -; ADD HL,A -; -; A REGISTER IS DESTROYED! -; -ADDHLA: - ADD A,L - LD L,A - RET NC - INC H - RET -; -; OUTPUT A '$' TERMINATED STRING -; -WRITESTR: - PUSH AF - PUSH BC - PUSH DE - PUSH HL - LD C,09H - CALL 0005H - POP HL - POP DE - POP BC - POP AF - RET -; -; READ A KEY, RETURN VALUE IN A -; -GETKEY: - PUSH BC - PUSH DE - PUSH HL - LD C,06H - LD E,0FFH - CALL 0005H - POP HL - POP DE - POP BC - - CP 03 - JP Z,EXIT - - RET - -GETKEYUC: - CALL GETKEY - CP 'a' - JP M,GETKEYUC_EXIT - CP 'z' + 1 - JP M,GETKEYUC_FIX - JP GETKEYUC_EXIT -GETKEYUC_FIX: - AND 11011111B -GETKEYUC_EXIT: - RET -; -; DELAY 16US (CPU SPEED COMPENSATED) INCUDING CALL/RET INVOCATION -; REGISTER A AND FLAGS DESTROYED -; NO COMPENSATION FOR Z180 MEMORY WAIT STATES -; THERE IS AN OVERHEAD OF 3TS PER INVOCATION -; IMPACT OF OVERHEAD DIMINISHES AS CPU SPEED INCREASES -; -; CPU SCALER (CPUSCL) = (CPUHMZ - 2) FOR 16US + 3TS DELAY -; NOTE: CPUSCL MUST BE >= 1! -; -; EXAMPLE: 8MHZ CPU (DELAY GOAL IS 16US) -; LOOP = ((6 * 16) - 5) = 91TS -; TOTAL COST = (91 + 40) = 131TS -; ACTUAL DELAY = (131 / 8) = 16.375US -; - ; --- TOTAL COST = (LOOP COST + 40) TS -----------------+ -DELAY: ; 17TS (FROM INVOKING CALL) | - LD A,(CPUSCL) ; 13TS | -; | -DELAY1: ; | - ; --- LOOP = ((CPUSCL * 16) - 5) TS ------------+ | - DEC A ; 4TS | | -#IFDEF CPU_Z180 ; | | - OR A ; +4TS FOR Z180 | | -#ENDIF ; | | - JR NZ,DELAY1 ; 12TS (NZ) / 7TS (Z) | | - ; ----------------------------------------------+ | -; | - RET ; 10TS (RETURN) | - ;-------------------------------------------------------+ -; -; DELAY 16US * DE (CPU SPEED COMPENSATED) -; REGISTER DE, A, AND FLAGS DESTROYED -; NO COMPENSATION FOR Z180 MEMORY WAIT STATES -; THERE IS A 27TS OVERHEAD FOR CALL/RET PER INVOCATION -; IMPACT OF OVERHEAD DIMINISHES AS DE AND/OR CPU SPEED INCREASES -; -; CPU SCALER (CPUSCL) = (CPUHMZ - 2) FOR 16US OUTER LOOP COST -; NOTE: CPUSCL MUST BE > 0! -; -; EXAMPLE: 8MHZ CPU, DE=6250 (DELAY GOAL IS .1 SEC OR 100,000US) -; INNER LOOP = ((16 * 6) - 5) = 91TS -; OUTER LOOP = ((91 + 37) * 6250) = 800,000TS -; ACTUAL DELAY = ((800,000 + 27) / 8) = 100,003US -; - ; --- TOTAL COST = (OUTER LOOP + 27) TS ------------------------+ -VDELAY: ; 17TS (FROM INVOKING CALL) | -; | - ; --- OUTER LOOP = ((INNER LOOP + 37) * DE) TS ---------+ | - LD A,(CPUSCL) ; 13TS | | -; | | -VDELAY1: ; | | - ; --- INNER LOOP = ((CPUSCL * 16) - 5) TS ------+ | | -#IFDEF CPU_Z180 ; | | | - OR A ; +4TS FOR Z180 | | | -#ENDIF ; | | | - DEC A ; 4TS | | | - JR NZ,VDELAY1 ; 12TS (NZ) / 7TS (Z) | | | - ; ----------------------------------------------+ | | -; | | - DEC DE ; 6TS | | -#IFDEF CPU_Z180 ; | | - OR A ; +4TS FOR Z180 | | -#ENDIF ; | | - LD A,D ; 4TS | | - OR E ; 4TS | | - JP NZ,VDELAY ; 10TS | | - ;-------------------------------------------------------+ | -; | - RET ; 10TS (FINAL RETURN) | - ;---------------------------------------------------------------+ -; -; DELAY ABOUT 0.5 SECONDS -; 500000US / 16US = 31250 -; -LDELAY: - PUSH AF - PUSH DE - LD DE,31250 - CALL VDELAY - POP DE - POP AF - RET - -; -; HANDLE USER INPUT FOR A MENU BASED ON TABLE OF MENU DATA. DISPATCH MENU FUNCTIONS. -; ON INPUT, HL=ADDRESS OF MENU TABLE, B=COUNT OF MENU ENTRIES -; - .module MenuInfo -MenuInfo ; TRANSIENT STORAGE FOR CURRENT MENU -_DrawProc .dw 0 ; ADDRESS OF MENU DRAW ROUTINE -_TableAdr .dw 0 ; ADDRESS OF MENU TABLE DATA -_EntryInfo .dw 0 ; ENTRY COUNT / ENTRY SIZE -_Size .equ $ - MenuInfo -; -RUNMENU: - push hl ; save address of menu info data - -_Run: - pop hl ; restore/resave menu init address - push hl - - ld de,MenuInfo - ld bc,_Size - ldir - - ld hl,(_DrawProc) - call JPHL ; call menu draw routine - -_GetKey: - call GETKEYUC ; GET USER KEYPRESS - ld hl,(_TableAdr) - ld bc,(_EntryInfo) ; B=COUNT, C=ENTRY SIZE - ld d,0 ; put entry size in de - ld e,c ; " - - ; a=key pressed, hl=menu table address, b=entry count, de=entry size -_Loop: - ld c,(hl) - cp c - jp z,_Match ; found code - - add hl,de ; point to next entry - djnz _Loop ; check next entry till count is zero - jp _GetKey ; keep trying - -_Match: - inc hl ; load string - ld e,(hl) - inc hl - ld d,(hl) - call WRITESTR ; display it - - inc hl ; load code address - ld e,(hl) - inc hl - ld d,(hl) - - ld a,d ; check for zero - or e - jp z,_Exit ; zero means exit - - ex de,hl - call JPHL ; indirect call to menu function - jp _Run - -_Exit: - pop hl - ret -; -; CONTROL CHARACTERS -; -CHR_CR .EQU 0DH -CHR_LF .EQU 0AH -CHR_BS .EQU 08H -CHR_ESC .EQU 1BH -; -STR_DRIVERESET .TEXT "RESET DRIVE...$" -STR_EXECUTE .TEXT "EXECUTION$" -STR_OP .TEXT "OPERATION$" -STR_FORMAT .TEXT "FORMAT$" -STR_SENDCMD .TEXT "SEND COMMAND$" -STR_GETRESULTS .TEXT "GET RESULTS$" -STR_SEEKWAIT .TEXT "SEEK WAIT$" -STR_DOR .TEXT "SET DOR$" -STR_PROGRESS .TEXT "PROGRESS$" -STR_MISMATCH .TEXT "DATA MISMATCH AT $" -STR_RESET .TEXT "FDCRESET...$" -STR_NOTIMPL .TEXT "*** NOT IMPLEMENTED ***$" -STR_NORESP .TEXT "*** DRIVE NOT RESPONDING ***$" -STR_EOD .TEXT "$" -STR_EMPTY .TEXT "$" -STR_TIMEOUT .TEXT "$" -STR_ARROW .TEXT " -->$" -STR_ENTER .TEXT "ENTER$" -STR_ON .TEXT "ON $" -STR_OFF .TEXT "OFF$" -STR_DRV720 .TEXT "720KB $" -STR_DRV144 .TEXT "1.44MB$" -STR_MODEPOLL .TEXT "POLLING $" -STR_MODEINT .TEXT "INTERRUPT $" -STR_MODEDMA .TEXT "DMA $" -STR_CC0 .TEXT " CC0=$" -STR_CC1 .TEXT " CC1=$" -STR_CC2 .TEXT " CC2=$" -STR_N .TEXT " N=$" -STR_SC .TEXT " SC=$" -STR_GPL .TEXT " GPL=$" -STR_D .TEXT " D=$" -STR_ST0 .TEXT " ST0=$" -STR_ST1 .TEXT " ST1=$" -STR_ST2 .TEXT " ST2=$" -STR_CYL .TEXT " CYL=$" -STR_UNIT .TEXT " UNIT=$" -STR_HEAD .TEXT " HD=$" -STR_REC .TEXT " SEC=$" -STR_NUM .TEXT " NUM=$" -STR_DENS .TEXT " DENS=$" -STR_EOTSEC .TEXT " EOTSEC=$" -STR_GAP .TEXT " GAP=$" -STR_DTL .TEXT " DTL=$" -STR_SN .TEXT " SN=$" -STR_NCN .TEXT " NCN=$" -STR_PCN .TEXT " PCN=$" -STR_MSR .TEXT " MSR=$" -STR_A .TEXT " A=$" -STR_BC .TEXT " BC=$" -STR_DE .TEXT " DE=$" -STR_HL .TEXT " HL=$" -STR_TO .TEXT " TO=$" -STR_ITER .TEXT " ITER=$" -STR_DSKCHG .TEXT " DC=$" -; -KEYBUFLEN .EQU 80 -KEYBUF .FILL KEYBUFLEN,' ' -; -STACKSAV .DW 0 -STACKSIZ .EQU 40H ; WE ARE A STACK PIG - .FILL STACKSIZ,0 -STACK .EQU $ -; -BUFFER .EQU 4000H -VFYBUF .EQU 5000H -BUFSIZ .EQU 0200H - .END diff --git a/Source/Apps/FDU/FDU.txt b/Source/Apps/FDU/FDU.txt deleted file mode 100644 index d67fe1fe..00000000 --- a/Source/Apps/FDU/FDU.txt +++ /dev/null @@ -1,514 +0,0 @@ -================================================================ -Floppy Disk Utility (FDU) v5.3 for RetroBrew Computers -Disk IO / Zeta / Dual-IDE / N8 / RC2014 / SmallZ80 / Dyno -================================================================ - -Updated January 5, 2020 -by Wayne Warthen (wwarthen@gmail.com) - -Application to test the hardware functionality of the Floppy -Disk Controller (FDC) on the ECB DISK I/O, DISK I/O V3, ZETA -SBC, Dual IDE w/ Floppy, or N8 board. - -The intent is to provide a testbed that allows direct testing -of all possible media types and modes of access. The -application supports read, write, and format by sector, track, -and disk as well as a random read/write test. - -The application supports access modes of polling, interrupt, -INT/WAIT, and DRQ/WAIT. At present, it supports 3.5" media at -DD (720KB) and HD (1.44MB) capacities. It also now supports -5.25" media (720KB and 1.2MB) and 8" media (1.11MB) as well. -Additional media will be added when I have time and access to -required hardware. Not all modes are supported on all -platforms and some modes are experimental in all cases. - -In many ways this application is merely reinventing the wheel -and performs functionality similar to existing applications, -but I have not seen any other applications for RetroBrew -Computers hardware that provide this range of functionality. - -While the application is now almost entirely new code, I would -like to acknowledge that much was derived from the previous -work of Andrew Lynch and Dan Werner. I also want to credit -Sergio Gimenez with testing the 5.25" drive support and Jim -Harre with testing the 8" drive support. Support for Zeta 2 -comes from Segey Kiselev. Thanks! - -General Usage -------------- - -In general, usage is self explanatory. At invocation, you -must select the floppy disk controller (FDC) that you are -using. Subsequently, the main menu allows you to set the -unit, media, and mode to test. These settings MUST match your -situation. Read, write, format, and verify functions are -provided. A sub-menu will allow you to choose sector, track, -disk, or random tests. - -The verify function requires a little explanation. It will -take the contents of the current in-memory disk buffer, save -it, and compare it to the selected sectors. So, you must -ensure that the sectors to be verified already have been -written with the same pattern as the buffer contains. I -typically init the buffer to a pattern, write the pattern to -the entire disk, then verify the entire disk. - -Another submenu is provided for FDC commands. This sub-menu -allows you to send low-level commands directly to FDC. You -*must* know what you are doing to use this sub-menu. For -example, in order to read a sector using this sub-menu, you -will need to perform specify, seek, sense int, and read -commands specifying correct values (nothing is value checked -in this menu). - -Required Hardware/BIOS ----------------------- - -Of course, the starting point is to have a supported hardware -configuration. The following Z80 / Z180 based CPU boards are -supported: - - - SBC V1/2 - - Zeta - - Zeta 2 - - N8 - - Mark IV - - RC2014 w/ SMC - - RC2014 w/ WDC - - SmallZ80 - - Dyno - -You must be using either a RomWBW or UBA based OS version. - -You must have one of the following floppy disk controllers: - - - Disk IO ECB Board FDC - - Disk IO 3 ECB Board FDC - - Dual-IDE ECB Board FDC - - Zeta SBC onboard FDC - - Zeta 2 SBC onboard FDC - - N8 SBC onboard FDC - - RC2014 Scott Baker SMC-based Floppy Module - - RC2014 Scott Baker WDC-based Floppy Module - -Finally, you will need a floppy drive connected via an -appropriate cable: - -Disk IO - no twist in cable, drive unit 0/1 must be selected by jumper on drive -DISK IO 3, Zeta, Zeta 2, RC2014, Dyno - cable with twist, unit 0 after twist, unit 1 before twist -DIDE, N8, Mark IV, SmallZ80 - cable with twist, unit 0 before twist, unit 1 after twist - -Note that FDU does not utilize your systems ROM or OS to -access the floppy system. FDU interacts directly with -hardware. Upon exit, you may need to reset your OS to get the -floppy system back into a state that is expected. - -The Disk I/O should be jumpered as follows: - -J1: depends on use of interrupt modes (see interrupt modes below) -J2: pins 1-2, & 3-4 jumpered -J3: hardware dependent timing for DMA mode (see DMA modes below) -J4: pins 2-3 jumpered -J5: off -J6: pins 2-3 jumpered -J7: pins 2-3 jumpered -J8: off -J9: off -J10: off -J11: off -J12: off - -Note that J1 can be left on even when not using interrupt -modes. As long as the BIOS is OK with it, that is fine. Note -also that J3 is only relevant for DMA modes, but also can be -left in place when using other modes. - -The Disk I/O 3 board should be jumpered at the default settings: - -JP2: 3-4 -JP3: 1-2 for int mode support, otherwise no jumper -JP4: 1-2, 3-4 -JP5: 1-2 -JP6: 1-2 -JP7: 1-2, 3-4 - -Zeta & Zeta 2 do not have any relevant jumper settings. The -hardwired I/O ranges are assumed in the code. - -The Dual-IDE board should be jumpered as follows: - -K3 (DT/R or /RD): /RD -P5 (bd ID): 1-2, 3-4 (for $20-$3F port range) - -There are no specific N8 jumper settings, but the default -I/O range starting at $80 is assumed in the published code. - -The RC2014 Scott Baker SMC-based floppy module should be jumpered -for I/O base address 0x50 (SV1: 11-12), JP1 (TS) shorted, -JP2 (/FAULT) shorted, JP3 (MINI): 2-3, JP4 (/DC/RDY): 2-3. - -The RC2014 Scott Baker WDC-based floppy module should be jumpered -for I/O base address 0x50 (SV1: 11-12), JP1 (/DACK): 1-2, -JP2 (TC): 2-3. - -SmallZ80 does not have any relevant jumper settings. The -hardwired I/O ranges are assumed in the code. - -Dyno does not have any relevant jumper settings. The -hardwired I/O ranges are assumed in the code. - -Modes of Operation ------------------- - -You can select the following test modes. Please refer to the -chart that follows to determine which modes should work with -combinations of Z80 CPU speed and media format. - -WARNING: In general, only the polling mode is considered fully -reliable. The other modes are basically experimental and -should only be used if you know exactly what you are doing. - -Polling: Traditional polled input/output. Works well and very -reliable with robust timeouts and good error recovery. Also, -the slowest performance which precludes it from being used -with 1.44MB floppy on a 4MHz Z80. This is definitely the mode -you want to get working before any others. It does not require -J1 (interrupt enable) on DISK I/O and does not care about the -setting of J3. - -Interrupt: Relies on FDC interrupts to determine when a byte -is ready to be read/written. It does *not* implement a -timeout during disk operations. For example, if there is no -disk in the drive, this mode will just hang until a disk is -inserted. This mode *requires* that the host has interrupts -active using interrupt mode 1 (IM1) and interrupts attached to -the FDC controller. The BIOS must be configured to handle -these interrupts safely. - -Fast Interrupt: Same as above, but sacrifices additional -reliability for faster operation. This mode will allow a -1.44MB floppy to work with a 4MHz Z80 CPU. However, if any -errors occur (even a transient read error which is not -unusual), this mode will hang. The same FDC interrupt -requirements as above are required. - -INT/WAIT: Same as Fast Interrupt, but uses CPU wait instead of -actual interrupt. This mode is exclusive to the original Disk -IO board. It is subject to all the same issues as Fast -Interrupt, but does not need J1 shorted. J3 is irrelevant. - -DRQ/WAIT: Uses pseudo DMA to handle input/output. Does not -require that interrupts (J1) be enabled on the DISK I/O. -However, it is subject to all of the same reliability issues -as "Fast Interrupt". This mode is exclusive to the original -Disk IO board. At present, the mode is *not* implemented! - -The chart below attempts to describe the combinations that -work for me. By far, the most reliable mode is Polling, but -it requires 8MHz CPU for HD disks. - -DRQ/WAIT --------------------------------+ -INT/WAIT -----------------------------+ | -Fast Interrupt --------------------+ | | -Interrupt ----------------------+ | | | -Polling ---------------------+ | | | | - | | | | | -CPU Speed --------------+ | | | | | - | | | | | | - | | | | | | - -3.5" DD (720K) ------ 4MHz Y Y Y Y X - 8MHz+ Y Y Y Y X - -3.5" HD (1.44M) ----- 4MHz N N Y Y X - 8MHz+ Y Y Y Y X - -5.25" DD (360K) ----- 4MHz Y Y Y Y X - 8MHz+ Y Y Y Y X - -5.25" HD (1.2M) ----- 4MHz N N Y Y X - 8MHz+ Y Y Y Y X - -8" DD (1.11M) ------- 4MHz N N Y Y X - 8MHz+ Y Y Y Y X - -Y = Yes, works -N = No, does not work -X = Experimental, probably won't work - -Tracing -------- - -Command/result activity to/from the FDC will be written out if -the trace setting is changed from '00' to '01' in setup. -Additionally, if a command failure is detected on any command, -that specific comand and results are written regardless of the -trace setting. - -The format of the line written is: -: --> [] - -For example, this is the output of a normal read operation: -READ: 46 01 00 00 01 02 09 1B FF --> 01 00 00 00 00 02 02 [OK] - -Please refer to the i8272 data sheet for information on the -command and result bytes. - -Note that the sense interrupt command can return a non-OK -result. This is completely normal in some cases. It is -necessary to "poll" the drive for seek status using sense -interrupt. If there is nothing to report, then the result -will be INVALID COMMAND. Additionally, during a recalibrate -operation, it may be necessary to issue the command twice -because the command will only step the drive 77 times looking -for track 0, but the head may be up to 80 tracks away. In -this case, the first recalibrate fails, but the second should -succeed. Here is what this would look like if trace is turned -on: - -RECALIBRATE: 07 01 --> [OK] -SENSE INTERRUPT: 08 --> 80 [INVALID COMMAND] - ... - ... - ... -SENSE INTERRUPT: 08 --> 80 [INVALID COMMAND] -SENSE INTERRUPT: 08 --> 71 00 [ABNORMAL TERMINATION] -RECALIBRATE: 07 01 --> [OK] -SENSE INTERRUPT: 08 --> 21 00 [OK] - -Another example is when the FDC has just been reset. In this -case, you will see up to 4 disk change errors. Again these -are not a real problem and to be expected. - -When tracing is turned off, the application tries to be -intelligent about error reporting. The specific errors from -sense interrupt documented above will be suppressed because -they are not a real problem. All other errors will be -displayed. - -Error Handling --------------- - -There is no automated error retry logic. This is very -intentional since the point is to expose the controller and -drive activity. Any error detected will result in a prompt to -abort, retry, or continue. Note that some number of errors is -considered normal for this technology. An occasional error -would not necessarily be considered a problem. - -CPU Speed ---------- - -Starting with v5.0, the application adjusts it's timing loops -to the actual system CPU speed by querying the BIOS for the -current CPU speed. - -Interleave ----------- - -The format command now allows the specification of a sector -interleave. It is almost always the case that the optimal -interleave will be 2 (meaning 2:1). - -360K Media ----------- - -The 360K media definition should work well for true 360K -drives. However, it will generally not work with 1.2M -drives. This is because these drives spin at 360RPM instead -of the 300RPM speed of true 360K drives. Additionally, 1.2M -drives are 80 tracks and 360K drives are 40 tracks and, so -far, there is no mechanism in FD to "double step" as a way to -use 40 track media in 80 track drives. - -With this said, it is possible to configure some 1.2M 5.25" -drives to automatically spin down to 300RPM based on a density -select signal (DENSEL). This signal is asserted by FD for -360K media, so IF you have configured your drive to react to -this signal correctly, you will be able to use the 360K media -defintion. Most 1.2M 5.25" drives are NOT configured this way -by default. TEAC drives are generally easy to modify and have -been tested by the author and do work in this manner. Note -that this does not address the issue of double stepping above; -you will just be using the first 40 of 80 tracks. - -Support -------- - -I am happy to answer questions as fast and well as I am able. -Best contact is wwarthen@gmail.com or post something on the -RetroBrew Computers Forum -https://www.retrobrewcomputers.org/forum/. - -Changes -------- - -WW 8/12/2011 - -Removed call to pulse TC in the FDC initialization after -determining that it periodically caused the FDC to write bad -sectors. I am mystified by this, but definitely found it to -be true. Will revisit at some point -- probably a timing -issue between puslsing TC and whatever happens next. - -Non-DMA mode was being set incorrectly for FAST-DMA mode. It -was set for non-DMA even though we were doing DMA. It is -interesting that it worked fine anyway. Fixed it anyway. - -DIO_SETMEDIA was not clearing DCD_DSKRDY as it should. Fixed. - -WW 8/26/2011: v1.1 - -Added support for Zeta. Note that INT/WAIT and DRQ/WAIT are -not available on Zeta. Note that Zeta provides the ability to -perform a reset of the FDC independent of a full CPU reset. -This is VERY useful and the FDC is reset anytime a drive reset -is required. - -Added INT/WAIT support. - -WW 8/28/2011: V1.2 - -All changes in this version are Zeta specific. Fixed FDC -reset logic and motor status display for Zeta (code from -Sergey). - -Modified Zeta disk change display to include it in the command -output line. This makes more sense because a command must be -issued to select the desired drive first. You can use the -SENSE INT command id you want to check the disk change value -at any time. It will also be displayed with any other command -output display. - -WW 9/1/2011: V1.3 - -Added CPUFREQ configuration setting to tune delays based on -cpu speed. The build app is set for 8MHz which also seems to -work well for 4MHz CPU's. Faster CPU speeds will probably -require tuning this setting. - -WW 9/5/2011: V1.4 - -Changed the polling execution routines to utilize CPUFREQ -variable to optimize timeout counter. Most importantly, this -should allow the use of faster CPUs (like 20MHz). - -WW 9/19/2011: V1.5 - -Zeta changes only. Added a call to FDC RESET after any -command failure. This solves an issue where the drive remains -selected if a command error occurs. Also added FDC RESET to -FDC CONTROL menu. - -WW 10/7/2011: V2.0 - -Added support for DIDE. Only supports polling IO and it does -not appear any other modes are possible given the hardware -constraints. - -WW 10/13/2011: V2.1 - -Modified to support N8. N8 is essentially identical to Dual -IDE. The only real change is the IO addresses. In theory, I -should be able to support true DMA on N8 and will work on that. - -WW 10/20/2011: v2.2 - -I had some problems with the results being read were sometimes -missing a byte. Fixed this by taking a more strict approach -to watching the MSR for the exact bits that are expected. - -WW 10/22/2011: V2.3 - -After spending a few days trying to track down an intermittent -data corruption issue with my Dual IDE board, I added a verify -function. This helped me isolate the problem very nicely -(turned out to be interference from the bus monitor). - -WW 11/25/2011: V2.4 - -Preliminary support for DISKIO V3. Basically just assumed -that it operates just like the Zeta. Needs to be verified -with real hardware as soon as I can. - -WW 1/9/2012: V2.5 - -Modified program termination to use CP/M reset call so that a -warm start is done and all drives are logged out. This is -important because media may have been formatted during the -program execution. - -WW 2/6/2012: v2.6 - -Added support for 5.25" drives as tested by Sergio. - -WW 4/5/2012: v2.7 - -Added support for 8" drives as tested by Jim Harre. - -WW 4/6/2012: v2.7a - -Fixed issue with media selection menu to remove duplicate -entries. - -WW 4/8/2012: v2.7b - -Corrected the handling of the density select signal. - -WW 5/22/2012: v2.8 - -Added new media definitions (5.25", 320K). - -WW 6/1/2012: v2.9 - -Added interleave capability on format. - -WW 6/5/2012: v3.0 - -Documentation cleanup. - -WW 7/1/2012: v3.1 - -Modified head load time (HLT) for 8" media based on YD-180 -spec. Now set to 50ms. - -WW 6/17/2013: v3.2 - -Cleaned up SRT, HLT, and HUT values. - -SK 2/10/2015: v3.3 - -Added Zeta SBC v2 support (Sergey Kiselev) - -WW 3/25/2015: v4.0 - -Renamed from FDTST --> FD - -WW 9/2/2017: v5.0 - -Renamed from FD to FDU. -Added runtime selection of FDC hardware. -Added runtime timing adjustment. - -WW 12/16/2017: v5.1 - -Improved polling version of read/write to fix occasional overrun errors. - -WW 1/8/2018: v5.2 - -Added support for RC2014 hardware: - - Scott Baker SMC 9266 FDC module - - Scott Baker WDC 37C65 FDC module - -WW 9/5/2018: v5.3 - - Removed use of pulsing TC to end R/W operations after one sector and - instead set EOT = R (sector number) so that after desired sector is - read, R/W stops with end of cylinder error which is a documented - method for controling number of sectors R/W. This specific termination - condition is no longer considered an error, but a successful end of - operation. - - Added support for SmallZ80 - -WW 5/1/2020: v5.4 - - Added support for Dyno (based on work by Steve Garcia) diff --git a/Source/Apps/FDU/Makefile b/Source/Apps/FDU/Makefile index ade7444a..8ea7ff0b 100644 --- a/Source/Apps/FDU/Makefile +++ b/Source/Apps/FDU/Makefile @@ -1,7 +1,7 @@ -OBJECTS = FDU.com -DOCS = FDU.txt +OBJECTS = fdu.com +DOCS = fdu.doc DEST = ../../../Binary/Apps -DOCDEST = ../../../Doc +DOCDEST = ../../../Binary/Apps TOOLS = ../../../Tools include $(TOOLS)/Makefile.inc diff --git a/Source/Apps/FDU/fdu.asm b/Source/Apps/FDU/fdu.asm new file mode 100644 index 00000000..4a68735e --- /dev/null +++ b/Source/Apps/FDU/fdu.asm @@ -0,0 +1,4757 @@ +;=============================================================================== +; FDU - FLOPPY DISK UTILITY PROGRAM FOR RETROBREW COMPUTERS +;=============================================================================== +; +; AUTHOR: WAYNE WARTHEN (DERIVED FROM FDCMON BY ANDREW LYNCH & DAN WERNER) +;_______________________________________________________________________________ +; +; CHANGELOG: +; 2011-08-05: v1.0 INITIAL RELEASE +; 2011-08-25: v1.1 SUPPORT ZETA +; SUPPORT INT/WAIT +; 2011-08-28: v1.2 FIX ZETA RESET LOGIC (from Sergey) +; FIX ZETA MOTOR DISPLAY (from Sergey) +; NEW ZETA DISK CHANGE DISPLAY +; 2011-09-01: V1.3 ADDED CONFIGURABLE CPU FREQUENCY FOR DELAYS +; 2011-09-05: V1.4 USE CPU FREQUENCY FOR POLLING TIMEOUT +; 2011-09-19: V1.5 IMPROVED USE OF FDC RESET ON ZETA +; ADDED FDC RESET TO FDC CONTROL MENU +; 2011-09-24: V1.5a MINOR CORRECTION TO POLLING ROUTINE TO AVOID OVERRUN +; 2011-10-07: V2.0 PRELIMINARY SUPPORT FOR DUAL IDE +; 2011-10-13: V2.1 PRELIMINARY SUPPORT FOR N8 +; 2011-10-20: V2.2 INCLUDE BUSY & NDMA BITS IN RESULTS BYTE READY CHECKING +; 2011-10-22: V2.3 ADDED VERIFY FUNCTION +; 2011-11-25: V2.4 ADDED SUPPORT FOR DISKIO V3 +; 2012-01-09: V2.5 WARM START CP/M AT TERMINATION TO LOGOUT ALL DRIVES +; 2012-01-09: V2.6 EXPERIMENTAL SUPPORT FOR 5 1/4" DRIVES +; 2012-04-05: V2.7 SUPPORT FOR 8" DRIVES +; 2012-04-06: V2.7a FIXED MEDIA SELECTION MENU (DUPLICATE ENTRIES) +; 2012-04-08: V2.7b HANDLE DENSITY SELECT PROPERLY +; 2012-05-22: V2.8 ADDED NEW MEDIA DEFINITIONS (5.25", 320K) +; 2012-06-01: V2.9 ADDED INTERLEAVE CAPABILITY IN FORMAT COMMAND +; 2012-06-05: V3.0 DOCUMENTATION CLEANUP +; 2012-07-01: V3.1 MODIFY HLT FOR 8" MEDIA (50ms PER YD-180 SPEC) +; 2013-06-17: V3.2 CLEANED UP THE SRT, HLT, AND HUT VALUES +; 2015-02-10: V3.3 ADDED ZETA SBC V2 SUPPORT (SERGEY KISELEV) +; 2015-03-25: V4.0 RENAMED APP FDTST --> FD +; 2017-09-02: V5.0 RENAMED APP TO FDU (FLOPPY DISK UTILITY) +; DYNAMIC FDC SELECTION AT STARTUP +; DYNAMIC CPU SPEED ADJUSTMENT +; 2017-12-16: V5.1 IMPROVED POLLING READ/WRITE PERFORMANCE +; 2018-01-08: V5.2 ADDED RCBUS SUPPORT FOR: +; - SCOTT BAKER (SMB) SMC 9266 FDC +; - SCOTT BAKER (SMB) WDC 37C65 FDC +; 2018-09-05: v5.3 ADDED SUPPORT FOR SMALLZ80 +; - USE EOT=R TO END R/W AFTER ONE SECTOR INSTEAD +; OF USING PULSE TC +; 2020-01-05: V5.4 ADDED SUPPORT FOR DYNO FDC +; 2020-04-29: v5.5 ADDED SUPPORT FOR ETCHED PIXELS FDC +; 2020-12-12: v5.6 UPDATED SMALLZ80 TO NEW I/O ADDRESSES +; 2021-03-24: v5.7 ADDED SOME SINGLE-SIDED FORMATS +; 2021-07-26: v5.8 ADDED SUPPORT MBC FDC +; +;_______________________________________________________________________________ +; +; BUILDING: +; CAN BE BUILT WITH TASM LIKE THIS: +; TASM -t80 -b -fFF FDU.ASM FDU.COM FDU.LST +; +; TODO: +; 1) CURRENT TRACK IS UPDATED EVEN IF SEEK FAILS! (DEFER, RECOVERS AUTOMATICALLY) +; 2) CLEAN UP UTILITY ROUTINES (DEFER, NOT IMPORTANT) +; 3) TIGHTEN UP THE TIMING LOOPS (DEFER, LOW PRIORITY, WORKING FINE AS IS) +; 4) MOVE STX EVALUATION TO DIO LEVEL? (NOT SURE..., LOW PRIORITY) +; 5) ALLOW TO ABORT AT PROMPTS +; 6) ALLOW TO ABORT OPERATION IN PROGRESS +; 7) MOVE CONTINUE PROMPT TO A SEPARATE ROUTINE +; +;_______________________________________________________________________________ +; +; +FALSE .EQU 0 +TRUE .EQU ~FALSE +; +; FDC ID +; +FDC_DIO .EQU 0 +FDC_DIO3 .EQU 1 +FDC_ZETA .EQU 2 +FDC_ZETA2 .EQU 3 +FDC_DIDE .EQU 4 +FDC_N8 .EQU 5 +FDC_RCSMC .EQU 6 +FDC_RCWDC .EQU 7 +FDC_SMZ80 .EQU 8 +FDC_DYNO .EQU 9 +FDC_EPFDC .EQU 10 +FDC_MBC .EQU 11 +; +; FDC MODE +; +_DIO .EQU $01 ; CUSTOM FOR DIO BOARD +_DIO3 .EQU $02 ; CUSTOM FOR DIO3 BOARD +_ZETA .EQU $04 ; CUSTOM FOR ZETA +_RCSMC .EQU $08 ; CUSTOM FOR RCBUS SMB SMC MODULE +_PCAT .EQU $10 ; PC/AT MODE IN NEWER CONTROLLERS +; +;=============================================================================== +; MAIN PROGRAM PROCEDURE +;=============================================================================== +; + .ORG 00100H + + ; SAVE PREVIOUS STACK POINTER, AND SWITCH TO OUR STACK + LD (STACKSAV),SP + LD SP,STACK + + ; GENERAL INITIALIZATION (BIOS & SPEED DETECTION) + CALL INIT + JR NZ,EXIT + + ; SELECT FD CONTROLLER + CALL NEWLINE + CALL FDCSEL + JR NZ,EXIT + + ; SETUP FOR DEFAULT MEDIA AND RUN THE MAIN MENU + CALL DIO_SETMEDIA + LD HL,MM_INFO + CALL RUNMENU + +EXIT: + LD C,00H ; CP/M SYSTEM RESET (WARM START) + CALL 0005H ; RETURN TO CP/M + + ; CLEAN UP AND RETURN TO OS + CALL NEWLINE + LD SP,(STACKSAV) + RET + + HALT ; SHOULD NEVER GET HERE + +; +;=============================================================================== +; FD CONTROLLER SELECTION +;=============================================================================== +; +INIT: + ; DISPLAY PROGRAM STARTUP BANNER + CALL NEWLINE + LD DE,STR_BANNER + CALL WRITESTR + + ; UNA UBIOS DETECTION... + LD A,($FFFD) ; FIXED LOCATION OF UNA API VECTOR + CP $C3 ; JP INSTRUCTION? + JR NZ,INIT1 ; IF NOT, NOT UNA + LD HL,($FFFE) ; GET JP ADDRESS + LD A,(HL) ; GET BYTE AT TARGET ADDRESS + CP $FD ; FIRST BYTE OF UNA PUSH IX INSTRUCTION + JR NZ,INIT1 ; IF NOT, NOT UNA + INC HL ; POINT TO NEXT BYTE + LD A,(HL) ; GET NEXT BYTE + CP $E5 ; SECOND BYTE OF UNA PUSH IX INSTRUCTION + JR NZ,INIT1 ; IF NOT, NOT UNA + LD DE,STR_UBIOS ; POINT TO UBIOS TAG + CALL WRITESTR ; AND DISPLAY IT + + ; GET CPU SPEED FROM UBIOS + LD C,0F8H ; UNA BIOS GET PHI FUNCTION + RST 08 ; RETURNS SPEED IN HZ IN DE:HL + LD B,4 ; DIVIDE MHZ IN DE:HL BY 100000H +INIT0: + SRL D ; ... TO GET APPROX CPU SPEED IN + RR E ; ...MHZ. THROW AWAY HL, AND + DJNZ INIT0 ; ...RIGHT SHIFT DE BY 4. + INC E ; FIX UP FOR VALUE TRUNCATION + LD A,E ; PUT IN A + LD (CPUSPD),A ; SAVE IT + JR INIT3 ; AND DONE + +INIT1: + ; ROMWBW HBIOS DETECTION + LD HL,(0FFFEH) ; HL := ADR OR ROMWBW HBIOS IDENT + LD A,(HL) ; GET FIRST BYTE OF ROMWBW MARKER + CP 'W' ; MATCH? + JP NZ,INIT2 ; ABORT WITH INVALID CONFIG BLOCK + INC HL ; NEXT BYTE (MARKER BYTE 2) + LD A,(HL) ; LOAD IT + CP ~'W' ; MATCH? + JP NZ,INIT2 ; ABORT WITH INVALID CONFIG BLOCK + LD DE,STR_HBIOS ; POINT TO HBIOS TAG + CALL WRITESTR ; AND DISPLAY IT + + ; GET CPU SPEED FROM HBIOS + LD B,0F8H ; HBIOS SYSGET FUNCTION 0XF8 + LD C,0F0H ; CPUINFO SUBFUNCTION 0XF0 + RST 08 ; DO IT, L := CPU SPEED IN MHZ + LD A,L ; MOVE IT TO A + LD (CPUSPD),A ; SAVE IT + JR INIT3 ; AND DONE + +INIT2: + ;; NO KNOWN BIOS DETECTED, BAIL OUT W/ ERROR + ;LD DE,STR_BIOERR + ;CALL WRITESTR + ;OR 0FFH + ;RET + LD A,20 + LD (CPUSPD),A + +INIT3: + ; COMPUTE CPU SCALER FOR DELAY LOOPS + LD A,(CPUSPD) + CP 3 ; TEST FOR <= 2 (SPECIAL HANDLING) + JR C,INIT4 ; IF <= 2, SPECIAL PROCESSING + SUB 2 ; ADJUST AS REQUIRED BY DELAY FUNCTIONS + JR INIT5 ; AND CONTINUE +INIT4: + LD A,1 ; USE THE MIN VALUE OF 1 +INIT5: + LD (CPUSCL),A ; UPDATE CPU SCALER VALUE + + ; REMAINDER OF BANNER + CALL NEWLINE + LD DE,STR_BANNER2 + CALL WRITESTR + + ; INITIALIZATION DONE + XOR A + RET + +STR_BANNER .DB "Floppy Disk Utility (FDU) v5.8, 26-Jul-2021$" +STR_BANNER2 .DB "Copyright (C) 2021, Wayne Warthen, GNU GPL v3","$" +STR_HBIOS .DB " [HBIOS]$" +STR_UBIOS .DB " [UBIOS]$" +; +STR_BIOERR .DB "\r\n\r\n*** Unknown BIOS ***\r\n$" +; +CPUSPD .DB 20 ; DEFAULT TO SAFE (HIGH) VALUE +CPUSCL .DB 0 ; CPU SPEED DELAY SCALER (COMPUTED) + +; +;=============================================================================== +; FD CONTROLLER SELECTION +;=============================================================================== +; +FDCSEL: + ; PROMPT + LD DE,FSS_MENU + CALL WRITESTR +; +FDCSEL1: + CALL GETKEYUC + CP 'X' ; EXIT? + JR NZ,FDCSEL2 ; IF NOT, CONTINUE + OR 0FFH ; ELSE SET NZ FOR EXIT REQUEST + RET ; AND RETURN +; +FDCSEL2: + SUB 'A' ; ASCII -> BINARY + CP FDCCNT ; TOO HIGH? + JR NC,FDCSEL1 ; IF SO, TRY AGAIN +; + ; SAVE SELECTED FDC IDENTIFIER + LD (FDCID),A ; RECORD THE FDC ID + RLCA ; TIMES 4 + RLCA ; ... FOR 4 BYTE ENTRIES + LD HL,FDCTBL ; POINT TO FDC INSTANCE TABLE + CALL ADDHLA ; OFFSET TO DESRIED ENTRY, A TRASHED + LD E,(HL) ; LOAD LABEL PTR INTO DE + INC HL ; ... + LD D,(HL) ; ... + LD (FDCLBL),DE ; SAVE LABEL PTR + INC HL ; BUMP TO CFG POINTER + LD E,(HL) ; LOAD CFG PTR INTO DE + INC HL ; ... + LD D,(HL) ; ... + LD (FDCCFG),DE ; SAVE CFG PTR + LD IY,(FDCCFG) ; AND INIT A WORKING COPY + LD A,(IY+CFG_MODE) ; GET MODE BITMAP BYTE + LD (FDCBM),A ; SAVE IT TO ACTIVE WORKING COPY +; + LD DE,(FDCLBL) ; GET LABEL POINTER + CALL WRITESTR ; AND DISPLAY IT +; + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; TABLE OF FDC CONTROLLERS +; +FDCTBL: ; LABEL CONFIG DATA + ; ----- ----------- + .DW STR_DIO, CFG_DIO + .DW STR_DIO3, CFG_DIO3 + .DW STR_ZETA, CFG_ZETA + .DW STR_ZETA2, CFG_ZETA2 + .DW STR_DIDE, CFG_DIDE + .DW STR_N8, CFG_N8 + .DW STR_RCSMC, CFG_RCSMC + .DW STR_RCWDC, CFG_RCWDC + .DW STR_SMZ80, CFG_SMZ80 + .DW STR_DYNO, CFG_DYNO + .DW STR_EPFDC, CFG_EPFDC + .DW STR_MBC, CFG_MBC +FDCCNT .EQU ($-FDCTBL)/4 ; FD CONTROLLER COUNT +; +; FDC LABEL STRINGS +; +STR_DIO .TEXT "DISKIO$" +STR_DIO3 .TEXT "DISKIO3$" +STR_ZETA .TEXT "ZETA$" +STR_ZETA2 .TEXT "ZETA2$" +STR_DIDE .TEXT "D-IDE$" +STR_N8 .TEXT "N8$" +STR_RCSMC .TEXT "RC-SMC$" +STR_RCWDC .TEXT "RC-WDC$" +STR_SMZ80 .TEXT "SMZ80$" +STR_DYNO .TEXT "DYNO$" +STR_EPFDC .TEXT "EPFDC$" +STR_MBC .TEXT "MBC$" +; +; FDC CONFIGURATION BLOCKS +; +CFG_MSR .EQU 0 +CFG_DATA .EQU 1 +CFG_DIR .EQU 2 +CFG_DOR .EQU 3 +CFG_DCR .EQU 4 +CFG_DACK .EQU 5 +CFG_TC .EQU 6 +CFG_DMA .EQU 7 +CFG_MODE .EQU 8 +; +CFG_DIO: + .DB 036H ; FDC MAIN STATUS REGISTER + .DB 037H ; FDC DATA PORT + .DB 038H ; DATA INPUT REGISTER + .DB 03AH ; DIGITAL OUTPUT REGISTER (LATCH) + .DB 0FFH ; DCR + .DB 0FFH ; DACK + .DB 0FFH ; TERMINAL COUNT (W/ DACK) + .DB 03CH ; PSEUDO DMA DATA PORT + .DB _DIO ; MODE= +CFG_DIO3: + .DB 036H ; FDC MAIN STATUS REGISTER + .DB 037H ; FDC DATA PORT + .DB 038H ; DATA INPUT REGISTER + .DB 03AH ; DIGITAL OUTPUT REGISTER (LATCH) + .DB 0FFH ; DCR + .DB 0FFH ; DACK + .DB 0FFH ; TERMINAL COUNT (W/ DACK) + .DB 03CH ; PSEUDO DMA DATA PORT + .DB _DIO3 ; MODE= +CFG_ZETA: + .DB 036H ; FDC MAIN STATUS REGISTER + .DB 037H ; FDC DATA PORT + .DB 038H ; DATA INPUT REGISTER + .DB 03AH ; DIGITAL OUTPUT REGISTER (LATCH) + .DB 0FFH ; DCR + .DB 0FFH ; DACK + .DB 0FFH ; TERMINAL COUNT (W/ DACK) + .DB 03CH ; PSEUDO DMA DATA PORT + .DB _ZETA ; MODE= +; +CFG_ZETA2: + .DB 030H ; FDC MAIN STATUS REGISTER + .DB 031H ; FDC DATA PORT + .DB 0FFH ; DATA INPUT REGISTER + .DB 038H ; DIGITAL OUTPUT REGISTER + .DB 028H ; CONFIGURATION CONTROL REGISTER + .DB 0FFH ; DACK + .DB 038H ; TERMINAL COUNT (W/ DACK) + .DB 0FFH ; NOT USED BY ZETA SBC V2 + .DB _PCAT ; MODE= +; +CFG_DIDE: + .DB 02AH ; FDC MAIN STATUS REGISTER + .DB 02BH ; FDC DATA PORT + .DB 0FFH ; DATA INPUT REGISTER + .DB 02CH ; DOR + .DB 02DH ; DCR + .DB 03CH ; DACK + .DB 03DH ; TERMINAL COUNT (W/ DACK) + .DB 0FFH ; NOT USED BY DIDE + .DB _PCAT ; MODE= +; +CFG_N8: + .DB 08CH ; FDC MAIN STATUS REGISTER + .DB 08DH ; FDC DATA PORT + .DB 0FFH ; DATA INPUT REGISTER + .DB 092H ; DOR + .DB 091H ; DCR + .DB 090H ; DACK + .DB 093H ; TERMINAL COUNT (W/ DACK) + .DB 0FFH ; NOT USED BY N8 + .DB _PCAT ; MODE= +; +CFG_RCSMC: + .DB 050H ; FDC MAIN STATUS REGISTER + .DB 051H ; FDC DATA PORT + .DB 0FFH ; DATA INPUT REGISTER + .DB 058H ; DIGITAL OUTPUT REGISTER (LATCH) + .DB 0FFH ; DCR + .DB 0FFH ; DACK + .DB 0FFH ; TERMINAL COUNT (W/ DACK) + .DB 0FFH ; PSEUDO DMA DATA PORT + .DB _RCSMC ; MODE= +; +CFG_RCWDC: + .DB 050H ; FDC MAIN STATUS REGISTER + .DB 051H ; FDC DATA PORT + .DB 0FFH ; DATA INPUT REGISTER + .DB 058H ; DIGITAL OUTPUT REGISTER (LATCH) + .DB 048H ; DCR + .DB 0FFH ; DACK + .DB 058H ; TERMINAL COUNT (W/ DACK) + .DB 0FFH ; PSEUDO DMA DATA PORT + .DB _PCAT ; MODE= +; +CFG_SMZ80: + .DB 074H ; FDC MAIN STATUS REGISTER + .DB 075H ; FDC DATA PORT + .DB 0FFH ; DATA INPUT REGISTER + .DB 072H ; DIGITAL OUTPUT REGISTER (LATCH) + .DB 077H ; DCR + .DB 0FFH ; DACK + .DB 0FFH ; TERMINAL COUNT (W/ DACK) + .DB 0FFH ; PSEUDO DMA DATA PORT + .DB _PCAT ; MODE= +; +CFG_DYNO: + .DB 084H ; FDC MAIN STATUS REGISTER + .DB 085H ; FDC DATA PORT + .DB 0FFH ; DATA INPUT REGISTER + .DB 086H ; DIGITAL OUTPUT REGISTER (LATCH) + .DB 087H ; DCR + .DB 0FFH ; DACK + .DB 086H ; TERMINAL COUNT (W/ DACK) + .DB 0FFH ; PSEUDO DMA DATA PORT + .DB _PCAT ; MODE= +; +CFG_EPFDC: + .DB 048H ; FDC MAIN STATUS REGISTER + .DB 049H ; FDC DATA PORT + .DB 0FFH ; DATA INPUT REGISTER + .DB 04AH ; DIGITAL OUTPUT REGISTER (LATCH) + .DB 04BH ; DCR + .DB 0FFH ; DACK + .DB 04CH ; TERMINAL COUNT (W/ DACK) + .DB 0FFH ; PSEUDO DMA DATA PORT + .DB _PCAT ; MODE= +; +CFG_MBC: + .DB 030H ; FDC MAIN STATUS REGISTER + .DB 031H ; FDC DATA PORT + .DB 0FFH ; DATA INPUT REGISTER + .DB 036H ; DIGITAL OUTPUT REGISTER (WHEN WRITTEN) + .DB 035H ; CONFIGURATION CONTROL REGISTER + .DB 036H ; DACK (WHEN READ) + .DB 037H ; TERMINAL COUNT (W/ DACK) + .DB 0FFH ; NOT USED BY ZETA SBC V2 + .DB _PCAT ; MODE= +; +FDCID .DB 0 ; FDC IDENTIFIER (0 INDEXED) +FDCBM .DB 0 ; FDC ID BITMAP +FDCLBL .DW 0 ; POINTER TO ACTIVE FDC LABEL STRING +FDCCFG .DW 0 ; POINTER TO ACTIVE CFG DATA +; +FSS_MENU: + .TEXT "\r\n" + .TEXT "SELECT FLOPPY DISK CONTROLLER:\r\n" + .TEXT " (A) Disk IO ECB Board\r\n" + .TEXT " (B) Disk IO 3 ECB Board\r\n" + .TEXT " (C) Zeta SBC Onboard FDC\r\n" + .TEXT " (D) Zeta 2 SBC Onboard FDC\r\n" + .TEXT " (E) Dual IDE ECB Board\r\n" + .TEXT " (F) N8 Onboard FDC\r\n" + .TEXT " (G) RCBus SMC (SMB)\r\n" + .TEXT " (H) RCBus WDC (SMB)\r\n" + .TEXT " (I) SmallZ80 Expansion\r\n" + .TEXT " (J) Dyno-Card FDC, D1030\r\n" + .TEXT " (K) RCBus EPFDC\r\n" + .TEXT " (L) Multi-Board Computer FDC\r\n" + .TEXT " (X) Exit\r\n" + .TEXT "=== OPTION ===> $\r\n" +; +;=============================================================================== +; MAIN MENU +;=============================================================================== +; +; MAIN MENU DATA +; +MM_TABLE .DB 'S' \ .DW MMS_SETUP, MM_SETUP +MM_ENTSIZ .EQU $ - MM_TABLE + .DB 'R' \ .DW MMS_READ, MM_READ + .DB 'W' \ .DW MMS_WRITE, MM_WRITE + .DB 'F' \ .DW MMS_FORMAT, MM_FORMAT + .DB 'V' \ .DW MMS_VERIFY, MM_VERIFY + .DB 'I' \ .DW MMS_INITBUF, MM_INITBUF + .DB 'D' \ .DW MMS_DUMPBUF, MM_DUMPBUF + .DB 'C' \ .DW MMS_FDCMENU, MM_FDCMENU + .DB 'X' \ .DW MMS_EXIT, 0000H +MM_COUNT .EQU (($ - MM_TABLE) / MM_ENTSIZ) ; # ENTRIES IN TABLE +MM_INFO: .DW MM_DRAW + .DW MM_TABLE + .DB MM_ENTSIZ + .DB MM_COUNT +; +; MAIN MENU DISPLAY STRINGS +; +STR_MAINMENU: + .TEXT "=======================<< FDU MAIN MENU >>======================\r\n" +; .TEXT "(S)ETUP: UNIT=XX MEDIA=XXXXXXXXXXXXX MODE=XXXXXXXXXX TRACE=XX\r\n" + .TEXT "(S)ETUP: UNIT=" +MV_UNIT .TEXT "XX" + .TEXT " MEDIA=" +MV_MED .TEXT "XXXXXXXXXXXXX" + .TEXT " MODE=" +MV_MODE .TEXT "XXXXXXXXXX" + .TEXT " TRACE=" +MV_TRC .TEXT "XX" + .TEXT "\r\n" + .TEXT "----------------------------------------------------------------\r\n" + .TEXT "(R)EAD (W)RITE (F)ORMAT (V)ERIFY\r\n" + .TEXT "(I)NIT BUFFER (D)UMP BUFFER FDC (C)MDS E(X)IT\r\n" + .TEXT "=== OPTION ===> $\r\n" +; +MMS_SETUP: .TEXT "SETUP$" +MMS_READ: .TEXT "READ$" +MMS_WRITE: .TEXT "WRITE$" +MMS_FORMAT: .TEXT "FORMAT$" +MMS_VERIFY: .TEXT "VERIFY$" +MMS_INITBUF: .TEXT "INITIALIZE BUFFER$" +MMS_DUMPBUF: .TEXT "DUMP BUFFER$" +MMS_FDCMENU: .TEXT "FDC MENU$" +MMS_EXIT: .TEXT "EXIT$" +; +; MAIN MENU DRAW PROCEDURE +; +MM_DRAW: + CALL NEWLINE + CALL NEWLINE + + ; UPDATE FDC LABEL + LD DE,STR_MAINMENU + 5 + LD A,' ' + LD (DE),A + INC DE + LD HL,(FDCLBL) + CALL COPYSTR + LD A,' ' + LD (DE),A + + ; UPDATE UNIT + LD DE,MV_UNIT + LD A,(DCD_UNIT) + CALL HEXSTRBYTE + + ; UPDATE MEDIA + LD DE,(MDB_LABEL) + LD HL,MV_MED + CALL STRCPY + + ; UPDATE MODE + LD A,(DCD_MD) + RLA + LD E,A + LD D,0 + LD HL,MDT + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) + EX DE,HL + LD E,(HL) + INC HL + LD D,(HL) + LD HL,MV_MODE + CALL STRCPY + + ; UPDATE TRACE + LD DE,MV_TRC + LD A,(DCD_TRACE) + CALL HEXSTRBYTE + + ; DISPLAY THE MENU + LD DE,STR_MAINMENU + CALL WRITESTR + + RET +; +; MAIN MENU FUNCTIONS +; +MM_SETUP: + CALL MM_GETSETUP + CALL DIO_SETMEDIA + RET + +MM_READ: + LD A,DOP_READ + LD (DCD_DOP),A + CALL MM_GETTGT + CALL MM_GETTGTPARMS + CALL MMOP_PROC + RET + +MM_WRITE: + LD A,DOP_WRITE + LD (DCD_DOP),A + CALL MM_GETTGT + CALL MM_GETTGTPARMS + CALL MMOP_PROC + RET + +MM_FORMAT: + LD A,DOP_FORMAT + LD (DCD_DOP),A + CALL MM_GETTGT + CALL MM_GETTGTPARMS + CALL MM_GETINTRLV + CALL MMOP_PROC + RET + +MM_VERIFY: + LD A,DOP_VERIFY + LD (DCD_DOP),A + CALL MM_GETTGT + CALL MM_GETTGTPARMS + CALL MM_SETVFYBUF + CALL MMOP_PROC + RET + +MM_INITBUF: + CALL PC_SPACE + LD DE,MMPS_IBOPT + CALL WRITESTR +MM_IBKEY: + CALL GETKEYUC + CP 'P' ; PATTERN + JP Z,MM_IBPAT + CP 'F' ; FILL + JP Z,MM_IBFILL + JP MM_IBKEY +MM_IBPAT: + LD DE,MMBS_PATTERN + CALL PC_SPACE + CALL WRITESTR + CALL MM_GETPATTERN + LD HL,BUFFER + LD DE,BUFSIZ + LD A,(DCD_PATTERN) + LD B,A + CALL PAT_BUFFER + RET +MM_IBFILL: + LD DE,MMBS_FILL + CALL WRITESTR + CALL PC_SPACE + CALL MM_GETFILL + LD HL,BUFFER + LD DE,BUFSIZ + LD A,(DCD_FILL) + LD B,A + CALL FILL_BUFFER + RET + +MM_DUMPBUF: + LD HL,BUFFER ; SET ADDRESS TO DUMP + LD DE,BUFFER ; SET END ADDRESS + INC D ; + INC D ; + CALL DUMP_BUFFER ; DUMP BUFFER TO CONSOLE + RET + +MM_FDCMENU: + CALL DIO_INIT + CALL FDCMENU + CALL DIO_TERM + RET +; +; MAIN MENU SUPPORT FUNCTIONS +; +MM_GETSETUP: + LD DE,MMP_UNIT + LD HL,DCD_UNIT + LD BC,0003H + CALL GETHEXBYTERNG + + CALL MM_MEDIALIST + LD DE,MMP_MEDIA + LD HL,DCD_MT + LD B,0 + LD A,MIT_ENTCNT + DEC A + LD C,A + CALL GETHEXBYTERNG + +MM_GETMODE: + CALL MM_MODELIST + LD DE,MMP_MODE + LD HL,DCD_MD + LD B,0 + LD A,MDT_ENTCNT + DEC A + LD C,A + CALL GETHEXBYTERNG + + ; VALIDATE MODE AGAINST CURRENT FDC + INC A ; PREP VALUE FOR LOOP + LD B,A ; PUT IN LOOP COUNTER + XOR A ; CLEAR A + SCF ; SET CF +MM_GETMODE1: + RLA ; ROTATE BIT ONE POSITION + DJNZ MM_GETMODE1 ; UNTIL BIT SET FOR MODE SPECIFIED + PUSH AF ; SAVE IT + LD A,(FDCID) ; A := FDC ID + LD HL,MD_MAP ; HL := START OF MODE MAP + CALL ADDHLA ; OFFSET TO CORRECT ENTRY FOR FDC + POP AF ; RECOVER MODE BIT VALUE + AND (HL) ; MASK WITH MODE MAP OF FDC + JR NZ,MM_TRACE ; NON-ZERO IS A MODE MATCH FOR FDC, CONTINUE + LD DE,MM_MODEERR ; INVALID MODE FOR FDC ERROR MESSAGE + CALL WRITESTR + JR MM_GETMODE + +MM_TRACE: + LD DE,MMP_TRACE + LD HL,DCD_TRACE + LD BC,0001H + CALL GETHEXBYTERNG + + RET + +MM_GETFILL: + LD DE,MMP_FILL + LD HL,DCD_FILL + CALL GETHEXBYTE + RET + +MM_GETPATTERN: + LD DE,MMP_PATTERN + LD HL,DCD_PATTERN + CALL GETHEXBYTE + RET + +MM_GETTGT: + CALL PC_SPACE + LD A,(DCD_DOP) + LD DE,MMPS_TGTF + CP DOP_FORMAT + JP Z,MM_GETTGT0 + LD DE,MMPS_TGTRW +MM_GETTGT0: + CALL WRITESTR +MM_GETTGT1: + CALL GETKEYUC + + LD B,MMT_TRACK + LD DE,MMTS_TRACK + CP 'T' + JP Z,MM_GETTGT3 + LD B,MMT_DISK + LD DE,MMTS_DISK + CP 'D' + JP Z,MM_GETTGT3 + ; FORMAT CANNOT DO THE NEXT ONES (GETTGT2 CHECKS FOR THIS) + LD B,MMT_SECTOR + LD DE,MMTS_SECTOR + CP 'S' + JP Z,MM_GETTGT2 + LD B,MMT_RANDOM + LD DE,MMTS_RANDOM + CP 'R' + JP Z,MM_GETTGT2 + JP MM_GETTGT1 +MM_GETTGT2: ; PREVENT FORMAT FROM USING SECTOR OR RANDOM FUNCTIONS + LD A,(DCD_DOP) + CP DOP_FORMAT + JP Z,MM_GETTGT1 +MM_GETTGT3: + LD A,B + LD (MMD_TGT),A + CALL WRITESTR + RET + +MM_GETTGTPARMS: + LD A,(MMD_TGT) + CP MMT_DISK + JP Z,MM_GETTGTPARMS1 + CP MMT_RANDOM + JP Z,MM_GETTGTPARMS1 + CALL MM_GETTRACK + CALL MM_GETHEAD + LD A,(MMD_TGT) + CP MMT_TRACK + JP Z,MM_GETTGTPARMS1 + CALL MM_GETSECTOR + JP MM_GETTGTPARMSX +MM_GETTGTPARMS1: + LD A,1 ; FIX UP THE SECTOR VALUE TO BE 1 IF NOT SINGLE SECTOR MODE + LD (DCD_SECTOR),A +MM_GETTGTPARMSX: + RET + +MM_GETTRACK: + LD DE,MMP_TRACK + LD HL,DCD_TRACK + LD B,0 + LD A,(MDB_NUMCYL) + DEC A + LD C,A + CALL GETHEXBYTERNG + RET + +MM_GETHEAD: + LD DE,MMP_HEAD + LD HL,DCD_HEAD + LD B,0 + LD A,(MDB_NUMHD) + DEC A + LD C,A + CALL GETHEXBYTERNG + RET + +MM_GETSECTOR: + LD DE,MMP_SECTOR + LD HL,DCD_SECTOR + LD A,(MDB_SOT) + LD B,A + LD A,(MDB_EOT) + LD C,A + CALL GETHEXBYTERNG + RET + +MM_GETINTRLV: + LD DE,MMP_INTRLV + LD HL,DCD_INTRLV + LD B,1 + LD A,(MDB_NUMSEC) + LD C,A + CALL GETHEXBYTERNG + RET + +MM_MEDIALIST: + LD HL,MIT + LD B,MIT_ENTCNT + LD C,0 +MM_MEDIALISTLOOP: + CALL NEWLINE + LD A,C + CALL PRTHEXBYTE + CALL PC_COLON + CALL PC_SPACE + PUSH HL + + LD A,(HL) ; HL = ENTRY VALUE + INC HL ; " + LD H,(HL) ; " + LD L,A ; " + + INC HL + INC HL + + LD A,(HL) ; HL = ENTRY VALUE + INC HL ; " + LD D,(HL) ; " + LD E,A ; " + + CALL WRITESTR + + POP HL + INC HL + INC HL + INC C + DJNZ MM_MEDIALISTLOOP + RET + +MM_MODELIST: + LD HL,MDT + LD B,MDT_ENTCNT + LD C,0 +MM_MODELISTLOOP: + CALL NEWLINE + LD A,C + CALL PRTHEXBYTE + CALL PC_COLON + CALL PC_SPACE + PUSH HL + + LD A,(HL) ; HL = ENTRY VALUE + INC HL ; " + LD H,(HL) ; " + LD L,A ; " + + INC HL + INC HL + + LD A,(HL) ; HL = ENTRY VALUE + INC HL ; " + LD D,(HL) ; " + LD E,A ; " + + CALL WRITESTR + + POP HL + INC HL + INC HL + INC C + DJNZ MM_MODELISTLOOP + RET + +MM_SETVFYBUF: + LD HL,BUFFER + LD DE,VFYBUF + LD BC,BUFSIZ + LDIR + RET +; +; MAIN MENU PROMPTS +; +MMP_FILL .TEXT "FILL VALUE$" +MMP_PATTERN .TEXT "PATTERN START VALUE$" +MMP_UNIT .TEXT "UNIT$" +MMP_TRACE .TEXT "TRACE LEVEL$" +MMP_TRACK .TEXT "TRACK$" +MMP_HEAD .TEXT "HEAD$" +MMP_SECTOR .TEXT "SECTOR$" +MMP_MEDIA .TEXT "MEDIA$" +MMP_MODE .TEXT "MODE$" +MMP_INTRLV .TEXT "INTERLEAVE$" +; +; MAIN MENU TARGET +; +MMT_SECTOR .EQU 'S' ; PERFORM OPERATION ON ONE SECTOR +MMT_TRACK .EQU 'T' ; PERFORM OPERATION ON ONE TRACK +MMT_DISK .EQU 'D' ; PERFORM OPERATION ON ENTIRE DISK +MMT_RANDOM .EQU 'R' ; PERFORM OPERATION ON RANDOM SECTORS +; +; MAIN MENU TARGET STRINGS +; +MMTS_SECTOR .TEXT "SECTOR$" +MMTS_TRACK .TEXT "TRACK$" +MMTS_DISK .TEXT "DISK$" +MMTS_RANDOM .TEXT "RANDOM$" +; +; MAIN MENU DATA +; +MMD_TGT .DB MMT_SECTOR +; +; MAIN MENU PROMPT STRINGS +; +MMPS_TGTRW .TEXT "(S)ECTOR, (T)RACK, (D)ISK, (R)ANDOM ===> $" +MMPS_TGTF .TEXT "(T)RACK, (D)ISK ===> $" +MMPS_IBOPT .TEXT "(P)ATTERN, (F)ILL ===> $" +; +; MAIN MENU BUFFER OPTIONS +; +MMBS_PATTERN .TEXT "PATTERN$" +MMBS_FILL .TEXT "FILL$" +; +; +; +MM_MODEERR .TEXT "\r\n\r\n*** SELECTED MODE NOT SUPPORTED ON HARDWARE ***\r\n$" +; +;________________________________________________________________________________________________________________________________ +; +; MAIN MENU OPERATIONS +;________________________________________________________________________________________________________________________________ +; +MMOP_PROC: + CALL NEWLINE + CALL NEWLINE + + LD A,FALSE + LD (DCD_ABORT),A + + CALL DIO_INIT + + LD A,(MMD_TGT) + CP MMT_DISK + JP Z,MMOP_PROCDISK + CP MMT_TRACK + JP Z,MMOP_PROCTRK + CP MMT_SECTOR + JP Z,MMOP_PROCSEC + CP MMT_RANDOM + JP Z,MMOP_PROCRND + + JP MMOP_PROCX + +MMOP_PROCDISK: + CALL MMOP_DISK + JP MMOP_PROCX + +MMOP_PROCTRK: + CALL MMOP_TRACK + JP MMOP_PROCX + +MMOP_PROCSEC: + CALL MMOP_SECTOR + JP MMOP_PROCX + +MMOP_PROCRND: + CALL MMOP_RANDOM + JP MMOP_PROCX + +MMOP_PROCX: + CALL DIO_TERM + RET + +MMOP_DISK: + LD A,0 + LD (DCD_TRACK),A + LD (DCD_HEAD),A +MMOP_DISK1: + LD A,(DCD_ABORT) + CP TRUE + JP Z,MMOP_DISKX + + CALL MMOP_TRACK + + LD A,(MDB_NUMHD) + LD C,A + LD A,(DCD_HEAD) ; INC HEAD + INC A + LD (DCD_HEAD),A + CP C ; # OF HEADS + JP NZ,MMOP_DISK1 ; LOOP IF LESS THAN # OF HEADS + LD A,0 ; RESET HEAD + LD (DCD_HEAD),A ; AND FALL THROUGH TO INC TRACK + + LD A,(MDB_NUMCYL) + LD C,A + LD A,(DCD_TRACK) ; INC TRACK + INC A + LD (DCD_TRACK),A + CP C ; # OF TRACKS + JP NZ,MMOP_DISK1 +MMOP_DISKX: + LD A,0 ; RESET TRACK TO A VALID VALUE + LD (DCD_TRACK),A + RET + +MMOP_TRACK: + LD A,(DCD_DOP) ; SPECIAL CASE, FORMAT IS TRACK-AT-A-TIME + CP DOP_FORMAT + JP Z,MMOP_TRACKFMT + + LD A,(MDB_SOT) + LD (DCD_SECTOR),A +MMOP_TRACK1: + LD A,(DCD_ABORT) + CP TRUE + JP Z,MMOP_TRACKX + + CALL DIO_RUN + + LD A,(MDB_EOT) + LD C,A + INC C ; ONE MORE THAN EOT + LD A,(DCD_SECTOR) ; INC SECTOR + INC A + LD (DCD_SECTOR),A + CP C ; > MAX SECTOR? + JP NZ,MMOP_TRACK1 + JP MMOP_TRACKX + +MMOP_TRACKFMT: + CALL DIO_RUN + JP MMOP_TRACKX + +MMOP_TRACKX: + LD A,(MDB_SOT) ; RESET SECTOR TO A VALID VALUE + LD (DCD_SECTOR),A + RET + +MMOP_SECTOR: + CALL DIO_RUN + RET + +MMOP_RANDOM: + LD B,20H ; READ 20H SECTORS RANDOMLY + +MMOP_RANDOM0: + LD A,(DCD_ABORT) + CP TRUE + JP Z,MMOP_RANDOMX + + PUSH BC + +MMOP_RANDOM1: ; GENERATE RANDOM TRACK + LD A,(MDB_NUMCYL) + LD C,A + CALL RNDBYTE + AND 7FH ; USE 7 BITS FOR UP TO 128 TRACKS + CP C ; MAX TRACK IS 4F + 1 = 50H + JP P,MMOP_RANDOM1 + LD (DCD_TRACK),A + +MMOP_RANDOM2: ; GENERATE RANDOM HEAD + ;OR A + ;CALL RNDBYTE + ;AND 01H ; JUST USE LOW ORDER BIT + ;LD (DCD_HEAD),A + LD A,(MDB_NUMHD) + LD C,A + CALL RNDBYTE + AND 01H ; USE 1 BIT FOR UP TO 2 HEADS + CP C + JP P,MMOP_RANDOM2 + LD (DCD_HEAD),A + +MMOP_RANDOM3: ; GENERATE RANDOM SECTOR + LD A,(MDB_EOT) + LD C,A + INC C ; ONE MORE THEN MAX SECTOR + CALL RNDBYTE + AND 1FH ; USE 5 BITS FOR UP TO 32 SECTORS + CP C ; MAX SECTOR NUM IS 9 + 1 = 0AH + JP P,MMOP_RANDOM3 + CP 00H ; SECTOR NUM STARTS AT 1, DON'T ALLOW ZERO + JP Z,MMOP_RANDOM3 + LD (DCD_SECTOR),A + + CALL DIO_RUN + + POP BC + DJNZ MMOP_RANDOM0 + +MMOP_RANDOMX: + RET + +; +;=============================================================================== +; DISK INPUT/OUTPUT SERVICES, DEVICE INDEPENDENT (LOGICAL) ACCESS TO STORAGE +; TRANSLATES BETWEEN LOGICAL AND PHYSICAL DEVICE OPERATIONS +;=============================================================================== +; +; +STR_CONTINUE: + .TEXT "CONTINUE? (A)BORT, (R)ETRY, (I)GNORE ===> $" +; +DIO_SETMEDIA: + ; INITIZLIZE THE MEDIA DESCRIPTION BLOCK + ; FILL IN MDB BASED ON USER SELECTION + LD A,(DCD_MT) ; A = MEDIA ID (OFFSET IN MEDIA INDEX TABLE) + ADD A,A ; * 2 (2 BYTES PER ENTRY) + LD H,0 ; MOVE IT TO HL + LD L,A ; " + LD DE,MIT ; DE = START OF MEDIA INDEX TABLE + ADD HL,DE ; ADD HL TO DE, HL NOW POINTS TO DESIRED ENTRY + LD A,(HL) ; HL = ENTRY VALUE + INC HL ; " + LD H,(HL) ; " + LD L,A ; " + LD DE,MDB ; HL = SOURCE, DE = DESTINATION + LD BC,MDB_LEN ; BC = BYTES TO COPY + LDIR ; COPY ENTRY TO FCD + + LD A,FALSE ; SET DRIVE READY TO FALSE! + LD (DCD_DSKRDY),A ; " + RET +; +DIO_INIT: + ; UPDATE DRIVE SELECTTION + LD A,(FCD_DS) ; GET THE CURRENT DRIVE SELECTION + LD B,A ; SAVE IN B + LD A,(DCD_UNIT) ; GET THE NEW DRIVE SELECTION + CP B ; CHANGED? + ; WE NEED TO SET DRIVE STATUS TO NOT READY IFF IT CHANGED + JP Z,DIO_INIT1 ; DO NOT RESET DRIVE STATUS! + LD (FCD_DS),A ; UPDATE FCD_DS TO NEW VALUE + LD A,FALSE ; SET DRIVE READY TO FALSE! + LD (DCD_DSKRDY),A ; " + +DIO_INIT1: + ; INITIALIZE TRACE SETTING + LD A,(DCD_TRACE) + LD (FCD_TRACE),A + + LD HL,MDB_FCD ; HL = SOURCE + LD DE,FCD ; DE = DESTINATION + LD BC,FCD_LEN ; BC = BYTES TO COPY + LDIR ; BYTES COPY FROM MDB TO FCD + + LD A,0 ; ASSUME DMA (NON-DMA = 0) + LD (FCD_ND),A + LD A,(DCD_MD) + CP MD_DRQWAIT + JP Z,DIO_INIT2 ; YES, DMA NEEDED, DO IT + + LD A,1 ; SET TO NON-DMA (NDMA = 1) + LD (FCD_ND),A + +DIO_INIT2: + CALL FC_INIT + CALL FC_MOTORON + RET + +DIO_TERM: + CALL FC_MOTOROFF + RET +; +; DIO_CLRDSKCHG +; +DIO_CLRDSKCHG: + ; PROCESS ANY PENDING DISK CHANGE NOTIFICATIONS + LD B,5 +DIO_CLRDSKCHG1: + PUSH BC + CALL FC_SENSEINT + POP BC + CALL DIO_CHKFC + CP FRC_DSKCHG + RET NZ + DJNZ DIO_CLRDSKCHG1 + RET +; +; DIO_WTSEEK +; +; WAIT FOR PENDING SEEK OPERATION TO COMPLETE BY POLLING SENSEINT +; AND WAITING FOR ABTERM OR OK. +; +DIO_WTSEEK: + LD BC,1000H +; LD BC,20H ; *DEBUG* +; LD BC,1H ; *DEBUG* +DIO_WTSEEKLOOP: + PUSH BC + CALL FC_SENSEINT + POP BC + + LD A,(FST_RC) ; CHECK RC + CP FRC_ABTERM ; ABTERM = DONE + RET Z + CP FRC_OK ; OK = DONE + RET Z + + DEC BC ; CHECK LOOP COUNTER IN BC + LD A,B ; " + OR C ; " + JP NZ,DIO_WTSEEKLOOP ; LOOP UNTIL COUNTER EXHAUSTED + +DIO_DRIVERESET: + CALL NEWLINE + CALL NEWLINE + LD DE,STR_DRIVERESET + CALL WRITESTR + + CALL FC_RESETFDC + + CALL DIO_CLRDSKCHG + CALL DIO_CHKFC + CP FRC_INVCMD ; INVALID COMMAND IS CORRECT RESPONSE HERE + JP NZ,DIO_NORESP + + ; CONTINUE RESET SEQUENCE WITH 'SPECIFY' COMMAND + CALL FC_SPECIFY + CALL DIO_CHKFC + JP NZ,DIO_NORESP + + CALL FC_RECAL + CALL DIO_CHKFC + JP NZ,DIO_NORESP + + ; CAREFUL... FIRST RECAL MAY FAIL TO REACH TRACK 0 + ; SO WE ALLOW FOR A SECOND TRY IN CASE OF A FAILURE + CALL DIO_WTSEEK + CALL DIO_CHKFC + JP Z,DIO_DRIVERESET1 + + ; SECOND TRY, ONLY IF NEEDED + CALL FC_RECAL + CALL DIO_CHKFC + JP NZ,DIO_NORESP + + CALL DIO_WTSEEK + CALL DIO_CHKFC + JP NZ,DIO_NORESP + JP DIO_DRIVERESET1 + +DIO_NORESP: + CALL NEWLINE + LD DE,STR_NORESP + CALL WRITESTR + RET + +DIO_DRIVERESET1: + LD A,TRUE + LD (DCD_DSKRDY),A + + LD A,0 + LD (DCD_CURTRK),A + + RET + +DIO_CHKFC: + LD A,(FST_RC) + OR A + RET + +DIO_RUN: + LD A,(DCD_DSKRDY) + CP TRUE + JP Z,DIO_RUN0 + + CALL DIO_DRIVERESET + LD A,(DCD_DSKRDY) + CP TRUE + JP NZ,DIO_RUNERR ; DRIVERESET FAILED! + +DIO_RUN0: + CALL DIO_PROGRESS + + ; COPY PARMS OVER + LD A,(DCD_UNIT) + LD (FCD_DS),A + + LD A,(DCD_TRACE) + LD (FCD_TRACE),A + + LD A,(DCD_TRACK) + LD (FCD_C),A + + LD A,(DCD_HEAD) + LD (FCD_H),A + + LD A,(DCD_SECTOR) + LD (FCD_R),A + + LD A,(DCD_INTRLV) + LD (FCD_X),A + + ; FIX: COMBINE WITH DCD_TRACK SETUP ABOVE? + LD A,(DCD_CURTRK) + LD B,A + LD A,(DCD_TRACK) + CP B + JP Z,DIO_RUN1 ; SKIP SEEK IF POSSIBLE + + ; SEEK AND WAIT FOR COMPLETE + CALL FC_SEEK + CALL DIO_CHKFC + JP NZ,DIO_RUNERR + + CALL DIO_WTSEEK + CALL DIO_CHKFC + JP NZ,DIO_RUNERR + + ; RECORD CURRENT TRACK + ; FIX: SHOULD NOT ASSUME SEEK REQUEST SUCCEEDED (FC_READID?) + LD A,(DCD_TRACK) + LD (DCD_CURTRK),A + +DIO_RUN1: + LD A,(DCD_DOP) + + CP DOP_READ + JP Z,DIO_RUNREAD + + CP DOP_WRITE + JP Z,DIO_RUNWRITE + + CP DOP_FORMAT + JP Z,DIO_RUNFORMAT + + CP DOP_VERIFY + JP Z,DIO_RUNVERIFY + + JP DIO_RUNX + +DIO_RUNREAD: + CALL FC_READ + JP DIO_RUNCHK + +DIO_RUNWRITE: + CALL FC_WRITE + JP DIO_RUNCHK + +DIO_RUNFORMAT: + CALL FC_FMTTRK + JP DIO_RUNCHK + +DIO_RUNVERIFY: + CALL FC_READ + JP DIO_RUNCHK + +DIO_RUNCHK: + LD A,(FST_RC) + OR A + CP FRC_OK + JP NZ,DIO_RUNERR ; HANDLE I/O ERROR + LD A,(DCD_DOP) + CP DOP_VERIFY + JP NZ,DIO_RUNX ; NOT VERIFY, ALL DONE + CALL DIO_VERIFY + LD A,(FST_RC) + OR A + CP FRC_OK + JP NZ,DIO_RUNERR ; HANDLE VERIFY ERROR + JP DIO_RUNX + +DIO_RUNERR: + LD A,FALSE + LD (DCD_DSKRDY),A + CALL FC_RESETFDC ; FIX... + CALL NEWLINE + LD DE,STR_CONTINUE ; ABORT/RETRY/IGNORE PROMPT + CALL WRITESTR + +DIO_RUNERR1: + CALL GETKEYUC + + CP 'A' + JP Z,DIO_ABORT + CP 'R' + JP Z,DIO_RETRY + CP 'I' + JP Z,DIO_IGNORE + + JP DIO_RUNERR1 + +DIO_ABORT: + LD DE,DIOCS_ABORT + CALL WRITESTR + LD A,TRUE + LD (DCD_ABORT),A + JP DIO_RUNX + +DIO_RETRY: + LD DE,DIOCS_RETRY + CALL WRITESTR + JP DIO_RUN + +DIO_IGNORE: + LD DE,DIOCS_IGNORE + CALL WRITESTR + JP DIO_RUNX + +DIO_RUNX: + RET + +DIO_PROGRESS: + LD A,(NEWLINE_USED) + OR A + JP Z,DIO_PROGRESS1 + CALL NEWLINE + LD A,0 + LD (NEWLINE_USED),A + +DIO_PROGRESS1: + CALL PC_CR + LD DE,STR_PROGRESS + CALL WRITESTR + CALL PC_COLON + CALL PC_SPACE + LD DE,DPL_TRACK + CALL WRITESTR + CALL PC_EQUAL + LD A,(DCD_TRACK) + CALL PRTHEXBYTE + CALL PC_SPACE + LD DE,DPL_HEAD + CALL WRITESTR + CALL PC_EQUAL + LD A,(DCD_HEAD) + CALL PRTHEXBYTE + CALL PC_SPACE + LD DE,DPL_SECTOR + CALL WRITESTR + CALL PC_EQUAL + LD A,(DCD_SECTOR) + CALL PRTHEXBYTE + + RET + +DIO_VERIFY: + LD HL,BUFFER + LD DE,VFYBUF + LD BC,BUFSIZ + +DIO_VERIFY1: + LD A,(DE) + CP (HL) + JP NZ,DIO_VERIFY2 + INC DE + INC HL + DEC BC + LD A,B + OR C + JP NZ,DIO_VERIFY1 + RET + +DIO_VERIFY2: + PUSH DE + + CALL NEWLINE + LD DE,STR_MISMATCH + CALL WRITESTR + POP DE + LD A,D + SUB VFYBUF >> 8 + CALL PRTHEXBYTE + LD A,E + CALL PRTHEXBYTE + LD A,FRC_MISMATCH + LD (FST_RC),A + RET +; +; CONTINUE PROMPT OPTION STRINGS +; +DIOCS_ABORT .TEXT "ABORT$" +DIOCS_RETRY .TEXT "RETRY$" +DIOCS_IGNORE .TEXT "IGNORE$" +; +; DISK PROGRESS LABELS +; +DPL_TRACK .TEXT "TRACK$" +DPL_HEAD .TEXT "HEAD$" +DPL_SECTOR .TEXT "SECTOR$" +; +; DISK OPERATIONS +; +DOP_READ .EQU 0 ; READ OPERATION +DOP_WRITE .EQU 1 ; WRITE OPERATION +DOP_FORMAT .EQU 2 ; FORMAT OPERATION +DOP_VERIFY .EQU 3 ; VERIFY OPERATION +; +; DEVICE CONTROL DATA +; +DCD_FILL .DB 0E5H ; DEFAULT TO E5 (EMPTY DIRECTORY BYTE) +DCD_PATTERN .DB 000H ; DEFAULT TO 00 +DCD_TRACE .DB 000H ; TRACE LEVEL +DCD_UNIT .DB 000H ; DEFAULT UNIT = 0 +DCD_SECTOR .DB 001H ; DEFAULT SECTOR = 1 +DCD_HEAD .DB 000H ; DEFAULT HEAD = 0 +DCD_TRACK .DB 000H ; DEFAULT TRACK = 0 +DCD_INTRLV .DB 002H ; DEFAULT INTERLEAVE = 2 +DCD_DOP .DB DOP_READ ; DEFAULT OP = READ +DCD_MT .DB MT_PC720 ; DEFAULT FLOPPY DEVICE = PC720 +DCD_MD .DB MD_POLL ; DEFAULT MODE = POLL +; +; DEVICE CONTROL DATA (PRIVATE) +; +DCD_DSKRDY .DB FALSE ; 0 = NOT RDY, 1 = RDY +DCD_ABORT .DB FALSE ; 0 = CONT, 1 = ABORT +DCD_CURTRK .DB 0FFH ; CURRENT TRACK, FF = UNKNOWN +; +; MODES +; +MD_POLL .EQU 0 +MD_INT .EQU 1 +MD_INTFAST .EQU 2 +MD_INTWAIT .EQU 3 +MD_DRQWAIT .EQU 4 +; +; MODE MAPPING +; BIT IS SET FOR ALLOWED MODES PER FDC +; +MD_MAP: + .DB %00011111 ; DIO POLL,INT,INTFAST,INTWAIT,DRQWAIT + .DB %00000111 ; DIO3 POLL,INT,INTFAST + .DB %00000111 ; ZETA POLL,INT,INTFAST + .DB %00000001 ; ZETA2 POLL + .DB %00000001 ; DIDE POLL + .DB %00000001 ; N8 POLL + .DB %00000001 ; RCSMC POLL + .DB %00000001 ; RCWDC POLL + .DB %00000001 ; SMZ80 POLL + .DB %00000001 ; DYNO POLL + .DB %00000001 ; EPFDC POLL + .DB %00000001 ; MBC POLL +; +; MEDIA DESCRIPTION BLOCK +; +MDB: +MDB_LABEL .DW 000H ; ADDRESS OF MEDIA LABEL +MDB_DESC .DW 000H ; ADDRESS OF MEDIA DESCRIPTION +MDB_NUMCYL .DB 000H ; NUMBER OF CYLINDERS +MDB_NUMHD .DB 000H ; NUMBER OF HEADS +MDB_NUMSEC .DB 000H ; NUMBER OF SECTORS +MDB_SOT .DB 000H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) +MDB_FCD: ; FLOPPY CONFIGURATION DATA (PUBLIC) MANAGED AS A "BLOCK", MUST MATCH FCB BELOW +MDB_EOT ; END OF TRACK SECTOR (SAME AS SC SINCE SOT ALWAYS 1) +MDB_SC .DB 000H ; SECTOR COUNT +MDB_SECSZ .DW 000H ; SECTOR SIZE IN BYTES +MDB_GPL .DB 000H ; GAP LENGTH (R/W) +MDB_GPLF .DB 000H ; GAP LENGTH (FORMAT) +MDB_SRTHUT .DB 000H ; STEP RATE, IBM PS/2 CALLS FOR 3ms, 0DH = 3ms SRT, HEAD UNLOAD TIME +MDB_HLT .DB 000H ; HEAD LOAD TIME, IBM PS/2 CALLS FOR 15ms 08H = 16ms HUT +MDB_DORA .DB 000H ; OPERATIONS REGISTER VALUE FOR MEDIA +MDB_DORB .DB 000H ; OPERATIONS REGISTER VALUE FOR MEDIA +MDB_DORC .DB 000H ; OPERATIONS REGISTER VALUE FOR MEDIA +MDB_DORD .DB 000H ; OPERATIONS REGISTER VALUE FOR MEDIA +MDB_DCR .DB 000H ; CONTROL REGISTER VALUE FOR MEDIA +MDB_LEN .EQU $ - MDB +; +MDT: ; MODE TABLE + .DW MTB_POLL + .DW MTB_INT + .DW MTB_INTFAST + .DW MTB_INTWAIT + .DW MTB_DRQWAIT +MDT_ENTCNT .EQU (($ - MDT) / 2) +; +MTB_POLL .DW MTL_POLL ; ADDRESS OF MODE LABEL + .DW MTS_POLL ; ADDRESS OF MODE DESCRIPTION +MTL_POLL .TEXT "POLL $" +MTS_POLL .TEXT "POLLING (RECOMMENDED)$" +; +MTB_INT .DW MTL_INT ; ADDRESS OF MODE LABEL + .DW MTS_INT ; ADDRESS OF MODE DESCRIPTION +MTL_INT .TEXT "INT $" +MTS_INT .TEXT "INTERRUPT (!!! READ MANUAL !!!)$" +; +MTB_INTFAST .DW MTL_INTFAST ; ADDRESS OF MODE LABEL + .DW MTS_INTFAST ; ADDRESS OF MODE DESCRIPTION +MTL_INTFAST .TEXT "INT-FAST $" +MTS_INTFAST .TEXT "FAST INTERRUPT (!!! READ MANUAL !!!)$" +; +MTB_INTWAIT .DW MTL_INTWAIT ; ADDRESS OF MODE LABEL + .DW MTS_INTWAIT ; ADDRESS OF MODE DESCRIPTION +MTL_INTWAIT .TEXT "INT/WAIT $" +MTS_INTWAIT .TEXT "INT/WAIT (!!! READ MANUAL !!!)$" +; +MTB_DRQWAIT .DW MTL_DRQWAIT ; ADDRESS OF MODE LABEL + .DW MTS_DRQWAIT ; ADDRESS OF MODE DESCRIPTION +MTL_DRQWAIT .TEXT "DRQ/WAIT $" +MTS_DRQWAIT .TEXT "DRQ/WAIT (!!! NOT YET IMPLEMENTED!!!)$" +; +; MEDIA TYPE INFORMATION +; +MT_PC720 .EQU 0 +MT_PC144 .EQU 1 +MT_PC320 .EQU 2 +MT_PC360 .EQU 3 +MT_PC120 .EQU 4 +MT_PC111 .EQU 5 +MT_PC160 .EQU 6 +MT_PC180 .EQU 7 +MT_PC320SS .EQU 8 +MT_PC360SS .EQU 9 +; +MIT: ; MEDIA INDEX TABLE + .DW MDB_PC720 + .DW MDB_PC144 + .DW MDB_PC320 + .DW MDB_PC360 + .DW MDB_PC120 + .DW MDB_PC111 + .DW MDB_PC160 + .DW MDB_PC180 + .DW MDB_PC320SS + .DW MDB_PC360SS +MIT_ENTCNT .EQU (($ - MIT) / 2) +; +; Specify Command: +; +-----+-----+-----+-----+-----+-----+-----+-----+-----+ +; |Byte | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +; +-----+-----+-----+-----+-----+-----+-----+-----+-----+ +; | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | +; | 1 | ----- STEP RATE ----- | -- HEAD UNLOAD TIME - | +; | 2 | ------------ HEAD LOAD TIME ----------- | NDM | +; +-----+-----+-----+-----+-----+-----+-----+-----+-----+ +; +; +; Step Rate (milliseconds): Head Unload Time (milliseconds): Head Load Time (milliseconds): +; +------+------+------+------+------+ +------+------+------+------+------+ +------+------+------+------+------+ +; | | BITRATE | | | BITRATE | | | BITRATE | +; | VAL | 1.0M | 500K | 300K | 250K | | VAL | 1.0M | 500K | 300K | 250K | | VAL | 1.0M | 500K | 300K | 250K | +; +------+------+------+------+------+ +------+------+------+------+------+ +------+------+------+------+------+ +; | 0 | 8.0 | 16.0 | 26.7 | 32.0 | | 0 | 128 | 256 | 426 | 512 | | 0 | 128 | 256 | 426 | 512 | +; | 1 | 7.5 | 15.0 | 25.0 | 30.0 | | 1 | 8 | 16 | 26.7 | 32 | | 1 | 1 | 2 | 3.3 | 4 | +; | 2 | 7.0 | 14.0 | 23.3 | 28.0 | | 2 | 16 | 32 | 53.3 | 64 | | 2 | 2 | 4 | 6.7 | 8 | +; | ... | ... | ... | ... | ... | | ... | ... | ... | ... | ... | | ... | ... | ... | ... | ... | +; | 14 | 1.0 | 2.0 | 3.3 | 4.0 | | 14 | 112 | 224 | 373 | 448 | | 126 | 126 | 252 | 420 | 504 | +; | 15 | 0.5 | 1.0 | 1.7 | 2.0 | | 15 | 120 | 240 | 400 | 480 | | 127 | 127 | 254 | 423 | 508 | +; +------+------+------+------+------+ +------+------+------+------+------+ +------+------+------+------+------+ +; +; IBM PS/2 CALLS FOR: +; STEP RATE: 3ms (6ms FOR ALL 41mm OR 720K DRIVES) +; HEAD LOAD TIME: 15ms +; +; STATIC CONFIGURATION, NEVER CHANGES (PRIVATE) +; +MDB_PC720 .DW DTL_PC720 ; ADDRESS OF MEDIA LABEL + .DW DTS_PC720 ; ADDRESS OF MEDIA DESCRIPTION + .DB 050H ; NUMBER OF CYLINDERS + .DB 002H ; NUMBER OF HEADS + .DB 009H ; NUMBER OF SECTORS + .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) +FCB_PC720 .DB 009H ; SECTOR COUNT + .DW 200H ; SECTOR SIZE IN BYTES + .DB 02AH ; GAP LENGTH (R/W) + .DB 050H ; GAP LENGTH (FORMAT) + .DB (13 << 4) | 0 ; SRT = 6ms, HUT = 512ms + .DB 4 ; HLT = 16ms + .DB DORA_BR250 ; OPERATIONS REGISTER VALUE + .DB DORB_BR250 ; OPERATIONS REGISTER VALUE + .DB DORC_BR250 ; OPERATIONS REGISTER VALUE + .DB DORD_BR250 ; OPERATIONS REGISTER VALUE + .DB DCR_BR250 ; CONTROL REGISTER VALUE + .IF (($ - MDB_PC720) != MDB_LEN) + .ECHO "*** FCB SIZE ERROR!!! ***\n" + .ENDIF +DTL_PC720 .TEXT "720KB DS/DD $" +DTS_PC720 .TEXT "3.5\" 720KB - 9 SECTORS, 2 SIDES, 80 TRACKS, DOUBLE DENSITY$" +; +MDB_PC144 .DW DTL_PC144 ; ADDRESS OF MEDIA LABEL + .DW DTS_PC144 ; ADDRESS OF MEDIA DESCRIPTION + .DB 050H ; NUMBER OF CYLINDERS + .DB 002H ; NUMBER OF HEADS + .DB 012H ; NUMBER OF SECTORS + .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) +FCB_PC144 .DB 012H ; SECTOR COUNT + .DW 200H ; SECTOR SIZE IN BYTES + .DB 01BH ; GAP LENGTH (R/W) + .DB 06CH ; GAP LENGTH (FORMAT) + .DB (13 << 4) | 0 ; SRT = 3ms, HUT = 256ms + .DB 8 ; HLT = 16ms + .DB DORA_BR500 ; OPERATIONS REGISTER VALUE + .DB DORB_BR500 ; OPERATIONS REGISTER VALUE + .DB DORC_BR500 ; OPERATIONS REGISTER VALUE + .DB DORD_BR500 ; OPERATIONS REGISTER VALUE + .DB DCR_BR500 ; CONTROL REGISTER VALUE + .IF (($ - MDB_PC144) != MDB_LEN) + .ECHO "*** FCB SIZE ERROR!!! ***\n" + .ENDIF +DTL_PC144 .TEXT "1.44MB DS/HD $" +DTS_PC144 .TEXT "3.5\" 1.44MB - 18 SECTORS, 2 SIDES, 80 TRACKS, HIGH DENSITY$" +; +MDB_PC320 .DW DTL_PC320 ; ADDRESS OF MEDIA LABEL + .DW DTS_PC320 ; ADDRESS OF MEDIA DESCRIPTION + .DB 028H ; NUMBER OF CYLINDERS + .DB 002H ; NUMBER OF HEADS + .DB 008H ; NUMBER OF SECTORS + .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) +FCB_PC320 .DB 008H ; SECTOR COUNT + .DW 200H ; SECTOR SIZE IN BYTES + .DB 02AH ; GAP LENGTH (R/W) + .DB 050H ; GAP LENGTH (FORMAT) + .DB (13 << 4) | 0 ; SRT = 6ms, HUT = 512ms + .DB 4 ; HLT = 16ms + .DB DORA_BR250 ; OPERATIONS REGISTER VALUE + .DB DORB_BR250 ; OPERATIONS REGISTER VALUE + .DB DORC_BR250 ; OPERATIONS REGISTER VALUE + .DB DORD_BR250 ; OPERATIONS REGISTER VALUE + .DB DCR_BR250 ; CONTROL REGISTER VALUE + .IF (($ - MDB_PC320) != MDB_LEN) + .ECHO "*** FCB SIZE ERROR!!! ***\n" + .ENDIF +DTL_PC320 .TEXT "320KB DS/DD $" +DTS_PC320 .TEXT "5.25\" 320KB - 8 SECTORS, 2 SIDES, 40 TRACKS, DOUBLE DENSITY$" +; +MDB_PC360 .DW DTL_PC360 ; ADDRESS OF MEDIA LABEL + .DW DTS_PC360 ; ADDRESS OF MEDIA DESCRIPTION + .DB 028H ; NUMBER OF CYLINDERS + .DB 002H ; NUMBER OF HEADS + .DB 009H ; NUMBER OF SECTORS + .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) +FCB_PC360 .DB 009H ; SECTOR COUNT + .DW 200H ; SECTOR SIZE IN BYTES + .DB 02AH ; GAP LENGTH (R/W) + .DB 050H ; GAP LENGTH (FORMAT) + .DB (13 << 4) | 0 ; SRT = 6ms, HUT = 512ms + .DB 4 ; HLT = 16ms + .DB DORA_BR250 ; OPERATIONS REGISTER VALUE + .DB DORB_BR250 ; OPERATIONS REGISTER VALUE + .DB DORC_BR250 ; OPERATIONS REGISTER VALUE + .DB DORD_BR250 ; OPERATIONS REGISTER VALUE + .DB DCR_BR250 ; CONTROL REGISTER VALUE + .IF (($ - MDB_PC360) != MDB_LEN) + .ECHO "*** FCB SIZE ERROR!!! ***\n" + .ENDIF +DTL_PC360 .TEXT "360KB DS/DD $" +DTS_PC360 .TEXT "5.25\" 360KB - 9 SECTORS, 2 SIDES, 40 TRACKS, DOUBLE DENSITY$" +; +MDB_PC120 .DW DTL_PC120 ; ADDRESS OF MEDIA LABEL + .DW DTS_PC120 ; ADDRESS OF MEDIA DESCRIPTION + .DB 050H ; NUMBER OF CYLINDERS + .DB 002H ; NUMBER OF HEADS + .DB 00FH ; NUMBER OF SECTORS + .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) +FCB_PC120 .DB 00FH ; SECTOR COUNT + .DW 200H ; SECTOR SIZE IN BYTES + .DB 01BH ; GAP LENGTH (R/W) + .DB 054H ; GAP LENGTH (FORMAT) + .DB (10 << 4) | 0 ; SRT = 6ms, HUT = 256ms + .DB 8 ; HLT = 16ms + .DB DORA_BR500 ; OPERATIONS REGISTER VALUE + .DB DORB_BR500 ; OPERATIONS REGISTER VALUE + .DB DORC_BR500 ; OPERATIONS REGISTER VALUE + .DB DORD_BR500 ; OPERATIONS REGISTER VALUE + .DB DCR_BR500 ; CONTROL REGISTER VALUE + .IF (($ - MDB_PC120) != MDB_LEN) + .ECHO "*** FCB SIZE ERROR!!! ***\n" + .ENDIF +DTL_PC120 .TEXT "1.2MB DS/HD $" +DTS_PC120 .TEXT "5.25\" 1.2MB - 15 SECTORS, 2 SIDES, 80 TRACKS, HIGH DENSITY$" +; +MDB_PC111 .DW DTL_PC111 ; ADDRESS OF MEDIA LABEL + .DW DTS_PC111 ; ADDRESS OF MEDIA DESCRIPTION + .DB 04DH ; NUMBER OF CYLINDERS + .DB 002H ; NUMBER OF HEADS + .DB 00FH ; NUMBER OF SECTORS + .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) +FCB_PC111 .DB 00FH ; SECTOR COUNT + .DW 200H ; SECTOR SIZE IN BYTES + .DB 01BH ; GAP LENGTH (R/W) + .DB 054H ; GAP LENGTH (FORMAT) + .DB (13 << 4) | 0 ; SRT = 3ms, HUT = 256ms + .DB 25 ; HLT = 50ms + .DB DORA_BR500 ; OPERATIONS REGISTER VALUE + .DB DORB_BR500 ; OPERATIONS REGISTER VALUE + .DB DORC_BR500 ; OPERATIONS REGISTER VALUE + .DB DORD_BR500 ; OPERATIONS REGISTER VALUE + .DB DCR_BR500 ; CONTROL REGISTER VALUE + .IF (($ - MDB_PC111) != MDB_LEN) + .ECHO "*** FCB SIZE ERROR!!! ***\n" + .ENDIF +DTL_PC111 .TEXT "1.11MB DS/DD $" +DTS_PC111 .TEXT "8\" 1.11MB - 15 SECTORS, 2 SIDES, 77 TRACKS, DOUBLE DENSITY$" +; +MDB_PC160 .DW DTL_PC160 ; ADDRESS OF MEDIA LABEL + .DW DTS_PC160 ; ADDRESS OF MEDIA DESCRIPTION + .DB 028H ; NUMBER OF CYLINDERS + .DB 001H ; NUMBER OF HEADS + .DB 008H ; NUMBER OF SECTORS + .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) +FCB_PC160 .DB 008H ; SECTOR COUNT + .DW 200H ; SECTOR SIZE IN BYTES + .DB 02AH ; GAP LENGTH (R/W) + .DB 050H ; GAP LENGTH (FORMAT) + .DB (13 << 4) | 0 ; SRT = 6ms, HUT = 512ms + .DB 4 ; HLT = 16ms + .DB DORA_BR250 ; OPERATIONS REGISTER VALUE + .DB DORB_BR250 ; OPERATIONS REGISTER VALUE + .DB DORC_BR250 ; OPERATIONS REGISTER VALUE + .DB DORD_BR250 ; OPERATIONS REGISTER VALUE + .DB DCR_BR250 ; CONTROL REGISTER VALUE + .IF (($ - MDB_PC160) != MDB_LEN) + .ECHO "*** FCB SIZE ERROR!!! ***\n" + .ENDIF +DTL_PC160 .TEXT "160KB SS/DD $" +DTS_PC160 .TEXT "5.25\" 160KB - 8 SECTORS, 1 SIDE, 40 TRACKS, DOUBLE DENSITY$" +; +MDB_PC180 .DW DTL_PC180 ; ADDRESS OF MEDIA LABEL + .DW DTS_PC180 ; ADDRESS OF MEDIA DESCRIPTION + .DB 028H ; NUMBER OF CYLINDERS + .DB 001H ; NUMBER OF HEADS + .DB 009H ; NUMBER OF SECTORS + .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) +FCB_PC180 .DB 009H ; SECTOR COUNT + .DW 200H ; SECTOR SIZE IN BYTES + .DB 02AH ; GAP LENGTH (R/W) + .DB 050H ; GAP LENGTH (FORMAT) + .DB (13 << 4) | 0 ; SRT = 6ms, HUT = 512ms + .DB 4 ; HLT = 16ms + .DB DORA_BR250 ; OPERATIONS REGISTER VALUE + .DB DORB_BR250 ; OPERATIONS REGISTER VALUE + .DB DORC_BR250 ; OPERATIONS REGISTER VALUE + .DB DORD_BR250 ; OPERATIONS REGISTER VALUE + .DB DCR_BR250 ; CONTROL REGISTER VALUE + .IF (($ - MDB_PC180) != MDB_LEN) + .ECHO "*** FCB SIZE ERROR!!! ***\n" + .ENDIF +DTL_PC180 .TEXT "180KB SS/DD $" +DTS_PC180 .TEXT "5.25\" 180KB - 9 SECTORS, 1 SIDE, 40 TRACKS, DOUBLE DENSITY$" +; +MDB_PC320SS .DW DTL_PC320SS ; ADDRESS OF MEDIA LABEL + .DW DTS_PC320SS ; ADDRESS OF MEDIA DESCRIPTION + .DB 050H ; NUMBER OF CYLINDERS + .DB 001H ; NUMBER OF HEADS + .DB 008H ; NUMBER OF SECTORS + .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) +FCB_PC320SS .DB 008H ; SECTOR COUNT + .DW 200H ; SECTOR SIZE IN BYTES + .DB 02AH ; GAP LENGTH (R/W) + .DB 050H ; GAP LENGTH (FORMAT) + .DB (13 << 4) | 0 ; SRT = 6ms, HUT = 512ms + .DB 4 ; HLT = 16ms + .DB DORA_BR250 ; OPERATIONS REGISTER VALUE + .DB DORB_BR250 ; OPERATIONS REGISTER VALUE + .DB DORC_BR250 ; OPERATIONS REGISTER VALUE + .DB DORD_BR250 ; OPERATIONS REGISTER VALUE + .DB DCR_BR250 ; CONTROL REGISTER VALUE + .IF (($ - MDB_PC320SS) != MDB_LEN) + .ECHO "*** FCB SIZE ERROR!!! ***\n" + .ENDIF +DTL_PC320SS .TEXT "320KB SS/DD $" +DTS_PC320SS .TEXT "5.25\" 320KB - 8 SECTORS, 1 SIDE, 80 TRACKS, DOUBLE DENSITY$" +; +MDB_PC360SS .DW DTL_PC360SS ; ADDRESS OF MEDIA LABEL + .DW DTS_PC360SS ; ADDRESS OF MEDIA DESCRIPTION + .DB 050H ; NUMBER OF CYLINDERS + .DB 001H ; NUMBER OF HEADS + .DB 009H ; NUMBER OF SECTORS + .DB 001H ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1) +FCB_PC360SS .DB 009H ; SECTOR COUNT + .DW 200H ; SECTOR SIZE IN BYTES + .DB 02AH ; GAP LENGTH (R/W) + .DB 050H ; GAP LENGTH (FORMAT) + .DB (13 << 4) | 0 ; SRT = 6ms, HUT = 512ms + .DB 4 ; HLT = 16ms + .DB DORA_BR250 ; OPERATIONS REGISTER VALUE + .DB DORB_BR250 ; OPERATIONS REGISTER VALUE + .DB DORC_BR250 ; OPERATIONS REGISTER VALUE + .DB DORD_BR250 ; OPERATIONS REGISTER VALUE + .DB DCR_BR250 ; CONTROL REGISTER VALUE + .IF (($ - MDB_PC360SS) != MDB_LEN) + .ECHO "*** FCB SIZE ERROR!!! ***\n" + .ENDIF +DTL_PC360SS .TEXT "360KB SS/DD $" +DTS_PC360SS .TEXT "5.25\" 360KB - 9 SECTORS, 1 SIDE, 80 TRACKS, DOUBLE DENSITY$" +; +;=============================================================================== +; FLOPPY DISK CONTROL MENU (DIRECT MENU INTERFACE TO FDC & RELATED HARDWARE) +;=============================================================================== +; +; FDC MENU DATA +; +FM_TABLE .DB 'R' \ .DW FMS_READ, FM_READ +FM_ENTSIZ .EQU $ - FM_TABLE + .DB 'D' \ .DW FMS_READDEL, FM_READDEL + .DB 'W' \ .DW FMS_WRITE, FM_WRITE + .DB 'E' \ .DW FMS_WRITEDEL, FM_WRITEDEL + .DB 'T' \ .DW FMS_READTRK, FM_READTRK + .DB 'I' \ .DW FMS_READID, FM_READID + .DB 'F' \ .DW FMS_FMTTRK, FM_FMTTRK + .DB 'Q' \ .DW FMS_SCANEQ, FM_SCANEQ + .DB 'L' \ .DW FMS_SCANLOEQ, FM_SCANLOEQ + .DB 'H' \ .DW FMS_SCANHIEQ, FM_SCANHIEQ + .DB 'C' \ .DW FMS_RECAL, FM_RECAL + .DB 'N' \ .DW FMS_SENSEINT, FM_SENSEINT + .DB 'P' \ .DW FMS_SPECIFY, FM_SPECIFY + .DB 'V' \ .DW FMS_DRVSTAT, FM_DRVSTAT + .DB 'S' \ .DW FMS_SEEK, FM_SEEK + .DB 'O' \ .DW FMS_VERSION, FM_VERSION + .DB 'U' \ .DW FMS_PULSETC, FM_PULSETC + .DB 'A' \ .DW FMS_DOR, FM_DOR + .DB 'M' \ .DW FMS_MOTOR, FM_MOTOR + .DB 'Z' \ .DW FMS_FDCRESET, FM_FDCRESET + .DB 'X' \ .DW FMS_EXIT, 0000H +FM_COUNT .EQU (($ - FM_TABLE) / FM_ENTSIZ) ; # ENTRIES IN TABLE +FM_INFO: .DW FM_DRAW + .DW FM_TABLE + .DB FM_ENTSIZ + .DB FM_COUNT +; +; FDC COMMAND MENU STRINGS +; +STR_FDCMENU: +; .TEXT "===================<< FDU FDC COMMAND MENU >>======= [MSR=XX] ==\r\n" + .TEXT "===================<< FDU FDC COMMAND MENU >>======= [MSR=" +MV_MSR .TEXT "XX" + .TEXT "] ==\r\n" + .TEXT "(R)EAD READ (D)EL (W)RITE WRITE D(E)L\r\n" + .TEXT "READ (T)RK READ (I)D (F)ORMAT SCAN E(Q)\r\n" + .TEXT "SCAN (L)O/EQ SCAN (H)I/EQ RE(C)AL SE(N)SE INT\r\n" + .TEXT "S(P)ECIFY DRI(V)E STAT (S)EEK VERSI(O)N\r\n" +; .TEXT "P(U)LSE TC L(A)TCH:XX (M)OTOR:XXX FDC RESET (Z)\r\n" + .TEXT "P(U)LSE TC L(A)TCH:" +MV_LAT .TEXT "XX" + .TEXT " (M)OTOR:" +MV_MOT .TEXT "XXX" + .TEXT " FDC RESET (Z)" + .TEXT "\r\n" + .TEXT "E(X)IT\r\n" + .TEXT "=== OPTION ===> $" +; +FMS_NOP .TEXT "NOP$" +FMS_READ .TEXT "READ$" +FMS_READDEL .TEXT "READ DELETED$" +FMS_WRITE .TEXT "WRITE$" +FMS_WRITEDEL .TEXT "WRITE DELETED$" +FMS_READTRK .TEXT "READ TRACK$" +FMS_READID .TEXT "READ ID$" +FMS_FMTTRK .TEXT "FORMAT TRACK$" +FMS_SCANEQ .TEXT "SCAN EQUAL$" +FMS_SCANLOEQ .TEXT "SCAN LOW OR EQUAL$" +FMS_SCANHIEQ .TEXT "SCAN HIGH OR EQUAL$" +FMS_RECAL .TEXT "RECALIBRATE$" +FMS_SENSEINT .TEXT "SENSE INTERRUPT$" +FMS_SPECIFY .TEXT "SPECIFY$" +FMS_DRVSTAT .TEXT "DRIVE STATUS$" +FMS_SEEK .TEXT "SEEK$" +FMS_VERSION .TEXT "VERSION$" +FMS_PULSETC .TEXT "PULSE TC$" +FMS_DOR .TEXT "DOR$" +FMS_MOTOR .TEXT "MOTOR$" +FMS_FDCRESET .TEXT "FDC RESET$" +FMS_EXIT .TEXT "EXIT$" +; +; ENTRY POINT FOR FDCMENU +; +FDCMENU: + LD A,01H + LD (FCD_TRACE),A ; FORCE TRACING OF ALL FDC COMMANDS + LD HL,FM_INFO + CALL RUNMENU + RET +; +; FDCMENU DRAW PROCEDURE +; +FM_DRAW: + CALL NEWLINE + CALL NEWLINE + + ; UPDATE MOTOR STATUS + LD HL,FDCBM + LD A,(HL) + AND _DIO + JR NZ,FM_DRAW0A + LD A,(HL) + AND _ZETA | _DIO3 + JR NZ,FM_DRAW0B + LD A,(HL) + AND _PCAT + JR NZ,FM_DRAW0C + LD A,(HL) + AND _RCSMC + JR NZ,FM_DRAW0D + JR FM_DRAW3 +FM_DRAW0A: ; DIO + LD A,(FST_DOR) + AND 00000010B + XOR 00000010B + JR FM_DRAW1 +FM_DRAW0B: ; ZETA, DIO3 + LD A,(FST_DOR) + AND 00000010B + JR FM_DRAW1 +FM_DRAW0C: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO, EPFDC, MBC + LD A,(FST_DOR) + AND 11110000B + JR FM_DRAW1 +FM_DRAW0D: ; RCSMC + LD A,(FST_DOR) + AND 00000110B + JR FM_DRAW1 +FM_DRAW1: + LD DE,STR_ON + JP NZ,FM_DRAW2 + LD DE,STR_OFF +FM_DRAW2: + LD HL,MV_MOT + CALL STRCPY +FM_DRAW3: + + ; UPDATE MSR VALUE + LD DE,MV_MSR + LD C,(IY+CFG_MSR) + IN A,(C) + CALL HEXSTRBYTE + + ; UPDATE FST_DOR VALUE + LD DE,MV_LAT + LD A,(FST_DOR) + CALL HEXSTRBYTE + + ; DISPLAY THE MENU + LD DE,STR_FDCMENU + CALL WRITESTR + + RET +; +; FDCMENU FUNCTIONS +; +FM_READ: + CALL FM_GETTHS + CALL FC_READ + RET + +FM_READDEL: + CALL FM_GETTHS + CALL FC_READDEL + RET + +FM_WRITE: + CALL FM_GETTHS + CALL FC_WRITE + RET + +FM_WRITEDEL: + CALL FM_GETTHS + CALL FC_WRITEDEL + RET + +FM_READTRK: + CALL FM_GETTHS + CALL FC_READTRK + RET + +FM_READID: + CALL FM_GETHEAD + CALL FC_READID + RET + +FM_FMTTRK: + CALL FM_GETTRK + CALL FM_GETHEAD + CALL FC_FMTTRK + RET + +FM_SCANEQ: + JP FM_NOTIMPL ; NOT IMPLEMENTED! + CALL FM_GETTHS + CALL FC_SCANEQ + RET + +FM_SCANLOEQ: + JP FM_NOTIMPL ; NOT IMPLEMENTED! + CALL FM_GETTHS + CALL FC_SCANLOEQ + RET + +FM_SCANHIEQ: + JP FM_NOTIMPL ; NOT IMPLEMENTED! + CALL FM_GETTHS + CALL FC_SCANHIEQ + RET + +FM_RECAL: + LD A,0 ; UPDATE CYLINDER FOR FUTURE CALLS + LD (FCD_C),A ; FIX: NOT IN THE RIGHT PLACE + CALL FC_RECAL + RET + +FM_SENSEINT: + CALL FC_SENSEINT + RET + +FM_SPECIFY: + CALL FC_SPECIFY + RET + +FM_DRVSTAT: + CALL FM_GETHEAD + CALL FC_DRVSTAT + RET + +FM_SEEK: + CALL FM_GETTRK + CALL FC_SEEK + RET + +FM_VERSION: + CALL FC_VERSION + RET + +FM_PULSETC: + CALL NEWLINE + CALL FC_PULSETC + RET + +FM_DOR: + CALL FM_GETDOR + CALL FC_SETDOR + RET + +FM_MOTOR: + ; TOGGLE MOTOR STATE + LD HL,FDCBM + LD A,(HL) + AND _DIO + JR NZ,FM_MOTOR0A + LD A,(HL) + AND _ZETA | _DIO3 + JR NZ,FM_MOTOR0B + LD A,(HL) + AND _PCAT + JR NZ,FM_MOTOR0C + LD A,(HL) + AND _RCSMC + JR NZ,FM_MOTOR0D + RET +FM_MOTOR0A: ; DIO + LD A,(FST_DOR) + AND 00000010B + XOR 00000010B + JR FM_MOTOR1 +FM_MOTOR0B: ; ZETA, DIO3 + LD A,(FST_DOR) + AND 00000010B + JR FM_MOTOR1 +FM_MOTOR0C: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO, EPFDC, MBC + LD A,(FST_DOR) + AND 11110000B + JR FM_MOTOR1 +FM_MOTOR0D: ; RCSMC + LD A,(FST_DOR) + AND 00000110B + JR FM_MOTOR1 +FM_MOTOR1: + JP Z,FC_MOTORON + JP FC_MOTOROFF + +FM_FDCRESET: + CALL NEWLINE + LD A,(FDCID) + CP FDC_DIO ; RESET NOT POSSIBLE ON DIO + JP NZ,FC_RESETFDC + LD DE,FCS_NORES + JP WRITESTR + +FM_NOTIMPL: + CALL PC_SPACE ; NOT IMPLEMENTED + LD DE,STR_NOTIMPL + CALL WRITESTR + RET + +FM_GETTHS: + CALL FM_GETTRK + CALL FM_GETHEAD + CALL FM_GETSEC + RET + +FM_GETTRK: + LD DE,FCPP_TRK + LD HL,FCD_C + CALL GETHEXBYTE + RET + +FM_GETHEAD: + LD DE,FCPP_HEAD + LD HL,FCD_H + CALL GETHEXBYTE + RET + +FM_GETSEC: + LD DE,FCPP_SEC + LD HL,FCD_R + CALL GETHEXBYTE + RET + +FM_GETDOR: + LD DE,FCPP_DOR + LD HL,FST_DOR + CALL GETHEXBYTE + RET +; +FCS_NORES .TEXT "\r\n*** RESET NOT SUPORTED BY HARDWARE ***$" +; +;=============================================================================== +; FLOPPY DISK CONTROL SERVICES (PHYSICAL DEVICE CONTROL FOR FDC HARDWARE) +;=============================================================================== +; +; FDC RESULT CODES +; +FRC_OK .EQU 0 ; 00 +FRC_NOTIMPL .EQU -01H ; FF +FRC_CMDERR .EQU -02H ; FE +FRC_ERROR .EQU -03H ; FD +FRC_ABORT .EQU -04H ; FC +FRC_BUFMAX .EQU -05H ; FB +FRC_ABTERM .EQU -08H ; F8 +FRC_INVCMD .EQU -09H ; F7 +FRC_DSKCHG .EQU -0AH ; F6 +FRC_ENDCYL .EQU -0BH ; F5 +FRC_DATAERR .EQU -0CH ; F4 +FRC_OVERRUN .EQU -0DH ; F3 +FRC_NODATA .EQU -0EH ; F2 +FRC_NOTWRIT .EQU -0FH ; F1 +FRC_MISADR .EQU -10H ; F0 +FRC_TOFDCRDY .EQU -11H ; EF +FRC_TOSNDCMD .EQU -12H ; EE +FRC_TOGETRES .EQU -13H ; ED +FRC_TOEXEC .EQU -14H ; EC +FRC_TOSEEKWT .EQU -15H ; EB +FRC_MISMATCH .EQU -16H ; EA +; +; FDC STATUS CODE STRINGS +; +FSS_OK .TEXT "OK$" +FSS_NOTIMPL .TEXT "NOT IMPLEMENTED$" +FSS_CMDERR .TEXT "COMMAND ERROR$" +FSS_ERROR .TEXT "ERROR$" +FSS_ABORT .TEXT "ABORT$" +FSS_BUFMAX .TEXT "BUFFER EXCEEDED$" +FSS_ABTERM .TEXT "ABNORMAL TERMINATION$" +FSS_INVCMD .TEXT "INVALID COMMAND$" +FSS_DSKCHG .TEXT "DISK CHANGE$" +FSS_ENDCYL .TEXT "END OF CYLINDER$" +FSS_DATAERR .TEXT "DATA ERROR$" +FSS_OVERRUN .TEXT "OVERRUN$" +FSS_NODATA .TEXT "NO DATA$" +FSS_NOTWRIT .TEXT "NOT WRITABLE$" +FSS_MISADR .TEXT "MISSING ADDRESS MARK$" +FSS_TOFDCRDY .TEXT "FDC READY TIMEOUT$" +FSS_TOSNDCMD .TEXT "SENDCMD TIMEOUT$" +FSS_TOGETRES .TEXT "GET RESULTS TIMEOUT$" +FSS_TOEXEC .TEXT "EXEC TIMEOUT$" +FSS_TOSEEKWT .TEXT "SEEK WAIT TIMEOUT$" +; +; FDC STATUS STRING TABLE +; +FSST: .DB FRC_OK \ .DW FSS_OK +FSST_ENTSIZ .EQU $ - FSST + .DB FRC_NOTIMPL \ .DW FSS_NOTIMPL + .DB FRC_CMDERR \ .DW FSS_CMDERR + .DB FRC_ERROR \ .DW FSS_ERROR + .DB FRC_ABORT \ .DW FSS_ABORT + .DB FRC_BUFMAX \ .DW FSS_BUFMAX + .DB FRC_ABTERM \ .DW FSS_ABTERM + .DB FRC_INVCMD \ .DW FSS_INVCMD + .DB FRC_DSKCHG \ .DW FSS_DSKCHG + .DB FRC_ENDCYL \ .DW FSS_ENDCYL + .DB FRC_DATAERR \ .DW FSS_DATAERR + .DB FRC_OVERRUN \ .DW FSS_OVERRUN + .DB FRC_NODATA \ .DW FSS_NODATA + .DB FRC_NOTWRIT \ .DW FSS_NOTWRIT + .DB FRC_MISADR \ .DW FSS_MISADR + .DB FRC_TOFDCRDY \ .DW FSS_TOFDCRDY + .DB FRC_TOSNDCMD \ .DW FSS_TOSNDCMD + .DB FRC_TOGETRES \ .DW FSS_TOGETRES + .DB FRC_TOEXEC \ .DW FSS_TOEXEC + .DB FRC_TOSEEKWT \ .DW FSS_TOSEEKWT +FSST_COUNT .EQU (($ - FSST) / FSST_ENTSIZ) ; # ENTRIES IN TABLE +; +; FDC COMMAND PHASE +; +FCP_CMD .DB 000H ; INPUT: COMMAND CODE +FCP_BUFLEN .DB 00H +FCP_BUF .FILL 10H +FCP_BUFSIZ .EQU $-FCP_BUF +FCP_XFRCNT .DW 00H ; BYTES TRANSFERRED DURING COMMAND PHASE +; +; FDC EXECUTION PHASE +; +FXP_XR .DW 00H ; INPUT: ADDRESS OF EXECUTION ROUTINE TO INVOKE +FXP_TO .DB 00H ; TIMEOUT COUNTDOWN TIMER USED IN SOME VARIATIONS +FXP_ITER .DB 00H ; LOOP ITERATION COUNTER (MUST IMMEDIATELY FOLLOW FXP_TO) +FXP_A .DB 00H ; LAST VALUE OF REG A RECORDED DURING EXECUTION +FXP_BC .DW 00H ; LAST VALUE OF REG BC RECORDED DURING EXECUTION +FXP_DE .DW 00H ; LAST VALUE OF REG DE RECORDED DURING EXECUTION +FXP_HL .DW 00H ; LAST VALUE OF REG HL RECORDED DURING EXECUTION +FXP_BUFLEN .DB 00H +FXP_BUF .FILL 50H ; USED FOR CERTAIN EXEC ROUTINES (FORMAT TRACK) +FXP_BUFSIZ .EQU $-FXP_BUF +; +; FDC STATUS +; +FST_RC .DB 00H +FST_MSR .DB 00H +FST_DOR .DB 00H +; +; FDC RESULTS BUFFER +; +FRB_LEN .DB 00H +FRB +FRB_ST0 +FRB_ST3 .DB 0 +FRB_ST1 +FRB_PCN .DB 0 +FRB_ST2 .DB 0 +FRB_C .DB 0 +FRB_H .DB 0 +FRB_R .DB 0 +FRB_N .DB 0 + .FILL 10H ; ALLOWS EXTRA CHARACTERS TO BE RETREIEVED +FRB_SIZ .EQU $-FRB +; +; FDC COMMANDS +; +CMD_READ .EQU 00000110B ; ST0,ST1,ST2,C,H,R,N +CMD_READDEL .EQU 00001100B ; ST0,ST1,ST2,C,H,R,N +CMD_WRITE .EQU 00000101B ; ST0,ST1,ST2,C,H,R,N +CMD_WRITEDEL .EQU 00001001B ; ST0,ST1,ST2,C,H,R,N +CMD_READTRK .EQU 00000010B ; ST0,ST1,ST2,C,H,R,N +CMD_READID .EQU 00001010B ; ST0,ST1,ST2,C,H,R,N +CMD_FMTTRK .EQU 00001101B ; ST0,ST1,ST2,C,H,R,N +CMD_SCANEQ .EQU 00010001B ; ST0,ST1,ST2,C,H,R,N +CMD_SCANLOEQ .EQU 00011001B ; ST0,ST1,ST2,C,H,R,N +CMD_SCANHIEQ .EQU 00011101B ; ST0,ST1,ST2,C,H,R,N +CMD_RECAL .EQU 00000111B ; +CMD_SENSEINT .EQU 00001000B ; ST0,PCN +CMD_SPECIFY .EQU 00000011B ; +CMD_DRVSTAT .EQU 00000100B ; ST3 +CMD_SEEK .EQU 00001111B ; +CMD_VERSION .EQU 00010000B ; ST0 +; +; FDC COMMAND DATA +; +FCD: ; FLOPPY CONFIGURATION DATA (PUBLIC) MANAGED AS A "BLOCK", SEE FCB BELOW +FCD_EOT ; END OF TRACK SECTOR (SAME AS SC SINCE SOT ALWAYS 1) +FCD_SC .DB 000H ; SECTOR COUNT +FCD_SECSZ .DW 000H ; SECTOR SIZE IN BYTES +FCD_GPL .DB 000H ; GAP LENGTH (R/W) +FCD_GPLF .DB 000H ; GAP LENGTH (FORMAT) +FCD_SRTHUT .DB 000H ; STEP RATE, IBM PS/2 CALLS FOR 3ms, 0DH = 3ms SRT, HEAD UNLOAD TIME +FCD_HLT .DB 000H ; HEAD LOAD TIME, IBM PS/2 CALLS FOR 15ms 08H = 16ms HUT +FCD_DORA .DB 000H ; DEFAULT DOR VALUE FOR MEDIA +FCD_DORB .DB 000H ; DEFAULT DOR VALUE FOR MEDIA +FCD_DORC .DB 000H ; DEFAULT DOR VALUE FOR MEDIA +FCD_DORD .DB 000H ; DEFAULT DOR VALUE FOR MEDIA +FCD_DCR .DB 000H ; DOR VALUE FOR MEDIA +FCD_LEN .EQU $ - FCD + ; DYNAMICALLY MANAGED (PUBLIC) +FCD_DS .DB 001H ; DRIVE SELECT (UNIT NUMBER 0-3) +FCD_C .DB 000H ; CYLINDER +FCD_H .DB 000H ; HEAD +FCD_R .DB 001H ; RECORD +FCD_D .DB 0E5H ; FORMAT DATA FILL BYTE +FCD_X .DB 002H ; FORMAT INTERLEAVE FACTOR (1...N) +FCD_ND .DB 000H ; DMA, 0=DMA, 1=NON-DMA + ; STATIC CONFIGURATION, NEVER CHANGES (PRIVATE) +FCD_SOT .DB 001H ; STARTING SECTOR NUMBER OF TRACK +FCD_MT .DB 000H ; MULTI-TRACK, WE DON'T USE, SET TO 0 +FCD_MFM .DB 001H ; MFM, 0=FM, 1=MFM, WE USE MFM ALWAYS +FCD_SK .DB 000H ; SKIP MODE, WE DON'T USE, SET TO 0 +FCD_N .DB 002H ; SECTOR SIZE, N=2 FOR 512 BYTES +FCD_DTL .DB 0FFH ; DATA LENGTH (WHEN N=0, SET TO FF OTHERWISE) +FCD_STP .DB 001H ; SECTOR SCAN TYPE, 1=CONTIG, 2=ALTERNATING + ; CONTROL STUFF (PUBLIC) +FCD_TRACE .DB 00H ; TRACE LEVEL +; +; +; FDC CMD PARM PROMPTS +; +FCPP_TRK .TEXT "TRACK$" +FCPP_HEAD .TEXT "HEAD$" +FCPP_SEC .TEXT "SECTOR$" +FCPP_DOR .TEXT "DOR$" +; +; FDC EXECUTION ROUTINE JUMP TABLE +; +FXRJ_NOP: JP FXR_NOP +FXRJ_READ: JP FXR_READ +FXRJ_READDEL: JP FXR_READDEL +FXRJ_WRITE: JP FXR_WRITE +FXRJ_WRITEDEL: JP FXR_WRITEDEL +FXRJ_READTRK: JP FXR_READTRK +FXRJ_READID: JP FXR_READID +FXRJ_FMTTRK: JP FXR_FMTTRK +FXRJ_SCANEQ: JP FXR_SCANEQ +FXRJ_SCANLOEQ: JP FXR_SCANLOEQ +FXRJ_SCANHIEQ: JP FXR_SCANHIEQ +FXRJ_RECAL: JP FXR_RECAL +FXRJ_SENSEINT: JP FXR_SENSEINT +FXRJ_SPECIFY: JP FXR_SPECIFY +FXRJ_DRVSTAT: JP FXR_DRVSTAT +FXRJ_SEEK: JP FXR_SEEK +FXRJ_VERSION JP FXR_VERSION +; +; FDC COMMAND STRINGS +; +FCS_NOP: .TEXT "NOP$" +FCS_READ: .TEXT "READ$" +FCS_READDEL: .TEXT "READ DELETED$" +FCS_WRITE: .TEXT "WRITE$" +FCS_WRITEDEL: .TEXT "WRITE DELETED$" +FCS_READTRK: .TEXT "READ TRACK$" +FCS_READID: .TEXT "READ ID$" +FCS_FMTTRK: .TEXT "FORMAT TRACK$" +FCS_SCANEQ: .TEXT "SCAN EQUAL$" +FCS_SCANLOEQ: .TEXT "SCAN LOW OR EQUAL$" +FCS_SCANHIEQ: .TEXT "SCAN HIGH OR EQUAL$" +FCS_RECAL: .TEXT "RECALIBRATE$" +FCS_SENSEINT: .TEXT "SENSE INTERRUPT$" +FCS_SPECIFY: .TEXT "SPECIFY$" +FCS_DRVSTAT: .TEXT "DRIVE STATUS$" +FCS_SEEK: .TEXT "SEEK$" +FCS_VERSION: .TEXT "VERSION$" +; +; FDC COMMAND TABLE +; +FCT .DB CMD_READ \ .DW FCS_READ, FXRJ_READ +FCT_ENTSIZ .EQU $ - FCT + .DB CMD_READDEL \ .DW FCS_READDEL, FXRJ_READDEL + .DB CMD_WRITE \ .DW FCS_WRITE, FXRJ_WRITE + .DB CMD_WRITEDEL \ .DW FCS_WRITEDEL, FXRJ_WRITEDEL + .DB CMD_READTRK \ .DW FCS_READTRK, FXRJ_READTRK + .DB CMD_READID \ .DW FCS_READID, FXRJ_READID + .DB CMD_FMTTRK \ .DW FCS_FMTTRK, FXRJ_FMTTRK + .DB CMD_SCANEQ \ .DW FCS_SCANEQ, FXRJ_SCANEQ + .DB CMD_SCANLOEQ \ .DW FCS_SCANLOEQ, FXRJ_SCANLOEQ + .DB CMD_SCANHIEQ \ .DW FCS_SCANHIEQ, FXRJ_SCANHIEQ + .DB CMD_RECAL \ .DW FCS_RECAL, FXRJ_RECAL + .DB CMD_SENSEINT \ .DW FCS_SENSEINT, FXRJ_SENSEINT + .DB CMD_SPECIFY \ .DW FCS_SPECIFY, FXRJ_SPECIFY + .DB CMD_DRVSTAT \ .DW FCS_DRVSTAT, FXRJ_DRVSTAT + .DB CMD_SEEK \ .DW FCS_SEEK, FXRJ_SEEK + .DB CMD_VERSION \ .DW FCS_VERSION, FXRJ_VERSION +FCT_COUNT .EQU (($ - FCT) / FCT_ENTSIZ) ; # ENTRIES IN TABLE +; +; ENTRY POINTS FOR FDC COMMANDS +; +FC_READ: + LD A,CMD_READ + LD B,0FFH ; MT & MFM & SK & CMD BITS + LD (FCP_CMD),A + LD HL,FXR_READ + LD (FXP_XR),HL + CALL FC_SETUPIO + CALL FC_CMDPROC + RET + +FC_READDEL: + LD A,CMD_READDEL + LD B,0FFH ; MT & MFM & SK & CMD BITS + LD (FCP_CMD),A + LD HL,FXR_READDEL + LD (FXP_XR),HL + CALL FC_SETUPIO + CALL FC_CMDPROC + RET + +FC_WRITE: + LD A,CMD_WRITE + LD B,0DFH ; MT & MFM & CMD BITS + LD (FCP_CMD),A + LD HL,FXR_WRITE + LD (FXP_XR),HL + CALL FC_SETUPIO + CALL FC_CMDPROC + RET + +FC_WRITEDEL: + LD A,CMD_WRITEDEL + LD B,0DFH ; MT & MFM & CMD BITS + LD (FCP_CMD),A + LD HL,FXR_WRITEDEL + LD (FXP_XR),HL + CALL FC_SETUPIO + CALL FC_CMDPROC + RET + +FC_READTRK: + LD A,CMD_READTRK + LD B,07FH ; MFM & SK & CMD BITS + LD (FCP_CMD),A + LD HL,FXR_READTRK + LD (FXP_XR),HL + CALL FC_SETUPIO + CALL FC_CMDPROC + RET + +FC_READID: + LD A,CMD_READID + LD B,05FH ; MFM & CMD BITS + LD (FCP_CMD),A + LD HL,FXR_READID + LD (FXP_XR),HL + CALL FC_SETUPCMD + CALL FC_CMDPROC + RET + +FC_FMTTRK: + LD A,CMD_FMTTRK + LD B,05FH ; MFM & CMD BITS + LD (FCP_CMD),A + LD HL,FXR_FMTTRK + LD (FXP_XR),HL + CALL FC_SETUPFMT + CALL FC_CMDPROC + RET + +FC_SCANEQ: + LD A,CMD_SCANEQ + LD B,0FFH ; MT & MFM & SK & CMD BITS + LD (FCP_CMD),A + LD HL,FXR_SCANEQ + LD (FXP_XR),HL + CALL FC_SETUPSCAN + CALL FC_CMDPROC + RET + +FC_SCANLOEQ: + LD A,CMD_SCANLOEQ + LD B,0FFH ; MT & MFM & SK & CMD BITS + LD (FCP_CMD),A + LD HL,FXR_SCANLOEQ + LD (FXP_XR),HL + CALL FC_SETUPSCAN + CALL FC_CMDPROC + RET + +FC_SCANHIEQ: + LD A,CMD_SCANHIEQ + LD B,0FFH ; MT & MFM & SK & CMD BITS + LD (FCP_CMD),A + LD HL,FXR_SCANHIEQ + LD (FXP_XR),HL + CALL FC_SETUPSCAN + CALL FC_CMDPROC + RET + +FC_RECAL: + LD A,CMD_RECAL + LD B,01FH ; CMD BITS ONLY + LD (FCP_CMD),A + LD HL,FXR_RECAL + LD (FXP_XR),HL + CALL FC_SETUPSEEK ; SPECIALIZATION OF SEEK + LD A,2 ; GENERIC COMMAND, BUT JUST FIRST COMMAND CODE + LD (FCP_BUFLEN),A + CALL FC_CMDPROC + RET + +FC_SENSEINT: + LD A,CMD_SENSEINT + LD B,01FH ; CMD BITS ONLY + LD (FCP_CMD),A + LD HL,FXR_SENSEINT + LD (FXP_XR),HL + CALL FC_SETUPCMD + LD A,1 ; GENERIC COMMAND, BUT JUST FIRST COMMAND CODE + LD (FCP_BUFLEN),A + CALL FC_CMDPROC + RET + +FC_SPECIFY: + LD A,CMD_SPECIFY + LD B,01FH ; CMD BITS ONLY + LD (FCP_CMD),A + LD HL,FXR_SPECIFY + LD (FXP_XR),HL + CALL FC_SETUPSPECIFY + CALL FC_CMDPROC + RET + +FC_DRVSTAT: + LD A,CMD_DRVSTAT + LD B,01FH ; CMD BITS ONLY + LD (FCP_CMD),A + LD HL,FXR_DRVSTAT + LD (FXP_XR),HL + CALL FC_SETUPCMD + CALL FC_CMDPROC + RET + +FC_SEEK: + LD A,CMD_SEEK + LD B,01FH ; CMD BITS ONLY + LD (FCP_CMD),A + LD HL,FXR_SEEK + LD (FXP_XR),HL + CALL FC_SETUPSEEK + CALL FC_CMDPROC + RET + +FC_VERSION: + LD A,CMD_VERSION + LD B,01FH ; CMD BITS ONLY + LD (FCP_CMD),A + LD HL,FXR_VERSION + LD (FXP_XR),HL + CALL FC_SETUPCMD + LD A,1 ; GENERIC COMMAND, BUT JUST FIRST COMMAND CODE + LD (FCP_BUFLEN),A + CALL FC_CMDPROC + RET +; +; HELPER FUNCTIONS TO SETUP CMDBUF +; +FC_SETUPCMD: + PUSH BC ; B CONTAINS BIT MASK TO USE FOR FIRST BYTE + ; SO THAT WE CAN MASK OFF BITS THAT ARE NOT + ; USED FOR CERTAIN COMMANDS + LD DE,FCP_BUF + + AND 01FH ; REMOVE ANY EXTRANEOUS BITS FROM COMMAND BYTE + LD C,A ; SAVE THE COMMAND + LD A,(FCD_MT) ; GET MT BIT + AND 01H ; MASK TO REMOVE IRRELEVANT BITS FOR SAFETY + RLA ; MAKE ROOM FOR MFM + LD B,A ; SAVE WHAT WE HAVE SO FAR IN B + LD A,(FCD_MFM) ; GET MFM BIT + AND 01H ; MASK TO REMOVE IRRELEVANT BITS FOR SAFETY + OR B ; COMBINE WITH SAVED + RLA ; MAKE ROOM FOR SK + LD B,A ; SAVE WHAT WE HAVE SO FAR IN B + LD A,(FCD_SK) ; GET SK BIT + AND 01H ; MASK TO REMOVE IRRELEVANT BITS FOR SAFETY + OR B ; COMBINE WITH SAVED + RLA ; MAKE ROOM FOR THE COMMAND BITS + RLA + RLA + RLA + RLA + LD B,C ; RECOVER THE COMMAND VALUE + OR B ; COMBINE WITH SAVED + POP BC ; GET THE BIT MASK FOR FIRST BYTE + AND B ; APPLY IT + LD (DE),A ; SAVE THE BYTE + INC DE + + LD A,(FCD_H) ; START WITH HDS + AND 01H ; MASK TO REMOVE IRRELEVANT BITS FOR SAFETY + RLA ; MAKE ROOM FOR DS BITS + RLA ; + LD B,A ; SAVE WHAT WE HAVE SO FAR IN B + LD A,(FCD_DS) ; GET DS VALUE + AND 03H ; MASK TO REMOVE IRRELEVANT BITS FOR SAFETY + OR B ; COMBINE WITH SAVED + LD (DE),A ; SAVE THE BYTE + INC DE + + LD A,2 ; THIS IS A 2 BYTE COMMAND STRING + LD (FCP_BUFLEN),A + + RET + +FC_SETUPIO: + CALL FC_SETUPCMD + + LD A,(FCD_C) + LD (DE),A + INC DE + + LD A,(FCD_H) + LD (DE),A + INC DE + + LD A,(FCD_R) + LD (DE),A + INC DE + + LD A,(FCD_N) + LD (DE),A + INC DE + + ; V5.3, USE EOT=R TO R/W ONLY ONE SECTOR + ;LD A,(FCD_EOT) + LD A,(FCD_R) + LD (DE),A + INC DE + + LD A,(FCD_GPL) + LD (DE),A + INC DE + + LD A,(FCD_DTL) + LD (DE),A + INC DE + + LD A,9 + LD (FCP_BUFLEN),A + + RET + +FC_SETUPFMT: + CALL FC_SETUPCMD + + LD A,(FCD_N) + LD (DE),A + INC DE + + LD A,(FCD_SC) + LD (DE),A + INC DE + + LD A,(FCD_GPLF) + LD (DE),A + INC DE + + LD A,(FCD_D) + LD (DE),A + INC DE + + LD A,6 + LD (FCP_BUFLEN),A + +; SETUP FORMAT BUFFER WITH SECTOR ID INFO FOR ENTIRE TRACK - (C,H,S,N) FOR EACH SECTOR +; INTERLEAVE AS REQUESTED +; +; B = CURRENT INTERLEAVE PASS STARTING SECTOR ID +; C = CURRENT SECTOR ID +; H = INTERLEAVE STEP +; L = LAST SECTOR ID + 1 +; DE = BUFFER POINTER +; + + PUSH DE + PUSH HL + + ; COMPUTE INTERLEAVE STEP + LD H,-1 + LD A,(FCD_X) + LD B,A + LD A,(FCD_SC) +LOOP: + INC H + SUB B + JR NC,LOOP + + LD DE,FXP_BUF ; DE POINTS TO START OF BUFFER + + LD A,(FCD_SOT) ; GET FIRST SECTOR ID + LD B,A ; B = FIRST SECTOR ID FOR CURRENT INTERLEAVE PASS + LD C,A ; C = SECTOR ID + + LD A,(FCD_SC) ; NUM SECTORS TO SET UP + ADD A,C + LD L,A ; L = LAST SECTOR ID + 1 + +FC_SETUPFMT1: + ; CYLINDER + LD A,(FCD_C) + LD (DE),A + INC DE + + ; HEAD + LD A,(FCD_H) + LD (DE),A + INC DE + + ; SECTOR ID + LD A,C + LD (DE),A + INC DE + + ; SECTOR SIZE + LD A,(FCD_N) + LD (DE),A + INC DE + + ; INC SECTOR ID BY INTERLEAVE STEP + LD A,H + ADD A,C + LD C,A + + ; LOOP IF WE HAVE NOT GOTTEN PAST LAST SECTOR ID + CP L + JP M,FC_SETUPFMT1 + + ; SETUP FOR NEXT INTERLEAVE PASS + INC B + LD C,B + + ; LOOP IF WE ARE NOT DONE + LD A,H + CP C + JP P,FC_SETUPFMT1 + + ; DONE, FINALIZE BUFFER + LD A,(FCD_SC) ; GET SECTOR COUNT + RLCA ; MULTIPLY BY 4 + RLCA + LD (FXP_BUFLEN),A ; STORE AS BUFFER LENGTH + + POP HL + POP DE + RET + +FC_SETUPSCAN: + CALL FC_SETUPIO ; START WITH GENERIC IO CMD + + LD DE,FCP_BUF+8 ; REPLACE DTL WITH STP + LD A,(FCD_STP) + LD (DE),A + + RET + +FC_SETUPSEEK: + CALL FC_SETUPCMD ; START WITH GENERIC IO CMD + + LD A,(FCD_C) + LD (DE),A + INC DE + + LD DE,FCP_BUF ; REMOVE EXTRANEOUS BITS FROM CC0 + LD A,(DE) + AND 0FH + LD (DE),A + + LD A,3 + LD (FCP_BUFLEN),A + + RET + +FC_SETUPSPECIFY: + CALL FC_SETUPCMD + DEC DE ; BACKUP 1 BYTE, WE ONLY WANT FIRST BYTE + + LD A,(FCD_SRTHUT) + LD (DE),A ; SAVE THE BYTE + INC DE + + LD A,(FCD_HLT) + AND 07FH + RLA + LD B,A + LD A,(FCD_ND) + AND 01H + OR B + LD (DE),A ; SAVE THE BYTE + INC DE + + LD A,3 + LD (FCP_BUFLEN),A + + RET +; +; MAIN FDC COMMAND PROCESSOR +; +FC_CMDPROC: + CALL FOP + CALL FC_PRTRESULTS + RET +; +; FDC SEQUENCE INITIALIZATION +; +FC_INIT: + LD HL,FDCBM + LD A,(HL) + AND _DIO + JR NZ,FC_INIT1 + LD A,(HL) + AND _ZETA | _DIO3 + JR NZ,FC_INIT2 + LD A,(HL) + AND _PCAT + JR NZ,FC_INIT3 + LD A,(HL) + AND _RCSMC + JR NZ,FC_INIT4 + RET +FC_INIT1: ; DIO + LD A,(FCD_DORA) + JR FC_INIT5 +FC_INIT2: ; ZETA, DIO3 + LD A,(FCD_DORB) + JR FC_INIT5 +FC_INIT3: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO, EPFDC, MBC + LD A,(FCD_DORC) + JR FC_INIT5 +FC_INIT4: ; WDSMC + LD A,(FCD_DORD) + JR FC_INIT5 + +FC_INIT5: + LD (FST_DOR),A + CALL FC_SETDOR + RET +; +; SET FST_DOR +; +FC_SETDOR: + PUSH AF + LD A,(FST_DOR) + LD C,(IY+CFG_DOR) + OUT (C),A + POP AF + RET +; +; RESET FDC BY PULSING BIT 7 OF DOR LOW +; NOTE: DIO HARDWARE HAS NO MECHANISM TO PULSE RESET VIA SOFTWARE +; +FC_RESETFDC: + LD C,(IY+CFG_DOR) + LD HL,FDCBM + LD A,(HL) + AND _ZETA | _DIO3 | _RCSMC + JR NZ,FC_RESETFDC1 + LD A,(HL) + AND _PCAT + JR NZ,FC_RESETFDC2 + RET +FC_RESETFDC1: ; ZETA, DIO3, RCSMC + LD A,(FST_DOR) + PUSH AF + RES 7,A + OUT (C),A + CALL DELAY + POP AF + OUT (C),A + JR FC_RESETFDC3 +FC_RESETFDC2: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO, EPFDC, MBC + LD A,0 + OUT (C),A + LD A,(FST_DOR) + OUT (C),A + JR FC_RESETFDC3 +FC_RESETFDC3: + LD DE,156 ; DELAY: 16us * 156 = 2.5ms + CALL VDELAY + + RET +; +; PULSE TERMCT TO TERMINATE ANY ACTIVE EXECUTION PHASE +; +FC_PULSETC: + ; V5.3, USE EOT=R TO R/W ONLY ONE SECTOR + ;LD A,(FDCBM) + ;AND _PCAT + ;JR NZ,FC_PULSETC1 + ;; NOT DIDE, N8, ZETA2, RCSMC, SMZ80 + ;LD C,(IY+CFG_DOR) + ;LD A,(FST_DOR) + ;SET 0,A + ;OUT (C),A + ;RES 0,A + ;OUT (C),A + ;JR FC_PULSETC2 +;FC_PULSETC1: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO, EPFDC, MBC + ;LD C,(IY+CFG_TC) + ;IN A,(C) + ;JR FC_PULSETC2 +;FC_PULSETC2: + RET +; +; SET FST_DOR FOR MOTOR CONTROL ON +; +FC_MOTORON: + LD HL,FDCBM + LD A,(HL) + AND _DIO + JR NZ,FC_MOTORON1 + LD A,(HL) + AND _ZETA | _DIO3 + JR NZ,FC_MOTORON2 + LD A,(HL) + AND _PCAT + JR NZ,FC_MOTORON3 + LD A,(HL) + AND _RCSMC + JR NZ,FC_MOTORON4 + RET +FC_MOTORON1: ; DIO + LD HL,FST_DOR ; POINT TO FDC_DOR + RES 1,(HL) ; SET MOTOR ON + JR FC_MOTORON5 +FC_MOTORON2: ; ZETA, DIO3 + LD HL,FST_DOR ; POINT TO FDC_DOR + SET 1,(HL) + JR FC_MOTORON5 +FC_MOTORON3: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO, EPFDC, MBC + LD HL,FST_DOR ; POINT TO FDC_DOR + LD A,(HL) ; START WITH CURRENT DOR + AND 11111100B ; GET RID OF ANY ACTIVE DS BITS + LD C,A ; SAVE IT FOR NOW + LD A,(FCD_DS) ; NOW GET CURRENT DS + LD B,A ; PUT IN B FOR LATER + OR C ; COMBINE WITH SAVED DOR + LD C,A ; RE-SAVE IT + INC B ; SET UP B AS LOOP COUNTER (DS + 1) + LD A,00001000B ; STARTING BIT PATTERN FOR MOTOR +FC_MOTORON3A: + RLA ; SHIFT LEFT + DJNZ FC_MOTORON3A ; DS TIMES + OR C ; COMBINE WITH SAVED + LD (HL),A ; COMMIT THE NEW VALUE TO FST_DOR + JR FC_MOTORON5 +FC_MOTORON4: ; RCSMC + LD A,(FCD_DS) ; GET CURRENT DS + LD C,00000010B ; ASSUME MOTORA (BIT 1) + OR A ; TEST FOR DS 0 + JR Z,FC_MOTORON4A ; IF SO, CONTINUE W/ MOTORA + LD C,00000100B ; OTHERWISE, MOTORB (BIT 2) +FC_MOTORON4A: + LD A,(FST_DOR) ; GET CURRENT DOR VALUE + OR C ; APPLY NEW MOTOR BIT + LD (FST_DOR),A ; COMMIT NEW VALUE + JR FC_MOTORON5 +FC_MOTORON5: + CALL FC_SETDOR ; OUTPUT TO CONTROLLER + CALL LDELAY ; WAIT 1/2 SEC ON MOTOR START FOR SPIN-UP + LD A,(FDCBM) + AND _PCAT + RET Z + LD A,(FCD_DCR) + LD C,(IY+CFG_DCR) + OUT (C),A + RET +; +; SET FST_DOR FOR MOTOR CONTROL OFF +; +FC_MOTOROFF: + LD HL,FDCBM + LD A,(HL) + AND _DIO + JR NZ,FC_MOTOROFF1 + LD A,(HL) + AND _ZETA | _DIO3 + JR NZ,FC_MOTOROFF2 + LD A,(HL) + AND _PCAT + JR NZ,FC_MOTOROFF3 + LD A,(HL) + AND _RCSMC + JR NZ,FC_MOTOROFF4 + RET +FC_MOTOROFF1: ; DIO + LD HL,FST_DOR ; POINT TO FDC_DOR + SET 1,(HL) ; SET MOTOR OFF + JR FC_MOTOROFF5 +FC_MOTOROFF2: ; ZETA, DIO3 + LD HL,FST_DOR ; POINT TO FDC_DOR + RES 1,(HL) + JR FC_MOTOROFF5 +FC_MOTOROFF3: ; DIDE, N8, ZETA2, RCWDC, SMZ80, DYNO, EPFDC, MBC + LD HL,FST_DOR ; POINT TO FDC_DOR + LD A,DORC_INIT + LD (HL),A + JR FC_MOTOROFF5 +FC_MOTOROFF4: ; RCSMC + LD HL,FST_DOR ; POINT TO FDC_DOR + RES 1,(HL) ; CLEAR MOTORA + RES 2,(HL) ; CLEAR MOTORB + JR FC_MOTOROFF5 + +FC_MOTOROFF5: + CALL FC_SETDOR ; OUTPUT TO CONTROLLER + RET +; +;=============================================================================== +; FDC OPERATIONS +;=============================================================================== +; +FOP: +; +; INITIALIZATION +; + LD A,0 + LD (FRB_LEN),A + + LD A,FRC_OK + LD (FST_RC),A + + LD B,0 ; B IS LOOP COUNTER + LD C,(IY+CFG_MSR) ; SET C TO MSR PORT +FOP_CLR1: + CALL DELAY ; FDC MAY TAKE UP TO 12us TO UPDATE MSR + IN A,(C) ; GET STATUS + LD (FST_MSR),A ; SAVE IT FOR POTENTIAL LATER DIAGNOSIS + AND 0C0H ; ISOLATE HIGH NIBBLE, RQM/DIO/EXM/CB + CP 0C0H ; LOOKING FOR RQM=1, DIO=1, BYTES PENDING + JP NZ,FOP_CMD1 ; NO BYTES PENDING, GO TO NEXT PHASE + INC C ; SWITCH TO DATA PORT + IN A,(C) ; GET THE PENDING BYTE AND DISCARD + DEC C ; SWITCH BACK TO MSR PORT + DJNZ FOP_CLR1 ; KEEP CHECKING TILL COUNTER EXHAUSTER + JP FOP_TOFDCRDY ; OTHERWISE, TIMEOUT +; +; SEND COMMAND +; +FOP_CMD1: + LD HL,FCP_BUF + LD A,(FCP_BUFLEN) + LD D,A ; D = CMD BYTES TO SEND + +FOP_CMD2: ; START OF LOOP TO SEND NEXT BYTE + LD B,0 ; B IS LOOP COUNTER + +FOP_CMD4: ; START OF STATUS LOOP, WAIT FOR FDC TO BE READY FOR BYTE + CALL DELAY ; FDC MAY TAKE UP TO 12us TO UPDATE MSR + ; TYPICAL MSR TRANSITIONS: 80 10 90 90 + LD C,(IY+CFG_MSR) ; SET C TO MSR PORT + IN A,(C) ; READ MAIN STATUS REGISTER + LD (FST_MSR),A ; SAVE IT FOR POTENTIAL LATER DIAGNOSIS + AND 0C0H ; ISOLATE RQM/DIO + CP 080H ; LOOKING FOR RQM=1, DIO=0 (FDC READY FOR A BYTE) + JP Z,FOP_CMD6 ; GOOD, GO TO SEND BYTE + CP 0C0H ; HMMMM... RQM=1 & DIO=1, FDC WANTS TO SEND US DATA, UNEXPECTED + JP Z,FOP_RES ; GO IMMEDIATELY TO RESULTS??? + DJNZ FOP_CMD4 ; LOOP TILL COUNTER EXHAUSTED + JP FOP_TOSNDCMD ; COUNTER EXHAUSTED, TIMEOUT / EXIT + +FOP_CMD6: ; SEND NEXT BYTE + LD A,(HL) ; POINT TO NEXT BYTE TO SEND + LD C,(IY+CFG_DATA) ; SET C TO DATA PORT + OUT (C),A ; PUSH IT TO FDC + INC HL ; INCREMENT POINTER FOR NEXT TIME + DEC D ; DECREMENT NUM BYTES LEFT TO SEND + JP NZ,FOP_CMD2 ; DO NEXT BYTE + +; +; EXECUTION PHASE +; +FOP_X1: + LD HL,(FXP_XR) ; LOAD THE EXECUTION ROUTINE ADDRESS + CALL JPHL ; CALL INDIRECTLY VIA HL + + LD A,(FST_RC) ; CURRENT RESULT CODE + ;CALL PC_SPACE + ;CALL PRTHEXBYTE + CP FRC_OK ; ERROR? + RET NZ ; IF SO, ALL DONE + +; JP FOP_RES ; CONTINUE WITH GETRESULTS + +; +; RESULTS PHASE +; +FOP_RES: + LD B,0 ; B = BYTES RECEIVED + LD HL,FRB_LEN ; POINT TO BUFFER LENGTH + LD (HL),B ; UPDATE NUMBER OF BYTES RECEIVED + LD HL,FRB ; POINT TO RECEIVE BUFFER + +FOP_RES0: + LD DE,0 ; DE IS LOOP COUNTER + LD C,(IY+CFG_MSR) ; SET C TO MSR PORT + +FOP_RES1: + CALL DELAY ; FDC MAY TAKE UP TO 12us TO UPDATE MSR + IN A,(C) ; READ MAIN STATUS REGISTER + ;CALL PC_SPACE + ;CALL PRTHEXBYTE + LD (FST_MSR),A ; SAVE IT FOR POTENTIAL LATER DIAGNOSIS + AND $F0 ; REMOVE SEEK BITS + CP $D0 ; LOOKING FOR RQM=1, DIO=1, BUSY=1 (FDC BYTE PENDING) + JR Z,FOP_RES2 ; GOOD, GO TO RECEIVE BYTE + CP $80 ; DONE? + JR Z,FOP_EVAL ; IF SO, GO TO EVAL + DEC DE + LD A,D + OR E + JP NZ,FOP_RES1 + JP FOP_TOGETRES ; OTHERWISE TIMEOUT ERROR + +FOP_RES2: ; PROCESS NEXT PENDING BYTE + LD A,FRB_SIZ ; GET BUF SIZE + CP B ; REACHED MAX? + JP Z,FOP_BUFMAX ; HANDLE BUF MAX/EXIT + INC C ; SWITCH TO DATA PORT + IN A,(C) ; GET THE BYTE + DEC C ; SWITCH TO MSR PORT + LD (HL),A ; SAVE VALUE + INC HL ; INCREMENT BUF POS + INC B ; INCREMENT BYTES RECEIVED + PUSH HL ; SAVE HL + LD HL,FRB_LEN ; POINT TO BUFFER LENGTH + LD (HL),B ; UPDATE NUMBER OF BYTES RECEIVED + POP HL ; RESTORE HL + JR FOP_RES0 ; CONTINUE READ LOOP + +; +; EXIT POINTS +; +FOP_NOTIMPL: + LD A,FRC_NOTIMPL + JP FOP_ERR + +FOP_CMDERR: + LD A,FRC_CMDERR + JP FOP_ERR + +FOP_ERROR: + LD A,FRC_ERROR + JP FOP_ERR + +FOP_ABORT: + LD A,FRC_ABORT + JP FOP_ERR + +FOP_BUFMAX: + LD A,FRC_BUFMAX + JP FOP_ERR + +FOP_TOFDCRDY: + LD A,FRC_TOFDCRDY + JP FOP_ERR + +FOP_TOSNDCMD: + LD A,FRC_TOSNDCMD + JP FOP_ERR + +FOP_TOGETRES: + LD A,FRC_TOGETRES + JP FOP_ERR + +FOP_TOEXEC: + LD A,FRC_TOEXEC + JP FOP_ERR + +FOP_ERR: + LD (FST_RC),A + +FOP_EVAL: + LD A,(FCP_CMD) + ; DRVSTAT IS WEIRD, HAS ONLY ST3, NOTHING TO EVAL + CP CMD_DRVSTAT + JP Z,FOP_EXIT + ; DO WE HAVE ST0? + LD A,(FRB_LEN) + CP 1 + JP M,FOP_EXIT + +FOP_EVALST0: + LD A,(FRB_ST0) + AND 11000000B + CP 01000000B ; ABTERM + JR Z,FOP_ABTERM + CP 10000000B ; INVCMD + JR Z,FOP_INVCMD + CP 11000000B ; DSKCHG + JR Z,FOP_DSKCHG + JR FOP_EXIT + +FOP_ABTERM: + ; SENSEINT DOES NOT USE ST1 + LD A,(FCP_CMD) + CP CMD_SENSEINT + JR Z,FOP_ABTERM1 + ; DO WE HAVE ST1? + LD A,(FRB_LEN) + CP 2 + JP M,FOP_ABTERM1 + JR FOP_EVALST1 +FOP_ABTERM1: ; NO FURTHER DATA, SET FST TO ABTERM + LD A,FRC_ABTERM + JP FOP_SETFST + +FOP_INVCMD: + LD A,FRC_INVCMD + JP FOP_SETFST + +FOP_DSKCHG: + LD A,FRC_DSKCHG + JP FOP_SETFST + +FOP_EVALST1: + LD A,(FRB_ST1) + BIT 7,A + JP NZ,FOP_ENDCYL + BIT 5,A + JP NZ,FOP_DATAERR + BIT 4,A + JP NZ,FOP_OVERRUN + BIT 2,A + JP NZ,FOP_NODATA + BIT 1,A + JP NZ,FOP_NOTWRIT + BIT 0,A + JP NZ,FOP_MISADR + JP FOP_EXIT + +FOP_ENDCYL: + ; V5.3, USE EOT=R TO R/W ONLY ONE SECTOR + ;LD A,FRC_ENDCYL + ;JP FOP_SETFST + JP FOP_EXIT + +FOP_DATAERR: + LD A,FRC_DATAERR + JP FOP_SETFST + +FOP_OVERRUN: + LD A,FRC_OVERRUN + JP FOP_SETFST + +FOP_NODATA: + LD A,FRC_NODATA + JP FOP_SETFST + +FOP_NOTWRIT: + LD A,FRC_NOTWRIT + JP FOP_SETFST + +FOP_MISADR: + LD A,FRC_MISADR + JP FOP_SETFST + +FOP_SETFST: + LD (FST_RC),A + +FOP_EXIT: + RET + +; +; EXECUTION ROUTINES +; +FXR_READID: + JP FXRX + +FXR_READ: + LD HL,BUFFER ; POINT TO SECTOR BUFFER START + LD DE,(FCD_SECSZ) + + LD A,(DCD_MD) ; FIX: SHOULD NOT BE USING DCD HERE + CP MD_POLL + JP Z,FXRR + CP MD_INT + JP Z,IFXRR + CP MD_INTFAST + JP Z,FFXRR + CP MD_INTWAIT + JP Z,WFXRR + CP MD_DRQWAIT + JP Z,WFXRR + JP FXR_NOTIMPL + +FXR_WRITE: + LD HL,BUFFER ; POINT TO SECTOR BUFFER START + LD DE,(FCD_SECSZ) + + LD A,(DCD_MD) ; FIX: SHOULD NOT BE USING DCD HERE + CP MD_POLL + JP Z,FXRW + CP MD_INT + JP Z,IFXRW + CP MD_INTFAST + JP Z,FFXRW + CP MD_INTWAIT + JP Z,WFXRW + CP MD_DRQWAIT + JP Z,WFXRW + JP FXR_NOTIMPL + +FXR_FMTTRK: + LD HL,FXP_BUF ; POINT TO BUFFER START + LD D,0 + LD A,(FXP_BUFLEN) ; GET BYTE COUNT TO WRITE + LD E,A + + LD A,(DCD_MD) ; FIX: SHOULD NOT BE USING DCD HERE + CP MD_POLL + JP Z,FXRW + CP MD_INT + JP Z,IFXRW + CP MD_INTFAST + JP Z,IFXRW ; CAN'T USE FFXRW BECAUSE IT IS NOT 512 BYTES + CP MD_INTWAIT + JP Z,WFXRW + CP MD_DRQWAIT + JP Z,WFXRW + JP FXR_NOTIMPL + +FXR_NOTIMPL: +FXR_READDEL: +FXR_WRITEDEL: +FXR_READTRK: +FXR_SCANEQ: +FXR_SCANLOEQ: +FXR_SCANHIEQ: + LD A,FRC_NOTIMPL + LD (FST_RC),A + ; FALL THROUGH TO RET BELOW +FXR_NOP: +FXR_RECAL: +FXR_SENSEINT: +FXR_SPECIFY: +FXR_DRVSTAT: +FXR_SEEK: +FXR_VERSION: + RET +; +; NULL EXECUTION, NO DATA TO READ/WRITE (USED BY READID) +; +FXRX: + LD DE,1000H ; DE IS LOOP COUNTER, 4096 ITERATIONS OF 25ms + LD C,(IY+CFG_MSR) ; SET C TO MSR PORT +FXRX1: + CALL DELAY + IN A,(C) ; GET MSR + ;AND 0E0H ; ISOLATE RQM/DIO/EXM + CP $D0 ; WE WANT RQM=1,DIO=1,EXM=0 (READY TO READ A BYTE W/ EXEC INACTIVE) + JP Z,FXR_END ; GOT IT, EXIT CLEAN + DEC DE ; DECREMENT COUNTER (16 BIT) + LD A,D ; CHECK FOR ZERO + OR E ; " + JR NZ,FXRX1 ; NOT ZERO YET, KEEP CHECKING + JP FXR_TO ; OTHERWISE, TIMEOUT ERROR + RET + +; +; READ DATA +; +FXRR: LD A,E ; LOW BYTE OF COUNT TO ACCUM + OR A ; TEST FOR ZERO + JR Z,FXRR1 ; IF ZERO, DO NOT ADJUST ITERATIONS + INC D ; OTHERWISE, ITERATIONS IS ONE MORE THAN HIGH BYTE +FXRR1: LD B,E ; LOW BYTE OF COUNT TO B + LD A,D ; HIGH BYTE OF COUNT + LD (FXP_ITER),A ; ... IS ITERATION COUNT + LD A,(CPUSPD) ; CPU SPEED SCALER + LD (FXP_TO),A ; SAVE IT AS OUTER LOOP TIMEOUT + LD IX,FXP_TO ; (IX) IS FXP_TO, (IX+1) IS FCP_ITER + LD C,(IY+CFG_DATA) ; SET C TO DATA PORT + LD DE,0 + DI ; DISABLE INTERRUPTS TO AVOID OVERRUN +FXRR2: DEC C ; [04] SET C TO MSR PORT +FXRR3: LD DE,0 ; [10] TIMEOUT COUNTER +FXRR4: IN A,(C) ; [12] GET MSR + CP $F0 ; [07] BYTE READY? + JR Z,FXRR5 ; [12/7] GET IT + ;LD (FST_MSR),A ; [13] *DEBUG* SAVE MSR FOR LATER + DEC E ; [04] DEC LSB OF INNER TIMEOUT COUNTER + JR NZ,FXRR4 ; [12/7] LOOP IF LSB IS NOT EXHAUSTED + CP $D0 ; [07] IF RQM=1, DIO=1, EXM=0, CB=1, EXECUTION ABORTED + JP Z,FXR_ABORT ; [10] IF NOT SET, EXECUTION ABORTED + DEC D ; [04] DEC MSB OF INNER TIMEOUT COUNTER + JR NZ,FXRR4 ; [12/7] LOOP IF MSB IS NOT EXHAUSTED + DEC (IX) ; [23] DECREMENT OUTER LOOP COUNTER + JR NZ,FXRR3 ; [12/7] LOOP IF NOT EXHAUSTED + JP FXR_TO ; [10] OTHERWISE, HANDLE TIMEOUT +FXRR5: INC C ; [04] POINT TO DATA PORT + INI ; [16] (HL) := (C), HL++, B-- + JR NZ,FXRR2 ; [12/7] LOOP + DEC (IX+1) ; [23] DECREMENT ITERATION COUNT + JR NZ,FXRR2 ; [12] IF MORE ITERATIONS, LOOP + JP FXR_END ; [10] ELSE DONE + +; +; INT READ DATA - SAFE VERSION +; HANDLES FDC ERRORS, BUT NO TIMEOUT +; + ; AVOID RETURN FROM HALT IN PROBLEMATIC ADDRESS RANGE XX30-XX3F!!! + .IF ((($ & 0F0H) == 20H) | (($ & 0F0H) == 30H)) + .FILL (($ & 0FF00H) + 40H) - $ + ; .ORG (($ & 0FF00H) + 40H) + .ENDIF +; +IFXRR: + DI + LD C,(IY+CFG_MSR) ; SET C TO MSR PORT +IFXRR2: + EI +IFXRRX .EQU $ - IFXRR + HALT + IN A,(C) + BIT 5,A + JP Z,FXR_ABORT + INC C ; SWITCH C TO DATA PORT + INI + DEC C ; SWITCH C BACK TO MSR PORT + DEC DE + LD A,E + OR D + JP NZ,IFXRR2 + JP FXR_END +; +; INT READ DATA - FAST VERSION +; FIXED SECTOR SIZE OF 512 BYTES +; HANGS ON FDC ERRORS, NO TIMEOUT +; + ; AVOID RETURN FROM HALT IN PROBLEMATIC ADDRESS RANGE XX30-XX3F!!! + .IF ((($ & 0F0H) == 20H) | (($ & 0F0H) == 30H)) + .FILL (($ & 0FF00H) + 40H) - $ + ; .ORG (($ & 0FF00H) + 40H) + .ENDIF +; +FFXRR: + DI + LD C,(IY+CFG_DATA) ; SET C TO DATA PORT FOR INI +FFXRR2 EI + HALT +FFXRRX1 .EQU $ - FFXRR + INI + JP NZ,FFXRR2 +FFXRR3 EI + HALT +FFXRRX2 .EQU $ - FFXRR + INI + JP NZ,FFXRR3 + JP FXR_END +; +; WAIT READ DATA +; HANGS ON FDC ERRORS, NO TIMEOUT +; +WFXRR: + DI + LD C,(IY+CFG_DMA) +WFXRR2: + INI ; GET PENDING BYTE + DEC DE ; DECREMENT BYTE COUNT + LD A,D + OR E + JP NZ,WFXRR2 ; IF NOT ZERO, REPEAT LOOP + JP FXR_END ; CLEAN EXIT + +; +; WRITE DATA +; +FXRW: LD A,E ; LOW BYTE OF COUNT TO ACCUM + OR A ; TEST FOR ZERO + JR Z,FXRW1 ; IF ZERO, DO NOT ADJUST ITERATIONS + INC D ; OTHERWISE, ITERATIONS IS ONE MORE THAN HIGH BYTE +FXRW1: LD B,E ; LOW BYTE OF COUNT TO B + LD A,D ; HIGH BYTE OF COUNT + LD (FXP_ITER),A ; ... IS ITERATION COUNT + LD A,(CPUSPD) ; CPU SPEED SCALER + LD (FXP_TO),A ; SAVE IT AS OUTER LOOP TIMEOUT + LD IX,FXP_TO ; (IX) IS FXP_TO, (IX+1) IS FCP_ITER + LD C,(IY+CFG_DATA) ; SET C TO DATA PORT + LD DE,0 + DI ; DISABLE INTERRUPTS TO AVOID OVERRUN +FXRW2: DEC C ; [04] SET C TO MSR PORT +FXRW3: LD DE,0 ; [10] TIMEOUT COUNTER +FXRW4: IN A,(C) ; [12] GET MSR + CP $B0 ; [07] BYTE READY? + JR Z,FXRW5 ; [12/7] GET IT + ;LD (FST_MSR),A ; [13] *DEBUG* SAVE MSR FOR LATER + DEC E ; [04] DEC LSB OF INNER TIMEOUT COUNTER + JR NZ,FXRW4 ; [12/7] LOOP IF LSB IS NOT EXHAUSTED + CP $D0 ; [07] IF RQM=1, DIO=1, EXM=0, CB=1, EXECUTION ABORTED + JP Z,FXR_ABORT ; [10] IF NOT SET, EXECUTION ABORTED + DEC D ; [04] DEC MSB OF INNER TIMEOUT COUNTER + JR NZ,FXRW4 ; [12/7] LOOP IF MSB IS NOT EXHAUSTED + DEC (IX) ; [23] DECREMENT OUTER LOOP COUNTER + JR NZ,FXRW3 ; [12/7] LOOP IF NOT EXHAUSTED + JP FXR_TO ; [10] OTHERWISE, HANDLE TIMEOUT +FXRW5: INC C ; [04] POINT TO DATA PORT + OUTI ; [16] (C) := (HL), HL++, B-- + JR NZ,FXRW2 ; [12/7] LOOP + DEC (IX+1) ; [23] DECREMENT ITERATION COUNT + JR NZ,FXRW2 ; [12] IF MORE ITERATIONS, GO DO IT + JP FXR_END ; [10] ELSE DONE + + + +; +; INT WRITE DATA - SAFE VERSION +; HANDLES FDC ERRORS, BUT NO TIMEOUT +; + ; AVOID RETURN FROM HALT IN PROBLEMATIC ADDRESS RANGE XX30-XX3F!!! + .IF ((($ & 0F0H) == 20H) | (($ & 0F0H) == 30H)) + .FILL (($ & 0FF00H) + 40H) - $ + ; .ORG (($ & 0FF00H) + 40H) + .ENDIF +; +IFXRW: + DI + LD C,(IY+CFG_MSR) ; SET C TO MSR PORT +IFXRW2: EI + HALT + IN A,(C) + BIT 5,A + JP Z,FXR_ABORT + INC C ; SWITCH TO DATA PORT + OUTI + DEC C ; SWITCH BACK TO MSR PORT + DEC DE + LD A,E + OR D + JP NZ,IFXRW2 + JP FXR_END +; +; INT WRITE DATA - FAST VERSION +; FIXED SECTOR SIZE OF 512 BYTES +; HANGS ON FDC ERRORS, NO TIMEOUT +; + ; AVOID RETURN FROM HALT IN PROBLEMATIC ADDRESS RANGE XX30-XX3F!!! + .IF ((($ & 0F0H) == 20H) | (($ & 0F0H) == 30H)) + .FILL (($ & 0FF00H) + 40H) - $ + ; .ORG (($ & 0FF00H) + 40H) + .ENDIF +; +FFXRW: + DI + LD C,(IY+CFG_DATA) ; SET C TO DATA PORT +FFXRW2 EI + HALT + OUTI + JP NZ,FFXRW2 +FFXRW3 EI + HALT + OUTI + JP NZ,FFXRW3 + JP FXR_END +; +; WAIT WRITE DATA +; HANGS ON FDC ERRORS, NO TIMEOUT +; +WFXRW: + DI + LD C,(IY+CFG_DMA) +WFXRW2: + OUTI ; WRITE IT 16ts + DEC DE ; DECREMENT BYTE COUNT 6ts + LD A,D ; 4ts + OR E ; 4ts + JP NZ,WFXRW2 ; IF NOT ZERO, REPEAT LOOP 10ts = 40 + JP FXR_END ; CLEAN EXIT + +; +; COMMON COMPLETION CODE FOR ALL EXECUTION ROUTINES +; + +FXR_TO: + ; SAVE CURRENT MSR VALUE + ;LD C,(IY+CFG_MSR) ; SET C TO MSR PORT + ;IN A,(C) + LD (FST_MSR),A + ; SET ERROR AND GET OUT W/O PULSING TC + LD A,FRC_TOEXEC + LD (FST_RC),A + JR FXR_END2 + +FXR_ABORT: + ; SAVE CURRENT MSR VALUE + ;LD C,(IY+CFG_MSR) ; SET C TO MSR PORT + ;IN A,(C) + LD (FST_MSR),A + ; LET RESULTS PHASE HANDLE ERROR, DO NOT PULSE TC, COMMAND ALREADY TERMINATED + ;LD A,FRC_ABORT + ;LD (FST_RC),A + JR FXR_END2 + +FXR_END: + ; SAVE CURRENT MSR VALUE + ;LD C,(IY+CFG_MSR) ; SET C TO MSR PORT + ;IN A,(C) + LD (FST_MSR),A + ; DO NOT PULSE TC AT END OF FORMAT OR READID, THOSE COMMANDS SELF-TERMINATE + ;LD A,(FCP_CMD) + ;CP CMD_FMTTRK + ;JR Z,FXR_END2 + ;CP CMD_READID + ;JR Z,FXR_END2 + + CALL FC_PULSETC + +FXR_END2: +#IF 0 + LD (FXP_A),A + LD (FXP_BC),BC + LD (FXP_DE),DE + LD (FXP_HL),HL + + CALL FXR_DUMP +#ENDIF + + EI ; I/O FINISHED, INTS BACK ON + RET + +; +;=============================================================================== +; COMMAND PROCESSING STATUS DISPLAY +;=============================================================================== +; +; PRINT STATUS +; +FC_PRTFST: + PUSH AF + PUSH BC + PUSH DE + PUSH HL + LD A,(FST_RC) ; A GETS FST_RC + LD B,FSST_COUNT ; B GETS TABLE ENTRY COUNT + LD HL,FSST + LD DE,FSST_ENTSIZ ; TABLE ENTRY LENGTH + +FC_PRTFST0: ; START OF LOOP + LD C,(HL) + CP C + JP Z,FC_PRTFST1 ; FOUND CODE + + ADD HL,DE ; POINT TO NEXT ENTRY + DJNZ FC_PRTFST0 ; CHECK NEXT ENTRY TILL COUNT IS ZERO + + ; NO MATCHING ENTRY, PRINT THE HEX VALUE + CALL PC_SPACE + CALL PC_LBKT + CALL PRTHEXBYTE + CALL PC_RBKT + JP FC_PRTFSTX + +FC_PRTFST1: ; ENTRY FOUND, PRINT IT + CALL PC_SPACE + INC HL + LD E,(HL) + INC HL + LD D,(HL) + CALL PC_LBKT + CALL WRITESTR + CALL PC_RBKT + +FC_PRTFSTX: + POP HL + POP DE + POP BC + POP AF + RET +; +; PRINT COMMAND +; +FC_PRTCMD: + PUSH AF + PUSH BC + PUSH DE + PUSH HL + LD A,(FCP_CMD) ; A GETS THE COMMAND CODE + LD B,FCT_COUNT ; B GETS TABLE ENTRY COUNT + LD HL,FCT + LD DE,FCT_ENTSIZ ; TABLE ENTRY LENGTH + +FCPC_LOOP: ; START OF LOOP + LD C,(HL) + CP C + JP Z,FCPC_MATCH ; FOUND CODE + + ADD HL,DE ; POINT TO NEXT ENTRY + DJNZ FCPC_LOOP ; CHECK NEXT ENTRY TILL COUNT IS ZERO + + ; NO MATCHING ENTRY, PRINT THE HEX VALUE + CALL PC_SPACE + CALL PC_LBKT + CALL PRTHEXBYTE + CALL PC_RBKT + JP FCPC_EXIT + +FCPC_MATCH: ; ENTRY FOUND, PRINT IT + INC HL + LD E,(HL) + INC HL + LD D,(HL) + CALL WRITESTR + +FCPC_EXIT: + POP HL + POP DE + POP BC + POP AF + RET +; +; PRINT RESULTS +; +FC_PRTRESULTS: + ; IF TRACE IS SET, FORCE PRINT RESULTS + LD A,(FCD_TRACE) + OR A + JP NZ,FCPR2 + + ; IF RC=OK, GET OUT, NOTHING TO PRINT + LD A,(FST_RC) + CP FRC_OK + RET Z + + ; SPECIAL CASE, DON'T PRINT IF SENSEINT & INVCMD/DSK CHG/ABTERM + LD A,(FCP_CMD) + CP CMD_SENSEINT + JP NZ,FCPR2 + + LD A,(FST_RC) + CP FRC_INVCMD + JP Z,FCPR_EXIT + CP FRC_DSKCHG + JP Z,FCPR_EXIT + CP FRC_ABTERM + JP Z,FCPR_EXIT + JP FCPR_EXIT + +FCPR2: + CALL NEWLINE + + CALL FC_PRTCMD + CALL PC_COLON + + LD A,(FCP_BUFLEN) + LD DE,FCP_BUF + CALL PRTHEXBUF + + LD DE,STR_ARROW + CALL WRITESTR + + LD A,(FRB_LEN) + LD DE,FRB + CALL PRTHEXBUF + + LD A,(FDCBM) + AND _ZETA | _DIO3 + JR Z,FCPR3 + LD DE,STR_DSKCHG + CALL WRITESTR + LD C,(IY+CFG_DIR) + IN A,(C) + AND 01H + CALL PRTHEXBYTE + +FCPR3: + LD A,(FST_RC) + CALL FC_PRTFST + +FCPR_EXIT: + RET +; +; DUMP EXECUTION INFO +; +FXR_DUMP: + CALL NEWLINE + LD DE,STR_OP + CALL WRITESTR + CALL PC_COLON + LD DE,STR_MSR + CALL WRITESTR + LD A,(FST_MSR) + CALL PRTHEXBYTE + + LD DE,STR_A + CALL WRITESTR + LD A,(FXP_A) + CALL PRTHEXBYTE + + LD DE,STR_BC + CALL WRITESTR + LD BC,(FXP_BC) + LD A,B + CALL PRTHEXBYTE + LD A,C + CALL PRTHEXBYTE + + LD DE,STR_DE + CALL WRITESTR + LD BC,(FXP_DE) + LD A,B + CALL PRTHEXBYTE + LD A,C + CALL PRTHEXBYTE + + LD DE,STR_HL + CALL WRITESTR + LD BC,(FXP_HL) + LD A,B + CALL PRTHEXBYTE + LD A,C + CALL PRTHEXBYTE + + LD DE,STR_ITER + CALL WRITESTR + LD A,(FXP_ITER) + CALL PRTHEXBYTE + + LD DE,STR_TO + CALL WRITESTR + LD A,(FXP_TO) + CALL PRTHEXBYTE + + RET +; +; DOR BITS (3AH) +; +; DISKIO 250KBPS 500KBPS +; ------- ------- ------- +;D7 /DC/RDY 1 (N/A) 1 (N/A) +;D6 /REDWC (DENSITY) 0 (DD) 1 (HD) +;D5 P0* (PRECOMP BIT 0) 1 \ 0 \ +;D4 P1* (PRECOMP BIT 1) 0 (125NS) 1 (125NS) +;D3 P2* (PRECOMP BIT 2) 0 / 0 / +;D2 MINI (BITRATE) 1 (250KBPS) 0 (500KBPS) +;D1 /MOTOR (ACTIVE LO) 1 (OFF) 1 (OFF) +;D0 TC (TERMINAL COUNT) 0 (OFF) 0 (OFF) +; +; *NOTE: FOR 9229 DATA SEPARATOR USED IN DISKIO, VALUE OF PRECOMP BITS CHANGES WITH MINI +; IF MINI=1 (250KBPS), USE 001 FOR 125NS PRECOMP, IF MINI=0, USE 010 FOR 125NS PRECOMP +; +DORA_BR250 .EQU 10100110B ; 250KBPS +DORA_BR500 .EQU 11010010B ; 500KBPS +; +DORA_INIT .EQU DORA_BR250 +; +; ZETA/DISKIO3 250KBPS 500KBPS +; ------------ ------- ------- +;D7 /FDC_RST 1 (RUN) 1 (RUN) +;D6 DENSEL 1 (DD) 0 (HD) +;D5 P0 (PRECOMP BIT 0) 1 \ 1 \ +;D4 P1 (PRECOMP BIT 1) 0 (125NS) 0 (125NS) +;D3 P2 (PRECOMP BIT 2) 0 / 0 / +;D2 MINI (BITRATE) 1 (250KBPS) 0 (500KBPS) +;D1 MOTOR 0 (OFF) 0 (OFF) +;D0 TC 0 (OFF) 0 (OFF) +; +; MOTOR AND DENSITY SELECT ARE INVERTED ON ZETA/DISKIO3 +; +DORB_BR250 .EQU 11100100B ; 250KBPS +DORB_BR500 .EQU 10100000B ; 500KBPS +; +DORB_INIT .EQU DORB_BR250 +; +; *** DIDE/N8/ZETA2/RCWDC/SMZ80/DYNO/EPFDC/MBC *** +; +DORC_INIT .EQU 00001100B ; SOFT RESET INACTIVE, DMA ENABLED +; +DORC_BR250 .EQU DORC_INIT +DORC_BR500 .EQU DORC_INIT +; +; *** RCSMC *** +; +DORD_BR250 .EQU 10100000B ; 250KBPS +DORD_BR500 .EQU 11100000B ; 500KBPS +; +DORD_INIT .EQU DORB_BR250 +; +; DCR (ONLY APPLIES TO DIDE, N8, AND ZETA2) +; +DCR_BR250 .EQU 01H ; 250KBPS +DCR_BR500 .EQU 00H ; 500KBPS +; +;=============================================================================== +; GENERAL UTILITY ROUTINES +;=============================================================================== +; +; INITIALIZE BUFFER WITH FILLER BYTE +; HL = ADDRESS OF BUFFER +; DE = SIZE OF BUFFER +; B = FILLER BYTE VALUE +; +FILL_BUFFER: + LD A,B + LD (HL),A + INC HL + DEC DE + LD A,D + OR E + JP NZ,FILL_BUFFER + RET +; +; INITIALIZE BUFFER WITH PATTERN +; HL = ADDRESS OF BUFFER +; DE = SIZE OF BUFFER +; B = STARTING BYTE VALUE +; +PAT_BUFFER: + LD A,B + LD (HL),A + INC HL + DEC DE + INC B + LD A,D + OR E + JP NZ,PAT_BUFFER + RET +; +; PRINT A BLOCK OF MEMORY NICELY FORMATTED +; +DUMP_BUFFER: + CALL NEWLINE ; +BLKRD: + CALL PHL ; PRINT START LOCATION + LD C,16 ; SET FOR 16 LOCS + PUSH HL ; SAVE STARTING HL +NXTONE: + LD A,(HL) ; GET BYTE + CALL PRTHEXBYTE ; PRINT IT + CALL PC_SPACE ; +UPDH: + INC HL ; POINT NEXT + DEC C ; DEC. LOC COUNT + JR NZ,NXTONE ; IF LINE NOT DONE + ; NOW PRINT 'DECODED' DATA TO RIGHT OF DUMP +PCRLF: + CALL PC_SPACE ; SPACE IT + LD C,16 ; SET FOR 16 CHARS + POP HL ; GET BACK START +PCRLF0: + LD A,(HL) ; GET BYTE + AND 060H ; SEE IF A 'DOT' + LD A,(HL) ; O.K. TO GET + JR NZ,PDOT ; +DOT: + LD A,2EH ; LOAD A DOT +PDOT: + CALL COUT ; PRINT IT + INC HL ; + LD A,D ; + CP H ; + JR NZ,UPDH1 ; + LD A,E ; + CP L ; + JP Z,DUMP_END ; +; +;IF BLOCK NOT DUMPED, DO NEXT CHARACTER OR LINE +UPDH1: + DEC C ; DEC. CHAR COUNT + JR NZ,PCRLF0 ; DO NEXT +CONTD: + CALL NEWLINE ; + JP BLKRD ; + +DUMP_END: + RET ; +; +; UTILITY PROCS TO PRINT SINGLE CHARACTERS +; +PC_SPACE: + PUSH AF ; Store AF + LD A,' ' ; LOAD A "SPACE" + CALL COUT ; SCREEN IT + POP AF ; RESTORE AF + RET ; DONE + +PC_HYPHEN: + PUSH AF ; Store AF + LD A,'-' ; LOAD A COLON + CALL COUT ; SCREEN IT + POP AF ; RESTORE AF + RET ; DONE + +PC_COLON: + PUSH AF ; Store AF + LD A,':' ; LOAD A COLON + CALL COUT ; SCREEN IT + POP AF ; RESTORE AF + RET ; DONE + +PC_EQUAL: + PUSH AF ; Store AF + LD A,'=' ; LOAD A COLON + CALL COUT ; SCREEN IT + POP AF ; RESTORE AF + RET ; DONE + +PC_CR: + PUSH AF ; Store AF + LD A,CHR_CR ; LOAD A + CALL COUT ; SCREEN IT + POP AF ; RESTORE AF + RET ; DONE + +PC_LF: + PUSH AF ; Store AF + LD A,CHR_LF ; LOAD A + CALL COUT ; SCREEN IT + POP AF ; RESTORE AF + RET ; DONE + +PC_LBKT: + PUSH AF ; Store AF + LD A,'[' ; LOAD A COLON + CALL COUT ; SCREEN IT + POP AF ; RESTORE AF + RET ; DONE + +PC_RBKT: + PUSH AF ; Store AF + LD A,']' ; LOAD A COLON + CALL COUT ; SCREEN IT + POP AF ; RESTORE AF + RET ; DONE + +PC_LPAREN: + PUSH AF ; Store AF + LD A,'(' ; LOAD A COLON + CALL COUT ; SCREEN IT + POP AF ; RESTORE AF + RET ; DONE + + +PC_RPAREN: + PUSH AF ; Store AF + LD A,')' ; LOAD A COLON + CALL COUT ; SCREEN IT + POP AF ; RESTORE AF + RET ; DONE + +PC_BS: + PUSH AF ; Store AF + LD A,CHR_BS ; LOAD A + CALL COUT ; SCREEN IT + POP AF ; RESTORE AF + RET ; DONE + +NEWLINE_USED .DB 1 +NEWLINE: + CALL PC_CR + CALL PC_LF + LD A,1 + PUSH AF + LD (NEWLINE_USED),A + POP AF ; RESTORE AF + RET ; DONE + +COPYSTR: + LD A,(HL) + CP '$' + RET Z + LDI + JR COPYSTR + +; +;__COUT_________________________________________________________________________________________________________________________ +; +; PRINT CONTENTS OF A +;________________________________________________________________________________________________________________________________ +; +COUT: + PUSH BC ; + PUSH AF ; + PUSH HL ; + PUSH DE ; + + LD C,2 ; BDOS FUNC: CONSOLE WRITE CHAR + LD E,A ; CHARACTER TO E + CALL $0005 ; CALL BDOS + + 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 PRTHEXBYTE ; DO HEX OUT ROUTINE + LD A,L ; GET LOW BYTE + CALL PRTHEXBYTE ; HEX IT + CALL PC_SPACE ; + RET ; DONE +; +; GET A LINE BUFFER WITH 2 HEX CHARS, HL=ADDRESS OF LINE BUFFER +; EXIT WITH C = NUMBER OF CHARS, C=0 MEANS NOTHING ENTERED +; +GETLNHEX: + LD C,0 ; C = CHAR COUNT +GLH_LOOP: + CALL GETKEYUC + OR A + JP Z,GLH_LOOP + CP CHR_CR + JP Z,GLH_CHK + CP CHR_BS + JP Z,GLH_BS + CP '0' + JP M,GLH_LOOP + CP '9' + 1 + JP M,GLH_APPEND + CP 'A' + JP M,GLH_LOOP + CP 'F' + 1 + JP M,GLH_APPEND + JP GLH_LOOP +GLH_BS: + LD A,C + OR A + JP Z,GLH_LOOP + CALL PC_BS + CALL PC_SPACE + CALL PC_BS + DEC C + DEC HL + JP GLH_LOOP +GLH_APPEND: + LD B,A + LD A,C + CP 2 + JP P,GLH_LOOP + LD A,B + CALL COUT + LD (HL),A + INC C + INC HL + JP GLH_LOOP +GLH_CHK: + LD A,C + CP 2 + JP Z,GLH_EXIT + CP 0 + JP Z,GLH_EXIT + JP GLH_LOOP +GLH_EXIT: + RET +; +;__HEXIN__________________________________________________________________________________________________________________________ +; +; GET ONE BYTE OF HEX DATA FROM BUFFER IN HL, RETURN IN A +;________________________________________________________________________________________________________________________________ +; +HEXIN: + PUSH BC ; SAVE BC REGS. + CALL NIBL ; DO A NIBBLE + RLC A ; MOVE FIRST BYTE UPPER NIBBLE + RLC A ; + RLC A ; + RLC A ; + LD B,A ; SAVE ROTATED BYTE + CALL NIBL ; DO NEXT NIBBLE + ADD A,B ; COMBINE NIBBLES IN ACC. + POP BC ; RESTORE BC + RET ; DONE +NIBL: + LD A,(HL) ; GET K.B. DATA + INC HL ; INC KB POINTER + CP 40H ; TEST FOR ALPHA + JR NC,ALPH ; + AND 0FH ; GET THE BITS + RET ; +ALPH: + AND 0FH ; GET THE BITS + ADD A,09H ; MAKE IT HEX A-F + RET ; +; +; COPY A $ TERMINATED STRING FROM ADDRESS IN DE TO ADDRESS IN HL +; DE = ADDRESS OF SOURCE STRING +; LH = ADDRESS OF TARGET LOCATION +; +STRCPY: + LD A,(DE) + CP '$' + JP Z,STRCPYX + LD (HL),A + INC HL + INC DE + JP STRCPY + +STRCPYX: + RET +; +; GET A HEX BYTE VALUE FROM THE USER +; WILL UPDATE STORED VALUE, EMPTY RESPONSE LEAVES VALUE ALONE +; DE = ADDRESS OF PROMPT STRING +; HL = ADDRESS OF VALUE +; BC = HI/BO ALLOWABLE RANGE OF VALID VALUES +; +GHB_PROMPTP .DW 0 +GHB_RANGE .DW 0 +GHB_VALUEP .DW 0 +GHB_CLEAR .DB " \b\b$" + +GETHEXBYTE: + LD BC,000FFH +GETHEXBYTERNG: + LD (GHB_PROMPTP),DE + LD (GHB_RANGE),BC + LD (GHB_VALUEP),HL + CALL NEWLINE +GHB_LOOP: + CALL PC_CR + LD DE,STR_ENTER + CALL WRITESTR + CALL PC_SPACE + LD DE,(GHB_PROMPTP) + CALL WRITESTR + CALL PC_SPACE + LD BC,(GHB_RANGE) + CALL PC_LBKT + LD A,B + CALL PRTHEXBYTE + CALL PC_HYPHEN + LD A,C + CALL PRTHEXBYTE + CALL PC_RBKT + CALL PC_SPACE + CALL PC_LPAREN + LD HL,(GHB_VALUEP) + LD A,(HL) + CALL PRTHEXBYTE + CALL PC_RPAREN + CALL PC_COLON + CALL PC_SPACE + LD DE,GHB_CLEAR + CALL WRITESTR + LD HL,KEYBUF + CALL GETLNHEX + LD A,C + CP 0 ; RETAIN CURRENT VALUE + JP Z,GHB_EXIT + CP 2 ; INPUT LOOKS OK, UPDATE IT + JP Z,GHB_CHK + JP GHB_LOOP ; ANYTHING ELSE, BAD INPUT, DO OVER +GHB_CHK: + LD HL,KEYBUF + CALL HEXIN + LD BC,(GHB_RANGE) + CP B + JP C,GHB_LOOP + CP C + JP Z,GHB_OK + JP NC,GHB_LOOP +GHB_OK: + LD HL,(GHB_VALUEP) + LD (HL),A +GHB_EXIT: + RET + +; +; PRINT THE HEX BYTE VALUE IN A +; +HEXSTRBUF .TEXT "XX$" +; +PRTHEXBYTE: + PUSH AF + PUSH DE + LD DE,HEXSTRBUF + CALL HEXSTRBYTE + LD A,'$' + LD (DE),A + LD DE,HEXSTRBUF + CALL WRITESTR + POP DE + POP AF + RET +; +; PRINT THE HEX WORD VALUE IN BC +; +PRTHEXWORD: + PUSH AF + LD A,B + CALL PRTHEXBYTE + LD A,C + CALL PRTHEXBYTE + POP AF + RET +; +; CONVERT VALUE IN A TO A 2 CHARACTER HEX STRING AT DE +; +HEXCHR .TEXT "0123456789ABCDEF" +; +HEXSTRBYTE: + PUSH BC + PUSH HL + PUSH AF + LD BC,0 + RRA + RRA + RRA + RRA + AND 0FH + LD C,A + LD HL,HEXCHR + ADD HL,BC + LD A,(HL) + LD (DE),A + INC DE + POP AF + PUSH AF + LD BC,0 + AND 0FH + LD C,A + LD HL,HEXCHR + ADD HL,BC + LD A,(HL) + LD (DE),A + INC DE + POP AF + POP HL + POP BC + RET +; +; CONVERT VALUE IN BC TO A 4 CHARACTER HEX STRING AT DE +; +HEXSTRWORD: + LD A,B + CALL HEXSTRBYTE + LD A,C + CALL HEXSTRBYTE + RET + +; +; PRINT A BYTE BUFFER IN HEX POINTED TO BY DE +; REGISTER A HAS SIZE OF BUFFER +; +PRTHEXBUF: + CP 0 ; EMPTY BUFFER? + JP Z,PRTHEXBUF2 + + LD B,A +PRTHEXBUF1: + CALL PC_SPACE + LD A,(DE) + CALL PRTHEXBYTE + INC DE + DJNZ PRTHEXBUF1 + JP PRTHEXBUFX + +PRTHEXBUF2: + CALL PC_SPACE + LD DE,STR_EMPTY + CALL WRITESTR + +PRTHEXBUFX: + RET +; +; JP TO ADDRESS IN HL IN HEX POINTED TO BY DE +; MOSTLY USEFUL TO PERFORM AN INDIRECT CALL LIKE: +; LD HL,xxxx +; CALL JPHL +; +JPHL JP (HL) +; +; GENERATE A RANDOM BYTE +; +; RETURNS PSEUDO RANDOM 8 BIT NUMBER IN A. ONLY AFFECTS A. +; (SEED) IS THE BYTE FROM WHICH THE NUMBER IS GENERATED AND MUST BE +; INITIALIZED TO A NON ZERO VALUE OR THIS FUNCTION WILL ALWAYS RETURN +; ZERO. +; +RB_SEED .DB 1 ; RNDBYTE SEED (MUST NOT BE ZERO) +; +RNDBYTE: + LD A,(RB_SEED) ; GET SEED + AND 0B8H ; MASK NON-FEEDBACK BITS + SCF ; SET CARRY + JP PO,RB_NC ; SKIP CLEAR IF ODD + CCF ; COMPLEMENT CARRY (CLEAR IT) +RB_NC LD A,(RB_SEED) ; GET SEED BACK + RLA ; ROTATE CARRY INTO BYTE + LD (RB_SEED),A ; SAVE BACK FOR NEXT + RET ; DONE +; +; ADD HL,A +; +; A REGISTER IS DESTROYED! +; +ADDHLA: + ADD A,L + LD L,A + RET NC + INC H + RET +; +; OUTPUT A '$' TERMINATED STRING +; +WRITESTR: + PUSH AF + PUSH BC + PUSH DE + PUSH HL + LD C,09H + CALL 0005H + POP HL + POP DE + POP BC + POP AF + RET +; +; READ A KEY, RETURN VALUE IN A +; +GETKEY: + PUSH BC + PUSH DE + PUSH HL + LD C,06H + LD E,0FFH + CALL 0005H + POP HL + POP DE + POP BC + + CP 03 + JP Z,EXIT + + RET + +GETKEYUC: + CALL GETKEY + CP 'a' + JP M,GETKEYUC_EXIT + CP 'z' + 1 + JP M,GETKEYUC_FIX + JP GETKEYUC_EXIT +GETKEYUC_FIX: + AND 11011111B +GETKEYUC_EXIT: + RET +; +; DELAY 16US (CPU SPEED COMPENSATED) INCUDING CALL/RET INVOCATION +; REGISTER A AND FLAGS DESTROYED +; NO COMPENSATION FOR Z180 MEMORY WAIT STATES +; THERE IS AN OVERHEAD OF 3TS PER INVOCATION +; IMPACT OF OVERHEAD DIMINISHES AS CPU SPEED INCREASES +; +; CPU SCALER (CPUSCL) = (CPUHMZ - 2) FOR 16US + 3TS DELAY +; NOTE: CPUSCL MUST BE >= 1! +; +; EXAMPLE: 8MHZ CPU (DELAY GOAL IS 16US) +; LOOP = ((6 * 16) - 5) = 91TS +; TOTAL COST = (91 + 40) = 131TS +; ACTUAL DELAY = (131 / 8) = 16.375US +; + ; --- TOTAL COST = (LOOP COST + 40) TS -----------------+ +DELAY: ; 17TS (FROM INVOKING CALL) | + LD A,(CPUSCL) ; 13TS | +; | +DELAY1: ; | + ; --- LOOP = ((CPUSCL * 16) - 5) TS ------------+ | + DEC A ; 4TS | | +#IFDEF CPU_Z180 ; | | + OR A ; +4TS FOR Z180 | | +#ENDIF ; | | + JR NZ,DELAY1 ; 12TS (NZ) / 7TS (Z) | | + ; ----------------------------------------------+ | +; | + RET ; 10TS (RETURN) | + ;-------------------------------------------------------+ +; +; DELAY 16US * DE (CPU SPEED COMPENSATED) +; REGISTER DE, A, AND FLAGS DESTROYED +; NO COMPENSATION FOR Z180 MEMORY WAIT STATES +; THERE IS A 27TS OVERHEAD FOR CALL/RET PER INVOCATION +; IMPACT OF OVERHEAD DIMINISHES AS DE AND/OR CPU SPEED INCREASES +; +; CPU SCALER (CPUSCL) = (CPUHMZ - 2) FOR 16US OUTER LOOP COST +; NOTE: CPUSCL MUST BE > 0! +; +; EXAMPLE: 8MHZ CPU, DE=6250 (DELAY GOAL IS .1 SEC OR 100,000US) +; INNER LOOP = ((16 * 6) - 5) = 91TS +; OUTER LOOP = ((91 + 37) * 6250) = 800,000TS +; ACTUAL DELAY = ((800,000 + 27) / 8) = 100,003US +; + ; --- TOTAL COST = (OUTER LOOP + 27) TS ------------------------+ +VDELAY: ; 17TS (FROM INVOKING CALL) | +; | + ; --- OUTER LOOP = ((INNER LOOP + 37) * DE) TS ---------+ | + LD A,(CPUSCL) ; 13TS | | +; | | +VDELAY1: ; | | + ; --- INNER LOOP = ((CPUSCL * 16) - 5) TS ------+ | | +#IFDEF CPU_Z180 ; | | | + OR A ; +4TS FOR Z180 | | | +#ENDIF ; | | | + DEC A ; 4TS | | | + JR NZ,VDELAY1 ; 12TS (NZ) / 7TS (Z) | | | + ; ----------------------------------------------+ | | +; | | + DEC DE ; 6TS | | +#IFDEF CPU_Z180 ; | | + OR A ; +4TS FOR Z180 | | +#ENDIF ; | | + LD A,D ; 4TS | | + OR E ; 4TS | | + JP NZ,VDELAY ; 10TS | | + ;-------------------------------------------------------+ | +; | + RET ; 10TS (FINAL RETURN) | + ;---------------------------------------------------------------+ +; +; DELAY ABOUT 0.5 SECONDS +; 500000US / 16US = 31250 +; +LDELAY: + PUSH AF + PUSH DE + LD DE,31250 + CALL VDELAY + POP DE + POP AF + RET + +; +; HANDLE USER INPUT FOR A MENU BASED ON TABLE OF MENU DATA. DISPATCH MENU FUNCTIONS. +; ON INPUT, HL=ADDRESS OF MENU TABLE, B=COUNT OF MENU ENTRIES +; + .module MenuInfo +MenuInfo ; TRANSIENT STORAGE FOR CURRENT MENU +_DrawProc .dw 0 ; ADDRESS OF MENU DRAW ROUTINE +_TableAdr .dw 0 ; ADDRESS OF MENU TABLE DATA +_EntryInfo .dw 0 ; ENTRY COUNT / ENTRY SIZE +_Size .equ $ - MenuInfo +; +RUNMENU: + push hl ; save address of menu info data + +_Run: + pop hl ; restore/resave menu init address + push hl + + ld de,MenuInfo + ld bc,_Size + ldir + + ld hl,(_DrawProc) + call JPHL ; call menu draw routine + +_GetKey: + call GETKEYUC ; GET USER KEYPRESS + ld hl,(_TableAdr) + ld bc,(_EntryInfo) ; B=COUNT, C=ENTRY SIZE + ld d,0 ; put entry size in de + ld e,c ; " + + ; a=key pressed, hl=menu table address, b=entry count, de=entry size +_Loop: + ld c,(hl) + cp c + jp z,_Match ; found code + + add hl,de ; point to next entry + djnz _Loop ; check next entry till count is zero + jp _GetKey ; keep trying + +_Match: + inc hl ; load string + ld e,(hl) + inc hl + ld d,(hl) + call WRITESTR ; display it + + inc hl ; load code address + ld e,(hl) + inc hl + ld d,(hl) + + ld a,d ; check for zero + or e + jp z,_Exit ; zero means exit + + ex de,hl + call JPHL ; indirect call to menu function + jp _Run + +_Exit: + pop hl + ret +; +; CONTROL CHARACTERS +; +CHR_CR .EQU 0DH +CHR_LF .EQU 0AH +CHR_BS .EQU 08H +CHR_ESC .EQU 1BH +; +STR_DRIVERESET .TEXT "RESET DRIVE...$" +STR_EXECUTE .TEXT "EXECUTION$" +STR_OP .TEXT "OPERATION$" +STR_FORMAT .TEXT "FORMAT$" +STR_SENDCMD .TEXT "SEND COMMAND$" +STR_GETRESULTS .TEXT "GET RESULTS$" +STR_SEEKWAIT .TEXT "SEEK WAIT$" +STR_DOR .TEXT "SET DOR$" +STR_PROGRESS .TEXT "PROGRESS$" +STR_MISMATCH .TEXT "DATA MISMATCH AT $" +STR_RESET .TEXT "FDCRESET...$" +STR_NOTIMPL .TEXT "*** NOT IMPLEMENTED ***$" +STR_NORESP .TEXT "*** DRIVE NOT RESPONDING ***$" +STR_EOD .TEXT "$" +STR_EMPTY .TEXT "$" +STR_TIMEOUT .TEXT "$" +STR_ARROW .TEXT " -->$" +STR_ENTER .TEXT "ENTER$" +STR_ON .TEXT "ON $" +STR_OFF .TEXT "OFF$" +STR_DRV720 .TEXT "720KB $" +STR_DRV144 .TEXT "1.44MB$" +STR_MODEPOLL .TEXT "POLLING $" +STR_MODEINT .TEXT "INTERRUPT $" +STR_MODEDMA .TEXT "DMA $" +STR_CC0 .TEXT " CC0=$" +STR_CC1 .TEXT " CC1=$" +STR_CC2 .TEXT " CC2=$" +STR_N .TEXT " N=$" +STR_SC .TEXT " SC=$" +STR_GPL .TEXT " GPL=$" +STR_D .TEXT " D=$" +STR_ST0 .TEXT " ST0=$" +STR_ST1 .TEXT " ST1=$" +STR_ST2 .TEXT " ST2=$" +STR_CYL .TEXT " CYL=$" +STR_UNIT .TEXT " UNIT=$" +STR_HEAD .TEXT " HD=$" +STR_REC .TEXT " SEC=$" +STR_NUM .TEXT " NUM=$" +STR_DENS .TEXT " DENS=$" +STR_EOTSEC .TEXT " EOTSEC=$" +STR_GAP .TEXT " GAP=$" +STR_DTL .TEXT " DTL=$" +STR_SN .TEXT " SN=$" +STR_NCN .TEXT " NCN=$" +STR_PCN .TEXT " PCN=$" +STR_MSR .TEXT " MSR=$" +STR_A .TEXT " A=$" +STR_BC .TEXT " BC=$" +STR_DE .TEXT " DE=$" +STR_HL .TEXT " HL=$" +STR_TO .TEXT " TO=$" +STR_ITER .TEXT " ITER=$" +STR_DSKCHG .TEXT " DC=$" +; +KEYBUFLEN .EQU 80 +KEYBUF .FILL KEYBUFLEN,' ' +; +STACKSAV .DW 0 +STACKSIZ .EQU 40H ; WE ARE A STACK PIG + .FILL STACKSIZ,0 +STACK .EQU $ +; +BUFFER .EQU 4000H +VFYBUF .EQU 5000H +BUFSIZ .EQU 0200H + .END diff --git a/Source/Apps/FDU/fdu.doc b/Source/Apps/FDU/fdu.doc new file mode 100644 index 00000000..13c14708 --- /dev/null +++ b/Source/Apps/FDU/fdu.doc @@ -0,0 +1,535 @@ +================================================================ +Floppy Disk Utility (FDU) v5.3 for RetroBrew Computers +Disk IO / Zeta / Dual-IDE / N8 / RCBus / SmallZ80 / Dyno +================================================================ + +Updated January 5, 2020 +by Wayne Warthen (wwarthen@gmail.com) + +Application to test the hardware functionality of the Floppy +Disk Controller (FDC) on the ECB DISK I/O, DISK I/O V3, ZETA +SBC, Dual IDE w/ Floppy, or N8 board. + +The intent is to provide a testbed that allows direct testing +of all possible media types and modes of access. The +application supports read, write, and format by sector, track, +and disk as well as a random read/write test. + +The application supports access modes of polling, interrupt, +INT/WAIT, and DRQ/WAIT. At present, it supports 3.5" media at +DD (720KB) and HD (1.44MB) capacities. It also now supports +5.25" media (720KB and 1.2MB) and 8" media (1.11MB) as well. +Additional media will be added when I have time and access to +required hardware. Not all modes are supported on all +platforms and some modes are experimental in all cases. + +In many ways this application is merely reinventing the wheel +and performs functionality similar to existing applications, +but I have not seen any other applications for RetroBrew +Computers hardware that provide this range of functionality. + +While the application is now almost entirely new code, I would +like to acknowledge that much was derived from the previous +work of Andrew Lynch and Dan Werner. I also want to credit +Sergio Gimenez with testing the 5.25" drive support and Jim +Harre with testing the 8" drive support. Support for Zeta 2 +comes from Sergey Kiselev. Thanks! + +General Usage +------------- + +In general, usage is self explanatory. At invocation, you +must select the floppy disk controller (FDC) that you are +using. Subsequently, the main menu allows you to set the +unit, media, and mode to test. These settings MUST match your +situation. Read, write, format, and verify functions are +provided. A sub-menu will allow you to choose sector, track, +disk, or random tests. + +The verify function requires a little explanation. It will +take the contents of the current in-memory disk buffer, save +it, and compare it to the selected sectors. So, you must +ensure that the sectors to be verified already have been +written with the same pattern as the buffer contains. I +typically init the buffer to a pattern, write the pattern to +the entire disk, then verify the entire disk. + +Another submenu is provided for FDC commands. This sub-menu +allows you to send low-level commands directly to FDC. You +*must* know what you are doing to use this sub-menu. For +example, in order to read a sector using this sub-menu, you +will need to perform specify, seek, sense int, and read +commands specifying correct values (nothing is value checked +in this menu). + +Required Hardware/BIOS +---------------------- + +Of course, the starting point is to have a supported hardware +configuration. The following Z80 / Z180 based CPU boards are +supported: + + - SBC V1/2 + - Zeta + - Zeta 2 + - N8 + - Mark IV + - RCBus + - SmallZ80 + - Dyno + - MBC + +You must be using either a RomWBW or UBA based OS version. + +You must have one of the following floppy disk controllers: + + - Disk IO ECB Board FDC + - Disk IO 3 ECB Board FDC + - Dual-IDE ECB Board FDC + - Zeta SBC onboard FDC + - Zeta 2 SBC onboard FDC + - N8 SBC onboard FDC + - RCBus Scott Baker SMC-based Floppy Module + - RCBus Scott Baker WDC-based Floppy Module + - SmallZ80 FDC + - Dyno FDC + - MBC FDC + +Finally, you will need a floppy drive connected via an +appropriate cable: + +Disk IO - no twist in cable, drive unit 0/1 must be selected by jumper on drive +DISK IO 3, Zeta, Zeta 2, RCBus, Dyno - cable with twist, unit 0 after twist, unit 1 before twist +DIDE, N8, Mark IV, SmallZ80 - cable with twist, unit 0 before twist, unit 1 after twist + +Note that FDU does not utilize your systems ROM or OS to +access the floppy system. FDU interacts directly with +hardware. Upon exit, you may need to reset your OS to get the +floppy system back into a state that is expected. + +The Disk I/O should be jumpered as follows: + +J1: depends on use of interrupt modes (see interrupt modes below) +J2: pins 1-2, & 3-4 jumpered +J3: hardware dependent timing for DMA mode (see DMA modes below) +J4: pins 2-3 jumpered +J5: off +J6: pins 2-3 jumpered +J7: pins 2-3 jumpered +J8: off +J9: off +J10: off +J11: off +J12: off + +Note that J1 can be left on even when not using interrupt +modes. As long as the BIOS is OK with it, that is fine. Note +also that J3 is only relevant for DMA modes, but also can be +left in place when using other modes. + +The Disk I/O 3 board should be jumpered at the default settings: + +JP2: 3-4 +JP3: 1-2 for int mode support, otherwise no jumper +JP4: 1-2, 3-4 +JP5: 1-2 +JP6: 1-2 +JP7: 1-2, 3-4 + +Zeta & Zeta 2 do not have any relevant jumper settings. The +hardwired I/O ranges are assumed in the code. + +The Dual-IDE board should be jumpered as follows: + +K3 (DT/R or /RD): /RD +P5 (bd ID): 1-2, 3-4 (for $20-$3F port range) + +There are no specific N8 jumper settings, but the default +I/O range starting at $80 is assumed in the published code. + +The RCBus Scott Baker SMC-based floppy module should be jumpered +for I/O base address 0x50 (SV1: 11-12), JP1 (TS) shorted, +JP2 (/FAULT) shorted, JP3 (MINI): 2-3, JP4 (/DC/RDY): 2-3. + +The RCBus Scott Baker WDC-based floppy module should be jumpered +for I/O base address 0x50 (SV1: 11-12), JP1 (/DACK): 1-2, +JP2 (TC): 2-3. + +The RCBus FDC by Alan Cox (Etched Pixels) needs to be strapped +for base I/O address 0x48. + +SmallZ80 does not have any relevant jumper settings. The +hardwired I/O ranges are assumed in the code. + +Dyno does not have any relevant jumper settings. The +hardwired I/O ranges are assumed in the code. + +The MBC FDC is expected to be strapped to use neither INT nor NMI. It +is also not expected to use DMA. + +Modes of Operation +------------------ + +You can select the following test modes. Please refer to the +chart that follows to determine which modes should work with +combinations of Z80 CPU speed and media format. + +WARNING: In general, only the polling mode is considered fully +reliable. The other modes are basically experimental and +should only be used if you know exactly what you are doing. + +Polling: Traditional polled input/output. Works well and very +reliable with robust timeouts and good error recovery. Also, +the slowest performance which precludes it from being used +with 1.44MB floppy on a 4MHz Z80. This is definitely the mode +you want to get working before any others. It does not require +J1 (interrupt enable) on DISK I/O and does not care about the +setting of J3. + +Interrupt: Relies on FDC interrupts to determine when a byte +is ready to be read/written. It does *not* implement a +timeout during disk operations. For example, if there is no +disk in the drive, this mode will just hang until a disk is +inserted. This mode *requires* that the host has interrupts +active using interrupt mode 1 (IM1) and interrupts attached to +the FDC controller. The BIOS must be configured to handle +these interrupts safely. + +Fast Interrupt: Same as above, but sacrifices additional +reliability for faster operation. This mode will allow a +1.44MB floppy to work with a 4MHz Z80 CPU. However, if any +errors occur (even a transient read error which is not +unusual), this mode will hang. The same FDC interrupt +requirements as above are required. + +INT/WAIT: Same as Fast Interrupt, but uses CPU wait instead of +actual interrupt. This mode is exclusive to the original Disk +IO board. It is subject to all the same issues as Fast +Interrupt, but does not need J1 shorted. J3 is irrelevant. + +DRQ/WAIT: Uses pseudo DMA to handle input/output. Does not +require that interrupts (J1) be enabled on the DISK I/O. +However, it is subject to all of the same reliability issues +as "Fast Interrupt". This mode is exclusive to the original +Disk IO board. At present, the mode is *not* implemented! + +The chart below attempts to describe the combinations that +work for me. By far, the most reliable mode is Polling, but +it requires 8MHz CPU for HD disks. + +DRQ/WAIT --------------------------------+ +INT/WAIT -----------------------------+ | +Fast Interrupt --------------------+ | | +Interrupt ----------------------+ | | | +Polling ---------------------+ | | | | + | | | | | +CPU Speed --------------+ | | | | | + | | | | | | + | | | | | | + +3.5" DD (720K) ------ 4MHz Y Y Y Y X + 8MHz+ Y Y Y Y X + +3.5" HD (1.44M) ----- 4MHz N N Y Y X + 8MHz+ Y Y Y Y X + +5.25" DD (360K) ----- 4MHz Y Y Y Y X + 8MHz+ Y Y Y Y X + +5.25" HD (1.2M) ----- 4MHz N N Y Y X + 8MHz+ Y Y Y Y X + +8" DD (1.11M) ------- 4MHz N N Y Y X + 8MHz+ Y Y Y Y X + +Y = Yes, works +N = No, does not work +X = Experimental, probably won't work + +Tracing +------- + +Command/result activity to/from the FDC will be written out if +the trace setting is changed from '00' to '01' in setup. +Additionally, if a command failure is detected on any command, +that specific comand and results are written regardless of the +trace setting. + +The format of the line written is: +: --> [] + +For example, this is the output of a normal read operation: +READ: 46 01 00 00 01 02 09 1B FF --> 01 00 00 00 00 02 02 [OK] + +Please refer to the i8272 data sheet for information on the +command and result bytes. + +Note that the sense interrupt command can return a non-OK +result. This is completely normal in some cases. It is +necessary to "poll" the drive for seek status using sense +interrupt. If there is nothing to report, then the result +will be INVALID COMMAND. Additionally, during a recalibrate +operation, it may be necessary to issue the command twice +because the command will only step the drive 77 times looking +for track 0, but the head may be up to 80 tracks away. In +this case, the first recalibrate fails, but the second should +succeed. Here is what this would look like if trace is turned +on: + +RECALIBRATE: 07 01 --> [OK] +SENSE INTERRUPT: 08 --> 80 [INVALID COMMAND] + ... + ... + ... +SENSE INTERRUPT: 08 --> 80 [INVALID COMMAND] +SENSE INTERRUPT: 08 --> 71 00 [ABNORMAL TERMINATION] +RECALIBRATE: 07 01 --> [OK] +SENSE INTERRUPT: 08 --> 21 00 [OK] + +Another example is when the FDC has just been reset. In this +case, you will see up to 4 disk change errors. Again these +are not a real problem and to be expected. + +When tracing is turned off, the application tries to be +intelligent about error reporting. The specific errors from +sense interrupt documented above will be suppressed because +they are not a real problem. All other errors will be +displayed. + +Error Handling +-------------- + +There is no automated error retry logic. This is very +intentional since the point is to expose the controller and +drive activity. Any error detected will result in a prompt to +abort, retry, or continue. Note that some number of errors is +considered normal for this technology. An occasional error +would not necessarily be considered a problem. + +CPU Speed +--------- + +Starting with v5.0, the application adjusts it's timing loops +to the actual system CPU speed by querying the BIOS for the +current CPU speed. + +Interleave +---------- + +The format command now allows the specification of a sector +interleave. It is almost always the case that the optimal +interleave will be 2 (meaning 2:1). + +360K Media +---------- + +The 360K media definition should work well for true 360K +drives. However, it will generally not work with 1.2M +drives. This is because these drives spin at 360RPM instead +of the 300RPM speed of true 360K drives. Additionally, 1.2M +drives are 80 tracks and 360K drives are 40 tracks and, so +far, there is no mechanism in FD to "double step" as a way to +use 40 track media in 80 track drives. + +With this said, it is possible to configure some 1.2M 5.25" +drives to automatically spin down to 300RPM based on a density +select signal (DENSEL). This signal is asserted by FD for +360K media, so IF you have configured your drive to react to +this signal correctly, you will be able to use the 360K media +defintion. Most 1.2M 5.25" drives are NOT configured this way +by default. TEAC drives are generally easy to modify and have +been tested by the author and do work in this manner. Note +that this does not address the issue of double stepping above; +you will just be using the first 40 of 80 tracks. + +Support +------- + +I am happy to answer questions as fast and well as I am able. +Best contact is wwarthen@gmail.com or post something on the +RetroBrew Computers Forum +https://www.retrobrewcomputers.org/forum/. + +Changes +------- + +WW 8/12/2011 + +Removed call to pulse TC in the FDC initialization after +determining that it periodically caused the FDC to write bad +sectors. I am mystified by this, but definitely found it to +be true. Will revisit at some point -- probably a timing +issue between puslsing TC and whatever happens next. + +Non-DMA mode was being set incorrectly for FAST-DMA mode. It +was set for non-DMA even though we were doing DMA. It is +interesting that it worked fine anyway. Fixed it anyway. + +DIO_SETMEDIA was not clearing DCD_DSKRDY as it should. Fixed. + +WW 8/26/2011: v1.1 + +Added support for Zeta. Note that INT/WAIT and DRQ/WAIT are +not available on Zeta. Note that Zeta provides the ability to +perform a reset of the FDC independent of a full CPU reset. +This is VERY useful and the FDC is reset anytime a drive reset +is required. + +Added INT/WAIT support. + +WW 8/28/2011: V1.2 + +All changes in this version are Zeta specific. Fixed FDC +reset logic and motor status display for Zeta (code from +Sergey). + +Modified Zeta disk change display to include it in the command +output line. This makes more sense because a command must be +issued to select the desired drive first. You can use the +SENSE INT command id you want to check the disk change value +at any time. It will also be displayed with any other command +output display. + +WW 9/1/2011: V1.3 + +Added CPUFREQ configuration setting to tune delays based on +cpu speed. The build app is set for 8MHz which also seems to +work well for 4MHz CPU's. Faster CPU speeds will probably +require tuning this setting. + +WW 9/5/2011: V1.4 + +Changed the polling execution routines to utilize CPUFREQ +variable to optimize timeout counter. Most importantly, this +should allow the use of faster CPUs (like 20MHz). + +WW 9/19/2011: V1.5 + +Zeta changes only. Added a call to FDC RESET after any +command failure. This solves an issue where the drive remains +selected if a command error occurs. Also added FDC RESET to +FDC CONTROL menu. + +WW 10/7/2011: V2.0 + +Added support for DIDE. Only supports polling IO and it does +not appear any other modes are possible given the hardware +constraints. + +WW 10/13/2011: V2.1 + +Modified to support N8. N8 is essentially identical to Dual +IDE. The only real change is the IO addresses. In theory, I +should be able to support true DMA on N8 and will work on that. + +WW 10/20/2011: v2.2 + +I had some problems with the results being read were sometimes +missing a byte. Fixed this by taking a more strict approach +to watching the MSR for the exact bits that are expected. + +WW 10/22/2011: V2.3 + +After spending a few days trying to track down an intermittent +data corruption issue with my Dual IDE board, I added a verify +function. This helped me isolate the problem very nicely +(turned out to be interference from the bus monitor). + +WW 11/25/2011: V2.4 + +Preliminary support for DISKIO V3. Basically just assumed +that it operates just like the Zeta. Needs to be verified +with real hardware as soon as I can. + +WW 1/9/2012: V2.5 + +Modified program termination to use CP/M reset call so that a +warm start is done and all drives are logged out. This is +important because media may have been formatted during the +program execution. + +WW 2/6/2012: v2.6 + +Added support for 5.25" drives as tested by Sergio. + +WW 4/5/2012: v2.7 + +Added support for 8" drives as tested by Jim Harre. + +WW 4/6/2012: v2.7a + +Fixed issue with media selection menu to remove duplicate +entries. + +WW 4/8/2012: v2.7b + +Corrected the handling of the density select signal. + +WW 5/22/2012: v2.8 + +Added new media definitions (5.25", 320K). + +WW 6/1/2012: v2.9 + +Added interleave capability on format. + +WW 6/5/2012: v3.0 + +Documentation cleanup. + +WW 7/1/2012: v3.1 + +Modified head load time (HLT) for 8" media based on YD-180 +spec. Now set to 50ms. + +WW 6/17/2013: v3.2 + +Cleaned up SRT, HLT, and HUT values. + +SK 2/10/2015: v3.3 + +Added Zeta SBC v2 support (Sergey Kiselev) + +WW 3/25/2015: v4.0 + +Renamed from FDTST --> FD + +WW 9/2/2017: v5.0 + +Renamed from FD to FDU. +Added runtime selection of FDC hardware. +Added runtime timing adjustment. + +WW 12/16/2017: v5.1 + +Improved polling version of read/write to fix occasional overrun errors. + +WW 1/8/2018: v5.2 + +Added support for RCBus hardware: + - Scott Baker SMC 9266 FDC module + - Scott Baker WDC 37C65 FDC module + +WW 9/5/2018: v5.3 + - Removed use of pulsing TC to end R/W operations after one sector and + instead set EOT = R (sector number) so that after desired sector is + read, R/W stops with end of cylinder error which is a documented + method for controling number of sectors R/W. This specific termination + condition is no longer considered an error, but a successful end of + operation. + - Added support for SmallZ80 + +WW 1/5/2020: v5.4 + - Added support for Dyno (based on work by Steve Garcia) + +WW 4/29/2020: v5.5 + - Added support for Etched Pixels FDC + +WW 12/12/2020: v5.6 + - Updated SmallZ80 support for new I/O map + +WW 3/24/2021: v5.7 + - Added support for a few single-sided formats + +WW 7/26/2021: v5.8 + - Added support for MBC FDC diff --git a/Source/Apps/Makefile b/Source/Apps/Makefile index 49db6949..03bacb2c 100644 --- a/Source/Apps/Makefile +++ b/Source/Apps/Makefile @@ -1,14 +1,9 @@ -OBJECTS = SysGen.com Survey.com \ - SysCopy.com Assign.com Format.com Talk.com Mode.com RTC.com \ - Timer.com IntTest.com -OTHERS = *.hex *.com -SUBDIRS = XM FDU FAT Tune +OBJECTS = sysgen.com syscopy.com assign.com format.com talk.com \ + mode.com rtc.com timer.com rtchb.com +SUBDIRS = XM FDU FAT Tune Test ZMP ZMD Dev VGM cpuspd Survey DEST = ../../Binary/Apps TOOLS =../../Tools include $(TOOLS)/Makefile.inc USETASM = 1 - -Survey.com: USETASM=0 - diff --git a/Source/Apps/Mode.asm b/Source/Apps/Mode.asm deleted file mode 100644 index 957bba69..00000000 --- a/Source/Apps/Mode.asm +++ /dev/null @@ -1,1040 +0,0 @@ -;=============================================================================== -; MODE - Display and/or modify device configuration -; -;=============================================================================== -; -; Author: Wayne Warthen (wwarthen@gmail.com) -;_______________________________________________________________________________ -; -; Usage: -; MODE /? -; MODE COM: [[,[,[,]]]] [/P] -; -; is numerical baudrate -; is (N)one, (O)dd, (E)ven, (M)ark, or (S)pace -; is number of data bits, typically 7 or 8 -; is number of stop bits, typically 1 or 2 -; /P prompts user prior to setting new configuration -; -; Examples: -; MODE /? (display command usage) -; MODE (display configuration of all serial ports) -; MODE COM0: (display configuration of serial unit 0) -; MODE COM1: 9600,N,8,1 (set serial unit 1 configuration) -; -; Notes: -; - Parameters not provided will remain unchanged -; - Device must support specified configuration -;_______________________________________________________________________________ -; -; Change Log: -; 2017-08-16 [WBW] Initial release -; 2017-08-28 [WBW] Handle UNACPM -; 2018-07-24 [WBW] Fixed bug in getnum23 routine (credit Phil Summers) -;_______________________________________________________________________________ -; -; ToDo: -; 1) Implement flow control settings -;_______________________________________________________________________________ -; -;=============================================================================== -; Definitions -;=============================================================================== -; -stksiz .equ $40 ; Working stack size -; -restart .equ $0000 ; CP/M restart vector -bdos .equ $0005 ; BDOS invocation vector -; -ident .equ $FFFE ; loc of RomWBW HBIOS ident ptr -; -rmj .equ 3 ; intended CBIOS version - major -rmn .equ 0 ; intended CBIOS version - minor -; -bf_cioinit .equ $04 ; HBIOS: CIOINIT function -bf_cioquery .equ $05 ; HBIOS: CIOQUERY function -bf_ciodevice .equ $06 ; HBIOS: CIODEVICE function -bf_sysget .equ $F8 ; HBIOS: SYSGET function -; -;=============================================================================== -; Code Section -;=============================================================================== -; - .org $100 -; - ; setup stack (save old value) - ld (stksav),sp ; save stack - ld sp,stack ; set new stack -; - ; initialization - call init ; initialize - jr nz,exit ; abort if init fails -; - ; get the target device - call getdev ; parse device/id from command line - jr nz,exit ; abort on error -; - ; process the configuration request - call process ; parse device/id from command line - jr nz,exit ; abort on error -; -exit: ; clean up and return to command processor - call crlf ; formatting - ld sp,(stksav) ; restore stack - jp restart ; return to CP/M via restart - ret ; return to CP/M w/o restart -; -; Initialization -; -init: - ; locate start of cbios (function jump table) - ld hl,(restart+1) ; load address of CP/M restart vector - ld de,-3 ; adjustment for start of table - add hl,de ; HL now has start of table - ld (bioloc),hl ; save it -; - ; check for UNA (UBIOS) - ld a,($FFFD) ; fixed location of UNA API vector - cp $C3 ; jp instruction? - jr nz,initwbw ; if not, not UNA - ld hl,($FFFE) ; get jp address - ld a,(hl) ; get byte at target address - cp $FD ; first byte of UNA push ix instruction - jr nz,initwbw ; if not, not UNA - inc hl ; point to next byte - ld a,(hl) ; get next byte - cp $E5 ; second byte of UNA push ix instruction - jr nz,initwbw ; if not, not UNA -; - ; UNA initialization - ld hl,unamod ; point to UNA mode flag - ld (hl),$FF ; set UNA mode flag - ld a,$FF ; assume max units for UNA - ld (comcnt),a ; ... and save it - jr initx ; UNA init done -; -initwbw: - ; get location of config data and verify integrity - ld hl,(ident) ; HL := adr or RomWBW HBIOS ident - ld a,(hl) ; get first byte of RomWBW marker - cp 'W' ; match? - jp nz,errinv ; abort with invalid config block - inc hl ; next byte (marker byte 2) - ld a,(hl) ; load it - cp ~'W' ; match? - jp nz,errinv ; abort with invalid config block - inc hl ; next byte (major/minor version) - ld a,(hl) ; load it - cp rmj << 4 | rmn ; match? - jp nz,errver ; abort with invalid os version -; - ; RomWBW initialization - ld b,bf_sysget ; BIOS SYSGET function - ld c,$00 ; CIOCNT subfunction - rst 08 ; E := serial device unit count - ld a,e ; count to A - ld (comcnt),a ; save it -; -initx - ; initialization complete - xor a ; signal success - ret ; return -; -; Get target device specification (e.g., "COM1:") and save -; as devicetype/id. -; -getdev: - ; skip to start of first parm - ld ix,$81 ; point to start of parm area (past len byte) - call nonblank ; skip to next non-blank char - jp z,prtcomall ; no parms, show all active ports -; -getdev1: - ; process options (if any) - cp '/' ; option prefix? - jr nz,getdev2 ; not an option, continue - call option ; process option - ret nz ; some options mean we are done (e.g., "/?") - inc ix ; skip option character - call nonblank ; skip whitespace - jr getdev1 ; continue option checking -; -getdev2: - ; parse device mnemonic (e.g., "COM1") into tmpstr - call getalpha ; extract alpha portion (e.g., "COM") - call getnum ; extract numeric portion - jp c,errunt ; handle overflow as invalid unit - ld (unit),a ; save as unit number -; - ; skip terminating ':' in device spec - ld a,(ix) ; get current char - cp ':' ; colon? - jr nz,getdev3 ; done if no colon - inc ix ; otherwise, skip the colon -; -getdev3: - call nonblank ; gobble any remaining whitespace - xor a ; indicate success - ret ; and return -; -; Process device -; -process: - ; match and branch according to device mnemonic - ld hl,tmpstr ; point to start of extracted string - ld de,strcom ; point to "COM" string - call strcmp ; and compare - jp z,comset ; handle COM port configuration - jp errdev ; abort if bad device name -; -; Display or change serial port configuration -; -comset: - ; check for valid unit number - ld hl,comcnt ; point to com device unit count - ld a,(unit) ; get com device unit count - cp (hl) ; compare to count (still in E) - jr c,comset1 ; unit < count, continue - jp errunt ; handle unit number error -; -comset1: - call ldcom ; load config for port -; - ld a,(comatr) ; get attributes - bit 7,a ; terminal? - jp nz,prtcom ; terminal not configurable -; - ld a,(ix) ; get current char - cp 0 ; nothing more? - jp z,prtcom ; no config parms, print current device config -; - ; parse and update baudrate - ld a,(ix) ; get current byte - cp '0' ; check for - jr c,comset1a ; ... valid digit - cp '9'+1 ; ... else jump ahead - jr nc,comset1a ; ... to handle empty -; - call getnum32 ; get baud rate into DE:HL - jp c,errcfg ; Handle overflow error - ld c,75 ; Constant for baud rate encode - call encode ; encode into C:4-0 - jp nz,errcfg ; Error if encode fails - ld a,(comcfg+1) ; Get high byte of config - and %11100000 ; strip out old baud rate bits - or c ; insert new baud rate bits - ld (comcfg+1),a ; save it -; -comset1a: - ; parse and update parity - call nonblank ; skip blanks - jp z,comset9 ; end of parms - cp ',' ; comma, as expected? - jp nz,comset8 ; check for trailing options - inc ix ; skip comma - call nonblank ; skip possible blanks - call ucase - ; lookup parity value - ld c,0 - cp 'N' - jr z,comset2 - ld c,1 - cp 'O' - jr z,comset2 - ld c,3 - cp 'E' - jr z,comset2 - ld c,5 - cp 'M' - jr z,comset2 - ld c,7 - cp 'S' - jr z,comset2 - jr comset3 ; unexpected parity char, possibly empty -; -comset2: - ; update parity value - ld a,c ; new parity value to A - rlca ; rotate to bits 5-3 - rlca ; - rlca ; - ld c,a ; and back to C - ld a,(comcfg) ; parity is in comcfg:5-3 - and %11000111 ; strip old value - or c ; apply new value - ld (comcfg),a ; and save it - inc ix ; bump past parity char -; -comset3: - ; parse & update data bits - call nonblank ; skip blanks - jr z,comset9 ; end of parms - cp ',' ; comma, as expected? - jr nz,comset8 ; check for trailing options - inc ix ; skip comma - call nonblank ; skip possible blanks - sub '5' ; normalize value - cp 4 ; value should now be 0-3 - jr nc,comset4 ; unexpected, possibly empty - ld c,a ; move new value to C - ld a,(comcfg) ; data bits is in comcfg:1-0 - and %11111100 ; strip old value - or c ; apply new value - ld (comcfg),a ; and save it - inc ix ; bump past data bits char -; -comset4: - ; parse & update stop bits - call nonblank ; skip blanks - jr z,comset9 ; end of parms - cp ',' ; comma, as expected? - jr nz,comset8 ; check for trailing options - inc ix ; skip comma - call nonblank ; skip possible blanks - sub '1' ; normalize value - cp 2 ; value should now be 0-1 - jr nc,comset8 ; unexpected, possibly empty - rlca ; rotate to bit 2 - rlca - ld c,a ; move new value to C - ld a,(comcfg) ; stop bit is in comcfg:2 - and %11111011 ; strip old value - or c ; apply new value - ld (comcfg),a ; and save it - inc ix ; bump past stop bits char -; -comset8: - ; trailing options - call nonblank ; skip blanks - jr z,comset9 ; end of parms - cp '/' ; option introducer? - jp nz,errprm ; parameter error - inc ix ; bump part '/' - ld a,(ix) ; get character - call ucase ; make upper case - cp 'P' ; only valid option - jp nz,errprm ; parameter error - ld a,$FF ; set prompt value on - ld (pflag),a ; save it - inc ix ; bump past character - jr comset8 ; process more parms -; -comset9: - ; display new config - ld de,(comcfg) ; get new config - call prtcom ; print it - ld a,(pflag) ; get prompt flag - or a ; set flags - jr z,comset9b ; bypass if not requested - call crlf2 ; spacing - ld de,indent ; indent - call prtstr ; do it - ld de,msgpmt ; point to prmopt message - call prtstr ; print it -; - ld b,64 -comset9a: - xor a - call prtchr - djnz comset9a -; -comset9b: - ; check for UNA - ld a,(unamod) ; get UNA flag - or a ; set flags - jr nz,comsetu ; go to UNA variant -; - ; implement new config - ld de,(comcfg) ; get new config value to DE - ld b,bf_cioinit ; BIOS serial init - ld a,(unit) ; get serial device unit - ld c,a ; ... into C - rst 08 ; call HBIOS - jp nz,errcfg ; handle error - jr comsetx ; common exit -; -comsetu: - ; implement new config under UNA - ld de,(comcfg) ; get new config value to DE - ld c,$10 ; UNA INIT function - ld a,(unit) ; get serial device unit - ld b,a ; ... into B - rst 08 ; call HBIOS - jp nz,errcfg ; handle error - jr comsetx ; common exit -; -comsetx: - ld a,(pflag) ; get prompt flag - or a ; set flags - jr z,comsetx2 ; bypass if not requested -comsetx1: - ld c,$01 ; console read - call bdos ; do it - cp $0D ; CR? - jr nz,comsetx1 ; loop as needed -; -comsetx2: - xor a - ret -; -; Print configuration of all serial ports -; -prtcomall: - ld a,(comcnt) ; get com device unit count - ld b,a ; init B as loop counter - ld c,0 ; init C as unit index -; -prtcomall1: - push bc ; save loop control -; - ; get port info - ld a,c ; put unit number - ld (unit),a ; ... into unit - call ldcom ; get config - jr z,prtcomall2 ; no error, continue - pop bc ; unwind stack - ret ; and return with NZ -; -prtcomall2: - ; print config for port - call prtcom ; print line for this port -; - ; loop as needed - pop bc ; restore loop control - inc c ; next unit index - djnz prtcomall1 ; loop till done -; - or $FF ; indicate nothing more to do - ret ; finished -; -; Print configuration of serial port -; -prtcom: - ; print leader (e.g., "COM0: ") - call crlf - ld de,indent - call prtstr - ld de,strcom - call prtstr - ld a,(unit) - call prtdecb - ld a,':' - call prtchr - ld a,' ' - call prtchr -; - ld a,(comatr) ; get attribute byte - bit 7,a ; 0=RS232, 1=terminal - jr z,prtcom1 ; handle serial port configuration -; - ; this is a terminal, just say so - ld de,strterm ; point to string - call prtstr ; print it - ret ; and return -; -prtcom1: - ld de,(comcfg) ; load config to DE -; - ; print baud rate - push de ; save it - ld a,d ; baud rate is in D - and $1F ; ... bits 4-0 - ld l,a ; move to L - ld h,0 ; setup H for decode routine - ld de,75 ; set DE to baud rate decode constant - call decode ; decode baud rate, DE:HL := baud rate - ld bc,bcdtmp ; point to temp bcd buffer - call bin2bcd ; convert baud to BCD - call prtbcd ; and print in decimal - pop de ; restore line characteristics -; - ; print parity - ld a,',' ; A := comma - call prtchr ; ... print it - ld a,e ; E has parity config - rrca ; isolate bits 5-3 - rrca ; ... - rrca ; ... - and $07 ; ... - ld hl,parmap ; HL := start of parity char table - call addhl ; index into table - ld a,(hl) ; get resulting parity char - call prtchr ; and print -; - ; print data bits - ld a,',' ; A := comma - call prtchr ; ... print it - ld a,e ; E has data bits config - and $03 ; isloate bits 1-0 - add A,'5' ; convert to printable char - call prtchr ; and print it -; - ; print stop bits - ld a,',' ; A := comma - call prtchr ; ... print it - ld a,e ; E has stop bits config - rrca ; isolate bit 2 - rrca ; ... - and $01 ; ... - add A,'1' ; convert to printable char - call prtchr ; and print it -; - ret -; -; Load serial device info for specific unit -; -ldcom: - ld a,(unamod) ; get UNA flag - or a ; set flags - jr nz,ldcomu ; go to UNA variant -; - ; get device type info - ld a,(unit) ; get unit - ld b,bf_ciodevice ; BIOS device call - ld c,a ; ... and put in C - rst 08 ; call HBIOS, C := attributes - ret nz ; return on error - ld a,c ; attributes to A - ld (comatr),a ; save it -; - ; get serial port config - ld b,bf_cioquery ; BIOS serial device query - ld a,(unit) ; get device unit num - ld c,a ; ... and put in C - rst 08 ; call H/UBIOS, DE := line characteristics - ret nz ; abort on error - ld (comcfg),de ; save config -; - xor a ; success - ret -; -ldcomu: ; UNA variant - xor a ; assume attribtues zero - ld (comatr),a ; save it - ; get device info - ld a,(unit) ; get unit - ld b,a ; put unit in B - ld c,$18 ; UNA Get line/driver info func - rst 08 ; call H/UBIOS, DE := line characteristics - ld a,c - or a - jr z,ldcomu1 - cp $43 ; $43 is OK for now (tell John about this) - jr z,ldcomu1 - ret ; return w/ NZ indicating error -; -ldcomu1: - ld (comcfg),de ; save config -; - xor a ; success - ret - -; -; Handle special options -; -option: -; - inc ix ; next char - ld a,(ix) ; get it - cp '?' ; is it a '?' as expected? - jp z,usage ; yes, display usage -; cp 'L' ; is it a 'L', display device list? -; jp z,devlist ; yes, display device list - jp errprm ; anything else is an error -; -; Display usage -; -usage: -; - call crlf ; formatting - ld de,msgban1 ; point to version message part 1 - call prtstr ; print it - ld a,(unamod) ; get UNA flag - or a ; set flags - ld de,msghb ; point to HBIOS mode message - call z,prtstr ; if not UNA, say so - ld de,msgub ; point to UBIOS mode message - call nz,prtstr ; if UNA, say so - call crlf ; formatting - ld de,msgban2 ; point to version message part 2 - call prtstr ; print it - call crlf2 ; blank line - ld de,msguse ; point to usage message - call prtstr ; print it - or $FF ; signal no action performed - ret ; and return -; -; Print character in A without destroying any registers -; -prtchr: - push bc ; save registers - push de - push hl - ld e,a ; character to print in E - ld c,$02 ; BDOS function to output a character - call bdos ; do it - pop hl ; restore registers - pop de - pop bc - ret -; -prtdot: -; - ; shortcut to print a dot preserving all regs - push af ; save af - ld a,'.' ; load dot char - call prtchr ; print it - pop af ; restore af - ret ; done -; -; Print a zero terminated string at (DE) without destroying any registers -; -prtstr: - push de -; -prtstr1: - ld a,(de) ; get next char - or a - jr z,prtstr2 - call prtchr - inc de - jr prtstr1 -; -prtstr2: - pop de ; restore registers - ret -; -; Print the value in A in hex without destroying any registers -; -prthex: - push af ; save AF - push de ; save DE - call hexascii ; convert value in A to hex chars in DE - ld a,d ; get the high order hex char - call prtchr ; print it - ld a,e ; get the low order hex char - call prtchr ; print it - pop de ; restore DE - pop af ; restore AF - ret ; done -; -; print the hex word value in bc -; -prthexword: - push af - ld a,b - call prthex - ld a,c - call prthex - pop af - ret -; -; print the hex dword value in de:hl -; -prthex32: - push bc - push de - pop bc - call prthexword - push hl - pop bc - call prthexword - pop bc - ret -; -; Convert binary value in A to ascii hex characters in DE -; -hexascii: - ld d,a ; save A in D - call hexconv ; convert low nibble of A to hex - ld e,a ; save it in E - ld a,d ; get original value back - rlca ; rotate high order nibble to low bits - rlca - rlca - rlca - call hexconv ; convert nibble - ld d,a ; save it in D - ret ; done -; -; Convert low nibble of A to ascii hex -; -hexconv: - and $0F ; low nibble only - add a,$90 - daa - adc a,$40 - daa - ret -; -; Print value of A or HL in decimal with leading zero suppression -; Use prtdecb for A or prtdecw for HL -; -prtdecb: - push hl - ld h,0 - ld l,a - call prtdecw ; print it - pop hl - ret -; -prtdecw: - push af - push bc - push de - push hl - call prtdec0 - pop hl - pop de - pop bc - pop af - ret -; -prtdec0: - ld e,'0' - ld bc,-10000 - call prtdec1 - ld bc,-1000 - call prtdec1 - ld bc,-100 - call prtdec1 - ld c,-10 - call prtdec1 - ld e,0 - ld c,-1 -prtdec1: - ld a,'0' - 1 -prtdec2: - inc a - add hl,bc - jr c,prtdec2 - sbc hl,bc - cp e - ret z - ld e,0 - call prtchr - ret -; -; Start a new line -; -crlf2: - call crlf ; two of them -crlf: - push af ; preserve AF - ld a,13 ; - call prtchr ; print it - ld a,10 ; - call prtchr ; print it - pop af ; restore AF - ret -; -; Get the next non-blank character from (HL). -; -nonblank: - ld a,(ix) ; load next character - or a ; string ends with a null - ret z ; if null, return pointing to null - cp ' ' ; check for blank - ret nz ; return if not blank - inc ix ; if blank, increment character pointer - jr nonblank ; and loop -; -; Get alpha chars and save in tmpstr -; Length of string returned in A -; -getalpha: -; - ld hl,tmpstr ; location to save chars - ld b,8 ; length counter (tmpstr max chars) - ld c,0 ; init character counter -; -getalpha1: - ld a,(ix) ; get active char - call ucase ; lower case -> uppper case, if needed - cp 'A' ; check for start of alpha range - jr c,getalpha2 ; not alpha, get out - cp 'Z' + 1 ; check for end of alpha range - jr nc,getalpha2 ; not alpha, get out - ; handle alpha char - ld (hl),a ; save it - inc c ; bump char count - inc hl ; inc string pointer - inc ix ; increment buffer ptr - djnz getalpha1 ; if space, loop for more chars -; -getalpha2: ; non-alpha, clean up and return - ld (hl),0 ; terminate string - ld a,c ; string length to A - or a ; set flags - ret ; and return -; -; Get numeric chars and convert to number returned in A -; Carry flag set on overflow -; -getnum: - ld c,0 ; C is working register -getnum1: - ld a,(ix) ; get the active char - cp '0' ; compare to ascii '0' - jr c,getnum2 ; abort if below - cp '9' + 1 ; compare to ascii '9' - jr nc,getnum2 ; abort if above -; - ; valid digit, add new digit to C - ld a,c ; get working value to A - rlca ; multiply by 10 - ret c ; overflow, return with carry set - rlca ; ... - ret c ; overflow, return with carry set - add a,c ; ... - ret c ; overflow, return with carry set - rlca ; ... - ret c ; overflow, return with carry set - ld c,a ; back to C - ld a,(ix) ; get new digit - sub '0' ; make binary - add a,c ; add in working value - ret c ; overflow, return with carry set - ld c,a ; back to C -; - inc ix ; bump to next char - jr getnum1 ; loop -; -getnum2: ; return result - ld a,c ; return result in A - or a ; with flags set, CF is cleared - ret -; -; Get numeric chars and convert to 32-bit number returned in DE:HL -; Carry flag set on overflow -; -getnum32: - ld de,0 ; Initialize DE:HL - ld hl,0 ; ... to zero -getnum32a: - ld a,(ix) ; get the active char - cp '0' ; compare to ascii '0' - jr c,getnum32c ; abort if below - cp '9' + 1 ; compare to ascii '9' - jr nc,getnum32c ; abort if above -; - ; valid digit, multiply DE:HL by 10 - ; X * 10 = (((x * 2 * 2) + x)) * 2 - push de - push hl -; - call getnum32e ; DE:HL *= 2 - jr c,getnum32d ; if overflow, ret w/ CF & stack pop -; - call getnum32e ; DE:HL *= 2 - jr c,getnum32d ; if overflow, ret w/ CF & stack pop -; - pop bc ; DE:HL += X - add hl,bc - ex de,hl - pop bc - adc hl,bc - ex de,hl - ret c ; if overflow, ret w/ CF -; - call getnum32e ; DE:HL *= 2 - ret c ; if overflow, ret w/ CF -; - ; now add in new digit - ld a,(ix) ; get the active char - sub '0' ; make it binary - add a,l ; add to L, CF updated - ld l,a ; back to L - jr nc,getnum32b ; if no carry, done - inc h ; otherwise, bump H - jr nz,getnum32b ; if no overflow, done - inc e ; otherwise, bump E - jr nz,getnum32b ; if no overflow, done - inc d ; otherwise, bump D - jr nz,getnum32b ; if no overflow, done - scf ; set carry flag to indicate overflow - ret ; and return -; -getnum32b: - inc ix ; bump to next char - jr getnum32a ; loop -; -getnum32c: - ; successful completion - xor a ; clear flags - ret ; and return -; -getnum32d: - ; special overflow exit with stack fixup - pop hl ; burn 2 - pop hl ; ... stack entries - ret ; and return -; -getnum32e: - ; DE:HL := DE:HL * 2 - sla l - rl h - rl e - rl d - ret -; -; Compare null terminated strings at HL & DE -; If equal return with Z set, else NZ -; -strcmp: - ld a,(de) ; get current source char - cp (hl) ; compare to current dest char - ret nz ; compare failed, return with NZ - or a ; set flags - ret z ; end of string, match, return with Z set - inc de ; point to next char in source - inc hl ; point to next char in dest - jr strcmp ; loop till done -; -; Convert character in A to uppercase -; -ucase: - cp 'a' ; if below 'a' - ret c ; ... do nothing and return - cp 'z' + 1 ; if above 'z' - ret nc ; ... do nothing and return - res 5,a ; clear bit 5 to make lower case -> upper case - ret ; and return -; -; Add the value in A to HL (HL := HL + A) -; -addhl: - add a,l ; A := A + L - ld l,a ; Put result back in L - ret nc ; if no carry, we are done - inc h ; if carry, increment H - ret ; and return -; -; Integer divide DE:HL by C -; result in DE:HL, remainder in A -; clobbers F, B -; -div32x8: - xor a - ld b,32 -div32x8a: - add hl,hl - rl e - rl d - rla - cp c - jr c,div32x8b - sub c - inc l -div32x8b: - djnz div32x8a - ret -; -; Jump indirect to address in HL -; -jphl: - jp (hl) -; -; Errors -; -erruse: ; command usage error (syntax) - ld de,msguse - jr err -; -errprm: ; command parameter error (syntax) - ld de,msgprm - jr err -; -errinv: ; invalid HBIOS, signature not found - ld de,msginv - jr err -; -errver: ; unsupported HBIOS version - ld de,msgver - jr err -; -errdev: ; invalid device name - ld de,msgdev - jr err -; -errnum: ; invalid number parsed, overflow - ld de,msgnum - jr err -; -errunt: ; Invalid device unit specified - ld de,msgunt - jr err -; -errcfg: ; Invalid device configuration specified - ld de,msgcfg - jr err -; -err: ; print error string and return error signal - call crlf2 ; print newline -; -err1: ; without the leading crlf - call prtstr ; print error string -; -err2: ; without the string -; call crlf ; print newline - or $FF ; signal error - ret ; done -; -;=============================================================================== -; Utility modules -;=============================================================================== -; -#include "Encode.asm" -#include "Decode.asm" -#include "bcd.asm" -; -;=============================================================================== -; Storage Section -;=============================================================================== -; -; -bioloc .dw 0 ; CBIOS starting address -unit .db 0 ; source unit -; -unamod .db 0 ; $FF indicates UNA UBIOS active -; -tmpstr .fill 9,0 ; temporary string of up to 8 chars, zero term -bcdtmp .fill 5,0 ; temporary bcd number storage -; -comcnt .db 0 ; count of com ports -comatr .db 0 ; com port attributes -comcfg .dw 0 ; com port configuration -; -parmap .db "NONENMNS" ; parity character lookup table -; -pflag .db 0 ; $FF indicates prompt option set -; -strcom .db "COM",0 ; serial device name string -strterm .db "VDU",0 ; terminal device string -; -stksav .dw 0 ; stack pointer saved at start - .fill stksiz,0 ; stack -stack .equ $ ; stack top -; -; Messages -; -indent .db " ",0 -msgban1 .db "MODE v1.2, 24-Jul-2018",0 -msghb .db " [HBIOS]",0 -msgub .db " [UBIOS]",0 -msgban2 .db "Copyright (C) 2017, Wayne Warthen, GNU GPL v3",0 -msguse .db "Usage: MODE COM: [[,[,[,]]]] [/P]",13,10 - .db " ex. MODE /? (display version and usage)",13,10 - .db " MODE (display config of all serial ports)",13,10 - .db " MODE COM0: (display serial unit 0 config)",13,10 - .db " MODE COM1: 9600,N,8,1 (set serial unit 1 config)",0 -msgprm .db "Parameter error (MODE /? for usage)",0 -msginv .db "Invalid BIOS (signature missing)",0 -msgver .db "Unexpected HBIOS version",0 -msgdev .db "Invalid device name",0 -msgnum .db "Unit or slice number invalid",0 -msgunt .db "Invalid device unit number specified",0 -msgcfg .db "Invalid device configuration specified",0 -msgpmt .db "Prepare line then press ",0 -; - .end diff --git a/Source/Apps/RTC.asm b/Source/Apps/RTC.asm deleted file mode 100644 index 07b5c447..00000000 --- a/Source/Apps/RTC.asm +++ /dev/null @@ -1,1732 +0,0 @@ - .Title "RTC" -; -; Program: rtc.asm -; Author: Andrew Lynch -; Date: 22 Feb 2007 -; Enviroment: TASM MS-DOS Z80 Cross Assembler source for CP/M -; -;[2011/8/11] VK5DG modified for N8 -; Changed base address to $88 -; Changed trickle charger value to 2k+2 diodes for DS1210s -; -;[2012/2/7] WBW modified to build for either -; traditional N8VEM/Zeta or N8 via conditionals -; -;[2013/12/29] WBW modified to build for MK4 -; -;[2017/11/29] WBW modified to adjust to RTC in use dynamically -; using HBIOS platform detection -; -;[2018/11/8] v1.2 PMS Add boot option. Code optimization. -; -;[2019/06/21] v1.3 Finalized RC2014 Z180 support. -; -;[2019/08/11] v1.4 Support SCZ180 platform. -; -;[2020/02/02] v1.5 PMS Basic command line support -; -; Constants -; -mask_data .EQU %10000000 ; RTC data line -mask_clk .EQU %01000000 ; RTC Serial Clock line -mask_rd .EQU %00100000 ; Enable data read from RTC -mask_rst .EQU %00010000 ; De-activate RTC reset line - -PORT_SBC .EQU $70 ; RTC port for SBC/ZETA -PORT_N8 .EQU $88 ; RTC port for N8 -PORT_MK4 .EQU $8A ; RTC port for MK4 -PORT_RCZ80 .EQU $C0 ; RTC port for RC2014 -PORT_RCZ180 .EQU $0C ; RTC port for RC2014 -PORT_SCZ180 .EQU $0C ; RTC port for SBCZ180 -PORT_EZZ80 .EQU $C0 ; RTC port for EZZ80 (actually does not have one!!!) - -BDOS .EQU 5 ; BDOS invocation vector -FCB .EQU 05CH ; Start of command line - -BID_BOOT .EQU $00 -HB_BNKCALL .EQU $FFF9 - -; -; Program -; - .ORG 0100H - -LOOP: - LD DE,MSG - LD C,09H ; CP/M write string to console call - CALL 0005H - -; program starts here - - CALL RTC_INIT ; Program initialization - - CALL RTC_TOP_LOOP - - LD C,00H ; CP/M system reset call - shut down - CALL 0005H - - HALT ; This code is never reached - - -; function HEXSTR -; input number in A -; output upper nibble of number in ASCII in H -; output lower nibble of number in ASCII in L -; uses BC -; -; based on following algorithm: -; -; const -; hextab : string = ('0','1','2','3','4','5','6','7','8', -; '9','A','B','C','D','E','F'); -; -; PROCEDURE hexstr(n: int): ^string; -; BEGIN -; n := n and 255; -; tmpstr[1] := hextab[n / 16]; -; tmpstr[2] := hextab[n and 15]; -; tmpstr[0] := #2; -; return @tmpstr; -; END; - - -HEXSTR: - 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,HEXSTR1 ;IF CY SET SAVE 'NUMBER' in H - ADD A,07H ;MAKE IT AN ALPHA -HEXSTR1: - LD H,A ;SAVE 'ALPHA' in H - LD A,B ;NEXT NIBBLE - AND 0FH ;JUST THIS - ADD A,30H ;TRY A NUMBER - CP 3AH ;TEST IT - JR C,HEXSTR2 ;IF CY SET SAVE 'NUMBER' in L - ADD A,07H ;MAKE IT ALPHA - -HEXSTR2: - LD L,A ;SAVE 'ALPHA' in L - POP BC ;RESTORE BC - RET - - -;***************************************************** -;* GET K.B. DATA & MAKE IT 'HEX' -;***************************************************** - -HEXIN: - PUSH BC ;SAVE BC REGS. - CALL NIBL ;DO A NIBBLE - RLC A ;MOVE FIRST BYTE UPPER NIBBLE - RLC A - RLC A - RLC A - LD B,A ;SAVE ROTATED BYTE - PUSH BC - - CALL NIBL ;DO NEXT NIBBLE - POP BC - ADD A,B ;COMBINE NIBBLES IN ACC. - POP BC ;RESTORE BC - RET ;DONE -NIBL: - LD C,01H ; CP/M console input call - CALL 0005H ;GET K.B. DATA - CP 40H ;TEST FOR ALPHA - JR NC,ALPH - AND 0FH ;GET THE BITS - RET -ALPH: - AND 0FH ;GET THE BITS - ADD A,09H ;MAKE IT HEX A-F - RET - -; function RTC_IN -; -; read a byte from RTC port, return in A -; NOTE: port address is dynamically set in RTC_INIT - -RTC_IN: -INP .EQU $ + 1 - IN A,($FF) - RET - -; function RTC_OUT -; -; write a byte to RTC port, value in A -; NOTE: port address is dynamically set in RTC_INIT - -RTC_OUT: -OUTP .EQU $ + 1 - OUT ($FF),A - RET - -; function RTC_BIT_DELAY -; -; based on following algorithm: -; -; { Make a short delay } -; PROCEDURE rtc_bit_delay; -; var -; x : int; -; BEGIN -; x := 3; -; END; - -RTC_BIT_DELAY: ; purpose is to delay ~36 uS or 144 t-states at 4MHz - PUSH AF ; 11 t-states - LD A,07H ; 7 t-states ADJUST THE TIME 13h IS FOR 4 MHZ -RTC_BIT_DELAY1: - DEC A ; 4 t-states DEC COUNTER. 4 T-states = 1 uS. - JP NZ,RTC_BIT_DELAY1 ; 10 t-states JUMP TO PAUSELOOP2 IF A <> 0. - - NOP ; 4 t-states - NOP ; 4 t-states - POP AF ; 10 t-states - RET ; 10 t-states (144 t-states total) - - -; function RTC_RESET -; -; based on following algorithm: -; -; { Output a RTC reset signal } -; PROCEDURE rtc_reset; -; BEGIN -; out(rtc_base,mask_data + mask_rd); -; rtc_bit_delay(); -; rtc_bit_delay(); -; out(rtc_base,mask_data + mask_rd + mask_rst); -; rtc_bit_delay(); -; rtc_bit_delay(); -; END; -; -RTC_RESET: - LD A,mask_data + mask_rd - ;OUT (RTC),A - CALL RTC_OUT - CALL RTC_BIT_DELAY - CALL RTC_BIT_DELAY - LD A,mask_data + mask_rd + mask_rst - ;OUT (RTC),A - CALL RTC_OUT - CALL RTC_BIT_DELAY - CALL RTC_BIT_DELAY - RET - - -; function RTC_RESET_ON -; -; based on following algorithm: -; -; { Assert RTC reset signal } -; PROCEDURE rtc_reset_on; -; BEGIN -; out(rtc_base,mask_data + mask_rd); -; rtc_bit_delay(); -; rtc_bit_delay(); -; END; - -RTC_RESET_ON: - LD A,mask_data + mask_rd - ;OUT (RTC),A - CALL RTC_OUT - CALL RTC_BIT_DELAY - CALL RTC_BIT_DELAY - RET - -; function RTC_RESET_OFF -; -; based on following algorithm: -; -; { De-assert RTC reset signal } -; PROCEDURE rtc_reset_off; -; BEGIN -; out(rtc_base,mask_data + mask_rd + mask_rst); -; rtc_bit_delay(); -; rtc_bit_delay(); -; END; - -RTC_RESET_OFF: - LD A,mask_data + mask_rd + mask_rst - ;OUT (RTC),A - CALL RTC_OUT - CALL RTC_BIT_DELAY - CALL RTC_BIT_DELAY - RET - -; function RTC_WR -; input value in C -; uses A -; -; PROCEDURE rtc_wr(n : int); -; var -; i : int; -; BEGIN -; for i := 0 while i < 8 do inc(i) loop -; if (n and 1) <> 0 then -; out(rtc_base,mask_rst + mask_data); -; rtc_bit_delay(); -; out(rtc_base,mask_rst + mask_clk + mask_data); -; else -; out(rtc_base,mask_rst); -; rtc_bit_delay(); -; out(rtc_base,mask_rst + mask_clk); -; end; -; rtc_bit_delay(); -; n := shr(n,1); -; end loop; -; END; - -RTC_WR: - XOR A ; set A=0 index counter of FOR loop - -RTC_WR1: - PUSH AF ; save accumulator as it is the index counter in FOR loop - LD A,C ; get the value to be written in A from C (passed value to write in C) - BIT 0,A ; is LSB a 0 or 1? - JP Z,RTC_WR2 ; if it's a 0, handle it at RTC_WR2. - ; LSB is a 1, handle it below - ; setup RTC latch with RST and DATA high, SCLK low - LD A,mask_rst + mask_data - ;OUT (RTC),A ; output to RTC latch - CALL RTC_OUT - CALL RTC_BIT_DELAY ; let it settle a while - ; setup RTC with RST, DATA, and SCLK high - LD A,mask_rst + mask_clk + mask_data - ;OUT (RTC),A ; output to RTC latch - CALL RTC_OUT - JP RTC_WR3 ; exit FOR loop - -RTC_WR2: - ; LSB is a 0, handle it below - LD A,mask_rst ; setup RTC latch with RST high, SCLK and DATA low - ;OUT (RTC),A ; output to RTC latch - CALL RTC_OUT - CALL RTC_BIT_DELAY ; let it settle a while - ; setup RTC with RST and SCLK high, DATA low - LD A,mask_rst + mask_clk - ;OUT (RTC),A ; output to RTC latch - CALL RTC_OUT - -RTC_WR3: - CALL RTC_BIT_DELAY ; let it settle a while - RRC C ; move next bit into LSB position for processing to RTC - POP AF ; recover accumulator as it is the index counter in FOR loop - INC A ; increment A in FOR loop (A=A+1) - CP $08 ; is A < $08 ? - JP NZ,RTC_WR1 ; No, do FOR loop again - RET ; Yes, end function and return - - -; function RTC_RD -; output value in C -; uses A -; -; function RTC_RD -; -; PROCEDURE rtc_rd(): int ; -; var -; i,n,mask : int; -; BEGIN -; n := 0; -; mask := 1; -; for i := 0 while i < 8 do inc(i) loop -; out(rtc_base,mask_rst + mask_rd); -; rtc_bit_delay(); -; if (in(rtc_base) and #1) <> #0 then -; { Data = 1 } -; n := n + mask; -; else -; { Data = 0 } -; end; -; mask := shl(mask,1); -; out(rtc_base,mask_rst + mask_clk + mask_rd); -; rtc_bit_delay(); -; end loop; -; return n; -; END; - -RTC_RD: - XOR A ; set A=0 index counter of FOR loop - LD C,$00 ; set C=0 output of RTC_RD is passed in C - LD B,$01 ; B is mask value - -RTC_RD1: - PUSH AF ; save accumulator as it is the index counter in FOR loop - ; setup RTC with RST and RD high, SCLK low - LD A,mask_rst + mask_rd - ;OUT (RTC),A ; output to RTC latch - CALL RTC_OUT - CALL RTC_BIT_DELAY ; let it settle a while - ;IN A,(RTC) ; input from RTC latch - CALL RTC_IN ; input from RTC latch - BIT 0,A ; is LSB a 0 or 1? - JP Z,RTC_RD2 ; if LSB is a 1, handle it below - LD A,C - ADD A,B - LD C,A -; INC C - ; if LSB is a 0, skip it (C=C+0) -RTC_RD2: - RLC B ; move input bit out of LSB position to save it in C - ; setup RTC with RST, SCLK high, and RD high - LD A,mask_rst + mask_clk + mask_rd - ;OUT (RTC),A ; output to RTC latch - CALL RTC_OUT - CALL RTC_BIT_DELAY ; let it settle - POP AF ; recover accumulator as it is the index counter in FOR loop - INC A ; increment A in FOR loop (A=A+1) - CP $08 ; is A < $08 ? - JP NZ,RTC_RD1 ; No, do FOR loop again - RET ; Yes, end function and return. Read RTC value is in C - -; function RTC_WRITE -; input address in D -; input value in E -; uses A -; -; based on following algorithm: -; -; PROCEDURE rtc_write(address, value: int); -; BEGIN -; lock(); -; rtc_reset_off(); -; { Write command } -; rtc_wr(128 + shl(address and $3f,1)); -; { Write data } -; rtc_wr(value and $ff); -; rtc_reset_on(); -; unlock(); -; END; - -RTC_WRITE: - DI ; disable interrupts during critical section - CALL RTC_RESET_OFF ; turn off RTC reset - LD A,D ; bring into A the address from D -; AND $3F ; keep only bits 6 LSBs, discard 2 MSBs - AND %00111111 ; keep only bits 6 LSBs, discard 2 MSBs - RLC A ; rotate address bits to the left -; ADD A,$80 ; set MSB to one for DS1302 COMMAND BYTE (WRITE) - ADD A,%10000000 ; set MSB to one for DS1302 COMMAND BYTE (WRITE) - LD C,A ; RTC_WR expects write data (address) in reg C - CALL RTC_WR ; write address to DS1302 - LD A,E ; start processing value - AND $FF ; seems unnecessary, probably delete since all values are 8-bit - LD C,A ; RTC_WR expects write data (value) in reg C - CALL RTC_WR ; write address to DS1302 - CALL RTC_RESET_ON ; turn on RTC reset - EI - RET - - -; function RTC_READ -; input address in D -; output value in C -; uses A -; -; based on following algorithm -; -; PROCEDURE rtc_read(address: int): int; -; var -; n : int; -; BEGIN -; lock(); -; rtc_reset_off(); -; { Write command } -; rtc_wr(128 + shl(address and $3f,1) + 1); -; { Read data } -; n := rtc_rd(); -; rtc_reset_on(); -; unlock(); -; return n; -; END; - -RTC_READ: - DI ; disable interrupts during critical section - CALL RTC_RESET_OFF ; turn off RTC reset - LD A,D ; bring into A the address from D - AND $3F ; keep only bits 6 LSBs, discard 2 MSBs - RLC A ; rotate address bits to the left - ADD A,$81 ; set MSB to one for DS1302 COMMAND BYTE (READ) - LD C,A ; RTC_WR expects write data (address) in reg C - CALL RTC_WR ; write address to DS1302 - CALL RTC_RD ; read value from DS1302 (value is in reg C) - CALL RTC_RESET_ON ; turn on RTC reset - EI - RET - - -; function RTC_WR_PROTECT -; input D (address) $07 -; input E (value) $80 -; uses A -; -; based on following algorithm -; -; PROCEDURE rtc_wr_protect; -; BEGIN -; rtc_write(7,128); -; END; - -RTC_WR_PROTECT: -; LD D,$07 - LD D,%00000111 -; LD E,$80 - LD E,%10000000 - CALL RTC_WRITE - RET - - -; function RTC_WR_UNPROTECT -; input D (address) $07 -; input E (value) $00 -; uses A -; -; based on following algorithm -; -; PROCEDURE rtc_wr_unprotect; -; BEGIN -; rtc_write(7,0); -; END; - -RTC_WR_UNPROTECT: -; LD D,$07 - LD D,%00000111 -; LD E,$00 - LD E,%00000000 - CALL RTC_WRITE - RET - - -; function RTC_GET_TIME -; input HL (memory address of buffer) -; uses A,C,D,E -; -; based on following algorithm -; -; PROCEDURE rtc_get_time(var buf: string); -; var -; n : int; -; BEGIN -; lock(); -; rtc_reset_off(); -; { Write command, burst read } -; rtc_wr(255 - 64); -; { Read seconds } -; n := rtc_rd(); 0 -; buf[16] := char(((n / 16) and $07)) + '0'; -; buf[17] := char((n and $0f)) + '0'; -; { Read minutes } -; n := rtc_rd(); 1 -; buf[13] := char(((n / 16) and $07)) + '0'; -; buf[14] := char((n and $0f)) + '0'; -; buf[15] := ':'; -; { Read hours } -; n := rtc_rd(); 2 -; buf[10] := char(((n / 16) and $03)) + '0'; -; buf[11] := char((n and $0f)) + '0'; -; buf[12] := ':'; -; { Read date } -; n := rtc_rd(); 3 -; buf[7] := char(((n / 16) and $03)) + '0'; -; buf[8] := char((n and $0f)) + '0'; -; buf[9] := ' '; -; { Read month } -; n := rtc_rd(); 4 -; buf[4] := char(((n / 16) and $03)) + '0'; -; buf[5] := char((n and $0f)) + '0'; -; buf[6] := '-'; -; { Read day } -; n := rtc_rd(); 5 -; { -; buf[4] := char(((n / 16) and $03)) + '0'; -; buf[4] := char((n and $0f)) + '0'; -; } -; { Read year } -; n := rtc_rd(); 6 -; buf[1] := char(((n / 16) and $0f)) + '0'; -; buf[2] := char((n and $0f)) + '0'; -; buf[3] := '-'; -; length(buf) := 17; -; rtc_reset_on(); -; unlock(); -; END rtc_get_time; - -RTC_GET_TIME: - DI ; disable interrupts during DS1302 read - CALL RTC_RESET_OFF ; turn of RTC reset - ; { Write command, burst read } - LD C,%10111111 ; (255 - 64) - CALL RTC_WR ; send COMMAND BYTE (BURST READ) to DS1302 - -; { Read seconds } - - CALL RTC_RD ; read value from DS1302, value is in Reg C - - ; digit 16 - LD A,C ; put value output in Reg C into accumulator - RLC A - RLC A - RLC A - RLC A - AND $07 - ADD A,'0' - LD (RTC_PRINT_BUFFER+15),A - - ; digit 17 - LD A,C ; put value output in Reg C into accumulator - AND $0F - ADD A,'0' - LD (RTC_PRINT_BUFFER+16),A - -; { Read minutes } - - CALL RTC_RD ; read value from DS1302, value is in Reg C - - ; digit 13 - LD A,C ; put value output in Reg C into accumulator - RLC A - RLC A - RLC A - RLC A - AND $07 - ADD A,'0' - LD (RTC_PRINT_BUFFER+12),A - - ; digit 14 - LD A,C ; put value output in Reg C into accumulator - AND $0F - ADD A,'0' - LD (RTC_PRINT_BUFFER+13),A - - ; digit 15 - LD A,':' - LD (RTC_PRINT_BUFFER+14),A - -; { Read hours } - - CALL RTC_RD ; read value from DS1302, value is in Reg C - - ; digit 10 - LD A,C ; put value output in Reg C into accumulator - RLC A - RLC A - RLC A - RLC A - AND $03 - ADD A,'0' - LD (RTC_PRINT_BUFFER+09),A - - ; digit 11 - LD A,C ; put value output in Reg C into accumulator - AND $0F - ADD A,'0' - LD (RTC_PRINT_BUFFER+10),A - - ; digit 12 - LD A,':' - LD (RTC_PRINT_BUFFER+11),A - -; { Read date } - - CALL RTC_RD ; read value from DS1302, value is in Reg C - - ; digit 07 - LD A,C ; put value output in Reg C into accumulator - RLC A - RLC A - RLC A - RLC A - AND $03 - ADD A,'0' - LD (RTC_PRINT_BUFFER+06),A - - ; digit 08 - LD A,C ; put value output in Reg C into accumulator - AND $0F - ADD A,'0' - LD (RTC_PRINT_BUFFER+07),A - - ; digit 09 - LD A,' ' - LD (RTC_PRINT_BUFFER+08),A - -; { Read month } - - CALL RTC_RD ; read value from DS1302, value is in Reg C - - ; digit 04 - LD A,C ; put value output in Reg C into accumulator - RLC A - RLC A - RLC A - RLC A - AND $03 - ADD A,'0' - LD (RTC_PRINT_BUFFER+03),A - - ; digit 05 - LD A,C ; put value output in Reg C into accumulator - AND $0F - ADD A,'0' - LD (RTC_PRINT_BUFFER+04),A - - ; digit 06 - LD A,'-' - LD (RTC_PRINT_BUFFER+05),A - -; { Read day } - - CALL RTC_RD ; read value from DS1302, value is in Reg C - - ; digit 04 -; LD A,C ; put value output in Reg C into accumulator -; RLC A -; RLC A -; RLC A -; RLC A -; AND $03 -; ADD A,'0' -; LD (RTC_PRINT_BUFFER+03),A - - ; digit 04 -; LD A,C ; put value output in Reg C into accumulator -; AND $0F -; ADD A,'0' -; LD (RTC_PRINT_BUFFER+03),A - -; add special code to put "DAY" value at end of string until better solution known - - ; digit 18 - LD A,'-' - LD (RTC_PRINT_BUFFER+17),A - - ; digit 19 - LD A,C ; put value output in Reg C into accumulator - RLC A - RLC A - RLC A - RLC A - AND $0F - ADD A,'0' - LD (RTC_PRINT_BUFFER+18),A - - ; digit 20 - LD A,C ; put value output in Reg C into accumulator - AND $0F - ADD A,'0' - LD (RTC_PRINT_BUFFER+19),A - -; { Read year } - - CALL RTC_RD ; read value from DS1302, value is in Reg C - - ; digit 01 - LD A,C ; put value output in Reg C into accumulator - RLC A - RLC A - RLC A - RLC A - AND $0F - ADD A,'0' - LD (RTC_PRINT_BUFFER+00),A - - ; digit 02 - LD A,C ; put value output in Reg C into accumulator - AND $0F - ADD A,'0' - LD (RTC_PRINT_BUFFER+01),A - - ; digit 03 - LD A,'-' - LD (RTC_PRINT_BUFFER+02),A - - CALL RTC_RESET_ON ; turn RTC reset back on - EI ; re-enable interrupts - - RET ; Yes, end function and return - - -; function RTC_SET_NOW -; uses A, D, E -; -; based on following algorithm -; -; { Set time to 96-02-18 19:43:00 } -; PROCEDURE rtc_set_now; -; BEGIN -; rtc_wr_unprotect(); -; { Set seconds } -; rtc_write(0,0); -; { Set minutes } -; rtc_write(1,$43); -; { Set hours } -; rtc_write(2,$19); -; { Set date } -; rtc_write(3,$18); -; { Set month } -; rtc_write(4,$02); -; { Set day } -; rtc_write(5,$07); -; { Set year } -; rtc_write(6,$96); -; rtc_wr_protect(); -; END; - -RTC_SET_NOW: -; set time to 07-02-23 19:45:00-05 <-Friday - CALL RTC_WR_UNPROTECT -; seconds - LD D,$00 - LD A,(SECONDS) - LD E,A - CALL RTC_WRITE - -; minutes - LD D,$01 - LD A,(MINUTES) - LD E,A - CALL RTC_WRITE - -; hours - LD D,$02 - LD A,(HOURS) - LD E,A - CALL RTC_WRITE - -; date - LD D,$03 - LD A,(DATE) - LD E,A - CALL RTC_WRITE - -; month - LD D,$04 - LD A,(MONTH) - LD E,A - CALL RTC_WRITE - -; day - LD D,$05 - LD A,(DAY) - LD E,A - CALL RTC_WRITE - -; year - LD D,$06 - LD A,(YEAR) - LD E,A - CALL RTC_WRITE - - CALL RTC_WR_PROTECT - RET - -RTC_INIT_NOW: -; set time to Current Time - -; year - LD DE,RTC_TOP_LOOP1_INIT_YEAR - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL HEXIN - LD (YEAR),A - -; month - LD DE,RTC_TOP_LOOP1_INIT_MONTH - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL HEXIN - LD (MONTH),A - -; date - LD DE,RTC_TOP_LOOP1_INIT_DATE - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL HEXIN - LD (DATE),A - -; hours - LD DE,RTC_TOP_LOOP1_INIT_HOURS - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL HEXIN - LD (HOURS),A - -; minutes - LD DE,RTC_TOP_LOOP1_INIT_MINUTES - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL HEXIN - LD (MINUTES),A - -; seconds - LD DE,RTC_TOP_LOOP1_INIT_SECONDS - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL HEXIN - LD (SECONDS),A - -; day - LD DE,RTC_TOP_LOOP1_INIT_DAY - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL HEXIN - LD (DAY),A - - RET - - -; function RTC_RESTART -; -; uses A, D, E, -; -; based on the following algorithm -; -; { Restart clock, set seconds to 00 } -; PROCEDURE rtc_restart; -; BEGIN -; rtc_wr_unprotect(); -; { Set seconds } -; rtc_write(0,0); -; rtc_wr_protect(); -; END; - -RTC_RESTART: - CALL RTC_WR_UNPROTECT - LD D,$00 - LD E,$00 - CALL RTC_WRITE - CALL RTC_WR_PROTECT - RET - - -; function RTC_CHARGE_ENABLE -; -; uses A, D, E -; -; based on following algorithm -; -; PROCEDURE rtc_charge_enable; -; BEGIN -; rtc_wr_unprotect(); -; { Enable trickle charger, 2kohm, 1 diode } -; rtc_write(8,$A5); -; rtc_wr_protect(); -; END; -; -; Trickle Charge Current: -; -; Imax = (5.0V - (0.7 * Ndiode)) / R -; (5.0 - (0.7 * 1)) / 2000 = .00215A = 2.15 milliamps -; (5.0 - (0.7 * 1)) / 8000 = 0.0005375A = .537 milliamps -; - -RTC_CHARGE_ENABLE - CALL RTC_WR_UNPROTECT - LD D,$08 - LD E,$A5 - CALL RTC_WRITE - CALL RTC_WR_PROTECT - RET - - -; function RTC_CHARGE_DISABLE -; -; uses A, D, E -; -; based on following algorithm -; -; PROCEDURE rtc_charge_disable; -; BEGIN -; rtc_wr_unprotect(); -; { Disable trickle charger} -; rtc_write(8,$00); -; rtc_wr_protect(); -; END; - -RTC_CHARGE_DISABLE - CALL RTC_WR_UNPROTECT - LD D,$08 - LD E,$00 - CALL RTC_WRITE - CALL RTC_WR_PROTECT - RET - - -; function TEST_BIT_DELAY -; -; based on the following algorithm -; -; -; PROCEDURE test_bit_delay(); -; var -; i,t0,t1 : int; -; BEGIN -; putln("Testing bit delay..."); -; t0 := sys_time(); -; for i := 0 while i < 1000 do inc(i) loop -; rtc_bit_delay(); -; end loop; -; t1 := sys_time(); -; putln(i," rtc_bit_delay calls took ",t1-t0," ms."); -; END; - -RTC_TEST_BIT_DELAY - LD DE,TESTING_BIT_DELAY_MSG - LD C,09H ; CP/M write string to console call - CALL 0005H - LD C,01H ; CP/M console input call - CALL 0005H - - ; test should take approximately 43 seconds based on the following code analysis - ; of Z80 T-states on a 4 MHz processor - ; =(4+15*(7+255*(7+255*(17+144+4+10)+4+10)+10)+7)/4/1000000 - - LD B,$0F -PAUSE: - LD C,$FF -PAUSE1: - LD A,$FF ; ADJUST THE TIME 13h IS FOR 4 MHZ -PAUSE2: - CALL RTC_BIT_DELAY ; CAUSE 36uS DELAY - DEC A ; DEC COUNTER. - JP NZ,PAUSE2 ; JUMP TO PAUSE2 IF A <> 0. - DEC C ; DEC COUNTER - JP NZ,PAUSE1 ; JUMP TO PAUSE1 IF C <> 0. - DJNZ PAUSE ; JUMP TO PAUSE IF B <> 0. - - LD DE,TESTING_BIT_DELAY_OVER - LD C,09H ; CP/M write string to console call - CALL 0005H - RET - - -; function RTC_HELP -; -; based on following algorithm -; -; PROCEDURE help(); -; BEGIN -; putln(); -; putln("rtc: ",version); -; putln("rtc: Commands: (E)xit (T)ime st(A)rt (S)et (R)aw (L)oop (C)harge (N)ocharge (H)elp"); -; END; - -RTC_HELP - LD DE,RTC_HELP_MSG - LD C,09H ; CP/M write string to console call - CALL 0005H - RET - -; function RTC_INIT -; -; Determine RTC port based on hardware platform -; and record it dynamically in code (see RTC_IN and RTC_OUT). -; - -RTC_INIT: - CALL IDBIO ; Id BIOS, 1=HBIOS, 2=UBIOS - DEC A ; Test for HBIOS - JR Z,HINIT ; Do HBIOS setup - DEC A ; Test for UBIOS - JR Z,UINIT ; Do UBIOS setup -; - ; Neither UNA nor RomWBW - LD DE,BIOERR ; BIOS error message - LD C,9 ; BDOS string display function - CALL BDOS ; Do it - JP 0 ; Bail out! -; -HINIT: -; - ; Display RomWBW notification string - LD DE,HBTAG ; BIOS notification string - LD C,9 ; BDOS string display function - CALL BDOS ; Do it -; - ; Get platform id from RomWBW HBIOS - LD B,0F1H ; HBIOS VER function 0xF1 - LD C,0 ; Required reserved value - RST 08 ; Do it, L := Platform ID - LD A,L ; Move to A -; - ; Assign correct port to C - LD C,PORT_SBC - LD DE,PLT_SBC - CP $01 ; SBC - JR Z,RTC_INIT2 - CP $02 ; ZETA - JR Z,RTC_INIT2 - CP $03 ; ZETA 2 - JR Z,RTC_INIT2 - LD C,PORT_N8 - LD DE,PLT_N8 - CP $04 ; N8 - JR Z,RTC_INIT2 - LD C,PORT_MK4 - LD DE,PLT_MK4 - CP $05 ; Mark IV - JR Z,RTC_INIT2 - LD C,PORT_RCZ80 - LD DE,PLT_RCZ80 - CP $07 ; RC2014 w/ Z80 - JR Z,RTC_INIT2 - LD C,PORT_RCZ180 - LD DE,PLT_RCZ180 - CP $08 ; RC2014 w/ Z180 - JR Z,RTC_INIT2 - LD C,PORT_SCZ180 - LD DE,PLT_SCZ180 - CP $0A ; SCZ180 - JR Z,RTC_INIT2 - ;LD C,PORT_EZZ80 - ;LD DE,PLT_EZZ80 - ;CP $09 ; Easy Z80 - ;JR Z,RTC_INIT2 -; - ; Unknown platform - LD DE,PLTERR ; BIOS error message - LD C,9 ; BDOS string display function - CALL BDOS ; Do it - JP 0 ; Bail out! -; -UINIT: - ;; Display UNA notification string - ;LD DE,UBTAG ; BIOS notification string - ;LD C,9 ; BDOS string display function - ;CALL BDOS ; Do it -; - ; Notify UNA not supported at present - LD DE,UBERR ; BIOS not support message - LD C,9 ; BDOS string display function - CALL BDOS ; Do it - JP 0 ; Bail out! - -RTC_INIT2: - ; Record port number in code routines - LD A,C - LD (INP),A - LD (OUTP),A -; - ; Display platform - LD C,9 ; BDOS string display function - CALL BDOS ; Do it - RET - -; -; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 -; -IDBIO: -; - ; Check for UNA (UBIOS) - LD A,(0FFFDH) ; fixed location of UNA API vector - CP 0C3H ; jp instruction? - JR NZ,IDBIO1 ; if not, not UNA - LD HL,(0FFFEH) ; get jp address - LD A,(HL) ; get byte at target address - CP 0FDH ; first byte of UNA push ix instruction - JR NZ,IDBIO1 ; if not, not UNA - INC HL ; point to next byte - LD A,(HL) ; get next byte - CP 0E5H ; second byte of UNA push ix instruction - JR NZ,IDBIO1 ; if not, not UNA, check others - LD A,2 ; UNA BIOS id = 2 - RET ; and done -; -IDBIO1: - ; Check for RomWBW (HBIOS) - LD HL,(0FFFEH) ; HL := HBIOS ident location - LD A,'W' ; First byte of ident - CP (HL) ; Compare - JR NZ,IDBIO2 ; Not HBIOS - INC HL ; Next byte of ident - LD A,~'W' ; Second byte of ident - CP (HL) ; Compare - JR NZ,IDBIO2 ; Not HBIOS - LD A,1 ; HBIOS BIOS id = 1 - RET ; and done -; -IDBIO2: - ; No idea what this is - XOR A ; Setup return value of 0 - RET ; and done - - -; function RTC_TOP_LOOP -; -; based on following algorithm -; -; PROCEDURE toploop(); -; var -; err,i,n,fd : int; -; BEGIN -; putln(); -; help(); -; rtc_reset_on(); -; hold(100); -; test_bit_delay(); -; rtc_charge_disable(); -; putln("rtc: trickle charger disabled."); -; loop -; put("rtc>"); -; gets(line); -; if line = "exit" then -; putln("Bye."); -; exit(0); -; elsif line = "charge" then -; putln("Trickle charger enabled."); -; rtc_charge_enable(); -; elsif line = "nocharge" then -; putln("Trickle charger disabled."); -; rtc_charge_disable(); -; elsif line = "start" then -; rtc_restart(); -; putln("Restarting RTC"); -; elsif line = "t" then -; rtc_get_time(line); -; putln("Current time: ",line); -; elsif line = "raw" then -; putln(); -; putln("Raw read loop, hit any key to stop..."); -; while read(0,@n,1 + RD_NOWAIT) = 0 loop -; put(#13,"sec=",hexstr(rtc_read(0))^); -; put(" min=",hexstr(rtc_read(1))^); -; hold(500); -; end loop; -; elsif line = "loop" then -; putln(); -; putln("Clock loop, hit any key to stop..."); -; while read(0,@n,1 + RD_NOWAIT) = 0 loop -; rtc_get_time(line); -; put(#13,line); -; hold(200); -; end loop; -; elsif line = "set" then -; putln("Setting RTC time to 96-02-18 19:43:00"); -; rtc_set_now(); -; elsif (line = "help") or (line = "?") then -; help(); -; elsif length(line) <> 0 then -; putln("You typed: """,line,""""); -; end; -; end loop; -; END toploop; -; Note:above code is not fully in sync with current menu code - -RTC_TOP_LOOP: - CALL RTC_RESET_ON - CALL RTC_BIT_DELAY - CALL RTC_BIT_DELAY - CALL RTC_BIT_DELAY - - LD A,(FCB+1) ; If there a command line tail - CP '/' ; get the command and feed it - LD A,(FCB+2) ; into the input stream - JR Z,RTC_UCL - - LD DE,CRLF_MSG - LD C,09H ; CP/M write string to console call - CALL 0005H - - CALL RTC_HELP - -RTC_TOP_LOOP_1: - LD DE,RTC_TOP_LOOP1_PROMPT - LD C,09H ; CP/M write string to console call - CALL 0005H - - LD C,01H ; CP/M console input call - CALL 0005H -RTC_UCL: - AND %01011111 ; handle lower case responses to menu - - CP 'L' - JP Z,RTC_TOP_LOOP_LOOP - - CP 'R' - JP Z,RTC_TOP_LOOP_RAW - - CP 'G' - JP Z,RTC_TOP_LOOP_GET - - CP 'P' - JP Z,RTC_TOP_LOOP_PUT - - CP 'E' -; JP Z,RTC_TOP_LOOP_EXIT - RET Z - - CP 'H' - JP Z,RTC_TOP_LOOP_HELP - - CP 'D' - JP Z,RTC_TOP_LOOP_DELAY - - CP 'B' - JP Z,RTC_TOP_LOOP_BOOT - - CP 'C' - JP Z,RTC_TOP_LOOP_CHARGE - - CP 'N' - JP Z,RTC_TOP_LOOP_NOCHARGE - - CP 'A' - JP Z,RTC_TOP_LOOP_START - - CP 'S' - JP Z,RTC_TOP_LOOP_SET - - CP 'I' - JP Z,RTC_TOP_LOOP_INIT - - CP 'T' - JP Z,RTC_TOP_LOOP_TIME - - LD DE,CRLF_MSG - LD C,09H ; CP/M write string to console call - CALL 0005H - - JR RTC_TOP_LOOP_1 - -;RTC_TOP_LOOP_EXIT: -; RET - -RTC_TOP_LOOP_HELP: - CALL RTC_HELP - JP RTC_TOP_LOOP_1 - -RTC_TOP_LOOP_DELAY: - CALL RTC_TEST_BIT_DELAY - JP RTC_TOP_LOOP_1 - -RTC_TOP_LOOP_BOOT: - LD DE,BOOTMSG ; BOOT message - LD C,9 ; BDOS string display function - CALL BDOS ; Do it - ; WAIT FOR MESSAGE TO BE DISPLAYED - LD HL,10000 -DELAY_LOOP: ; LOOP IS 26TS - DEC HL ; 6TS - LD A,H ; 4TS - OR L ; 4TS - JR NZ,DELAY_LOOP ; 12TS - LD A,BID_BOOT ; BOOT BANK - LD HL,0 ; ADDRESS ZERO - CALL HB_BNKCALL ; DOES NOT RETURN - -RTC_TOP_LOOP_CHARGE: - LD DE,RTC_TOP_LOOP1_CHARGE - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL RTC_CHARGE_ENABLE - LD A,(FCB+1) ; If we came from the - CP '/' ; command line - RET Z ; exit back to CP/M - JP RTC_TOP_LOOP_1 - -RTC_TOP_LOOP_NOCHARGE: - LD DE,RTC_TOP_LOOP1_NOCHARGE - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL RTC_CHARGE_DISABLE - LD A,(FCB+1) ; If we came from the - CP '/' ; command line - RET Z ; exit back to CP/M - JP RTC_TOP_LOOP_1 - -RTC_TOP_LOOP_START: - LD DE,RTC_TOP_LOOP1_START - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL RTC_RESTART - JP RTC_TOP_LOOP_1 - -RTC_TOP_LOOP_SET: - LD DE,RTC_TOP_LOOP1_SET - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL RTC_SET_NOW - JP RTC_TOP_LOOP_1 - -RTC_TOP_LOOP_INIT: - LD DE,RTC_TOP_LOOP1_INIT - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL RTC_INIT_NOW - JP RTC_TOP_LOOP_1 - -RTC_TOP_LOOP_TIME: - LD DE,RTC_TOP_LOOP1_TIME - LD C,09H ; CP/M write string to console call - CALL 0005H - CALL RTC_GET_TIME - LD DE,RTC_PRINT_BUFFER - LD C,09H ; CP/M write string to console call - CALL 0005H - LD A,(FCB+1) ; If we came from the - CP '/' ; command line - RET Z ; exit back to CP/M - JP RTC_TOP_LOOP_1 - -RTC_TOP_LOOP_RAW: - LD DE,RTC_TOP_LOOP1_RAW - LD C,09H ; CP/M write string to console call - CALL 0005H -RTC_TOP_LOOP_RAW1: - -; { Read seconds } - LD D,$00 ; seconds register in DS1302 - CALL RTC_READ ; read value from DS1302, value is in Reg C - - ; digit 16 - LD A,C ; put value output in Reg C into accumulator - RLC A - RLC A - RLC A - RLC A - AND $07 - ADD A,'0' - LD (RTC_PRINT_BUFFER+15),A - - ; digit 17 - LD A,C ; put value output in Reg C into accumulator - AND $0F - ADD A,'0' - LD (RTC_PRINT_BUFFER+16),A - -; { Read minutes } - - LD D,$01 ; minutes register in DS1302 - CALL RTC_READ ; read value from DS1302, value is in Reg C - - ; digit 13 - LD A,C ; put value output in Reg C into accumulator - RLC A - RLC A - RLC A - RLC A - AND $07 - ADD A,'0' - LD (RTC_PRINT_BUFFER+12),A - - ; digit 14 - LD A,C ; put value output in Reg C into accumulator - AND $0F - ADD A,'0' - LD (RTC_PRINT_BUFFER+13),A - - ; digit 15 - LD A,':' - LD (RTC_PRINT_BUFFER+14),A - - ; digits 1-12 and 18-20 are spaces - LD A,' ' ; space - LD (RTC_PRINT_BUFFER+19),A - LD (RTC_PRINT_BUFFER+18),A - LD (RTC_PRINT_BUFFER+17),A - LD (RTC_PRINT_BUFFER+11),A - LD (RTC_PRINT_BUFFER+10),A - LD (RTC_PRINT_BUFFER+09),A - LD (RTC_PRINT_BUFFER+08),A - LD (RTC_PRINT_BUFFER+07),A - LD (RTC_PRINT_BUFFER+06),A - LD (RTC_PRINT_BUFFER+05),A - LD (RTC_PRINT_BUFFER+04),A - LD (RTC_PRINT_BUFFER+03),A - LD (RTC_PRINT_BUFFER+02),A - LD (RTC_PRINT_BUFFER+01),A - LD (RTC_PRINT_BUFFER+00),A - - LD DE,RTC_PRINT_BUFFER - LD C,09H ; CP/M write string to console call - CALL 0005H - - LD C,01H ; CP/M console input call - CALL 0005H - - CP ' ' ; space - JP Z,RTC_TOP_LOOP_RAW1 - - JP RTC_TOP_LOOP_1 - -RTC_TOP_LOOP_LOOP: - LD DE,RTC_TOP_LOOP1_LOOP - LD C,09H ; CP/M write string to console call - CALL 0005H - -RTC_TOP_LOOP_LOOP1: - CALL RTC_GET_TIME - - LD DE,RTC_PRINT_BUFFER - LD C,09H ; CP/M write string to console call - CALL 0005H - - LD C,01H ; CP/M console input call - CALL 0005H - - CP ' ' - JP Z,RTC_TOP_LOOP_LOOP1 - - JP RTC_TOP_LOOP_1 - -RTC_TOP_LOOP_PUT: - LD A,$01 ; set PUT as true - LD (GET_PUT),A -RTC_TOP_LOOP_GET: - LD DE,RTC_TOP_LOOP1_GET - LD C,09H ; CP/M write string to console call - CALL 0005H - - CALL HEXIN ; read NVRAM address - LD (PUT_ADR),A ; store for possible PUT later - -; { Read NVRAM address } - LD D,A ; seconds register in DS1302 - CALL RTC_READ ; read value from DS1302, value is in Reg C - - ; first digit - LD A,C ; put value output in Reg C into accumulator - RLC A - RLC A - RLC A - RLC A - AND $0F - CP 0AH ;TEST FOR NUMERIC & convert to ASCII - JR C,NUM1 ;if not ALPHA, its numeric and skip - ADD A,$07 - -NUM1: ADD A,'0' - LD (RTC_GET_BUFFER),A - - ; second digit - LD A,C ; put value output in Reg C into accumulator - AND $0F - CP 0AH ;TEST FOR NUMERIC & convert to ASCII - JR C,NUM2 ;if not ALPHA, its numeric and skip - ADD A,$07 - -NUM2: ADD A,'0' - LD (RTC_GET_BUFFER+1),A - - LD DE,CRLF_MSG - LD C,09H ; CP/M write string to console call - CALL 0005H - - LD DE,RTC_GET_BUFFER - LD C,09H ; CP/M write string to console call - CALL 0005H - - LD A,(GET_PUT) ; check if GET or PUT mode - CP $00 - JP Z,RTC_GET_PUT_EXIT ; if GET mode, exit - - LD DE,RTC_TOP_LOOP1_PUT - LD C,09H ; CP/M write string to console call - CALL 0005H - -; { Write NVRAM address } - - CALL RTC_WR_UNPROTECT - - CALL HEXIN ; read NVRAM address - LD E,A ; new data for NVRAM register in DS1302 - LD A,(PUT_ADR) - LD D,A ; load address from before - - CALL RTC_WRITE ; read value from DS1302, value is in Reg C - - CALL RTC_WR_PROTECT - -RTC_GET_PUT_EXIT: - LD A,$00 ; reset GET mode - LD (GET_PUT),A - JP RTC_TOP_LOOP_1 - -; -; Text Strings -; - -MSG: - .TEXT "Start RTC Program" -CRLF_MSG: - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; Line terminator - -TESTING_BIT_DELAY_MSG: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Testing bit delay. Successful test is ~43 sec." - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Start clock and press space bar." - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; Line terminator - -TESTING_BIT_DELAY_OVER: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Test complete. Stop clock." - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; Line terminator - -RTC_HELP_MSG: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "RTC: Version 1.5" - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Commands: E)xit T)ime st(A)rt S)et R)aw L)oop C)harge N)ocharge D)elay I)nit G)et P)ut B)oot H)elp" - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_PROMPT: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "RTC>" - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_CHARGE: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Trickle charger enabled." - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_NOCHARGE: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Trickle charger disabled." - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_START: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Restart RTC." - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_TIME: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Current time: " - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_RAW: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Raw read Loop. Press SPACE BAR for next." - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_LOOP: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Clock Loop. Press SPACE BAR for next." - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_SET: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Set RTC time." - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_INIT: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Init date/time." - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_GET: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "Get NVRAM addr:" - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_PUT: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "NVRAM data:" - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_INIT_SECONDS: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "SECONDS:" - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_INIT_MINUTES: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "MINUTES:" - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_INIT_HOURS: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "HOURS:" - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_INIT_DATE: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "DATE:" - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_INIT_MONTH: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "MONTH:" - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_INIT_DAY: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "DAY:" - .DB "$" ; Line terminator - -RTC_TOP_LOOP1_INIT_YEAR: - .DB 0Ah, 0Dh ; line feed and carriage return - .TEXT "YEAR:" - .DB "$" ; Line terminator - -RTC_PRINT_BUFFER: - .FILL 20,0 ; Buffer for formatted date & time to print - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; line terminator - -RTC_GET_BUFFER: - .FILL 2,0 ; Buffer for formatted NVRAM data to print - .DB 0Ah, 0Dh ; line feed and carriage return - .DB "$" ; line terminator - -BIOERR .TEXT "\r\nUnknown BIOS, aborting...\r\n$" -PLTERR .TEXT "\r\n\r\nUnknown/unsupported hardware platform, aborting...\r\n$" -UBERR .TEXT "\r\nUNA UBIOS is not currently supported, aborting...\r\n$" -HBTAG .TEXT "RomWBW HBIOS$" -UBTAG .TEXT "UNA UBIOS" -BOOTMSG .TEXT "\r\n\r\nRebooting...$" -PLT_SBC .TEXT ", SBC/Zeta RTC Latch Port 0x70\r\n$" -PLT_N8 .TEXT ", N8 RTC Latch Port 0x88\r\n$" -PLT_MK4 .TEXT ", Mark 4 RTC Latch Port 0x8A\r\n$" -PLT_RCZ80 .TEXT ", RC2014 Z80 RTC Module Latch Port 0xC0\r\n$" -PLT_RCZ180 .TEXT ", RC2014 Z180 RTC Module Latch Port 0x0C\r\n$" -PLT_SCZ180 .TEXT ", SC Z180 RTC Module Latch Port 0x0C\r\n$" -PLT_EZZ80 .TEXT ", Easy Z80 RTC Module Latch Port 0xC0\r\n$" - -; -; Generic FOR-NEXT loop algorithm -; -; LD A,$00 ; set A=0 index counter of FOR loop -;FOR_LOOP: -; PUSH AF ; save accumulator as it is the index counter in FOR loop -; { contents of FOR loop here } ; setup RTC with RST and RD high, SCLK low -; POP AF ; recover accumulator as it is the index counter in FOR loop -; INC A ; increment A in FOR loop (A=A+1) -; CP $08 ; is A < $08 ? -; JP NZ,FOR_LOOP ; No, do FOR loop again -; RET ; Yes, end function and return. Read RTC value is in C - -YEAR .DB $18 -MONTH .DB $11 -DATE .DB $08 -HOURS .DB $00 -MINUTES .DB $00 -SECONDS .DB $00 -DAY .DB $05 -GET_PUT .DB $00 - -PUT_ADR .DB 0 - - .END - diff --git a/Source/Apps/Survey.asm b/Source/Apps/Survey.asm deleted file mode 100644 index 33c71236..00000000 --- a/Source/Apps/Survey.asm +++ /dev/null @@ -1,725 +0,0 @@ -;***************************************; -; ; -; S U R V E Y ; -; ; -;***************************************; - -;By Michael Friese 9/22/79 - - -;* Lists Kbytes used and remaining plus number of files -; on all logged disks (up to 8) -;* Prints Memory map and synopsis of all machine memory -;* Lists all active I/O Ports -;* Uses disk allocation block for all disk calculations -; -;VERSION LIST - Most recent version first. -; -;16/Dec/17 - Handle 16-bit port addressing using -; Z80 IN A,(C) instruction. Wayne Warthen -; -;06/Jul/82 - Added Godbout DISK 1 equate and added SKIP equate -; Bill Bolton - Software Tools, Australia -; -;01/Jun/82 - Tidied up and fixed port display, added display -; of contents of low memory. David Bennett - Alfred -; Hospital, Australia -; -;29/Jun/80 - Added version number test and calculations for CP/M -; version 2 compatibility. This program should now work -; properly on all versions 1.4 and later. BRR -; -;28/Jun/80 - Added IMS400 equate (prevents Industrial Micro Systems -; controller from hanging up during port scan). BRR -; -;24/Jun/80 - Removed MACLIB statement, included required macros -; in source. Bruce R. Ratoff -; - -;*******************************; -; SYSTEM MACROS ; -;*******************************; -;Increments 16 bit memory location X -INXI MACRO X - LOCAL JUST8 - PUSH H - LXI H,X - INR M - JNZ JUST8 - INX H - INR M -JUST8: - POP H - ENDM -;.............................................................. -; -; SAVE MACRO SAVE SPECIFIED REGISTERS -; -; SAVE R1,R2,R3,R4 -; -; R1-R4 MAY BE B,D,H OR PSW SAVED IN ORDER SPECIFIED -; IF REGS ARE OMITTED SAVE B,D AND H -; -SAVE MACRO R1,R2,R3,R4 - IF NOT NUL R1&R2&R3&R4 - IRP R,<,,,> - IF NUL R - EXITM - ENDIF - PUSH R - ENDM - ELSE - IRPC REG,BDH - PUSH REG - ENDM - ENDIF - ENDM -; -; . . . . . . . . . . . . . . . . . . . . . . . . . . . . -; -; RESTORE MACRO RESTORE REGISTERS (INVERSE OF SAVE) -; -; RESTORE R1,R2,R3,R4 -; -; R1-R4 MAY BE B,D,H OR PSW RESTORED IN ORDER SPECIFIED -; IF REGS OMITTED RESTORE H,D AND B -; -RESTORE MACRO R1,R2,R3,R4 - IF NOT NUL R1&R2&R3&R4 - IRP R,<,,,> - IF NUL R - EXITM - ENDIF - POP R - ENDM - ELSE - IRPC REG,HDB - POP REG - ENDM - ENDIF - ENDM -; -;.............................................................. -; -; CHAROUT MACRO CONSOLE OUTPUT FROM A -; -; CHAROUT ADDR -; -CHAROUT MACRO ADDR - IF NOT NUL ADDR - LDA ADDR - ENDIF - MVI C,2 ;;CONOUT - MOV E,A ;;CHAR TO E - CALL 5 ;;CALL BDOS - ENDM -; -; -;............................................................. -; -; DECOUT MACRO CONVERT A POSITIVE INTEGER TO DECIMAL AND OUTPUT -; TO THE CONSOLE. -; -; DECOUT ADDR -; -; IF ADDR OMITTED, NUMBER ASSUMED TO BE IN HL, ELSE LOADED TO HL -; LEADING ZEROS SUPRESSED. MAXIMUM NUMBER 65,767 -; -DECOUT MACRO ADDR - LOCAL ENDDEC,DX - JMP ENDDEC -@DECOUT: - SAVE ;;PUSH STACK - LXI B,-10 ;;RADIX FOR CONVERSION - LXI D,-1 ;;THIS BECOMES NO DIVIDED BY RADIX -DX: - DAD B ;;SUBTRACT 10 - INX D - JC DX - LXI B,10 - DAD B ;;ADD RADIX BACK IN ONCE - XCHG - MOV A,H - ORA L ;;TEST FOR ZERO - CNZ @DECOUT ;;RECURSIVE CALL - MOV A,E - ADI '0' ;;CONVERT FROM BCD TO HEX - MOV E,A ;;TO E FOR OUTPUT - CHAROUT ;;CONSOLE OUTPUT - RESTORE ;;POP STACK - RET -ENDDEC: -DECOUT MACRO ?ADDR - IF NOT NUL ?ADDR - LHLD ?ADDR - ENDIF - CALL @DECOUT ;;CALL THE SUBROUTINE - ENDM - DECOUT ADDR - ENDM -; -; -;.............................................................. -; -; HEXOUT MACRO CONVERT BINARY NO AND OUTPUT TO CONSOLE -; -; HEXOUT ADDR -; -; NUMBER ASSUMED IN A IF NO ARGUMENT -; -HEXOUT MACRO ADDR - LOCAL OUTCHR,HEXEND - JMP HEXEND -HEXPRN: - SAVE PSW - RRC - RRC - RRC - RRC ;;SHIFT RIGHT 4 - CALL OUTCHR - RESTORE PSW -OUTCHR: - ANI 0FH ;;MASK 4 BITS - ADI 90H ;;ADD OFFSET - DAA ;;DEC ADJUST - ACI 40H ;;ADD OFFSET - DAA ;;DEC ADJUST - MOV E,A ;;TO E FOR OUTPUT - MVI C,2 ;;CONOUT - JMP 5 ;;CALL BDOS -HEXEND: - -HEXOUT MACRO ?ADDR - IF NOT NUL ?ADDR - LDA ?ADDR - ENDIF - CALL HEXPRN - ENDM - HEXOUT ADDR - ENDM -; -; - -;*******************************; -; SYSTEM EQUATES ; -;*******************************; -TRUE EQU -1 -FALSE EQU NOT TRUE -TARBEL EQU FALSE ; Tarbell FDC dmb 31-may-82 -IMS400 EQU FALSE ; Industrial Micro Systems FDC -GODBOUT EQU FALSE ; Godbout Disk 1 FDC -GODBAS EQU 0C0H ; Base of Godbout FDC -TARBAS EQU 0F8H ; Base of Tarbell -SKIP EQU TARBEL OR IMS400 OR GODBOUT ; Will be true - ; if any skip needed - IF TARBEL -SKIPORT EQU TARBAS+4 ; Port # to skip if Tarbell FDC - ENDIF - IF IMS400 -SKIPORT EQU 08FH ; Port # to skip if IMS FDC - ENDIF - IF GODBOUT -SKIPORT EQU GODBAS+1 ; Port # to skip if Disk 1 FDC - ENDIF -BDOS EQU 5 ; jump to BDOS -bios equ 0 ; jump to BIOS dmb 1-jun-82 -CRLF EQU 0A0DH ; CR LF sequence -CRLFE EQU 8A0DH ; CR LF with EOL -EOL EQU 80H ; End of line -TAB EQU 'I'-40H ; Tab character -ESC EQU 1BH ; Escape character -TABS EQU 9 ; Tab columns - -;***********************; -; MAIN PROGRAM ; -;***********************; -; - ORG 100H -; -START: - LXI H,0 ; Save stack pointer - DAD SP - SHLD OLDSP - LXI SP,FINIS+64 - CALL TYPE ; Type initial CRLF - DB TAB,TAB,'*** System Survey (December 17) ***' - DW CRLF,CRLFE - -;DISK SURVEY - LXI H,8 ; Init drive counter - MVI C,24 ; Get login vector - PUSH H - CALL BDOS - POP H -ROTBIT: - RAR ; RAR login bit to C - JNC NOTLOG ; Drive not logged - PUSH PSW ; Save login - PUSH H ; and counter - -;Print drive letter - CALL TYPE - DB 'Drive' - DB ' '+EOL - MVI A,'A' ; Get ASCII bias - ADD H ; Add to drive # - MOV E,A ; Print drive letter - CALL TCHR - CALL TYPE ; and colon - DB ':',' '+EOL - POP H ; Restore drive # - PUSH H - -;Print K already allocated - MOV E,H - MVI C,14 ; Log drive - CALL BDOS - MVI C,27 ; Index allocation vect - CALL BDOS - MOV L,A ; Put in decent regs - MOV H,B - PUSH H ; save for later - MVI C,12 ; get version # - CALL BDOS - MOV A,L ; zero if version 1 - ORA A - JNZ V2X ; otherwise, use 2.x style params - LHLD BDOS+1 ; get vers 1 style params - MVI L,3CH - MOV A,M ; get block shift factor - STA BLKSHF - INX H - INX H - MOV L,M ; get max. block number - MVI H,0 - SHLD MAXALL - MVI B,32 ; assume 32 bytes in block map - JMP GETALC ; continue -V2X: - MVI A,'?' ; Use wild user # - STA FCB ; in filename search - MVI C,31 ; Get 2.x parameter block - CALL BDOS - INX H - INX H - MOV A,M ; Get and save ablock shift factor - STA BLKSHF - INX H - INX H - INX H - MOV A,M ; Get maximum block number - INX H ; (double precision) - MOV H,M - MOV L,A - SHLD MAXALL - INX H - MVI B,3 ; map size is (MAXALL+1)/8 -V2SH: - MOV A,H - ORA A ; do 16 bit right shift - RAR - MOV H,A - MOV A,L - RAR - MOV L,A - DCR B ; 3 times - JNZ V2SH - MOV B,L - LDA MAXALL ; allow for leftover bits if any - ANI 3 - JZ GETALC - INR B -GETALC: - POP H - LXI D,0 ; Init group counter -NXBYTE: - MVI C,8 ; Bit counter for byte - MOV A,M ; Get map byte -NXBIT: - RAR ; Rotate to C - JNC NOBIT ; No group allocated - INX D ; Inc group counter -NOBIT: - DCR C ; Dec bit counter - JNZ NXBIT - INX H ; Index next byte - DCR B - JNZ NXBYTE - CALL SHF16 - PUSH H - CALL BINDEC - CALL TYPE - DB 'K bytes in',' '+EOL - -;Print number of files - LXI D,FCB ; Fake file cont block - MVI C,17 ; Search for 1st file - CALL BDOS - LXI H,0 ; File counter -LOOK: - CPI 255 ; Failure - JZ PFILE - ADD A ; File offset times 2 - ADD A ; 4 - ADD A ; 8 - ADD A ; 16 - ADD A ; 32 - ADI 80H ; Make sure it's not a deleted file - MOV E,A - MVI D,0 - LDAX D - CPI 0E5H - JZ LOOK1 - INX H ; Bump file counter -LOOK1: - LXI D,FCB ; Restore FCB - MVI C,18 ; Look for addtl files - PUSH H ; Save file counter - CALL BDOS - POP H - JMP LOOK -PFILE: - CALL BINDEC ; Print # of files - CALL TYPE - DB ' files with',' '+EOL - -;Print K remaining - LHLD MAXALL ; Get number of blocks - XCHG - INX D ; Inc for actual value - CALL SHF16 - XCHG - POP H - MOV A,H ; Ones comp & move - CMA - MOV H,A - MOV A,L - CMA - MOV L,A - INX H ; Twos complement - DAD D ; and subtract - CALL BINDEC ; K remaining - CALL TYPE - DB 'K bytes remaining' - DW CRLFE - -;Set up to print next drive - POP H ; Restore bit counter - POP PSW ; and bitmap byte -NOTLOG: - INR H ; Bump drive counter - DCR L ; Dec bit counter - JNZ ROTBIT - -;MEMORY SURVEY -;Create header -MSURV: - CALL TYPE - DW CRLF - DB 'Memory map:' - DW CRLF - DB '0',TAB,'8',TAB,'16',TAB,'24',TAB,'32' - DB TAB,'40',TAB,'48',TAB,'56',TAB,'64' - DW CRLF - REPT 8 - DB '|',TAB - ENDM - DB '|' - DW CRLF - db ' ' ; dmb 31-May-82 - DB 'T'+EOL - LXI H,RAM - MVI M,LOW 1023 ; Init RAM counter - INX H - MVI M,HIGH 1023 - MVI B,4 ; Clear ROM, EMP -CLREG: - INX H - MVI M,0 - DCR B - JNZ CLREG - LXI H,1024 ; Init memory pointer - MVI C,63 ; K to be checked - -;Start of analysis loop -BEGANA: - LXI D,1024 ; Byte counter - XRA A ; Clear flag bytes - STA RAMF - STA EMPF -ANALP: - MOV A,M ; Get test byte and - MOV B,A ; store for later - CMA - MOV M,A ; Put invertd tst byte - SUB M ; Check for good write - MOV M,B ; Restore orignl data - JNZ NOTMEM ; Wasn't good write - INXI RAM ; Bump memory counter - JMP NEXT ; To next byte - -NOTMEM: - STA RAMF ; Not considered RAM - MVI A,0FFH ; Is it empty space? - SUB B - JNZ NOTEMP ; Inc ROM, set flag - LDA EMPF ; Any non empty space - ANA A ; before here? - JZ NEXT - JMP NOTEM ; To next byte -NOTEMP: - STA EMPF ; Set no empty flag -NOTEM: - INXI ROM -NEXT: - INX H ; Index next byte - DCX D ; Decrement K counter - XRA A - ORA D - ORA E - JNZ ANALP ; K counter not 0 - PUSH B - PUSH H - LDA RAMF ; Is it RAM? - ANA A - JNZ NOTRAM ; No - dcr h ; drop H to make compares right - LDA BDOS+2 ; Is it under BDOS ? - CMP H - JC NOTTPA ; No - CALL TYPE ; Yes, it's TPA - DB 'T'+EOL - JMP NEXTK -NOTTPA: - lda bios+2 ; is it under bios ? - cmp h - jc nbdos - call type ; yes, it's BDOS - db 'C'+eol - jmp nextk -nbdos: - CALL TYPE ; Assume it's BIOS - DB 'B'+EOL - JMP NEXTK -; -NOTRAM: - LDA EMPF ; Is it empty? - ANA A - JZ NOMEM ; Yes, no memory - CALL TYPE ; No, must be ROM - DB 'R'+EOL - JMP NEXTK -NOMEM: - CALL TYPE - DB ' '+EOL -NEXTK: - POP H - POP B - DCR C ; Decrement K counter - JNZ BEGANA - CALL TYPE - DW CRLF - DB 'T=TPA',TAB,'C=CPM',TAB,'B=BIOS or unassigned' - DB TAB,'R=ROM or bad' - DW CRLFE -; -; contents of first page - call type - db 'BIOS at',' '+eol - hexout bios+2 - hexout bios+1 - call type - db tab,'iobyte',' '+eol - hexout bios+3 - call type - db tab,'drive',' '+eol - hexout bios+4 - call type - db tab,'BDOS at',' '+eol - hexout bdos+2 - hexout bdos+1 - call type - dw crlf,crlfe -; -;MEMORY SYNOPSIS - LHLD RAM - PUSH H ; Save RAM - CALL BINDEC ; Type RAM - CALL TYPE - DB ' Bytes RAM',TAB,TAB+EOL - LHLD ROM - PUSH H - CALL BINDEC ; Type ROM - CALL TYPE - DB ' Bytes ROM',TAB,TAB+EOL - LHLD BDOS+1 - CALL BINDEC - CALL TYPE - DB ' Bytes in TPA' - DW CRLFE - POP D ; Get RAM - POP H ; Get RAM - DAD D ; Add 'em - PUSH H ; and save result - LXI D,0 ; Subtract from this - MOV A,H ; Complement 16 bits - CMA - MOV H,A - MOV A,L - CMA - MOV L,A ; 2s comp bias in D - DAD D ; Subtract - CALL BINDEC - CALL TYPE - DB ' Bytes Empty ',TAB+EOL - POP H ; Restore RAM+ROM - CALL BINDEC - CALL TYPE - DB ' Total Active Bytes' - DW CRLF,CRLF - -;PORT SURVEY - DB 'Active I/O ports',':'+EOL - LXI H,1000H ; DELAY SO MESSAGE OUTPUT -PDLY: - DCX H ; DOESN'T GIVE A FALSE READING - MOV A,H ; ON CONSOLE STATUS PORT - ORA L - JNZ PDLY - LXI H,0 ; Init active port counter - mvi d,0 ; Init port counter - mvi e,0ffh ; init port group variable -PORTLP: - MOV A,D - - IF SKIP ; Single port mask - CPI SKIPORT - JZ ISPORT ; Print mask port - ENDIF - - mov c,a ; port number to reg c - mvi b,0 ; for 16 bit port addressing - db 0edh,078h ; z80: in a,(c) -; inactive port could return 0xFF or 0x78 - CPI 0FFH - JZ NEXTPT - cpi 078h - jz nextpt -ISPORT: - mov a,d ; got a live one, probably - ani 0f0h ; is port in same group as last ? - cmp e - jz nocrlf - call type ; no, start a new line - dw crlfe - mov a,d ; save for next time - ani 0f0h - mov e,a -nocrlf: - MOV A,D ; Get port # - PUSH D - PUSH H - HEXOUT - POP H - POP D - INX H ; count another one found - call type - db ' '+eol -NEXTPT: - INR D ; Bump port counter - JNZ PORTLP ; Not done - CALL TYPE ; Done - DW CRLFE - CALL BINDEC - CALL TYPE ; Type Active Ports - DB ' Ports active' - DW CRLFE - CCP: - LHLD OLDSP - SPHL - RET - - -;***********************; -; SUBROUTINES ; -;***********************; - -;Binary to decimal conversion -BINDEC: - DECOUT ; From LIB - RET - -;Types a string of text terminated with bit 7 high -TYPE: - XTHL ; Get string address - PUSH D -TYPELP: - MOV A,M ; Get type data - MOV D,A ; Save for later - ANI 7FH ; Mask ASCII - MOV E,A - PUSH H - PUSH D - CALL TCHR - POP D - POP H - INX H - MVI A,EOL ; End of line bit - ANA D - JP TYPELP ; Not done - POP D - XTHL ; Get return address - RET - -;Types a single character on console -TCHR: - MVI C,2 - JMP BDOS - -;Checks sectors per block and multiplies or divides block size -;Enter with data in D. Result returned in H,L -; -SHF16: - LDA BLKSHF ; Get shift factor (gives block size) - CPI 3 ; Is it 1K (std)? - JNZ NOT3 - MOV L,E ; Yes, use present # -ZH: - MVI H,0 - RET -; -NOT3: - CPI 2 ; Is it minifloppy? - JNZ NOT2 - MOV A,E ; Yes, divide by 2 - RRC - ANI 7FH - MOV L,A - JMP ZH -NOT2: - SUI 3 ; Must be something - MOV B,A ; larger like double - XCHG ; sided or double dens -BITSHF: - DAD H ; 16 bit 2^(B-1) - DCR B - JNZ BITSHF - RET - - -;***********************; -; DATA STORAGE ; -;***********************; - -FCB: DB 0,'???????????',0,0,0 ; File control block - DS 17 ; Extra FCB workspace -OLDSP: DS 2 ; Old stack pointer -RAM: DS 2 ; RAM counter -ROM: DS 2 ; ROM counter -RAMF: DS 1 ; RAM good flag -EMPF: DS 1 ; Empty so far flag -BLKSHF: DS 1 ; block shift factor -MAXALL: DS 2 ; maximum block number -FINIS EQU $ ; End of program - END - \ No newline at end of file diff --git a/Source/Apps/Survey/Build.cmd b/Source/Apps/Survey/Build.cmd new file mode 100644 index 00000000..f8b59a23 --- /dev/null +++ b/Source/Apps/Survey/Build.cmd @@ -0,0 +1,16 @@ +@echo off +setlocal + +set TOOLS=..\..\..\Tools + +set PATH=%TOOLS%\zxcc;%PATH% + +set CPMDIR80=%TOOLS%/cpm/ + +:: zxcc MAC survey.asm -$PO || exit /b +:: zxcc MLOAD25 survey || exit /b + +zxcc M80 -,=survey/L/R +zxcc L80 -survey,survey/N/E + +copy /Y survey.com ..\..\..\Binary\Apps\ || exit /b diff --git a/Source/Apps/Survey/Clean.cmd b/Source/Apps/Survey/Clean.cmd new file mode 100644 index 00000000..14eed93d --- /dev/null +++ b/Source/Apps/Survey/Clean.cmd @@ -0,0 +1,8 @@ +@echo off +setlocal + +if exist *.hex del *.hex +if exist *.rel del *.rel +if exist *.prn del *.prn +if exist *.lst del *.lst +if exist *.com del *.com diff --git a/Source/Apps/Survey/Makefile b/Source/Apps/Survey/Makefile new file mode 100644 index 00000000..5fbf081e --- /dev/null +++ b/Source/Apps/Survey/Makefile @@ -0,0 +1,6 @@ +OBJECTS = survey.com +DEST = ../../../Binary/Apps +TOOLS = ../../../Tools +OTHERS = *.hex + +include $(TOOLS)/Makefile.inc diff --git a/Source/Apps/Survey/survey.mac b/Source/Apps/Survey/survey.mac new file mode 100644 index 00000000..23b2fb9f --- /dev/null +++ b/Source/Apps/Survey/survey.mac @@ -0,0 +1,830 @@ +;***************************************; +; ; +; S U R V E Y ; +; ; +;***************************************; + +;By Michael Friese 9/22/79 + + +;* Lists Kbytes used and remaining plus number of files +; on all logged disks (up to 8) +;* Prints Memory map and synopsis of all machine memory +;* Lists all active I/O Ports +;* Uses disk allocation block for all disk calculations +; +;VERSION LIST - Most recent version first. +; +;10/Feb/23 - Total hack to avoid crash on ECB SBC +; RomWBW now required by this version +; Wayne Warthen +; +;16/Dec/17 - Handle 16-bit port addressing using +; Z80 IN A,(C) instruction. Wayne Warthen +; +;06/Jul/82 - Added Godbout DISK 1 equate and added SKIP equate +; Bill Bolton - Software Tools, Australia +; +;01/Jun/82 - Tidied up and fixed port display, added display +; of contents of low memory. David Bennett - Alfred +; Hospital, Australia +; +;29/Jun/80 - Added version number test and calculations for CP/M +; version 2 compatibility. This program should now work +; properly on all versions 1.4 and later. BRR +; +;28/Jun/80 - Added IMS400 equate (prevents Industrial Micro Systems +; controller from hanging up during port scan). BRR +; +;24/Jun/80 - Removed MACLIB statement, included required macros +; in source. Bruce R. Ratoff +; + +;*******************************; +; SYSTEM MACROS ; +;*******************************; +;Increments 16 bit memory location X +INXI MACRO X + LOCAL JUST8 + PUSH H + LXI H,X + INR M + JNZ JUST8 + INX H + INR M +JUST8: + POP H + ENDM +;.............................................................. +; +; SAVE MACRO SAVE SPECIFIED REGISTERS +; +; SAVE R1,R2,R3,R4 +; +; R1-R4 MAY BE B,D,H OR PSW SAVED IN ORDER SPECIFIED +; IF REGS ARE OMITTED SAVE B,D AND H +; +SAVE MACRO R1,R2,R3,R4 + IF NOT NUL R1&R2&R3&R4 + IRP R,<,,,> + IF NUL R + EXITM + ENDIF + PUSH R + ENDM + ELSE + IRPC REG,BDH + PUSH REG + ENDM + ENDIF + ENDM +; +; . . . . . . . . . . . . . . . . . . . . . . . . . . . . +; +; RESTORE MACRO RESTORE REGISTERS (INVERSE OF SAVE) +; +; RESTORE R1,R2,R3,R4 +; +; R1-R4 MAY BE B,D,H OR PSW RESTORED IN ORDER SPECIFIED +; IF REGS OMITTED RESTORE H,D AND B +; +RESTORE MACRO R1,R2,R3,R4 + IF NOT NUL R1&R2&R3&R4 + IRP R,<,,,> + IF NUL R + EXITM + ENDIF + POP R + ENDM + ELSE + IRPC REG,HDB + POP REG + ENDM + ENDIF + ENDM +; +;.............................................................. +; +; CHAROUT MACRO CONSOLE OUTPUT FROM A +; +; CHAROUT ADDR +; +CHAROUT MACRO ADDR + IF NOT NUL ADDR + LDA ADDR + ENDIF + MVI C,2 ;;CONOUT + MOV E,A ;;CHAR TO E + CALL 5 ;;CALL BDOS + ENDM +; +; +;............................................................. +; +; DECOUT MACRO CONVERT A POSITIVE INTEGER TO DECIMAL AND OUTPUT +; TO THE CONSOLE. +; +; DECOUT ADDR +; +; IF ADDR OMITTED, NUMBER ASSUMED TO BE IN HL, ELSE LOADED TO HL +; LEADING ZEROS SUPRESSED. MAXIMUM NUMBER 65,767 +; +DECOUT MACRO ADDR + LOCAL ENDDEC,DX + JMP ENDDEC +@DECOUT: + SAVE ;;PUSH STACK + LXI B,-10 ;;RADIX FOR CONVERSION + LXI D,-1 ;;THIS BECOMES NO DIVIDED BY RADIX +DX: + DAD B ;;SUBTRACT 10 + INX D + JC DX + LXI B,10 + DAD B ;;ADD RADIX BACK IN ONCE + XCHG + MOV A,H + ORA L ;;TEST FOR ZERO + CNZ @DECOUT ;;RECURSIVE CALL + MOV A,E + ADI '0' ;;CONVERT FROM BCD TO HEX + MOV E,A ;;TO E FOR OUTPUT + CHAROUT ;;CONSOLE OUTPUT + RESTORE ;;POP STACK + RET +ENDDEC: +DECOUT MACRO ?ADDR + IF NOT NUL ?ADDR + LHLD ?ADDR + ENDIF + CALL @DECOUT ;;CALL THE SUBROUTINE + ENDM + DECOUT ADDR + ENDM +; +; +;.............................................................. +; +; HEXOUT MACRO CONVERT BINARY NO AND OUTPUT TO CONSOLE +; +; HEXOUT ADDR +; +; NUMBER ASSUMED IN A IF NO ARGUMENT +; +HEXOUT MACRO ADDR + LOCAL OUTCHR,HEXEND + JMP HEXEND +HEXPRN: + SAVE PSW + RRC + RRC + RRC + RRC ;;SHIFT RIGHT 4 + CALL OUTCHR + RESTORE PSW +OUTCHR: + ANI 0FH ;;MASK 4 BITS + ADI 90H ;;ADD OFFSET + DAA ;;DEC ADJUST + ACI 40H ;;ADD OFFSET + DAA ;;DEC ADJUST + MOV E,A ;;TO E FOR OUTPUT + MVI C,2 ;;CONOUT + JMP 5 ;;CALL BDOS +HEXEND: + +HEXOUT MACRO ?ADDR + IF NOT NUL ?ADDR + LDA ?ADDR + ENDIF + CALL HEXPRN + ENDM + HEXOUT ADDR + ENDM +; +; + +;*******************************; +; SYSTEM EQUATES ; +;*******************************; +TRUE EQU -1 +FALSE EQU NOT TRUE +TARBEL EQU FALSE ; Tarbell FDC dmb 31-may-82 +IMS400 EQU FALSE ; Industrial Micro Systems FDC +GODBOUT EQU FALSE ; Godbout Disk 1 FDC +GODBAS EQU 0C0H ; Base of Godbout FDC +TARBAS EQU 0F8H ; Base of Tarbell +SKIP EQU TARBEL OR IMS400 OR GODBOUT ; Will be true + ; if any skip needed + IF TARBEL +SKIPORT EQU TARBAS+4 ; Port # to skip if Tarbell FDC + ENDIF + IF IMS400 +SKIPORT EQU 08FH ; Port # to skip if IMS FDC + ENDIF + IF GODBOUT +SKIPORT EQU GODBAS+1 ; Port # to skip if Disk 1 FDC + ENDIF +BDOS EQU 5 ; jump to BDOS +bios equ 0 ; jump to BIOS dmb 1-jun-82 +CRLF EQU 0A0DH ; CR LF sequence +CRLFE EQU 8A0DH ; CR LF with EOL +EOL EQU 80H ; End of line +TAB EQU 'I'-40H ; Tab character +ESC EQU 1BH ; Escape character +TABS EQU 9 ; Tab columns + +;***********************; +; MAIN PROGRAM ; +;***********************; +; + ;ORG 100H +; +; +; + .Z80 + LD HL,IMGORG + LD DE,START + LD BC,IMGEND-IMGORG + LDIR + JP START + .8080 +; +IMGORG: +; + .PHASE 8000H +; +START: + LXI H,0 ; Save stack pointer + DAD SP + SHLD OLDSP + LXI SP,FINIS+64 + CALL TYPE ; Type initial CRLF + DW CRLF,CRLF + DB TAB,'*** RomWBW System Survey (Feb 2023) ***' + DW CRLF,CRLFE + +;DISK SURVEY + LXI H,8 ; Init drive counter + MVI C,24 ; Get login vector + PUSH H + CALL BDOS + POP H +ROTBIT: + RAR ; RAR login bit to C + JNC NOTLOG ; Drive not logged + PUSH PSW ; Save login + PUSH H ; and counter + +;Print drive letter + CALL TYPE + DB 'Drive' + DB ' '+EOL + MVI A,'A' ; Get ASCII bias + ADD H ; Add to drive # + MOV E,A ; Print drive letter + CALL TCHR + CALL TYPE ; and colon + DB ':',' '+EOL + POP H ; Restore drive # + PUSH H + +;Print K already allocated + MOV E,H + MVI C,14 ; Log drive + CALL BDOS + MVI C,27 ; Index allocation vect + CALL BDOS + MOV L,A ; Put in decent regs + MOV H,B + PUSH H ; save for later + MVI C,12 ; get version # + CALL BDOS + MOV A,L ; zero if version 1 + ORA A + JNZ V2X ; otherwise, use 2.x style params + LHLD BDOS+1 ; get vers 1 style params + MVI L,3CH + MOV A,M ; get block shift factor + STA BLKSHF + INX H + INX H + MOV L,M ; get max. block number + MVI H,0 + SHLD MAXALL + MVI B,32 ; assume 32 bytes in block map + JMP GETALC ; continue +V2X: + MVI A,'?' ; Use wild user # + STA FCB ; in filename search + MVI C,31 ; Get 2.x parameter block + CALL BDOS + INX H + INX H + MOV A,M ; Get and save ablock shift factor + STA BLKSHF + INX H + INX H + INX H + MOV A,M ; Get maximum block number + INX H ; (double precision) + MOV H,M + MOV L,A + SHLD MAXALL + INX H + MVI B,3 ; map size is (MAXALL+1)/8 +V2SH: + MOV A,H + ORA A ; do 16 bit right shift + RAR + MOV H,A + MOV A,L + RAR + MOV L,A + DCR B ; 3 times + JNZ V2SH + MOV B,L + LDA MAXALL ; allow for leftover bits if any + ANI 3 + JZ GETALC + INR B +GETALC: + POP H + LXI D,0 ; Init group counter +NXBYTE: + MVI C,8 ; Bit counter for byte + MOV A,M ; Get map byte +NXBIT: + RAR ; Rotate to C + JNC NOBIT ; No group allocated + INX D ; Inc group counter +NOBIT: + DCR C ; Dec bit counter + JNZ NXBIT + INX H ; Index next byte + DCR B + JNZ NXBYTE + CALL SHF16 + PUSH H + CALL BINDEC + CALL TYPE + DB 'K bytes in',' '+EOL + +;Print number of files + LXI D,FCB ; Fake file cont block + MVI C,17 ; Search for 1st file + CALL BDOS + LXI H,0 ; File counter +LOOK: + CPI 255 ; Failure + JZ PFILE + ADD A ; File offset times 2 + ADD A ; 4 + ADD A ; 8 + ADD A ; 16 + ADD A ; 32 + ADI 80H ; Make sure it's not a deleted file + MOV E,A + MVI D,0 + LDAX D + CPI 0E5H + JZ LOOK1 + INX H ; Bump file counter +LOOK1: + LXI D,FCB ; Restore FCB + MVI C,18 ; Look for addtl files + PUSH H ; Save file counter + CALL BDOS + POP H + JMP LOOK +PFILE: + CALL BINDEC ; Print # of files + CALL TYPE + DB ' files with',' '+EOL + +;Print K remaining + LHLD MAXALL ; Get number of blocks + XCHG + INX D ; Inc for actual value + CALL SHF16 + XCHG + POP H + MOV A,H ; Ones comp & move + CMA + MOV H,A + MOV A,L + CMA + MOV L,A + INX H ; Twos complement + DAD D ; and subtract + CALL BINDEC ; K remaining + CALL TYPE + DB 'K bytes remaining' + DW CRLFE + +;Set up to print next drive + POP H ; Restore bit counter + POP PSW ; and bitmap byte +NOTLOG: + INR H ; Bump drive counter + DCR L ; Dec bit counter + JNZ ROTBIT + +;MEMORY SURVEY +;Create header +MSURV: + CALL TYPE + DW CRLF + DB 'Memory map:' + DW CRLF + DB '0',TAB,'8',TAB,'16',TAB,'24',TAB,'32' + DB TAB,'40',TAB,'48',TAB,'56',TAB,'64' + DW CRLF + REPT 8 + DB '|',TAB + ENDM + DB '|' + DW CRLF + db ' ' ; dmb 31-May-82 + DB 'T'+EOL + LXI H,RAM + MVI M,LOW 1023 ; Init RAM counter + INX H + MVI M,HIGH 1023 + MVI B,4 ; Clear ROM, EMP +CLREG: + INX H + MVI M,0 + DCR B + JNZ CLREG + LXI H,1024 ; Init memory pointer + MVI C,63 ; K to be checked + +;Start of analysis loop +BEGANA: + LXI D,1024 ; Byte counter + XRA A ; Clear flag bytes + STA RAMF + STA EMPF +ANALP: + MOV A,M ; Get test byte and + MOV B,A ; store for later + CMA + MOV M,A ; Put invertd tst byte + SUB M ; Check for good write + MOV M,B ; Restore orignl data + JNZ NOTMEM ; Wasn't good write + INXI RAM ; Bump memory counter + JMP NEXT ; To next byte + +NOTMEM: + STA RAMF ; Not considered RAM + MVI A,0FFH ; Is it empty space? + SUB B + JNZ NOTEMP ; Inc ROM, set flag + LDA EMPF ; Any non empty space + ANA A ; before here? + JZ NEXT + JMP NOTEM ; To next byte +NOTEMP: + STA EMPF ; Set no empty flag +NOTEM: + INXI ROM +NEXT: + INX H ; Index next byte + DCX D ; Decrement K counter + XRA A + ORA D + ORA E + JNZ ANALP ; K counter not 0 + PUSH B + PUSH H + LDA RAMF ; Is it RAM? + ANA A + JNZ NOTRAM ; No + dcr h ; drop H to make compares right + LDA BDOS+2 ; Is it under BDOS ? + CMP H + JC NOTTPA ; No + CALL TYPE ; Yes, it's TPA + DB 'T'+EOL + JMP NEXTK +NOTTPA: + lda bios+2 ; is it under bios ? + cmp h + jc nbdos + call type ; yes, it's BDOS + db 'C'+eol + jmp nextk +nbdos: + CALL TYPE ; Assume it's BIOS + DB 'B'+EOL + JMP NEXTK +; +NOTRAM: + LDA EMPF ; Is it empty? + ANA A + JZ NOMEM ; Yes, no memory + CALL TYPE ; No, must be ROM + DB 'R'+EOL + JMP NEXTK +NOMEM: + CALL TYPE + DB ' '+EOL +NEXTK: + POP H + POP B + DCR C ; Decrement K counter + JNZ BEGANA + CALL TYPE + DW CRLF + DB 'T=TPA',TAB,'C=CPM',TAB,'B=BIOS or unassigned' + DB TAB,'R=ROM or bad' + DW CRLFE +; +; contents of first page + call type + db 'BIOS at',' '+eol + hexout bios+2 + hexout bios+1 + call type + db tab,'iobyte',' '+eol + hexout bios+3 + call type + db tab,'drive',' '+eol + hexout bios+4 + call type + db tab,'BDOS at',' '+eol + hexout bdos+2 + hexout bdos+1 + call type + dw crlf,crlfe +; +;MEMORY SYNOPSIS + LHLD RAM + PUSH H ; Save RAM + CALL BINDEC ; Type RAM + CALL TYPE + DB ' Bytes RAM',TAB,TAB+EOL + LHLD ROM + PUSH H + CALL BINDEC ; Type ROM + CALL TYPE + DB ' Bytes ROM',TAB,TAB+EOL + LHLD BDOS+1 + CALL BINDEC + CALL TYPE + DB ' Bytes in TPA' + DW CRLFE + POP D ; Get RAM + POP H ; Get RAM + DAD D ; Add 'em + PUSH H ; and save result + LXI D,0 ; Subtract from this + MOV A,H ; Complement 16 bits + CMA + MOV H,A + MOV A,L + CMA + MOV L,A ; 2s comp bias in D + DAD D ; Subtract + CALL BINDEC + CALL TYPE + DB ' Bytes Empty ',TAB+EOL + POP H ; Restore RAM+ROM + CALL BINDEC + CALL TYPE + DB ' Total Active Bytes' + DW CRLF,CRLF + +;PORT SURVEY + DB 'Active I/O ports',':'+EOL + LXI H,1000H ; DELAY SO MESSAGE OUTPUT +PDLY: + DCX H ; DOESN'T GIVE A FALSE READING + MOV A,H ; ON CONSOLE STATUS PORT + ORA L + JNZ PDLY +; + .Z80 + ; record the active bank + ld a,(0ffe0h) ; get current hbios bank id + ld (BANK),a ; and save it + ; Check for Z180 CPU + xor a ; assume Z80 + ld (IS180),a ; save it + ld de,0506H ; 5 x 6 + db 0EDH,05CH ; MLT DE: de = 30 if z180 + ld a,e ; result to A + cp 30 ; check if multiply happened + jr nz,z80 ; if invalid, then Z80 + or 0ffH ; flag value for Z180 + ld (IS180),a ; save it +z80: + .8080 +; + LXI H,0 ; Init active port counter + mvi d,0 ; Init port counter + mvi e,0ffh ; init port group variable +PORTLP: + MOV A,D + + IF SKIP ; Single port mask + CPI SKIPORT + JZ ISPORT ; Print mask port + ENDIF +; + .Z80 + di ; interrupts off + ld a,(IS180) ; Z180? + or a + jr nz,rd180 +; + ; Z80 port read + ; Read port using IN A,(C), push result + ld a,d + ld c,a + ld (pnum0a),a ; dynamic update + ld (pnum0b),a ; dynamic update + ld b,0 + in a,(c) + push af + ; Read port using IN A,(port), push result + in a,(0ffh) ; IN0 +pnum0a equ $-1 + push af + ; Read port using IN A,(port), push result + in a,(0ffh) ; IN0 +pnum0b equ $-1 + push af + jr rdz +; +rd180: + ; Z180 port read + ; Read port using IN A,(C), push result + ld a,d + ld c,a + ld (pnum1a),a ; dynamic update + ld (pnum1b),a ; dynamic update + ld b,0 + in a,(c) + push af + ; Read port using IN0 A,(port), push result + db 0EDH,038H,0FFH ; IN0 +pnum1a equ $-1 + push af + ; Read port using IN0 A,(port), push result + db 0EDH,038H,0FFH ; IN0 +pnum1b equ $-1 + push af +; +rdz: + ; Make sure correct bank is still selected! + push af + ld a,(BANK) + call 0FFF3H + pop af +; + ei ; interrupts back on now +; +; port is considered inactive if values read from different port +; read mechanisms differ or if the value $FF is read consistently, +; or if the value read is equal to the port number itself +; + pop bc ; second IN0 (port) value + pop af ; first IN0 (port) valule + cp b ; same? + pop bc ; IN (C) value + jr nz,ISPORT ; if no, active running ctr port + cp b ; same? + jr nz,NEXTPT ; if not, inactive port + cp 0FFh ; pullup value??? + jr z,NEXTPT ; if so, consider not active + cp d ; value same as port num??? + jr z,NEXTPT ; if so, consider not active +; + .8080 +ISPORT: + mov a,d ; got a live one, probably + ani 0f0h ; is port in same group as last ? + cmp e + jz nocrlf + call type ; no, start a new line + dw crlfe + mov a,d ; save for next time + ani 0f0h + mov e,a +nocrlf: + MOV A,D ; Get port # + PUSH D + PUSH H + HEXOUT + POP H + POP D + INX H ; count another one found + call type + db ' '+eol +NEXTPT: + INR D ; Bump port counter + JNZ PORTLP ; Not done + CALL TYPE ; Done + DW CRLFE + CALL BINDEC + CALL TYPE ; Type Active Ports + DB ' Ports active' + DW CRLFE + CCP: + LHLD OLDSP + SPHL + RET + + +;***********************; +; SUBROUTINES ; +;***********************; + +;Binary to decimal conversion +BINDEC: + DECOUT ; From LIB + RET + +;Types a string of text terminated with bit 7 high +TYPE: + XTHL ; Get string address + PUSH D +TYPELP: + MOV A,M ; Get type data + MOV D,A ; Save for later + ANI 7FH ; Mask ASCII + MOV E,A + PUSH H + PUSH D + CALL TCHR + POP D + POP H + INX H + MVI A,EOL ; End of line bit + ANA D + JP TYPELP ; Not done + POP D + XTHL ; Get return address + RET + +;Types a single character on console +TCHR: + MVI C,2 + JMP BDOS + +;Checks sectors per block and multiplies or divides block size +;Enter with data in D. Result returned in H,L +; +SHF16: + LDA BLKSHF ; Get shift factor (gives block size) + CPI 3 ; Is it 1K (std)? + JNZ NOT3 + MOV L,E ; Yes, use present # +ZH: + MVI H,0 + RET +; +NOT3: + CPI 2 ; Is it minifloppy? + JNZ NOT2 + MOV A,E ; Yes, divide by 2 + RRC + ANI 7FH + MOV L,A + JMP ZH +NOT2: + SUI 3 ; Must be something + MOV B,A ; larger like double + XCHG ; sided or double dens +BITSHF: + DAD H ; 16 bit 2^(B-1) + DCR B + JNZ BITSHF + RET + +;***********************; +; DATA STORAGE ; +;***********************; + +FCB: DB 0,'???????????',0,0,0 ; File control block + DS 17 ; Extra FCB workspace +OLDSP: DS 2 ; Old stack pointer +RAM: DS 2 ; RAM counter +ROM: DS 2 ; ROM counter +RAMF: DS 1 ; RAM good flag +EMPF: DS 1 ; Empty so far flag +BLKSHF: DS 1 ; block shift factor +MAXALL: DS 2 ; maximum block number +BANK: DS 1 ; saved HBIOS bank id +IS180: DS 1 ; non-zero for Z180 CPU +FINIS EQU $ ; End of program +; + .DEPHASE +; +IMGEND: +; + END + \ No newline at end of file diff --git a/Source/Apps/SysCopy.asm b/Source/Apps/SysCopy.asm deleted file mode 100644 index 144f9536..00000000 --- a/Source/Apps/SysCopy.asm +++ /dev/null @@ -1,978 +0,0 @@ -;=============================================================================== -; SysCopy - Copy System Image to/from reserved tracks of disk for RomWBW -; adaptation of CP/M 2.2 & CP/M 3 -;=============================================================================== -; -; Author: Wayne Warthen (wwarthen@gmail.com) -;_______________________________________________________________________________ -; -; Usage: -; SYSCOPY [=] -; -; and may be a drive or a file reference -; If is not specified, the system image will -; be read from the current drive -;_______________________________________________________________________________ -; -; Change Log: -; 2016-04-24 [WBW] Updated to preserve MBR partition table -; 2020-02-17 [WBW] Updated for CP/M 3 -;_______________________________________________________________________________ -; -; ToDo: -; 1) Add option to wait/prompt for disk change -; 2) Allow and to be memory -;_______________________________________________________________________________ -; -;=============================================================================== -; Definitions -;=============================================================================== -; -false .equ 0 ; define true -true .equ ~false ; define false -; -stksiz .equ $40 ; we are a stack pig -; -restart .equ $0000 ; CP/M restart vector -bdos .equ $0005 ; BDOS invocation vector -; -imgbuf .equ $900 ; load point for system image (from original SYSGEN) -mbrbuf .equ imgbuf+$4000 ; load point for MBR storage -; -;=============================================================================== -; Code Section -;=============================================================================== -; - .org $100 - ; setup stack (save old value) - ld (stksav),sp ; save stack - ld sp,stack ; set new stack - ; processing... - call main ; do the real work - call crlf ; formatting - ; return - jp 0 ; return to CP/M via reset - ; - ;ld sp,(stksav) ; restore stack - ;ret ; return to CP/M w/o reset -; -; Main routine -; -main: - call init ; initialize - ret nz ; abort on failure - - call parse ; parse command tail - ret nz ; abort on failure - - call confirm ; confirm pending action - ret nz ; abort on failure - - call crlf ; formatting - - ld de,msgrd - call prtstr ; display "reading" message - call rdimg ; do the image read - ret nz ; abort on failure - - ld de,msgwrt - call prtstr ; display "writing" message - call wrtimg ; do the image write - ret nz ; abort on failure - - ld de,msgdon ; completion message - call prtstr ; display it - - ret -; -; Initialization -; -init: - ; add check for RomWBW? - ; - ; get OS version - ld c,12 ; BDOS get os version - call bdos ; do it, L=version - cp $30 ; Test for v3.0 - jr c,init1 ; if <, pre v3.0 - ld a,true ; OS v3.0 or above - ld (v3os),a ; save it - jr init2 -init1: - ld a,false ; OS < v3.0 - ld (v3os),a ; save it -init2: - ; locate cbios function table address - ld hl,(restart+1) ; load address of CP/M restart vector - ld de,-3 ; adjustment for start of table - add hl,de ; HL now has start of table - ld (cbftbl),hl ; save it - ; save current drive no - ld c,$19 ; bdos func: get current drive - call bdos ; invoke BDOS function - inc a ; 1-based index for fcb - ld (defdrv),a ; save it - ; print version banner - call crlf ; formatting - ld de,msgban1 ; point to version message part 1 - call prtstr ; print it - ld a,(v3os) ; get OS version flag - or a ; set flags - ld de,msgv2 ; point to V2 mode message - call z,prtstr ; if V2, say so - ld de,msgv3 ; point to V3 mode message - call nz,prtstr ; if V3, say so - call crlf ; formatting - ld de,msgban2 ; point to version message part 2 - call prtstr ; print it - call crlf ; formatting - ; return success - xor a - ret -; -; Parse command tail -; -parse: - ld hl,$81 ; point to start of command tail (after length byte) - call nonblank ; locate start of parms - jp z,erruse ; no parms - ld de,destfcb ; point to destination fcb - call convert ; convert destination spec - jp nz,erramb ; Error, ambiguous file specification - call nonblank ; skip blanks - or a ; end of command tail (null)? - jr z,parse2 ; setup default source fcb - cp '=' ; std delimiter - jr z,parse1 ; valid delimiter, continue - cp '_' ; alt delimiter - jr z,parse1 ; valid delimiter, continue - jp errdlm ; invalid delimiter -parse1: - inc hl ; skip delimiter - call nonblank ; skip blanks -parse2: - ld de,srcfcb ; point to source fcb - call convert ; convert spec to fcb - jp nz,erramb ; Error, ambiguous file specification - ; return success - xor a ; signal success - ret ; done parsing -; -; Confirm pending action with user -; -confirm: - ; prompt - call crlf - ld de,sconf1 - call prtstr - ld hl,srcfcb - call prtfcb - ld de,sconf2 - call prtstr - ld hl,destfcb - call prtfcb - ld de,sconf3 - call prtstr -; - ; get input (imgbuf is used for temp storage) - ld c,$0A ; get console buffer - ld de,imgbuf ; into buf - ld a,1 ; max of 1 character - ld (de),a ; set up buffer - call bdos ; invoke BDOS - ld a,(imgbuf+1) ; get num chars entered - dec a ; check that we got exactly one char - jr nz,confirm ; bad input, re-prompt - ld a,(imgbuf+2) ; get the character - and $DF ; force upper case - cp 'Y' ; compare to Y - ret ; return with Z set appropriately -; -; Read system image -; -rdimg: - ld hl,srcfcb ; point to source fcb - call chkfcb ; check if for drive/file spec - bit 1,a ; is there a file spec? - jp nz,rdfil ; yes, read using file i/o - jp rddsk ; no, read using raw disk i/o -; -; Write system image -; -wrtimg: - ld hl,destfcb ; point to destination fcb - call chkfcb ; check it for drive/file spec - bit 1,a ; is there a file spec? - jp nz,wrfil ; yes, write using file i/o - jp wrdsk ; no, write using raw disk i/o - -; -; Read system image from file system -; -rdfil: - ; open the file - ld c,$0F ; bdos open file - ld de,srcfcb ; source fcb - ld (rwfcb),de ; save it - call bdos ; invoke bdos function - cp $FF ; $FF is error - jp z,errfil ; handle error condition - ; read the header - ld a,$14 ; setup for bdos read sequential - ld (rwfun),a ; save bdos function - ld a,12 ; start with 1536 byte header (12 records) - ld (reccnt),a ; init record counter - ld hl,imgbuf ; start of buffer - ld (bufptr),hl ; init buffer pointer - call rwfil ; read the header - ret nz ; abort on error (no need to close file) - ; check header and get image size - call chkhdr ; verifies marker & ver, hl = image size - ret nz ; abort on error (no need to close file) - ld b,7 ; right shift 7 bits to get 128 byte record count -rdfil1: srl h ; shift right msb - rr l ; shift lsb w/ carry from msb - djnz rdfil1 ; loop till done - ld a,l ; record count to a - ld (reccnt),a ; set remaining records to read - add a,12 ; add the header back - ld (imgsiz),a ; and save the total image size (in records) - call rwfil ; do it - ret nz ; abort on error - ; return via close file - jp closefile ; close file -; -; Write system image to file system -; -wrfil: - ; check for pre-existing target file - ld c,$11 ; bdos find first - ld de,destfcb ; destination fcb - call bdos - cp $FF ; check for error - jr z,wrfil1 ; not there, skip delete - ; delete target file if it exists - ld c,$13 ; bdos delete - ld de,destfcb ; destination fcb - call bdos - cp $FF ; check return code - jp z,errdel ; handle error -wrfil1: ; create target file - ld c,$16 ; bdos create file - ld de,destfcb ; destination fcb - ld (rwfcb),de ; save it - call bdos - cp $FF ; check return code - jp z,errfil ; handle error - ; write the image - ld a,$15 ; setup for bdos write sequential - ld (rwfun),a ; save bdos function - ld a,(imgsiz) ; number of records to write - ld (reccnt),a ; init record counter - ld hl,imgbuf ; start of buffer - ld (bufptr),hl ; init buffer pointer - call rwfil ; do it - ret nz ; abort on error - ; return via close file - jp closefile ; close file -; -; Common routine to handle read/write for file system -; -rwfil: - ld c,$1A ; BDOS set dma - ld de,(bufptr) ; current buffer pointer - push de ; save pointer - call bdos ; do it - pop de ; recover pointer - ld hl,128 ; record length - add hl,de ; increment buffer pointer - ld (bufptr),hl ; save it - ld a,(rwfun) ; get the active function - ld c,a ; set it - ld de,(rwfcb) ; active fcb - call bdos ; do it - or a ; check return code - jp nz,errdos ; BDOS err - ld hl,reccnt ; point to record count - dec (hl) ; decrement record count - jr nz,rwfil ; loop till done - xor a ; signal success - ret ; done -; -; Close file -; -closefile: - ld c,$10 ; BDOS close file - ld de,(rwfcb) ; active fcb - call bdos ; do it - cp $FF ; $FF is error - jp z,errclo ; if error, handle it - xor a ; signal success - ret ; done -; -; Read image directly from disk system tracks using CBIOS -; -rddsk: - ; force return to go through disk reset - ld hl,resdsk ; load address of reset disk routine - push hl ; and put it on the stack - ; set drive for subsequent reads - ld a,(srcfcb) ; get the drive - dec a ; adjust for zero indexing - call setdsk ; setup disk - ret nz ; abort on error - ; set function to read - ld a,13 ; CBIOS func 13: Read - ld (actfnc),a ; save it - ; read the header - ld a,12 ; start with 1536 byte header (12 records) - ld (reccnt),a ; initialize record counter - call rwdsk ; read the header - ret nz ; abort on error - ; check header and get image size - call chkhdr ; check integrity, HL = image size on return - ret nz ; abort on error - ; convert image size to count of 128-byte records - ld b,7 ; right shift 7 bits to get 128 byte record count -rddsk1: srl h ; shift right msb - rr l ; shift lsb w/ carry from msb - djnz rddsk1 ; loop till done - ; set the number of records pending to read - ld a,l ; record count to a - ld (reccnt),a ; set remaining records to read - ; save the total image size (including header) for later - add a,12 ; add the header records back - ld (imgsiz),a ; and save the total image size (in records) - ; read the remaining system image records - call rwdsk ; finish up - ret nz ; abort on error - ; perform BDOS disk reset (critical since we mucked with CBIOS) - ld c,$0D ; BDOS reset disk - call bdos ; do it - ; return - xor a ; signal success - ret ; done -; -; Write image directly to disk system tracks using CBIOS -; -wrdsk: - ; force return to go through disk reset - ld hl,resdsk ; load address of reset disk routine - push hl ; and put it on the stack - ; setup to read existing MBR - ld a,(destfcb) ; get the drive - dec a ; adjust for zero indexing - call setdsk ; setup disk - ret nz ; abort on error - ld hl,mbrbuf ; override to read - ld (bufptr),hl ; ... into MBR buffer - ld a,4 ; 4 records = 1 512 byte sector - ld (reccnt),a ; initialize record counter - ; set function to read - ld a,13 ; CBIOS func 13: Read - ld (actfnc),a ; save it - ; read the existing MBR into memory - call rwdsk ; read the sector - ret nz ; abort on error - ; test for valid partition table ($55, $AA at offset $1FE) - ld hl,(mbrbuf+$1FE); HL := signature - ld a,$55 ; load expected value of first byte - cp l ; check for proper value - jr nz,wrdsk1 ; mismatch, ignore old partition table - ld a,$AA ; load expected value of second byte - cp h ; check for proper value - jr nz,wrdsk1 ; mismatch, ignore old partition table - ; valid MBR, copy existing partition table over to new image - ld hl,mbrbuf+$1BE ; copy from MBR offset of existing MBR - ld de,imgbuf+$1BE ; copy to MBR offset of new image - ld bc,$40 ; size of MBR - ldir ; do it -wrdsk1: ; setup to write the image from memory to disk - ld a,(destfcb) ; get the drive - dec a ; adjust for zero indexing - call setdsk ; setup disk - ret nz ; abort on error - ; set function to write - ld a,14 ; CBIOS func 14: Write - ld (actfnc),a ; save it - ; setup the record count to write - ld a,(imgsiz) ; get previously recorded image size - ld (reccnt),a ; save it as pending record count - ; write the image - call rwdsk ; write the image - ret nz ; abort on error - ; return - xor a ; signal success - ret ; done -; -; Perform BDOS disk reset -; Required after making direct CBIOS disk calls -; -resdsk: - ; perform BDOS disk reset - push af ; preserve status - ld c,$0D ; BDOS reset disk - call bdos ; do it - pop af ; restore status - ret -; -; Setup for CBIOS disk access -; -setdsk: - ; select disk - ld (actdsk),a ; save active disk no - ld c,a ; move to c - ld e,0 ; treat as first select - call cbios ; invoke cbios with... - ;.db $1B ; SELDSK entry offset - .db 9 ; SELDSK entry offset - ; check return (sets HL to DPH address) - ld a,h - or l - jp z,errsel ; HL == 0 is select error - ; set HL to DPB address - ld de,10 ; DPB address is 10 bytes into DPH - add hl,de ; HL := address of DPB pointer - ld a,(hl) ; dereference... - inc hl - ld h,(hl) - ld l,a ; HL := address of DPB - ; extract sectors per track from first word of DPB - ld c,(hl) - inc hl - ld b,(hl) ; BC := sectors per track - ld (actspt),bc ; save it - ; ensure there are system tracks (verify that offset field in DPB is not zero) - ld de,12 ; offset field is 12 bytes into DPB - add hl,de ; point to offset field in DPB - ld a,(hl) ; load first byte in A - inc hl ; point to second byte - or (hl) ; or with first byte - jp z,errsys ; if zero, abort (no system tracks) - ; initialize for I/O - ld hl,0 - ld (acttrk),hl ; active track := 0 - ld (actsec),hl ; active sector := 0 - ld hl,imgbuf ; assume r/w to image buffer - ld (bufptr),hl ; reset buffer pointer -; - xor a ; signal success - ret ; done -; -; Read or write (reccnt) sectors to/from disk via CBIOS -; -rwdsk: - ld hl,128 ; assume rec len for < CP/M 3 - ld (reclen),hl ; and save it - ld a,(v3os) ; CP/M 3 or greater? - or a ; set flags - jr z,rwdsk0 ; if not, continue - ; adjust reccnt, logical (128) to physical (512) - ld a,(reccnt) ; get pending rec cnt - add a,3 ; round up - srl a ; shift to - srl a ; ... divide by 4 - ld (reccnt),a ; and resave it - ld hl,512 ; use physical rec len - ld (reclen),hl ; and save it -rwdsk0: - ; setup to read/write a sector - ld bc,(acttrk) ; get active track - call cbios ; invoke cbios with... - ;.db $1E ; SETTRK entry offset - .db 10 ; SETTRK entry offset - ld bc,(actsec) ; get active sector - call cbios ; invoke cbios with... - ;.db $21 ; SETSEC entry offset - .db 11 ; SETSEC entry offset - ld bc,(bufptr) ; get active buffer pointer - call cbios ; invoke cbios with... - ;.db $24 ; SETDMA entry offset - .db 12 ; SETDMA entry offset - ; read/write sector - ld a,(reccnt) ; get the pending record count - dec a ; last record? - ld c,2 ; allow cached writes by default - jr nz,rwdsk1 ; not last record, continue - ld c,1 ; last record, no caching please -rwdsk1: - ld a,(actfnc) - call cbiosfn - or a ; set flags on return code - jp nz,errio ; if not zero, error abort - ; adjust buffer pointer - ld hl,(bufptr) ; get buffer pointer - ld de,(reclen) ; get rec len - add hl,de ; adjust buffer ptr for next record - ld (bufptr),hl ; save it - ; next sector - ld hl,(actsec) ; current sector - inc hl ; increment sector - ld (actsec),hl ; save it - ; check for end of track - ld de,(actspt) ; get current sectors per track - or a ; clear CF - sbc hl,de ; current track == sectors per track? - jr nz,rwdsk2 ; no, skip track change - ; next track - ld hl,0 - ld (actsec),hl ; current sector := 0 - ld hl,acttrk ; point to track variable - inc (hl) ; increment track - ; check pending record count and loop or return -rwdsk2: ld hl,reccnt - dec (hl) ; decrement pending record count - ret z ; if zero, done, return with Z set - jr rwdsk0 ; otherwise, loop -; -jphl: jp (hl) ; indirect jump -; -; Verify system image header in buf by checking the expected signature. -; Compute and return image size (based on header values) in HL. -; NZ set if signature error. -; -chkhdr: - ; check signature - ld hl,(imgbuf+$580) ; get signature - ld de,$A55A ; signature value - or a ; clear CF - sbc hl,de ; compare - jp nz,errsig ; invalid signature - ; compute the image size (does not include size of header) - ld hl,(imgbuf+$5FC) ; get CPM_END - ld de,(imgbuf+$5FA) ; get CPM_LOC - or a ; clear CF - sbc hl,de ; image size := CPM_END - CPM_LOC - xor a ; signal success - ret ; done -; -; Convert a filename at (HL) into an FCB at (DE). -; Includes wildcard expansion. -; On return, A=0 if unambiguous name specified, and -; (HL) points to character following filename spec -; -convert: - push de ; put fcb address on stack - ex de,hl - ld a,(de) ; get first character. - or a - jp z,convrt1 - sbc a,'A'-1 ; might be a drive name, convert to binary. - ld b,a ; and save. - inc de ; check next character for a ':'. - ld a,(de) - cp ':' - jp z,convrt2 - dec de ; nope, move pointer back to the start of the line. -convrt1: - ld a,(defdrv) - ld (hl),a - jp convrt3 -convrt2: - ld a,b - ld (hl),b - inc de - ; Convert the base file name. -convrt3:ld b,08h -convrt4:ld a,(de) - call delim - jp z,convrt8 - inc hl - cp '*' ; note that an '*' will fill the remaining - jp nz,convrt5 ; field with '?' - ld (hl),'?' - jp convrt6 -convrt5:ld (hl),a - inc de -convrt6:dec b - jp nz,convrt4 -convrt7:ld a,(de) - call delim ; get next delimiter - jp z,getext - inc de - jp convrt7 -convrt8:inc hl ; blank fill the file name - ld (hl),' ' - dec b - jp nz,convrt8 -getext: ld b,03h - cp '.' - jp nz,getext5 - inc de -getext1:ld a,(de) - call delim - jp z,getext5 - inc hl - cp '*' - jp nz,getext2 - ld (hl),'?' - jp getext3 -getext2:ld (hl),a - inc de -getext3:dec b - jp nz,getext1 -getext4:ld a,(de) - call delim - jp z,getext6 - inc de - jp getext4 -getext5:inc hl - ld (hl),' ' - dec b - jp nz,getext5 -getext6:ld b,3 -getext7:inc hl - ld (hl),0 - dec b - jp nz,getext7 - pop hl ; HL := start of FCB - push de ; save input line pointer - ; Check to see if this is an ambiguous file name specification. - ; Set the A register to non-zero if it is. - ld bc,11 ; set name length. -getext8:inc hl - ld a,(hl) - cp '?' ; any question marks? - jp nz,getext9 - inc b ; count them. -getext9:dec c - jp nz,getext8 - ld a,b - or a - pop hl ; return with updated input pointer - ret -; -; Print formatted FCB at (HL) -; -prtfcb: - push hl ; save HL - call chkfcb ; set flags indicating nature of FCB - pop hl ; restore HL - ret z ; nothing to print - push af ; save FCB flags - ld a,(hl) ; get first byte of FCB (drive) - inc hl ; point to next char - or a ; is drive specified (non-zero)? - jr z,prtfcb1 ; if zero, do not print drive letter - add a,'@' ; adjust drive number to alpha - call prtchr ; print it - ld a,':' - call prtchr ; print drive separator -prtfcb1: - pop af ; restore FCB flags - bit 1,a ; bit 1 set if filename specified - ret z ; return if no filename - ld b,8 ; base is 8 characters - call prtfcb2 ; print them - ld a,'.' - call prtchr ; print file extension separator - ld b,3 ; extension is 3 characters -prtfcb2: - ld a,(hl) ; load the next character - inc hl ; point to next character - cp ' ' ; check for blank - call nz,prtchr ; print char if it is not a blank - djnz prtfcb2 ; loop till done - ret ; return -; -; Check FCB to see if a drive and/or filename is specified. -; Set bit 0 for drive and bit 1 for filename in A -; -chkfcb: - ld c,0 ; use C for flags, start with none - ld a,(hl) ; get drive - or a ; anything there? - jr z,chkfcb1 ; skip if nothing there - set 0,c ; set bit zero to indicate a drive spec -chkfcb1: - ld b,11 ; set up to check 11 bytes (base & ext) -chkfcb2: - inc hl ; bump to next byte - ld a,(hl) ; get next - cp 'A' ; blank means empty byte - jr nc,chkfcb3 ; if not blank, we have a filename - djnz chkfcb2 ; loop - jr chkfcb4 ; nothing there -chkfcb3: - set 1,c ; set bit 1 to indicate a file spec -chkfcb4: - ld a,c ; put result in a - or a ; set flags - ret -; -; Print dot -; -prtdot: - push af - ld a,'.' - call prtchr - pop af - ret -; -; Print character in A without destroying any registers -; -prtchr: - push bc ; save registers - push de - push hl - ld e,a ; character to print in E - ld c,$02 ; BDOS function to output a character - call bdos ; do it - pop hl ; restore registers - pop de - pop bc - ret -; -; Print $ terminated string at (DE) without destroying any registers -; -prtstr: - push bc ; save registers - push de - push hl - ld c,$09 ; BDOS function to output a '$' terminated string - call bdos ; do it - pop hl ; restore registers - pop de - pop bc - ret -; -; Print the value in A in hex without destroying any registers -; -prthex: - push af ; save AF - push de ; save DE - call hexascii ; convert value in A to hex chars in DE - ld a,d ; get the high order hex char - call prtchr ; print it - ld a,e ; get the low order hex char - call prtchr ; print it - pop de ; restore DE - pop af ; restore AF - ret ; done -; -; Convert binary value in A to ascii hex characters in DE -; -hexascii: - ld d,a ; save A in D - call hexconv ; convert low nibble of A to hex - ld e,a ; save it in E - ld a,d ; get original value back - rlca ; rotate high order nibble to low bits - rlca - rlca - rlca - call hexconv ; convert nibble - ld d,a ; save it in D - ret ; done -; -; Convert low nibble of A to ascii hex -; -hexconv: - and $0F ; low nibble only - add a,$90 - daa - adc a,$40 - daa - ret -; -; Start a new line -; -crlf: - ld a,13 ; - call prtchr ; print it - ld a,10 ; - jr prtchr ; print it -; -; Get the next non-blank character from (HL). -; -nonblank: - ld a,(hl) ; load next character - or a ; string ends with a null - ret z ; if null, return pointing to null - cp ' ' ; check for blank - ret nz ; return if not blank - inc hl ; if blank, increment character pointer - jr nonblank ; and loop -; -; Check character at (DE) for delimiter. -; -delim: or a - ret z - cp ' ' ; blank - ret z - jr c,delim1 ; handle control characters - cp '=' ; equal - ret z - cp '_' ; underscore - ret z - cp '.' ; period - ret z - cp ':' ; colon - ret z - cp $3b ; semicolon - ret z - cp '<' ; less than - ret z - cp '>' ; greater than - ret -delim1: - ; treat control chars as delimiters - xor a ; set Z - ret ; return -; -; Invoke CBIOS function -; The CBIOS function offset must be stored in the byte -; following the call instruction. ex: -; call cbios -; .db $0C ; offset of CONOUT CBIOS function -; -cbios: - ex (sp),hl - ld a,(hl) ; get the function number - inc hl ; point past value following call instruction - ex (sp),hl ; put address back at top of stack and recover HL - -cbiosfn: - ; enter here if function already in reg A - ld (bpb_fn),a ; save function -; - ld a,(v3os) ; CP/M 3 or greater? - or a ; set flags - jr nz,cbios2 ; if >= V3, handle it -; - ; CBIOS call for CP/M < v3 - ld a,(bpb_fn) ; get pending function number - ld l,a ; function number to L - add a,l ; ... and multiply by 3 for - add a,l ; ... jump table offset - ld hl,(cbftbl) ; address of CBIOS function table to HL - call addhl ; determine specific function address - jp (hl) ; invoke CBIOS -; -cbios2: - ; CBIOS call for CP/M v3 or greater - ld (bpb_bc),bc - ld (bpb_de),de - ld (bpb_hl),hl - - ld c,50 ; direct bios call function number - ld de,bpb ; BIOS parameter block - jp bdos ; return via BDOS call -; -; Add the value in A to HL (HL := HL + A) -; -addhl: - add a,l ; A := A + L - ld l,a ; Put result back in L - ret nc ; if no carry, we are done - inc h ; if carry, increment H - ret ; and return -; -; Errors -; -erruse: ; command usage error (syntax) - ld de,msguse - jr err -erramb: ; ambiguous file spec (wild cards) is not allowed - ld de,msgamb - jr err -errdlm: ; invalid delimiter in command tail - ld de,msgdlm - jr err -errfil: ; source file not found - ld de,msgfil - jr err -errclo: ; file close error - ld de,msgclo - jr err -errdel: ; file delete error - ld de,msgdel - jr err -errsig: ; invalid system image signature error - ld de,msgsig - jr err -errsel: ; CBIOS drive select error - ld de,msgsel - jr err -errsys: ; no system tracks on drive error - ld de,msgsys - jr err -errio: ; I/O error - ld de,msgio - jr err -err: ; print error string and return error signal - call crlf ; print newline - call prtstr ; print error string - or $FF ; signal error - ret ; done -errdos: ; handle BDOS errors - push af ; save return code - call crlf ; newline - ld de,msgdos ; load - call prtstr ; and print error string - pop af ; recover return code - call prthex ; print error code - or $FF ; signal error - ret ; done -; -;=============================================================================== -; Storage Section -;=============================================================================== -; -defdrv .db 0 ; default drive for FCB -cbftbl .dw 0 ; address of CBIOS function table -imgsiz .db 0 ; image size (count of 128 byte records) -; -destfcb .fill 36,0 ; destination FCB -srcfcb .fill 36,0 ; source FCB -; -stksav .dw 0 ; stack pointer saved at start - .fill stksiz,0 ; stack -stack .equ $ ; stack top -; -rwfun .db 0 ; active read/write function -rwfcb .dw 0 ; active read/write FCB -reccnt .db 0 ; active remaining records to read/write -bufptr .dw 0 ; active pointer into buffer -; -actdsk .db 0 ; active disk no -acttrk .dw 0 ; active track -actsec .dw 0 ; active sector -actspt .dw 0 ; active sectors per track -actfnc .db 0 ; active cbios i/o function (read or write) -v3os .db 0 ; true ($FF) if OS v3.0 or greater -reclen .dw 0 ; active record length -; -bpb: ; BIOS parameter block for CP/M 3 BIOS calls -bpb_fn .db 0 ; function -bpb_a .db 0 ; reg A -bpb_bc .dw 0 ; reg BC -bpb_de .dw 0 ; reg DE -bpb_hl .dw 0 ; reg HL -; -; Messages -; -msgban1 .db "SYSCOPY v2.0 for RomWBW CP/M, 17-Feb-2020$" -msgv2 .db " (CP/M 2 Mode)$" -msgv3 .db " (CP/M 3 Mode)$" -msgban2 .db "Copyright 2020, Wayne Warthen, GNU GPL v3$" - -msguse .db "Usage: SYSCOPY [=]$" -msgamb .db "Ambiguous file specification not allowed$" -msgdlm .db "Invalid delimiter$" -msgfil .db "File not found$" -msgclo .db "File close error$" -msgdel .db "Error deleting target file$" -msgsig .db "Invalid system image (bad signature)$" -msgdos .db "DOS error, return code=0x$" -msgsel .db "Disk select error$" -msgsys .db "Non-system disk error$" -msgio .db "Disk I/O error$" -msgrd .db "Reading image... $" -msgwrt .db "Writing image... $" -msgdon .db "Done$" -sconf1 .db "Transfer system image from $" -sconf2 .db " to $" -sconf3 .db " (Y/N)? $" -; - .end diff --git a/Source/Apps/SysGen.z80 b/Source/Apps/SysGen.z80 deleted file mode 100644 index 7e108117..00000000 --- a/Source/Apps/SysGen.z80 +++ /dev/null @@ -1,507 +0,0 @@ - TITLE 'SYSGEN - SYSTEM GENERATION PROGRAM 8/79' -; SYSTEM GENERATION PROGRAM, VERSION FOR ROMWBW -VERS EQU 20 ; X.X -; -; COPYRIGHT (C) DIGITAL RESEARCH -; 1976, 1977, 1978, 1979 -; -NDISKS EQU 16 ; NUMBER OF DISK DRIVES -SECSIZ EQU 128 ; SIZE OF EACH SECTOR -LOG2SEC EQU 7 ; LOG 2 SECSIZ -; -FCB EQU 05CH ; DEFAULT FCB LOCATION -FCBCR EQU FCB+32 ; CURRENT RECORD LOCATION -TPA EQU 0100H ; TRANSIENT PROGRAM AREA -LOADP EQU 900H ; LOAD POINT FOR SYSTEM DURING LOAD/STORE -BDOS EQU 5 ; DOS ENTRY POINT -BOOT EQU 0 ; JMP TO 'BOOT' TO REBOOT SYSTEM -CONI EQU 1 ; CONSOLE INPUT FUNCTION -CONO EQU 2 ; CONSOLE OUTPUT FUNCTION -OPENF EQU 15 ; DISK OPEN FUNCTION -DREADF EQU 20 ; DISK READ FUNCTION -; -CR EQU 0DH ; CARRIAGE RETURN -LF EQU 0AH ; LINE FEED -STKSIZE EQU 16 ; SIZE OF LOCAL STACK -; -WBOOT EQU 1 ; ADDRESS OF WARM BOOT (OTHER PATCH ENTRY -; - ORG TPA ; TRANSIENT PROGRAM AREA - JP START - DB 'COPYRIGHT (C) 1978, DIGITAL RESEARCH ' -; -; UTILITY SUBROUTINES -; -GETCHAR: - ; READ CONSOLE CHARACTER TO REGISTER A - LD C,CONI - CALL BDOS - ; CONVERT TO UPPER CASE BEFORE RETURN - CP 'A' OR 20H - RET C ; RETURN IF BELOW LOWER CASE A - CP ('Z' OR 20H) + 1 - RET NC ; RETURN IF ABOVE LOWER CASE Z - AND 5FH - RET -; -PUTCHAR: - ; WRITE CHARACTER FROM A TO CONSOLE - LD E,A - LD C,CONO - CALL BDOS - RET -; -CRLF: ; SEND CARRIAGE RETURN, LINE FEED - LD A,CR - CALL PUTCHAR - LD A,LF - CALL PUTCHAR - RET -; -CRMSG: ; PRINT MESSAGE ADDRESSED BY H,L TIL ZERO - ; WITH LEADING CRLF - PUSH HL - CALL CRLF - POP HL ; DROP THRU TO OUTMSG0 -OUTMSG: - LD A,(HL) - OR A - RET Z - ; MESSAGE NOT YET COMPLETED - PUSH HL - CALL PUTCHAR - POP HL - INC HL - JP OUTMSG -; -DREAD: ; DISK READ FUNCTION VIA BDOS - LD C,DREADF - JP BDOS -; -OPEN: ; FILE OPEN FUNCTION VIA BDOS - LD C,OPENF - JP BDOS -; -; READ IMAGE DIRECTLY FROM DISK SYSTEM TRACKS USING CBIOS -; DISK NUMBER MUST BE IN (ACTDSK) -; -RDDSK: - ; FORCE RETURN TO GO THROUGH DISK RESET - LD HL,RESDSK ; LOAD ADDRESS OF RESET DISK ROUTINE - PUSH HL ; AND PUT IT ON THE STACK - ; SET DRIVE FOR SUBSEQUENT READS - CALL SETDSK ; SETUP DISK SPECIFIED IN A - RET NZ ; ABORT ON ERROR - ; SET FUNCTION TO READ - LD HL,(CBFTBL) ; GET ADDRESS OF CBIOS FUNCTION TABLE - LD A,027H ; $27 IS CBIOS READ ENTRY OFFSET - CALL ADDHL ; SET HL TO RESULTANT ENTRY POINT - LD (ACTFNC),HL ; SAVE IT - ; READ THE HEADER - LD A,12 ; START WITH 1536 BYTE HEADER (12 RECORDS) - LD (RECCNT),A ; INITIALIZE RECORD COUNTER - CALL RWDSK ; READ THE HEADER - RET NZ ; ABORT ON ERROR - ; CHECK HEADER AND GET IMAGE SIZE - CALL CHKHDR ; CHECK INTEGRITY, HL = IMAGE SIZE ON RETURN - RET NZ ; ABORT ON ERROR - ; CONVERT IMAGE SIZE TO COUNT OF 128-BYTE RECORDS - LD B,7 ; RIGHT SHIFT 7 BITS TO GET 128 BYTE RECORD COUNT -RDDSK1: SRL H ; SHIFT RIGHT MSB - RR L ; SHIFT LSB W/ CARRY FROM MSB - DJNZ RDDSK1 ; LOOP TILL DONE - ; SET THE NUMBER OF RECORDS PENDING TO READ - LD A,L ; RECORD COUNT TO A - LD (RECCNT),A ; SET REMAINING RECORDS TO READ - ; SAVE THE TOTAL IMAGE SIZE (INCLUDING HEADER) FOR LATER - ADD A,12 ; ADD THE HEADER RECORDS BACK - LD (IMGSIZ),A ; AND SAVE THE TOTAL IMAGE SIZE (IN RECORDS) - ; READ THE REMAINING SYSTEM IMAGE RECORDS - CALL RWDSK ; FINISH UP - RET NZ ; ABORT ON ERROR - ; PERFORM BDOS DISK RESET (CRITICAL SINCE WE MUCKED WITH CBIOS) - LD C,0DH ; BDOS RESET DISK - CALL BDOS ; DO IT - ; RETURN - XOR A ; SIGNAL SUCCESS - RET ; DONE -; -; WRITE IMAGE DIRECTLY TO DISK SYSTEM TRACKS USING CBIOS -; DISK NUMBER MUST BE IN (ACTDSK) -; -WRDSK: - ; FORCE RETURN TO GO THROUGH DISK RESET - LD HL,RESDSK ; LOAD ADDRESS OF RESET DISK ROUTINE - PUSH HL ; AND PUT IT ON THE STACK - ; SET DRIVE FOR SUBSEQUENT WRITES - CALL SETDSK ; SETUP DISK SPECIFIED IN A - RET NZ ; ABORT ON ERROR - ; SET FUNCTION TO WRITE - LD HL,(CBFTBL) ; GET ADDRESS OF CBIOS FUNCTION TABLE - LD A,02AH ; $2A IS CBIOS WRITE ENTRY OFFSET - CALL ADDHL ; SET HL TO RESULTANT ENTRY POINT - LD (ACTFNC),HL ; SAVE IT - ; SETUP THE RECORD COUNT TO WRITE - LD A,(IMGSIZ) ; GET PREVIOUSLY RECORDED IMAGE SIZE - LD (RECCNT),A ; SAVE IT AS PENDING RECORD COUNT - ; WRITE THE IMAGE - CALL RWDSK ; WRITE THE IMAGE - RET NZ ; ABORT ON ERROR - ; RETURN - XOR A ; SIGNAL SUCCESS - RET ; DONE -; -; PERFORM BDOS DISK RESET -; REQUIRED AFTER MAKING DIRECT CBIOS DISK CALLS -; -RESDSK: - ; PERFORM BDOS DISK RESET - PUSH AF ; PRESERVE STATUS - LD C,0DH ; BDOS RESET DISK - CALL BDOS ; DO IT - POP AF ; RESTORE STATUS - RET -; -; SETUP FOR CBIOS DISK ACCESS -; -SETDSK: - ; SELECT DISK - LD A,(ACTDSK) ; GET ACTIVE DISK - LD C,A ; MOVE TO C - LD E,0 ; TREAT AS FIRST SELECT - CALL CBIOS ; INVOKE CBIOS WITH... - DB 01BH ; SELDSK ENTRY OFFSET - ; CHECK RETURN (SETS HL TO DPH ADDRESS) - LD A,H - OR L - JP Z,ERRSEL ; HL == 0 IS SELECT ERROR - ; SET HL TO DPB ADDRESS - LD DE,10 ; DPB ADDRESS IS 10 BYTES INTO DPH - ADD HL,DE ; HL := ADDRESS OF DPB POINTER - LD A,(HL) ; DEREFERENCE... - INC HL - LD H,(HL) - LD L,A ; HL := ADDRESS OF DPB - ; EXTRACT SECTORS PER TRACK FROM FIRST WORD OF DPB - LD C,(HL) - INC HL - LD B,(HL) ; BC := SECTORS PER TRACK - LD (ACTSPT),BC ; SAVE IT - ; ENSURE THERE ARE SYSTEM TRACKS (VERIFY THAT OFFSET FIELD IN DPB IS NOT ZERO) - LD DE,12 ; OFFSET FIELD IS 12 BYTES INTO DPB - ADD HL,DE ; POINT TO OFFSET FIELD IN DPB - LD A,(HL) ; LOAD FIRST BYTE IN A - INC HL ; POINT TO SECOND BYTE - OR (HL) ; OR WITH FIRST BYTE - JP Z,ERRSYS ; IF ZERO, ABORT (NO SYSTEM TRACKS) - ; INITIALIZE FOR I/O - LD HL,0 - LD (ACTTRK),HL ; ACTIVE TRACK := 0 - LD (ACTSEC),HL ; ACTIVE SECTOR := 0 - LD HL,LOADP - LD (BUFPTR),HL ; RESET BUFFER POINTER -; - XOR A ; SIGNAL SUCCESS - RET ; DONE -; -; READ OR WRITE (RECCNT) SECTORS TO/FROM DISK VIA CBIOS -; -RWDSK: - ; SETUP TO READ/WRITE A SECTOR - LD BC,(ACTTRK) ; GET ACTIVE TRACK - CALL CBIOS ; INVOKE CBIOS WITH... - DB 01EH ; SETTRK ENTRY OFFSET - LD BC,(ACTSEC) ; GET ACTIVE SECTOR - CALL CBIOS ; INVOKE CBIOS WITH... - DB 021H ; SETSEC ENTRY OFFSET - LD BC,(BUFPTR) ; GET ACTIVE BUFFER POINTER - CALL CBIOS ; INVOKE CBIOS WITH... - DB 024H ; SETDMA ENTRY OFFSET - ; READ/WRITE SECTOR - LD A,(RECCNT) ; GET THE PENDING RECORD COUNT - DEC A ; LAST RECORD? - LD C,2 ; ALLOW CACHED WRITES BY DEFAULT - JR NZ,RWDSK1 ; NOT LAST RECORD, CONTINUE - LD C,1 ; LAST RECORD, NO CACHING PLEASE -RWDSK1: LD HL,(ACTFNC) ; LOAD THE CBIOS FUNCTION VECTOR - CALL JPHL ; INDIRECT CALL (READ OR WRITE) - OR A ; SET FLAGS ON RETURN CODE - JP NZ,ERRIO ; IF NOT ZERO, ERROR ABORT - ; ADJUST BUFFER POINTER - LD HL,(BUFPTR) ; GET BUFFER POINTER - LD DE,128 ; RECORD LENGTH IS 128 BYTES - ADD HL,DE ; ADJUST BUFFER PTR FOR NEXT RECORD - LD (BUFPTR),HL ; SAVE IT - ; NEXT SECTOR - LD HL,(ACTSEC) ; CURRENT SECTOR - INC HL ; INCREMENT SECTOR - LD (ACTSEC),HL ; SAVE IT - ; CHECK FOR END OF TRACK - LD DE,(ACTSPT) ; GET CURRENT SECTORS PER TRACK - OR A ; CLEAR CF - SBC HL,DE ; CURRENT TRACK == SECTORS PER TRACK? - JR NZ,RWDSK2 ; NO, SKIP TRACK CHANGE - ; NEXT TRACK - LD HL,0 - LD (ACTSEC),HL ; CURRENT SECTOR := 0 - LD HL,ACTTRK ; POINT TO TRACK VARIABLE - INC (HL) ; INCREMENT TRACK - ; CHECK PENDING RECORD COUNT AND LOOP OR RETURN -RWDSK2: LD HL,RECCNT - DEC (HL) ; DECREMENT PENDING RECORD COUNT - RET Z ; IF ZERO, DONE, RETURN WITH Z SET - JR RWDSK ; OTHERWISE, LOOP -; -JPHL: JP (HL) ; INDIRECT JUMP -; -; VERIFY SYSTEM IMAGE HEADER IN BUF BY CHECKING THE EXPECTED SIGNATURE. -; COMPUTE AND RETURN IMAGE SIZE (BASED ON HEADER VALUES) IN HL. -; NZ SET IF SIGNATURE ERROR. -; -CHKHDR: - ; CHECK SIGNATURE - LD HL,(LOADP+580H) ; GET SIGNATURE - LD DE,0A55AH ; SIGNATURE VALUE - OR A ; CLEAR CF - SBC HL,DE ; COMPARE - JP NZ,ERRSIG ; INVALID SIGNATURE - ; COMPUTE THE IMAGE SIZE (DOES NOT INCLUDE SIZE OF HEADER) - LD HL,(LOADP+5FCH) ; GET CPM_END - LD DE,(LOADP+5FAH) ; GET CPM_LOC - OR A ; CLEAR CF - SBC HL,DE ; IMAGE SIZE := CPM_END - CPM_LOC - XOR A ; SIGNAL SUCCESS - RET ; DONE -; -; INVOKE CBIOS FUNCTION -; THE CBIOS FUNCTION OFFSET MUST BE STORED IN THE BYTE -; FOLLOWING THE CALL INSTRUCTION. EX: -; CALL CBIOS -; DB 0CH ; OFFSET OF CONOUT CBIOS FUNCTION -; -CBIOS: - EX (SP),HL - LD A,(HL) ; GET THE FUNCTION OFFSET - INC HL ; POINT PAST VALUE FOLLOWING CALL INSTRUCTION - EX (SP),HL ; PUT ADDRESS BACK AT TOP OF STACK AND RECOVER HL - LD HL,(CBFTBL) ; ADDRESS OF CBIOS FUNCTION TABLE TO HL - CALL ADDHL ; DETERMINE SPECIFIC FUNCTION ADDRESS - JP (HL) ; INVOKE CBIOS -; -; ADD THE VALUE IN A TO HL (HL := HL + A) -; -ADDHL: - ADD A,L ; A := A + L - LD L,A ; PUT RESULT BACK IN L - RET NC ; IF NO CARRY, WE ARE DONE - INC H ; IF CARRY, INCREMENT H - RET ; AND RETURN -; -; START OF PROGRAM -; -START: - LD SP,STACK ; SET LOCAL STACK POINTER - LD HL,SIGNON - CALL CRMSG - ; LOCATE CBIOS FUNCTION TABLE ADDRESS - LD HL,(BOOT+1) ; LOAD ADDRESS OF CP/M RESTART VECTOR - LD DE,-3 ; ADJUSTMENT FOR START OF TABLE - ADD HL,DE ; HL NOW HAS START OF TABLE - LD (CBFTBL),HL ; SAVE IT - ; CHECK FOR DEFAULT FILE LOAD INSTEAD OF GET - LD A,(FCB+1); BLANK IF NO FILE - CP ' ' - JP Z,GETSYS ; SKIP TO GET SYSTEM MESSAGE IF BLANK - LD DE,FCB ; TRY TO OPEN IT - CALL OPEN ; - INC A ; 255 BECOMES 00 - JP NZ,RDOK ; OK TO READ IF NOT 255 - ; FILE NOT PRESENT, ERROR AND REBOOT - LD HL,NOFILE - CALL CRMSG - JP REBOOT -; -; FILE PRESENT - READ TO LOAD POINT -; -RDOK: - XOR A - LD (FCBCR),A; CURRENT RECORD = 0 - ; PRE-READ AREA FROM TPA TO LOADP - LD C,(LOADP-TPA)/SECSIZ -PRERD: ; PRE-READ FILE - PUSH BC ; SAVE COUNT - LD DE,FCB ; INPUT FILE CONTROL COUNT - CALL DREAD ; ASSUME SET TO DEFAULT BUFFER - POP BC ; RESTORE COUNT - OR A - JP NZ,BADRD ; CANNOT ENCOUNTER END-OF FILE - DEC C ; COUNT DOWN - JP NZ,PRERD ; FOR ANOTHER SECTOR -; -; SECTORS SKIPPED AT BEGINNING OF FILE -; - LD HL,LOADP -RDINP: - PUSH HL - LD B,H - LD C,L ; READY FOR DMA - CALL CBIOS ; INVOKE CBIOS WITH... - DB 024H ; SETDMA ENTRY OFFSET - LD DE,FCB ; READY FOR READ - CALL DREAD ; - POP HL ; RECALL DMA ADDRESS - OR A ; 00 IF READ OK - JP NZ,PUTSYS ; ASSUME EOF IF NOT. - ; MORE TO READ, CONTINUE - LD DE,SECSIZ - ADD HL,DE ; HL IS NEW LOAD ADDRESS - JP RDINP -; -BADRD: ; EOF ENCOUNTERED IN INPUT FILE - LD HL,BADFILE - CALL CRMSG - JP REBOOT -; -GETSYS: - CALL CRLF - LD HL,ASKGET ; GET SYSTEM? - CALL CRMSG - CALL GETCHAR - CP CR - JP Z,PUTSYS ; SKIP IF CR ONLY - ; - SUB 'A' ; NORMALIZE DRIVE NUMBER - CP NDISKS ; VALID DRIVE? - JP C,GETC ; SKIP TO GETC IF SO - ; INVALID DRIVE NUMBER - CALL BADDISK - JP GETSYS ; TO TRY AGAIN -; -GETC: - ; SELECT DISK GIVEN BY REGISTER A - ADD A,'A' - LD (GDISK),A; TO SET MESSAGE - SUB 'A' - LD (ACTDSK),A ; SAVE ACTIVE DISK NO - -; ; GETSYS, SET RW TO READ AND GET THE SYSTEM - CALL CRLF - LD HL,GETMSG - CALL OUTMSG - CALL GETCHAR - CP CR - JP NZ,REBOOT - CALL CRLF - CALL RDDSK - JP NZ,GETSYS - LD HL,DONE - CALL OUTMSG -; -; PUT SYSTEM -; -PUTSYS: - CALL CRLF - LD HL,ASKPUT - CALL CRMSG - CALL GETCHAR - CP CR - JP Z,REBOOT - SUB 'A' - CP NDISKS - JP C,PUTC - ; INVALID DRIVE NAME - CALL BADDISK - JP PUTSYS ; TO TRY AGAIN -; -PUTC: ; SET DISK FROM REGISTER C - ADD A,'A' - LD (PDISK),A ; MESSAGE SET - SUB 'A' - LD (ACTDSK),A ; SAVE ACTIVE DISK NO - - ; PUT SYSTEM - LD HL,PUTMSG - CALL CRMSG - CALL GETCHAR - CP CR - JP NZ,REBOOT - CALL CRLF - CALL WRDSK - JP NZ,PUTSYS - LD HL,DONE - CALL OUTMSG - JP PUTSYS ; FOR ANOTHER PUT OPERATION -; -REBOOT: - CALL CRLF - JP BOOT -; -ERRSEL: - LD HL,SELMSG - JP ERR -; -ERRSYS: - LD HL,SYSMSG - JP ERR -; -ERRIO: - LD HL,IOMSG - JP ERR -; -ERRSIG: - LD HL,SIGMSG - JP ERR -; -ERR: - CALL OUTMSG - OR A,0FFH - RET -; -BADDISK:;BAD DISK NAME - LD HL,QDISK - CALL CRMSG - RET -; -; DATA AREAS -; MESSAGES -; -SIGNON: DB 'ROMWBW SYSGEN VER ' - DB VERS/10+'0','.',VERS MOD 10+'0' - DB 0 -ASKGET: DB 'SOURCE DRIVE NAME (OR RETURN TO SKIP): ',0 -GETMSG: DB 'SOURCE ON ' -GDISK: DS 1 ; FILLED IN AT GET FUNCTION - DB ':, THEN TYPE RETURN',0 -ASKPUT: DB 'DESTINATION DRIVE NAME (OR RETURN TO REBOOT): ',0 -PUTMSG: DB 'DESTINATION ON ' -PDISK: DS 1 ; FILLED IN AT PUT FUNCTION - DB ':, THEN TYPE RETURN',0 -ERRMSG: DB 'PERMANENT ERROR, TYPE RETURN TO IGNORE',0 -DONE: DB 'FUNCTION COMPLETE',0 -QDISK: DB 'INVALID DRIVE NAME (USE A-P)',0 -NOFILE: DB 'NO SOURCE FILE ON DISK',0 -BADFILE: - DB 'SOURCE FILE INCOMPLETE',0 -SELMSG: DB 'DISK SELECTION ERROR',0 -SYSMSG: DB 'NON-SYSTEM DISK ERROR',0 -IOMSG: DB 'FATAL DISK I/O ERROR',0 -SIGMSG: DB 'INVALID SYSTEM IMAGE (BAD SIGNATURE)',0 -; -; VARIABLES -; -CBFTBL DW 0 ; ADDRESS OF CBIOS FUNCTION TABLE -IMGSIZ DB 0 ; IMAGE SIZE (COUNT OF 128 BYTE RECORDS) -; -RWFUN DB 0 ; ACTIVE READ/WRITE FUNCTION -RECCNT DB 0 ; ACTIVE REMAINING RECORDS TO READ/WRITE -BUFPTR DW 0 ; ACTIVE POINTER INTO BUFFER -; -ACTDSK DB 0 ; ACTIVE DISK NO -ACTTRK DW 0 ; ACTIVE TRACK -ACTSEC DW 0 ; ACTIVE SECTOR -ACTSPT DW 0 ; ACTIVE SECTORS PER TRACK -ACTFNC DW 0 ; ACTIVE FUNCTION (READ OR WRITE) - DS STKSIZE*2 -STACK: -; - END diff --git a/Source/Apps/Test/2piotst/2piotst.mac b/Source/Apps/Test/2piotst/2piotst.mac new file mode 100644 index 00000000..027dcddf --- /dev/null +++ b/Source/Apps/Test/2piotst/2piotst.mac @@ -0,0 +1,567 @@ +; 24.9.2018 PMS (b1ackmai1er) +; Modified version for ECB-ZILOG PERIPHERALS BOARD - TEST 2 PIO's +; 01.11.2011 WKA +; Assembler M80 +; ECB-4PIO +; Testprogramm fr die I/O-Karte ECB-4PIO in Z80-Mnemonics + + PAGE 72 + .Z80 + ASEG + ORG 100H +; +;CP/M-ADDRESSES +;* * * * * * * +; +BOOT EQU 0 ;WARMBOOT CP/M +BDOS EQU 5 ;ENTRY BDOS +NMI EQU 66H ;Error-ROUTINE +; +;CONSOLE-CODES +;* * * * * * * +; +EOT EQU 4 ;END OF TEXT +BS EQU 8 ;BACKSPACE +TAB EQU 9 ;TABULATOR +LF EQU 0AH ;LINE-FEED +CR EQU 0DH ;CARRIAGE-RETURN +FF EQU 0CH ;FORM-FEED +ESC EQU 1BH ;ESCAPE +CTRLC EQU 'C'-40H ;CONTROL-C +CTRLW EQU 'W'-40H ;CONTROL-W +CTRLX EQU 'X'-40H ;CONTROL-X +CTRLY EQU 'Y'-40H ;CONTROL-Y +CTRLZ EQU 'Z'-40H ;CONTROL-Z +; +BASE EQU 0B8H ; 4 DIL-SCHALTER +; +PIO0AD EQU BASE+0 ; PIO 0 A DATEN +PIO0AC EQU BASE+2 ; PIO 0 A CONTROL +PIO0BD EQU BASE+1 ; PIO 0 B DATEN +PIO0BC EQU BASE+3 ; PIO 0 B CONTROL +; +PIO1AD EQU BASE+4 ; PIO 1 A DATEN +PIO1AC EQU BASE+6 ; PIO 1 A CONTROL +PIO1BD EQU BASE+5 ; PIO 1 B DATEN +PIO1BC EQU BASE+7 ; PIO 1 B CONTROL +; +MAIN: LD DE,PIO_SRTMSG + CALL PSTRIN +; + LD DE,INI_MSG + CALL PSTRIN + CALL INIT +; + LD DE,PIO0ADW ;PIO0 A + CALL PSTRIN + LD A,55H + PUSH AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN + POP AF + OUT (PIO0AD),A + IN A,(PIO0AD) + PUSH AF +; + LD DE,PIO0ADR + CALL PSTRIN + POP AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN +; + LD DE,PIO0ADW + CALL PSTRIN + LD A,0AAH + PUSH AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN + POP AF + OUT (PIO0AD),A + IN A,(PIO0AD) + PUSH AF +; + LD DE,PIO0ADR + CALL PSTRIN + POP AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN +; + LD DE,PIO0BDW ;PIO0 B + CALL PSTRIN + LD A,55H + PUSH AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN + POP AF + OUT (PIO0BD),A + IN A,(PIO0BD) + PUSH AF +; + LD DE,PIO0BDR + CALL PSTRIN + POP AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN +; + LD DE,PIO0BDW + CALL PSTRIN + LD A,0AAH + PUSH AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN + POP AF + OUT (PIO0BD),A + IN A,(PIO0BD) + PUSH AF +; + LD DE,PIO0BDR + CALL PSTRIN + POP AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN +; + LD DE,PIO1ADW ;PIO1 A + CALL PSTRIN + LD A,55H + PUSH AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN + POP AF + OUT (PIO1AD),A + IN A,(PIO1AD) + PUSH AF +; + LD DE,PIO1ADR + CALL PSTRIN + POP AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN +; + LD DE,PIO1ADW + CALL PSTRIN + LD A,0AAH + PUSH AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN + POP AF + OUT (PIO1AD),A + IN A,(PIO1AD) + PUSH AF +; + LD DE,PIO1ADR + CALL PSTRIN + POP AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN +; + LD DE,PIO1BDW ;PIO1 B + CALL PSTRIN + LD A,55H + PUSH AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN + POP AF + OUT (PIO1BD),A + IN A,(PIO1BD) + PUSH AF +; + LD DE,PIO1BDR + CALL PSTRIN + POP AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN +; + LD DE,PIO1BDW + CALL PSTRIN + LD A,0AAH + PUSH AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN + POP AF + OUT (PIO1BD),A + IN A,(PIO1BD) + PUSH AF +; + LD DE,PIO1BDR + CALL PSTRIN + POP AF + CALL OUTB + LD DE,LINE_E + CALL PSTRIN +; + LD DE,PIO_ENDMSG + CALL PSTRIN + JP BOOT +; +;========================================================================== +INIT: LD HL,PIO0T ; PIO0 INITITALISIEREN + CALL INITX + LD HL,PIO1T ; PIO1 INITITALISIEREN + CALL INITX + RET +; +INITX: LD A,(HL) ; BYTE-ANZAHL + OR A + RET Z + LD B,A ; Port-Adresse nach C + INC HL + LD C,(HL) + INC HL + OTIR + JR INITX +; +PIO0T: DEFB 05 ; 5 BYTE ZUM PIO 0 A CONTROL + DEFB PIO0AC + DEFB 00000011B ; DIS-INT + DEFB 01001111B ; BETR.ART BYTE EINGABE + DEFB 01001111B ; BETR.ART BYTE EINGABE + DEFB 11001111B ; BETR.ART BIT EIN/AUSG. + DEFB 00000000B ; ALLES AUSG. + DEFB 01 ; 1 BYTE ZUM PIO 0 A DATEN + DEFB PIO0AD + DEFB 00000000B ; DATEN "LOW" +; + DEFB 05 ; 5 BYTE ZUM PIO 0 B CONTROL + DEFB PIO0BC + DEFB 00000011B ; DIS-INT + DEFB 01001111B ; BETR.ART BYTE EINGABE + DEFB 01001111B ; BETR.ART BYTE EINGABE + DEFB 11001111B ; BETR.ART BIT EIN/AUSG. + DEFB 00000000B ; ALLES AUSG. + DEFB 01 ; 1 BYTE ZUM PIO 0 B DATEN + DEFB PIO0BD + DEFB 00000000B ; DATEN "LOW" + DEFB 0 ; ENDE PIO 0 B -TABELLE +; +PIO1T: DEFB 05 ; 5 BYTE ZUM PIO 1 A CONTROL + DEFB PIO1AC + DEFB 00000011B ; DIS-INT + DEFB 01001111B ; BETR.ART BYTE EINGABE + DEFB 01001111B ; BETR.ART BYTE EINGABE + DEFB 11001111B ; BETR.ART BIT EIN/AUSG. + DEFB 00000000B ; ALLES AUSG. + DEFB 01 ; 1 BYTE ZUM PIO 1 A DATEN + DEFB PIO1AD + DEFB 00000000B ; DATEN "LOW" +; + DEFB 05 ; 5 BYTE ZUM PIO 1 B CONTROL + DEFB PIO1BC + DEFB 00000011B ; DIS-INT + DEFB 01001111B ; BETR.ART BYTE EINGABE + DEFB 01001111B ; BETR.ART BYTE EINGABE + DEFB 11001111B ; BETR.ART BIT EIN/AUSG. + DEFB 00000000B ; ALLES AUSG. + DEFB 01 ; 1 BYTE ZUM PIO 1 B DATEN + DEFB PIO1BD + DEFB 00000000B ; DATEN "LOW" + DEFB 0 ; ENDE PIO 1 B -TABELLE +; +;========================================================================== +; +;Output on Screen +;**************** +; +PRBS: LD E,BS + CALL PCHAR + RET +; +;Output CR+LF on Screen +;********************** +; +CRLF: LD E,CR + CALL PCHAR + LD E,LF + CALL PCHAR + RET +; +;Output ASCII-Character +;********************** +; +PRINP: PUSH AF + LD E,A + CALL PCHAR + POP AF + RET; +; +;CALL BDOS with Register Save +;**************************** +; +INCHA: LD C,1 ;INPUT CHARACTER TO A + JR BDO +PCHAR: LD C,2 ;PRINT CHARACTER IN E + JR BDO +PSTRIN: LD C,9 ;PRINT STRING + JR BDO +INBUFF: LD C,10 ;READ CONSOLE-BUFFER + JR BDO +CSTS: LD C,11 ;CONSOLE-STATUS + JR BDO +OPEN: LD C,15 ;OPEN FILE + JR BDO +CLOSE: LD C,16 ;CLOSE FILE + JR BDO +DELETE: LD C,19 ;DELETE FILE + JR BDO +READS: LD C,20 ;READ SEEK + JR BDO +WRITES: LD C,21 ;WRITE SEEK + JR BDO +MAKE: LD C,22 ;MAKE FILE + JR BDO +SETDMA: LD C,26 ;SET DMA-ADDRESS +BDO: PUSH HL + PUSH DE + PUSH BC + PUSH IX + PUSH IY + CALL BDOS + POP IY + POP IX + POP BC + POP DE + POP HL + RET +; +;DIRECT CONSOLE INPUT +;******************** +; +INDCON: CALL INDCOX + CP 0 + JR Z,INDCON + RET +; +INDCOX: LD C,6 ;Code for Direct Console Input + LD E,0FFH ;Code for Input + PUSH HL + PUSH DE + PUSH BC + PUSH IX + PUSH IY + CALL BDOS + POP IY + POP IX + POP BC + POP DE + POP HL + RET +; +; +;Output WORD +;*********** +; +;PARAMETER: Entry WORD IN HL +;********* +; +OUTW: LD A,H + CALL OUTB + LD A,L + CALL OUTB + RET +; +;Output BYTE +;*********** +; +;PARAMETER: Entry BYTE IN A +;********* +; +OUTB: PUSH AF + RRCA + RRCA + RRCA + RRCA + AND 0FH + CALL HBTHE ;Change Half-BYTE + POP AF + AND 0FH + CALL HBTHE + RET +; +;Output HALF-BYTE +;**************** +; +;PARAMETER: Entry Half-BYTE IN A (BIT 0 - 3) +;********* +; +HBTHE: CP 0AH + JR C,HBTHE1 + ADD A,7 ;Character to Letter +HBTHE1: ADD A,30H + LD E,A + CALL PCHAR + RET +; +;Input ADDRESS +;************* +; +;PARAMETER: Exit with ADDRESS IN HL +;********* +; +INADR: LD HL,0 +INADR1: CALL INCHAR ;Input TETRADE + LD D,A + CALL INBYT1 ;IN HEXA + RET C ;END OF Input + ADD HL,HL + ADD HL,HL + ADD HL,HL + ADD HL,HL + OR L + LD L,A + JR INADR1 ;New Key +; +; +;Input BYTE +;********** +; +;PARAMTER: Exit with BYTE IN A +;******** +; +INBYT: CALL INADR + LD A,L + RET +; +;Input of one TETRADE to A (BIT 0-3) +;************************************ +; +INBYT1: SUB '0' + RET C + CP 'G'-30H + JR NC,INBYT3 ;Error + CP ':'-30H + JR C,INBYT2 + CP 'A'-30H + JR C,INBYT3 ;Error + SUB 7 +INBYT2: OR A + RET +; +INBYT3: SCF + RET +; +;Input ASCII-Character to A +;************************** +; +INCON: CALL INDCON ;Input ASCII-Character to A + CP CTRLC ;TEST CONTROL-C + JP Z,QUIT + CP CTRLX ;TEST CONTROL-X + JR Z,INCHA1 + CP CTRLW ;TEST CONTROL-W + JR Z,INCHA3 + CP CTRLY ;TEST CONTROL-Y + JR Z,INCHA2 + CP BS + RET Z + CP CR + RET Z + CP ' ' + JR C,INCON + JR INCH1 +; +INCHAR: CALL INCHA ;Input ASCII-Character to A + CP CTRLC ;TEST CONTROL-C + JR Z,QUIT + CP CTRLX ;TEST CONTROL-X + JR Z,INCHA1 + CP CTRLW ;TEST CONTROL-W + JR Z,INCHA3 + CP CTRLY ;TEST CONTROL-Y + JR Z,INCHA2 + CP BS + RET Z + CP CR + RET Z + CP ' ' + JR C,INCHAR ;Input invalied +; +INCH1: CP 'A' + RET C ;Character ok +; + RES 5,A ;lower case -> upper case + RET +INCHA1: POP HL + LD E,FF + CALL PCHAR ;Clear screen + JP GOON +INCHA2: POP HL + LD E,FF + CALL PCHAR ;Clear screen + JP GOON +INCHA3: LD E,FF + CALL PCHAR + RET +; +;ABBRUCH DER BEARBEITUNG +;*********************** +; +COMPLT: LD DE,TCOMP + CALL PSTRIN + JP GOON +QUIT: CALL CRLF + LD DE,TQUIT + JR FINIS +INTTIM: POP DE ;STACK OK +; CALL DESAK + LD DE,TNMIAB + CALL PSTRIN + LD DE,MAIN ;NEW ADDRESS + PUSH DE + RETN +FINIS: CALL PSTRIN ;AT BDOS-ERROR +GOON: + JP BOOT +; +; +;TEXT-Messages +;************* +; +TCOMP: DEFB ESC,21,0,14H,ESC,23,0 + DEFM 'Function complete !!$' +TQUIT: DEFB ESC,23,0,14H,7 + DEFM 'End Run RAMFTEST$' +TNMIAB: DEFB ESC,23,0,14H + DEFM 'Time Out !!$' +; +; +INI_MSG:DEFM 'ECB-4PIO Init all PIO Bit-Mode ',CR,LF,'$' +PIO0ADW:DEFM 'ECB-4PIO Write to PIO0AD ','$' +PIO0ADR:DEFM 'ECB-4PIO Read from PIO0AD ','$' +PIO0BDW:DEFM 'ECB-4PIO Write to PIO0BD ','$' +PIO0BDR:DEFM 'ECB-4PIO Read from PIO0BD ','$' +PIO1ADW:DEFM 'ECB-4PIO Write to PIO1AD ','$' +PIO1ADR:DEFM 'ECB-4PIO Read from PIO1AD ','$' +PIO1BDW:DEFM 'ECB-4PIO Write to PIO1BD ','$' +PIO1BDR:DEFM 'ECB-4PIO Read from PIO1BD ','$' + +PIO_SRTMSG: + DEFM 'ECB-ZILOG PERIPHERALS start test 1.0',CR,LF,'$' +PIO_ENDMSG: + DEFM 'ECB-ZILOG PERIPHERALS end test 1.0',CR,LF,'$' +LINE_E: DEFM 'H',CR,LF,'$' +; + IF1 + .PRINTX 'Pass 1 complete' + ENDIF +; + IF2 + .PRINTX 'Pass 2 complete' + .PRINTX 'Assembly complete' + ENDIF +; + END + diff --git a/Source/Apps/Test/2piotst/Build.cmd b/Source/Apps/Test/2piotst/Build.cmd new file mode 100644 index 00000000..8d719eab --- /dev/null +++ b/Source/Apps/Test/2piotst/Build.cmd @@ -0,0 +1,13 @@ +@echo off +setlocal + +set TOOLS=..\..\..\..\Tools + +set PATH=%TOOLS%\zxcc;%PATH% + +set CPMDIR80=%TOOLS%/cpm/ + +zxcc M80 -=2piotst/l || exit /b +zxcc L80 -2piotst,2piotst.com/n/e || exit /b + +copy /Y 2piotst.com ..\..\..\..\Binary\Apps\Test\ || exit /b diff --git a/Source/Apps/Test/2piotst/Clean.cmd b/Source/Apps/Test/2piotst/Clean.cmd new file mode 100644 index 00000000..a9c92a7d --- /dev/null +++ b/Source/Apps/Test/2piotst/Clean.cmd @@ -0,0 +1,8 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin +if exist *.rel del *.rel +if exist *.prn del *.prn diff --git a/Source/Apps/Test/2piotst/Makefile b/Source/Apps/Test/2piotst/Makefile new file mode 100644 index 00000000..6dde1f3a --- /dev/null +++ b/Source/Apps/Test/2piotst/Makefile @@ -0,0 +1,8 @@ +OBJECTS = 2piotst.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools +OTHERS = *.rel + +include $(TOOLS)/Makefile.inc + +2piotst.com : 2piotst.rel \ No newline at end of file diff --git a/Source/Apps/Test/Build.cmd b/Source/Apps/Test/Build.cmd new file mode 100644 index 00000000..f757cf32 --- /dev/null +++ b/Source/Apps/Test/Build.cmd @@ -0,0 +1,40 @@ +@echo off +setlocal + +set TOOLS=../../../Tools +set APPBIN=..\..\Binary\Apps + +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%PATH% + +set TASMTABS=%TOOLS%\tasm32 + +set CPMDIR80=%TOOLS%/cpm/ + +pushd DMAmon && call Build || exit /b & popd +pushd tstdskng && call Build || exit /b & popd +pushd inttest && call Build || exit /b & popd +pushd ppidetst && call Build || exit /b & popd +pushd ramtest && call Build || exit /b & popd +pushd I2C && call Build || exit /b & popd +pushd rzsz && call Build || exit /b & popd +pushd vdctest && call Build || exit /b & popd +pushd kbdtest && call Build || exit /b & popd +pushd ps2info && call Build || exit /b & popd +pushd 2piotst && call Build || exit /b & popd +pushd piomon && call Build || exit /b & popd +pushd banktest && call Build || exit /b & popd +pushd portscan && call Build || exit /b & popd + +goto :eof + +:asm +echo. +echo Building %1... +tasm -t80 -g3 -fFF %1.asm %1.com %1.lst || exit /b +goto :eof + +:asm180 +echo. +echo Building %1... +tasm -t180 -g3 -fFF %1.asm %1.com %1.lst || exit /b +goto :eof diff --git a/Source/Apps/Test/Clean.cmd b/Source/Apps/Test/Clean.cmd new file mode 100644 index 00000000..1e62b7d8 --- /dev/null +++ b/Source/Apps/Test/Clean.cmd @@ -0,0 +1,23 @@ +@echo off +setlocal + +if exist *.bin del *.bin +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.hex del *.hex +if exist *.prn del *.prn + +pushd DMAmon && call Clean || exit /b 1 & popd +pushd tstdskng && call Clean || exit /b 1 & popd +pushd inttest && call Clean || exit /b 1 & popd +pushd ppidetst && call Clean || exit /b 1 & popd +pushd ramtest && call Clean || exit /b 1 & popd +pushd I2C && call Clean || exit /b 1 & popd +pushd rzsz && call Clean || exit /b 1 & popd +pushd vdctest && call Clean || exit /b 1 & popd +pushd kbdtest && call Clean || exit /b 1 & popd +pushd ps2info && call Clean || exit /b 1 & popd +pushd 2piotst && call Clean || exit /b 1 & popd +pushd piomon && call Clean || exit /b 1 & popd +pushd banktest && call Clean || exit /b 1 & popd +pushd portscan && call Clean || exit /b 1 & popd diff --git a/Source/Apps/Test/DMAmon/Build.cmd b/Source/Apps/Test/DMAmon/Build.cmd new file mode 100644 index 00000000..7bfc3f43 --- /dev/null +++ b/Source/Apps/Test/DMAmon/Build.cmd @@ -0,0 +1,11 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF dmamon.asm dmamon.com dmamon.lst || exit /b + +copy /Y dmamon.com ..\..\..\..\Binary\Apps\Test\ || exit /b + diff --git a/Source/Apps/Test/DMAmon/Clean.cmd b/Source/Apps/Test/DMAmon/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/DMAmon/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/DMAmon/Makefile b/Source/Apps/Test/DMAmon/Makefile new file mode 100644 index 00000000..f605796f --- /dev/null +++ b/Source/Apps/Test/DMAmon/Makefile @@ -0,0 +1,7 @@ +OBJECTS = dmamon.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/Test/DMAmon/Readme.txt b/Source/Apps/Test/DMAmon/Readme.txt new file mode 100644 index 00000000..24ca0401 --- /dev/null +++ b/Source/Apps/Test/DMAmon/Readme.txt @@ -0,0 +1,8 @@ +DMAmon is a program to verify operation of the Z80 MBC DMA board + +Version 2 has been hacked to include testing for interrupts. This +requires running the application under RomWBW using IM2. There +is an equate in the source file to disable interrupt testing +if needed. + +--WBW 10:36 AM 3/14/2022 \ No newline at end of file diff --git a/Source/Apps/Test/DMAmon/dmamon.asm b/Source/Apps/Test/DMAmon/dmamon.asm new file mode 100644 index 00000000..c602d526 --- /dev/null +++ b/Source/Apps/Test/DMAmon/dmamon.asm @@ -0,0 +1,1220 @@ +;================================================================================================== +; Z80 DMA TEST UTILITY - ROMWBW SPECIFIC +;================================================================================================== +; +;================================================================================================== +; PLATFORM CONFIGURATION +;================================================================================================== +; +DMAMODE_NONE .EQU 0 +DMAMODE_ECB .EQU 1 ; ECB-DMA WOLFGANG KABATZKE'S Z80 DMA ECB BOARD +DMAMODE_Z180 .EQU 2 ; Z180 INTEGRATED DMA +DMAMODE_Z280 .EQU 3 ; Z280 INTEGRATED DMA +DMAMODE_RC .EQU 4 ; RCBUS Z80 DMA +DMAMODE_MBC .EQU 5 ; MBC +DMAMODE_VDG .EQU 6 ; VELESOFT DATAGEAR +; +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_MBC ; SELECT DMA DEVICE FOR TESTING +DMAIOTST .EQU $68 ; AN OUTPUT PORT FOR TESTING - 16C450 SERIAL OUT +; +;================================================================================================== +; HELPER MACROS AND EQUATES +;================================================================================================== +; +FALSE .EQU 0 +TRUE .EQU ~FALSE +; +#DEFINE PRTC(C) CALL PRTCH \ .DB C ; PRINT CHARACTER C TO CONSOLE - PRTC('X') +#DEFINE PRTS(S) CALL PRTSTRD \ .TEXT S ; PRINT STRING S TO CONSOLE - PRTD("HELLO") +#DEFINE PRTX(X) CALL PRTSTRI \ .DW X ; PRINT STRING AT ADDRESS X TO CONSOLE - PRTI(STR_HELLO) +; +;================================================================================================== +; INTERRUPT TESTING CONFIGURATION +; ASSUMES SYSTEM IS ALREADY CONFIGURED FOR IM2 OPERATION +; INTIDX MUST BE SET TO AN UNUSED INTERRUPT SLOT +;================================================================================================== +; +INTENABLE .EQU TRUE ; ENABLE INT TESTING +INTIDX .EQU 1 ; INT VECTOR INDEX +; +;================================================================================================== +; DMA MODE BYTES - I/O ROUTINES CLEAR b3 AND ONLY PROGRAM LOW ADDRESS +;================================================================================================== +; +DMA_BYTE .equ %10011101 ; b7b1b0 = Register = 1xxxxx01 = Program R4 + ; b6b5 = Transfer Mode = x00xxxxx = Byte transfer mode + ; b2 = start address (low) = xxxxx1xx = low address follows (1 byte) + ; b3 = start address (high) = xxxx1xxx = high address follows (1 byte) + ; b4 = int control byte = xxx1xxxx = interrupt, pulse or vector byte follow +; +DMA_CONTINUOUS .equ %10111101 ; b7b1b0 = Register = 1xxxxx01 = Program R4 + ; b6b5 = Transfer Mode = x01xxxxx = Continuous transfer mode (default) + ; b2 = start address (low) = xxxxx1xx = low address follows (1 byte) + ; b3 = start address (high) = xxxx1xxx = high address follows (1 byte) + ; b4 = int control byte = xxx1xxxx = interrupt, pulse or vector byte follow +; +DMA_BURST .equ %11011101 ; b7b1b0 = Register = 1xxxxx01 = Program R4 + ; b6b5 = Transfer Mode = x10xxxxx = Burst transfer mode + ; b2 = start address (low) = xxxxx1xx = low address follows (1 byte) + ; b3 = start address (high) = xxxx1xxx = high address follows (1 byte) + ; b4 = int control byte = xxx1xxxx = interrupt, pulse or vector byte follow +; +DMA_ICBYTE .equ %00001100 ; b7 = Interrupt Cont. Byte = 0xxxxxxx = Interrupt Control Byte identifier + ; b6 = Interrupt on RDY = x0xxxxxx = Do not interrupt on RDY + ; b5 = Status affects vector= xx0xxxxx = Status does not affect vector + ; b4 = Interrupt vector byte= xxx0xxxx = No interrupt vector byte will follow + ; b3 = Pulse control byte = xxxx1xxx = A pulse control byte will follow + ; b2 = Pulse generation = xxxxx100 = A pulse will be generated + ; b1 = Interrupt @ block end= xxxxxx0x = No interrupt at block end + ; b0 = Interrupt on match = xxxxxxx0 = No interrupt on match +; +DMA_LOAD .equ $cf ; %11001111 +DMA_ENABLE .equ $87 ; %10000111 +DMA_FORCE_READY .equ $b3 +DMA_DISABLE .equ $83 +DMA_START_READ_SEQUENCE .equ $a7 +DMA_READ_STATUS_BYTE .equ $bf +DMA_READ_MASK_FOLLOWS .equ $bb +DMA_RESET .equ $c3 +;DMA_RESET_PORT_A_TIMING .equ $c7 +;DMA_RESET_PORT_B_TIMING .equ $cb +;DMA_CONTINUE .equ $d3 +;DMA_DISABLE_INTERUPTS .equ $af +DMA_ENABLE_INTERUPTS .equ $ab +;DMA_RESET_DISABLE_INTERUPTS .equ $a3 +;DMA_ENABLE_AFTER_RETI .equ $b7 +DMA_REINIT_STATUS_BYTE .equ $8b +; +DMA_RDY .EQU %00001000 +DMA_FORCE .EQU 0 +DMA_XMODE .equ 1 ; Byte = 0, Continuous = 1, Burst = 2 +; +;================================================================================================== +; ROMWBW HBIOS DEFINITIONS +;================================================================================================== +; +bf_sysint .equ $FC ; INT function +bf_sysget .equ $F8 ; GET function +; +bf_sysintinfo .equ $00 ; INT INFO subfunction +bf_sysintget .equ $10 ; INT GET subfunction +bf_sysintset .equ $20 ; INT SET subfunction +bf_sysgetcpuspd .equ $F3 ; GET CPUSPD subfunction +; +;================================================================================================== +; MAIN DMA MONITOR ROUTINE +;================================================================================================== +; + .ORG $0100 +; +MAIN: + LD (SAVSTK),SP ; SETUP LOCAL + LD SP,STACK ; STACK +; + call PRTSTRD ; WELCOME + .db "\n\rDMA Monitor V3\n\r$" +; +#IF (INTENABLE) +; + ; Install interrupt handler in upper mem + ld hl,reladr + ld de,$A000 + ld bc,hsiz + ldir +; + ; Install interrupt vector (RomWBW specific!!!) + ld hl,int ; pointer to my interrupt handler + ld b,bf_sysint + ld c,bf_sysintset ; set new vector + ld e,INTIDX ; vector idx + di + rst 08 ; do it + ld (orgvec),hl ; save the original vector + ei ; interrupts back on +; +#ENDIF +; +MENULP: CALL DISPM ; DISPLAY MENU + CALL CINU ; GET SELECTION + CALL COUT +; +MENULP1: + CALL NEWLINE + CP 'C' + JP Z,DMACFG_C ; CONFIGURE XFER MODE + CP 'D' + JP Z,DMATST_D ; DUMP REGISTERS + CP 'I' + JP Z,DMATST_I ; INITIALIZE +#IF (INTENABLE) + CP 'T' + JP Z,DMATST_T ; TOGGLE INT USAGE +#ENDIF + CP 'M' + JP Z,DMATST_M ; MEMORY COPY + CP 'N' + JP Z,DMATST_N ; MEMORY COPY ITER + CP '0' + JP Z,DMATST_01 + CP 'O' + JP Z,DMATST_O +#IF !(DMAMODE==DMAMODE_VDG) + CP '1' + JP Z,DMATST_01 + CP 'R' + JP Z,DMATST_R ; TOGGLE RESET + CP 'Y' + JP Z,DMATST_Y ; TOGGLE READY +#ENDIF + cp 'S' + jp z,DMACFG_S ; SET PORT + cp 'V' + jp z,DMACFG_V ; TOGGLE VERBOSE + CP 'X' + JP Z,DMABYE ; EXIT +; + JR MENULP +; +DMABYE: +#IF (INTENABLE) + ; Deinstall interrupt vector + ld hl,(orgvec) ; original vector + ld b,bf_sysint + ld c,bf_sysintset ; set new vector + ld e,INTIDX ; vector idx + di + rst 08 ; do it + ei ; interrupts back on +#ENDIF +; + LD SP,(SAVSTK) ; RESTORE CP/M STACK + RET +; +;================================================================================================== +; CONFIGURE PORT +;================================================================================================== +; +DMACFG_S: + call PRTSTRD + .db "\n\rSet port address\n\rPort:$" + call HEXIN + ld hl,dmaport + ld (hl),a + inc hl + inc a + ld (hl),a + jp MENULP +; +DMATST_I: + call PRTSTRD + .db "\n\rStart Initialization\n\r$" + CALL DMA_INIT + JP MENULP +; +#IF (INTENABLE) +; +DMATST_T: + LD A,(USEINT) + XOR $FF + LD (USEINT),A + JP MENULP +; +#ENDIF +; +DMATST_M: + call PRTSTRD + .db "\n\rPerforming Memory-Memory Copy Test\n\r$" + CALL DMAMemTest + JP MENULP +; +DMATST_N: + call PRTSTRD + .db "\n\rPerforming Iterative Memory-Memory Copy Test\n\r$" + CALL DMAMemTestIter + JP MENULP +; +DMATST_01: + call PRTSTRD + .db "\n\rPerforming Port Selection Test\n\r$" + CALL DMA_Port01 + JP MENULP +; +DMATST_O: + call PRTSTRD + .db "\n\rTest output to I/O device\n\r$" + CALL DMA_ReadyO + JP MENULP +; +DMATST_D: + call PRTSTRD + .db "\n\rRegister dump:\n\r$" + CALL DMARegDump + JP MENULP +; +DMATST_Y: + call PRTSTRD + .db "\n\rPerforming Ready Bit Test\n\r$" + CALL DMA_ReadyT + JP MENULP +; +DMATST_R: + call PRTSTRD + .db "\n\rPerforming Reset\n\r$" +; CALL + JP MENULP + +DMACFG_C: + CALL DMA_XferM + call PRTSTRD + .db "\n\rTransfer mode change to: $" + LD a,(dmaxfer) + LD DE,DMA_XFRMODE + CALL PRTIDXDEA + CALL NEWLINE + JP MENULP +; +;================================================================================================== +; DISPLAY MENU +;================================================================================================== +; +DISPM: call PRTSTRD + .db "\n\rDMA Device: $" + LD C,DMAMODE ; DISPLAY + LD A,00000111B ; TARGET + LD DE,DMA_DEV_STR ; DEVICE + CALL PRTIDXMSK +; + call PRTSTRD + .db ", Port=0x$" + LD A,(dmaport) ; DISPLAY + CALL PRTHEXBYTE ; DMA PORT +; +#IF (INTENABLE) +; + call PRTSTRD + .db "\n\rInterrupts=$" + LD A,(USEINT) + OR A + LD A,'Y' + JR NZ,DISPM_INT + LD A,'N' + JR DISPM_INT +; +DISPM_INT: + CALL COUT +; + call PRTSTRD + .db ", Interrupt Count=$" + ld hl,(counter) + call PRTDEC +; +#ENDIF +; +#IF (DMAMODE==DMAMODE_VDG) + call PRTSTRD + .db "\n\rReset\\Ready Latch unsupported.$" +#ENDIF + call PRTSTRD ; DISPLAY SPEED + .db "\n\rCPU at $" + LD B,bf_sysget + LD C,bf_sysgetcpuspd ; GET CURRENT + RST 08 ; SPEED SETTING + OR A + LD A,L + JR Z,SPDDISP + LD A,3 +SPDDISP:LD DE,DMA_SPD_STR + CALL PRTIDXDEA +; + call PRTSTRD + .db "\n\rTransfer Mode: $" ; DIPLAY TRANSFER + LD a,(dmaxfer) ; MODE + LD DE,DMA_XFRMODE + CALL PRTIDXDEA + CALL NEWLINE +; + LD HL,MENU_OPT ; DISPLAY + CALL PRTSTR ; MENU OPTIONS + RET +; +#INCLUDE "util.asm" +; +;================================================================================================== +; DMA INITIALIZATION CODE +;================================================================================================== +; +DMA_INIT: + CALL NEWLINE + PRTS("DMA: IO=0x$") ; announce + LD A,(dmaport) + CALL PRTHEXBYTE +; +#IF !(DMAMODE==DMAMODE_VDG) + ld a,(dmautil) + ld c,a + LD A,DMA_FORCE + out (c),a ; force ready off +#ENDIF +; + call DMAProbe ; do we have a dma? + jr nz,DMA_NOTFOUND +; + call PRTSTRD + .db " DMA Found\n\r$" +; + ld hl,DMAInitMode ; setup the + call SETXFER ; transfer mode + set 3,(hl) ; upper and lower address +; + ld hl,DMACode ; program the + ld b,DMACode_Len ; dma command + ld c,DMABASE ; block +; + di + otir ; load dma + ei + xor a ; set status +; +DMA_EXIT: + ret +; +DMA_NOTFOUND: + push af + call PRTSTRD + .db " NOT Present$" + pop af + jr DMA_EXIT +; +DMA_FAIL_FLAG: + .db 0 +; +DMACode ;.db DMA_DISABLE ; R6-Command Disable DMA + .db %01111101 ; R0-Transfer mode, A -> B, start address, block length follow + .dw 0 ; R0-Port A, Start address + .dw 0 ; R0-Block length + .db %00010100 ; R1-No timing bytes follow, address increments, is memory + .db %00010000 ; R2-No timing bytes follow, address increments, is memory + .db %10000000 ; R3-DMA, interrupt, stop on match disabled +DMAInitMode: .db DMA_CONTINUOUS ; R4-Transfer mode, destination address, interrupt and control byte follow + .dw 0 ; R4-Port B, Destination address + .db DMA_ICBYTE ; R4-Pulse byte follows, Pulse generated + .db 0 ; R4-Pulse offset + .db %10010010+DMA_RDY; R5-Stop on end of block, ce/wait multiplexed, READY active config + .db DMA_LOAD ; R6-Command Load +; .db DMA_FORCE_READY ; R6-Command Force ready +; .db DMA_ENABLE ; R6-Command Enable DMA +DMACode_Len .equ $-DMACode +; +;================================================================================================== +; STRINGS +;================================================================================================== +; +DMA_DEV_STR: + .TEXT "NONE$" + .TEXT "ECB$" + .TEXT "Z180$" + .TEXT "Z280$" + .TEXT "RCBUS$" + .TEXT "MBC$" + .TEXT "DATAGEAR$" +; +DMA_SPD_STR: + .TEXT "half speed.$" + .TEXT "full speed.$" + .TEXT "double speed.$" + .TEXT "unknown speed.$" +; +DMA_XFRMODE: + .TEXT "Byte.$" + .TEXT "Continuous.$" + .TEXT "Burst.$" +; +MENU_OPT: + .TEXT "\n\r" + .TEXT "C) Change transfer mode\n\r" + .TEXT "D) Dump DMA registers\n\r" + .TEXT "I) Initialize DMA\n\r" + .TEXT "T) Toggle Interrupt Usage\n\r" + .TEXT "M) Test Memory-Memory Copy\n\r" + .TEXT "N) Test Memory-Memory Copy Iteratively\n\r" + .TEXT "O) Memory to I/O Test\n\r" + .TEXT "0) Test DMA Port Selection\n\r" +#IF !(DMAMODE==DMAMODE_VDG) + .TEXT "1) Test DMA Latch Port Selection\n\r" + .TEXT "Y) Test Ready Bit\n\r" +#ENDIF + .TEXT "S) Set DMA port\n\r" + .TEXT "L) Set Latch port\n\r" + .TEXT "V) Verbose status toggle\n\r" + .TEXT "X) Exit\n\r" + + .TEXT ">$" +; +;================================================================================================== +; TOGGLE TRANSFER MODE +;================================================================================================== +; +DMA_XferM: ; Set next transfer mode + ld a,(dmaxfer) + inc a + cp 3 + jr nz,NextX + ld a,0 +NextX: ld (dmaxfer),a + ret +; +;================================================================================================== +; TOGGLE VERBOSE MODE +;================================================================================================== +; +DMACFG_V: + ld a,(dmavbs) + cpl + ld (dmavbs),a + jp MENULP +; +;================================================================================================== +; OUTPUT A BUFFER OF TEXT TO AN IOPORT +;================================================================================================== +; +DMABUF .TEXT "0123456789abcdef" +; +DMA_ReadyO: + call PRTSTRD + .db "\r\nOutputing string to port 0x$" + ld a,DMAIOTST + call PRTHEXBYTE + call NEWLINE +; + ld b,16 +IOLoop: push bc + call NEWLINE + ld hl,DMABUF + ld a,DMAIOTST + ld bc,16 +; + call DMAOTIR +; + pop bc + djnz IOLoop + call NEWLINE + ret +; +;================================================================================================== +; PULSE PORT (COMMON ROUTINE WHERE A CONTAINS THE ASCII PORT OFFSET) +;================================================================================================== +; +DMA_Port01: + call PRTSTRD + .db "\r\nPulsing port 0x$" + sub '0' ; Calculate + ld c,a + ld a,(dmaport) ; Port to + add a,c + call PRTHEXBYTE + call NEWLINE + ld c,a ; toggle + ld b,$20 ; loop counter +portlp: push bc + call PC_PERIOD + push bc + ld b,0 + ld a,0 +portlp1:out (c),a + djnz portlp1 + pop bc + call delay + pop bc + djnz portlp + call NEWLINE + JP MENULP +; +delay: push bc + ld bc,0 +dlylp: dec bc + ld a,b + or c + jr nz,dlylp + pop bc + ret +; +;================================================================================================== +; TOGGLE READY BIT +;================================================================================================== +; +DMA_ReadyT: + call NEWLINE +#IF !(DMAMODE==DMAMODE_VDG) + +#ENDIF + ld a,(dmautil) + ld c,a ; toggle + ld b,$20 ; loop counter +portlp2:push bc + ld a,b + call PRTDECB + call PRTSTRD + .db ": ON$" + call delay + ld a,$FF +; ld c,DMABASE+1 + out (c),a + call PRTSTRD + .db " -> OFF$" + call delay + call PRTSTRD + .db "\r \r$" +; ld c,DMABASE+1 + ld a,0 + out (c),a + pop bc + djnz portlp2 + ret +; +;================================================================================================== +; DMA MEMORY MOVE +;================================================================================================== +; +DMAMemMove: + LD HL,$8000 ; PREFILL DESTINATION WITH $55 + LD A,$55 + LD (HL),A + LD DE,$8001 + LD BC,4096-1 + LDIR +; + LD HL,PROEND ; FILL SOURCE WITH $AA + LD A,$AA + LD (HL),A + LD DE,PROEND+1 + LD BC,4096-1 + LDIR +; + LD HL,PROEND ; DMA COPY + LD DE,$8000 + LD BC,4096-1 + LD A,(USEINT) ; USE INTS? + OR A ; TEST VALUE + JR NZ,DMAMemMove1 ; IF SO, DO SO + CALL DMALDIR ; ELSE NORMAL DMA + JR DMAMemMove2 +; +DMAMemMove1: + CALL DMALDIRINT ; DMA W/ INTERRUPTS +; +DMAMemMove2: +; +; LD HL,$8400 ; PLANT +; LD A,$00 ; BAD +; LD (HL),A ; SEED +; + LD A,$AA ; CHECK COPY SUCCESSFULL + LD HL,$8000 + LD BC,4096 +NXTCMP: CPI + JP PO,CMPOK + JR Z,NXTCMP + RET ; RET W/ ZF CLEAR +; +CMPOK: + RET ; RET W/ ZF SET +; +;================================================================================================== +; DMA MEMORY TEST +;================================================================================================== +; +DMAMemTest: + call DMAMemMove ; do a single memory copy + jr z,DMAMemTestOK + jr DMAMemTestFail +; +DMAMemTestOK: + call PRTSTRD + .db "\n\rMemory-Memory Test Passed\n\r$" + ret +; +DMAMemTestFail: + call PRTSTRD + .db "\n\rMemory-Memory Test Failed\n\r$" + ret +; +;================================================================================================== +; DMA MEMORY MOVE ITERATIVE +;================================================================================================== +; +DMAMemTestIter: + ld b,$20 ; loop counter + ld a,b + call PRTDECB + call PRTSTRD + .db " iterations:\n\r$" +DMAMemTestIterLoop: + push bc ; save loop control + call DMAMemMove ; do an iteration + jr z,DMAMemTestIterOK + call PRTSTRD + .db " Mismatch\n\r$" + jr DMAMemTestIterCont ; continue +; +DMAMemTestIterOK: + call PRTSTRD + .db " Match\n\r$" +; +DMAMemTestIterCont: + pop bc + djnz DMAMemTestIterLoop + call NEWLINE + ret +; +;================================================================================================== +; DMA PROBE - WRITE TO ADDRESS REGISTER AND READ BACK +;================================================================================================== +; +DMAProbe: + ld a,(dmaport) + ld c,a + ld a,DMA_RESET + out (c),a + ld a,%01111101 ; R0-Transfer mode, A -> B, start address follows + out (c),a + ld a,$cc + out (c),a + ld a,$dd + out (c),a + ld a,$e5 + out (c),a + ld a,$1a + out (c),a + ld a,DMA_LOAD + out (c),a +; + ld a,DMA_READ_MASK_FOLLOWS ; set up + out (c),a ; for + ld a,%00011000 ; register + out (c),a ; read + ld a,DMA_START_READ_SEQUENCE + out (c),a +; + in a,(c) ; read in + ld e,a ; address + in a,(c) + ld d,a +; + xor a ; is it + ld hl,$ddcc ; a match + sbc hl,de ; return with + ret z ; status + cpl + ret +; +;================================================================================================== +; DMA COPY BLOCK CODE - ASSUMES DMA PREINITIALIZED +;================================================================================================== +; +DMALDIR: + ld (DMASource),hl ; populate the dma + ld (DMADest),de ; register template + ld (DMALength),bc +; + ld hl,DMACopyMode + call SETXFER + set 3,(hl) ; upper and lower address +; + ld hl,DMACopy ; program the + ld b,DMACopy_Len ; dma command + ld a,(dmaport) ; block + ld c,a +; + di + otir ; load and execute dma + ei +; + call DMASTATUS + ret +; +DMACopy ;.db DMA_DISABLE ; R6-Command Disable DMA + .db %01111101 ; R0-Transfer mode, A -> B, start address, block length follow +DMASource .dw 0 ; R0-Port A, Start address +DMALength .dw 0 ; R0-Block length + .db %00010100 ; R1-No timing bytes follow, address increments, is memory + .db %00010000 ; R2-No timing bytes follow, address increments, is memory + .db %10000000 ; R3-DMA, interrupt, stop on match disabled +DMACopyMode: .db DMA_CONTINUOUS ; R4-Transfer mode. Destination address, interrupt and control byte follow +DMADest .dw 0 ; R4-Port B, Destination address + .db DMA_ICBYTE ; R4-Pulse byte follows, Pulse generated + .db 0 ; R4-Pulse offset +; .db %10010010+DMA_RDY;R5-Stop on end of block, ce/wait multiplexed, READY active config + .db DMA_LOAD ; R6-Command Load + .db DMA_FORCE_READY ; R6-Command Force ready + .db DMA_ENABLE ; R6-Command Enable DMA +DMACopy_Len .equ $-DMACopy +; +;================================================================================================== +; DMA COPY BLOCK CODE - ASSUMES DMA PREINITIALIZED +; INTERRUPT VERSION! +;================================================================================================== +; +DMALDIRINT: +; +#IF (INTENABLE) +; + ld (DMASourceInt),hl ; populate the dma + ld (DMADestInt),de ; register template + ld (DMALengthInt),bc +; + ld hl,DMAICopyMode + call SETXFER + set 3,(hl) ; upper and lower address +; + ld hl,DMACopyInt ; program the + ld b,DMACopyInt_Len ; dma command + ld a,(dmaport) ; block + ld c,a +; + di + otir ; load and execute dma + ei +; + call DMASTATUS +#ENDIF +; + ret +; +#IF (INTENABLE) +; +DMACopyInt ;.db DMA_DISABLE ; R6-Command Disable DMA + .db %01111101 ; R0-Transfer mode, A -> B, start address, block length follow +DMASourceInt .dw 0 ; R0-Port A, Start address +DMALengthInt .dw 0 ; R0-Block length + .db %00010100 ; R1-No timing bytes follow, address increments, is memory + .db %00010000 ; R2-No timing bytes follow, address increments, is memory + .db %10100000 ; R3-DMA, interrupt, stop on match disabled +DMAICopyMode: .db DMA_CONTINUOUS ; R4-Transfer mode, destination address, interrupt and control byte follow +DMADestInt .dw 0 ; R4-Port B, Destination address + .db %00011110 ; R4-Interrupt control byte: Pulse byte follows, Pulse generated + .db 0 ; R4-Pulse control byte + .db INTIDX*2 ; R4-Interrupt vector +; .db %10010010+DMA_RDY;R5-Stop on end of block, ce/wait multiplexed, READY active config + .db %10011010 + .db DMA_LOAD ; R6-Command Load + .db DMA_FORCE_READY ; R6-Command Force ready + .db DMA_ENABLE ; R6-Command Enable DMA +DMACopyInt_Len .equ $-DMACopyInt +; +#ENDIF +; +;================================================================================================== +; DMA I/O OUT BLOCK CODE - ADDRESS TO I/O PORT +;================================================================================================== +; +DMAOTIR: + ld (DMAOutSource),hl ; populate the dma + ld (DMAOutDest),a ; register template + ld (DMAOutLength),bc +; + ld hl,DMAOutMode + call SETXFER + res 3,(hl) ; no upper address +; + ld hl,DMAOutCode ; program the + ld b,DMAOut_Len ; dma command + ld a,(dmaport) ; block + ld c,a +; + di + otir ; load and execute dma + ei +; + call DMASTATUS + ret +; +DMAOutCode ;.db DMA_DISABLE ; R6-Command Disable DMA + .db %01111001 ; R0-Transfer mode, B -> A (temp), start address, block length follow +DMAOutSource .dw 0 ; R0-Port A, Start address +DMAOutLength .dw 0 ; R0-Block length + + .db %00010100 ; R1-No timing bytes follow, fixed incrementing address, is memory + .db %00101000 ; R2-No timing bytes follow, address static, is i/o + .db %10000000 ; R3-DMA, interrupt, stop on match disabled + +DMAOutMode: .db DMA_CONTINUOUS ; R4-Transfer Mode, destination port, interrupt and control byte follow +DMAOutDest .db 0 ; R4-Port B, Destination port + .db DMA_ICBYTE ; R4-Pulse byte follows, Pulse generated + .db 0 ; R4-Pulse offset + + .db %10010010+DMA_RDY;R5-Stop on end of block, ce/wait multiplexed, READY active config + .db DMA_LOAD ; R6-Command Load + .db %00000101 ; R0-Port A is Source + .db DMA_LOAD ; R6-Command Load + .db DMA_FORCE_READY ; R6-Command Force ready + .db DMA_ENABLE ; R6-Command Enable DMA +DMAOut_Len .equ $-DMAOutCode +; +;================================================================================================== +; DMA I/O INPUT BLOCK CODE - I/O PORT TO ADDRESS +;================================================================================================== +; +DMAINIR: + ld (DMAInDest),hl ; populate the dma + ld (DMAInSource),a ; register template + ld (DMAInLength),bc +; + ld hl,DMAOutMode + call SETXFER + res 3,(hl) ; no upper address + + ld hl,DMAInCode ; program the + ld b,DMAIn_Len ; dma command + ld a,(dmaport) ; block + ld c,a +; + di + otir ; load and execute dma + ei +; + call DMASTATUS + ret +; +DMAInCode ;.db DMA_DISABLE ; R6-Command Disable DMA + .db %01111001 ; R0-Transfer mode, B -> A, start address, block length follow +DMAInDest .dw 0 ; R0-Port A, Start address +DMAInLength .dw 0 ; R0-Block length + .db %00010100 ; R1-No timing bytes follow, address increments, is memory + .db %00111000 ; R2-No timing bytes follow, address static, is i/o + .db %10000000 ; R3-DMA, interrupt, stop on match disabled +DMAInMode: .db DMA_CONTINUOUS ; R4-Transfer mode, destination port, no interrupt, control byte. +DMAInSource .db 0 ; R4-Port B, Destination port + .db DMA_ICBYTE ; R4-Pulse byte follows, Pulse generated + .db 0 ; R4-Pulse offset + .db %10010010+DMA_RDY;R5-Stop on end of block, ce/wait multiplexed, READY active config + .db DMA_LOAD ; R6-Command Load + .db DMA_FORCE_READY ; R6-Command Force ready + .db DMA_ENABLE ; R6-Command Enable DMA + +DMAIn_Len .equ $-DMAInCode +; +;================================================================================================== +; SET TRANSFER MODE +;================================================================================================== +; +SETXFER: + ld a,(dmaxfer) ; setup the + cp 0 ; transfer mode + jr nz,DMAX1 + ld a,DMA_BYTE + jr DMAX3 +DMAX1: cp 1 + jr nz,DMAX2 + ld a,DMA_CONTINUOUS + jr DMAX3 +DMAX2: cp 2 + ret nz + ld a,DMA_BURST +DMAX3: ld (hl),a + ret +; +;================================================================================================== +; GET STATUS +;================================================================================================== +; +DMASTATUS: + ld a,(dmaxfer) ; if byte mode + cp 0 ; give some time to finish + jr nz,DMASTS1 + +; ld b,1 +;DMASTS2:call delay +; djnz DMASTS2 +; +DMASTS1:ld a,DMA_READ_STATUS_BYTE ; check status + out (c),a ; of transfer + in a,(c) + and %00111011 +; +; push af +; ld a,DMA_REINIT_STATUS_BYTE +; out (c),a +; pop af +; + call PRTSTRD + .db "\n\rReturn Status: $" + call PRTHEXBYTE + call NEWLINE +; + ld c,a + ld a,(dmavbs) + or a + jr z,DMSSTS2 + ld a,c +; + ld a,%00000001 + ld de,DMASTSBIT0 + call PRTIDXMSK +; + ld a,%00000010 + ld de,DMASTSBIT1 + call PRTIDXMSK +; + ld a,%00001000 + ld de,DMASTSBIT3 + call PRTIDXMSK +; + ld a,%00010000 + ld de,DMASTSBIT4 + call PRTIDXMSK +; + ld a,%00100000 + ld de,DMASTSBIT5 + call PRTIDXMSK +; +DMSSTS2:ld a,c + ret + +DMASTSBIT0: + .TEXT "DMA Bus request did not occur after LOAD command\n\r$" + .TEXT "DMA Bus request occurred after the LOAD command\n\r$" +DMASTSBIT1: + .TEXT "Ready line inactive\n\r$" + .TEXT "Ready line active\n\r$" +DMASTSBIT3: + .TEXT "Interrupt pending\n\r$" + .TEXT "No interrupt pending\n\r$" +DMASTSBIT4: + .TEXT "Match found\n\r$" + .TEXT "No match found\n\r$" +DMASTSBIT5: + .TEXT "End of block reached\n\r$" + .TEXT "End of block not reached\n\r$" +; +;================================================================================================== +; DEBUG - READ START, DESTINATION AND COUNT REGISTERS +;================================================================================================== +; +DMARegDump: + ld a,(dmaport) + ld c,a + ld a,DMA_READ_MASK_FOLLOWS + out (c),a + ld a,%01111110 + out (c),a + ld a,DMA_START_READ_SEQUENCE + out (c),a +; + in a,(c) + ld l,a + in a,(c) + ld h,a + call PRTHEXWORDHL + ld a,':' + call COUT +; + in a,(c) + ld l,a + in a,(c) + ld h,a + call PRTHEXWORDHL + ld a,':' + call COUT +; + in a,(c) + ld l,a + in a,(c) + ld h,a + call PRTHEXWORDHL +; + call NEWLINE + ret +; +;================================================================================================== +; CONSOLE I/O ROUTINES +;================================================================================================== +; +CIO_CONSOLE .EQU $80 ; HBIOS DEFAULT CONSOLE +BF_CIOOUT .EQU $01 ; HBIOS FUNC: OUTPUT CHAR +BF_CIOIN .EQU $00 ; HBIOS FUNC: INPUT CHAR +BF_CIOIST .EQU $02 ; HBIOS FUNC: INPUT CHAR STATUS +; +;__CINU_______________________________________________________________________ +; +; INPUT AN UPPERCASE CHARACTER +;_____________________________________________________________________________ +; +CINU: CALL CIN + ; Force upper case + CP 'a' ; < 'a' + RET C ; IF SO, JUST CONTINUE + CP 'z'+1 ; > 'z' + RET NC ; IS SO, JUST CONTINUE + SUB 'a'-'A' ; CONVERT TO UPPER + RET +; +;__HEXIN_______________________________________________________________________ +; +; INPUT A HEX BYTE, RETURN VALUE IN A +;_____________________________________________________________________________ +; +HEXIN: CALL CINU ; GET 1 CHAR INPUT + push af + CALL ISHEX ; CHECK FOR VALID CHARACTER + JR C,HEXIN + ADD A,A + ADD A,A + ADD A,A + ADD A,A + LD C,A ; Save top nibble + pop af ; Retreive letter + call COUT ; and display it +; +HEXIN1: CALL CINU ; GET 1 CHAR INPUT + push af + CALL ISHEX ; CHECK FOR VALID CHARACTER + JR C,HEXIN1 +; + or c + ld c,a + pop af ; Retreive letter + call COUT ; and display it +; + ld a,c + RET + +; CF SET MEANS CHARACTER 0-9,A-F + +ISHEX: CP '0' ; < '0'? + JR C,ISHEX1 ; YES, NOT 0-9, CHECK A-F + CP '9' + 1 ; > '9' + jr nc,ISHEX1 + sub '0' ; MUST BE 0-9, RETURN + ret +ISHEX1: CP 'A' ; < 'A'? + ret c ; YES, NOT A-F, FAIL + cp 'F' + 1 ; > 'F' + jr nc,ISHEX2 + sub 'A' - 10 + RET ; MUST BE A-F, RETURN +ISHEX2: SCF + RET +; +;__COUT_______________________________________________________________________ +; +; OUTPUT CHARACTER FROM A +;_____________________________________________________________________________ +; +COUT: + ; SAVE ALL INCOMING REGISTERS + PUSH AF + PUSH BC + PUSH DE + PUSH HL +; + ; OUTPUT CHARACTER TO CONSOLE VIA HBIOS + LD E,A ; OUTPUT CHAR TO E + LD C,CIO_CONSOLE ; CONSOLE UNIT TO C + LD B,BF_CIOOUT ; HBIOS FUNC: OUTPUT CHAR + CALL $FFF0 ; HBIOS OUTPUTS CHARACTER +; + ; RESTORE ALL REGISTERS + POP HL + POP DE + POP BC + POP AF + RET +; +;__CIN________________________________________________________________________ +; +; INPUT CHARACTER TO A +;_____________________________________________________________________________ +; +CIN: + ; SAVE INCOMING REGISTERS (AF IS OUTPUT) + PUSH BC + PUSH DE + PUSH HL +; + ; INPUT CHARACTER FROM CONSOLE VIA HBIOS + LD C,CIO_CONSOLE ; CONSOLE UNIT TO C + LD B,BF_CIOIN ; HBIOS FUNC: INPUT CHAR + CALL $FFF0 ; HBIOS READS CHARACTER + LD A,E ; MOVE CHARACTER TO A FOR RETURN +; + ; RESTORE REGISTERS (AF IS OUTPUT) + POP HL + POP DE + POP BC + RET +; +;__CST________________________________________________________________________ +; +; RETURN INPUT STATUS IN A (0 = NO CHAR, !=0 CHAR WAITING) +;_____________________________________________________________________________ +; +CST: + ; SAVE INCOMING REGISTERS (AF IS OUTPUT) + PUSH BC + PUSH DE + PUSH HL +; + ; GET CONSOLE INPUT STATUS VIA HBIOS + LD C,CIO_CONSOLE ; CONSOLE UNIT TO C + LD B,BF_CIOIST ; HBIOS FUNC: INPUT STATUS + CALL $FFF0 ; HBIOS RETURNS STATUS IN A +; + ; RESTORE REGISTERS (AF IS OUTPUT) + POP HL + POP DE + POP BC + RET +; +USEINT .DB FALSE ; USE INTERRUPTS FLAG +counter .dw 0 +dmaport .db DMABASE +dmautil .db DMABASE+1 +dmaxfer .db DMA_XMODE +dmavbs .db 0 +SAVSTK: .DW 2 + .FILL 64 +STACK: .EQU $ +; +orgvec .dw 0 ; saved interrupt vector +; +;=============================================================================== +; Interrupt Handler +;=============================================================================== +; +reladr .equ $ ; relocation start adr +; + .org $A000 ; code will run here +; +int: + ; According to the DMA doc, you must issue + ; a DMA_DISABLE command prior to a + ; DMA_REINIT_STATUS_BYTE command to avoid a + ; potential race condition. + ld a,(dmaport) + ld c,a + ld a,DMA_DISABLE + out (c),a +; + ; The doc confuses me, but apparently it is + ; necessary to reinitialize the status byte + ; when an end-of-block interrupt occurs. Otherwise, + ; the end-of-block condition remains set and + ; causes the interrupt to fire continuously. + ld a,DMA_REINIT_STATUS_BYTE + out (c),a +; + ld hl,(counter) + inc hl + ld (counter),hl +; + or $ff ; signal int handled + ret +; +hsiz .equ $ - $A000 ; size of handler to relocate +; + .org reladr + hsiz +; +PROEND: .EQU $ +; + .END diff --git a/Source/Apps/Test/DMAmon/util.asm b/Source/Apps/Test/DMAmon/util.asm new file mode 100644 index 00000000..dfa3ad95 --- /dev/null +++ b/Source/Apps/Test/DMAmon/util.asm @@ -0,0 +1,969 @@ +; +;================================================================================================== +; UTILITY FUNCTIONS +;================================================================================================== +; +; +CHR_BEL .EQU 07H +CHR_CR .EQU 0DH +CHR_LF .EQU 0AH +CHR_BS .EQU 08H +CHR_ESC .EQU 1BH +; +;__________________________________________________________________________________________________ +; +; UTILITY PROCS TO PRINT SINGLE CHARACTERS WITHOUT TRASHING ANY REGISTERS +; +PC_SPACE: + PUSH AF + LD A,' ' + JR PC_PRTCHR + +PC_PERIOD: + PUSH AF + LD A,'.' + JR PC_PRTCHR + +PC_COLON: + PUSH AF + LD A,':' + JR PC_PRTCHR + +PC_COMMA: + PUSH AF + LD A,',' + JR PC_PRTCHR + +PC_LBKT: + PUSH AF + LD A,'[' + JR PC_PRTCHR + +PC_RBKT: + PUSH AF + LD A,']' + JR PC_PRTCHR + +PC_LT: + PUSH AF + LD A,'<' + JR PC_PRTCHR + +PC_GT: + PUSH AF + LD A,'>' + JR PC_PRTCHR + +PC_LPAREN: + PUSH AF + LD A,'(' + JR PC_PRTCHR + +PC_RPAREN: + PUSH AF + LD A,')' + JR PC_PRTCHR + +PC_ASTERISK: + PUSH AF + LD A,'*' + JR PC_PRTCHR + +PC_CR: + PUSH AF + LD A,CHR_CR + JR PC_PRTCHR + +PC_LF: + PUSH AF + LD A,CHR_LF + JR PC_PRTCHR + +PC_PRTCHR: + CALL COUT + POP AF + RET + +NEWLINE2: + CALL NEWLINE +NEWLINE: + CALL PC_CR + CALL PC_LF + RET +; +; PRINT A CHARACTER REFERENCED BY POINTER AT TOP OF STACK +; USAGE: +; CALL PRTCH +; .DB 'X' +; +PRTCH: + EX (SP),HL + PUSH AF + LD A,(HL) + CALL COUT + POP AF + INC HL + EX (SP),HL + RET +; +; PRINT A STRING AT ADDRESS SPECIFIED IN HL +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; LD HL,MYSTR +; CALL PRTSTR +; ... +; MYSTR: .DB "HELLO$" +; +PRTSTR: + LD A,(HL) + INC HL + CP '$' + RET Z + CALL COUT + JR PRTSTR +; +; PRINT A STRING DIRECT: REFERENCED BY POINTER AT TOP OF STACK +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; CALL PRTSTRD +; .DB "HELLO$" +; ... +; +PRTSTRD: + EX (SP),HL + PUSH AF + CALL PRTSTR + POP AF + EX (SP),HL + RET +; +; PRINT A STRING INDIRECT: REFERENCED BY INDIRECT POINTER AT TOP OF STACK +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; CALL PRTSTRI(MYSTRING) +; MYSTRING .DB "HELLO$" +; +PRTSTRI: + EX (SP),HL + PUSH AF + LD A,(HL) + INC HL + PUSH HL + LD H,(HL) + LD L,A + CALL PRTSTR + POP HL + INC HL + POP AF + EX (SP),HL + RET +; +; PRINT THE HEX BYTE VALUE IN A +; +PRTHEXBYTE: + PUSH AF + PUSH DE + CALL HEXASCII + LD A,D + CALL COUT + LD A,E + CALL COUT + POP DE + POP AF + RET +; +; PRINT THE HEX WORD VALUE IN BC +; +PRTHEXWORD: + PUSH AF + LD A,B + CALL PRTHEXBYTE + LD A,C + CALL PRTHEXBYTE + POP AF + RET +; +; PRINT THE HEX WORD VALUE IN HL +; +PRTHEXWORDHL: + PUSH AF + LD A,H + CALL PRTHEXBYTE + LD A,L + CALL PRTHEXBYTE + POP AF + RET +; +; PRINT THE HEX DWORD VALUE IN DE:HL +; +PRTHEX32: + PUSH BC + PUSH DE + POP BC + CALL PRTHEXWORD + PUSH HL + POP BC + CALL PRTHEXWORD + POP BC + RET +; +; CONVERT BINARY VALUE IN A TO ASCII HEX CHARACTERS IN DE +; +HEXASCII: + LD D,A + CALL HEXCONV + LD E,A + LD A,D + RLCA + RLCA + RLCA + RLCA + CALL HEXCONV + LD D,A + RET +; +; CONVERT LOW NIBBLE OF A TO ASCII HEX +; +HEXCONV: + AND 0FH ;LOW NIBBLE ONLY + ADD A,90H + DAA + ADC A,40H + DAA + RET +; +; PRINT A BYTE BUFFER IN HEX POINTED TO BY DE +; REGISTER A HAS SIZE OF BUFFER +; +PRTHEXBUF: + OR A + RET Z ; EMPTY BUFFER +; + LD B,A +PRTHEXBUF1: + CALL PC_SPACE + LD A,(DE) + CALL PRTHEXBYTE + INC DE + DJNZ PRTHEXBUF1 + RET +; +; PRINT A BLOCK OF MEMORY NICELY FORMATTED +; DE=BUFFER ADDRESS +; +DUMP_BUFFER: + CALL NEWLINE + + PUSH DE + POP HL + INC D + INC D + +DB_BLKRD: + PUSH BC + PUSH HL + POP BC + CALL PRTHEXWORD ; PRINT START LOCATION + POP BC + CALL PC_SPACE ; + LD C,16 ; SET FOR 16 LOCS + PUSH HL ; SAVE STARTING HL +DB_NXTONE: + LD A,(HL) ; GET BYTE + CALL PRTHEXBYTE ; PRINT IT + CALL PC_SPACE ; +DB_UPDH: + INC HL ; POINT NEXT + DEC C ; DEC. LOC COUNT + JR NZ,DB_NXTONE ; IF LINE NOT DONE + ; NOW PRINT 'DECODED' DATA TO RIGHT OF DUMP +DB_PCRLF: + CALL PC_SPACE ; SPACE IT + LD C,16 ; SET FOR 16 CHARS + POP HL ; GET BACK START +DB_PCRLF0: + LD A,(HL) ; GET BYTE + AND 060H ; SEE IF A 'DOT' + LD A,(HL) ; O.K. TO GET + JR NZ,DB_PDOT ; +DB_DOT: + LD A,2EH ; LOAD A DOT +DB_PDOT: + CALL COUT ; PRINT IT + INC HL ; + LD A,D ; + CP H ; + JR NZ,DB_UPDH1 ; + LD A,E ; + CP L ; + JP Z,DB_END ; +DB_UPDH1: +; IF BLOCK NOT DUMPED, DO NEXT CHARACTER OR LINE + DEC C ; DEC. CHAR COUNT + JR NZ,DB_PCRLF0 ; DO NEXT +DB_CONTD: + CALL NEWLINE ; + JP DB_BLKRD ; + +DB_END: + RET +; +; PRINT THE nTH STRING IN A LIST OF STRINGS WHERE EACH IS TERMINATED BY $ +; C REGISTER CONTAINS THE INDEX TO THE STRING TO BE DISPLAYED. +; A REGISTER CONTAINS A MASK TO BE APPLIED TO THE INDEX +; THE INDEX IS NORMALIZED TO A RANGE 0..N USING THE MASK AND THEN THE nTH +; STRING IS PRINTED IN A LIST DEFINED BY DE +; +; C = ATTRIBUTE +; A = MASK +; DE = STRING LIST +; +PRTIDXMSK: + PUSH BC +PRTIDXMSK0: + BIT 0,A + JR NZ,PRTIDXMSK1 + SRL A + SRL C + JR PRTIDXMSK0 +PRTIDXMSK1: + LD B,A + LD A,C + AND B + POP BC +; +; PRINT THE nTH STRING IN A LIST OF STRINGS WHERE EACH IS TERMINATED BY $ +; A REGISTER DEFINES THE nTH STRING IN THE LIST TO PRINT AND DE POINTS +; TO THE START OF THE STRING LIST. +; +; SLOW BUT IMPROVES CODE SIZE, READABILITY AND ELIMINATES THE NEED HAVE +; LIST OF POINTERS OR A LIST OF CONDITIONAL CHECKS. +; +PRTIDXDEA: + PUSH BC + LD C,A ; INDEX COUNT + OR A + LD A,0 + LD (PRTIDXCNT),A ; RESET CHARACTER COUNT +PRTIDXDEA1: + JR Z,PRTIDXDEA3 +PRTIDXDEA2: + LD A,(DE) ; LOOP UNIT + INC DE ; WE REACH + CP '$' ; END OF STRING + JR NZ,PRTIDXDEA2 + DEC C ; AT STRING END. SO GO + JR PRTIDXDEA1 ; CHECK FOR INDEX MATCH +PRTIDXDEA3: + POP BC +; CALL WRITESTR ; FALL THROUGH TO WRITESTR +; RET +; +; OUTPUT A '$' TERMINATED STRING AT DE +; +WRITESTR: + PUSH AF +WRITESTR1: + LD A,(DE) + CP '$' ; TEST FOR STRING TERMINATOR + JP Z,WRITESTR2 + CALL COUT + LD A,(PRTIDXCNT) + INC A + LD (PRTIDXCNT),A + INC DE + JP WRITESTR1 +WRITESTR2: + POP AF + RET +; +PRTIDXCNT: + .DB 0 ; CHARACTER COUNT +; +; +; +TSTPT: + PUSH DE + LD DE,STR_TSTPT + CALL WRITESTR + POP DE + JR REGDMP ; DUMP REGISTERS AND RETURN +; +; +; +REGDMP: + CALL XREGDMP + RET +; +XREGDMP: + EX (SP),HL ; RET ADR TO HL, SAVE HL ON TOS + LD (REGDMP_RET),HL ; SAVE RETURN ADDRESS + POP HL ; RESTORE HL AND BURN STACK ENTRY + + EX (SP),HL ; PC TO HL, SAVE HL ON TOS + LD (REGDMP_PC),HL ; SAVE PC VALUE + EX (SP),HL ; BACK THE WAY IT WAS + + LD (REGDMP_SP),SP ; SAVE STACK POINTER + + ;LD (RD_STKSAV),SP ; SAVE ORIGINAL STACK POINTER + ;LD SP,RD_STACK ; SWITCH TO PRIVATE STACK + + PUSH AF + PUSH BC + PUSH DE + PUSH HL + + PUSH AF + LD A,'@' + CALL COUT + POP AF + + PUSH BC + LD BC,(REGDMP_PC) + CALL PRTHEXWORD ; PC + POP BC + CALL PC_LBKT + PUSH BC + PUSH AF + POP BC + CALL PRTHEXWORD ; AF + POP BC + CALL PC_COLON + CALL PRTHEXWORD ; BC + CALL PC_COLON + PUSH DE + POP BC + CALL PRTHEXWORD ; DE + CALL PC_COLON + PUSH HL + POP BC + CALL PRTHEXWORD ; HL + CALL PC_COLON + LD BC,(REGDMP_SP) + CALL PRTHEXWORD ; SP + + CALL PC_COLON + PUSH IX + POP BC + CALL PRTHEXWORD ; IX + + CALL PC_COLON + PUSH IY + POP BC + CALL PRTHEXWORD ; IY + + CALL PC_RBKT + CALL PC_SPACE + + POP HL + POP DE + POP BC + POP AF + + ;LD SP,(RD_STKSAV) ; BACK TO ORIGINAL STACK FRAME + + JP $FFFF ; RETURN, $FFFF IS DYNAMICALLY UPDATED +REGDMP_RET .EQU $-2 ; RETURN ADDRESS GOES HERE +; +REGDMP_PC .DW 0 +REGDMP_SP .DW 0 +; +;RD_STKSAV .DW 0 +; .FILL $FF,16*2 ; 16 LEVEL PRIVATE STACK +;RD_STACK .EQU $ +; +; +; +; +; +STR_HALT .TEXT "\r\n\r\n*** System Halted ***$" +STR_TSTPT .TEXT "\r\n+++ TSTPT: $" +;STR_AF .DB " AF=$" +;STR_BC .DB " BC=$" +;STR_DE .DB " DE=$" +;STR_HL .DB " HL=$" +;STR_PC .DB " PC=$" +;STR_SP .DB " SP=$" +; +; INDIRECT JUMP TO ADDRESS IN HL +; +; MOSTLY USEFUL TO PERFORM AN INDIRECT CALL LIKE: +; LD HL,xxxx +; CALL JPHL +; +JPHL: JP (HL) +; +; ADD HL,A +; +; A REGISTER IS DESTROYED! +; +ADDHLA: + ADD A,L + LD L,A + RET NC + INC H + RET +; +;**************************** +; A(BCD) => A(BIN) +; [00H..99H] -> [0..99] +;**************************** +; +BCD2BYTE: + PUSH BC + LD C,A + AND 0F0H + SRL A + LD B,A + SRL A + SRL A + ADD A,B + LD B,A + LD A,C + AND 0FH + ADD A,B + POP BC + RET +; +;***************************** +; A(BIN) => A(BCD) +; [0..99] => [00H..99H] +;***************************** +; +BYTE2BCD: + PUSH BC + LD B,10 + LD C,-1 +BYTE2BCD1: + INC C + SUB B + JR NC,BYTE2BCD1 + ADD A,B + LD B,A + LD A,C + ADD A,A + ADD A,A + ADD A,A + ADD A,A + OR B + POP BC + RET + +#IFDEF USEDELAY + +; +; DELAY 16US (CPU SPEED COMPENSATED) INCUDING CALL/RET INVOCATION +; REGISTER A AND FLAGS DESTROYED +; NO COMPENSATION FOR Z180 MEMORY WAIT STATES +; THERE IS AN OVERHEAD OF 3TS PER INVOCATION +; IMPACT OF OVERHEAD DIMINISHES AS CPU SPEED INCREASES +; +; CPU SCALER (CPUSCL) = (CPUHMZ - 2) FOR 16US + 3TS DELAY +; NOTE: CPUSCL MUST BE >= 1! +; +; EXAMPLE: 8MHZ CPU (DELAY GOAL IS 16US) +; LOOP = ((6 * 16) - 5) = 91TS +; TOTAL COST = (91 + 40) = 131TS +; ACTUAL DELAY = (131 / 8) = 16.375US +; + ; --- TOTAL COST = (LOOP COST + 40) TS -----------------+ +DELAY: ; 17TS (FROM INVOKING CALL) | + LD A,(CPUSCL) ; 13TS | +; | +DELAY1: ; | + ; --- LOOP = ((CPUSCL * 16) - 5) TS ------------+ | + DEC A ; 4TS | | + #IF (BIOS == BIOS_WBW) ; | | + #IF (CPUFAM == CPU_Z180) ; | | + OR A ; +4TS FOR Z180 | | + #ENDIF ; | | + #ENDIF ; | | + JR NZ,DELAY1 ; 12TS (NZ) / 7TS (Z) | | + ; ----------------------------------------------+ | +; | + RET ; 10TS (RETURN) | + ;-------------------------------------------------------+ +; +; DELAY 16US * DE (CPU SPEED COMPENSATED) +; REGISTER DE, A, AND FLAGS DESTROYED +; NO COMPENSATION FOR Z180 MEMORY WAIT STATES +; THERE IS A 27TS OVERHEAD FOR CALL/RET PER INVOCATION +; IMPACT OF OVERHEAD DIMINISHES AS DE AND/OR CPU SPEED INCREASES +; +; CPU SCALER (CPUSCL) = (CPUHMZ - 2) FOR 16US OUTER LOOP COST +; NOTE: CPUSCL MUST BE > 0! +; +; EXAMPLE: 8MHZ CPU, DE=6250 (DELAY GOAL IS .1 SEC OR 100,000US) +; INNER LOOP = ((16 * 6) - 5) = 91TS +; OUTER LOOP = ((91 + 37) * 6250) = 800,000TS +; ACTUAL DELAY = ((800,000 + 27) / 8) = 100,003US +; + ; --- TOTAL COST = (OUTER LOOP + 27) TS ------------------------+ +VDELAY: ; 17TS (FROM INVOKING CALL) | +; | + ; --- OUTER LOOP = ((INNER LOOP + 37) * DE) TS ---------+ | + LD A,(CPUSCL) ; 13TS | | +; | | +VDELAY1: ; | | + ; --- INNER LOOP = ((CPUSCL * 16) - 5) TS ------+ | | + #IF (BIOS == BIOS_WBW) ; | | | + #IF (CPUFAM == CPU_Z180) ; | | | + OR A ; +4TS FOR Z180 | | | + #ENDIF ; | | | + #ENDIF ; | | | + DEC A ; 4TS | | | + JR NZ,VDELAY1 ; 12TS (NZ) / 7TS (Z) | | | + ; ----------------------------------------------+ | | +; | | + DEC DE ; 6TS | | + #IF (BIOS == BIOS_WBW) ; | | | + #IF (CPUFAM == CPU_Z180) ; | | + OR A ; +4TS FOR Z180 | | + #ENDIF ; | | + #ENDIF ; | | + LD A,D ; 4TS | | + OR E ; 4TS | | + JP NZ,VDELAY ; 10TS | | + ;-------------------------------------------------------+ | +; | + RET ; 10TS (FINAL RETURN) | + ;---------------------------------------------------------------+ +; +; DELAY ABOUT 0.5 SECONDS +; 500000US / 16US = 31250 +; +LDELAY: + PUSH AF + PUSH DE + LD DE,31250 + CALL VDELAY + POP DE + POP AF + RET +; +; INITIALIZE DELAY SCALER BASED ON OPERATING CPU SPEED +; ENTER WITH A = CPU SPEED IN MHZ +; +DELAY_INIT: + CP 3 ; TEST FOR <= 2 (SPECIAL HANDLING) + JR C,DELAY_INIT1 ; IF <= 2, SPECIAL PROCESSING + SUB 2 ; ADJUST AS REQUIRED BY DELAY FUNCTIONS + JR DELAY_INIT2 ; AND CONTINUE +DELAY_INIT1: + LD A,1 ; USE THE MIN VALUE OF 1 +DELAY_INIT2: + LD (CPUSCL),A ; UPDATE CPU SCALER VALUE + RET + + #IF (CPUMHZ < 3) +CPUSCL .DB 1 ; CPU SCALER MUST BE > 0 + #ELSE +CPUSCL .DB CPUMHZ - 2 ; OTHERWISE 2 LESS THAN PHI MHZ + #ENDIF +; +#ENDIF +; +; SHORT DELAY FUNCTIONS. NO CLOCK SPEED COMPENSATION, SO THEY +; WILL RUN LONGER ON SLOWER SYSTEMS. THE NUMBER INDICATES THE +; NUMBER OF CALL/RET INVOCATIONS. A SINGLE CALL/RET IS +; 27 T-STATES ON A Z80, 25 T-STATES ON A Z180 +; +; ; Z80 Z180 +; ; ---- ---- +DLY64: CALL DLY32 ; 1728 1600 +DLY32: CALL DLY16 ; 864 800 +DLY16: CALL DLY8 ; 432 400 +DLY8: CALL DLY4 ; 216 200 +DLY4: CALL DLY2 ; 108 100 +DLY2: CALL DLY1 ; 54 50 +DLY1: RET ; 27 25 +; +; MULTIPLY 8-BIT VALUES +; IN: MULTIPLY H BY E +; OUT: HL = RESULT, E = 0, B = 0 +; +MULT8: + LD D,0 + LD L,D + LD B,8 +MULT8_LOOP: + ADD HL,HL + JR NC,MULT8_NOADD + ADD HL,DE +MULT8_NOADD: + DJNZ MULT8_LOOP + RET +; +; MULTIPLY A 16 BIT BY 8 BIT INTO 16 BIT +; IN: MULTIPLY DE BY A +; OUT: HL = RESULT, B=0, A, C, DE UNCHANGED +; +MULT8X16: + LD B,8 + LD HL,0 +MULT8X16_1: + ADD HL,HL + RLCA + JR NC,MULT8X16_2 + ADD HL,DE +MULT8X16_2: + DJNZ MULT8X16_1 + RET +;; +;; COMPUTE HL / DE +;; RESULT IN BC, REMAINDER IN HL, AND SET ZF DEPENDING ON REMAINDER +;; A, DE DESTROYED +;; +;DIV: +; XOR A +; LD BC,0 +;DIV1: +; SBC HL,DE +; JR C,DIV2 +; INC BC +; JR DIV1 +;DIV2: +; XOR A +; ADC HL,DE ; USE ADC SO ZF IS SET +; RET +;=============================================================== +; +; COMPUTE HL / DE = BC W/ REMAINDER IN HL & ZF +; +DIV16: + LD A,H ; HL -> AC + LD C,L ; ... + LD HL,0 ; INIT HL + LD B,16 ; INIT LOOP COUNT +DIV16A: + SCF + RL C + RLA + ADC HL,HL + SBC HL,DE + JR NC,DIV16B + ADD HL,DE + DEC C +DIV16B: + DJNZ DIV16A ; LOOP AS NEEDED + LD B,A ; AC -> BC + LD A,H ; SET ZF + OR L ; ... BASED ON REMAINDER + RET ; DONE +; +; INTEGER DIVIDE DE:HL BY C +; RESULT IN DE:HL, REMAINDER IN A +; CLOBBERS F, B +; +DIV32X8: + XOR A + LD B,32 +DIV32X8A: + ADD HL,HL + RL E + RL D + RLA + CP C + JR C,DIV32X8B + SUB C + INC L +DIV32X8B: + DJNZ DIV32X8A + RET +; +; FILL MEMORY AT HL WITH VALUE A, LENGTH IN BC, ALL REGS USED +; LENGTH *MUST* BE GREATER THAN 1 FOR PROPER OPERATION!!! +; +FILL: + LD D,H ; SET DE TO HL + LD E,L ; SO DESTINATION EQUALS SOURCE + LD (HL),A ; FILL THE FIRST BYTE WITH DESIRED VALUE + INC DE ; INCREMENT DESTINATION + DEC BC ; DECREMENT THE COUNT + LDIR ; DO THE REST + RET ; RETURN +; +; SET A BIT IN BYTE ARRAY AT HL, INDEX IN A +; +BITSET: + CALL BITLOC ; LOCATE THE BIT + OR (HL) ; SET THE SPECIFIED BIT + LD (HL),A ; SAVE IT + RET ; RETURN +; +; CLEAR A BIT IN BYTE ARRAY AT HL, INDEX IN A +; +BITCLR: + CALL BITLOC ; LOCATE THE BIT + CPL ; INVERT ALL BITS + AND (HL) ; CLEAR SPECIFIED BIT + LD (HL),A ; SAVE IT + RET ; RETURN +; +; GET VALUE OF A BIT IN BYTE ARRAY AT HL, INDEX IN A +; +BITTST: + CALL BITLOC ; LOCATE THE BIT + AND (HL) ; SET Z FLAG BASED ON BIT + RET ; RETURN +; +; LOCATE A BIT IN BYTE ARRAY AT HL, INDEX IN A +; RETURN WITH HL POINTING TO BYTE AND A WITH MASK FOR SPECIFIC BIT +; +BITLOC: + PUSH AF ; SAVE BIT INDEX + SRL A ; DIVIDE BY 8 TO GET BYTE INDEX + SRL A ; " + SRL A ; " + LD C,A ; MOVE TO BC + LD B,0 ; " + ADD HL,BC ; HL NOW POINTS TO BYTE CONTAINING BIT + POP AF ; RECOVER A (INDEX) + AND $07 ; ISOLATE REMAINDER, Z SET IF ZERO + LD B,A ; SETUP SHIFT COUNTER + LD A,1 ; SETUP A WITH MASK + RET Z ; DONE IF ZERO +BITLOC1: + SLA A ; SHIFT + DJNZ BITLOC1 ; LOOP AS NEEDED + RET ; DONE +; +; PRINT VALUE OF A IN DECIMAL WITH LEADING ZERO SUPPRESSION +; +PRTDECB: + PUSH HL + PUSH AF + LD L,A + LD H,0 + CALL PRTDEC + POP AF + POP HL + RET +; +; PRINT VALUE OF HL IN DECIMAL WITH LEADING ZERO SUPPRESSION +; +PRTDEC: + PUSH BC + PUSH DE + PUSH HL + LD E,'0' + LD BC,-10000 + CALL PRTDEC1 + LD BC,-1000 + CALL PRTDEC1 + LD BC,-100 + CALL PRTDEC1 + LD C,-10 + CALL PRTDEC1 + LD E,0 + LD C,-1 + CALL PRTDEC1 + POP HL + POP DE + POP BC + RET +PRTDEC1: + LD A,'0' - 1 +PRTDEC2: + INC A + ADD HL,BC + JR C,PRTDEC2 + SBC HL,BC + CP E + JR Z,PRTDEC3 + LD E,0 + CALL COUT +PRTDEC3: + RET +; +; SHIFT HL:DE BY B BITS +; +SRL32: + ; ROTATE RIGHT 32 BITS, HIGH ORDER BITS BECOME ZERO + SRL D + RR E + RR H + RR L + DJNZ SRL32 + RET +; +SLA32: + ; ROTATE LEFT 32 BITS, LOW ORDER BITS BECOME ZERO + SLA L + RL H + RL E + RL D + DJNZ SLA32 + RET +; +; LOAD OR STORE DE:HL +; +LD32: + ; LD DE:HL,(HL) + PUSH AF + LD E,(HL) + INC HL + LD D,(HL) + INC HL + LD A,(HL) + INC HL + LD H,(HL) + LD L,A + POP AF + EX DE,HL + RET +; +ST32: + ; LD (BC),DE:HL + PUSH AF + LD A,L + LD (BC),A + INC BC + LD A,H + LD (BC),A + INC BC + LD A,E + LD (BC),A + INC BC + LD A,D + LD (BC),A + POP AF + RET +; +; INC/ADD/DEC/SUB 32 BIT VALUE IN DE:HL +; FOR ADD/SUB, OPERAND IS IN BC +; +INC32: + LD BC,1 +ADD32: + ADD HL,BC + RET NC + INC DE + RET +; +DEC32: + LD BC,1 +SUB32: + OR A + SBC HL,BC + RET NC + DEC DE + RET +; +; INC32 (HL) +; INCREMENT 32 BIT BINARY AT ADDRESS +; +INC32HL: + INC (HL) + RET NZ + INC HL + INC (HL) + RET NZ + INC HL + INC (HL) + RET NZ + INC HL + INC (HL) + RET + diff --git a/Source/Apps/Test/I2C/Build.cmd b/Source/Apps/Test/I2C/Build.cmd new file mode 100644 index 00000000..1a1a8206 --- /dev/null +++ b/Source/Apps/Test/I2C/Build.cmd @@ -0,0 +1,13 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF i2cscan.asm i2cscan.com i2cscan.lst || exit /b +tasm -t180 -g3 -fFF rtcds7.asm rtcds7.com rtcds7.lst || exit /b +tasm -t180 -g3 -fFF i2clcd.asm i2clcd.com i2clcd.lst || exit /b + +copy /Y i2c*.com ..\..\..\..\Binary\Apps\Test\ || exit /b +copy /Y rtcds7*.com ..\..\..\..\Binary\Apps\Test\ || exit /b diff --git a/Source/Apps/Test/I2C/Clean.cmd b/Source/Apps/Test/I2C/Clean.cmd new file mode 100644 index 00000000..07f1d4c3 --- /dev/null +++ b/Source/Apps/Test/I2C/Clean.cmd @@ -0,0 +1,5 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst diff --git a/Source/Apps/Test/I2C/Makefile b/Source/Apps/Test/I2C/Makefile new file mode 100644 index 00000000..c7abbb52 --- /dev/null +++ b/Source/Apps/Test/I2C/Makefile @@ -0,0 +1,8 @@ +OBJECTS = i2cscan.com rtcds7.com i2clcd.com +DEST = ../../../../Binary/Apps/Test/ +TOOLS = ../../../../Tools + +USETASM=1 +TASMFLAGS=-dWBW + +include $(TOOLS)/Makefile.inc diff --git a/Source/Apps/Test/I2C/i2ccpm.inc b/Source/Apps/Test/I2C/i2ccpm.inc new file mode 100644 index 00000000..ee469e5d --- /dev/null +++ b/Source/Apps/Test/I2C/i2ccpm.inc @@ -0,0 +1,132 @@ +;================================================================================================== +; GENERIC CP/M ROUTINES +;================================================================================================== +; +BDOS .EQU 5 ;ENTRY BDOS +BS .EQU 8 ;BACKSPACE +TAB .EQU 9 ;TABULATOR +LF .EQU 0AH ;LINE-FEED +CR .EQU 0DH ;CARRIAGE-RETURN +; +CLIARGS .EQU $81 +RESTART .EQU $0000 ; CP/M restart vector +FCB .EQU $5C ; Location of default FCB +; +; OUTPUT TEXT AT HL +; +PRTSTR: LD A,(HL) + CP '$' + RET Z + CALL COUT + INC HL + JR PRTSTR +; +;Output WORD +;*********** +; +;PARAMETER: Entry WORD IN HL +;********* +; +OUTW: LD A,H + CALL OUTB + LD A,L + CALL OUTB + RET +; +;Output BYTE +;*********** +; +;PARAMETER: Entry BYTE IN A +;********* +; +OUTB: PUSH AF + RRCA + RRCA + RRCA + RRCA + AND 0FH + CALL HBTHE ;Change Half-BYTE + POP AF + AND 0FH + CALL HBTHE + RET +; +;Output HALF-BYTE +;**************** +; +;PARAMETER: Entry Half-BYTE IN A (BIT 0 - 3) +;********* +; +HBTHE: CP 0AH + JR C,HBTHE1 + ADD A,7 ;Character to Letter +HBTHE1: ADD A,30H + LD E,A + CALL PCHAR + RET +; +; +;Output on Screen +;**************** +; +PRBS: LD E,BS + CALL PCHAR + RET +; +;Output CR+LF on Screen +;********************** +; +NEWLINE: + LD E,CR + CALL PCHAR + LD E,LF + CALL PCHAR + RET +; +;Output ASCII-Character +;********************** +; +COUT: PUSH AF + LD E,A + CALL PCHAR + POP AF + RET +; +;CALL BDOS with Register Save +;**************************** +; +INCHA: LD C,1 ;INPUT CHARACTER TO A + JR BDO +PCHAR: LD C,2 ;PRINT CHARACTER IN E + JR BDO +PSTRIN: LD C,9 ;PRINT STRING + JR BDO +INBUFF: LD C,10 ;READ CONSOLE-BUFFER + JR BDO +CSTS: LD C,11 ;CONSOLE-STATUS + JR BDO +OPEN: LD C,15 ;OPEN FILE + JR BDO +CLOSE: LD C,16 ;CLOSE FILE + JR BDO +DELETE: LD C,19 ;DELETE FILE + JR BDO +READS: LD C,20 ;READ SEEK + JR BDO +WRITES: LD C,21 ;WRITE SEEK + JR BDO +MAKE: LD C,22 ;MAKE FILE + JR BDO +SETDMA: LD C,26 ;SET DMA-ADDRESS +BDO: PUSH HL + PUSH DE + PUSH BC + PUSH IX + PUSH IY + CALL BDOS + POP IY + POP IX + POP BC + POP DE + POP HL + RET diff --git a/Source/Apps/Test/I2C/i2clcd.asm b/Source/Apps/Test/I2C/i2clcd.asm new file mode 100644 index 00000000..548895b2 --- /dev/null +++ b/Source/Apps/Test/I2C/i2clcd.asm @@ -0,0 +1,517 @@ +;================================================================================================== +; PCF8584 HD44780 I2C LCD UTILITY +; +; SOME GENERAL INFORMATION ON LCDS CAN BE SEEN HERE : FOCUSLCDS.COM/PRODUCT-CATEGORY/CHARACTER-LCD/ +; +;================================================================================================== +; + .ECHO "i2clcd\n" +; +#INCLUDE "pcfi2c.inc" +; +; LCD COMMANDS +; +LCDFSET .EQU 00100000B ; 20H +LCD4BIT .EQU 00000000B ; 00H +LCD2LIN .EQU 00001000B ; 08H +LCDDON .EQU 00000100B ; 04H +LCDDMOV .EQU 00001000B ; 07H +LCDSGRA .EQU 01000000B ; 04H +LCDSDRA .EQU 10000000B ; 80H +LCDEMS .EQU 00000100B ; 04H +LCDELFT .EQU 00000010B ; 03H +; +LCDPINE .EQU 00000100B ; PIN 2 +LCDPIND .EQU 00000001B ; PIN O +; +; +; STANDARD FORMATS - 8X1, 8X2, 16X1, 16X2, 16X4, 20X1, 20X2, 20X4, 24X2, 40X1, 40X2, 40X4 +; +TIMEOUT .EQU 255 + + .ORG 100H + +;INIT: CALL PCF_INIT +; + LD A,0 + LD (DEBUGF),A +; + CALL LCDINIT ; SETUP THE LCD THROUGH THE PCF8574 + + LD HL,LCDDATA ; DISPLAY TEXT AT HL + PUSH HL + CALL LCDSTR + POP HL + + CALL STOP ; CLOSE I2C CONNECTION +; + RET + +;----------------------------------------------------------------------------- +; +LCDLITE .DB 00001000B +; +LCDINIT: +; CALL DEBUG +; + LD A,I2CLCDW ; SET SLAVE ADDRESS + OUT (REGS0),A +; + LD A,0C5H ; GENERATE START CONDITION + OUT (REGS1),A ; AND ISSUE THE SLAVE ADDRESS + CALL CHKPIN +; +; CALL DEBUG +; + LD HL,LCDINIT1 + LD B,2 + CALL WLN +; + CALL DELAY +; + LD HL,LCDINIT2 + LD B,2 + CALL WLN +; + CALL DELAY +; +; NOW WE ARE IN 4 BIT MODE +; + LD A,+(LCDFSET | LCD4BIT | LCD2LIN) + CALL LCDCMD + LD A,+(LCDDON | LCDDMOV) + CALL LCDCMD + LD A,+(LCDEMS | LCDELFT) + CALL LCDCMD + LD A,LCDSDRA + CALL LCDCMD +; + RET +; +;----------------------------------------------------------------------------- +; +WLN: LD A,(HL) + OUT (REGS0),A ; PUT DATA ON BUS + CALL CHKPIN + INC HL + DJNZ WLN + RET +; +;----------------------------------------------------------------------------- +; DISPLAY STRING AT HL, TERMINATED BY 0 +; +LCDSTR: POP BC ; GET THE POINTER OF + POP HL ; THE TEXT TO DISPLAY + PUSH HL ; OFF THE STACK AND + PUSH BC ; PUT IT IN HL. +; +LCDST0: LD A,(HL) ; GET NEXT CHARACTER TO + OR A ; DISPLAY BUT RETURN + RET Z ; WHEN TERMINATOR REACHED + PUSH HL +; + CALL LCDATA ; OUTPUT TO LCD + POP HL +; RET C ; POINT TO NEXT + INC HL ; AND REPEAT + JR LCDST0 +; +;----------------------------------------------------------------------------- +; SEND BYTE IN A TO LCD IN 4-BIT MODE +; +LCDATA: PUSH DE + LD D,A + LD A,(LCDLITE) + OR +(LCDPINE | LCDPIND) + JP LCDSND +LCDCMD: PUSH DE + LD D,A + LD A,(LCDLITE) + OR LCDPINE +LCDSND: LD E,A + LD A,D + PUSH BC + LD C,11110000B + AND C + OR E + LD (LCDBUF),A + AND ~LCDPINE + LD (LCDBUF+1),A + LD A,D + RLC A + RLC A + RLC A + RLC A + AND C + OR E + LD (LCDBUF+2),A + AND ~LCDPINE + LD (LCDBUF+3),A +; + LD HL,LCDBUF ; OUTPUT 1 BYTE WHICH + LD B,4 ; REQUIRES A FOUR + CALL WLN ; BYTE SEQUENCE +; + POP BC + POP DE + RET +; +LCDDATA: + .DB "TEST HOW BIG IS THIS LINE DOES IT WRAP",0 +; +LCDINIT1: + .DB 00110100B + .DB 00011000B +; +LCDINIT2: + .DB 00100100B + .DB 00100000B +; +LCDBUF: + .DB 0, 0, 0, 0 ; BUFFER TO HOLD 4 BYTE SEQUENCE + +; FLASH DEVICE READ +; + +DEVMADR .EQU 0 + +READR: LD B,255 +DLY1: DJNZ DLY1 +; + LD A,D ; SET SLAVE ADDRESS + OUT (REGS0),A +; + LD A,0C5H ; GENERATE START CONDITION + OUT (REGS1),A ; AND ISSUE THE SLAVE ADDRESS + CALL CHKPIN +; + LD A,+(DEVMADR/256) + OUT (REGS0),A ; PUT ADDRESS MSB ON BUS + CALL CHKPIN +; + LD A,+(DEVMADR&$00FF) + OUT (REGS0),A ; PUT ADDRESS LSB ON BUS + CALL CHKPIN +; + LD A,045H ; START + OUT (REGS1),A +; + LD A,E ; ISSUE CONTROL BYTE + READ + OUT (REGS0),A +; + CALL READI2C ; DUMMY READ + JR NZ,ERREXT +; +READLP1:CALL READI2C +; JR Z,ERREXT + CP 1AH + PUSH AF + CALL COUT + POP AF + JR NZ,READLP1 +; + LD A,PCF_ES0 + OUT (REGS1),A + CALL CHKPIN + IN A,(REGS0) + CALL READI2C + CALL STOP +; + CALL NEWLINE +; + RET +; +;----------------------------------------------------------------------------- +;----------------------------------------------------------------------------- +RESET: LD A,0C2H ; STOP + OUT (REGS1),A + LD B,255 +DLY2: DJNZ DLY2 + LD A,0C1H + OUT (REGS1),A + RET + + +RDSTAT: LD BC,-1 +STATLP: IN A,(REGS1) + AND 1 + RET Z + LD A,B + OR C + DEC BC + JR NZ,STATLP + LD A,'T' + JP ERREXTT +; +ERREXT: LD A,'Q' + JR ERR + +ERREXTT: POP HL +ERR: CALL COUT + CALL STOP + CALL RESET + RET +; +STOP: LD A,0C3H + OUT (REGS1),A + RET +; +DELAY: PUSH HL + LD HL,-1 +DLOOP: LD A,H + OR L + DEC HL + JR NZ,DLOOP + POP HL + RET +; +CHKPIN: IN A,(REGS1) ; POLL FOR + BIT 7,A ; TRANSMISSION + JP NZ,CHKPIN ; TO FINISH + +; IN A,(REGS1) ; CHECK FOR + BIT 3,A ; SLAVE + RET Z ; ACKNOWLEDGMENT + LD A,'A' + JP ERREXTT +; +; READ ONE BYTE FROM I2C +; RETURNS DATA IN A +; Z flag set is acknowledge received (correct operation) +; +READI2C: + IN A,(REGS1) ; READ S1 REGISTER + BIT 7,A ; CHECK PIN STATUS + JP NZ,READI2C + BIT 3,A ; CHECK LRB=0 + RET NZ + IN A,(REGS0) ; GET DATA + RET +; +DEBUG: PUSH AF + PUSH DE + LD A,'[' + CALL COUT + LD HL,DEBUGF + LD A,(HL) + INC (HL) + CALL HBTHE + LD A,']' + CALL COUT + POP DE + POP AF + RET +DEBUGF: .DB 00H +; +;----------------------------------------------------------------------------- +; +; LINUX DRIVER BASED CODE +; +; I2C_INB = IN A,(REGS0) +; I2C_OUTB = LD A,* | OUT (REGS0),A +; SET_PCF = LD A,* | OUT (REGS1),A +; GET_PCF = IN A,(REGS1) +; +;----------------------------------------------------------------------------- +I2C_START: + LD A,PCF_START_ + OUT (REGS1),A + RET +; +;----------------------------------------------------------------------------- +I2C_REPSTART: + LD A,PCF_START_ + OUT (REGS1),A + RET +; +;----------------------------------------------------------------------------- +I2C_STOP: + LD A,PCF_STOP_ + OUT (REGS1),A + RET +; +;----------------------------------------------------------------------------- +HANDLE_LAB: + +LABDLY .EQU 0F000H + + LD A,PCF_PIN + OUT (REGS1),A + LD A,PCF_ES0 + OUT (REGS1),A +; + LD HL,LABDLY +LABLP LD A,H + OR L + DEC HL + JR NZ,LABLP +; + IN A,(REGS1) + RET +; +;----------------------------------------------------------------------------- +WAIT_FOR_BB: +; +BBTIMO .EQU 255 +; + LD HL,BBTIMO +BBNOTO IN A,(REGS1) + AND PCF_BB + RET Z + DEC HL + LD A,H + OR A + JR NZ,BBNOTO + CPL ; RET NZ IF TIMEOUT +BBNOTB RET ; RET Z IF BUS IS BUSY +; +;----------------------------------------------------------------------------- +WAIT_FOR_PIN: +; +; RETURN A=00/Z IF SUCCESSFULL +; RETURN A=FF/NZ IF TIMEOUT +; RETURN A=01/NZ IF LOST ARBITRATION +; +PINTIMO .EQU 16000 +; + LD HL,PINTIMO +PINNOTO IN A,(REGS1) + LD (STATUS),A + LD B,A + AND PCF_PIN + RET Z + DEC HL + LD A,H + OR A + JR NZ,PINNOTO + CPL ; RET NZ IF TIMEOUT +PINNOTB RET ; RET Z IF BUS IS BUSY +; + LD B,A + AND PCF_LAB + CALL HANDLE_LAB + LD (STATUS),A + XOR A + INC A + RET +; +STATUS .DB 00H +; +;----------------------------------------------------------------------------- +PCF_INIT: + LD A,PCF_PIN ; S1=80H: S0 SELECTED, SERIAL + OUT (REGS1),A ; INTERFACE OFF + NOP + IN A,(REGS1) ; CHECK TO SEE S1 NOW USED AS R/W + AND 07FH ; CTRL. PCF8584 DOES THAT WHEN ESO + JR NZ,INIERR ; IS ZERO +; + LD A,PCF_OWN ; LOAD OWN ADDRESS IN S0, + OUT (REGS0),A ; EFFECTIVE ADDRESS IS (OWN <<1) + NOP + IN A,(REGS0) ; CHECK IT IS REALLY WRITTEN + CP PCF_OWN + JR NZ,SETERR +; + LD A,+(PCF_PIN | PCF_ES1) ; S1=0A0H + OUT (REGS1),A ; NEXT BYTE IN S2 + NOP + IN A,(REGS1) + AND 07FH + CP PCF_ES1 + JR NZ,REGERR +; + LD A,PCF_CLK ; LOAD CLOCK REGISTER S2 + OUT (REGS0),A + NOP + IN A,(REGS0) ; CHECK IT'S REALLY WRITTEN, ONLY + AND 1FH ; THE LOWER 5 BITS MATTER + CP PCF_CLK + JR NZ,CLKERR +; + LD A,PCF_IDLE_ + OUT (REGS1),A + NOP + IN A,(REGS1) + CP +(PCF_PIN | PCF_BB) + JR NZ,IDLERR + + RET +; +;----------------------------------------------------------------------------- +PCF_SENDBYTES: ; HL POINTS TO DATA, BC = COUNT, A = 0 LAST A=1 NOT LAST + ; + LD (LASTB),A +; +SB0: LD A,(HL) + OUT (REGS0),A + CALL WAIT_FOR_PIN + JR Z,SB1 + + CP 01H ; EXIT IF ARBITRATION ERROR + RET Z + + CALL I2C_STOP ; MUST BE TIMEOUT + LD A,055H ; ERROR + RET + +SB1: LD A,(STATUS) + AND PCF_LRB + JR NZ,SB2 + LD A,055H +; +SB2: LD A,B + OR C + INC HL + JR NZ,SB0 ; CHECK IF FINISHED +; +SBGOOD: LD A,(LASTB) + OR A + JR NZ,DB3 + CALL I2C_STOP + RET +DB3: CALL I2C_REPSTART + RET +; +LASTB .DB 00H +; + +; I2C_INB = IN A,(REGS0) +; I2C_OUTB = LD A,* | OUT (REGS0),A +; SET_PCF = LD A,* | OUT (REGS1),A +; GET_PCF = IN A,(REGS1) + + +; +;----------------------------------------------------------------------------- + +INIERR LD HL,NOPCF + CALL PRTSTR + RET +; +SETERR LD HL,WRTFAIL + CALL PRTSTR + RET +REGERR LD HL,REGFAIL + CALL PRTSTR + RET +; +CLKERR LD HL,CLKFAIL + CALL PRTSTR + RET +; +IDLERR LD HL,IDLFAIL + CALL PRTSTR + RET +; +NOPCF .DB "NO DEVICE FOUND",CR,LF,"$" +WRTFAIL .DB "SETTING DEVICE ID FAILED",CR,LF,"$" +REGFAIL .DB "CLOCK REGISTER SELECT ERROR",CR,LF,"$" +CLKFAIL .DB "CLOCK SET FAIL",CR,LF,"$" +IDLFAIL .DB "BUS IDLE FAILED",CR,LF,"$" +; +#INCLUDE "i2ccpm.inc" +; +BUFFER: .DS 256 +; + .END diff --git a/Source/Apps/Test/I2C/i2cscan.asm b/Source/Apps/Test/I2C/i2cscan.asm new file mode 100644 index 00000000..5b594ef5 --- /dev/null +++ b/Source/Apps/Test/I2C/i2cscan.asm @@ -0,0 +1,500 @@ +; + .ECHO "i2cscan\n" +; +; I2C BUS SCANNER +; MARCO MACCAFERRI, HTTPS://WWW.MACCASOFT.COM +; HBIOS VERSION BY PHIL SUMMERS (B1ACKMAILER) DIFFICULTLEVELHIGH@GMAIL.COM +; +PCF .EQU 1 +P8X180 .EQU 0 +SC126 .EQU 0 +SC137 .EQU 0 +; +#IF (PCF) +I2C_BASE .EQU 0F0H +PCF_ID .EQU 0AAH +CPU_CLK .EQU 12 +; +PCF_RS0 .EQU I2C_BASE +PCF_RS1 .EQU PCF_RS0+1 +PCF_OWN .EQU (PCF_ID >> 1) ; PCF'S ADDRESS IN SLAVE MODE +#ENDIF +; +#IF (P8X180) +I2C_BASE .EQU 0A0h +_sda .EQU 0 +_scl .EQU 1 +_idle .EQU 00000011B +#ENDIF +; +#IF (SC126) +I2C_BASE .EQU 0Ch +_sda .EQU 7 +_scl .EQU 0 +_idle .EQU 10001101B +#ENDIF +; +#IF (SC137) +I2C_BASE .EQU 20h +_sda .EQU 7 +_scl .EQU 0 +_idle .EQU 10000001B +#ENDIF +; +;----------------------------------------------------------------------------- +; + .org 100h + + ld sp,stack + + ld hl,signon + call _strout + + ld c,' ' + call _cout + call _cout + call _cout + +; display x axis header 00-0F + + xor a + ld (x),a + ld b, 16 +lp1: ld c,' ' + call _cout + ld a,(x) + ld c,a + inc a + ld (x),a + call _hexout + djnz lp1 + call _eolout + +; start of line loop 00-07 + + xor a ; display + ld (y),a ; y-axis + ld (addr),a ; prefix + ld d,8 +lp3b: ld a,(y) + ld c,a + add a,10h + ld (y),a + call _hexout + ld c,':' + call _cout + +; set up x axis loop + + xor a + ld (x),a + ld e,16 +lp2b: push de + + ld c,' ' + call _cout + +; i2c challenge +; . issue device start command +; . write address to device +; . issue device stop command. +; . delay +; . display response + +; call _i2c_start +; ld a,(addr) +; ld c,a +; call _i2c_write +; ld (rc),a +; call _i2c_stop + + CALL PCF_WAIT_FOR_BB + JP NZ,PCF_BBERR +; + LD A,(addr) + OUT (PCF_RS0),A + CALL PCF_START ; GENERATE START CONDITION +; + ld bc,100 ; delay +lp6: nop + dec bc + ld a,c + or b + jr nz,lp6 + + CALL PCF_WAIT_FOR_ACK; AND ISSUE THE SLAVE ADDRESS + or a + jp nz,lp4f + + ld c,'-' ; display no + call _cout ; response + call _cout + jp lp5f + +lp4f: ld a,(addr) ; adjust address + ld c,a ; and display it + srl c + call _hexout + +lp5f: ld a,(addr) ; next address + add a,2 ; adjust for + ld (addr),a ; 7-bit + + CALL PCF_STOP + + pop de ; check if + dec e ; reached end + jp nz,lp2b ; of line + call _eolout + + dec d ; loop until + jp nz,lp3b ; all done + + jp 0 + +signon: .db "I2C Bus Scanner" +#IF (PCF) + .DB " - PCF8584" +#ENDIF +#IF (SC126) + .DB " - SC126" +#ENDIF +#IF (SC137) + .DB " - SC137" +#ENDIF + .db 13, 10, 13, 10, 0, "$"8 + +_strout: +st1: ld a,(hl) ; display + CP '$' ; zero + ret z ; terminated + ld c,a ; string + call _cout + inc hl + jp st1 + +_hexout: ; display + ld a,c ; A in hex + srl a + srl a + srl a + srl a + add a,30h + cp 3Ah + jp c,h1 + add a,7 +h1: ld h,a + ld a,c + and 0Fh + add a,30h + cp 3Ah + jp c,h2 + add a,7 +h2: ld l,a + ld c,h + call _cout + ld c,l + call _cout + ret + +_eolout: ; newline + ld c,13 + call _cout + ld c,10 + call _cout + ret + +_cout: ; character + push af ; output + push bc + push de + push hl + ld e,c + ld c,02h + call 5 + pop hl + pop de + pop bc + pop af + ret + +;----------------------------------------------------------------------------- +#IF (PCF) +_i2c_start: +PCF_START: + LD A,PCF_START_ + OUT (PCF_RS1),A + RET +#ELSE +;_i2c_start: + ld a,_idle ; issue + out (I2C_BASE),a ; start + ; command + res _sda,a + out (I2C_BASE),a + nop + nop + res _scl,a + out (I2C_BASE),a + + ld (oprval),a + ret +#ENDIF +; +;----------------------------------------------------------------------------- +; +; CONTROL REGISTER BITS +; +PCF_PIN .EQU 10000000B +PCF_ES0 .EQU 01000000B +PCF_ES1 .EQU 00100000B +PCF_ES2 .EQU 00010000B +PCF_EN1 .EQU 00001000B +PCF_STA .EQU 00000100B +PCF_STO .EQU 00000010B +PCF_ACK .EQU 00000001B +; +; STATUS REGISTER BITS +; +;PCF_PIN .EQU 10000000B +PCF_INI .EQU 01000000B ; 1 if not initialized +PCF_STS .EQU 00100000B +PCF_BER .EQU 00010000B +PCF_AD0 .EQU 00001000B +PCF_LRB .EQU 00001000B +PCF_AAS .EQU 00000100B +PCF_LAB .EQU 00000010B +PCF_BB .EQU 00000001B +; +PCF_START_ .EQU (PCF_PIN | PCF_ES0 | PCF_STA | PCF_ACK) +PCF_STOP_ .EQU (PCF_PIN | PCF_ES0 | PCF_STO | PCF_ACK) +; +; TIMEOUT AND DELAY VALUES (ARBITRARY) +; +PCF_PINTO .EQU 65000 +PCF_ACKTO .EQU 65000 +PCF_BBTO .EQU 65000 +PCF_LABDLY .EQU 65000 +; +PCF_STATUS .DB 00H +; +;-------------------------------------------------------------------------------- +; +; RETURN NZ/FF IF TIMEOUT ERROR +; RETURN NZ/01 IF FAILED TO RECEIVE ACKNOWLEDGE +; RETURN Z/00 IF RECEIVED ACKNOWLEDGE +; +PCF_WAIT_FOR_ACK: + PUSH HL + LD HL,PCF_ACKTO +; +PCF_WFA0: + IN A,(PCF_RS1) ; READ PIN + LD (PCF_STATUS),A ; STATUS + LD B,A +; + DEC HL ; SEE IF WE HAVE TIMED + LD A,H ; OUT WAITING FOR PIN + OR L ; EXIT IF + JR Z,PCF_WFA1 ; WE HAVE +; + LD A,B ; OTHERWISE KEEP LOOPING + AND PCF_PIN ; UNTIL WE GET PIN + JR NZ,PCF_WFA0 ; OR TIMEOUT +; + LD A,B ; WE GOT PIN SO NOW + AND PCF_LRB ; CHECK WE HAVE + LD A,1 + JR Z,PCF_WFA2 ; RECEIVED ACKNOWLEDGE + XOR A + JR PCF_WFA2 +PCF_WFA1: + CPL ; TIMOUT ERROR +PCF_WFA2: + POP HL ; EXIT WITH NZ = FF + RET +; +;----------------------------------------------------------------------------- +; +; POLL THE BUS BUSY BIT TO DETERMINE IF BUS IS FREE. +; RETURN WITH A=00H/Z STATUS IF BUS IS FREE +; RETURN WITH A=FFH/NZ STATUS IF BUS +; +; AFTER RESET THE BUS BUSY BIT WILL BE SET TO 1 I.E. NOT BUSY +; +PCF_WAIT_FOR_BB: + LD HL,PCF_BBTO +PCF_WFBB0: + IN A,(PCF_RS1) + AND PCF_BB + RET Z ; BUS IS FREE RETURN ZERO + DEC HL + LD A,H + OR L + JR NZ,PCF_WFBB0 ; REPEAT IF NOT TIMED OUT + CPL ; RET NZ IF TIMEOUT + RET +; +;----------------------------------------------------------------------------- +; DISPLAY ERROR MESSAGES +; +PCF_RDERR: + PUSH HL + LD HL,PCF_RDFAIL + JR PCF_PRTERR +; +PCF_INIERR: + PUSH HL + LD HL,PCF_NOPCF + JR PCF_PRTERR +; +PCF_SETERR: + PUSH HL + LD HL,PCF_WRTFAIL + JR PCF_PRTERR +; +PCF_REGERR: + PUSH HL + LD HL,PCF_REGFAIL + JR PCF_PRTERR +; +PCF_CLKERR: + PUSH HL + LD HL,PCF_CLKFAIL + JR PCF_PRTERR +; +PCF_IDLERR: + PUSH HL + LD HL,PCF_IDLFAIL + JR PCF_PRTERR +; +PCF_ACKERR: + PUSH HL + LD HL,PCF_ACKFAIL + JR PCF_PRTERR +; +PCF_RDBERR: + PUSH HL + LD HL,PCF_RDBFAIL + JR PCF_PRTERR +; +PCF_TOERR: + PUSH HL + LD HL,PCF_TOFAIL + JR PCF_PRTERR +; +PCF_ARBERR: + PUSH HL + LD HL,PCF_ARBFAIL + JR PCF_PRTERR +; +PCF_PINERR: + PUSH HL + LD HL,PCF_PINFAIL + JR PCF_PRTERR +; +PCF_BBERR: + PUSH HL + LD HL,PCF_BBFAIL + JR PCF_PRTERR +; +PCF_PRTERR: + CALL _strout + CALL _eolout + POP HL + RET +; +PCF_NOPCF .DB "NO DEVICE FOUND$" +PCF_WRTFAIL .DB "SETTING DEVICE ID FAILED$" +PCF_REGFAIL .DB "CLOCK REGISTER SELECT ERROR$" +PCF_CLKFAIL .DB "CLOCK SET FAIL$" +PCF_IDLFAIL .DB "BUS IDLE FAILED$" +PCF_ACKFAIL .DB "FAILED TO RECEIVE ACKNOWLEDGE$" +PCF_RDFAIL .DB "READ FAILED$" +PCF_RDBFAIL .DB "READBYTES FAILED$" +PCF_TOFAIL .DB "TIMEOUT ERROR$" +PCF_ARBFAIL .DB "LOST ARBITRATION$" +PCF_PINFAIL .DB "PIN FAIL$" +PCF_BBFAIL .DB "BUS BUSY$" +; +;----------------------------------------------------------------------------- +#IF (PCF) +_i2c_stop: +PCF_STOP: + LD A,PCF_STOP_ ; issue + OUT (PCF_RS1),A ; stop + RET ; command +#ELSE +;_i2c_stop: + ld a,(oprval) + res _scl,a + res _sda,a + out (I2C_BASE),a + + set _scl,a + out (I2C_BASE),a + nop + nop + set _sda,a + out (I2C_BASE),a + + ld (oprval),a + ret +; +_i2c_write: ; write + ld a,(oprval) ; to i2c + ; bus + ld b,8 +i2c1: res _sda,a + rl c + jr nc,i2c2 + set _sda,a +i2c2: out (I2C_BASE),a + set _scl,a + out (I2C_BASE),a + +#IF (SC126=0) + ld d,a +i2c3: in a,(I2C_BASE) + bit _scl,a + jr z,i2c3 + ld a,d +#ENDIF + res _scl,a + out (I2C_BASE),a + djnz i2c1 + + set _sda,a + out (I2C_BASE),a + set _scl,a + out (I2C_BASE),a + + ld d,a +i2c4: in a,(I2C_BASE) +#IF (SC126=0) + bit _scl,a + jr z,4b +#ENDIF + ld c,a + ld a,d + + res _scl,a + out (I2C_BASE),a + ld (oprval),a + + xor a + bit _sda,c + ret z + inc a + + ret +#ENDIF +oprval: .db 0 +x: .db 0 +y: .db 0 +addr: .db 0 +rc: .db 0 + + .fill 128 +stack: + .end diff --git a/Source/Apps/Test/I2C/pcfi2c.inc b/Source/Apps/Test/I2C/pcfi2c.inc new file mode 100644 index 00000000..c61dcb59 --- /dev/null +++ b/Source/Apps/Test/I2C/pcfi2c.inc @@ -0,0 +1,116 @@ +;================================================================================================== +; PCF8584 Generic +;================================================================================================== +; +PCF_BASE .EQU 0F0H +PCF_ID .EQU 0AAH +CPU_CLK .EQU 12 + +PCF_RS0 .EQU PCF_BASE +PCF_RS1 .EQU PCF_RS0+1 +PCF_OWN .EQU (PCF_ID >> 1) ; PCF'S ADDRESS IN SLAVE MODE + +REGS0 .EQU PCF_BASE +REGS1 .EQU REGS0+1 +; +;T4LC512D .EQU 10100000B ; DEVICE IDENTIFIER +;T4LC512A1 .EQU 00000000B ; DEVICE ADDRESS +;T4LC512A2 .EQU 00001110B ; DEVICE ADDRESS +;T4LC512A3 .EQU 00000010B ; DEVICE ADDRESS +;T4LC512W .EQU 00000000B ; DEVICE WRITE +;T4LC512R .EQU 00000001B ; DEVICE READ +; +;I2CDEV1W .EQU (T4LC512D+T4LC512A1+T4LC512W) +;I2CDEV1R .EQU (T4LC512D+T4LC512A1+T4LC512R) +; +;I2CDEV2W .EQU (T4LC512D+T4LC512A2+T4LC512W) +;I2CDEV2R .EQU (T4LC512D+T4LC512A2+T4LC512R) +; +;I2CDEV3W .EQU (T4LC512D+T4LC512A3+T4LC512W) +;I2CDEV3R .EQU (T4LC512D+T4LC512A3+T4LC512R) +; +; CONTROL REGISTER BITS +; +PCF_PIN .EQU 10000000B +PCF_ES0 .EQU 01000000B +PCF_ES1 .EQU 00100000B +PCF_ES2 .EQU 00010000B +PCF_EN1 .EQU 00001000B +PCF_STA .EQU 00000100B +PCF_STO .EQU 00000010B +PCF_ACK .EQU 00000001B +; +PCF_START_ .EQU (PCF_PIN | PCF_ES0 | PCF_STA | PCF_ACK) +PCF_STOP_ .EQU (PCF_PIN | PCF_ES0 | PCF_STO | PCF_ACK) +PCF_REPSTART_ .EQU ( PCF_ES0 | PCF_STA | PCF_ACK) +PCF_IDLE_ .EQU (PCF_PIN | PCF_ES0 | PCF_ACK) +; +; STATUS REGISTER BITS +; +;PCF_PIN .EQU 10000000B +PCF_INI .EQU 01000000B ; 1 if not initialized +PCF_STS .EQU 00100000B +PCF_BER .EQU 00010000B +PCF_AD0 .EQU 00001000B +PCF_LRB .EQU 00001000B +PCF_AAS .EQU 00000100B +PCF_LAB .EQU 00000010B +PCF_BB .EQU 00000001B +; +; CLOCK CHIP FREQUENCIES +; +PCF_CLK3 .EQU 000H +PCF_CLK443 .EQU 010H +PCF_CLK6 .EQU 014H +PCF_CLK8 .EQU 018H +PCF_CLK12 .EQU 01cH +; +; TRANSMISSION FREQUENCIES +; +PCF_TRNS90 .EQU 000H ; 90 kHz */ +PCF_TRNS45 .EQU 001H ; 45 kHz */ +PCF_TRNS11 .EQU 002H ; 11 kHz */ +PCF_TRNS15 .EQU 003H ; 1.5 kHz */ +; +; TIMEOUT AND DELAY VALUES (ARBITRARY) +; +PCF_PINTO .EQU 65000 +PCF_ACKTO .EQU 65000 +PCF_BBTO .EQU 65000 +PCF_LABDLY .EQU 65000 +; +; DATA PORT REGISTERS +; +#IF (CPU_CLK = 443) +PCF_CLK .EQU PCF_CLK443 +#ELSE + #IF (CPU_CLK = 8) +PCF_CLK .EQU PCF_CLK8 + #ELSE + #IF (CPU_CLK = 12) +PCF_CLK .EQU PCF_CLK12 + #ELSE ***ERROR + #ENDIF + #ENDIF +#ENDIF +; +DS7_OUT .EQU 10000000B ; SELECT SQUARE WAVE FUNCTION +DS7_SQWE .EQU 00010000B ; ENABLE SQUARE WAVE OUTPUT +DS7_RATE .EQU 00000000B ; SET 1HZ OUPUT +; +DS7_DS1307 .EQU 11010000B ; DEVICE IDENTIFIER +DS7_W .EQU 00000000B ; DEVICE WRITE +DS7_R .EQU 00000001B ; DEVICE READ +; +DS7_READ .EQU (DS7_DS1307 | DS7_R) ; READ +DS7_WRITE .EQU (DS7_DS1307 | DS7_W) ; WRITE +; +DS7_CTL .EQU (DS7_OUT | DS7_SQWE | DS7_RATE) +; +PCF8574 .EQU 01000000B ; DEVICE IDENTIFIER +PCF8574A .EQU 00001110B ; DEVICE ADDRESS +PCF8574W .EQU 00000000B ; DEVICE WRITE +PCF8574R .EQU 00000001B ; DEVICE READ +; +I2CLCDR .EQU (PCF8574+PCF8574A+PCF8574R) +I2CLCDW .EQU (PCF8574+PCF8574A+PCF8574W) diff --git a/Source/Apps/Test/I2C/rtcds7.asm b/Source/Apps/Test/I2C/rtcds7.asm new file mode 100644 index 00000000..2c05c96c --- /dev/null +++ b/Source/Apps/Test/I2C/rtcds7.asm @@ -0,0 +1,540 @@ +;================================================================================================== +; PCF8584/DS1307 I2C DATE AND TIME UTILITY +;================================================================================================== +; + .ECHO "rtcds7\n" +; +#INCLUDE "pcfi2c.inc" +; + .ORG 100H +; +DS7_START: + LD (DS7_STK),SP ; SETUP A + LD SP,DS7_LOC ; LOCAL STACK +; + CALL DS7_INIT ; INITIALIZE AND + JR NZ,DS7_ERR ; RETURN WITH STATUS +; + LD A,(FCB+1) ; GET FIRST COMMAND LINE CHAR + CP ' ' ; COMPARE TO BLANK. IF SO NO + JR Z,DS7_ST0 ; ARGUMENTS SO DISLAY TIME AND DATE +; + LD A,(FCB+1) ; GET FIRST CHAR + CP '/' ; IS IT INDICATING AN ARGUMENT + JR NZ,DS7_ST0 ; +; + LD A,(FCB+2) ; GET NEXT CHARACTER + CP 'D' ; + JR NZ,DS7_ST1 ; +; +; /D SET DATE +; + JR DS7_EXIT +; +DS7_ST1: + LD A,(FCB+2) ; GET NEXT CHARACTER + CP 'T' ; + JR NZ,DS7_ST2 ; +; +; /T SET TIME +; + JR DS7_EXIT +; +DS7_ST2: + LD A,(FCB+2) ; GET NEXT CHARACTER + CP 'S' ; + JR NZ,DS7_ST3 ; +; +; /S SET TIME AND DATE +; + JR DS7_EXIT +; +DS7_ST3: +; +; UNREGOGNIZED ARGUMENT +; + JR DS7_EXIT +; +DS7_ST0: + CALL DS7_RDC ; READ CLOCK DATA INTO BUFFER + CALL DS7_DISP ; DISPLAY TIME AND DATE FROM BUFFER +; +DS7_EXIT: + LD SP,(DS7_STK) ; RESTORE STACK + RET ; AND EXIT +; +DS7_ERR: + CALL PCF_INIERR ; DISPLAY ERROR + JR DS7_EXIT ; END EXIT +; +DS7_STK .DW 2 ; SAVE STACK +; +;----------------------------------------------------------------------------- +; RTC READ +; +; 1. ISSUE SLAVE ADDRESS WITH START CONDITION AND WRITE STATUS +; 2. OUTPUT THE ADDRESS TO ACCESS. (00H = START OF DS1307 REGISTERS) +; 3. OUTPUT REPEAT START TO TRANSITION TO READ PROCESS +; 4. ISSUE SLAVE ADDRESS WITH READ STATUS +; 5. DO A DUMMY READ +; 6. READ 8 BYTES STARTING AT ADDRESS PREVIOUSLY SET +; 7. END READ WITH NON-ACKNOWLEDGE +; 8. ISSUE STOP AND RELEASE BUS +; +DS7_RDC: + LD A,DS7_WRITE ; SET SLAVE ADDRESS + OUT (REGS0),A +; + CALL PCF_WAIT_FOR_BB + JP NZ,PCF_BBERR +; + CALL PCF_START ; GENERATE START CONDITION + CALL PCF_WAIT_FOR_PIN; AND ISSUE THE SLAVE ADDRESS + CALL NZ,PCF_PINERR +; + LD A,0 + OUT (REGS0),A ; PUT ADDRESS MSB ON BUS + CALL PCF_WAIT_FOR_PIN + CALL NZ,PCF_PINERR +; + CALL PCF_REPSTART ; REPEAT START +; + LD A,DS7_READ ; ISSUE CONTROL BYTE + READ + OUT (REGS0),A +; + CALL PCF_READI2C ; DUMMY READ +; + LD HL,DS7_BUF ; READ 8 BYTES INTO BUFFER + LD B,8 +DS7_RL1:CALL PCF_READI2C + LD (HL),A + INC HL + DJNZ DS7_RL1 +; +#IF (0) + LD A,8 + LD DE,DS7_BUF ; DISLAY DATA READ + CALL PRTHEXBUF ; + CALL NEWLINE +#ENDIF +; + LD A,PCF_ES0 ; END WITH NOT-ACKNOWLEDGE + OUT (REGS1),A ; AND RELEASE BUS + NOP + IN A,(REGS0) + NOP +DS7_WTPIN: + IN A,(REGS1) ; READ S1 REGISTER + BIT 7,A ; CHECK PIN STATUS + JP NZ,DS7_WTPIN + CALL PCF_STOP +; + IN A,(REGS0) + RET + +; +;----------------------------------------------------------------------------- +; DISPLAY CLOCK INFORMATION FROM DATA STORED IN BUFFER +; +DS7_DISP: + LD HL,DS7_CLKTBL +DS7_CLP:LD C,(HL) + INC HL + LD D,(HL) + CALL DS7_BCD + INC HL + LD A,(HL) + OR A + RET Z + CALL COUT + INC HL + JR DS7_CLP + RET +; +DS7_CLKTBL: + .DB 04H, 00111111B, '/' + .DB 05H, 00011111B, '/' + .DB 06H, 11111111B, ' ' + .DB 02H, 00011111B, ':' + .DB 01H, 01111111B, ':' + .DB 00H, 01111111B, 00H +; +DS7_BCD:PUSH HL + LD HL,DS7_BUF ; READ VALUE FROM + LD B,0 ; BUFFER, INDEXED BY A + ADD HL,BC + LD A,(HL) + AND D ; MASK OFF UNNEEDED + SRL A + SRL A + SRL A + SRL A + ADD A,30H + CALL COUT + LD A,(HL) + AND 00001111B + ADD A,30H + CALL COUT + POP HL + RET +; +DS7_BUF: .FILL 8,0 ; BUFFER FOR TIME, DATE AND CONTROL + +;----------------------------------------------------------------------------- +PCF_START: + LD A,PCF_START_ + OUT (REGS1),A + RET +; +;----------------------------------------------------------------------------- +PCF_REPSTART: + LD A,PCF_REPSTART_ + OUT (REGS1),A + RET +; +;----------------------------------------------------------------------------- +PCF_STOP: + LD A,PCF_STOP_ + OUT (REGS1),A + RET +; +;----------------------------------------------------------------------------- +; +DS7_INIT: + LD A,PCF_PIN ; S1=80H: S0 SELECTED, SERIAL + OUT (REGS1),A ; INTERFACE OFF + NOP + IN A,(REGS1) ; CHECK TO SEE S1 NOW USED AS R/W CTRL. + AND 07FH ; PCF8584 DOES THAT WHEN ESO IS ZERO + RET NZ ; PCF_INIERR +; + LD A,PCF_OWN ; LOAD OWN ADDRESS IN S0, + OUT (REGS0),A ; EFFECTIVE ADDRESS IS (OWN <<1) + NOP + IN A,(REGS0) ; CHECK IT IS REALLY WRITTEN + CP PCF_OWN + RET NZ ; PCF_SETERR +; + LD A,+(PCF_PIN | PCF_ES1) ; S1=0A0H + OUT (REGS1),A ; NEXT BYTE IN S2 + NOP + IN A,(REGS1) + AND 07FH + CP PCF_ES1 + RET NZ ; PCF_REGERR +; + LD A,PCF_CLK ; LOAD CLOCK REGISTER S2 + OUT (REGS0),A + NOP + IN A,(REGS0) ; CHECK IT'S REALLY WRITTEN, ONLY + AND 1FH ; THE LOWER 5 BITS MATTER + CP PCF_CLK + RET NZ ; PCF_CLKERR +; + LD A,PCF_IDLE_ + OUT (REGS1),A + NOP + IN A,(REGS1) + CP +(PCF_PIN | PCF_BB) + RET NZ ; PCF_IDLERR +; + XOR A + RET +; +;----------------------------------------------------------------------------- +PCF_HANDLE_LAB: +; + LD A,PCF_PIN + OUT (REGS1),A + LD A,PCF_ES0 + OUT (REGS1),A +; + LD HL,PCF_LABDLY +PCF_LABLP: + LD A,H + OR L + DEC HL + JR NZ,PCF_LABLP +; + IN A,(REGS1) + RET +; +;----------------------------------------------------------------------------- +; +; RETURN A=00/Z IF SUCCESSFULL +; RETURN A=FF/NZ IF TIMEOUT +; RETURN A=01/NZ IF LOST ARBITRATION +; PCF_STATUS HOLDS LAST PCF STATUS +; +PCF_WAIT_FOR_PIN: + PUSH HL + LD HL,PCF_PINTO ; SET TIMEOUT VALUE + +PCF_WFP0: + IN A,(REGS1) ; GET BUS + LD (PCF_STATUS),A ; STATUS + LD B,A + + DEC HL ; HAVE WE + LD A,H ; TIMED OUT + OR L + JR Z,PCF_WFP1 ; YES WE HAVE, GO ACTION IT + + LD A,B ; + AND PCF_PIN ; IS TRANSMISSION COMPLETE? + JR NZ,PCF_WFP0 ; KEEP ASKING IF NOT OR + POP HL ; YES COMPLETE (PIN=0) RETURN WITH ZERO + RET +PCF_WFP1: + LD A,B ; DID WE LOSE ARBITRATION? + AND PCF_LAB ; IF A=0 THEN NO + CPL + JR NZ,PCF_WFP2 ; NO + CALL PCF_HANDLE_LAB ; YES GO HANDLE IT + LD (PCF_STATUS),A + XOR A ; RETURN NZ, A=01H + INC A +PCF_WFP2: + POP HL ; RET NZ, A=FF IF TIMEOUT + RET +; +PCF_STATUS .DB 00H + +;-------------------------------------------------------------------------------- +; +; RETURN NZ/FF IF TIMEOUT ERROR +; RETURN NZ/01 IF FAILED TO RECEIVE ACKNOWLEDGE +; RETURN Z/00 IF RECEIVED ACKNOWLEDGE +; +PCF_WAIT_FOR_ACK: + PUSH HL + LD HL,PCF_ACKTO +; +PCF_WFA0: + IN A,(REGS1) ; READ PIN + LD (PCF_STATUS),A ; STATUS + LD B,A +; + DEC HL ; SEE IF WE HAVE TIMED + LD A,H ; OUT WAITING FOR PIN + OR L ; EXIT IF + JR Z,PCF_WFA1 ; WE HAVE +; + LD A,B ; OTHERWISE KEEP LOOPING + AND PCF_PIN ; UNTIL WE GET PIN + JR NZ,PCF_WFA0 ; OR TIMEOUT +; + LD A,B ; WE GOT PIN SO NOW + AND PCF_LRB ; CHECK WE HAVE + LD A,1 + JR Z,PCF_WFA2 ; RECEIVED ACKNOWLEDGE + XOR A + JR PCF_WFA2 +PCF_WFA1: + CPL ; TIMOUT ERROR +PCF_WFA2: + POP HL ; EXIT WITH NZ = FF + RET +; +;-------------------------------------------------------------------------------- +; +; HL POINTS TO DATA +; DE = COUNT +; A = 0 LAST A=1 NOT LAST +; +; +;PCF_READBYTES: ; NOT FUNCTIONAL YET + + LD (PCF_LBF),A ; SAVE LAST BYTE FLAG +; + INC DE ; INCREMENT NUMBER OF BYTES TO READ BY ONE -- DUMMY READ BYTE + LD BC,0 ; SET BYTE COUNTER +; +PCF_RBL:PUSH BC + CALL PCF_WAIT_FOR_PIN ; DO WE HAVE THE BUS? + POP BC + JR Z,PCF_RB1 ; YES + CP 01H + JR Z,PCF_RB3 ; NO - LOST ARBITRATION + JR PCF_RB2 ; NO - TIMEOUT +; +PCF_RB1: + LD A,(PCF_STATUS) + AND PCF_LRB + + + ; IS THIS THE SECOND TO LAST BYTE TO GO? + + PUSH DE ; SAVE COUNT + DEC DE ; COUNT (DE) = NUMBER OF BYTES TO READ LESS 1 + EX DE,HL ; SAVE POINTER, PUT COUNT IN DE + XOR A ; CLEAR CARRY FLAG + SBC HL,BC ; DOES BYTE COUNTER = HL (NUMBER OF BYTES TO READ LESS 1) + EX DE,HL ; RESTORE POINTER + POP DE ; RESTORE COUNT + + ; Z = YES IT IS + ; NZ = NO IT ISN'T + JR NZ,PCF_RB4 +; +PCF_RB4:LD A,B ; IF FIRST READ DO A DUMMY + OR C ; READ OTHERWISE READ AND SAVE + JR NZ,PCF_RB5 + + IN A,(REGS0) ; DUMMY READ + JR PCF_RB6 + +PCF_RB5:IN A,(REGS0) ; READ AND SAVE + LD (HL),A +; +PCF_RB6: ; HAVE WE DONE ALL? + + PUSH DE ; SAVE COUNT + EX DE,HL ; SAVE POINTER, PUT COUNT IN DE + XOR A ; CLEAR CARRY FLAG + SBC HL,BC ; DOES BYTE COUNTER = HL (NUMBER OF BYTES TO READ) + EX DE,HL ; RESTORE POINTER + POP DE ; RESTORE COUNT +; + INC HL ; BUFFER POINTER + INC BC ; COUNT +; + JR NZ,PCF_RBL ; REPEAT UNTIL COUNTS MATCH + RET +; +PCF_RB2: ; TIMEOUT + CALL PCF_STOP + CALL PCF_TOERR + RET +; +PCF_RB3: ; LOST ARBITRATION + CALL PCF_ARBERR + RET +; +PCF_LBF: + .DB 0 ; LAST BYTE FLAG +; +;----------------------------------------------------------------------------- +; READ ONE BYTE FROM I2C +; RETURNS DATA IN A +; Z FLAG SET IS ACKNOWLEDGE RECEIVED (CORRECT OPERATION) +; +PCF_READI2C: + IN A,(REGS1) ; READ S1 REGISTER + BIT 7,A ; CHECK PIN STATUS + JP NZ,PCF_READI2C + BIT 3,A ; CHECK LRB=0 + JP NZ,PCF_RDERR + IN A,(REGS0) ; GET DATA + RET +;----------------------------------------------------------------------------- +; +; POLL THE BUS BUSY BIT TO DETERMINE IF BUS IS FREE. +; RETURN WITH A=00H/Z STATUS IF BUS IS FREE +; RETURN WITH A=FFH/NZ STATUS IF BUS +; +; AFTER RESET THE BUS BUSY BIT WILL BE SET TO 1 I.E. NOT BUSY +; +PCF_WAIT_FOR_BB: + LD HL,PCF_BBTO +PCF_WFBB0: + IN A,(REGS1) + AND PCF_BB + RET Z ; BUS IS FREE RETURN ZERO + DEC HL + LD A,H + OR L + JR NZ,PCF_WFBB0 ; REPEAT IF NOT TIMED OUT + CPL ; RET NZ IF TIMEOUT + RET +; +;----------------------------------------------------------------------------- +; DISPLAY ERROR MESSAGES +; +PCF_RDERR: + PUSH HL + LD HL,PCF_RDFAIL + JR PCF_PRTERR +; +PCF_INIERR: + PUSH HL + LD HL,PCF_NOPCF + JR PCF_PRTERR +; +PCF_SETERR: + PUSH HL + LD HL,PCF_WRTFAIL + JR PCF_PRTERR +; +PCF_REGERR: + PUSH HL + LD HL,PCF_REGFAIL + JR PCF_PRTERR +; +PCF_CLKERR: + PUSH HL + LD HL,PCF_CLKFAIL + JR PCF_PRTERR +; +PCF_IDLERR: + PUSH HL + LD HL,PCF_IDLFAIL + JR PCF_PRTERR +; +PCF_ACKERR: + PUSH HL + LD HL,PCF_ACKFAIL + JR PCF_PRTERR +; +PCF_RDBERR: + PUSH HL + LD HL,PCF_RDBFAIL + JR PCF_PRTERR +; +PCF_TOERR: + PUSH HL + LD HL,PCF_TOFAIL + JR PCF_PRTERR +; +PCF_ARBERR: + PUSH HL + LD HL,PCF_ARBFAIL + JR PCF_PRTERR +; +PCF_PINERR: + PUSH HL + LD HL,PCF_PINFAIL + JR PCF_PRTERR +; +PCF_BBERR: + PUSH HL + LD HL,PCF_BBFAIL + JR PCF_PRTERR +; +PCF_PRTERR: + CALL PRTSTR + CALL NEWLINE + POP HL + RET +; +PCF_NOPCF .DB "NO DEVICE FOUND$" +PCF_WRTFAIL .DB "SETTING DEVICE ID FAILED$" +PCF_REGFAIL .DB "CLOCK REGISTER SELECT ERROR$" +PCF_CLKFAIL .DB "CLOCK SET FAIL$" +PCF_IDLFAIL .DB "BUS IDLE FAILED$" +PCF_ACKFAIL .DB "FAILED TO RECEIVE ACKNOWLEDGE$" +PCF_RDFAIL .DB "READ FAILED$" +PCF_RDBFAIL .DB "READBYTES FAILED$" +PCF_TOFAIL .DB "TIMEOUT ERROR$" +PCF_ARBFAIL .DB "LOST ARBITRATION$" +PCF_PINFAIL .DB "PIN FAIL$" +PCF_BBFAIL .DB "BUS BUSY$" +; +;----------------------------------------------------------------------------- +; +#INCLUDE "i2ccpm.inc" +; + .FILL 128 +DS7_LOC: +; + .END diff --git a/Source/Apps/Test/MBC/button2.asm b/Source/Apps/Test/MBC/button2.asm new file mode 100644 index 00000000..001f8d48 --- /dev/null +++ b/Source/Apps/Test/MBC/button2.asm @@ -0,0 +1,19 @@ +; test program for user button on Z80 MBC clock board +; by Andrew Lynch, 6 Jul 2021 + + + ORG 00100H + +MAIN_LOOP: + + IN A,($70) ; READ USER BUTTON STATUS + AND %01000000 ; REMOVE ALL EXCEPT USER BUTTON (D6) + ; 0=PRESSED, 1=NOT PRESSED + JR NZ,MAIN_LOOP ; IF NOT PRESSED TRY AGAIN + + LD A,%00000011 ; TURN ON BOTH USER LEDS + OUT ($70),A ; + + RET + + end diff --git a/Source/Apps/Test/MBC/leds2.asm b/Source/Apps/Test/MBC/leds2.asm new file mode 100644 index 00000000..ddf36f81 --- /dev/null +++ b/Source/Apps/Test/MBC/leds2.asm @@ -0,0 +1,8 @@ +; program to test user LEDs on Z80 MBC clock board +; by Andrew Lynch, 6 Jul 2021 + + org $0100 + LD A,%00000011 + OUT ($70),A ; turn on USERLED0 and USERLED1 + RET + end diff --git a/Source/Apps/Test/MBC/tone3.asm b/Source/Apps/Test/MBC/tone3.asm new file mode 100644 index 00000000..620841e0 --- /dev/null +++ b/Source/Apps/Test/MBC/tone3.asm @@ -0,0 +1,35 @@ +; program to test user buzzer/speaker on Z80 MBC clock board +; by Andrew Lynch, 6 Jul 2021 + + org $0100 + + LD HL,$7FFF ; INITIALIZE OUTER LOOP + LD DE,$0001 ; DECREMENT VALUE + +START: + + LD A,%00000100 + OUT ($70),A ; TURN ON SPEAKER + + LD B,$80 ; HOLD SPEAKER ON FOR 128 COUNTS +LOOP1: DJNZ LOOP1 + + LD A,%00000000 + OUT ($70),A ; TURN OFF SPEAKER + + LD B,$80 ; HOLD SPEAKER OFF FOR 128 COUNTS +LOOP2: DJNZ LOOP2 + + SBC HL,DE ; REDUCE OUTER LOOP BY 1 + + JR NZ,START ; LOOP 32768 TIMES, ABOUT 15 SECONDS + + LD A,%00000011 + OUT ($70),A ; TURN ON BOTH USER LEDS + +; HALT ; HALT & TURN ON HALT LED + + RET + + end + diff --git a/Source/Apps/Test/Makefile b/Source/Apps/Test/Makefile new file mode 100644 index 00000000..6fbce342 --- /dev/null +++ b/Source/Apps/Test/Makefile @@ -0,0 +1,6 @@ +OBJECTS = +SUBDIRS = DMAmon I2C inttest ppidetst ramtest tstdskng rzsz vdctest kbdtest ps2info 2piotst piomon banktest portscan +DEST = ../../../Binary/Apps/Test +TOOLS =../../../Tools + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/Test/banktest/Build.cmd b/Source/Apps/Test/banktest/Build.cmd new file mode 100644 index 00000000..e6229710 --- /dev/null +++ b/Source/Apps/Test/banktest/Build.cmd @@ -0,0 +1,11 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t80 -g3 -fFF banktest.asm banktest.com banktest.lst || exit /b + +copy /Y banktest.com ..\..\..\..\Binary\Apps\Test\ || exit /b + diff --git a/Source/Apps/Test/banktest/Clean.cmd b/Source/Apps/Test/banktest/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/banktest/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/banktest/Makefile b/Source/Apps/Test/banktest/Makefile new file mode 100644 index 00000000..8648fb10 --- /dev/null +++ b/Source/Apps/Test/banktest/Makefile @@ -0,0 +1,7 @@ +OBJECTS = banktest.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/Test/banktest/banktest.asm b/Source/Apps/Test/banktest/banktest.asm new file mode 100644 index 00000000..bb1e0f9c --- /dev/null +++ b/Source/Apps/Test/banktest/banktest.asm @@ -0,0 +1,563 @@ +;=============================================================================== +; BANKTEST - Test RomWBW bank management API +; +;=============================================================================== +; +; Author: Wayne Warthen (wwarthen@gmail.com) +;_______________________________________________________________________________ +; +; Usage: +; BANKTEST +; +; Operation: +; Steps through a series of banking API tests +;_______________________________________________________________________________ +; +; Change Log: +; 2023-01-22 [WBW] Initial release +;_______________________________________________________________________________ +; +; ToDo: +;_______________________________________________________________________________ +; +;=============================================================================== +; Definitions +;=============================================================================== +; +runloc .equ $C000 ; Running location (upper memory required) +stksiz .equ $40 ; Working stack size +; +restart .equ $0000 ; CP/M restart vector +; +#include "../../../ver.inc" +; +#include "../../../HBIOS/hbios.inc" +; +;=============================================================================== +; Code Section +;=============================================================================== +; + .org $100 +; + ; relocate worker code to upper memory + ld hl,begin ; start of working code image + ld de,runloc ; running location + ld bc,size ; size of working code image + ldir ; copy to upper RAM + jp runloc ; and go +; +; Start of working code +; +begin .equ $ ; image loaded here +; + .org runloc ; now generate running location adresses +; + ; setup stack (save old value) + ld (stksav),sp ; save stack + ld sp,stack ; set new stack +; + ; initialization + call init ; initialize + jr nz,exit ; abort if init fails +; + ; process + call process ; do main processing + jr nz,exit ; abort on error +; +exit: ; clean up and return to command processor + call crlf ; formatting + ld sp,(stksav) ; restore stack + ;jp restart ; return to CP/M via restart + ret ; return to CP/M w/o restart +; +; Initialization +; +init: + call crlf2 ; formatting + ld de,msgban ; point to version message part 1 + call prtstr ; print it +; + call idbio ; identify active BIOS + cp 1 ; check for HBIOS + jp nz,errbio ; handle BIOS error +; + ld a,rmj << 4 | rmn ; expected HBIOS ver + cp d ; compare with result above + jp nz,errbio ; handle BIOS error +; +initx + ; initialization complete + xor a ; signal success + ret ; return +; +; Process +; +process: +; +; Start by testing a bank switch and dumping some memory +; from the new bank. +; + di +; + ; Get and display current RAM bank + ld b,BF_SYSGETBNK ; HBIOS GetBank function + rst 08 ; do it via RST vector, C=bank id + ld a,c ; put bank id in A + push af ; save bank id returned + call crlf2 + ld de,msgcur ; load message + call prtstr ; print it + pop af ; restore bank id + call prthex ; print the bank id +; + ; Switch to first RAM bank + ld b,BF_SYSSETBNK ; HBIOS SetBank function + ld c,$80 ; first RAM bank + rst 08 ; do it via RST vector + ld a,c ; original bank id to accum + ld (orgbnk),a ; save it +; +; NOTE: Once the page zero of the default bank is swapped out, we +; cannot use RST 08 for HBIOS function calls because the vector is +; no longer in context. Instead, we rely on the alternate call +; address entry point. +; + ; Do an HBIOS function call while bank switched + call crlf2 + ld de,msg80 ; message to print + call prtstr ; do it +; + ; Dump chunk of memory from bank + call crlf + ld de,0 ; from 0x0000 + call dump_buffer +; + ; Switch back to original bank + ld b,BF_SYSSETBNK ; HBIOS SetBank function + ld a,(orgbnk) ; get original bank back + ld c,a ; to C for function call + call HB_INVOKE ; do it via call +; + ei +; +; Now poke a small procedure into an alternate bank and do an +; inter-bank call to execute it. +; + ; Copy test procedure to a foreign bank + ld b,BF_SYSSETCPY ; HBIOS SysSetCopy function + ld a,(orgbnk) ; our current bank is source + ld e,a ; put in D + ld d,xproc_bnk ; target bank is 0x80 + ld hl,xproc_len ; length to copy + rst 08 ; do it +; + ld b,BF_SYSBNKCPY ; HBIOS SysBnkCopy function + ld de,xproc_loc ; destination address + ld hl,xproc ; source address + rst 08 ; do it +; + ; Do an inter-bank call to the test procedure + di ; interrupts off + ld a,xproc_bnk ; target bank + ld ix,xproc_loc ; target address + call HB_BNKCALL ; do it and pray + ei ; interrupts back on +; + call crlf2 + ld de,msgdone ; message to print + call prtstr ; do it +; + ret ; all done +; +; Test procedure to be copied into an alternate bank. Code should +; be entirely relocatable. +; +xproc_bnk .equ $80 ; alternate bank for test proc +xproc_loc .equ $1000 ; run location for test proc +; +xproc: + call crlf2 + ld de,msgxcal + call prtstr + ret +; +xproc_end .equ $ +xproc_len .equ xproc_end - xproc +; +; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 +; +idbio: +; + ; Check for UNA (UBIOS) + ld a,($FFFD) ; fixed location of UNA API vector + cp $C3 ; jp instruction? + jr nz,idbio1 ; if not, not UNA + ld hl,($FFFE) ; get jp address + ld a,(hl) ; get byte at target address + cp $FD ; first byte of UNA push ix instruction + jr nz,idbio1 ; if not, not UNA + inc hl ; point to next byte + ld a,(hl) ; get next byte + cp $E5 ; second byte of UNA push ix instruction + jr nz,idbio1 ; if not, not UNA, check others +; + ld bc,$04FA ; UNA: get BIOS date and version + rst 08 ; DE := ver, HL := date +; + ld a,2 ; UNA BIOS id = 2 + ret ; and done +; +idbio1: + ; Check for RomWBW (HBIOS) + ld hl,(HB_IDENT) ; HL := HBIOS ident location + ld a,'W' ; First byte of ident + cp (hl) ; Compare + jr nz,idbio2 ; Not HBIOS + inc hl ; Next byte of ident + ld a,~'W' ; Second byte of ident + cp (hl) ; Compare + jr nz,idbio2 ; Not HBIOS +; + ld b,BF_SYSVER ; HBIOS: VER function + ld c,0 ; required reserved value + rst 08 ; DE := version, L := platform id +; + ld a,1 ; HBIOS BIOS id = 1 + ret ; and done +; +idbio2: + ; No idea what this is + xor a ; Setup return value of 0 + ret ; and done +; +; Print character in A without destroying any registers +; +prtchr: + push bc ; save registers + push de + push hl + ld e,a ; character to print in E + ld b,BF_CIOOUT ; HBIOS function to output a character + ld c,CIO_CONSOLE ; write to current console unit + call HB_INVOKE ; invoke HBIOS via call + pop hl ; restore registers + pop de + pop bc + ret +; +prtdot: +; + ; shortcut to print a dot preserving all regs + push af ; save af + ld a,'.' ; load dot char + call prtchr ; print it + pop af ; restore af + ret ; done +; +prtspace: +; + ; shortcut to print a space preserving all regs + push af ; save af + ld a,' ' ; load dot char + call prtchr ; print it + pop af ; restore af + ret ; done +; +prtcr: +; + ; shortcut to print a dot preserving all regs + push af ; save af + ld a,13 ; load CR value + call prtchr ; print it + pop af ; restore af + ret ; done +; +; Print a zero terminated string at (DE) without destroying any registers +; +prtstr: + push de +; +prtstr1: + ld a,(de) ; get next char + or a + jr z,prtstr2 + call prtchr + inc de + jr prtstr1 +; +prtstr2: + pop de ; restore registers + ret +; +; Print a block of memory nicely formatted +; de=buffer address +; +dump_buffer: + call crlf + + push de + pop hl + inc d + inc d + +db_blkrd: + push bc + push hl + pop bc + call prthexword ; print start location + pop bc + call prtspace ; + ld c,16 ; set for 16 locs + push hl ; save starting hl +db_nxtone: + ld a,(hl) ; get byte + call prthex ; print it + call prtspace ; +db_updh: + inc hl ; point next + dec c ; dec. loc count + jr nz,db_nxtone ; if line not done + ; now print 'decoded' data to right of dump +db_pcrlf: + call prtspace ; space it + ld c,16 ; set for 16 chars + pop hl ; get back start +db_pcrlf0: + ld a,(hl) ; get byte + and 060h ; see if a 'dot' + ld a,(hl) ; o.k. to get + jr nz,db_pdot ; +db_dot: + ld a,2eh ; load a dot +db_pdot: + call prtchr ; print it + inc hl ; + ld a,d ; + cp h ; + jr nz,db_updh1 ; + ld a,e ; + cp l ; + jp z,db_end ; +db_updh1: +; if block not dumped, do next character or line + dec c ; dec. char count + jr nz,db_pcrlf0 ; do next +db_contd: + call crlf ; + jp db_blkrd ; + +db_end: + ret +; +; Print the value in A in hex without destroying any registers +; +prthex: + push af ; save AF + push de ; save DE + call hexascii ; convert value in A to hex chars in DE + ld a,d ; get the high order hex char + call prtchr ; print it + ld a,e ; get the low order hex char + call prtchr ; print it + pop de ; restore DE + pop af ; restore AF + ret ; done +; +; print the hex word value in bc +; +prthexword: + push af + ld a,b + call prthex + ld a,c + call prthex + pop af + ret +; +; print the hex dword value in de:hl +; +prthex32: + push bc + push de + pop bc + call prthexword + push hl + pop bc + call prthexword + pop bc + ret +; +; Convert binary value in A to ascii hex characters in DE +; +hexascii: + ld d,a ; save A in D + call hexconv ; convert low nibble of A to hex + ld e,a ; save it in E + ld a,d ; get original value back + rlca ; rotate high order nibble to low bits + rlca + rlca + rlca + call hexconv ; convert nibble + ld d,a ; save it in D + ret ; done +; +; Convert low nibble of A to ascii hex +; +hexconv: + and $0F ; low nibble only + add a,$90 + daa + adc a,$40 + daa + ret +; +; Print value of A or HL in decimal with leading zero suppression +; Use prtdecb for A or prtdecw for HL +; +prtdecb: + push hl + ld h,0 + ld l,a + call prtdecw ; print it + pop hl + ret +; +prtdecw: + push af + push bc + push de + push hl + call prtdec0 + pop hl + pop de + pop bc + pop af + ret +; +prtdec0: + ld e,'0' + ld bc,-10000 + call prtdec1 + ld bc,-1000 + call prtdec1 + ld bc,-100 + call prtdec1 + ld c,-10 + call prtdec1 + ld e,0 + ld c,-1 +prtdec1: + ld a,'0' - 1 +prtdec2: + inc a + add hl,bc + jr c,prtdec2 + sbc hl,bc + cp e + ret z + ld e,0 + call prtchr + ret +; +; Start a new line +; +crlf2: + call crlf ; two of them +crlf: + push af ; preserve AF + ld a,13 ; + call prtchr ; print it + ld a,10 ; + call prtchr ; print it + pop af ; restore AF + ret +; +; Get the next non-blank character from (HL). +; +nonblank: + ld a,(hl) ; load next character + or a ; string ends with a null + ret z ; if null, return pointing to null + cp ' ' ; check for blank + ret nz ; return if not blank + inc hl ; if blank, increment character pointer + jr nonblank ; and loop +; +; Convert character in A to uppercase +; +ucase: + cp 'a' ; if below 'a' + ret c ; ... do nothing and return + cp 'z' + 1 ; if above 'z' + ret nc ; ... do nothing and return + res 5,a ; clear bit 5 to make lower case -> upper case + ret ; and return +; +; Add the value in A to HL (HL := HL + A) +; +addhl: + add a,l ; A := A + L + ld l,a ; Put result back in L + ret nc ; if no carry, we are done + inc h ; if carry, increment H + ret ; and return +; +; Jump indirect to address in HL +; +jphl: + jp (hl) +; +; Errors +; +erruse: ; command usage error (syntax) + ld de,msguse + jr err +; +errprm: ; command parameter error (syntax) + ld de,msgprm + jr err +; +errbio: ; invalid BIOS or version + ld de,msgbio + jr err +; +err: ; print error string and return error signal + call crlf2 ; print newline +; +err1: ; without the leading crlf + call prtstr ; print error string +; +err2: ; without the string +; call crlf ; print newline + or $FF ; signal error + ret ; done +; +;=============================================================================== +; Storage Section +;=============================================================================== +; +orgbnk .db 0 ; original bank id at startup +; +stksav .dw 0 ; stack pointer saved at start + .fill stksiz,0 ; stack +stack .equ $ ; stack top +; +; Messages +; +msgban .db "BANKTEST v1.0, 22-Jan-2023",13,10 + .db "Copyright (C) 2023, Wayne Warthen, GNU GPL v3",0 +msguse .db "Usage: BANKTEST",13,10 +msgprm .db "Parameter error (BANKTEST /? for usage)",0 +msgbio .db "Incompatible BIOS or version, " + .db "HBIOS v", '0' + rmj, ".", '0' + rmn, " required",0 +msgcur .db "Initial Bank ID = 0x",0 +msg80 .db "Hello from bank 0x80!",0 +msgxcal .db "Inter-bank procedure call test...",0 +msgdone .db "End of bank test",0 +; +; +; +size .equ $ - runloc +; + .end diff --git a/Source/Apps/Test/inttest/Build.cmd b/Source/Apps/Test/inttest/Build.cmd new file mode 100644 index 00000000..e26d9b73 --- /dev/null +++ b/Source/Apps/Test/inttest/Build.cmd @@ -0,0 +1,11 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF inttest.asm inttest.com inttest.lst || exit /b + +copy /Y inttest.com ..\..\..\..\Binary\Apps\Test\ || exit /b + diff --git a/Source/Apps/Test/inttest/Clean.cmd b/Source/Apps/Test/inttest/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/inttest/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/inttest/Makefile b/Source/Apps/Test/inttest/Makefile new file mode 100644 index 00000000..04222fbd --- /dev/null +++ b/Source/Apps/Test/inttest/Makefile @@ -0,0 +1,7 @@ +OBJECTS = inttest.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/IntTest.asm b/Source/Apps/Test/inttest/inttest.asm similarity index 100% rename from Source/Apps/IntTest.asm rename to Source/Apps/Test/inttest/inttest.asm diff --git a/Source/Apps/Test/kbdtest/Build.cmd b/Source/Apps/Test/kbdtest/Build.cmd new file mode 100644 index 00000000..5ae6b746 --- /dev/null +++ b/Source/Apps/Test/kbdtest/Build.cmd @@ -0,0 +1,11 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF kbdtest.asm kbdtest.com kbdtest.lst || exit /b + +copy /Y kbdtest.com ..\..\..\..\Binary\Apps\Test\ || exit /b + diff --git a/Source/Apps/Test/kbdtest/Clean.cmd b/Source/Apps/Test/kbdtest/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/kbdtest/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/kbdtest/Makefile b/Source/Apps/Test/kbdtest/Makefile new file mode 100644 index 00000000..f83c46d4 --- /dev/null +++ b/Source/Apps/Test/kbdtest/Makefile @@ -0,0 +1,7 @@ +OBJECTS = kbdtest.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/Test/kbdtest/kbdtest.asm b/Source/Apps/Test/kbdtest/kbdtest.asm new file mode 100644 index 00000000..e32aec3b --- /dev/null +++ b/Source/Apps/Test/kbdtest/kbdtest.asm @@ -0,0 +1,377 @@ +; +; Test program for Z80 KBDMSE on Retrobrewcomputer.org (Load with CPM). +; +; V0.1 ;Original version 2/23/2014 by John Monahan +; V0.2 ;Update for Z80 KBDMSE with VT82C42 PS/2 Keyboard Controller by Andrew Lynch +; +; Based on works by John Monahan S100Computers.com +; for S100 MSDOS Support Board with HT6542B Keyboard Controller +; Thanks to John for generously posting this program for others to use and adapt +; +; This is a simple test program to work with the Z80 KBDMSE board. It is written so +; the only other hardware use is the CP/M Console Port -- typically serial port interface. +; Note the data is displayed in crude (bulk) form. A proper scancode to ASCII translation +; routine must be written for practical use. See the IBM PC BIOS or SKEY.Z80 docs + + + +; PORT ASSIGNMENTS + +KEY_DATA .EQU 0E2H ;Port used to access keyboard & Mouse (also sometimes Controller itself) +KEY_CTRL .EQU 0E3H ;Port for VT82C42 PS/2 Keyboard & Mouse Controller + +ESC .EQU 1BH +CR .EQU 0DH +LF .EQU 0AH +TAB .EQU 09H +BELL .EQU 07H + + .ORG 0100H +START: + LD SP,STACK + + LD HL,SIGNON ; Signon + CALL PRINT_STRING + + LD C,0AAH ;Test PS/2 Controller + CALL CMD_OUT +CHK1: + CALL KEY_IN_STATUS ;wait for feedback + JR Z,CHK1 + IN A,(KEY_DATA) + CP 055H ;If not 55H then error + JR NZ,INIT_ERR + LD C,060H ; Set keyboard controller cmd byte + CALL CMD_OUT + LD C,$60 ; XLAT ENABLED, MOUSE DISABLED, NO INTS + CALL KEY_OUT + LD C,0AEH ;Enable 1st PS/2 port + CALL CMD_OUT ;Send it + JR DONE_INIT + +INIT_ERR: + LD HL,INIT_ERR_STR ;Say error + CALL PRINT_STRING + HALT ;Just Halt! + +DONE_INIT: + LD HL,INIT_OK ;Say all OK + CALL PRINT_STRING + +LOOP: + CALL KEY_IN_STATUS ;See if keyboard key available + JR Z,LOOP + IN A,(KEY_DATA) + LD C,A ;Store in [C] + LD HL,SCAN_MSG + CALL PRINT_STRING ;No registers changed + + CALL A_HEXOUT ;Display Hex value of typed character + two spaces + + ;CP 0F0H ;Is it an UP key + AND 080H ;Is it an UP key + JR Z,DOWNKY ;Must be a down key stroke + LD HL,UPKEY_MSG ;Say Up Key + CALL PRINT_STRING + CALL ZCRLF + JR LOOP + +DOWNKY: + CP 58H ;Is it CAPS Lock key +; CP 3AH ;Is it CAPS Lock key + JR NZ,NOT_CAPSKEY + LD HL,CAPS_MSG ;Say Caps lock key + CALL PRINT_STRING + CALL ZCRLF + JR LOOP + +NOT_CAPSKEY: + CP 12H ;Is it a SHIFT key +; CP 2AH ;Is it a SHIFT key + JR Z,SHIFTKEY + CP 59H ;Is it the other SHIFT key +; CP 36H ;Is it the other SHIFT key + JR NZ,NOT_SHIFTKEY + +SHIFTKEY: + LD HL,SHIFT_MSG ;Say Shift key + CALL PRINT_STRING + CALL ZCRLF + JR LOOP + +NOT_SHIFTKEY: + CP 14H ;Is it the CTRL key +; CP 1DH ;Is it the CTRL key + JR NZ,NOT_CTRLKEY + LD HL,CTRL_MSG ;Say CTRL key + CALL PRINT_STRING + CALL ZCRLF + JR LOOP + +NOT_CTRLKEY: + CP 77H ;Is it the NUM LOCK key +; CP 45H ;Is it the NUM LOCK key + JR NZ,NOT_NUMKEY + LD HL,NUM_MSG ;Say Number key + CALL PRINT_STRING + CALL ZCRLF + JR LOOP + +NOT_NUMKEY: + PUSH BC ;Save Character + LD HL,IBM1_MSG ;Say Table 1 lookup + CALL PRINT_STRING + LD HL,IBM1TBL ;Point to lookup table for upper case + CALL SHOW_CHAR + + POP BC ;Get back character + LD HL,IBM2_MSG ;Say Table 2 lookup + CALL PRINT_STRING + LD HL,IBM2TBL ;Point to lookup table for upper case + CALL SHOW_CHAR + + CALL ZCRLF + JR LOOP + +SHOW_CHAR: + LD D,0 + LD E,C + ADD HL,DE ;Add in offset + LD C,(HL) + LD A,C + CP ESC + RET Z ;ESC messes up the screen display + CP CR + RET Z ;CR messes up the screen display + CP LF + RET Z ;LF messes up the screen display + CP TAB + RET Z ;TAB messes up the screen display + CALL ZCO ;Display on Screen + RET + +KEY_IN_STATUS: ;Ret NZ if character is available + IN A,(KEY_CTRL) + AND 1 + RET ;Ret NZ if character available + +CMD_OUT: ;Send a byte (in [C]) to Control port + IN A,(KEY_CTRL) + AND 2 + JR NZ,CMD_OUT ;Chip is not ready yet to receive character + LD A,C + OUT (KEY_CTRL),A + RET + +KEY_OUT: ;Send a byte (in [C]) to Data port + IN A,(KEY_CTRL) + AND 2 + JR NZ,KEY_OUT ;Chip is not ready yet to receive character + LD A,C + OUT (KEY_DATA),A + RET + + +; A_HEXOUT ;output the 2 hex digits in [A] +A_HEXOUT: ;No registers altered + push AF + push BC + push AF + srl a + srl a + srl a + srl a + call hexdigout + pop AF + call hexdigout ;get upper nibble + LD C,' ' + call ZCO ;Space for easy reading + call ZCO + pop BC + pop AF + ret + +hexdigout: + and 0fh ;convert nibble to ascii + add a,90h + daa + adc a,40h + daa + LD c,a + call ZCO + ret + +; Main console I/O routines +; + +ZCO: + PUSH HL + LD E,C + LD C,02H ;BDOS Function 2 Write Console Byte + CALL 0005H ;Call BDOS + POP HL + RET + +ZCI: + LD C,0BH ;BDOS Function 11 Read Console Status + CALL 0005H ;Call BDOS + JP Z,ZCI + LD C,01H ;BDOS Function 1 Read Console Byte + CALL 0005H ;Call BDOS + RET +; +; Send CR/LF to Console +; +ZCRLF: + PUSH AF + PUSH BC + LD C,CR + CALL ZCO + LD C,LF + CALL ZCO + POP BC + POP AF + RET + + +PRINT_STRING: + PUSH AF + push BC +print1: + LD a,(HL) ;Point to start of string + inc HL ;By using the CS over-ride we will always have + CP '$' ;a valid pointer to messages at the end of this monitor + JP z,print2 + CP 0 ;Also terminate with 0's + JP Z,print2 + LD C,A + call ZCO + jp print1 +print2: + pop BC + POP AF + ret + +;--------------------------------------------------------------------------------------------------- +; Black: ESC,[30m +; Red: ESC,[31m +; Green: ESC,[32m +; Yellow: ESC,[33m +; Blue: ESC,[34m +; Magenta: ESC,[35m +; Cyan: ESC,[36m +; White: ESC,[37m +; Reset: ESC,[0m + +SIGNON: + .DB CR,LF,LF + .DB ESC,"[33m","Test VT82C42 PC Keyboard & Mouse controller chip on Z80 KBDMSE Board." ; Yellow + .DB CR,LF,"$" +INIT_ERR_STR: + .DB CR,LF,BELL + .DB ESC,"[31m","Error: The 0xAA Test of Controller did nor return 0x55. Program Halted." ; Red + .DB CR,LF,"$" +INIT_OK: + .DB CR,LF + .DB ESC,"[32m","The 0xAA Test of Controller returned 0x55. Now enter keyboard keys." ; Green + .DB CR,LF,LF,"$" + +SCAN_MSG: + .DB ESC,"[34m","Scancode = $" ; Blue +UPKEY_MSG: + .DB "(Up Keystroke)$" +CAPS_MSG: + .DB "(Caps Lock)$" +SHIFT_MSG: + .DB "(Shift Key)$" +CTRL_MSG: + .DB "(CTRL Key)$" +NUM_MSG: + .DB "(NUM Key)$" +IBM1_MSG: + .DB ESC,"[36m","Table 1 lookup -> $" ; Cyan +IBM2_MSG: + .DB ESC,"[37m"," Table 2 lookup -> $" ; White + + +IBM1TBL: ;The "Normal" table + ;00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f +; .DB 0,"*", 0,"*","*","*","*","*", 0,"*","*","*","*",09H,"`",00H + .DB 000,027,"1","2","3","4","5","6","7","8","9","0","-","=",008,009 ;00-0F + + ;10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1f +; .DB 0, 0, 0, 0, 0,"q","1", 0, 0, 0,"z","s","a","w","2",0 + .DB "q","w","e","r","t","y","u","i","o","p","[","]",013,000,"a","s" ;10-1F + + ;20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2a, 2b, 2c, 2d, 2e, 2f +; .DB 0,"c","x","d","e","4","3", 0, 0," ","v","f","t","r","5",0 + .DB "d","f","g","h","j","k","l",";",27H,60H,000,092,"z","x","c","v" ;20-2F + + ;30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 3a, 3b, 3c, 3d, 3e, 3f +; .DB 0,"n","b","h","g","y","6", 0, 0, 0,"m","j","u","7","8",0 + .DB "b","n","m",",",".","/",000,000,000," ",000,000,000,000,000,000 ;30-3F + + ;40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 4a, 4b, 4c, 4d, 4e, 4f +; .DB 0,",","k","i","o","0","9", 0, 0,".","/","l",";","p","-",0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;40-4F + + ;50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 5a, 5b, 5c, 5d, 5e, 5f +; .DB 0, 0,27H, 0,"[","=", 0, 0, 0, 0,0DH,"]", 0,5CH, 0,0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;50-5F + + ;60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 6a, 6b, 6c, 6d, 6e, 6f +; .DB 0, 0, 0, 0, 0, 0,08H, 0, 0,11H, 0,13H,10H, 0, 0, 0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;60-6F + + ;70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 7a, 7b, 7c, 7d, 7e, 7f +; .DB 0BH,7FH,03H,15H,04H,05H,1BH,00H,"*",02H,18H,16H,0CH,17H,"*",0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;70-7F + + ;80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 8a, 8b, 8c, 8d, 8e, 8f +; .DB 0, 0, 0,"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;80-8F + + +IBM2TBL: ;If the SHIFT key or CAPS lock key is on + ;00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f +; .DB 0, "*", 0,"*","*","*","*","*", 0,"*","*","*","*",09H,"~",00H + .DB 000,027,"!","@","#","$","%","^","&","*","(",")","_","+",008,009 ;00-0F + + ;10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1f +; .DB 0, 0, 0, 0, 0,"Q","!", 0, 0, 0,"Z","S","A","W","@",0 + .DB "Q","W","E","R","T","Y","U","I","O","P","{","}",013,000,"A","S" ;10-1F + + ;20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2a, 2b, 2c, 2d, 2e, 2f +; .DB 0,"C","X","D","E","$","#", 0, 0," ","V","F","T","R","%",0 + .DB "D","F","G","H","J","K","L",":",034,"~",000,"|","Z","X","C","V" ;20-2F + + ;30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 3a, 3b, 3c, 3d, 3e, 3f +; .DB 0,"N","B","H","G","Y","^", 0, 0, 0,"M","J","U","&","*",0 + .DB "B","N","M","<",">","?",000,000,000," ",000,000,000,000,000,000 ;30-3F + + ;40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 4a, 4b, 4c, 4d, 4e, 4f +; .DB 0,"<","K","I","O",29H,"(", 0, 0,">","?","L",":","P", "_",0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;40-4F + + ;50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 5a, 5b, 5c, 5d, 5e, 5f +; .DB 0, 0,22H, 0,"{","+", 0, 0, 0, 0,0DH,"}", 0,"|", 0,0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;50-5F + + ;60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 6a, 6b, 6c, 6d, 6e, 6f +; .DB 0, 0, 0, 0, 0, 0,08H, 0, 0,11H, 0,13H,10H, 0, 0, 0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;60-6F + + ;70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 7a, 7b, 7c, 7d, 7e, 7f +; .DB 0BH,7FH,03H,15H,04H,05H,1BH,00H,"*",02H,18H,16H,0CH,17H,"*",0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;70-7F + + ;80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 8a, 8b, 8c, 8d, 8e, 8f +; .DB 0, 0, 0,"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;80-8F + + + .FILL 040H,000H +STACK: .DB 0H + .FILL 19,000H + +.END diff --git a/Source/Apps/Test/piomon/Build.cmd b/Source/Apps/Test/piomon/Build.cmd new file mode 100644 index 00000000..f0e405e1 --- /dev/null +++ b/Source/Apps/Test/piomon/Build.cmd @@ -0,0 +1,10 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF piomon.asm piomon.com piomon.lst || exit /b + +copy /Y piomon.com ..\..\..\..\Binary\Apps\Test\ || exit /b diff --git a/Source/Apps/Test/piomon/Clean.cmd b/Source/Apps/Test/piomon/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/piomon/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/piomon/Makefile b/Source/Apps/Test/piomon/Makefile new file mode 100644 index 00000000..d3054352 --- /dev/null +++ b/Source/Apps/Test/piomon/Makefile @@ -0,0 +1,7 @@ +OBJECTS = piomon.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/Test/piomon/Readme.txt b/Source/Apps/Test/piomon/Readme.txt new file mode 100644 index 00000000..ddf13f7a --- /dev/null +++ b/Source/Apps/Test/piomon/Readme.txt @@ -0,0 +1,36 @@ +PIOMON is a program to verify operation of the Z80 MBC DUALPIO board + +Most testing requires the use of loopback hardware constructed as: + +Channel A RDY STB D0 D1 D2 D3 D4 D5 D6 D7 + \ / | | | | | | | | + \ / | | | | | | | | + X | | | | | | | | + / \ | | | | | | | | + / \ | | | | | | | | +Channel B RDY STB D0 D1 D2 D3 D4 D5 D6 D7 + +The DUALPIO has, well, 2 PIO chips. Only one chip +is tested at a time. At startup, PIOMON will ask +you for the port of the chip to test. It defaults +to the standard port number for the primary PIO chip +on an MBC DUALPIO board. + +The port number specified is the base I/O port. Each +chip has two channels which are addressed in the +menu by specifying A or B. + +MBC DUALPIO Primary PIO = 0xB8 +MBC DUALPIO Secondary PIO = 0xBC + +If you try to use PIOMON without the RDY and STB +cross connected, you may have interrupt issues +because STB will be floating. + +N.B., V1 and V2 of the DUALPIO lack a hardware reset. The +PIO chips will reset at power-on, but they do not reset +when the reset button is pushed. + +Happy St. Patrick's Day!!! + +--WBW 7:42 PM 3/17/2022 \ No newline at end of file diff --git a/Source/Apps/Test/piomon/piomon.asm b/Source/Apps/Test/piomon/piomon.asm new file mode 100644 index 00000000..d7cdb71f --- /dev/null +++ b/Source/Apps/Test/piomon/piomon.asm @@ -0,0 +1,1361 @@ +; +;======================================================================= +; Zilog PIO Monitor & Hardware Testing Application +;======================================================================= +; +iodef .equ $B8 ; Default base I/O port address +; +; +; +; Port address offsets from base address +iodata .equ 0 ; Channel A Data +iodatb .equ 1 ; Channel B Data +ioctla .equ 2 ; Channel A Control +ioctlb .equ 3 ; Channel B Control +; +intveca .equ 0 ; Channel A interrupt vector +intvecb .equ 1 ; Channel B interrupt vector +; +iocmd .equ $E3 ; PS/2 controller command port address +iodat .equ $E2 ; PS/2 controller data port address +; +cpumhz .equ 8 ; for time delay calculations (not critical) +; +; General operational equates (should not requre adjustment) +; +stksiz .equ $40 ; Working stack size +buflen .equ $80 ; Command buffer length +; +ltimout .equ 0 ; 256*10ms = 2.56s +stimout .equ 10 ; 10*10ms = 100ms +; +restart .equ $0000 ; CP/M restart vector +bdos .equ $0005 ; BDOS invocation vector +; +bf_sysint .equ $FC ; INT function +; +bf_sysintinfo .equ $00 ; INT INFO subfunction +bf_sysintget .equ $10 ; INT GET subfunction +bf_sysintset .equ $20 ; INT SET subfunction +; +bel .equ 7 ; ASCII bell +bs .equ 8 ; ASCII backspace +lf .equ 10 ; ASCII linefeed +cr .equ 13 ; ASCII carriage return +; +;======================================================================= +; + .org $100 ; standard CP/M executable +; +; + ; setup stack (save old value) + ld (stksav),sp ; save stack + ld sp,stack ; set new stack +; + call nl + ld hl,str_banner ; banner + call pstr +; +getport1: + ld hl,str_port1 + call pstr + ld a,(iobase) + call prthexbyte + ld hl,str_port2 + call pstr + call rdln + ld ix,cmdbuf + call skipws + or a + jr z,getport2 + call ishex + jr nz,getport1 + call gethex ; get port value + jp c,getport1 ; handle overflow + ld (iobase),a ; save value +; +getport2: + call init +; + call main ; do the real work +; +exit: + call deinit +; + call nl2 + ld hl,str_exit + call pstr +; + ; clean up and return to command processor + call nl ; formatting + ld sp,(stksav) ; restore stack + jp restart ; return to CP/M via restart +; +;======================================================================= +; Initialize +;======================================================================= +; +init: + ; Install interrupt handler in upper mem + ld hl,reladr + ld de,$A000 + ld bc,hsiz + ldir +; + ; Install interrupt vectors (RomWBW specific!!!) + ld hl,inta ; pointer to my interrupt handler + ld b,bf_sysint + ld c,bf_sysintset ; set new vector + ld e,intveca ; vector idx + di + rst 08 ; do it + ld (orgveca),hl ; save the original vector + ei ; interrupts back on + ld hl,intb ; pointer to my interrupt handler + ld b,bf_sysint + ld c,bf_sysintset ; set new vector + ld e,intvecb ; vector idx + di + rst 08 ; do it + ld (orgvecb),hl ; save the original vector + ei ; interrupts back on +; + ; Load the interrupt vectors + ld a,(iobase) + add a,ioctla + ld c,a + ld a,intveca * 2 + out (c),a + ld a,(iobase) + add a,ioctlb + ld c,a + ld a,intvecb * 2 + out (c),a +; + ; Set the interrupt control words + ld a,(iobase) + add a,ioctla + ld c,a + ld a,%10000111 + out (c),a ; int enab, no mask follows + ;ld a,%11111111 + ;out (ioctla),a ; no ints in control mode + ld a,(iobase) + add a,ioctlb + ld c,a + ld a,%10000111 + out (c),a ; int enab, no mask follows + ;ld a,%11111111 + ;out (ioctlb),a ; no ints in control mode +; + ret +; +deinit: + call reset +; + ld a,(iobase) + add a,ioctla + ld c,a + ld a,%00010111 ; clear interrupt ctl word + out (c),a + ld a,%11111111 ; clear mask + out (c),a + ld a,%00000000 ; clear interrupt vector + out (c),a +; + ld a,(iobase) + add a,ioctlb + ld c,a + ld a,%00010111 ; clear interrupt ctl word + out (c),a + ld a,%11111111 ; clear mask + out (c),a + ld a,%00000000 ; clear interrupt vector + out (c),a +; + ; Deinstall interrupt vectors + ld hl,(orgveca) ; original vector + ld b,bf_sysint + ld c,bf_sysintset ; set new vector + ld e,intveca ; vector idx + di + rst 08 ; do it + ei ; interrupts back on + ld hl,(orgvecb) ; original vector + ld b,bf_sysint + ld c,bf_sysintset ; set new vector + ld e,intvecb ; vector idx + di + rst 08 ; do it + ei ; interrupts back on + ret +; +;======================================================================= +; Main Program +;======================================================================= +; +main: + ; Prompt + call nl2 + ld hl,str_pre + call pstr + ld a,(iobase) + call prthexbyte +; + ld hl,str_int1 + call pstr + ld hl,(intcnta) + call prtdec + ld hl,str_int2 + call pstr + ld hl,(intcntb) + call prtdec +; + ld hl,str_pre2 + call pstr +; + ; Read command line + call rdln + ld ix,cmdbuf +; +main1: + ;;;; Upper case the entire command line + ;;;ld a,(ix) + ;;;or a + ;;;jr z,main2 + ;;;call upcase + ;;;ld (ix),a + ;;;inc ix + ;;;jr main1 +; +main2: + ld ix,cmdbuf + call skipws + or a ; check for eol + call nz,runcmd ; run command if not eol + jr main ; loop +; +; Run the command line pointed to by IX +; +runcmd: + ld ix,cmdbuf ; point to cmd line + call skipws + or a ; check for eol + ret z ; return if nothing there +; + ld a,(ix) ; get character +; + ; Dispatch + cp '?' ; Help + jp z,help + cp 'H' ; Help + jp z,help + cp 'X' ; Exit + jp z,exit + cp 'P' ; PIO Base Port + jp z,setport + cp 'Z' ; Reset Chip + jp z,reschip + cp 'W' ; Watch pins + jp z,watch + cp 'I' ; Input pins on channel + jp z,input + cp 'O' ; Output pins on channel + jp z,output + cp 'S' ; Send strobed byte to channel + jp z,send + cp 'R' ; Read strobed byte from channel + jp z,receive + cp 'T' ; Test + jp z,test + jp err_invcmd ; Invalid command +; +help: + ld hl,str_usage + call pstr + ret +; +setport: + call findws ; skip command + call skipws ; skip white space + call ishex ; do we have a number + jp nz,err_invcmd ; handle invalid command + call gethex + jp c,err_invcmd ; handle overflow error + push af + call deinit + pop af + ld (iobase),a ; set new port value + call init + ret ; and done +; +reschip: + ld hl,str_reschip1 + call pstr + call reset + ld hl,str_reschip2 + call pstr + ret +; +watch: + inc ix ; skip command byte + call getchan ; get channel + jp nz,err_invcmd ; handle invalid channel +; + ld hl,str_watch1 + call pstr + ld a,(channel) + add a,'A' + call cout + ld hl,str_watch2 + call pstr + call nl2 ; formatting + call ctlport ; set c to ctl port of channel + ld a,%11001111 ; bit control mode + out (c),a ; do it + ld a,%11111111 ; set all pins to input + out (c),a ; do it + call dataport ; set c to data port + ld a,0 + ld b,0 + jr watch2 +watch1: + call keychk ; key pressed? + ret nz ; return if so + in a,(c) ; read data port + cp b ; same as before + jr z,watch1 ; loop +watch2: + ld b,a ; save in B + ld hl,str_watchtag + call pstr + ld a,b ; restore value read + call prthexbyte ; print new value + jr watch1 +; +input: + inc ix ; skip command byte + call getchan ; get channel + jp nz,err_invcmd ; handle invalid channel +; + ld hl,str_input1 + call pstr + ld a,(channel) + add a,'A' + call cout + ld hl,str_input2 + call pstr + call ctlport ; set c to ctl port of channel + ld a,%11001111 ; bit control mode + out (c),a ; do it + ld a,%11111111 ; set all pins to input + out (c),a ; do it + call dataport ; set c to data port + in a,(c) + call prthexbyte + ret +; +output: + inc ix ; skip command byte + call getchan ; get channel + jp nz,err_invcmd ; handle invalid channel +; + call findws ; skip command + call skipws ; skip white space + call ishex ; do we have a number + jp nz,err_invcmd ; handle invalid command + call gethex + jp c,err_invcmd ; handle overflow error + push af +; + ld hl,str_output1 + call pstr + ld a,(channel) + add a,'A' + call cout + ld hl,str_output2 + call pstr + call ctlport ; set c to ctl port of channel + ld a,%11001111 ; bit control mode + out (c),a ; do it + ld a,%00000000 ; set all pins to output + out (c),a ; do it + call dataport ; set c to data port + pop af + out (c),a + call prthexbyte + ret +; +send: + inc ix ; skip command byte + call getchan ; get channel + jp nz,err_invcmd ; handle invalid channel +; + call findws ; skip command + call skipws ; skip white space + call ishex ; do we have a number + jp nz,err_invcmd ; handle invalid command + call gethex + jp c,err_invcmd ; handle overflow error + push af +; + ld hl,str_send1 + call pstr + ld a,(channel) + add a,'A' + call cout + ld hl,str_send2 + call pstr + call ctlport ; set c to ctl port of channel + ld a,%00001111 ; strobed output mode + out (c),a ; do it + call dataport ; set c to data port + pop af + out (c),a + call prthexbyte + ret +; +receive: + inc ix ; skip command byte + call getchan ; get channel + jp nz,err_invcmd ; handle invalid channel +; + ld hl,str_receive1 + call pstr + ld a,(channel) + add a,'A' + call cout + ld hl,str_receive2 + call pstr + call ctlport ; set c to ctl port of channel + ld a,%01001111 ; strobed input mode + out (c),a ; do it + call dataport ; set c to data port + in a,(c) + call prthexbyte + ret +; +test: + inc ix ; skip command byte + ld a,(ix) ; get character +; + ; Dispatch + cp 'R' + jp z,test_rdbk ; Readback Test + cp 'L' + jp z,test_lpbk ; Loopback Test + cp 'S' + jp z,test_stlp ; Strobed Loopback Test + jp err_invcmd + ret +; +test_rdbk: + inc ix ; skip command byte + call getchan ; get channel + jp nz,err_invcmd ; handle invalid channel +; + ld hl,str_rdbk + call pstr + ld a,(channel) + add a,'A' + call cout + call nl ; formatting + call ctlport ; set c to ctl port of channel + ld a,%00001111 ; mode 0 (output mode) + out (c),a ; do it + call dataport ; set c to data port +; + ld hl,vallist + ld b,vallen +test_rdbk0: + push hl + push bc + ld a,(hl) + call test_rdbk1 + pop bc + pop hl + jp nz,err_fail + inc hl + djnz test_rdbk0 + ret +; +test_rdbk1: + ld b,a + call nl + ld a,b + call prthexbyte + out (c),a + ld hl,str_arrow + call pstr + in a,(c) + call prthexbyte + cp b + ret +; +test_lpbk: + ld hl,str_lpbkAB + call pstr + ld a,(iobase) ; Test from A + add a,ioctla + ld d,a + ld a,(iobase) ; ... to B + add a,ioctlb + ld e,a + push de + call reset + call test_lpbk1 ; avoid output on both channels + pop de + jp nz,err_fail + ld hl,str_lpbkBA + call pstr + ld a,d ; switch direction + ld d,e + ld e,a + call reset ; avoid output on both channels + call test_lpbk1 + jp nz,err_fail + ret +; +test_lpbk1: + ; Setup output channel + ld c,d + ld a,%11001111 ; bit control mode + out (c),a ; do it + ld a,%00000000 ; set all pins to output + out (c),a ; do it +; + ; Setup input channel + ld c,e + ld a,%11001111 ; bit control mode + out (c),a ; do it + ld a,%11111111 ; set all pins to input + out (c),a ; do it +; + ; Loop through test values + dec d ; point to data port (output) + dec d + dec e ; point to data port (input) + dec e + ld hl,vallist + ld b,vallen +; +test_lpbk2: + call test_lpbk3 + ret nz + inc hl + djnz test_lpbk2 + ret +; +test_lpbk3: + call nl + ld c,d + ld a,(hl) + call prthexbyte + out (c),a + push hl + ld hl,str_arrow + call pstr + pop hl + ld c,e + in a,(c) + call prthexbyte + cp (hl) + ret +; +test_stlp: + ld hl,str_stlpAB + call pstr + ld a,(iobase) ; Test from A + add a,ioctla + ld d,a + ld a,(iobase) ; ... to B + add a,ioctlb + ld e,a + push de + call reset + call test_stlp1 ; avoid output on both channels + pop de + jp nz,err_fail + ld hl,str_stlpBA + call pstr + ld a,d ; switch direction + ld d,e + ld e,a + call reset ; avoid output on both channels + call test_stlp1 + jp nz,err_fail + ret +; +test_stlp1: + ; Setup output channel + ld c,d + ld a,%00001111 ; strobed output mode + out (c),a ; do it +; + ; Setup input channel + ld c,e + ld a,%01001111 ; strobed input mode + out (c),a ; do it +; + ; Loop through test values + dec d ; point to data port (output) + dec d + dec e ; point to data port (input) + dec e + ld hl,vallist + ld b,vallen +; +test_stlp2: + call test_stlp3 + ret nz + inc hl + djnz test_stlp2 + ret +; +test_stlp3: + call nl + ld c,d + ld a,(hl) + call prthexbyte + out (c),a + push hl + ld hl,str_arrow + call pstr + pop hl + ld c,e + in a,(c) + call prthexbyte + cp (hl) + ret +; +; +; +getchan: + ld a,(ix) ; get byte + sub 'A' ; convert to binary + cp 2 ; check for max value + ret nc ; return with NZ if too high + ld (channel),a ; save new value + cp a ; set ZF + ret ; done +; +; +; +reset: + ld a,(iobase) + add a,ioctla + ld c,a + call reset1 + ld a,(iobase) + add a,ioctlb + ld c,a + jr reset1 +; +reset1: + ld a,%01001111 ; set mode 1 (input) + out (c),a + ;ld a,%00010111 ; clear interrupt ctl word + ;out (c),a + ;ld a,%11111111 ; clear mask + ;out (c),a + ;ld a,%00000000 ; clear interrupt vector + ;out (c),a + ret +; +; +; +ctlport: + ld a,(iobase) ; base port + add a,ioctla ; offset to control ports + ld c,a ; put in c + ld a,(channel) ; get channel + add a,c ; combine + ld c,a + ret +; +; +; +dataport: + ld a,(iobase) ; base port + add a,iodata ; offset to data ports + ld c,a ; put in c + ld a,(channel) ; get channel + add a,c ; combine + ld c,a + ret +; +; Error Handlers +; +err_abort: + ld hl,str_err_abort + jr err_ret +err_invcmd: + ld hl,str_err_invcmd + jr err_ret +err_fail: + ld hl,str_err_fail + jr err_ret +; +err_ret: + push hl + ld hl,str_err_prefix + call pstr + pop hl + jp pstr +; +str_err_prefix .db bel,"\r\n\r\n*** ",0 +str_err_abort .db "User Aborted",0 +str_err_invcmd .db "Invalid command, press '?' for help",0 +str_err_fail .db "Test failed!",0 +; +;======================================================================= +; Utility functions +;======================================================================= +; +; Print string at HL on console, null terminated +; +pstr: + push af + push hl +pstr1: + ld a,(hl) ; get next character + or a ; set flags + inc hl ; bump pointer regardless + jr z,pstr2 ; done if null + call cout ; display character + jr pstr1 ; loop till done +pstr2: + pop hl + pop af + ret +; +; Print volume label string at HL, '$' terminated, 16 chars max +; +pvol: + ld b,16 ; init max char downcounter +pvol1: + ld a,(hl) ; get next character + cp '$' ; set flags + inc hl ; bump pointer regardless + ret z ; done if null + call cout ; display character + djnz pvol1 ; loop till done + ret ; hit max of 16 chars +; +; Start a newline on console (cr/lf) +; +nl2: + call nl ; double newline +nl: + ld a,cr ; cr + call cout ; send it + ld a,lf ; lf + jp cout ; send it and return +; +; Print a dot on console +; +pdot: + push af + ld a,'.' + call cout + pop af + ret +; +; +; +keychk: + call cst + or a + ret z + call cin + or $FF + ret +; +; Read a string on the console to cmdbuf +; +; Input is zero terminated +; +rdln: + ld de,cmdbuf ; init buffer address ptr +rdln_nxt: + call cin ; get a character + cp bs ; backspace? + jr z,rdln_bs ; handle it if so + cp cr ; return? + jr z,rdln_cr ; handle it if so +; + ; check for non-printing characters + cp ' ' ; first printable is space char + jr c,rdln_bel ; too low, beep and loop + cp '~'+1 ; last printable char + jr nc,rdln_bel ; too high, beep and loop +; + ; need to check for buffer overflow here!!! + ld hl,cmdbuf+buflen ; max cmd length + or a ; clear carry + sbc hl,de ; test for max + jr z,rdln_bel ; at max, beep and loop +; + ; good to go, echo and store character + call upcase + call cout ; echo character input + ld (de),a ; save in buffer + inc de ; inc buffer ptr + jr rdln_nxt ; loop till done +; +rdln_bs: + ld hl,cmdbuf ; start of buffer + or a ; clear carry + sbc hl,de ; subtract from cur buf ptr + jr z,rdln_bel ; at buf start, just beep + ld hl,str_bs ; backspace sequence + call pstr ; send it + dec de ; backup buffer pointer + jr rdln_nxt ; and loop +; +rdln_bel: + ld a,bel ; Bell characters + call cout ; send it + jr rdln_nxt ; and loop +; +rdln_cr: + xor a ; null to A + ld (de),a ; store terminator + ret ; and return +; +; Find next whitespace character at buffer adr in DE, returns with first +; whitespace character in A. +; +findws: + ld a,(ix) ; get next char + or a ; check for eol + ret z ; done if so + cp ' ' ; blank? + ret z ; nope, done + inc ix ; bump buffer pointer + jr findws ; and loop +; +; Skip whitespace at buffer adr in DE, returns with first +; non-whitespace character in A. +; +skipws: + ld a,(ix) ; get next char + or a ; check for eol + ret z ; done if so + cp ' ' ; blank? + ret nz ; nope, done + inc ix ; bump buffer pointer + jr skipws ; and loop +; +; Uppercase character in A +; +upcase: + cp 'a' ; below 'a'? + ret c ; if so, nothing to do + cp 'z'+1 ; above 'z'? + ret nc ; if so, nothing to do + and ~$20 ; convert character to lower + ret ; done +; +; Get numeric chars at IX and convert to number returned in A +; Carry flag set on overflow +; +getnum: + ld c,0 ; C is working register +getnum1: + ld a,(ix) ; get the active char + cp '0' ; compare to ascii '0' + jr c,getnum2 ; abort if below + cp '9' + 1 ; compare to ascii '9' + jr nc,getnum2 ; abort if above +; + ; valid digit, add new digit to C + ld a,c ; get working value to A + rlca ; multiply by 10 + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + add a,c ; ... + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + ld c,a ; back to C + ld a,(ix) ; get new digit + sub '0' ; make binary + add a,c ; add in working value + ret c ; overflow, return with carry set + ld c,a ; back to C +; + inc ix ; bump to next char + jr getnum1 ; loop +; +getnum2: ; return result + ld a,c ; return result in A + or a ; with flags set, CF is cleared + ret +; +; Get hex chars at IX and convert to binary number returned in A +; Carry flag set on overflow +; +gethex: + ld c,0 ; C is working register +gethex1: + ld a,(ix) ; get the active char + call ishex ; is it a hex char? + jr nz,gethex9 ; abort if not +; + ; valid digit, add new digit to C + ld a,c ; get working value to A + rlca ; multiply by 16 + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + ld c,a ; back to C + ld a,(ix) ; get new hex digit + call isnum ; regular number? + jr z,gethex2 ; if so, handle it, else hex char + sub 'A'-10 ; convert to binary + jr gethex3 ; and continue +gethex2: + sub '0' ; convert to binary +gethex3: + add a,c ; add in working value + ret c ; overflow, return with carry set + ld c,a ; back to C +; + inc ix ; bump to next char + jr gethex1 ; loop +; +gethex9: ; return result + ld a,c ; return result in A + or a ; with flags set, CF is cleared + ret +; +; Is character in A numberic? NZ if not +; +isnum: + cp '0' ; compare to ascii '0' + jr c,isnum1 ; abort if below + cp '9' + 1 ; compare to ascii '9' + jr nc,isnum1 ; abort if above + cp a ; set Z + ret +isnum1: + cp '0' ; set NZ w/o changing value + ret ; and done +; +; Is character in A hex? NZ if not +; +ishex: + call isnum ; is it a numeric? + ret z ; if so, all done + cp 'A' ; first hex char + jr c,ishex1 ; abort if below + cp 'F' + 1 ; last hex char + jr nc,ishex1 ; abort if above + cp a ; set Z + ret ; done +ishex1: + cp '0' ; set NZ w/o changing value + ret ; done +; +; Delay 16us (cpu speed compensated) incuding call/ret invocation +; Register A and flags destroyed +; No compensation for z180 memory wait states +; There is an overhead of 3ts per invocation +; Impact of overhead diminishes as cpu speed increases +; +; cpu scaler (cpuscl) = (cpuhmz - 2) for 16us + 3ts delay +; note: cpuscl must be >= 1! +; +; example: 8mhz cpu (delay goal is 16us) +; loop = ((6 * 16) - 5) = 91ts +; total cost = (91 + 40) = 131ts +; actual delay = (131 / 8) = 16.375us +; + ; --- total cost = (loop cost + 40) ts -----------------+ +delay: ; 17ts (from invoking call) | + ld a,(cpuscl) ; 13ts | +; | +delay1: ; | + ; --- loop = ((cpuscl * 16) - 5) ts ------------+ | + dec a ; 4ts | | + jr nz,delay1 ; 12ts (nz) / 7ts (z) | | + ; ----------------------------------------------+ | +; | + ret ; 10ts (return) | + ;-------------------------------------------------------+ +; +; Delay 16us * DE (cpu speed compensated) +; Register DE, A, and flags destroyed +; No compensation for z180 memory wait states +; There is a 27ts overhead for call/ret per invocation +; Impact of overhead diminishes as DE and/or cpu speed increases +; +; cpu scaler (cpuscl) = (cpuhmz - 2) for 16us outer loop cost +; note: cpuscl must be > 0! +; +; Example: 8MHz cpu, DE=6250 (delay goal is .1 sec or 100,000us) +; inner loop = ((16 * 6) - 5) = 91ts +; outer loop = ((91 + 37) * 6250) = 800,000ts +; actual delay = ((800,000 + 27) / 8) = 100,003us +; + ; --- total cost = (outer loop + 27) ts ------------------------+ +vdelay: ; 17ts (from invoking call) | +; | + ; --- outer loop = ((inner loop + 37) * de) ts ---------+ | + ld a,(cpuscl) ; 13ts | | +; | | +vdelay1: ; | | + ; --- inner loop = ((cpuscl * 16) - 5) ts ------+ | | + dec a ; 4ts | | | + jr nz,vdelay1 ; 12ts (nz) / 7ts (z) | | | + ; ----------------------------------------------+ | | +; | | + dec de ; 6ts | | + ld a,d ; 4ts | | + or e ; 4ts | | + jp nz,vdelay ; 10ts | | + ;-------------------------------------------------------+ | +; | + ret ; 10ts (final return) | + ;---------------------------------------------------------------+ +; +; Delay about 0.5 seconds +; 500000us / 16us = 31250 +; +ldelay: + push af + push de + ld de,31250 + call vdelay + pop de + pop af + ret +; +#if (cpumhz < 3) +cpuscl .db 1 ; cpu scaler must be > 0 +#else +cpuscl .db cpumhz - 2 ; otherwise 2 less than phi mhz +#endif +; +; Print value of a in decimal with leading zero suppression +; +prtdecb: + push hl + push af + ld l,a + ld h,0 + call prtdec + pop af + pop hl + ret +; +; Print value of HL in decimal with leading zero suppression +; +prtdec: + push bc + push de + push hl + ld e,'0' + ld bc,-10000 + call prtdec1 + ld bc,-1000 + call prtdec1 + ld bc,-100 + call prtdec1 + ld c,-10 + call prtdec1 + ld e,0 + ld c,-1 + call prtdec1 + pop hl + pop de + pop bc + ret +prtdec1: + ld a,'0' - 1 +prtdec2: + inc a + add hl,bc + jr c,prtdec2 + sbc hl,bc + cp e + jr z,prtdec3 + ld e,0 + call cout +prtdec3: + ret +; +; Short delay functions. No clock speed compensation, so they +; will run longer on slower systems. The number indicates the +; number of call/ret invocations. A single call/ret is +; 27 t-states on a z80, 25 t-states on a z180. +; +; ; z80 z180 +; ; ---- ---- +dly64: call dly32 ; 1728 1600 +dly32: call dly16 ; 864 800 +dly16: call dly8 ; 432 400 +dly8: call dly4 ; 216 200 +dly4: call dly2 ; 108 100 +dly2: call dly1 ; 54 50 +dly1: ret ; 27 25 +; +; Add hl,a +; +; A register is destroyed! +; +addhla: + add a,l + ld l,a + ret nc + inc h + ret +; +; +; +prtdot: + push af + ld a,'.' + call cout + pop af + ret +; +; Print the hex byte value in A +; +prthexbyte: + push af + push de + call hexascii + ld a,d + call cout + ld a,e + call cout + pop de + pop af + ret +; +; Print the hex word value in BC +; +prthexword: + push af + ld a,b + call prthexbyte + ld a,c + call prthexbyte + pop af + ret +; +; Print the hex dword value in DE:HL +; +prthex32: + push bc + push de + pop bc + call prthexword + push hl + pop bc + call prthexword + pop bc + ret +; +; Convert binary value in A to ASCII hex characters in DE +; +hexascii: + ld d,a + call hexconv + ld e,a + ld a,d + rlca + rlca + rlca + rlca + call hexconv + ld d,a + ret +; +; Convert low nibble of A to ASCII hex +; +hexconv: + and 0Fh ; low nibble only + add a,90h + daa + adc a,40h + daa + ret +; +; Output character from A +; +cout: + ; Save all incoming registers + push af + push bc + push de + push hl +; + ; Output character to console via BDOS + ld e,a ; output char to E + ld c,6 ; BDOS direct console I/O + call bdos ; output character +; + ; Restore all registers + pop hl + pop de + pop bc + pop af + ret +; +; Input character to A +; +cin: + ; Save incoming registers (AF is output) + push bc + push de + push hl +; + ; Input character from console via BDOS +cin1: + ld e,$FF ; input request + ld c,6 ; BDOS direct console I/O + call bdos ; input character to A + or a ; test for zero (no input) + jr z,cin1 ; loop till we have a char +; + ; Restore registers (AF is output) + pop hl + pop de + pop bc + ret +; +; Return input status in A (0 = no char, != 0 char waiting) +; +cst: + ; Save incoming registers (AF is output) + push bc + push de + push hl +; + ; Get console input status via BDOS + ld e,$FE ; status + ld c,6 ; BDOS direct console I/O + call bdos ; input status to A +; + ; Restore registers (AF is output) + pop hl + pop de + pop bc + ret +; +; +; +;======================================================================= +; Constants +;======================================================================= +; +str_banner .db "Zilog PIO Monitor v0.1, 14-Mar-2022\r\n" + .db "Press ? for help$" +str_bs .db bs,' ',bs,0 +str_port1 .db "\r\n\r\nEnter PIO port in hex [",0 +str_port2 .db "]:",0 +str_pre .db "Zilog PIO @ Port 0x",0 +str_pre2 .db "\r\n\r\n>",0 +str_exit .db "Done, Thank you for using Zilog PIO Monitor!",0 +str_reschip1 .db "\r\n\r\nFull Reset of PIO Chip... ",0 +str_reschip2 .db "Done",0 +str_int1 .db "\r\nChannel A Interrupts=",0 +str_int2 .db ", Channel B Interrupts=",0 +str_watch1 .db "\r\n\r\nWatching Channel ",0 +str_watch2 .db ", press any to end...",0 +str_watchtag .db "\rPort Value=0x",0 +str_input1 .db "\r\n\r\nValue of Pins on Channel ",0 +str_input2 .db " = 0x",0 +str_output1 .db "\r\n\r\nSetting Value of Pins on Channel ",0 +str_output2 .db " = 0x",0 +str_receive1 .db "\r\n\r\nReceived from Channel ",0 +str_receive2 .db " = 0x",0 +str_send1 .db "\r\n\r\nSent to Channel ",0 +str_send2 .db " = 0x",0 +str_rdbk .db "\r\n\r\nReadback Test on Channel ",0 +str_arrow .db " --> ",0 +str_lpbkAB .db "\r\n\r\nLoopback Test in Bit Control Mode A->B...\r\n",0 +str_lpbkBA .db "\r\n\r\nLoopback Test in Bit Control Mode B->A...\r\n",0 +str_stlpAB .db "\r\n\r\nLoopback Test in Strobed Mode A->B...\r\n",0 +str_stlpBA .db "\r\n\r\nLoopback Test in Strobed Mode B->A...\r\n",0 +str_usage .db "\r\n" + .db "\r\n P n - Set Current PIO Base Port" + .db "\r\n Z - Reset PIO (both channels)" + .db "\r\n Wc - Watch Channel c Pin Values (bit control)" + .db "\r\n Oc n - Output Channel c Pin Values (bit control)" + .db "\r\n Ic - Input Channel c Pin Values (bit control)" + .db "\r\n Sc n - Send Value to Channel c (strobed)" + .db "\r\n Rc - Receive Value from Channel c (strobed)" + .db "\r\n TRc - Test Readback on Channel c (bit control)" + .db "\r\n TL - Test Loopback (bit control)" + .db "\r\n TS - Test Loopback (strobed)" + .db "\r\n H,? - Help" + .db "\r\n X - Exit" + .db "\r\n " + .db "\r\n Loopback tests require hardware loopback (see readme.txt)" + .db 0 +; +;======================================================================= +; Working data +;======================================================================= +; +stksav .dw 0 ; stack pointer saved at start + .fill stksiz,0 ; stack +stack .equ $ ; stack top +; +iobase .db iodef ; current I/O base address +channel .db 0 ; current channel +wrkval .db 0 +; +cmdbuf .fill buflen+1,0 +; +vallist: + .db $00,$FF,$AA,$55,$A5,$5A,$FF,$00 +vallen .equ $ - vallist +; +orgveca .dw 0 ; saved int vector, channel A +orgvecb .dw 0 ; saved int vector, channel B +; +;=============================================================================== +; Interrupt Handler +;=============================================================================== +; +reladr .equ $ ; relocation start adr +; + .org $A000 ; code will run here +; +inta: +; + ld hl,(intcnta) + inc hl + ld (intcnta),hl +; + or $ff ; signal int handled + ret +; +intb: +; + ld hl,(intcntb) + inc hl + ld (intcntb),hl +; + or $ff ; signal int handled + ret +; +intcnta .dw 0 +intcntb .dw 0 +; +hsiz .equ $ - $A000 ; size of handler to relocate +; + .org reladr + hsiz +; + .end + \ No newline at end of file diff --git a/Source/Apps/Test/portscan/Build.cmd b/Source/Apps/Test/portscan/Build.cmd new file mode 100644 index 00000000..38027da2 --- /dev/null +++ b/Source/Apps/Test/portscan/Build.cmd @@ -0,0 +1,11 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF portscan.asm portscan.com portscan.lst || exit /b + +copy /Y portscan.com ..\..\..\..\Binary\Apps\Test\ || exit /b + diff --git a/Source/Apps/Test/portscan/Clean.cmd b/Source/Apps/Test/portscan/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/portscan/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/portscan/Makefile b/Source/Apps/Test/portscan/Makefile new file mode 100644 index 00000000..b1e9ee84 --- /dev/null +++ b/Source/Apps/Test/portscan/Makefile @@ -0,0 +1,9 @@ +OBJECTS = portscan.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc + +TASM=$(BINDIR)/uz80as -t hd64180 diff --git a/Source/Apps/Test/portscan/portscan.asm b/Source/Apps/Test/portscan/portscan.asm new file mode 100644 index 00000000..00953221 --- /dev/null +++ b/Source/Apps/Test/portscan/portscan.asm @@ -0,0 +1,602 @@ +;=============================================================================== +; PORTSCAN - Sweep Ports +; +;=============================================================================== +; +; Author: Wayne Warthen (wwarthen@gmail.com) +;_______________________________________________________________________________ +; +; Usage: +; PORTSCAN +; +; Operation: +; Reads all ports (multiple ways) and displays values read +;_______________________________________________________________________________ +; +; Change Log: +; 2023-02-14 [WBW] Initial release +;_______________________________________________________________________________ +; +; ToDo: +;_______________________________________________________________________________ +; +;=============================================================================== +; Definitions +;=============================================================================== +; +runloc .equ $C000 ; Running location (upper memory required) +stksiz .equ $40 ; Working stack size +; +restart .equ $0000 ; CP/M restart vector +; +; +#include "../../../ver.inc" +; +#include "../../../HBIOS/hbios.inc" +; +;=============================================================================== +; Code Section +;=============================================================================== +; + .org $100 +; + ; relocate worker code to upper memory + ld hl,begin ; start of working code image + ld de,runloc ; running location + ld bc,size ; size of working code image + ldir ; copy to upper RAM + jp runloc ; and go +; +; Start of working code +; +begin .equ $ ; image loaded here +; + .org runloc ; now generate running location adresses +; + ; setup stack (save old value) + ld (stksav),sp ; save stack + ld sp,stack ; set new stack +; + ; initialization + call init ; initialize + jr nz,exit ; abort if init fails +; + ; process + call process ; do main processing + jr nz,exit ; abort on error +; +exit: ; clean up and return to command processor + call crlf ; formatting + ld sp,(stksav) ; restore stack + ;jp restart ; return to CP/M via restart + ret ; return to CP/M w/o restart +; +; Initialization +; +init: + call crlf2 ; formatting + ld de,msgban ; point to version message part 1 + call prtstr ; print it +; + call idbio ; identify active BIOS + cp 1 ; check for HBIOS + jp nz,errbio ; handle BIOS error +; + ld a,rmj << 4 | rmn ; expected HBIOS ver + cp d ; compare with result above + jp nz,errbio ; handle BIOS error +; +initx + ; initialization complete + xor a ; signal success + ret ; return +; +; Process +; +process: + call crlf + ld a,($FFE0) ; get current hbios bank id + ld (orgbnk),a ; and save it + ld a,0 ; start with port 0 + ld (curport),a ; save it for use below + ; Test for z180 using mlt + ld de,$0506 ; 5 x 6 + mlt de ; de = 30 if z180 + ld a,e ; result to A + cp 30 ; check if multiply happened + jr nz,prtcpu ; if invalid, then Z80 + or $FF ; flag value for Z180 + ld (is180),a ; save it +; +prtcpu: + ld de,msgcpu + call prtstr + ld a,(is180) + or a + ld de,msgz80 + jr z,prtcpu1 + ld de,msgz180 +prtcpu1: + call prtstr + call crlf +; +loop: + call crlf + ld a,(curport) + call prthex + ld a,':' + call prtchr +; + di ; interrupts off +; + ld hl,vallist ; init value list pointer + call portread ; read the port + call portread ; do it again +; + ; restore possibly corrupted bank registers + ld a,(orgbnk) ; get proper bank id + call $FFF3 ; restore it +; + ei ; interrupts safe now +; + ld hl,vallist ; re-init value list pointer + ld b,4 ; print 4 values +prtloop: + ld a,' ' + call prtchr + ld a,(hl) + call prthex + inc hl + djnz prtloop +; + ; update port and loop as needed + ld a,(curport) ; get current port + inc a ; move to next + ld (curport),a ; save it + jr z,done ; done on wraparound + jr loop ; loop until done +; +done: +; + call crlf2 + ld de,msgdone ; message to print + call prtstr ; do it + ret ; all done +; +; +; +portread: + ld a,(is180) + or a + jr nz,portread_z180 +; +portread_z80: ; use traditional "IN" + ; read port using IN + ld a,(curport) ; get current port + ld (pnum0),a ; modify IN instruction + nop ; defeat Z280 pipeline + nop + in a,($FF) ; read the port +pnum0 .equ $-1 + ld (hl),a ; save it + inc hl ; bump value list pointer + jr portread1 +; +portread_z180: ; use "IN0" + ; read port using IN + ld a,(curport) ; get current port + ld (pnum1),a ; modify IN instruction + in0 a,($FF) ; read the port +pnum1 .equ $-1 + ld (hl),a ; save it + inc hl ; bump value list pointer +; +portread1: + ; read port using IN (C) + ld a,(curport) ; get current port + ld b,0 ; in case 16 bits decoded + ld c,a ; move to reg C + in a,(c) ; read the port + ld (hl),a ; save it + inc hl ; bump value list pointer + ret +; +; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 +; +idbio: +; + ; Check for UNA (UBIOS) + ld a,($FFFD) ; fixed location of UNA API vector + cp $C3 ; jp instruction? + jr nz,idbio1 ; if not, not UNA + ld hl,($FFFE) ; get jp address + ld a,(hl) ; get byte at target address + cp $FD ; first byte of UNA push ix instruction + jr nz,idbio1 ; if not, not UNA + inc hl ; point to next byte + ld a,(hl) ; get next byte + cp $E5 ; second byte of UNA push ix instruction + jr nz,idbio1 ; if not, not UNA, check others +; + ld bc,$04FA ; UNA: get BIOS date and version + rst 08 ; DE := ver, HL := date +; + ld a,2 ; UNA BIOS id = 2 + ret ; and done +; +idbio1: + ; Check for RomWBW (HBIOS) + ld hl,(HB_IDENT) ; HL := HBIOS ident location + ld a,'W' ; First byte of ident + cp (hl) ; Compare + jr nz,idbio2 ; Not HBIOS + inc hl ; Next byte of ident + ld a,~'W' ; Second byte of ident + cp (hl) ; Compare + jr nz,idbio2 ; Not HBIOS +; + ld b,BF_SYSVER ; HBIOS: VER function + ld c,0 ; required reserved value + rst 08 ; DE := version, L := platform id +; + ld a,1 ; HBIOS BIOS id = 1 + ret ; and done +; +idbio2: + ; No idea what this is + xor a ; Setup return value of 0 + ret ; and done +; +; Print character in A without destroying any registers +; +prtchr: + push bc ; save registers + push de + push hl + ld e,a ; character to print in E + ld b,BF_CIOOUT ; HBIOS function to output a character + ld c,CIO_CONSOLE ; write to current console unit + call HB_INVOKE ; invoke HBIOS via call + pop hl ; restore registers + pop de + pop bc + ret +; +prtdot: +; + ; shortcut to print a dot preserving all regs + push af ; save af + ld a,'.' ; load dot char + call prtchr ; print it + pop af ; restore af + ret ; done +; +prtspace: +; + ; shortcut to print a space preserving all regs + push af ; save af + ld a,' ' ; load dot char + call prtchr ; print it + pop af ; restore af + ret ; done +; +prtcr: +; + ; shortcut to print a dot preserving all regs + push af ; save af + ld a,13 ; load CR value + call prtchr ; print it + pop af ; restore af + ret ; done +; +; Print a zero terminated string at (DE) without destroying any registers +; +prtstr: + push de +; +prtstr1: + ld a,(de) ; get next char + or a + jr z,prtstr2 + call prtchr + inc de + jr prtstr1 +; +prtstr2: + pop de ; restore registers + ret +; +; Print a block of memory nicely formatted +; de=buffer address +; +dump_buffer: + call crlf + + push de + pop hl + inc d + inc d + +db_blkrd: + push bc + push hl + pop bc + call prthexword ; print start location + pop bc + call prtspace ; + ld c,16 ; set for 16 locs + push hl ; save starting hl +db_nxtone: + ld a,(hl) ; get byte + call prthex ; print it + call prtspace ; +db_updh: + inc hl ; point next + dec c ; dec. loc count + jr nz,db_nxtone ; if line not done + ; now print 'decoded' data to right of dump +db_pcrlf: + call prtspace ; space it + ld c,16 ; set for 16 chars + pop hl ; get back start +db_pcrlf0: + ld a,(hl) ; get byte + and 060h ; see if a 'dot' + ld a,(hl) ; o.k. to get + jr nz,db_pdot ; +db_dot: + ld a,2eh ; load a dot +db_pdot: + call prtchr ; print it + inc hl ; + ld a,d ; + cp h ; + jr nz,db_updh1 ; + ld a,e ; + cp l ; + jp z,db_end ; +db_updh1: +; if block not dumped, do next character or line + dec c ; dec. char count + jr nz,db_pcrlf0 ; do next +db_contd: + call crlf ; + jp db_blkrd ; + +db_end: + ret +; +; Print the value in A in hex without destroying any registers +; +prthex: + push af ; save AF + push de ; save DE + call hexascii ; convert value in A to hex chars in DE + ld a,d ; get the high order hex char + call prtchr ; print it + ld a,e ; get the low order hex char + call prtchr ; print it + pop de ; restore DE + pop af ; restore AF + ret ; done +; +; print the hex word value in bc +; +prthexword: + push af + ld a,b + call prthex + ld a,c + call prthex + pop af + ret +; +; print the hex dword value in de:hl +; +prthex32: + push bc + push de + pop bc + call prthexword + push hl + pop bc + call prthexword + pop bc + ret +; +; Convert binary value in A to ascii hex characters in DE +; +hexascii: + ld d,a ; save A in D + call hexconv ; convert low nibble of A to hex + ld e,a ; save it in E + ld a,d ; get original value back + rlca ; rotate high order nibble to low bits + rlca + rlca + rlca + call hexconv ; convert nibble + ld d,a ; save it in D + ret ; done +; +; Convert low nibble of A to ascii hex +; +hexconv: + and $0F ; low nibble only + add a,$90 + daa + adc a,$40 + daa + ret +; +; Print value of A or HL in decimal with leading zero suppression +; Use prtdecb for A or prtdecw for HL +; +prtdecb: + push hl + ld h,0 + ld l,a + call prtdecw ; print it + pop hl + ret +; +prtdecw: + push af + push bc + push de + push hl + call prtdec0 + pop hl + pop de + pop bc + pop af + ret +; +prtdec0: + ld e,'0' + ld bc,-10000 + call prtdec1 + ld bc,-1000 + call prtdec1 + ld bc,-100 + call prtdec1 + ld c,-10 + call prtdec1 + ld e,0 + ld c,-1 +prtdec1: + ld a,'0' - 1 +prtdec2: + inc a + add hl,bc + jr c,prtdec2 + sbc hl,bc + cp e + ret z + ld e,0 + call prtchr + ret +; +; Start a new line +; +crlf2: + call crlf ; two of them +crlf: + push af ; preserve AF + ld a,13 ; + call prtchr ; print it + ld a,10 ; + call prtchr ; print it + pop af ; restore AF + ret +; +; Get the next non-blank character from (HL). +; +nonblank: + ld a,(hl) ; load next character + or a ; string ends with a null + ret z ; if null, return pointing to null + cp ' ' ; check for blank + ret nz ; return if not blank + inc hl ; if blank, increment character pointer + jr nonblank ; and loop +; +; Convert character in A to uppercase +; +ucase: + cp 'a' ; if below 'a' + ret c ; ... do nothing and return + cp 'z' + 1 ; if above 'z' + ret nc ; ... do nothing and return + res 5,a ; clear bit 5 to make lower case -> upper case + ret ; and return +; +; Add the value in A to HL (HL := HL + A) +; +addhl: + add a,l ; A := A + L + ld l,a ; Put result back in L + ret nc ; if no carry, we are done + inc h ; if carry, increment H + ret ; and return +; +; Jump indirect to address in HL +; +jphl: + jp (hl) +; +; Short delay functions. No clock speed compensation, so they +; will run longer on slower systems. The number indicates the +; number of call/ret invocations. a single call/ret is +; 27 t-states on a z80, 25 t-states on a z180 +; +; ; Z80 Z180 +; ; ---- ---- +dly64: call dly32 ; 1728 1600 +dly32: call dly16 ; 864 800 +dly16: call dly8 ; 432 400 +dly8: call dly4 ; 216 200 +dly4: call dly2 ; 108 100 +dly2: call dly1 ; 54 50 +dly1: ret ; 27 25 + +; +; Errors +; +erruse: ; command usage error (syntax) + ld de,msguse + jr err +; +errprm: ; command parameter error (syntax) + ld de,msgprm + jr err +; +errbio: ; invalid BIOS or version + ld de,msgbio + jr err +; +err: ; print error string and return error signal + call crlf2 ; print newline +; +err1: ; without the leading crlf + call prtstr ; print error string +; +err2: ; without the string +; call crlf ; print newline + or $FF ; signal error + ret ; done +; +;=============================================================================== +; Storage Section +;=============================================================================== +; +is180 .db 0 ; non-zero for z180 +orgbnk .db 0 ; original bank id +curport .db 0 ; current port being processed +vallist .fill 8,0 ; port values read +; +stksav .dw 0 ; stack pointer saved at start + .fill stksiz,0 ; stack +stack .equ $ ; stack top +; +; Messages +; +msgban .db "PORTSCAN v1.0, 16-Feb-2023",13,10 + .db "Copyright (C) 2023, Wayne Warthen, GNU GPL v3",0 +msguse .db "Usage: PORTSCAN",13,10 +msgprm .db "Parameter error (PORTSCAN /? for usage)",0 +msgbio .db "Incompatible BIOS or version, " + .db "HBIOS v", '0' + rmj, ".", '0' + rmn, " required",0 +str_sep .db ": ",0 +; +msgcpu .db "CPU is ",0 +msgz80 .db "Z80",0 +msgz180 .db "Z180",0 +msgdone .db "End of Port Sweep",0 + +; +; +; +size .equ $ - runloc +; + .end diff --git a/Source/Apps/Test/ppidetst/Build.cmd b/Source/Apps/Test/ppidetst/Build.cmd new file mode 100644 index 00000000..5b7becb0 --- /dev/null +++ b/Source/Apps/Test/ppidetst/Build.cmd @@ -0,0 +1,11 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF ppidetst.asm ppidetst.com ppidetst.lst || exit /b + +copy /Y ppidetst.com ..\..\..\..\Binary\Apps\Test\ || exit /b + diff --git a/Source/Apps/Test/ppidetst/Clean.cmd b/Source/Apps/Test/ppidetst/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/ppidetst/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/ppidetst/Makefile b/Source/Apps/Test/ppidetst/Makefile new file mode 100644 index 00000000..74f9615f --- /dev/null +++ b/Source/Apps/Test/ppidetst/Makefile @@ -0,0 +1,7 @@ +OBJECTS = ppidetst.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/Test/ppidetst/ppidetst.asm b/Source/Apps/Test/ppidetst/ppidetst.asm new file mode 100644 index 00000000..85fcd3f5 --- /dev/null +++ b/Source/Apps/Test/ppidetst/ppidetst.asm @@ -0,0 +1,1371 @@ +; N8VEM PPI IDE test program for checkout of IDE drive connected to the 8255 PPI +; +; Written by Max Scane July 2009 +; Based on work by Paul Stoffregen (www.pjrc.com) +; +; Note: due to a known anomaly in the 8255, some signals ( all active low signals) on the IDE bus require an inverter (74LS04 or 74LS14) +; between the 8255 and the IDE drive. +; This is due to the 8255 returning all signals to 0 (low) when a mode change is performed (for read and write to IDE data bus). +; +; This test program will allow you to check out an attached IDE drive using the basic commands: +; +; u - Spin up the drive +; d - Spin down the drive +; s - Read and print out drive status +; i - Execute drive ID command and print result correctly +; r - Read the current LBA into the sector buffer and print status +; w - Write the sector buffer to the current LBA and print status +; l - Change the current LBA +; h - Dump the current sector buffer in hexdump format +; f - format drive for CP/M use (fill with 0xE5) +; e - Display drive error information +; x - Return to CP/M +; n - read and hexdump next LBA +; ? - Display command menu help +; p - set PPI port +; +; +; +; +; - Updated December 2014 MS - changed IO routines to support different PPI ports. +; - Updated July 2021 Andrew Lynch - Minor cosmetic updates + +;********************* HARDWARE IO ADR ************************************ + +DEFBASE: .EQU 60H ; PPI base I/O address default + +; +; Offsets to the various PPI registers + +IDELSB: .EQU 0 ; LSB +IDEMSB: .EQU 1 ; MSB +IDECTL: .EQU 2 ; Control Signals +PIOCONT: .EQU 3 ; CONTROL BYTE PIO 82C55 + +; PPI control bytes for read and write to IDE drive + +rd_ide_8255: .EQU 10010010b ; ide_8255_ctl out, ide_8255_lsb/msb input +wr_ide_8255: .EQU 10000000b ; all three ports output + +;IDE control lines for use with ide_8255_ctl. Change these 8 +;constants to reflect where each signal of the 8255 each of the +;IDE control signals is connected. All the control signals must +;be on the same port, but these 8 lines let you connect them to +;whichever pins on that port. + +ide_a0_line: .EQU 01H ; direct from 8255 to IDE interface +ide_a1_line: .EQU 02H ; direct from 8255 to IDE interface +ide_a2_line: .EQU 04H ; direct from 8255 to IDE interface +ide_cs0_line: .EQU 08H ; inverter between 8255 and IDE interface +ide_cs1_line: .EQU 10H ; inverter between 8255 and IDE interface +ide_wr_line: .EQU 20H ; inverter between 8255 and IDE interface +ide_rd_line: .EQU 40H ; inverter between 8255 and IDE interface +ide_rst_line: .EQU 80H ; inverter between 8255 and IDE interface + + +;------------------------------------------------------------------ +; More symbolic constants... these should not be changed, unless of +; course the IDE drive interface changes, perhaps when drives get +; to 128G and the PC industry will do yet another kludge. + +;some symbolic constants for the ide registers, which makes the +;code more readable than always specifying the address pins + +ide_data: .EQU ide_cs0_line +ide_err: .EQU ide_cs0_line + ide_a0_line +ide_sec_cnt: .EQU ide_cs0_line + ide_a1_line +ide_sector: .EQU ide_cs0_line + ide_a1_line + ide_a0_line +ide_cyl_lsb: .EQU ide_cs0_line + ide_a2_line +ide_cyl_msb: .EQU ide_cs0_line + ide_a2_line + ide_a0_line +ide_head: .EQU ide_cs0_line + ide_a2_line + ide_a1_line +ide_command: .EQU ide_cs0_line + ide_a2_line + ide_a1_line + ide_a0_line +ide_status: .EQU ide_cs0_line + ide_a2_line + ide_a1_line + ide_a0_line +ide_control: .EQU ide_cs1_line + ide_a2_line + ide_a1_line +ide_astatus: .EQU ide_cs1_line + ide_a2_line + ide_a1_line + ide_a0_line + +;IDE Command Constants. These should never change. +ide_cmd_recal: .EQU 10H +ide_cmd_read: .EQU 20H +ide_cmd_write: .EQU 30H +ide_cmd_init: .EQU 91H +ide_cmd_id: .EQU 0ECH +ide_cmd_spindown: .EQU 0E0H +ide_cmd_spinup: .EQU 0E1H + +CR: .EQU 0Dh +LF: .EQU 0Ah +BELL: .EQU 07H + + + .org 100H + +start: + +; save stack pointer so that we can return to calling program + + ld (savsp),sp + ld sp,stack + + call set_ppi_rd ; setup PPI chip to known state + + ld hl,lba1 ; zero LBA variables + call clrlba + + ld hl,lba2 + call clrlba + + ld hl,lba3 + call clrlba + + + call print + .db "PPI IDE test program v0.6b",CR,LF,0 + + call prport + call prstatus + call prlba + + call ide_init + call prstatus + + call crlf + +menu: + call print ; display prompt + .db "Enter command (u,d,s,i,r,w,l,h,f,e,n,p,?,x) > ",0 + + call cin ; get command from console in reg A + push af + call crlf + pop af + +mnu1: + cp 'd' ; spin down command + jr nz,mnu2 + call spindown + jr menu +mnu2: + cp 'u' ; spinup command + jr nz,mnu3 + call spinup + jr menu + +mnu3: + cp 's' ; print IDE status reg contents + jr nz,mnu4 + call prstatus + jr menu + +mnu4: + cp 'i' + jr nz,mnu5 ; drive ID command + call drive_id + jr menu + +mnu5: + cp 'r' + jr nz,mnu6 ; read command + call prlba ; print out the current LBA + call read_sector ; read current LBA + call prstatus + jr menu + +mnu6: + cp 'w' + jr nz,mnu7 ; write command + call prlba ; print out the current LBA + call write_sector ; write current LBA + call prstatus + jr menu + +mnu7: + cp 'l' + jr nz,mnu8 ; LBA command + call prlba ; print out the current LBA +mnu7a: + call print + .db "Enter new LBA: ",0 + + ld de,lba1 ; get LBA in lba1 + call getlba + jp nc,menu ; valid, finished + + call print + .db "Invalid LBA",CR,LF,0 + + jr mnu7a ; try again + + +mnu8: + cp 'h' + jr nz,mnu9 ; hexdump command + call hexdump ; hexdump the current sector buffer + jp menu + +mnu9: + cp 'f' + jr nz,mnua ; drive format + call format + jp menu + +mnua: + cp 'e' + jr nz,mnub ; get error register + call get_err + push af + call print + .db "Error register is: ",0 + + pop af + call prhex + call crlf + + + ld a,ide_head + call ide_read + ld a,c + call prhex + + ld a,ide_cyl_msb + call ide_read + ld a,c + call prhex + + ld a,ide_cyl_lsb + call ide_read + ld a,c + call prhex + + + ld a,ide_sector + call ide_read + ld a,c + call prhex + + call crlf + + ld a,ide_sec_cnt + call ide_read + ld a,c + call prhex + call crlf + + jp menu + + +mnub: + cp 'n' + jr nz,mnuc + ld hl,lba1 + call inclba + call prlba + call read_sector + call hexdump + jp menu + +mnuc: + cp 'p' + jr nz,mnux + call prport +mnuca: + call print + .db "Enter new PPI base port: ",0 + + ld a,(ppibase) + call gethexbyte + jr c,mnucb + ld (ppibase),a ; save it + call prport + jp menu + +mnucb: + call print + .db "Invalid PPI base port value",CR,LF,0 + jr mnuca + +mnux: + cp 'x' ; exit command + jp nz,mnuhlp + ld sp,(savsp) + ret + + +mnuhlp: + call print + .db "Commands available:",CR,LF,LF + .db "u - Spin Up drive",CR,LF + .db "d - Spin Down drive",CR,LF + .db "s - Print drive Status",CR,LF + .db "i - Query drive using ID command",CR,LF + .db "r - Read a sector addressed by the lba variable",CR,LF + .db "w - Write a sector adresses by the lba variable",CR,LF + .db "l - Change the current LBA variable",CR,LF + .db "h - Hexdump the current buffer",CR,LF + .db "f - Format the drive for CP/M use (fill with 0xE5)",CR,LF + .db "e - Display drive Error information",CR,LF + .db "p - Change base IO port",CR,LF + .db "? - Display command menu help",CR,LF + .db "x - eXit from this utility",CR,LF,LF,0 + jp menu + + +format: + call print + .db "Warning - this command will write data to the drive",CR,LF,LF + .db "All existing data will be over written",CR,LF,LF + .db "Is that what you want to do ? ",0 + + call cin ; get answer + cp 'y' + jr z,fmt1 ; if yes then continue + call print + .db " Command aborted",CR,LF,0 + ret + +fmt1: + ld a,0E5h + call fillbuf ; setup sector buffer +fmt2: + + call print + .db CR,LF,"Enter starting LBA: ",0 + + ld de,lba2 ; starting LBA + call getlba + jr nc,fmt3 + + call print + .db "Invalid LBA",CR,LF,0 + jr fmt2 ; try again + +fmt3: + + call crlf + +fmt4: + call print + .db "Enter ending LBA: ",0 + + ld de,lba3 ; ending LBA + call getlba + jr nc,fmt5 + + call print + .db "Invalid LBA",CR,LF,0 + + jr fmt4 ; try again + +fmt5: + call crlf + + call print ; say what is going to happen + .db "Format will start at LBA ",0 + + ld a,(lba2+3) + call prhex + ld a,(lba2+2) + call prhex + ld a,(lba2+1) + call prhex + ld a,(lba2) + call prhex + + call print + .db " and finish at LBA ",0 + ld a,(lba3+3) + call prhex + ld a,(lba3+2) + call prhex + ld a,(lba3+1) + call prhex + ld a,(lba3) + call prhex + + call crlf + call print + .db "Type y to continue or any other key to abort ",0 + + call cin + cp 'y' + jp nz,fmtx + call crlf + + ; add the actual format code here + ; get starting LBA + ; get ending LBA + ; fill buffer with E5 + + ld hl,lba2 + ld de,lba1 + call cpylba ; copy start LBA to LBA + call inclba + + +fmt6: + push hl + call print ; display progress + .db "Writing LBN: ",0 + ld a,(lba1+3) + call prhex + ld a,(lba1+2) + call prhex + ld a,(lba1+1) + call prhex + ld a,(lba1) + call prhex + ld a,CR + call cout + pop hl + +; do some stuff to format here + call write_sector + +; need to check status after each call and check for errors +; + ld hl,lba1 ; LBA for disk operation + call inclba + + ld hl,lba1 + ld de,lba3 + call cplba + + jp nz,fmt6 + + call crlf + +fmtx: + call print ; finished + .db "Format complete",CR,LF,0 + ret + + +getlba: ; get an LBA value from the console and validate it + push de ; save LBA variable + ld c,0ah ; bdos read console buffer + ld de,conbuf + call 5 ; get edited string + + call crlf + + ; ok we now have an ascii string representing the LBA. now we have to validate it + + pop de + ld hl,conbuf + inc hl + ld b,(hl) ; get character count +glba1: + inc hl ; HL = address of buffer + ld a,(hl) ; get next character + + call ishex + ret c ; return with carry set if any char is invalid + + ; ok we are here when we have a valid character (0-9,A-F,a-f) need to convert to binary + ; character is still in A + + cp 3AH ; test for 0-9 + jp m,glba4 + cp 47H ; test for A-F + jp m,glba3 + cp 67H ; test for a-f + jp m,glba2 + +glba2: + sub 20H ; character is a-f +glba3: + sub 07h ; character is A-F +glba4: + sub 030H ; character is 0-9 + + ld (hl),a ; save back in buffer as binary + djnz glba1 ; continue checking the buffer + +; need to pack bytes into the destination LBA which is in de and points to the LSB + +glba5: + +; - need to change the endian-ness + push de + ex de,hl ; clear LBA ready +; push de ; address of LBA +; pop hl ; address of input buffer + ld a,0 ; zero existing LBA variable + ld (hl),a + inc hl + ld (hl),a + inc hl + ld (hl),a + inc hl + ld (hl),a + + ex de,hl ; de now positioned at end of LBA + pop de ; restore LBA + ; de still contains dest address + ; now pack and store LBA + + ld hl,conbuf+1 ; get character count + ld b,(hl) + inc hl ; point to first character in buffer + +glba6: + push de ; save starting address for next subsequent rotations + ld a,(hl) ; get next char from buffer + inc hl ; next character + ex de,hl ; switch to LBA + rld ; shift nibble into LBA + inc hl + rld + inc hl + rld + inc hl + rld + ex de,hl ; back to console buffer + pop de ; restore address of LBA + djnz glba6 ; process next character + + scf + ccf ; exit with carry clear = success + ret + + +gethexbyte: + push af ; save incoming value + ld c,0ah ; bdos read console buffer + ld de,conbuf + call 5 ; get edited string + call crlf + pop de ; restore incoming to d + + ; ok we should now have a string with a hex number + ld hl,conbuf + inc hl + ld a,(hl) ; get character count + inc hl + cp 3 + jr c,ghb0 ; ok if <= 2 chars + scf ; signal error + ret ; and return + +ghb0: + or a ; set flags + jr nz,ghb1 ; got chars, go ahead + ld a,d ; restore incoming value + or a ; signal success + ret ; and done + +ghb1: + ld b,a ; count to b + ld c,0 ; initial value + +ghb2: + ld a,(hl) ; get next char + inc hl + call ishex + ret c ; abort on non-hex char + + ; ok we are here when we have a valid character (0-9,A-F,a-f) need to convert to binary + ; character is still in A + + cp 3AH ; test for 0-9 + jp m,ghb2c + cp 47H ; test for A-F + jp m,ghb2b + cp 67H ; test for a-f + jp m,ghb2a +ghb2a: sub 20H ; character is a-f +ghb2b: sub 07H ; character is A-F +ghb2c: sub 30H ; character is 0-9 + + rlc c ; multiply cur value by 16 + rlc c + rlc c + rlc c + add a,c ; add to accum + ld c,a ; put back in c + + djnz ghb2 ; loop thru all chars + + ld a,c ; into a for return + or a ; signal success + ret ; done + +ishex: + cp 30h ; check if less than character 0 + jp m,nothex + cp 3Ah ; check for > 9 + jp m,ishx1 ; ok, character is 1-9 + + cp 41h ; check for character less than A + jp m,nothex + cp 47H ; check for characters > F + jp m,ishx1 + + cp 61H ; check for characters < a + jp m,nothex + + cp 67H ; check for character > f + jp m,ishx1 +nothex: + scf ; set carry to indicate fail + ret + +ishx1: + scf + ccf + ret + + + +fillbuf: + ; fill sector buffer with character specified in A + ld hl,buffer + ld b,0 +fb1: + ld (hl),a ; store character in buffer + inc hl + ld (hl),a + inc hl + djnz fb1 + ret + + +hexdump: + + call print ; print heading + .db "Current sector buffer contents:",CR,LF,LF,0 + + ld b,32 ; line counter + ld hl,buffer ; address of buffer to dump +hxd1: + + push bc ; save loop counter + push hl ; save address pointer + + push hl + ld a,h + call prhex ; print hi byte of address + pop hl + + push hl + ld a,l + call prhex ; print lo byte of address + ld a,' ' + call cout + pop hl + + + ld b,16 ; how many characters do we display +hxd2: + push bc + + ld a,(hl) ; get byte from buffer + inc hl + push hl + + call prhex ; display it in hex + ld a,' ' + call cout + + pop hl + pop bc + djnz hxd2 + + pop hl + + ld b,16 ; how many characters do we display +hxd3: + push bc + + ld a,(hl) ; get byte from buffer + inc hl + push hl + + call prascii ; display it in ASCII + + pop hl + pop bc + djnz hxd3 + + push hl + call crlf + + pop hl + pop bc + + ld a,b ; check for screen pause + cp 16 + jp nz,hxd4 + + push hl + push bc + call cin ; wait for a character + pop bc + pop hl + +hxd4: + djnz hxd1 ; continue if not at end of buffer + + call crlf + call crlf + ret + +prascii: + + cp 20H + jp m,pra1 ; anything less than 20H is non-printable + cp 7fH ; anything greater than 7E is non-printable + jp m,pra2 +pra1: + ld a,'.' +pra2: + call cout + ret +; +; +; +; ------------------------------------------------------------------------- +; +; LBA manipulation routines; +; +cpylba: + ; copy LBA to LBA + ; source = HL, Destination = DE + ld bc,04H + ldir + ret + +; ------------------------------------------------------------------------- + +inclba: + ld a,(hl) ; first byte + add a,1 + ld (hl),a + ret nc + + inc hl ;second byte + ld a,(hl) + add a,1 + ld (hl),a + ret nc + + inc hl ; third byte + ld a,(hl) + add a,1 + ld (hl),a + ret nc + + inc hl ; fourth byte (MSB) + ld a,(hl) + add a,1 + ld (hl),a + + ret + +; ------------------------------------------------------------------------- + +cplba: ; compare LBA + ; addresses by HL and DE + + ld a,(hl) ; start at LSB + inc hl + ex de,hl + cp (hl) + ret nz + inc hl + ex de,hl + + ld a,(hl) + inc hl + ex de,hl + cp (hl) + ret nz + inc hl + ex de,hl + + ld a,(hl) + inc hl + ex de,hl + cp (hl) + ret nz + inc hl + ex de,hl + + ld a,(hl) + inc hl + ex de,hl + cp (hl) + ret + + ret nz + inc hl + ex de,hl + + ret + +; ------------------------------------------------------------------------- + +prlba: + + call print + .db "Current LBA = ",0 + ld a,(lba1+3) + call prhex + ld a,(lba1+2) + call prhex + ld a,(lba1+1) + call prhex + ld a,(lba1) + call prhex + call crlf + call crlf + ret + +; ------------------------------------------------------------------------- + +prport: + call print + .db "Current PPI base port: 0x",0 + ld a,(ppibase) + call prhex + call crlf + ret + + +clrlba: + ld a,0 + ld b,4 +clr32b1: + ld (hl),a + inc hl + djnz clr32b1 + ret + + +; ------------------------------------------------------------------------- + +prstatus: + call print + .db "status = ",0 + + ld a,ide_status ; read IDE status register + call ide_read + ld a,c ; returned value + call prhex + + call crlf + ret + + + + +print: + pop hl ; get address of text + ld a,(hl) ; get next character + inc hl + push hl + cp 0 + ret z ; end of text found + call cout ; output character + jp print + +; ------------------------------------------------------------------------- + +prhex: ; print hexadecimal digit in A + push af + srl a ; move high nibble to low + srl a + srl a + srl a + call hexnib ; convert to ASCII Hex + call cout ; send character to output device + pop af + call hexnib + call cout ; send character to output device + ret + + + +hexnib: + and 0fh ; strip high order nibble + add a,30H ; add ASCII ofset + cp 3ah ; correction necessary? + ret m + add a,7 ; correction for A to F + ret + +; ------------------------------------------------------------------------- + +cout: + ld e,a + ld c,02h ; Console output byte call + call 5 + ret + +; ------------------------------------------------------------------------- + +cin: + ld c,01h ; BDOS console function + call 5 + ret + +; ------------------------------------------------------------------------- + +crlf: + ld a,CR + call cout + ld a,LF + call cout + ret + +;------------------------------------------------------------------ +; Routines that talk with the IDE drive, these should be called by +; the main program. + + + ; read a sector, specified by the 4 bytes in "lba", + ; Return, acc is zero on success, non-zero for an error +read_sector: + call ide_wait_not_busy ;make sure drive is ready + call wr_lba ;tell it which sector we want + + ld a, ide_command + ld c, ide_cmd_read + call ide_write ; ask the drive to read it + + call ide_wait_drq ;wait until it's got the data + + bit 0,a + jp nz, get_err + ld hl, buffer + call read_data ;grab the data + ld a,0 + ret + + + ; when an error occurs, we get acc.0 set from a call to ide_drq + ; or ide_wait_not_busy (which read the drive's status register). If + ; that error bit is set, we should jump here to read the drive's + ; explanation of the error, to be returned to the user. If for + ; some reason the error code is zero (shouldn't happen), we'll + ; return 255, so that the main program can always depend on a + ; return of zero to indicate success. +get_err: + ld a,ide_err + call ide_read + ld a,c + jp z,gerr2 + ret +gerr2: + ld a, 255 + ret + + + ;write a sector, specified by the 4 bytes in "lba", + ;whatever is in the buffer gets written to the drive! + ;Return, acc is zero on success, non-zero for an error +write_sector: + call ide_wait_not_busy ; make sure drive is ready + call wr_lba ; tell it which sector we want + ld a, ide_command + ld c, ide_cmd_write + + call ide_write ;tell drive to write a sector + call ide_wait_drq ;wait unit it wants the data + bit 0,a ; check for error returned + jp nz,get_err + + ld hl, buffer + call write_data ;give the data to the drive + call ide_wait_not_busy ;wait until the write is complete + + bit 0,a + jp nz,get_err + + ld a,0 + ret + + + ; do the identify drive command, and return with the buffer + ; filled with info about the drive +drive_id: + call ide_wait_not_busy + ld a,ide_head + ld c,10100000b + call ide_write ;select the master device + call ide_wait_ready + ld a,ide_command + ld c,0ech + call ide_write ;issue the command + call ide_wait_drq + ld hl, buffer + call read_data + ret + + + ; tell the drive to spin up +spinup: + ld c,ide_cmd_spinup + ld a,ide_command + call ide_write + call ide_wait_not_busy + ret + + ; tell the drive to spin down +spindown: + call ide_wait_not_busy + ld c,ide_cmd_spindown + ld a,ide_command + call ide_write + call ide_wait_not_busy + ret + + ; initialize the IDE drive +ide_init: + ld a, ide_head + ld b, 0 + ld c, 10100000b ; select the master device + call ide_write +init1: + ld a, ide_status + call ide_read + ld a, c + + ; should probably check for a timeout here + bit 6,a ; wait for RDY bit to be set + jp z,init1 + bit 7,a + jp nz,init1 ; wait for BSY bit to be clear + + ret + + + +; IDE Status Register: +; bit 7: Busy 1=busy, 0=not busy +; bit 6: Ready 1=ready for command, 0=not ready yet +; bit 5: DF 1=fault occured inside drive +; bit 4: DSC 1=seek complete +; bit 3: DRQ 1=data request ready, 0=not ready to xfer yet +; bit 2: CORR 1=correctable error occured +; bit 1: IDX vendor specific +; bit 0: ERR 1=error occured + + + + + +;------------------------------------------------------------------ +; Not quite as low, low level I/O. These routines talk to the drive, +; using the low level I/O. Normally a main program should not call +; directly to these. + + + ;Read a block of 512 bytes (one sector) from the drive + ;and store it in memory @ HL +read_data: + ld b, 0 +rdblk2: + push bc + push hl + ld a, ide_data + call ide_read + pop hl + ld a, c + ld (hl), a + inc hl + ld a, b + ld (hl), a + inc hl + pop bc + djnz rdblk2 + ret + + + ; Write a block of 512 bytes (at HL) to the drive +write_data: + ld b,0 +wrblk2: + push bc + ld a,(hl) + ld c, a ; LSB + inc hl + ld a,(hl) + ld b, a ; MSB + inc hl + push hl + + ld a, ide_data + call ide_write + pop hl + pop bc + djnz wrblk2 + ret + + + + ; write the logical block address to the drive's registers +wr_lba: + ld a,(lba1+3) ; MSB + and 0fh + or 0e0h + ld c,a + ld a,ide_head + call ide_write + + ld a,(lba1+2) + ld c,a + ld a,ide_cyl_msb + call ide_write + + ld a,(lba1+1) + ld c,a + ld a,ide_cyl_lsb + call ide_write + + ld a,(lba1+0) ; LSB + ld c,a + ld a,ide_sector + call ide_write + + ld c,1 + ld a,ide_sec_cnt + call ide_write + + + ret + + +ide_wait_not_busy: + ld a,ide_status ;wait for RDY bit to be set + call ide_read + bit 7,c + jp nz,ide_wait_not_busy + ; should probably check for a timeout here + + ret + + +ide_wait_ready: + ld a,ide_status ; wait for RDY bit to be set + call ide_read + bit 6,c ; test for XXX + jp z,ide_wait_ready + bit 7,c + jp nz,ide_wait_ready + + ;should probably check for a timeout here + ret + + + + ; Wait for the drive to be ready to transfer data. + ; Returns the drive's status in Acc +ide_wait_drq: + ld a,ide_status ;wait for DRQ bit to be set + call ide_read + bit 7,c + jp nz,ide_wait_drq ; check for busy + bit 3,c ; wait for DRQ + jp z,ide_wait_drq + + ; should probably check for a timeout here + + ret + + + +;----------------------------------------------------------------------------- +; Low Level I/O to the drive. These are the routines that talk +; directly to the drive, via the 8255 chip. Normally a main +; program would not call to these. + + ; Do a read bus cycle to the drive, using the 8255. + ; input acc = IDE register address + ; output C = lower byte read from IDE drive + ; output B = upper byte read from IDE drive + + + + +ide_read: + push af ; save register value + push bc + call set_ppi_rd ; setup for a read cycle + pop bc + + pop af ; restore register value + call wrppictl ; write to control sigs + + or ide_rd_line ; assert RD pin + call wrppictl ; write to control sigs + + push af ; save register value + call rdppilsb ; read LSB register into A + ld c,a ; save in reg C + + call rdppimsb ; read MSB register into A + ld b,a ; save in reg C + + + pop af ; restore register value + xor ide_rd_line ; de-assert RD signal + call wrppictl ; write to control sigs + + ld a,0 + call wrppictl ; write to control sigs + ret + + + + ; Do a write bus cycle to the drive, via the 8255 + ; input acc = IDE register address + ; input register C = LSB to write + ; input register B = MSB to write + ; + +ide_write: + push af ; save IDE register value + + push bc + call set_ppi_wr ; setup for a write cycle + pop bc + + ld a,c ; get value to be written + call wrppilsb + + ld a,b ; get value to be written + call wrppimsb + + pop af ; get saved IDE register + call wrppictl ; write to control sigs + + or ide_wr_line ; assert write pin + call wrppictl ; write to control sigs + + xor ide_wr_line ; de assert WR pin + call wrppictl ; write to control sigs + + ld a,0 + call wrppictl ; write to control sigs + ret + + +;------------------------------------------------------------------------------------------- + +ide_hard_reset: + call set_ppi_rd + ld a,ide_rst_line + call wrppictl ; write to control register + ld bc,0 +rstdly: + djnz rstdly + ld a,0 + call wrppictl ; write to control registers + ret + +;----------------------------------------------------------------------------------- +; PPI setup routine to configure the appropriate PPI mode +; +;------------------------------------------------------------------------------------ + +set_ppi_rd: + ld a,(ppibase) + add a,PIOCONT ; select Control register + ld c,a + ld a,rd_ide_8255 ; configure 8255 chip, read mode + out (c),a + ret + +set_ppi_wr: + ld a,(ppibase) + add a,PIOCONT ; select Control register + ld c,a + ld a,wr_ide_8255 ; configure 8255 chip, write mode + out (c),a + ret + +;------------------------------------------------------------------------------------ + +rdppilsb: ; read LSB + ; returns data in A + push bc + ld a,(ppibase) + add a,IDELSB ; select Control register + ld c,a + in a,(c) + pop bc + ret + + +wrppilsb: ; write LSB + ; data to be written in A + push bc + push af + ld a,(ppibase) + add a,IDELSB ; select Control register + ld c,a + pop af + out (c),a + pop bc + ret + +;-------------------------------------------------------------------------- + +rdppimsb: ; read MSB + ; returns data in A + push bc + ld a,(ppibase) + add a,IDEMSB ; select MSB Register + ld c,a + in a,(c) + pop bc + ret + + +wrppimsb: ; write LSB + ; data to be written in A + push bc + push af + ld a,(ppibase) + add a,IDEMSB ; select MSB Register + ld c,a + pop af + out (c),a + pop bc + ret + +;-------------------------------------------------------------------------- + +wrppictl: ; write to control signals + ; data to be written in A + push bc + push af + ld a,(ppibase) + add a,IDECTL ; select CTL Register + ld c,a + pop af + out (c),a + pop bc + ret + +;-------------------------------------------------------------------------- +; Storage area follows + +savsp: .dw 0 ; saved stack pointer +lba1: .dw 0,0 ; LBA used for read/write operations +lba2: .dw 0,0 ; Start LBA for format +lba3: .dw 0,0 ; End LBA for format +ppibase: .db DEFBASE ; base address of PPI chip + + .fill 0C00H - $ + +buffer: .fill 512 ; sector buffer for IDE transfers +conbuf: .db 8 ; maximum chars + .db 0 ; count + .fill 8 ; size of buffer + + .fill 100 +stack: + + .end + diff --git a/Source/Apps/Test/ps2info/Build.cmd b/Source/Apps/Test/ps2info/Build.cmd new file mode 100644 index 00000000..965883ce --- /dev/null +++ b/Source/Apps/Test/ps2info/Build.cmd @@ -0,0 +1,10 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF ps2info.asm ps2info.com ps2info.lst || exit /b + +copy /Y ps2info.com ..\..\..\..\Binary\Apps\Test\ || exit /b diff --git a/Source/Apps/Test/ps2info/Clean.cmd b/Source/Apps/Test/ps2info/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/ps2info/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/ps2info/Makefile b/Source/Apps/Test/ps2info/Makefile new file mode 100644 index 00000000..33330b47 --- /dev/null +++ b/Source/Apps/Test/ps2info/Makefile @@ -0,0 +1,7 @@ +OBJECTS = ps2info.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/Test/ps2info/ps2info.asm b/Source/Apps/Test/ps2info/ps2info.asm new file mode 100644 index 00000000..c11d8fb7 --- /dev/null +++ b/Source/Apps/Test/ps2info/ps2info.asm @@ -0,0 +1,1470 @@ +; +;======================================================================= +; PS/2 Keyboard/Mouse Information Utility (PS2INFO) +;======================================================================= +; +; Simple utility that performs simple tests of an 8242 PS/2 controller, +; keyboard, and mouse. +; +; WBW 2022-03-28: Add menu driven port selection +; Add support for RHYOPHYRE +; WBW 2022-04-01: Add menu for test functions +; WBW 2022-04-02: Fix prtchr register saving/recovery +; +;======================================================================= +; +; PS/2 Keyboard/Mouse controller port addresses (adjust as needed) +; +; MBC: +iocmd_mbc .equ $E3 ; PS/2 controller command port address +iodat_mbc .equ $E2 ; PS/2 controller data port address +; RPH: +iocmd_rph .equ $8D ; PS/2 controller command port address +iodat_rph .equ $8C ; PS/2 controller data port address +; +cpumhz .equ 8 ; for time delay calculations (not critical) +; +; General operational equates (should not requre adjustment) +; +stksiz .equ $40 ; Working stack size +; +ltimout .equ 0 ; 256*10ms = 2.56s +stimout .equ 10 ; 10*10ms = 100ms +; +restart .equ $0000 ; CP/M restart vector +bdos .equ $0005 ; BDOS invocation vector +; +;======================================================================= +; + .org $100 ; standard CP/M executable +; +; + ; setup stack (save old value) + ld (stksav),sp ; save stack + ld sp,stack ; set new stack +; + call crlf + ld de,str_banner ; banner + call prtstr +; + call setup +; + call main ; do the real work +; +exit: + call crlf2 + ld de,str_exit + call prtstr + + ; clean up and return to command processor + call crlf ; formatting + ld sp,(stksav) ; restore stack + jp restart ; return to CP/M via restart +; +;======================================================================= +; Select and setup for hardware +;======================================================================= +; +setup: + call crlf2 + ld de,str_hwmenu + call prtstr +setup1: + ld c,$06 ; BDOS direct console I/O + ld e,$FF ; Subfunction = read + call bdos + cp 0 + jr z,setup1 + call upcase + call prtchr + cp '1' ; MBC + jr z,setup_mbc + cp '2' ; RHYOPHYRE + jr z,setup_rph + cp 'X' + jr z,exit + jr setup +; +setup_mbc: + ld a,iocmd_mbc + ld (iocmd),a + ld a,iodat_mbc + ld (iodat),a + ld de,str_mbc + jr setup2 +; +setup_rph: + ld a,iocmd_rph + ld (iocmd),a + ld a,iodat_rph + ld (iodat),a + ld de,str_rph + jr setup2 +; +setup2: + call prtstr + call crlf2 + ld de,str_cmdport + call prtstr + ;ld a,iocmd + ld a,(iocmd) + call prthex + call crlf + ld de,str_dataport + call prtstr + ;ld a,iodat + ld a,(iodat) + call prthex +; + xor a + ret +; +;======================================================================= +; Main Program +;======================================================================= +; +main: + call crlf2 + ld de,str_menu + call prtstr +main1: + ld c,$06 ; BDOS direct console I/O + ld e,$FF ; Subfunction = read + call bdos + cp 0 + jr z,main1 + call upcase + call prtchr + cp 'X' + jp z,exit + call main2 + jr main +; +main2: + ; Dispatch to test functions + cp 'C' ; Test Controller + jp z,test_ctlr + cp 'K' ; Test Keyboard + jp z,test_kbd + cp 'M' ; Test Mouse + jp z,test_mse + cp 'B' ; Test Both + jp z,test_kbdmse + ret +; +; Test 8242 PS/2 Controller +; +test_ctlr: + call crlf2 + ld de,str_ctlr + call prtstr +; + call ctlr_test + ret nz +; + call ctlr_test_p1 +; + call ctlr_test_p2 +; + ret +; +; Test Keyboard +; +test_kbd: +; +; First, we attempt to contact the controller and keyboard, then +; print the keyboard identity and scan codes supported +; + call crlf2 + ld de,str_basic + call prtstr +; + call ctlr_test + jr nz,test_kbd_fail +; + call test_kbd_basic + jr nz,test_kbd_fail +; +; We make two passes through the test series with different controller +; setup values. The first time is with scan code translation off and +; the second time with it on. +; + ; Run test series with translation off + call crlf2 + ld de,str_trans_off + call prtstr +; + ld a,$20 ; kbd enabled, xlat disabled, mouse disabled, no ints + ld (ctlr_cfgval),a + call test_kbd_keys +; + ; Run test series with translation on + call crlf2 + ld de,str_trans_on + call prtstr +; + ld a,$60 ; kbd enabled, xlat enabled, mouse disabled, no ints + ld (ctlr_cfgval),a + call test_kbd_keys +; + ret +; +test_kbd_fail: + ld de,str_kbd_failed + call crlf2 + call prtstr + ret +; +; Test Mouse +; +test_mse: + call crlf2 + ld de,str_basic_mse + call prtstr +; + call ctlr_test + jr nz,test_mse_fail +; + ld a,$10 ; kbd disabled, mse enabled, no ints + call ctlr_setup + jr nz,test_mse_fail +; + call mse_reset + jr nz,test_mse_fail +; + call mse_ident + jr nz,test_mse_fail +; + call mse_stream + jr nz,test_mse_fail +; + call mse_echo +; + xor a ; signal success + ret +; +test_mse_fail: + ld de,str_mse_failed + call crlf2 + call prtstr + ret +; +; Test Everything +; +test_kbdmse: + call crlf2 + ld de,str_kbdmse + call prtstr +; + call ctlr_test + jr nz,test_kbdmse_fail +; + ld a,$00 ; kbd enabled, mse enabled, no ints + call ctlr_setup + jr nz,test_kbdmse_fail +; + call kbd_reset + jr nz,test_kbdmse_fail +; + ld a,2 + call kbd_setsc +; + call mse_reset + jr nz,test_kbdmse_fail +; + call mse_stream + jr nz,test_kbdmse_fail +; + call kbdmse_echo +; + xor a ; signal success + ret +; +test_kbdmse_fail: + ld de,str_kbdmse_failed + call crlf2 + call prtstr + ret +; +; Perform basic keyboard tests, display keyboard identity, and +; inventory the supported scan code sets. +; +test_kbd_basic: + ld a,$20 ; Xlat off for this checking + call ctlr_setup + ret nz +; + call kbd_reset + ret nz +; + call kbd_ident + ;ret nz +; + ld b,3 ; Loop control, 3 scan code sets + ld c,1 ; Current scan code number +test_kbd_basic1: + ld a,c ; Scan code set to A + push bc + call kbd_setsc ; Attempt to set it + pop bc + push af ; save result + call crlf2 + ld de,str_sc_tag + call prtstr + ld a,c + call prtdecb + pop af ; restore result + ld de,str_sc_ok + jr z,test_kbd_basic2 + ld de,str_sc_fail +test_kbd_basic2: + call prtstr + inc c + djnz test_kbd_basic1 +; + xor a ; signal success + ret +; +; This routine runs a series of controller and keyboard tests. The +; desired controller setup value should be placed in ctlr_cfgval +; prior to invoking this routine. +; +test_kbd_keys: + ld a,(ctlr_cfgval) + call ctlr_setup + ret nz +; + call kbd_reset + ret nz +; + call kbd_ident + ;ret nz +; + ld a,2 + call kbd_setsc + ;ret nz +; + call kbd_dispsc + ;ret nz +; + call kbd_echo + ;ret nz +; + xor a ; signal success + ret +; +;======================================================================= +; Controller/Keyboard/Mouse Test Routines +;======================================================================= +; +; Attempt self-test command on PS/2 controller +; +; PS/2 controller should respond with an 0x55 on data port +; after being sent a 0xAA on the command port. +; +ctlr_test: + call crlf2 + ld de,str_ctlr_test + call prtstr + ld a,$aa ; self-test command + call put_cmd_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $55 ; expected value? + jp nz,err_ctlr_test ; handle self-test error + call crlf + ld de,str_ctlr_test_ok + call prtstr + xor a + ret +; +; Attempt self-test of first port of controller +; +ctlr_test_p1: + call crlf2 + ld de,str_ctlr_test_p1 + call prtstr + ld a,$ab ; self-test first port + call put_cmd_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $00 ; expected value? + jp nz,err_ctlr_test_p1 ; handle self-test error + call crlf + ld de,str_ctlr_test_p1_ok + call prtstr + xor a + ret +; +; Attempt self-test of second port of controller +; +ctlr_test_p2: + call crlf2 + ld de,str_ctlr_test_p2 + call prtstr + ld a,$a9 ; self-test second port + call put_cmd_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $00 ; expected value? + jp nz,err_ctlr_test_p2 ; handle self-test error + call crlf + ld de,str_ctlr_test_p2_ok + call prtstr + xor a + ret +; +; PS/2 controller setup +; +; Set controller command register to value in A +; +ctlr_setup: + push af ; save incoming value + call crlf2 + ld de,str_ctlr_setup + call prtstr + ld a,$60 ; write to command register 0 + call put_cmd_dbg + pop bc ; recover incoming to B + jp c,err_ctlr_to ; handle controller error + ld a,b + call put_data_dbg + jp c,err_ctlr_to ; handle controller error + xor a + ret +; +; Perform a keyboard reset +; +kbd_reset: + call crlf2 + ld de,str_kbd_reset + call prtstr + ld a,$ff ; Keyboard reset + call put_data_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $FA ; Is it an ack as expected? + jp nz,err_kbd_reset + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $aa ; Success? + jp nz,err_kbd_reset + call crlf + ld de,str_kbd_reset_ok + call prtstr + xor a + ret +; +; Identify keyboard +; +kbd_ident: + call crlf2 + ld de,str_kbd_ident + call prtstr + ld a,$f2 ; Identify keyboard command + call put_data_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $FA ; Is it an ack as expected? + jp nz,err_kbd_ident + ; Now we need to receive 0-2 bytes. There is no way to know + ; how many are coming, so we receive bytes until there is a + ; timeout error. Timeout is shortened here so that we don't + ; have to wait seconds for the routine to complete normally. + ; A short timeout is more than sufficient here. + ld ix,workbuf + ld a,(timeout) ; save current timeout + push af + ld a,stimout ; set a short timeout + ld (timeout),a + ld b,8 ; buf max + ld c,0 ; buf len +kbd_ident1: + push bc + call get_data_dbg + pop bc + jr c,kbd_ident2 + ld (ix),a + inc ix + inc c + djnz kbd_ident1 +kbd_ident2: + pop af ; restore original timeout + ld (timeout),a + call crlf + ld de,str_kbd_ident_disp + call prtstr + ld a,'[' + call prtchr + ld ix,workbuf + ld a,c ; bytes to print + or a ; check for zero + jr z,kbd_ident4 ; handle zero + ld b,a ; setup loop counter + jr kbd_ident3a +kbd_ident3: + ld a,',' + call prtchr +kbd_ident3a: + ld a,(ix) + call prthex + inc ix + djnz kbd_ident3 +kbd_ident4: + ld a,']' + call prtchr + xor a + ret +; +; Display keyboard active scan code set being used +; +kbd_dispsc: + call crlf2 + ld de,str_kbd_getsc + call prtstr + ld a,$f0 ; Keyboard get/set scan code + call put_data_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $FA ; Is it an ack as expected? + jp nz,err_kbd_getsc + ld a,$00 ; Get active scan code set + call put_data_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $FA ; Is it an ack as expected? + jp nz,err_kbd_getsc + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + push af + call crlf + ld de,str_kbd_dispsc + call prtstr + pop af + call prtdecb + xor a + ret +; +; Set keyboard active scan code set to value in A +; +kbd_setsc: + ld (kbd_setsc_val),a ; Save incoming value + call crlf2 + ld de,str_kbd_setsc + call prtstr + call prtdecb + ld a,$f0 ; Keyboard get/set scan code + call put_data_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $FA ; Is it an ack as expected? + jp nz,err_kbd_setsc + ld a,(kbd_setsc_val) ; Recover scan code set value + call put_data_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $FA ; Is it an ack as expected? + jp nz,err_kbd_setsc + xor a + ret +; +kbd_setsc_val .db 0 +; +; Read and display raw scan codes +; +kbd_echo: + call crlf2 + ld de,str_disp_scan_codes + call prtstr +read_loop: + ld c,$06 ; BDOS direct console I/O + ld e,$FF ; Subfunction = read + call bdos + cp $1B ; Escape key? + ret z + call check_read_kbd + jr nz,read_loop + call get_data + jp c,err_ctlr_to ; handle controller error + push af + ld a,' ' + call prtchr + ld a,'[' + call prtchr + pop af + call prthex + ld a,']' + call prtchr + jr read_loop +; +; Reset Mouse +; +mse_reset: + call crlf2 + ld de,str_mse_reset + call prtstr + ld a,$f2 ; Identify mouse command + call put_data_mse_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $fa ; Is it an ack as expected? + jp nz,err_mse_reset + call crlf + ld de,str_mse_reset_ok + call prtstr + xor a + ret +; +; Identify Mouse +; +mse_ident: + call crlf2 + ld de,str_mse_ident + call prtstr + ld a,$f2 ; Identify mouse command + call put_data_mse_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $fa ; Is it an ack as expected? + jp nz,err_mse_ident + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + push af + call crlf + ld de,str_mse_ident_disp + call prtstr + pop af + call prtdecb + xor a + ret +; +; Enable mouse packet streaming +; +mse_stream: + call crlf2 + ld de,str_mse_stream + call prtstr + ld a,$f4 ; Stream packets cmd + call put_data_mse_dbg + jp c,err_ctlr_to ; handle controller error + call get_data_dbg + jp c,err_ctlr_to ; handle controller error + cp $FA ; Is it an ack as expected? + jp nz,err_mse_stream + xor a + ret +; +; Read and display raw mouse packets +; +mse_echo: + call crlf2 + ld de,str_disp_mse_pkts + call prtstr + call mse_track_disp ; show mouse status + xor a + ld (msebuflen),a +mse_echo1: + ld c,$06 ; BDOS direct console I/O + ld e,$FF ; Subfunction = read + call bdos + cp $1B ; Escape key? + ret z + call check_read_mse + jr nz,mse_echo1 + call get_data + jp c,err_ctlr_to ; handle controller error + push af + ld a,(msebuflen) ; current bytes in buf + ld hl,msebuf ; start of buf + call addhla ; point to next buf pos + pop af + ld (hl),a ; save byte in buf + ld a,(msebuflen) + inc a + ld (msebuflen),a ; inc buf len + cp 3 ; got 3 bytes? + jr nz,mse_echo1 ; if not, get some more + call mse_track + call mse_track_disp + jr mse_echo1 ; and loop +; +; Read and display data from keyboard and mouse +; +kbdmse_echo: + call crlf2 + ld de,str_disp_kbdmse + call prtstr + xor a + ld (msebuflen),a + call kbdmse_track_disp +; +kbdmse_echo1: + ; Check for user abort + ld c,$06 ; BDOS direct console I/O + ld e,$FF ; Subfunction = read + call bdos + cp $1B ; Escape key? + ret z +; + call kbdmse_echo2 + call kbdmse_echo3 + jr kbdmse_echo1 +; +kbdmse_echo2: + ; Check & handle keyboard data + call check_read_kbd + ret nz + call get_data + ld (kbd_byte),a + call kbdmse_track_disp + ret +; +kbdmse_echo3: + ; Check & handle mouse data + call check_read_mse + ret nz + call get_data + jp c,err_ctlr_to ; handle controller error + push af + ld a,(msebuflen) ; current bytes in buf + ld hl,msebuf ; start of buf + call addhla ; point to next buf pos + pop af + ld (hl),a ; save byte in buf + ld a,(msebuflen) + inc a + ld (msebuflen),a ; inc buf len + cp 3 ; full packet? + ret nz ; if not, loop + call mse_track + call kbdmse_track_disp + ret +; +; Update mouse tracking stuff +; This routine assumes that msebuf has been filled with a complete +; 3 byte mouse packet. +; +mse_track: + ; Buttons... + ld a,(msebuf) + ld (mse_stat),a +; + ; X Coordinate + ld a,(msebuf+1) + ld e,a + ld d,0 + ld a,(msebuf) + and %00010000 ; sign bit + jr z,mse_track_x + ld d,$ff ; sign extend +mse_track_x: + ld hl,(mse_x) + add hl,de + ld (mse_x),hl ; save result +; + ; Y Coordinate + ld a,(msebuf+2) + ld e,a + ld d,0 + ld a,(msebuf) + and %00100000 ; sign bit + jr z,mse_track_y + ld d,$ff ; sign extend +mse_track_y: + ld hl,(mse_y) + add hl,de + ld (mse_y),hl ; save result +; + ; Reset mouse buffer + xor a + ld (msebuflen),a + ret +; +; Display current mouse tracking info (buttons and coordinates) +; +mse_track_disp: + ld a,13 ; CR only + call prtchr + ld de,str_msestat1 ; "L=" + call prtstr + ld a,(mse_stat) + and %00000001 + call updown + ld de,str_msestat2 ; ", M=" + call prtstr + ld a,(mse_stat) + and %00000100 + call updown + ld de,str_msestat3 ; ", R=" + call prtstr + ld a,(mse_stat) + and %00000010 + call updown +; + ld de,str_msestat4 ; ", X=" + call prtstr + ld hl,(mse_x) ; save result + call prthexword +; + ld de,str_msestat5 ; ", Y=" + call prtstr + ld hl,(mse_y) ; save result + call prthexword +; + ret +; +updown: + jr nz,updown1 + ld de,str_up + jr updown2 +updown1: + ld de,str_down +updown2: + call prtstr + ret +; +; Display all keyboard and mouse tracking +; +kbdmse_track_disp: + call mse_track_disp + ld a,' ' + call prtchr + ld a,'[' + call prtchr + ld a,(kbd_byte) + call prthex + ld a,']' + call prtchr + ret +; +;======================================================================= +; PS/2 Controller I/O Routines +;======================================================================= +; +wait_write: +; +; Wait for controller to be ready for a write +; A=0 indicates success (ZF set) +; + ld a,(timeout) ; setup timeout constant + ld b,a +wait_write1: + ld a,(iocmd) ; cmd port + ld c,a ; ... to C + in a,(c) ; get status + ld c,a ; save status + and $02 ; isolate input buf status bit + ret z ; 0 means ready, all done + call delay ; wait a bit + djnz wait_write1 ; loop until counter exhausted +; ld de,str_timeout_write ; write timeout message +; call crlf +; call prtstr +; ld a,c ; recover last status value +; call prthex + or $ff ; signal error + ret +; +wait_read: +; +; Wait for controller to be ready to read a byte +; A=0 indicates success (ZF set) +; + ld a,(timeout) ; setup timeout constant + ld b,a +wait_read1: + ld a,(iocmd) ; cmd port + ld c,a ; ... to C + in a,(c) ; get status + ld c,a ; save status + and $01 ; isolate input buf status bit + xor $01 ; invert so 0 means ready + ret z ; if 0, all done + call delay ; wait a bit + djnz wait_read1 ; loop until counter exhausted +; ld de,str_timeout_read ; write timeout message +; call crlf +; call prtstr +; ld a,c ; recover last status value +; call prthex + or $ff ; signal error + ret +; +check_read: +; +; Check for data ready to read +; A=0 indicates data available (ZF set) +; + ld a,(iocmd) ; cmd port + ld c,a ; ... to C + in a,(c) ; get status + and $01 ; isolate input buf status bit + xor $01 ; invert so 0 means ready + ret +; +check_read_kbd: +; +; Check for keyboard data ready to read +; A=0 indicates data available (ZF set) +; + ld a,(iocmd) ; cmd port + ld c,a ; ... to C + in a,(c) ; get status + and %00100001 ; isolate input buf status bit + cp %00000001 ; data ready, not mouse + ret +; +check_read_mse: +; +; Check for mouse data ready to read +; A=0 indicates data available (ZF set) +; + ld a,(iocmd) ; cmd port + ld c,a ; ... to C + in a,(c) ; get status + and %00100001 ; isolate input buf status bit + cp %00100001 ; data ready, is mouse + ret +; +put_cmd: +; +; Put a cmd byte from A to the controller with timeout +; CF set indicates timeout error +; + ld e,a ; save incoming value + call wait_write ; wait for controller ready + jr z,put_cmd1 ; if ready, move on + scf ; else, signal timeout error + ret ; and bail out +put_cmd1: + ld a,(iocmd) ; cmd port + ld c,a ; ... to C + ld a,e ; recover value to write + out (c),a ; write it + or a ; clear CF for success + ret +; +put_cmd_dbg: + call put_cmd + ret c + push af + + call crlf + ld de,str_put_cmd + call prtstr + call prthex + + pop af + ret +; +put_data: +; +; Put a data byte from A to the controller interface with timeout +; CF set indicates timeout error +; + ld e,a ; save incoming value + call wait_write ; wait for controller ready + jr z,put_data1 ; if ready, move on + scf ; else, signal timeout error + ret ; and bail out +put_data1: + ld a,(iodat) ; data port + ld c,a ; ... to C + ld a,e ; recover value to write + out (c),a ; write it + or a ; clear CF for success + ret +; +put_data_dbg: + call put_data + ret c + push af + + call crlf + ld de,str_put_data + call prtstr + call prthex + + pop af + ret + +; +put_data_mse: +; +; Put a data byte from A to the mouse interface with timeout +; CF set indicates timeout error +; + ld e,a ; save incoming value + push de + + ld a,$d4 ; mouse channel prefix + call put_cmd + pop de + ret c + + ld a,e ; recover value + call put_data + ret +; +put_data_mse_dbg: + ld e,a ; save incoming value + push de + + ld a,$d4 ; mouse channel prefix + call put_cmd_dbg + pop de + ret c + + ld a,e ; recover value + call put_data_dbg + ret +; +; Get a data byte from the controller interface to A with timeout +; CF set indicates timeout error +; +get_data: + call wait_read ; wait for byte to be ready + jr z,get_data1 ; if readym, move on + scf ; else signal timeout error + ret ; and bail out +get_data1: + ld a,(iodat) ; data port + ld c,a ; ... to C + in a,(c) ; get data byte + or a ; clear CF for success + ret +; +get_data_dbg: + call get_data + ret c + push af + + call crlf + ld de,str_get_data + call prtstr + call prthex + + pop af + ret +; +; Error Handlers +; +err_ctlr_to: + ld de,str_err_ctlr_to + jr err_ret +; +err_ctlr_test: + ld de,str_err_ctlr_test + jr err_ret +; +err_ctlr_test_p1: + ld de,str_err_ctlr_test_p1 + jr err_ret +; +err_ctlr_test_p2: + ld de,str_err_ctlr_test_p2 + jr err_ret +; +err_kbd_reset: + ld de,str_err_kbd_reset + jr err_ret +; +err_kbd_getsc: + ld de,str_err_kbd_getsc + jr err_ret +; +err_kbd_setsc: + ld de,str_err_kbd_setsc + jr err_ret +; +err_kbd_ident: + ld de,str_err_kbd_ident + jr err_ret +; +err_mse_reset: + ld de,str_err_mse_reset + jr err_ret +; +err_mse_ident: + ld de,str_err_mse_ident + jr err_ret +; +err_mse_stream: + ld de,str_err_mse_stream + jr err_ret +; +err_ret: + call crlf2 + call prtstr + or $ff ; signal error + ret +; +;======================================================================= +; Utility Routines +;======================================================================= +; +; Print character in A without destroying any registers +; +prtchr: + push af ; save registers + push bc + push de + push hl + ld e,a ; character to print in E + ld c,$02 ; BDOS function to output a character + call bdos ; do it + pop hl ; restore registers + pop de + pop bc + pop af + ret +; +prtdot: +; + ; shortcut to print a dot preserving all regs + push af ; save af + ld a,'.' ; load dot char + call prtchr ; print it + pop af ; restore af + ret ; done +; +; Uppercase character in A +; +upcase: + cp 'a' ; below 'a'? + ret c ; if so, nothing to do + cp 'z'+1 ; above 'z'? + ret nc ; if so, nothing to do + and ~$20 ; convert character to lower + ret ; done +; +; Print a zero terminated string at (de) without destroying any registers +; +prtstr: + push af + push de +; +prtstr1: + ld a,(de) ; get next char + or a + jr z,prtstr2 + call prtchr + inc de + jr prtstr1 +; +prtstr2: + pop de ; restore registers + pop af + ret +; +; Print a hex value prefix "0x" +; +prthexpre: + push af + ld a,'0' + call prtchr + ld a,'x' + call prtchr + pop af + ret +; +; Print the value in A in hex without destroying any registers +; +prthex: + call prthexpre +prthex1: + push af ; save AF + push de ; save DE + call hexascii ; convert value in A to hex chars in DE + ld a,d ; get the high order hex char + call prtchr ; print it + ld a,e ; get the low order hex char + call prtchr ; print it + pop de ; restore DE + pop af ; restore AF + ret ; done +; +; print the hex word value in hl +; +prthexword: + call prthexpre +prthexword1: + push af + ld a,h + call prthex1 + ld a,l + call prthex1 + pop af + ret +; +; print the hex dword value in de:hl +; +prthex32: + call prthexpre + push bc + push de + pop bc + call prthexword1 + push hl + pop bc + call prthexword1 + pop bc + ret +; +; Convert binary value in A to ascii hex characters in DE +; +hexascii: + ld d,a ; save A in D + call hexconv ; convert low nibble of A to hex + ld e,a ; save it in E + ld a,d ; get original value back + rlca ; rotate high order nibble to low bits + rlca + rlca + rlca + call hexconv ; convert nibble + ld d,a ; save it in D + ret ; done +; +; Convert low nibble of A to ascii hex +; +hexconv: + and $0F ; low nibble only + add a,$90 + daa + adc a,$40 + daa + ret +; +; Print value of A or HL in decimal with leading zero suppression +; Use prtdecb for A or prtdecw for HL +; +prtdecb: + push hl + ld h,0 + ld l,a + call prtdecw ; print it + pop hl + ret +; +prtdecw: + push af + push bc + push de + push hl + call prtdec0 + pop hl + pop de + pop bc + pop af + ret +; +prtdec0: + ld e,'0' + ld bc,-10000 + call prtdec1 + ld bc,-1000 + call prtdec1 + ld bc,-100 + call prtdec1 + ld c,-10 + call prtdec1 + ld e,0 + ld c,-1 +prtdec1: + ld a,'0' - 1 +prtdec2: + inc a + add hl,bc + jr c,prtdec2 + sbc hl,bc + cp e + ret z + ld e,0 + call prtchr + ret +; +; Start a new line +; +crlf2: + call crlf ; two of them +crlf: + push af ; preserve AF + ld a,13 ; + call prtchr ; print it + ld a,10 ; + call prtchr ; print it + pop af ; restore AF + ret +; +; Add hl,a +; +; A register is destroyed! +; +addhla: + add a,l + ld l,a + ret nc + inc h + ret +; +; Delay ~10ms +; +delay: + push af + push de + ld de,625 ; 10000us/16us +delay0: + ld a,(cpuscl) +delay1: + dec a + jr nz,delay1 + dec de + ld a,d + or e + jp nz,delay0 + pop de + pop af + ret +; +; +; +;======================================================================= +; Constants +;======================================================================= +; +str_banner .db "PS/2 Keyboard/Mouse Information v0.6a, 2-Apr-2022",0 +str_hwmenu .db "PS/2 Controller Port Options:\r\n\r\n" + .db " 1 - MBC\r\n" + .db " 2 - RHYOPHYRE\r\n" + .db " X - Exit Application\r\n" + .db "\r\nSelection? ",0 +str_mbc .db "MBC",0 +str_rph .db "RHYOPHYRE",0 +str_menu .db "PS/2 Testing Options:\r\n\r\n" + .db " C - Test PS/2 Controller\r\n" + .db " K - Test PS/2 Keyboard\r\n" + .db " M - Test PS/2 Mouse\r\n" + .db " B - Test Both PS/2 Keyboard and Mouse Together\r\n" + .db " X - Exit Application\r\n" + .db "\r\nSelection? ",0 +str_exit .db "Done, Thank you for using PS/2 Keyboard/Mouse Information!",0 +str_cmdport .db "Controller Command Port: ",0 +str_dataport .db "Controller Data Port: ",0 +str_err_ctlr_to .db "Controller I/O Timeout",0 +str_err_ctlr_test .db "Controller Self-Test Failed",0 +str_put_cmd .db " Sent Command ",0 +str_put_data .db " Sent Data ",0 +str_get_data .db " Got Data ",0 +str_ctlr_test .db "Attempting Controller Self-Test",0 +str_ctlr_test_ok .db "Controller Self-Test OK",0 +str_ctlr_test_p1 .db "Attempting Self-Test of First Controller Port",0 +str_ctlr_test_p1_ok .db "Controller First Port Self-Test OK",0 +str_err_ctlr_test_p1 .db "Controller First Port Self-Test Failed",0 +str_ctlr_test_p2 .db "Attempting Self-Test of Second Controller Port",0 +str_ctlr_test_p2_ok .db "Controller Second Port Self-Test OK",0 +str_err_ctlr_test_p2 .db "Controller Second Port Self-Test Failed",0 +str_ctlr_setup .db "Performing Controller Setup",0 +str_ctlr .db "***** Basic 8242 PS/2 Controller Tests *****",0 +str_basic .db "***** Basic Keyboard Checks and Scan Code Inventory *****",0 +str_trans_off .db "***** Testing Keyboard with Scan Code Translation DISABLED *****",0 +str_trans_on .db "***** Testing Keyboard with Scan Code Translation ENABLED *****",0 +str_basic_mse .db "***** Basic Mouse Tests *****",0 +str_kbdmse .db "***** Test All Devices Combined *****",0 +str_kbd_reset .db "Attempting Keyboard Reset",0 +str_kbd_reset_ok .db "Keyboard Reset OK",0 +str_err_kbd_reset .db "Keyboard Reset Failed",0 +str_mse_reset .db "Attempting Mouse Reset",0 +str_mse_reset_ok .db "Mouse Reset OK",0 +str_err_mse_reset .db "Mouse Reset Failed",0 +str_kbd_getsc .db "Requesting Active Scan Code Set from Keyboard",0 +str_kbd_dispsc .db "Active Keyboard Scan Code Set is #",0 +str_err_kbd_getsc .db "Error getting Active Keyboard Scan Code Set",0 +str_kbd_setsc .db "Setting Active Keyboard Scan Code Set to #",0 +str_err_kbd_setsc .db "Error setting Active Keyboard Scan Code Set",0 +str_kbd_ident .db "Keyboard Identification",0 +str_kbd_ident_disp .db "Keyboard Identity: ",0 +str_mse_ident .db "Mouse Identification",0 +str_mse_ident_disp .db "Mouse Identity: ",0 +str_mse_stream .db "Enable Mouse Packet Streaming",0 +str_err_mse_stream .db "Error enabling Mouse Packet Streaming",0 +str_msestat1 .db "L=",0 +str_msestat2 .db ", M=",0 +str_msestat3 .db ", R=",0 +str_msestat4 .db ", X=",0 +str_msestat5 .db ", Y=",0 +str_up .db "UP",0 +str_down .db "DN",0 +str_sc_tag .db "Scan Code Set #",0 +str_sc_ok .db " IS supported",0 +str_sc_fail .db " IS NOT supported",0 +str_err_kbd_ident .db "Error performing Keyboard Identification",0 +str_err_mse_ident .db "Error performing Mouse Identification",0 +str_disp_scan_codes .db "Displaying Raw Scan Codes",13,10 + .db " Press keys on test keyboard to display scan codes",13,10 + .db " Press on CP/M console to end",13,10,13,10,0 +str_disp_mse_pkts .db "Displaying Mouse Packets",13,10 + .db " Move mouse and click mouse buttons",13,10 + .db " Press on CP/M console to end",13,10,13,10,0 +str_disp_kbdmse .db "Displaying Keyboard & Mouse Activity",13,10 + .db " Press keys on test keyboard to display scan codes",13,10 + .db " Move mouse and click mouse buttons",13,10 + .db " Press on CP/M console to end",13,10,13,10,0 +str_kbd_failed .db "***** KEYBOARD HARDWARE ERROR *****",13,10,13,10 + .db "A basic hardware or configuration issue prevented",13,10 + .db "the completion of the full set of keyboard tests.",13,10 + .db "Check your hardware and verify the port",13,10 + .db "addresses being used for the controller",0 +str_mse_failed .db "***** MOUSE HARDWARE ERROR *****",13,10,13,10 + .db "A basic hardware or configuration issue prevented",13,10 + .db "the completion of the full set of mouse tests.",13,10 + .db "Check your hardware and verify the port",13,10 + .db "addresses being used for the controller",0 +str_kbdmse_failed .db "***** KEYBOARD/MOUSE HARDWARE ERROR *****",13,10,13,10 + .db "A basic hardware or configuration issue prevented",13,10 + .db "the completion of the full set of keyboard/mouse tests.",13,10 + .db "Check your hardware and verify the port",13,10 + .db "addresses being used for the controller",0 +; +;======================================================================= +; Working data +;======================================================================= +; +stksav .dw 0 ; stack pointer saved at start + .fill stksiz,0 ; stack +stack .equ $ ; stack top +; +iocmd .db 0 +iodat .db 0 +; +workbuf .fill 8 +workbuf_len .db 0 +; +msebuf .fill 5,0 +msebuflen .db 0 +; +mse_stat .db 0 +mse_x .dw 0 +mse_y .dw 0 +; +kbd_byte .db 0 +; +ctlr_cfgval .db 0 ; Value for controller cmd reg 0 +; +cpuscl .db cpumhz - 2 +timeout .db ltimout +; +;======================================================================= +; + .end \ No newline at end of file diff --git a/Source/Apps/Test/ramtest/Build.cmd b/Source/Apps/Test/ramtest/Build.cmd new file mode 100644 index 00000000..aac36c4b --- /dev/null +++ b/Source/Apps/Test/ramtest/Build.cmd @@ -0,0 +1,13 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t80 -b -fFF loader.asm loader.bin loader.lst || exit /b +tasm -t80 -b -fFF dbgmon.asm dbgmon.bin dbgmon.lst || exit /b + +copy /Y /b loader.bin+dbgmon.bin ramtest.com || exit /b + +copy /Y ramtest.com ..\..\..\..\Binary\Apps\Test\ || exit /b diff --git a/Source/Apps/Test/ramtest/Clean.cmd b/Source/Apps/Test/ramtest/Clean.cmd new file mode 100644 index 00000000..60b882d0 --- /dev/null +++ b/Source/Apps/Test/ramtest/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.bin del *.bin +if exist *.lst del *.lst diff --git a/Source/Apps/Test/ramtest/Makefile b/Source/Apps/Test/ramtest/Makefile new file mode 100644 index 00000000..3c5e6515 --- /dev/null +++ b/Source/Apps/Test/ramtest/Makefile @@ -0,0 +1,10 @@ +OBJECTS = ramtest.com +DEST = ../../../../Binary/Apps/Test +DOCDEST = ../../../../Doc +TOOLS = ../../../../Tools +OTHERS = loader.bin dbgmon.bin +include $(TOOLS)/Makefile.inc + +ramtest.com: loader.bin dbgmon.bin + cat $^ >$@ + diff --git a/Source/Apps/Test/ramtest/dbgmon.asm b/Source/Apps/Test/ramtest/dbgmon.asm new file mode 100644 index 00000000..dc69ddf1 --- /dev/null +++ b/Source/Apps/Test/ramtest/dbgmon.asm @@ -0,0 +1,1326 @@ +;___RAM_TEST_PROGRAM_____________________________________________________________________________________________________________ +; +; ORIGINAL CODE BY: ANDREW LYNCH (LYNCHAJ@YAHOO COM) 17 JUL 2021 +; +; HELP FROM WAYNE WARTHEN +; +;__REFERENCES________________________________________________________________________________________________________________________ +; THOMAS SCHERRER BASIC HARDWARE TEST ASSEMBLER SOURCES FROM THE Z80 INFO PAGE +; INCLUDING ORIGINAL SCHEMATIC CONCEPT +; HTTP://Z80 INFO/Z80SOURC.TXT +; CODE SAMPLES FROM BRUCE JONES PUBLIC DOMAIN ROM MONITOR FOR THE SBC-200C +; HTTP://WWW RETROTECHNOLOGY.COM/HERBS_STUFF/SD_BRUCE_CODE.ZIP +; INSPIRATION FROM JOEL OWENS "Z-80 SPACE-TIME PRODUCTIONS SINGLE BOARD COMPUTER" +; HTTP://WWW JOELOWENSORG/Z80/Z80INDEX.HTML +; GREAT HELP AND TECHNICAL ADVICE FROM ALLISON AT ALPACA_DESIGNERS +; HTTP://GROUPS YAHOO.COM/GROUP/ALPACA_DESIGNERS +; INTEL SDK-85 ROM DEBUG MONITOR +; +;__HARDWARE_INTERFACES________________________________________________________________________________________________________________ +; +; PIO 82C55 I/O IS DECODED TO PORT 60-67 +; +PORTA: .EQU 60H +PORTB: .EQU 61H +PORTC: .EQU 62H +PIOCONT: .EQU 63H +; +; UART 16C450 SERIAL IS DECODED TO 68-6F +; +UART0: .EQU 68H ; DATA IN/OUT +UART1: .EQU 69H ; CHECK RX +UART2: .EQU 6AH ; INTERRUPTS +UART3: .EQU 6BH ; LINE CONTROL +UART4: .EQU 6CH ; MODEM CONTROL +UART5: .EQU 6DH ; LINE STATUS +UART6: .EQU 6EH ; MODEM STATUS +UART7: .EQU 6FH ; SCRATCH REG. +; +; MEMORY PAGE CONFIGURATION LATCH IS DECODED TO 7CH +; +MPCL_ROM: .EQU 7CH ; CONTROL PORT, SHOULD ONLY BE CHANGED WHILE +; IN UPPER MEMORY PAGE 08000h-$FFFF OR LIKELY +; LOSS OF CPU MEMORY CONTEXT +; +; ROM MEMORY PAGE CONFIGURATION LATCH CONTROL PORT ( IO_Y3 ) INFORMATION +; +; 7 6 5 4 3 2 1 0 ONLY APPLICABLE TO THE LOWER MEMORY PAGE 00000h-$7FFF +; ^ ^ ^ ^ ^ ^ ^ ^ +; : : : : : : : :--0 = A15 ROM ONLY ADDRESS LINE DEFAULT IS 0 +; : : : : : : :----0 = A16 ROM ONLY ADDRESS LINE DEFAULT IS 0 +; : : : : : :------0 = A17 ROM ONLY ADDRESS LINE DEFAULT IS 0 +; : : : : :--------0 = A18 ROM ONLY ADDRESS LINE DEFAULT IS 0 +; : : : :-----------0 = A19 ROM ONLY ADDRESS LINE DEFAULT IS 0 +; : : :-------------0 = A20 ROM ONLY ADDRESS LINE DEFAULT IS 0 +; : :---------------0 = ROM BOOT OVERRIDE DEFAULT IS 0 +; :-----------------0 = LOWER PAGE ROM SELECT (0=ROM, 1=NOTHING) DEFAULT IS 0 +; +; MEMORY PAGE CONFIGURATION LATCH IS DECODED TO 78H +; +MPCL_RAM: .EQU 78H ; CONTROL PORT, SHOULD ONLY BE CHANGED WHILE +; IN UPPER MEMORY PAGE 08000h-$FFFF OR LIKELY +; LOSS OF CPU MEMORY CONTEXT +; +; MEMORY PAGE CONFIGURATION LATCH CONTROL PORT ( IO_Y1 ) INFORMATION +; +; 7 6 5 4 3 2 1 0 ONLY APPLICABLE TO THE LOWER MEMORY PAGE 00000h-$7FFF +; ^ ^ ^ ^ ^ ^ ^ ^ +; : : : : : : : :--0 = A15 RAM ONLY ADDRESS LINE DEFAULT IS 0 +; : : : : : : :----0 = A16 RAM ONLY ADDRESS LINE DEFAULT IS 0 +; : : : : : :------0 = A17 RAM ONLY ADDRESS LINE DEFAULT IS 0 +; : : : : :--------0 = A18 RAM ONLY ADDRESS LINE DEFAULT IS 0 +; : : : :-----------0 = A19 RAM ONLY ADDRESS LINE DEFAULT IS 0 +; : : :-------------0 = UNDEFINED DEFAULT IS 0 +; : :---------------0 = RAM BOOT OVERRIDE DEFAULT IS 0 +; :-----------------0 = LOWER PAGE RAM SELECT (0=NOTHING, 1=RAM) DEFAULT IS 0; +; +;; +; +;__CONSTANTS_________________________________________________________________________________________________________________________ +; +RAMTOP: .EQU 0FFFFh ; HIGHEST ADDRESSABLE MEMORY LOCATION +STACKSTART: .EQU 0CFFFh ; START OF STACK +RAMBOTTOM: .EQU 08000h ; START OF FIXED UPPER 32K PAGE OF 512KB X 8 RAM 8000H-FFFFH +MONSTARTCOLD: .EQU 08000h ; COLD START MONITOR IN HIGH RAM +ENDT: .EQU 0FFh ; MARK END OF TEXT +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 8000H ; NORMAL OP + + + + +;__MONSTARTWARM___________________________________________________________________________________________________________________ +; +; SERIAL MONITOR STARTUP +;________________________________________________________________________________________________________________________________ +; + +MONSTARTWARM: ; CALL HERE FOR SERIAL MONITOR WARM START + LD SP,STACKSTART ; SET THE STACK POINTER TO STACKSTART + CALL INITIALIZE ; INITIALIZE SYSTEM + + XOR A ;ZERO OUT ACCUMULATOR (ADDED) + PUSH HL ;PROTECT HL FROM OVERWRITE + LD HL,TXT_READY ;POINT AT TEXT + CALL MSG ;SHOW WE'RE HERE + POP HL ;PROTECT HL FROM OVERWRITE + +; +;__SERIAL_MONITOR_COMMANDS_________________________________________________________________________________________________________ +; +; A RAM TEST LOWER 32KB RAM PAGE +; B XX BOOT CPM FROM DRIVE XX +; D XXXXH YYYYH DUMP MEMORY FROM XXXX TO YYYY +; F XXXXH YYYYH ZZH FILL MEMORY FROM XXXX TO YYYY WITH ZZ +; H LOAD INTEL HEX FORMAT DATA +; I INPUT FROM PORT AND SHOW HEX DATA +; K ECHO KEYBOARD INPUT +; M XXXXH YYYYH ZZZZH MOVE MEMORY BLOCK XXXX TO YYYY TO ZZZZ +; O OUTPUT TO PORT HEX DATA +; P XXXXH YYH PROGRAM RAM FROM XXXXH WITH VALUE IN YYH, WILL PROMPT FOR NEXT LINES FOLLOWING UNTIL CR +; R RUN A PROGRAM FROM CURRENT LOCATION + + + +;__COMMAND_PARSE_________________________________________________________________________________________________________________ +; +; PROMPT USER FOR COMMANDS, THEN PARSE THEM +;________________________________________________________________________________________________________________________________ +; + +SERIALCMDLOOP: + LD HL,TXT_MAIN_MENU ; POINT AT MAIN MENU TEXT + CALL MSG ; PRINT COMMAND LABEL + CALL CRLFA ; CR,LF,> + LD HL,KEYBUF ; SET POINTER TO KEYBUF AREA + CALL GETLN ; GET A LINE OF INPUT FROM THE USER + LD HL,KEYBUF ; RESET POINTER TO START OF KEYBUF + LD A,(HL) ; LOAD FIRST CHAR INTO A (THIS SHOULD BE THE COMMAND) + INC HL ; INC POINTER + + CP 'A' ; IS IT "A" (Y/N) + JP Z,DORAMTEST ; IF YES DO RAM TEST + CP 'B' ; IS IT "B" (Y/N) + JP Z,DOBOOT ; IF YES DO BOOT + CP 'R' ; IS IT "R" (Y/N) + JP Z,RUN ; IF YES GO RUN ROUTINE + CP 'P' ; IS IT "P" (Y/N) + JP Z,PROGRM ; IF YES GO PROGRAM ROUTINE + CP 'O' ; IS IT AN "O" (Y/N) + JP Z,POUT ; PORT OUTPUT + CP 'H' ; IS IT A "H" (Y/N) + JP Z,HXLOAD ; INTEL HEX FORMAT LOAD DATA + CP 'I' ; IS IT AN "I" (Y/N) + JP Z,PIN ; PORT INPUT + CP 'D' ; IS IT A "D" (Y/N) + JP Z,DUMP ; DUMP MEMORY + CP 'K' + JP Z,KLOP ; LOOP ON KEYBOARD + CP 'M' ; IS IT A "M" (Y/N) + JP Z,MOVE ; MOVE MEMORY COMMAND + CP 'F' ; IS IT A "F" (Y/N) + JP Z,FILL ; FILL MEMORY COMMAND + LD HL,TXT_COMMAND ; POINT AT ERROR TEXT + CALL MSG ; PRINT COMMAND LABEL + + JR SERIALCMDLOOP + + + + + +;__KLOP__________________________________________________________________________________________________________________________ +; +; READ FROM THE SERIAL PORT AND ECHO, MONITOR COMMAND "K" +;________________________________________________________________________________________________________________________________ +; +KLOP: + CALL KIN ; GET A KEY + CALL COUT ; OUTPUT KEY TO SCREEN + CP ESC ; IS ? + JR NZ,KLOP ; NO, LOOP + JP SERIALCMDLOOP ; + +;__GETLN_________________________________________________________________________________________________________________________ +; +; READ A LINE(80) OF TEXT FROM THE SERIAL PORT, HANDLE , TERM ON +; EXIT IF TOO MANY CHARS STORE RESULT IN HL. CHAR COUNT IN C. +;________________________________________________________________________________________________________________________________ +; +GETLN: + LD C,00H ; ZERO CHAR COUNTER + PUSH DE ; STORE DE +GETLNLOP: + CALL KIN ; GET A KEY + CALL COUT ; OUTPUT KEY TO SCREEN + CP CR ; IS ? + JR Z,GETLNDONE ; YES, EXIT + CP BS ; IS ? + JR NZ,GETLNSTORE ; NO, STORE CHAR + LD A,C ; A=C + CP 0 ; + JR Z,GETLNLOP ; NOTHING TO BACKSPACE, IGNORE & GET NEXT KEY + DEC HL ; PERFORM BACKSPACE + DEC C ; LOWER CHAR COUNTER + LD A,0 ; + LD (HL),A ; STORE NULL IN BUFFER + LD A,20H ; BLANK OUT CHAR ON TERM + CALL COUT ; + LD A,BS ; + CALL COUT ; + JR GETLNLOP ; GET NEXT KEY +GETLNSTORE: + LD (HL),A ; STORE CHAR IN BUFFER + INC HL ; INC POINTER + INC C ; INC CHAR COUNTER + LD A,C ; A=C + CP 4DH ; OUT OF BUFFER SPACE? + JR NZ,GETLNLOP ; NOPE, GET NEXT CHAR +GETLNDONE: + LD (HL),00H ; STORE NULL IN BUFFER + POP DE ; RESTORE DE + RET ; + + +;__KIN___________________________________________________________________________________________________________________________ +; +; READ FROM THE SERIAL PORT AND ECHO & CONVERT INPUT TO UCASE +;________________________________________________________________________________________________________________________________ +; +KIN: + IN A,(UART5) ; READ LINE STATUS REGISTER + BIT 0,A ; TEST IF DATA IN RECEIVE BUFFER + JP Z,KIN ; LOOP UNTIL DATA IS READY + IN A,(UART0) ; THEN READ THE CHAR FROM THE UART + 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 + + +;__COUT__________________________________________________________________________________________________________________________ +; +; WRITE THE VALUE IN "A" TO THE SERIAL PORT +;________________________________________________________________________________________________________________________________ +; +COUT: + PUSH AF ; STORE AF +TX_BUSYLP: + IN A,(UART5) ; READ LINE STATUS REGISTER + BIT 5,A ; TEST IF UART IS READY TO SEND + JP Z,TX_BUSYLP ; IF NOT REPEAT + POP AF ; RESTORE AF + OUT (UART0),A ; THEN WRITE THE CHAR TO UART + RET ; DONE + + +;__CRLF__________________________________________________________________________________________________________________________ +; +; SEND CR & LF TO THE SERIAL PORT +;________________________________________________________________________________________________________________________________ +; +CRLF: + PUSH HL ; PROTECT HL FROM OVERWRITE + LD HL,TCRLF ; LOAD MESSAGE POINTER + CALL MSG ; SEBD MESSAGE TO SERIAL PORT + POP HL ; PROTECT HL FROM OVERWRITE + RET ; + + +;__LDHL__________________________________________________________________________________________________________________________ +; +; GET ONE WORD OF HEX DATA FROM BUFFER POINTED TO BY HL SERIAL PORT, RETURN IN HL +;________________________________________________________________________________________________________________________________ +; +LDHL: + PUSH DE ; STORE DE + CALL HEXIN ; GET K B. AND MAKE HEX + LD D,A ; THATS THE HI BYTE + CALL HEXIN ; DO HEX AGAIN + LD L,A ; THATS THE LOW BYTE + LD H,D ; MOVE TO HL + POP DE ; RESTORE BC + RET ; GO BACK WITH ADDRESS + + +;__HEXIN__________________________________________________________________________________________________________________________ +; +; GET ONE BYTE OF HEX DATA FROM BUFFER IN HL, RETURN IN A +;________________________________________________________________________________________________________________________________ +; +HEXIN: + PUSH BC ;SAVE BC REGS + CALL NIBL ;DO A NIBBLE + RLC A ;MOVE FIRST BYTE UPPER NIBBLE + RLC A ; + RLC A ; + RLC A ; + LD B,A ; SAVE ROTATED BYTE + CALL NIBL ; DO NEXT NIBBLE + ADD A,B ; COMBINE NIBBLES IN ACC + POP BC ; RESTORE BC + RET ; DONE +NIBL: + LD A,(HL) ; GET K B. DATA + INC HL ; INC KB POINTER + CP 40H ; TEST FOR ALPHA + JR NC,ALPH ; + AND 0FH ; GET THE BITS + RET ; +ALPH: + AND 0FH ; GET THE BITS + ADD A,09H ; MAKE IT HEX A-F + RET ; + + +;__HEXINS_________________________________________________________________________________________________________________________ +; +; GET ONE BYTE OF HEX DATA FROM SERIAL PORT, RETURN IN A +;________________________________________________________________________________________________________________________________ +; +HEXINS: + PUSH BC ;SAVE BC REGS + PUSH HL ;SAVE HL REGS + CALL NIBLS ;DO A NIBBLE + RLC A ;MOVE FIRST BYTE UPPER NIBBLE + RLC A ; + RLC A ; + RLC A ; + LD B,A ; SAVE ROTATED BYTE + CALL NIBLS ; DO NEXT NIBBLE + ADD A,B ; COMBINE NIBBLES IN ACC + POP HL ; RESTORE HL + POP BC ; RESTORE BC + RET ; DONE +NIBLS: + CALL KIN ; GET K B. DATA + INC HL ; INC KB POINTER + CP 40H ; TEST FOR ALPHA + JR NC,ALPH ; + AND 0FH ; GET THE BITS + 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 + +;__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 + +;__POUT__________________________________________________________________________________________________________________________ +; +; OUTPUT TO AN I/O PORT, MONITOR COMMAND "O" +;________________________________________________________________________________________________________________________________ +; +POUT: +POUT1: + INC HL ; + CALL HEXIN ; GET PORT + LD C,A ; SAVE PORT POINTER + INC HL ; + CALL HEXIN ; GET DATA +OUTIT: + OUT (C),A ; + JP SERIALCMDLOOP ; + + +;__PIN___________________________________________________________________________________________________________________________ +; +; INPUT FROM AN I/O PORT, MONITOR COMMAND "I" +;________________________________________________________________________________________________________________________________ +; +PIN: + INC HL ; + CALL HEXIN ; GET PORT + LD C,A ; SAVE PORT POINTER + CALL CRLF ; + IN A,(C) ; GET DATA + CALL HXOUT ; SHOW IT + JP SERIALCMDLOOP ; + + + + + +;__CRLFA_________________________________________________________________________________________________________________________ +; +; PRINT COMMAND PROMPT TO THE SERIAL PORT +;________________________________________________________________________________________________________________________________ +; +CRLFA: + PUSH HL ; PROTECT HL FROM OVERWRITE + LD HL,PROMPT ; + CALL MSG ; + POP HL ; PROTECT HL FROM OVERWRITE + RET ; DONE + + +;__MSG___________________________________________________________________________________________________________________________ +; +; PRINT A STRING TO THE SERIAL PORT +;________________________________________________________________________________________________________________________________ +; +MSG: + +TX_SERLP: + LD A,(HL) ; GET CHARACTER TO A + CP ENDT ; TEST FOR END BYTE + JP Z,TX_END ; JUMP IF END BYTE IS FOUND + CALL COUT ; + INC HL ; INC POINTER, TO NEXT CHAR + JP TX_SERLP ; TRANSMIT LOOP +TX_END: + RET ;ELSE DONE + +;__RUN___________________________________________________________________________________________________________________________ +; +; TRANSFER OUT OF MONITOR, USER OPTION "R" +;________________________________________________________________________________________________________________________________ +; +RUN: + INC HL ; SHOW READY + CALL LDHL ; GET START ADDRESS + JP (HL) ; + + +;__PROGRM________________________________________________________________________________________________________________________ +; +; PROGRAM RAM LOCATIONS, USER OPTION "P" +;________________________________________________________________________________________________________________________________ +; +PROGRM: + INC HL ; SHOW READY + PUSH HL ; STORE HL + CALL LDHL ; GET START ADDRESS + LD D,H ; + LD E,L ; DE POINTS TO ADDRESS TO PROGRAM + POP HL ; + INC HL ; + INC HL ; + INC HL ; + INC HL ; + INC HL ; +PROGRMLP: + CALL HEXIN ; GET NEXT HEX NUMBER + LD (DE),A ; STORE IT + INC DE ; NEXT ADDRESS; + CALL CRLFA ; CR,LF,> + LD A,'P' ; + CALL COUT ; + CALL SPACE ; + LD H,D ; + LD L,E ; + CALL PHL ; + LD HL,KEYBUF ; SET POINTER TO KEYBUF AREA + CALL GETLN ; GET A LINE OF INPUT FROM THE USER + LD HL,KEYBUF ; RESET POINTER TO START OF KEYBUF + LD A,(HL) ; LOAD FIRST CHAR INTO A + CP 00H ; END OF LINE? + JP Z,PROGRMEXIT ; YES, EXIT + JP PROGRMLP ; NO, LOOP +PROGRMEXIT: + JP SERIALCMDLOOP + + + + + + + +;__DUMP__________________________________________________________________________________________________________________________ +; +; PRINT A MEMORY DUMP, USER OPTION "D" +;________________________________________________________________________________________________________________________________ +; +DUMP: + INC HL ; SHOW READY + PUSH HL ; STORE HL + CALL LDHL ; GET START ADDRESS + LD D,H ; + LD E,L ; + POP HL ; + PUSH DE ; SAVE START + INC HL ; + INC HL ; + INC HL ; + INC HL ; + INC HL ; + CALL LDHL ; GET END ADDRESS + INC HL ; ADD ONE MORE FOR LATER COMPARE + EX DE,HL ; PUT END ADDRESS IN DE + POP HL ; GET BACK START +GDATA: + CALL CRLF ; +BLKRD: + CALL PHL ; PRINT START LOCATION + LD C,16 ; SET FOR 16 LOCS + PUSH HL ; SAVE STARTING HL +NXTONE: + EXX ; + LD C,E ; + IN A,(C) ; + EXX ; + AND 7FH ; + CP ESC ; + JP Z,SERIALCMDLOOP ; + CP 19 ; + JR Z,NXTONE ; + LD A,(HL) ; GET BYTE + CALL HXOUT ; PRINT IT + CALL SPACE ; +UPDH: + INC HL ; POINT NEXT + DEC C ; DEC LOC COUNT + JR NZ,NXTONE ; IF LINE NOT DONE + ; NOW PRINT 'DECODED' DATA TO RIGHT OF DUMP +PCRLF: + CALL SPACE ; SPACE IT + LD C,16 ; SET FOR 16 CHARS + POP HL ; GET BACK START +PCRLF0: + LD A,(HL) ; GET BYTE + AND 060H ; SEE IF A 'DOT' + LD A,(HL) ; O K. TO GET + JR NZ,PDOT ; +DOT: + LD A,2EH ; LOAD A DOT +PDOT: + CALL COUT ; PRINT IT + INC HL ; + LD A,D ; + CP H ; + JR NZ,UPDH1 ; + LD A,E ; + CP L ; + JP Z,SERIALCMDLOOP ; +; +;IF BLOCK NOT DUMPED, DO NEXT CHARACTER OR LINE +UPDH1: + DEC C ; DEC CHAR COUNT + JR NZ,PCRLF0 ; DO NEXT +CONTD: + CALL CRLF ; + JP BLKRD ; + + +;__HXLOAD__________________________________________________________________________________________________________________________ +; +; LOAD INTEL HEX FORMAT FILE FROM THE SERIAL PORT, USER OPTION "H" +; +; [INTEL HEX FORMAT IS: +; 1) COLON (FRAME 0) +; 2) RECORD LENGTH FIELD (FRAMES 1 AND 2) +; 3) LOAD ADDRESS FIELD (FRAMES 3,4,5,6) +; 4) RECORD TYPE FIELD (FRAMES 7 AND 8) +; 5) DATA FIELD (FRAMES 9 TO 9+2*(RECORD LENGTH)-1 +; 6) CHECKSUM FIELD - SUM OF ALL BYTE VALUES FROM RECORD LENGTH TO AND +; INCLUDING CHECKSUM FIELD = 0 ] +; +; EXAMPLE OF INTEL HEX FORMAT FILE +; EACH LINE CONTAINS A CARRIAGE RETURN AS THE LAST CHARACTER +; :18F900002048454C4C4F20574F524C4420FF0D0AFF0D0A3EFF0D0A54BF +; :18F918006573742050726F746F7479706520524F4D204D6F6E69746FF1 +; :18F9300072205265616479200D0AFF0D0A434F4D4D414E4420524543F2 +; :18F948004549564544203AFF0D0A434845434B53554D204552524F52CD +; :16F96000FF0A0D20202D454E442D4F462D46494C452D20200A0DA4 +; :00000001FF +;________________________________________________________________________________________________________________________________ +HXLOAD: + CALL CRLF ; SHOW READY +HXLOAD0: + CALL KIN ; GET THE FIRST CHARACTER, EXPECTING A ':' +HXLOAD1: + CP 03Ah ; IS IT COLON ':'? START OF LINE OF INTEL HEX FILE + JR NZ,HXLOADERR ; IF NOT, MUST BE ERROR, ABORT ROUTINE + LD E,0 ; FIRST TWO CHARACTERS IS THE RECORD LENGTH FIELD + CALL HEXINS ; GET US TWO CHARACTERS INTO BC, CONVERT IT TO A BYTE + CALL HXCHKSUM ; UPDATE HEX CHECK SUM + LD D,A ; LOAD RECORD LENGTH COUNT INTO D + CALL HEXINS ; GET NEXT TWO CHARACTERS, MEMORY LOAD ADDRESS + CALL HXCHKSUM ; UPDATE HEX CHECK SUM + LD H,A ; PUT VALUE IN H REGISTER + CALL HEXINS ; GET NEXT TWO CHARACTERS, MEMORY LOAD ADDRESS + CALL HXCHKSUM ; UPDATE HEX CHECK SUM + LD L,A ; PUT VALUE IN L REGISTER + CALL HEXINS ; GET NEXT TWO CHARACTERS, RECORD FIELD TYPE + CALL HXCHKSUM ; UPDATE HEX CHECK SUM + CP 001h ; RECORD FIELD TYPE 00 IS DATA, 01 IS END OF FILE + JR NZ,HXLOAD2 ; MUST BE THE END OF THAT FILE + CALL HEXINS ; GET NEXT TWO CHARACTERS, ASSEMBLE INTO BYTE + CALL HXCHKSUM ; UPDATE HEX CHECK SUM + LD A,E ; RECALL THE CHECKSUM BYTE + AND A ; IS IT ZERO? + JP Z,HXLOADEXIT ; MUST BE O K., GO BACK FOR SOME MORE, ELSE + JR HXLOADERR ; CHECKSUMS DON'T ADD UP, ERROR OUT +HXLOAD2: + LD A,D ; RETRIEVE LINE CHARACTER COUNTER + AND A ; ARE WE DONE WITH THIS LINE? + JR Z,HXLOAD3 ; GET TWO MORE ASCII CHARACTERS, BUILD A BYTE AND CHECKSUM + CALL HEXINS ; GET NEXT TWO CHARS, CONVERT TO BYTE IN A, CHECKSUM IT + CALL HXCHKSUM ; UPDATE HEX CHECK SUM + LD (HL),A ; CHECKSUM OK, MOVE CONVERTED BYTE IN A TO MEMORY LOCATION + INC HL ; INCREMENT POINTER TO NEXT MEMORY LOCATION + DEC D ; DECREMENT LINE CHARACTER COUNTER + JR HXLOAD2 ; AND KEEP LOADING INTO MEMORY UNTIL LINE IS COMPLETE +HXLOAD3: + CALL HEXINS ; GET TWO CHARS, BUILD BYTE AND CHECKSUM + CALL HXCHKSUM ; UPDATE HEX CHECK SUM + LD A,E ; CHECK THE CHECKSUM VALUE + AND A ; IS IT ZERO? + JR Z,HXLOADAGAIN ; IF THE CHECKSUM IS STILL OK, CONTINUE ON, ELSE +HXLOADERR: + LD HL,TXT_CKSUMERR ; GET "CHECKSUM ERROR" MESSAGE + CALL MSG ; PRINT MESSAGE FROM (HL) AND TERMINATE THE LOAD + JP HXLOADEXIT ; RETURN TO PROMPT +HXCHKSUM: + LD C,A ; BUILD THE CHECKSUM + LD A,E ; + SUB C ; THE CHECKSUM SHOULD ALWAYS EQUAL ZERO WHEN CHECKED + LD E,A ; SAVE THE CHECKSUM BACK WHERE IT CAME FROM + LD A,C ; RETRIEVE THE BYTE AND GO BACK + RET ; BACK TO CALLER +HXLOADAGAIN: + CALL KIN ; CATCH THE TRAILING CARRIAGE RETURN + JP HXLOAD0 ; LOAD ANOTHER LINE OF DATA +HXLOADEXIT: + CALL KIN ; CATCH ANY STRAY TRAILING CHARACTERS + JP SERIALCMDLOOP ; RETURN TO PROMPT + + +;__MOVE__________________________________________________________________________________________________________________________ +; +; MOVE MEMORY, USER OPTION "M" +;________________________________________________________________________________________________________________________________ +; +MOVE: + LD C,03 + ; START GETNM REPLACEMENT + ; GET SOURCE STARTING MEMORY LOCATION + INC HL ; SHOW EXAMINE READY + PUSH HL ; + CALL LDHL ; LOAD IN HL REGS + LD D,H ; + LD E,L ; + POP HL ; + PUSH DE ; PUSH MEMORY ADDRESS ON STACK + INC HL ; + INC HL ; + INC HL ; + INC HL ; + INC HL ; PRINT SPACE SEPARATOR + PUSH HL ; + CALL LDHL ; LOAD IN HL REGS + LD D,H ; + LD E,L ; + POP HL ; + PUSH DE ; PUSH MEMORY ADDRESS ON STACK + INC HL ; + INC HL ; + INC HL ; + INC HL ; + INC HL ; PRINT SPACE SEPARATOR + CALL LDHL ; LOAD IN HL REGS + PUSH HL ; PUSH MEMORY ADDRESS ON STACK + ; END GETNM REPLACEMENT + POP DE ; DEST + POP BC ; SOURCE END + POP HL ; SOURCE + PUSH HL ; + LD A,L ; + CPL ; + LD L,A ; + LD A,H ; + CPL ; + LD H,A ; + INC HL ; + ADD HL,BC ; + LD C,L ; + LD B,H ; + POP HL ; + CALL MOVE_LOOP ; + JP SERIALCMDLOOP ; EXIT MOVE COMMAND ROUTINE +MOVE_LOOP: + LD A,(HL) ; FETCH + LD (DE),A ; DEPOSIT + INC HL ; BUMP SOURCE + INC DE ; BUMP DEST + DEC BC ; DEC COUNT + LD A,C ; + OR B ; + JP NZ,MOVE_LOOP ; TIL COUNT=0 + RET ; + +;__FILL__________________________________________________________________________________________________________________________ +; +; FILL MEMORY, USER OPTION "M" +;________________________________________________________________________________________________________________________________ +; +FILL: + LD C,03 ; + ; START GETNM REPLACEMENT + ; GET FILL STARTING MEMORY LOCATION + INC HL ; SHOW EXAMINE READY + PUSH HL ; + CALL LDHL ; LOAD IN HL REGS + LD D,H ; + LD E,L ; + POP HL ; + PUSH DE ; PUSH MEMORY ADDRESS ON STACK + INC HL ; + INC HL ; + INC HL ; + INC HL ; + INC HL ; PRINT SPACE SEPARATOR + ; GET FILL ENDING MEMORY LOCATION + PUSH HL ; + CALL LDHL ; LOAD IN HL REGS + LD D,H ; + LD E,L ; + POP HL ; + PUSH DE ; PUSH MEMORY ADDRESS ON STACK + INC HL ; + INC HL ; + INC HL ; + INC HL ; + INC HL ; PRINT SPACE SEPARATOR + ; GET TARGET STARTING MEMORY LOCATION + CALL HEXIN ; GET K B. AND MAKE HEX + LD C,A ; PUT FILL VALUE IN F SO IT IS SAVED FOR LATER + PUSH BC ; PUSH FILL VALUE BYTE ON STACK + ; END GETNM REPLACEMENT + POP BC ; BYTE + POP DE ; END + POP HL ; START + LD (HL),C ; +FILL_LOOP: + LD (HL),C ; + INC HL ; + LD A,E ; + SUB L ; + LD B,A ; + LD A,D ; + SUB H ; + OR B ; + JP NZ,FILL_LOOP ; + JP SERIALCMDLOOP ; + + +;__DOBOOT________________________________________________________________________________________________________________________ +; +; PERFORM BOOT +;________________________________________________________________________________________________________________________________ +; +DOBOOT: +; LD A,0H ; LOAD VALUE TO SWITCH OUT ROM + LD A,80H ; LOAD VALUE TO SWITCH OUT ROM + OUT (MPCL_ROM),A ; SWITCH OUT ROM, BRING IN LOWER 32K RAM PAGE + ; + ; + OUT (MPCL_RAM),A ; +; JP 0000H ; GO TO CP/M + + + +;__GOCPM_________________________________________________________________________________________________________________________ +; +; BOOT CP/M FROM ROM DRIVE, USER OPTION "C" +;________________________________________________________________________________________________________________________________ +; +GOCPM: +;___________________________ +; REMOVE COMMENTS WHEN BURNED IN ROM +;___________________________ + +; LD A,000000000b ; RESET MPCL LATCH TO DEFAULT ROM +; OUT (MPCL),A ; +; LD HL,ROMSTART_CPM ; WHERE IN ROM CP/M IS STORED (FIRST BYTE) +; LD DE,RAMTARG_CPM ; WHERE IN RAM TO MOVE MONITOR TO (FIRST BYTE) +; LD BC,MOVSIZ_CPM ; NUMBER OF BYTES TO MOVE FROM ROM TO RAM +; LDIR ; PERFORM BLOCK COPY OF CP/M TO UPPER RAM PAGE +; LD A,010000000b ; RESET MPCL LATCH TO DEFAULT CP/M WITH 64K SETTING +; OUT (MPCL),A ; + +; JP 0EA00h ; CP/M COLD BOOT ENTRY POINT + RET ; RETURN TO CP/M + +; +;__INIT_UART_____________________________________________________________________________________________________________________ +; +; INITIALIZE UART +; PARAMS: SER_BAUD NEEDS TO BE SET TO BAUD RATE +; 1200: 96 = 1,843,200 / ( 16 X 1200 ) +; 2400: 48 = 1,843,200 / ( 16 X 2400 ) +; 4800: 24 = 1,843,200 / ( 16 X 4800 ) +; 9600: 12 = 1,843,200 / ( 16 X 9600 ) +; 19K2: 06 = 1,843,200 / ( 16 X 19,200 ) +; 38K4: 03 +; 57K6: 02 +; 115K2: 01 +; +;_________________________________________________________________________________________________________________________________ +; +INIT_UART: + LD A,80H ; + OUT (UART3),A ; SET DLAB FLAG + LD A,(SER_BAUD) ; + OUT (UART0),A ; + LD A,00H ; + OUT (UART1),A ; + LD A,03H ; + OUT (UART3),A ; SET 8 BIT DATA, 1 STOPBIT + LD A,03H ; set DTR & RTS + OUT (UART4),A ; + RET + + +; +;__FILL_MEM_______________________________________________________________________________________________________________________ +; +; FUNCTION : FILL MEMORY WITH A VALUE +; INPUT : HL = START ADDRESS BLOCK +; : BC = LENGTH OF BLOCK +; : A = VALUE TO FILL WITH +; USES : DE, BC +; OUTPUT : +; CALLS : +; TESTED : 13 FEB 2007 +;_________________________________________________________________________________________________________________________________ +; +FILL_MEM: + LD E,L ; + LD D,H ; + INC DE ; + LD (HL),A ; INITIALISE FIRST BYTE OF BLOCK WITH DATA BYTE IN A + DEC BC ; + LDIR ; FILL MEMORY + RET ; RETURN TO CALLER +; +;__RAM_TEST________________________________________________________________________ +; +; TEST FUNCTIONALITY OF LOWER 32KB RAM PAGE, USER OPTION "A" +; SYNTAX: A +;_____________________________________________________________________________ +; + +DORAMTEST: + +; VERIFY DATA BUS FUNCTIONALITY BEFORE STARTING MEMORY TEST +DATABUSTEST: + LD A,$80 ; FIRST 32KB PAGE ONLY + LD (PAGE_NUM),A ; STORE WORKING PAGE NUMBER + OUT (MPCL_ROM),A ; SWITCH OUT LOWER 32KB ROM PAGE + OUT (MPCL_RAM),A ; SWITCH IN LOWER 32KB RAM PAGE + LD A,$00 ; INITIALIZE A TO 0 + +DATABUSCHECK: + LD C,A + LD ($0000),A ; WRITE TO LOWEST RAM ADDRESS + LD A,($0000) ; READ VALUE FROM LOWEST RAM ADDRESS + CP C ; IS IT SAME AS WRITTEN? + JP NZ,DATABUSFAIL ; NO? DATA BUS FAIL HANDLER ROUTINE + INC A ; YES, GET NEXT VALUE + JP NZ,DATABUSCHECK ; REPEAT FOR ALL 256 VALUES + LD HL,TXT_DATA_BUS_PASS ; POINT AT DATA BUS PASS TEXT + CALL MSG ; PRINT DATA BUS PASS LABEL + JP ADDRBUSTEST ; CONTINUE WITH ADDRESS BUS TEST + +DATABUSFAIL: + PUSH AF ; STORE FAILED VALUE + LD HL,TXT_DATA_BUS_FAIL ; POINT AT DATA BUS FAIL TEXT + CALL MSG ; PRINT DATA BUS FAIL LABEL + POP AF ; RETRIEVE FAILED VALUE + CALL HXOUT ; SHOW VALUE THAT FAILED + LD HL,TCRLF ; CR & LF + CALL MSG ; DISPLAY IT + JP SERIALCMDLOOP ; AND BACK TO COMMAND LOOP + +; VERIFY ADDRESS BUS FUNCTIONALITY BEFORE STARTING MEMORY TEST +ADDRBUSTEST: + LD A,$80 ; FIRST 32KB PAGE ONLY + LD (PAGE_NUM),A ; STORE WORKING PAGE NUMBER + OUT (MPCL_ROM),A ; SWITCH OUT LOWER 32KB ROM PAGE + OUT (MPCL_RAM),A ; SWITCH IN LOWER 32KB RAM PAGE + LD A,$00 ; INITIALIZE A TO 0 + LD ($0000),A ; WRITE TO LOWEST RAM ADDRESS + LD HL,$0001 ; INITIALIZE HL TO CHECK A0 + +ADDRBUSCHECK: + LD (HL),$FF ; WRITE ALL ONES INTO HL ADDRESS + LD C,$00 + LD A,($0000) ; READ VALUE FROM LOWEST RAM ADDRESS + CP C ; IS IT SAME AS WRITTEN? SHOULD BE 0 + JP NZ,ADDRBUSFAIL ; NO? ADDR BUS FAIL HANDLER ROUTINE + PUSH HL ; STORE HL, FOR COPY TO BC + POP BC ; RETRIEVE BC (SAME AS HL) + ADD HL,BC ; INCREMENT TO NEXT ADDR LINE + LD A,H ; WHICH ADDRESS LINE ARE WE AT + CP $80 ; ARE WE AT A15? + JP NZ,ADDRBUSCHECK ; NO? REPEAT FOR ALL 15 VALUES + LD HL,TXT_ADDR_BUS_PASS ; YES? POINT AT ADDR BUS PASS TEXT + CALL MSG ; PRINT ADDR BUS PASS LABEL + JP MEMSIZELOOP ; CONTINUE WITH REST OF RAM TEST + +ADDRBUSFAIL: + PUSH HL ; STORE FAILED ADDR LINE VALUE + LD HL,TXT_ADDR_BUS_FAIL ; POINT AT ADDR BUS FAIL TEXT + CALL MSG ; PRINT ADDR BUS FAIL LABEL + POP HL ; RETRIEVE FAILED ADDR LINE VALUE + LD A,H ; PRINT UPPER HALF OF ADDRESS + PUSH HL ; STORE FAILED ADDR LINE VALUE + CALL HXOUT ; PRINT HIGH ADDR HALF THAT FAILED + POP HL ; RETRIEVE FAILED ADDR LINE VALUE + LD A,L ; PRINT LOWER HALF OF ADDRESS + CALL HXOUT ; PRINT LOW ADDR HALF THAT FAILED + LD HL,TCRLF ; CR & LF + CALL MSG ; DISPLAY IT + JP SERIALCMDLOOP ; AND BACK TO COMMAND LOOP + +MEMSIZELOOP: + LD HL,TXT_RAM_TEST_MAIN ; POINT AT RAM TEST MAIN MENU TEXT + CALL MSG ; PRINT MENU TEXT LABEL + CALL CRLFA ; CR,LF,> + LD HL,KEYBUF ; SET POINTER TO KEYBUF AREA + CALL GETLN ; GET A LINE OF INPUT FROM THE USER + LD HL,KEYBUF ; RESET POINTER TO START OF KEYBUF + LD A,(HL) ; LOAD FIRST CHAR INTO A (THIS SHOULD BE THE MEM SIZE FOR TEST) + INC HL ; INC POINTER + + CP 'A' ; IS IT "A" (Y/N) + JP Z,MEM32KB ; IF YES DO 32KB RAM TEST + CP 'B' ; IS IT "B" (Y/N) + JP Z,MEM64KB ; IF YES DO 64KB RAM TEST + CP 'C' ; IS IT "C" (Y/N) + JP Z,MEM128KB ; IF YES DO 128KB RAM TEST + CP 'D' ; IS IT "D" (Y/N) + JP Z,MEM256KB ; IF YES DO 256KB RAM TEST + CP 'E' ; IS IT "E" (Y/N) + JP Z,MEM512KB ; IF YES DO 512KB RAM TEST + CP 'F' ; IS IT "F" (Y/N) + JP Z,MEM1024KB ; IF YES DO 1024KB RAM TEST + LD HL,TXT_COMMAND ; POINT AT ERROR TEXT + CALL MSG ; PRINT COMMAND LABEL + + JR MEMSIZELOOP + +MEM32KB: + LD HL,TXT_RAM_TEST_32KB ; 1 PAGE, 32KB RAM TEST SELECTED + CALL MSG ; DISPLAY IT + + LD A,$80 ; ONE 32KB PAGE ONLY + LD (PAGE_NUM),A ; STORE WORKING PAGE NUMBER + JP RAMTEST + +MEM64KB: + LD HL,TXT_RAM_TEST_64KB ; 2 PAGE, 64KB RAM TEST SELECTED + CALL MSG ; DISPLAY IT + + LD A,$81 ; TWO 32KB PAGES + LD (PAGE_NUM),A ; STORE WORKING PAGE NUMBER + JP RAMTEST + +MEM128KB: + LD HL,TXT_RAM_TEST_128KB ; 4 PAGE, 12864KB RAM TEST SELECTED + CALL MSG ; DISPLAY IT + + LD A,$83 ; FOUR 32KB PAGES + LD (PAGE_NUM),A ; STORE WORKING PAGE NUMBER + JP RAMTEST + +MEM256KB: + LD HL,TXT_RAM_TEST_256KB ; 8 PAGE, 256KB RAM TEST SELECTED + CALL MSG ; DISPLAY IT + + LD A,$87 ; EIGHT 32KB PAGES + LD (PAGE_NUM),A ; STORE WORKING PAGE NUMBER + JP RAMTEST + +MEM512KB: + LD HL,TXT_RAM_TEST_512KB ; 16 PAGE, 512KB RAM TEST SELECTED + CALL MSG ; DISPLAY IT + + LD A,$8F ; SIXTEEN 32KB PAGES + LD (PAGE_NUM),A ; STORE WORKING PAGE NUMBER + JP RAMTEST + +MEM1024KB: + LD HL,TXT_RAM_TEST_1024KB ; 32 PAGE, 1024KB RAM TEST SELECTED + CALL MSG ; DISPLAY IT + + LD A,$9F ; THIRTY-TWO 32KB PAGES + LD (PAGE_NUM),A ; STORE WORKING PAGE NUMBER + JP RAMTEST + +RAMTEST: + LD A,(PAGE_NUM) ; GET WORKING PAGE NUMBER + CP $8F ; IS IT PAGE SIXTEEN? + JP NZ,NEXTPAGE ; NO? DO ANOTHER 32KB PAGE + SUB $01 ; YES? SKIP OVER PAGE SIXTEEN + ; (WHERE RAMTEST PROGRAM IS RUNNING) + LD (PAGE_NUM),A ; UPDATE WORKING PAGE NUMBER + + LD HL,TXT_SKIP_16 ; POINT AT SYNTAX SKIP PAGE SIXTEEN + CALL MSG ; DISPLAY IT + + JP RAMTEST ; TRY AGAIN WITH NEXT RAM PAGE + +NEXTPAGE: + OUT (MPCL_ROM),A ; SWITCH OUT LOWER 32KB ROM PAGE + OUT (MPCL_RAM),A ; SWITCH IN LOWER 32KB RAM PAGE + + LD HL,$7FFF ; INITIALIZE MEMORY ADDRESS COUNT + LD DE,$0001 ; DECREMENT VALUE + LD IX,TEST_VALUES ; MEMORY TEST VALUES + +START: + LD A,(IX+0) ; LOAD TEST VALUE + LD B,A ; STORE TEST VALUE IN B + CP '$' ; IS IT LAST ONE? + JP Z,RAM_PASS ; YES?, RAM PASSED TEST, EXIT RAM TEST + + LD (HL),A ; NO?, WRITE TO MEMORY ADDRESS + LD C,(HL) ; LOAD VALUE FROM MEMORY ADDRESS + CP C ; IS IT SAME AS WRITTEN? + JP NZ,RAM_FAIL ; NO?, JUMP TO ERROR HANDLER ROUTINE + + SBC HL,DE ; REDUCE MEMORY ADDRESS COUNT BY 1 + JP NZ,START ; LOOP THROUGH ALL MEMORY IN LOWER 32KB PAGE + + ; DO $0000 MEMORY ADDRESS + LD (HL),A ; NO?, WRITE TO MEMORY ADDRESS + LD C,(HL) ; LOAD VALUE FROM MEMORY ADDRESS + CP C ; IS IT SAME AS WRITTEN? + JP NZ,RAM_FAIL ; NO?, JUMP TO ERROR HANDLER ROUTINE + + INC IX ; POINT TO NEXT TEST VALUE + LD HL,$7FFF ; INITIALIZE MEMORY ADDRESS COUNT + JP START ; START AGAIN, TEST ALL MEMORY LOCATIONS WITH NEW TEST VALUE + +RAM_PASS: + LD HL,TXT_RAM_PASS ; POINT AT SYNTAX RAM PASS TEXT + CALL MSG ; DISPLAY IT + + LD A,(PAGE_NUM) ; GET WORKING PAGE NUMBER + SUB $80 ; CONVERT MPCL VALUE TO PAGE NUMBER + CALL HXOUT ; SHOW IT + + LD A,(PAGE_NUM) ; GET WORKING PAGE NUMBER + DEC A ; MARK PAGE COMPLETE, MOVE TO NEXT + LD (PAGE_NUM),A ; STORE UPDATED PAGE NUMBER + + CP $7F ; WAS THAT THE LAST PAGE? + JP NZ,RAMTEST ; NO? DO ANOTHER 32KB PAGE + + LD HL,TCRLF ; CR & LF + CALL MSG ; DISPLAY IT + JP SERIALCMDLOOP ; YES? BACK TO COMMAND LOOP + + +RAM_FAIL: + PUSH HL + LD HL,TXT_RAM_FAIL1 ; POINT AT 1ST SYNTAX RAM FAIL TEXT + CALL MSG ; DISPLAY IT + LD A,(PAGE_NUM) ; GET CURRENT PAGE NUMBER + SUB $80 + CALL HXOUT ; SHOW IT + LD HL,TXT_RAM_FAIL2 ; POINT AT 2ND SYNTAX RAM FAIL TEXT + CALL MSG ; DISPLAY IT + + POP HL ; RETRIEVE FAILED ADDR VALUE + LD A,H ; PRINT UPPER HALF OF ADDRESS + PUSH HL ; STORE FAILED ADDR VALUE + CALL HXOUT ; PRINT HIGH ADDR HALF THAT FAILED + POP HL ; RETRIEVE FAILED ADDR LINE VALUE + LD A,L ; PRINT LOWER HALF OF ADDRESS + CALL HXOUT ; PRINT LOW ADDR HALF THAT FAILED + LD HL,TCRLF ; CR & LF + CALL MSG ; DISPLAY IT + + LD A,(PAGE_NUM) ; GET WORKING PAGE NUMBER + DEC A ; MARK PAGE COMPLETE, MOVE TO NEXT + LD (PAGE_NUM),A ; STORE UPDATED PAGE NUMBER + CP $7F ; WAS THAT THE LAST PAGE? + JP NZ,RAMTEST ; NO? DO ANOTHER 32KB PAGE + JP SERIALCMDLOOP ; AND BACK TO COMMAND LOOP + + +; +;__INITIALIZE_____________________________________________________________________________________________________________________ +; +; INITIALIZE SYSTEM +;_________________________________________________________________________________________________________________________________ +; +INITIALIZE: +; LD A,12 ; SPECIFY BAUD RATE 9600 BPS (9600,8,NONE,1) + LD A,3 ; SPECIFY BAUD RATE 38400 BPS (9600,8,NONE,1) + LD (SER_BAUD),A ; + CALL INIT_UART ; INIT THE UART + RET ; +; + +;__MTERM_INIT________________________________________________________________________________________ +; +; SETUP 8255, MODE 0, PORT A=OUT, PORT B=IN, PORT C=OUT/OUT +; +;____________________________________________________________________________________________________ +MTERM_INIT: + LD A, 82H + OUT (PIOCONT),A + RET + +; +;__TEXT_STRINGS_________________________________________________________________________________________________________________ +; +; SYSTEM TEXT STRINGS +;_____________________________________________________________________________________________________________________________ +; +TCRLF: + .DB CR,LF,ENDT + +PROMPT: + .DB CR,LF,'>',ENDT + +TXT_READY: + .DB "RAM TEST PROGRAM",CR,LF + .DB CR,LF + .DB "MONITOR READY " + .DB CR,LF,ENDT + +TXT_COMMAND: + .DB CR,LF + .DB "UNKNOWN COMMAND." + .DB ENDT + +TXT_MAIN_MENU: + .DB CR,LF + .DB "MAIN MENU: " + .DB "A RAM TEST, " + .DB "B BOOT, " + .DB "D DUMP, " + .DB "F FILL, " + .DB "H LOAD, " + .DB CR,LF + .DB "I INPUT, " + .DB "K ECHO, " + .DB "M MOVE, " + .DB "O OUTPUT, " + .DB "P PROGRAM, " + .DB "R RUN" + .DB CR,LF + .DB ENDT + +TXT_CKSUMERR: + .DB CR,LF + .DB "CHECKSUM ERROR." + .DB ENDT + +TXT_RAM_PASS: + .DB CR,LF + .DB "RAM PASS, PAGE = " + .DB ENDT + +TXT_RAM_FAIL1: + .DB CR,LF + .DB "RAM FAIL, 32KB PAGE NUMBER: " + .DB ENDT + +TXT_RAM_FAIL2: + .DB CR,LF + .DB " ADDRESS " + .DB CR,LF,ENDT + +TXT_DATA_BUS_FAIL: + .DB CR,LF + .DB "DATA BUS FAIL, VALUE =" + .DB ENDT + +TXT_DATA_BUS_PASS: + .DB CR,LF + .DB "DATA BUS PASS " + .DB CR,LF,ENDT + +TXT_ADDR_BUS_FAIL: + .DB CR,LF + .DB "ADDR BUS FAIL, VALUE =" + .DB ENDT + +TXT_ADDR_BUS_PASS: + .DB CR,LF + .DB "ADDR BUS PASS " + .DB CR,LF,ENDT + +TXT_SKIP_16: + .DB CR,LF + .DB "SKIPPING PAGE 0F " + .DB ENDT + +TXT_RAM_TEST_MAIN: + .DB CR,LF + .DB "ENTER RAM SIZE: A=32KB, B=64KB," + .DB " C=128KB, D=256KB, E=512KB," + .DB " F=1024KB" + .DB CR,LF,ENDT + +TXT_RAM_TEST_32KB: + .DB CR,LF + .DB "ONE 32KB PAGE SELECTED" + .DB CR,LF,ENDT + +TXT_RAM_TEST_64KB: + .DB CR,LF + .DB "TWO 32KB PAGES SELECTED" + .DB CR,LF,ENDT + +TXT_RAM_TEST_128KB: + .DB CR,LF + .DB "FOUR 32KB PAGES SELECTED" + .DB CR,LF,ENDT + +TXT_RAM_TEST_256KB: + .DB CR,LF + .DB "EIGHT 32KB PAGES SELECTED" + .DB CR,LF,ENDT + +TXT_RAM_TEST_512KB: + .DB CR,LF + .DB "SIXTEEN 32KB PAGES SELECTED" + .DB CR,LF,ENDT + +TXT_RAM_TEST_1024KB: + .DB CR,LF + .DB "THIRTY-TWO 32KB PAGES SELECTED" + .DB CR,LF,ENDT + +; +;__RAM_TEST_VALUES____________________________________________________________ +; +; RAM TEST VALUES +;_____________________________________________________________________________ +; +TEST_VALUES .DB $00,$FF,$33,$CC,$55,$AA,'$' + +; +;__WORK_AREA___________________________________________________________________________________________________________________ +; +; RESERVED RAM FOR MONITOR WORKING AREA +;_____________________________________________________________________________________________________________________________ +; +SER_BAUD: .FILL 1 ; SPECIFY DESIRED UART COM RATE IN BPS +PAGE_NUM .FILL 1 +KEYBUF: .DB " " + .DB " " + .DB " " + .DB " " + .DB " " + +;********************* END OF PROGRAM *********************************** + .FILL 08FFFh-$ + .ORG 08FFFh + .DB 000h + .END + + + diff --git a/Source/Apps/Test/ramtest/loader.asm b/Source/Apps/Test/ramtest/loader.asm new file mode 100644 index 00000000..f239a443 --- /dev/null +++ b/Source/Apps/Test/ramtest/loader.asm @@ -0,0 +1,55 @@ +; Z80 +;*********************************** +;* Z80 TEST PROTOTYPE +;* LOAD MONITOR FROM ROM INTO RAM AND EXECUTE PROGRAM +;* ANDREW LYNCH +;* LYNCHAJ@YAHOO COM +;* 15 FEB 2007 +;*********************************** + + +;********************* CONSTANTS **************************************** + +RAMTOP: .EQU 0FFFFh ; HIGHEST ADDRESSABLE MEMORY LOCATION +MONSTART: .EQU 08000h ; START OF 6116 SRAM 2KB X 8 RAM F800H-FFFFH +RAMBOTTOM: .EQU 08000h ; BEGINNING OF UPPER 32K RAM PAGE +END: .EQU 0FFh ; MARK END OF TEXT +CR: .EQU 0DH ; ASCII CARRIAGE RETURN CHARACTER +LF: .EQU 0AH ; ASCII LINE FEED CHARACTER +ESC: .EQU 1BH ; ASCII ESCAPE CHARACTER + +ROMSTART_MON: .EQU 00200h ; WHERE THE DBGMON IS STORED IN ROM +RAMTARG_MON: .EQU 08000h ; WHERE THE DBGMON STARTS IN RAM (ENTRY POINT) +MOVSIZ_MON: .EQU 01000h ; DBGMON IS 4096 BYTES IN LENGTH + +MON_ENTRY: .EQU 08000h ; DBGMON ENTRY POINT (MAY CHANGE) + + + +;******************************************************************* +;* START AFTER RESET +;* FUNCTION : READY SYSTEM, LOAD MONITOR INTO RAM AND START +;******************************************************************* + + .ORG 00100h + +; DI ; DISABLE INTERRUPT + LD SP,RAMTOP ; SET STACK POINTER TO TOP OF RAM +; IM 1 ; SET INTERRUPT MODE 1 + + LD HL,ROMSTART_MON ; WHERE IN ROM DBGMON IS STORED (FIRST BYTE) + LD DE,RAMTARG_MON ; WHERE IN RAM TO MOVE MONITOR TO (FIRST BYTE) + LD BC,MOVSIZ_MON ; NUMBER OF BYTES TO MOVE FROM ROM TO RAM + LDIR ; PERFORM BLOCK COPY OF DBGMON TO UPPER RAM PAGE + +; EI ; ENABLE INTERRUPTS (ACCESS TO MONITOR WHILE CP/M RUNNING) + + JP MON_ENTRY ; JUMP TO START OF MONITOR + + .FILL 001FFh-$ + + .ORG 001FFh +FLAG: + .DB 0FFh + + .END diff --git a/Source/Apps/Test/ramtest/ramtest.bat b/Source/Apps/Test/ramtest/ramtest.bat new file mode 100644 index 00000000..8d78b069 --- /dev/null +++ b/Source/Apps/Test/ramtest/ramtest.bat @@ -0,0 +1,8 @@ +set TOOLS=../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t80 -b -fFF loader.asm loader.bin loader.lst +tasm -t80 -b -fFF dbgmon.asm dbgmon.bin dbgmon.lst + +copy /Y /b loader.bin+dbgmon.bin ramtest.com diff --git a/Source/Apps/Test/ramtest/ramtest.sh b/Source/Apps/Test/ramtest/ramtest.sh new file mode 100644 index 00000000..adbb2055 --- /dev/null +++ b/Source/Apps/Test/ramtest/ramtest.sh @@ -0,0 +1,3 @@ +../../../Tools/unix/uz80as/uz80as -t z80 loader.asm loader.bin +../../../Tools/unix/uz80as/uz80as -t z80 dbgmon.asm dbgmon.bin +cat loader.bin dbgmon.bin > ramtest.com diff --git a/Source/Apps/Test/rzsz/Build.cmd b/Source/Apps/Test/rzsz/Build.cmd new file mode 100644 index 00000000..42fd5b5f --- /dev/null +++ b/Source/Apps/Test/rzsz/Build.cmd @@ -0,0 +1,17 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t80 -b -f00 rz.asm rz.com rz.lst || exit /b +tasm -t80 -b -f00 sz.asm sz.com sz.lst || exit /b + +:: Compare to original distribution +:: Need to remove these lines when starting to make actual changes +fc /B rz.com rz.com.orig || exit /b +fc /B sz.com sz.com.orig || exit /b + +copy /Y rz.com ..\..\..\..\Binary\Apps\Test\ || exit /b +copy /Y sz.com ..\..\..\..\Binary\Apps\Test\ || exit /b diff --git a/Source/Apps/Test/rzsz/Clean.cmd b/Source/Apps/Test/rzsz/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/rzsz/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/rzsz/Makefile b/Source/Apps/Test/rzsz/Makefile new file mode 100644 index 00000000..52710d6b --- /dev/null +++ b/Source/Apps/Test/rzsz/Makefile @@ -0,0 +1,7 @@ +OBJECTS = rz.com sz.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/Test/rzsz/rz.asm b/Source/Apps/Test/rzsz/rz.asm new file mode 100644 index 00000000..25550523 --- /dev/null +++ b/Source/Apps/Test/rzsz/rz.asm @@ -0,0 +1,3556 @@ +; rz (receive Zmodem) is a disassembly of CP/M 3 binaries by Wilfried Schmitten released in 1992. +; this file is an attempt to reconstruct the Z80 assembler source code which has been lost +; credit to Wilfried Schmitten for writing this program initially + +; +; +-----------------------------------------------------------------+ +; | This file is generated by The Interactive Disassembler (IDA) FW | +; | Copyright (c) 1997 by DataRescue sprl, | +; | Professional version of IDA is at http://www.idapro.com | +; +-----------------------------------------------------------------+ +; + + +; File Name C:\RZ.COM +; Format COM File +; Base Address: 0000h Range: 0100h - 1800h Loaded length: 1700h + +; Processor: z80 +; Target assembler: Table Driven Assembler (TASM) by Speech Technology Inc. + +cpm .equ 0000h +iobyte .equ 0004h +bdos .equ 0005h + +C_READ .equ 1 +A_READ .equ 3 +A_WRITE .equ 4 +A_STATIN .equ 7 +A_STAT_OUT .equ 8 +C_WRITESTR .equ 9 +C_STAT .equ 11 +S_BDOSVER .equ 12 +DRV_SET .equ 14 +F_OPEN .equ 15 +F_CLOSE .equ 16 +F_SFIRST .equ 17 +F_DELETE .equ 19 +F_WRITE .equ 21 +F_MAKE .equ 22 +DRV_GET .equ 25 +F_DMAOFF .equ 26 +F_USERNUM .equ 32 +DRV_DPB .equ 33 +F_SIZE .equ 35 +F_MULTISEC .EQU 44 +S_SYSVAR .equ 49 + +buf_len: .equ 80h +rbuf_size .equ 1000h + +;---------------------------------------------------------------------------- + + .org 100h + +start: ld sp, nstack ; Setup local stack + ld c,S_BDOSVER ; Get CP/M version # + call bdos + cp 30h ; Exit if less than + jp c,err_vern ; CP/M 3 + ld de,str_welc + ld c,C_WRITESTR ; display version + call bdos ; welcome message + call sub_195 + ld hl,(word_179E) ; zero first 20 + xor a ; bytes of + ld b,20 ; free memory + call fill_bhla + ld a,(buf_len) ; if there is nothing in + or a ; the command line buffer + jr z,skip_cl ; go wait for transfer + + ld (hl),2 + ld de,82h + ex de,hl + ld a,0FFh + call sub_172E + jp nz, err_exit + ld hl,(word_179E) + inc hl + ld a,(hl) + or a + jp z,skip_cl + inc hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(de) + cp '-' + jr nz,loc_152 + call sub_39A + ld e,(hl) + inc hl + ld d,(hl) + ld a,d + or e + jr z,skip_cl +loc_152: ld hl,file_fcb + ex de,hl + call sub_1492 + ld hl,file_fcb + xor a + or (hl) + jr nz,loc_164 + ld a,(byte_17A1) + ld (hl),a +loc_164: ld bc,0Dh + add hl,bc + dec de + ldi + ld de,file_fcb + call sub_1B0 + call clo_c +skip_cl: ld de,str_sxfr ; display start + ld c,C_WRITESTR ; tranfer message + call bdos + call sub_3EF + call sub_8D1 + call sub_451 +smod_b_186: .equ $+1 +loc_185: ld bc,0 + ld (word_17A2),bc + ld de,file_fcb + call sub_1B0 + jp cpm + + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_195: ld a,(iobyte) + ld b,a + rlca + rlca + rlca + rlca + and 0Fh + ld (byte_17A0),a + ld a,b + and 0Fh + inc a + ld (byte_17A1),a + ld hl,(byte_17A0) + ld (smod_b_186),hl + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1B0: ld a,(de) + push af + dec de + ld a,(de) + ld e, a + ld c,F_USERNUM + call bdos ; get/set user number + pop af + dec a + ld e, a + ld c,DRV_SET + jp bdos ; Select disc + +;---------------------------------------------------------------------------- + +err_vern: ld de,str_cpm3 ; Display version + ld c,C_WRITESTR ; error and exit + call bdos + +err_exit: ld de,str_info ; Display usage + ld c,C_WRITESTR ; and exit to + call bdos ; CP/M + jp cpm + +;---------------------------------------------------------------------------- + +str_welc: .text "RZ for CP/M 3 V 1.04\r\n" + .text "(C) 92 wshbg\r\n\n$" +str_sxfr: .text "start your local X/Y/ZModem sending program\r\n\n$" +str_cpm3: .text "sorry, CP/M 3 Tool\r\n$" +str_info: .text "usage: rz [-?pbcrxyz] [du:fn]\r\n\n" + .text " options for ZModem:\r\n" + .text " ? this help\r\n" + .text " p protect File\r\n" + .text " b receive binary\r\n" + .text " c convert to local linefeed\r\n" + .text " r resume transmission\r\n" + .text " x,y,z Protokoll\r\n" + .text " du:fn defaults to XModem\r\n\n" + .text "these values override options from sender\r\n$" + +;---------------------------------------------------------------------------- +; Search list of command line options + +sub_39A: push hl + push de +loc_39C: inc de ; get next character + ld a,(de) ; to check + or a + jr z,loc_3AE ; exit if not found + ld hl,stab_clo ; table to seach + ld bc,stab_clo_s ; no. of table entries + cpir ; check match + call z,stab_jmp ; if yes get table entry and jump + jr loc_39C ; else continue search + +loc_3AE: pop de + pop hl + ret + +stab_clo: .text "?PBCXYZR" +stab_clo_s: .equ $-stab_clo + + .dw clo_help ; ? + .dw clo_p ; P + .dw clo_b ; B + .dw clo_c ; C + .dw clo_x ; X + .dw clo_y ; Y + .dw clo_z ; Z + .dw err_exit ; R + +;---------------------------------------------------------------------------- +; Set flags and options from command line + +clo_c: ld a,1 + jr set_opt +clo_b: ld a,3 + jr set_opt +clo_p: ld a,4 +set_opt: ld (byte_8AF),a + ret + +clo_z: ld a,$ff + ld (flg_zmdm),a + ret +clo_y: ld a,$ff + ld (flg_ymdm),a + ret +clo_x: ld a,$ff + ld (flg_xmdm),a + ret +clo_help: ld a,$ff + ld (flg_help),a + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_3EF: xor a + ld (byte_460),a + ld (byte_464),a + ld c,S_SYSVAR + ld de,byte_45F + call bdos ; Access the system variables + ld a,h + cpl + ld h,a + ld a,l + cpl + ld l, a + ld (word_46F),hl + ld c,S_SYSVAR + ld de,byte_463 + call bdos ; Access the system variables + ld (word_46B),hl + ld de,(word_46F) + ld a,h + and d + ld h,a + ld a,l + and e + ld l, a + ld (word_465),hl + ld c,S_SYSVAR + ld de,byte_467 + call bdos ; Access the system variables + ld (word_46D),hl + ld de,(word_46F) + ld a,h + and d + ld h,a + ld a,l + and e + ld l, a + ld (word_469),hl +loc_437: ld a,0FEh + ld (byte_464),a + ld de,byte_463 + ld c,S_SYSVAR + call bdos ; Access the system variables + ld a,0FEh + ld (byte_468),a + ld de,byte_467 + ld c,S_SYSVAR + jp bdos ; Access the System Control Block + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_451: ld hl,(word_46B) + ld (word_465),hl + ld hl,(word_46D) + ld (word_469),hl + jr loc_437 + +;----------------------------------------------------------------------------' + +byte_45F: .db 28h +byte_460: .db 0 + .db 0 + .db 0 +byte_463: .db 24h +byte_464: .db 0 +word_465: .dw 0 +byte_467: .db 22h +byte_468: .db 0 +word_469: .dw 0 +word_46B: .dw 0 +word_46D: .dw 0 +word_46F: .dw 0 + +;---------------------------------------------------------------------------- +; Call BDOS and set status flag + +bdos_s: call bdos + or a + ret + +;---------------------------------------------------------------------------- +; Search for 0 terminated string starting at HL + +Search0: push af +loc_477: push bc + xor a + ld b,a + ld c,a + cpir + pop bc + djnz loc_477 + pop af + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_482: ld a,(byte_2D04) + ld de,text495h ; Update error string with errors + call sub_16E7 + ld de,text493h + ld c,C_WRITESTR + jp bdos ; Output string + +;---------------------------------------------------------------------------- + +text493h: .text "\r\n" +text495h: .db 0,0,0 + .text " error(s)\r\n$" + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_4A4: ld de,file_fcb + ld hl,byte_4F8 + ld (hl),':' + inc hl + xor a + ld b,0Dh + call fill_bhla + inc de + call sub_16C4 + dec de + ld a,(de) + add a,'A'-1 + ld (byte_4F4),a + dec de + ld a,(de) + ld de,byte_4F5 + call sub_16E7 + ld a,'$' + ld (term_fn),a + ld de,text4F2h + ld c,C_WRITESTR + call bdos ; Output string + ld hl,(byte_2CD4) + ld a,h + or l + ret z + ld b,1 + call Search0 + dec hl + ld (hl),'$' + ld de,(byte_2CD4) + ld c,C_WRITESTR + call bdos ; Output string + ld de,newline + ld c,C_WRITESTR + jp bdos ; Output string + +;---------------------------------------------------------------------------- + +text4F2h: .text "\r\n" +byte_4F4: .db 0 +byte_4F5: .db 0 ; + .db 0 ; + .db 0 ; +byte_4F8: .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 20h ; +term_fn: .db 0 +newline: .text "\r\n$" + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_50B: ld hl,loc_2CAB + ld de,loc_51F + call loc_774 + ld (hl),'$' + ld de,text51Eh + ld c,C_WRITESTR + jp bdos ; Output string + +;---------------------------------------------------------------------------- +text51Eh: + .db 0Dh ; +loc_51F: .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + +disp_bsy: ld hl,str_busy +smod_52D: .equ $+1 ; self modifying + ld a,0 + inc a + and 3 + ld (smod_52D),a + ld e,a + ld d,0 + add hl,de + ld a,(hl) + ld (str_sav),a + ld de,str_rev + ld c,C_WRITESTR + jp bdos + +str_busy: .db 7ch ; | + .db 02fh ; / + .db 2dh ; - + .db 5ch ; \ +str_rev: .db 20h ; +str_sav: .db 7ch ; | + .db 08h ; /b + .db 08h ; /b + .db 24h ; $ + + ld de,text569h + jr sub_555 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_552: ld de,text55Ah +sub_555: ld c,C_WRITESTR + jp bdos ; Output string + +;---------------------------------------------------------------------------- + +text55Ah: .text "File skipped\r\n$" +text569h: .text "can't open any file\r\n$" + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_57F: ld hl,byte_586 + ld (hl),a + inc hl + ld (hl),c + ret + +;---------------------------------------------------------------------------- + +byte_586: .db 0 +byte_587: .db 0 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_588: or a ; is the receive + ld hl,(rbuf_bfree) ; buffer full? + ld de,rbuf_size + sbc hl,de + jr z,loc_5A9 + ld c,A_STATIN ; if it isn't see + call bdos ; if there is a character + or a ; available + jr z,loc_5A9 + ld c,A_READ ; get the character + call bdos + ld c,a + ld hl,rbuf_bfree + call sub_61C + jr sub_588 + +;---------------------------------------------------------------------------- + +loc_5A9: ld hl,byte_587 + or (hl) + ret nz + ld hl,(rbuf_bfree) + ld a,h + or l + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_5B4: ld a,(byte_587) + or a + ld hl,rbuf_bfree + jp z,loc_5F7 + push af + ld hl,byte_587 + dec (hl) + dec hl + pop af + ld a,(hl) + ret + +;---------------------------------------------------------------------------- + +loc_5C7: LD C,A_WRITE ; punch out + LD E,A + JP bdos + +;---------------------------------------------------------------------------- +; Set I/O byte +; E=I/O byte +; S u b r o u t i n e + +sub_5CD: ld c,A_STAT_OUT + call bdos ; BDOS function 8 (A_STATOUT) - Auxiliary Output status + or a + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e ; Receive a byte into the receive buffer? + +sub_5D4: push bc + ld b,5Fh ; retries? +loc_5D7: push bc + call sub_588 + pop bc + jr nz,loc_5E6 + call delay + djnz loc_5D7 + call sub_588 +loc_5E6: call nz,sub_5B4 + pop bc + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +delay: push bc + ld a,4 + ld b,0 +loc_5F0: djnz loc_5F0 + dec a + jr nz,loc_5F0 + pop bc + ret + +;---------------------------------------------------------------------------- + +loc_5F7: ld e,(hl) + inc hl + ld d,(hl) + ld a,d + or e + ret z + dec de + ld (hl),d + dec hl + ld (hl),e + ld de,4 + add hl,de + push hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + add hl,de + ex (sp),hl + inc de + ld a,e + and 0FFh + ld (hl),a + inc hl + ld a,d + and 0Fh + ld (hl),a + pop hl + ld a,1 + or a + ld a,(hl) + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_61C: or a + push hl + ld e,(hl) + inc hl + ld d,(hl) + ld hl,rbuf_size + sbc hl,de + pop hl + ret z + inc de + ld (hl),e + inc hl + ld (hl),d + inc hl + push hl + ld e,(hl) + inc hl + ld d,(hl) + inc hl + inc hl + inc hl + add hl,de + ex (sp),hl + inc de + ld a,e + and 0FFh + ld (hl),a + inc hl + ld a,d + and 0Fh + ld (hl),a + pop hl + ld (hl),c + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_643: ld hl,word_17A2 + ld b,25h + jr loc_650 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_64A: ld b,3 + jr loc_650 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_64E: ld b,6 +loc_650: xor a + jp fill_bhla + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_654: xor a + or (hl) + ret z + dec (hl) + inc hl + inc hl + ld e,(hl) + ld d,0 + ld a,e + inc a + and 7Fh + ld (hl),a + inc hl + adc hl,de + ld a,(hl) + ret nc + ccf + ret + +;---------------------------------------------------------------------------- + +sub_669: LD A,80H + SUB (HL) + RET Z + INC (HL) + INC HL + LD E,(HL) + LD D,0 + LD A,E + INC A + AND 7FH + LD (HL),A + INC HL + INC HL + ADC HL,DE + LD (HL),C + RET NC + CCF + RET + +;---------------------------------------------------------------------------- +; Jump to table address entry + +stab_jmp: add hl,bc + sla c + add hl,bc + ld c,(hl) + inc hl + ld h,(hl) + ld l, c + jp (hl) + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_688: xor a + push bc + push de + push hl + ld (hl),a + ld d,h + ld e,l + inc de + jr loc_697 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_692: push bc + push de + push hl + ldi +loc_697: ldi + ldi + ldi + pop hl + pop de + pop bc + ret + +;---------------------------------------------------------------------------- + +loc_6A1: PUSH HL + POP IX + PUSH DE + POP IY + LD A,(IX+3) + XOR (IY+3) + JP P,loc_6B6 + XOR (IX+3) +loc_6B3: RET M + CCF + RET + +loc_6B6: XOR (IX+3) + JP P,loc_6C2 + CALL loc_6C2 + SCF + JR loc_6B3 + +loc_6C2: PUSH BC + PUSH DE + PUSH HL + EX DE,HL + OR A + LD B,4 +loc_6C9: LD A,(DE) + SBC A,(HL) + INC DE + INC HL + DJNZ loc_6C9 + POP HL + POP DE + POP BC + RET + +sub_6D3: PUSH BC + PUSH DE + PUSH HL + LD B,4 +loc_6D8: LD A,(DE) + XOR (HL) + JR NZ,loc_6E0 + INC DE + INC HL + DJNZ loc_6D8 +loc_6E0: POP HL + POP DE + POP BC + RET + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_6E4: push bc + push de + push hl + or a + ex af, af' + ld a,4 +loc_6EB: ex af, af' + ld a,(de) + adc a,(hl) + ld (bc),a + inc bc + inc de + inc hl + ex af, af' + dec a + jr nz,loc_6EB + pop hl + pop de + pop bc + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_6FA: push bc + push de + push hl + ex de,hl + or a + ex af, af' + ld a,4 +loc_702: ex af, af' + ld a,(de) + sbc a,(hl) + ld (bc),a + inc bc + inc hl + inc de + ex af, af' + dec a + jr nz,loc_702 + ex af, af' + pop hl + pop de + pop bc + ret + +;---------------------------------------------------------------------------- + +loc_712: PUSH BC + PUSH HL + LD A,1 + ADD A,(HL) + LD (HL),A + JR NC,loc_723 + LD B,3 +loc_71C: INC HL + LD A,0 + ADC A,(HL) + LD (HL),A + DJNZ loc_71C +loc_723: POP HL + POP BC + RET + +;---------------------------------------------------------------------------- + +loc_726: call sub_688 +sub_729: push bc + push hl + ld a,(hl) + sub 1 + ld (hl),a + ld b,3 +loc_731: inc hl + ld a,(hl) + sbc a,0 + ld (hl),a + djnz loc_731 + pop hl + pop bc + ret + +;---------------------------------------------------------------------------- + +loc_73B: PUSH BC + PUSH DE + PUSH HL + EX DE,HL + LD A,004H +loc_741: PUSH AF + LD A,(DE) + AND (HL) + LD (BC),A + INC BC + INC DE + INC HL + POP AF + DEC A + JR NZ,loc_741 + POP HL + POP DE + POP BC + RET + +;---------------------------------------------------------------------------- + +loc_750: .db 0, 0CAh, 9Ah, 3Bh + .db 0, 0E1h, 0F5h, 5 + .db 80h, 96h, 98h, 0 + .db 40h, 42h, 0Fh, 0 + .db 0A0h, 86h, 1, 0 + .db 10h, 27h, 0, 0 + .db 0E8h, 3, 0, 0 + .db 64h, 0, 0, 0 + .db 0Ah, 0, 0, 0 + +loc_774: ld (smod_w_7BF),de + ld de,byte_2891 + call sub_692 + ld c,+(loc_774-loc_750)/4 + ld de,loc_750-4 + xor a + ld (smod_b_7BA),a +loc_787: ld a,30h + ld (smod_b_7B4),a + inc de + inc de + inc de + inc de + ld b,0Ah +loc_792: push bc + ld hl,byte_2891 + ld bc,loc_2895 + call sub_6FA + pop bc + jr c,loc_7B3 + push de + ld a,(smod_b_7B4) + inc a + ld (smod_b_7B4),a + ld de,byte_2891 + ld hl,loc_2895 + call sub_692 + pop de + djnz loc_792 +smod_b_7B4: .EQU $+1 +loc_7B3: LD A,30H ; self modifying + CP 30H + JR NZ,loc_7BE +smod_b_7BA: .EQU $+1 + LD A,0 + OR A + JR Z,loc_7CB +smod_w_7BF: .EQU $+1 +loc_7BE: LD HL,0 + LD (HL),A + INC HL + LD (smod_w_7BF),HL + LD A,30H + LD (smod_b_7BA),A +loc_7CB: DEC C + JR NZ,loc_787 + LD A,(byte_2891) + AND 0FH + ADD A,30H + LD HL,(smod_w_7BF) + LD (HL),A + INC HL + LD (HL),0 + RET + +sub_7DD: PUSH AF +smod_b_7DF: .EQU $+1 + ADD A,0 + LD (smod_b_7DF),A + POP AF + RET + +loc_7E5: .db 20h + .db 83h + .db 0B8h + .db 0EDh + +loc_7E9: .db 0E3h + .db 20h + .db 0BBh + .db 0DEh + +sub_7ED: PUSH AF +smod_w_7F0: .EQU $+2 + LD IY,loc_289D + LD IX,loc_2899 + XOR (ix+0) + LD H,0 + LD L,A + ADD HL,HL + ADD HL,HL + LD B,H + LD C,L + ADD IY,BC + LD A,(IY) + XOR (IX+1) + LD (ix+0),A + LD A,(IY+1) + XOR (IX+2) + LD (IX+1),A + LD A,(IY+2) + XOR (IX+3) + LD (IX+2),A + LD A,(IY+3) + LD (IX+3),A + POP AF + RET + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_825: push de + push hl + ld hl,(smod_w_7F0) + ld bc,3FFh + add hl,bc + push hl + pop iy + ld ix, loc_7E5 + xor a +loc_836: push af + ld hl,0FFFFh + ld de,0FFFFh + xor e + ld e, a + ld b,8 +loc_841: scf + rr h + rr l + rr d + rr e + jr nc,loc_860 + ld a,e + xor (ix+0) + ld e, a + ld a,d + xor (ix+1) + ld d,a + ld a,l + xor (ix+2) + ld l, a + ld a,h + xor (ix+3) + ld h,a +loc_860: djnz loc_841 + ld a,h + cpl + ld (iy+0), a + dec iy + ld a,l + cpl + ld (iy+0), a + dec iy + ld a,d + cpl + ld (iy+0), a + dec iy + ld a,e + cpl + ld (iy+0), a + dec iy + pop af + inc a + jr nz,loc_836 + pop hl + pop de + ret + +;---------------------------------------------------------------------------- + +crc16: PUSH AF +crc_seed: .equ $+1 + LD HL,0 + LD DE,1021H ; crc16-ccitt polynomial + XOR H + LD H,A + LD B,8 +loc_890: ADD HL,HL + JR NC,loc_899 + LD A,H + XOR D + LD H,A + LD A,L + XOR E + LD L,A +loc_899: DJNZ loc_890 + LD (crc_seed),HL + POP AF + RET + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_8A0: xor a + ld h,a + ld l, a + ld (smod_b_7DF),a + ld (crc_seed),hl + ld hl,loc_2899 + jp loc_726 + +;---------------------------------------------------------------------------- + +byte_8AF: .db 4 +flg_zmdm: .db 0 +flg_xmdm: .db 0 +flg_ymdm: .db 0 +flg_help: .db 0 +word_8B4: .dw 0 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_8B6: xor a + ld c,a + ld b,8 + ld a,h +loc_8BB: rlca + set 7,c + jr c,loc_8C4 + rr c + djnz loc_8BB +loc_8C4: ld a,h + and c + ld h,a + ld l,0 + ld (word_2CEB),hl + dec hl + ld (word_8B4),hl + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_8D1: xor a + ld hl,byte_2C9D + ld b,61h + call fill_bhla + ld hl,rbuf_bfree + call sub_64E + call sub_825 + ld hl,(word_179E) + ld (word_2CE9),hl + ld de,(6) + ex de,hl + or a + sbc hl,de + call sub_8B6 + ld a,(flg_zmdm) + cp 0 + jr z,loc_8FD + ld a,7 +loc_8FD: ld (byte_2CA4),a + ld a,10h + ld (byte_2C9E),a + ld a,(byte_8AF) + cp 3 + jr c,loc_947 + ld a,1 + ld (smod_b_B0A),a + call loc_ACF + jp c,loc_954 + or a + jr z,loc_92B + cp 4 + jr z,loc_924 + cp 0Fh + jr nz,loc_924 + jr locret_953 + +loc_924: call sub_BB4 + jr c,loc_954 + jr locret_953 + +;---------------------------------------------------------------------------- + +loc_92B: ld a,3 + ld (byte_8AF),a + xor a + ld (byte_2D04),a + call sub_11C1 + jr c,loc_954 + call sub_961 + jr c,loc_954 + jr z,locret_953 ; ret z ? + call sub_11FA + jr c,loc_954 + jr loc_92B + +;---------------------------------------------------------------------------- + +loc_947: call sub_961 + jr c,loc_954 + jr z,locret_953 ; ret z ? + call sub_11FA + jr c,loc_954 +locret_953: ret + +;---------------------------------------------------------------------------- + +loc_954: call sub_DD9 + ld a,(byte_2CA5) + cp 0FFh + call z,sub_D0E + jr locret_953 ; ret ? + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_961: ld a,(flg_xmdm) + cpl + ld hl,flg_ymdm + or (hl) + ld (byte_2CA3),a + ld a,(byte_2CA4) + or a + jr z,loc_975 + ld (byte_2CA1),a +loc_975: ld a,(flg_ymdm) + cp 0FFh + jr z,loc_988 + ld a,(byte_2CA2) + cp 2 + jr nz,loc_988 + ld a,0 + ld (byte_2CA3),a +loc_988: ld a,(byte_2CA2) + cp 1 + jr nz,loc_994 + ld a,0FFh + ld (byte_2CA3),a +loc_994: ld a,(byte_2CA1) + cp 7 + jr z,loc_9AE + ld a,(byte_2CA1) + cp 3 + jr nz,loc_9AE + ld a,(byte_2CA3) + cp 0FFh + jr nz,loc_9AE + ld a,7 + ld (byte_2CA1),a +loc_9AE: ld a,(byte_8AF) + cp 3 + jr c,loc_9E3 + call sub_643 + ld hl,(word_2CE9) + xor a + or (hl) + scf + ret z + push hl + ld b,1 + call Search0 + dec hl + ld (hl),20h + pop hl + ld de,loc_2CD0 + ld a,7 + ld (de),a + ld a,0FFh + call sub_172E + ld hl,(word_2CD2) + ld de,file_fcb + call sub_1492 + ld hl,(byte_17A0) + ld (word_17A2),hl +loc_9E3: call sub_4A4 + ld de,file_fcb + call sub_169E + jr nz,loc_A11 + ld de,file_fcb + ld c,F_MAKE + call bdos_s + ret c + ld a,0FFh + ld (byte_2CA5),a + ld hl,byte_280E + call sub_64A + ld a,(byte_2CD1) + cp 2 + jr c,loc_A0D +sub_A09: ld de,(byte_2CD4) +loc_A0D: ld a,1 + or a + ret + +;---------------------------------------------------------------------------- + +loc_A11: call sub_A09 + ld a,(byte_8AF) + cp 4 + jr nz,loc_A24 + ld a,(byte_2CA1) + cp 7 + jr nz,loc_A35 + jr loc_A2E + +;---------------------------------------------------------------------------- + +loc_A24: ld de,file_fcb + ld c,F_DELETE + call bdos_s + jr nc,loc_9E3 +loc_A2E: call sub_552 + ld a,5 + scf + ret + +;---------------------------------------------------------------------------- + +loc_A35: ld a,(byte_2CA1) + cp 3 + jr z,loc_A43 + ld a,(flg_help) + cp 0FFh + jr nz,loc_A24 +loc_A43: ld de,loc_2811 + ld c,F_DMAOFF + call bdos ; BDOS function 26 (F_DMAOFF) - Set DMA address + ld e, 1 + ld c,F_MULTISEC + call bdos ; BDOS function 44 (F_MULTISEC) - Set number of records to read/write at once + ld de,file_fcb + ld c,F_OPEN + call bdos_s + ret c + ld a,0FFh + ld (byte_2CA5),a + ld hl,byte_280E + call sub_64A + ld de,file_fcb + ld c,F_SIZE + call bdos_s + ret c + ld hl,byte_17C7 + ld (hl),0 + ld hl,loc_17C4 + call sub_729 + ld de,loc_2CAB + call sub_692 + ex de,hl + ld b,7 +loc_A83: push hl + sla (hl) + inc hl + rl (hl) + inc hl + rl (hl) + inc hl + rl (hl) + pop hl + djnz loc_A83 + ld de,file_fcb + ld c,DRV_DPB + call bdos_s + ret c + ld a,(byte_2CA1) + cp 3 + jr z,loc_AA6 + ld a,9 + or a + ret + +;---------------------------------------------------------------------------- + +loc_AA6: ld a,80h + ld (byte_280E),a +loc_AAB: ld hl,byte_280E + call sub_654 + jr z,loc_AC6 + cp 1Ah + jr nz,loc_AAB + ld a,(byte_2810) + dec a + ld (byte_280F),a + ld hl,byte_280E + ld a,7Fh + sub (hl) + jr loc_AC8 + +;---------------------------------------------------------------------------- + +loc_AC6: ld a,80h +loc_AC8: ld (byte_280E),a + ld a,1 + or a + ret + +;---------------------------------------------------------------------------- + +loc_ACF: xor a + ld (byte_2D04),a + ld a,4 + ld hl,byte_8AF + cp (hl) + ld a,0 + ret nz + ld hl,word_2CED + ld b,11h + xor a + call fill_bhla + call sub_FAA + ld a,(byte_2CA6) + cp 0FFh + ld b,5 + jr z,loc_AF3 + ld b,0Ah + +loc_AF3: push bc + ld ix,loc_2CE0 + ld (ix+3),20h + ld (ix+2),0 + ld hl,(word_2CEB) + ld (ix+0),l + ld (ix+1),h +smod_b_B0A: .equ $+1 + ld a,1 ; self modifying value + CALL sub_13BA + LD A,(smod_b_B0A) + CP 5 + JR NZ,0B1AH + LD A,1 + LD (smod_b_B0A),A +loc_B1A: CALL sub_FD1 + LD HL,loc_B96 + LD BC,0AH + CPIR + JP Z,stab_jmp +loc_B28: LD HL,byte_2D04 + INC (HL) + CALL sub_482 +loc_B2F: POP BC + DJNZ loc_AF3 + XOR A + RET + +loc_B34: POP BC + LD A,0FFH + SCF + RET + +loc_B39: POP BC + CALL sub_D9B + LD A,0FH + RET + +loc_B40: LD HL,loc_2CE0 + CALL sub_688 + JR loc_B68 + + +loc_B48: LD IX,loc_2CA7 + LD A,(IX+3) + AND 40H + LD (byte_2C9D),A + CALL loc_EC7 + CP 0EBH + LD A,6 + JR NZ,loc_B6A + LD HL,(word_2CE9) + LD DE,loc_2CAF + LD BC,20H + LDIR +loc_B68: LD A,3 +loc_B6A: PUSH AF + LD HL,loc_2CE0 + CALL sub_688 + POP AF + CALL sub_13BA + CALL sub_FC9 + JP loc_B28 + +loc_B7B: LD HL,loc_2CA7 + LD DE,loc_2C9F + CALL sub_692 + LD A,1 + LD (smod_b_B0A),A + CALL loc_EC7 + CP 0EBH + LD A,6 + JR NZ,loc_B6A + POP BC + LD A,4 + RET + +loc_B96: .db 0 + .db 0Bh + .db 0FEh + .db 4 + .db 2 + .db 11h + .db 12h + .db 0Fh + .db 8 + .db 10h + +loc_BA0: .dw loc_B34 + .dw loc_B39 + .dw loc_B1A + .dw loc_B34 + .dw loc_B40 + .dw loc_B48 + .dw loc_B7B + .dw loc_B28 + .dw loc_B2F + .dw loc_B2F + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_BB4: call sub_BD3 + ret c + cp 0Bh + jr z,loc_BC2 + cp 5 + jr z,loc_BC2 + or a + ret + +;---------------------------------------------------------------------------- + +loc_BC2: call loc_ACF + ret c + cp 4 + jr z,sub_BB4 + cp 0Fh + ld a,0 + ret z + ld a,0FFh + scf + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_BD3: call sub_961 + jr nc,loc_BDF + ld a,5 + ld (smod_b_B0A),a + or a + ret + +loc_BDF: cp 9 + jr z,loc_BE9 + ld hl,loc_2CAB + call sub_688 +loc_BE9: xor a + ld (byte_2D04),a + call sub_FAA +loc_BF0: call sub_FC9 + call sub_D30 + ld hl,loc_2CAB + ld de,loc_2CE0 + call sub_692 + ld hl,rbuf_bfree + call sub_64E + ld a,9 + call sub_13BA +loc_C0A: call sub_FD1 + ld hl,stab_CE4 + ld bc,7 + cpir + jp z,stab_jmp + ld a,0FFh + scf + ret + +;---------------------------------------------------------------------------- + +loc_C1C: LD HL,byte_2D04 + INC (HL) + CALL sub_482 + LD HL,byte_2D04 + LD A,0AH + CP (HL) + JP NZ,loc_BF0 + LD A,0FFH + SCF + RET + +loc_C30: CALL loc_EC7 + JP loc_BF0 + +loc_C36: LD DE,loc_2CA7 + LD HL,loc_2CAB + CALL sub_6D3 + JP NZ,loc_BF0 + CALL sub_D0E + JR Z,loc_C50 +loc_C47: LD A,0CH + LD (smod_b_B0A),A + LD A,0FFH + SCF + RET + +loc_C50: CALL sub_643 + LD A,0BH + OR A + RET + +loc_C57: LD HL,byte_2D04 + INC (HL) + CALL sub_482 + LD HL,byte_2D04 + LD A,0AH + CP (HL) + JR NZ,loc_C6A + LD A,0FFH + SCF + RET + +loc_C6A: LD HL,loc_2CAF + CALL sub_DDC + JP loc_BF0 + +loc_C73: LD DE,loc_2CA7 + LD HL,loc_2CAB + CALL sub_6D3 + JP NZ,0C57H +loc_C7F: CALL disp_bsy + CALL loc_EC7 + LD HL,stab_CF9 + LD BC,7 + CPIR + JP Z,stab_jmp + JP loc_C1C + +loc_C93: LD A,0FFH + SCF + RET + +sub_C97: XOR A + LD (byte_2D04),A + LD DE,loc_2CF9 + LD HL,loc_2CAB + LD BC,loc_2CAB + CALL sub_6E4 + JP sub_FBA + +loc_CAA: CALL sub_C97 + JP loc_C0A + +loc_CB0: CALL sub_C97 + JP loc_C7F + +loc_CB6: CALL sub_C97 + LD HL,loc_2CAB + LD DE,loc_2CE0 + CALL sub_692 + LD A,3 + CALL sub_13BA + JP loc_C7F + +loc_CCA: CALL sub_C97 + CALL sub_D30 + JP C,loc_C47 + LD HL,loc_2CAB + LD DE,loc_2CE0 + CALL sub_692 + LD A,3 + CALL sub_13BA + JP loc_C0A + +stab_CE4: .db 6 + .db 0FEh + .db 4 + .db 0Bh + .db 0FFh + .db 0Ah + .db 0FCh + + .dw loc_C1C + .dw loc_C73 + .dw loc_C57 + .dw loc_C36 + .dw loc_C30 + .dw loc_C1C + .dw loc_C1C + +stab_CF9: .db 0EBh + .db 0EAh + .db 0E9h + .db 0E8h + .db 0FFh + .db 0FEh + .db 010h + + .dw loc_C93 + .dw loc_C1C + .dw loc_C57 + .dw loc_CAA + .dw loc_CB0 + .dw loc_CB6 + .dw loc_CCA + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_D0E: call sub_50B + call sub_D30 + ret c +loc_D15: ld a,1Ah + call loc_D68 + ret c + ld hl,byte_280E + ld a,1 + cp (hl) + jr nz,loc_D15 + ld a,0 + ld (byte_2CA5),a + ld c,F_CLOSE + ld de,file_fcb + jp bdos_s + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_D30: ld bc,(word_2CF5) + ld a,b + or c + ret z + ld hl,(word_2CE9) +loc_D3A: ld a,(byte_2CA3) + cp 0FFh + jr z,loc_D52 +smod_b_D41: .equ $+1 +loc_D41: ld a,0 + cp 0Dh + jr z,loc_D52 + ld a,(hl) + cp 0Ah + jr nz,loc_D52 + ld a,0Dh + call loc_D68 + ret c +loc_D52: ld a,(hl) + ld (smod_b_D41),a + inc hl + dec bc + call loc_D68 + ret c + ld a,b + or c + jr nz,loc_D3A + call sub_50B + call sub_FAA + xor a + ret + +;---------------------------------------------------------------------------- + +loc_D68: ld (byte_D6F),a + push bc + push de + push hl +byte_D6F: .equ $+1 +loc_D6E: LD C,0 + LD HL,byte_280E + CALL sub_669 + JR NZ,loc_0D97 + LD HL,byte_280E + CALL sub_64A + LD C,F_DMAOFF ; set dma + LD DE,loc_2811 + CALL bdos + LD C,F_MULTISEC + LD E,1 + CALL bdos + LD C,F_WRITE ; wr. seq. + LD DE,file_fcb + CALL bdos_s + JR NC,loc_D6E +loc_0D97: POP HL + POP DE + POP BC + RET + +sub_D9B: LD HL,loc_2CE0 + CALL sub_688 + LD B,4 +loc_0DA3: PUSH BC + LD A,8 + CALL sub_13BA + LD B,64H + CALL sub_DE7 + JR C,loc_DB8 + CP 4FH + JR Z,loc_DBC + CP 0FDH + JR Z,loc_DBC +loc_DB8: POP BC + DJNZ loc_0DA3 + PUSH BC +loc_DBC: POP BC + LD B,1 + CALL sub_DE7 + XOR A + RET + +stab_DC4: .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 0 ; + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_DD9: ld hl,stab_DC4 +sub_DDC: ld a,(hl) + inc hl + or a + ret z + push hl + call loc_145C + pop hl + jr sub_DDC + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_DE7: push bc + call sub_16AA + call nz,sub_16A5 + cp 1Bh + ld a,18h + ld c,0Ah + call z,sub_57F + pop bc +loc_DF8: call sub_5D4 + jr nz,loc_E03 + djnz loc_DF8 + ld a,0FEh + scf + ret + +loc_E03: or a + ret + +;---------------------------------------------------------------------------- +loc_E05: LD B,64H + CALL sub_DE7 + RET C + AND 7FH + LD HL,loc_E2A + LD BC,2 + CPIR + JR Z,loc_E05 + LD BC,3 + CPIR + RET Z + LD B,A + AND 60H + JR NZ,loc_E28 + LD A,(byte_2C9D) + OR A + JR NZ,loc_E05 +loc_E28: LD A,B + RET + +loc_E2A: .db 11h ; dc1 + .db 13h ; dc3 + .db 0dh ; cr + .db 0ah ; lf + .db 18h ; can + +sub_E2F: ld b,64H + CALL sub_DE7 + RET C + LD E,A +loc_E36: AND 60H + LD A,E + RET NZ + CP 18H + JR Z,loc_E50 + LD HL,loc_EA2 + LD BC,4 + CPIR + JR Z,sub_E2F + LD A,(byte_2C9D) + OR A + JR NZ,sub_E2F + LD A,E + RET + +loc_E50: LD B,64H + CALL sub_DE7 + RET C + CP 18H + JR NZ,loc_0E74 + LD B,64h + CALL sub_DE7 + RET C + CP 18H + JR NZ,loc_0E74 + LD B,64H + CALL sub_DE7 + RET C + CP 18H + JR NZ,loc_0E74 + LD B,64H + CALL sub_DE7 + RET C +loc_0E74: LD HL,loc_EA6 + LD BC,0BH + CPIR + JP Z,stab_jmp + LD L,A + LD A,(byte_2C9D) + OR A + JR Z,loc_E8B + LD A,L + AND 60H + JR Z,loc_E50 +loc_E8B: LD A,L + AND 60H + CP 40H + JR NZ,loc_E9C + LD A,L + XOR 40H + RET + +loc_E96: LD A,7FH + RET + +loc_E99: LD A,0FFH + RET + +loc_E9C: LD A,0FFH +loc_E9E: OR 80H + SCF + RET + +loc_EA2: .db 11h ; + .db 91h ; ? + .db 13h ; + .db 93h ; ? +loc_EA6: .db 11h ; + .db 91h ; ? + .db 13h ; + .db 93h ; ? + .db 18h ; + .db 68h ; h + .db 69h ; i + .db 6Ah ; j + .db 6Bh ; k + .db 6Ch ; l + .db 6Dh ; m + + .dw loc_E99 + .dw loc_E96 + .dw loc_E9E + .dw loc_E9E + .dw loc_E9E + .dw loc_E9E + .dw loc_E9E + .dw loc_E50 + .dw loc_E50 + .dw loc_E50 + .dw loc_E50 + +loc_EC7: OR A + LD HL,(word_2CEB) + LD DE,(word_2CEF) + SBC HL,DE + JP C,sub_F4E + CALL sub_8A0 + LD HL,0 + LD (loc_2CF9),HL +loc_EDD: CALL sub_E2F + JP C,loc_F38 + CALL sub_FA2 + CALL Z,sub_7ED + CALL NZ,crc16 + LD HL,(word_2CEB) + LD BC,(word_2CEF) + SBC HL,BC + JP Z,sub_F4E + INC BC + LD (word_2CEF),BC + LD HL,(loc_2CF9) + INC HL + LD (loc_2CF9),HL + LD HL,(word_2CED) + LD (HL),A + INC HL + LD (word_2CED),HL + JR loc_EDD + +sub_F0E: .db 0E8h ; è + .db 0E9h ; é + .db 0EAh ; ê + .db 0EBh ; ë + .db 98h ; ? + .db 0FFh ; ÿ + .db 0FEh ; þ + + .dw sub_F52 + .dw sub_F4E + .dw sub_F54 + .dw sub_F58 + .dw sub_F58 + .dw sub_F58 + .dw sub_F58 + +stab_F23: .db 0E8h ; è + .db 0E9h ; é + .db 0EAh ; ê + .db 0EBh ; ë + .db 98h ; ? + .db 0FFh ; ÿ + .db 0FEh ; þ + + .dw sub_F52 + .dw sub_F4E + .dw sub_F54 + .dw sub_F7C + .dw sub_F7C + .dw sub_F7C + .dw sub_F7C + +loc_F38: LD HL,stab_F23 + LD BC,7 + CALL sub_FA2 + JR Z,loc_F49 + LD HL,sub_F0E + LD BC,7 +loc_F49: CPIR + JP Z,stab_jmp +sub_F4E: LD A,0FFH + SCF + RET + +sub_F52: SCF + RET + +sub_F54: LD A,10H + SCF + RET + +sub_F58: LD (byte_2CFD),A + AND 7FH + CALL crc16 + LD B,2 +loc_F62: PUSH BC + CALL sub_E2F + CALL crc16 + POP BC + JP C,loc_F38 + DJNZ loc_F62 + LD A,H + OR L + JR Z,loc_F77 +loc_F73: LD A,0FFH + SCF + RET + +loc_F77: LD A,(byte_2CFD) + OR A + RET + +sub_F7C: LD (byte_2CFD),A + AND 7FH + CALL sub_7ED + LD B,4 +loc_F86: PUSH BC + CALL sub_E2F + CALL sub_7ED + POP BC + JP C,loc_F38 + DJNZ loc_F86 + LD HL,loc_2899 + LD DE,loc_7E9 + CALL sub_6D3 + JP Z,loc_F77 + JP loc_F73 + +sub_FA2: LD E,A + LD A,(byte_2C9E) + CP 20H + LD A,E + RET + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_FAA: ld hl,word_2CE9 + ld de,word_2CED + ldi + ldi + ld hl,0 + ld (word_2CEF),hl +sub_FBA: ld hl,word_2CED + ld de,loc_2CF3 +loc_FC0: ldi + ldi + ldi + ldi + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_FC9: ld hl,loc_2CF3 + ld de,word_2CED + jr loc_FC0 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_FD1: xor a + ld (byte_2D01),a + ld hl,400h + ld (word_2CFE),hl +loc_FDB: ld a,5 + ld (byte_2D00),a +loc_FE0: ld b,64h + call sub_DE7 + jp c,loc_108A + ld hl,stab_109E + ld bc,3 + cpir + jp z,stab_jmp + jr loc_1024 + +;---------------------------------------------------------------------------- + + LD HL,byte_2D00 + DEC (HL) + LD A,10H + JP Z,loc_108A + LD B,0AH + CALL sub_DE7 + JR C,loc_FE0 + LD HL,stab_10A7 + LD BC,2 + CPIR + JP Z,stab_jmp + JR loc_1024 + + LD HL,byte_2D00 + DEC (HL) + LD A,10H + JP Z,loc_108A + JR loc_FE0 + + LD B,0AH + CALL sub_DE7 + JR C,loc_1035 +loc_1024: ld hl,(word_2CFE) + dec hl + ld (word_2CFE),hl + ld a,h + or l + ld a,0FCh + jp z,loc_108A + jp loc_FDB + +;---------------------------------------------------------------------------- + +loc_1035: LD A,0FFH + JP loc_108A + + LD A,5 + LD (byte_2D00),A + CALL loc_E05 + JR C,loc_108A + LD HL,stab_10AD + LD BC,2 + CPIR + JP Z,stab_jmp + JR loc_1024 + + CALL loc_E05 + JR C,loc_108A + LD HL,stab_10B3 + LD BC,4 + CPIR + JP Z,stab_jmp + JR loc_1024 + + LD A,10H + LD (byte_2C9E),A + CALL sub_113F + JR loc_107F + + LD A,10H + LD (byte_2C9E),A + CALL sub_1100 + JR loc_107F + + LD A,20H + LD (byte_2C9E),A + CALL sub_10C5 +loc_107F: PUSH AF + LD HL,loc_2CA7 + LD DE,loc_2CE4 + CALL sub_692 + POP AF +loc_108A: ld hl,stab_10BF + ld bc,6 + cpir + jr nz,loc_109C + cp 98h + jr nz,loc_109A + ld a,10h +loc_109A: scf + ret + +loc_109C: or a + ret + +;---------------------------------------------------------------------------- + +stab_109E: .db 18h ; + .db 0AAh ; ª + .db 2Ah ; * + .db 3Ah ; : + .db 10h ; + .db 3Ah ; : + .db 10h ; + .db 0F5h ; õ + .db 0Fh ; + +stab_10A7: .db 6Bh ; k + .db 18h ; + .db 12h ; + .db 10h ; + .db 1Dh ; + .db 10h ; + +stab_10AD: .db 2Ah ; * + .db 18h ; + .db 51h ; Q + .db 10h ; + .db 3Fh ; ? + .db 10h ; + +stab_10B3: .db 43h ; C + .db 41h ; A + .db 42h ; B + .db 18h ; + .db 0F5h ; õ + .db 0Fh ; + + .db 63h ; c + .db 10h ; + .db 6Dh ; m + .db 10h ; + .db 77h ; w + .db 10h ; + +stab_10BF: .db 98h ; ? + .db 6 ; + .db 10h ; + .db 0FFh ; ÿ + .db 0FEh ; þ + .db 0FCh ; ü + +sub_10C5: CALL sub_8A0 + CALL sub_E2F + RET C + LD (byte_2D01),A + CALL sub_7ED + LD HL,loc_2CA7 + LD B,4 +loc_10D7: PUSH BC + PUSH HL + CALL sub_E2F + CALL sub_7ED + POP HL + POP BC + LD (HL),A + INC HL + RET C + DJNZ loc_10D7 + LD B,4 +loc_10E8: PUSH BC + CALL sub_E2F + CALL sub_7ED + POP BC + RET C + DJNZ loc_10E8 + LD HL,loc_2899 + LD DE,loc_7E9 + CALL sub_6D3 + JR Z,loc_1132 + JR loc_113B + +sub_1100: CALL sub_8A0 + CALL sub_E2F + RET C + LD (byte_2D01),A + CALL crc16 + LD HL,loc_2CA7 + LD B,4 +loc_1112: PUSH BC + PUSH HL + CALL sub_E2F + CALL crc16 + POP HL + POP BC + LD (HL),A + INC HL + RET C + DJNZ loc_1112 + LD B,2 +loc_1123: PUSH BC + CALL sub_E2F + CALL crc16 + POP BC + RET C + DJNZ loc_1123 + LD A,H + OR L + JR NZ,loc_113B +loc_1132: LD A,0FFH + LD (byte_2CA6),A + LD A,(byte_2D01) + RET + +loc_113B: LD A,0FFH + SCF + RET + +sub_113F: CALL sub_8A0 + CALL sub_1194 + RET C + LD (byte_2D01),A + CALL crc16 + LD HL,loc_2CA7 + LD B,4 +loc_1151: PUSH BC + PUSH HL + CALL sub_1194 + JR NC,loc_115B + POP HL + POP BC + RET + +loc_115B: CALL crc16 + POP HL + POP BC + LD (HL),A + INC HL + DJNZ loc_1151 + LD B,2 +loc_1166: PUSH BC + CALL sub_1194 + JR NC,loc_116E + POP BC + RET + +loc_116E: CALL crc16 + POP BC + DJNZ loc_1166 + LD A,H + OR L + JR NZ,loc_1190 + LD B,0AH + CALL sub_DE7 + CP 0DH + JR NZ,loc_1186 + LD B,0AH + CALL sub_DE7 +loc_1186: OR A + LD A,0FFH + LD (byte_2CA6),A + LD A,(byte_2D01) + RET + +loc_1190: LD A,0FFH + SCF + RET + +sub_1194: CALL loc_E05 + RET C + CALL sub_11B3 + JR NZ,loc_11AF + RLCA + RLCA + RLCA + RLCA + LD B,A + PUSH BC + CALL loc_E05 + POP BC + RET C + CALL sub_11B3 + JR NZ,loc_11AF + OR B + RET + +loc_11AF: LD A,0FFH + SCF + RET + +sub_11B3: LD L,A + SUB 30H + CP 0AH + JR C,loc_11BC + SUB 27H +loc_11BC: LD L,A + AND 0F0H + LD A,L + RET + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_11C1: ld a,0FFh + ld (byte_2D02),a + call sub_FAA + ld a,(byte_2C9E) + cp 10h + ld a,43h + jr z,loc_11D4 + ld a,15h + +loc_11D4: call loc_145C + ld b,64h + call sub_1289 + or a + jr z,loc_11F3 + cp 0F6h + jr z,loc_11E7 + ld a,0FFh + scf + ret +;---------------------------------------------------------------------------- + +loc_11E7: ld a,6 + call loc_145C + ld b,0Ah + call sub_DE7 + jr sub_11C1 + +;---------------------------------------------------------------------------- + +loc_11F3: ld a,6 + call loc_145C + xor a + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_11FA: ld a,0FFh + ld (byte_2D02),a + ld (byte_2CA3),a + xor a + ld (byte_2D07),a + call sub_FAA + ld hl,loc_2CAB + call sub_688 + ld a,(byte_2C9E) + cp 10h + ld a,43h + jr z,loc_121A + ld a,15h +loc_121A: call loc_145C +loc_121D: ld a,(byte_2D07) + or a + ld b,82h + jr z,loc_1227 + ld b,32h +loc_1227: call sub_1289 + jr c,loc_125A + push af + call sub_50B + pop af + ld hl,byte_2D07 + cp (hl) + jr z,loc_1250 + dec a + cp (hl) + jr nz,loc_126D + inc (hl) + ld de,word_2CEF + ld hl,loc_2CAB + ld bc,loc_2CAB + call sub_6E4 + call sub_FBA + call sub_D30 + jr c,loc_1285 + +loc_1250: call sub_FC9 + ld a,6 + call loc_145C + jr loc_121D + +loc_125A: cp 0F6h + jr nz,loc_126D + call sub_D0E + jr c,loc_1285 + call sub_643 + ld a,6 + call loc_145C + xor a + ret + +;---------------------------------------------------------------------------- + +loc_126D: cp 0FFh + jr nz,loc_1285 + ld a,(byte_2D02) + cp 0FFh + jr nz,loc_1285 + ld a,(byte_2C9E) + or a + jr z,loc_1285 + xor a + ld (byte_2C9E),a + jp sub_11FA + +loc_1285: ld a,0FFh + scf + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1289: ld a,b + ld (byte_2D03),a + xor a + ld (byte_2D04),a + ld a,0 + ld (byte_2D09),a +loc_1296: ld a,(byte_2D03) + ld b,a + call sub_DE7 + ld (byte_2D08),a + ld hl,loc_12AE + ld bc,4 + cpir + jp z,stab_jmp + jp loc_137A + +;---------------------------------------------------------------------------- + +loc_12AE: .db 2 ; + .db 1 ; + .db 4 ; + .db 18h ; + + .dw loc_136A + .dw loc_135F + .dw loc_12BF + .dw loc_12BA + +loc_12BA: LD HL,400H + JR loc_12C2 + +loc_12BF: LD HL,80H +loc_12C2: LD (word_2D05),HL + ld b,0ah + call sub_DE7 + ld (smod_b_12D9),A + jp c,loc_137A + ld b,0ah + call sub_DE7 + jp c,loc_137A +smod_b_12D9: .equ $+1 + add a,0 + cp 0ffh + jp nz,loc_137A + call sub_8A0 + ld ix,(word_2CED) +loc_12E6: LD B,0AH + PUSH IX + CALL sub_DE7 + POP IX + LD (byte_2D08),A + JP C,loc_137A + LD (IX),A + INC IX + CALL sub_7DD + CALL crc16 + LD BC,(word_2CEF) + INC BC + LD (word_2CEF),BC + LD DE,(word_2D05) + DEC DE + LD (word_2D05),DE + LD A,D + OR E + JR NZ,loc_12E6 + LD (word_2CED),IX + LD B,0AH + CALL sub_DE7 + LD (byte_2D08),A + JP C,loc_137A + LD A,(byte_2C9E) + CP 10H + JR NZ,loc_1352 + LD A,(byte_2D08) + CALL crc16 + LD B,0AH + CALL sub_DE7 + LD (byte_2D08),A + JP C,loc_137A + CALL crc16 + LD A,H + OR L + JP NZ,loc_137A +loc_1345: XOR A + LD (byte_2D04),A + LD A,0 + LD (byte_2D02),A + LD A,(smod_b_12D9) + RET + +loc_1352: ld a,(byte_2D08) + ld l,a + ld a,(smod_b_7DF) + sub l + jr z,loc_1345 + jp loc_137A + +loc_135F: ld b,0ah + call sub_DE7 + ld a,0f6h + ret c + jp loc_137A + +loc_136A: ld a,0ffh + ld hl,byte_2D09 + cp (hl) + jr nz,loc_1376 + ld a,0ffh + scf + ret + +loc_1376: ld (hl),a + jp loc_13A4 + +;---------------------------------------------------------------------------- + +loc_137A: ld a,0 + ld (byte_2D09),a +loc_137F: ld b,0Ah + call sub_DE7 + jr nc,loc_137F + ld a,(byte_2D02) + cp 0FFh + jr nz,loc_139A + ld a,(byte_2C9E) + cp 10h + ld a,43h + jr z,loc_13A1 + ld a,15h + jr loc_13A1 + +loc_139A: ld a,28h + ld (byte_2D03),a + ld a,15h +loc_13A1: call loc_145C +loc_13A4: call sub_FC9 + ld hl,byte_2D04 + inc (hl) + call sub_482 + ld a,(byte_2D04) + cp 5 + jp nz,loc_1296 + ld a,0FFh + scf + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_13BA: ld (byte_2CE8),a + ld hl,loc_1403 + call sub_DDC + call sub_8A0 + ld a,(byte_2CE8) + call crc16 + call sub_1418 + ld hl,loc_2CE0 + ld b,4 +loc_13D4: push bc + ld a,(hl) + inc hl + push hl + call crc16 + call sub_1418 + pop hl + pop bc + djnz loc_13D4 + ld a,(crc_seed+1) + call sub_1418 + ld a,(crc_seed) + call sub_1418 + ld a,0Dh + call loc_145C + ld a,0Ah + call loc_145C + ld a,(byte_2CE8) + cp 8 + ret z + ld a,11h + jp loc_145C + +;---------------------------------------------------------------------------- + +loc_1403: .db 2Ah ; * + .db 2Ah ; * + .db 18h ; + .db 42h ; B + .db 0 ; + +loc_1408: .text "0123456789abcdef" + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1418: push af + ld hl,loc_1408 + ld b,0 + rra + rra + rra + rra + and 0Fh + ld c,a + add hl,bc + ld a,(hl) + call loc_145C + pop af + ld hl,loc_1408 + ld b,0 + and 0Fh + ld c,a + add hl,bc + ld a,(hl) + jp loc_145C + +;---------------------------------------------------------------------------- + +loc_1438: LD (smod_b_145B),A + LD BC,+(loc_1480-stab_7B3) + LD HL,stab_7B3 + CPIR + JP Z,stab_jmp + AND 60H + JR NZ,loc_145A + LD A,(byte_2C9D) + OR A + JR Z,loc_145A +loc_1450: LD HL,smod_b_145B + SET 6,(HL) + LD A,18H + CALL loc_145C +smod_b_145B: .equ $+1 +loc_145A: LD A,0 +loc_145C: LD (smod_b_1468),A +loc_145F: CALL sub_588 + CALL sub_5CD + JR Z,loc_145F +smod_b_1468: .equ $+1 + LD A,0 + JP loc_5C7 + +loc_146C: LD A,(smod_b_1468) + AND 7FH + CP 40H + JR NZ,loc_145A + JR loc_1450 + +stab_7B3: .db 18h + .db 0Dh + .db 8Dh + .db 10h + .db 90h + .db 11h + .db 91h + .db 13h + .db 93h + +loc_1480: .dw loc_1450 + .dw loc_1450 + .dw loc_1450 + .dw loc_1450 + .dw loc_1450 + .dw loc_1450 + .dw loc_146C + .dw loc_146C + .dw loc_1450 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1492: push bc + ld (byte_2D0A),a + call sub_171E + push de + call sub_162C + ld (de),a + pop de + push de + call sub_14A7 + pop de + pop bc + jr loc_151D + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_14A7: xor a + ld (de),a + ld (byte_2D0D),a + ld (byte_2D0C),a + call sub_1687 + ld a,c + ld (byte_2D0E),a + push de + ld a,(hl) + cp 3Ah + jr nz,loc_14BD + inc hl +loc_14BD: ld b,8 + call sub_1522 + pop de + ld a,(hl) + ld (byte_2D0B),a + cp 3Ah + jr nz,loc_14FE + inc hl + ld a,(byte_2D0A) + or a + jr z,loc_14D7 + call sub_154A + jr z,loc_14E5 +loc_14D7: call sub_159D + jr z,loc_14E5 + ld a,(byte_2D0A) + or a + jr nz,loc_14E5 + call sub_154A +loc_14E5: ld a,(byte_2D0D) + ld (de),a + push de + inc de + call sub_1632 + pop de + xor a + ld (byte_2D0C),a + push de + ld b,8 + call sub_1522 + pop de + ld a,(hl) + ld (byte_2D0B),a +loc_14FE: ld a,(byte_2D0B) + ex de,hl + ld bc,8 + add hl,bc + ex de,hl + ld b,3 + cp 2Eh + jr nz,loc_1513 + inc hl + push de + call sub_1522 + pop de +loc_1513: ex de,hl + ld bc,5 + add hl,bc + ex de,hl + ld a,(byte_2D0E) + ld (de),a +loc_151D: ld a,(byte_2D0C) + or a + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1522: call valid_fnc + ret z + inc de + cp 2Ah + jr nz,loc_1533 + ld a,3Fh + ld (de),a + call sub_1543 + jr loc_153A +loc_1533: ld (de),a + inc hl + cp 3Fh + call z,sub_1543 +loc_153A: djnz sub_1522 +loc_153C: call valid_fnc + ret z + inc hl + jr loc_153C + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1543: push hl + ld hl,byte_2D0C + inc (hl) + pop hl + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_154A: push hl + push de + call sub_1552 + pop de + pop hl + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1552: call sub_164A + jr z,loc_15CA + ex de,hl + inc hl + call sub_1652 + ld b,a + inc b + ld a,(hl) + cp 41h + jr c,loc_1574 + sub 40h + cp b + jr nc,loc_15CA + ld (byte_2D0D),a + inc hl + ld a,(hl) + cp 20h + ret z + call sub_1625 + ret c +loc_1574: push hl + ld b,2 +loc_1577: ld a,(hl) + cp 20h + jr z,loc_1589 + call sub_1625 + jr c,loc_159A + inc hl + djnz loc_1577 + ld a,(hl) + cp 20h + jr nz,loc_159A +loc_1589: pop hl + call sub_165A + ld c,a + inc c + call sub_15FA + cp c + jr nc,loc_15CA + ld (byte_2D0E),a + xor a + ret + +loc_159A: pop hl + jr loc_15CA + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_159D: push hl + push de + call sub_15A5 + pop de + pop hl + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_15A5: call sub_1662 + jr z,loc_15CA + ex de,hl + inc hl +loc_15AC: ld a,(de) + or a + jr z,loc_15CA + inc de + inc de + push hl + push de + ld b,8 +loc_15B6: ld a,(de) + cp (hl) + jr nz,loc_15BE + inc hl + inc de + djnz loc_15B6 +loc_15BE: pop de + pop hl + jr z,loc_15CD + ex de,hl + ld bc,10h + add hl,bc + ex de,hl + jr loc_15AC + +loc_15CA: or 0FFh + ret + +loc_15CD: dec de + ld a,(de) + ld (byte_2D0E),a + dec de + ld a,(de) + ld (byte_2D0D),a + xor a + ret + +;---------------------------------------------------------------------------- +; Validate character at hl is a valid filename character + +valid_fnc: ld a,(hl) + cp '!' ; below ! + jr c,loc_15F8 + cp '=' + ret z + cp '_' + ret z + cp '.' + ret z + cp ':' + ret z + cp ',' + ret z + cp '<' + ret z + cp '>' + ret z + or a ; null + ret z + cp 3bh ; ';' + ret + +loc_15F8: xor a + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_15FA: push bc + ld bc,1100h ; ? +loc_15FE: ld a,(hl) ; duplicious ? + call valid_fnc + jr z,loc_161E + inc hl + call sub_1625 + jr c,loc_1622 + ld d,a + ld a,c + rlca + jr c,loc_1622 + rlca + jr c,loc_1622 + add a,c + jr c,loc_1622 + rlca + jr c,loc_1622 + add a,d + jr c,loc_1622 + ld c,a + djnz loc_15FE +loc_161E: ld a,c + pop bc + or a + ret +; +loc_1622: pop bc + scf + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1625: sub 30h + ret c + cp 0Ah + ccf + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_162C: xor a + ld (de),a + inc de + call sub_1632 +sub_1632: ld b,0Bh + ld a,20h + call sub_1645 + xor a + ld (de),a + inc de + call sub_1687 + ld a,c + ld (de),a + inc de + ld b,3 + xor a +sub_1645: ld (de),a + inc de + djnz sub_1645 + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_164A: push hl + push de + ld de,2Eh + jp loc_1669 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1652: push hl + push de + ld de,2Ch + jp loc_1669 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_165A: push hl + push de + ld de,2Dh + jp loc_1669 +; +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1662: push de + ld de,15h + jp loc_1676 + +;---------------------------------------------------------------------------- + +loc_1669: ld hl,(word_2D0F) + ld a,h + or l + jr z,loc_1671 + add hl,de +loc_1671: ld a,(hl) + pop de + pop hl + or a + ret + +;---------------------------------------------------------------------------- + +loc_1676: ld hl,(word_2D0F) + add hl,de + ld e,(hl) + inc hl + ld d,(hl) + inc hl + ld a,(hl) + ex de,hl + pop de + or a + ret + +;---------------------------------------------------------------------------- + +loc_1683: ld (word_2D0F),hl + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1687: push af + push de + push hl + ld c,DRV_GET + call bdos_s2 + push af + ld e, 0FFh + ld c,F_USERNUM + call bdos_s2 + ld c,a + pop af + ld b,a + pop hl + pop de + pop af + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_169E: ld a,F_SFIRST + call bdos_cs3 + inc a + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_16A5: ld a,C_READ + jp bdos_cs3 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_16AA: ld a,C_STAT + jp bdos_cs3 + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +bdos_s2: push de + push bc + call bdos + pop bc + pop de + or a + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +bdos_cs3: push hl + push de + push bc + ld c,a + call bdos + or a + pop bc + pop de + pop hl + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_16C4: push bc + push hl + push de + push af + ld b,8 + call sub_16DA + ld (hl),2Eh + inc hl + ld b,3 + call sub_16DA + pop af + pop de + pop hl + pop bc + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_16DA: ld a,(de) + and 7Fh + cp 20h + jr z,loc_16E3 + ld (hl),a + inc hl +loc_16E3: inc de + djnz sub_16DA + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_16E7: push bc + ld b,0 + jp loc_16F0 +sub_16ED: PUSH BC + LD B,0FFH +loc_16F0: push hl + push af + ld h,64h + call sub_1703 + ld h,0Ah + call sub_1703 + call sub_1717 + pop af + pop hl + pop bc + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1703: ld l, 0FFh +loc_1705: sub h + inc l + jr nc,loc_1705 + add a,h + ld h,a + ld a,l + or a + jr nz,sub_1717 + or b + ld a,h + ret m + ld a,20h + jr z,loc_171A + xor a +sub_1717: add a,30h + ld b,a +loc_171A: ld (de),a + inc de + ld a,h + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_171E: push af + push hl +loc_1720: ld a,(hl) + or a + jr z,loc_172B + call sub_1793 + ld (hl),a + inc hl + jr loc_1720 +loc_172B: pop hl + pop af + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_172E: push bc + push de + push hl + ld c,a + ex de,hl + ld b,(hl) + push hl + inc hl + inc hl +loc_1737: call sub_176B + or a + jr z,loc_1760 + ld (hl),e + inc hl + ld (hl),d + inc hl + dec b + jr z,loc_1755 + call sub_1779 + or a + jr z,loc_1760 + ld a,c + or a + jr z,loc_1751 + xor a + ld (de),a + inc de +loc_1751: ld a,b + or a + jr nz,loc_1737 +loc_1755: call sub_1779 + call sub_176B + or a + jr z,loc_1760 + or 0FFh +loc_1760: pop hl + push af + ld a,(hl) + sub b + inc hl + ld (hl),a + pop af + pop hl + pop de + pop bc + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_176B: ld a,(de) + and 7Fh + inc de + cp 20h + jr z,sub_176B + cp 9 + jr z,sub_176B + dec de + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1779: ld a,(de) + and 7Fh + ret z + cp 20h + ret z + cp 9 + ret z + inc de + jr sub_1779 + +;---------------------------------------------------------------------------- +; Fill b locations starting at hl with value a + +fill_bhla: push hl + call fill_1 + pop hl + ret + +;---------------------------------------------------------------------------- +; Fill b locations starting at hl with value a + +fill_1: push bc +loc_178D: ld (hl),a + inc hl + djnz loc_178D + pop bc + ret + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_1793: and 7Fh + cp 61h + ret c + cp 7Bh + ret nc + and 5Fh + ret + +;---------------------------------------------------------------------------- +word_179E: .dw loc_end +byte_17A0: .db 0 +byte_17A1: .db 0 +word_17A2: .db 0 +file_fcb: .db 0 + .fill $20,0 +loc_17C4: .db 0 + .db 0 + .db 0 +byte_17C7: .db 0 + .fill $1800-$,0 + .ds 8 +nstack: +rbuf_bfree: .ds 2 + .ds rbuf_size+4 +byte_280E: .ds 1 +byte_280F: .ds 1 +byte_2810: .ds 1 +loc_2811: .ds 80h +byte_2891: .ds 1 + .ds 3 +loc_2895: .ds 4 +loc_2899: .ds 4 +loc_289D: .ds 400h +byte_2C9D: .ds 1 +byte_2C9E: .ds 1 +loc_2C9F: .ds 1 + .ds 1 +byte_2CA1: .ds 1 +byte_2CA2: .ds 1 +byte_2CA3: .ds 1 +byte_2CA4: .ds 1 +byte_2CA5: .ds 1 +byte_2CA6: .ds 1 +loc_2CA7: .ds 4 +loc_2CAB: .ds 4 +loc_2CAF: .ds 21h +loc_2CD0: .ds 1 +byte_2CD1: .ds 1 +word_2CD2: .ds 2 +byte_2CD4: .ds 1 + .ds 0Bh +loc_2CE0: .ds 4 +loc_2CE4: .ds 4 +byte_2CE8: .ds 1 +word_2CE9: .ds 2 +word_2CEB: .ds 2 +word_2CED: .ds 2 +word_2CEF: .ds 2 + .ds 2 +loc_2CF3: .ds 2 +word_2CF5: .ds 2 + .ds 2 +loc_2CF9: .ds 4 +byte_2CFD: .ds 1 +word_2CFE: .ds 2 +byte_2D00: .ds 1 +byte_2D01: .ds 1 +byte_2D02: .ds 1 +byte_2D03: .ds 1 +byte_2D04: .ds 1 +word_2D05: .ds 2 +byte_2D07: .ds 1 +byte_2D08: .ds 1 +byte_2D09: .ds 1 +byte_2D0A: .ds 1 +byte_2D0B: .ds 1 +byte_2D0C: .ds 1 +byte_2D0D: .ds 1 +byte_2D0E: .ds 1 +word_2D0F: .ds 2 +loc_end .equ $ + .end ; start diff --git a/Source/Apps/Test/rzsz/rz.com.orig b/Source/Apps/Test/rzsz/rz.com.orig new file mode 100644 index 00000000..b0767674 Binary files /dev/null and b/Source/Apps/Test/rzsz/rz.com.orig differ diff --git a/Source/Apps/Test/rzsz/sz.asm b/Source/Apps/Test/rzsz/sz.asm new file mode 100644 index 00000000..3db52b16 --- /dev/null +++ b/Source/Apps/Test/rzsz/sz.asm @@ -0,0 +1,7447 @@ +; sz (send Zmodem) is a disassembly of CP/M 3 binaries by Wilfried Schmitten released in 1992. +; this file is an attempt to reconstruct the Z80 assembler source code which has been lost +; credit to Wilfried Schmitten for writing this program initially + +; +; +-----------------------------------------------------------------+ +; | This file is generated by The Interactive Disassembler (IDA) FW | +; | Copyright (c) 1997 by DataRescue sprl, | +; | Professional version of IDA is at http://www.idapro.com | +; +-----------------------------------------------------------------+ +; + + +; File Name C:\SZ.COM +; Format COM File +; Base Address: 0000h Range: 0100h - 1F80h Loaded length: 1E80h + +; Processor: z80 +; Target assembler: Table Driven Assembler (TASM) by Speech Technology Inc. + +bdos .equ 0005h + +A_READ .equ 3 +A_STATIN .equ 7 +A_STATOUT .equ 8 +C_WRITESTR .equ 9 +S_BDOSVER .equ 12 +DRV_SET .equ 14 +F_SFIRST .equ 17 +DRV_GET .equ 25 +F_DMAOFF .equ 26 +DRV_DPB .equ 31 +F_USERNUM .equ 32 +S_SYSVAR .equ 49 + +;---------------------------------------------------------------------------- + + .org 100h + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +start: + jp loc_0_10B +;---------------------------------------------------------------------------- + .db 5Ah ; Z + .db 33h ; 3 + .db 45h ; E + .db 4Eh ; N + .db 56h ; V + .db 1 ; +word_0_109: .dw 0 ; DATA XREF: start+Er +;---------------------------------------------------------------------------- + +loc_0_10B: ; CODE XREF: startj + ld sp, 2067h + ld hl, (word_0_109) + call sub_0_17C5 + ld c, S_BDOSVER + call bdos + cp 30h + jp c, loc_0_21E + ld de, 231h + ld c, C_WRITESTR + call bdos + call sub_0_1F1 + ld a, (80h) + or a + jp z, loc_0_226 + ld hl, (word_0_1F78) + ld (hl), 2 + ld de, 82h + ex de, hl + ld a, 0FFh + call sub_0_1EAB + ld hl, (word_0_1F78) + inc hl + ld a, (hl) + or a + jp z, loc_0_226 + inc hl + ld e, (hl) + inc hl + ld d, (hl) + inc hl + ld a, (de) + cp 2Dh + jr nz, loc_0_157 + call sub_0_3B3 + ld e, (hl) + inc hl + ld d, (hl) + +loc_0_157: ; CODE XREF: start+4Fj + ld a, d + or e + jr z, loc_0_196 + ld hl, 2003h + ex de, hl + call sub_0_15D4 + ld hl, 2003h + xor a + or (hl) + jr nz, loc_0_16D + ld a, (2001h) + ld (hl), a + +loc_0_16D: ; CODE XREF: start+67j + ld (byte_0_8AE), a + ld bc, 0Dh + add hl, bc + dec de + ldi + ld de, 2003h + call sub_0_20C + or a + jp nz, loc_0_1E1 + ld hl, (word_0_1F78) + ld a, (2002h) + or 0C0h + ld de, 2003h + call sub_0_17C9 + ld (word_0_8A6), hl + ld a, c + ld (26F7h), a + +loc_0_196: ; CODE XREF: start+59j + push af + push bc + push de + push hl + ld de, 36Ch + call sub_0_1E49 + ld de, 36Ch + ld c, C_WRITESTR + call bdos + pop hl + pop de + pop bc + pop af + or a + jp z, loc_0_1E1 + ex de, hl + ld h, b + ld l, c + add hl, hl + add hl, hl + add hl, hl + add hl, hl + ex de, hl + add hl, de + ld (26EFh), hl + ld de, (6) + ex de, hl + or a + sbc hl, de + ld (26F3h), hl + ld hl, 0 + ld (26F1h), hl + ld (26F5h), hl + ld de, 385h + ld c, C_WRITESTR + call bdos + call sub_0_408 + call sub_0_854 + call sub_0_46A + +loc_0_1E1: ; CODE XREF: start+7Ej start+ADj + ; DATA XREF: ... + ld bc, 0 + ld (2002h), bc + ld de, 2003h + call sub_0_20C + jp 0 +; End of function start + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1F1: ; CODE XREF: start+26p + ld a, (4) + ld b, a + rlca + rlca + rlca + rlca + and 0Fh + ld (2000h), a + ld a, b + and 0Fh + inc a + ld (2001h), a + ld hl, (2000h) + ld (loc_0_1E1+1), hl + ret +; End of function sub_0_1F1 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_20C: ; CODE XREF: start+7Ap start+EBp + ld a, (de) + push af + dec de + ld a, (de) + ld e, a + ld c, F_USERNUM + call bdos + pop af + dec a + ld e, a + ld c, DRV_SET + jp bdos +; End of function sub_0_20C + +;---------------------------------------------------------------------------- + +loc_0_21E: ; CODE XREF: start+1Bj + ld de, 259h + ld c, C_WRITESTR + call bdos + +loc_0_226: ; CODE XREF: start+2Dj start+44j + ld de, 26Eh + ld c, C_WRITESTR + call bdos + jp 0 +;---------------------------------------------------------------------------- + .db 53h ; S + .db 5Ah ; Z + .db 20h ; + .db 66h ; f + .db 6Fh ; o + .db 72h ; r + .db 20h ; + .db 43h ; C + .db 50h ; P + .db 2Fh ; / + .db 4Dh ; M + .db 20h ; + .db 33h ; 3 + .db 20h ; + .db 20h ; + .db 20h ; + .db 56h ; V + .db 20h ; + .db 31h ; 1 + .db 2Eh ; . + .db 31h ; 1 + .db 31h ; 1 + .db 0Dh ; + .db 0Ah ; + .db 28h ; ( + .db 43h ; C + .db 29h ; ) + .db 20h ; + .db 39h ; 9 + .db 32h ; 2 + .db 20h ; + .db 77h ; w + .db 73h ; s + .db 68h ; h + .db 62h ; b + .db 67h ; g + .db 0Dh ; + .db 0Ah ; + .db 0Ah ; + .db 24h ; $ + .db 73h ; s + .db 6Fh ; o + .db 72h ; r + .db 72h ; r + .db 79h ; y + .db 2Ch ; , + .db 20h ; + .db 43h ; C + .db 50h ; P + .db 2Fh ; / + .db 4Dh ; M + .db 20h ; + .db 33h ; 3 + .db 20h ; + .db 54h ; T + .db 6Fh ; o + .db 6Fh ; o + .db 6Ch ; l + .db 0Dh ; + .db 0Ah ; + .db 24h ; $ + .db 75h ; u + .db 73h ; s + .db 61h ; a + .db 67h ; g + .db 65h ; e + .db 3Ah ; : + .db 20h ; + .db 73h ; s + .db 7Ah ; z + .db 20h ; + .db 5Bh ; [ + .db 2Dh ; - + .db 3Fh ; ? + .db 70h ; p + .db 61h ; a + .db 62h ; b + .db 63h ; c + .db 78h ; x + .db 79h ; y + .db 7Ah ; z + .db 5Dh ; ] + .db 20h ; + .db 5Bh ; [ + .db 64h ; d + .db 75h ; u + .db 3Ah ; : + .db 5Dh ; ] + .db 66h ; f + .db 6Eh ; n + .db 0Dh ; + .db 0Ah ; + .db 0Ah ; + .db 20h ; + .db 6Fh ; o + .db 70h ; p + .db 74h ; t + .db 69h ; i + .db 6Fh ; o + .db 6Eh ; n + .db 73h ; s + .db 3Ah ; : + .db 0Dh ; + .db 0Ah ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 3Fh ; ? + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 74h ; t + .db 68h ; h + .db 69h ; i + .db 73h ; s + .db 20h ; + .db 68h ; h + .db 65h ; e + .db 6Ch ; l + .db 70h ; p + .db 0Dh ; + .db 0Ah ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 70h ; p + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 70h ; p + .db 72h ; r + .db 6Fh ; o + .db 74h ; t + .db 65h ; e + .db 63h ; c + .db 74h ; t + .db 20h ; + .db 46h ; F + .db 69h ; i + .db 6Ch ; l + .db 65h ; e + .db 20h ; + .db 61h ; a + .db 74h ; t + .db 20h ; + .db 64h ; d + .db 65h ; e + .db 73h ; s + .db 74h ; t + .db 69h ; i + .db 6Eh ; n + .db 61h ; a + .db 74h ; t + .db 69h ; i + .db 6Fh ; o + .db 6Eh ; n + .db 0Dh ; + .db 0Ah ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 61h ; a + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 61h ; a + .db 70h ; p + .db 70h ; p + .db 65h ; e + .db 6Eh ; n + .db 64h ; d + .db 0Dh ; + .db 0Ah ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 62h ; b + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 72h ; r + .db 65h ; e + .db 63h ; c + .db 65h ; e + .db 69h ; i + .db 76h ; v + .db 65h ; e + .db 20h ; + .db 62h ; b + .db 69h ; i + .db 6Eh ; n + .db 61h ; a + .db 72h ; r + .db 79h ; y + .db 0Dh ; + .db 0Ah ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 63h ; c + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 63h ; c + .db 6Fh ; o + .db 6Eh ; n + .db 76h ; v + .db 65h ; e + .db 72h ; r + .db 74h ; t + .db 20h ; + .db 74h ; t + .db 6Fh ; o + .db 20h ; + .db 6Ch ; l + .db 6Fh ; o + .db 63h ; c + .db 61h ; a + .db 6Ch ; l + .db 20h ; + .db 6Ch ; l + .db 69h ; i + .db 6Eh ; n + .db 65h ; e + .db 66h ; f + .db 65h ; e + .db 65h ; e + .db 64h ; d + .db 0Dh ; + .db 0Ah ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 78h ; x + .db 2Ch ; , + .db 79h ; y + .db 2Ch ; , + .db 7Ah ; z + .db 20h ; + .db 50h ; P + .db 72h ; r + .db 6Fh ; o + .db 74h ; t + .db 6Fh ; o + .db 6Bh ; k + .db 6Fh ; o + .db 6Ch ; l + .db 6Ch ; l + .db 0Dh ; + .db 0Ah ; + .db 24h ; $ + .db 20h ; + .db 20h ; + .db 20h ; + .db 20h ; + .db 46h ; F + .db 69h ; i + .db 6Ch ; l + .db 65h ; e + .db 28h ; ( + .db 73h ; s + .db 29h ; ) + .db 20h ; + .db 72h ; r + .db 65h ; e + .db 71h ; q + .db 75h ; u + .db 65h ; e + .db 73h ; s + .db 74h ; t + .db 65h ; e + .db 64h ; d + .db 0Dh ; + .db 0Ah ; + .db 0Ah ; + .db 24h ; $ + .db 73h ; s + .db 74h ; t + .db 61h ; a + .db 72h ; r + .db 74h ; t + .db 20h ; + .db 79h ; y + .db 6Fh ; o + .db 75h ; u + .db 72h ; r + .db 20h ; + .db 6Ch ; l + .db 6Fh ; o + .db 63h ; c + .db 61h ; a + .db 6Ch ; l + .db 20h ; + .db 58h ; X + .db 2Fh ; / + .db 59h ; Y + .db 2Fh ; / + .db 5Ah ; Z + .db 4Dh ; M + .db 6Fh ; o + .db 64h ; d + .db 65h ; e + .db 6Dh ; m + .db 20h ; + .db 72h ; r + .db 65h ; e + .db 63h ; c + .db 65h ; e + .db 69h ; i + .db 76h ; v + .db 65h ; e + .db 20h ; + .db 70h ; p + .db 72h ; r + .db 6Fh ; o + .db 67h ; g + .db 72h ; r + .db 61h ; a + .db 6Dh ; m + .db 0Dh ; + .db 0Ah ; + .db 24h ; $ + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_3B3: ; CODE XREF: start+51p + push hl + push de + +loc_0_3B5: ; CODE XREF: sub_0_3B3+12j + inc de + ld a, (de) + or a + jr z, loc_0_3C7 + ld hl, 3CAh + ld bc, 8 + cpir + call z, sub_0_629 + jr loc_0_3B5 +;---------------------------------------------------------------------------- + +loc_0_3C7: ; CODE XREF: sub_0_3B3+5j + pop de + pop hl + ret +; End of function sub_0_3B3 + +;---------------------------------------------------------------------------- + .db 3Fh ; ? + .db 50h ; P + .db 41h ; A + .db 42h ; B + .db 43h ; C + .db 58h ; X + .db 59h ; Y + .db 5Ah ; Z + .db 0EAh ; ê + .db 3 ; + .db 0E6h ; æ + .db 3 ; + .db 0E2h ; â + .db 3 ; + .db 2 ; + .db 4 ; + .db 0FCh ; ü + .db 3 ; + .db 0F6h ; ö + .db 3 ; + .db 0F0h ; ð + .db 3 ; + .db 26h ; & + .db 2 ; + .db 3Eh ; > + .db 1 ; + .db 18h ; + .db 6 ; + .db 3Eh ; > + .db 3 ; + .db 18h ; + .db 2 ; + .db 3Eh ; > + .db 4 ; + .db 32h ; 2 + .db 52h ; R + .db 8 ; + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 32h ; 2 + .db 0EBh ; ë + .db 26h ; & + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 32h ; 2 + .db 0ECh ; ì + .db 26h ; & + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 32h ; 2 + .db 0EEh ; î + .db 26h ; & + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 32h ; 2 + .db 0EDh ; í + .db 26h ; & + .db 0C9h ; É + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_408: ; CODE XREF: start+D8p + xor a + ld (byte_0_479), a + ld (byte_0_47D), a + ld c, 31h + ld de, 478h + call bdos + ld a, h + cpl + ld h, a + ld a, l + cpl + ld l, a + ld (word_0_488), hl + ld c, S_SYSVAR + ld de, 47Ch + call bdos + ld (word_0_484), hl + ld de, (word_0_488) + ld a, h + and d + ld h, a + ld a, l + and e + ld l, a + ld (word_0_47E), hl + ld c, 31h + ld de, 480h + call bdos + ld (word_0_486), hl + ld de, (word_0_488) + ld a, h + and d + ld h, a + ld a, l + and e + ld l, a + ld (word_0_482), hl + +loc_0_450: ; CODE XREF: sub_0_46A+Cj + ld a, 0FEh + ld (byte_0_47D), a + ld de, 47Ch + ld c, S_SYSVAR + call bdos + ld a, 0FEh + ld (byte_0_481), a + ld de, 480h + ld c, S_SYSVAR + jp bdos +; End of function sub_0_408 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_46A: ; CODE XREF: start+DEp + ld hl, (word_0_484) + ld (word_0_47E), hl + ld hl, (word_0_486) + ld (word_0_482), hl + jr loc_0_450 +; End of function sub_0_46A + +;---------------------------------------------------------------------------- + .db 28h ; ( +byte_0_479: .db 0 ; DATA XREF: sub_0_408+1w + .db 0 ; + .db 0 ; + .db 24h ; $ +byte_0_47D: .db 0 ; DATA XREF: sub_0_408+4w sub_0_408+4Aw +word_0_47E: .dw 0 ; DATA XREF: sub_0_408+2Dw + ; sub_0_46A+3w + .db 22h ; " +byte_0_481: .db 0 ; DATA XREF: sub_0_408+57w +word_0_482: .dw 0 ; DATA XREF: sub_0_408+45w + ; sub_0_46A+9w +word_0_484: .dw 0 ; DATA XREF: sub_0_408+20w + ; sub_0_46Ar +word_0_486: .dw 0 ; DATA XREF: sub_0_408+38w + ; sub_0_46A+6r +word_0_488: .dw 0 ; DATA XREF: sub_0_408+15w + ; sub_0_408+23r ... + .db 3Ah ; : + .db 9Fh ; Ÿ + .db 26h ; & + .db 11h ; + .db 9Dh ;  + .db 4 ; + .db 0CDh ; à + .db 49h ; I + .db 1Eh ; + .db 11h ; + .db 9Bh ; › + .db 4 ; + .db 0Eh ; + .db 9 ; + .db 0C3h ; à + .db 5 ; + .db 0 ; + .db 0Dh ; + .db 0Ah ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 20h ; + .db 65h ; e + .db 72h ; r + .db 72h ; r + .db 6Fh ; o + .db 72h ; r + .db 28h ; ( + .db 73h ; s + .db 29h ; ) + .db 0Dh ; + .db 0Ah ; + .db 24h ; $ + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_4AC: ; CODE XREF: sub_0_922+39p + ld de, 226Eh + ld hl, 4EDh + ld (hl), 3Ah + inc hl + xor a + ld b, 0Dh + call sub_0_1F03 + inc de + call sub_0_1E26 + dec de + ld a, (de) + add a, 40h + ld (byte_0_4E9), a + dec de + ld a, (de) + ld de, 4EAh + call sub_0_1E49 + ld hl, 26E3h + ld de, 4FCh + call loc_0_71E + ld (hl), 0Dh + inc hl + ld (hl), 0Ah + inc hl + ld (hl), 24h + ld de, 4E7h + ld c, C_WRITESTR + jp bdos +; End of function sub_0_4AC + +;---------------------------------------------------------------------------- + .db 0Dh ; + .db 0Ah ; +byte_0_4E9: .db 0 ; DATA XREF: sub_0_4AC+17w + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 20h ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_508: ; CODE XREF: seg000:0AFAp + ld hl, 26A4h + ld de, 51Ch + call loc_0_71E + ld (hl), 24h + ld de, 51Bh + ld c, C_WRITESTR + jp bdos +; End of function sub_0_508 + +;---------------------------------------------------------------------------- + .db 0Dh ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_526: ; CODE XREF: sub_0_8C1+33p + ld de, 542h + jr loc_0_52E +; End of function sub_0_526 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_52B: ; CODE XREF: sub_0_8C1+21p + ld de, 533h + +loc_0_52E: ; CODE XREF: sub_0_526+3j + ld c, C_WRITESTR + jp bdos +; End of function sub_0_52B + +;---------------------------------------------------------------------------- + .db 46h ; F + .db 69h ; i + .db 6Ch ; l + .db 65h ; e + .db 20h ; + .db 73h ; s + .db 6Bh ; k + .db 69h ; i + .db 70h ; p + .db 70h ; p + .db 65h ; e + .db 64h ; d + .db 0Dh ; + .db 0Ah ; + .db 24h ; $ + .db 63h ; c + .db 61h ; a + .db 6Eh ; n + .db 27h ; ' + .db 74h ; t + .db 20h ; + .db 6Fh ; o + .db 70h ; p + .db 65h ; e + .db 6Eh ; n + .db 20h ; + .db 61h ; a + .db 6Eh ; n + .db 79h ; y + .db 20h ; + .db 66h ; f + .db 69h ; i + .db 6Ch ; l + .db 65h ; e + .db 0Dh ; + .db 0Ah ; + .db 24h ; $ + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_558: ; CODE XREF: sub_0_15B6+Dp + ld hl, 55Fh + ld (hl), a + inc hl + ld (hl), c + ret +; End of function sub_0_558 + +;---------------------------------------------------------------------------- + .db 0 ; +byte_0_560: .db 0 ; DATA XREF: sub_0_58Dr + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_561: ; CODE XREF: sub_0_561+1Fj + ; sub_0_5AD+4p ... + or a + ld hl, (2067h) + ld de, 200h + sbc hl, de + jr z, loc_0_582 + ld c, A_STATIN + call bdos + or a + jr z, loc_0_582 + ld c, A_READ + call bdos + ld c, a + ld hl, 2067h + call sub_0_5F5 + jr sub_0_561 +;---------------------------------------------------------------------------- + +loc_0_582: ; CODE XREF: sub_0_561+9j sub_0_561+11j + ld hl, 560h + or (hl) + ret nz + ld hl, (2067h) + ld a, h + or l + ret +; End of function sub_0_561 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_58D: ; CODE XREF: sub_0_5AD+12p + ld a, (byte_0_560) + or a + ld hl, 2067h + jp z, loc_0_5D0 + push af + ld hl, 560h + dec (hl) + dec hl + pop af + ld a, (hl) + ret +; End of function sub_0_58D + +;---------------------------------------------------------------------------- + .db 0Eh ; + .db 4 ; + .db 5Fh ; _ + .db 0C3h ; à + .db 5 ; + .db 0 ; + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_5A6: ; CODE XREF: seg000:12ACp + ld c, A_STATOUT + call bdos + or a + ret +; End of function sub_0_5A6 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_5AD: ; CODE XREF: sub_0_15B6+11p + push bc + ld b, 5Fh + +loc_0_5B0: ; CODE XREF: sub_0_5AD+Dj + push bc + call sub_0_561 + pop bc + jr nz, loc_0_5BF + call sub_0_5C4 + djnz loc_0_5B0 + call sub_0_561 + +loc_0_5BF: ; CODE XREF: sub_0_5AD+8j + call nz, sub_0_58D + pop bc + ret +; End of function sub_0_5AD + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_5C4: ; CODE XREF: sub_0_5AD+Ap + push bc + ld a, 4 + ld b, 0 + +loc_0_5C9: ; CODE XREF: sub_0_5C4+5j sub_0_5C4+8j + djnz loc_0_5C9 + dec a + jr nz, loc_0_5C9 + pop bc + ret +; End of function sub_0_5C4 + +;---------------------------------------------------------------------------- + +loc_0_5D0: ; CODE XREF: sub_0_58D+7j + ld e, (hl) + inc hl + ld d, (hl) + ld a, d + or e + ret z + dec de + ld (hl), d + dec hl + ld (hl), e + ld de, 4 + add hl, de + push hl + ld e, (hl) + inc hl + ld d, (hl) + inc hl + add hl, de + ex (sp), hl + inc de + ld a, e + and 0FFh + ld (hl), a + inc hl + ld a, d + and 1 + ld (hl), a + pop hl + ld a, 1 + or a + ld a, (hl) + ret + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_5F5: ; CODE XREF: sub_0_561+1Cp + or a + push hl + ld e, (hl) + inc hl + ld d, (hl) + ld hl, 200h + sbc hl, de + pop hl + ret z + inc de + ld (hl), e + inc hl + ld (hl), d + inc hl + push hl + ld e, (hl) + inc hl + ld d, (hl) + inc hl + inc hl + inc hl + add hl, de + ex (sp), hl + inc de + ld a, e + and 0FFh + ld (hl), a + inc hl + ld a, d + and 1 + ld (hl), a + pop hl + ld (hl), c + ret +; End of function sub_0_5F5 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_61C: ; CODE XREF: sub_0_854+15p + ld hl, 226Dh + ld b, 25h + jr loc_0_625 +; End of function sub_0_61C + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_623: ; CODE XREF: sub_0_854+1Ep + ld b, 6 + +loc_0_625: ; CODE XREF: sub_0_61C+5j + xor a + jp sub_0_1F03 +; End of function sub_0_623 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_629: ; CODE XREF: sub_0_3B3+Fp sub_0_9D9+21j + ; ... + add hl, bc + sla c + add hl, bc + ld c, (hl) + inc hl + ld h, (hl) + ld l, c + jp (hl) +; End of function sub_0_629 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_632: ; CODE XREF: seg000:06D0p sub_0_8C1+18p + ; ... + xor a + push bc + push de + push hl + ld (hl), a + ld d, h + ld e, l + inc de + jr loc_0_641 +; End of function sub_0_632 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_63C: ; CODE XREF: seg000:0725p seg000:0757p + ; ... + push bc + push de + push hl + ldi + +loc_0_641: ; CODE XREF: sub_0_632+8j + ldi + ldi + ldi + pop hl + pop de + pop bc + ret +; End of function sub_0_63C + +;---------------------------------------------------------------------------- + .db 0E5h ; Ã¥ + .db 0DDh ; à + .db 0E1h ; á + .db 0D5h ; Õ + .db 0FDh ; ý + .db 0E1h ; á + .db 0DDh ; à + .db 7Eh ; ~ + .db 3 ; + .db 0FDh ; ý + .db 0AEh ; ® + .db 3 ; + .db 0F2h ; ò + .db 60h ; ` + .db 6 ; + .db 0DDh ; à + .db 0AEh ; ® + .db 3 ; + .db 0F8h ; ø + .db 3Fh ; ? + .db 0C9h ; É + .db 0DDh ; à + .db 0AEh ; ® + .db 3 ; + .db 0F2h ; ò + .db 6Ch ; l + .db 6 ; + .db 0CDh ; à + .db 6Ch ; l + .db 6 ; + .db 37h ; 7 + .db 18h ; + .db 0F1h ; ñ + .db 0C5h ; Ã… + .db 0D5h ; Õ + .db 0E5h ; Ã¥ + .db 0EBh ; ë + .db 0B7h ; · + .db 6 ; + .db 4 ; + .db 1Ah ; + .db 9Eh ; ž + .db 13h ; + .db 23h ; # + .db 10h ; + .db 0FAh ; ú + .db 0E1h ; á + .db 0D1h ; Ñ + .db 0C1h ; à + .db 0C9h ; É + .db 0C5h ; Ã… + .db 0D5h ; Õ + .db 0E5h ; Ã¥ + .db 6 ; + .db 4 ; + .db 1Ah ; + .db 0AEh ; ® + .db 20h ; + .db 4 ; + .db 13h ; + .db 23h ; # + .db 10h ; + .db 0F8h ; ø + .db 0E1h ; á + .db 0D1h ; Ñ + .db 0C1h ; à + .db 0C9h ; É + .db 0C5h ; Ã… + .db 0D5h ; Õ + .db 0E5h ; Ã¥ + .db 0B7h ; · + .db 8 ; + .db 3Eh ; > + .db 4 ; + .db 8 ; + .db 1Ah ; + .db 8Eh ; ÂŽ + .db 2 ; + .db 3 ; + .db 13h ; + .db 23h ; # + .db 8 ; + .db 3Dh ; = + .db 20h ; + .db 0F5h ; õ + .db 0E1h ; á + .db 0D1h ; Ñ + .db 0C1h ; à + .db 0C9h ; É + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_6A4: ; CODE XREF: seg000:0743p + push bc + push de + push hl + ex de, hl + or a + ex af, af' + ld a, 4 + +loc_0_6AC: ; CODE XREF: sub_0_6A4+11j + ex af, af' + ld a, (de) + sbc a, (hl) + ld (bc), a + inc bc + inc hl + inc de + ex af, af' + dec a + jr nz, loc_0_6AC + ex af, af' + pop hl + pop de + pop bc + ret +; End of function sub_0_6A4 + +;---------------------------------------------------------------------------- + .db 0C5h ; Ã… + .db 0E5h ; Ã¥ + .db 3Eh ; > + .db 1 ; + .db 86h ; † + .db 77h ; w + .db 30h ; 0 + .db 9 ; + .db 6 ; + .db 3 ; + .db 23h ; # + .db 3Eh ; > + .db 0 ; + .db 8Eh ; ÂŽ + .db 77h ; w + .db 10h ; + .db 0F9h ; ù + .db 0E1h ; á + .db 0C1h ; à + .db 0C9h ; É +;---------------------------------------------------------------------------- + +loc_0_6D0: ; CODE XREF: sub_0_12DC+Cj + call sub_0_632 + push bc + push hl + ld a, (hl) + sub 1 + ld (hl), a + ld b, 3 + +loc_0_6DB: ; CODE XREF: seg000:06E0j + inc hl + ld a, (hl) + sbc a, 0 + ld (hl), a + djnz loc_0_6DB + pop hl + pop bc + ret +;---------------------------------------------------------------------------- + .db 0C5h ; Ã… + .db 0D5h ; Õ + .db 0E5h ; Ã¥ + .db 0EBh ; ë + .db 3Eh ; > + .db 4 ; + .db 0F5h ; õ + .db 1Ah ; + .db 0A6h ; ¦ + .db 2 ; + .db 3 ; + .db 13h ; + .db 23h ; # + .db 0F1h ; ñ + .db 3Dh ; = + .db 20h ; + .db 0F5h ; õ + .db 0E1h ; á + .db 0D1h ; Ñ + .db 0C1h ; à + .db 0C9h ; É + .db 0 ; + .db 0CAh ; Ê + .db 9Ah ; š + .db 3Bh ; ; + .db 0 ; + .db 0E1h ; á + .db 0F5h ; õ + .db 5 ; + .db 80h ; € + .db 96h ; – + .db 98h ; ˜ + .db 0 ; + .db 40h ; @ + .db 42h ; B + .db 0Fh ; + .db 0 ; + .db 0A0h ;   + .db 86h ; † + .db 1 ; + .db 0 ; + .db 10h ; + .db 27h ; ' + .db 0 ; + .db 0 ; + .db 0E8h ; è + .db 3 ; + .db 0 ; + .db 0 ; + .db 64h ; d + .db 0 ; + .db 0 ; + .db 0 ; + .db 0Ah ; + .db 0 ; + .db 0 ; + .db 0 ; +;---------------------------------------------------------------------------- + +loc_0_71E: ; CODE XREF: sub_0_4AC+28p + ; sub_0_508+6p ... + ld (word_0_769), de + ld de, 2293h + call sub_0_63C + ld c, 9 + ld de, 6F6h + xor a + ld (byte_0_764), a + ld a, 30h + ld (byte_0_75E), a + inc de + inc de + inc de + inc de + ld b, 0Ah + +loc_0_73C: ; CODE XREF: seg000:075Bj + push bc + ld hl, 2293h + ld bc, 2297h + call sub_0_6A4 + pop bc + jr c, unk_0_75D + push de + ld a, (byte_0_75E) + inc a + ld (byte_0_75E), a + ld de, 2293h + ld hl, 2297h + call sub_0_63C + pop de + djnz loc_0_73C +;---------------------------------------------------------------------------- +unk_0_75D: .db 3Eh ; > ; CODE XREF: seg000:0747j +byte_0_75E: .db 30h ; DATA XREF: seg000:0733w seg000:074Ar + ; ... + .db 0FEh ; þ + .db 30h ; 0 + .db 20h ; + .db 5 ; + .db 3Eh ; > +byte_0_764: .db 0 ; DATA XREF: seg000:072Ew + .db 0B7h ; · + .db 28h ; ( + .db 0Dh ; + .db 21h ; ! +word_0_769: .dw 0 ; DATA XREF: seg000:071Ew + .db 77h ; w + .db 23h ; # + .db 22h ; " + .db 69h ; i + .db 7 ; + .db 3Eh ; > + .db 30h ; 0 + .db 32h ; 2 + .db 64h ; d + .db 7 ; + .db 0Dh ; + .db 20h ; + .db 0B9h ; ¹ + .db 3Ah ; : + .db 93h ; “ + .db 22h ; " + .db 0E6h ; æ + .db 0Fh ; + .db 0C6h ; Æ + .db 30h ; 0 + .db 2Ah ; * + .db 69h ; i + .db 7 ; + .db 77h ; w + .db 23h ; # + .db 36h ; 6 + .db 0 ; + .db 0C9h ; É + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_787: ; CODE XREF: seg000:0B26p + push af + +loc_0_788: ; DATA XREF: sub_0_787+3w sub_0_12DC+3w + add a, 0 + ld (loc_0_788+1), a + pop af + ret +; End of function sub_0_787 + +;---------------------------------------------------------------------------- + .db 20h ; + .db 83h ; ƒ + .db 0B8h ; ¸ + .db 0EDh ; í + .db 0E3h ; ã + .db 20h ; + .db 0BBh ; » + .db 0DEh ; Þ +;---------------------------------------------------------------------------- + +loc_0_797: ; CODE XREF: sub_0_118C+4Dp + ; sub_0_118C+5Cp + push af +;---------------------------------------------------------------------------- + .db 0FDh ; ý + .db 21h ; ! +word_0_79A: .dw 229Fh ; DATA XREF: sub_0_7CF+2r + .db 0DDh ; à + .db 21h ; ! + .db 9Bh ; › + .db 22h ; " + .db 0DDh ; à + .db 0AEh ; ® + .db 0 ; + .db 26h ; & + .db 0 ; + .db 6Fh ; o + .db 29h ; ) + .db 29h ; ) + .db 44h ; D + .db 4Dh ; M + .db 0FDh ; ý + .db 9 ; + .db 0FDh ; ý + .db 7Eh ; ~ + .db 0 ; + .db 0DDh ; à + .db 0AEh ; ® + .db 1 ; + .db 0DDh ; à + .db 77h ; w + .db 0 ; + .db 0FDh ; ý + .db 7Eh ; ~ + .db 1 ; + .db 0DDh ; à + .db 0AEh ; ® + .db 2 ; + .db 0DDh ; à + .db 77h ; w + .db 1 ; + .db 0FDh ; ý + .db 7Eh ; ~ + .db 2 ; + .db 0DDh ; à + .db 0AEh ; ® + .db 3 ; + .db 0DDh ; à + .db 77h ; w + .db 2 ; + .db 0FDh ; ý + .db 7Eh ; ~ + .db 3 ; + .db 0DDh ; à + .db 77h ; w + .db 3 ; + .db 0F1h ; ñ + .db 0C9h ; É + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_7CF: ; CODE XREF: sub_0_854+18p + push de + push hl + ld hl, (word_0_79A) + ld bc, 3FFh + add hl, bc + push hl + pop iy + ld ix, 78Fh + xor a + +loc_0_7E0: ; CODE XREF: sub_0_7CF+5Bj + push af + ld hl, 0FFFFh + ld de, 0FFFFh + xor e + ld e, a + ld b, 8 + +loc_0_7EB: ; CODE XREF: sub_0_7CF+3Bj + scf + rr h + rr l + rr d + rr e + jr nc, loc_0_80A + ld a, e + xor (ix+0) + ld e, a + ld a, d + xor (ix+1) + ld d, a + ld a, l + xor (ix+2) + ld l, a + ld a, h + xor (ix+3) + ld h, a + +loc_0_80A: ; CODE XREF: sub_0_7CF+25j + djnz loc_0_7EB + ld a, h + cpl + ld (iy+0), a + dec iy + ld a, l + cpl + ld (iy+0), a + dec iy + ld a, d + cpl + ld (iy+0), a + dec iy + ld a, e + cpl + ld (iy+0), a + dec iy + pop af + inc a + jr nz, loc_0_7E0 + pop hl + pop de + ret +; End of function sub_0_7CF + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_82F: ; CODE XREF: seg000:0B29p sub_0_118C+20p + ; ... + push af + +loc_0_830: ; DATA XREF: sub_0_82F+16w + ; sub_0_118C+3Fr ... + ld hl, 0 + ld de, 1021h + xor h + ld h, a + ld b, 8 + +loc_0_83A: ; CODE XREF: sub_0_82F+14j + add hl, hl + jr nc, loc_0_843 + ld a, h + xor d + ld h, a + ld a, l + xor e + ld l, a + +loc_0_843: ; CODE XREF: sub_0_82F+Cj + djnz loc_0_83A + ld (loc_0_830+1), hl + pop af + ret +; End of function sub_0_82F + +;---------------------------------------------------------------------------- + .db 0 ; + .db 4 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0FCh ; ü + .db 0FFh ; ÿ + .db 0FFh ; ÿ +byte_0_852: .db 4 ; DATA XREF: sub_0_854r sub_0_854+9w + ; ... + .db 20h ; + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_854: ; CODE XREF: start+DBp + ld a, (byte_0_852) + cp 4 + jr nz, loc_0_860 + ld a, 3 + ld (byte_0_852), a + +loc_0_860: ; CODE XREF: sub_0_854+5j + xor a + ld hl, 269Fh + ld b, 50h + call sub_0_1F03 + call sub_0_61C + call sub_0_7CF + ld hl, 2067h + call sub_0_623 + ld hl, (26F3h) + call sub_0_88A + ld hl, 400h + ld (26CFh), hl + call sub_0_8C1 + jr c, loc_0_888 + or a + ret +;---------------------------------------------------------------------------- + +loc_0_888: ; CODE XREF: sub_0_854+30j + scf + ret +; End of function sub_0_854 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_88A: ; CODE XREF: sub_0_854+24p + xor a + ld c, a + ld b, 8 + ld a, h + +loc_0_88F: ; CODE XREF: sub_0_88A+Cj + rlca + set 7, c + jr c, loc_0_898 + rr c + djnz loc_0_88F + +loc_0_898: ; CODE XREF: sub_0_88A+8j + ld a, h + and c + ld h, a + ld l, 0 + ld (26F3h), hl + dec hl + ld (26DAh), hl + ret +; End of function sub_0_88A + +;---------------------------------------------------------------------------- +unk_0_8A5: .db 21h ; ! ; CODE XREF: sub_0_8C1+12p +word_0_8A6: .dw 0 ; DATA XREF: start+8Fw + .db 11h ; + .db 6Dh ; m + .db 22h ; " + .db 0EDh ; í + .db 0A0h ;   + .db 3Eh ; > +byte_0_8AE: .db 0 ; DATA XREF: start+6Dw + .db 12h ; + .db 13h ; + .db 1 ; + .db 0Bh ; + .db 0 ; + .db 0EDh ; í + .db 0B0h ; ° + .db 2Ah ; * + .db 0A6h ; ¦ + .db 8 ; + .db 1 ; + .db 10h ; + .db 0 ; + .db 9 ; + .db 22h ; " + .db 0A6h ; ¦ + .db 8 ; + .db 0C9h ; É + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_8C1: ; CODE XREF: sub_0_854+2Dp + xor a + ld (26A9h), a + ld a, 0FFh + ld (26AEh), a + ld a, (26F7h) + or a + jr z, loc_0_8F4 + ld b, a + +loc_0_8D1: ; CODE XREF: sub_0_8C1+2Bj + push bc + ld a, b + call unk_0_8A5 + ld hl, 26DCh + call sub_0_632 + call sub_0_922 + push af + cp 5 + call z, sub_0_52B + call sub_0_1C09 + pop af + pop bc + jr c, loc_0_8F7 + djnz loc_0_8D1 + ld a, (26D9h) + or a + jr nz, loc_0_8FE + +loc_0_8F4: ; CODE XREF: sub_0_8C1+Dj + call sub_0_526 + +loc_0_8F7: ; CODE XREF: sub_0_8C1+29j + call sub_0_15A8 + ld a, 0FFh + scf + ret +;---------------------------------------------------------------------------- + +loc_0_8FE: ; CODE XREF: sub_0_8C1+31j + ld a, (byte_0_852) + cp 3 + jr c, loc_0_920 + jr nz, loc_0_91D + xor a + ld (26E1h), a + ld hl, (26EFh) + ld b, 80h + call sub_0_1F03 + ld hl, 80h + ld (26E7h), hl + call loc_0_AE4 + xor a + +loc_0_91D: ; CODE XREF: sub_0_8C1+44j + call nz, sub_0_10DD + +loc_0_920: ; CODE XREF: sub_0_8C1+42j + xor a + ret +; End of function sub_0_8C1 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_922: ; CODE XREF: sub_0_8C1+1Bp + ld de, 226Eh + call sub_0_1DA3 + ld de, 0 + srl h + rr l + rr e + ld d, l + ld l, h + ld h, 0 + ld (26E3h), de + ld (26E5h), hl + ld hl, 26C3h + call sub_0_632 + ld de, 226Eh + call sub_0_1BDB + jr z, loc_0_94C + xor a + ret +;---------------------------------------------------------------------------- + +loc_0_94C: ; CODE XREF: sub_0_922+26j + xor a + ld (269Fh), a + ld a, 0 + ld (26D6h), a + ld (26D7h), a + ld de, 226Eh + call sub_0_4AC + ld hl, 26D9h + inc (hl) + call sub_0_972 + ret c + cp 5 + ret z + ld a, (byte_0_852) + cp 4 + call nz, sub_0_A4C + ret +; End of function sub_0_922 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_972: ; CODE XREF: sub_0_922+40p + ld hl, (26EFh) + xor a + ld b, 80h + call sub_0_1F03 + ld de, 226Fh + call sub_0_1E26 + ld b, 0Ch + +loc_0_983: ; CODE XREF: sub_0_972+1Bj + ld a, (hl) + call loc_0_1F10 + jr nz, loc_0_98C + or 20h + ld (hl), a + +loc_0_98C: ; CODE XREF: sub_0_972+15j + inc hl + djnz loc_0_983 + ld hl, (26EFh) + call sub_0_1E9E + ld (hl), 0 + inc hl + ld de, 26E3h + ex de, hl + push de + call loc_0_71E + pop de + ld a, (byte_0_852) + cp 3 + ccf + ret nc + ld a, (26D8h) + cp 68h + call nz, sub_0_9D9 + ret c + xor a + ld (26E1h), a + ld a, (byte_0_852) + cp 3 + ld hl, 80h + ld (26E7h), hl + jp z, loc_0_AE4 + ld hl, (26EFh) + call sub_0_1E9E + inc hl + call sub_0_1E9E + ld de, (26EFh) + or a + sbc hl, de + inc hl + ex de, hl + jp loc_0_C8B +; End of function sub_0_972 + + +;---------------------------------------------------------------------------- +; S u b r o u t i n e + +sub_0_9D9: ; CODE XREF: sub_0_972+3Bp + ld a, (byte_0_852) + cp 3 + ld a, 0 + call nc, sub_0_1204 + xor a + ld (26E2h), a + ld (26E0h), a + +loc_0_9EA: ; CODE XREF: sub_0_9D9+2Aj + ld b, 0FFh + call sub_0_15B6 + ld (26E0h), a + ld hl, 0A31h + ld bc, 5 + cpir + jp z, sub_0_629 + ld a, (26E0h) + ld (26E2h), a + jr loc_0_9EA +; End of function sub_0_9D9 + +;---------------------------------------------------------------------------- + .db 6 ; + .db 14h ; + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 32h ; 2 + .db 0E0h ; à + .db 26h ; & + .db 0FEh ; þ + .db 18h ; + .db 20h ; + .db 0ECh ; ì + .db 21h ; ! + .db 0E2h ; â + .db 26h ; & + .db 0BEh ; ¾ + .db 20h ; + .db 0E6h ; æ + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 3Eh ; > + .db 10h ; + .db 32h ; 2 + .db 0A9h ; © + .db 26h ; & + .db 0AFh ; ¯ + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 0CDh ; à + .db 0F0h ; ð + .db 0Bh ; + .db 0D8h ; Ø + .db 3Eh ; > + .db 4 ; + .db 32h ; 2 + .db 52h ; R + .db 8 ; + .db 0AFh ; ¯ + .db 0C9h ; É + .db 2Ah ; * + .db 0FEh ; þ + .db 43h ; C + .db 15h ; + .db 18h ; + .db 5 ; + .db 0Ah ; + .db 20h ; + .db 0Ah ; + .db 1Bh ; + .db 0Ah ; + .db 22h ; " + .db 0Ah ; + .db 26h ; & + .db 0Ah ; + .db 15h ; + .db 43h ; C + .db 0FEh ; þ + .db 18h ; + .db 76h ; v + .db 0Ah ; + .db 0DDh ; à + .db 0Ah ; + .db 7Ah ; z + .db 0Ah ; + .db 7Fh ;  + .db 0Ah ; + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_A4C: ; CODE XREF: sub_0_922+4Cp + xor a + ld (26A9h), a + ld a, 0FFh + ld (26AEh), a + ld hl, 26B7h + call sub_0_632 + ld hl, 26DCh + call sub_0_632 + +loc_0_A61: ; CODE XREF: sub_0_A4C+25j + ld b, 0FFh + call sub_0_15B6 + ld (26E0h), a + ld hl, 0A40h + ld bc, 4 + cpir + jr nz, loc_0_A61 + jp sub_0_629 +; End of function sub_0_A4C + +;---------------------------------------------------------------------------- + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 3Eh ; > + .db 10h ; + .db 32h ; 2 + .db 0A9h ; © + .db 26h ; & + .db 0AFh ; ¯ + .db 32h ; 2 + .db 0E1h ; á + .db 26h ; & + .db 21h ; ! + .db 0E3h ; ã + .db 26h ; & + .db 11h ; + .db 0B7h ; · + .db 26h ; & + .db 1 ; + .db 0C7h ; Ç + .db 26h ; & + .db 0CDh ; à + .db 0A4h ; ¤ + .db 6 ; + .db 21h ; ! + .db 0C7h ; Ç + .db 26h ; & + .db 11h ; + .db 4Ah ; J + .db 8 ; + .db 0CDh ; à + .db 4Bh ; K + .db 6 ; + .db 21h ; ! + .db 0 ; + .db 4 ; + .db 30h ; 0 + .db 3 ; + .db 21h ; ! + .db 80h ; € + .db 0 ; + .db 22h ; " + .db 0E7h ; ç + .db 26h ; & + .db 0EDh ; í + .db 4Bh ; K + .db 0E7h ; ç + .db 26h ; & + .db 0CDh ; à + .db 0A2h ; ¢ + .db 10h ; + .db 38h ; 8 + .db 31h ; 1 + .db 0B7h ; · + .db 28h ; ( + .db 4 ; + .db 7Ah ; z + .db 0B3h ; ³ + .db 28h ; ( + .db 16h ; + .db 21h ; ! + .db 0E1h ; á + .db 26h ; & + .db 34h ; 4 + .db 0CDh ; à + .db 0E4h ; ä + .db 0Ah ; + .db 0D8h ; Ø + .db 21h ; ! + .db 0B7h ; · + .db 26h ; & + .db 11h ; + .db 0E7h ; ç + .db 26h ; & + .db 1 ; + .db 0B7h ; · + .db 26h ; & + .db 0CDh ; à + .db 8Eh ; ÂŽ + .db 6 ; + .db 18h ; + .db 0BAh ; º + .db 6 ; + .db 5 ; + .db 0C5h ; Ã… + .db 3Eh ; > + .db 4 ; + .db 0CDh ; à + .db 0A6h ; ¦ + .db 12h ; + .db 6 ; + .db 64h ; d + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 0FEh ; þ + .db 6 ; + .db 28h ; ( + .db 7 ; + .db 0C1h ; à + .db 10h ; + .db 0EEh ; î + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 0C1h ; à + .db 0AFh ; ¯ + .db 0C9h ; É +;---------------------------------------------------------------------------- + +loc_0_AE4: ; CODE XREF: sub_0_8C1+58p + ; sub_0_972+4Ej + xor a + ld (26E0h), a + ld (269Fh), a + ld a, (26E0h) + ld (26E2h), a + ld hl, 26B7h + ld de, 26A4h + call sub_0_63C + call sub_0_508 + ld hl, (26E7h) + ld (word_0_B34), hl + ld a, l + cp 80h + ld a, 1 + jr z, loc_0_B0C + ld a, 2 + +loc_0_B0C: ; CODE XREF: seg000:0B08j + call loc_0_12A6 + ld a, (26E1h) + call loc_0_12A6 + ld a, (26E1h) + cpl + call loc_0_12A6 + call sub_0_12DC + ld ix, (26EFh) + ld a, (ix+0) + call sub_0_787 + call sub_0_82F + push ix + call loc_0_12A6 + pop ix +;---------------------------------------------------------------------------- + .db 21h ; ! +word_0_B34: .dw 0 ; DATA XREF: seg000:0B00w + .db 2Bh ; + + .db 22h ; " + .db 34h ; 4 + .db 0Bh ; + .db 0DDh ; à + .db 23h ; # + .db 7Ch ; | + .db 0B5h ; µ + .db 20h ; + .db 0E3h ; ã + .db 3Ah ; : + .db 0A9h ; © + .db 26h ; & + .db 0FEh ; þ + .db 10h ; + .db 28h ; ( + .db 5 ; + .db 3Ah ; : + .db 89h ; ‰ + .db 7 ; + .db 18h ; + .db 9 ; + .db 3Ah ; : + .db 32h ; 2 + .db 8 ; + .db 0CDh ; à + .db 0A6h ; ¦ + .db 12h ; + .db 3Ah ; : + .db 31h ; 1 + .db 8 ; + .db 0CDh ; à + .db 0A6h ; ¦ + .db 12h ; + .db 6 ; + .db 64h ; d + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 32h ; 2 + .db 0E0h ; à + .db 26h ; & + .db 3Ah ; : + .db 0E0h ; à + .db 26h ; & + .db 21h ; ! + .db 9Ch ; œ + .db 0Bh ; + .db 1 ; + .db 6 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 0C3h ; à + .db 0BAh ; º + .db 0Bh ; + .db 3Ah ; : + .db 0E2h ; â + .db 26h ; & + .db 0FEh ; þ + .db 18h ; + .db 0C2h ;  + .db 0BAh ; º + .db 0Bh ; + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 0C3h ; à + .db 0DDh ; à + .db 0Bh ; + .db 3Ah ; : + .db 0AEh ; ® + .db 26h ; & + .db 0FEh ; þ + .db 0FFh ; ÿ + .db 20h ; + .db 5 ; + .db 3Eh ; > + .db 10h ; + .db 32h ; 2 + .db 0A9h ; © + .db 26h ; & + .db 0C3h ; à + .db 0DDh ; à + .db 0Bh ; + .db 3Eh ; > + .db 0 ; + .db 32h ; 2 + .db 0AEh ; ® + .db 26h ; & + .db 0AFh ; ¯ + .db 32h ; 2 + .db 9Fh ; Ÿ + .db 26h ; & + .db 0C9h ; É + .db 0C3h ; à + .db 0BAh ; º + .db 0Bh ; + .db 18h ; + .db 0FEh ; þ + .db 43h ; C + .db 15h ; + .db 6 ; + .db 0FFh ; ÿ + .db 99h ; ™ + .db 0Bh ; + .db 8Fh ;  + .db 0Bh ; + .db 8Ch ; ÂŒ + .db 0Bh ; + .db 80h ; € + .db 0Bh ; + .db 7Dh ; } + .db 0Bh ; + .db 71h ; q + .db 0Bh ; + .db 0FEh ; þ + .db 15h ; + .db 43h ; C + .db 18h ; + .db 0D3h ; Ó + .db 0Bh ; + .db 60h ; ` + .db 0Bh ; + .db 60h ; ` + .db 0Bh ; + .db 0DDh ; à + .db 0Bh ; + .db 3Ah ; : + .db 0E0h ; à + .db 26h ; & + .db 32h ; 2 + .db 0E2h ; â + .db 26h ; & + .db 6 ; + .db 64h ; d + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 32h ; 2 + .db 0E0h ; à + .db 26h ; & + .db 21h ; ! + .db 0AEh ; ® + .db 0Bh ; + .db 1 ; + .db 4 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 3Ah ; : + .db 0E2h ; â + .db 26h ; & + .db 0FEh ; þ + .db 18h ; + .db 0CAh ; Ê + .db 79h ; y + .db 0Bh ; + .db 18h ; + .db 0DDh ; à + .db 21h ; ! + .db 9Fh ; Ÿ + .db 26h ; & + .db 34h ; 4 + .db 0CDh ; à + .db 8Ah ; Š + .db 4 ; + .db 3Ah ; : + .db 9Fh ; Ÿ + .db 26h ; & + .db 0FEh ; þ + .db 5 ; + .db 0DAh ; Ú + .db 0EBh ; ë + .db 0Ah ; + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 3Eh ; > + .db 0Bh ; + .db 32h ; 2 + .db 0F8h ; ø + .db 26h ; & + .db 21h ; ! + .db 0F8h ; ø + .db 26h ; & + .db 35h ; 5 + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C8h ; È + .db 0CDh ; à + .db 0EBh ; ë + .db 12h ; + .db 21h ; ! + .db 79h ; y + .db 0Ch ; + .db 1 ; + .db 6 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 3Eh ; > + .db 6 ; + .db 0CDh ; à + .db 4 ; + .db 12h ; + .db 18h ; + .db 0E3h ; ã + .db 21h ; ! + .db 0A0h ;   + .db 26h ; & + .db 11h ; + .db 0AAh ; ª + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 3Eh ; > + .db 3 ; + .db 0CDh ; à + .db 4 ; + .db 12h ; + .db 18h ; + .db 0D3h ; Ó + .db 21h ; ! + .db 0AAh ; ª + .db 26h ; & + .db 0CDh ; à + .db 32h ; 2 + .db 6 ; + .db 3Eh ; > + .db 0 ; + .db 0CDh ; à + .db 4 ; + .db 12h ; + .db 18h ; + .db 0C6h ; Æ + .db 0DDh ; à + .db 21h ; ! + .db 0A0h ;   + .db 26h ; & + .db 0DDh ; à + .db 7Eh ; ~ + .db 3 ; + .db 32h ; 2 + .db 0D4h ; Ô + .db 26h ; & + .db 0E6h ; æ + .db 20h ; + .db 32h ; 2 + .db 0A9h ; © + .db 26h ; & + .db 3Ah ; : + .db 0D4h ; Ô + .db 26h ; & + .db 0E6h ; æ + .db 40h ; @ + .db 32h ; 2 + .db 0D5h ; Õ + .db 26h ; & + .db 0DDh ; à + .db 6Eh ; n + .db 0 ; + .db 0DDh ; à + .db 66h ; f + .db 1 ; + .db 22h ; " + .db 0CBh ; Ë + .db 26h ; & + .db 7Ch ; | + .db 0B5h ; µ + .db 20h ; + .db 0Bh ; + .db 3Ah ; : + .db 53h ; S + .db 8 ; + .db 17h ; + .db 17h ; + .db 67h ; g + .db 2Eh ; . + .db 0 ; + .db 22h ; " + .db 0CBh ; Ë + .db 26h ; & + .db 21h ; ! + .db 0 ; + .db 4 ; + .db 22h ; " + .db 0CFh ; à + .db 26h ; & + .db 0AFh ; ¯ + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 0DDh ; à + .db 21h ; ! + .db 0A0h ;   + .db 26h ; & + .db 0DDh ; à + .db 7Eh ; ~ + .db 3 ; + .db 0FEh ; þ + .db 12h ; + .db 0CAh ; Ê + .db 0F5h ; õ + .db 0Bh ; + .db 0C3h ; à + .db 0Bh ; + .db 0Ch ; + .db 0Eh ; + .db 12h ; + .db 1 ; + .db 10h ; + .db 0FEh ; þ + .db 0 ; + .db 6Ah ; j + .db 0Ch ; + .db 66h ; f + .db 0Ch ; + .db 66h ; f + .db 0Ch ; + .db 2Fh ; / + .db 0Ch ; + .db 22h ; " + .db 0Ch ; + .db 12h ; + .db 0Ch ; +;---------------------------------------------------------------------------- + +loc_0_C8B: ; CODE XREF: sub_0_972+64j + ld (word_0_CD2), de + ld hl, 26B7h + call sub_0_632 + ld ix, 26AAh + ld a, (26EEh) + cp 0FFh + ld a, 1 + jr z, loc_0_CAC + ld a, (26EDh) + cp 0FFh + ld a, 2 + jr z, loc_0_CAC + xor a + +loc_0_CAC: ; CODE XREF: seg000:0CA0j seg000:0CA9j + ld (ix+3), a + ld a, (26EBh) + cp 0FFh + ld a, 7 + jr z, loc_0_CC2 + ld a, (26ECh) + cp 0FFh + ld a, 3 + jr z, loc_0_CC2 + xor a + +loc_0_CC2: ; CODE XREF: seg000:0CB6j seg000:0CBFj + ld (ix+2), a + xor a + ld (ix+1), a + ld (ix+0), a + ld a, 4 + call sub_0_118C +;---------------------------------------------------------------------------- + .db 1 ; +word_0_CD2: .dw 0 ; DATA XREF: seg000:0C8Bw + .db 3Eh ; > + .db 6Bh ; k + .db 0CDh ; à + .db 0FDh ; ý + .db 10h ; + .db 0CDh ; à + .db 0EBh ; ë + .db 12h ; + .db 21h ; ! + .db 2Fh ; / + .db 0Dh ; + .db 1 ; + .db 8 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 18h ; + .db 0ACh ; ¬ + .db 6 ; + .db 32h ; 2 + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 38h ; 8 + .db 0A5h ; Â¥ + .db 0FEh ; þ + .db 2Ah ; * + .db 28h ; ( + .db 0E5h ; Ã¥ + .db 18h ; + .db 0F3h ; ó + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 0C3h ; à + .db 0D9h ; Ù + .db 0Ch ; + .db 3Eh ; > + .db 5 ; + .db 0C9h ; É + .db 21h ; ! + .db 0B3h ; ³ + .db 26h ; & + .db 11h ; + .db 0FAh ; ú + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 0CDh ; à + .db 8Fh ;  + .db 0Fh ; + .db 0D8h ; Ø + .db 21h ; ! + .db 0B3h ; ³ + .db 26h ; & + .db 11h ; + .db 0AFh ; ¯ + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 11h ; + .db 0B7h ; · + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 11h ; + .db 0BBh ; » + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 11h ; + .db 0BFh ; ¿ + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 0EBh ; ë + .db 0CDh ; à + .db 0D3h ; Ó + .db 6 ; + .db 0C3h ; à + .db 47h ; G + .db 0Dh ; + .db 1 ; + .db 10h ; + .db 0FEh ; þ + .db 7 ; + .db 8 ; + .db 0Dh ; + .db 5 ; + .db 9 ; + .db 0 ; + .db 0Dh ; + .db 0FDh ; ý + .db 0Ch ; + .db 0FAh ; ú + .db 0Ch ; + .db 0F6h ; ö + .db 0Ch ; + .db 0F6h ; ö + .db 0Ch ; + .db 0F6h ; ö + .db 0Ch ; + .db 0F6h ; ö + .db 0Ch ; + .db 0E9h ; é + .db 0Ch ; + .db 0AFh ; ¯ + .db 32h ; 2 + .db 0D3h ; Ó + .db 26h ; & + .db 32h ; 2 + .db 9Fh ; Ÿ + .db 26h ; & + .db 0C3h ; à + .db 0B6h ; ¶ + .db 0Dh ; + .db 0AFh ; ¯ + .db 32h ; 2 + .db 0F9h ; ù + .db 26h ; & + .db 3Eh ; > + .db 0FFh ; ÿ + .db 0CDh ; à + .db 0D1h ; Ñ + .db 0Eh ; + .db 21h ; ! + .db 6Eh ; n + .db 0Dh ; + .db 1 ; + .db 5 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 3Eh ; > + .db 5 ; + .db 0C9h ; É + .db 0AFh ; ¯ + .db 0C9h ; É + .db 10h ; + .db 5 ; + .db 3 ; + .db 9 ; + .db 1 ; + .db 6Ch ; l + .db 0Dh ; + .db 81h ;  + .db 0Dh ; + .db 7Dh ; } + .db 0Dh ; + .db 69h ; i + .db 0Dh ; + .db 65h ; e + .db 0Dh ; + .db 0AFh ; ¯ + .db 32h ; 2 + .db 9Fh ; Ÿ + .db 26h ; & + .db 0CDh ; à + .db 61h ; a + .db 5 ; + .db 28h ; ( + .db 30h ; 0 + .db 6 ; + .db 0Ah ; + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 21h ; ! + .db 0A7h ; § + .db 0Dh ; + .db 1 ; + .db 5 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 20h ; + .db 0ECh ; ì + .db 0C3h ; à + .db 29h ; ) + .db 6 ; + .db 3Eh ; > + .db 0 ; + .db 0CDh ; à + .db 0D1h ; Ñ + .db 0Eh ; + .db 0C3h ; à + .db 5Ah ; Z + .db 0Dh ; + .db 6 ; + .db 64h ; d + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 18h ; + .db 0E4h ; ä + .db 0FEh ; þ + .db 18h ; + .db 2Ah ; * + .db 13h ; + .db 93h ; “ + .db 0A0h ;   + .db 0Dh ; + .db 0A0h ;   + .db 0Dh ; + .db 98h ; ˜ + .db 0Dh ; + .db 98h ; ˜ + .db 0Dh ; + .db 65h ; e + .db 0Dh ; + .db 2Ah ; * + .db 0CBh ; Ë + .db 26h ; & + .db 22h ; " + .db 0CDh ; à + .db 26h ; & + .db 21h ; ! + .db 0B7h ; · + .db 26h ; & + .db 11h ; + .db 0AAh ; ª + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 3Eh ; > + .db 0Ah ; + .db 0CDh ; à + .db 8Ch ; ÂŒ + .db 11h ; + .db 0CDh ; à + .db 42h ; B + .db 10h ; + .db 0D8h ; Ø + .db 22h ; " + .db 2 ; + .db 27h ; ' + .db 3Ah ; : + .db 0D6h ; Ö + .db 26h ; & + .db 0FEh ; þ + .db 0FFh ; ÿ + .db 20h ; + .db 8 ; + .db 3Eh ; > + .db 68h ; h + .db 32h ; 2 + .db 0D8h ; Ø + .db 26h ; & + .db 0C3h ; à + .db 16h ; + .db 0Eh ; + .db 3Ah ; : + .db 0F9h ; ù + .db 26h ; & + .db 0FEh ; þ + .db 4 ; + .db 38h ; 8 + .db 8 ; + .db 3Eh ; > + .db 6Bh ; k + .db 32h ; 2 + .db 0D8h ; Ø + .db 26h ; & + .db 0C3h ; à + .db 16h ; + .db 0Eh ; + .db 21h ; ! + .db 0BBh ; » + .db 26h ; & + .db 11h ; + .db 0BFh ; ¿ + .db 26h ; & + .db 0CDh ; à + .db 7Dh ; } + .db 6 ; + .db 28h ; ( + .db 0EDh ; í + .db 2Ah ; * + .db 0CBh ; Ë + .db 26h ; & + .db 7Ch ; | + .db 0B5h ; µ + .db 28h ; ( + .db 10h ; + .db 2Ah ; * + .db 0CDh ; à + .db 26h ; & + .db 0EDh ; í + .db 5Bh ; [ + .db 2 ; + .db 27h ; ' + .db 0EDh ; í + .db 52h ; R + .db 22h ; " + .db 0CDh ; à + .db 26h ; & + .db 28h ; ( + .db 0D8h ; Ø + .db 38h ; 8 + .db 0D6h ; Ö + .db 3Eh ; > + .db 69h ; i + .db 32h ; 2 + .db 0D8h ; Ø + .db 26h ; & + .db 3Ah ; : + .db 0D8h ; Ø + .db 26h ; & + .db 0EDh ; í + .db 4Bh ; K + .db 2 ; + .db 27h ; ' + .db 0CDh ; à + .db 0FDh ; ý + .db 10h ; + .db 11h ; + .db 2 ; + .db 27h ; ' + .db 21h ; ! + .db 0B7h ; · + .db 26h ; & + .db 1 ; + .db 0B7h ; · + .db 26h ; & + .db 0CDh ; à + .db 8Eh ; ÂŽ + .db 6 ; + .db 21h ; ! + .db 0B7h ; · + .db 26h ; & + .db 11h ; + .db 0BBh ; » + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 3Ah ; : + .db 0D8h ; Ø + .db 26h ; & + .db 0FEh ; þ + .db 6Bh ; k + .db 0CAh ; Ê + .db 51h ; Q + .db 0Dh ; + .db 0CDh ; à + .db 61h ; a + .db 5 ; + .db 28h ; ( + .db 51h ; Q + .db 6 ; + .db 0Ah ; + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 21h ; ! + .db 84h ; „ + .db 0Eh ; + .db 1 ; + .db 5 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 21h ; ! + .db 0F9h ; ù + .db 26h ; & + .db 34h ; 4 + .db 18h ; + .db 0E5h ; Ã¥ + .db 3Eh ; > + .db 0 ; + .db 0CDh ; à + .db 0D1h ; Ñ + .db 0Eh ; + .db 0FEh ; þ + .db 3 ; + .db 28h ; ( + .db 32h ; 2 + .db 0F5h ; õ + .db 21h ; ! + .db 67h ; g + .db 20h ; + .db 0CDh ; à + .db 23h ; # + .db 6 ; + .db 0CDh ; à + .db 61h ; a + .db 5 ; + .db 20h ; + .db 0F5h ; õ + .db 3Eh ; > + .db 68h ; h + .db 1 ; + .db 0 ; + .db 0 ; + .db 0CDh ; à + .db 0FDh ; ý + .db 10h ; + .db 0F1h ; ñ + .db 0C3h ; à + .db 5Ah ; Z + .db 0Dh ; + .db 6 ; + .db 64h ; d + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 21h ; ! + .db 0F9h ; ù + .db 26h ; & + .db 34h ; 4 + .db 18h ; + .db 0C3h ; à + .db 0FEh ; þ + .db 18h ; + .db 2Ah ; * + .db 13h ; + .db 93h ; “ + .db 79h ; y + .db 0Eh ; + .db 79h ; y + .db 0Eh ; + .db 58h ; X + .db 0Eh ; + .db 58h ; X + .db 0Eh ; + .db 65h ; e + .db 0Dh ; + .db 3Ah ; : + .db 0D6h ; Ö + .db 26h ; & + .db 0FEh ; þ + .db 0FFh ; ÿ + .db 0C2h ;  + .db 0CAh ; Ê + .db 0Dh ; + .db 21h ; ! + .db 0B7h ; · + .db 26h ; & + .db 11h ; + .db 0AAh ; ª + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 3Eh ; > + .db 0Bh ; + .db 0CDh ; à + .db 8Ch ; ÂŒ + .db 11h ; + .db 3Eh ; > + .db 0FFh ; ÿ + .db 0CDh ; à + .db 0D1h ; Ñ + .db 0Eh ; + .db 21h ; ! + .db 0C5h ; Ã… + .db 0Eh ; + .db 1 ; + .db 4 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 18h ; + .db 0DCh ; Ü + .db 0C3h ; à + .db 4Eh ; N + .db 0Dh ; + .db 0AFh ; ¯ + .db 0C9h ; É + .db 0C9h ; É + .db 3 ; + .db 9 ; + .db 1 ; + .db 5 ; + .db 0C4h ; Ä + .db 0Eh ; + .db 0C2h ;  + .db 0Eh ; + .db 0BFh ; ¿ + .db 0Eh ; + .db 0BDh ; ½ + .db 0Eh ; + .db 32h ; 2 + .db 0FAh ; ú + .db 0Eh ; + .db 0CDh ; à + .db 0EBh ; ë + .db 12h ; + .db 21h ; ! + .db 74h ; t + .db 0Fh ; + .db 1 ; + .db 9 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 3Eh ; > + .db 6 ; + .db 0CDh ; à + .db 8Ch ; ÂŒ + .db 11h ; + .db 18h ; + .db 0EBh ; ë + .db 0C9h ; É + .db 0F5h ; õ + .db 0CDh ; à + .db 9 ; + .db 1Ch ; + .db 0F1h ; ñ + .db 0C9h ; É + .db 11h ; + .db 0AFh ; ¯ + .db 26h ; & + .db 21h ; ! + .db 0B3h ; ³ + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 3Eh ; > + .db 0 ; + .db 0FEh ; þ + .db 0 ; + .db 3Eh ; > + .db 3 ; + .db 0C8h ; È + .db 11h ; + .db 0B7h ; · + .db 26h ; & + .db 21h ; ! + .db 0B3h ; ³ + .db 26h ; & + .db 0CDh ; à + .db 7Dh ; } + .db 6 ; + .db 3Eh ; > + .db 3 ; + .db 0C8h ; È + .db 0C3h ; à + .db 0D4h ; Ô + .db 0Eh ; + .db 21h ; ! + .db 0B3h ; ³ + .db 26h ; & + .db 11h ; + .db 0FAh ; ú + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 0CDh ; à + .db 8Fh ;  + .db 0Fh ; + .db 0D8h ; Ø + .db 3Eh ; > + .db 0 ; + .db 32h ; 2 + .db 0D6h ; Ö + .db 26h ; & + .db 21h ; ! + .db 9Fh ; Ÿ + .db 26h ; & + .db 34h ; 4 + .db 0CDh ; à + .db 8Ah ; Š + .db 4 ; + .db 21h ; ! + .db 0B3h ; ³ + .db 26h ; & + .db 11h ; + .db 0B7h ; · + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 11h ; + .db 0AFh ; ¯ + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 11h ; + .db 0BBh ; » + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 11h ; + .db 0BFh ; ¿ + .db 26h ; & + .db 0CDh ; à + .db 7Dh ; } + .db 6 ; + .db 20h ; + .db 1Fh ; + .db 3Ah ; : + .db 0D3h ; Ó + .db 26h ; & + .db 3Ch ; < + .db 32h ; 2 + .db 0D3h ; Ó + .db 26h ; & + .db 0FEh ; þ + .db 5 ; + .db 38h ; 8 + .db 14h ; + .db 21h ; ! + .db 20h ; + .db 0 ; + .db 0EDh ; í + .db 5Bh ; [ + .db 0CFh ; à + .db 26h ; & + .db 0B7h ; · + .db 0EDh ; í + .db 52h ; R + .db 30h ; 0 + .db 8 ; + .db 0CBh ; Ë + .db 3Ah ; : + .db 0CBh ; Ë + .db 1Bh ; + .db 0EDh ; í + .db 53h ; S + .db 0CFh ; à + .db 26h ; & + .db 21h ; ! + .db 0B3h ; ³ + .db 26h ; & + .db 11h ; + .db 0BFh ; ¿ + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 3Eh ; > + .db 9 ; + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 10h ; + .db 7 ; + .db 8 ; + .db 0FEh ; þ + .db 9 ; + .db 3 ; + .db 1 ; + .db 5 ; + .db 0FFh ; ÿ + .db 0E2h ; â + .db 0Eh ; + .db 0E9h ; é + .db 0Eh ; + .db 0EAh ; ê + .db 0Eh ; + .db 0F0h ; ð + .db 0Eh ; + .db 0Fh ; + .db 0Fh ; + .db 70h ; p + .db 0Fh ; + .db 70h ; p + .db 0Fh ; + .db 70h ; p + .db 0Fh ; + .db 70h ; p + .db 0Fh ; + .db 21h ; ! + .db 0C3h ; à + .db 26h ; & + .db 11h ; + .db 0F3h ; ó + .db 26h ; & + .db 1 ; + .db 0C7h ; Ç + .db 26h ; & + .db 0CDh ; à + .db 0A4h ; ¤ + .db 6 ; + .db 21h ; ! + .db 0FAh ; ú + .db 26h ; & + .db 11h ; + .db 0C7h ; Ç + .db 26h ; & + .db 0CDh ; à + .db 4Bh ; K + .db 6 ; + .db 0D2h ; Ã’ + .db 0D2h ; Ã’ + .db 0Fh ; + .db 3Eh ; > + .db 0 ; + .db 32h ; 2 + .db 0D7h ; × + .db 26h ; & + .db 21h ; ! + .db 0FAh ; ú + .db 26h ; & + .db 11h ; + .db 4Eh ; N + .db 8 ; + .db 1 ; + .db 0FEh ; þ + .db 26h ; & + .db 0CDh ; à + .db 0E5h ; Ã¥ + .db 6 ; + .db 21h ; ! + .db 0FEh ; þ + .db 26h ; & + .db 0CDh ; à + .db 1Dh ; + .db 10h ; + .db 0D8h ; Ø + .db 21h ; ! + .db 0FEh ; þ + .db 26h ; & + .db 11h ; + .db 0DCh ; Ü + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 0EDh ; í + .db 4Bh ; K + .db 0F3h ; ó + .db 26h ; & + .db 0CDh ; à + .db 0A2h ; ¢ + .db 10h ; + .db 0D8h ; Ø + .db 0AFh ; ¯ + .db 0C9h ; É + .db 21h ; ! + .db 0C3h ; à + .db 26h ; & + .db 11h ; + .db 4Ah ; J + .db 8 ; + .db 1 ; + .db 0C7h ; Ç + .db 26h ; & + .db 0CDh ; à + .db 0A4h ; ¤ + .db 6 ; + .db 21h ; ! + .db 0C7h ; Ç + .db 26h ; & + .db 11h ; + .db 0FAh ; ú + .db 26h ; & + .db 0CDh ; à + .db 4Bh ; K + .db 6 ; + .db 0D2h ; Ã’ + .db 15h ; + .db 10h ; + .db 3Eh ; > + .db 0 ; + .db 32h ; 2 + .db 0D7h ; × + .db 26h ; & + .db 21h ; ! + .db 0FAh ; ú + .db 26h ; & + .db 11h ; + .db 4Eh ; N + .db 8 ; + .db 1 ; + .db 0FEh ; þ + .db 26h ; & + .db 0CDh ; à + .db 0E5h ; Ã¥ + .db 6 ; + .db 21h ; ! + .db 0FEh ; þ + .db 26h ; & + .db 0CDh ; à + .db 17h ; + .db 10h ; + .db 0D8h ; Ø + .db 21h ; ! + .db 0FEh ; þ + .db 26h ; & + .db 11h ; + .db 0DCh ; Ü + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 0EDh ; í + .db 4Bh ; K + .db 0F3h ; ó + .db 26h ; & + .db 0CDh ; à + .db 0A2h ; ¢ + .db 10h ; + .db 0D8h ; Ø + .db 0AFh ; ¯ + .db 0C9h ; É + .db 0AFh ; ¯ + .db 0C9h ; É + .db 0EBh ; ë + .db 21h ; ! + .db 0C3h ; à + .db 26h ; & + .db 18h ; + .db 10h ; + .db 0CDh ; à + .db 9 ; + .db 1Ch ; + .db 11h ; + .db 6Eh ; n + .db 22h ; " + .db 0CDh ; à + .db 0DBh ; Û + .db 1Bh ; + .db 0EBh ; ë + .db 21h ; ! + .db 0C3h ; à + .db 26h ; & + .db 0CDh ; à + .db 32h ; 2 + .db 6 ; + .db 0CDh ; à + .db 7Dh ; } + .db 6 ; + .db 0C8h ; È + .db 0CDh ; à + .db 0F9h ; ù + .db 1Bh ; + .db 20h ; + .db 5 ; + .db 0CDh ; à + .db 0BCh ; ¼ + .db 6 ; + .db 18h ; + .db 0F2h ; ò + .db 0EEh ; î + .db 4 ; + .db 0C8h ; È + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 21h ; ! + .db 2 ; + .db 27h ; ' + .db 0CDh ; à + .db 32h ; 2 + .db 6 ; + .db 21h ; ! + .db 0BBh ; » + .db 26h ; & + .db 11h ; + .db 0DAh ; Ú + .db 26h ; & + .db 1 ; + .db 0DCh ; Ü + .db 26h ; & + .db 0CDh ; à + .db 0E5h ; Ã¥ + .db 6 ; + .db 21h ; ! + .db 0BBh ; » + .db 26h ; & + .db 11h ; + .db 0C3h ; à + .db 26h ; & + .db 0CDh ; à + .db 4Bh ; K + .db 6 ; + .db 0DAh ; Ú + .db 70h ; p + .db 10h ; + .db 0EDh ; í + .db 4Bh ; K + .db 0CFh ; à + .db 26h ; & + .db 0CDh ; à + .db 0A2h ; ¢ + .db 10h ; + .db 0D8h ; Ø + .db 3Ah ; : + .db 0D7h ; × + .db 26h ; & + .db 32h ; 2 + .db 0D6h ; Ö + .db 26h ; & + .db 0EBh ; ë + .db 0C9h ; É + .db 21h ; ! + .db 0BBh ; » + .db 26h ; & + .db 11h ; + .db 0CFh ; à + .db 26h ; & + .db 1 ; + .db 0C7h ; Ç + .db 26h ; & + .db 0CDh ; à + .db 8Eh ; ÂŽ + .db 6 ; + .db 21h ; ! + .db 0C3h ; à + .db 26h ; & + .db 11h ; + .db 0C7h ; Ç + .db 26h ; & + .db 0CDh ; à + .db 4Bh ; K + .db 6 ; + .db 0DAh ; Ú + .db 8Ch ; ÂŒ + .db 10h ; + .db 2Ah ; * + .db 0CFh ; à + .db 26h ; & + .db 0C9h ; É + .db 3Ah ; : + .db 0D7h ; × + .db 26h ; & + .db 32h ; 2 + .db 0D6h ; Ö + .db 26h ; & + .db 21h ; ! + .db 0C3h ; à + .db 26h ; & + .db 11h ; + .db 0BBh ; » + .db 26h ; & + .db 1 ; + .db 0C7h ; Ç + .db 26h ; & + .db 0CDh ; à + .db 0A4h ; ¤ + .db 6 ; + .db 2Ah ; * + .db 0C7h ; Ç + .db 26h ; & + .db 0C9h ; É + .db 11h ; + .db 0 ; + .db 0 ; + .db 0CDh ; à + .db 0C5h ; Ã… + .db 10h ; + .db 0CDh ; à + .db 0F9h ; ù + .db 1Bh ; + .db 20h ; + .db 0Eh ; + .db 77h ; w + .db 21h ; ! + .db 0C3h ; à + .db 26h ; & + .db 0CDh ; à + .db 0BCh ; ¼ + .db 6 ; + .db 13h ; + .db 0Bh ; + .db 78h ; x + .db 0B1h ; ± + .db 20h ; + .db 0EBh ; ë + .db 0C9h ; É + .db 0FEh ; þ + .db 4 ; + .db 3Eh ; > + .db 0FFh ; ÿ + .db 32h ; 2 + .db 0D7h ; × + .db 26h ; & + .db 0C8h ; È + .db 37h ; 7 + .db 0C9h ; É + .db 0C5h ; Ã… + .db 0D5h ; Õ + .db 2Ah ; * + .db 0DCh ; Ü + .db 26h ; & + .db 19h ; + .db 0EDh ; í + .db 4Bh ; K + .db 0DAh ; Ú + .db 26h ; & + .db 7Ch ; | + .db 0A0h ;   + .db 67h ; g + .db 7Dh ; } + .db 0A1h ; ¡ + .db 6Fh ; o + .db 0EDh ; í + .db 5Bh ; [ + .db 0EFh ; ï + .db 26h ; & + .db 19h ; + .db 0D1h ; Ñ + .db 0C1h ; à + .db 0C9h ; É + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_10DD: ; CODE XREF: sub_0_8C1+5Cp + ; sub_0_10DD+14j + ld hl, 26AAh + call sub_0_632 + ld a, 8 + call sub_0_1204 + call sub_0_12EB + ret c + cp 10h + ret z + cp 8 + jr nz, sub_0_10DD + ld a, 4Fh + call loc_0_12A6 + ld a, 4Fh + jp loc_0_12A6 +; End of function sub_0_10DD + +;---------------------------------------------------------------------------- + .db 32h ; 2 + .db 6 ; + .db 27h ; ' + .db 0C5h ; Ã… + .db 21h ; ! + .db 0B7h ; · + .db 26h ; & + .db 11h ; + .db 0A4h ; ¤ + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 0CDh ; à + .db 8 ; + .db 5 ; + .db 0C1h ; à + .db 0CDh ; à + .db 0DCh ; Ü + .db 12h ; + .db 11h ; + .db 0 ; + .db 0 ; + .db 3Ah ; : + .db 0A9h ; © + .db 26h ; & + .db 0E6h ; æ + .db 20h ; + .db 20h ; + .db 3Bh ; ; + .db 78h ; x + .db 0B1h ; ± + .db 28h ; ( + .db 12h ; + .db 0C5h ; Ã… + .db 0D5h ; Õ + .db 0CDh ; à + .db 0C5h ; Ã… + .db 10h ; + .db 7Eh ; ~ + .db 0CDh ; à + .db 2Fh ; / + .db 8 ; + .db 0CDh ; à + .db 82h ; ‚ + .db 12h ; + .db 0D1h ; Ñ + .db 0C1h ; à + .db 13h ; + .db 0Bh ; + .db 18h ; + .db 0EAh ; ê + .db 3Eh ; > + .db 18h ; + .db 0CDh ; à + .db 0A6h ; ¦ + .db 12h ; + .db 3Ah ; : + .db 6 ; + .db 27h ; ' + .db 0CDh ; à + .db 2Fh ; / + .db 8 ; + .db 0CDh ; à + .db 0A6h ; ¦ + .db 12h ; + .db 3Ah ; : + .db 32h ; 2 + .db 8 ; + .db 0CDh ; à + .db 82h ; ‚ + .db 12h ; + .db 3Ah ; : + .db 31h ; 1 + .db 8 ; + .db 0CDh ; à + .db 82h ; ‚ + .db 12h ; + .db 3Ah ; : + .db 6 ; + .db 27h ; ' + .db 0FEh ; þ + .db 6Bh ; k + .db 0C8h ; È + .db 3Eh ; > + .db 11h ; + .db 0C3h ; à + .db 0A6h ; ¦ + .db 12h ; + .db 78h ; x + .db 0B1h ; ± + .db 28h ; ( + .db 12h ; + .db 0C5h ; Ã… + .db 0D5h ; Õ + .db 0CDh ; à + .db 0C5h ; Ã… + .db 10h ; + .db 7Eh ; ~ + .db 0CDh ; à + .db 97h ; — + .db 7 ; + .db 0CDh ; à + .db 82h ; ‚ + .db 12h ; + .db 0D1h ; Ñ + .db 0C1h ; à + .db 13h ; + .db 0Bh ; + .db 18h ; + .db 0EAh ; ê + .db 3Eh ; > + .db 18h ; + .db 0CDh ; à + .db 0A6h ; ¦ + .db 12h ; + .db 3Ah ; : + .db 6 ; + .db 27h ; ' + .db 0CDh ; à + .db 97h ; — + .db 7 ; + .db 0CDh ; à + .db 0A6h ; ¦ + .db 12h ; + .db 6 ; + .db 4 ; + .db 21h ; ! + .db 9Bh ; › + .db 22h ; " + .db 7Eh ; ~ + .db 23h ; # + .db 0C5h ; Ã… + .db 0E5h ; Ã¥ + .db 2Fh ; / + .db 0CDh ; à + .db 82h ; ‚ + .db 12h ; + .db 0E1h ; á + .db 0C1h ; à + .db 10h ; + .db 0F4h ; ô + .db 0C9h ; É + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_118C: ; CODE XREF: seg000:0CCEp + ld (2707h), a + ld a, 2Ah + call loc_0_12A6 + ld a, 18h + call loc_0_12A6 + call sub_0_12DC + ld a, (26A9h) + and 20h + jp nz, loc_0_11D1 + ld a, 41h + call loc_0_12A6 + ld a, (2707h) + call sub_0_82F + call loc_0_1282 + ld hl, 26AAh + ld b, 4 + +loc_0_11B7: ; CODE XREF: sub_0_118C+37j + push bc + ld a, (hl) + inc hl + push hl + call sub_0_82F + call loc_0_1282 + pop hl + pop bc + djnz loc_0_11B7 + ld a, (loc_0_830+2) + call loc_0_1282 + ld a, (loc_0_830+1) + jp loc_0_1282 +;---------------------------------------------------------------------------- + +loc_0_11D1: ; CODE XREF: sub_0_118C+15j + ld a, 43h + call loc_0_12A6 + ld a, (2707h) + call loc_0_797 + call loc_0_12A6 + ld hl, 26AAh + ld b, 4 + +loc_0_11E4: ; CODE XREF: sub_0_118C+64j + push bc + ld a, (hl) + inc hl + push hl + call loc_0_797 + call loc_0_1282 + pop hl + pop bc + djnz loc_0_11E4 + ld hl, 229Bh + ld b, 4 + +loc_0_11F7: ; CODE XREF: sub_0_118C+75j + push bc + ld a, (hl) + inc hl + push hl + cpl + call loc_0_1282 + pop hl + pop bc + djnz loc_0_11F7 + ret +; End of function sub_0_118C + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1204: ; CODE XREF: sub_0_9D9+7p sub_0_10DD+8p + ld (2707h), a + ld hl, 124Dh + call sub_0_15AB + call sub_0_12DC + ld a, (2707h) + call sub_0_82F + call sub_0_1262 + ld hl, 26AAh + ld b, 4 + +loc_0_121E: ; CODE XREF: sub_0_1204+26j + push bc + ld a, (hl) + inc hl + push hl + call sub_0_82F + call sub_0_1262 + pop hl + pop bc + djnz loc_0_121E + ld a, (loc_0_830+2) + call sub_0_1262 + ld a, (loc_0_830+1) + call sub_0_1262 + ld a, 0Dh + call loc_0_12A6 + ld a, 0Ah + call loc_0_12A6 + ld a, (2707h) + cp 8 + ret z + ld a, 11h + jp loc_0_12A6 +; End of function sub_0_1204 + +;---------------------------------------------------------------------------- + .db 2Ah ; * + .db 2Ah ; * + .db 18h ; + .db 42h ; B + .db 0 ; + .db 30h ; 0 + .db 31h ; 1 + .db 32h ; 2 + .db 33h ; 3 + .db 34h ; 4 + .db 35h ; 5 + .db 36h ; 6 + .db 37h ; 7 + .db 38h ; 8 + .db 39h ; 9 + .db 61h ; a + .db 62h ; b + .db 63h ; c + .db 64h ; d + .db 65h ; e + .db 66h ; f + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1262: ; CODE XREF: sub_0_1204+12p + ; sub_0_1204+21p ... + push af + ld hl, 1252h + ld b, 0 + rra + rra + rra + rra + and 0Fh + ld c, a + add hl, bc + ld a, (hl) + call loc_0_12A6 + pop af + ld hl, 1252h + ld b, 0 + and 0Fh + ld c, a + add hl, bc + ld a, (hl) + jp loc_0_12A6 +; End of function sub_0_1262 + +;---------------------------------------------------------------------------- + +loc_0_1282: ; CODE XREF: sub_0_118C+23p + ; sub_0_118C+32p ... + ld (byte_0_12A5), a + ld bc, 9 + ld hl, 12C1h + cpir + jp z, sub_0_629 + and 60h + jr nz, unk_0_12A4 + ld a, (26D5h) + or a + jr z, unk_0_12A4 + ld hl, 12A5h + set 6, (hl) + ld a, 18h + call loc_0_12A6 +;---------------------------------------------------------------------------- +unk_0_12A4: .db 3Eh ; > ; CODE XREF: seg000:1292j seg000:1298j +byte_0_12A5: .db 0 ; DATA XREF: seg000:1282w +;---------------------------------------------------------------------------- + +loc_0_12A6: ; CODE XREF: seg000:0B0Cp seg000:0B12p + ; ... + ld (byte_0_12B2), a + +loc_0_12A9: ; CODE XREF: seg000:12AFj + call sub_0_561 + call sub_0_5A6 + jr z, loc_0_12A9 +;---------------------------------------------------------------------------- + .db 3Eh ; > +byte_0_12B2: .db 0 ; DATA XREF: seg000:12A6w + .db 0C3h ; à + .db 0A0h ;   + .db 5 ; + .db 3Ah ; : + .db 0B2h ; ² + .db 12h ; + .db 0E6h ; æ + .db 7Fh ;  + .db 0FEh ; þ + .db 40h ; @ + .db 20h ; + .db 0E5h ; Ã¥ + .db 18h ; + .db 0D9h ; Ù + .db 18h ; + .db 0Dh ; + .db 8Dh ;  + .db 10h ; + .db 90h ;  + .db 11h ; + .db 91h ; ‘ + .db 13h ; + .db 93h ; “ + .db 9Ah ; š + .db 12h ; + .db 9Ah ; š + .db 12h ; + .db 9Ah ; š + .db 12h ; + .db 9Ah ; š + .db 12h ; + .db 9Ah ; š + .db 12h ; + .db 9Ah ; š + .db 12h ; + .db 0B6h ; ¶ + .db 12h ; + .db 0B6h ; ¶ + .db 12h ; + .db 9Ah ; š + .db 12h ; + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_12DC: ; CODE XREF: seg000:0B1Cp sub_0_118C+Dp + ; ... + xor a + ld h, a + ld l, a + ld (loc_0_788+1), a + ld (loc_0_830+1), hl + ld hl, 229Bh + jp loc_0_6D0 +; End of function sub_0_12DC + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_12EB: ; CODE XREF: sub_0_10DD+Bp + xor a + ld (270Bh), a + ld hl, 400h + ld (2708h), hl + +loc_0_12F5: ; CODE XREF: sub_0_12EB+61j + ld a, 5 + ld (270Ah), a + ld b, 0FFh + call sub_0_15B6 + jp c, loc_0_13A4 + ld hl, 13B8h + ld bc, 3 + cpir + jp z, sub_0_629 + jr loc_0_133E +;---------------------------------------------------------------------------- + .db 21h ; ! + .db 0Ah ; + .db 27h ; ' + .db 35h ; 5 + .db 3Eh ; > + .db 10h ; + .db 0CAh ; Ê + .db 0A4h ; ¤ + .db 13h ; + .db 6 ; + .db 0Ah ; + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 38h ; 8 + .db 0DBh ; Û + .db 21h ; ! + .db 0C1h ; à + .db 13h ; + .db 1 ; + .db 2 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 18h ; + .db 12h ; + .db 21h ; ! + .db 0Ah ; + .db 27h ; ' + .db 35h ; 5 + .db 3Eh ; > + .db 10h ; + .db 0CAh ; Ê + .db 0A4h ; ¤ + .db 13h ; + .db 18h ; + .db 0C3h ; à + .db 6 ; + .db 0Ah ; + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 38h ; 8 + .db 11h ; +;---------------------------------------------------------------------------- + +loc_0_133E: ; CODE XREF: sub_0_12EB+22j + ld hl, (2708h) + dec hl + ld (2708h), hl + ld a, h + or l + ld a, 0FCh + jp z, loc_0_13A4 + jp loc_0_12F5 +;---------------------------------------------------------------------------- + .db 3Eh ; > + .db 0FFh ; ÿ + .db 0C3h ; à + .db 0A4h ; ¤ + .db 13h ; + .db 3Eh ; > + .db 5 ; + .db 32h ; 2 + .db 0Ah ; + .db 27h ; ' + .db 0CDh ; à + .db 0D1h ; Ñ + .db 14h ; + .db 38h ; 8 + .db 46h ; F + .db 21h ; ! + .db 0C7h ; Ç + .db 13h ; + .db 1 ; + .db 2 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 18h ; + .db 0D3h ; Ó + .db 0CDh ; à + .db 0D1h ; Ñ + .db 14h ; + .db 38h ; 8 + .db 34h ; 4 + .db 21h ; ! + .db 0CDh ; à + .db 13h ; + .db 1 ; + .db 4 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 18h ; + .db 0C1h ; à + .db 3Eh ; > + .db 10h ; + .db 32h ; 2 + .db 0A8h ; ¨ + .db 26h ; & + .db 0CDh ; à + .db 54h ; T + .db 14h ; + .db 18h ; + .db 12h ; + .db 3Eh ; > + .db 10h ; + .db 32h ; 2 + .db 0A8h ; ¨ + .db 26h ; & + .db 0CDh ; à + .db 1Ah ; + .db 14h ; + .db 18h ; + .db 8 ; + .db 3Eh ; > + .db 20h ; + .db 32h ; 2 + .db 0A8h ; ¨ + .db 26h ; & + .db 0CDh ; à + .db 0DFh ; ß + .db 13h ; + .db 0F5h ; õ + .db 21h ; ! + .db 0A0h ;   + .db 26h ; & + .db 11h ; + .db 0B3h ; ³ + .db 26h ; & + .db 0CDh ; à + .db 3Ch ; < + .db 6 ; + .db 0F1h ; ñ +;---------------------------------------------------------------------------- + +loc_0_13A4: ; CODE XREF: sub_0_12EB+14j + ; sub_0_12EB+5Ej + ld hl, 13D9h + ld bc, 6 + cpir + jr nz, loc_0_13B6 + cp 98h + jr nz, loc_0_13B4 + ld a, 10h + +loc_0_13B4: ; CODE XREF: sub_0_12EB+C5j + scf + ret +;---------------------------------------------------------------------------- + +loc_0_13B6: ; CODE XREF: sub_0_12EB+C1j + or a + ret +; End of function sub_0_12EB + +;---------------------------------------------------------------------------- + .db 18h ; + .db 0AAh ; ª + .db 2Ah ; * + .db 54h ; T + .db 13h ; + .db 54h ; T + .db 13h ; + .db 0Fh ; + .db 13h ; + .db 6Bh ; k + .db 18h ; + .db 2Ch ; , + .db 13h ; + .db 37h ; 7 + .db 13h ; + .db 2Ah ; * + .db 18h ; + .db 6Bh ; k + .db 13h ; + .db 59h ; Y + .db 13h ; + .db 43h ; C + .db 41h ; A + .db 42h ; B + .db 18h ; + .db 0Fh ; + .db 13h ; + .db 7Dh ; } + .db 13h ; + .db 87h ; ‡ + .db 13h ; + .db 91h ; ‘ + .db 13h ; + .db 98h ; ˜ + .db 6 ; + .db 10h ; + .db 0FFh ; ÿ + .db 0FEh ; þ + .db 0FCh ; ü + .db 0CDh ; à + .db 0DCh ; Ü + .db 12h ; + .db 0CDh ; à + .db 0FBh ; û + .db 14h ; + .db 0D8h ; Ø + .db 32h ; 2 + .db 0Bh ; + .db 27h ; ' + .db 0CDh ; à + .db 97h ; — + .db 7 ; + .db 21h ; ! + .db 0A0h ;   + .db 26h ; & + .db 6 ; + .db 4 ; + .db 0C5h ; Ã… + .db 0E5h ; Ã¥ + .db 0CDh ; à + .db 0FBh ; û + .db 14h ; + .db 0CDh ; à + .db 97h ; — + .db 7 ; + .db 0E1h ; á + .db 0C1h ; à + .db 77h ; w + .db 23h ; # + .db 0D8h ; Ø + .db 10h ; + .db 0F1h ; ñ + .db 6 ; + .db 4 ; + .db 0C5h ; Ã… + .db 0CDh ; à + .db 0FBh ; û + .db 14h ; + .db 0CDh ; à + .db 97h ; — + .db 7 ; + .db 0C1h ; à + .db 0D8h ; Ø + .db 10h ; + .db 0F5h ; õ + .db 21h ; ! + .db 9Bh ; › + .db 22h ; " + .db 11h ; + .db 93h ; “ + .db 7 ; + .db 0CDh ; à + .db 7Dh ; } + .db 6 ; + .db 28h ; ( + .db 34h ; 4 + .db 18h ; + .db 36h ; 6 + .db 0CDh ; à + .db 0DCh ; Ü + .db 12h ; + .db 0CDh ; à + .db 0FBh ; û + .db 14h ; + .db 0D8h ; Ø + .db 32h ; 2 + .db 0Bh ; + .db 27h ; ' + .db 0CDh ; à + .db 2Fh ; / + .db 8 ; + .db 21h ; ! + .db 0A0h ;   + .db 26h ; & + .db 6 ; + .db 4 ; + .db 0C5h ; Ã… + .db 0E5h ; Ã¥ + .db 0CDh ; à + .db 0FBh ; û + .db 14h ; + .db 0CDh ; à + .db 2Fh ; / + .db 8 ; + .db 0E1h ; á + .db 0C1h ; à + .db 77h ; w + .db 23h ; # + .db 0D8h ; Ø + .db 10h ; + .db 0F1h ; ñ + .db 6 ; + .db 2 ; + .db 0C5h ; Ã… + .db 0CDh ; à + .db 0FBh ; û + .db 14h ; + .db 0CDh ; à + .db 2Fh ; / + .db 8 ; + .db 0C1h ; à + .db 0D8h ; Ø + .db 10h ; + .db 0F5h ; õ + .db 7Ch ; | + .db 0B5h ; µ + .db 20h ; + .db 4 ; + .db 3Ah ; : + .db 0Bh ; + .db 27h ; ' + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 0CDh ; à + .db 0DCh ; Ü + .db 12h ; + .db 0CDh ; à + .db 0A4h ; ¤ + .db 14h ; + .db 0D8h ; Ø + .db 32h ; 2 + .db 0Bh ; + .db 27h ; ' + .db 0CDh ; à + .db 2Fh ; / + .db 8 ; + .db 21h ; ! + .db 0A0h ;   + .db 26h ; & + .db 6 ; + .db 4 ; + .db 0C5h ; Ã… + .db 0E5h ; Ã¥ + .db 0CDh ; à + .db 0A4h ; ¤ + .db 14h ; + .db 30h ; 0 + .db 3 ; + .db 0E1h ; á + .db 0C1h ; à + .db 0C9h ; É + .db 0CDh ; à + .db 2Fh ; / + .db 8 ; + .db 0E1h ; á + .db 0C1h ; à + .db 77h ; w + .db 23h ; # + .db 10h ; + .db 0EDh ; í + .db 6 ; + .db 2 ; + .db 0C5h ; Ã… + .db 0CDh ; à + .db 0A4h ; ¤ + .db 14h ; + .db 30h ; 0 + .db 2 ; + .db 0C1h ; à + .db 0C9h ; É + .db 0CDh ; à + .db 2Fh ; / + .db 8 ; + .db 0C1h ; à + .db 10h ; + .db 0F2h ; ò + .db 7Ch ; | + .db 0B5h ; µ + .db 20h ; + .db 13h ; + .db 6 ; + .db 0Ah ; + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 0FEh ; þ + .db 0Dh ; + .db 20h ; + .db 5 ; + .db 6 ; + .db 0Ah ; + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 0B7h ; · + .db 3Ah ; : + .db 0Bh ; + .db 27h ; ' + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 0CDh ; à + .db 0D1h ; Ñ + .db 14h ; + .db 0D8h ; Ø + .db 0CDh ; à + .db 0C3h ; à + .db 14h ; + .db 20h ; + .db 12h ; + .db 7 ; + .db 7 ; + .db 7 ; + .db 7 ; + .db 47h ; G + .db 0C5h ; Ã… + .db 0CDh ; à + .db 0D1h ; Ñ + .db 14h ; + .db 0C1h ; à + .db 0D8h ; Ø + .db 0CDh ; à + .db 0C3h ; à + .db 14h ; + .db 20h ; + .db 2 ; + .db 0B0h ; ° + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 37h ; 7 + .db 0C9h ; É + .db 6Fh ; o + .db 0D6h ; Ö + .db 30h ; 0 + .db 0FEh ; þ + .db 0Ah ; + .db 38h ; 8 + .db 2 ; + .db 0D6h ; Ö + .db 27h ; ' + .db 6Fh ; o + .db 0E6h ; æ + .db 0F0h ; ð + .db 7Dh ; } + .db 0C9h ; É + .db 6 ; + .db 64h ; d + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 0D8h ; Ø + .db 0E6h ; æ + .db 7Fh ;  + .db 21h ; ! + .db 0F6h ; ö + .db 14h ; + .db 1 ; + .db 2 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 28h ; ( + .db 0EEh ; î + .db 1 ; + .db 3 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0C8h ; È + .db 47h ; G + .db 0E6h ; æ + .db 60h ; ` + .db 20h ; + .db 6 ; + .db 3Ah ; : + .db 0D5h ; Õ + .db 26h ; & + .db 0B7h ; · + .db 20h ; + .db 0DDh ; à + .db 78h ; x + .db 0C9h ; É + .db 11h ; + .db 13h ; + .db 0Dh ; + .db 0Ah ; + .db 18h ; + .db 6 ; + .db 64h ; d + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 0D8h ; Ø + .db 5Fh ; _ + .db 0E6h ; æ + .db 60h ; ` + .db 7Bh ; { + .db 0C0h ; À + .db 0FEh ; þ + .db 18h ; + .db 28h ; ( + .db 12h ; + .db 21h ; ! + .db 6Eh ; n + .db 15h ; + .db 1 ; + .db 4 ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 28h ; ( + .db 0E7h ; ç + .db 3Ah ; : + .db 0D5h ; Õ + .db 26h ; & + .db 0B7h ; · + .db 20h ; + .db 0E1h ; á + .db 7Bh ; { + .db 0C9h ; É + .db 6 ; + .db 64h ; d + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 0D8h ; Ø + .db 0FEh ; þ + .db 18h ; + .db 20h ; + .db 1Ah ; + .db 6 ; + .db 64h ; d + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 0D8h ; Ø + .db 0FEh ; þ + .db 18h ; + .db 20h ; + .db 10h ; + .db 6 ; + .db 64h ; d + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 0D8h ; Ø + .db 0FEh ; þ + .db 18h ; + .db 20h ; + .db 6 ; + .db 6 ; + .db 64h ; d + .db 0CDh ; à + .db 0B6h ; ¶ + .db 15h ; + .db 0D8h ; Ø + .db 21h ; ! + .db 72h ; r + .db 15h ; + .db 1 ; + .db 0Bh ; + .db 0 ; + .db 0EDh ; í + .db 0B1h ; ± + .db 0CAh ; Ê + .db 29h ; ) + .db 6 ; + .db 6Fh ; o + .db 3Ah ; : + .db 0D5h ; Õ + .db 26h ; & + .db 0B7h ; · + .db 28h ; ( + .db 5 ; + .db 7Dh ; } + .db 0E6h ; æ + .db 60h ; ` + .db 28h ; ( + .db 0C5h ; Ã… + .db 7Dh ; } + .db 0E6h ; æ + .db 60h ; ` + .db 0FEh ; þ + .db 40h ; @ + .db 20h ; + .db 0Ah ; + .db 7Dh ; } + .db 0EEh ; î + .db 40h ; @ + .db 0C9h ; É + .db 3Eh ; > + .db 7Fh ;  + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 0C9h ; É + .db 3Eh ; > + .db 0FFh ; ÿ + .db 0F6h ; ö + .db 80h ; € + .db 37h ; 7 + .db 0C9h ; É + .db 11h ; + .db 91h ; ‘ + .db 13h ; + .db 93h ; “ + .db 11h ; + .db 91h ; ‘ + .db 13h ; + .db 93h ; “ + .db 18h ; + .db 68h ; h + .db 69h ; i + .db 6Ah ; j + .db 6Bh ; k + .db 6Ch ; l + .db 6Dh ; m + .db 65h ; e + .db 15h ; + .db 62h ; b + .db 15h ; + .db 6Ah ; j + .db 15h ; + .db 6Ah ; j + .db 15h ; + .db 6Ah ; j + .db 15h ; + .db 6Ah ; j + .db 15h ; + .db 6Ah ; j + .db 15h ; + .db 1Ch ; + .db 15h ; + .db 1Ch ; + .db 15h ; + .db 1Ch ; + .db 15h ; + .db 1Ch ; + .db 15h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 18h ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 8 ; + .db 0 ; + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_15A8: ; CODE XREF: sub_0_8C1+36p + ld hl, 1593h +; End of function sub_0_15A8 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_15AB: ; CODE XREF: sub_0_1204+6p + ; sub_0_15AB+9j + ld a, (hl) + inc hl + or a + ret z + push hl + call loc_0_12A6 + pop hl + jr sub_0_15AB +; End of function sub_0_15AB + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_15B6: ; CODE XREF: sub_0_9D9+13p + ; sub_0_A4C+17p ... + push bc + call sub_0_1E0C + call nz, sub_0_1E07 + cp 1Bh + ld a, 18h + ld c, 0Ah + call z, sub_0_558 + pop bc + +loc_0_15C7: ; CODE XREF: sub_0_15B6+16j + call sub_0_5AD + jr nz, loc_0_15D2 + djnz loc_0_15C7 + ld a, 0FEh + scf + ret +;---------------------------------------------------------------------------- + +loc_0_15D2: ; CODE XREF: sub_0_15B6+14j + or a + ret +; End of function sub_0_15B6 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_15D4: ; CODE XREF: start+5Fp + push bc + ld (270Ch), a + call sub_0_1E80 + push de + call sub_0_176E + ld (de), a + pop de + push de + call sub_0_15E9 + pop de + pop bc + jr loc_0_165F +; End of function sub_0_15D4 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_15E9: ; CODE XREF: sub_0_15D4+Ep + xor a + ld (de), a + ld (270Fh), a + ld (270Eh), a + call sub_0_1D8C + ld a, c + ld (2710h), a + push de + ld a, (hl) + cp 3Ah + jr nz, loc_0_15FF + inc hl + +loc_0_15FF: ; CODE XREF: sub_0_15E9+13j + ld b, 8 + call sub_0_1664 + pop de + ld a, (hl) + ld (270Dh), a + cp 3Ah + jr nz, loc_0_1640 + inc hl + ld a, (270Ch) + or a + jr z, loc_0_1619 + call sub_0_168C + jr z, loc_0_1627 + +loc_0_1619: ; CODE XREF: sub_0_15E9+29j + call sub_0_16DF + jr z, loc_0_1627 + ld a, (270Ch) + or a + jr nz, loc_0_1627 + call sub_0_168C + +loc_0_1627: ; CODE XREF: sub_0_15E9+2Ej + ; sub_0_15E9+33j ... + ld a, (270Fh) + ld (de), a + push de + inc de + call sub_0_1774 + pop de + xor a + ld (270Eh), a + push de + ld b, 8 + call sub_0_1664 + pop de + ld a, (hl) + ld (270Dh), a + +loc_0_1640: ; CODE XREF: sub_0_15E9+22j + ld a, (270Dh) + ex de, hl + ld bc, 8 + add hl, bc + ex de, hl + ld b, 3 + cp 2Eh + jr nz, loc_0_1655 + inc hl + push de + call sub_0_1664 + pop de + +loc_0_1655: ; CODE XREF: sub_0_15E9+64j + ex de, hl + ld bc, 5 + add hl, bc + ex de, hl + ld a, (2710h) + ld (de), a + +loc_0_165F: ; CODE XREF: sub_0_15D4+13j + ld a, (270Eh) + or a + ret +; End of function sub_0_15E9 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1664: ; CODE XREF: sub_0_15E9+18p + ; sub_0_15E9+4Fp ... + call sub_0_171B + ret z + inc de + cp 2Ah + jr nz, loc_0_1675 + ld a, 3Fh + ld (de), a + call sub_0_1685 + jr loc_0_167C +;---------------------------------------------------------------------------- + +loc_0_1675: ; CODE XREF: sub_0_1664+7j + ld (de), a + inc hl + cp 3Fh + call z, sub_0_1685 + +loc_0_167C: ; CODE XREF: sub_0_1664+Fj + djnz sub_0_1664 + +loc_0_167E: ; CODE XREF: sub_0_1664+1Fj + call sub_0_171B + ret z + inc hl + jr loc_0_167E +; End of function sub_0_1664 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1685: ; CODE XREF: sub_0_1664+Cp + ; sub_0_1664+15p + push hl + ld hl, 270Eh + inc (hl) + pop hl + ret +; End of function sub_0_1685 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_168C: ; CODE XREF: sub_0_15E9+2Bp + ; sub_0_15E9+3Bp + push hl + push de + call sub_0_1694 + pop de + pop hl + ret +; End of function sub_0_168C + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1694: ; CODE XREF: sub_0_168C+2p + call sub_0_178C + jr z, loc_0_170C + ex de, hl + inc hl + call sub_0_1794 + ld b, a + inc b + ld a, (hl) + cp 41h + jr c, loc_0_16B6 + sub 40h + cp b + jr nc, loc_0_170C + ld (270Fh), a + inc hl + ld a, (hl) + cp 20h + ret z + call sub_0_1767 + ret c + +loc_0_16B6: ; CODE XREF: sub_0_1694+Fj + push hl + ld b, 2 + +loc_0_16B9: ; CODE XREF: sub_0_1694+30j + ld a, (hl) + cp 20h + jr z, loc_0_16CB + call sub_0_1767 + jr c, loc_0_16DC + inc hl + djnz loc_0_16B9 + ld a, (hl) + cp 20h + jr nz, loc_0_16DC + +loc_0_16CB: ; CODE XREF: sub_0_1694+28j + pop hl + call sub_0_179C + ld c, a + inc c + call sub_0_173C + cp c + jr nc, loc_0_170C + ld (2710h), a + xor a + ret +;---------------------------------------------------------------------------- + +loc_0_16DC: ; CODE XREF: sub_0_1694+2Dj + ; sub_0_1694+35j + pop hl + jr loc_0_170C +; End of function sub_0_1694 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_16DF: ; CODE XREF: sub_0_15E9+30p + push hl + push de + call sub_0_16E7 + pop de + pop hl + ret +; End of function sub_0_16DF + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_16E7: ; CODE XREF: sub_0_16DF+2p + call sub_0_17A4 + jr z, loc_0_170C + ex de, hl + inc hl + +loc_0_16EE: ; CODE XREF: sub_0_16E7+23j + ld a, (de) + or a + jr z, loc_0_170C + inc de + inc de + push hl + push de + ld b, 8 + +loc_0_16F8: ; CODE XREF: sub_0_16E7+17j + ld a, (de) + cp (hl) + jr nz, loc_0_1700 + inc hl + inc de + djnz loc_0_16F8 + +loc_0_1700: ; CODE XREF: sub_0_16E7+13j + pop de + pop hl + jr z, loc_0_170F + ex de, hl + ld bc, 10h + add hl, bc + ex de, hl + jr loc_0_16EE +;---------------------------------------------------------------------------- + +loc_0_170C: ; CODE XREF: sub_0_1694+3j + ; sub_0_1694+14j ... + or 0FFh + ret +;---------------------------------------------------------------------------- + +loc_0_170F: ; CODE XREF: sub_0_16E7+1Bj + dec de + ld a, (de) + ld (2710h), a + dec de + ld a, (de) + ld (270Fh), a + xor a + ret +; End of function sub_0_16E7 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_171B: ; CODE XREF: sub_0_1664p sub_0_1664+1Ap + ; ... + ld a, (hl) + cp 21h + jr c, loc_0_173A + cp 3Dh + ret z + cp 5Fh + ret z + cp 2Eh + ret z + cp 3Ah + ret z + cp 2Ch + ret z + cp 3Ch + ret z + cp 3Eh + ret z + or a + ret z + cp 3Bh + ret +;---------------------------------------------------------------------------- + +loc_0_173A: ; CODE XREF: sub_0_171B+3j + xor a + ret +; End of function sub_0_171B + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_173C: ; CODE XREF: sub_0_1694+3Dp + push bc + ld bc, 1100h + +loc_0_1740: ; CODE XREF: sub_0_173C+22j + ld a, (hl) + call sub_0_171B + jr z, loc_0_1760 + inc hl + call sub_0_1767 + jr c, loc_0_1764 + ld d, a + ld a, c + rlca + jr c, loc_0_1764 + rlca + jr c, loc_0_1764 + add a, c + jr c, loc_0_1764 + rlca + jr c, loc_0_1764 + add a, d + jr c, loc_0_1764 + ld c, a + djnz loc_0_1740 + +loc_0_1760: ; CODE XREF: sub_0_173C+8j + ld a, c + pop bc + or a + ret +;---------------------------------------------------------------------------- + +loc_0_1764: ; CODE XREF: sub_0_173C+Ej + ; sub_0_173C+13j ... + pop bc + scf + ret +; End of function sub_0_173C + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1767: ; CODE XREF: sub_0_1694+1Ep + ; sub_0_1694+2Ap ... + sub 30h + ret c + cp 0Ah + ccf + ret +; End of function sub_0_1767 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_176E: ; CODE XREF: sub_0_15D4+8p + xor a + ld (de), a + inc de + call sub_0_1774 +; End of function sub_0_176E + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1774: ; CODE XREF: sub_0_15E9+44p + ld b, 0Bh + ld a, 20h + call sub_0_1787 + xor a + ld (de), a + inc de + call sub_0_1D8C + ld a, c + ld (de), a + inc de + ld b, 3 + xor a +; End of function sub_0_1774 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1787: ; CODE XREF: sub_0_1774+4p + ; sub_0_1787+2j + ld (de), a + inc de + djnz sub_0_1787 + ret +; End of function sub_0_1787 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_178C: ; CODE XREF: sub_0_1694p + push hl + push de + ld de, 2Eh + jp loc_0_17AB +; End of function sub_0_178C + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1794: ; CODE XREF: sub_0_1694+7p + push hl + push de + ld de, 2Ch + jp loc_0_17AB +; End of function sub_0_1794 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_179C: ; CODE XREF: sub_0_1694+38p + push hl + push de + ld de, 2Dh + jp loc_0_17AB +; End of function sub_0_179C + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_17A4: ; CODE XREF: sub_0_16E7p + push de + ld de, 15h + jp loc_0_17B8 +;---------------------------------------------------------------------------- + +loc_0_17AB: ; CODE XREF: sub_0_178C+5j + ; sub_0_1794+5j ... + ld hl, (2711h) + ld a, h + or l + jr z, loc_0_17B3 + add hl, de + +loc_0_17B3: ; CODE XREF: sub_0_17A4+Cj + ld a, (hl) + pop de + pop hl + or a + ret +;---------------------------------------------------------------------------- + +loc_0_17B8: ; CODE XREF: sub_0_17A4+4j + ld hl, (2711h) + add hl, de + ld e, (hl) + inc hl + ld d, (hl) + inc hl + ld a, (hl) + ex de, hl + pop de + or a + ret +; End of function sub_0_17A4 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_17C5: ; CODE XREF: start+11p + ld (2711h), hl + ret +; End of function sub_0_17C5 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_17C9: ; CODE XREF: start+8Cp + push de + ld (2752h), a + call sub_0_1979 + call sub_0_185C + jp loc_0_17E0 +;---------------------------------------------------------------------------- + .db 0D5h ; Õ + .db 32h ; 2 + .db 52h ; R + .db 27h ; ' + .db 0CDh ; à + .db 79h ; y + .db 19h ; + .db 0CDh ; à + .db 5Dh ; ] + .db 18h ; +;---------------------------------------------------------------------------- + +loc_0_17E0: ; CODE XREF: sub_0_17C9+Aj + pop de + ret z + push af + ld a, (2752h) + call sub_0_19CB + call sub_0_1938 + xor a + call sub_0_17F2 + pop af + ret +; End of function sub_0_17C9 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_17F2: ; CODE XREF: sub_0_17C9+24p + push bc + push de + push hl + ld (273Fh), hl + push hl + ld (2713h), a + ld de, 273Fh + ld (2741h), bc + ld hl, 181Ah + ld (2745h), hl + ld hl, (2747h) + call sub_0_1A30 + pop hl + ld (273Fh), hl + call sub_0_1A81 + pop hl + pop de + pop bc + ret +; End of function sub_0_17F2 + +;---------------------------------------------------------------------------- + .db 0C5h ; Ã… + .db 0E5h ; Ã¥ + .db 0D5h ; Õ + .db 3Ah ; : + .db 13h ; + .db 27h ; ' + .db 0B7h ; · + .db 28h ; ( + .db 30h ; 0 + .db 1 ; + .db 9 ; + .db 0 ; + .db 9 ; + .db 0EBh ; ë + .db 9 ; + .db 0EBh ; ë + .db 6 ; + .db 3 ; + .db 0CDh ; à + .db 6Ah ; j + .db 1Fh ; + .db 0D1h ; Ñ + .db 0E1h ; á + .db 20h ; + .db 1Eh ; + .db 0E5h ; Ã¥ + .db 0D5h ; Õ + .db 23h ; # + .db 13h ; + .db 6 ; + .db 8 ; + .db 0CDh ; à + .db 6Ah ; j + .db 1Fh ; + .db 0D1h ; Ñ + .db 0E1h ; á + .db 20h ; + .db 11h ; + .db 0E5h ; Ã¥ + .db 0D5h ; Õ + .db 1 ; + .db 0Ch ; + .db 0 ; + .db 9 ; + .db 0EBh ; ë + .db 9 ; + .db 0EBh ; ë + .db 1Ah ; + .db 0BEh ; ¾ + .db 0D1h ; Ñ + .db 0E1h ; á + .db 20h ; + .db 2 ; + .db 1Ah ; + .db 0BEh ; ¾ + .db 0C1h ; à + .db 0C9h ; É + .db 23h ; # + .db 13h ; + .db 6 ; + .db 0Ch ; + .db 0CDh ; à + .db 6Ah ; j + .db 1Fh ; + .db 18h ; + .db 0EFh ; ï + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_185C: ; CODE XREF: sub_0_17C9+7p + or 0AFh + ld (2738h), a + push hl + push de + ld (273Fh), hl + ld (2739h), hl + ld hl, 2714h + ld a, 3Fh + ld b, 0Ch + call sub_0_1F09 + xor a + ld b, 18h + call sub_0_1F09 + ld hl, 0 + ld (273Bh), hl + ld de, 80h + ld c, F_DMAOFF + call bdos + ld c, 11h + jr loc_0_1892 +;---------------------------------------------------------------------------- + +loc_0_188B: ; CODE XREF: sub_0_185C+3Ej + call sub_0_18A8 + jr z, loc_0_18A5 + ld c, 12h + +loc_0_1892: ; CODE XREF: sub_0_185C+2Dj + ld de, 2714h + call bdos + cp 0FFh + jr nz, loc_0_188B + or 0FFh + +loc_0_189E: ; CODE XREF: sub_0_185C+4Aj + ld bc, (273Bh) + pop de + pop hl + ret +;---------------------------------------------------------------------------- + +loc_0_18A5: ; CODE XREF: sub_0_185C+32j + xor a + jr loc_0_189E +; End of function sub_0_185C + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_18A8: ; CODE XREF: sub_0_185C+2Fp + push bc + push de + push hl + rrca + rrca + rrca + and 60h + ld de, 80h + ld l, a + ld h, 0 + add hl, de + ld a, (hl) + cp 0E5h + jr z, loc_0_18E4+1 + cp 21h + jr nc, loc_0_18E4+1 + call sub_0_18EB + jr z, loc_0_18E4+1 + push hl + ld hl, (273Bh) + inc hl + ld (273Bh), hl + pop hl + ld de, (273Fh) + ld bc, 10h + ldir + ld (273Fh), de + call sub_0_1F4A + ld a, h + dec a + cp d + jr nz, loc_0_18E4+1 + xor a + +loc_0_18E4: ; CODE XREF: sub_0_18A8+12j + ; sub_0_18A8+16j ... + ld hl, 0FFF6h + pop hl + pop de + pop bc + ret +; End of function sub_0_18A8 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_18EB: ; CODE XREF: sub_0_18A8+18p + push hl + ex de, hl + ld bc, (273Bh) + ld a, b + or c + jr z, loc_0_1934 + ld hl, (2739h) + +loc_0_18F8: ; CODE XREF: sub_0_18EB+47j + push bc + push hl + push de + ld b, 0Ch + call sub_0_1F6A + pop de + pop hl + jr nz, loc_0_192A + push hl + push de + ld bc, 0Ch + add hl, bc + ex de, hl + add hl, bc + ld a, (de) + cp (hl) + pop de + pop hl + jr nc, loc_0_1920 + ld a, (2738h) + or a + jr nz, loc_0_1926 + +loc_0_1918: ; CODE XREF: sub_0_18EB+39j + ex de, hl + ld bc, 10h + ldir + jr loc_0_1926 +;---------------------------------------------------------------------------- + +loc_0_1920: ; CODE XREF: sub_0_18EB+25j + ld a, (2738h) + or a + jr nz, loc_0_1918 + +loc_0_1926: ; CODE XREF: sub_0_18EB+2Bj + ; sub_0_18EB+33j + pop bc + xor a + pop hl + ret +;---------------------------------------------------------------------------- + +loc_0_192A: ; CODE XREF: sub_0_18EB+17j + ld bc, 10h + add hl, bc + pop bc + dec bc + ld a, b + or c + jr nz, loc_0_18F8 + +loc_0_1934: ; CODE XREF: sub_0_18EB+8j + or 0FFh + pop hl + ret +; End of function sub_0_18EB + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1938: ; CODE XREF: sub_0_17C9+20p + push hl + push de + push af + push hl + ld hl, 0 + ld (273Dh), hl + pop hl + ld (273Fh), hl + push bc + +loc_0_1947: ; CODE XREF: sub_0_1938+31j + ; sub_0_1938+37j + pop bc + ld a, b + or c + jr z, loc_0_1971 + dec bc + push bc + bit 7, (hl) + jr z, loc_0_196B + res 7, (hl) + ex de, hl + ld hl, (273Dh) + inc hl + ld (273Dh), hl + ld hl, (273Fh) + ex de, hl + ld bc, 10h + ldir + ld (273Fh), de + jr loc_0_1947 +;---------------------------------------------------------------------------- + +loc_0_196B: ; CODE XREF: sub_0_1938+18j + ld bc, 10h + add hl, bc + jr loc_0_1947 +;---------------------------------------------------------------------------- + +loc_0_1971: ; CODE XREF: sub_0_1938+12j + ld bc, (273Dh) + pop af + pop de + pop hl + ret +; End of function sub_0_1938 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1979: ; CODE XREF: sub_0_17C9+4p + push de + push bc + ex de, hl + call sub_0_19A1 + ld hl, (2750h) + ld (2741h), hl + ld hl, 10h + ld (2743h), hl + ld hl, 0 + ld (273Fh), hl + ld hl, 0FFh + ld (2749h), hl + ex de, hl + ld de, 273Fh + call sub_0_1A30 + pop bc + pop de + ret +; End of function sub_0_1979 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_19A1: ; CODE XREF: sub_0_1979+3p + push bc + push de + push hl + push af + ld c, 1Fh + call bdos + inc hl + inc hl + ld de, 274Bh + ldi + ldi + ldi + ld e, (hl) + inc hl + ld d, (hl) + inc de + ld (274Eh), de + inc hl + ld e, (hl) + inc hl + ld d, (hl) + inc de + ld (2750h), de + pop af + pop hl + pop de + pop bc + ret +; End of function sub_0_19A1 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_19CB: ; CODE XREF: sub_0_17C9+1Dp + push hl + push de + push bc + push af + ld (2752h), a + push bc + +loc_0_19D3: ; CODE XREF: sub_0_19CB+39j + pop bc + ld a, b + or c + jr z, loc_0_1A06 + dec bc + push bc + push hl + push de + inc hl + inc de + ld b, 8 + ex de, hl + call sub_0_1F58 + pop de + pop hl + jr nz, loc_0_1A00 + push hl + push de + ld bc, 9 + add hl, bc + ex de, hl + add hl, bc + ld b, 3 + call sub_0_1F58 + pop de + pop hl + jr nz, loc_0_1A00 + call sub_0_1A0B + jr nz, loc_0_1A00 + set 7, (hl) + +loc_0_1A00: ; CODE XREF: sub_0_19CB+1Bj + ; sub_0_19CB+2Cj ... + ld bc, 10h + add hl, bc + jr loc_0_19D3 +;---------------------------------------------------------------------------- + + +loc_0_1A06: ; CODE XREF: sub_0_19CB+Bj + pop af + pop bc + pop de + pop hl + ret +; End of function sub_0_19CB + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1A0B: ; CODE XREF: sub_0_19CB+2Ep + push de + push hl + ld de, 0Ah + add hl, de + bit 7, (hl) + pop hl + pop de + ld a, (2752h) + jr z, loc_0_1A21 + bit 6, a + jr nz, loc_0_1A25 + +loc_0_1A1E: ; CODE XREF: sub_0_1A0B+18j + ; sub_0_1A0B+21j + or 0FFh + ret +;---------------------------------------------------------------------------- + +loc_0_1A21: ; CODE XREF: sub_0_1A0B+Dj + bit 7, a + jr z, loc_0_1A1E + +loc_0_1A25: ; CODE XREF: sub_0_1A0B+11j + bit 5, a + jr nz, loc_0_1A2E + xor (hl) + and 3Fh + jr nz, loc_0_1A1E + +loc_0_1A2E: ; CODE XREF: sub_0_1A0B+1Cj + xor a + ret +; End of function sub_0_1A0B + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1A30: ; CODE XREF: sub_0_17F2+1Ap + ; sub_0_1979+22p + push bc + push de + push hl + call sub_0_1B84 + pop de + ld (275Dh), de + ld hl, (2757h) + ld a, h + or l + jr z, loc_0_1A7B + ld b, h + ld c, l + add hl, hl + jr c, loc_0_1A7B + add hl, de + jr c, loc_0_1A7B + ex de, hl + ld hl, (6) + sbc hl, de + jr c, loc_0_1A7B + ld hl, (2755h) + ld a, h + or l + jr z, loc_0_1A5A + ex de, hl + +loc_0_1A5A: ; CODE XREF: sub_0_1A30+27j + push de + ld hl, (275Dh) + +loc_0_1A5E: ; CODE XREF: sub_0_1A30+3Cj + ld (hl), e + inc hl + ld (hl), d + inc hl + push hl + ld hl, (2759h) + add hl, de + ex de, hl + pop hl + dec bc + ld a, b + or c + jr nz, loc_0_1A5E + pop hl + ld (2755h), hl + push hl + call sub_0_1B91 + pop hl + dec a + +loc_0_1A78: ; CODE XREF: sub_0_1A30+4Fj + pop de + pop bc + ret +;---------------------------------------------------------------------------- + +loc_0_1A7B: ; CODE XREF: sub_0_1A30+10j + ; sub_0_1A30+15j ... + xor a + ld hl, (275Dh) + jr loc_0_1A78 +; End of function sub_0_1A30 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1A81: ; CODE XREF: sub_0_17F2+21p + ex af, af' + push af + ex af, af' + push hl + push de + push bc + push af + call sub_0_1B84 + call sub_0_1B9A + ld a, (275Fh) + or a + jr z, loc_0_1AF1 + ld a, (2760h) + or a + jr nz, loc_0_1AF1 + ld hl, (2757h) + ld a, h + or l + jr z, loc_0_1AF1 + ld (2761h), hl + ld hl, 0 + ld (2763h), hl + +loc_0_1AAA: ; CODE XREF: sub_0_1A81+4Bj + ; sub_0_1A81+6Ej + ld hl, (2761h) + dec hl + ld a, h + or l + jr z, loc_0_1AF1 + ld (2761h), hl + ld hl, (2763h) + inc hl + ld (2763h), hl + ld d, h + ld e, l + call sub_0_1B7C + ld a, (hl) + inc hl + ld h, (hl) + ld l, a + ex de, hl + call sub_0_1B29 + sbc hl, de + add hl, de + jr nc, loc_0_1AAA + push de + push hl + call sub_0_1B08 + ld hl, (2763h) + call sub_0_1B7C + pop de + ld (hl), e + inc hl + ld (hl), d + inc hl + +loc_0_1ADE: ; CODE XREF: sub_0_1A81+61j + ; sub_0_1A81+67j + ld a, (hl) + inc hl + cp e + inc hl + jr nz, loc_0_1ADE + dec hl + ld a, (hl) + inc hl + cp d + jr nz, loc_0_1ADE + pop de + dec hl + ld (hl), d + dec hl + ld (hl), e + jr loc_0_1AAA +;---------------------------------------------------------------------------- + +loc_0_1AF1: ; CODE XREF: sub_0_1A81+11j + ; sub_0_1A81+17j ... + pop af + pop bc + pop de + pop hl + ex af, af' + pop af + ex af, af' + ret +; End of function sub_0_1A81 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1AF9: ; CODE XREF: sub_0_1B9A+3Cp + push hl + push de + ld bc, 1B0Eh + push bc + ld a, (275Fh) + or a + jr nz, loc_0_1B11 + call sub_0_1B25 +; End of function sub_0_1AF9 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1B08: ; CODE XREF: sub_0_1A81+4Fp + ld bc, (2759h) + jr loc_0_1B1B +;---------------------------------------------------------------------------- + .db 0D1h ; Ñ + .db 0E1h ; á + .db 0C9h ; É +;---------------------------------------------------------------------------- + +loc_0_1B11: ; CODE XREF: sub_0_1AF9+Aj + call sub_0_1B7C + ex de, hl + dec hl + add hl, hl + add hl, bc + ld bc, 2 + +loc_0_1B1B: ; CODE XREF: sub_0_1B08+4j + ; sub_0_1B08+19j + ld a, (de) + ldi + dec hl + ld (hl), a + inc hl + jp pe, loc_0_1B1B + ret +; End of function sub_0_1B08 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1B25: ; CODE XREF: sub_0_1AF9+Cp + ; sub_0_1B55+Cp + call sub_0_1B29 + ex de, hl +; End of function sub_0_1B25 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1B29: ; CODE XREF: sub_0_1A81+45p + ; sub_0_1B25p + push de + dec hl + ld d, h + ld e, l + ld bc, (2759h) + ld hl, 0FFE5h + add hl, bc + ld hl, 0 + jr nc, loc_0_1B4A + ld a, 10h + +loc_0_1B3C: ; CODE XREF: sub_0_1B29+1Bj + add hl, hl + ex de, hl + add hl, hl + ex de, hl + jr nc, loc_0_1B43 + add hl, bc + +loc_0_1B43: ; CODE XREF: sub_0_1B29+17j + dec a + jr nz, loc_0_1B3C + jr loc_0_1B4E +;---------------------------------------------------------------------------- + +loc_0_1B48: ; CODE XREF: sub_0_1B29+23j + dec bc + add hl, de + +loc_0_1B4A: ; CODE XREF: sub_0_1B29+Fj + ld a, b + or c + jr nz, loc_0_1B48 + +loc_0_1B4E: ; CODE XREF: sub_0_1B29+1Dj + ld de, (2755h) + add hl, de + pop de + ret +; End of function sub_0_1B29 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1B55: ; CODE XREF: sub_0_1B9A+37p + push hl + push de + ld bc, 1B0Eh + push bc + ld a, (275Fh) + or a + jr nz, loc_0_1B66 + call sub_0_1B25 + jr loc_0_1B76 +;---------------------------------------------------------------------------- + +loc_0_1B66: ; CODE XREF: sub_0_1B55+Aj + call sub_0_1B7C + ex de, hl + dec hl + add hl, hl + add hl, bc + ld c, (hl) + inc hl + ld b, (hl) + ex de, hl + ld e, (hl) + inc hl + ld d, (hl) + ld h, b + ld l, c + +loc_0_1B76: ; CODE XREF: sub_0_1B55+Fj + push hl + ld hl, (275Bh) + ex (sp), hl + ret +; End of function sub_0_1B55 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1B7C: ; CODE XREF: sub_0_1A81+3Dp + ; sub_0_1A81+55p ... + dec hl + add hl, hl + ld bc, (275Dh) + add hl, bc + ret +; End of function sub_0_1B7C + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1B84: ; CODE XREF: sub_0_1A30+3p + ; sub_0_1A81+7p + ex de, hl + ld (2753h), hl + ld de, 2755h + +loc_0_1B8B: ; CODE XREF: sub_0_1B91+7j + ld bc, 0Ch + ldir + ret +; End of function sub_0_1B84 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1B91: ; CODE XREF: sub_0_1A30+43p + ld hl, 2755h + ld de, (2753h) + jr loc_0_1B8B +; End of function sub_0_1B91 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1B9A: ; CODE XREF: sub_0_1A81+Ap + ld hl, (2757h) + ld (2763h), hl + +loc_0_1BA0: ; CODE XREF: sub_0_1B9A+29j + ld hl, (2763h) + srl h + rr l + ld a, l + or h + ret z + bit 0, l + jr nz, loc_0_1BAF + dec hl + +loc_0_1BAF: ; CODE XREF: sub_0_1B9A+12j + ld (2763h), hl + ld (2761h), hl + +loc_0_1BB5: ; CODE XREF: sub_0_1B9A+31j + ; sub_0_1B9A+33j ... + ld hl, (2761h) + inc hl + ld (2761h), hl + ex de, hl + ld hl, (2757h) + or a + sbc hl, de + jr c, loc_0_1BA0 + +loc_0_1BC5: ; CODE XREF: sub_0_1B9A+3Fj + ld hl, (2763h) + ex de, hl + sbc hl, de + jr c, loc_0_1BB5 + jr z, loc_0_1BB5 + ex de, hl + add hl, de + call sub_0_1B55 + jr nc, loc_0_1BB5 + call sub_0_1AF9 + jr loc_0_1BC5 +; End of function sub_0_1B9A + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1BDB: ; CODE XREF: sub_0_922+23p + push hl + call sub_0_1C23 + call sub_0_1C37 + pop hl + ret nz + cpl + ld (byte_0_1C35), a + cpl + ret +; End of function sub_0_1BDB + +;---------------------------------------------------------------------------- + .db 0E5h ; Ã¥ + .db 0CDh ; à + .db 2Ch ; , + .db 1Ch ; + .db 0CDh ; à + .db 75h ; u + .db 1Ch ; + .db 0E1h ; á + .db 0C0h ; À + .db 2Fh ; / + .db 32h ; 2 + .db 36h ; 6 + .db 1Ch ; + .db 2Fh ; / + .db 0C9h ; É + .db 0E5h ; Ã¥ + .db 0CDh ; à + .db 23h ; # + .db 1Ch ; + .db 0C3h ; à + .db 98h ; ˜ + .db 1Ch ; + .db 0E5h ; Ã¥ + .db 0F5h ; õ + .db 0CDh ; à + .db 2Ch ; , + .db 1Ch ; + .db 0F1h ; ñ + .db 0C3h ; à + .db 0DFh ; ß + .db 1Ch ; + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1C09: ; CODE XREF: sub_0_8C1+24p + push hl + call sub_0_1C23 + call nz, sub_0_1D16 + pop hl + ret nz + ld (byte_0_1C35), a + ret +; End of function sub_0_1C09 + +;---------------------------------------------------------------------------- + .db 0E5h ; Ã¥ + .db 0CDh ; à + .db 2Ch ; , + .db 1Ch ; + .db 0C4h ; Ä + .db 21h ; ! + .db 1Dh ; + .db 0E1h ; á + .db 0C0h ; À + .db 32h ; 2 + .db 36h ; 6 + .db 1Ch ; + .db 0C9h ; É + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1C23: ; CODE XREF: sub_0_1BDB+1p + ; sub_0_1C09+1p + ld hl, 2765h + ld a, (byte_0_1C35) + ld (hl), a + or a + ret +; End of function sub_0_1C23 + +;---------------------------------------------------------------------------- + .db 21h ; ! + .db 0Dh ; + .db 28h ; ( + .db 3Ah ; : + .db 36h ; 6 + .db 1Ch ; + .db 77h ; w + .db 0B7h ; · + .db 0C9h ; É +byte_0_1C35: .db 0 ; DATA XREF: sub_0_1BDB+Aw + ; sub_0_1C09+9w ... + .db 0 ; + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1C37: ; CODE XREF: sub_0_1BDB+4p + push bc + push de + ld a, (hl) + or a + ld a, 7 + jr nz, loc_0_1C72 + ld (28B5h), hl + inc hl + inc hl + inc hl + inc hl + push hl + ld bc, 24h + ex de, hl + ldir + pop de + call sub_0_1DF3 + call sub_0_1DD7 + ld a, 3 + jr nz, loc_0_1C72 + call sub_0_1D56 + ld a, 4 + jr nz, loc_0_1C72 + ld hl, (28B5h) + ld (hl), 0FFh + inc hl + ld (hl), 80h + inc hl + ex de, hl + ld hl, 26h + add hl, de + ex de, hl + ld (hl), e + inc hl + ld (hl), d + xor a + +loc_0_1C72: ; CODE XREF: sub_0_1C37+6j + ; sub_0_1C37+1Fj ... + jp loc_0_1D52 +; End of function sub_0_1C37 + +;---------------------------------------------------------------------------- + .db 0C5h ; Ã… + .db 0D5h ; Õ + .db 7Eh ; ~ + .db 0B7h ; · + .db 3Eh ; > + .db 7 ; + .db 20h ; + .db 0F5h ; õ + .db 22h ; " + .db 0B5h ; µ + .db 28h ; ( + .db 23h ; # + .db 23h ; # + .db 23h ; # + .db 23h ; # + .db 0E5h ; Ã¥ + .db 1 ; + .db 24h ; $ + .db 0 ; + .db 0EBh ; ë + .db 0EDh ; í + .db 0B0h ; ° + .db 0D1h ; Ñ + .db 0CDh ; à + .db 0F3h ; ó + .db 1Dh ; + .db 0CDh ; à + .db 0C9h ; É + .db 1Dh ; + .db 28h ; ( + .db 0CBh ; Ë + .db 3Eh ; > + .db 5 ; + .db 18h ; + .db 0DAh ; Ú + .db 0C5h ; Ã… + .db 0D5h ; Õ + .db 7Eh ; ~ + .db 0B7h ; · + .db 3Eh ; > + .db 1 ; + .db 28h ; ( + .db 71h ; q + .db 22h ; " + .db 0B5h ; µ + .db 28h ; ( + .db 23h ; # + .db 23h ; # + .db 5Eh ; ^ + .db 23h ; # + .db 56h ; V + .db 7Ah ; z + .db 0B3h ; ³ + .db 3Eh ; > + .db 4 ; + .db 28h ; ( + .db 63h ; c + .db 1Ah ; + .db 32h ; 2 + .db 0B7h ; · + .db 28h ; ( + .db 13h ; + .db 72h ; r + .db 2Bh ; + + .db 73h ; s + .db 2Bh ; + + .db 35h ; 5 + .db 20h ; + .db 1Bh ; + .db 36h ; 6 + .db 80h ; € + .db 23h ; # + .db 0EBh ; ë + .db 21h ; ! + .db 26h ; & + .db 0 ; + .db 19h ; + .db 0EBh ; ë + .db 73h ; s + .db 23h ; # + .db 72h ; r + .db 0CDh ; à + .db 56h ; V + .db 1Dh ; + .db 28h ; ( + .db 0Ah ; + .db 2Ah ; * + .db 0B5h ; µ + .db 28h ; ( + .db 23h ; # + .db 23h ; # + .db 36h ; 6 + .db 0 ; + .db 23h ; # + .db 36h ; 6 + .db 0 ; + .db 3Ah ; : + .db 0B7h ; · + .db 28h ; ( + .db 0BFh ; ¿ + .db 18h ; + .db 37h ; 7 + .db 0E5h ; Ã¥ + .db 2Ah ; * + .db 0B5h ; µ + .db 28h ; ( + .db 0C5h ; Ã… + .db 0D5h ; Õ + .db 32h ; 2 + .db 0B7h ; · + .db 28h ; ( + .db 7Eh ; ~ + .db 0B7h ; · + .db 3Eh ; > + .db 1 ; + .db 28h ; ( + .db 27h ; ' + .db 22h ; " + .db 0B5h ; µ + .db 28h ; ( + .db 23h ; # + .db 23h ; # + .db 5Eh ; ^ + .db 23h ; # + .db 56h ; V + .db 3Ah ; : + .db 0B7h ; · + .db 28h ; ( + .db 12h ; + .db 13h ; + .db 72h ; r + .db 2Bh ; + + .db 73h ; s + .db 2Bh ; + + .db 35h ; 5 + .db 20h ; + .db 0D7h ; × + .db 36h ; 6 + .db 80h ; € + .db 23h ; # + .db 0EBh ; ë + .db 21h ; ! + .db 26h ; & + .db 0 ; + .db 19h ; + .db 0EBh ; ë + .db 73h ; s + .db 23h ; # + .db 72h ; r + .db 0CDh ; à + .db 6Dh ; m + .db 1Dh ; + .db 28h ; ( + .db 0C6h ; Æ + .db 3Eh ; > + .db 2 ; + .db 0B7h ; · + .db 0D1h ; Ñ + .db 0C1h ; à + .db 0E1h ; á + .db 0C9h ; É + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1D16: ; CODE XREF: sub_0_1C09+4p + push bc + push de + ld a, (hl) + or a + jr z, loc_0_1D52 + ld (28B5h), hl + jr loc_0_1D40 +;---------------------------------------------------------------------------- + .db 0C5h ; Ã… + .db 0D5h ; Õ + .db 7Eh ; ~ + .db 0B7h ; · + .db 28h ; ( + .db 2Bh ; + + .db 22h ; " + .db 0B5h ; µ + .db 28h ; ( + .db 23h ; # + .db 7Eh ; ~ + .db 0FEh ; þ + .db 80h ; € + .db 28h ; ( + .db 10h ; + .db 3Eh ; > + .db 1Ah ; + .db 0CDh ; à + .db 0DBh ; Û + .db 1Ch ; + .db 7Eh ; ~ + .db 0FEh ; þ + .db 80h ; € + .db 28h ; ( + .db 6 ; + .db 0AFh ; ¯ + .db 0CDh ; à + .db 0DBh ; Û + .db 1Ch ; + .db 18h ; + .db 0F5h ; õ +;---------------------------------------------------------------------------- + +loc_0_1D40: ; CODE XREF: sub_0_1D16+9j + ld hl, (28B5h) + ld (hl), 0 + inc hl + inc hl + inc hl + inc hl + ex de, hl + call sub_0_1DD2 + ld a, 6 + jr nz, loc_0_1D52 + xor a + +loc_0_1D52: ; CODE XREF: sub_0_1C37+3Bj + ; sub_0_1D16+4j ... + pop de + pop bc + or a + ret +; End of function sub_0_1D16 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1D56: ; CODE XREF: sub_0_1C37+21p + ld hl, (28B5h) + ld de, 28h + add hl, de + call sub_0_1DE9 + ld de, (28B5h) + inc de + inc de + inc de + inc de + call sub_0_1DDF + jr loc_0_1D82 +;---------------------------------------------------------------------------- + .db 2Ah ; * + .db 0B5h ; µ + .db 28h ; ( + .db 11h ; + .db 28h ; ( + .db 0 ; + .db 19h ; + .db 0CDh ; à + .db 0E9h ; é + .db 1Dh ; + .db 0EDh ; í + .db 5Bh ; [ + .db 0B5h ; µ + .db 28h ; ( + .db 13h ; + .db 13h ; + .db 13h ; + .db 13h ; + .db 0CDh ; à + .db 0E4h ; ä + .db 1Dh ; +;---------------------------------------------------------------------------- + +loc_0_1D82: ; CODE XREF: sub_0_1D56+15j + push af + ld hl, 80h + call sub_0_1DE9 + pop af + or a + ret +; End of function sub_0_1D56 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1D8C: ; CODE XREF: sub_0_15E9+8p + ; sub_0_1774+Ap + push af + push de + push hl + ld c, 19h + call sub_0_1E11 + push af + ld e, 0FFh + ld c, 20h + call sub_0_1E11 + ld c, a + pop af + ld b, a + pop hl + pop de + pop af + ret +; End of function sub_0_1D8C + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1DA3: ; CODE XREF: sub_0_922+3p + ld a, 23h + jr loc_0_1DA9 +;---------------------------------------------------------------------------- + .db 3Eh ; > + .db 24h ; $ +;---------------------------------------------------------------------------- + +loc_0_1DA9: ; CODE XREF: sub_0_1DA3+2j + push de + push bc + push af + ld hl, 28B8h + ld bc, 24h + push hl + ex de, hl + ldir + pop de + pop af + call sub_0_1E1A + ld hl, 21h + add hl, de + ld e, (hl) + inc hl + ld d, (hl) + inc hl + ld a, (hl) + ex de, hl + pop bc + pop de + or a + ret +; End of function sub_0_1DA3 + +;---------------------------------------------------------------------------- + .db 0CDh ; à + .db 0D7h ; × + .db 1Dh ; + .db 0C8h ; È + .db 3Eh ; > + .db 16h ; + .db 0C3h ; à + .db 0D9h ; Ù + .db 1Dh ; + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1DD2: ; CODE XREF: sub_0_1D16+34p + ld a, 10h + jp loc_0_1DD9 +; End of function sub_0_1DD2 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1DD7: ; CODE XREF: sub_0_1C37+1Ap + ld a, 0Fh + +loc_0_1DD9: ; CODE XREF: sub_0_1DD2+2j + call sub_0_1E1A + ret m + xor a + ret +; End of function sub_0_1DD7 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1DDF: ; CODE XREF: sub_0_1D56+12p + ld a, 14h + jp sub_0_1E1A +; End of function sub_0_1DDF + +;---------------------------------------------------------------------------- + .db 3Eh ; > + .db 15h ; + .db 0C3h ; à + .db 1Ah ; + .db 1Eh ; + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1DE9: ; CODE XREF: sub_0_1D56+7p + ; sub_0_1D56+30p + push af + ld a, 1Ah + ex de, hl + call sub_0_1E1A + ex de, hl + pop af + ret +; End of function sub_0_1DE9 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1DF3: ; CODE XREF: sub_0_1C37+17p + push hl + push de + push af + ex de, hl + ld de, 0Ch + ld (hl), d + add hl, de + ld e, 15h + +loc_0_1DFE: ; CODE XREF: sub_0_1DF3+Ej + ld (hl), d + inc hl + dec e + jr nz, loc_0_1DFE + pop af + pop de + pop hl + ret +; End of function sub_0_1DF3 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1E07: ; CODE XREF: sub_0_15B6+4p + ld a, 1 + jp sub_0_1E1A +; End of function sub_0_1E07 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1E0C: ; CODE XREF: sub_0_15B6+1p + ld a, 0Bh + jp sub_0_1E1A +; End of function sub_0_1E0C + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1E11: ; CODE XREF: sub_0_1D8C+5p + ; sub_0_1D8C+Dp + push de + push bc + call bdos + pop bc + pop de + or a + ret +; End of function sub_0_1E11 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1E1A: ; CODE XREF: sub_0_1DA3+15p + ; sub_0_1DD7+2p ... + push hl + push de + push bc + ld c, a + call bdos + or a + pop bc + pop de + pop hl + ret +; End of function sub_0_1E1A + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1E26: ; CODE XREF: sub_0_4AC+10p + ; sub_0_972+Cp + push bc + push hl + push de + push af + ld b, 8 + call sub_0_1E3C + ld (hl), 2Eh + inc hl + ld b, 3 + call sub_0_1E3C + pop af + pop de + pop hl + pop bc + ret +; End of function sub_0_1E26 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1E3C: ; CODE XREF: sub_0_1E26+6p + ; sub_0_1E26+Ep ... + ld a, (de) + and 7Fh + cp 20h + jr z, loc_0_1E45 + ld (hl), a + inc hl + +loc_0_1E45: ; CODE XREF: sub_0_1E3C+5j + inc de + djnz sub_0_1E3C + ret +; End of function sub_0_1E3C + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1E49: ; CODE XREF: start+9Dp sub_0_4AC+1Fp + push bc + ld b, 0 + jp loc_0_1E52 +;---------------------------------------------------------------------------- + .db 0C5h ; Ã… + .db 6 ; + .db 0FFh ; ÿ +;---------------------------------------------------------------------------- + +loc_0_1E52: ; CODE XREF: sub_0_1E49+3j + push hl + push af + ld h, 64h + call sub_0_1E65 + ld h, 0Ah + call sub_0_1E65 + call sub_0_1E79 + pop af + pop hl + pop bc + ret +; End of function sub_0_1E49 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1E65: ; CODE XREF: sub_0_1E49+Dp + ; sub_0_1E49+12p + ld l, 0FFh + +loc_0_1E67: ; CODE XREF: sub_0_1E65+4j + sub h + inc l + jr nc, loc_0_1E67 + add a, h + ld h, a + ld a, l + or a + jr nz, sub_0_1E79 + or b + ld a, h + ret m + ld a, 20h + jr z, loc_0_1E7C + xor a +; End of function sub_0_1E65 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1E79: ; CODE XREF: sub_0_1E49+15p + ; sub_0_1E65+Aj + add a, 30h + ld b, a + +loc_0_1E7C: ; CODE XREF: sub_0_1E65+11j + ld (de), a + inc de + ld a, h + ret +; End of function sub_0_1E79 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1E80: ; CODE XREF: sub_0_15D4+4p + push af + push hl + +loc_0_1E82: ; CODE XREF: sub_0_1E80+Bj + ld a, (hl) + or a + jr z, loc_0_1E8D + call sub_0_1F3F + ld (hl), a + inc hl + jr loc_0_1E82 +;---------------------------------------------------------------------------- + +loc_0_1E8D: ; CODE XREF: sub_0_1E80+4j + pop hl + pop af + ret +; End of function sub_0_1E80 + +;---------------------------------------------------------------------------- + .db 0F5h ; õ + .db 7Eh ; ~ + .db 23h ; # + .db 0B7h ; · + .db 28h ; ( + .db 5 ; + .db 0CDh ; à + .db 24h ; $ + .db 1Fh ; + .db 28h ; ( + .db 0F6h ; ö +;---------------------------------------------------------------------------- + +loc_0_1E9B: ; CODE XREF: sub_0_1E9E+4j + ; sub_0_1E9E+Bj + dec hl + pop af + ret + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1E9E: ; CODE XREF: sub_0_972+20p + ; sub_0_972+54p ... + push af + +loc_0_1E9F: ; CODE XREF: sub_0_1E9E+9j + ld a, (hl) + inc hl + or a + jr z, loc_0_1E9B + call sub_0_1F24 + jr nz, loc_0_1E9F + jr loc_0_1E9B +; End of function sub_0_1E9E + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1EAB: ; CODE XREF: start+3Bp + push bc + push de + push hl + ld c, a + ex de, hl + ld b, (hl) + push hl + inc hl + inc hl + +loc_0_1EB4: ; CODE XREF: sub_0_1EAB+25j + call sub_0_1EE8 + or a + jr z, loc_0_1EDD + ld (hl), e + inc hl + ld (hl), d + inc hl + dec b + jr z, loc_0_1ED2 + call sub_0_1EF6 + or a + jr z, loc_0_1EDD + ld a, c + or a + jr z, loc_0_1ECE + xor a + ld (de), a + inc de + +loc_0_1ECE: ; CODE XREF: sub_0_1EAB+1Ej + ld a, b + or a + jr nz, loc_0_1EB4 + +loc_0_1ED2: ; CODE XREF: sub_0_1EAB+14j + call sub_0_1EF6 + call sub_0_1EE8 + or a + jr z, loc_0_1EDD + or 0FFh + +loc_0_1EDD: ; CODE XREF: sub_0_1EAB+Dj + ; sub_0_1EAB+1Aj ... + pop hl + push af + ld a, (hl) + sub b + inc hl + ld (hl), a + pop af + pop hl + pop de + pop bc + ret +; End of function sub_0_1EAB + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1EE8: ; CODE XREF: sub_0_1EAB+9p + ; sub_0_1EAB+2Ap ... + ld a, (de) + and 7Fh + inc de + cp 20h + jr z, sub_0_1EE8 + cp 9 + jr z, sub_0_1EE8 + dec de + ret +; End of function sub_0_1EE8 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1EF6: ; CODE XREF: sub_0_1EAB+16p + ; sub_0_1EAB+27p ... + ld a, (de) + and 7Fh + ret z + cp 20h + ret z + cp 9 + ret z + inc de + jr sub_0_1EF6 +; End of function sub_0_1EF6 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1F03: ; CODE XREF: sub_0_4AC+Cp sub_0_623+3j + ; ... + push hl + call sub_0_1F09 + pop hl + ret +; End of function sub_0_1F03 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1F09: ; CODE XREF: sub_0_185C+14p + ; sub_0_185C+1Ap ... + push bc + +loc_0_1F0A: ; CODE XREF: sub_0_1F09+3j + ld (hl), a + inc hl + djnz loc_0_1F0A + pop bc + ret +; End of function sub_0_1F09 + +;---------------------------------------------------------------------------- + +loc_0_1F10: ; CODE XREF: sub_0_972+12p + push bc + ld c, a + and 7Fh + call sub_0_1F3F + cp 41h + jr c, unk_0_1F1F + cp 5Bh + jr c, loc_0_1F20 +;---------------------------------------------------------------------------- +unk_0_1F1F: .db 0F6h ; ö ; CODE XREF: seg000:1F19j +;---------------------------------------------------------------------------- + +loc_0_1F20: ; CODE XREF: seg000:1F1Dj + xor a + ld a, c + pop bc + ret + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1F24: ; CODE XREF: sub_0_1E9E+6p + push af + and 7Fh + jr z, loc_0_1F39 + cp 7Fh + jr z, loc_0_1F39 + cp 20h + jr z, loc_0_1F39 + cp 8 + jr c, loc_0_1F3C + cp 0Eh + jr nc, loc_0_1F3C + +loc_0_1F39: ; CODE XREF: sub_0_1F24+3j + ; sub_0_1F24+7j ... + pop af + cp a + ret +;---------------------------------------------------------------------------- + +loc_0_1F3C: ; CODE XREF: sub_0_1F24+Fj + ; sub_0_1F24+13j + pop af + or a + ret +; End of function sub_0_1F24 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1F3F: ; CODE XREF: sub_0_1E80+6p + ; seg000:1F14p + and 7Fh + cp 61h + ret c + cp 7Bh + ret nc + and 5Fh + ret +; End of function sub_0_1F3F + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1F4A: ; CODE XREF: sub_0_18A8+33p + ld hl, (6) + ld l, 0 + ld a, (2) + sub 16h + cp h + ret nc + ld h, a + ret +; End of function sub_0_1F4A + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1F58: ; CODE XREF: sub_0_19CB+16p + ; sub_0_19CB+27p ... + ld a, (hl) + and 7Fh + cp 3Fh + jr z, loc_0_1F65 + ld c, a + ld a, (de) + and 7Fh + cp c + ret nz + +loc_0_1F65: ; CODE XREF: sub_0_1F58+5j + inc hl + inc de + djnz sub_0_1F58 + ret +; End of function sub_0_1F58 + + +;---------------------------------------------------------------------------- + +; S u b r o u t i n e + +sub_0_1F6A: ; CODE XREF: sub_0_18EB+12p + ; sub_0_1F6A+Bj + ld a, (hl) + and 7Fh + ld c, a + ld a, (de) + and 7Fh + cp c + ret nz + inc hl + inc de + djnz sub_0_1F6A + ret +; End of function sub_0_1F6A + +;---------------------------------------------------------------------------- +word_0_1F78: .dw 28DCh ; DATA XREF: start+30r start+3Er + ; ... + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + .db 0 ; + + + + .end ; start + diff --git a/Source/Apps/Test/rzsz/sz.com.orig b/Source/Apps/Test/rzsz/sz.com.orig new file mode 100644 index 00000000..e905002b Binary files /dev/null and b/Source/Apps/Test/rzsz/sz.com.orig differ diff --git a/Source/Apps/Test/sound/Scales.asm b/Source/Apps/Test/sound/Scales.asm new file mode 100644 index 00000000..46bbb19f --- /dev/null +++ b/Source/Apps/Test/sound/Scales.asm @@ -0,0 +1,329 @@ +; +;------------------------------------------------------------------------------ +; PLAY SCALES USING HBIOS +;------------------------------------------------------------------------------ +; +FCB .EQU $5C ; Location of default FCB +BDOS .EQU $0005 +; + .ORG $0100 +; + LD (OLDSTACK),SP ; save old stack pointer + LD SP,STACK ; set new stack pointer +; +;------------------------------------------------------------------------------ +; GET DEVICE # FROM COMMAND LINE +;------------------------------------------------------------------------------ +; + LD A,(FCB+1) ; GET FIRST CHAR + SUB ' ' + JR Z,NO_ARG + SUB '0'-' ' + JP C,EXIT +; +;------------------------------------------------------------------------------ +; DISPLAY DEVICE AND NUMBER OF CHANNELS +;------------------------------------------------------------------------------ +; +NO_ARG: LD (DEVICE),A ; + LD DE,TXT_DEV ; DEVICE: + CALL PRTSTR + CALL PRTDECB + LD C,A ; GET DEVICE ID + LD A,':' + CALL PRTCHR + LD B,$55 + PUSH BC + LD E,4 + RST 08 + LD DE,TXT_NAME + LD A,B + RRCA \ RRCA \ RRCA \ RRCA + CALL PRTIDXDEA ; SHOW NAME + LD DE,TXT_CH + CALL PRTSTR +; + POP BC ; GET & DISPLAY # CHANNELS + LD E,1 + RST 08 + LD A,B + CALL PRTDECB + CALL CRLF ; NUMBER OF CHANNELS IS IN B +; +;------------------------------------------------------------------------------ +; LOOP THROUGH EACH CHANNEL +;------------------------------------------------------------------------------ + +CH__TONE: LD A,(DEVICE) ; C CONTAINS DEVICE + LD C,A ; THROUGH THIS LOOP +; + PUSH BC + LD B,50H ; RESET DEVICE + RST 08 + POP BC +; + PUSH BC + LD B,51H ; VOLUME FULL + LD L,0FFH + RST 08 + POP BC +; + LD A,B +TST_TONE_LP: DEC A + LD (CHANNEL),A ; SAVE CURRENT CHANNEL + CALL TST_SCALES ; SCALES TEST +; CALL TST_VOLUME ; VOLUME TEST + CALL CRLF + DJNZ TST_TONE_LP +; + PUSH BC + LD B,50H ; RESET DEVICE + RST 08 + POP BC +; +;------------------------------------------------------------------------------ +; RESTORE STACK & EXIT +;------------------------------------------------------------------------------ +; +EXIT: LD SP, (OLDSTACK) ; Exit to CP/M + RST 00H + DI + HALT +; +;------------------------------------------------------------------------------ +; PLAY SCALES FROM HIGHEST HBIOS NOTE TO LOWEST +;------------------------------------------------------------------------------ +; +TST_SCALES: PUSH BC + PUSH AF +; + LD HL,380 ; START NOTE + LD (NOTE),HL ; Top of Octave 7 is 343 + + LD B,51H ; VOLUME HIGH + LD L,0FFH + PUSH BC + RST 08 + POP BC +; +NEXT0: PUSH BC +; + LD DE,TXT_TSTCH ; DISPLAY CHANNEL + CALL PRTSTR + LD A,(CHANNEL) + CALL PRTDECB +; + LD DE,TXT_NOTE ; DISPLAY NOTE + CALL PRTSTR + LD HL,(NOTE) + CALL PRTDECW + POP BC +; + LD B,53H ; SET NOTE + LD HL,(NOTE) + PUSH BC + RST 08 + POP BC + + OR A ; DID DRIVER FAIL + JR Z,NEXT4 ; THIS NOTE ? + + LD DE,TXT_BAD_N + CALL FAILMSG + JR SKIP +; +NEXT4: LD B,57H ; DURATION + LD HL,1000 + PUSH BC + RST 08 + POP BC + + LD B,54H ; PLAY + LD A,(CHANNEL) + LD D,A + PUSH BC + RST 08 + POP BC +; + OR A ; DID DRIVER FAIL + JR Z,NEXT2 ; TO PLAY ? + + LD DE,TXT_BAD_N + CALL FAILMSG + JR SKIP +; +NEXT2: CALL DELAY + CALL CRLF +; +SKIP: LD HL,(NOTE) + DEC HL + LD (NOTE),HL + + INC HL + LD A,H + OR L + DEC HL + JR NZ,NEXT0 +; + LD B,51H ; VOLUME + LD L,00H ; OFF + PUSH BC + RST 08 + POP BC +; + LD B,54H ; PLAY + LD A,(CHANNEL) + LD D,A + PUSH BC + RST 08 + POP BC + + PUSH BC + LD C, 6 ; check for keypress + LD E,0FFH + CALL BDOS + POP BC + OR A + JP NZ,EXIT + + POP AF + POP BC +; + RET +; +FAILMSG: PUSH AF + PUSH BC + CALL PRTSTR + CALL CRLF + POP BC + POP AF + RET +; +;------------------------------------------------------------------------------ +; CONSTANT TONE ON ALL CHANNELS, SCALE VOLUME +;------------------------------------------------------------------------------ +; +TST_VOLUME: + LD HL,332+48 ; TONE + LD (NOTE),HL +; + LD B,3 +NEXTCH1 LD A,B + DEC A + LD (CHANNEL),A + PUSH BC ; ACROSS + CALL TONE ; ALL + + LD C, 6 ; KEYPRESS + LD E, 0FFH + CALL BDOS + POP BC ; CHANNELS + + OR A + JP NZ,EXIT + + DJNZ NEXTCH1 + + RET + +TONE: LD A,(DEVICE) + LD C,A + + LD B,50H ; RESET + PUSH BC + RST 08 + POP BC +; +NEXT1: LD B,51H ; VOLUME + LD A,(VOLUME) + LD L,A + PUSH BC + RST 08 + POP BC +; + LD B,53H ; NOTE + LD HL,(NOTE) + PUSH BC + RST 08 + POP BC +; + LD B,54H ; PLAY + LD A,(CHANNEL) + LD D,A + PUSH BC + RST 08 + POP BC +; + CALL DELAY +; + LD A,(VOLUME) + DEC A + LD (VOLUME),A + JR NZ,NEXT1 +; + LD B,51H ; VOLUME + LD L,00H + PUSH BC + RST 08 + POP BC +; + LD B,54H ; PLAY + PUSH BC + LD A,(CHANNEL) + LD D,A + POP BC + RST 08 +; + RET +;; +;------------------------------------------------------------------------------ +; LONG DELAY +;------------------------------------------------------------------------------ +; +DELAY: LD HL,-1 +DELAY1: DEC HL + LD A,H + OR L + JR NZ,DELAY1 + RET +; +;------------------------------------------------------------------------------ +; PRINT THE nTH STRING IN A LIST OF STRINGS WHERE EACH IS TERMINATED BY 0 +; A REGISTER DEFINES THE nTH STRING IN THE LIST TO PRINT AND DE POINTS +; TO THE START OF THE STRING LIST. +;------------------------------------------------------------------------------ +; +PRTIDXDEA: LD C,A + OR A +PRTIDXDEA1: JR Z,PRTIDXDEA3 ; FOUND TARGET SO EXIT +PRTIDXDEA2: LD A,(DE) ; LOOP UNIT + INC DE ; WE REACH + OR A ; END OF STRING + JR NZ,PRTIDXDEA2 + DEC C ; AT STRING END. SO GO + JR PRTIDXDEA1 ; CHECK FOR INDEX MATCH +PRTIDXDEA3: CALL PRTSTR ; DISPLAY THE STRING + RET +; +#INCLUDE "printing.inc" +; +TXT_CH .DB "CHANNELS: ",0 +TXT_TSTCH .DB "CHANNEL: ",0 +TXT_BAD_N .DB " BAD NOTE",0 +TXT_BAD_P .DB " PLAY ERROR",0 +TXT_NOTE .DB " NOTE: ",0 +TXT_DEV .DB "DEVICE: ",0 +TXT_NAME .DB "SN76489 ",0 + .DB "AY-3-8910 ",0 + .DB "I/O PORT ",0 + .DB "YM2612 ",0 +MODE .DB 0 ; scales mode or volume mode +DEVICE .DB 0 +NOTE .DW 128 +VOLUME .DB 0 +CHANNEL .DB 0 +OLDSTACK .DW 0 ; original stack pointer + .DS 40H ; space for stack +STACK ; top of stack +; + .END diff --git a/Source/Apps/Test/sound/ay-test.asm b/Source/Apps/Test/sound/ay-test.asm new file mode 100644 index 00000000..29f84f7b --- /dev/null +++ b/Source/Apps/Test/sound/ay-test.asm @@ -0,0 +1,201 @@ +;***************************************************************************** +;***************************************************************************** +;** ** +;** AY-3-8910 Sound Test Program ** +;** Author: Wayne Warthen -- 10/8/2017 ** +;** ** +;***************************************************************************** +;***************************************************************************** +; +;============================================================================= +; Constants Section +;============================================================================= +; +; Hardware port addresses +; +rsel .equ $9A ; Register seelection port address +rdat .equ $9B ; Register data port address +acr .equ $9C ; Aux control register port address +; +; CPU speed for delay scaling +; +cpuspd .equ 4 ; CPU speed in MHz +; +; BDOS invocation constants +; +bdos .equ $0005 ; BDOS invocation vector +print .equ 9 ; BDOS print function number +conwrt .equ 2 ; BDOS console write char +; +;============================================================================= +; Code Section +;============================================================================= +; + .org $100 +; + ld (stksav),sp ; save incoming stack frame + ld sp,stack ; setup our private stack +; + ld de,banner ; load banner string address + ld c,print ; BDOS print function number + call bdos ; do it +; + ld a,$FF ; SCG board activation value + out (acr),a ; write value to ACR +; + xor a ; zero accum + ld (chan),a ; init channel number +; +chloop: + ; Test each channel + call tstchan ; test the current channel + ld hl,chan ; point to channel number + ld a,(chan) ; get current channel + inc a ; bump to next + ld (chan),a ; save it + cp 3 ; end of channels? + jr nz,chloop ; loop if not done +; + ld de,crlf ; newline + ld c,print ; BDOS print function + call bdos ; do it +; + ld sp,(stksav) ; restore stack +; + ret ; end of program +; +tstchan: + ; Display channel being tested + ld de,chmsg ; point to channel message + ld c,print ; BDOS print function number + call bdos ; do it + ld a,(chan) ; get current channel number + add a,'A' ; offset to print as alpha + ld e,a ; put in E + ld c,conwrt ; BDOS console out function number + call bdos ; do it + ld de,chmsg2 ; point to channel message + ld c,print ; BDOS print function number + call bdos ; do it +; + ld hl,0 ; initial pitch value + ld (pitch),hl ; save it +; + ; Setup mixer register + ld a,(chan) ; get channel num (0-2) + inc a ; adjust index (1-3) + ld b,a ; and use as loop counter + xor a ; clear accum + scf ; set carry +mixloop: + rla ; rotate bit + djnz mixloop ; loop based on channel num + cpl ; invert bits + and $FF ; so only target bit is cleared + push af ; save value + ld a,7 ; mixer register + out (rsel),a ; select it + pop af ; recover value + out (rdat),a ; and set register value +; + ; Set channel volume to max + ld a,(chan) ; get channel + add a,8 ; adjust for start of vol regs + out (rsel),a ; select register + ld a,$0F ; max volume + out (rdat),a ; write it +; +pitloop: + ; Pitch loop + ld a,(chan) ; get channel + sla a ; A := channel pitch reg, 2 bytes per chan + out (rsel),a ; select low byte register + push af ; save register + ld a,l ; get low byte of pitch value + out (rdat),a ; and write it to register + pop af ; recover register index + inc a ; inc to high byte pitch register + out (rsel),a ; select high byte register + ld a,h ; get high byte of pitch value + out (rdat),a ; and write it to register +; + ; Delay + ld b,cpuspd ; cpu speed scalar +dlyloop: + call dly64 ; arbitrary delay + djnz dlyloop ; loop based on cpu speed +; + ; Next pitch value + ld hl,(pitch) ; get current pitch + inc hl ; increment + ld (pitch),hl ; save new value + ld a,h ; get high byte + ;cp 16 ; end of max range? + cp 4 ; end of max range? + jr nz,pitloop ; loop till done +; + ; Clean up + call clrpsg ; shut down psg +; + ret ; done +; +; Clear PSG registers to default +; +clrpsg: + ld b,16 ; loop for 18 registers + ld c,0 ; init register index +clrpsg1: + ld a,c ; register num to accum + out (rsel),a ; select it + xor a ; clear accum + out (rdat),a ; and write to register + inc c ; next register + djnz clrpsg1 ; loop through all registers + ret ; return +; +; Program PSG registers from list at HL +; +setpsg: + ld a,(hl) ; get psg reg number + inc hl ; bump index + cp $FF ; check for end + ret z ; return if end marker $FF + out (rsel),a ; select psg register + ld a,(hl) ; get register value + inc hl ; bump index + out (rdat),a ; set register value + jr setpsg ; loop till done +; +; Short delay functions. No clock speed compensation, so they +; will run longer on slower systems. The number indicates the +; number of call/ret invocations. A single call/ret is +; 27 t-states on a z80, 25 t-states on a z180 +; +dly256: call dly128 +dly128: call dly64 +dly64: call dly32 +dly32: call dly16 +dly16: call dly8 +dly8: call dly4 +dly4: call dly2 +dly2: call dly1 +dly1: ret +; +;============================================================================= +; Data Section +;============================================================================= +; +chan .db 0 ; active audio channel +pitch .dw 0 ; current pitch +; +banner .text "\r\nRetroBrew Computers SCG AY-3-8910 Sound Test\r\n" + .text "Set SCG board base I/O address to 0x98\r\n$" +chmsg .text "\r\nPlaying descending tones on channel $" +chmsg2 .text "...$" +crlf .text "\r\n$" +; +stksav .dw 0 ; saved stack frame + .fill 80,$FF ; 40 level private stack +stack .equ $ ; start of stack +; + .end \ No newline at end of file diff --git a/Source/Apps/Test/tstdskng/Build.cmd b/Source/Apps/Test/tstdskng/Build.cmd new file mode 100644 index 00000000..a56e8dbc --- /dev/null +++ b/Source/Apps/Test/tstdskng/Build.cmd @@ -0,0 +1,11 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF tstdskng.asm tstdskng.com tstdskng.lst || exit /b + +copy /Y tstdskng.com ..\..\..\..\Binary\Apps\Test\ || exit /b + diff --git a/Source/Apps/Test/tstdskng/Clean.cmd b/Source/Apps/Test/tstdskng/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/tstdskng/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/tstdskng/Makefile b/Source/Apps/Test/tstdskng/Makefile new file mode 100644 index 00000000..c32a43eb --- /dev/null +++ b/Source/Apps/Test/tstdskng/Makefile @@ -0,0 +1,7 @@ +OBJECTS = tstdskng.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/Test/tstdskng/tstdskng.asm b/Source/Apps/Test/tstdskng/tstdskng.asm new file mode 100644 index 00000000..2bc94322 --- /dev/null +++ b/Source/Apps/Test/tstdskng/tstdskng.asm @@ -0,0 +1,1188 @@ +; +;================================================================================================== +; DSKY NEXT GENERATION TEST APPLICATION +;================================================================================================== +; +; TO BUILD: +; +; TASM -t80 -g3 -fFF TSTDSKNG.ASM TSTDSKNG.COM TSTDSKNG.LST +; +; PIO 82C55 I/O IS DECODED TO PORT $60-$67 (ADJUST BELOW AS NEEDED) +; ASSUMES UART AT PORT $68 (ADJUST BELOW AS NEEDED) +; +; THIS CODE IS BELIEVED TO BE COMPATIBLE WITH PPIDE OR PPISD +; RUNNING ON SAME PPI BUS. +; +FALSE: .EQU 0 +TRUE: .EQU !FALSE +; +DSKY_OSC: .EQU 3000000 ; OSCILLATOR FREQ IN HZ +; +BDOS: .EQU TRUE ; BDOS OR DIRECT TO 8250ISH +DSKY_PROTO: .EQU FALSE ; SET FOR DSKYNG PROTOTYPE +; +UART_BASE: .EQU $68 ; UART BASE IO ADDRESS +PPI_BASE_DEF: .EQU $60 ; PPI BASE IO PORT +; +; LED SEGMENTS (BIT VALUES) +; +; +--01--+ +; 20 02 +; +--40--+ +; 10 04 +; +--08--+ 80 +; +; KEY CODE MAP (KEY CODES) CSCCCRRR +; |||||||| +; |||||+++-- ROW +; ||+++----- COL +; |+-------- SHIFT +; +--------- CONTROL +; +; 00 08 10 18 23 +; 01 09 11 19 22 +; 02 0A 12 1A 21 +; 03 0B 13 1B 20 +; 04 0C 14 1C SHIFT +; 05 0D 15 1D CONTROL +; +; LED BIT MAP (BIT VALUES) +; +; $08 $09 $0A $0B $0C +; --- --- --- --- --- +; 01 01 01 01 01 +; 02 02 02 02 02 +; 04 04 04 04 04 +; 08 08 08 08 08 +; 10 10 10 10 10 +; 20 20 20 20 20 +; +PPIA: .EQU 0 ; PORT A OFFSET +PPIB: .EQU 1 ; PORT B OFFSET +PPIC: .EQU 2 ; PORT C OFFSET +PPIX: .EQU 3 ; PIO CONTROL PORT OFFSET +; +DSKY_PPIX_RD: .EQU %10010010 ; PPIX VALUE FOR READS +DSKY_PPIX_WR: .EQU %10000010 ; PPIX VALUE FOR WRITES +; +; PIO CHANNEL C: +; +; 7 6 5 4 3 2 1 0 +; RES 0 0 CS CS /RD /WR A0 +; +; SETTING BITS 3 & 4 WILL ASSERT /CS ON 3279 +; CLEAR BITS 1 OR 2 TO ASSERT READ/WRITE +; +; +#IF (DSKY_PROTO) +; +DSKY_PPI_IDLE: .EQU %01100000 +; +DSKY_RDBIT .EQU 6 +DSKY_WRBIT .EQU 5 +; +#ELSE +; +DSKY_PPI_IDLE: .EQU %00000110 +; +DSKY_RDBIT .EQU 2 +DSKY_WRBIT .EQU 1 +; +#ENDIF +; +DSKY_CMD_CLR: .EQU %11011111 ; CLEAR (ALL OFF) +DSKY_CMD_CLRX: .EQU %11010011 ; CLEAR (ALL ON) +DSKY_CMD_WDSP: .EQU %10010000 ; WRITE DISPLAY RAM +DSKY_CMD_RDSP: .EQU %01110000 ; READ DISPLAY RAM +DSKY_CMD_CLK: .EQU %00100000 ; SET CLK PRESCALE +DSKY_CMD_FIFO: .EQU %01000000 ; READ FIFO +; +DSKY_PRESCL: .EQU DSKY_OSC / 100000 ; PRESCALER +; + .ORG $100 +; + ; SAVE PREVIOUS STACK POINTER, AND SWITCH TO OUR STACK + LD (STACKSAV),SP + LD SP,STACK +; + CALL PRTSTRD + .DB "\r\nNextGenDSKY$" +; +#IF (DSKY_PROTO) + CALL PRTSTRD + .DB " Prototype$" +#ENDIF +; + CALL PRTSTRD + .DB " Test Program, v1.4a, 2021-07-18$" +; + CALL GET_BASE + JP NZ,EXIT +; + CALL PRTSTRD + .DB "\r\nDSKYng PPI base port: 0x$" + LD A,(PPI_BASE) + CALL PRTHEXBYTE + CALL NEWLINE +; + CALL DSKY_INIT + CALL DSKY_READ +; + CALL PRTSTRD + .DB "\r\nCLEAR Command (all ON)$" + LD A,DSKY_CMD_CLRX + CALL DSKY_CMD + CALL WAITKEY + CALL DSKY_READ +; + CALL PRTSTRD + .DB "\r\nCLEAR Command (all OFF)$" + LD A,DSKY_CMD_CLR + CALL DSKY_CMD + CALL WAITKEY + CALL DSKY_READ +; + CALL PRTSTRD + .DB "\r\nIndividual segments and LEDs$" + LD HL,PAT1 + LD B,PAT1LN + LD C,0 + CALL DSKY_PUTSTR + CALL WAITKEY + CALL DSKY_READ +; + CALL PRTSTRD + .DB "\r\nIncrementing segments and LEDs$" + LD HL,PAT2 + LD B,PAT2LN + LD C,0 + CALL DSKY_PUTSTR + CALL WAITKEY + CALL DSKY_READ +; + CALL PRTSTRD + .DB "\r\nOmit individual segments and LEDs$" + LD HL,PAT3 + LD B,PAT3LN + LD C,0 + CALL DSKY_PUTSTR + CALL WAITKEY + CALL DSKY_READ +; + ; DISPLAY HEX DIGITS 0-7 +; + CALL PRTSTRD + .DB "\r\nHex digits 0-7$" + LD HL,HEX1 + LD B,HEX1LN + LD C,0 + CALL DSKY_PUTENCSTR + CALL WAITKEY + CALL DSKY_READ +; + CALL PRTSTRD + .DB "\r\nHex digits 8-F$" + LD HL,HEX2 + LD B,HEX2LN + LD C,0 + CALL DSKY_PUTENCSTR + CALL WAITKEY + CALL DSKY_READ +; + CALL DSKY_BLANK +; + ; WAIT FOR KEY THEN DISPLAY FIFO CONTENTS + CALL PRTSTRD + .DB "\r\nPress keys on pad (console key to end)...$" +; + ; CLEAR BUFFER + LD HL,DSPBUF + LD A,$10 + LD B,8 +M1: + LD (HL),A + INC HL + DJNZ M1 +; + ; DISPLAY INIITAL BUFFER + LD B,8 + LD C,0 + LD HL,DSPBUF + CALL DSKY_PUTENCSTR +; +M2: + CALL CST ; CONSOLE STATUS + JP NZ,M4 ; ABORT IF KEY PRESSED + CALL DSKY_STAT + AND $3F ; DUMP 2 HIGH BITS + JR Z,M2 ; LOOP IF STATUS ZERO + CALL PRTSTRD + .DB "\r\nFIFO status=$" + CALL PRTHEXBYTE + AND $0F ; ISOLATE THE CUR FIFO LEN + JR Z,M2 ; LOOP IF NOTHING THERE + PUSH AF + LD A,DSKY_CMD_FIFO + CALL DSKY_CMD + POP BC ; B := CUR FIFO LEN + CALL PRTSTRD + .DB ", key code(s)=$" + +M3: + PUSH BC + CALL DSKY_DIN + XOR %11000000 ; FLIP CONTROL & SHIFT MODIFIERS + CALL PRTHEXBYTE + CALL PC_SPACE + ; SHIFT BUFFER + LD HL,DSPBUF+5 + LD DE,DSPBUF+7 + LD BC,6 + LDDR + ; PUT NEW VALUE AT START + PUSH AF + RRCA + RRCA + RRCA + RRCA + AND $0F + LD (DSPBUF),A + POP AF + PUSH AF + AND $0F + LD (DSPBUF+1),A + ; UPDATE THE DISPLAY + LD B,8 + LD C,0 + LD HL,DSPBUF + CALL DSKY_PUTENCSTR + POP AF + ; TOGGLE LED, KEY CODE: CSCCCRRR + PUSH AF + AND $07 ; ISOLATE ROW + LD B,A ; SAVE IN B + POP AF + RRCA + RRCA + RRCA + AND $07 ; ISOLATE COLUMN + LD C,A ; SAVE IN C + CALL DSKY_TOGLED ; TOGGLE LED AT ROW/COL + POP BC ; INSIDE LOOP COUNTER + DJNZ M3 + JP M2 ; LOOP +M4: + CALL CIN ; DUMP PENDING CONSOLE KEY +; + ; DANCING LIGHTS + CALL PRTSTRD + .DB "\r\nDance, Baby, Dance (console key to end)...$" + + LD A,DSKY_CMD_CLR + CALL DSKY_CMD +; + + + + LD E,$01 ; STARTING VALUE +M5: + CALL CST ; CONSOLE STATUS + JR NZ,M8 ; ABORT IF KEY PRESSED + LD B,16 ; NUMBER OF BYTES + LD C,$00 ; STARTING LOCATION (BYTE) +M6: + LD A,E + CALL DSKY_PUTBYTE + INC C ; NEXT LOCATION + DJNZ M6 ; INNER LOOP FOR ALL BYTES + RLC E ; ROTATE THE VALUE + LD B,0 ; DELAY LOOP +M7: + CALL DLY64 + DJNZ M7 + JR M5 ; REPEAT OUTER LOOP +M8: + CALL CIN ; DUMP PENDING CONSOLE KEY +; + ; CLEAR ALL + LD A,DSKY_CMD_CLR + CALL DSKY_CMD +; +EXIT: + ; GOODBYE + CALL PRTSTRD + .DB "\r\nThank you, please call again\r\n$" +; + ; CLEAN UP AND RETURN TO OS + LD SP,(STACKSAV) +; + RET +; +; SETUP PPI FOR WRITING: PUT PPI PORT A IN OUTPUT MODE +; AVOID REWRTING PPIX IF ALREADY IN OUTPUT MODE +; +DSKY_PPIWR: + PUSH AF + PUSH BC +; + LD A,(PPI_BASE) + ADD A,PPIX + LD C,A +; + ; CHECK FOR WRITE MODE + LD A,(PPIX_VAL) + CP DSKY_PPIX_WR + JR Z,DSKY_PPIWR1 +; + ; SET PPI TO WRITE MODE + LD A,DSKY_PPIX_WR + OUT (C),A + LD (PPIX_VAL),A +; + ; RESTORE PORT C (MAY NOT BE NEEDED) + LD A,DSKY_PPI_IDLE + DEC C + OUT (C),A +; +DSKY_PPIWR1: +; + POP BC + POP AF + RET +; +; SETUP PPI FOR READING: PUT PPI PORT A IN INPUT MODE +; AVOID REWRTING PPIX IF ALREADY IN INPUT MODE +; +DSKY_PPIRD: + PUSH AF + PUSH BC +; + LD A,(PPI_BASE) + ADD A,PPIX + LD C,A +; + ; CHECK FOR READ MODE + LD A,(PPIX_VAL) + CP DSKY_PPIX_RD + JR Z,DSKY_PPIRD1 +; + ; SET PPI TO READ MODE + LD A,DSKY_PPIX_RD + OUT (C),A + LD (PPIX_VAL),A +; + ; RESTORE PORT C (MAY NOT BE NEEDED) + LD A,DSKY_PPI_IDLE + DEC C + OUT (C),A +; +DSKY_PPIRD1: + POP BC + POP AF + RET +; +; RELEASE USE OF PPI +; +DSKY_PPIIDLE: + JR DSKY_PPIRD ; SAME AS READ MODE +; +; +; +DSKY_INIT: + ; RESET DSKY + CALL DSKY_RES + ; SET CLOCK SCALER TO 20 + LD A,DSKY_CMD_CLK | DSKY_PRESCL + CALL DSKY_CMD + LD A,%00001000 ; dan + CALL DSKY_CMD +; + RET +; +; HARDWARE RESET 8279 BY PULSING RESET LINE +; +DSKY_RES: +; + PUSH BC + LD A,(PPI_BASE) + ADD A,PPIC + LD C,A + ; SETUP PPI + CALL DSKY_PPIRD + ; INIT 8279 VALUES TO IDLE STATE + LD A,DSKY_PPI_IDLE + OUT (C),A + ; PULSE RESET SIGNAL ON 8279 + SET 7,A + OUT (C),A + RES 7,A + OUT (C),A + ; DONE + CALL DSKY_PPIIDLE + POP BC + RET +; +; COMMAND IN A +; TRASHES BC +; +DSKY_CMD: + LD B,$01 + JR DSKY_DOUT2 +; +; DATA VALUE IN A +; TRASHES BC +; +DSKY_DOUT: + LD B,$00 +; +DSKY_DOUT2: +; + ; SAVE INCOMING DATA BYTE + PUSH AF +; + ; SET PPI LINE CONFIG TO WRITE MODE + CALL DSKY_PPIWR +; + ; SETUP + LD A,(PPI_BASE) + ADD A,PPIC + LD C,A +; + ; SET ADDRESS FIRST + LD A,DSKY_PPI_IDLE + OR B + OUT (C),A +; + ; ASSERT 8279 /CS + SET 3,A + SET 4,A + OUT (C),A +; + ; PPIC WORKING VALUE TO REG B NOW + LD B,A +; + ; ASSERT DATA BYTE VALUE + DEC C + DEC C + POP AF + OUT (C),A + INC C + INC C +; + ; PULSE /WR + RES DSKY_WRBIT,B + OUT (C),B + NOP ; MAY NOT BE NEEDED + SET DSKY_WRBIT,B + OUT (C),B +; + ; DEASSERT /CS + RES 3,B + RES 4,B + OUT (C),B +; + ; CLEAR ADDRESS BIT + RES 0,B + OUT (C),B +; + ; DONE + CALL DSKY_PPIIDLE + RET +; +; STATUS VALUE IN A +; TRASHES BC +; +DSKY_STAT: + LD B,$01 + JR DSKY_DIN2 +; +; DATA VALUE RETURNED IN A +; TRASHES BC +; +DSKY_DIN: + LD B,$00 +; +DSKY_DIN2: + ; SET PPI LINE CONFIG TO WRITE MODE + CALL DSKY_PPIRD +; + ; SETUP + LD A,(PPI_BASE) + ADD A,PPIC + LD C,A +; + ; SET ADDRESS FIRST + LD A,DSKY_PPI_IDLE + OR B + OUT (C),A +; + ; ASSERT 8279 /CS + SET 3,A + SET 4,A + OUT (C),A +; + ; PPIC WORKING VALUE TO REG B NOW + LD B,A +; + ; ASSERT /RD + RES DSKY_RDBIT,B + OUT (C),B +; + ; GET VALUE + DEC C + DEC C + IN A,(C) + INC C + INC C +; + ; DEASSERT /RD + SET DSKY_RDBIT,B + OUT (C),B +; + ; DEASSERT /CS + RES 3,B + RES 4,B + OUT (C),B +; + ; CLEAR ADDRESS BIT + RES 0,B + OUT (C),B +; + ; DONE + CALL DSKY_PPIIDLE + RET +; +; BLANK THE DISPLAY (WITHOUT USING CLEAR) +; +DSKY_BLANK: + LD A,DSKY_CMD_WDSP + CALL DSKY_CMD + LD B,16 +DSKY_BLANK1: + PUSH BC + LD A,$FF + CALL DSKY_DOUT + POP BC + DJNZ DSKY_BLANK1 + RET +; +; WRITE A RAW BYTE VALUE TO DSKY DISPLAY RAM +; AT LOCATION IN REGISTER C, VALUE IN A. +; +DSKY_PUTBYTE: + PUSH BC + PUSH AF + LD A,C + ADD A,DSKY_CMD_WDSP + CALL DSKY_CMD + POP AF + XOR $FF + CALL DSKY_DOUT + POP BC + RET +; +; READ A RAW BYTE VALUE FROM DSKY DISPLAY RAM +; AT LOCATION IN REGISTER C, VALUE RETURNED IN A +; +DSKY_GETBYTE: + PUSH BC + LD A,C + ADD A,DSKY_CMD_RDSP + CALL DSKY_CMD + CALL DSKY_DIN + XOR $FF + POP BC + RET +; +; WRITE A STRING OF RAW BYTE VALUES TO DSKY DISPLAY RAM +; AT LOCATION IN REGISTER C, LENGTH IN B, ADDRESS IN HL. +; +DSKY_PUTSTR: + PUSH BC + LD A,C + ADD A,DSKY_CMD_WDSP + CALL DSKY_CMD + POP BC +; +DSKY_PUTSTR1: + LD A,(HL) + XOR $FF + INC HL + PUSH BC + CALL DSKY_DOUT + POP BC + DJNZ DSKY_PUTSTR1 + RET +; +; READ A STRING OF RAW BYTE VALUES FROM DSKY DISPLAY RAM +; AT LOCATION IN REGISTER C, LENGTH IN B, ADDRESS IN HL. +; +DSKY_GETSTR: + PUSH BC + LD A,C + ADD A,DSKY_CMD_RDSP + CALL DSKY_CMD + POP BC +; +DSKY_GETSTR1: + PUSH BC + CALL DSKY_DIN + POP BC + XOR $FF + LD (HL),A + INC HL + DJNZ DSKY_GETSTR1 + RET +; +; HL IS ADR OF ENCODED STRING OF BYTES +; B IS LEN OF STRING (BYTES) +; C IS POSITION IN DISPLAY RAM TO WRITE +; +DSKY_PUTENCSTR: + PUSH BC + LD A,C + ADD A,DSKY_CMD_WDSP + CALL DSKY_CMD + POP BC + EX DE,HL +DSKY_PUTENCSTR1: + LD A,(DE) + INC DE + LD HL,HEXMAP + CALL ADDHLA + LD A,(HL) + XOR $FF + PUSH BC + CALL DSKY_DOUT + POP BC + DJNZ DSKY_PUTENCSTR1 + RET +; +; TOGGLE LED AT ROW (B) AND COLUMN (C) +; +DSKY_TOGLED: + ; CONVERT B (ROW) TO BIT VALUE + XOR A + INC B + SCF +DSKY_TOGLED1: + RLA + DJNZ DSKY_TOGLED1 + LD B,A + ; LED COLS START AT 8 + LD A,8 + ADD A,C + LD C,A + ; FLIP THE BIT + CALL DSKY_GETBYTE ; GET CURRENT COL BITMAP + XOR B ; FLIP DESIRED BIT + CALL DSKY_PUTBYTE ; WRITE VLAUE BACK TO COLUMN + RET +; +; READ AND PRINT DISPLAY RAM (RAW BYTES) +; +DSKY_READ: + CALL PRTSTRD + .DB "\r\nRead display RAM: $" + LD B,16 ; 16 BYTES + LD C,0 ; POSITION 0 + LD HL,DSPBUF + CALL DSKY_GETSTR + LD B,$10 + LD HL,DSPBUF +DSKY_READ1: + LD A,(HL) + INC HL + CALL PC_SPACE + CALL PRTHEXBYTE + DJNZ DSKY_READ1 + RET +; +; +; +GET_BASE: + CALL PRTSTRD + .DB "\r\nDSKYng PPI base port [0x$" + LD A,(PPI_BASE) + CALL PRTHEXBYTE + CALL PRTSTRD + .DB "]: $" + LD A,(PPI_BASE) + CALL GETHEXBYTE + JR C,GET_BASE1 + LD (PPI_BASE),A + XOR A + RET +; +GET_BASE1: + CALL PRTSTRD + .DB "\r\nInvalid DSKYng PPI base port value!$" + JR GET_BASE +; +; OUTPUT CHARACTER FROM A +; +COUT: + PUSH AF ; + PUSH BC ; + PUSH DE ; + PUSH HL ; + +#IF (BDOS) + LD C,2 ; BDOS FUNC: CONSOLE OUTPUT + LD E,A ; CHARACTER TO E + CALL $0005 ; CALL BDOS +#ELSE + LD C,A +COUT1: + IN A,(UART_BASE + 05H) ; READ LINE STATUS REGISTER + AND 20H ; TEST IF UART IS READY TO SEND + JP Z,COUT1 ; IF NOT REPEAT + LD A,C ; GET TO ACCUMULATOR + OUT (UART_BASE),A ; THEN WRITE THE CHAR TO UART (UART0 = 068h + $00) +#ENDIF + + POP HL ; + POP DE ; + POP BC ; + POP AF ; + RET ; DONE +; +; INPUT CHARACTER TO A +; +CIN: + PUSH BC ; + PUSH DE ; + PUSH HL ; +#IF BDOS +CIN1: + LD C,6 ; BDOS FUNC: DIRECT CONSOLE I/O + LD E,$FF ; SET FOR INPUT + CALL $0005 ; CALL BDOS, CHARACTER TO A + OR A ; CHECK FOR NO CHAR, $00 + JR Z,CIN1 ; LOOP TIL WE GET A CHAR +#ELSE +CIN1: + CALL CST ; IS A CHAR READY TO BE READ FROM UART? + CP 00H ; + JP Z,CIN1 ; NO? TRY AGAIN + IN A,(UART_BASE) ; YES? READ THE CHAR FROM THE UART (UART0 = 068h + $00) +#ENDIF + POP HL ; + POP DE ; + POP BC ; + RET ; DONE +; +; RETURN INPUT STATUS IN A (0 = NO CHAR, !=0 CHAR WAITING) +; +CST: + PUSH BC ; + PUSH DE ; + PUSH HL ; +#IF BDOS + LD C,$0B ; BDOS FUNC: GET CONSOLE STATUS + CALL $0005 ; CALL BDOS + OR A ; SET FLAGS +#ELSE + ; CONSOLE STATUS, RETURN 0FFH IF CHARACTER READY, 00H IF NOT + IN A,(UART_BASE + 05H) ; READ LINE STATUS REGISTER (UART5 = 068h + $05) + AND 01H ; TEST IF DATA IN RECEIVE BUFFER + ; IS THERE A CHAR READY? 0=NO, 1=YES + JP Z,CST1 ; + LD A,0FFH ; YES, PUT 0FFh IN A AND RETURN +CST1: ; + ; NO, LEAVE 000h IN A AND RETURN +#ENDIF + POP HL ; + POP DE ; + POP BC ; + RET ; DONE +; +; WAIT FOR A KEY +; +WAITKEY: + PUSH AF + CALL PRTSTRD + .DB ", press a key to continue...$" + CALL CIN + CP $1B + JP Z,EXIT + POP AF + RET +; +;================================================================================================== +; UTILITY FUNCTIONS +;================================================================================================== +; +; +CHR_BEL: .EQU 07H +CHR_CR: .EQU 0DH +CHR_LF: .EQU 0AH +CHR_BS: .EQU 08H +CHR_ESC: .EQU 1BH +; +;__________________________________________________________________________________________________ +; +; UTILITY PROCS TO PRINT SINGLE CHARACTERS WITHOUT TRASHING ANY REGISTERS +; +PC_SPACE: + PUSH AF + LD A,' ' + JR PC_PRTCHR + +PC_PERIOD: + PUSH AF + LD A,'.' + JR PC_PRTCHR + +PC_COLON: + PUSH AF + LD A,':' + JR PC_PRTCHR + +PC_COMMA: + PUSH AF + LD A,',' + JR PC_PRTCHR + +PC_LBKT: + PUSH AF + LD A,'[' + JR PC_PRTCHR + +PC_RBKT: + PUSH AF + LD A,']' + JR PC_PRTCHR + +PC_LT: + PUSH AF + LD A,'<' + JR PC_PRTCHR + +PC_GT: + PUSH AF + LD A,'>' + JR PC_PRTCHR + +PC_LPAREN: + PUSH AF + LD A,'(' + JR PC_PRTCHR + +PC_RPAREN: + PUSH AF + LD A,')' + JR PC_PRTCHR + +PC_ASTERISK: + PUSH AF + LD A,'*' + JR PC_PRTCHR + +PC_CR: + PUSH AF + LD A,CHR_CR + JR PC_PRTCHR + +PC_LF: + PUSH AF + LD A,CHR_LF + JR PC_PRTCHR + +PC_PRTCHR: + CALL COUT + POP AF + RET + +NEWLINE2: + CALL NEWLINE +NEWLINE: + CALL PC_CR + CALL PC_LF + RET +; +; PRINT A CHARACTER REFERENCED BY POINTER AT TOP OF STACK +; USAGE: +; CALL PRTCH +; DB 'X' +; +PRTCH: + EX (SP),HL + PUSH AF + LD A,(HL) + CALL COUT + POP AF + INC HL + EX (SP),HL + RET +; +; PRINT A STRING AT ADDRESS SPECIFIED IN HL +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; LD HL,MYSTR +; CALL PRTSTR +; ... +; MYSTR: DB "HELLO$" +; +PRTSTR: + LD A,(HL) + INC HL + CP '$' + RET Z + CALL COUT + JR PRTSTR +; +; PRINT A STRING DIRECT: REFERENCED BY POINTER AT TOP OF STACK +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; CALL PRTSTRD +; DB "HELLO$" +; ... +; +PRTSTRD: + EX (SP),HL + PUSH AF + CALL PRTSTR + POP AF + EX (SP),HL + RET +; +; PRINT A STRING INDIRECT: REFERENCED BY INDIRECT POINTER AT TOP OF STACK +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; CALL PRTSTRI(MYSTRING) +; MYSTRING DB "HELLO$" +; +PRTSTRI: + EX (SP),HL + PUSH AF + LD A,(HL) + INC HL + PUSH HL + LD H,(HL) + LD L,A + CALL PRTSTR + POP HL + INC HL + POP AF + EX (SP),HL + RET +; +; PRINT THE HEX BYTE VALUE IN A +; +PRTHEXBYTE: + PUSH AF + PUSH DE + CALL HEXASCII + LD A,D + CALL COUT + LD A,E + CALL COUT + POP DE + POP AF + RET +; +; PRINT THE HEX WORD VALUE IN BC +; +PRTHEXWORD: + PUSH AF + LD A,B + CALL PRTHEXBYTE + LD A,C + CALL PRTHEXBYTE + POP AF + RET +; +; PRINT THE HEX WORD VALUE IN HL +; +PRTHEXWORDHL: + PUSH AF + LD A,H + CALL PRTHEXBYTE + LD A,L + CALL PRTHEXBYTE + POP AF + RET +; +; CONVERT BINARY VALUE IN A TO ASCII HEX CHARACTERS IN DE +; +HEXASCII: + LD D,A + CALL HEXCONV + LD E,A + LD A,D + RLCA + RLCA + RLCA + RLCA + CALL HEXCONV + LD D,A + RET +; +; CONVERT LOW NIBBLE OF A TO ASCII HEX +; +HEXCONV: + AND 0FH ;LOW NIBBLE ONLY + ADD A,90H + DAA + ADC A,40H + DAA + RET +; +; +; +GETHEXBYTE: + PUSH AF ; SAVE INCOMING VALUE + LD C,0AH ; BDOS READ CONSOLE BUFFER + LD DE,CONBUF + CALL 5 ; GET EDITED STRING + CALL NEWLINE + POP DE ; RESTORE INCOMING TO D + + ; OK WE SHOULD NOW HAVE A STRING WITH A HEX NUMBER + LD HL,CONBUF + INC HL + LD A,(HL) ; GET CHARACTER COUNT + INC HL + CP 3 + JR C,GHB0 ; OK IF <= 2 CHARS + SCF ; SIGNAL ERROR + RET ; AND RETURN + +GHB0: + OR A ; SET FLAGS + JR NZ,GHB1 ; GOT CHARS, GO AHEAD + LD A,D ; RESTORE INCOMING VALUE + OR A ; SIGNAL SUCCESS + RET ; AND DONE + +GHB1: + LD B,A ; COUNT TO B + LD C,0 ; INITIAL VALUE + +GHB2: + LD A,(HL) ; GET NEXT CHAR + INC HL + CALL ISHEX + RET C ; ABORT ON NON-HEX CHAR + + ; OK WE ARE HERE WHEN WE HAVE A VALID CHARACTER (0-9,A-F,A-F) NEED TO CONVERT TO BINARY + ; CHARACTER IS STILL IN A + + CP 3AH ; TEST FOR 0-9 + JP M,GHB2C + CP 47H ; TEST FOR A-F + JP M,GHB2B + CP 67H ; TEST FOR A-F + JP M,GHB2A +GHB2A: SUB 20H ; CHARACTER IS A-F +GHB2B: SUB 07H ; CHARACTER IS A-F +GHB2C: SUB 30H ; CHARACTER IS 0-9 + + RLC C ; MULTIPLY CUR VALUE BY 16 + RLC C + RLC C + RLC C + ADD A,C ; ADD TO ACCUM + LD C,A ; PUT BACK IN C + + DJNZ GHB2 ; LOOP THRU ALL CHARS + + LD A,C ; INTO A FOR RETURN + OR A ; SIGNAL SUCCESS + RET ; DONE + +ISHEX: + CP 30H ; CHECK IF LESS THAN CHARACTER 0 + JP M,NOTHEX + CP 3AH ; CHECK FOR > 9 + JP M,ISHX1 ; OK, CHARACTER IS 1-9 + + CP 41H ; CHECK FOR CHARACTER LESS THAN A + JP M,NOTHEX + CP 47H ; CHECK FOR CHARACTERS > F + JP M,ISHX1 + + CP 61H ; CHECK FOR CHARACTERS < A + JP M,NOTHEX + + CP 67H ; CHECK FOR CHARACTER > F + JP M,ISHX1 +NOTHEX: + SCF ; SET CARRY TO INDICATE FAIL + RET + +ISHX1: + SCF + CCF + RET +; +; SHORT DELAY FUNCTIONS. NO CLOCK SPEED COMPENSATION, SO THEY +; WILL RUN LONGER ON SLOWER SYSTEMS. THE NUMBER INDICATES THE +; NUMBER OF CALL/RET INVOCATIONS. A SINGLE CALL/RET IS +; 27 T-STATES ON A Z80, 25 T-STATES ON A Z180 +; +; ; Z80 Z180 +; ; ---- ---- +DLY64: CALL DLY32 ; 1728 1600 +DLY32: CALL DLY16 ; 864 800 +DLY16: CALL DLY8 ; 432 400 +DLY8: CALL DLY4 ; 216 200 +DLY4: CALL DLY2 ; 108 100 +DLY2: CALL DLY1 ; 54 50 +DLY1: RET ; 27 25 +; +; ADD HL,A +; +; A REGISTER IS DESTROYED! +; +ADDHLA: + ADD A,L + LD L,A + RET NC + INC H + RET +; +; STORAGE +; +PPI_BASE: .DB PPI_BASE_DEF +; +CONBUF: .DB 8 ; MAXIMUM CHARS + .DB 0 ; COUNT + .FILL 8 ; SIZE OF BUFFER +; +PPIX_VAL: .DB 0 +; +DSPBUF: .FILL 16,0 +; +PAT1: .DB $01,$02,$04,$08,$10,$20,$40,$80 + .DB $11,$22,$44,$88,$00,$00,$00,$00 +PAT1LN: .EQU $ - PAT1 +PAT2: .DB $01,$03,$07,$0F,$1F,$3F,$7F,$FF + .DB $11,$33,$77,$FF,$00,$00,$00,$00 +PAT2LN: .EQU $ - PAT2 +PAT3: .DB $FE,$FD,$FB,$F7,$EF,$DF,$BF,$7F + .DB $77,$BB,$DD,$EE,$00,$00,$00,$00 +PAT3LN: .EQU $ - PAT3 +BLANK: .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 +BLNKLN: .EQU $ - BLANK +HEX1: .DB $0,$1,$2,$3,$4,$5,$6,$7 +HEX1LN: .EQU $ - HEX1 +HEX2: .DB $8,$9,$A,$B,$C,$D,$E,$F +HEX2LN: .EQU $ - HEX2 +; +HEXMAP: + ; '0' '1' '2' '3' '4' '5' '6' '7' + .DB $3F, $06, $5B, $4F, $66, $6D, $7D, $07 + ; '8' '9' 'A' 'B' 'C' 'D' 'E' 'F' + .DB $7F, $67, $77, $7C, $39, $5E, $79, $71 + ; + .DB $00 +; +STACKSAV: .DW 0 +STACKSIZ: .EQU $100 ; WE ARE A STACK PIG + .FILL STACKSIZ,0 +STACK: .EQU $ +; + .END diff --git a/Source/Apps/Test/vdctest/Build.cmd b/Source/Apps/Test/vdctest/Build.cmd new file mode 100644 index 00000000..814cb585 --- /dev/null +++ b/Source/Apps/Test/vdctest/Build.cmd @@ -0,0 +1,12 @@ +@echo off +setlocal + +set TOOLS=../../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF vdctest.asm vdctest.com vdctest.lst || exit /b +tasm -t180 -g3 -fFF vdconly.asm vdconly.com vdconly.lst || exit /b + +copy /Y vdctest.com ..\..\..\..\Binary\Apps\Test\ || exit /b +copy /Y vdconly.com ..\..\..\..\Binary\Apps\Test\ || exit /b diff --git a/Source/Apps/Test/vdctest/Clean.cmd b/Source/Apps/Test/vdctest/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/Test/vdctest/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/Test/vdctest/Makefile b/Source/Apps/Test/vdctest/Makefile new file mode 100644 index 00000000..c182b787 --- /dev/null +++ b/Source/Apps/Test/vdctest/Makefile @@ -0,0 +1,7 @@ +OBJECTS = vdctest.com vdconly.com +DEST = ../../../../Binary/Apps/Test +TOOLS =../../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/Test/vdctest/font.asm b/Source/Apps/Test/vdctest/font.asm new file mode 100644 index 00000000..67ce06ac --- /dev/null +++ b/Source/Apps/Test/vdctest/font.asm @@ -0,0 +1,1025 @@ +FONT: + .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 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$18,$18,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $33,$33,$CC,$CC,$33,$33,$CC,$CC + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $33,$99,$CC,$66,$33,$99,$CC,$66 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C0,$C0,$C0,$C0,$C0,$C0,$C0,$C0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $CC,$CC,$33,$33,$CC,$CC,$33,$33 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $03,$03,$03,$03,$03,$03,$03,$03 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$CC,$CC,$33,$33 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $CC,$99,$33,$66,$CC,$99,$33,$66 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $03,$03,$03,$03,$03,$03,$03,$03 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$1F,$1F,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$0F,$0F,$0F,$0F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$1F,$1F,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$F8,$F8,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$1F,$1F,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$FF,$FF,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$FF,$FF,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$F8,$F8,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C0,$C0,$C0,$C0,$C0,$C0,$C0,$C0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E0,$E0,$E0,$E0,$E0,$E0,$E0,$E0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $07,$07,$07,$07,$07,$07,$07,$07 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $01,$03,$06,$6C,$78,$70,$60,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$18,$00,$00,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$66,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$FF,$66,$FF,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$3E,$60,$3C,$06,$7C,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $62,$66,$0C,$18,$30,$66,$46,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$3C,$38,$67,$66,$3F,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $06,$0C,$18,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $0C,$18,$30,$30,$30,$18,$0C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $30,$18,$0C,$0C,$0C,$18,$30,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$66,$3C,$FF,$3C,$66,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$18,$18,$7E,$18,$18,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$18,$18,$30 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$7E,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$18,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$03,$06,$0C,$18,$30,$60,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$6E,$76,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$38,$18,$18,$18,$7E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$06,$0C,$30,$60,$7E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$06,$1C,$06,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $06,$0E,$1E,$66,$7F,$06,$06,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$60,$7C,$06,$06,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$60,$7C,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$66,$0C,$18,$18,$18,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$66,$3C,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$66,$3E,$06,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$18,$00,$00,$18,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$18,$00,$00,$18,$18,$30 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $0E,$18,$30,$60,$30,$18,$0E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$7E,$00,$7E,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $70,$18,$0C,$06,$0C,$18,$70,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$06,$0C,$18,$00,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$6E,$6E,$60,$62,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$3C,$66,$7E,$66,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7C,$66,$66,$7C,$66,$66,$7C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$60,$60,$60,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $78,$6C,$66,$66,$66,$6C,$78,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$60,$60,$78,$60,$60,$7E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$60,$60,$78,$60,$60,$60,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$60,$6E,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$66,$7E,$66,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$18,$18,$18,$18,$18,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $1E,$0C,$0C,$0C,$0C,$6C,$38,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$6C,$78,$70,$78,$6C,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $60,$60,$60,$60,$60,$60,$7E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $63,$77,$7F,$6B,$63,$63,$63,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$76,$7E,$7E,$6E,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$66,$66,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7C,$66,$66,$7C,$60,$60,$60,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$66,$66,$66,$3C,$0E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7C,$66,$66,$7C,$78,$6C,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$60,$3C,$06,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$18,$18,$18,$18,$18,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$66,$66,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$66,$66,$66,$3C,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $63,$63,$63,$6B,$7F,$77,$63,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$3C,$18,$3C,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$66,$3C,$18,$18,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$06,$0C,$18,$30,$60,$7E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$30,$30,$30,$30,$30,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $40,$60,$30,$18,$0C,$06,$02,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$0C,$0C,$0C,$0C,$0C,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$18,$24,$42,$42,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$30,$18,$0C,$04,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$3C,$06,$3E,$66,$3E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$60,$60,$7C,$66,$66,$7C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$3C,$60,$60,$60,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$06,$06,$3E,$66,$66,$3E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$3C,$66,$7E,$60,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$0E,$18,$3E,$18,$18,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$3E,$66,$66,$3E,$06,$7C + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$60,$60,$7C,$66,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$18,$00,$38,$18,$18,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$06,$00,$06,$06,$06,$06,$3C + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$60,$60,$6C,$78,$6C,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$38,$18,$18,$18,$18,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$66,$7F,$7F,$6B,$63,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$7C,$66,$66,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$3C,$66,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$7C,$66,$66,$7C,$60,$60 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$3E,$66,$66,$3E,$06,$06 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$7C,$66,$60,$60,$60,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$3E,$60,$3C,$06,$7C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$18,$7E,$18,$18,$18,$0E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$66,$66,$66,$66,$3E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$66,$66,$66,$3C,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$63,$6B,$7F,$3E,$36,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$66,$3C,$18,$3C,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$66,$66,$66,$3E,$0C,$78 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$7E,$0C,$18,$30,$7E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$0C,$10,$10,$20,$10,$10,$0C + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$18,$18,$18,$18,$18,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$18,$04,$04,$02,$04,$04,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$32,$4C,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$81,$81,$81,$81,$81,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F0,$F0,$F0,$F0,$0F,$0F,$0F,$0F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$91,$91,$9F,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$C3,$F9,$C1,$99,$C1,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$9F,$9F,$83,$99,$99,$83,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$C3,$9F,$9F,$9F,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$F9,$F9,$C1,$99,$99,$C1,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$C3,$99,$81,$9F,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$F1,$E7,$C1,$E7,$E7,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$C1,$99,$99,$C1,$F9,$83 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$9F,$9F,$83,$99,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$E7,$FF,$C7,$E7,$E7,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$F9,$FF,$F9,$F9,$F9,$F9,$C3 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$9F,$9F,$93,$87,$93,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$C7,$E7,$E7,$E7,$E7,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$99,$80,$80,$94,$9C,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$83,$99,$99,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$C3,$99,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$83,$99,$99,$83,$9F,$9F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$C1,$99,$99,$C1,$F9,$F9 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$83,$99,$9F,$9F,$9F,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$C1,$9F,$C3,$F9,$83,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$E7,$81,$E7,$E7,$E7,$F1,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$99,$99,$99,$99,$C1,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$99,$99,$99,$C3,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$9C,$94,$80,$C1,$C9,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$99,$C3,$E7,$C3,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$99,$99,$99,$C1,$F3,$87 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$81,$F3,$E7,$CF,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$CF,$CF,$CF,$CF,$CF,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F3,$ED,$CF,$83,$CF,$9D,$03,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$F3,$F3,$F3,$F3,$F3,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$E7,$C3,$81,$E7,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$EF,$CF,$80,$80,$CF,$EF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$E7,$FF,$FF,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$99,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$00,$99,$00,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$C1,$9F,$C3,$F9,$83,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $9D,$99,$F3,$E7,$CF,$99,$B9,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$C3,$C7,$98,$99,$C0,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F9,$F3,$E7,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F3,$E7,$CF,$CF,$CF,$E7,$F3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $CF,$E7,$F3,$F3,$F3,$E7,$CF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$99,$C3,$00,$C3,$99,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$E7,$E7,$81,$E7,$E7,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$E7,$E7,$CF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$81,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$E7,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FC,$F9,$F3,$E7,$CF,$9F,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$91,$89,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$C7,$E7,$E7,$E7,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$F9,$F3,$CF,$9F,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$F9,$E3,$F9,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F9,$F1,$E1,$99,$80,$F9,$F9,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$9F,$83,$F9,$F9,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$9F,$83,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$99,$F3,$E7,$E7,$E7,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$99,$C3,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$99,$C1,$F9,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$E7,$FF,$FF,$E7,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$E7,$FF,$FF,$E7,$E7,$CF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F1,$E7,$CF,$9F,$CF,$E7,$F1,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$81,$FF,$81,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $8F,$E7,$F3,$F9,$F3,$E7,$8F,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$F9,$F3,$E7,$FF,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$00,$00,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$C3,$99,$81,$99,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $83,$99,$99,$83,$99,$99,$83,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$9F,$9F,$9F,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $87,$93,$99,$99,$99,$93,$87,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$9F,$9F,$87,$9F,$9F,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$9F,$9F,$87,$9F,$9F,$9F,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$9F,$91,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$99,$81,$99,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$E7,$E7,$E7,$E7,$E7,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E1,$F3,$F3,$F3,$F3,$93,$C7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$93,$87,$8F,$87,$93,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $9F,$9F,$9F,$9F,$9F,$9F,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $9C,$88,$80,$94,$9C,$9C,$9C,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$89,$81,$81,$91,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$99,$99,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $83,$99,$99,$83,$9F,$9F,$9F,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$99,$99,$99,$C3,$F1,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $83,$99,$99,$83,$87,$93,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$9F,$C3,$F9,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$E7,$E7,$E7,$E7,$E7,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$99,$99,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$99,$99,$99,$C3,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $9C,$9C,$9C,$94,$80,$88,$9C,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$C3,$E7,$C3,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$99,$C3,$E7,$E7,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$F9,$F3,$E7,$CF,$9F,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$00,$00,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3F,$3F,$CF,$CF,$3F,$3F,$CF,$CF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$E7,$E7,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $CC,$CC,$33,$33,$CC,$CC,$33,$33 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $CC,$66,$33,$99,$CC,$66,$33,$99 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$FF,$FF,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3F,$3F,$3F,$3F,$3F,$3F,$3F,$3F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $33,$33,$CC,$CC,$33,$33,$CC,$CC + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FC,$FC,$FC,$FC,$FC,$FC,$FC,$FC + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$33,$33,$CC,$CC + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $33,$66,$CC,$99,$33,$66,$CC,$99 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FC,$FC,$FC,$FC,$FC,$FC,$FC,$FC + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$E0,$E0,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$F0,$F0,$F0,$F0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$E0,$E0,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$07,$07,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$FF,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$E0,$E0,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$00,$00,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$00,$00,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$07,$07,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3F,$3F,$3F,$3F,$3F,$3F,$3F,$3F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $1F,$1F,$1F,$1F,$1F,$1F,$1F,$1F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F8,$F8,$F8,$F8,$F8,$F8,$F8,$F8 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$FF,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FE,$FC,$F9,$93,$87,$8F,$9F,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$0F,$0F,$0F,$0F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$07,$07,$FF,$FF,$FF + .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 + .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 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$3C,$66,$7E,$66,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7C,$66,$66,$7C,$66,$66,$7C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$60,$60,$60,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $78,$6C,$66,$66,$66,$6C,$78,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$60,$60,$78,$60,$60,$7E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$60,$60,$78,$60,$60,$60,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$60,$6E,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$66,$7E,$66,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$18,$18,$18,$18,$18,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $1E,$0C,$0C,$0C,$0C,$6C,$38,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$6C,$78,$70,$78,$6C,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $60,$60,$60,$60,$60,$60,$7E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $63,$77,$7F,$6B,$63,$63,$63,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$76,$7E,$7E,$6E,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$66,$66,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7C,$66,$66,$7C,$60,$60,$60,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$66,$66,$66,$3C,$0E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7C,$66,$66,$7C,$78,$6C,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$60,$3C,$06,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$18,$18,$18,$18,$18,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$66,$66,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$66,$66,$66,$3C,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $63,$63,$63,$6B,$7F,$77,$63,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$3C,$18,$3C,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$66,$3C,$18,$18,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$06,$0C,$18,$30,$60,$7E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$30,$30,$30,$30,$30,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $0C,$12,$30,$7C,$30,$62,$FC,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$0C,$0C,$0C,$0C,$0C,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$18,$3C,$7E,$18,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$10,$30,$7F,$7F,$30,$10,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$18,$00,$00,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$66,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $66,$66,$FF,$66,$FF,$66,$66,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$3E,$60,$3C,$06,$7C,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $62,$66,$0C,$18,$30,$66,$46,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$3C,$38,$67,$66,$3F,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $06,$0C,$18,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $0C,$18,$30,$30,$30,$18,$0C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $30,$18,$0C,$0C,$0C,$18,$30,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$66,$3C,$FF,$3C,$66,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$18,$18,$7E,$18,$18,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$18,$18,$30 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$7E,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$18,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$03,$06,$0C,$18,$30,$60,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$6E,$76,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$38,$18,$18,$18,$7E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$06,$0C,$30,$60,$7E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$06,$1C,$06,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $06,$0E,$1E,$66,$7F,$06,$06,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$60,$7C,$06,$06,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$60,$7C,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $7E,$66,$0C,$18,$18,$18,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$66,$3C,$66,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$66,$3E,$06,$66,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$18,$00,$00,$18,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$18,$00,$00,$18,$18,$30 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $0E,$18,$30,$60,$30,$18,$0E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$7E,$00,$7E,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $70,$18,$0C,$06,$0C,$18,$70,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$66,$06,$0C,$18,$00,$18,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$FF,$FF,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $08,$1C,$3E,$7F,$7F,$1C,$3E,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$18,$18,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$FF,$FF,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$FF,$FF,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$FF,$FF,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$FF,$FF,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $30,$30,$30,$30,$30,$30,$30,$30 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$E0,$F0,$38,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$1C,$0F,$07,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$38,$F0,$E0,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C0,$C0,$C0,$C0,$C0,$C0,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C0,$E0,$70,$38,$1C,$0E,$07,$03 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $03,$07,$0E,$1C,$38,$70,$E0,$C0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$C0,$C0,$C0,$C0,$C0,$C0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$03,$03,$03,$03,$03,$03 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$3C,$7E,$7E,$7E,$7E,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$FF,$FF,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $36,$7F,$7F,$7F,$3E,$1C,$08,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $60,$60,$60,$60,$60,$60,$60,$60 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$07,$0F,$1C,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$E7,$7E,$3C,$3C,$7E,$E7,$C3 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$3C,$7E,$66,$66,$7E,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$66,$66,$18,$18,$3C,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $06,$06,$06,$06,$06,$06,$06,$06 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $08,$1C,$3E,$7F,$3E,$1C,$08,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .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 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$18,$18,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$03,$3E,$76,$36,$36,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$7F,$3F,$1F,$0F,$07,$03,$01 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C0,$C0,$C0,$C0,$C0,$C0,$C0,$C0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $CC,$CC,$33,$33,$CC,$CC,$33,$33 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $03,$03,$03,$03,$03,$03,$03,$03 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$CC,$CC,$33,$33 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FE,$FC,$F8,$F0,$E0,$C0,$80 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $03,$03,$03,$03,$03,$03,$03,$03 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$1F,$1F,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$0F,$0F,$0F,$0F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$1F,$1F,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$F8,$F8,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$1F,$1F,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$FF,$FF,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$FF,$FF,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$F8,$F8,$18,$18,$18 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C0,$C0,$C0,$C0,$C0,$C0,$C0,$C0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E0,$E0,$E0,$E0,$E0,$E0,$E0,$E0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $07,$07,$07,$07,$07,$07,$07,$07 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $03,$03,$03,$03,$03,$03,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$F0,$F0,$F0,$F0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $0F,$0F,$0F,$0F,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $18,$18,$18,$F8,$F8,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F0,$F0,$F0,$F0,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F0,$F0,$F0,$F0,$0F,$0F,$0F,$0F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$91,$91,$9F,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$C3,$99,$81,$99,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $83,$99,$99,$83,$99,$99,$83,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$9F,$9F,$9F,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $87,$93,$99,$99,$99,$93,$87,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$9F,$9F,$87,$9F,$9F,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$9F,$9F,$87,$9F,$9F,$9F,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$9F,$91,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$99,$81,$99,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$E7,$E7,$E7,$E7,$E7,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E1,$F3,$F3,$F3,$F3,$93,$C7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$93,$87,$8F,$87,$93,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $9F,$9F,$9F,$9F,$9F,$9F,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $9C,$88,$80,$94,$9C,$9C,$9C,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$89,$81,$81,$91,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$99,$99,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $83,$99,$99,$83,$9F,$9F,$9F,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$99,$99,$99,$C3,$F1,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $83,$99,$99,$83,$87,$93,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$9F,$C3,$F9,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$E7,$E7,$E7,$E7,$E7,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$99,$99,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$99,$99,$99,$C3,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $9C,$9C,$9C,$94,$80,$88,$9C,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$C3,$E7,$C3,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$99,$C3,$E7,$E7,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$F9,$F3,$E7,$CF,$9F,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$CF,$CF,$CF,$CF,$CF,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F3,$ED,$CF,$83,$CF,$9D,$03,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$F3,$F3,$F3,$F3,$F3,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$E7,$C3,$81,$E7,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$EF,$CF,$80,$80,$CF,$EF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$E7,$FF,$FF,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$99,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $99,$99,$00,$99,$00,$99,$99,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$C1,$9F,$C3,$F9,$83,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $9D,$99,$F3,$E7,$CF,$99,$B9,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$C3,$C7,$98,$99,$C0,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F9,$F3,$E7,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F3,$E7,$CF,$CF,$CF,$E7,$F3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $CF,$E7,$F3,$F3,$F3,$E7,$CF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$99,$C3,$00,$C3,$99,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$E7,$E7,$81,$E7,$E7,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$E7,$E7,$CF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$81,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$E7,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FC,$F9,$F3,$E7,$CF,$9F,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$91,$89,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$C7,$E7,$E7,$E7,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$F9,$F3,$CF,$9F,$81,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$F9,$E3,$F9,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F9,$F1,$E1,$99,$80,$F9,$F9,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$9F,$83,$F9,$F9,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$9F,$83,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $81,$99,$F3,$E7,$E7,$E7,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$99,$C3,$99,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$99,$C1,$F9,$99,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$E7,$FF,$FF,$E7,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$E7,$FF,$FF,$E7,$E7,$CF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F1,$E7,$CF,$9F,$CF,$E7,$F1,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$81,$FF,$81,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $8F,$E7,$F3,$F9,$F3,$E7,$8F,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C3,$99,$F9,$F3,$E7,$FF,$E7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$00,$00,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F7,$E3,$C1,$80,$80,$E3,$C1,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$E7,$E7,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$00,$00,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$00,$00,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$00,$00,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$00,$00,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $CF,$CF,$CF,$CF,$CF,$CF,$CF,$CF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F3,$F3,$F3,$F3,$F3,$F3,$F3,$F3 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$1F,$0F,$C7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E3,$F0,$F8,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$C7,$0F,$1F,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3F,$3F,$3F,$3F,$3F,$3F,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3F,$1F,$8F,$C7,$E3,$F1,$F8,$FC + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FC,$F8,$F1,$E3,$C7,$8F,$1F,$3F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$3F,$3F,$3F,$3F,$3F,$3F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$FC,$FC,$FC,$FC,$FC,$FC + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$C3,$81,$81,$81,$81,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$00,$00,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $C9,$80,$80,$80,$C1,$E3,$F7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $9F,$9F,$9F,$9F,$9F,$9F,$9F,$9F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$F8,$F0,$E3,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3C,$18,$81,$C3,$C3,$81,$18,$3C + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$C3,$81,$99,$99,$81,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$99,$99,$E7,$E7,$C3,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F9,$F9,$F9,$F9,$F9,$F9,$F9,$F9 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F7,$E3,$C1,$80,$C1,$E3,$F7,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$00,$00,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3F,$3F,$CF,$CF,$3F,$3F,$CF,$CF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$E7,$E7,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FC,$C1,$89,$C9,$C9,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$80,$C0,$E0,$F0,$F8,$FC,$FE + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$00,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$FF,$FF,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3F,$3F,$3F,$3F,$3F,$3F,$3F,$3F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $33,$33,$CC,$CC,$33,$33,$CC,$CC + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FC,$FC,$FC,$FC,$FC,$FC,$FC,$FC + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$33,$33,$CC,$CC + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$01,$03,$07,$0F,$1F,$3F,$7F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FC,$FC,$FC,$FC,$FC,$FC,$FC,$FC + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$E0,$E0,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$F0,$F0,$F0,$F0 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$E0,$E0,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$07,$07,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$FF,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$E0,$E0,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$00,$00,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$00,$00,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$07,$07,$E7,$E7,$E7 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $3F,$3F,$3F,$3F,$3F,$3F,$3F,$3F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $1F,$1F,$1F,$1F,$1F,$1F,$1F,$1F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F8,$F8,$F8,$F8,$F8,$F8,$F8,$F8 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$FF,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $00,$00,$00,$FF,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$FF,$00,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FC,$FC,$FC,$FC,$FC,$FC,$00,$00 + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $FF,$FF,$FF,$FF,$0F,$0F,$0F,$0F + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $F0,$F0,$F0,$F0,$FF,$FF,$FF,$FF + .DB $00,$00,$00,$00,$00,$00,$00,$00 + .DB $E7,$E7,$E7,$07,$07,$FF,$FF,$FF + .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 diff --git a/Source/Apps/Test/vdctest/vdconly.asm b/Source/Apps/Test/vdctest/vdconly.asm new file mode 100644 index 00000000..6f7b54ca --- /dev/null +++ b/Source/Apps/Test/vdctest/vdconly.asm @@ -0,0 +1,1055 @@ +;__CVDUTEST________________________________________________________________________________________ +; +; CVDUTEST COLOR VDU TEST +; +; WRITTEN BY: DAN WERNER -- 11/4/2011 +;__________________________________________________________________________________________________ +; + +; DATA CONSTANTS +;__________________________________________________________________________________________________ +;IDE REGISTER IO PORT ; FUNCTION +M8563Status .EQU $E4 +M8563Register .EQU $E4 +M8563Data .EQU $E5 + +I8242Status .EQU $E3 +I8242Command .EQU $E3 +I8242Data .EQU $E2 + + + .ORG $0100 +;__________________________________________________________________________________________________ +; MAIN PROGRAM BEGINS HERE +;__________________________________________________________________________________________________ +INITVDU: + CALL VDU_INIT ; INIT VDU +; CALL KB_INITIALIZE ; INIT KB + + CALL DSPMATRIX ; DISPLAY INIT MATRIX SCREEN +; CALL WAIT_KBHIT ; WAIT FOR A KEYSTROKE + +LOOP1: +; CALL GET_KEY + LD A,27 ; SIMULATE KEYSTROKE TO END PROGRAM + + LD C,14 + CP 13 + JP Z,LOOP2 + CP 27 + JP Z,LOOP3 + CP '6' + JP Z,LOOP4 + CALL VDU_PutChar ; DUMP CHAR TO DISPLAY + JP LOOP1 +LOOP2: + LD A,0 ; YES, WRAP TO NEXT LINE + LD (TERM_X),A ; STORE X + LD A,(TERM_Y) ; A= Y COORD + INC A ; INC Y COORD + LD (TERM_Y),A ; STORE Y + CALL GOTO_XY ; YES, HANDLE SCROLLING + JP LOOP1 +LOOP3: + LD C,00H ; CP/M SYSTEM RESET CALL + CALL 0005H ; RETURN TO PROMPT + RET +LOOP4: + CALL REVERSE_SCROLL + JP LOOP1 + + +;__DO_SCROLL_______________________________________________________________________________________ +; +; SCROLL THE SCREEN UP ONE LINE +;__________________________________________________________________________________________________ +DO_SCROLL: + PUSH AF ; STORE AF +DO_SCROLLE1: + PUSH HL ; STORE HL + PUSH BC ; STORE BC + + LD B, 24 ; GET REGISTER 24 + CALL VDU_GREG ; + OR 80H ; TURN ON COPY BIT + LD D,A ; PARK IT + + LD HL, (VDU_DISPLAY_START) ; GET UP START OF DISPLAY + LD E,23 ; +DO_SCROLL1: + LD B, 18 ; SET UPDATE(DEST) POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE(DEST) POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD BC,0050H ; + ADD HL,BC ; + LD B, 32 ; SET SOURCE POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 33 ; SET SOURCE POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B, 24 ; SET COPY + LD A,D ; + CALL VDU_WREG ; WRITE IT + + LD B, 30 ; SET AMOUNT TO COPY + LD A,050H ; + CALL VDU_WREG ; WRITE IT + DEC A + LD A,E ; + CP 00H ; + JP NZ,DO_SCROLL1 ; LOOP TILL DONE + + LD HL, (VDU_DISPLAY_START) ; GET UP START OF DISPLAY + LD BC,0820H ; + ADD HL,BC ; + LD E,23 +DO_SCROLL2: + LD B, 18 ; SET UPDATE(DEST) POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE(DEST) POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD BC,0050H ; + ADD HL,BC ; + LD B, 32 ; SET SOURCE POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 33 ; SET SOURCE POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B, 24 ; SET COPY + LD A,D ; + CALL VDU_WREG ; WRITE IT + + LD B, 30 ; SET AMOUNT TO COPY + LD A,050H ; + CALL VDU_WREG ; WRITE IT + DEC E + LD A,E ; + CP 00H ; + JP NZ,DO_SCROLL2 ; LOOP TILL DONE + + + LD A,23 ; SET CURSOR TO BEGINNING OF LAST LINE + LD (TERM_Y),A ; + LD A,(TERM_X) ; + PUSH AF ; STORE X COORD + LD A,0 ; + LD (TERM_X),A ; + CALL GOTO_XY ; SET CURSOR POSITION TO BEGINNING OF LINE + POP AF ; RESTORE X COORD + POP BC ; RESTORE BC + CALL PERF_ERASE_EOL ; ERASE SCROLLED LINE + LD (TERM_X),A ; + CALL GOTO_XY ; SET CURSOR POSITION + POP HL ; RESTORE HL + POP AF ; RESTORE AF + RET ; + +;__REVERSE_SCROLL__________________________________________________________________________________ +; +; SCROLL THE SCREEN DOWN ONE LINE +;__________________________________________________________________________________________________ +REVERSE_SCROLL: + PUSH AF ; STORE AF + PUSH HL ; STORE HL + PUSH BC ; STORE BC + + LD B, 24 ; GET REGISTER 24 + CALL VDU_GREG ; + OR 80H ; TURN ON COPY BIT + LD E,A ; PARK IT + + LD HL, (VDU_DISPLAY_START) ; GET UP START OF DISPLAY + LD BC,0730H ; + ADD HL,BC + LD D,23 ; +REVERSE_SCROLL1: + LD B, 18 ; SET UPDATE(DEST) POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE(DEST) POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD BC,0FFB0H ; + ADD HL,BC ; + LD B, 32 ; SET SOURCE POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 33 ; SET SOURCE POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B, 24 ; SET COPY + LD A,E ; + CALL VDU_WREG ; WRITE IT + + LD B, 30 ; SET AMOUNT TO COPY + LD A,050H ; + CALL VDU_WREG ; WRITE IT + + DEC D + LD A,D ; + CP 00H ; + JP NZ,REVERSE_SCROLL1 ; LOOP TILL DONE + + + LD HL, (VDU_DISPLAY_START) ; GET UP START OF DISPLAY + LD BC,0F50H ; + ADD HL,BC + LD D,23 ; +REVERSE_SCROLL2: + LD B, 18 ; SET UPDATE(DEST) POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE(DEST) POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD BC,0FFB0H ; + ADD HL,BC ; + LD B, 32 ; SET SOURCE POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 33 ; SET SOURCE POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B, 24 ; SET COPY + LD A,E ; + CALL VDU_WREG ; WRITE IT + + LD B, 30 ; SET AMOUNT TO COPY + LD A,050H ; + CALL VDU_WREG ; WRITE IT + + DEC D + LD A,D ; + CP 00H ; + JP NZ,REVERSE_SCROLL2 ; LOOP TILL DONE + LD A,0 ; SET CURSOR TO BEGINNING OF FIRST LINE + LD (TERM_Y),A ; + LD A,(TERM_X) ; + PUSH AF ; STORE X COORD + LD A,0 ; + LD (TERM_X),A ; + CALL GOTO_XY ; SET CURSOR POSITION TO BEGINNING OF LINE + POP AF ; RESTORE AF + POP BC ; RESTORE BC + CALL PERF_ERASE_EOL ; ERASE SCROLLED LINE + LD (TERM_X),A ; + CALL GOTO_XY ; SET CURSOR POSITION + POP HL ; RESTORE HL + POP AF ; RESTORE AF + RET ; + +;__VDU_INIT_________________________________________________________________________________________ +; +; INITIALIZE VDU +;__________________________________________________________________________________________________ +VDU_INIT: + PUSH AF ; STORE AF + PUSH DE ; STORE DE + PUSH HL ; STORE HL + PUSH BC ; STORE BC + + CALL VDU_CRTInit ; INIT 8563 VDU CHIP + CALL VDU_LOADFONT ; + CALL PERF_CURSOR_HOME ; CURSOR HOME + LD C,14 ; + CALL PERF_ERASE_EOS ; CLEAR SCREEN + CALL VDU_CursorOn ; TURN ON CURSOR + + POP BC ; + POP HL ; + POP DE ; + POP AF ; + + RET + +;__PERF_CURSOR_HOME________________________________________________________________________________ +; +; PERFORM CURSOR HOME +;__________________________________________________________________________________________________ +PERF_CURSOR_HOME: + LD A,0 ; LOAD 0 INTO A + LD (TERM_X),A ; SET X COORD + LD (TERM_Y),A ; SET Y COORD + JP GOTO_XY ; MOVE CURSOR TO POSITION + +;__PERF_ERASE_EOS__________________________________________________________________________________ +; +; PERFORM ERASE FROM CURSOR POS TO END OF SCREEN +; C= DEFAULT COLOR +;__________________________________________________________________________________________________ +PERF_ERASE_EOS: + PUSH HL + PUSH AF + PUSH BC + + LD HL, (VDU_DisplayPos) ; GET CURRENT DISPLAY ADDRESS + LD B, 18 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + CALL GOTO_XY ; MOVE CURSOR + LD DE,0820H ; SET SCREEN SIZE INTO HL +PERF_ERASE_EOS_LOOP: + LD A, ' ' ; MOVE SPACE CHARACTER INTO A + LD B,31 ; + CALL VDU_WREG ; WRITE IT TO SCREEN, VDU WILL AUTO INC TO NEXT ADDRESS + DEC DE ; DEC COUNTER + LD A,D ; IS COUNTER 0 YET? + OR E ; + JP NZ,PERF_ERASE_EOS_LOOP ; NO, LOOP + LD DE,0820H ; SET SCREEN SIZE INTO HL +PERF_ERASE_EOS_CLOOP: + LD A, C ; MOVE COLOR INTO A + LD B,31 ; + CALL VDU_WREG ; WRITE IT TO SCREEN, VDU WILL AUTO INC TO NEXT ADDRESS + DEC DE ; DEC COUNTER + LD A,D ; IS COUNTER 0 YET? + OR E ; + JP NZ,PERF_ERASE_EOS_CLOOP ; NO, LOOP + + CALL GOTO_XY ; YES, MOVE CURSOR BACK TO ORIGINAL POSITION + POP BC + POP AF + POP HL + RET + +;__PERF_ERASE_EOL__________________________________________________________________________________ +; +; PERFORM ERASE FROM CURSOR POS TO END OF LINE +; C=DEFAULT COLOR +;__________________________________________________________________________________________________ +PERF_ERASE_EOL: + PUSH HL + PUSH AF + PUSH BC + + LD A,(TERM_X) ; GET CURRENT CURSOR X COORD + LD D,A ; STORE IT IN C + LD A,80 ; MOVE CURRENT LINE WIDTH INTO A + SUB D ; GET REMAINING POSITIONS ON CURRENT LINE + LD B,A ; MOVE IT INTO B +PERF_ERASE_EOL_LOOP: + LD A, ' ' ; MOVE SPACE CHARACTER INTO A + CALL VDU_PutCharRAW ; + DJNZ PERF_ERASE_EOL_LOOP ; LOOP UNTIL DONE + CALL GOTO_XY ; MOVE CURSOR BACK TO ORIGINAL POSITION + POP BC + POP AF + POP HL + RET + +;__DSPMATRIX_______________________________________________________________________________________ +; +; DISPLAY INTRO SCREEN +;__________________________________________________________________________________________________ +DSPMATRIX: + CALL PERF_CURSOR_HOME ; RESET CURSOR TO HOME POSITION + LD HL,TESTMATRIX ; SET HL TO SCREEN IMAGE + LD DE, 1919 ; SET IMAGE SIZE +; LD C,00000011B ; SET COLOR + LD C,00001111B ; SET COLOR +DSPMATRIX_LOOP: + LD A,(HL) ; GET NEXT CHAR FROM IMAGE + call VDU_PutChar ; DUMP CHAR TO DISPLAY + INC HL ; INC POINTER + DEC DE ; DEC COUNTER + LD A,D ; IS COUNTER ZERO? + OR E ; + JP NZ,DSPMATRIX_LOOP ; NO, LOOP + CALL PERF_CURSOR_HOME ; YES, RESET CURSOR TO HOME POSITION + RET + +TESTMATRIX: + .TEXT "0 1 2 3 4 5 6 7 " + .TEXT "01234567890123456789012345678901234567890123456789012345678901234567890123456789" + .TEXT "2 " + .TEXT "3 " + .TEXT "4 ===================================================== " + .TEXT "5 " + .TEXT "6 **** * * **** * * **** * * " + .TEXT "7 * * * * * * * * * * * * " + .TEXT "8 * * * * * * * * * ** " + .TEXT "9 * * * * * * * * * ** " + .TEXT "10 * * * * * * * * * * * * " + .TEXT "11 **** * **** **** **** * * " + .TEXT "12 " + .TEXT "13 ===================================================== " + .TEXT "14 " + .TEXT "15 VDU TEST V0.1 VT-52 EMULATION " + .TEXT "16 " + .TEXT "17 ** PRESS ANY KEY TO ENTER TERMINAL MODE ** " + .TEXT "18 " + .TEXT "19 " + .TEXT "21 " + .TEXT "22 " + .TEXT "23 " + .TEXT "24 " + + +;__VDU_WREG________________________________________________________________________________________ +; +; WRITE VALUE IN A TO REGISTER IN B +; B: REGISTER TO UPDATE +; A: VALUE TO WRITE +;__________________________________________________________________________________________________ +VDU_WREG: + PUSH AF ; STORE AF +VDU_WREG_1: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_WREG_1 ; wait for ready + LD A,B ; + OUT (M8563Register),A ; select register +VDU_WREG_2: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_WREG_2 ; wait for ready + POP AF ; + OUT (M8563Data),A ; PUT DATA + RET + + +;__VDU_GREG________________________________________________________________________________________ +; +; GET VALUE FROM REGISTER IN B PLACE IN A +; B: REGISTER TO GET +; A: VALUE +;__________________________________________________________________________________________________ +VDU_GREG: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_GREG ; wait for ready + LD A,B ; + OUT (M8563Register) , A ; select register +VDU_GREG_1: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_GREG_1 ; wait for ready + IN A,(M8563Data) ; GET DATA + RET + + + +VDU_Init8563: + .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 + +;__VDU_CRTInit_____________________________________________________________________________________ +; +; INIT VDU CHIP +;__________________________________________________________________________________________________ +VDU_CRTInit: + PUSH AF ; STORE AF + PUSH BC ; STORE BC + PUSH HL ; STORE HL + + LD B,$00 ; B = 0 + LD HL,VDU_Init8563 ; HL = pointer to the default values + XOR A ; A = 0 +VDU_CRTInitLoop: + LD A,(HL) ; GET VALUE + CALL VDU_WREG ; WRITE IT + INC HL + INC B ; + LD A,B ; + CP 37 ; + JR NZ,VDU_CRTInitLoop ; LOOP UNTIL DONE + POP HL ; RESTORE HL + POP BC ; RESTORE BC + POP AF ; RESTORE AF + RET + + +;__VDU_CursorOn____________________________________________________________________________________ +; +; TURN ON CURSOR +;__________________________________________________________________________________________________ +VDU_CursorOn: + PUSH AF ; STORE AF + LD A, $60 ; SET CURSOR VALUE + JP VDU_CursorSet ; + +;__VDU_CursorOff___________________________________________________________________________________ +; +; TURN OFF CURSOR +;__________________________________________________________________________________________________ +VDU_CursorOff: + PUSH AF ; STORE AF + LD A, $20 ; SET CURSOR VALUE +VDU_CursorSet: + PUSH BC ; STORE BC + LD B,10 + CALL VDU_WREG ; WRITE IT + POP BC ; RESTORE BC + POP AF ; RESTORE AF + RET + +;__GOTO_XY_________________________________________________________________________________________ +; +; MOVE CURSOR TO POSITON IN TERM_X AND TERM_Y +;__________________________________________________________________________________________________ +GOTO_XY: + PUSH AF ; STORE AF + + LD A,(TERM_Y) ; PLACE Y COORD IN A + CP 24 ; IS 24? + JP Z,DO_SCROLLE1 ; YES, MUST SCROLL + + PUSH BC ; STORE BC + PUSH DE ; STORE DE + LD A,(TERM_X) ; + LD H,A ; + LD A,(TERM_Y) ; + LD L,A ; + PUSH HL ; STORE HL + LD B, A ; B = Y COORD + LD DE, 80 ; MOVE LINE LENGTH INTO DE + LD HL, 0 ; MOVE 0 INTO HL + LD A, B ; A=B + CP 0 ; Y=0? + JP Z, VDU_YLoopEnd ; THEN DO NOT MULTIPLY BY 80 +VDU_YLoop: ; HL = 80 * Y + ADD HL, DE ; HL=HL+DE + DJNZ VDU_YLoop ; LOOP +VDU_YLoopEnd: ; + POP DE ; DE = org HL + LD E, D ; E = X + LD D, 0 ; D = 0 + ADD HL, DE ; HL = HL + X + LD (VDU_DisplayPos), HL ; + PUSH HL ; + POP DE ; + LD HL,(VDU_DISPLAY_START) ; + ADD HL,DE ; + LD B, 18 ; SET UPDATE ADDRESS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE ADDRESS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B, 14 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 15 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + POP DE ; RESTORE DE + POP BC ; RESTORE BC + POP AF ; RESTORE AF + RET + +;__VDU_PutChar______________________________________________________________________________________ +; +; PLACE CHARACTER ON SCREEN +; A: CHARACTER TO OUTPUT +; C: COLOR +;__________________________________________________________________________________________________ +VDU_PutChar: + PUSH DE ; STORE DE + PUSH AF ; STORE AF + PUSH HL ; STORE HL + LD D,A ; STORE CHAR IN D + LD A,(TERM_X) ; PLACE X COORD IN A + INC A ; INC X COORD + LD (TERM_X),A ; STORE IN A + CP 80 ; IS 80? + JP NZ,VDU_PutChar1 ; NO, PLACE CHAR ON DISPLAY + LD A,0 ; YES, WRAP TO NEXT LINE + LD (TERM_X),A ; STORE X + LD A,(TERM_Y) ; A= Y COORD + INC A ; INC Y COORD + LD (TERM_Y),A ; STORE Y + CP 24 ; IS PAST END OF SCREEN? + CALL Z,GOTO_XY ; YES, HANDLE SCROLLING +VDU_PutChar1: ; + ; + LD HL, (VDU_DisplayPos) ; GET CURRENT DISPLAY ADDRESS + LD B, 18 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD A,D ; RESTORE CHAR + LD B,31 ; + CALL VDU_WREG ; WRITE IT + PUSH HL ; + LD DE,$0820 ; + ADD HL,DE ; + LD B, 18 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD A,C ; GET COLOR + LD B,31 ; + CALL VDU_WREG ; WRITE IT + POP HL ; RESTORE ADDRESS + INC HL ; INCREMENT IT + LD (VDU_DisplayPos), HL ; STORE CURRENT DISPLAY ADDRESS + PUSH HL ; MOVE HL TO DE + POP DE ; + LD HL,(VDU_DISPLAY_START) ; + ADD HL,DE ; + LD B, 14 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 15 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + POP HL ; RESTORE HL + POP AF ; RESTORE AF + POP DE ; RESTORE DE + RET + +VDU_PutCharRAW: + PUSH BC ; + LD D,A ; + LD HL, (VDU_DisplayPos) ; GET CURRENT DISPLAY ADDRESS + LD B, 18 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD A,D ; RESTORE CHAR + LD B,31 ; + CALL VDU_WREG ; WRITE IT + PUSH HL ; + LD DE,$0820 ; + ADD HL,DE ; + LD B, 18 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD A,C ; GET COLOR + LD B,31 ; + CALL VDU_WREG ; WRITE IT + POP HL ; RESTORE ADDRESS + INC HL ; INCREMENT IT + LD (VDU_DisplayPos), HL ; STORE CURRENT DISPLAY ADDRESS + POP BC + RET + +;__VDU_LOADFONT____________________________________________________________________________________ +; +; LOAD SCREEN FONT +;__________________________________________________________________________________________________ +VDU_LOADFONT: + PUSH AF + PUSH BC + + LD HL,$2000 ; SET FONT LOCATION + ; + LD B, 18 ; SET UPDATE ADDRESS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE ADDRESS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B,$00 ; FONT SIZE + LD C,$20 ; FONT SIZE + LD HL,FONT ; FONT DATA +VDU_LOADFONT_LOOP: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_LOADFONT_LOOP ; wait for ready + LD A,31 ; + OUT (M8563Register) , A ; select register +VDU_LOADFONT_LOOP_1: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_LOADFONT_LOOP_1 ; wait for ready + LD A,(HL) ; + OUT (M8563Data) , A ; PUT DATA + INC HL + DJNZ VDU_LOADFONT_LOOP ; + DEC C ; + JP NZ,VDU_LOADFONT_LOOP ; + POP BC + POP AF + RET + +;__KB_INITIALIZE___________________________________________________________________________________ +; +; INIT KEYBOARD CONTROLLER +;__________________________________________________________________________________________________ +KB_INITIALIZE: + LD C,0a7H ; + CALL I8242CommandPut ; + LD C,0aeH ; + CALL I8242CommandPut ; + LD C,0aaH ; + CALL I8242CommandPut ; + LD A,0 ; EMPTY KB QUEUE + LD (KB_QUEUE_PTR),A ; + RET + +;__I8242CommandPut_________________________________________________________________________________ +; +; WRITE VALUE IN A TO 8242 +; C: VALUE TO WRITE +;__________________________________________________________________________________________________ +I8242CommandPut: + IN A,(I8242Status) ; read status register + BIT 1,A ; if bit 1 = 1 + JR NZ,I8242CommandPut ; wait for ready + LD A,C ; + OUT (I8242Command),A ; select register + RET + +;__WAIT_KBHIT______________________________________________________________________________________ +; +; WAIT FOR A KEY PRESS +;__________________________________________________________________________________________________ +WAIT_KBHIT: + CALL KB_PROCESS ; call keyboard routine + LD A,(KB_QUEUE_PTR) ; IS QUEUE EMPTY? + OR A ; set flags + JP Z,WAIT_KBHIT ; if no keys waiting, try again + RET + +;__IS_KBHIT________________________________________________________________________________________ +; +; WAS A KEY PRESSED? +;__________________________________________________________________________________________________ +IS_KBHIT: + CALL KB_PROCESS ; call keyboard routine + LD A,(KB_QUEUE_PTR) ; ask if keyboard has key waiting + RET + +;__GET_KEY_________________________________________________________________________________________ +; +; GET KEY PRESS VALUE +;__________________________________________________________________________________________________ +GET_KEY: + CALL WAIT_KBHIT ; WAIT FOR A KEY + LD A,(KB_QUEUE_PTR) ; GET QUEUE POINTER + OR A ; + RET Z ; ABORT IF QUEUE EMPTY + PUSH BC ; STORE BC + LD B,A ; STORE QUEUE COUNT FOR LATER + PUSH HL ; STORE HL + LD A,(KB_QUEUE) ; GET TOP BYTE FROM QUEUE + PUSH AF ; STORE IT + LD HL,KB_QUEUE ; GET POINTER TO QUEUE +GET_KEY_LOOP: ; + INC HL ; POINT TO NEXT VALUE IN QUEUE + LD A,(HL) ; GET VALUE + DEC HL ; + LD (HL),A ; MOVE IT UP ONE + INC HL ; + DJNZ GET_KEY_LOOP ; LOOP UNTIL DONE + LD A,(KB_QUEUE_PTR) ; DECREASE QUEUE POINTER BY ONE + DEC A ; + LD (KB_QUEUE_PTR),A ; + POP AF ; RESTORE VALUE + POP HL ; RESTORE HL + POP BC ; RESTORE BC + RET + + +;__KB_PROCESS______________________________________________________________________________________ +; +; a=0 if want to know if a byte is available, and a=1 to ask for the byte +;__________________________________________________________________________________________________ +KB_PROCESS: + IN A,(I8242Status) ; read status register + BIT 0,A ; if bit 0 = 0 + RET Z ; EXIT + IN A,(I8242Data) ; GET BYTE + call KB_decodechar ; returns char or 0 for things like keyup, some return directly to cp/m + ret ; return to cp/m + +;__KB_waitbyte______________________________________________________________________________________ +; +; WAIT FOR byte TO BE available +;__________________________________________________________________________________________________ +KB_waitbyte: + IN A,(I8242Status) ; read status register + BIT 0,A ; if bit 0 = 0 + jp Z,KB_waitbyte ; LOOP + IN A,(I8242Data) ; GET BYTE + RET + +;__KB_decodechar____________________________________________________________________________________ +; +; decode character pass a and prints out the char +; on the LCD screen +;__________________________________________________________________________________________________ +KB_decodechar: + cp 0 ; is it zero + ret z ; return if a zero - no need to do anything + + ld c,a ; + cp 0AAh ; shift (down, because up would be trapped by 0F above) + jp z,shiftup ; + cp 0B6h ; other shift key + jp z,shiftup ; + cp 9Dh ; control key + jp z,controlup ; + AND 80H ; if bit 7 = 1 + RET nz ; ignore char up + ld a,C ; + cp 0E0h ; TWO BYTE + JP Z,twobyte ; + cp 03Ah ; caps lock so toggle + jp z,capstog ; + cp 2Ah ; shift (down, because up would be trapped by 0F above) + jp z,shiftdown ; + cp 36h ; other shift key + jp z,shiftdown ; + cp 01Dh ; control key + jp z,controldown ; + ld c,a ; + ld b,0 ; add bc to hl + ld hl,normalkeys ; offset to add + add hl,bc ; + ld a,(ctrl) ; + cp 0 ; is control being held down? + jR z,dc1 ; no so go back to test caps lock on + ld a,(hl) ; get the letter, should be smalls + sub 96 ; a=97 so subtract 96 a=1=^A + JP KB_ENQUEUE ; STORE ON KB QUEUE +dc1: ld a,(capslock) ; + cp 0 ; is it 0, if so then don't add the caps offset + jr z,dc2 ; + ld c,080h ; add another 50h to smalls to get caps + add hl,bc ; +dc2: ld a,(hl) ; + JP KB_ENQUEUE ; STORE ON KB QUEUE +twobyte:; already got EO so get the next character + call KB_waitbyte + cp 053h ; delete + jp z,deletekey ; + cp 01Ch ; return on number pad + jp z,returnkey ; + cp 050h ; + jp z,downarrow ; + cp 04Dh ; + jp z,rightarrow ; + cp 04Bh ; + jp z,leftarrow ; + cp 048h ; + jp z,uparrow ; + cp 052h ; + jp z,insert ; + cp 049h ; + jp z,pageup ; + cp 051h ; + jp z,pagedown ; + cp 047h ; + jp z,home ; + cp 04Fh ; + jp z,end ; + ld a,0 ; returns nothing + ret +home: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'?' ; ? + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'w' ; w + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +end: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'?' ; ? + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'q' ; q + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +downarrow: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'B' ; B + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +rightarrow: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'C' ; C + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +leftarrow: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'D' ; D + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +uparrow: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'A' ; A + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +insert: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'?' ; ? + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'p' ; p + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +pageup: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'?' ; ? + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'y' ; y + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +pagedown: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'?' ; ? + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'s' ; s + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +controldown: ; same code as shiftdown but diff location + ld a,0ffh ; + ld (ctrl),a ; control down + ld a,0 ; + ret ; +controlup: ; control key up see shift for explanation + ld a,0 ; + ld (ctrl),a ; + ld a,0 ; + ret ; +returnkey: ; + ld a,13 ; + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +deletekey: ; + ld a,07fh ; delete key value that cp/m uses + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +capstog: ; + ld a,(capslock) ; + xor 11111111B ; swap all the bits + ld (capslock),a ; + ld a,0 ; returns nothing + ret ; +shiftdown: ; shift is special - hold it down and it autorepeats + ; so once it is down, turn caps on and ignore all further shifts + ; only an F0+shift turns caps lock off again + ld a,0ffh ; + ld (capslock),a ; + ld a,0 ; returns nothing + ret ; +shiftup: ; shiftup turns off caps lock definitely + ld a,0 ; + ld (capslock),a ; + ld a,0 ; returns nothing + ret ; + +;__KB_ENQUEUE______________________________________________________________________________________ +; +; STORE A BYTE IN THE KEYBOARD QUEUE +; A: BYTE TO ENQUEUE +;__________________________________________________________________________________________________ +KB_ENQUEUE: + PUSH DE ; STORE DE + PUSH HL ; STORE HL + PUSH AF ; STORE VALUE + LD A,(KB_QUEUE_PTR); PUT QUEUE POINTER IN A + CP 15 ; IS QUEUE FULL + JP P,KB_ENQUEUE_AB ; YES, ABORT + LD HL,KB_QUEUE ; GET QUEUE POINTER + PUSH HL ; MOVE HL TO BC + POP BC ; + LD H,0 ; ZERO OUT H + LD L,A ; PLACE QUEUE POINTER IN L + ADD HL,BC ; POINT HL AT THE NEXT LOACTION TO ADD VALUE + POP AF ; RESTORE VALUE + LD (HL),A ; ENQUEUE VALUE + LD A,(KB_QUEUE_PTR); GET QUEUE POINTER + INC A ; INC IT + LD (KB_QUEUE_PTR),A; STORE QUEUE POINTER +KB_ENQUEUE_AB: + POP HL ; RESTORE HL + POP DE ; RESTORE DE + RET + +normalkeys: ; The TI character codes, offset from label by keyboard scan code + .db 000,027,"1","2","3","4","5","6","7","8","9","0","-","=",008,009 ;00-0F + .DB "q","w","e","r","t","y","u","i","o","p","[","]",013,000,"a","s" ;10-1F + .DB "d","f","g","h","j","k","l",";",27H,60H,000,092,"z","x","c","v" ;20-2F + .DB "b","n","m",",",".","/",000,000,000," ",000,000,000,000,000,000 ;30-3F + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;40-4F + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;50-5F + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;60-6F + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;70-7F + .db 000,027,"!","@","#","$","%","^","&","*","(",")","_","+",008,009 + .DB "Q","W","E","R","T","Y","U","I","O","P","{","}",013,000,"A","S" + .DB "D","F","G","H","J","K","L",":",034,"~",000,"|","Z","X","C","V" + .DB "B","N","M","<",">","?",000,000,000," ",000,000,000,000,000,000 + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + + .include "font.asm" + +;__________________________________________________________________________________________________ +; +; RAM STORAGE AREAS +;__________________________________________________________________________________________________ + +ALT_KEYPAD .DB 0 ; ALT KEYPAD ENABLED? +GR_MODE .DB 0 ; GRAPHICS MODE ENABLED? +TERM_X: .DB 0 ; CURSOR X +TERM_Y: .DB 0 ; CURSOR Y +TERMSTATE: .DB 0 ; TERMINAL STATE + ; 0 = NORMAL + ; 1 = ESC RCVD +VDU_DisplayPos: .DW 0 ; CURRENT DISPLAY POSITION +VDU_DISPLAY_START: + .DW 0 ; CURRENT DISPLAY POSITION +capslock .DB 0 ; location for caps lock, either 00000000 or 11111111 +ctrl .DB 0 ; location for ctrl on or off 00000000 or 11111111 +numlock .DB 0 ; location for num lock +skipcount .DB 0 ; only check some calls, speeds up a lot of cp/m + +KB_QUEUE .DB 0,0,0,0,0,0,0,0 ; 16 BYTE KB QUEUE + .DB 0,0,0,0,0,0,0,0 +KB_QUEUE_PTR .DB 0 ; POINTER TO QUEUE +PARKSTACK .DW 0000 ; SAVE STACK POINTER + + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; +TERMSTACK: .DB 0 ; + + + .end diff --git a/Source/Apps/Test/vdctest/vdctest.asm b/Source/Apps/Test/vdctest/vdctest.asm new file mode 100644 index 00000000..60eb8564 --- /dev/null +++ b/Source/Apps/Test/vdctest/vdctest.asm @@ -0,0 +1,1089 @@ +;__CVDUTEST________________________________________________________________________________________ +; +; CVDUTEST COLOR VDU TEST +; +; WRITTEN BY: DAN WERNER -- 11/4/2011 +;__________________________________________________________________________________________________ +; + +; DATA CONSTANTS +;__________________________________________________________________________________________________ +;IDE REGISTER IO PORT ; FUNCTION +M8563Status .EQU $E4 +M8563Register .EQU $E4 +M8563Data .EQU $E5 + +I8242Status .EQU $E3 +I8242Command .EQU $E3 +I8242Data .EQU $E2 + + + .ORG $0100 +;__________________________________________________________________________________________________ +; MAIN PROGRAM BEGINS HERE +;__________________________________________________________________________________________________ +INITVDU: + CALL VDU_INIT ; INIT VDU + CALL KB_INITIALIZE ; INIT KB + + CALL DSPMATRIX ; DISPLAY INIT MATRIX SCREEN + CALL WAIT_KBHIT ; WAIT FOR A KEYSTROKE + +LOOP1: + CALL GET_KEY + LD C,14 + CP 13 + JP Z,LOOP2 + CP 27 + JP Z,LOOP3 + CP '6' + JP Z,LOOP4 + CALL VDU_PutChar ; DUMP CHAR TO DISPLAY + JP LOOP1 +LOOP2: + LD A,0 ; YES, WRAP TO NEXT LINE + LD (TERM_X),A ; STORE X + LD A,(TERM_Y) ; A= Y COORD + INC A ; INC Y COORD + LD (TERM_Y),A ; STORE Y + CALL GOTO_XY ; YES, HANDLE SCROLLING + JP LOOP1 +LOOP3: + LD C,00H ; CP/M SYSTEM RESET CALL + CALL 0005H ; RETURN TO PROMPT + RET +LOOP4: + CALL REVERSE_SCROLL + JP LOOP1 + + +;__DO_SCROLL_______________________________________________________________________________________ +; +; SCROLL THE SCREEN UP ONE LINE +;__________________________________________________________________________________________________ +DO_SCROLL: + PUSH AF ; STORE AF +DO_SCROLLE1: + PUSH HL ; STORE HL + PUSH BC ; STORE BC + + LD B, 24 ; GET REGISTER 24 + CALL VDU_GREG ; + OR 80H ; TURN ON COPY BIT + LD D,A ; PARK IT + + LD HL, (VDU_DISPLAY_START) ; GET UP START OF DISPLAY + LD E,23 ; +DO_SCROLL1: + LD B, 18 ; SET UPDATE(DEST) POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE(DEST) POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD BC,0050H ; + ADD HL,BC ; + LD B, 32 ; SET SOURCE POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 33 ; SET SOURCE POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B, 24 ; SET COPY + LD A,D ; + CALL VDU_WREG ; WRITE IT + + LD B, 30 ; SET AMOUNT TO COPY + LD A,050H ; + CALL VDU_WREG ; WRITE IT + DEC A + LD A,E ; + CP 00H ; + JP NZ,DO_SCROLL1 ; LOOP TILL DONE + + LD HL, (VDU_DISPLAY_START) ; GET UP START OF DISPLAY + LD BC,0820H ; + ADD HL,BC ; + LD E,23 +DO_SCROLL2: + LD B, 18 ; SET UPDATE(DEST) POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE(DEST) POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD BC,0050H ; + ADD HL,BC ; + LD B, 32 ; SET SOURCE POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 33 ; SET SOURCE POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B, 24 ; SET COPY + LD A,D ; + CALL VDU_WREG ; WRITE IT + + LD B, 30 ; SET AMOUNT TO COPY + LD A,050H ; + CALL VDU_WREG ; WRITE IT + DEC E + LD A,E ; + CP 00H ; + JP NZ,DO_SCROLL2 ; LOOP TILL DONE + + + LD A,23 ; SET CURSOR TO BEGINNING OF LAST LINE + LD (TERM_Y),A ; + LD A,(TERM_X) ; + PUSH AF ; STORE X COORD + LD A,0 ; + LD (TERM_X),A ; + CALL GOTO_XY ; SET CURSOR POSITION TO BEGINNING OF LINE + POP AF ; RESTORE X COORD + POP BC ; RESTORE BC + CALL PERF_ERASE_EOL ; ERASE SCROLLED LINE + LD (TERM_X),A ; + CALL GOTO_XY ; SET CURSOR POSITION + POP HL ; RESTORE HL + POP AF ; RESTORE AF + RET ; + +;__REVERSE_SCROLL__________________________________________________________________________________ +; +; SCROLL THE SCREEN DOWN ONE LINE +;__________________________________________________________________________________________________ +REVERSE_SCROLL: + PUSH AF ; STORE AF + PUSH HL ; STORE HL + PUSH BC ; STORE BC + + LD B, 24 ; GET REGISTER 24 + CALL VDU_GREG ; + OR 80H ; TURN ON COPY BIT + LD E,A ; PARK IT + + LD HL, (VDU_DISPLAY_START) ; GET UP START OF DISPLAY + LD BC,0730H ; + ADD HL,BC + LD D,23 ; +REVERSE_SCROLL1: + LD B, 18 ; SET UPDATE(DEST) POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE(DEST) POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD BC,0FFB0H ; + ADD HL,BC ; + LD B, 32 ; SET SOURCE POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 33 ; SET SOURCE POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B, 24 ; SET COPY + LD A,E ; + CALL VDU_WREG ; WRITE IT + + LD B, 30 ; SET AMOUNT TO COPY + LD A,050H ; + CALL VDU_WREG ; WRITE IT + + DEC D + LD A,D ; + CP 00H ; + JP NZ,REVERSE_SCROLL1 ; LOOP TILL DONE + + + LD HL, (VDU_DISPLAY_START) ; GET UP START OF DISPLAY + LD BC,0F50H ; + ADD HL,BC + LD D,23 ; +REVERSE_SCROLL2: + LD B, 18 ; SET UPDATE(DEST) POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE(DEST) POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD BC,0FFB0H ; + ADD HL,BC ; + LD B, 32 ; SET SOURCE POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 33 ; SET SOURCE POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B, 24 ; SET COPY + LD A,E ; + CALL VDU_WREG ; WRITE IT + + LD B, 30 ; SET AMOUNT TO COPY + LD A,050H ; + CALL VDU_WREG ; WRITE IT + + DEC D + LD A,D ; + CP 00H ; + JP NZ,REVERSE_SCROLL2 ; LOOP TILL DONE + LD A,0 ; SET CURSOR TO BEGINNING OF FIRST LINE + LD (TERM_Y),A ; + LD A,(TERM_X) ; + PUSH AF ; STORE X COORD + LD A,0 ; + LD (TERM_X),A ; + CALL GOTO_XY ; SET CURSOR POSITION TO BEGINNING OF LINE + POP AF ; RESTORE AF + POP BC ; RESTORE BC + CALL PERF_ERASE_EOL ; ERASE SCROLLED LINE + LD (TERM_X),A ; + CALL GOTO_XY ; SET CURSOR POSITION + POP HL ; RESTORE HL + POP AF ; RESTORE AF + RET ; + + + +;__VDU_INIT_________________________________________________________________________________________ +; +; INITIALIZE VDU +;__________________________________________________________________________________________________ +VDU_INIT: + PUSH AF ; STORE AF + PUSH DE ; STORE DE + PUSH HL ; STORE HL + PUSH BC ; STORE BC + + CALL VDU_CRTInit ; INIT 8563 VDU CHIP + CALL VDU_LOADFONT ; + CALL PERF_CURSOR_HOME ; CURSOR HOME + LD C,14 ; + CALL PERF_ERASE_EOS ; CLEAR SCREEN + CALL VDU_CursorOn ; TURN ON CURSOR + + POP BC ; + POP HL ; + POP DE ; + POP AF ; + + RET + +;__PERF_CURSOR_HOME________________________________________________________________________________ +; +; PERFORM CURSOR HOME +;__________________________________________________________________________________________________ +PERF_CURSOR_HOME: + LD A,0 ; LOAD 0 INTO A + LD (TERM_X),A ; SET X COORD + LD (TERM_Y),A ; SET Y COORD + JP GOTO_XY ; MOVE CURSOR TO POSITION + +;__PERF_ERASE_EOS__________________________________________________________________________________ +; +; PERFORM ERASE FROM CURSOR POS TO END OF SCREEN +; C= DEFAULT COLOR +;__________________________________________________________________________________________________ +PERF_ERASE_EOS: + PUSH HL + PUSH AF + PUSH BC + + LD HL, (VDU_DisplayPos) ; GET CURRENT DISPLAY ADDRESS + LD B, 18 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + CALL GOTO_XY ; MOVE CURSOR + LD DE,0820H ; SET SCREEN SIZE INTO HL +PERF_ERASE_EOS_LOOP: + LD A, ' ' ; MOVE SPACE CHARACTER INTO A + LD B,31 ; + CALL VDU_WREG ; WRITE IT TO SCREEN, VDU WILL AUTO INC TO NEXT ADDRESS + DEC DE ; DEC COUNTER + LD A,D ; IS COUNTER 0 YET? + OR E ; + JP NZ,PERF_ERASE_EOS_LOOP ; NO, LOOP + LD DE,0820H ; SET SCREEN SIZE INTO HL +PERF_ERASE_EOS_CLOOP: + LD A, C ; MOVE COLOR INTO A + LD B,31 ; + CALL VDU_WREG ; WRITE IT TO SCREEN, VDU WILL AUTO INC TO NEXT ADDRESS + DEC DE ; DEC COUNTER + LD A,D ; IS COUNTER 0 YET? + OR E ; + JP NZ,PERF_ERASE_EOS_CLOOP ; NO, LOOP + + CALL GOTO_XY ; YES, MOVE CURSOR BACK TO ORIGINAL POSITION + POP BC + POP AF + POP HL + RET + +;__PERF_ERASE_EOL__________________________________________________________________________________ +; +; PERFORM ERASE FROM CURSOR POS TO END OF LINE +; C=DEFAULT COLOR +;__________________________________________________________________________________________________ +PERF_ERASE_EOL: + PUSH HL + PUSH AF + PUSH BC + + LD A,(TERM_X) ; GET CURRENT CURSOR X COORD + LD D,A ; STORE IT IN C + LD A,80 ; MOVE CURRENT LINE WIDTH INTO A + SUB D ; GET REMAINING POSITIONS ON CURRENT LINE + LD B,A ; MOVE IT INTO B +PERF_ERASE_EOL_LOOP: + LD A, ' ' ; MOVE SPACE CHARACTER INTO A + CALL VDU_PutCharRAW ; + DJNZ PERF_ERASE_EOL_LOOP ; LOOP UNTIL DONE + CALL GOTO_XY ; MOVE CURSOR BACK TO ORIGINAL POSITION + POP BC + POP AF + POP HL + RET + +;__DSPMATRIX_______________________________________________________________________________________ +; +; DISPLAY INTRO SCREEN +;__________________________________________________________________________________________________ +DSPMATRIX: + CALL PERF_CURSOR_HOME ; RESET CURSOR TO HOME POSITION + LD HL,TESTMATRIX ; SET HL TO SCREEN IMAGE + LD DE, 1919 ; SET IMAGE SIZE + LD C,00000011B ; SET COLOR +DSPMATRIX_LOOP: + LD A,(HL) ; GET NEXT CHAR FROM IMAGE + call VDU_PutChar ; DUMP CHAR TO DISPLAY + INC HL ; INC POINTER + DEC DE ; DEC COUNTER + LD A,D ; IS COUNTER ZERO? + OR E ; + JP NZ,DSPMATRIX_LOOP ; NO, LOOP + CALL PERF_CURSOR_HOME ; YES, RESET CURSOR TO HOME POSITION + RET + +TESTMATRIX: + .TEXT "0 1 2 3 4 5 6 7 " + .TEXT "01234567890123456789012345678901234567890123456789012345678901234567890123456789" + .TEXT "2 " + .TEXT "3 " + .TEXT "4 ===================================================== " + .TEXT "5 " + .TEXT "6 **** * * **** * * **** * * " + .TEXT "7 * * * * * * * * * * * * " + .TEXT "8 * * * * * * * * * ** " + .TEXT "9 * * * * * * * * * ** " + .TEXT "10 * * * * * * * * * * * * " + .TEXT "11 **** * **** **** **** * * " + .TEXT "12 " + .TEXT "13 ===================================================== " + .TEXT "14 " + .TEXT "15 VDU TEST V0.1 VT-52 EMULATION " + .TEXT "16 " + .TEXT "17 ** PRESS ANY KEY TO ENTER TERMINAL MODE ** " + .TEXT "18 " + .TEXT "19 " + .TEXT "21 " + .TEXT "22 " + .TEXT "23 " + .TEXT "24 " + + +;__VDU_WREG________________________________________________________________________________________ +; +; WRITE VALUE IN A TO REGISTER IN B +; B: REGISTER TO UPDATE +; A: VALUE TO WRITE +;__________________________________________________________________________________________________ +VDU_WREG: + PUSH AF ; STORE AF +VDU_WREG_1: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_WREG_1 ; wait for ready + LD A,B ; + OUT (M8563Register),A ; select register +VDU_WREG_2: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_WREG_2 ; wait for ready + POP AF ; + OUT (M8563Data),A ; PUT DATA + RET + + +;__VDU_GREG________________________________________________________________________________________ +; +; GET VALUE FROM REGISTER IN B PLACE IN A +; B: REGISTER TO GET +; A: VALUE +;__________________________________________________________________________________________________ +VDU_GREG: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_GREG ; wait for ready + LD A,B ; + OUT (M8563Register) , A ; select register +VDU_GREG_1: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_GREG_1 ; wait for ready + IN A,(M8563Data) ; GET DATA + RET + + + +VDU_Init8563: + .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 + +;__VDU_CRTInit_____________________________________________________________________________________ +; +; INIT VDU CHIP +;__________________________________________________________________________________________________ +VDU_CRTInit: + PUSH AF ; STORE AF + PUSH BC ; STORE BC + PUSH HL ; STORE HL + + LD B,$00 ; B = 0 + LD HL,VDU_Init8563 ; HL = pointer to the default values + XOR A ; A = 0 +VDU_CRTInitLoop: + LD A,(HL) ; GET VALUE + CALL VDU_WREG ; WRITE IT + INC HL + INC B ; + LD A,B ; + CP 37 ; + JR NZ,VDU_CRTInitLoop ; LOOP UNTIL DONE + POP HL ; RESTORE HL + POP BC ; RESTORE BC + POP AF ; RESTORE AF + RET + + +;__VDU_CursorOn____________________________________________________________________________________ +; +; TURN ON CURSOR +;__________________________________________________________________________________________________ +VDU_CursorOn: + PUSH AF ; STORE AF + LD A, $60 ; SET CURSOR VALUE + JP VDU_CursorSet ; + +;__VDU_CursorOff___________________________________________________________________________________ +; +; TURN OFF CURSOR +;__________________________________________________________________________________________________ +VDU_CursorOff: + PUSH AF ; STORE AF + LD A, $20 ; SET CURSOR VALUE +VDU_CursorSet: + PUSH BC ; STORE BC + LD B,10 + CALL VDU_WREG ; WRITE IT + POP BC ; RESTORE BC + POP AF ; RESTORE AF + RET + +;__GOTO_XY_________________________________________________________________________________________ +; +; MOVE CURSOR TO POSITON IN TERM_X AND TERM_Y +;__________________________________________________________________________________________________ +GOTO_XY: + PUSH AF ; STORE AF + + LD A,(TERM_Y) ; PLACE Y COORD IN A + CP 24 ; IS 24? + JP Z,DO_SCROLLE1 ; YES, MUST SCROLL + + PUSH BC ; STORE BC + PUSH DE ; STORE DE + LD A,(TERM_X) ; + LD H,A ; + LD A,(TERM_Y) ; + LD L,A ; + PUSH HL ; STORE HL + LD B, A ; B = Y COORD + LD DE, 80 ; MOVE LINE LENGTH INTO DE + LD HL, 0 ; MOVE 0 INTO HL + LD A, B ; A=B + CP 0 ; Y=0? + JP Z, VDU_YLoopEnd ; THEN DO NOT MULTIPLY BY 80 +VDU_YLoop: ; HL = 80 * Y + ADD HL, DE ; HL=HL+DE + DJNZ VDU_YLoop ; LOOP +VDU_YLoopEnd: ; + POP DE ; DE = org HL + LD E, D ; E = X + LD D, 0 ; D = 0 + ADD HL, DE ; HL = HL + X + LD (VDU_DisplayPos), HL ; + PUSH HL ; + POP DE ; + LD HL,(VDU_DISPLAY_START) ; + ADD HL,DE ; + LD B, 18 ; SET UPDATE ADDRESS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE ADDRESS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B, 14 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 15 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + POP DE ; RESTORE DE + POP BC ; RESTORE BC + POP AF ; RESTORE AF + RET + +;__VDU_PutChar______________________________________________________________________________________ +; +; PLACE CHARACTER ON SCREEN +; A: CHARACTER TO OUTPUT +; C: COLOR +;__________________________________________________________________________________________________ +VDU_PutChar: + PUSH DE ; STORE DE + PUSH AF ; STORE AF + PUSH HL ; STORE HL + LD D,A ; STORE CHAR IN D + LD A,(TERM_X) ; PLACE X COORD IN A + INC A ; INC X COORD + LD (TERM_X),A ; STORE IN A + CP 80 ; IS 80? + JP NZ,VDU_PutChar1 ; NO, PLACE CHAR ON DISPLAY + LD A,0 ; YES, WRAP TO NEXT LINE + LD (TERM_X),A ; STORE X + LD A,(TERM_Y) ; A= Y COORD + INC A ; INC Y COORD + LD (TERM_Y),A ; STORE Y + CP 24 ; IS PAST END OF SCREEN? + CALL Z,GOTO_XY ; YES, HANDLE SCROLLING +VDU_PutChar1: ; + ; + LD HL, (VDU_DisplayPos) ; GET CURRENT DISPLAY ADDRESS + LD B, 18 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD A,D ; RESTORE CHAR + LD B,31 ; + CALL VDU_WREG ; WRITE IT + PUSH HL ; + LD DE,$0820 ; + ADD HL,DE ; + LD B, 18 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD A,C ; GET COLOR + LD B,31 ; + CALL VDU_WREG ; WRITE IT + POP HL ; RESTORE ADDRESS + INC HL ; INCREMENT IT + LD (VDU_DisplayPos), HL ; STORE CURRENT DISPLAY ADDRESS + PUSH HL ; MOVE HL TO DE + POP DE ; + LD HL,(VDU_DISPLAY_START) ; + ADD HL,DE ; + LD B, 14 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 15 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + POP HL ; RESTORE HL + POP AF ; RESTORE AF + POP DE ; RESTORE DE + RET + +VDU_PutCharRAW: + PUSH BC ; + LD D,A ; + LD HL, (VDU_DisplayPos) ; GET CURRENT DISPLAY ADDRESS + LD B, 18 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD A,D ; RESTORE CHAR + LD B,31 ; + CALL VDU_WREG ; WRITE IT + PUSH HL ; + LD DE,$0820 ; + ADD HL,DE ; + LD B, 18 ; SET UPDATE CSR POS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE CSR POS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + LD A,C ; GET COLOR + LD B,31 ; + CALL VDU_WREG ; WRITE IT + POP HL ; RESTORE ADDRESS + INC HL ; INCREMENT IT + LD (VDU_DisplayPos), HL ; STORE CURRENT DISPLAY ADDRESS + POP BC + RET + +;__VDU_LOADFONT____________________________________________________________________________________ +; +; LOAD SCREEN FONT +;__________________________________________________________________________________________________ +VDU_LOADFONT: + PUSH AF + PUSH BC + + LD HL,$2000 ; SET FONT LOCATION + ; + LD B, 18 ; SET UPDATE ADDRESS IN VDU + LD A,H ; + CALL VDU_WREG ; WRITE IT + LD B, 19 ; SET UPDATE ADDRESS IN VDU + LD A,L ; + CALL VDU_WREG ; WRITE IT + + LD B,$00 ; FONT SIZE + LD C,$20 ; FONT SIZE + LD HL,FONT ; FONT DATA +VDU_LOADFONT_LOOP: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_LOADFONT_LOOP ; wait for ready + LD A,31 ; + OUT (M8563Register) , A ; select register +VDU_LOADFONT_LOOP_1: + IN A,(M8563Status) ; read address/status register + BIT 7,A ; if bit 7 = 1 than an update strobe has been occured + JR Z,VDU_LOADFONT_LOOP_1 ; wait for ready + LD A,(HL) ; + OUT (M8563Data) , A ; PUT DATA + INC HL + DJNZ VDU_LOADFONT_LOOP ; + DEC C ; + JP NZ,VDU_LOADFONT_LOOP ; + POP BC + POP AF + RET + +;__KB_INITIALIZE___________________________________________________________________________________ +; +; INIT KEYBOARD CONTROLLER +;__________________________________________________________________________________________________ +KB_INITIALIZE: + LD C,0aaH ; SELF TEST + CALL I8242CommandPut ; + LD C,060H ; SET COMMAND REGISTER + CALL I8242CommandPut ; + LD C,$60 ; XLAT ENABLED, MOUSE DISABLED, NO INTS + CALL I8242DataPut ; + LD C,0a7H ; DISABLE MOUSE + CALL I8242CommandPut ; + LD C,0aeH ; ENABLE KEYBOARD + CALL I8242CommandPut ; + LD A,0 ; EMPTY KB QUEUE + LD (KB_QUEUE_PTR),A ; + RET + +;__I8242CommandPut_________________________________________________________________________________ +; +; WRITE VALUE IN A TO 8242 +; C: VALUE TO WRITE +;__________________________________________________________________________________________________ +I8242CommandPut: + IN A,(I8242Status) ; read status register + BIT 1,A ; if bit 1 = 1 + JR NZ,I8242CommandPut ; wait for ready + LD A,C ; + OUT (I8242Command),A ; select register + RET + +;__I8242DataPut____________________________________________________________________________________ +; +; WRITE VALUE IN A TO 8242 +; C: VALUE TO WRITE +;__________________________________________________________________________________________________ +I8242DataPut: + IN A,(I8242Status) ; read status register + BIT 1,A ; if bit 1 = 1 + JR NZ,I8242DataPut ; wait for ready + LD A,C ; + OUT (I8242Data),A ; select register + RET + +;__WAIT_KBHIT______________________________________________________________________________________ +; +; WAIT FOR A KEY PRESS +;__________________________________________________________________________________________________ +WAIT_KBHIT: + CALL KB_PROCESS ; call keyboard routine + LD A,(KB_QUEUE_PTR) ; IS QUEUE EMPTY? + OR A ; set flags + JP Z,WAIT_KBHIT ; if no keys waiting, try again + RET + +;__IS_KBHIT________________________________________________________________________________________ +; +; WAS A KEY PRESSED? +;__________________________________________________________________________________________________ +IS_KBHIT: + CALL KB_PROCESS ; call keyboard routine + LD A,(KB_QUEUE_PTR) ; ask if keyboard has key waiting + RET + + +;__GET_KEY_________________________________________________________________________________________ +; +; GET KEY PRESS VALUE +;__________________________________________________________________________________________________ +GET_KEY: + CALL WAIT_KBHIT ; WAIT FOR A KEY + LD A,(KB_QUEUE_PTR) ; GET QUEUE POINTER + OR A ; + RET Z ; ABORT IF QUEUE EMPTY + PUSH BC ; STORE BC + LD B,A ; STORE QUEUE COUNT FOR LATER + PUSH HL ; STORE HL + LD A,(KB_QUEUE) ; GET TOP BYTE FROM QUEUE + PUSH AF ; STORE IT + LD HL,KB_QUEUE ; GET POINTER TO QUEUE +GET_KEY_LOOP: ; + INC HL ; POINT TO NEXT VALUE IN QUEUE + LD A,(HL) ; GET VALUE + DEC HL ; + LD (HL),A ; MOVE IT UP ONE + INC HL ; + DJNZ GET_KEY_LOOP ; LOOP UNTIL DONE + LD A,(KB_QUEUE_PTR) ; DECREASE QUEUE POINTER BY ONE + DEC A ; + LD (KB_QUEUE_PTR),A ; + POP AF ; RESTORE VALUE + POP HL ; RESTORE HL + POP BC ; RESTORE BC + RET + + +;__KB_PROCESS______________________________________________________________________________________ +; +; a=0 if want to know if a byte is available, and a=1 to ask for the byte +;__________________________________________________________________________________________________ +KB_PROCESS: + IN A,(I8242Status) ; read status register + BIT 0,A ; if bit 0 = 0 + RET Z ; EXIT + IN A,(I8242Data) ; GET BYTE + call KB_decodechar ; returns char or 0 for things like keyup, some return directly to cp/m + ret ; return to cp/m + +;__KB_waitbyte______________________________________________________________________________________ +; +; WAIT FOR byte TO BE available +;__________________________________________________________________________________________________ +KB_waitbyte: + IN A,(I8242Status) ; read status register + BIT 0,A ; if bit 0 = 0 + jp Z,KB_waitbyte ; LOOP + IN A,(I8242Data) ; GET BYTE + RET + + + +;__KB_decodechar____________________________________________________________________________________ +; +; decode character pass a and prints out the char +; on the LCD screen +;__________________________________________________________________________________________________ +KB_decodechar: + cp 0 ; is it zero + ret z ; return if a zero - no need to do anything + + ld c,a ; + cp 0AAh ; shift (down, because up would be trapped by 0F above) + jp z,shiftup ; + cp 0B6h ; other shift key + jp z,shiftup ; + cp 9Dh ; control key + jp z,controlup ; + AND 80H ; if bit 7 = 1 + RET nz ; ignore char up + ld a,C ; + cp 0E0h ; TWO BYTE + JP Z,twobyte ; + cp 03Ah ; caps lock so toggle + jp z,capstog ; + cp 2Ah ; shift (down, because up would be trapped by 0F above) + jp z,shiftdown ; + cp 36h ; other shift key + jp z,shiftdown ; + cp 01Dh ; control key + jp z,controldown ; + ld c,a ; + ld b,0 ; add bc to hl + ld hl,normalkeys ; offset to add + add hl,bc ; + ld a,(ctrl) ; + cp 0 ; is control being held down? + jR z,dc1 ; no so go back to test caps lock on + ld a,(hl) ; get the letter, should be smalls + sub 96 ; a=97 so subtract 96 a=1=^A + JP KB_ENQUEUE ; STORE ON KB QUEUE +dc1: ld a,(capslock) ; + cp 0 ; is it 0, if so then don't add the caps offset + jr z,dc2 ; + ld c,080h ; add another 50h to smalls to get caps + add hl,bc ; +dc2: ld a,(hl) ; + JP KB_ENQUEUE ; STORE ON KB QUEUE +twobyte:; already got EO so get the next character + call KB_waitbyte + cp 053h ; delete + jp z,deletekey ; + cp 01Ch ; return on number pad + jp z,returnkey ; + cp 050h ; + jp z,downarrow ; + cp 04Dh ; + jp z,rightarrow ; + cp 04Bh ; + jp z,leftarrow ; + cp 048h ; + jp z,uparrow ; + cp 052h ; + jp z,insert ; + cp 049h ; + jp z,pageup ; + cp 051h ; + jp z,pagedown ; + cp 047h ; + jp z,home ; + cp 04Fh ; + jp z,end ; + ld a,0 ; returns nothing + ret +home: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'?' ; ? + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'w' ; w + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +end: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'?' ; ? + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'q' ; q + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +downarrow: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'B' ; B + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +rightarrow: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'C' ; C + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +leftarrow: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'D' ; D + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +uparrow: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'A' ; A + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +insert: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'?' ; ? + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'p' ; p + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +pageup: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'?' ; ? + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'y' ; y + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +pagedown: ; + ld a,1BH ; ESC + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'?' ; ? + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ld a,'s' ; s + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +controldown: ; same code as shiftdown but diff location + ld a,0ffh ; + ld (ctrl),a ; control down + ld a,0 ; + ret ; +controlup: ; control key up see shift for explanation + ld a,0 ; + ld (ctrl),a ; + ld a,0 ; + ret ; +returnkey: ; + ld a,13 ; + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +deletekey: ; + ld a,07fh ; delete key value that cp/m uses + CALL KB_ENQUEUE ; STORE ON KB QUEUE + ret ; +capstog: ; + ld a,(capslock) ; + xor 11111111B ; swap all the bits + ld (capslock),a ; + ld a,0 ; returns nothing + ret ; +shiftdown: ; shift is special - hold it down and it autorepeats + ; so once it is down, turn caps on and ignore all further shifts + ; only an F0+shift turns caps lock off again + ld a,0ffh ; + ld (capslock),a ; + ld a,0 ; returns nothing + ret ; +shiftup: ; shiftup turns off caps lock definitely + ld a,0 ; + ld (capslock),a ; + ld a,0 ; returns nothing + ret ; + +;__KB_ENQUEUE______________________________________________________________________________________ +; +; STORE A BYTE IN THE KEYBOARD QUEUE +; A: BYTE TO ENQUEUE +;__________________________________________________________________________________________________ +KB_ENQUEUE: + PUSH DE ; STORE DE + PUSH HL ; STORE HL + PUSH AF ; STORE VALUE + LD A,(KB_QUEUE_PTR); PUT QUEUE POINTER IN A + CP 15 ; IS QUEUE FULL + JP P,KB_ENQUEUE_AB ; YES, ABORT + LD HL,KB_QUEUE ; GET QUEUE POINTER + PUSH HL ; MOVE HL TO BC + POP BC ; + LD H,0 ; ZERO OUT H + LD L,A ; PLACE QUEUE POINTER IN L + ADD HL,BC ; POINT HL AT THE NEXT LOACTION TO ADD VALUE + POP AF ; RESTORE VALUE + LD (HL),A ; ENQUEUE VALUE + LD A,(KB_QUEUE_PTR); GET QUEUE POINTER + INC A ; INC IT + LD (KB_QUEUE_PTR),A; STORE QUEUE POINTER +KB_ENQUEUE_AB: + POP HL ; RESTORE HL + POP DE ; RESTORE DE + RET + + + + +normalkeys: ; The TI character codes, offset from label by keyboard scan code + .db 000,027,"1","2","3","4","5","6","7","8","9","0","-","=",008,009 ;00-0F + .DB "q","w","e","r","t","y","u","i","o","p","[","]",013,000,"a","s" ;10-1F + .DB "d","f","g","h","j","k","l",";",27H,60H,000,092,"z","x","c","v" ;20-2F + .DB "b","n","m",",",".","/",000,000,000," ",000,000,000,000,000,000 ;30-3F + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;40-4F + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;50-5F + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;60-6F + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 ;70-7F + .db 000,027,"!","@","#","$","%","^","&","*","(",")","_","+",008,009 + .DB "Q","W","E","R","T","Y","U","I","O","P","{","}",013,000,"A","S" + .DB "D","F","G","H","J","K","L",":",034,"~",000,"|","Z","X","C","V" + .DB "B","N","M","<",">","?",000,000,000," ",000,000,000,000,000,000 + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + .DB 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + .db 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 + + +; .DB 0,"*", 0,"*","*","*","*","*", 0,"*","*","*","*",09H,"`",00H +; .DB 0, 0, 0, 0, 0,"q","1", 0, 0, 0,"z","s","a","w","2",0 +; .DB 0,"c","x","d","e","4","3", 0, 0," ","v","f","t","r","5",0 +; .DB 0,"n","b","h","g","y","6", 0, 0, 0,"m","j","u","7","8",0 +; .DB 0,",","k","i","o","0","9", 0, 0,".","/","l",";","p","-",0 +; .DB 0, 0,27H, 0,"[","=", 0, 0, 0, 0,0DH,"]", 0,5CH, 0,0 +; .DB 0, 0, 0, 0, 0, 0,08H, 0, 0,11H, 0,13H,10H, 0, 0, 0 +; .DB 0BH,7FH,03H,15H,04H,05H,1BH,00H,"*",02H,18H,16H,0CH,17H,"*",0 +; .DB 0, 0, 0,"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + + + .include "font.asm" + +;__________________________________________________________________________________________________ +; +; RAM STORAGE AREAS +;__________________________________________________________________________________________________ + +ALT_KEYPAD .DB 0 ; ALT KEYPAD ENABLED? +GR_MODE .DB 0 ; GRAPHICS MODE ENABLED? +TERM_X: .DB 0 ; CURSOR X +TERM_Y: .DB 0 ; CURSOR Y +TERMSTATE: .DB 0 ; TERMINAL STATE + ; 0 = NORMAL + ; 1 = ESC RCVD +VDU_DisplayPos: .DW 0 ; CURRENT DISPLAY POSITION +VDU_DISPLAY_START: + .DW 0 ; CURRENT DISPLAY POSITION +capslock .DB 0 ; location for caps lock, either 00000000 or 11111111 +ctrl .DB 0 ; location for ctrl on or off 00000000 or 11111111 +numlock .DB 0 ; location for num lock +skipcount .DB 0 ; only check some calls, speeds up a lot of cp/m + +KB_QUEUE .DB 0,0,0,0,0,0,0,0 ; 16 BYTE KB QUEUE + .DB 0,0,0,0,0,0,0,0 +KB_QUEUE_PTR .DB 0 ; POINTER TO QUEUE +PARKSTACK .DW 0000 ; SAVE STACK POINTER + + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; + .DB 0,0,0,0,0,0,0,0 ; +TERMSTACK: .DB 0 ; + + + .end diff --git a/Source/Apps/Timer.asm b/Source/Apps/Timer.asm deleted file mode 100644 index 867f2e24..00000000 --- a/Source/Apps/Timer.asm +++ /dev/null @@ -1,495 +0,0 @@ -;=============================================================================== -; TIMER - Display system timer value -; -;=============================================================================== -; -; Author: Wayne Warthen (wwarthen@gmail.com) -;_______________________________________________________________________________ -; -; Usage: -; TIMER [/C] [/?] -; ex: TIMER (display current timer value) -; TIMER /? (display version and usage) -; TIMER /C (display timer value continuously) -; -; Operation: -; Reads and displays system timer value. -;_______________________________________________________________________________ -; -; Change Log: -; 2018-01-14 [WBW] Initial release -; 2018-01-17 [WBW] Add HBIOS check -; 2019-11-08 [WBW] Add seconds support -;_______________________________________________________________________________ -; -; ToDo: -;_______________________________________________________________________________ -; -;=============================================================================== -; Definitions -;=============================================================================== -; -stksiz .equ $40 ; Working stack size -; -restart .equ $0000 ; CP/M restart vector -bdos .equ $0005 ; BDOS invocation vector -; -ident .equ $FFFE ; loc of RomWBW HBIOS ident ptr -; -rmj .equ 3 ; intended CBIOS version - major -rmn .equ 0 ; intended CBIOS version - minor -; -bf_sysver .equ $F1 ; BIOS: VER function -bf_sysget .equ $F8 ; HBIOS: SYSGET function -bf_sysgettimer .equ $D0 ; TIMER subfunction -bf_sysgetsecs .equ $D1 ; SECONDS subfunction -; -;=============================================================================== -; Code Section -;=============================================================================== -; - .org $100 -; - ; setup stack (save old value) - ld (stksav),sp ; save stack - ld sp,stack ; set new stack -; - ; initialization - call init ; initialize - jr nz,exit ; abort if init fails -; - ; process - call process ; do main processing - jr nz,exit ; abort on error -; -exit: ; clean up and return to command processor - call crlf ; formatting - ld sp,(stksav) ; restore stack - ;jp restart ; return to CP/M via restart - ret ; return to CP/M w/o restart -; -; Initialization -; -init: - call crlf ; formatting - ld de,msgban ; point to version message part 1 - call prtstr ; print it -; - call idbio ; identify active BIOS - cp 1 ; check for HBIOS - jp nz,errbio ; handle BIOS error -; - ld a,rmj << 4 | rmn ; expected HBIOS ver - cp d ; compare with result above - jp nz,errbio ; handle BIOS error -; -initx - ; initialization complete - xor a ; signal success - ret ; return -; -; Process -; -process: - ; look for start of parms - ld hl,$81 ; point to start of parm area (past len byte) -; -process00: - call nonblank ; skip to next non-blank char - jp z,process0 ; no more parms, go to display -; - ; check for option, introduced by a "/" - cp '/' ; start of options? - jp nz,usage ; yes, handle option - call option ; do option processing - ret nz ; done if non-zero return - jr process00 ; continue looking for options -; -process0: - call crlf2 ; formatting -; -process1: - ld b,bf_sysget ; HBIOS SYSGET function - ld c,bf_sysgettimer ; TIMER subfunction - rst 08 ; call HBIOS, DE:HL := timer value - - ld a,(first) - or a - ld a,0 - ld (first),a - jr nz,process1a - - ; test for new value - ld a,(last) ; last LSB value to A - cp l ; compare to current LSB - jr z,process2 ; if equal, bypass display - -process1a: - ; save and print new value - ld a,l ; new LSB value to A - ld (last),a ; save as last value - call prtcr ; back to start of line - ;call nz,prthex32 ; display it - call prthex32 ; display it - ld de,strtick ; tag - call prtstr ; display it - - ; get and print seconds value - ld b,bf_sysget ; HBIOS SYSGET function - ld c,bf_sysgetsecs ; SECONDS subfunction - rst 08 ; call HBIOS, DE:HL := seconds value - call prthex32 ; display it - ld a,'.' ; fraction separator - call prtchr ; print it - ld a,c ; get fractional component - call prthex ; print it - ld de,strsec ; tag - call prtstr ; display it -; -process2: - ld a,(cont) ; continuous display? - or a ; test for true/false - jr z,process3 ; if false, get out -; - ld c,6 ; BDOS: direct console I/O - ld e,$FF ; input char - call bdos ; call BDOS, A := char - or a ; test for zero - jr z,process1 ; loop until char pressed -; -process3: - xor a ; signal success - ret -; -; Handle special options -; -option: -; - inc hl ; next char - ld a,(hl) ; get it - or a ; zero terminator? - ret z ; done if so - cp ' ' ; blank? - ret z ; done if so - cp '?' ; is it a '?'? - jp z,usage ; yes, display usage - cp 'C' ; is it a 'C', continuous? - jp z,setcont ; yes, set continuous display - jp errprm ; anything else is an error -; -usage: -; - jp erruse ; display usage and get out -; -setcont: -; - or $FF ; set A to true - ld (cont),a ; and set continuous flag - jr option ; check for more option letters -; -; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 -; -idbio: -; - ; Check for UNA (UBIOS) - ld a,($FFFD) ; fixed location of UNA API vector - cp $C3 ; jp instruction? - jr nz,idbio1 ; if not, not UNA - ld hl,($FFFE) ; get jp address - ld a,(hl) ; get byte at target address - cp $FD ; first byte of UNA push ix instruction - jr nz,idbio1 ; if not, not UNA - inc hl ; point to next byte - ld a,(hl) ; get next byte - cp $E5 ; second byte of UNA push ix instruction - jr nz,idbio1 ; if not, not UNA, check others -; - ld bc,$04FA ; UNA: get BIOS date and version - rst 08 ; DE := ver, HL := date -; - ld a,2 ; UNA BIOS id = 2 - ret ; and done -; -idbio1: - ; Check for RomWBW (HBIOS) - ld hl,($FFFE) ; HL := HBIOS ident location - ld a,'W' ; First byte of ident - cp (hl) ; Compare - jr nz,idbio2 ; Not HBIOS - inc hl ; Next byte of ident - ld a,~'W' ; Second byte of ident - cp (hl) ; Compare - jr nz,idbio2 ; Not HBIOS -; - ld b,bf_sysver ; HBIOS: VER function - ld c,0 ; required reserved value - rst 08 ; DE := version, L := platform id -; - ld a,1 ; HBIOS BIOS id = 1 - ret ; and done -; -idbio2: - ; No idea what this is - xor a ; Setup return value of 0 - ret ; and done -; -; Print character in A without destroying any registers -; -prtchr: - push bc ; save registers - push de - push hl - ld e,a ; character to print in E - ld c,$02 ; BDOS function to output a character - call bdos ; do it - pop hl ; restore registers - pop de - pop bc - ret -; -prtdot: -; - ; shortcut to print a dot preserving all regs - push af ; save af - ld a,'.' ; load dot char - call prtchr ; print it - pop af ; restore af - ret ; done -; -prtcr: -; - ; shortcut to print a dot preserving all regs - push af ; save af - ld a,13 ; load CR value - call prtchr ; print it - pop af ; restore af - ret ; done -; -; Print a zero terminated string at (DE) without destroying any registers -; -prtstr: - push de -; -prtstr1: - ld a,(de) ; get next char - or a - jr z,prtstr2 - call prtchr - inc de - jr prtstr1 -; -prtstr2: - pop de ; restore registers - ret -; -; Print the value in A in hex without destroying any registers -; -prthex: - push af ; save AF - push de ; save DE - call hexascii ; convert value in A to hex chars in DE - ld a,d ; get the high order hex char - call prtchr ; print it - ld a,e ; get the low order hex char - call prtchr ; print it - pop de ; restore DE - pop af ; restore AF - ret ; done -; -; print the hex word value in bc -; -prthexword: - push af - ld a,b - call prthex - ld a,c - call prthex - pop af - ret -; -; print the hex dword value in de:hl -; -prthex32: - push bc - push de - pop bc - call prthexword - push hl - pop bc - call prthexword - pop bc - ret -; -; Convert binary value in A to ascii hex characters in DE -; -hexascii: - ld d,a ; save A in D - call hexconv ; convert low nibble of A to hex - ld e,a ; save it in E - ld a,d ; get original value back - rlca ; rotate high order nibble to low bits - rlca - rlca - rlca - call hexconv ; convert nibble - ld d,a ; save it in D - ret ; done -; -; Convert low nibble of A to ascii hex -; -hexconv: - and $0F ; low nibble only - add a,$90 - daa - adc a,$40 - daa - ret -; -; Print value of A or HL in decimal with leading zero suppression -; Use prtdecb for A or prtdecw for HL -; -prtdecb: - push hl - ld h,0 - ld l,a - call prtdecw ; print it - pop hl - ret -; -prtdecw: - push af - push bc - push de - push hl - call prtdec0 - pop hl - pop de - pop bc - pop af - ret -; -prtdec0: - ld e,'0' - ld bc,-10000 - call prtdec1 - ld bc,-1000 - call prtdec1 - ld bc,-100 - call prtdec1 - ld c,-10 - call prtdec1 - ld e,0 - ld c,-1 -prtdec1: - ld a,'0' - 1 -prtdec2: - inc a - add hl,bc - jr c,prtdec2 - sbc hl,bc - cp e - ret z - ld e,0 - call prtchr - ret -; -; Start a new line -; -crlf2: - call crlf ; two of them -crlf: - push af ; preserve AF - ld a,13 ; - call prtchr ; print it - ld a,10 ; - call prtchr ; print it - pop af ; restore AF - ret -; -; Get the next non-blank character from (HL). -; -nonblank: - ld a,(hl) ; load next character - or a ; string ends with a null - ret z ; if null, return pointing to null - cp ' ' ; check for blank - ret nz ; return if not blank - inc hl ; if blank, increment character pointer - jr nonblank ; and loop -; -; Convert character in A to uppercase -; -ucase: - cp 'a' ; if below 'a' - ret c ; ... do nothing and return - cp 'z' + 1 ; if above 'z' - ret nc ; ... do nothing and return - res 5,a ; clear bit 5 to make lower case -> upper case - ret ; and return -; -; Add the value in A to HL (HL := HL + A) -; -addhl: - add a,l ; A := A + L - ld l,a ; Put result back in L - ret nc ; if no carry, we are done - inc h ; if carry, increment H - ret ; and return -; -; Jump indirect to address in HL -; -jphl: - jp (hl) -; -; Errors -; -erruse: ; command usage error (syntax) - ld de,msguse - jr err -; -errprm: ; command parameter error (syntax) - ld de,msgprm - jr err -; -errbio: ; invalid BIOS or version - ld de,msgbio - jr err -; -err: ; print error string and return error signal - call crlf2 ; print newline -; -err1: ; without the leading crlf - call prtstr ; print error string -; -err2: ; without the string -; call crlf ; print newline - or $FF ; signal error - ret ; done -; -;=============================================================================== -; Storage Section -;=============================================================================== -; -last .db 0 ; last LSB of timer value -cont .db 0 ; non-zero indicates continuous display -first .db $FF ; first pass flag (true at start) -; -stksav .dw 0 ; stack pointer saved at start - .fill stksiz,0 ; stack -stack .equ $ ; stack top -; -; Messages -; -msgban .db "TIMER v1.1, 10-Nov-2019",13,10 - .db "Copyright (C) 2019, Wayne Warthen, GNU GPL v3",0 -msguse .db "Usage: TIMER [/C] [/?]",13,10 - .db " ex. TIMER (display current timer value)",13,10 - .db " TIMER /? (display version and usage)",13,10 - .db " TIMER /C (display timer value continuously)",0 -msgprm .db "Parameter error (TIMER /? for usage)",0 -msgbio .db "Incompatible BIOS or version, " - .db "HBIOS v", '0' + rmj, ".", '0' + rmn, " required",0 -strtick .db " Ticks, ",0 -strsec .db " Seconds",0 -; - .end diff --git a/Source/Apps/Tune/Build.cmd b/Source/Apps/Tune/Build.cmd index 568f73dc..6c601548 100644 --- a/Source/Apps/Tune/Build.cmd +++ b/Source/Apps/Tune/Build.cmd @@ -5,9 +5,9 @@ set TOOLS=../../../Tools set PATH=%TOOLS%\tasm32;%PATH% set TASMTABS=%TOOLS%\tasm32 -tasm -t180 -g3 -fFF Tune.asm Tune.com Tune.lst +tasm -t180 -g3 -fFF -dWBW tune.asm tune.com tune.lst || exit /b +tasm -t180 -g3 -fFF -dZX tune.asm tunezx.com tunezx.lst || exit /b +tasm -t180 -g3 -fFF -dMSX tune.asm tunemsx.com tunemsx.lst || exit /b -if errorlevel 1 goto :eof - -copy /Y Tune.com ..\..\..\Binary\Apps\ -copy /Y Tunes\*.* ..\..\..\Binary\Apps\Tunes\ \ No newline at end of file +copy /Y tune*.com ..\..\..\Binary\Apps\ || exit /b +copy /Y Tunes\*.* ..\..\..\Binary\Apps\Tunes\ || exit /b \ No newline at end of file diff --git a/Source/Apps/Tune/Makefile b/Source/Apps/Tune/Makefile index 3aa5c338..e01b796e 100644 --- a/Source/Apps/Tune/Makefile +++ b/Source/Apps/Tune/Makefile @@ -1,11 +1,19 @@ -OBJECTS = Tune.com +OBJECTS = tune.com tunezx.com tunemsx.com DEST = ../../../Binary/Apps TOOLS = ../../../Tools include $(TOOLS)/Makefile.inc -Tune.com: Tune.asm - $(TASM) Tune.asm Tune.com +DEPS := tune.asm $(shell find . -name '*.inc') + +tune.com: $(DEPS) + $(TASM) -dWBW tune.asm tune.com tune.lst + +tunezx.com: $(DEPS) + $(TASM) -dZX tune.asm tunezx.com tunezx.lst + +tunemsx.com: $(DEPS) + $(TASM) -dMSX tune.asm tunemsx.com tunemsx.lst all:: mkdir -p $(DEST)/Tunes diff --git a/Source/Apps/Tune/Tune.asm b/Source/Apps/Tune/Tune.asm deleted file mode 100644 index 73fe5b0e..00000000 --- a/Source/Apps/Tune/Tune.asm +++ /dev/null @@ -1,2693 +0,0 @@ -;=============================================================================== -; TUNE - Play PT2/PT3/MYM sound files -; -;=============================================================================== -; -; Author: Wayne Warthen (wwarthen@gmail.com) -; -; This application is basically just a RomWBW wrapper for the -; Universal PT2 and PT3 player by S.V.Bulba and the MYM player -; by Marq/Lieves!Tuore. See comments below. -;_______________________________________________________________________________ -; -; Usage: -; TUNE -; -; of sound file to load and play -; Filename extension determines file type (.PT2, .PT3, or .MYM) -; -; Notes: -; - Supports AY-3-8910, YM2149, etc. -; - Plays PT2, PT3, or MYM format files. File extension (.PT2, .PT3, or .MYM) -; determines file type. -; - Max Z80 CPU clock is about 8MHz or sound chip will not handle speed. -; - Higher CPU clock speeds are possible on Z180 because extra I/O -; wait states are added during I/O to sound chip. -; - Uses hardware timer support on systems that support a timer. Otherwise, -; a delay loop calibrated to CPU speed is used. -; - Delay loop is calibrated to CPU speed, but it does not compensate for -; time variations in each quark loop resulting from data decompression. -; An average quark processing time is assumed in each loop. -; - Most sound files originally targeted MSX or ZX Spectrum which used -; 1.7897725 MHz and 1.773400 MHz respectively for the PSG clock. For best -; sound playback, PSG should be run at approx. this clock rate. -;_______________________________________________________________________________ -; -; Change Log: -; 2018-01-26 [WBW] Initial release -; 2018-01-28 [WBW] Added support for MYM sound files -; 2019-11-21 [WBW] Added table-driven configuration -; 2020-02-11 [WBW] Made hardware config & detection more flexible -; 2020-03-29 [WBW] Fix error in Z180 I/O W/S bracketing -;_______________________________________________________________________________ -; -; ToDo: -; 1) Add an option to play file in a continuous loop? -;_______________________________________________________________________________ -; -;=============================================================================== -; Main program -;=============================================================================== -; -RESTART .EQU $0000 ; CP/M restart vector -BDOS .EQU $0005 ; BDOS invocation vector -; -IDENT .EQU $FFFE ; loc of RomWBW HBIOS ident ptr -; -RMJ .EQU 3 ; intended CBIOS version - major -RMN .EQU 0 ; intended CBIOS version - minor -; -BF_SYSVER .EQU $F1 ; BIOS: VER function -BF_SYSGET .EQU $F8 ; HBIOS: SYSGET function -; -FCB .EQU $5C ; Location of default FCB -; -HEAPEND .EQU $C000 ; End of heap storage -; -TYPPT2 .EQU 1 ; FILTYP value for PT2 sound file -TYPPT3 .EQU 2 ; FILTYP value for PT3 sound file -TYPMYM .EQU 3 ; FILTYP value for MYM sound file -; -; -; - .ORG $0100 -; - CALL CRLF - LD DE,MSGBAN ; Point to banner message - CALL PRTSTR ; Print message -; - ; Check BIOS and version - CALL IDBIO ; Identify hardware BIOS - CP 1 ; RomWBW HBIOS? - JP NZ,ERRBIO ; If not, handle BIOS error - LD A,RMJ << 4 | RMN ; Expected HBIOS ver - CP D ; Compare with result above - JP NZ,ERRBIO ; Handle BIOS error - LD A,L ; Platform id to A - LD (CURPLT),A ; Save as current platform id -; - LD HL,CFGTBL ; Point to start of config table -CFGSEL: - LD A,$FF ; End of table marker - CP (HL) ; Compare - JP Z,ERRHW ; Bail out if no more configs to try -; - LD BC,CFGSIZ ; Size of one entry - LD DE,CFG ; Active config structure - LDIR ; Update active config structure -; - LD A,(CURPLT) ; Get current running platform id - LD E,A ; Put in E - LD A,(PLT) ; Get platform id of loaded config - CP E ; Equal? - JR NZ,CFGSEL ; If no match keep trying -; - ; Activate card if applicable - CALL SLOWIO ; Slow down I/O now - LD A,(ACR) ; Get ACR port address (if any) - INC A ; $FF -> $00 & set flags - JR Z,PROBE ; Skip ahead to probe if no ACR - DEC A ; Restore real ACR port address - LD C,A ; Put in C for I/O - LD A,$FF ; Value to activate card - OUT (C),A ; Write value to ACR -; -PROBE: - ; Test for hardware (sound chip detection) - LD DE,(PORTS) ; D := RDAT, E := RSEL - LD C,E ; Port = RSEL - LD A,2 ; Register 2 - OUT (C),A ; Select register 2 - LD C,D ; Port = RDAT - LD A,$AA ; Value = $AA - OUT (C),A ; Write $AA to register 2 - LD A,(RIN) ; Port = RIN - LD C,A ; ... to C - IN A,(C) ; Read back value in register 2 - CP $AA ; Value as written? - PUSH AF ; Save AF - CALL NORMIO ; Back to normal I/O speeds - POP AF ; Recover AF - JR Z,MAT ; Hardware matched! - JR CFGSEL ; And keep trying -; -MAT: - ; Hardware matched! - CALL CRLF ; Formatting - LD DE,(DESC) ; Load hardware description pointer - CALL PRTSTR ; Print description -; - ; Test for timer running to determine if it can be used for delay - LD B,BF_SYSGET ; HBIOS: GET function - LD C,$D0 ; TIMER subfunction - RST 08 ; DE:HL := current tick count - LD A,L ; DE:HL == 0? - OR H - OR E - OR D - LD A,0 ; Assume no timer - LD DE,MSGDLY ; Delay mode msg - JR Z,SETDLY ; If tick count is zero, no timer active - LD A,$FF ; Value for timer active - LD DE,MSGTIM ; Timer mode msg -SETDLY: - LD (WMOD),A ; Save wait mode - CALL PRTSTR ; Print it -; - ; Get CPU speed & type from RomWBW HBIOS and compute quark delay factor - LD B,$F8 ; HBIOS SYSGET function 0xF8 - LD C,$F0 ; CPUINFO subfunction 0xF0 - RST 08 ; Do it, DE := CPU speed in KHz - SRL D ; Divide by 2 - RR E ; ... for delay factor - EX DE,HL ; Move result to HL - LD (QDLY),HL ; Save result as quark delay factor -; - ; Clear heap storage - LD HL,HEAP ; Point to heap start - XOR A ; A := zero - LD (HEAP),A ; Clear first byte of heap - LD DE,HEAP+1 ; Set dest to next byte - LD BC,HEAPEND-HEAP-1 ; Size of heap except first byte - LDIR ; Propagate zero to rest of heap -; - ; Check sound filename (must be *.PT2, *.PT3, or *.MYM) - LD A,(FCB+1) ; Get first char of filename - CP ' ' ; Compare to blank - JP Z,ERRCMD ; If so, missing filename - LD A,(FCB+9) ; If the filetype - CP ' ' ; is blanks - JR NZ,HASEXT ; then assume - LD A,'P' ; type PT3. - LD (FCB+9),A - LD A,'T' ; Fill in - LD (FCB+10),A ; the file - LD A,'3' ; extension - LD (FCB+11),A ; and the - LD C,TYPPT3 ; file type - JR _SET -HASEXT LD A,(FCB+9) ; Extension char 1 - CP 'P' ; Check for 'P' - JP NZ,CHKMYM ; If not, check for MYM extension - LD A,(FCB+10) ; Extension char 2 - CP 'T' ; Check for 'T' - JP NZ,ERRNAM ; If not, bad file extension - LD A,(FCB+11) ; Extension char 3 - LD C,TYPPT2 ; Assume PT2 file type - CP '2' ; Check for '2' - JR Z,_SET ; If so, commit file type value - LD C,TYPPT3 ; Assume PT3 file type - CP '3' ; Check for '3' - JR Z,_SET ; If so, commit file type value - JP ERRNAM ; Anything else is a bad file extension -CHKMYM LD A,(FCB+9) ; Extension char 1 - CP 'M' ; Check for 'M' - JP NZ,ERRNAM ; If not, bad file extension - LD A,(FCB+10) ; Extension char 2 - CP 'Y' ; Check for 'Y' - JP NZ,ERRNAM ; If not, bad file extension - LD A,(FCB+11) ; Extension char 3 - LD C,TYPMYM ; Assume MYM file type - CP 'M' ; Check for 'M' - JR Z,_SET ; If so, commit file type value - JP ERRNAM ; Anything else is a bad file extension -_SET LD A,C ; Get file type value - LD (FILTYP),A ; Save file type value -; - ; Load sound file -_LD0 LD C,15 ; CPM Open File function - LD DE,FCB ; FCB - CALL BDOS ; Do it - INC A ; Test for error $FF - JP Z,ERRFIL ; Handle file error -; - LD A,(FILTYP) ; Get file type - LD HL,MDLADDR ; Assume load address - LD (DMA),HL ; ... for PTx files - CP TYPMYM ; MYM file? - JR NZ,_LD ; If not, all set - LD HL,rows ; Otherwise, load address - LD (DMA),HL ; ... for MYM files -; -_LD LD HL,(DMA) ; Get load address - PUSH HL ; Save it - LD DE,128 ; Bump by size of - ADD HL,DE ; ... one record - LD (DMA),HL ; Save for next loop - LD A,HEAPEND >> 8 ; A := page limit for load - CP H ; Check to see if limit hit - JP Z,ERRSIZ ; Handle size error - POP DE ; Restore current DMA to DE - LD C,26 ; CPM Set DMA function - CALL BDOS ; Read next 128 bytes -; - LD C,20 ; CPM Read Sequential function - LD DE,FCB ; FCB - CALL BDOS ; Read next 128 bytes - OR A ; Set flags to check EOF - JR NZ,_LDX ; Non-zero is EOF - JR Z,_LD ; Load loop -; -_LDX LD C,16 ; CPM Close File function - LD DE,FCB ; FCB - CALL BDOS ; Do it -; - ; Play loop - CALL CRLF2 ; Formatting - LD DE,MSGPLY ; Playing message - CALL PRTSTR ; Print message - ;CALL CRLF2 ; Formatting - ;CALL SLOWCPU - LD A,(FILTYP) ; Get file type - CP TYPPT2 ; PT2? - JR Z,GOPT2 ; If so, do it - CP TYPPT3 ; PT3? - JR Z,GOPT3 ; If so, do it - CP TYPMYM ; MYM? - JR Z,gomym ; If so, do it - JP ERRNAM ; This should never happen - -GOPT2 LD A,2 ; SETUP value to PT2 sound files - LD (START+10),A ; Save it - ; Avg TS / quark for PT2 files has *not* been measured!!! - LD DE,185 ; Avg TS / quark = 7400, so 185 delay loops - JR GOPTX ; Play PTx file - -GOPT3 LD A,0 ; SETUP value to PT3 sound files - LD (START+10),A ; Save it - LD DE,185 ; Avg TS / quark = 7400, so 185 delay loops - JR GOPTX ; Play PTx file - -GOPTX LD HL,(QDLY) ; Get basic quark delay - OR A ; Clear carry - SBC HL,DE ; Adjust for file type - LD (QDLY),HL ; Save updated quark delay factor - CALL START ; Do initialization -PTXLP CALL START+5 ; Play one quark - LD A,(START+10) ; Get setup byte - BIT 7,A ; Check bit 7 (loop point passed) - JR NZ,EXIT ; Bail out when done playing - CALL GETKEY ; Check for keypress - JR NZ,EXIT ; Abort on keypress - ;LD A,13 ; Back to - ;CALL PRTCHR ; ... start of line - ;LD A,(CurPos) ; Get current position - ;CALL PRTHEX ; ... and display it - CALL WAITQ ; Wait one quark period - JR PTXLP ; Loop for next quark -; -gomym ld hl,(QDLY) ; Get basic quark delay - or a ; Clear carry - ld de,125 ; Avg TS / quark = ~5000, so 125 delay loops - sbc hl,de ; Adjust for file type - ld (QDLY),hl ; Save updated quark delay factor - ;ld bc,(rows) - ;call PRTHEXWORD - call mymini ; Initialize player - call extract ; Unpack the first fragment -mymlp call extract - jr nc,EXIT ; CF clear at end of tune -waitvb call WAITQ - call upsg ; Update PSG registers - call GETKEY ; Check for keypess - jr nz,EXIT ; Bail out if so - ld a,(played) ; Wait until VBI has played a fragment - or a - jr nz,waitvb - ld (psource),iy - ld a,FRAG - ld (played),a - ;call PRTDOT - jr mymlp -; -EXIT CALL START+8 ; Mute audio - ;CALL NORMCPU - ;CALL CRLF2 ; Formatting - LD DE,MSGEND ; Completion message - CALL PRTSTR ; Print message - CALL CRLF ; Formatting - JP 0 ; Exit the easy way -; -; Wait for quark play time. Can use hardware timer if -; supported by hardware or simple delay loop otherwise. -; Delay loop requires QDLY to be pre-set to to achieve -; optimal 20ms wait time. -; -WAITQ LD A,(WMOD) ; Get delay mode - OR A ; Set flags - JR Z,DLY ; Delay mode -; - ; Timer loop - CALL TIM2 ; Read timer LSB into A - LD C,A ; Init prev value -TIM1 PUSH BC ; Save prev value - CALL TIM2 ; Read timer LSB into A - POP BC ; Recover prev value - CP C ; Compare to prev - RET NZ ; Done if changed - JR TIM1 ; Else, loop -; -TIM2 LD B,$F8 ; BIOS SYSGET function - LD C,$D0 ; TIMER sub-function - RST 08 ; Call BIOS - LD A,L ; MSB to A - RET ; Return to loop -; - ; Delay spin loop (40 tstates per loop) -DLY LD BC,(QDLY) ; Load quark delay factor -DLY1 DEC BC ; [6] - NOP ; [4] - NOP ; [4] - NOP ; [4] - NOP ; [4] - LD A,B ; [4] - OR C ; [4] - JP NZ,DLY1 ; [10] - RET -; -; Get a keystroke from CPM -; -GETKEY LD C,6 ; BDOS direct I/O - LD E,$FF ; Get character if available - CALL BDOS ; Call BDOS - OR A ; Set flags, Z set if no key - RET ; Done -; -; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 -; -IDBIO: -; - ; Check for UNA (UBIOS) - LD A,($FFFD) ; fixed location of UNA API vector - CP $C3 ; jp instruction? - JR NZ,IDBIO1 ; if not, not UNA - LD HL,($FFFE) ; get jp address - LD A,(HL) ; get byte at target address - CP $FD ; first byte of UNA push ix instruction - JR NZ,IDBIO1 ; if not, not UNA - INC HL ; point to next byte - LD A,(HL) ; get next byte - CP $E5 ; second byte of UNA push ix instruction - JR NZ,IDBIO1 ; if not, not UNA, check others -; - LD BC,$04FA ; UNA: get BIOS date and version - RST 08 ; DE := ver, HL := date -; - LD A,2 ; UNA BIOS id = 2 - RET ; and done -; -IDBIO1: - ; Check for RomWBW (HBIOS) - LD HL,($FFFE) ; HL := HBIOS ident location - LD A,'W' ; First byte of ident - CP (HL) ; Compare - JR NZ,IDBIO2 ; Not HBIOS - INC HL ; Next byte of ident - LD A,~'W' ; Second byte of ident - CP (HL) ; Compare - JR NZ,IDBIO2 ; Not HBIOS -; - LD B,BF_SYSVER ; HBIOS: VER function - LD C,0 ; required reserved value - RST 08 ; DE := version, L := platform id -; - LD A,1 ; HBIOS BIOS id = 1 - RET ; and done -; -IDBIO2: - ; No idea what this is - XOR A ; Setup return value of 0 - RET ; and done -; -; -; -SLOWCPU: - LD A,(Z180) ; Z180 base I/O port - CP $FF ; Check for no value - RET Z ; Bail out if no value - ADD A,$1E ; Apply offset of CMR register - LD C,A ; And put it in C - LD B,0 ; MSB for 16-bit I/O - IN A,(C) ; Get current value - LD (CMRSAV),A ; Save it to restore later - XOR A ; Go slow - OUT (C),A ; And update CMR - INC C ; Now point to CCR register - IN A,(C) ; Get current value - LD (CCRSAV),A ; Save it to restore later - XOR A ; Go slow - OUT (C),A ; And update CCR - RET -; -; -; -NORMCPU: - LD A,(Z180) ; Z180 base I/O port - CP $FF ; Check for no value - RET Z ; Bail out if no value - ADD A,$1E ; Apply offset of CMR register - LD C,A ; And put it in C - LD B,0 ; MSB for 16-bit I/O - LD A,(CMRSAV) ; Get original CMR value - OUT (C),A ; And update CMR - INC C ; Now point to CCR register - LD A,(CCRSAV) ; Get original CCR value - OUT (C),A ; And update CCR - RET -; -; -; -SLOWIO: - LD A,(Z180) ; Z180 base I/O port - CP $FF ; Check for no value - RET Z ; Bail out if no value - ADD A,$32 ; Apply offset of DCNTL register - LD C,A ; And put it in C - LD B,0 ; MSB for 16-bit I/O - IN A,(C) ; Get current value - LD (DCSAV),A ; Save it to restore later - OR %00110000 ; Force slow operation (I/O W/S=3) - OUT (C),A ; And update DCNTL - RET -; -; -; -NORMIO: - LD A,(Z180) ; Z180 base I/O port - CP $FF ; Check for no value - RET Z ; Bail out if no value - ADD A,$32 ; Apply offset of DCNTL register - LD C,A ; And put it in C - LD B,0 ; MSB for 16-bit I/O - LD A,(DCSAV) ; Get saved DCNTL value - OUT (C),A ; And restore it - RET -; -; Print character in A without destroying any registers -; -PRTCHR: - PUSH BC ; save registers - PUSH DE - PUSH HL - LD E,A ; character to print in E - LD C,$02 ; BDOS function to output a character - CALL BDOS ; do it - POP HL ; restore registers - POP DE - POP BC - RET -; -PRTDOT: -; - ; shortcut to print a dot preserving all regs - PUSH AF ; save af - LD A,'.' ; load dot char - CALL PRTCHR ; print it - POP AF ; restore af - RET ; done -; -PRTCR: -; - ; shortcut to print a dot preserving all regs - PUSH AF ; save af - LD A,13 ; load CR value - CALL PRTCHR ; print it - POP AF ; restore af - RET ; done -; -; Print a zero terminated string at (DE) without destroying any registers -; -PRTSTR: - PUSH DE -; -PRTSTR1: - LD A,(DE) ; get next char - OR A - JR Z,PRTSTR2 - CALL PRTCHR - INC DE - JR PRTSTR1 -; -PRTSTR2: - POP DE ; restore registers - RET -; -; Print the value in A in hex without destroying any registers -; -PRTHEX: - PUSH AF ; save AF - PUSH DE ; save DE - CALL HEXASCII ; convert value in A to hex chars in DE - LD A,D ; get the high order hex char - CALL PRTCHR ; print it - LD A,E ; get the low order hex char - CALL PRTCHR ; print it - POP DE ; restore DE - POP AF ; restore AF - RET ; done -; -; print the hex word value in bc -; -PRTHEXWORD: - PUSH AF - LD A,B - CALL PRTHEX - LD A,C - CALL PRTHEX - POP AF - RET -; -; print the hex dword value in de:hl -; -PRTHEX32: - PUSH BC - PUSH DE - POP BC - CALL PRTHEXWORD - PUSH HL - POP BC - CALL PRTHEXWORD - POP BC - RET -; -; Convert binary value in A to ascii hex characters in DE -; -HEXASCII: - LD D,A ; save A in D - CALL HEXCONV ; convert low nibble of A to hex - LD E,A ; save it in E - LD A,D ; get original value back - RLCA ; rotate high order nibble to low bits - RLCA - RLCA - RLCA - CALL HEXCONV ; convert nibble - LD D,A ; save it in D - RET ; done -; -; Convert low nibble of A to ascii hex -; -HEXCONV: - AND $0F ; low nibble only - ADD A,$90 - DAA - ADC A,$40 - DAA - RET -; -; Print value of A or HL in decimal with leading zero suppression -; Use prtdecb for A or prtdecw for HL -; -PRTDECB: - PUSH HL - LD H,0 - LD L,A - CALL PRTDECW ; print it - POP HL - RET -; -PRTDECW: - PUSH AF - PUSH BC - PUSH DE - PUSH HL - CALL PRTDEC0 - POP HL - POP DE - POP BC - POP AF - RET -; -PRTDEC0: - LD E,'0' - LD BC,-10000 - CALL PRTDEC1 - LD BC,-1000 - CALL PRTDEC1 - LD BC,-100 - CALL PRTDEC1 - LD C,-10 - CALL PRTDEC1 - LD E,0 - LD C,-1 -PRTDEC1: - LD A,'0' - 1 -PRTDEC2: - INC A - ADD HL,BC - JR C,PRTDEC2 - SBC HL,BC - CP E - RET Z - LD E,0 - CALL PRTCHR - RET -; -; Start a new line -; -CRLF2: - CALL CRLF ; two of them -CRLF: - PUSH AF ; preserve AF - LD A,13 ; - CALL PRTCHR ; print it - LD A,10 ; - CALL PRTCHR ; print it - POP AF ; restore AF - RET -; -; ADD HL,A -; -; A REGISTER IS DESTROYED! -; -ADDHLA: - ADD A,L - LD L,A - RET NC - INC H - RET -; -ERRBIO: ; Invalid BIOS or version - LD DE,MSGBIO - JR ERR -; -ERRPLT: ; Invalid BIOS or version - LD DE,MSGPLT - JR ERR -; -ERRHW: ; Hardware error, sound chip not detected - LD DE,MSGHW - JR ERR -; -ERRCMD: ; Command error, display usage info - LD DE,MSGUSE - JR ERR -; -ERRNAM: ; Missing or invalid filename parameter - LD DE,MSGNAM - JR ERR -; -ERRFIL: ; Error opening sound file - LD DE,MSGFIL - JR ERR -; -ERRSIZ: ; Sound file is too large for memory - LD DE,MSGSIZ - JR ERR -; -ERR: ; print error string and return error signal - CALL CRLF2 ; print newline -; -ERR1: ; without the leading crlf - CALL PRTSTR ; print error string -; -ERR2: ; without the string - CALL CRLF ; print newline - JP 0 ; fast exit -; -; CONFIG TABLE, ENTRY ORDER MATCHES HBIOS PLATFORM ID -; -CFGSIZ .EQU 8 -; -CFGTBL: ; PLT RSEL RDAT RIN Z180 ACR - ; DESC - .DB $01, $9A, $9B, $9A, $FF, $9C ; SBC W/ SCG - .DW HWSTR_SCG -; - .DB $04, $9C, $9D, $9C, $40, $FF ; N8 W/ ONBOARD PSG - .DW HWSTR_N8 -; - .DB $05, $9A, $9B, $9A, $40, $9C ; MK4 W/ SCG - .DW HWSTR_SCG -; - .DB $07, $D8, $D0, $D8, $FF, $FF ; RCZ80 W/ RC SOUND MODULE (EB) - .DW HWSTR_RCEB -; - .DB $07, $D1, $D0, $D0, $FF, $FF ; RCZ80 W/ RC SOUND MODULE (MF) - .DW HWSTR_RCMF -; - .DB $08, $68, $60, $68, $C0, $FF ; RCZ180 W/ RC SOUND MODULE (EB) - .DW HWSTR_RCEB -; - .DB $08, $61, $60, $60, $C0, $FF ; RCZ180 W/ RC SOUND MODULE (MF) - .DW HWSTR_RCMF -; - .DB $09, $D8, $D0, $D8, $FF, $FF ; EZZ80 W/ RC SOUND MODULE (EB) - .DW HWSTR_RCEB -; - .DB $09, $D1, $D0, $D0, $FF, $FF ; EZZ80 W/ RC SOUND MODULE (EB) - .DW HWSTR_RCMF -; - .DB $0A, $68, $60, $68, $C0, $FF ; SCZ180 W/ RC SOUND MODULE (EB) - .DW HWSTR_RCEB -; - .DB $0A, $61, $60, $60, $C0, $FF ; SCZ180 W/ RC SOUND MODULE (MF) - .DW HWSTR_RCMF -; - .DB $FF ; END OF TABLE MARKER -; -CFG: ; ACTIVE CONFIG VALUES (FROM SELECTED CFGTBL ENTRY) -PLT .DB 0 ; RomWBW HBIOS platform id -PORTS: -RSEL .DB 0 ; Register selection port -RDAT .DB 0 ; Register data port -RIN .DB 0 ; Register input port -Z180 .DB 0 ; Z180 base I/O port -ACR .DB 0 ; Aux Ctrl Reg I/O port on SCG -DESC .DW 0 ; Hardware description string adr -; -CURPLT .DB 0 ; Current platform id reported by HBIOS -QDLY .DW 0 ; quark delay factor -WMOD .DB 0 ; delay mode, non-zero to use timer -DCSAV .DB 0 ; for saving original Z180 DCNTL value -CCRSAV .DB 0 ; for saving original Z180 CCR value -CMRSAV .DB 0 ; for saving original Z180 CMR value -; -DMA .DW 0 ; Working DMA -FILTYP .DB 0 ; Sound file type (TYPPT2, TYPPT3, TYPMYM) -; -TMP .DB 0 ; work around use of undocumented Z80 -; - -MSGBAN .DB "Tune Player for RomWBW v2.5, 29-Mar-2020",0 -MSGUSE .DB "Copyright (C) 2020, Wayne Warthen, GNU GPL v3",13,10 - .DB "PTxPlayer Copyright (C) 2004-2007 S.V.Bulba",13,10 - .DB "MYMPlay by Marq/Lieves!Tuore",13,10,13,10 - .DB "Usage: TUNE .[PT2|PT3|MYM]",0 -MSGBIO .DB "Incompatible BIOS or version, " - .DB "HBIOS v", '0' + RMJ, ".", '0' + RMN, " required",0 -MSGPLT .DB "Hardware error, system not supported!",0 -MSGHW .DB "Hardware error, sound chip not detected!",0 -MSGNAM .DB "Sound filename invalid (must be .PT2, .PT3, or .MYM)",0 -MSGFIL .DB "Sound file not found!",0 -MSGSIZ .DB "Sound file too large to load!",0 -MSGTIM .DB ", timer mode",0 -MSGDLY .DB ", delay mode",0 -MSGPLY .DB "Playing...",0 -MSGEND .DB " Done",0 -; -HWSTR_SCG .DB "SCG ECB Board",0 -HWSTR_N8 .DB "N8 Onboard Sound",0 -HWSTR_RCEB .DB "RC2014 Sound Module (EB)",0 -HWSTR_RCMF .DB "RC2014 Sound Module (MF)",0 -; -;=============================================================================== -; PTx Player Routines -;=============================================================================== -; -;Universal PT2 and PT3 player for ZX Spectrum and MSX -;(c)2004-2007 S.V.Bulba -;http://bulba.untergrund.net (http://bulba.at.kz) - -;Release number -;Release .EQU "1" -#DEFINE Release "1" - -;Conditional assembly -;1) Version of ROUT (ZX or MSX standards) -ZX .EQU 0 -MSX .EQU 0 -WBW .EQU 1 -;2) Current position counter at (START+11) -CurPosCounter .EQU 0 -;3) Allow channels allocation bits at (START+10) -ACBBAC .EQU 0 -;4) Allow loop checking and disabling -LoopChecker .EQU 1 -;5) Insert official identificator -Id .EQU 1 - -;Features -;-------- -;-Can be compiled at any address (i.e. no need rounding ORG -; address). -;-Variables (VARS) can be located at any address (not only after -;code block). -;-INIT subprogram checks PT3-module version and rightly -; generates both note and volume tables outside of code block -; (in VARS). -;-Two portamento (spc. command 3xxx) algorithms (depending of -; PT3 module version). -;-New 1.XX and 2.XX special command behaviour (only for PT v3.7 -; and higher). -;-Any Tempo value are accepted (including Tempo=1 and Tempo=2). -;-Fully compatible with Ay_Emul PT3 and PT2 players codes. -;-See also notes at the end of this source code. - -;Limitations -;----------- -;-Can run in RAM only (self-modified code is used). -;-PT2 position list must be end by $FF marker only. - -;Warning!!! PLAY subprogram can crash if no module are loaded -;into RAM or INIT subprogram was not called before. - -;Call MUTE or INIT one more time to mute sound after stopping -;playing - - ;ORG $C000 -;Test codes (commented) -; LD A,2 ;PT2,ABC,Looped -; LD (START+10),A -; CALL START -; EI -;_LP HALT -; CALL START+5 -; XOR A -; IN A,($FE) -; CPL -; AND 15 -; JR Z,_LP -; JR START+8 - -TonA .EQU 0 -TonB .EQU 2 -TonC .EQU 4 -Noise .EQU 6 -Mixer .EQU 7 -AmplA .EQU 8 -AmplB .EQU 9 -AmplC .EQU 10 -Env .EQU 11 -EnvTp .EQU 13 - -;ChannelsVars -; STRUCT CHP -;reset group -PsInOr .EQU 0 -PsInSm .EQU 1 -CrAmSl .EQU 2 -CrNsSl .EQU 3 -CrEnSl .EQU 4 -TSlCnt .EQU 5 -CrTnSl .EQU 6 -TnAcc .EQU 8 -COnOff .EQU 10 -;reset group - -OnOffD .EQU 11 - -;IX for PTDECOD here (+12) -OffOnD .EQU 12 -OrnPtr .EQU 13 -SamPtr .EQU 15 -NNtSkp .EQU 17 -Note .EQU 18 -SlToNt .EQU 19 -Env_En .EQU 20 -Flags .EQU 21 - ;Enabled - 0,SimpleGliss - 2 -TnSlDl .EQU 22 -TSlStp .EQU 23 -TnDelt .EQU 25 -NtSkCn .EQU 27 -Volume .EQU 28 -; ENDS -CHP .EQU 29 - -;Entry and other points -;START initialize playing of module at MDLADDR -;START+3 initialization with module address in HL -;START+5 play one quark -;START+8 mute -;START+10 setup and status flags -;START+11 current position value (byte) (optional) - -START - LD HL,MDLADDR - JR INIT - JP PLAY - JR MUTE -SETUP .DB 0 ;set bit0, if you want to play without looping - ;(optional); - ;set bit1 for PT2 and reset for PT3 before - ;calling INIT; - ;bits2-3: %00-ABC, %01 ACB, %10 BAC (optional); - ;bits4-6 are not used - ;bit7 is set each time, when loop point is passed - ;(optional) -#IF CurPosCounter -CurPos .DB 0 ;for visualization only (i.e. no need for playing) -#ENDIF - -;Identifier - .IF Id - .DB "=Uni PT2 and PT3 Player r.",Release,"=" - .ENDIF - - .IF LoopChecker -CHECKLP LD HL,SETUP - SET 7,(HL) - BIT 0,(HL) - RET Z - POP HL - LD HL,DelyCnt - INC (HL) - LD HL,ChanA+NtSkCn - INC (HL) - .ENDIF - -MUTE XOR A - LD H,A - LD L,A - LD (AYREGS+AmplA),A - LD (AYREGS+AmplB),HL - JP ROUT - -INIT -;HL - AddressOfModule - LD A,(START+10) - AND 2 - JR NZ,INITPT2 - - CALL SETMDAD - PUSH HL - LD DE,100 - ADD HL,DE - LD A,(HL) - LD (Delay),A - PUSH HL - POP IX - ADD HL,DE - LD (CrPsPtr),HL - LD E,(IX+102-100) - INC HL - -#IF CurPosCounter - LD A,L - LD (PosSub+1),A -#ENDIF - - ADD HL,DE - LD (LPosPtr),HL - POP DE - LD L,(IX+103-100) - LD H,(IX+104-100) - ADD HL,DE - LD (PatsPtr),HL - LD HL,169 - ADD HL,DE - LD (OrnPtrs),HL - LD HL,105 - ADD HL,DE - LD (SamPtrs),HL - LD A,(IX+13-100) ;EXTRACT VERSION NUMBER - SUB $30 - JR C,L20 - CP 10 - JR C,L21 -L20 LD A,6 -L21 LD (Version),A - PUSH AF ;VolTable version - CP 4 - LD A,(IX+99-100) ;TONE TABLE NUMBER - RLA - AND 7 - PUSH AF ;NoteTable number - LD HL,(e_-SamCnv-2)*256+$18 - LD (SamCnv),HL - LD A,$BA - LD (OrnCP),A - LD (SamCP),A - LD A,$7B - LD (OrnLD),A - LD (SamLD),A - LD A,$87 - LD (SamClc2),A - LD BC,PT3PD - LD HL,0 - LD DE,PT3EMPTYORN - JR INITCOMMON - -INITPT2 LD A,(HL) - LD (Delay),A - PUSH HL - PUSH HL - PUSH HL - INC HL - INC HL - LD A,(HL) - INC HL - LD (SamPtrs),HL - LD E,(HL) - INC HL - LD D,(HL) - POP HL - AND A - SBC HL,DE - CALL SETMDAD - POP HL - LD DE,67 - ADD HL,DE - LD (OrnPtrs),HL - LD E,32 - ADD HL,DE - LD C,(HL) - INC HL - LD B,(HL) - LD E,30 - ADD HL,DE - LD (CrPsPtr),HL - LD E,A - INC HL - -#IF CurPosCounter - LD A,L - LD (PosSub+1),A -#ENDIF - - ADD HL,DE - LD (LPosPtr),HL - POP HL - ADD HL,BC - LD (PatsPtr),HL - LD A,5 - LD (Version),A - PUSH AF - LD A,2 - PUSH AF - LD HL,$51CB - LD (SamCnv),HL - LD A,$BB - LD (OrnCP),A - LD (SamCP),A - LD A,$7A - LD (OrnLD),A - LD (SamLD),A - LD A,$80 - LD (SamClc2),A - LD BC,PT2PD - LD HL,$8687 - LD DE,PT2EMPTYORN - -INITCOMMON - - LD (PTDECOD+1),BC - LD (PsCalc),HL - PUSH DE - -;note table data depacker -;(c) Ivan Roshin - LD DE,T_PACK - LD BC,T1_+(2*49)-1 -TP_0 LD A,(DE) - INC DE - CP 15*2 - JR NC,TP_1 - LD H,A - LD A,(DE) - LD L,A - INC DE - JR TP_2 -TP_1 PUSH DE - LD D,0 - LD E,A - ADD HL,DE - ADD HL,DE - POP DE -TP_2 LD A,H - LD (BC),A - DEC BC - LD A,L - LD (BC),A - DEC BC - SUB ($F8*2) & $FF - JR NZ,TP_0 - -#IF LoopChecker - LD HL,SETUP - RES 7,(HL) - - #IF CurPosCounter - INC HL - LD (HL),A - #ENDIF - -#ELSE - - #IF CurPosCounter - LD (CurPos),A - #ENDIF - -#ENDIF - - LD HL,VARS - LD (HL),A - LD DE,VARS+1 - LD BC,VAR0END-VARS-1 - LDIR - LD (AdInPtA),HL ;ptr to zero - INC A - LD (DelyCnt),A - LD HL,$F001 ;H - Volume, L - NtSkCn - LD (ChanA+NtSkCn),HL - LD (ChanB+NtSkCn),HL - LD (ChanC+NtSkCn),HL - POP HL - LD (ChanA+OrnPtr),HL - LD (ChanB+OrnPtr),HL - LD (ChanC+OrnPtr),HL - - POP AF - -;NoteTableCreator (c) Ivan Roshin -;A - NoteTableNumber*2+VersionForNoteTable -;(xx1b - 3.xx..3.4r, xx0b - 3.4x..3.6x..VTII1.0) - - LD HL,NT_DATA - PUSH DE - LD D,B - ADD A,A - LD E,A - ADD HL,DE - LD E,(HL) - INC HL - SRL E - SBC A,A - AND $A7 ;$00 (NOP) or $A7 (AND A) - LD (L3),A - EX DE,HL - POP BC ;BC=T1_ - ADD HL,BC - - LD A,(DE) - ADD A,T_ & $FF - LD C,A - ADC A,T_/256 - SUB C - LD B,A - PUSH BC - LD DE,NT_ - PUSH DE - - LD B,12 - LD IX,TMP ; +WW -L1 PUSH BC - LD C,(HL) - INC HL - PUSH HL - LD B,(HL) - - PUSH DE - EX DE,HL - LD DE,23 - ;LD IXH,8 ; -WW - LD (IX),8 ; +WW - -L2 SRL B - RR C -L3 .DB $19 ;AND A or NOP - LD A,C - ADC A,D ;=ADC 0 - LD (HL),A - INC HL - LD A,B - ADC A,D - LD (HL),A - ADD HL,DE - ;DEC IXH ; -WW - DEC (IX) ; +WW - JR NZ,L2 - - POP DE - INC DE - INC DE - POP HL - INC HL - POP BC - DJNZ L1 - - POP HL - POP DE - - LD A,E - CP TCOLD_1 & $FF - JR NZ,CORR_1 - LD A,$FD - LD (NT_+$2E),A - -CORR_1 LD A,(DE) - AND A - JR Z,TC_EXIT - RRA - PUSH AF - ADD A,A - LD C,A - ADD HL,BC - POP AF - JR NC,CORR_2 - DEC (HL) - DEC (HL) -CORR_2 INC (HL) - AND A - SBC HL,BC - INC DE - JR CORR_1 - -TC_EXIT - - POP AF - -;VolTableCreator (c) Ivan Roshin -;A - VersionForVolumeTable (0..4 - 3.xx..3.4x; - ;5.. - 2.x,3.5x..3.6x..VTII1.0) - - CP 5 - LD HL,$11 - LD D,H - LD E,H - LD A,$17 - JR NC,M1 - DEC L - LD E,L - XOR A -M1 LD (M2),A - - LD IX,VT_+16 - - LD C,$F -INITV2 PUSH HL - - ADD HL,DE - EX DE,HL - SBC HL,HL - - LD B,$10 -INITV1 LD A,L -M2 .DB $7D - LD A,H - ADC A,0 - LD (IX),A - INC IX - ADD HL,DE - DJNZ INITV1 - - POP HL - LD A,E - CP $77 - JR NZ,M3 - INC E -M3 DEC C - JR NZ,INITV2 - - JP ROUT - -SETMDAD LD (MODADDR),HL - LD (MDADDR1),HL - LD (MDADDR2),HL - RET - -PTDECOD JP $C3C3 - -;PT2 pattern decoder -PD2_SAM CALL SETSAM - JR PD2_LOOP - -PD2_EOff LD (IX-12+Env_En),A - JR PD2_LOOP - -PD2_ENV LD (IX-12+Env_En),16 - LD (AYREGS+EnvTp),A - LD A,(BC) - INC BC - LD L,A - LD A,(BC) - INC BC - LD H,A - LD (EnvBase),HL - JR PD2_LOOP - -PD2_ORN CALL SETORN - JR PD2_LOOP - -PD2_SKIP INC A - LD (IX-12+NNtSkp),A - JR PD2_LOOP - -PD2_VOL RRCA - RRCA - RRCA - RRCA - LD (IX-12+Volume),A - JR PD2_LOOP - -PD2_DEL CALL C_DELAY - JR PD2_LOOP - -PD2_GLIS SET 2,(IX-12+Flags) - INC A - LD (IX-12+TnSlDl),A - LD (IX-12+TSlCnt),A - LD A,(BC) - INC BC - LD (IX-12+TSlStp),A - ADD A,A - SBC A,A - LD (IX-12+TSlStp+1),A - SCF - JR PD2_LP2 - -PT2PD AND A - -PD2_LP2 EX AF,AF' - -PD2_LOOP LD A,(BC) - INC BC - ADD A,$20 - JR Z,PD2_REL - JR C,PD2_SAM - ADD A,96 - JR C,PD2_NOTE - INC A - JR Z,PD2_EOff - ADD A,15 - JP Z,PD_FIN - JR C,PD2_ENV - ADD A,$10 - JR C,PD2_ORN - ADD A,$40 - JR C,PD2_SKIP - ADD A,$10 - JR C,PD2_VOL - INC A - JR Z,PD2_DEL - INC A - JR Z,PD2_GLIS - INC A - JR Z,PD2_PORT - INC A - JR Z,PD2_STOP - LD A,(BC) - INC BC - LD (IX-12+CrNsSl),A - JR PD2_LOOP - -PD2_PORT RES 2,(IX-12+Flags) - LD A,(BC) - INC BC - INC BC ;ignoring precalc delta to right sound - INC BC - SCF - JR PD2_LP2 - -PD2_STOP LD (IX-12+TSlCnt),A - JR PD2_LOOP - -PD2_REL LD (IX-12+Flags),A - JR PD2_EXIT - -PD2_NOTE LD L,A - LD A,(IX-12+Note) - LD (PrNote+1),A - LD (IX-12+Note),L - XOR A - LD (IX-12+TSlCnt),A - SET 0,(IX-12+Flags) - EX AF,AF' - JR NC,NOGLIS2 - BIT 2,(IX-12+Flags) - JR NZ,NOPORT2 - LD (LoStep),A - ADD A,A - SBC A,A - EX AF,AF' - LD H,A - LD L,A - INC A - CALL SETPORT -NOPORT2 LD (IX-12+TSlCnt),1 -NOGLIS2 XOR A - - -PD2_EXIT LD (IX-12+PsInSm),A - LD (IX-12+PsInOr),A - LD (IX-12+CrTnSl),A - LD (IX-12+CrTnSl+1),A - JP PD_FIN - -;PT3 pattern decoder -PD_OrSm LD (IX-12+Env_En),0 - CALL SETORN -PD_SAM_ LD A,(BC) - INC BC - RRCA - -PD_SAM CALL SETSAM - JR PD_LOOP - -PD_VOL RRCA - RRCA - RRCA - RRCA - LD (IX-12+Volume),A - JR PD_LP2 - -PD_EOff LD (IX-12+Env_En),A - LD (IX-12+PsInOr),A - JR PD_LP2 - -PD_SorE DEC A - JR NZ,PD_ENV - LD A,(BC) - INC BC - LD (IX-12+NNtSkp),A - JR PD_LP2 - -PD_ENV CALL SETENV - JR PD_LP2 - -PD_ORN CALL SETORN - JR PD_LOOP - -PD_ESAM LD (IX-12+Env_En),A - LD (IX-12+PsInOr),A - CALL NZ,SETENV - JR PD_SAM_ - -PT3PD LD A,(IX-12+Note) - LD (PrNote+1),A - LD L,(IX-12+CrTnSl) - LD H,(IX-12+CrTnSl+1) - LD (PrSlide+1),HL - -PD_LOOP LD DE,$2010 -PD_LP2 LD A,(BC) - INC BC - ADD A,E - JR C,PD_OrSm - ADD A,D - JR Z,PD_FIN - JR C,PD_SAM - ADD A,E - JR Z,PD_REL - JR C,PD_VOL - ADD A,E - JR Z,PD_EOff - JR C,PD_SorE - ADD A,96 - JR C,PD_NOTE - ADD A,E - JR C,PD_ORN - ADD A,D - JR C,PD_NOIS - ADD A,E - JR C,PD_ESAM - ADD A,A - LD E,A - LD HL,SPCCOMS+$FF20-$2000 - ADD HL,DE - LD E,(HL) - INC HL - LD D,(HL) - PUSH DE - JR PD_LOOP - -PD_NOIS LD (Ns_Base),A - JR PD_LP2 - -PD_REL RES 0,(IX-12+Flags) - JR PD_RES - -PD_NOTE LD (IX-12+Note),A - SET 0,(IX-12+Flags) - XOR A - -PD_RES LD (PDSP_+1),SP - LD SP,IX - LD H,A - LD L,A - PUSH HL - PUSH HL - PUSH HL - PUSH HL - PUSH HL - PUSH HL -PDSP_ LD SP,$3131 - -PD_FIN LD A,(IX-12+NNtSkp) - LD (IX-12+NtSkCn),A - RET - -C_PORTM LD A,(BC) - INC BC -;SKIP PRECALCULATED TONE DELTA (BECAUSE -;CANNOT BE RIGHT AFTER PT3 COMPILATION) - INC BC - INC BC - EX AF,AF' - LD A,(BC) ;SIGNED TONE STEP - INC BC - LD (LoStep),A - LD A,(BC) - INC BC - AND A - EX AF,AF' - LD L,(IX-12+CrTnSl) - LD H,(IX-12+CrTnSl+1) - -;Set portamento variables -;A - Delay; A' - Hi(Step); ZF' - (A'=0); HL - CrTnSl - -SETPORT RES 2,(IX-12+Flags) - LD (IX-12+TnSlDl),A - LD (IX-12+TSlCnt),A - PUSH HL - LD DE,NT_ - LD A,(IX-12+Note) - LD (IX-12+SlToNt),A - ADD A,A - LD L,A - LD H,0 - ADD HL,DE - LD A,(HL) - INC HL - LD H,(HL) - LD L,A - PUSH HL -PrNote LD A,$3E - LD (IX-12+Note),A - ADD A,A - LD L,A - LD H,0 - ADD HL,DE - LD E,(HL) - INC HL - LD D,(HL) - POP HL - SBC HL,DE - LD (IX-12+TnDelt),L - LD (IX-12+TnDelt+1),H - POP DE -Version .EQU $+1 - LD A,$3E - CP 6 - JR C,OLDPRTM ;Old 3xxx for PT v3.5- -PrSlide LD DE,$1111 - LD (IX-12+CrTnSl),E - LD (IX-12+CrTnSl+1),D -LoStep .EQU $+1 -OLDPRTM LD A,$3E - EX AF,AF' - JR Z,NOSIG - EX DE,HL -NOSIG SBC HL,DE - JP P,SET_STP - CPL - EX AF,AF' - NEG - EX AF,AF' -SET_STP LD (IX-12+TSlStp+1),A - EX AF,AF' - LD (IX-12+TSlStp),A - LD (IX-12+COnOff),0 - RET - -C_GLISS SET 2,(IX-12+Flags) - LD A,(BC) - INC BC - LD (IX-12+TnSlDl),A - AND A - JR NZ,GL36 - LD A,(Version) ;AlCo PT3.7+ - CP 7 - SBC A,A - INC A -GL36 LD (IX-12+TSlCnt),A - LD A,(BC) - INC BC - EX AF,AF' - LD A,(BC) - INC BC - JR SET_STP - -C_SMPOS LD A,(BC) - INC BC - LD (IX-12+PsInSm),A - RET - -C_ORPOS LD A,(BC) - INC BC - LD (IX-12+PsInOr),A - RET - -C_VIBRT LD A,(BC) - INC BC - LD (IX-12+OnOffD),A - LD (IX-12+COnOff),A - LD A,(BC) - INC BC - LD (IX-12+OffOnD),A - XOR A - LD (IX-12+TSlCnt),A - LD (IX-12+CrTnSl),A - LD (IX-12+CrTnSl+1),A - RET - -C_ENGLS LD A,(BC) - INC BC - LD (Env_Del),A - LD (CurEDel),A - LD A,(BC) - INC BC - LD L,A - LD A,(BC) - INC BC - LD H,A - LD (ESldAdd),HL - RET - -C_DELAY LD A,(BC) - INC BC - LD (Delay),A - RET - -SETENV LD (IX-12+Env_En),E - LD (AYREGS+EnvTp),A - LD A,(BC) - INC BC - LD H,A - LD A,(BC) - INC BC - LD L,A - LD (EnvBase),HL - XOR A - LD (IX-12+PsInOr),A - LD (CurEDel),A - LD H,A - LD L,A - LD (CurESld),HL -C_NOP RET - -SETORN ADD A,A - LD E,A - LD D,0 - LD (IX-12+PsInOr),D -OrnPtrs .EQU $+1 - LD HL,$2121 - ADD HL,DE - LD E,(HL) - INC HL - LD D,(HL) -MDADDR2 .EQU $+1 - LD HL,$2121 - ADD HL,DE - LD (IX-12+OrnPtr),L - LD (IX-12+OrnPtr+1),H - RET - -SETSAM ADD A,A - LD E,A - LD D,0 -SamPtrs .EQU $+1 - LD HL,$2121 - ADD HL,DE - LD E,(HL) - INC HL - LD D,(HL) -MDADDR1 .EQU $+1 - LD HL,$2121 - ADD HL,DE - LD (IX-12+SamPtr),L - LD (IX-12+SamPtr+1),H - RET - -;ALL 16 ADDRESSES TO PROTECT FROM BROKEN PT3 MODULES -SPCCOMS .DW C_NOP - .DW C_GLISS - .DW C_PORTM - .DW C_SMPOS - .DW C_ORPOS - .DW C_VIBRT - .DW C_NOP - .DW C_NOP - .DW C_ENGLS - .DW C_DELAY - .DW C_NOP - .DW C_NOP - .DW C_NOP - .DW C_NOP - .DW C_NOP - .DW C_NOP - -CHREGS XOR A - LD (Ampl),A - BIT 0,(IX+Flags) - PUSH HL - JP Z,CH_EXIT - LD (CSP_+1),SP - LD L,(IX+OrnPtr) - LD H,(IX+OrnPtr+1) - LD SP,HL - POP DE - LD H,A - LD A,(IX+PsInOr) - LD L,A - ADD HL,SP - INC A - ;PT2 PT3 -OrnCP INC A ;CP E CP D - JR C,CH_ORPS -OrnLD .DB 1 ;LD A,D LD A,E -CH_ORPS LD (IX+PsInOr),A - LD A,(IX+Note) - ADD A,(HL) - JP P,CH_NTP - XOR A -CH_NTP CP 96 - JR C,CH_NOK - LD A,95 -CH_NOK ADD A,A - EX AF,AF' - LD L,(IX+SamPtr) - LD H,(IX+SamPtr+1) - LD SP,HL - POP DE - LD H,0 - LD A,(IX+PsInSm) - LD B,A - ADD A,A -SamClc2 ADD A,A ;or ADD A,B for PT2 - LD L,A - ADD HL,SP - LD SP,HL - LD A,B - INC A - ;PT2 PT3 -SamCP INC A ;CP E CP D - JR C,CH_SMPS -SamLD .DB 1 ;LD A,D LD A,E -CH_SMPS LD (IX+PsInSm),A - POP BC - POP HL - -;Convert PT2 sample to PT3 - ;PT2 PT3 -SamCnv POP HL ;BIT 2,C JR e_ - POP HL - LD H,B - JR NZ,$+8 - EX DE,HL - AND A - SBC HL,HL - SBC HL,DE - LD D,C - RR C - SBC A,A - CPL - AND $3E - RR C - RR B - AND C - LD C,A - LD A,B - RRA - RRA - RR D - RRA - AND $9F - LD B,A - -e_ LD E,(IX+TnAcc) - LD D,(IX+TnAcc+1) - ADD HL,DE - BIT 6,B - JR Z,CH_NOAC - LD (IX+TnAcc),L - LD (IX+TnAcc+1),H -CH_NOAC EX DE,HL - EX AF,AF' - ADD A,NT_ & $FF - LD L,A - ADC A,NT_/256 - SUB L - LD H,A - LD SP,HL - POP HL - ADD HL,DE - LD E,(IX+CrTnSl) - LD D,(IX+CrTnSl+1) - ADD HL,DE -CSP_ LD SP,$3131 - EX (SP),HL - XOR A - OR (IX+TSlCnt) - JR Z,CH_AMP - DEC (IX+TSlCnt) - JR NZ,CH_AMP - LD A,(IX+TnSlDl) - LD (IX+TSlCnt),A - LD L,(IX+TSlStp) - LD H,(IX+TSlStp+1) - LD A,H - ADD HL,DE - LD (IX+CrTnSl),L - LD (IX+CrTnSl+1),H - BIT 2,(IX+Flags) - JR NZ,CH_AMP - LD E,(IX+TnDelt) - LD D,(IX+TnDelt+1) - AND A - JR Z,CH_STPP - EX DE,HL -CH_STPP SBC HL,DE - JP M,CH_AMP - LD A,(IX+SlToNt) - LD (IX+Note),A - XOR A - LD (IX+TSlCnt),A - LD (IX+CrTnSl),A - LD (IX+CrTnSl+1),A -CH_AMP LD A,(IX+CrAmSl) - BIT 7,C - JR Z,CH_NOAM - BIT 6,C - JR Z,CH_AMIN - CP 15 - JR Z,CH_NOAM - INC A - JR CH_SVAM -CH_AMIN CP -15 - JR Z,CH_NOAM - DEC A -CH_SVAM LD (IX+CrAmSl),A -CH_NOAM LD L,A - LD A,B - AND 15 - ADD A,L - JP P,CH_APOS - XOR A -CH_APOS CP 16 - JR C,CH_VOL - LD A,15 -CH_VOL OR (IX+Volume) - ADD A,VT_ & $FF - LD L,A - ADC A,VT_/256 - SUB L - LD H,A - LD A,(HL) -CH_ENV BIT 0,C - JR NZ,CH_NOEN - OR (IX+Env_En) -CH_NOEN LD (Ampl),A - BIT 7,B - LD A,C - JR Z,NO_ENSL - RLA - RLA - SRA A - SRA A - SRA A - ADD A,(IX+CrEnSl) ;SEE COMMENT BELOW - BIT 5,B - JR Z,NO_ENAC - LD (IX+CrEnSl),A -NO_ENAC LD HL,AddToEn - ADD A,(HL) ;BUG IN PT3 - NEED WORD HERE - LD (HL),A - JR CH_MIX -NO_ENSL RRA - ADD A,(IX+CrNsSl) - LD (AddToNs),A - BIT 5,B - JR Z,CH_MIX - LD (IX+CrNsSl),A -CH_MIX LD A,B - RRA - AND $48 -CH_EXIT LD HL,AYREGS+Mixer - OR (HL) - RRCA - LD (HL),A - POP HL - XOR A - OR (IX+COnOff) - RET Z - DEC (IX+COnOff) - RET NZ - XOR (IX+Flags) - LD (IX+Flags),A - RRA - LD A,(IX+OnOffD) - JR C,CH_ONDL - LD A,(IX+OffOnD) -CH_ONDL LD (IX+COnOff),A - RET - -PLAY XOR A - LD (AddToEn),A - LD (AYREGS+Mixer),A - DEC A - LD (AYREGS+EnvTp),A - LD HL,DelyCnt - DEC (HL) - JP NZ,PL2 - LD HL,ChanA+NtSkCn - DEC (HL) - JR NZ,PL1B -AdInPtA .EQU $+1 - LD BC,$0101 - LD A,(BC) - AND A - JR NZ,PL1A - LD D,A - LD (Ns_Base),A -CrPsPtr .EQU $+1 - LD HL,$2121 - INC HL - LD A,(HL) - INC A - JR NZ,PLNLP - -#IF LoopChecker - CALL CHECKLP -#ENDIF - -LPosPtr .EQU $+1 - LD HL,$2121 - LD A,(HL) - INC A -PLNLP LD (CrPsPtr),HL - DEC A - ;PT2 PT3 -PsCalc DEC A ;ADD A,A NOP - DEC A ;ADD A,(HL) NOP - ADD A,A - LD E,A - RL D - -#IF CurPosCounter - LD A,L -PosSub SUB $D6 - LD (CurPos),A -#ENDIF - -PatsPtr .EQU $+1 - LD HL,$2121 - ADD HL,DE -MODADDR .EQU $+1 - LD DE,$1111 - LD (PSP_+1),SP - LD SP,HL - POP HL - ADD HL,DE - LD B,H - LD C,L - POP HL - ADD HL,DE - LD (AdInPtB),HL - POP HL - ADD HL,DE - LD (AdInPtC),HL -PSP_ LD SP,$3131 -PL1A LD IX,ChanA+12 - CALL PTDECOD - LD (AdInPtA),BC - -PL1B LD HL,ChanB+NtSkCn - DEC (HL) - JR NZ,PL1C - LD IX,ChanB+12 -AdInPtB .EQU $+1 - LD BC,$0101 - CALL PTDECOD - LD (AdInPtB),BC - -PL1C LD HL,ChanC+NtSkCn - DEC (HL) - JR NZ,PL1D - LD IX,ChanC+12 -AdInPtC .EQU $+1 - LD BC,$0101 - CALL PTDECOD - LD (AdInPtC),BC - -Delay .EQU $+1 -PL1D LD A,$3E - LD (DelyCnt),A - -PL2 LD IX,ChanA - LD HL,(AYREGS+TonA) - CALL CHREGS - LD (AYREGS+TonA),HL - LD A,(Ampl) - LD (AYREGS+AmplA),A - LD IX,ChanB - LD HL,(AYREGS+TonB) - CALL CHREGS - LD (AYREGS+TonB),HL - LD A,(Ampl) - LD (AYREGS+AmplB),A - LD IX,ChanC - LD HL,(AYREGS+TonC) - CALL CHREGS - LD (AYREGS+TonC),HL - - LD HL,(Ns_Base_AddToNs) - LD A,H - ADD A,L - LD (AYREGS+Noise),A - -AddToEn .EQU $+1 - LD A,$3E - LD E,A - ADD A,A - SBC A,A - LD D,A - LD HL,(EnvBase) - ADD HL,DE - LD DE,(CurESld) - ADD HL,DE - LD (AYREGS+Env),HL - - XOR A - LD HL,CurEDel - OR (HL) - JR Z,ROUT - DEC (HL) - JR NZ,ROUT -Env_Del .EQU $+1 - LD A,$3E - LD (HL),A -ESldAdd .EQU $+1 - LD HL,$2121 - ADD HL,DE - LD (CurESld),HL - -ROUT -#IF ACBBAC - LD A,(SETUP) - AND 12 - JR Z,ABC - ADD A,CHTABLE - LD E,A - ADC A,CHTABLE/256 - SUB E - LD D,A - LD B,0 - LD IX,AYREGS - LD HL,AYREGS - LD A,(DE) - INC DE - LD C,A - ADD HL,BC - LD A,(IX+TonB) - LD C,(HL) - LD (IX+TonB),C - LD (HL),A - INC HL - LD A,(IX+TonB+1) - LD C,(HL) - LD (IX+TonB+1),C - LD (HL),A - LD A,(DE) - INC DE - LD C,A - ADD HL,BC - LD A,(IX+AmplB) - LD C,(HL) - LD (IX+AmplB),C - LD (HL),A - LD A,(DE) - INC DE - LD (RxCA1),A - XOR 8 - LD (RxCA2),A - LD HL,AYREGS+Mixer - LD A,(DE) - AND (HL) - LD E,A - LD A,(HL) -RxCA1 LD A,(HL) - AND %010010 - OR E - LD E,A - LD A,(HL) - AND %010010 -RxCA2 OR E - OR E - LD (HL),A -ABC -#ENDIF - -#IF ZX - XOR A - LD DE,$FFBF - LD BC,$FFFD - LD HL,AYREGS -LOUT OUT (C),A - LD B,E - OUTI - LD B,D - INC A - CP 13 - JR NZ,LOUT - OUT (C),A - LD A,(HL) - AND A - RET M - LD B,E - OUT (C),A - RET -#ENDIF - -#IF MSX -;MSX version of ROUT (c)Dioniso - XOR A - LD C,$A0 - LD HL,AYREGS -LOUT OUT (C),A - INC C - OUTI - DEC C - INC A - CP 13 - JR NZ,LOUT - OUT (C),A - LD A,(HL) - AND A - RET M - INC C - OUT (C),A - RET -#ENDIF - -#IF WBW - DI - CALL SLOWIO - LD DE,(PORTS) ; D := RDAT, E := RSEL - XOR A ; start with reg 0 - LD C,E ; point to address port - LD HL,AYREGS ; start of value list -LOUT OUT (C),A ; select register - LD C,D ; point to data port - OUTI ; write (HL) to data port, bump HL - LD C,E ; point to address port - INC A ; next register - CP 13 ; reg 13? - JR NZ,LOUT ; if not, loop - OUT (C),A ; select register 13 - LD A,(HL) ; get value for register 13 - AND A ; set flags - JP M,LOUT2 ; if bit 7 set, return w/o writing value - LD C,D ; select data port - OUT (C),A ; write value to register 13 -LOUT2 - CALL NORMIO - EI - RET ; And done -#ENDIF - -#IF ACBBAC -CHTABLE .EQU $-4 - .DB 4,5,15,%001001,0,7,7,%100100 -#ENDIF - -NT_DATA .DB (T_NEW_0-T1_)*2 - .DB TCNEW_0-T_ - .DB (T_OLD_0-T1_)*2+1 - .DB TCOLD_0-T_ - .DB (T_NEW_1-T1_)*2+1 - .DB TCNEW_1-T_ - .DB (T_OLD_1-T1_)*2+1 - .DB TCOLD_1-T_ - .DB (T_NEW_2-T1_)*2 - .DB TCNEW_2-T_ - .DB (T_OLD_2-T1_)*2 - .DB TCOLD_2-T_ - .DB (T_NEW_3-T1_)*2 - .DB TCNEW_3-T_ - .DB (T_OLD_3-T1_)*2 - .DB TCOLD_3-T_ - -T_ - -TCOLD_0 .DB $00+1,$04+1,$08+1,$0A+1,$0C+1,$0E+1,$12+1,$14+1 - .DB $18+1,$24+1,$3C+1,0 -TCOLD_1 .DB $5C+1,0 -TCOLD_2 .DB $30+1,$36+1,$4C+1,$52+1,$5E+1,$70+1,$82,$8C,$9C - .DB $9E,$A0,$A6,$A8,$AA,$AC,$AE,$AE,0 -TCNEW_3 .DB $56+1 -TCOLD_3 .DB $1E+1,$22+1,$24+1,$28+1,$2C+1,$2E+1,$32+1,$BE+1,0 -TCNEW_0 .DB $1C+1,$20+1,$22+1,$26+1,$2A+1,$2C+1,$30+1,$54+1 - .DB $BC+1,$BE+1,0 -TCNEW_1 .EQU TCOLD_1 -TCNEW_2 .DB $1A+1,$20+1,$24+1,$28+1,$2A+1,$3A+1,$4C+1,$5E+1 - .DB $BA+1,$BC+1,$BE+1,0 - -PT3EMPTYORN .EQU $-1 - .DB 1,0 - -;first 12 values of tone tables (packed) - -T_PACK .DB $06EC*2/256,$06EC*2 - .DB $0755-$06EC - .DB $07C5-$0755 - .DB $083B-$07C5 - .DB $08B8-$083B - .DB $093D-$08B8 - .DB $09CA-$093D - .DB $0A5F-$09CA - .DB $0AFC-$0A5F - .DB $0BA4-$0AFC - .DB $0C55-$0BA4 - .DB $0D10-$0C55 - .DB $066D*2/256,$066D*2 - .DB $06CF-$066D - .DB $0737-$06CF - .DB $07A4-$0737 - .DB $0819-$07A4 - .DB $0894-$0819 - .DB $0917-$0894 - .DB $09A1-$0917 - .DB $0A33-$09A1 - .DB $0ACF-$0A33 - .DB $0B73-$0ACF - .DB $0C22-$0B73 - .DB $0CDA-$0C22 - .DB $0704*2/256,$0704*2 - .DB $076E-$0704 - .DB $07E0-$076E - .DB $0858-$07E0 - .DB $08D6-$0858 - .DB $095C-$08D6 - .DB $09EC-$095C - .DB $0A82-$09EC - .DB $0B22-$0A82 - .DB $0BCC-$0B22 - .DB $0C80-$0BCC - .DB $0D3E-$0C80 - .DB $07E0*2/256,$07E0*2 - .DB $0858-$07E0 - .DB $08E0-$0858 - .DB $0960-$08E0 - .DB $09F0-$0960 - .DB $0A88-$09F0 - .DB $0B28-$0A88 - .DB $0BD8-$0B28 - .DB $0C80-$0BD8 - .DB $0D60-$0C80 - .DB $0E10-$0D60 - .DB $0EF8-$0E10 -; -;Release 0 steps: -;02/27/2005 -;Merging PT2 and PT3 players; debug -;02/28/2005 -;debug; optimization -;03/01/2005 -;Migration to SjASM; conditional assembly (ZX, MSX and -;visualization) -;03/03/2005 -;SETPORT subprogram (35 bytes shorter) -;03/05/2005 -;fixed CurPosCounter error -;03/06/2005 -;Added ACB and BAC channels swapper (for Spectre); more cond. -;assembly keys; optimization -;Release 1 steps: -;04/15/2005 -;Removed loop bit resetting for no loop build (5 bytes shorter) -;04/30/2007 -;New 1.xx and 2.xx interpretation for PT 3.7+. - -;Tests in IMMATION TESTER V1.0 by Andy Man/POS -;(for minimal build) -;Module name/author Min tacts Max tacts -;PT3 (a little slower than standalone player) -;Spleen/Nik-O 1720 9368 -;Chuta/Miguel 1720 9656 -;Zhara/Macros 4536 8792 -;PT2 (more slower than standalone player) -;Epilogue/Nik-O 3928 10232 -;NY tHEMEs/zHenYa 3848 9208 -;GUEST 4/Alex Job 2824 9352 -;KickDB/Fatal Snipe 1720 9880 - -;Size (minimal build for ZX Spectrum): -;Code block $7B9 bytes -;Variables $21D bytes (can be stripped) -;Size in RAM $7B9+$21D=$9D6 (2518) bytes - -;Notes: -;Pro Tracker 3.4r can not be detected by header, so PT3.4r tone -;tables realy used only for modules of 3.3 and older versions. -; -;=============================================================================== -; MYM Player Routines -;=============================================================================== -; -; MYMPLAY - Player for MYM-tunes -; MSX-version by Marq/Lieves!Tuore & Fit 30.1.2000 -; -; 1.2.2000 - Added the disk loader. Thanks to Yzi & Plaque for examples. -; 7.2.2000 - Removed one unpack window -> freed 1.7kB memory -; -; Source suitable for Table-driven assembler (TASM), sorry all -; Devpac freaks :v/ - -FRAG .equ 128 ; Fragment size -REGS .equ 14 ; Number of PSG registers -FBITS .equ 7 ; Bits needed to store fragment offset -; -mymini exx ; Starting values for procedure readbits - ld e,1 - ld d,0 - ld hl,data - exx - - ld hl,uncomp+FRAG ; Starting values for the playing variables - ld (dest1),hl - ld (dest2),hl - ld (psource),hl - ld a,FRAG - ld (played),a - ld hl,0 - ld (prows),hl -; -; *** Unpack a fragment. Returns IY=new playing position for VBI -extract: - ld a,0 -regloop: - push af - ld c,a - ld b,0 - ld hl,regbits ; D=Bits in this PSG register - add hl,bc - ld d,(hl) - ld hl,current ; E=Current value of a PSG register - add hl,bc - ld e,(hl) - - ld bc,FRAG*3 - ld hl,(dest1) ; IX=Destination 1 - ld ix,(dest1) - add hl,bc - ld (dest1),hl - ld hl,(dest2) ; HL=Destination 2 - push hl - add hl,bc - ld (dest2),hl - pop hl - - ex af,af' - ld a,FRAG ; AF'=fragment end counter - ex af,af' - ld a,1 ; Get fragment bit - call readbits - or a - jr nz,compfrag ; 1=Compressed fragment, 0=Unchanged - - ld b,FRAG ; Unchanged fragment: just set all to E -sweep: ld (hl),e - inc hl - ld (ix),e - inc ix - djnz sweep - jp nextreg - -compfrag: ; Compressed fragment - ld a,1 - call readbits - or a - jr nz,notprev ; 0=Previous register value, 1=raw/compressed - - ld (hl),e ; Unchanged register - inc hl - ld (ix),e - inc ix - ex af,af' - dec a - ex af,af' - jp nextbit - -notprev: - ld a,1 - call readbits - or a - jr z,packed ; 0=compressed data, 1=raw data - - ld a,d ; Raw data, read regbits[i] bits - call readbits - ld e,a - ld (hl),a - inc hl - ld (ix),a - inc ix - ex af,af' - dec a - ex af,af' - jp nextbit - -packed: ld a,FBITS ; Reference to previous data: - call readbits ; Read the offset - ld c,a - ld a,FBITS ; Read the number of bytes - call readbits - ld b,a - - push hl - push bc - ld bc,-FRAG - add hl,bc - pop bc - ld a,b - ld b,0 - add hl,bc - ld b,a - push hl - pop iy ; IY=source address - pop hl - - inc b -copy: ld a,(iy) ; Copy from previous data - inc iy - ld e,a ; Set current value - ld (hl),a - inc hl - ld (ix),a - inc ix - ex af,af' - dec a - ex af,af' - djnz copy - -nextbit: - ex af,af' ; If AF'=0 then fragment is done - ld c,a - ex af,af' - ld a,c - or a - jp nz,compfrag - -nextreg: - pop af - ld b,0 ; Save the current value of PSG reg - ld c,a - push hl - ld hl,current - add hl,bc - ld (hl),e - pop hl - - inc a ; Check if all registers are done - cp REGS - jp nz,regloop - - or a ; Check if dest2 must be wrapped - ld bc,rows - sbc hl,bc - jr nz,nowrap - - ld ix,FRAG+uncomp - ld hl,FRAG+uncomp - ld iy,(2*FRAG)+uncomp - jr endext - -nowrap: ld ix,uncomp - ld hl,(2*FRAG)+uncomp - ld iy,(FRAG)+uncomp - -endext: ld (dest1),ix - ld (dest2),hl - - ld bc,FRAG ; Check end-of-file. Clumsy :v/ - ld hl,(prows) - add hl,bc - ld (prows),hl - ld bc,(rows) - or a - sbc hl,bc - -; jr c,noend ; If rows>played rows then exit -; exx ; Otherwise restart -; ld e,1 -; ld d,0 -; ld hl,data -; exx -; ld hl,0 -; ld (prows),hl - -noend: ret - -; *** Reads A bits from data, returns bits in A -readbits: - exx - ld b,a - ld c,0 - -onebit: sla c ; Get one bit at a time - rrc e - jr nc,nonew ; Wrap the AND value - ld d,(hl) - inc hl - -nonew: ld a,e - and d - jr z,zero - inc c -zero: djnz onebit - - ld a,c - exx - ret - -; *** Update PSG registers -upsg: ld a,(WMOD) ; if WMOD = 1, CPU is z180 - or a ; set flags - jr z,upsg1 ; skip z180 stuff - di - call SLOWIO - -upsg1: ld hl,(psource) - ld de,(PORTS) ; E := RSEL, D := RDAT - xor a - -psglp: ld c,e ; C := RSEL - out (c),a ; Select register - ld c,d ; C := RDAT - outi ; Set register value - inc a ; Next register - ld bc,(3*FRAG)-1 ; Bytes to skip before next reg-1 - add hl,bc ; Update HL - cp REGS-1 ; Check for next to last register? - jr nz,psglp ; If not, loop - - ld a,$FF ; Prepare to check for $FF value - cp (hl) ; If last reg (13) is $FF - jr z,notrig ; ... then don't output - ld a,13 ; Register 13 - ld c,e ; C := RSEL - out (c),a ; Select register - ld c,d ; C := RDAT - outi ; Set register value - -notrig: ld hl,(psource) - inc hl - ld (psource),hl - - ld a,(played) - or a - jr z,endint - dec a - ld (played),a - -endint: call NORMIO - ei - ret ; And done -; -; *** Program data -played .db 0 ; VBI counter -dest1 .dw 0 ; Uncompress destination 1 -dest2 .dw 0 ; - " - 2 -psource .dw 0 ; Playing offset for the VB-player -prows .dw 0 ; Rows played so far - -; Bits per PSG register -regbits .db 8,4,8,4,8,4,5,8,5,5,5,8,8,8 -; Current values of PSG registers -current .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0 -; -;=============================================================================== -;=============================================================================== -; PTx/MYM Shared Heap Storage -;=============================================================================== -;=============================================================================== -; -; Note that two different storage layouts are defined below. One for PTx and -; one for MYM. They share the same storage area starting at the HEAP marker, -; but only one defintion will be active depending on the type of file -; being played. -; -HEAP .EQU $ -; -;=============================================================================== -; PTx Player Storage -;=============================================================================== -; - .ORG HEAP -; -;vars from here can be stripped -;you can move VARS to any other address - -VARS - -ChanA .DS CHP -ChanB .DS CHP -ChanC .DS CHP - -;GlobalVars -DelyCnt .DS 1 -CurESld .DS 2 -CurEDel .DS 1 -Ns_Base_AddToNs -Ns_Base .DS 1 -AddToNs .DS 1 - -AYREGS - -VT_ .DS 256 ;CreatedVolumeTableAddress - -EnvBase .EQU VT_+14 - -T1_ .EQU VT_+16 ;Tone tables data depacked here - -T_OLD_1 .EQU T1_ -T_OLD_2 .EQU T_OLD_1+24 -T_OLD_3 .EQU T_OLD_2+24 -T_OLD_0 .EQU T_OLD_3+2 -T_NEW_0 .EQU T_OLD_0 -T_NEW_1 .EQU T_OLD_1 -T_NEW_2 .EQU T_NEW_0+24 -T_NEW_3 .EQU T_OLD_3 - -PT2EMPTYORN .EQU VT_+31 ;1,0,0 sequence - -NT_ .DS 192 ;CreatedNoteTableAddress - -;local var -Ampl .EQU AYREGS+AmplC - -VAR0END .EQU VT_+16 ;INIT zeroes from VARS to VAR0END-1 - -VARSEND .EQU $ - -MDLADDR .EQU $ -; -;=============================================================================== -; MYM Player Storage -;=============================================================================== -; - .ORG HEAP -; Reserve room for uncompressed data -uncomp: - .DS (3*FRAG*REGS) - -; The tune is stored here -rows: - .DS 2 ; WORD value -data: -; -;=============================================================================== - .END - diff --git a/Source/Apps/Tune/cli.inc b/Source/Apps/Tune/cli.inc new file mode 100644 index 00000000..fc901068 --- /dev/null +++ b/Source/Apps/Tune/cli.inc @@ -0,0 +1,86 @@ + +CLI_ABRT_IF_OPT_FIRST: + LD A, (FCB+1) + CP '-' ; OPTION FIRST OR - MISSING FILENAME? + JP Z, ERRCMD ; SHOW USAGE + RET + +CLI_HAVE_HBIOS_SWITCH: + LD HL, CLIARGS ; TEST FOR --HBIOS ON COMMAND LINE + LD DE, HBIOSOPT + CALL STRINDEX + JR NZ, CLI_HAVE_HBIOS_SWITCH1 + OR $FF ; MATCHED --HBIOS + LD (HBIOSMD), A + LD BC,(BF_SYSGET*256)+BF_SND + RST 08 ; CHECK WE HAVE + XOR A ; AT LEAST ONE + CP E ; SOUND DEVICE + RET NZ + JP ERRHW +CLI_HAVE_HBIOS_SWITCH1 ; NOT MATCHED --HBIOS + XOR A + LD (HBIOSMD), A + RET + +CLI_ABRT_UNSUPPFILTYP: + PUSH AF + ISHBIOS + JR Z, CLI_ABRT_UNSUPPFILTYP1 + POP AF + CP TYPMYM + RET NZ + ERRWITHMSG(MSGUNSUP) ; EXIT WITH UNSUPPORTED FILE TYPE MESSAGE + +CLI_ABRT_UNSUPPFILTYP1: + POP AF + RET + +CLI_OCTAVE_ADJST: ; SEARCH FOR OCTAVE ADJUSTMENT SWITCH (-n or +n) + LD HL, CLIARGS ; TEST FOR --HBIOS ON COMMAND LINE + LD DE, DOWN1 + CALL STRINDEX + JR NZ, CLI_OCTAVE_ADJST1 + + LD A, -1 + JR CLI_OCTAVE_ADJST5 + +CLI_OCTAVE_ADJST1: + LD HL, CLIARGS ; TEST FOR --HBIOS ON COMMAND LINE + LD DE, DOWN2 + CALL STRINDEX + JR NZ, CLI_OCTAVE_ADJST2 + + LD A, -2 + JR CLI_OCTAVE_ADJST5 + +CLI_OCTAVE_ADJST2: + LD HL, CLIARGS ; TEST FOR --HBIOS ON COMMAND LINE + LD DE, UP1 + CALL STRINDEX + JR NZ, CLI_OCTAVE_ADJST3 + + LD A, 1 + JR CLI_OCTAVE_ADJST5 + +CLI_OCTAVE_ADJST3: + LD HL, CLIARGS ; TEST FOR --HBIOS ON COMMAND LINE + LD DE, UP2 + CALL STRINDEX + JR NZ, CLI_OCTAVE_ADJST4 + + LD A, 2 + JR CLI_OCTAVE_ADJST5 + +CLI_OCTAVE_ADJST4: + LD A, 0 + +CLI_OCTAVE_ADJST5: + LD (OCTAVEADJ), A + RET + +HBIOSOPT: .DB "--HBIOS", 0 +DOWN1 .DB "-t1", 0 ; DOWN AN OCTAVE +DOWN2 .DB "-t2", 0 ; DOWN TWO OCTAVE +UP1 .DB "+t1", 0 ; UP AN OCTAVE +UP2 .DB "+t2", 0 ; UP TWO OCTAVE diff --git a/Source/Apps/Tune/cpm.inc b/Source/Apps/Tune/cpm.inc new file mode 100644 index 00000000..a3c84af9 --- /dev/null +++ b/Source/Apps/Tune/cpm.inc @@ -0,0 +1,4 @@ +CLIARGS .EQU $81 +RESTART .EQU $0000 ; CP/M restart vector +BDOS .EQU $0005 ; BDOS invocation vector +FCB .EQU $5C ; Location of default FCB diff --git a/Source/Apps/Tune/hbios.inc b/Source/Apps/Tune/hbios.inc new file mode 100644 index 00000000..cba06045 --- /dev/null +++ b/Source/Apps/Tune/hbios.inc @@ -0,0 +1,12 @@ +IDENT .EQU $FFFE ; loc of RomWBW HBIOS ident ptr +; +BF_SYSVER .EQU $F1 ; BIOS: VER function +BF_SYSGET .EQU $F8 ; HBIOS: SYSGET function +; +BF_SND .EQU $50 +BF_SNDRESET .EQU BF_SND + 0 ; RESET SOUND SYSTEM +BF_SNDVOL .EQU BF_SND + 1 ; REQUEST SOUND VOL - L CONTAINS VOLUME (255 MAX, 0 SILENT) - SCALED AS REQUIRED BY DRIVER (EG: MAPS TO JUST 4 BIT RESOLUTION FOR SN76489) +BF_SNDPRD .EQU BF_SND + 2 ; REQUEST SOUND PERIOD - HL CONTAINS DRIVER SPECIFIC VALUE +BF_SNDNOTE .EQU BF_SND + 3 ; REQUEST NOTE - L CONTAINS NOTE - EACH VALUE IS QUARTER NOTE +BF_SNDPLAY .EQU BF_SND + 4 ; INITIATE THE REQUESTED SOUND COMMAND +BF_SNDQUERY .EQU BF_SND + 5 ; E IS SUBFUNCTION diff --git a/Source/Apps/Tune/printing.inc b/Source/Apps/Tune/printing.inc new file mode 100644 index 00000000..be1ade84 --- /dev/null +++ b/Source/Apps/Tune/printing.inc @@ -0,0 +1,177 @@ +; +; Print character in A without destroying any registers +; +PRTCHR: + PUSH BC ; save registers + PUSH DE + PUSH HL + LD E,A ; character to print in E + LD C,$02 ; BDOS function to output a character + CALL BDOS ; do it + POP HL ; restore registers + POP DE + POP BC + RET +; +PRTDOT: +; + ; shortcut to print a dot preserving all regs + PUSH AF ; save af + LD A,'.' ; load dot char + CALL PRTCHR ; print it + POP AF ; restore af + RET ; done +; +PRTCR: +; + ; shortcut to print a carriage return preserving all regs + PUSH AF ; save af + LD A,13 ; load CR value + CALL PRTCHR ; print it + POP AF ; restore af + RET ; done +; +; Print a zero terminated string at (DE) without destroying any registers +; +PRTSTR: + PUSH AF + PUSH DE +; +PRTSTR1: + LD A,(DE) ; get next char + OR A + JR Z,PRTSTR2 + CALL PRTCHR + INC DE + JR PRTSTR1 +; +PRTSTR2: + POP DE ; restore registers + POP AF + RET +; +; Print the value in A in hex without destroying any registers +; +PRTHEX: + PUSH AF ; save AF + PUSH DE ; save DE + CALL HEXASCII ; convert value in A to hex chars in DE + LD A,D ; get the high order hex char + CALL PRTCHR ; print it + LD A,E ; get the low order hex char + CALL PRTCHR ; print it + POP DE ; restore DE + POP AF ; restore AF + RET ; done +; +; print the hex word value in bc +; +PRTHEXWORD: + PUSH AF + LD A,B + CALL PRTHEX + LD A,C + CALL PRTHEX + POP AF + RET +; +; print the hex dword value in de:hl +; +PRTHEX32: + PUSH BC + PUSH DE + POP BC + CALL PRTHEXWORD + PUSH HL + POP BC + CALL PRTHEXWORD + POP BC + RET +; +; Convert binary value in A to ascii hex characters in DE +; +HEXASCII: + LD D,A ; save A in D + CALL HEXCONV ; convert low nibble of A to hex + LD E,A ; save it in E + LD A,D ; get original value back + RLCA ; rotate high order nibble to low bits + RLCA + RLCA + RLCA + CALL HEXCONV ; convert nibble + LD D,A ; save it in D + RET ; done + +; +; Convert low nibble of A to ascii hex +; +HEXCONV: + AND $0F ; low nibble only + ADD A,$90 + DAA + ADC A,$40 + DAA + RET + +; +; Print value of A or HL in decimal with leading zero suppression +; Use prtdecb for A or prtdecw for HL +; +PRTDECB: + PUSH HL + LD H,0 + LD L,A + CALL PRTDECW ; print it + POP HL + RET +; +PRTDECW: + PUSH AF + PUSH BC + PUSH DE + PUSH HL + CALL PRTDEC0 + POP HL + POP DE + POP BC + POP AF + RET +; +PRTDEC0: + LD E,'0' + LD BC,-10000 + CALL PRTDEC1 + LD BC,-1000 + CALL PRTDEC1 + LD BC,-100 + CALL PRTDEC1 + LD C,-10 + CALL PRTDEC1 + LD E,0 + LD C,-1 +PRTDEC1: + LD A,'0' - 1 +PRTDEC2: + INC A + ADD HL,BC + JR C,PRTDEC2 + SBC HL,BC + CP E + RET Z + LD E,0 + CALL PRTCHR + RET +; +; Start a new line +; +CRLF2: + CALL CRLF ; two of them +CRLF: + PUSH AF ; preserve AF + LD A,13 ; + CALL PRTCHR ; print it + LD A,10 ; + CALL PRTCHR ; print it + POP AF ; restore AF + RET diff --git a/Source/Apps/Tune/strings.inc b/Source/Apps/Tune/strings.inc new file mode 100644 index 00000000..5df10276 --- /dev/null +++ b/Source/Apps/Tune/strings.inc @@ -0,0 +1,39 @@ +STRINDEX: ; SEARCH FOR STRING AT DE WITHIN STRING AT HL + + LD B, 0 + LD C, 0 + +TRYNEXT: + PUSH HL + PUSH DE + CALL STRCMP + POP DE + POP HL + RET Z + + INC HL + INC BC + LD A, (HL) + OR A + JR NZ, TRYNEXT + + OR $FF ; RETURN NZ + RET + +STRCMP: ; COMPARE STRING AT HL WITH DE - RETURN Z IF LIKE + LD A, (DE) + OR A + RET Z + + LD B, A + LD A, (HL) + OR A + JR NZ, STRCMP1 + OR $FF ; END OF STRING HL - SO NOT FOUND + RET +STRCMP1 + CP B + RET NZ + INC HL + INC DE + JR STRCMP diff --git a/Source/Apps/Tune/timing.inc b/Source/Apps/Tune/timing.inc new file mode 100644 index 00000000..857e4d2c --- /dev/null +++ b/Source/Apps/Tune/timing.inc @@ -0,0 +1,60 @@ + +; +; Wait for quark play time. Can use hardware timer if +; supported by hardware or simple delay loop otherwise. +; Delay loop requires QDLY to be pre-set to to achieve +; optimal 20ms wait time. +; +WAITQ LD A,(WMOD) ; Get delay mode + OR A ; Set flags + JR Z,DLY ; Delay mode +; + ; Timer loop + CALL TIM2 ; Read timer LSB into A + LD C,A ; Init prev value +TIM1 PUSH BC ; Save prev value + CALL TIM2 ; Read timer LSB into A + POP BC ; Recover prev value + CP C ; Compare to prev + RET NZ ; Done if changed + JR TIM1 ; Else, loop +; +TIM2 LD B,$F8 ; BIOS SYSGET function + LD C,$D0 ; TIMER sub-function + RST 08 ; Call BIOS + LD A,L ; MSB to A + RET ; Return to loop +; + ; Delay spin loop (40 tstates per loop) +DLY LD BC,(QDLY) ; Load quark delay factor +DLY1 DEC BC ; [6] + NOP ; [4] + NOP ; [4] + NOP ; [4] + NOP ; [4] + LD A,B ; [4] + OR C ; [4] + JP NZ,DLY1 ; [10] + RET + +; +; Test for timer running to determine if it can be used for delay +; Return string message in DE +; Assigned (WMOD) with 0 if no hardware time, 1 if hardware timer found +; +PROBETIMER: + LD B,BF_SYSGET ; HBIOS: GET function + LD C,$D0 ; TIMER subfunction + RST 08 ; DE:HL := current tick count + LD A,L ; DE:HL == 0? + OR H + OR E + OR D + LD A,0 ; Assume no timer + LD DE,MSGDLY ; Delay mode msg + JR Z,SETDLY ; If tick count is zero, no timer active + LD A,$FF ; Value for timer active + LD DE,MSGTIM ; Timer mode msg +SETDLY: + LD (WMOD),A ; Save wait mode + RET diff --git a/Source/Apps/Tune/tune.asm b/Source/Apps/Tune/tune.asm new file mode 100644 index 00000000..994d113a --- /dev/null +++ b/Source/Apps/Tune/tune.asm @@ -0,0 +1,2657 @@ +;=============================================================================== +; TUNE - Play PT2/PT3/MYM sound files +; +;=============================================================================== +; +; Author: Wayne Warthen (wwarthen@gmail.com) +; +; This application is basically just a RomWBW wrapper for the +; Universal PT2 and PT3 player by S.V.Bulba and the MYM player +; by Marq/Lieves!Tuore. See comments below. +;_______________________________________________________________________________ +; +; Usage: +; TUNE +; +; of sound file to load and play +; Filename extension determines file type (.PT2, .PT3, or .MYM) +; +; Notes: +; - Supports AY-3-8910, YM2149, etc. +; - Plays PT2, PT3, or MYM format files. File extension (.PT2, .PT3, or .MYM) +; determines file type. +; - Max Z80 CPU clock is about 8MHz or sound chip will not handle speed. +; - Higher CPU clock speeds are possible on Z180 because extra I/O +; wait states are added during I/O to sound chip. +; - Uses hardware timer support on systems that support a timer. Otherwise, +; a delay loop calibrated to CPU speed is used. +; - Delay loop is calibrated to CPU speed, but it does not compensate for +; time variations in each quark loop resulting from data decompression. +; An average quark processing time is assumed in each loop. +; - Most sound files originally targeted MSX or ZX Spectrum which used +; 1.7897725 MHz and 1.773400 MHz respectively for the PSG clock. For best +; sound playback, PSG should be run at approx. this clock rate. +;_______________________________________________________________________________ +; +; Change Log: +; 2018-01-26 [WBW] Initial release +; 2018-01-28 [WBW] Added support for MYM sound files +; 2019-11-21 [WBW] Added table-driven configuration +; 2020-02-11 [WBW] Made hardware config & detection more flexible +; 2020-03-29 [WBW] Fix error in Z180 I/O W/S bracketing +; 2020-04-25 [DEN] Added support to use HBIOS Sound driver +; 2020-05-02 [PMS] Add support for SBC-V2 slow-io hack +; 2020-09-03 [E?B] Add support for Ed Brindley YM/AY Sound Card v6 +; 2021-08-13 [WBW] Add support for LiNC Z50 Sound Card +; 2021-08-17 [WBW] When playing via HBIOS, call BF_SNDRESET at end +; 2022-03-20 [DDW] Add support for MBC PSG module +;_______________________________________________________________________________ +; +; ToDo: +; 1) Add an option to play file in a continuous loop? +;_______________________________________________________________________________ +; +;=============================================================================== +; Main program +;=============================================================================== +; +#include "../../ver.inc" +#include "hbios.inc" +#include "cpm.inc" +#include "tune.inc" +; +HEAPEND .EQU $C000 ; End of heap storage +; +TYPPT2 .EQU 1 ; FILTYP value for PT2 sound file +TYPPT3 .EQU 2 ; FILTYP value for PT3 sound file +TYPMYM .EQU 3 ; FILTYP value for MYM sound file +; +; HIGH SPEED CPU CONTROL +; +SBCV2004 .EQU 0 ; ENABLE SBC-V2-004 HALF CLOCK DIVIDER +CPUFAMZ180 .EQU 1 ; ENABLE Z180 WAIT STATE MANAGEMENT +; +;Conditional assembly - use -D switch on TASM or uz80as assembler to control +_ZX .EQU 0 ; 1) Version of ROUT (ZX or MSX standards) +_MSX .EQU 0 +_WBW .EQU 0 +HBIOS .EQU 0 +#IFDEF ZX +_ZX .SET 1 +#ELSE +#IFDEF MSX +_MSX .SET 1 +#ELSE +_WBW .SET 1 + +#ENDIF +#ENDIF + +CurPosCounter .EQU 0 ; 2) Current position counter at (START+11) +ACBBAC .EQU 0 ; 3) Allow channels allocation bits at (START+10) +LoopChecker .EQU 1 ; 4) Allow loop checking and disabling +Id .EQU 1 ; 5) Insert official identificator +#DEFINE Release "1" ; Release number + + .ORG $0100 +; + PRTCRLF + PRTSTRDE(MSGBAN) ; Print to banner message + + CALL CLI_ABRT_IF_OPT_FIRST + CALL CLI_HAVE_HBIOS_SWITCH + CALL CLI_OCTAVE_ADJST + JP CONTINUE + +CONTINUE: + ; Check BIOS and version + CALL IDBIO ; Identify hardware BIOS + CP 1 ; RomWBW HBIOS? + JP NZ, ERRBIO ; If not, handle BIOS error + LD A, RMJ << 4 | RMN ; Expected HBIOS ver + CP D ; Compare with result above + JP NZ, ERRBIO ; Handle BIOS error + LD A, L ; Platform id to A + LD (CURPLT),A ; Save as current platform id + + LD A, (HBIOSMD) + OR A + JR NZ, TSTTIMER ; skip hardware check if using hbios + + LD HL,CFGTBL ; Point to start of config table +CFGSEL: + LD A,$FF ; End of table marker + CP (HL) ; Compare + JP Z,ERRHW ; Bail out if no more configs to try +; + LD BC,CFGSIZ ; Size of one entry + LD DE,CFG ; Active config structure + LDIR ; Update active config structure +; + LD A,(CURPLT) ; Get current running platform id + LD E,A ; Put in E + LD A,(PLT) ; Get platform id of loaded config + CP E ; Equal? + JR NZ,CFGSEL ; If no match keep trying +; + ; Activate card if applicable + CALL SLOWIO ; Slow down I/O now + LD A,(ACR) ; Get ACR port address (if any) + INC A ; $FF -> $00 & set flags + JR Z,PROBE ; Skip ahead to probe if no ACR + DEC A ; Restore real ACR port address + LD C,A ; Put in C for I/O + LD A,$FF ; Value to activate card + OUT (C),A ; Write value to ACR +; +PROBE: + ; Test for hardware (sound chip detection) + LD DE,(PORTS) ; D := RDAT, E := RSEL + LD C,E ; Port = RSEL + LD A,2 ; Register 2 + OUT (C),A ; Select register 2 + LD C,D ; Port = RDAT + LD A,$AA ; Value = $AA + OUT (C),A ; Write $AA to register 2 + LD A,(RIN) ; Port = RIN + LD C,A ; ... to C + IN A,(C) ; Read back value in register 2 + CP $AA ; Value as written? + PUSH AF ; Save AF + CALL NORMIO ; Back to normal I/O speeds + POP AF ; Recover AF + JR Z,MAT ; Hardware matched! + JR CFGSEL ; And keep trying +; +MAT: + ; Hardware matched! + CALL CRLF ; Formatting + LD DE,(DESC) ; Load hardware description pointer + CALL PRTSTR ; Print description +; + +TSTTIMER: + CALL PROBETIMER + CALL PRTSTR ; Print it +; + ; Get CPU speed & type from RomWBW HBIOS and compute quark delay factor + LD B,$F8 ; HBIOS SYSGET function 0xF8 + LD C,$F0 ; CPUINFO subfunction 0xF0 + RST 08 ; Do it, DE := CPU speed in KHz + SRL D ; Divide by 2 + RR E ; ... for delay factor + EX DE,HL ; Move result to HL + LD (QDLY),HL ; Save result as quark delay factor +; + ; Clear heap storage + LD HL,HEAP ; Point to heap start + XOR A ; A := zero + LD (HEAP),A ; Clear first byte of heap + LD DE,HEAP+1 ; Set dest to next byte + LD BC,HEAPEND-HEAP-1 ; Size of heap except first byte + LDIR ; Propagate zero to rest of heap +; + ; Check sound filename (must be *.PT2, *.PT3, or *.MYM) + LD A,(FCB+1) ; Get first char of filename + CP ' ' ; Compare to blank + JP Z,ERRCMD ; If so, missing filename + LD A,(FCB+9) ; If the filetype + CP ' ' ; is blanks + JR NZ,HASEXT ; then assume + LD A,'P' ; type PT3. + LD (FCB+9),A + LD A,'T' ; Fill in + LD (FCB+10),A ; the file + LD A,'3' ; extension + LD (FCB+11),A ; and the + LD C,TYPPT3 ; file type + JR _SET +HASEXT LD A,(FCB+9) ; Extension char 1 + CP 'P' ; Check for 'P' + JP NZ,CHKMYM ; If not, check for MYM extension + LD A,(FCB+10) ; Extension char 2 + CP 'T' ; Check for 'T' + JP NZ,ERRNAM ; If not, bad file extension + LD A,(FCB+11) ; Extension char 3 + LD C,TYPPT2 ; Assume PT2 file type + CP '2' ; Check for '2' + JR Z,_SET ; If so, commit file type value + LD C,TYPPT3 ; Assume PT3 file type + CP '3' ; Check for '3' + JR Z,_SET ; If so, commit file type value + JP ERRNAM ; Anything else is a bad file extension +CHKMYM LD A,(FCB+9) ; Extension char 1 + CP 'M' ; Check for 'M' + JP NZ,ERRNAM ; If not, bad file extension + LD A,(FCB+10) ; Extension char 2 + CP 'Y' ; Check for 'Y' + JP NZ,ERRNAM ; If not, bad file extension + LD A,(FCB+11) ; Extension char 3 + LD C,TYPMYM ; Assume MYM file type + CP 'M' ; Check for 'M' + JR Z,_SET ; If so, commit file type value + JP ERRNAM ; Anything else is a bad file extension +_SET LD A,C ; Get file type value + LD (FILTYP),A ; Save file type value +; + CALL CLI_ABRT_UNSUPPFILTYP + + ; Load sound file +_LD0 LD C,15 ; CPM Open File function + LD DE,FCB ; FCB + CALL BDOS ; Do it + INC A ; Test for error $FF + JP Z,ERRFIL ; Handle file error +; + LD A,(FILTYP) ; Get file type + LD HL,MDLADDR ; Assume load address + LD (DMA),HL ; ... for PTx files + CP TYPMYM ; MYM file? + JR NZ,_LD ; If not, all set + LD HL,rows ; Otherwise, load address + LD (DMA),HL ; ... for MYM files +; +_LD LD HL,(DMA) ; Get load address + PUSH HL ; Save it + LD DE,128 ; Bump by size of + ADD HL,DE ; ... one record + LD (DMA),HL ; Save for next loop + LD A,HEAPEND >> 8 ; A := page limit for load + CP H ; Check to see if limit hit + JP Z,ERRSIZ ; Handle size error + POP DE ; Restore current DMA to DE + LD C,26 ; CPM Set DMA function + CALL BDOS ; Read next 128 bytes +; + LD C,20 ; CPM Read Sequential function + LD DE,FCB ; FCB + CALL BDOS ; Read next 128 bytes + OR A ; Set flags to check EOF + JR NZ,_LDX ; Non-zero is EOF + JR Z,_LD ; Load loop +; +_LDX LD C,16 ; CPM Close File function + LD DE,FCB ; FCB + CALL BDOS ; Do it +; + ; Play loop +; CALL CRLF2 ; Formatting +; LD DE,MSGPLY ; Playing message +; CALL PRTSTR ; Print message + ;CALL CRLF2 ; Formatting + ;CALL SLOWCPU + LD A,(FILTYP) ; Get file type + CP TYPPT2 ; PT2? + JR Z,GOPT2 ; If so, do it + CP TYPPT3 ; PT3? + JR Z,GOPT3 ; If so, do it + CP TYPMYM ; MYM? + JR Z,gomym ; If so, do it + JP ERRNAM ; This should never happen + +GOPT2 LD A,2 ; SETUP value to PT2 sound files + LD (START+10),A ; Save it + ; Avg TS / quark for PT2 files has *not* been measured!!! + LD DE,185 ; Avg TS / quark = 7400, so 185 delay loops + JR GOPTX ; Play PTx file + +GOPT3 LD A,0 ; SETUP value to PT3 sound files + LD (START+10),A ; Save it + LD DE,185 ; Avg TS / quark = 7400, so 185 delay loops + JR GOPTX ; Play PTx file + +GOPTX + CALL CRLF2 + LD DE, MSGSONGNAME ; Print song name message + CALL PRTSTR + LD DE, MDLADDR + $1E ; Print 32 character long song name from module + LD B, $20 +GOPTX1 LD A,(DE) + CALL PRTCHR + INC DE + DJNZ GOPTX1 + CALL CRLF + LD DE, MSGARTIST ; Print "by" message + CALL PRTSTR + LD DE, MDLADDR + $42 ; Print 32 character long composer/artist from module + LD B, $20 +GOPTX2 LD A,(DE) + CALL PRTCHR + INC DE + DJNZ GOPTX2 + CALL CRLF2 ; Formatting + LD DE,MSGPLY ; Playing message + CALL PRTSTR ; Print message + LD HL,(QDLY) ; Get basic quark delay + OR A ; Clear carry + SBC HL,DE ; Adjust for file type + LD (QDLY),HL ; Save updated quark delay factor + CALL START ; Do initialization +PTXLP CALL START+5 ; Play one quark + LD A,(START+10) ; Get setup byte + BIT 7,A ; Check bit 7 (loop point passed) + JR NZ,EXIT ; Bail out when done playing + CALL GETKEY ; Check for keypress + JR NZ,EXIT ; Abort on keypress + ;LD A,13 ; Back to + ;CALL PRTCHR ; ... start of line + ;LD A,(CurPos) ; Get current position + ;CALL PRTHEX ; ... and display it + CALL WAITQ ; Wait one quark period + JR PTXLP ; Loop for next quark +; +gomym + CALL CRLF2 ; Formatting + LD DE,MSGPLY ; Playing message + CALL PRTSTR ; Print message + ld hl,(QDLY) ; Get basic quark delay + or a ; Clear carry + ld de,125 ; Avg TS / quark = ~5000, so 125 delay loops + sbc hl,de ; Adjust for file type + ld (QDLY),hl ; Save updated quark delay factor + ;ld bc,(rows) + ;call PRTHEXWORD + call mymini ; Initialize player + call extract ; Unpack the first fragment +mymlp call extract + jr nc,EXIT ; CF clear at end of tune +waitvb call WAITQ + call upsg ; Update PSG registers + call GETKEY ; Check for keypess + jr nz,EXIT ; Bail out if so + ld a,(played) ; Wait until VBI has played a fragment + or a + jr nz,waitvb + ld (psource),iy + ld a,FRAG + ld (played),a + ;call PRTDOT + jr mymlp +; +EXIT CALL START+8 ; Mute audio + ;CALL NORMCPU + ;CALL CRLF2 ; Formatting + LD DE,MSGEND ; Completion message + CALL PRTSTR ; Print message + CALL CRLF ; Formatting + JP 0 ; Exit the easy way + +#include "timing.inc" +#include "strings.inc" +#include "cli.inc" +#include "printing.inc" + +; +; Get a keystroke from CPM +; +GETKEY LD C,6 ; BDOS direct I/O + LD E,$FF ; Get character if available + CALL BDOS ; Call BDOS + OR A ; Set flags, Z set if no key + RET ; Done +; +; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 +; +IDBIO: +; + ; Check for UNA (UBIOS) + LD A,($FFFD) ; fixed location of UNA API vector + CP $C3 ; jp instruction? + JR NZ,IDBIO1 ; if not, not UNA + LD HL,($FFFE) ; get jp address + LD A,(HL) ; get byte at target address + CP $FD ; first byte of UNA push ix instruction + JR NZ,IDBIO1 ; if not, not UNA + INC HL ; point to next byte + LD A,(HL) ; get next byte + CP $E5 ; second byte of UNA push ix instruction + JR NZ,IDBIO1 ; if not, not UNA, check others +; + LD BC,$04FA ; UNA: get BIOS date and version + RST 08 ; DE := ver, HL := date +; + LD A,2 ; UNA BIOS id = 2 + RET ; and done +; +IDBIO1: + ; Check for RomWBW (HBIOS) + LD HL,($FFFE) ; HL := HBIOS ident location + LD A,'W' ; First byte of ident + CP (HL) ; Compare + JR NZ,IDBIO2 ; Not HBIOS + INC HL ; Next byte of ident + LD A,~'W' ; Second byte of ident + CP (HL) ; Compare + JR NZ,IDBIO2 ; Not HBIOS +; + LD B,BF_SYSVER ; HBIOS: VER function + LD C,0 ; required reserved value + RST 08 ; DE := version, L := platform id +; + LD A,1 ; HBIOS BIOS id = 1 + RET ; and done +; +IDBIO2: + ; No idea what this is + XOR A ; Setup return value of 0 + RET ; and done +; +; +; +;SLOWCPU: +; LD A,(Z180) ; Z180 base I/O port +; CP $FF ; Check for no value +; RET Z ; Bail out if no value +; ADD A,$1E ; Apply offset of CMR register +; LD C,A ; And put it in C +; LD B,0 ; MSB for 16-bit I/O +; IN A,(C) ; Get current value +; LD (CMRSAV),A ; Save it to restore later +; XOR A ; Go slow +; OUT (C),A ; And update CMR +; INC C ; Now point to CCR register +; IN A,(C) ; Get current value +; LD (CCRSAV),A ; Save it to restore later +; XOR A ; Go slow +; OUT (C),A ; And update CCR +; RET +; +; +; +;NORMCPU: +; LD A,(Z180) ; Z180 base I/O port +; CP $FF ; Check for no value +; RET Z ; Bail out if no value +; ADD A,$1E ; Apply offset of CMR register +; LD C,A ; And put it in C +; LD B,0 ; MSB for 16-bit I/O +; LD A,(CMRSAV) ; Get original CMR value +; OUT (C),A ; And update CMR +; INC C ; Now point to CCR register +; LD A,(CCRSAV) ; Get original CCR value +; OUT (C),A ; And update CCR +; RET +; +; SLOW DOWN I/O FOR FAST CPU'S +; +SLOWIO: +#IF (CPUFAMZ180) + LD A,(Z180) ; Z180 base I/O port + CP $FF ; Check for no value + RET Z ; Bail out if no value + ADD A,$32 ; Apply offset of DCNTL register + LD C,A ; And put it in C + LD B,0 ; MSB for 16-bit I/O + IN A,(C) ; Get current value + LD (DCSAV),A ; Save it to restore later + OR %00110000 ; Force slow operation (I/O W/S=3) + OUT (C),A ; And update DCNTL +#ENDIF +#IF (SBCV2004) + LD A,8 ; sbc-v2-004 change to + OUT (112),A ; half clock speed +#ENDIF + RET +; +; RESTORE I/O SPEED FOR FAST CPU'S +; +NORMIO: +#IF (CPUFAMZ180) + LD A,(Z180) ; Z180 base I/O port + CP $FF ; Check for no value + RET Z ; Bail out if no value + ADD A,$32 ; Apply offset of DCNTL register + LD C,A ; And put it in C + LD B,0 ; MSB for 16-bit I/O + LD A,(DCSAV) ; Get saved DCNTL value + OUT (C),A ; And restore it +#ENDIF +#IF (SBCV2004) + LD A,0 ; sbc-v2-004 change to + OUT (112),A ; normal clock speed +#ENDIF + RET +; +ERRBIO: ; Invalid BIOS or version + LD DE,MSGBIO + JR ERR +; +ERRPLT: ; Invalid BIOS or version + LD DE,MSGPLT + JR ERR +; +ERRHW: ; Hardware error, sound chip not detected + LD DE,MSGHW + JR ERR +; +ERRCMD: ; Command error, display usage info + LD DE,MSGUSE + JR ERR +; +ERRNAM: ; Missing or invalid filename parameter + LD DE,MSGNAM + JR ERR +; +ERRFIL: ; Error opening sound file + LD DE,MSGFIL + JR ERR +; +ERRSIZ: ; Sound file is too large for memory + LD DE,MSGSIZ + JR ERR +; +ERR: ; print error string and return error signal + CALL CRLF2 ; print newline +; +ERR1: ; without the leading crlf + CALL PRTSTR ; print error string +; +ERR2: ; without the string + CALL CRLF ; print newline + JP 0 ; fast exit +; +; CONFIG TABLE, ENTRY ORDER MATCHES HBIOS PLATFORM ID +; +CFGSIZ .EQU 8 +; +CFGTBL: ; PLT RSEL RDAT RIN Z180 ACR + ; DESC + .DB $01, $9A, $9B, $9A, $FF, $9C ; SBC W/ SCG + .DW HWSTR_SCG +; + .DB $04, $9C, $9D, $9C, $40, $FF ; N8 W/ ONBOARD PSG + .DW HWSTR_N8 +; + .DB $05, $9A, $9B, $9A, $40, $9C ; MK4 W/ SCG + .DW HWSTR_SCG +; + .DB $07, $D8, $D0, $D8, $FF, $FF ; RCZ80 W/ RC SOUND MODULE (EB) + .DW HWSTR_RCEB +; + .DB $07, $A0, $A1, $A2, $FF, $FF ; RCZ80 W/ RC SOUND MODULE (EB Rev 6) + .DW HWSTR_RCEB6 +; + .DB $07, $D1, $D0, $D0, $FF, $FF ; RCZ80 W/ RC SOUND MODULE (MF) + .DW HWSTR_RCMF +; + .DB $07, $33, $32, $32, $FF, $FF ; RCZ80 W/ LINC SOUND MODULE + .DW HWSTR_LINC +; + .DB $08, $68, $60, $68, $C0, $FF ; RCZ180 W/ RC SOUND MODULE (EB) + .DW HWSTR_RCEB +; + .DB $08, $A0, $A1, $A2, $C0, $FF ; RCZ180 W/ RC SOUND MODULE (EB Rev 6) + .DW HWSTR_RCEB6 +; + .DB $08, $61, $60, $60, $C0, $FF ; RCZ180 W/ RC SOUND MODULE (MF) + .DW HWSTR_RCMF +; + .DB $08, $33, $32, $32, $C0, $FF ; RCZ180 W/ LINC SOUND MODULE + .DW HWSTR_LINC +; + .DB $09, $D8, $D0, $D8, $FF, $FF ; EZZ80 W/ RC SOUND MODULE (EB) + .DW HWSTR_RCEB +; + .DB $09, $A0, $A1, $A2, $FF, $FF ; EZZ80 W/ RC SOUND MODULE (EB Rev 6) + .DW HWSTR_RCEB6 +; + .DB $09, $D1, $D0, $D0, $FF, $FF ; EZZ80 W/ RC SOUND MODULE (MF) + .DW HWSTR_RCMF +; + .DB $09, $33, $32, $32, $FF, $FF ; EZZ80 W/ LINC SOUND MODULE + .DW HWSTR_LINC +; + .DB $0A, $68, $60, $68, $C0, $FF ; SCZ180 W/ RC SOUND MODULE (EB) + .DW HWSTR_RCEB +; + .DB $0A, $A0, $A1, $A2, $C0, $FF ; SCZ180 W/ RC SOUND MODULE (EB Rev 6) + .DW HWSTR_RCEB6 +; + .DB $0A, $61, $60, $60, $C0, $FF ; SCZ180 W/ RC SOUND MODULE (MF) + .DW HWSTR_RCMF +; + .DB $0A, $33, $32, $32, $C0, $FF ; SCZ180 W/ LINC SOUND MODULE + .DW HWSTR_LINC +; + .DB $0B, $D8, $D0, $D8, $FF, $FF ; RCZ280 W/ RC SOUND MODULE (EB) + .DW HWSTR_RCEB +; + .DB $0B, $A0, $A1, $A2, $FF, $FF ; RCZ280 W/ RC SOUND MODULE (EB Rev 6) + .DW HWSTR_RCEB6 +; + .DB $0B, $D1, $D0, $D0, $FF, $FF ; RCZ280 W/ RC SOUND MODULE (MF) + .DW HWSTR_RCMF +; + .DB $0B, $33, $32, $32, $FF, $FF ; RCZ280 W/ LINC SOUND MODULE + .DW HWSTR_LINC +; + .DB 13, $A0, $A1, $A0, $FF, $A2 ; MBC + .DW HWSTR_MBC +; + .DB $FF ; END OF TABLE MARKER +; +CFG: ; ACTIVE CONFIG VALUES (FROM SELECTED CFGTBL ENTRY) +PLT .DB 0 ; RomWBW HBIOS platform id +PORTS: +RSEL .DB 0 ; Register selection port +RDAT .DB 0 ; Register data port +RIN .DB 0 ; Register input port +Z180 .DB 0 ; Z180 base I/O port +ACR .DB 0 ; Aux Ctrl Reg I/O port on SCG +DESC .DW 0 ; Hardware description string adr +; +CURPLT .DB 0 ; Current platform id reported by HBIOS +QDLY .DW 0 ; quark delay factor +WMOD .DB 0 ; delay mode, non-zero to use timer +DCSAV .DB 0 ; for saving original Z180 DCNTL value +CCRSAV .DB 0 ; for saving original Z180 CCR value +CMRSAV .DB 0 ; for saving original Z180 CMR value +; +DMA .DW 0 ; Working DMA +FILTYP .DB 0 ; Sound file type (TYPPT2, TYPPT3, TYPMYM) +; +TMP .DB 0 ; work around use of undocumented Z80 + +HBIOSMD .DB 0 ; NON-ZERO IF USING HBIOS SOUND DRIVER, ZERO OTHERWISE +OCTAVEADJ .DB 0 ; AMOUNT TO ADJUST OCTAVE UP OR DOWN + +MSGBAN .DB "Tune Player for RomWBW v3.5, 20-Mar-2022",0 +MSGUSE .DB "Copyright (C) 2021, Wayne Warthen, GNU GPL v3",13,10 + .DB "PTxPlayer Copyright (C) 2004-2007 S.V.Bulba",13,10 + .DB "MYMPlay by Marq/Lieves!Tuore",13,10,13,10 + .DB "Usage: TUNE .[PT2|PT3|MYM] [--hbios] [+tn|-tn]",0 +MSGBIO .DB "Incompatible BIOS or version, " + .DB "HBIOS v", '0' + RMJ, ".", '0' + RMN, " required",0 +MSGPLT .DB "Hardware error, system not supported!",0 +MSGHW .DB "Hardware error, sound chip not detected!",0 +MSGNAM .DB "Sound filename invalid (must be .PT2, .PT3, or .MYM)",0 +MSGFIL .DB "Sound file not found!",0 +MSGSIZ .DB "Sound file too large to load!",0 +MSGTIM .DB ", timer mode",0 +MSGDLY .DB ", delay mode",0 +MSGPLY .DB "Playing...",0 +MSGEND .DB " Done",0 +MSGERR .DB "App Error", 0 +; +HWSTR_SCG .DB "SCG ECB Board",0 +HWSTR_N8 .DB "N8 Onboard Sound",0 +HWSTR_RCEB .DB "RCBus Sound Module (EB)",0 +HWSTR_RCEB6 .DB "RCBus Sound Module (EBv6)",0 +HWSTR_RCMF .DB "RCBus Sound Module (MF)",0 +HWSTR_LINC .DB "Z50 LiNC Sound Module",0 +HWSTR_MBC .DB "NHYODYNE Sound Module",0 + +MSGUNSUP .db "MYM files not supported with HBIOS yet!\r\n", 0 + +MSGSONGNAME .DB "Song name: ", 0 +MSGARTIST .DB "by: ", 0 +; +;=============================================================================== +; PTx Player Routines +;=============================================================================== +; +;Universal PT2 and PT3 player for ZX Spectrum and MSX +;(c)2004-2007 S.V.Bulba +;http://bulba.untergrund.net (http://bulba.at.kz) + + +;Features +;-------- +;-Can be compiled at any address (i.e. no need rounding ORG +; address). +;-Variables (VARS) can be located at any address (not only after +;code block). +;-INIT subprogram checks PT3-module version and rightly +; generates both note and volume tables outside of code block +; (in VARS). +;-Two portamento (spc. command 3xxx) algorithms (depending of +; PT3 module version). +;-New 1.XX and 2.XX special command behaviour (only for PT v3.7 +; and higher). +;-Any Tempo value are accepted (including Tempo=1 and Tempo=2). +;-Fully compatible with Ay_Emul PT3 and PT2 players codes. +;-See also notes at the end of this source code. + +;Limitations +;----------- +;-Can run in RAM only (self-modified code is used). +;-PT2 position list must be end by $FF marker only. + +;Warning!!! PLAY subprogram can crash if no module are loaded +;into RAM or INIT subprogram was not called before. + +;Call MUTE or INIT one more time to mute sound after stopping +;playing + + ;ORG $C000 +;Test codes (commented) +; LD A,2 ;PT2,ABC,Looped +; LD (START+10),A +; CALL START +; EI +;_LP HALT +; CALL START+5 +; XOR A +; IN A,($FE) +; CPL +; AND 15 +; JR Z,_LP +; JR START+8 + +TonA .EQU 0 +TonB .EQU 2 +TonC .EQU 4 +Noise .EQU 6 +Mixer .EQU 7 +AmplA .EQU 8 +AmplB .EQU 9 +AmplC .EQU 10 +Env .EQU 11 +EnvTp .EQU 13 + +;ChannelsVars +; STRUCT CHP +;reset group +PsInOr .EQU 0 +PsInSm .EQU 1 +CrAmSl .EQU 2 +CrNsSl .EQU 3 +CrEnSl .EQU 4 +TSlCnt .EQU 5 +CrTnSl .EQU 6 +TnAcc .EQU 8 +COnOff .EQU 10 +;reset group + +OnOffD .EQU 11 + +;IX for PTDECOD here (+12) +OffOnD .EQU 12 +OrnPtr .EQU 13 +SamPtr .EQU 15 +NNtSkp .EQU 17 +Note .EQU 18 +SlToNt .EQU 19 +Env_En .EQU 20 +Flags .EQU 21 + ;Enabled - 0,SimpleGliss - 2 +TnSlDl .EQU 22 +TSlStp .EQU 23 +TnDelt .EQU 25 +NtSkCn .EQU 27 +Volume .EQU 28 +; ENDS +CHP .EQU 29 + +;Entry and other points +;START initialize playing of module at MDLADDR +;START+3 initialization with module address in HL +;START+5 play one quark +;START+8 mute +;START+10 setup and status flags +;START+11 current position value (byte) (optional) + +START + LD HL,MDLADDR + JR INIT + JP PLAY + JR MUTE +SETUP .DB 0 ;set bit0, if you want to play without looping + ;(optional); + ;set bit1 for PT2 and reset for PT3 before + ;calling INIT; + ;bits2-3: %00-ABC, %01 ACB, %10 BAC (optional); + ;bits4-6 are not used + ;bit7 is set each time, when loop point is passed + ;(optional) +#IF CurPosCounter +CurPos .DB 0 ;for visualization only (i.e. no need for playing) +#ENDIF + +;Identifier + .IF Id + .DB "=Uni PT2 and PT3 Player r." + .DB Release + .DB "=" + .ENDIF + + .IF LoopChecker +CHECKLP LD HL,SETUP + SET 7,(HL) + BIT 0,(HL) + RET Z + POP HL + LD HL,DelyCnt + INC (HL) + LD HL,ChanA+NtSkCn + INC (HL) + .ENDIF + +MUTE ISHBIOS + JR NZ,MUTEVIAHBIOS + + XOR A + LD H,A + LD L,A + LD (AYREGS+AmplA),A + LD (AYREGS+AmplB),HL + JP ROUT + +MUTEVIAHBIOS: + LD B,BF_SNDRESET + LD C,0 + RST 08 + RET + +INIT +;HL - AddressOfModule + LD A,(START+10) + AND 2 + JR NZ,INITPT2 + + CALL SETMDAD + PUSH HL + LD DE,100 + ADD HL,DE + LD A,(HL) + LD (Delay),A + PUSH HL + POP IX + ADD HL,DE + LD (CrPsPtr),HL + LD E,(IX+102-100) + INC HL + +#IF CurPosCounter + LD A,L + LD (PosSub+1),A +#ENDIF + + ADD HL,DE + LD (LPosPtr),HL + POP DE + LD L,(IX+103-100) + LD H,(IX+104-100) + ADD HL,DE + LD (PatsPtr),HL + LD HL,169 + ADD HL,DE + LD (OrnPtrs),HL + LD HL,105 + ADD HL,DE + LD (SamPtrs),HL + LD A,(IX+13-100) ;EXTRACT VERSION NUMBER + SUB $30 + JR C,L20 + CP 10 + JR C,L21 +L20 LD A,6 +L21 LD (Version),A + PUSH AF ;VolTable version + CP 4 + LD A,(IX+99-100) ;TONE TABLE NUMBER + RLA + AND 7 + PUSH AF ;NoteTable number + LD HL,(e_-SamCnv-2)*256+$18 + LD (SamCnv),HL + LD A,$BA + LD (OrnCP),A + LD (SamCP),A + LD A,$7B + LD (OrnLD),A + LD (SamLD),A + LD A,$87 + LD (SamClc2),A + LD BC,PT3PD + LD HL,0 + LD DE,PT3EMPTYORN + JR INITCOMMON + +INITPT2 LD A,(HL) + LD (Delay),A + PUSH HL + PUSH HL + PUSH HL + INC HL + INC HL + LD A,(HL) + INC HL + LD (SamPtrs),HL + LD E,(HL) + INC HL + LD D,(HL) + POP HL + AND A + SBC HL,DE + CALL SETMDAD + POP HL + LD DE,67 + ADD HL,DE + LD (OrnPtrs),HL + LD E,32 + ADD HL,DE + LD C,(HL) + INC HL + LD B,(HL) + LD E,30 + ADD HL,DE + LD (CrPsPtr),HL + LD E,A + INC HL + +#IF CurPosCounter + LD A,L + LD (PosSub+1),A +#ENDIF + + ADD HL,DE + LD (LPosPtr),HL + POP HL + ADD HL,BC + LD (PatsPtr),HL + LD A,5 + LD (Version),A + PUSH AF + LD A,2 + PUSH AF + LD HL,$51CB + LD (SamCnv),HL + LD A,$BB + LD (OrnCP),A + LD (SamCP),A + LD A,$7A + LD (OrnLD),A + LD (SamLD),A + LD A,$80 + LD (SamClc2),A + LD BC,PT2PD + LD HL,$8687 + LD DE,PT2EMPTYORN + +INITCOMMON + + LD (PTDECOD+1),BC + LD (PsCalc),HL + PUSH DE + +;note table data depacker +;(c) Ivan Roshin + LD DE,T_PACK + LD BC,T1_+(2*49)-1 +TP_0 LD A,(DE) + INC DE + CP 15*2 + JR NC,TP_1 + LD H,A + LD A,(DE) + LD L,A + INC DE + JR TP_2 +TP_1 PUSH DE + LD D,0 + LD E,A + ADD HL,DE + ADD HL,DE + POP DE +TP_2 LD A,H + LD (BC),A + DEC BC + LD A,L + LD (BC),A + DEC BC + SUB ($F8*2) & $FF + JR NZ,TP_0 + +#IF LoopChecker + LD HL,SETUP + RES 7,(HL) + + #IF CurPosCounter + INC HL + LD (HL),A + #ENDIF + +#ELSE + + #IF CurPosCounter + LD (CurPos),A + #ENDIF + +#ENDIF + + LD HL,VARS + LD (HL),A + LD DE,VARS+1 + LD BC,VAR0END-VARS-1 + LDIR + LD (AdInPtA),HL ;ptr to zero + INC A + LD (DelyCnt),A + LD HL,$F001 ;H - Volume, L - NtSkCn + LD (ChanA+NtSkCn),HL + LD (ChanB+NtSkCn),HL + LD (ChanC+NtSkCn),HL + POP HL + LD (ChanA+OrnPtr),HL + LD (ChanB+OrnPtr),HL + LD (ChanC+OrnPtr),HL + + POP AF + +;NoteTableCreator (c) Ivan Roshin +;A - NoteTableNumber*2+VersionForNoteTable +;(xx1b - 3.xx..3.4r, xx0b - 3.4x..3.6x..VTII1.0) + + LD HL,NT_DATA + PUSH DE + LD D,B + ADD A,A + LD E,A + ADD HL,DE + LD E,(HL) + INC HL + SRL E + SBC A,A + AND $A7 ;$00 (NOP) or $A7 (AND A) + LD (L3),A + EX DE,HL + POP BC ;BC=T1_ + ADD HL,BC + + LD A,(DE) + ADD A,T_ & $FF + LD C,A + ADC A,T_/256 + SUB C + LD B,A + PUSH BC + LD DE,NT_ + PUSH DE + + LD B,12 + LD IX,TMP ; +WW +L1 PUSH BC + LD C,(HL) + INC HL + PUSH HL + LD B,(HL) + + PUSH DE + EX DE,HL + LD DE,23 + ;LD IXH,8 ; -WW + LD (IX),8 ; +WW + +L2 SRL B + RR C +L3 .DB $19 ;AND A or NOP + LD A,C + ADC A,D ;=ADC 0 + LD (HL),A + INC HL + LD A,B + ADC A,D + LD (HL),A + ADD HL,DE + ;DEC IXH ; -WW + DEC (IX) ; +WW + JR NZ,L2 + + POP DE + INC DE + INC DE + POP HL + INC HL + POP BC + DJNZ L1 + + POP HL + POP DE + + LD A,E + CP TCOLD_1 & $FF + JR NZ,CORR_1 + LD A,$FD + LD (NT_+$2E),A + +CORR_1 LD A,(DE) + AND A + JR Z,TC_EXIT + RRA + PUSH AF + ADD A,A + LD C,A + ADD HL,BC + POP AF + JR NC,CORR_2 + DEC (HL) + DEC (HL) +CORR_2 INC (HL) + AND A + SBC HL,BC + INC DE + JR CORR_1 + +TC_EXIT + + POP AF + +;VolTableCreator (c) Ivan Roshin +;A - VersionForVolumeTable (0..4 - 3.xx..3.4x; + ;5.. - 2.x,3.5x..3.6x..VTII1.0) + + CP 5 + LD HL,$11 + LD D,H + LD E,H + LD A,$17 + JR NC,M1 + DEC L + LD E,L + XOR A +M1 LD (M2),A + + LD IX,VT_+16 + + LD C,$F +INITV2 PUSH HL + + ADD HL,DE + EX DE,HL + SBC HL,HL + + LD B,$10 +INITV1 LD A,L +M2 .DB $7D + LD A,H + ADC A,0 + LD (IX),A + INC IX + ADD HL,DE + DJNZ INITV1 + + POP HL + LD A,E + CP $77 + JR NZ,M3 + INC E +M3 DEC C + JR NZ,INITV2 + + JP ROUT + +SETMDAD LD (MODADDR),HL + LD (MDADDR1),HL + LD (MDADDR2),HL + RET + +PTDECOD JP $C3C3 + +;PT2 pattern decoder +PD2_SAM CALL SETSAM + JR PD2_LOOP + +PD2_EOff LD (IX-12+Env_En),A + JR PD2_LOOP + +PD2_ENV LD (IX-12+Env_En),16 + LD (AYREGS+EnvTp),A + LD A,(BC) + INC BC + LD L,A + LD A,(BC) + INC BC + LD H,A + LD (EnvBase),HL + JR PD2_LOOP + +PD2_ORN CALL SETORN + JR PD2_LOOP + +PD2_SKIP INC A + LD (IX-12+NNtSkp),A + JR PD2_LOOP + +PD2_VOL RRCA + RRCA + RRCA + RRCA + LD (IX-12+Volume),A + JR PD2_LOOP + +PD2_DEL CALL C_DELAY + JR PD2_LOOP + +PD2_GLIS SET 2,(IX-12+Flags) + INC A + LD (IX-12+TnSlDl),A + LD (IX-12+TSlCnt),A + LD A,(BC) + INC BC + LD (IX-12+TSlStp),A + ADD A,A + SBC A,A + LD (IX-12+TSlStp+1),A + SCF + JR PD2_LP2 + +PT2PD AND A + +PD2_LP2 EX AF,AF' + +PD2_LOOP LD A,(BC) + INC BC + ADD A,$20 + JR Z,PD2_REL + JR C,PD2_SAM + ADD A,96 + JR C,PD2_NOTE + INC A + JR Z,PD2_EOff + ADD A,15 + JP Z,PD_FIN + JR C,PD2_ENV + ADD A,$10 + JR C,PD2_ORN + ADD A,$40 + JR C,PD2_SKIP + ADD A,$10 + JR C,PD2_VOL + INC A + JR Z,PD2_DEL + INC A + JR Z,PD2_GLIS + INC A + JR Z,PD2_PORT + INC A + JR Z,PD2_STOP + LD A,(BC) + INC BC + LD (IX-12+CrNsSl),A + JR PD2_LOOP + +PD2_PORT RES 2,(IX-12+Flags) + LD A,(BC) + INC BC + INC BC ;ignoring precalc delta to right sound + INC BC + SCF + JR PD2_LP2 + +PD2_STOP LD (IX-12+TSlCnt),A + JR PD2_LOOP + +PD2_REL LD (IX-12+Flags),A + JR PD2_EXIT + +PD2_NOTE LD L,A + LD A,(IX-12+Note) + LD (PrNote+1),A + LD (IX-12+Note),L + XOR A + LD (IX-12+TSlCnt),A + SET 0,(IX-12+Flags) + EX AF,AF' + JR NC,NOGLIS2 + BIT 2,(IX-12+Flags) + JR NZ,NOPORT2 + LD (LoStep),A + ADD A,A + SBC A,A + EX AF,AF' + LD H,A + LD L,A + INC A + CALL SETPORT +NOPORT2 LD (IX-12+TSlCnt),1 +NOGLIS2 XOR A + + +PD2_EXIT LD (IX-12+PsInSm),A + LD (IX-12+PsInOr),A + LD (IX-12+CrTnSl),A + LD (IX-12+CrTnSl+1),A + JP PD_FIN + +;PT3 pattern decoder +PD_OrSm LD (IX-12+Env_En),0 + CALL SETORN +PD_SAM_ LD A,(BC) + INC BC + RRCA + +PD_SAM CALL SETSAM + JR PD_LOOP + +PD_VOL RRCA + RRCA + RRCA + RRCA + LD (IX-12+Volume),A + JR PD_LP2 + +PD_EOff LD (IX-12+Env_En),A + LD (IX-12+PsInOr),A + JR PD_LP2 + +PD_SorE DEC A + JR NZ,PD_ENV + LD A,(BC) + INC BC + LD (IX-12+NNtSkp),A + JR PD_LP2 + +PD_ENV CALL SETENV + JR PD_LP2 + +PD_ORN CALL SETORN + JR PD_LOOP + +PD_ESAM LD (IX-12+Env_En),A + LD (IX-12+PsInOr),A + CALL NZ,SETENV + JR PD_SAM_ + +PT3PD LD A,(IX-12+Note) + LD (PrNote+1),A + LD L,(IX-12+CrTnSl) + LD H,(IX-12+CrTnSl+1) + LD (PrSlide+1),HL + +PD_LOOP LD DE,$2010 +PD_LP2 LD A,(BC) + INC BC + ADD A,E + JR C,PD_OrSm + ADD A,D + JR Z,PD_FIN + JR C,PD_SAM + ADD A,E + JR Z,PD_REL + JR C,PD_VOL + ADD A,E + JR Z,PD_EOff + JR C,PD_SorE + ADD A,96 + JR C,PD_NOTE + ADD A,E + JR C,PD_ORN + ADD A,D + JR C,PD_NOIS + ADD A,E + JR C,PD_ESAM + ADD A,A + LD E,A + LD HL,SPCCOMS+$FF20-$2000 + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) + PUSH DE + JR PD_LOOP + +PD_NOIS LD (Ns_Base),A + JR PD_LP2 + +PD_REL RES 0,(IX-12+Flags) + JR PD_RES + +PD_NOTE LD (IX-12+Note),A + SET 0,(IX-12+Flags) + XOR A + +PD_RES LD (PDSP_+1),SP + LD SP,IX + LD H,A + LD L,A + PUSH HL + PUSH HL + PUSH HL + PUSH HL + PUSH HL + PUSH HL +PDSP_ LD SP,$3131 + +PD_FIN LD A,(IX-12+NNtSkp) + LD (IX-12+NtSkCn),A + RET + +C_PORTM LD A,(BC) + INC BC +;SKIP PRECALCULATED TONE DELTA (BECAUSE +;CANNOT BE RIGHT AFTER PT3 COMPILATION) + INC BC + INC BC + EX AF,AF' + LD A,(BC) ;SIGNED TONE STEP + INC BC + LD (LoStep),A + LD A,(BC) + INC BC + AND A + EX AF,AF' + LD L,(IX-12+CrTnSl) + LD H,(IX-12+CrTnSl+1) + +;Set portamento variables +;A - Delay; A' - Hi(Step); ZF' - (A'=0); HL - CrTnSl + +SETPORT RES 2,(IX-12+Flags) + LD (IX-12+TnSlDl),A + LD (IX-12+TSlCnt),A + PUSH HL + LD DE,NT_ + LD A,(IX-12+Note) + LD (IX-12+SlToNt),A + ADD A,A + LD L,A + LD H,0 + ADD HL,DE + LD A,(HL) + INC HL + LD H,(HL) + LD L,A + PUSH HL +PrNote LD A,$3E + LD (IX-12+Note),A + ADD A,A + LD L,A + LD H,0 + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) + POP HL + SBC HL,DE + LD (IX-12+TnDelt),L + LD (IX-12+TnDelt+1),H + POP DE +Version .EQU $+1 + LD A,$3E + CP 6 + JR C,OLDPRTM ;Old 3xxx for PT v3.5- +PrSlide LD DE,$1111 + LD (IX-12+CrTnSl),E + LD (IX-12+CrTnSl+1),D +LoStep .EQU $+1 +OLDPRTM LD A,$3E + EX AF,AF' + JR Z,NOSIG + EX DE,HL +NOSIG SBC HL,DE + JP P,SET_STP + CPL + EX AF,AF' + NEG + EX AF,AF' +SET_STP LD (IX-12+TSlStp+1),A + EX AF,AF' + LD (IX-12+TSlStp),A + LD (IX-12+COnOff),0 + RET + +C_GLISS SET 2,(IX-12+Flags) + LD A,(BC) + INC BC + LD (IX-12+TnSlDl),A + AND A + JR NZ,GL36 + LD A,(Version) ;AlCo PT3.7+ + CP 7 + SBC A,A + INC A +GL36 LD (IX-12+TSlCnt),A + LD A,(BC) + INC BC + EX AF,AF' + LD A,(BC) + INC BC + JR SET_STP + +C_SMPOS LD A,(BC) + INC BC + LD (IX-12+PsInSm),A + RET + +C_ORPOS LD A,(BC) + INC BC + LD (IX-12+PsInOr),A + RET + +C_VIBRT LD A,(BC) + INC BC + LD (IX-12+OnOffD),A + LD (IX-12+COnOff),A + LD A,(BC) + INC BC + LD (IX-12+OffOnD),A + XOR A + LD (IX-12+TSlCnt),A + LD (IX-12+CrTnSl),A + LD (IX-12+CrTnSl+1),A + RET + +C_ENGLS LD A,(BC) + INC BC + LD (Env_Del),A + LD (CurEDel),A + LD A,(BC) + INC BC + LD L,A + LD A,(BC) + INC BC + LD H,A + LD (ESldAdd),HL + RET + +C_DELAY LD A,(BC) + INC BC + LD (Delay),A + RET + +SETENV LD (IX-12+Env_En),E + LD (AYREGS+EnvTp),A + LD A,(BC) + INC BC + LD H,A + LD A,(BC) + INC BC + LD L,A + LD (EnvBase),HL + XOR A + LD (IX-12+PsInOr),A + LD (CurEDel),A + LD H,A + LD L,A + LD (CurESld),HL +C_NOP RET + +SETORN ADD A,A + LD E,A + LD D,0 + LD (IX-12+PsInOr),D +OrnPtrs .EQU $+1 + LD HL,$2121 + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) +MDADDR2 .EQU $+1 + LD HL,$2121 + ADD HL,DE + LD (IX-12+OrnPtr),L + LD (IX-12+OrnPtr+1),H + RET + +SETSAM ADD A,A + LD E,A + LD D,0 +SamPtrs .EQU $+1 + LD HL,$2121 + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) +MDADDR1 .EQU $+1 + LD HL,$2121 + ADD HL,DE + LD (IX-12+SamPtr),L + LD (IX-12+SamPtr+1),H + RET + +;ALL 16 ADDRESSES TO PROTECT FROM BROKEN PT3 MODULES +SPCCOMS .DW C_NOP + .DW C_GLISS + .DW C_PORTM + .DW C_SMPOS + .DW C_ORPOS + .DW C_VIBRT + .DW C_NOP + .DW C_NOP + .DW C_ENGLS + .DW C_DELAY + .DW C_NOP + .DW C_NOP + .DW C_NOP + .DW C_NOP + .DW C_NOP + .DW C_NOP + +CHREGS XOR A + LD (Ampl),A + BIT 0,(IX+Flags) + PUSH HL + JP Z,CH_EXIT + LD (CSP_+1),SP + LD L,(IX+OrnPtr) + LD H,(IX+OrnPtr+1) + LD SP,HL + POP DE + LD H,A + LD A,(IX+PsInOr) + LD L,A + ADD HL,SP + INC A + ;PT2 PT3 +OrnCP INC A ;CP E CP D + JR C,CH_ORPS +OrnLD .DB 1 ;LD A,D LD A,E +CH_ORPS LD (IX+PsInOr),A + LD A,(IX+Note) + ADD A,(HL) + JP P,CH_NTP + XOR A +CH_NTP CP 96 + JR C,CH_NOK + LD A,95 +CH_NOK ADD A,A + EX AF,AF' + LD L,(IX+SamPtr) + LD H,(IX+SamPtr+1) + LD SP,HL + POP DE + LD H,0 + LD A,(IX+PsInSm) + LD B,A + ADD A,A +SamClc2 ADD A,A ;or ADD A,B for PT2 + LD L,A + ADD HL,SP + LD SP,HL + LD A,B + INC A + ;PT2 PT3 +SamCP INC A ;CP E CP D + JR C,CH_SMPS +SamLD .DB 1 ;LD A,D LD A,E +CH_SMPS LD (IX+PsInSm),A + POP BC + POP HL + +;Convert PT2 sample to PT3 + ;PT2 PT3 +SamCnv POP HL ;BIT 2,C JR e_ + POP HL + LD H,B + JR NZ,$+8 + EX DE,HL + AND A + SBC HL,HL + SBC HL,DE + LD D,C + RR C + SBC A,A + CPL + AND $3E + RR C + RR B + AND C + LD C,A + LD A,B + RRA + RRA + RR D + RRA + AND $9F + LD B,A + +e_ LD E,(IX+TnAcc) + LD D,(IX+TnAcc+1) + ADD HL,DE + BIT 6,B + JR Z,CH_NOAC + LD (IX+TnAcc),L + LD (IX+TnAcc+1),H +CH_NOAC EX DE,HL + EX AF,AF' + ADD A,NT_ & $FF + LD L,A + ADC A,NT_/256 + SUB L + LD H,A + LD SP,HL + POP HL + ADD HL,DE + LD E,(IX+CrTnSl) + LD D,(IX+CrTnSl+1) + ADD HL,DE +CSP_ LD SP,$3131 + EX (SP),HL + XOR A + OR (IX+TSlCnt) + JR Z,CH_AMP + DEC (IX+TSlCnt) + JR NZ,CH_AMP + LD A,(IX+TnSlDl) + LD (IX+TSlCnt),A + LD L,(IX+TSlStp) + LD H,(IX+TSlStp+1) + LD A,H + ADD HL,DE + LD (IX+CrTnSl),L + LD (IX+CrTnSl+1),H + BIT 2,(IX+Flags) + JR NZ,CH_AMP + LD E,(IX+TnDelt) + LD D,(IX+TnDelt+1) + AND A + JR Z,CH_STPP + EX DE,HL +CH_STPP SBC HL,DE + JP M,CH_AMP + LD A,(IX+SlToNt) + LD (IX+Note),A + XOR A + LD (IX+TSlCnt),A + LD (IX+CrTnSl),A + LD (IX+CrTnSl+1),A +CH_AMP LD A,(IX+CrAmSl) + BIT 7,C + JR Z,CH_NOAM + BIT 6,C + JR Z,CH_AMIN + CP 15 + JR Z,CH_NOAM + INC A + JR CH_SVAM +CH_AMIN CP -15 + JR Z,CH_NOAM + DEC A +CH_SVAM LD (IX+CrAmSl),A +CH_NOAM LD L,A + LD A,B + AND 15 + ADD A,L + JP P,CH_APOS + XOR A +CH_APOS CP 16 + JR C,CH_VOL + LD A,15 +CH_VOL OR (IX+Volume) + ADD A,VT_ & $FF + LD L,A + ADC A,VT_/256 + SUB L + LD H,A + LD A,(HL) +CH_ENV BIT 0,C + JR NZ,CH_NOEN + OR (IX+Env_En) +CH_NOEN LD (Ampl),A + BIT 7,B + LD A,C + JR Z,NO_ENSL + RLA + RLA + SRA A + SRA A + SRA A + ADD A,(IX+CrEnSl) ;SEE COMMENT BELOW + BIT 5,B + JR Z,NO_ENAC + LD (IX+CrEnSl),A +NO_ENAC LD HL,AddToEn + ADD A,(HL) ;BUG IN PT3 - NEED WORD HERE + LD (HL),A + JR CH_MIX +NO_ENSL RRA + ADD A,(IX+CrNsSl) + LD (AddToNs),A + BIT 5,B + JR Z,CH_MIX + LD (IX+CrNsSl),A +CH_MIX LD A,B + RRA + AND $48 +CH_EXIT LD HL,AYREGS+Mixer + OR (HL) + RRCA + LD (HL),A + POP HL + XOR A + OR (IX+COnOff) + RET Z + DEC (IX+COnOff) + RET NZ + XOR (IX+Flags) + LD (IX+Flags),A + RRA + LD A,(IX+OnOffD) + JR C,CH_ONDL + LD A,(IX+OffOnD) +CH_ONDL LD (IX+COnOff),A + RET + +PLAY XOR A + LD (AddToEn),A + LD (AYREGS+Mixer),A + DEC A + LD (AYREGS+EnvTp),A + LD HL,DelyCnt + DEC (HL) + JP NZ,PL2 + LD HL,ChanA+NtSkCn + DEC (HL) + JR NZ,PL1B +AdInPtA .EQU $+1 + LD BC,$0101 + LD A,(BC) + AND A + JR NZ,PL1A + LD D,A + LD (Ns_Base),A +CrPsPtr .EQU $+1 + LD HL,$2121 + INC HL + LD A,(HL) + INC A + JR NZ,PLNLP + +#IF LoopChecker + CALL CHECKLP +#ENDIF + +LPosPtr .EQU $+1 + LD HL,$2121 + LD A,(HL) + INC A +PLNLP LD (CrPsPtr),HL + DEC A + ;PT2 PT3 +PsCalc DEC A ;ADD A,A NOP + DEC A ;ADD A,(HL) NOP + ADD A,A + LD E,A + RL D + +#IF CurPosCounter + LD A,L +PosSub SUB $D6 + LD (CurPos),A +#ENDIF + +PatsPtr .EQU $+1 + LD HL,$2121 + ADD HL,DE +MODADDR .EQU $+1 + LD DE,$1111 + LD (PSP_+1),SP + LD SP,HL + POP HL + ADD HL,DE + LD B,H + LD C,L + POP HL + ADD HL,DE + LD (AdInPtB),HL + POP HL + ADD HL,DE + LD (AdInPtC),HL +PSP_ LD SP,$3131 +PL1A LD IX,ChanA+12 + CALL PTDECOD + LD (AdInPtA),BC + +PL1B LD HL,ChanB+NtSkCn + DEC (HL) + JR NZ,PL1C + LD IX,ChanB+12 +AdInPtB .EQU $+1 + LD BC,$0101 + CALL PTDECOD + LD (AdInPtB),BC + +PL1C LD HL,ChanC+NtSkCn + DEC (HL) + JR NZ,PL1D + LD IX,ChanC+12 +AdInPtC .EQU $+1 + LD BC,$0101 + CALL PTDECOD + LD (AdInPtC),BC + +Delay .EQU $+1 +PL1D LD A,$3E + LD (DelyCnt),A + +PL2 LD IX,ChanA + LD HL,(AYREGS+TonA) + CALL CHREGS + LD (AYREGS+TonA),HL + LD A,(Ampl) + LD (AYREGS+AmplA),A + LD IX,ChanB + LD HL,(AYREGS+TonB) + CALL CHREGS + LD (AYREGS+TonB),HL + LD A,(Ampl) + LD (AYREGS+AmplB),A + LD IX,ChanC + LD HL,(AYREGS+TonC) + CALL CHREGS + LD (AYREGS+TonC),HL + + LD HL,(Ns_Base_AddToNs) + LD A,H + ADD A,L + LD (AYREGS+Noise),A + +AddToEn .EQU $+1 + LD A,$3E + LD E,A + ADD A,A + SBC A,A + LD D,A + LD HL,(EnvBase) + ADD HL,DE + LD DE,(CurESld) + ADD HL,DE + LD (AYREGS+Env),HL + + XOR A + LD HL,CurEDel + OR (HL) + JR Z,ROUT + DEC (HL) + JR NZ,ROUT +Env_Del .EQU $+1 + LD A,$3E + LD (HL),A +ESldAdd .EQU $+1 + LD HL,$2121 + ADD HL,DE + LD (CurESld),HL + +ROUT +#IF ACBBAC + LD A,(SETUP) + AND 12 + JR Z,ABC + ADD A,CHTABLE + LD E,A + ADC A,CHTABLE/256 + SUB E + LD D,A + LD B,0 + LD IX,AYREGS + LD HL,AYREGS + LD A,(DE) + INC DE + LD C,A + ADD HL,BC + LD A,(IX+TonB) + LD C,(HL) + LD (IX+TonB),C + LD (HL),A + INC HL + LD A,(IX+TonB+1) + LD C,(HL) + LD (IX+TonB+1),C + LD (HL),A + LD A,(DE) + INC DE + LD C,A + ADD HL,BC + LD A,(IX+AmplB) + LD C,(HL) + LD (IX+AmplB),C + LD (HL),A + LD A,(DE) + INC DE + LD (RxCA1),A + XOR 8 + LD (RxCA2),A + LD HL,AYREGS+Mixer + LD A,(DE) + AND (HL) + LD E,A + LD A,(HL) +RxCA1 LD A,(HL) + AND %010010 + OR E + LD E,A + LD A,(HL) + AND %010010 +RxCA2 OR E + OR E + LD (HL),A +ABC +#ENDIF + +#IF _ZX + XOR A + LD DE,$FFBF + LD BC,$FFFD + LD HL,AYREGS +LOUT OUT (C),A + LD B,E + OUTI + LD B,D + INC A + CP 13 + JR NZ,LOUT + OUT (C),A + LD A,(HL) + AND A + RET M + LD B,E + OUT (C),A + RET +#ENDIF + +#IF _MSX +;MSX version of ROUT (c)Dioniso + XOR A + LD C,$A0 + LD HL,AYREGS +LOUT OUT (C),A + INC C + OUTI + DEC C + INC A + CP 13 + JR NZ,LOUT + OUT (C),A + LD A,(HL) + AND A + RET M + INC C + OUT (C),A + RET +#ENDIF + +#IF _WBW + ISHBIOS + JR NZ, PLAYVIAHBIOS + + DI + CALL SLOWIO + LD DE, (PORTS) ; D := RDAT, E := RSEL + XOR A ; START WITH REG 0 + LD C, E ; POINT TO ADDRESS PORT + LD HL, AYREGS ; START OF VALUE LIST +LOUT OUT (C), A ; SELECT REGISTER + LD C, D ; POINT TO DATA PORT + OUTI ; WRITE (HL) TO DATA PORT, BUMP HL + LD C, E ; POINT TO ADDRESS PORT + INC A ; NEXT REGISTER + CP 13 ; REG 13? + JR NZ, LOUT ; IF NOT, LOOP + OUT (C), A ; SELECT REGISTER 13 + LD A, (HL) ; GET VALUE FOR REGISTER 13 + AND A ; SET FLAGS + JP M, LOUT2 ; IF BIT 7 SET, RETURN W/O WRITING VALUE + LD C, D ; SELECT DATA PORT + OUT (C), A ; WRITE VALUE TO REGISTER 13 +LOUT2 CALL NORMIO + EI + RET ; AND DONE + +PLAYVIAHBIOS: +; CHANNEL 0 + LD HL, AYREGS + AmplA + LD DE, AYREGS + TonA + LD B, 0 + CALL PLAYNOTE +; +; CHANNEL 1 + LD HL, AYREGS + AmplB + LD DE, AYREGS + TonB + LD B, 1 + CALL PLAYNOTE + +; CHANNEL 2 + LD HL, AYREGS + AmplC + LD DE, AYREGS + TonC + LD B, 2 + JP PLAYNOTE + +PLAYNOTE: + PUSH BC ; CHANNEL IN B + PUSH DE ; PERIOD ADDR IN DE + + LD A, (HL) + ADD A,A ; GET 4-BIT + ADD A,A ; VOLUME 0-15 + ADD A,A ; AND CONVERT + ADD A,A ; TO HBIOS + LD L, A ; RANGE 0-255 + LD BC, (BF_SNDVOL*256)+0 ; SET VOLUME + RST 08 +; + POP HL ; RESTORE PERIOD ADDR + LD A, (HL) ; DEVICE 0 + INC HL + LD H, (HL) + LD L, A + LD A, H ; GET 12-BIT ONE PERIOD + AND $0F ; MASK OFF HIGH + LD H, A ; NIBBLE + + LD A, (OCTAVEADJ) + OR A + JR Z, PLAYNOTE3 ; NO OCTAVE ADJUSTMENT + BIT 7, A + JR Z, PLAYNOTE2 ; OCTAVE DOWN ADJUSTMENT + +PLAYNOTE1: + ADD HL, HL ; MULTIPLE BY 2 FOR EACH OCTAVE + INC A + JR NZ, PLAYNOTE1 + JR PLAYNOTE3 + +PLAYNOTE2: + SRL H ; DIVIDE BY 2 FOR EACH OCTAVE + RR L + DEC A + JR NZ, PLAYNOTE2 + +PLAYNOTE3 + LD BC, (BF_SNDPRD*256)+0 ; SET PERIOD + RST 08 +; + POP DE ; RESTORE CHANNEL IN D (FROM B) + LD BC, (BF_SNDPLAY*256)+0 ; PLAY + RST 08 + + RET + +#ENDIF + +#IF ACBBAC +CHTABLE .EQU $-4 + .DB 4,5,15,%001001,0,7,7,%100100 +#ENDIF + +NT_DATA .DB (T_NEW_0-T1_)*2 + .DB TCNEW_0-T_ + .DB (T_OLD_0-T1_)*2+1 + .DB TCOLD_0-T_ + .DB (T_NEW_1-T1_)*2+1 + .DB TCNEW_1-T_ + .DB (T_OLD_1-T1_)*2+1 + .DB TCOLD_1-T_ + .DB (T_NEW_2-T1_)*2 + .DB TCNEW_2-T_ + .DB (T_OLD_2-T1_)*2 + .DB TCOLD_2-T_ + .DB (T_NEW_3-T1_)*2 + .DB TCNEW_3-T_ + .DB (T_OLD_3-T1_)*2 + .DB TCOLD_3-T_ + +T_ + +TCOLD_0 .DB $00+1,$04+1,$08+1,$0A+1,$0C+1,$0E+1,$12+1,$14+1 + .DB $18+1,$24+1,$3C+1,0 +TCOLD_1 .DB $5C+1,0 +TCOLD_2 .DB $30+1,$36+1,$4C+1,$52+1,$5E+1,$70+1,$82,$8C,$9C + .DB $9E,$A0,$A6,$A8,$AA,$AC,$AE,$AE,0 +TCNEW_3 .DB $56+1 +TCOLD_3 .DB $1E+1,$22+1,$24+1,$28+1,$2C+1,$2E+1,$32+1,$BE+1,0 +TCNEW_0 .DB $1C+1,$20+1,$22+1,$26+1,$2A+1,$2C+1,$30+1,$54+1 + .DB $BC+1,$BE+1,0 +TCNEW_1 .EQU TCOLD_1 +TCNEW_2 .DB $1A+1,$20+1,$24+1,$28+1,$2A+1,$3A+1,$4C+1,$5E+1 + .DB $BA+1,$BC+1,$BE+1,0 + +PT3EMPTYORN .EQU $-1 + .DB 1,0 + +;first 12 values of tone tables (packed) + +T_PACK .DB $06EC*2/256,$06EC*2 + .DB $0755-$06EC + .DB $07C5-$0755 + .DB $083B-$07C5 + .DB $08B8-$083B + .DB $093D-$08B8 + .DB $09CA-$093D + .DB $0A5F-$09CA + .DB $0AFC-$0A5F + .DB $0BA4-$0AFC + .DB $0C55-$0BA4 + .DB $0D10-$0C55 + .DB $066D*2/256,$066D*2 + .DB $06CF-$066D + .DB $0737-$06CF + .DB $07A4-$0737 + .DB $0819-$07A4 + .DB $0894-$0819 + .DB $0917-$0894 + .DB $09A1-$0917 + .DB $0A33-$09A1 + .DB $0ACF-$0A33 + .DB $0B73-$0ACF + .DB $0C22-$0B73 + .DB $0CDA-$0C22 + .DB $0704*2/256,$0704*2 + .DB $076E-$0704 + .DB $07E0-$076E + .DB $0858-$07E0 + .DB $08D6-$0858 + .DB $095C-$08D6 + .DB $09EC-$095C + .DB $0A82-$09EC + .DB $0B22-$0A82 + .DB $0BCC-$0B22 + .DB $0C80-$0BCC + .DB $0D3E-$0C80 + .DB $07E0*2/256,$07E0*2 + .DB $0858-$07E0 + .DB $08E0-$0858 + .DB $0960-$08E0 + .DB $09F0-$0960 + .DB $0A88-$09F0 + .DB $0B28-$0A88 + .DB $0BD8-$0B28 + .DB $0C80-$0BD8 + .DB $0D60-$0C80 + .DB $0E10-$0D60 + .DB $0EF8-$0E10 +; +;Release 0 steps: +;02/27/2005 +;Merging PT2 and PT3 players; debug +;02/28/2005 +;debug; optimization +;03/01/2005 +;Migration to SjASM; conditional assembly (ZX, MSX and +;visualization) +;03/03/2005 +;SETPORT subprogram (35 bytes shorter) +;03/05/2005 +;fixed CurPosCounter error +;03/06/2005 +;Added ACB and BAC channels swapper (for Spectre); more cond. +;assembly keys; optimization +;Release 1 steps: +;04/15/2005 +;Removed loop bit resetting for no loop build (5 bytes shorter) +;04/30/2007 +;New 1.xx and 2.xx interpretation for PT 3.7+. + +;Tests in IMMATION TESTER V1.0 by Andy Man/POS +;(for minimal build) +;Module name/author Min tacts Max tacts +;PT3 (a little slower than standalone player) +;Spleen/Nik-O 1720 9368 +;Chuta/Miguel 1720 9656 +;Zhara/Macros 4536 8792 +;PT2 (more slower than standalone player) +;Epilogue/Nik-O 3928 10232 +;NY tHEMEs/zHenYa 3848 9208 +;GUEST 4/Alex Job 2824 9352 +;KickDB/Fatal Snipe 1720 9880 + +;Size (minimal build for ZX Spectrum): +;Code block $7B9 bytes +;Variables $21D bytes (can be stripped) +;Size in RAM $7B9+$21D=$9D6 (2518) bytes + +;Notes: +;Pro Tracker 3.4r can not be detected by header, so PT3.4r tone +;tables realy used only for modules of 3.3 and older versions. +; +;=============================================================================== +; MYM Player Routines +;=============================================================================== +; +; MYMPLAY - Player for MYM-tunes +; MSX-version by Marq/Lieves!Tuore & Fit 30.1.2000 +; +; 1.2.2000 - Added the disk loader. Thanks to Yzi & Plaque for examples. +; 7.2.2000 - Removed one unpack window -> freed 1.7kB memory +; +; Source suitable for Table-driven assembler (TASM), sorry all +; Devpac freaks :v/ + +FRAG .equ 128 ; Fragment size +REGS .equ 14 ; Number of PSG registers +FBITS .equ 7 ; Bits needed to store fragment offset +; +mymini exx ; Starting values for procedure readbits + ld e,1 + ld d,0 + ld hl,data + exx + + ld hl,uncomp+FRAG ; Starting values for the playing variables + ld (dest1),hl + ld (dest2),hl + ld (psource),hl + ld a,FRAG + ld (played),a + ld hl,0 + ld (prows),hl +; +; *** Unpack a fragment. Returns IY=new playing position for VBI +extract: + ld a,0 +regloop: + push af + ld c,a + ld b,0 + ld hl,regbits ; D=Bits in this PSG register + add hl,bc + ld d,(hl) + ld hl,current ; E=Current value of a PSG register + add hl,bc + ld e,(hl) + + ld bc,FRAG*3 + ld hl,(dest1) ; IX=Destination 1 + ld ix,(dest1) + add hl,bc + ld (dest1),hl + ld hl,(dest2) ; HL=Destination 2 + push hl + add hl,bc + ld (dest2),hl + pop hl + + ex af,af' + ld a,FRAG ; AF'=fragment end counter + ex af,af' + ld a,1 ; Get fragment bit + call readbits + or a + jr nz,compfrag ; 1=Compressed fragment, 0=Unchanged + + ld b,FRAG ; Unchanged fragment: just set all to E +sweep: ld (hl),e + inc hl + ld (ix),e + inc ix + djnz sweep + jp nextreg + +compfrag: ; Compressed fragment + ld a,1 + call readbits + or a + jr nz,notprev ; 0=Previous register value, 1=raw/compressed + + ld (hl),e ; Unchanged register + inc hl + ld (ix),e + inc ix + ex af,af' + dec a + ex af,af' + jp nextbit + +notprev: + ld a,1 + call readbits + or a + jr z,packed ; 0=compressed data, 1=raw data + + ld a,d ; Raw data, read regbits[i] bits + call readbits + ld e,a + ld (hl),a + inc hl + ld (ix),a + inc ix + ex af,af' + dec a + ex af,af' + jp nextbit + +packed: ld a,FBITS ; Reference to previous data: + call readbits ; Read the offset + ld c,a + ld a,FBITS ; Read the number of bytes + call readbits + ld b,a + + push hl + push bc + ld bc,-FRAG + add hl,bc + pop bc + ld a,b + ld b,0 + add hl,bc + ld b,a + push hl + pop iy ; IY=source address + pop hl + + inc b +copy: ld a,(iy) ; Copy from previous data + inc iy + ld e,a ; Set current value + ld (hl),a + inc hl + ld (ix),a + inc ix + ex af,af' + dec a + ex af,af' + djnz copy + +nextbit: + ex af,af' ; If AF'=0 then fragment is done + ld c,a + ex af,af' + ld a,c + or a + jp nz,compfrag + +nextreg: + pop af + ld b,0 ; Save the current value of PSG reg + ld c,a + push hl + ld hl,current + add hl,bc + ld (hl),e + pop hl + + inc a ; Check if all registers are done + cp REGS + jp nz,regloop + + or a ; Check if dest2 must be wrapped + ld bc,rows + sbc hl,bc + jr nz,nowrap + + ld ix,FRAG+uncomp + ld hl,FRAG+uncomp + ld iy,(2*FRAG)+uncomp + jr endext + +nowrap: ld ix,uncomp + ld hl,(2*FRAG)+uncomp + ld iy,(FRAG)+uncomp + +endext: ld (dest1),ix + ld (dest2),hl + + ld bc,FRAG ; Check end-of-file. Clumsy :v/ + ld hl,(prows) + add hl,bc + ld (prows),hl + ld bc,(rows) + or a + sbc hl,bc + +; jr c,noend ; If rows>played rows then exit +; exx ; Otherwise restart +; ld e,1 +; ld d,0 +; ld hl,data +; exx +; ld hl,0 +; ld (prows),hl + +noend: ret + +; *** Reads A bits from data, returns bits in A +readbits: + exx + ld b,a + ld c,0 + +onebit: sla c ; Get one bit at a time + rrc e + jr nc,nonew ; Wrap the AND value + ld d,(hl) + inc hl + +nonew: ld a,e + and d + jr z,zero + inc c +zero: djnz onebit + + ld a,c + exx + ret + +; *** Update PSG registers +upsg: + ISHBIOS + JR Z, upsg0 + ERRWITHMSG(MSGERR) + +upsg0: + di + call SLOWIO + +upsg1: ld hl,(psource) + ld de,(PORTS) ; E := RSEL, D := RDAT + xor a + +psglp: ld c, e ; C := RSEL + out (c), a ; Select register + ld c, d ; C := RDAT + outi ; Set register value + inc a ; Next register + + ld bc, (3 * FRAG) - 1 ; Bytes to skip before next reg-1 + add hl, bc ; Update HL + cp REGS-1 ; Check for next to last register? + jr nz,psglp ; If not, loop + + ld a, $FF ; Prepare to check for $FF value + cp (hl) ; If last reg (13) is $FF + jr z, notrig ; ... then don't output + ld a, 13 ; Register 13 + ld c, e ; C := RSEL + out (c), a ; Select register + ld c, d ; C := RDAT + outi ; Set register value + +notrig: ld hl,(psource) + inc hl + ld (psource),hl + ld a,(played) + or a + jr z,endint + dec a + ld (played),a + +endint: call NORMIO + ei + ret ; And done +; + +; *** Program data +played .db 0 ; VBI counter +dest1 .dw 0 ; Uncompress destination 1 +dest2 .dw 0 ; - " - 2 +psource .dw 0 ; Playing offset for the VB-player +prows .dw 0 ; Rows played so far + +; Bits per PSG register +regbits .db 8,4,8,4,8,4,5,8,5,5,5,8,8,8 +; Current values of PSG registers +current .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0 +; +;=============================================================================== +;=============================================================================== +; PTx/MYM Shared Heap Storage +;=============================================================================== +;=============================================================================== +; +; Note that two different storage layouts are defined below. One for PTx and +; one for MYM. They share the same storage area starting at the HEAP marker, +; but only one defintion will be active depending on the type of file +; being played. +; +HEAP .EQU $ +; +;=============================================================================== +; PTx Player Storage +;=============================================================================== +; + .ORG HEAP +; +;vars from here can be stripped +;you can move VARS to any other address + +VARS + +ChanA .DS CHP +ChanB .DS CHP +ChanC .DS CHP + +;GlobalVars +DelyCnt .DS 1 +CurESld .DS 2 +CurEDel .DS 1 +Ns_Base_AddToNs +Ns_Base .DS 1 +AddToNs .DS 1 + +AYREGS + +VT_ .DS 256 ;CreatedVolumeTableAddress + +EnvBase .EQU VT_+14 + +T1_ .EQU VT_+16 ;Tone tables data depacked here + +T_OLD_1 .EQU T1_ +T_OLD_2 .EQU T_OLD_1+24 +T_OLD_3 .EQU T_OLD_2+24 +T_OLD_0 .EQU T_OLD_3+2 +T_NEW_0 .EQU T_OLD_0 +T_NEW_1 .EQU T_OLD_1 +T_NEW_2 .EQU T_NEW_0+24 +T_NEW_3 .EQU T_OLD_3 + +PT2EMPTYORN .EQU VT_+31 ;1,0,0 sequence + +NT_ .DS 192 ;CreatedNoteTableAddress + +;local var +Ampl .EQU AYREGS+AmplC + +VAR0END .EQU VT_+16 ;INIT zeroes from VARS to VAR0END-1 + +VARSEND .EQU $ + +MDLADDR .EQU $ +; +;=============================================================================== +; MYM Player Storage +;=============================================================================== +; + .ORG HEAP +; Reserve room for uncompressed data +uncomp: + .DS (3*FRAG*REGS) + +; The tune is stored here +rows: + .DS 2 ; WORD value +data: +; +;=============================================================================== + .END diff --git a/Source/Apps/Tune/tune.inc b/Source/Apps/Tune/tune.inc new file mode 100644 index 00000000..3db0e0e9 --- /dev/null +++ b/Source/Apps/Tune/tune.inc @@ -0,0 +1,4 @@ +#DEFINE ISHBIOS LD A, (HBIOSMD) \ OR A +#DEFINE PRTSTRDE(X) LD DE, X \ CALL PRTSTR +#DEFINE PRTCRLF CALL CRLF +#DEFINE ERRWITHMSG(X) LD DE, X \ JP ERR diff --git a/Source/Apps/VGM/Build.cmd b/Source/Apps/VGM/Build.cmd new file mode 100644 index 00000000..08e013f5 --- /dev/null +++ b/Source/Apps/VGM/Build.cmd @@ -0,0 +1,12 @@ +@echo off +setlocal + +set TOOLS=../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF -dWBW vgmplay.asm vgmplay.com vgmplay.lst || exit /b +tasm -t180 -g3 -fFF -dWBW ymfmdemo.asm ymfmdemo.com ymfmdemo.lst || exit /b + +copy /Y vgmplay.com ..\..\..\Binary\Apps\ || exit /b +copy /Y Tunes\*.vgm ..\..\..\Binary\Apps\Tunes\ || exit /b diff --git a/Source/Apps/VGM/Clean.cmd b/Source/Apps/VGM/Clean.cmd new file mode 100644 index 00000000..07f1d4c3 --- /dev/null +++ b/Source/Apps/VGM/Clean.cmd @@ -0,0 +1,5 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst diff --git a/Source/Apps/VGM/Makefile b/Source/Apps/VGM/Makefile new file mode 100644 index 00000000..fdb643d9 --- /dev/null +++ b/Source/Apps/VGM/Makefile @@ -0,0 +1,18 @@ +OBJECTS = vgmplay.com +DEST = ../../../Binary/Apps +TOOLS = ../../../Tools +OTHERS = *.LST + +include $(TOOLS)/Makefile.inc + +DEPS := vgmplay.asm $(shell find . -name '*.inc') + +vgmplay.com: $(DEPS) + $(TASM) -dWBW vgmplay.asm vgmplay.com vgmplay.lst + +ym2612.com: + $(TASM) -dWBW ymfmdemo.asm ymfmdemo.com ymfmdemo.lst + +all:: + mkdir -p $(DEST)/Tunes + cp Tunes/*.vgm $(DEST)/Tunes diff --git a/Source/Apps/VGM/Tunes/More/aggress.vgm b/Source/Apps/VGM/Tunes/More/aggress.vgm new file mode 100644 index 00000000..fd0a3924 Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/aggress.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/anna.vgm b/Source/Apps/VGM/Tunes/More/anna.vgm new file mode 100644 index 00000000..cf8f6a64 Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/anna.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/bgm.vgm b/Source/Apps/VGM/Tunes/More/bgm.vgm new file mode 100644 index 00000000..e71c431b Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/bgm.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/descent.vgm b/Source/Apps/VGM/Tunes/More/descent.vgm new file mode 100644 index 00000000..0e72d802 Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/descent.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/fieldmap.vgm b/Source/Apps/VGM/Tunes/More/fieldmap.vgm new file mode 100644 index 00000000..efab70af Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/fieldmap.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/itsgamov.vgm b/Source/Apps/VGM/Tunes/More/itsgamov.vgm new file mode 100644 index 00000000..d6034e56 Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/itsgamov.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/lemmin01.vgm b/Source/Apps/VGM/Tunes/More/lemmin01.vgm new file mode 100644 index 00000000..74b0cee9 Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/lemmin01.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/pengui03.vgm b/Source/Apps/VGM/Tunes/More/pengui03.vgm new file mode 100644 index 00000000..0d2c3625 Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/pengui03.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/pitfal02.vgm b/Source/Apps/VGM/Tunes/More/pitfal02.vgm new file mode 100644 index 00000000..92d56555 Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/pitfal02.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/qix.vgm b/Source/Apps/VGM/Tunes/More/qix.vgm new file mode 100644 index 00000000..f3d46790 Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/qix.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/startdem.vgm b/Source/Apps/VGM/Tunes/More/startdem.vgm new file mode 100644 index 00000000..66b57817 Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/startdem.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/teddy.vgm b/Source/Apps/VGM/Tunes/More/teddy.vgm new file mode 100644 index 00000000..4b30c562 Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/teddy.vgm differ diff --git a/Source/Apps/VGM/Tunes/More/tiger02.vgm b/Source/Apps/VGM/Tunes/More/tiger02.vgm new file mode 100644 index 00000000..29146936 Binary files /dev/null and b/Source/Apps/VGM/Tunes/More/tiger02.vgm differ diff --git a/Source/Apps/VGM/Tunes/bgm.vgm b/Source/Apps/VGM/Tunes/bgm.vgm new file mode 100644 index 00000000..e71c431b Binary files /dev/null and b/Source/Apps/VGM/Tunes/bgm.vgm differ diff --git a/Source/Apps/VGM/Tunes/ending.vgm b/Source/Apps/VGM/Tunes/ending.vgm new file mode 100644 index 00000000..dcd349bc Binary files /dev/null and b/Source/Apps/VGM/Tunes/ending.vgm differ diff --git a/Source/Apps/VGM/Tunes/inchina.vgm b/Source/Apps/VGM/Tunes/inchina.vgm new file mode 100644 index 00000000..cb73e2c7 Binary files /dev/null and b/Source/Apps/VGM/Tunes/inchina.vgm differ diff --git a/Source/Apps/VGM/Tunes/shirakaw.vgm b/Source/Apps/VGM/Tunes/shirakaw.vgm new file mode 100644 index 00000000..c6cf01b6 Binary files /dev/null and b/Source/Apps/VGM/Tunes/shirakaw.vgm differ diff --git a/Source/Apps/VGM/Tunes/startdem.vgm b/Source/Apps/VGM/Tunes/startdem.vgm new file mode 100644 index 00000000..66b57817 Binary files /dev/null and b/Source/Apps/VGM/Tunes/startdem.vgm differ diff --git a/Source/Apps/VGM/Tunes/wonder01.vgm b/Source/Apps/VGM/Tunes/wonder01.vgm new file mode 100644 index 00000000..d6efddc0 Binary files /dev/null and b/Source/Apps/VGM/Tunes/wonder01.vgm differ diff --git a/Source/Apps/VGM/printing.inc b/Source/Apps/VGM/printing.inc new file mode 100644 index 00000000..be1ade84 --- /dev/null +++ b/Source/Apps/VGM/printing.inc @@ -0,0 +1,177 @@ +; +; Print character in A without destroying any registers +; +PRTCHR: + PUSH BC ; save registers + PUSH DE + PUSH HL + LD E,A ; character to print in E + LD C,$02 ; BDOS function to output a character + CALL BDOS ; do it + POP HL ; restore registers + POP DE + POP BC + RET +; +PRTDOT: +; + ; shortcut to print a dot preserving all regs + PUSH AF ; save af + LD A,'.' ; load dot char + CALL PRTCHR ; print it + POP AF ; restore af + RET ; done +; +PRTCR: +; + ; shortcut to print a carriage return preserving all regs + PUSH AF ; save af + LD A,13 ; load CR value + CALL PRTCHR ; print it + POP AF ; restore af + RET ; done +; +; Print a zero terminated string at (DE) without destroying any registers +; +PRTSTR: + PUSH AF + PUSH DE +; +PRTSTR1: + LD A,(DE) ; get next char + OR A + JR Z,PRTSTR2 + CALL PRTCHR + INC DE + JR PRTSTR1 +; +PRTSTR2: + POP DE ; restore registers + POP AF + RET +; +; Print the value in A in hex without destroying any registers +; +PRTHEX: + PUSH AF ; save AF + PUSH DE ; save DE + CALL HEXASCII ; convert value in A to hex chars in DE + LD A,D ; get the high order hex char + CALL PRTCHR ; print it + LD A,E ; get the low order hex char + CALL PRTCHR ; print it + POP DE ; restore DE + POP AF ; restore AF + RET ; done +; +; print the hex word value in bc +; +PRTHEXWORD: + PUSH AF + LD A,B + CALL PRTHEX + LD A,C + CALL PRTHEX + POP AF + RET +; +; print the hex dword value in de:hl +; +PRTHEX32: + PUSH BC + PUSH DE + POP BC + CALL PRTHEXWORD + PUSH HL + POP BC + CALL PRTHEXWORD + POP BC + RET +; +; Convert binary value in A to ascii hex characters in DE +; +HEXASCII: + LD D,A ; save A in D + CALL HEXCONV ; convert low nibble of A to hex + LD E,A ; save it in E + LD A,D ; get original value back + RLCA ; rotate high order nibble to low bits + RLCA + RLCA + RLCA + CALL HEXCONV ; convert nibble + LD D,A ; save it in D + RET ; done + +; +; Convert low nibble of A to ascii hex +; +HEXCONV: + AND $0F ; low nibble only + ADD A,$90 + DAA + ADC A,$40 + DAA + RET + +; +; Print value of A or HL in decimal with leading zero suppression +; Use prtdecb for A or prtdecw for HL +; +PRTDECB: + PUSH HL + LD H,0 + LD L,A + CALL PRTDECW ; print it + POP HL + RET +; +PRTDECW: + PUSH AF + PUSH BC + PUSH DE + PUSH HL + CALL PRTDEC0 + POP HL + POP DE + POP BC + POP AF + RET +; +PRTDEC0: + LD E,'0' + LD BC,-10000 + CALL PRTDEC1 + LD BC,-1000 + CALL PRTDEC1 + LD BC,-100 + CALL PRTDEC1 + LD C,-10 + CALL PRTDEC1 + LD E,0 + LD C,-1 +PRTDEC1: + LD A,'0' - 1 +PRTDEC2: + INC A + ADD HL,BC + JR C,PRTDEC2 + SBC HL,BC + CP E + RET Z + LD E,0 + CALL PRTCHR + RET +; +; Start a new line +; +CRLF2: + CALL CRLF ; two of them +CRLF: + PUSH AF ; preserve AF + LD A,13 ; + CALL PRTCHR ; print it + LD A,10 ; + CALL PRTCHR ; print it + POP AF ; restore AF + RET diff --git a/Source/Apps/VGM/vgmplay.asm b/Source/Apps/VGM/vgmplay.asm new file mode 100644 index 00000000..2a53838e --- /dev/null +++ b/Source/Apps/VGM/vgmplay.asm @@ -0,0 +1,1348 @@ +;------------------------------------------------------------------------------ +; SN76489 + AY-3-8910 + YM2162 + YM2151 VGM player for CP/M +;------------------------------------------------------------------------------ +; +; Based on VGM player by J.B. Langston +; https://github.com/jblang/SN76489 +; +; Enhanced with multi-chip support by Marco Maccaferri +; YM2151 support from Ed Brindley +; +; YM2162/YM3484, GD3 support, VGM Chip identification, +; default file type, basic file size checking, polled CTC mode +; added by Phil Summers +; +; Bugs: YM2151 playback untested & no mute. +; CTC polled timing - predicted 44100 divider is too slow +; +; Assemble with: +; +; TASM -80 -b VGMPLAY.ASM VGMPLAY.COM +; +; +; A VGM file can play 44100 samples a second. This may be sound chip +; register commands or PCM data. This player does not support PCM playback +; due to the high processor speed and file size required. Typical VGM files +; available use a much lower sample rate and are playable. Where the processor +; speed is low and the sample rate is high, the playback overhead will cause +; playback speed to be inaccurate. + +;------------------------------------------------------------------------------ +; Device and system specific definitions +;------------------------------------------------------------------------------ +; +custom .equ 0 ; System configurations +P8X180 .equ 1 +RCBUS .equ 2 +sbcecb .equ 3 +MBC .equ 4 +; +plt_romwbw .equ 1 ; Build for ROMWBW? +plt_type .equ sbcecb ; Select build configuration +debug .equ 0 ; Display port, register, config info +; +;------------------------------------------------------------------------------ +; Platform specific definitions. If building for ROMWBW, these may be overridden +;------------------------------------------------------------------------------ + +#IF (plt_type=custom) +RSEL .equ 09AH ; Primary AY-3-8910 Register selection +RDAT .equ 09BH ; Primary AY-3-8910 Register data +RSEL2 .equ 88H ; Secondary AY-3-8910 Register selection +RDAT2 .equ 89H ; Secondary AY-3-8910 Register data +VGMBASE .equ $C0 +YMSEL .equ VGMBASE+00H ; Primary YM2162 11000000 a1=0 a0=0 +YMDAT .equ VGMBASE+01H ; Primary YM2162 11000001 a1=0 a0=1 +YM2SEL .equ VGMBASE+02H ; Secondary YM2162 11000010 a1=1 a0=0 +YM2DAT .equ VGMBASE+03H ; Secondary YM2162 11000011 a1=1 a0=1 +PSG1REG .equ VGMBASE+08H ; Primary SN76489 +PSG2REG .equ VGMBASE+09H ; Secondary SN76489 +ctcbase .equ VGMBASE+0CH ; CTC base address +YM2151_SEL1 .equ 0FEH ; Primary YM2151 register selection +YM2151_DAT1 .equ 0FFH ; Primary YM2151 register data +YM2151_SEL2 .equ 0FEH ; Secondary YM2151 register selection +YM2151_DAT2 .equ 0FFH ; Secondary YM2151 register data +plt_cpuspd .equ 6;000000 ; Non ROMWBW cpu speed default +FRAME_DLY .equ 10 ; Frame delay (~ 1/44100) + +#ENDIF +; +#IF (plt_type=P8X180) +RSEL .equ 82H ; Primary AY-3-8910 Register selection +RDAT .equ 83H ; Primary AY-3-8910 Register data +RSEL2 .equ 88H ; Secondary AY-3-8910 Register selection +RDAT2 .equ 89H ; Secondary AY-3-8910 Register data +PSG1REG .equ 84H ; Primary SN76489 +PSG2REG .equ 8AH ; Secondary SN76489 +YM2151_SEL1 .equ 0B0H ; Primary YM2151 register selection +YM2151_DAT1 .equ 0B1H ; Primary YM2151 register data +YM2151_SEL2 .equ 0B2H ; Secondary YM2151 register selection +YM2151_DAT2 .equ 0B3H ; Secondary YM2151 register data +ctcbase .equ 000H ; CTC base address +YMSEL .equ 000H ; Primary YM2162 11000000 a1=0 a0=0 +YMDAT .equ 000H ; Primary YM2162 11000001 a1=0 a0=1 +YM2SEL .equ 000H ; Secondary YM2162 11000010 a1=1 a0=0 +YM2DAT .equ 000H ; Secondary YM2162 11000011 a1=1 a0=1 +FRAME_DLY .equ 48 ; Frame delay (~ 1/44100) +plt_cpuspd .equ 20 ; Non ROMWBW cpu speed default +#ENDIF +; +#IF (plt_type=RCBUS) +RSEL .equ 0D8H ; AYMODE_RCZ80 ; Primary AY-3-8910 Register selection +RDAT .equ 0D0H ; AYMODE_RCZ80 ; Primary AY-3-8910 Register data +RSEL2 .equ 000H ; UNDEFINED ; Secondary AY-3-8910 Register selection +RDAT2 .equ 000H ; UNDEFINED ; Secondary AY-3-8910 Register data +PSG1REG .equ 0FFH ; SNMODE_RC ! ; Primary SN76489 +PSG2REG .equ 0FBH ; SNMODE_RC ; Secondary SN76489 +YM2151_SEL1 .equ 0FEH ; ED BRINDLEY ; Primary YM2151 register selection +YM2151_DAT1 .equ 0FFH ; ED BRINDLEY ! ; Primary YM2151 register data +YM2151_SEL2 .equ 000H ; UNDEFINED ; Secondary YM2151 register selection +YM2151_DAT2 .equ 000H ; UNDEFINED ; Secondary YM2151 register data +ctcbase .equ 000H ; UNDEFINED ; CTC base address +YMSEL .equ 000H ; UNDEFINED ; Primary YM2162 11000000 a1=0 a0=0 +YMDAT .equ 000H ; UNDEFINED ; Primary YM2162 11000001 a1=0 a0=1 +YM2SEL .equ 000H ; UNDEFINED ; Secondary YM2162 11000010 a1=1 a0=0 +YM2DAT .equ 000H ; UNDEFINED ; Secondary YM2162 11000011 a1=1 a0=1 +plt_cpuspd .equ 7;372800 ; CPUOSC ; Non ROMWBW cpu speed default +FRAME_DLY .equ 12 ; Frame delay (~ 1/44100) +#ENDIF +; +#IF (plt_type=sbcecb) +RSEL .equ 09AH ; AYMODE_SCG ; Primary AY-3-8910 Register selection +RDAT .equ 09BH ; AYMODE_SCG ; Primary AY-3-8910 Register data +RSEL2 .equ 000H ; UNDEFINED ; Secondary AY-3-8910 Register selection +RDAT2 .equ 000H ; UNDEFINED ; Secondary AY-3-8910 Register data +VGMBASE .equ $C0 ; ECB-VGM V2 base address +YMSEL .equ VGMBASE+00H ; Primary YM2162 11000000 a1=0 a0=0 +YMDAT .equ VGMBASE+01H ; Primary YM2162 11000001 a1=0 a0=1 +YM2SEL .equ VGMBASE+02H ; Secondary YM2162 11000010 a1=1 a0=0 +YM2DAT .equ VGMBASE+03H ; Secondary YM2162 11000011 a1=1 a0=1 +PSG1REG .equ VGMBASE+06H ; SNMODE_VGM ; Primary SN76489 +PSG2REG .equ VGMBASE+07H ; SNMODE_VGM ; Secondary SN76489 +ctcbase .equ VGMBASE+0CH ; CTC base address +YM2151_SEL1 .equ 000H ; UNDEFINED ; Primary YM2151 register selection +YM2151_DAT1 .equ 000H ; UNDEFINED ; Primary YM2151 register data +YM2151_SEL2 .equ 000H ; UNDEFINED ; Secondary YM2151 register selection +YM2151_DAT2 .equ 000H ; UNDEFINED ; Secondary YM2151 register data +plt_cpuspd .equ 8;000000 ; CPUOSC ; Non ROMWBW cpu speed default +FRAME_DLY .equ 13 ; Frame delay (~ 1/44100) +#ENDIF +; +#IF (plt_type=MBC) +RSEL .equ 0A0H ; AYMODE_MBC ; Primary AY-3-8910 Register selection +RDAT .equ 0A1H ; AYMODE_MBC ; Primary AY-3-8910 Register data +RSEL2 .equ 000H ; UNDEFINED ; Secondary AY-3-8910 Register selection +RDAT2 .equ 000H ; UNDEFINED ; Secondary AY-3-8910 Register data +YMSEL .equ 000H ; UNDEFINED ; Primary YM2162 11000000 a1=0 a0=0 +YMDAT .equ 000H ; UNDEFINED ; Primary YM2162 11000001 a1=0 a0=1 +YM2SEL .equ 000H ; UNDEFINED ; Secondary YM2162 11000010 a1=1 a0=0 +YM2DAT .equ 000H ; UNDEFINED ; Secondary YM2162 11000011 a1=1 a0=1 +PSG1REG .equ 000H ; UNDEFINED ; Primary SN76489 +PSG2REG .equ 000H ; UNDEFINED ; Secondary SN76489 +ctcbase .equ 000H ; UNDEFINED ; CTC base address +YM2151_SEL1 .equ 000H ; UNDEFINED ; Primary YM2151 register selection +YM2151_DAT1 .equ 000H ; UNDEFINED ; Primary YM2151 register data +YM2151_SEL2 .equ 000H ; UNDEFINED ; Secondary YM2151 register selection +YM2151_DAT2 .equ 000H ; UNDEFINED ; Secondary YM2151 register data +plt_cpuspd .equ 8;000000 ; CPUOSC ; Non ROMWBW cpu speed default +FRAME_DLY .equ 13 ; UNDEFINED ; Frame delay (~ 1/44100) + +#ENDIF +; +;------------------------------------------------------------------------------ +; Configure timing loop +;------------------------------------------------------------------------------ +; +cpu_loop: .equ 0 +ctc_poll: .equ 1 +ctc_int: .equ 2 ; not implemented +; +delay_type: .equ cpu_loop ; cpu timed loop or utilize ctc +delay_wait .equ 0 ; funny wait mode for ctc +; +D60 .equ 735 ; 735x60=44100 Frame delay values for ntsc +D50 .equ 882 ; 882x50=44100 Frame delay values for pal +; +;------------------------------------------------------------------------------ +; CTC Defaults +;------------------------------------------------------------------------------ +; +ctcdiv0 .equ 1 ; Divider chain for 3.579545MHz input +ctcdiv1 .equ 1 ; Ctc with 3 step divider base address +ctcdiv2 .equ 16 +ctcdiv3 .equ 3 ; 3579545 / 1 / 2 / 41 = 43653 = 1% error +; +;------------------------------------------------------------------------------ +; Processor speed control for SBCV2004+ +;------------------------------------------------------------------------------ +; +;#DEFINE SBCV2004 ; My SBC board at 12Mhz needs this to switch to +HB_RTCVAL .equ 0FFEEH ; 6MHz for it to work with the ECB-VGM reliably. +RTCIO .equ 070H +; +;------------------------------------------------------------------------------ +; YM2162 Register write macros - with wait and timeout +;------------------------------------------------------------------------------ +; +#DEFINE setreg(reg,val) \ +#DEFCONT \ ld a,reg +#DEFCONT \ out (YMSEL),a +#DEFCONT \ ld a,val +#DEFCONT \ out (YMDAT),a +#DEFCONT \ ld b,0 +#DEFCONT \ in a,(YMSEL) +#DEFCONT \ rlca +#DEFCONT \ jp nc,$+5 +#DEFCONT \ djnz $-6 +; +#DEFINE setreg2(reg,val) \ +#DEFCONT \ ld a,reg +#DEFCONT \ out (YM2SEL),a +#DEFCONT \ ld a,val +#DEFCONT \ out (YM2DAT),a +#DEFCONT \ ld b,0 +#DEFCONT \ in a,(YMSEL) +#DEFCONT \ rlca +#DEFCONT \ jp nc,$+5 +#DEFCONT \ djnz $-6 + +;------------------------------------------------------------------------------ +; VGM Codes - see vgmrips.net/wiki/VGM_specification +;------------------------------------------------------------------------------ + +VGM_GG_W .equ 04FH ; GAME GEAR PSG STEREO. WRITE DD TO PORT 0X06 +VGM_PSG1_W .equ 050H ; PSG (SN76489/SN76496) #1 WRITE VALUE DD +VGM_PSG2_W .equ 030H ; PSG (SN76489/SN76496) #2 WRITE VALUE DD +VGM_YM26121_W .equ 052H ; YM2612 #1 WRITE VALUE DD +VGM_YM26122_W .equ 053H ; YM2612 #2 WRITE VALUE DD +VGM_WNS .equ 061H ; WAIT N SAMPLES +VGM_W735 .equ 062H ; WAIT 735 SAMPLES (1/60TH SECOND) +VGM_W882 .equ 063H ; WAIT 882 SAMPLES (1/50TH SECOND) +VGM_ESD .equ 066H ; END OF SOUND DATA +VGM_YM21511_W .equ 054H ; YM2612 #1 WRITE VALUE DD +VGM_YM21512_W .equ 0A4H ; YM2612 #2 WRITE VALUE DD + +;------------------------------------------------------------------------------ +; Generic CP/M definitions +;------------------------------------------------------------------------------ + +BOOT .equ 0000H ; boot location +BDOS .equ 0005H ; bdos entry point +FCB .equ 005CH ; file control block +FCBCR .equ FCB + 20H ; fcb current record +BUFF .equ 0080H ; DMA buffer +TOPM .equ 0002H ; Top of memory + +PRINTF .equ 9 ; BDOS print string function +OPENF .equ 15 ; BDOS open file function +CLOSEF .equ 16 ; BDOS close file function +READF .equ 20 ; BDOS sequential read function + +CR .equ 0DH ; carriage return +LF .equ 0AH ; line feed + +;------------------------------------------------------------------------------ +; Program Start +;------------------------------------------------------------------------------ + + .ORG 100H +; + LD (OLDSTACK),SP ; save old stack pointer + LD SP,STACK ; set new stack pointer +; + CALL vgmsetup ; Device setup + call welcome ; Welcome message and build debug info + call vgmreadr ; read in the vgm file +; +;------------------------------------------------------------------------------ +; Play loop +;------------------------------------------------------------------------------ +; +MAINLOOP CALL PLAY ; Play one frame +; + LD HL,KEYCHK ; Check for keypress + DEC (HL) + JR NZ,NO_CHK +; + LD C,6 ; Every 256 commands + LD E,0FFH ; because HBIOS calls + CALL BDOS ; take a long time + OR A + JR NZ,EXIT +NO_CHK: +#IF (delay_type==cpu_loop) +vdelay: .equ $+1 + ld hl,vdelay +fdelay: .equ $+1 +lp1: LD B,FRAME_DLY ; 44100 one frame = 0.0000226757 seconds + DJNZ $ + DEC HL + LD A,H + OR L + JP NZ,lp1 ; Normally NZ so jp is faster +#ENDIF +; +#IF (delay_type==ctc_poll) +vdelay: .equ $+1 + ld hl,vdelay ; Frame delay +lp1: in a,(ctcch3) ; wait for counter to reach zero + dec a + jr nz,lp1 +#IF (delay_wait) +lp2: in a,(ctcch3) ; wait for counter to pass zero + dec a + jr z,lp2 + +lp3: in a,(ctcch3) ; wait for counter to reach zero + dec a + jr nz,lp3 +#ENDIF + DEC HL + LD A,H + OR L + JP NZ,lp1 ; Normally NZ so jp is faster +#ENDIF +; +#IF (delay_type==ctc_int) +#ENDIF +; + JP MAINLOOP +; +;------------------------------------------------------------------------------ +; Program Exit +;------------------------------------------------------------------------------ +; +EXIT: CALL VGMDEVICES ; Display devices used + CALL VGMMUTE ; Mute Devices + +#IFDEF SBCV2004 + CALL FASTIO +#ENDIF + LD DE,MSG_EXIT +EXIT_ERR: CALL PRTSTR ; Generic message or error + LD SP, (OLDSTACK) ; Exit to CP/M + JP BOOT +; +;------------------------------------------------------------------------------ +; Read VGM file +;------------------------------------------------------------------------------ +; +vgmreadr: + CALL READVGM ; Read in the VGM file + CALL VGMINFO ; Check and display VGM Information +; + LD HL, (VGMDATA + 34H) ; Determine start of VGM + LD A, H ; data. + OR L + JR NZ, _S1 + LD HL, 000CH ; Default location (40H - 34H) +_S1 LD DE, VGMDATA + 34H + ADD HL, DE + LD (VGMPOS), HL +; + LD HL,D60 ; VGM delay (60hz) + LD (vdelay), HL +; + LD IX,VGM_DEV ; IX points to device mask + ret +; +;------------------------------------------------------------------------------ +; Read VGM file into memory +;------------------------------------------------------------------------------ +; +READVGM: LD A,(FCB+1) ; Get first char of filename + CP ' ' ; Compare to blank + LD DE,MSG_NOFILE ; If blank, missing filename + JP Z,EXIT_ERR ; so exit + LD A,(FCB+9) ; If the filetype + CP ' ' ; is blanks + JR NZ,HASEXT ; then assume + LD A,'V' ; type VGM. + LD (FCB+9),A + LD A,'G' ; Fill in + LD (FCB+10),A ; the file + LD A,'M' ; extension + LD (FCB+11),A + +HASEXT: LD C,OPENF ; Open File + LD DE,FCB + CALL BDOS + INC A + LD DE,MSG_NOFILE + JP Z,EXIT_ERR + + XOR A ; Read VGM file into memory + LD (FCBCR), A + LD DE, VGMDATA + LD (VGMPOS), DE +RLOOP +; LD A,(TOPM) ; CBIOS start +; SUB 10h ; Less BDOS = Top Memory Page + LD A,$D6 ; Hardcoded top of memory + CP D + LD DE,MSG_MEM + JP Z,EXIT_ERR ; Exit top of memory reached + LD C, READF + LD DE, FCB + CALL BDOS + OR A + JR NZ, RDONE + LD HL, BUFF + LD DE, (VGMPOS) + LD BC, 128 + LDIR + LD (VGMPOS), DE + JR RLOOP + +RDONE LD C, CLOSEF ; Close the file + LD DE, FCB + CALL BDOS + RET +; +;------------------------------------------------------------------------------ +; VGM Player. +;------------------------------------------------------------------------------ +PLAY +#IFDEF SBCV2004 + CALL SLOWIO +#ENDIF + LD HL, (VGMPOS) ; Start processing VGM commands +NEXT LD A, (HL) + INC HL + LD (VGMPOS), HL + CP VGM_ESD ; Restart VGM cmd + JR NZ, NEXT1 + LD HL, (VGMDATA + 1CH) ; Loop offset + LD A, H + OR L + JP Z, EXIT + LD DE, VGMDATA + 1CH + ADD HL, DE + LD (VGMPOS), HL + JR NEXT + +NEXT1: +; +; SN76489 SECTION + +PSG CP VGM_PSG1_W ; Write byte to SN76489. + JR NZ, PSG2 + LD A, (HL) + INC HL + OUT (PSG1REG), A + SET 0,(IX+0) + JR NEXT + +PSG2 CP VGM_PSG2_W ; Write byte to second SN76489. + JR NZ, AY + LD A, (HL) + INC HL + OUT (PSG2REG), A + SET 1,(IX+0) + JR NEXT + +; AY-3-8910 SECTION + +AY CP 0A0H + JR NZ,YM2162_1 + LD A, (HL) + INC HL + BIT 7, A ; Bit 7=1 for second AY-3-8910 + JR Z, AY1 + AND 7FH + OUT (RSEL2), A + LD A, (HL) + INC HL + OUT (RDAT2), A + SET 2,(IX+0) + JR NEXT +AY1 OUT (RSEL), A + LD A, (HL) + INC HL + OUT (RDAT), A + SET 3,(IX+0) + JR NEXT +; +; YM2612 SECTION +; +YM2162_1 CP VGM_YM26121_W + JR NZ, YM2162_2 + LD A,(HL) + OUT (YMSEL),A + INC HL + LD A,(HL) + OUT (YMDAT),A + INC HL + SET 4,(IX+0) + JP NEXT +; +YM2162_2 CP VGM_YM26122_W + JR NZ,YM2151_1 + LD A,(HL) + OUT (YM2SEL),A + INC HL + LD A,(HL) + OUT (YM2DAT),A + INC HL + SET 4,(IX+0) ; 2nd channel + JP NEXT +; +; YM2151 SECTION +; +YM2151_1 CP VGM_YM21511_W + JR NZ,YM2151_2 + LD A,(HL) + OUT (YM2151_SEL1),A + INC HL + LD A,(HL) + OUT (YM2151_DAT1),A + INC HL + SET 6,(IX+0) + JP NEXT +; +YM2151_2 CP VGM_YM21512_W + JR NZ,GG + LD A,(HL) + OUT (YM2151_SEL2),A + INC HL + LD A,(HL) + OUT (YM2151_DAT2),A + INC HL + SET 7,(IX+0) + JP NEXT +; +; GAME GEAR SN76489 STEREO SECTION +; +GG: CP VGM_GG_W ; Stereo steering port value + JR NZ, WAITNN +; SET 0,(IX+1) + INC HL + JP NEXT +; +WAITNN CP VGM_WNS ; Wait nn samples + JR NZ, WAIT60 + LD A, (HL) + INC HL + LD D, (HL) + INC HL + LD (VGMPOS), HL + LD L, A + LD H, D + LD (vdelay), HL + RET +; +WAIT60 CP VGM_W735 ; Wait 735 samples (60Hz) + JR NZ, WAIT50 + LD (VGMPOS), HL + LD HL, D60 + LD (vdelay), HL + RET +; +WAIT50: CP VGM_W882 ; Wait 882 samples (50Hz) + JR NZ, WAIT1 + LD (VGMPOS), HL + LD HL, D50 + LD (vdelay), HL + RET +; +WAIT1: CP 70H ; WAIT 0-15 SAMPLES + JR C, UNK ; CODES 70-7FH + CP 80H + JP NC, UNK + SUB 6FH + LD L, A + LD H, 0 + LD (vdelay), HL + RET +; +UNK: SET 0,(IX+1) ; unknown device + INC HL ; Try and skip +#IF (debug) + ld a,'u' ; Display unknow command + call PRTCHR + call PRTDOT + call PRTHEX + ld a,' ' + call PRTCHR +#ENDIF + JP NEXT +; +;------------------------------------------------------------------------------ +; Display VGM Devices detected during playback. +;------------------------------------------------------------------------------ +; +VGMDEVICES: LD DE,MSG_PO ; Played on ... + CALL PRTSTR +; + LD A,(IX+0) + PUSH AF +; + LD DE,MSG_SN ; SN76489 Devices + CALL CHKDEV +; + POP AF + SRL A + SRL A + PUSH AF +; + LD DE,MSG_AY ; AY-3-8910 Devices + CALL CHKDEV +; + POP AF + SRL A + SRL A + PUSH AF +; + LD DE,MSG_YM2612 ; YM-2612 Devices + CALL CHKDEV +; + POP AF + SRL A + SRL A + PUSH AF +; + LD DE,MSG_YM2151 ; YM-2151 Devices + CALL CHKDEV +; + POP AF +; SRL A +; SRL A +; PUSH AF +; + LD A,(IX+1) + LD DE,MSG_UNK ; Unknown Device Code detected +; CALL CHKDEV +; +CHKDEV: AND %00000011 ; Display + RET Z ; number of + SRL A ; devices + ADC A,'0' + CALL PRTCHR ; Skip if not + CALL PRTSTR ; used. + RET +; +;------------------------------------------------------------------------------ +; Display VGM information. +;------------------------------------------------------------------------------ +; +VGMINFO: LD DE,MSG_BADF ; Check valid file + LD HL,VGMDATA + LD A,(HL) + CP 'V' + JP NZ,EXIT_ERR + INC HL + LD A,(HL) + CP 'g' + JP NZ,EXIT_ERR + INC HL + LD A,(HL) + CP 'm' + JP NZ,EXIT_ERR + INC HL + LD A,(HL) + CP ' ' + JP NZ,EXIT_ERR + + LD HL,VGMDATA+08H ; Get version in DE:HL + LD E,(HL) + INC HL + LD D,(HL) + INC HL + LD B,(HL) + INC HL + LD C,(HL) + EX DE,HL + PUSH BC + POP DE +; CALL PRTHEX32 ; Debug + + LD HL,(VGMDATA+16H) ; Is GD3 in range? + LD A,H + OR L + JR NZ,SKIP_GD3 + + LD HL,(VGMDATA+14H) ; Is there a GD3 header + LD DE,VGMDATA+14H + ADD HL,DE + LD A,(HL) + CP 'G' + JR NZ,SKIP_GD3 + INC HL + LD A,(HL) + CP 'd' + JR NZ,SKIP_GD3 + INC HL + LD A,(HL) + CP '3' + JR NZ,SKIP_GD3 + INC HL + LD A,(HL) + CP ' ' + JR NZ,SKIP_GD3 + + LD DE,0009H ; Skip version and size + ADD HL,DE + + CALL CRLF + LD DE,MSG_TRACK + CALL PRTSTR + +GD3_NXT: LD A,(HL) ; Print English Track + OR A + INC HL + INC HL + JR Z,GD3_NXT1 + CALL PRTCHR + JR GD3_NXT + +GD3_NXT1: LD A,(HL) ; Skip Japanese Track + OR A + INC HL + INC HL + JR NZ,GD3_NXT1 +; JR GD3_NXT1 + + LD DE,MSG_TITLE + CALL PRTSTR + +GD3_NXT2: LD A,(HL) ; Print English Title + OR A + INC HL + INC HL + JR Z,GD3_NXT3 + CALL PRTCHR + JR GD3_NXT2 + +GD3_NXT3: CALL CRLF +SKIP_GD3: RET +; +;------------------------------------------------------------------------------ +; Mute Devices. +;------------------------------------------------------------------------------ +; +VGMMUTE: LD A,(IX+0) ; Only mute devices used. + AND %00000011 + JR Z,SKIP1 + + LD A, 9FH ; Mute all channels on psg + OUT (PSG1REG), A + OUT (PSG2REG), A + LD A, 0BFH + OUT (PSG1REG), A + OUT (PSG2REG), A + LD A, 0DFH + OUT (PSG1REG), A + OUT (PSG2REG), A + LD A, 0FFH + OUT (PSG1REG), A + OUT (PSG2REG), A + +SKIP1: LD A,(IX+0) + AND %00001100 + JR Z,SKIP2 + + LD A, 8 ; Mute all channels on ay + OUT (RSEL), A + OUT (RSEL2), A + XOR A + OUT (RDAT), A + OUT (RDAT2), A + LD A, 9 + OUT (RSEL), A + OUT (RSEL2), A + XOR A + OUT (RDAT), A + OUT (RDAT2), A + LD A, 10 + OUT (RSEL), A + OUT (RSEL2), A + XOR A + OUT (RDAT), A + OUT (RDAT2), A + CALL FASTIO + +SKIP2: LD A,(IX+0) ; mute all channels on ym2612 + AND %00110000 + JP Z,SKIP3 + + setreg($22,$00) ; lfo off + + setreg($27,$00) ; Disable independant Channel 3 + setreg($28,$00) ; note off ch 1 + setreg($28,$01) ; note off ch 2 + setreg($28,$02) ; note off ch 3 + setreg($28,$04) ; note off ch 4 + setreg($28,$05) ; note off ch 5 + setreg($28,$06) ; note off ch 6 + setreg($2b,$00) ; dac off + + setreg($b4,$00) ; sound off ch 1-3 + setreg($b5,$00) + setreg($b6,$00) + setreg2($b4,$00) ; sound off ch 4-6 + setreg2($b5,$00) + setreg2($b6,$00) + + setreg($40,$7f) ; ch 1-3 total level minimum + setreg($41,$7f) + setreg($42,$7f) + setreg($44,$7f) + setreg($45,$7f) + setreg($46,$7f) + setreg($48,$7f) + setreg($49,$7f) + setreg($4a,$7f) + setreg($4c,$7f) + setreg($4d,$7f) + setreg($4e,$7f) + + setreg2($40,$7f) ; ch 4-6 total level minimum + setreg2($41,$7f) + setreg2($42,$7f) + setreg2($44,$7f) + setreg2($45,$7f) + setreg2($46,$7f) + setreg2($48,$7f) + setreg2($49,$7f) + setreg2($4a,$7f) + setreg2($4c,$7f) + setreg2($4d,$7f) + setreg2($4e,$7f) + +#if (0) + + setreg($2a,$00) ; dac value + + setreg($24,$00) ; timer A frequency + setreg($25,$00) ; timer A frequency + setreg($26,$00) ; time B frequency + + setreg($30,$00) ; ch 1-3 multiply & detune + setreg($31,$00) + setreg($32,$00) + setreg($34,$00) + setreg($35,$00) + setreg($36,$00) + setreg($38,$00) + setreg($39,$00) + setreg($3a,$00) + setreg($3c,$00) + setreg($3d,$00) + setreg($3e,$00) + + setreg2($30,$00) ; ch 4-6 multiply & detune + setreg2($31,$00) + setreg2($32,$00) + setreg2($34,$00) + setreg2($35,$00) + setreg2($36,$00) + setreg2($38,$00) + setreg2($39,$00) + setreg2($3a,$00) + setreg2($3c,$00) + setreg2($3d,$00) + setreg2($3e,$00) + + setreg($50,$00) ; ch 1-3 attack rate and scaling + setreg($51,$00) + setreg($52,$00) + setreg($54,$00) + setreg($55,$00) + setreg($56,$00) + setreg($58,$00) + setreg($59,$00) + setreg($5a,$00) + setreg($5c,$00) + setreg($5d,$00) + setreg($5e,$00) + + setreg2($50,$00) ; ch 4-6 attack rate and scaling + setreg2($51,$00) + setreg2($52,$00) + setreg2($54,$00) + setreg2($55,$00) + setreg2($56,$00) + setreg2($58,$00) + setreg2($59,$00) + setreg2($5a,$00) + setreg2($5c,$00) + setreg2($5d,$00) + setreg2($5e,$00) + + setreg($60,$00) ; ch 1-3 decay rate and am enable + setreg($61,$00) + setreg($62,$00) + setreg($64,$00) + setreg($65,$00) + setreg($66,$00) + setreg($68,$00) + setreg($69,$00) + setreg($6a,$00) + setreg($6c,$00) + setreg($6d,$00) + setreg($6e,$00) + + setreg2($60,$00) ; ch 4-6 decay rate and am enable + setreg2($61,$00) + setreg2($62,$00) + setreg2($64,$00) + setreg2($65,$00) + setreg2($66,$00) + setreg2($68,$00) + setreg2($69,$00) + setreg2($6a,$00) + setreg2($6c,$00) + setreg2($6d,$00) + setreg2($6e,$00) + + setreg($70,$00) ; ch 1-3 sustain rate + setreg($71,$00) + setreg($72,$00) + setreg($74,$00) + setreg($75,$00) + setreg($76,$00) + setreg($78,$00) + setreg($79,$00) + setreg($7a,$00) + setreg($7c,$00) + setreg($7d,$00) + setreg($7e,$00) + + setreg2($70,$00) ; ch 4-6 sustain rate + setreg2($71,$00) + setreg2($72,$00) + setreg2($74,$00) + setreg2($75,$00) + setreg2($76,$00) + setreg2($78,$00) + setreg2($79,$00) + setreg2($7a,$00) + setreg2($7c,$00) + setreg2($7d,$00) + setreg2($7e,$00) + + setreg($80,$00) ; ch 1-3 release rate and sustain level + setreg($81,$00) + setreg($82,$00) + setreg($84,$00) + setreg($85,$00) + setreg($86,$00) + setreg($88,$00) + setreg($89,$00) + setreg($8a,$00) + setreg($8c,$00) + setreg($8d,$00) + setreg($8e,$00) + + setreg2($80,$00) ; ch 4-6 release rate and sustain level + setreg2($81,$00) + setreg2($82,$00) + setreg2($84,$00) + setreg2($85,$00) + setreg2($86,$00) + setreg2($88,$00) + setreg2($89,$00) + setreg2($8a,$00) + setreg2($8c,$00) + setreg2($8d,$00) + setreg2($8e,$00) + + setreg($90,$00) ; ch 1-3 ssg-eg + setreg($91,$00) + setreg($92,$00) + setreg($94,$00) + setreg($95,$00) + setreg($96,$00) + setreg($98,$00) + setreg($99,$00) + setreg($9a,$00) + setreg($9c,$00) + setreg($9d,$00) + setreg($9e,$00) + + setreg2($90,$00) ; ch 4-6 ssg-eg + setreg2($91,$00) + setreg2($92,$00) + setreg2($94,$00) + setreg2($95,$00) + setreg2($96,$00) + setreg2($98,$00) + setreg2($99,$00) + setreg2($9a,$00) + setreg2($9c,$00) + setreg2($9d,$00) + setreg2($9e,$00) + + setreg($a0,$00) ; ch 1-3 frequency + setreg($a1,$00) + setreg($a2,$00) + setreg($a4,$00) + setreg($a5,$00) + setreg($a6,$00) +; setreg($a8,$00) ; ch 3 special mode +; setreg($a9,$00) +; setreg($aa,$00) +; setreg($ac,$00) +; setreg($ad,$00) +; setreg($ae,$00) + + setreg2($a0,$00) ; ch 4-6 frequency + setreg2($a1,$00) + setreg2($a2,$00) + setreg2($a4,$00) + setreg2($a5,$00) + setreg2($a6,$00) +; setreg2($a8,$00) ; ch 3 special mode +; setreg2($a9,$00) +; setreg2($aa,$00) +; setreg2($ac,$00) +; setreg2($ad,$00) +; setreg2($ae,$00) + + setreg($b0,$00) ; ch 1-3 algorith + feedback + setreg($b1,$00) + setreg($b2,$00) + setreg2($b0,$00) ; ch 4-6 algorith + feedback + setreg2($b1,$00) + setreg2($b2,$00) + +#endif + +SKIP3: LD A,(IX+0) ; For YM2151 ... Unimplemented + AND %11000000 + JP Z,SKIP4 + + ; MUTE YM2151 + +SKIP4 RET +; +;------------------------------------------------------------------------------ +; Hardware specific routines. +;------------------------------------------------------------------------------ +; +SLOWIO: +#IFDEF SBCV2004 + PUSH AF + LD A,(HB_RTCVAL) + OR %00001000 ; SBC-V2-004+ CHANGE + OUT (RTCIO),A ; TO HALF CLOCK SPEED + POP AF +#ENDIF + RET +; +FASTIO: +#IFDEF SBCV2004 + LD A,(HB_RTCVAL) + AND %11110111 ; SBC-V2-004+ CHANGE TO + OUT (RTCIO),A ; NORMAL CLOCK SPEED +#ENDIF + RET +; +;------------------------------------------------------------------------------ +; PRINT THE nTH STRING IN A LIST OF STRINGS WHERE EACH IS TERMINATED BY 0 +; A REGISTER DEFINES THE nTH STRING IN THE LIST TO PRINT AND DE POINTS +; TO THE START OF THE STRING LIST. +;------------------------------------------------------------------------------ +; +PRTIDXDEA: + LD C,A + OR A +PRTIDXDEA1: + JR Z,PRTIDXDEA3 ; FOUND TARGET SO EXIT +PRTIDXDEA2: + LD A,(DE) ; LOOP UNIT + INC DE ; WE REACH + OR A ; END OF STRING + JR NZ,PRTIDXDEA2 + DEC C ; AT STRING END. SO GO + JR PRTIDXDEA1 ; CHECK FOR INDEX MATCH +PRTIDXDEA3: + CALL PRTSTR ; DISPLAY THE STRING + RET +; +;------------------------------------------------------------------------------ +; External routines. +;------------------------------------------------------------------------------ +; +#INCLUDE "printing.inc" +; +;------------------------------------------------------------------------------ +; Strings and constants. +;------------------------------------------------------------------------------ +; +MSG_WELC: .DB "VGM Player v0.4, 11-Dec-2022" +; .DB CR,LF, "J.B. Langston/Marco Maccaferri/Ed Brindley/Phil Summers",CR,LF + .DB 0 +MSG_BADF: .DB "Not a VGM file",CR,LF,0 +MSG_PO .DB "Played on : ",0 +MSG_YM2612: .DB "xYM-2612 ",0 +MSG_SN: .DB "xSN76489 ",0 +MSG_AY: .DB "xAY-3-8910 ",0 +MSG_YM2151: .DB "xYM-2151 ",0 +MSG_UNK: .DB "xUnsupported device encountered", CR, LF, 0 +MSG_EXIT: .DB "FINISHED.",CR,LF,0 +MSG_NOFILE: .DB "File not found", CR, LF, 0 +MSG_MEM: .DB "File to big", CR, LF, 0 +MSG_TITLE: .DB " from: ",0 +MSG_TRACK .DB "Playing: ",0 +MSG_CPU .DB "[cpu]",0 +MSG_CTCPOLL .DB "[ctc polled]",0 +MSG_CTCINT .DB "[ctc interrupts]",0 +MSG_ROMWBW .DB " [romwbw] ",0 +MSG_CUSTOM .DB " [custom] ",0 +MSG_P8X180 .DB " [p8x180] ",0 +MSG_RCBUS .DB " [RCBus] ",0 +MSG_SBCECB .DB " [sbc] ",0 +MSG_MBC .DB " [mbc] ",0 +; +;------------------------------------------------------------------------------ +; Variables +;------------------------------------------------------------------------------ +; +VGMPOS .DW 0 +KEYCHK .DB 0 ; Counter for keypress checks +; +VGM_DEV .DB %00000000 ; IX+0 Flags for devices + ; xx...... ym2151 1 & 2 + ; ..x..... ym2612 2 (not supported) + ; ...x.... ym2612 1 + ; ....xx.. ay-3-8910 1 & 2 + ; ......xx sn76489 1 & 2 + + .DB %00000000 ; IX+1 Unimplemented device flags & future devices +; +OLDSTACK .DW 0 ; original stack pointer + .FILL 40H ; space for stack +STACK .DW 0 ; top of stack + +;------------------------------------------------------------------------------ +; VGM data gets loaded into TPA here +;------------------------------------------------------------------------------ +; +VGMDATA: +; +;****************************************************************************** +;*********** Initialization code that gets overwritten by VGMDATA ************* +;****************************************************************************** +; +vgmsetup: +#IF (plt_romwbw==1) + CALL cfgports ; Get and setup ports from HBIOS +#ENDIF +; +#IF (delay_type==cpu_loop) + call setfdelay ; Setup the frame delay based on cpu speed +#ENDIF +; +#IF (delay_type==ctc_poll) + call cfgctc_poll ; If building for polled ctc, initialize it +#ENDIF +; +#IF (delay_type==ctc_int) ; If building for interrupt driven ctc, initialize it + call cfgctc_int +#ENDIF +; +#IF (debug) +; LD A,0 ; tone to validate presence +;TST: LD C,PSG1REG +; OUT (C),A +; LD C,PSG2REG +; OUT (C),A +; JR TST +#ENDIF + ret +; +;------------------------------------------------------------------------------ +; Welcome +;------------------------------------------------------------------------------ +; +welcome: LD DE,MSG_WELC ; Welcome Message + CALL PRTSTR +; +#IF (plt_romwbw) + LD DE,MSG_ROMWBW ; display system type + CALL PRTSTR +#ENDIF +; + LD A,delay_type ; display build type + LD DE,MSG_CPU + CALL PRTIDXDEA +; + LD A,plt_type ; display system type + LD DE,MSG_CUSTOM + CALL PRTIDXDEA + call CRLF +; +#IF (debug) +#IF (delay_type==cpu_loop) + ld a,'f' ; Display frame rate delay + call PRTCHR + call PRTDOT + ld a,(fdelay) + call PRTDECB + LD A,' ' +#ENDIF + CALL PRTCHR + ld a,'c' + call PRTCHR + call PRTDOT + ld a,ctcdiv0 ; Display ctc divider values + call PRTDECB + CALL PRTDOT + ld a,ctcdiv1 + call PRTDECB + CALL PRTDOT + ld a,ctcdiv2 + call PRTDECB + CALL PRTDOT + ld a,ctcdiv3 + call PRTDECB +; +#IF (delay_wait) + ld a,' ' + CALL PRTCHR + LD A,'w' ; Display if using double wait + CALL PRTCHR +#ENDIF +#ENDIF + CALL CRLF + ret +; +;------------------------------------------------------------------------------ +; Probe HBIOS for devices and patch in I/O ports for devices +;------------------------------------------------------------------------------ +; +cfgports: ret +; +;------------------------------------------------------------------------------ +; Setup frame delay value - Loop count for DJNZ $ loop +;------------------------------------------------------------------------------ +; +setfdelay: +#IF (delay_type==cpu_loop) +#IF (plt_romwbw) + LD BC,$F8F0 ; GET CPU SPEED + RST 08 ; FROM HBIOS + LD A,L ; +#ELSE + ld a,plt_cpuspd ; USE STANDALONE CPU SPEED +#ENDIF + LD HL,CLKTBL-1 ; CPU SPEED + ADD A,L ; INDEXES + LD L,A ; INTO + ADC A,H ; TABLE + SUB L + LD H,A ; LOOK IT UP IN THE + LD A,(HL) ; CLOCK TABLE +; + LD (fdelay),A ; SAVE LOOP COUNTER FOR CPU SPEED + RET +; +;------------------------------------------------------------------------------ +; Frame delay values for different processor speeds. +;------------------------------------------------------------------------------ +; +; 1/44100hz = 22676ns +; 16Mhz = 62.5ns : DJNZ $ = 1 frame delay= 22676ns/13*62.5ns = 27.91 +; 12Mhz = 83.3ns : DJNZ $ = 1 frame delay= 22676ns/13*83.3ns = 20.94 +; 10Mhz = 100ns : DJNZ $ = 1 frame delay= 22676ns/13*100ns = 17.44 +; 8Mhz = 125ns : DJNZ $ = 1 frame delay= 22676ns/13*125ns = 13.95 +; 7.3728Mhz = 135.6ns : DJNZ $ = 1 frame delay= 22676ns/13*135.6ns = 12.86 +; 6Mhz = 166.6s : DJNZ $ = 1 frame delay= 22676ns/13*166.6ns = 10.47 +; 4Mhz = 250ns : DJNZ $ = 1 frame delay= 22676ns/13*250ns = 6.98 +; 2Mhz = 500ns : DJNZ $ = 1 frame delay= 22676ns/13*500ns = 3.49 +; 1Mhz = 1000ns : DJNZ $ = 1 frame delay= 22676ns/13*1000ns = 1.74 +; +CLKTBL: .DB 1 ; 1Mhz ; none of these + .DB 3 ; 2Mhz ; have been + .DB 0 ; 3Mhz ; validated + .DB 6 ; 4Mhz + .DB 0 ; 5Mhz + .DB 10 ; 6Mhz + .DB 12 ; 7Mhz 7.3728Mhz + .DB 13 ; 8Mhz + .DB 0 ; 9Mhz + .DB 17 ; 10Mhz + .DB 0 ; 11Mhz + .DB 20 ; 12Mhz + .DB 0 ; 13Mhz + .DB 0 ; 14Mhz + .DB 0 ; 15Mhz + .DB 27 ; 16Mhz + .DB 0 ; 17Mhz + .DB 0 ; 18Mhz + .DB 0 ; 19Mhz + .DB 0 ; 20Mhz +#ENDIF +; +; +;------------------------------------------------------------------------------ +; Initialize CTC +;------------------------------------------------------------------------------ +; +; %01010011 ; CTC DEFAULT CONFIG +; %01010111 ; CTC COUNTER MODE CONFIG +; %11010111 ; CTC COUNTER INTERRUPT MODE CONFIG +; |||||||+-- CONTROL WORD FLAG +; ||||||+--- SOFTWARE RESET +; |||||+---- TIME CONSTANT FOLLOWS +; ||||+----- AUTO TRIGGER WHEN TIME CONST LOADED +; |||+------ RISING EDGE TRIGGER +; ||+------- TIMER MODE PRESCALER (0=16, 1=256) +; |+-------- COUNTER MODE +; +--------- INTERRUPT ENABLE +; +cfgctc_poll: +; +ctcch0 .equ ctcbase +ctcch1 .equ ctcbase+1 +ctcch2 .equ ctcbase+2 +ctcch3 .equ ctcbase+3 +; +ctccfg0 .equ %01010011 +ctccfg1 .equ %01010111 +ctccfg2 .equ %01010111 +ctccfg3 .equ %01010111 +; + ld a,ctccfg0 & $7f ; ; Channel 0 + out (ctcch0),a +; + ld a,ctccfg1 & $7f ; Channel 1 + out (ctcch1),a ; + ld a,ctcdiv1 & $ff ; + out (ctcch1),a ; +; + ld a,ctccfg2 & $7f ; Channel 2 + out (ctcch2),a ; + ld a,ctcdiv2 & $ff ; + out (ctcch2),a ; +; + ld a,ctccfg3 & $7f ; Channel 3 + out (ctcch3),a ; + ld a,ctcdiv3 & $ff ; + out (ctcch3),a ; +; + ret +; +#IF (debug) +ctctest: + ld b,0 + +ctclp1: in a,(ctcch3) ; wait for counter to reach zero + dec a + jr nz,ctclp1 + +ctclp2: in a,(ctcch3) ; wait for counter to pass zero + dec a + jr z,ctclp2 + + call PRTDOT +; + djnz ctclp1 +#ENDIF + ret +; +cfgctc_int: + ret + + .END diff --git a/Source/Apps/VGM/vgmplay.txt b/Source/Apps/VGM/vgmplay.txt new file mode 100644 index 00000000..0961c4d3 --- /dev/null +++ b/Source/Apps/VGM/vgmplay.txt @@ -0,0 +1,74 @@ +VGM Player for Z80 +================== + +Simple player for VGM (Video Game Music) files. + +Usage: + +VGMPLAY MUSIC[.VGM] + +Press a key to exit the program. + +Supported devices +================= + +SN76489 +AY-3-89810 +YM2612/YM3484 +YM2151 + +Supported platforms +=================== + +VGM Player is currently being developed on the ROMWBW platform using the Retrobrew computers +EBC-SBC-V2 (Z80), ECB-SCG (AY-3-8910) and ECB-VGM (YM2612 and 2xSN76489) board. +It can be configured to run with other hardware such as RCBus, P8X180 and nhyodyne MBC. + +VGM files can be very big and are limited in size by the available TPA space, which is typically 52k. + +Processor speed affects the playback speed. Under ROMWBW the player will detect the cpu speed configuration +and adjust timing loops. For other platforms, default speeds are configured but may need to be changed +to suit your hardware. Counter/Timer hardware may be supported in future. + +Example Music Files +=================== + +ENDING.VGM - AY-3-8910 * Puyo Puyo: Ending (Unused) : 24K +QIX.VGM - AY-3-8910 - Super Qix: Main BGM 2 : 28K +AGGRESS.VGM - AY-3-8910 - Rastan Saga: Aggressive World : 32K +PENGUI03.VGM - AY-3-8910 - Penguin Adventure: Forest Path : 44K +TIGER02.VGM - 2xAY-3-8910 - Tiger Hely: First Mission : 28K +BGM.VGM - 2xAY-3-8910 * SHM: BGM : 8K +LEMMIN01.VGM - SN76489 - Lemmings: Title Screen : 44K +TEDDY.VGM - 2xSN76489 - TeddyBoy Blues: Title ~ Main Theme : 52K +PITFAL02.VGM - 2xSN76489 - Pitfall II: Scene 1 : 16K +WONDER01.VGM - 2xSN76489 * Wonder Boy in Monster Land: Monster Land : 40K +DESCENT.VGM - SN76489+YM2612 - Flashback: The Quest for Identity: Descent into the Tunnels : 40K +SHIRAKAW.VGM - SN76489+YM2612 * Jantei Monogatari: St. Shirakawa University : 32K +ANNA.VGM - SN76489+YM2612 - Jantei Monogatari: Anna : 32K +FIELDMAP.VGM - SN76489+YM2612 - Taikou Risshiden: Field Map: Summer : 8K +ITSGAMOV.VGM - SN76489+YM2612 - Puyo Puyo Tsuu: It's Game Over! : 16K +STARTDEM.VGN - 2xSN76489+AY-3-8910 * Exed Exes / Savage Bees: Start Demo ~Main BGM : 32K +INCHINA.VGM - YM2612 * Double Dragon 3: The Rosetta Stone: In China : 44K + +* Included in disk images + +VGM sources +=========== +https://www.smspower.org/forums/15359-VGMPacksGameGearMegaCollection +https://vgmrips.net/packs/chip/ym2612 +https://project2612.org/ + +VGM Tools +========= +https://vgmrips.net/wiki/VGMTool +https://github.com/vgmrips/vgmtools + +References +========== +http://www.primrosebank.net/computers/mtx/tools/PD/vgmplayer.zip - Paul Daniels MTX SN76489 interrupt version with embedded VGM tune. +https://github.com/jblang/SN76489/blob/master/examples/vgmplayer.asm - J.B. Langston RCBus polled version with file loading. +https://groups.google.com/g/rc2014-z80/c/9nHnETJzGKU - Marco Maccaferri P8X180 & AY-3-8910 support +https://github.com/electrified/rc2014-ym2151/tree/main/software/vgmplay - Ed Brindly RCBus & YM2151 support + +ROMWBW version by Phil Summers. VGM Player is still in development. The ECB-VGM is also still under development. diff --git a/Source/Apps/VGM/ymfmdemo.asm b/Source/Apps/VGM/ymfmdemo.asm new file mode 100644 index 00000000..ba45f419 --- /dev/null +++ b/Source/Apps/VGM/ymfmdemo.asm @@ -0,0 +1,779 @@ +; +;------------------------------------------------------------------------------ +; Simple Z80 FM Music Driver. +; Adapted from https://github.com/michaelcmartin/bumbershoot/genesis/fm_mus.asm +;------------------------------------------------------------------------------ +; +; A song in this system is a series of records, where each record +; begins with a byte for the number of frames this record lasts, +; followed by a byte for the number of register writes to the first +; block of FM registers, followed by that many pairs of (register, +; value) bytes. +; When a zero byte is reached for a record length, the playback +; loops back to the "segno" label. +; +; Song data is created from a Music Macro Language score (mml) +; by the makebach.py script +; +;------------------------------------------------------------------------------ +; Device and system specific definitions +;------------------------------------------------------------------------------ +; +custom .equ 0 ; System configurations +sbcecb .equ 1 +MBC .equ 2 +; +plt_romwbw .equ 1 ; Build for ROMWBW? +plt_type .equ sbcecb ; Select build configuration +plt_cpuspd .equ 6 ; Non ROMWBW cpu speed default +debug .equ 0 + +ctc_delay .equ 0 +; + .org 100H +; +BDOS .equ 0005h +; +YMSEL .equ $c0 +YMDAT .equ $c1 +ctcbase .equ $cc +; +;------------------------------------------------------------------------------ +; Initialize sound chip and ctc etc +;------------------------------------------------------------------------------ +; +init: +#IF (debug) + call ym_init +#ENDIF +#IF (ctc_delay) + call ctc_config +#ENDIF +; +;------------------------------------------------------------------------------ +; Main loop +;------------------------------------------------------------------------------ +; +mloop: LD C, 6 ; check for keypress + LD E, 0FFH + CALL 5 + OR A + JP NZ,0 +; + call ploop ; PLAY + jp z,0 +; + ld hl,$1000 ; DELAY +dlp: dec hl + ld a,h + or l + jr nz,dlp +; + jr mloop +; +;------------------------------------------------------------------------------ +; Play loop +;------------------------------------------------------------------------------ +; +ploop: ld hl, wait ; HAVE WE REACHED THE + dec (hl) ; LAST FRAME + ret nz + + ld hl, (ptr) ; POINT TO START OF SONG + ld a, (hl) ; GET NO OF FRAMES + and a ; + ret z +; jr nz, nolp +; +; ld a,'@' +; call PRTCHR +; +; ld hl, segno ; POINT TO CURRENT SEGMENT + ; ld a, (hl) ; GET FRAME COUNT +nolp: ld (wait), a ; AND SAVE IT + inc hl + call PRTHEX + call PRTDOT + + ld b, (hl) ; GET NUMBER OF REGISTER PAIRS TO WRITE + inc hl ; POINT TO REGISTER + ld a,b + call PRTHEX + call PRTDOT + +rlp: ld a, (hl) ; SELECT REGISTER + out (YMSEL),a + call PRTHEX + + inc hl ; GET VALUE + ld a, (hl) + call PRTHEX + + inc hl + + out (YMDAT),a ; WRITE THE VALUE + + djnz rlp ; DO ALL THE PAIRS IN THIS SEGMENT + + ld (ptr), hl ; SAVE WHERE WE ARE AT + call CRLF + + ret +; +;------------------------------------------------------------------------------ +; CTC initialization +;------------------------------------------------------------------------------ +; +ctc_config: +; ld b,4 ; 4 channels +; ld c,ctcbase ; first channel port +;ctc_lp: ld a,ctc_defcfg ; ctc default config +; out (c),a ; ctc command +; inc c ; next channel port +; djnz ctc_lp + +; ld hl,hb_timint ; TIMER INT HANDLER ADR +; ld (ivt(ctctivt)),hl +; +; ld a,int_ctc0a * 2 + out (ctcbase),a ; SETUP CTC BASE INT VECTOR +; +ctcch0 .equ ctcbase +ctcch1 .equ ctcbase+1 +ctcch2 .equ ctcbase+2 +ctcch3 .equ ctcbase+3 + +ctccfg0 .equ %01010011 +ctccfg1 .equ %01010111 +ctccfg2 .equ %01010111 +ctccfg3 .equ %01010111 + +ctcdiv0 .equ 1 ; 3.579545MHz input 60Hz timer tick +ctcdiv1 .equ 8 +ctcdiv2 .equ 0 +ctcdiv3 .equ 29 + +;ctcdiv0 .equ 1 ; 3.579545MHz input 50Hz timer tick +;ctcdiv1 .equ 8 +;ctcdiv2 .equ 0 +;ctcdiv3 .equ 34 + +;ctcdiv0 .equ 1 ; 3.579545MHz input 44100z timer tick +;ctcdiv1 .equ 1 +;ctcdiv2 .equ 1 +;ctcdiv3 .equ 81 + + ld a,ctccfg0 & $7f ; ; Channel 0 + out (ctcch0),a +; + ld a,ctccfg1 & $7f ; Channel 1 + out (ctcch1),a ; + ld a,ctcdiv1 & $ff ; + out (ctcch1),a ; +; + ld a,ctccfg2 & $7f ; Channel 2 + out (ctcch2),a ; + ld a,ctcdiv2 & $ff ; + out (ctcch2),a ; +; + ld a,ctccfg3 & $7f ; Channel 3 + out (ctcch3),a ; + ld a,ctcdiv3 & $ff ; + out (ctcch3),a ; +; + ret +; +ptr: .dw song +wait: .db $01 +; +;------------------------------------------------------------------------------ +; YM2612 initialization - not required if included in song data +;------------------------------------------------------------------------------ +; +#DEFINE setreg(reg,val) \ +#DEFCONT \ ld a,reg +#DEFCONT \ out (YMSEL),a +#DEFCONT \ ld a,val +#DEFCONT \ out (YMDAT),a +#DEFCONT \ ld b,0 +#DEFCONT \ in a,(YMSEL) +#DEFCONT \ rlca +#DEFCONT \ jp nc,$+5 +#DEFCONT \ djnz $-6 +; +ym_init: + setreg($22,$00) ; lfo off + setreg($27,$00) ; note off ch 0 + setreg($28,$01) ; note off ch 1 + setreg($28,$02) ; note off ch 2 + setreg($28,$03) ; note off ch 3 + setreg($28,$04) ; note off ch 4 + setreg($28,$05) ; note off ch 5 + setreg($28,$06) ; note off ch 6 + setreg($28,$01) ; note off ch 1 + setreg($2b,$00) ; dac off + setreg($30,$71) + setreg($34,$0d) + setreg($38,$33) + setreg($3c,$01) ; dt1/mul + setreg($40,$23) + setreg($44,$2d) + setreg($48,$26) + setreg($4c,$00) ; total level + setreg($50,$5f) + setreg($54,$99) + setreg($58,$5f) + setreg($5c,$94) ; rs/ar + setreg($60,$05) + setreg($64,$05) + setreg($68,$05) + setreg($6c,$07) ; am/dir + setreg($70,$02) + setreg($74,$02) + setreg($78,$02) + setreg($7c,$02) ; d2r + setreg($80,$11) + setreg($84,$11) + setreg($88,$11) + setreg($8c,$a6) ; d1l/rr + setreg($90,$00) + setreg($94,$00) + setreg($98,$00) + setreg($9c,$00) ; proprietary + setreg($b0,$32) ; feedback/algorithm + setreg($b4,$c0) ; both speakers on + setreg($28,$00) ; key off + setreg($a4,$22) + setreg($a0,$69) ; set frequency +; + ret +; +;------------------------------------------------------------------------------ +; Example breakdown of first section, which is initialization +;------------------------------------------------------------------------------ +; +; BYTE NUMBER OF FRAMES +; BYTE NUMBER OF REGISTER WRITES +; BYTE REGISTER +; BYTE VALUE +; +; CNT $0D 13 frames +; $42 66 register writes (132 BYTES) +; 2 $30,$71 dac +; 4 $34,$0D dac +; 6 $38,$33 dac +; 8 $3C,$01 dt1/mul +; 10 $40,$23 dt1/mul +; 12 $44,$2D dt1/mul +; 14 $48,$26 dt1/mul +; 16 $4C,$00 total level +; 18 $50,$5F total level +; 20 $54,$99 total level +; 22 $58,$5F total level +; 24 $5C,$94 rs/ar +; 26 $60,$05 rs/ar +; 28 $64,$05 rs/ar +; 30 $68,$05 rs/ar +; 32 $6C,$07 am/dir +; 34 $70,$02 am/dir +; 36 $74,$02 am/dir +; 38 $78,$02 am/dir +; 40 $7c,$02 d2r +; 42 $80,$11 d2r +; 44 $84,$11 d2r +; 46 $88,$11 d2r +; 48 $8C,$A6 +; 50 $90,$00 +; 52 $94,$00 +; 54 $98,$00 +; 56 $9C,$00 +; 58 $B0,$32 +; 60 $B4,$C0 +; 62 $31,$71 +; 64 $35,$0D +; 66 $39,$33 +; 68 $3D,$01 +; 70 $41,$23 +; 72 $45,$2D +; 74 $49,$26 +; 76 $4D,$00 +; 78 $51,$5F +; 80 $55,$99 +; 82 $59,$5F +; 84 $5D,$94 +; 86 $61,$05 +; 88 $65,$05 +; 90 $69,$05 +; 92 $6D,$07 +; 94 $71,$02 +; 96 $75,$02 +; 98 $79,$02 +; 100 $7D,$02 +; 102 $81,$11 +; 104 $85,$11 +; 106 $89,$11 +; 108 $8D,$A6 +; 110 $91,$00 +; 112 $95,$00 +; 114 $99,$00 +; 116 $9D,$00 +; 118 $B0,$32 +; 120 $B4,$C0 +; 122 $A4,$17 +; 124 $A0,$89 +; 126 $28,$F0 +; 128 $A5,$0F +; 130 $A1,$89 +; 132 $28,$F1 +; +;------------------------------------------------------------------------------ +; Song data created from Music Macro Language (mml) by makebach +;------------------------------------------------------------------------------ +; +song: +segno: .db $0D,$42,$30,$71,$34,$0D,$38,$33,$3C,$01,$40,$23,$44,$2D,$48,$26 + .db $4C,$00,$50,$5F,$54,$99,$58,$5F,$5C,$94,$60,$05,$64,$05,$68,$05 + .db $6C,$07,$70,$02,$74,$02,$78,$02,$7C,$02,$80,$11,$84,$11,$88,$11 + .db $8C,$A6,$90,$00,$94,$00,$98,$00,$9C,$00,$B0,$32,$B4,$C0,$31,$71 + .db $35,$0D,$39,$33,$3D,$01,$41,$23,$45,$2D,$49,$26,$4D,$00,$51,$5F + .db $55,$99,$59,$5F,$5D,$94,$61,$05,$65,$05,$69,$05,$6D,$07,$71,$02 + .db $75,$02,$79,$02,$7D,$02,$81,$11,$85,$11,$89,$11,$8D,$A6,$91,$00 + .db $95,$00,$99,$00,$9D,$00,$B0,$32,$B4,$C0,$A4,$17,$A0,$89,$28,$F0 + .db $A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00,$0D,$03,$A4,$1C,$A0,$BF + .db $28,$F0,$02,$01,$28,$00,$0D,$03,$A4,$1D,$A0,$A5,$28,$F0,$02,$01 + .db $28,$00,$07,$03,$A4,$1F,$A0,$89,$28,$F0,$06,$01,$28,$01,$02,$01 + .db $28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1 + .db $02,$01,$28,$00,$0B,$03,$A4,$1F,$A0,$1D,$28,$F0,$02,$01,$28,$01 + .db $02,$01,$28,$00,$0D,$06,$A4,$1F,$A0,$89,$28,$F0,$A5,$07,$A1,$89 + .db $28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01 + .db $28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D + .db $A1,$A5,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0F,$A1,$89,$28,$F1 + .db $02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0 + .db $A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF + .db $28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89 + .db $28,$F0,$A5,$07,$A1,$89,$28,$F1,$02,$01,$28,$00,$0D,$03,$A4,$1C + .db $A0,$BF,$28,$F0,$02,$01,$28,$00,$0D,$03,$A4,$1D,$A0,$A5,$28,$F0 + .db $02,$01,$28,$00,$07,$03,$A4,$1F,$A0,$89,$28,$F0,$06,$01,$28,$01 + .db $02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$A5 + .db $28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1F,$A0,$1D,$28,$F0,$02,$01 + .db $28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1F,$A0,$89,$28,$F0,$A5,$07 + .db $A1,$89,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1 + .db $02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0 + .db $A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0F,$A1,$89 + .db $28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89 + .db $28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C + .db $A1,$BF,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$1A,$06,$A4,$1E + .db $A0,$56,$28,$F0,$A5,$0D,$A1,$08,$28,$F1,$04,$02,$28,$00,$28,$01 + .db $1A,$06,$A4,$1E,$A0,$56,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$04,$02 + .db $28,$00,$28,$01,$0D,$06,$A4,$1E,$A0,$56,$28,$F0,$A5,$0D,$A1,$08 + .db $28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1F,$A0,$89,$28,$F0,$02,$01 + .db $28,$01,$02,$01,$28,$00,$1A,$06,$A4,$1D,$A0,$A5,$28,$F0,$A5,$0C + .db $A1,$BF,$28,$F1,$04,$02,$28,$00,$28,$01,$1A,$06,$A4,$1D,$A0,$A5 + .db $28,$F0,$A5,$0F,$A1,$89,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06 + .db $A4,$1D,$A0,$A5,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1F,$A0,$89,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $1A,$06,$A4,$1D,$A0,$08,$28,$F0,$A5,$0C,$A1,$3B,$28,$F1,$04,$02 + .db $28,$00,$28,$01,$0D,$06,$A4,$1D,$A0,$A5,$28,$F0,$A5,$0F,$A1,$1D + .db $28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1D,$A0,$08,$28,$F0,$02,$01 + .db $28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$0F + .db $A1,$89,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1D,$A0,$08,$28,$F0 + .db $02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0 + .db $A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$01,$0D,$03,$A5,$0E,$A1,$56 + .db $28,$F1,$02,$01,$28,$01,$0D,$03,$A5,$0F,$A1,$1D,$28,$F1,$02,$01 + .db $28,$01,$0D,$03,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$01,$0D,$03 + .db $A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$01,$03,$03,$A5,$0F,$A1,$1D + .db $28,$F1,$0A,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89 + .db $28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00,$0D,$03,$A4,$1C + .db $A0,$BF,$28,$F0,$02,$01,$28,$00,$0D,$03,$A4,$1D,$A0,$A5,$28,$F0 + .db $02,$01,$28,$00,$07,$03,$A4,$1F,$A0,$89,$28,$F0,$06,$01,$28,$01 + .db $02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$A5 + .db $28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1F,$A0,$1D,$28,$F0,$02,$01 + .db $28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1F,$A0,$89,$28,$F0,$A5,$07 + .db $A1,$89,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1 + .db $02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0 + .db $A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0F,$A1,$89 + .db $28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89 + .db $28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C + .db $A1,$BF,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17 + .db $A0,$89,$28,$F0,$A5,$07,$A1,$89,$28,$F1,$02,$01,$28,$00,$0D,$03 + .db $A4,$1C,$A0,$BF,$28,$F0,$02,$01,$28,$00,$0D,$03,$A4,$1D,$A0,$A5 + .db $28,$F0,$02,$01,$28,$00,$07,$03,$A4,$1F,$A0,$89,$28,$F0,$06,$01 + .db $28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0D + .db $A1,$A5,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1F,$A0,$1D,$28,$F0 + .db $02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1F,$A0,$89,$28,$F0 + .db $A5,$07,$A1,$89,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF + .db $28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89 + .db $28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0F + .db $A1,$89,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17 + .db $A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$01,$0B,$03 + .db $A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$1A,$06 + .db $A4,$1E,$A0,$56,$28,$F0,$A5,$0D,$A1,$08,$28,$F1,$04,$02,$28,$00 + .db $28,$01,$0D,$06,$A4,$1D,$A0,$A5,$28,$F0,$A5,$0E,$A1,$56,$28,$F1 + .db $02,$01,$28,$00,$0B,$03,$A4,$1D,$A0,$08,$28,$F0,$02,$01,$28,$01 + .db $02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$0F,$A1,$89 + .db $28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1C,$A0,$3B,$28,$F0,$02,$01 + .db $28,$01,$02,$01,$28,$00,$1A,$06,$A4,$1D,$A0,$A5,$28,$F0,$A5,$0C + .db $A1,$BF,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$1D,$A0,$08 + .db $28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1C + .db $A0,$BF,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C + .db $A0,$3B,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$17,$A0,$89,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$08,$06 + .db $A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$08,$28,$F1,$02,$01,$28,$00 + .db $08,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01,$28,$00,$06,$03,$A4,$1D + .db $A0,$08,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$1A,$06,$A4,$15 + .db $A0,$A5,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$04,$02,$28,$00,$28,$01 + .db $1A,$06,$A4,$17,$A0,$1D,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$04,$02 + .db $28,$00,$28,$01,$1A,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0F,$A1,$89 + .db $28,$F1,$04,$01,$28,$01,$1A,$03,$A5,$0D,$A1,$A5,$28,$F1,$04,$01 + .db $28,$01,$12,$03,$A5,$07,$A1,$89,$28,$F1,$08,$01,$28,$00,$04,$01 + .db $28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0F,$A1,$89,$28,$F1 + .db $02,$01,$28,$00,$0D,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01,$28,$00 + .db $0D,$03,$A4,$1D,$A0,$A5,$28,$F0,$02,$01,$28,$00,$07,$03,$A4,$1F + .db $A0,$89,$28,$F0,$06,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C + .db $A0,$3B,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$1F,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1F,$A0,$89,$28,$F0,$A5,$07,$A1,$89,$28,$F1,$02,$01,$28,$01 + .db $0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01 + .db $0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01 + .db $28,$01,$0B,$03,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00,$02,$01 + .db $28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1 + .db $02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00 + .db $02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$07,$A1,$89 + .db $28,$F1,$02,$01,$28,$00,$0D,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01 + .db $28,$00,$0D,$03,$A4,$1D,$A0,$A5,$28,$F0,$02,$01,$28,$00,$07,$03 + .db $A4,$1F,$A0,$89,$28,$F0,$06,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1F,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $0D,$06,$A4,$1F,$A0,$89,$28,$F0,$A5,$07,$A1,$89,$28,$F1,$02,$01 + .db $28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00,$02,$01 + .db $28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1 + .db $02,$01,$28,$01,$0B,$03,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00 + .db $02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5 + .db $28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01 + .db $28,$00,$02,$01,$28,$01,$1A,$06,$A4,$1E,$A0,$56,$28,$F0,$A5,$0D + .db $A1,$08,$28,$F1,$04,$02,$28,$00,$28,$01,$1A,$06,$A4,$1E,$A0,$56 + .db $28,$F0,$A5,$0F,$A1,$89,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06 + .db $A4,$1E,$A0,$56,$28,$F0,$A5,$0D,$A1,$08,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1F,$A0,$89,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $1A,$06,$A4,$1D,$A0,$A5,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$04,$02 + .db $28,$00,$28,$01,$1A,$06,$A4,$1D,$A0,$A5,$28,$F0,$A5,$0F,$A1,$89 + .db $28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$1D,$A0,$A5,$28,$F0 + .db $A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1F,$A0,$89 + .db $28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$1A,$06,$A4,$1D,$A0,$08 + .db $28,$F0,$A5,$0C,$A1,$3B,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06 + .db $A4,$1D,$A0,$A5,$28,$F0,$A5,$0F,$A1,$1D,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1D,$A0,$08,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $0D,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01 + .db $28,$00,$0B,$03,$A4,$1D,$A0,$08,$28,$F0,$02,$01,$28,$01,$02,$01 + .db $28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1 + .db $02,$01,$28,$01,$0D,$03,$A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$01 + .db $0D,$03,$A5,$0F,$A1,$1D,$28,$F1,$02,$01,$28,$01,$0D,$03,$A5,$0D + .db $A1,$A5,$28,$F1,$02,$01,$28,$01,$0D,$03,$A5,$0E,$A1,$56,$28,$F1 + .db $02,$01,$28,$01,$03,$03,$A5,$0F,$A1,$1D,$28,$F1,$0A,$01,$28,$00 + .db $02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0F,$A1,$89 + .db $28,$F1,$02,$01,$28,$00,$0D,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01 + .db $28,$00,$0D,$03,$A4,$1D,$A0,$A5,$28,$F0,$02,$01,$28,$00,$07,$03 + .db $A4,$1F,$A0,$89,$28,$F0,$06,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1F,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $0D,$06,$A4,$1F,$A0,$89,$28,$F0,$A5,$07,$A1,$89,$28,$F1,$02,$01 + .db $28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00,$02,$01 + .db $28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1 + .db $02,$01,$28,$01,$0B,$03,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00 + .db $02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5 + .db $28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01 + .db $28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$07 + .db $A1,$89,$28,$F1,$02,$01,$28,$00,$0D,$03,$A4,$1C,$A0,$BF,$28,$F0 + .db $02,$01,$28,$00,$0D,$03,$A4,$1D,$A0,$A5,$28,$F0,$02,$01,$28,$00 + .db $07,$03,$A4,$1F,$A0,$89,$28,$F0,$06,$01,$28,$01,$02,$01,$28,$00 + .db $0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01 + .db $28,$00,$0B,$03,$A4,$1F,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01 + .db $28,$00,$0D,$06,$A4,$1F,$A0,$89,$28,$F0,$A5,$07,$A1,$89,$28,$F1 + .db $02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00 + .db $02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5 + .db $28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0F,$A1,$89,$28,$F1,$02,$01 + .db $28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D + .db $A1,$A5,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1 + .db $02,$01,$28,$00,$02,$01,$28,$01,$1A,$06,$A4,$1E,$A0,$56,$28,$F0 + .db $A5,$0D,$A1,$08,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$1D + .db $A0,$A5,$28,$F0,$A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$1D,$A0,$08,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1C,$A0,$BF,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1C,$A0,$3B,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $1A,$06,$A4,$1D,$A0,$A5,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$04,$02 + .db $28,$00,$28,$01,$0D,$06,$A4,$1D,$A0,$08,$28,$F0,$A5,$0D,$A1,$A5 + .db $28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01 + .db $28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0F + .db $A1,$89,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$17,$A0,$89,$28,$F0 + .db $02,$01,$28,$01,$02,$01,$28,$00,$08,$06,$A4,$1C,$A0,$3B,$28,$F0 + .db $A5,$0D,$A1,$08,$28,$F1,$02,$01,$28,$00,$08,$03,$A4,$1C,$A0,$BF + .db $28,$F0,$02,$01,$28,$00,$06,$03,$A4,$1D,$A0,$08,$28,$F0,$02,$01 + .db $28,$01,$02,$01,$28,$00,$1A,$06,$A4,$15,$A0,$A5,$28,$F0,$A5,$0D + .db $A1,$A5,$28,$F1,$04,$02,$28,$00,$28,$01,$1A,$06,$A4,$17,$A0,$1D + .db $28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$04,$02,$28,$00,$28,$01,$1A,$06 + .db $A4,$17,$A0,$89,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$04,$01,$28,$01 + .db $1A,$03,$A5,$0D,$A1,$A5,$28,$F1,$04,$01,$28,$01,$12,$03,$A5,$07 + .db $A1,$89,$28,$F1,$08,$01,$28,$00,$04,$01,$28,$01,$0D,$06,$A4,$17 + .db $A0,$89,$28,$F0,$A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$1C,$A0,$3B,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1C,$A0,$BF,$28,$F0,$A5,$0D,$A1,$FB,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1C,$A0,$3B,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$02,$01 + .db $28,$00,$0B,$03,$A4,$17,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01 + .db $28,$00,$1A,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0E,$A1,$56,$28,$F1 + .db $04,$02,$28,$00,$28,$01,$1A,$06,$A4,$16,$A0,$56,$28,$F0,$A5,$0C + .db $A1,$BF,$28,$F1,$04,$02,$28,$00,$28,$01,$1A,$06,$A4,$16,$A0,$56 + .db $28,$F0,$A5,$06,$A1,$56,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06 + .db $A4,$1F,$A0,$89,$28,$F0,$A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1F,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $0D,$06,$A4,$1E,$A0,$56,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01 + .db $28,$00,$0B,$03,$A4,$1F,$A0,$89,$28,$F0,$02,$01,$28,$01,$02,$01 + .db $28,$00,$0D,$06,$A4,$1F,$A0,$1D,$28,$F0,$A5,$14,$A1,$BF,$28,$F1 + .db $02,$01,$28,$00,$0B,$03,$A4,$1E,$A0,$56,$28,$F0,$02,$01,$28,$01 + .db $02,$01,$28,$00,$0D,$06,$A4,$1F,$A0,$1D,$28,$F0,$A5,$0C,$A1,$BF + .db $28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0D,$A1,$FB,$28,$F1,$02,$01 + .db $28,$00,$02,$01,$28,$01,$0D,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$0F + .db $A1,$1D,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$14,$A1,$BF,$28,$F1 + .db $02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$1C,$A0,$BF,$28,$F0 + .db $A5,$0F,$A1,$1D,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0D,$A1,$FB + .db $28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$1F,$A0,$89 + .db $28,$F0,$A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1F + .db $A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1E + .db $A0,$56,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$1F,$A0,$89,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1F,$A0,$1D,$28,$F0,$A5,$14,$A1,$BF,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1E,$A0,$56,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $1A,$06,$A4,$1F,$A0,$1D,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$04,$02 + .db $28,$00,$28,$01,$1A,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$14,$A1,$3B + .db $28,$F1,$04,$02,$28,$00,$28,$01,$1A,$06,$A4,$1E,$A0,$56,$28,$F0 + .db $A5,$0F,$A1,$89,$28,$F1,$04,$02,$28,$00,$28,$01,$08,$06,$A4,$1F + .db $A0,$1D,$28,$F0,$A5,$14,$A1,$3B,$28,$F1,$02,$01,$28,$00,$08,$03 + .db $A4,$1F,$A0,$89,$28,$F0,$02,$01,$28,$00,$06,$03,$A4,$24,$A0,$3B + .db $28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$1A,$06,$A4,$1C,$A0,$BF + .db $28,$F0,$A5,$14,$A1,$BF,$28,$F1,$04,$02,$28,$00,$28,$01,$1A,$06 + .db $A4,$1D,$A0,$FB,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$04,$02,$28,$00 + .db $28,$01,$1A,$06,$A4,$1E,$A0,$56,$28,$F0,$A5,$0E,$A1,$56,$28,$F1 + .db $04,$01,$28,$00,$0D,$03,$A4,$1D,$A0,$FB,$28,$F0,$02,$01,$28,$00 + .db $0D,$03,$A4,$1E,$A0,$56,$28,$F0,$02,$01,$28,$00,$12,$03,$A4,$1F + .db $A0,$1D,$28,$F0,$08,$01,$28,$01,$04,$01,$28,$00,$1A,$06,$A4,$1F + .db $A0,$89,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$04,$02,$28,$00,$28,$01 + .db $0D,$06,$A4,$1F,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01 + .db $28,$00,$0B,$03,$A4,$1F,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01 + .db $28,$00,$0D,$06,$A4,$1E,$A0,$56,$28,$F0,$A5,$0F,$A1,$89,$28,$F1 + .db $02,$01,$28,$00,$0B,$03,$A4,$1D,$A0,$A5,$28,$F0,$02,$01,$28,$01 + .db $02,$01,$28,$00,$1A,$06,$A4,$1E,$A0,$56,$28,$F0,$A5,$0D,$A1,$08 + .db $28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$1E,$A0,$56,$28,$F0 + .db $A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1D,$A0,$A5 + .db $28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1D,$A0,$08 + .db $28,$F0,$A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1C + .db $A0,$BF,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$1A,$06,$A4,$1D + .db $A0,$08,$28,$F0,$A5,$0C,$A1,$3B,$28,$F1,$04,$02,$28,$00,$28,$01 + .db $0D,$06,$A4,$1D,$A0,$08,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$02,$01 + .db $28,$00,$0B,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01,$28,$01,$02,$01 + .db $28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$08,$28,$F1 + .db $02,$01,$28,$00,$0B,$03,$A4,$17,$A0,$89,$28,$F0,$02,$01,$28,$01 + .db $02,$01,$28,$00,$1A,$06,$A4,$17,$A0,$1D,$28,$F0,$A5,$0D,$A1,$A5 + .db $28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$16,$A0,$56,$28,$F0 + .db $A5,$0C,$A1,$3B,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$17,$A0,$1D + .db $28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$1A,$06,$A4,$15,$A0,$A5 + .db $28,$F0,$A5,$05,$A1,$A5,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06 + .db $A4,$1C,$A0,$3B,$28,$F0,$A5,$0F,$A1,$1D,$28,$F1,$02,$01,$28,$01 + .db $0B,$03,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01 + .db $0D,$06,$A4,$15,$A0,$A5,$28,$F0,$A5,$0F,$A1,$1D,$28,$F1,$02,$01 + .db $28,$01,$0B,$03,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$02,$01 + .db $28,$01,$0D,$06,$A4,$15,$A0,$A5,$28,$F0,$A5,$0F,$A1,$1D,$28,$F1 + .db $02,$01,$28,$01,$0B,$03,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00 + .db $02,$01,$28,$01,$0D,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$0F,$A1,$89 + .db $28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0D,$A1,$A5,$28,$F1,$02,$01 + .db $28,$00,$02,$01,$28,$01,$0D,$06,$A4,$15,$A0,$A5,$28,$F0,$A5,$0F + .db $A1,$89,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0D,$A1,$A5,$28,$F1 + .db $02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$15,$A0,$A5,$28,$F0 + .db $A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0D,$A1,$A5 + .db $28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$1A,$06,$A4,$1D,$A0,$08 + .db $28,$F0,$A5,$0F,$A1,$1D,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06 + .db $A4,$1D,$A0,$A5,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1D,$A0,$08,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $0D,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01 + .db $28,$00,$0B,$03,$A4,$1D,$A0,$08,$28,$F0,$02,$01,$28,$01,$02,$01 + .db $28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1 + .db $02,$01,$28,$01,$0D,$03,$A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$01 + .db $0D,$03,$A5,$0F,$A1,$1D,$28,$F1,$02,$01,$28,$01,$0D,$03,$A5,$0D + .db $A1,$A5,$28,$F1,$02,$01,$28,$01,$0D,$03,$A5,$0E,$A1,$56,$28,$F1 + .db $02,$01,$28,$01,$03,$03,$A5,$0F,$A1,$1D,$28,$F1,$0A,$01,$28,$00 + .db $02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0F,$A1,$89 + .db $28,$F1,$02,$01,$28,$00,$0D,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01 + .db $28,$00,$0D,$03,$A4,$1D,$A0,$A5,$28,$F0,$02,$01,$28,$00,$07,$03 + .db $A4,$1F,$A0,$89,$28,$F0,$06,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1F,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $0D,$06,$A4,$1F,$A0,$89,$28,$F0,$A5,$07,$A1,$89,$28,$F1,$02,$01 + .db $28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00,$02,$01 + .db $28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1 + .db $02,$01,$28,$01,$0B,$03,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00 + .db $02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5 + .db $28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01 + .db $28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$07 + .db $A1,$89,$28,$F1,$02,$01,$28,$00,$0D,$03,$A4,$1C,$A0,$BF,$28,$F0 + .db $02,$01,$28,$00,$0D,$03,$A4,$1D,$A0,$A5,$28,$F0,$02,$01,$28,$00 + .db $07,$03,$A4,$1F,$A0,$89,$28,$F0,$06,$01,$28,$01,$02,$01,$28,$00 + .db $0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01 + .db $28,$00,$0B,$03,$A4,$1F,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01 + .db $28,$00,$0D,$06,$A4,$1F,$A0,$89,$28,$F0,$A5,$07,$A1,$89,$28,$F1 + .db $02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00 + .db $02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5 + .db $28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0F,$A1,$89,$28,$F1,$02,$01 + .db $28,$00,$02,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D + .db $A1,$A5,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1 + .db $02,$01,$28,$00,$02,$01,$28,$01,$1A,$06,$A4,$1E,$A0,$56,$28,$F0 + .db $A5,$0D,$A1,$08,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$1D + .db $A0,$A5,$28,$F0,$A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$1D,$A0,$08,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1C,$A0,$BF,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1C,$A0,$3B,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $1A,$06,$A4,$1D,$A0,$A5,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$04,$02 + .db $28,$00,$28,$01,$0D,$06,$A4,$1D,$A0,$08,$28,$F0,$A5,$0D,$A1,$A5 + .db $28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01 + .db $28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0F + .db $A1,$89,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$17,$A0,$89,$28,$F0 + .db $02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0 + .db $A5,$0D,$A1,$08,$28,$F1,$02,$01,$28,$00,$0D,$03,$A4,$1C,$A0,$BF + .db $28,$F0,$02,$01,$28,$00,$16,$03,$A4,$15,$A0,$A5,$28,$F0,$04,$01 + .db $28,$01,$04,$01,$28,$00,$1A,$06,$A4,$17,$A0,$1D,$28,$F0,$A5,$0D + .db $A1,$A5,$28,$F1,$04,$02,$28,$00,$28,$01,$1A,$06,$A4,$17,$A0,$89 + .db $28,$F0,$A5,$0F,$A1,$89,$28,$F1,$04,$01,$28,$01,$1A,$03,$A5,$0D + .db $A1,$A5,$28,$F1,$04,$01,$28,$01,$12,$03,$A5,$07,$A1,$89,$28,$F1 + .db $08,$01,$28,$00,$04,$01,$28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0 + .db $A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1C,$A0,$3B + .db $28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$BF + .db $28,$F0,$A5,$0D,$A1,$FB,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1C + .db $A0,$3B,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$17 + .db $A0,$89,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$17,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$1A,$06 + .db $A4,$17,$A0,$89,$28,$F0,$A5,$0E,$A1,$56,$28,$F1,$04,$02,$28,$00 + .db $28,$01,$1A,$06,$A4,$16,$A0,$56,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1 + .db $04,$02,$28,$00,$28,$01,$1A,$06,$A4,$16,$A0,$56,$28,$F0,$A5,$06 + .db $A1,$56,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$1F,$A0,$89 + .db $28,$F0,$A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1F + .db $A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1E + .db $A0,$56,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$1F,$A0,$89,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1F,$A0,$1D,$28,$F0,$A5,$14,$A1,$BF,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1E,$A0,$56,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $0D,$06,$A4,$1F,$A0,$1D,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$02,$01 + .db $28,$01,$0B,$03,$A5,$0D,$A1,$FB,$28,$F1,$02,$01,$28,$00,$02,$01 + .db $28,$01,$0D,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$0F,$A1,$1D,$28,$F1 + .db $02,$01,$28,$01,$0B,$03,$A5,$14,$A1,$BF,$28,$F1,$02,$01,$28,$00 + .db $02,$01,$28,$01,$0D,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$0F,$A1,$1D + .db $28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0D,$A1,$FB,$28,$F1,$02,$01 + .db $28,$00,$02,$01,$28,$01,$0D,$06,$A4,$1F,$A0,$89,$28,$F0,$A5,$0E + .db $A1,$56,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1F,$A0,$1D,$28,$F0 + .db $02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1E,$A0,$56,$28,$F0 + .db $A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1F,$A0,$89 + .db $28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1F,$A0,$1D + .db $28,$F0,$A5,$14,$A1,$BF,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1E + .db $A0,$56,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$1A,$06,$A4,$1F + .db $A0,$1D,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$04,$02,$28,$00,$28,$01 + .db $1A,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$14,$A1,$3B,$28,$F1,$04,$02 + .db $28,$00,$28,$01,$1A,$06,$A4,$1E,$A0,$56,$28,$F0,$A5,$0F,$A1,$89 + .db $28,$F1,$04,$02,$28,$00,$28,$01,$08,$06,$A4,$1F,$A0,$1D,$28,$F0 + .db $A5,$14,$A1,$3B,$28,$F1,$02,$01,$28,$00,$08,$03,$A4,$1F,$A0,$89 + .db $28,$F0,$02,$01,$28,$00,$06,$03,$A4,$24,$A0,$3B,$28,$F0,$02,$01 + .db $28,$01,$02,$01,$28,$00,$1A,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$14 + .db $A1,$BF,$28,$F1,$04,$02,$28,$00,$28,$01,$1A,$06,$A4,$1D,$A0,$FB + .db $28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$04,$02,$28,$00,$28,$01,$1A,$06 + .db $A4,$1E,$A0,$56,$28,$F0,$A5,$0E,$A1,$56,$28,$F1,$04,$01,$28,$00 + .db $0D,$03,$A4,$1D,$A0,$FB,$28,$F0,$02,$01,$28,$00,$0D,$03,$A4,$1E + .db $A0,$56,$28,$F0,$02,$01,$28,$00,$12,$03,$A4,$1F,$A0,$1D,$28,$F0 + .db $08,$01,$28,$01,$04,$01,$28,$00,$1A,$06,$A4,$1F,$A0,$89,$28,$F0 + .db $A5,$0C,$A1,$BF,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$1F + .db $A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$1F,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1E,$A0,$56,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$1D,$A0,$A5,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $1A,$06,$A4,$1E,$A0,$56,$28,$F0,$A5,$0D,$A1,$08,$28,$F1,$04,$02 + .db $28,$00,$28,$01,$0D,$06,$A4,$1E,$A0,$56,$28,$F0,$A5,$0D,$A1,$A5 + .db $28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1D,$A0,$A5,$28,$F0,$02,$01 + .db $28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1D,$A0,$08,$28,$F0,$A5,$0E + .db $A1,$56,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1C,$A0,$BF,$28,$F0 + .db $02,$01,$28,$01,$02,$01,$28,$00,$1A,$06,$A4,$1D,$A0,$08,$28,$F0 + .db $A5,$0C,$A1,$3B,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$1D + .db $A0,$08,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$1C,$A0,$BF,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$08,$28,$F1,$02,$01,$28,$00 + .db $0B,$03,$A4,$17,$A0,$89,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00 + .db $1A,$06,$A4,$17,$A0,$1D,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$04,$02 + .db $28,$00,$28,$01,$0D,$06,$A4,$16,$A0,$56,$28,$F0,$A5,$0C,$A1,$3B + .db $28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$17,$A0,$1D,$28,$F0,$02,$01 + .db $28,$01,$02,$01,$28,$00,$1A,$06,$A4,$15,$A0,$A5,$28,$F0,$A5,$05 + .db $A1,$A5,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$1C,$A0,$3B + .db $28,$F0,$A5,$0F,$A1,$1D,$28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0D + .db $A1,$A5,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$0D,$06,$A4,$15 + .db $A0,$A5,$28,$F0,$A5,$0F,$A1,$1D,$28,$F1,$02,$01,$28,$01,$0B,$03 + .db $A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$0D,$06 + .db $A4,$15,$A0,$A5,$28,$F0,$A5,$0F,$A1,$1D,$28,$F1,$02,$01,$28,$01 + .db $0B,$03,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01 + .db $0D,$06,$A4,$1C,$A0,$BF,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01 + .db $28,$01,$0B,$03,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$02,$01 + .db $28,$01,$0D,$06,$A4,$15,$A0,$A5,$28,$F0,$A5,$0F,$A1,$89,$28,$F1 + .db $02,$01,$28,$01,$0B,$03,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00 + .db $02,$01,$28,$01,$0D,$06,$A4,$15,$A0,$A5,$28,$F0,$A5,$0F,$A1,$89 + .db $28,$F1,$02,$01,$28,$01,$0B,$03,$A5,$0D,$A1,$A5,$28,$F1,$02,$01 + .db $28,$00,$02,$01,$28,$01,$1A,$06,$A4,$1D,$A0,$08,$28,$F0,$A5,$0F + .db $A1,$1D,$28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$1D,$A0,$A5 + .db $28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1D + .db $A0,$08,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C + .db $A0,$BF,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$1D,$A0,$08,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$01 + .db $0D,$03,$A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$01,$0D,$03,$A5,$0F + .db $A1,$1D,$28,$F1,$02,$01,$28,$01,$0D,$03,$A5,$0D,$A1,$A5,$28,$F1 + .db $02,$01,$28,$01,$0D,$03,$A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$01 + .db $03,$03,$A5,$0F,$A1,$1D,$28,$F1,$0A,$01,$28,$00,$02,$01,$28,$01 + .db $0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01 + .db $28,$00,$0D,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01,$28,$00,$0D,$03 + .db $A4,$1D,$A0,$A5,$28,$F0,$02,$01,$28,$00,$07,$03,$A4,$1F,$A0,$89 + .db $28,$F0,$06,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$3B + .db $28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1F + .db $A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1F + .db $A0,$89,$28,$F0,$A5,$07,$A1,$89,$28,$F1,$02,$01,$28,$01,$0B,$03 + .db $A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01,$0D,$06 + .db $A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$01 + .db $0B,$03,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01 + .db $0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01 + .db $28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00,$02,$01 + .db $28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$07,$A1,$89,$28,$F1 + .db $02,$01,$28,$00,$0D,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01,$28,$00 + .db $0D,$03,$A4,$1D,$A0,$A5,$28,$F0,$02,$01,$28,$00,$07,$03,$A4,$1F + .db $A0,$89,$28,$F0,$06,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C + .db $A0,$3B,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01,$28,$00,$0B,$03 + .db $A4,$1F,$A0,$1D,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06 + .db $A4,$1F,$A0,$89,$28,$F0,$A5,$07,$A1,$89,$28,$F1,$02,$01,$28,$01 + .db $0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00,$02,$01,$28,$01 + .db $0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01 + .db $28,$01,$0B,$03,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00,$02,$01 + .db $28,$01,$0D,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1 + .db $02,$01,$28,$01,$0B,$03,$A5,$0C,$A1,$BF,$28,$F1,$02,$01,$28,$00 + .db $02,$01,$28,$01,$1A,$06,$A4,$1E,$A0,$56,$28,$F0,$A5,$0D,$A1,$08 + .db $28,$F1,$04,$02,$28,$00,$28,$01,$0D,$06,$A4,$1D,$A0,$A5,$28,$F0 + .db $A5,$0E,$A1,$56,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1D,$A0,$08 + .db $28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$BF + .db $28,$F0,$A5,$0F,$A1,$89,$28,$F1,$02,$01,$28,$00,$0B,$03,$A4,$1C + .db $A0,$3B,$28,$F0,$02,$01,$28,$01,$02,$01,$28,$00,$1A,$06,$A4,$1D + .db $A0,$A5,$28,$F0,$A5,$0C,$A1,$BF,$28,$F1,$04,$02,$28,$00,$28,$01 + .db $0D,$06,$A4,$1D,$A0,$08,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1,$02,$01 + .db $28,$00,$0B,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01,$28,$01,$02,$01 + .db $28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0F,$A1,$89,$28,$F1 + .db $02,$01,$28,$00,$0B,$03,$A4,$17,$A0,$89,$28,$F0,$02,$01,$28,$01 + .db $02,$01,$28,$00,$0D,$06,$A4,$1C,$A0,$3B,$28,$F0,$A5,$0D,$A1,$08 + .db $28,$F1,$02,$01,$28,$00,$0D,$03,$A4,$1C,$A0,$BF,$28,$F0,$02,$01 + .db $28,$00,$16,$03,$A4,$15,$A0,$A5,$28,$F0,$04,$01,$28,$01,$04,$01 + .db $28,$00,$1A,$06,$A4,$17,$A0,$1D,$28,$F0,$A5,$0D,$A1,$A5,$28,$F1 + .db $04,$02,$28,$00,$28,$01,$1A,$06,$A4,$17,$A0,$89,$28,$F0,$A5,$0F + .db $A1,$89,$28,$F1,$04,$01,$28,$01,$1A,$03,$A5,$0D,$A1,$A5,$28,$F1 + .db $04,$01,$28,$01,$12,$03,$A5,$07,$A1,$89,$28,$F1,$08,$01,$28,$00 + .db $04,$01,$28,$01,$00 + ;; 7045 bytes in song + +#include "printing.inc" + + .end diff --git a/Source/Apps/XM/Build.cmd b/Source/Apps/XM/Build.cmd index 4fbbae00..cf07e3cd 100644 --- a/Source/Apps/XM/Build.cmd +++ b/Source/Apps/XM/Build.cmd @@ -3,20 +3,26 @@ setlocal set TOOLS=..\..\..\Tools -set PATH=%TOOLS%\zx;%PATH% +set PATH=%TOOLS%\zxcc;%PATH% -set ZXBINDIR=%TOOLS%\cpm\bin\ -set ZXLIBDIR=%TOOLS%\cpm\lib\ -set ZXINCDIR=%TOOLS%\cpm\include\ +set CPMDIR80=%TOOLS%/cpm/ -zx mac xmdm125.asm $PO -zx slr180 -xmhb/HF -rem zx slr180 -xmuf/HF -zx mload25 XM=xmdm125,xmhb -rem zx mload25 XMUF=xmdm125,xmuf +zxcc mac xmdm125.asm $PO || exit /b + +zxcc slr180 -xmhb/HF || exit /b +zxcc mload25 XM=xmdm125,xmhb || exit /b + +rem zxcc slr180 -xmuf/HF || exit /b +rem zxcc mload25 XMUF=xmdm125,xmuf || exit /b + +zxcc slr180 -xmhb_old/HF || exit /b +zxcc mload25 XMOLD=xmdm125,xmhb_old || exit /b rem set PROMPT=[Build] %PROMPT% rem %comspec% -copy /Y XM.com ..\..\..\Binary\Apps\ -rem copy /Y XMUF.com ..\..\..\Binary\Apps\ +copy /Y XM.com ..\..\..\Binary\Apps\ || exit /b +rem copy /Y XMUF.com ..\..\..\Binary\Apps\ || exit /b +copy /Y XMOLD.com ..\..\..\Binary\Apps\ || exit /b + +rem pause \ No newline at end of file diff --git a/Source/Apps/XM/Makefile b/Source/Apps/XM/Makefile index b16ff7ef..fc9a62e6 100644 --- a/Source/Apps/XM/Makefile +++ b/Source/Apps/XM/Makefile @@ -1,5 +1,5 @@ -#OBJECTS = xm.com xmuf.com -OBJECTS = xm.com +OBJECTS = xm.com xmold.com +#OBJECTS += xmuf.com DEST = ../../../Binary/Apps TOOLS = ../../../Tools OTHERS = *.hex @@ -7,7 +7,10 @@ OTHERS = *.hex include $(TOOLS)/Makefile.inc xm.com: xmdm125.hex xmhb.hex - $(ZXCC) $(CPM)/MLOAD25 XM=xmdm125,xmhb + $(ZXCC) MLOAD25 XM=xmdm125,xmhb -#xmuf.com: xmdm125.hex xmuf.hex -# $(ZXCC) $(CPM)/MLOAD25 XMUF=xmdm125,xmuf +xmuf.com: xmdm125.hex xmuf.hex + $(ZXCC) MLOAD25 XMUF=xmdm125,xmuf + +xmold.com: xmdm125.hex xmhb_old.hex + $(ZXCC) MLOAD25 XMOLD=xmdm125,xmhb_old diff --git a/Source/Apps/XM/XModem Xfer Anomaly.txt b/Source/Apps/XM/XModem Xfer Anomaly.txt new file mode 100644 index 00000000..45f274bc --- /dev/null +++ b/Source/Apps/XM/XModem Xfer Anomaly.txt @@ -0,0 +1,77 @@ +XModem 12.5 & Tera Term Anomaly Analysis +---------------------------------------- + +Protocol Notes: + +- During protocol startup, the receiver NAKs the sender repeatedly + to let the sender know it can start sending. +- Normally, the receiver sends a NAK character to ask the sender to + resend a packet. +- Prior to receiving the first packet, the receiver may send a "C" + or a "CK" instead of a NAK. This mechanism is used to inform the + sender that the receiver wants to use (C)RC error detection + instead of checksum error detection and optionally 1(K) packet sizes. +- After the first packet exchange, a NAK is always used to + request a packet be resent. + +Anomalous Exchange Description: + +XModem on RomWBW is being used to receive a file being sent +by Tera Term on a Windows PC... + +- XModem is started in receive mode +- User starts process of selecting a file to send on Tera Term +- XModem begins sending "CK" sequences as described above + to wake up the sender +- Tera Term buffers incoming "CK" sequences while user is selecting + a file to send +- User completes file selection +- Tera Term receives the first "CK" which was buffered while user + was selecting a file +- Tera Term correctly receives the first "CK", sets itself to + use CRC and 1K packets, then sends the first packet +- While waiting for Tera Term to send the first packet, XModem + is repeatedly timing out and resending the "CK" sequence +- For each timeout, XModem spends 1 second flushing any incoming + characters from the sender (it assumes it is flushing line garbage). +- IFF the first packet from Tera Term starts to arrive during this + 1 second flushing interval, XModem gobbles up and discards the + first packet sent by Tera Term +- XModem then sends a new "CK" because it is still waiting for the + first packet (having just flushed the actual first packet) +- Tera Term has already switched out of "first packet" mode and will + now only respond to an actual NAK character, so it ignores all of + the CKs send from XModem +- XModem continues to send CKs and Tera Term continues to ignore them + until XModem hits a retry threshold +- When XModem hits the retry threshold, it attempts to switch from + CRC to Checksum assuming the sender was not capable of using + CRCs +- XModem now sends a NAK character because that is what is used for + for first packet NAKing in Checksum mode +- Tera Term sees the NAK and resends the first packet, but appends a + CRC instead of a Checksum because Tera Term is still in CRC mode +- XModem fails the Tera Term first packet resends because it is + looking for a Checksum and Tera Term is appending CRCs. +- XModem eventually gives up. + +Summary of failure: + +If Tera Term happens to start sending the first packet during the +one second "flush" window of XModem, the exchange will fail during +the startup sequence. + +Since the precise start timing of the first packet is dependent on +the time the user takes to select a file, the occurrence of the +failure is essentially random. + +The timeout used by XModem is about 5 seconds followed by the 1 +second line flush. So, there is a 1 in 6 chance that the protocol +will fail to startup successfully. + +Mitigation: + +- Modified the receive timeout recovery to *not* flush the incoming + buffer for one second. Flushing in this scenario makes no sense + anyway because a timeout just occurred meaning no data is being + received. \ No newline at end of file diff --git a/Source/Apps/XM/xmdm125.asm b/Source/Apps/XM/xmdm125.asm index ac881800..e735b618 100644 --- a/Source/Apps/XM/xmdm125.asm +++ b/Source/Apps/XM/xmdm125.asm @@ -71,7 +71,7 @@ STX EQU 02H ; 'Start of header' for 1024 byte blocks ; Conditional equates - change to suit your system, then assemble ; MHZ EQU 10 ; Clock speed, use integer (2,4,5,8, etc.) -SCL EQU 6600 ; WBW: Receive loop timeout scalar +SCL EQU 6600 ; [WBW] Receive loop timeout scalar CPM3 EQU NO ; Yes, if operating in CP/M v3.0 environment STOPBIT EQU NO ; No, if using 1 stop bit, yes if using 2 BYEBDOS EQU NO ; Yes, if using BYE338-up, BYE501-up, or NUBYE @@ -758,7 +758,10 @@ RECVOPT:MVI A,'K' ; First off, default to 1K mode CALL RCVOPC ; Check 4th (or 5th) option ENDIF ; - JMP OPTERR ; If 5th or 6th option, whoops! + ; [WBW] Added to support port number + CALL RCVOPC ; Check 5th (or 6th) option +; + JMP OPTERR ; If 7th or 8th option, whoops! ; RCVOPC: INX H ; Increment pointer to next character MOV A,M ; Get option character HL points to @@ -790,7 +793,7 @@ CHK3RD: CPI 'X' ; Got an "X" for first option? CHK4TH: IF MBFMSG ; Allowing "RM" for message uploads? CPI 'M' ; Got an "M" for message upload? - JNZ CHK5TH ; If not, bad option + JNZ CHK5TH ; Nope, try next STA MSGFLG ; If "M", set MSGFLG MVI A,'P' ; Also, set PRVTFL STA PRVTFL @@ -804,11 +807,21 @@ CHK4TH: CHK5TH: IF NDESC ; Allowing "RN" to skip upload descript? CPI 'N' ; Got an 'N'? - JNZ BADROP ; If nope, is NG.. + JNZ CHK6TH ; Nope, try next STA NDSCFL ; else set flag to skip descript phase RET ENDIF ; +CHK6TH: + ; [WBW] Get target serial port (0-9 supported) + CPI '0' + JC BADROP ; If < 0, out of range + CPI '9' + 1 + JNC BADROP ; If > 9, out of range + SUI '0' ; Make binary + STA PORT + RET +; BADROP: POP PSW ; Restore stack JMP OPTERR ; is bad option ; @@ -817,9 +830,10 @@ BADROP: POP PSW ; Restore stack ; ALLSET: CALL GETCHR CALL GETCHR + LDA PORT ; [WBW] Pass serial port to driver CALL MINIT - STA CPUMHZ ; WBW: Save CPU speed from MINIT - SHLD RCVSCL ; WBW: Save rcv loop scalar from MINIT + STA CPUMHZ ; [WBW] Save CPU speed from MINIT + SHLD RCVSCL ; [WBW] Save rcv loop scalar from MINIT ; ; Jump to appropriate function ; @@ -920,7 +934,8 @@ SKSK2: CALL ILPRT DB 'XMODEM L CAT.LBR CAT.COM send a file from a library' DB CR,LF DB 'XMODEM LK CAT.LBR CAT.COM send in 1k blocks',CR,LF - DB ' The ".LBR" file extension may be omitted',CR,LF,LF + DB ' The ".LBR" file extension may be omitted',CR,LF + DB ' Add "0"-"9" to specify serial port',CR,LF,LF DB 'XMODEM R HELLO.DOC receive a file from you' DB CR,LF DB 'XMODEM RP HELLO.DOC receive in a private area' @@ -939,7 +954,8 @@ SKSK2: CALL ILPRT ; IF NOT LUXMOD DB ' Add "C" for forced checksum ("RC" "RPC")',CR,LF - DB ' Add "X" for forced 128 byte protocol ("RX" "RPX")' + DB ' Add "X" for forced 128 byte protocol ("RX" "RPX")',CR,LF + DB ' Add "0"-"9" to specify serial port' DB CR,LF DB ' "R" switches from CRC to checksum after 5 retries' DB CR,LF,LF @@ -2214,13 +2230,13 @@ ILLDU: CALL ERXIT RCVRECD:XRA A ; Initialize error count to zero STA ERRCT ; -;WBW BEGIN: Be more patient waiting for host to start sending file - LDA FRSTIM ; WBW: Get first time flag - ORA A ; WBW: Set CPU flags - JNZ RCVRPT ; WBW: If not first time, bypass - MVI A,-10 ; WBW: Else increase error limit - STA ERRCT ; WBW: Save error new limit -;WBW END +; [WBW] BEGIN: Be more patient waiting for host to start sending file + LDA FRSTIM ; Get first time flag + ORA A ; Set CPU flags + JNZ RCVRPT ; If not first time, bypass + MVI A,-10 ; Else increase error limit + STA ERRCT ; Save error new limit +; [WBW] END ; RCVRPT: IF CONFUN ; Check for function key? CALL FUNCHK ; Yeah, why not? @@ -2233,7 +2249,7 @@ RCVRPT: IF CONFUN ; Check for function key? ENDIF ; ;MVI B,10-1 ; 10-second timeout - MVI B,5-1 ; WBW: 5-second timeout + MVI B,5-1 ; [WBW] 5-second timeout CALL RECV ; Get any character received JC RCVSTOT ; Timeout ; @@ -2259,7 +2275,7 @@ RCVRPTB:CPI SOH ; 'SOH' for a 128-byte block? RCVSERR:MVI B,1 ; Wait for 1 second CALL RECV ; After last char. received JNC RCVSERR ; Loop until sender done - LDA FRSTIM ; Is it the first time? +RCVSER1:LDA FRSTIM ; Is it the first time? ORA A MVI A,NAK JNZ RCVSER2 ; If not first time, send NAK @@ -2320,7 +2336,9 @@ DELFILE:LXI D,FCB ; Point to file ; ; Timed out on receive ; -RCVSTOT:JMP RCVSERR ; Bump error count, etc. +;RCVSTOT:JMP RCVSERR ; Bump error count, etc. +; [WBW] Bypass line flush if error is timeout +RCVSTOT:JMP RCVSER1 ; Bump error count, etc. ; ; Got SOH or STX - get block number, block number complemented ; @@ -3457,9 +3475,18 @@ RSDMA: LXI D,TBUF ; Reset DMA address WRERR: CALL RSDMA ; Reset DMA to normal MVI C,CAN ; Cancel CALL SEND ; Sender +; [WBW] BEGIN: RCVSABT does not return, so file write error +; message was never being displayed. Swapped things around +; to fix this. +; CALL RCVSABT ; Kill receive file +; CALL ERXIT ; Exit with msg: +; DB '++ Error writing file ++$' +; [WBW] ----- + CALL ILPRT ; Dispaly error msg + DB CR,LF,'++ Error writing file ++',CR,LF,0 CALL RCVSABT ; Kill receive file - CALL ERXIT ; Exit with msg: - DB '++ Error writing file ++$' +; [WBW] END + ; ; Receive a character - timeout time is in 'B' in seconds. Entry via ; 'RECVDG' deletes garbage characters on the line. For example, having @@ -3470,11 +3497,17 @@ RECVDG: CALL GETCHR CALL GETCHR ; RECV: PUSH D ; Save 'DE' regs. -;WBW BEGIN: Use dynamic CPU speed +; +; [WBW] BEGIN: Check immediately for char pending to avoid delay + CALL RCVRDY ; Input from modem ready + JZ MCHAR ; Got the character +; [WBW] END +; +; [WBW] BEGIN: Use dynamic CPU speed ; MVI E,MHZ ; Get the clock speed LDA CPUMHZ ; Get the clock speed MOV E,A ; Put speed in E -;WBW END +; [WBW] END XRA A ; Clear the 'A' reg. ; MSLOOP: ADD B ; Number of seconds @@ -3483,12 +3516,12 @@ MSLOOP: ADD B ; Number of seconds MOV B,A ; Put total value back into 'B' ; MSEC: IF NOT BYEBDOS -;WBW BEGIN: Use scalar passed in by patch +; [WBW] BEGIN: Use scalar passed in by patch ;LXI D,6600 ; 1 second DCR count XCHG LHLD RCVSCL ; Use scalar value from patch XCHG -;WBW END +; [WBW] END ENDIF ; IF BYEBDOS @@ -3567,7 +3600,7 @@ CARCK2: LDA OPTSAV ; Get option ; Delay - 100 millisecond delay. ; DELAY: PUSH B ; Save 'BC' -; WBW BEGIN: Use dynamic CPU speed +; [WBW] BEGIN: Use dynamic CPU speed ; Loop below is 105TS on Z80 and 96TS on Z180 ; Approx 1024 iter per 100ms per MHz ; Loop time below extended to accommodate CPU speeds up to 64MHz @@ -3578,7 +3611,7 @@ DELAY: PUSH B ; Save 'BC' RLC ; * 2, A now has MHz * 4 MOV B,A ; Use as high byte MVI C,0 ; Zero low byte, BC now has MHz * 1024 -; WBW END +; [WBW] END DELAY2: DCX B ; Update count MOV A,B ; Get MSP byte ORA C ; Count = zero? @@ -3967,7 +4000,7 @@ INPUT: PUSH H ; Save current values PUSH D PUSH B ; -; WBW BEGIN: Use dynamic CPU speed +; [WBW] BEGIN: Use dynamic CPU speed ;INPUT1: LXI D,1200 ; Outer loop count (about 2 minutes) ;; ;INPUT2: LXI B,MHZ*100 ; Roughly 100 ms. @@ -3976,7 +4009,7 @@ INPUT1: LXI D,468 ; Outer loop count (about 2 minutes) INPUT2: LDA CPUMHZ ; CPU MHz to A MOV B,A ; Put in B MVI C,0 ; Zero C, BC is now CPU MHz * 256, ~256ms -; WBW END +; [WBW] END ; INPUT3: PUSH D ; Save the outer delay count PUSH B ; Save the inner delay count @@ -5655,8 +5688,9 @@ MSGFLG: DB 0 ; Message upload flag SAVEHL: DW 0 ; Saves TBUF command line address TOTERR: DW 0 ; Total errors for transmission attempt VRECNO: DW 0 ; Virtual record # in 128 byte records -CPUMHZ: DB MHZ ; WBW: CPU speed in MHz -RCVSCL: DW SCL ; WBW: Recv loop scalar +CPUMHZ: DB MHZ ; [WBW] CPU speed in MHz +RCVSCL: DW SCL ; [WBW] Recv loop scalar +PORT: DB 0FFH ; [WBW] Target serial port, FFH=not specified ; EOFLG: DB 0 ; 'EOF' flag (1=yes) EOFCTR: DB 0 ; EOF send counter @@ -5685,7 +5719,8 @@ OLINE: DS 80 ; Temporary buffer to store line ORG ($+127)/128*128 ; DBUF EQU $ ; 16-record disk buffer -STACK EQU DBUF-2 ; Save original stack address +;STACK EQU DBUF-2 ; Save original stack address +STACK EQU 0B000H ; [WBW] Above 8000h for HBIOS Fastpath LOGBUF EQU DBUF+128 ; For use with LOGCAL ; ;----------------------------------------------------------------------- diff --git a/Source/Apps/XM/xmhb.180 b/Source/Apps/XM/xmhb.180 deleted file mode 100644 index 8f926794..00000000 --- a/Source/Apps/XM/xmhb.180 +++ /dev/null @@ -1,920 +0,0 @@ -;======================================================================= -; -; XMHB.Z80 - XMODEM12 PATCH FILE FOR ROMWBW HBIOS -; -; Wayne Warthen - wwarthen@gmail.com -; -; 2018-06-06 WBW Added support for RC2014 w/ Z180 -; 2019-08-17 WBW Refactored and merged Phil's ECB-FIFO support -; 2019-08-28 WBW Refactored ASCI support -; -;======================================================================= -; - ASEG -; -NO EQU 0 -YES EQU NOT NO -; -ERRDET EQU NO ; detect parity/framing/overrun errs -; -BASE EQU 100H ; start of cp/m normal program area -; -BDOS EQU 00005H ; BDOS function dispatch vector -; -;======================================================================= -; -; Jump table: The jump table must be in exactly the same sequence as the -; one in XMODEM. Note the ORG of 103H - This jump table has no jump to -; 'BEGIN'. -; - ORG BASE + 3 ; start after 'JMP BEGIN' -; - JP CONOUT ; must be 00000h if not used, see below - JP MINIT ; initialization routine (if needed) - JP UNINIT ; undo whatever 'MINIT' did (or return) -JPTBL: - JP SENDR ; send character (via pop psw) - JP CAROK ; test for carrier - JP MDIN ; receive data byte - JP GETCHR ; get character from modem - JP RCVRDY ; check receive ready - JP SNDRDY ; check send ready - JP SPEED ; get speed value for file transfer time - JP EXTRA1 ; extra for custom routine - JP EXTRA2 ; extra for custom routine - JP EXTRA3 ; extra for custom routine -; -;----------------------------------------------------------------------- -; -; Output character to console -; -CONOUT EQU 0 ; not used -; -;----------------------------------------------------------------------- -; -; Initialize modem -; -; This procedure has been usurped to dynamically detect the type -; of system we are running on and install the *real* jump table -; entries as appropriate. -; -MINIT: - ; Announce - LD DE,RBC ; RetroBrew Computers - LD C,9 ; BDOS string display function - CALL BDOS ; Do it -; - ; Identify BIOS (RomWBW HBIOS or UNA UBIOS) - CALL IDBIO ; 1=HBIOS, 2=UBIOS - LD (BIOID),A ; Save it - DEC A ; Test for HBIOS - JR Z,HINIT ; Do HBIOS setup - DEC A ; Test for UBIOS - JR Z,UINIT ; Do UBIOS setup -; - ; Neither UNA nor RomWBW - LD DE,ERR_BIO ; BIOS error message - LD C,9 ; BDOS string display function - CALL BDOS ; Do it - JP 0 ; Bail out! -; -MINIT_RET: - PUSH HL ; Save HL (JP table adr) - - ; Display port notification string - LD C,9 ; BDOS string display function - CALL BDOS ; Do it -; - ; Newline - LD C,9 ; BDOS string display function - LD DE,CRLF ; Newline - CALL BDOS ; Do it -; - ; Copy real vectors into active jump table - POP HL ; Recover HL - LD DE,JPTBL ; Real jump table is destination - LD BC,7 * 3 ; Copy 7 3-byte entries - LDIR ; Do the copy -; - ; Return with CPU speed in A - LD A,(CPUSPD) ; A := CPU speed in MHz - LD HL,(RCVSCL) ; HL := receive scalar - RET ; and return -; -HINIT: - ; Display RomWBW notification string - LD DE,HBTAG ; BIOS notification string - LD C,9 ; BDOS string display function - CALL BDOS ; Do it -; - ; Get CPU speed from RomWBW HBIOS and save it - LD B,0F8H ; HBIOS SYSGET function 0xF8 - LD C,0F0H ; CPUINFO subfunction 0xF0 - RST 08 ; Do it, L := CPU speed in MHz - LD A,L ; Move it to A - LD (CPUSPD),A ; Save it -; - ; Get HBIOS character 0 device type - LD B,006H ; HBIOS DEVICE function 0x06 - LD C,000H ; HBIOS char 0 device - RST 08 ; Do it, D=device type - LD A,D ; Put result in A - CP 000H ; UART? - JP Z,U_INIT ; If so, do UART init - CP 010H ; ASCI? - JP Z,A_INIT ; If so, do ASCI init - CP 080H ; USB-FIFO? - JP Z,UF_INIT ; If so, do USB-FIFO init - JP H_INIT ; Otherwise, use HBIOS I/O -; -UINIT: - ; Display UNA notification string - LD DE,UBTAG ; BIOS notification string - LD C,9 ; BDOS string display function - CALL BDOS ; Do it -; - ; Get CPU speed from UNA and save it - LD C,0F8H ; UNA BIOS Get PHI function - RST 08 ; Returns speed in Hz in DE:HL - LD B,4 ; Divide MHz in DE:HL by 100000H -UINIT1: - SRL D ; ... to get approx CPU speed in - RR E ; ...MHz. Throw away HL, and - DJNZ UINIT1 ; ...right shift DE by 4. - INC E ; Fix up for value truncation - LD A,E ; Put in A - LD (CPUSPD),A ; Save it -; - ; Check CPU, Z80=UART, Z180=ASCI - LD DE,00202H ; D := 2, E := 2 - MLT DE ; DE := D * E == 4 - BIT 2,E ; Bit 2 wil be set if mlt happend - JP Z,U_INIT ; UART initialization - JP A_INIT ; otherwise, ASCI -; -HWERR: - ; Failed to identify target comm hardware - LD DE,ERR_HW ; Hardware error message - LD C,9 ; BDOS string display function - CALL BDOS ; Do it - JP 0 ; Bail out! -; -; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 -; -IDBIO: -; - ; Check for UNA (UBIOS) - LD A,(0FFFDH) ; fixed location of UNA API vector - CP 0C3H ; jp instruction? - JR NZ,IDBIO1 ; if not, not UNA - LD HL,(0FFFEH) ; get jp address - LD A,(HL) ; get byte at target address - CP 0FDH ; first byte of UNA push ix instruction - JR NZ,IDBIO1 ; if not, not UNA - INC HL ; point to next byte - LD A,(HL) ; get next byte - CP 0E5H ; second byte of UNA push ix instruction - JR NZ,IDBIO1 ; if not, not UNA, check others - LD A,2 ; UNA BIOS id = 2 - RET ; and done -; -IDBIO1: - ; Check for RomWBW (HBIOS) - LD HL,(0FFFEH) ; HL := HBIOS ident location - LD A,'W' ; First byte of ident - CP (HL) ; Compare - JR NZ,IDBIO2 ; Not HBIOS - INC HL ; Next byte of ident - LD A,~'W' ; Second byte of ident - CP (HL) ; Compare - JR NZ,IDBIO2 ; Not HBIOS - LD A,1 ; HBIOS BIOS id = 1 - RET ; and done -; -IDBIO2: - ; No idea what this is - XOR A ; Setup return value of 0 - RET ; and done -; -;----------------------------------------------------------------------- -; -; Uninitialize modem -; -UNINIT: - LD A,(BIOID) - CP 1 ; Is HBIOS? - JR Z,H_UNINIT ; Handle HBIOS - CP 2 ; Is UBIOS? - JR Z,U_UNINIT ; Handle UBIOS - RET ; Just return -; -H_UNINIT: - ; HBIOS: Reset character device 0 - LD B,04H ; HBIOS CIOINIT function 0x04 - LD C,0 ; Unit = 0 - LD DE,-1 ; Reset w/ current settings - RST 08 ; Do it - RET ; not initialized, so no 'UN-INITIALIZE' -; -U_UNINIT: - ; UBIOS: Reset character device 0 - LD C,10H ; UNA INIT function 0x10 - LD B,0 ; Unit = 0 - LD DE,-1 ; Reset w/ current settings - RST 08 ; Do it - RET ; not initialized, so no 'UN-INITIALIZE' -; -;----------------------------------------------------------------------- -; -; The following are all dummy routines that are unused because MINIT -; dynamically installs the real jump table. -; -SENDR: -CAROK: -MDIN: -GETCHR: -RCVRDY: -SNDRDY: -SPEED: -EXTRA1: -EXTRA2: -EXTRA3: - RET -; -BIOID DB 0 ; BIOS ID, 1=HBIOS, 2=UBIOS -CPUSPD DB 10 ; CPU speed in MHz -RCVSCL DW 6600 ; RECV loop timeout scalar -; -RBC DB "RBC, 28-Aug-2019$" -; -U_LBL DB ", UART$" -A_LBL DB ", ASCI$" -S_LBL DB ", SIO$" -H_LBL DB ", COM$" -UF_LBL DB ", USB-FIFO$" -; -UBTAG DB " [UNA]$" -HBTAG DB " [WBW]$" -; -CRLF DB 13, 10, "$" -; -ERR_BIO DB 13, 10, 13, 10, "++ Unknown BIOS ++", 13, 10, "$" -ERR_HW DB 13, 10, 13, 10, "++ Unknown Hardware ++", 13, 10, "$" -; -;======================================================================= -;======================================================================= -; -; 8250-like UART @ Port 68H -; -;======================================================================= -;======================================================================= -; -; UART port constants -; -U_BASE EQU 68H ; UART base port -U_DATP EQU U_BASE + 0 ; data in port -U_DATO EQU U_BASE + 0 ; data out port -U_CTLP EQU U_BASE + 5 ; control/status port -U_SNDB EQU 20H ; bit to test for send ready -U_SNDR EQU 20H ; value when ready to send -U_RCVB EQU 01H ; bit to test for receive ready -U_RCVR EQU 01H ; value when ready to receive -U_PARE EQU 04H ; bit for parity error -U_OVRE EQU 02H ; bit for overrun error -U_FRME EQU 08H ; bit for framing error -U_ERRS EQU U_FRME | U_OVRE | U_PARE -; -; Following jump table is dynamically patched into real jump -; table at program startup. See MINIT above. Note that only a -; subset of the jump table is overlaid (SENDR to SPEED). -; -U_JPTBL: - JP U_SENDR ; send character (via pop psw) - JP U_CAROK ; test for carrier - JP U_MDIN ; receive data byte - JP U_GETCHR ; get character from modem - JP U_RCVRDY ; check receive ready - JP U_SNDRDY ; check send ready - JP U_SPEED ; get speed value for file transfer time -; -;----------------------------------------------------------------------- -; -; UART initialization -; -U_INIT: - LD HL,13000 ; Receive loop timeout scalar - LD (RCVSCL),HL ; ... for UART RCVRDY timing -; - LD HL,U_JPTBL - LD DE,U_LBL - JP MINIT_RET -; -;----------------------------------------------------------------------- -; -; Send character on top of stack -; -U_SENDR: - POP AF ; get character to send from stack - OUT (U_DATO),A ; send to port - RET -; -;----------------------------------------------------------------------- -; -; Test and report carrier status, Z set if carrier present -; -U_CAROK: - XOR A ; not used, always indicate present - RET -; -;----------------------------------------------------------------------- -; -; Get a character (assume character ready has already been tested) -; -U_MDIN: -U_GETCHR: - IN A,(U_DATP) ; read character from port - RET -; -;----------------------------------------------------------------------- -; -; Test for character ready to receive, Z = ready -; Error code returned in A register -; *** Error code does not seem to be used *** -; -U_RCVRDY: - IN A,(U_CTLP) ; get modem status -; - IF ERRDET -; - ; With error detection (slower) - PUSH BC ; save scratch register - PUSH AF ; save full status on stack - AND U_ERRS ; isolate line err bits - LD B,A ; save err status in B - POP AF ; get full status back - AND U_RCVB ; isolate ready bit - CP U_RCVR ; test it (set flags) - LD A,B ; get the error code back - POP BC ; restore scratch register -; - ELSE -; - ; No error detection (faster) - AND U_RCVB ; isolate ready bit - CP U_RCVR ; test it (set flags) - LD A,0 ; report no line errors -; - ENDIF -; - RET -; -;----------------------------------------------------------------------- -; -; Test for ready to send a character, Z = ready -; -U_SNDRDY: - IN A,(U_CTLP) ; get status - AND U_SNDB ; isolate transmit ready bit - CP U_SNDR ; test for ready value - RET -; -;----------------------------------------------------------------------- -; -; Report baud rate (index into SPTBL returned in register A) -; -U_SPEED: - LD A,8 ; arbitrarily return 9600 baud - RET -; -;======================================================================= -;======================================================================= -; -; Z180 Primary ASCI -; -; - Port is determined dynamically in A_INIT -; -;======================================================================= -;======================================================================= -; -; ASCI port constants -; -A_DATP EQU 08H ; Z180 TSR - ASCI receive data port -A_DATO EQU 06H ; Z180 TDR - ASCI transmit data port -A_CTLP EQU 04H ; Z180 STAT - ASCI status port -A_CTL2 EQU 00H ; Z180 CNTLA - ASCI control port -; -A_SNDB EQU 02H ; Z180 STAT:TDRE - xmit data reg empty bit -A_SNDR EQU 02H ; Z180 STAT:TDRE - xmit data reg empty value -A_RCVB EQU 80H ; Z180 STAT:RDRF - rcv data reg full bit -A_RCVR EQU 80H ; Z180 STAT:RDRF - rcv data reg full value -A_PARE EQU 20H ; Z180 STAT:PE - parity error bit -A_OVRE EQU 40H ; Z180 STAT:OVRN - overrun error bit -A_FRME EQU 10H ; Z180 STAT:FE - framing error bit -A_ERRS EQU A_FRME | A_OVRE | A_PARE -; -A_BASE DB 00H ; internal IO base address for Z180 -; -; Following jump table is dynamically patched over initial jump -; table at program startup. See MINIT above. Note that only a -; subset of the jump table is overlaid (SENDR to SPEED). -; -A_JPTBL: - JP A_SENDR ; send character (via pop psw) - JP A_CAROK ; test for carrier - JP A_MDIN ; receive data byte - JP A_GETCHR ; get character from modem - JP A_RCVRDY ; check receive ready - JP A_SNDRDY ; check send ready - JP A_SPEED ; get speed value for file transfer time -; -;----------------------------------------------------------------------- -; -; ASCI initialization -; -A_INIT: - LD HL,7500 ; Receive loop timeout scalar - LD (RCVSCL),HL ; ... for ASCI RCVRDY timing -; - ; Test for location of Z180 internal registers - ; and use appropriate I/O address. - LD B,0 ; set MSB for 16 bit I/O - LD C,040H|3FH ; internal registers @ 40H? - IN A,(C) ; read - CP 040H|01FH ; same value except for bit 5? - JR Z,A_INIT1 ; do ASCI init (port in C) - LD C,0C0H|3FH ; internal registers @ C0H? - IN A,(C) ; read - CP 0C0H|1FH ; same value except for bit 5? - JR Z,A_INIT1 ; do ASCI init (port in C) - JP HWERR ; unknown hardware error -; -A_INIT1: - LD A,C ; test port value to A - AND 0C0H ; only top two bits relevant - LD (A_BASE),A ; save it - ADD A,A_CTLP ; status port offset - LD C,A ; put in C for I/O - LD B,0 ; MSB for 16 bit I/O - XOR A ; clear interrupt enable flags - OUT (C),A ; do it -; - LD HL,A_JPTBL - LD DE,A_LBL - JP MINIT_RET -; -;----------------------------------------------------------------------- -; -; Send character on top of stack -; -A_SENDR: - EX (SP),HL ; save HL, HL := char to send - PUSH BC ; save scratch register - LD A,(A_BASE) ; IO base address - ADD A,A_DATO ; data out port offset - LD C,A ; put in C for I/O - LD B,0 ; MSB for 16 bit I/O - OUT (C),H ; send to port - POP BC ; restore scratch reg - POP HL ; restore HL - RET ; done -; -;----------------------------------------------------------------------- -; -; Test and report carrier status, Z set if carrier present -; -A_CAROK: - XOR A ; not used, always indicate present - RET -; -;----------------------------------------------------------------------- -; -; Get a character (assume character ready has already been tested) -; -A_MDIN: -A_GETCHR: - PUSH BC ; save scratch register - LD A,(A_BASE) ; IO base address - ADD A,A_DATP ; data in port offset - LD C,A ; put in C for I/O - LD B,0 ; MSB for 16 bit I/O - IN A,(C) ; read character from port - POP BC ; restore scratch reg - RET -; -;----------------------------------------------------------------------- -; -; Test for character ready to receive, Z = ready -; Error code returned in A register -; *** Error code does not seem to be used *** -; -A_RCVRDY: - PUSH BC ; save scratch register - LD A,(A_BASE) ; IO base address - ADD A,A_CTLP ; status port offset - LD C,A ; put in C for I/O - LD B,0 ; MSB for 16 bit I/O - IN A,(C) ; get modem status - PUSH AF ; save full status on stack - AND A_ERRS ; isolate line err bits - LD B,A ; save err status in B - - ; Z180 ASCI ports will stall if there are errors. - ; Error bits are NOT cleared by merely reading - ; the status register. Below, bit 3 of ASCI - ; control register is written with a zero to - ; clear error(s) if needed. - JR Z,A_RCVRDY2 ; if no errs, continue - PUSH BC ; save scratch reg - LD A,(A_BASE) ; IO base address - ADD A,A_CTL2 ; status port offset - LD C,A ; put in C for I/O - LD B,0 ; MSB for 16 bit I/O - IN A,(C) ; get current control reg value - AND 0F7H ; force err reset bit to zero - OUT (C),A ; write control register - POP BC ; restore scratch reg -; -A_RCVRDY2: - POP AF ; get full status back - AND A_RCVB ; isolate ready bit - CP A_RCVR ; test it (set flags) - LD A,B ; get the error code back - POP BC ; restore scratch register - RET -; -;----------------------------------------------------------------------- -; -; Test for ready to send a character, Z = ready -; -A_SNDRDY: - PUSH BC ; save scratch register - LD A,(A_BASE) ; IO base address - ADD A,A_CTLP ; status port offset - LD C,A ; put in C for I/O - LD B,0 ; MSB for 16 bit I/O - IN A,(C) ; get modem status - AND A_SNDB ; isolate transmit ready bit - CP A_SNDR ; test for ready value - POP BC ; restore scratch register - RET -; -;----------------------------------------------------------------------- -; -; Report baud rate (index into SPTBL returned in register A) -; -A_SPEED: - LD A,8 ; arbitrarily return 9600 baud - RET -; -;======================================================================= -;======================================================================= -; -; Zilog SIO @ Port 80H -; -;======================================================================= -;======================================================================= -; -; Currently assumes the port address and ordering conventions of the -; official RC2014 SIO module. Will not work with others such as EZZ80 -; or ZP. -; -; SIO port constants -; -S_BASE EQU 80H ; SIO base port -S_DATP EQU S_BASE + 1 ; data in port -S_DATO EQU S_BASE + 1 ; data out port -S_CTLP EQU S_BASE + 0 ; control/status port -S_SNDB EQU 04H ; bit to test for send ready -S_SNDR EQU 04H ; value when ready to send -S_RCVB EQU 01H ; bit to test for receive ready -S_RCVR EQU 01H ; value when ready to receive -; -; Following jump table is dynamically patched into real jump -; table at program startup. See MINIT above. Note that only a -; subset of the jump table is overlaid (SENDR to SPEED). -; -S_JPTBL: - JP S_SENDR ; send character (via pop psw) - JP S_CAROK ; test for carrier - JP S_MDIN ; receive data byte - JP S_GETCHR ; get character from modem - JP S_RCVRDY ; check receive ready - JP S_SNDRDY ; check send ready - JP S_SPEED ; get speed value for file transfer time -; -;----------------------------------------------------------------------- -; -; SIO initialization -; -S_INIT: - LD HL,12000 ; Receive loop timeout scalar - LD (RCVSCL),HL ; ... for UART RCVRDY timing -; - ; Suppress interrupts - LD A,01H ; WR1 - OUT (S_CTLP),A ; Select WR1 - XOR A ; No interrupts - OUT (S_CTLP),A ; Do it -; - LD HL,S_JPTBL - LD DE,S_LBL - JP MINIT_RET -; -;----------------------------------------------------------------------- -; -; Send character on top of stack -; -S_SENDR: - POP AF ; get character to send from stack - OUT (S_DATO),A ; send to port - RET -; -;----------------------------------------------------------------------- -; -; Test and report carrier status, Z set if carrier present -; -S_CAROK: - XOR A ; not used, always indicate present - RET -; -;----------------------------------------------------------------------- -; -; Get a character (assume character ready has already been tested) -; -S_MDIN: -S_GETCHR: - IN A,(S_DATP) ; read character from port - RET -; -;----------------------------------------------------------------------- -; -; Test for character ready to receive, Z = ready -; Error code returned in A register -; *** Error code does not seem to be used *** -; -S_RCVRDY: - ;XOR A - ;OUT (S_CTLP),A ; select WR0 - IN A,(S_CTLP) ; get status - AND S_RCVB ; isolate ready bit - CP S_RCVR ; test it (set flags) - LD A,0 ; report no line errors - RET -; -;----------------------------------------------------------------------- -; -; Test for ready to send a character, Z = ready -; -S_SNDRDY: - ;XOR A - ;OUT (S_CTLP),A ; select WR0 - IN A,(S_CTLP) ; get status - AND S_SNDB ; isolate ready bit - CP S_SNDR ; test it (set flags) - LD A,0 ; report no line errors - RET -; -;----------------------------------------------------------------------- -; -; Report baud rate (index into SPTBL returned in register A) -; -S_SPEED: - LD A,8 ; arbitrarily return 9600 baud - RET -; -;======================================================================= -;======================================================================= -; -; HBIOS Console (COM0:) -; -;======================================================================= -;======================================================================= -; -; Following jump table is dynamically patched over initial jump -; table at program startup. See MINIT above. Note that only a -; subset of the jump table is overlaid (SENDR to SPEED). -; -H_JPTBL: - JP H_SENDR ; send character (via pop psw) - JP H_CAROK ; test for carrier - JP H_MDIN ; receive data byte - JP H_GETCHR ; get character from modem - JP H_RCVRDY ; check receive ready - JP H_SNDRDY ; check send ready - JP H_SPEED ; get speed value for file transfer time -; -;----------------------------------------------------------------------- -; -; HBIOS initialization -; -H_INIT: - LD HL,1250 ; Smaller receive loop timeout scalar - LD (RCVSCL),HL ; ... to compensate for BIOS overhead -; - LD HL,H_JPTBL - LD DE,H_LBL - JP MINIT_RET -; -;----------------------------------------------------------------------- -; -; Send character on top of stack -; -H_SENDR: - POP AF ; get character to send from stack - PUSH BC - PUSH DE - PUSH HL - LD B,01H ; HBIOS OUT function - LD C,0 ; console is unit 0 by fiat - LD E,A ; character to E - RST 08 ; HBIOS call - POP HL - POP DE - POP BC - RET -; -;----------------------------------------------------------------------- -; -; Test and report carrier status, Z set if carrier present -; -H_CAROK: - XOR A ; not used, always indicate present - RET -; -;----------------------------------------------------------------------- -; -; Get a character (assume character ready has already been tested) -; -; This routine must NOT block. -; -H_MDIN: -H_GETCHR: - PUSH BC - PUSH DE - PUSH HL - LD B,02H ; HBIOS IST function - LD C,0 ; console is unit 0 by fiat - RST 08 ; HBIOS call, A := bytes pending - JR NZ,H_MDIN1 ; If char(s) waiting, go get it - XOR A ; otherwise, return null - JR H_MDIN2 ; and done -H_MDIN1: - LD B,00H ; HBIOS IN function - LD C,0 ; console is unit 0 by fiat - RST 08 ; HBIOS call - LD A,E ; byte received to A -H_MDIN2: - POP HL - POP DE - POP BC - RET -; -;----------------------------------------------------------------------- -; -; Test for character ready to receive, Z = ready -; Error code returned in A register -; *** Error code does not seem to be used *** -; -H_RCVRDY: - PUSH BC - PUSH DE - PUSH HL - LD B,02H ; HBIOS IST function - LD C,0 ; console is unit 0 by fiat - RST 08 ; HBIOS call, A := bytes pending - SUB 1 ; CF set IFF zero - RL A ; CF to bit 0 of A - AND 01H ; set Z flag as needed - LD A,0 ; report no line errors - POP HL - POP DE - POP BC - RET -; -;----------------------------------------------------------------------- -; -; Test for ready to send a character, Z = ready -; -H_SNDRDY: - PUSH BC - PUSH DE - PUSH HL - LD B,03H ; HBIOS OST function - LD C,0 ; console is unit 0 by fiat - RST 08 ; HBIOS call, A := xmit buf bytes avail - SUB 1 ; CF set IFF zero - RL A ; CF to bit 0 of A - AND 01H ; set Z flag as needed - POP HL - POP DE - POP BC - RET -; -;----------------------------------------------------------------------- -; -; Report baud rate (index into SPTBL returned in register A) -; -H_SPEED: - LD A,8 ; arbitrarily return 9600 baud - RET -; -; -;======================================================================= -;======================================================================= -; -; WILL SOWERBUTTS ECB USB-FIFO -; -;======================================================================= -;======================================================================= -; -UF_BASE EQU 0CH -UF_DATA EQU (UF_BASE+0) -UF_STATUS EQU (UF_BASE+1) -UF_SEND_IMM EQU (UF_BASE+2) -; -; Following jump table is dynamically patched over initial jump -; table at program startup. See MINIT above. Note that only a -; subset of the jump table is overlaid (SENDR to SPEED). -; -UF_JPTBL: - JP UF_SENDR ; send character (via pop psw) - JP UF_CAROK ; test for carrier - JP UF_MDIN ; receive data byte - JP UF_GETCHR ; get character from modem - JP UF_RCVRDY ; check receive ready - JP UF_SNDRDY ; check send ready - JP UF_SPEED ; get speed value for file transfer time -; -;----------------------------------------------------------------------- -; -; USB-FIFO initialization -; -UF_INIT: - LD HL,12000 ; Receive loop timeout scalar - LD (RCVSCL),HL ; ... for UART RCVRDY timing -; - LD HL,UF_JPTBL - LD DE,UF_LBL - JP MINIT_RET -; -;----------------------------------------------------------------------- -; -; Send character on top of stack -; -UF_SENDR: - - POP AF ; get character to send from stack - OUT (UF_DATA),A ; WRITE TO FIFO - OUT (UF_SEND_IMM),A ; SEND IMMEDIATE - RET -; -;----------------------------------------------------------------------- -; -; Test and report carrier status, Z set if carrier present -; -UF_CAROK: - XOR A ; not used, always indicate present - RET -; -;----------------------------------------------------------------------- -; -; Get a character (assume character ready has already been tested) -; -; This routine must NOT block. -; -UF_MDIN: -UF_GETCHR: - IN A,(UF_DATA) ; GET CHAR - RET -; -;----------------------------------------------------------------------- -; -; Test for character ready to receive, Z = ready -; Error code returned in A register -; *** Error code does not seem to be used *** -; -UF_RCVRDY: - IN A,(UF_STATUS) ; B7=0 IF CHAR AVAIL, =1 IF NO CHAR. - RLCA ; B0=0 IF CHAR AVAIL, =1 IF NO CHAR. - AND 00000001B ; A=0, ZF=1 IF NO CHAR, A=1, ZF=0 IF CHAR AVAIL, - LD A,0 - RET -; -;----------------------------------------------------------------------- -; -; Test for ready to send a character, Z = ready -; -UF_SNDRDY: - IN A,(UF_STATUS) ; Bit 0=0 IF SPACE AVAIL, =1 IF FULL - AND 00000001B ; A=0, ZF=1 IF SPACE AVAIL, A=1, ZF=0 IF FULL. - RET -; -;----------------------------------------------------------------------- -; -; Report baud rate (index into SPTBL returned in register A) -; -UF_SPEED: - LD A,8 ; arbitrarily return 9600 baud - RET -; - END diff --git a/Source/Apps/XM/xmhb.z80 b/Source/Apps/XM/xmhb.z80 new file mode 100644 index 00000000..54b415c3 --- /dev/null +++ b/Source/Apps/XM/xmhb.z80 @@ -0,0 +1,873 @@ +;======================================================================= +; +; XMHB.Z80 - XMODEM12 PATCH FILE FOR ROMWBW HBIOS +; +; Wayne Warthen - wwarthen@gmail.com +; +; 2020-05-23 WBW Rewrite for HBIOS FastPath(tm) +; +;======================================================================= +; + ASEG +; +BASE EQU 100H ; Start of CP/M normal program area +; +BDOS EQU 0005H ; BDOS function dispatch vector +; +;======================================================================= +; +; Jump table: The jump table must be in exactly the same sequence as the +; one in XMODEM. Note the ORG of 103H - This jump table has no jump to +; 'BEGIN'. +; + ORG BASE + 3 ; start after 'JMP BEGIN' +; + JP CONOUT ; must be 00000h if not used, see below + JP MINIT ; initialization routine (if needed) + JP UNINIT ; undo whatever 'MINIT' did (or return) +JPTBL: + JP SENDR ; send character (via pop psw) + JP CAROK ; test for carrier + JP MDIN ; receive data byte + JP GETCHR ; get character from modem + JP RCVRDY ; check receive ready + JP SNDRDY ; check send ready + JP SPEED ; get speed value for file transfer time + JP EXTRA1 ; extra for custom routine + JP EXTRA2 ; extra for custom routine + JP EXTRA3 ; extra for custom routine +; +;----------------------------------------------------------------------- +; +; Output character to console +; +CONOUT EQU 0 ; not used +; +;----------------------------------------------------------------------- +; +; Initialize modem +; +; This procedure has been usurped to dynamically detect the type +; of system we are running on and install the *real* jump table +; entries as appropriate. +; +MINIT: + LD (UNIT),A ; Save port specified + + ; Announce + LD DE,TAG ; Tagline + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Identify BIOS (RomWBW HBIOS or UNA UBIOS) + CALL IDBIO ; 1=HBIOS, 2=UBIOS + LD (BIOID),A ; Save it + DEC A ; Test for HBIOS + JR Z,MINIT_HB ; Do HBIOS setup + DEC A ; Test for UBIOS + JR Z,MINIT_UB ; Do UBIOS setup +; + ; Neither UNA nor RomWBW + LD DE,ERR_BIO ; BIOS error message + JP FAIL ; Print msg and bail out +; +MINIT_HB: + ; Display RomWBW notification string + LD DE,HB_TAG ; BIOS notification string + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Get CPU speed from RomWBW HBIOS and save it + LD B,0F8H ; HBIOS SYSGET function 0xF8 + LD C,0F0H ; CPUINFO subfunction 0xF0 + RST 08 ; Do it, L := CPU speed in MHz + LD A,L ; Move it to A + LD (CPUSPD),A ; Save it +; + ; Get HBIOS bank id + LD BC,0F8F2H ; HBIOS SYSGET, Bank Info + RST 08 ; do it + JP NZ,APIERR ; handle API error + LD A,D ; BIOS bank id to A + LD (BIOSBID),A ; save it +; + LD A,(UNIT) ; get current unit specified + CP 0FFH ; check for undefined + JR NZ,MINIT_HB1 ; if not undefined, go ahead +; + ; Lookup current console to use as default for transfer + LD B,0FAH ; HBIOS PEEK + LD A,(BIOSBID) ; get BIOS bank id + LD D,A ; ... and put in D + LD HL,100H + 12H ; HCB console unit address + RST 08 ; E := value + LD A,E ; put in A + LD (UNIT),A ; replace UNIT with console UNIT +; +MINIT_HB1: + ; Get HBIOS device type + LD B,06H ; HBIOS DEVICE function 0x06 + LD A,(UNIT) ; Get xfer unit + LD C,A ; Put in C + RST 08 ; Do it, D=device type + LD A,D ; Put result in A + CP 00H ; UART? + JP Z,MINIT_HB2 ; If so, do UART H/W init + CP 80H ; USB-FIFO? + JP Z,UF_INIT ; If so, do USB-FIFO H/W init + JP HB_INIT ; Otherwise, use BIOS I/O +; +MINIT_HB2: + ; Handle UART driver special. If receive interrupts active, + ; we must use BIOS I/O. Otherwise, direct UART I/O is best + LD B,06H ; Serial device function + LD A,(UNIT) ; Get xfer unit + LD C,A ; Put in C + RST 08 ; Do it, H = UART TYPE + BIT 7,H ; Check for interrupt driven receive + JP Z,UA_INIT ; If not, do direct UART I/O + JP HB_INIT ; else use BIOS I/O +; +MINIT_UB: + ; Display UNA notification string + LD DE,UB_TAG ; BIOS notification string + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Get CPU speed from UNA and save it + LD C,0F8H ; UNA BIOS Get PHI function + RST 08 ; Returns speed in Hz in DE:HL + LD B,4 ; Divide MHz in DE:HL by 100000H +MINIT_UB1: + SRL D ; ... to get approx CPU speed in + RR E ; ...MHz. Throw away HL, and + DJNZ MINIT_UB1 ; ...right shift DE by 4. + INC E ; Fix up for value truncation + LD A,E ; Put in A + LD (CPUSPD),A ; Save it +; + JP UB_INIT ; UNA BIOS init +; +MINIT_RET: + PUSH HL ; Save HL (JP table adr) + + ; Display handler label + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Display port (unit number) + LD DE,COM_LBL ; Prefix + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + LD A,(UNIT) ; Get unit number + ADD A,'0' ; Make displayable + LD E,A ; Put in E for display + LD C,2 ; BDOS console write char + CALL BDOS ; Do it +; + ; Newline + LD C,9 ; BDOS string display function + LD DE,CRLF ; Newline + CALL BDOS ; Do it +; + ; Copy real vectors into active jump table + POP HL ; Recover HL + LD DE,JPTBL ; Real jump table is destination + LD BC,7 * 3 ; Copy 7 3-byte entries + LDIR ; Do the copy +; + ; Return with CPU speed in A + LD A,(CPUSPD) ; A := CPU speed in MHz + LD HL,(RCVSCL) ; HL := receive scalar + RET ; and return +; +;----------------------------------------------------------------------- +; +; Uninitialize modem +; +UNINIT: + LD A,(BIOID) + CP 1 ; Is HBIOS? + JR Z,HUNINIT ; Handle HBIOS + CP 2 ; Is UBIOS? + JR Z,UUNINIT ; Handle UBIOS + RET ; Just return +; +HUNINIT: + ; HBIOS: Reset character device 0 + LD B,04H ; HBIOS CIOINIT function 0x04 + LD A,(UNIT) ; HBIOS serial unit number + LD C,A ; Put in C for func call + LD DE,-1 ; Reset w/ current settings + RST 08 ; Do it + RET ; not initialized, so no 'UN-INITIALIZE' +; +UUNINIT: + ; UBIOS: Reset character device 0 + LD C,10H ; UNA INIT function 0x10 + LD A,(UNIT) ; UBIOS serial unit number + LD B,A ; Put in B for func call + LD DE,-1 ; Reset w/ current settings + RST 08 ; Do it + RET ; not initialized, so no 'UN-INITIALIZE' +; +; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 +; +IDBIO: +; + ; Check for UNA (UBIOS) + LD A,(0FFFDH) ; fixed location of UNA API vector + CP 0C3H ; jp instruction? + JR NZ,IDBIO1 ; if not, not UNA + LD HL,(0FFFEH) ; get jp address + LD A,(HL) ; get byte at target address + CP 0FDH ; first byte of UNA push ix instruction + JR NZ,IDBIO1 ; if not, not UNA + INC HL ; point to next byte + LD A,(HL) ; get next byte + CP 0E5H ; second byte of UNA push ix instruction + JR NZ,IDBIO1 ; if not, not UNA, check others + LD A,2 ; UNA BIOS id = 2 + RET ; and done +; +IDBIO1: + ; Check for RomWBW (HBIOS) + LD HL,(0FFFEH) ; HL := HBIOS ident location + LD A,'W' ; First byte of ident + CP (HL) ; Compare + JR NZ,IDBIO2 ; Not HBIOS + INC HL ; Next byte of ident + LD A,~'W' ; Second byte of ident + CP (HL) ; Compare + JR NZ,IDBIO2 ; Not HBIOS + LD A,1 ; HBIOS BIOS id = 1 + RET ; and done +; +IDBIO2: + ; No idea what this is + XOR A ; Setup return value of 0 + RET ; and done +; +HWERR: + ; Failed to identify target comm hardware + LD DE,ERR_HW ; Hardware error message + JP FAIL ; Print message and bail out +; +APIERR: + ; API returned unepected failure + LD DE,ERR_API ; API error message + JP FAIL ; Pprint message and bail out +; +FAIL: + ; DE has error string address + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + JP 0 ; Bail out! +; +;----------------------------------------------------------------------- +; +; The following are all dummy routines that are unused because MINIT +; dynamically installs the real jump table. +; +SENDR: +CAROK: +MDIN: +GETCHR: +RCVRDY: +SNDRDY: +SPEED: +EXTRA1: +EXTRA2: +EXTRA3: + RET +; +BIOID DB 0 ; BIOS ID, 1=HBIOS, 2=UBIOS +CPUSPD DB 10 ; CPU speed in MHz +RCVSCL DW 6600 ; RECV loop timeout scalar +UNIT DB 0 ; BIOS serial device unit number +BIOSBID DB 00H ; BIOS bank id +; +TAG DB "RomWBW, 30-May-2020$" +; +HB_LBL DB ", HBIOS FastPath$" +UB_LBL DB ", UNA UBIOS$" +UA_LBL DB ", UART$" +UF_LBL DB ", USB-FIFO$" +COM_LBL DB " on COM$" +; +UB_TAG DB " [UNA]$" +HB_TAG DB " [WBW]$" +; +CRLF DB 13, 10, "$" +; +ERR_BIO DB 13, 10, 13, 10, "++ Unknown BIOS ++", 13, 10, "$" +ERR_HW DB 13, 10, 13, 10, "++ Unknown Hardware ++", 13, 10, "$" +ERR_API DB 13, 10, 13, 10, "++ BIOS API Error ++", 13, 10, "$" +; +;======================================================================= +;======================================================================= +; +; RomWBW HBIOS Interface +; +;======================================================================= +;======================================================================= +; +; Following jump table is dynamically patched over initial jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +HB_JPTBL: + JP HB_SENDR ; send character (via pop psw) + JP HB_CAROK ; test for carrier + JP HB_MDIN ; receive data byte + JP HB_GETCHR ; get character from modem + JP HB_RCVRDY ; check receive ready + JP HB_SNDRDY ; check send ready + JP HB_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; HBIOS initialization +; +HB_INIT: + LD HL,2150 ; Smaller receive loop timeout scalar + LD (RCVSCL),HL ; ... to compensate for BIOS overhead +; + ; Patch SENDR w/ FastPath addresses + LD BC,0F801H ; Get CIO func/data adr + LD D,01H ; Func=CIO OUT + LD A,(UNIT) ; get desired char unit + LD E,A ; and put in E + RST 08 + JP NZ,APIERR ; handle API error + LD (HB_UDAT),DE ; Plug in data adr + LD (HB_SCFN),HL ; Plug in func adr +; + ; Patch GETCHR/MDIN w/ FastPath addresses + LD BC,0F801H ; Get CIO func/data adr + LD D,00H ; Func=CIO IN + LD A,(UNIT) ; get desired char unit + LD E,A ; and put in E + RST 08 + JP NZ,APIERR ; handle API error + LD (HB_GCFN),HL ; Plug in func adr +; + ; Patch RCVRDY w/ FastPath addresses + LD BC,0F801H ; Get CIO func/data adr + LD D,02H ; Func=CIO IST + LD A,(UNIT) ; get desired char unit + LD E,A ; and put in E + RST 08 + JP NZ,APIERR ; handle API error + LD (HB_RRFN),HL ; Plug in func adr +; + ; Patch SNDRDY w/ FastPath addresses + LD BC,0F801H ; Get CIO func/data adr + LD D,03H ; Func=CIO OST + LD A,(UNIT) ; get desired char unit + LD E,A ; and put in E + RST 08 + JP NZ,APIERR ; handle API error + LD (HB_SRFN),HL ; Plug in func adr +; + LD HL,HB_JPTBL + LD DE,HB_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +HB_SENDR: + POP AF ; get character to send from stack + PUSH BC + PUSH DE + PUSH HL + LD E,A ; character to E + LD IY,(HB_UDAT) + LD A,(BIOSBID) ; call into HBIOS bank + LD IX,0000H +HB_SCFN EQU $-2 + CALL 0FFF9H ; HBIOS bank call + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +HB_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character +; +; GETCHR must not block +; +HB_GETCHR: + CALL HB_RCVRDY + RET NZ + ; Fall thru if char ready +; +; MDIN can assume a character is ready +; +HB_MDIN: + PUSH BC + PUSH DE + PUSH HL + LD IY,(HB_UDAT) + LD A,(BIOSBID) ; call into HBIOS bank + LD IX,0000H +HB_GCFN EQU $-2 + CALL 0FFF9H ; HBIOS bank call + LD A,E ; byte received to A + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +HB_RCVRDY: + PUSH BC + PUSH DE + PUSH HL + LD IY,(HB_UDAT) + LD A,(BIOSBID) ; call into HBIOS bank + LD IX,0000H +HB_RRFN EQU $-2 + CALL 0FFF9H ; HBIOS bank call + SUB 1 ; CF set IFF zero + RL A ; CF to bit 0 of A + AND 01H ; set Z flag as needed + LD A,0 ; report no line errors + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +HB_SNDRDY: + PUSH BC + PUSH DE + PUSH HL + LD IY,(HB_UDAT) + LD A,(BIOSBID) ; call into HBIOS bank + LD IX,0000H +HB_SRFN EQU $-2 + CALL 0FFF9H ; HBIOS bank call + SUB 1 ; CF set IFF zero + RL A ; CF to bit 0 of A + AND 01H ; set Z flag as needed + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +HB_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; +; +; +HB_UDAT DW 0000H ; Unit data address +; +; +;======================================================================= +;======================================================================= +; +; UNA UBIOS Interface +; +;======================================================================= +;======================================================================= +; +; Following jump table is dynamically patched over initial jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +UB_JPTBL: + JP UB_SENDR ; send character (via pop psw) + JP UB_CAROK ; test for carrier + JP UB_MDIN ; receive data byte + JP UB_GETCHR ; get character from modem + JP UB_RCVRDY ; check receive ready + JP UB_SNDRDY ; check send ready + JP UB_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; UBIOS initialization +; +UB_INIT: +; +; TODO: +; - TEST!!! +; - ADJUST RCVSCL? +; + LD HL,3000 ; Smaller receive loop timeout scalar + LD (RCVSCL),HL ; ... to compensate for BIOS overhead +; + LD HL,UB_JPTBL + LD DE,UB_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +UB_SENDR: + POP AF ; get character to send from stack + PUSH BC + PUSH DE + PUSH HL + LD BC,0012H ; unit 0, func 12h (write char) + LD E,A ; character to E + RST 08 + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +UB_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character +; +; GETCHR must not block +; +UB_GETCHR: + CALL UB_RCVRDY + RET NZ + ; Fall thru if char ready +; +; MDIN can assume a character is ready +; +UB_MDIN: + PUSH BC + PUSH DE + PUSH HL + LD BC,0011H ; unit 0, func 12h (write char) + RST 08 + LD A,E ; byte received to A + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +UB_RCVRDY: + PUSH BC + PUSH DE + PUSH HL + LD BC,0013H ; unit 0, func 13h (input stat) + RST 08 + XOR A ; zero accum ; 4 + CP E ; CF means not zero ; 4 + CCF ; CF means zero ; 4 + RLA ; ZF means not zero ; 4 + LD A,0 ; report no line errors + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +UB_SNDRDY: + PUSH BC + PUSH DE + PUSH HL + LD BC,0014H ; unit 0, func 14h (output stat) + RST 08 + XOR A ; zero accum ; 4 + CP E ; CF means not zero ; 4 + CCF ; CF means zero ; 4 + RLA ; ZF means not zero ; 4 + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +UB_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; +;======================================================================= +;======================================================================= +; +; 8250-like UART +; +;======================================================================= +;======================================================================= +; +; UART constants +; +UA_SNDB EQU 20H ; bit to test for send ready +UA_SNDR EQU 20H ; value when ready to send +UA_RCVB EQU 01H ; bit to test for receive ready +UA_RCVR EQU 01H ; value when ready to receive +UA_PARE EQU 04H ; bit for parity error +UA_OVRE EQU 02H ; bit for overrun error +UA_FRME EQU 08H ; bit for framing error +UA_ERRS EQU UA_FRME | UA_OVRE | UA_PARE +; +; Following jump table is dynamically patched into real jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +UA_JPTBL: + JP UA_SENDR ; send character (via pop psw) + JP UA_CAROK ; test for carrier + JP UA_MDIN ; receive data byte + JP UA_GETCHR ; get character from modem + JP UA_RCVRDY ; check receive ready + JP UA_SNDRDY ; check send ready + JP UA_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; UART initialization +; +UA_INIT: + LD DE,13000 ; receive loop timeout scalar + LD (RCVSCL),DE ; ... for UART RCVRDY timing +; + LD A,L ; get base I/O port address + LD (UA_SCP),A ; set port value in SENDR + LD (UA_GCP),A ; set port value in GETCHR + ADD A,5 ; UART control port is 5 higher + LD (UA_RRP),A ; set port value in RCVRDY + LD (UA_SRP),A ; set port value in SNDRDY +; + LD HL,UA_JPTBL + LD DE,UA_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +UA_SENDR: + POP AF ; get character to send from stack + OUT (0FFH),A ; send to port +UA_SCP EQU $-1 ; port value + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +UA_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character +; +; GETCHR must not block +; +UA_GETCHR: + CALL UA_RCVRDY + RET NZ + ; Fall thru if char ready +; +; MDIN can assume a character is ready +; +UA_MDIN: + IN A,(0FFH) ; read character from port +UA_GCP EQU $-1 ; port value + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +UA_RCVRDY: + IN A,(0FFH) ; get modem status +UA_RRP EQU $-1 ; port value + AND UA_RCVB ; isolate ready bit + CP UA_RCVR ; test it (set flags) + LD A,0 ; report no line errors +; + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +UA_SNDRDY: + IN A,(0FFH) ; get status +UA_SRP EQU $-1 ; port value + AND UA_SNDB ; isolate transmit ready bit + CP UA_SNDR ; test for ready value + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +UA_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; +; +; +UA_BASE DB 00H ; UART base port I/O address +UA_CTLP DB 00H ; UART control port I/O address +; +; +;======================================================================= +;======================================================================= +; +; WILL SOWERBUTTS ECB USB-FIFO +; +;======================================================================= +;======================================================================= +; +UF_BASE EQU 0CH +UF_DATA EQU (UF_BASE+0) +UF_STATUS EQU (UF_BASE+1) +UF_SEND_IMM EQU (UF_BASE+2) +; +; Following jump table is dynamically patched over initial jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +UF_JPTBL: + JP UF_SENDR ; send character (via pop psw) + JP UF_CAROK ; test for carrier + JP UF_MDIN ; receive data byte + JP UF_GETCHR ; get character from modem + JP UF_RCVRDY ; check receive ready + JP UF_SNDRDY ; check send ready + JP UF_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; USB-FIFO initialization +; +UF_INIT: + LD DE,12000 ; receive loop timeout scalar + LD (RCVSCL),DE ; ... for UART RCVRDY timing +; + LD A,L ; get base I/O port address (data port) + LD (UF_SCDP),A ; set data port in SENDR + LD (UF_GCDP),A ; set data port in GETCHR/MDIN + INC A ; bump to status port + LD (UF_RRSP),A ; set status port in RCVRDY + LD (UF_SRSP),A ; set status port in SNDRDY + INC A ; bump to send immediate port + LD (UF_SCIP),A ; set send immed port in SENDR +; + LD HL,UF_JPTBL + LD DE,UF_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +UF_SENDR: + + POP AF ; get character to send from stack + OUT (0FFH),A ; write to fifo +UF_SCDP EQU $-1 ; data port + OUT (0FFH),A ; send immediate +UF_SCIP EQU $-1 ; send immediate port + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +UF_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character (assume character ready has already been tested) +; +; GETCHR must not block +; +UF_GETCHR: + CALL UF_RCVRDY ; check for char ready + RET NZ ; return if not + ; Fall thru if char ready +; +; MDIN can assume a character is ready +; +UF_MDIN: + IN A,(0FFH) ; get char +UF_GCDP EQU $-1 ; data port + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +UF_RCVRDY: + IN A,(0FFH) ; bit 7 = 0 if char avail, = 1 if no char. +UF_RRSP EQU $-1 ; status port + RLCA ; bit 0 = 0 if char avail, = 1 if no char. + AND 00000001B ; A = 0, ZF = 1 if no char, A = 1, ZF = 0 if char avail. + LD A,0 ; no errors + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +UF_SNDRDY: + IN A,(0FFH) ; bit 0 = 0 if space avail, = 1 if full +UF_SRSP EQU $-1 ; status port + AND 00000001B ; A = 0, ZF = 1 if space avail, A = 1, ZF = 0 if full. + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +UF_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; + END diff --git a/Source/Apps/XM/xmhb_old.z80 b/Source/Apps/XM/xmhb_old.z80 new file mode 100644 index 00000000..9405d3cf --- /dev/null +++ b/Source/Apps/XM/xmhb_old.z80 @@ -0,0 +1,920 @@ +;======================================================================= +; +; XMHB.Z80 - XMODEM12 PATCH FILE FOR ROMWBW HBIOS +; +; Wayne Warthen - wwarthen@gmail.com +; +; 2018-06-06 WBW Added support for RCBus w/ Z180 +; 2019-08-17 WBW Refactored and merged Phil's ECB-FIFO support +; 2019-08-28 WBW Refactored ASCI support +; +;======================================================================= +; + ASEG +; +NO EQU 0 +YES EQU NOT NO +; +ERRDET EQU NO ; detect parity/framing/overrun errs +; +BASE EQU 100H ; start of cp/m normal program area +; +BDOS EQU 00005H ; BDOS function dispatch vector +; +;======================================================================= +; +; Jump table: The jump table must be in exactly the same sequence as the +; one in XMODEM. Note the ORG of 103H - This jump table has no jump to +; 'BEGIN'. +; + ORG BASE + 3 ; start after 'JMP BEGIN' +; + JP CONOUT ; must be 00000h if not used, see below + JP MINIT ; initialization routine (if needed) + JP UNINIT ; undo whatever 'MINIT' did (or return) +JPTBL: + JP SENDR ; send character (via pop psw) + JP CAROK ; test for carrier + JP MDIN ; receive data byte + JP GETCHR ; get character from modem + JP RCVRDY ; check receive ready + JP SNDRDY ; check send ready + JP SPEED ; get speed value for file transfer time + JP EXTRA1 ; extra for custom routine + JP EXTRA2 ; extra for custom routine + JP EXTRA3 ; extra for custom routine +; +;----------------------------------------------------------------------- +; +; Output character to console +; +CONOUT EQU 0 ; not used +; +;----------------------------------------------------------------------- +; +; Initialize modem +; +; This procedure has been usurped to dynamically detect the type +; of system we are running on and install the *real* jump table +; entries as appropriate. +; +MINIT: + ; Announce + LD DE,RBC ; RetroBrew Computers + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Identify BIOS (RomWBW HBIOS or UNA UBIOS) + CALL IDBIO ; 1=HBIOS, 2=UBIOS + LD (BIOID),A ; Save it + DEC A ; Test for HBIOS + JR Z,HINIT ; Do HBIOS setup + DEC A ; Test for UBIOS + JR Z,UINIT ; Do UBIOS setup +; + ; Neither UNA nor RomWBW + LD DE,ERR_BIO ; BIOS error message + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + JP 0 ; Bail out! +; +MINIT_RET: + PUSH HL ; Save HL (JP table adr) + + ; Display port notification string + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Newline + LD C,9 ; BDOS string display function + LD DE,CRLF ; Newline + CALL BDOS ; Do it +; + ; Copy real vectors into active jump table + POP HL ; Recover HL + LD DE,JPTBL ; Real jump table is destination + LD BC,7 * 3 ; Copy 7 3-byte entries + LDIR ; Do the copy +; + ; Return with CPU speed in A + LD A,(CPUSPD) ; A := CPU speed in MHz + LD HL,(RCVSCL) ; HL := receive scalar + RET ; and return +; +HINIT: + ; Display RomWBW notification string + LD DE,HBTAG ; BIOS notification string + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Get CPU speed from RomWBW HBIOS and save it + LD B,0F8H ; HBIOS SYSGET function 0xF8 + LD C,0F0H ; CPUINFO subfunction 0xF0 + RST 08 ; Do it, L := CPU speed in MHz + LD A,L ; Move it to A + LD (CPUSPD),A ; Save it +; + ; Get HBIOS character 0 device type + LD B,006H ; HBIOS DEVICE function 0x06 + LD C,000H ; HBIOS char 0 device + RST 08 ; Do it, D=device type + LD A,D ; Put result in A + CP 000H ; UART? + JP Z,U_INIT ; If so, do UART init + CP 010H ; ASCI? + JP Z,A_INIT ; If so, do ASCI init + CP 080H ; USB-FIFO? + JP Z,UF_INIT ; If so, do USB-FIFO init + JP H_INIT ; Otherwise, use HBIOS I/O +; +UINIT: + ; Display UNA notification string + LD DE,UBTAG ; BIOS notification string + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Get CPU speed from UNA and save it + LD C,0F8H ; UNA BIOS Get PHI function + RST 08 ; Returns speed in Hz in DE:HL + LD B,4 ; Divide MHz in DE:HL by 100000H +UINIT1: + SRL D ; ... to get approx CPU speed in + RR E ; ...MHz. Throw away HL, and + DJNZ UINIT1 ; ...right shift DE by 4. + INC E ; Fix up for value truncation + LD A,E ; Put in A + LD (CPUSPD),A ; Save it +; + ; Check CPU, Z80=UART, Z180=ASCI + LD DE,00202H ; D := 2, E := 2 + MLT DE ; DE := D * E == 4 + BIT 2,E ; Bit 2 wil be set if mlt happend + JP Z,U_INIT ; UART initialization + JP A_INIT ; otherwise, ASCI +; +HWERR: + ; Failed to identify target comm hardware + LD DE,ERR_HW ; Hardware error message + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + JP 0 ; Bail out! +; +; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 +; +IDBIO: +; + ; Check for UNA (UBIOS) + LD A,(0FFFDH) ; fixed location of UNA API vector + CP 0C3H ; jp instruction? + JR NZ,IDBIO1 ; if not, not UNA + LD HL,(0FFFEH) ; get jp address + LD A,(HL) ; get byte at target address + CP 0FDH ; first byte of UNA push ix instruction + JR NZ,IDBIO1 ; if not, not UNA + INC HL ; point to next byte + LD A,(HL) ; get next byte + CP 0E5H ; second byte of UNA push ix instruction + JR NZ,IDBIO1 ; if not, not UNA, check others + LD A,2 ; UNA BIOS id = 2 + RET ; and done +; +IDBIO1: + ; Check for RomWBW (HBIOS) + LD HL,(0FFFEH) ; HL := HBIOS ident location + LD A,'W' ; First byte of ident + CP (HL) ; Compare + JR NZ,IDBIO2 ; Not HBIOS + INC HL ; Next byte of ident + LD A,~'W' ; Second byte of ident + CP (HL) ; Compare + JR NZ,IDBIO2 ; Not HBIOS + LD A,1 ; HBIOS BIOS id = 1 + RET ; and done +; +IDBIO2: + ; No idea what this is + XOR A ; Setup return value of 0 + RET ; and done +; +;----------------------------------------------------------------------- +; +; Uninitialize modem +; +UNINIT: + LD A,(BIOID) + CP 1 ; Is HBIOS? + JR Z,H_UNINIT ; Handle HBIOS + CP 2 ; Is UBIOS? + JR Z,U_UNINIT ; Handle UBIOS + RET ; Just return +; +H_UNINIT: + ; HBIOS: Reset character device 0 + LD B,04H ; HBIOS CIOINIT function 0x04 + LD C,0 ; Unit = 0 + LD DE,-1 ; Reset w/ current settings + RST 08 ; Do it + RET ; not initialized, so no 'UN-INITIALIZE' +; +U_UNINIT: + ; UBIOS: Reset character device 0 + LD C,10H ; UNA INIT function 0x10 + LD B,0 ; Unit = 0 + LD DE,-1 ; Reset w/ current settings + RST 08 ; Do it + RET ; not initialized, so no 'UN-INITIALIZE' +; +;----------------------------------------------------------------------- +; +; The following are all dummy routines that are unused because MINIT +; dynamically installs the real jump table. +; +SENDR: +CAROK: +MDIN: +GETCHR: +RCVRDY: +SNDRDY: +SPEED: +EXTRA1: +EXTRA2: +EXTRA3: + RET +; +BIOID DB 0 ; BIOS ID, 1=HBIOS, 2=UBIOS +CPUSPD DB 10 ; CPU speed in MHz +RCVSCL DW 6600 ; RECV loop timeout scalar +; +RBC DB "RBC, 28-Aug-2019$" +; +U_LBL DB ", UART$" +A_LBL DB ", ASCI$" +S_LBL DB ", SIO$" +H_LBL DB ", COM$" +UF_LBL DB ", USB-FIFO$" +; +UBTAG DB " [UNA]$" +HBTAG DB " [WBW]$" +; +CRLF DB 13, 10, "$" +; +ERR_BIO DB 13, 10, 13, 10, "++ Unknown BIOS ++", 13, 10, "$" +ERR_HW DB 13, 10, 13, 10, "++ Unknown Hardware ++", 13, 10, "$" +; +;======================================================================= +;======================================================================= +; +; 8250-like UART @ Port 68H +; +;======================================================================= +;======================================================================= +; +; UART port constants +; +U_BASE EQU 68H ; UART base port +U_DATP EQU U_BASE + 0 ; data in port +U_DATO EQU U_BASE + 0 ; data out port +U_CTLP EQU U_BASE + 5 ; control/status port +U_SNDB EQU 20H ; bit to test for send ready +U_SNDR EQU 20H ; value when ready to send +U_RCVB EQU 01H ; bit to test for receive ready +U_RCVR EQU 01H ; value when ready to receive +U_PARE EQU 04H ; bit for parity error +U_OVRE EQU 02H ; bit for overrun error +U_FRME EQU 08H ; bit for framing error +U_ERRS EQU U_FRME | U_OVRE | U_PARE +; +; Following jump table is dynamically patched into real jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +U_JPTBL: + JP U_SENDR ; send character (via pop psw) + JP U_CAROK ; test for carrier + JP U_MDIN ; receive data byte + JP U_GETCHR ; get character from modem + JP U_RCVRDY ; check receive ready + JP U_SNDRDY ; check send ready + JP U_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; UART initialization +; +U_INIT: + LD HL,13000 ; Receive loop timeout scalar + LD (RCVSCL),HL ; ... for UART RCVRDY timing +; + LD HL,U_JPTBL + LD DE,U_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +U_SENDR: + POP AF ; get character to send from stack + OUT (U_DATO),A ; send to port + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +U_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character (assume character ready has already been tested) +; +U_MDIN: +U_GETCHR: + IN A,(U_DATP) ; read character from port + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +U_RCVRDY: + IN A,(U_CTLP) ; get modem status +; + IF ERRDET +; + ; With error detection (slower) + PUSH BC ; save scratch register + PUSH AF ; save full status on stack + AND U_ERRS ; isolate line err bits + LD B,A ; save err status in B + POP AF ; get full status back + AND U_RCVB ; isolate ready bit + CP U_RCVR ; test it (set flags) + LD A,B ; get the error code back + POP BC ; restore scratch register +; + ELSE +; + ; No error detection (faster) + AND U_RCVB ; isolate ready bit + CP U_RCVR ; test it (set flags) + LD A,0 ; report no line errors +; + ENDIF +; + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +U_SNDRDY: + IN A,(U_CTLP) ; get status + AND U_SNDB ; isolate transmit ready bit + CP U_SNDR ; test for ready value + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +U_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; +;======================================================================= +;======================================================================= +; +; Z180 Primary ASCI +; +; - Port is determined dynamically in A_INIT +; +;======================================================================= +;======================================================================= +; +; ASCI port constants +; +A_DATP EQU 08H ; Z180 TSR - ASCI receive data port +A_DATO EQU 06H ; Z180 TDR - ASCI transmit data port +A_CTLP EQU 04H ; Z180 STAT - ASCI status port +A_CTL2 EQU 00H ; Z180 CNTLA - ASCI control port +; +A_SNDB EQU 02H ; Z180 STAT:TDRE - xmit data reg empty bit +A_SNDR EQU 02H ; Z180 STAT:TDRE - xmit data reg empty value +A_RCVB EQU 80H ; Z180 STAT:RDRF - rcv data reg full bit +A_RCVR EQU 80H ; Z180 STAT:RDRF - rcv data reg full value +A_PARE EQU 20H ; Z180 STAT:PE - parity error bit +A_OVRE EQU 40H ; Z180 STAT:OVRN - overrun error bit +A_FRME EQU 10H ; Z180 STAT:FE - framing error bit +A_ERRS EQU A_FRME | A_OVRE | A_PARE +; +A_BASE DB 00H ; internal IO base address for Z180 +; +; Following jump table is dynamically patched over initial jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +A_JPTBL: + JP A_SENDR ; send character (via pop psw) + JP A_CAROK ; test for carrier + JP A_MDIN ; receive data byte + JP A_GETCHR ; get character from modem + JP A_RCVRDY ; check receive ready + JP A_SNDRDY ; check send ready + JP A_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; ASCI initialization +; +A_INIT: + LD HL,7500 ; Receive loop timeout scalar + LD (RCVSCL),HL ; ... for ASCI RCVRDY timing +; + ; Test for location of Z180 internal registers + ; and use appropriate I/O address. + LD B,0 ; set MSB for 16 bit I/O + LD C,040H|3FH ; internal registers @ 40H? + IN A,(C) ; read + CP 040H|01FH ; same value except for bit 5? + JR Z,A_INIT1 ; do ASCI init (port in C) + LD C,0C0H|3FH ; internal registers @ C0H? + IN A,(C) ; read + CP 0C0H|1FH ; same value except for bit 5? + JR Z,A_INIT1 ; do ASCI init (port in C) + JP HWERR ; unknown hardware error +; +A_INIT1: + LD A,C ; test port value to A + AND 0C0H ; only top two bits relevant + LD (A_BASE),A ; save it + ADD A,A_CTLP ; status port offset + LD C,A ; put in C for I/O + LD B,0 ; MSB for 16 bit I/O + XOR A ; clear interrupt enable flags + OUT (C),A ; do it +; + LD HL,A_JPTBL + LD DE,A_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +A_SENDR: + EX (SP),HL ; save HL, HL := char to send + PUSH BC ; save scratch register + LD A,(A_BASE) ; IO base address + ADD A,A_DATO ; data out port offset + LD C,A ; put in C for I/O + LD B,0 ; MSB for 16 bit I/O + OUT (C),H ; send to port + POP BC ; restore scratch reg + POP HL ; restore HL + RET ; done +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +A_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character (assume character ready has already been tested) +; +A_MDIN: +A_GETCHR: + PUSH BC ; save scratch register + LD A,(A_BASE) ; IO base address + ADD A,A_DATP ; data in port offset + LD C,A ; put in C for I/O + LD B,0 ; MSB for 16 bit I/O + IN A,(C) ; read character from port + POP BC ; restore scratch reg + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +A_RCVRDY: + PUSH BC ; save scratch register + LD A,(A_BASE) ; IO base address + ADD A,A_CTLP ; status port offset + LD C,A ; put in C for I/O + LD B,0 ; MSB for 16 bit I/O + IN A,(C) ; get modem status + PUSH AF ; save full status on stack + AND A_ERRS ; isolate line err bits + LD B,A ; save err status in B + + ; Z180 ASCI ports will stall if there are errors. + ; Error bits are NOT cleared by merely reading + ; the status register. Below, bit 3 of ASCI + ; control register is written with a zero to + ; clear error(s) if needed. + JR Z,A_RCVRDY2 ; if no errs, continue + PUSH BC ; save scratch reg + LD A,(A_BASE) ; IO base address + ADD A,A_CTL2 ; status port offset + LD C,A ; put in C for I/O + LD B,0 ; MSB for 16 bit I/O + IN A,(C) ; get current control reg value + AND 0F7H ; force err reset bit to zero + OUT (C),A ; write control register + POP BC ; restore scratch reg +; +A_RCVRDY2: + POP AF ; get full status back + AND A_RCVB ; isolate ready bit + CP A_RCVR ; test it (set flags) + LD A,B ; get the error code back + POP BC ; restore scratch register + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +A_SNDRDY: + PUSH BC ; save scratch register + LD A,(A_BASE) ; IO base address + ADD A,A_CTLP ; status port offset + LD C,A ; put in C for I/O + LD B,0 ; MSB for 16 bit I/O + IN A,(C) ; get modem status + AND A_SNDB ; isolate transmit ready bit + CP A_SNDR ; test for ready value + POP BC ; restore scratch register + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +A_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; +;======================================================================= +;======================================================================= +; +; Zilog SIO @ Port 80H +; +;======================================================================= +;======================================================================= +; +; Currently assumes the port address and ordering conventions of the +; official RCBus SIO module. Will not work with others such as EZZ80 +; or ZP. +; +; SIO port constants +; +S_BASE EQU 80H ; SIO base port +S_DATP EQU S_BASE + 1 ; data in port +S_DATO EQU S_BASE + 1 ; data out port +S_CTLP EQU S_BASE + 0 ; control/status port +S_SNDB EQU 04H ; bit to test for send ready +S_SNDR EQU 04H ; value when ready to send +S_RCVB EQU 01H ; bit to test for receive ready +S_RCVR EQU 01H ; value when ready to receive +; +; Following jump table is dynamically patched into real jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +S_JPTBL: + JP S_SENDR ; send character (via pop psw) + JP S_CAROK ; test for carrier + JP S_MDIN ; receive data byte + JP S_GETCHR ; get character from modem + JP S_RCVRDY ; check receive ready + JP S_SNDRDY ; check send ready + JP S_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; SIO initialization +; +S_INIT: + LD HL,12000 ; Receive loop timeout scalar + LD (RCVSCL),HL ; ... for UART RCVRDY timing +; + ; Suppress interrupts + LD A,01H ; WR1 + OUT (S_CTLP),A ; Select WR1 + XOR A ; No interrupts + OUT (S_CTLP),A ; Do it +; + LD HL,S_JPTBL + LD DE,S_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +S_SENDR: + POP AF ; get character to send from stack + OUT (S_DATO),A ; send to port + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +S_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character (assume character ready has already been tested) +; +S_MDIN: +S_GETCHR: + IN A,(S_DATP) ; read character from port + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +S_RCVRDY: + ;XOR A + ;OUT (S_CTLP),A ; select WR0 + IN A,(S_CTLP) ; get status + AND S_RCVB ; isolate ready bit + CP S_RCVR ; test it (set flags) + LD A,0 ; report no line errors + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +S_SNDRDY: + ;XOR A + ;OUT (S_CTLP),A ; select WR0 + IN A,(S_CTLP) ; get status + AND S_SNDB ; isolate ready bit + CP S_SNDR ; test it (set flags) + LD A,0 ; report no line errors + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +S_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; +;======================================================================= +;======================================================================= +; +; HBIOS Console (COM0:) +; +;======================================================================= +;======================================================================= +; +; Following jump table is dynamically patched over initial jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +H_JPTBL: + JP H_SENDR ; send character (via pop psw) + JP H_CAROK ; test for carrier + JP H_MDIN ; receive data byte + JP H_GETCHR ; get character from modem + JP H_RCVRDY ; check receive ready + JP H_SNDRDY ; check send ready + JP H_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; HBIOS initialization +; +H_INIT: + LD HL,1250 ; Smaller receive loop timeout scalar + LD (RCVSCL),HL ; ... to compensate for BIOS overhead +; + LD HL,H_JPTBL + LD DE,H_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +H_SENDR: + POP AF ; get character to send from stack + PUSH BC + PUSH DE + PUSH HL + LD B,01H ; HBIOS OUT function + LD C,0 ; console is unit 0 by fiat + LD E,A ; character to E + RST 08 ; HBIOS call + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +H_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character (assume character ready has already been tested) +; +; This routine must NOT block. +; +H_MDIN: +H_GETCHR: + PUSH BC + PUSH DE + PUSH HL + LD B,02H ; HBIOS IST function + LD C,0 ; console is unit 0 by fiat + RST 08 ; HBIOS call, A := bytes pending + JR NZ,H_MDIN1 ; If char(s) waiting, go get it + XOR A ; otherwise, return null + JR H_MDIN2 ; and done +H_MDIN1: + LD B,00H ; HBIOS IN function + LD C,0 ; console is unit 0 by fiat + RST 08 ; HBIOS call + LD A,E ; byte received to A +H_MDIN2: + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +H_RCVRDY: + PUSH BC + PUSH DE + PUSH HL + LD B,02H ; HBIOS IST function + LD C,0 ; console is unit 0 by fiat + RST 08 ; HBIOS call, A := bytes pending + SUB 1 ; CF set IFF zero + RL A ; CF to bit 0 of A + AND 01H ; set Z flag as needed + LD A,0 ; report no line errors + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +H_SNDRDY: + PUSH BC + PUSH DE + PUSH HL + LD B,03H ; HBIOS OST function + LD C,0 ; console is unit 0 by fiat + RST 08 ; HBIOS call, A := xmit buf bytes avail + SUB 1 ; CF set IFF zero + RL A ; CF to bit 0 of A + AND 01H ; set Z flag as needed + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +H_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; +; +;======================================================================= +;======================================================================= +; +; WILL SOWERBUTTS ECB USB-FIFO +; +;======================================================================= +;======================================================================= +; +UF_BASE EQU 0CH +UF_DATA EQU (UF_BASE+0) +UF_STATUS EQU (UF_BASE+1) +UF_SEND_IMM EQU (UF_BASE+2) +; +; Following jump table is dynamically patched over initial jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +UF_JPTBL: + JP UF_SENDR ; send character (via pop psw) + JP UF_CAROK ; test for carrier + JP UF_MDIN ; receive data byte + JP UF_GETCHR ; get character from modem + JP UF_RCVRDY ; check receive ready + JP UF_SNDRDY ; check send ready + JP UF_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; USB-FIFO initialization +; +UF_INIT: + LD HL,12000 ; Receive loop timeout scalar + LD (RCVSCL),HL ; ... for UART RCVRDY timing +; + LD HL,UF_JPTBL + LD DE,UF_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +UF_SENDR: + + POP AF ; get character to send from stack + OUT (UF_DATA),A ; WRITE TO FIFO + OUT (UF_SEND_IMM),A ; SEND IMMEDIATE + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +UF_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character (assume character ready has already been tested) +; +; This routine must NOT block. +; +UF_MDIN: +UF_GETCHR: + IN A,(UF_DATA) ; GET CHAR + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +UF_RCVRDY: + IN A,(UF_STATUS) ; B7=0 IF CHAR AVAIL, =1 IF NO CHAR. + RLCA ; B0=0 IF CHAR AVAIL, =1 IF NO CHAR. + AND 00000001B ; A=0, ZF=1 IF NO CHAR, A=1, ZF=0 IF CHAR AVAIL, + LD A,0 + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +UF_SNDRDY: + IN A,(UF_STATUS) ; Bit 0=0 IF SPACE AVAIL, =1 IF FULL + AND 00000001B ; A=0, ZF=1 IF SPACE AVAIL, A=1, ZF=0 IF FULL. + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +UF_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; + END diff --git a/Source/Apps/XM/xmuf.180 b/Source/Apps/XM/xmuf.z80 similarity index 100% rename from Source/Apps/XM/xmuf.180 rename to Source/Apps/XM/xmuf.z80 diff --git a/Source/Apps/ZMD/-29sep88 b/Source/Apps/ZMD/-29sep88 new file mode 100644 index 00000000..e69de29b diff --git a/Source/Apps/ZMD/-notice.doc b/Source/Apps/ZMD/-notice.doc new file mode 100644 index 00000000..79faa5ad --- /dev/null +++ b/Source/Apps/ZMD/-notice.doc @@ -0,0 +1,24 @@ + + ----------------------------------------------------------------------- + Copyright (c) 1987, 1988 by Robert W. Kramer III, ALL RIGHTS RESERVED + Release 1.50 1569 40th St. + 09/29/88 Rock Island, Il. 61201 + Voice: (309) 786-6711, 24hr + RI RCPM-RDOS (128 Meg) Data: (309) 786-6227, 24hr, 300/1200/2400 + ----------------------------------------------------------------------- + + + USER AGREEMENT: + --------------- + + ZMD is free to use, providing program signon messages (my name, program + name, release date and copyright notices) remain intact as released. + You may modify any .Z80 file as you wish so long as your modified copy + is used for your own personal non-profit use and is NOT passed on to + any other party. + + You are encouraged to distribute ZMD releases to any interested party + providing all files remain in their ORIGINAL UNMODIFIED RELEASE FORM + as distributed from RI RCPM-RDOS. + + \ No newline at end of file diff --git a/Source/Apps/ZMD/-zmd.for b/Source/Apps/ZMD/-zmd.for new file mode 100644 index 00000000..151dceae --- /dev/null +++ b/Source/Apps/ZMD/-zmd.for @@ -0,0 +1,10 @@ +----- +ZMD150.LBR - CP/M Communications + 09/29/88 - This release is super clean, super fast - and smaller. + Some major problems in the way Ymodem Batch protocol was implemented + on CP/M systems has been fixed, virtually eliminating all delays + between files. CPM3 systems can now run all ZMD programs with no + problems. Some other bug fixes, modifications and enhancements. + This is probably the last release of ZMD until ZMD with ZMODEM is + released. Bob Kramer - RI RCPM-RDOS (128 Mb) - (309) 786-6711 + \ No newline at end of file diff --git a/Source/Apps/ZMD/Build.cmd b/Source/Apps/ZMD/Build.cmd new file mode 100644 index 00000000..5d8d700d --- /dev/null +++ b/Source/Apps/ZMD/Build.cmd @@ -0,0 +1,35 @@ +@echo off +setlocal + +set TOOLS=..\..\..\Tools + +set PATH=%TOOLS%\zxcc;%PATH% + +set CPMDIR80=%TOOLS%/cpm/ + +zxcc z80asm -zmd/fm +zxcc l80 -zmd,zmd/n/e + +zxcc z80asm -zmap/fm +zxcc l80 -zmap,zmap/n/e + +zxcc z80asm -znews/fm +zxcc l80 -znews,znews/n/e + +zxcc z80asm -znewp/fm +zxcc l80 -znewp,znewp/n/e + +zxcc z80asm -zfors/fm +zxcc l80 -zfors,zfors/n/e + +zxcc z80asm -zforp/fm +zxcc l80 -zforp,zforp/n/e + +zxcc z80asm -zmdel/fm +zxcc l80 -zmdel,zmdel/n/e + +zxcc z80asm -zmdhb/fh +zxcc mload25 -zmd=zmd.com,zmdhb + +copy /Y zmd.com ..\..\..\Binary\Apps\ || exit /b + diff --git a/Source/Apps/ZMD/Clean.cmd b/Source/Apps/ZMD/Clean.cmd new file mode 100644 index 00000000..04e795a6 --- /dev/null +++ b/Source/Apps/ZMD/Clean.cmd @@ -0,0 +1,10 @@ +@echo off +setlocal + +ren zmdsubs.rel zmdsubs.rel.sav +if exist *.rel del *.rel +ren zmdsubs.rel.sav zmdsubs.rel +if exist *.hex del *.hex +if exist *.prn del *.prn +if exist *.lst del *.lst +if exist *.com del *.com diff --git a/Source/Apps/ZMD/Makefile b/Source/Apps/ZMD/Makefile new file mode 100644 index 00000000..70350198 --- /dev/null +++ b/Source/Apps/ZMD/Makefile @@ -0,0 +1,10 @@ +OBJECTS = zmd.com +DEST = ../../../Binary/Apps +TOOLS = ../../../Tools +OTHERS = *.hex zmd.rel + +include $(TOOLS)/Makefile.inc + +zmd.com: zmd.rel zmdhb.hex + $(ZXCC) L80 -zmd,zmd/n/e + $(ZXCC) MLOAD25 -zmd=zmd.com,zmdhb diff --git a/Source/Apps/ZMD/autoinst.doc b/Source/Apps/ZMD/autoinst.doc new file mode 100644 index 00000000..b5209d59 --- /dev/null +++ b/Source/Apps/ZMD/autoinst.doc @@ -0,0 +1,36 @@ + + ----------------------------------------------------------------------- + Copyright (c) 1987, 1988 by Robert W. Kramer III, ALL RIGHTS RESERVED + Release 1.50 1569 40th St. + 09/29/88 Rock Island, Il. 61201 + Voice: (309) 786-6711, 24hr + RI RCPM-RDOS (128 Meg) Data: (309) 786-6227, 24hr, 300/1200/2400 + ----------------------------------------------------------------------- + + + ZMD AUTO-INSTALL FEATURE + ------------------------ + + ZINSTL can automatically install the new release of ZMD (and utilities) + with the use of the '!' option. ZINSTL ! will read all switch/toggle + configurations and port/modem/rtc overlays from your already installed + version of ZMD where you can then use them to install this new release. + + Follow these steps: + + 1) Extract all files from ZMDnnn.LBR + 2) Rename your already configured ZMD.COM to ZMD149.COM + 3) Run ZINSTL (Release 1.50) with the '!' option: ZINSTL ! + 4) Answer any questions ZINSTL may ask + 5) Use the 'J' option to save configurations + 6) Rename ZMD150.COM to ZMD.COM + + + NOTE: This will not work with any other version of ZMD except for 1.49 + and 1.50. Running ZINSTL without the ! option will cause it to run just + like you've all been used to. In the future, if the new release header + file ZMDHDR.Z80 becomes incompatible with that of the previous release + this feature will be disabled. + + + \ No newline at end of file diff --git a/Source/Apps/ZMD/equates.ins b/Source/Apps/ZMD/equates.ins new file mode 100644 index 00000000..f38310c6 --- /dev/null +++ b/Source/Apps/ZMD/equates.ins @@ -0,0 +1,88 @@ +; +; Version identification +; +VERS EQU 1 ; Release +MODLEV EQU 5 ; Major modification level +REV EQU 0 ; Minor revision number + +VMONTH EQU 09 ; Version month +VDAY EQU 29 ; Version day +VYEAR EQU 88 ; Version year +; +;========================================================================== +; +NO EQU 0 +YES EQU 0FFH +; +;-------------------------------------------------------------------------- +; Define ASCII characters used +;-------------------------------------------------------------------------- + +SOH EQU 1 ; ^A - start of header +STX EQU 2 ; ^B - start of 1k header +CTRLC EQU 3 ; ^C - abort/break character +EOT EQU 4 ; ^D - end of transmission +ACK EQU 6 ; ^F - acknowledge +BELL EQU 7 ; ^G - bell +BS EQU 8 ; ^H - backspace +TAB EQU 9 ; ^I - horizontal tab +LF EQU 10 ; ^J - line feed +CTRLK EQU 11 ; ^K - abort character +CR EQU 13 ; ^M - carriage return +PAUSE EQU 19 ; ^S - pause request +NAK EQU 21 ; ^U - negative acknowledge +CANCEL EQU 24 ; ^X - cancel +EOF EQU 26 ; ^Z - end of file +CRC EQU 67 ; C - CRC request character +KSND EQU 75 ; K - 1k block request character +DEL EQU 127 ; Delete/Rubout +; +; +; Define standard CP/M BDOS equates +; +DIRCON EQU 6 ; Direct console output +PRINT EQU 9 ; Print string function +GETVER EQU 12 ; Get CP/M version +SELDSK EQU 14 ; Select drive +OPEN EQU 15 ; Open file +CLOSE EQU 16 ; Close file +SRCHF EQU 17 ; Search for first occurence +SRCHN EQU 18 ; Search for next occurence +DELETE EQU 19 ; Delete file +READ EQU 20 ; Read record +WRITE EQU 21 ; Write record +MAKE EQU 22 ; Make new file +RENAME EQU 23 ; Rename a file +CURDRV EQU 25 ; Get current drive +SETDMA EQU 26 ; Set DMA +SETFILE EQU 30 ; Set file attributes +SETUSR EQU 32 ; Set user area to receive file +RRDM EQU 33 ; Read random +WRDM EQU 34 ; Write random +FILSIZ EQU 35 ; Compute file size +SETRRD EQU 36 ; Set random record + +BDOS EQU 0005H ; Address for BDOS jump vectors +TBUF EQU 0080H ; Default DMA address +FCB EQU 005CH ; System FCB +FCB1 EQU 006CH ; Secondary FCB area +FCBEXT EQU FCB+12 ; File extent +FCBRNO EQU FCB+32 ; Record number +RANDOM EQU FCB+33 ; Random record field +RLEN EQU 128 ; Record length +ITEMSZ EQU 16 ; Number of data bytes in each filename entry +; +; +TAGFIL EQU 7 +DWNTAG EQU 6 +NOSYS EQU 5 +NOLBS EQU 4 +NOCOMS EQU 3 +NOCOMR EQU 2 +RESERV1 EQU 1 +ZCPR EQU 0 +; +; +; +;-------------------------------------------------------------------------- + \ No newline at end of file diff --git a/Source/Apps/ZMD/mkcoms.sub b/Source/Apps/ZMD/mkcoms.sub new file mode 100644 index 00000000..2486776a --- /dev/null +++ b/Source/Apps/ZMD/mkcoms.sub @@ -0,0 +1,44 @@ +; +; +; MKCOMS.SUB - 09/29/88 - Assemble/Link ZMD and utilities +; +; To use this file with M80, you'll have to edit all 'z80asm ' +; to 'm80 ='. Older versions of M80 which truncate labels to 6 +; bytes will not assemble the programs properly. +; +; --> MICROSOFT MACRO-80 v3.43 has been tested and proven to +; assemble them without error. +; +; +z80asm zmd/m +l80 zmd,zmd/n/e +era zmd.rel +; +z80asm zmap/m +l80 zmap,zmap/n/e +era zmap.rel +; +z80asm znews/m +l80 znews,znews/n/e +era znews.rel +; +z80asm znewp/m +l80 znewp,znewp/n/e +era znewp.rel +; +z80asm zfors/m +l80 zfors,zfors/n/e +era zfors.rel +; +z80asm zforp/m +l80 zforp,zforp/n/e +era zforp.rel +; +z80asm zmdel/m +l80 zmdel,zmdel/n/e +era zmdel.rel +; +; +; Done... +; + \ No newline at end of file diff --git a/Source/Apps/ZMD/zforp.z80 b/Source/Apps/ZMD/zforp.z80 new file mode 100644 index 00000000..be6414c0 --- /dev/null +++ b/Source/Apps/ZMD/zforp.z80 @@ -0,0 +1,420 @@ +; + + TITLE ZFORP.Z80 - 09/29/88 - ZMD Public Description Utility +; Copyrighted (c) 1987, 1988 +; Robert W. Kramer III + + PAGE +;- -; +; Update History ; +; ; +; Date Release Comments ; +; -------- ------- ---------------------------------------------- ; +; ; +; 09/29/88 v1.50 - No change(s) made to this file. ; +; 03/18/88 v1.49 - No change(s) made to this file ; +; 03/13/88 v1.48 - Redefined buffer table at end of programs. STACK; +; and filename buffers now EQUated with offsets ; +; from the last switch/toggle in program instead ; +; of with DS directive. ; +; - Some systems which do NOT have an interrupt ; +; driven keyboard may have noticed problems when ; +; an invalid key was entered in the ZNEWP, ZFORP ; +; and ZMDEL programs. In ZNEWP and ZFORP, if a ; +; CR was entered to pause the output, output was ; +; limited to one line at a time per key pressed. ; +; If an invalid key was hit, output would have ; +; remained in a paused state until one of the ; +; abort keys were pressed. This was difficult to ; +; find since my keyboard is interrupt driven and ; +; I could not duplicate the problem on my own ; +; system. ; +; 02/25/88 v1.47 - No change(s) made to this file ; +; 01/27/88 v1.46 - Some changes were made to ZMDSUBS that are not ; +; directly related to this file ; +; - Fixed typo in help guide reflecting '/' as the ; +; flag to force LF in search routine ; +; 01/17/88 v1.45 - First public release ; +; 12/24/87 v1.01 - Some trivial bugs fixed ; +; 11/10/87 v1.00 - Initial version ; +;- -; + +;-------------------------------------------------------------------------; +; EXTERNAL Declarations: | +;-------------------------------------------------------------------------; + + + EXTRN CKABRT,CMDBUF,DBUF,ERXIT,EXIT,ILPRTB,LINCNT,NOFILE + EXTRN NOFOR,OLDDRV,OLDUSR,PRINTV,RECAR1,RECDR1,RENFCB + EXTRN RSDMA,SHONM4,STACK,TYPE,UCASE,NOFOR + +; +;-------------------------------------------------------------------------; +; Program Starts Here | +;-------------------------------------------------------------------------; + + + .Z80 + ASEG + ORG 100H ; Program starts + JP BEGIN ; Jump around configuration table + INCLUDE ZMDHDR.Z80 ; Include the ZMD header overlay + .REQUEST ZMDSUBS ; Include the ZMD subroutines + +; +; +; Save CP/M stack, initialize new one for this program +; +BEGIN: LD (STACK),SP ; Save return address to CCP + LD SP,STACK ; Initialize new one for this program + +; +; Get current drive/user and save for later +; + LD A,255 + CALL RECAR1 + LD (OLDUSR),A ; Save current user area + LD C,CURDRV + CALL BDOS + LD (OLDDRV),A ; Save current drive + +; +; Tell em who we are +; + LD HL,PUBFOR + CALL PRINTV + +; +; See if descriptions enabled +; + LD A,(DESCRIB) + OR A + JP NZ,BEGIN1 + LD A,(MSGDESC) + OR A + JP Z,NOFOR + +BEGIN1: CALL ILPRTB + DB '(S to Pause - C K or X Abort - ? for Help)' + DB CR,LF,LF,0 + LD A,8 + LD (LINCNT),A + +; +; See if user wants file displayed 'nonstop' ($N) +; + LD A,(TBUF) ; Number of bytes in command tail + OR A ; Were there any? + LD (SHOWALL),A ; Tell rest of program + JP Z,OPNFIL ; Just go display the file if not + + LD A,(FCB+1) ; Get first character on command line + CP '$' ; Must specify '$' first for pause disabling + JP NZ,CKHLP ; Nope, continue normal + + LD A,(FCB+2) ; Get second character on command line + CP 'N' ; 'N' for nonstop display? + JP NZ,CKHLP ; No + + XOR A + LD (SHOWALL),A ; Disable string search + LD (PAGLEN),A ; Else disable page pauses + JP OPNFIL + +; +; See if requesting help +; +CKHLP: LD A,(TBUF+2) ; Get character after space + CP '?' ; ?? + JP NZ,SAVTAIL ; No, save command tail for comparison + + LD A,(TBUF+3) ; Any more chracters? + OR A + JP Z,HELP ; No, so must want HELP + +; +; Move command line buffer to internal buffer +; +SAVTAIL:LD HL,TBUF ; Point to command line buffer + LD B,(HL) ; Character count is first byte into 'B' + LD DE,CMDBUF ; Destination is internal buffer + INC HL ; Increment to ' ', next INC gets first chr + LD A,(HL) ; Get this character + CP ' ' ; Is it a space? + JR Z,SVTAIL1 ; Yes, leave things alone + DEC HL ; No, decrement pointer + +SVTAIL1:INC HL ; Increment to next character + LD A,(HL) ; Into A + LD (DE),A ; Store in internal buffer + INC DE ; Increment pointer + DJNZ SVTAIL1 ; One less character on command line + +; +; Open FOR file +; +OPNFIL: LD A,(USER) ; Get user area to find FOR file + CALL RECAR1 ; Log into it + LD A,(DRIVE) ; Get drive to find FOR file + CALL RECDR1 ; Log into it + + LD HL,FILE ; Initialize internal FCB1 + LD DE,FORNAM ; With FOR filename + CALL RENFCB + + LD DE,FILE ; Internal FCB1 contains filename + LD C,OPEN ; Now attempt open + CALL BDOS + INC A ; Open successful? + LD HL,FORNAM ; Point to FOR filename for 'not found' + JP Z,NOFILE ; No, inform user and abort + +; +; Read a 128 byte record into DBUF at end of program +; + XOR A + LD (FILE+12),A ; Start with first extent + LD (FILE+32),A ; And first record + LD DE,DBUF ; Destination buffer + +; +RDRECD: PUSH DE ; Save current data buffer address + CALL RSDMA ; Reset DMA + + LD C,READ ; Read next record + LD DE,FILE ; From FOR file + CALL BDOS + POP DE ; Get current DBUF address back + OR A ; Read successful? + JP NZ,RERROR ; No, go check EOF + LD HL,TBUF ; 128 byte buffer in page 0 + +WRDLP: LD A,(LINEND) ; At end of line? + OR A + JP Z,WDLP1 ; No + + XOR A + LD (LINEND),A ; Else we aren't anymore + + LD A,(HL) ; Get the character + AND 7FH ; Strip parity + CP '-' ; Start of next description? + JP NZ,WDLP1 ; No + + LD A,3 + LD (DE),A ; Stuff a break for beginning of last descrip + JP SEARCH + +WDLP1: LD A,(HL) ; Get character + AND 7FH ; Strip high bit + CP DEL ; Rubout? + JP Z,NEXT ; Yes, ignore and get next character + CP EOF ; EOF - End of file marker? + JP Z,ENDFIL ; Yes, all done + LD B,A ; Save character for now + LD A,(SHOWALL) ; Looking for specified string? + OR A + LD A,B ; Get our character back now + JP NZ,WDLP2 ; Yes, just write to memory + CALL TYPE ; Output to console + EX AF,AF' ; Save flags (NZ=displaying to console) + LD A,0 ; A=0 disables pausing while checking abort + EX AF,AF' ; Save it for now, get character back + JP WDLP3 ; And see if at end of line + +WDLP2: LD (DE),A ; Else writing to memory + INC DE ; Next buffer position + EX AF,AF' ; Save flags (Z=writing to memory) + LD A,1 ; A=1 enables puasing while checking abort + EX AF,AF' ; Save it for now, get character back + +WDLP3: CP LF ; Are we at end of line? + JP NZ,NEXT ; No get next character + + LD A,(SHOWALL) ; Get string search toggle + LD (LINEND),A ; If set, at end of line, and writng to memory + EX AF,AF' ; AF'=1 enable pauses, disable if 0 + CALL CKABRT ; Check for user abort (and pauses if A=1) + +NEXT: INC L ; One more byte + JP Z,RDRECD ; If no more get next record + JP WRDLP ; Else get next character + +; +; Search for a match with search string +; +SEARCH: PUSH HL ; Save HL + LD HL,CMDBUF ; Point to buffer containing command tail + +SEARC1: LD (CMDPTR),HL ; Save command tail buffer pointer + LD HL,DBUF ; Disk buffer with FOR text + +SEARC2: LD DE,(CMDPTR) ; Get command tail buffer pointer again + PUSH HL ; Save it (command tail pointer still in DE) + +SEARC3: LD A,(DE) ; Get a character + CP '\' ; Force LF? + JP NZ,SEARC4 ; No + LD A,LF ; Else LF value in A for comparison + +SEARC4: INC DE ; Increment to next command tail character + OR A ; Anything there? + JP Z,SEARC8 ; No + CP '|' ; String seperator? + JP Z,SEARC8 ; Yes + LD B,A ; Save character for compare + LD A,(HL) ; Get a FOR text character in A + CALL UCASE ; Convert it to uppercase + +SEARC5: LD C,A ; Put FOR text character in C for now + INC HL ; And increment to next one + LD A,B ; Get comparison character back (from CMDBUF) + CP '?' ; Accept any character? + JP Z,SEARC3 ; Yes, call it a match + CP C ; Else are they the same? + JP Z,SEARC3 ; Yes, call it a match + POP HL ; Else get FOR buffer address back + INC HL ; Increment to next character + LD B,0 ; Initialize count to 0 + LD A,(HL) ; Get next character from FOR buffer + CP CTRLC ; Beginning of description entry? + JP Z,SEARC6 ; Yes + CP 4 ; End of file? + JP NZ,SEARC2 ; No + INC B ; Else, show we hit end of buffer + +SEARC6: LD HL,(CMDPTR) ; Get command tail pointer back + +SEARC7: LD A,(HL) ; Get character from saved command tail + INC HL ; Point to next one + CP '|' ; Searching for multiple strings? + JP Z,SEARC1 ; Yes, go search next one + OR A ; Else are we all done? + JP NZ,SEARC7 ; No, keep looking + LD A,B ; Else see if at end of buffer + OR A + JP NZ,ENDFL1 ; Yes + LD DE,DBUF+1 + POP HL ; Get record count back + JP NEXT ; Go get next + +SEARC8: POP HL + LD A,CR + CALL TYPE ; Output CR for end of line + LD HL,DBUF + +SEARC9: LD A,(HL) ; Get character + CP CTRLC ; Start of description? + JP Z,SEARC10 ; Yes, go get next character + CP 4 ; End of file? + JP Z,ENDFL1 ; Yes + CALL TYPE ; Output character to console + CP LF ; At end of line? + LD A,0 ; Disable page pauses + CALL Z,CKABRT ; Check for aborts + INC HL ; Next character + JP SEARC9 ; Loop until a ^C or ^D + +SEARC10:POP HL + LD DE,DBUF+1 + JP NEXT ; Go get next byte + +; +; The following routine displays the help guide to the user +; +HELP: CALL PRTABT + DB CR,LF + DB 'Usage examples:' + DB CR,LF + DB CR,LF,' FOR Show entire file' + DB CR,LF,' FOR $N Show entire file without paging' + DB CR,LF,' FOR ZMD All descriptions containing string ''ZMD''' + DB CR,LF,' FOR ZMD|LU ''|'' seperates multiple strings to search' + DB CR,LF,' FOR \ZMD ''\'' forces line feed and looks at filenames' + DB CR,LF,' FOR ZM? ''?'' matches any character in this position' + DB CR,LF,0 + + LD A,(INCLDU) + OR A + JP Z,HELP1 + CALL PRTABT + DB ' FOR (B0:) Descriptions for files received on B0:',0 + +HELP1: CALL PRTABT + DB CR,LF,0 + LD A,(DSTAMP) + OR A + JP Z,HELP4 + LD A,(EDATE) + OR A + JP Z,HELP2 + CALL PRTABT + DB ' FOR ??/12',0 + JP HELP3 + +HELP2: CALL PRTABT + DB ' FOR 12/??',0 + +HELP3: CALL PRTABT + DB ' Show files received in month of December',0 + +HELP4: CALL ERXIT + DB CR,LF,LF,LF,LF,'$' + +; +; Inline print routine checks for user abort on each line feed +; +PRTABT: POP HL ; Get address following CALL + +AM1: LD A,(HL) ; Character in A + OR A ; Null terminator? + JP Z,AM2 ; Yes, all done + CALL TYPE ; Else output to console + CP LF ; Was it a LF? + LD A,0 ; Enable page pauses + CALL Z,CKABRT ; Check for user abort, or pause request + INC HL ; Point to next character + JP AM1 ; Loop until a null + +AM2: PUSH HL ; Current address in HL=return address + RET + +; +; +RERROR: CP 1 + JP Z,ENDFIL + CALL ERXIT + DB '-- Source file read error$' +; +ENDFIL: LD A,(SHOWALL) + OR A + JP Z,ENDFL1 + LD A,4 + LD (DE),A + JP SEARCH + +ENDFL1: LD C,CLOSE + LD DE,FILE + CALL BDOS + CALL ERXIT + DB CR + DB '-----' + DB CR,LF + DB '-- End of file --$' + + +; +; These next are dummy routines to satisfy external ZMDSUBS requests. +; They do nothing, but leave alone +; +DONE:: JP EXIT +TIME:: RET + + +LINEND: DB 0 +SHOWALL:DB 0 +CMDPTR: DW 0 + + + END + \ No newline at end of file diff --git a/Source/Apps/ZMD/zfors.z80 b/Source/Apps/ZMD/zfors.z80 new file mode 100644 index 00000000..3461842c --- /dev/null +++ b/Source/Apps/ZMD/zfors.z80 @@ -0,0 +1,233 @@ +; + + TITLE ZFORS.Z80 - 09/29/88 - ZMD Sysop Description Utility +; Copyrighted (c) 1987, 1988 +; Robert W. Kramer III + + PAGE +;- -; +; Update History ; +; ; +; Date Release Comments ; +; -------- ------- ---------------------------------------------- ; +; ; +; 09/29/88 v1.50 - Added trivial routines to display the user's ; +; prompt selections to screen. ; +; 03/13/88 v1.49 - No changes made to this file ; +; 03/13/88 v1.48 - Had a small problem with TPA fix which has been ; +; corrected. CHKTPA was calculating the total ; +; number of bytes available for DBUF, but wasn't ; +; clearing register L (forcing an even amount of ; +; sectors before initializing OUTSIZ buffer limit ; +; comparison word). This may have introduced ; +; minimal garbage to your FOR file if your FOR ; +; file is large enough to fill available TPA with ; +; ZMD, ZFORS or to the log file if running ZMDEL. ; +; - Rewrote OUTCHR routine in ZMDSUBS. ; +; - Redefined buffer table at end of programs. STACK; +; and filename buffers now EQUated with offsets ; +; from the last switch/toggle in program instead ; +; of with DS directive. ; +; - Some systems which do NOT have an interrupt ; +; driven keyboard may have noticed problems when ; +; an invalid key was entered in the ZNEWP, ZFORP ; +; and ZMDEL programs. In ZNEWP and ZFORP, if a ; +; CR was entered to pause the output, output was ; +; limited to one line at a time per key pressed. ; +; If an invalid key was hit, output would have ; +; remained in a paused state until one of the ; +; abort keys were pressed. This was difficult to ; +; find since my keyboard is interrupt driven and ; +; I could not duplicate the problem on my own ; +; system. ; +; 02/25/88 v1.47 - No change(s) made to this file +; 01/27/88 v1.46 - Set MODE to 255 so ZMDSUBS knows we might be ; +; running in local mode and not to worry if BYE ; +; is running or not when CHKENV checks to see ; +; which clock features are valid. ; +; 01/17/88 v1.45 - First public release ; +; 12/06/87 v1.02 - Fixed numerous trivial bugs. ; +;- -; + +;-------------------------------------------------------------------------; +; EXTERNAL Declarations: | +;-------------------------------------------------------------------------; + + + EXTRN CLRLIN,DECOUT,DSCFLG,ERXIT,EXIT,FILCNT,GETDAT + EXTRN GETDSC,GETFN,GETKIND,ILPRTB,INPUT,NEWNAM,OLDDRV + EXTRN OLDUSR,OPNFOR,PRINTV,RECAR1,SHOCAT,STACK,TYPE + EXTRN UCASE,NOFOR,MODE + +; +;-------------------------------------------------------------------------; +; Program Starts Here | +;-------------------------------------------------------------------------; + + + .Z80 + ASEG + ORG 100H ; Program starts + JP BEGIN ; Jump around configuration table + INCLUDE ZMDHDR.Z80 ; Include the ZMD header overlay + .REQUEST ZMDSUBS ; Include the ZMD subroutines + +; +; +; Save CP/M stack, initialize new one for this program +; +BEGIN: LD (STACK),SP ; Save return address to CCP + LD SP,STACK ; Initialize new one for this program + +; +; Save current drive/user +; + LD A,255 ; Get current user + CALL RECAR1 + LD (OLDUSR),A ; Store it + LD C,CURDRV ; Get current drive + CALL BDOS + LD (OLDDRV),A ; Store it + +; +; Disable sleepy caller timeout and set description routines for up to +; 50 new entries +; + XOR A + LD (DESWAIT),A ; Disable sleepy caller timer + LD A,50 + LD (FILCNT),A ; Allow up to 50 descriptions + + LD A,255 + LD (MODE),A ; Tell ZMDSUBS we're a sysop utility + +; +; Display program name and version +; +BEGIN1: LD HL,SYSFOR ; Point to name of this program + CALL PRINTV ; Display it + + LD A,(DESCRIB) ; Regular FOR descriptions? + OR A + JP NZ,MAKDESC ; Yes, skip next + + LD A,(MSGDESC) ; BBS message base descriptions? + OR A + JP Z,NOFOR ; No, descriptions disabled + LD A,1 + LD (DSCFLG),A ; Set flag to show message base descriptions + LD A,(PRUSR) ; Get the private user + LD (USER),A ; FOR destination + LD A,(PRDRV) ; Get the private drive + LD (DRIVE),A ; FOR destination + JP MAKFN ; Skip date stuff + +; +; Get the date of the upload if suppose to. +; +MAKDESC:LD A,(DSTAMP) ; Datestamping description header? + OR A + JP Z,MAKFN ; No, go get filename + CALL ILPRTB + DB 'Date of upload: ',0 + CALL GETDAT ; Get the date + +; +; Get the filename (no spaces with '.' filename seperator) +; +MAKFN: CALL ILPRTB + DB CR,LF + DB ' Name of file: ',0 + CALL GETFN ; Get filename + CALL CLRLIN ; Clear current line + LD A,B ; Get filename bytes remaining count in A + CP 11 ; Anything entered? + JP NZ,GOTNM1 ; Yes, skip this + +; +; No filename was entered, check for save or abort, else continue +; + CALL ILPRTB + DB 'Save, Continue, Abort: ',0 + CALL INPUT ; Get character + CALL UCASE ; Convert to uppercase + CP 'S' ; Save changes? + JP Z,OPNFOR ; Yes, write current buffer to FOR file + + CP 'A' ; Abort program? + JP NZ,BEGIN1 ; No, get next character + CALL ILPRTB + DB CR + DB 'Abort with NO changes? ',0 + CALL INPUT + CALL UCASE + CP 'Y' + JP NZ,BEGIN1 + JP EXIT ; Then abort + +; +; Display file descriptor/upload areas and get choice +; +GOTNM1: CALL GETKIND ; Get file category for description header + +; +; Show the drive/user +; + LD A,(MSGDESC) ; Using BBS message base for descriptions? + OR A + JP NZ,SHOWDU ; Yes, show drive/user of uploaded file + LD A,(INCLDU) ; Include du in description header? + OR A + JP Z,SHOWFN ; No, then skip this stuff + +SHOWDU: LD A,(DRV) ; Get upload drive + CALL TYPE ; Output to console + LD A,(USR) ; Get upload user area + LD H,0 + LD L,A ; In A + CALL DECOUT ; Decimal output routine + LD A,':' ; Output colon + CALL TYPE + +; +; Show the filename +; +SHOWFN: LD HL,NEWNAM + +SHONM1: LD A,(HL) + CP LF + JP Z,SHOWCT + CALL TYPE + INC HL + JP SHONM1 + +; +; Show the file descriptor/upload area +; +SHOWCT: LD A,(ASKIND) ; Supposed to be showing file descriptor? + OR A + JP Z,MKENTRY ; No, get the description + CALL ILPRTB + DB ' - ',0 + CALL SHOCAT ; If so, show it + +; +; Get up to 7 lines for description +; +MKENTRY:CALL GETDSC ; Get up to 7 lines for description + JP NZ,BEGIN1 ; If none entered, or incorrect, skip next + + LD IY,FILCNT ; Else point to maximum entries left + DEC (IY) ; One less to go + JP BEGIN1 ; Get next one + +; +; These next are dummy routines to satisfy ZMDSUBS external requests. +; They do nothing, but leave them alone. +; +DONE:: JP EXIT ; Exit routine can take care of us +TIME:: RET + + + END + \ No newline at end of file diff --git a/Source/Apps/ZMD/zmap.z80 b/Source/Apps/ZMD/zmap.z80 new file mode 100644 index 00000000..4af048d8 --- /dev/null +++ b/Source/Apps/ZMD/zmap.z80 @@ -0,0 +1,268 @@ +; + + TITLE ZMAP.Z80 - 09/29/88 - ZMD System MAP Utility +; Copyrighted (c) 1988 +; Robert W. Kramer III + + PAGE +;- -; +; Update History ; +; ; +; Date Release Comments ; +; -------- ------- ---------------------------------------------- ; +; ; +; 09/29/88 v1.50 - Initial release ; +;- -; + +;-------------------------------------------------------------------------; +; EXTERNAL Declarations: | +;-------------------------------------------------------------------------; + + + EXTRN EXIT,ILPRTB,OLDDRV,OLDUSR,PRINTV,RECAR1,STACK,TYPE + EXTRN KIND,CATADR,SHONM4,WHLCHK,DECOUT + +; +;-------------------------------------------------------------------------; +; Program Starts Here | +;-------------------------------------------------------------------------; + + + .Z80 + ASEG + ORG 100H ; Program starts + JP BEGIN ; Jump around configuration table + INCLUDE ZMDHDR.Z80 ; Include the ZMD header overlay + .REQUEST ZMDSUBS ; Include the ZMD subroutines + +; +; +; Save CP/M stack, initialize new one for this program +; +BEGIN: LD (STACK),SP ; Save return address to CCP + LD SP,STACK ; Initialize new one for this program + +; +; Save current drive/user +; + LD A,255 ; Get current user + CALL RECAR1 + LD (OLDUSR),A ; Store it + LD C,CURDRV ; Get current drive + CALL BDOS + LD (OLDDRV),A ; Store it + +; +; +; Display program name and version +; +BEGIN1: LD HL,MAPNAM ; Point to name of this program + CALL PRINTV ; Display it + + LD A,(ASKAREA) + OR A + JP Z,NOTDEF ; Upload areas not enabled, Abort + + CALL WHLCHK + JP Z,BEGIN2 + LD A,1 + LD (SPECIAL),A + +BEGIN2: CALL HBORD + + LD A,'A' + LD (KIND),A + + LD A,(MAXTYP) + RRA + PUSH AF + + LD A,(MAXTYP) + SUB A,'A' + RRA + LD C,A + + POP AF + JP NC,NOTODD + LD A,1 + LD (ISODD),A + +NOTODD: INC C + LD A,'A' + ADD A,C + LD C,A ; C contains letter of 2nd column descriptors + + LD A,(MAXTYP) + SUB A,'@' + LD B,A ; B contains binary number of descriptors + + LD DE,DESTBL ; DE contains address to 26 byte table + LD A,C + EX AF,AF' + LD A,'A' ; Initialize first entry + +SETLP: LD (DE),A + INC DE + INC A + EX AF,AF' + DJNZ SETLP + LD A,0 + LD (DE),A ; Stuff terminator for display routines + +; +; Main program loop +; +LOOP: LD A,(COLM) + OR A + JP NZ,DOCOL2 + + CALL ILPRTB + DB ' | ',0 + JP ATEND + +DOCOL2: CALL ILPRTB + DB ' || ',0 + +ATEND: CALL SHOWFD + CALL SHOWDU + LD A,(COLM) + OR A + JP Z,ATEND1 + CALL ILPRTB + DB ' |' + DB CR,LF,0 + XOR A + JP ATEND2 + +ATEND1: LD A,1 + +ATEND2: LD (COLM),A + + LD HL,(TBLSAV) + INC HL + LD (TBLSAV),HL + LD A,(HL) + LD (KIND),A + OR A + JP NZ,LOOP + + LD A,(ISODD) + OR A + JP Z,ISDN1 + +ISDONE: CALL ILPRTB + DB ' || ',0 + LD A,(SPECIAL) + OR A + JP Z,IS1 + CALL ILPRTB + DB ' ',0 + +IS1: CALL ILPRTB + DB ' |',CR,LF,0 + +ISDN1: CALL HBORD + CALL ILPRTB + DB CR,LF + DB ' Use FOR/NEW to view recent upload description/log listings.' + DB 0 + JP EXIT +; +; +SHOWDU: LD A,(KIND) + SUB 'A' + RLA + RLA + LD D,0 + LD E,A + LD IY,TYPTBL + ADD IY,DE + LD A,(IY) + CALL TYPE + + LD A,(IY+1) + CALL SHODU1 + + CALL ILPRTB + DB ' ',0 + + LD A,(SPECIAL) + OR A + RET Z + + LD A,(IY+2) + CALL TYPE + + LD A,(IY+3) + +SHODU1: CP 10 + PUSH AF + + LD H,0 + LD L,A + CALL DECOUT + CALL ILPRTB + DB ':',0 + + POP AF + RET C + + CALL ILPRTB + DB ' ',0 + RET + +; +; +SHOWFD: CALL CATADR + INC DE + INC DE + LD B,23 + +SHOFD1: LD A,(DE) + CALL TYPE + INC DE + DJNZ SHOFD1 + CALL ILPRTB + DB ' ',0 + RET + +; +; Show horizontal border for top and bottom +; +HBORD: CALL ILPRTB + DB ' ================================================================',0 + LD A,(SPECIAL) + OR A + JP Z,HBORD1 + CALL ILPRTB + DB '==========',0 + +HBORD1: CALL ILPRTB + DB CR,LF,0 + RET + +NOTDEF: CALL ILPRTB + DB CR,LF + DB 'ZMD Upload Routing feature not enabled, ',0 + LD HL,MAPNAM + CALL SHONM4 + CALL ILPRTB + DB 'aborting...',0 + JP EXIT +; +; These next are dummy routines to satisfy ZMDSUBS external requests. +; They do nothing, but leave them alone. +; +DONE:: JP EXIT ; Exit routine can take care of us +TIME:: RET + +TBLSAV: DW DESTBL +DESTBL: DB 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +ISODD: DB 0 +COUNT: DB 0 +COLM: DB 0 +SPECIAL:DB 0 + + + END + \ No newline at end of file diff --git a/Source/Apps/ZMD/zmd.pdf b/Source/Apps/ZMD/zmd.pdf new file mode 100644 index 00000000..464b212e Binary files /dev/null and b/Source/Apps/ZMD/zmd.pdf differ diff --git a/Source/Apps/ZMD/zmd.ws b/Source/Apps/ZMD/zmd.ws new file mode 100644 index 00000000..26359638 --- /dev/null +++ b/Source/Apps/ZMD/zmd.ws @@ -0,0 +1,1144 @@ +. MARGINS: RIGHT=65; LEFT= +.op +.he** 09/29/88 ** ZMD Reference Manual - Version 1.50 +.foCopyright (c) 1987, 1988 Robert W. Kramer III ALL RIGHTS RESERVED + + + + + + + + + + + + + + + + + + + + + ZMD File Transfer Program for the Z80 RCP/M + + External Reference Specification + + ZMD - Version 1.50 +.PA Š.pn 1 +.he** 09/29/88 ** ZMD Reference Manual - Version 1.50 Page # + +     CONTENTS + +     1.° Introductioî tï ZMD..........................® 4 + +     2.° Applicablå Files.............................® 5 + +     3.° Installation.................................® 8 + +      3.± Locaì CRÔ Cleaò Screeî Sequences.............. 8 + +      3.² Input/Output.................................. 8 +      3.2.± Modeí......................................... 8 +      3.2.² Microprocessoò Speed.......................... 9 +      3.2.³ Modeí Speeä Indicatoò Byte.................... 9 +      3.2.´ Disë Writå Locë Flag.......................... 9 +      3.2.µ Sleepù Calleò Timeout......................... 9 +      3.2.¶ Minimuí Speeä foò 1ë Blocks................... 9 +      3.2.· File Transfer Buffer Queue.................... 10 +      3.2.¸ Pagå Pausing.................................. 10 +         3.2.9 Automatic Calculation of Disk Buffer Size..... 10 + +      3.³ Timekeeping................................... 11 +      3.3.± MBYE/BYEµ Clocë Support....................... 11 +      3.3.² ZMÄ Internaì Clock/Datå Readeò Code........... 11 +      3.3.³ Restrictinç Downloadó tï Timå Left............ 12 +      3.3.´ Maximuí Timå Allowed.......................... 12 +      3.3.µ Displaù Timå oî Systeí messages............... 12 +      3.3.6 Logon Hour/Minute Addresses................... 12 + +      3.´ Accesó Restrictions........................... 13 +      3.4.± ZCMD/ZCPR..................................... 13 +      3.4.² WHEEÌ Byte.................................... 13 +      3.4.³ Maximuí Drive/User............................ 13 +      3.4.´ BYE/BBÓ Prograí Accesó Flaç Byte.............. 13 + + 3.µ Uploaä Configuration.........................® 14 +      3.5.± Preformatteä BBÓ Messagå Uploads.............. 14 +      3.5.² Hidinç Ne÷ Uploadó Untiì Approveä bù Sysop.... 14 +      3.5.³ Uploaä Routinç tï Multiplå Drive/Users........ 14 +      3.5.4 Uploadinç tï Specifieä Drive/User............. 14 +      3.5.5 Receivinç Privatå Uploads..................... 15 +      3.5.¶ Creditinç Uploaä Timå tï Timå Left............ 15 +      3.5.· Receivinç .COÍ Fileó Securely................. 15 + +      3.¶ Uploaä Descriptions........................... 16 +      3.6.± Forwardinç Descriptionó tï BBÓ Messagå Base... 16 +      3.6.² Forwardinç Descriptionó tï FOÒ Texô File...... 16 +      3.6.³ Desriptioî Filå Filename/Drive/User........... 16 +      3.6.´ Uploaä Descriptioî Headeò Information......... 17 +      3.6.µ Includinç Filå Descriptors.................... 17 +      3.6.¶ Includinç Uploaä Drive/Useò Area.............. 17 +      3.6.· Datestampinç thå Descriptioî Header........... 17 +      3.6.¸ Overridinç Descriptioî Requests............... 17 +      3.6.¹ Automatiã Worä Wrap........................... 18 Š +      3.· Downloaä Configurations....................... 19 +      3.7.± Restrictinç .LBÒ anä Singlå F± Taggeä Files... 19 +      3.7.² Disallo÷ Sendinç .COÍ Files................... 19 +      3.7.³ Disallo÷ Sendinç .??£ Files................... 19 +      3.7.´ Disallo÷ Sendinç F² Taggeä $SYSteí Files...... 20 +      3.7.µ Sendinç F³ Taggeä Fileó Regardlesó oæ Access.. 20 +      3.7.¶ Speciaì Sysoð Downloadó tï Selecteä Caller.... 20 + +      3.¸ Logkeeping.................................... 21 +      3.8.± Makinç ZMD.LOÇ File..........................® 21 +      3.8.² Europeaî Datå Formaô (DD/MM/YY)............... 21 +      3.8.³ Transfeò Loç Drive/User/Filename.............. 21 +      3.8.´ LASTCALÒ Filå Information..................... 21 +      3.8.µ Countinç Filå Transferó foò BBÓ Software...... 21 + +.pa Š +     APPENDICES + + +     APPENDIØ A.............................................. 23 + +      A.± Modem Interface............................... 23 + A.1.1 Creating Modem I/O Overlays................... 23 + A.1.2 Installing Modem I/O Overlays................. 23 + + +     APPENDIØ B.............................................. 25 + +      B.± RTà Clock/Datå Readeò Codå.................... 25 + + +     APPENDIØ C.............................................. 26 + +      C.± Filå Descriptors/Categories................... 26 + + +     APPENDIØ D.............................................. 27 + +      D.± Uploaä Routinç Table.......................... 27 +.pa Š +     1.° Introductioî tï ZMD + +     ZMÄ  ió  á  Remotå CP/Í Filå  Transfeò  Prograí  writteî  iî +     MICROSOFÔ  MACRO-8° languagå usinç ZILOÇ Z8°  assembler®  Iô +     wilì  ruî  oî anù Z8° microprocessoò usinç CP/Í ² oò  ³  anä +     provideó  fulì supporô foò systemó runninç ZCMÄ oò ZCPÒ  CCÐ +     replacement® ZMÄ caî bå configureä tï ruî undeò mosô populaò +     remotå  consolå  programs¬  buô ió  primarilù  targeteä  foò +     BYE5+¬  MBYÅ anä BYE3¬ oò aó aî entirelù stanä alonå prograí +     usinç  modem/porô overlayó foò modeí I/O®  Fulì supporô  ió +     provideä foò mosô oæ thå populaò BBÓ softwarå sucè aó  PBBS¬ +     MBBS¬  RBBS¬ Metal¬ Oxgate¬ ZBBÓ anä others® Communicationó +     programó sucè aó MODEM7¬ MEX¬ MEX+¬ PROCOMM¬ ProYam¬ QMODEM¬ +     IMÐ anä otheró arå alì alsï fullù compatible. + +     Thió  manuaì  ió  noô intendeä tï bå specifiã iî  detaiì  tï +     thå internaì characteristicó oæ ZMÄ anä utilities®  Iô  waó +     writteî  aó á guidå tï helð thå implementeò decidå whicè  oæ +     thå  optionó anä featureó wilì bå useä oî hió  system® + +     Aî  internaì referencå manuaì coverinç thå ZMDSUBS.REÌ  filå +     anä  user'ó  manuaì  haó  beeî  iî  thå  making®  Additionaì +     modem/porô overlayó wilì bå addeä tï thå ZMDOVLn.LBÒ filå aó +     theù  arå  created®  Á ZMDCLOCK.LBÒ ió beinç considereä  foò +     organizinç  approveä RTà inserts®  Therå arå  manù  planneä +     features®  Iæ  yoõ havå anù ideaó foò changeó oò additions¬ +     feeì freå tï contacô me. + +  Robert W. Kramer III RI RCPM-RDOS (128mb) +  1569 40th St. 300/1200/240° - 24hrs +  Rock Island, Il 61201 Data: (309) 786-6227 +      Voiceº (309© 786-671± + +     Features: + +      ï  Menõ driveî instalì prograí with intelligence +      o Automatic installation of new releases +      ï  User definable modeí/port I/Ï routineó +      ï  µ seconäs to gather 255 filenames in batch mode! +      o Multiple drive/users fully supported in Batch send +      o Overlayable .COM file installation +      o Upload routing to multiple drive/user areas +      o Time and Datestamping in upload description header +      o 100% MBYE/BYE3/BYE5 compatible + o Truly capable of standalone operation +      o Automatic batch enable (eliminates the 'SB' command) +      o Automatic 'k' block detection of host +      o Fully CP/M 2.n and CP/M 3.n compatible +      o ARC/ARK/LBR member extraction support +      o Automatic BYEBDOS - I/O overlay detection +      ï  Fasteò erroò checkinç resultinç iî quicker transfers + o No delays between files in batch transfers +.pa Š +     2.0 Applicable Files + +     Filenamå Kâ Purpose +     ZMDHDR .Z80 Thió  filå  containó  alì  thå  prograí +                          switcheó  anä valueó lookeä aô  bù  alì +                          thå ZMÄ programs®  Iô ió noô needeä iæ +                          usinç  thå installatioî prograí ZINSTÌ. + +     ZMDSUBS.REL‚ Contains the common subroutines for all + ZMÄ  anä  supporô utilities®  Thió  ió +                          useä  wheî  linkinç á  newlù  assembleä +                          versioî oæ onå oæ thå programs® Sourcå +                          codå ió noô releaseä foò thió file® + +     ZINSTL .COM Thió  ió  thå instalì prograí  useä  tï +      configurå thå ZMD anä utilitù programs® +                          Wheî firsô ran¬  ZINSTÌ readó thå firsô +                          1°  recordó  oæ ZMD.COÍ oî thå  currenô +                          drive/user®  Iæ noô found¬ promptó foò +                          á ne÷ drive/useò tï loç intï anä  trieó +                          again®  Á  fasô  anä easù tï uså  menõ +                          driveî  displaù  showinç  alì   currenô +                          prograí settings®  Afteò editinç anù oæ +                          thå switches/values¬ á selectioî oæ 'J§ +                          iî thå maiî menõ wilì writå thå currenô +                          configuratioî   (firsô  11  recordó  oæ +                          ZINSTL©  bacë  tï ZMD anä ALÌ  oæ  it'ó +                          utilities® Uså iô oî thå flù tï changå +                          switcheó  anä  valueó  quicklù  withouô +                          havinç  tï  reassemblå  anything®  Thió +                          takeó  onlù secondó anä allowó yoõ  thå +                          versatilitù oæ changinç addresses¬ filå +                          descriptors/categories¬ upload/downloaä +                          drive/useò  areas¬  timå  restrictions¬ +                          etc®  Anythinç founä iî thå ZMDHDR.Z8° +                          configuratioî headeò caî bå editeä froí +                          withiî  ZINSTL®  Sourcå  codå  ió  noô +                          provideä foò thió program®  Iæ yoõ makå +                          anù  modificationó  tï  thå  ZMDHDR.Z8° +                          configuratioî  file¬   ZINSTÌ  wilì  NÏ +                          longeò  bå  ablå tï instalì  youò  .COÍ +                          fileó properly. + +     ZMD  .COM‚  Maiî filå  transfeò  program®  Leavå + ZMD .Z80  thió onå onlinå foò publiã uså (Usuallù +                          A0:)® Iô provideó fulì systeí securitù +                          whilå   presentinç   á  useò   freindlù +                          interfacå  tï  uploadó  anä  downloads® +                          YMODEÍ 1ë anä YMODEÍ 1ë  Batch¬  XMODEÍ +                          12¸  bytå  CRC¬  anä  XMODEÍ  12¸  bytå +                          checksuí  arå supporteä witè  automatiã +                          protocoì detect. +.pa Š +     Filenamå Kâ CRà Purpose + ZMAP .COM Publiã upload/downloaä matriø displaù +     ZMAP .Z80          program®  Alsï  completelù  installablå +                          witè thå ZINSTÌ program®  Privatå areaó +                          are shown only if WHEEL byte is on. + +     ZFORS .COM Sysoð descriptioî filå utility® Thió +     ZFORS .Z80 onå    allowó   thå   Sysoð   tï    adä +                          descriptionó  tï thå FOÒ texô filå  (oò +                          BBÓ  messagå base)®  Thió prograí wilì +                          noô   ruî   unlesó   descriptionó   arå +                          enabled. + +     ZNEWÓ .COM‚ Sysoð filå transfeò loç utility® Thió +     ZNEWS .Z80 onå  allowó  thå Sysoð  tï  appenä  thå +                          ZMD.LOÇ  filå witè á ne÷ uploaä  entry® +                          Thió  procedurå  currentlù  supportó  ± +                          entry per program run. + +     ZMDEÌ .COM‚ Sysoð filå transfeò loç purgå utility® +     ZMDEL .Z80 Cleanó  thå ZMD.LOÇ filå oæ alì entrieó +                          excepô foò "R¢ uploadeä entries®  Thió +                          keepó  thå  loç filå  aô  á  reasonablå +                          size. + +     ZNEWР .COM‚ Publiã filå transfeò loç utilitù allowó +     ZNEWP .Z80 calleró  tï quicklù vie÷ statisticó  oæ +                          recenô  uploadó sucè aó thå drive/user¬ +                          filå sizå iî kilobytes¬  datå oæ uploaä +                          (iæ  clock/datå optionó  arå  enabled)¬ +                          etc®  Thió  prograí ió usuallù  placeä +                          on A0:. + +     ZFORР .COM‚ Publiã uploaä descriptioî search anä +     ZFORP .Z80 displaù  utility®  Useró  caî vie÷  thå +                          descriptionó   onlinå  oæ   thå   fileó +                          recentlù   uploaded®   Strinç   searcè +                          capabilitieó  arå  supporteä  tï  allo÷ +                          'picking§ thå descriptionó desired®  Á +                          calleò    caî    quicklù    vie÷    alì +                          descriptionó pertaininç tï 'IBM'¬ 'Z80§ +                          oò anù strinç thaô wilì fiô oî thå hosô +                          system'ó   commanä   line®   Multiplå +                          strinç searcè ió alsï supported¬  aó ió +                          datå  searcheó (iæ enabled©  anä  fileó +                          locateä  iî  á specifiã drive/useò  (iæ +                          thaô  featurå  ió  enabled)®   Á  nicå +                          companion for ZMD. + + +.pa Š + + + + + + + + + + + + + + +     ------------------------------------------------------------ +     NOTEº  Tï  prevenô possiblå discrepencieó withiî thå ZMDSUBÓ +     subroutineó file¬  alì programó havå beeî designeä tï  aborô +     witè  erroò iæ thå program'ó maiî featurå ió disabled®  Foò +     example¬  ZFORÓ  wilì  noô ruî unlesó iô haó beeî  installeä +     witè descriptionó enabled® ZMÄ caî noô bå disabled¬ howeveò +     wilì  aborô  witè erroò iæ thå modeí I/Ï  routineó  arå  noô +     found® Pleaså dï noô trù tï disable thió prograí function. +     ------------------------------------------------------------ +.pa Š +     3.0 Installation + +     3.1 Local CRT Clear Screen Sequences + +     CLRSCRΠ seô  tï  YEÓ enableó ZMÄ anä alì utilitù  fileó  tï +     cleaò  youò screeî locallù durinç batcè filå  transferó  anä +     menõ displays®  Iæ youò terminaì requireó á ^Ú (1AH)¬  leavå +     CLRSTR‚ alone® Otherwiså yoõ wilì havå tï includå youò cleaò +     screeî sequencå aô labeì CLRSTR® Uð tï ¶ byteó arå allowed. +     This CLS sequence is terminated with a '$'. + +     STOPº Iæ runninç ZMÄ anä utilitieó aó á stanä alonå packagå +     anä  youò  locaì  consolå outpuô vectoò  addresó  cannoô  bå +     calculateä  usinç standarä CP/Í conventionó (i.e®  youò BIOÓ +     JР tablå haó beeî altered)¬  yoõ wilì neeä tï providå  thå +     addresó yourselæ aô labeì CONOUÔ iî youò port/modeí overlay® +     Thió ió cruciaì tï ZMÄ eveî wheî noô usinç thå cleaò  screeî +     featurå  aó thå recorä counô ió displayeä locallù durinç thå +     filå transfeò anä anù outpuô oæ thió naturå tï thå modeí  aô +     thió timå woulä causå seriouó problems. + + +     3.2 Input/Output + +     3.2.1 Modem + +     ZMÄ provideó fulì supporô foò thå Extendeä BDOÓ calló seô uð +     bù  somå  Remotå Consolå Programó sucè aó BYEµ  oò  MBYE44+® +     Iî ordeò tï uså thió method¬ simplù skið thå overlaù procesó +     outlineä iî APPENDIØ A® Iæ nï overlaù ió included¬ ZMÄ wilì +     uså  BYE'ó modeí I/Ï routineó alreadù  established®  Iæ  aî +     attempô  tï seô thå currenô useò areá tï 24± returnó á valuå +     oæ  7· iî registeò A¬  thå followinç calló tï BDOÓ  musô  bå +     handled by your BYE program: + +      BDOS +      Call Function +      ---- --------------------- +      61 Check receive ready +      62 Check send ready +      63 Send a character +      64 Receive a character +      65 Check carrier +      66 Console status +      67 Console input +      68 Local console output  + +     Iæ  youò BYÅ prograí doeó noô seô uð it'ó modeí I/Ï routineó +     foò  publiã  accesó bù outsidå programs¬  yoõ wilì  havå  tï +     follo÷  thå  overlaù  procedurå outlineä iî  APPENDIØ  Á  oî +     Modem Interface‚ tï instalì youò modeí routines. + +     NOTE:‚  Thió  featurå ió fullù automatic®  Nï  matteò  whicè +     methoä  yoõ use¬  ZMÄ wilì know® Š +     3.2.2 Microprocessor Speed + +     MHÚ  ió  defineä tï represenô youò  system'ó  microprocessoò +     speed® Thió allowó ZMD tï accuratelù timå delayó anä sleepù +     calleò timeouts® Musô bå integeò valuå iî thå rangå oæ 1-9. + + +     3.2.3 Modem Speed Indicator Byte + +     MSPEEÄ  shoulä  contaiî  thå  addresó oæ  youò  modeí  speeä +     indicatoò  byte®  Thió ió needeä sï thaô ZMÄ caî  calculatå +     thå  amounô  oæ timå needeä foò transferó anä  foò  transfeò +     speeä  insertioî iî thå loç filå entry®  Youò  BYÅ  prograí +     shoulä  stufæ  thió integeò valuå somewherå  iî  memory®  Aî +     integeò valuå oæ 1-¹ musô corresponä aó illustrated: + +          Value Bps Value Bps +      ----- ------- ----- ------- +      1 300 7 4800 +      5 1200 8 9600 +      6 2400 9 19200 + + +     3.2.4 Disk Write Lock Flag +      +     WRTLOà ió  thå higè memorù bytå togglå useä  foò  disablinç +     BYE'ó  abilitù  tï hanç uð wheî thå caller'ó timå ió  uð  oò +     carrieò ió lost®  Thió allowó currenô disë writå operationó +     tï  bå completeä first®  Checë youò BBÓ documentatioî - manù +     moderî systemó don'ô neeä this®  Iæ unsure¬ seô thió tï NO® +     Codå  tï seô anä reseô thió togglå assumeó iô tï bå  locateä +     LOCOFÆ byteó froí thå JÐ COLDBOOÔ vectoò aô thå beginninç oæ +     thå BYÅ BIOÓ jumð table® (YEÓ foò MBBÓ anä PBBS). +      + +     3.2.5 Sleepy Caller Timeout + +     DESWAIÔ  ió  thå numbeò oæ minuteó oæ inactivitù  durinç  aî +     uploaä  descriptioî oò anù prompô beforå abortinç thå  inpuô +     routine®  (0-255¬  ° disableó thió feature)®  Iæ á timeouô +     occuró durinç descriptioî entry¬  thå currenô disë buffeò ió +     writteî tï disë anä thå prograí exitó tï CP/Í givinç controì +     back to your BYE program (if WRTLOC is YES). + + +     3.2.6 Minimum Speed for 1k Blocks + +     MINKSPD‚ ió thå minimuí modeí speeä alloweä tï transfeò fileó +     usinç 1ë blocks®  Iæ oî á networë sucè aó Pà Pursuit¬  anä +     arå ablå tï receivå incominç calls¬ seô thió bytå tï 1® Thå +     delayó  theså networkó uså tï senä datá bacë anä fortè  makå +     1ë packetó advantageouó tï eveî 30° bpó users®  Iæ noô oî á +     networë sucè aó Pà Pursuit¬ it'ó á matteò oæ preference¬ Seå + illustratioî iî figurå 3.2.³ foò lisô oæ modeí speeä values. Š +     3.2.7 File Transfer Buffer Queue + +     BUFSIÚ  allowó yoõ tï changå thå numbeò oæ 1ë blockó  beforå +     writinç  buffeò tï disk®  Normaì disë systemó caî  transfeò +     16ë  froí computeò tï disë iî 2-3-´ secondó  oò  less®  Somå +     verù  slo÷  5-1/4¢ floppù systemó (sucè aó Nortè  Star©  maù +     takå uð tï 20-3° secondó tï transfeò 16k®  Thió woulä causå +     severaì timeoutó aô 1° secondó each®  Iæ yoõ experiencå anù +     timeouts¬ trù changinç thió tï somethinç smaller¬ perhapó 8ë +     oò eveî 4k. +      + +     3.2.8 Page Pausing + +     PAGLEΠ ió seô tï thå numbeò oæ lineó tï displaù iî  betweeî +     [moreÝ  pauseó  anä menõ displays®  (Seô tï  °  tï  disablå +     page pauses. + + +     3.2.9 Automatic Calculation of Disk Buffer Size + +     STDBUF‚ enableä telló ZMÄ programó tï calculatå thå amounô oæ +     memorù  availablå  foò  routineó  usinç  DBUÆ  disë  buffer® +     OUTSIÚ  wilì adjusô accordinç tï thå contentó oæ locatioî  ¶ +     anä 7® Iæ BYÅ ió running¬ thió valuå ió useä aó is¬ elså iæ +     BYÅ  ió NOT‚ running¬  0806È ió subtracteä froí thió  addresó +     locatioî ¶ anä 7®  Iî eitheò case¬ thå enä oæ prograí valuå +     determineä aô timå oæ assemblù ió subtracteä froí thå resulô +     oæ  thå abovå tï situations®  Leftoveò byteó iî Ì arå  theî +     discardeä tï leavå aî eveî pagå boundary. + + +     ------------------------------------------------------------ +     NOTEº  MOSÔ  ALÌ systemó wilì benefiô witè STDBUÆ  enabled¬ +     sincå  maximuí  numbeò oæ uploadó alloweä iî  batcè  receivå +     modå  ió directlù relateä tï thå amounô oæ memorù available® +     However¬ Iæ youò systeí useó memorù locateä belo÷ thå CCÐ oò +     BYÅ program¬  yoõ wilì neeä tï disablå this¬  iî whicè  caså +     OUTSIÚ  wilì bå seô tï 16ë nï matteò what®  Iæ youò  systeí +     hangó   oò   behaveó  strangelù  durinç   descriptioî   filå +     read/writå operations¬ disablå thió - trù iô enableä first. +     ------------------------------------------------------------ + +.pa Š +     3.3 Timekeeping + +     3.3.1 BYE Clock Support + +     CLOCK‚  enableä  wilì  allo÷ ZMÄ anä  utilitieó  tï  looë  aô +     clocë  anä datå informatioî retrieveä bù BYÅ  (BYE5¬  MBYEnî +     anä MBYE44« witè extendeä BDOÓ enabled© froí youò systeí anä +     storeä  iî  higè  memory®  Thå addresó oæ thió  higè  memorù +     buffeò ió calculateä aó thå addresó aô (JÐ COLBOOT+25)®  Iæ +     yoõ seô thió tï YES¬ thå followinç informatioî ió retrieved: + + +      Location Contents Range +      +------------------+-----------------------+-------+ +      | (JP COLDBOOT+24) | Maximum time allowed  | 0-255 | +     | (JP COLDBOOT+25) | LSB of RTCBUF address | ----- | +     | (JP COLDBOOT+26) | MSB of RTCBUF address | ----- | +     +------------------+-----------------------+-------+ + + +------------------+-----------------------+-------+ +     | (RTCBUF+0) | Current hour | 0-23 | +     | (RTCBUF+1) | Current minute | 0-59 | +     | (RTCBUF+2) | Current seconds | 0-59 | +     | (RTCBUF+3) | Current century | 19 | +     | (RTCBUF+4) | Current year | 0-99 | +     | (RTCBUF+5) | Current month | 1-12 | +     | (RTCBUF+6) | Current day | 1-31 | +     | (RTCBUF+7©  | LSB oæ TOS | 0-255 | +     | (RTCBUF+8©  | MSB oæ TOS | ----- | + +------------------+-----------------------+-------+ + + Clock/datå  readeò codå insertó arå noô supporteä undeò thió +     configuration® ZMÄ programó supporô alì clock/datå featureó +     witè  thió switcè enableä anä clock/datå readeò codå  ió  iî +     BYE® + + +     3.3.2 ZMD Internal Clock/Date Reader Code + +     RTC‚  shoulä bå enableä iæ yoõ cannoô takå advantagå oæ BYE'ó +     RTCBUÆ  explaineä abovå anä yoõ wisè tï includå youò  systeí +     specifiã  clocë anä datå readeò codå aô labeì RTCTIÍ iî  thå +     ZMDHDR.Z8°  configuratioî table®  Bå surå tï initializå alì +     byteó  witè binarù valueó (seå Range‚ columî iî  tablå  3.3.± +     foò  minimuí anä maximuí values)®  BCDBIÎ maù bå  requesteä +     froí  ZMDSUBS.REÌ tï converô binarù codå decimaì valuå iî  Á +     registeò  tï  binarù valuå iî Á register®  Deletå alì  ';<=§ +     lineó  afteò youò codå ió installed®  Thió concepô ió  noô +     valiä  iæ CLOCË switcè ió enableä anä BYÅ ió  runninç  witè +     clocë anä datå readeò codå installed. + +     NOTEº  Makå  surå yoõ dï noô overruî thå modeí I/Ï  patcè +     area when you insert your clock code. +.pa Š +     3.3.3 Restricting Downloads to Time Left + +     TIMEON‚ switcè enableä telló ZMÄ tï restricô downloadó tï thå +     calleró  timå  lefô  oî system®  Iæ CLOCË  ió  enableä  anä +     MBYE/BYEµ  ió running¬  BYE'ó maximuí timå alloweä bytå (JÐ +     COLDBOOT+24©  ió useä foò comparison®  Iæ CLOCË ió  NÏ  (oò +     MBYE/BYE5©  anä RTà ió yes¬  MAXTOÓ shoulä bå pokeä bù  youò +     RTà insert®  Iæ CLOCË anä RTà arå botè NO¬  MAXMIÎ wilì bå +     useä  aó  á defaulô anä incrementeä oò decrementeä  aó  filå +     transferó occur. + + +     3.3.4 Maximum Minutes Allowed + +     MAXMIN‚  shoulä  bå seô tï youò likinç iæ CLOCË anä  RTà arå +     botè NO¬ anä TIMEOÎ ió YES® Thió valuå wilì bå thå default® +     Thió ió decremented/incrementeä eacè timå á filå transfeò ió +     madå  anä  thå  calleò  ió loggeä ofæ  wheî  iô  reacheó  0® + + +     3.3.5 Display Time on System Messages + +     DSPTIM‚ ió seô YEÓ tï havå timå oî systeí messageó  displayeä +     aô thå starô anä exiô oæ ZMD® Iæ CLOCË ió YES¬ anä MBYE/BYÅ +     ió  running¬  TOÓ ió gotteî froí BYE'ó TOÎ worä (iî RTCBUF)® +     Iæ  CLOCË ió NO¬  oò MBYE/BYEµ ió noô running¬  thå  currenô +     minuteó  alloweä  ió subtracteä froí thå originaì  valuå  oæ +     MAXMIÎ aô prograí startup®  Thå resulô ió displayeä aó timå +     on® Thió value ió actuallù á tallù: +      +      Original MAXMIN + upload time - download time = time on + + +     3.3.6 Logon Hour/Minute Addresses + +      LHOUR‚  ió thå addresó oæ thå caller'ó logoî  houò  bytå +     seô  bù  youò  BYÅ oò BBÓ prograí wheî thå calleò  logó  on® +     LHOUR+² ió thå logoî minute® Botè valueó containeä iî theså +     addresseó  shoulä bå iî binary®  Thió shoulä onlù bå seô iæ +     RTà anä eitheò TIMEOÎ oò DSPTOÓ arå seô YES® (Noô useä witè +     CLOCK). +.pa Š +     3.4 Access Restrictions + +     3.4.1 ZCMD/ZCPR + +     ZCPÒ (biô ° iî ACCMAP© shoulä bå seô tï YEÓ iæ yoõ intenä oî +     monitorinç  WHEEÌ bytå statuó oò neeä tï restricô  receivinç +     SYS¬  RCP¬  NDÒ filå types® Iæ thió biô ió seô NO¬ WHEEÌ ió +     alwayó 0. + + +     3.4.2 WHEEL Byte + +     WHEEÌ bytå togglå ió foò verù speciaì users® Iæ ZCPÒ ió seô +     tï YES¬  ZMÄ wilì monitoò thå bytå locateä aô thió address® +     Iæ it'ó 0¬ time¬ drive/user/filenamå anä accesó restrictionó +     remaiî iî force® Iæ thió bytå ió non-zero¬ alì restrictionó +     are bypassed. + + +     3.4.3 Maximum Drive/User + +     USEMAØ  shoulä  bå seô tï YEÓ iæ yoõ wanô tï uså ZCPR'ó  lo÷ +     memorù  byteó tï keeð tracë oæ maximuí drivå anä user®  ZMÄ +     wilì  uså  thå valueó aô locationó DRIVMAØ  anä  USRMAØ  foò +     maximuí  drive/user®  Iæ USEMAØ ió NO¬  hardcodå MAXDRÖ anä +     MAXUSÒ tï youò owî requirements. + + +     3.4.4 BYE/BBS Program Access Flag Byte + +     ACCESÓ  iæ  enabled¬  telló ZMÄ thaô youò BYE/BBÓ  softwarå +     supporô  aî  accesó  flagó  register®  Thió  flaç  registeò +     (AFBYTE©  ió ± datá bytå iî lengtè anä containó ¸ flaç  bitó +     correspdondinç  tï commoî BBÓ restrictions®  ZMÄ caî  checë +     thió  registeò  beforå  allowinç thå 'RM§ optioî  tï  uploaä +     preformatteä messagå fileó tï youò BBS'ó messagå base¬ oò tï +     uså  thå  'RW§ optioî foò 'privilegeä user§  uploaä  withouô +     beinç requireä tï givå uploaä descriptions®  Iæ enabled¬ seô +     ACCOFÆ  tï  reflecô thå numbeò oæ byteó froí JÐ COLDBOOÔ  tï +     AFBYTÅ  flagó byte®  ZMÄ inspectó AFBYTÅ foò  thå  followinç +     flaç data: + + + Bit: 7 6 5 4 3 2 1 0 + | | | | | | | | +  Privileged user ---* | | | | | | | + Uploaä -----ª ü ü ü ü ü ü ª Oæ theså bits¬ onlù 3¬ + Downloaä -------ª ü ü ü ü ü 5¬ ¶ anä · arå useä bù + CP/Í ---------« ü ü ü ü ZMD®  Biô numberó arå + Writå -----------ª ü ü ü poweró oæ 2¬  witè biô + Reaä -------------« ü ü ° beinç  thå  leasô + BBÓ ---------------« ü significanô biô oæ thå + System -----------------+ byte. +.pa Š +     3.5 Upload Configurations + +     3.5.1 Preformatted BBS Message Uploads + +     MSGFIÌ  switcè  enableó ZMÄ tï accepô  preformatteä  messagå +     filå  uploads®  Fileó uploadeä witè thå 'RM§ optioî wilì  bå +     forwardeä  tï  thå  drive/useò defineä aô PRDRÖ  anä  PRUSR® +     Thió uploaä ió theî appendeä tï youò BBÓ messagå base®  Youò +     BBÓ  softwarå  anä  BYÅ prograí musô supporô  thió  feature® +     MBBÓ, QBBS and PBBS all support this feature. PMSG/HMSG is + now available on RI RCPM-RDOS. + + +     3.5.2 Hiding New Uploads Until Approved by Sysop + +     HIDEIÔ allowó Sysopó tï keeð alì ne÷ regulaò uploadó  hiddeî +     froí  publiã viewinç untiì revieweä anä cleared®  Thió way¬ +     ne÷  uploadó  wilì  noô appeaò iî á  DIRectorù  listinç  anä +     cannoô bå vieweä oò eveî downloadeä bù ZMD® Thió featurå ió +     disableä wheî thå WHEEÌ bytå ió OÎ oò Privatå uploaä modå ió +     enabled®  Fileó  thaô  havå beeî hiddeî wilì sho÷ uð  iî  á +     DIRectorù listinç wheî thå WHEEÌ bytå ió seô anä á $Ó optioî +     ió  useä  tï sho÷ SYSTEÍ files®  Referencå wilì bå madå  tï +     theså  fileó iî thå loç anä FOÒ texô filå listingó iæ  thoså +     featureó  arå enabled®  Yoõ caî uså POWEÒ oò NSWEEÐ tï  seô +     hiddeî fileó tï $DIR. + + +     3.5.3 Upload Routing to Multiple Drive/Users + +     ASKAREÁ  switcè seô YEÓ enableó uploaä routinç  tï  multiplå +     drive/useò areas®  Witè thió enableä á calleò ió  displayeä +     á lisô oæ uploaä categorieó tï chooså from®  Wheî hå enteró +     hió selection¬  ZMÄ wilì calculatå thå offseô tï thå  uploaä +     drive/useò  iî TYPTBÌ anä seô thå uploaä areá baseä oî  hió +     selection®  Thió ió donå aô thå samå timå foò botè  Regulaò +     anä Privatå uploads)®  Uploaä routinç ió disableä wheî thå +     WHEEÌ bytå ió set¬ iî whicè case¬ normaì uploadó wilì gï tï +     thå  currenô drive/useò areá anä privatå uploadó wilì gï  tï +     thå drive/useò equateä aô PRDRÖ anä PRUSR. + + +     3.5.4 Uploading to Specified Drive/User + +     SETAREÁ  enableä  forceó alì ne÷ uploadó tï  thå  drive/useò +     defineä aô DRV‚ anä USR®  Iæ thå WHEEÌ bytå ió set¬  regulaò +     uploadó wilì gï tï thå currenô oò specifieä drive/user® Alì +     privatå  fileó uploadeä witè thå 'RP§ optioî wilì bå senô tï +     PRDRÖ anä PRUSÒ regardlesó oæ WHEEÌ status. + +.pa Š +     3.5.5 Receiving Private Uploads + +     PRDRÖ anä PRUSÒ arå thå drive/useò areá wherå ALÌ fileó senô +     tï  thå Sysoð witè thå 'RP§ optioî wilì gï  (unlesó  ASKAREÁ +     ió YES)® Thió permitó experimentaì files¬ replacemenô and/oò +     proprietarù  programó tï bå senô tï aî areá onlù  accessiblå +     bù  thå  Sysop®  Thió ió alsï thå drivå anä useò areá  wherå +     messagå  fileó  arå  uploaded¬  iæ MSGFIÌ ió  seô  YES®  Iæ +     ASKAREÁ ió YES¬ 'RP§ uploadó wilì gï herå onlù iæ thå WHEEÌ +     ió set®  Iæ MSGDESà ió YES¬  thió ió thå drivå anä useò areá +     thå FOÒ texô filå wilì bå placeä beforå appendinç iô tï  thå +     BBÓ system'ó messagå base. + + +     3.5.6 Crediting Upload Time to Time Left + +     CREDIÔ  enableä  causeó ZMÄ tï crediô calleró foò  thå  timå +     theù  spenä uploadinç non-privatå fileó eacè  session®  Foò +     example¬  á  calleò whï spendó 3° minuteó sendinç aî  uploaä +     getó  3° minuteó addeä tï hió TLOS®  (Yoõ musô  seô  eitheò +     CLOCK¬ RTà oò TIMEOÎ tï YEÓ tï uså thió feature). + + +     3.5.7 Receiving .COM Files Securely + +     NOCOMÒ  telló ZMÄ tï renamå .COÍ fileó tï .OBÊ anä  .PRÌ  tï +     .OBР oî  receive®  Thió featurå ió alsï disableä wheî  thå +     WHEEÌ bytå ió set. + +.pa Š +     3.6 Upload Descriptions + +     Thió sectioî haó tï dï witè uploaä descriptions®  Iæ yoõ dï +     noô intenä oî implementinç uploaä descriptions¬  seô DESCRI +     anä  MSGDESà tï  NO®  Thå resô oæ  theså  valueó  arå  theî +     ignored®  Iæ  usinç descriptions¬  seô ONLÙ onå oæ theså tï +     YES¬ noô both. + + +     3.6.1 Forwarding Descriptions to BBS Message Base + +     MSGDESà shoulä bå seô YEÓ iæ youò youò BBÓ systeí  supportó +     messagå  uploads¬  anä yoõ prefeò uploaä descriptionó tï  bå +     placeä iî youò BBÓ messagå baså (seô DESCRI NO)® MBBÓ useró +     neeä  tï instalì MFMSG.COÍ witè thå MBBSINIÔ program®  Theî +     seô  youò BYÅ prograí tï kno÷ abouô messagå filå uploadó  bù +     settinç thå MSGFIÌ optioî iî BYE/MBYÅ tï YES®  Iæ seô  YES¬ +     ZMÄ  wilì  producå  á  FOÒ texô  filå  wheî  writinç  uploaä +     descriptions®  Thió  FOÒ filå wilì gï tï thå drivå anä  useò +     areá  equateä aô PRDRÖ anä PRUSÒ jusô beforå beinç  appendeä +     tï youò BBÓ system'ó messagå base. + + +     3.6.2 Forwarding Description to FOR Text File + +     DESCRI  switcè shoulä bå YEÓ iæ yoõ wanô descriptionó tï bå +     appendeä tï thå currenô FOÒ filå wherå theù caî bå vieweä bù +     calleró   witè  thå  ZFORР utility®   Sysoð  caî  adä   ne÷ +     descriptionó  witè thå ZFORÓ utility®  Uploadó senô tï  thå +     Sysoð privatå uploaä areá wilì noô requirå descriptions¬ noò +     wilì  fileó uploadeä witè thå 'RW§ optioî - useò musô  bå  á +     privilegeä  useò  (biô · iî ACCESÓ bytå set© oò  havå  WHEEÌ +     accesó anä PUPOPÔ musô bå seô YEÓ tï uså thå 'RW§ option. + + +     3.6.3 Description Filename + +     FORNAM/DRIVE/USEÒ  ió thå drive/useò anä filenamå oæ thå FOÒ +     descriptioî  texô  file®  Thió filenamå musô  bå  1±  byteó +     paddeä witè spaces® Iæ usinç witè DESCRI seô YES¬ yoõ musô +     indicatå  whaô  drive/useò  yoõ wanô thå 'FOR§  filå  tï  bå +     placed®  Drive/useò areá ió automaticallù changeä tï  PRDRÖ +     anä  PRUSÒ  iæ descriptionó arå tï bå forwardeä tï  thå  BBÓ +     messagå baså + +.pa Š +     3.6.4 Upload Description Header Information + +     Iæ  youò configuratioî includeó DESCRI seô tï  YES¬  you'lì +     havå  tï telì ZMÄ whaô informatioî yoõ wanô includeä iî  thå +     firsô linå oæ eacè description® Codå ió includeä iî alì ZMÄ +     programó  tï  placå  alì  (any© informatioî  iî  thå  uploaä +     descriptioî header® Thå followinç diagraí illustrateó á fulì +     implementatioî oæ DESCRIB: + + +  ----- +  ZMD150.LBR - Communications (C3:) Rcvd: 09/29/88 + / / / + _______/ _______/ _____/ + ASKIND INCLDU DSTAMP + + + +     3.6.5 Including File Descriptors + +     ASKINÄ  switcè  enableä causeó ZMÄ programó tï asë  foò  thå +     categorù  oæ  thå  upload(s© anä writå iô  intï  thå  uploaä +     descriptioî header®  Iæ yoõ seô thió tï YES¬  makå surå yoõ +     seô  MAXTYÐ tï thå highesô letteò choicå yoõ wisè tï supporô +     anä ediô thå texô aô KNDTBÌ uð tï anä includinç youò  MAXTYÐ +     setting® (Useä onlù witè DESCRIB). + + +     3.6.6 Including Upload Drive/User Area + +     INCLDÕ  enableä  wilì  includå thå drive/useò  areá  oæ  thå +     uploadeä filå intï thå uploaä descriptioî header® (Useä onlù +     witè DESCRIB). + + +     3.6.7 Datestamping the Description Header + +     DSTAMÐ enableä wilì includå thå datå thå uploaä waó receiveä +     intï thå uploaä descriptioî header®  (NÏ iæ nï clock© (Useä +     onlù witè DESCRIB). + + +     3.6.8 Overriding Description requests + +     PUPOPÔ  allowó descriptionó tï bå disableä wheî "RW¢ ió useä +     oî thå ZMÄ commanä linå (i.e® ZMÄ R× FILE.EXT)® Thió commanä +     maù  onlù bå useä bù thoså considereä "priviledged¢ useró oî +     youò  systeí oò WHEEÌ users®  Uploadó oæ thió typå wilì  bå +     taggeä iî thå ZMD.LOÇ filå aó private¬  sï aó noô tï displaù +     witè thå NE× command®  (Seå ACCESÓ equatå descriptioî abovå +     foò informatioî oî detecting 'priviledged§ users). + +.pa Š +     3.6.9 Automatic Word Wrap + +     WRAР ió  seô tï thå columî positioî wherå  worä  wrað  wilì +     occur®  Iæ usinç MSGDESà anä havå problemó witè aî 'Invaliä +     format§ erroò froí MFMSG.COM¬  trù settinç WRAÐ tï somethinç +     smaller¬  likå 6² oò 63® (Worä wrað caî bå disableä bù thå +     useò  witè ^× durinç descriptioî entry®  Enteò 7²  herå  tï +     disablå WRAÐ completely). + +.pa Š +     3.7 Download Configurations + +     ACCMAР ió á biô mappeä flaç registeò ± bytå iî length®  Iô +     containó  ¸  flaç  bitó whicè  enable/disablå  thå  filenamå +     restrictionó  outlineä  below®   Thå  restrictionó   alwayó +     pertaiî tï thå filå beinç considereä foò transfer® Enablinç +     anù  oæ theså optionó causeó ZMÄ tï looë aô thå higè biô  oæ +     thå  bytå  positioî  indicateä belo÷  (F1=filenamå  bytå  1¬ +     T2=filå  typå bytå 2¬  etc)®  Theså restrictionó arå alwayó +     bypasseä wheî usinç ZCPÒ anä thå WHEEÌ ió set. + + +     3.7.1 Restricting .LBR and Single F1 Tagged Files + +     TAGFIL‚  switcè  ió enableä iæ yoõ wanô tï  restricô  calleró +     froí downloadinç certaiî files¬  sucè aó verù largå  overlaù +     libraries¬  gamå libraries¬  etc®  Iî mosô cases¬ remaininç +     timå  lefô  oî  systeí woulä bå sufficienô  foò  restrictinç +     downloads®  However¬ witè biô · oæ ACCMAÐ seô tï 1¬ ZMÄ wilì +     checë  thå  higè biô oæ filenamå bytå ± anä iæ thió ió  set¬ +     thå  filå  maù  noô  bå  downloaded®   Iæ  thå  filå  ió  á +     ARK/ARC/LBÒ  file¬  individuaì  memberó  maù  bå  downloadeä +     however®  Thió restrictioî ió bypasseä iæ thå WHEEÌ bytå ió +     set. + +      ACCMAP Switch: 10000000 +      Filename Byte: FILENAME.EXT +      + +     3.7.2 Disallowing .COM Downloads + +     NOCOMÓ  shoulä bå enableä iæ yoõ dï noô wanô calleró  tï  bå +     ablå  tï  downloaä *.COÍ files®  Mosô securå  systemó  wilì +     enablå  thió  restriction®  Thió featurå ió  bypasseä  wheî +     WHEEL byte is set. + +      ACCMAP Switch: 00001000 +      Filename Byte: FILENAME.EXT + + +     3.7.3 Disallowing .??# Downloads + +     NOLBÓ ió enableä foò thoså systemó whicè uså 'labels§ iî thå +     thirä  filå  extenô bytå oæ systeí fileó tï restricô  publiã +     accesó tï them® ZMÄ wilì checë T³ bytå foò á '#§ characters® +     Upoî  á  match¬  thå downloaä ió denied®  Thió  featurå  ió +     bypassed when the WHEEL byte is set. + +      ACCMAP Switch: 00010000 +      Filename Byte: FILENAME.EXT + +.pa Š +     3.7.4 Disallowing F2 Tagged $SYStem File Downloads + +     NOSYÓ  enableä telló ZMÄ tï ignorå alì fileó witè  thå  higè +     biô seô iî filenamå bytå T2®  Theså fileó arå considereä aó +     hiddeî $SYSteí fileó bù CP/Í anä caî bå treateä thå samå waù +     bù ZMD® Thió featurå ió bypasseä wheî thå WHEEÌ bytå ió set. + +      ACCMAP Switch: 00100000 +      Filename Byte: FILENAME.EXT + + +     3.7.5 Sending F3 Tagged Files Regardless of Access + +     DWNTAÇ  iæ enableä allowó anù filå witè thå higè biô seô  iî +     filenamå bytå ³ tï bå senô regardlesó oæ thå calleró access. +     Thió comeó iî verù handù foò closeä systemó requirinç  useró +     tï  downloaä  applications¬  systeí informatioî  files¬  BBÓ +     lists, etc. + +      ACCMAP Switch: 01000000 +      Filename Byte: FILENAME.EXT + + +     3.7.6 Special Sysop Downloads to Selected Caller + +     SPDRÖ  anä SPUSÒ contaiî thå drive/useò areá foò downloadinç +     privatå  'SP§ fileó froí Sysop®  Thió permitó you tï puô  á +     speciaì 'non-public§ filå iî thió area¬ theî leavå á privatå +     notå tï thå persoî iô ió intendeä foò mentioninç thå namå oæ +     thå  filå anä ho÷ tï downloaä it®  Althougè anybodù 'could§ +     downloaä thaô program¬  theù don'ô kno÷ whaô (iæ any©  fileó +     arå  there®  Á higè degreå oæ securitù exists¬  whilå  thå +     Sysoð stilì haó thå abilitù tï makå speciaì fileó available® +     Thuó anù persoî caî bå á temporarù 'privilegeä user'. + +     NOTEº Á breacè oæ securitù existó iæ SPUSÒ ió noô defineä aó +     á  higheò useò areá thaî thå maximuí allowablå  publiã  useò +     area.‚ + +.pa Š +     3.8 Logkeeping + +     Á clocë ió not necessary for this logkeeping features. + + +     3.8.1 Making ZMD.LOG File + +    LOGCAL‚ enableó thå loç keepinç routineó iî ZMD® Ne÷ uploadó +     wilì bå addeä tï thå currenô ZMD.LOÇ file®  Iæ nï loç  filå +     exists¬ onå wilì bå created® Alì filå transferó arå logged® +     Yoõ  caî  theî  uså  ZNEWP.COÍ tï sho÷  listingó  oæ  recenô +     uploadó oò ZNEWÓ tï adä loç entries. + + +     3.8.2 European Date Format (DD/MM/YY) + +     EDATE‚  causeó  ZMÄ anä utilitieó tï sho÷  datå  iî  dd/mm/yù +     formaô insteaä oæ mm/dd/yù format. + + +     3.8.3 Transfer Log Drive/User/Filename + +     LOGNAM/LOGDRV/LOGUSR‚  ió thå drive/useò anä filenamå oæ  thå +     ZMD.LOÇ  filå transfeò log®  Thió filenamå musô bå 1± byteó +     paddeä witè spaces®  Iæ usinç witè LOGCAÌ seô YES¬ yoõ musô +     indicatå  whaô drive/useò yoõ wanô thå 'ZMD.LOG§ filå tï  bå +     placed® + + +     3.8.4 LASTCALR Drive/User + +     LASTDRV/LASTUSR/LCNAME‚  ió thå drive/useò oæ youò BBÓ oò BYÅ +     program'ó LASTCALR.??¿ file® Thió filenamå musô bå 1± byteó +     paddeä witè spaces®  Iæ usinç witè LOGCAÌ seô YES¬ yoõ musô +     indicatå whaô drive/useò ZMÄ caî finä thå LASTCALR.??¿ file® +     LCNAMÅ shoulä bå seô tï thå columî positioî oæ thå  caller'ó +     namå iî thå LASTCALR.??¿ file® (° foò PBBS¬ 1± foò MBBS). + + +     3.8.5 Counting Files Transfers for BBS Software + +     LGLDS‚  seô YEÓ enableó sessioî uploaä anä downloaä counting® +     ZMÄ  wilì counô thå numbeò oæ up/downloadó foò  eacè  logon® +     Youò  BBÓ  prograí theî caî checë UPLDS‚  anä  DNLDS‚  counteò +     byteó wheî á useò logó ouô anä updatå eitheò thå user'ó filå +     oò á filå foò thió purpose®  Yoõ caî eitheò modifù youò BBÓ +     entrù prograí tï checë thå LASTCALÒ filå beforå updatinç anä +     theî  updatå  (risky)¬  oò makå á separatå prograí thaô  BYÅ +     calló wheî logginç ofæ á useò (preferred)®  (YEÓ foò PBBS)® +     Don'ô forgeô tï initializå UPLDÓ anä DNLDÓ counteò byteó  tï +     ° froí youò BBÓ prograí wheî somebodù logó in. + +     NOTEº  Cleaò  thå UPLÄ anä DNLÄ byteó ONLÙ wheî á useò  logó +     in¬ noô wheî hå re-enteró thå BBÓ prograí froí CP/M. Š + + + + + + + + + + + + + + + + + + + + + + +      APPENDICES + +.pa Š +     A.1 Modem Interface + + A.1.1 Creating ZMD Modem Input/Output Overlays + +     Alì  port/modeí overlayó arå alloweä 12¸ byteó betweeî  580È +     anä 5FFH®  Thió areá ió alwayó containeä iî thå  ZMDHDR.Z8° +     configuratioî   tablå  anä  includeä  durinç  thå   assemblù +     process®  Thå firsô 27 byteó oæ thió overlaù musô contaiî  ¸ +     JÐ instructionó iî thå followinç order: + + +      Routine Purpose Entry Exit +      -------------------------------------------------------- +      CONOUT Local console output (BIOS) A=char ----- +      INIT Initialization ----- ----- +      UNINIT Uninitialization ----- ----- +      SNDCHR Send character POP AF gets->A=char ----- + CARCHË Carrier check ----- Z=Carrier +      GETCHÒ  Receive a character ----- Char in A +      RCVRDÙ  Check receive ready ----- Z=char +      SNDRDÙ  Check send ready ----- Z=ready + + + A.1.2 Installing Your Modem I/O Overlays + +     ZMÄ musô havå accesó tï youò modeí foò obviouó reasons®  Iô +     needó tï senä data¬  receivå data¬  perforí erroò  checking¬ +     monitoò  carrieò  anä givå controì bacë tï youò BYÅ  prograí +     wheî  carrieò  ió lost®  Iô haó tï kno÷ wheî thå  modeí  ió +     readù  tï  senä  anotheò  characteò anä wheî  onå  haó  beeî +     received® Iæ youò systeí useó extendeä BDOÓ calló tï accesó +     youò BYÅ programó port/modeí routines¬  yoõ caî instalì  ZMÄ +     anä  utilitieó withouô regarä tï thió  section®  Otherwise¬ +     follo÷ these steps: + +      1©  Finä aî overlaù froí ZMDOVLn.LBÒ thaô besô fitó youò +      modem/porô requirements® Yoõ maù havå tï creatå onå +      foò youò systeí iæ onå doesn'ô exisô already® Some +      standarä  formató arå includeä (seå -OVERLAY.LSÔ  iî +      the ZMDOVLn.LBR). +    2©  Ediô iô witè youò favoritå wordprocessoò aó needed® +      Makå  surå yoõ locaì consolå outpuô  addresó  (BIOS© +      caî bå calculateä usinç standarä CP/Í methodó  (i.e® +      (JР COLDBOOT+9©  Iæ  youò BIOÓ JР TABLÅ  haó  beeî +      altered¬  yoõ  wilì havå tï providå thió addresó foò +      ZMÄ  aô labeì CONOUT®  Iî mosô cases¬  ZMÄ wilì  bå +      ablå tï calculatå thió addresó foò you® Iæ yoõ wilì +      neeä  tï  initializå anythinç aô prograí  starô  up¬ +      includå  youò custoí routinå aô labeì INIÔ anä  youò +      uninitializå  routinå aô UNINIT®  INIÔ ió calleä aô +      prograí startup¬  anä oæ courså UNINIÔ ió calleä aô +      prograí exit. +.pa Š      3© Assemblå witè M80¬ oò SLRMAà oò otheò Z8° compatiblå +      assembler to produce ZMxx-n.HEX +    4© Uså MLOAÄ (included© tï loaä ZMxx-n.HEØ oveò ZMD.COÍ +      likå this: + +      A0>MLOAD ZMD=ZMD.COM,ZMxx-n + + +     ZINSTÌ wilì no÷ recognizå youò modeí overlay®  Yoõ caî alsï +     uså  DDÔ tï patcè youò overlaù in®  Makå surå iô startó  aô +     580H and ends by 5FFH (128 bytes). + +     NOTEº  Iæ ZMÄ attemptó tï seô thå currenô useò areá tï  24± +     anä 7· ió returneä iî registeò A¬  BYE'ó extendeä BDOÓ calló +     will be used for modem I/O. +.pa Š +     B.1 RTC Clock/Date Reader Code + +     Á fe÷ oæ ZMD'ó nicå featureó arå dependenô upoî accesó tï  á +     Reaì Timå Clock®  MBYÅ anä BYEµ useró whï havå theiò  clocë +     anä  datå  readeò codå installeä neeä onlù seô CLOCË tï  YEÓ +     anä  leavå RTà seô NO®  Iæ oî thå otheò hanä youò BYÅ  doeó +     noô  reaä youò systeí clock¬  yoõ wilì havå tï  inserô  youò +     clocë  anä  datå readeò codå aô labeì RTCTIÍ iî  ZMDHDR.Z80® +     Witè  RTà seô  YES¬  alì ZMÄ routineó havå  accesó  tï  thå +     followinç binary valueó (pokeä bù youò clocë insert): + + +      Address Length Range +      +---------+--------+-------+ +      | MONTH | 1 byte | 1-12 | +      | DAY  | 1 byte | 1-31 | +      | YEAR  | 1 byte | 0-99 | +      | HOUR  | 1 byte | 0-23 | +      | MINUTE | 1 byte | 0-59 | +      +---------+----------------+ + + + Youò inserô musô starô aô 4FEÈ anä enä bù 57FÈ (13° bytes). +.pa Š +     C.1 File Descriptors/Categories + +     Thió  tablå  defineó  thå  texô tï  bå  includeä  iî  uploaä +     descriptioî  headeró  (DESCRI  anä ASKIND©  and/oò  defineó +     categorieó  foò uploadinç tï multiplå drive/useò  areaó  (Iæ +     ASKAREA)®  Changå aó desired¬ iæ thió lisô ió noô suitable® +     Dï  NOÔ  removå anù oæ thå texô aô KNDTBL®  Simplù ediô  thå +     categorù  texô  belo÷ uð to/includinç youò  MAXTYР setting® +     MAXTYP‚  belo÷  musô bå seô tï whateveò letteò  youò  maximuí +     choicå wilì be® + + +     MAXTYP: DB 'W' ; Highest category you will support. + +     KNDTBL: + +     DB ' A) - CP/M Utility ',CR,LF + D ' B© - CP/Í Applicatioî ',CR,LF +     D ' C© - CP/Í Gamå ',CR,LF +     D ' D© - Wordprocessinç ',CR,LF + DB ' E) - Text & Information ',CR,LF + DB ' F) - Printer Related ',CR,LF + DB ' G) - Communications - IMP ',CR,LF + DB ' H) - Communications - MEX ',CR,LF + DB ' I) - Communications - Other',CR,LF + DB ' J) - RCP/M Software ',CR,LF + DB ' K) - BBS List ',CR,LF + DB ' L) - ZCPR1/2/3 ',CR,LF +     DB ' M) - Pascal Utility/Source ',CR,LF + DB ' N) - dBase Utility/Source ',CR,LF + DB ' O) - Basic Utility/Source ',CR,LF + DB ' P) - ''Other'' Language ',CR,LF + DB ' Q) - EPSON Specific ',CR,LF + DB ' R) - ZMD Support ',CR,LF + DB ' S) - IBM Utility ',CR,LF + DB ' T) - IBM Application ',CR,LF + DB ' U) - IBM Game ',CR,LF + DB ' V) - IBM Communications ',CR,LF + DB ' W) - Mixed Batch/Misc ',CR,LF + DB ' X) - <<<< Not Defined! >>>>',CR,LF + DB ' Y) - <<<< Not Defined! >>>>',CR,LF + DB ' Z) - <<<< Not Defined! >>>>',CR,LF + DB 0 ; leave the table terminator alone. + + +     ------------------------------------------------------------ +     NOTEº  Makå surå yoõ leavå alì thå categorieó abovå EXACTLÙ +     3±  byteó lonç (2¹ byteó oæ texô pluó thå CR,LÆ equaló  31© +     oò yoõ wilì havå problemó witè thå doublå columî  formattinç +     routines. +     ------------------------------------------------------------ +.pa Š +     D.1 Upload Routing Table + +     Iæ  yoõ decideä tï enablå uploaä routinç tï  multiplå  drivå +     users¬ yoõ wilì havå tï seô thå followinç tablå foò youò owî +     requirements®  Ediô  alì areaó aô TYPTBÌ uð tï anä includinç +     youò  MAXTYР setinç  tï matcè thå messagå  texô  iî  KNDTBÌ +     above® Notå thaô PRIVATÅ uploadó maù bå senô tï á differenô +     drivå  aó  welì aó á differenô useò  area®  Eacè  entrù  ió +     expresseä aó 'drivå letter',useò area® Simplù seô MAXTYÐ tï +     thå  highesô letteò choicå supported®  (Dï NOÔ commenô  ouô +     anù oæ theså storagå bytes). + + _________ + NOTE: / A \ <--- Corresponds to category 'A' + 'A',1,'B',15, + \ / \ / + Normal upload --+ | + Private upload -------+ + + + TYPTBL: + _________ _________ _________ _________ + / A \ / B \ / C \ / D \ + DB 'A',1,'B',15, 'A',2,'B',15, 'B',2,'B',15, 'B',4,'B',15 + _________ _________ + / E \ / Z \ + DB 'B',3,'B',15, ... thru ... 'B',7,'C',12 + + + \ No newline at end of file diff --git a/Source/Apps/ZMD/zmd.z80 b/Source/Apps/ZMD/zmd.z80 new file mode 100644 index 00000000..c47274a7 --- /dev/null +++ b/Source/Apps/ZMD/zmd.z80 @@ -0,0 +1,4858 @@ +; + + TITLE ZMD.Z80 - 09/29/88 - Z80 RCP/M File Transfer Program +; Copyrighted (c) 1987, 1988 +; Robert W. Kramer III + + PAGE +;- -; +; Update History ; +; ; +; Date Release Comments ; +; -------- ------- ---------------------------------------------- ; +; ; +; 09/29/88 v1.50 - If an LBR/ARK/ARC member extraction is being ; +; made, a check at OPNOK5: determines if (FCB+9) ; +; is an 'L' for a .LBR member extraction. If so, ; +; ZMD informs the receiver that the file is ready ; +; for downloading. If (FCB+9) is other than an ; +; 'L' an ARC/ARK member extraction is assumed and ; +; the receiver is told to name the received file ; +; accordingly. Extractions on LBR/ARC/ARK files ; +; with the high bit set in (FCB+9) triggers this ; +; test unreliable. The simple fix has been made, ; +; which strips the parity bit of (FCB+9) before ; +; anylizing it. ; +; - Fixed a problem that caused some systems to ; +; ignore the first character typed in some ZMD ; +; utilities. The modification was made at the ; +; TYPE: routine in ZMDSUBS. Instead of using ; +; BDOS function 2 to display a character, we are ; +; now using BDOS call 6. ; +; - Fixed CONSTAT: routine in ZMDSUBS to properly ; +; react to cancel requests from Sysop. ; +; - Modified all low level I/O routines to preserve ; +; HL, DE, and BC registers. Whether you're using ; +; BYE's extended BDOS calls or have a custom I/O ; +; overlay installed in ZMD, those registers are ; +; will return intact. This allows those writing ; +; overlays to not have to worry about register ; +; integrity. ; +; - Single file Receive now defaults to 1k blocks. ; +; - Library extractions now default to 1k blocks. ; +; - Fixed bugs in the handshaking that have been ; +; around since 1k Batch was implemented on CPM ; +; systems. This required several modifications ; +; to the SNDFIL routines. All of them were ; +; modified specifically for the Batch routines, ; +; however, other Send routines were directly ; +; effected by them. ; +; ; +; 1. ZMD does not use the BDOS call 35 to get ; +; the file size since this information is ; +; supplied in the directory entry for each ; +; extent retreived during filename lookup. ; +; ; +; 2. We no longer open a file to send until ; +; the receiver has ACKnowledged header 0 ; +; *AND* sent his invitation for CRC ('C'). ; +; Previously, opening the file immediately ; +; after the header 0 ACK caused the 'C' to ; +; be missed during the time the sender is ; +; opening the file and filling his transmit ; +; buffer. ; +; ; +; 3. I personally feel there is no need to ; +; purge the line of incoming characters at ; +; anytime during a batch session. All of the; +; occurences of CALL CATCH have been removed; +; from the Send batch routines with the ; +; exception of the GTACK routine, in which ; +; case a call to CATCH is only made if the ; +; current byte received is other than an ; +; ACK, NAK, 7Bh, FBh, or a CANCEL. ; +; ; +; I do not have the resources to change all ; +; the other CP/M file transfer utilities ; +; floating around, so you may still notice ; +; some minor delays between files in BATCH ; +; protocol. Since most of the problem was ; +; in the Send routines, you'll not notice ; +; lengthy delays when using ZMD to send. ; +; Delays when using ZMD to receive will be ; +; dependant upon what software the sender ; +; is using. (IBM comm programs don't seem ; +; to have this problem, however all CP/M ; +; comm programs will have these irritating ; +; delays - except ZMD). ; +; ; +; - Added code to initialize KDRV with current ; +; drive at program startup. CPM3 systems were ; +; experiencing problems with BDOS 46. ; +; - CPM3 BDOS call 46 returns the current disk space; +; free in the first 3 bytes of the currently set ; +; DMA. This was being done during a check for ; +; the batch intention and destroying the current ; +; command line buffer (at 80h where DMA address is; +; usually set). CPM3 systems should now have no ; +; problems with ZMD. ; +; - Fixed bug to allow 255 files to be transferred ; +; when descriptions are disabled (either by the ; +; ZINSTL program or by using the 'RW' option). ; +; - Added CKWILD routine to prevent commands such ; +; as 'ZMD R *.*' enter '*.*' into the directory. ; +; Using any wildcards in the filename or extent ; +; of the receive filename will trigger YMODEM 1k ; +; Batch. ; +; - Log file routines were writing some filename ; +; attributes to the log file. Fixed at PUTLOG: ; +; - Modified ZMDSUBS.REL and send/send Batch code ; +; to take care of incorrect drive display problem ; +; for local terminal. Created new subroutine to ; +; poke the current binary 'BDOS' drive/user area ; +; into (DUU) and (DUD) in both SNDFIL: and SBTCH: ; +; routines. Both DUD and DUU have been moved to ; +; the ZMDSUBS file for global use. ; +; - Fixed EDATE routines for LOG and FOR files. ; +; Previously, the EDATE setting had no effect on ; +; the ZMD.Z80 program. ; +; - Fixed message upload routine at RCVFL to check ; +; for access restrictions. If ACCESS is set to ; +; NO, the message upload will be accepted, else ; +; bit 3 of AFBYTE will be anylized. ; +; ; +; 03/18/88 v1.49 - No change(s) made to this file ; +; 03/13/88 v1.48 - Had a small problem with TPA fix which has been ; +; corrected. CHKTPA was calculating the total ; +; number of bytes available for DBUF, but wasn't ; +; clearing register L (forcing an even amount of ; +; sectors before initializing OUTSIZ buffer limit ; +; comparison word). This may have introduced ; +; minimal garbage to your FOR file if your FOR ; +; file is large enough to fill available TPA with ; +; ZMD, ZFORS or to the log file if running ZMDEL. ; +; - Rewrote OUTCHR routine in ZMDSUBS. ; +; - Redefined buffer table at end of programs. STACK; +; and filename buffers now EQUated with offsets ; +; from the last switch/toggle in program instead ; +; of with DS directive. ; +; - Some systems which do NOT have an interrupt ; +; driven keyboard may have noticed problems when ; +; an invalid key was entered in the ZNEWP, ZFORP ; +; and ZMDEL programs. In ZNEWP and ZFORP, if a ; +; CR was entered to pause the output, output was ; +; limited to one line at a time per key pressed. ; +; If an invalid key was hit, output would have ; +; remained in a paused state until one of the ; +; abort keys were pressed. This was difficult to ; +; find since my keyboard is interrupt driven and ; +; I could not duplicate the problem on my own ; +; system. ; +; - Fixed a problem in the MODE parsing routines ; +; that caused ZMD to default to 128 byte blocks ; +; in single file SEND mode. Now defaults to 1k ; +; YMODEM. ; +; 02/25/88 v1.47 - Fixed a problem that caused only partial display; +; of the help guide if an invalid command such as ; +; ZMD RPC with no filename was entered. ; +; - Repaired routine that loads access flags byte ; +; into AFBYTE. If ACCESS was disabled and BYE ; +; was running, a check for a modem overlay was ; +; being made that caused a system hang up. v1.46 ; +; was the only version with this problem. ; +; - And then there were TPA problems. Past versions ; +; of ZMD required at least 48k TPA to run. If ; +; your system has less, and descriptions enabled, ; +; you most likely had a system hang up during the ; +; FOR file read/write operations. This version ; +; will run on any system with as little as 24k of ; +; available TPA. Maximum number of uploads is ; +; automatically calculated according to your TPA ; +; limitations. If upload descriptions have been ; +; disabled (either during installation or during ; +; program execution with the RW or RP options), ; +; as many as 255 files may be uploaded. ; +; - Fixed time out error in CRC receive routine. ; +; Register B contains the number of seconds to ; +; wait for a character on entry to RECV and some- ; +; how I inadvertanly removed the line that loads ; +; this value on entry. (Label RCVCRC2) ; +; - Fixed description routine so that the caller ; +; will be asked for the category of each uploaded ; +; file if ASKAREA is disabled. Problem caused ZMD ; +; to ask only 1 time for the file descriptor of ; +; uploaded files - no matter how many of them ; +; there were. ; +; 01/27/88 v1.46 - Fixed BYE time routines. Now displays correct ; +; time on system when exiting. ; +; - Fixed SUBS file so that discrepency check will ; +; not turn off CLOCK, and DSTAMP if MODE is set ; +; to 255. (So ZFORS and ZFORP can react to the ; +; clock related features without BYE running). ; +; - Added prompt to tell remote when ZMD is waiting ; +; for him to come back to terminal mode. Gets ; +; redisplayed every 3 seconds for a total of ; +; approximately 30 seconds before continuing on ; +; automatically. ; +; - Added code to SUBS file that determines if we ; +; are in private mode or not. If so, only private ; +; drive/user information is displayed when asking ; +; for file descriptors/categories choice. If in ; +; regular mode or in SPACE routines only the ; +; regular drive/user is shown. Fix is for upload ; +; routing routines. ; +; - Repaired message file exit routine. Command ; +; line wasn't being properly built. ; +; - Fixed so that batch mode is not valid with the ; +; RM option. (Slipped by during a rewrite of the ; +; command tail parsing routines). ; +; 01/17/88 v1.45 - First public release ; +; 01/14/88 v1.43 - Removed MBYE/BYE3 specific switches in ZMDHDR. ; +; Added new switch CLOCK. Removed Extended BDOS ; +; calls from time and date routines. Rewrote for ; +; 100% compatibility with BYE5/MBYE/BYE3 remote ; +; console programs. RTC switch can be set for ; +; user defined time and date routines at RTCTIM ; +; in ZMDHDR.Z80 ; +; - Fixed an error in send routines that allowed ; +; FCB+9-FCB+12 to remain initialized to nulls, if ; +; file requested had less than 3 characters in ; +; the filename extent. ; +; 12/29/87 v1.41 - Removed and rewrote description routines to be ; +; universal with ZMD, ZFORS and ZINSTL programs. ; +; Routine is now requested from ZMDSUBS.REL ; +; 12/23/87 v1.40 - Fixed numerous trivial bugs. ; +; - Rewrote the help and time/date routines. ; +; - Added code to determine if BIOS local console ; +; output address has been included in the modem ; +; overlay and if not calculate it according to ; +; standard CP/M specifications and store it for ; +; program use. ; +; 12/13/87 v1.39 - Rewrote common subroutines for inclusion in ; +; ZMDSUBS.REL subroutines file. ; +; 12/07/87 v1.38 - Modified to support drive/user area requests ; +; in SEND BATCH mode. Drive/user restrictions ; +; remain enforced. ; +; 10/02/87 v1.37 - Wrote code for automatic host disk block size ; +; detection. All file sizes (and total file ; +; sizes) are rounded to reflect this block size. ; +; 08/29/87 V1.36 - Rewrote all time routines. Moved RTC reader ; +; code insert address to ZMDHDR. Moved all date ; +; and time routines together to be updated all ; +; in same pass. Values stored at end of program ; +; to free up registers and retain values for any ; +; subsequent use. ; +; 08/14/87 v1.35 - Removed access restriction routines and rewrote ; +; completely. Access switches now bit mapped. ; +; 07/24/87 v1.34 - Updated to detect and process batch filename ; +; requests automatically. (AUTO-BATCH). ; +; - Removed entire SBTCH routines and threw away. ; +; Rewrote from scratch to enhance speed, ; +; efficiency, readability, and user friendliness. ; +; ZMD is capable of locating multiple filenames ; +; on multiple drive user areas with full drive ; +; and user area, filename, and time restrictions ; +; in force in 5 seconds (all other CP/M file ; +; transfer programs take 7 minutes or more) to ; +; find maximum 255 filenames. ; +; - Complete rewrites of: command line parsing, ; +; exit, abort, credit and descriptions routines. ; +; 06/18/87 v1.30 - Removed conditional assembly and modified to ; +; support .COM file installation/reconfiguration ; +; without reassembling. ; +; 06/17/87 v1.29 - Converted entire program to Microsoft MACRO-80 ; +; language. Programs no longer compatible with ; +; 8080 microcomputers. ; +;- -; + +;-------------------------------------------------------------------------; +; EXTERNAL Declarations: | +;------------------------------------------------------------------------- +; + + EXTRN BCDBIN,BLKSIZ,BUFSTR,BYECHK,CATCH,CHARLN,CKDIR,CLEARIT + EXTRN CMDBUF,CNREC,CONIN,CONONL,CONSTAT,CPDEHL,CPM3,CRCCHK + EXTRN CRCVAL,DATDEC,DATMSG,DBUF,DECOUT,DELAY,DIVREC,DSCFLG + EXTRN DSKSAV,DVHLDE,ERXIT,EXIT,FILCNT,FILTM1,FINCRC,FUNCHK + EXTRN GETDSC,GETKIND,GETOFF,GETSPD,GTCURDU,HEXO,ILPRT,ILPRTB + EXTRN ILPRTL,INCRNO,INITFCB,INITFLG,INITIT,INPUT,KDRV,KIND + EXTRN KSHOW,KTIM,LBRARC,LCASE,LOGBUF,LOW41K,MATCH,MCHFTYP + EXTRN MEMFCB,MODE,MOVFCB,MSGFLG,NAMBUF,NOARK,OLDDRV + EXTRN OLDUSR,PGSIZE,PRINTV,PRIVATE,RDARC,RDCOUNT,RECAR1 + EXTRN RECARE,RECDR1,RECDRX,RECTBL,RECV,RENFCB,RENTYP,RSDMA + EXTRN RSTLCK,SEND,SENDBEL,SETLCK,SHOCAT,SHONM,SHONM3,SHOSPD + EXTRN SNDABT,SPCDRV,STACK,STDMA,STORTM,TYPE,UCASE,USRSAV + EXTRN WAIT1,WHLCHK,XTIM,NEWNAM,SHONM4,NOROOM,BYEBDOS,BATCH + EXTRN FILIMT,PUPFLG,CHKTPA + +; +;-------------------------------------------------------------------------; +; PUBLIC Declarations: | +;-------------------------------------------------------------------------; +; + + PUBLIC KTABLE,XTABLE,KECTBL,DONE,EOTFLG,ABORT,ABORTX,HELP + PUBLIC KFLG,FCBBUF,HDRADR,RCNT,RECDNO,SAVEHL,RCDCNT,TIME + +; +;-------------------------------------------------------------------------; +; Program Starts Here | +;-------------------------------------------------------------------------; + + + .Z80 + ASEG + ORG 100H ; Program starts + JP BEGIN ; Jump around configuration table + INCLUDE ZMDHDR.Z80 ; Include the ZMD header overlay + .REQUEST ZMDSUBS ; Include the ZMD subroutines + +; +; +; Save current CP/M stack address +; +BEGIN: LD (STACK),SP ; Save current CP/M stack address + ;LD SP,STACK ; Initialize new one for ZMD + LD SP,0C000H ; [WBW] For HBIOS Fastpath + +; +; Save current drive and user area for later +; + LD A,255 + CALL RECAR1 ; Get current user + LD (OLDUSR),A ; Save current user + LD C,CURDRV ; Current drive + CALL BDOS + LD (OLDDRV),A ; Save current drive + ADD A,'A' ; Make it ASCII + LD (KDRV),A ; And store as default drive for DPB info + +; +; Display signon message and check environmental discrepencies +; + LD HL,ZMDNAM ; Point to this program's name + CALL PRINTV ; Display it and version number + +; +; If running under CPM3 tell rest of program +; + LD C,GETVER ; Get CPM version + CALL BDOS + CP 48 ; Version 3.0? + JR C,$+5 ; No, it's 2.n so skip next + LD (CPM3),A ; Else set CPM3 switch on + +; +; Locate modem I/O routines +; + CALL BYECHK ; BYE extended BDOS valid? + CP 5 + JR NZ,BEGIN0 ; No, check for I/O overlay + LD A,255 + LD (BYEBDOS),A ; Enable BYE extended BDOS for modem I/O + JR BEGIN1 + +BEGIN0: LD A,(MDINP+2) ; Check for MDINP address + OR A ; Anything there? + JP Z,NOIO ; No overlay either, bitch then exit + LD (INITFLG),A ; Tell exit routine to 'UNINIT' + CALL MINIT ; Initialize system routine (if included) + LD (MHZ),A ; [WBW] Save system speed reported by HBIOS + +; +; Get bit mapped access flags byte +; +BEGIN1: LD A,(ACCESS) ; Using access flags byte? + OR A + JR Z,BEGIN3 ; No + + CALL BYECHK ; Check version of BYE + CP 5 ; BYE5? + JR NZ,BEGIN2 ; No + + LD E,255 + LD C,85 ; Get access flags byte + CALL BDOS + LD (AFBYTE),A ; Store it + JR BEGIN3 + +BEGIN2: LD DE,ACBOFF ; Offset to access flags byte + CALL GETOFF ; Get address + LD A,(HL) ; HL points to access flags byte + LD (AFBYTE),A ; Store it + +; +; Set WRTLOC, display time on system +; +BEGIN3: CALL SETLCK ; Set WRTLOC if needed + CALL CATCH ; Gobble up garbage characters from line + CALL TIME ; Get clock values and display time on + +; +;-------------------------------------------------------------------------; +; P a r s e ' M o d e ' f r o m C o m m a n d T a i l | +;-------------------------------------------------------------------------; +; +; Second character in CP/M FCB contains program mode +; + LD HL,FCB+1 + LD A,(HL) ; Get the main option + LD (MODE),A ; Save it for later use + CP 'F' ; Free space? + JP Z,SPACE ; Yes + CP 'A' ; .ARC/.ARK member extraction? + JP Z,CKSND-3 ; Yes + CP 'L' ; .LBR member extraction? + JP Z,CKSND-3 ; Yes + CP 'S' ; Send a file? + JP Z,CKSND ; Yes + CP 'R' ; Receive a file? + JP NZ,HELP ; No, show help guide + +; +; Check additional 'R'eceive mode options +; + INC HL ; Point to next option + LD A,(HL) ; Put in A + CP 'P' ; Receive Private? + JR Z,CKRCV2-3 ; Yes + CP 'W' ; Receive Privileged? (No descriptions) + JR NZ,CKRCV1 ; No + LD A,(PUPOPT) ; Is >0 if allowing privileged uploads + LD (PUPFLG),A ; Sets our flag this way + OR A ; Allowed? + JP Z,HELP ; No, show help guide + JR CKRCV2 ; Else get next option + +CKRCV1: CP 'M' ; Receive message? + JR NZ,CKRCV3 ; No + LD A,(FCB1+1) ; See if a filename was requested + CP ' ' + JP Z,HELP ; No, batch mode not allowed + LD A,(MSGFIL) ; Is >0 if allowing message uploads + LD (MSGFLG),A ; Sets our flag this way + OR A ; Allowed? + JP Z,HELP ; No, show help guide + LD A,'P' ; Else... + LD (PRIVATE),A ; Set the private flag + +CKRCV2: INC HL ; Point to next option + LD A,(HL) ; Put in A + +CKRCV3: CP ' ' ; Anything there? + JP Z,BCHMSG ; No, see if requesting Batch + CP 'B' ; Batch mode? + JP Z,BCHMSG ; Yes + CP 'C' ; Force Checksum? + JP Z,CHKMSG ; Yes + CP 'X' ; Force 128 byte packets? + JP Z,XMDMSG ; Yes + CP 'K' ; Force 1k packets? + JP Z,YMDMSG ; Yes + JP HELP ; Invalid option, show help guide + +; +; Check additional 'S'end mode options +; + LD (LBRARC),A ; Set .LBR/.ARK/.ARC extraction flag + +CKSND: INC HL ; Next option on command line + LD A,(LBRARC) ; Get the member extraction flag + OR A ; Is is set? + JR Z,CKSND0 ; No, we can check for batch + LD A,(HL) ; Get the character + CP ' ' ; Any more options? + JP Z,YMDMSG ; No, and batch not used with extractions + +CKSND0: LD A,(HL) ; Get the character back + CP ' ' ; Any more options? + JR Z,BCHMSG ; No, check for batch intention + CP 'C' ; Force checksums? + JP Z,CHKMSG ; Show protocol + CP 'X' ; Force XMODEM protocol? + JP Z,XMDMSG ; Show protocol + CP 'K' ; Force 1k protocol? + JP Z,YMDMSG ; Show protocol + LD A,(LBRARC) ; Get LBR/ARC extraction flag + OR A ; Enabled? + JP NZ,NOMSG ; Yes, ignore Batch + LD A,(HL) ; Get option back + CP 'B' ; Forcing batch? + JR NZ,CKSND1 ; No + LD A,(PRIVATE) ; Get special download area flag + OR A ; Enabled? + JP NZ,NOMSG ; Yes, don't allow batch + JP BCMSG2 ; Go set batch flag and display mode + +CKSND1: CP 'P' ; Send private? + JP NZ,HELP ; No + LD (PRIVATE),A ; Enable private download + JR CKSND ; Loop for more options + +; +; Display the currently selected (or default) protocol. +; +BCHMSG: LD A,(MODE) ; Get main option again + CP 'R' ; Receiving? + JR NZ,BCMSG1 ; No + LD A,(FCB1+1) ; Was a file requested? + CP ' ' + JR Z,BCMSG2 ; No, in batch receive + + LD HL,FCB1+1 ; Point to secondary FCB + CALL CKWILD ; Check for wildcards + LD A,(BATCH) ; Batch enabled now? + OR A + JR NZ,BCMSG2 ; Yes, report protocol + JR YMDMSG ; Else, single file receive. Default to 1k + +; +; Scan the command line to see if there was any intention of batch and if +; so, set program environment to Ymodem 1k batch protocol. +; +BCMSG1: XOR A ; Clear accumulator + LD (MODE),A ; Gets us back from the SBTCH routines + CALL SBTCH ; Check for batch intention + LD A,'S' + LD (MODE),A ; Fix the transfer mode flag + LD A,(BATCH) ; Get the batch mode flag + OR A ; Was it enabled? + JR Z,YMDMSG ; No, sending single file. Default to 1k + +BCMSG2: CALL LOW41K ; 1k packets allowed? + JP C,TOOSLOW ; No, can't use batch + LD A,1 + LD (BATCH),A ; Enable batch + CALL ILPRTB + DB '1k Batch',0 + JR MSGEND + +YMDMSG: CALL LOW41K ; 1k packets allowed? + JR C,NOMSG ; No + LD (KFLG),A ; Enable 1k + CALL ILPRTB + DB '1k',0 + JR MSGEND + +XMDMSG: XOR A ; Clear accumulator + LD (KFLG),A ; Disable 1k blocks + CALL ILPRTB + DB '128 byte CRC',0 + JR MSGEND + +CHKMSG: XOR A ; Clear accumulator + LD (CRCFLG),A ; Disable CRC + LD (KFLG),A ; Disable 1k blocks (not allowed in Checksum) + CALL ILPRTB + DB '128 byte Checksum',0 + +MSGEND: CALL ILPRTB + DB ' enabled',0 + +NOMSG: CALL CHKTPA ; Calculate TPA limitations + CALL ILPRTB + DB CR,LF,0 + LD A,(MODE) ; Get transfer mode + CP 'R' ; Receiving? + JP Z,RCVFL ; Yes + LD A,'S' + LD (MODE),A ; Else make mode an 'S' (send mode) + +; +;-------------------------------------------------------------------------; +; ----> SNDFIL - S e n d f i l e ( s ) | +;-------------------------------------------------------------------------; +; +; The file specified in the ZMD command line is transferred over the phone +; to another computer with modem using the "S"end option. The data is sent +; 1 record at a time with headers, checksums, and retransmission on errors. +; +SNDFIL: LD A,(BATCH) ; Batch mode requested? + OR A + JP NZ,SBTCH ; Yes, go handle batch mode + +; +; Take care of single file transfer - not in batch +; + CALL LOGDU ; Log into drive and get DPB info + CALL GTCDUD ; Get current binary drive/user in DUU/DUD + CALL CNREC ; Calculate number of records (unless LBRARC) + CALL CATCH ; Clear the decks + CALL OPNFIL ; Open the file and check restrictions + +; +; Loop back here for the start of each BATCH file sent +; +SNDFL1: LD E,60 ; Number of seconds to wait for initial 'NAK' + +SNDFL2: CALL FUNCHK ; Check for function keys + CALL SNDABT ; Local abort? + LD B,1 + CALL RECV ; Wait 1 second for initial NAK + JR C,SNDFL3 ; No character + CP CRC ; CRC request? + JR Z,SNDFL4 ; Yes + CP KSND ; 1k request? + JR Z,SNDFL7 ; Yes + CP NAK ; NAK for checksum? + JR Z,SNDFL8 ; Yes + CP CANCEL ; Cancel? + JP Z,ABORT ; Yes + +SNDFL3: DEC E ; One less second + JP Z,ABORT ; Abort if 0 + JR SNDFL2 ; Else wait some more + +; +; Got a 'C', now wait up to 1 second for 'K' +; +SNDFL4: LD A,(BATCH) ; In batch mode? + OR A + JR NZ,SNDFL7 ; Yes, don't wait for 'K' + LD B,1 + CALL RECV ; Get character from remote + JR C,SNDFL5 ; No character received, so not using 1k + AND 7FH ; Strip high bit + CP '{' + JR Z,SNDFL4 ; Disregard noisy lines + CP KSND ; Requesting 1k? + JR Z,SNDFL7 ; Exit if yes, otherwise set CRC + +; +; Turn on the flag for CRC +; +SNDFL5: LD A,(KFLG) ; KFLG manually set from 'SK'? + OR A + JR NZ,SNDFL7 ; If yes, keep it set + +SNDFL6: XOR A + LD (KFLG),A ; Defaults to 128 character blocks + INC A + LD (CRCFLG),A ; Insures in CRC mode + CALL ILPRTL + DB CR + DB 'CRC',0 + JP SNDFL10 + +; +; Turn on the flag for 1k blocks and insure in CRC mode +; +SNDFL7: CALL LOW41K ; 1k packets allowed? + JP C,SNDFL6 ; No + LD (KFLG),A ; Set the flag for 1k blocks + LD (CRCFLG),A ; Insures in CRC mode + LD A,(BATCH) ; In Ymodem Batch? + OR A + CALL NZ,OPNFIL ; Yes, then open file/check restrictions + CALL ILPRTL + DB CR + DB 'Ymodem',0 + JR SNDFL10 + +; +; Turn on checksum flag, insure sending 128 character blocks +; +SNDFL8: LD A,(BATCH) ; In batch mode now? + OR A + JR NZ,SNDFL9 ; If yes, exit + XOR A + LD (CRCFLG),A ; Make sure in checksum mode + LD (KFLG),A ; Defaults to 128 character blocks + CALL ILPRTL + DB CR + DB 'Checksum',0 + JR SNDFL10 + +SNDFL9: CALL ILPRTL + DB CR + DB '-- Checksum not used in batch' + DB CR,LF,0 + JP SNDFL2 ; If yes, ignore checksum request + +SNDFL10:CALL ILPRTL + DB ' requested ' + DB CR,LF,0 + CALL RDBLOK ; Put up to 16k from file into buffer + CALL SETFLG ; Disable 1k if less than 8 records left + +; +; Loop back here to send the next 1k/128 byte block after a successful trans- +; mission. If using 1k blocks, check the ACK ratio. Check total error count +; vs. records sent, and switch from 1k to 128 byte transmissions if higher. +; +SNDLP: LD A,(KFLG) ; Using 1k blocks? + OR A + JP Z,RDRECD ; If not, skip checking 1k error ratio + LD A,(ERRCNT) ; See if we got any errors last record + CP 4 ; 4 or more? + JR NC,SNDLP1 ; Yes, switch to 128 size + LD A,(ACCERR) ; See if up to minimum errors yet + CP 3 ; Had as many as three errors yet? + JR C,RDRECD ; If not, don't get excited too quickly + + LD HL,(RECDNO) ; Get current record number increment + LD DE,65528 ; Have not successfully sent this 1k yet + ADD HL,DE ; Subtract the current increment, then + LD DE,(ACCERR) ; Number of non-'ACK' errors in HL + CALL DVHLDE ; Get ratio in BC of records/hit + CALL GETSPD ; Get current speed + CP 5 ; 1200 baud? + LD A,70 ; for 1200 bps + JR Z,$+4 ; If 1200, skip next line + LD A,42 ; for 2400 bps + CP C ; Compare with actual ratio + JR C,RDRECD ; Continue if less hits than allowed + +SNDLP1: XOR A ; Clear A + LD (KFLG),A ; Reset system to 128 byte blocks + CALL ILPRTL ; Inform locally + DB ' - YMODEM 1k blocks disabled' + DB CR,LF,0 + +; +; Read a record, refill buffer if empty, update record read +; +RDRECD: LD A,(RECNBF) ; Any records in the buffer? + OR A + JR Z,RDBLOCK ; No, go get some + LD A,(KFLG) ; Using 1k blocks? + OR A + JR Z,RDREC1 ; No, exit + LD A,(RECNBF) ; See how many records in buffer + CP 8 ; 8 or more records? + JR NC,RDREC2 ; Yes, stay in 1k blocks + XOR A + LD (KFLG),A ; Reset the 1k flag for 128 byte + +RDREC1: LD A,(RECNBF) ; Point to number of records in buffer + DEC A ; Decrement it for 128 character blocks + LD (RECNBF),A ; Store it + JP SNDLP2 ; Send it + +RDREC2: SUB 8 ; Subtract 8 records (1k worth) + LD (RECNBF),A ; Store it + JP SNDLP2 ; Send it + +; +; Buffer is empty - read in another block of 16k +; +RDBLOCK:LD A,(EOFLG) ; Get 'EOF' flag + CP 1 ; Is it set? + SCF ; To show 'EOF' + JP Z,SNDLP2 ; Got 'EOF' + CALL RDBLOK ; Read up to 16k into DBUF + JR RDRECD ; Pass record to caller + +; +; Read up to 16k from the disk file into the buffer, ready to send +; +RDBLOK: LD C,0 ; Set number of records in block to 0 + LD DE,DBUF ; Point to disk buffer as destination + +RDBLOK1:PUSH BC + PUSH DE + LD A,(LBRARC) ; Get ARK/ARC/LBR extraction flag + OR A ; Enabled? + JR Z,RDBLOK2 ; No, skip next + LD A,(FCB+9) ; Get filetype byte 1 + AND 7FH ; Strip high bit + CP 'A' ; Is it an ARK/ARC extraction? + CALL Z,RDARC ; Yes, (flags saved at RDARC) + JR Z,RDBLOK3 ; Same flags + +RDBLOK2:CALL STDMA ; Set DMA address + LD C,READ + LD DE,FCB + CALL BDOS + +RDBLOK3:POP DE + POP BC + OR A ; Read ok? + JR NZ,RDBLOK5 ; If not, error or end of file + LD HL,128 ; Add length of one record + ADD HL,DE ; To next buffer + EX DE,HL ; Buffer to 'DE' + INC C ; More records? + LD A,(BUFSIZ) + ADD A,A + ADD A,A + ADD A,A + CP C + JR NZ,RDBLOK1 ; Read more + +; +; Buffer is full or got EOF +; +RDBLOK4:LD (RECNBF),A ; Store record count + LD HL,DBUF ; Get the beginning buffer address + LD (RECPTR),HL ; Save for next record + JP RSDMA ; Reset DMA address to default + +RDBLOK5:DEC A ; 'EOF'? + JR NZ,READERR ; Got 'EOF' + +RDBLOK6:INC A + LD (EOFLG),A ; Set EOF flag + LD A,C + JR RDBLOK4 + +READERR:CALL ILPRTB + DB CR,LF + DB '-- Read Error: ',0 + CALL SHONM3 + JP EXIT + +; +; Now send the next record +; +SNDLP2: JP C,SNDEOF ; Send 'EOF' if done + CALL INCRNO ; Bump record number if sent ok + XOR A ; Initialize error count to zero + LD (ERRCNT),A + +SNDRPT: CALL CKABORT ; Check for remote abort + CALL SNDABT ; Check for local abort + CALL SNDHDR ; Send a header + CALL SNDREC ; Send data record + CALL SNDCHK ; Send CRC or checksum value + CALL GTACK ; Get the 'ACK' + CP ACK ; ACK? + JR NZ,SNDRPT ; No, repeat transmission + LD DE,128 ; For 128 character blocks + LD A,(KFLG) ; See if last block sent was 1k + OR A + JR Z,$+5 ; No, skip next line + LD DE,1024 ; Else set for 1024 character blocks + LD HL,(RECPTR) ; Get the buffer pointer + ADD HL,DE ; Increment for the record just sent + LD (RECPTR),HL ; New buffer address for next block + LD A,(LBRARC) ; Get LBR/ARC/ARK extraction flag + OR A ; Enabled? + JP Z,SNDLP ; No + LD A,(KFLG) ; 1k enabled? + LD DE,65535 ; 128 byte + OR A + JR Z,$+5 + LD DE,65528 ; 1k + LD HL,(RCNT) ; Alter the records-sent count + ADD HL,DE + LD (RCNT),HL ; One less transmission to go + OR A ; 'K' flag set? + CALL NZ,SETFLG ; Yes, see if enough records for 1k packet + LD HL,(RCNT) ; See if anything was actually sent + LD A,H + OR L ; L and H both zero now? + JP NZ,SNDLP ; No, continue + +; +; End of Transmission (Send mode) +; +SNDEOF: LD A,(LOGLDS) ; Counting transfers? + OR A + JR Z,SNDEOF1 ; No + LD A,(PRIVATE) ; Is this a private transfer? + OR A + JR NZ,SNDEOF1 ; Yes, don't increment download count + LD IY,(DNLDS) ; Get Downloads counter address + INC (IY) ; One more download since log in + +SNDEOF1:CALL LOGCALL ; Log transfer if supposed to + CALL EOFSND + CALL ADDTON ; Update BYE's time on byte if supposed to + CALL ALLDON + JP DONE + +; +; See if enough records left to use 1k protocol +; +SETFLG: LD HL,(RCNT) + LD A,H ; Anything in the 'H' register? + OR A + RET NZ ; Yes, enough records for another 1k packet + LD A,L ; Get number of records in 'L' register + CP 8 ; At least 8 yet? + RET NC ; Yes, keep going + XOR A ; Reset the 'K' flag + LD (KFLG),A + RET + +; +; HL points to filename FCB - now search for it wildcards. If any, enable +; BATCH flag and pad with '?' as needed +; +CKWILD: LD B,8 ; Check first 8 bytes + CALL CKWLD1 + LD B,3 ; And check filetype + +CKWLD1: LD A,(HL) ; Get the character + CP '*' ; '*'? + JR NZ,CKWLD2 ; No, check for little wildcards + LD (BATCH),A ; Enable AUTO-BATCH + LD A,'?' ; Fill rest with '?' character + JP INITIT ; Initialize + +CKWLD2: CP '?' ; '?'? + JR NZ,$+5 ; No, don't enable AUTO-BATCH + LD (BATCH),A ; Enable AUTO-BATCH + INC HL ; Point to next character + DJNZ CKWLD1 ; Loop until B=0 + RET + +; +; Get the current drive/user +; +GTCDUD: LD A,0FFH ; Stuffed into E at RECAR1 + CALL RECAR1 ; Get current user area + LD (DUU),A ; Store it + LD C,CURDRV ; Get current drive + CALL BDOS + LD (DUD),A ; Store it + RET + +; +;-------------------------------------------------------------------------; +; S e n d B a t c h | +;-------------------------------------------------------------------------; +; +; Copy original command line buffer to internal work buffer +; +SBTCH: LD A,(FSTFLG) ; If first time through + OR A + JP NZ,SBTCH1 ; If not first time, exit + + LD HL,TBUF ; Source + LD DE,CMDBUF ; Destination + LD BC,128 ; Count + LDIR ; Move + +; +; Locate end of command line and place a ' ' as a delimiter +; + LD HL,CMDBUF ; Point to number of bytes in line + LD B,0 ; Zero high order + LD C,(HL) ; Number of characters in command line + INC HL ; Point to start of line + ADD HL,BC ; Plus number of characters equals end of line + LD (HL),' ' ; Place the delimiter at end of line + INC BC ; Increment character count for delimiter + +; +; Count ambiguous/unambiguous filenames in command line +; + XOR A ; Clear accumulator + LD (FILCNT),A ; Reset the file count + LD (NAMECT),A ; Reset name count (used in parsing routines) + LD HL,CMDBUF+2 ; Point to command tail option + LD A,' ' ; Looking for space/non-space characters + CPIR ; On command option, look for next space + JP PO,SCANDN ; If at end of line, done + CPI ; Find first character of first name + JP PO,SCANDN ; If at end of line, done + JR Z,$-5 ; Eat extra spaces + DEC HL ; CPI is one ahead of us, so back up + LD (BGNMS),HL ; Store address of beginning name + INC HL ; And it was supposed to be, so restore it + +SCANLP: CPIR ; Move to end of current name (next space) + EX AF,AF' ; Save A (match char) & current flags (result) + LD A,(NAMECT) ; Get current name count + INC A ; Bump it one + LD (NAMECT),A ; Put it back + CP 255 ; 255 names? + JR Z,SCANDN ; Yes, that's all we allow + EX AF,AF' ; Restore A and old flags + JP PO,SCANDN ; If at end of line, done + CPI ; Find next non-space character + JP PO,SCANDN ; If at end of line, done + JR Z,$-5 ; Was a space, keep looking + JR SCANLP ; Found next non-space, find next name + +SCANDN: LD A,(NAMECT) ; Get the ambiguous filename count + OR A ; Were there any? + JP Z,HELP ; No, they must need help + CP 1 ; Just 1 name? + JR Z,$+5 ; If only 1, don't force AUTO-BATCH here + LD (BATCH),A ; Else set batch mode flag (for AUTO-BATCH) + LD HL,NAMBUF ; Get start of batch filename buffer + LD (NBSAVE),HL ; Save as address of the first name + +; +; Place a name in work buffer +; +TNLP: LD B,0 ; Initialize character count + LD HL,(BGNMS) ; Source is address of first name + LD DE,FCBBUF+2 ; Destination + +TNLP1: LD A,(HL) ; Get a byte in A + CP ' ' ; A space? + JR Z,TNLP2 ; Yes, done with name + LD (DE),A ; Move character to FCB buffer + INC HL ; Increment pointers + INC DE + INC B ; Bump count of characters in name + JR TNLP1 ; Loop until space + +TNLP2: INC HL ; Point to next character + LD A,(HL) ; Put it in A + CP ' ' ; Is it a ' '? + JR Z,TNLP2 ; Yes, eat extra spaces + LD (BGNMS),HL ; Store address of next name + LD HL,FCBBUF+1 ; # characters in filename + LD (HL),B ; Before name + +; +; Initialize FCB for search routines +; + LD A,0 ; String of all 0's for intitialization + LD HL,FCB ; Destination + LD B,16 ; 16 bytes + CALL INITIT ; Initialize FCB + + LD HL,FCBBUF+1 ; Point to # of bytes in command line + LD D,0 ; Zero high order + LD E,(HL) ; Load DE pair with # bytes + INC HL ; Increment to start of command line + ADD HL,DE ; Point to byte after last character + LD (HL),CR ; Store CR for delimiter + +; +; Check for valid drive/user combination and move filename to FCB +; + LD HL,FCBBUF+2 ; Start of filename + LD DE,DUSAVE ; Isolate possible 'duu:' + LD BC,4 ; Up to 4 bytes + LDIR ; For logging into specified d/u + + LD HL,FCBBUF+1 ; Point to amount of characters in filename + LD B,(HL) ; In B for d/u parsing routines + INC B ; Increment character count for CR terminator + INC HL ; And point to start filename again + LD (SAVEHL),HL ; Initialize 'current' address pointer + + LD A,(MODE) ; Get transfer mode + PUSH AF ; Save it while checking valid d/u + XOR A ; Zero accumulator for new mode + LD (MODE),A ; Save it (keeps us out of trouble in LGDU1:) + CALL LGDU1 ; Check valid d/u and copy filename to FCB + CALL GTCDUD ; Get current binary drive user in DUU/DUD + POP AF ; Get possible previously determined mode + LD (MODE),A ; Restore + LD HL,FCB+1 ; Filename FCB + CALL CKWILD ; Check it for wildcards, enable Batch if any + + LD A,(MODE) ; Get file transfer mode + OR A ; 0=checking batch intention + RET Z ; All done if so + +; +; Now search directory and store first matching filename +; + CALL RSDMA ; Reset to default memory address + LD A,'?' + LD (FCBEXT),A ; Fetch all extents of matching filenames + XOR A + LD (FCBRNO),A ; Clear FCB record number byte + LD DE,FCB ; Use default FCB for search + LD C,SRCHF ; Search for first occurence + CALL BDOS + CP 0FFH ; Anything found? + JP Z,NEXTNM ; No, go get next ambiguous filename + LD HL,(LIST) ; Initialize list pointer parameters + LD (LISTPOS),HL ; Save current position of list + +; +; Calculate offset to matched directory entry +; +FNDENT: AND 3 ; Zero based, two bit index + ADD A,A ; *2 + ADD A,A ; *4 + ADD A,A ; *8 + ADD A,A ; *16 + ADD A,A ; *32 to make position index + LD C,A ; Put in BC + XOR B ; Clear MSB + LD HL,TBUF ; Address of default command line buffer + ADD HL,BC ; And offset to matched directory entry + LD A,(DUD) ; Get drive number + LD (HL),A ; Put in front of name in name buffer + +; +; Check the match for download restrictions +; + PUSH HL ; Save address of matched entry + PUSH HL ; Save another copy + POP IX ; As address of filename to check + CALL RESTRCT ; Check for download restrictions + POP HL ; Get our matched entry address back + JP NZ,DONEXT ; NZ=entry not allowed + +; +; Trap zero length file before adding to list +; + PUSH HL ; Save matched entry address + POP IY ; Get a copy in IY + LD A,(IY+12) ; Get the extent byte + OR A ; Is this the first extent? (#0) + JR NZ,COPYNM ; No, can't be 0 length (at least 16k already) + LD A,(IY+15) ; Get it + OR A ; Any records? + JP Z,DONEXT ; No, zero length, but in batch so no messages + +; +; Copy the name to list +; +COPYNM: LD A,(FSTFLG) ; Displayed the following message yet? + OR A + JR NZ,NAM2LST ; Yes, they alreay know to wait + PUSH HL ; Save matched entry address + CALL ILPRTB + DB CR,LF + DB 'Locating selection(s)...',0 + LD A,1 + LD (FSTFLG),A ; Set so message don't show again + POP HL ; Restore matched entry address + +NAM2LST:LD DE,(LISTPOS) ; Pointer to current load point in list + LD B,12 ; Move drive number and name to list + +NM2LST1:LD A,(HL) ; HL contains address of entry + AND 7FH ; All done with high bits + LD (DE),A ; Move it to list + INC HL ; Increment pointer + INC DE + DJNZ NM2LST1 ; Loop until B equals 0 + LD A,(HL) ; Get the EX byte + LD (DE),A ; Put it in list + INC HL ; Increment to RC byte + INC HL + INC HL + INC DE + LD A,(HL) ; Get it + LD (DE),A ; Put it in list + INC DE ; Point to start of next name in list + LD A,(DUU) + LD (DE),A + INC DE + INC DE + LD (LISTPOS),DE ; Store address of next load point + +; +; Search for next occurance of specified filename +; +DONEXT: LD C,SRCHN ; Search next function code + LD DE,FCB ; Filename specification field + CALL BDOS + CP 0FFH ; See if all through directory yet + JP NZ,FNDENT ; If not, calculate code offset and add 2 list + +; +; Trap conditions of 0 files found +; + LD HL,(LISTPOS) ; Get the end of list address + LD DE,(LIST) ; Get beginning of list address + CALL CPDEHL ; Are they the same? + JP Z,NEXTNM ; Yes, none of the files found were allowed + +; +; Prepare associated sort parameters +; + LD HL,(LIST) ; Adjust I and J pointers for initial sort + LD (LISTI),HL ; Beginning of list + LD DE,ITEMSZ ; Get offset to next name + ADD HL,DE ; Add the offset + LD (LISTJ),HL ; Into J variable + +; +; Don't need a sort if only 1 file extent found +; + LD HL,(LIST) ; Was there more than one entry found? + LD BC,ITEMSZ + ADD HL,BC + EX DE,HL + LD HL,(LISTPOS) ; Next load name of list is start of buffer + LD (LISTEND),HL ; Set list end marker + CALL CPDEHL ; Compare DE address with HL address + JP Z,MINNN ; If same, no sort needed + +; +; Sort the list by disk, filename, and EX byte. +; +SORT: LD HL,(LISTI) ; Compare entries I and J + LD DE,(LISTJ) + LD B,13 ; Number of bytes to compare + CALL MATCH ; + JR NC,SORT1 ; Swap entries if J is larger than I + LD HL,(LISTI) ; Get our original pointers back + LD DE,(LISTJ) + LD B,ITEMSZ ; Counter for number of bytes to swap + +SWAP: LD C,(HL) ; Get character from string 1 + LD A,(DE) ; And one from other string + LD (HL),A ; Second into first + LD A,C ; First into second + LD (DE),A + INC HL ; Bump swap pointers + INC DE + DJNZ SWAP ; Loop until B=0 + +SORT1: LD HL,(LISTJ) ; Increment J pointer + LD DE,ITEMSZ ; By the amount of items per entry + ADD HL,DE + LD (LISTJ),HL + LD DE,(LISTEND) ; Get the address of the end of list + CALL CPDEHL ; DE and HL the same? + JR NZ,SORT ; No, so more J loop + + LD HL,(LISTI) ; Get the I pointer + LD DE,ITEMSZ ; Get offset to next name + ADD HL,DE ; Add + LD (LISTI),HL + ADD HL,DE ; Add offset to next name + LD (LISTJ),HL ; Start J loop over again + LD DE,(LISTEND) ; Get the address of the end of list + CALL CPDEHL ; DE and HL the same? + JR NZ,SORT ; No, must be more I loop to go + +; +; List minimization loop +; + LD HL,(LIST) ; Point to the beginning of our list + LD (LISTI),HL ; Initialize current name pointer + LD DE,ITEMSZ ; Get offset to next name + ADD HL,DE ; Add it to current name address + LD (LISTJ),HL ; Store as next name + +MINCL: LD DE,(LISTEND) ; End of list address + LD HL,(LISTJ) ; Next name address + CALL CPDEHL ; Are they the same? + JR Z,MINNN ; Yes, go set kbytes on last name (End of list) + + LD DE,(LISTJ) ; Next name address + LD HL,(LISTI) ; Current name address + LD B,12 ; # of bytes to check + CALL MATCH ; Are they the same? + JR NZ,MINNN ; No, go set kbytes on last extent (Next name) + +; +; Increment next name pointer and get parameter bytes +; + LD HL,(LISTJ) ; Fetch EX and RC from next name + LD DE,ITEMSZ ; Offset to next name + ADD HL,DE ; Add it + LD (LISTJ),HL ; Save bumped J value + + DEC HL ; Point to parameter bytes of previous name + DEC HL + DEC HL + LD B,(HL) ; Save the RC byte + DEC HL + LD C,(HL) ; Save the EX number + + LD HL,(LISTI) ; Point at current name + ADD HL,DE ; Point at current name info bytes + DEC HL + DEC HL + DEC HL + LD D,(HL) ; Fetch that RC byte + DEC HL + LD E,(HL) ; Fetch current EX byte + + LD A,E ; Check if new EXtent is bigger than last + CP C + JR NC,MINCL ; Skip using size of a less or equal EX + LD (HL),C ; Put new sizes into the location + INC HL + LD (HL),B ; New RC byte too + JR MINCL ; Continue handling as current file + +; +; File size computation loop +; +MINNN: LD HL,(LISTI) ; Point to name to convert records + LD DE,ITEMSZ-4 ; Index to largest extent number + ADD HL,DE ; Add the offset + LD B,(HL) ; Get the extent number for a loop counter + INC HL ; Bump to the last extent RC byte + PUSH HL ; Save pointer to list parameters + LD HL,0 ; Zero extent total record count + LD DE,128 ; Set size of one extent + +; +; Calculate total number of 128 byte records +; +MINEL: LD A,B ; Get the number of extents left + OR A ; Any more? + JR Z,MINELD ; No, done with 128 multiply + ADD HL,DE ; Else add another 128 to HL + DEC B ; 1 less extent left + JR MINEL ; Loop until no more + +MINELD: EX DE,HL ; Total extent size to DE + POP HL ; Get back RC byte pointer + LD B,0 + LD C,(HL) ; Get final extent size to BC + EX DE,HL ; Add remainder to total records in DE + ADD HL,BC + LD B,H ; Move total record count to BC + LD C,L + LD HL,(TOTREC) ; Get current total records + ADD HL,BC ; Add records of this file + LD (TOTREC),HL ; And save it for later display + EX DE,HL ; Get table entry pointer back in HL + CALL ROUNDK ; Get disk space needed for file DE + LD (HL),D ; Put kilobyte count in table + DEC HL + LD (HL),E + LD A,(FILCNT) ; Bump the file count + CP 255 ; 255 file names yet? + JR Z,MINN0 ; Yes, that's all we allow + INC A ; Else bump it one + LD (FILCNT),A ; Store it + LD HL,(FILEK) ; Get current total file kilobytes + ADD HL,DE ; Add in the current file's kilobyte size + LD (FILEK),HL ; And store it + LD HL,(LISTI) ; Source + LD DE,(NBSAVE) ; Destination + LD BC,16 ; 16 byte count + LDIR ; Move filename to names buffer + LD (NBSAVE),DE ; And store address to put next filename + +MINN0: LD DE,(LISTJ) ; Done with all names + LD HL,(LISTEND) ; Check if at end of list + CALL CPDEHL + JR Z,NEXTNM ; Get next ambiguous filename, if finished + LD HL,(LISTI) ; Point to LISTI value + LD DE,ITEMSZ ; Point to next position + ADD HL,DE + LD (LISTI),HL ; Set new working LISTI + LD DE,(LISTI) + LD HL,(LISTJ) ; Next name position to copy from + CALL CPDEHL ; See if pointers only one apart + JR Z,MINN1 ; If so, don't cover up one name + LD BC,ITEMSZ + LDIR ; Move that name up there + JR MINN2 + +MINN1: LD DE,ITEMSZ ; No open slot, so just move LISTJ up one slot + ADD HL,DE + +MINN2: LD (LISTJ),HL + JP MINCL ; Go to MIN NAME start of loop + +NEXTNM: LD A,(OLDDRV) + CALL RECDRX ; Restore default drive + LD A,(OLDUSR) + CALL RECAR1 ; Restore default user + LD A,(NAMECT) ; Get number of names found + DEC A ; Decrement it + LD (NAMECT),A ; Put it back + JP NZ,TNLP ; Loop until zero + LD (FSTFLG),A ; Done with first time flag, reinitialize it + LD HL,NAMBUF ; Save start of buffer + LD (NBSAVE),HL + + LD A,(FILCNT) ; Get total files + LD (SHOCNT),A + OR A ; Were there any? + JR NZ,NXTNM1 ; Yes + CALL ILPRT + DB CR,LF,0 + JP NOFILE ; No + +NXTNM1: CALL ILPRTB + DB CR + DB 'Number of files found > ',0 + LD A,(SHOCNT) + LD L,A + LD H,0 + CALL DECOUT ; Show number of files found + LD HL,(TOTREC) + LD (RCNT),HL + LD A,1 + LD (SBSHOW),A ; Get's us back early + CALL OPNOK2 ; Go show total file stats + XOR A + LD (SBSHOW),A + +SBTCH1: LD A,(FILCNT) ; Get the count of files to send + OR A ; Is there any? + JP Z,SNDFN ; No + LD A,(FSTFLG) ; Past first batch file yet? + LD (CONONL),A ; Toggle to local display only + OR A + CALL NZ,CLEARIT ; Else show local + CALL ILPRT + DB CR,LF,LF + DB 'Total transfer time > ',0 + CALL GETSPD ; Get speed indicator + CP 1 ; Are we at 300 bps? + LD HL,XTABLE ; This gives us 128-byte transfer time + JR Z,$+5 ; Yes, skip next line, show 128-byte time + LD HL,KTABLE ; This gives us 1k transfer time + LD D,0 + LD E,A ; Set up for table access + ADD HL,DE ; Index to proper factor + ADD HL,DE + LD E,(HL) + INC HL + LD D,(HL) + LD HL,(TOTREC) ; Get number of records + CALL FILTM1 + CALL XFRTIM ; Check for time restrictions + CALL ILPRT + DB CR,LF,0 + LD A,(FSTFLG) + OR A + CALL Z,DLRDY + +; +; Send the batch filename to remote +; +SNDFN: CALL CKABORT ; Check for remote abort + LD HL,FCB + CALL INITFCB ; Initialize FCB + XOR A + LD (ERRCNT),A ; Reset the error count + INC A + LD (CONONL),A ; Set to local display only + LD A,(FILCNT) ; Get file count + OR A + JP Z,CCHECK ; No more files, exit + LD A,1 + LD (CRCFLG),A ; Make sure in CRC mode + + LD A,0FFH + CALL RECAR1 ; Get the current user area + LD B,A ; Save current user area + PUSH BC ; On stack + LD HL,(NBSAVE) ; Get start of filename + LD BC,14 ; Offset to user area + ADD HL,BC ; Point to binary user area + LD A,(HL) ; Get it + POP BC ; Get current user area back + CP B ; Same? + CALL NZ,RECAR1 ; No, but it is now + CALL SPCDRV ; Get disk parameter block info + + LD HL,(NBSAVE) ; Get address of next batch filename + INC (HL) ; Escape default situation in FCB drive byte + LD DE,FCB ; Where to put it + LD BC,12 ; 12 bytes for drive and filename + LDIR ; Move + LD BC,4 ; Next filename is 4 bytes away + ADD HL,BC ; Add offset + LD (NBSAVE),HL ; Store address for next filename + LD HL,(RECPTR) ; Where to load the 0 block + EX DE,HL ; Put into DE + LD HL,FCB+1 ; Get the start of the filename in HL + LD B,8 + +SZMD1: LD A,(HL) + AND 7FH ; Strip any high bit set + OR A + JR Z,SZMD6 ; Null pathname + CP ' ' + JR Z,SZMD3 + +SZMD2: CALL LCASE ; Put file name in lower case for UNIX + LD (DE),A + INC HL + INC DE + DJNZ SZMD1 + JR SZMD4 + +SZMD3: INC HL ; Skip over spaces if short name + DJNZ SZMD3 + +SZMD4: LD A,(HL) + CP ' ' + JR Z,SZMD6 ; Missing file type field + LD A,'.' ; Send name-type seperator + LD (DE),A + INC DE + LD B,3 + +SZMD5: LD A,(HL) + AND 7FH ; Strip any high bit set + CP ' ' + JR Z,SZMD6 + CALL LCASE ; Put in lower case for UNIX + LD (DE),A + INC HL + INC DE + DJNZ SZMD5 + +SZMD6: EX DE,HL ; Get the address back to HL + LD (HL),0 + INC HL + LD (HDRADR),HL + CALL CNREC ; Get number of records in this file + CALL CHARLN ; Include the ASCII character length + +SZMD7: LD (HL),0 ; Fill rest with zeroes + INC L ; Pad to end of block with binary 0 + JR NZ,SZMD7 + LD HL,(RCNT) + LD (BUFSTR),HL ; Store the file length at end of block + XOR A ; Make sure the header starts with Zero + LD (RCDCNT),A + +; +; Wait for 'C' from remote to indicate he is ready +; +CCHECK: LD E,60 ; Wait up to 60 seconds to abort + +CCHECK1:CALL CKABORT ; Manually requesting an abort? + LD B,3 + CALL RECV ; Wait up to 5 seconds for a character + JR C,CCHECK2 ; No character, decrement counter + CP CANCEL ; If they sent a CTL-X, abort now + CALL Z,CKCAN + CP CRC ; If they sent a CRC, go to work + JR Z,SZMD8 + JR CCHECK ; None of these, wait some more + +CCHECK2:DEC E ; One less to go + JR NZ,CCHECK1 + JP ACKMSG ; Abort if timed out and no character + +SZMD8: LD A,(FILCNT) ; Any files to send? + OR A + JR NZ,SZMD9 ; Yes, continue + XOR A ; Reset the pointers + LD (ACKCHK),A ; Reset flag for normal GTACK use + LD (RCDCNT),A ; Reset the record counter + LD (KFLG),A ; Show in 128 size now + LD HL,(RECPTR) + LD (HL),A ; Reset record pointer + LD A,SOH ; Send a start of header + CALL SEND + CALL SNDHNM ; This header is a zero count + CALL SNDREC ; Send an empty record + CALL SNDCRC ; Send the CRC for the empty record + LD A,(GOTONE) ; Did we actually send at least one? + OR A + JP Z,ABORT ; If not, don't act like we did + CALL EOFSND ; No more files so send EOT to finish + CALL XFRDON + JP EXIT + +; +; Now send the 128 byte filename record +; +SZMD9: DEC A ; Decrement file count for this one + LD (FILCNT),A ; Store it + +SZMD10: XOR A + LD (KFLG),A + LD A,SOH ; Send SOH + LD (ACKCHK),A + CALL SEND ; Send SOH character to the modem + CALL SNDHNM ; Send header (record number, inverse) + CALL SNDREC ; Send a 128 byte record + CALL SNDCRC ; Send a two byte CRC + CALL GTACK + CP ACK + JR NZ,SZMD10 ; Not an ACK, send it again + XOR A + LD (ACKCHK),A ; Reset flag for normal GTACK use + CALL LOW41K ; Check speed being used + JR C,$+7 ; Don't allow 1k blocks if less than MINKSPD + LD A,1 + LD (KFLG),A ; Change to 1k for normal file xfer + XOR A ; Clear A + LD (ERRCNT),A ; Start fresh for the main file + JP SNDFL1 + +; +; Send EOT. Get Acknowledgement from remote. Try up to 4 times then abort. +; +EOFSND: LD A,EOT ; Send an 'EOT' + CALL SEND + LD A,(CHKEOT) ; Did not get an ACK, try again + INC A + LD (CHKEOT),A ; Limit number of retries to 4 + CP 4 ; (to prevent possible 'lock-up') + RET NC ; Quit if already sent 4 or more + CALL GTACK ; Get the ACK + CP ACK + JR NZ,EOFSND ; Resend if no ACK + RET + +ALLDON: LD A,(BATCH) ; In batch mode? + OR A + RET NZ ; If yes, ignore message + CALL ILPRT ; (Want to keep this a separate message) + DB CR,LF,0 + +XFRDON: CALL ILPRTL + DB CR,LF + DB '-- Transfer completed' + DB CR,LF,0 + RET + +; +;-------------------------------------------------------------------------; +; ----> RCVFL - R e c e i v e f i l e ( s ) | +;-------------------------------------------------------------------------; +; +; The filename specified in ZMD command line is transferred over the phone +; from the user's computer to the RCPM system via modem using the 'R' +; (receive) option. The data is sent one record at a time, with headers +; and checksums and retransmissions on errors. 'RM' option is disallowed +; at time of command tail parsing at beginning of program (MSGFLG cannot +; be set unless MSGFIL is enabled). +; +RCVFL: LD A,(MSGFLG) ; Get message file upload flag + OR A ; Enabled? + JR Z,RCVF2 ; No, skip the rest + CALL WHLCHK ; Yes, WHEEL byte set? + JR NZ,RCVF1 ; Yes, turn it off and skip access check + + LD A,(ACCESS) ; Checking access restrictions? + OR A + JR Z,RCVF3 ; No + LD A,(AFBYTE) ; Get access flags byte + AND 8 ; Test for write access (bit 3) + JP Z,NOACC ; Not allowed to write messages + +RCVF1: XOR A ; Clear A + LD HL,(WHEEL) ; Point to WHEEL byte + LD (HL),A ; And stuff a 0 to turn WHEEL off + JR RCVF3 ; WHEEL 'was' on, so skip access check + +; +; Check additional receive flags +; +RCVF2: LD A,(ACCESS) ; Checking access restrictions? + OR A + JR Z,RCVF3 ; No + CALL WHLCHK ; SYSOP online? + JR NZ,RCVF3 ; Yep, skip all this checking + LD A,(PUPFLG) ; Privileged transfer option request? + OR A + LD A,(AFBYTE) ; Get access flags byte + JR Z,$+7 ; No + AND 80H ; Test for privileged user access (bit 7) + JP Z,NOACC ; Not allowed to use "RW" option + AND 40H ; Test for upload access (bit 6) + JP Z,NOACC ; Not allowed to upload files + +; +; User has the access he asked for +; +RCVF3: LD A,(BATCH) ; Requesting batch mode? + OR A + JP NZ,RBTCH ; Yes, go do batch stuff first + CALL RCVFL1 ; Find drive/user/filetype permitted + LD IX,FCB + CALL RESTRCT ; Check restrictions on uploads + CALL CONTIN ; Display drive/user area + CALL MAKEFIL ; Open the file, ready to receive + +; +; Receive records until EOT +; +RCVLP: XOR A + LD (ERRCNT),A ; Initialize error count to zero + CALL RCVRECD ; Receive a record + JR NC,RCVLP1 ; If not EOT, store this record and get next + LD HL,(RECDNO) ; Get number of records + LD A,H + OR L ; 0 length file? + JP Z,ABORT ; Yes, abort and erase file + LD A,(EOTFLG) ; This the first EOT character? + OR A + JP NZ,RCVEOT ; No, exit + LD A,NAK + LD (EOTFLG),A ; Set the flag + CALL SEND ; Send a NAK + JR RCVLP ; Go wait another EOT + +; +; Increment record number +; +RCVLP1: CALL INCRNO ; Bump record number, if received ok + LD HL,(RECPTR) ; Get buffer address + LD DE,128 ; 128 chars/record + LD A,(KFLG) ; Using 1k blocks? + OR A + JR Z,$+5 ; If not, skip next line + LD DE,1024 ; 1k/record + ADD HL,DE ; To next buffer + LD (RECPTR),HL ; Save buffer address + LD A,(KFLG) ; Using 1k blocks? + OR A + LD A,(RECNBF) ; Get number of records in buffer + JR Z,$+6 ; If not, skip next 2 lines + ADD A,8 ; Increment it 8 records for 1k + JR $+3 ; Skip next line + INC A ; Else only 1 record + LD (RECNBF),A ; Store new record count + +; +; If 16k in buffer, write to disk +; + LD C,A ; Put the record count in C + LD A,(BUFSIZ) ; Buffer size in A + ADD A,A + ADD A,A + ADD A,A + CP C ; Is the buffer full, yet? + CALL Z,WRBLOCK ; No, return + CALL SNDACK ; Ack the record + JP RCVLP ; Loop until 'EOF' + +; +; End of transmission received +; +RCVEOT: CALL SNDACK ; ACK the record + CALL WRBLOCK + JP RCVEOT0 + +WRBLOCK:LD A,(RECNBF) ; Number of records in the buffer + OR A ; 0 means end of file + RET Z ; None to write + LD C,A ; Save count + LD DE,DBUF ; Point to disk buff + +WRBLOK1:PUSH HL + PUSH DE + PUSH BC + CALL STDMA ; Set DMA + LD DE,FCB ; Then write the block + LD C,WRITE + CALL BDOS + POP BC + POP DE + POP HL + OR A ; Write error? + JR Z,WRBLOK2 ; No + CALL RSDMA ; Reset DMA to normal + LD A,CANCEL ; Cancel + CALL SEND ; Sender + CALL SEND + CALL SEND + CALL CLOSFIL ; Kill received file + CALL ILPRTB ; Exit with msg: + DB CR,LF + DB '-- Write Error: ',0 + CALL SHONM3 + JP EXIT + +WRBLOK2:LD HL,128 ; Length of 1 record + ADD HL,DE ; 'HL'= next buff + EX DE,HL ; To 'DE' for setdma + DEC C ; More records? + JR NZ,WRBLOK1 ; Yes, loop + XOR A ; Get a zero + LD (RECNBF),A ; Reset number of records + LD HL,DBUF ; Reset buffer + LD (RECPTR),HL ; Save buffer address + JP RSDMA + +; +; Write record to log file if LOGCAL is YES +; +RCVEOT0:CALL CLOSFIL ; Close the file + LD HL,(RECDNO) ; Get # of records + LD (RCNT),HL ; Stuff in RCNT + CALL XTIM ; Calculate approximate transfer time + CALL STORTM ; Store time + CALL LOGCALL ; Log transfer if supposed to + +RCVEOT1:LD A,(LOGLDS) ; Counting uploads? + OR A + JR Z,RCVEOT2 ; No + LD A,(PRIVATE) ; Private upload? + OR A + JR NZ,RCVEOT2 ; Yes, no credit for private uploads + LD IY,(UPLDS) ; Get Upload Counter + INC (IY) ; One more upload since log in + +RCVEOT2:CALL ALLDON ; If not in BATCH, print transfer complete + JP CRED ; Credit upload time and ask for descriptions + +; +;-------------------------------------------------------------------------; +; R e c e i v e B a t c h | +;-------------------------------------------------------------------------; +; +RBTCH: XOR A ; Using batch so reset some flags + LD (FRSTIM),A ; Needs to be reset for each new file + LD A,(FSTFLG) ; First batch file? + OR A + JR Z,RBTCH0 ; Yes, give them time to setup + LD A,CRC + CALL SEND ; In case he's quick like us + JP RBTCH1 + +; +; Initial setup only +; +RBTCH0: CALL RCVFL1 ; Find drive/user/filetype permitted + CALL CONTIN ; Display drive/user area + LD HL,NAMBUF + LD (NBSAVE),HL + LD A,1 + LD (FSTFLG),A ; No need to run those routines again + +; +; Get the batch file name and display +; +RBTCH1: LD HL,FCB + CALL INITFCB ; Initialize FCB + XOR A + LD (RCVTRY),A + INC A ; Set to local display only + LD (CONONL),A + +RBTCH2: CALL CKABORT ; Check for user abort + LD B,5 + CALL RECV ; Wait up to 5 seconds for SOH from remote + JR C,RBTCH3 ; No character, decrement counter + CP CANCEL ; Was it a CTL-X for cancel? + CALL Z,CKCAN ; Check for abort + CP SOH + JR Z,RBTCH5 ; Got SOH + JR RBTCH2 ; None of these, wait some more + +RBTCH3: LD A,CRC ; Send a 'C' + CALL SEND + +RBTCH4: LD A,(RCVTRY) + INC A + LD (RCVTRY),A + CP 20 + JR C,RBTCH2 + JP ABORT ; Quit and try to force him to quit also + +RBTCH5: LD B,5 + CALL RECV ; Wait up to 5 seconds for sector number + JP C,TOTERR + LD D,A ; Save sector number in D + OR A ; Must be a 0 if sending batch + JP NZ,WRGHDR + LD B,5 + CALL RECV ; Wait up to 5 seconds for reciprocal + JP C,TOTERR + CPL ; Invert it and compare to sector # + CP D + JP NZ,CRCERR ; Bad match + LD HL,0 + LD (CRCVAL),HL ; Clear CRC counter + LD E,128 ; Expecting a 128 character block + LD HL,(RECPTR) ; Point to the buffer address + +RBTCH6: LD B,5 + CALL RECV ; Up to 5 seconds for 128 byte header block + JP C,TOTERR ; Exit if no character + LD (HL),A ; Store the character + INC HL ; Point to next buffer location + DEC E ; One less to go + JR NZ,RBTCH6 + LD E,2 ; Number of CRC bytes to get + +RBTCH7: LD B,5 + CALL RECV ; Up to 5 seconds for CRC bytes + JP C,TOTERR + DEC E ; Done? + JR NZ,RBTCH7 ; No + CALL CRCCHK ; Compare CRC received against ours + OR A ; Ok? + JP NZ,CRCERR ; No + CALL SNDACK ; Yes, acknowledge to remote + +; +; Decode pathname into CPM format +; + LD DE,FCB+1 ; Where to put it + LD HL,(RECPTR) ; Where to get it + LD B,8 ; Filename length + +RBTCH8: LD A,(HL) ; Get the character from the buffer + OR A ; Was it a zero? + JR Z,RBTCH12 ; If yes, all done + CP '.' ; Was it a delimiter? + JR Z,RBTCH9 + CALL UCASE ; Insure name is in upper case + CP '_' ; Is it an underline? + JR NZ,$+4 ; No + LD A,'-' ; Else make it a dash + LD (DE),A ; Store filename character in FCB + INC DE ; Increment pointers + INC HL + DJNZ RBTCH8 ; If not 8, keep going + LD A,(HL) ; Get the character back + OR A ; We had 8, was there an extent? + JR Z,RBTCH11 ; If zero, was all done + JR RBTCH10 ; Else must be a '.' + +RBTCH9: LD A,' ' ; Spaces to make up 8 spaces for name + LD (DE),A ; Store space character in FCB + INC DE ; Increment pointers + DJNZ RBTCH9 ; Keep going until in extent area + +RBTCH10:INC HL ; Skip the '.' position + LD B,3 ; Extent length + +RBTCH11:LD A,(HL) ; Get the character from the buffer + OR A ; Was it a zero? + JR Z,RBTCH12 ; If yes, all done + CALL UCASE ; Insure extent is in upper case + LD (DE),A ; Store extent character + INC DE ; Increment pointers + INC HL + DJNZ RBTCH11 ; Keep going until finished + +RBTCH12:LD A,(FCB+1) ; See if there was any filename at all + CP ' ' + JP Z,RBCHDON ; No, all done, no more files + CALL CLEARIT ; Clear screen locally if suppose to + +RBTCH13:LD HL,(BUFSTR) ; Get the file length, if provided + LD A,H + OR L + JR NZ,$+7 ; If not both zero, length is provided + CALL SHONM ; Else show the filename + JR RBTCH14 ; And wait to receive + LD (RCNT),HL ; Store the file length + CALL OPNOK1 ; Show filename and file sizes + CALL ILPRTL + DB CR,LF + DB 'Ymodem transfer time > ',0 + CALL GETSPD ; Get speed indicator + CP 5 ; Are we less than 1200 bps? + JR C,$+7 ; Yes, skip 1k time + CALL KTIM ; Get 1k transfer time + JR $+5 ; Skip 128 byte transfer time + CALL XTIM ; Get 128 byte transfer time + CALL XFRTIM ; Display transfer time + +RBTCH14:CALL ILPRTL + DB CR,LF,LF,0 ; Finish the filename line + XOR A ; Reset the carry flag + LD (RCVTRY),A ; Reset the error counter + LD IX,FCB + CALL RESTRCT ; Check restrictions on uploads + CALL CHEKFIL ; Already have a file with that name? + CALL MAKEFIL ; If not, make it + CALL BCHINR + CALL WAITMSG ; Display '[ waiting ]' message locally + LD A,CRC + CALL SEND + JP RCVLP ; Start receiving the file + +RBCHDON:XOR A ; Zero the batch mode flag + LD (BATCH),A + LD A,(GOTONE) ; Were there any files received? + OR A + JP Z,ABORT ; No, abort + CALL XFRDON ; Show transmission is finished + JP CRED ; Ask for descriptions + +CRCERR: CALL ILPRTL + DB '-- CRC error' + DB CR,LF,0 + JP INCERR + +WRGHDR: CALL ILPRTL + DB '-- Wrong header type' + DB CR,LF,0 + JR INCERR + +TOTERR: CALL ILPRTL + DB '-- Timeout receiving filename' + DB CR,LF,0 + +INCERR: CALL WAIT1 ; Make sure sender has stopped + LD A,NAK ; Tell sender it was not successful + CALL SEND + LD A,(RCVTRY) ; Increment the error counter + INC A + LD (RCVTRY),A + CP 33 + JP C,RBTCH4 ; Send a NAK and tell him to try again + JP ABORT ; Else abort + +; +;-------------------------------------------------------------------------; +; C r e d i t R o u t i n e s | +;-------------------------------------------------------------------------; +; +; The following credits the caller for the amount of time spent uploading +; any non-private files with descriptions. +; +CRED: LD A,(BATCH) + OR A + JR NZ,CRED0A + LD E,10 ; Set up for a 30 second wait + +CRED0: LD B,3 ; 3 seconds to receive a character + CALL RECV + JR NC,CRED0A ; Got one, continue + CALL ILPRTB ; Make sure this goes to modem + DB CR + DB '-- Hit a key' + DB CR,0 ; Let them know we're waiting + DEC E ; 2 less seconds + JR NZ,CRED0 ; Wait until 0 + +CRED0A: LD A,(CREDIT) ; Credit caller with upload time? + OR A + JP Z,CRED2 ; No + CALL WHLCHK ; WHEEL byte set? + JP NZ,CRED2 ; Yes, skip credit + LD A,(PUPFLG) ; Privileged transfer request? + OR A + JP NZ,CRED2 ; Yes, skip credit + LD A,(PRIVATE) ; Was this a private file? + OR A + JP NZ,CRED2 ; Yes, skip credit + LD A,(BATCH) ; In batch mode now? + OR A + JP NZ,CRED1 ; If yes, skip following messages + + CALL ILPRTB ; Show to remote also + DB CR,LF + DB 'Thanks for the ',0 + CALL SHOCAT ; Show upload area descriptor, if supposed to + CALL ILPRTB + DB 'upload(s)!',CR,LF,0 + CALL ILPRTB + DB 'Upload time has been credited to time left.',0 + +CRED1: LD A,(MAXTOS) ; Get maximum time allowed + OR A ; Unlimited? + JR Z,CRED2 ; Yes, skip credit + LD HL,(RECDNO) ; Else get the number of records + LD (RCNT),HL + CALL XTIM ; Get transfer time in C + LD A,(MAXTOS) ; Get maximum time allowed back + INC A ; Increment to next full minute + ADD A,C ; Add upload time + LD (MAXTOS),A ; Save for internal use + +; +; If not still in BATCH mode, ask for file description +; +CRED2: LD A,(BATCH) ; Still in batch? + OR A + JP NZ,DONE ; Yes, see if anymore files left + LD A,(HIDEIT) ; Did we make this upload a $SYS file? + OR A + JR Z,CRED3 ; No, skip all this + CALL WHLCHK ; Wheel byte set? + JR NZ,CRED3 ; Yes, file not set to $SYS + LD A,(PRIVATE) ; Was this a private upload? + OR A + JR NZ,CRED3 ; Yes, file not set to $SYS + CALL ILPRTB + DB CR,LF + DB 'Uploads remain hidden until cleared by Sysop.',0 + +CRED3: CALL ILPRTB + DB CR,LF,LF,0 + CALL RSTLCK ; Clear WRTLOC before descriptions + CALL ADDTON ; Update BYE's time on byte if supposed to + +; +;-------------------------------------------------------------------------; +; D e s c r i p t i o n R o u t i n e s | +;-------------------------------------------------------------------------; + +ASK: LD A,(PRIVATE) ; Private upload? + OR A + JP NZ,EXIT ; Yes, no descriptions + LD A,(PUPFLG) ; Privileged transfer request? + OR A + JP NZ,EXIT ; Yes, no descriptions + LD A,(DESCRIB) ; Requiring descriptions? + OR A + JR NZ,ASK1 ; Yes + + LD A,(MSGDESC) ; To BBS message base? + OR A + JP Z,EXIT ; No + LD (DSCFLG),A ; Set flag to show message base descriptions + LD A,(PRUSR) ; Get the private user + LD (USER),A ; FOR destination + LD A,(PRDRV) ; Get the private drive + LD (DRIVE),A ; FOR destination + +ASK1: CALL GETTIME + LD HL,DATMSG+6 + + LD A,(EDATE) ; European date format? + OR A + JR Z,ASK1A ; No + LD A,(DAY) + CALL DATDEC ; Print DD + INC HL + LD A,(MONTH) ; Print MM + JR ASK1B ; And finish with YY + +ASK1A: LD A,(MONTH) + CALL DATDEC ; Print MM + INC HL + LD A,(DAY) + +ASK1B: CALL DATDEC ; Print DD + INC HL + LD A,(YEAR) + CALL DATDEC ; Print YY + + LD A,(FILCNT) ; Any batch filenames? + OR A + JR Z,ASK3 ; No + LD HL,NAMBUF ; Point to name buffer + LD (NBSAVE),HL + +ASK2: LD IY,FILCNT ; One less file to describe + DEC (IY) + LD HL,(NBSAVE) ; Get address of next batch filename + LD DE,FCB ; Where to put it + LD BC,12 + LDIR + LD (NBSAVE),HL ; Store address for next filename + +ASK3: LD A,(DESCRIB) ; FOR file descriptions? + OR A + JR Z,ASK6 ; No + + LD A,(ASKAREA) ; Using upload routing? + OR A + JR Z,ASK4 ; No, KIND contents doesn't matter + + LD A,(KIND) ; Do we have a the upload area yet? + OR A + JR NZ,ASK6 ; Yes, don't ask them twice + + CALL ILPRTB + DB CR,LF,LF + DB 'Upload category: ' + DB CR,LF,0 + JR ASK5 + +ASK4: LD A,(ASKIND) ; Need file descriptors for FOR entries? + OR A + JR Z,ASK6 ; No + + CALL ILPRTB + DB CR,LF,LF,0 + CALL SHONM3 ; Show the file name + + CALL ILPRTB + DB ' - this file is for:' + DB CR,LF,0 + +ASK5: CALL GETKIND ; Get file category for description header + CALL TYPE ; Output to both consoles + +ASK6: CALL ILPRTB + DB CR + DB 'Describe ',0 + CALL SHONM3 ; Show the filename + CALL ILPRTB + DB ' - 7 lines or less - ^W disables WRAP - CR when done',0 + + LD HL,FCB+1 ; FCB contains current filename + LD DE,NEWNAM ; Needed in here for description routines + LD B,8 ; Filename is up to 8 bytes long + CALL ASK7 ; Go store it until a space + + LD A,'.' + LD (DE),A ; Add seperator + + INC DE + LD HL,FCB+9 ; Point to file extent at FCB + LD B,3 ; File extent is up to 3 bytes long + CALL ASK7 ; Go store until space or B=3 + + LD A,LF ; Stuff Terminator + LD (DE),A + + CALL GETDSC ; Show typing guide and get upload description + JP Z,ASK2 ; If we got a description, get next + JP ASK3 ; Else get this one over again + +; +; Small subroutine to store the filename located at FCB+1 into buffer area +; located at DE +; +ASK7: LD A,(HL) ; Get character + AND 7FH ; Done with high bits + CP ' ' ; A space? + RET Z ; Yes, all done + LD (DE),A ; Else store it in destination + INC HL ; Increment source pointer + INC DE ; Increment destination + DJNZ ASK7 ; Keep looping until B=0 or (HL)=' ' + RET + +; +;----------------------- +; Set upload drive/user +; +RCVFL1: CALL LOGDU ; Select drive/user for upload + LD A,(PUPFLG) ; Place "RW" file as needed + OR A ; Can only be set if user is privileged + JR NZ,RCVFL2 ; Privileged, else check if sysop... + CALL WHLCHK ; Let WHEEL user put file wherever he wants + JR Z,RCVFL6 ; If WHEEL byte not set, stay normal + +RCVFL2: LD A,(RCVDRV) + OR A + JR Z,RCVFL3 + SUB 'A' ; Convert ASCII drive to binary + JR RCVFL4 + +RCVFL3: LD A,(OLDDRV) + +RCVFL4: INC A + LD (FCB),A + ADD A,'A'-1 ; Convert binary to ASCII + LD (DRV),A ; Drive + LD A,(RCVDRV) ; See if a drive was requested + OR A + LD A,(OLDUSR) ; Current user + JR Z,RCVFL5 ; If not, use current user + LD A,(RCVUSR) ; Else get requested user + +RCVFL5: LD (USR),A ; User + RET + +RCVFL6: LD A,(SETAREA) + OR A + JR NZ,RCVFL7 + LD A,(ASKAREA) + OR A + JR Z,RCVFL8 + +RCVFL7: LD A,(DRV) + SUB 40H + LD (FCB),A + +RCVFL8: LD A,(PRIVATE) ; Receiving to a private area? + OR A + RET Z ; If not, exit + LD A,(PRDRV) ; Private area takes precedence + SUB 40H ; Convert to binary + LD (FCB),A ; Store drive to be used + RET + +; +; Display where file(s) will go, open file and display name +; +CONTIN: LD A,(ASKAREA) ; Upload routing enabled? + OR A + JR NZ,CONT0 ; No + LD A,(ASKIND) + OR A + JR Z,CONT1 + +CONT0: CALL WHLCHK ; Is WHEEL byte set? + JR NZ,CONT1 ; No, skip this + CALL GETKIND ; Get upload area + LD A,CR ; So the line feed (LF) doesn't get printed + LD (CONT1+4),A + +CONT1: CALL ILPRTB + DB CR,LF + DB 'Receiving on: Drive ',0 + LD A,(PRIVATE) ; Private upload? + OR A + LD A,(PRUSR) ; Get private user area + LD B,A ; Put in B for now + LD A,(PRDRV) ; Get private drive + JR NZ,CONT2+3 ; Yes, priority 1 + LD A,(USR) ; Get the regular user area + LD B,A ; And put it in B + LD A,(PUPFLG) ; Privileged upload? + OR A + JR NZ,CONT2 ; Yes, priority 2 + CALL WHLCHK ; WHEEL set? + JR NZ,CONT2 ; Yes, priority 3 + LD A,(SETAREA) ; Uploading to designated drive/user? + OR A + JR NZ,CONT2 ; Yes, priority 4 + LD A,(ASKAREA) ; Upload routing enabled? + OR A + JR Z,CONT3 ; No + +CONT2: LD A,(DRV) ; Get regular upload drive + PUSH AF ; Save ASCII upload drive + SUB 40H ; Convert drive to binary + LD (FCB),A ; Store it in File Control Block + POP AF ; Get ASCII drive back + JR CONT4 ; All done, now display it + +CONT3: LD A,(OLDUSR) ; Get current user area for default + LD B,A ; Save in B + DB 0,0 ; Contains 'LD B,n' (DUU) from GETDU + LD A,(OLDDRV) ; Get current drive for default + ADD A,'A' ; Convert to ASCII + DB 0,0 ; Contains 'LD A,n' (DUD) from GETDU + +CONT4: LD (KDRV),A ; Save it for KSHOW + CALL TYPE ; Print the drive to store on + CALL ILPRTB + DB ', User ',0 + LD A,B ; B contains the user area + LD (USR),A ; Save for MSGDESC upload info + LD H,0 + LD L,A ; Binary user area in L + CALL DECOUT ; Decimal output + CALL ILPRTB + DB '. (',0 + CALL KSHOW ; Show available space remaining + CALL ILPRTB + DB ')',0 + CALL CHEKFIL ; See if file exists + + LD A,(DESCRIB) ; Descriptions enabled? + OR A + JR NZ,CONT5 ; Yes + LD A,(MSGDESC) ; Message base descriptions? + OR A + JR Z,CONT6 ; No + +CONT5: LD A,(PRIVATE) ; Private upload? + OR A + JR NZ,CONT6 ; Yes, no descriptions + LD A,(PUPFLG) ; Privileged upload? + OR A + JR NZ,CONT6 ; Yes, no descriptions + CALL ILPRTB + DB CR,LF + DB 'Description(s) needed - ',0 + JR CONT7 + +CONT6: CALL ILPRTB + DB CR,LF,0 + +CONT7: CALL ILPRTB + DB 'Abort: ^X pause ^X' + DB CR,LF,LF,0 + CALL WAITMSG + RET + +; +; Increment the file count +; +BCHINR: LD HL,(NBSAVE) ; Where to put the name + LD DE,FCB ; Where to get the name + EX DE,HL + LD BC,12 ; Move current filename to buffer for ASK: + LDIR + EX DE,HL + LD (NBSAVE),HL ; Store address for next filename + LD A,(FILCNT) ; Increment the file count + INC A + LD (FILCNT),A + RET + +; +;-------------------------------------------------------------------------; +; T r a n s f e r c o m p l e t e | +;-------------------------------------------------------------------------; +; +; Done transferring current file. Check to see if in BATCH mode and if so, +; display filename transferred and reset flags for next possible file. +; Otherwise eat garbage from line, reset WRTLOC, do timekeeping and exit +; to CP/M (Forward text file to BBS message base if supposed to). +; +DONE: LD A,(BATCH) ; Still in batch mode? + OR A + JP Z,EXIT ; No. All done + LD A,(OLDDRV) ; Restore the original drive + CALL RECDRX + LD A,(OLDUSR) ; Restore the original number + CALL RECAR1 + CALL RSDMA ; Reset to default DMA address + LD A,1 ; Display filename locally only + LD (GOTONE),A ; Indicates there was a file handled + CALL ILPRTL ; Display the file name + DB CR,LF,0 + CALL SHONM3 ; Show the filename at FCB+1 + CALL ILPRT + DB ' transferred',CR,LF,0 + +; +; Now reset some flags for another possible batch file +; + XOR A + LD (EOFLG),A ; Clear end of file flag + LD (EOTFLG),A ; And end of transmission flag + LD (CHKEOT),A ; Clear the "resend EOT" flag + LD HL,0 + LD (ACCERR),HL ; Reset the accumulate error count + LD (RECNBF),HL ; Zero number of records in the buffer + LD (RECDNO),HL ; Zero the current record number + LD (RCDCNT),HL ; Zero the transmit record counter + LD HL,DBUF ; Reset buffer pointers + LD (RECPTR),HL + LD A,(MODE) ; Get transfer mode + CP 'S' ; Sending files? + JP Z,SNDFIL ; Yes + + LD A,(FILIMT) ; Maximum upload (TPA limitation) + LD B,A ; Into B for comparison + LD A,(FILCNT) ; Get current count received + CP B ; Received BATCH transfer limit yet? + JP C,RCVFL + LD A,CANCEL + CALL SEND + CALL SEND + CALL SEND + CALL WAIT1 + + CALL ILPRTB + DB CR,LF + DB '-- ',0 + LD A,(FILIMT) + LD H,0 + LD L,A + CALL DECOUT + CALL ILPRTB + DB ' file limit in BATCH receive',CR,LF,0 + + XOR A + LD (BATCH),A ; Reset the batch mode flag to zero + JP CRED3 ; Go back and ask for descriptions + +; +;-------------------------------------------------------------------------; +; C o m m o n S u b r o u t i n e s | +;-------------------------------------------------------------------------; +; +; Universal access check routine checks restrictions of current file being +; considered for transfer. +; +; On entry: IX = start address of byte before filename +; On exit: Z = File ok to send/receive +; NZ = Transfer denied +; +; Each bit of this word contains an image of the high bit within the filename +; pointed to by IX+1 on entry. +; +HBITMAP:DW 0000000000000000B + +; +; First, make a bit map containing an image of the high bits in the filename +; pointed to by IX+1 on entry. +; +RESTRCT:LD B,11 ; Number of bytes to map + LD HL,0 ; Initialize destination for bit map + PUSH IX ; Save current filename address + INC IX ; Skip past drive indicator + +ACCMASK:LD A,(IX) ; Get next character of filename + AND 80H ; Isolate attribute bit + RLCA ; Move MS bit into LS bit + OR L ; OR in any previously set bits + LD L,A ; Save result + ADD HL,HL ; Shift HL left one bit for next time + INC IX ; IY+1 equals next character in filename-type + DJNZ ACCMASK ; Loop through all 11 bytes + POP IX ; Get our original filename pointer back + +; +; Most significant bit will already be in bit 11 of HL, so only 4 shifts are +; necessary +; + ADD HL,HL ; 000?????$??????00 + ADD HL,HL ; 00??????$?????000 + ADD HL,HL ; 0???????$????0000 + ADD HL,HL ; ????????$???00000 + LD (HBITMAP),HL ; Store filename high bit image + +; +; See which (if any) restrictions we need to enforce +; + CALL WHLCHK ; WHEEL byte set? + JP NZ,SENDOK ; Yes, transfer is approved + LD A,(ACCMAP) ; Get user defined restriction flags + LD B,A + LD A,(MODE) ; Get the file transfer mode + CP 'S' ; Sending? + JR Z,RSTRCT2 ; Yes, check send restrictions + +; +; Check RECEIVE restrictions +; + LD IX,FCB + BIT NOCOMR,B ; Rename '.COM' uploads to '.OBJ'? + JR Z,RSTRCT1 ; No, check for ZCPR restrictions + LD DE,COMCHG ; Compare to 'COM' + CALL MCHFTYP ; Are they the same? + CALL Z,RENTYP ; Yes, rename it to 'OBJ' + +RSTRCT1:BIT ZCPR,B ; Using with ZCPR? + RET Z ; No, all done + LD DE,SYSCHK ; Compare to 'SYS' + CALL MCHFTYP ; Are they the same? + JR Z,FTYPERR ; Yes, tell them to use a different filetype + LD DE,NDRCHK ; Compare to 'NDR' + CALL MCHFTYP ; ... + JR Z,FTYPERR ; ... + LD DE,RCPCHK ; Compare to 'RCP' + CALL MCHFTYP ; ... + RET NZ ; If no match, filetype is ok to receive + +FTYPERR:CALL ERXIT + DB CR,LF + DB '-- Use a different file extent','$' + +; +; Check SEND restrictions +; +RSTRCT2:LD A,(BATCH) ; In BATCH? + OR A + JR NZ,RSTRT2A ; Yes, require send access for any batch file + BIT DWNTAG,B ; Allow F3 tagged file regardless of access? + JR Z,RSTRT2A ; No, skip this + BIT 5,H ; Byte 3 of filename set? + JP NZ,SENDOK ; Yes, send it immediately + +RSTRT2A:LD A,(ACCESS) + OR A + JR Z,RSTRCT3 + LD A,(AFBYTE) ; Get BYE or BBS bit mapped access flag + AND 20H ; Download access allowed? + JP Z,NOACC ; No, inform user of restricted function + +RSTRCT3:LD A,(LBRARC) ; Get member extraction flag + OR A ; Enabled? + JR NZ,RSTRCT4 ; Yes, skip these restrictions + BIT TAGFIL,B ; Restricting tagged files? + JR Z,RSTRCT4 ; No + BIT 7,H ; First byte of filename set? + JR NZ,NOSEND ; Yes, can't send it + +RSTRCT4:BIT NOSYS,B ; Restricting $SYS files? + JR Z,RSTRCT5 ; No + BIT 6,L ; First byte of filetype set? + JR NZ,NOSEND ; Yes, can't send + +RSTRCT5:LD A,(LBRARC) ; Get member extraction flag + OR A ; Enabled? + RET NZ ; Yes, and file was not tagged (returning NZ) + BIT NOLBS,B ; Restricting files with labels (#)? + JR Z,RSTRCT6 ; No + LD A,(IX+11) ; Get possible label + AND 7FH ; Strip the high bit + CP '#' ; Labeled? + JR Z,NOSEND ; Yes, can't send + +RSTRCT6:BIT NOCOMS,B ; Allow sending 'COM' files? + JP Z,SENDOK ; Yes + LD DE,COMCHG ; Point to string to compare with + CALL MCHFTYP ; Is it a .COM file? + JP NZ,SENDOK ; No + +; +; Common exit point +; +COMTRY: LD A,(BATCH) ; In batch mode? + OR A + JP NZ,NOSND2 ; Yes, just set flag to not include (NZ) + POP HL ; Remove call from OPNOK from stack + CALL ERXIT + DB CR,LF + DB '-- Can''t send .COM files','$' + +NOSEND: LD A,(BATCH) ; Are we in batch mode? + OR A + JP NZ,NOSND2 ; Yes, no error messages, just checking + LD DE,LBRNAM + CALL NOSND0 + JR Z,NOSND1 + LD DE,ARKNAM + CALL NOSND0 + JR Z,NOSND1 + LD DE,ARCNAM + CALL NOSND0 + JR Z,NOSND1 + CALL ERXIT + DB CR,LF + DB '-- File is not for distribution','$' + +NOSND0: LD B,3 + LD HL,FCB+9 + CALL MATCH + RET + +NOSND1: CALL ERXIT + DB CR,LF + DB '-- Individual members only','$' + +NOSND2: LD A,1 ; Return NZ if file not allowed + OR A + RET + +SENDOK: XOR A ; Return Z if file is ok + RET + +; +; See if next character is ' ' or non ' '. File name error if no ASCII +; character. +; +CHKFSP: LD A,(BATCH) ; Requesting batch mode now? + OR A + JR Z,CHKFSP2 ; Exit if not + LD A,(MODE) ; Sending batch? + CP 'S' + JR Z,CHKFSP2 ; If yes, exit + DEC B + JR Z,CHKFSP1 + INC B + JR CHKFSP2 + +CHKFSP1:POP HL ; Do not return to LOGDU + RET ; Return instead to SNDFIL + +CHKFSP2:DEC B + JP Z,NFN1 ; Error if end of chars. + LD A,(HL) + CP ' '+1 + RET NC ; Ok if valid character so return + INC HL + JR CHKFSP + +; +; Check next character to see if a space or non-space, go to menu if a command +; error. +; +CHKSP: LD A,(BATCH) ; Requesting batch mode? + OR A + JR Z,CHKSP2 ; Exit if not + LD A,(MODE) ; Sending in batch mode now? + CP 'S' + JR Z,CHKSP2 ; If yes, exit + DEC B + JR Z,CHKSP1 + INC B + JR CHKSP2 + +CHKSP1: POP HL ; Don't return to LOGDU + RET ; Return to SNDFIL + +CHKSP2: DEC B + JP Z,HELP + INC HL + LD A,(HL) ; Get the character there + CP ' ' ; Space character? + RET ; Z = space, NZ = non-space + +; +; Determine the amount of disk storage needed for the current file. On +; entry: BC = total record count of file +; +ROUNDK: LD DE,(BLKSIZ) ; Fetch block size in kilobytes + PUSH DE ; Save block size + PUSH BC ; Save file record count + LD B,3 ; Make a mask for size limit + +MSKCMP: OR A ; Clear carry + RL E ; Make mask for size limit + RL D ; Shift until + DJNZ MSKCMP ; Shift until DE is A + DEC DE ; Mask of records per block + POP BC ; Get a copy of file record count + PUSH BC + + LD A,C ; Mask file size with block size mask + AND E + LD C,A + LD A,B + AND D + OR C ; Zero result indicates no block + POP BC + PUSH AF ; Remainder in file size + LD A,D ; Compliment mask and zero file size + CPL ; Remainder in BC + AND B + LD B,A + LD A,E + CPL + AND C + LD C,A + LD E,3 ; Shift count to divide masked file + +MINKL: OR A ; Clear carry + RR B ; Rotate high byte through carry + RR C + DEC E ; Decrement shift count + JR NZ,MINKL + + POP AF ; Check if even block size + POP DE ; Get back block size + PUSH HL ; Save kilobyte insert address + LD HL,0 ; Initial zero of remainderI + JR Z,MINKS ; Zero if even + EX DE,HL ; Block size to HL if remainder + +MINKS: ADD HL,BC ; Add in total kilobyte count + EX DE,HL ; Total size to DE + POP HL ; Get back load address + RET + +; +; Log into drive and user +; +; (If specified). If none mentioned, falls through to 'TRAP' routine for +; normal use. +; +LOGDU: LD HL,TBUF ; Point to default buffer command line + LD B,(HL) ; Store number of characters in command + INC B ; Add in current location + CALL CHKSP ; Skip spaces to find 1st command + JR Z,$-3 ; Loop until non-space character + CALL CHKSP ; Skip 1st command (non-spaces) + JR NZ,$-3 ; Loop until a space + INC HL + CALL CHKFSP ; Skip spaces to find 2nd command + LD (SAVEHL),HL ; Save start address of the 2nd command + +; +; Now pointing to the first byte in the argument. (If it was of a format +; similar to: 'B6:HELLO.DOC' then we point at the drive character 'B'. Then +; transfer up to 4 bytes from the command line buffer (pointed at by HL) to +; the drive/user storage buffer pointed at by DE +; +LGDU1: PUSH HL ; Save command line position + PUSH BC ; And character count + LD DE,DUSAVE ; Destination buffer + LD C,4 ; Drive/user is 4 characters maximum 'B15:' + +LGDU2: LD A,(HL) ; Get character + CP ' '+1 ; Space or return? + JP C,TRAP ; Yes, all done + LD (DE),A ; Else store it in DUSAVE + INC HL ; Increment to next argument + INC DE ; Increment DUSAVE + CP ':' ; Was it a colon? + JR Z,LGDU3 ; Yes, was drive/user requested + DEC B ; One less position to check + DEC C ; One less to go + JR NZ,LGDU2 ; Loop until a colon or C=0 + JP TRAP ; Move name to FCB + +; +; Get Disk and User from DUSAVE and log in if valid. +; +LGDU3: EXX ; Save HL (buffer) pointer and BC (char count) + POP BC ; We don't need these back, but fix the stack + POP HL + EXX ; And get HL and BC back to continue + LD A,(BATCH) ; Requesting batch mode? + OR A + JR Z,LGDU4 ; No + LD A,(MODE) ; Get program transfer mode + CP 'R' ; Receiving batch? + JR Z,LGDU5 ; Yes, skip next two lines + +LGDU4: CALL CHKFSP ; See if a file name is included + LD (SAVEHL),HL ; Save location of the filename + +LGDU5: LD A,(PRIVATE) ; Uploading to a private area? + OR A + JP NZ,TRAP2 ; If yes, going to a specified area + + LD A,(OLDDRV) ; Get current drive + LD (DUD),A + ADD A,'A' + LD (RCVDRV),A + + LD HL,DUSAVE ; Point to drive/user + LD A,(HL) ; Get 1st character + CP '0' ; It is a ' ', CR or LF? + JR C,LGDU6 ; Yes, skip next 2 lines + CP '9'+1 ; Is it an ASCII number 0-9? + JR C,LGDU10 + +LGDU6: LD (RCVDRV),A ; Allows SYSOP to upload to any drive + CP 'A'-1 + JR C,LGDU9 ; Satisfied with current drive + SUB 'A' + LD (DUD),A + + LD A,(PUPFLG) ; Privileged user upload request? + OR A + LD A,(DUD) + JR NZ,LGDU8 ; Yes + + CALL WHLCHK + LD A,(DUD) + JR NZ,LGDU8 + + LD A,(USEMAX) ; Using ZCPR low memory bytes? + OR A + JR NZ,LGDU7 ; Yes + LD A,(MAXDRV) + LD C,A + LD A,(DUD) + CP C + JP NC,ILLDU ; Drive selection not available + JR LGDU8 + +LGDU7: LD A,(DUD) ; Get the drive back + LD IY,(DRIVMAX) ; Point to max drive byte + INC (IY) + CP (IY) ; And check it + PUSH AF ; Save flags from the CP + DEC (IY) ; Restore max drive to normal + POP AF ; Restore flags from the CP + JP NC,ILLDU + +LGDU8: INC HL ; Get 2nd character + +LGDU9: LD A,(HL) + CP ':' + JP Z,LGDU17 ; Colon for drive only, no user number + CALL CKNUM ; Check if numeric + +LGDU10: SUB '0' ; Convert ASCII to binary + LD (DUU),A ; Save it + INC HL ; Get 3rd character if any + LD A,(HL) + CP ':' + JR Z,LGDU11 + LD A,(DUU) + CP 1 ; Is first number a '1'? + JP NZ,ILLDU + LD A,(HL) + CALL CKNUM + SUB 38 + LD (DUU),A + INC HL ; Get 4th (and last character) if any + LD A,(HL) + CP ':' + JP NZ,ILLDU + +LGDU11: LD A,(MODE) + CP 'R' ; Receiving a file? + LD A,(DUU) + JR Z,LGDU12 + LD A,(SPLDRV) + SUB 'A' + LD C,A + LD A,(DUD) + CP C + JR NZ,LGDU12 + LD A,(SPLUSR) + LD C,A + LD A,(DUU) + CP C + JR Z,LGDU15 + +LGDU12: CALL WHLCHK ; SYSOP using the system? + JR Z,LGDU13 + LD A,(DUU) ; Restore desired user area + LD (RCVUSR),A ; Allows SYSOP to upload anywhere + JR NZ,LGDU15 ; If yes, let him have all user areas + +LGDU13: LD A,(USEMAX) ; Using ZCPR low memory bytes? + OR A + JR NZ,LGDU14 ; Yes + LD A,(MAXUSR) ; Check for maximum user download area + ADD A,1 + LD C,A + LD A,(DUU) + CP C + JP NC,ILLDU ; Error if more (and not special area) + JR LGDU15 + +LGDU14: LD A,(DUU) + LD IY,(USRMAX) ; Point at maximum user byte + CP (IY) ; And check it + JP NC,ILLDU + +LGDU15: LD E,A + LD A,(SETAREA) ; Using designated drv/usr for reg. uploads? + OR A + JR NZ,LGDU16 ; Yes + LD A,(ASKAREA) ; Using upload routing? + OR A + JR NZ,LGDU16 ; Yes + LD A,E + LD (CONT3+5),A ; Store requested user area + LD A,6 ; 'LD B,n' instruction + LD (CONT3+4),A + +LGDU16: LD C,SETUSR ; Set to requested user area + CALL BDOS + +LGDU17: LD A,(DUD) ; Get drive + LD E,A + LD A,(SETAREA) ; Using designated drv/usr for reg. uploads? + OR A + JR NZ,LGDU18 ; Yes + LD A,(ASKAREA) ; Using upload routing? + OR A + JR NZ,LGDU18 ; Yes + LD A,E + ADD A,'A' + LD (CONT3+12),A ; Store requested drive + LD A,3EH ; 'LD A,n' instruction + LD (CONT3+11),A + +LGDU18: LD C,SELDSK ; Set to requested drive + CALL BDOS + JR TRAP2 ; Now find file selected + +; +; If we get here, no d/u was specified. Restore original command line pointer +; and character count and move name to FCB. +; +TRAP: POP BC ; Get original character count back + POP HL ; And original command line buffer position + +; +; Check for no file name or ambiguous name +; +TRAP1: LD A,(PRIVATE) ; Get the private transfer flag + OR A ; Is it enabled? + JR Z,TRAP2 ; No, current du stays normal + LD A,(SPLUSR) ; Get the special download user area + CALL RECAR1 ; Set user area to special download user + LD A,(SPLDRV) ; Get the special download drive + CALL RECDR1 ; Set drive to special download drive + +TRAP2: CALL SPCDRV ; Keep DPB info straight + LD HL,FCB + CALL INITFCB ; Make sure FCB initialized + CALL MOVFCB ; Move the filename into the file block + LD HL,FCB+1 ; Point to file name + LD A,(HL) ; Get first character + CP ' ' ; Any there? + JR NZ,TRAP3 ; Yes, check wildcards + LD HL,FCB+9 ; Else point to file extent + LD A,(HL) ; Get character + CP ' ' ; Space also? + JP Z,NFN ; Yes, we have no filename, exit with error + LD HL,FCB+1 ; Else point to start again + +TRAP3: LD A,(PRIVATE) ; Get the private transfer flag + OR A ; Is it enabled? + RET Z ; No, then don't trap wildcards + LD B,11 ; Else check all 11 characters of filename + +TRAP4: LD A,(HL) ; Get char from FCB + CP '?' ; Ambiguous? + JR Z,NOWILD ; Yes, exit with error message + CP '*' ; Even more ambiguous? + JR Z,NOWILD ; Yes, exit with error message + INC HL ; Point to next character + DJNZ TRAP4 ; Not done, check some more + RET + +CKNUM: CP '0' + JR C,ILLDU ; Error if less than ascii '0' + CP '9'+1 + RET C ; Error if more than ascii '9' + +ILLDU: CALL ERXIT + DB CR,LF + DB '-- Unauthorized drive/user','$' + +NFN: CALL ILPRT + DB CR,LF,0 + +NFN1: CALL ERXIT ; Print message, exit + DB '-- No filename(s) requested','$' + +NOWILD: CALL ERXIT ; Print message, exit + DB CR,LF + DB '-- Wildcards not valid for PRIVATE downloads','$' + +; +; Previous record repeated, due to the last ACK being garbaged. ACK it so the +; sender will catch up +; +RCVACK: CALL SNDACK ; Send the ACK + XOR A + LD (ERRCNT),A ; Reset the error count + +; +; Receive a record - returns with carry bit set if EOT received +; +RCVRECD:CALL FUNCHK ; Check function keys + CALL SNDABT ; See if wanting to abort + LD A,(FRSTIM) ; Have we started, yet? + OR A + LD B,10 ; Check every ten seconds if already started + JR Z,$+4 ; If yes, skip next line + LD B,5 ; Check every 5 seconds until started + CALL RECV ; Get character + JP C,RCVSTOT ; Timeout error if no character received + CP SOH ; SOH? + JP Z,RCVSOH ; Yes, get record + CP STX ; STX for 1k blocks? + JR NZ,$+11 ; No + LD (KFLG),A ; Set the 1k flag + LD (CRCFLG),A ; Insure in CRC mode for 1k blocks + JP RCVS1 + + CP CANCEL ; Was it a CTL-X to abort? + CALL Z,CKCAN ; If yes, check for aborting + OR A ; Get another character, if a null + JR Z,RCVRECD + CP 7BH ; V.22 synch character, ignore + JR Z,RCVRECD + CP 0FBH ; V.22 synch character with high bit set + JR Z,RCVRECD + CP EOT ; See if end of transmission + SCF ; Set carry + RET Z ; Return with carry set + CP CRC ; Ignore our own character coming back + JR Z,RCVRECD + CP KSND ; Ignore our own character coming back + JR Z,RCVRECD + CP NAK ; Ignore our own character coming back + JR Z,RCVRECD + CALL ILPRTL ; Show locally only + DB CR,'-- ',0 + LD A,B + CALL HEXO + CALL ILPRTL + DB 'H received not SOH',CR,LF,0 + JR RCVSR + +; +; Checksum error +; +CKSMERR:CALL ILPRTL + DB ' - Checksum error',CR,LF,0 + JR RCVSR ; Go check the error limit and send NAK + +; +; Bad record number in header error +; +HDRERR: CALL ILPRTL + DB ' - Error in header',CR,LF,0 + JR RCVSR ; Go check error limit and send NAK + +; +; Timed out on receive error +; +RCVSTOT:LD A,(FRSTIM) ; First time flag set yet? + OR A + JR Z,RCVSR ; If not, don't show an error + CALL TOTMSG + +; +; Didn't get SOH or EOT or did not get valid header so purge the line, then +; send NAK. +; +RCVSR: CALL WAIT1 ; Get anything coming in and discard + CALL SNDABT ; See if wanting to abort + LD A,(FRSTIM) ; Get first time switch + OR A ; Has first 'SOH' been received? + LD A,NAK + JR NZ,RCVSR1 ; Yes, then send 'NAK' + LD A,(CRCFLG) ; Get the 'CRC' flag + OR A ; 'CRC' in effect? + LD A,NAK ; Put 'NAK' in 'A' register + JR Z,RCVSR1 ; No, send the 'NAK' for checksum + LD A,CRC ; Tell sender we have 'CRC' + CALL SEND + LD A,(KFLG) ; Requesting 1k transmissions? + OR A + JR Z,RCVSR1 ; If not, exit + LD A,KSND ; Tell sender we also have 1k capability + +RCVSR1: CALL SEND ; The 'NAK' or 'CRC' request + LD A,(ERRCNT) ; Get the error count + INC A ; Increment error count + LD (ERRCNT),A ; Store new value + LD B,A ; Keep the error count for now + LD A,(FRSTIM) ; Have we gotten under way yet? + OR A + LD A,B ; get the value back + JR Z,RCVSR2 ; If not, exit + CP 10 ; 10 errors the limit, once under way + JP NC,ABORT ; Abort if over the limit + CALL RDCOUNT ; Display record count before repeating + JP RCVRECD ; Less than 10, keep going + +RCVSR2: CP 7 ; 7 times for 1k/CRC yet? (40 seconds) + JP C,RCVRECD ; Keep trying if less + XOR A ; Else flip to checksum mode + LD (CRCFLG),A + LD A,B ; Get the count back + CP 3 ; Another 3 times for checksum? + JP C,RCVRECD ; If less, try again, quit at 60 seconds + JP ABORT + +; +; Aborts with 1 CTL-X if first time flag is not set, two otherwise +; +CKCAN: LD A,(FRSTIM) ; First time flag set yet? + OR A + JR Z,CKCAN1 ; If not, abort + LD B,2 + CALL RECV ; Maximum of 2 seconds for extra ^X + RET C ; No additional character, ignore single ^X + CP CANCEL ; Got a character, is it a ^X? + RET NZ ; No, ignore 1st ^X and return + +CKCAN1: POP HL ; Reset stack for CALL CKCAN + JP ABORT ; Got 2nd ^X, abort and close file + +; +; Got SOH - get block number (complemented) +; +RCVSOH: XOR A + LD (KFLG),A ; If SOH, clear the 1k flag + +RCVS1: LD A,1 ; Get something to store + LD (FRSTIM),A ; Indicate first 'SOH' or 'STX' recvd. + LD B,5 + CALL RECV ; Wait up to 5 seconds for block number + JP C,RCVSTOT ; Got timeout + LD D,A ; Save block number + LD B,5 + CALL RECV ; 5 seconds for complimented record number + JP C,RCVSTOT ; Timeout + CPL ; Get the complement + CP D ; Same as original block number? + JP NZ,HDRERR ; No, go report bad record number in header + LD A,D ; Get record number + LD (RCVCNT),A ; Save it + LD C,0 ; Initialize checksum + LD HL,0 ; Initialize CRC + LD (CRCVAL),HL ; Clear CRC counter + LD DE,128 ; For 128 character blocks + LD A,(KFLG) ; Using 1k blocks? + OR A + JR Z,$+5 ; If not, skip next line + LD DE,1024 ; If using 1k blocks + LD HL,(RECPTR) ; Get buffer address + +RCVCHR: LD B,5 + CALL RECV ; 5 seconds for character + JP C,RCVSTOT ; Timeout + LD (HL),A ; Store the character + INC HL ; Point to next character + DEC DE ; One less to go + LD A,E ; See if 'D' and 'E' are both empty + OR D + JR NZ,RCVCHR ; No, get next character + LD A,(CRCFLG) ; Using 'CRC'? + OR A + JP NZ,RCVCRC ; If yes go get 'CRC' + +; +; Verify checksum +; + LD D,C ; Save checksum + LD B,5 + CALL RECV ; Up to 5 seconds for checksum + JP C,RCVSTOT ; Timeout + CP D ; Checksum ok? + JP NZ,CKSMERR ; No, report error + +; +; Got a record, it's a duplicate if equal to the previous number, it's OK if +; previous + 1 record +; +CHKSNUM:LD A,(RCVCNT) ; Get received record number + LD B,A ; Save it + LD A,(RCDCNT) ; Get previous record number + CP B ; Previous record repeated? + JP Z,RCVACK ; If yes 'ACK' to catch up + INC A ; Increment by 1 for 120 character block + CP B ; Match this one we just got? + JP NZ,ABORT ; No match, stop the sender, exit + RET ; Else return with carry not set, was ok + +; +; Receive the Cyclic Redundancy Check characters (2 bytes) and see if the CRC +; received matches the one calculated. If they match, get next record, else +; send a NAK requesting the record be sent again. +; +RCVCRC: LD E,2 ; Number of bytes to receive + +RCVCRC2:LD B,5 + CALL RECV ; Up to 5 seconds for CRC byte + JP C,RCVSTOT ; Timeout + DEC E ; Decrement the number of bytes + JR NZ,RCVCRC2 ; Get both bytes + CALL CRCCHK ; Check received CRC against calc'd CRC + OR A ; Is CRC okay? + JR Z,CHKSNUM ; Yes, go check record numbers + CALL ILPRTL ; Show locally only + DB ' - CRC error',CR,LF,0 + JP RCVSR ; Go check error limit and send NAK + +; +;------------------ +; Send subroutines +;------------------ +; +; Send an ACK for the record +; +SNDACK: LD A,ACK ; Get 'ACK' + JP SEND ; And send it + +; +; Send SOH, block number and complemented block number (3 bytes total) +; +SNDHDR: LD A,(KFLG) ; Sending 1k blocks? + OR A + LD A,STX ; If yes, send a STX rather than SOH + JR NZ,$+4 + LD A,SOH ; Send start of header + CALL SEND + +SNDHNM: LD A,(RCDCNT) ; Send the current record number + CALL SEND + LD A,(RCDCNT) ; Get the record number again + CPL ; Complemented + JP SEND ; From SENDHDR + +; +; Send data record +; +SNDREC: LD C,0 ; Initialize checksum + LD HL,0 ; Initialize CRC + LD (CRCVAL),HL + LD A,(KFLG) ; Sending 1k blocks? + OR A + LD DE,1024 + JR NZ,$+5 ; If yes, skip the next line + LD DE,128 + LD HL,(RECPTR) ; Get buffer address + +SENDC: LD A,(HL) ; Get a character + CALL SEND ; Send it + INC HL ; Point to next character + DEC DE + LD A,E + OR D + JR NZ,SENDC ; If DE not zero, keep going + RET ; From SENDREC + +; +; Send the CRC or checksum value +; +SNDCHK: LD A,(CRCFLG) ; See if sending 'CRC' or 'checksum' + OR A + JR NZ,SNDCRC ; If not zero, send the 'CRC' value + +; +; Send Checksum +; +SNDCKS: LD A,C ; Send the checksum + JP SEND ; From SNDCKS + +; +; Send CRC (2 characters). Call FINCRC to calculate the CRC which will be +; in 'DE' upon return. +; +SNDCRC: CALL FINCRC ; Calculate the 'CRC' for this record + LD A,D ; Put first 'CRC' byte in accumulator + CALL SEND ; Send it + LD A,E ; Put second 'CRC' byte in accumulator + CALL SEND ; Send it + XOR A ; Set zero return code + RET + +; +; Get acknowlegement +; +; After a record is sent, a character is returned telling if it was received +; properly or not. An ACK allows the next record to be sent. A NAK causes +; the current record to be resent. If no character (or any character other +; than ACK or NAK) is received after a short wait (10-12 seconds), a timeout +; error message is shown and the record will be resent. +; +GTACK: LD B,12 + CALL RECV ; Wait up to 12 seconds for ACK or NAK + JR NC,GTACK1 ; Got one + CALL TOTMSG + JP ACKERR ; Set the carry bit and return + +GTACK1: CP ACK ; See if an ACK already + RET Z ; If yes, return + CP NAK ; See if a NAK + JR Z,GTACK2 ; If yes, print error, then resend + CP 07BH ; V.22 synch character? + JR Z,GTACK ; If yes, ignore it + CP 0FBH ; V.22 synch character? + JR Z,GTACK ; If yes, ignore it + CP CANCEL ; CTL-X to cancel attempt? + CALL Z,CKCAN + +GTACK2: LD B,A ; Save the character + LD A,(CHKEOT) ; Sending EOT? + OR A + JP NZ,ACKERR ; If yes, don't show error (for ZMD) + CALL ILPRTL + DB ' - ',0 + LD A,B + CP NAK + JR Z,GTACK3 + CALL HEXO + CALL ILPRTL + DB 'H',0 + JR GTACK4 + +GTACK3: CALL ILPRTL + DB 'NAK',0 + +GTACK4: CALL ILPRTL + DB ' received not ACK',CR,LF,0 + CALL CATCH ; None of them, establish clear line again + +; +; Timeout or error on ACK - bump error count then resend the record if +; error limit is not exceeded +; +ACKERR: LD A,(ACCERR) ; Count accumulated errors on ACK + INC A ; Add in this error + LD (ACCERR),A + LD A,(ERRCNT) ; Get count + INC A ; Bump it + LD (ERRCNT),A ; Save back + CP 10 ; At limit? + JR NC,ACKMSG ; If yes, send error message and abort + LD A,(ACKCHK) ; Checking after a batch header? + OR A + CALL Z,RDCOUNT ; Yes, show the record count for repeat + + LD A,B ; Get character back + CP NAK ; NAK? + JP NZ,GTACK ; No, ignore and wait for ACK or NAK + RET ; And go back + +; +; Reached error limit +; +ACKMSG: CALL WAIT1 ; Wait for any input to stop + LD A,CANCEL ; Tell remote we are quitting + CALL SEND + CALL SEND + CALL SEND + LD B,2 + CALL RECV ; Up to 2 seconds for remote to quit too + LD A,BS + CALL SEND ; Clear any CTL-X from buffer + CALL SEND + CALL SEND + CALL ERXIT + DB CR + DB '-- File transfer aborted','$' + +; +; Routines to trap abort conditions +; +; Check to see if a cancel requested. Fall through to ABORT if so. +; +CKABORT:CALL CONSTAT + OR A + RET Z + CALL CONIN + CP CANCEL + RET NZ + +; +; Aborts send or receive routines and returns to command line +; +ABORT: CALL WAIT1 ; 1- second delay to clear input + CALL CATCH + LD A,(EOTFLG) ; Timed out after only 1 EOT? + OR A + JP NZ,RCVEOT+3 ; Accept as valid EOT then + LD A,CANCEL ; Show you are cancelling + CALL SEND ; They may quit also with enough CTL-X + CALL SEND + CALL SEND + CALL WAIT1 ; 1-second delay to clear input + CALL CATCH + LD A,BS + CALL SEND + CALL SEND + CALL SEND + +ABORTX: CALL CATCH ; Eat garbage characters + CALL ABRTMSG ; Show we have aborted + LD A,(MODE) ; Get file transfer mode + CP 'R' ; Sending a file? + JP NZ,EXIT ; Yes, quit to CP/M + +; +; Take care of received file (if any). +; +CLOSFIL:LD C,CLOSE ; Get function + LD DE,FCB ; Point to file + CALL BDOS ; Close it + INC A ; Close ok? + JR NZ,CLOSFL1 ; Yes + CALL ILPRT ; No, abort + DB CR,LF + DB '-- Received file not closed',0 + JP NTDEL1 + +CLOSFL1:LD A,(EOTFLG) ; Get end of transmission flag + OR A ; Received entire file? + RET NZ ; Yes, return to RCVEOT routines + CALL ILPRTB + DB CR,LF + DB '-- Upload has been cancelled',0 + +; +; Delete the received file +; + LD C,DELETE ; Get function + LD DE,FCB ; Point to file + CALL BDOS ; Delete it + INC A ; Delete ok? + JR Z,NOTDEL ; No + CALL ERXIT ; Print second half of message + DB CR,LF + DB '-- Partial file is deleted','$' + +; +; Unsuccessful delete +; +NOTDEL: CALL ILPRT + DB CR,LF + DB '-- Received file not deleted' + +NTDEL1: CALL ERXIT + DB ' or no file received','$' + +; +; See if a file exists. If it exists, ask for a different name. +; +CHEKFIL:LD A,(SETAREA) ; Uploading to designated drive/user? + OR A + JR NZ,CHEKF1 ; Yes + LD A,(ASKAREA) ; Upload routing enabled? + OR A + JR NZ,CHEKF1 ; Yes + LD A,(PRIVATE) ; Receiving in private area? + OR A + JR Z,$+5 ; No + +CHEKF1: CALL RECARE ; Set the designated area up + LD C,SRCHF ; See if it exists + LD DE,FCB ; Point to control block + CALL BDOS + INC A ; Found? + RET Z ; No, return + LD A,CANCEL ; Tell the remote we are aborting + CALL SEND ; Send several cancel requests + CALL SEND + CALL SEND + +CHEKF2: LD B,1 + CALL RECV ; Up to 1 seconds for character + JR NC,CHEKF2 ; Wait until no more characters + LD A,(BATCH) ; Using batch mode now? + LD (CONONL),A ; If not, send message to modem also + OR A + JR Z,CHEKF3 ; If not, exit + LD A,CANCEL + CALL SEND + CALL SEND + CALL SEND + LD A,BS + CALL SEND + +CHEKF3: CALL ERXIT ; Exit, print error message + DB CR,LF + DB '-- File already exists','$' + +; +; Make the file to be received +; +MAKEFIL:XOR A ; Set extent and record number to 0 + LD (FCBEXT),A + LD (FCBRNO),A + LD A,(HIDEIT) + OR A + JR Z,MAKEF1 ; HIDEIT not enabled, skip all this + CALL WHLCHK + JR NZ,MAKEF1 ; Don't make it $SYS if SYSOP online + LD A,(PRIVATE) + OR A + JR NZ,MAKEF1 ; Don't make it $SYS if private upload + + LD DE,FCB+10 ; Point at second char of file extent + LD A,(DE) + OR 80H ; And turn on the high bit (Make file $SYS) + LD (DE),A ; Put it back + +MAKEF1: LD C,MAKE ; Get BDOS FNC + LD DE,FCB ; Point to FCB + CALL BDOS ; To the make + PUSH AF ; Save MAKE error code + + LD C,SETFILE ; Set up for BDOS FUNCTION 30 + LD DE,FCB + CALL BDOS ; Set file attributes + POP AF ; Error code from BDOS make function + INC A ; 0FFH=bad? + RET NZ ; Open ok + + LD HL,FCB+1 + JP NOROOM ; Tell them directory might be full + +; +; Open file to be sent +; +OPNFIL: XOR A ; Zero accumulator + LD (FCBEXT),A ; Set extent to 0 + LD (FCBRNO),A ; Set record number to 0 + LD DE,FCB ; Point to file + LD C,OPEN ; Open it + CALL BDOS + INC A ; Open ok? + JR NZ,OPNOK ; Yes, check restrictions + + LD A,(LBRARC) ; Get extraction flag + OR A ; Enabled? + JP Z,NOFILE ; No, abort + LD HL,ARCNAM ; Force .ARC filetype + CALL CHNGEXT ; Try to open it + JR NZ,OPNOK ; File found + LD HL,ARKNAM ; Force .ARK filetype + CALL CHNGEXT ; Try to open it + JR NZ,OPNOK ; File found + LD HL,LBRNAM ; Force .LBR filetype + CALL CHNGEXT ; Try to open it + JR NZ,OPNOK ; File found + JP NOARK ; Not found and no more filetypes to try + +CHNGEXT:LD DE,FCB+9 + LD BC,3 + LDIR + LD C,OPEN + LD DE,FCB + CALL BDOS + INC A + RET ; Z flag set=file not found + +; +; Requested file was found, now check some restrictions +; +OPNOK: LD IX,FCB ; Point to filename + CALL RESTRCT ; Check it for restrictions + LD A,(LBRARC) ; Get the member extraction flag + OR A ; Enabled? + JR Z,OPNOK1 ; No, skip this + CALL RSDMA ; Reset to default DMA address + LD C,READ ; Read first file record + LD DE,FCB + CALL BDOS + OR A ; Read ok? + JP NZ,READERR ; If not, error + CALL CKDIR ; Take care of LBR stuff + +OPNOK1: LD HL,(RCNT) ; Get record count + LD A,H + OR L + JP Z,ZEROLN ; Can't send 0-length files + LD A,(BATCH) + OR A + JR Z,OPNOK1A ; Don't clear screen unless in BATCH mode + LD A,(FSTFLG) ; Get first file sent flag + OR A ; Sent it already? + LD A,1 ; Show we have for next time + LD (FSTFLG),A + CALL Z,CLEARIT ; No, need to clear screen here first time + +OPNOK1A:CALL SHONM ; Show the name of this file + CALL LOW41K ; Less than MINKSPD? + JR C,OPNOK3 ; Yes, don't show 1k packets + +OPNOK2: CALL ILPRT + DB CR,LF + DB 'Ymodem packets total > ',0 + LD HL,(RCNT) ; Get record count + CALL DIVREC ; Divide number of records by 8 + CALL DECOUT ; Show # of 1k packets + +OPNOK3: CALL ILPRT + DB CR,LF + DB 'Xmodem packets total > ',0 + LD HL,(RCNT) ; Get original count + CALL DECOUT ; Show # of 128 byte packets + LD A,(MODE) ; Get transfer mode + CP 'R' ; Receiving? + RET Z ; Yes, all done + + CALL ILPRT + DB CR,LF + DB 'Disk space you need > ',0 + + LD A,(SBSHOW) ; Displaying intial BATCH screen to remote? + OR A + PUSH AF ; Save answer + LD HL,(FILEK) ; Get precalculated total 'k' for all files + JR NZ,OPNOK4 ; Go show it + LD BC,(RCNT) ; Else get single file record count back + CALL ROUNDK ; Round disk space needed + EX DE,HL +; +OPNOK4: CALL DECOUT ; Decimal output + CALL ILPRT + DB 'k (',0 + LD HL,(BLKSIZ) ; Get host disk block size + CALL DECOUT ; Decimal output + CALL ILPRT + DB 'k blocks)',0 + POP AF ; Displaying initial BATCH screen to remote? + RET NZ ; Yes, then we're done in here + +; +; Show transfer time, first for 1k blocks, then for 128-byte blocks. If we are +; at 300 bps, report both transfer times the same. (skip the 1k times for +; speeds slower than MINKSPD bps.) +; +KSPD: CALL LOW41K ; Less than MINKSPD? + JR C,XSPD ; Yes, skip 1k display + CALL ILPRT + DB CR,LF + DB 'Ymodem time / 1k > ',0 + CALL GETSPD ; Get current modem speed + CP 1 ; At 300 bps? + JR Z,KSPD1 ; 1k transfer time in BC (minutes) if >300 + CALL KTIM + JR KSPD2 + +KSPD1: LD HL,XECTBL + LD (RECTBL+1),HL + CALL XTIM + +KSPD2: CALL STORTM ; Store it + CALL XFRTIM ; Display it + +XSPD: CALL ILPRT + DB CR,LF + DB 'Xmodem time / 128 byte > ',0 + LD HL,XECTBL ; 128 size values (300 bps) + LD (RECTBL+1),HL + CALL XTIM ; Xmodem transfer time + LD A,(KFLG) ; If 'SK' set, 1k time already stored + OR A + CALL Z,STORTM + CALL XFRTIM + LD HL,KECTBL ; Restore to original 1k values + LD (RECTBL+1),HL + CALL ILPRT + DB CR,LF,0 + + LD A,(BATCH) ; In batch mode? + OR A + JP Z,OPNOK5 ; No, couldn't have been here before + LD A,(FSTFLG) ; Yes, been here before? + OR A + JP Z,OPNOK5 ; No, following gets shown next time + +; +; In batch, show files remaining after this one is sent +; + CALL ILPRTL + DB CR,LF + DB 'Files remaining > ',0 + LD A,(SHOCNT) ; Get cumulative files + DEC A + LD (SHOCNT),A ; Less one + LD L,A + LD H,0 + CALL DECOUT + + CALL ILPRTL + DB CR,LF + DB 'Ymodem packets remaining > ',0 + LD HL,(RCNT) ; Get this file's record count again + EX DE,HL ; Put in DE + LD HL,(TOTREC) ; Total records remaining + LD A,L + SUB E + LD L,A + LD A,H + SBC A,D + LD H,A + JR NC,$+5 + LD HL,0 ; In case of a slightly negative number + PUSH HL ; Save it for Xmodem packets show + CALL DIVREC ; Divide number of records by 8 + CALL DECOUT + + CALL ILPRTL + DB CR,LF + DB 'Xmodem packets remaining > ',0 + POP HL ; Get total records remaining after this file + LD (TOTREC),HL + CALL DECOUT ; Show remote remaining records + CALL ILPRTL + DB CR,LF,LF,0 + CALL WAITMSG ; Display '[ waiting ]' message locally + RET + +; +; If sending an ARC or ARK file, tell user to rename to .ARK or .ARC file type. +; +OPNOK5: LD A,(LBRARC) ; Get extraction flag + OR A ; Enabled? + JP Z,DLRDY ; No, skip this + LD A,(FCB+9) ; Point to member filetype + AND 7FH ; Strip parity + CP 'L' ; LBR member extraction? + JP Z,DLRDY ; Yes, skip this + CALL ILPRTB + DB CR,LF + DB 'You MUST name file > ',0 + LD D,8 ; Filename count - ignore filetype + LD HL,MEMFCB ; Get requested member name + +OPNOK6: LD A,(HL) + CP ' ' ; Short filename? + JR Z,OPNOK7 ; If so, fill in type + CALL TYPE + + DEC D ; One less... + INC HL ; Next character + JR NZ,OPNOK6 ; Loop until done + +OPNOK7: LD A,(FCB+11) ; Get last character of parent filetype + LD ($+9),A ; Stuff it below to display + CALL ILPRTB + DB '.AR?' ; Either a 'C' or a 'K' gets poked at '?' + DB CR,LF,0 + CALL DLRDY ; Tell them their download(s) are ready + RET + +; +; These routines display the transfer time in minutes & seconds and check for +; time restrictions, if a clock is enabled. +; +XFRTIM: PUSH HL ; Save seconds in 'L' + CALL WHLCHK ; Sysop online? + JR NZ,SKPTIM ; Yes, then skip the limit + + LD A,(MAXTOS) + OR A + JR Z,SKPTIM + LD D,C ; Save minutes for now + INC D ; Increment to next full minute + LD A,(TIMEON) ; Using TIMEON? + OR A + LD A,D ; Get length of this program + JR Z,XFRTM1 ; No, don't increment time + LD HL,TON ; Point to time on system + ADD A,(HL) ; Else add time on system to transfer time + +XFRTM1: LD (XFRMIN),A ; Store it + OR A + LD A,B ; Get hours in A + JR NZ,$+3 ; Don't increment if not zero + INC A ; Increment to next full minute + LD (XFRMIN+1),A + +SKPTIM: LD H,B ; Get most significant in H (hours) + LD L,C ; Get least significant byte of minutes in L + CALL DECOUT ; Print decimal number of minutes + CALL ILPRT + DB ':',0 + POP HL ; Get seconds back + LD A,L ; Get the number of seconds + CP 10 ; 10 seconds or more? + JR NC,$+7 ; If yes, disregard next two lines + CALL ILPRT + DB '0',0 + CALL DECOUT ; Print decimal number of seconds + CALL ILPRT + DB ' at ',0 + CALL GETSPD ; Get modem speed value in A + CALL SHOSPD ; Display in BPS + +; +; Determine if the caller has enough time left online to make the +; requested download(s). +; +XFRTM3: LD A,(MODE) ; Get transfer mode + CP 'R' ; Receiving? + RET Z ; Yes, all done + + LD A,(MAXTOS) ; Get maximum time allowed + OR A ; Unlimited? + RET Z ; Yes, skip time restriction + + LD A,(XFRMIN+1) ; Get most significant byte of minutes + OR A ; 0? + JR NZ,OVERTM ; If not, over 255 minutes + LD A,(XFRMIN) ; Get least significant byte of minute count + LD B,A ; Put in B + LD A,(MAXTOS) ; Get maximum time allowed + INC A + SBC A,B + RET NC + +; +; There is not enough time to download the requested file(s). Inform user and +; abort to CP/M. +; +OVERTM: CALL ILPRTB + DB CR,LF,LF,0 + CALL ABRTMSG ; Display both local and remote we aborted + CALL ILPRTB + DB CR,LF,LF + DB 'Required send time exceeds the ',0 + LD A,(TLOS) ; Get time left on system + LD H,0 ; Zero H + LD L,A ; Time left on system in L + CALL DECOUT ; Decimal output routine + CALL ERXIT ; Display following message and abort to CP/M + DB ' minutes allowed','$' + +; +;-------------------------------------------------------------------------; +; L o g F i l e T r a n s f e r | +;-------------------------------------------------------------------------; +; +; Main log file routine, adds record to log file +; +LOGCALL:LD A,(LOGCAL) ; Logging file transfers? + OR A + RET Z ; No + CALL GTCURDU ; Get current drive/user in USRSAV and DSKSAV + + LD HL,FCBCLR ; FCB to initialize + LD DE,LSTCLR ; Filename to insert + CALL RENFCB ; Initialize FCB + + LD A,(LASTDRV) + SUB 'A' + LD (DEFDSK),A + LD A,(LASTUSR) + LD (DEFUSR),A + LD DE,FCBCLR + CALL OPENF ; Open LASTCALR file + JR NZ,LGCAL1 + CALL ILPRT + DB CR,LF + DB '-- File not Found: LASTCALR.???' + DB CR,LF,0 + RET ; Now go send EOT + +LGCAL1: LD C,SETRRD ; Get random record # + LD DE,FCBCLR ; (for first record in file) + CALL BDOS + + LD DE,DBUF ; Set DMA to DBUF + CALL STDMA + + LD C,RRDM ; Read first (and only) record + LD DE,FCBCLR + CALL BDOS + + LD HL,DBUF ; Set pointer to beginning of record + LD A,(CLOCK) ; Is there a clock installed? + OR A + JR Z,LGCAL2 ; No, skip this then + LD DE,0 ; Zero DE + LD A,(LCNAME) ; Offset to start of caller's name + LD E,A ; To E + ADD HL,DE ; HL now points to start of name + +LGCAL2: LD (CLRPTR),HL + LD DE,LOGBUF ; Set DMA address to LOGBUF + CALL STDMA + + LD HL,FCBLOG ; FCB to initialize + LD DE,LOGNAM ; Filename to insert + CALL RENFCB ; Initialize FCB + + LD A,(LOGDRV) + SUB 'A' + LD (DEFDSK),A + LD A,(LOGUSR) + LD (DEFUSR),A + LD DE,FCBLOG + CALL OPENF ; Open log file + JR NZ,LGCAL5 ; If file exists, skip create + LD DE,FCBLOG + LD C,MAKE ; Create a new file if needed + CALL BDOS + INC A + JR NZ,LGCAL3 ; No error, continue + CALL ILPRT ; File create error + DB CR,LF + DB '-- Directory Full: ',0 + LD HL,LOGNAM + CALL SHONM4 + RET ; Go back and send EOT + +LGCAL3: LD DE,LOGBUF ; Set DMA back to LOGBUF + CALL STDMA + + LD C,SETRRD ; Set random record # + LD DE,FCBLOG ; (for first record in file) + CALL BDOS + +LGCAL4: LD A,EOF + LD (LOGBUF),A + JR LGCAL6 + +LGCAL5: LD DE,LOGBUF ; Set DMA to LOGBUF + CALL STDMA + + LD C,FILSIZ ; Get file length + LD DE,FCBLOG + CALL BDOS + LD HL,(FCBLOG+33) ; Back up to last record + LD A,L + OR H + JR Z,LGCAL4 ; Unless zero length file + DEC HL + LD (FCBLOG+33),HL + LD DE,FCBLOG + LD C,RRDM ; And read it + CALL BDOS + +LGCAL6: CALL RSTLP ; Initialize LOGPTR and LOGCNT + +LGCAL7: LD A,(LOGCNT) + INC A + LD (LOGCNT),A + CP 129 + JR NZ,LGCAL8 + LD HL,(FCBLOG+33) + INC HL + LD (FCBLOG+33),HL + LD HL,LOGBUF+1 + LD (LOGPTR),HL + LD A,1 + LD (LOGCNT),A + LD A,EOF + JR LGCAL8A + +LGCAL8: LD HL,(LOGPTR) + LD A,(HL) + INC HL + LD (LOGPTR),HL + +LGCAL8A:CP EOF + JR NZ,LGCAL7 ; Until EOF + LD A,(LOGCNT) ; Then backup one character + DEC A + LD (LOGCNT),A + LD HL,(LOGPTR) + DEC HL + LD (LOGPTR),HL + +; +; Print file transfer mode to LOG file (R, S, P, A, L) +; + LD A,(PUPFLG) + OR A ; Privileged upload option request? + JR Z,LGCAL8B ; No, skip next 2 lines + LD A,'P' ; Else, + JR LGCAL9 ; Show as private upload for log file + +LGCAL8B:LD A,(PRIVATE) + OR A + JR NZ,LGCAL9 + LD A,(MODE) ; Get transfer mode back and put in file + +LGCAL9: CALL PUTLOG + +; +; Print baud rate to LOG file +; + CALL GETSPD ; Get speed factor + ADD A,30H + CALL PUTLOG + CALL PUTSP ; Blank + +; +; Print program size (in minutes and seconds) to LOG file +; + LD A,(PGSIZE) ; Now the program size in minutes.. + CALL PNDEC ; Of transfer time (mins) + LD A,':' + CALL PUTLOG ; ':' + LD A,(PGSIZE+2) + CALL PNDEC ; And seconds + CALL PUTSP ; Blank + +; +; Log the drive and user area as a prompt +; + LD A,(FCB) + OR A + JR NZ,WDRV + LD A,(DSKSAV) + INC A + +WDRV: ADD A,'A'-1 + CALL PUTLOG + LD A,(USRSAV) + CALL PNDEC + LD A,'>' ; Make it look like a prompt + CALL PUTLOG + LD A,(LBRARC) + OR A ; Member extraction? + JR Z,WDRV1 ; No, won't be member name + LD HL,MEMFCB ; Name of file in library + LD B,11 + CALL PUTSTR + CALL PUTSP ; ' ' + +; +; Put filename in LOG file +; +WDRV1: LD HL,FCB+1 ; Now the name of the file + LD B,11 + CALL PUTSTR + LD A,(LBRARC) + OR A ; Member extraction? + JR Z,WDRV2 ; No, won't be member name + LD C,1 + JR SPLOOP + +WDRV2: LD C,13 + +SPLOOP: PUSH BC + CALL PUTSP ; Put ' ' + POP BC + DEC C + JR NZ,SPLOOP + +; +; Print number of 'k' to LOG file +; + LD HL,(RECDNO) ; Get record count + CALL DIVREC ; Divide record count by 8 + +EXKB2: CALL PNDEC3 ; Print to log file (right just xxxk) + LD HL,LOGK ; 'k ' + LD B,2 + CALL PUTSTR + XOR A + LD (COMMA),A ; Reset field counter + +; +; Print date and time of transfer to LOG file +; + LD A,(CLOCK) ; Clock available in BYE? + OR A + JR NZ,EXKB3 ; Yes, continue + LD A,(RTC) ; Else how about an RTC overlay? + OR A + JR Z,CLOOP ; Nope, foget date and time + +EXKB3: CALL GETTIME ; Get CURRENT time for log + + LD A,(EDATE) ; European date format? + OR A + JR Z,EXKB4 ; No + + LD A,(DAY) + CALL PNDEC ; Print DD + LD A,'/' ; '/' + CALL PUTLOG + LD A,(MONTH) + CALL PNDEC ; Print MM + JR EXKB5 + +EXKB4: LD A,(MONTH) + CALL PNDEC ; Print MM + LD A,'/' ; '/' + CALL PUTLOG + LD A,(DAY) + CALL PNDEC ; Print DD + +EXKB5: LD A,'/' ; '/' + CALL PUTLOG + LD A,(YEAR) + CALL PNDEC ; Print YY + CALL PUTSP ; ' ' + LD A,(HOUR) ; Get current hour + CALL PNDEC ; Print hr to file + LD A,':' ; With ':' + CALL PUTLOG ; Between HH:MM + LD A,(MINUTE) ; Get min + CALL PNDEC ; And print min + CALL PUTSP ; Print a space + +; +; Print name of caller to LOG file +; +CLOOP: LD HL,(CLRPTR) + LD A,(HL) + INC HL + LD (CLRPTR),HL + CP EOF ; End of file? + JR Z,QUIT ; Yes + CP CR ; Do not print 2nd line of 'LASTCALR' + JR NZ,CLOP1 + +CEND: CALL PUTLOG + LD A,LF + CALL PUTLOG ; And add a LF + JR QUIT + +CLOP1: CP ' ' ; Space? + JR NZ,CLOP1A ; No, check for comma + LD A,',' ; Convert space to comma for field checking + +CLOP1A: CP ',' ; Comma? + JR NZ,CLOP2 + LD A,(COMMA) + CP 1 ; Is this the second comma or space? + JR NZ,CLOP1B ; No, bump the counter + LD A,CR + JR CEND ; Yes, stop taking data from lastcalr + +CLOP1B: INC A ; Bump it one + LD (COMMA),A + LD A,' ' ; Instead send a ' ' + +CLOP2: CALL PUTLOG + JR CLOOP + +QUIT: LD A,EOF ; Put in EOF + CALL PUTLOG + LD A,(LOGCNT) ; Check count of chars in buffer + CP 1 + JR NZ,QUIT ; Fill last buffer & write it + LD DE,FCBCLR ; Close lastcaller file + LD C,CLOSE + CALL BDOS + INC A + JR Z,QUIT1 + LD HL,(FCBLOG+33) ; Move pointer back to show + DEC HL ; Actual file size + LD (FCBLOG+33),HL + LD DE,FCBLOG ; Close log file + LD C,CLOSE + CALL BDOS + INC A + RET NZ ; If OK, return now... + +QUIT1: CALL ILPRT ; If error, oops + DB CR,LF + DB '-- Close Error: ',0 + LD HL,LOGNAM + CALL SHONM4 + RET ; Go back and send EOT + +; +;------------------------- +; LOGCAL Support Routines +; +; Open file with FCB pointed to by DE (disk/user passed in DEFDSK and DEFUSR) +; +OPENF: PUSH DE ; Save FCB address + LD A,(DEFDSK) ; Get disk for file + CALL RECDRX ; Log into it + LD A,(DEFUSR) ; Get default user + CALL RECAR1 ; Log into it + POP DE ; Get FCB address + LD A,(CPM3) ; Using with CPM3? + OR A + JR Z,OPENF1 ; No + PUSH DE ; Save FCB address + CALL RSDMA ; Set DMA to 80H + POP DE ; Get back pointer to FCB + PUSH DE ; Save FCB pointer again + LD C,SRCHF ; Search for first match + CALL BDOS + INC A ; Did file match? + POP DE + RET Z ; No, return + PUSH DE + DEC A ; A=directory code (0-3) + ADD A,A ; *2 + ADD A,A ; *4 + ADD A,A ; *8 + ADD A,A ; *16 + ADD A,A ; *32 + LD E,A + LD D,0 + LD HL,TBUF ; Add (32*dir code) to default DMA + ADD HL,DE ; to find first match filename + POP DE ; DE=FCB + PUSH DE ; Save DE again + INC HL ; Move HL past user # byte in buffer + INC DE ; Move DE past drive # byte in FCB + LD BC,11 + LDIR ; Move name found to FCB + POP DE ; And continue with open + +OPENF1: LD C,OPEN ; Open file + CALL BDOS + CP 0FFH ; Not present? + RET ; Return to caller + +; +; Write character to log file +; +PUTLOG: LD HL,(LOGPTR) ; Get pointer + AND 7FH ; Strip any attributes + LD (HL),A ; Put data + INC HL ; Increment pointer + LD (LOGPTR),HL ; Update pointer + LD B,A ; Save character in B + LD A,(LOGCNT) ; Get count + INC A ; Increment it + LD (LOGCNT),A ; Update count + CP 129 ; Check it + RET NZ ; If not EOB, return + PUSH BC ; Save character + LD DE,FCBLOG ; Else, write this sector + LD C,WRDM + CALL BDOS + OR A + JR Z,ADVRCP ; If ok, cont. + CALL ILPRT + DB CR,LF + DB '-- Disk Full: ',0 + LD HL,LOGNAM + CALL SHONM4 + RET + +ADVRCP: LD HL,(FCBLOG+33) ; Advance record number + INC HL + LD (FCBLOG+33),HL + CALL RSTLP ; Reset buffer pointers + POP AF ; Get saved character + JP PUTLOG ; Put it in buffer and return + +RSTLP: LD HL,LOGBUF ; Reset pointers + LD (LOGPTR),HL ; And return + LD A,0 + LD (LOGCNT),A + RET + +; +; Print number in decimal format (into log file) IN: HL=binary number +; OUT: nnn=right justified with spaces +; +PNDEC3: LD A,H ; Check high byte + OR A + JR NZ,DECOT ; If on, is at least 3 digits + LD A,L ; Else, check low byte + CP 100 + JR NC,TEN + CALL PUTSP + +TEN: CP 10 + JR NC,DECOT + CALL PUTSP + JR DECOT + +; +; Print number in decimal format (into log file) +; +PNDEC: CP 10 ; Two column decimal format routine + JR C,ONE ; One or two digits to area number? + JR TWO + +ONE: PUSH AF + LD A,'0' + CALL PUTLOG + POP AF + +TWO: LD H,0 + LD L,A + +DECOT: PUSH BC + PUSH DE + PUSH HL + LD BC,-10 + LD DE,-1 + +DECOT2: ADD HL,BC + INC DE + JR C,DECOT2 + LD BC,10 + ADD HL,BC + EX DE,HL + LD A,H + OR L + CALL NZ,DECOT + LD A,E + +DECOT3: ADD A,'0' + CALL PUTLOG + +DECOT4: POP HL + POP DE + POP BC + RET + +; +; Put string to log file +; +PUTSTR: LD A,(HL) + PUSH HL + PUSH BC + CALL PUTLOG + POP BC + POP HL + INC HL + DJNZ PUTSTR + RET + +; +; Puts a single space in log file, saves PSW/HL +; +PUTSP: PUSH AF + PUSH HL + LD A,' ' + CALL PUTLOG + POP HL + POP AF + RET + +; +;-------------------------------------------------------------------------; +; T I M E & D A T E R o u t i n e s | +;-------------------------------------------------------------------------; +; +; Get RTCBUF address if running BYE +; +TIME: LD A,(CLOCK) ; Clock in BYE? + OR A + JR Z,TIME1 ; No + LD DE,25 ; Offset to RTCBUF address + CALL GETOFF ; Point to JP COLDBOOT + offset in DE + LD E,(HL) ; HL points to RTCBUF address + INC HL ; To most significant byte of address + LD D,(HL) + EX DE,HL ; Back to HL + LD (RTCBUF),HL ; Save for later use + CALL GETTIME ; Store RTCBUF contents internally + + LD HL,(RTCBUF) ; Get RTC buffer address + LD DE,7 ; Offset to time on system (TOS) word + ADD HL,DE ; Address in HL + LD A,(HL) ; Get minutes on system + LD (TON),A ; Store time on system for SHOWTOS + +; +; Get MAXTOS if restricting downloads to time left +; + LD A,(TIMEON) ; Policing time on system? + OR A + JP Z,SHOWTOS ; No + LD DE,24 ; Offset to maximum time allowed + CALL GETOFF ; Point to JP COLDBOOT + offset in D + + LD A,(MODE) ; Exiting? (Gets set NZ in exit routine) + OR A + JR Z,TIME0 ; No, skip next + LD A,(MAXTOS) ; Reset maximum time allowed + LD (HL),A + JR TIME0A + +TIME0: LD A,(HL) ; Get maximum time allowed + LD (MAXTOS),A ; Store it + LD (HL),0 ; Disable BYE from checking time for now + +TIME0A: LD A,(TON) + LD B,A ; Save time on system for comparison + LD A,(MAXTOS) ; Get maximum time allowed + SUB B ; Get time left on system + LD (TLOS),A ; Store time left on system + JP SHOWTOS ; Go show TON + +; +; Get TON if RTC +; +TIME1: LD A,(RTC) ; Clock reader code installed in ZMD? + OR A + JP Z,SHOWTOS ; No + CALL GETTIME + + LD HL,(LHOUR) ; Get address to logon hour + LD A,(HOUR) + CP (HL) ; Same as current hour? + INC HL ; Point to logon minute + LD D,(HL) ; Get it in D + JR NZ,TIME2 ; No, not the same + LD A,(MINUTE) ; Else get current minute + SUB D ; Subtract logon minute + LD (TON),A ; Store it as time on system + JR TIME3 ; Get maximum allowed + +TIME2: LD A,60 ; Fake an hour + SUB D ; Subtract logon minute + LD HL,MINUTE ; Point to current minute + ADD A,(HL) ; Add them + LD (TON),A ; Store as current time on system + +; +; Get MAXTOS if TIMEON +; +TIME3: LD A,(TIMEON) ; Restricting downloads to time left? + OR A + JR Z,SHOWTOS ; No + CALL WHLCHK ; WHEEL byte set? + JR NZ,SHOWTOS ; Yes, just display time on system + LD A,(MODE) ; Else been here before? + OR A + JR NZ,TIME4 ; Yes (MODE is 0 first time through) + LD A,(MAXMIN) + LD (MAXTOS),A ; Else set maximum time allowed + LD (TLOS),A ; And current time left on system + +TIME4: LD A,(MAXTOS) ; Get current maximum time allowed + OR A ; Unlimited? + JR Z,SHOWTOS ; Yes, just display time on system + LD A,(MAXMIN) ; Else get original maximum minutes allowed + LD B,A ; Into B + LD A,(TON) ; Get current time on system + SUB B ; Time up? + JR C,SHOWTOS ; No, just display time on system + + CALL ILPRTB + DB CR,LF,LF + DB '-- Your time is up, please share the system with others' + DB CR,LF,0 + POP HL + LD A,0CDH + LD (0),A + JP 0 + +; +; Display the time on system +; +SHOWTOS:LD A,(DSPTOS) ; Display time on system message? + OR A + RET Z ; No, all done + LD A,(MODE) ; Else exiting? + OR A + JR Z,SHOTOS1 ; Yes, no line feed + CALL ILPRTB + DB CR,LF,0 + +SHOTOS1:CALL ILPRTB + DB 'Online ',0 + LD A,(TON) ; Get time on system + LD H,0 ; Zero H + LD L,A ; TON in L + CALL DECOUT ; Decimal output + CALL ILPRTB + DB ' minute',0 + LD A,(TON) ; Get time on system + CP 1 ; 1? + JR Z,SHOTOS2 ; Yes, leave display as 'minute' + CALL ILPRTB + DB 's',0 ; Else make it plural + +SHOTOS2:LD A,(MODE) + OR A + RET NZ + CALL ILPRT + DB CR,LF,0 + RET + +; +; Transfer BYE's RTCBUF contents to internal storage +; +GETTIME:LD A,(RTC) ; User installed clock routines? + OR A + JP NZ,RTCTIM ; Yes, go do it + LD HL,(RTCBUF) + + LD A,(HL) ; 00: + CALL BCDBIN ; Convert to binary + LD (HOUR),A ; Save + + CALL GETTIM3 ; :00 + LD (MINUTE),A ; Save + + INC HL ; Skip seconds + INC HL ; Skip '19'nn + CALL GETTIM3 ; YY + LD (YEAR),A ; Save + + CALL GETTIM3 ; MM + LD (MONTH),A ; Save + + CALL GETTIM3 ; DD + LD (DAY),A ; Save + RET ; And return + +GETTIM3:INC HL ; Increment to next RTC byte value + LD A,(HL) ; Get it + JP BCDBIN ; Return with binary value in A + +; +; Add the time of the last upload/download to BYE's time on system byte +; +ADDTON: LD A,(TIMEON) ; Using TIMEON? + OR A + RET Z + + CALL BYECHK ; If so, see if BYE is running + OR A ; 0 if no clock, or 0 if no BYE. + LD HL,TON ; Prepare for internal RTC + JR Z,ADDTN1 + + LD HL,(RTCBUF) ; Get RTC buffer address + LD DE,7 ; Get offset to TOS word + ADD HL,DE ; Add offset, HL contains TON address + +ADDTN1: PUSH HL ; Save it + LD HL,(RECDNO) + LD (RCNT),HL + CALL XTIM ; Calculate transfer time + POP HL ; Restore TON address + LD A,(HL) ; Get time on in A + LD B,A ; Save it + LD A,(MODE) ; Get current transfer mode + CP 'S' ; Is this a download? + JR Z,ADDTN2 ; Yes, subtract download time + LD A,(CREDIT) ; Else crediting upload time? + OR A + RET Z ; No, skip this + LD A,B ; Else get time on system back + SUB C ; Subtract upload time + LD (HL),A ; Store it + RET + +ADDTN2: LD A,B + INC A ; Bump it one + ADD A,C ; Add transfer time + LD (HL),A ; Put it back for BYE + RET + +; +;-------------------------------------------------------------------------; +; A v a i l a b l e U p l o a d S p a c e | +;-------------------------------------------------------------------------; +; +; This routine is called with the 'F' option from both CP/M (with 'ZMD F') +; or from The HELP Guide routines. First determine where uploads are +; suppose to go. +; +SPACE: CALL RSTLCK ; Go reset WRTLOC if needed + CALL WHLCHK ; WHEEL byte set? + JR NZ,SPACE1 ; Yes, give space for current drive/user + LD A,(ASKAREA) + OR A + JR NZ,SPACE2 + LD A,(SETAREA) + OR A + JR NZ,SPACE2 ; Yes + +SPACE1: LD A,(OLDDRV) ; Get currently logged drive + ADD A,'A' ; Make it ASCII + LD (DRV),A + LD (KDRV),A ; Store it for KSHOW + LD A,(OLDUSR) ; Get currently logged user + LD (USR),A ; Store it for KSHOW + +SPACE2: CALL WHLCHK + CALL Z,GETKIND ; Get upload area if ASKAREA + CALL ILPRTB + DB CR + DB ' Regular ',0 + CALL SPACE8 + CALL ILPRTB + DB CR,LF + DB ' Private ',0 + LD A,1 + LD (PRVSPC),A + CALL SPACE8 + JP EXIT ; Exit to CP/M + +; +; Displays the file descriptor/category when showing available upload space. +; +SPACE8: CALL WHLCHK + CALL Z,SHOCAT ; Show upload area descriptor, if supposed to + CALL ILPRTB + DB 'uploads received on ',0 + LD A,(PRVSPC) ; Want private area space? + OR A + JR NZ,SPACE9 ; Yes, do private stuff + LD A,(DRV) ; Get drive to receive regular upload + LD (KDRV),A ; Store it for KSHOW + CALL TYPE ; Output to modem + LD A,(USR) ; Get user area to receive regular upload + JR SPACE10 ; Go show free space + +SPACE9: LD A,(PRDRV) ; Get drive to receive private upload + LD (KDRV),A ; Store it for KSHOW + CALL TYPE ; Output to modem + LD A,(PRUSR) ; Get user area to receive private upload + +SPACE10:LD H,0 + LD L,A ; User area in L + CALL DECOUT ; Decimal output + CALL ILPRTB + DB ':',0 + LD A,(PRVSPC) ; Getting private info? + OR A + JR Z,SPACE11 ; No + LD A,(DRV) ; Else get regular drive + LD HL,PRDRV ; Point to private drive + CP (HL) ; Private same as regular drive? + RET Z ; Yes, don't report 'k' this time + +SPACE11:CALL ILPRTB + DB ' (',0 + LD A,(KDRV) ; Get upload drive + CALL KSHOW ; Show available space for drive + CALL ILPRTB + DB ')',0 + RET + +; +;-------------------------------------------------------------------------; +; R u n t i m e H e l p G u i d e | +;-------------------------------------------------------------------------; +; +; Either 'ZMD' was entered by itself from CP/M, or an invalid option +; given. +; +HELP: CALL ILPRTB + DB CR,LF,' mode drive/user' + DB CR,LF,' / /' + DB CR,LF,'Usage: ZMD SK {du:} ' + DB CR,LF,' / /' + DB CR,LF,' protocol filename' + DB CR,LF + DB CR,LF,'Mode: Protocol:' + DB CR,LF,' S - Send file from BBS ' + DB 'X - Xmodem 128 byte blocks (CRC)' + DB CR,LF,' SP - Send from private area ' + DB 'C - Xmodem 128 byte blocks (Checksum)' + DB CR,LF,' A - Send ARK/ARC/LBR member ' + DB 'K - Ymodem 1024 byte blocks (CRC only)' + DB CR,LF,' R - Receive file from YOU' + DB CR,LF,' RP - Receive in private area',0 + + + CALL ILPRTB + DB CR,LF,0 + LD A,(MSGFIL) + OR A + JR Z,HELP1 + CALL ILPRTB + DB ' RM - Receive preformatted message base upload',0 + +HELP1: CALL ILPRTB + DB CR,LF,0 + CALL WHLCHK + JR Z,HELP2 + CALL ILPRTB + DB ' RW - Receive without description(s)',0 + +HELP2: CALL ILPRTB + DB CR,LF,' F - Displays available upload space' + DB CR,LF + DB CR,LF + DB CR,LF + DB '--SPACE BAR displays specific examples--',0 + + CALL INPUT + CP ' ' + JP NZ,EXIT + + LD HL,ZMDNAM + CALL PRINTV + CALL ILPRTB + DB 'Usage examples:' + DB CR,LF + DB CR,LF,' ZMD S filename.ext ' + DB 'Send single file (Automatic detect)' + DB CR,LF,' ZMD S B4:filename.ext ' + DB 'Send single file (Automatic detect)' + DB CR,LF,' ZMD SK filename.ext ' + DB 'Send single file (Ymodem 1k)' + DB CR,LF,' ZMD S filename.* ' + DB 'Send from current d/u (Ymodem 1k Batch)' + DB CR,LF,' ZMD S D1:*.* B9:*.doc ' + DB 'Send from multiple d/u (Ymodem 1k Batch)' + DB CR,LF,' ZMD A librnam lbrmber.ext ' + DB 'Send ARK/ARC/LBR member (Automatic detect)' + DB CR,LF,' ZMD AK librnam lbrmber.ext ' + DB 'Send ARK/ARC/LBR member (Ymodem 1k)' + DB CR,LF + DB CR,LF,' ZMD R filename.ext ' + DB 'Receive single file (Automatic detect)' + DB CR,LF,' ZMD R ' + DB 'Receive multiple files (Ymodem 1k Batch)' + DB CR,LF,' ZMD RPC filename.ext ' + DB 'Receive to private area (Checksum)' + DB CR,LF,LF + DB 'Protocol may be omitted for automatic protocol detection.' + DB CR,LF + DB 'Ymodem 1k Batch is enabled upon detection of wildcards or' + DB ' multiple' + DB CR,LF + DB ' filenames on command line (can also be forced with' + DB ' ''SB'' mode).',0 + JP EXIT + + +ABRTMSG:CALL ILPRTB + DB CR + DB '-- ZMD Aborted',0 + RET + +NOACC: CALL SENDBEL ; Send a bell out modem only + CALL ERXIT + DB CR,LF + DB '-- Restricted Function - Access Denied','$' + +ZEROLN: CALL ERXIT + DB CR,LF + DB '-- File empty - ZMD aborted','$' + +NOFILE: CALL ERXIT + DB CR + DB '-- No matching filename(s) found','$' + +NOIO: XOR A + LD (RTC),A + LD (TIMEON),A + LD (DSPTOS),A + LD (CLOCK),A + CALL ERXIT + DB BELL + DB '-- Modem I/O unavailable - Aborting','$' + +TOOSLOW:CALL ERXIT + DB CR,LF,LF + DB '-- YMODEM 1k/BATCH not valid - Modem speed too slow','$' + + +TOTMSG: CALL ILPRTL + DB ' - Timeout, no character received',CR,LF,0 + RET + +DLRDY: CALL ILPRT + DB CR,LF + DB 'Your file(s) now ready to download',0 + CALL CONT6 + RET + +WAITMSG:CALL ILPRTL + DB ' -- Waiting --' + DB CR,0 + RET + +; +;------------------------------- +; File type restriction storage +;------------------------------- +; +; Don't allow ___ (If ZCPR is YES) +; \ +SYSCHK: DB 'SYS' +NDRCHK: DB 'NDR' +RCPCHK: DB 'RCP' + +; +; If receiving __ change it to __ (If NOCOMR is YES) +; \ \ +COMCHG: DB 'COM', 'OBJ' +PRLCHG: DB 'PRL', 'OBP' + +; +; If the library extraction flag (LBRARC) is set and an unsuccessful open with +; the default filetype occurs, the following file types are copied to FCB+9 +; and the open attempt is repeated. +; +ARCNAM: DB 'ARC' ; Copied to FCB+9 +LBRNAM: DB 'LBR' ; Copied to FCB+9 +ARKNAM: DB 'ARK' ; Copied to FCB+9 + +; +;--------------------- +; LOGCALL allocations +;--------------------- +; +DEFDSK: DB 0 ; Disk for open stored here +DEFUSR: DB 0 ; User for open stored here +CLRPTR: DW LOGBUF +LOGPTR: DW DBUF +LOGCNT: DB 0 +LOGK: DB 'k ' +DUSAVE: DB 0,0,0,0 ; Buffer for drive/user + +; +;------------------ +; Time allocations +;------------------ +; +MAXTOS: DB 0 ; Maximum time left on system +RTCBUF: DW 0 ; RTCBUF address +TLOS: DB 0 ; Current time left on system +TON: DB 0 ; Current time on system + +; +XTABLE: DW 5, 13, 19, 25, 30, 48, 85, 141, 210, 280, 0 +KTABLE: DW 5, 14, 21, 27, 32, 53, 101, 190, 330, 525, 0 +XECTBL: DB 192, 74, 51, 38, 32, 20, 11, 8, 5, 3, 0 +KECTBL: DB 192, 69, 46, 36, 30, 18, 10, 5, 3, 2, 0 + +; +;-------------------- +; Batch mode storage +;-------------------- +; +BGNMS: DW 0 ; Start address of filenames in TBUFF +LIST: DW DBUF ; Filename storage in send batch mode +LISTPOS:DW 0 ; Next position to store matching filename +LISTEND:DW 0 ; Address of last matching filename +LISTI: DW 0 ; Pointer 1 for two-dimensional bubble sort +LISTJ: DW 0 ; Pointer 2 for two-dimensional bubble sort +FILEK: DW 0 ; Total kilobytes of files found (send batch) +FCBBUF: DS 21 ; Batch filename from command line +FSTFLG: DB 0 ; Set to 1 when command line scan done +NAMECT: DB 0 ; # of names on command line +NBSAVE: DW 0 ; Start address in NAMBUF for next file +SBSHOW: DB 0 ; Set shows partial stat display in batch +SHOCNT: DB 0 ; Counter to show files left +TOTREC: DW 0 ; Total records to be sent + +; +;------------------------ +; Temporary storage area +;------------------------ +; +ACKCHK: DB 0 ; Lets batch header user GTACK routine +AFBYTE: DB 0 ; Access flags byte storage +CHKEOT: DB 0 ; Prevents locking up after an EOT +COMMA: DB 0 ; Field counter for logcal +CRCFLG: DB 1 ; For sending checksum rather than CRC +EOFLG: DB 0 ; EOF (End of file) flag +EOTFLG: DB 0 ; EOT (End of transmission) status flag +ERRCNT: DB 0 ; Error count +FRSTIM: DB 0 ; Turned on after first 'SOH' received +GOTONE: DB 0 ; Prevents asking for a description +KFLG: DB 1 ; For sending 1k blocks (Defaults to 1k) +PRVSPC: DB 0 ; Shows in private display in SPACE: if set +RCVCNT: DB 0 ; Record number received +RCVTRY: DB 0 ; Keeps track of number of attempts +RCVDRV: DB 0 ; Requested drive number +RCVUSR: DB 0 ; Requested user number + +ACCERR: DW 0 ; No 'ACK' error count for 1k ratio +HDRADR: DW 0 ; Current location in batch header block +RCNT: DW 0 ; Record count +RECDNO: DW 0 ; Current record number +RCDCNT: DW 0 ; Used in sending the record header +RECPTR: DW DBUF +RECNBF: DW 0 ; Number of records in the buffer +SAVEHL: DW 0 ; Saves TBUF command line address +XFRMIN: DW 0 ; Transfer time in mins for TIMEON + +; + END ; 'Almost'... + \ No newline at end of file diff --git a/Source/Apps/ZMD/zmdel.z80 b/Source/Apps/ZMD/zmdel.z80 new file mode 100644 index 00000000..81113f46 --- /dev/null +++ b/Source/Apps/ZMD/zmdel.z80 @@ -0,0 +1,264 @@ +; + + TITLE ZMDEL.Z80 - 09/29/88 - ZMD Sysop Transfer Log Purge Utility +; Copyrighted (c) 1987, 1988 +; Robert W. Kramer III + + PAGE +;- -; +; Update History ; +; ; +; Date Release Comments ; +; -------- ------- ---------------------------------------------- ; +; ; +; 09/29/88 v1.50 - No change(s) made to this file ; +; 03/18/88 v1.49 - No change(s) made to this file ; +; 03/13/88 v1.48 - Had a small problem with TPA fix which has been ; +; corrected. CHKTPA was calculating the total ; +; number of bytes available for DBUF, but wasn't ; +; clearing register L (forcing an even amount of ; +; sectors before initializing OUTSIZ buffer limit ; +; comparison word). This may have introduced ; +; minimal garbage to your FOR file if your FOR ; +; file is large enough to fill available TPA with ; +; ZMD, ZFORS or to the log file if running ZMDEL. ; +; - Rewrote OUTCHR routine in ZMDSUBS. ; +; - Redefined buffer table at end of programs. STACK; +; and filename buffers now EQUated with offsets ; +; from the last switch/toggle in program instead ; +; of with DS directive. ; +; - Some systems which do NOT have an interrupt ; +; driven keyboard may have noticed problems when ; +; an invalid key was entered in the ZNEWP, ZFORP ; +; and ZMDEL programs. In ZNEWP and ZFORP, if a ; +; CR was entered to pause the output, output was ; +; limited to one line at a time per key pressed. ; +; If an invalid key was hit, output would have ; +; remained in a paused state until one of the ; +; abort keys were pressed. This was difficult to ; +; find since my keyboard is interrupt driven and ; +; I could not duplicate the problem on my own ; +; system. ; +; 02/25/88 v1.47 - Fixed line count display routine. Number of ; +; lines read was being improperly decremented ; +; before displaying. Same fix included removing ; +; code that added an extra CR,LF to the beginning ; +; of the file. Count is now right. ; +; 01/27/88 v1.46 - Some changes were made to the ZMDSUBS file that ; +; are not directly related to this file ; +; 01/17/88 v1.45 - First public release ; +; 11/20/87 v1.00 - Initial version ; +;- -; + +;-------------------------------------------------------------------------; +; EXTERNAL Declarations: | +;-------------------------------------------------------------------------; + + + EXTRN CKABRT,CLEARIT,CLRLIN,DBUF,DECOUT,ERXIT,EXIT,ILPRTB + EXTRN INPUT,NOFILE,NOLOG,NOROOM,OLDDRV,OLDUSR,OUTCHR,PRINTV + EXTRN RECAR1,RECDR1,RENFCB,RERROR,RSDMA,SHONM4,STACK,STDMA + EXTRN TDONE,TYPE,UCASE + +; +;-------------------------------------------------------------------------; +; Program Starts Here | +;-------------------------------------------------------------------------; + + + .Z80 + ASEG + ORG 100H ; Program starts + JP BEGIN ; Jump around configuration table + INCLUDE ZMDHDR.Z80 ; Include the ZMD header overlay + .REQUEST ZMDSUBS ; Include the ZMD subroutines + +; +; +; Save CP/M stack, initialize new one for this program +; +BEGIN: LD (STACK),SP ; Save return address to CCP + LD SP,STACK + +; +; Save current drive/user +; + LD A,255 ; Get user function + CALL RECAR1 + LD (OLDUSR),A ; Save user area for later + LD C,CURDRV ; Get current drive function + CALL BDOS + LD (OLDDRV),A ; Save drive for later + +; +; Tell em who we are and ask if they want to continue +; + LD HL,PRGUTL + CALL PRINTV + + LD A,(LOGCAL) ; Log file enabled? + OR A + JP Z,NOLOG ; No, then don't run program + + CALL ILPRTB + DB 'Purge all except "R" entries from log? ',0 + LD A,0 + LD (DESWAIT),A ; Disable sleepy caller timout + CALL INPUT + CALL UCASE + CP 'Y' ; Continue? + JP NZ,EXIT ; No, exit to CP/M + CALL CLRLIN + +; +; Now log into drive/user area of ZMD.LOG +; + LD A,(LOGUSR) ; Get user area to find ZMD.LOG file + CALL RECAR1 + LD A,(LOGDRV) ; Get drive to find ZMD.LOG file + CALL RECDR1 + +; +; Open the 'ZMD .LOG' file +; + LD DE,LOGNAM ; Point to LOG filename + LD HL,FILE ; Destination is internal FCB1 + CALL RENFCB ; Initialize FCB + + LD DE,FILE ; Point to ZMD.LOG FCB + LD C,OPEN ; Open file + CALL BDOS + INC A ; Does file exist? + LD HL,LOGNAM ; Point to log filename + JP Z,NOFILE ; No, inform user and abort to CP/M + +; +; Open the ' .$$$' file +; + LD DE,TEMPFIL ; Point to temporary filename + LD HL,DEST ; Destination is internal FCB2 + CALL RENFCB ; Initialize FCB + + LD HL,FILE ; Point to default FCB + LD DE,DEST ; + LD BC,9 ; Move drive and filename bytes + LDIR + + LD C,DELETE ; Delete possible '$$$' temporary file + LD DE,DEST + CALL BDOS + + LD C,MAKE ; And make new one for this session + LD DE,DEST + CALL BDOS + INC A ; Successful create? + JP Z,NOROOM ; No, inform user and exit to CP/M + + CALL ILPRTB ; Warn them of the wait + DB CR + DB 'Cleaning ',0 + LD HL,LOGNAM + CALL SHONM4 + +RDRECD: CALL RSDMA ; Reset DMA + LD DE,FILE ; Read a record from ZMD.LOG + LD C,READ + CALL BDOS + OR A ; Read ok? + JP NZ,RERROR ; No, inform user and exit + LD HL,TBUF ; Point to first character in read buffer + +GETBYT: LD A,(HL) ; Get a byte from read buffer + AND 7FH ; Strip parity bit + CP 7FH ; Del (Rubout) + JP Z,NEXT ; Yes, ignore it + CP EOF ; End of file marker + JP Z,TDONE ; Transfer done. Close and exit + LD B,A ; Save character + CP LF ; Was it a line feed? + JP Z,NEWLIN ; Yes toggle line counters, start new line + +; +; LOGMODE is set to 0 everytime a line feed is encountered. If LOGMODE is +; is 0 at this point, the current byte is anylized as this log entry's +; mode of transfer. Only entries made in the 'R' receive mode are written +; to the new ZMD.$$$ file. Encountering an 'R' when LOGMODE is 0 causes +; KEEPER to be set non zero +; + LD A,(LOGMODE) ; Start of new line? + OR A + JP NZ,NXTBYT ; No, then we don't care what this byte is + INC A + LD (LOGMODE),A ; Else show we are not on LOGMODE byte anymore + LD A,B ; Get the character back + CP 'R' ; Is this an upload entry? + LD (KEEPER),A ; Indicate saving byte just in case + JP Z,NXTBYT ; Yes, leave KEEPER non-zero so it's written + XOR A + LD (KEEPER),A ; Else 0 keep flag (0=don't keep this entry) + +NXTBYT: LD A,(KEEPER) ; Keeping this log entry? + OR A + JP Z,NEXT ; No, get next byte + +; +; Place current byte in buffer and write to disk if buffer full +; +WRTBYT: LD A,B + CALL OUTCHR + +NEXT: INC L ; Done with sector? + JP Z,RDRECD ; Yes, get another sector + JP GETBYT ; Else get another byte + +NEWLIN: XOR A ; Zero accumulator + LD (LOGMODE),A ; Show current byte is log mode byte + LD IY,(LNSREAD) ; Get lines read counter + INC IY ; Add one more + LD (LNSREAD),IY + LD A,1 ; Disable page pauses + CALL CKABRT ; User abort? + LD A,(KEEPER) ; Are we keeping this entry? + OR A + JP Z,NEXT ; No, read another byte + LD IY,(LNSWROT) ; Get lines written count + INC IY ; Add one more + LD (LNSWROT),IY + JP WRTBYT + +; +DONE:: CALL CLRLIN + CALL ILPRTB + DB CR,'Finished.' + DB CR,LF + DB ' ',0 + + LD HL,(LNSREAD) + CALL DECOUT + CALL ILPRTB + DB TAB + DB 'original lines',CR,LF + DB ' ',0 + + LD HL,(LNSWROT) + CALL DECOUT + CALL ILPRTB + DB TAB + DB 'retained lines ',0 + JP EXIT + +; +; These next are dummy routines to satisfy external ZMDSUBS requests. +; They do nothing, but leave alone. +; +TIME:: RET + + +KEEPER: DB 0 +LOGMODE:DB 0 +LNSREAD:DW 0 +LNSWROT:DW 0 + + + END + \ No newline at end of file diff --git a/Source/Apps/ZMD/zmdhb.z80 b/Source/Apps/ZMD/zmdhb.z80 new file mode 100644 index 00000000..9d4cddd5 --- /dev/null +++ b/Source/Apps/ZMD/zmdhb.z80 @@ -0,0 +1,916 @@ +;======================================================================= +; +; XMHB.Z80 - XMODEM12 PATCH FILE FOR ROMWBW HBIOS +; +; Wayne Warthen - wwarthen@gmail.com +; +; 2020-05-23 WBW Rewrite for HBIOS FastPath(tm) +; +;======================================================================= +; + ASEG +; +BASE EQU 100H ; Start of CP/M normal program area +FCB EQU 005CH ; System FCB +; +BDOS EQU 0005H ; BDOS function dispatch vector +; +;======================================================================= +; +; Jump table: The jump table must be in exactly the same sequence as the +; one in ZMD. +; + ORG 0580H ; ZMD I/O overlay address +; + JP CONOUT ; must be 00000h if not used, see below + JP MINIT ; initialization routine (if needed) + JP UNINIT ; undo whatever 'MINIT' did (or return) +JPTBL: + JP SENDR ; send character (via pop psw) + JP CAROK ; test for carrier + ;JP MDIN ; receive data byte (not present in ZMD) + JP GETCHR ; get character from modem + JP RCVRDY ; check receive ready + JP SNDRDY ; check send ready + JP SPEED ; get speed value for file transfer time + JP EXTRA1 ; extra for custom routine + JP EXTRA2 ; extra for custom routine + JP EXTRA3 ; extra for custom routine +; + ORG 0600H +; +; ZMD expects to find a byte with the baud rate code somewhere. For +; lack of a better location, we put it at 0600H. The highest baud +; rate code understood by ZMD is 9 which means 19200 baud. We just +; use that since we are almost certainly running faster than this. +; +BAUDCD DB 9 ; Baud rate storage +; +;----------------------------------------------------------------------- +; +; Output character to console +; +; This is intended to write file transfer progress to a RCPM +; BBS console. It is stubbed out because it will write to the +; active file transfer port when not using an RCPM. +; +CONOUT: + RET +; +;----------------------------------------------------------------------- +; +; Initialize modem +; +; This procedure has been usurped to dynamically detect the type +; of system we are running on and install the *real* jump table +; entries as appropriate. +; +MINIT: +; +; Scan the command line for a number. If found, this is used +; as the HBIOS unit number. +; + LD HL,FCB+1 ; Start after drive byte + LD B,8 ; Check 8 characters +MINIT1: + LD A,(HL) ; Get character + CP '0' ; Start of numerics + JR C,MINIT2 ; If below '0', continue scan + CP '9' ; Last numeric + JR NC,MINIT2 ; If above '9', continue scan + SUB '0' ; Got it, convert to binary + LD (UNIT),A ; Save it + LD A,' ' ; Space character to accum + LD (HL),A ; Remove numberic from FCB + JR MINIT3 ; Proceed with initialization + +MINIT2: + INC HL + DJNZ MINIT1 + +MINIT3: + ; Announce + LD DE,TAG ; Tagline + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Identify BIOS (RomWBW HBIOS or UNA UBIOS) + CALL IDBIO ; 1=HBIOS, 2=UBIOS + LD (BIOID),A ; Save it + DEC A ; Test for HBIOS + JR Z,MINIT_HB ; Do HBIOS setup + DEC A ; Test for UBIOS + JR Z,MINIT_UB ; Do UBIOS setup +; + ; Neither UNA nor RomWBW + LD DE,ERR_BIO ; BIOS error message + JP FAIL ; Print msg and bail out +; +MINIT_HB: + ; Display RomWBW notification string + LD DE,HB_TAG ; BIOS notification string + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Get CPU speed from RomWBW HBIOS and save it + LD B,0F8H ; HBIOS SYSGET function 0xF8 + LD C,0F0H ; CPUINFO subfunction 0xF0 + RST 08 ; Do it, L := CPU speed in MHz + LD A,L ; Move it to A + LD (CPUSPD),A ; Save it +; + ; Get HBIOS bank id + LD BC,0F8F2H ; HBIOS SYSGET, Bank Info + RST 08 ; do it + JP NZ,APIERR ; handle API error + LD A,D ; BIOS bank id to A + LD (BIOSBID),A ; save it +; + LD A,(UNIT) ; get current unit specified + CP 0FFH ; check for undefined + JR NZ,MINIT_HB1 ; if not undefined, go ahead +; + ; Lookup current console to use as default for transfer + LD B,0FAH ; HBIOS PEEK + LD A,(BIOSBID) ; get BIOS bank id + LD D,A ; ... and put in D + LD HL,100H + 12H ; HCB console unit address + RST 08 ; E := value + LD A,E ; put in A + LD (UNIT),A ; replace UNIT with console UNIT +; +MINIT_HB1: + ; Get HBIOS device type + LD B,06H ; HBIOS DEVICE function 0x06 + LD A,(UNIT) ; Get xfer unit + LD C,A ; Put in C + RST 08 ; Do it, D=device type + LD A,D ; Put result in A + CP 00H ; UART? + JP Z,MINIT_HB2 ; If so, do UART H/W init + CP 80H ; USB-FIFO? + JP Z,UF_INIT ; If so, do USB-FIFO H/W init + JP HB_INIT ; Otherwise, use BIOS I/O +; +MINIT_HB2: + ; Handle UART driver special. If receive interrupts active, + ; we must use BIOS I/O. Otherwise, direct UART I/O is best + LD B,06H ; Serial device function + LD A,(UNIT) ; Get xfer unit + LD C,A ; Put in C + RST 08 ; Do it, H = UART TYPE + BIT 7,H ; Check for interrupt driven receive + JP Z,UA_INIT ; If not, do direct UART I/O + JP HB_INIT ; else use BIOS I/O +; +MINIT_UB: + ; Display UNA notification string + LD DE,UB_TAG ; BIOS notification string + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Get CPU speed from UNA and save it + LD C,0F8H ; UNA BIOS Get PHI function + RST 08 ; Returns speed in Hz in DE:HL + LD B,4 ; Divide MHz in DE:HL by 100000H +MINIT_UB1: + SRL D ; ... to get approx CPU speed in + RR E ; ...MHz. Throw away HL, and + DJNZ MINIT_UB1 ; ...right shift DE by 4. + INC E ; Fix up for value truncation + LD A,E ; Put in A + LD (CPUSPD),A ; Save it +; + JP UB_INIT ; UNA BIOS init +; +MINIT_RET: + PUSH HL ; Save HL (JP table adr) + + ; Display handler label + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Display port (unit number) + LD DE,COM_LBL ; Prefix + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + LD A,(UNIT) ; Get unit number + ADD A,'0' ; Make displayable + LD E,A ; Put in E for display + LD C,2 ; BDOS console write char + CALL BDOS ; Do it +; + ; Newline + LD C,9 ; BDOS string display function + LD DE,CRLF ; Newline + CALL BDOS ; Do it +; + ; Copy real vectors into active jump table + POP HL ; Recover HL + LD DE,JPTBL ; Real jump table is destination + LD BC,7 * 3 ; Copy 7 3-byte entries + LDIR ; Do the copy +; + ; Return with CPU speed in A + LD A,(CPUSPD) ; A := CPU speed in MHz + LD HL,(RCVSCL) ; HL := receive scalar + RET ; and return +; +;----------------------------------------------------------------------- +; +; Uninitialize modem +; +UNINIT: + LD A,(BIOID) + CP 1 ; Is HBIOS? + JR Z,HUNINIT ; Handle HBIOS + CP 2 ; Is UBIOS? + JR Z,UUNINIT ; Handle UBIOS + RET ; Just return +; +HUNINIT: + ; HBIOS: Reset character device 0 + LD B,04H ; HBIOS CIOINIT function 0x04 + LD A,(UNIT) ; HBIOS serial unit number + LD C,A ; Put in C for func call + LD DE,-1 ; Reset w/ current settings + RST 08 ; Do it + RET ; not initialized, so no 'UN-INITIALIZE' +; +UUNINIT: + ; UBIOS: Reset character device 0 + LD C,10H ; UNA INIT function 0x10 + LD A,(UNIT) ; UBIOS serial unit number + LD B,A ; Put in B for func call + LD DE,-1 ; Reset w/ current settings + RST 08 ; Do it + RET ; not initialized, so no 'UN-INITIALIZE' +; +; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 +; +IDBIO: +; + ; Check for UNA (UBIOS) + LD A,(0FFFDH) ; fixed location of UNA API vector + CP 0C3H ; jp instruction? + JR NZ,IDBIO1 ; if not, not UNA + LD HL,(0FFFEH) ; get jp address + LD A,(HL) ; get byte at target address + CP 0FDH ; first byte of UNA push ix instruction + JR NZ,IDBIO1 ; if not, not UNA + INC HL ; point to next byte + LD A,(HL) ; get next byte + CP 0E5H ; second byte of UNA push ix instruction + JR NZ,IDBIO1 ; if not, not UNA, check others + LD A,2 ; UNA BIOS id = 2 + RET ; and done +; +IDBIO1: + ; Check for RomWBW (HBIOS) + LD HL,(0FFFEH) ; HL := HBIOS ident location + LD A,'W' ; First byte of ident + CP (HL) ; Compare + JR NZ,IDBIO2 ; Not HBIOS + INC HL ; Next byte of ident + LD A,~'W' ; Second byte of ident + CP (HL) ; Compare + JR NZ,IDBIO2 ; Not HBIOS + LD A,1 ; HBIOS BIOS id = 1 + RET ; and done +; +IDBIO2: + ; No idea what this is + XOR A ; Setup return value of 0 + RET ; and done +; +HWERR: + ; Failed to identify target comm hardware + LD DE,ERR_HW ; Hardware error message + JP FAIL ; Print message and bail out +; +APIERR: + ; API returned unepected failure + LD DE,ERR_API ; API error message + JP FAIL ; Pprint message and bail out +; +FAIL: + ; DE has error string address + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + JP 0 ; Bail out! +; +;----------------------------------------------------------------------- +; +; The following are all dummy routines that are unused because MINIT +; dynamically installs the real jump table. +; +SENDR: +CAROK: +MDIN: +GETCHR: +RCVRDY: +SNDRDY: +SPEED: +EXTRA1: +EXTRA2: +EXTRA3: + RET +; +BIOID DB 0 ; BIOS ID, 1=HBIOS, 2=UBIOS +CPUSPD DB 10 ; CPU speed in MHz +RCVSCL DW 6600 ; RECV loop timeout scalar +UNIT DB 0FFH ; BIOS serial device unit number +BIOSBID DB 00H ; BIOS bank id +; +TAG DB "RomWBW, 30-May-2020$" +; +HB_LBL DB ", HBIOS FastPath$" +UB_LBL DB ", UNA UBIOS$" +UA_LBL DB ", UART$" +UF_LBL DB ", USB-FIFO$" +COM_LBL DB " on COM$" +; +UB_TAG DB " [UNA]$" +HB_TAG DB " [WBW]$" +; +CRLF DB 13, 10, "$" +; +ERR_BIO DB 13, 10, 13, 10, "++ Unknown BIOS ++", 13, 10, "$" +ERR_HW DB 13, 10, 13, 10, "++ Unknown Hardware ++", 13, 10, "$" +ERR_API DB 13, 10, 13, 10, "++ BIOS API Error ++", 13, 10, "$" +; +;======================================================================= +;======================================================================= +; +; RomWBW HBIOS Interface +; +;======================================================================= +;======================================================================= +; +; Following jump table is dynamically patched over initial jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +HB_JPTBL: + JP HB_SENDR ; send character (via pop psw) + JP HB_CAROK ; test for carrier + ;JP HB_MDIN ; receive data byte (not present in ZMD) + JP HB_GETCHR ; get character from modem + JP HB_RCVRDY ; check receive ready + JP HB_SNDRDY ; check send ready + JP HB_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; HBIOS initialization +; +HB_INIT: + LD HL,2150 ; Smaller receive loop timeout scalar + LD (RCVSCL),HL ; ... to compensate for BIOS overhead +; + ; Patch SENDR w/ FastPath addresses + LD BC,0F801H ; Get CIO func/data adr + LD D,01H ; Func=CIO OUT + LD A,(UNIT) ; get desired char unit + LD E,A ; and put in E + RST 08 + JP NZ,APIERR ; handle API error + LD (HB_UDAT),DE ; Plug in data adr + LD (HB_SCFN),HL ; Plug in func adr +; + ; Patch GETCHR/MDIN w/ FastPath addresses + LD BC,0F801H ; Get CIO func/data adr + LD D,00H ; Func=CIO IN + LD A,(UNIT) ; get desired char unit + LD E,A ; and put in E + RST 08 + JP NZ,APIERR ; handle API error + LD (HB_GCFN),HL ; Plug in func adr +; + ; Patch RCVRDY w/ FastPath addresses + LD BC,0F801H ; Get CIO func/data adr + LD D,02H ; Func=CIO IST + LD A,(UNIT) ; get desired char unit + LD E,A ; and put in E + RST 08 + JP NZ,APIERR ; handle API error + LD (HB_RRFN),HL ; Plug in func adr +; + ; Patch SNDRDY w/ FastPath addresses + LD BC,0F801H ; Get CIO func/data adr + LD D,03H ; Func=CIO OST + LD A,(UNIT) ; get desired char unit + LD E,A ; and put in E + RST 08 + JP NZ,APIERR ; handle API error + LD (HB_SRFN),HL ; Plug in func adr +; + ; Claim 1 MHz CPU to offset overhead of HBIOS + LD A,1 + LD (CPUSPD),A ; Save it +; + LD HL,HB_JPTBL + LD DE,HB_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +HB_SENDR: + POP AF ; get character to send from stack + PUSH BC + PUSH DE + PUSH HL + LD E,A ; character to E + LD IY,(HB_UDAT) + LD A,(BIOSBID) ; call into HBIOS bank + LD IX,0000H +HB_SCFN EQU $-2 + CALL 0FFF9H ; HBIOS bank call + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +HB_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character +; +; GETCHR must not block +; +HB_GETCHR: + CALL HB_RCVRDY + RET NZ + ; Fall thru if char ready +; +; MDIN can assume a character is ready +; +HB_MDIN: + PUSH BC + PUSH DE + PUSH HL + LD IY,(HB_UDAT) + LD A,(BIOSBID) ; call into HBIOS bank + LD IX,0000H +HB_GCFN EQU $-2 + CALL 0FFF9H ; HBIOS bank call + LD A,E ; byte received to A + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +HB_RCVRDY: + PUSH BC + PUSH DE + PUSH HL + LD IY,(HB_UDAT) + LD A,(BIOSBID) ; call into HBIOS bank + LD IX,0000H +HB_RRFN EQU $-2 + CALL 0FFF9H ; HBIOS bank call + SUB 1 ; CF set IFF zero + RL A ; CF to bit 0 of A + AND 01H ; set Z flag as needed + LD A,0 ; report no line errors + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +HB_SNDRDY: + PUSH BC + PUSH DE + PUSH HL + LD IY,(HB_UDAT) + LD A,(BIOSBID) ; call into HBIOS bank + LD IX,0000H +HB_SRFN EQU $-2 + CALL 0FFF9H ; HBIOS bank call + SUB 1 ; CF set IFF zero + RL A ; CF to bit 0 of A + AND 01H ; set Z flag as needed + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +HB_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; +; +; +HB_UDAT DW 0000H ; Unit data address +; +; +;======================================================================= +;======================================================================= +; +; UNA UBIOS Interface +; +;======================================================================= +;======================================================================= +; +; Following jump table is dynamically patched over initial jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +UB_JPTBL: + JP UB_SENDR ; send character (via pop psw) + JP UB_CAROK ; test for carrier + ;JP UB_MDIN ; receive data byte (not present in ZMD) + JP UB_GETCHR ; get character from modem + JP UB_RCVRDY ; check receive ready + JP UB_SNDRDY ; check send ready + JP UB_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; UBIOS initialization +; +UB_INIT: +; +; TODO: +; - TEST!!! +; - ADJUST RCVSCL? +; + LD HL,3000 ; Smaller receive loop timeout scalar + LD (RCVSCL),HL ; ... to compensate for BIOS overhead +; + ; Claim 1 MHz CPU to offset overhead of HBIOS + LD A,1 + LD (CPUSPD),A ; Save it +; + LD HL,UB_JPTBL + LD DE,UB_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +UB_SENDR: + POP AF ; get character to send from stack + PUSH BC + PUSH DE + PUSH HL + LD BC,0012H ; unit 0, func 12h (write char) + LD E,A ; character to E + RST 08 + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +UB_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character +; +; GETCHR must not block +; +UB_GETCHR: + CALL UB_RCVRDY + RET NZ + ; Fall thru if char ready +; +; MDIN can assume a character is ready +; +UB_MDIN: + PUSH BC + PUSH DE + PUSH HL + LD BC,0011H ; unit 0, func 12h (write char) + RST 08 + LD A,E ; byte received to A + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +UB_RCVRDY: + PUSH BC + PUSH DE + PUSH HL + LD BC,0013H ; unit 0, func 13h (input stat) + RST 08 + XOR A ; zero accum ; 4 + CP E ; CF means not zero ; 4 + CCF ; CF means zero ; 4 + RLA ; ZF means not zero ; 4 + LD A,0 ; report no line errors + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +UB_SNDRDY: + PUSH BC + PUSH DE + PUSH HL + LD BC,0014H ; unit 0, func 14h (output stat) + RST 08 + XOR A ; zero accum ; 4 + CP E ; CF means not zero ; 4 + CCF ; CF means zero ; 4 + RLA ; ZF means not zero ; 4 + POP HL + POP DE + POP BC + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +UB_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; +;======================================================================= +;======================================================================= +; +; 8250-like UART +; +;======================================================================= +;======================================================================= +; +; UART constants +; +UA_SNDB EQU 20H ; bit to test for send ready +UA_SNDR EQU 20H ; value when ready to send +UA_RCVB EQU 01H ; bit to test for receive ready +UA_RCVR EQU 01H ; value when ready to receive +UA_PARE EQU 04H ; bit for parity error +UA_OVRE EQU 02H ; bit for overrun error +UA_FRME EQU 08H ; bit for framing error +UA_ERRS EQU UA_FRME | UA_OVRE | UA_PARE +; +; Following jump table is dynamically patched into real jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +UA_JPTBL: + JP UA_SENDR ; send character (via pop psw) + JP UA_CAROK ; test for carrier + ;JP UA_MDIN ; receive data byte (not present in ZMD) + JP UA_GETCHR ; get character from modem + JP UA_RCVRDY ; check receive ready + JP UA_SNDRDY ; check send ready + JP UA_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; UART initialization +; +UA_INIT: + LD DE,13000 ; receive loop timeout scalar + LD (RCVSCL),DE ; ... for UART RCVRDY timing +; + LD A,L ; get base I/O port address + LD (UA_SCP),A ; set port value in SENDR + LD (UA_GCP),A ; set port value in GETCHR + ADD A,5 ; UART control port is 5 higher + LD (UA_RRP),A ; set port value in RCVRDY + LD (UA_SRP),A ; set port value in SNDRDY +; + LD HL,UA_JPTBL + LD DE,UA_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +UA_SENDR: + POP AF ; get character to send from stack + OUT (0FFH),A ; send to port +UA_SCP EQU $-1 ; port value + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +UA_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character +; +; GETCHR must not block +; +UA_GETCHR: + CALL UA_RCVRDY + RET NZ + ; Fall thru if char ready +; +; MDIN can assume a character is ready +; +UA_MDIN: + IN A,(0FFH) ; read character from port +UA_GCP EQU $-1 ; port value + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +UA_RCVRDY: + IN A,(0FFH) ; get modem status +UA_RRP EQU $-1 ; port value + AND UA_RCVB ; isolate ready bit + CP UA_RCVR ; test it (set flags) + LD A,0 ; report no line errors +; + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +UA_SNDRDY: + IN A,(0FFH) ; get status +UA_SRP EQU $-1 ; port value + AND UA_SNDB ; isolate transmit ready bit + CP UA_SNDR ; test for ready value + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +UA_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; +; +; +UA_BASE DB 00H ; UART base port I/O address +UA_CTLP DB 00H ; UART control port I/O address +; +; +;======================================================================= +;======================================================================= +; +; WILL SOWERBUTTS ECB USB-FIFO +; +;======================================================================= +;======================================================================= +; +UF_BASE EQU 0CH +UF_DATA EQU (UF_BASE+0) +UF_STATUS EQU (UF_BASE+1) +UF_SEND_IMM EQU (UF_BASE+2) +; +; Following jump table is dynamically patched over initial jump +; table at program startup. See MINIT above. Note that only a +; subset of the jump table is overlaid (SENDR to SPEED). +; +UF_JPTBL: + JP UF_SENDR ; send character (via pop psw) + JP UF_CAROK ; test for carrier + ;JP UF_MDIN ; receive data byte (not present in ZMD) + JP UF_GETCHR ; get character from modem + JP UF_RCVRDY ; check receive ready + JP UF_SNDRDY ; check send ready + JP UF_SPEED ; get speed value for file transfer time +; +;----------------------------------------------------------------------- +; +; USB-FIFO initialization +; +UF_INIT: + LD DE,12000 ; receive loop timeout scalar + LD (RCVSCL),DE ; ... for UART RCVRDY timing +; + LD A,L ; get base I/O port address (data port) + LD (UF_SCDP),A ; set data port in SENDR + LD (UF_GCDP),A ; set data port in GETCHR/MDIN + INC A ; bump to status port + LD (UF_RRSP),A ; set status port in RCVRDY + LD (UF_SRSP),A ; set status port in SNDRDY + INC A ; bump to send immediate port + LD (UF_SCIP),A ; set send immed port in SENDR +; + LD HL,UF_JPTBL + LD DE,UF_LBL + JP MINIT_RET +; +;----------------------------------------------------------------------- +; +; Send character on top of stack +; +UF_SENDR: + + POP AF ; get character to send from stack + OUT (0FFH),A ; write to fifo +UF_SCDP EQU $-1 ; data port + OUT (0FFH),A ; send immediate +UF_SCIP EQU $-1 ; send immediate port + RET +; +;----------------------------------------------------------------------- +; +; Test and report carrier status, Z set if carrier present +; +UF_CAROK: + XOR A ; not used, always indicate present + RET +; +;----------------------------------------------------------------------- +; +; Get a character (assume character ready has already been tested) +; +; GETCHR must not block +; +UF_GETCHR: + CALL UF_RCVRDY ; check for char ready + RET NZ ; return if not + ; Fall thru if char ready +; +; MDIN can assume a character is ready +; +UF_MDIN: + IN A,(0FFH) ; get char +UF_GCDP EQU $-1 ; data port + RET +; +;----------------------------------------------------------------------- +; +; Test for character ready to receive, Z = ready +; Error code returned in A register +; *** Error code does not seem to be used *** +; +UF_RCVRDY: + IN A,(0FFH) ; bit 7 = 0 if char avail, = 1 if no char. +UF_RRSP EQU $-1 ; status port + RLCA ; bit 0 = 0 if char avail, = 1 if no char. + AND 00000001B ; A = 0, ZF = 1 if no char, A = 1, ZF = 0 if char avail. + LD A,0 ; no errors + RET +; +;----------------------------------------------------------------------- +; +; Test for ready to send a character, Z = ready +; +UF_SNDRDY: + IN A,(0FFH) ; bit 0 = 0 if space avail, = 1 if full +UF_SRSP EQU $-1 ; status port + AND 00000001B ; A = 0, ZF = 1 if space avail, A = 1, ZF = 0 if full. + RET +; +;----------------------------------------------------------------------- +; +; Report baud rate (index into SPTBL returned in register A) +; +UF_SPEED: + LD A,8 ; arbitrarily return 9600 baud + RET +; + END diff --git a/Source/Apps/ZMD/zmdhdr.z80 b/Source/Apps/ZMD/zmdhdr.z80 new file mode 100644 index 00000000..f5c96da5 --- /dev/null +++ b/Source/Apps/ZMD/zmdhdr.z80 @@ -0,0 +1,637 @@ +; + + TITLE ZMDHDR.Z80 - 09/29/88 - ZMD Configuration Header +; Copyrighted (c) 1987, 1988 +; Robert W. Kramer III + + PAGE +;- -; +; Update History ; +; ; +; Date Release Comments ; +; -------- ------- ---------------------------------------------- ; +; ; +; 09/29/88 v1.50 - Changed file descriptor table. (Sorry, but as ; +; many times as I am required to reassemble the ; +; ZMD system, it saves alot of time for me). ; +; 03/18/88 v1.49 - No change(s) were made to this file ; +; 03/13/88 v1.48 - Added STDBUF switch to enable/disable automatic ; +; calculation of memory available for DBUF. If ; +; enabled, CHKTPA will set OUTSIZ with an even ; +; paged maximum memory comparison word according ; +; to the address contained at location 6 and 7. ; +; The value set as end of program during assembly ; +; is subtracted from it. If BYE is NOT running, ; +; an additional 806H is subtracted. The LSB of ; +; the result is discarded and the new even paged ; +; value is stored for later comparison as maximum ; +; Read/Write memory available for disk buffer ; +; operations. ; +; ; +; * * SPECIAL NOTE * * MOST ALL systems will benefit by enabling this ; +; feature. Some special CP/M systems which place ; +; buffers below location (6 and 7), may need to ; +; disable this feature in which case DBUF size ; +; will be set to 16k. This fix consumed 1 more ; +; byte in the switch/value table below. Previous ; +; configuration headers are incompatible with this; +; release. Additional program code is 9 bytes. ; +; (See explaination at STDBUF:) ; +; ; +; 02/25/88 v1.47 - No change(s) made to configuration file ; +; 01/27/88 v1.46 - No change(s) made to configuration file ; +; 01/17/88 v1.45 - First public release ; +; 11/19/87 v1.00 - Initial version ; +;- -; + +;-------------------------------------------------------------------------; +; Introduction | +;-------------------------------------------------------------------------; +; +; This document is a detailed listing of all the program option toggles +; and their functions within the ZMD environment which when used in +; conjunction with the source listings, install program and reference +; manual, provide all the necessary documentation to support program +; maintenance. + +; +;-------------------------------------------------------------------------; +; EQUates Header | +;-------------------------------------------------------------------------; + + + INCLUDE EQUATES.INS ; Include system constant definitions + +; +;-------------------------------------------------------------------------; +; PUBLIC Declarations: | +;-------------------------------------------------------------------------; + + + PUBLIC ACCMAP,ASKAREA,ASKIND,CLRSCRN,CLRSTR,DESWAIT,DRV + PUBLIC LOCOFF,MHZ,MINKSPD,MSPEED,PAGLEN,PRDRV,PRUSR,USR,WHEEL + PUBLIC WRAP,WRTLOC,CONOUT,MDINST,MDINP,MDOUTST,MDCARCK,MDOUTP + PUBLIC KNDTBL,TYPTBL,MAXTYP,DESCRIB,FORNAM,MSGDESC,DSTAMP + PUBLIC INCLDU,UNINIT,DRIVE,USER,LOGNAM,SETAREA,CLOCK,RTC + PUBLIC TIMEON,CREDIT,EDATE,DSPTOS,STDBUF + +; +;-------------------------------------------------------------------------; +; EXTERNAL Declarations: | +;-------------------------------------------------------------------------; + + + EXTRN MONTH,DAY,YEAR,HOUR,MINUTE,DEST,FILE,ZMDNAM,INSNAM + EXTRN MAPNAM,PRGUTL,PUBFOR,PUBNEW,SYSFOR,PUBFOR,INSNAM + EXTRN SYSNEW,FCBCLR,FCBLOG,TEMPFIL,BCDBIN,TIMBUF,DUD,DUU + +; +;-------------------------------------------------------------------------; +; Program configuration starts here | +;-------------------------------------------------------------------------; +; +; Options that are most often changed are marked with ';*' at the start of +; the comment line for that option. Simple systems not using time clocks, +; user logs, etc. will keep most of those 'NO'. RCPM systems running the +; usual bulletin board systems, etc., will change most of those to 'YES'. +; +MHZ: DB 10 ; Microprocessor speed - use integer 1,4,5, etc. +;MSPEED: DW 003CH ; Location of modem speed indicator byte +MSPEED: DW 0600H ; Location of modem speed indicator byte + ; [WBW] placed in I/O overlay + +WRTLOC: DB NO ; Set/reset WRTLOC so BYE won't hang up. Check +LOCOFF: DB 12 ; your BBS documentation - many modern systems + ; don't need WRTLOC. If unsure, set WRTLOC to NO. + ; Code to set and reset WRTLOC assumes the WRTLOC + ; byte to be located "LOCOFF" bytes from the JP + ; COLDBOOT instruction at the beginning of the BYE + ; BIOS jump table. (YES for MBBS and PBBS). + +STDBUF: DB NO ; If the size of your TPA cannot be calculated by + ; using one of the two following methods, disable + ; this by setting to NO. ZMD will Automatically + ; calculate the maximum disk buffer size allowed. If + ; enabled, CHKTPA will determine whether or not + ; BYE is running, if so uses (0006)-1. Else + ; subtracts 806H from (0006). If disabled, DBUF + ; setting will be used as default (Normally set to + ; 16k). Either way, if descriptions are allowed, + ; the total number of uploads allowed is set based + ; on the value of OUTSIZ divided by maximum bytes + ; per description entry. + +DESWAIT:DB 2 ; This is the number of minutes of inactivity during + ; an upload description or Help Guide prompt before + ; logging aborting the input routine. If the + ; caller was entering a description, the current + ; description buffer is written to disk before + ; resetting your BYE program's disk write lock flag + ; (WRTLOC), if enabled. + +MINKSPD:DB 1 ; Minimum speed acceptable for 1k packet file + ; transfers. If you are on a network such as PC + ; Pursuit, and are able to RECEIVE incoming calls, + ; set this byte to 1. The delays these networks + ; use to send data back and forth make 1k packets + ; advantageous to even 300 bps users. If you are + ; not on a network such as PC Pursuit, it's simply + ; a matter of preference, but why not let the 300 + ; bps callers experience the 1k packet transfers? + ; (1 = 300, 5 = 1200, 6 = 2400, ..., 9 = 19,200) + +BUFSIZ: DB 16 ; Normal disk systems can transfer 16k from + ; computer to disk in 2-3-4 seconds and less. Some + ; very slow 5-1/4" floppy systems (such as North + ; Star) may take up to 20-30 seconds to transfer + ; 16k. This would cause several timeouts at 10 + ; seconds each. If you experience any timeouts, + ; try changing BUFSIZ to something smaller, perhaps + ; 8k or even 4k. + +CLRSCRN:DB NO ; Yes, you want ZMD to clear your screen locally +CLRSTR: DB 1AH,00H ; during display of batch file transfers and all + DB 00H,00H ; the help menus. If you set CLRSCRN to YES, enter + DB 00H,00H ; your clear screen sequence in the 6 bytes aside. + DB '$' ; (If your terminal uses ^Z, leave as is, 1AH = ^Z) + +PAGLEN: DB 24 ; This is the number of lines to display in between + ; [more] pauses. (Set to 0 to disable pauses). + +; +;-------------------------------------------------------------------------; +; Timekeeping Considerations | +;-------------------------------------------------------------------------; +; +; If you have a clock installed (either in your BYE program or internal), +; set the following switches to your liking. If running ZMD without a +; clock, set these all NO. +; +CLOCK: DB NO ; Clock/date reader code installed in BYE program +RTC: DB NO ; Clock/date reader code installed at RTCTIM: + +TIMEON: DB NO ; Restrict downloads to maximum time allowed +MAXMIN: DB 60 ; Total minutes allowed for downloads. This should + ; be set if TIMEON is YES and CLOCK is NO. +DSPTOS: DB NO ; Yes to display 'Online nn minutes' messages +LHOUR: DW 0000H ; Logon hour address (If RTC). LHOUR+2 = logon + ; minute address. + +; +;-------------------------------------------------------------------------; +; Bit Map Layout | +;-------------------------------------------------------------------------; +; +; The following byte contains information corresponding to the filename +; bytes of the file being considered for transfer. Enabling any of the +; options causes ZMD to look at the high bit of the byte position +; indicated below (F1=filename byte 1, T2=file type byte 2, etc). These +; restrictions are always bypassed when using ZCPR and the WHEEL is set. +; +; Bit: 76543210 ; Correspond to definitions below +; |||||||| +ACCMAP: DB 11111101B ; Set any bits of this byte according +; __________\______/ ; to your own preference. +; / +; +; 7 | F1 | File not for distribution. If file is a ARK/ARC/LBR +; | | file, individual members may be downloaded (no Batch) +; 6 | F3 | File can be downloaded regardless of user's access +; 5 | T2 | $SYS files not sent or reported +; 4 | T3 | .??# files with labels not sent +; 3 | T1/2/3 | .COM files not sent or reported +; 2 | T1/2/3 | Rename .COM to .OBJ and .PRL to .OBP on receive +; 1 | -- | RESERVED FOR FUTURE USE +; 0 | T1/2/3 | .SYS, .NDR, .RCP, file extents not accepted. (ZCPR) + +; +;-------------------------------------------------------------------------; +; ZCMD/ZCPR | +;-------------------------------------------------------------------------; +; +; If using ZCPR low memory bytes to keep track of maximum drive and user, +; set USEMAX to yes. ZMD will use the values at locations DRIVMAX and +; USRMAX for maximum drive/user. If USEMAX is NO, hardcode MAXDRV and +; MAXUSR to your own requirements. +; +WHEEL: DW 3EH ; Location of ZCPR wheel byte +USEMAX: DB NO ;*Use values at DRIVMAX and USRMAX for maximum + ; (Else use MAXDRV and MAXUSR values) +DRIVMAX:DW 3DH ; ZCPR maximum drive memory byte +USRMAX: DW 3FH ; ZCPR maximum user memory byte +MAXDRV: DB 16 ; Maximum download drive allowed +MAXUSR: DB 16 ; Maximum download user allowed + +; +;-------------------------------------------------------------------------; +; Access Restrictions | +;-------------------------------------------------------------------------; +; +; If ACCESS is YES, ZMD will inspect AFBYTE (located ACBOFF bytes from JP +; COLDBOOT) for the following flag data: +; +; +; Bit: 7 6 5 4 3 2 1 0 +; | | | | | | | | +; Privileged user ---* | | | | | | | +; Upload -----* | | | | | | +; Download -------* | | | | | * Of these bits, only 3, 5, 6 +; CP/M ---------+ | | | | and 7 are used by ZMD. Bit +; Write -----------* | | | numbers are powers of 2, with +; Read -------------+ | | bit 0 being least significant +; BBS ---------------+ | bit of byte. +; System -----------------+ +; +; +ACCESS: DB NO ;*Yes, your system sets BYE's bit-mapped flag + ; register to restrict user's ability to upload, + ; download, use the 'RM' option to upload message + ; files to your BBS's message base, or to use the + ; 'RW' option for 'privileged user' upload without + ; being required to give upload descriptions. + +ACBOFF: DB 21 ; If you set ACCESS to YES, you 'might' need to + ; set this to reflect the number of bytes from JP + ; COLDBOOT to ACCESS byte. In most cases, leave + ; alone. + +; +;-------------------------------------------------------------------------; +; Upload Configurations | +;-------------------------------------------------------------------------; +; +MSGFIL: DB NO ; Some BBS's allow callers to upload preformatted + ; text files which are appended to the message + ; base. (MBBS and PBBS are examples of this). If + ; you're running MBBS or PBBS and wish to support + ; this, simply set MSGFIL to YES. Message file + ; uploads go to PRDRV and PRUSR. + +HIDEIT: DB NO ; Yes, make all normal uploads $SYS files. This + ; way, new uploads will not appear in a DIRectory + ; listing and cannot be viewed or even downloaded + ; until they are cleared by SYSOP. (New uploads + ; will show up when the WHEEL byte is ON and a $S + ; option is used to show SYSTEM files. Use the $O + ; option to list ONLY $SYS files. Reference will + ; be made to these files in the in the NEW and FOR + ; listings if those features are enabled). Private + ; uploads, and uploads made with the WHEEL byte + ; set are NOT made $SYS. You can use POWER or + ; NSWEEP to set to $DIR. + +; +;-------------------------------------------------------------------------; +; Upload Routing Options | +;-------------------------------------------------------------------------; +; +; The following equates determine what drive/user area uploads will be sent +; to. If you prefer to enable upload routing (ASKAREA set YES), you will +; have to set MAXTYP to the letter of the highest category you wish to +; support, and configure TYPTBL: and KNDTBL: tables below for your own +; system. Do NOT set ASKAREA and SETAREA both to YES. +; +ASKAREA:DB NO ;*Yes, you want upload routing to multiple drive + ; and user areas. The caller will be asked what + ; the file (or files) he is uploading are for and + ; his uploads will then be forwarded to the + ; appropriate area. You will need to set up the + ; categories at KNDTBL: for your own system and + ; set the drive/user area each category belongs on + ; at label TYPTBL:. There can be up to 26 different + ; drive/user and category combinations. This applies + ; for both private and normal uploads. Upload + ; routing is disabled when the WHEEL byte is set, + ; in which case, normal uploads will go to the + ; current drive/user area and private uploads will + ; go to the drive/user equated at PRDRV and PRUSR. + +SETAREA:DB NO ;*Yes, you wish to have all regular uploads sent +DRV: DB 'B' ; to the drive/user equated at DRV and USR to left. +USR: DB 0 ; If WHEEL byte is set, regular uploads will go to + ; the current or specified drive/user. Unless you + ; ASKAREA is YES, all private files uploaded with + ; the 'RP' option will be sent to PRDRV and PRUSR + ; regardless of WHEEL status. + +PRDRV: DB 'H' ;*This is the drive/user area where ALL files sent +PRUSR: DB 15 ;*to the sysop with the 'RP' option will go (unless + ; ASKAREA below is YES). This permits experimental + ; files, replacement and/or proprietary programs to + ; be sent to an area only accessible by the sysop. + ; This is also the drive and user area where message + ; files are uploaded, if MSGFIL is set YES. (If + ; ASKAREA is YES, this is the drive/user where + ; uploads will go when 'RP' is specified, and WHEEL + ; is set). (If MSGDESC is YES, this is the drive + ; and user area the FOR text file will be placed + ; before appending it to the BBS system's message + ; base). + +CREDIT: DB NO ;*Yes, callers are given credit for the amount of + ; time they spend uploading non-private files. A + ; caller who spends 30 minutes sending an upload + ; gets 30 minutes added to his TLOS. (You must + ; set either CLOCK or TIMEON to YES to use this + ; feature). + +; +;-------------------------------------------------------------------------; +; Upload Description Options | +;-------------------------------------------------------------------------; +; +; This section has to do with upload descriptions. If you do not intend +; on implementing upload descriptions, set DESCRIB and MSGDESC to NO. The +; rest of these values are then ignored. If using descriptions, set ONLY +; one of these to YES, not both. +; +MSGDESC:DB NO ; Yes, your BBS system supports message uploads, + ; and you prefer upload descriptions to be placed + ; in your BBS message system (set DESCRIB NO). + ; MBBS users need to install MFMSG.COM with the + ; MBBSINIT program. Then set your BYE program to + ; know about message file uploads by setting the + ; MSGFIL option in BYE/MBYE to YES. If set YES, + ; ZMD will produce a FOR text file when writing + ; upload descriptions. This FOR file will go to + ; the drive and user area equated at PRDRV and + ; PRUSR just before being appended to your BBS + ; system's message base. + +DESCRIB:DB NO ;*Yes, requiring users to provide descriptions for + ; any files they upload. These descriptions will + ; be added to the current FOR file where they can + ; be viewed by callers with the ZFORP utility. + ; Sysop can add new descriptions with the ZFORS + ; utility (See ZMD.WS for more information on ZMD + ; support files). Uploads sent to the SYSOP private + ; upload area will not be require descriptions, nor + ; will files uploaded with the 'RW' option - user + ; must be a privileged user (bit 7 in ACCESS byte + ; set) or have WHEEL access and PUPOPT must be set + ; YES to use the 'RW' option. + +FORNAM: DB 'FOR ' ; Description text file (Must be 11 bytes) +DRIVE: DB 'A' ;*If using with DESCRIB set YES, you must indicate +USER: DB 14 ;*what drive/user you want the 'FOR' file to be + ; placed. + +; +; If DESCRIB above is set to YES, you'll have to tell ZMD what information +; you want included in the first line of each description. Code is included +; in ZMD to place all (any) information in the upload description header in +; in the same column position no matter what the filename or file category +; length is. The following illustrates a full implementation of DESCRIB. +; +; Example upload description header: +; +; ----- +; ZMD150.LBR - Communications (C3:) Rcvd: 09/21/88 +; / / / +; _______/ ______/ _______/ +; ASKIND INCLDU DSTAMP +; +; +ASKIND: DB NO ;*Yes, ask for the category of uploads and write it + ; into the upload description header. If you set + ; this to YES, make sure you set MAXTYP below to + ; the highest letter choice you wish to support and + ; edit the text at KNDTBL: up to and including your + ; MAXTYP setting. (Used only with DESCRIB). + +INCLDU: DB YES ;*Yes, include the drive/user area of the uploaded + ; file into the upload description header. + ; (Used only with DESCRIB). + +DSTAMP: DB YES ;*Yes, include the date the upload was received into + ; the upload description header. (NO if no clock) + ; (Used only with DESCRIB). + +PUPOPT: DB YES ;*Yes, description request of file upload will be + ; skipped when "RW" is used in the ZMD command line + ; (i.e. ZMD RW FILE.EXT). This command may only be + ; used by those considered "priviledged" users on + ; your system or WHEEL users. Uploads of this type + ; will be tagged in the ZMD.LOG file as private, so + ; as not to display with the NEW command. (See + ; ACCESS equate description above for information + ; on 'priviledged' users). + +WRAP: DB 64 ; Column position where word wrap will occur. If + ; you are using MSGDESC and have problems with an + ; 'Invalid format' error from MFMSG.COM, try setting + ; WRAP to something smaller, like 62 or 63. (Word + ; wrap can be disabled by the user with ^W during + ; description entry. Enter 72 here to disable + ; completely). + +; +;-------------------------------------------------------------------------; +; Special Sysop Downloads | +;-------------------------------------------------------------------------; +; +SPLDRV: DB 'H' ;*Drive/user area for downloading private files +SPLUSR: DB 14 ;*from sysop. This permits him to put a special + ; file in this area, then leave a private note + ; to that person mentioning the name of the file + ; and how to download it (ZMD SP filename.ext). + ; Although anybody 'could' download that program, + ; they don't know what (if any) files are there. + ; A high degree of security exists, while the + ; SYSOP still has the ability to make special + ; files available. Thus any person can be a + ; temporary 'privileged user'. + +; +;-------------------------------------------------------------------------; +; File Transfer Log | +;-------------------------------------------------------------------------; +; +LOGCAL: DB NO ;*ZMD.LOG is produced if LOGCAL is set YES. All + ; file transfers are logged. You can then use + ; ZNEWP.COM to show listings of recent uploads. +EDATE: DB NO ; Yes, show date in ZMD.LOG in dd/mm/yy format + ; instead of mm/dd/yy format. + +LOGNAM: DB 'ZMD LOG' ; File transfer log (Must be 11 bytes) +LOGDRV: DB 'A' ;*Drive to find ZMD.LOG on. +LOGUSR: DB 14 ;*User area to find ZMD.LOG on. + +LSTCLR: DB 'LASTCALR???' ; Last caller file (Must be 11 bytes) +LASTDRV:DB 'A' ;*Drive to find LASTCALR??? file on. +LASTUSR:DB 14 ;*User area to find LASTCALR??? file on. +LCNAME: DB 0 ;*Position of last caller's name in the LASTCALR??? + ; file. (MBBS is 11, PBBS is 0). + +LOGLDS: DB NO ;*Count number of up/down loads since login. Your +UPLDS: DW 0054H ; BBS program can check UPLDS and DNLDS when a user +DNLDS: DW 0055H ; logs out and update either the user's file or a + ; file for this purpose. You can either modify + ; your BBS entry program to check the LASTCALR file + ; before updating and then update (risky), or make + ; a separate program that BYE calls when logging off + ; a user (preferred). (YES for PBBS). Clear UPLDS + ; and DNLDS to 0 from your BBS program when somebody + ; logs in. NOTE: Clear ONLY when a user logs in, + ; not when he re-enters the BBS program from CP/M. + +; +;-------------------------------------------------------------------------; +; File Descriptors | +;-------------------------------------------------------------------------; +; +; This table defines the text to be included in upload description headers +; (DESCRIB and ASKIND) and/or defines categories for uploading to multiple +; drive/user areas (If ASKAREA and NOT SETAREA). Change as desired, if +; this list is not suitable. Do NOT remove any of the text at KNDTBL:. +; Simply edit the text below up to/and including your MAXTYP setting. +; MAXTYP below must be set to whatever letter your maximum choice will be. +; Make sure you leave all the following categories EXACTLY 31 bytes long +; (29 bytes of text plus the CR,LF equals 31) or you will be CERTAIN to +; have problems with the double column formatting later on in the program. +; +MAXTYP: DB 'W' ; Letter of highest category you will support. + +KNDTBL: DB ' A) - BBS Lists, PC Pursuit ',CR,LF + DB ' B) - CP/M Modem Program ',CR,LF + DB ' C) - CP/M Utility ',CR,LF + DB ' D) - CP/M Lbr, Ark, Catalog',CR,LF + DB ' E) - CP/M Plus Specific ',CR,LF + DB ' F) - CP/M Games & Humor ',CR,LF + DB ' G) - CP/M Wordprocessing ',CR,LF + DB ' H) - CP/M Printer Utility ',CR,LF + DB ' I) - CP/M OS Enhancement ',CR,LF + DB ' J) - CP/M BBS Software ',CR,LF + DB ' K) - CP/M Assemb/Disassemb ',CR,LF + DB ' L) - CP/M Language (Other) ',CR,LF + DB ' M) - Turbo Pascal ',CR,LF + DB ' N) - dBase & Database ',CR,LF + DB ' O) - "C" ',CR,LF + DB ' P) - Text & Information ',CR,LF + DB ' Q) - DOS Modem Program ',CR,LF + DB ' R) - DOS BBS Software ',CR,LF + DB ' S) - DOS Language ',CR,LF + DB ' T) - DOS Assemb/Disassemb ',CR,LF + DB ' U) - DOS Lbr, Arc, Catalog ',CR,LF + DB ' V) - DOS Wordprocessing ',CR,LF + DB ' W) - DOS Printer Utility ',CR,LF + DB ' X) - DOS Games & Humor ',CR,LF + DB ' Y) - DOS Application ',CR,LF + DB ' Z) - DOS Utility ',CR,LF + DB 0 ; leave the table terminator alone. + +; +;-------------------------------------------------------------------------; +; Upload Routing Table | +;-------------------------------------------------------------------------; +; +; If ASKAREA is set YES, then set these areas up to match the message text +; in KNDTBL: above. Note that PRIVATE uploads may be sent to a different +; drive as well as a different user area. Each entry is expressed as +; 'drive letter',user area. Simply set MAXTYP above to the highest +; letter choice supported. (Do NOT comment out any of the following +; storage bytes). +; +; _________ +; NOTE: / A \ <--- 'A' Corresponds to category 'A' above +; 'A',1,'B',15, +; \ / \ / +; Normal upload --+ | +; Private upload -------+ +; + +TYPTBL: +; _________ _________ _________ _________ +; / A \ / B \ / C \ / D \ + DB 'B',1,'F',15, 'B',0,'F',15, 'B',2,'F',15, 'B',4,'F',15 +; _________ _________ _________ _________ +; / E \ / F \ / G \ / H \ + DB 'B',5,'F',15, 'B',6,'F',15, 'C',0,'F',15, 'C',1,'F',15 +; _________ _________ _________ _________ +; / I \ / J \ / K \ / L \ + DB 'C',2,'F',15, 'C',3,'F',15, 'A',1,'F',15, 'A',5,'F',15 +; _________ _________ _________ _________ +; / M \ / N \ / O \ / P \ + DB 'A',2,'F',15, 'A',3,'F',15, 'A',4,'F',15, 'A',6,'F',15 +; _________ _________ _________ _________ +; / Q \ / R \ / S \ / T \ + DB 'E',0,'F',15, 'E',1,'F',15, 'E',2,'F',15, 'E',3,'F',15 +; _________ _________ _________ _________ +; / U \ / V \ / W \ / X \ + DB 'F',0,'F',15, 'F',1,'F',15, 'F',2,'F',15, 'F',3,'F',15 +; _________ _________ +; / Y \ / Z \ + DB 'G',0,'F',15, 'H',0,'F',15 + +; +;=========================================================================; +;>>>>>>>>>>>>>> DO NOT CHANGE ANYTHING BEYOND THIS POINT <<<<<<<<<<<<<<<| +;=========================================================================; +;-------------------------------------------------------------------------; +; Version Identification | +;-------------------------------------------------------------------------; +; +; If/when INSTALL is first ran, it checks these next 3 bytes to make sure +; it is installing the proper version of ZMD.COM. If these bytes do not +; match, the INSTALL procedure will abort. (Don't change this one) +; +INSVERS:DB '150' ; Don't change this one + +; +;-------------------------------------------------------------------------; +; User Definable Storage Bytes | +;-------------------------------------------------------------------------; +; +; If you make changes to the configuration table, make them here. You +; are allowed 2 bytes for switches, or storage for an address, etc. Any +; changes before this point and ZINSTL will not run. +; +SPARE1: DB 0 ; User definable storage +SPARE2: DB 0 + +; +;-------------------------------------------------------------------------; +; Clock/Date Reader Code | +;-------------------------------------------------------------------------; +; +; Install your clock/date reader code here. RTCTIM gets called to retrieve +; the current date and time. All values must be stored in binary form. +; A 6 byte clock buffer called TIMBUF can be used as a work area. Call +; BCDBIN to convert your BCD (Binary Coded Decimal) value in A to binary +; value in A. Delete all ';<=' lines; after installing your custom +; routine. +; + ORG 4FEH ; Allow 130 bytes for RTC insert +; +RTCTIM::LD A,0 ;<= Delete lines if reader code installed + LD (MONTH),A ;<= Current month (1-12) + LD (DAY),A ;<= Current date (1-31) + LD (YEAR),A ;<= Current year (0-99) + LD (MINUTE),A ;<= Current minute (0-59) + LD (HOUR),A ;<= Current hour (0-23) + RET + +; +;-------------------------------------------------------------------------; +; Input/Output Patch Area | +;-------------------------------------------------------------------------; + + ORG 580H ; Modem routine starts here + +CONOUT: JP 0000H ; BIOS local console output routine address +MINIT: JP 0000H ; Startup initialization routine +UNINIT: JP 0000H ; Exit uninitialize routine +MDOUTP: JP 0000H ; Send character out modem +MDCARCK:JP 0000H ; Test for carrier +MDINP: JP 0000H ; Get character from modem +MDINST: JP 0000H ; Check receive ready +MDOUTST:JP 0000H ; Check send ready + + ;ORG 600H ; Allow 128 bytes for I/O overlay + ORG 1000H ; Allow for large I/O overlay + + +; +; Overlay ends here +; + \ No newline at end of file diff --git a/Source/Apps/ZMD/zmdsubs.rel b/Source/Apps/ZMD/zmdsubs.rel new file mode 100644 index 00000000..20da9eb7 Binary files /dev/null and b/Source/Apps/ZMD/zmdsubs.rel differ diff --git a/Source/Apps/ZMD/znewp.z80 b/Source/Apps/ZMD/znewp.z80 new file mode 100644 index 00000000..56f8750f --- /dev/null +++ b/Source/Apps/ZMD/znewp.z80 @@ -0,0 +1,517 @@ +; + + TITLE ZNEWP.Z80 - 09/29/88 - ZMD Public Transfer Log Utility +; Copyrighted (c) 1987, 1988 +; Robert W. Kramer III + +;- -; +; Update History ; +; ; +; Date Release Comments ; +; -------- ------- ---------------------------------------------- ; +; ; +; 09/29/88 v1.50 - No change(s) made to this file ; +; 03/18/88 v1.49 - No change(s) made to this file ; +; 03/13/88 v1.48 - Redefined buffer table at end of programs. STACK; +; and filename buffers now EQUated with offsets ; +; from the last switch/toggle in program instead ; +; of with DS directive. ; +; - Some systems which do NOT have an interrupt ; +; driven keyboard may have noticed problems when ; +; an invalid key was entered in the ZNEWP, ZFORP ; +; and ZMDEL programs. In ZNEWP and ZFORP, if a ; +; CR was entered to pause the output, output was ; +; limited to one line at a time per key pressed. ; +; If an invalid key was hit, output would have ; +; remained in a paused state until one of the ; +; abort keys were pressed. This was difficult to ; +; find since my keyboard is interrupt driven and ; +; I could not duplicate the problem on my own ; +; system. ; +; 02/25/88 v1.47 - Fixed to determine if CLOCK is enabled before ; +; inserting spaces after 8 'date' positions. ; +; (Keeps caller name from being split with an ; +; extra space at column 52). ; +; 01/27/88 v1.46 - Now uses BDOS call 35 to calculate virtual size ; +; of log file (in records) which is returned in ; +; bytes 33 and 34 of log FCB. It then uses BDOS ; +; call 33 to compute the extent of the specified ; +; record number (bytes 33 and 34 of log FCB), ; +; decrements the record number for next random ; +; read and displays current record. This method ; +; of reading the log file allows for files up to ; +; 8,388,480 bytes in size to be displayed at an ; +; instant. ; +; 01/17/88 v1.45 - First public release ; +; 11/01/87 v1.00 - Initial version ; +;- -; + +;-------------------------------------------------------------------------; +; EXTERNAL Declarations: | +;-------------------------------------------------------------------------; + + + EXTRN CKABRT,CLEARIT,DBUF,ERXIT,EXIT,ILPRTB,LINCNT,MODE + EXTRN NOFILE,NOLOG,OLDDRV,OLDUSR,PRINTV,PRIVATE,RECAR1 + EXTRN RECDR1,RENFCB,RSDMA,SHONM4,STACK,TYPE,WHLCHK + +; +;-------------------------------------------------------------------------; +; Program Starts Here | +;-------------------------------------------------------------------------; + + + .Z80 + ASEG + ORG 100H ; Program starts + JP BEGIN ; Jump around configuration table + INCLUDE ZMDHDR.Z80 ; Include the ZMD header overlay + .REQUEST ZMDSUBS ; Include the ZMD subroutines + +; +; +; Save CP/M stack, initialize new one for this program +; +BEGIN: LD (STACK),SP ; Save return address to CCP + LD SP,STACK ; Initialize new one for this program + +; +; Get current drive/user +; + LD A,255 ; Get current user + CALL RECAR1 + LD (OLDUSR),A ; Store it + LD C,CURDRV ; Get current drive + CALL BDOS + LD (OLDDRV),A ; Store it + +; +; Tell em who we are +; + LD A,255 ; Need this so discrepency check will + LD (MODE),A ; Leave clock settings alone in case local + LD HL,PUBNEW ; Point to this filename + CALL PRINTV ; Display it + + LD A,(LOGCAL) ; See if log file enabled + OR A + JP Z,NOLOG ; Don't run program if not + + CALL ILPRTB + DB '(S to Pause - C K or X Abort)' + DB CR,LF,LF + DB 0 + + LD A,9 ; Leave program name on first screen + LD (LINCNT),A + +; +; If WHEEL byte set, check to see if 'A' specified in command tail. If +; it is, set switch to display entire transfer log +; + CALL WHLCHK ; WHEEL byte set? + JP Z,BEGIN2 ; No don't look for options + LD A,(FCB+1) ; Get possible option + CP 'A' ; Want to show all of file? + JP NZ,BEGIN2 ; No + LD A,1 + LD (SHOWALL),A ; Set to show all entries + LD A,8 + LD (LINCNT),A + +; +; See if user wants file displayed 'nonstop' ($N) +; +BEGIN2: LD HL,FCB+1 ; Get first character on command line + LD A,(HL) ; Into A + CP '$' ; Must specify '$' first + JP NZ,OPNLOG ; Nope, continue normal + INC HL ; Point to next byte + LD A,(HL) ; Into A for comparison + CP 'N' ; 'N' for nonstop display? + JP NZ,OPNLOG ; No + LD A,0 + LD (PAGLEN),A ; Else disable page pauses + +; +; Set drive/user to the log file area and open ZMD.LOG +; +OPNLOG: LD A,(LOGUSR) ; Set user area to ZMD.LOG area + CALL RECAR1 + LD A,(LOGDRV) ; Set drive to ZMD.LOG area + CALL RECDR1 + + LD HL,FILE ; Destination is internal FCB + LD DE,LOGNAM ; For log filename + CALL RENFCB ; Initialize and rename + + LD DE,FILE + LD C,OPEN ; Open log file + CALL BDOS + INC A ; Check for no open + LD HL,FILE+1 + JP Z,NOFILE ; No file, exit + +; +; See if special sysop access was allowed/requested. Display enabled +; message if so. +; + LD A,(SHOWALL) ; Showing entire transfer log? + OR A + JP Z,SHOHDR ; No, display header as usual + CALL ILPRTB + DB CR + DB '-- Sysop access enabled --',0 + JP CALCSIZ + +; +; Display all applicable field titles +; +SHOHDR: CALL ILPRTB + DB CR + DB 'D/u Filename Size Speed ',0 + + LD A,(CLOCK) + OR A + JP Z,SHOHDR1 + CALL ILPRTB + DB ' Date Time ',0 + +SHOHDR1:CALL ILPRTB + DB ' Uploaded by' + DB CR,LF,0 + +; +; Get number of records in log file +; +CALCSIZ:LD DE,FILE ; Point to log FCB + LD C,FILSIZ ; Compute file size function + CALL BDOS + LD DE,DBUF+81 ; Point to beggining of write buffer + LD A,CR + LD (DE),A ; Force first CR + DEC E + +; +; Decrement number of records left. If any left, read on into write +; buffer, otherwise close file and exit +; +NXTRCD: PUSH DE ; Save write buffer address + LD HL,FILE+33 ; Get current record counter + LD E,(HL) ; LSB record count + INC HL + LD D,(HL) ; MSB record count + DEC DE ; Decrement it + LD (HL),D ; Put it back + DEC HL + LD (HL),E + LD A,E + CP 0FFH ; Any more records? + JP NZ,RDRCD ; Yes, go read it + LD A,D ; Maybe not, check MSB + CP 0FFH ; Any more? + JP Z,TDONE ; No, all done + +; +; Read a record from source file +; +RDRCD: CALL RSDMA ; Reset DMA to 80H + LD DE,FILE + LD C,RRDM ; Random read + CALL BDOS + POP DE ; Get write buffer address back + OR A ; Read ok? + JP NZ,RDERR ; Yes + LD HL,TBUF+127 ; End address of read buffer + LD B,128 ; Buffer is filled backwards + +; +; Write record from disk to memory (in reverse order) +; +WRTBYT: LD A,(HL) ; Get byte from read buffer + AND 7FH ; Strip parity bit + CP LF ; End of line? + JP Z,DSPLIN ; Yes, show it if supposed to + CP 7FH ; Del (rubout)? + JP Z,NXTBYT ; Yes, ignore it + CP EOF ; End of file marker? + JP Z,NXTBYT ; Yes, ignore it + LD (DE),A + DEC E ; Decrement write buffer pointer + +NXTBYT: DEC L ; Decrement read buffer pointer + DJNZ WRTBYT ; And character count, get next if any left + JP NXTRCD ; Else read another record + +; +; Found end (CR) of current entry. Display it. +; +DSPLIN: DEC B ; Decrement character counter + PUSH AF ; Save flags + DEC L ; Decrement write buffer pointer + PUSH HL ; Save write address + PUSH BC ; Save character count + EX DE,HL ; HL now contains current buffer read address + LD (HL),A ; Store the LF + + LD A,(SHOWALL) ; Show entire file? + OR A + JP NZ,NEXT ; Yes + + INC L ; Else next character is transfer mode + LD A,(HL) ; Get it + DEC L ; Restore read pointer + CP 'R' ; Uploaded entry? + JP NZ,SENDLF1 ; No, ignore it and reset pointers + +; +; Get next character from read buffer. If end of line, go display CR,LF. +; +NEXT: INC L ; Increment next read byte + LD A,(HL) ; Get character + LD B,A ; Into B + CP CR ; End of line? + JP Z,SENDLF ; Yes, send a CR,LF and reset pointers + + LD A,(COLUMN) ; Get column count + CP 79 ; End of line? + JP Z,DSPLP2 ; Yes, start new line + OR A ; At beginning of line? + JP NZ,DSPLP3 ; No, continue + INC A + LD (COLUMN),A ; We aren't anymore + + LD A,B ; Get the character back + LD (STORE),A ; Store it for later comparison + + CP 'P' ; This entry private upload? + JP NZ,DSPLP1 ; No, check for regular upload + LD A,(SHOWALL) ; Yes, were we supposed to show entire file? + OR A + JP Z,DSPLP2 ; No, so ignore it + LD (PRIVATE),A ; Set private flag + JP DSPLP4 ; Go show it + +DSPLP1: CP 'R' ; Regular upload? + JP Z,DSPLP4 ; Yes, keep the flag set + + LD A,(SHOWALL) + OR A + JP NZ,DSPLP4 + + XOR A + LD (STORE),A + LD (COLUMN),A ; Start in column 0 + JP NEXT + +DSPLP2: XOR A + LD (STORE),A ; Otherwise reset flag to zero + +DSPLP3: LD A,(STORE) ; Storing into memory? + OR A + JP Z,NEXT ; If not, exit + +DSPLP4: LD A,(COLUMN) ; Increment the column counter + INC A + LD (COLUMN),A + + CP 3 ; User's modem speed is in column 2 + JP NZ,DSPLP5 ; If not column 2, continue + LD A,B ; Otherwise get the character + LD (STORE),A ; Store it for conversion to baud rate + JP NEXT ; Do not print the "MSPEED" number + +DSPLP5: CP 11 + JP C,NEXT ; Skip everything through column 10 + +; +; Display drive and user of file +; + CP 14 + JP C,SEND ; Print everything through column 13 + JP NZ,DSPFN + +; +; If a private file, make a special note of it +; + LD A,(PRIVATE) ; Private entry? + OR A + JP Z,DSPDU ; No + + XOR A ; Reset flag for next time + LD (PRIVATE),A + LD A,'*' ; Displays entry is private + CALL TYPE + LD B,' ' ; Keep our distance from next field + JP SEND + +DSPDU: LD A,':' ; Stick in a colon after column 12 + CALL TYPE + LD B,' ' ; Send a space + JP SEND + +; +; Display filename and extent +; +DSPFN: CP 22 ; Print through column 20 + JP C,SEND + JP NZ,DSPFT + LD A,B + CALL TYPE ; Send character in colum 21 + LD B,'.' ; Add a period after the file name + JP SEND + +DSPFT: CP 27 + JP C,SEND ; Print file type and some spaces + CALL Z,PRTSPC + CP 39 + JP C,NEXT ; Ignore the "big gap" + CP 43 + JP C,SEND ; Print the file size + JP Z,DSPBD + JP DSPDAT + +; +; Display the baud rate (300-19200 bps) +; +DSPBD: PUSH HL + LD A,(STORE) + CP '1' + JP Z,B300 + CP '5' + JP Z,B1200 + CP '6' + JP Z,B2400 + CP '7' + JP Z,B4800 + CP '8' + JP Z,B9600 + CP '9' + JP Z,B19200 + CALL ILPRTB + DB ' ',0 + POP HL + JP NEXT ; Go get next byte from read buffer + +B300: CALL ILPRTB + DB ' 3',0 + JP BFINISH + +B1200: CALL ILPRTB + DB ' 12',0 + JP BFINISH + +B2400: CALL ILPRTB + DB ' 24',0 + JP BFINISH + +B4800: CALL ILPRTB + DB ' 48',0 + JP BFINISH + +B9600: CALL ILPRTB + DB ' 96',0 + JP BFINISH + +B19200: CALL ILPRTB + DB ' 192',0 + +BFINISH:CALL ILPRTB + DB '00 bps ',0 + POP HL + JP NEXT + +; +; Display time and date +; +DSPDAT: LD A,(CLOCK) ; Clock enabled? + OR A + LD A,(COLUMN) + JP Z,SEND ; No, leave caller's name alone + CP 52 + JP C,SEND ; Print the date + JP NZ,DSPTIM + CALL PRTSPC ; Keep our distance from next field + JP SEND + +DSPTIM: CP 58 + JP C,SEND ; Print the time + JP NZ,SEND + CALL PRTSPC ; Keep our distance from next field + +; +; Display character in B +; +SEND: LD A,B ; Get the character back + CALL TYPE ; Display it + JP NEXT + +; +; Reached end of entry. Send CR,LF and reset pointers +; +SENDLF: LD A,CR ; Output CR + CALL TYPE + LD A,LF ; And LF for next line + CALL TYPE + XOR A ; Enable page pauses for output + JP $+5 + +SENDLF1:LD A,1 + CALL CKABRT ; Check for aborts/pauses + XOR A ; Start new line + LD (COLUMN),A ; And indicate column 0 + LD DE,DBUF+80 ; Beginning of write buffer again + POP BC ; Number of characters left in buffer + POP HL ; Current read buffer address + POP AF ; Were there any characters left? + JP Z,NXTRCD ; No, get next record + JP WRTBYT ; Else get next character + +; +; S u b r o u t i n e s +;----------------------- +; +; Routine to display a space - saves character in A on entry +; +PRTSPC: PUSH AF + LD A,' ' + CALL TYPE + POP AF + RET + +; +; Transfer is done - close destination file +; +TDONE: LD C,CLOSE + LD DE,FILE + CALL BDOS + CALL ERXIT + DB CR,LF + DB '-- End of listing','$' + +; +RDERR: CALL ILPRTB + DB CR,LF + DB '-- Read Error: ',0 + LD HL,FILE+1 + CALL SHONM4 + JP EXIT + +; +; +; These next are just to satisfy ZMDSUBS external requests. Leave alone. +; +DONE:: JP EXIT +TIME:: RET +; +; +; Initialized storage area +;-------------------------- +; +COLUMN: DB 0 ; Column of ZMD.LOG line +STORE: DB 0 +SHOWALL:DB 0 ; 1=all transfers, 0=uploads only + + + END + \ No newline at end of file diff --git a/Source/Apps/ZMD/znews.z80 b/Source/Apps/ZMD/znews.z80 new file mode 100644 index 00000000..12fdb725 --- /dev/null +++ b/Source/Apps/ZMD/znews.z80 @@ -0,0 +1,298 @@ +; + + TITLE ZNEWS.Z80 - 09/29/88 - ZMD Sysop Transfer Log Utility +; Copyrighted (c) 1987, 1988 +; Robert W. Kramer III + + PAGE +;- -; +; Update History ; +; ; +; Date Release Comments ; +; -------- ------- ---------------------------------------------- ; +; ; +; 09/29/88 v1.50 - Fixed problem that caused a 'ZMD .L$$' file ; +; to not be deleted from directory after aborted ; +; sessions. ; +; - Also, was moving 9 filename bytes intead of 8, ; +; this is what caused the mysterious filename of ; +; '.L$$' as mentioned above. The filename left ; +; in the directory should have been '.$$$'. ; +; - Some minor cosmetic changes. ; +; 03/18/88 v1.49 - No change(s) made to this file ; +; 03/13/88 v1.48 - Redefined buffer table at end of programs. STACK; +; and filename buffers now EQUated with offsets ; +; from the last switch/toggle in program instead ; +; of with DS directive. ; +; 02/25/88 v1.47 - No change(s) made to this file +; 01/27/88 v1.46 - Some changes were made to ZMDSUBS file that are ; +; not directly related to this file ; +; 01/17/88 v1.45 - First public release ; +; 11/19/87 v1.00 - Initial version ; +;- -; + +; +;-------------------------------------------------------------------------; +; EXTERNAL Declarations: | +;-------------------------------------------------------------------------; + + + EXTRN CASEFLG,CKABRT,CLEARIT,CMDBUF,DESC,DSTOR,DSTOR1,ERXIT + EXTRN EXIT,ILPRTB,INPUT,LNLNGTH,NOFILE,NOLOG,NOROOM,OLDDRV + EXTRN OLDUSR,OLINE,PRINTV,RECAR1,RECDR1,RENFCB,RERROR,RSDMA + EXTRN SHONM4,STACK,TDONE,UCASE + +; +;-------------------------------------------------------------------------; +; Program Starts Here | +;-------------------------------------------------------------------------; + + + .Z80 + ASEG + ORG 100H ; Program starts + JP BEGIN ; Jump around configuration table + INCLUDE ZMDHDR.Z80 ; Include the ZMD header overlay + .REQUEST ZMDSUBS ; Include the ZMD subroutines + +; +; +; Save CP/M stack, initialize new one for this program +; +BEGIN: LD (STACK),SP ; Save current CCP stack address + LD SP,STACK ; Initialize new one for this program + +; +; Get current drive/user area and store for later +; + LD A,255 ; Get current user area + CALL RECAR1 + LD (OLDUSR),A ; Save it + LD C,CURDRV ; Get current drive + CALL BDOS + LD (OLDDRV),A ; Save it + +; +; Display program name, version, and copyright notice +; +BEGIN1: LD HL,SYSNEW + CALL PRINTV + + LD A,(LOGCAL) ; Log file enabled? + OR A + JP Z,NOLOG ; No, then don't run program + + LD A,(GOTLAST) ; Already located last entry? + OR A + JP NZ,GTNEW ; Yes, then just show it + LD (DESWAIT),A ; Disable sleepy caller time out + + CALL ILPRTB + DB 'Working.',0 + +; +; Log into log file drive/user +; + LD A,(LOGUSR) ; User area to find ZMD.LOG + CALL RECAR1 + LD A,(LOGDRV) ; Drive to find ZMD.LOG + CALL RECDR1 + +; +; Open 'ZMD .LOG' file +; + LD DE,LOGNAM ; Current log filename + LD HL,FILE ; Internal FCB + CALL RENFCB ; Initialize + + LD DE,FILE + LD C,OPEN ; Open log file + CALL BDOS + INC A ; ZMD.LOG file exist? + LD HL,LOGNAM + JP Z,NOFILE ; No, inform user and exit to CP/M + +; +; Open 'ZMD .$$$' file +; + LD DE,TEMPFIL ; Current '$$$' filename + LD HL,DEST ; Internal FCB + CALL RENFCB ; Initialize + + LD HL,FILE+1 ; Point to log filename + LD DE,DEST+1 ; And temporary filename + LD BC,8 ; Set to move filename bytes only + LDIR + + LD C,OPEN ; Open new log file + LD DE,DEST + CALL BDOS + INC A ; Did file already exist? + + LD C,DELETE ; Prepare for delete + LD DE,DEST + CALL NZ,BDOS ; Yes, delete existing file + + LD C,MAKE ; Make new temporary file + LD DE,DEST + CALL BDOS + INC A + LD HL,DEST+1 + JP Z,NOROOM ; Exit if no more disk space + +; +; Read record from ZMD.LOG file +; + LD DE,CMDBUF ; Point to last log entry buffer + +RDRECD: PUSH DE ; Save current buffer position + CALL RSDMA ; Reset DMA + LD DE,FILE + LD C,READ + CALL BDOS + POP DE ; Last entry buffer address + OR A ; Read ok? + JP NZ,RERROR ; No + +; +; Now look for the end of the file overwriting OLINE with each entry found +; (from LF to LF). Upon ^Z (EOF) display last entry and get prompt for new +; one +; + LD HL,TBUF + +WRDLP: LD A,(HL) ; Get a character + AND 7FH + CP 7FH ; Delete character? + JP Z,NEXT ; Yes, don't store this character + + CP EOF ; End of file? + JP Z,GTNEW ; Yes, display last entry and get new one + + LD (DE),A ; Else store character in last entry buffer + INC DE ; Next positition in last entry buffer + CP LF ; Was it a line feed? + JP NZ,NEXT ; No, get next character + +; +; Check periodically (every LF) for user abort +; + LD A,1 ; Disable page pausing + CALL CKABRT ; Check for user requests + LD A,'$' ; Terminator for BDOS print function + LD (DE),A ; At end of last entry string + + PUSH HL + LD HL,CMDBUF + CALL DSTOR1 + POP HL + LD DE,CMDBUF + +NEXT: INC L + JP Z,RDRECD + JP WRDLP + +; +; Get new entry to ZMD.LOG. First display the last entry added to the file +; for use as a typing guide. +; +GTNEW: CALL ILPRTB + DB CR + DB 'Current format of ',0 + + LD HL,LOGNAM ; Point to log filename + CALL SHONM4 + + CALL SHWLAST ; Show last entry in log file + LD A,1 + LD (GOTLAST),A ; Show we've found/displayed last entry + +; +; Get the new entry. Process input - CR terminates entry. +; + LD A,79 + LD (LNLNGTH+1),A ; Set for up to 79 character string + LD (WRAP),A ; Disable word wrap + LD (CASEFLG),A ; Convert all input to uppercase + CALL DESC ; Go get string + LD A,0 + LD (CASEFLG),A ; Disable uppercase lock + JP Z,NOCHANG ; Z=CR entered on blank line + LD (HL),'$' ; Place a '$' for BDOS print function + +; +; Done with entry, ask for verification before writing to disk +; + CALL ILPRTB + DB CR,LF + DB ' Repeating to verify:',0 + + CALL SHWLAST ; Show last entry + LD DE,OLINE ; Point to new entry buffer + LD C,PRINT ; BDOS print function + CALL BDOS + + CALL ILPRTB + DB CR,LF + DB 'Correct? (Y/N): ',0 + +GETOK1: CALL INPUT ; Get repsonse + CALL UCASE ; Convert to uppercase + CP 'N' ; No? + JP NZ,GETOK2 ; Yes, all done + + CALL ILPRTB + DB 'No.' + DB CR,LF,0 + JP BEGIN1 + +GETOK2: CP 'Y' ; Yes? + JP NZ,GETOK1 ; Loop until we get a yes or no + + CALL ILPRTB + DB CR + DB 'Writing log entry to ',0 + LD HL,LOGNAM + CALL SHONM4 + CALL ILPRTB + DB '...',0 + CALL DSTOR ; Go store it in disk buffer + JP TDONE ; Transfer to disk +; +; +;------------------- +; UTILITIES SECTION +;------------------- +; +NOCHANG:CALL ILPRTB ; Else nothing typed, abort + DB CR,LF + DB '-- Log entry aborted... ',0 + + LD C,DELETE + LD DE,DEST + CALL BDOS ; Clean up (Erase 'ZMD .$$$' file) + + JP EXIT + +; +; Show last entry in ZMD.LOG file +; +SHWLAST:CALL ILPRTB + DB CR,LF,LF,0 + LD DE,CMDBUF ; Point to last entry buffer + LD C,PRINT ; BDOS print function + JP BDOS + +; +; These next are just dummy routines to satisfy external ZMDSUBS requests. +; They do nothing but leave alone. +; +DONE:: JP EXIT +TIME:: RET + + +GOTLAST:DB 0 + + + END + \ No newline at end of file diff --git a/Source/Apps/ZMP/Build.cmd b/Source/Apps/ZMP/Build.cmd new file mode 100644 index 00000000..8df63e1a --- /dev/null +++ b/Source/Apps/ZMP/Build.cmd @@ -0,0 +1,16 @@ +@echo off +setlocal + +set TOOLS=..\..\..\Tools + +set PATH=%TOOLS%\zxcc;%PATH% + +set CPMDIR80=%TOOLS%/cpm/ + +zxcc Z80ASM -ZMO-RW01/H || exit /b +zxcc MLOAD25 -ZMP.COM=ZMPX.COM,ZMO-RW01 || exit /b + +copy /Y zmp.com ..\..\..\Binary\Apps\ || exit /b +copy /Y *.ovr ..\..\..\Binary\Apps\ || exit /b +copy /Y *.hlp ..\..\..\Binary\Apps\ || exit /b +copy /Y zmp.doc ..\..\..\Binary\Apps\ || exit /b \ No newline at end of file diff --git a/Source/Apps/ZMP/Clean.cmd b/Source/Apps/ZMP/Clean.cmd new file mode 100644 index 00000000..161b365c --- /dev/null +++ b/Source/Apps/ZMP/Clean.cmd @@ -0,0 +1,7 @@ +@echo off +setlocal + +if exist zmp.com del zmp.com +if exist *.hex del *.hex +if exist *.lst del *.lst +if exist *.zip del *.zip diff --git a/Source/Apps/ZMP/Makefile b/Source/Apps/ZMP/Makefile new file mode 100644 index 00000000..11574dd6 --- /dev/null +++ b/Source/Apps/ZMP/Makefile @@ -0,0 +1,10 @@ +OBJECTS = zmp.com *.ovr *.hlp zmp.doc +DEST = ../../../Binary/Apps +TOOLS = ../../../Tools +OTHERS = *.hex +NODELETE = *.ovr zmp.doc *.hlp + +include $(TOOLS)/Makefile.inc + +zmp.com: zmo-rw01.hex + $(ZXCC) MLOAD25 -ZMP.COM=ZMPX.COM,ZMO-RW01 diff --git a/Source/Apps/ZMP/Notes.txt b/Source/Apps/ZMP/Notes.txt new file mode 100644 index 00000000..76fdf39b --- /dev/null +++ b/Source/Apps/ZMP/Notes.txt @@ -0,0 +1,30 @@ +This ROMWBW version is an extract of https://github.com/mecparts/zmp/bin +as at Aug 23rd, 2021. + +- Overlay files must reside on default drive at time program is + launched. This seems to preclude the path search feature of + ZSDOS/ZCPR which would be nice. Need to look into this. +- Need some mechanism for user to select a CIO unit other than CIO 1 + without modifying and rebuilding application. +- Initialization messages refer to CIO 1 as CIO 0 +- System hangs after error message if there is no CIO 1 unit +- When leaving program, terminal cursor remains hidden + +--WBW 1:42 PM 8/23/2021 + +- When leaving program, terminal cursor remains hidden (fixed) +- System hangs after error message if there is no CIO 1 unit (fixed) +- Initialization messages refer to CIO 1 as CIO 0 (fixed) + +--WBW 1:58 PM 8/23/2021 + +- Restore cursor on normal program exit. +- Revert original HBIOS conout and default console code as there + is no associated facility for direct HBIOS conin. +- Allow setting port 0 and port 1 CIO device from command line + ZMP 2 sets comms port to CIO 2. Can set primary and secondary + i.e. ZMP 21 but only primary supported on this ZMP version. + Untested on Ron Murrays ZMP15 +- Space getting short so messages shortened. + +--PMS 8/24/2021 \ No newline at end of file diff --git a/Source/Apps/ZMP/zmconfig.ovr b/Source/Apps/ZMP/zmconfig.ovr new file mode 100644 index 00000000..556170c1 Binary files /dev/null and b/Source/Apps/ZMP/zmconfig.ovr differ diff --git a/Source/Apps/ZMP/zminit.ovr b/Source/Apps/ZMP/zminit.ovr new file mode 100644 index 00000000..c522157a Binary files /dev/null and b/Source/Apps/ZMP/zminit.ovr differ diff --git a/Source/Apps/ZMP/zmo-rw01.z80 b/Source/Apps/ZMP/zmo-rw01.z80 new file mode 100644 index 00000000..6c9f4276 --- /dev/null +++ b/Source/Apps/ZMP/zmo-rw01.z80 @@ -0,0 +1,663 @@ +;----------------------------------------------------------------------------- +; +; Overlay for ZMP (Z-Modem Program) +; +; Name ZMO-RW01.Z80 +; +; ROMWBW version using HBIOS and https://github.com/mecparts/zmp version of zmodem +; Databits, stop bit, parity setting not supported. +; All modem/serial i/o is through the hbios. +; Timing delay calculations based on hbios reported cpu speed. +; Only 1 port is supported by the mecports version of zmp. +; Port setting supports 2 port, port A is CIO 1, port B is CIO 2 +; This overlay is compatible with Ron Murray's original ZMP15 which support two ports. +; Teraterm users may need to change the ZmodemWinSize value to 1024 in teraterm.ini file. +; +;----------------------------------------------------------------------------- +; +false equ 0 +true equ not false +; +;------------------------------------------------------------------------------ +; +; User-set variables: +; +debug equ false ; to allow debugging of overlay with Z8E etc. +; +;Set the following two equates to the drive and user area which will contain +; ZMP's .OVR files, .CFG file, .FON file and .HLP file. Set both to zero +; (null) to locate them on the drive from which ZMP was invoked. + +overdrive equ 0 ; Drive to find overlay files on ('A'-'P') +overuser equ 0 ; User area to find files +; +; Initial baud rate code +; +initbr equ 10 ; Refer to "baudtbl" table below - brate column +; +;------------------------------------------------------------------------------ +; +; NOT user-set variables + +userdef equ 0145h ; origin of this overlay + ; This address should not change with + ; subsequent revisions. +mspeed equ 03ch ; location of current baud rate. +ovsize equ 0400h ; max size of this overlay +; + .z80 ; use z80 code + aseg ; absolute + + if debug + org 100h ; so you can debug it with cebug, zsid, etc + else + org userdef + endif +; +esc equ 1bh +ctrlq equ 11h +cr equ 0dh +lf equ 0ah +bdos equ 5 +fcb equ 05ch+1 ; Command line +; +codebgn equ $ +; +;Jump table for the overlay: do NOT change this +jump_tab: + jp scrnpr ; screen print + jp mrd ; modem read with timeout + jp mchin ; get a character from modem + jp mchout ; send a character to the modem + jp mordy ; test for tx buffer empty + jp mirdy ; test for character received + jp sndbrk ; send break + jp cursadd ; cursor addressing + jp cls ; clear screen + jp invon ; inverse video on + jp invoff ; inverse video off + jp hide ; hide cursor + jp show ; show cursor + jp savecu ; save cursor position + jp rescu ; restore cursor position + jp mint ; service modem interrupt + jp invec ; initialise interrupt vectors + jp dinvec ; de-initialise interrupt vectors + jp mdmerr ; test uart flags for error + jp dtron ; turn DTR on + jp dtroff ; turn DTR OFF + jp init ; initialise uart + jp wait ; wait seconds + jp mswait ; wait milliseconds + jp userin ; user-defined entry routine + jp userout ; user-defined exit routine + jp getvars ; get system variables + jp setport ; set port (0 or 1) +; +; Spare jumps for compatibility with future versions + jp spare ; spare for later use + jp spare ; spare for later use + jp spare ; spare for later use + jp spare ; spare for later use + jp spare ; spare for later use + jp spare ; spare for later use +; +; Port 0 & 1 defaults. Can be overwritten by command line +; +hbport0 db 1 ; default hbios CIO serial port 0 +hbport1 db 2 ; alternate hbios CIO serial port 1 +port: db 1 ; current cio port. +; +; Main code starts here +; +;Screen print function +scrnpr: call print + db 'This function not supported.',cr,lf,0 +spare: ret +; +; User-defined entry routine: +; +; forcing reinit will resend AT command to modem, reset +; current line defaults and eat up buffered characters +; +; Get and set modem/serial ports to use from the command line +; +; Get the cpu speed reported by romwbw hbios and calculate +; the three required loop counter values for timing: +; +; outerva (outv) +; innerval (inv) +; millisv (msv) +; +userin: ld a,-1 ; force re-init + ld (mspeed),a +; + ld a,(fcb) ; first character + cp ' ' ; of parsed filename + jr z,dport1 ; is port 0 + sub '0' + ld (hbport0),a ; set CIO for port 0 + ld (port),a ; reconfigure default +dport0: ld a,(fcb+1) ; second character + cp ' ' ; of parsed filename + jr z,dport1 ; is port 1 + sub '0' + ld (hbport1),a +dport1: push bc + ld bc,0f8f0h ; get clock speed in l + rst 08 +; +; outerval equ (clkspd / 10) + 1 +; + push hl ; save clock speed + ld h,0 + ld c,10 + call div_hl_c ; result in hl + ld a,l + inc a + ld (outv),a ; save outerval +; +; innerval equ (6667 / outerval) * clkspd +; + ld c,a + ld hl,6667 + call div_hl_c ; result in hl +; + ex de,hl + pop hl ; recall clock + ld a,l ; save + push af ; clock speed +; + call mult_a_de + ld (inv),hl ; save innerval +; +; ld de,39 * clkspd +; + pop af ; recall clock speed + ld de,39 + call mult_a_de + ld (msv),hl ; save msec value +; + pop bc + ret +; +outv: ds 1 ; outer value +inv: ds 2 ; inner value +msv: ds 2 ; millisec value +; +; maths helpers +; +mult_a_de: ; https://wikiti.brandonw.net/index.php?title=Z80_Routines:Math:Multiplication + ld c,0 + ld h,c + ld l,h + add a,a ; optimised 1st iteration + jr nc,$+4 + ld h,d + ld l,e + ld b,7 +_loop2: add hl,hl + rla + jr nc,$+4 + add hl,de + adc a,c + djnz _loop2 ; result in ahl + ret +; +div_hl_c: ; https://wikiti.brandonw.net/index.php?title=Z80_Routines:Math:Division + xor a + ld b,16 +_loop1: add hl,hl + rla + jr c,$+5 + cp c + jr c,$+4 + sub c + inc l + djnz _loop1 ; result in hl + ret +; +; User-defined exit routine: leave empty if not needed +userout:call show + ret +; +;Get a character from the modem: return in HL +mchin: push bc + ld b,00h + ld hl,port + ld c,(hl) + rst 08 + ld l,e + pop bc + ret + +;Send a character to the modem +mchout: ld hl,2 ; get the character + add hl,sp + ld e,(hl) + ld b,01h + ld hl,port + ld c,(hl) + rst 08 + ret ; done + +;Test for output ready: return TRUE (1) in HL if ok +mordy: ld b,03h + ld hl,port + ld c,(hl) + rst 08 + ld h,0 + or a + jr z,modrdy1 + ld a,1 + or a +modrdy1:ld l,a + ret + +;Test for character at modem: return TRUE (1) in HL if so +mirdy: push bc + ld b,02h + ld hl,port + ld c,(hl) + rst 08 + ld h,0 + or a + jr z,mirdy1 + ld a,1 + or a +mirdy1: ld l,a + pop bc + ret +; +;Send a break to the modem: leave empty if your system can't do it +sndbrk: ld hl,300 ; wait 300 mS + call waithlms + ret +; +;Test UART flags for error: return TRUE (1) in HL if error. +mdmerr: xor a ; set/clear Z + ld h,a + ld l,a + ret +; +;Turn DTR ON +dtron: +; ret +; +;Turn DTR OFF +dtroff: + ret +; +;Initialise the uart +; +init: ld hl,2 ; get parameters + add hl,sp + ex de,hl + call getparm ; in HL + ld (brate),hl ; baud rate + call getparm + ld (parity),hl ; parity + call getparm + ld (data),hl ; data bits (BINARY 7 or 8) + call getparm + ld (stop),hl ; stop bits (BINARY 1 or 2) +; + ld a,(port) ; get device type + ld c,a + ld b,06h + rst 08 + or a ; check if valid + jr nz,initerr +; + ld a,(brate) ; get baud rate to set + ld c,a + ld b,0 + ld hl,baudtbl + add hl,bc + ld a,(hl) ; convert to encoded hbios + cp a,-1 + jr z,initerr +; + push af + ld a,(port) ; get line characteristics + ld c,a + ld b,05h + rst 08 + ld a,d ; mask out exisitng + and 11100000b ; replace with rate + ld d,a + pop af + or d + ld d,a +; + ld b,04h ; set new + ld a,(port) ; speed + ld c,a + rst 08 + or a + jr nz,initerr +; + call print + db 'Initializing device: ',0 + call diport +; + ld a,(brate) ; load mspeed with the current brate value if + ld (mspeed),a ; the new rate is valid. See table of values below. + ret +; +initerr:call print + db lf,lf,'Initization failed, device: ',0 + call diport + call show ; show cursor, then ... + jp 0 ; bail out to avoid system hang! +; +diport: ld a,(port) ; Display port +diport1:add a,'0' + call cout + call print + db cr,lf,0 + ret +; +;-------------------------------------------------------------------------- +stop: dw 1 ; stop bits +parity: dw 'N' ; parity +data: dw 8 ; data bits +brate: dw initbr ; baud rate: +;-------------------------------------------------------------------------- +; +;Values of brate for each baud rate +; +; hb encode baud rate brate +; +baudtbl: + db -1 ; 110 0 not supported + db 2 ; 300 1 + db 17 ; 450 2 + db 3 ; 600 3 + db -1 ; 710 4 not supported + db 4 ; 1200 5 + db 5 ; 2400 6 + db 6 ; 4800 7 + db 7 ; 9600 8 + db 8 ; 19200 9 + db 9 ; 38400 10 + db 24 ; 57600 11 + db 10 ; 76800 12 +; +; Set the port. ZMP supplies either 0 or 1 as a parameter. +; Note that ZMP calls this routine with both values +; for the port on initialisation. +; +; Only originl ZMP calls setport. Mecports does not support setting ports +; +setport:ld hl,2 ; get port number + add hl,sp + ex de,hl + call getparm ; in HL (values are 0 and 1) +; + ld a,l ; point to which port + ld hl,hbport0 ; we want to set + or a + jr z,isport0 + inc hl +isport0:ld c,(hl) ; get the associated CIO port + push hl + ld b,06h ; test if a valid cio + rst 08 + pop hl + or a + ld a,(hl) ; get the associated CIO port + jr nz,seterr + ld (port),a ; save the valid port + call print + db 'Setting CIO device: ',0 + jp diport +; +seterr: push hl + call print + db 'Unable to set CIO device: ',0 + pop hl + ld a,(hl) ; get port we wanted to set + jp diport1 +; +;**************************************************************************** +;Video terminal sequences: these are for VT-100: Modify as you wish +;Cursor addressing: +cursadd: + ld hl,2 ; get parameters + add hl,sp + ex de,hl + call getparm ; in HL + inc hl + ld (row),hl ; row + call getparm + inc hl + ld (col),hl ; column +; + call print + db esc,'[',0 + ld a,(row) ; row first + call cursconv + ld a,';' + call cout + ld a,(col) ; same for column + call cursconv + ld a,'H' + call cout + ret +; +cursconv: + ld b,a + xor a +ca1: add a,1 + daa + djnz ca1 + ld (num),a + and 0f0h + jr z,ca2 + srl a + srl a + srl a + srl a + or '0' + call cout +ca2: ld a,(num) + and 0fh + or '0' + call cout + ret +; +row: ds 2 ; row +col: ds 2 ; column +num: ds 1 +; +;Clear screen: +cls: + call print + db esc,"[H",esc,"[2J",0 + ret +; +;Inverse video on: +invon: + call print + db esc,"[7m",0 + ret +; +;Inverse video off: +invoff: + call print + db esc,"[m",0 + ret +; +;Turn off cursor: +hide: + call print + db esc,'[?25l',0 + ret +; +;Turn on cursor: +show: + call print + db esc,'[?25h',0 + ret +; +;Save cursor position: +savecu: + call print + db esc,'[7',0 + ret +; +;Restore cursor position: +rescu: + call print + db esc,'[8',0 + ret +; +;**************************************************************************** +; +;Service modem interrupt: +mint: +; ret ; unused +; +;Initialise interrupt vectors: +invec: +; ret ; ditto +; +;De-initialise interrupt vectors: +dinvec: + ret ; ditto +; +;****************** End of user-defined code ******************************** +; Do not change anything below here. +; +;Modem character test for 100 ms +mrd: + push bc ; save bc + ld bc,100 ; set limit +mrd1: call mirdy ; char at modem? + jr nz,mrd2 ; yes, exit + ld hl,1 ; else wait 1ms + call waithlms + dec bc ; loop till done + ld a,b + or c + jr nz,mrd1 + ld hl,0 ; none there, result=0 + xor a +mrd2: pop bc + ret +; +; Inline print routine: destroys A and HL +; +print: ex (sp),hl ; get address of string +ploop: ld a,(hl) ; get next + inc hl ; bump pointer + or a ; done if zero + jr z,pdone + call cout ; else print + jr ploop ; and loop +pdone: ex (sp),hl ; restore return address + ret ; and quit +; +;Output a character in A to the console +; +cout: push bc ; save regs + push de + push hl + ld e,a ; character to E + ld c,2 + call bdos ; print it + pop hl + pop de + pop bc + ret +; +; Calculate values for loop constants. +; Need to have two loops to avoid 16-bit overflow with clock speeds above 9 MHz. + +;outerval equ (clkspd / 10) + 1 +;innerval equ (6667 / outerval) * clkspd +; +;Wait(seconds) - entry point from C +wait: ld hl,2 + add hl,sp + ex de,hl ; get delay size + call getparm + ; fall thru to.. +;Wait seconds in HL - entry point for this overlay +waithls: + push bc ; save bc + push de ; de + push ix ; and ix + ld ix,0 ; then point ix to 0 + ; so we don't upset memory-mapped i/o +; +wait10: ld a,(outv) ; was ld b,outerval + ld b,a +wait11: ld de,(inv) ; was ld de,innerval +wait12: bit 0,(ix) ; time-wasters + bit 0,(ix) + bit 0,(ix) ; 20 T-states each + bit 0,(ix) + bit 0,(ix) + bit 0,(ix) + dec de + ld a,e + ld a,d + or e + jr nz,wait12 ; 150 T-states per inner loop + djnz wait11 ; decrement outer loop + dec hl ; ok, decrement count in hl + ld a,h + or l + jr nz,wait10 + pop ix ; done -- restore ix + pop de ; de + pop bc ; and bc + ret +; +;Wait milliseconds - entry point from C +mswait: ld hl,2 + add hl,sp + ex de,hl ; get delay size + call getparm + ; fall thru to.. +;Wait milliseconds in HL - entry point for this overlay +waithlms: + push de +w1ms0: ld de,(msv) ; was ld de,39 * clkspd +w1ms1: dec de + ld a,d + or e + jr nz,w1ms1 + dec hl + ld a,h + or l + jr nz,w1ms0 + pop de + ret +; +;Get next parameter from (de) into hl +getparm: + ex de,hl ; get address into hl + ld e,(hl) ; get lo + inc hl + ld d,(hl) ; then hi + inc hl ; bump for next + ex de,hl ; result in hl, address still in de + ret +; +;Get address of user-defined variables +; +getvars:ld hl,uservars + ret +; +uservars: + dw overdrive ; .OVR etc. drive/user + dw overuser +; + if ($ - codebgn) gt ovsize +toobig: jp errval ; Overlay too large! + endif +; + end diff --git a/Source/Apps/ZMP/zmp-blnk.z80 b/Source/Apps/ZMP/zmp-blnk.z80 new file mode 100644 index 00000000..9cd1ba0b --- /dev/null +++ b/Source/Apps/ZMP/zmp-blnk.z80 @@ -0,0 +1,573 @@ +;----------------------------------------------------------------------------- +; +; Sample Overlay for ZMP (Z-Modem Program) +; +; Name ZMO-BLNK.Z80 +; +; Dated Sep 14, 1988 +; +; Written by - +; Ron Murray, c/o Z-Node 62, 061-9-450-0200, Perth, Western Australia. +; +; Modified to ZMP v1.2 standard rjm 15/9/88 +; Modified to ZMP v1.3 standard rjm 11/10/88 +; Modified to ZMP v1.4 standard rjm 20/11/88 +; Modified to ZMP v1.5 standard rjm 25/3/89 +; +; +;----------------------------------------------------------------------------- +; +; +; System-dependent code overlay for ZMODEM +; +; +; +; Insert your own code as necessary in this file. Code contained herein +; has been written in Z80 code for use with M80 or SLR. Assemble as follows: +; +; SLR ZMO-xx01/h +; MLOAD ZMP.COM=ZMODEM.COM,ZMO-xx01.HEX +; or +; M80 =ZMO-xx01.Z80 +; RELHEX ZMO-xx01 +; MLOAD ZMP.COM=ZMODEM.COM,ZMO-xx01.HEX +; +; +; (Don't use L80 without changing the source for assembly as a +; cseg file.) +; +;----------------------------------------------------------------------------- +; +; +; Notes on modifying this file: +; +; C requires that functions do not change either index register (IX or IY). +; If your overlay requires either of these to be changed, ensure they are +; restored to the original values on return. +; Since collecting parameters from C functions can be tricky, only change +; the parts marked 'Insert your own code here'. Do NOT modify the jump +; table at the start. Do NOT modify the entry/exit sections of each +; function. Do NOT pass 'GO'. Do NOT collect $200. +; Apart from defining modem functions, this file also defines terminal +; characteristics. Examples provided are for ADM-3A (with a few of my own +; additions). Modify to suit your own terminal. An inline print routine +; is provided for printing strings in the usual way: usage is +; +; call print +; db 'required string',0 +; +;----------------------------------------------------------------------------- +; +; +; Don't forget to set your clock speed at the clkspd variable. +; +; +; If you find your overlay exceeds the maximum size (currently 0400h), +; you will have to contact me for another version. If too many people need +; to do it, we haven't allowed enough room. +; +; Ron Murray 15/8/88 +; +; +; +;--------------------------------------------------------------------------- + +false equ 0 +true equ not false + +;------------------------------------------------------------------------------ + +; User-set variables: + +clkspd equ 4 ; Processor clock speed in MHz +debug equ false ; to allow debugging of overlay with Z8E etc. + +;Set the following two equates to the drive and user area which will contain +; ZMP's .OVR files, .CFG file, .FON file and .HLP file. Set both to zero +; (null) to locate them on the drive from which ZMP was invoked. + +overdrive equ 'A' ; Drive to find overlay files on ('A'-'P') +overuser equ 0 ; User area to find files + +;------------------------------------------------------------------------------ + + +; NOT user-set variables + +userdef equ 0145h ; origin of this overlay + ; This address should not change with + ; subsequent revisions. +mspeed equ 03ch ; location of current baud rate. +ovsize equ 0400h ; max size of this overlay + + .z80 ; use z80 code + aseg ; absolute + + if debug + org 100h ; so you can debug it with cebug, zsid, etc + else + org userdef + endif + + +esc equ 1bh +ctrlq equ 11h +cr equ 0dh +lf equ 0ah +bdos equ 5 + + +codebgn equ $ + +;Jump table for the overlay: do NOT change this +jump_tab: + jp scrnpr ; screen print + jp mrd ; modem read with timeout + jp mchin ; get a character from modem + jp mchout ; send a character to the modem + jp mordy ; test for tx buffer empty + jp mirdy ; test for character received + jp sndbrk ; send break + jp cursadd ; cursor addressing + jp cls ; clear screen + jp invon ; inverse video on + jp invoff ; inverse video off + jp hide ; hide cursor + jp show ; show cursor + jp savecu ; save cursor position + jp rescu ; restore cursor position + jp mint ; service modem interrupt + jp invec ; initialise interrupt vectors + jp dinvec ; de-initialise interrupt vectors + jp mdmerr ; test uart flags for error + jp dtron ; turn DTR on + jp dtroff ; turn DTR OFF + jp init ; initialise uart + jp wait ; wait seconds + jp mswait ; wait milliseconds + jp userin ; user-defined entry routine + jp userout ; user-defined exit routine + jp getvars ; get system variables + jp setport ; set port (0 or 1) + +; Spare jumps for compatibility with future versions + jp spare ; spare for later use + jp spare ; spare for later use + jp spare ; spare for later use + jp spare ; spare for later use + jp spare ; spare for later use + jp spare ; spare for later use + +; +; Main code starts here +; +;Screen print function +scrnpr: + ; <== Insert your own code here + call print + db 'This function not supported.',cr,lf,0 + ; <== End of your own code +spare: + ret + +; User-defined entry routine: leave empty if not needed +userin: + ret + +; User-defined exit routine: leave empty if not needed +userout: + ret + + +;Get a character from the modem: return in HL +mchin: + push bc + ; <== Insert your own code here + + + ; <== End of your own code + + ld l,a ; put in HL + ld h,0 + or a ; set/clear Z + pop bc + ret + +;Send a character to the modem +mchout: + ld hl,2 ; get the character + add hl,sp + ld a,(hl) + ; <== Insert your own code here + + + ; <== End of your own code + ret ; done + +;Test for output ready: return TRUE (1) in HL if ok +mordy: + ; <== Insert your own code here + + ; <== End of your own code + + ld a,l ; set/clear Z + or a + ret + +;Test for character at modem: return TRUE (1) in HL if so +mirdy: + ; <== Insert your own code here + + + ; <== End of your own code + ld a,l ; set/clear Z + or a + ret + +;Send a break to the modem: leave empty if your system can't do it +sndbrk: + ; <== Insert your own code here + + ld hl,300 ; wait 300 mS + call waithlms + + ; <== End of your own code + ret +; +;Test UART flags for error: return TRUE (1) in HL if error. +mdmerr: + ; <== Insert your own code here + + ; <== End of your own code + ld a,l ; set/clear Z + or a + ret + + + +;Turn DTR ON +dtron: + ; <== Insert your own code here + + ; <== End of your own code + ret + + + +;Turn DTR OFF +dtroff: + ; <== Insert your own code here + + + ; <== End of your own code + ret + + + +;Initialise the uart + +init: + + ld hl,2 ; get parameters + add hl,sp + ex de,hl + call getparm ; in HL + ld (brate),hl ; baud rate + call getparm + ld (parity),hl ; parity + call getparm + ld (data),hl ; data bits (BINARY 7 or 8) + call getparm + ld (stop),hl ; stop bits (BINARY 1 or 2) + + + ; <== Insert your own code here + ; using values below + ld (mspeed),a ; don't forget to load mspeed with the + ; current brate value if the new rate is + ; valid. See table of values below. + ; <== End of your own code + ret +;-------------------------------------------------------------------------- + +stop: dw 1 ; stop bits +parity: dw 'N' ; parity +data: dw 8 ; data bits +brate: dw 7 ; baud rate: + +;-------------------------------------------------------------------------- +;Values of brate for each baud rate +; +; baud rate brate +; +; 110 0 +; 300 1 +; 450 2 +; 600 3 +; 710 4 +; 1200 5 +; 2400 6 +; 4800 7 +; 9600 8 +; 19200 9 +; 38400 10 +; 57600 11 +; 76800 12 + +; +; Set the port. ZMP supplies either 0 or 1 as a parameter. You're on your +; own here -- your system is bound to be different from any other! You may +; implement a software switch on all the modem-dependent routines, or perhaps +; you can have one or two centralised routines for accessing the UARTs and +; modify the code from this routine to select one or the other. (Who said +; there was anything wrong with self-modifying code?). If you have only one +; UART port, or if you don't want to go through all the hassles, just have +; this routine returning with no changes made. Note that ZMP calls this +; routine with both values for the port on initialisation. +; +setport: + ld hl,2 ; get port number + add hl,sp + ex de,hl + call getparm ; in HL (values are 0 and 1) + + ; <== Insert your own code here + + ; <== End of your own code + ret + +port: ds 1 + + +;**************************************************************************** +;Video terminal sequences: these are for ADM-3A: Modify as you wish +;Cursor addressing: +cursadd: + ld hl,2 ; get parameters + add hl,sp + ex de,hl + call getparm ; in HL + ld (row),hl ; row + call getparm + ld (col),hl ; column + ; <== Insert your own code here + ; using values in row and col + call print + db esc,'=',0 ; ADM-3A leadin + ld a,(row) ; row first + add a,' ' ; add offset + call cout + ld a,(col) ; sane for column + add a,' ' + call cout + ; <== end of your own code + ret + +row: ds 2 ; row +col: ds 2 ; column + + +;Clear screen: +cls: + call print + db 1ah,0 + ret + +;Inverse video on: +invon: + call print + db esc,'G4',0 + ret + +;Inverse video off: +invoff: + call print + db esc,'G0',0 + ret + +;Turn off cursor: +hide: + call print + db esc,'.1',0 + ret + +;Turn on cursor: +show: + call print + db esc,'.3',0 + ret + +;Save cursor position: +savecu: + ret + +;Restore cursor position: +rescu: + ret + +;**************************************************************************** + +;Service modem interrupt: +mint: + ret ; my system doesn't need this + +;Initialise interrupt vectors: +invec: + ret ; ditto + +;De-initialise interrupt vectors: +dinvec: + ret ; ditto + +;****************** End of user-defined code ******************************** +; Do not change anything below here. + +;Modem character test for 100 ms +mrd: + push bc ; save bc + ld bc,100 ; set limit +mrd1: + call mirdy ; char at modem? + jr nz,mrd2 ; yes, exit + ld hl,1 ; else wait 1ms + call waithlms + dec bc ; loop till done + ld a,b + or c + jr nz,mrd1 + ld hl,0 ; none there, result=0 + xor a +mrd2: + pop bc + ret + +; Inline print routine: destroys A and HL + +print: + ex (sp),hl ; get address of string +ploop: + ld a,(hl) ; get next + inc hl ; bump pointer + or a ; done if zero + jr z,pdone + call cout ; else print + jr ploop ; and loop +pdone: + ex (sp),hl ; restore return address + ret ; and quit + +; +;Output a character in A to the console +; +cout: + push bc ; save regs + push de + push hl + ld e,a ; character to E + ld c,2 + call bdos ; print it + pop hl + pop de + pop bc + ret + +;Wait(seconds) +wait: + ld hl,2 + add hl,sp + ex de,hl ; get delay size + call getparm + ; fall thru to.. +;Wait seconds in HL +waithls: + push bc ; save bc + push de ; de + push ix ; and ix + ld ix,0 ; then point ix to 0 + ; so we don't upset memory-mapped i/o + +;Calculate values for loop constants. Need to have two loops to avoid +; 16-bit overflow with clock speeds above 9 MHz. + +outerval equ (clkspd / 10) + 1 +innerval equ (6667 / outerval) * clkspd + +wait10: + ld b,outerval + +wait11: + ld de,innerval + +wait12: + bit 0,(ix) ; time-wasters + bit 0,(ix) + bit 0,(ix) ; 20 T-states each + bit 0,(ix) + bit 0,(ix) + bit 0,(ix) + dec de + ld a,e + ld a,d + or e + jr nz,wait12 ; 150 T-states per inner loop + djnz wait11 ; decrement outer loop + dec hl ; ok, decrement count in hl + ld a,h + or l + jr nz,wait10 + pop ix ; done -- restore ix + pop de ; de + pop bc ; and bc + ret + +;Wait milliseconds +mswait: + ld hl,2 + add hl,sp + ex de,hl ; get delay size + call getparm + ; fall thru to.. +;Wait milliseconds in HL +waithlms: + push de +w1ms0: + ld de,39 * clkspd +w1ms1: + dec de + ld a,d + or e + jr nz,w1ms1 + dec hl + ld a,h + or l + jr nz,w1ms0 + pop de + ret + +;Get next parameter from (de) into hl +getparm: + ex de,hl ; get address into hl + ld e,(hl) ; get lo + inc hl + ld d,(hl) ; then hi + inc hl ; bump for next + ex de,hl ; result in hl, address still in de + ret + +;Get address of user-defined variables + +getvars: + ld hl,uservars + ret + +uservars: + dw overdrive ; .OVR etc. drive/user + dw overuser + + + if ($ - codebgn) gt ovsize +toobig: jp errval ; Overlay too large! + endif + + end + \ No newline at end of file diff --git a/Source/Apps/ZMP/zmp-ovl.upd b/Source/Apps/ZMP/zmp-ovl.upd new file mode 100644 index 00000000..b2da16ec --- /dev/null +++ b/Source/Apps/ZMP/zmp-ovl.upd @@ -0,0 +1,256 @@ + ZMP Overlay Update Information + + This file contains information on updating ZMP overlays designed for +previous versions to the current version. Newer versions appear first in +this file. + +Updates to ZMP14 Overlays for use with ZMP15. +--------------------------------------------- + + The changes required here are associated with ZMP15's ability to access +either of two UART ports, if available on the specific machine. One entry +needs to be added to the jump table, and an extra routine needs to be added +to set which port is in use. Lines which must be added to the overlay have +an asterisk at the beginning. + +1. Add an entry to the jump table. + + Add the following instruction at the end of the jump table, after the +'jp getvars' instruction and before the spare jumps: + +* jp setport ; Set the modem port being used + +2. Add the setport routine. + + The following routine should be added into the code. A good place is +immediately following the UART init code. + +*; +*; Set the port. ZMP supplies either 0 or 1 as a parameter. You're on your +*; own here -- your system is bound to be different from any other! You may +*; implement a software switch on all the modem-dependent routines, or perhaps +*; you can have one or two centralised routines for accessing the UARTs and +*; modify the code from this routine to select one or the other. (Who said +*; there was anything wrong with self-modifying code?). If you have only one +*; UART port, or if you don't want to go through all the hassles, just have +*; this routine returning with no changes made. Note that ZMP calls this +*; routine twice -- once for each port value -- on initialisation. +*; +*setport: +* ld hl,2 ; get port number +* add hl,sp +* ex de,hl +* call getparm ; in HL (values are 0 and 1) +* +* ; <== Insert your own code here +* +* ; <== End of your own code +* ret +* +*port: ds 1 +* + +End of changes ZMP14 --> ZMP15. + + -- Ron Murray + 25/3/89 + +=============================================================================== + +Updates to ZMP13 Overlays for use with ZMP14. +--------------------------------------------- + + Some changes need to be made to accommodate the user-specification +of drive/user area for the .OVR files. Changes need to be made in three +places in your overlay (asterisks at the start of lines indicate which lines +should be added): + +1. Specify the required drive/user area. + + Add the following section after the mspeed equate: + +*;Set the following two equates to the drive and user area which will contain +*; ZMP's .OVR files, .CFG file, .FON file and .HLP file. Set both to zero +*; (null) to locate them on the drive from which ZMP was invoked. +* +*overdrive equ 'A' ; Drive to find overlay files on ('A'-'P') +*overuser equ 0 ; User area to find files + +2. Add to the jump table + + Add the following instruction at the end of the jump table, after the +'jp userout' instruction and before the spare jumps: + +* jp getvars ; get system variables + + +3. Add code at the end to get the system variables: + + Add the following code just in front of the overlay size test: + +*;Get address of user-defined variables +* +*getvars: +* ld hl,uservars +* ret +* +*uservars: +* dw overdrive ; .OVR etc. drive/user +* dw overuser +* + +End of ZMP14 overlay modifications. + + -- Ron Murray, 20/11/88 + +=============================================================================== + +Updates to ZMP12 Overlays for use with ZMP13. +--------------------------------------------- + + There have been very few changes made to the overlay structure in ZMP13. +Some shuffling of module orders has allowed the origin to be set at 0145 hex, +and here it should stay (unless I fiddle with the startup code -- MOST +unlikely!). So, set your 'userdef' equate to 0145h and you should be able to +leave it there. + There is also a bug fix which should be installed in all overlays. + +1. Fix a bug in the wait routines + + Two routines in the user overlays are misnamed. You would expect wait1s +to pause for one second, and wait1ms to pause for one millisecond, wouldn't +you? Well they don't. Blame it on a lack of sleep on my part. They actually +pause for a number of seconds (milliseconds) in hl. I suggest renaming them +to waithls amd waithlms. The main consequence of this has been the pause in +the middle of the 'send break' routine: there was originally a ld hl, 1 before +the call to wait1s, but it got lost somewhere along the way. In any case, one +second is probably too long for this, and I suggest you change it to + + ld hl, 300 ; wait 300 mS + call waithlms + + There are two faults in the waithls (formerly wait1s) routine. The first +is a misplaced jr instruction that caused waits of more than 1 second to be +much longer than intended. The other concerns z80 machines with a clock speed +greater than 9 MHz: these will cause 16-bit overflow in the ld de,6667 +instruction. (It had never occurred to me that anyone would have a z80 running +at this speed!). Both these faults can be solved by replacing the whole +waithls routine with the following: + +;Wait seconds in HL +waithls: + push bc ; save bc + push de ; de + push ix ; and ix + ld ix,0 ; then point ix to 0 + ; so we don't upset memory-mapped i/o + +;Calculate values for loop constants. Need to have two loops to avoid +; 16-bit overflow with clock speeds above 9 MHz. + +outerval equ (clkspd / 10) + 1 +innerval equ (6667 / outerval) * clkspd + +wait10: + ld b,outerval + +wait11: + ld de,innerval + +wait12: + bit 0,(ix) ; time-wasters + bit 0,(ix) + bit 0,(ix) ; 20 T-states each + bit 0,(ix) + bit 0,(ix) + bit 0,(ix) + dec de + ld a,e + ld a,d + or e + jr nz,wait12 ; 150 T-states per inner loop + djnz wait11 ; decrement outer loop + dec hl ; ok, decrement count in hl + ld a,h + or l + jr nz,wait10 + pop ix ; done -- restore ix + pop de ; de + pop bc ; and bc + ret + +; End of changes to waithls routine + + The remaining changes concern baud rates. Firstly, ZMP13 will reject a +selected baud rate if the machine is not capable of it. It does this by +determining if the value in mspeed (location 3c hex) has changed. Thus if +you modify your overlay to only change 003ch (mspeed) if the new baud rate +is valid, then incorrect baud rates cannot be selected. No code is given for +this as all overlays are different. Note that the only penalty for not making +this change is that all baud rates are accepted, whether valid or not. Older +overlays always set mspeed to the new value. + In response to numerous requests (well, actually, two), ZMP13 will accept +speeds of 38400, 57600 and 76800 baud. This means that it accepts the numbers +for these -- mspeed values are 10, 11 and 12 respectively. If you think that +you can get your machine to actually work at these speeds, then go ahead. But +don't blame me if it doesn't work. (Personally, I doubt if successful +transfers in both directions with a 4 MHz machine can be done at much over +4800 baud. But don't let me stop you.) + + -- Ron Murray + 11/10/88 + + +End of changes ZMP12 --> ZMP13 +=============================================================================== + +Updates to ZMP11 Overlays for ZMP12. +------------------------------------ + + Some additions to the jump table have been made to allow for user-defined +routines to be executed on entry/exit from ZMP. Modify your overlay as +follows: + +1. Adding to the jump table + + Add the following code to the end of the jump table after the line: + + jp mswait ; wait milliseconds (Last entry of old table) + +==> Insert this stuff + jp userin ; user-defined entry routine + jp userout ; user-defined exit routine + +;Spare jumps for compatibility with future versions + jp spare ; spares for later use + jp spare ; spares for later use + jp spare ; spares for later use + jp spare ; spares for later use + jp spare ; spares for later use +==> End of inserted jump codes + +2. Adding the 'spare' code + + The following code can be added anywhere. A good idea is to put the +'spare:' label in front of an existing ret instruction. + +spare: + ret + +3. Adding the user routines + + Add the following code to your overlay. Anywhere will do. The code +you put in here depends on what you want to do. + +;User-defined entry routine: leave empty if not used +userin: + ret + +;User-defined exit routine: leave empty if not used +userout: + ret + +End of changes ZMP11 --> ZMP12 +=============================================================================== + + \ No newline at end of file diff --git a/Source/Apps/ZMP/zmp.cfg b/Source/Apps/ZMP/zmp.cfg new file mode 100644 index 00000000..1f2b0ffb --- /dev/null +++ b/Source/Apps/ZMP/zmp.cfg @@ -0,0 +1,24 @@ +1 1 0 0 0 360 + + + + + + + + + + +AT! +ATV1Q0DT +! +CONNECT +BUSY +NO CARRIER +NO ANSWER +ERROR +~+++~~ATH! +15 30 +5 N 8 1 +1400 512 F 5 50 + diff --git a/Source/Apps/ZMP/zmp.doc b/Source/Apps/ZMP/zmp.doc new file mode 100644 index 00000000..aeb5383e --- /dev/null +++ b/Source/Apps/ZMP/zmp.doc @@ -0,0 +1,389 @@ + ** ZMP Documentation ** + +1. Introduction. + + ZMP is a communications/file transfer program for CP/M which +performs Xmodem, Xmodem-1k (often erroneously called Ymodem), +true Ymodem and Zmodem file transfer protocols. Although tested +with Z80DOS, ZRDOS and CP/M 2.2, there seems to be no reason why +it shouldn't work with CP/M 3 as well. The only requirements are +a Z80 processor (sorry about that!), a computer running CP/M in +one of its various guises, with at least 45k of TPA (but the more +the better!), and a modem. + When you try to pack this many features into one program, +you end up with a pretty large file. The big problem occurs when +file transfers are attempted: unless you have at least 4-8k of +buffer size, you might as well use xmodem protocol. The approach +taken in ZMP is to use overlays for various functions, accepting +the time taken to load these from disk. Thus performance will +vary depending on your disk setup: if you have a hard disk and a +fast processor you will likely not notice the difference. If, on +the other hand, you are running a Commodore 128 with CP/M on a +1571 drive, there is no physical reason why ZMP won't work, but +you might consider investing in a book to read while the overlays +load. (A suitable book to read might be a computer catalogue!). + The curious amongst you may notice that the beginning of the +ZMPX.COM file has the magic 'Z3ENV' string, but don't let this +fool you into thinking that you don't need to add terminal +characteristics into the overlay if you have a ZCPR3 system. It +has proved possible to persuade this particular C compiler to +access ZCPR3's environment descriptor, but not for ZMP. Yet. +Perhaps later. In the meantime, the startup code is there for it. + In order to produce a program which would work with most +CP/M systems, the Zmodem protocol performed by ZMP is fairly +simple. The transmit section uses 'Full Streaming with Reverse +Interrupt', as Chuck Forsberg calls it in his description of the +Zmodem protocol. The receive section uses 'Segmented Streaming'. +This means that, if your system can do serial I/O and disk I/O at +the same time, ZMP does not take advantage of the faster transfer +rate which this capability provides. Since, however, I can't +write and listen at the same time, and neither can my computer, +and neither can the vast majority of CP/M computers, it seemed +the best approach to take. Segmented Streaming means that the +receive program tells the transmit program how big its buffer is. +The transmit program then sends just that much data, then waits +for an acknowledge from the receiver. We have encountered some +Zmodem programs which send too much data in this case: errors +will appear if this happens, but the protocol should recover and +the file will be received intact (we hope!). + The string which ZMP passes to the receiving program to +interrupt in case of errors is likewise simple. Basically it +causes the receiving program to send a control-C character and +then wait for one second. The receiver will then send its ZRPOS +string, by which time ZMP, as the transmitter, should be ready to +receive it. + + +2. Customisation. + + ZMP must be customised to suit your system. This involves +overlaying the un-installed copy of ZMP.COM (contained in this +library as ZMPX.COM) with a user-written installation overlay. +Some hints on writing this are given below; there is a blank +overlay file in this library, or you may be able to obtain one +for your computer from the same place you got this library. +This value is set at 0145 hex, and should stay there permanently. +See the notes in this document, and also the ZMP-OVL.UPD file, +for more details on how to set up your overlay. + Once the installation overlay is written, assemble it with +M80 (or SLR or whatever), use RELHEX to create a .HEX file, and +use MLOAD to overlay it over the ZMPX.COM file to produce your +very own ZMP.COM. + +3. Operation. + + The following files must be on the same disk and user area, +which must be specified in your customisation overlay: + + ZMCONFIG.OVR -- the configuration overlay + ZMINIT.OVR -- the initialisation overlay + ZMTERM.OVR -- the terminal overlay + ZMXFER.OVR -- the file transfer overlay + ZMP.HLP -- the help file (recommended). + + Start the program with ZMP. The screen should clear, then a +title message is printed, then ZMP enters terminal mode. You may +type escape-H for help at this point. When you first run the +program, the first thing you need to do is to enter the +configuration overlay (type escape-C) and set all the defaults +and others to suit your system as required. If you don't know +whether to change something or not, it's probably better to leave +it alone. When you exit the configuration program, answer 'Y' to +the 'Make changes permanent' question. ZMP.FON and ZMP.CFG will +be produced on your disk, in the same drive/user area as the +above files. + + Operation of the program is controlled by escape sequences +entered in terminal mode. Escape-H gives you a list of options. +Most of these are self-explanatory, but they will be summarized +here. + +B - Send Break to modem. + If your overlay has been set up to send a break command + to your UART, this command will perform this function. (Some + remote systems may require a break sent to them to interrupt + Zmodem transfers). + +C - Configure system. + This function is designed to set system defaults, save + phone numbers etc. Changing baud rates etc. for a particular + call are better handled with the escape-L option. If you + answer Y or y to the 'make changes permanent?' question, the + new configuration will be saved in a ZMP.CFG file, and the + phone numbers in a ZMP.FON file for later use. The .CFG file + is read, if it exists, when ZMP is first started. + +D - Get disk Directory. + Gets a directory of the current drive and user area. + Change to another with the escape-F command, described + below. The directory will be sorted and will include + filesizes unless you have so many files on the current + drive/user area that there is insufficient memory available + to sort them. In this case an unsorted directory, without + file sizes, will be printed. + +F - Disk/File operations. + This command is used to change the current drive/user + area, to reset a disk in the current drive, and to view, + erase, print or rename files. There are also options to give + a directory of the current drive/user area, and to supply a + new filename for the capture file. This filename may specify + a different drive/user area than the current one. If capture + mode is on, the status line printed when terminal mode is + entered will state the capture file name. + +H - Get Help. + Prints the ZMP.HLP file. You may then either type CR to + return to terminal mode, or enter the required function key. + +I - Initiate phone call. + Reads the ZMP.FON file, if any, and prints it. You have + four seconds after typing ESC I, during which you may enter + the letter corresponding to the required number, in which + case ZMP will dial it without printing a list. Otherwise the + full phone list will be printed, and you will be asked which + number you want. Enter the identifying letter of the number + you wish to call. You can also enter numbers not in the + list. Multiple numbers can be called by entering them separ- + ated with commas. Dialling will then commence, and will + continue until one of the numbers answers, or until you + abort the process with the escape key. Note that the baud + rate used for the call is that in the .FON file for that + number, or the current one if a new number is entered. This + function works best if the strings in the .CFG file have + been set up for your modem, and the initialisation string + sent to the modem sets it into verbose mode for status + messages (ATV1). + +K - Display Keyboard macros. + The configuration option allows up to ten macro keys to + be defined, and these are recalled by typing escape followed + by the numbers 0 to 9. This function prints the current + assignments. + +L - Change Line settings. + This function allows temporary changes of baud rate, + stop bits, and data bits. There is also an option to operate + terminal mode in full duplex (locally typed characters are + sent but not displayed on the screen), half duplex (locally + typed characters are sent and also displayed on the screen), + or echo mode (as for half duplex, but received characters + are echoed to the remote system as well as being displayed). + Don't have two computers talking to each other in echo mode + unless you're bored. There are also options to allow/dis- + allow control characters above CR to be displayed in term- + inal mode, to strip the parity bit in terminal mode, and to + re-initialise the currently selected UART and modem at the + current baud rate. + Like IMP, ZMP uses location 003C hex to store a value + corresponding to the present baud rate. Then, if you leave + ZMP and later re-enter, it checks location 003C. If it + contains a legal value, then that baud rate is set for you, + otherwise it sets the default baud rate as selected in the + .CFG file. + +M - Toggle capture mode in Memory. + Received characters will be saved in a buffer and saved + in a file named 'ZMP.LOG' when the buffer fills or when the + command is entered again. A control-S/control-Q sequence is + sent to the remote computer while the buffer is being saved + in an attempt to stop it sending more data. + +P - Toggle Printer. + This is similar to the 'M' command, except incoming + characters are sent to the printer. This functions best if + your system performs the BIOS 'List Status' function + correctly. + +Q - Quit the program. + Obvious. You will be asked if this is really what you + want. Any entry other than N or n will exit to CP/M. + +R - Receive a file. + You will be asked which protocol you wish to use. The + default is ZMODEM. The modem option will allow either + 128-byte blocks (standard XMODEM) or 1k blocks (XMODEM-1k), + since this is decided by the transmit end. If an attempt is + made to receive a file which has the same name as a file on + the current drive/user area, the current one will be renamed + to .BAK and the new one will then be received normally. + (However, see below for the transfer resumption feature in + ZMP v1.5 and above). + Note that the byte count on the screen is not kept up- + to-date on Zmodem receive. This is because the data arrives + non-stop and there is simply no time available with non- + interrupt driven computers to update the screen. An update + is performed if errors occur, and when the computer pauses + to write to the disk. + Starting with version 1.4, Zmodem file receive will + commence automatically upon receipt of the sender's ZRQINIT + string. Thus all you need to do is have the sender initiate + the transfer, select the drive and user area you wish + the file(s) to be received on, and wait.. + ZMP v1.5 adds the ability to resume an interrupted + Zmodem transfer. If a Zmodem receive attempt fails (either + because of manual cancellation or massive errors), you will + be asked if you wish to save the portion of the file already + received. If not, it will be erased. If so, and a subsequent + Zmodem receive attempt would result in a file of the same + name, you are asked if you wish to resume the transfer. If + you do, transfer will start at the end of the file. + Otherwise the old file will be renamed to .BAK as before. + Since this feature is a function of the receiver, it should + work with any Zmodem implementation which conforms + reasonably closely to Chuck Forsberg's standard. It has been + tested with ZMP and RZMP, and I would like to hear of any + programs with which it doesn't work. No attempt is made to + determine if the files are the same up to the commencement + point: the Zmodem protocol provides two ways in which this + may be determined (file date and CRC), but neither has yet + been implemented in ZMP. + +S - Send a file. + Operation is similar to the receive function. + Additional options available are ASCII send and the + capability of distinguishing between normal Xmodem and + Xmodem-1k. In Ymodem and Zmodem modes, wildcard filenames + and multiple filenames are allowed. Multiple filenames + should be entered separated by spaces. In all cases, files + on different drives/user areas may be specified by supplying + a zcpr3-style du: prefix (e.g. C7:NEATPROG.WOW). + Byte count information is displayed in Zmodem mode on + transmit. This causes noticeable breaks between packets, but + it is felt that this is outweighed by the usefulness of the + information. ZMP's Zmodem mode is capable of CRC-32 opera- + tion, although CRC-16 mode is used if the receiver is incap- + able of CRC-32. Some other terminal programs, however, do + strange things when faced with a receiving program which + claims it can do CRC-32 (we have encountered one for the + Amiga which exhibits this problem). If this happens, the + esc-L menu and the configuration overlay have an option to + disable CRC-32. + +X - Hangup. + This function causes the modem to disconnect from the + phone line, by momentarily dropping DTR. + +Y - Print screen. + Allows the current screen to be dumped to printer. Note + that this must be supported in the overlay: most terminals + are incapable of this function. The standard overlay prints + 'This function not supported.'. If you can make it work on + your system, good luck! + +Z - Clear screen. + Allows the screen to be cleared. Useful if it fills + with rubbish. + + +4. Other information. + +a) ZMP at higher baud rates. + When I first produced ZMP, I was more interested in + producing a universal Zmodem program than anything else. + Originally (several C compilers ago!) I had difficulty get- + ting it to work even at 300 baud, and so little thought was + given to accommodate higher transmission speeds. In partic- + ular, there is a "designed-in" bug/feature which would prob- + ably preclude ZMP working at much over 4800 baud. The prob- + lem is in the user overlay, in the mrd: routine. The requ- + irement here is to have a routine which returns either when + a character is available at the modem (in which case we + return TRUE), or 100 mS has elapsed (in which case we return + FALSE). The catch is that I used 100 x 1 mS waits, between + which we test for a character. A little calculation will + show that a 9600 baud character will take a little over 1 mS + to transfer, and 19200 baud characters take half this time. + Thus we are practically guaranteed to miss characters at + 19200 baud, and even 9600 baud characters leave little + processing timeto spare. Two possible ways to overcome this + are: + + i) Make the wait time shorter. Thus we could wait 1000 x + 100 uS periods instead. This, however, makes the actual + wait time more unpredictable, since subroutine + call/return times are comparable to the wait time. It + also just puts off the evil day. + + ii) Use a hardware timer to determine whether 100 mS has + elapsed. This is the preferred approach. Thus the mrd: + routine would loop continuously, exiting when either + there was a character at the modem or when the hardware + timer expired. An embryo CP/M-68K version of ZMP using + this approach has proved capable of reliable transfers + at 19,200 baud (although one must admit that it IS + running a 68010 at 10 MHz!). + + I would like to hear from anyone who has had any + success with either of these two approaches. + +5. Acknowledgements. + + ZMP was developed from Hal Maney's Heath-specific HMODEM II. +I would like to thank Hal for writing HMODEM: CP/M users have +been without ZMODEM capability for far too long. As requested in +the source file, acknowledgement is given to him therein. +Appreciations also go to the authors of the Hi-Tech C compiler, +which proved to be capable of producing fast and compact code for +Z80 machines. + ZMP in its various incarnations is refined by suggestions +from you, the user. In particular, I would like to thank Mike +Allen, Richard Kopplin and Fred Haines for their invaluable +suggestions. I may sometimes be a little slow at implementation, +but I usually get there eventually! Fred Haines has also kindly +offered to be the U.S. collection point for bug reports, +suggestions etc. His address appears at the bottom of this +document, and he'll forward them to me via what he calls 'U.S. +Snail'. I will try and respond using what I call 'Australia +Pest'. + I would also like to thank Lindsay Allen, sysop of Z-Node +62. His name was removed from the original zmp11 title screen at +his own request, since I had done most of the work in modifying +Hmodem to work on other machines. Without Lindsay's encouragement +at difficult times, suggestions as to how to go about +recalcitrant procedures, and experience in file transfers, ZMP +would not have been produced. Thank you. + + +6. Finally... + The files contained in this library are placed in the public +domain. Just don't sell it, claim you wrote it, or do anything +similar that might annoy me. Above all, don't bother trying to +sue me if it doesn't work, or you tripped over the disk, or +anything similar. I haven't distributed the source files partly +due to the size of them, partly due to the fact that compilation +is messy (several modifications were needed to "standard" library +functions!), and partly due to the fact that there's still work +to do on them. Besides, I feel a certain fatherly feeling towards +ZMP, having spent most of my spare time for the last four months +working on it. So here's the deal: I will continue to support ZMP +(and RZMP) until I get sick of it. This could take an unknown +amount of time! At that point, I will release the sources into +the RCP/M community, and you may make of them what you will. + ZMP has a remote system relative, called RZMP. This allows +Zmodem transfers to and from remote systems. It should be +available from the same place from which you obtained ZMP. + I have also produced an extremely cut-down version of ZMP +which runs under CP/M-68K, currently running quite well as a +single .68K file (no overlays!) on a system with 128k bytes of +memory. If there is enough interest from CP/M-68k users (are +there any??), I could be persuaded to upgrade this version to the +point where it could be released. + Comments and suggestions are welcome. Bug reports are not so +welcome, but we'd like them anyway! Send either to: + + Z-Node 62 + Perth, Western Australia + (061+) 09-450-0200 + (Soon to be on FidoNet) + + U.S. users may send reports/comments to: + + Fred Haines, + 733 North King's Road, Apt. 356 + Los Angeles, California 90069 + + -- Ron Murray + 26th March, 1989 +te systems. It should be +available from the same place fr diff --git a/Source/Apps/ZMP/zmp.fon b/Source/Apps/ZMP/zmp.fon new file mode 100644 index 00000000..3266618f --- /dev/null +++ b/Source/Apps/ZMP/zmp.fon @@ -0,0 +1,21 @@ +Virtual Altair altair 8 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +heatwave heatwave 8 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +Level 29 bbs.fozztexx.com 8 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +Particles BBS particles 8 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 +_________________ _________________ 9 N 8 1 0 + diff --git a/Source/Apps/ZMP/zmp.for b/Source/Apps/ZMP/zmp.for new file mode 100644 index 00000000..18f92615 --- /dev/null +++ b/Source/Apps/ZMP/zmp.for @@ -0,0 +1,13 @@ + ZMP is a communications/file transfer program for CP/M which +performs Xmodem, Xmodem-1k (often erroneously called Ymodem), +true Ymodem and Zmodem file transfer protocols. + + This library contains an un-installed ZMP.COM (called +ZMPX.COM) and five .OVR files. There is also a file called +ZMP-OVL.UPD which describes the changes which need to be made to +the user-written overlay to allow it to operate with this version +of ZMP. YOU need to read this one!! + + Details of changes made to this version are in the ZMPxx.NEW +file. + \ No newline at end of file diff --git a/Source/Apps/ZMP/zmp.hlp b/Source/Apps/ZMP/zmp.hlp new file mode 100644 index 00000000..641ab610 --- /dev/null +++ b/Source/Apps/ZMP/zmp.hlp @@ -0,0 +1,20 @@ +Commands: Precede with ESC: + +B Send break to modem +C Configure system +D Get disk directory +F File operations, change/reset disk +H Get instructions +I Initiate phone call (dial) +K Display keyboard macros +L Change line parameters (baud rate, full/half duplex/echo, UART settings) +M Toggle memory capture mode +P Toggle printer +Q Quit +R Receive a file +S Send a file +X Hangup +Y Print screen +Z Clear local screen + + \ No newline at end of file diff --git a/Source/Apps/ZMP/zmp15+-.new b/Source/Apps/ZMP/zmp15+-.new new file mode 100644 index 00000000..07e1c277 --- /dev/null +++ b/Source/Apps/ZMP/zmp15+-.new @@ -0,0 +1,27 @@ + Version 1.5+/- of ZMP now compiles and links with v3.09 of +Hi Tech C and fixes a few things that had niggled at me for +awhile (some, a few decades): + +* Datestamps transferred in Y/Zmodem transfers. +* Fixed long filename conversions on Y/Zmodem transfers. +* Fixed issues displaying baud rate and send times when the + baud rate is > 19.2K. +* Removed superfluous CR sent to the remote end when a + connection was established, which was a pita when connecting to + a Linux box. +* In keyboard macros, ! translates to a CR now, not CR/LF. +* \ escapes ! and ~ so those literal characters can be used in + keyboard macros. +* Long distance access code has been removed. +* Quick dialing letters limited to A-T. + + This version, based on the version of the source code in +ZMP-SRC.LBR, is missing a few things that made it into the later +version in ZMP15.LBR. So, to quote the original author, + +"As always, ensure that you erase your .CFG file and make a +new one with the config option. There have again been changes to +the format of this file." + +June 7, 2021 + diff --git a/Source/Apps/ZMP/zmpx.com b/Source/Apps/ZMP/zmpx.com new file mode 100644 index 00000000..69ca8392 Binary files /dev/null and b/Source/Apps/ZMP/zmpx.com differ diff --git a/Source/Apps/ZMP/zmterm.ovr b/Source/Apps/ZMP/zmterm.ovr new file mode 100644 index 00000000..ef5b3324 Binary files /dev/null and b/Source/Apps/ZMP/zmterm.ovr differ diff --git a/Source/Apps/ZMP/zmxfer.ovr b/Source/Apps/ZMP/zmxfer.ovr new file mode 100644 index 00000000..ff488465 Binary files /dev/null and b/Source/Apps/ZMP/zmxfer.ovr differ diff --git a/Source/Apps/assign.asm b/Source/Apps/assign.asm new file mode 100644 index 00000000..757859f4 --- /dev/null +++ b/Source/Apps/assign.asm @@ -0,0 +1,1979 @@ +;=============================================================================== +; ASSIGN - Display and/or modify drive letter assignments +; +;=============================================================================== +; +; Author: Wayne Warthen (wwarthen@gmail.com) +;_______________________________________________________________________________ +; +; Usage: +; ASSIGN D:[=[{D:|[]:[]}]][,...] +; ex: ASSIGN (display all active drive assignments) +; ASSIGN /? (display version and usage) +; ASSIGN /L (display all possible devices) +; ASSIGN C:=D: (swaps C: and D:) +; ASSIGN C:=FD0: (assign C: to floppy unit 0) +; ASSIGN C:=IDE0:1 (assign C: to IDE unit0, slice 1) +; ASSIGN C:= (unassign C:) +;_______________________________________________________________________________ +; +; Change Log: +; 2016-03-21 [WBW] Updated for HBIOS 2.8 +; 2016-04-08 [WBW] Determine key memory addresses dynamically +; 2019-08-07 [WBW] Fixed DPB selection error +; 2019-11-17 [WBW] Added preliminary CP/M 3 support +; 2019-12-24 [WBW] Fixed location of BIOS save area +; 2020-04-29 [WBW] Updated for larger DPH (16 -> 20 bytes) +; 2020-05-06 [WBW] Add patch level to version compare +; 2020-05-10 [WBW] Set media change flag in XDPH for CP/M 3 +; 2020-05-12 [WBW] Back out media change flag +; 2021-12-06 [WBW] Fix inverted ROM/RAM DPB mapping in buffer alloc +; 2022-02-28 [WBW] Use HBIOS to swap banks under CP/M 3 +; Use CPM3 BDOS direct BIOS call to get DRVTBL adr +;_______________________________________________________________________________ +; +; ToDo: +; 1) Do something to prevent assigning slices when device does not support them +; 2) ASSIGN C: causes drive map to be reinstalled unnecessarily +;_______________________________________________________________________________ +; +;=============================================================================== +; Definitions +;=============================================================================== +; +stksiz .equ $40 ; Working stack size +; +restart .equ $0000 ; CP/M restart vector +bdos .equ $0005 ; BDOS invocation vector +bnksel .equ $FFF3 ; HBIOS bank select vector +; +stamp .equ $40 ; loc of RomWBW CBIOS zero page stamp +; +#include "../ver.inc" +; +;=============================================================================== +; Code Section +;=============================================================================== +; + .org $100 +; + ; relocate to high memory + ld hl,image + ld de,$8000 + ld bc,modsize + ldir + jp start +; +image .equ $ +; + .org $8000 +; +start: +; + ; setup stack (save old value) + ld (stksav),sp ; save stack + ld sp,stack ; set new stack +; + ; initialization + call init ; initialize + jr nz,exit ; abort if init fails +; + ; do the real work + call process ; parse and process command line + jr nz,exit ; done if error or no action +; + ; perform table integrity check + call valid + jr nz,exit +; + ; install the new drive map if changes were made + ld a,(modcnt) ; get the mod count + or a ; set flags + call nz,install ; install new drive map +; +exit: ; clean up and return to command processor + call crlf ; formatting + ld sp,(stksav) ; restore stack + jp restart ; return to CP/M via restart + ret ; return to CP/M w/o restart +; +; Initialization +; +init: +; + ; locate start of cbios (function jump table) + ld hl,(restart+1) ; load address of CP/M restart vector + ld de,-3 ; adjustment for start of table + add hl,de ; HL now has start of table + ld (bioloc),hl ; save it +; + ; get CP/M version and save it + ld c,$0C ; function number + call bdos ; do it, HL := version + ld (cpmver),hl ; save it + ;push hl ; *debug* + ;pop bc ; *debug* + ;call prthexword ; *debug* + ;ld a,l ; low byte + ;cp $30 ; CP/M 3.0? +; + ; get location of config data and verify integrity + ld hl,stamp ; HL := adr or RomWBW zero page stamp + ld a,(hl) ; get first byte of RomWBW marker + cp 'W' ; match? + jp nz,errinv ; abort with invalid config block + inc hl ; next byte (marker byte 2) + ld a,(hl) ; load it + cp ~'W' ; match? + jp nz,errinv ; abort with invalid config block + inc hl ; next byte (major/minor version) + ld a,(hl) ; load it + cp RMJ << 4 | RMN ; match? + jp nz,errver ; abort with invalid os version + inc hl ; next byte (update/patch) + ld a,(hl) ; load it + and $F0 ; eliminate patch num + cp RUP << 4 ; match? + jp nz,errver ; abort with invalid os version + inc hl ; bump past version info +; + ; dereference HL to point to CBIOS extension data + ld a,(hl) ; dereference HL + inc hl ; ... to point to + ld h,(hl) ; ... ROMWBW config data block + ld l,a ; ... in CBIOS +; + ; skip device map address + inc hl ; bump two bytes + inc hl ; ... past device map address entry +; + ; get location of drive map + ld e,(hl) ; dereference HL + inc hl ; ... into DE to get + ld d,(hl) ; ... drive map pointer + inc hl ; skip past drive map pointer + ld (maploc),de ; and save it +; + ; get location of dpbmap + ld e,(hl) ; dereference HL + inc hl ; ... into DE to get + ld d,(hl) ; ... DPB map pointer + ld (dpbloc),de ; and save it +; + ; test for CP/M 3 and branch if so + ld a,(cpmver) ; low byte of cpm version + cp $30 ; CP/M 3.0? + jp nc,initcpm3 ; handle CP/M 3.0 or greater +; + ; make a local working copy of the drive map + ld hl,(maploc) ; copy from CBIOS drive map + ld de,mapwrk ; copy to working drive map + dec hl ; point to entry count + ld a,(hl) ; get entry count + inc hl ; restore hl pointer to drive map start + add a,a ; multiple a by + add a,a ; ... size of entries (4 bytes each) + ld c,a ; set BC := 0A + ld b,0 ; ... so BC is length to copy + ldir ; do the copy +; + ; determine end of CBIOS (assume HBIOS for now) + ld hl,($FFFE) ; get proxy start address + ld (bioend),hl ; save as CBIOS end address +; + ; check for UNA (UBIOS) + ld a,($FFFD) ; fixed location of UNA API vector + cp $C3 ; jp instruction? + jr nz,initx ; if not, not UNA + ld hl,($FFFE) ; get jp address + ld a,(hl) ; get byte at target address + cp $FD ; first byte of UNA push ix instruction + jr nz,initx ; if not, not UNA + inc hl ; point to next byte + ld a,(hl) ; get next byte + cp $E5 ; second byte of UNA push ix instruction + jr nz,initx ; if not, not UNA + ld hl,unamod ; point to UNA mode flag + ld (hl),$FF ; set UNA mode flag + ld c,$F1 ; UNA func: Get HMA + rst 08 ; call UNA, HL := UNA proxy start address + ld (bioend),hl ; save as CBIOS end address +; +initx: + ; compute size of CBIOS + ld hl,(bioend) ; HL := end address + ld de,(bioloc) ; DE := starting address + xor a ; clear carry + sbc hl,de ; subtract to get size in HL + ld (biosiz),hl ; and save it +; + ; establish heap limit + ld hl,(bioend) ; HL := end of CBIOS address + ld de,-$40 ; allow 40 bytes for CBIOS stack + add hl,de ; adjust + ld (heaplim),hl ; save it +; +#if 0 + ld a,' ' + call crlf + ld bc,(bioloc) + call prthexword + call prtchr + ld bc,(bioend) + call prthexword + call prtchr + ld bc,(maploc) + call prthexword + call prtchr + ld bc,(heaplim) + call prthexword + +#endif +; + ; return success + xor a ; signal success + ret ; return +; +; CP/M 3 initialization +; +initcpm3: + ld a,22 ; XBIOS DRVTBL function + call xbios ; Invoke XBIOS + ld (drvtbl),hl ; save DRVTBL address +; +; The CP/M 3 drvtbl is in common memory, but the XDPHs are not. +; So, here we temporarily swap the bank to the CP/M 3 system +; bank. We cannot use the CP/M Direct BIOS call because it +; explicitly blocks use of SELMEM, so we are forced to use +; HBIOS call. The CP/M 3 system bank is always the HBIOS +; user bank. +; + ; switch to sysbnk + ld a,($FFE0) ; get current bank + push af ; save it + ld bc,$F8F2 ; HBIOS Get Bank Info + rst 08 ; call HBIOS, E=User Bank + ld a,e ; HBIOS User Bank + call bnksel ; HBIOS BNKSEL +; + ; copy CP/M 3 drvtbl to drvmap working copy + ld hl,(drvtbl) ; get drive table in HL + ld de,mapwrk ; DE := working drive map + ld b,16 +initc2: + push hl ; save drvtbl entry adr + ld a,(hl) ; deref HL to get DPH adr + inc hl ; ... + ld h,(hl) ; ... + ld l,a ; ... + ld a,l ; check for + or h ; ... zero + jr nz,initc3 ; if not zero, copy entry + inc de ; ... else bump past unit field + jr initc4 ; ... and continue without copying +initc3: + dec hl ; back up to + dec hl ; ... unit + ld a,(hl) ; get unit from drvtbl + ld (de),a ; save unit to drvmap + inc hl ; bump to slice + inc de ; bump to slice + ld a,(hl) ; get slice from drvtbl + ld (de),a ; save slice to drvmap +initc4: + inc de ; bump past slice + inc de ; skip + inc de ; ... dph + pop hl ; back to drvtbl entry + inc hl ; bump to + inc hl ; ... next drvtbl entry + djnz initc2 +; + ; switch back to tpabnk + pop af ; recover prev bank + call bnksel ; HBIOS BNKSEL +; + ; return success + xor a ; signal success + ret ; return +; +; Process command line +; +process: +; + ; look for start of parms + ld hl,$81 ; point to start of parm area (past len byte) + call nonblank ; skip to next non-blank char + jp z,showall ; no parms, show all active assignments +; + ; check for special option, introduced by a "/" + cp '/' ; start of usage request? + jp z,option ; yes, handle option +; +process0: +; + sub 'A' ; make it binary + ld (dstdrv),a ; save it as destination drive + inc hl ; next char + ld a,(hl) ; get it + cp ':' ; is it ':' as expected? + jp nz,errprm ; error if not + inc hl ; skip ':' + call nonblank ; skip possible blanks + cp '=' ; proper delimiter? + jr z,process1 ; yes, continue + + ld de,drvshow ; show the drive + ld a,(dstdrv) ; load the drive + jr process4 ; do it +; +process1: ; handle other side of '=' +; + inc hl ; skip '=' + call nonblank ; skip blanks as needed + ld de,drvdel ; assume a drive delete + jp z,process4 ; continue to processing + cp ',' ; comma? + jp z,process4 ; continue to processing + call getalpha ; gobble all alpha characters + dec b ; decrement num chars parsed + jr nz,process2 ; more than 1 char, handle as device name +; + ; handle as drive swap + cp ':' ; check for mandatory trailing colon + jp nz,errprm ; handle unexpected character + inc hl ; skip ':' + ld a,(tmpstr) ; get the drive letter + sub 'A' ; make it binary + ld (srcdrv),a ; assume it is a src drv and save it + ld de,drvswap ; put routine to call in DE + jr process4 ; and continue +; +process2: ; handle a device/slice assignment +; + call getnum ; get number from buffer + jp c,errnum ; abort on overflow + cp 16 ; compare to max + jp nc,errnum ; abort if too high + ld (unit),a ; save it as unit num + ld a,(hl) ; get terminating char + cp ':' ; check for mandatory colon + jp nz,errprm ; handle unexpected character + inc hl ; skip past colon + call getnum ; get number from buffer + jp c,errnum ; abort on overflow + ld (slice),a ; save it as slice num + ld de,drvmap ; put routine to call in DE + jr process4 ; and continue +; +process4: ; check for terminating null or comma +; + call nonblank ; skip possible blanks + jr z,process5 ; null terminator OK + cp ',' ; check for comma + jr z,process5 ; also OK + jp errprm ; otherwise parm error +; +process5: ; do the processing +; + ex de,hl ; move routine to call to HL + push de ; save command string pointer + call jphl ; do the work + pop hl ; recover command string pointer + ret nz ; abort on error + ld a,(hl) ; get the current cmd string char + or a ; set flags + ret z ; if null, we are done + inc hl ; otherwise, skip comma + call nonblank ; and possible blanks after comma + ret z ; get out if nothing more + jp process0 ; we have more work, loop +; +; Handle special options +; +option: +; + inc hl ; next char + ld a,(hl) ; get it + cp '?' ; is it a '?' as expected? + jp z,usage ; yes, display usage + cp 'L' ; is it a 'L', display device list? + jp z,devlist ; yes, display device list + jp errprm ; anything else is an error +; +usage: +; + call crlf ; formatting + ld de,msgban1 ; point to version message part 1 + call prtstr ; print it + ld de,msg22 ; assume CP/M 2.2 + ld a,(cpmver) ; low byte of ver + cp $30 ; CP/M 3.0? + jp c,usage1 ; if not, jump ahead + ld de,msg3 ; CP/M 3 +usage1: + call prtstr + ld de,msbban2 ; next portion of banner + call prtstr + ld a,(unamod) ; get UNA flag + or a ; set flags + ld de,msghb ; point to HBIOS mode message + call z,prtstr ; if not UNA, say so + ld de,msgub ; point to UBIOS mode message + call nz,prtstr ; if UNA, say so + call crlf ; formatting + ld de,msgban3 ; point to version message part 2 + call prtstr ; print it + call crlf2 ; blank line + ld de,msguse ; point to usage message + call prtstr ; print it + or $FF ; signal no action performed + ret ; and return +; +devlist: +; + ld a,(unamod) ; get UNA mode flag + or a ; set flags + jr nz,devlstu ; do UNA mode dev list +; + ld b,$F8 ; hbios func: sysget + ld c,$10 ; sysget subfunc: diocnt + rst 08 ; call hbios, E := device count + ld b,e ; use device count for loop count + ld c,0 ; use C for device index +devlist1: + call crlf ; formatting + ld de,indent ; indent + call prtstr ; ... to look nice + push bc ; preserve loop control + ld a,c ; device to A + call prtdev ; print device mnemonic + ld a,':' ; colon for device/unit format + call prtchr ; print it + pop bc ; restore loop control + inc c ; next device index + djnz devlist1 ; loop as needed + or $FF ; signal no action taken + ret ; done +; +devlstu: + ; UNA mode device list + ld b,0 ; use unit 0 to get count + ld c,$48 ; una func: get disk type + ld l,0 ; preset unit count to zero + rst 08 ; call una, b is assumed to be untouched!!! + ld a,l ; unit count to a + or a ; set flags + ret z ; no units, return + ld b,l ; unit count to b + ld c,0 ; init unit index +devlstu1: + call crlf ; formatting + ld de,indent ; indent + call prtstr ; ... to look nice + push bc ; save loop control vars + ld a,c ; put unit num in A + push af ; save it + call prtdevu ; print the device name + pop af ; restore unit num + call prtdecb ; print unit num + ld a,':' ; colon delimiter + call prtchr ; print it + pop bc ; restore loop control + inc c ; next drive + djnz devlstu1 ; loop as needed + ret ; return +; +; Install the new drive map into CBIOS +; +install: + ld a,(cpmver) ; low byte of CP/M version + cp $30 ; CP/M 3.0? + jp nc,instcpm3 ; handle CP/M 3.0 or greater +; + ; capture CBIOS snapshot and stack frame for error recovery + ld hl,(bioloc) ; start of CBIOS + ld de,$1000 ; save it here + ld bc,(biosiz) ; size of CBIOS + ldir ; save it + ld (xstksav),sp ; save stack frame + ; clear CBIOS buffer area + ld hl,(maploc) ; start fill at drive map + ld a,(bioend + 1) ; msb of CBIOS end address to A +install1: + ld e,0 ; fill with null + ld (hl),e ; fill next byte + inc hl ; point to next byte + cp h ; is H == msb of CBIOS end address? + jr nz,install1 ; if not, loop +; + ; determine the drive map entry count + ld hl,mapwrk + ld c,0 + ld b,16 +install2: + ld a,$FF + cp (hl) + jr z,install3 + ld e,c ; remember high water mark +install3: + inc hl + inc hl + inc hl + inc hl + inc c + djnz install2 + inc e ; convert from max value to count +; + ; record entry count in CBIOS + ld hl,(maploc) ; start of map + dec hl ; backup to entry count + ld (hl),e ; record count +; + ; copy map + ld a,e ; A := entry count + add a,a ; multiply by size + add a,a ; ... of entry (4 bytes) + ld c,a ; put in C for count + ld b,0 ; msb of count is always zero + ld hl,mapwrk ; source of copy is work map + ld de,(maploc) ; target is CBIOS map loc + ldir ; do it +; + ; set start of memory allocation heap + ld (heaptop),de ; DE has next byte available +; + ; allocate directory buffer + ld hl,128 ; size of directory buffer + call alloc ; allocate the space + jp c,instovf ; handle overflow error + ld (dirbuf),hl ; ... and save in dirbuf +; +dph_init: +; +; iterate through drive map to build dph entries dynamically +; + ; setup for dph build loop + ld hl,(maploc) ; 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: + ; no DPH if drive not assigned + ld a,(hl) + cp $FF + jr nz,dph_init2 + ld de,0 ; not assigned, use DPH pointer of zero + jr dph_init3 +; +dph_init2: + ld a,(hl) ; unit to A + push bc ; save loop control + push hl ; save drive map pointer + ;ld hl,16 ; size of a DPH structure + ld hl,20 ; size of a DPH structure + call alloc ; allocate space for dph + jp c,instovf ; handle overflow error + push hl ; save DPH location + push hl ; move DPH location + pop de ; ... to DE + call makdph ; make the DPH, unit in A from above + pop de ; restore DPH pointer to DE + pop hl ; restore drive map pointer to HL + pop bc ; restore loop control +; +dph_init3: + inc hl ; bump to slice loc + inc hl ; bump to DPH pointer lsb + ld (hl),e ; save lsb + inc hl ; bump to DPH pointer msb + ld (hl),d ; save msb + inc hl ; bump to start of next drive map entry + inc c ; next drive index + djnz dph_init1 ; loop as needed +; + ; display free memory + call crlf2 + ld de,indent + call prtstr + ld hl,(heaplim) ; subtract high water + ld de,(heaptop) ; ... from top of cbios + or a ; ... with cf clear + sbc hl,de ; ... so hl gets bytes free + call prtdecw ; print it + ld de,msgmem ; add description + call prtstr ; and print it +; + call drvrst ; perform BDOS drive reset +; + xor a ; signal success + ret ; done +; +makdph: +; +; make a dph at address in de for dev/unit in a +; + push de ; save incoming dph address +; + ld c,a ; save incoming dev/unit + ld a,(unamod) ; get UNA mode flag + or a ; set flags + ld a,c ; restore incoming dev/unit + jr nz,makdphuna ; do UNA mode + jr makdphwbw ; do WBW mode +; +makdphuna: ; determine appropriate dpb (WBW mode) + ld b,a ; unit num to b + ld c,$48 ; una func: get disk type + rst 08 ; call una + ld a,d ; move disk type to a +; + ; derive dpb address based on disk type + cp $40 ; ram/rom drive? + jr z,makdphuna1 ; handle ram/rom drive if so +; cp $?? ; floppy drive? +; jr z,xxxxx ; handle floppy + ld e,4 ; assume hard disk + jr makdph0 ; continue +; +makdphuna1: ; handle ram/rom + ld c,$45 ; una func: get disk info + ld de,$9000 ; 512 byte buffer *** fix!!! *** + rst 08 ; call una + bit 7,b ; test ram drive bit + ld e,1 ; assume rom + jr z,makdph0 ; not set, rom drive, continue + ld e,2 ; otherwise, must be ram drive + jr makdph0 ; continue +; +makdphwbw: ; determine appropriate dpb (WBW mode, unit number in A) +; + ld c,a ; unit number to C + ld b,$17 ; HBIOS: Report Device Info + rst 08 ; call HBIOS, return w/ device type in D, physical unit in E + ld a,d ; device type to A + cp $00 ; ram/rom? + jr nz,makdph00 ; if not, skip ahead to other types + ld a,e ; physical unit number to A + ld e,1 ; assume rom + cp $01 ; rom? + jr z,makdph0 ; yes, jump ahead + ld e,2 ; otherwise ram + jr makdph0 ; jump ahead +makdph00: + ld e,6 ; assume floppy + cp $10 ; floppy? + jr z,makdph0 ; yes, jump ahead + ld e,3 ; assume ram floppy + cp $20 ; ram floppy? + jr z,makdph0 ; yes, jump ahead + ld e,4 ; everything else is assumed to be hard disk + jr makdph0 ; yes, jump ahead +; +makdph0: + ld hl,(dpbloc) ; point to start of dpb table in CBIOS + ld a,e ; get index of target DPB to A + add a,a ; each entry is two bytes + call addhl ; add offset for desired DPB address + ld e,(hl) ; dereference HL + inc hl ; into DE, so DE + ld d,(hl) ; has address of target DPB +; +makdph1: +; + ; build the dph + pop hl ; hl := start of dph + ld a,8 ; size of dph reserved area + call addhl ; 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: + ; DE = address of CKS or ALS buf to allocate + ; HL = address of field in DPH to get allocated address + push hl ; save DPH field ptr + pop bc ; into BC +; + ; HL := alloc size, DE bumped + ex de,hl + ld e,(hl) ; get size to allocate + inc hl ; ... + ld d,(hl) ; ... into HL + inc hl ; and bump DE + ex de,hl +; + ; check for size of zero, special case + ld a,h ; check to see + or l ; ... if hl is zero + jr z,makdph3 ; if so, jump ahead using hl as address +; + ; allocate memory + call alloc ; do the allocation + jp c,instovf ; bail out on overflow + +makdph3: + ; swap hl and bc + push bc ; bc -> (sp) + ex (sp),hl ; (sp) -> hl, hl -> (sp) + pop bc ; (sp) -> bc +; + ; save allocated address + 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 +; +; +; +instcpm3: + ; swicth to sysbnk + ld a,($FFE0) ; get current bank + push af ; save it + ld bc,$F8F2 ; HBIOS Get Bank Info + rst 08 ; call HBIOS, E=User Bank + ld a,e ; HBIOS User Bank + call $FFF3 ; HBIOS BNKSEL +; + ; copy drvmap working copy to CP/M 3 drvtbl + ld hl,(drvtbl) ; get drvtbl address + ld a,(hl) ; deref HL to get DPH0 adr + inc hl ; ... + ld h,(hl) ; ... + ld l,a ; ... + ld (dphadr),hl ; save starting dphadr + + + ld hl,(drvtbl) ; get drive table in HL + ld de,mapwrk ; DE := working drive map + ld b,16 +instc1: + ld a,(de) ; get unit field of mapwrk + inc a ; test for $FF + jr nz,instc2 ; if used, do copy + xor a ; zero accum + ld (hl),a ; zero lsb of drvtbl entry adr + inc hl ; move to msb + ld (hl),a ; zero msb of drvtbl entry adr + inc hl ; bump to start of next drvtbl entry + inc de ; bump to next mapwrk entry + inc de ; ... + inc de ; ... + inc de ; ... + jr instc3 ; resume loop without copy +; +instc2: + push hl ; save drvtbl entry adr + push de ; save mapwrk entry adr + ld de,(dphadr) ; get cur dph adr + ld (hl),e ; save dph adr to drvtbl + inc hl ; ... + ld (hl),d ; ... + ex de,hl ; dph adr to HL + pop de ; restore mapwrk entry adr + dec hl ; backup to unit + dec hl ; ... + ld a,(de) ; get unit from mapwrk + ld (hl),a ; put unit into DPH field + inc de ; bump to slice field of mapwrk + inc hl ; bump to slice field of DPH field + ld a,(de) ; get slice from mapwrk + ld (hl),a ; put slice into DPH field +; ld a,11 ; media byte is 11 bytes ahead +; call addhl ; bump HL to media byte adr +; or $FF ; use $FF to signify media change +; ld (hl),a ; set media flag byte + inc de ; bump to next mapwrk entry + inc de ; ... + inc de ; ... + pop hl ; back to drvtbl entry + inc hl ; bump to + inc hl ; ... next drvtbl entry +instc3: + push hl ; save drvtbl entry adr + push de ; save mapwrk entry adr + ld hl,(dphadr) ; get cur dph address + ld de,$27 ; size of xdph + add hl,de ; bump to next dph + ld (dphadr),hl ; save it + pop de ; recover mapwrk entry adr + pop hl ; recover drvtbl entry adr + djnz instc1 +; + ; switch back to tpabnk + pop af ; recover prev bank + call $FFF3 ; HBIOS BNKSEL +; + ; set SCB drive door open flag + ld a,$54 ; SCB drive door opened flag + ld (scboff),a ; set offset parm + or $FF ; SCB operation, $FF = set + ld (scbop),a ; set operation parm + ld (scbval),a ; set value parm to $FF + ld c,$31 ; get/set system control block + ld de,scbpb ; scb parameter block adr + call bdos +; + call drvrst ; perform BDOS drive reset +; + xor a ; signal success + ret +; +; Handle overflow error in installation +; +instovf: + ; restore stack frame and CBIOS image + ld sp,(xstksav) ; restore stack frame + ld hl,$1000 ; start of CBIOS image buffer + ld de,(bioloc) ; start of CBIOS + ld bc,(biosiz) ; size of CBIOS + ldir ; restore it + jp errovf +; +; Allocate HL bytes from heap +; Return pointer to allocated memory in HL +; On overflow error, C set +; +alloc: + push de ; save de so we can use it for work reg + ld de,(heaptop) ; get current heap top + push de ; and save for return value + add hl,de ; add requested space, hl := new heap top + jr c,allocx ; test for cpu memory space overflow + ld de,(heaplim) ; load de with heap limit + ex de,hl ; de=new heaptop, hl=heaplim + sbc hl,de ; heaplim - heaptop + jr c,allocx ; c set on overflow error + ; allocation succeeded, commit new heaptop + ld (heaptop),de ; save new heaptop +allocx: + pop hl ; return value to hl + pop de ; recover de + ret +; +; Scan drive map table for integrity +; Currently just checks for multiple drive +; letters referencing a single file system +; +valid: + ld hl,mapwrk ; point to working drive map table + ld b,16 - 1 ; loop one less times than num entries +; + ; check that drive A: is assigned + ld a,$FF ; value that indicates unassigned + cp (hl) ; compare to A: value + jp z,errnoa ; handle failure +; +valid1: ; outer loop +; call crlf + push hl ; save pointer + push bc ; save loop control + call valid2 ; do the inner loop + pop bc ; restore loop control + pop hl ; restore pointer + jp z,errint ; validation error + ld a,4 ; 4 bytes per entry + call addhl ; bump to next entry + djnz valid1 ; loop until done + xor a ; signal OK + ret ; done +; +valid2: ; setup for inner loop + push hl ; save HL + ld a,4 ; 4 bytes per entry + call addhl ; point to entry following + pop de ; de points to comparison entry +; +valid3: ; inner loop + ; bypass unassigned drives (only need to test 1) + ld a,(hl) ; get first drive unit in A + cp $FF ; unassigned? + jr z,valid4 ; yes, skip +; + ; compare unit/slice values + ld a,(de) ; first byte to A + cp (hl) ; compare + jr nz,valid4 ; if not equal, continue loop + inc de ; bump DE to next byte + inc hl ; bump HL to next byte + ld a,(de) ; first byte to A + cp (hl) ; compare + ret z ; both bytes equal, return signalling problem + dec de ; point DE back to first byte of comparison entry + dec hl ; point HL back +; +valid4: ; no match, loop + inc hl + inc hl ; bump HL + inc hl ; ... to + inc hl ; ... next entry + or $FF ; no match + djnz valid3 ; loop as appropriate + ret +; +; Show a specific drive assignment +; +drvshow: + ld a,(dstdrv) ; get the drive num + call chkdrv ; valid drive letter? + ret nz ; abort if not + call showone ; show it + xor a ; signal success + ret ; done +; +; Delete (unassign) drive +; +drvdel: + ld a,(dstdrv) ; get the dest drive (to be unassigned) + call chkdrv ; valid drive letter? + ret nz ; abort if not + ; point to correct entry in drive map + ld hl,mapwrk ; point to working drive map + ld a,(dstdrv) ; get drive letter to remove + rlca ; calc table offset + rlca ; ... as drive num * 4 + call addhl ; get final table offset + ; wipe out the drive letter + ld a,$FF ; dev/unit := $FF (unassigned) + ld (hl),a ; do it + xor a ; zero accum + inc hl ; slice := 0 + ld (hl),a ; do it + inc hl ; DPH pointer lsb := 0 + ld (hl),a ; do it + inc hl ; DPH pointer msb := 0 + ld (hl),a ; do it + ; done + ld a,(dstdrv) ; get the destination + call showone ; show it + ld hl,modcnt ; point to mod count + inc (hl) ; increment it + xor a ; signal success + ret +; +; Swap the source and destination drive letters +; +drvswap: + ld a,(dstdrv) ; get the destination drive + call chkdrv ; valid drive? + ret nz ; abort if not + ld a,(srcdrv) ; get the source drive + call chkdrv ; valid drive? + ret nz ; abort if not + ld hl,(drives) ; load source/dest in DE + ld a,h ; put source drive num in a + cp l ; compare to the dest drive num + jp z,errswp ; Invalid swap request, src == dest +; + ; Get pointer to source drive table entry + ld hl,mapwrk + ld a,(srcdrv) + rlca + rlca + call addhl + ld (srcptr),hl +; + ; Get pointer to destination drive table entry + ld hl,mapwrk + ld a,(dstdrv) + rlca + rlca + call addhl + ld (dstptr),hl +; + ; 1) dest -> temp + ld hl,(dstptr) + ld de,tmpent + ld bc,4 + ldir +; + ; 2) source -> dest + ld hl,(srcptr) + ld de,(dstptr) + ld bc,4 + ldir +; + ; 3) temp -> source + ld hl,tmpent + ld de,(srcptr) + ld bc,4 + ldir +; + ; print the results + ld a,(dstdrv) ; get the destination + call showone ; show it + ld a,(srcdrv) ; get the source drive + call showone ; show it +; + ld hl,modcnt ; point to mod count + inc (hl) ; increment it + xor a ; signal success + ret ; exit +; +; Assign drive to specified unit/slice +; +drvmap: + ; check for UNA mode + ld a,(unamod) ; get UNA mode flag + or a ; set flags + jr nz,drvmapu ; do UNA mode drvmap +; + ; determine device code by scanning for string + ld b,16 ; device table always has 16 entries + ld c,0 ; c is used to track table entry num + ld de,tmpstr ; de points to specified device name + ld hl,devtbl ; hl points to first entry of devtbl +; +drvmap1: ; loop through device table looking for a match + push hl ; save device table entry pointer + ld a,(hl) ; dereference HL + inc hl ; ... to point to + ld h,(hl) ; ... string + ld l,a ; ... in device table + push de ; save string pointer + push bc ; save loop control stuff + call strcmp ; compare strings + pop bc ; restore loop control stuff + pop de ; restore de + pop hl ; restore table entry pointer + jr z,drvmap2 ; match, continue + inc hl ; bump to next + inc hl ; device table pointer + inc c ; keep track of table entry num + djnz drvmap1 ; and loop + jp errdev +; +drvmap2: + ; convert index to device type id + ld a,c ; index to accum + rlca ; move it to upper nibble + rlca ; ... + rlca ; ... + rlca ; ... + ld (device),a ; save as device id +; + ; loop thru hbios units looking for device type/unit match + ld b,$F8 ; hbios func: sysget + ld c,$10 ; sysget subfunc: diocnt + rst 08 ; call hbios, E := device count + ld b,e ; use device count for loop count + ld c,0 ; use C for device index +drvmap3: + push bc ; preserve loop control + ld b,$17 ; hbios func: diodevice + rst 08 ; call hbios, D := device, E := unit + pop bc ; restore loop control + ld a,(device) + cp d + jr nz,drvmap4 + ld a,(unit) + cp e + jr z,drvmap5 ; match, continue, C = BIOS unit +drvmap4: + ; continue looping + inc c + djnz drvmap3 + jp errdev ; invalid device specified +; +drvmap5: + ; check for valid unit (supported by BIOS) + push bc ; save unit + ld a,c ; unit to A + call chkdev ; check validity + pop bc ; restore unit + ret nz ; bail out on error + + ; resolve the CBIOS DPH table entry + ld a,(dstdrv) ; dest drv num to A + call chkdrv ; valid drive? + ret nz ; abort if invalid + ld hl,mapwrk ; point to start of drive map + rlca ; multiply by + rlca ; ... entry size of 4 + call addhl ; adjust HL to point to entry + ld (dstptr),hl ; save it +; + ; shove updated unit/slice into the entry + ld (hl),c ; save unit byte + inc hl ; bump to next byte + ld a,(slice) + ld (hl),a ; save slice +; + ; finish up + ld a,(dstdrv) ; get the destination drive + call showone ; show it's new value + ld hl,modcnt ; point to mod count + inc (hl) ; increment it + xor a ; signal success + ret ; exit +; +; UNA mode drive mapping +; +drvmapu: +; + ; verify the device nmeumonic + ld a,(unit) ; get unit specified + ld b,a ; put in b + ld d,0 ; preset type to 0 + ld c,$48 ; una func: get disk type + rst 08 ; call una, b is assumed to be untouched!!! + ld a,d ; resultant device type to a + cp $40 ; RAM/ROM + jr z,drvmapu0 ; special case for RAM/ROM + ld de,udevide ; assume IDE + cp $41 ; IDE? + jr z,drvmapu1 ; do compare + ld de,udevppide ; assume PPIDE + cp $42 ; PPIDE? + jr z,drvmapu1 ; do compare + ld de,udevsd ; assume SD + cp $43 ; SD? + jr z,drvmapu1 ; do compare + ld de,udevdsd ; assume DSD + cp $44 ; DSD? + jr z,drvmapu1 ; do compare + jp errdev ; error, invalid device name +; +drvmapu0: + ; handle RAM/ROM + ld a,(unit) ; get unit specified + ld b,a ; unit num to B + ld c,$45 ; UNA func: get disk info + ld de,$9000 ; 512 byte buffer *** FIX!!! *** + rst 08 ; call UNA + bit 7,b ; test RAM drive bit + ld de,udevrom ; assume ROM + jr z,drvmapu1 ; do compare + ld de,udevram ; assume RAM + jr drvmapu1 ; do compare + jp errdev ; error, invalid device name +; +drvmapu1: + ld hl,tmpstr ; point HL to specified device name + call strcmp ; compare + jp nz,errdev ; no match, invalid device name +; + ; check for valid unit (supported by BIOS) + ld a,(unit) ; get specified unit + call chkdevu ; check validity + jp nz,errdev ; invalid device specified +; + ; resolve the CBIOS DPH table entry + ld a,(dstdrv) ; dest drv num to A + call chkdrv ; valid drive? + ret nz ; abort if invalid + ld hl,mapwrk ; point to start of drive map + rlca ; multiply by + rlca ; ... entry size of 4 + call addhl ; adjust HL to point to entry + ld (dstptr),hl ; save it +; + ; shove updated unit/slice into the entry + ld a,(unit) ; get specified unit + ld (hl),a ; save it + inc hl ; next byte is slice + ld a,(slice) ; get specified slice + ld (hl),a ; save it +; + ; finish up + ld a,(dstdrv) ; get the destination drive + call showone ; show it's new value + ld hl,modcnt ; point to mod count + inc (hl) ; increment it + xor a ; signal success + ret +; +; Display all active drive letter assignments +; +showall: + ld b,16 ; 16 drives possible + ld c,0 ; map index (drive letter) +; + ld a,b ; load count + or $FF ; signal no action + ret z ; bail out if zero +; +showall1: ; loop + ld a,c ; + push bc ; save loop control + call showass + pop bc ; restore loop control + inc c + djnz showall1 + or $FF + ret +; +; Display drive letter assignment IF it is assigned +; Drive num in A +; +showass: +; + ; setup HL to point to desired entry in table + ld c,a ; save incoming drive in C + ld hl,mapwrk ; HL = address of drive map + rlca + rlca + call addhl ; HL = address of drive map table entry + ld a,(hl) ; get unit value + cp $FF ; compare to unassigned value + ld a,c ; recover original drive num + ret z ; bail out if unassigned drive + ; fall thru to display drive +; +; Display drive letter assignment for the drive num in A +; +showone: +; + push af ; save the incoming drive num +; + call crlf ; formatting +; + ld de,indent ; indent + call prtstr ; ... to look nice +; + ; setup HL to point to desired entry in table + pop af + push af + ld hl,mapwrk ; HL = address of drive map + rlca + rlca + call addhl ; HL = address of drive map table entry + pop af +; + ; render the drive letter based on table index + add a,'A' ; convert to alpha + call prtchr ; print it + ld a,':' ; conventional color after drive letter + call prtchr ; print it + ld a,'=' ; use '=' to represent assignment + call prtchr ; print it +; + ; render the map entry + ld a,(hl) ; load unit + cp $FF ; empty? + ret z ; yes, bypass + push hl ; preserve HL + call prtdev ; print device mnemonic + ld a,':' ; colon for device/unit format + call prtchr ; print it + pop hl ; recover HL + inc hl ; point to slice num + ld a,(hl) ; load slice num + call prtdecb ; print it +; + ret +; +; Force BDOS to reset (logout) all drives +; +drvrst: + ld c,$0D ; BDOS Reset Disk function + call bdos ; do it +; + ld c,$25 ; BDOS Reset Multiple Drives + ld de,$FFFF ; all drives + call bdos ; do it +; + xor a ; signal success + ret +; +; Print device mnemonic based on device number in A +; +prtdev: + ld e,a ; stash incoming device num in E + ld a,(unamod) ; get UNA mode flag + or a ; set flags + ld a,e ; put device num back + jr nz,prtdevu ; print device in UNA mode + ld b,$17 ; hbios func: diodevice + ld c,a ; unit to C + rst 08 ; call hbios, D := device, E := unit + push de ; save results + ld a,d ; device to A + rrca ; isolate high nibble (device) + rrca ; ... + rrca ; ... + rrca ; ... into low nibble + and $0F ; mask out undesired bits + push hl ; save HL + add a,a ; multiple A by two for word table + ld hl,devtbl ; point to start of device name table + call addhl ; 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 prtstr ; print the device nmemonic + pop hl ; restore HL + pop de ; get device/unit data back + ld a,e ; device id to a + call prtdecb ; print it + ret ; done +; +prtdevu: + push bc + push de + push hl +; + ; UNA mode version of print device + ld b,a ; B := unit num + push bc ; save for later + ld c,$48 ; UNA func: get disk type + rst 08 ; call UNA + ld a,d ; disk type to A + pop bc ; get unit num back in C +; + ; pick string based on disk type + cp $40 ; RAM/ROM? + jr z,prtdevu1 ; if so, handle it + cp $41 ; IDE? + ld de,udevide ; load string + jr z,prtdevu2 ; if IDE, print and return + cp $42 ; PPIDE? + ld de,udevppide ; load string + jr z,prtdevu2 ; if PPIDE, print and return + cp $43 ; SD? + ld de,udevsd ; load string + jr z,prtdevu2 ; if SD, print and return + cp $44 ; DSD? + ld de,udevdsd ; load string + jr z,prtdevu2 ; if DSD, print and return + ld de,udevunk ; load string for unknown + jr prtdevu2 ; and print it +; +prtdevu1: + ; handle RAM/ROM + push bc ; save unit num + ld c,$45 ; UNA func: get disk info + ld de,$9000 ; 512 byte buffer *** FIX!!! *** + rst 08 ; call UNA + bit 7,b ; test RAM drive bit + pop bc ; restore unit num + ld de,udevrom ; load string + jr z,prtdevu2 ; print and return + ld de,udevram ; load string + jr prtdevu2 ; print and return +; +prtdevu2: + call prtstr ; print the device nmemonic + ld a,b ; get the unit num back + call prtdecb ; append it + pop hl + pop de + pop bc + ret +; +; Check that specified drive num is valid +; +chkdrv: + cp 16 ; max of 16 drive letters + jp nc,errdrv ; handle bad drive + cp a ; set Z to signal good + ret ; and return +; +; Check that the unit value in A is valid +; according to active BIOS support. +; +; +chkdev: ; HBIOS variant + push af ; save incoming unit + ld b,$F8 ; hbios func: sysget + ld c,$10 ; sysget subfunc: diocnt + rst 08 ; call hbios, E := device count + pop af ; restore incoming unit + cp e ; compare to unit count + jp nc,errdev ; if too high, error +; + ; get device/unit info + ld b,$17 ; hbios func: diodevice + ld c,a ; unit to C + rst 08 ; call hbios, D := device, E := unit + ld a,d ; device to A +; + ; check slice support + cp $30 ; A has device/unit, in hard disk range? + jr c,chkdev1 ; if not hard disk, check slice val + xor a ; otherwise, signal OK + ret +; +chkdev1: ; not a hard disk, make sure slice == 0 + ld a,(slice) ; get specified slice + or a ; set flags + jp nz,errslc ; invalid slice error + xor a ; signal OK + ret +; +chkdevu: ; UNA variant + ld b,a ; put in b + ld d,0 ; preset type to 0 + ld c,$48 ; una func: get disk type + rst 08 ; call una + ld a,d ; resultant device type to a + or a ; set flags + jp z,errdev ; invalid if 0 +; + ; check for slice support, if required + cp $40 ; ram/rom? + jr z,chkdevu1 ; yes, check for slice +; cp $?? ; floppy? +; jr z,chkdevu1 ; yes, check for slice + xor a ; otherwise signal success + ret ; and return +; +chkdevu1: + ld a,(slice) ; get specified slice + or a ; set flags + jp nz,errslc ; invalid slice error + xor a ; otherwise, signal OK + ret ; and return +; +; Print character in A without destroying any registers +; +prtchr: + push bc ; save registers + push de + push hl + ld e,a ; character to print in E + ld c,$02 ; BDOS function to output a character + call bdos ; do it + pop hl ; restore registers + pop de + pop bc + ret +; +prtdot: +; + ; shortcut to print a dot preserving all regs + push af ; save af + ld a,'.' ; load dot char + call prtchr ; print it + pop af ; restore af + ret ; done +; +; Print a zero terminated string at (HL) without destroying any registers +; +prtstr: + push de +; +prtstr1: + ld a,(de) ; get next char + or a + jr z,prtstr2 + call prtchr + inc de + jr prtstr1 +; +prtstr2: + pop de ; restore registers + ret +; +; Print the value in A in hex without destroying any registers +; +prthex: + push af ; save AF + push de ; save DE + call hexascii ; convert value in A to hex chars in DE + ld a,d ; get the high order hex char + call prtchr ; print it + ld a,e ; get the low order hex char + call prtchr ; print it + pop de ; restore DE + pop af ; restore AF + ret ; done +; +; print the hex word value in bc +; +prthexword: + push af + ld a,b + call prthex + ld a,c + call prthex + pop af + ret +; +; Convert binary value in A to ascii hex characters in DE +; +hexascii: + ld d,a ; save A in D + call hexconv ; convert low nibble of A to hex + ld e,a ; save it in E + ld a,d ; get original value back + rlca ; rotate high order nibble to low bits + rlca + rlca + rlca + call hexconv ; convert nibble + ld d,a ; save it in D + ret ; done +; +; Convert low nibble of A to ascii hex +; +hexconv: + and $0F ; low nibble only + add a,$90 + daa + adc a,$40 + daa + ret +; +; Print value of A or HL in decimal with leading zero suppression +; Use prtdecb for A or prtdecw for HL +; +prtdecb: + push hl + ld h,0 + ld l,a + call prtdecw ; print it + pop hl + ret +; +prtdecw: + push af + push bc + push de + push hl + call prtdec0 + pop hl + pop de + pop bc + pop af + ret +; +prtdec0: + ld e,'0' + ld bc,-10000 + call prtdec1 + ld bc,-1000 + call prtdec1 + ld bc,-100 + call prtdec1 + ld c,-10 + call prtdec1 + ld e,0 + ld c,-1 +prtdec1: + ld a,'0' - 1 +prtdec2: + inc a + add hl,bc + jr c,prtdec2 + sbc hl,bc + cp e + ret z + ld e,0 + call prtchr + ret +; +; Print a byte buffer in hex pointed to by DE +; Register A has size of buffer +; +prthexbuf: + or a + ret z ; empty buffer +; + ld b,a +prthexbuf1: + ld a,' ' + call prtchr + ld a,(de) + call prthex + inc de + djnz prthexbuf1 + ret +; +; Start a new line +; +crlf2: + call crlf ; two of them +crlf: + push af ; preserve AF + ld a,13 ; + call prtchr ; print it + ld a,10 ; + call prtchr ; print it + pop af ; restore AF + ret +; +; Get the next non-blank character from (HL). +; +nonblank: + ld a,(hl) ; load next character + or a ; string ends with a null + ret z ; if null, return pointing to null + cp ' ' ; check for blank + ret nz ; return if not blank + inc hl ; if blank, increment character pointer + jr nonblank ; and loop +; +; Check character at (DE) for delimiter. +; +delim: or a + ret z + cp ' ' ; blank + ret z + jr c,delim1 ; handle control characters + cp '=' ; equal + ret z + cp '_' ; underscore + ret z + cp '.' ; period + ret z + cp ':' ; colon + ret z + cp $3B ; semicolon + ret z + cp '<' ; less than + ret z + cp '>' ; greater than + ret +delim1: + ; treat control chars as delimiters + xor a ; set Z + ret ; return +; +; Get alpha chars and save in tmpstr +; return with terminating char in A and flags set +; return with num chars in B +; +getalpha: +; + ld de,tmpstr ; location to save chars + ld b,0 ; length counter +; +getalpha1: + ld a,(hl) ; get active char + cp 'A' ; check for start of alpha range + jr c,getalpha2 ; not alpha, get out + cp 'Z' + 1 ; check for end of alpha range + jr nc,getalpha2 ; not alpha, get out + ; handle alpha char + inc hl ; increment buffer ptr + ld (de),a ; save it + inc de ; inc string pointer + inc b ; inc string length + ld a,b ; put length in A + cp 8 ; max length? + jr z,getalpha2 ; if max, get out + jr getalpha1 ; and loop +; +getalpha2: ; non-alpha, clean up and return + xor a ; clear accum + ld (de),a ; terminate string + ld a,(hl) ; recover terminating char + or a ; set flags + ret ; and done +; +; Get numeric chars and convert to number returned in A +; Carry flag set on overflow +; +getnum: + ld c,0 ; C is working register +getnum1: + ld a,(hl) ; get the active char + cp '0' ; compare to ascii '0' + jr c,getnum2 ; abort if below + cp '9' + 1 ; compare to ascii '9' + jr nc,getnum2 ; abort if above\ +; + ; valid digit, add new digit to C + ld a,c ; get working value to A + rlca ; multiply by 10 + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + add a,c ; ... + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + ld c,a ; back to C + ld a,(hl) ; get new digit + sub '0' ; make binary + add a,c ; add in working value + ret c ; overflow, return with carry set + ld c,a ; back to C +; + inc hl ; bump to next char + jr getnum1 ; loop +; +getnum2: ; return result + ld a,c ; return result in A + or a ; with flags set, CF is cleared + ret +; +; Compare null terminated strings at HL & DE +; If equal return with Z set, else NZ +; +strcmp: +; + ld a,(de) ; get current source char + cp (hl) ; compare to current dest char + ret nz ; compare failed, return with NZ + or a ; set flags + ret z ; end of string, match, return with Z set + inc de ; point to next char in source + inc hl ; point to next char in dest + jr strcmp ; loop till done +; +; Invoke CBIOS function +; The CBIOS function offset must be stored in the byte +; following the call instruction. ex: +; call cbios +; .db $0C ; offset of CONOUT CBIOS function +; +cbios: + ex (sp),hl + ld a,(hl) ; get the function offset + inc hl ; point past value following call instruction + ex (sp),hl ; put address back at top of stack and recover HL + ld hl,(bioloc) ; address of CBIOS function table to HL + call addhl ; determine specific function address + jp (hl) ; invoke CBIOS +; +; Routine to call CPM3 BIOS routines via BDOS +; function 50. +; +xbios: + ld (biofnc),a ; set BIOS function + ld c,50 ; direct BIOS call function + ld (dereg),de ; set DE parm + ld de,biospb ; BIOS parameter block + jp bdos ; invoke BDOS +; +biospb: +biofnc .db 0 ; BIOS function +areg .db 0 ; A register +bcreg .dw 0 ; BC register +dereg .dw 0 ; DE register +hlreg .dw 0 ; HL register +; +; Add the value in A to HL (HL := HL + A) +; +addhl: + add a,l ; A := A + L + ld l,a ; Put result back in L + ret nc ; if no carry, we are done + inc h ; if carry, increment H + ret ; and return +; +; Jump indirect to address in HL +; +jphl: + jp (hl) +; +; Errors +; +erruse: ; command usage error (syntax) + ld de,msguse + jr err +; +errprm: ; command parameter error (syntax) + ld de,msgprm + jr err +; +errinv: ; invalid CBIOS, zp signature not found + ld de,msginv + jr err +; +errver: ; CBIOS version is not as expected + ld de,msgver + jr err +; +errdrv: ; Invalid drive letter specified + push af + call crlf + ld de,msgdrv1 + call prtstr + pop af + add a,'A' + call prtchr + ld de,msgdrv2 + jr err1 +; +errswp: ; invalid drive swap request + ld de,msgswp + jr err +; +errdev: ; invalid device name + ld de,msgdev + jr err +; +errslc: ; invalid slice + ld de,msgslc + jr err +; +errtyp: ; invalid device assignment request (not a hard disk device type) + ld de,msgtyp + jr err +; +errnum: ; invalid number parsed, overflow + ld de,msgnum + jr err +; +errint: ; DPH table integrity error (multiple drives ref one filesystem) + ld de,msgint + jr err +; +errnoa: ; No A: drive assignment + ld de,msgnoa + jr err +; +errovf: ; CBIOS disk buffer overflow + ld de,msgovf + jr err +; +errdos: ; handle BDOS errors + push af ; save return code + call crlf ; newline + ld de,msgdos ; load + call prtstr ; and print error string + pop af ; recover return code + call prthex ; print error code + jr err2 +; +err: ; print error string and return error signal + call crlf2 ; print double newline +; +err1: ; without the leading crlf + call prtstr ; print error string +; +err2: ; without the string +; call crlf ; print newline + or $FF ; signal error + ret ; done +; +;=============================================================================== +; Storage Section +;=============================================================================== +; +; +bioloc .dw 0 ; CBIOS starting address +bioend .dw 0 ; CBIOS ending address +biosiz .dw 0 ; CBIOS size (in bytes) +maploc .dw 0 ; location of CBIOS drive map table +dpbloc .dw 0 ; location of CBIOS DPB map table +cpmver .dw 0 ; CP/M version +drvtbl .dw 0 ; CP/M 3 drive table address +dphadr .dw 0 ; CP/M 3 working value for DPH +; +drives: +dstdrv .db 0 ; destination drive +srcdrv .db 0 ; source drive +device .db 0 ; source device +unit .db 0 ; source unit +slice .db 0 ; source slice +; +unamod .db 0 ; $FF indicates UNA UBIOS active +modcnt .db 0 ; count of drive map modifications +; +srcptr .dw 0 ; source pointer for copy +dstptr .dw 0 ; destination pointer for copy +tmpent .fill 4,0 ; space to save a table entry +tmpstr .fill 9,0 ; temporary string of up to 8 chars, zero term +; +heaptop .dw 0 ; current address of top of heap memory +heaplim .dw 0 ; heap limit address +; +dirbuf .dw 0 ; directory buffer location +; +scbpb: ; BDOS SCB get/set parm block +scboff .db $54 ; media open door flag +scbop .db $FF ; set a byte +scbval .dw $FF ; value to set +; +mapwrk .fill (4 * 16),$FF ; working copy of drive map +; +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 "?",0 +dev00 .db "MD",0 +dev01 .db "FD",0 +dev02 .db "RAMF",0 +dev03 .db "IDE",0 +dev04 .db "ATAPI",0 +dev05 .db "PPIDE",0 +dev06 .db "SD",0 +dev07 .db "PRPSD",0 +dev08 .db "PPPSD",0 +dev09 .db "HDSK",0 +dev10 .equ devunk +dev11 .equ devunk +dev12 .equ devunk +dev13 .equ devunk +dev14 .equ devunk +dev15 .equ devunk +; +devcnt .equ 10 ; 10 devices defined +; +udevram .db "RAM",0 +udevrom .db "ROM",0 +udevide .db "IDE",0 +udevppide .db "PPIDE",0 +udevsd .db "SD",0 +udevdsd .db "DSD",0 +udevunk .db "UNK",0 +; +stksav .dw 0 ; stack pointer saved at start +xstksav .dw 0 ; temp stack save for error recovery + .fill stksiz,0 ; stack +stack .equ $ ; stack top +; +; Messages +; +indent .db " ",0 +msgban1 .db "ASSIGN v1.5 for RomWBW CP/M ",0 +msg22 .db "2.2",0 +msg3 .db "3",0 +msbban2 .db ", 28-Feb-2022",0 +msghb .db " (HBIOS Mode)",0 +msgub .db " (UBIOS Mode)",0 +msgban3 .db "Copyright 2021, Wayne Warthen, GNU GPL v3",0 +msguse .db "Usage: ASSIGN D:[=[{D:|[]:[]}]][,...]",13,10 + .db " ex. ASSIGN (display all active assignments)",13,10 + .db " ASSIGN /? (display version and usage)",13,10 + .db " ASSIGN /L (display all possible devices)",13,10 + .db " ASSIGN C:=D: (swaps C: and D:)",13,10 + .db " ASSIGN C:=FD0: (assign C: to floppy unit 0)",13,10 + .db " ASSIGN C:=IDE0:1 (assign C: to IDE unit0, slice 1)",13,10 + .db " ASSIGN C:= (unassign C:)",0 +msgprm .db "Parameter error (ASSIGN /? for usage)",0 +msginv .db "Unexpected CBIOS (signature missing)",0 +msgver .db "Unexpected CBIOS version",0 +msgdrv1 .db "Invalid drive letter (",0 +msgdrv2 .db ":)",0 +msgswp .db "Invalid drive swap request",0 +msgdev .db "Invalid device name (ASSIGN /L for device list)",0 +msgslc .db "Specified device does not support slices",0 +msgnum .db "Unit or slice number invalid",0 +msgovf .db "Disk buffer exceeded in CBIOS, aborted",0 +msgtyp .db "Only hard drive devices can be reassigned",0 +msgint .db "Multiple drive letters reference one filesystem, aborting!",0 +msgnoa .db "Drive A: is unassigned, aborting!",0 +msgdos .db "DOS error, return code=0x",0 +msgmem .db " Disk Buffer Bytes Free",0 +; +modsize .equ $ - start +; + .end diff --git a/Source/Apps/cpuspd/Build.cmd b/Source/Apps/cpuspd/Build.cmd new file mode 100644 index 00000000..1e3fe0a5 --- /dev/null +++ b/Source/Apps/cpuspd/Build.cmd @@ -0,0 +1,10 @@ +@echo off +setlocal + +set TOOLS=../../../Tools +set PATH=%TOOLS%\tasm32;%PATH% +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF cpuspd.asm cpuspd.com cpuspd.lst || exit /b + +copy /Y cpuspd.com ..\..\..\Binary\Apps\ || exit /b diff --git a/Source/Apps/cpuspd/Clean.cmd b/Source/Apps/cpuspd/Clean.cmd new file mode 100644 index 00000000..9ecb428f --- /dev/null +++ b/Source/Apps/cpuspd/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.lst del *.lst +if exist *.bin del *.bin diff --git a/Source/Apps/cpuspd/Makefile b/Source/Apps/cpuspd/Makefile new file mode 100644 index 00000000..c8025816 --- /dev/null +++ b/Source/Apps/cpuspd/Makefile @@ -0,0 +1,7 @@ +OBJECTS = cpuspd.com +DEST = ../../../Binary/Apps +TOOLS =../../../Tools + +USETASM=1 + +include $(TOOLS)/Makefile.inc \ No newline at end of file diff --git a/Source/Apps/cpuspd/cpuspd.asm b/Source/Apps/cpuspd/cpuspd.asm new file mode 100644 index 00000000..722131c4 --- /dev/null +++ b/Source/Apps/cpuspd/cpuspd.asm @@ -0,0 +1,705 @@ +; +;======================================================================= +; HBIOS CPU Speed Selection Tool +;======================================================================= +; +; Simple utility that sets CPU speed on RomWBW systems that support +; software speed selection. +; +;======================================================================= +; +#include "../../HBIOS/hbios.inc" +; +#include "../../ver.inc" +; +; General operational equates (should not requre adjustment) +; +stksiz .equ $40 ; Working stack size +; +cpumhz .equ 30 ; for time delay calculations (not critical) +; +rtc_port .equ $70 ; RTC latch port adr +; +restart .equ $0000 ; CP/M restart vector +bdos .equ $0005 ; BDOS invocation vector +; +ident .equ $FFFE ; loc of RomWBW HBIOS ident ptr +; +;======================================================================= +; + .org $100 ; standard CP/M executable +; +; + ; setup stack (save old value) + ld (stksav),sp ; save stack + ld sp,stack ; set new stack +; + call crlf + ld de,str_banner ; banner + call prtstr +; + ; initialization + call init ; initialize + jr nz,exit ; abort if init fails +; + call main ; do the real work +; +exit: + ; clean up and return to command processor + call crlf ; formatting + ld sp,(stksav) ; restore stack + jp restart ; return to CP/M via restart +; +; +;======================================================================= +; Main Program +;======================================================================= +; +; +; Initialization +; +init: + ; check for UNA (UBIOS) + ld a,($FFFD) ; fixed location of UNA API vector + cp $C3 ; jp instruction? + jr nz,initwbw ; if not, not UNA + ld hl,($FFFE) ; get jp address + ld a,(hl) ; get byte at target address + cp $FD ; first byte of UNA push ix instruction + jr nz,initwbw ; if not, not UNA + inc hl ; point to next byte + ld a,(hl) ; get next byte + cp $E5 ; second byte of UNA push ix instruction + jr nz,initwbw ; if not, not UNA + jp err_una ; UNA not supported +; +initwbw: + ; get location of config data and verify integrity + ld hl,(ident) ; HL := adr or RomWBW HBIOS ident + ld a,(hl) ; get first byte of RomWBW marker + cp 'W' ; match? + jp nz,err_inv ; abort with invalid config block + inc hl ; next byte (marker byte 2) + ld a,(hl) ; load it + cp ~'W' ; match? + jp nz,err_inv ; abort with invalid config block + inc hl ; next byte (major/minor version) + ld a,(hl) ; load it + cp rmj << 4 | rmn ; match? + jp nz,err_ver ; abort with invalid os version +; +initz: + ; initialization complete + xor a ; signal success + ret ; return +; +; +; +main: + ; skip to start of first parm + ld ix,$81 ; point to start of parm area (past len byte) + call nonblank ; skip to next non-blank char + jp z,show_spd ; no parms, show current settings +; +main1: + ; process options (if any) + cp '/' ; option prefix? + jr nz,main2 ; not an option, continue + call option ; process option + ret nz ; some options mean we are done (e.g., "/?") + inc ix ; skip option character + call nonblank ; skip whitespace + jr main1 ; continue option checking +; +main2: + ret z ; if end, nothing to do + cp ',' ; no new speed? + jr z,main2a ; go to wait states + ; parse speed string (half, full, double) + call getalpha ; extract speed ("HALF", "FULL", "DOUBLE") + call parse_spd ; parse to numeric + jp c,err_parm ; if invalid, abort + ld (new_cpu_spd),a ; save it + call nonblank ; skip whitespace + jp z,set_spd ; if nothing else, set new speed + cp ',' ; parm separator + jp nz,err_parm ; invalid format, show usage and abort +main2a: + inc ix ; pass separator + call nonblank ; skip whitespace + jp z,set_spd ; if nothing else, set new speed + call isnum ; start of parm? + jr c,main3 ; nope, try skipping this parm + call getnum ; get memory wait states + jp c,err_parm ; if overflow, show usage and abort + ld (new_ws_mem),a ; save memory wait states +; +main3: + call nonblank ; skip whitespace + jp z,set_spd ; if nothing else, set new speed + cp ',' ; parm separator + jp nz,err_parm ; invalid format, show usage and abort + inc ix ; pass separator + call nonblank ; skip whitespace + jp z,set_spd ; if nothing else, set new speed + call getnum ; get I/O wait states + jp c,err_parm ; if overflow, show usage and abort + ld (new_ws_io),a ; save memory wait states +; + call nonblank ; skip whitespace + jp nz,err_parm ; invalid format, show usage and abort + jp set_spd ; set new speed and return +; +parse_spd: + ld a,(tmpstr) ; first byte of string + ld c,0 ; assume half speed + cp 'H' ; check it + jr z,parse_spd1 ; if equal, done + ld c,1 ; assume full speed + cp 'F' ; check it + jr z,parse_spd1 ; if equal, done + ld c,2 ; assume double speed + cp 'D' ; check it + jr z,parse_spd1 ; if equal, done + or a ; clear CF + ccf ; set CF to indicate error + ret +parse_spd1: + ld a,c ; result to a + or a ; clear CF + ret +; +set_spd: + call delay + ld b,BF_SYSSET + ld c,BF_SYSSET_CPUSPD + ld a,(new_cpu_spd) + ld l,a + ld a,(new_ws_mem) + ld d,a + ld a,(new_ws_io) + ld e,a + rst 08 + jp nz,err_not_sup + call show_spd + xor a + ret +; +show_spd: + ld b,BF_SYSGET + ld c,BF_SYSGET_CPUINFO + rst 08 + jp nz,err_not_sup + call crlf2 + ld (cpu_spd),de ; save CPU speed for now + push bc ; Oscillator speed to HL + pop hl + ld de,str_spacer + call prtstr + call prtd3m ; print it + ld de,str_oscspd + call prtstr + ld b,BF_SYSGET + ld c,BF_SYSGET_CPUSPD + rst 08 + jp nz,err_not_sup + push de ; save wait states for now + ld a,l + ld de,str_slow + cp 0 + jr z,show_spd1 + ld de,str_full + cp 1 + jr z,show_spd1 + ld de,str_dbl + cp 2 + jr z,show_spd1 + jp err_invalid +show_spd1: + call crlf + call prtstr + ld hl,(cpu_spd) ; recover CPU speed + call prtd3m + ld de,str_cpuspd + call prtstr + pop hl + ld a,h ; memory wait states + cp $FF + jr z,show_spd2 + call crlf + ld de,str_spacer + call prtstr + call prtdecb + ld de,str_memws + call prtstr +; +show_spd2: + ld a,l + cp $FF + jr z,show_spd3 + call crlf + ld de,str_spacer + call prtstr + call prtdecb + ld de,str_iows + call prtstr +; +show_spd3: + ret +; +; Handle special options +; +option: +; + inc ix ; next char + ld a,(ix) ; get it + cp '?' ; is it a '?' as expected? + jp z,usage ; yes, display usage + jp err_parm ; anything else is an error + +usage: + call crlf2 + ld de,str_usage + call prtstr + or $FF + ret +; +; Error Handlers +; +err_una: + ld de,str_err_una + jr err_ret +err_inv: + ld de,str_err_inv + jr err_ret +err_ver: + ld de,str_err_ver + jr err_ret +err_parm: + ld de,str_err_parm + jr err_ret +err_not_sup: + ld de,str_err_not_sup + jr err_ret +err_invalid: + ld de,str_err_invalid + jr err_ret +; +err_ret: + call crlf2 + call prtstr + or $FF ; signal error + ret +; +;======================================================================= +; Utility Routines +;======================================================================= +; +; +; Print character in A without destroying any registers +; +prtchr: + push af + push bc ; save registers + push de + push hl + ld e,a ; character to print in E + ld c,$02 ; BDOS function to output a character + call bdos ; do it + pop hl ; restore registers + pop de + pop bc + pop af + ret +; +; Print a dot character without destroying any registers +; +prtdot: + ; shortcut to print a dot preserving all regs + push af ; save af + ld a,'.' ; load dot char + call prtchr ; print it + pop af ; restore af + ret ; done +; +; Print a zero terminated string at (de) without destroying any registers +; +prtstr: + push af + push de +; +prtstr1: + ld a,(de) ; get next char + or a + jr z,prtstr2 + call prtchr + inc de + jr prtstr1 +; +prtstr2: + pop de ; restore registers + pop af + ret +; +; Print a hex value prefix "0x" +; +prthexpre: + push af + ld a,'0' + call prtchr + ld a,'x' + call prtchr + pop af + ret +; +; Print the value in A in hex without destroying any registers +; +prthex: + call prthexpre +prthex1: + push af ; save AF + push de ; save DE + call hexascii ; convert value in A to hex chars in DE + ld a,d ; get the high order hex char + call prtchr ; print it + ld a,e ; get the low order hex char + call prtchr ; print it + pop de ; restore DE + pop af ; restore AF + ret ; done +; +; print the hex word value in hl +; +prthexword: + call prthexpre +prthexword1: + push af + ld a,h + call prthex1 + ld a,l + call prthex1 + pop af + ret +; +; print the hex dword value in de:hl +; +prthex32: + call prthexpre + push bc + push de + pop bc + call prthexword1 + push hl + pop bc + call prthexword1 + pop bc + ret +; +; Convert binary value in A to ascii hex characters in DE +; +hexascii: + ld d,a ; save A in D + call hexconv ; convert low nibble of A to hex + ld e,a ; save it in E + ld a,d ; get original value back + rlca ; rotate high order nibble to low bits + rlca + rlca + rlca + call hexconv ; convert nibble + ld d,a ; save it in D + ret ; done +; +; Convert low nibble of A to ascii hex +; +hexconv: + and $0F ; low nibble only + add a,$90 + daa + adc a,$40 + daa + ret +; +; Print value of A or HL in decimal with leading zero suppression +; Use prtdecb for A or prtdecw for HL +; +prtdecb: + push hl + ld h,0 + ld l,a + call prtdecw ; print it + pop hl + ret +; +prtdecw: + push af + push bc + push de + push hl + call prtdec0 + pop hl + pop de + pop bc + pop af + ret +; +prtdec0: + ld e,'0' + ld bc,-10000 + call prtdec1 + ld bc,-1000 + call prtdec1 + ld bc,-100 + call prtdec1 + ld c,-10 + call prtdec1 + ld e,0 + ld c,-1 +prtdec1: + ld a,'0' - 1 +prtdec2: + inc a + add hl,bc + jr c,prtdec2 + sbc hl,bc + cp e + ret z + ld e,0 + call prtchr + ret +; +; Print value of HL as thousandths, ie. 0.000 +; +prtd3m: + push bc + push de + push hl + ld e,'0' + ld bc,-10000 + call prtd3m1 + ld e,0 + ld bc,-1000 + call prtd3m1 + call prtdot + ld bc,-100 + call prtd3m1 + ld c,-10 + call prtd3m1 + ld c,-1 + call prtd3m1 + pop hl + pop de + pop bc + ret +prtd3m1: + ld a,'0' - 1 +prtd3m2: + inc a + add hl,bc + jr c,prtd3m2 + sbc hl,bc + cp e + jr z,prtd3m3 + ld e,0 + call prtchr +prtd3m3: + ret + + + +; +; Get the next non-blank character from (HL). +; +nonblank: + ld a,(ix) ; load next character + or a ; string ends with a null + ret z ; if null, return pointing to null + cp ' ' ; check for blank + ret nz ; return if not blank + inc ix ; if blank, increment character pointer + jr nonblank ; and loop +; +; Get alpha chars and save in tmpstr +; Length of string returned in A +; +getalpha: +; + ld hl,tmpstr ; location to save chars + ld b,8 ; length counter (tmpstr max chars) + ld c,0 ; init character counter +; +getalpha1: + ld a,(ix) ; get active char + call ucase ; lower case -> uppper case, if needed + cp 'A' ; check for start of alpha range + jr c,getalpha2 ; not alpha, get out + cp 'Z' + 1 ; check for end of alpha range + jr nc,getalpha2 ; not alpha, get out + ; handle alpha char + ld (hl),a ; save it + inc c ; bump char count + inc hl ; inc string pointer + inc ix ; increment buffer ptr + djnz getalpha1 ; if space, loop for more chars +; +getalpha2: ; non-alpha, clean up and return + ld (hl),0 ; terminate string + ld a,c ; string length to A + or a ; set flags + ret ; and return +; +; Determine if byte in A is a numeric '0'-'9' +; Return with CF clear if it is numeric +; +isnum: + cp '0' + jr c,isnum1 ; too low + cp '9' + 1 + jr nc,isnum1 ; too high + or a ; clear CF + ret +isnum1: + or a ; clear CF + ccf ; set CF + ret + +; +; Get numeric chars and convert to number returned in A +; Carry flag set on overflow +; +getnum: + ld c,0 ; C is working register +getnum1: + ld a,(ix) ; get the active char + cp '0' ; compare to ascii '0' + jr c,getnum2 ; abort if below + cp '9' + 1 ; compare to ascii '9' + jr nc,getnum2 ; abort if above +; + ; valid digit, add new digit to C + ld a,c ; get working value to A + rlca ; multiply by 10 + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + add a,c ; ... + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + ld c,a ; back to C + ld a,(ix) ; get new digit + sub '0' ; make binary + add a,c ; add in working value + ret c ; overflow, return with carry set + ld c,a ; back to C +; + inc ix ; bump to next char + jr getnum1 ; loop +; +getnum2: ; return result + ld a,c ; return result in A + or a ; with flags set, CF is cleared + ret +; +; Start a new line +; +crlf2: + call crlf ; two of them +crlf: + push af ; preserve AF + ld a,13 ; + call prtchr ; print it + ld a,10 ; + call prtchr ; print it + pop af ; restore AF + ret +; +; Convert character in A to uppercase +; +ucase: + cp 'a' ; if below 'a' + ret c ; ... do nothing and return + cp 'z' + 1 ; if above 'z' + ret nc ; ... do nothing and return + res 5,a ; clear bit 5 to make lower case -> upper case + ret ; and return +; +; Add hl,a +; +; A register is destroyed! +; +addhla: + add a,l + ld l,a + ret nc + inc h + ret +; +; Delay ~10ms +; +delay: + push af + push de + ld de,625 ; 10000us/16us +delay0: + ld a,cpumhz - 2 +delay1: + dec a + jr nz,delay1 + dec de + ld a,d + or e + jp nz,delay0 + pop de + pop af + ret +; +; +;======================================================================= +; Constants +;======================================================================= +; +str_banner .db "RomWBW CPU Speed Selector v0.5, 2-Feb-2022",0 +str_spacer .db " ",0 +str_oscspd .db " MHz Oscillator",0 +str_slow .db " CPU speed is HALF (",0 +str_full .db " CPU speed is FULL (",0 +str_dbl .db " CPU speed is DOUBLE (",0 +str_cpuspd .db " MHz)",0 +str_memws .db " Memory Wait State(s)",0 +str_iows .db " I/O Wait State(s)",0 +str_err_una .db " ERROR: UNA not supported by application",0 +str_err_inv .db " ERROR: Invalid BIOS (signature missing)",0 +str_err_ver .db " ERROR: Unexpected HBIOS version",0 +str_err_parm .db " ERROR: Parameter error (CPUSPD /? for usage)",0 +str_err_not_sup .db " ERROR: Platform or configuration not supported!",0 +str_err_invalid .db " ERROR: Invalid configuration!",0 +str_usage .db " Usage: CPUSPD ,,\r\n" + .db "\r\n" + .db " : \"Half\", \"Full\", or \"Double\"\r\n" + .db " : Memory wait states\r\n" + .db " : I/O wait states\r\n" + .db "\r\n" + .db " Any parameter may be omitted\r\n" + .db " Ability to set values varies by system\r\n",0 +; +;======================================================================= +; Working data +;======================================================================= +; +stksav .dw 0 ; stack pointer saved at start + .fill stksiz,0 ; stack +stack .equ $ ; stack top +; +; +tmpstr .fill 9,0 ; temp string (8 chars, 0 term) +cpu_spd .dw 0 ; current cpu speed +new_cpu_spd .db $FF ; new CPU speed +new_ws_mem .db $FF ; new memory wait states +new_ws_io .db $FF ; new I/O wait states + + +; +;======================================================================= +; + .end \ No newline at end of file diff --git a/Source/Apps/Decode.asm b/Source/Apps/decode.asm similarity index 100% rename from Source/Apps/Decode.asm rename to Source/Apps/decode.asm diff --git a/Source/Apps/Encode.asm b/Source/Apps/encode.asm similarity index 100% rename from Source/Apps/Encode.asm rename to Source/Apps/encode.asm diff --git a/Source/Apps/Format.asm b/Source/Apps/format.asm similarity index 100% rename from Source/Apps/Format.asm rename to Source/Apps/format.asm diff --git a/Source/Apps/mode.asm b/Source/Apps/mode.asm new file mode 100644 index 00000000..0a52ee69 --- /dev/null +++ b/Source/Apps/mode.asm @@ -0,0 +1,1039 @@ +;=============================================================================== +; MODE - Display and/or modify device configuration +; +;=============================================================================== +; +; Author: Wayne Warthen (wwarthen@gmail.com) +;_______________________________________________________________________________ +; +; Usage: +; MODE /? +; MODE COM: [[,[,[,]]]] [/P] +; +; is numerical baudrate +; is (N)one, (O)dd, (E)ven, (M)ark, or (S)pace +; is number of data bits, typically 7 or 8 +; is number of stop bits, typically 1 or 2 +; /P prompts user prior to setting new configuration +; +; Examples: +; MODE /? (display command usage) +; MODE (display configuration of all serial ports) +; MODE COM0: (display configuration of serial unit 0) +; MODE COM1: 9600,N,8,1 (set serial unit 1 configuration) +; +; Notes: +; - Parameters not provided will remain unchanged +; - Device must support specified configuration +;_______________________________________________________________________________ +; +; Change Log: +; 2017-08-16 [WBW] Initial release +; 2017-08-28 [WBW] Handle UNACPM +; 2018-07-24 [WBW] Fixed bug in getnum23 routine (credit Phil Summers) +;_______________________________________________________________________________ +; +; ToDo: +; 1) Implement flow control settings +;_______________________________________________________________________________ +; +#include "../ver.inc" +; +;=============================================================================== +; Definitions +;=============================================================================== +; +stksiz .equ $40 ; Working stack size +; +restart .equ $0000 ; CP/M restart vector +bdos .equ $0005 ; BDOS invocation vector +; +ident .equ $FFFE ; loc of RomWBW HBIOS ident ptr +; +bf_cioinit .equ $04 ; HBIOS: CIOINIT function +bf_cioquery .equ $05 ; HBIOS: CIOQUERY function +bf_ciodevice .equ $06 ; HBIOS: CIODEVICE function +bf_sysget .equ $F8 ; HBIOS: SYSGET function +; +;=============================================================================== +; Code Section +;=============================================================================== +; + .org $100 +; + ; setup stack (save old value) + ld (stksav),sp ; save stack + ld sp,stack ; set new stack +; + ; initialization + call init ; initialize + jr nz,exit ; abort if init fails +; + ; get the target device + call getdev ; parse device/id from command line + jr nz,exit ; abort on error +; + ; process the configuration request + call process ; parse device/id from command line + jr nz,exit ; abort on error +; +exit: ; clean up and return to command processor + call crlf ; formatting + ld sp,(stksav) ; restore stack + jp restart ; return to CP/M via restart + ret ; return to CP/M w/o restart +; +; Initialization +; +init: + ; locate start of cbios (function jump table) + ld hl,(restart+1) ; load address of CP/M restart vector + ld de,-3 ; adjustment for start of table + add hl,de ; HL now has start of table + ld (bioloc),hl ; save it +; + ; check for UNA (UBIOS) + ld a,($FFFD) ; fixed location of UNA API vector + cp $C3 ; jp instruction? + jr nz,initwbw ; if not, not UNA + ld hl,($FFFE) ; get jp address + ld a,(hl) ; get byte at target address + cp $FD ; first byte of UNA push ix instruction + jr nz,initwbw ; if not, not UNA + inc hl ; point to next byte + ld a,(hl) ; get next byte + cp $E5 ; second byte of UNA push ix instruction + jr nz,initwbw ; if not, not UNA +; + ; UNA initialization + ld hl,unamod ; point to UNA mode flag + ld (hl),$FF ; set UNA mode flag + ld a,$FF ; assume max units for UNA + ld (comcnt),a ; ... and save it + jr initx ; UNA init done +; +initwbw: + ; get location of config data and verify integrity + ld hl,(ident) ; HL := adr or RomWBW HBIOS ident + ld a,(hl) ; get first byte of RomWBW marker + cp 'W' ; match? + jp nz,errinv ; abort with invalid config block + inc hl ; next byte (marker byte 2) + ld a,(hl) ; load it + cp ~'W' ; match? + jp nz,errinv ; abort with invalid config block + inc hl ; next byte (major/minor version) + ld a,(hl) ; load it + cp rmj << 4 | rmn ; match? + jp nz,errver ; abort with invalid os version +; + ; RomWBW initialization + ld b,bf_sysget ; BIOS SYSGET function + ld c,$00 ; CIOCNT subfunction + rst 08 ; E := serial device unit count + ld a,e ; count to A + ld (comcnt),a ; save it +; +initx + ; initialization complete + xor a ; signal success + ret ; return +; +; Get target device specification (e.g., "COM1:") and save +; as devicetype/id. +; +getdev: + ; skip to start of first parm + ld ix,$81 ; point to start of parm area (past len byte) + call nonblank ; skip to next non-blank char + jp z,prtcomall ; no parms, show all active ports +; +getdev1: + ; process options (if any) + cp '/' ; option prefix? + jr nz,getdev2 ; not an option, continue + call option ; process option + ret nz ; some options mean we are done (e.g., "/?") + inc ix ; skip option character + call nonblank ; skip whitespace + jr getdev1 ; continue option checking +; +getdev2: + ; parse device mnemonic (e.g., "COM1") into tmpstr + call getalpha ; extract alpha portion (e.g., "COM") + call getnum ; extract numeric portion + jp c,errunt ; handle overflow as invalid unit + ld (unit),a ; save as unit number +; + ; skip terminating ':' in device spec + ld a,(ix) ; get current char + cp ':' ; colon? + jr nz,getdev3 ; done if no colon + inc ix ; otherwise, skip the colon +; +getdev3: + call nonblank ; gobble any remaining whitespace + xor a ; indicate success + ret ; and return +; +; Process device +; +process: + ; match and branch according to device mnemonic + ld hl,tmpstr ; point to start of extracted string + ld de,strcom ; point to "COM" string + call strcmp ; and compare + jp z,comset ; handle COM port configuration + jp errdev ; abort if bad device name +; +; Display or change serial port configuration +; +comset: + ; check for valid unit number + ld hl,comcnt ; point to com device unit count + ld a,(unit) ; get com device unit count + cp (hl) ; compare to count (still in E) + jr c,comset1 ; unit < count, continue + jp errunt ; handle unit number error +; +comset1: + call ldcom ; load config for port +; + ld a,(comatr) ; get attributes + bit 7,a ; terminal? + jp nz,prtcom ; terminal not configurable +; + ld a,(ix) ; get current char + cp 0 ; nothing more? + jp z,prtcom ; no config parms, print current device config +; + ; parse and update baudrate + ld a,(ix) ; get current byte + cp '0' ; check for + jr c,comset1a ; ... valid digit + cp '9'+1 ; ... else jump ahead + jr nc,comset1a ; ... to handle empty +; + call getnum32 ; get baud rate into DE:HL + jp c,errcfg ; Handle overflow error + ld c,75 ; Constant for baud rate encode + call encode ; encode into C:4-0 + jp nz,errcfg ; Error if encode fails + ld a,(comcfg+1) ; Get high byte of config + and %11100000 ; strip out old baud rate bits + or c ; insert new baud rate bits + ld (comcfg+1),a ; save it +; +comset1a: + ; parse and update parity + call nonblank ; skip blanks + jp z,comset9 ; end of parms + cp ',' ; comma, as expected? + jp nz,comset8 ; check for trailing options + inc ix ; skip comma + call nonblank ; skip possible blanks + call ucase + ; lookup parity value + ld c,0 + cp 'N' + jr z,comset2 + ld c,1 + cp 'O' + jr z,comset2 + ld c,3 + cp 'E' + jr z,comset2 + ld c,5 + cp 'M' + jr z,comset2 + ld c,7 + cp 'S' + jr z,comset2 + jr comset3 ; unexpected parity char, possibly empty +; +comset2: + ; update parity value + ld a,c ; new parity value to A + rlca ; rotate to bits 5-3 + rlca ; + rlca ; + ld c,a ; and back to C + ld a,(comcfg) ; parity is in comcfg:5-3 + and %11000111 ; strip old value + or c ; apply new value + ld (comcfg),a ; and save it + inc ix ; bump past parity char +; +comset3: + ; parse & update data bits + call nonblank ; skip blanks + jr z,comset9 ; end of parms + cp ',' ; comma, as expected? + jr nz,comset8 ; check for trailing options + inc ix ; skip comma + call nonblank ; skip possible blanks + sub '5' ; normalize value + cp 4 ; value should now be 0-3 + jr nc,comset4 ; unexpected, possibly empty + ld c,a ; move new value to C + ld a,(comcfg) ; data bits is in comcfg:1-0 + and %11111100 ; strip old value + or c ; apply new value + ld (comcfg),a ; and save it + inc ix ; bump past data bits char +; +comset4: + ; parse & update stop bits + call nonblank ; skip blanks + jr z,comset9 ; end of parms + cp ',' ; comma, as expected? + jr nz,comset8 ; check for trailing options + inc ix ; skip comma + call nonblank ; skip possible blanks + sub '1' ; normalize value + cp 2 ; value should now be 0-1 + jr nc,comset8 ; unexpected, possibly empty + rlca ; rotate to bit 2 + rlca + ld c,a ; move new value to C + ld a,(comcfg) ; stop bit is in comcfg:2 + and %11111011 ; strip old value + or c ; apply new value + ld (comcfg),a ; and save it + inc ix ; bump past stop bits char +; +comset8: + ; trailing options + call nonblank ; skip blanks + jr z,comset9 ; end of parms + cp '/' ; option introducer? + jp nz,errprm ; parameter error + inc ix ; bump part '/' + ld a,(ix) ; get character + call ucase ; make upper case + cp 'P' ; only valid option + jp nz,errprm ; parameter error + ld a,$FF ; set prompt value on + ld (pflag),a ; save it + inc ix ; bump past character + jr comset8 ; process more parms +; +comset9: + ; display new config + ld de,(comcfg) ; get new config + call prtcom ; print it + ld a,(pflag) ; get prompt flag + or a ; set flags + jr z,comset9b ; bypass if not requested + call crlf2 ; spacing + ld de,indent ; indent + call prtstr ; do it + ld de,msgpmt ; point to prmopt message + call prtstr ; print it +; + ld b,64 +comset9a: + xor a + call prtchr + djnz comset9a +; +comset9b: + ; check for UNA + ld a,(unamod) ; get UNA flag + or a ; set flags + jr nz,comsetu ; go to UNA variant +; + ; implement new config + ld de,(comcfg) ; get new config value to DE + ld b,bf_cioinit ; BIOS serial init + ld a,(unit) ; get serial device unit + ld c,a ; ... into C + rst 08 ; call HBIOS + jp nz,errcfg ; handle error + jr comsetx ; common exit +; +comsetu: + ; implement new config under UNA + ld de,(comcfg) ; get new config value to DE + ld c,$10 ; UNA INIT function + ld a,(unit) ; get serial device unit + ld b,a ; ... into B + rst 08 ; call HBIOS + jp nz,errcfg ; handle error + jr comsetx ; common exit +; +comsetx: + ld a,(pflag) ; get prompt flag + or a ; set flags + jr z,comsetx2 ; bypass if not requested +comsetx1: + ld c,$01 ; console read + call bdos ; do it + cp $0D ; CR? + jr nz,comsetx1 ; loop as needed +; +comsetx2: + xor a + ret +; +; Print configuration of all serial ports +; +prtcomall: + ld a,(comcnt) ; get com device unit count + ld b,a ; init B as loop counter + ld c,0 ; init C as unit index +; +prtcomall1: + push bc ; save loop control +; + ; get port info + ld a,c ; put unit number + ld (unit),a ; ... into unit + call ldcom ; get config + jr z,prtcomall2 ; no error, continue + pop bc ; unwind stack + ret ; and return with NZ +; +prtcomall2: + ; print config for port + call prtcom ; print line for this port +; + ; loop as needed + pop bc ; restore loop control + inc c ; next unit index + djnz prtcomall1 ; loop till done +; + or $FF ; indicate nothing more to do + ret ; finished +; +; Print configuration of serial port +; +prtcom: + ; print leader (e.g., "COM0: ") + call crlf + ld de,indent + call prtstr + ld de,strcom + call prtstr + ld a,(unit) + call prtdecb + ld a,':' + call prtchr + ld a,' ' + call prtchr +; + ld a,(comatr) ; get attribute byte + bit 7,a ; 0=RS232, 1=terminal + jr z,prtcom1 ; handle serial port configuration +; + ; this is a terminal, just say so + ld de,strterm ; point to string + call prtstr ; print it + ret ; and return +; +prtcom1: + ld de,(comcfg) ; load config to DE +; + ; print baud rate + push de ; save it + ld a,d ; baud rate is in D + and $1F ; ... bits 4-0 + ld l,a ; move to L + ld h,0 ; setup H for decode routine + ld de,75 ; set DE to baud rate decode constant + call decode ; decode baud rate, DE:HL := baud rate + ld bc,bcdtmp ; point to temp bcd buffer + call bin2bcd ; convert baud to BCD + call prtbcd ; and print in decimal + pop de ; restore line characteristics +; + ; print parity + ld a,',' ; A := comma + call prtchr ; ... print it + ld a,e ; E has parity config + rrca ; isolate bits 5-3 + rrca ; ... + rrca ; ... + and $07 ; ... + ld hl,parmap ; HL := start of parity char table + call addhl ; index into table + ld a,(hl) ; get resulting parity char + call prtchr ; and print +; + ; print data bits + ld a,',' ; A := comma + call prtchr ; ... print it + ld a,e ; E has data bits config + and $03 ; isloate bits 1-0 + add A,'5' ; convert to printable char + call prtchr ; and print it +; + ; print stop bits + ld a,',' ; A := comma + call prtchr ; ... print it + ld a,e ; E has stop bits config + rrca ; isolate bit 2 + rrca ; ... + and $01 ; ... + add A,'1' ; convert to printable char + call prtchr ; and print it +; + ret +; +; Load serial device info for specific unit +; +ldcom: + ld a,(unamod) ; get UNA flag + or a ; set flags + jr nz,ldcomu ; go to UNA variant +; + ; get device type info + ld a,(unit) ; get unit + ld b,bf_ciodevice ; BIOS device call + ld c,a ; ... and put in C + rst 08 ; call HBIOS, C := attributes + ret nz ; return on error + ld a,c ; attributes to A + ld (comatr),a ; save it +; + ; get serial port config + ld b,bf_cioquery ; BIOS serial device query + ld a,(unit) ; get device unit num + ld c,a ; ... and put in C + rst 08 ; call H/UBIOS, DE := line characteristics + ret nz ; abort on error + ld (comcfg),de ; save config +; + xor a ; success + ret +; +ldcomu: ; UNA variant + xor a ; assume attribtues zero + ld (comatr),a ; save it + ; get device info + ld a,(unit) ; get unit + ld b,a ; put unit in B + ld c,$18 ; UNA Get line/driver info func + rst 08 ; call H/UBIOS, DE := line characteristics + ld a,c + or a + jr z,ldcomu1 + cp $43 ; $43 is OK for now (tell John about this) + jr z,ldcomu1 + ret ; return w/ NZ indicating error +; +ldcomu1: + ld (comcfg),de ; save config +; + xor a ; success + ret + +; +; Handle special options +; +option: +; + inc ix ; next char + ld a,(ix) ; get it + cp '?' ; is it a '?' as expected? + jp z,usage ; yes, display usage +; cp 'L' ; is it a 'L', display device list? +; jp z,devlist ; yes, display device list + jp errprm ; anything else is an error +; +; Display usage +; +usage: +; + call crlf ; formatting + ld de,msgban1 ; point to version message part 1 + call prtstr ; print it + ld a,(unamod) ; get UNA flag + or a ; set flags + ld de,msghb ; point to HBIOS mode message + call z,prtstr ; if not UNA, say so + ld de,msgub ; point to UBIOS mode message + call nz,prtstr ; if UNA, say so + call crlf ; formatting + ld de,msgban2 ; point to version message part 2 + call prtstr ; print it + call crlf2 ; blank line + ld de,msguse ; point to usage message + call prtstr ; print it + or $FF ; signal no action performed + ret ; and return +; +; Print character in A without destroying any registers +; +prtchr: + push bc ; save registers + push de + push hl + ld e,a ; character to print in E + ld c,$02 ; BDOS function to output a character + call bdos ; do it + pop hl ; restore registers + pop de + pop bc + ret +; +prtdot: +; + ; shortcut to print a dot preserving all regs + push af ; save af + ld a,'.' ; load dot char + call prtchr ; print it + pop af ; restore af + ret ; done +; +; Print a zero terminated string at (DE) without destroying any registers +; +prtstr: + push de +; +prtstr1: + ld a,(de) ; get next char + or a + jr z,prtstr2 + call prtchr + inc de + jr prtstr1 +; +prtstr2: + pop de ; restore registers + ret +; +; Print the value in A in hex without destroying any registers +; +prthex: + push af ; save AF + push de ; save DE + call hexascii ; convert value in A to hex chars in DE + ld a,d ; get the high order hex char + call prtchr ; print it + ld a,e ; get the low order hex char + call prtchr ; print it + pop de ; restore DE + pop af ; restore AF + ret ; done +; +; print the hex word value in bc +; +prthexword: + push af + ld a,b + call prthex + ld a,c + call prthex + pop af + ret +; +; print the hex dword value in de:hl +; +prthex32: + push bc + push de + pop bc + call prthexword + push hl + pop bc + call prthexword + pop bc + ret +; +; Convert binary value in A to ascii hex characters in DE +; +hexascii: + ld d,a ; save A in D + call hexconv ; convert low nibble of A to hex + ld e,a ; save it in E + ld a,d ; get original value back + rlca ; rotate high order nibble to low bits + rlca + rlca + rlca + call hexconv ; convert nibble + ld d,a ; save it in D + ret ; done +; +; Convert low nibble of A to ascii hex +; +hexconv: + and $0F ; low nibble only + add a,$90 + daa + adc a,$40 + daa + ret +; +; Print value of A or HL in decimal with leading zero suppression +; Use prtdecb for A or prtdecw for HL +; +prtdecb: + push hl + ld h,0 + ld l,a + call prtdecw ; print it + pop hl + ret +; +prtdecw: + push af + push bc + push de + push hl + call prtdec0 + pop hl + pop de + pop bc + pop af + ret +; +prtdec0: + ld e,'0' + ld bc,-10000 + call prtdec1 + ld bc,-1000 + call prtdec1 + ld bc,-100 + call prtdec1 + ld c,-10 + call prtdec1 + ld e,0 + ld c,-1 +prtdec1: + ld a,'0' - 1 +prtdec2: + inc a + add hl,bc + jr c,prtdec2 + sbc hl,bc + cp e + ret z + ld e,0 + call prtchr + ret +; +; Start a new line +; +crlf2: + call crlf ; two of them +crlf: + push af ; preserve AF + ld a,13 ; + call prtchr ; print it + ld a,10 ; + call prtchr ; print it + pop af ; restore AF + ret +; +; Get the next non-blank character from (HL). +; +nonblank: + ld a,(ix) ; load next character + or a ; string ends with a null + ret z ; if null, return pointing to null + cp ' ' ; check for blank + ret nz ; return if not blank + inc ix ; if blank, increment character pointer + jr nonblank ; and loop +; +; Get alpha chars and save in tmpstr +; Length of string returned in A +; +getalpha: +; + ld hl,tmpstr ; location to save chars + ld b,8 ; length counter (tmpstr max chars) + ld c,0 ; init character counter +; +getalpha1: + ld a,(ix) ; get active char + call ucase ; lower case -> uppper case, if needed + cp 'A' ; check for start of alpha range + jr c,getalpha2 ; not alpha, get out + cp 'Z' + 1 ; check for end of alpha range + jr nc,getalpha2 ; not alpha, get out + ; handle alpha char + ld (hl),a ; save it + inc c ; bump char count + inc hl ; inc string pointer + inc ix ; increment buffer ptr + djnz getalpha1 ; if space, loop for more chars +; +getalpha2: ; non-alpha, clean up and return + ld (hl),0 ; terminate string + ld a,c ; string length to A + or a ; set flags + ret ; and return +; +; Get numeric chars and convert to number returned in A +; Carry flag set on overflow +; +getnum: + ld c,0 ; C is working register +getnum1: + ld a,(ix) ; get the active char + cp '0' ; compare to ascii '0' + jr c,getnum2 ; abort if below + cp '9' + 1 ; compare to ascii '9' + jr nc,getnum2 ; abort if above +; + ; valid digit, add new digit to C + ld a,c ; get working value to A + rlca ; multiply by 10 + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + add a,c ; ... + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + ld c,a ; back to C + ld a,(ix) ; get new digit + sub '0' ; make binary + add a,c ; add in working value + ret c ; overflow, return with carry set + ld c,a ; back to C +; + inc ix ; bump to next char + jr getnum1 ; loop +; +getnum2: ; return result + ld a,c ; return result in A + or a ; with flags set, CF is cleared + ret +; +; Get numeric chars and convert to 32-bit number returned in DE:HL +; Carry flag set on overflow +; +getnum32: + ld de,0 ; Initialize DE:HL + ld hl,0 ; ... to zero +getnum32a: + ld a,(ix) ; get the active char + cp '0' ; compare to ascii '0' + jr c,getnum32c ; abort if below + cp '9' + 1 ; compare to ascii '9' + jr nc,getnum32c ; abort if above +; + ; valid digit, multiply DE:HL by 10 + ; X * 10 = (((x * 2 * 2) + x)) * 2 + push de + push hl +; + call getnum32e ; DE:HL *= 2 + jr c,getnum32d ; if overflow, ret w/ CF & stack pop +; + call getnum32e ; DE:HL *= 2 + jr c,getnum32d ; if overflow, ret w/ CF & stack pop +; + pop bc ; DE:HL += X + add hl,bc + ex de,hl + pop bc + adc hl,bc + ex de,hl + ret c ; if overflow, ret w/ CF +; + call getnum32e ; DE:HL *= 2 + ret c ; if overflow, ret w/ CF +; + ; now add in new digit + ld a,(ix) ; get the active char + sub '0' ; make it binary + add a,l ; add to L, CF updated + ld l,a ; back to L + jr nc,getnum32b ; if no carry, done + inc h ; otherwise, bump H + jr nz,getnum32b ; if no overflow, done + inc e ; otherwise, bump E + jr nz,getnum32b ; if no overflow, done + inc d ; otherwise, bump D + jr nz,getnum32b ; if no overflow, done + scf ; set carry flag to indicate overflow + ret ; and return +; +getnum32b: + inc ix ; bump to next char + jr getnum32a ; loop +; +getnum32c: + ; successful completion + xor a ; clear flags + ret ; and return +; +getnum32d: + ; special overflow exit with stack fixup + pop hl ; burn 2 + pop hl ; ... stack entries + ret ; and return +; +getnum32e: + ; DE:HL := DE:HL * 2 + sla l + rl h + rl e + rl d + ret +; +; Compare null terminated strings at HL & DE +; If equal return with Z set, else NZ +; +strcmp: + ld a,(de) ; get current source char + cp (hl) ; compare to current dest char + ret nz ; compare failed, return with NZ + or a ; set flags + ret z ; end of string, match, return with Z set + inc de ; point to next char in source + inc hl ; point to next char in dest + jr strcmp ; loop till done +; +; Convert character in A to uppercase +; +ucase: + cp 'a' ; if below 'a' + ret c ; ... do nothing and return + cp 'z' + 1 ; if above 'z' + ret nc ; ... do nothing and return + res 5,a ; clear bit 5 to make lower case -> upper case + ret ; and return +; +; Add the value in A to HL (HL := HL + A) +; +addhl: + add a,l ; A := A + L + ld l,a ; Put result back in L + ret nc ; if no carry, we are done + inc h ; if carry, increment H + ret ; and return +; +; Integer divide DE:HL by C +; result in DE:HL, remainder in A +; clobbers F, B +; +div32x8: + xor a + ld b,32 +div32x8a: + add hl,hl + rl e + rl d + rla + cp c + jr c,div32x8b + sub c + inc l +div32x8b: + djnz div32x8a + ret +; +; Jump indirect to address in HL +; +jphl: + jp (hl) +; +; Errors +; +erruse: ; command usage error (syntax) + ld de,msguse + jr err +; +errprm: ; command parameter error (syntax) + ld de,msgprm + jr err +; +errinv: ; invalid HBIOS, signature not found + ld de,msginv + jr err +; +errver: ; unsupported HBIOS version + ld de,msgver + jr err +; +errdev: ; invalid device name + ld de,msgdev + jr err +; +errnum: ; invalid number parsed, overflow + ld de,msgnum + jr err +; +errunt: ; Invalid device unit specified + ld de,msgunt + jr err +; +errcfg: ; Invalid device configuration specified + ld de,msgcfg + jr err +; +err: ; print error string and return error signal + call crlf2 ; print newline +; +err1: ; without the leading crlf + call prtstr ; print error string +; +err2: ; without the string +; call crlf ; print newline + or $FF ; signal error + ret ; done +; +;=============================================================================== +; Utility modules +;=============================================================================== +; +#include "encode.asm" +#include "decode.asm" +#include "bcd.asm" +; +;=============================================================================== +; Storage Section +;=============================================================================== +; +; +bioloc .dw 0 ; CBIOS starting address +unit .db 0 ; source unit +; +unamod .db 0 ; $FF indicates UNA UBIOS active +; +tmpstr .fill 9,0 ; temporary string of up to 8 chars, zero term +bcdtmp .fill 5,0 ; temporary bcd number storage +; +comcnt .db 0 ; count of com ports +comatr .db 0 ; com port attributes +comcfg .dw 0 ; com port configuration +; +parmap .db "NONENMNS" ; parity character lookup table +; +pflag .db 0 ; $FF indicates prompt option set +; +strcom .db "COM",0 ; serial device name string +strterm .db "VDU",0 ; terminal device string +; +stksav .dw 0 ; stack pointer saved at start + .fill stksiz,0 ; stack +stack .equ $ ; stack top +; +; Messages +; +indent .db " ",0 +msgban1 .db "MODE v1.2, 24-Jul-2018",0 +msghb .db " [HBIOS]",0 +msgub .db " [UBIOS]",0 +msgban2 .db "Copyright (C) 2017, Wayne Warthen, GNU GPL v3",0 +msguse .db "Usage: MODE COM: [[,[,[,]]]] [/P]",13,10 + .db " ex. MODE /? (display version and usage)",13,10 + .db " MODE (display config of all serial ports)",13,10 + .db " MODE COM0: (display serial unit 0 config)",13,10 + .db " MODE COM1: 9600,N,8,1 (set serial unit 1 config)",0 +msgprm .db "Parameter error (MODE /? for usage)",0 +msginv .db "Invalid BIOS (signature missing)",0 +msgver .db "Unexpected HBIOS version",0 +msgdev .db "Invalid device name",0 +msgnum .db "Unit or slice number invalid",0 +msgunt .db "Invalid device unit number specified",0 +msgcfg .db "Invalid device configuration specified",0 +msgpmt .db "Prepare line then press ",0 +; + .end diff --git a/Source/Apps/rtc.asm b/Source/Apps/rtc.asm new file mode 100644 index 00000000..b0a7fe44 --- /dev/null +++ b/Source/Apps/rtc.asm @@ -0,0 +1,1789 @@ + .Title "RTC" +; +; Program: rtc.asm +; Author: Andrew Lynch +; Date: 22 Feb 2007 +; Enviroment: TASM MS-DOS Z80 Cross Assembler source for CP/M +; +;[2011/8/11] VK5DG modified for N8 +; Changed base address to $88 +; Changed trickle charger value to 2k+2 diodes for DS1210s +; +;[2012/2/7] WBW modified to build for either +; traditional N8VEM/Zeta or N8 via conditionals +; +;[2013/12/29] WBW modified to build for MK4 +; +;[2017/11/29] WBW modified to adjust to RTC in use dynamically +; using HBIOS platform detection +; +;[2018/11/8] v1.2 PMS Add boot option. Code optimization. +; +;[2019/06/21] v1.3 Finalized RCBus Z180 support. +; +;[2019/08/11] v1.4 Support SCZ180 platform. +; +;[2020/02/02] v1.5 PMS Basic command line support +; +;[2020/05/15] v1.6 Added Warm Start option +; +;[2021/07/10] v1.7 Support MBC (AJL) +; +;[2022/03/27] v1.8 Support RHYOPHYRE +; +; Constants +; +mask_data .EQU %10000000 ; RTC data line +mask_clk .EQU %01000000 ; RTC Serial Clock line +mask_rd .EQU %00100000 ; Enable data read from RTC +mask_rst .EQU %00010000 ; De-activate RTC reset line + +PORT_SBC .EQU $70 ; RTC port for SBC/ZETA +PORT_N8 .EQU $88 ; RTC port for N8 +PORT_MK4 .EQU $8A ; RTC port for MK4 +PORT_RCZ80 .EQU $C0 ; RTC port for RCBus +PORT_RCZ180 .EQU $0C ; RTC port for RCBus +PORT_EZZ80 .EQU $C0 ; RTC port for EZZ80 (actually does not have one!!!) +PORT_SCZ180 .EQU $0C ; RTC port for SCZ180 +PORT_DYNO .EQU $0C ; RTC port for DYNO +PORT_RCZ280 .EQU $C0 ; RTC port for RCZ280 +PORT_MBC .EQU $70 ; RTC port for MBC +PORT_RPH .EQU $84 ; RTC port for RHYOPHYRE + + +BDOS .EQU 5 ; BDOS invocation vector +FCB .EQU 05CH ; Start of command line + +;BID_BOOT .EQU $00 +;HB_BNKCALL .EQU $FFF9 + +BF_SYSRESET .EQU $F0 ; RESTART SYSTEM + +BF_SYSRES_INT .EQU $00 ; RESET HBIOS INTERNAL +BF_SYSRES_WARM .EQU $01 ; WARM START (RESTART BOOT LOADER) +BF_SYSRES_COLD .EQU $02 ; COLD START + +; +; Program +; + .ORG 0100H + +LOOP: + LD DE,MSG + LD C,09H ; CP/M write string to console call + CALL 0005H + +; program starts here + + CALL RTC_INIT ; Program initialization + + CALL RTC_TOP_LOOP + + LD C,00H ; CP/M system reset call - shut down + CALL 0005H + + HALT ; This code is never reached + + +; function HEXSTR +; input number in A +; output upper nibble of number in ASCII in H +; output lower nibble of number in ASCII in L +; uses BC +; +; based on following algorithm: +; +; const +; hextab : string = ('0','1','2','3','4','5','6','7','8', +; '9','A','B','C','D','E','F'); +; +; PROCEDURE hexstr(n: int): ^string; +; BEGIN +; n := n and 255; +; tmpstr[1] := hextab[n / 16]; +; tmpstr[2] := hextab[n and 15]; +; tmpstr[0] := #2; +; return @tmpstr; +; END; + + +HEXSTR: + 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,HEXSTR1 ;IF CY SET SAVE 'NUMBER' in H + ADD A,07H ;MAKE IT AN ALPHA +HEXSTR1: + LD H,A ;SAVE 'ALPHA' in H + LD A,B ;NEXT NIBBLE + AND 0FH ;JUST THIS + ADD A,30H ;TRY A NUMBER + CP 3AH ;TEST IT + JR C,HEXSTR2 ;IF CY SET SAVE 'NUMBER' in L + ADD A,07H ;MAKE IT ALPHA + +HEXSTR2: + LD L,A ;SAVE 'ALPHA' in L + POP BC ;RESTORE BC + RET + + +;***************************************************** +;* GET K.B. DATA & MAKE IT 'HEX' +;***************************************************** + +HEXIN: + PUSH BC ;SAVE BC REGS. + CALL NIBL ;DO A NIBBLE + RLC A ;MOVE FIRST BYTE UPPER NIBBLE + RLC A + RLC A + RLC A + LD B,A ;SAVE ROTATED BYTE + PUSH BC + + CALL NIBL ;DO NEXT NIBBLE + POP BC + ADD A,B ;COMBINE NIBBLES IN ACC. + POP BC ;RESTORE BC + RET ;DONE +NIBL: + LD C,01H ; CP/M console input call + CALL 0005H ;GET K.B. DATA + CP 40H ;TEST FOR ALPHA + JR NC,ALPH + AND 0FH ;GET THE BITS + RET +ALPH: + AND 0FH ;GET THE BITS + ADD A,09H ;MAKE IT HEX A-F + RET + +; function RTC_IN +; +; read a byte from RTC port, return in A +; NOTE: port address is dynamically set in RTC_INIT + +RTC_IN: +INP .EQU $ + 1 + IN A,($FF) + RET + +; function RTC_OUT +; +; write a byte to RTC port, value in A +; NOTE: port address is dynamically set in RTC_INIT + +RTC_OUT: +OUTP .EQU $ + 1 + OUT ($FF),A + RET + +; function RTC_BIT_DELAY +; +; based on following algorithm: +; +; { Make a short delay } +; PROCEDURE rtc_bit_delay; +; var +; x : int; +; BEGIN +; x := 3; +; END; + +RTC_BIT_DELAY: ; purpose is to delay ~36 uS or 144 t-states at 4MHz + PUSH AF ; 11 t-states + LD A,07H ; 7 t-states ADJUST THE TIME 13h IS FOR 4 MHZ +RTC_BIT_DELAY1: + DEC A ; 4 t-states DEC COUNTER. 4 T-states = 1 uS. + JP NZ,RTC_BIT_DELAY1 ; 10 t-states JUMP TO PAUSELOOP2 IF A <> 0. + + NOP ; 4 t-states + NOP ; 4 t-states + POP AF ; 10 t-states + RET ; 10 t-states (144 t-states total) + + +; function RTC_RESET +; +; based on following algorithm: +; +; { Output a RTC reset signal } +; PROCEDURE rtc_reset; +; BEGIN +; out(rtc_base,mask_data + mask_rd); +; rtc_bit_delay(); +; rtc_bit_delay(); +; out(rtc_base,mask_data + mask_rd + mask_rst); +; rtc_bit_delay(); +; rtc_bit_delay(); +; END; +; +RTC_RESET: + LD A,mask_data + mask_rd + ;OUT (RTC),A + CALL RTC_OUT + CALL RTC_BIT_DELAY + CALL RTC_BIT_DELAY + LD A,mask_data + mask_rd + mask_rst + ;OUT (RTC),A + CALL RTC_OUT + CALL RTC_BIT_DELAY + CALL RTC_BIT_DELAY + RET + + +; function RTC_RESET_ON +; +; based on following algorithm: +; +; { Assert RTC reset signal } +; PROCEDURE rtc_reset_on; +; BEGIN +; out(rtc_base,mask_data + mask_rd); +; rtc_bit_delay(); +; rtc_bit_delay(); +; END; + +RTC_RESET_ON: + LD A,mask_data + mask_rd + ;OUT (RTC),A + CALL RTC_OUT + CALL RTC_BIT_DELAY + CALL RTC_BIT_DELAY + RET + +; function RTC_RESET_OFF +; +; based on following algorithm: +; +; { De-assert RTC reset signal } +; PROCEDURE rtc_reset_off; +; BEGIN +; out(rtc_base,mask_data + mask_rd + mask_rst); +; rtc_bit_delay(); +; rtc_bit_delay(); +; END; + +RTC_RESET_OFF: + LD A,mask_data + mask_rd + mask_rst + ;OUT (RTC),A + CALL RTC_OUT + CALL RTC_BIT_DELAY + CALL RTC_BIT_DELAY + RET + +; function RTC_WR +; input value in C +; uses A +; +; PROCEDURE rtc_wr(n : int); +; var +; i : int; +; BEGIN +; for i := 0 while i < 8 do inc(i) loop +; if (n and 1) <> 0 then +; out(rtc_base,mask_rst + mask_data); +; rtc_bit_delay(); +; out(rtc_base,mask_rst + mask_clk + mask_data); +; else +; out(rtc_base,mask_rst); +; rtc_bit_delay(); +; out(rtc_base,mask_rst + mask_clk); +; end; +; rtc_bit_delay(); +; n := shr(n,1); +; end loop; +; END; + +RTC_WR: + XOR A ; set A=0 index counter of FOR loop + +RTC_WR1: + PUSH AF ; save accumulator as it is the index counter in FOR loop + LD A,C ; get the value to be written in A from C (passed value to write in C) + BIT 0,A ; is LSB a 0 or 1? + JP Z,RTC_WR2 ; if it's a 0, handle it at RTC_WR2. + ; LSB is a 1, handle it below + ; setup RTC latch with RST and DATA high, SCLK low + LD A,mask_rst + mask_data + ;OUT (RTC),A ; output to RTC latch + CALL RTC_OUT + CALL RTC_BIT_DELAY ; let it settle a while + ; setup RTC with RST, DATA, and SCLK high + LD A,mask_rst + mask_clk + mask_data + ;OUT (RTC),A ; output to RTC latch + CALL RTC_OUT + JP RTC_WR3 ; exit FOR loop + +RTC_WR2: + ; LSB is a 0, handle it below + LD A,mask_rst ; setup RTC latch with RST high, SCLK and DATA low + ;OUT (RTC),A ; output to RTC latch + CALL RTC_OUT + CALL RTC_BIT_DELAY ; let it settle a while + ; setup RTC with RST and SCLK high, DATA low + LD A,mask_rst + mask_clk + ;OUT (RTC),A ; output to RTC latch + CALL RTC_OUT + +RTC_WR3: + CALL RTC_BIT_DELAY ; let it settle a while + RRC C ; move next bit into LSB position for processing to RTC + POP AF ; recover accumulator as it is the index counter in FOR loop + INC A ; increment A in FOR loop (A=A+1) + CP $08 ; is A < $08 ? + JP NZ,RTC_WR1 ; No, do FOR loop again + RET ; Yes, end function and return + + +; function RTC_RD +; output value in C +; uses A +; +; function RTC_RD +; +; PROCEDURE rtc_rd(): int ; +; var +; i,n,mask : int; +; BEGIN +; n := 0; +; mask := 1; +; for i := 0 while i < 8 do inc(i) loop +; out(rtc_base,mask_rst + mask_rd); +; rtc_bit_delay(); +; if (in(rtc_base) and #1) <> #0 then +; { Data = 1 } +; n := n + mask; +; else +; { Data = 0 } +; end; +; mask := shl(mask,1); +; out(rtc_base,mask_rst + mask_clk + mask_rd); +; rtc_bit_delay(); +; end loop; +; return n; +; END; + +RTC_RD: + XOR A ; set A=0 index counter of FOR loop + LD C,$00 ; set C=0 output of RTC_RD is passed in C + LD B,$01 ; B is mask value + +RTC_RD1: + PUSH AF ; save accumulator as it is the index counter in FOR loop + ; setup RTC with RST and RD high, SCLK low + LD A,mask_rst + mask_rd + ;OUT (RTC),A ; output to RTC latch + CALL RTC_OUT + CALL RTC_BIT_DELAY ; let it settle a while + ;IN A,(RTC) ; input from RTC latch + CALL RTC_IN ; input from RTC latch + BIT 0,A ; is LSB a 0 or 1? + JP Z,RTC_RD2 ; if LSB is a 1, handle it below + LD A,C + ADD A,B + LD C,A +; INC C + ; if LSB is a 0, skip it (C=C+0) +RTC_RD2: + RLC B ; move input bit out of LSB position to save it in C + ; setup RTC with RST, SCLK high, and RD high + LD A,mask_rst + mask_clk + mask_rd + ;OUT (RTC),A ; output to RTC latch + CALL RTC_OUT + CALL RTC_BIT_DELAY ; let it settle + POP AF ; recover accumulator as it is the index counter in FOR loop + INC A ; increment A in FOR loop (A=A+1) + CP $08 ; is A < $08 ? + JP NZ,RTC_RD1 ; No, do FOR loop again + RET ; Yes, end function and return. Read RTC value is in C + +; function RTC_WRITE +; input address in D +; input value in E +; uses A +; +; based on following algorithm: +; +; PROCEDURE rtc_write(address, value: int); +; BEGIN +; lock(); +; rtc_reset_off(); +; { Write command } +; rtc_wr(128 + shl(address and $3f,1)); +; { Write data } +; rtc_wr(value and $ff); +; rtc_reset_on(); +; unlock(); +; END; + +RTC_WRITE: + DI ; disable interrupts during critical section + CALL RTC_RESET_OFF ; turn off RTC reset + LD A,D ; bring into A the address from D +; AND $3F ; keep only bits 6 LSBs, discard 2 MSBs + AND %00111111 ; keep only bits 6 LSBs, discard 2 MSBs + RLC A ; rotate address bits to the left +; ADD A,$80 ; set MSB to one for DS1302 COMMAND BYTE (WRITE) + ADD A,%10000000 ; set MSB to one for DS1302 COMMAND BYTE (WRITE) + LD C,A ; RTC_WR expects write data (address) in reg C + CALL RTC_WR ; write address to DS1302 + LD A,E ; start processing value + AND $FF ; seems unnecessary, probably delete since all values are 8-bit + LD C,A ; RTC_WR expects write data (value) in reg C + CALL RTC_WR ; write address to DS1302 + CALL RTC_RESET_ON ; turn on RTC reset + EI + RET + + +; function RTC_READ +; input address in D +; output value in C +; uses A +; +; based on following algorithm +; +; PROCEDURE rtc_read(address: int): int; +; var +; n : int; +; BEGIN +; lock(); +; rtc_reset_off(); +; { Write command } +; rtc_wr(128 + shl(address and $3f,1) + 1); +; { Read data } +; n := rtc_rd(); +; rtc_reset_on(); +; unlock(); +; return n; +; END; + +RTC_READ: + DI ; disable interrupts during critical section + CALL RTC_RESET_OFF ; turn off RTC reset + LD A,D ; bring into A the address from D + AND $3F ; keep only bits 6 LSBs, discard 2 MSBs + RLC A ; rotate address bits to the left + ADD A,$81 ; set MSB to one for DS1302 COMMAND BYTE (READ) + LD C,A ; RTC_WR expects write data (address) in reg C + CALL RTC_WR ; write address to DS1302 + CALL RTC_RD ; read value from DS1302 (value is in reg C) + CALL RTC_RESET_ON ; turn on RTC reset + EI + RET + + +; function RTC_WR_PROTECT +; input D (address) $07 +; input E (value) $80 +; uses A +; +; based on following algorithm +; +; PROCEDURE rtc_wr_protect; +; BEGIN +; rtc_write(7,128); +; END; + +RTC_WR_PROTECT: +; LD D,$07 + LD D,%00000111 +; LD E,$80 + LD E,%10000000 + CALL RTC_WRITE + RET + + +; function RTC_WR_UNPROTECT +; input D (address) $07 +; input E (value) $00 +; uses A +; +; based on following algorithm +; +; PROCEDURE rtc_wr_unprotect; +; BEGIN +; rtc_write(7,0); +; END; + +RTC_WR_UNPROTECT: +; LD D,$07 + LD D,%00000111 +; LD E,$00 + LD E,%00000000 + CALL RTC_WRITE + RET + + +; function RTC_GET_TIME +; input HL (memory address of buffer) +; uses A,C,D,E +; +; based on following algorithm +; +; PROCEDURE rtc_get_time(var buf: string); +; var +; n : int; +; BEGIN +; lock(); +; rtc_reset_off(); +; { Write command, burst read } +; rtc_wr(255 - 64); +; { Read seconds } +; n := rtc_rd(); 0 +; buf[16] := char(((n / 16) and $07)) + '0'; +; buf[17] := char((n and $0f)) + '0'; +; { Read minutes } +; n := rtc_rd(); 1 +; buf[13] := char(((n / 16) and $07)) + '0'; +; buf[14] := char((n and $0f)) + '0'; +; buf[15] := ':'; +; { Read hours } +; n := rtc_rd(); 2 +; buf[10] := char(((n / 16) and $03)) + '0'; +; buf[11] := char((n and $0f)) + '0'; +; buf[12] := ':'; +; { Read date } +; n := rtc_rd(); 3 +; buf[7] := char(((n / 16) and $03)) + '0'; +; buf[8] := char((n and $0f)) + '0'; +; buf[9] := ' '; +; { Read month } +; n := rtc_rd(); 4 +; buf[4] := char(((n / 16) and $03)) + '0'; +; buf[5] := char((n and $0f)) + '0'; +; buf[6] := '-'; +; { Read day } +; n := rtc_rd(); 5 +; { +; buf[4] := char(((n / 16) and $03)) + '0'; +; buf[4] := char((n and $0f)) + '0'; +; } +; { Read year } +; n := rtc_rd(); 6 +; buf[1] := char(((n / 16) and $0f)) + '0'; +; buf[2] := char((n and $0f)) + '0'; +; buf[3] := '-'; +; length(buf) := 17; +; rtc_reset_on(); +; unlock(); +; END rtc_get_time; + +RTC_GET_TIME: + DI ; disable interrupts during DS1302 read + CALL RTC_RESET_OFF ; turn of RTC reset + ; { Write command, burst read } + LD C,%10111111 ; (255 - 64) + CALL RTC_WR ; send COMMAND BYTE (BURST READ) to DS1302 + +; { Read seconds } + + CALL RTC_RD ; read value from DS1302, value is in Reg C + + ; digit 16 + LD A,C ; put value output in Reg C into accumulator + RLC A + RLC A + RLC A + RLC A + AND $07 + ADD A,'0' + LD (RTC_PRINT_BUFFER+15),A + + ; digit 17 + LD A,C ; put value output in Reg C into accumulator + AND $0F + ADD A,'0' + LD (RTC_PRINT_BUFFER+16),A + +; { Read minutes } + + CALL RTC_RD ; read value from DS1302, value is in Reg C + + ; digit 13 + LD A,C ; put value output in Reg C into accumulator + RLC A + RLC A + RLC A + RLC A + AND $07 + ADD A,'0' + LD (RTC_PRINT_BUFFER+12),A + + ; digit 14 + LD A,C ; put value output in Reg C into accumulator + AND $0F + ADD A,'0' + LD (RTC_PRINT_BUFFER+13),A + + ; digit 15 + LD A,':' + LD (RTC_PRINT_BUFFER+14),A + +; { Read hours } + + CALL RTC_RD ; read value from DS1302, value is in Reg C + + ; digit 10 + LD A,C ; put value output in Reg C into accumulator + RLC A + RLC A + RLC A + RLC A + AND $03 + ADD A,'0' + LD (RTC_PRINT_BUFFER+09),A + + ; digit 11 + LD A,C ; put value output in Reg C into accumulator + AND $0F + ADD A,'0' + LD (RTC_PRINT_BUFFER+10),A + + ; digit 12 + LD A,':' + LD (RTC_PRINT_BUFFER+11),A + +; { Read date } + + CALL RTC_RD ; read value from DS1302, value is in Reg C + + ; digit 07 + LD A,C ; put value output in Reg C into accumulator + RLC A + RLC A + RLC A + RLC A + AND $03 + ADD A,'0' + LD (RTC_PRINT_BUFFER+06),A + + ; digit 08 + LD A,C ; put value output in Reg C into accumulator + AND $0F + ADD A,'0' + LD (RTC_PRINT_BUFFER+07),A + + ; digit 09 + LD A,' ' + LD (RTC_PRINT_BUFFER+08),A + +; { Read month } + + CALL RTC_RD ; read value from DS1302, value is in Reg C + + ; digit 04 + LD A,C ; put value output in Reg C into accumulator + RLC A + RLC A + RLC A + RLC A + AND $03 + ADD A,'0' + LD (RTC_PRINT_BUFFER+03),A + + ; digit 05 + LD A,C ; put value output in Reg C into accumulator + AND $0F + ADD A,'0' + LD (RTC_PRINT_BUFFER+04),A + + ; digit 06 + LD A,'-' + LD (RTC_PRINT_BUFFER+05),A + +; { Read day } + + CALL RTC_RD ; read value from DS1302, value is in Reg C + + ; digit 04 +; LD A,C ; put value output in Reg C into accumulator +; RLC A +; RLC A +; RLC A +; RLC A +; AND $03 +; ADD A,'0' +; LD (RTC_PRINT_BUFFER+03),A + + ; digit 04 +; LD A,C ; put value output in Reg C into accumulator +; AND $0F +; ADD A,'0' +; LD (RTC_PRINT_BUFFER+03),A + +; add special code to put "DAY" value at end of string until better solution known + + ; digit 18 + LD A,'-' + LD (RTC_PRINT_BUFFER+17),A + + ; digit 19 + LD A,C ; put value output in Reg C into accumulator + RLC A + RLC A + RLC A + RLC A + AND $0F + ADD A,'0' + LD (RTC_PRINT_BUFFER+18),A + + ; digit 20 + LD A,C ; put value output in Reg C into accumulator + AND $0F + ADD A,'0' + LD (RTC_PRINT_BUFFER+19),A + +; { Read year } + + CALL RTC_RD ; read value from DS1302, value is in Reg C + + ; digit 01 + LD A,C ; put value output in Reg C into accumulator + RLC A + RLC A + RLC A + RLC A + AND $0F + ADD A,'0' + LD (RTC_PRINT_BUFFER+00),A + + ; digit 02 + LD A,C ; put value output in Reg C into accumulator + AND $0F + ADD A,'0' + LD (RTC_PRINT_BUFFER+01),A + + ; digit 03 + LD A,'-' + LD (RTC_PRINT_BUFFER+02),A + + CALL RTC_RESET_ON ; turn RTC reset back on + EI ; re-enable interrupts + + RET ; Yes, end function and return + + +; function RTC_SET_NOW +; uses A, D, E +; +; based on following algorithm +; +; { Set time to 96-02-18 19:43:00 } +; PROCEDURE rtc_set_now; +; BEGIN +; rtc_wr_unprotect(); +; { Set seconds } +; rtc_write(0,0); +; { Set minutes } +; rtc_write(1,$43); +; { Set hours } +; rtc_write(2,$19); +; { Set date } +; rtc_write(3,$18); +; { Set month } +; rtc_write(4,$02); +; { Set day } +; rtc_write(5,$07); +; { Set year } +; rtc_write(6,$96); +; rtc_wr_protect(); +; END; + +RTC_SET_NOW: +; set time to 07-02-23 19:45:00-05 <-Friday + CALL RTC_WR_UNPROTECT +; seconds + LD D,$00 + LD A,(SECONDS) + LD E,A + CALL RTC_WRITE + +; minutes + LD D,$01 + LD A,(MINUTES) + LD E,A + CALL RTC_WRITE + +; hours + LD D,$02 + LD A,(HOURS) + LD E,A + CALL RTC_WRITE + +; date + LD D,$03 + LD A,(DATE) + LD E,A + CALL RTC_WRITE + +; month + LD D,$04 + LD A,(MONTH) + LD E,A + CALL RTC_WRITE + +; day + LD D,$05 + LD A,(DAY) + LD E,A + CALL RTC_WRITE + +; year + LD D,$06 + LD A,(YEAR) + LD E,A + CALL RTC_WRITE + + CALL RTC_WR_PROTECT + RET + +RTC_INIT_NOW: +; set time to Current Time + +; year + LD DE,RTC_TOP_LOOP1_INIT_YEAR + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL HEXIN + LD (YEAR),A + +; month + LD DE,RTC_TOP_LOOP1_INIT_MONTH + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL HEXIN + LD (MONTH),A + +; date + LD DE,RTC_TOP_LOOP1_INIT_DATE + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL HEXIN + LD (DATE),A + +; hours + LD DE,RTC_TOP_LOOP1_INIT_HOURS + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL HEXIN + LD (HOURS),A + +; minutes + LD DE,RTC_TOP_LOOP1_INIT_MINUTES + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL HEXIN + LD (MINUTES),A + +; seconds + LD DE,RTC_TOP_LOOP1_INIT_SECONDS + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL HEXIN + LD (SECONDS),A + +; day + LD DE,RTC_TOP_LOOP1_INIT_DAY + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL HEXIN + LD (DAY),A + + RET + + +; function RTC_RESTART +; +; uses A, D, E, +; +; based on the following algorithm +; +; { Restart clock, set seconds to 00 } +; PROCEDURE rtc_restart; +; BEGIN +; rtc_wr_unprotect(); +; { Set seconds } +; rtc_write(0,0); +; rtc_wr_protect(); +; END; + +RTC_RESTART: + CALL RTC_WR_UNPROTECT + LD D,$00 + LD E,$00 + CALL RTC_WRITE + CALL RTC_WR_PROTECT + RET + + +; function RTC_CHARGE_ENABLE +; +; uses A, D, E +; +; based on following algorithm +; +; PROCEDURE rtc_charge_enable; +; BEGIN +; rtc_wr_unprotect(); +; { Enable trickle charger, 2kohm, 1 diode } +; rtc_write(8,$A5); +; rtc_wr_protect(); +; END; +; +; Trickle Charge Current: +; +; Imax = (5.0V - (0.7 * Ndiode)) / R +; (5.0 - (0.7 * 1)) / 2000 = .00215A = 2.15 milliamps +; (5.0 - (0.7 * 1)) / 8000 = 0.0005375A = .537 milliamps +; + +RTC_CHARGE_ENABLE + CALL RTC_WR_UNPROTECT + LD D,$08 + LD E,$A5 + CALL RTC_WRITE + CALL RTC_WR_PROTECT + RET + + +; function RTC_CHARGE_DISABLE +; +; uses A, D, E +; +; based on following algorithm +; +; PROCEDURE rtc_charge_disable; +; BEGIN +; rtc_wr_unprotect(); +; { Disable trickle charger} +; rtc_write(8,$00); +; rtc_wr_protect(); +; END; + +RTC_CHARGE_DISABLE + CALL RTC_WR_UNPROTECT + LD D,$08 + LD E,$00 + CALL RTC_WRITE + CALL RTC_WR_PROTECT + RET + + +; function TEST_BIT_DELAY +; +; based on the following algorithm +; +; +; PROCEDURE test_bit_delay(); +; var +; i,t0,t1 : int; +; BEGIN +; putln("Testing bit delay..."); +; t0 := sys_time(); +; for i := 0 while i < 1000 do inc(i) loop +; rtc_bit_delay(); +; end loop; +; t1 := sys_time(); +; putln(i," rtc_bit_delay calls took ",t1-t0," ms."); +; END; + +RTC_TEST_BIT_DELAY + LD DE,TESTING_BIT_DELAY_MSG + LD C,09H ; CP/M write string to console call + CALL 0005H + LD C,01H ; CP/M console input call + CALL 0005H + + ; test should take approximately 43 seconds based on the following code analysis + ; of Z80 T-states on a 4 MHz processor + ; =(4+15*(7+255*(7+255*(17+144+4+10)+4+10)+10)+7)/4/1000000 + + LD B,$0F +PAUSE: + LD C,$FF +PAUSE1: + LD A,$FF ; ADJUST THE TIME 13h IS FOR 4 MHZ +PAUSE2: + CALL RTC_BIT_DELAY ; CAUSE 36uS DELAY + DEC A ; DEC COUNTER. + JP NZ,PAUSE2 ; JUMP TO PAUSE2 IF A <> 0. + DEC C ; DEC COUNTER + JP NZ,PAUSE1 ; JUMP TO PAUSE1 IF C <> 0. + DJNZ PAUSE ; JUMP TO PAUSE IF B <> 0. + + LD DE,TESTING_BIT_DELAY_OVER + LD C,09H ; CP/M write string to console call + CALL 0005H + RET + + +; function RTC_HELP +; +; based on following algorithm +; +; PROCEDURE help(); +; BEGIN +; putln(); +; putln("rtc: ",version); +; putln("rtc: Commands: (E)xit (T)ime st(A)rt (S)et (R)aw (L)oop (C)harge (N)ocharge (H)elp"); +; END; + +RTC_HELP + LD DE,RTC_HELP_MSG + LD C,09H ; CP/M write string to console call + CALL 0005H + RET + +; function RTC_INIT +; +; Determine RTC port based on hardware platform +; and record it dynamically in code (see RTC_IN and RTC_OUT). +; + +RTC_INIT: + CALL IDBIO ; Id BIOS, 1=HBIOS, 2=UBIOS + DEC A ; Test for HBIOS + JP Z,HINIT ; Do HBIOS setup + DEC A ; Test for UBIOS + JP Z,UINIT ; Do UBIOS setup +; + ; Neither UNA nor RomWBW + LD DE,BIOERR ; BIOS error message + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + JP 0 ; Bail out! +; +HINIT: +; + ; Display RomWBW notification string + LD DE,HBTAG ; BIOS notification string + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Get platform id from RomWBW HBIOS + LD B,0F1H ; HBIOS VER function 0xF1 + LD C,0 ; Required reserved value + RST 08 ; Do it, L := Platform ID + LD A,L ; Move to A +; + ; Assign correct port to C + LD C,PORT_SBC + LD DE,PLT_SBC + CP $01 ; SBC + JR Z,RTC_INIT2 + CP $02 ; ZETA + JR Z,RTC_INIT2 + CP $03 ; ZETA 2 + JR Z,RTC_INIT2 +; + LD C,PORT_N8 + LD DE,PLT_N8 + CP $04 ; N8 + JR Z,RTC_INIT2 +; + LD C,PORT_MK4 + LD DE,PLT_MK4 + CP $05 ; Mark IV + JR Z,RTC_INIT2 +; + LD C,PORT_RCZ80 + LD DE,PLT_RCZ80 + CP $07 ; RCBus w/ Z80 + JR Z,RTC_INIT2 +; + LD C,PORT_RCZ180 + LD DE,PLT_RCZ180 + CP $08 ; RCBus w/ Z180 + JR Z,RTC_INIT2 +; + LD C,PORT_EZZ80 + LD DE,PLT_EZZ80 + CP $09 ; Easy Z80 + JR Z,RTC_INIT2 +; + LD C,PORT_SCZ180 + LD DE,PLT_SCZ180 + CP $0A ; SCZ180 + JR Z,RTC_INIT2 +; + LD C,PORT_DYNO + LD DE,PLT_DYNO + CP 11 ; DYNO + JR Z,RTC_INIT2 +; + LD C,PORT_RCZ280 + LD DE,PLT_RCZ280 + CP 12 ; RCZ280 + JR Z,RTC_INIT2 +; + LD C,PORT_MBC + LD DE,PLT_MBC + CP 13 ; MBC + JR Z,RTC_INIT2 +; + LD C,PORT_RPH + LD DE,PLT_RPH + CP 14 ; RHYOPHYRE + JR Z,RTC_INIT2 +; + ; Unknown platform + LD DE,PLTERR ; BIOS error message + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + JP 0 ; Bail out! +; +UINIT: + ;; Display UNA notification string + ;LD DE,UBTAG ; BIOS notification string + ;LD C,9 ; BDOS string display function + ;CALL BDOS ; Do it +; + ; Notify UNA not supported at present + LD DE,UBERR ; BIOS not support message + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + JP 0 ; Bail out! + +RTC_INIT2: + ; Record port number in code routines + LD A,C + LD (INP),A + LD (OUTP),A +; + ; Display platform + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + RET + +; +; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 +; +IDBIO: +; + ; Check for UNA (UBIOS) + LD A,(0FFFDH) ; fixed location of UNA API vector + CP 0C3H ; jp instruction? + JR NZ,IDBIO1 ; if not, not UNA + LD HL,(0FFFEH) ; get jp address + LD A,(HL) ; get byte at target address + CP 0FDH ; first byte of UNA push ix instruction + JR NZ,IDBIO1 ; if not, not UNA + INC HL ; point to next byte + LD A,(HL) ; get next byte + CP 0E5H ; second byte of UNA push ix instruction + JR NZ,IDBIO1 ; if not, not UNA, check others + LD A,2 ; UNA BIOS id = 2 + RET ; and done +; +IDBIO1: + ; Check for RomWBW (HBIOS) + LD HL,(0FFFEH) ; HL := HBIOS ident location + LD A,'W' ; First byte of ident + CP (HL) ; Compare + JR NZ,IDBIO2 ; Not HBIOS + INC HL ; Next byte of ident + LD A,~'W' ; Second byte of ident + CP (HL) ; Compare + JR NZ,IDBIO2 ; Not HBIOS + LD A,1 ; HBIOS BIOS id = 1 + RET ; and done +; +IDBIO2: + ; No idea what this is + XOR A ; Setup return value of 0 + RET ; and done + + +; function RTC_TOP_LOOP +; +; based on following algorithm +; +; PROCEDURE toploop(); +; var +; err,i,n,fd : int; +; BEGIN +; putln(); +; help(); +; rtc_reset_on(); +; hold(100); +; test_bit_delay(); +; rtc_charge_disable(); +; putln("rtc: trickle charger disabled."); +; loop +; put("rtc>"); +; gets(line); +; if line = "exit" then +; putln("Bye."); +; exit(0); +; elsif line = "charge" then +; putln("Trickle charger enabled."); +; rtc_charge_enable(); +; elsif line = "nocharge" then +; putln("Trickle charger disabled."); +; rtc_charge_disable(); +; elsif line = "start" then +; rtc_restart(); +; putln("Restarting RTC"); +; elsif line = "t" then +; rtc_get_time(line); +; putln("Current time: ",line); +; elsif line = "raw" then +; putln(); +; putln("Raw read loop, hit any key to stop..."); +; while read(0,@n,1 + RD_NOWAIT) = 0 loop +; put(#13,"sec=",hexstr(rtc_read(0))^); +; put(" min=",hexstr(rtc_read(1))^); +; hold(500); +; end loop; +; elsif line = "loop" then +; putln(); +; putln("Clock loop, hit any key to stop..."); +; while read(0,@n,1 + RD_NOWAIT) = 0 loop +; rtc_get_time(line); +; put(#13,line); +; hold(200); +; end loop; +; elsif line = "set" then +; putln("Setting RTC time to 96-02-18 19:43:00"); +; rtc_set_now(); +; elsif (line = "help") or (line = "?") then +; help(); +; elsif length(line) <> 0 then +; putln("You typed: """,line,""""); +; end; +; end loop; +; END toploop; +; Note:above code is not fully in sync with current menu code + +RTC_TOP_LOOP: + CALL RTC_RESET_ON + CALL RTC_BIT_DELAY + CALL RTC_BIT_DELAY + CALL RTC_BIT_DELAY + + LD A,(FCB+1) ; If there a command line tail + CP '/' ; get the command and feed it + LD A,(FCB+2) ; into the input stream + JR Z,RTC_UCL + + LD DE,CRLF_MSG + LD C,09H ; CP/M write string to console call + CALL 0005H + + CALL RTC_HELP + +RTC_TOP_LOOP_1: + LD DE,RTC_TOP_LOOP1_PROMPT + LD C,09H ; CP/M write string to console call + CALL 0005H + + LD C,01H ; CP/M console input call + CALL 0005H +RTC_UCL: + AND %01011111 ; handle lower case responses to menu + + CP 'L' + JP Z,RTC_TOP_LOOP_LOOP + + CP 'R' + JP Z,RTC_TOP_LOOP_RAW + + CP 'G' + JP Z,RTC_TOP_LOOP_GET + + CP 'P' + JP Z,RTC_TOP_LOOP_PUT + + CP 'E' +; JP Z,RTC_TOP_LOOP_EXIT + RET Z + + CP 'H' + JP Z,RTC_TOP_LOOP_HELP + + CP 'D' + JP Z,RTC_TOP_LOOP_DELAY + + CP 'B' + JP Z,RTC_TOP_LOOP_BOOT + + CP 'W' + JP Z,RTC_TOP_LOOP_WARMSTART + + CP 'C' + JP Z,RTC_TOP_LOOP_CHARGE + + CP 'N' + JP Z,RTC_TOP_LOOP_NOCHARGE + + CP 'A' + JP Z,RTC_TOP_LOOP_START + + CP 'S' + JP Z,RTC_TOP_LOOP_SET + + CP 'I' + JP Z,RTC_TOP_LOOP_INIT + + CP 'T' + JP Z,RTC_TOP_LOOP_TIME + + LD DE,CRLF_MSG + LD C,09H ; CP/M write string to console call + CALL 0005H + + JR RTC_TOP_LOOP_1 + +;RTC_TOP_LOOP_EXIT: +; RET + +RTC_TOP_LOOP_HELP: + CALL RTC_HELP + JP RTC_TOP_LOOP_1 + +RTC_TOP_LOOP_DELAY: + CALL RTC_TEST_BIT_DELAY + JP RTC_TOP_LOOP_1 + +RTC_TOP_LOOP_BOOT: + LD DE,BOOTMSG ; BOOT message + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + ; WAIT FOR MESSAGE TO BE DISPLAYED + LD HL,10000 +DELAY_LOOP: ; LOOP IS 26TS + DEC HL ; 6TS + LD A,H ; 4TS + OR L ; 4TS + JR NZ,DELAY_LOOP ; 12TS + ; RESTART SYSTEM FROM ROM BANK 0, ADDRESS $0000 + LD B,BF_SYSRESET ; SYSTEM RESTART + LD C,BF_SYSRES_COLD ; COLD START + CALL $FFF0 ; CALL HBIOS + + +RTC_TOP_LOOP_WARMSTART: + LD B,BF_SYSRESET ; SYSTEM RESTART + LD C,BF_SYSRES_WARM ; WARM START + CALL $FFF0 ; CALL HBIOS + +RTC_TOP_LOOP_CHARGE: + LD DE,RTC_TOP_LOOP1_CHARGE + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL RTC_CHARGE_ENABLE + LD A,(FCB+1) ; If we came from the + CP '/' ; command line + RET Z ; exit back to CP/M + JP RTC_TOP_LOOP_1 + +RTC_TOP_LOOP_NOCHARGE: + LD DE,RTC_TOP_LOOP1_NOCHARGE + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL RTC_CHARGE_DISABLE + LD A,(FCB+1) ; If we came from the + CP '/' ; command line + RET Z ; exit back to CP/M + JP RTC_TOP_LOOP_1 + +RTC_TOP_LOOP_START: + LD DE,RTC_TOP_LOOP1_START + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL RTC_RESTART + JP RTC_TOP_LOOP_1 + +RTC_TOP_LOOP_SET: + LD DE,RTC_TOP_LOOP1_SET + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL RTC_SET_NOW + JP RTC_TOP_LOOP_1 + +RTC_TOP_LOOP_INIT: + LD DE,RTC_TOP_LOOP1_INIT + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL RTC_INIT_NOW + JP RTC_TOP_LOOP_1 + +RTC_TOP_LOOP_TIME: + LD DE,RTC_TOP_LOOP1_TIME + LD C,09H ; CP/M write string to console call + CALL 0005H + CALL RTC_GET_TIME + LD DE,RTC_PRINT_BUFFER + LD C,09H ; CP/M write string to console call + CALL 0005H + LD A,(FCB+1) ; If we came from the + CP '/' ; command line + RET Z ; exit back to CP/M + JP RTC_TOP_LOOP_1 + +RTC_TOP_LOOP_RAW: + LD DE,RTC_TOP_LOOP1_RAW + LD C,09H ; CP/M write string to console call + CALL 0005H +RTC_TOP_LOOP_RAW1: + +; { Read seconds } + LD D,$00 ; seconds register in DS1302 + CALL RTC_READ ; read value from DS1302, value is in Reg C + + ; digit 16 + LD A,C ; put value output in Reg C into accumulator + RLC A + RLC A + RLC A + RLC A + AND $07 + ADD A,'0' + LD (RTC_PRINT_BUFFER+15),A + + ; digit 17 + LD A,C ; put value output in Reg C into accumulator + AND $0F + ADD A,'0' + LD (RTC_PRINT_BUFFER+16),A + +; { Read minutes } + + LD D,$01 ; minutes register in DS1302 + CALL RTC_READ ; read value from DS1302, value is in Reg C + + ; digit 13 + LD A,C ; put value output in Reg C into accumulator + RLC A + RLC A + RLC A + RLC A + AND $07 + ADD A,'0' + LD (RTC_PRINT_BUFFER+12),A + + ; digit 14 + LD A,C ; put value output in Reg C into accumulator + AND $0F + ADD A,'0' + LD (RTC_PRINT_BUFFER+13),A + + ; digit 15 + LD A,':' + LD (RTC_PRINT_BUFFER+14),A + + ; digits 1-12 and 18-20 are spaces + LD A,' ' ; space + LD (RTC_PRINT_BUFFER+19),A + LD (RTC_PRINT_BUFFER+18),A + LD (RTC_PRINT_BUFFER+17),A + LD (RTC_PRINT_BUFFER+11),A + LD (RTC_PRINT_BUFFER+10),A + LD (RTC_PRINT_BUFFER+09),A + LD (RTC_PRINT_BUFFER+08),A + LD (RTC_PRINT_BUFFER+07),A + LD (RTC_PRINT_BUFFER+06),A + LD (RTC_PRINT_BUFFER+05),A + LD (RTC_PRINT_BUFFER+04),A + LD (RTC_PRINT_BUFFER+03),A + LD (RTC_PRINT_BUFFER+02),A + LD (RTC_PRINT_BUFFER+01),A + LD (RTC_PRINT_BUFFER+00),A + + LD DE,RTC_PRINT_BUFFER + LD C,09H ; CP/M write string to console call + CALL 0005H + + LD C,01H ; CP/M console input call + CALL 0005H + + CP ' ' ; space + JP Z,RTC_TOP_LOOP_RAW1 + + JP RTC_TOP_LOOP_1 + +RTC_TOP_LOOP_LOOP: + LD DE,RTC_TOP_LOOP1_LOOP + LD C,09H ; CP/M write string to console call + CALL 0005H + +RTC_TOP_LOOP_LOOP1: + CALL RTC_GET_TIME + + LD DE,RTC_PRINT_BUFFER + LD C,09H ; CP/M write string to console call + CALL 0005H + + LD C,01H ; CP/M console input call + CALL 0005H + + CP ' ' + JP Z,RTC_TOP_LOOP_LOOP1 + + JP RTC_TOP_LOOP_1 + +RTC_TOP_LOOP_PUT: + LD A,$01 ; set PUT as true + LD (GET_PUT),A +RTC_TOP_LOOP_GET: + LD DE,RTC_TOP_LOOP1_GET + LD C,09H ; CP/M write string to console call + CALL 0005H + + CALL HEXIN ; read NVRAM address + LD (PUT_ADR),A ; store for possible PUT later + +; { Read NVRAM address } + LD D,A ; seconds register in DS1302 + CALL RTC_READ ; read value from DS1302, value is in Reg C + + ; first digit + LD A,C ; put value output in Reg C into accumulator + RLC A + RLC A + RLC A + RLC A + AND $0F + CP 0AH ;TEST FOR NUMERIC & convert to ASCII + JR C,NUM1 ;if not ALPHA, its numeric and skip + ADD A,$07 + +NUM1: ADD A,'0' + LD (RTC_GET_BUFFER),A + + ; second digit + LD A,C ; put value output in Reg C into accumulator + AND $0F + CP 0AH ;TEST FOR NUMERIC & convert to ASCII + JR C,NUM2 ;if not ALPHA, its numeric and skip + ADD A,$07 + +NUM2: ADD A,'0' + LD (RTC_GET_BUFFER+1),A + + LD DE,CRLF_MSG + LD C,09H ; CP/M write string to console call + CALL 0005H + + LD DE,RTC_GET_BUFFER + LD C,09H ; CP/M write string to console call + CALL 0005H + + LD A,(GET_PUT) ; check if GET or PUT mode + CP $00 + JP Z,RTC_GET_PUT_EXIT ; if GET mode, exit + + LD DE,RTC_TOP_LOOP1_PUT + LD C,09H ; CP/M write string to console call + CALL 0005H + +; { Write NVRAM address } + + CALL RTC_WR_UNPROTECT + + CALL HEXIN ; read NVRAM address + LD E,A ; new data for NVRAM register in DS1302 + LD A,(PUT_ADR) + LD D,A ; load address from before + + CALL RTC_WRITE ; read value from DS1302, value is in Reg C + + CALL RTC_WR_PROTECT + +RTC_GET_PUT_EXIT: + LD A,$00 ; reset GET mode + LD (GET_PUT),A + JP RTC_TOP_LOOP_1 + +; +; Text Strings +; + +MSG: + .TEXT "Start RTC Program" +CRLF_MSG: + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; Line terminator + +TESTING_BIT_DELAY_MSG: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Testing bit delay. Successful test is ~43 sec." + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Start clock and press space bar." + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; Line terminator + +TESTING_BIT_DELAY_OVER: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Test complete. Stop clock." + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; Line terminator + +RTC_HELP_MSG: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "RTC: Version 1.8" + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Commands: E)xit T)ime st(A)rt S)et R)aw L)oop C)harge N)ocharge D)elay I)nit G)et P)ut B)oot W)arm-start H)elp" + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_PROMPT: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "RTC>" + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_CHARGE: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Trickle charger enabled." + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_NOCHARGE: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Trickle charger disabled." + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_START: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Restart RTC." + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_TIME: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Current time: " + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_RAW: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Raw read Loop. Press SPACE BAR for next." + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_LOOP: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Clock Loop. Press SPACE BAR for next." + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_SET: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Set RTC time." + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_INIT: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Init date/time." + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_GET: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "Get NVRAM addr:" + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_PUT: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "NVRAM data:" + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_INIT_SECONDS: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "SECONDS:" + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_INIT_MINUTES: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "MINUTES:" + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_INIT_HOURS: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "HOURS:" + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_INIT_DATE: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "DATE:" + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_INIT_MONTH: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "MONTH:" + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_INIT_DAY: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "DAY:" + .DB "$" ; Line terminator + +RTC_TOP_LOOP1_INIT_YEAR: + .DB 0Ah, 0Dh ; line feed and carriage return + .TEXT "YEAR:" + .DB "$" ; Line terminator + +RTC_PRINT_BUFFER: + .FILL 20,0 ; Buffer for formatted date & time to print + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; line terminator + +RTC_GET_BUFFER: + .FILL 2,0 ; Buffer for formatted NVRAM data to print + .DB 0Ah, 0Dh ; line feed and carriage return + .DB "$" ; line terminator + +BIOERR .TEXT "\r\nUnknown BIOS, aborting...\r\n$" +PLTERR .TEXT "\r\n\r\nUnknown/unsupported hardware platform, aborting...\r\n$" +UBERR .TEXT "\r\nUNA UBIOS is not currently supported, aborting...\r\n$" +HBTAG .TEXT "RomWBW HBIOS$" +UBTAG .TEXT "UNA UBIOS" +BOOTMSG .TEXT "\r\n\r\nRebooting...$" +PLT_SBC .TEXT ", SBC/Zeta RTC Latch Port 0x70\r\n$" +PLT_N8 .TEXT ", N8 RTC Latch Port 0x88\r\n$" +PLT_MK4 .TEXT ", Mark 4 RTC Latch Port 0x8A\r\n$" +PLT_RCZ80 .TEXT ", RCBus Z80 RTC Module Latch Port 0xC0\r\n$" +PLT_RCZ180 .TEXT ", RCBus Z180 RTC Module Latch Port 0x0C\r\n$" +PLT_EZZ80 .TEXT ", Easy Z80 RTC Module Latch Port 0xC0\r\n$" +PLT_SCZ180 .TEXT ", SC Z180 RTC Module Latch Port 0x0C\r\n$" +PLT_DYNO .TEXT ", DYNO RTC Module Latch Port 0x0C\r\n$" +PLT_RCZ280 .TEXT ", RCBus Z280 RTC Module Latch Port 0xC0\r\n$" +PLT_MBC .TEXT ", MBC RTC Latch Port 0x70\r\n$" +PLT_RPH .TEXT ", RHYOPHYRE RTC Latch Port 0x84\r\n$" + +; +; Generic FOR-NEXT loop algorithm +; +; LD A,$00 ; set A=0 index counter of FOR loop +;FOR_LOOP: +; PUSH AF ; save accumulator as it is the index counter in FOR loop +; { contents of FOR loop here } ; setup RTC with RST and RD high, SCLK low +; POP AF ; recover accumulator as it is the index counter in FOR loop +; INC A ; increment A in FOR loop (A=A+1) +; CP $08 ; is A < $08 ? +; JP NZ,FOR_LOOP ; No, do FOR loop again +; RET ; Yes, end function and return. Read RTC value is in C + +YEAR .DB $18 +MONTH .DB $11 +DATE .DB $08 +HOURS .DB $00 +MINUTES .DB $00 +SECONDS .DB $00 +DAY .DB $05 +GET_PUT .DB $00 + +PUT_ADR .DB 0 + + .END + diff --git a/Source/Apps/rtchb.asm b/Source/Apps/rtchb.asm new file mode 100644 index 00000000..9fe4ff15 --- /dev/null +++ b/Source/Apps/rtchb.asm @@ -0,0 +1,233 @@ +;================================================================================================== +; GENERIC HBIOS DATE AND TIME +;================================================================================================== +; + .ECHO "rtchb\n" +; +; HBIOS FORMAT = YYMMDDHHMMSS +; + .ORG 100H +; + LD (HBC_STK),SP ; SETUP A + LD SP,HBC_LOC ; LOCAL STACK +; + LD B,$20 ; READ CLOCK DATA INTO BUFFER + LD HL,HBC_BUF ; DISPLAY TIME AND DATE FROM BUFFER + RST 08 +; + OR A ; EXIT IF NO + JR NZ,HBC_ERR ; DRIVER OR HARDWARE +; +#IF (0) + PUSH AF + LD A,6 + LD DE,HBC_BUF ; DISLAY DATA READ +; CALL PRTHEXBUF + CALL NEWLINE + POP AF +#ENDIF +; + CALL HBC_DISP +; +HBC_EXIT: + LD SP,(HBC_STK) ; RESTORE STACK AND + RET ; RETURN TO CP/M +; +HBC_BUF .FILL 6,0 ; DATE AND TIME STORAGE +HBC_STK .DW 2 ; SAVE STACK +; +;----------------------------------------------------------------------------- +; DISPLAY CLOCK INFORMATION FROM DATA STORED IN BUFFER +; +HBC_DISP: + LD HL,HBC_CLKTBL +HBC_CLP:LD C,(HL) + INC HL + LD D,(HL) + CALL HBC_BCD + INC HL + LD A,(HL) + OR A + RET Z + CALL COUT + INC HL + JR HBC_CLP + RET +; +HBC_CLKTBL: + .DB 02H, 00111111B, '/' + .DB 01H, 00011111B, '/' + .DB 00H, 11111111B, ' ' + .DB 03H, 00011111B, ':' + .DB 04H, 01111111B, ':' + .DB 05H, 01111111B, 00H +; +HBC_BCD:PUSH HL + LD HL,HBC_BUF ; READ VALUE FROM + LD B,0 ; BUFFER, INDEXED BY A + ADD HL,BC + LD A,(HL) + AND D ; MASK OFF UNNEEDED + SRL A + SRL A + SRL A + SRL A + ADD A,30H + CALL COUT + LD A,(HL) + AND 00001111B + ADD A,30H + CALL COUT + POP HL + RET +; +;----------------------------------------------------------------------------- +; DISPLAY ERROR + +HBC_ERR: + PUSH HL + LD HL,HBC_FAIL + JR HBC_PRTERR +; +HBC_PRTERR: + CALL PRTSTR + CALL NEWLINE + POP HL + JP HBC_EXIT +; +HBC_FAIL .DB "ERROR$" +; +;----------------------------------------------------------------------------- +; GENERIC CP/M ROUTINES +; +BDOS .EQU 5 ;ENTRY BDOS +BS .EQU 8 ;BACKSPACE +TAB .EQU 9 ;TABULATOR +LF .EQU 0AH ;LINE-FEED +CR .EQU 0DH ;CARRIAGE-RETURN +; +; OUTPUT TEXT AT HL +; +PRTSTR: LD A,(HL) + CP '$' + RET Z + CALL COUT + INC HL + JR PRTSTR +; +;Output WORD +;*********** +; +;PARAMETER: Entry WORD IN HL +;********* +; +OUTW: LD A,H + CALL OUTB + LD A,L + CALL OUTB + RET +; +;Output BYTE +;*********** +; +;PARAMETER: Entry BYTE IN A +;********* +; +OUTB: PUSH AF + RRCA + RRCA + RRCA + RRCA + AND 0FH + CALL HBTHE ;Change Half-BYTE + POP AF + AND 0FH + CALL HBTHE + RET +; +;Output HALF-BYTE +;**************** +; +;PARAMETER: Entry Half-BYTE IN A (BIT 0 - 3) +;********* +; +HBTHE: CP 0AH + JR C,HBTHE1 + ADD A,7 ;Character to Letter +HBTHE1: ADD A,30H + LD E,A + CALL PCHAR + RET +; +; +;Output on Screen +;**************** +; +PRBS: LD E,BS + CALL PCHAR + RET +; +;Output CR+LF on Screen +;********************** +; +NEWLINE: +CRLF: LD E,CR + CALL PCHAR + LD E,LF + CALL PCHAR + RET +; +;Output ASCII-Character +;********************** +; +COUT: +PRINP: PUSH AF + PUSH DE + LD E,A + CALL PCHAR + POP DE + POP AF + RET +; +;CALL BDOS with Register Save +;**************************** +; +INCHA: LD C,1 ;INPUT CHARACTER TO A + JR BDO +PCHAR: LD C,2 ;PRINT CHARACTER IN E + JR BDO +PSTRIN: LD C,9 ;PRINT STRING + JR BDO +INBUFF: LD C,10 ;READ CONSOLE-BUFFER + JR BDO +CSTS: LD C,11 ;CONSOLE-STATUS + JR BDO +OPEN: LD C,15 ;OPEN FILE + JR BDO +CLOSE: LD C,16 ;CLOSE FILE + JR BDO +DELETE: LD C,19 ;DELETE FILE + JR BDO +READS: LD C,20 ;READ SEEK + JR BDO +WRITES: LD C,21 ;WRITE SEEK + JR BDO +MAKE: LD C,22 ;MAKE FILE + JR BDO +SETDMA: LD C,26 ;SET DMA-ADDRESS +BDO: PUSH HL + PUSH DE + PUSH BC + PUSH IX + PUSH IY + CALL BDOS + POP IY + POP IX + POP BC + POP DE + POP HL + RET +; + .FILL 128,$FF +HBC_LOC: + .END diff --git a/Source/Apps/Startup.asm b/Source/Apps/startup.asm similarity index 100% rename from Source/Apps/Startup.asm rename to Source/Apps/startup.asm diff --git a/Source/Apps/syscopy.asm b/Source/Apps/syscopy.asm new file mode 100644 index 00000000..10b85bd2 --- /dev/null +++ b/Source/Apps/syscopy.asm @@ -0,0 +1,989 @@ +;=============================================================================== +; SysCopy - Copy System Image to/from reserved tracks of disk for RomWBW +; adaptation of CP/M 2.2 & CP/M 3 +;=============================================================================== +; +; Author: Wayne Warthen (wwarthen@gmail.com) +;_______________________________________________________________________________ +; +; Usage: +; SYSCOPY [=] +; +; and may be a drive or a file reference +; If is not specified, the system image will +; be read from the current drive +;_______________________________________________________________________________ +; +; Change Log: +; 2016-04-24 [WBW] Updated to preserve MBR partition table +; 2020-02-17 [WBW] Updated for CP/M 3 +; 2020-05-16 [WBW] Fixed SPT for CP/M 3 +;_______________________________________________________________________________ +; +; ToDo: +; 1) Add option to wait/prompt for disk change +; 2) Allow and to be memory +;_______________________________________________________________________________ +; +;=============================================================================== +; Definitions +;=============================================================================== +; +false .equ 0 ; define true +true .equ ~false ; define false +; +stksiz .equ $40 ; we are a stack pig +; +restart .equ $0000 ; CP/M restart vector +bdos .equ $0005 ; BDOS invocation vector +; +imgbuf .equ $900 ; load point for system image (from original SYSGEN) +mbrbuf .equ imgbuf+$4000 ; load point for MBR storage +; +;=============================================================================== +; Code Section +;=============================================================================== +; + .org $100 + ; setup stack (save old value) + ld (stksav),sp ; save stack + ld sp,stack ; set new stack + ; processing... + call main ; do the real work + call crlf ; formatting + ; return + jp 0 ; return to CP/M via reset + ; + ;ld sp,(stksav) ; restore stack + ;ret ; return to CP/M w/o reset +; +; Main routine +; +main: + call init ; initialize + ret nz ; abort on failure + + call parse ; parse command tail + ret nz ; abort on failure + + call confirm ; confirm pending action + ret nz ; abort on failure + + call crlf ; formatting + + ld de,msgrd + call prtstr ; display "reading" message + call rdimg ; do the image read + ret nz ; abort on failure + + ld de,msgwrt + call prtstr ; display "writing" message + call wrtimg ; do the image write + ret nz ; abort on failure + + ld de,msgdon ; completion message + call prtstr ; display it + + ret +; +; Initialization +; +init: + ; add check for RomWBW? + ; + ; get OS version + ld c,12 ; BDOS get os version + call bdos ; do it, L=version + cp $30 ; Test for v3.0 + jr c,init1 ; if <, pre v3.0 + ld a,true ; OS v3.0 or above + ld (v3os),a ; save it + jr init2 +init1: + ld a,false ; OS < v3.0 + ld (v3os),a ; save it +init2: + ; locate cbios function table address + ld hl,(restart+1) ; load address of CP/M restart vector + ld de,-3 ; adjustment for start of table + add hl,de ; HL now has start of table + ld (cbftbl),hl ; save it + ; save current drive no + ld c,$19 ; bdos func: get current drive + call bdos ; invoke BDOS function + inc a ; 1-based index for fcb + ld (defdrv),a ; save it + ; print version banner + call crlf ; formatting + ld de,msgban1 ; point to version message part 1 + call prtstr ; print it + ld a,(v3os) ; get OS version flag + or a ; set flags + ld de,msgv2 ; point to V2 mode message + call z,prtstr ; if V2, say so + ld de,msgv3 ; point to V3 mode message + call nz,prtstr ; if V3, say so + call crlf ; formatting + ld de,msgban2 ; point to version message part 2 + call prtstr ; print it + call crlf ; formatting + ; return success + xor a + ret +; +; Parse command tail +; +parse: + ld hl,$81 ; point to start of command tail (after length byte) + call nonblank ; locate start of parms + jp z,erruse ; no parms + ld de,destfcb ; point to destination fcb + call convert ; convert destination spec + jp nz,erramb ; Error, ambiguous file specification + call nonblank ; skip blanks + or a ; end of command tail (null)? + jr z,parse2 ; setup default source fcb + cp '=' ; std delimiter + jr z,parse1 ; valid delimiter, continue + cp '_' ; alt delimiter + jr z,parse1 ; valid delimiter, continue + jp errdlm ; invalid delimiter +parse1: + inc hl ; skip delimiter + call nonblank ; skip blanks +parse2: + ld de,srcfcb ; point to source fcb + call convert ; convert spec to fcb + jp nz,erramb ; Error, ambiguous file specification + ; return success + xor a ; signal success + ret ; done parsing +; +; Confirm pending action with user +; +confirm: + ; prompt + call crlf + ld de,sconf1 + call prtstr + ld hl,srcfcb + call prtfcb + ld de,sconf2 + call prtstr + ld hl,destfcb + call prtfcb + ld de,sconf3 + call prtstr +; + ; get input (imgbuf is used for temp storage) + ld c,$0A ; get console buffer + ld de,imgbuf ; into buf + ld a,1 ; max of 1 character + ld (de),a ; set up buffer + call bdos ; invoke BDOS + ld a,(imgbuf+1) ; get num chars entered + dec a ; check that we got exactly one char + jr nz,confirm ; bad input, re-prompt + ld a,(imgbuf+2) ; get the character + and $DF ; force upper case + cp 'Y' ; compare to Y + ret ; return with Z set appropriately +; +; Read system image +; +rdimg: + ld hl,srcfcb ; point to source fcb + call chkfcb ; check if for drive/file spec + bit 1,a ; is there a file spec? + jp nz,rdfil ; yes, read using file i/o + jp rddsk ; no, read using raw disk i/o +; +; Write system image +; +wrtimg: + ld hl,destfcb ; point to destination fcb + call chkfcb ; check it for drive/file spec + bit 1,a ; is there a file spec? + jp nz,wrfil ; yes, write using file i/o + jp wrdsk ; no, write using raw disk i/o + +; +; Read system image from file system +; +rdfil: + ; open the file + ld c,$0F ; bdos open file + ld de,srcfcb ; source fcb + ld (rwfcb),de ; save it + call bdos ; invoke bdos function + cp $FF ; $FF is error + jp z,errfil ; handle error condition + ; read the header + ld a,$14 ; setup for bdos read sequential + ld (rwfun),a ; save bdos function + ld a,12 ; start with 1536 byte header (12 records) + ld (reccnt),a ; init record counter + ld hl,imgbuf ; start of buffer + ld (bufptr),hl ; init buffer pointer + call rwfil ; read the header + ret nz ; abort on error (no need to close file) + ; check header and get image size + call chkhdr ; verifies marker & ver, hl = image size + ret nz ; abort on error (no need to close file) + ld b,7 ; right shift 7 bits to get 128 byte record count +rdfil1: srl h ; shift right msb + rr l ; shift lsb w/ carry from msb + djnz rdfil1 ; loop till done + ld a,l ; record count to a + ld (reccnt),a ; set remaining records to read + add a,12 ; add the header back + ld (imgsiz),a ; and save the total image size (in records) + call rwfil ; do it + ret nz ; abort on error + ; return via close file + jp closefile ; close file +; +; Write system image to file system +; +wrfil: + ; check for pre-existing target file + ld c,$11 ; bdos find first + ld de,destfcb ; destination fcb + call bdos + cp $FF ; check for error + jr z,wrfil1 ; not there, skip delete + ; delete target file if it exists + ld c,$13 ; bdos delete + ld de,destfcb ; destination fcb + call bdos + cp $FF ; check return code + jp z,errdel ; handle error +wrfil1: ; create target file + ld c,$16 ; bdos create file + ld de,destfcb ; destination fcb + ld (rwfcb),de ; save it + call bdos + cp $FF ; check return code + jp z,errfil ; handle error + ; write the image + ld a,$15 ; setup for bdos write sequential + ld (rwfun),a ; save bdos function + ld a,(imgsiz) ; number of records to write + ld (reccnt),a ; init record counter + ld hl,imgbuf ; start of buffer + ld (bufptr),hl ; init buffer pointer + call rwfil ; do it + ret nz ; abort on error + ; return via close file + jp closefile ; close file +; +; Common routine to handle read/write for file system +; +rwfil: + ld c,$1A ; BDOS set dma + ld de,(bufptr) ; current buffer pointer + push de ; save pointer + call bdos ; do it + pop de ; recover pointer + ld hl,128 ; record length + add hl,de ; increment buffer pointer + ld (bufptr),hl ; save it + ld a,(rwfun) ; get the active function + ld c,a ; set it + ld de,(rwfcb) ; active fcb + call bdos ; do it + or a ; check return code + jp nz,errdos ; BDOS err + ld hl,reccnt ; point to record count + dec (hl) ; decrement record count + jr nz,rwfil ; loop till done + xor a ; signal success + ret ; done +; +; Close file +; +closefile: + ld c,$10 ; BDOS close file + ld de,(rwfcb) ; active fcb + call bdos ; do it + cp $FF ; $FF is error + jp z,errclo ; if error, handle it + xor a ; signal success + ret ; done +; +; Read image directly from disk system tracks using CBIOS +; +rddsk: + ; force return to go through disk reset + ld hl,resdsk ; load address of reset disk routine + push hl ; and put it on the stack + ; set drive for subsequent reads + ld a,(srcfcb) ; get the drive + dec a ; adjust for zero indexing + call setdsk ; setup disk + ret nz ; abort on error + ; set function to read + ld a,13 ; CBIOS func 13: Read + ld (actfnc),a ; save it + ; read the header + ld a,12 ; start with 1536 byte header (12 records) + ld (reccnt),a ; initialize record counter + call rwdsk ; read the header + ret nz ; abort on error + ; check header and get image size + call chkhdr ; check integrity, HL = image size on return + ret nz ; abort on error + ; convert image size to count of 128-byte records + ld b,7 ; right shift 7 bits to get 128 byte record count +rddsk1: srl h ; shift right msb + rr l ; shift lsb w/ carry from msb + djnz rddsk1 ; loop till done + ; set the number of records pending to read + ld a,l ; record count to a + ld (reccnt),a ; set remaining records to read + ; save the total image size (including header) for later + add a,12 ; add the header records back + ld (imgsiz),a ; and save the total image size (in records) + ; read the remaining system image records + call rwdsk ; finish up + ret nz ; abort on error + ; perform BDOS disk reset (critical since we mucked with CBIOS) + ld c,$0D ; BDOS reset disk + call bdos ; do it + ; return + xor a ; signal success + ret ; done +; +; Write image directly to disk system tracks using CBIOS +; +wrdsk: + ; force return to go through disk reset + ld hl,resdsk ; load address of reset disk routine + push hl ; and put it on the stack + ; setup to read existing MBR + ld a,(destfcb) ; get the drive + dec a ; adjust for zero indexing + call setdsk ; setup disk + ret nz ; abort on error + ld hl,mbrbuf ; override to read + ld (bufptr),hl ; ... into MBR buffer + ld a,4 ; 4 records = 1 512 byte sector + ld (reccnt),a ; initialize record counter + ; set function to read + ld a,13 ; CBIOS func 13: Read + ld (actfnc),a ; save it + ; read the existing MBR into memory + call rwdsk ; read the sector + ret nz ; abort on error + ; test for valid partition table ($55, $AA at offset $1FE) + ld hl,(mbrbuf+$1FE); HL := signature + ld a,$55 ; load expected value of first byte + cp l ; check for proper value + jr nz,wrdsk1 ; mismatch, ignore old partition table + ld a,$AA ; load expected value of second byte + cp h ; check for proper value + jr nz,wrdsk1 ; mismatch, ignore old partition table + ; valid MBR, copy existing partition table over to new image + ld hl,mbrbuf+$1BE ; copy from MBR offset of existing MBR + ld de,imgbuf+$1BE ; copy to MBR offset of new image + ld bc,$40 ; size of MBR + ldir ; do it +wrdsk1: ; setup to write the image from memory to disk + ld a,(destfcb) ; get the drive + dec a ; adjust for zero indexing + call setdsk ; setup disk + ret nz ; abort on error + ; set function to write + ld a,14 ; CBIOS func 14: Write + ld (actfnc),a ; save it + ; setup the record count to write + ld a,(imgsiz) ; get previously recorded image size + ld (reccnt),a ; save it as pending record count + ; write the image + call rwdsk ; write the image + ret nz ; abort on error + ; return + xor a ; signal success + ret ; done +; +; Perform BDOS disk reset +; Required after making direct CBIOS disk calls +; +resdsk: + ; perform BDOS disk reset + push af ; preserve status + ld c,$0D ; BDOS reset disk + call bdos ; do it + pop af ; restore status + ret +; +; Setup for CBIOS disk access +; +setdsk: + ; select disk + ld (actdsk),a ; save active disk no + ld c,a ; move to c + ld e,0 ; treat as first select + call cbios ; invoke cbios with... + ;.db $1B ; SELDSK entry offset + .db 9 ; SELDSK entry offset + ; check return (sets HL to DPH address) + ld a,h + or l + jp z,errsel ; HL == 0 is select error + ; set HL to DPB address + ld de,10 ; DPB address is 10 bytes into DPH + add hl,de ; HL := address of DPB pointer + ld a,(hl) ; dereference... + inc hl + ld h,(hl) + ld l,a ; HL := address of DPB + ; extract sectors per track from first word of DPB + ld c,(hl) + inc hl + ld b,(hl) ; BC := sectors per track + ; handle CP/M 3 physical sector size + ld a,(v3os) ; CP/M 3 or greater? + or a ; set flags + jr z,setdsk1 ; if not, continue + ; adjust SPT for CP/M 3 physical sector size + srl b ; divide SPT by 4 + rr c + srl b + rr c +setdsk1: + ld (actspt),bc ; save it + ; ensure there are system tracks (verify that offset field in DPB is not zero) + ld de,12 ; offset field is 12 bytes into DPB + add hl,de ; point to offset field in DPB + ld a,(hl) ; load first byte in A + inc hl ; point to second byte + or (hl) ; or with first byte + jp z,errsys ; if zero, abort (no system tracks) + ; initialize for I/O + ld hl,0 + ld (acttrk),hl ; active track := 0 + ld (actsec),hl ; active sector := 0 + ld hl,imgbuf ; assume r/w to image buffer + ld (bufptr),hl ; reset buffer pointer +; + xor a ; signal success + ret ; done +; +; Read or write (reccnt) sectors to/from disk via CBIOS +; +rwdsk: + ld hl,128 ; assume rec len for < CP/M 3 + ld (reclen),hl ; and save it + ld a,(v3os) ; CP/M 3 or greater? + or a ; set flags + jr z,rwdsk0 ; if not, continue + ; adjust reccnt, logical (128) to physical (512) + ld a,(reccnt) ; get pending rec cnt + add a,3 ; round up + srl a ; shift to + srl a ; ... divide by 4 + ld (reccnt),a ; and resave it + ld hl,512 ; use physical rec len + ld (reclen),hl ; and save it +rwdsk0: + ; setup to read/write a sector + ld bc,(acttrk) ; get active track + call cbios ; invoke cbios with... + ;.db $1E ; SETTRK entry offset + .db 10 ; SETTRK entry offset + ld bc,(actsec) ; get active sector + call cbios ; invoke cbios with... + ;.db $21 ; SETSEC entry offset + .db 11 ; SETSEC entry offset + ld bc,(bufptr) ; get active buffer pointer + call cbios ; invoke cbios with... + ;.db $24 ; SETDMA entry offset + .db 12 ; SETDMA entry offset + ; read/write sector + ld a,(reccnt) ; get the pending record count + dec a ; last record? + ld c,2 ; allow cached writes by default + jr nz,rwdsk1 ; not last record, continue + ld c,1 ; last record, no caching please +rwdsk1: + ld a,(actfnc) + call cbiosfn + or a ; set flags on return code + jp nz,errio ; if not zero, error abort + ; adjust buffer pointer + ld hl,(bufptr) ; get buffer pointer + ld de,(reclen) ; get rec len + add hl,de ; adjust buffer ptr for next record + ld (bufptr),hl ; save it + ; next sector + ld hl,(actsec) ; current sector + inc hl ; increment sector + ld (actsec),hl ; save it + ; check for end of track + ld de,(actspt) ; get current sectors per track + or a ; clear CF + sbc hl,de ; current track == sectors per track? + jr nz,rwdsk2 ; no, skip track change + ; next track + ld hl,0 + ld (actsec),hl ; current sector := 0 + ld hl,acttrk ; point to track variable + inc (hl) ; increment track + ; check pending record count and loop or return +rwdsk2: ld hl,reccnt + dec (hl) ; decrement pending record count + ret z ; if zero, done, return with Z set + jr rwdsk0 ; otherwise, loop +; +jphl: jp (hl) ; indirect jump +; +; Verify system image header in buf by checking the expected signature. +; Compute and return image size (based on header values) in HL. +; NZ set if signature error. +; +chkhdr: + ; check signature + ld hl,(imgbuf+$580) ; get signature + ld de,$A55A ; signature value + or a ; clear CF + sbc hl,de ; compare + jp nz,errsig ; invalid signature + ; compute the image size (does not include size of header) + ld hl,(imgbuf+$5FC) ; get CPM_END + ld de,(imgbuf+$5FA) ; get CPM_LOC + or a ; clear CF + sbc hl,de ; image size := CPM_END - CPM_LOC + xor a ; signal success + ret ; done +; +; Convert a filename at (HL) into an FCB at (DE). +; Includes wildcard expansion. +; On return, A=0 if unambiguous name specified, and +; (HL) points to character following filename spec +; +convert: + push de ; put fcb address on stack + ex de,hl + ld a,(de) ; get first character. + or a + jp z,convrt1 + sbc a,'A'-1 ; might be a drive name, convert to binary. + ld b,a ; and save. + inc de ; check next character for a ':'. + ld a,(de) + cp ':' + jp z,convrt2 + dec de ; nope, move pointer back to the start of the line. +convrt1: + ld a,(defdrv) + ld (hl),a + jp convrt3 +convrt2: + ld a,b + ld (hl),b + inc de + ; Convert the base file name. +convrt3:ld b,08h +convrt4:ld a,(de) + call delim + jp z,convrt8 + inc hl + cp '*' ; note that an '*' will fill the remaining + jp nz,convrt5 ; field with '?' + ld (hl),'?' + jp convrt6 +convrt5:ld (hl),a + inc de +convrt6:dec b + jp nz,convrt4 +convrt7:ld a,(de) + call delim ; get next delimiter + jp z,getext + inc de + jp convrt7 +convrt8:inc hl ; blank fill the file name + ld (hl),' ' + dec b + jp nz,convrt8 +getext: ld b,03h + cp '.' + jp nz,getext5 + inc de +getext1:ld a,(de) + call delim + jp z,getext5 + inc hl + cp '*' + jp nz,getext2 + ld (hl),'?' + jp getext3 +getext2:ld (hl),a + inc de +getext3:dec b + jp nz,getext1 +getext4:ld a,(de) + call delim + jp z,getext6 + inc de + jp getext4 +getext5:inc hl + ld (hl),' ' + dec b + jp nz,getext5 +getext6:ld b,3 +getext7:inc hl + ld (hl),0 + dec b + jp nz,getext7 + pop hl ; HL := start of FCB + push de ; save input line pointer + ; Check to see if this is an ambiguous file name specification. + ; Set the A register to non-zero if it is. + ld bc,11 ; set name length. +getext8:inc hl + ld a,(hl) + cp '?' ; any question marks? + jp nz,getext9 + inc b ; count them. +getext9:dec c + jp nz,getext8 + ld a,b + or a + pop hl ; return with updated input pointer + ret +; +; Print formatted FCB at (HL) +; +prtfcb: + push hl ; save HL + call chkfcb ; set flags indicating nature of FCB + pop hl ; restore HL + ret z ; nothing to print + push af ; save FCB flags + ld a,(hl) ; get first byte of FCB (drive) + inc hl ; point to next char + or a ; is drive specified (non-zero)? + jr z,prtfcb1 ; if zero, do not print drive letter + add a,'@' ; adjust drive number to alpha + call prtchr ; print it + ld a,':' + call prtchr ; print drive separator +prtfcb1: + pop af ; restore FCB flags + bit 1,a ; bit 1 set if filename specified + ret z ; return if no filename + ld b,8 ; base is 8 characters + call prtfcb2 ; print them + ld a,'.' + call prtchr ; print file extension separator + ld b,3 ; extension is 3 characters +prtfcb2: + ld a,(hl) ; load the next character + inc hl ; point to next character + cp ' ' ; check for blank + call nz,prtchr ; print char if it is not a blank + djnz prtfcb2 ; loop till done + ret ; return +; +; Check FCB to see if a drive and/or filename is specified. +; Set bit 0 for drive and bit 1 for filename in A +; +chkfcb: + ld c,0 ; use C for flags, start with none + ld a,(hl) ; get drive + or a ; anything there? + jr z,chkfcb1 ; skip if nothing there + set 0,c ; set bit zero to indicate a drive spec +chkfcb1: + ld b,11 ; set up to check 11 bytes (base & ext) +chkfcb2: + inc hl ; bump to next byte + ld a,(hl) ; get next + cp 'A' ; blank means empty byte + jr nc,chkfcb3 ; if not blank, we have a filename + djnz chkfcb2 ; loop + jr chkfcb4 ; nothing there +chkfcb3: + set 1,c ; set bit 1 to indicate a file spec +chkfcb4: + ld a,c ; put result in a + or a ; set flags + ret +; +; Print dot +; +prtdot: + push af + ld a,'.' + call prtchr + pop af + ret +; +; Print character in A without destroying any registers +; +prtchr: + push bc ; save registers + push de + push hl + ld e,a ; character to print in E + ld c,$02 ; BDOS function to output a character + call bdos ; do it + pop hl ; restore registers + pop de + pop bc + ret +; +; Print $ terminated string at (DE) without destroying any registers +; +prtstr: + push bc ; save registers + push de + push hl + ld c,$09 ; BDOS function to output a '$' terminated string + call bdos ; do it + pop hl ; restore registers + pop de + pop bc + ret +; +; Print the value in A in hex without destroying any registers +; +prthex: + push af ; save AF + push de ; save DE + call hexascii ; convert value in A to hex chars in DE + ld a,d ; get the high order hex char + call prtchr ; print it + ld a,e ; get the low order hex char + call prtchr ; print it + pop de ; restore DE + pop af ; restore AF + ret ; done +; +; Convert binary value in A to ascii hex characters in DE +; +hexascii: + ld d,a ; save A in D + call hexconv ; convert low nibble of A to hex + ld e,a ; save it in E + ld a,d ; get original value back + rlca ; rotate high order nibble to low bits + rlca + rlca + rlca + call hexconv ; convert nibble + ld d,a ; save it in D + ret ; done +; +; Convert low nibble of A to ascii hex +; +hexconv: + and $0F ; low nibble only + add a,$90 + daa + adc a,$40 + daa + ret +; +; Start a new line +; +crlf: + ld a,13 ; + call prtchr ; print it + ld a,10 ; + jr prtchr ; print it +; +; Get the next non-blank character from (HL). +; +nonblank: + ld a,(hl) ; load next character + or a ; string ends with a null + ret z ; if null, return pointing to null + cp ' ' ; check for blank + ret nz ; return if not blank + inc hl ; if blank, increment character pointer + jr nonblank ; and loop +; +; Check character at (DE) for delimiter. +; +delim: or a + ret z + cp ' ' ; blank + ret z + jr c,delim1 ; handle control characters + cp '=' ; equal + ret z + cp '_' ; underscore + ret z + cp '.' ; period + ret z + cp ':' ; colon + ret z + cp $3b ; semicolon + ret z + cp '<' ; less than + ret z + cp '>' ; greater than + ret +delim1: + ; treat control chars as delimiters + xor a ; set Z + ret ; return +; +; Invoke CBIOS function +; The CBIOS function offset must be stored in the byte +; following the call instruction. ex: +; call cbios +; .db $0C ; offset of CONOUT CBIOS function +; +cbios: + ex (sp),hl + ld a,(hl) ; get the function number + inc hl ; point past value following call instruction + ex (sp),hl ; put address back at top of stack and recover HL + +cbiosfn: + ; enter here if function already in reg A + ld (bpb_fn),a ; save function +; + ld a,(v3os) ; CP/M 3 or greater? + or a ; set flags + jr nz,cbios2 ; if >= V3, handle it +; + ; CBIOS call for CP/M < v3 + ld a,(bpb_fn) ; get pending function number + ld l,a ; function number to L + add a,l ; ... and multiply by 3 for + add a,l ; ... jump table offset + ld hl,(cbftbl) ; address of CBIOS function table to HL + call addhl ; determine specific function address + jp (hl) ; invoke CBIOS +; +cbios2: + ; CBIOS call for CP/M v3 or greater + ld (bpb_bc),bc + ld (bpb_de),de + ld (bpb_hl),hl + + ld c,50 ; direct bios call function number + ld de,bpb ; BIOS parameter block + jp bdos ; return via BDOS call +; +; Add the value in A to HL (HL := HL + A) +; +addhl: + add a,l ; A := A + L + ld l,a ; Put result back in L + ret nc ; if no carry, we are done + inc h ; if carry, increment H + ret ; and return +; +; Errors +; +erruse: ; command usage error (syntax) + ld de,msguse + jr err +erramb: ; ambiguous file spec (wild cards) is not allowed + ld de,msgamb + jr err +errdlm: ; invalid delimiter in command tail + ld de,msgdlm + jr err +errfil: ; source file not found + ld de,msgfil + jr err +errclo: ; file close error + ld de,msgclo + jr err +errdel: ; file delete error + ld de,msgdel + jr err +errsig: ; invalid system image signature error + ld de,msgsig + jr err +errsel: ; CBIOS drive select error + ld de,msgsel + jr err +errsys: ; no system tracks on drive error + ld de,msgsys + jr err +errio: ; I/O error + ld de,msgio + jr err +err: ; print error string and return error signal + call crlf ; print newline + call prtstr ; print error string + or $FF ; signal error + ret ; done +errdos: ; handle BDOS errors + push af ; save return code + call crlf ; newline + ld de,msgdos ; load + call prtstr ; and print error string + pop af ; recover return code + call prthex ; print error code + or $FF ; signal error + ret ; done +; +;=============================================================================== +; Storage Section +;=============================================================================== +; +defdrv .db 0 ; default drive for FCB +cbftbl .dw 0 ; address of CBIOS function table +imgsiz .db 0 ; image size (count of 128 byte records) +; +destfcb .fill 36,0 ; destination FCB +srcfcb .fill 36,0 ; source FCB +; +stksav .dw 0 ; stack pointer saved at start + .fill stksiz,0 ; stack +stack .equ $ ; stack top +; +rwfun .db 0 ; active read/write function +rwfcb .dw 0 ; active read/write FCB +reccnt .db 0 ; active remaining records to read/write +bufptr .dw 0 ; active pointer into buffer +; +actdsk .db 0 ; active disk no +acttrk .dw 0 ; active track +actsec .dw 0 ; active sector +actspt .dw 0 ; active sectors per track +actfnc .db 0 ; active cbios i/o function (read or write) +v3os .db 0 ; true ($FF) if OS v3.0 or greater +reclen .dw 0 ; active record length +; +bpb: ; BIOS parameter block for CP/M 3 BIOS calls +bpb_fn .db 0 ; function +bpb_a .db 0 ; reg A +bpb_bc .dw 0 ; reg BC +bpb_de .dw 0 ; reg DE +bpb_hl .dw 0 ; reg HL +; +; Messages +; +msgban1 .db "SYSCOPY v2.1 for RomWBW CP/M, 15-May-2020$" +msgv2 .db " (CP/M 2 Mode)$" +msgv3 .db " (CP/M 3 Mode)$" +msgban2 .db "Copyright 2020, Wayne Warthen, GNU GPL v3$" + +msguse .db "Usage: SYSCOPY [=]$" +msgamb .db "Ambiguous file specification not allowed$" +msgdlm .db "Invalid delimiter$" +msgfil .db "File not found$" +msgclo .db "File close error$" +msgdel .db "Error deleting target file$" +msgsig .db "Invalid system image (bad signature)$" +msgdos .db "DOS error, return code=0x$" +msgsel .db "Disk select error$" +msgsys .db "Non-system disk error$" +msgio .db "Disk I/O error$" +msgrd .db "Reading image... $" +msgwrt .db "Writing image... $" +msgdon .db "Done$" +sconf1 .db "Transfer system image from $" +sconf2 .db " to $" +sconf3 .db " (Y/N)? $" +; + .end diff --git a/Source/Apps/sysgen.z80 b/Source/Apps/sysgen.z80 new file mode 100644 index 00000000..ec2d62d1 --- /dev/null +++ b/Source/Apps/sysgen.z80 @@ -0,0 +1,507 @@ + TITLE 'SYSGEN - SYSTEM GENERATION PROGRAM 8/79' +; SYSTEM GENERATION PROGRAM, VERSION FOR ROMWBW +VERS EQU 20 ; X.X +; +; COPYRIGHT (C) DIGITAL RESEARCH +; 1976, 1977, 1978, 1979 +; +NDISKS EQU 16 ; NUMBER OF DISK DRIVES +SECSIZ EQU 128 ; SIZE OF EACH SECTOR +LOG2SEC EQU 7 ; LOG 2 SECSIZ +; +FCB EQU 05CH ; DEFAULT FCB LOCATION +FCBCR EQU FCB+32 ; CURRENT RECORD LOCATION +TPA EQU 0100H ; TRANSIENT PROGRAM AREA +LOADP EQU 900H ; LOAD POINT FOR SYSTEM DURING LOAD/STORE +BDOS EQU 5 ; DOS ENTRY POINT +BOOT EQU 0 ; JMP TO 'BOOT' TO REBOOT SYSTEM +CONI EQU 1 ; CONSOLE INPUT FUNCTION +CONO EQU 2 ; CONSOLE OUTPUT FUNCTION +OPENF EQU 15 ; DISK OPEN FUNCTION +DREADF EQU 20 ; DISK READ FUNCTION +; +CR EQU 0DH ; CARRIAGE RETURN +LF EQU 0AH ; LINE FEED +STKSIZE EQU 32 ; SIZE OF LOCAL STACK +; +WBOOT EQU 1 ; ADDRESS OF WARM BOOT (OTHER PATCH ENTRY +; + ORG TPA ; TRANSIENT PROGRAM AREA + JP START + DB 'COPYRIGHT (C) 1978, DIGITAL RESEARCH ' +; +; UTILITY SUBROUTINES +; +GETCHAR: + ; READ CONSOLE CHARACTER TO REGISTER A + LD C,CONI + CALL BDOS + ; CONVERT TO UPPER CASE BEFORE RETURN + CP 'A' OR 20H + RET C ; RETURN IF BELOW LOWER CASE A + CP ('Z' OR 20H) + 1 + RET NC ; RETURN IF ABOVE LOWER CASE Z + AND 5FH + RET +; +PUTCHAR: + ; WRITE CHARACTER FROM A TO CONSOLE + LD E,A + LD C,CONO + CALL BDOS + RET +; +CRLF: ; SEND CARRIAGE RETURN, LINE FEED + LD A,CR + CALL PUTCHAR + LD A,LF + CALL PUTCHAR + RET +; +CRMSG: ; PRINT MESSAGE ADDRESSED BY H,L TIL ZERO + ; WITH LEADING CRLF + PUSH HL + CALL CRLF + POP HL ; DROP THRU TO OUTMSG0 +OUTMSG: + LD A,(HL) + OR A + RET Z + ; MESSAGE NOT YET COMPLETED + PUSH HL + CALL PUTCHAR + POP HL + INC HL + JP OUTMSG +; +DREAD: ; DISK READ FUNCTION VIA BDOS + LD C,DREADF + JP BDOS +; +OPEN: ; FILE OPEN FUNCTION VIA BDOS + LD C,OPENF + JP BDOS +; +; READ IMAGE DIRECTLY FROM DISK SYSTEM TRACKS USING CBIOS +; DISK NUMBER MUST BE IN (ACTDSK) +; +RDDSK: + ; FORCE RETURN TO GO THROUGH DISK RESET + LD HL,RESDSK ; LOAD ADDRESS OF RESET DISK ROUTINE + PUSH HL ; AND PUT IT ON THE STACK + ; SET DRIVE FOR SUBSEQUENT READS + CALL SETDSK ; SETUP DISK SPECIFIED IN A + RET NZ ; ABORT ON ERROR + ; SET FUNCTION TO READ + LD HL,(CBFTBL) ; GET ADDRESS OF CBIOS FUNCTION TABLE + LD A,027H ; $27 IS CBIOS READ ENTRY OFFSET + CALL ADDHL ; SET HL TO RESULTANT ENTRY POINT + LD (ACTFNC),HL ; SAVE IT + ; READ THE HEADER + LD A,12 ; START WITH 1536 BYTE HEADER (12 RECORDS) + LD (RECCNT),A ; INITIALIZE RECORD COUNTER + CALL RWDSK ; READ THE HEADER + RET NZ ; ABORT ON ERROR + ; CHECK HEADER AND GET IMAGE SIZE + CALL CHKHDR ; CHECK INTEGRITY, HL = IMAGE SIZE ON RETURN + RET NZ ; ABORT ON ERROR + ; CONVERT IMAGE SIZE TO COUNT OF 128-BYTE RECORDS + LD B,7 ; RIGHT SHIFT 7 BITS TO GET 128 BYTE RECORD COUNT +RDDSK1: SRL H ; SHIFT RIGHT MSB + RR L ; SHIFT LSB W/ CARRY FROM MSB + DJNZ RDDSK1 ; LOOP TILL DONE + ; SET THE NUMBER OF RECORDS PENDING TO READ + LD A,L ; RECORD COUNT TO A + LD (RECCNT),A ; SET REMAINING RECORDS TO READ + ; SAVE THE TOTAL IMAGE SIZE (INCLUDING HEADER) FOR LATER + ADD A,12 ; ADD THE HEADER RECORDS BACK + LD (IMGSIZ),A ; AND SAVE THE TOTAL IMAGE SIZE (IN RECORDS) + ; READ THE REMAINING SYSTEM IMAGE RECORDS + CALL RWDSK ; FINISH UP + RET NZ ; ABORT ON ERROR + ; PERFORM BDOS DISK RESET (CRITICAL SINCE WE MUCKED WITH CBIOS) + LD C,0DH ; BDOS RESET DISK + CALL BDOS ; DO IT + ; RETURN + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; WRITE IMAGE DIRECTLY TO DISK SYSTEM TRACKS USING CBIOS +; DISK NUMBER MUST BE IN (ACTDSK) +; +WRDSK: + ; FORCE RETURN TO GO THROUGH DISK RESET + LD HL,RESDSK ; LOAD ADDRESS OF RESET DISK ROUTINE + PUSH HL ; AND PUT IT ON THE STACK + ; SET DRIVE FOR SUBSEQUENT WRITES + CALL SETDSK ; SETUP DISK SPECIFIED IN A + RET NZ ; ABORT ON ERROR + ; SET FUNCTION TO WRITE + LD HL,(CBFTBL) ; GET ADDRESS OF CBIOS FUNCTION TABLE + LD A,02AH ; $2A IS CBIOS WRITE ENTRY OFFSET + CALL ADDHL ; SET HL TO RESULTANT ENTRY POINT + LD (ACTFNC),HL ; SAVE IT + ; SETUP THE RECORD COUNT TO WRITE + LD A,(IMGSIZ) ; GET PREVIOUSLY RECORDED IMAGE SIZE + LD (RECCNT),A ; SAVE IT AS PENDING RECORD COUNT + ; WRITE THE IMAGE + CALL RWDSK ; WRITE THE IMAGE + RET NZ ; ABORT ON ERROR + ; RETURN + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; PERFORM BDOS DISK RESET +; REQUIRED AFTER MAKING DIRECT CBIOS DISK CALLS +; +RESDSK: + ; PERFORM BDOS DISK RESET + PUSH AF ; PRESERVE STATUS + LD C,0DH ; BDOS RESET DISK + CALL BDOS ; DO IT + POP AF ; RESTORE STATUS + RET +; +; SETUP FOR CBIOS DISK ACCESS +; +SETDSK: + ; SELECT DISK + LD A,(ACTDSK) ; GET ACTIVE DISK + LD C,A ; MOVE TO C + LD E,0 ; TREAT AS FIRST SELECT + CALL CBIOS ; INVOKE CBIOS WITH... + DB 01BH ; SELDSK ENTRY OFFSET + ; CHECK RETURN (SETS HL TO DPH ADDRESS) + LD A,H + OR L + JP Z,ERRSEL ; HL == 0 IS SELECT ERROR + ; SET HL TO DPB ADDRESS + LD DE,10 ; DPB ADDRESS IS 10 BYTES INTO DPH + ADD HL,DE ; HL := ADDRESS OF DPB POINTER + LD A,(HL) ; DEREFERENCE... + INC HL + LD H,(HL) + LD L,A ; HL := ADDRESS OF DPB + ; EXTRACT SECTORS PER TRACK FROM FIRST WORD OF DPB + LD C,(HL) + INC HL + LD B,(HL) ; BC := SECTORS PER TRACK + LD (ACTSPT),BC ; SAVE IT + ; ENSURE THERE ARE SYSTEM TRACKS (VERIFY THAT OFFSET FIELD IN DPB IS NOT ZERO) + LD DE,12 ; OFFSET FIELD IS 12 BYTES INTO DPB + ADD HL,DE ; POINT TO OFFSET FIELD IN DPB + LD A,(HL) ; LOAD FIRST BYTE IN A + INC HL ; POINT TO SECOND BYTE + OR (HL) ; OR WITH FIRST BYTE + JP Z,ERRSYS ; IF ZERO, ABORT (NO SYSTEM TRACKS) + ; INITIALIZE FOR I/O + LD HL,0 + LD (ACTTRK),HL ; ACTIVE TRACK := 0 + LD (ACTSEC),HL ; ACTIVE SECTOR := 0 + LD HL,LOADP + LD (BUFPTR),HL ; RESET BUFFER POINTER +; + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; READ OR WRITE (RECCNT) SECTORS TO/FROM DISK VIA CBIOS +; +RWDSK: + ; SETUP TO READ/WRITE A SECTOR + LD BC,(ACTTRK) ; GET ACTIVE TRACK + CALL CBIOS ; INVOKE CBIOS WITH... + DB 01EH ; SETTRK ENTRY OFFSET + LD BC,(ACTSEC) ; GET ACTIVE SECTOR + CALL CBIOS ; INVOKE CBIOS WITH... + DB 021H ; SETSEC ENTRY OFFSET + LD BC,(BUFPTR) ; GET ACTIVE BUFFER POINTER + CALL CBIOS ; INVOKE CBIOS WITH... + DB 024H ; SETDMA ENTRY OFFSET + ; READ/WRITE SECTOR + LD A,(RECCNT) ; GET THE PENDING RECORD COUNT + DEC A ; LAST RECORD? + LD C,2 ; ALLOW CACHED WRITES BY DEFAULT + JR NZ,RWDSK1 ; NOT LAST RECORD, CONTINUE + LD C,1 ; LAST RECORD, NO CACHING PLEASE +RWDSK1: LD HL,(ACTFNC) ; LOAD THE CBIOS FUNCTION VECTOR + CALL JPHL ; INDIRECT CALL (READ OR WRITE) + OR A ; SET FLAGS ON RETURN CODE + JP NZ,ERRIO ; IF NOT ZERO, ERROR ABORT + ; ADJUST BUFFER POINTER + LD HL,(BUFPTR) ; GET BUFFER POINTER + LD DE,128 ; RECORD LENGTH IS 128 BYTES + ADD HL,DE ; ADJUST BUFFER PTR FOR NEXT RECORD + LD (BUFPTR),HL ; SAVE IT + ; NEXT SECTOR + LD HL,(ACTSEC) ; CURRENT SECTOR + INC HL ; INCREMENT SECTOR + LD (ACTSEC),HL ; SAVE IT + ; CHECK FOR END OF TRACK + LD DE,(ACTSPT) ; GET CURRENT SECTORS PER TRACK + OR A ; CLEAR CF + SBC HL,DE ; CURRENT TRACK == SECTORS PER TRACK? + JR NZ,RWDSK2 ; NO, SKIP TRACK CHANGE + ; NEXT TRACK + LD HL,0 + LD (ACTSEC),HL ; CURRENT SECTOR := 0 + LD HL,ACTTRK ; POINT TO TRACK VARIABLE + INC (HL) ; INCREMENT TRACK + ; CHECK PENDING RECORD COUNT AND LOOP OR RETURN +RWDSK2: LD HL,RECCNT + DEC (HL) ; DECREMENT PENDING RECORD COUNT + RET Z ; IF ZERO, DONE, RETURN WITH Z SET + JR RWDSK ; OTHERWISE, LOOP +; +JPHL: JP (HL) ; INDIRECT JUMP +; +; VERIFY SYSTEM IMAGE HEADER IN BUF BY CHECKING THE EXPECTED SIGNATURE. +; COMPUTE AND RETURN IMAGE SIZE (BASED ON HEADER VALUES) IN HL. +; NZ SET IF SIGNATURE ERROR. +; +CHKHDR: + ; CHECK SIGNATURE + LD HL,(LOADP+580H) ; GET SIGNATURE + LD DE,0A55AH ; SIGNATURE VALUE + OR A ; CLEAR CF + SBC HL,DE ; COMPARE + JP NZ,ERRSIG ; INVALID SIGNATURE + ; COMPUTE THE IMAGE SIZE (DOES NOT INCLUDE SIZE OF HEADER) + LD HL,(LOADP+5FCH) ; GET CPM_END + LD DE,(LOADP+5FAH) ; GET CPM_LOC + OR A ; CLEAR CF + SBC HL,DE ; IMAGE SIZE := CPM_END - CPM_LOC + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; INVOKE CBIOS FUNCTION +; THE CBIOS FUNCTION OFFSET MUST BE STORED IN THE BYTE +; FOLLOWING THE CALL INSTRUCTION. EX: +; CALL CBIOS +; DB 0CH ; OFFSET OF CONOUT CBIOS FUNCTION +; +CBIOS: + EX (SP),HL + LD A,(HL) ; GET THE FUNCTION OFFSET + INC HL ; POINT PAST VALUE FOLLOWING CALL INSTRUCTION + EX (SP),HL ; PUT ADDRESS BACK AT TOP OF STACK AND RECOVER HL + LD HL,(CBFTBL) ; ADDRESS OF CBIOS FUNCTION TABLE TO HL + CALL ADDHL ; DETERMINE SPECIFIC FUNCTION ADDRESS + JP (HL) ; INVOKE CBIOS +; +; ADD THE VALUE IN A TO HL (HL := HL + A) +; +ADDHL: + ADD A,L ; A := A + L + LD L,A ; PUT RESULT BACK IN L + RET NC ; IF NO CARRY, WE ARE DONE + INC H ; IF CARRY, INCREMENT H + RET ; AND RETURN +; +; START OF PROGRAM +; +START: + LD SP,STACK ; SET LOCAL STACK POINTER + LD HL,SIGNON + CALL CRMSG + ; LOCATE CBIOS FUNCTION TABLE ADDRESS + LD HL,(BOOT+1) ; LOAD ADDRESS OF CP/M RESTART VECTOR + LD DE,-3 ; ADJUSTMENT FOR START OF TABLE + ADD HL,DE ; HL NOW HAS START OF TABLE + LD (CBFTBL),HL ; SAVE IT + ; CHECK FOR DEFAULT FILE LOAD INSTEAD OF GET + LD A,(FCB+1); BLANK IF NO FILE + CP ' ' + JP Z,GETSYS ; SKIP TO GET SYSTEM MESSAGE IF BLANK + LD DE,FCB ; TRY TO OPEN IT + CALL OPEN ; + INC A ; 255 BECOMES 00 + JP NZ,RDOK ; OK TO READ IF NOT 255 + ; FILE NOT PRESENT, ERROR AND REBOOT + LD HL,NOFILE + CALL CRMSG + JP REBOOT +; +; FILE PRESENT - READ TO LOAD POINT +; +RDOK: + XOR A + LD (FCBCR),A; CURRENT RECORD = 0 + ; PRE-READ AREA FROM TPA TO LOADP + LD C,(LOADP-TPA)/SECSIZ +PRERD: ; PRE-READ FILE + PUSH BC ; SAVE COUNT + LD DE,FCB ; INPUT FILE CONTROL COUNT + CALL DREAD ; ASSUME SET TO DEFAULT BUFFER + POP BC ; RESTORE COUNT + OR A + JP NZ,BADRD ; CANNOT ENCOUNTER END-OF FILE + DEC C ; COUNT DOWN + JP NZ,PRERD ; FOR ANOTHER SECTOR +; +; SECTORS SKIPPED AT BEGINNING OF FILE +; + LD HL,LOADP +RDINP: + PUSH HL + LD B,H + LD C,L ; READY FOR DMA + CALL CBIOS ; INVOKE CBIOS WITH... + DB 024H ; SETDMA ENTRY OFFSET + LD DE,FCB ; READY FOR READ + CALL DREAD ; + POP HL ; RECALL DMA ADDRESS + OR A ; 00 IF READ OK + JP NZ,PUTSYS ; ASSUME EOF IF NOT. + ; MORE TO READ, CONTINUE + LD DE,SECSIZ + ADD HL,DE ; HL IS NEW LOAD ADDRESS + JP RDINP +; +BADRD: ; EOF ENCOUNTERED IN INPUT FILE + LD HL,BADFILE + CALL CRMSG + JP REBOOT +; +GETSYS: + CALL CRLF + LD HL,ASKGET ; GET SYSTEM? + CALL CRMSG + CALL GETCHAR + CP CR + JP Z,PUTSYS ; SKIP IF CR ONLY + ; + SUB 'A' ; NORMALIZE DRIVE NUMBER + CP NDISKS ; VALID DRIVE? + JP C,GETC ; SKIP TO GETC IF SO + ; INVALID DRIVE NUMBER + CALL BADDISK + JP GETSYS ; TO TRY AGAIN +; +GETC: + ; SELECT DISK GIVEN BY REGISTER A + ADD A,'A' + LD (GDISK),A; TO SET MESSAGE + SUB 'A' + LD (ACTDSK),A ; SAVE ACTIVE DISK NO + +; ; GETSYS, SET RW TO READ AND GET THE SYSTEM + CALL CRLF + LD HL,GETMSG + CALL OUTMSG + CALL GETCHAR + CP CR + JP NZ,REBOOT + CALL CRLF + CALL RDDSK + JP NZ,GETSYS + LD HL,DONE + CALL OUTMSG +; +; PUT SYSTEM +; +PUTSYS: + CALL CRLF + LD HL,ASKPUT + CALL CRMSG + CALL GETCHAR + CP CR + JP Z,REBOOT + SUB 'A' + CP NDISKS + JP C,PUTC + ; INVALID DRIVE NAME + CALL BADDISK + JP PUTSYS ; TO TRY AGAIN +; +PUTC: ; SET DISK FROM REGISTER C + ADD A,'A' + LD (PDISK),A ; MESSAGE SET + SUB 'A' + LD (ACTDSK),A ; SAVE ACTIVE DISK NO + + ; PUT SYSTEM + LD HL,PUTMSG + CALL CRMSG + CALL GETCHAR + CP CR + JP NZ,REBOOT + CALL CRLF + CALL WRDSK + JP NZ,PUTSYS + LD HL,DONE + CALL OUTMSG + JP PUTSYS ; FOR ANOTHER PUT OPERATION +; +REBOOT: + CALL CRLF + JP BOOT +; +ERRSEL: + LD HL,SELMSG + JP ERR +; +ERRSYS: + LD HL,SYSMSG + JP ERR +; +ERRIO: + LD HL,IOMSG + JP ERR +; +ERRSIG: + LD HL,SIGMSG + JP ERR +; +ERR: + CALL OUTMSG + OR A,0FFH + RET +; +BADDISK:;BAD DISK NAME + LD HL,QDISK + CALL CRMSG + RET +; +; DATA AREAS +; MESSAGES +; +SIGNON: DB 'ROMWBW SYSGEN VER ' + DB VERS/10+'0','.',VERS MOD 10+'0' + DB 0 +ASKGET: DB 'SOURCE DRIVE NAME (OR RETURN TO SKIP): ',0 +GETMSG: DB 'SOURCE ON ' +GDISK: DS 1 ; FILLED IN AT GET FUNCTION + DB ':, THEN TYPE RETURN',0 +ASKPUT: DB 'DESTINATION DRIVE NAME (OR RETURN TO REBOOT): ',0 +PUTMSG: DB 'DESTINATION ON ' +PDISK: DS 1 ; FILLED IN AT PUT FUNCTION + DB ':, THEN TYPE RETURN',0 +ERRMSG: DB 'PERMANENT ERROR, TYPE RETURN TO IGNORE',0 +DONE: DB 'FUNCTION COMPLETE',0 +QDISK: DB 'INVALID DRIVE NAME (USE A-P)',0 +NOFILE: DB 'NO SOURCE FILE ON DISK',0 +BADFILE: + DB 'SOURCE FILE INCOMPLETE',0 +SELMSG: DB 'DISK SELECTION ERROR',0 +SYSMSG: DB 'NON-SYSTEM DISK ERROR',0 +IOMSG: DB 'FATAL DISK I/O ERROR',0 +SIGMSG: DB 'INVALID SYSTEM IMAGE (BAD SIGNATURE)',0 +; +; VARIABLES +; +CBFTBL DW 0 ; ADDRESS OF CBIOS FUNCTION TABLE +IMGSIZ DB 0 ; IMAGE SIZE (COUNT OF 128 BYTE RECORDS) +; +RWFUN DB 0 ; ACTIVE READ/WRITE FUNCTION +RECCNT DB 0 ; ACTIVE REMAINING RECORDS TO READ/WRITE +BUFPTR DW 0 ; ACTIVE POINTER INTO BUFFER +; +ACTDSK DB 0 ; ACTIVE DISK NO +ACTTRK DW 0 ; ACTIVE TRACK +ACTSEC DW 0 ; ACTIVE SECTOR +ACTSPT DW 0 ; ACTIVE SECTORS PER TRACK +ACTFNC DW 0 ; ACTIVE FUNCTION (READ OR WRITE) + DS STKSIZE*2 +STACK: +; + END diff --git a/Source/Apps/Talk.asm b/Source/Apps/talk.asm similarity index 100% rename from Source/Apps/Talk.asm rename to Source/Apps/talk.asm diff --git a/Source/Apps/timer.asm b/Source/Apps/timer.asm new file mode 100644 index 00000000..b220db1a --- /dev/null +++ b/Source/Apps/timer.asm @@ -0,0 +1,506 @@ +;=============================================================================== +; TIMER - Display system timer value +; +;=============================================================================== +; +; Author: Wayne Warthen (wwarthen@gmail.com) +;_______________________________________________________________________________ +; +; Usage: +; TIMER [/C] [/?] +; ex: TIMER (display current timer value) +; TIMER /? (display version and usage) +; TIMER /C (display timer value continuously) +; +; Operation: +; Reads and displays system timer value. +;_______________________________________________________________________________ +; +; Change Log: +; 2018-01-14 [WBW] Initial release +; 2018-01-17 [WBW] Add HBIOS check +; 2019-11-08 [WBW] Add seconds support +;_______________________________________________________________________________ +; +; ToDo: +;_______________________________________________________________________________ +; +#include "../ver.inc" +; +;=============================================================================== +; Definitions +;=============================================================================== +; +stksiz .equ $40 ; Working stack size +; +restart .equ $0000 ; CP/M restart vector +bdos .equ $0005 ; BDOS invocation vector +; +ident .equ $FFFE ; loc of RomWBW HBIOS ident ptr +; +bf_sysver .equ $F1 ; BIOS: VER function +bf_sysget .equ $F8 ; HBIOS: SYSGET function +bf_sysset .equ $F9 ; HBIOS: SYSGET function +bf_sysgettimer .equ $D0 ; TIMER subfunction +bf_syssettimer .equ $D0 ; TIMER subfunction +bf_sysgetsecs .equ $D1 ; SECONDS subfunction +bf_syssetsecs .equ $D1 ; SECONDS subfunction +; +;=============================================================================== +; Code Section +;=============================================================================== +; + .org $100 +; + ; setup stack (save old value) + ld (stksav),sp ; save stack + ld sp,stack ; set new stack +; + ; initialization + call init ; initialize + jr nz,exit ; abort if init fails +; + ; process + call process ; do main processing + jr nz,exit ; abort on error +; +exit: ; clean up and return to command processor + call crlf ; formatting + ld sp,(stksav) ; restore stack + ;jp restart ; return to CP/M via restart + ret ; return to CP/M w/o restart +; +; Initialization +; +init: + call crlf ; formatting + ld de,msgban ; point to version message part 1 + call prtstr ; print it +; + call idbio ; identify active BIOS + cp 1 ; check for HBIOS + jp nz,errbio ; handle BIOS error +; + ld a,rmj << 4 | rmn ; expected HBIOS ver + cp d ; compare with result above + jp nz,errbio ; handle BIOS error +; +initx + ; initialization complete + xor a ; signal success + ret ; return +; +; Process +; +process: + ; look for start of parms + ld hl,$81 ; point to start of parm area (past len byte) +; +process00: + call nonblank ; skip to next non-blank char + jp z,process0 ; no more parms, go to display +; + ; check for option, introduced by a "/" + cp '/' ; start of options? + jp nz,usage ; yes, handle option + call option ; do option processing + ret nz ; done if non-zero return + jr process00 ; continue looking for options +; +process0: +; + ; Test of API function to set seconds value + ;ld b,bf_sysset ; HBIOS SYSGET function + ;ld c,bf_syssetsecs ; SECONDS subfunction + ;ld de,0 ; set seconds value + ;ld hl,1000 ; ... to 1000 + ;rst 08 ; call HBIOS, DE:HL := seconds value +; + ; get and print seconds value + call crlf2 ; formatting +; +process1: + ld b,bf_sysget ; HBIOS SYSGET function + ld c,bf_sysgettimer ; TIMER subfunction + rst 08 ; call HBIOS, DE:HL := timer value + + ld a,(first) + or a + ld a,0 + ld (first),a + jr nz,process1a + + ; test for new value + ld a,(last) ; last LSB value to A + cp l ; compare to current LSB + jr z,process2 ; if equal, bypass display + +process1a: + ; save and print new value + ld a,l ; new LSB value to A + ld (last),a ; save as last value + call prtcr ; back to start of line + ;call nz,prthex32 ; display it + call prthex32 ; display it + ld de,strtick ; tag + call prtstr ; display it + + ; get and print seconds value + ld b,bf_sysget ; HBIOS SYSGET function + ld c,bf_sysgetsecs ; SECONDS subfunction + rst 08 ; call HBIOS, DE:HL := seconds value + call prthex32 ; display it + ld a,'.' ; fraction separator + call prtchr ; print it + ld a,c ; get fractional component + call prthex ; print it + ld de,strsec ; tag + call prtstr ; display it +; +process2: + ld a,(cont) ; continuous display? + or a ; test for true/false + jr z,process3 ; if false, get out +; + ld c,6 ; BDOS: direct console I/O + ld e,$FF ; input char + call bdos ; call BDOS, A := char + or a ; test for zero + jr z,process1 ; loop until char pressed +; +process3: + xor a ; signal success + ret +; +; Handle special options +; +option: +; + inc hl ; next char + ld a,(hl) ; get it + or a ; zero terminator? + ret z ; done if so + cp ' ' ; blank? + ret z ; done if so + cp '?' ; is it a '?'? + jp z,usage ; yes, display usage + cp 'C' ; is it a 'C', continuous? + jp z,setcont ; yes, set continuous display + jp errprm ; anything else is an error +; +usage: +; + jp erruse ; display usage and get out +; +setcont: +; + or $FF ; set A to true + ld (cont),a ; and set continuous flag + jr option ; check for more option letters +; +; Identify active BIOS. RomWBW HBIOS=1, UNA UBIOS=2, else 0 +; +idbio: +; + ; Check for UNA (UBIOS) + ld a,($FFFD) ; fixed location of UNA API vector + cp $C3 ; jp instruction? + jr nz,idbio1 ; if not, not UNA + ld hl,($FFFE) ; get jp address + ld a,(hl) ; get byte at target address + cp $FD ; first byte of UNA push ix instruction + jr nz,idbio1 ; if not, not UNA + inc hl ; point to next byte + ld a,(hl) ; get next byte + cp $E5 ; second byte of UNA push ix instruction + jr nz,idbio1 ; if not, not UNA, check others +; + ld bc,$04FA ; UNA: get BIOS date and version + rst 08 ; DE := ver, HL := date +; + ld a,2 ; UNA BIOS id = 2 + ret ; and done +; +idbio1: + ; Check for RomWBW (HBIOS) + ld hl,($FFFE) ; HL := HBIOS ident location + ld a,'W' ; First byte of ident + cp (hl) ; Compare + jr nz,idbio2 ; Not HBIOS + inc hl ; Next byte of ident + ld a,~'W' ; Second byte of ident + cp (hl) ; Compare + jr nz,idbio2 ; Not HBIOS +; + ld b,bf_sysver ; HBIOS: VER function + ld c,0 ; required reserved value + rst 08 ; DE := version, L := platform id +; + ld a,1 ; HBIOS BIOS id = 1 + ret ; and done +; +idbio2: + ; No idea what this is + xor a ; Setup return value of 0 + ret ; and done +; +; Print character in A without destroying any registers +; +prtchr: + push bc ; save registers + push de + push hl + ld e,a ; character to print in E + ld c,$02 ; BDOS function to output a character + call bdos ; do it + pop hl ; restore registers + pop de + pop bc + ret +; +prtdot: +; + ; shortcut to print a dot preserving all regs + push af ; save af + ld a,'.' ; load dot char + call prtchr ; print it + pop af ; restore af + ret ; done +; +prtcr: +; + ; shortcut to print a dot preserving all regs + push af ; save af + ld a,13 ; load CR value + call prtchr ; print it + pop af ; restore af + ret ; done +; +; Print a zero terminated string at (DE) without destroying any registers +; +prtstr: + push de +; +prtstr1: + ld a,(de) ; get next char + or a + jr z,prtstr2 + call prtchr + inc de + jr prtstr1 +; +prtstr2: + pop de ; restore registers + ret +; +; Print the value in A in hex without destroying any registers +; +prthex: + push af ; save AF + push de ; save DE + call hexascii ; convert value in A to hex chars in DE + ld a,d ; get the high order hex char + call prtchr ; print it + ld a,e ; get the low order hex char + call prtchr ; print it + pop de ; restore DE + pop af ; restore AF + ret ; done +; +; print the hex word value in bc +; +prthexword: + push af + ld a,b + call prthex + ld a,c + call prthex + pop af + ret +; +; print the hex dword value in de:hl +; +prthex32: + push bc + push de + pop bc + call prthexword + push hl + pop bc + call prthexword + pop bc + ret +; +; Convert binary value in A to ascii hex characters in DE +; +hexascii: + ld d,a ; save A in D + call hexconv ; convert low nibble of A to hex + ld e,a ; save it in E + ld a,d ; get original value back + rlca ; rotate high order nibble to low bits + rlca + rlca + rlca + call hexconv ; convert nibble + ld d,a ; save it in D + ret ; done +; +; Convert low nibble of A to ascii hex +; +hexconv: + and $0F ; low nibble only + add a,$90 + daa + adc a,$40 + daa + ret +; +; Print value of A or HL in decimal with leading zero suppression +; Use prtdecb for A or prtdecw for HL +; +prtdecb: + push hl + ld h,0 + ld l,a + call prtdecw ; print it + pop hl + ret +; +prtdecw: + push af + push bc + push de + push hl + call prtdec0 + pop hl + pop de + pop bc + pop af + ret +; +prtdec0: + ld e,'0' + ld bc,-10000 + call prtdec1 + ld bc,-1000 + call prtdec1 + ld bc,-100 + call prtdec1 + ld c,-10 + call prtdec1 + ld e,0 + ld c,-1 +prtdec1: + ld a,'0' - 1 +prtdec2: + inc a + add hl,bc + jr c,prtdec2 + sbc hl,bc + cp e + ret z + ld e,0 + call prtchr + ret +; +; Start a new line +; +crlf2: + call crlf ; two of them +crlf: + push af ; preserve AF + ld a,13 ; + call prtchr ; print it + ld a,10 ; + call prtchr ; print it + pop af ; restore AF + ret +; +; Get the next non-blank character from (HL). +; +nonblank: + ld a,(hl) ; load next character + or a ; string ends with a null + ret z ; if null, return pointing to null + cp ' ' ; check for blank + ret nz ; return if not blank + inc hl ; if blank, increment character pointer + jr nonblank ; and loop +; +; Convert character in A to uppercase +; +ucase: + cp 'a' ; if below 'a' + ret c ; ... do nothing and return + cp 'z' + 1 ; if above 'z' + ret nc ; ... do nothing and return + res 5,a ; clear bit 5 to make lower case -> upper case + ret ; and return +; +; Add the value in A to HL (HL := HL + A) +; +addhl: + add a,l ; A := A + L + ld l,a ; Put result back in L + ret nc ; if no carry, we are done + inc h ; if carry, increment H + ret ; and return +; +; Jump indirect to address in HL +; +jphl: + jp (hl) +; +; Errors +; +erruse: ; command usage error (syntax) + ld de,msguse + jr err +; +errprm: ; command parameter error (syntax) + ld de,msgprm + jr err +; +errbio: ; invalid BIOS or version + ld de,msgbio + jr err +; +err: ; print error string and return error signal + call crlf2 ; print newline +; +err1: ; without the leading crlf + call prtstr ; print error string +; +err2: ; without the string +; call crlf ; print newline + or $FF ; signal error + ret ; done +; +;=============================================================================== +; Storage Section +;=============================================================================== +; +last .db 0 ; last LSB of timer value +cont .db 0 ; non-zero indicates continuous display +first .db $FF ; first pass flag (true at start) +; +stksav .dw 0 ; stack pointer saved at start + .fill stksiz,0 ; stack +stack .equ $ ; stack top +; +; Messages +; +msgban .db "TIMER v1.1, 10-Nov-2019",13,10 + .db "Copyright (C) 2019, Wayne Warthen, GNU GPL v3",0 +msguse .db "Usage: TIMER [/C] [/?]",13,10 + .db " ex. TIMER (display current timer value)",13,10 + .db " TIMER /? (display version and usage)",13,10 + .db " TIMER /C (display timer value continuously)",0 +msgprm .db "Parameter error (TIMER /? for usage)",0 +msgbio .db "Incompatible BIOS or version, " + .db "HBIOS v", '0' + rmj, ".", '0' + rmn, " required",0 +strtick .db " Ticks, ",0 +strsec .db " Seconds",0 +; + .end diff --git a/Source/BPBIOS/@WBW Issues.txt b/Source/BPBIOS/@WBW Issues.txt index f7d12f4c..ae68d9a6 100644 --- a/Source/BPBIOS/@WBW Issues.txt +++ b/Source/BPBIOS/@WBW Issues.txt @@ -1,15 +1,22 @@ -Loader uses CBIOS Disk I/O prior to CBOOT/WBOOT being run. As a -result, DIOBUF is not properly initialized. At present, it is -initialized to $7C00 which will work unless the location of the -physical disk buffer in HBIOS ever changes! - -The clock drivers supplied with BPBIOS (LDDS, LDP2D, and LDNZT) -load into ZSYS user memory. If the user segment is not at the -same location as the original BPBIOS ($E900), then the clock -driver will just overlay other code. At present, the N config -is OK because it does not relocate the user segment, but the T -config fails because it uses a user segment at $E700. Note that -this does not affect ZSDOS2 variants because they do not require -a loadable clock driver. +In general, the BPBIOS for RomWBW is incomplete. This is +mostly just a proof of concept that it can work. As such, +it is not built or included in the default builds of +RomWBW. You *must* review and adjust the file romwbw.lib +before building BPBIOS. To include BPBIOS in the build +process, you need to uncomment the corresponding line +in the Build.cmd file in the Source directory. -BPBIOS needs to assign disk units dynamically via discovery of disk type +For now, BPBIOS does not understand the dynamic disk assignment +mechanism of RomWBW. This means that you need to explicitly +tell BPBIOS the console unit number and the disk unit number of +the first hard disk device. Floppy drives are basically not +supported. You should review and adjust the romwbw.lib file +as needed. The RomWBW ASSIGN command is not supported. BPBIOS +will boot from the first hard disk unit number you assign and +always from the first slice. + +BPBIOS does not yet understand the 1024 directory entry +hard disk format. You must use the 512 directory entry +format images. + +--WBW 1:25 PM 10/7/2021 \ No newline at end of file diff --git a/Source/BPBIOS/@WBW Z3ENV.txt b/Source/BPBIOS/@WBW Z3ENV.txt index 8c17e2ca..cf57667c 100644 --- a/Source/BPBIOS/@WBW Z3ENV.txt +++ b/Source/BPBIOS/@WBW Z3ENV.txt @@ -4,7 +4,7 @@ BPBIOS for RomWBW / HBIOS The build process included in this directory constructs multiple BPBIOS OS images that can be loaded dynamically on a running RomWBW CP/M-like system. Normally, you would boot CP/M and then load the desired variant. On a running system, you would enter -something like "LDSYS BP34T". This document describes the specifics of the build +something like "LDSYS BP34". This document describes the specifics of the build process and the image variations which are identified by naming convention. Each image is composed of three basic components: Command Processor (CCP), Disk @@ -36,112 +36,98 @@ ZCPR 4.X == ZSDOS 2.X BPBIOS must be assembled for the target configuration. BPBIOS includes a DEF-WW-???????.LIB file during assembly which sets various equates to contol the features and behavior of -BPBIOS. The most critical ones are: +BPBIOS. The relevant settings are: BANKED: If YES, BPBIOS implements memory banking features ZSDOS2: If YES, BPBIOS is built to utilize ZSDOS 2.X specifics features - INTPXY: If YES, BPBIOS implements HBIOS proxy code internally w/ stub at FFE0H-FFFFH The table below illustrates the target build configurations along with the .DAT and .LIB files which are utilized for the specific configuration. The "?" is replaced with a letter that represents one of the ZCPR memory segment configurations described later in this document. -BP33?.DAT DEF-WW-Z33?.LIB Non-Banked BPBIOS w/ ZCPR 3.3 & ZSDOS 1.1 -BP33?BNK.DAT DEF-WW-Z33?BNK.LIB Banked BPBIOS w/ ZCPR 3.3 & ZSDOS 1.1 -BP34?.DAT DEF-WW-Z34?.LIB Non-Banked BPBIOS w/ ZCPR 3.4 & ZSDOS 1.1 -BP34?BNK.DAT DEF-WW-Z34?BNK.LIB Banked BPBIOS w/ ZCPR 3.4 & ZSDOS 1.1 -BP41?BNK.DAT DEF-WW-Z41?BNK.LIB Banked BPBIOS w/ ZCPR 4.1 & ZSDOS 2.03 +BP33.DAT DEF-WW-Z33.LIB Non-Banked BPBIOS w/ ZCPR 3.3 & ZSDOS 1.1 +BP33BNK.DAT DEF-WW-Z33BNK.LIB Banked BPBIOS w/ ZCPR 3.3 & ZSDOS 1.1 +BP34.DAT DEF-WW-Z34.LIB Non-Banked BPBIOS w/ ZCPR 3.4 & ZSDOS 1.1 +BP34BNK.DAT DEF-WW-Z34BNK.LIB Banked BPBIOS w/ ZCPR 3.4 & ZSDOS 1.1 +BP41BNK.DAT DEF-WW-Z41BNK.LIB Banked BPBIOS w/ ZCPR 4.1 & ZSDOS 2.X The table below illustrates the BPBIOS equates used and the specific CCP/DOS/BIOS components that are used to generate each configuration. As above, the "?" is replaced with a letter that represents one of the ZCPR memory segment configurations described later in this document. - BP33? BP33?BNK BP34? BP34?BNK BP41?BNK + BP33 BP33BNK BP34 BP34BNK BP41BNK -------------- -------------- -------------- -------------- -------------- -------------- BANKED NO YES NO YES YES ZSDOS2 NO NO NO NO YES -------------- -------------- -------------- -------------- -------------- -------------- -CCP ZCPR33?.REL ZCPR33?.REL Z34.REL Z34.REL Z41.ZRL -DOS ZSDOS.ZRL ZSDOS.ZRL ZSDOS.ZRL ZSDOS.ZRL ZS203.ZRL -BIOS BP33.REL BP33BNK.REL BP34.REL BP34BNK.REL BP41.REL +CCP ZCPR33.REL ZCPR33.REL Z34.REL Z34.REL Z41.ZRL +DOS ZSDOS.ZRL ZSDOS.ZRL ZSDOS.ZRL ZSDOS.ZRL ZS227G.ZRL +BIOS BP33.REL BP33BNK.REL BP34.REL BP34BNK.REL BP41BNK.REL -------------- -------------- -------------- -------------- -------------- -------------- -In addition to the configuration options above, ZCPR also utilizes a -defined set of memory segments in upper memory. The location and size of these -segments have many ramifications and general ZCPR / BPBIOS documents -should be consulted to understand these. The build process used here -produces several different configurations which can be loaded at runtime. -The original distributed memory segment configuration occupies the top -of memory which, unfortunately, conflicts with the RomWBW HBIOS need to -occupy this space. - -Although RomWBW HBIOS is implemented in it's own dedicated memory bank, it -requires a small proxy at the top of memory which acts as a mechansim to -route calls to HBIOS. There are two ways to implement this upper memory -proxy. The full proxy occupies FE00H-FFFFH and implements all of the -HBIOS routing code. Alternatively, a mini proxy can be utilized to -minimize the dedicated proxy space in upper memory. The mini proxy -requires just 20H bytes at the top of memory (FFE0H-FFFFH), but requires -that the bulk of the proxy code be implemented internally in BPBIOS. - -Taking the above into account, the build process implements a couple of -memory segment configurations that are compatible with RomWBW HBIOS. -Essentially, these configurations rearrange the ZCPR memory segments -to free up the area required by the HBIOS full or mini proxy. Note -that this is a bit complicated because there are some constraints on -the locations of certain segments. - -First, the RCP, FCP, and IOP segments contain executable code which is -pre-built and intended to run at specific locations. Specifically, the -SYS.RCP, SYS.FCP, and SYS.IOP files provided with the BPBIOS distribution -must be loaded at their original intended location. In theory, new -versions of these files could be created to load at different locations, -but that is not the approach taken here. Instead, the memory segment -configurations are designed to keep these 3 components at the same -location as the original distribution. +In addition to the configuration options above, ZCPR also utilizes a +defined set of memory segments in upper memory. The location and +size of these segments have many ramifications and general ZCPR / +BPBIOS documents should be consulted to understand these. The build +process used here produces a custom configuration appropriate for +RomWBW. The original distributed memory segment configuration occupies +the top of memory which, unfortunately, conflicts with the RomWBW +HBIOS need to occupy this space. + +Although RomWBW HBIOS is implemented in it's own dedicated memory +bank, it requires a small proxy at the top of memory which acts as a +mechansim to route calls to HBIOS. The proxy occupies FE00H-FFFFH and +implements all of the HBIOS routing code. + +Taking the above into account, the build process implements a memory +segment configuration that is compatible with RomWBW HBIOS. +Essentially, this configuration rearranges the ZCPR memory segments to +free up the area required by the HBIOS proxy. Note that this is a bit +complicated because there are some constraints on the locations of +certain segments. BPBIOS is assembled as relocatable code. Subsequently, the BPBUILD tool is used to link BPBIOS with the CCP and DOS relocatable code to produce -the absolute image (.IMG file). Note that BPBUILD does more than just +the loadable image (.IMG file). Note that BPBUILD does more than just linking. As part of it's work, BPBUILD adjusts the built-in environment segment to customize the final image for the desired location and size of Z-System segments. The following table summarizes the original memory segment configuration and the -two new configurations utilized by this build process. As indicated above, the +new configuration utilized by this build process. As indicated above, the original configuration is incompatible with RomWBW HBIOS because it occupies the -very top of memory. This configuration is shown below purely to document the -original distribued configuration. - -SEGMENT Original T Config N Config --------------- -------------- -------------- -------------- -Environment FE00 EA00* FE00 - # Recs 2 2 2 -Flow Ctl Pkg FA00 FA00 FA00 - # Recs 4 4 4 -I/O Pkg EC00 EC00 EC00 - # Recs 12 12 12 -Res Cmd Pkg F200 F200 F200 - # Recs 16 16 16 -Cmd Line FF00 EB00* FF00 - # Bytes 203 203 171* -Named Dirs FC00 FC00 FC00 - # Ents 14 14 14 -Ext Path FDF4 FDF4 FDF4 - # Ents 5 5 5 -Shell Stack FD00 FD00 FD00 - # Ents 4 4 4 - Ent Size 32 32 32 -Msg Buffer FD80 FD80 FD80 -Ext FCB FDD0 FDD0 FDD0 -Ext Stack FFD0 EBD0* FFB0* - -User Space E900 E700* E900 - Size 300 300 300 - -Wheel Byte FDFF FDFF FDFF +very top of memory. The original configuration is shown below purely to +document the original distributed configuration. + +SEGMENT Original RomWBW Config +-------------- -------------- -------------- +Environment FE00 FC00 + # Recs 2 2 +Flow Ctl Pkg FA00 F700 + # Recs 4 4 +I/O Pkg EC00 EF00 + # Recs 12 0 +Res Cmd Pkg F200 EF00 + # Recs 16 16 +Cmd Line FF00 FD00 + # Bytes 203 251 +Named Dirs FC00 F900 + # Ents 14 25 +Ext Path FDF4 FBF4 + # Ents 5 5 +Shell Stack FD00 FB00 + # Ents 4 4 + Ent Size 32 32 +Msg Buffer FD80 FB80 +Ext FCB FDD0 FBD0 +Ext Stack FFD0 FAD0 + +User Space E900 EC00 + Size 300 300 + +Wheel Byte FDFF FBFF The sections below provide a more detailed description of the memory segment configurations. @@ -167,63 +153,34 @@ ORIGINAL DISTRIBUTION CONFIGURATION (NO HBIOS): ============================================================================= ============================================================================= -T CONFIGURATION (HBIOS FULL PROXY @ FC00-FFFF): - This configuration uses a modified layout of the ZSystem segments so - that critical segments can be located at the same address as the - "stock" configuration. Some segments are built with an assumed - memory location and will generally fail if they are not loaded in - that location. The Flow Control Package (FCP) and Resident - Command Processor (RCP) are very sensitive to this. This configuration - places them at their original locations, so they work well. +ROMWBW CONFIGURATION (HBIOS PROXY @ FE00-FFFF): ----------------------------------------------------------------------------- - A - Environment - EA00H F - Named Dirs - FC00H - Size (# recs)- 2 # of Entries - 14 - B - Flow Ctrl Pkg - FA00H G - External Path - FDF4H - Size (# recs)- 4 # of Entries - 5 - C - I/O Package - EC00H H - Shell Stack - FD00H - Size (# recs)- 12 # of Entries - 4 - D - Res Cmd Proc - F200H Entry Size - 32 - Size (# recs)- 16 I - Msg Buffer - FD80H - E - Command Line - EB00H J - Ext. FCB - FDD0H - Size (bytes) - 203 K - Ext. Stack - EBD0H -============================================================================= - -============================================================================= -N CONFIGURATION (HBIOS MINI PROXY @ FFE0-FFFF): - This configuration frees up the top 20H bytes of memory to make space for the - HBIOS mini-proxy. It does this by shrinking Cmd Line and shifting the Ext Stack - down by 32 bytes. This configuration will only work if INTPXY=YES in HBIOS. ------------------------------------------------------------------------------ - A - Environment - FE00H F - Named Dirs - FC00H - Size (# recs)- 2 # of Entries - 14 - B - Flow Ctrl Pkg - FA00H G - External Path - FDF4H - Size (# recs)- 4 # of Entries - 5 - C - I/O Package - EC00H H - Shell Stack - FD00H - Size (# recs)- 12 # of Entries - 4 - D - Res Cmd Proc - F200H Entry Size - 32 - Size (# recs)- 16 I - Msg Buffer - FD80H - E - Command Line - FF00H J - Ext. FCB - FDD0H - Size (bytes) - 171 K - Ext. Stack - FFB0H + A - Environment - FC00H F - Named Dirs - F900H + Size (# recs)- 2 # of Entries - 25 + B - Flow Ctrl Pkg - F700H G - External Path - FBF4H + Size (# recs)- 4 # of Entries - 5 + C - I/O Package - EF00H H - Shell Stack - FB00H + Size (# recs)- 0 # of Entries - 4 + D - Res Cmd Proc - EF00H Entry Size - 32 + Size (# recs)- 16 I - Msg Buffer - FB80H + E - Command Line - FD00H J - Ext. FCB - FBD0H + Size (bytes) - 251 K - Ext. Stack - FAD0H ============================================================================= BPBIOS is designed to invoke a command at startup (autostart command). There -are 3 ZEX command files customized for this build. They are Z33.ZEX, Z34.ZEX, -and Z41.ZEX. BPBIOS is customized to launch the ZEX command file corresponding +are 3 ZEX command files customized for this build. They are ZSTT.ZEX, ZSTN.ZEX, +and ZSTF.ZEX. BPBIOS is customized to launch the ZEX command file corresponding to the version of ZCPR being linked with it. The table below summarizes the loadable image files created by the build process: -ZCPR ZSDOS BPBIOS STARTUP T (INTPXY=NO) N (INTPXY=YES) ------- ------ -------------- -------------- -------------- -------------- -v3.3 v1.1 NON-BANKED Z33.ZEX BP33T.IMG BP33N.IMG -v3.3 v1.1 BANKED Z33.ZEX BP33TBNK.IMG BP33NBNK.IMG -v3.4 v1.1 NON-BANKED Z34.ZEX BP34T.IMG BP34N.IMG -v3.4 v1.1 BANKED Z34.ZEX BP34TBNK.IMG BP34NBNK.IMG -v4.1 v2.03 BANKED Z41.ZEX BP41TBNK.IMG BP41NBNK.IMG - -WARNING: Once an N configuration image has been loaded, it is no longer -possible to load a T configuration without rebooting. This constraint -exists because the N configurations wipe out all but the top 20H bytes -of memory. The T configurations rely on the full 200H byte HBIOS -proxy. +ZCPR ZSDOS BPBIOS STARTUP HBIOS PROXY IMAGE +------ ------ -------------- -------------- -------------- -------------- +v3.3 v1.1 NON-BANKED ZST.ZEX EXTERNAL BP33.IMG +v3.3 v1.1 BANKED ZST.ZEX EXTERNAL BP33BNK.IMG +v3.4 v1.1 NON-BANKED ZST.ZEX EXTERNAL BP34.IMG +v3.4 v1.1 BANKED ZST.ZEX EXTERNAL BP34BNK.IMG +v4.1 v2.03 BANKED ZSTF.ZEX EXTERNAL BP41BNK.IMG + +--WBW 1:34 PM 10/7/2021 \ No newline at end of file diff --git a/Source/BPBIOS/Build.cmd b/Source/BPBIOS/Build.cmd index 54186541..184aafec 100644 --- a/Source/BPBIOS/Build.cmd +++ b/Source/BPBIOS/Build.cmd @@ -1,30 +1,17 @@ @echo off - setlocal -setlocal & cd ZCPR33 && call Build || exit /b 1 & endlocal -setlocal & cd Z34RCP11 && call Build || exit /b 1 & endlocal -setlocal & cd NZFCP13 && call Build || exit /b 1 & endlocal - -set PATH=%PATH%;..\..\Tools\zx;..\..\Tools\cpmtools; - -set ZXBINDIR=../../tools/cpm/bin/ -set ZXLIBDIR=../../tools/cpm/lib/ -set ZXINCDIR=../../tools/cpm/include/ - -call :makebp 33t +pushd ZCPR33 && call Build || exit /b & popd -call :makebp 33tbnk -call :makebp 33n -call :makebp 33nbnk +set PATH=%PATH%;..\..\Tools\zxcc;..\..\Tools\cpmtools; -call :makebp 34t -call :makebp 34tbnk -call :makebp 34n -call :makebp 34nbnk +set CPMDIR80=%TOOLS%/cpm/ -call :makebp 41tbnk -call :makebp 41nbnk +call :makebp 33 +call :makebp 33bnk +call :makebp 34 +call :makebp 34bnk +call :makebp 41bnk rem pause @@ -54,32 +41,33 @@ echo. echo Building BPBIOS Variant "%VER%"... echo. -copy def-ww-z%VER%.lib def-ww.lib -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 -ren bpbio-ww.err bp%VER%.err -copy bpbio-ww.rel bp%VER%.rel +copy def-ww-z%VER%.lib def-ww.lib || exit /b +rem if exist bpbio-ww.rel del bpbio-ww.rel || exit /b +zxcc ZMAC -BPBIO-WW -/P || exit /b +if exist bp%VER%.prn del bp%VER%.prn || exit /b +ren bpbio-ww.prn bp%VER%.prn || exit /b +if exist bp%VER%.err del bp%VER%.err || exit /b +ren bpbio-ww.err bp%VER%.err || exit /b +copy bpbio-ww.rel bp%VER%.rel || exit /b 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 but zxcc fails due to host OS. Below, a temp file rem is used to avoid the problematic rename. -if exist bpsys.img del bpsys.img -if exist bpsys.tmp del bpsys.tmp -copy bp%VER%.dat bpsys.tmp +if exist bpsys.img del bpsys.img || exit /b +if exist bpsys.tmp del bpsys.tmp || exit /b +copy bp%VER%.dat bpsys.tmp || exit /b rem bpsys.tmp -> bpsys.img -zx bpbuild -bpsys.tmp bpsys.img -zx bpbuild -bpsys.tmp -; Version: 1.3 -; Changes: Updated & improved JetLDR signon. -; Changed four JR's to JP's. - -; Date: August 21, 1988 -; Author: Carson Wilson -; Version: 1.2 - -; Derived from: - -; Date: April 1988 -; Name changed and code modified for NZ-COM. - -; Derived from: - -; PROGRAM: Z34FCP -; AUTHOR: Jay Sage -; VERSION: 1.0 -; DATE: May 25, 1987 -; DERIVATION: FCP10 by Jay Sage (ZSIG) - -; ZCPR34 is copyright 1987 by Jay P. Sage. All rights reserved. End-user -; distribution and duplication permitted for non-commercial purposes only. -; Any commercial use of ZCPR34, defined as any situation where the duplicator -; recieves revenue by duplicating or distributing ZCPR34 by itself or in -; conjunction with any hardware or software product, is expressly prohibited -; unless authorized in writing by Jay P. Sage. - -;============================================================================= -; -; R E V I S I O N H I S T O R Y -; -;============================================================================= -; -; 21 Aug 88 Added JetLDR signon description. -; IF IN now prints ' (Y/N)? ', and accepts only Y or y or -; N or n. -; Added macro code to show FCP length following assembly. -; -; Carson Wilson. -; -; 6 April 88 Handles latest Type 4 IF.COM -; 1.2 Changed command tail loader to accept :IF. Joe Wright -; -; 12/31/87 Modified for use with Z34CMN.LIB for NZ-COM. Joe Wright. -; 1.1 -; -; 05/25/87 Created ZCPR33 version from the code I released through ZSIG. -; 1.0 This code differs only in the more efficient way in which it -; determines if it was invoked with a directory prefix that -; signals that the transient IF.COM should be used to process -; the IF command. This permits the user to force the use of a -; more powerful option processor in the transient IF.COM than in -; the resident code. Option bytes were added after the end of -; the resident option dispatch table so that SHOW can report -; configuration options to the user. -; -; FCP10 notes -; -; The transient processor can now be loaded at an address other -; than 100h so as not to interfere with code loaded in the TPA. -; Then the GO command can normally be used even after IF.COM is -; used to process the flow test. If the LOADCHK equate -; is true then the FCP will verify that the transient -; processor has been loaded to the page in memory for which -; it was assembled. If loaded to the wrong page, it will -; be reloaded to the correct one. -; -; The test for the form ARG1=ARG2 was tightened up so as not to -; be confused by an equal sign in some later part of the command -; tail (e.g., "IF REG 1 = 2"). Now only the first token -; (contiguous string of characters) is checked. This extra code -; is under the control of the XEQOPT equate. The only option -; that is still a problem is the COMIF form '~='. Since the '=' -; is in the first token, this 'not equal' condition cannot be -; distinguished from an equality test against the character '~'. -; The solution is to turn off equality testing in the resident FCP -; or to use the alternative COMIF options 'NE' or '~EQ' for this -; test. -; -; Added optional commands AND and OR. These work like IF except -; that they affect the current IF level rather than going one -; level deeper. -; -; Added optional command ZIF to zero out all IF states no matter -; whether current state is true or false (XIF only works if state -; is true. -; -; Added new optional command IFQ (if-query) and enhanced the -; IFSTAT code that is invoked when the NOISE equate is true. -; In both cases, the entire tree of IF states is now shown, -; starting with the current level. For example, IFQ might result -; in the display "IF FTT" (we are at third IF level and it is -; false; the second and first IF levels are true). If the -; current IF level is 0, then the display is "IF None". -; -; Added two new resident options: AMBIGUOUS (AM) returns true if -; the file specification in the second token has a '?' (or '*') -; in it; COMPRESSED (CO) returns true if the file specificaton in -; the second token has a 'Z' or a 'Q' in the second character of -; the file type. -; -; Howard Goldstein contributed significantly to the development -; of this code. Bridger Mitchell also offered helpful -; suggestions. -; -; Jay Sage -; -; Notes from earlier SYSFCP revisions -; -; 09/12/85 Fixed bug in my code used when IF.COM is found in a specified -; drive/user area. The values of CDISK and CUSER were not being -; set, and as a result the user was not returned to the correct -; directory. The EXIST and EMPTY tests did not work correctly -; unless a DIR: or DU: was given explicitly with each file name. -; Jay Sage - -; 08/29/85 Reorganized code so that COMIF code handles only those -; options not in the table of local IF functions. Also changed -; code to allow searching for IF.COM in a specified directory -; instead of using the ROOT of the path. Also renamed macros -; to make code ZAS compatible. -; Jay Sage - -; 07/21/85 Corrected reversed sensing of program error flag in the -; IF ERROR test. -; Jay Sage - -; 01/02/85 Revised to correct a bug in the IF EMPTY test. First, the -; current record byte was not being set to zero before trying -; to read from the file. Secondly, the test for error was not -; testing for FF but for 00. My BDOS does not return 0 for -; success. It seems to return 00, 01, 02, or 03. This made the -; file appear to be empty. -; Jay Sage - - -;============================================================================= -; -; M A C R O S A N D E Q U A T E S -; -;============================================================================= - - name ('FCP') - -; External macro references - - maclib Z34CMN.LIB ; Source of system addresses - maclib NZFCP.LIB ; Source of configuration options - maclib Z34MAC.LIB ; Z34 macros - -; Equates section - -version equ 13 - -lf equ 0ah -cr equ 0dh -bell equ 07h - -base equ 0 -wboot equ base+0000h ; CP/M warm boot address -udflag equ base+0004h ; User num in high nybble, disk in low -bdos equ base+0005h ; BDOS function call entry point -tfcb equ base+005ch ; Default FCB buffer -fcb1 equ tfcb ; 1st and 2nd FCBs -fcb2 equ tfcb+16 -tbuff equ base+0080h ; Default disk I/O buffer -tpa equ base+0100h ; Base of TPA - - -;============================================================================= -; -; J e t L D R S I G N - O N -; -;============================================================================= - -; This prints an extended ID message upon loading with JetLDR. -; These are NOT the command names. - - COM /_ID_/ - - db 'Copyright 1989 ZSA',cr,lf - db 'Commands:',cr,lf - db ' IF ELSE FI XIF ' - - if andopt - db 'AND ' - endif - if oropt - db 'OR ' - endif - if ifqopt - db 'IFQ ' - endif - if zifopt - db 'ZIF ' - endif - - db cr,lf,'Options' - if ifoneg - db ' (use "',negchar,'" to negate)' - endif - if noise - db '; (noise)' - endif - db ':',cr,lf - - if ifotrue - db ' T F ' - endif - if ifambig - db 'AMbig ' - endif - if ifcompr - db 'COmpr ' - endif - if ifoempty - db 'EMpty ' - endif - if ifoeq - db 'x=y ' - endif - if ifoerror - db 'ERror ' - endif - if ifoexist - db 'EXist ' - endif - if ifoinput - db 'INput ' - endif - if ifonull - db 'NUll ' - endif - if iforeg - db 'REgs ' - endif - if ifotcap - db 'TCap ' - endif - if ifowheel - db 'WHeel ' - endif - - if comif - db cr,lf,' Use ' - if pathroot - db 'root:' - endif - db 'IF.COM' - endif - - db 0 ; End of JetLDR sign-on message - - CSEG - -;============================================================================= - -; Start of code - -start: - db 'Z3FCP' ; Flag for Package Loader - -;============================================================================= -; -; C O M M A N D T A B L E -; -;============================================================================= - -; The command name table is structured as follows: -; -; The first byte is the number of characters in each command name. -; Next come records consisting of command names followed by entry -; point addresses for the code to process the command. Finally, -; there is a null to indicate the end of the dispatch table. - - db cmdsize ; Size of text entries -ctab: ctable ; Macro defined in NZFCP.LIB - db 0 - -;============================================================================= -; -; I F C O N D I T I O N O P T I O N S -; -;============================================================================= - -condtab: - - if ifotrue - db 'T ' ; TRUE - dw ifctrue - db 'F ' ; FALSE - dw ifcfalse - endif ; ifotrue - - if ifambig ; Ambiguous file spec - db 'AM' - dw ifcambig - endif ; ifambig - - if ifcompr ; Squeezed or crunched - db 'CO' - dw ifccompr - endif ; ifcompr - - if ifoempty - db 'EM' ; File empty - dw ifcempty - endif ; ifoempty - - if ifoerror - db 'ER' ; Error message - dw ifcerror - endif ; ifoerror - - if ifoexist - db 'EX' ; File exists - dw ifcex - endif ; ifoexist - - if ifoinput - db 'IN' ; User input - dw ifcinput - endif ; ifoinput - - if ifonull - db 'NU' - dw ifcnull - endif ; ifonull - - if ifotcap ; Z3 TCAP available - db 'TC' - dw ifctcap - endif ; ifotcap - - if ifowheel ; Wheel Byte - db 'WH' - dw ifcwheel - endif ; ifowheel - - db 0 - -; Option bytes: these option bytes can be used to convey information to -; programs such as SHOW. The first one is used to reduce the chance of -; misinterpreting data from an earlier version of the FCP that does not -; have the option bytes. The next byte tells if COMIF has been activated -; and if the root of the path will be used as the directory in which to look -; for IF.COM. If PATHROOT is not selected (or if the path is empty), then -; the specified drive/user will be used. The overflow bit in case the user -; number is greater than 15 is kept in bit 2 of the second option byte. The -; combined user/drive value is kept in the third option byte. - -highuser defl ifusr gt 15 - -opt0: db 34h ; ZCPR34 version ID -opt1: optflag highuser,pathroot,comif -opt2: db ( ifusr and 0fh ) shl 4 + ( ifdrv - 'A' ) ; user/drive flag - -;============================================================================= -; -; C O M M A N D P R O C E S S I N G C O D E -; -;============================================================================= - -; Command: ZIF -; -; This command zeros out the IF system no matter what the current -; level IF state is. - - if zifopt - -ifzero: - if noise - call nl ; Print new line - endif ; noise - - jr ifexit1 - - endif ; zifopt - -;----------------------------------------------------------------------------- - -; Command: XIF -; -; If current IF state is true, XIF terminates all IFs, restoring a basic -; TRUE state. - -ifexit: - if noise - call nl ; Print new line - endif ; noise - - call iftest ; See if current IF is running and FALSE - - if noise - jr z,ifstat ; Abort with status message if so - else ; not noise - ret z ; Or just return if false - endif ; noise - -ifexit1: - ld hl,z3msg+1 ; Pt to IF flag - ld (hl),0 ; Zero IF flag - jr ifendmsg ; Print message - -;----------------------------------------------------------------------------- - -; Command: FI -; -; FI decrements to the previous IF level. It does this by shifting the -; current-if-bit in the first 'if' message in the Z3MSG buffer right one -; position. - -ifend: - if noise - call nl ; Print new line - endif ; noise - -; ld hl,z3msg+1 ; Point to IF flag -; ld a,(hl) ; Get it -; or a ; No IF active? - - call msgbf1 - dec hl ; Save a byte over the three lines above - - jr z,ifnderr - -ifendmsg: - if noise - call print - dc 'To ' ; Prefix to status display - endif ; noise - - srl (hl) ; Adjust active bit - - if noise - jr nz,ifstat ; Print status if IF still active - endif ; noise - -ifnderr: - if noise - - call print ; Print message - dc 'No ' - jp prif - - else ; not noise - - ret - - endif ; noise - -;----------------------------------------------------------------------------- - -; Command: ELSE -; -; ELSE complements the Active Bit for the Current IF provided the -; previous IF state was true. If the previous state was false, the -; command is flushed. -; -; This is accomplished according to the following algorithm. If the -; current IF is 0 (no IF) or 1 (one IF), then take the previous state -; to be true and perform the toggle. Otherwise, test the previous -; IF level condition and toggle only if it is true. - -ifelse: - if noise and (not ifqopt) - call nl ; Print new line - endif ; noise and (not ifqopt) - - call msgbf1 ; Get current if - ld b,a ; Save in B - srl a ; Back up if pointer bit to previous IF level - jr z,iftog ; If no previous IF level, go to toggle code - and (hl) ; Determine state of previous IF level - - if noise - if ifqopt - jr z,ifstat0 ; Print status on new line - else - jr z,ifstat ; If false, just print status - endif ; Ifqopt - else ; not noise - ret z ; Or simply return - endif ; noise - -iftog: - ld a,(hl) ; Get if-status message byte - xor b ; Flip current state - ld (hl),a ; Put result back in message byte - ; ..and fall thru to print status - - if not noise - ret - endif - -;----------------------------------------------------------------------------- - -; Indicate if current IF is True or False - -ifstat0: - call nl -ifstat: - call prif ; Print 'IF ' - call msgbf1 ; Get current if byte and set flags - ld b,a ; Get it into B - jr nz,ifstat1 ; Nz means if active - - call print - dc 'None' - ret - -ifstat1: - ld a,(hl) ; Get if-status message byte - and b ; Mask in currently active IF level status - ld c,'F' ; Load with false indicator - jr z,ifstat2 ; If current IF is false, jump - ld c,'T' ; Else, load with true indicator -ifstat2: - ld a,c - call conout - - srl b ; Drop one IF level - jr nz,ifstat1 ; Loop through all IF states - ret - -;------------------------- - -; Output CRLF - -nl: call print - dc cr,lf - ret - -;----------------------------------------------------------------------------- - -; Command: OR - -; This command performs a logical or operation by updating the -; if state without going to a new level. If there are active -; IFs and the current state is true, we do nothing. Else we back -; up one level and fall through to normal IF processing. - - if oropt - -orstart: - call msgbf1 ; Get if active byte - jr z,backup ; Treat like if if no IFs active - and (hl) ; Check current state - jr z,backup ; Current STATE false so go proecess - - if noise - jr ifstat0 ; Else return and show status - else - ret ; Or just return - - endif ; Noise - endif ; Oropt - -;----------------------------------------------------------------------------- - -; Command: AND - -; This command performs a logical and operation by updating the -; if state without going to a new level. If there are active -; IFs and the current state is false, we do nothing. Else we back -; up one level and fall through to normal IF processing. - - if andopt - -andstart: - call iftest ; Test for IF running and false - if noise - jr z,ifstat0 ; Condition met, show status & return - else - ret z ; Condition met, return - endif ; Noise - endif ; Andopt - -; Common stuff for and and or - - if andopt or oropt - -backup: - dec hl ; Pt to flag byte - srl (hl) ; Drop back one level -; -; Poke "IF" into external fcb for transient -; - if comif -pokefcb: - ld de,extfcb+1 ; Pt to external fcb - ld hl,ifcmd ; Pointer to IF command in table - ld bc,cmdsize ; Length - ldir ; Move it in - - endif ; comif - -; Fall through to IF PROCESSING - endif ;Andopt or oropt - -;----------------------------------------------------------------------------- - -; FCP Command: IF -; -; If current IF state is false, then advance to next level and set it -; to false also. If current IF state is true, then test condition and -; set the next level accordingly. - -ifstart: - if not ifqopt - - ld a,(extfcb) ; NZ if explicit - ld hl,tbuff - or (hl) - jp z,ifstat0 ; Report IF status - - endif ; not ifqopt - -ifstrt: - if noise - call nl ; Print new line - endif ; noise - - call iftest ; See if current IF is running and FALSE - jP z,ifcf ; Yes, do the right thing - -; Test for presence of colon in command. If colon present, then go directly -; to COMIF processing. - - if comif - ld a,(extfcb) ; Check drive byte of external FCB - or a ; If it is zero, no colon was present - jp nz,runcomif ; If colon, go to comif processing - ; Else fall through to resident processing - endif ; comif - -;----------------------------------------------------------------------------- -; -; R E S I D E N T C O M M A N D P R O C E S S I N G -; -;----------------------------------------------------------------------------- - -resident: - -; Test for Equality if Equal Sign in Token - - if ifoeq - - ld hl,tbuff+1 - - if xeqopt ; Extended equal testing - -skipsp: ; Skip over any space to first token - ld a,(hl) - or a ; Check for end of tail - jr z,ifck0 ; If so , go on - cp ' '+1 ; Test for space or control character - jr nc,tsteq ; If not, we are at first token - inc hl ; Otherwise advance to next character - jr skipsp ; ..and continue testing - - endif ; xeqopt - -tsteq: - ld a,(hl) ; Get character from command tail - inc hl ; Point to next one - or a ; EOL? - jr z,ifck0 ; Continue if so - - if xeqopt - cp ' '+1 ; End of token? - jr c,ifck0 ; If so, go on - endif ; xeqopt - - cp '=' ; Found '=' ? - jr nz,tsteq ; If not, continue scan - - ld hl,fcb1+1 ; Else, get ready to compare FCBs - ld de,fcb2+1 - ld b,11 ; 11 bytes -eqtest: - ld a,(de) ; Compare - cp (hl) - jr nz,ifcf - inc hl ; Pt to next - inc de - djnz eqtest - jr ifct - - endif ; ifoeq - - -ifck0: - ld de,fcb1+1 ; Point to first character in FCB1 - - if ifoneg - ld a,(de) ; Get it - ld (negflag),a ; Set negate flag - cp negchar ; Is it a negate? - jr nz,ifck1 ; If not, go on - inc de ; Else point to character after negchar -ifck1: - endif ; ifoneg - - if iforeg ; REGISTERS - call regtest ; Test for register value - jr nz,runreg - endif ; iforeg - - call condtest ; Test of condition match - jr nz,runcond ; If found, process condition - - if comif - jp runcomif ; If function not found in table, use transient - else - - call print ; Beep to indicate error - dc bell - - if noise - jp ifstat ; No condition, display current condition - else ; no noise - ret - endif ; noise - endif ; comif - -;----------------------------------------------------------------------------- -; -; Process register - register value is in A -; -;----------------------------------------------------------------------------- - - if iforeg -runreg: - push af ; Save value - call getnum ; Extract value in FCB2 as a number - pop af ; Get value - cp b ; Compare against extracted value - jr jrtrue ; True if match; false if not - endif ; iforeg - -;----------------------------------------------------------------------------- -; -; Process conditional test - address of conditional routine is in HL -; -;----------------------------------------------------------------------------- - -runcond: - jp (hl) ; "call" routine pted to by HL - -;============================================================================= -; -; R E S I D E N T C O N D I T I O N O P T I O N S -; -;============================================================================= - -; Condition: AMBIGUOUS - - if ifambig - -ifcambig: - ld hl,fcb2+1 ; Scan FCB2 for a '?' character - ld bc,11 ; Characters to scan - ld a,'?' ; Reference character - cpir - jr jrtrue ; True if '?' found; false if not - - endif ; ifambig - -;----------------------------------------------------------------------------- - -; Condition: COMPRESSED - - if ifcompr - -ifccompr: - ld a,(fcb2+10) ; Get middle character of file type - cp 'Z' ; Crunched - jr z,ifctrue - cp 'Q' ; Squeezed - jr jrtrue - - endif ; ifcompr - -;----------------------------------------------------------------------------- - -; Condition: TRUE -; IFCTRUE enables an active IF -; Condition: FALSE -; IFCFALSE enables an inactive IF - - if ifoempty or ifoerror or ifoexist or ifowheel -jrfalse: - jr z,ifcfalse - endif ; Ifoempty or ifoerror or ifoexist or ifowheel - -ifctrue: - - if ifoneg - call negtest ; Test for negate - jr z,ifcf - endif ; ifoneg - -ifct: - ld b,0ffh ; Active - jp ifset - - if iforeg or ifambig or ifcompr or ifoinput or ifonull -jrtrue: - jr z,ifctrue - endif ; Iforeg or ifambig or ifcompr or ifoinput or ifonull - -ifcfalse: - - if ifoneg - call negtest ; Test for negate - jr z,ifct - endif ; ifoneg - -ifcf: - ld b,0 ; Inactive - jp ifset - -;----------------------------------------------------------------------------- - -; Condition: EMPTY filename.typ - - if ifoempty -ifcempty: - call tlog ; Log into FCB2's DU - ld de,fcb2 ; Pt to fcb2 - ld c,15 ; Open file - push de ; Save fcb ptr - call bdos - pop de - inc a ; Not found? - jr z,ifctrue - ld c,20 ; Try to read a record - xor a ; set cr value to zero - ld (fcb2+32),a ; to attempt to read first record - call bdos - or a ; 0=OK - jr jrfalse ; true if no read - endif ; ifoempty - -;----------------------------------------------------------------------------- - -; Condition: ERROR - - if ifoerror -ifcerror: - ld a,(z3msg+6) ; Get error byte - or a ; 0=FALSE (no error registered) - jr jrfalse - endif ; ifoerror - -;----------------------------------------------------------------------------- - -; Condition: EXIST filename.typ - - if ifoexist -ifcex: - call tlog ; Log into DU - ld de,fcb2 ; Pt to fcb - ld c,17 ; Search for first - call bdos - inc a ; Set zero if error - jr jrfalse - endif ; Ifoexist - -;----------------------------------------------------------------------------- - -; Condition: INPUT (from user) - -; Modified to say " (Y/N)? ", and accept ONLY Y or y or N or n -; Carson Wilson 3/1/88 - - if ifoinput -ifcinput: - call print - dc ' (Y/N)? ' -ifcinp1: - ld hl,z3msg+7 ; Pt to ZEX message byte - ld (hl),10b ; Suspend ZEX input - push hl ; Save ptr to ZEX message byte -ifcinp2: - ld e,0ffh - ld c,6 ; Direct input from console - call bdos - or a ; Any input yet? - jr z,ifcinp2 ; Nope, try again - - pop hl ; Get ptr to ZEX message byte - ld (hl),0 ; Return ZEX to normal processing - and 5fh ; Mask and capitalize user input - cp 'Y' - jr nz,testN ; No, check if 'N' - call conout ; Display 'Y' - jr ifctrue ; Process as true -testN: - cp 'N' - jr nz,notN ; Not 'N' or 'n' - call conout ; Display 'N' - jr ifcfalse ; Process as false -notN: - ld a,bell ; Protest! - call conout - jr ifcinp1 ; Force either Y or y or N or n - - endif ; ifoinput - -;----------------------------------------------------------------------------- - -; Condition: NULL (2nd file name) - - if ifonull -ifcnull: - ld a,(fcb2+1) ; Get first char of 2nd file name - cp ' ' ; Space = null - jr jrtrue - endif ; ifonull - -;----------------------------------------------------------------------------- - -; Condition: TCAP - - if ifotcap -ifctcap: - ld a,(z3env+80h) ; Get first char of Z3 TCAP Entry - cp ' '+1 ; Space or less = none - jP c,ifcfalse - jP ifctrue - endif ; ifotcap - -;----------------------------------------------------------------------------- - -; Condition: WHEEL - - if ifowheel -ifcwheel: - ld hl,(z3env+29h) ; Get address of wheel byte - ld a,(hl) ; Get byte - or a ; Test for true - jP jrfalse ; False if 0 - endif ; ifowheel - -;============================================================================= -; -; S U P P O R T R O U T I N E S -; -;============================================================================= - -; Convert chars in FCB2 into a number in B - - if iforeg -getnum: - ld b,0 ; Set number - ld hl,fcb2+1 ; Pt to first char -getn1: - ld a,(hl) ; Get char - inc hl ; Pt to next - sub '0' ; Convert to binary - ret c ; Done if error - cp 10 ; Range? - ret nc ; Done if out of range - ld c,a ; Value in C - ld a,b ; A=old value - add a,a ; *2 - add a,a ; *4 - add a,b ; *5 - add a,a ; *10 - add a,c ; Add in new digit value - ld b,a ; Result in B - jr getn1 ; Continue processing - endif ; iforeg - -;----------------------------------------------------------------------------- - -; Log into DU in FCB2 - - if ifoexist or ifoempty - -tlog: - ld a,(fcb2) ; Get disk - or a ; Current? - jr nz,tlog1 - ld c,25 ; Get disk - call bdos - inc a ; Increment for following decrement -tlog1: - dec a ; A=0 - ld e,a ; Disk in E - ld c,14 - call bdos - ld a,(fcb2+13) ; Pt to user - ld e,a - ld c,32 ; Set user - jp bdos - - endif ; ifoexist or ifoempty - -;----------------------------------------------------------------------------- - -; Test of Negate Flag = negchar - - if ifoneg -negtest: -negflag equ $+1 ; Pointer for in-the-code modification - ld a,0 ; 2nd byte is filled in - cp negchar ; Test for No - ret - endif ; ifoneg - -;----------------------------------------------------------------------------- - -; Test FCB1 against a single digit (0-9) -; Return with register value in A and NZ if so - - if iforeg -regtest: - ld a,(de) ; Get digit - sub '0' - jr c,zret ; Z flag for no digit - cp 10 ; Range? - jr nc,zret ; Z flag for no digit - ld hl,z3msg+30h ; Pt to registers - add a,l ; Pt to register - ld l,a - ld a,h ; Add in H - adc 0 - ld h,a - xor a ; Set NZ - dec a - ld a,(hl) ; Get register value - ret -zret: - xor a ; Set Z - ret - endif ; iforeg - -;----------------------------------------------------------------------------- - -; Test to see if a current IF is running and if it is FALSE -; If so, return with Zero Flag Set (Z) -; If not, return with Zero Flag Clear (NZ) -; Affect only HL and PSW - -iftest: - call msgbf1 ; Test for active IF - jr z,ifok ; No active IF - and (hl) ; Check active flag - ret z ; Return Z since IF running and FALSE -ifok: - or 255 ; Return NZ for OK - ret - -msgbf1: - ld hl,z3msg+1 ; Get IF active flag - ld a,(hl) - inc hl ; Pt to If status byte - or a ; Set z if no IF active - ret - -;----------------------------------------------------------------------------- - -; Test FCB1 against condition table (must have 2-char entries) -; Return with routine address in HL if match and NZ flag - -condtest: - ld hl,condtab ; Pt to table -condt1: - ld a,(hl) ; End of table? - or a - ret z - ld a,(de) ; Get char - cp (hl) ; Comppare entries - inc hl ; Pt to next - inc de - jr nz,condt2 - ld a,(de) ; Get 2nd char - cp (hl) ; Compare - jr nz,condt2 - inc hl ; Pt to address - ld a,(hl) ; Get address in HL - inc hl - ld h,(hl) - ld l,a ; HL = address - jr ifok ; Set NZ for OK -condt2: - inc hl ; Pt to next entry - inc hl ; Skip over addr - inc hl - dec de ; Pt to 1st char of condition - jr condt1 - -;----------------------------------------------------------------------------- - -; Turn on next IF level -; B register is 0 if level is inactive, 0FFH if level is active - -ifset: -; ld hl,z3msg+1 ; Get IF flag -; ld a,(hl) -; or a ; If no if at all, start 1st one - - call msgbf1 - dec hl - - jr z,ifset1 -ifset0: - add a,a ; Advance to next level - jr c,iferr ; Check for overflow (8 IFs max) - ld (hl),a ; Set IF byte - jr ifset2 -ifset1: - inc a ; A=1 - ld (hl),a ; Set 1st IF -ifset2: - ld d,a ; Get IF byte - and b ; Set interested bit - ld b,a - inc hl ; Pt to active flag - ld a,d ; Complement IF byte - cpl - and (hl) ; Mask in only uninterested bits - or b ; Mask in interested bit - ld (hl),a ; Save result - - if noise - jp ifstat ; Print status and exit - else - ret ; Or just exit - endif ; noise - -iferr: - call print ; Beep to indicate overflow - dc bell - ret - -;============================================================================= -; -; T R A N S I E N T I F P R O C E S S I N G -; -;============================================================================= - - - if comif - -runcomif: - -; First we have to find IF.COM - - ld bc,100h*(ifdrv-'A')+ifusr ; Values to use if null path - - if pathroot - - ld hl,(expath) ; Point to symbolic path (indirect) -fndroot: - ld a,(hl) ; Check for end of path - or a - jr z,froot2 ; If end, branch - -; Process Next Path Element - - cp curint ; Current disk/user symbol? - jr nz,froot0 ; If not, branch - ld a,(curdr) ; Get current disk - inc a ; Compensate for following decrement -froot0: - dec a ; Shift to range 0..15 - ld b,a ; Set disk - inc hl ; Point to user in path - ld a,(hl) ; Get user - cp curint ; Current drive/user symbol? - jr nz,froot1 ; If not, branch - ld a,(curusr) ; Get current user -froot1: - ld c,a ; Set user - inc hl ; Point to next element in symbolic path - jr fndroot - -; Done with Search - BC Contains ROOT DU (or specified DU if path is empty) - - endif ; pathroot - -froot2: - call logbc ; Log into IF.COM's directory - -; Try to Open File IF.COM - - ld de,extfcb ; Point to command FCB - xor a - ld (de),a ; Force current drive - ld c,15 ; Open file - call bdos - inc a - jr nz,ifload ; Branch if file found - -; IF.COM not found - process as IF F - -ifnotfnd: - call iferr ; Ring bell - call reset ; Return home - jp ifcf - -; Load File IF.COM - -ifload: - call defdma ; First record to tbuff - call readcmd ; Read 1st record from IF.COM - jr nz,ifnotfnd ; If eof, treat as if file not found - - ld (extfcb+32),a ; Start from scratch (record 0) - ld a,(tbuff+8) - cp 3 - jr c,ifnotfnd ; Only Types 3 and 4 are acceptable - - call loadif ; Load IF.COM and set IFADR appropriately -; -; Build the command tail at tbuff -; - ld de,tbuff ; Point DE to tbuff - push de ; Save it for later - ld hl,(z3msg+4) ; Points into MCL buffer -; -; Advance HL to first 'space' after IF or .IF or :IF -; -advsp: inc hl - ld a,(hl) - cp ' '+1 ; Carry if space or null - jr nc,advsp - - ld c,0 ; Clear a counter - -putt: inc de ; Advance tbuff pointer - ld a,(hl) ; From MCL - ld (de),a ; To tbuff - inc hl ; Advance MCL pointer - or a ; Check for null - jr z,putx ; End of command line - cp ';' ; Command separator - jr z,putx ; End of command - inc c ; Count it up - jr putt ; Next.. - -putx: xor a ; Get a null - ld (de),a ; Terminate the line in tbuff - pop hl ; Beginning of tbuff - ld (hl),c ; Character count -; -; Pick up the execution address for Type 3 or 4 -; - ld hl,(ifadr) ; Load address - ld a,(hl) ; First byte at load address - cp 0c7h ; Test for RST 0 - jr nz,runif ; Nope, execute it - ld (hl),0c3h ; Plug in a JP -; -; Arrive here to execute IF.COM -; -runif: ld hl,z3env ; Pass environment in HL - db 0c3h ; JP instruction -ifadr: dw 0 ; Load/Execution address of IF.COM - -; -; Load IF.COM -; -loadif: - ld hl,(tbuff+11) ; Type 3 load address - jr z,loada ; Load as Type 3 -; -; Assume Type 4 (or higher) -; - ld hl,extfcb+32 ; Point to CR of extfcb - ld (hl),2 ; Set up for record 2 - push hl ; Save the pointer - call readcmd ; Get it into tbuff - pop hl - jp nz,ifnotfnd ; Too short - ld (hl),a ; Record 0 again - ld hl,(tbuff+11) ; Size word - push hl ; Save it - call readcmd ; Read record 0 again - pop bc ; Size - ld de,(ccp) ; CCP start - ld hl,z3env - dec a ; Phony fullget flag - call tbuff+9 ; Call Type 4 loader - push hl ; Save load address - call readcmd ; Read record 1 to tbuff (point to record 2) - pop hl ; Load address -; -loada: ld (ifadr),hl ; Save it -; -; Load IF.COM to (HL) until end of file, reset DMA and DU and return -; -load: push hl ; Save loading address - call setdma ; According to HL - call readcmd ; Read a record from file - pop hl ; Get current loading address back - jr nz,reset ; End of file - ld de,128 ; Advance it by one record - add hl,de - jr load ; Back to read some more - -; Reset DMA and Current DU - -reset: call defdma - ld bc,(curusr) ; Return home - -; Log Into DU in BC - -logbc: ld e,b ; Set disk - push bc - ld c,14 ; Select disk - call bdos - pop bc - ld e,c ; Set user - ld c,32 ; Select user - jp bdos - - -; Set default DMA address - -defdma: ld hl,tbuff - -; Set DMA to address according to HL - -setdma: push hl ; Save it - ex de,hl ; To DE - ld c,26 ; Set DMA command - call bdos ; Do it - pop hl ; DMA address - ret - -; Read a record from file in EXTFCB - -readcmd: - ld de,extfcb - ld c,20 - call bdos - or a ; Set NZ if error (end of file) - ret - - endif ; comif - -;============================================================================= -; -; U T I L I T Y S U B R O U T I N E S -; -;============================================================================= - -; Print "IF " - -prif: - call print - dc 'IF ' - ret - -;----------------------------------------------------------------------------- - -; Print String (terminated in 0 or MSB Set) at Return Address - -print: - ex (sp),hl ; Get address - call print1 - ex (sp),hl ; Put address - ret - -; Print String (terminated by MSB Set) pted to by HL - -print1: - ld a,(hl) ; Done? - inc hl ; Pt to next - call conout ; Print char - or a ; Set msb flag (m) - ret m ; Msb terminator - jr print1 - -;----------------------------------------------------------------------------- - -; Console Output Routine - -conout: - push hl ; Save regs - push de - push bc - push af - and 7fh ; Clear msb - ld e,a ; Char in E - ld c,2 ; Output - call bdos - pop af ; Get regs - pop bc - pop de - pop hl - ret - -;============================================================================= -; -; Display current length in records -; -prtval macro m1,v1,m2,v2,m3 - .radix 10 - .printx m1 v1 m2 v2 m3 - endm - -length equ $ - start -recs equ length / 128 -bytes equ length mod 128 - - .printx - prtval ,%recs,,%bytes, - .printx - - end - -; End of NZFCP.Z80 - \ No newline at end of file diff --git a/Source/BPBIOS/NZFCP13/z34cmn.lib b/Source/BPBIOS/NZFCP13/z34cmn.lib deleted file mode 100644 index ad8c8cec..00000000 --- a/Source/BPBIOS/NZFCP13/z34cmn.lib +++ /dev/null @@ -1,105 +0,0 @@ -; -; Library: Z34CMN.LIB -; Author: Carson Wilson -; Version: 1.2 -; Date: 16 June 1988 -; Changes: Renamed CRT0 to LINS for NZCOM compatibility. -; Added CUSR " " " - -; Author: Carson Wilson -; Version: 1.1 -; Date: 12 June 1988 -; Changes: Added CDRV for various Z34RCP commands. -; Added CRT0 for Z34RCP TYPE command. -; Added Z3TCAP and CLRSCR for Z34RCP CLS command. -; Added QUIET for ZCPR34 time in prompt. -; Added RSDMSG for ZCPR34 time in prompt. - -; Library: Z34CMN.LIB -; Author: Joe Wright -; Date: 23 March 1988 - -; As a replacement for Z3BASE.LIB, some usual equates. - -base equ 0 ; Base Page - -false equ 0 -true equ not false - -no equ false -yes equ true - -off equ false -on equ true - -; Named COMMON declarations start here. For compatibility, these -; are the same names used by Bridger Mitchell's JetLDR. - - common /_ENV_/ -z3env: ; Z3 Environment descriptor -z3envs equ yes ; There is one - -expath equ z3env+9 ; Address of External Path -expaths equ 10 ; Maximum 10 elements for MPATH - -rcp equ z3env+0ch ; Address of RCP -rcps equ yes ; Used as existence test, not size - -fcp equ z3env+12h ; Address of FCB -fcps equ yes ; Used as existence test, not size - -z3ndir equ z3env+15h ; Address of NDR -z3ndirs equ yes ; Used as existence test, not size - -quiet equ z3env+28h ; Quiet flag address - -z3whl equ z3env+29h ; Wheel byte address -z3whls equ yes ; There is a wheel - -lins equ z3env+33h ; CRT text lines address - -ccp equ z3env+3fh ; CCP entry -ccps equ z3env+41h ; Size - -dos equ z3env+42h ; DOS entry (+6) -doss equ z3env+44h ; Size - -bio equ z3env+45h ; BIO entry - -z3tcap equ z3env+80h ; TCAP address - -clrscr equ z3env+97h ; Clear screen string address - - common /_SSTK_/ -shstk: ; Top of Shell stack -shstks equ yes ; There is a shell stack - - common /_MSG_/ -z3msg: ; Message buffer -z3msgs equ yes ; There is one - -cusr equ z3msg+2eh ; Current user -cdrv equ z3msg+2fh ; Current drive - -rsdmsg equ z3msg+3ah ; Reserved bytes - - common /_FCB_/ -extfcb: ; External file control block -extfcbs equ yes ; There is one - - common /_MCL_/ -z3cl: ; Multiple command line -z3cls equ yes ; There is one - - common /_XSTK_/ -extstk: ; External stack -extstks equ yes ; There is one - - common /_BIOS_/ -bios: - - cseg ; Select Code Segment - -; End of Z34CMN.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/NZFCP13/z34mac.lib b/Source/BPBIOS/NZFCP13/z34mac.lib deleted file mode 100644 index 8ab3ffbe..00000000 --- a/Source/BPBIOS/NZFCP13/z34mac.lib +++ /dev/null @@ -1,122 +0,0 @@ - -; Z33MAC.LIB : Macros for use with ZCPR33 - -; General purpose macros - -putreg macro - push hl ; Save registers in order - push de - push bc - endm - -getreg macro - pop bc ; Restore registers in order - pop de - pop hl - endm - -swap macro - rrca ; Exchange nibbles - rrca - rrca - rrca - endm - -;---------------------------------------- - -; Macro for forming option bytes - -; This macro generates a byte with bits corresponding to up to 8 option -; flags. The bits are filled in the order of the parameters and are right -; justified in the byte. - -optflag macro f1,f2,f3,f4,f5,f6,f7,f8 - -flag defl 0 ;; initial value - - irp temp, - - if not nul temp -flag defl flag shl 1 - if temp -flag defl flag or 1 - endif ;;temp - endif ;;not nul temp - - endm ;; irp - - defb low flag - - endm ;; optflag - -;----------------------------------------------------------------------------- - -; Command table entry definition macro - -; Macro to form an entry for one command in the table. The first parameter is -; the name to be used for the command (no quotes); the second parameter is the -; flag that indicates whether or not the command is to be enabled; the third -; parameter is the wheel control flag; and the last parameter is the jump -; address to the code that carries out the command. The command names are -; automatically padded out to the correct length (they will be truncated and -; an error message will result if a command name is too long). The characters -; in the command name are automatically converted to upper case. - -command macro cmdname,enableflag,wheelflag,address - - if enableflag ;; Generate command only if enabled - -whlmask defl wheelflag ;; Initialize variables -count defl cmdsize ;; Initialize to size of each command name - - irpc char,cmdname ;; Repeat over letters in command name - -count defl count - 1 ;; Count down characters in name - - if [ count lt cmdsize ] - - ;; If character is lower case, convert to upper case - - if [ '&char' ge 'a' ] and [ '&char' le 'z' ] - - if whlmask - defb [ '&char' and 5fh ] + 80h - else ;;not whlmask - defb [ '&char' and 5fh ] - endif ;;whlmask - - else ;;not lower case - - if whlmask - defb '&char' + 80h ;; If controlled by wheel, set high bit - else ;;not whlmask - defb '&char' ;; If not restricted, leave high bit clear - endif ;;whlmask - - endif ;;lower case - - endif ;;[ count lt cmdsize ] - -whlmask defl false ;; Turn off high-bit setting after first char - - endm ;irpc - - ;; Pad command name with blanks - - if [ count gt cmdsize ] ;; If we underflowed - *** Command name "&cmdname" is too long / truncated *** - else - rept count - defb ' ' - endm - endif ;[ count gt cmdsize ] - - dw address ;; Dispatch address for command - - endif ;enable - - endm ;command - -; End Z33MAC.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/WW.Z3T b/Source/BPBIOS/WW.Z3T deleted file mode 100644 index 004cc957..00000000 Binary files a/Source/BPBIOS/WW.Z3T and /dev/null differ diff --git a/Source/BPBIOS/Z34RCP11/Build.cmd b/Source/BPBIOS/Z34RCP11/Build.cmd deleted file mode 100644 index 1323b95f..00000000 --- a/Source/BPBIOS/Z34RCP11/Build.cmd +++ /dev/null @@ -1,11 +0,0 @@ -@echo off -setlocal - -set PATH=%PATH%;..\..\..\Tools\zx;..\..\..\Tools\cpmtools; - -set ZXBINDIR=../../../tools/cpm/bin/ -set ZXLIBDIR=../../../tools/cpm/lib/ -set ZXINCDIR=../../../tools/cpm/include/ - -rem zx Z80ASM -z34rcp11/MF -zx ZMAC -z34rcp11.z80 -/P diff --git a/Source/BPBIOS/Z34RCP11/Clean.cmd b/Source/BPBIOS/Z34RCP11/Clean.cmd deleted file mode 100644 index a088f4e8..00000000 --- a/Source/BPBIOS/Z34RCP11/Clean.cmd +++ /dev/null @@ -1,7 +0,0 @@ -@echo off -setlocal - -if exist *.prn del *.prn -if exist *.lst del *.lst -if exist *.err del *.err -if exist *.rel del *.rel diff --git a/Source/BPBIOS/Z34RCP11/Makefile b/Source/BPBIOS/Z34RCP11/Makefile deleted file mode 100644 index 7d8b55f8..00000000 --- a/Source/BPBIOS/Z34RCP11/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -OBJECTS = z34rcp11.rel -TOOLS = ../../../Tools -DEST = - -include $(TOOLS)/Makefile.inc diff --git a/Source/BPBIOS/Z34RCP11/cledinst.com b/Source/BPBIOS/Z34RCP11/cledinst.com deleted file mode 100644 index c26a3cf0..00000000 Binary files a/Source/BPBIOS/Z34RCP11/cledinst.com and /dev/null differ diff --git a/Source/BPBIOS/Z34RCP11/cledsave.com b/Source/BPBIOS/Z34RCP11/cledsave.com deleted file mode 100644 index dde04bc1..00000000 Binary files a/Source/BPBIOS/Z34RCP11/cledsave.com and /dev/null differ diff --git a/Source/BPBIOS/Z34RCP11/nzrcp.z80 b/Source/BPBIOS/Z34RCP11/nzrcp.z80 deleted file mode 100644 index 52b844e3..00000000 --- a/Source/BPBIOS/Z34RCP11/nzrcp.z80 +++ /dev/null @@ -1,3010 +0,0 @@ - -; New Name: NZRCP.Z80 Joe Wright July 1987 - -; Program: Z34RCP -; Version: 1.0 -; Description: Resident Command Package (RCP) for ZCPR34 -; Author: Jay Sage -; Date: March 1, 1987 -; Derivation: SYSRCP (Richard Conn) and many other contributions - -; ZCPR34 is copyright 1987 by Jay P. Sage. All rights reserved. End-user -; distribution and duplication permitted for non-commercial purposes only. -; Any commercial use of ZCPR34, defined as any situation where the duplicator -; recieves revenue by duplicating or distributing ZCPR34 by itself or in -; conjunction with any hardware or software product, is expressly prohibited -; unless authorized in writing by Jay P. Sage. - -version equ 2 -subver equ 4 - -; Vers 2.4 - Add whlchk subroutine for indirect addressing of wheel byte. -; 4 Apr 88 - Fixed command list routines. -; Joe Wright - Inhibit SPOP if there is no shell. Allow shstks = 1. - -; Vers 2.3 - Reset command, after calling F37, jumps to 0. -; 22 Feb 88 - -; Vers 2.2 - Modified for use of Z34CMN.LIB and NZ-COM. -; 31 Dec 87 -; Joe Wright - - -; Vers 2.1 - R command uses ZRDOS function 37 to reset drives. -; 6 Sep 87 - WHL command changed, WHLQ disappears. -; Joe Wright - REG command expanded. Add REG E (program error byte) -; - SPOP command added. Pops the shell stack - -;============================================================================= -; -; D E F I N I T I O N S S E C T I O N -; -;============================================================================= - - name ('RCP') - - maclib z34cmn.lib ; Defines ZCPR system addresses - maclib z34defn.lib ; Defines offsets in Z34 command processor - maclib z34mac.lib ; Macros - maclib sysdef.lib ; Common logic, sys, ascii defines - maclib nzrcp.lib ; Defines command options - -;============================================================================= -; -; E N T R Y C O D E S E C T I O N -; -;============================================================================= - -start: - db 'Z3RCP' ; Package ID - - -;---------------------------------------- - -; Command table - - db cmdsize ; Length of each command name - cmdtbl ; Dispatch table from Z33RCP.LIB - db 0 ; Marks end of command jump table - - -;---------------------------------------- - -; Name of RCP - -; This block allows the 'H' command and/or the SHOW utility to display a name -; and version number for this RCP as well as the commands that are supported. - -rcpname: - idstring ; From macro in Z33RCP.LIB - -; Include only those code sections that are required. - -; include rcph ; 'H' help (command list) command - page - -; RCP-H.Z80 'H' Command - -;============================================================================= -; -; H E L P C O M M A N D -; -;============================================================================= - -; This command displays a list of all resident commands that are supported, -; including those in the CPR (command processor), RCP, and FCP. - -clist: - -; Print the CPR-resident command names - - if listcpr - - call print ; Print "CPR" - db lf - db 'CP','R'+80h -; - ld hl,(ccp) ; CCP location from Z3ENV - ld de,offcmd ; Offset to CPR command table - add hl,de - call cmdlist ; Display the list of commands - - endif ;listcpr - -; Print the FCP-resident command names - - if listfcp - - ld hl,(fcp) - ld a,h - or l - jr z,rcplist ; No FCP - - ld a,(hl) - or a - jr z,rcplist ; FCP removed - - call print ; Print header for FCP - db lf - db 'FC','P'+80h - ld de,5 - add hl,de ; Point to FCP command table - call cmdlist - - endif ;listfcp - -; Print the RCP-resident command names - -rcplist: - if listrcp - - call crlf ; Skip a line - ld hl,rcpname ; Print RCP name - call printhl - ld hl,start+5 ; Point to RCP command table - - else - - ret - - endif ;listrcp - - ; Fall through to CMDLIST - -;---------------------------------------- - -; Subroutine to display list of commands in a command table (code above -; falls through to this routine -- do not move it). The commands are -; displayed 5 per line with 8 character spaces allowed for each command -; (subject to equates below). - -cmdlist: - call crlf ; Start with new line - ld e,(hl) ; Get size of each command name into DE - ld d,0 - inc hl ; Point to name of first command - ld c,cmdsline ; Set names-per-line value - -cmdlist1: - ld a,(hl) ; Get first character of the command name - or a ; See if it is null - jr nz,cmdlist1a ; If not, continue - ld a,cmdsline ; See if we are already on a new line - cp c - call nz,crlf ; If not, skip a line - ret - -cmdlist1a: - if noshow ; Option to suppress wheel-limited cmds - rla ; Shift high bit of name into carry bit - jr nc,cmdlist2 ; If not restricted, go on - call whlchk ; Check wheel byte - jr nz,cmdlist2 ; If wheel set, continue as usual - add hl,de ; Otherwise skip this command - jr cmdlist5 - endif - -; Print leading spaces between names - -cmdlist2: - ld a,cmdspace ; Spacing between command names - sub e ; Less length of each command name - ld b,a - ld a,' ' -cmdlist3: - call conout - djnz cmdlist3 - -; Print name of command - - ld b,e ; Length of each name into B -cmdlist4: - ld a,(hl) ; Get command name character - call conout - inc hl ; Point to next - djnz cmdlist4 - - dec c ; Decrement count of names on this line - jr nz,cmdlist5 ; Branch if room for more names - call crlf ; Otherwise, end this line and - ld c,cmdsline ; ..reset count for another line of commands - -; Skip to next command name - -cmdlist5: - inc hl ; Skip jump vector - inc hl - jr cmdlist1 ; Back to process next name - -; End RCP-H.Z80 - -;============================================================================= -; -; P O P S H E L L S T A C K C O M M A N D -; -;============================================================================= - -; -; POP the Shell Stack -; - if spopon - -; Pop the shell stack - -spop: ld hl,(z3env+1eh) ; SHSTK (indirect) - ld a,h - or l - ret z ; No shell stack - - ex de,hl ; SHSTK to DE - ld hl,(z3env+20h) ; SHSTKS to L, SHSIZE to H - push hl ; Save SHSIZE - xor a ; Your basic null in A - ld b,l - dec b ; SHSTKS-1 in B - jr z,sp0a ; Clear one entry - - push de ; Save SHSTK - ld e,h ; SHSIZE to E - ld d,a ; Clear D - ld h,a ; Clear H.. - ld l,a ; ..and L -sp0: add hl,de ; Multiply SHSIZE*(SHSTKS-1) - djnz sp0 - ld b,h - ld c,l ; Length to BC - ex de,hl ; SHSIZE to HL - pop de ; Get SHSTK (destination) - add hl,de ; SHSTK+SHSIZE to HL (Source) - ldir - -sp0a: pop bc ; Get SHSIZE in B -sp1: ld (de),a ; Clear last entry - inc de - djnz sp1 - ret - endif ; SPOPON - - - if clson -; include rcpcls ; 'CLS' clear screen command - page - -; RCP-CLS.Z80 'CLS' Command - -;============================================================================= -; -; C L E A R S C R E E N C O M M A N D -; -;============================================================================= - -; Command: CLS -; Function: To clear the CRT screen -; Comments: The setting of the CLSTCAP equate determines whether this -; command uses the TCAP information or not. If not, it uses the -; clear-screen string passed in macro CLSSTR. That string should -; end with the high bit set. - -cls: - if clstcap ; If using TCAP for clear screen string - - ld a,(z3env+80h) ; Get beginning of tcap - cp ' '+1 ; See if blank or perhaps null - jr nc,cls1 ; If not, go to clear screen code - call print ; If blank, then give error message - db ' No TCA','P'+80h - ret - -cls1: ld hl,z3env+97h ; Point to beginning of clear screen string - jp printhl ; Display it - - else ; Not using tcap - - call print - clsstr ; String from Z33RCP.LIB - ret - - endif ;clstcap - -; End RCP-CLS.Z80 - - endif ;clson - - if reson -; include rcpr ; 'R' disk reset command - page - -; RCP-R.Z80 'R' command - -;============================================================================= -; -; D I S K R E S E T C O M M A N D -; -;============================================================================= - -; Command: RESET -; Function: Reset the disk system -; Comments: ZRDOS does not require a disk system reset when disks are -; changed, but directory programs will not show the correct -; size if this is not done. It is also good practice. Since -; no warm boot performed, the disk in drive A need not have the -; operating system on it. -; Ver 2.1 Now logs all drives off and forces fixed and ram disks to -; re-log. -reset: - if resmsg ; If displaying a reset message - call print ; Report action - dc ' Reset' - endif ;resmsg - - ld de,-1 ; All 16 drives - ld c,37 ; Disks reset ZRDOS function - call bdos - ld c,13 ; Reset disk system - jp bdos - -; End RCP-R.Z80 - - endif ;reson - - if tston -; include rcptst ; 'TST' error test command - page - -; RCP-TST.Z80 'TST' Command - -;============================================================================= -; -; E R R O R T E S T C O M M A N D -; -;============================================================================= - -; Command: TST -; Function: To set the message buffer program error flag based on -; error count reported by M80 or L80 -; Syntax: TST PN where PN is (at least) the first letter of M80 or L80 - -testerr: - -; Check for name of program to test - - ld a,(fcb1+1) ; Get first character in program name - - if testm80 - ld hl,m80f ; Preset for m80 test counts - ld de,m80w - cp 'M' - jr z,testcount - endif ; Testm80 - - if testf80 - ld hl,f80f - ld de,f80w - cp 'F' - jr z,testcount - endif ; Testf80 - -; If no match, give error message - - call print - db 'bad nam','e'+80h - -testcount: - ld a,(hl) ; Test first error count word - inc hl - or (hl) - ex de,hl ; Test second word - or (hl) - inc hl - or (hl) - ld hl,z3msg+6 ; Point to program error flag - ld (hl),0 ; Clear it - ret z ; If counts were zero, we are done - ld (hl),0ffh ; Else set the error flag - ret - -; End RCP-TST.Z80 - - endif ;tston - - if spaceon -; include rcpsp ; 'SP' space on disk command - page - -; RCP-SP.Z80 'SP' Command - -;============================================================================= -; -; D I S K S P A C E C O M M A N D -; -;============================================================================= - -; Command: SP -; Function: Shows space remaining on designated drive -; Syntax: SP [DIR:|DU:] -; Comments: This code can be called by several other RCP commands so that -; they can show the space remaining on the disk after their -; operation. - - if [erasp or cpsp or dirsp] -crspace: ; Used to call space after other subroutines - call crlf ; Start new line - endif ;[erasp or cpsp or dirsp] - -space: - ld a,(fcb1) ; Determine requested drive - or a ; If drive explicitly selected - jr nz,space1 ; ..then skip - - ld c,25 ; BDOS get current drive function - call bdos - inc a ; Shift to range 1..16 - -space1: - dec a ; Shift to range 0..15 - ld e,a ; Save in E for selecting disk below - add 'A' ; Convert to letter and - ld (seldrv),a ; save in message string below - ld c,14 ; BDOS select disk function - call bdos ; Not needed if no drive selected, but smallest - ; ..possible code size this way. - -; Here we extract the following disk parameter information from the disk -; parameter block (DPB): -; BLKSHF: block shift factor (1 byte) -; BLKMAX: max number of blocks on disk (2 bytes) - -dparams: - ld c,31 ; BDOS get disk parameters function - call bdos - inc hl ; Advance to block shift factor byte - inc hl - ld a,(hl) ; Get value and - ld (blkshf),a ; ..save it in code below - inc hl ; Advance to max block number word - inc hl - inc hl - ld e,(hl) ; Get value into HL - inc hl - ld d,(hl) - inc de ; Add 1 for max number of blocks - -; Compute amount of free space left on disk - -dfree: - ld c,27 ; BDOS get allocation vector function - push de ; Save BLKMAX value - call bdos ; Get allocation vector into HL - ld b,h ; Copy allocation vector to BC - ld c,l - pop hl ; Restore MAXBLK value to HL - ld de,0 ; Inititialize count of free blocks - -; At this point we have -; BC = allocation vector address -; DE = free block count -; HL = number of blocks on disk - -free1: - push bc ; Save allocation address - ld a,(bc) ; Get bit pattern of allocation byte - ld b,8 ; Set to process 8 blocks -free2: - rla ; Rotate allocated block bit into carry flag - jr c,free3 ; If set (bit=1), block is allocated - inc de ; If not set, block is not allocated, so - ; ..increment free block count -free3: - ld c,a ; Save remaining allocation bits in C - dec hl ; Count down number of blocks on disk - ld a,l ; See if we are down to zero - or h - jr z,free4 ; Branch if no more blocks to check - ld a,c ; Get back current allocation bit pattern - djnz free2 ; Loop through 8 bits - pop bc ; Get pointer to allocation vector - inc bc ; Point to next allocation byte - jr free1 ; Continue by processing next allocation byte - -free4: - pop bc ; Clean up stack - ex de,hl ; Free block count to HL -blkshf equ $+1 ; Pointer for in-the-code modification - ld a,0 ; Get block shift factor - sub 3 ; Convert to log base 2 of K per block - jr z,free6 ; Done if single density (1k per block) - -; Convert for blocks of more than 1K each - -free5: - add hl,hl - dec a - jr nz,free5 - -; At this point HL = amount of free space on disk in K - -free6: - call print - db ' Space on ' -seldrv: db 0 ; Modified above to contain drive letter - db ':',[' '+80h] - -; Display decimal value of HL - - ld b,0 ; Initialize count of digits already printed - ld de,10000 ; Divisor in DE - call decdsp ; Print digit (or space if leading '0') - ld de,1000 - call decdsp - call decdsp3 ; Display hundreds, tens, and units - ld a,'K' - jp conout ; Final return from space routine - -; End RCP-SP.Z80 - - endif ;spaceon - - if diron -; include rcpdir ; 'DIR' directory command - page - -; RCP-DIR.Z80 'DIR' Command - -;============================================================================= -; -; D I R E C T O R Y D I S P L A Y C O M M A N D -; -;============================================================================= - -; Command: DIR -; Function: Display a directory of the files on disk -; Syntax: DIR Displays the DIR files -; DIR S Displays the SYS files -; DIR A Display both DIR and SYS files -; DIR /S Equivalent to DIR *.* S -; DIR /A Equivalent to DIR *.* A - -dir: - call retsave ; Save return address and set stack - -; See if FCB should be made wild (all '?') - - ld hl,fcb1+1 ; Point to file name in FCP - ld a,(hl) ; Get first character of filename - - if slashchk ; Allow "DIR /S" and "DIR /A" formats - cp '/' ; If name does not start with '/' - jr nz,dir01 ; ..branch and process normally - inc hl ; Point to second character - ld a,(hl) ; Get option character after slash - ld (fcb2+1),a ; ..and put it into second FCB - dec hl ; Back to first character - ld a,' ' ; Simulate empty FCB - endif ;slashchk - -dir01: - ld b,11 ; Prepare to fill FCB name and type with '?' - cp ' ' ; See if no file spec given - ld a,'?' ; Get ready to fill with '?' - call z,fillp ; ..carry out fill - - if nosys ; Suppress-SYS-file-if-no-wheel option - call whlchk ; Check wheel byte - jr z,dirnly ; If wheel off, ignore options - endif - - ld a,(fcb2+1) ; Get first char of 2nd file name - ld b,1 ; Set for both dir and sys files - cp allflag ; SYS and DIR flag specifier? - jr z,dirpr ; Got system specifier - dec b ; B=0 for sys files only - cp sysflag ; SYS only? - jr z,dirpr - -dirnly: ld b,80h ; Must be dir-only selection - -; DIRECTORY PRINT ROUTINE; ON ENTRY, B REG IS SET AS FOLLOWS: -; 0 FOR ONLY SYSTEM FILES, 80H FOR ONLY DIR FILES, 1 FOR BOTH -; -dirpr: - ld a,b ; Get systst flag - call getdir ; Load and sort directory - jp z,prfnf ; Print no file message - ld e,width ; Count down to 0 -; -; ENTRY PRINT LOOP; ON ENTRY, HL PTS TO FILES SELECTED (TERMINATED BY 0) -; AND E IS ENTRY COUNTER -; -dir3: - ld a,(hl) ; Check for done - or a - if dirsp and spaceon - jp z,spaexit ; Show space when done - else - jp z,exit ; Exit if done - endif ; Dirsp and spaceon - ld a,e ; Get entry counter - or a ; Output if 4 entries printed in line - jr nz,dir3a ; Continue - call crlf ; New line - ld e,width ; Reset entry count - ld a,e ; Get entry count -dir3a cp width ; First entry? - jr z,dir4 - call print -; - if wide -; - db ' ' ; 2 spaces - db fence ; Then fence char - db ' '+80h ; Then 1 more space -; - else -; - db ' ' ; Space - db fence+80h ; Then fence char -; - endif ; Wide -; -dir4: - call prfn ; Print file name - call break ; Check for abort - dec e ; Decrement entry counter - jr dir3 - -; End RCP-DIR.Z80 - - endif ;diron - - if eraon -; include rcpera ; 'ERA' erase command - page - -; RCP-ERA.Z80 'ERA' Command - -;============================================================================= -; -; E R A S E C O M M A N D -; -;============================================================================= - -;Command: ERA -;Function: Erase files -;Forms: -; ERA Erase Specified files and print their names -; ERA I Erase Specified files and print their names, but ask -; for verification before Erase is done - -era: - call retsave - ld a,(fcb2+1) ; Get eraflg if it's there - ld (eraflg),a ; Save it as a flag - ld a,1 ; Dir files only - call getdir ; Load directory of files - jp z,prfnf ; Abort if no files -; -; MAIN ERASE LOOP -; -era1: - call break ; See if user wants to stop - push hl ; Save ptr to file - call prfn ; Print its name - ld (nxtfile),hl ; Save ptr to next file - pop hl ; Get ptr to this file - call rotest ; Test file pted to by hl for r/o - jr nz,era3 -eraflg equ $+1 ; Address of flag - ld a,0 ; 2nd byte is flag - cp 'I' ; Is it an inspect option? - jr nz,era2 ; Skip prompt if it is not - call eraq ; Erase? - jr nz,era3 ; Skip if not -era2: - ld de,fcb1+1 ; Copy into fcb1 - ld b,11 ; 11 bytes - call blkmov - call initfcb1 ; Init fcb - ld c,19 ; Delete file - call bdos -era3: - ld hl,(nxtfile) ; Hl pts to next file - ld a,(hl) ; Get char - or a ; Done? - if erasp and spaceon - jp z,spaexit - else - jp z,exit - endif ; Erasp and spaceon - call crlf ; New line - jr era1 - -; End RCP-ERA.Z80 - - endif ;eraon - - if lton -; include rcplt ; 'LIST' and 'TYPE' commands - page - -; RCP-LT.Z80 - -;============================================================================= -; -; L I S T A N D T Y P E C O M M A N D S -; -;============================================================================= - -;Command: LIST -;Function: Print out specified file on the LST: Device -;Forms: -; LIST Print file (NO Paging) -;Notes: -; The flags which apply to TYPE do not take effect with LIST - - if liston -list: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED - - - call retsave - ld a,0ffh ; Turn on printer flag - jr type0 - endif ;liston - -;Command: TYPE -;Function: Print out specified file on the CON: Device -;Forms: -; TYPE Print file -; TYPE P Print file with paging flag -;Notes: -; The flag PGDFLG defines the letter which toggles the paging -; facility (P in the forms section above) -; The flag PGDFLT determines if TYPE is to page by default -; (PGDFLT=TRUE if TYPE pages by default); combined with -; PGDFLG, the following events occur -- -; If PGDFLT = TRUE, PGDFLG turns OFF paging -; If PGDFLT = FALSE, PGDFLG turns ON paging -; -type: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; -; - call retsave - xor a ; Turn off printer flag -; -; ENTRY POINT FOR CPR LIST FUNCTION (LIST) -; -type0: - if liston - ld (prflg),a ; Set flag - endif ; Liston - - ld a,(fcb2+1) ; Get page flag - ld (pgflg),a ; Save it as a flag - ld a,1 ; Select dir files - call getdir ; Allow ambiguous files (HL points to buffer) - jp z,prfnf ; No files - jr typex2 - - ; Entry point for successive files -typex: - ld hl,(nxtfile) ; Get ptr to next file - ld a,(hl) ; Any files? - or a - jp z,exit - - if liston - ld a,(prflg) ; Check for list output - or a ; 0=type - jr z,typex1 - ld a,cr ; Bol on printer - call lcout - ld a,ff ; Form feed the printer - call lcout - jr typex2 - endif ; Liston - -typex1: -; LDA PAGCNT ; If we've just done so, - push hl - ld hl,(pagcnt) - ld a,(hl) - pop hl - cp nlines-2 ; Don't type another - call nz,pagebreak ; Page break message -typex2: - ld de,fcb1+1 ; Copy into fcb1 - ld b,11 ; 11 bytes - call blkmov - ld (nxtfile),hl ; Set ptr to next file - call initfcb1 ; Init fcb1 - ld c,15 ; Open file - call bdos - inc a ; Set error flag - jp z,prfnf ; Abort if error -; MVI A,NLINES-2 ; Set line count -; STA PAGCNT - ld hl,(pagcnt) - ld (hl),nlines-2 - ld a,cr ; New line - call lcout - ld a,lf - call lcout - ld bc,080h ; Set char position and tab count - ; (b=0=tab, c=080h=char position) -; -; MAIN LOOP FOR LOADING NEXT BLOCK -; -type2: - ld a,c ; Get char count - cp 80h - jr c,type3 -; PUSH H ; Read next block - push bc - ld de,fcb1 ; Pt to fcb - ld c,20 ; Read record - call bdos - or a ; Set flags - pop bc -; POP H - jr nz,typex ; End of file? - ld c,0 ; Set char count - ld hl,tbuff ; Pt to first char -; -; MAIN LOOP FOR PRINTING CHARS IN TBUFF -; -type3: - ld a,(hl) ; Get next char - and 7fh ; Mask out msb - cp 1ah ; End of file (^z)? - jr z,typex ; Next file if so -; -; OUTPUT CHAR TO CON: OR LST: DEVICE WITH TABULATION -; - cp cr ; Reset tab count? - jr z,type4 - cp lf ; Reset tab count? - jr z,type4 - cp tab ; Tab? - jr z,type5 -; -; OUTPUT CHAR AND INCREMENT CHAR COUNT -; - call lcout ; Output char - inc b ; Increment tab count - jr type6 -; -; OUTPUT OR AND RESET TAB COUNT -; -type4: - call lcout ; Output or - ld b,0 ; Reset tab counter - jr type6 -; -; TABULATE -; -type5: - ld a,' ' ; - call lcout - inc b ; Incr pos count - ld a,b - and 7 - jr nz,type5 -; -; CONTINUE PROCESSING -; -type6: - inc c ; Increment char count - inc hl ; Pt to next char - call break ; Check for abort - jp z,typex ; Skip - jr type2 -; -; SEND OUTPUT TO LST: OR CON:, AS PER THE FLAG -; RETURN WITH Z IF ABORT -; -lcout: - push hl ; Save regs - push bc - ld e,a ; Char in e - ld c,2 ; Output to con: - if liston -prflg equ $+1 ; Pointer for in-the-code modification - ld a,0 ; 2nd byte is the print flag - or a ; 0=type - jr z,lc1 - ld c,5 ; Output to lst: - endif ; Liston - -lc1: - push de ; Save char - call bdos ; Output char in e - pop de ; Get char - ld a,e - cp lf - jr nz,lc2 - if liston - ld a,(prflg) ; Output to lst:? - or a ; Nz = yes - jr nz,lc2 - endif ; Liston -; -; CHECK FOR PAGING -; -; LXI H,PAGCNT ; Count down - ld hl,(pagcnt) - dec (hl) - jr nz,lc2 ; Jump if not end of page - ld (hl),nlines-2 ; Refill counter -pgflg equ $+1 ; Pointer to in-the-code buffer - ld a,0 ; 2nd byte is the paging flag - cp pgdflg ; Page default override option wanted? -; - if pgdflt ; If paging is default -; - jr z,lc2 ; Pgdflg means no paging -; - else -; - jr nz,lc2 ; Pgdflg means page -; - endif ; Pgdflt -; - call pagebreak ; Print page break message - jp z,typex ; Z to skip -lc2: - pop bc ; Restore regs - pop hl - ret -; -; PRINT PAGE BREAK MESSAGE AND GET USER INPUT -; ABORT IF ^C, RZ IF ^X -; -pagebreak: - push hl ; Save hl - call print - db cr,lf,' Typing',' '+80h - ld hl,fcb1+1 ; Print file name - call prfn - call dash ; Print dash - call conin ; Get input - pop hl ; Restore hl - push af - call crlf ; New line - pop af - jp break1 -; -; End RCP-LT.Z80 - - endif ;lton - - if renon -; include rcpren ; 'REN' rename command - page - -; RCP-REN.Z80 - -;Section 5E -;Command: REN -;Function: To change the name of an existing file -;Forms: -; REN = Perform function -; -ren: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; - - call retsave -; -; -; STEP 1: CHECK FOR FILE 2 BEING AMBIGUOUS -; - ld hl,fcb2+1 ; Can't be ambiguous - call ambchk1 -; -; STEP 2: LOG INTO USER AREA -; - call logusr ; Log into user area of fcb1 -; -; STEP 3: SEE IF OLD FILE IS R/O -; - ld hl,fcb1 ; Pt to 1st fcb - push hl - ld de,fcb2 ; Pt to 2nd file - push de ; Save ptr - ld a,(hl) ; Get 1st's drive - ld (de),a ; Stuff into second fcb - ld c,17 ; Look for file - call bdos - inc a - jp z,prfnf - call getsbit ; Get ptr to entry in tbuff - ex de,hl ; Hl pts to entry - inc hl ; Pt to fn - call rotest ; See if file is r/o - jp nz,exit -; -; STEP 4: SEE IF NEW FILE ALREADY EXISTS -; EXTEST PERFORMS A NUMBER OF CHECKS: -; 1) AMBIGUITY -; 2) R/O -; 3) IF FILE EXISTS AND NOT R/O, PERMISSION TO DELETE -; - call extest - jp z,exit ; R/o or no permission -; -; STEP 5: EXCHANGE FILE NAME FIELDS FOR RENAME -; - pop de ; Pt to old - pop hl ; Pt to new - push hl ; Save ptr - ld b,12 ; 12 bytes - call iswap1 -; -; STEP 6: RENAME THE FILE -; - pop de ; Get ptr to fcb - ld c,23 ; Rename - call bdos - inc a ; Set zero flag if error - jp z,prfnf ; Print no source file message - jp exit -; -; -; End RCP-REN.Z80 - - endif ;renon - - if proton -; include rcpprot ; 'PROT' file attribute setting command - page - -; RCP-PROT.Z80 - -;Section 5F -;Command: PROT -;Function: To set the attributes of a file (R/O and SYS) -; -;Form: -; PROT afn RSI -;If either R or S are omitted, the file is made R/W or DIR, resp; -;R and S may be in any order. If I is present, Inspection is enabled. - -att: - call retsave - xor a ; Set no inspect - ld (inspect),a - ld hl,0 ; Set r/o and sys attributes off - ld de,fcb2+1 ; Pt to attributes - ld b,3 ; 3 chars max -att1: - ld a,(de) ; Get char - inc de ; Pt to next - cp 'I' ; Inspect? - jr z,atti - cp 'R' ; Set r/o? - jr z,attr - cp 'S' ; Set sys? - jr z,atts -att2: - djnz att1 - jr att3 -atti: - ld (inspect),a ; Set flag - jr att2 -attr: - ld h,80h ; Set r/o bit - jr att2 -atts: - ld l,80h ; Set sys bit - jr att2 -att3: - ld (fatt),hl ; Save file attributes - ld a,1 ; Select dir and sys files - call getdir ; Load directory - jp z,prfnf ; No file error - jr att5 -att4: - ld hl,(nxtfile) ; Pt to next file - ld a,(hl) ; End of list? - or a - jp z,exit - call crlf ; New line -att5: - call break ; Check for possible abort - push hl ; Save ptr to current file - call prfn ; Print its name - ld (nxtfile),hl ; Save ptr to next file - call print - db ' Set to R','/'+80h - ld hl,(fatt) ; Get attributes - ld c,'W' ; Assume r/w - ld a,h ; Get r/o bit - or a - jr z,att6 - ld c,'O' ; Set r/o -att6: - ld a,c ; Get char - call conout - ld a,l ; Get sys flag - or a ; Set flag - jr z,att7 - call print - db ' and SY','S'+80h -att7: -inspect equ $+1 ; Ptr for in-the-code modification - ld a,0 ; Get inspect flag - or a ; Z=no - pop hl ; Get ptr to current file - jr z,att8 - call eraq1 ; Ask for y/n - jr nz,att4 ; Advance to next file if not y -att8: - ld de,fcb1+1 ; Copy into fcb1 - ld b,11 ; 11 bytes - call blkmov -fatt equ $+1 ; Ptr for in-the-code modification - ld hl,0 ; Get attributes - dec de ; Pt to sys byte - dec de - ld a,l ; Get sys flag - call attset ; Set attribute correctly - dec de ; Pt to r/o byte - ld a,h ; Get r/o flag - call attset - ld de,fcb1 ; Pt to fcb - ld c,30 ; Set attributes - call bdos - jr att4 -attset: - or a ; 0=clear attribute - jr z,attst1 - ld a,(de) ; Get byte - or 80h ; Set attribute - ld (de),a - ret -attst1: - ld a,(de) ; Get byte - and 7fh ; Clear attribute - ld (de),a - ret -; -; End RCP-PROT.Z80 - - endif ;proton - - if cpon -; include rcpcp ; 'CP' file copying command - -; RCP-CP.Z80 - -;============================================================================= -; -; F I L E C O P Y C O M M A N D -; -;============================================================================= - -; Command: CP -; Function: Copy a file from one place to another -; Syntax: CP destfile=srcfile -; CP srcfile -; Comments: Both file specifications can include a directory specification. -; If only one file name is given, then the current directory and -; the source file name are assumed for the destination. - -copy: - call retsave - -; If new is blank, make it the same name and type as old - - ld de,fcb1+1 ; Point to destination file name - ld a,(de) ; Get first character - cp ' ' ; If not blank (no name) - jr nz,copy0 ; ..then branch to copy - - ld hl,fcb2+1 ; Copy source name into destination FCB - ld b,11 ; Name and type are 11 bytes - call blkmov - -; See if destination is same as source, and abort if so - -copy0: - ld hl,fcb1 ; Set up pointers to two files - ld de,fcb2 - push hl - push de - inc hl ; Point to names of files - inc de - ld b,13 ; Compare 13 bytes (name, type, and user #) -copy1: - call comp - jr nz,copy2 ; If they differ, go on with copy - - ld c,25 ; Get-current-disk BDOS function - call bdos ; Get it in case no drive given explicitly - inc a ; Shift to range 1..16 - ld b,a ; ..and keep value in B - pop de ; Restore pointers to FCBs - pop hl - ld a,(de) ; Get drive of source file - ld c,a ; ..and save it in C - or a ; Is it default drive? - jr nz,copy1a ; Branch if drive made explicit - ld c,b ; Otherwise, copy default drive into C -copy1a: - ld a,(hl) ; Get drive of destination file - or a ; Is it default drive? - jr nz,copy1b ; Branch if drive made explicit - ld a,b ; Otherwise, get current drive -copy1b: - cp c ; Compare the two drives specified - jr nz,copy3 ; Branch if they are different - jr cperr ; Branch to error code if they are the same - -copy2: - pop de ; Clean up the stack - pop hl - -; Make note of the user numbers of the two files - -copy3: - ld a,(fcb1+13) ; Get destination user number - ld (usrdest),a - ld a,(fcb2+13) ; Get source user number - ld (usrsrc),a - -; Set up new FCB for source file and open the source - - call define ; Define buffer addresses dynamically - ld hl,(srcfcb) ; Get address to use for new source FCB - push hl - ex de,hl ; Copy file data to new FCB - ld b,12 - call blkmov - call logsrc ; Log in user number of source file - pop hl ; Initialize the source file FCB - call initfcb2 - ld c,15 ; Open file - call bdos - inc a ; Check for error - jp z,prfnf ; Branch if file not found - -; Make sure destination file does not already exist - - call logdest ; Log into destination s user area - call extest ; Test for existence of file - jp z,exit ; Branch if it exists - -; Create destination file - - ld de,fcb1 ; Point to destination FCB - ld c,22 ; BDOS make-file function - call bdos - inc a ; Test for error (no directory space) - jr nz,copy5 ; Branch if OK - -; Report file error - -cperr: - call print - db ' Copy','?'+80h - jp exit - -; Copy source to destination with buffering - -;++++++++++ this should be done by changing DMA address to save all the -; buffer swapping - -copy5: - call logsrc ; Log in source user area - ld b,0 ; Initialize counter - ld hl,(cbuff) ; Initialize buffer pointer - -copy5a: - push hl ; Save address and counter - push bc - ld hl,(srcfcb) ; Point to source file FCB - ex de,hl ; Put it in DE for BDOS call - ld c,20 ; BDOS read-sequential function - call bdos - pop bc ; Get counter and address - pop de - or a ; Read Ok? - jr nz,copy5b ; Branch if end of file - - push bc ; Save counter - ld hl,tbuff ; Copy from 80h to buffer - ld b,128 ; 128 bytes - call blkmov - ex de,hl ; HL points to next buffer address - pop bc ; Get counter back - inc b ; Increment it - ld a,b ; See if buffer full - cp cpblocks - jr nz,copy5a ; If not, go back for more - -copy5b: - ld a,b ; Get count of blocks loaded into buffer - or a ; Are there any? - jr z,copy6 ; Branch if not (we are done) - - push bc ; Save count - call logdest ; Log into destination user number -cbuff equ $+1 ; Pointer for in-the-code modification - ld hl,0 ; Point to beginning of copy buffer -copy5c: - ld de,tbuff ; Copy into tbuff - ld b,128 ; 128 bytes - call blkmov - push hl ; Save pointer to next block - ld de,fcb1 ; Point to destination file FCB - ld c,21 ; Write the block - call bdos - or a - jr nz,cperr ; Branch on error (disk full of write error) - pop hl ; Get back pointer to next block - pop bc ; Get count -; djnz copy5 ; Work through the blocks - dec b ; - jr z,copy5 ; - push bc ; Save count - jr copy5c ; Back for another bufferful - -; Close the destination file - -copy6: - call logdest ; Log into destination user number - ld de,fcb1 ; Point to destination FCB - ld c,16 ; Close file - call bdos - call print - db ' Don','e'+80h - - if cpsp and spaceon - jp spaexit ; Report space remaining on destination drive - else - jp exit - endif ;cpsp and spaceon - -; Log into user number of source file - -logsrc: -usrsrc equ $+1 ; Pointer for in-the-code modification - ld a,0 ; Get user number - jr setusrrel ; Local jump to save code - -; Log into user number of destination file - -logdest: -usrdest equ $+1 ; Pointer for in-the-code modification - ld a,0 ; Get user number -setusrrel: - jp setusr - -; End RCP-CP.Z80 - - endif ;cpon - - if peekon or pokeon or porton -; include rcpiom ; 'PEEK', 'POKE', 'PORT' commands - page - -; RCP-IOM.Z80 - -; Command: PEEK -; Function: Display memory contents -; -; Form: -; PEEK startadr 256 bytes displayed -; PEEK startadr endadr range of bytes displayed - - if peekon - -peek: - call retsave - - ld hl,tbuff+1 ; Find first number -nxtpeek equ $+1 ; Pointer for in-the-code modification - ld de,100h ; Default peek address if none - call sksp ; Skip to first token (if any) - call nz,hexnum ; Get start address if any - - push de ; Save starting address - ld bc,255 ; Compute default ending address - ex de,hl - add hl,bc - - if peekchk ; Check for overflow - jr nc,peek0 ; If no overflow past FFFF, go on - ld hl,0ffffh ; Else use FFFF as ending address -peek0: - endif ;peekchk - - ex de,hl ; End address in DE - call sksp ; Skip to next token (if any) - call nz,hexnum ; Get 2nd number in DE (else default) - -peek1: - pop hl ; HL is start address, DE is end address - - if peekhdr - - push hl ; Save starting address again - ld b,8 ; Output leading spaces -peek0a: - call print - db ' '+80h - djnz peek0a - - ld b,16 ; Display 16 column headers -peek0b: - ld a,l - and 03h - call z,spac - - call spac - call spac - ld a,l ; Get low byte of address - and 0fh ; Display low hex digit - call pah - inc hl - djnz peek0b - - if peekbdr - call crlf - ld b,8 -peek0c: - call print - db ' '+80h - djnz peek0c - ld b,16 -peek0d: - ld a,l - and 3 - call z,spac - inc l - call print - db ' -', '-'+80h - djnz peek0d - endif ;peekbdr - - pop hl ; Restore starting address - - endif ;peekhdr - - ld c,0ffh ; Use C as continue flag - call peek2 ; Do peek - ld (nxtpeek),hl ; Set continued peek address - jp exit - -peek2: - ld a,c ; Check continuation flag - or a ; - ret z ; - -; Print line header - -peek2a: - call crlf ; New line - ld a,h ; Print address - call pashc - ld a,l - call pahc - call dash ; Print leader - ld b,16 ; 16 bytes to display - push hl ; Save start address - - ; Print hex values for 16 bytes - -peek3: - ld a,l - and 03h - call z,spac - - ld a,(hl) ; Get next byte - call pashc ; Print with leading space - - ; Check for last address - ; If c is already 0, leave it that way. - ; Otherwise check for end address and if so - ; Set c to zero. - - ld a,c ; See if continue flag already cleared - or a - jr z,peek3a ; If so, skip test - ld a,h - sub a,d ; See if h = d - ld c,a - ld a,l - sub a,e ; See if l = e - or c ; Combine two tests - ld c,a - -peek3a: inc hl ; Pt to next - djnz peek3 - - ; Print ascii equivalents for 16 bytes - - pop hl ; Pt to first address again - ld b,16 ; 16 bytes - call print ; Space and fence - db ' ' - db fence+80h - push bc ; Save flag in c -peek4: - ld a,(hl) ; Get next byte - ld c,'.' ; Assume dot - and 7fh ; Mask it - cp ' ' ; Dot if less than space - jr c,peek5 - cp 7fh ; Don't print del - jr z,peek5 - ld c,a ; Char in c -peek5: - ld a,c ; Get char - call conout ; Send it - inc hl ; Pt to next - djnz peek4 - - call print ; Closing fence - db fence+80h - pop bc ; Get flag in c back - call break ; Allow abort - jr peek2 - - endif ; Peekon -; -; PRINT A AS 2 HEX CHARS -; PASHC - LEADING SPACE -; - if peekon or [pokeon and not pokeq] or porton -pashc: - push af ; Save a - call spac - pop af -pahc: - push af - rrca ; Exchange nybbles - rrca - rrca - rrca - call pah ; Print hex char - pop af -pah: - and 0fh ; Mask - add a,'0' ; Convert to ascii - cp '9'+1 ; Letter? - jr c,pah1 - add a,7 ; Adjust to letter -pah1: - jp conout -; - endif ; Peekon or [pokeon and not pokeq] or porton -; -;Section 5I -;Command: POKE -;Function: Place Values into Memory -; -;Form: -; POKE startadr val1 val2 ... -; - if pokeon -poke: - call retsave - ld hl,tbuff+1 ; Pt to first char - call sksp ; Skip to non-blank - jr z,noargs ; Arg error - call hexnum ; Convert to number - - if not pokeq - call print - db ' Pok','e'+80h - call adrat ; Print at message - endif - -; LOOP FOR STORING HEX VALUES SEQUENTIALLY VIA POKE - -poke1: - push de ; Save address - call sksp ; Skip to non-blank - jp z,exit ; Done - cp '"' ; Quoted text? - jr z,poke2 - call hexnum ; Get number - ld a,e ; Get low - pop de ; Get address - ld (de),a ; Store number - inc de ; Pt to next - jr poke1 -; -; STORE ASCII CHARS -; -poke2: - pop de ; Get next address - inc hl ; Pt to next char -poke3: - ld a,(hl) ; Get next char - or a ; Done? - jp z,exit - ld (de),a ; Put char - inc hl ; Pt to next - inc de - jr poke3 - - endif ; Pokeon -; -; No Argument Error -; - - if pokeon or porton - -noargs: - call print - db ' Arg','?'+80h - jp exit -; - endif ; Pokeon or porton - -; -;Section 5I+ -;Command: PORT -;Function: Display or Set I/O Port Data -; -;Form: -; PORT addr - read port and display value -; PORT addr value - output value to port -; - if porton -port: - call retsave - ld hl,tbuff+1 ; Find first number - call sksp ; Skip to first command-line token - jr z,noargs ; Abort if no port address given - call hexnum ; Get start address into de - push hl ; Save pointer to command tail - ld hl,portaddr ; Modify code - ld (hl),e ; Move specified port addr into place - dec hl ; Point to opcode position - ld (hl),0dbh ; Poke 'in' opcode - ex (sp),hl ; Get tail pointer back while saving this one - call print ; Print header - db ' Por','t'+80h - ld a,e - call pashc ; Print port address - call sksp ; Skip to possible second value - jr z,portin ; Proceed with port input - - call hexnum ; Get 2nd number in de - ex (sp),hl ; Get pointer to opcode back - ld (hl),0d3h ; Poke 'out' opcode - call print - db ': OU','T'+80h - ld a,e ; Get value to output - jr paddr - -portin: call print - db ': I','N'+80h - xor a ; Make sure high port address = 0 (for HD64180) -paddr: ld b,0 ; ..for both IN and OUT instructions -opcode: - db 0 ; Opcode for IN or OUT inserted by code above -portaddr: - db 0 ; Port address inserted by code above - call pashc - pop hl ; Clean up stack - jp exit - - endif ; Porton - -; End RCP-IOM.Z80 - - endif ;peekon or pokeon or porton - - if regon -; include rcpreg ; 'REG' register operation commands - page - -; RCP-REG.Z80 - -; -;Section 5J -;Command: REG -;Function: Manipulate Memory Registers -; -;Forms: -; REG D or REG <-- Display 10 Register Values -; REG Mreg <-- Decrement Register Value -; REG Preg <-- Increment Register Value -; REG Sreg value <-- Set Register Value -; -; Vers 2.1 Joe Wright -; -; REG reg <-- Display a single register value -; -; REG numbers now range from 0 to 31, although only the first ten are -; displayed with REG D. -; -; REG now treats the program error byte as register E. -; -register: - ld de,fcb1+2 ; Pt to first arg - ld a,(de) ; Get possible digit - call regptr ; Pt HL to potential register - dec de ; Point to command - ld a,(de) - cp 'S' ; Set? - jr z,rset - cp 'P' ; Plus? - jr z,rinc - cp 'M' ; Minus? - jr z,rdec - cp ' ' - jr z,rshow - cp 'D' - jr z,rshow - call regptr - jp regout - -; INCREMENT REGISTER VALUE -; HL PTS TO MEMORY REGISTER ON INPUT - -rinc: - inc (hl) ; Increment it - jr regout ; Print result - -; DECREMENT REGISTER VALUE -; HL PTS TO MEMORY REGISTER ON INPUT - -rdec: - dec (hl) ; Decrement value - jr regout ; Print result - -; Show first ten registers and Program Error byte -; -rshow: - call rshow10 - ld hl,z3msg+6 - jp regout - -rshow10: - xor a ; Select register 0 - ld b,a ; Counter set to 0 in B - call regp1 ; HL pts to register 0 -rshow1: - ld a,b ; Get counter value - cp 10 ; First ten registers - ret z ; Exit if done - push bc ; Save counter - push hl ; Save pointer - call regout ; Print register value - pop hl ; Get pointer - pop bc ; Get counter - inc b ; Increment counter - ld a,b ; Check for new line - and 3 - call z,crlf ; Newline after fourth display - inc hl ; Pt to next register - jr rshow1 - -; SET REGISTER VALUE -; HL PTS TO REGISTER ON INPUT - -rset: - ld de,fcb2+1 ; Pt to value - call de2bin ; Eval string at DE to binary in B - ld (hl),b ; Set value - -; Enter with HL pointing to the register. HL is maintained. -; -regout: - call print - db ' Reg',' '+80h - ld de,z3msg+30h ; Register 0 - sbc hl,de ; Register number in HL - ld a,l - cp 32 ; A numbered Register? - jr c,rego0 ; Yep - call print - db ' ','E'+80h - jr rego1 ; Report - -rego0: push hl - push de - ld b,0 ; Suppress zeros - call decdsp2 ; Report register number - pop de - pop hl - -rego1: add hl,de ; HL points to register again - call print - db ' =',' '+80h - ld l,(hl) - xor a - ld h,a - ld b,a ; Suppress leading zeros - jp decdsp3 ; Display value - -; Evaluate decimal string at DE to binary in B -; -de2bin: - ld b,0 ; Init value to zero -de2b: - ld a,(de) ; Get this digit - inc de ; Pt to next - sub '0' ; Convert to binary - ret c ; A space, finished - cp 10 ; Range? - ret nc ; Not decimal, finished - ld c,a ; Digit in c - ld a,b ; Multiply old by 10 - add a,a ; *2 - add a,a ; *4 - add a,b ; *5 - add a,a ; *10 - add a,c ; Add in new digit - ld b,a ; Result in b - jr de2b ; Again - -; SET HL TO POINT TO MEMORY REGISTER WHOSE INDEX IS PTED TO BY HL -; ON INPUT, A CONTAINS REGISTER CHAR -; ON OUTPUT, HL = ADDRESS OF MEMORY REGISTER (REG 0 ASSUMED IF ERROR) - -regptr: - ld hl,z3msg+6 ; The E register - cp 'E' - ret z - push de - call de2bin ; Get register number in B - pop de - ld a,b - cp 32 ; Range 0-31 - ld a,0 - jr nc,regp1 ; Out of range, use 0 - ld a,b ; Value in A -regp1: - ld hl,z3msg+30h ; Pt to memory registers - add a,l ; Pt to proper register - ld l,a - ret ; No chance of crossing page boundary -; -; End RCP-REG.Z80 - - endif ;regon - - if whlon or whlqon -; include rcpwhl ; 'WHL' and 'WHLQ' commands - page -; -;Section 5K -;Command: WHL/WHLQ -;Function: Set the Wheel Byte on or off -; -;If WHLQUIET equate is true, then RCP does not report wheel status with WHL -;command. -; -;Form: -; WHL -- turn Wheel Byte OFF -; WHL password -- turn Wheel Byte ON if password is correct -; WHLQ -- find out status of Wheel Byte -; -; Vers 2.1 Changes the function a little as follows: -; -; WHL -- Report Wheel Status (no WHLQ) -; WHL password -- Set Wheel ON if password is correct -; -- Set Wheel OFF if password incorrect -whl: - ld hl,fcb1+1 ; Pt to first char - ld a,(hl) ; Get it - - if not whlqon - cp ' ' - jr z,whlmsg ; Report wheel status if no password - endif - - ld de,whlpass - ld b,8 ; Check 8 chars - call comp ; Compare - jr nz,whloff ; Set wheel OFF if incorrect password - -; TURN ON WHEEL BYTE - - ld a,0ffh ; Turn on wheel byte - jr whlset - -; TURN OFF WHEEL BYTE - -whloff: - xor a ; Turn off wheel byte -whlset: - ld hl,(z3whl) ; Indirect from z3env - ld (hl),a -whlq: - if whlquiet - ret - endif - -; PRINT WHEEL BYTE MESSAGE - - if not whlquiet - -whlmsg: - call print - dc ' Wheel ' - call whlchk ; Check wheel byte - jr z,offm - call print - dc 'On' - ret -offm: - call print - dc 'Off' - ret - - endif ;[not whlquiet] or whlqon - - -; WHEEL PASSWORD DEFINED FROM SYSRCP.LIB FILE - - db 'Z'-'@' ; Leading ^z to block attempt to type rcp file -whlpass: - wpass ; Use macro -; -; End RCP-WHL.Z80 - - endif ;whlon - - if echoon -; include rcpecho ; 'ECHO' command - page - -; RCP-ECHO.Z80 - -;============================================================================= -; -; E C H O T E X T T O S C R E E N A N D P R I N T E R -; -;============================================================================= - -; Command: ECHO -; Function: Echo text to console or printer - -echo: - xor a ; Lower case flag setting - - if upcase ; If upper case default - dec a - endif ;upcase - - ld (casefl),a ; Store flag in code below - - ld hl,tbuff+1 ; Point to first character - call getchar ; Get first character (should be blank) - ; If none, exit from routine - - if echolst - call getchar ; Get first char after leading blank - ld b,a ; Save first char as list output flag - cp '$' ; Print flag? - jr z,echo2 ; If so, go on - dec hl ; Else backup one character - endif ; Echolst - -; LOOP TO ECHO CHARS - -echo2: call getchar - - if echolst - cp ff ; Form feed? - jr z,echo3 - endif ;echolst - - cp '^' - jr nz,echo2a ; Not control character prefix - call getchar ; Get next character - and 1fh ; Convert to control character - jr echo2d ; Echo it - -echo2a: cp cmdchar ; Case shift prefix? - jr nz,echo2d ; No, normal echo - call getchar ; Get next character - cp ucasechar ; Up-shift character? - jr z,echo2c ; Store non-zero value in case flag - -echo2b: cp lcasechar ; Lower-case character? - jr nz,echo2d ; No, echo the character as is - xor a ; Else, clear case flag -echo2c: ld (casefl),a - jr echo2 ; On to next character - -echo2d: - call echout ; Send char - jr echo2 - -; FORM FEED - SEND NEW LINE FOLLOWED BY FORM FEED IF PRINTER OUTPUT - - if echolst -echo3: - ld a,b ; Check for printer output - cp '$' - jr nz,echoff ; Send form feed normally if not printer - call echonl ; Send new line - ld a,ff ; Send form feed - jr echout - -; SEND FORM FEED CHAR TO CONSOLE - -echoff: - ld a,ff ; Get char - jr echo2d - endif ;echolst - -; END OF PRINT LOOP - CHECK FOR PRINTER TERMINATION - -echo4: - if not echolst - - ret - - else - - ld a,b ; Get list mode flag - cp '$' - ret nz ; Done if no printer output - -; OUTPUT A NEW LINE - -echonl: - ld a,cr ; Output new line on printer - call echout - ld a,lf ; Fall thru to echout - - endif ;not echolst - -; OUTPUT CHAR TO PRINTER OR CONSOLE - -echout: - ld c,a ; Char in c - - cp 'A' ; If less than 'a' - jr c,echouta ; Leave as is - cp 'Z'+1 ; If greater than 'z' - jr nc,echouta ; Leave as is - add 20h ; Else convert to lower case -echouta: - ld d,a ; Save lower case version in d -casefl equ $+1 ; Pointer for in-the-code modification - ld a,0 - or a - jr nz,echoutb ; If upper case selected, go on as is - ld c,d ; Else substitute lower case version -echoutb: - - push hl ; Save hl - push bc ; Save bc - ld de,0ch-3 ; Offset for console output - - if echolst - ld a,b ; Check for printer output - cp '$' - jr nz,echout1 - inc de ; Add 3 for printer offset - inc de - inc de - endif ;echolst - -; OUTPUT CHAR IN C WITH BIOS OFFSET IN DE - -echout1: - call biout ; Bios output - pop bc ; Restore bc,hl - pop hl - ret - -; Get a character from the command tail buffer - -getchar: - ld a,(hl) ; Get character - inc hl ; Point to next one - or a ; Check for end of string - ret nz ; If not end, return - pop hl ; Else, clean up stack - jr echo4 ; And exit from routine - -; OUTPUT CHAR IN C TO BIOS WITH OFFSET IN DE - -biout: - ld hl,(wboot+1) ; Get address of warm boot - add hl,de ; Pt to routine - jp (hl) ; Jump to it - -; End RCP-ECHO.Z80 - - endif ;echoon - -; include rcpsubs ; File of subroutines - page - -; RCPSUBS.Z80 Subroutines for Z33RCP.Z80 - - -;----------------------------------------------------------------------------- - -; Display decimal digit routines - -;-------------------- - -; Display hundreds, tens, and units digits (assumes flag in B has been set) - - if regon or spaceon - -decdsp3: - ld de,100 ; Display hundreds - call decdsp -decdsp2: - ld de,10 ; Display tens - call decdsp - ld a,l ; Get remaining units value - add '0' ; Convert to character - jr conout ; Print it and return - -;-------------------- - -; Routine to print any single digit - -; Actually, this routine displays the value of HL divided by DE and leaves the -; remainder in HL. In computing the character to display, it assumes that the -; result of the division will be a decimal digit. If the result is zero, the -; value in the B register, which is the number of digits already printed, is -; checked. If it is zero, a space is printed instead of a leading '0'. If it -; is not zero, the '0' is printed. Whenever any digit (not a space) is -; printed, the value in B is incremented. - -decdsp: - ld c,'0'-1 ; Initialize digit count - xor a ; Clear carry flag - -decdsp1: - inc c ; Pre-increment the digit - sbc hl,de ; Subtract DE from HL - jr nc,decdsp1 - - add hl,de ; Add back in to produce remainder - ld a,c ; Get decimal digit - cp '0' ; Check for leading 0 - jr nz,decdout ; If not 0, proceed to display it - ld a,b ; Digit printed already? - or a - ld a,' ' ; Possible space for calling routine to print -; ret z ; If no digit printed, return zero flag set - jr z,conout ; Print leading space -decdout: - inc b ; Indicate digit printed - ld a,c ; Else print real digit - ; Fall through to CONOUT - - endif ;regon or spaceon - -;----------------------------------------------------------------------------- - -; Console Output Routine - -conout: - putreg ; Save all register except AF - push af ; Save AF, too - and 7fh ; Mask out MSB - ld e,a ; Transfer character to E - ld c,2 ; BDOS conout function number - call bdos - pop af - getreg ; Restore registers -note: ; Use this RET for NOTE command - ret - - if peekon or [pokeon and not pokeq] or porton -spac: ld a,' ' - jr conout - endif ; peekon or [pokeon and not pokeq] or porton - - -;----------------------------------------------------------------------------- - -; String printing routines - -;-------------------- - -; Print string following call (terminated with null or character with the -; high bit set) - -print: - ex (sp),hl ; Get address - call printhl - ex (sp),hl ; Put address - ret - -;-------------------- - -; Print string pointed to by HL (terminated with null or character with the -; high bit set) - -printhl: - ld a,(hl) ; Get next character - inc hl ; Point to following one - or a ; See if null terminator - ret z ; If so, we are done - call conout ; Display the character - ret m ; We are done if MSB is set (negative number) - jr printhl ; Back for more - -;----------------------------------------------------------------------------- - -; OUTPUT NEW LINE TO CON: - -crlf: - call print - db cr,lf+80h - ret - -; CONSOLE INPUT - - if eraon or lton or proton or renon or cpon - -conin: - push hl ; Save regs - push de - push bc - ld c,1 ; Input - call bdos - pop bc ; Get regs - pop de - pop hl - and 7fh ; Mask msb - cp 61h - ret c - and 5fh ; To upper case - ret - - endif ; Eraon or lton or proton or renon or cpon -; -; SAVE RETURN ADDRESS -; -retsave: - pop de ; Get return address - pop hl ; Get return address to zcpr3 - ld (z3ret),hl ; Save it - push hl ; Put return address to zcpr3 back - push de ; Put return address back - ret - -; - if spaceon and [dirsp or cpsp or erasp] -spaexit: - call crspace ; Show space remaining - endif ; Spaceon and [dirsp or cpsp or erasp] -; -; EXIT TO ZCPR3 -; -exit: -z3ret equ $+1 ; Pointer to in-the-code modification - jp 0 ; Return address - -; -; PRINT A DASH -; - if lton or peekon -dash: - call print - db ' -',' '+80h - ret -; - endif ; Lton or peekon -; -; PRINT ADDRESS MESSAGE -; PRINT ADDRESS IN DE -; - if peekon or pokeon - if not pokeq -adrat: - call print - db ' at',' '+80h - ld a,d ; Print high - call pahc - ld a,e ; Print low - jp pahc - - endif ; Not pokeq - endif ; Peekon or pokeon - - if peekon or pokeon or porton -; -; EXTRACT HEXADECIMAL NUMBER FROM LINE PTED TO BY HL -; RETURN WITH VALUE IN DE AND HL PTING TO OFFENDING CHAR -; -hexnum: - ld de,0 ; De=accumulated value -hnum1: - ld a,(hl) ; Get char - cp ' '+1 ; Done? - ret c ; Return if space or less - inc hl ; Pt to next - sub '0' ; Convert to binary - jr c,numerr ; Return and done if error - cp 10 ; 0-9? - jr c,hnum2 - sub 7 ; A-f? - cp 10h ; Error? - jr nc,numerr -hnum2: - push hl ; Save pointer - ex de,hl - add hl,hl - add hl,hl - add hl,hl - add hl,hl ; DE x16 to HL - ld e,a - ld d,0 - add hl,de - ex de,hl ; DE = DE * 16 + A - pop hl ; Get the pointer - jr hnum1 ; Try again -; -; NUMBER ERROR -; -numerr: - call print - db ' Num','?'+80h - jp exit -; -; SKIP TO NEXT NON-BLANK -; -sksp: - ld a,(hl) ; Get char - inc hl ; Pt to next - cp ' ' ; Skip spaces - jr z,sksp - dec hl ; Pt to good char - or a ; Set eol flag - ret -; - endif ; Peekon or pokeon or porton - -;----------------------------------------------------------------------------- - -; Test File in FCB for unambiguity and existence, ask user to delete if so -; Return with Z flag set if R/O or no permission to delete -; - if renon or cpon -extest: - call ambchk ; Ambiguous file names not allowed - call searf ; Look for specified file - jr z,exok ; Ok if not found - call getsbit ; Position into dir - inc de ; Pt to file name - ex de,hl ; Hl pts to file name - push hl ; Save ptr to file name - call prfn ; Print file name - pop hl - call rotest ; Check for r/o - jr nz,exer - call eraq ; Erase? - jr nz,exer ; Restart as error if no - ld de,fcb1 ; Pt to fcb1 - ld c,19 ; Delete file - call bdos -exok: - xor a - dec a ; Nz = ok - ret -exer: - xor a ; Error flag - file is r/o or no permission - ret - -; -; CHECK FOR AMBIGUOUS FILE NAME IN FCB1 -; RETURN Z IF SO -; -ambchk: - ld hl,fcb1+1 ; Pt to fcb -; -; CHECK FOR AMBIGUOUS FILE NAME PTED TO BY HL -; -ambchk1: - push hl - ld b,11 ; 11 bytes -amb1: - ld a,(hl) ; Get char - and 7fh ; Mask - cp '?' - jr z,amb2 - inc hl ; Pt to next - djnz amb1 - dec b ; Set nz flag - pop de - ret -amb2: - pop hl ; Pt to file name - call prfn - call print - db ' is AF','N'+80h - jp exit -; - endif ; Renon or cpon -; -; TEST FILE PTED TO BY HL FOR R/O -; NZ IF R/O -; - if renon or cpon or eraon -; -rotest: - push hl ; Advance to r/o byte - ld bc,8 ; Pt to 9th byte - add hl,bc - ld a,(hl) ; Get it - and 80h ; Mask bit - push af - ld hl,romsg - call nz,printhl ; Print if nz - pop af ; Get flag - pop hl ; Get ptr - ret -romsg: - db ' is R/','O'+80h -; -; CHECK USER TO SEE IF HE APPROVES ERASE OF FILE -; RETURN WITH Z IF YES -; -eraq: - call print - db ' - Eras','e'+80h - endif ; Renon or cpon or eraon - - if renon or cpon or eraon or proton -eraq1: - call print - db ' (Y/N/Q)?',' '+80h - call conin ; Get response - cp 'Q' ; Quit command? - jp z,exit - cp 'Y' ; Key on yes - ret -; - endif ; Renon or cpon or eraon or proton -; -; INIT FCB1, RETURN WITH DE PTING TO FCB1 -; - if eraon or lton or cpon -initfcb1: - ld hl,fcb1 ; Pt to fcb -initfcb2: - push hl ; Save ptr - ld bc,12 ; Pt to first byte - add hl,bc - ld b,24 ; Zero 24 bytes - xor a ; Zero fill - call fillp ; Fill memory - pop de ; Pt to fcb - ret -; - endif ; Eraon or lton or cpon -; - if eraon or lton or cpon or diron - -fillp: - ld (hl),a ; Store byte - inc hl ; Pt to next - djnz fillp ; Count down - ret -; - endif ; Eraon or lton or cpon or diron - -; -; CHECK FOR USER INPUT; IF ^C, RETURN WITH Z -; - if diron or lton or eraon or proton or peekon - -break: - push hl ; Save regs - push de - push bc - ld c,11 ; Console status check - call bdos - or a - ld c,1 ; Get char if any - call nz,bdos - pop bc ; Restore regs - pop de - pop hl -break1: cp ctrlc ; Check for abort - jp z,exit ; Exit - cp ctrlx ; Skip? - ret - endif ; Diron or lton or eraon or proton or peekon - -; AFTER A SEARCH, RETURN NZ SET IF DESIRED TYPE OF FILE FOUND, Z IF NOT -; THIS ALGORITHM LOOKS AT THE SYSTEM BIT OF THE LOCATED FILE; THIS -; BIT IS SET TO 1 IF THE FILE IS A SYSTEM FILE AND 0 IF NOT A SYSTEM -; FILE. THE FOLLOWING EXCLUSIVE OR MASKS ARE APPLIED TO RETURN Z OR NZ -; AS REQUIRED BY THE CALLING PROGRAM: -; -; SYSTEM BYTE: X 0 0 0 0 0 0 0 (AFTER 80H MASK, X=1 IF SYS, 0 IF DIR) -; -; SYS-ONLY : 0 0 0 0 0 0 0 0 (XOR 0 = 0 if X=0, = 80H if X=1) -; DIR-ONLY : 1 0 0 0 0 0 0 0 (XOR 80H = 80h if X=0, = 0 if X=1) -; BOTH : 0 0 0 0 0 0 0 1 (XOR 1 = 81H or 1H, NZ in both cases) - - if diron or eraon or lton or proton or cpon or renon - -getsbit: - dec a ; Adjust to returned value - rrca ; Convert number to offset into tbuff - rrca - rrca - and 60h - ld de,tbuff ; Pt to buffer - add a,e ; Add entry offset to base addr - ld e,a ; Result in e - push de ; Save ptr in de - add 10 ; Add offset of 10 to pt to system byte - ld e,a ; Set address - ld a,(de) ; Get byte - pop de ; Get ptr in de - and 80h ; Look at only system bit -systst equ $+1 ; In-the-code variable - xor 0 ; If systst=0, sys only; if systst=80h, dir - ; Only; if systst=1, both sys and dir - ret ; Nz if ok, z if not ok -; -; -; COPY HL TO DE FOR B BYTES -; -blkmov: - ld a,(hl) ; Get - ld (de),a ; Put - inc hl ; Pt to next - inc de - djnz blkmov ; Loop - ret - -; -; PRINT FILE NOT FOUND MESSAGE -; -prfnf: - call print - db ' No File','s'+80h - jp exit - -; LOG INTO USER AREA CONTAINED IN FCB1 -; -logusr: - ld a,(fcb1+13) ; Get user number -setusr: - ld e,a - ld c,32 ; Use bdos fct - jp bdos - -; -; PRINT FILE NAME PTED TO BY HL -; -prfn: - call print ; Leading space - db ' '+80h - ld b,8 ; 8 chars - call prfn1 - call print - db '.'+80h ; Dot - ld b,3 ; 3 chars -prfn1: - ld a,(hl) ; Get char - inc hl ; Pt to next - call conout ; Print char - djnz prfn1 ; Count down - ret - -; -; SEARCH FOR FIRST -; -searf: - push bc ; Save counter - push hl ; Save hl - ld c,17 ; Search for first function -searf1: - ld de,fcb1 ; Pt to fcb - call bdos - inc a ; Set zero flag for error return - pop hl ; Get hl - pop bc ; Get counter - ret - - endif ; Diron or eraon or lton or proton or cpon or renon - -;----------------------------------------------------------------------------- - -; Define buffers as high as possible in TPA for the following groups -; of commands: -; COPY needs SRCFCB and CBUFF -; LIST/TYPE needs PAGCNT and DIRBUF -; ERA, PROT, and DIR commands. needs DIRBUF -; If DIRBUF is defined, its value is in HL on return from this code. The DE -; register pair is not changed by the code, but the BC pair is affected. - -dirbufon equ lton or diron or eraon or proton - - if dirbufon -dirbuf: ds 2 ; Address for directory buffer - endif ;dirbufon - - if cpon -srcfcb: ds 2 ; Address of source file FCB (CBUFF address - ; ..is in the code) - endif ;cpon - - if lton -pagcnt: ds 2 ; Address for page counter - endif ;lton - - - if cpon or lton or eraon or proton or diron - -define: - push de - ld hl,(bdos+1) ; Get bottom of BDOS - ex de,hl ; ..into DE - ld hl,(1) ; Get BIOS warmboot address into HL - ld bc,-[0e00h+800h+3] ; Offset to command processor address - add hl,bc - -; Now we have to compare and pick the lower address as the top of TPA - - push hl ; Save CPR address while comparing - xor a ; Clear the carry flag - sbc hl,de ; Compute (CPR-BDOS) - pop hl ; Restore CPR address - jr c,define1 ; Branch if BDOS address is higher (use CPR) - ex de,hl ; Otherwise use BDOS address -define1: - - if lton - dec hl ; Put PAGCNT in first free byte at top of TPA - ld (pagcnt),hl - endif ;lton - - if cpon - ld de,-36 ; Calculate place for SRCFCB for copy command - add hl,de - ld (srcfcb),hl - if dirbufon - push hl ; Save if needed below - endif ;dirbufon - ld de,-[cpblocks*128] ; CBUFF can use same space as DIRBUF - add hl,de - ld (cbuff),hl - if dirbufon - pop hl - endif ;dirbufon - endif ;cpon - - if dirbufon - ld de,-[maxdirs*11] ; Space for directory buffer - add hl,de - ld (dirbuf),hl - endif - - pop de - ret - - endif ;cpon or dirbufon - -;----------------------------------------------------------------------------- - -; -; SEARCH FOR NEXT -; - if diron or eraon or lton or proton - -searn: - push bc ; Save counter - push hl ; Save hl - ld c,18 ; Search for next function - jr searf1 - -; LOAD DIRECTORY AND SORT IT -; ON INPUT, A=SYSTST FLAG (0=SYS, 1=DIR, 80H=BOTH) -; DIRECTORY IS LOADED INTO BUFFER AT TOP OF TPA -; RETURN WITH ZERO SET IF NO MATCH AND HL PTS TO 1ST ENTRY IF MATCH - -direrr: - call print - db 'DIR Ovf','l'+80h - jp exit - -getdir: - ld (systst),a ; Set system test flag - call logusr ; Log into user area of fcb1 - -; LXI H,DIRBUF ; Pt to dir buffer - call define ; Define buffer addresses - ld (hl),0 ; Set empty - ld bc,0 ; Set counter - call searf ; Look for match - ret z ; Return if not found -; -; STEP 1: LOAD DIRECTORY -; -gd1: - push bc ; Save counter - call getsbit ; Check for system ok - pop bc - jr z,gd2 ; Not ok, so skip - push bc ; Save counter - inc de ; Pt to file name - ex de,hl ; Hl pts to file name, de pts to buffer - ld b,11 ; Copy 11 bytes - call blkmov ; Do copy - pop bc ; Get counter - inc bc ; Increment counter - ld hl,maxdirs-1 ; See if count equals or exceeds MAXDIRS - ld a,b ; Check high bytes - sub a,h - jr c,gd1a ; If carry set, we are OK - ld a,c ; Check low bytes - sub a,l - jr nc,direrr ; If no carry, jump to error message -gd1a: - ex de,hl ; Hl pts to next buffer location -gd2: - call searn ; Look for next - jr nz,gd1 - ld (hl),0 ; Store ending 0 -; LXI H,DIRBUF ; Pt to dir buffer - ld hl,(dirbuf) ; Pt to dir buffer - ld a,(hl) ; Check for empty - or a - ret z -; -; STEP 2: SORT DIRECTORY -; - if sorton - push hl ; Save ptr to dirbuf for return - call diralpha ; Sort - pop hl - endif - xor a ; Set nz flag for ok - dec a - ret - -; -; DIRALPHA -- ALPHABETIZES DIRECTORY IN DIRBUF; BC CONTAINS -; THE NUMBER OF FILES IN THE DIRECTORY -; -diralpha: -; -; SHELL SORT -- -; THIS SORT ROUTINE IS ADAPTED FROM "SOFTWARE TOOLS" -; BY KERNIGAN AND PLAUGHER, PAGE 106. COPYRIGHT, 1976, ADDISON-WESLEY. -; - ld h,b ; Hl=bc=file count - ld l,c - ld (n),hl ; Set "N" - ld (gap),hl ; Set initial gap to n for first division by 2 - -; FOR (GAP = N/2; GAP > 0; GAP = GAP/2) -srtl0: - or a ; Clear carry -gap equ $+1 ; Pointer for in-the-code modification - ld hl,0 ; Get previous gap - ld a,h ; Rotate right to divide by 2 - rra - ld h,a - ld a,l - rra - ld l,a - -; TEST FOR ZERO - or h - ret z ; Done with sort if gap = 0 - - ld (gap),hl ; Set value of gap - ld (ii),hl ; Set ii=gap for following loop - -; FOR (II = GAP + 1; II <= N; II = II + 1) -srtl1: -ii equ $+1 ; Pointer for in-the-code modification - ld hl,0 ; Add 1 to ii - inc hl - ld (ii),hl - -; TEST FOR II <= N - ex de,hl ; Ii is in de -n equ $+1 ; Pointer for in-the-code modification - ld hl,0 ; Number of items to sort - ld a,l ; Compare by subtraction - sub a,e - ld a,h - sbc a,d ; Carry set means ii > n - jr c,srtl0 ; Don't do for loop if ii > n - - ex de,hl ; Set jj = ii initially for first subtraction of gap - ld (jj),hl - -; FOR (JJ = II - GAP; JJ > 0; JJ = JJ - GAP) -srtl2: - ld hl,(gap) ; Get gap - ex de,hl ; In de -jj equ $+1 ; Pointer for in-the-code modification - ld hl,0 ; Get jj - ld a,l ; Compute jj - gap - sub a,e - ld l,a - ld a,h - sbc a,d - ld h,a - ld (jj),hl ; Jj = jj - gap - jr c,srtl1 ; If carry from subtractions, jj < 0 and abort - or l ; Jj=0? - - jr z,srtl1 ; If zero, jj=0 and abort - -; SET JG = JJ + GAP - ex de,hl ; Jj in de - ld hl,(gap) ; Get gap - add hl,de ; Jj + gap - ld (jg),hl ; Jg = jj + gap - -; IF (V(JJ) <= V(JG)) - call icompare ; J in de, jg in hl - -; ... THEN BREAK - jr c,srtl1 - -; ... ELSE EXCHANGE - ld hl,(jj) ; Swap jj, jg - ex de,hl -jg equ $+1 ; Pointer for in-the-code modification - ld hl,0 - call iswap ; Jj in de, jg in hl - -; END OF INNER-MOST FOR LOOP - jr srtl2 - -; -; SWAP (Exchange) the elements whose indexes are in HL and DE -; -iswap: - call ipos ; Compute position from index - ex de,hl - call ipos ; Compute 2nd element position from index - ld b,11 ; 11 bytes to flip - endif ; Diron or eraon or lton or proton - - if diron or eraon or lton or proton or renon -iswap1: - ld a,(de) ; Get bytes - ld c,(hl) - ld (hl),a ; Put bytes - ld a,c - ld (de),a - inc hl ; Pt to next - inc de - djnz iswap1 - ret - endif ; Diron or eraon or lton or proton or renon - - if diron or eraon or lton or proton -; -; ICOMPARE compares the entry pointed to by the pointer pointed to by HL -; with that pointed to by DE (1st level indirect addressing); on entry, -; HL and DE contain the numbers of the elements to compare (1, 2, ...); -; on exit, Carry Set means ((DE)) < ((HL)), Zero Set means ((HL)) = ((DE)), -; and Non-Zero and No-Carry means ((DE)) > ((HL)) -; -icompare: - call ipos ; Get position of first element - ex de,hl - call ipos ; Get position of 2nd element - ex de,hl -; -; COMPARE DIR ENTRY PTED TO BY HL WITH THAT PTED TO BY DE; -; NO NET EFFECT ON HL, DE; RET W/CARRY SET MEANS DE/>> to indicate state) - ^W - recall command lines from history stack - ^E - recall history in reverse direction - - -Installation: - - The installation program, CLEDINST, allows you to set up the editor -to your preference. The RCP can be installed directly in memory or in a disk -file -- RCPxxx.ZRL or a system configuration saved with SNAP or NZBLITZ. -CLEDINST also serves as a "help" utility by displaying the current command -bindings. Type "CLEDINST //" for help with CLEDINST.COM. - - -History Tool: - - CLEDSAVE writes the contents of the history stack to a text file on disk. -The file can be reloaded later (CLEDSAVE L), or composed in advance -with a text editor, then loaded. If the file is too large for the history -stack, as many commmand lines as fit are loaded. - - CLEDSAVE is useful as in a startup alias to load frequently used command -lines from an easily altered file. For example: - -Alias: START - -A15: -CLEDSYS <- load SNAP image of ENV,TCAP,RCP,FCP,NDR,QUIET,&PATH -CLEDSAVE CLED.VAR L <- load precomposed command lines into CLED -CLED <- turn the shell on -... <- rest of startup line runs before CLED gets control - -For help with CLEDSAVE.COM, type "CLEDSAVE //". - - You may also use SNAP or NZBLITZ to save the system segment image with -command lines already loaded (turn SAVE OFF first.) - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpcled.lib b/Source/BPBIOS/Z34RCP11/rcpcled.lib deleted file mode 100644 index 6c2879a7..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpcled.lib +++ /dev/null @@ -1,1327 +0,0 @@ - page - -; Library: RCPCLED for Z34RCP -; Author: Carson Wilson (modifications only) -; Version: 1.3b -; Date: October 8, 1989 -; Changes: Civilian time now prints "12" instead of "0" for midnight hour. -; Put Z3PLUS time display capability back in. -; Z3PLUS time display disabled if date = 01/01/78 (no clock). -; Added Rob Friefeld's fix to SAVE_LINE. -; -; Author: rdf -; Version: 1.3a -; Date: October 2, 1989 -; Changes: Changed order of installable highlight codes and history buffer -; addresses to simplify installing a ZRL file. Changed version -; number to guarantee compatibility with accessory programs. -; Option to print user number zero at prompt. -; Time string separator installable. - -; Author: Carson Wilson (modifications only) -; Version: 1.2 B -; Date: September 29, 1989 -; Changes: Made ">>" the prompt when previous commands are NOT being -; overwritten. -; Changed line edit commands to be closer to CP/M Plus. -; Shortened the clock read code (ZSDOS allows straight -; DateStamper calls). -; Uses DEFINE from RCPSUBS.LIB to save space. -; Does not print prompt user number if at user zero. -; Optional installable highlight codes for time in prompt. -; Time prompt shortened to "hh.mm" for easier reading. - -; Author: Rob Friefeld -; Version: 1.2 a -; Date: September 20, 1989 - -; Syntax: CLED [/] if "/", then run for one command line only -; e.g. from a shell like ZFILER - -; -; ===== D E F I N I T I O N S S E C T I O N ===================== -; - -clver equ 13 ; Version number (Install program compat.) -clrev equ 'b' ; Revision (Does not affect config.) - -del equ 7fh ; not in sysdef.lib - -; -;===== C O N F I G U R A T I O N A R E A ======================== -; - -; The installation program and buffer loader depend on the configuration -; of this data structure. It should not be changed. - -shname: db 'CLED',0 ; Name put on shell stack -versid: db clver ; CLED version -ddsep: db dudir_sep ; DU:DIR separator char -ins_flag: db clins ; Yes = insert mode -minsave: db clmin ; Discard line =< this -era_flag: db clera ; Erase stored line on exit -save_flag: db clsav ; Save command lines -tim_sep: db timesep ; Time string separator - -; --------------------------- - -; Command list for RCPCLED, Version 1.3 -; Set bit 7 to use a command with meta key - -cmd_list: - db 'Q' ; Meta key 1 - db 'H' ; Backspace - db 'S' ; Cursor left - db 'D' ; Cursor right - db 'A' ; Word left - db 'F' ; Word right - db 'B' ; Line end/ start - dc 'S' ; Line start - dc 'D' ; Line end - db 'G' ; Delete char - db DEL ; Delete left - db 'T' ; Delete word - db 'L' ; Delete word left - db 'X' ; Delete to SOL - db 'Y' ; Delete line - db 'K' ; Delete to EOL - db 'V' ; Toggle insert - db 'P' ; Enter control - db 'W' ; Recall line - db 'E' ; Recall reverse - db 'M' ; Execute line - db '[' ; ESC menu - -cmdlen equ $ - cmd_list - -; --------------------------- -; Highlight on/off codes for time display (installable) -; -stndout: db 0,0,0,0 ; Must terminate with hibit or binary 0 -stndend: db 0,0,0,0 ; Ditto - -; --------------------------- -; 4 bytes are used here for the information of the history save/load tool, -; CLEDSAVE - -histaddr: dw history ; Pointer to history buffer -histsz: dw histsize ; Buffer size - -; -;===== M A I N C O D E S E C T I O N ======================== -; -cled: - call define ; Set pointer to free mem - ld de,-lbufwid-1 - add hl,de - ld (line),hl ; Set line buffer location - xor a - ld (hl),a ; Zero line - ld hl,history ; History stack - ld (recall_ptr),hl ; Init position pointer to start - - ld a,(fcb+1) ; Check command line option - cp '/' - jr z,cledit ; Go right to editing - - ld a,(z3msg+3) ; QSHELL - dec a ; <> 1 on manual invocation - jr z,cledit ; Skip installation - -; -;===== S H E L L I N S T A L L A T I O N ========================= -; -sh_inst: - ld hl,shname - call shpush ; Z = OK - ret z - call print ; Complain about stack and cancel - dc cr,lf,'SH STK' ; Full or non-existent - ret - -; -;===== L I N E E D I T =========================================== -; - -; This is the main entry point for the shell -; 1 - Display prompt -; 2 - Get user input -; 3 - Reset shell bit -; 4 - Run command line - - -; Subtask 1 -- -cledit: - call prompt ; Display system prompt - -;---------------------------------------- -; Subtask 2 -- - -; The editor returns NZ if the shell pop command has been given. If not, it -; returns the character count of the command line in B. - - call EDIT - -;---------------------------------------- -; Subtask 3 -- - push af ; Save return code - xor a - ld (z3msg+3),a ; PUTCST - pop af - -;---------------------------------------- -; Subtask 4 -- - jp nz,shpop ; Quit shell - -; Here we load the MCL directly from the line buffer. On OVFL, loop to edit. - -loadcl: - ld a,(z3cl+2) ; MCL size - inc b ; B contains line count, include terminating 0 - cp b ; Compare to line size - jr nc,loadcl1 ; OK - -mclerr: - call print - dc cr,lf,'OVFL',cr,lf - jp cledit - -loadcl1: - ld de,z3cl+4 ; Set MCL pointer to start - ld (z3cl),de - - ld hl,(line) - ld c,b - ld b,0 - ldir ; Move line buff to MCL - ret ; Run it - - -; -;===== S U B R O U T I N E S ======================================= -; - -; Prompt -- PRINT a DU:DIR prompt. -; -prompt: - if systime - call print_time - endif - - ld bc,(cusr) ; GDEFDU - ld a,b ; Drive - add a,'A' ; Make it a letter - call conout ; Write it - ld a,c ; Get user - - if puser0 - call pusr ; Write it - else - or a - call nz,pusr ; Write it IF NONZERO - endif ;puser0 - - call dutdir ; Get the ndr - jr z,prompt1 - ld a,(ddsep) ; DU:DIR separator - call conout - ld b,8 ; Eight chars max -nameloop: - ld a,(hl) ; Get the first char - cp ' ' - call nz,conout ; Write it if not blank - inc hl - djnz nameloop - -prompt1: - call prompt2 - ld a,(save_flag) ; If save is OFF, prompt is >> - or a - ret nz -prompt2: - call print - dc '>' - ret - -; PUSR -- Convert user # in A to decimal and print -; -pusr: - ld hl,10 shl 8 + '0'-1 ; H=10, L='0'-1 - cp h ; User < 10 ? - jr c,pusr1 -pusr0: - inc l ; Advance character for user number tens digit - sub h - jr nc,pusr0 - add a,h - ld h,a ; Keep low digit of user number in H - ld a,l ; Display tens digit - call conout - ld a,h ; Ready to process units digit -pusr1: - jp decout ; Routine in RCPSUBS.LIB -; add '0' -;pusr2: -; jp conout - -; Console input without echo - -cin: - push hl - push de - push bc -cin1: ld c,dirconf ; DCIO - ld e,-1 - call bdos - or a - jr z,cin1 - pop bc - pop de - pop hl - ret - -; -;===== E D I T O R S E C T I O N ================================ -; - -; Date: October 2, 1989 - -; Entry is EDIT -; Return Z = Execute command line, NZ = Quit shell, B = char count of line - -; Initialize to on-line environment. -; While editing, HL -> current position in LINE, B = char count, -; C = cursor position (0 .. count), DE = scratch - -edit: - ld hl,(line) ; Init to start of line - xor a - ld b,a ; Line count = 0 - ld c,a ; Cursor pos = 0 - - push hl ; There may already be a line here - dec b ; Accumulate possible char count in B -edit1: - inc b - cp (hl) ; A = 0 - inc hl - jr nz,edit1 ; Loop until 0 terminator -edit2: - pop hl ; Point to line again - call zline ; Zero the remainder of LINE buffer - call ptail ; Print the line from cursor position - -;-------------------------------------------------------------------- - -; EDIT COMMAND LOOP - -; Get a char. If it is text, enter it. If it is a control, scan the -; CMD_LIST for a match. If found, compute offset into jump table and go. -; A "shifted" key (high bit set in table) is matched after the "meta-key" -; has been entered. - -ecmd: - exx ; Main regs must be preserved - ld hl,ecmd ; Save address so a return comes back here - push hl - -no_match: - call cin ; Next key... - cp 'C'-'@' ; Warm boot? - jp z,0000h - - ld hl,meta_flag ; Shift flag - or (hl) ; Mask in possible high bit - ld (hl),0 ; Reset flag - exx ; Recover main regs - - cp 20h ; Test key - jr c,control_key ; Not text - cp del ; This control char > text chars - jp c,enter ; Input text - -control_key: - call menuinp ; Convert control char to cap - - exx ; Must preserve main regs - ld hl,cmd_list ; Scan command list - ld bc,cmdlen - cpir - jr nz,no_match - ld hl,cmd_vector - ld a,cmdlen-1 ; Point to address in vector table - sub c - add a,a - ld c,a - add hl,bc - ld c,(hl) - inc hl - ld b,(hl) - ld (cjump),bc ; Address to jump to - exx ; Restore regs! - -cjump equ $+1 - jp 0 - - -; Convert a control key entry to cap char - -menuinp: - push af - and 80h ; Keep high bit - ld e,a - pop af - and 7fh - call ucase - or e ; Restore high bit - ret - -; Mark meta-key flag - -meta_key1: - ld a,10000000b - ld (meta_flag),a - ret - -meta_flag: db 0 ; Initial value 0 = no shift - - -; Jump table for commands - -cmd_vector: - dw meta_key1 ; Shift key - dw bsp ; Backspace - dw bsp ; Cursor left - dw fsp ; Cursor right - dw bwrd ; Left word - dw fwrd ; Right word - dw linend ; To EOL - dw linbeg ; To SOL - dw linend1 ; To EOL/SOL - dw delete ; Delete char - dw delft ; Delete char left - dw delwrd ; Delete word right - dw delwlft ; Delete word left - dw delsol ; Delete to start of line - dw dline ; Delete line - dw deleol ; Delete to end of line - dw instog ; Toggle insert - dw ctl_entry ; Enter control char - dw recall_back ; Scroll back in history - dw recall_fwrd ; Scroll ahead in history - dw eds$ex ; Execute line - dw esc_menu ; Submenu - -;-------------------------------------------------------------------- - -; ON-LINE ROUTINES, EDITING CURRENT LINE IN LINE BUFFER - -; WHILE ON LINE: -; B = CHAR COUNT (0..lbufwid) C = CURSOR POSITION (0..lbufwid) -; HL = MEM POSITION - - -; Backspace -; Return Z = backspace not done, NZ = all OK - -bsp: - xor a - cp c ; Cursor pos - ret z ; At start - dec hl ; Back up in mem - dec c ; Cursor pos back -bspace: - ld a,bs ; Back up on screen - or a ; Must ret nz - jp conout - - -; Forward space -; Return Z = not done - -fsp: - ld a,(hl) - or a - ret z ; At EOL - inc hl - inc c - jp pctl ; Screen advance by reprinting char - - -; Back word - -bwrd: - call bsp ; Backspace - ret z ; Nowhere to go - ld a,(hl) - cp ' ' - jr z,bwrd ; Backspace over blanks - dec hl ; Now backspace until next wordsep - call wrdsep ; Look at char before this position - inc hl - jr nz,bwrd - ret - -; Forward word - -fwrd: - call wrdsep ; Are we on a word separator? - jr z,fwrd1 ; Yes - call fsp ; No, advance until we find one - jr fwrd - -fwrd1: call fsp ; Word sep found, advance 1 more space - ld a,(hl) ; Are we on a blank? - cp ' ' - jr z,fwrd1 ; Don't quit on a blank - ret - - -; Delete char left - -delft: - call bsp ; Backspace and fall through to delete - - -; Delete char - -delete: - call delmem ; In memory - jp ptail ; Refresh screen from cursor position - -; Delete to start of line - -delsol: - ld a,c ; Get cursor pos - or a - ret z ; Already at start - cp b - jr z,dline ; At end, so delete entire line (quicker) - ld e,a ; Cursor pos = # chars to delete - call linbeg ; Go to start -delcmd1: - call delmem ; Delete first char in memory - dec e ; Loop counter - jr nz,delcmd1 - jp ptail ; Now update screen - - -; Delete word left - -delwlft: - call bwrd ; Back a word and fall thru ... - - -; Delete word right - -delwrd: - call wrdsep ; On a word sep? - jr z,delete ; Yes, kill it - ld a,b ; Compare line count to cursor pos - cp c - jr z,delete ; On last char of line -delwrd1: - call delmem ; Delete in mem, let screen catch up later - jr delwrd ; Go until word sep found - - -; Delete line - -dline: - call linbeg ; Position at line start and fall thru ... - -; Delete to eoln - -deleol: - call ereol ; Clear on screen - ld b,c ; Char count = current position - jp zline ; Zero line tail in mem - -; Insert/overwrite toggle - -instog: - ld a,(ins_flag) ; Flag 0 -> owrt - cpl - ld (ins_flag),a - ret - -; Enter a control - -ctl_entry: - call cin - and 1fh ; Fall thru to normal char entry - -; Enter a char - -enter: - ex af,af' ; Save char - ld a,b ; At eoln? - cp c - jr z,ovrwrt ; Yes, no need for insert mode - ld a,(ins_flag) ; Which mode are we in? - or a ; 0 = overwrite, nz = insert - jr nz,insert - - -; Enter char in overwrite mode - -ovrwrt: - ld a,b ; Char count - cp lbufwid-2 ; Line full? - jr c,ovr1 ; No - cp c ; At EOLN? - ret z ; Accept no more chars - -ovr1: ex af,af' ; Recover char - ld (hl),a ; Put char in place - call fsp ; Advance by printing it - ld a,b ; Char count -> a - cp c - ret nc ; No need to incr char count inside line - inc b ; Else add to count - ret - -; Enter char in insert mode - -insert: - ld a,b ; Line full? - cp lbufwid-2 - ret nc - -insrt: - ld a,b ; At eoln? - sub c ; A = # chars to eoln - jr z,ovr1 ; Yes, really want overwrite - call insmem ; Push chars down to make room - ex af,af' ; Recover new char - ld (hl),a ; Place char in line - call ptail ; Reprint entire line from here - inc b ; Inc char count - jp fsp ; Advance cursor - - -; Line end/start toggle - -linend: ; Go to eoln or, if there, to start of line - ld a,b - cp c - jr z,linbeg - -linend1: - call fsp ; Print ahead until EOL - jr nz,linend1 - ret - -linbeg: - call bsp ; Backspace until start - jr nz,linbeg - ret - - -; Compare current char to list of word separators - -wrdsep: - push hl - push bc - ld bc,wrdseplen - ld a,(hl) - ld hl,wrdseps - cpir - pop bc - pop hl - ret - -wrdseps: - db 0,' ,;:.' ; Punctuation word separators -wrdseplen equ $ - wrdseps - - -; Delete current char from line - -delmem: - ld (hl),0 ; Terminal 0 or char to be deleted - ld a,b - sub c ; A = (count-position) = chars from end - ret z ; At eoln, no char - dec b - ret z ; Single char line - dec a - ret z ; On last char, just deleted it -delmem1: - inc a ; To move terminal 0 in - push hl - push de - push bc - ld d,h ; Dest is current pos - ld e,l - inc hl ; Source, terminal 0 - ld c,a ; Count, line tail - ld b,0 - ldir ; Block move - pop bc - pop de - pop hl - ret - -; Insert a char in line - -insmem: - push bc ; Make room for char in line - push de - ld c,a ; Bc = # chars to move - ld b,0 - add hl,bc ; Dest is new eoln - ld d,h ; Now in DE - ld e,l - dec hl ; Source is current eoln - lddr ; Tail move - pop de - pop bc ; Recover char count, crs pos info - inc hl ; Hl to next char - ret - - -; Print line tail from cursor position, return to position - -ptail: - push hl ; Save mem pos - push bc ; Save screen pos - call linend1 ; Print ahead to end of line - call ereol ; Clean off danglers -ptail1: - ld a,c ; End of line cursor pos - pop bc - pop hl - sub c ; Current cursor pos - ret z ; At end of line already - ld e,a ; Loop counter -ptail2: - call bspace ; Else back up to where we were - dec e - jr nz,ptail2 - ret - - -; Print a char, turn a control char into a cap char - -pctl: - push af - cp 20h - jr nc,pctl1 - add '@' -pctl1: call conout - pop af - ret - - -; Convert char or control key to upper case - -ucase: - cp ' ' - jr nc,notctl - add '@' -notctl: cp 'a' - ret c ; Not a lowercase - cp 'z'+1 - ret nc ; Not a lowercase - sub ' ' ; Yes, a lowercase - ret - - -; Zero line tail - -zline: - push hl - push bc - ld hl,(line) ; HL -> start of line - ld c,b ; BC = char count - ld b,0 - add hl,bc ; HL -> EOLN - ld a,lbufwid - sub c - dec a - jr z,zline0 - ld b,a ; # of 0's - xor a -zline1: - ld (hl),a - inc hl - djnz zline1 -zline0: - pop bc - pop hl - ret - - -; ESC key pressed - get submenu command - -esc_menu: - call cin - call ucase - cp 'Q' ; Quit - jr z,edquit - cp 'S' ; Toggle Save - ret nz ; Loop if none of these - -; Toggle recording state -; - Alter line prompt to > if save ON, >> if save OFF - -save_tog: - ld a,(save_flag) ; Flip flag byte - cpl - ld (save_flag),a - call crlf - call prompt ; Print new prompt string - pop af ; Lift ecmd from stack - jp edit ; Restart - - -; Exit editor - -eds$ex: - pop af ; Lift ECMD from stack - ld a,(save_flag) ; Are we recording? - or a - ret z ; Nope - - ld a,(minsave) ; Is line worth keeping? - cp b - push bc - call c,save_line - pop bc - -edn$ex: - xor a ; Return Z - ret - - -; Exit and pop shell - -edquit: - pop af ; Lift ECMD from stack - xor a ; Return NZ - dec a - ret - - -; --------------------------- - -; HISTORY STACK ROUTINES for RCPCLED, Version 1.2 - -;Each command line is pushed onto the history stack before execution. As the -;older ones overflow, they are eliminated. The last character of each line -;has the high bit set. The buffer terminates with a 0. -;The history stack is internal to the RCP, but could be implemented in an RSX - -; Save new line to stack -; - This routine called only on exit, so on-line regs not preserved. -; - Push contents down by size of current line -; - Move line buffer to start of stack -; - Terminate line with high bit set -; - Terminate history with 0 after last complete line -; - If current line is too big for buffer size chosen, do nothing - -save_line: - ld c,b ; Line size from b to bc - xor a - ld b,a - push bc - ld hl,HISTSIZE - sbc hl,bc ; Buffer size - line length - jr z,savel_err ; Not enough room - jr c,savel_err ; Definitely not enough room! - push hl - ld hl,hbuf_top - push hl - sbc hl,bc ; hl -> bufftop - line size - pop de ; de -> bufftop - pop bc ; bc = buffsize - line size - lddr ; tail move - - pop bc ; Recover line size in bc - ex de,hl - inc de ; de -> buffstart - ld hl,(line) ; Move in line - ldir - dec de - ex de,hl - set 7,(hl) ; Tag line terminus - - ld hl,hbuf_top ; Terminate history after last complete line -savel1: - dec hl ; Back up to EOLN - bit 7,(hl) - jr z,savel1 ; Loop until hi-bit encountered - inc hl - ld (hl),0 - ret - -savel_err: - pop af ; Lift BC push - ret - -; Recall command history, newest -> oldest -; - recall_ptr is init to start of buffer on each CLED invocation -; - return with pointer updated to next line - -recall_back: - call check_recall ; Is there anything in buffer? - ret nc ; No - -; Transfer from recall pointer to line buffer -; - enter hl @ recall_ptr -; - return ptr -> start of next command if no OVFL - -rc_back1: - ld de,(line) ; Destination for move -rc_back1a: - ld a,(hl) - or a - jr z,recall_quit ; Buff end - ldi - bit 7,a - jr z,rc_back1a - - ld (recall_ptr),hl ; Update ptr now - ex de,hl ; Point to end of line in line buffer - ld (hl),0 ; Terminate it - dec hl - res 7,(hl) ; Fix high bit from storage - - pop af ; Lift ecmd from stack - jp edit ; Restart on this line - -recall_quit0: - pop af ; Lift subroutine call from stack -recall_quit: - exx ; Recover main regs - ret ; Back to editing - - -; Recall command history, oldest -> newest - -recall_fwrd: - call check_recall ; Anything in buffer? - ret nc ; No - call rc_fwrd1 ; Move to previous line - call rc_fwrd1 ; Don't repeat line on direction rev - jr rc_back1 ; Now same code as recall_back - -rc_fwrd1: - dec hl ; Initially, HL -> next line to recall - ld de,history ; Underflow address -rc_fwrd1a: - push hl ; Compute position relative to top - xor a - sbc hl,de - pop hl - ret z ; Quit when start of buff reached - jr c,recall_quit0 ; Underflow - dec hl ; Going backwards in buffer - bit 7,(hl) - jr z,rc_fwrd1a - inc hl ; Point to char past command terminator - ret - - -; Check to see if anything in recall buffer yet -; - Ret NC = no, main regs preserved -; - Else switch main regs to alt, ret HL @ recall buffer line - -check_recall: - ld a,(history) ; Is anything in buffer yet? - or a - ret z ; Nope - call linbeg - exx - ld hl,(recall_ptr) - scf - ret - -; --------------------------- - -; Routine: EREOL function for Z34RCP -; Author: Rob Friefeld -; Version: 1.0 -; Date: September 19, 1989 -; -; Entry: EREOL -; Function: To clear to end of line -; Comments: The setting of the ERLTCAP equate determines whether this -; command uses the TCAP information or not. If not, it uses the -; ereol string passed in macro CLR_EOL. That string should -; end with the high bit set. The setting of the ERLQUICK equate -; determines whether to simply output the TCAP string for this -; function or to interpret it as does Rick Conn's VLIB version. -; Uses RCPSUBS.LIB routines CONOUT and PRINTHL. - - -; ------------------------------------------------------------------- - - if [not erltcap] -; Erase to end of line. Return NZ. - -ereol: call print - clr_eol -; or -1 ; For VLIB compatibility - ret - - - else - if erlquick - -; --------------------------- - -; This version just prints the EREOL string: no delay, no interpretation. - -ereol: - push hl - ld hl,z3tcap+17h ; CLS string - xor a ; Skip to EREOL string -ereol1: cp (hl) ; Skip once - inc hl - jr nz,ereol1 -ereol2: cp (hl) ; Skip twice - inc hl - jr nz,ereol2 - call printhl ; Print it - pop hl - ret - -; --------------------------- - -; This is a disassembly of EREOL from VLIB - else - -ereol: - push bc - push de - push hl - ld hl,z3tcap+16h ; Point to ereol delay - ld d,(hl) - inc hl - call vidskp - call vidskp - call vidout - pop hl - pop de - pop bc - xor a - dec a - ret - -vidskp: - ld a,(hl) - inc hl - or a - ret z - cp '\' - jr nz,vidskp - inc hl - jr vidskp - -vidout: - ld a,(hl) - or a - jr z,vid2 - inc hl - cp '\' - jr nz,vid1 - ld a,(hl) -vid1: - call conout - jr vidout - -vid2: - ld a,d - or a - ret z - ld c,a - ld hl,z3env+2bh ; Processor speed - ld a,(hl) - or a - jr nz,vidl1 - ld a,4 -vidl1: - ld b,a - push bc - call vdelay - pop bc - dec c - jr nz,vidl2 - ret -vdelay: - call vdel1 - djnz vdelay - ret -vdel1: - ld c,20 -vdel1a: - ex (sp),hl - ex (sp),hl - dec c - jr nz,vdel1a - ret - - endif ;erlquick - endif ;not erltcap - -; -;===== Z 3 L I B R O U T I N E S ================================ -; - -; Disassembly of Z3LIB routines DUTDIR, SHPUSH, SHPOP -; For use with CLED RCP segment ONLY -; Does not save regs as does Z3LIB, and has less env error checking -; rdf 10/2/89 - -DUTDIR: - ld a,z3ndirs ; No NDR - or a - ret z - - ld hl,(z3ndir) - inc b -dutdir1: - ld a,(hl) - or a - jr nz,dutdir2 - dec b - xor a - ret -dutdir2: - cp b - inc hl - jr nz,dutdir3 - ld a,(hl) - cp c - jr nz,dutdir3 - inc hl - dec b - xor a - dec a - ret -dutdir3: - push bc - ld bc,11h - add hl,bc - pop bc - jr dutdir1 - - -shpop: - -; *** -;Special function for RCPCLED -- null saved command line - ld a,(era_flag) ; Erase? - or a - jr z,eflag1 ; Z = NO - xor a - ld (history),a -eflag1: -; *** - -;shpop: - call getsh ; HL -> stack, DE = size, B = entries - ret z ; No stack - ld c,e ; Entry size - ld a,(hl) - or a - ret z ; Empty - ex de,hl - add hl,de ; HL -> next entry, DE -> first entry - xor a -shpop1: - ld (de),a ; Zero entry - dec b - ret z ; Successful exit, no more entries - push bc ; Pop next entry - ld b,0 - ldir - pop bc - jr shpop1 - - -shpush: - push hl ; Save string pointer - call getsh - jr z,shpush_err1 ; No stack - -shpush3: - ld a,(hl) ; Look for free entry - or a - jr z,shpush4 - add hl,de - djnz shpush3 - jr shpush_err2 ; Stack full -shpush4: - call getsh ; Point to top of stack - push bc -shpush5: - dec b - jr z,shpush6 - add hl,de - jr shpush5 -shpush6: - pop bc - ld c,e - dec hl - ex de,hl - add hl,de ; HL -> (entry-1) + size, DE -> (entry-1) - ex de,hl -shpush7: - ld a,b - cp 1 - jr z,shpush8 - dec b - push bc - ld b,0 - lddr - pop bc - jr shpush7 -shpush8: - call getsh - pop de - ex de,hl -shpush9: - ld a,(hl) - ldi - or a - jr nz,shpush9 - -shpushx: - ret - -shpush_err1: -; ld a,1 ; No stack -; jr shpush_err - -shpush_err2: - ld a,2 ; Stack full -shpush_err: - pop hl - or a - ret - - -; Get shell stack entry -; Return HL -> top of stack -; DE = entry size -; C = unchanged -; B = # entries -; A = # entries -; Z = no entries -getsh: -getsh2: - ld hl,(z3env+1eh) ; Stack - ld a,(z3env+20h) ; # entries - ld b,a - ld de,(z3env+21h) ; Entry size in E - ld d,0 - or a - ret - -; -;===== C L O C K R E A D I N G ================================== -; - - if systime - -; Print system time from DateStamper, ZS/ZDDOS/Z3PLUS clock - -; Entry point -; Print the string with leading '0' suppression -; Format: "h.mm " or "hh.mm " - -print_time: - -; 1. Test for DateStamper/ZSDOS/Z3PLUS and read clock if present - - ld c,12 ; Return version - ld e,'D' ; DateStamper test - call bdos - ld a,l ; Version # - cp 30h ; Z3PLUS? - jr nc,time1 ; Yes - ld a,h - cp 'D' - ret nz ; No clock - -; 2. Get time - - ld hl,time2 - push hl ; Return address on stack - push de ; Clock address on stack - ld hl,dtbuf ; Point to buffer - ret ; Call clock, return to time2 -time1: ; Z3PLUS entry point - ld c,105 ; CP/M Plus get time - ld de,dtbuf+1 - push de - call bdos - pop hl - ld a,(hl) - inc hl - ld b,(hl) - dec a - or b - ret z ; No clock if date = 0001 -time2: - -; 3. Turn highlight on, if present - - ld hl,stndout - call printhl - - ld hl,dtbuf+3 ; Point to hours - -; 4. Convert military time to civilian, if selected - - if civtim - ld a,(hl) ; Hours - or a ; Midnight? - jr nz,time3 ; No - ld a,24h ; Yes, say "12" -time3: sub 13h ; Time past 12:59 pm? - jr c,time4 ; No, don't change - daa ; Decimal adjust - inc a ; Yes, xlate to 12-hour - daa - ld (hl),a ; ..and patch in. - endif ; civtim - -; 5. Display time - -time4: - xor a - call pmbcd ; Print hours as 1 or 2 digits - ld a,(tim_sep) ; Print separator between hours, minutes - call conout - inc hl ; Point to minutes - ld a,80h ; Say print leading 0 - call pmbcd ; Print minutes as 2 digits - -; 2. Turn highlight off, if present - - ld hl,stndend - call printhl - jp spac ; Space before rest of prompt - -; -;===== D A T A ==================================================== -; - -; Buffer for date/time for read/write system clock - -dtbuf: ds 6 - - endif ;systime - - -line ds 2 ; Pointer to line buffer -recall_ptr ds 2 ; History position pointer -history ds HISTSIZE,0 ; History buffer -hbuf_top: equ $-1 - -; End RCPCLED.LIB - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpcls.lib b/Source/BPBIOS/Z34RCP11/rcpcls.lib deleted file mode 100644 index e6264137..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpcls.lib +++ /dev/null @@ -1,35 +0,0 @@ - page - -; Library: RCPCLS for Z34RCP -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: CLS -; Function: To clear the CRT screen -; Comments: The setting of the CLSTCAP equate determines whether this -; command uses the TCAP information or not. If not, it uses the -; clear-screen string passed in macro CLSSTR. That string should -; end with the high bit set. - -cls: - if clstcap ; If using TCAP for clear screen string - ld a,(z3tcap) ; TCAP address from Z34CMN.LIB - cp ' '+1 ; See if blank - jr nc,cls1 ; If not, go to clear screen code - jp crlf ; If blank, just do CRLF -cls1: - ld hl,clrscr ; Address from Z34CMN.LIB - jp printhl ; Display it - - else ; Not using tcap - - call print - clsstr ; String from Z34RCP.LIB - ret - - endif ;clstcap - -; End RCPCLS.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpcmd.lib b/Source/BPBIOS/Z34RCP11/rcpcmd.lib deleted file mode 100644 index 58a54e78..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpcmd.lib +++ /dev/null @@ -1,56 +0,0 @@ - page - -; Library: RCPCMD for Z34RCP -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; Description: Command Table and Custom Commands for Z34-RCP - -; This is the customization file for the ZCPR Version 3.4 resident command -; package. Use it to add your own custom commands to the RCP. - -; Give each of your custom commands a unique label and command name. Then -; add the command name(s) to the macro CUSTTBL, below, and append the code -; for the commands to the end of this file. - -; CUSTTBL - Custom commands table. -; -; Add one line to CUSTTBL for each of your custom commands. Each line -; must be of the form: -; -; COMMAND name, TRUE, wheel, label -; -; Where COMMAND and TRUE appear as-is, and "name", "wheel", and "label" -; are created by the user. "Name" is a name of four characters or less used -; to invoke the command, in upper case. "Wheel" is "true" to protect the -; command from non-wheel users, "false" otherwise. "Label" marks the -; beginning of the custom code. For example, to create a wheel- -; protected command named "DIR" which calls the code at label "directory", -; CUSTTBL appears as follows: -; -;custtbl macro -; command DIR, true, true, directory -; endm - -custtbl macro -;; command ____, true, ____, _______ ; Template for custom commands - endm - -; ------------------------------ - -; RCP command dispatch table - - db cmdsize ; Length of each command name - cmdtbl ; Dispatch table from Z34RCP.LIB - custtbl ; Optional custom commands - db 0 ; Marks end of command jump table - -; -------------------------------------------------- - -; Insert label(s) and code for custom RCP commands here: - -; - -; END RCPCMD.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpcp.lib b/Source/BPBIOS/Z34RCP11/rcpcp.lib deleted file mode 100644 index 6ec69f48..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpcp.lib +++ /dev/null @@ -1,245 +0,0 @@ - page - -; Library: RCPCP for Z34RCP -; Author: Carson Wilson -; Version: 1.3 -; Date: August 11, 1989 -; Changes: Responds dynamically to QUIET flag, eliminating "noise." - -; Version: 1.2 -; Date: December 30, 1988 -; Changes: Now works properly with CP/M Plus. -; Moved SETDMA to common routines. - -; Author: Carson Wilson -; Version: 1.1 -; Date: August 4, 1988 -; Changes: Now initializes FCB1 before calling SetFStp, allowing -; stamp setting of multiple-extent files. -; -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: CP -; Function: Copy a file from one place to another -; Syntax: If FCBSWAP false: -; CP destfile=srcfile, CP =srcfile -; If FCBSWAP true: -; CP srcfile destfile, CP srcfile -; If TESTEQ and FCBSWAP true: -; Both of the above forms work -; -; Comments: Both file specifications can include a directory specification. -; If only one file name is given, then the current directory and -; the source file name are assumed for the destination. - -; -; New ZSDOS/DosDisk BDOS standard functions: -; -GetFStp equ 102 ; Get file stamp function -SetFStp equ 103 ; Set file stamp function - -copy: - call retsave - call dirchek ; Test bad directory - - if leftright - call fcbswap ; Exchange fcb1 with fcb2 - endif - -; If new is blank, make it the same name and type as old - - ld de,fcb1+1 ; Point to destination file name - ld a,(de) ; Get first character - cp ' ' ; If not blank (no name) - jr nz,copy0 ; ..then branch to copy - ld hl,fcb2+1 ; Copy source name into destination FCB - ld b,11 ; Name and type are 11 bytes - call blkmov - -; See if destination is same as source, and abort if so - -copy0: - ld hl,fcb1 ; Set up pointers to two files - ld de,fcb2 - push hl - push de - inc hl ; Point to names of files - inc de - ld b,13 ; Compare 13 bytes (name, type, and user #) -copy1: call comp - jr nz,copy2 ; If they differ, go on with copy - ld a,(cdrv) ; ZCPR current drive - inc a ; Shift to range 1..16 - ld b,a ; ..and keep value in B - pop de ; Restore pointers to FCBs - pop hl - ld a,(de) ; Get drive of source file - ld c,a ; ..and save it in C - or a ; Is it default drive? - jr nz,copy1a ; Branch if drive made explicit - ld c,b ; Otherwise, copy default drive into C -copy1a: ld a,(hl) ; Get drive of destination file - or a ; Is it default drive? - jr nz,copy1b ; Branch if drive made explicit - ld a,b ; Otherwise, get current drive -copy1b: cp c ; Compare the two drives specified - jr nz,copy3 ; Branch if they are different - jp duperr ; Tell EH duplicate filespecs -copy2: - pop de ; Clean up the stack - pop hl - -; Make note of the user numbers of the two files - -copy3: - ld a,(fcb1+13) ; Get destination user number - ld (usrdest),a - ld a,(fcb2+13) ; Get source user number - ld (usrsrc),a - -; Set up new FCB for source file and open the source - - call define ; Define buffer addresses dynamically -srcfcb equ $+1 - ld hl,0 ; Get address to use for new source FCB - push hl - ex de,hl ; Copy file data to new FCB - ld b,12 - call blkmov - call logsrc ; Log in user number of source file - pop hl ; Initialize the source file FCB - call initfcb2 - ld c,15 ; Open source file - call bdos - inc a ; Check for error - jp z,noflerr ; File not found error handler - - if StpCall - call cpmver - jr nc,copy4 ; Don't do this if CP/M Plus -stpbuf equ $+1 - ld de,0 - call setdma ; Set DMA to date buffer - ld de,(srcfcb) - ld c,GetFStp ; Get stamp (if any) to DMA - call bdos - ld (gotstp),a ; Store result - ld de,tbuff ; Restore DMA - call setdma ; ..for search -copy4: - endif ; StpCall - -; Make sure destination file does not already exist - - call logdest ; Log into destination user area - call extest ; Test for existence of file in fcb1 - jp z,exit ; Branch if it exists and user says no - -; Create destination file - - ld de,fcb1 ; Point to destination FCB - ld c,22 ; BDOS make-file function - call bdos - inc a ; Test for error (no directory space) - jp z,fulerr ; Invoke EH if not OK - -; Copy source to destination - -copy5: call logsrc ; Log in source user area - ld b,0 ; Initialize counter - ld de,(cbuff) ; Initialize buffer pointer -copy5a: push de ; Save address and counter - push bc - call setdma ; Set DMA to cbuff+(b*128) - ld de,(srcfcb) ; Point to source file FCB - ld c,20 ; BDOS read-sequential function - call bdos - pop bc ; Get counter and address - pop de - or a ; Read Ok? - jr nz,copy5b ; Branch if end of file - ld hl,128 ; Point DE to next buffer address - add hl,de - ex de,hl - inc b ; Increment counter - ld a,b ; See if buffer full - cp cpblocks - jr nz,copy5a ; If not, go back for more -copy5b: ld a,b ; Get count of blocks loaded into buffer - or a ; Are there any? - jr z,copy6 ; Branch if not (we are done) - push bc ; Save count - call logdest ; Log into destination user number -cbuff equ $+1 ; Pointer for in-the-code modification - ld de,0 ; Point to beginning of copy buffer -copy5c: push de ; Save buffer address - call setdma ; Set dma to buffer - ld de,fcb1 ; Point to destination file FCB - ld c,21 ; Sequential write the block - call bdos - or a ; Get result - jp nz,fulerr ; Invoke EH (disk full or write error) - pop de ; Get buffer address & balance stack - pop bc ; Get count - dec b ; Buffer empty? - jr z,copy5 ; Yes. Back for refill - push bc ; No. Save count - ld hl,128 - add hl,de - ex de,hl ; DE points to next buffer address - jr copy5c ; Back for another sector to write - -; Close the destination file - -copy6: call logdest ; Log into destination user number - ld de,fcb1 ; Point to destination FCB - ld c,16 ; Close file - call bdos - inc a ; 0ffh --> 0 if error - jp z,fulerr ; Invoke EH - - if StpCall -gotstp equ $+1 - ld a,0 ; File had stamp? - dec a ; 1 --> 0 = yes - jr nz,noset ; No - ld de,(stpbuf) ; Point to buffer - call setdma ; Set DMA - call initfcb1 ; Init. for SetFStp, point to dest. - ld c,SetFStp ; Set file's stamp - call bdos ; CCP restores DMA -noset: - endif ; StpCall - - ld a,(quiet) - or a - jr nz,qcpdone - call print - db ' Don','e'+80h -qcpdone: - if cpsp and spaceon - jp spaexit ; Report space remaining on destination drive - else - jp exit - endif ;cpsp and spaceon - -; Log into user number of source file - -logsrc: -usrsrc equ $+1 ; Pointer for in-the-code modification - ld a,0 ; Get user number - jr setusrrel ; Local jump to save code - -; Log into user number of destination file - -logdest: -usrdest equ $+1 ; Pointer for in-the-code modification - ld a,0 ; Get user number -setusrrel: - jp setusr - -; End RCPCP.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpdir.lib b/Source/BPBIOS/Z34RCP11/rcpdir.lib deleted file mode 100644 index 76c08bc3..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpdir.lib +++ /dev/null @@ -1,137 +0,0 @@ - page - -; Library: RCPDIR for Z34RCP -; Author: Carson Wilson -; Version: 1.0 -; Date: August 6, 1989 -; Changes: Now allows "DIR [dir:].aft" as well as "DIR [dir:]*.aft" -; to show all files of a given file extentsion, -; e.g., "d .?80" gives all .Z80 and .180 files. -; -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: DIR -; Function: Display a directory of the files on disk -; Syntax: DIR [dir:afn] Displays the DIR files -; DIR [dir:afn] S Displays the SYS files -; DIR [dir:afn] A Display both DIR and SYS files -; -; If slashchk is true: -; -; DIR [dir:]/S Equivalent to DIR [dir:]*.* S -; DIR [dir:]/A Equivalent to DIR [dir:]*.* A - -dir: - call retsave ; Save return address and set stack - -; See if FCB should be made wild (all '?') - - ld hl,fcb1+1 ; Point to file name in FCP - ld a,(hl) ; Get first character of filename - - if slashchk ; Allow "DIR /S" and "DIR /A" formats - cp '/' ; If name does not start with '/' - jr nz,dir01 ; ..branch and process normally - inc hl ; Point to second character - ld a,(hl) ; Get option character after slash - ld (fcb2+1),a ; ..and put it into second FCB - dec hl ; Back to first character - ld a,' ' ; Simulate empty FCB - endif ;slashchk - -dir01: - cp ' ' ; See if no file spec given - jr nz,dir02 ; Spec given - - ld b,8 ; Wildcard name - ld a,(fcb1+9) - cp ' ' ; Wildcard type? - jr nz,dir01a ; No - ld b,11 ; Yes. Fill name and type. -dir01a: ld a,'?' ; Get ready to fill with '?' - call fillp ; ..carry out fill -dir02: - if nosys ; Suppress-SYS-file-if-no-wheel option - call getwhl ; Get wheel status - jr z,dirnly ; If wheel off, ignore options - endif - - ld a,(fcb2+1) ; Get first char of 2nd file name - ld b,1 ; Set for both dir and sys files - cp allflag ; SYS and DIR flag specifier? - jr z,dirpr ; Got system specifier - dec b ; B=0 for sys files only - cp sysflag ; SYS only? - jr z,dirpr - -dirnly: ld b,80h ; Must be dir-only selection - -; DIRECTORY PRINT ROUTINE -; On entry, B reg is set as follows: -; 0 for only system files, 80h for only dir files, 1 for both -; -dirpr: - ld a,b ; Get systst flag - call getdir ; Load and sort directory - jp z,prfnf ; Print no file message - if wide - ld e,5 - else - ld e,4 ; Count down to 0 - endif ; wide -; -; ENTRY PRINT LOOP -; On entry, HL pts to files selected (terminated by 0) -; and E is entry counter -; -dir3: - ld a,(hl) ; Check for done - or a - if dirsp and spaceon - jp z,spaexit ; Show space when done - else - jp z,exit ; Exit if done - endif ; Dirsp and spaceon - ld a,e ; Get entry counter - or a ; Output CRLF if 4 or 5 entries printed in line - jr nz,dir3a ; Continue - call crlf ; New line - if wide - ld e,5 - else - ld e,4 ; Reset entry count - endif ; wide - - ld a,e ; Get entry count -dir3a: - if wide - cp 5 - else - cp 4 ; First entry? - endif ; wide - - jr z,dir4 - call print -; - if wide -; - db ' ' ; 2 spaces - db ' '+80h ; Then 1 more space -; - else -; - db ' ' ; Space - db fence+80h ; Then fence char -; - endif ; Wide -; -dir4: - call prfn ; Print file name - call break ; Check for abort - dec e ; Decrement entry counter - jr dir3 - -; End RCPDIR.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpecho.lib b/Source/BPBIOS/Z34RCP11/rcpecho.lib deleted file mode 100644 index ffe56183..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpecho.lib +++ /dev/null @@ -1,162 +0,0 @@ - page - -; Library: RCPECHO for Z34RCP -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: ECHO -; Function: Echo text to console or printer - -echo: - xor a ; Lower case/printer off flag setting - ld (crtfl),a ; Printer off by default - - if upcase ; If upper case default - dec a - endif ;upcase - - ld (casefl),a ; Store flag in code below - ld hl,tbuff+1 ; Point to first character - call getchar ; Get first character (should be blank) - ; If none, exit from routine - -; Loop to echo chars - -echo2: call getchar - - if echolst - cp ff ; Form feed? - jr z,echo3 - endif ;echolst - - cp '^' - jr nz,echo2a ; Not control character prefix - call getchar ; Get next character - and 1fh ; Convert to control character - jr echo2e ; Echo it -echo2a: - cp cmdchar ; Case shift prefix? - jr nz,echo2e ; No, normal echo - call getchar ; Get next character - - if echolst - cp prtchar ; Turn printer on? - jr z,echo2b ; Store non-zero in crt flag - cp crtchar ; Turn printer off? - jr nz,echo2c ; No, test for shift characters - xor a ; Yes, clear crt flag -echo2b: ld (crtfl),a - jr echo2 ; On to next character -echo2c: - endif ; echolst - - cp ucasechar ; Up-shift character? - jr z,echo2d ; Store non-zero value in case flag - cp lcasechar ; Lower-case character? - jr nz,echo2e ; No, echo the character as is - xor a ; Else, clear case flag -echo2d: ld (casefl),a - jr echo2 ; On to next character -echo2e: - call echout ; Send char - jr echo2 - -; Form feed - send new line followed by form feed if printer output - - if echolst -echo3: - ld a,(crtfl) ; Check for printer output - or a ; Non-zero? - jr z,echoff ; No, send form feed normally - call echonl ; Send new line - ld a,ff ; Send form feed - jr echout - -; Send form feed char to console - -echoff: - ld a,ff ; Get char - jr echo2e - endif ;echolst - -; End of print loop - check for printer termination - -echo4: - if not echolst - ret - - else - ld a,(crtfl) ; Get list mode flag - or a - ret z ; Done if no printer output - -; Output a new line - -echonl: - ld a,cr ; Output new line on printer - call echout - ld a,lf ; Fall thru to echout - endif ; not echolst - -; Output char to printer or console - -echout: - ld c,a ; Char in c - cp 'A' ; If less than 'A' - jr c,echouta ; Leave as is - cp 'Z'+1 ; If greater than 'Z' - jr nc,echouta ; Leave as is - add 20h ; Else convert to lower case -echouta: - ld d,a ; Save lower case version in d -casefl equ $+1 ; Pointer for in-the-code modification - ld a,0 - or a ; Upper case? - jr nz,echoutb ; If upper case selected, go on as is - ld c,d ; Else substitute lower case version -echoutb: - - push hl ; Save hl - push bc ; Save bc - ld de,0ch-3 ; Offset for BIOS console output - - if echolst - -crtfl equ $+1 - ld a,0 - or a ; Printer? - jr z,echout1 ; No - inc de ; Offset for BIOS printer output - inc de - inc de - endif ;echolst - -; Output char in C with BIOS offset in DE - -echout1: - call biout ; Bios output - pop bc ; Restore bc,hl - pop hl - ret - -; Get a character from the command tail buffer - -getchar: - ld a,(hl) ; Get character - inc hl ; Point to next one - or a ; Check for end of string - ret nz ; If not end, return - pop hl ; Else, clean up stack - jr echo4 ; And exit from routine - -; Output char in C to BIOS with offset in DE - -biout: - ld hl,(wboot+1) ; Get address of warm boot - add hl,de ; Pt to routine - jp (hl) ; Jump to it - -; End RCPECHO.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpera.lib b/Source/BPBIOS/Z34RCP11/rcpera.lib deleted file mode 100644 index 776becb8..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpera.lib +++ /dev/null @@ -1,76 +0,0 @@ - page - -; Library: RCPERA for Z34RCP -; Author: Carson Wilson -; Version: 1.2 -; Date: Sept. 15, 1989 -; Changes: Chains to error handler with flag set to invoke transient ERA -; if a read only file is encountered. Propose error code -; 17 decimal for "file read only" error. -; -; Version: 1.1 -; Date: August 12, 1989 -; Changes: Now responds dynamically to QUIET flag, eliminating "noise". -; NOTE: if QUIET is active, using the inspect option or trying -; to erase R/O files will give meaningless messages. Use -; the PROT command to set R/O files to R/W first in order to -; erase them quietly. -; -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: ERA -; Function: Erase files -; Forms: -; ERA Erase Specified files and print their names -; ERA o Erase Specified files and print their names, but ask -; for verification before Erase is done - -era: - call retsave - ld a,(fcb2+1) ; Get eraflg if it's there - ld (eraflg),a ; Save it as a flag - ld a,1 ; Dir files only - call getdir ; Load directory of files - jp z,prfnf ; Abort if no files -; -; Main erase loop -; -era1: call break ; See if user wants to stop - call qplug ; Turn of output if quiet - push hl ; Save ptr to file - call prfn ; Print its name - ld (nxtfile),hl ; Save ptr to next file - pop hl ; Get ptr to this file - call unplug ; Turn output on - call rotest ; Test file pted to by hl for r/o - ld a,17 ; Proposed file R/O error code - ld b,00010000b ; EH flag to invoke transient - jp nz,errex1 ; Chain to transient if R/O -eraflg equ $+1 ; Address of flag - ld a,0 ; 2nd byte is flag - cp ' ' ; Is it an inspect option? - jr z,era2 ; Skip prompt if it is not - call eraq ; Erase? - jr nz,era3 ; Skip if not -era2: ld de,fcb1+1 ; Copy into fcb1 - ld b,11 ; 11 bytes - call blkmov - call initfcb1 ; Init fcb - ld c,19 ; Delete file - call bdos -era3: ld hl,(nxtfile) ; Hl pts to next file - ld a,(hl) ; Get char - or a ; Done? - if erasp and spaceon - jp z,spaexit - else - jp z,exit - endif ; Erasp and spaceon - call crlf ; New line - jr era1 - -; End RCPERA.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcph.lib b/Source/BPBIOS/Z34RCP11/rcph.lib deleted file mode 100644 index 34cae928..00000000 --- a/Source/BPBIOS/Z34RCP11/rcph.lib +++ /dev/null @@ -1,119 +0,0 @@ - page - -; Library: RCPH for Z34RCP -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: HELP -; Function: This command displays a list of all resident commands that -; are supported, including those in the CPR (command processor), -; RCP, and FCP. -; -; Syntax: H - -clist: - -; Print the FCP-resident command names - - if listfcp - call print ; Print header for FCP - db lf - db 'FC','P'+80h - ld hl,(fcp) ; Get FCP address dynamically from ENV - ld a,h ; See if still there - or l - jr z,nofcp ; FCP has been removed - ld bc,5 ; Calculate address of FCP command table - add hl,bc - call cmdlist ; Display list of commands -nofcp: - endif ;listfcp - -; Print the CPR-resident command names - - if listcpr - call print ; Print "CPR" - db cr,lf ; Need CR if no FCP - db 'CP','R'+80h - ld hl,(ccp) ; Get CCP address from ENV - ld bc,offcmd ; Point to command table in CPR - add hl,bc - call cmdlist ; Display the list of commands - endif ;listcpr - -; Print the RCP-resident command names - - call crlf ; Skip a line - ld hl,rcpname ; Print RCP name - call printhl - ld hl,RCPbegin+5 ; Point to RCP command table - ; Fall through to CMDLIST - -;---------------------------------------- - -; Subroutine to display list of commands in a command table (code above -; falls through to this routine -- do not move it). The commands are -; displayed 5 per line with 8 character spaces allowed for each command -; (subject to equates below). - -cmdlist: - call crlf ; Start with new line - ld e,(hl) ; Get size of each command name into DE - ld d,0 - inc hl ; Point to name of first command - ld c,cmdsline ; Set names-per-line value -cmdlist1: - ld a,(hl) ; Get first character of the command name - or a ; See if it is null - jr nz,cmdlist1a ; If not, continue - ld a,cmdsline ; See if we are already on a new line - cp c - call nz,crlf ; If not, skip a line - ret - -cmdlist1a: - if noshow ; Option to suppress wheel-limited cmds - rla ; Shift high bit of name into carry bit - jr nc,cmdlist2 ; If not restricted, go on - call getwhl ; Otherwise, check wheel byte - or a - jr nz,cmdlist2 ; If wheel set, continue as usual - add hl,de ; Otherwise skip this command - jr cmdlist5 - endif - -; Print leading spaces between names - -cmdlist2: - ld a,cmdspace ; Spacing between command names - sub e ; Less length of each command name - ld b,a -cmdlist3: - call spac - djnz cmdlist3 - -; Print name of command - - ld b,e ; Length of each name into B -cmdlist4: - ld a,(hl) ; Get command name character - call conout - inc hl ; Point to next - djnz cmdlist4 - - dec c ; Decrement count of names on this line - jr nz,cmdlist5 ; Branch if room for more names - call crlf ; Otherwise, end this line and - ld c,cmdsline ; ..reset count for another line of commands - -; Skip to next command name - -cmdlist5: - inc hl ; Skip jump vector - inc hl - jr cmdlist1 ; Back to process next name - -; End RCPH.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpid.lib b/Source/BPBIOS/Z34RCP11/rcpid.lib deleted file mode 100644 index dfbacaf2..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpid.lib +++ /dev/null @@ -1,64 +0,0 @@ - page - -; Library: RCPID for Z34RCP -; Author: Carson Wilson -; Version: 1.0 -; Date: September 29, 1989 -; Changes: ID appended with 'C' if CLED is present -; -; Author: Carson Wilson -; Version: 1.0 -; Date: September 14, 1988 -; -; Function: Build the name of the RCP and append it at the end of the -; file at label RCPID. This serves two purposes: first it -; allows the 'H' command to describe which RCP is active, -; second, the string identifies the actual end of the RCP -; in memory. -; -; ------------------------------------------------------------------------ - -; Macros to build RCP ID for Help command - -; Under SLR and compatible assemblers, the RCP name reflects the -; RCP size, e.g., "RCP-21F" means the RCP occupies 21 records. - - if SLR -rcpid macro -rcplen defl RCPend - RCPbegin -fulrecs equ rcplen / 128 ; Full records -lastr equ [rcplen mod 128 + 127]/128 ; Last record, if any -ttlrecs equ fulrecs + lastr - - db 'RCP-' - db ttlrecs / 10 + '0' ; Tens of records - db ttlrecs mod 10 + '0' ; Ones - db rcptype ; 'F', 'H', etc. from RCP.LIB - if cledon - db 'C' ; Distinguish CLED versions - endif - db 0 ; ID string terminator - endm - - else ; Non-SLR -rcpid macro - db 'RCP-' - db rcptype - db 0 - endm - endif ; SLR - -; ----------------------------------------------------------------------- - -; Name of RCP - -; This block allows the 'H' command and/or the SHOW utility to display a name -; and version number for this RCP as well as the commands that are supported. -; It also generates a unique string marking the end of the RCP module. - -rcpname: - rcpid - -; End of RCPID.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpiom.lib b/Source/BPBIOS/Z34RCP11/rcpiom.lib deleted file mode 100644 index d85e553d..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpiom.lib +++ /dev/null @@ -1,296 +0,0 @@ - page - -; Library: RCPIOM for Z34RCP -; Author: Carson Wilson -; Version: 1.1 -; Date: August 12, 1989 -; Changes: POKE and PORT now respond dynamically to QUIET flag, -; eliminating "noise." - -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Commands: PEEK, POKE, and PORT - -; ------------------------------------------------------------------ -; -; Command: PEEK -; Function: Display memory contents -; -; Form: -; PEEK startadr 128 bytes displayed -; PEEK startadr endadr Range of bytes displayed - - if peekon -peek: - call retsave - ld hl,tbuff+1 ; Find first number -nxtpeek equ $+1 ; Pointer for in-the-code modification - ld de,100h ; Default peek address if none - call sksp ; Skip to first token (if any) - call nz,hexnum ; Get start address if any - push de ; Save starting address - ld bc,peeklen ; Compute default ending address - ex de,hl - add hl,bc - - if peekchk ; Check for overflow - jr nc,peek0 ; If no overflow past FFFF, go on - ld hl,0ffffh ; Else use FFFF as ending address -peek0: - endif ;peekchk - - ex de,hl ; End address in DE - call sksp ; Skip to next token (if any) - call nz,hexnum ; Get 2nd number in DE (else default) -peek1: pop hl ; HL is start address, DE is end address - - if peekhdr - push hl ; Save starting address again - ld b,8 ; Output leading spaces -peek0a: call spac - djnz peek0a - ld b,16 ; Display 16 column headers -peek0b: ld a,l ; Get low byte of address - and 0fh ; Display low hex digit - call pashc - inc hl - djnz peek0b -; -; Display header for ASCII area -; - call print - db ' ',' '+80H ; Space over to ASCII area - pop hl ; Get address - push hl - ld b,16 ; Display 16 chars. ASCII header -peek0b1:ld a,l ; Get byte - and 0fh ; Mask - call pah ; Print ASCII char. - inc hl ; Next byte - djnz peek0b1 - - if peekbdr - call crlf - ld b,8 -peek0c: call spac ; Print leading spaces - djnz peek0c - ld b,16 -peek0d: call print - db ' -','-'+80h - djnz peek0d - -; Print border at ASCII area - - call print - db ' ',' '+80h ; Space to ASCII border - ld b,16 ; 16 dashes -peek0e: call print - db '-'+80h - djnz peek0e - endif ;peekbdr - - pop hl ; Restore starting address - endif ;peekhdr - - ld c,0ffh ; Use C as continue flag - call peek2 ; Do peek - ld (nxtpeek),hl ; Set continued peek address - jp exit -peek2: - ld a,c ; Check continuation flag - or a - ret z - -; Print line header - -peek2a: call crlf ; New line - ld a,h ; Print address - call pashc - ld a,l - call pahc - call dash ; Print leader - ld b,16 ; 16 bytes to display - push hl ; Save start address - -; Print hex values for 16 bytes - -peek3: ld a,(hl) ; Get next byte - call pashc ; Print with leading space - -; Check for last address. If C is already 0, leave it that way. -; Otherwise check for end address and if so set C to zero. - - ld a,c ; See if continue flag already cleared - or a - jr z,peek3a ; If so, skip test - ld a,h - sub a,d ; See if h = d - ld c,a - ld a,l - sub a,e ; See if l = e - or c ; Combine two tests - ld c,a -peek3a: inc hl ; Pt to next - djnz peek3 - -; Print ASCII equivalents for 16 bytes - - pop hl ; Pt to first address again - ld b,16 ; 16 bytes - call print ; Space and fence - db ' ' - db fence+80h - push bc ; Save flag in c -peek4: ld a,(hl) ; Get next byte - ld c,'.' ; Assume dot - and 7fh ; Mask it - cp ' ' ; Dot if less than space - jr c,peek5 - cp 7fh ; Don't print del - jr z,peek5 - ld c,a ; Char in c -peek5: ld a,c ; Get char - call conout ; Send it - inc hl ; Pt to next - djnz peek4 - call print ; Closing fence - db fence+80h - pop bc ; Get flag in c back - call break ; Allow abort - jr peek2 - endif ; Peekon - -; PAHC - Print A as 2 hex chars -; PASHC - With leading space - - if peekon or pokeon or porton -pashc: - push af ; Save A - call spac - pop af -pahc: push bc ; Save bc - ld c,a ; Byte in c - rrca ; Exchange nybbles - rrca - rrca - rrca - call pah ; Print hex char - ld a,c ; Get low - pop bc ; Restore bc and fall thru to pah -pah: and 0fh ; Mask - add '0' ; Convert to ascii - cp '9'+1 ; Letter? - jr c,pah1 - add 7 ; Adjust to letter -pah1: jp conout - endif ; Peekon or pokeon or porton - -; -------------------------------------------------------------------- -; -; Command: POKE -; Function: Place Values into Memory -; -; Form: -; POKE startadr val1 val2 ... -; - if pokeon -poke: - call retsave - ld hl,tbuff+1 ; Pt to first char - call sksp ; Skip to non-blank - jp z,numerr ; Numerical error - call hexnum ; Convert to number - call qplug ; Shut off output if quiet - call print - db ' Pok','e'+80h - call adrat ; Print at message (quiet sensitive) - call unplug ; Turn on output - -; Loop for storing hex values sequentially via POKE - -poke1: push de ; Save address - call sksp ; Skip to non-blank - jp z,exit ; Done - cp '"' ; Quoted text? - jr z,poke2 - call hexnum ; Get number - ld a,e ; Get low - pop de ; Get address - ld (de),a ; Store number - inc de ; Pt to next - jr poke1 - -; Store ASCII chars. - -poke2: pop de ; Get next address - inc hl ; Pt to next char -poke3: ld a,(hl) ; Get next char - or a ; Done? - jp z,exit - ld (de),a ; Put char - inc hl ; Pt to next - inc de - jr poke3 - - endif ; Pokeon - -; ------------------------------------------------------------------- -; -; Command: PORT -; Function: Display or Set I/O Port Data -; -; Forms: -; PORT addr - Read port and display value -; PORT addr value - Output value to port -; - if porton -port: - call retsave - ld hl,tbuff+1 ; Find first number - call sksp ; Skip to first command-line token - jp z,numerr ; Numerical error - call hexnum ; Get start address into de - push hl ; Save pointer to command tail - ld hl,portadl ; Modify code - ld (hl),e ; Move specified port addr into place - dec hl ; Point to opcode position - ld (hl),0dbh ; Poke 'in' opcode - dec hl - ld (hl),d ; Save MSB for port address - inc hl - ex (sp),hl ; Get tail pointer back while saving this one - call qplug ; Shut off output if quiet - call print ; Print header - db ' Por','t'+80h - ld a,e - call pashc ; Print port address - call sksp ; Skip to possible second value - jr z,portin ; Proceed with port input - call hexnum ; Get 2nd number in de - ex (sp),hl ; Get pointer to opcode back - ld (hl),0d3h ; Poke 'out' opcode - call print - db ': OU','T'+80h - ld a,e ; Get value to output - jr paddr -portin: - call print - db ': I','N'+80h - xor a ; Make sure high port address = 0 (for hd64180) -portadh equ $+1 -paddr: ld b,0 ; ..for both in and out instructions -opcode: - db 0 ; Opcode for in or out inserted by code above -portadl: - db 0 ; Port address inserted by code above - call pashc - call unplug ; Turn on output - pop hl ; Clean up stack - jp exit - - endif ; Porton - -; End RCPIOM.Z80 - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcplt.lib b/Source/BPBIOS/Z34RCP11/rcplt.lib deleted file mode 100644 index 98d6b0ba..00000000 --- a/Source/BPBIOS/Z34RCP11/rcplt.lib +++ /dev/null @@ -1,256 +0,0 @@ - page - -; Library: RCPLT for Z34RCP -; Author: Carson Wilson -; Version: 1.1 -; Date: August 26, 1989 -; Changes: Some WordStar characters caused garbage to appear on the -; screen. Now filters control characters other than CR, -; TAB, and LF. Thanks to Gene Pizzetta for this suggestion. -; -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Commands: LIST and TYPE - -; ---------------------------------------------------------------- -; -; Command: LIST -; Function: Print out specified file on the LST: Device -; Forms: -; LIST Do form feed -; LIST Print file(s) (NO Paging) -; Notes: -; The flags which apply to TYPE do not take effect with LIST -; The tab expansion code is required for LST: output. - - if liston -list: - ld a,(fcb1+1) ; Get filename or ' ' from command - ld (prflg),a ; List flag (A can't be 0) - cp ' ' ; Null command? - jp z,lstff ; Yes, do form feed and return - jr type0 ; No, send file to LST: - endif ;liston - -; -------------------------------------------------------------------- -; -; Command: TYPE -; Function: Print out specified file on the CON: Device -; Forms: -; TYPE Print file -; TYPE P Print file with paging flag -; Notes: -; The flag PGDFLG defines the letter which toggles the paging -; facility (P in the forms section above) -; The flag PGDFLT determines if TYPE is to page by default -; (PGDFLT=TRUE if TYPE pages by default); combined with -; PGDFLG, the following events occur -- -; If PGDFLT = TRUE, PGDFLG turns OFF paging -; If PGDFLT = FALSE, PGDFLG turns ON paging - -type: - if liston - xor a ; Turn off printer flag - ld (prflg),a ; Set flag - endif ; Liston - -; Entry point for list function (LIST) - -type0: call retsave ; Save return address - ld a,(fcb2+1) ; Get page flag from command - ld (pgflg),a ; Store it - ld a,1 ; Select dir files - call getdir ; Allow ambiguous files (HL points to buffer) - jp z,noflerr ; EH no files error - ld a,(lins) ; Set line count - ld (pagcnt),a - jr typex1 - -; Entry point for successive files - -typex0: pop hl ; Balance stack for skip - pop hl ; ..to next file command (^X) -typex: ld hl,(nxtfile) ; Get ptr to next file - ld a,(hl) ; Any files? - or a - jp z,exit - - if liston - ld a,(prflg) ; Check for lst: output - or a ; 0=type - jr z,typex1 - ld a,cr ; Bol on printer - call lcout - call lstff ; Form feed the printer -; fall thru - endif ; Liston - - ; Entry point for 1st file -typex1: ld de,fcb1+1 ; Copy into fcb1 - ld b,11 ; 11 bytes - call blkmov - ld (nxtfile),hl ; Set ptr to next file - call initfcb1 ; Init fcb1 - ld c,15 ; Open file - call bdos - inc a ; Set error flag - jp z,noflerr ; EH no files error - ld a,cr ; New line - call lcout - ld a,lf - call lcout - ld bc,080h ; Set char position and tab count - ; (b=0=tab, c=080h=char position) - -; Main loop for loading next block - -type2: ld a,c ; Get char count - cp 80h - jr c,type3 - call break - push bc ; Read next block - ld de,fcb1 ; Pt to fcb - ld c,20 ; Read record - call bdos - or a ; Set flags - pop bc - jr nz,typex ; End of file? - ld c,0 ; Set char count - ld hl,tbuff ; Pt to first char - -; Main loop for printing chars in tbuff - -type3: ld a,(hl) ; Get next char - and 7fh ; Mask out msb - cp 1ah ; End of file (^z)? - jr z,typex ; Next file if so - -; Output char to CON: or LST: device with tabulation - - cp cr ; Reset tab count? - jr z,type4 - cp lf ; Reset tab count? - jr z,type4 - cp tab ; Tab? - jr z,type5 - cp ' ' ; Skip other ctls. - jr c,type6 - -; Output char and increment char count - - call lcout ; Output char - inc b ; Increment tab count - jr type6 - -; Output or and reset tab count - -type4: call lcout ; Output or - ld b,0 ; Reset tab counter - jr type6 - -; Tabulate - -type5: ld a,' ' ; - call lcout - inc b ; Incr pos count - ld a,b - and 7 - jr nz,type5 - -; Continue processing - -type6: - inc c ; Increment char count - inc hl ; Pt to next char - jr type2 - -; Send a formfeed to LST:. Assumes PRFLG <> 0. - -lstff: - ld a,ff ; formfeed -; fall thru - -; Send output to LST: or CON:, as per the flag -; Return with Z if abort - -lcout: push hl ; Save regs - push bc - ld e,a ; Char in e - ld c,2 ; Output to con: - - if liston -prflg equ $+1 ; Pointer for in-the-code modification - ld a,0 ; 2nd byte is the print flag - or a ; 0=type - jr z,lc1 - ld c,5 ; Output to lst: - endif ; Liston - -lc1: push de ; Save char - call bdos ; Output char in e - pop de ; Get char - ld a,e - cp lf ; New line? - jr nz,lc2 ; No, return - call break ; Check for abort - jp z,typex0 ; Skip if ^X - - if liston - ld a,(prflg) ; Output to lst:? - or a ; Nz = yes - jr nz,lc2 - endif ; Liston - -; New line, so check for paging - - ld hl,pagcnt - dec (hl) - jr nz,lc2 ; Jump if not end of page - ld a,(lins) - ld (hl),a ; Reset counter -pgflg equ $+1 ; Pointer to in-the-code buffer - ld a,0 ; 2nd byte is the paging flag - cp pgdflg ; Page default override option wanted? - - if pgdflt ; If paging is default - jr z,lc2 ; Pgdflg means no paging - else - jr nz,lc2 ; Pgdflg means page - endif ; Pgdflt - - push hl ; Save hl - call print - db cr,lf,' Typing',' '+80h - ld hl,fcb1+1 ; Print file name - call prfn - call dash ; Print dash - call conin ; Get input - pop hl ; Restore hl - call break1 ; Set Z flag or abort - push af ; Save results - - if typecls and clson - call cls ; Clear between screens - else - call crlf - endif - - pop af ; Get results - jp z,typex0 ; Control-X, so skip to next file - cp ctrlz ; If Control-Z, - jr nz,lc2 - ld a,pgdflg ; Switch to non-default - ld (pgflg),a ; ..paging mode -lc2: pop bc ; Restore regs - pop hl - ret - -; Storage for line counter - -pagcnt: - ds 1 - -; End RCPLT.LIB - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpprot.lib b/Source/BPBIOS/Z34RCP11/rcpprot.lib deleted file mode 100644 index 4e8a5479..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpprot.lib +++ /dev/null @@ -1,130 +0,0 @@ - page - -; Library: RCPPROT for Z34RCP -; Author: Carson Wilson -; Version: 1.1 -; Date: August 12, 1989 -; Changes: Now responds dynamically to QUIET flag, eliminating "noise." - -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: PROT -; Function: To set the attributes of a file (R/O, SYS, and ARC) -; Form: PROT afn RSAI -; Comments: If R, S, or A are omitted, the file is made R/W, DIR, or -; modified, respectively. R, S, A, and I may be in any order. -; If I is present, Inspection is enabled. - -att: - call retsave - call dirchek ; Test bad directory - xor a ; Set no inspect - ld (inspect),a - ld hl,0 ; Set r/o and sys attributes off - ld c,0 ; Set Arc attribute off - ld de,fcb2+1 ; Pt to attributes - ld b,4 ; 4 chars max -att1: - ld a,(de) ; Get char - inc de ; Pt to next - cp 'I' ; Inspect? - jr z,atti - cp 'R' ; Set r/o? - jr z,attr - cp 'S' ; Set sys? - jr z,atts - cp 'A' - jr z,atta -att2: - djnz att1 - jr att3 -atti: - ld (inspect),a ; Set flag - jr att2 -attr: - ld h,a ; Save R/O flag - jr att2 -atts: - ld l,a ; Save SYS flag - jr att2 -atta: - ld c,a ; Save ARC - jr att2 -att3: - ld (fatt2),hl ; Save file attributes - ld a,c - ld (fatt1),a ; Save Arc attribute - ld a,1 ; Select dir and sys files - call getdir ; Load directory - jp z,noflerr ; Tell error handler no file - jr att5 -att4: - ld hl,(nxtfile) ; Pt to next file - ld a,(hl) ; End of list? - or a - jp z,exit - call crlf ; New line -att5: call break ; Check for possible abort - call qplug ; Turn off output if quiet - push hl ; Save ptr to current file - call prfn ; Print its name - ld (nxtfile),hl ; Save ptr to next file - call print - db ' Set to R','/'+80h - ld hl,(fatt2) ; Get attributes - ld c,'W' ; Assume r/w - ld a,h ; Get r/o bit - or a - jr z,att6 - ld c,'O' ; Set r/o -att6: ld a,c ; Get char - call conout - ld a,l ; Get sys flag - or a ; Set flag - jr z,att7 - call print - db ', SY','S'+80h -att7: ld a,(fatt1) - or a - jr z,att7a - call print - db ', AR','C'+80h -att7a: call unplug ; Turn output on -inspect equ $+1 ; Ptr for in-the-code modification - ld a,0 ; Get inspect flag - or a ; Z=no - pop hl ; Get ptr to current file - jr z,att8 - call eraq1 ; Ask for y/n - jr nz,att4 ; Advance to next file if not y -att8: ld de,fcb1+1 ; Copy into fcb1 - ld b,11 ; 11 bytes - call blkmov - ex de,hl - dec hl ; Pt to archive byte -fatt1 equ $+1 - ld a,0 - call attset - dec hl ; Pt to sys byte -fatt2 equ $+1 ; Ptr for in-the-code modification - ld de,0 ; Get attributes - ld a,e ; Get sys flag - call attset ; Set attribute correctly - dec hl ; Pt to r/o byte - ld a,d ; Get r/o flag - call attset - ld de,fcb1 ; Pt to fcb - ld c,30 ; Set attributes - call bdos - jp att4 -attset: - res 7,(hl) ; Clear attribute - or a - ret z ; 0=clear attribute - set 7,(hl) ; Set attribute - ret - -; End RCPPROT.LIB - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpquiet.lib b/Source/BPBIOS/Z34RCP11/rcpquiet.lib deleted file mode 100644 index 9269d241..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpquiet.lib +++ /dev/null @@ -1,49 +0,0 @@ - page - -; Library: RCPQUIET for Z34RCP -; Author: Carson Wilson -; Version: 1.1 -; Date: August 6, 1989 -; Changes: Now "Q R[eset]" and "Q S[et]" just reset and set quiet status -; without showing it, and Q alone (or with any other character, -; e.g., "Q ?") always just shows status. -; Forms: -; Q - Display quiet flag (always) -; Q s - Set quiet flag ON -; Q r - Set quiet flag OFF -; -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: Q -; Function: Set the Quiet flag on or off -; Comments: If QQUIET equate is true, then RCP does not report -; quiet status with the Q command. -; Forms: -; Q - Display quiet flag (if QQUIET false) -; Q s - Set quiet flag ON -; Q r - Set quiet flag OFF - -quset: - ld a,(fcb1+1) ; Get first char - ld b,1 ; Prepare to turn on - cp 'S' ; S-et quiet (ON) - jr z,quset1 - ld b,0 ; Prepare to turn off - cp 'R' ; R-eset quiet (OFF) - jr nz,qmsg ; Neither S nor R, so display -quset1: - ld a,b - ld (quiet),a - ret - -qmsg: -; Print Quiet Flag Message - - ld a,(quiet) - jp tella ; Say " On" or " Off" and return - -; End RCPQUIET.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpr.lib b/Source/BPBIOS/Z34RCP11/rcpr.lib deleted file mode 100644 index e29a4f37..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpr.lib +++ /dev/null @@ -1,108 +0,0 @@ - page - -; Library: RCPR for Z34RCP -; Author: Carson Wilson -; Version: 1.5 -; Date: August 30, 1989 -; Changes: Minor bug fix as suggested by Howard Goldstein. -; -; Version: 1.4 -; Date: August 26, 1989 -; Changes: Now performs reset 37 for ALL drives under CP/M 2.2 or ZRDOS -; to ensure that fast fixed disks are reset under ZRDOS, then -; exits with reset 13 to compensate for bugs in ZRDOS/CP/M 2.2 -; reset 37. Still resets individual drives selectively under -; CP/M Plus and ZS/ZDDOS. - -; Version: 1.3 -; Date: August 11, 1989 -; Changes: Now responds dynamically to QUIET flag, eliminating "noise." -; Now performs reset 37 in ALL cases, reset 13 as well if not -; CP/M Plus or ZSDOS (per suggestion by Howard Goldstein). - -; Version: 1.2 -; Date: December 30, 1988 -; Changes: Now resets single drives under Z3PLUS. - -; Version: 1.1 -; Date: September 11, 1988 -; Changes: Fixed bug which failed to detect ZRDOS. ZRDOS' function -; 37, like CP/M's, is not reliable. - -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: RESET -; Function: Reset the disk system -; Forms: R [d: or dir:] - ZSDOS or CP/M Plus -; R - CP/M 2.2 or ZRDOS -; Comments: ZRDOS does not require a disk system reset when disks are -; changed, but directory programs will not show the correct -; size if this is not done. It is also good practice. Since -; no warm boot is performed, the disk in drive A need not have -; the operating system on it. -; -; Under ZSDOS or CP/M Plus, individual drives may be reset, and -; if RESETSP is true, space remaining is also given. If -; the fast hard disk reset capability is enabled under ZSDOS, -; any "fast" fixed disks are also reset at this time. -; -; NOTE: It is necessary to reset a legal directory or DU when there are -; protected directories. - -reset: ld a,(quiet) - or a ; Skip message if quiet - jr nz,QReset - call print ; Report action - db ' Rese','t'+80h -QReset: call cpmver ; CP/M Plus? - jr nc,reset0 ; Yes - ld c,48 - call bdos ; ZRDOS or CP/M? - ld a,h - or a - jr nz,reset0 ; No, assume bug-free F37 - ld de,0ffffh ; Yes, reset ALL drives, both ways - ld c,37 - call bdos - ld c,13 - jp bdos ; Yes, do regular reset - -; Reset individual drive(s) - -reset0: call dirchek ; Abort with error if illegal drivespec - ld a,(fcb1) ; Use default drive? - or a - jr nz,reset1 ; No, use drive from FCB1 - ld a,(cdrv) ; Yes, get ZCPR 3.3 current drive byte - inc a ; Shift range to 1..16 -reset1: ld hl,1 ; Map drive "A:" -reset2: dec a ; Done yet? - jr z,reset3 ; Yes - add hl,hl ; No, shift vector to next drive - jr reset2 - -; Check for fixed disks - -reset3: push hl ; Save current or specified vector - ld c,39 - call bdos ; ZSDOS return fixed disks in HL - pop de ; Restore vector - ld a,d - or h ; Add any fixed disks - ld d,a - ld a,e - or l - ld e,a - ld c,37 ; Reset individual drive(s) - - if spaceon and resetsp - call bdos - jp crspace ; Show space remaining (QUIET sensitive) - else - jp bdos ; Do reset and return - endif - -; End RCPR.LIB - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpreg.lib b/Source/BPBIOS/Z34RCP11/rcpreg.lib deleted file mode 100644 index d73eee05..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpreg.lib +++ /dev/null @@ -1,165 +0,0 @@ - page - -; Library: RCPREG for Z34RCP -; Version: 1.1 -; Date: August 11, 1989 -; Changes: Register Set, Decrement, and Increment commands now respond -; dynamically to QUIET flag, eliminating "noise." - -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: REG -; Function: Manipulate Memory Registers -; -; Forms: -; REG D or REG <-- Display 10 Register Values -; REG Mreg <-- Decrement Register Value -; REG Preg <-- Increment Register Value -; REG Sreg value <-- Set Register Value -; -; Vers 2.1 Joe Wright -; -; REG reg <-- Display a single register value -; -; REG numbers now range from 0 to 31, although only the first ten are -; displayed with REG D. -; -; REG now treats the program error byte as register E. -; -register: - ld de,fcb1+2 ; Pt to first arg - ld a,(de) ; Get possible digit - call regptr ; Pt hl to potential register - dec de ; Point to command - ld a,(de) - cp 'S' ; Set? - jr z,rset - cp 'P' ; Plus? - jr z,rinc - cp 'M' ; Minus? - jr z,rdec - cp ' ' - jr z,rshow - cp 'D' - jr z,rshow - call regptr - jp regout - -; Increment register value -; HL pts to memory register on input - -rinc: inc (hl) ; Increment it - jr Qregout ; Print result - -; Decrement register value -; HL pts to memory register on input - -rdec: dec (hl) ; Decrement value - jr Qregout ; Print result - -; Show first ten registers and Program Error byte - -rshow: call rshow10 - ld hl,z3msg+6 - jp regout - -rshow10:xor a ; Select register 0 - ld b,a ; Counter set to 0 in b - call regp1 ; Hl pts to register 0 -rshow1: ld a,b ; Get counter value - cp 10 ; First ten registers - ret z ; Exit if done - push bc ; Save counter - push hl ; Save pointer - call regout ; Print register value - pop hl ; Get pointer - pop bc ; Get counter - inc b ; Increment counter - ld a,b ; Check for new line - and 3 - call z,crlf ; Newline after fourth display - inc hl ; Pt to next register - jr rshow1 - -; Set register value -; HL pts to register on input - -rset: - ld de,fcb2+1 ; Pt to value - call de2bin ; Eval string at de to binary in b - ld (hl),b ; Set value - -; Enter with HL pointing to the register. HL is maintained. -; -qregout:ld a,(quiet) - or a - ret nz -regout: call print - db ' Reg',' '+80h - ld de,z3msg+30h ; Register 0 - sbc hl,de ; Register number in hl - ld a,l - cp 32 ; A numbered register? - jr c,rego0 ; Yep - call print - db ' ','E'+80h - jr rego1 ; Report - -rego0: push hl - push de - ld b,0 ; Suppress zeros - call decdsp2 ; Report register number - pop de - pop hl -rego1: add hl,de ; Hl points to register again - call print - db ' =',' '+80h - ld l,(hl) - xor a - ld h,a - ld b,a ; Suppress leading zeros - jp decdsp3 ; Display value - -; Evaluate decimal string at DE to binary in B - -de2bin: ld b,0 ; Init value to zero -de2b: ld a,(de) ; Get this digit - inc de ; Pt to next - sub '0' ; Convert to binary - ret c ; A space, finished - cp 10 ; Range? - ret nc ; Not decimal, finished - ld c,a ; Digit in c - ld a,b ; Multiply old by 10 - add a,a ; *2 - add a,a ; *4 - add a,b ; *5 - add a,a ; *10 - add a,c ; Add in new digit - ld b,a ; Result in b - jr de2b ; Again - -; Set HL to point to memory register whose index is pted to by HL -; On input, A contains register char -; On output, HL = address of memory register (reg 0 assumed if error) - -regptr: ld hl,z3msg+6 ; The e register - cp 'E' - ret z - push de - call de2bin ; Get register number in b - pop de - ld a,b - cp 32 ; Range 0-31 - ld a,0 - jr nc,regp1 ; Out of range, use 0 - ld a,b ; Value in a -regp1: ld hl,z3msg+30h ; Pt to memory registers - add a,l ; Pt to proper register - ld l,a - ret ; No chance of crossing page boundary - -; End RCPREG.LIB - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpren.lib b/Source/BPBIOS/Z34RCP11/rcpren.lib deleted file mode 100644 index 6947bad2..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpren.lib +++ /dev/null @@ -1,100 +0,0 @@ - page - -; Library: RCPREN for Z34RCP -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: REN -; Function: To change the name of an existing file -; Forms: -; LEFTRIGHT false: -; REN = -; LEFTRIGHT true: -; REN -; LEFTRIGHT and TESTEQ both true: -; Either of the above forms may be used. - -ren: - call retsave - call dirchek ; Test bad dirspec - - if leftright - call fcbswap ; Exchange command line fcb's - endif -; -; STEP 1: See if old name is ambiguous -; - ld hl,fcb2+1 ; Can't be ambiguous - call ambchk1 -; -; STEP 2: Log into user area -; -; If dirspec given at old name, use it -; else use dirspec (or default) given at new name. - - ld hl,fcb1 ; Pt to new name - push hl - ld de,fcb2 ; Pt to old name - push de ; Save ptr - ld a,(de) ; Test if dirspec issued - or a ; ..at old name - jr z,ren1 ; No, use user at new name - ld (hl),a ; Stuff drive into new file - ld a,(fcb2+13) ; Yes, log to user area - call setusr ; ..of old name - jr ren2 -; -; Use dirspec at new name (none given at old name) -; -ren1: - ld a,(hl) ; Stuff drive of new name - ld (de),a ; ..into old name - call logusr ; Log to user at new name -ren2: -; -; STEP 3: See if old file is R/O -; - pop de ; Restore ptr to old FCB - push de ; Save it again - ld c,17 ; Look for old file - call bdos - inc a - jr z,rnxit - call getsbit ; Match found, get ptr to entry in tbuff - ex de,hl ; Hl pts to entry - inc hl ; Pt to fn - call rotest ; See if file is r/o - jr nz,rnxit1 ; Abort if so -; -; STEP 4: See if new file already exists -; EXTEST performs a number of checks: -; 1) Ambiguity -; 2) R/O -; 3) If file exists and not R/O, permission to delete -; - call extest - jr z,rnxit1 ; R/o or no permission -; -; STEP 5: Exchange file name fields for rename -; - pop de ; Pt to old - pop hl ; Pt to new - push hl ; Save ptr - ld b,12 ; 12 bytes - call iswap1 -; -; STEP 6: Rename the file -; - pop de ; Get ptr to FCB - ld c,23 ; Rename - call bdos - inc a ; Set zero flag if error -rnxit: - jp z,noflerr ; EH print no source file message -rnxit1: - jp exit - -; End RCPREN.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpsp.lib b/Source/BPBIOS/Z34RCP11/rcpsp.lib deleted file mode 100644 index 0fc5ecf6..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpsp.lib +++ /dev/null @@ -1,163 +0,0 @@ - page - -; Library: RCPSP for Z34RCP -; Author: Carson Wilson -; Version: 1.2 -; Date: August 11, 1989 -; Changes: CRSPACE does nothing if QUIET is true. -; -; Author: Carson Wilson -; Version: 1.1 -; Date: December 30, 1988 -; Changes: Calls CPMVER common routine. -; Sets DMA to TBUFF for CP/M Plus in case we chained to SP. - -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Command: SP -; Function: Shows space remaining on designated drive -; Syntax: SP [DIR:|DU:] -; Comments: This code can be called by several other RCP commands so that -; they can show the space remaining on the disk after their -; operation. - -; Now works with CP/M Plus. - - if [erasp or cpsp or dirsp] -crspace: ; Used to call space after other subroutines - ld a,(quiet) - or a ; Skip if we're being quiet - ret nz - call crlf ; Start new line - jr space0 ; Skip directory check - endif ;[erasp or cpsp or dirsp] -space: - call dirchek ; Abort to EH on bad dirspec -space0: ld a,(fcb1) ; Determine requested drive - or a ; If drive explicitly selected - jr nz,space1 ; ..then skip - ld a,(cdrv) ; Get current drive from ZCPR 3.4 - inc a ; Shift to range 1..16 - -space1: - dec a ; Shift to range 0..15 - ld e,a ; Save in E for selecting disk below - add a,'A' ; Convert to letter and - ld (seldrv),a ; save in message string below - ld c,14 ; BDOS select disk function - call bdos ; Not needed if no drive selected, but smallest - ; ..possible code size this way. - -; Here we extract the following disk parameter information from the disk -; parameter block (DPB): -; BLKSHF: block shift factor (1 byte) -; BLKMAX: max number of blocks on disk (2 bytes) - - call cpmver ; What BDOS is running? - jr nc,isplus - ld c,31 ; BDOS get disk parameters function - call bdos - inc hl ; Advance to block shift factor byte - inc hl - ld a,(hl) ; Get value and - ld (blkshf),a ; ..save it in code below - inc hl ; Advance to max block number word - inc hl - inc hl - ld e,(hl) ; Get value into HL - inc hl - ld d,(hl) - inc de ; Add 1 for max number of blocks - -; Compute amount of free space left on disk - -dfree: - ld c,27 ; BDOS get allocation vector function - push de ; Save BLKMAX value - call bdos ; Get allocation vector into HL - ld b,h ; Copy allocation vector to BC - ld c,l - pop hl ; Restore BLKMAX value to HL - ld de,0 ; Inititialize count of free blocks - -; At this point we have -; BC = allocation vector address -; DE = free block count -; HL = number of blocks on disk - -free1: push bc ; Save allocation address - ld a,(bc) ; Get bit pattern of allocation byte - ld b,8 ; Set to process 8 blocks -free2: rla ; Rotate allocated block bit into carry flag - jr c,free3 ; If set (bit=1), block is allocated - inc de ; If not set, block is not allocated, so - ; ..increment free block count -free3: ld c,a ; Save remaining allocation bits in C - dec hl ; Count down number of blocks on disk - ld a,l ; See if we are down to zero - or h - jr z,free4 ; Branch if no more blocks to check - ld a,c ; Get back current allocation bit pattern - djnz free2 ; Loop through 8 bits - pop bc ; Get pointer to allocation vector - inc bc ; Point to next allocation byte - jr free1 ; Continue by processing next allocation byte - -free4: pop bc ; Clean up stack - ex de,hl ; Free block count to HL -blkshf equ $+1 ; Pointer for in-the-code modification - ld a,0 ; Get block shift factor - sub 3 ; Convert to log base 2 of K per block - jr z,free6 ; Done if single density (1k per block) - -; Convert for blocks of more than 1K each - -free5: add hl,hl - dec a - jr nz,free5 - -; At this point HL = amount of free space on disk in K - -; Display decimal value of HL - -free6: ld b,0 ; Initialize count of digits already printed - ld de,10000 ; Divisor in DE - call decdsp ; Print digit (or space if leading '0') - ld de,1000 - call decdsp - call decdsp3 ; Display hundreds, tens, and units - - call print - db 'k free on ' -seldrv: db 0 ; Modified above to contain drive letter - db ':'+80h - ret - -; CP/M Plus free space calculation - -isplus: ld de,tbuff ; We may have chained to SP - call setdma - ld a,(seldrv) ; Get drive letter - sub 'A' ; Convert to BDOS call value - ld e,a - ld c,2eh ; Get free space call - call bdos - -; Convert 3 byte count of records to K - - ld b,3 ; Total amount to shift -c3fre1: ld hl,tbuff+2 ; Point to buffer start - rr (hl) - dec hl - rr (hl) - dec hl - rr (hl) - djnz c3fre1 - ld hl,(tbuff) ; Get free mod 65536k - jr free6 - -; End RCPSP.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/rcpsubs.lib b/Source/BPBIOS/Z34RCP11/rcpsubs.lib deleted file mode 100644 index 3879e9a2..00000000 --- a/Source/BPBIOS/Z34RCP11/rcpsubs.lib +++ /dev/null @@ -1,1057 +0,0 @@ - page - -; Library: RCPSUBS for Z34RCP -; Author: Carson Wilson -; Version: 1.4 -; Date: October 4, 1989 -; Changes: Added modifications by Rob Friefeld for CLED. -; -; Version: 1.3 -; Date: Sept. 8, 1989 -; Changes: Added ERREX1 routine. RCP now sets bit 4 of the command -; status flag on ambiguous file name errors. Intelligent -; error handlers can interpret this bit and chain to -; more sophisticated transient programs of the same name, -; much the same as CP/M Plus. -; -; Version: 1.2 -; Date: August 12, 1989 -; Changes: Added QPLUG and UNPLUG routines for QUIET operation. - -; Author: Carson Wilson -; Version: 1.1 -; Date: December 30, 1988 -; Changes: Added CPMVER routine to detect CP/M Plus. -; Expanded ZSDOS datestamp buffer to full 128 bytes. -; Now gets CCP address from Z34CMN.LIB instead of calculating -; it from BIOS address, since NZCOM allows nonstandard length -; CCP segments (suggested by Howard Goldstein). - -; Author: Carson Wilson -; Version: 1.0 -; Date: June 15, 1988 -; -; Subroutines for Z34RCP.Z80 - -; ---------------------------------------- - -; Routines to chain to Error Handler (EH) - -; 1. Error codes (from ZCPR34.LBR) - -; ZCPR34 uses the error byte at the beginning of the message buffer as a flag -; to show what kind of error occurred. Advanced error handlers will be able -; to help the user further by suggesting the possible cause of the error. - -ecbaddir equ 2 ; Bad directory specification -- logging of - ; ..user number beyond legal range, - ; ..nonexistent named directory -ecambig equ 8 ; Ambiguous file specification where not - ; ..allowed (SAVE, GET, REN) -ecbadnum equ 9 ; Bad numerical value -- not a number where - ; ..number expected, number out of range -ecnofile equ 10 ; File not found -- REN, TYPE, LIST could not - ; ..find a specified file -ecdiskfull equ 11 ; Disk directory or data area full - ; ..(DOS write error) -ectpafull equ 12 ; TPA overflow error -ecdupspec equ 16 ; Duplicate filespecs (COPY, RENAME) - -; 2. Error Routines - - if cpon or renon or lton or proton -NoFlErr: ; File missing - ld a,ecnofile ; File not found error - jr errexit ; Chain to error handler - endif ; cpon or renon or lton or proton - - if cpon -FulErr: ; Disk or directory full (BDOS write error) - ld a,ecdiskfull ; Disk or data area full - jr errexit ; Chain to error handler -DupErr: ; Duplicate file specs - ld a,ecdupspec ; Duplicate filespec error - jr errexit ; Chain to error handler - endif ; cpon -; -; Check for illegal directory specification under ZCPR 3.4. -; DirChek assumes that FCB's have not been altered since they were -; set by the CCP. Therefore DirChek is called before other BDOS calls. - - if cpon or lton or renon or diron or eraon or proton or reson or spaceon -DirChek: - ld a,(fcb1+15) ; Z34 sets these to non zero - ld hl,fcb2+15 ; ..if illegal dirspecs. found - or (hl) - ret z ; Return if OK - ld a,ecbaddir ; Bad dir. error code -; fall thru - endif -; -; Set error type, then set error, ECP, and external program bits of command -; status flag to tell CCP to go straight to EH. - -ErrExit: - ld b,0 -ErrEx1: ld ix,z3msg ; Point to message buffer - ld (ix+0),a ; First set error type in error byte - ld a,00001110b ; Tell CCP External, No ECP, Error, No shell - or b ; Add any specified bits - ld (ix+3),A ; Set bits in command status flag - jp exit ; Return to CCP - -; ------------------------------------------------------------- - -; Routine to get wheel byte - Returns wheel in A with flags set - -getwhl: - push hl - ld hl,(z3whl) ; Get wheel address from ENV - ld a,(hl) ; Read wheel byte - and a ; Set flags - pop hl - ret - -; ------------------------------ - - if systime ; Time in CLED prompt -; -; PMBCD - Print byte at (HL) to console as 1 or 2 BCD digits. -; -; Entry: A = 80h for leading zero's -; A = 0h for no leading zero's -; -pmbcd: - rld ; Get hi nibble (HL) to low nibble A - or a ; For HD64180 - call nz,decout ; Display if low or high of A not zero - rld ; Get low nibble (HL), from above -decout: - and 00001111b ; Mask high nibble - add a,'0' ; Convert to character - jr conout - endif ; systime - -; Display decimal digit routines - -; Display hundreds, tens, and units digits (assumes flag in B has been set) - - if regon or spaceon -decdsp3: - ld de,100 ; Display hundreds - call decdsp -decdsp2: - ld de,10 ; Display tens - call decdsp - ld a,l ; Get remaining units value -decdsp4: - add a,'0' ; Convert to character - jr conout ; Print it and return - -; --------------------------------- - -; Routine to print any single digit - -; Actually, this routine displays the value of HL divided by DE and leaves the -; remainder in HL. In computing the character to display, it assumes that the -; result of the division will be a decimal digit. If the result is zero, the -; value in the B register, which is the number of digits already printed, is -; checked. If it is zero, a space is printed instead of a leading '0'. If it -; is not zero, the '0' is printed. Whenever any digit (not a space) is -; printed, the value in B is incremented. - - -decdsp: - ld c,'0'-1 ; Initialize digit count - xor a ; Clear carry flag - -decdsp1: - inc c ; Pre-increment the digit - sbc hl,de ; Subtract DE from HL - jr nc,decdsp1 - - add hl,de ; Add back in to produce remainder - ld a,c ; Get decimal digit - cp '0' ; Check for leading 0 - jr nz,decdout ; If not 0, proceed to display it - ld a,b ; Digit printed already? - or a - jr z,spac ; Print leading space if not -decdout: - ld a,c ; Else print real digit - inc b ; Indicate digit printed - jr conout - endif ; regon or spaceon - -; ------------ - -; Print a dash - - if lton or peekon -dash: call print - db ' -',' '+80h - ret - endif ; Lton or peekon - -; ------------------------- - -; Shut off output in QUIET is set. Return Z if QUIET, NZ otherwise. -; Uses: AF - -qplug: - ld a,(quiet) - or a - ret z - ld a,0C9h ; "RET" -qplug1: ld (plug),a - ret - -; -------------------------- - -; Turn on output - -unplug: xor a - jr qplug1 - - -; ------------- - -; Print a space - -spac: ld a,' ' - -; fall thru - -; Console Output Routine - -conout: -plug: db 00h ; Goes to 0C9h to turn off output - putreg ; Save all registers except AF - push af ; Save AF, too - and 7fh ; Mask out MSB - ld e,a ; Transfer character to E - ld c,2 ; BDOS conout function number - call bdos - pop af - getreg ; Restore registers -note: ; Use this RET for NOTE command - ret - -; ------------------------ - -; String printing routines - -; Print string following call (terminated with null or character with the -; high bit set) - -print: - ex (sp),hl ; Get address - call printhl - ex (sp),hl ; Put address - ret - - if whlon or quieton -; -; Routine to say "On" if A is non-zero or "Off" if A is zero. -; Called by WHL and Q commands. - -onmsg: - dc ' On' -offmsg: - dc ' Off' -tella: - ld hl,offmsg ; Prepare to say Off - or a - jr z,printhl ; Say it if A=0 - ld hl,onmsg ; Say On - -; fall thru ; Display message and return - - endif ; whlon or quieton - -; Print string pointed to by HL (terminated with null or character with the -; high bit set) - -printhl: - ld a,(hl) ; Get next character - inc hl ; Point to following one - or a ; See if null terminator - ret z ; If so, we are done - call conout ; Display the character - ret m ; We are done if MSB is set (negative number) - jr printhl ; Back for more - -; ------------------------ - -; Output new line to CON: - -crlf: - call print - db cr,lf+80h - ret - -; Console input - - if eraon or lton or proton or renon or cpon -conin: - push hl ; Save regs - push de - push bc - ld c,1 ; Input - call bdos - pop bc ; Get regs - pop de - pop hl - and 7fh ; Mask msb - cp 61h - ret c - and 5fh ; To upper case - ret - endif ; Eraon or lton or proton or renon or cpon - -; ------------------- - -; Save return address - -retsave: - pop de ; Get return address - pop hl ; Get return address to zcpr3 - ld (z3ret),hl ; Save it - push hl ; Put return address to zcpr3 back - push de ; Put return address back - ret - -; ------------------------------- - -; Test file pted to by HL for R/O -; NZ if R/O - - if renon or cpon or eraon -rotest: - push hl ; Advance to r/o byte - ld bc,8 ; Pt to 9th byte - add hl,bc - ld a,(hl) ; Get it - and 80h ; Mask bit - push af - ld hl,romsg - call nz,printhl ; Print if nz - pop af ; Get flag - pop hl ; Get ptr - ret -romsg: - db ' is R/','O'+80h - -; ----------------------------------------------- - -; Check user to see if he approves erase of file -; Return with Z if yes - -eraq: - call print - db ' - Eras','e'+80h - endif ; Renon or cpon or eraon - - if renon or cpon or eraon or proton -eraq1: - call print - db ' (Y/N/Q)? N',88h ; 88h = backspace - call conin ; Get response - cp 'Q' ; Quit command? - jr z,exit - cp 'Y' ; Key on yes - ret - endif ; Renon or cpon or eraon or proton - -; ------------------------------------- - -; Give space on current disk and return - - if spaceon and [dirsp or cpsp or erasp or resetsp] -spaexit: - call crspace ; Show space remaining -; fall thru - endif ; spaceon and [dirsp or cpsp or erasp or resetsp] - -; -; Exit to ZCPR3 -; -exit: -z3ret equ $+1 ; Pointer to in-the-code modification - ld hl,0 ; Return address - jp (hl) ; Goto ZCPR3 - -; -------------------------------------------------------- - -; Check for user input; if ^X, return with Z, abort if ^C - - if diron or lton or eraon or proton or peekon -break: - push hl ; Save regs - push de - push bc - ld c,11 ; Console status check - call bdos - or a - ld c,1 ; Get char if any - call nz,bdos - pop bc ; Restore regs - pop de - pop hl -break1: cp ctrlc ; Check for abort - jr z,exit ; Exit - cp ctrlx ; Skip? - ret - endif ; Diron or lton or eraon or proton or peekon - -; --------------------- - -; Print address in DE - - if peekon or pokeon -adrat: - call print - db ' at',' '+80h - ld a,d ; Print high - call pahc - ld a,e ; Print low - jp pahc - endif ; Peekon or pokeon - -; -------------------------------------------------- - -; Extract hexadecimal number from line pted to by HL -; Return with value in DE and HL pting to offending char - - if peekon or pokeon or porton -hexnum: - ld de,0 ; De=accumulated value -hnum1: - ld a,(hl) ; Get char - cp ' '+1 ; Done? - ret c ; Return if space or less - inc hl ; Pt to next - sub '0' ; Convert to binary - jr c,numerr ; Return and done if error - cp 10 ; 0-9? - jr c,hnum2 - sub 7 ; A-f? - cp 10h ; Error? - jr nc,numerr -hnum2: - push hl ; Save pointer - ex de,hl - add hl,hl - add hl,hl - add hl,hl - add hl,hl ; De x16 to hl - ld e,a - ld d,0 - add hl,de - ex de,hl ; De = de * 16 + a - pop hl ; Get the pointer - jr hnum1 ; Try again -; -; Number error -; -numerr: - ld a,ecbadnum ; Numeric error - jp errexit ; Chain to error handler - -; Skip to next non-blank - -sksp: - ld a,(hl) ; Get char - inc hl ; Pt to next - cp ' ' ; Skip spaces - jr z,sksp - dec hl ; Pt to good char - or a ; Set eol flag - ret - endif ; Peekon or pokeon or porton - -; ------------------------------------------------------------------------ - -; Test File in FCB for unambiguity and existence, ask user to delete if so -; Return with Z flag set if R/O or no permission to delete - - if renon or cpon -extest: - call ambchk ; Ambiguous file names not allowed - call searf ; Look for specified file - jr z,exok ; Ok if not found - call getsbit ; Position into dir - inc de ; Pt to file name - ex de,hl ; Hl pts to file name - push hl ; Save ptr to file name - call prfn ; Print file name - pop hl - call rotest ; Check for r/o - jr nz,exer - call eraq ; Erase? - jr nz,exer ; Restart as error if no - ld de,fcb1 ; Pt to fcb1 - ld c,19 ; Delete file - call bdos -exok: xor a - dec a ; Nz = ok - ret -exer: - xor a ; Error flag - file is r/o or no permission - ret - -; Check for ambiguous file name in FCB1 -; Return z if so - -ambchk: - ld hl,fcb1+1 ; Pt to fcb - -; Check for ambiguous file name pted to by HL - -ambchk1: - push hl - ld b,11 ; 11 bytes -amb1: ld a,(hl) ; Get char - and 7fh ; Mask - cp '?' - jr z,amb2 - inc hl ; Pt to next - djnz amb1 - dec b ; Set nz flag - pop de - ret -amb2: - pop hl ; Pt to file name - ld a,ecambig ; Ambiguous name error - ld b,00010000b ; Bit 4 tells EH to load transient - jp ErrEx1 ; Chain to error handler - endif ; Renon or cpon - -; --------------------------------------- - -; Init FCB1, return with DE pting to FCB1 - - if eraon or lton or cpon -initfcb1: - ld hl,fcb1 ; Pt to fcb -initfcb2: - push hl ; Save ptr - ld bc,12 ; Pt to first byte - add hl,bc - ld b,24 ; Zero 24 bytes - xor a ; Zero fill - call fillp ; Fill memory - pop de ; Pt to fcb - ret - endif ; Eraon or lton or cpon - -; Fill a region with byte in A - - if eraon or lton or cpon or diron -fillp: - ld (hl),a ; Store byte - inc hl ; Pt to next - djnz fillp ; Count down - ret - endif ; Eraon or lton or cpon or diron - -; --------------------------------------------------------------------- - -; After a search, return NZ set if desired type of file found, Z if not. -; This algorithm looks at the system bit of the located file; this -; bit is set to 1 if the file is a system file and 0 if not a system -; file. The following exclusive or masks are applied to return Z or NZ -; as required by the calling routine: -; -; SYSTEM BYTE: X 0 0 0 0 0 0 0 (AFTER 80H MASK, X=1 IF SYS, 0 IF DIR) -; -; SYS-ONLY : 0 0 0 0 0 0 0 0 (XOR 0 = 0 if X=0, = 80H if X=1) -; DIR-ONLY : 1 0 0 0 0 0 0 0 (XOR 80H = 80h if X=0, = 0 if X=1) -; BOTH : 0 0 0 0 0 0 0 1 (XOR 1 = 81H or 1H, NZ in both cases) - - if diron or eraon or lton or proton or cpon or renon -getsbit: - dec a ; Adjust to returned value - rrca ; Convert number to offset into tbuff - rrca - rrca - and 60h - ld de,tbuff ; Pt to buffer - add a,e ; Add entry offset to base addr - ld e,a ; Result in e - push de ; Save ptr in de - add a,10 ; Add offset of 10 to pt to system byte - ld e,a ; Set address - ld a,(de) ; Get byte - pop de ; Get ptr in de - and 80h ; Look at only system bit -systst equ $+1 ; In-the-code variable - xor 0 ; If systst=0, sys only; if systst=80h, dir - ; Only; if systst=1, both sys and dir - ret ; Nz if ok, z if not ok - -; Log into user area contained in FCB1 - -logusr: - ld a,(fcb1+13) ; Get user number -setusr: - ld e,a - ld c,32 ; Use bdos fct - jp bdos - -; Print file name pted to by HL - -prfn: - call spac ; Leading space - ld b,8 ; 8 chars - call prfn1 - call print - db '.'+80h ; Dot - ld b,3 ; 3 chars -prfn1: ld a,(hl) ; Get char - inc hl ; Pt to next - call conout ; Print char - djnz prfn1 ; Count down - ret - -; Search for first - -searf: - push bc ; Save counter - push hl ; Save hl - call dirchek ; Check bad dirspec - ld c,17 ; Search for first function -searf1: ld de,fcb1 ; Pt to fcb - call bdos - inc a ; Set zero flag for error return - pop hl ; Get hl - pop bc ; Get counter - ret - endif ; Diron or eraon or lton or proton or cpon or renon - -; ------------------------- - -; Copy HL to DE for B bytes - - if diron or eraon or lton or proton or cpon -blkmov: - ld a,(hl) ; Get - ld (de),a ; Put - inc hl ; Pt to next - inc de - djnz blkmov ; Loop - ret - endif ; Diron or eraon or lton or proton or cpon - -; ----------------------------- - -; Print file not found message - - if diron or eraon -prfnf: - call print - db ' No File','s'+80h - jp exit - endif ; Diron or eraon - -; ------------------------------------------------------------------ - -; Define buffers as high as possible in TPA for the following groups -; of commands: -; -; COPY needs SRCFCB, CBUFF, STPBUF (if STPCALL) -; ERA, PROT, LIST/TYPE need DIRBUF and NXTFILE -; DIR needs DIRBUF -; -; If DIRBUF is defined, its value is in HL on return from this code. The DE -; register pair is not changed by the code, but the BC pair is affected. - -dirbufon equ lton or eraon or proton or diron - - if dirbufon -dirbuf: ds 2 ; Address for directory buffer - endif ; dirbufon - - if lton or eraon or proton -nxtfile: ds 2 ; Ptr to next file in list - endif ; eraon or lton or proton - - if cpon or dirbufon or cledon -define: - push de - ld hl,(bdos+1) ; Get bottom of BDOS - ex de,hl ; ..into DE - ld hl,(ccp) ; From Z34CMN.LIB - -; Now we have to compare and pick the lower address as the top of TPA - - push hl ; Save CPR address while comparing - xor a ; Clear the carry flag - sbc hl,de ; Compute (CPR-BDOS) - pop hl ; Restore CPR address - jr c,define1 ; Branch if BDOS address is higher (use CPR) - ex de,hl ; Otherwise use BDOS address -define1: - if cpon - ld de,-36 ; Calculate place for SRCFCB for copy command - add hl,de - ld (srcfcb),hl - - if stpcall - ld de,-128 - add hl,de ; Buffer for datestamps - ld (stpbuf),hl - endif ; stpcall - - if dirbufon - push hl ; Save if needed below - endif ; dirbufon - - ld de,-[cpblocks*128] ; CBUFF can use same space as DIRBUF - add hl,de - ld (cbuff),hl - - if dirbufon - pop hl - endif ; dirbufon - - endif ; cpon - - if dirbufon - ld de,-[maxdirs*11] ; Space for directory buffer - add hl,de - ld (dirbuf),hl - endif ; dirbufon - - pop de - ret - - endif ; cpon or dirbufon or cledon - -; --------------- - -; Search for next - - if diron or eraon or lton or proton -searn: - push bc ; Save counter - push hl ; Save hl - ld c,18 ; Search for next function - jr searf1 - -; Load directory and sort it -; On input, A=SYSTST flag (0=SYS, 1=DIR, 80H=BOTH) -; Directory is loaded into buffer at top of TPA -; Return with ZERO set if no match and HL pts to 1st entry if match - -direrr: - ld a,ectpafull ; Chain to error handler - jp errexit - -getdir: - ld (systst),a ; Set system test flag - call logusr ; Log into user area of fcb1 - call define ; Define buffer addresses - ld (hl),0 ; Set empty - ld bc,0 ; Set counter - call searf ; Look for match - ret z ; Return if not found - -; Step 1: Load directory - -gd1: - push bc ; Save counter - call getsbit ; Check for system ok - pop bc - jr z,gd2 ; Not ok, so skip - push bc ; Save counter - inc de ; Pt to file name - ex de,hl ; Hl pts to file name, de pts to buffer - ld b,11 ; Copy 11 bytes - call blkmov ; Do copy - pop bc ; Get counter - inc bc ; Increment counter - ld hl,maxdirs-1 ; See if count equals or exceeds MAXDIRS - ld a,b ; Check high bytes - sub h - jr c,gd1a ; If carry set, we are OK - ld a,c ; Check low bytes - sub l - jr nc,direrr ; If no carry, jump to error message -gd1a: ex de,hl ; Hl pts to next buffer location -gd2: call searn ; Look for next - jr nz,gd1 - ld (hl),0 ; Store ending 0 - ld hl,(dirbuf) ; Pt to dir buffer - ld a,(hl) ; Check for empty - or a - ret z - -; Step 2: Sort directory - - if dsort - push hl ; Save ptr to dirbuf for return - call diralpha ; Sort - pop hl - endif - - xor a ; Set nz flag for ok - dec a - ret - - -; DIRALPHA -- Alphabetizes directory in DIRBUF; BC contains -; the number of files in the directory -; - if dsort -diralpha: -; -; SHELL SORT -- -; This sort routine is adapted from "Software Tools" -; by Kernigan and Plaugher, page 106. Copyright, 1976, Addison-Wesley. -; - ld h,b ; Hl=bc=file count - ld l,c - ld (num),hl ; Set "NUM" - ld (gap),hl ; Set initial gap to n for first division by 2 - -; For (gap = num/2; gap > 0; gap = gap/2) - -srtl0: -gap equ $+1 ; Pointer for in-the-code modification - ld hl,0 ; Get previous gap - or a ; Clear carry - rr h ; Rotate right to divide by 2 - rr l - - ld a,l ; Test for zero - or h - ret z ; Done with sort if gap = 0 - - ld (gap),hl ; Set value of gap - push hl - pop ix ; Set ix=gap for following loop - -; For (ix = gap + 1; ix <= num; ix = ix + 1) - -srtl1: - inc ix ; Add 1 to ix - push ix - pop de ; IX is in DE - -; Test for ix <= num - -num equ $+1 ; Pointer for in-the-code modification - ld hl,0 ; Number of items to sort - ld a,l ; Compare by subtraction - sub e - ld a,h - sbc a,d ; Carry set means ix > n - jr c,srtl0 ; Don't do for loop if ix > n - ex de,hl ; Set jj = ix initially for first - ; ..subtraction of gap - ld (jj),hl - -; For (jj = ix - gap; jj > 0; jj = jj - gap) - -srtl2: - ld de,(gap) -jj equ $+1 ; Pointer for in-the-code modification - ld hl,0 ; Get jj - - sbc hl,de ; Compute JJ - GAP - ld a,h - ld (jj),hl ; Jj = jj - gap - jr c,srtl1 ; If carry from subtractions, jj < 0 and abort - or l ; Jj=0? - jr z,srtl1 ; If zero, jj=0 and abort - -; Set iy = jj + gap - - ex de,hl ; Jj in de - ld hl,(gap) ; Get gap - add hl,de ; Jj + gap - push hl - pop iy ; IY = iy + gap - -; If (v(jj) <= v(iy)) - - call icompare ; JJ in de, iy in hl - -; ...then break - - jr c,srtl1 - -; ...else exchange - - ld de,(jj) ; Swap jj, iy - push iy - pop hl - call iswap ; Jj in de, iy in hl - -; End of inner-most for loop - - jr srtl2 - -; -; SWAP (Exchange) the elements whose indexes are in HL and DE -; -iswap: - call ipos ; Compute position from index - ex de,hl - call ipos ; Compute 2nd element position from index - ld b,11 ; 11 bytes to flip - endif ; Dsort - endif ; Diron or eraon or lton or proton - - if diron or eraon or lton or proton or renon or (cpon and leftright) -iswap1: - ld a,(de) ; Get bytes - ld c,(hl) - ex de,hl - ld (de),a ; Put bytes - ld (hl),c - inc hl ; Pt to next - inc de - djnz iswap1 - ret - endif ; Diron or eraon or lton or proton or renon - ; ..or (cpon and leftright) - - if leftright and (cpon or renon) -; -; FCBSWAP exchanges 16 byte FCB1 with FCB2 from the command line. -; This allows COPY and REN commands to execute left to right, -; e.g., "cp source dest". Costs 10 bytes. -; -; If TESTEQ is true, then commands containing '=' still execute right -; to left, e.g., "cp dest=source". Costs 11 bytes additional. -; -fcbswap: - if testeq - xor a ; Zero B - ld b,a - ld hl,80h ; Point to command line, length - ld c,(hl) ; Set up for CPIR - ld a,'=' ; Search for '=' - cpir ; '=' found in command? - ret z ; Yes, don't swap - endif ; Testeq - - ld de,fcb1 ; Point to command fcb's - ld hl,fcb2 - ld b,16 ; Exchange them - jr iswap1 - endif ; leftright and (cpon or renon) - - if diron or eraon or lton or proton - if dsort -; -; ICOMPARE compares the entry pointed to by the pointer pointed to by HL -; with that pointed to by DE (1st level indirect addressing); on entry, -; HL and DE contain the numbers of the elements to compare (1, 2, ...); -; on exit, Carry Set means ((DE)) < ((HL)), Zero Set means ((HL)) = ((DE)), -; and Non-Zero and No-Carry means ((DE)) > ((HL)) -; -icompare: - call ipos ; Get position of first element - ex de,hl - call ipos ; Get position of 2nd element - ex de,hl -; -; Compare dir entry pted to by HL with that pted to by DE; -; No net effect on HL, DE; ret w/CARRY set means DE -; Version: 1.2 -; Date: 16 June 1988 -; Changes: Renamed CRT0 to LINS for NZCOM compatibility. -; Added CUSR " " " - -; Author: Carson Wilson -; Version: 1.1 -; Date: 12 June 1988 -; Changes: Added CDRV for various Z34RCP commands. -; Added CRT0 for Z34RCP TYPE command. -; Added Z3TCAP and CLRSCR for Z34RCP CLS command. -; Added QUIET for ZCPR34 time in prompt. -; Added RSDMSG for ZCPR34 time in prompt. - -; Library: Z34CMN.LIB -; Author: Joe Wright -; Date: 23 March 1988 - -; As a replacement for Z3BASE.LIB, some usual equates. - -base equ 0 ; Base Page - -false equ 0 -true equ not false - -no equ false -yes equ true - -off equ false -on equ true - -; Named COMMON declarations start here. For compatibility, these -; are the same names used by Bridger Mitchell's JetLDR. - - common /_ENV_/ -z3env: ; Z3 Environment descriptor -z3envs equ yes ; There is one - -expath equ z3env+9 ; Address of External Path -expaths equ 10 ; Maximum 10 elements for MPATH - -rcp equ z3env+0ch ; Address of RCP -rcps equ yes ; Used as existence test, not size - -fcp equ z3env+12h ; Address of FCB -fcps equ yes ; Used as existence test, not size - -z3ndir equ z3env+15h ; Address of NDR -z3ndirs equ yes ; Used as existence test, not size - -quiet equ z3env+28h ; Quiet flag address - -z3whl equ z3env+29h ; Wheel byte address -z3whls equ yes ; There is a wheel - -lins equ z3env+33h ; CRT text lines address - -ccp equ z3env+3fh ; CCP entry -ccps equ z3env+41h ; Size - -dos equ z3env+42h ; DOS entry (+6) -doss equ z3env+44h ; Size - -bio equ z3env+45h ; BIO entry - -z3tcap equ z3env+80h ; TCAP address - -clrscr equ z3env+97h ; Clear screen string address - - common /_SSTK_/ -shstk: ; Top of Shell stack -shstks equ yes ; There is a shell stack - - common /_MSG_/ -z3msg: ; Message buffer -z3msgs equ yes ; There is one - -cusr equ z3msg+2eh ; Current user -cdrv equ z3msg+2fh ; Current drive - -rsdmsg equ z3msg+3ah ; Reserved bytes - - common /_FCB_/ -extfcb: ; External file control block -extfcbs equ yes ; There is one - - common /_MCL_/ -z3cl: ; Multiple command line -z3cls equ yes ; There is one - - common /_XSTK_/ -extstk: ; External stack -extstks equ yes ; There is one - - common /_BIOS_/ -bios: - - cseg ; Select Code Segment - -; End of Z34CMN.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34defn.lib b/Source/BPBIOS/Z34RCP11/z34defn.lib deleted file mode 100644 index 683fc322..00000000 Binary files a/Source/BPBIOS/Z34RCP11/z34defn.lib and /dev/null differ diff --git a/Source/BPBIOS/Z34RCP11/z34mac.lib b/Source/BPBIOS/Z34RCP11/z34mac.lib deleted file mode 100644 index 8ab3ffbe..00000000 --- a/Source/BPBIOS/Z34RCP11/z34mac.lib +++ /dev/null @@ -1,122 +0,0 @@ - -; Z33MAC.LIB : Macros for use with ZCPR33 - -; General purpose macros - -putreg macro - push hl ; Save registers in order - push de - push bc - endm - -getreg macro - pop bc ; Restore registers in order - pop de - pop hl - endm - -swap macro - rrca ; Exchange nibbles - rrca - rrca - rrca - endm - -;---------------------------------------- - -; Macro for forming option bytes - -; This macro generates a byte with bits corresponding to up to 8 option -; flags. The bits are filled in the order of the parameters and are right -; justified in the byte. - -optflag macro f1,f2,f3,f4,f5,f6,f7,f8 - -flag defl 0 ;; initial value - - irp temp, - - if not nul temp -flag defl flag shl 1 - if temp -flag defl flag or 1 - endif ;;temp - endif ;;not nul temp - - endm ;; irp - - defb low flag - - endm ;; optflag - -;----------------------------------------------------------------------------- - -; Command table entry definition macro - -; Macro to form an entry for one command in the table. The first parameter is -; the name to be used for the command (no quotes); the second parameter is the -; flag that indicates whether or not the command is to be enabled; the third -; parameter is the wheel control flag; and the last parameter is the jump -; address to the code that carries out the command. The command names are -; automatically padded out to the correct length (they will be truncated and -; an error message will result if a command name is too long). The characters -; in the command name are automatically converted to upper case. - -command macro cmdname,enableflag,wheelflag,address - - if enableflag ;; Generate command only if enabled - -whlmask defl wheelflag ;; Initialize variables -count defl cmdsize ;; Initialize to size of each command name - - irpc char,cmdname ;; Repeat over letters in command name - -count defl count - 1 ;; Count down characters in name - - if [ count lt cmdsize ] - - ;; If character is lower case, convert to upper case - - if [ '&char' ge 'a' ] and [ '&char' le 'z' ] - - if whlmask - defb [ '&char' and 5fh ] + 80h - else ;;not whlmask - defb [ '&char' and 5fh ] - endif ;;whlmask - - else ;;not lower case - - if whlmask - defb '&char' + 80h ;; If controlled by wheel, set high bit - else ;;not whlmask - defb '&char' ;; If not restricted, leave high bit clear - endif ;;whlmask - - endif ;;lower case - - endif ;;[ count lt cmdsize ] - -whlmask defl false ;; Turn off high-bit setting after first char - - endm ;irpc - - ;; Pad command name with blanks - - if [ count gt cmdsize ] ;; If we underflowed - *** Command name "&cmdname" is too long / truncated *** - else - rept count - defb ' ' - endm - endif ;[ count gt cmdsize ] - - dw address ;; Dispatch address for command - - endif ;enable - - endm ;command - -; End Z33MAC.LIB - - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp.lib b/Source/BPBIOS/Z34RCP11/z34rcp.lib deleted file mode 100644 index 74908d54..00000000 --- a/Source/BPBIOS/Z34RCP11/z34rcp.lib +++ /dev/null @@ -1,515 +0,0 @@ - -; File: Z34RCP.LIB -; Description: Resident Command Package (RCP) for ZCPR34 -; Version: 1.4 -; Author: Carson Wilson -; Date: October 4, 1989 -; Changes: Added PUSER0 equate suggested by Rob Friefeld. -; -; Version: 1.3 -; Author: Carson Wilson -; Date: September 29, 1989 -; Changes: Added CLED (Command Line Editor Shell) command options -; and equates. -; -; Version: 1.2 -; Author: Carson Wilson -; Date: August 11, 1989 -; Changes: Removed several "quiet" conditional assembly equates as -; we are now sensing the QUIET flag instead. -; Changed default of WHLQUIET to false. -; -; Version: 1.1 -; Author: Carson Wilson -; Date: July 10, 1989 -; Changes: Changed 'S' command name to 'SP'. -; Removed wheel protection from 'Q' command and set QQUIET -; on by default. -; Changed command order. - -; Version: 1.0 -; Author: Carson Wilson -; Date: June 15, 1988 - -; This is the configuration file for the ZCPR Version 3.4 resident command -; package. You should read through this file and set the equates according -; to the features you want to implement. Since most systems have a limited -; amount of space for the resident command package, it will probably be -; impossible to include all features. - -; If you are using an SLR or equivalent assembler, you will be prompted -; at assembly time for which commands to include in the RCP. - -;============================================================================= -; -; A S S E M B L Y O P T I O N S -; -;============================================================================= - -; SLR controls whether special pseudo-ops such as ".printx" and ".accept", -; and complex macros are used at assembly time. For SLR Systems or compatible -; macro assemblers, set this equate to true. - -SLR equ false - -; RCPTYPE is the final character of the RCP name in the H(elp) command, -; and determines the order in which commands are added. - - if SLR -Y equ true -N equ false -H equ 'H' -F equ 'F' - -.accept 'Enter "F" for floppy, "H" for fixed disk version: ',rcptype - else -rcptype equ 'H' ; Floppy disk version - endif ; SLR - -; ZRL controls whether named common labels are used in the code. To create -; absolute code, modify RCPBASE.LIB to reflect your system's addresses, set -; ZRL to false and instruct your assembler to generate absolute code (either -; a .COM or .HEX file). -; -; To create a relocatable file for use with Bridger Mitchell's JetLDR or -; Joe Wright's NZCOM, you must use an assembler which recognizes named -; common blocks. If your assembler has this capability, set ZRL to true -; and instruct the assembler to generate relocatable (.REL) code. - -ZRL equ true - -;============================================================================= -; -; M A C R O S -; -;============================================================================= - -; SLR assemblers allow selection of options during assembly. - - if SLR - -select macro option default comment - .accept comment,option ; Prompt user for selection - endm - - .printx - .printx Answer "Y" to include, "N" to exclude commands: - .printx - - else - -select macro option default comment -option equ default ; Use selections from file - endm - endif ; SLR - -;============================================================================= -; -; R E S I D E N T C O M M A N D S S E L E C T I O N -; -;============================================================================= - -; Commands to include in the resident command package - -; There are some interrelations between a number of the possible resident -; commands. Some are so close (LIST and TYPE) that a single equate controls -; both functions. Others like DIR and ERA share code (both display file -; listings). It is efficient to select or deselect them together. - -; If you are using an SLR or compatible assembler, you will be prompted -; at assembly time for command selections. Otherwise, select commands to -; be included by setting each SELECT macro below to yes or no. - -select CLEDON no 'CLED - command line editor shell? ' -select CLSON yes 'CLS - clear screen? ' -select RESON yes 'R - reset disk system? ' -select SPACEON yes 'SP - show space remaining on disk? ' - - if RCPTYPE='F' ; Assemble in floppy order -select DIRON yes 'D - disk directory? ' -select ERAON yes 'ERA - erase files? ' -select ECHOON yes 'ECHO - send text to screen or printer? ' -select RENON yes 'REN - rename files? ' -select CPON yes 'CP - copy file? ' -select LTON yes 'TYPE - display file on console? ' -select POKEON yes 'POKE - set memory? ' -select PEEKON yes 'PEEK - view memory? ' - else ; Assemble in fixed-disk order -select ECHOON yes 'ECHO - send text to screen or printer? ' -select POKEON yes 'POKE - set memory? ' -select PEEKON yes 'PEEK - view memory? ' -select QUIETON yes 'Q - set or clear quiet status? ' -select DIRON yes 'D - disk directory? ' -select ERAON no 'ERA - erase files? ' -select RENON no 'REN - rename files? ' -select CPON no 'CP - copy file? ' -select LTON yes 'TYPE - display file on console? ' - endif ; RCPTYPE='F' - - if LTON -select LISTON no 'LIST - list to printer? ' - else ; allowed only if TYPE is enabled -LISTON equ no - endif - - if RCPTYPE='F' ; Assemble in floppy order -select QUIETON yes 'Q - set or clear quiet status? ' - endif - -select PROTON no 'PROT - set file attributes? ' -select NOTEON no 'NOTE - command-line comment? ' -select REGON no 'REG - set and display user registers? ' -select WHLON no 'WHL - set or clear wheel status? ' -select PORTON no 'PORT - view and set I/O ports? ' - -;============================================================================= -; -; W H E E L P R O T E C T I O N -; -;============================================================================= - -; To prevent unauthorized users from performing certain dangerous or sensitive -; operations on the computer, ZCPR34 provides the capability of disabling the -; operation of certain commands when the wheel byte is off. In ZCPR30, an -; attempt to use one of these wheel-protected commands when the wheel byte was -; off resulted in an error message. In ZCPR34 things work differently. In the -; same situation, the command simply disappears. In this way a transient -; program or extended command processor function can take over and deal with -; the attempt to use the command in a much more flexible way. -; -; Wheel-protected commands in ZCPR30 had extra code to intercept the function -; and disable it. In ZCPR34, wheel protection is enabled and disabled in a -; different way. To wheel-protect a command the high bit of the first -; character in the command name is set. The command table scanner in ZCPR34 -; will not recognize these commands when the wheel byte is off. Since the same -; command scanner is used to scan the commands in the RCP and FCP (flow control -; package), commands there can be wheel protected in the same way. For skilled -; computer operators it is very easy to use a debugger, file patcher, or disk -; utility to enable and disable wheel protection without having to reassemble -; the CPR, RCP, or FCP. -; -; Because of the way the command scanner works, once wheel protection is -; implemented in the CCP, there is no further code penalty in protecting RCP -; commands. Therefore, we recommend protecting all possibly sensitive -; commands or none. - -wcled equ no ; CLED -wcp equ yes ; CP -wdir equ no ; DIR -wera equ yes ; ERA -wlist equ yes ; LIST -wpeek equ yes ; PEEK -wpoke equ yes ; POKE -wport equ yes ; PORT -wprot equ yes ; PROT -wquiet equ no ; QUIET -wreg equ yes ; REG -wren equ yes ; REN -wspop equ yes ; SPOP -wtype equ yes ; TYPE -whrc equ no ; H - -wheel defl wcp or wdir or wera or wlist or wpeek or wpoke or wport -wheel defl wheel or wprot or wreg or wren or wtype or whrc - -;============================================================================= -; -; C O M M A N D O P T I O N S -; -;============================================================================= - -; Options affecting several commands - -; DSORT includes code to sort file entries for the D, TYPE, LIST, ERA, -; and PROT commands. - -dsort equ yes - -; LEFTRIGHT affects the COPY and RENAME commands. If yes, add code to allow -; CP and REN operations work from left to right, and CP to accept a -; single filespec as its source. -; Examples: -; B0>ren b1:old.nam new.nam Renames B1:old.nam to B1:new.nam -; B0>cp a15:that.fil Copies A15:that.fil to B0: -; B0>cp source.fil dest.fil Copies source.fil to dest.fil - -leftright equ yes - -; If LEFTRIGHT is yes, setting TESTEQ to yes also allows CP and REN commands -; to be processed from right to left if they contain an equal sign ("="). -; Costs 11 bytes. -; Example: -; B0>cp dest.fil=source.fil Copies source.fil to dest.fil - -testeq equ yes - -;----------------------------------------------------------------------------- - -; 'CLS' command - -; This command clears the console screen. It can either use a fixed string -; (for shorter code if the same terminal is always used) or use the TCAP -; entry for automatic adaptation to any terminal. - -clstcap equ true ; Use TCAP for clear-screen string - -; If CLSTCAP is not enabled, then the string below must be provided and -; it must end with a character with the high bit set - - if not clstcap -clsstr macro - db 'Z'-'@'+80h ; Control-Z to clear screen - endm - endif ;not clstcap - -typecls equ true ; Clear between screens when typing files - -;----------------------------------------------------------------------------- - -; 'CP' command - -; This command copies a single file. The destination file can have a different -; name from the source file. Set the size of the memory buffer in K below (do -; not change the second definition). The copy buffer is placed at the top of -; the TPA, where it will generally not interfere with subsequent use of the GO -; command to rerun a program loaded in the TPA. - -cpblocks defl 16 ; Size of copy buffer in K - -cpblocks defl cpblocks * 8 ; Convert to number of records - -; If you will be using a BDOS or RSX which supports new functions 102 (Get -; Stamp) and 103 (Set Stamp), set STPCALL to true, and datestamps of files -; will be preserved across copies. The "last access" stamps of both copies -; are set to the time the copy took place if access stamping is enabled. - -stpcall equ true ; Copy file stamps with functions 102/3 - -;----------------------------------------------------------------------------- - -; 'DIR' command - -; This command displays a sorted listing of the files in a directory. The -; file name buffer is allocated at the top of the TPA so as not to modify -; any program loaded in low memory. Consequently, the size of the buffer -; must be set in advance. - - -maxdirs equ 256 ; Maximum number of names in directory buffer - -nosys equ yes ; suppress 'A' and 'S' options if wheel off - -slashchk equ yes ; allow "DIR /S" or "DIR /A" formats (costs - ; about 12 bytes) - -allflag equ 'A' ; Option character for showing - ; all file (both SYS and DIR) -sysflag equ 'S' ; Option character for showing - ; SYS files only -sortnt equ yes ; Sort file by name then type -wide equ yes ; Make display for 80-column screen -fence equ '|' ; Character to use as fence between columns - ; ..if WIDE is false. - -;----------------------------------------------------------------------------- - -; 'ECHO' command - -; This command sends characters to the console or list device. If ECHOLST is -; enabled, then code is included for sending characters to the LST device. -; Characters normally go the the console device and are normally upper or lower -; case depending on the setting of UPCASE. The command line can have special -; command sequences to toggle the case of the output and to change the -; destination between the console and printer. Any other character following -; the command character will be sent as is. For the normal setting of the -; equates below (upcase/yes, cmdchar/%, prtchar/P, crtchar/C, lcasech/>, -; and ucasech/<) an example command line would be: -; A0:ROOT>ECHO T%>HIS IS A TEST^M^J^IDONE%PONE, TWO, %' ; Character after CASECHAR that toggles - ; subsequent output to lower case - -; ---------------------------------------------------------------------------- - -; 'H' command - -; This command displays a list of the resident commands implemented in the -; system. FCP, CPR, and RCP commands can be displayed. The basic command is -; not optional; it is always included. - -listcpr equ yes ; Include list of CPR-resident commands in - ; display (highly recommended) - -listfcp equ yes ; Include list of FCP-resident commands in - ; display (recommended if there is room) - -noshow equ yes ; Suppress listing commands that are wheel- - ; restricted unless wheel byte is set (i.e., - ; don't show commands that won't run) - -cmdsline equ 5 ; Number of commands on each line of display - -cmdspace equ 8 ; Space in display for each command name - -;----------------------------------------------------------------------------- - -; 'LIST' and 'TYPE' commands - -pgdflt equ yes ; Default to paging of console output - -pgdflg equ 'P' ; Character to toggle paging status - -;---------------------------------------- - -; 'PEEK' command - -peekhdr equ yes ; Label columns in PEEK display - -peekbdr equ yes ; Include line of hyphens under labels - -peekchk equ yes ; If yes, the ending address will be tested to - ; prevent overflow past FFFF (costs 5 bytes) - -peeklen equ 127 ; Display 1 record (128 bytes) as default. - ; PEEK displays in increments of 16 bytes. - ; You may set PEEKLEN for 0 to 65525. - -;---------------------------------------- - -; 'S' command - -; Print disk space with other commands (recommended) - -dirsp equ true ; Show space after DIR -erasp equ true ; Show space after ERA -cpsp equ true ; Show space after CP -resetsp equ true ; Show space after R - -;---------------------------------------- - -; 'WHL' command - -whlquiet equ false ; If true, don't report wheel state with - ; .."WHL password" command (costs 1 byte) - -wpass macro - db 'SYSTEM ' - endm - -;---------------------------------------- - -; 'CLED' command -; -; Command line editing takes place in the line buffer. It does not take up -; room in the RCP. The editor will handle a 255 byte line. Although that -; is larger than the maximum command line size, it allows you to edit a long -; line without deleting something first. The history is kept inside the RCP, -; so its size will depend upon how many other RCP commands are enabled. -; HISTSIZE should be at least as large as the multiple command line buffer -; (204 bytes). - -lbufwid equ 255 ; Line buffer size, byte -histsize equ 204 ; History buffer size, word - -; CLERA controls whether to null the internal history when CLED is exited, or -; to leave it for the next run. Secure systems will want to set it to YES. - -clera equ no ; Erase history on terminating shell - -; CLMIN sets the cutoff for discarding short lines from history recording. -; A setting of 3 would discard a command such as DIR. - -clmin equ 5 ; Discard lines which do not exceed this - -clins equ yes ; Initial insert state ON -clsav equ yes ; Initial history recording ON - -; The appearance of the command line prompt may include the system time if a -; DateStamper or ZS/ZDDOS clock is implemented. The DU:DIR separator character -; can be changed to indicate that CLED is running. - -dudir_sep equ '/' ; DU:DIR separator char -puser0 equ no ; Print user #0 in prompt -systime equ yes ; Include system time in prompt - - if systime -civtim equ yes ; Yes for 12-hr civil time vs. 24-hr military -timesep equ '.' ; Separator between hours and minutes - endif - -; The editor must use EREOL. The VLIB routine to send the EREOL sequence -; to the terminal needs to test for a video delay and the presence of the "/" -; quote character. Most terminals can just print the TCAP sequence as is. If -; that doesn't work, set ERLQUICK to NO. If you are using only one terminal, -; it will be most efficient to set ERLTCAP to NO and use the CLR_EOL macro. - -erltcap equ yes ; Use TCAP routine vs macro - - if erltcap -erlquick equ yes ; Use simplified TCAP routine - else - -clr_eol macro ; Define terminal specific string - dc 1bh,'T' ; ...set high bit on last character - endm - - endif ;erltcap - -;----------------------------------------------------------------------------- - -; Command names - -; The CTABLE macro, which constructs the command dispatch table, includes a -; line for each command, the first parameter of which is the name of the -; command. These names may be changed if you wish. But make sure that you -; do not use a name that is longer than the maximum allowed length. If you -; do, the name will be truncated and a nonfatal error will occur during -; assembly. DO NOT CHANGE ANY PARAMETER OTHER THAN THE COMMAND NAME. Lower -; case letters will be converted to upper case. The macro COMMAND is defined -; in Z34MAC.LIB. - -cmdsize equ 4 ; Length of each command name - -cmdtbl macro - command CLED, cledon, wcled, cled - command CLS, clson, false, cls - command CP, cpon, wcp, copy - command D, diron, wdir, dir - command ECHO, echoon, false, echo - command ERA, eraon, wera, era - command H, true, whrc, clist - command LIST, liston, wlist, list - command NOTE, noteon, false, note - command P, peekon, wpeek, peek - command POKE, pokeon, wpoke, poke - command PORT, porton, wport, port - command PROT, proton, wprot, att - command Q, quieton,wquiet, quset - command R, reson, false, reset - command REG, regon, wreg, register - command REN, renon, wren, ren - command SP, spaceon,false, space - command SPOP, cledon, wspop, shpop - command TYPE, lton, wtype, type - command WHL, whlon, false, whl - endm - -; END Z34RCP.LIB - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp.lib.sav b/Source/BPBIOS/Z34RCP11/z34rcp.lib.sav deleted file mode 100644 index a0272445..00000000 --- a/Source/BPBIOS/Z34RCP11/z34rcp.lib.sav +++ /dev/null @@ -1,515 +0,0 @@ - -; File: Z34RCP.LIB -; Description: Resident Command Package (RCP) for ZCPR34 -; Version: 1.4 -; Author: Carson Wilson -; Date: October 4, 1989 -; Changes: Added PUSER0 equate suggested by Rob Friefeld. -; -; Version: 1.3 -; Author: Carson Wilson -; Date: September 29, 1989 -; Changes: Added CLED (Command Line Editor Shell) command options -; and equates. -; -; Version: 1.2 -; Author: Carson Wilson -; Date: August 11, 1989 -; Changes: Removed several "quiet" conditional assembly equates as -; we are now sensing the QUIET flag instead. -; Changed default of WHLQUIET to false. -; -; Version: 1.1 -; Author: Carson Wilson -; Date: July 10, 1989 -; Changes: Changed 'S' command name to 'SP'. -; Removed wheel protection from 'Q' command and set QQUIET -; on by default. -; Changed command order. - -; Version: 1.0 -; Author: Carson Wilson -; Date: June 15, 1988 - -; This is the configuration file for the ZCPR Version 3.4 resident command -; package. You should read through this file and set the equates according -; to the features you want to implement. Since most systems have a limited -; amount of space for the resident command package, it will probably be -; impossible to include all features. - -; If you are using an SLR or equivalent assembler, you will be prompted -; at assembly time for which commands to include in the RCP. - -;============================================================================= -; -; A S S E M B L Y O P T I O N S -; -;============================================================================= - -; SLR controls whether special pseudo-ops such as ".printx" and ".accept", -; and complex macros are used at assembly time. For SLR Systems or compatible -; macro assemblers, set this equate to true. - -SLR equ true - -; RCPTYPE is the final character of the RCP name in the H(elp) command, -; and determines the order in which commands are added. - - if SLR -Y equ true -N equ false -H equ 'H' -F equ 'F' - -.accept 'Enter "F" for floppy, "H" for fixed disk version: ',rcptype - else -rcptype equ 'F' ; Floppy disk version - endif ; SLR - -; ZRL controls whether named common labels are used in the code. To create -; absolute code, modify RCPBASE.LIB to reflect your system's addresses, set -; ZRL to false and instruct your assembler to generate absolute code (either -; a .COM or .HEX file). -; -; To create a relocatable file for use with Bridger Mitchell's JetLDR or -; Joe Wright's NZCOM, you must use an assembler which recognizes named -; common blocks. If your assembler has this capability, set ZRL to true -; and instruct the assembler to generate relocatable (.REL) code. - -ZRL equ true - -;============================================================================= -; -; M A C R O S -; -;============================================================================= - -; SLR assemblers allow selection of options during assembly. - - if SLR - -select macro option default comment - .accept comment,option ; Prompt user for selection - endm - - .printx - .printx Answer "Y" to include, "N" to exclude commands: - .printx - - else - -select macro option default comment -option equ default ; Use selections from file - endm - endif ; SLR - -;============================================================================= -; -; R E S I D E N T C O M M A N D S S E L E C T I O N -; -;============================================================================= - -; Commands to include in the resident command package - -; There are some interrelations between a number of the possible resident -; commands. Some are so close (LIST and TYPE) that a single equate controls -; both functions. Others like DIR and ERA share code (both display file -; listings). It is efficient to select or deselect them together. - -; If you are using an SLR or compatible assembler, you will be prompted -; at assembly time for command selections. Otherwise, select commands to -; be included by setting each SELECT macro below to yes or no. - -select CLEDON no 'CLED - command line editor shell? ' -select CLSON yes 'CLS - clear screen? ' -select RESON yes 'R - reset disk system? ' -select SPACEON yes 'SP - show space remaining on disk? ' - - if RCPTYPE='F' ; Assemble in floppy order -select DIRON yes 'D - disk directory? ' -select ERAON yes 'ERA - erase files? ' -select ECHOON yes 'ECHO - send text to screen or printer? ' -select RENON yes 'REN - rename files? ' -select CPON yes 'CP - copy file? ' -select LTON yes 'TYPE - display file on console? ' -select POKEON yes 'POKE - set memory? ' -select PEEKON yes 'PEEK - view memory? ' - else ; Assemble in fixed-disk order -select ECHOON yes 'ECHO - send text to screen or printer? ' -select POKEON yes 'POKE - set memory? ' -select PEEKON yes 'PEEK - view memory? ' -select QUIETON yes 'Q - set or clear quiet status? ' -select DIRON yes 'D - disk directory? ' -select ERAON yes 'ERA - erase files? ' -select RENON yes 'REN - rename files? ' -select CPON yes 'CP - copy file? ' -select LTON yes 'TYPE - display file on console? ' - endif ; RCPTYPE='F' - - if LTON -select LISTON no 'LIST - list to printer? ' - else ; allowed only if TYPE is enabled -LISTON equ no - endif - - if RCPTYPE='F' ; Assemble in floppy order -select QUIETON yes 'Q - set or clear quiet status? ' - endif - -select PROTON no 'PROT - set file attributes? ' -select NOTEON no 'NOTE - command-line comment? ' -select REGON no 'REG - set and display user registers? ' -select WHLON no 'WHL - set or clear wheel status? ' -select PORTON no 'PORT - view and set I/O ports? ' - -;============================================================================= -; -; W H E E L P R O T E C T I O N -; -;============================================================================= - -; To prevent unauthorized users from performing certain dangerous or sensitive -; operations on the computer, ZCPR34 provides the capability of disabling the -; operation of certain commands when the wheel byte is off. In ZCPR30, an -; attempt to use one of these wheel-protected commands when the wheel byte was -; off resulted in an error message. In ZCPR34 things work differently. In the -; same situation, the command simply disappears. In this way a transient -; program or extended command processor function can take over and deal with -; the attempt to use the command in a much more flexible way. -; -; Wheel-protected commands in ZCPR30 had extra code to intercept the function -; and disable it. In ZCPR34, wheel protection is enabled and disabled in a -; different way. To wheel-protect a command the high bit of the first -; character in the command name is set. The command table scanner in ZCPR34 -; will not recognize these commands when the wheel byte is off. Since the same -; command scanner is used to scan the commands in the RCP and FCP (flow control -; package), commands there can be wheel protected in the same way. For skilled -; computer operators it is very easy to use a debugger, file patcher, or disk -; utility to enable and disable wheel protection without having to reassemble -; the CPR, RCP, or FCP. -; -; Because of the way the command scanner works, once wheel protection is -; implemented in the CCP, there is no further code penalty in protecting RCP -; commands. Therefore, we recommend protecting all possibly sensitive -; commands or none. - -wcled equ no ; CLED -wcp equ yes ; CP -wdir equ no ; DIR -wera equ yes ; ERA -wlist equ yes ; LIST -wpeek equ yes ; PEEK -wpoke equ yes ; POKE -wport equ yes ; PORT -wprot equ yes ; PROT -wquiet equ no ; QUIET -wreg equ yes ; REG -wren equ yes ; REN -wspop equ yes ; SPOP -wtype equ yes ; TYPE -whrc equ no ; H - -wheel defl wcp or wdir or wera or wlist or wpeek or wpoke or wport -wheel defl wheel or wprot or wreg or wren or wtype or whrc - -;============================================================================= -; -; C O M M A N D O P T I O N S -; -;============================================================================= - -; Options affecting several commands - -; DSORT includes code to sort file entries for the D, TYPE, LIST, ERA, -; and PROT commands. - -dsort equ yes - -; LEFTRIGHT affects the COPY and RENAME commands. If yes, add code to allow -; CP and REN operations work from left to right, and CP to accept a -; single filespec as its source. -; Examples: -; B0>ren b1:old.nam new.nam Renames B1:old.nam to B1:new.nam -; B0>cp a15:that.fil Copies A15:that.fil to B0: -; B0>cp source.fil dest.fil Copies source.fil to dest.fil - -leftright equ yes - -; If LEFTRIGHT is yes, setting TESTEQ to yes also allows CP and REN commands -; to be processed from right to left if they contain an equal sign ("="). -; Costs 11 bytes. -; Example: -; B0>cp dest.fil=source.fil Copies source.fil to dest.fil - -testeq equ yes - -;----------------------------------------------------------------------------- - -; 'CLS' command - -; This command clears the console screen. It can either use a fixed string -; (for shorter code if the same terminal is always used) or use the TCAP -; entry for automatic adaptation to any terminal. - -clstcap equ true ; Use TCAP for clear-screen string - -; If CLSTCAP is not enabled, then the string below must be provided and -; it must end with a character with the high bit set - - if not clstcap -clsstr macro - db 'Z'-'@'+80h ; Control-Z to clear screen - endm - endif ;not clstcap - -typecls equ true ; Clear between screens when typing files - -;----------------------------------------------------------------------------- - -; 'CP' command - -; This command copies a single file. The destination file can have a different -; name from the source file. Set the size of the memory buffer in K below (do -; not change the second definition). The copy buffer is placed at the top of -; the TPA, where it will generally not interfere with subsequent use of the GO -; command to rerun a program loaded in the TPA. - -cpblocks defl 16 ; Size of copy buffer in K - -cpblocks defl cpblocks * 8 ; Convert to number of records - -; If you will be using a BDOS or RSX which supports new functions 102 (Get -; Stamp) and 103 (Set Stamp), set STPCALL to true, and datestamps of files -; will be preserved across copies. The "last access" stamps of both copies -; are set to the time the copy took place if access stamping is enabled. - -stpcall equ true ; Copy file stamps with functions 102/3 - -;----------------------------------------------------------------------------- - -; 'DIR' command - -; This command displays a sorted listing of the files in a directory. The -; file name buffer is allocated at the top of the TPA so as not to modify -; any program loaded in low memory. Consequently, the size of the buffer -; must be set in advance. - - -maxdirs equ 256 ; Maximum number of names in directory buffer - -nosys equ yes ; suppress 'A' and 'S' options if wheel off - -slashchk equ yes ; allow "DIR /S" or "DIR /A" formats (costs - ; about 12 bytes) - -allflag equ 'A' ; Option character for showing - ; all file (both SYS and DIR) -sysflag equ 'S' ; Option character for showing - ; SYS files only -sortnt equ yes ; Sort file by name then type -wide equ yes ; Make display for 80-column screen -fence equ '|' ; Character to use as fence between columns - ; ..if WIDE is false. - -;----------------------------------------------------------------------------- - -; 'ECHO' command - -; This command sends characters to the console or list device. If ECHOLST is -; enabled, then code is included for sending characters to the LST device. -; Characters normally go the the console device and are normally upper or lower -; case depending on the setting of UPCASE. The command line can have special -; command sequences to toggle the case of the output and to change the -; destination between the console and printer. Any other character following -; the command character will be sent as is. For the normal setting of the -; equates below (upcase/yes, cmdchar/%, prtchar/P, crtchar/C, lcasech/>, -; and ucasech/<) an example command line would be: -; A0:ROOT>ECHO T%>HIS IS A TEST^M^J^IDONE%PONE, TWO, %' ; Character after CASECHAR that toggles - ; subsequent output to lower case - -; ---------------------------------------------------------------------------- - -; 'H' command - -; This command displays a list of the resident commands implemented in the -; system. FCP, CPR, and RCP commands can be displayed. The basic command is -; not optional; it is always included. - -listcpr equ yes ; Include list of CPR-resident commands in - ; display (highly recommended) - -listfcp equ yes ; Include list of FCP-resident commands in - ; display (recommended if there is room) - -noshow equ yes ; Suppress listing commands that are wheel- - ; restricted unless wheel byte is set (i.e., - ; don't show commands that won't run) - -cmdsline equ 5 ; Number of commands on each line of display - -cmdspace equ 8 ; Space in display for each command name - -;----------------------------------------------------------------------------- - -; 'LIST' and 'TYPE' commands - -pgdflt equ yes ; Default to paging of console output - -pgdflg equ 'P' ; Character to toggle paging status - -;---------------------------------------- - -; 'PEEK' command - -peekhdr equ yes ; Label columns in PEEK display - -peekbdr equ yes ; Include line of hyphens under labels - -peekchk equ yes ; If yes, the ending address will be tested to - ; prevent overflow past FFFF (costs 5 bytes) - -peeklen equ 127 ; Display 1 record (128 bytes) as default. - ; PEEK displays in increments of 16 bytes. - ; You may set PEEKLEN for 0 to 65525. - -;---------------------------------------- - -; 'S' command - -; Print disk space with other commands (recommended) - -dirsp equ true ; Show space after DIR -erasp equ true ; Show space after ERA -cpsp equ true ; Show space after CP -resetsp equ true ; Show space after R - -;---------------------------------------- - -; 'WHL' command - -whlquiet equ false ; If true, don't report wheel state with - ; .."WHL password" command (costs 1 byte) - -wpass macro - db 'SYSTEM ' - endm - -;---------------------------------------- - -; 'CLED' command -; -; Command line editing takes place in the line buffer. It does not take up -; room in the RCP. The editor will handle a 255 byte line. Although that -; is larger than the maximum command line size, it allows you to edit a long -; line without deleting something first. The history is kept inside the RCP, -; so its size will depend upon how many other RCP commands are enabled. -; HISTSIZE should be at least as large as the multiple command line buffer -; (204 bytes). - -lbufwid equ 255 ; Line buffer size, byte -histsize equ 204 ; History buffer size, word - -; CLERA controls whether to null the internal history when CLED is exited, or -; to leave it for the next run. Secure systems will want to set it to YES. - -clera equ no ; Erase history on terminating shell - -; CLMIN sets the cutoff for discarding short lines from history recording. -; A setting of 3 would discard a command such as DIR. - -clmin equ 5 ; Discard lines which do not exceed this - -clins equ yes ; Initial insert state ON -clsav equ yes ; Initial history recording ON - -; The appearance of the command line prompt may include the system time if a -; DateStamper or ZS/ZDDOS clock is implemented. The DU:DIR separator character -; can be changed to indicate that CLED is running. - -dudir_sep equ '/' ; DU:DIR separator char -puser0 equ no ; Print user #0 in prompt -systime equ yes ; Include system time in prompt - - if systime -civtim equ yes ; Yes for 12-hr civil time vs. 24-hr military -timesep equ '.' ; Separator between hours and minutes - endif - -; The editor must use EREOL. The VLIB routine to send the EREOL sequence -; to the terminal needs to test for a video delay and the presence of the "/" -; quote character. Most terminals can just print the TCAP sequence as is. If -; that doesn't work, set ERLQUICK to NO. If you are using only one terminal, -; it will be most efficient to set ERLTCAP to NO and use the CLR_EOL macro. - -erltcap equ yes ; Use TCAP routine vs macro - - if erltcap -erlquick equ yes ; Use simplified TCAP routine - else - -clr_eol macro ; Define terminal specific string - dc 1bh,'T' ; ...set high bit on last character - endm - - endif ;erltcap - -;----------------------------------------------------------------------------- - -; Command names - -; The CTABLE macro, which constructs the command dispatch table, includes a -; line for each command, the first parameter of which is the name of the -; command. These names may be changed if you wish. But make sure that you -; do not use a name that is longer than the maximum allowed length. If you -; do, the name will be truncated and a nonfatal error will occur during -; assembly. DO NOT CHANGE ANY PARAMETER OTHER THAN THE COMMAND NAME. Lower -; case letters will be converted to upper case. The macro COMMAND is defined -; in Z34MAC.LIB. - -cmdsize equ 4 ; Length of each command name - -cmdtbl macro - command CLED, cledon, wcled, cled - command CLS, clson, false, cls - command CP, cpon, wcp, copy - command D, diron, wdir, dir - command ECHO, echoon, false, echo - command ERA, eraon, wera, era - command H, true, whrc, clist - command LIST, liston, wlist, list - command NOTE, noteon, false, note - command P, peekon, wpeek, peek - command POKE, pokeon, wpoke, poke - command PORT, porton, wport, port - command PROT, proton, wprot, att - command Q, quieton,wquiet, quset - command R, reson, false, reset - command REG, regon, wreg, register - command REN, renon, wren, ren - command SP, spaceon,false, space - command SPOP, cledon, wspop, shpop - command TYPE, lton, wtype, type - command WHL, whlon, false, whl - endm - -; END Z34RCP.LIB - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp11.doc b/Source/BPBIOS/Z34RCP11/z34rcp11.doc deleted file mode 100644 index 92195c5d..00000000 --- a/Source/BPBIOS/Z34RCP11/z34rcp11.doc +++ /dev/null @@ -1,429 +0,0 @@ - - ZCPR Version 3.4 Resident Command Package - Source Code - - Revised Documentation for Version 1.1 - October 7, 1989 by Carson Wilson - - Version 1.0 Documentation - June 17, 1988 by Carson Wilson - - - Contents - -------- - - 1. Files in this Library. - - 2. Purpose of the Resident Command Package. - - 2.1. "Resident" vs. "Transient" Commands. - - 2.2. The Z-System Resident Command Package. - - 2.2.1. Design Philosophy of the Z34 RCP. - - 3. Structure and Operation of the RCP Segment. - - 4. Generating an RCP for your System. - - 4.1. The Z-Relocatable Approach. - - 4.1.1. NZCOM and JetLDR. - 4.1.2. Z-Relocatable (ZRL) Code - - 4.2. The Assembly Approach. - - 4.2.1. Note on Assemblers. - 4.2.2. Assembly to Absolute Code. - 4.2.3. Assembly to Z-Relocatable Code. - 4.2.4. Adding Custom Commands to Z34RCP. - - 5. Legal Use of These Files. - - - -1. Files in this Library. - -This library of files contains the assembler source code and -accompanying documentation for the Z-System Resident Command -Package (RCP). To use Z34RCP you must be running ZCPR versions -3.3 or above. For pre-assembled Z-Relocatable (ZRL) RCPs, see -RCPZRL11.LBR. Z34RCP11.LBR consists of the following files -(uncompress with UNCR.COM, QL.COM or LBRE.COM): - -CLEDINST.CZM - Installer for CLED command. -CLEDSAVE.CZM - Command file utility for CLED. -RCPCLED .DZC - Documentation on CLED. -RCPBASE .LZB - Used to assemble an absolute address RCP. -RCPCMD .LZB - Used to include custom commands in the RCP. -RCP?????.LZB - Code modules for the standard RCP commands. -SYSDEF .LZB - Commonly used equates. -Z34CMN .LZB - Used to assemble Z-Relocatable RCP's. -Z34DEFN .LZB - Offsets in the ZCPR 3.4 code. -Z34MAC .LZB - Assembler macros. -Z34RCP11.DZC - This file. -Z34RCP11.FOR - Short description of the library. -Z34RCP11.HZP - Help file for the RCP, gives command syntax and - examples. -Z34RCP .LZB - Used to select features when assembling the RCP. -Z34RCP11.NZW - Changes since Z34RCP10.LBR. Intended for former - RCP users, this will be only of passing interest - to new users. -Z34RCP11.ZZ0 - Main file for assembling the RCP. -ZSYSTEM .AZ - General information about Z System. - - -2. Purpose of the Resident Command Package. - - 2.1. "Resident" vs. "Transient" Commands. - -Most of the commands used under CP/M and Z-System are "transient" -commands. The machine code for these commands (or "programs") is -stored in "command files," whose file type is normally .COM. -Thus, the machine code for WordStar is stored in a file called -"WS.COM". - -To run WordStar, the user issues the command "WS" at the command -line, the operating system loads WS.COM from the disk drive to -memory, and WS.COM takes over control of the computer. If the -user then exits WordStar and issues another command, the -operating system can load another command file from the disk, -reusing the area of memory previously occupied by WordStar. - -Recycling memory in this way makes personal computers quite -versatile, as the number of commands available to the user is -only limited to the number of command files stored on disk. -There are some drawbacks to this approach, however. Although -disk-based commands conserve memory by recycling it, they must be -loaded from disk each time they operate. This creates its own -costs in terms of speed of execution, disk storage space, and -memory reallocation. - -The most obvious disadvantage of loading a file from disk each -time a command is issued is that it takes time to find and load -disk files. Especially with floppy diskettes, the amount of time -which elapses after the command is issued and before the command -executes is significant. A second drawback to disk-based -commands is that commands will not execute unless their machine -code is available on the disk system. This means that the user -must know what command files are available on disk before issuing -commands. The final disadvantage of disk file based commands is -that some commands (e.g., SAVE) require that the area of memory -normally overwritten by command files (known as the "Transient -Program Area" or TPA) be preserved. - -In answer to these difficulties, the creators of CP/M designed -some of its commands as "built-in" commands. The DIR, REN, SAVE, -ERA, USER, and TYPE commands of CP/M 2.2 remain in memory and can -be issued without loading machine code files from disk. Thus, -the DIR command provides a disk directory regardless of whether -the command file "DIR.COM" is present on disk, and the SAVE -command saves the contents of memory at 100 hex to a disk file. -Residing permanently in memory, these commands are simple in -order to leave memory for disk-based commands to load in. - - 2.2. The Z-System Resident Command Package. - -The creators of Z-System have followed the resident command -philosophy of CP/M, extending and enhancing the capabilities of -resident commands with the Z-System Resident Command Package. -Under CP/M 2.2, resident commands are tightly integrated with the -operating system. The user is therefore limited to a fixed set -of resident commands. The code in the Z-System Resident Command -Package is much more loosely linked with the operating system. - -The RCP occupies a section of protected memory, but how that -memory is used is only very loosely constrained. The Z-System -resident command package may be tailored for a wide variety of -installations, and easily altered within a single installation. - - 2.2.1. Design Philosophy of the Z34 RCP. - -Though any set of commands which will fit in the RCP memory area -can be loaded as an RCP, a standard set of Z-System RCP commands -have evolved over the years. Distributed as the standard -Z-System RCP, this set of commands consists of universal, -single-purpose commands modeled after the resident command set of -CP/M 2.2, such as DIR, REN, and ERA. - -Keeping these commands simple both conserves memory and allows -their use in custom command scripts. None of the standard RCP -commands require interaction on the part of the user--they -perform a single function and quit. Aliases or other command -scripts which build complex commands from simple RCP commands -therefore retain complete control over the user interface. - -However, the standard RCP forms only one of many alternative uses -to which the Z-System RCP memory segment may be put. Since the -RCP memory is protected, it can be used by background programs -which continue to function even while other applications have -been loaded into the transient program area. Several such -programs, including key-redefiners, screen-trapping programs, -background numeric calculators, program assembly environments, -and memory utilities have been developed. - -Until Z34RCP, all but the most advanced users had to surrender -their entire RCP to use the custom commands, even if the commands -needed far less than the available RCP space. Thus, to use a -key-redefinition RCP, one was forced to give up all of his other -RCP commands. Z34RCP solves this problem by acting as a base to -which programmers may easily add code. By modifying the standard -file RCPCMD.LIB, programmers can implement and distribute custom -RCP commands which may be installed by those with only basic -knowledge of assembly language. See "Adding Custom Commands," -below, for details. - - -3. Structure and Operation of the RCP Segment. - -Typically, the Resident Command Package occupies 2 kilobytes of -memory, protected above the system's Basic Input Output System -(BIOS). Its internal structure is very simple, consisting of the -five byte string "Z3RCP", a table of command names and their -addresses within the RCP, and the machine code of the commands -themselves. This means that an RCP of a given length can contain -any number of resident commands which will fit in 2k, from one -large program to many shorter programs. - -Further, since the RCP is independent of the rest of the -operating system, the resident commands may be changed at will. -On system startup, a default RCP is loaded into memory. -Thereafter the RCP's commands remain active until the system is -turned off or another RCP is loaded. - -Using loader programs to load the RCP to memory allows another -important ability--it can exchange RCPs during a single session. -By allowing users to change their RCPs "on-the-fly," loader -programs provide some of the benefits of transient commands even -while preserving the benefits of resident commands. In fact, -even what portion of memory is allocated to the RCP can be -altered in this way by advanced users! (see the Z-System User's -Manual for more on this). - - -4. Generating an RCP for your System. - -Since Z80 computers come with a wide variety of operating system -environments, it is impossible for a single segment of machine -code function as a universal RCP. Due to differences in -operating system and hardware design, the size and location of -memory available to the Z-System RCP vary widely. Until -Z34RCP, this meant that each type of Z80 computer required an RCP -segment assembled specifically for that computer. - -Now, however, there are two basic means by which you may generate -an RCP for your system. The simplest route is to load already- -assembled Z-Relocatable code modules. This technique is -recommended for beginners and those with little experience in -assembly language. See RCPZRL11.LBR for pre-assembled RCP -modules. For more experienced users with an interest in -customizing or their RCPs or adding their own commands, custom -assembly of the files in this library is also an option. - - 4.1. The Z-Relocatable Approach. - - 4.1.1. NZCOM and JetLDR. - -LDR.COM, the familiar Z-System segment loader first introduced by -Rick Conn as a means of loading the various segments of the ZCPR -environment from disk to memory, required that system segments be -assembled to run only at system-specific addresses. For example, -if the system's RCP started at FA00 hex, only an RCP assembled to -run at that starting address would function on the system. -Therefore, separate SYS.RCP files were needed for each computer -installation. - -Thanks to several advanced loader utilities, namely NZCOM by Joe -Wright and JetLDR and Z3PLUS by Bridger Mitchell, custom- -assembling an RCP for a given target machine is no longer -necessary. These three programs can load specially assembled RCP -segments (known as Z-ReLocatable or "ZRL" segments) to any area -of memory. Z-System users now need only obtain previously -assembled RCP segments, much as they need only obtain assembled -.COM or .OBJ files to run transient programs. - -Using information in the system's environmental descriptor, -advanced loaders load pre-assembled segments to the proper -addresses in any system. The only remaining constraint is the -amount of memory allocated to the RCP. While the standard RCP -size is 2 kilobytes, many Z-System installations vary -considerably from this standard, so it is still necessary to -ensure that a ZRL segment does not exceed available RCP memory. -Fortunately, this is taken care of automatically by the advanced -loader programs. - -Using NZCOM or JetLDR, it is possible to load an RCP directly -from RCPZRL11.LBR. See NZCOM or JetLDR documentation for full -instructions on how to load Z-Relocatable RCPs with these -programs. - - 4.1.2. Z-Relocatable (ZRL) Code - -The technique used by NZCOM and JetLDR to load a single RCP to -any address in memory involves relocatable code. Relocatable -code has been used for years by the "linker" programs available -to assembly language programmers. Since only portions of a given -Z80 machine code routine are specific to one memory address, it -is possible to create "relocatable" files of Z80 routines (known -by their file type .REL) containing all but the address-specific -codes. These files can then be very quickly relocated (or -"linked") by a linker program to operate at any memory address. - -Z-Relocatable code is simply a more sophisticated form of -relocatable code. ZRL files contain separately labeled segments, -known as "named common blocks." Where normal relocatable code is -all linked to operate at one address at a time by the linker -program, named common blocks allow the linker to distinguish -between different sections of the file and to link each "block" -to operate at a different address. - -This represents a major step forwards in user convenience, and -will certainly lead to more innovative work using the ZCPR system -segments. There is a minor drawback, however, inherent in the -form of assembly required by NZCOM and JetLDR. Before the advent -of these two programs, system segments were equivalent to .COM -files which were assembled to operate at addresses other than the -standard 100 hex. The ability to load a single system segment to -any address depends partially on the form of the assembled system -segment itself. - -While public domain assemblers will produce absolute object -files, more sophisticated assemblers, such as SLR's Z80ASM (a -bargain at $50) are required to assemble code with named common -addresses. NZCOM and JetLDR thus greatly reduce the time needed -by most users to install Z-System segments, but those wishing to -assemble Z-Relocatable segments will probably need a commercial -assembler. - - 4.2. The Assembly Approach. - -Those with knowledge of assembly language may opt to assemble -their own custom RCPs, including only the commands and options -which match their exact requirements. Z34RCP.LBR contains the -complete source to the ZCPR 3.4 RCP. The file Z34RCP.Z80 -contains include statements to combine the various library files -during assembly. The file Z34RCP.LIB contains all of the equates -controlling assembly time options, and should be edited before -assembling Z34RCP.Z80. - - 4.2.1. Note on Assemblers. - -The development work on Z34RCP was done exclusively with the SLR -Systems line of Z80 assemblers. Hence, some of the source code -is unavoidably specific to SLR and compatible assemblers. Those -using incompatible assemblers such as public-domain Z80 -assemblers should set the SLR equate in Z34RCP.LIB to FALSE. -This removes most SLR-specific pseudo-ops, but some additional -editing of the source files may be required for error-free -assembly. Unless your assembler can handle named common blocks, -you will also want to set the ZRL equate in Z34RCP.LIB to FALSE. - - 4.2.2. Assembly to Absolute Code. - -If you are assembling a custom RCP for use at one memory address -only, or if your assembler can't handle named common blocks, you -can set the ZRL equate in Z34RCP.LIB to FALSE, and instruct your -assembler to produce absolute code (either a .HEX or a .COM file). - -Before generating absolute code you must set addresses in the -file RCPBASE.LIB for the particular installation. Once you have -set these addresses, you may proceed to assemble Z34RCP.Z80 to -either Z34RCP.COM or Z34RCP.HEX. If your assembler generated a -.HEX file, use LOAD.COM to convert Z34RCP.HEX to Z34RCP.COM. - -If you are running a version of ZCPR prior to 3.4, you must now -alter two bytes in your Z-System environment segment to point to -your system's CCP address. The bytes at offset 39 and 40 hex -(formerly containing "width of printer 2" and "lines on printer -2") should contain a 2-byte address of your system's CCP, most -significant byte last. - -Z34RCP.COM may now be renamed to SYS.RCP and loaded with the Z- -System loader program LDR.COM or Bridger Mitchell's JetLDR. - - 4.2.3. Assembly to Z-Relocatable Code. - -Unlike absolute RCP segments, Z-Relocatable segments may be -loaded to ANY address, provided enough RCP space to contain them -is available. To assemble a Z-Relocatable RCP, you will need an -assembler which can handle named common blocks (see 4.2.1 above). -Set the ZRL equate in Z34RCP.LIB to TRUE, and instruct your -assembler to produce a relocatable (.REL) file. The resulting -Z34RCP.REL may then be renamed to Z34RCP.ZRL and loaded with -NZCOM, Z3PLUS, JetLDR. - - 4.2.4. Adding Custom Commands to Z34RCP. - -As mentioned above, I have designed Z34RCP as a base to which -custom RCP commands may readily be added. All code and command -names for custom commands may be included in RCPCMD.LIB. -Thereafter, whenever the RCP is assembled the commands added to -RCPCMD.LIB will be included automatically. To remove the custom -commands, just replace the modified RCPCMD.LIB with an unmodified -copy. See RCPCMD.LIB for detailed instructions on how to add -code and command names. - -RCPCMD.LIB also facilitates distribution of custom commands to be -included by others in their RCPs. Simply distribute a copy of -your modified RCPCMD.LIB along with instructions on how to use -your custom commands. Users may then easily include the new -commands by substituting your modified RCPCMD.LIB for their -original copy and reassembling their RCPs. - -Of course, users of NZCOM, Z3PLUS, or JetLDR may simply trade -custom RCPs in Z-Relocatable form and dispense with the need for -any assembly work on the part of the user. All three of these -advanced loaders are available from Z Systems Associates (see -below). - - -5. Legal Use of These Files. - -Z34RCP is copyright 1989 by Z Systems Associates (ZSA), all -rights reserved. Any commercial use of Z34RCP, defined as any -situation where the duplicator recieves revenue by duplicating or -distributing Z34RCP by itself or in conjunction with any hardware -or software product, is expressly prohibited unless authorized in -writing by ZSA. - -Except for the file RCPCMD.LIB (see 4.2.4 above), you may -redistribute Z34RCP.LBR in its present form only. I encourage -you to explore the source code, suggest improvements, and -document errors. However, please obtain permission from Z -Systems Associates before redistributing any of these files in -altered form. This will prevent confusion by allowing your work -to be coordinated with the efforts of others. - -The Z Systems Associates are: - - Sage Microsystems East - Selling & Supporting the Best in 8-Bit Software - 1435 Centre St., Newton Centre, MA 02159-2469 - Voice: 617/965-3552 (9:00am - 11:30pm) - Modem: 617/965-7259 (password = DDT)(MABOS on PC-Pursuit) - -and: - - Plu*Perfect Systems - "==World-Class Software" - 410 23rd Street, Santa Monica, CA 90402 - Voice: 213/393-6105 (evenings) - Modem: 213/670-9465 (leave message for "Bridger Mitchell") - -For more information on Z System, check at the above bulletin -board systems, or consult The Computer Journal for excellent -articles on ZCPR and CP/M. The Computer Journal is published six -times a year by Publishing Consultants, 190 Sullivan Crossroad, -Columbia Falls, MT 59912, phone 406/257-9119. An issue averages -forty pages with few ads. Subscription rates are $16 for one -year (6 issues), or $28 for two years (12 issues) in the U.S., -$22 for one year Canada and Mexico, and $24 (surface) for one -year in other countries. - - -Carson Wilson is the operator of: - - Antelope Freeway Remote Access System - Chicago, 312-764-5162 - 300-1200-2400 Baud, 24 Hours - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp11.for b/Source/BPBIOS/Z34RCP11/z34rcp11.for deleted file mode 100644 index c60e1910..00000000 --- a/Source/BPBIOS/Z34RCP11/z34rcp11.for +++ /dev/null @@ -1,7 +0,0 @@ -Z-System Resident Command Package (RCP) in source code form, version -1.1. Complete Z80 source code to the RCP plus documentation, for -ZCPR versions 3.3 and above. Adds several exciting new commands and -features and fixes various bugs in the previous release. See -companion file RCPZRL11.LBR for pre-compiled RCP modules which may -be loaded with NZ-COM, Z3PLUS, or JetLDR. - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp11.hlp b/Source/BPBIOS/Z34RCP11/z34rcp11.hlp deleted file mode 100644 index 991d5d71..00000000 --- a/Source/BPBIOS/Z34RCP11/z34rcp11.hlp +++ /dev/null @@ -1,390 +0,0 @@ - The RCP Commands - CLED/SPOP Command Line Editor  - CLS Clear the CRT screen  - CP Copy a File  - D Display Directory  - ECHO Echo Command Tail  - ERA Erase Files  - H Display Available Commands  - LIST/TYPE Display a File on Printer/CRT - NOTE Comment  - P/POKE Display/Alter Memory  - PORT Input/Output to system ports  - PROT Protect Files  - Q Alter or Query the Quiet Flag - R Reset Disk  - REG ZCPR3 Register Display/Alter  - REN Rename a File  - SP Display Disk Space Remaining  - WHL Alter or Query Wheel Byte  -:Thå RCÐ Commands - - - Thå   standarä ZCPR³ Systeí Residenô Commanä  Packagå  (RCP© -distributeä  witè thå ZCPR³ systeí containó á numbeò oæ  residenô -commandó  whicè  maù bå enableä (dependinç oî systeí  memorù  anä -securitù  characteristics©  aô thå discretioî oæ  thå  installer® -Usagå oæ thå RCÐ commandó ió describeä iî thió HELÐ file. - - Thå  RCÐ commandó residå iî memorù ratheò thaî beinç  loadeä -froí  disk¬ anä thereforå operatå verù efficientlù anä arå  disë­ -independent®   Oî thå otheò hand¬ duå tï memorù constraints¬  thå -RCÐ commandó arå ofteî lesó powerfuì thaî theiò transienô prograí -counterparts® - - - - Iæ aî erroò occurs¬ thå RCÐ commandó generallù chaiî tï  thå -installeä erroò handler¬ providinç á detaileä reporô oæ thå erroò -anä  allowinç thå commanä tï bå editeä oò aborted® Iæ  nï  erroò -handleò  ió  installed¬  thå commanä whicè causeä  thå  erroò  ió -echoeä tï thå screen¬ followeä bù á questioî mark. - - Alì RCÐ commandó arå installatioî-dependent¬ anä manù maù bå -configureä  aô  assemblù timå tï perforí  iî  slightlù  differenô -ways®   Thå  exampleó giveî iî thió HELÐ filå arå  baseä  oî  thå -distributeä seô oæ options® Seå sourcå codå filå Z34RCP.LIÂ  foò -morå detailó oî commanä anä optioî selection. - -:CLED anä SPOÐ Commands - Transient Counterparts: LSÈ anä SPOP - - Thå  CLEÄ commanä invokeó á speciaì prograí  whicè  provideó -WordStaò-likå editinç oæ commandó aô thå systeí prompt® Iô  alsï -allowó yoõ tï recalì thå lasô severaì commandó invokeä witè  onlù -onå keystroke® Finally¬ iæ available¬ CLEÄ displayó thå  currenô -systeí timå tï thå lefô oæ youò prompt® Thå syntaø is: - - CLED - invoke as shell - CLED / - invoke for next command only - - - - Thå SPOÐ commanä "pops¢ thå toð shelì froí thå shelì  stack¬ -sï thaô iô nï longeò loadó afteò everù command® Thió commanä  ió -rarelù  needed¬  anä ió includeä onlù witè versionó  oæ  thå  RCÐ -includinç CLEÄ (seå above)® Thå syntaø ió simply: - - SPOP -:CLS Command - Transient Counterpart: None - - Thå  CLÓ  commanä  clearó  thå  terminaì  screen¬   removinç -displayó  whicè  mighô  havå beeî lefô bù  previouó  commandó  oò -programs® Thå syntaø is: - - CLS - -:CP Command - Transient Counterpart: MCOPY - - Thå  CÐ  commanä copieó onå filå froí onå DÕ tï  anotheò  oò -intï  thå samå DÕ undeò á differenô name® Iæ functionó 10²  (geô -stamp©  anä 10³ (seô stamp© arå supporteä bù aî RSØ oò DOS¬  filå -datestampó arå preserveä acrosó copies® Thå syntaø is: - - CP dir:ufn1 dir:ufn2 -- ufn1 to ufn2 - CP dir:ufn1 -- ufn1 to current dir: - CP dir:ufn2=dir:ufn1 -- ufn1 to ufn2 - - Examples: - - CP f1.txt f2.txt - CP b0:f1.txt a15: - CP root:f1.txt - -:D Command - Transient Counterpart: DIR, XD, XDIR - - Thå   Ä   commanä  displayó  thå  directorù  oæ   fileó   iî -alphabeticaì ordeò acrosó thå lineó tï thå user® Thå syntaø is: - - D dir:afn.aft o - D .aft o - D /o - - Options (wheel only) are: - - S - Display System Files Only - A - Display Both Non-System and System Files - - Examples: - - D /a - D root:myfile.txt Š D .com - -:ECHO Command - Transient Counterpart: ECHO - - ECHÏ   ió usefuì iî issuinç botè messageó (tï thå  user¬ -saù withiî á commanä filå durinç execution© anä escapå sequences® -Bù  uså oæ thå %¾ anä %¼ parameters¬ ECHÏ caî senä itó outpuô  iî -combinationó  oæ uppeò anä loweò case® Bù uså oæ thå %Ð  anä  %Ã -parameters¬  ECHÏ  outpuô  caî  bå  toggleä  betweeî  screeî  anä -printer®   ECHÏ  useó  BIOÓ  calls¬  sï  alì  controì  characteró -(entereä aó ^character© arå passeä exactly® Hence¬ consolå-leveì -programminç oæ sucè deviceó (CRTó anä printers© ió possible. - - Examples: - ECHO %Pthis is a test%Cof echo%P - -- "THIS IS A TEST" goes to the printer - "OF ECHO" goes to the console - (trailing %P flushes printer buffer) - - ECHO t%>his is a % - prtdec ,%recs,,%bytes, - prtdec ; Trailing CRLF - endm - - else ; Non-SLR assemblers -include macro filename - $include filename&.lib - endm - endif ; SLR - - - if ZRL - -; ============================================================================= - -; J e t L D R I D S E C T I O N - -; ============================================================================= - -; Macro to build ID block message for JetLDR. Max. length is ~256 chars. - -optcnt defl 0 ; Options counter - -option macro string1,enable1,string2,enable2 - - if enable1 ;; Skip if command not present - if [optcnt mod 4] eq 0 - db cr,lf ;; New line every four options - endif - optcnt defl optcnt + 1 ;; Increment options counter - count defl 0 ;; Initialize character count - - irpc char,string1 ;; Count and define characters - count defl count + 1 - db '&char' - endm ; irpc - - if not nul enable2 ;; Sub-option label present - if enable2 ;; Sub-option enabled - db ' (' ;; Begin sub-opt description - irpc char,string2 ;; Count and define characters - count defl count + 1 - db '&char' - endm ; irpc - db ')' ;; End sub-opt description - count defl count + 3 ;; For ' ()' - endif ; enable2 - endif ; not nul enable2 - - if [optcnt mod 4] ne 0 - count defl 11 - count - rept count - db ' ' ;; Pad to 11 spaces - endm ; rept - endif ; [optcnt mod 4] ne 0 - - endif ; enable1 - endm ; option macro - -; --------------------------------------------------------- - - COM /_ID_/ ; JetLDR ID block - db 'Copr. 1989 ZSA. Enabled Commands:' - option Cled,cledon - option Cls,clson,TC,clstcap - option Cp,cpon,stp,stpcall - option Dir,diron,sp, - option Echo,echoon,lst,echolst - option Era,eraon,sp, - option Help,true - option List,liston - option Note,noteon - option Peek,peekon,hdr,peekhdr - ; option Poke,pokeon,q,pokeq - option Poke,pokeon - option Port,porton - option Protect,proton - option Quiet,quieton - option Register,regon - option Rename,renon - option Reset,reson,sp, - option Space,spaceon - option Spop,cledon - option Type,lton,cls, - option Wheel,whlon,q,whlquiet - db 0 ; ID string terminator - -;============================================================================= -; -; E N T R Y C O D E S E C T I O N -; -;============================================================================= - - cseg - else - org z3rcp - endif ; ZRL - -RCPbegin: - db 'Z3RCP' ; Package ID - - include RCPcmd ; Command table and custom commands - - include RCPsubs ; File of subroutines - - include RCPh ; 'H' help (command list) command - -; Include only selected code sections. - - if cledon ; 'CLED' and 'SPOP' commands - include RCPcled - endif ;cledon - - if clson - include RCPcls ; 'CLS' clear screen command - endif ;clson - - if reson - include RCPr ; 'R' disk reset command - endif ;reson - - if spaceon - include RCPsp ; 'SP' space on disk command - endif ;spaceon - - if diron - include RCPdir ; 'DIR' directory command - endif ;diron - - if eraon - include RCPera ; 'ERA' erase command - endif ;eraon - - if renon - include RCPren ; 'REN' rename command - endif ;renon - - if cpon - include RCPcp ; 'CP' file copying command - endif ;cpon - - if echoon - include RCPecho ; 'ECHO' command - endif ;echoon - - if quieton - include RCPquiet ; 'Q' quiet flag - endif ;quieton - - if lton - include RCPlt ; 'LIST' and 'TYPE' commands - endif ;lton - - if proton - include RCPprot ; 'PROT' file attribute setting command - endif ;proton - - if peekon or pokeon or porton - include RCPiom ; 'PEEK', 'POKE', 'PORT' commands - endif ;peekon or pokeon or porton - - if regon - include RCPreg ; 'REG' register operation commands - endif ;regon - - if whlon - include RCPwhl ; 'WHL' command - endif ;whlon - - include RCPid ; Add ID string (must come last) - -RCPend: ; Used to calculate length - end - -; End of Z34RCP.Z80 - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/z34rcp11.z80.sav b/Source/BPBIOS/Z34RCP11/z34rcp11.z80.sav deleted file mode 100644 index 7af6b875..00000000 --- a/Source/BPBIOS/Z34RCP11/z34rcp11.z80.sav +++ /dev/null @@ -1,267 +0,0 @@ - -; Program: Z34RCP -; Description: Resident Command Package (RCP) for ZCPR34 -; Version: 1.3 -; Author: Carson Wilson -; Date: September 13, 1989 -; Changes: Added CLED (command line editor shell) command. -; To save space, JetLDR ID section no longer pads end of each -; line. (JetLDR allows only 256 bytes maximum in its -; description field). - -; Version: 1.2 -; Author: Carson Wilson -; Date: July 9, 1989 -; Changes: Uses spaces instead of tabs in JetLDR displays. -; Copyright now ZSA. - -; Version: 1.1 -; Author: Carson Wilson -; Date: September 14, 1988 -; Changes: RCPID macro called from RCPID.LIB so that the final INCLUDE -; macro call gives total size of the RCP, including the ID -; string, with SLR assemblers. -; Label WHLQ changed to WHLQUIET in Option macro to match -; Z34HDR.LIB equate. - -; Version: 1.0 -; Author: Carson Wilson -; Date: June 15, 1988 - -; Derivation: SYSRCP (Richard Conn) - -; Z34RCP is copyright 1989 by Z Systems Associates. All rights reserved. -; End-user distribution and duplication permitted for non-commercial purposes -; only. Any commercial use of Z34RCP, defined as any situation where the -; duplicator recieves revenue by duplicating or distributing Z34RCP by itself -; or in conjunction with any hardware or software product, is expressly -; prohibited unless authorized in writing by Z Systems Associates. - -;============================================================================= -; -; D E F I N I T I O N S S E C T I O N -; -;============================================================================= - - maclib sysdef.lib ; Common logic, sys, ascii defines - maclib z34defn.lib ; Defines offsets in Z34 command processor - maclib z34mac.lib ; Macros - maclib z34rcp.lib ; Defines command options - - if ZRL - maclib z34cmn.lib ; Defines universal ZCPR named common blocks - else - maclib rcpbase.lib ; Defines addresses for one system - endif - - name RCP11 ; Declare module name - -; ============================================================================ - -; M A C R O S S E C T I O N - -; ============================================================================ - -; Macros to include module file and print module length. -; Under SLR and compatible assemblers, a running account of current RCP -; size and bytes added will be given for each module. -; -; For other assemblers you may have to either modify the non-SLR include -; macro or use a text editor to read in the actual contents of each file -; in place of the include statement. - - if SLR -; -; General purpose macro to display decimal values and messages -; -prtdec macro m1,m2,m3,m4,m5 - .radix 10 ; Decimal output - .printx m1 m2 m3 m4 m5 ; Print to screen - endm -; -; Macro to include modules and display lengths. -; -include macro filename -before defl $ - $include filename&.lib -after defl $ -modlen defl after - before ; Module length -rcplen defl after - RCPbegin ; RCP length -recs defl rcplen / 128 ; ..in records -bytes defl rcplen mod 128 ; ..and additional bytes - prtdec %modlen, - prtdec ,%recs,,%bytes, - prtdec ; Trailing CRLF - endm - - else ; Non-SLR assemblers -include macro filename - $include filename&.lib - endm - endif ; SLR - - - if ZRL - -; ============================================================================= - -; J e t L D R I D S E C T I O N - -; ============================================================================= - -; Macro to build ID block message for JetLDR. Max. length is ~256 chars. - -optcnt defl 0 ; Options counter - -option macro string1,enable1,string2,enable2 - - if enable1 ;; Skip if command not present - if [optcnt mod 4] eq 0 - db cr,lf ;; New line every four options - endif - optcnt defl optcnt + 1 ;; Increment options counter - count defl 0 ;; Initialize character count - - irpc char,string1 ;; Count and define characters - count defl count + 1 - db '&char' - endm ; irpc - - if not nul enable2 ;; Sub-option label present - if enable2 ;; Sub-option enabled - db ' (' ;; Begin sub-opt description - irpc char,string2 ;; Count and define characters - count defl count + 1 - db '&char' - endm ; irpc - db ')' ;; End sub-opt description - count defl count + 3 ;; For ' ()' - endif ; enable2 - endif ; not nul enable2 - - if [optcnt mod 4] ne 0 - count defl 11 - count - rept count - db ' ' ;; Pad to 11 spaces - endm ; rept - endif ; [optcnt mod 4] ne 0 - - endif ; enable1 - endm ; option macro - -; --------------------------------------------------------- - - COM /_ID_/ ; JetLDR ID block - db 'Copr. 1989 ZSA. Enabled Commands:' - option Cled,cledon - option Cls,clson,TC,clstcap - option Cp,cpon,stp,stpcall - option Dir,diron,sp, - option Echo,echoon,lst,echolst - option Era,eraon,sp, - option Help,true - option List,liston - option Note,noteon - option Peek,peekon,hdr,peekhdr - option Poke,pokeon,q,pokeq - option Port,porton - option Protect,proton - option Quiet,quieton - option Register,regon - option Rename,renon - option Reset,reson,sp, - option Space,spaceon - option Spop,cledon - option Type,lton,cls, - option Wheel,whlon,q,whlquiet - db 0 ; ID string terminator - -;============================================================================= -; -; E N T R Y C O D E S E C T I O N -; -;============================================================================= - - cseg - else - org z3rcp - endif ; ZRL - -RCPbegin: - db 'Z3RCP' ; Package ID - - include RCPcmd ; Command table and custom commands - - include RCPsubs ; File of subroutines - - include RCPh ; 'H' help (command list) command - -; Include only selected code sections. - - if cledon ; 'CLED' and 'SPOP' commands - include RCPcled - endif ;cledon - - if clson - include RCPcls ; 'CLS' clear screen command - endif ;clson - - if reson - include RCPr ; 'R' disk reset command - endif ;reson - - if spaceon - include RCPsp ; 'SP' space on disk command - endif ;spaceon - - if diron - include RCPdir ; 'DIR' directory command - endif ;diron - - if eraon - include RCPera ; 'ERA' erase command - endif ;eraon - - if renon - include RCPren ; 'REN' rename command - endif ;renon - - if cpon - include RCPcp ; 'CP' file copying command - endif ;cpon - - if echoon - include RCPecho ; 'ECHO' command - endif ;echoon - - if quieton - include RCPquiet ; 'Q' quiet flag - endif ;quieton - - if lton - include RCPlt ; 'LIST' and 'TYPE' commands - endif ;lton - - if proton - include RCPprot ; 'PROT' file attribute setting command - endif ;proton - - if peekon or pokeon or porton - include RCPiom ; 'PEEK', 'POKE', 'PORT' commands - endif ;peekon or pokeon or porton - - if regon - include RCPreg ; 'REG' register operation commands - endif ;regon - - if whlon - include RCPwhl ; 'WHL' command - endif ;whlon - - include RCPid ; Add ID string (must come last) - -RCPend: ; Used to calculate length - end - -; End of Z34RCP.Z80 - \ No newline at end of file diff --git a/Source/BPBIOS/Z34RCP11/zsystem.ad b/Source/BPBIOS/Z34RCP11/zsystem.ad deleted file mode 100644 index 5231a575..00000000 --- a/Source/BPBIOS/Z34RCP11/zsystem.ad +++ /dev/null @@ -1,97 +0,0 @@ - - Z System Upgrades CP/M - -Z System is first-rate, state-of-the-art software for your CP/M machine. -ZCPR has been with us for over five years now, and has enhanced computer -productivity for thousands of CP/M users. Z System is now a mature -replacement for CP/M 2.2 or CP/M Plus, yet is "backward compatible" with -almost all programs written for CP/M. This means that you can still run -the CP/M programs you now use, yet take advantage of greatly increased -power and performance at the same time. - -NZ-COM and Z3PLUS form the heart of Z System. They replace the most -visible parts of CP/M 2.2 and CP/M Plus respectively, adding enhanced -command processing, named directories, vastly improved resident -commands, flow control processing, error handling, and much more. But -it isn't necessary to master all of these (at least at first!) to take -advantage of NZ-COM and Z3PLUS. In fact, though both packages come with -several disks of software and excellent manuals, almost anyone can -install either of these packages on their CP/M computer in just a few -minutes' time. The price for either NZ-COM or Z3PLUS is $69.95 plus $3 -shipping. - -The next step up in sophistication for CP/M 2.2 users is ZSDOS. ZSDOS -replaces the less visible portion of CP/M 2.2 which controls program -input and output. Through clever coding and exhaustive testing, the -authors of ZSDOS offer significant improvements in performance, safety, -and versatility for CP/M 2.2, including file time and date stamping, -file archiving for faster backups, public files (accessable from all -user areas), path access to files, and improved error messages and -handling. As with NZ-COM and Z3PLUS, ZSDOS installation is completely -menu-driven. ZSDOS comes with a collection of state-of-the-art utility -programs and a 140 page manual to help you make the most of the extended -features. ZSDOS costs $75 ($60 when purchased with NZ-COM) plus $3 -shipping. - -Another path to system enhancement for CP/M 2.2 users with hard or RAM -disks is available in the form of BackGrounder ii (BGii). BGii allows -you to "suspend" any program at the touch of a button and use a wide -range of resident commands such as DIR, REN, ERA, CALC, or TYPE. Then -hit the button again and BGii quickly returns you to the program you -suspended, right where you left off. Or use BGii's SWAP command and -you're back at the CP/M prompt, ready to run any other CP/M program. -When you're through, SWAP again and BGii returns you to your original -program, exactly as you left it! Advanced "Cut" and "Paste" commands -are also available for many terminals, allowing you to transfer sections -of screen directly from one program to another. Print spooling, -advanced key redefinition and recording capabilities, and a beautifully -designed 140-page user's manual are included. Installation is -menu-driven and easy. BGii is compatible with either ZCPR or CP/M 2.2, -and costs $75.00 plus $3 shipping. - -Last but not least is DosDisk, a small but powerful program which allows -you to read or write DIRECTLY to MS-DOS disks with your CP/M computer. -No more file transfers--simply insert a standard MS-DOS DSDD diskette in -your CP/M machine, type "DosDisk :", and away you go--all files -on the diskette are now accessable by all of your CP/M programs--even -files in MS-DOS subdirectories! DosDisk comes with a handsome 38-page -user's manual, and is available preconfigured for most machines at just -$30.00 plus $3 shipping. DosDisk is compatible with either ZCPR or -CP/M 2.2. - -These and other fine products for CP/M and CP/M Plus are available from -users groups around the country, or directly from Z Systems Associates. -Sizeable discounts for users' groups are also available from Z Systems -Associates through the Z Plan. The Z Systems Associates are: - - Sage Microsystems East - Selling & Supporting the Best in 8-Bit Software - 1435 Centre St., Newton Centre, MA 02159-2469 - Voice: 617/965-3552 (9:00am - 11:30pm) - Modem: 617/965-7259 (password = DDT)(MABOS on PC-Pursuit) - - Same-day shipping of most products with modem download and support - available. Order by phone, mail, or modem. Shipping and handling $4 - per order (USA). Check, VISA, or MasterCard. Specify exact disk format. - -and: - - Plu*Perfect Systems - "==World-Class Software" - 410 23rd Street, Santa Monica, CA 90402 - Voice: 213/393-6105 (evenings) - Modem: 213/670-9465 (leave message for "Bridger Mitchell") - - To order: Specify product, operating system, computer, 5 1/4" disk - format. Enclose check, adding $3 shipping ($5 foreign) + 6.5% tax in - California. Enclose invoice if upgrading BGii or ZRDOS. - -For more information on Z System, check at the above bulletin board -systems, or consult The Computer Journal for excellent articles on ZCPR -and CP/M. The Computer Journal is published six times a year by -Publishing Consultants, 190 Sullivan Crossroad, Columbia Falls, MT -59912, phone 406/257-9119. An issue averages forty pages with few ads. -Subscription rates are $16 for one year (6 issues), or $28 for two years -(12 issues) in the U.S., $22 for one year Canada and Mexico, and $24 -(surface) for one year in other countries. - \ No newline at end of file diff --git a/Source/BPBIOS/ZCPR33/@WBW.txt b/Source/BPBIOS/ZCPR33/@WBW.txt index e0c9ad67..9bb34ae1 100644 --- a/Source/BPBIOS/ZCPR33/@WBW.txt +++ b/Source/BPBIOS/ZCPR33/@WBW.txt @@ -2,7 +2,5 @@ This directory contains the official ZCPR 3.3 source with minor customizations to support the BPBIOS build in the parent directory: - Modified to produce a relocatable image compatibile with BPBUILD - - Build process (Build.cmd) creates ZCPR33T.REL and ZCPR33N.REL based - on Z3BASET.LIB and B3BASEN.LIB from parent directory. See "@WBW Z3ENV.txt" file in parent directory for more information. \ No newline at end of file diff --git a/Source/BPBIOS/ZCPR33/Build.cmd b/Source/BPBIOS/ZCPR33/Build.cmd index 1037b138..fbfb43f8 100644 --- a/Source/BPBIOS/ZCPR33/Build.cmd +++ b/Source/BPBIOS/ZCPR33/Build.cmd @@ -1,18 +1,11 @@ @echo off setlocal -set PATH=%PATH%;..\..\..\Tools\zx;..\..\..\Tools\cpmtools; +set PATH=%PATH%;..\..\..\Tools\zxcc;..\..\..\Tools\cpmtools; -set ZXBINDIR=../../../tools/cpm/bin/ -set ZXLIBDIR=../../../tools/cpm/lib/ -set ZXINCDIR=../../../tools/cpm/include/ +set CPMDIR80=%TOOLS%/cpm/ -copy ..\z3baset.lib . -zx ZMAC -zcpr33t.z80 -/P -del z3baset.lib -move zcpr33t.rel .. - -copy ..\z3basen.lib . -zx ZMAC -zcpr33n.z80 -/P -del z3basen.lib -move zcpr33n.rel .. \ No newline at end of file +copy ..\z3base.lib . || exit /b +zxcc ZMAC -zcpr33.z80 -/P || exit /b +del z3base.lib || exit /b +move zcpr33.rel .. || exit /b \ No newline at end of file diff --git a/Source/BPBIOS/ZCPR33/Makefile b/Source/BPBIOS/ZCPR33/Makefile index 62450918..eca179f1 100644 --- a/Source/BPBIOS/ZCPR33/Makefile +++ b/Source/BPBIOS/ZCPR33/Makefile @@ -9,10 +9,10 @@ DIFFPATH = $(DIFFTO)/Source/BPBIOS zcpr33t.rel: ../z3baset.lib cp ../z3baset.lib z3baset.lib - $(ZXCC) $(CPM)/ZMAC -zcpr33t.z80 -/P + $(ZXCC) ZMAC -zcpr33t.z80 -/P rm z3baset.lib zcpr33n.rel: ../z3basen.lib cp ../z3basen.lib z3basen.lib - $(ZXCC) $(CPM)/ZMAC -zcpr33n.z80 -/P + $(ZXCC) ZMAC -zcpr33n.z80 -/P rm z3basen.lib diff --git a/Source/BPBIOS/ZCPR33/z3base.lib b/Source/BPBIOS/ZCPR33/z3base.lib deleted file mode 100644 index b412c670..00000000 --- a/Source/BPBIOS/ZCPR33/z3base.lib +++ /dev/null @@ -1,226 +0,0 @@ -; Z3BASE - Dynamic Configuration -; -; ZCPR33 is copyright 1987 by Echelon, Inc. All rights reserved. End-user -; distribution and duplication permitted for non-commercial purposes only. -; Any commercial use of ZCPR33, defined as any situation where the duplicator -; recieves revenue by duplicating or distributing ZCPR33 by itself or in -; conjunction with any hardware or software product, is expressly prohibited -; unless authorized in writing by Echelon. -; -; This is a special version of Z3BASE, inspired by Joe Wright's Z3BASE -; for Z-Com. All segment addresses are automatically derived when the -; CCP equate is set. The benefit of this is that reconfiguration of the -; system after initial installation is greatly eased. -; -; Although this version of Z3BASE is being distributed with ZCPR 3.3, any -; previous version of Z3BASE can be used to assemble the Z33 Command -; Processor. No new symbols are needed. So, if you have an existing -; Z3BASE, go ahead and use it. -; -; Instructions: -; -; The user should first design the ZCPR3 memory usage using the chart -; below. (Echelon recommends the chart be filled out, even though it is -; not read by the assembler, so that your system will be self-documenting.) -; Then set the CCP equate for the beginning address of ZCPR3. Next, examine -; and change the SEGn equates which follow in the file to ensure that the -; system segments and buffers are placed at the proper addresses. -; -; This file has been customized for use with AMPRO hard disk systems. The -; target configuration has support for hard disks up to 49 Meg, extended -; IOP support, and 28-entry NDR. -; -;**************************************************************** -;* * -;* Z3BASE.LIB -- Base Addresses for ZCPR 3.3/Z-System * -;* * -;* Segments: * -;* * -;* Segment Function * -;* ------- -------- * -;* ZRDOS Echelon Z80 Replacement Disk Operating * -;* System, Version 1.7 (Public ZRDOS Plus) * -;* CBIOSZ Ampro-compatible BIOS with additional * -;* ZCPR3 initialization routines * -;* ZCPR3 Echelon Z80 Command Processor * -;* Replacement, Version 3.3 (ZCPR3) * -;* *.ENV All Environment Descriptors * -;* *.FCP All Flow Command Packages * -;* *.NDR All Named Directory Definition Files * -;* *.RCP All Resident Command Packages * -;* *.IOP All Input/Output Packages * -;* * -;* * -;* Memory Map of System (for CCP EQU 0BC00H): * -;* * -;* Address Range Size Function * -;* ------------- ------- -------- * -;* 0 - FF 256 b Standard CP/M Buffers except * -;* 100 - C3FF ~49 K Transient Program Area * -;* BC00 - C3FF 2K ZCPR 3.3 Command Processor * -;* C400 - D1FF 3.5 K ZRDOS * -;* D200 - EAFF 6.25K Ampro BIOS w/hard disk buffers * -;* EB00 - F2FF 2 K Resident Command Package * -;* F300 - F8FF 1.5 K Input/Output Package * -;* F900 - FAFF .5 K Flow Command Package * -;* FB00 - FB7F 128 b ZCPR3 Shell Stack * -;* FB80 - FBCF 80 b ZCPR3 Message Buffers * -;* FBD0 - FBF3 36 b ZCPR3 External FCB * -;* FBF4 - FBFE 11 b ZCPR3 External Path * -;* FBFF 1 b Wheel Byte * -;* FC00 - FDFF .5 K Memory-Based Named Directory * -;* FE00 - FEFF 256 b Environment Descriptor * -;* Bytes 00H-7FH: Z3 Parameters * -;* Bytes 80H-FFH: Z3 TCAP * -;* FF00 - FFCF 208 B Multiple Command Line Buffer * -;* FD00 - FFFF 48 b ZCPR3 External Stack * -;**************************************************************** - -FALSE equ 0 -TRUE equ NOT FALSE - -Z3REV EQU 33 ; ZCPR3 REV NUMBER -MSIZE EQU 54 ; SIZE OF CPM SYSTEM - -BASE EQU 0 - -CCP EQU 0BC00H ; ZCPR3 COMMAND PROCESSOR - -seg1 equ CCP+2F00h ; 11.75k from CCP to here (adding 2k ZCPR, - ; 3.5k DOS, and 6.25k BIOS). - -; -; RCP definition. Set RCPS to 0 to eliminate RCP -; - -RCPS EQU 16 ; 16 128-byte Blocks (2K bytes) - - IF RCPS NE 0 -RCP EQU seg1 ; RESIDENT COMMAND PACKAGE - ELSE -RCP EQU 0 - ENDIF - -seg2 equ seg1+[rcps*128] - -; -; IOP definition. Set IOPS to 0 to eliminate IOP -; -IOPS EQU 12 ; 12 128-byte Blocks (1.5K bytes) - - IF IOPS NE 0 -IOP EQU seg2 ; REDIRECTABLE I/O PACKAGE - ELSE -IOP EQU 0 - ENDIF - -seg3 equ seg2+[iops*128] - -; -; FCP definition. Set FCPS to 0 to eliminate FCP -; - -FCPS EQU 4 ; 4 128-byte Blocks (0.5K bytes) - - IF FCPS NE 0 -fcp equ seg3 - ELSE -fcp equ 0 - ENDIF - -seg4 equ seg3+[fcps*128] - -; -; Shell Stack definition. Set SHSTKS to 0 to eliminate Shell Stack -; - -SHSTKS EQU 4 ; NUMBER OF SHSIZE-BYTE SHELL STACK ENTRIES -SHSIZE EQU 32 ; SIZE OF A SHELL STACK ENTRY - ; (STACK SIZE = SHSTKS * SHSIZE) - IF SHSTKS NE 0 -SHSTK EQU seg4 - ELSE -SHSTK EQU 0 - ENDIF - -seg5 equ seg4+[shstks*shsize] - -; -; The ZCPR3 Message Buffers are mandatory for ZCPR 3.3. -; -Z3MSG EQU seg5 ; ZCPR3 MESSAGE BUFFER - -seg6 equ seg5+80 - -; -; The ZCPR3 External FCB is mandatory for ZCPR 3.3. -; - -EXTFCB EQU seg6 ; ZCPR3 EXTERNAL FCB - -seg7 equ seg6+36 - -; -; The Path is mandatory for ZCPR 3.3. No more than 5 path elements can be -; used with this Z3BASE.LIB file. -; - -EXPATH EQU seg7 ; EXTERNAL PATH -EXPATHS EQU 5 ; 5 2-byte Path Elements - ; (PATH SIZE = EXPATHS*2 + 1) - -seg8 equ seg7+[expaths*2]+1 - -; -; The ZCPR3 Wheel Byte is mandatory for ZCPR 3.3. -; - -Z3WHL EQU seg8 ; WHEEL BYTE ADDRESS - -seg9 equ seg8+1 - -; -; ZCPR3 Named Directory Buffer definition. Set Z3NDIRS to 0 to eliminate -; the named directory buffer. If Z3NDIRS is changed, also change the seg10 -; equate below. -; -Z3NDIRS EQU 28 ; 28 18-byte Named Directory Elements permitted - ; (NDIR SIZE = Z3NDIRS*18 + 1 for trailing 0) - IF Z3NDIRS NE 0 -Z3NDIR EQU seg9 ; ZCPR3 NAMED DIRECTORY AREA - ELSE -Z3NDIR EQU 0 - ENDIF - -seg10 equ seg9+512 ; add 512 for 28-entry NDR - ; add 256 for 14-entry NDR ("standard") - ; add 0 if Z3NDIRS is set to 0 - -; -; The ZCPR3 External Environment Descriptor is mandatory for ZCPR 3.3. -; Echelon recommends you work this out so that your ENV begins at address -; FE00h, but this is only a recommendation and not mandatory. -; - -Z3ENV EQU seg10 ; ENVIRONMENT DESCRIPTORS -Z3ENVS EQU 2 ; SIZE OF ENVIRONMENT DESCRIPTOR IN 128-BYTE BLOCKS - -seg11 equ seg10+[z3envs*128] - -; -; The ZCPR3 External Command Line Buffer is mandatory for ZCPR 3.3. -; - -Z3CL EQU seg11 ; ZCPR3 COMMAND LINE BUFFER -Z3CLS EQU 208 ; SIZE OF COMMAND LINE BUFFER - -seg12 equ seg11+z3cls - -; -; The ZCPR3 External Stack is mandatory for ZCPR 3.3. -; - -EXTSTK EQU seg12 ; ZCPR3 EXTERNAL STACK - -; end of Z3BASE.LIB - \ No newline at end of file diff --git a/Source/BPBIOS/ZCPR33/zcpr33.z80 b/Source/BPBIOS/ZCPR33/zcpr33.z80 index 99e7e96a..cb5f1de1 100644 --- a/Source/BPBIOS/ZCPR33/zcpr33.z80 +++ b/Source/BPBIOS/ZCPR33/zcpr33.z80 @@ -78,6 +78,9 @@ ; which are used to customize ZCPR33 for the user's working environment. ; NOTE -- TRUE & FALSE are defined in Z3BASE. +memtop equ 0FE00H - 1 ; Reserve memory above this for HBIOS +base equ 0 + maclib z3base.lib maclib z33hdr.lib @@ -137,7 +140,7 @@ tfcb equ base+005ch ; Default FCB buffer tfcb2 equ tfcb+16 ; 2nd FCB tbuff equ base+0080h ; Default disk I/O buffer tpa equ base+0100h ; Base of TPA -bios equ ccp+0800h+0e00h ; BIOS location +;bios equ ccp+0800h+0e00h ; BIOS location ; ---------- Error codes @@ -262,6 +265,10 @@ curdr equ z3msg+2fh ; Currently logged drive if not rel ; If generating absolute code org ccp + else + common /_BIOS_/ +bios equ $ + cseg endif ;not rel diff --git a/Source/BPBIOS/ZCPR33/zcpr33n.z80 b/Source/BPBIOS/ZCPR33/zcpr33n.z80 deleted file mode 100644 index a5bdeda8..00000000 --- a/Source/BPBIOS/ZCPR33/zcpr33n.z80 +++ /dev/null @@ -1,4042 +0,0 @@ -; PROGRAM: ZCPR -; VERSION: 3.3 -; DERIVATION: ZCPR30 -; AUTHOR: Jay Sage -; DATE: May 28, 1987 - -; ZCPR33 is copyright 1987 by Echelon, Inc. All rights reserved. End-user -; distribution and duplication permitted for non-commercial purposes only. -; Any commercial use of ZCPR33, defined as any situation where the duplicator -; recieves revenue by duplicating or distributing ZCPR33 by itself or in -; conjunction with any hardware or software product, is expressly prohibited -; unless authorized in writing by Echelon. -; -; Echelon specifically disclaims any warranties, expressed or implied, -; including but not limited to implied warranties of merchantability and -; fitness for a particular purpose. In no event will Echelon be liable for -; any loss of profit or any other commercial damage, including but not limited -; to special, incidental, consequential, or other damages. -; -; Echelon can be contacted at: -; Echelon, Inc. -; 885 N. San Antonio Road -; Los Altos, California USA 94022 -; (415) 948-3820 - - -;----------------------------------------------------------------------------- -; -; A C K N O W L E D G M E N T S -; -;----------------------------------------------------------------------------- - -; Many people have played a role in the development of ZCPR in general and -; ZCPR33 in particular. It all started when "The CCP Group," including -; Richard Conn, Ron Fowler, Keith Petersen, Frank Wancho, Charlie Strom, and -; Bob Mathias decided that by rewriting the CP/M command processor to take -; advantage of Zilog-specific opcodes they could save enough code to enhance -; some of the features. Richard Conn then extended that development through -; ZCPR2 to ZCPR3 (3.0). Just a little over two years ago, I took the first -; step to enhance ZCPR3 by making it get the maximum drive and user values -; from the environment instead of hard coding them in. This version was -; distributed privately as ZCPR31. Along the way to what is now ZCPR -; version 3.3 a number of others have made valuable contributions: Steve -; Kitahata, Michael Bate, Bruce Morgen, Roger Warren, Dreas Nielsen, Bob Freed, -; Al Hawley, Howard Goldstein, and many others who have stimulated developments -; by pointing out problems or asking questions. - -; I would like particularly to acknowledge two people who have played a very -; significant role in these developments. One is Al Hawley. He introduced -; the idea of having the DUOK flag in the environment control how the CPR -; would respond to the DU: form of directory reference. He also originated -; the idea of using the high bit of the first character of each command name -; to control whether or not it would be wheel restricted. Finally, he -; contributed the basic structure of the highly efficient, elegant, and more -; general number evaluation routines in the code. - -; My biggest debt of gratitude is to Howard Goldstein. His role in the -; development of ZCPR33 goes back about a year, when he contributed the first -; correct implementation of the minpath feature. More recently, during the -; period of intense development since Echelon expressed its interest in my -; writing the official 3.3 version, he and I have shared an especially -; enjoyable and fruitful relationship. Most of the newest ideas have been -; worked out jointly, and Howard has done a great deal to keep my code and -; concepts on track. He discovered many ways to pare the code down and, more -; importantly, uncovered numerous subtle bugs. He recoded the SAVE command -; to make it more compact and reliable. -; -; Jay Sage -; May 28,1987 - -;----------------------------------------------------------------------------- -; -; U S E R C O N F I G U R A T I O N -; -;----------------------------------------------------------------------------- - -; The following MACLIB statements load all the user-selected equates -; which are used to customize ZCPR33 for the user's working environment. -; NOTE -- TRUE & FALSE are defined in Z3BASE. - - maclib z3basen.lib - maclib z33hdr.lib - -; Check that the configuration includes the required facilities - -; A ZCPR33 system is assumed to include certain minimal features, including -; an external file control block, external path, shell stack, message buffer, -; external environment descriptor, multiple command line, and external stack. -; If wheel checking is enabled in the Z33HDR.LIB file, then there must be -; an address defined for the wheel byte in the Z3BASE.LIB file. - -errflag defl extfcb eq 0 ; External command FCB -errflag defl errflag or [ expath eq 0 ] ; Symbolic path -errflag defl errflag or [ shstk eq 0 ] ; Shell stack -errflag defl errflag or [ z3msg eq 0 ] ; Message buffer -errflag defl errflag or [ z3env eq 0 ] ; Environment descriptor -errflag defl errflag or [ z3cl eq 0 ] ; Multiple command line -errflag defl errflag or [ extstk eq 0 ] ; External stack - if wheel or wdu or wpass or wprefix or whldir -errflag defl errflag or [ z3whl eq 0 ] ; Wheel byte - endif ;wheel or wdu or wpass or wprefix or whldir - - if errflag - - *** NOT ALL REQUIRED ZCPR3 FACILITIES ARE SUPPORTED *** - - else ; go ahead with the assembly - - -;----------------------------------------------------------------------------- -; -; D E F I N I T I O N S S E C T I O N -; -;----------------------------------------------------------------------------- - - -; ---------- Macro definitions - - maclib z33mac.lib ; Library of macros for ZCPR33 - - -; ---------- ASCII definitions - -ctrlc equ 03h -bell equ 07h -tab equ 09h -lf equ 0ah -cr equ 0dh - - -; ---------- Operating system addresses - -wboot equ base+0000h ; CP/M warm boot address -udflag equ base+0004h ; User number in high nybble, disk in low -bdos equ base+0005h ; BDOS function call entry point -tfcb equ base+005ch ; Default FCB buffer -tfcb2 equ tfcb+16 ; 2nd FCB -tbuff equ base+0080h ; Default disk I/O buffer -tpa equ base+0100h ; Base of TPA -;bios equ ccp+0800h+0e00h ; BIOS location - - -; ---------- Error codes - -; ZCPR33 uses the error byte at the beginning of the message buffer as a flag -; to show what kind of error occurred. Advanced error handlers will be able -; to help the user further by suggesting the possible cause of the error. -; Error code 6 for an ECP error is determined by the code and cannot be -; changed (without increasing code length). - -ecduchg equ 1 ; Directory change error -- attempt to change - ; ..logged directory when under control of - ; ..wheel byte and wheel is off - -ecbaddir equ 2 ; Bad directory specification -- logging of - ; ..user number beyond legal range, - ; ..nonexistent named directory - -ecbadpass equ 3 ; Bad password -- incorrect password entered - - -ecbadcmd equ 5 ; Bad command form -- wildcard or file type - ; ..present in command verb - -ececperr equ 6 ; ECP error -- command could not be executed - ; ..by ECP, error handling was forced by a - ; ..transient for its own reasons - ; (DO NOT CHANGE FROM 6) - -ecnocmd equ 7 ; Command file not found -- command that skips - ; ..ECP could not be executed, GET could not - ; ..find file to load - -ecambig equ 8 ; Ambiguous file specification where not - ; ..allowed (SAVE, GET, REN) - -ecbadnum equ 9 ; Bad numerical value -- not a number where - ; ..number expected, number out of range - -ecnofile equ 10 ; File not found -- REN, TYPE, LIST could not - ; ..find a specified file - -ecdiskfull equ 11 ; Disk directory or data area full - -ectpafull equ 12 ; TPA overflow error - - -; ---------- Multiple command line equates - -; The multiple command line buffer is located in a protected area in memory so -; that it is not overwritten during warm boots. It includes some pointers so -; that when ZCPR33 starts it can tell where to start reading the command line. -; BUFSIZ and CHRCNT are not used by ZCPR33 but are provided so that the BDOS -; line input function can be used to read in a command line. - -nxtchr equ z3cl ; Address where pointer to next command to - ; ..process is kept -bufsiz equ z3cl+2 ; Address where size of buffer is kept -chrcnt equ z3cl+3 ; Address where length of string actually in - ; ..the buffer is kept (not always reliable) -cmdlin equ z3cl+4 ; Address of beginning of command line buffer -buflen equ z3cls ; Length of command line buffer - - -; ---------- Command file control block - -; In ZCPR33 the file control block for commands must be located in protected -; memory. This not only frees up valuable space in the command processor for -; code but also makes it possible for programs to determine by what name they -; were invoked. - -cmdfcb equ extfcb - - -; ---------- External CPR stack - -stack equ extstk+48 ; Set top-of-stack address -pwlin equ extstk ; Place line at bottom of stack - - -; ---------- Environment - -quietfl equ z3env+28h ; Quiet flag -maxdrenv equ z3env+2ch ; Maximum drive value -maxusrenv equ z3env+2dh ; Maximum user value -duokfl equ z3env+2eh ; Flag indicating acceptance of DU: form -crttxt0 equ z3env+33h ; Address of number of lines of text on the - ; ..screen of CRT0 - - -; ---------- Message buffer - -ecflag equ z3msg ; Error return code flag -ifptrfl equ z3msg+1 ; Pointer to current IF level -ifstatfl equ z3msg+2 ; Flow control status byte -cmdstatfl equ z3msg+3 ; Command status flag -cmdptr equ z3msg+4 ; Pointer to currently running command -zexinpfl equ z3msg+7 ; ZEX input status/control flag -zexrunfl equ z3msg+8 ; ZEX running flag -errcmd equ z3msg+10h ; Error handling command line -xsubflag equ z3msg+2ch ; XSUB input redirection flag -subflag equ z3msg+2dh ; Submit running flag -curusr equ z3msg+2eh ; Currently logged user -curdr equ z3msg+2fh ; Currently logged drive - - -;----------------------------------------------------------------------------- -; -; C O D E M O D U L E S S E C T I O N -; -;----------------------------------------------------------------------------- - - page - -; ZCPR33-1.Z80 - -;============================================================================= -; -; E N T R Y P O I N T S A N D H E A D E R S T R U C T U R E -; -;============================================================================= - - if not rel ; If generating absolute code - org ccp - else - common /_BIOS_/ -bios equ $ - cseg - endif ;not rel - - -; ENTRY POINTS INTO ZCPR33 -; -; For compatibility with CP/M, two entry points are provided here. In -; standard CP/M if the code is entered from the first entry point, then the -; command in the resident command buffer is executed; if entered from the -; second entry point, the command line is flushed. With ZCPR33 and its -; multiple command line buffer, these two entry points function identically -; and go to the same address. -; -; We have kept the entry points in their standard locations but have used a -; relative jump for the second entry point and replaced the last byte with the -; version number. In this way the version number occupies a position that -; would otherwise contain the page number at which the CPR runs. It will -; always be possible, therefore, to distinguish ZCPR33 and later versions -; from other command processors. The first jump is kept as an absolute jump -; so that 1) the code will be compatible with Z-COM and Z3-DOT-COM and 2) the -; execution address of a CPR module can always be determined. - -entry: - jp zcpr - - jr zcpr - -version: - defb 33h ; Version ID squeezed in here (offset = 5) - -;----------------------------------------------------------------------------- - -; Configuration information - -options: ; (offset = 6) - optflag badduecp,rootonly,ndrenv,fcpenv,rcpenv,inclenv,aduenv,duenv - optflag highuser,drvprefix,scancur,incldir,incldu,dufirst,accptdir,accptdu - optflag no,pwcheck,pwnoecho,wdu,wpass,wprefix,fastecp,skippath - -attdir defl [ comatt eq 80h ] or [ comatt eq 01h ] or [ not attchk ] -attsys defl [ comatt eq 00h ] or [ comatt eq 01h ] or [ not attchk ] -subquiet defl [ subnoise eq 1 ] -subecho defl [ subnoise gt 1 ] - - optflag shellif,attsys,attdir,attchk,subecho,subquiet,subclue,subon - -; Byte with information about the alternate colon option. If the byte is -; zero, the option is not supported. Otherwise the byte contains the -; prefix character that serves as an alias for a colon prefix. Offset = 10. - - if altcolon - defb altchar - else - defb 0 - endif ;altcolon - -; Byte with information about the FASTECP implementation (option bit above -; indicates whether the feature is enabled at all). If no character appears -; here (zero byte), then only a leading space can be used. Otherwise, the -; first seven bits contain the character, and the high bit, if set, indicates -; that ONLY this character will be recognized and not a space. Offset = 11. - - if fastecp and altspace - if altonly - defb ecpchar + 80h - else ;not altonly - defb ecpchar - endif ;altonly - else ;no alternate character - defb 0 - endif ;fastecp and altspace - - defb 0,0,0,0 ; Space reserved for expansion - -;----------------------------------------------------------------------------- - -; Entry points to file name parsing code. - -; Entry point REPARSE. A call to this point can be used to parse a command -; line tail into the default file control blocks at 5CH and 6CH. Each time -; the parser is called it leaves the starting address of the second token in -; the PARESPTR address below so that successive calls to the routine reparse -; the command tail one token later. A program can load its own pointer into -; PARSEPTR as well. Offset = 16 (10h). - -reparse: -parseptr equ $+1 ; Pointer for in-the-code modification - ld hl,0 - jp parsetail - -; Entry point SCAN. A call to this point can be used to parse a single token -; pointed to by HL into the FCB pointed to by DE. Offset 22 (16h). - -scan: - jp scanner - -;----------------------------------------------------------------------------- - -; BUFFERS -; -; In this area various data items are kept. First comes the list of commands -; supported by ZCPR33; then comes the name of the extended command processor -; (ECP). By putting these items here, an 'H' command in the RCP or a utility -; like SHOW.COM can find this information and report it to the user. - - -; ---------- RESIDENT COMMAND TABLE - -; The command table entry is structured as follows: First there is a byte -; which indicates the number of characters in each command. Then there is a -; series of entries comprising the name of a command followed by the address -; of the entry point to the code for carrying out that command. Finally, -; there is a null byte (00h) to mark the end of the table. Offset = 25 (19h). - - -cmdtbl: - defb cmdsize ; Length of command names - ctable ; Define table via macro in Z33HDR.LIB - defb 0 ; End of table - -; ---------- NAME FOR EXTENDED COMMAND PROCESSOR - -; The name of the extended command processor is placed here after the command -; table so that utilities like SHOW or an RCP 'H' command can find it. - -ecpfcb: - ecpname ; From Z33HDR.LIB - - -; ---------- FILE TYPE FOR TRANSIENT COMMANDS (usually COM) - -; This file type also applies to the extended command processor name. - -commsg: - comtyp ; From Z33HDR.LIB - - - -; ---------- SUBMIT FILE CONTROL BLOCK - - if subon ; If submit facility enabled ... - -subfcb: - defb subdrv-'A'+1 ; Explicit drive for submit file - defb '$$$ ' ; File name - subtyp ; From Z33HDR.LIB - defb 0 ; Extent number - defb 0 ; S1 (user number 0) -subfs2: - defs 1 ; S2 -subfrc: - defs 1 ; Record count - defs 16 ; Disk group map -subfcr: - defs 1 ; Current record number - - endif ; subon - -; End ZCPR33-1.Z80 - - page - -; ZCPR33-2.Z80 - -;============================================================================= -; -; C O M M A N D L I N E P R O C E S S I N G C O D E -; -;============================================================================= - -; MAIN ENTRY POINT TO CPR - -; This is the main entry point to the command processor. On entry the C -; register must contain the value of the user/drive to be used as the current -; directory. - -zcpr: - ld sp,stack ; Reset stack - - if pwnoecho - ld a,0c3h ; Reenable BIOS conout routine - ld (bios+0ch),a ; ..after a warmboot - endif ;pwnoecho - - ld b,0fh ; Keep nibble mask in B - -; If the HIGHUSER option is enabled, we compare the user/drive in the login -; byte in C to the values stored in the message buffer. If, ignoring bit 4 -; of the user number, they match, then we remain in the current area, which -; may be a user area above 15. - - if highuser - - ld a,c ; Copy user/drive byte to A - and b ; Isolate drive - ld d,a ; ..and move to D - ld a,c ; Get full byte back - swap ; Swap nibbles - and b ; Isolate user number - ld e,a ; ..and move to E - ld hl,(curusr) ; Get old curdr/curusr into HL - sbc hl,de ; Subtract new values from old (carry is clear) - ex de,hl ; Switch new values into HL, diff into DE - ld a,d ; Combine two parts of difference - or e - and b ; Ignore bit for high user numbers - jr z,zcpr1 ; Skip update if no change in DU - ld (curusr),hl ; Update values of current drive and user -zcpr1: - - else ;not highuser - - ld a,c ; Copy user/drive byte to A - and b ; Isolate drive - ld h,a ; ..and move to H - ld a,c ; Get full byte back - swap ; Swap nibbles - and b ; Isolate user number - ld l,a ; ..and move to L - ld (curusr),hl ; ..and save them - - endif ;highuser - -; This block of code is executed when submit processing is enabled. We log -; into user area 0, where the submit file is kept, and we search the -; designated drive for the file. The result is kept in SUBFLAG. This code -; only has to be executed on reentry to the command processor at the main -; entry point. Commands that do not reboot but simply return to the CPR will -; execute without the disk reset and file search required here. Ron Fowler -; pointed out a shortcut based on the fact that after a disk reset, the A -; regiser contains a value of 0 if there is no file on drive A with a '$' in -; the file name and 0FFH if there is such a file. Thus if A = 0, there can -; be no '$$$.SUB' file on drive A. This trick is, unfortunately, not reliable -; under some versions of ZRDOS. Therefore, an option has been included to -; use or not use this shortcut. - - if subon ; If submit facility enabled .. - - call defltdma ; Set DMA address to 80H - ld a,0 ; Log into user area 0 - call setuser - ld c,0dh ; Reset disk system (returns 0FFH if a $$$.SUB - call bdossave ; ..file might exist in user 0) - ld de,subfcb ; Point to submit file FCB with explicit drive - - if subclue - call nz,srchfst ; Search only if flag says it could exist - else ;not subclue - call srchfst ; Search for the file unconditionally - endif ;subclue - - ld (subflag),a ; Set flag for result (0 = no $$$.SUB) - - else ;not subon - - ld c,0dh ; Reset disk system - call bdossave - - endif ; subon - - jr nextcmd ; Go to entry point for processing next command - - -;----------------------------------------------------------------------------- - -; NEW COMMAND LINE ENTRY POINT - -; This entry point is used when ZCPR33 finds the command line empty. A call to -; READBUF gets the next command line from the following possible sources in -; this order: -; 1) a running ZEX script -; 2) the submit file $$$.SUB (if enabled) -; 3) the shell stack -; 4) the user -; If the line comes from the shell stack, then the shell bit in the command -; status flag is set. - -restart: - ld sp,stack ; Reset stack - xor a - ld (cmdstatfl),a ; Reset ZCPR3 command status flag - inc a ; Set ZEX message byte to 1 to - ld (zexinpfl),a ; ..indicate command prompt - if subon - ld (xsubflag),a ; Ditto for XSUB flag - endif ;subon - ld hl,cmdlin ; HL --> beginning of command line buffer - ld (nxtchr),hl ; Save as pointer to next character to process - ld (hl),0 ; Zero out command line (in case of warm boot) - push hl ; Save pointer to command line - call readbuf ; Input command line (ZEX, submit, shell, - ; ..or user) - pop hl ; Get back pointer to command line - ld a,(hl) ; Check for comment line - cp comment ; Begins with comment character? - jr z,restart ; If so, go back for another line - ; Otherwise, fall through - -;----------------------------------------------------------------------------- - -; COMMAND CONTINUATION PROCESSING ENTRY POINT - -; This is the entry point for continuing the processing of an existing command -; line. The current drive and user values as known to the CPR are combined -; and made into the user/drive byte that CP/M keeps at location 0004. If the -; HIGHUSER option is enabled, the user number for this byte is forced to be -; in the range 0..15. Next the command status flag is processed. The error -; and ECP bits in the actual flag are reset, and the original flag is checked -; for an ECP error return (both ECP bit and error bit set). In that case, -; control is transferred to the error handler. - -nextcmd: - ld hl,(curusr) ; Get currently logged drive and user - ld a,l ; Work on user number - if highuser - and 0fh ; Keep value modulo 16 - endif ;highuser - swap ; Get user into high nibble - or h ; ..and drive into low nibble - ld (udflag),a ; Set user/disk flag in page 0 - - ld a,2 ; Turn ZEX input redirection off - ld (zexinpfl),a - if subon - ld (xsubflag),a ; Turn off XSUB input redirection - endif ;subon - - ld hl,cmdstatfl ; Point to the command status flag (CSF) - ld a,(hl) ; Get a copy into register A - res 1,(hl) ; Reset the actual error bit - res 2,(hl) ; Reset the actual ECP bit - and 110b ; Select ECP and error bits in original flag - cp 110b ; Test for an ECP error - jp z,error ; Process ECP error with error handler - -nextcmd1: - ld sp,stack ; Reset stack - call logcurrent ; Return to default directory - ld hl,(nxtchr) ; Point to first character of next command - push hl ; Save pointer to next character to process - -; We have to capitalize the command line each time because an alias or other -; command line generator may have stuck some new text in. The code is shorter -; if we simply capitalize the entire command rather than trying to capitalize -; only the one command we are about to execute. - -capbuf: ; Capitalize the command line - ld a,(hl) ; Get character - call ucase ; Convert to upper case - ld (hl),a ; Put it back - inc hl ; Point to next one - or a ; See if end of line (marked with null) - jr nz,capbuf ; If not, loop back - - pop hl ; Restore pointer to next character to process - -nextcmd3: - -; ZCPR33 provides a convenience feature to make it easier to enter a leading -; colon to force the current directory to be scanned and to make the CPR skip -; resident commands. If ALTCOLON is active, an alternate character can be -; entered as the first character of a command. The default (and recommended) -; alternative character is the period (it could not have any other meaning -; here). If FASTECP (see below) is not enabled or if ALTONLY is enabled, -; leading spaces on the command line are skipped before looking for the -; alternate character for the colon - - if [ not fastecp ] or [ fastecp and altonly ] - call sksp - endif ;[ not fastecp ] or [ fastecp and altonly ] - - if altcolon ; If allowing alias character for leading colon - ; Set B = ':' and C = alias character ('.') - ld bc,':' shl 8 + altchar - ld a,(hl) ; Get first character in new command line - cp c ; If first character is ALTCHAR, treat as ':' - jr nz,nextcmd3a ; Branch if not '.' - ld (hl),b ; Else replace with colon -nextcmd3a: - endif ;altcolon - - -; ZCPR33 supports three new options that can speed up command processing. -; FASTECP allows commands with a leading space to bypass the search for -; resident commands or transient commands (COM files) along the path and go -; directly to the extended command processor. With SKIPPATH enabled, when -; a command is prefixed by an explicit directory specification (but not a -; lone colon), searching of the path and invocation of the ECP are disabled. -; If the command is not found in the specified directory, the error handler -; is invoked immediately. Finally, if BADDUECP is enabled, when an attempt -; is made to log into an invalid directory, the command is sent directly to -; the ECP, which can provide special handling. To implement these three -; features, the first actual character of the command line is saved as a -; flag in FIRSTCHAR. My apologies for the complexity of these nested -; conditionals. - - if fastecp or skippath or badduecp - - ; With FASTECP we store the first actual - ; ..character and then skip over spaces (unless ALTONLY is - ; ..enabled, in which case we skipped spaces above) - - if fastecp - - if altspace ; If allowing alias character for leading space - ; Set B = ' ' and C = alias character ('/') - ld bc,' ' shl 8 + ecpchar - ld a,(hl) ; Get first character in new command line - cp c ; If first character is ECPCHAR treat as ' ' - jr nz,nextcmd3b ; Branch if not '/' (alternate character) - ld (hl),b ; Else replace with space -nextcmd3b: - endif ;altspace - - ld a,(hl) ; Get first character in command line - ld (firstchar),a ; Save it in flag - call sksp ; Then skip leading spaces - endif ;fastecp - - ; With SKIPPATH but not FASTECP we store the first - ; ..character of the command (spaces were skipped above) - - if [ not fastecp ] and skippath - ld (firstchar),a ; Store first nonspace character - endif ;[ not fastecp ] and skippath - - ; With only BADDUECP (and neither SKIPPATH nor FASTECP) - ; ..we store a null in the FIRSTCHAR flag - - if [ not fastecp ] and [ not skippath ] - xor a - ld (firstchar),a - endif ;[ not fastecp ] and [ not skippath ] - - endif ;fastecp or skippath or badduecp - -; Resume processing of the command line - - or a ; Now at end of line? - jr z,restart ; If so, get a new command line - cp ctrlc ; Flush ^C to prevent error-handler - jr z,restart ; ..invocation on warm boots - - cp cmdsep ; Is it a command separator? - jr nz,nextcmd4 ; If not, skip ahead to process the command - inc hl ; If it is, skip over it - jr nextcmd3 ; ..and process next command - -nextcmd4: - -; Unless we are now running the external error handler, the following code -; saves the address of the current command in Z3MSG+4 for use by programs -; to determine the command line with which they were invoked. - - ld a,(cmdstatfl) ; Get command status flag - bit 1,a ; Test for error handler invocation - jr nz,nextcmd5 ; If so, skip over next instruction - ld (cmdptr),hl - -nextcmd5: - call parser ; Parse entire command line, then look for - ; ..the command - - -;============================================================================= - -; C O M M A N D S E A R C H C O D E - -;============================================================================= - -; CODE FOR FINDING AND RUNNING THE COMMAND - -; Here is the code for running a command. Commands are searched for and -; processed in the following order: -; -; 1) flow control package (FCP) commands and IF state testing -; 2) resident command package (RCP) -; 3) command processor (CPR) -; 4) transient (COM file or extended command processor) -; 5) external error handler -; 6) internal error message and processing -; -; Special notes: -; -; a) If the current command is a shell command, special handling of flow -; control is required. If SHELLIF is enabled so that flow commands are -; allowed in shell alias scripts, then we reset the flow state to its -; initial condition (none) with each shell invocation (and after each -; command is run, we reset the shell bit in the code after CALLPROG). -; In this case shells will run regardless of flow state, and residual -; conditionals from the last running of the shell are flushed. Each -; shell input sequence begins afresh. On the other hand, if SHELLIF is -; off, flow control commands inside a shell script must be flushed so -; that they do not interfere with user entered commands. -; b) Directory prefixes are ignored for flow commands, since all flow control -; processing must pass through the FCP (the command must run even when -; the current flow state is false). -; c) If the command is not found in the FCP, then the current flow state is -; tested. If it is false, the command is flushed and the code branches -; back to get the next command. -; d) If the command had a directory prefix (a colon alone is sufficient), -; then steps #2 and #3 are skipped over,and the command is processed -; immediately as a transient program. -; e) In ZCPR33, unlike ZCPR30, RCP commands are scanned before CPR commands. -; This has been done so that more powerful RCP commands can supercede -; CPR commands. -; f) If the SKIPPATH option is enabled, when an explicit directory is -; specified with a command (but not just a colon), searching of the path -; is bypassed. If the FASTECP option is enabled, commands with leading -; spaces are sent directly to the ECP for processing. -; g) If no external command can be found, ZCPR33 performs extensive error -; handling. If the command error occurred while looking for a shell -; program, then the shell stack is popped. Otherwise, ZCPR33 tries to -; invoke an external, user-specified error handling command line. If -; none was specified or if the error handler invoked by that command -; line cannot be found, the internal error message (step #6) is displayed. - - -;----------------------------------------------------------------------------- - -runcmd: - if shellif ; If shells reininitialize flow control... - ld a,(cmdstatfl) ; Get command status flag - bit 0,a ; Shell bit set? - jr z,fcpcmd ; If not a shell, process command - xor a ; Otherwise, shell is running, so - ld (ifptrfl),a ; ..reinitialize the IF system and continue - endif ;shellif - - -; ---------- Module <<1>>: Flow Control Processing - -; An option is supported here to allow the address of the FCP to be obtained -; from the environment descriptor. This is logically consistent with the -; pholosopy of the Z-System and is useful when one wants to have a single block -; of FCP/RCP memory that can be allocated dynamically between FCP and RCP -; functions. - -fcpcmd: - - if fcp ne 0 ; Omit code if FCP not implemented - - if fcpenv ; If getting FCP address from Z3ENV - - ld e,12h ; Offset in Z3ENV to FCP address - call pkgoff ; Set HL to FCP+5 - jr z,runcmd1 ; Skip if no FCP present - - else ; using fixed FCP address - - ld hl,fcp+5 ; Get address from Z3BASE.LIB - - endif ;fcpenv - - -; If flow control processing is not allowed in shell aliases (scripts running -; as shell commands), then we have to make sure that we flush any flow control -; commmands, otherwise the CPR will attempt to execute them as transients, -; with dire consequences. In the code below we check the shell bit. If it -; is not set, we proceed normally. If it is set, we scan for flow commands -; and then jump past the flow testing to RUNFCP2, where the code will flush -; the command if it was a flow command and execute it unconditionally if not. - - if not shellif - ld a,(cmdstatfl) ; Get command status flag - bit 0,a ; If shell bit not set, - jr z,runfcp1 ; ..we do normal processing - call cmdscan ; Otherwise, check for flow command - jr runfcp2 ; ..and flush if so using code below - endif ;not shellif - -runfcp1: - call cmdscan ; Scan command table in the module - jr z,callprog ; Run if found (with no leading CRLF) - -; This is where we test the current IF state. If it is false, we skip this -; command. - - call iftest ; Check current IF status - -runfcp2: ; If false, skip this command and go on to next - if drvprefix ; If DRVPREFIX we can use code below - jr z,jpnextcmd ; ..to save a byte - else ; Otherwise, we have to do an - jp z,nextcmd ; ..absolute jump - endif ;drvprefix - - endif ;fcp ne 0 - - -runcmd1: - if fastecp or badduecp - ld a,(firstchar) ; If FIRSTCHAR flag set for ECP invocation, - cp ' ' ; ..then go straight to transient processing - jr z,com - endif ;fastecp or badduecp - -colon equ $+1 ; Flag for in-the-code modification - ld a,0 ; If command had a directory prefix (even just - or a ; ..a colon) then skip over resident commands - jr nz,comdir - - -; ---------- Module <<2>>: RCP Processing - -; An option is supported here to allow the address of the RCP to be obtained -; from the environment descriptor. This is logically consistent with the -; pholosopy of the Z-System and is useful when one wants to have a single block -; of FCP/RCP memory that can be allocated dynamically between FCP and RCP -; functions. - - if rcp ne 0 ; Omit code if RCP not implemented - -rcpcmd: - - if rcpenv ; If getting address of rcp from Z3ENV - - ld e,0ch ; Offset in Z3ENV to RCP address - call pkgoff ; Set HL to address of RCP+5 - jr z,cprcmd ; Skip if no RCP - - else ; using fixed RCP address - - ld hl,rcp+5 ; Get address from Z3BASE.LIB - - endif ; rcpenv - - call cmdscan ; Check for command in RCP - jr z,callproglf ; If so, run it (with leading CRLF) - - endif ;rcp ne 0 - - -; ---------- Module <<3>>: CPR-Resident Command Processing - -cprcmd: - - ld hl,cmdtbl ; Point to CPR-resident command table - call cmdscan ; ..and scan for the command - jr z,callprog ; If found, run it (with no leading CRLF) - - - -; ---------- Module <<4>>: Transient Command Processing - -comdir: ; Test for DU: or DIR: only (directory change) - - if drvprefix - - ld a,(cmdfcb+1) ; Any command name? - cp ' ' - jr nz,com ; If so, must be transient or error - - ; Entry point for change of directory only - - if wdu ; If controlled by wheel.. - - ld a,(z3whl) ; Get wheel byte - or a ; If wheel on, go on ahead - jr nz,comdir1 - - if badduecp - ld (colon),a ; Pretend there is no colon - ld a,' ' ; Force invocation of ECP - ld (firstchar),a - jr com - else ;not badduecp - ld a,ecduchg - jr z,error - endif ;badduecp - - endif ; wdu - -comdir1: - ld hl,(tempusr) ; Get temporary drive and user bytes - - if not highuser ; If only users 0..15 can be logged - ld a,l ; Get user number and - cp 16 ; ..make sure not above 15 - jr nc,baddirerr ; If out of range, invoke error handling - endif ;not highuser - - dec h ; Shift drive to range 0..15 - ld (curusr),hl ; Make the temporary DU into the current DU - call logcurrent ; Log into the new current directory -jpnextcmd: - jp nextcmd ; Resume command line processing - - else ;not drvprefix - - if badduecp - xor a ; Pretend there is no colon - ld (colon),a - ld a,' ' ; Force invocation of ECP - ld (firstchar),a - else ;not badduecp - ld a,ecduchg - jr z,error - endif ;badduecp - - endif ;drvprefix - - -com: ; Process transient command - - ld a,(cmdstatfl) ; Check command status flag to see if - and 2 ; ..error handler is running - ld (zexinpfl),a ; Store result in ZEX control flag (2 will turn - ; ..ZEX input redirection off (0 = on) - if subon - ld (xsubflag),a ; Turn off XSUB input redirection also - endif ;subon - - ld hl,tpa ; Set default execution/load address - ld a,3 ; Dynamically load type-3 and above ENVs - call mload ; Load memory with file specified in cmd line - ld a,(cmdstatfl) ; Check command status flag to see if - and 100b ; ..ECP running (and suppress leading CRLF) - -; CALLPROG is the entry point for the execution of the loaded program. At -; alternate entry point CALLPROGLF if the zero flag is set, a CRLF is sent to -; the console before running the program. - -callproglf: - call z,crlf ; Leading new line - -callprog: - ; Copy command tail into TBUFF - -tailsv equ $+1 ; Pointer for in-the-code modification - ld hl,0 ; Address of first character of command tail - ld de,tbuff ; Point to TBUFF - push de ; Save pointer - ld bc,7e00h ; C=0 (byte counter) and B=7E (max bytes) - inc de ; Point to first char -tail: - ld a,(hl) ; Get character from tail - call tsteol ; Check for EOL - jr z,tail1 ; Jump if we are done - ld (de),a ; Put character into TBUFF - inc hl ; Advance pointers - inc de - inc c ; Increment character count - djnz tail ; If room for more characters, continue - call print ; Display overflow message - db bell ; ..ring bell - db 'Ovf','l'+80h ; ..then continue anyway -tail1: - xor a ; Store ending zero - ld (de),a - pop hl ; Get back pointer to character count byte - ld (hl),c ; Store the count - -; Run loaded transient program - - call defltdma ; Set DMA to 0080h standard value - -; Perform automatic installation of Z3 programs (unless type-2 environment) - - ld hl,(execadr) ; Get current execution address - call z3chk ; See if file is a Z3 program - jr nz,noinstall ; Branch if not - - cp 2 ; If type-2 (internal) environment - jr z,noinstall ; ..do not perform installation - - inc hl ; Advance to place for ENV address - ld (hl),low z3env ; Put in low byte of environment address - inc hl - ld (hl),high z3env ; Put in high byte - -noinstall: - -; Execution of the program occurs here by calling it as a subroutine - - ld hl,z3env ; Pass environment address to program in HL -execadr equ $+1 ; Pointer for in-line code modification - call 0 ; Call transient - -; Return from execution - - if shellif ; If flow processing allowed in shells... - ld hl,cmdstatfl ; Reset the shell bit in the command status - res 0,(hl) ; ..flag so multiple-command shells will work - endif ;shellif - - ; Continue command processing - if drvprefix ; If DRVPREFIX we can save a byte by - jr jpnextcmd ; ..doing a two-step relative jump - else ; Otherwise, we just have to do - jp nextcmd ; ..the absolute jump - endif ;drvprefix - - -; ---------- Module <<5>>: External Error Handler Processing - -baddirerr: - ld a,ecbaddir ; Error code for bad directory specification - -error: - -; If we are returning from an external command to process an error, we want -; to leave the error return code as it was set by the transient program. - - ld hl,cmdstatfl ; Point to command status flag - bit 3,(hl) ; Check transient error flag bit - jr nz,error1 ; If set, leave error code as set externally - ld (ecflag),a ; Otherwise, save error code from A register - -error1: - res 2,(hl) ; Reset the ECP bit to prevent recursion of - ; ..error handler by programs that don't - ; ..clear the bit - bit 0,(hl) ; Was error in attempting to run a shell? - jr nz,errsh ; If so, pop shell stack - -; The following code is included to avoid a catastrophic infinite loop when -; the external error handler cannot be found. After one unsuccessful try, -; the internal code is invoked. - - bit 1,(hl) ; Was an error handler already called? - jr nz,errintrnl ; If so, use internal error handler - -; If the current IF state is false, we would like to ignore the error and just -; go on with the next command. Unfortunately, for some errors (e.g., a bad -; command format such as a command with a wildcard character) the error handler -; is invoked before the pointer in the multiple command line buffer is set up -; to the next command. In that case, we fall into an infinite loop. We also -; must not allow the external error handler to run, since it will not run and -; we will again fall into an infinite loop. The present code is not so bad, of -; course, since even a command in a false part of a command sequence should not -; have a true error in it. We have already put in code to bypass password -; checking during a false IF state, since a command with a password is not an -; invalid command. - - if fcp ne 0 - call iftest ; If we are in a false IF state, external - jr z,errintrnl ; ..handler will not run, so use built-in - endif ;fcp ne 0 - - set 1,(hl) ; Set command status flag for error invocation - ld hl,errcmd ; Point to error handler command line - ld a,(hl) ; Check first byte for presence of an - or a ; ..error command line - jr z,errintrnl ; If no error handler, use built-in one - ld (nxtchr),hl ; Else, use error command line as next command - jp nextcmd1 ; Run command without resetting status flag - - -; ---------- Module <<6>>: Resident Error Handler Code - -; If the error is with the invocation of a shell command, we pop the bad shell -; command off the stack to prevent recursion of the error. We then use the -; the internal error handler to echo the bad shell command. - -errsh: - - ld de,shstk ; Point to current entry in shell stack - ld hl,shstk+shsize ; Point to next entry in stack - ld bc,[shstks-1]*shsize ; Bytes to move - ldir ; Pop the stack - xor a ; Clear the last entry position - ld (de),a - -errintrnl: - if subon - call subkil ; Terminate active submit file if any - endif ;subon - - call crlf ; New line - ld hl,(cmdptr) ; Point to beginning of bad command - call printhl ; Echo it to console - call print ; Print '?' - defb '?'+80h - jp restart ; Restart CPR - -; End ZCPR33-2.Z80 - - page - -; ZCPR33-3.Z80 - -;============================================================================= -; -; C O M M A N D L I N E P A R S I N G C O D E -; -;============================================================================= - -; This code parses the command line pointed to by HL. The command verb is -; parsed, placing the requested program name into the command file control -; block. The drive and user bytes are set. If an explicit DU or DIR was -; given, the COLON flag is set so that the processor knows about this later -; when the command search path is built. - -parser: - - ld de,cmdfcb ; Point to the command FCB - push de - call initfcb ; Initialize the FCB - pop de - ld (duerrflag),a ; Store zero (INITFCB ends with A=0) into flag - call scanner ; Parse first token on command line into FCB - jr nz,badcmd ; Invoke error handler if '?' in command - -duerrflag equ $+1 ; Pointer for in-the-code modification - ld a,0 ; See if bad DU/DIR specified with command verb - or a - - if badduecp - jr z,parser1 ; If DU/DIR is OK, skip ahead - ld a,(cmdstatfl) ; If ECP already running - bit 2,a ; ..skip ahead - jr nz,parser1 - ld a,(cmdfcb+1) ; If not a directory change command - sub ' ' ; ..invoke error handler - jr nz,baddirerr - ; If bad directory change attempt, - ld (tmpcolon),a ; ..pretend there is no colon (A=0) - ld a,' ' ; ..and force immediate ECP invocation - ld (firstchar),a ; ..when command is processed - else ; If errors not processed by ECP then - jr nz,baddirerr ; ..invoke error handler - endif ; badduecp - -parser1: - ld de,cmdfcb+9 ; Make sure no explicit file type was given - ld a,(de) ; Get first character of file type - cp ' ' ; Must be blank -badcmd: - ld a,ecbadcmd ; Error code for illegal command form - jr nz,error ; If not, invoke error handler - - push hl ; Save pointer to next byte of command - ld hl,commsg ; Place default file type (COM) into FCB - ld bc,3 - ldir - pop hl ; Get command line pointer back - -; The following block of code is arranged so that the COLON flag is set only -; when an explicit directory specification is detected in the command verb. -; Other parses also change the TMPCOLON flag, but only when passing here does -; the flag get transferred to COLON. - -tmpcolon equ $+1 ; Pointer for in-the-code modification - ld a,0 ; ..by SCANNER routine - ld (colon),a ; If explicit DU/DIR, set COLON flag - -; Find the end of this command and set up the pointer to the next command. - - push hl ; Save command line pointer - dec hl ; Adjust for preincrementing below -parser2: ; Find end of this command - inc hl ; Point to next character - ld a,(hl) ; ..and get it - call tsteol ; Test for end of command - jr nz,parser2 ; Keep looping if not - - ld (nxtchr),hl ; Set pointer to next command - pop hl ; Get back pointer to current command tail - -; This block of code parses two tokens in the command line into the two -; default FCBs at 5Ch and 6Ch. It also sets a pointer to the command tail -; for later copying into the command tail buffer at 80h. This code is used -; first when attempting to parse a normal command line and possibly again -; later when the entire user's command is treated as a tail to the extended -; command processor. The resident JUMP and SAVE commands use it also, and -; the entry point is available at location CCP+9 for use by other programs. - -parsetail: - ld (tailsv),hl ; Save pointer to command tail - - ; Process first token - - ld de,tfcb ; Point to first default FCB - push de ; Save pointer while initializing - call initfcb ; Initialize both default FCBs - pop de - call sksp ; Skip over spaces in command line - call nz,scanner ; If not end of line, parse the token - ; ..into first FCB - ld (parseptr),hl ; Save pointer to second token for reparsing - - ; Process second token - - call sksp ; Skip over spaces - ret z ; Done if end of line or end of command - ld de,tfcb2 ; Point to second default FCB - ; ..and fall through to SCANNER routine - -;----------------------------------------------------------------------------- - -; This routine processes a command line token pointed to by HL. It attempts -; to interpret the token according to the form [DU:|DIR:]NAME.TYP and places -; the corresponding values into the FCB pointed to by DE. On exit, HL points -; to the delimiter encountered at the end of the token. The Z flag is set if -; a wild card was detected in the token. - -scanner: - xor a ; Initialize various flags - ld (tmpcolon),a ; Set no colon - ld bc,(curusr) ; Get current drive and user into BC - inc b ; Shift drive range from 0..15 to 1..16 - ld (tempusr),bc ; Initialize temporary DU - - call scanfld8 ; Extract possible file name - cp ':' ; Was terminating character a colon? - jr nz,scantype ; If not, go on to extract file type - ld (tmpcolon),a ; Otherwise, set colon and process DU/DIR - inc hl ; Point to character after colon - -; Code for resolving directory specifications (macro RESOLVE is defined in -; Z33MAC.LIB). RESOLVE returns with a nonzero value and a NZ flag setting -; if the DU/DIR specification cannot be resolved. There are quite a few -; possibilities here. - - ; Case where both forms are accepted - - if accptdir and accptdu - if dufirst - resolve du,dir ; Check DU: form before DIR: form - else - resolve dir,du ; Check DIR: form before DU: form - endif ;dufirst - endif ;accptdir and accptdu - - ; Cases of only one form accepted - - if accptdu and not accptdir - resolve du, ; Check only DU: form - endif ;accptdu and not accptdir - - if accptdir and not accptdu - resolve dir, ; Check only DIR: form - endif ;accptdir and not accptdu - - ; Case of neither form accepted - - if not accptdir and not accptdu - push hl ; Save pointer to command string - inc de ; Point to first character of name - ld a,(de) ; Get it - dec de ; Restore the pointer - sub ' ' ; If no name is there, A=0 and Z flag set - endif ;not accptdir and not accptdu - - push de ; Save pointer to FCB again - push af ; Save bad directory flag - ld a,(tempdr) ; Set designated drive - ld (de),a ; ..into FCB - inc de ; Point to file name field - call ifcb ; Perform partial init (set user code) - pop af ; Get bad directory flag back - ld (duerrflag),a ; Save flag in parser code - jr z,scanner1 ; Branch if valid directory specified - dec de ; Back up to record count byte - dec de - ld (de),a ; Store error flag there (NZ if error) -scanner1: - pop de ; Get FCB pointer back - pop hl ; Restore pointer to command string - call scanfld8 ; Scan for file name - -; This code processes the file type specification in the token - -scantype: - ld a,(hl) ; Get ending character of file name field - ex de,hl ; Switch FCB pointer into HL - ld bc,8 ; Offset to file type field - add hl,bc - ex de,hl ; Switch pointers back - - ld b,3 ; Maximum characters in file type - cp '.' ; See if file type specified - jr nz,scantype2 ; If not, skip over file type parsing - - inc hl ; Point to character after '.' - push de ; Save pointer to FCB file type - call scanfield ; Parse file type into FCB - pop de - -scantype2: - ex de,hl ; Swap pointers again - ld bc,5 ; Offset from file type to S1 field in FCB - add hl,bc - ex de,hl ; Swap pointers back - ld a,(tempusr) ; Get specified user number - ld (de),a ; ..and store in S1 byte of FCB - -scan3: ; Skip to space character, character after an - ; ..equal sign, or to end of command - ld a,(hl) ; Get next character - cp ' '+1 ; Done if less than space - jr c,scan4 - call tsteol ; Done if end of line or end of command - jr z,scan4 - inc hl ; Skip on to next character - cp '=' ; If not equal sign - jr nz,scan3 ; ..keep scanning - -scan4: ; Set zero flag if '?' in filename.typ - -qmcnt equ $+1 ; Pointer for in-the-code modification - ld a,0 ; Number of question marks - or a ; Set zero flag - ret - -; This routine invokes SCANFIELD for a file name field. It initializes the -; question mark count and preserves the FCB pointer. - -scanfld8: - xor a ; Initialize question mark count - ld (qmcnt),a - push de ; Save pointer to FCB - ld b,8 ; Scan up to 8 characters - call scanfield - pop de ; Restore pointer to FCB - ret - -; This routine scans a command-line token pointed to by HL for a field whose -; maximum length is given by the contents of the B register. The result is -; placed into the FCB buffer pointed to by DE. The FCB must have had its name -; and type fields initialized before this routine is called. Wild cards of -; '?' and '*' are expanded. On exit, HL points to the terminating delimiter. - -scanfield: - call sdelm ; Done if delimiter encountered - ret z - inc de ; Point to next byte in FCB - cp '*' ; Is character a wild card? - jr nz,scanfld1 ; Continue if not - - ld a,'?' ; Process '*' by filling with '?'s - ld (de),a - call qcountinc ; Increment count of question marks - jr scanfld2 ; Skip so HL pointer left on '*' - -scanfld1: ; Not wildcard character '*' - ld (de),a ; Store character in FCB - inc hl ; Point to next character in command line - cp '?' ; Check for question mark (wild) - call z,qcountinc ; Increment question mark count -scanfld2: - djnz scanfield ; Decrement char count until limit reached -scanfld3: - call sdelm ; Skip until delimiter - ret z ; Zero flag set if delimiter found - inc hl ; Pt to next char in command line - jr scanfld3 - - -; Subroutine to increment the count of question mark characters in the -; parsed file name. - -qcountinc: - push hl - ld hl,qmcnt ; Point to count - inc (hl) ; Increment it - pop hl - ret - -;----------------------------------------------------------------------------- - -; Validate the password pointed to by HL. Prompt user for password entry -; and return zero if it is correct. - - if pwcheck - -passck: - push hl ; Save pointer to password - call print ; Prompt user - defb cr,lf,'PW?',' '+80h - ld hl,pwlin ; Set up buffer for user input - ld bc,90ah ; Set 0ah (BDOS readln function) in C - ld (hl),b ; ..and 9 (max character count) in B - ex de,hl ; Switch buffer pointer to DE - - if pwnoecho - ld a,0c9h ; Disable BIOS conout routine to - ld (bios+0ch),a ; ..suppress password echoing - call bdossave ; Get user input - ld a,0c3h ; Reenable BIOS conout routine - ld (bios+0ch),a - else ;not pwnoecho - call bdossave ; Get user input - endif ;pwnoecho - - ex de,hl ; Restore pointer to HL - inc hl ; Point to count of characters entered - ld a,(hl) ; Get character count - inc hl ; Point to first character - push hl ; Save pointer while marking end of input - call addah ; Advance HL to just past last character - ld (hl),' ' ; Place space there - pop de ; Restore pointer to beginning of user input - pop hl ; Restore pointer to password from NDR - ld b,8 ; Maximum characters to compare -pwck: - ld a,(de) ; Get next user character - call ucase ; Capitalize it - cp (hl) ; Compare to NDR - ret nz ; No match - cp ' ' ; If last user character matched space in - ret z ; ..NDR, then we have a complete match - inc hl ; If not done, point to next characters - inc de - djnz pwck ; (flags not affected by DJNZ) - xor a ; Set zero flag and - ret ; ..return Z to show success - - endif ; pwcheck - -;----------------------------------------------------------------------------- - -; This code attempts to interpret the token in the FCB pointed to by register -; pair DE as a DIR (named directory) prefix. If it is successful, the drive -; and user values are stored in TEMPDR and TEMPUSR, the zero flag is set, and -; a value of zero is returned in register A. -; -; If the named directory is found to be password restricted, then the user is -; asked for the password (unless the directory is the one currently logged or -; the current IF state is false). If an incorrect password is entered, the -; error handler is generally invoked directly. The exception to this is when -; the transient program bit is set in the command status flag (this bit would -; be set by a non-CPR program that calls REPARSE). In this case the default -; directory is returned, the zero flag is reset, and a nonzero value in -; returned in register A to show a bad directory. In addition, the code in -; SCANNER will set record-count byte in the FCB to a nonzero value so that -; the calling program can detect the error. [Note: if DU processing is also -; allowed and it follows DIR processing, DUSCAN will also be called. Unless -; there is a passworded directory with a DU form, this will cause no trouble.] - - if accptdir - -dirscan: - -; If the DU form is not allowed, we have to detect a colon-only condition here. -; Otherwise DUSCAN will take care of it. - - inc de ; Point to first byte of directory form - - if not accptdu - ld a,(de) ; Get first character of directory - sub ' ' ; If it is a blank space - ret z ; ..we have a successful directory resolution - endif ;not accptdu - - ex de,hl ; Switch pointer to FCB to HL - - if ndrenv ; If getting NDR address for Z3ENV - ld e,15h ; Offset to NDR address - push hl ; Preserve pointer to FCB - call pkgoff ; Get NDR address from ENV into DE - pop hl - jr z,direrr ; Branch if no NDR implemented - else ; using fixed address of NDR buffer - ld de,z3ndir ; Point to first entry in NDR - endif ; ndrenv - -dirscan1: - ld a,(de) ; Get next character - or a ; Zero if end of NDR - jr z,direrr - inc de ; Point to name of directory - inc de - push hl ; Save pointer to name we are looking for - push de ; Save pointer to NDR entry - ld b,8 ; Number of characters to compare - -dirscan2: - ld a,(de) - cp (hl) - jr nz,dirscan3 ; If no match, quit and go on to next DIR - inc hl ; Point to next characters to compare - inc de - djnz dirscan2 ; Count down - -dirscan3: - pop de ; Restore pointers - pop hl - jr z,dirscan4 ; Branch if we have good match - - ex de,hl ; Advance to next entry in NDR - ld bc,16 ; 8 bytes for name + 8 bytes for password - add hl,bc - ex de,hl - jr dirscan1 ; Continue comparing - -; If ACCPTDU is enabled, we can share similar code in DUSCAN and do not need -; the code here. - - if not accptdu -direrr: ; No match found - dec a - ret - endif ;not accptdu - -dirscan4: ; Match found - ex de,hl ; Switch pointer to NDR entry into HL - push hl ; ..and save it for later - dec hl ; Point to user corresponding to the DIR - ld c,(hl) ; Get user value into C - dec hl ; Point to drive - ld b,(hl) ; Get it into B - - if pwcheck - - ld hl,(curusr) ; Get current drive/user into HL - inc h ; Shift drive to range 1..16 - xor a ; Clear carry flag - sbc hl,bc ; Compare - pop hl ; Restore pointer to NDR entry - jr z,setdu ; If same, accept values without PW checking - -; If WPASS is set, then password checking is bypassed when the wheel byte is -; set. - - if wpass - ld a,(z3whl) ; Get wheel byte - or a ; If wheel byte set - jr nz,setdu ; ..skip checking passwords - endif ;wpass - -; This code is a bit tricky. We do not want to be asked for passwords for -; named directory references in commands when the current IF state is false. -; So, first we check to see if there is a password on the directory. If not, -; we proceed to set the temporary DU to the specified directory. If there is -; a password, we check the current IF state. If it is false, we do not check -; passwords and pretend there was no password. However, we leave the current -; directory in effect. This will work properly in all but one rare -; circumstance. When the command is an 'OR' command with a reference to a -; passworded named directory (e.g., "OR EXIST SECRET:FN.FT"), the password -; will not be requested and the current directory will be used instead of the -; specified one. - - push bc ; Save requested drive/user - ld bc,8 ; Point to password in NDR - add hl,bc - ld a,(hl) ; Get first character of password - cp ' ' ; Is there a password? - - if fcp eq 0 ; If FCP not implemented ... - - call nz,passck ; Perform password checking if pw present - - else ;fcp ne 0 ; FCP implemented ... - - jr z,dirscan5 ; If no pw, skip ahead - call iftest ; Otherwise, test current IF state - pop bc ; Restore BC in case we return now - ret z ; If false IF in effect, fake success without - ; ..checking password (but TEMPDR/TEMPUSR not - ; ..set) - push bc ; Otherwise, save BC again - call passck ; Perform password checking - - endif ;fcp eq 0 - -dirscan5: - pop bc ; Restore requested drive/user - jr z,setdu ; If not bad password, set it up - ld a,(cmdstatfl) ; See if external invocation (disable - bit 3,a ; ..error handling if so) - ret nz ; Return NZ to show bad directory - ld a,ecbadpass ; Error code for bad password - jp error - - else ;not pwcheck - - pop hl ; Clean up stack - if accptdu ; If we cannot fall through, branch - jr setdu - endif ;accptdu - - endif ;pwcheck - - if not accptdu ; If NOT ACCPTDU, we have to supply code here -setdu: - ld (tempusr),bc - xor a ; Set Z to flag success - ret - endif ;not accptdu - - endif ;accptdir - -;----------------------------------------------------------------------------- - -; This code attempts to interpret the token in the FCB pointed to by register -; pair DE as a DU (drive/user) prefix. If it is successful, the drive and -; user values are stored in TEMPDR and TEMPUSR, the zero flag is set, and a -; value of zero is returned in register A. Otherwise the zero flag is reset -; and a nonzero value is returned in register A. -; -; The ADUENV option allows acceptance of the DU form to be controlled by the -; DUOK flag in the environment descriptor. An additional feature of this code -; when the ADUENV option is enabled is that a DU value is always accepted, -; even if DUOK is off and even if it is outside the normally allowed range, -; if it corresponds to a named directory with no password. The currently -; logged directory is unconditionally acceptable (if you got there once, you -; can stay as long as you like without further hassles). - - if accptdu ; Allow DU: form - -direrr: ; This code may do double duty for DIRSCAN - ; ..above -duerr: - xor a ; Return NZ to show failure - dec a - ret - -duscan: - ex de,hl ; Switch FCB pointer to HL - inc hl ; Point to first byte of file name in FCB - - ld bc,(curusr) ; Preset C to current user, B to current drive - ld a,(hl) ; Get possible drive specification - sub 'A' ; Otherwise convert to number 0..15 - jr c,duscan1 ; If < 0, leave B as is - cp 16 - jr nc,duscan1 ; If > 15, leave B as is - ld b,a ; Otherwise use value given - inc hl ; ..and point to next character - -duscan1: - inc b ; Shift drive to range 1..16 - ld a,(hl) ; Get possible user specification - cp ' ' - jr z,duscan2 ; If none present, leave C as is - push bc ; Save DU values in BC - call decimal1 ; Get specified decimal user number into BC - pop hl ; Restore values to HL - jr c,duerr ; Return NZ if invalid decimal conversion - ld a,b ; Get high byte of result - or a ; Make sure it is zero - ret nz ; If not, return NZ to show bad user number - ld b,h ; DU value is now in BC - -; If the specified directory is the currently logged directory, accept it -; even if it is out of range and/or password protected. - -duscan2: - ld hl,(curusr) ; Get current drive/user into HL - inc h ; Shift drive to range 1..16 - xor a ; Clear carry flag - sbc hl,bc ; Compare values - jr z,setdu - -; If the specified DU corresponds to a named directory with no password, or -; if WPASS is enabled so that password checking is not performed when the -; wheel byte is set, then accept it. - - if z3ndir ne 0 - - call du2dir ; See if there is a matching named directory - jr z,duscan3 ; If not, skip on - - if pwcheck ; If passwords are being checked... - - if wpass - ld a,(z3whl) ; Get wheel byte - or a ; If wheel byte set, skip checking passwords - jr nz,setdu ; ..and accept the DU values - endif ;wpass - - ld de,9 ; Advance to password - add hl,de - ld a,(hl) ; Get first character of password - cp ' ' - jr z,setdu ; If none, we have a valid DU - - else ;not pwcheck - - jr setdu ; Set the DU - - endif ;pwcheck - - endif ;z3ndir ne 0 - -duscan3: - if aduenv ; Check DUOK flag in ENV - ld a,(duokfl) ; Get flag - or a ; If DU not accepted - jr z,duerr ; ..skip over the DU scan - endif ;aduenv - - if duenv ; If getting max drive and user from ENV - ld hl,(maxdrenv) ; Get max drive into L and max user into H - ld a,l ; Test drive value - cp b - jr c,duerr - ld a,h ; Test user value - cp c - jr c,duerr - else ; Using fixed values of max DU - ld a,maxdisk - cp b - jr c,duerr - ld a,maxusr - cp c - jr c,duerr - endif ;duenv - -setdu: - ld (tempusr),bc - xor a ; Set Z to flag success - ret - - endif ; accptdu - -; End ZCPR33-3.Z80 - - page - -; ZCPR33-4.Z80 - -;============================================================================= -; -; G E N E R A L S U B R O U T I N E S S E C T I O N -; -;============================================================================= - - -;----------------------------------------------------------------------------- -; -; CHARACTER I/O BDOS ROUTINES -; -;----------------------------------------------------------------------------- - -; Get uppercase character from console (with ^S processing). Registers B, -; D, H, and L are preserved. The character is returned in A. - -conin: - ld c,1 ; BDOS conin function - call bdossave - ; Fall through to UCASE - -;-------------------- - -; Convert character in A to upper case. All registers except A are preserved. - -ucase: - and 7fh ; Mask out msb - cp 61h ; Less than lower-case 'a'? - ret c ; If so, return - cp 7bh ; Greater than lower-case 'z'? - ret nc ; If so, return - and 5fh ; Otherwise capitalize - ret - -;---------------------------------------- - -; Output CRLF - -crlf: - call print - db cr - db lf or 80h - ret - -;---------------------------------------- - -; Output character in A to the console. All registers are preserved. - -conout: - push de - push bc - ld c,2 ; BDOS conout function -output: ; Entry point for LCOUT below - ld e,a - call bdossave - pop bc - pop de - ret - -;---------------------------------------- - -; Print the character string immediately following the call to this routine. -; The string terminates with a character whose high bit is set or with a null. -; At entry point PRINTC the string is automatically preceded by a -; carriage-return-linefeed sequence. All registers are preserved except A. - -printc: - call crlf ; New line - -print: - ex (sp),hl ; Get pointer to string - call printhl ; Print string - ex (sp),hl ; Restore HL and set return address - ret - -;---------------------------------------- - -; Print the character string pointed to by HL. Terminate on character with -; the high bit set or on a null character. On return HL points to the byte -; after the last character displayed. All other registers except A are -; preserved. - -printhl: - ld a,(hl) ; Get a character - inc hl ; Point to next byte - or a ; End of string null? - ret z - push af ; Save flags - and 7fh ; Mask out msb - call conout ; Print character - pop af ; Get flags - ret m ; String terminated by msb set - jr printhl - - -;----------------------------------------------------------------------------- -; -; FILE I/O BDOS ROUTINES -; -;----------------------------------------------------------------------------- - -; Read a record from a file to be listed or typed - - if lton ; Only needed for LIST and TYPE functions - -readf: - ld de,tfcb - jr read - - endif ; lton - -;---------------------------------------- - -; Read a record from the command file named in CMDFCB - -readcmd: - ld de,cmdfcb - -; Read a record from file whose FCB is pointed to by DE - -read: - ld c,14h ; Read-sequential function - ; Fall through to BDOSSAVE - -;-------------------- - -; Call BDOS for read and write operations. The flags are set appropriately. -; The BC, DE, and HL registers are preserved. - -bdossave: - putreg - call bdos - getreg - or a ; Set flags -note: ; This return is used for NOTE command, too - ret - - -;----------------------------------------------------------------------------- -; -; MISCELLANEOUS BDOS ROUTINES -; -;----------------------------------------------------------------------------- - -; Set DMA address. At the entry point DEFLTDMA the address is set to the -; default value of 80H. At the entry point DMASET it is set to the value -; passed in the DE registers. - -defltdma: - ld de,tbuff -dmaset: - ld c,1ah - jr bdossave - -;---------------------------------------- - -; Log in the drive value passed in the A register (A=0). - -setdrive: - ld e,a - ld c,0eh - jr bdossave - -;---------------------------------------- - -; Open a file. At entry point OPENCMD the file is the one specified in -; CMDFCB, and the current record is set to zero. At entry point OPEN -; the file whose FCB is pointed to by DE is used. - -opencmd: - xor a ; Set current record to 0 - ld (cmdfcb+32),a - ld de,cmdfcb ; Command file control block - ; Fall through to open - -open: - ld c,0fh ; BDOS open function - ; Fall through to BDOSTEST - -;-------------------- - -; Invoke BDOS for disk functions. This routine increments the return code in -; register A so that the zero flag is set if there was an error. Registers -; BC, DE, and HL are preserved. - -bdostest: - call bdossave - inc a ; Set zero flag for error return - ret - -;---------------------------------------- - -; Close file whose FCB is pointed to by DE. - - if saveon or subon -close: - ld c,10h - jr bdostest - endif ;saveon or subon - -;---------------------------------------- - -; Search for first matching file. At entry point SRCHFST1 the first default FCB -; is used. At entry point SRCHFST the FCB pointed to by DE is used. - - if diron or eraon or renon or saveon -srchfst1: - ld de,tfcb ; Use first default FCB - endif ;diron or eraon or renon or saveon - -srchfst: - ld c,11h - jr bdostest - -;----------------------------------------------------------------------------- - -; Search for next matching file whose FCB is pointed to by DE. - - if diron or eraon ; Only needed by DIR and ERA functions -srchnxt: - ld c,12h - jr bdostest - endif ; diron or eraon - -;----------------------------------------------------------------------------- - -; Kill any submit file that is executing. - - if subon - -subkil: - ld hl,subflag ; Check for submit file in execution - ld a,(hl) - or a ; 0=no - ret z ; If none executing, return now - ; Kill submit file - xor a - ld (hl),a ; Zero submit flag - call setuser ; Log in user 0 - ld de,subfcb ; Delete submit file - ; ..by falling through to delete routine - - endif ; subon - -;-------------------- - -; Delete file whose FCB is pointed to by DE. - - if eraon or renon or saveon or subon -delete: - ld c,13h - jr bdossave - endif ;eraon or renon or saveon or subon - -;----------------------------------------------------------------------------- - -; Get and set user number. Registers B, D, H, and L are preserved. Register -; E is also preserved at entry point SETUSER1. - -getuser: - ld a,0ffh ; Get current user number -setuser: - ld e,a ; User number in E -setuser1: - ld c,20h ; Get/Set BDOS function - jr bdossave - - -;----------------------------------------------------------------------------- -; -; GENERAL UTILITY ROUTINES -; -;----------------------------------------------------------------------------- - - -; This subroutine checks to see if a program loaded at an address given by HL -; has a Z3ENV header. If the header is not present, the zero flag is reset. -; If it is present, the zero flag is set, and on return HL points to the -; environment-type byte and A contains that byte. - -z3chk: - ld de,z3env+3 ; Point to 'Z3ENV' string in ENV - inc hl ; Advance three bytes to possible program - inc hl ; ..header - inc hl - ld b,5 ; Characters to compare -z3chk1: ; Check for Z3 ID header - ld a,(de) ; Get character from ENV descriptor - cp (hl) ; Compare it to loaded file - ret nz ; Quit now if mismatch - inc hl ; If same, advance to next characters - inc de ; ..and continue comparing - djnz z3chk1 ; (flags not affected by DJNZ) - ld a,(hl) ; Return the environment type in A - ret ; Return Z if all 5 characters match - -;---------------------------------------- - -; Subroutine to skip over spaces in the buffer pointed to by HL. On return, -; the zero flag is set if we encountered the end of the line or a command -; separator character. - -sksp: - ld a,(hl) ; Get next character - inc hl ; Point to the following character - cp ' ' ; Space? - jr z,sksp ; If so, keep skipping - dec hl ; Back up to non-space - ; ..and fall through - -;-------------------- - -; Subroutine to check if character is the command separator or marks the end -; of the line. - -tsteol: - or a ; End of command line? - ret z ; Return with zero flag set - cp cmdsep ; Command separator? - ret ; Return with flag set appropriately - -;---------------------------------------- - -; Initialize complete FCB pointed to by DE - -initfcb: - xor a - ld (de),a ; Set default disk (dn byte is 0) - inc de ; Point to file name field - call ifcb ; Fill 1st part of FCB - ; Fall through to IFCB to run again - -;-------------------- - -; Initialize part of FCB whose file name field is pointed to by DE on entry. -; The file name and type are set to space characters; the EX, S2, RC, and the -; following CR (current record ) or DN (disk number) fields are set to zero. -; The S1 byte is set to the current user number. On exit, DE points to the -; byte at offset 17 in the FCB (two bytes past the record count byte). - -ifcb: - ld b,11 ; Store 11 spaces for file name and type - ld a,' ' - call fill - xor a - ld (de),a ; Set extent byte to zero - inc de - ld a,(curusr) - ld (de),a ; Set S1 byte to current user - inc de - ld b,3 ; Store 3 zeroes - xor a ; Fall thru to fill - -;-------------------- - -; Fill memory pointed to by DE with character in A for B bytes - -fill: - ld (de),a ; Fill with byte in A - inc de ; Point to next - djnz fill - ret - -;---------------------------------------- - -; Subroutine to display the 'no file' error message for the built-in -; commands DIR, ERA, LIST, TYPE, and/or REN. - - if diron or eraon - -prnnf: - call printc ; No file message - defb 'No Fil','e'+80h - ret - endif ; diron or eraon - -;---------------------------------------- - -; Calculate address of command table in package from Z3ENV. On entry, E -; contains the offset to the address of the package in the environment. On -; exit, DE points to the beginning of the package and HL points to the fifth -; byte (where the command table starts in the RCP and FCP modules). The zero -; flag is set on return if the package is not supported. - - if fcpenv or rcpenv or ndrenv -pkgoff: - ld hl,z3env ; Point to beginning of ENV descriptor - ld d,0 ; Make DE have offset - add hl,de ; ..and add it - ld a,(hl) ; Get low byte of package address - inc hl ; Point to high byte - ld h,(hl) ; ..and get it - ld l,a ; Move full address into HL - or h ; Set zero flag if no package - ld de,5 ; Offset to start of table - ex de,hl ; Preserve start address of package in DE - add hl,de ; Pointer to 5th byte of package in HL - ret ; Return with zero flag set appropriately - - endif ;fcpenv or rcpenv or ndrenv - -;---------------------------------------- - -; This subroutine checks to see if we are in a false IF state. If that is -; the case, the routine returns with the zero flag set. If there is not active -; IF state or if it is true, then the zero flag is reset. - - if fcp ne 0 ; Omit code if FCP not implemented - -iftest: - ld bc,(ifptrfl) ; Current IF pointer into C, IF status into B - ld a,c ; See if any IF in effect - or a - jr z,iftest1 ; Branch if no IF state is active - and b ; Mask the current IF status - ret -iftest1: - dec a ; Reset the zero flag - ret - - endif ;fcp ne 0 - -;---------------------------------------- - -; Print the command prompt with DU and/or DIR (but without any trailing -; character). This is also the code in which the current drive and user -; will be stored. The conditional assemblies are somewhat involved because -; of the possibilities of either or both of the DU or DIR forms being omitted -; from the prompt. - -prompt: - call crlf - - if incldu ; If drive/user in prompt - - ld hl,(curusr) ; Get current drive/user into HL - -; If INCLENV is enabled, the drive and user (DU) will be included in the -; prompt based on the state of the DUOK flag in the environment. If INCLENV -; is disabled, the DU form will always be included if INCLDU is on. - - if inclenv - ld a,(duokfl) ; If ENV disallows DU, - or a ; ..then don't show it in - jr z,prompt2 ; ..the prompt, either - endif ;inclenv - - ld a,h ; Get current drive - add a,'A' ; Convert to ascii A-P - call conout - ld a,l ; Get current user - - if supres ; If suppressing user # report for user 0 - or a - jr z,prompt2 - endif - - cp 10 ; User < 10? - jr c,prompt1 - - if highuser ; If allowing users 16..31 - - ld c,'0'-1 -prompt0: - inc c - sub 10 - jr nc,prompt0 - add a,10 - ld b,a - ld a,c - call conout - ld a,b - - else ;using only standard user numbers 0..15 - - sub 10 ; Subtract 10 from user number - push af ; Save low digit - call print ; Display a '1' for tens digit - defb '1' or 80h - pop af - - endif ;highuser - -prompt1: - add a,'0' ; Output 1's digit (convert to ascii) - call conout -prompt2: - endif ; incldu - - ; Display named directory - - if incldir - - if incldu - ld b,h ; Copy drive/user from HL to BC - ld c,l ; ..(saves a byte) - else - ld bc,(curusr) ; Get current drive and user into BC - endif ;incldu - - inc b ; Switch drive to range 1..16 - call du2dir ; See if there is a corresponding DIR form - ret z ; If not, return now - - if incldu ; Separate DU and DIR with colon - - if inclenv - ld a,(duokfl) ; If not displaying DU, then - or a ; ..don't send separator, either - ld a,':' ; Make the separator - call nz,conout ; ..and send if permitted - else - call print ; Put in colon separator - defb ':' or 80h - endif ;inclenv - - endif ; incldu - - ld b,8 ; Max of 8 chars in DIR name -prompt3: - inc hl ; Point to next character in DIR name - ld a,(hl) ; ..and get it - cp ' ' ; Done if space - ret z - call conout ; Print character - djnz prompt3 ; Count down - - endif ; incldir - - ret - -;----------------------------------------------------------------------------- - -; Subroutine to convert DU value in BC into pointer to a matching entry in -; the NDR. If there is no match, the routine returns with the zero flag set. -; If a match is found, the zero flag is reset, and the code returns with HL -; pointing to the byte before the directory name. - - if z3ndir ne 0 - -du2dir: - - if ndrenv ; If getting NDR address from environment - ld e,15h ; Offset to NDR in Z3ENV - call pkgoff ; Get address of NDR into DE - ex de,hl ; ..and switch into HL - ret z ; If no NDR, return with zero flag set - jr du2dir2 - else - ld hl,z3ndir-17 ; Scan directory for match - endif ;ndrenv - -du2dir1: ; Advance to next entry in NDR - ld de,16+1 ; Skip user (1 byte) and name/pw (16 bytes) - add hl,de - -du2dir2: - ld a,(hl) ; End of NDR? - or a - ret z ; If so, return with zero flag set - - inc hl ; Point to user number in NDR entry - cp b ; Compare drive values - jr nz,du2dir1 ; If mismatch, back for another try - ld a,(hl) ; Get user number - sub c ; ..and compare - jr nz,du2dir1 ; If mismatch, back for another try - dec a ; Force NZ to show successful match - ret - - endif ;z3ndir ne 0 - -;----------------------------------------------------------------------------- - -; This routine gets the next line of input for the command buffer. The -; following order of priority is followed: -; If ZEX is active, the next line is obtained from ZEX -; If a submit file is running, its last record provides the input -; If there is a command line on the shell stack, use it -; Finally, if none of the above, the input is obtained from the user - -readbuf: - - ld a,(zexrunfl) ; Get ZEX-running flag - or a - jr nz,userinput ; If ZEX running, go directly to user input - - if subon ; If submit facility is enabled, check for it - - ld a,(subflag) ; Test for submit file running - or a - jr z,shellinput ; If not, go on to possible shell input - - xor a ; Log into user 0 - call setuser - call defltdma ; Initialize DMA pointer - ld de,subfcb ; Point to submit file FCB - call open ; Try to open file - jr z,readbuf1 ; Branch if open failed - - ld hl,subfrc ; Point to record count in submit FCB - ld a,(hl) ; Get the number of records in file - dec a ; Reduce to number of last record - ld (subfcr),a ; ..and put into current record field - call read ; Attempt to read submit file - jr nz,readbuf1 ; Branch if read failed - - dec (hl) ; Reduce file record cound - dec hl ; Point to S2 byte of FCB (yes, this is req'd!) - ld (hl),a ; Stuff a zero in there (A=0 from call to READ) - call close ; Close the submit file one record smaller - jr z,readbuf1 ; Branch if close failed - -; Now we copy the line read from the file into the multiple command line -; buffer - - ld de,chrcnt ; Point to command length byte in command buffer - ld hl,tbuff ; Point to sector read in from submit file - - if buflen gt 7fh ; If command line buffer is longer than record, - ld bc,80h ; ..then copy entire record from $$$.SUB file - else ;buflen le 7fh ; Otherwise copy only enough to fill - ld bc,buflen+1 ; ..the command line buffer - endif ;buflen gt 7fh - - ldir ; Transfer line from submit file to buffer - -; We now deal with various options that control the display of commands fed -; to the command processor from a submit file. - - if subnoise gt 0 ; If subnoise = 0 we omit all this display code - - if subnoise eq 1 ; If subnoise = 1 we follow the quiet flag - ld a,(quietfl) - or a - jr nz,readbuf0 ; If quiet, skip echoing the command - endif ;subnoise eq 1 - - call prompt ; Print prompt - call print ; Print submit prompt trailer - defb sprmpt or 80h - ld hl,cmdlin ; Print command line - call printhl - - endif ;subnoise gt 0 - -readbuf0: - call break ; Check for abort (any char) - ret nz ; If no ^C, return to caller and run - -readbuf1: - call subkil ; Kill submit file and abort - jp restart ; Restart CPR - - endif ; subon - -shellinput: - ld hl,shstk ; Point to shell stack - ld a,(hl) ; Check first byte - cp ' '+1 ; See if any entry - jr c,userinput ; Get user input if none - - ld de,cmdlin ; Point to first character of command line - ld bc,shsize ; Copy shell line into command line buffer - ldir ; Do copy - ex de,hl ; HL points to end of line - ld a,1 ; Set command status flag to show - ld (cmdstatfl),a ; ..that a shell has been invoked - jr readbuf3 ; Store ending zero and exit - -userinput: - call prompt ; Print prompt - call print ; Print prompt trailer - defb cprmpt or 80h - ld c,0ah ; Read command line from user - ld de,bufsiz ; Point to buffer size byte of command line - call bdos - - ; Store null at end of line - - ld hl,chrcnt ; Point to character count - ld a,(hl) ; ..and get its value - inc hl ; Point to first character of command line - call addah ; Make pointer to byte past end of command line -readbuf3: - ld (hl),0 ; Store ending zero - ret - -;----------------------------------------------------------------------------- - -; Check for any character from the user console. Return with the character -; in A. If the character is a control-C, then the zero flag will be set. - - if subon or diron or eraon or lton - -break: - ld c,0bh ; BDOS console status function - call bdossave ; Call BDOS and set flags - call nz,conin ; Get input character if there is one - cp 'C'-'@' ; Check for abort - ret - - endif ; subon or diron or eraon or lton - -;----------------------------------------------------------------------------- - -; Add A to HL (HL=HL+A) - -addah: - add a,l - ld l,a - ret nc - inc h - ret - -;----------------------------------------------------------------------------- - -; The routine NUMBER evaluates a string in the first FCB as either a decimal -; or, if terminated with the NUMBASE hexadecimal marker, a HEX number. If the -; conversion is successful, the value is returned as a 16-bit quantity in BC. -; If an invalid character is encountered in the string, the routine returns -; with the carry flag set and HL pointing to the offending character. - - if saveon - -number: - ld hl,tfcb+8 ; Set pointer to end of number string - ld bc,8 ; Number of characters to scan - ld a,numbase ; Scan for HEX identifier - cpdr ; Do the search - jr nz,decimal ; Branch if HEX identifier not found - - inc hl ; Point to HEX marker - ld (hl),' ' ; Replace HEX marker with valid terminator - ; ..and fall through to HEXNUM - - endif ;saveon - -;---------------------------------------- - -; At this entry point the character string in the first default FCB is -; converted as a hexadecimal number (there must NOT be a HEX marker). - -hexnum: - ld hl,tfcb+1 ; Point to string in first FCB - -; At this entry point the character string pointed to by HL is converted -; as a hexadecimal number (there must be NO HEX marker at the end). - -hexnum1: - ld de,16 ; HEX radix base - jr radbin ; Invoke the generalized conversion routine - -;---------------------------------------- - -; This entry point performs decimal conversion of the string in the first -; default FCB. - -decimal: - ld hl,tfcb+1 ; Set pointer to number string - -; This entry point performs decimal conversion of the string pointed to -; by HL. - -decimal1: - ld de,10 ; Decimal radix base - ; Fall through to generalized - ; ..radix conversion routine - -; This routine converts the string pointed to by HL using the radix passed in -; DE. If the conversion is successful, the value is returned in BC. HL points -; to the character that terminated the number, and A contains that character. -; If an invalid character is encountered, the routine returns with the carry -; flag set, and HL points to the offending character. - -radbin: - ld bc,0 ; Initialize result -radbin1: - or a ; Make sure carry is reset - call sdelm ; Test for delimiter (returns Z if delimiter) - ret z ; Return if delimiter encountered - - sub '0' ; See if less than '0' - ret c ; Return with carry set if so - cp 10 ; See if in range '0'..'9' - jr c,radbin2 ; Branch if it is valid - cp 'A'-'0' ; Bad character if < 'A' - ret c ; ..so we return with carry set - sub 7 ; Convert to range 10..15 -radbin2: - cp e ; Compare to radix in E - ccf ; Carry should be set; this will clear it - ret c ; If carry now set, we have an error - - inc hl ; Point to next character - push bc ; Push the result we are forming onto the stack - ex (sp),hl ; Now HL=result, (sp)=source pointer - call mpy16 ; HLBC = previous$result * radix - ld h,0 ; Discard high 16 bits and - ld l,a ; ..move current digit into HL - add hl,bc ; Form new result - ld c,l ; Move it into BC - ld b,h - pop hl ; Get string pointer back - jr radbin1 ; Loop until delimiter - -;----------------------------------------------------------------------------- - -; This routine multiplies the 16-bit values in DE and HL and returns the -; 32-bit result in HLBC (HL has high 16 bits; BC has low 16 bits). Register -; pair AF is preserved. - -mpy16: - ex af,af' ; Save AF - ld a,h ; Transfer factor in HL to A and C - ld c,l - ld hl,0 ; Initialize product - ld b,16 ; Set bit counter - rra ; Shift AC right so first multiplier bit - rr c ; ..is in carry flag -mp161: - jr nc,mp162 ; If carry not set, skip the addition - add hl,de ; Add multiplicand -mp162: - rr h ; Rotate HL right, low bit into carry - rr l - rra ; Continue rotating through AC, with - rr c ; ..next multiplier bit moving into carry - djnz mp161 ; Loop through 16 bits - - ld b,a ; Move A to B so result is in HLBC - ex af,af' ; Restore original AF registers - ret - -;----------------------------------------------------------------------------- - -; This routine checks for a delimiter character pointed to by HL. It returns -; with the character in A and the zero flag set if it is a delimiter. All -; registers are preserved except A. - -sdelm: - ld a,(hl) ; Get the character - exx ; Use alternate register set (shorter code) - ld hl,deldat ; Point to delimiter list - ld bc,delend-deldat; Length of delimiter list - cpir ; Scan for match - exx ; Restore registers - ret ; Returns Z if delimiter - -deldat: ; List of delimiter characters - db ' ' - db '=' - db '_' - db '.' - db ':' - db ';' - db '<' - db '>' - db ',' - db 0 - if cmdsep ne ';' - db cmdsep - endif ;cmdsep ne ';' -delend: - -;----------------------------------------------------------------------------- - -; Log into DU contained in FCB pointed to by DE. Registers DE are preserved; -; all others are changed. Explicit values for the temporary drive and user -; are extracted from the FCB. If the record-count byte has an FF in it, that -; is a signal that the directory specification was invalid. We then invoke -; the error handler. - - if diron or eraon or lton or renon or saveon - -fcblog: - push de ; Save pointer to FCB - ex de,hl - ld a,(hl) ; Get drive - ld bc,13 ; Offset to S1 field - add hl,bc - ld c,(hl) ; Get user into C - or a ; See if drive value was 0 - jr nz,fcblog1 ; If not, branch ahead - ld a,(curdr) ; Otherwise substitute current drive - inc a ; ..shifted to range 1..16 -fcblog1: - ld b,a ; Get drive into B - ld (tempusr),bc ; Set up temporary DU values - call logtemp ; ..and log into it - pop de ; Restore pointer to FCB - -; Now check to make sure that the directory specification was valid. - - inc hl ; Advance pointer to record-count byte - inc hl - ld a,(hl) ; See if it is nonzero - or a - jp nz,baddirerr ; If so, invoke error handler - - ret ; Otherwise return - - endif ;diron or eraon or lton or renon or saveon - -;----------------------------------------------------------------------------- - -; Log into the temporary directory. Registers B, H, and L are preserved. - -logtemp: - ld de,(tempusr) ; Set D = tempdr, E = tempusr - call setuser1 ; Register D is preserved during this call - ld a,d ; Move drive into A - dec a ; Adjust for drive range 0..15 - jp setdrive ; Log in new drive and return - -;----------------------------------------------------------------------------- - -; This routine scans the command table pointed to by HL for the command name -; stored in the command FCB. If the command is not found, the routine returns -; with the zero flag reset. If the command is found, the address vector is -; stored in EXECADR and the zero flag is set. - -cmdscan: - ld b,(hl) ; Get length of each command - inc hl ; Point to first command name - -scannext: - ld a,(hl) ; Check for end of table - or a - jr z,scanend ; Branch if end - - ld de,cmdfcb+1 ; Point to name of requested command - push bc ; Save size of commands in table - - if wheel - ; Ignore commands with high bit set in first - ; ..char of command name if wheel is false - ld a,(z3whl) ; Get the wheel byte - or a - ld c,0ffh ; Make a mask that passes all characters - jr z,scancmp ; Use this mask if wheel not set - - endif ; wheel - - ld c,7fh ; Use mask to block high bit if wheel set - ; ..or not in use - -scancmp: - ld a,(de) ; Compare against table entry - - xor (hl) - and c ; Mask high bit of comparison - jr nz,scanskip ; No match, so skip rest of command name - - inc de ; Advance to next characters to compare - inc hl - res 7,c ; Mask out high bit on characters after first - djnz scancmp ; Count down - - ld a,(de) ; See if next character in input command - cp ' ' ; ..is a space - jr nz,scanbad ; If not, user command is longer than commands - ; ..in the command table - - ; Matching command found - - pop bc ; Clear stack - ld a,(hl) ; Get address from table into HL - inc hl - ld h,(hl) - ld l,a - ld (execadr),hl ; Set execution address - xor a ; Set zero flag to show that command found - ret - -scanskip: - inc hl ; Skip to next command table entry - djnz scanskip - -scanbad: - pop bc ; Get back size of each command - inc hl ; Skip over address vector - inc hl - jr scannext ; Try scanning next entry in table - -scanend: - xor a ; Reset zero flag to show - dec a ; ..that command was not found - ret - -; End ZCPR33-4.Z80 - - page - -; ZCPR33-5.Z80 - -;============================================================================= -; -; R E S I D E N T C O M M A N D C O D E -; -;============================================================================= - -; Command: DIR -; Function: To display a directory of the files on disk -; Forms: -; DIR Displays the DIR-attribute files -; DIR Same as DIR *.* -; DIR S Displays the SYS-attribute files -; DIR /S Same as DIR *.* S -; DIR A Display both DIR and SYS files -; DIR /A Same as DIR *.* A - - if diron - -dir: - ld de,tfcb ; Point to target FCB - push de ; ..and save the pointer for later - inc de ; Point to file name - ld a,(de) ; Get first character - - if slashfl ; If allowing "DIR /S" and "DIR /A" formats - cp '/' ; If name does not start with '/' - jr nz,dir1 ; ..branch and process normally - inc de ; Point to second character - ld a,(de) ; Get option character after slash - ld (tfcb2+1),a ; ..and put it into second FCB - dec de ; Back to first character - ld a,' ' ; Simulate empty FCB - endif ;slashfl - -dir1: - cp ' ' ; If space, make all wild - jr nz,dir2 - ld b,11 - ld a,'?' - call fill - -dir2: - pop de ; Restore pointer to FCB - call fcblog ; Log in the specified directory - - if whldir - ld a,(z3whl) ; Check wheel status - or a ; If not set, then ignore options - jr z,dir2a - endif ;whldir - - ld a,(tfcb2+1) ; Check for any option letter - ld b,1 ; Flag for both DIR and SYS files - cp allchar ; See if all (SYS and DIR) option letter - jr z,dirpr ; Branch if so - dec b ; B = 0 for SYS files only - cp syschar ; See if SYS-only option letter - jr z,dirpr ; Branch if so -dir2a: - ld b,80h ; Flag for DIR-only selection - ; Drop into DIRPR to print directory - - endif ; diron - -;-------------------- - -; Directory display routine - -; On entry, if attribute checking is required, the B register is -; set as follows: -; 00H for SYS files only -; 80H for DIR files only -; 01H for both - - if diron or eraon - -dirpr: - if diron ; Attribute checking needed only for DIR - ld a,b ; Get flag - ld (systst),a ; Set system test flag - endif - - ld e,0 ; Set column counter to zero - push de ; Save column counter (E) - call srchfst1 ; Search for specified file (first occurrence) - jr nz,dir3 - call prnnf ; Print no-file message - pop de ; Restore DE - xor a ; Set Z to show no files found - ret - -; Entry selection loop. On entering this code, A contains the offset in the -; directory block as returned by the search-first or search-next call. - -dir3: - if diron ; Attribute checking needed only for DIR cmd - - call getsbit ; Get and test for type of files - jr z,dir6 - - else ;not diron - - dec a ; Adjust returned value from 1..4 to 0..3 - rrca ; Multiply by 32 to convert number to - rrca ; ..offset into TBUFF - rrca - ld c,a ; C = offset to entry in TBUFF - - endif ;diron - - pop de ; Restore count of - ld a,e ; ..entries displayed - inc e ; Increment entry counter - push de ; Save it - and 03h ; Output CRLF if 4 entries printed in line - jr nz,dir4 - call crlf ; New line - jr dir5 -dir4: - call print - - if wide - - defb ' ' ; 2 spaces - defb fence ; Then fence char - defb ' ',' '+80h ; Then 2 more spaces - - else ;not wide - - defb ' ' ; Space - defb fence ; Then fence char - defb ' '+80h ; Then space - - endif ; wide - -dir5: - ld a,1 - call dirptr ; HL now points to 1st byte of file name - call prfn ; Print file name -dir6: - call break ; Check for abort - jr z,dir7 - call srchnxt ; Search for next file - jr nz,dir3 ; Continue if file found - -dir7: - pop de ; Restore stack - dec a ; Set NZ flag - ret - - endif ; diron or eraon - -;----------------------------------------------------------------------------- - - if diron or attchk or eraon - -; This routine returns a pointer in HL to the directory entry in TBUFF that -; corresponds to the offset specified in registers C (file offset) and C -; (byte offset within entry). - -dirptr: - ld hl,tbuff - add a,c ; Add the two offset contributions - call addah ; Set pointer to desired byte - ld a,(hl) ; Get the desired byte - ret - - endif ; diron or attchk or eraon - -;----------------------------------------------------------------------------- - -; Test File in FCB for existence, ask user to delete if so, and abort if he -; choses not to - - if saveon or renon - -extest: - ld de,tfcb ; Point to FCB - push de ; ..and save it for later - call fcblog ; Log into specified directory - call srchfst1 ; Look for specified file - pop de ; Restore pointer - ret z ; OK if not found, so return - call printc - if bellfl - defb bell - endif ;bellfl - defb 'Erase',' '+80h - ld hl,tfcb+1 ; Point to file name field - call prfn ; Print it - call print ; Add question mark - defb '?' or 80h - call conin ; Get user response - cp 'Y' ; Test for permission to erase file - jp nz,restart ; If not, flush the entire command line - jp delete ; Delete the file - - endif ; saveon or renon - -;----------------------------------------------------------------------------- - -; Print file name pointed to by HL - - if diron or renon or saveon - -prfn: - ld b,8 ; Display 8 characters in name - call prfn1 - call print ; Put in dot - defb '.' or 80h - ld b,3 ; Display 3 characters in type -prfn1: - ld a,(hl) ; Get character - inc hl ; Point to next - call conout ; Print character - djnz prfn1 ; Loop through them all - ret - - endif ;diron or renon or saveon - -;----------------------------------------------------------------------------- - -; This routine returns NZ if the file has the required attributes and Z if -; it does not. It works by performing the 'exclusive or' of the mask passed -; in register A and the filename attribute obtained by masking out all but -; the highest bit of the character. For the 'both' case, setting any bit -; in the mask other than bit 7 will guarantee a nonzero result. -; -; File name: : X 0 0 0 0 0 0 0 (After 80H mask, X=1 if SYS, 0 if DIR) -; -; SYS-ONLY : 0 0 0 0 0 0 0 0 (XOR gives 00H if X=0 and 80H if X=1) -; DIR-ONLY : 1 0 0 0 0 0 0 0 (XOR gives 80H if X=0 and 00H if X=1) -; BOTH : 0 0 0 0 0 0 0 1 (XOR gives 01H if X=0 and 81H if X=1) - - if diron or attchk - -getsbit: - dec a ; Adjust to returned value from 1..4 to 0..3 - rrca ; Multiply by 32 to convert number to - rrca ; ..offset into TBUFF - rrca - ld c,a ; Save offset in TBUFF in C - ld a,10 ; Add 10 to point to SYS attribute bit - call dirptr ; A = SYS byte - and 80h ; Look only at attribute bit -systst equ $+1 ; In-the-code variable - xor 0 ; If SYSTST=0, SYS only; if SYSTST=80H, DIR - ; ..only; if SYSTST=1, both SYS and DIR - ret ; NZ if OK, Z if not OK - - endif ;diron or attchk - -;----------------------------------------------------------------------------- - -; Command: REN -; Function: To change the name of an existing file -; Forms: REN = -; Notes: If either file spec is ambiguous, or if the source file does -; not exist, the error handler will be entered. If a file with -; the new name already exists, the user is prompted for deletion -; and ZEX is turned off during the prompt. - - if renon - -ren: - ld hl,tfcb ; Check for ambiguity in first file name - call ambchk - call fcblog ; Login to fcb - ld hl,tfcb2 ; Check for ambiguity in second file name - call ambchk - xor a ; Use current drive for 2nd file - ld (de),a - call srchfst ; Check for old file's existence - jr nz,ren0a ; Branch if file exists -jpnofile: - ld a,ecnofile ; Set error code for file not found - jp error ; ..and invoke error handler -ren0a: - call extest ; Test for file existence and return if not - ld b,12 ; Exchange new and old file names - push de ; Save pointer to FCB - ld hl,tfcb2 ; Point to FCB for old file name -ren0: - ld a,(de) ; Get character of old name - ld c,a ; ..into C register - ld a,(hl) ; Get character of new name - ld (de),a ; ..into place in old name - ld (hl),c ; Put character of old name into new name - inc hl ; Advance pointers - inc de - djnz ren0 - -; Perform rename function - - pop de ; Restore pointer to FCB - ld c,17h ; BDOS rename function - jp bdostest - - endif ;renon - -;----------------------------------------------------------------------------- - -; Command: ERA -; Function: Erase files -; Forms: -; ERA Erase specified files and dislay their names -; ERA I Display names of files to be erased and prompt for -; inspection before erase is performed. (Character 'I' -; is defined by INSPCH in Z33HDR.LIB; if it is ' ', then -; any character triggers inspection.) - - if eraon - -era: - if inspfl and eraok; 'I' flag and verification enabled? - ld a,(tfcb2+1) ; Get flag, if any, entered by user - ld (eraflg),a ; Save it in code below - endif ;erav and eraok - - ld de,tfcb ; Point to target FCB - call fcblog ; ..and log into the specified directory - - if diron or attchk ; Attribute checking only in these cases - ld b,1 ; Display all matching files - endif ;diron or attchk - - call dirpr ; Print directory of erased files - ret z ; Abort if no files - - if eraok ; Print prompt - - if inspfl ; Test verify flag - -eraflg equ $+1 ; Address of flag (in-the-code modification) - ld a,0 - cp inspch ; Is it an inspect option? - - if inspch ne ' ' ; If an explicit inspect character is specified - jr nz,era2 ; ..skip prompt if it is not that character - else ; If INSPCH is the space character - jr z,era2 ; ..then skip prompt only if FCB has a space - endif ;inspch ne ' ' - - endif ;inspfl - - call printc - defb 'OK to Erase','?'+80h - call conin ; Get reply - cp 'Y' ; Yes? - ret nz ; Abort if not - - endif ; eraok - -era2: - ld de,tfcb - jp delete ; Delete files and return - - endif ; Eraon - -;----------------------------------------------------------------------------- - -; Command: LIST -; Function: Print out specified file on the LST: device -; Forms: LIST Print file (No Paging) -; Notes: The flags which apply to TYPE do not take effect with LIST - - if lton - -list: - ld a,0ffh ; Turn on printer flag - jr type0 - -;----------------------------------------------------------------------------- - -; Command: TYPE -; Function: Print out specified file on the CON: Device -; Forms: TYPE Print file with default paging option -; TYPE P Print file with paging option reversed - -type: - xor a ; Turn off printer flag - -; Common entry point for LIST and TYPE functions - -type0: - ld (prflg),a ; Set printer/console flag - ld a,(tfcb2+1) ; Check for user page toggle ('P') option - ld (pgflg),a ; Save it as a flag in code below - ld hl,tfcb ; Point to target file FCB - call ambchk ; Check for ambiguous file spec (vectors to - ; ..error handler if so) - call fcblog ; Log into specified directory - call open ; Open the file - - if renon ; If REN on, share code - jr z,jpnofile - else ;not renon ; Otherwise repeat code here - ld a,ecnofile - jp z,error - endif ;renon - - call crlf ; New line - ld a,(crttxt0) ; Set line count using value from the - ; ..environment for CRT0 - inc a ; One extra the first time through - ld (pagcnt),a - ld bc,080h ; Set character position and tab count - ; (B = 0 = tab, C = 080h = char position) - -; Main loop for loading next block - -type2: - ld a,c ; Get character count - cp 80h ; If not end of disk record - jr c,type3 ; ..then skip - - call readf ; Read next record of file - ret nz ; Quit if end of file - - ld c,0 ; Reset character count - ld hl,tbuff ; Point to first character - -; Main loop for printing characters in TBUFF - -type3: - ld a,(hl) ; Get next character - and 7fh ; Mask out MSB - cp 1ah ; Check for end of file (^z) - ret z ; Quit if so - -; Output character to CON: or LST: device with tabulation - - cp cr ; If carriage return, - jr z,type4 ; ..branch to reset tab count - cp lf ; If line feed, then output - jr z,type4a ; ..with no change in tab count - cp tab ; If tab - jr z,type5 ; ..expand to spaces - -; Output character and increment character count - - call lcout ; Output character - inc b ; Increment tab count - jr type6 - -; Output CR and reset tab count - -type4: - ld b,0 ; Reset tab counter - -; Output LF and leave tab count as is - -type4a: - call lcout ; Output or - jr type6 - -; Process tab character - -type5: - ld a,' ' ; Space - call lcout - inc b ; Increment tab count - ld a,b - and 7 - jr nz,type5 ; Loop until column = n * 8 + 7 - -; Continue processing - -type6: - inc c ; Increment character count - inc hl ; Point to next character - push bc - call break ; Check for user abort - pop bc - ret z ; Quit if so - jr type2 ; Else back for more - -;-------------------- - -; Output character in A to console or list device depending on a flag. -; Registers are preserved. This code is used only by the LIST and TYPE -; commands. - -lcout: - push af ; Save character -prflg equ $+1 ; Pointer for in-the-code modification - ld a,0 ; ..to determine destination (CON or LST) - or a ; Z=type, NZ=list - jr z,lc1 - - ; Output to list device - - pop af ; Get character back - push de - push bc - ld c,5 ; LISTOUT function - jp output - - ; Output to console with paging - -lc1: - pop af ; Get character back - push af ; Save it again for page check - call conout ; Output to console - pop af ; Get character back again - cp lf ; Check for new line (paging) - ret nz ; If not new line, we are done - - ; Paging routines - -pager: - push hl - ld hl,pagcnt ; Decrement lines remaining on screen - dec (hl) - jr nz,pager1 ; Jump if not end of page - - ; New page - ld a,(crttxt0) ; Get full page count from environment - ld (hl),a ; Reset count to a full page -pgflg equ $+1 ; Pointer to in-the-code buffer pgflg - ld a,0 - cp pagech ; Page default override option wanted? - - if pagech ne ' ' ; If using explicit character for page toggle - - if pagefl ; If paging is default - jr z,pager1 ; ..PAGECH means no paging - else ; If paging not default - jr nz,pager1 ; ..PAGECH means please paginate - endif ;pagefl - - else ; Any character toggles paging - - if pagefl ; If paging is default - jr nz,pager1 ; ..any character means no paging - else ; If paging not default - jr z,pager1 ; ..any character means please paginate - endif ;pagefl - - endif ;pagech ne ' ' - - ; End of page - push bc - call bios+9 ; Wait for user input (BIOS console input) - pop bc - cp 'C'-'@' ; Did user enter control-c? - jp z,nextcmd ; If so, terminate this command - -pager1: - pop hl ; Restore HL - ret - - endif ; lton - -;----------------------------------------------------------------------------- - -; Command: SAVE -; Function: To save the contents of the TPA onto disk as a file -; Forms: -; SAVE -; Save specified number of pages (starting at 100H) from TPA -; into specified file -; -; SAVE -; Like SAVE above, but numeric argument specifies -; number of sectors rather than pages - - if saveon - -; Entry point for SAVE command - -save: - call number ; Extract number from command line - jr c,badnumber ; Invoke error handler if bad number - push bc ; Save the number - call reparse ; Reparse tail after number of sectors/pages - pop hl ; Get sector/page count back into HL - ld a,(tfcb2+1) ; Check sector flag in second FCB - cp sectch - - if sectch ne ' ' ; If using a specific character, then jump - jr z,save0 ; ..if it is that character - else ; If allowing any character (SECTCH=' ') - jr nz,save0 ; ..jump if it is anything other than space - endif ;sectch ne ' ' - - add hl,hl ; Double page count to get sector count -save0: - ld a,1 ; Maximum allowed value in H - cp h ; Make sure sector count < 512 (64K) - jr c,badnumber ; If >511, invoke error handler - - push hl ; Save sector count - ld hl,tfcb - call ambchk ; Check for ambiguous file spec (vectors to - ; ..error handler if so) - - call extest ; Test for existence of file and abort if so - ld c,16h ; BDOS make file function - call bdostest - jr z,save3 ; Branch if error in creating file - - pop bc ; Get sector count into BC - ld hl,tpa-80h ; Set pointer to one record before TPA - -save1: - ld a,b ; Check for BC = 0 - or c - dec bc ; Count down on sectors (flags unchanged, - ; ..B=0FFH if all records written successfully) - jr z,save2 ; If BC=0, save is done so branch - - push bc ; Save sector count - ld de,80h ; Advance address by one record - add hl,de - push hl ; Save address on stack - ex de,hl ; Put address into DE for BDOS call - call dmaset ; Set DMA address for write - ld de,tfcb ; Write sector - ld c,15h ; BDOS write sector function - call bdossave - pop hl ; Get address back into HL - pop bc ; Get sector count back into BC - jr z,save1 ; If write successful, go back for more - - ld b,0 ; B=0 if write failed - -save2: - call close ; Close file even if last write failed - and b ; Combine close return code with - ; ..write success flag - ret nz ; Return if all ok - -save3: ; Disk must be full - ld a,ecdiskfull ; Disk full error code - jr jperror - - endif ; saveon - -;----------------------------------------------------------------------------- - - if lton or saveon or renon or geton - -; Check file control block pointed to by HL for any wildcard characters ('?'). -; Return to calling program if none found. Otherwise branch to error handler. -; The routine also treats an empty file name as ambiguous. - -ambchk: - push hl ; Save pointer to FCB - inc hl ; Point to first character in file name - ld a,(hl) ; See if first character is a space - cp ' ' - jr z,ambchk1 ; If so, branch to error return - - ld a,'?' ; Set up for scan for question mark - ld bc,11 ; Scan 11 characters - cpir - pop de ; Restore pointer to FCB in DE - ret nz ; Return if no '?' found -ambchk1: - ld a,ecambig ; Error code for ambiguous file name - jr jperror - - endif ;lton or renon or saveon or geton - - if lton or renon or saveon or geton or jumpon - -badnumber: - ld a,ecbadnum ; Error code for bad number value -jperror: ; Local entry point for relative jump - jp error ; ..to go to error handler - - endif ;lton or renon or saveon or geton or jumpon - -;----------------------------------------------------------------------------- - -; Command: JUMP -; Function: To execute a program already loaded into some specified memory -; address -; Forms: JUMP -; The address is in hex; the tail will be parsed as usual - - if jumpon - -jump: - call hexnum ; Get load address into BC - jr c,badnumber ; If bad number, invoke error handling - push bc ; ..and save it - call reparse ; Reparse tail after address value - pop hl ; Restore execution address to HL - jr getproglf ; Perform call via code below - - endif ;jumpon - -;----------------------------------------------------------------------------- - -; Command: GO -; Function: To Call the program in the TPA without loading -; loading from disk. Same as JUMP 100H, but much -; more convenient, especially when used with -; parameters for programs like STAT. Also can be -; allowed on remote-access systems with no problems. -; -;Form: GO - - if goon - -go: - ld hl,tpa ; Set up TPA as the execution address - - endif ; goon - - if jumpon or goon ; Common code - -getproglf: - ld (execadr),hl - xor a ; Set zero flag to enable leading CRLF - jp callproglf ; Perform call (with leading CRLF) - - endif ;jumpon or goon - -;----------------------------------------------------------------------------- - -; Command: GET -; Function: To load the specified file from disk to the specified address -; Forms: GET -; Loads the specified file to the specified hexadecimal address -; Note that the normal file search path is used to find the file. -; If SCANCUR is off, the file may not be found in the current -; directory unless a colon is included in the file spec. - - if geton - -get: - -; TMPCOLON was set when the file name was parsed. We use that as the colon -; flag so that the file will be loaded from a directory just as if it had -; been entered as the command name. - - if drvprefix and [not scancur] - ld a,(tmpcolon) ; Allow GET to load from specified - ld (colon),a ; directory - endif ;drvprefix and [not scancur] - - ld hl,tfcb2 ; Copy TFCB2 to CMDFCB for load - push hl - ld de,cmdfcb - ld bc,14 - ldir - pop hl - call ambchk ; Make sure file is not ambiguous (vectors - ; ..to error handler if so) - -; If GET fails to find the specified file along the search path, we do not -; want the ECP to be engaged. To prevent that, we fool the command processor -; by telling it that the ECP is already engaged. - - ld hl,cmdstatfl ; Point to command status flag - set 2,(hl) ; Turn on ECP flag to prevent use of ECP - call hexnum ; Get load address into BC - jr c,badnumber ; If invalid number, invoke error handler - - if not fullget - ld a,b ; If trying to load into base page - or a ; ..treat as error - jr z,badnumber - endif ;not fullget - - ld h,b ; Move address into HL - ld l,c - ld a,0ffh ; Disable dynamic loading - ; Fall through to mload - - endif ; geton - -; End ZCPR33-5.Z80 - - page - -; ZCPR33-6.Z80 - -;============================================================================= -; -; P A T H S E A R C H A N D F I L E L O A D I N G C O D E -; -;============================================================================= - -; This block of code loads a file into memory. The normal address at which -; loading is to begin is passed to the routine in the HL register. The name -; of the file to load is passed in the command file control block. -; -; This code supports an advanced option that loads files to a dynamic address -; specified in the header to the file using a new type-3 environment. In a -; type-3 environment, the execution/load address is stored in the word -; following the environment descriptor address. A value is passed to MLOAD in -; the A register that controls this dynamic loading mechanism. The value -; specifies the lowest environment type value for which dynamic loading will -; be performed. This value will be 3 when MLOAD is called for normal COM file -; execution and will be 0FFH when chained to from the GET command. In the -; latter case, the user-specified load address must be used. -; -; MLOAD guards against loading a file over the operating system. It computes -; the lower of the following two addresses: 1) the CPR entry point; 2) the -; bottom of protected memory as indicated by the DOS entry address stored at -; address 0006H. If the load would exceed this limit, error handling is -; engaged (except for the GET command when FULLGET is enabled). - -mload: - ld (envtype),a ; Set up in-the-code modification below - ld (execadr),hl ; Set up execution/load address - call defltdma ; Set DMA address to 80H for file searches - - -; This code sets the attributes of COM files which are acceptable. If both -; SYS and DIR type files are acceptable, there is no need to include this code, -; and ATTCHK can be set to false. - - if attchk ; Only if attribute checking enabled - ld a,comatt ; Attributes specified in Z33HDR.LIB - ld (systst),a ; Set flag - endif ;attchk - -;----------------------------------------------------------------------------- - -; PATH BUILDING CODE - -; In ZCPR33 the minpath feature, optional in ZCPR30, is always used. To -; minimize the size of the CPR code, however, there is an option to place the -; minpath in an external buffer (outside the CPR). If the path is short -; enough, the minpath can be placed at the bottom of the system stack. - - ld de,path ; Point to first element in user's symbolic path - ld hl,mpath ; Point to minpath buffer - xor a - ld (hl),a ; Initialize to empty minpath - - -; If DRVPREFIX is enabled, the CPR will recognize an explicit directory -; reference in a command. The first element of the path will then be this -; explicit directory. If no explicit directory was given in the command, -; then no entry is made into the search path. If the WPREFIX option is -; on, explicit directory prefixes will be recognized only when the wheel -; byte is on. - - if drvprefix ; Pay attention to du:com prefix? - - ld a,(colon) ; See if colon was present in command - or a - jr z,makepath2 ; If not, skip ahead - - if wprefix - ld a,(z3whl) ; See if wheel byte is on - or a - jr z,makepath2 ; If not, skip ahead - endif ;wprefix - - ld a,(cmdfcb) ; Get drive from command FCB - ld (hl),a ; Put drive into minpath - inc hl ; Advance pointer - ld a,(cmdfcb+13) ; Get user number from command FCB - ld (hl),a ; Put it into minpath - inc hl ; Advance pointer to next path element - xor a ; A=0 - ld (hl),a ; Store ending 0 in mpath -makepath2: - endif ; drvprefix - - -; If SCANCUR is enabled in Z33HDR.LIB, then we always include the current -; directory automatically, even without a '$$' element in the user's path. -; If WPREFIX is enabled, however, we do not want to allow the current -; directory to be included, but we must make sure that it is included in -; the building of the root path, in case the user's symbolic path is empty. - - if scancur ; Scan current directory at all times? - - ld bc,(curusr) ; C = current user, B = current drive - inc b ; Set drive to range 1..16 - - if wprefix - - ld a,(z3whl) ; See if wheel byte is on - or a - jr nz,addpath ; If it is, add element to path; if not, - ; ..fall through to MAKEPATH3 - else ;not wprefix - - jr addpath ; Begin loop of placing entries into mpath - - endif ;wprefix - - else ;not scancur - -; If SCANCUR is off and ROOTONLY is in effect, we have to make sure that some -; directory values are put into the root path in the case where the user's -; path is completely empty. To do so, we preset BC for directory A0. - - if rootonly - ld bc,0100h ; Setup for drive A (B=1), user 0 (C=0) - endif ;rootonly - - endif ;scancur - - -; Convert symbolic entries in user's path into absolute DU values in minpath. -; Entries are read one-by-one from the symbolic path. If the 'current' drive -; or user indicator is present (default symbol is '$'), then the current -; drive or user value is fetched. Otherwise the explicit binary value from the -; path is used. After each absolute DU value is formed, the minpath as it -; exists so far is scanned to see if this DU value is already there. If it is -; not, then the DU value is appended to the path. Otherwise it is ignored. - -makepath3: - ld a,(de) ; Get next symbolic path entry - or a ; If 0, we are at end of path - jr z,makepath6 - - ld bc,(curusr) ; C = current user, B = current drive - inc b ; Set drive to range 1..16 - cp curind ; Check for current drive symbol (default '$') - jr z,makepath4 ; If so, leave current drive in B - ld b,a ; Else move specified drive into B -makepath4: - inc de ; Point to user value in symbolic path - ld a,(de) ; Get user - inc de ; Point to next element in symbolic path - cp curind ; Check for current user symbol (default '$') - jr z,makepath5 ; If so, leave current drive in C - ld c,a ; Else move specified user into C -makepath5: - -; At this point in the code we have a potential path element in BC. We first -; have to scan the minpath we have so far to see if that element is already -; there. In that case we ignore it; otherwise we add it to the end of the path. - -addpath: - ; Skip path if directory given explicitly - - if skippath - - if wprefix - ld a,(z3whl) ; See if wheel byte is on - or a - call nz,skipchk ; If not, fall through - else ;not wprefix - call skipchk ; See if path should be skipped - endif ;wprefix - - jr nz,makepath3 ; If so, branch out of ADDPATH - - endif ;skippath - - ld hl,mpath ; Point to beginning of minpath - -addpath1: ; Point of reentry - ld a,(hl) ; Get drive value - or a ; Check for end of minpath - jr z,addpath2 ; If end, jump and add BC to minpath - - inc hl ; Increment pointer to user - cp b ; Check for drive match - ld a,(hl) ; Get user from minpath - inc hl ; Point to next minpath entry - jr nz,addpath1 ; If drive was different, loop back again - cp c ; Check for user match - jr nz,addpath1 ; If user is different, loop back again - jr makepath3 ; Branch if we have a duplicate - -; We have a new DU; add it to minpath - -addpath2: - ld (hl),b ; Store drive - inc hl - ld (hl),c ; Store user - inc hl - ld (hl),0 ; Store ending 0 - jr makepath3 ; Continue scanning user's path - -; If the ECP facility is set up to use the root directory, then create a -; root path. BC presently contains the proper DU. - -makepath6: - - if rootonly - ld hl,rootpth ; Point to special path to contain root - ld (hl),b ; Store disk - inc hl - ld (hl),c ; Store user - endif ;rootonly - -;----------------------------------------------------------------------------- - -; This is the code for loading the specified file by searching the minpath. - - xor a ; Always use current disk specification in the - ld (cmdfcb),a ; ..command FCB - -mload1: - - ld hl,mpath ; Point to beginning of minpath - -mload2: - -; Either the FASTECP or BADDUECP option may have set FIRSTCHAR to a space -; character as a signal to go directly to extended command processing. If -; neither option is enabled but SKIPPATH is, then the FIRSTCHAR data is -; stored in the routine below where path skipping is implemented. - - if fastecp or badduecp - - ld a,(cmdstatfl) ; If ECP is running - bit 2,a ; ..we branch to look for ECP along path - jr nz,mload2a -firstchar equ $+1 ; Pointer for in-the-code modification - ld a,0 - cp ' ' ; Was command invoked with leading space? - jr z,ecprun ; If so, go directly to ECP code - - endif ;fastecp or badduecp - -mload2a: - ld a,(hl) ; Get drive from path - or a ; If end of path, command not found - jr nz,mload3 ; If not end of path, skip over ECP code - -;----------------------------------------------------------------------------- - -; EXTENDED COMMAND PROCESSING - -; At this point we have exhausted the search path. We now engage the -; extended command processor. - -ecprun: - if skippath - call skipchk ; See if path should be skipped - jr nz,jnzerror ; If so, invoke error handler - endif ;skippath - - ld hl,cmdstatfl ; Point to command status flag - ld a,(hl) ; ..and get value - and 110b ; Isolate ECP and error handler bits -jnzerror: ; If either is set, - ld a,ecnocmd ; Error code for command not found - jp nz,error ; ..process as an error - - set 2,(hl) ; Set ECP bit - - ld hl,ecpfcb ; Copy name of ECP to command FCB - ld de,cmdfcb - ld bc,12 ; Only 12 bytes required - ldir - - ld hl,(cmdptr) ; Get pointer to current command line - call parsetail ; Parse entire command as the command tail - - if rootonly ; Look for ECP in root directory only - ld hl,rootpth ; Point to path containing root directory only - jr mload2 ; Search for command - else ; not rootonly - jr mload1 ; Search the entire minpath for the ECP - endif ; rootonly - -;----------------------------------------------------------------------------- - -mload3: - ld b,a ; Drive into B - inc hl ; Point to user number - ld c,(hl) ; User into C - ld (tempusr),bc ; Save the values - inc hl ; Point to next entry in path - call logtemp ; Log in path-specified user/drive - - if attchk ; If allowing execution only of COM files with - ; ..specific attributes - - ld de,cmdfcb ; Point to command FCB - call srchfst ; Look for directory entry for file - jr z,mload2a ; Continue path search if file not found - push hl ; Save path pointer - call getsbit ; Check system attribute bit - pop hl ; Restore path pointer - jr z,mload2a ; Continue if attributes do not match - call opencmd ; Open file for input - jr z,mload2a ; If open failed, back to next path element - - else ;not attchk - - call opencmd ; Open file for input - jr z,mload2a ; If open failed, back to next path element - - endif ; attchk - - call readcmd ; Read first record into default DMA address - jr nz,mload5 ; Branch if zero-length file - xor a ; Set file current record back to zero - ld (cmdfcb+20h),a - ld hl,80h ; Pointer to start of code - call z3chk - jr nz,mload3a ; If not Z3 file, branch - -; The following test is modified by earlier code. For normal COM file loading, -; a 3 is inserted for the minimum environment type for dynamic load address -; determination. For the GET command, where the user-specified address should -; be used, a value of 0FFH is put in here so the carry flag will always be set. - -envtype equ $+1 ; Pointer for in-the-code modification - cp 3 ; See if no higher than a type-3 environment - jr c,mload3a ; If higher than type 3, branch - - inc hl ; Advance to load address word - inc hl - inc hl - ld a,(hl) ; Get load address into HL - inc hl - ld h,(hl) - ld l,a - ld (execadr),hl ; Set new execution/load address - -mload3a: - ld hl,(execadr) ; Get initial loading address - -; Load the file, making sure neither CPR nor protected memory is overwritten - -mload4: - if fullget - ld a,(envtype) ; If ENVTYPE is FF (from GET command) - inc a ; ..then skip memory limit checking - jr z,mload4b - endif ;fullget - - if rel - ld bc,entry ; We have to use a relocatable form to get - dec b ; ..highest page below the CPR - else ;not rel - ld b,high entry - 1 ; We can use shorter code for absolute form - endif ;rel - - ld a,(0007h) ; Get highest page below - dec a ; ..protected memory - cp b ; If A is lower value, - jr c,mload4a ; ..branch - ld a,b ; Otherwise use lower value in B -mload4a: - cp h ; Are we going to overwrite protected memory? - ld a,ectpafull ; Get ready with TPA overflow error code - jp c,error ; Error if about to overwrite protected memory -mload4b: - push hl ; Save this load address - ex de,hl ; Set DMA address - call dmaset - call readcmd - pop hl ; Get last load address back - jr nz,mload5 ; Read error or eof? - ld de,128 ; Increment load address by 128 - add hl,de - jr mload4 ; Continue loading - -; In case a program would like to find out in what directory the command -; processor found the program, temporary DU is stored in bytes 13 (user) and -; 14 (drive) in the command FCB. - -mload5: - -tempusr equ $+1 ; Pointers for in-the-code modification -tempdr equ $+2 - ld hl,0 - ld (cmdfcb+13),hl - -logcurrent: ; Return to original logged directory - ld hl,(curusr) ; Set L = current user, H = current drive - ld a,h - call setdrive ; Login current drive - ld a,l - jp setuser ; Log in new user and return from MLOAD - -;---------------------------------------- - -; This routine checks to see if building the path or running the ECP should -; be skipped. If there is a colon in the command (an explicit directory -; given) but it was not a lone colon (indicating desire to skip resident -; commands), then the routine returns with the zero flag reset. - - if skippath - -skipchk: - ld a,(colon) ; Was there a colon in the command? - or a - ret z ; Return with zero flag set if not - - if fastecp or badduecp - ld a,(firstchar) ; See if the first character was the colon - else -firstchar equ $+1 ; Put data here if other two options are - ld a,0 ; ..false (in-the-code modification) - endif ;fastecp or badduecp - - cp ':' - ret ; Return: Z if lone colon, NZ otherwise - - endif ;skippath - - -; End ZCPR33-6.Z80 - - page - -;----------------------------------------------------------------------------- -; -; D A T A A R E A D E F I N I T I O N S -; -;----------------------------------------------------------------------------- - -; ---------- Page line count buffer - - if lton ; Needed only if TYPE command included - -pagcnt: - defs 1 ; Lines left on page (filled in by code) - - endif ;lton - - -; ---------- Minpath/Rootpth buffers - - if extmpath - -mpath equ extmpathadr ; Assign external minpath address - - else - -mpath: - if drvprefix - defs 2 ; Two bytes for specified DU - endif - - if scancur - defs 2 ; Two bytes for current DU - endif - - defs 2 * expaths ; Space for path from path buffer - - defs 1 ; One byte for ending null - - endif ; not extmpath - - - if rootonly -rootpth: - defs 2 ; Special path for root dir only - defb 0 ; End of path - endif ; rootonly - -;----------------------------------------------------------------------------- - -; The following will cause an error message to appear if -; the size of ZCPR33 is over 2K bytes. - - if [ $ - entry ] gt 800h - *** ZCPR33 IS LARGER THAN 2K BYTES *** - endif - - endif ;errflag - - end ; ZCPR33 - \ No newline at end of file diff --git a/Source/BPBIOS/ZCPR33/zcpr33t.z80 b/Source/BPBIOS/ZCPR33/zcpr33t.z80 deleted file mode 100644 index 3f2313e1..00000000 --- a/Source/BPBIOS/ZCPR33/zcpr33t.z80 +++ /dev/null @@ -1,4042 +0,0 @@ -; PROGRAM: ZCPR -; VERSION: 3.3 -; DERIVATION: ZCPR30 -; AUTHOR: Jay Sage -; DATE: May 28, 1987 - -; ZCPR33 is copyright 1987 by Echelon, Inc. All rights reserved. End-user -; distribution and duplication permitted for non-commercial purposes only. -; Any commercial use of ZCPR33, defined as any situation where the duplicator -; recieves revenue by duplicating or distributing ZCPR33 by itself or in -; conjunction with any hardware or software product, is expressly prohibited -; unless authorized in writing by Echelon. -; -; Echelon specifically disclaims any warranties, expressed or implied, -; including but not limited to implied warranties of merchantability and -; fitness for a particular purpose. In no event will Echelon be liable for -; any loss of profit or any other commercial damage, including but not limited -; to special, incidental, consequential, or other damages. -; -; Echelon can be contacted at: -; Echelon, Inc. -; 885 N. San Antonio Road -; Los Altos, California USA 94022 -; (415) 948-3820 - - -;----------------------------------------------------------------------------- -; -; A C K N O W L E D G M E N T S -; -;----------------------------------------------------------------------------- - -; Many people have played a role in the development of ZCPR in general and -; ZCPR33 in particular. It all started when "The CCP Group," including -; Richard Conn, Ron Fowler, Keith Petersen, Frank Wancho, Charlie Strom, and -; Bob Mathias decided that by rewriting the CP/M command processor to take -; advantage of Zilog-specific opcodes they could save enough code to enhance -; some of the features. Richard Conn then extended that development through -; ZCPR2 to ZCPR3 (3.0). Just a little over two years ago, I took the first -; step to enhance ZCPR3 by making it get the maximum drive and user values -; from the environment instead of hard coding them in. This version was -; distributed privately as ZCPR31. Along the way to what is now ZCPR -; version 3.3 a number of others have made valuable contributions: Steve -; Kitahata, Michael Bate, Bruce Morgen, Roger Warren, Dreas Nielsen, Bob Freed, -; Al Hawley, Howard Goldstein, and many others who have stimulated developments -; by pointing out problems or asking questions. - -; I would like particularly to acknowledge two people who have played a very -; significant role in these developments. One is Al Hawley. He introduced -; the idea of having the DUOK flag in the environment control how the CPR -; would respond to the DU: form of directory reference. He also originated -; the idea of using the high bit of the first character of each command name -; to control whether or not it would be wheel restricted. Finally, he -; contributed the basic structure of the highly efficient, elegant, and more -; general number evaluation routines in the code. - -; My biggest debt of gratitude is to Howard Goldstein. His role in the -; development of ZCPR33 goes back about a year, when he contributed the first -; correct implementation of the minpath feature. More recently, during the -; period of intense development since Echelon expressed its interest in my -; writing the official 3.3 version, he and I have shared an especially -; enjoyable and fruitful relationship. Most of the newest ideas have been -; worked out jointly, and Howard has done a great deal to keep my code and -; concepts on track. He discovered many ways to pare the code down and, more -; importantly, uncovered numerous subtle bugs. He recoded the SAVE command -; to make it more compact and reliable. -; -; Jay Sage -; May 28,1987 - -;----------------------------------------------------------------------------- -; -; U S E R C O N F I G U R A T I O N -; -;----------------------------------------------------------------------------- - -; The following MACLIB statements load all the user-selected equates -; which are used to customize ZCPR33 for the user's working environment. -; NOTE -- TRUE & FALSE are defined in Z3BASE. - - maclib z3baset.lib - maclib z33hdr.lib - -; Check that the configuration includes the required facilities - -; A ZCPR33 system is assumed to include certain minimal features, including -; an external file control block, external path, shell stack, message buffer, -; external environment descriptor, multiple command line, and external stack. -; If wheel checking is enabled in the Z33HDR.LIB file, then there must be -; an address defined for the wheel byte in the Z3BASE.LIB file. - -errflag defl extfcb eq 0 ; External command FCB -errflag defl errflag or [ expath eq 0 ] ; Symbolic path -errflag defl errflag or [ shstk eq 0 ] ; Shell stack -errflag defl errflag or [ z3msg eq 0 ] ; Message buffer -errflag defl errflag or [ z3env eq 0 ] ; Environment descriptor -errflag defl errflag or [ z3cl eq 0 ] ; Multiple command line -errflag defl errflag or [ extstk eq 0 ] ; External stack - if wheel or wdu or wpass or wprefix or whldir -errflag defl errflag or [ z3whl eq 0 ] ; Wheel byte - endif ;wheel or wdu or wpass or wprefix or whldir - - if errflag - - *** NOT ALL REQUIRED ZCPR3 FACILITIES ARE SUPPORTED *** - - else ; go ahead with the assembly - - -;----------------------------------------------------------------------------- -; -; D E F I N I T I O N S S E C T I O N -; -;----------------------------------------------------------------------------- - - -; ---------- Macro definitions - - maclib z33mac.lib ; Library of macros for ZCPR33 - - -; ---------- ASCII definitions - -ctrlc equ 03h -bell equ 07h -tab equ 09h -lf equ 0ah -cr equ 0dh - - -; ---------- Operating system addresses - -wboot equ base+0000h ; CP/M warm boot address -udflag equ base+0004h ; User number in high nybble, disk in low -bdos equ base+0005h ; BDOS function call entry point -tfcb equ base+005ch ; Default FCB buffer -tfcb2 equ tfcb+16 ; 2nd FCB -tbuff equ base+0080h ; Default disk I/O buffer -tpa equ base+0100h ; Base of TPA -;bios equ ccp+0800h+0e00h ; BIOS location - - -; ---------- Error codes - -; ZCPR33 uses the error byte at the beginning of the message buffer as a flag -; to show what kind of error occurred. Advanced error handlers will be able -; to help the user further by suggesting the possible cause of the error. -; Error code 6 for an ECP error is determined by the code and cannot be -; changed (without increasing code length). - -ecduchg equ 1 ; Directory change error -- attempt to change - ; ..logged directory when under control of - ; ..wheel byte and wheel is off - -ecbaddir equ 2 ; Bad directory specification -- logging of - ; ..user number beyond legal range, - ; ..nonexistent named directory - -ecbadpass equ 3 ; Bad password -- incorrect password entered - - -ecbadcmd equ 5 ; Bad command form -- wildcard or file type - ; ..present in command verb - -ececperr equ 6 ; ECP error -- command could not be executed - ; ..by ECP, error handling was forced by a - ; ..transient for its own reasons - ; (DO NOT CHANGE FROM 6) - -ecnocmd equ 7 ; Command file not found -- command that skips - ; ..ECP could not be executed, GET could not - ; ..find file to load - -ecambig equ 8 ; Ambiguous file specification where not - ; ..allowed (SAVE, GET, REN) - -ecbadnum equ 9 ; Bad numerical value -- not a number where - ; ..number expected, number out of range - -ecnofile equ 10 ; File not found -- REN, TYPE, LIST could not - ; ..find a specified file - -ecdiskfull equ 11 ; Disk directory or data area full - -ectpafull equ 12 ; TPA overflow error - - -; ---------- Multiple command line equates - -; The multiple command line buffer is located in a protected area in memory so -; that it is not overwritten during warm boots. It includes some pointers so -; that when ZCPR33 starts it can tell where to start reading the command line. -; BUFSIZ and CHRCNT are not used by ZCPR33 but are provided so that the BDOS -; line input function can be used to read in a command line. - -nxtchr equ z3cl ; Address where pointer to next command to - ; ..process is kept -bufsiz equ z3cl+2 ; Address where size of buffer is kept -chrcnt equ z3cl+3 ; Address where length of string actually in - ; ..the buffer is kept (not always reliable) -cmdlin equ z3cl+4 ; Address of beginning of command line buffer -buflen equ z3cls ; Length of command line buffer - - -; ---------- Command file control block - -; In ZCPR33 the file control block for commands must be located in protected -; memory. This not only frees up valuable space in the command processor for -; code but also makes it possible for programs to determine by what name they -; were invoked. - -cmdfcb equ extfcb - - -; ---------- External CPR stack - -stack equ extstk+48 ; Set top-of-stack address -pwlin equ extstk ; Place line at bottom of stack - - -; ---------- Environment - -quietfl equ z3env+28h ; Quiet flag -maxdrenv equ z3env+2ch ; Maximum drive value -maxusrenv equ z3env+2dh ; Maximum user value -duokfl equ z3env+2eh ; Flag indicating acceptance of DU: form -crttxt0 equ z3env+33h ; Address of number of lines of text on the - ; ..screen of CRT0 - - -; ---------- Message buffer - -ecflag equ z3msg ; Error return code flag -ifptrfl equ z3msg+1 ; Pointer to current IF level -ifstatfl equ z3msg+2 ; Flow control status byte -cmdstatfl equ z3msg+3 ; Command status flag -cmdptr equ z3msg+4 ; Pointer to currently running command -zexinpfl equ z3msg+7 ; ZEX input status/control flag -zexrunfl equ z3msg+8 ; ZEX running flag -errcmd equ z3msg+10h ; Error handling command line -xsubflag equ z3msg+2ch ; XSUB input redirection flag -subflag equ z3msg+2dh ; Submit running flag -curusr equ z3msg+2eh ; Currently logged user -curdr equ z3msg+2fh ; Currently logged drive - - -;----------------------------------------------------------------------------- -; -; C O D E M O D U L E S S E C T I O N -; -;----------------------------------------------------------------------------- - - page - -; ZCPR33-1.Z80 - -;============================================================================= -; -; E N T R Y P O I N T S A N D H E A D E R S T R U C T U R E -; -;============================================================================= - - if not rel ; If generating absolute code - org ccp - else - common /_BIOS_/ -bios equ $ - cseg - endif ;not rel - - -; ENTRY POINTS INTO ZCPR33 -; -; For compatibility with CP/M, two entry points are provided here. In -; standard CP/M if the code is entered from the first entry point, then the -; command in the resident command buffer is executed; if entered from the -; second entry point, the command line is flushed. With ZCPR33 and its -; multiple command line buffer, these two entry points function identically -; and go to the same address. -; -; We have kept the entry points in their standard locations but have used a -; relative jump for the second entry point and replaced the last byte with the -; version number. In this way the version number occupies a position that -; would otherwise contain the page number at which the CPR runs. It will -; always be possible, therefore, to distinguish ZCPR33 and later versions -; from other command processors. The first jump is kept as an absolute jump -; so that 1) the code will be compatible with Z-COM and Z3-DOT-COM and 2) the -; execution address of a CPR module can always be determined. - -entry: - jp zcpr - - jr zcpr - -version: - defb 33h ; Version ID squeezed in here (offset = 5) - -;----------------------------------------------------------------------------- - -; Configuration information - -options: ; (offset = 6) - optflag badduecp,rootonly,ndrenv,fcpenv,rcpenv,inclenv,aduenv,duenv - optflag highuser,drvprefix,scancur,incldir,incldu,dufirst,accptdir,accptdu - optflag no,pwcheck,pwnoecho,wdu,wpass,wprefix,fastecp,skippath - -attdir defl [ comatt eq 80h ] or [ comatt eq 01h ] or [ not attchk ] -attsys defl [ comatt eq 00h ] or [ comatt eq 01h ] or [ not attchk ] -subquiet defl [ subnoise eq 1 ] -subecho defl [ subnoise gt 1 ] - - optflag shellif,attsys,attdir,attchk,subecho,subquiet,subclue,subon - -; Byte with information about the alternate colon option. If the byte is -; zero, the option is not supported. Otherwise the byte contains the -; prefix character that serves as an alias for a colon prefix. Offset = 10. - - if altcolon - defb altchar - else - defb 0 - endif ;altcolon - -; Byte with information about the FASTECP implementation (option bit above -; indicates whether the feature is enabled at all). If no character appears -; here (zero byte), then only a leading space can be used. Otherwise, the -; first seven bits contain the character, and the high bit, if set, indicates -; that ONLY this character will be recognized and not a space. Offset = 11. - - if fastecp and altspace - if altonly - defb ecpchar + 80h - else ;not altonly - defb ecpchar - endif ;altonly - else ;no alternate character - defb 0 - endif ;fastecp and altspace - - defb 0,0,0,0 ; Space reserved for expansion - -;----------------------------------------------------------------------------- - -; Entry points to file name parsing code. - -; Entry point REPARSE. A call to this point can be used to parse a command -; line tail into the default file control blocks at 5CH and 6CH. Each time -; the parser is called it leaves the starting address of the second token in -; the PARESPTR address below so that successive calls to the routine reparse -; the command tail one token later. A program can load its own pointer into -; PARSEPTR as well. Offset = 16 (10h). - -reparse: -parseptr equ $+1 ; Pointer for in-the-code modification - ld hl,0 - jp parsetail - -; Entry point SCAN. A call to this point can be used to parse a single token -; pointed to by HL into the FCB pointed to by DE. Offset 22 (16h). - -scan: - jp scanner - -;----------------------------------------------------------------------------- - -; BUFFERS -; -; In this area various data items are kept. First comes the list of commands -; supported by ZCPR33; then comes the name of the extended command processor -; (ECP). By putting these items here, an 'H' command in the RCP or a utility -; like SHOW.COM can find this information and report it to the user. - - -; ---------- RESIDENT COMMAND TABLE - -; The command table entry is structured as follows: First there is a byte -; which indicates the number of characters in each command. Then there is a -; series of entries comprising the name of a command followed by the address -; of the entry point to the code for carrying out that command. Finally, -; there is a null byte (00h) to mark the end of the table. Offset = 25 (19h). - - -cmdtbl: - defb cmdsize ; Length of command names - ctable ; Define table via macro in Z33HDR.LIB - defb 0 ; End of table - -; ---------- NAME FOR EXTENDED COMMAND PROCESSOR - -; The name of the extended command processor is placed here after the command -; table so that utilities like SHOW or an RCP 'H' command can find it. - -ecpfcb: - ecpname ; From Z33HDR.LIB - - -; ---------- FILE TYPE FOR TRANSIENT COMMANDS (usually COM) - -; This file type also applies to the extended command processor name. - -commsg: - comtyp ; From Z33HDR.LIB - - - -; ---------- SUBMIT FILE CONTROL BLOCK - - if subon ; If submit facility enabled ... - -subfcb: - defb subdrv-'A'+1 ; Explicit drive for submit file - defb '$$$ ' ; File name - subtyp ; From Z33HDR.LIB - defb 0 ; Extent number - defb 0 ; S1 (user number 0) -subfs2: - defs 1 ; S2 -subfrc: - defs 1 ; Record count - defs 16 ; Disk group map -subfcr: - defs 1 ; Current record number - - endif ; subon - -; End ZCPR33-1.Z80 - - page - -; ZCPR33-2.Z80 - -;============================================================================= -; -; C O M M A N D L I N E P R O C E S S I N G C O D E -; -;============================================================================= - -; MAIN ENTRY POINT TO CPR - -; This is the main entry point to the command processor. On entry the C -; register must contain the value of the user/drive to be used as the current -; directory. - -zcpr: - ld sp,stack ; Reset stack - - if pwnoecho - ld a,0c3h ; Reenable BIOS conout routine - ld (bios+0ch),a ; ..after a warmboot - endif ;pwnoecho - - ld b,0fh ; Keep nibble mask in B - -; If the HIGHUSER option is enabled, we compare the user/drive in the login -; byte in C to the values stored in the message buffer. If, ignoring bit 4 -; of the user number, they match, then we remain in the current area, which -; may be a user area above 15. - - if highuser - - ld a,c ; Copy user/drive byte to A - and b ; Isolate drive - ld d,a ; ..and move to D - ld a,c ; Get full byte back - swap ; Swap nibbles - and b ; Isolate user number - ld e,a ; ..and move to E - ld hl,(curusr) ; Get old curdr/curusr into HL - sbc hl,de ; Subtract new values from old (carry is clear) - ex de,hl ; Switch new values into HL, diff into DE - ld a,d ; Combine two parts of difference - or e - and b ; Ignore bit for high user numbers - jr z,zcpr1 ; Skip update if no change in DU - ld (curusr),hl ; Update values of current drive and user -zcpr1: - - else ;not highuser - - ld a,c ; Copy user/drive byte to A - and b ; Isolate drive - ld h,a ; ..and move to H - ld a,c ; Get full byte back - swap ; Swap nibbles - and b ; Isolate user number - ld l,a ; ..and move to L - ld (curusr),hl ; ..and save them - - endif ;highuser - -; This block of code is executed when submit processing is enabled. We log -; into user area 0, where the submit file is kept, and we search the -; designated drive for the file. The result is kept in SUBFLAG. This code -; only has to be executed on reentry to the command processor at the main -; entry point. Commands that do not reboot but simply return to the CPR will -; execute without the disk reset and file search required here. Ron Fowler -; pointed out a shortcut based on the fact that after a disk reset, the A -; regiser contains a value of 0 if there is no file on drive A with a '$' in -; the file name and 0FFH if there is such a file. Thus if A = 0, there can -; be no '$$$.SUB' file on drive A. This trick is, unfortunately, not reliable -; under some versions of ZRDOS. Therefore, an option has been included to -; use or not use this shortcut. - - if subon ; If submit facility enabled .. - - call defltdma ; Set DMA address to 80H - ld a,0 ; Log into user area 0 - call setuser - ld c,0dh ; Reset disk system (returns 0FFH if a $$$.SUB - call bdossave ; ..file might exist in user 0) - ld de,subfcb ; Point to submit file FCB with explicit drive - - if subclue - call nz,srchfst ; Search only if flag says it could exist - else ;not subclue - call srchfst ; Search for the file unconditionally - endif ;subclue - - ld (subflag),a ; Set flag for result (0 = no $$$.SUB) - - else ;not subon - - ld c,0dh ; Reset disk system - call bdossave - - endif ; subon - - jr nextcmd ; Go to entry point for processing next command - - -;----------------------------------------------------------------------------- - -; NEW COMMAND LINE ENTRY POINT - -; This entry point is used when ZCPR33 finds the command line empty. A call to -; READBUF gets the next command line from the following possible sources in -; this order: -; 1) a running ZEX script -; 2) the submit file $$$.SUB (if enabled) -; 3) the shell stack -; 4) the user -; If the line comes from the shell stack, then the shell bit in the command -; status flag is set. - -restart: - ld sp,stack ; Reset stack - xor a - ld (cmdstatfl),a ; Reset ZCPR3 command status flag - inc a ; Set ZEX message byte to 1 to - ld (zexinpfl),a ; ..indicate command prompt - if subon - ld (xsubflag),a ; Ditto for XSUB flag - endif ;subon - ld hl,cmdlin ; HL --> beginning of command line buffer - ld (nxtchr),hl ; Save as pointer to next character to process - ld (hl),0 ; Zero out command line (in case of warm boot) - push hl ; Save pointer to command line - call readbuf ; Input command line (ZEX, submit, shell, - ; ..or user) - pop hl ; Get back pointer to command line - ld a,(hl) ; Check for comment line - cp comment ; Begins with comment character? - jr z,restart ; If so, go back for another line - ; Otherwise, fall through - -;----------------------------------------------------------------------------- - -; COMMAND CONTINUATION PROCESSING ENTRY POINT - -; This is the entry point for continuing the processing of an existing command -; line. The current drive and user values as known to the CPR are combined -; and made into the user/drive byte that CP/M keeps at location 0004. If the -; HIGHUSER option is enabled, the user number for this byte is forced to be -; in the range 0..15. Next the command status flag is processed. The error -; and ECP bits in the actual flag are reset, and the original flag is checked -; for an ECP error return (both ECP bit and error bit set). In that case, -; control is transferred to the error handler. - -nextcmd: - ld hl,(curusr) ; Get currently logged drive and user - ld a,l ; Work on user number - if highuser - and 0fh ; Keep value modulo 16 - endif ;highuser - swap ; Get user into high nibble - or h ; ..and drive into low nibble - ld (udflag),a ; Set user/disk flag in page 0 - - ld a,2 ; Turn ZEX input redirection off - ld (zexinpfl),a - if subon - ld (xsubflag),a ; Turn off XSUB input redirection - endif ;subon - - ld hl,cmdstatfl ; Point to the command status flag (CSF) - ld a,(hl) ; Get a copy into register A - res 1,(hl) ; Reset the actual error bit - res 2,(hl) ; Reset the actual ECP bit - and 110b ; Select ECP and error bits in original flag - cp 110b ; Test for an ECP error - jp z,error ; Process ECP error with error handler - -nextcmd1: - ld sp,stack ; Reset stack - call logcurrent ; Return to default directory - ld hl,(nxtchr) ; Point to first character of next command - push hl ; Save pointer to next character to process - -; We have to capitalize the command line each time because an alias or other -; command line generator may have stuck some new text in. The code is shorter -; if we simply capitalize the entire command rather than trying to capitalize -; only the one command we are about to execute. - -capbuf: ; Capitalize the command line - ld a,(hl) ; Get character - call ucase ; Convert to upper case - ld (hl),a ; Put it back - inc hl ; Point to next one - or a ; See if end of line (marked with null) - jr nz,capbuf ; If not, loop back - - pop hl ; Restore pointer to next character to process - -nextcmd3: - -; ZCPR33 provides a convenience feature to make it easier to enter a leading -; colon to force the current directory to be scanned and to make the CPR skip -; resident commands. If ALTCOLON is active, an alternate character can be -; entered as the first character of a command. The default (and recommended) -; alternative character is the period (it could not have any other meaning -; here). If FASTECP (see below) is not enabled or if ALTONLY is enabled, -; leading spaces on the command line are skipped before looking for the -; alternate character for the colon - - if [ not fastecp ] or [ fastecp and altonly ] - call sksp - endif ;[ not fastecp ] or [ fastecp and altonly ] - - if altcolon ; If allowing alias character for leading colon - ; Set B = ':' and C = alias character ('.') - ld bc,':' shl 8 + altchar - ld a,(hl) ; Get first character in new command line - cp c ; If first character is ALTCHAR, treat as ':' - jr nz,nextcmd3a ; Branch if not '.' - ld (hl),b ; Else replace with colon -nextcmd3a: - endif ;altcolon - - -; ZCPR33 supports three new options that can speed up command processing. -; FASTECP allows commands with a leading space to bypass the search for -; resident commands or transient commands (COM files) along the path and go -; directly to the extended command processor. With SKIPPATH enabled, when -; a command is prefixed by an explicit directory specification (but not a -; lone colon), searching of the path and invocation of the ECP are disabled. -; If the command is not found in the specified directory, the error handler -; is invoked immediately. Finally, if BADDUECP is enabled, when an attempt -; is made to log into an invalid directory, the command is sent directly to -; the ECP, which can provide special handling. To implement these three -; features, the first actual character of the command line is saved as a -; flag in FIRSTCHAR. My apologies for the complexity of these nested -; conditionals. - - if fastecp or skippath or badduecp - - ; With FASTECP we store the first actual - ; ..character and then skip over spaces (unless ALTONLY is - ; ..enabled, in which case we skipped spaces above) - - if fastecp - - if altspace ; If allowing alias character for leading space - ; Set B = ' ' and C = alias character ('/') - ld bc,' ' shl 8 + ecpchar - ld a,(hl) ; Get first character in new command line - cp c ; If first character is ECPCHAR treat as ' ' - jr nz,nextcmd3b ; Branch if not '/' (alternate character) - ld (hl),b ; Else replace with space -nextcmd3b: - endif ;altspace - - ld a,(hl) ; Get first character in command line - ld (firstchar),a ; Save it in flag - call sksp ; Then skip leading spaces - endif ;fastecp - - ; With SKIPPATH but not FASTECP we store the first - ; ..character of the command (spaces were skipped above) - - if [ not fastecp ] and skippath - ld (firstchar),a ; Store first nonspace character - endif ;[ not fastecp ] and skippath - - ; With only BADDUECP (and neither SKIPPATH nor FASTECP) - ; ..we store a null in the FIRSTCHAR flag - - if [ not fastecp ] and [ not skippath ] - xor a - ld (firstchar),a - endif ;[ not fastecp ] and [ not skippath ] - - endif ;fastecp or skippath or badduecp - -; Resume processing of the command line - - or a ; Now at end of line? - jr z,restart ; If so, get a new command line - cp ctrlc ; Flush ^C to prevent error-handler - jr z,restart ; ..invocation on warm boots - - cp cmdsep ; Is it a command separator? - jr nz,nextcmd4 ; If not, skip ahead to process the command - inc hl ; If it is, skip over it - jr nextcmd3 ; ..and process next command - -nextcmd4: - -; Unless we are now running the external error handler, the following code -; saves the address of the current command in Z3MSG+4 for use by programs -; to determine the command line with which they were invoked. - - ld a,(cmdstatfl) ; Get command status flag - bit 1,a ; Test for error handler invocation - jr nz,nextcmd5 ; If so, skip over next instruction - ld (cmdptr),hl - -nextcmd5: - call parser ; Parse entire command line, then look for - ; ..the command - - -;============================================================================= - -; C O M M A N D S E A R C H C O D E - -;============================================================================= - -; CODE FOR FINDING AND RUNNING THE COMMAND - -; Here is the code for running a command. Commands are searched for and -; processed in the following order: -; -; 1) flow control package (FCP) commands and IF state testing -; 2) resident command package (RCP) -; 3) command processor (CPR) -; 4) transient (COM file or extended command processor) -; 5) external error handler -; 6) internal error message and processing -; -; Special notes: -; -; a) If the current command is a shell command, special handling of flow -; control is required. If SHELLIF is enabled so that flow commands are -; allowed in shell alias scripts, then we reset the flow state to its -; initial condition (none) with each shell invocation (and after each -; command is run, we reset the shell bit in the code after CALLPROG). -; In this case shells will run regardless of flow state, and residual -; conditionals from the last running of the shell are flushed. Each -; shell input sequence begins afresh. On the other hand, if SHELLIF is -; off, flow control commands inside a shell script must be flushed so -; that they do not interfere with user entered commands. -; b) Directory prefixes are ignored for flow commands, since all flow control -; processing must pass through the FCP (the command must run even when -; the current flow state is false). -; c) If the command is not found in the FCP, then the current flow state is -; tested. If it is false, the command is flushed and the code branches -; back to get the next command. -; d) If the command had a directory prefix (a colon alone is sufficient), -; then steps #2 and #3 are skipped over,and the command is processed -; immediately as a transient program. -; e) In ZCPR33, unlike ZCPR30, RCP commands are scanned before CPR commands. -; This has been done so that more powerful RCP commands can supercede -; CPR commands. -; f) If the SKIPPATH option is enabled, when an explicit directory is -; specified with a command (but not just a colon), searching of the path -; is bypassed. If the FASTECP option is enabled, commands with leading -; spaces are sent directly to the ECP for processing. -; g) If no external command can be found, ZCPR33 performs extensive error -; handling. If the command error occurred while looking for a shell -; program, then the shell stack is popped. Otherwise, ZCPR33 tries to -; invoke an external, user-specified error handling command line. If -; none was specified or if the error handler invoked by that command -; line cannot be found, the internal error message (step #6) is displayed. - - -;----------------------------------------------------------------------------- - -runcmd: - if shellif ; If shells reininitialize flow control... - ld a,(cmdstatfl) ; Get command status flag - bit 0,a ; Shell bit set? - jr z,fcpcmd ; If not a shell, process command - xor a ; Otherwise, shell is running, so - ld (ifptrfl),a ; ..reinitialize the IF system and continue - endif ;shellif - - -; ---------- Module <<1>>: Flow Control Processing - -; An option is supported here to allow the address of the FCP to be obtained -; from the environment descriptor. This is logically consistent with the -; pholosopy of the Z-System and is useful when one wants to have a single block -; of FCP/RCP memory that can be allocated dynamically between FCP and RCP -; functions. - -fcpcmd: - - if fcp ne 0 ; Omit code if FCP not implemented - - if fcpenv ; If getting FCP address from Z3ENV - - ld e,12h ; Offset in Z3ENV to FCP address - call pkgoff ; Set HL to FCP+5 - jr z,runcmd1 ; Skip if no FCP present - - else ; using fixed FCP address - - ld hl,fcp+5 ; Get address from Z3BASE.LIB - - endif ;fcpenv - - -; If flow control processing is not allowed in shell aliases (scripts running -; as shell commands), then we have to make sure that we flush any flow control -; commmands, otherwise the CPR will attempt to execute them as transients, -; with dire consequences. In the code below we check the shell bit. If it -; is not set, we proceed normally. If it is set, we scan for flow commands -; and then jump past the flow testing to RUNFCP2, where the code will flush -; the command if it was a flow command and execute it unconditionally if not. - - if not shellif - ld a,(cmdstatfl) ; Get command status flag - bit 0,a ; If shell bit not set, - jr z,runfcp1 ; ..we do normal processing - call cmdscan ; Otherwise, check for flow command - jr runfcp2 ; ..and flush if so using code below - endif ;not shellif - -runfcp1: - call cmdscan ; Scan command table in the module - jr z,callprog ; Run if found (with no leading CRLF) - -; This is where we test the current IF state. If it is false, we skip this -; command. - - call iftest ; Check current IF status - -runfcp2: ; If false, skip this command and go on to next - if drvprefix ; If DRVPREFIX we can use code below - jr z,jpnextcmd ; ..to save a byte - else ; Otherwise, we have to do an - jp z,nextcmd ; ..absolute jump - endif ;drvprefix - - endif ;fcp ne 0 - - -runcmd1: - if fastecp or badduecp - ld a,(firstchar) ; If FIRSTCHAR flag set for ECP invocation, - cp ' ' ; ..then go straight to transient processing - jr z,com - endif ;fastecp or badduecp - -colon equ $+1 ; Flag for in-the-code modification - ld a,0 ; If command had a directory prefix (even just - or a ; ..a colon) then skip over resident commands - jr nz,comdir - - -; ---------- Module <<2>>: RCP Processing - -; An option is supported here to allow the address of the RCP to be obtained -; from the environment descriptor. This is logically consistent with the -; pholosopy of the Z-System and is useful when one wants to have a single block -; of FCP/RCP memory that can be allocated dynamically between FCP and RCP -; functions. - - if rcp ne 0 ; Omit code if RCP not implemented - -rcpcmd: - - if rcpenv ; If getting address of rcp from Z3ENV - - ld e,0ch ; Offset in Z3ENV to RCP address - call pkgoff ; Set HL to address of RCP+5 - jr z,cprcmd ; Skip if no RCP - - else ; using fixed RCP address - - ld hl,rcp+5 ; Get address from Z3BASE.LIB - - endif ; rcpenv - - call cmdscan ; Check for command in RCP - jr z,callproglf ; If so, run it (with leading CRLF) - - endif ;rcp ne 0 - - -; ---------- Module <<3>>: CPR-Resident Command Processing - -cprcmd: - - ld hl,cmdtbl ; Point to CPR-resident command table - call cmdscan ; ..and scan for the command - jr z,callprog ; If found, run it (with no leading CRLF) - - - -; ---------- Module <<4>>: Transient Command Processing - -comdir: ; Test for DU: or DIR: only (directory change) - - if drvprefix - - ld a,(cmdfcb+1) ; Any command name? - cp ' ' - jr nz,com ; If so, must be transient or error - - ; Entry point for change of directory only - - if wdu ; If controlled by wheel.. - - ld a,(z3whl) ; Get wheel byte - or a ; If wheel on, go on ahead - jr nz,comdir1 - - if badduecp - ld (colon),a ; Pretend there is no colon - ld a,' ' ; Force invocation of ECP - ld (firstchar),a - jr com - else ;not badduecp - ld a,ecduchg - jr z,error - endif ;badduecp - - endif ; wdu - -comdir1: - ld hl,(tempusr) ; Get temporary drive and user bytes - - if not highuser ; If only users 0..15 can be logged - ld a,l ; Get user number and - cp 16 ; ..make sure not above 15 - jr nc,baddirerr ; If out of range, invoke error handling - endif ;not highuser - - dec h ; Shift drive to range 0..15 - ld (curusr),hl ; Make the temporary DU into the current DU - call logcurrent ; Log into the new current directory -jpnextcmd: - jp nextcmd ; Resume command line processing - - else ;not drvprefix - - if badduecp - xor a ; Pretend there is no colon - ld (colon),a - ld a,' ' ; Force invocation of ECP - ld (firstchar),a - else ;not badduecp - ld a,ecduchg - jr z,error - endif ;badduecp - - endif ;drvprefix - - -com: ; Process transient command - - ld a,(cmdstatfl) ; Check command status flag to see if - and 2 ; ..error handler is running - ld (zexinpfl),a ; Store result in ZEX control flag (2 will turn - ; ..ZEX input redirection off (0 = on) - if subon - ld (xsubflag),a ; Turn off XSUB input redirection also - endif ;subon - - ld hl,tpa ; Set default execution/load address - ld a,3 ; Dynamically load type-3 and above ENVs - call mload ; Load memory with file specified in cmd line - ld a,(cmdstatfl) ; Check command status flag to see if - and 100b ; ..ECP running (and suppress leading CRLF) - -; CALLPROG is the entry point for the execution of the loaded program. At -; alternate entry point CALLPROGLF if the zero flag is set, a CRLF is sent to -; the console before running the program. - -callproglf: - call z,crlf ; Leading new line - -callprog: - ; Copy command tail into TBUFF - -tailsv equ $+1 ; Pointer for in-the-code modification - ld hl,0 ; Address of first character of command tail - ld de,tbuff ; Point to TBUFF - push de ; Save pointer - ld bc,7e00h ; C=0 (byte counter) and B=7E (max bytes) - inc de ; Point to first char -tail: - ld a,(hl) ; Get character from tail - call tsteol ; Check for EOL - jr z,tail1 ; Jump if we are done - ld (de),a ; Put character into TBUFF - inc hl ; Advance pointers - inc de - inc c ; Increment character count - djnz tail ; If room for more characters, continue - call print ; Display overflow message - db bell ; ..ring bell - db 'Ovf','l'+80h ; ..then continue anyway -tail1: - xor a ; Store ending zero - ld (de),a - pop hl ; Get back pointer to character count byte - ld (hl),c ; Store the count - -; Run loaded transient program - - call defltdma ; Set DMA to 0080h standard value - -; Perform automatic installation of Z3 programs (unless type-2 environment) - - ld hl,(execadr) ; Get current execution address - call z3chk ; See if file is a Z3 program - jr nz,noinstall ; Branch if not - - cp 2 ; If type-2 (internal) environment - jr z,noinstall ; ..do not perform installation - - inc hl ; Advance to place for ENV address - ld (hl),low z3env ; Put in low byte of environment address - inc hl - ld (hl),high z3env ; Put in high byte - -noinstall: - -; Execution of the program occurs here by calling it as a subroutine - - ld hl,z3env ; Pass environment address to program in HL -execadr equ $+1 ; Pointer for in-line code modification - call 0 ; Call transient - -; Return from execution - - if shellif ; If flow processing allowed in shells... - ld hl,cmdstatfl ; Reset the shell bit in the command status - res 0,(hl) ; ..flag so multiple-command shells will work - endif ;shellif - - ; Continue command processing - if drvprefix ; If DRVPREFIX we can save a byte by - jr jpnextcmd ; ..doing a two-step relative jump - else ; Otherwise, we just have to do - jp nextcmd ; ..the absolute jump - endif ;drvprefix - - -; ---------- Module <<5>>: External Error Handler Processing - -baddirerr: - ld a,ecbaddir ; Error code for bad directory specification - -error: - -; If we are returning from an external command to process an error, we want -; to leave the error return code as it was set by the transient program. - - ld hl,cmdstatfl ; Point to command status flag - bit 3,(hl) ; Check transient error flag bit - jr nz,error1 ; If set, leave error code as set externally - ld (ecflag),a ; Otherwise, save error code from A register - -error1: - res 2,(hl) ; Reset the ECP bit to prevent recursion of - ; ..error handler by programs that don't - ; ..clear the bit - bit 0,(hl) ; Was error in attempting to run a shell? - jr nz,errsh ; If so, pop shell stack - -; The following code is included to avoid a catastrophic infinite loop when -; the external error handler cannot be found. After one unsuccessful try, -; the internal code is invoked. - - bit 1,(hl) ; Was an error handler already called? - jr nz,errintrnl ; If so, use internal error handler - -; If the current IF state is false, we would like to ignore the error and just -; go on with the next command. Unfortunately, for some errors (e.g., a bad -; command format such as a command with a wildcard character) the error handler -; is invoked before the pointer in the multiple command line buffer is set up -; to the next command. In that case, we fall into an infinite loop. We also -; must not allow the external error handler to run, since it will not run and -; we will again fall into an infinite loop. The present code is not so bad, of -; course, since even a command in a false part of a command sequence should not -; have a true error in it. We have already put in code to bypass password -; checking during a false IF state, since a command with a password is not an -; invalid command. - - if fcp ne 0 - call iftest ; If we are in a false IF state, external - jr z,errintrnl ; ..handler will not run, so use built-in - endif ;fcp ne 0 - - set 1,(hl) ; Set command status flag for error invocation - ld hl,errcmd ; Point to error handler command line - ld a,(hl) ; Check first byte for presence of an - or a ; ..error command line - jr z,errintrnl ; If no error handler, use built-in one - ld (nxtchr),hl ; Else, use error command line as next command - jp nextcmd1 ; Run command without resetting status flag - - -; ---------- Module <<6>>: Resident Error Handler Code - -; If the error is with the invocation of a shell command, we pop the bad shell -; command off the stack to prevent recursion of the error. We then use the -; the internal error handler to echo the bad shell command. - -errsh: - - ld de,shstk ; Point to current entry in shell stack - ld hl,shstk+shsize ; Point to next entry in stack - ld bc,[shstks-1]*shsize ; Bytes to move - ldir ; Pop the stack - xor a ; Clear the last entry position - ld (de),a - -errintrnl: - if subon - call subkil ; Terminate active submit file if any - endif ;subon - - call crlf ; New line - ld hl,(cmdptr) ; Point to beginning of bad command - call printhl ; Echo it to console - call print ; Print '?' - defb '?'+80h - jp restart ; Restart CPR - -; End ZCPR33-2.Z80 - - page - -; ZCPR33-3.Z80 - -;============================================================================= -; -; C O M M A N D L I N E P A R S I N G C O D E -; -;============================================================================= - -; This code parses the command line pointed to by HL. The command verb is -; parsed, placing the requested program name into the command file control -; block. The drive and user bytes are set. If an explicit DU or DIR was -; given, the COLON flag is set so that the processor knows about this later -; when the command search path is built. - -parser: - - ld de,cmdfcb ; Point to the command FCB - push de - call initfcb ; Initialize the FCB - pop de - ld (duerrflag),a ; Store zero (INITFCB ends with A=0) into flag - call scanner ; Parse first token on command line into FCB - jr nz,badcmd ; Invoke error handler if '?' in command - -duerrflag equ $+1 ; Pointer for in-the-code modification - ld a,0 ; See if bad DU/DIR specified with command verb - or a - - if badduecp - jr z,parser1 ; If DU/DIR is OK, skip ahead - ld a,(cmdstatfl) ; If ECP already running - bit 2,a ; ..skip ahead - jr nz,parser1 - ld a,(cmdfcb+1) ; If not a directory change command - sub ' ' ; ..invoke error handler - jr nz,baddirerr - ; If bad directory change attempt, - ld (tmpcolon),a ; ..pretend there is no colon (A=0) - ld a,' ' ; ..and force immediate ECP invocation - ld (firstchar),a ; ..when command is processed - else ; If errors not processed by ECP then - jr nz,baddirerr ; ..invoke error handler - endif ; badduecp - -parser1: - ld de,cmdfcb+9 ; Make sure no explicit file type was given - ld a,(de) ; Get first character of file type - cp ' ' ; Must be blank -badcmd: - ld a,ecbadcmd ; Error code for illegal command form - jr nz,error ; If not, invoke error handler - - push hl ; Save pointer to next byte of command - ld hl,commsg ; Place default file type (COM) into FCB - ld bc,3 - ldir - pop hl ; Get command line pointer back - -; The following block of code is arranged so that the COLON flag is set only -; when an explicit directory specification is detected in the command verb. -; Other parses also change the TMPCOLON flag, but only when passing here does -; the flag get transferred to COLON. - -tmpcolon equ $+1 ; Pointer for in-the-code modification - ld a,0 ; ..by SCANNER routine - ld (colon),a ; If explicit DU/DIR, set COLON flag - -; Find the end of this command and set up the pointer to the next command. - - push hl ; Save command line pointer - dec hl ; Adjust for preincrementing below -parser2: ; Find end of this command - inc hl ; Point to next character - ld a,(hl) ; ..and get it - call tsteol ; Test for end of command - jr nz,parser2 ; Keep looping if not - - ld (nxtchr),hl ; Set pointer to next command - pop hl ; Get back pointer to current command tail - -; This block of code parses two tokens in the command line into the two -; default FCBs at 5Ch and 6Ch. It also sets a pointer to the command tail -; for later copying into the command tail buffer at 80h. This code is used -; first when attempting to parse a normal command line and possibly again -; later when the entire user's command is treated as a tail to the extended -; command processor. The resident JUMP and SAVE commands use it also, and -; the entry point is available at location CCP+9 for use by other programs. - -parsetail: - ld (tailsv),hl ; Save pointer to command tail - - ; Process first token - - ld de,tfcb ; Point to first default FCB - push de ; Save pointer while initializing - call initfcb ; Initialize both default FCBs - pop de - call sksp ; Skip over spaces in command line - call nz,scanner ; If not end of line, parse the token - ; ..into first FCB - ld (parseptr),hl ; Save pointer to second token for reparsing - - ; Process second token - - call sksp ; Skip over spaces - ret z ; Done if end of line or end of command - ld de,tfcb2 ; Point to second default FCB - ; ..and fall through to SCANNER routine - -;----------------------------------------------------------------------------- - -; This routine processes a command line token pointed to by HL. It attempts -; to interpret the token according to the form [DU:|DIR:]NAME.TYP and places -; the corresponding values into the FCB pointed to by DE. On exit, HL points -; to the delimiter encountered at the end of the token. The Z flag is set if -; a wild card was detected in the token. - -scanner: - xor a ; Initialize various flags - ld (tmpcolon),a ; Set no colon - ld bc,(curusr) ; Get current drive and user into BC - inc b ; Shift drive range from 0..15 to 1..16 - ld (tempusr),bc ; Initialize temporary DU - - call scanfld8 ; Extract possible file name - cp ':' ; Was terminating character a colon? - jr nz,scantype ; If not, go on to extract file type - ld (tmpcolon),a ; Otherwise, set colon and process DU/DIR - inc hl ; Point to character after colon - -; Code for resolving directory specifications (macro RESOLVE is defined in -; Z33MAC.LIB). RESOLVE returns with a nonzero value and a NZ flag setting -; if the DU/DIR specification cannot be resolved. There are quite a few -; possibilities here. - - ; Case where both forms are accepted - - if accptdir and accptdu - if dufirst - resolve du,dir ; Check DU: form before DIR: form - else - resolve dir,du ; Check DIR: form before DU: form - endif ;dufirst - endif ;accptdir and accptdu - - ; Cases of only one form accepted - - if accptdu and not accptdir - resolve du, ; Check only DU: form - endif ;accptdu and not accptdir - - if accptdir and not accptdu - resolve dir, ; Check only DIR: form - endif ;accptdir and not accptdu - - ; Case of neither form accepted - - if not accptdir and not accptdu - push hl ; Save pointer to command string - inc de ; Point to first character of name - ld a,(de) ; Get it - dec de ; Restore the pointer - sub ' ' ; If no name is there, A=0 and Z flag set - endif ;not accptdir and not accptdu - - push de ; Save pointer to FCB again - push af ; Save bad directory flag - ld a,(tempdr) ; Set designated drive - ld (de),a ; ..into FCB - inc de ; Point to file name field - call ifcb ; Perform partial init (set user code) - pop af ; Get bad directory flag back - ld (duerrflag),a ; Save flag in parser code - jr z,scanner1 ; Branch if valid directory specified - dec de ; Back up to record count byte - dec de - ld (de),a ; Store error flag there (NZ if error) -scanner1: - pop de ; Get FCB pointer back - pop hl ; Restore pointer to command string - call scanfld8 ; Scan for file name - -; This code processes the file type specification in the token - -scantype: - ld a,(hl) ; Get ending character of file name field - ex de,hl ; Switch FCB pointer into HL - ld bc,8 ; Offset to file type field - add hl,bc - ex de,hl ; Switch pointers back - - ld b,3 ; Maximum characters in file type - cp '.' ; See if file type specified - jr nz,scantype2 ; If not, skip over file type parsing - - inc hl ; Point to character after '.' - push de ; Save pointer to FCB file type - call scanfield ; Parse file type into FCB - pop de - -scantype2: - ex de,hl ; Swap pointers again - ld bc,5 ; Offset from file type to S1 field in FCB - add hl,bc - ex de,hl ; Swap pointers back - ld a,(tempusr) ; Get specified user number - ld (de),a ; ..and store in S1 byte of FCB - -scan3: ; Skip to space character, character after an - ; ..equal sign, or to end of command - ld a,(hl) ; Get next character - cp ' '+1 ; Done if less than space - jr c,scan4 - call tsteol ; Done if end of line or end of command - jr z,scan4 - inc hl ; Skip on to next character - cp '=' ; If not equal sign - jr nz,scan3 ; ..keep scanning - -scan4: ; Set zero flag if '?' in filename.typ - -qmcnt equ $+1 ; Pointer for in-the-code modification - ld a,0 ; Number of question marks - or a ; Set zero flag - ret - -; This routine invokes SCANFIELD for a file name field. It initializes the -; question mark count and preserves the FCB pointer. - -scanfld8: - xor a ; Initialize question mark count - ld (qmcnt),a - push de ; Save pointer to FCB - ld b,8 ; Scan up to 8 characters - call scanfield - pop de ; Restore pointer to FCB - ret - -; This routine scans a command-line token pointed to by HL for a field whose -; maximum length is given by the contents of the B register. The result is -; placed into the FCB buffer pointed to by DE. The FCB must have had its name -; and type fields initialized before this routine is called. Wild cards of -; '?' and '*' are expanded. On exit, HL points to the terminating delimiter. - -scanfield: - call sdelm ; Done if delimiter encountered - ret z - inc de ; Point to next byte in FCB - cp '*' ; Is character a wild card? - jr nz,scanfld1 ; Continue if not - - ld a,'?' ; Process '*' by filling with '?'s - ld (de),a - call qcountinc ; Increment count of question marks - jr scanfld2 ; Skip so HL pointer left on '*' - -scanfld1: ; Not wildcard character '*' - ld (de),a ; Store character in FCB - inc hl ; Point to next character in command line - cp '?' ; Check for question mark (wild) - call z,qcountinc ; Increment question mark count -scanfld2: - djnz scanfield ; Decrement char count until limit reached -scanfld3: - call sdelm ; Skip until delimiter - ret z ; Zero flag set if delimiter found - inc hl ; Pt to next char in command line - jr scanfld3 - - -; Subroutine to increment the count of question mark characters in the -; parsed file name. - -qcountinc: - push hl - ld hl,qmcnt ; Point to count - inc (hl) ; Increment it - pop hl - ret - -;----------------------------------------------------------------------------- - -; Validate the password pointed to by HL. Prompt user for password entry -; and return zero if it is correct. - - if pwcheck - -passck: - push hl ; Save pointer to password - call print ; Prompt user - defb cr,lf,'PW?',' '+80h - ld hl,pwlin ; Set up buffer for user input - ld bc,90ah ; Set 0ah (BDOS readln function) in C - ld (hl),b ; ..and 9 (max character count) in B - ex de,hl ; Switch buffer pointer to DE - - if pwnoecho - ld a,0c9h ; Disable BIOS conout routine to - ld (bios+0ch),a ; ..suppress password echoing - call bdossave ; Get user input - ld a,0c3h ; Reenable BIOS conout routine - ld (bios+0ch),a - else ;not pwnoecho - call bdossave ; Get user input - endif ;pwnoecho - - ex de,hl ; Restore pointer to HL - inc hl ; Point to count of characters entered - ld a,(hl) ; Get character count - inc hl ; Point to first character - push hl ; Save pointer while marking end of input - call addah ; Advance HL to just past last character - ld (hl),' ' ; Place space there - pop de ; Restore pointer to beginning of user input - pop hl ; Restore pointer to password from NDR - ld b,8 ; Maximum characters to compare -pwck: - ld a,(de) ; Get next user character - call ucase ; Capitalize it - cp (hl) ; Compare to NDR - ret nz ; No match - cp ' ' ; If last user character matched space in - ret z ; ..NDR, then we have a complete match - inc hl ; If not done, point to next characters - inc de - djnz pwck ; (flags not affected by DJNZ) - xor a ; Set zero flag and - ret ; ..return Z to show success - - endif ; pwcheck - -;----------------------------------------------------------------------------- - -; This code attempts to interpret the token in the FCB pointed to by register -; pair DE as a DIR (named directory) prefix. If it is successful, the drive -; and user values are stored in TEMPDR and TEMPUSR, the zero flag is set, and -; a value of zero is returned in register A. -; -; If the named directory is found to be password restricted, then the user is -; asked for the password (unless the directory is the one currently logged or -; the current IF state is false). If an incorrect password is entered, the -; error handler is generally invoked directly. The exception to this is when -; the transient program bit is set in the command status flag (this bit would -; be set by a non-CPR program that calls REPARSE). In this case the default -; directory is returned, the zero flag is reset, and a nonzero value in -; returned in register A to show a bad directory. In addition, the code in -; SCANNER will set record-count byte in the FCB to a nonzero value so that -; the calling program can detect the error. [Note: if DU processing is also -; allowed and it follows DIR processing, DUSCAN will also be called. Unless -; there is a passworded directory with a DU form, this will cause no trouble.] - - if accptdir - -dirscan: - -; If the DU form is not allowed, we have to detect a colon-only condition here. -; Otherwise DUSCAN will take care of it. - - inc de ; Point to first byte of directory form - - if not accptdu - ld a,(de) ; Get first character of directory - sub ' ' ; If it is a blank space - ret z ; ..we have a successful directory resolution - endif ;not accptdu - - ex de,hl ; Switch pointer to FCB to HL - - if ndrenv ; If getting NDR address for Z3ENV - ld e,15h ; Offset to NDR address - push hl ; Preserve pointer to FCB - call pkgoff ; Get NDR address from ENV into DE - pop hl - jr z,direrr ; Branch if no NDR implemented - else ; using fixed address of NDR buffer - ld de,z3ndir ; Point to first entry in NDR - endif ; ndrenv - -dirscan1: - ld a,(de) ; Get next character - or a ; Zero if end of NDR - jr z,direrr - inc de ; Point to name of directory - inc de - push hl ; Save pointer to name we are looking for - push de ; Save pointer to NDR entry - ld b,8 ; Number of characters to compare - -dirscan2: - ld a,(de) - cp (hl) - jr nz,dirscan3 ; If no match, quit and go on to next DIR - inc hl ; Point to next characters to compare - inc de - djnz dirscan2 ; Count down - -dirscan3: - pop de ; Restore pointers - pop hl - jr z,dirscan4 ; Branch if we have good match - - ex de,hl ; Advance to next entry in NDR - ld bc,16 ; 8 bytes for name + 8 bytes for password - add hl,bc - ex de,hl - jr dirscan1 ; Continue comparing - -; If ACCPTDU is enabled, we can share similar code in DUSCAN and do not need -; the code here. - - if not accptdu -direrr: ; No match found - dec a - ret - endif ;not accptdu - -dirscan4: ; Match found - ex de,hl ; Switch pointer to NDR entry into HL - push hl ; ..and save it for later - dec hl ; Point to user corresponding to the DIR - ld c,(hl) ; Get user value into C - dec hl ; Point to drive - ld b,(hl) ; Get it into B - - if pwcheck - - ld hl,(curusr) ; Get current drive/user into HL - inc h ; Shift drive to range 1..16 - xor a ; Clear carry flag - sbc hl,bc ; Compare - pop hl ; Restore pointer to NDR entry - jr z,setdu ; If same, accept values without PW checking - -; If WPASS is set, then password checking is bypassed when the wheel byte is -; set. - - if wpass - ld a,(z3whl) ; Get wheel byte - or a ; If wheel byte set - jr nz,setdu ; ..skip checking passwords - endif ;wpass - -; This code is a bit tricky. We do not want to be asked for passwords for -; named directory references in commands when the current IF state is false. -; So, first we check to see if there is a password on the directory. If not, -; we proceed to set the temporary DU to the specified directory. If there is -; a password, we check the current IF state. If it is false, we do not check -; passwords and pretend there was no password. However, we leave the current -; directory in effect. This will work properly in all but one rare -; circumstance. When the command is an 'OR' command with a reference to a -; passworded named directory (e.g., "OR EXIST SECRET:FN.FT"), the password -; will not be requested and the current directory will be used instead of the -; specified one. - - push bc ; Save requested drive/user - ld bc,8 ; Point to password in NDR - add hl,bc - ld a,(hl) ; Get first character of password - cp ' ' ; Is there a password? - - if fcp eq 0 ; If FCP not implemented ... - - call nz,passck ; Perform password checking if pw present - - else ;fcp ne 0 ; FCP implemented ... - - jr z,dirscan5 ; If no pw, skip ahead - call iftest ; Otherwise, test current IF state - pop bc ; Restore BC in case we return now - ret z ; If false IF in effect, fake success without - ; ..checking password (but TEMPDR/TEMPUSR not - ; ..set) - push bc ; Otherwise, save BC again - call passck ; Perform password checking - - endif ;fcp eq 0 - -dirscan5: - pop bc ; Restore requested drive/user - jr z,setdu ; If not bad password, set it up - ld a,(cmdstatfl) ; See if external invocation (disable - bit 3,a ; ..error handling if so) - ret nz ; Return NZ to show bad directory - ld a,ecbadpass ; Error code for bad password - jp error - - else ;not pwcheck - - pop hl ; Clean up stack - if accptdu ; If we cannot fall through, branch - jr setdu - endif ;accptdu - - endif ;pwcheck - - if not accptdu ; If NOT ACCPTDU, we have to supply code here -setdu: - ld (tempusr),bc - xor a ; Set Z to flag success - ret - endif ;not accptdu - - endif ;accptdir - -;----------------------------------------------------------------------------- - -; This code attempts to interpret the token in the FCB pointed to by register -; pair DE as a DU (drive/user) prefix. If it is successful, the drive and -; user values are stored in TEMPDR and TEMPUSR, the zero flag is set, and a -; value of zero is returned in register A. Otherwise the zero flag is reset -; and a nonzero value is returned in register A. -; -; The ADUENV option allows acceptance of the DU form to be controlled by the -; DUOK flag in the environment descriptor. An additional feature of this code -; when the ADUENV option is enabled is that a DU value is always accepted, -; even if DUOK is off and even if it is outside the normally allowed range, -; if it corresponds to a named directory with no password. The currently -; logged directory is unconditionally acceptable (if you got there once, you -; can stay as long as you like without further hassles). - - if accptdu ; Allow DU: form - -direrr: ; This code may do double duty for DIRSCAN - ; ..above -duerr: - xor a ; Return NZ to show failure - dec a - ret - -duscan: - ex de,hl ; Switch FCB pointer to HL - inc hl ; Point to first byte of file name in FCB - - ld bc,(curusr) ; Preset C to current user, B to current drive - ld a,(hl) ; Get possible drive specification - sub 'A' ; Otherwise convert to number 0..15 - jr c,duscan1 ; If < 0, leave B as is - cp 16 - jr nc,duscan1 ; If > 15, leave B as is - ld b,a ; Otherwise use value given - inc hl ; ..and point to next character - -duscan1: - inc b ; Shift drive to range 1..16 - ld a,(hl) ; Get possible user specification - cp ' ' - jr z,duscan2 ; If none present, leave C as is - push bc ; Save DU values in BC - call decimal1 ; Get specified decimal user number into BC - pop hl ; Restore values to HL - jr c,duerr ; Return NZ if invalid decimal conversion - ld a,b ; Get high byte of result - or a ; Make sure it is zero - ret nz ; If not, return NZ to show bad user number - ld b,h ; DU value is now in BC - -; If the specified directory is the currently logged directory, accept it -; even if it is out of range and/or password protected. - -duscan2: - ld hl,(curusr) ; Get current drive/user into HL - inc h ; Shift drive to range 1..16 - xor a ; Clear carry flag - sbc hl,bc ; Compare values - jr z,setdu - -; If the specified DU corresponds to a named directory with no password, or -; if WPASS is enabled so that password checking is not performed when the -; wheel byte is set, then accept it. - - if z3ndir ne 0 - - call du2dir ; See if there is a matching named directory - jr z,duscan3 ; If not, skip on - - if pwcheck ; If passwords are being checked... - - if wpass - ld a,(z3whl) ; Get wheel byte - or a ; If wheel byte set, skip checking passwords - jr nz,setdu ; ..and accept the DU values - endif ;wpass - - ld de,9 ; Advance to password - add hl,de - ld a,(hl) ; Get first character of password - cp ' ' - jr z,setdu ; If none, we have a valid DU - - else ;not pwcheck - - jr setdu ; Set the DU - - endif ;pwcheck - - endif ;z3ndir ne 0 - -duscan3: - if aduenv ; Check DUOK flag in ENV - ld a,(duokfl) ; Get flag - or a ; If DU not accepted - jr z,duerr ; ..skip over the DU scan - endif ;aduenv - - if duenv ; If getting max drive and user from ENV - ld hl,(maxdrenv) ; Get max drive into L and max user into H - ld a,l ; Test drive value - cp b - jr c,duerr - ld a,h ; Test user value - cp c - jr c,duerr - else ; Using fixed values of max DU - ld a,maxdisk - cp b - jr c,duerr - ld a,maxusr - cp c - jr c,duerr - endif ;duenv - -setdu: - ld (tempusr),bc - xor a ; Set Z to flag success - ret - - endif ; accptdu - -; End ZCPR33-3.Z80 - - page - -; ZCPR33-4.Z80 - -;============================================================================= -; -; G E N E R A L S U B R O U T I N E S S E C T I O N -; -;============================================================================= - - -;----------------------------------------------------------------------------- -; -; CHARACTER I/O BDOS ROUTINES -; -;----------------------------------------------------------------------------- - -; Get uppercase character from console (with ^S processing). Registers B, -; D, H, and L are preserved. The character is returned in A. - -conin: - ld c,1 ; BDOS conin function - call bdossave - ; Fall through to UCASE - -;-------------------- - -; Convert character in A to upper case. All registers except A are preserved. - -ucase: - and 7fh ; Mask out msb - cp 61h ; Less than lower-case 'a'? - ret c ; If so, return - cp 7bh ; Greater than lower-case 'z'? - ret nc ; If so, return - and 5fh ; Otherwise capitalize - ret - -;---------------------------------------- - -; Output CRLF - -crlf: - call print - db cr - db lf or 80h - ret - -;---------------------------------------- - -; Output character in A to the console. All registers are preserved. - -conout: - push de - push bc - ld c,2 ; BDOS conout function -output: ; Entry point for LCOUT below - ld e,a - call bdossave - pop bc - pop de - ret - -;---------------------------------------- - -; Print the character string immediately following the call to this routine. -; The string terminates with a character whose high bit is set or with a null. -; At entry point PRINTC the string is automatically preceded by a -; carriage-return-linefeed sequence. All registers are preserved except A. - -printc: - call crlf ; New line - -print: - ex (sp),hl ; Get pointer to string - call printhl ; Print string - ex (sp),hl ; Restore HL and set return address - ret - -;---------------------------------------- - -; Print the character string pointed to by HL. Terminate on character with -; the high bit set or on a null character. On return HL points to the byte -; after the last character displayed. All other registers except A are -; preserved. - -printhl: - ld a,(hl) ; Get a character - inc hl ; Point to next byte - or a ; End of string null? - ret z - push af ; Save flags - and 7fh ; Mask out msb - call conout ; Print character - pop af ; Get flags - ret m ; String terminated by msb set - jr printhl - - -;----------------------------------------------------------------------------- -; -; FILE I/O BDOS ROUTINES -; -;----------------------------------------------------------------------------- - -; Read a record from a file to be listed or typed - - if lton ; Only needed for LIST and TYPE functions - -readf: - ld de,tfcb - jr read - - endif ; lton - -;---------------------------------------- - -; Read a record from the command file named in CMDFCB - -readcmd: - ld de,cmdfcb - -; Read a record from file whose FCB is pointed to by DE - -read: - ld c,14h ; Read-sequential function - ; Fall through to BDOSSAVE - -;-------------------- - -; Call BDOS for read and write operations. The flags are set appropriately. -; The BC, DE, and HL registers are preserved. - -bdossave: - putreg - call bdos - getreg - or a ; Set flags -note: ; This return is used for NOTE command, too - ret - - -;----------------------------------------------------------------------------- -; -; MISCELLANEOUS BDOS ROUTINES -; -;----------------------------------------------------------------------------- - -; Set DMA address. At the entry point DEFLTDMA the address is set to the -; default value of 80H. At the entry point DMASET it is set to the value -; passed in the DE registers. - -defltdma: - ld de,tbuff -dmaset: - ld c,1ah - jr bdossave - -;---------------------------------------- - -; Log in the drive value passed in the A register (A=0). - -setdrive: - ld e,a - ld c,0eh - jr bdossave - -;---------------------------------------- - -; Open a file. At entry point OPENCMD the file is the one specified in -; CMDFCB, and the current record is set to zero. At entry point OPEN -; the file whose FCB is pointed to by DE is used. - -opencmd: - xor a ; Set current record to 0 - ld (cmdfcb+32),a - ld de,cmdfcb ; Command file control block - ; Fall through to open - -open: - ld c,0fh ; BDOS open function - ; Fall through to BDOSTEST - -;-------------------- - -; Invoke BDOS for disk functions. This routine increments the return code in -; register A so that the zero flag is set if there was an error. Registers -; BC, DE, and HL are preserved. - -bdostest: - call bdossave - inc a ; Set zero flag for error return - ret - -;---------------------------------------- - -; Close file whose FCB is pointed to by DE. - - if saveon or subon -close: - ld c,10h - jr bdostest - endif ;saveon or subon - -;---------------------------------------- - -; Search for first matching file. At entry point SRCHFST1 the first default FCB -; is used. At entry point SRCHFST the FCB pointed to by DE is used. - - if diron or eraon or renon or saveon -srchfst1: - ld de,tfcb ; Use first default FCB - endif ;diron or eraon or renon or saveon - -srchfst: - ld c,11h - jr bdostest - -;----------------------------------------------------------------------------- - -; Search for next matching file whose FCB is pointed to by DE. - - if diron or eraon ; Only needed by DIR and ERA functions -srchnxt: - ld c,12h - jr bdostest - endif ; diron or eraon - -;----------------------------------------------------------------------------- - -; Kill any submit file that is executing. - - if subon - -subkil: - ld hl,subflag ; Check for submit file in execution - ld a,(hl) - or a ; 0=no - ret z ; If none executing, return now - ; Kill submit file - xor a - ld (hl),a ; Zero submit flag - call setuser ; Log in user 0 - ld de,subfcb ; Delete submit file - ; ..by falling through to delete routine - - endif ; subon - -;-------------------- - -; Delete file whose FCB is pointed to by DE. - - if eraon or renon or saveon or subon -delete: - ld c,13h - jr bdossave - endif ;eraon or renon or saveon or subon - -;----------------------------------------------------------------------------- - -; Get and set user number. Registers B, D, H, and L are preserved. Register -; E is also preserved at entry point SETUSER1. - -getuser: - ld a,0ffh ; Get current user number -setuser: - ld e,a ; User number in E -setuser1: - ld c,20h ; Get/Set BDOS function - jr bdossave - - -;----------------------------------------------------------------------------- -; -; GENERAL UTILITY ROUTINES -; -;----------------------------------------------------------------------------- - - -; This subroutine checks to see if a program loaded at an address given by HL -; has a Z3ENV header. If the header is not present, the zero flag is reset. -; If it is present, the zero flag is set, and on return HL points to the -; environment-type byte and A contains that byte. - -z3chk: - ld de,z3env+3 ; Point to 'Z3ENV' string in ENV - inc hl ; Advance three bytes to possible program - inc hl ; ..header - inc hl - ld b,5 ; Characters to compare -z3chk1: ; Check for Z3 ID header - ld a,(de) ; Get character from ENV descriptor - cp (hl) ; Compare it to loaded file - ret nz ; Quit now if mismatch - inc hl ; If same, advance to next characters - inc de ; ..and continue comparing - djnz z3chk1 ; (flags not affected by DJNZ) - ld a,(hl) ; Return the environment type in A - ret ; Return Z if all 5 characters match - -;---------------------------------------- - -; Subroutine to skip over spaces in the buffer pointed to by HL. On return, -; the zero flag is set if we encountered the end of the line or a command -; separator character. - -sksp: - ld a,(hl) ; Get next character - inc hl ; Point to the following character - cp ' ' ; Space? - jr z,sksp ; If so, keep skipping - dec hl ; Back up to non-space - ; ..and fall through - -;-------------------- - -; Subroutine to check if character is the command separator or marks the end -; of the line. - -tsteol: - or a ; End of command line? - ret z ; Return with zero flag set - cp cmdsep ; Command separator? - ret ; Return with flag set appropriately - -;---------------------------------------- - -; Initialize complete FCB pointed to by DE - -initfcb: - xor a - ld (de),a ; Set default disk (dn byte is 0) - inc de ; Point to file name field - call ifcb ; Fill 1st part of FCB - ; Fall through to IFCB to run again - -;-------------------- - -; Initialize part of FCB whose file name field is pointed to by DE on entry. -; The file name and type are set to space characters; the EX, S2, RC, and the -; following CR (current record ) or DN (disk number) fields are set to zero. -; The S1 byte is set to the current user number. On exit, DE points to the -; byte at offset 17 in the FCB (two bytes past the record count byte). - -ifcb: - ld b,11 ; Store 11 spaces for file name and type - ld a,' ' - call fill - xor a - ld (de),a ; Set extent byte to zero - inc de - ld a,(curusr) - ld (de),a ; Set S1 byte to current user - inc de - ld b,3 ; Store 3 zeroes - xor a ; Fall thru to fill - -;-------------------- - -; Fill memory pointed to by DE with character in A for B bytes - -fill: - ld (de),a ; Fill with byte in A - inc de ; Point to next - djnz fill - ret - -;---------------------------------------- - -; Subroutine to display the 'no file' error message for the built-in -; commands DIR, ERA, LIST, TYPE, and/or REN. - - if diron or eraon - -prnnf: - call printc ; No file message - defb 'No Fil','e'+80h - ret - endif ; diron or eraon - -;---------------------------------------- - -; Calculate address of command table in package from Z3ENV. On entry, E -; contains the offset to the address of the package in the environment. On -; exit, DE points to the beginning of the package and HL points to the fifth -; byte (where the command table starts in the RCP and FCP modules). The zero -; flag is set on return if the package is not supported. - - if fcpenv or rcpenv or ndrenv -pkgoff: - ld hl,z3env ; Point to beginning of ENV descriptor - ld d,0 ; Make DE have offset - add hl,de ; ..and add it - ld a,(hl) ; Get low byte of package address - inc hl ; Point to high byte - ld h,(hl) ; ..and get it - ld l,a ; Move full address into HL - or h ; Set zero flag if no package - ld de,5 ; Offset to start of table - ex de,hl ; Preserve start address of package in DE - add hl,de ; Pointer to 5th byte of package in HL - ret ; Return with zero flag set appropriately - - endif ;fcpenv or rcpenv or ndrenv - -;---------------------------------------- - -; This subroutine checks to see if we are in a false IF state. If that is -; the case, the routine returns with the zero flag set. If there is not active -; IF state or if it is true, then the zero flag is reset. - - if fcp ne 0 ; Omit code if FCP not implemented - -iftest: - ld bc,(ifptrfl) ; Current IF pointer into C, IF status into B - ld a,c ; See if any IF in effect - or a - jr z,iftest1 ; Branch if no IF state is active - and b ; Mask the current IF status - ret -iftest1: - dec a ; Reset the zero flag - ret - - endif ;fcp ne 0 - -;---------------------------------------- - -; Print the command prompt with DU and/or DIR (but without any trailing -; character). This is also the code in which the current drive and user -; will be stored. The conditional assemblies are somewhat involved because -; of the possibilities of either or both of the DU or DIR forms being omitted -; from the prompt. - -prompt: - call crlf - - if incldu ; If drive/user in prompt - - ld hl,(curusr) ; Get current drive/user into HL - -; If INCLENV is enabled, the drive and user (DU) will be included in the -; prompt based on the state of the DUOK flag in the environment. If INCLENV -; is disabled, the DU form will always be included if INCLDU is on. - - if inclenv - ld a,(duokfl) ; If ENV disallows DU, - or a ; ..then don't show it in - jr z,prompt2 ; ..the prompt, either - endif ;inclenv - - ld a,h ; Get current drive - add a,'A' ; Convert to ascii A-P - call conout - ld a,l ; Get current user - - if supres ; If suppressing user # report for user 0 - or a - jr z,prompt2 - endif - - cp 10 ; User < 10? - jr c,prompt1 - - if highuser ; If allowing users 16..31 - - ld c,'0'-1 -prompt0: - inc c - sub 10 - jr nc,prompt0 - add a,10 - ld b,a - ld a,c - call conout - ld a,b - - else ;using only standard user numbers 0..15 - - sub 10 ; Subtract 10 from user number - push af ; Save low digit - call print ; Display a '1' for tens digit - defb '1' or 80h - pop af - - endif ;highuser - -prompt1: - add a,'0' ; Output 1's digit (convert to ascii) - call conout -prompt2: - endif ; incldu - - ; Display named directory - - if incldir - - if incldu - ld b,h ; Copy drive/user from HL to BC - ld c,l ; ..(saves a byte) - else - ld bc,(curusr) ; Get current drive and user into BC - endif ;incldu - - inc b ; Switch drive to range 1..16 - call du2dir ; See if there is a corresponding DIR form - ret z ; If not, return now - - if incldu ; Separate DU and DIR with colon - - if inclenv - ld a,(duokfl) ; If not displaying DU, then - or a ; ..don't send separator, either - ld a,':' ; Make the separator - call nz,conout ; ..and send if permitted - else - call print ; Put in colon separator - defb ':' or 80h - endif ;inclenv - - endif ; incldu - - ld b,8 ; Max of 8 chars in DIR name -prompt3: - inc hl ; Point to next character in DIR name - ld a,(hl) ; ..and get it - cp ' ' ; Done if space - ret z - call conout ; Print character - djnz prompt3 ; Count down - - endif ; incldir - - ret - -;----------------------------------------------------------------------------- - -; Subroutine to convert DU value in BC into pointer to a matching entry in -; the NDR. If there is no match, the routine returns with the zero flag set. -; If a match is found, the zero flag is reset, and the code returns with HL -; pointing to the byte before the directory name. - - if z3ndir ne 0 - -du2dir: - - if ndrenv ; If getting NDR address from environment - ld e,15h ; Offset to NDR in Z3ENV - call pkgoff ; Get address of NDR into DE - ex de,hl ; ..and switch into HL - ret z ; If no NDR, return with zero flag set - jr du2dir2 - else - ld hl,z3ndir-17 ; Scan directory for match - endif ;ndrenv - -du2dir1: ; Advance to next entry in NDR - ld de,16+1 ; Skip user (1 byte) and name/pw (16 bytes) - add hl,de - -du2dir2: - ld a,(hl) ; End of NDR? - or a - ret z ; If so, return with zero flag set - - inc hl ; Point to user number in NDR entry - cp b ; Compare drive values - jr nz,du2dir1 ; If mismatch, back for another try - ld a,(hl) ; Get user number - sub c ; ..and compare - jr nz,du2dir1 ; If mismatch, back for another try - dec a ; Force NZ to show successful match - ret - - endif ;z3ndir ne 0 - -;----------------------------------------------------------------------------- - -; This routine gets the next line of input for the command buffer. The -; following order of priority is followed: -; If ZEX is active, the next line is obtained from ZEX -; If a submit file is running, its last record provides the input -; If there is a command line on the shell stack, use it -; Finally, if none of the above, the input is obtained from the user - -readbuf: - - ld a,(zexrunfl) ; Get ZEX-running flag - or a - jr nz,userinput ; If ZEX running, go directly to user input - - if subon ; If submit facility is enabled, check for it - - ld a,(subflag) ; Test for submit file running - or a - jr z,shellinput ; If not, go on to possible shell input - - xor a ; Log into user 0 - call setuser - call defltdma ; Initialize DMA pointer - ld de,subfcb ; Point to submit file FCB - call open ; Try to open file - jr z,readbuf1 ; Branch if open failed - - ld hl,subfrc ; Point to record count in submit FCB - ld a,(hl) ; Get the number of records in file - dec a ; Reduce to number of last record - ld (subfcr),a ; ..and put into current record field - call read ; Attempt to read submit file - jr nz,readbuf1 ; Branch if read failed - - dec (hl) ; Reduce file record cound - dec hl ; Point to S2 byte of FCB (yes, this is req'd!) - ld (hl),a ; Stuff a zero in there (A=0 from call to READ) - call close ; Close the submit file one record smaller - jr z,readbuf1 ; Branch if close failed - -; Now we copy the line read from the file into the multiple command line -; buffer - - ld de,chrcnt ; Point to command length byte in command buffer - ld hl,tbuff ; Point to sector read in from submit file - - if buflen gt 7fh ; If command line buffer is longer than record, - ld bc,80h ; ..then copy entire record from $$$.SUB file - else ;buflen le 7fh ; Otherwise copy only enough to fill - ld bc,buflen+1 ; ..the command line buffer - endif ;buflen gt 7fh - - ldir ; Transfer line from submit file to buffer - -; We now deal with various options that control the display of commands fed -; to the command processor from a submit file. - - if subnoise gt 0 ; If subnoise = 0 we omit all this display code - - if subnoise eq 1 ; If subnoise = 1 we follow the quiet flag - ld a,(quietfl) - or a - jr nz,readbuf0 ; If quiet, skip echoing the command - endif ;subnoise eq 1 - - call prompt ; Print prompt - call print ; Print submit prompt trailer - defb sprmpt or 80h - ld hl,cmdlin ; Print command line - call printhl - - endif ;subnoise gt 0 - -readbuf0: - call break ; Check for abort (any char) - ret nz ; If no ^C, return to caller and run - -readbuf1: - call subkil ; Kill submit file and abort - jp restart ; Restart CPR - - endif ; subon - -shellinput: - ld hl,shstk ; Point to shell stack - ld a,(hl) ; Check first byte - cp ' '+1 ; See if any entry - jr c,userinput ; Get user input if none - - ld de,cmdlin ; Point to first character of command line - ld bc,shsize ; Copy shell line into command line buffer - ldir ; Do copy - ex de,hl ; HL points to end of line - ld a,1 ; Set command status flag to show - ld (cmdstatfl),a ; ..that a shell has been invoked - jr readbuf3 ; Store ending zero and exit - -userinput: - call prompt ; Print prompt - call print ; Print prompt trailer - defb cprmpt or 80h - ld c,0ah ; Read command line from user - ld de,bufsiz ; Point to buffer size byte of command line - call bdos - - ; Store null at end of line - - ld hl,chrcnt ; Point to character count - ld a,(hl) ; ..and get its value - inc hl ; Point to first character of command line - call addah ; Make pointer to byte past end of command line -readbuf3: - ld (hl),0 ; Store ending zero - ret - -;----------------------------------------------------------------------------- - -; Check for any character from the user console. Return with the character -; in A. If the character is a control-C, then the zero flag will be set. - - if subon or diron or eraon or lton - -break: - ld c,0bh ; BDOS console status function - call bdossave ; Call BDOS and set flags - call nz,conin ; Get input character if there is one - cp 'C'-'@' ; Check for abort - ret - - endif ; subon or diron or eraon or lton - -;----------------------------------------------------------------------------- - -; Add A to HL (HL=HL+A) - -addah: - add a,l - ld l,a - ret nc - inc h - ret - -;----------------------------------------------------------------------------- - -; The routine NUMBER evaluates a string in the first FCB as either a decimal -; or, if terminated with the NUMBASE hexadecimal marker, a HEX number. If the -; conversion is successful, the value is returned as a 16-bit quantity in BC. -; If an invalid character is encountered in the string, the routine returns -; with the carry flag set and HL pointing to the offending character. - - if saveon - -number: - ld hl,tfcb+8 ; Set pointer to end of number string - ld bc,8 ; Number of characters to scan - ld a,numbase ; Scan for HEX identifier - cpdr ; Do the search - jr nz,decimal ; Branch if HEX identifier not found - - inc hl ; Point to HEX marker - ld (hl),' ' ; Replace HEX marker with valid terminator - ; ..and fall through to HEXNUM - - endif ;saveon - -;---------------------------------------- - -; At this entry point the character string in the first default FCB is -; converted as a hexadecimal number (there must NOT be a HEX marker). - -hexnum: - ld hl,tfcb+1 ; Point to string in first FCB - -; At this entry point the character string pointed to by HL is converted -; as a hexadecimal number (there must be NO HEX marker at the end). - -hexnum1: - ld de,16 ; HEX radix base - jr radbin ; Invoke the generalized conversion routine - -;---------------------------------------- - -; This entry point performs decimal conversion of the string in the first -; default FCB. - -decimal: - ld hl,tfcb+1 ; Set pointer to number string - -; This entry point performs decimal conversion of the string pointed to -; by HL. - -decimal1: - ld de,10 ; Decimal radix base - ; Fall through to generalized - ; ..radix conversion routine - -; This routine converts the string pointed to by HL using the radix passed in -; DE. If the conversion is successful, the value is returned in BC. HL points -; to the character that terminated the number, and A contains that character. -; If an invalid character is encountered, the routine returns with the carry -; flag set, and HL points to the offending character. - -radbin: - ld bc,0 ; Initialize result -radbin1: - or a ; Make sure carry is reset - call sdelm ; Test for delimiter (returns Z if delimiter) - ret z ; Return if delimiter encountered - - sub '0' ; See if less than '0' - ret c ; Return with carry set if so - cp 10 ; See if in range '0'..'9' - jr c,radbin2 ; Branch if it is valid - cp 'A'-'0' ; Bad character if < 'A' - ret c ; ..so we return with carry set - sub 7 ; Convert to range 10..15 -radbin2: - cp e ; Compare to radix in E - ccf ; Carry should be set; this will clear it - ret c ; If carry now set, we have an error - - inc hl ; Point to next character - push bc ; Push the result we are forming onto the stack - ex (sp),hl ; Now HL=result, (sp)=source pointer - call mpy16 ; HLBC = previous$result * radix - ld h,0 ; Discard high 16 bits and - ld l,a ; ..move current digit into HL - add hl,bc ; Form new result - ld c,l ; Move it into BC - ld b,h - pop hl ; Get string pointer back - jr radbin1 ; Loop until delimiter - -;----------------------------------------------------------------------------- - -; This routine multiplies the 16-bit values in DE and HL and returns the -; 32-bit result in HLBC (HL has high 16 bits; BC has low 16 bits). Register -; pair AF is preserved. - -mpy16: - ex af,af' ; Save AF - ld a,h ; Transfer factor in HL to A and C - ld c,l - ld hl,0 ; Initialize product - ld b,16 ; Set bit counter - rra ; Shift AC right so first multiplier bit - rr c ; ..is in carry flag -mp161: - jr nc,mp162 ; If carry not set, skip the addition - add hl,de ; Add multiplicand -mp162: - rr h ; Rotate HL right, low bit into carry - rr l - rra ; Continue rotating through AC, with - rr c ; ..next multiplier bit moving into carry - djnz mp161 ; Loop through 16 bits - - ld b,a ; Move A to B so result is in HLBC - ex af,af' ; Restore original AF registers - ret - -;----------------------------------------------------------------------------- - -; This routine checks for a delimiter character pointed to by HL. It returns -; with the character in A and the zero flag set if it is a delimiter. All -; registers are preserved except A. - -sdelm: - ld a,(hl) ; Get the character - exx ; Use alternate register set (shorter code) - ld hl,deldat ; Point to delimiter list - ld bc,delend-deldat; Length of delimiter list - cpir ; Scan for match - exx ; Restore registers - ret ; Returns Z if delimiter - -deldat: ; List of delimiter characters - db ' ' - db '=' - db '_' - db '.' - db ':' - db ';' - db '<' - db '>' - db ',' - db 0 - if cmdsep ne ';' - db cmdsep - endif ;cmdsep ne ';' -delend: - -;----------------------------------------------------------------------------- - -; Log into DU contained in FCB pointed to by DE. Registers DE are preserved; -; all others are changed. Explicit values for the temporary drive and user -; are extracted from the FCB. If the record-count byte has an FF in it, that -; is a signal that the directory specification was invalid. We then invoke -; the error handler. - - if diron or eraon or lton or renon or saveon - -fcblog: - push de ; Save pointer to FCB - ex de,hl - ld a,(hl) ; Get drive - ld bc,13 ; Offset to S1 field - add hl,bc - ld c,(hl) ; Get user into C - or a ; See if drive value was 0 - jr nz,fcblog1 ; If not, branch ahead - ld a,(curdr) ; Otherwise substitute current drive - inc a ; ..shifted to range 1..16 -fcblog1: - ld b,a ; Get drive into B - ld (tempusr),bc ; Set up temporary DU values - call logtemp ; ..and log into it - pop de ; Restore pointer to FCB - -; Now check to make sure that the directory specification was valid. - - inc hl ; Advance pointer to record-count byte - inc hl - ld a,(hl) ; See if it is nonzero - or a - jp nz,baddirerr ; If so, invoke error handler - - ret ; Otherwise return - - endif ;diron or eraon or lton or renon or saveon - -;----------------------------------------------------------------------------- - -; Log into the temporary directory. Registers B, H, and L are preserved. - -logtemp: - ld de,(tempusr) ; Set D = tempdr, E = tempusr - call setuser1 ; Register D is preserved during this call - ld a,d ; Move drive into A - dec a ; Adjust for drive range 0..15 - jp setdrive ; Log in new drive and return - -;----------------------------------------------------------------------------- - -; This routine scans the command table pointed to by HL for the command name -; stored in the command FCB. If the command is not found, the routine returns -; with the zero flag reset. If the command is found, the address vector is -; stored in EXECADR and the zero flag is set. - -cmdscan: - ld b,(hl) ; Get length of each command - inc hl ; Point to first command name - -scannext: - ld a,(hl) ; Check for end of table - or a - jr z,scanend ; Branch if end - - ld de,cmdfcb+1 ; Point to name of requested command - push bc ; Save size of commands in table - - if wheel - ; Ignore commands with high bit set in first - ; ..char of command name if wheel is false - ld a,(z3whl) ; Get the wheel byte - or a - ld c,0ffh ; Make a mask that passes all characters - jr z,scancmp ; Use this mask if wheel not set - - endif ; wheel - - ld c,7fh ; Use mask to block high bit if wheel set - ; ..or not in use - -scancmp: - ld a,(de) ; Compare against table entry - - xor (hl) - and c ; Mask high bit of comparison - jr nz,scanskip ; No match, so skip rest of command name - - inc de ; Advance to next characters to compare - inc hl - res 7,c ; Mask out high bit on characters after first - djnz scancmp ; Count down - - ld a,(de) ; See if next character in input command - cp ' ' ; ..is a space - jr nz,scanbad ; If not, user command is longer than commands - ; ..in the command table - - ; Matching command found - - pop bc ; Clear stack - ld a,(hl) ; Get address from table into HL - inc hl - ld h,(hl) - ld l,a - ld (execadr),hl ; Set execution address - xor a ; Set zero flag to show that command found - ret - -scanskip: - inc hl ; Skip to next command table entry - djnz scanskip - -scanbad: - pop bc ; Get back size of each command - inc hl ; Skip over address vector - inc hl - jr scannext ; Try scanning next entry in table - -scanend: - xor a ; Reset zero flag to show - dec a ; ..that command was not found - ret - -; End ZCPR33-4.Z80 - - page - -; ZCPR33-5.Z80 - -;============================================================================= -; -; R E S I D E N T C O M M A N D C O D E -; -;============================================================================= - -; Command: DIR -; Function: To display a directory of the files on disk -; Forms: -; DIR Displays the DIR-attribute files -; DIR Same as DIR *.* -; DIR S Displays the SYS-attribute files -; DIR /S Same as DIR *.* S -; DIR A Display both DIR and SYS files -; DIR /A Same as DIR *.* A - - if diron - -dir: - ld de,tfcb ; Point to target FCB - push de ; ..and save the pointer for later - inc de ; Point to file name - ld a,(de) ; Get first character - - if slashfl ; If allowing "DIR /S" and "DIR /A" formats - cp '/' ; If name does not start with '/' - jr nz,dir1 ; ..branch and process normally - inc de ; Point to second character - ld a,(de) ; Get option character after slash - ld (tfcb2+1),a ; ..and put it into second FCB - dec de ; Back to first character - ld a,' ' ; Simulate empty FCB - endif ;slashfl - -dir1: - cp ' ' ; If space, make all wild - jr nz,dir2 - ld b,11 - ld a,'?' - call fill - -dir2: - pop de ; Restore pointer to FCB - call fcblog ; Log in the specified directory - - if whldir - ld a,(z3whl) ; Check wheel status - or a ; If not set, then ignore options - jr z,dir2a - endif ;whldir - - ld a,(tfcb2+1) ; Check for any option letter - ld b,1 ; Flag for both DIR and SYS files - cp allchar ; See if all (SYS and DIR) option letter - jr z,dirpr ; Branch if so - dec b ; B = 0 for SYS files only - cp syschar ; See if SYS-only option letter - jr z,dirpr ; Branch if so -dir2a: - ld b,80h ; Flag for DIR-only selection - ; Drop into DIRPR to print directory - - endif ; diron - -;-------------------- - -; Directory display routine - -; On entry, if attribute checking is required, the B register is -; set as follows: -; 00H for SYS files only -; 80H for DIR files only -; 01H for both - - if diron or eraon - -dirpr: - if diron ; Attribute checking needed only for DIR - ld a,b ; Get flag - ld (systst),a ; Set system test flag - endif - - ld e,0 ; Set column counter to zero - push de ; Save column counter (E) - call srchfst1 ; Search for specified file (first occurrence) - jr nz,dir3 - call prnnf ; Print no-file message - pop de ; Restore DE - xor a ; Set Z to show no files found - ret - -; Entry selection loop. On entering this code, A contains the offset in the -; directory block as returned by the search-first or search-next call. - -dir3: - if diron ; Attribute checking needed only for DIR cmd - - call getsbit ; Get and test for type of files - jr z,dir6 - - else ;not diron - - dec a ; Adjust returned value from 1..4 to 0..3 - rrca ; Multiply by 32 to convert number to - rrca ; ..offset into TBUFF - rrca - ld c,a ; C = offset to entry in TBUFF - - endif ;diron - - pop de ; Restore count of - ld a,e ; ..entries displayed - inc e ; Increment entry counter - push de ; Save it - and 03h ; Output CRLF if 4 entries printed in line - jr nz,dir4 - call crlf ; New line - jr dir5 -dir4: - call print - - if wide - - defb ' ' ; 2 spaces - defb fence ; Then fence char - defb ' ',' '+80h ; Then 2 more spaces - - else ;not wide - - defb ' ' ; Space - defb fence ; Then fence char - defb ' '+80h ; Then space - - endif ; wide - -dir5: - ld a,1 - call dirptr ; HL now points to 1st byte of file name - call prfn ; Print file name -dir6: - call break ; Check for abort - jr z,dir7 - call srchnxt ; Search for next file - jr nz,dir3 ; Continue if file found - -dir7: - pop de ; Restore stack - dec a ; Set NZ flag - ret - - endif ; diron or eraon - -;----------------------------------------------------------------------------- - - if diron or attchk or eraon - -; This routine returns a pointer in HL to the directory entry in TBUFF that -; corresponds to the offset specified in registers C (file offset) and C -; (byte offset within entry). - -dirptr: - ld hl,tbuff - add a,c ; Add the two offset contributions - call addah ; Set pointer to desired byte - ld a,(hl) ; Get the desired byte - ret - - endif ; diron or attchk or eraon - -;----------------------------------------------------------------------------- - -; Test File in FCB for existence, ask user to delete if so, and abort if he -; choses not to - - if saveon or renon - -extest: - ld de,tfcb ; Point to FCB - push de ; ..and save it for later - call fcblog ; Log into specified directory - call srchfst1 ; Look for specified file - pop de ; Restore pointer - ret z ; OK if not found, so return - call printc - if bellfl - defb bell - endif ;bellfl - defb 'Erase',' '+80h - ld hl,tfcb+1 ; Point to file name field - call prfn ; Print it - call print ; Add question mark - defb '?' or 80h - call conin ; Get user response - cp 'Y' ; Test for permission to erase file - jp nz,restart ; If not, flush the entire command line - jp delete ; Delete the file - - endif ; saveon or renon - -;----------------------------------------------------------------------------- - -; Print file name pointed to by HL - - if diron or renon or saveon - -prfn: - ld b,8 ; Display 8 characters in name - call prfn1 - call print ; Put in dot - defb '.' or 80h - ld b,3 ; Display 3 characters in type -prfn1: - ld a,(hl) ; Get character - inc hl ; Point to next - call conout ; Print character - djnz prfn1 ; Loop through them all - ret - - endif ;diron or renon or saveon - -;----------------------------------------------------------------------------- - -; This routine returns NZ if the file has the required attributes and Z if -; it does not. It works by performing the 'exclusive or' of the mask passed -; in register A and the filename attribute obtained by masking out all but -; the highest bit of the character. For the 'both' case, setting any bit -; in the mask other than bit 7 will guarantee a nonzero result. -; -; File name: : X 0 0 0 0 0 0 0 (After 80H mask, X=1 if SYS, 0 if DIR) -; -; SYS-ONLY : 0 0 0 0 0 0 0 0 (XOR gives 00H if X=0 and 80H if X=1) -; DIR-ONLY : 1 0 0 0 0 0 0 0 (XOR gives 80H if X=0 and 00H if X=1) -; BOTH : 0 0 0 0 0 0 0 1 (XOR gives 01H if X=0 and 81H if X=1) - - if diron or attchk - -getsbit: - dec a ; Adjust to returned value from 1..4 to 0..3 - rrca ; Multiply by 32 to convert number to - rrca ; ..offset into TBUFF - rrca - ld c,a ; Save offset in TBUFF in C - ld a,10 ; Add 10 to point to SYS attribute bit - call dirptr ; A = SYS byte - and 80h ; Look only at attribute bit -systst equ $+1 ; In-the-code variable - xor 0 ; If SYSTST=0, SYS only; if SYSTST=80H, DIR - ; ..only; if SYSTST=1, both SYS and DIR - ret ; NZ if OK, Z if not OK - - endif ;diron or attchk - -;----------------------------------------------------------------------------- - -; Command: REN -; Function: To change the name of an existing file -; Forms: REN = -; Notes: If either file spec is ambiguous, or if the source file does -; not exist, the error handler will be entered. If a file with -; the new name already exists, the user is prompted for deletion -; and ZEX is turned off during the prompt. - - if renon - -ren: - ld hl,tfcb ; Check for ambiguity in first file name - call ambchk - call fcblog ; Login to fcb - ld hl,tfcb2 ; Check for ambiguity in second file name - call ambchk - xor a ; Use current drive for 2nd file - ld (de),a - call srchfst ; Check for old file's existence - jr nz,ren0a ; Branch if file exists -jpnofile: - ld a,ecnofile ; Set error code for file not found - jp error ; ..and invoke error handler -ren0a: - call extest ; Test for file existence and return if not - ld b,12 ; Exchange new and old file names - push de ; Save pointer to FCB - ld hl,tfcb2 ; Point to FCB for old file name -ren0: - ld a,(de) ; Get character of old name - ld c,a ; ..into C register - ld a,(hl) ; Get character of new name - ld (de),a ; ..into place in old name - ld (hl),c ; Put character of old name into new name - inc hl ; Advance pointers - inc de - djnz ren0 - -; Perform rename function - - pop de ; Restore pointer to FCB - ld c,17h ; BDOS rename function - jp bdostest - - endif ;renon - -;----------------------------------------------------------------------------- - -; Command: ERA -; Function: Erase files -; Forms: -; ERA Erase specified files and dislay their names -; ERA I Display names of files to be erased and prompt for -; inspection before erase is performed. (Character 'I' -; is defined by INSPCH in Z33HDR.LIB; if it is ' ', then -; any character triggers inspection.) - - if eraon - -era: - if inspfl and eraok; 'I' flag and verification enabled? - ld a,(tfcb2+1) ; Get flag, if any, entered by user - ld (eraflg),a ; Save it in code below - endif ;erav and eraok - - ld de,tfcb ; Point to target FCB - call fcblog ; ..and log into the specified directory - - if diron or attchk ; Attribute checking only in these cases - ld b,1 ; Display all matching files - endif ;diron or attchk - - call dirpr ; Print directory of erased files - ret z ; Abort if no files - - if eraok ; Print prompt - - if inspfl ; Test verify flag - -eraflg equ $+1 ; Address of flag (in-the-code modification) - ld a,0 - cp inspch ; Is it an inspect option? - - if inspch ne ' ' ; If an explicit inspect character is specified - jr nz,era2 ; ..skip prompt if it is not that character - else ; If INSPCH is the space character - jr z,era2 ; ..then skip prompt only if FCB has a space - endif ;inspch ne ' ' - - endif ;inspfl - - call printc - defb 'OK to Erase','?'+80h - call conin ; Get reply - cp 'Y' ; Yes? - ret nz ; Abort if not - - endif ; eraok - -era2: - ld de,tfcb - jp delete ; Delete files and return - - endif ; Eraon - -;----------------------------------------------------------------------------- - -; Command: LIST -; Function: Print out specified file on the LST: device -; Forms: LIST Print file (No Paging) -; Notes: The flags which apply to TYPE do not take effect with LIST - - if lton - -list: - ld a,0ffh ; Turn on printer flag - jr type0 - -;----------------------------------------------------------------------------- - -; Command: TYPE -; Function: Print out specified file on the CON: Device -; Forms: TYPE Print file with default paging option -; TYPE P Print file with paging option reversed - -type: - xor a ; Turn off printer flag - -; Common entry point for LIST and TYPE functions - -type0: - ld (prflg),a ; Set printer/console flag - ld a,(tfcb2+1) ; Check for user page toggle ('P') option - ld (pgflg),a ; Save it as a flag in code below - ld hl,tfcb ; Point to target file FCB - call ambchk ; Check for ambiguous file spec (vectors to - ; ..error handler if so) - call fcblog ; Log into specified directory - call open ; Open the file - - if renon ; If REN on, share code - jr z,jpnofile - else ;not renon ; Otherwise repeat code here - ld a,ecnofile - jp z,error - endif ;renon - - call crlf ; New line - ld a,(crttxt0) ; Set line count using value from the - ; ..environment for CRT0 - inc a ; One extra the first time through - ld (pagcnt),a - ld bc,080h ; Set character position and tab count - ; (B = 0 = tab, C = 080h = char position) - -; Main loop for loading next block - -type2: - ld a,c ; Get character count - cp 80h ; If not end of disk record - jr c,type3 ; ..then skip - - call readf ; Read next record of file - ret nz ; Quit if end of file - - ld c,0 ; Reset character count - ld hl,tbuff ; Point to first character - -; Main loop for printing characters in TBUFF - -type3: - ld a,(hl) ; Get next character - and 7fh ; Mask out MSB - cp 1ah ; Check for end of file (^z) - ret z ; Quit if so - -; Output character to CON: or LST: device with tabulation - - cp cr ; If carriage return, - jr z,type4 ; ..branch to reset tab count - cp lf ; If line feed, then output - jr z,type4a ; ..with no change in tab count - cp tab ; If tab - jr z,type5 ; ..expand to spaces - -; Output character and increment character count - - call lcout ; Output character - inc b ; Increment tab count - jr type6 - -; Output CR and reset tab count - -type4: - ld b,0 ; Reset tab counter - -; Output LF and leave tab count as is - -type4a: - call lcout ; Output or - jr type6 - -; Process tab character - -type5: - ld a,' ' ; Space - call lcout - inc b ; Increment tab count - ld a,b - and 7 - jr nz,type5 ; Loop until column = n * 8 + 7 - -; Continue processing - -type6: - inc c ; Increment character count - inc hl ; Point to next character - push bc - call break ; Check for user abort - pop bc - ret z ; Quit if so - jr type2 ; Else back for more - -;-------------------- - -; Output character in A to console or list device depending on a flag. -; Registers are preserved. This code is used only by the LIST and TYPE -; commands. - -lcout: - push af ; Save character -prflg equ $+1 ; Pointer for in-the-code modification - ld a,0 ; ..to determine destination (CON or LST) - or a ; Z=type, NZ=list - jr z,lc1 - - ; Output to list device - - pop af ; Get character back - push de - push bc - ld c,5 ; LISTOUT function - jp output - - ; Output to console with paging - -lc1: - pop af ; Get character back - push af ; Save it again for page check - call conout ; Output to console - pop af ; Get character back again - cp lf ; Check for new line (paging) - ret nz ; If not new line, we are done - - ; Paging routines - -pager: - push hl - ld hl,pagcnt ; Decrement lines remaining on screen - dec (hl) - jr nz,pager1 ; Jump if not end of page - - ; New page - ld a,(crttxt0) ; Get full page count from environment - ld (hl),a ; Reset count to a full page -pgflg equ $+1 ; Pointer to in-the-code buffer pgflg - ld a,0 - cp pagech ; Page default override option wanted? - - if pagech ne ' ' ; If using explicit character for page toggle - - if pagefl ; If paging is default - jr z,pager1 ; ..PAGECH means no paging - else ; If paging not default - jr nz,pager1 ; ..PAGECH means please paginate - endif ;pagefl - - else ; Any character toggles paging - - if pagefl ; If paging is default - jr nz,pager1 ; ..any character means no paging - else ; If paging not default - jr z,pager1 ; ..any character means please paginate - endif ;pagefl - - endif ;pagech ne ' ' - - ; End of page - push bc - call bios+9 ; Wait for user input (BIOS console input) - pop bc - cp 'C'-'@' ; Did user enter control-c? - jp z,nextcmd ; If so, terminate this command - -pager1: - pop hl ; Restore HL - ret - - endif ; lton - -;----------------------------------------------------------------------------- - -; Command: SAVE -; Function: To save the contents of the TPA onto disk as a file -; Forms: -; SAVE -; Save specified number of pages (starting at 100H) from TPA -; into specified file -; -; SAVE -; Like SAVE above, but numeric argument specifies -; number of sectors rather than pages - - if saveon - -; Entry point for SAVE command - -save: - call number ; Extract number from command line - jr c,badnumber ; Invoke error handler if bad number - push bc ; Save the number - call reparse ; Reparse tail after number of sectors/pages - pop hl ; Get sector/page count back into HL - ld a,(tfcb2+1) ; Check sector flag in second FCB - cp sectch - - if sectch ne ' ' ; If using a specific character, then jump - jr z,save0 ; ..if it is that character - else ; If allowing any character (SECTCH=' ') - jr nz,save0 ; ..jump if it is anything other than space - endif ;sectch ne ' ' - - add hl,hl ; Double page count to get sector count -save0: - ld a,1 ; Maximum allowed value in H - cp h ; Make sure sector count < 512 (64K) - jr c,badnumber ; If >511, invoke error handler - - push hl ; Save sector count - ld hl,tfcb - call ambchk ; Check for ambiguous file spec (vectors to - ; ..error handler if so) - - call extest ; Test for existence of file and abort if so - ld c,16h ; BDOS make file function - call bdostest - jr z,save3 ; Branch if error in creating file - - pop bc ; Get sector count into BC - ld hl,tpa-80h ; Set pointer to one record before TPA - -save1: - ld a,b ; Check for BC = 0 - or c - dec bc ; Count down on sectors (flags unchanged, - ; ..B=0FFH if all records written successfully) - jr z,save2 ; If BC=0, save is done so branch - - push bc ; Save sector count - ld de,80h ; Advance address by one record - add hl,de - push hl ; Save address on stack - ex de,hl ; Put address into DE for BDOS call - call dmaset ; Set DMA address for write - ld de,tfcb ; Write sector - ld c,15h ; BDOS write sector function - call bdossave - pop hl ; Get address back into HL - pop bc ; Get sector count back into BC - jr z,save1 ; If write successful, go back for more - - ld b,0 ; B=0 if write failed - -save2: - call close ; Close file even if last write failed - and b ; Combine close return code with - ; ..write success flag - ret nz ; Return if all ok - -save3: ; Disk must be full - ld a,ecdiskfull ; Disk full error code - jr jperror - - endif ; saveon - -;----------------------------------------------------------------------------- - - if lton or saveon or renon or geton - -; Check file control block pointed to by HL for any wildcard characters ('?'). -; Return to calling program if none found. Otherwise branch to error handler. -; The routine also treats an empty file name as ambiguous. - -ambchk: - push hl ; Save pointer to FCB - inc hl ; Point to first character in file name - ld a,(hl) ; See if first character is a space - cp ' ' - jr z,ambchk1 ; If so, branch to error return - - ld a,'?' ; Set up for scan for question mark - ld bc,11 ; Scan 11 characters - cpir - pop de ; Restore pointer to FCB in DE - ret nz ; Return if no '?' found -ambchk1: - ld a,ecambig ; Error code for ambiguous file name - jr jperror - - endif ;lton or renon or saveon or geton - - if lton or renon or saveon or geton or jumpon - -badnumber: - ld a,ecbadnum ; Error code for bad number value -jperror: ; Local entry point for relative jump - jp error ; ..to go to error handler - - endif ;lton or renon or saveon or geton or jumpon - -;----------------------------------------------------------------------------- - -; Command: JUMP -; Function: To execute a program already loaded into some specified memory -; address -; Forms: JUMP -; The address is in hex; the tail will be parsed as usual - - if jumpon - -jump: - call hexnum ; Get load address into BC - jr c,badnumber ; If bad number, invoke error handling - push bc ; ..and save it - call reparse ; Reparse tail after address value - pop hl ; Restore execution address to HL - jr getproglf ; Perform call via code below - - endif ;jumpon - -;----------------------------------------------------------------------------- - -; Command: GO -; Function: To Call the program in the TPA without loading -; loading from disk. Same as JUMP 100H, but much -; more convenient, especially when used with -; parameters for programs like STAT. Also can be -; allowed on remote-access systems with no problems. -; -;Form: GO - - if goon - -go: - ld hl,tpa ; Set up TPA as the execution address - - endif ; goon - - if jumpon or goon ; Common code - -getproglf: - ld (execadr),hl - xor a ; Set zero flag to enable leading CRLF - jp callproglf ; Perform call (with leading CRLF) - - endif ;jumpon or goon - -;----------------------------------------------------------------------------- - -; Command: GET -; Function: To load the specified file from disk to the specified address -; Forms: GET -; Loads the specified file to the specified hexadecimal address -; Note that the normal file search path is used to find the file. -; If SCANCUR is off, the file may not be found in the current -; directory unless a colon is included in the file spec. - - if geton - -get: - -; TMPCOLON was set when the file name was parsed. We use that as the colon -; flag so that the file will be loaded from a directory just as if it had -; been entered as the command name. - - if drvprefix and [not scancur] - ld a,(tmpcolon) ; Allow GET to load from specified - ld (colon),a ; directory - endif ;drvprefix and [not scancur] - - ld hl,tfcb2 ; Copy TFCB2 to CMDFCB for load - push hl - ld de,cmdfcb - ld bc,14 - ldir - pop hl - call ambchk ; Make sure file is not ambiguous (vectors - ; ..to error handler if so) - -; If GET fails to find the specified file along the search path, we do not -; want the ECP to be engaged. To prevent that, we fool the command processor -; by telling it that the ECP is already engaged. - - ld hl,cmdstatfl ; Point to command status flag - set 2,(hl) ; Turn on ECP flag to prevent use of ECP - call hexnum ; Get load address into BC - jr c,badnumber ; If invalid number, invoke error handler - - if not fullget - ld a,b ; If trying to load into base page - or a ; ..treat as error - jr z,badnumber - endif ;not fullget - - ld h,b ; Move address into HL - ld l,c - ld a,0ffh ; Disable dynamic loading - ; Fall through to mload - - endif ; geton - -; End ZCPR33-5.Z80 - - page - -; ZCPR33-6.Z80 - -;============================================================================= -; -; P A T H S E A R C H A N D F I L E L O A D I N G C O D E -; -;============================================================================= - -; This block of code loads a file into memory. The normal address at which -; loading is to begin is passed to the routine in the HL register. The name -; of the file to load is passed in the command file control block. -; -; This code supports an advanced option that loads files to a dynamic address -; specified in the header to the file using a new type-3 environment. In a -; type-3 environment, the execution/load address is stored in the word -; following the environment descriptor address. A value is passed to MLOAD in -; the A register that controls this dynamic loading mechanism. The value -; specifies the lowest environment type value for which dynamic loading will -; be performed. This value will be 3 when MLOAD is called for normal COM file -; execution and will be 0FFH when chained to from the GET command. In the -; latter case, the user-specified load address must be used. -; -; MLOAD guards against loading a file over the operating system. It computes -; the lower of the following two addresses: 1) the CPR entry point; 2) the -; bottom of protected memory as indicated by the DOS entry address stored at -; address 0006H. If the load would exceed this limit, error handling is -; engaged (except for the GET command when FULLGET is enabled). - -mload: - ld (envtype),a ; Set up in-the-code modification below - ld (execadr),hl ; Set up execution/load address - call defltdma ; Set DMA address to 80H for file searches - - -; This code sets the attributes of COM files which are acceptable. If both -; SYS and DIR type files are acceptable, there is no need to include this code, -; and ATTCHK can be set to false. - - if attchk ; Only if attribute checking enabled - ld a,comatt ; Attributes specified in Z33HDR.LIB - ld (systst),a ; Set flag - endif ;attchk - -;----------------------------------------------------------------------------- - -; PATH BUILDING CODE - -; In ZCPR33 the minpath feature, optional in ZCPR30, is always used. To -; minimize the size of the CPR code, however, there is an option to place the -; minpath in an external buffer (outside the CPR). If the path is short -; enough, the minpath can be placed at the bottom of the system stack. - - ld de,path ; Point to first element in user's symbolic path - ld hl,mpath ; Point to minpath buffer - xor a - ld (hl),a ; Initialize to empty minpath - - -; If DRVPREFIX is enabled, the CPR will recognize an explicit directory -; reference in a command. The first element of the path will then be this -; explicit directory. If no explicit directory was given in the command, -; then no entry is made into the search path. If the WPREFIX option is -; on, explicit directory prefixes will be recognized only when the wheel -; byte is on. - - if drvprefix ; Pay attention to du:com prefix? - - ld a,(colon) ; See if colon was present in command - or a - jr z,makepath2 ; If not, skip ahead - - if wprefix - ld a,(z3whl) ; See if wheel byte is on - or a - jr z,makepath2 ; If not, skip ahead - endif ;wprefix - - ld a,(cmdfcb) ; Get drive from command FCB - ld (hl),a ; Put drive into minpath - inc hl ; Advance pointer - ld a,(cmdfcb+13) ; Get user number from command FCB - ld (hl),a ; Put it into minpath - inc hl ; Advance pointer to next path element - xor a ; A=0 - ld (hl),a ; Store ending 0 in mpath -makepath2: - endif ; drvprefix - - -; If SCANCUR is enabled in Z33HDR.LIB, then we always include the current -; directory automatically, even without a '$$' element in the user's path. -; If WPREFIX is enabled, however, we do not want to allow the current -; directory to be included, but we must make sure that it is included in -; the building of the root path, in case the user's symbolic path is empty. - - if scancur ; Scan current directory at all times? - - ld bc,(curusr) ; C = current user, B = current drive - inc b ; Set drive to range 1..16 - - if wprefix - - ld a,(z3whl) ; See if wheel byte is on - or a - jr nz,addpath ; If it is, add element to path; if not, - ; ..fall through to MAKEPATH3 - else ;not wprefix - - jr addpath ; Begin loop of placing entries into mpath - - endif ;wprefix - - else ;not scancur - -; If SCANCUR is off and ROOTONLY is in effect, we have to make sure that some -; directory values are put into the root path in the case where the user's -; path is completely empty. To do so, we preset BC for directory A0. - - if rootonly - ld bc,0100h ; Setup for drive A (B=1), user 0 (C=0) - endif ;rootonly - - endif ;scancur - - -; Convert symbolic entries in user's path into absolute DU values in minpath. -; Entries are read one-by-one from the symbolic path. If the 'current' drive -; or user indicator is present (default symbol is '$'), then the current -; drive or user value is fetched. Otherwise the explicit binary value from the -; path is used. After each absolute DU value is formed, the minpath as it -; exists so far is scanned to see if this DU value is already there. If it is -; not, then the DU value is appended to the path. Otherwise it is ignored. - -makepath3: - ld a,(de) ; Get next symbolic path entry - or a ; If 0, we are at end of path - jr z,makepath6 - - ld bc,(curusr) ; C = current user, B = current drive - inc b ; Set drive to range 1..16 - cp curind ; Check for current drive symbol (default '$') - jr z,makepath4 ; If so, leave current drive in B - ld b,a ; Else move specified drive into B -makepath4: - inc de ; Point to user value in symbolic path - ld a,(de) ; Get user - inc de ; Point to next element in symbolic path - cp curind ; Check for current user symbol (default '$') - jr z,makepath5 ; If so, leave current drive in C - ld c,a ; Else move specified user into C -makepath5: - -; At this point in the code we have a potential path element in BC. We first -; have to scan the minpath we have so far to see if that element is already -; there. In that case we ignore it; otherwise we add it to the end of the path. - -addpath: - ; Skip path if directory given explicitly - - if skippath - - if wprefix - ld a,(z3whl) ; See if wheel byte is on - or a - call nz,skipchk ; If not, fall through - else ;not wprefix - call skipchk ; See if path should be skipped - endif ;wprefix - - jr nz,makepath3 ; If so, branch out of ADDPATH - - endif ;skippath - - ld hl,mpath ; Point to beginning of minpath - -addpath1: ; Point of reentry - ld a,(hl) ; Get drive value - or a ; Check for end of minpath - jr z,addpath2 ; If end, jump and add BC to minpath - - inc hl ; Increment pointer to user - cp b ; Check for drive match - ld a,(hl) ; Get user from minpath - inc hl ; Point to next minpath entry - jr nz,addpath1 ; If drive was different, loop back again - cp c ; Check for user match - jr nz,addpath1 ; If user is different, loop back again - jr makepath3 ; Branch if we have a duplicate - -; We have a new DU; add it to minpath - -addpath2: - ld (hl),b ; Store drive - inc hl - ld (hl),c ; Store user - inc hl - ld (hl),0 ; Store ending 0 - jr makepath3 ; Continue scanning user's path - -; If the ECP facility is set up to use the root directory, then create a -; root path. BC presently contains the proper DU. - -makepath6: - - if rootonly - ld hl,rootpth ; Point to special path to contain root - ld (hl),b ; Store disk - inc hl - ld (hl),c ; Store user - endif ;rootonly - -;----------------------------------------------------------------------------- - -; This is the code for loading the specified file by searching the minpath. - - xor a ; Always use current disk specification in the - ld (cmdfcb),a ; ..command FCB - -mload1: - - ld hl,mpath ; Point to beginning of minpath - -mload2: - -; Either the FASTECP or BADDUECP option may have set FIRSTCHAR to a space -; character as a signal to go directly to extended command processing. If -; neither option is enabled but SKIPPATH is, then the FIRSTCHAR data is -; stored in the routine below where path skipping is implemented. - - if fastecp or badduecp - - ld a,(cmdstatfl) ; If ECP is running - bit 2,a ; ..we branch to look for ECP along path - jr nz,mload2a -firstchar equ $+1 ; Pointer for in-the-code modification - ld a,0 - cp ' ' ; Was command invoked with leading space? - jr z,ecprun ; If so, go directly to ECP code - - endif ;fastecp or badduecp - -mload2a: - ld a,(hl) ; Get drive from path - or a ; If end of path, command not found - jr nz,mload3 ; If not end of path, skip over ECP code - -;----------------------------------------------------------------------------- - -; EXTENDED COMMAND PROCESSING - -; At this point we have exhausted the search path. We now engage the -; extended command processor. - -ecprun: - if skippath - call skipchk ; See if path should be skipped - jr nz,jnzerror ; If so, invoke error handler - endif ;skippath - - ld hl,cmdstatfl ; Point to command status flag - ld a,(hl) ; ..and get value - and 110b ; Isolate ECP and error handler bits -jnzerror: ; If either is set, - ld a,ecnocmd ; Error code for command not found - jp nz,error ; ..process as an error - - set 2,(hl) ; Set ECP bit - - ld hl,ecpfcb ; Copy name of ECP to command FCB - ld de,cmdfcb - ld bc,12 ; Only 12 bytes required - ldir - - ld hl,(cmdptr) ; Get pointer to current command line - call parsetail ; Parse entire command as the command tail - - if rootonly ; Look for ECP in root directory only - ld hl,rootpth ; Point to path containing root directory only - jr mload2 ; Search for command - else ; not rootonly - jr mload1 ; Search the entire minpath for the ECP - endif ; rootonly - -;----------------------------------------------------------------------------- - -mload3: - ld b,a ; Drive into B - inc hl ; Point to user number - ld c,(hl) ; User into C - ld (tempusr),bc ; Save the values - inc hl ; Point to next entry in path - call logtemp ; Log in path-specified user/drive - - if attchk ; If allowing execution only of COM files with - ; ..specific attributes - - ld de,cmdfcb ; Point to command FCB - call srchfst ; Look for directory entry for file - jr z,mload2a ; Continue path search if file not found - push hl ; Save path pointer - call getsbit ; Check system attribute bit - pop hl ; Restore path pointer - jr z,mload2a ; Continue if attributes do not match - call opencmd ; Open file for input - jr z,mload2a ; If open failed, back to next path element - - else ;not attchk - - call opencmd ; Open file for input - jr z,mload2a ; If open failed, back to next path element - - endif ; attchk - - call readcmd ; Read first record into default DMA address - jr nz,mload5 ; Branch if zero-length file - xor a ; Set file current record back to zero - ld (cmdfcb+20h),a - ld hl,80h ; Pointer to start of code - call z3chk - jr nz,mload3a ; If not Z3 file, branch - -; The following test is modified by earlier code. For normal COM file loading, -; a 3 is inserted for the minimum environment type for dynamic load address -; determination. For the GET command, where the user-specified address should -; be used, a value of 0FFH is put in here so the carry flag will always be set. - -envtype equ $+1 ; Pointer for in-the-code modification - cp 3 ; See if no higher than a type-3 environment - jr c,mload3a ; If higher than type 3, branch - - inc hl ; Advance to load address word - inc hl - inc hl - ld a,(hl) ; Get load address into HL - inc hl - ld h,(hl) - ld l,a - ld (execadr),hl ; Set new execution/load address - -mload3a: - ld hl,(execadr) ; Get initial loading address - -; Load the file, making sure neither CPR nor protected memory is overwritten - -mload4: - if fullget - ld a,(envtype) ; If ENVTYPE is FF (from GET command) - inc a ; ..then skip memory limit checking - jr z,mload4b - endif ;fullget - - if rel - ld bc,entry ; We have to use a relocatable form to get - dec b ; ..highest page below the CPR - else ;not rel - ld b,high entry - 1 ; We can use shorter code for absolute form - endif ;rel - - ld a,(0007h) ; Get highest page below - dec a ; ..protected memory - cp b ; If A is lower value, - jr c,mload4a ; ..branch - ld a,b ; Otherwise use lower value in B -mload4a: - cp h ; Are we going to overwrite protected memory? - ld a,ectpafull ; Get ready with TPA overflow error code - jp c,error ; Error if about to overwrite protected memory -mload4b: - push hl ; Save this load address - ex de,hl ; Set DMA address - call dmaset - call readcmd - pop hl ; Get last load address back - jr nz,mload5 ; Read error or eof? - ld de,128 ; Increment load address by 128 - add hl,de - jr mload4 ; Continue loading - -; In case a program would like to find out in what directory the command -; processor found the program, temporary DU is stored in bytes 13 (user) and -; 14 (drive) in the command FCB. - -mload5: - -tempusr equ $+1 ; Pointers for in-the-code modification -tempdr equ $+2 - ld hl,0 - ld (cmdfcb+13),hl - -logcurrent: ; Return to original logged directory - ld hl,(curusr) ; Set L = current user, H = current drive - ld a,h - call setdrive ; Login current drive - ld a,l - jp setuser ; Log in new user and return from MLOAD - -;---------------------------------------- - -; This routine checks to see if building the path or running the ECP should -; be skipped. If there is a colon in the command (an explicit directory -; given) but it was not a lone colon (indicating desire to skip resident -; commands), then the routine returns with the zero flag reset. - - if skippath - -skipchk: - ld a,(colon) ; Was there a colon in the command? - or a - ret z ; Return with zero flag set if not - - if fastecp or badduecp - ld a,(firstchar) ; See if the first character was the colon - else -firstchar equ $+1 ; Put data here if other two options are - ld a,0 ; ..false (in-the-code modification) - endif ;fastecp or badduecp - - cp ':' - ret ; Return: Z if lone colon, NZ otherwise - - endif ;skippath - - -; End ZCPR33-6.Z80 - - page - -;----------------------------------------------------------------------------- -; -; D A T A A R E A D E F I N I T I O N S -; -;----------------------------------------------------------------------------- - -; ---------- Page line count buffer - - if lton ; Needed only if TYPE command included - -pagcnt: - defs 1 ; Lines left on page (filled in by code) - - endif ;lton - - -; ---------- Minpath/Rootpth buffers - - if extmpath - -mpath equ extmpathadr ; Assign external minpath address - - else - -mpath: - if drvprefix - defs 2 ; Two bytes for specified DU - endif - - if scancur - defs 2 ; Two bytes for current DU - endif - - defs 2 * expaths ; Space for path from path buffer - - defs 1 ; One byte for ending null - - endif ; not extmpath - - - if rootonly -rootpth: - defs 2 ; Special path for root dir only - defb 0 ; End of path - endif ; rootonly - -;----------------------------------------------------------------------------- - -; The following will cause an error message to appear if -; the size of ZCPR33 is over 2K bytes. - - if [ $ - entry ] gt 800h - *** ZCPR33 IS LARGER THAN 2K BYTES *** - endif - - endif ;errflag - - end ; ZCPR33 - \ No newline at end of file diff --git a/Source/BPBIOS/bank-dx.cnf b/Source/BPBIOS/bank-dx.cnf deleted file mode 100644 index 15f25911..00000000 --- a/Source/BPBIOS/bank-dx.cnf +++ /dev/null @@ -1,129 +0,0 @@ -; BPCNFG Configuration script for D-X Designs' P112, 256/512k RAM, 16/18 MHz -; - -;-- Submenu 1 allows changes to be made in miscellaneous system parameters - -1[ ; Start w/Base Menu, go to Submenu 1 - 2 START01, ; Use START01.COM alias file. Comma ends string. - ;; NOTE: While the original P112 plans call for a 16.000 MHz Crystal, - ;; more precise baud rate generation, plus a little extra speed - ;; is obtained by using a 18.432 MHz Crystal. - ;; Select one of the two following pairs, comment out the other -;; 4 18,, ; Set 18 MHz, Scale divisor (18.432 MHz recommended) -;; 3 46080, ; Explicitly set for 18*2560 - 4 16,, ; Set 16 MHz, Scale divisor (Crystal per Dave's plan) - 3 40000, ; Explicitly set for 16*2500 - 5 1, 2, ; Set Wait States: 9 MHz --> Memory = 0, IO = 1 - ; 18 MHz --> Memory = 1, IO = 2 - ;; The following configures the contiguous system RAM size and allocation. - ;; NOTE: This assumes 'bank' 0 occupied by image of Boot Flash ROM. - 6 Y ; "Hidden" Menu, "Y" acknowledging danger - 1 1, ; Base Bank of TPA - 2 3, ; First System Bank - 3 4, ; First User Bank - 4 5, ; First Bank of RAM Disk (Runs to Last) - 5 15,, ; Last RAM Bank (7=256k,15=512k, 31=1MB) - ] ; and back to main menu - -;-- Submenu 2 allows changes to be made to Character IO and IOByte Devices -; Insure that the Console (COM1) Baud rate is set to that of your terminal - -2[ ; Start w/Base Menu, go to Submenu 2 - 2 10,,,,,,,, ; Set COM1 (Console) to 9600 bps, default settings - 3 10,,,,,,,, ; Set COM2 to 9600 bps, default settings - ] ; and back to main menu - -;-- Submenu 3 allows changes to be made in the Floppy Drive physical parameters - -3[ ; Start w/Base Menu, go to Submenu 3 - 1 0 3, ; Set Drive, Unit 0 (3.5" Teac FDD 235-4xxx) - D Y H ; Double-Sided, Motor Needed, "High-Density" - 80, 3, 4, 240, ; 80 Trks, 3 mS Step, 4 mS Head Load, 240 mS Unload - 1 1 2, ; Set Drive, Unit 1, (5.25" Teac FD-55FGV) - D Y H ; Double-Sided, Motor Needed, "High-Density" - 80, 3, 4, 240, ; 80 Trks, 3 mS Step, 4 mS Head Load, 240 mS Unload - 1 3 2, ; Set Drive, Unit 3, (5.25" Teac FD-55B) - D Y S ; Double-Sided, Motor Needed, Standard Double-Density - 40, 4, 24, 240, ; 40 Trks, 4 mS Step, 24 mS Head Load, 240 mS Unload - ] - -;-- Submenu 4 allows changes to be made in Physical Hard Drive parameters - -4[ ; Start w/Base Menu, go to Submenu 4 -; Set SCSI Controller Type for this configuration as: -; 0 = Owl -; 1 = Adaptec ACB-4000A -; 2 = Xebec 1410a/Shugart 1610-3 -; 3 = Seagate SCSI -; 4 = Shugart 1610-4 (Minimal SCSI) -; 5 - Conner SCSI -; 6 - Quantum SCSI -; 7 - Maxtor SCSI -; 8 - Syquest SCSI -; 9 - GIDE (Generic IDE/ATA) - - ; Sample SCSI config. (Values of Trk/Hd/etc irrelevant) - 1 5 ; Configure Controller to Type #5 (Conner SCSI) - 2 Y 0, 0, ; Set Unit 0 Params, Activate, Unit 0, LUN 0 - 615, 4, 615, 615, ; Generic SCSI, 615 Trks, 4 Hds, RedWrt & Precomp @615 - ; Sample IDE config. NECESSARY if using GIDE. -; 1 9 ; Configure Controller to Type (9 = GIDE) -; 2 Y 0, ; Set Unit 0 Params, Activate, Device 0 (IDE Master) -; 988, 10, 17, ; Toshiba 2.5" MK1422 Emulates 988 Trks,10 Hds,17 SPT - ] - -;-- Submenu 5 allows changes to be made to Hard and RAM Disk Logical -;-- parameters, and exchanging of logical drives. - -5[ ; Starting w/Base menu, go to Submenu 5 - ; Since the initial assembly places Floppies in A-D, - ; swap them with the first four Hard Drive partitions. - ; NOTE Comment these out if you have no Hard Drive, or are - ; re-configuring an image that has them already swapped! - 1 A E ; swap floppies - 1 B F ; A-D with - 1 C G ; Hard Partitions - 1 D H ; E-H - - ; Configure the Hard Drive partitions. - 2 A ; Configure Partition A: - 4,1024, 2, 498,0, ; 4k Allocs, 1024 Dirs, Start @ 2, 498 Trks, Unit 0 - 2 B ; Partition B: - 4,1024, 500,750,0, ; 4k Allocs, 1024 Dirs, Start @ 500, 750 Trks, U 0 - 2 C ; Partition C: - 4,1024,1250, 750,0, ; 4k Allocs, 1024 Dirs, Start @ 1250, 750 Trks, U 0 - 2 D ; Partition D: - 4,1024,2000, 3206,0, ; 4k Allocs, 1024 Dirs, Start @ 2000, 3206 Trks, U 0 - - ; A second drive is often useful. Configure allocations here. - ; NOTE: the Bios must be assembled to activate these drives, or - ; BPCNFG will abort. - 2 O ; Partition O: (Backup Drive) - 4,1024, 2, 998,1, ; 4k Allocs, 1024 Dirs, Start @ 2, 1000 Trks, U 1 - 2 P ; Partition P: (Backup Drive) - 4,1024,1000,1620,1, ; 4k Allocs, 1024 Dirs, Start @ 1000, 1635 Trks, U 1 - - ; SUGGESTION: If you use the ZSDOS2 Hashed Directory feature, one way - ; is to build a primary partition with needed executables, then swap - ; it with the main A: drive, gaining the significantly faster access - ; and response. For example, if the hashed drive is the partition - ; at D:, to use it as A: simply uncomment the following. - -; 1 A D ; Swap Logical drives A: and D:. - - ; Configure the RAM Drive. - ; Each "Track" is a 4k increment, 8 "Tracks" per 32k memory bank. - ; Common memory complements for the P112 are 2-128k memory chips (256k), - ; 1-512k chip (512k), and 2-512k chips (1024k). If a User Bank is - ; defined, the space for RAM drive is reduced by 32k (8 'tracks). - 2 M ; Drive M: (RAM Disk) - 2, 128, 0, 88,0, ; 2k Allocs, 128 Dirs, Start @ 0, 88 Trks (352k), U 0 - ;------ Alternatives for 2x128k, 1x512k and 2x512k RAM Chips ------ - ; Alc #Dirs Start #Trks Unit Cap w/User Bank - ; 256k RAM : 2, 64, 0, 32, 0, (128k, 24= 96k) - ;NOTE: For 512k or More RAM, the Flash is copied to RAM - ; causing one 32k block to be unusable. - ; 512k RAM : 2, 128, 0, 96, 0, (384k, 88=352k) - ; Max w/1 MB RAM : 2, 256, 0, 224, 0, (896k, 216=864k) - ] - \ No newline at end of file diff --git a/Source/BPBIOS/boot-dx.cnf b/Source/BPBIOS/boot-dx.cnf deleted file mode 100644 index 1bfa09fe..00000000 --- a/Source/BPBIOS/boot-dx.cnf +++ /dev/null @@ -1,86 +0,0 @@ -; BPCNFG Configuration script for D-X Designs' P112 -; <--BOOT TRACK Version--> -;-- Submenu 1 allows changes to be made in miscellaneous system parameters - -1[ ; Start w/Base Menu, go to Submenu 1 -; 2 STARTUP, ; Uncomment and change name for custom startup script. - ; Comma ends string. - ;; NOTE: While the original P112 plans call for a 16.000 MHz Crystal, - ;; more precise baud rate generation, plus a little extra speed - ;; is obtained by using a 18.432 MHz Crystal. - ;; Select one of the two following pairs, comment out the other -;; 4 18,, ; Set 18 MHz, Scale divisor (18.432 MHz recommended) -;; 3 46080, ; Explicitly set for 18*2560 - 4 16,, ; Set 16 MHz, Scale divisor (Crystal per Dave's plan) - 3 40000, ; Explicitly set for 16*2500 - 5 1, 2, ; Set Wait States: 9 MHz --> Memory = 0, IO = 1 - ; 18 MHz --> Memory = 1, IO = 2 - ;; The following configures the contiguous system RAM size and allocation. - ;; NOTE: Memory configuration not needed in Boot version, commented out - ;; This layout assumes 'Bank' 0 occupied by image of Flash Boot ROM. -; 6 Y ; "Hidden" Menu, "Y" acknowledging danger -; 1 1, ; Base Bank of TPA -; 2 3, ; First System Bank -; 3 4, ; First User Bank -; 4 5, ; First Bank of RAM Disk (Extends to Last) -; 5 15,, ; Last RAM Bank (7=256k,15=512k, 31=1MB) - ] ; and back to main menu - -;-- Submenu 2 allows changes to be made to Character IO and IOByte Devices -; Insure that the Console (COM1) Baud rate is set to that of your terminal - -2[ ; Start w/Base Menu, go to Submenu 2 - 2 10,,,,,,,, ; Set COM1 (Console) to 9600 bps, default settings - 3 10,,,,,,,, ; Set COM2 to 9600 bps, default settings - ] ; and back to main menu - -;-- Submenu 3 allows changes to be made in the Floppy Drive physical parameters - -3[ ; Start w/Base Menu, go to Submenu 3 - 1 0 3, ; Set Drive, Unit 0 (3.5" Teac FDD 235-4xxx) - D Y H ; Double-Sided, Motor Needed, "High-Density" - 80, 4, 4, 240, ; 80 Trks, 4 mS Step, 4 mS Head Load, 240 mS Unload - 1 1 2, ; Set Drive, Unit 1 (5.25" Teac FDD 55FGV) - D Y H ; Double-Sided, Motor Needed, "High-Density" - 80, 4, 4, 240, ; 80 Trks, 4 mS Step, 4 mS Head Load, 240 mS Unload - ] - -;-- Submenu 4 allows changes to be made in Physical Hard Drive parameters - -4[ ; Start w/Base Menu, go to Submenu 4 -; Set SCSI Controller Type for this configuration as: -; 0 = Owl -; 1 = Adaptec ACB-4000A -; 2 = Xebec 1410a/Shugart 1610-3 -; 3 = Seagate SCSI -; 4 = Shugart 1610-4 (Minimal SCSI) -; 5 - Conner SCSI -; 6 - Quantum SCSI -; 7 - Maxtor SCSI -; 8 - Syquest SCSI -; 9 - GIDE (Generic IDE/ATA) - ; Sample SCSI config. (Values of Trk/Hd/etc irrelevant) - 1 5 ; Configure Controller to Type #5 (Conner SCSI) - 2 Y 0, 0, ; Set Unit 0 Params, Activate, Unit 0, LUN 0 - 615, 4, 615, 615, ; Generic SCSI, 615 Trks, 4 Hds, RedWrt & Precomp @615 - ; Sample IDE config. (All values NECESSARY if using GIDE). -; 1 9 ; Configure Controller to Type (9 = GIDE) -; 2 Y 0, ; Set Unit 0 Params, Activate, Device 0 (IDE Master) -; 988, 10, 17, ; Toshiba 2.5" MK1422 Emulates 988 Trks,10 Hds,17 SPT - ] - -;-- Submenu 5 allows changes to be made to Hard and RAM Disk Logical -;-- parameters, and exchanging of logical drives. - -5[ ; Starting w/Base menu, go to Submenu 5 - ; Configure the Hard Drive partitions. (Generally, Only two on Boot Disks) - 2 E ; Configure Partition E: - 4,1024, 2, 498,0, ; 4k Allocs, 1024 Dirs, Start @ 2, 498 Trks, Unit 0 - 2 F ; Partition F: - 4,1024, 500, 750,0, ; 4k Allocs, 1024 Dirs, Start @ 500, 750 Trks, U 0 - ; Swap first HD partitions with Floppies only if going to Hard on boot - ; (Comment out swaps for Floppy-only operation) -; 1 A E -; 1 B F - ] - \ No newline at end of file diff --git a/Source/BPBIOS/bp33.dat b/Source/BPBIOS/bp33.dat new file mode 100644 index 00000000..2d1678b5 Binary files /dev/null and b/Source/BPBIOS/bp33.dat differ diff --git a/Source/BPBIOS/bp33bnk.dat b/Source/BPBIOS/bp33bnk.dat new file mode 100644 index 00000000..e3e214c0 Binary files /dev/null and b/Source/BPBIOS/bp33bnk.dat differ diff --git a/Source/BPBIOS/bp33n.dat b/Source/BPBIOS/bp33n.dat deleted file mode 100644 index 8ec9a9c2..00000000 Binary files a/Source/BPBIOS/bp33n.dat and /dev/null differ diff --git a/Source/BPBIOS/bp33nbnk.dat b/Source/BPBIOS/bp33nbnk.dat deleted file mode 100644 index 8ec9a9c2..00000000 Binary files a/Source/BPBIOS/bp33nbnk.dat and /dev/null differ diff --git a/Source/BPBIOS/bp33t.dat b/Source/BPBIOS/bp33t.dat deleted file mode 100644 index 09506ea4..00000000 Binary files a/Source/BPBIOS/bp33t.dat and /dev/null differ diff --git a/Source/BPBIOS/bp33tbnk.dat b/Source/BPBIOS/bp33tbnk.dat deleted file mode 100644 index 09506ea4..00000000 Binary files a/Source/BPBIOS/bp33tbnk.dat and /dev/null differ diff --git a/Source/BPBIOS/bp34.dat b/Source/BPBIOS/bp34.dat new file mode 100644 index 00000000..941a5761 Binary files /dev/null and b/Source/BPBIOS/bp34.dat differ diff --git a/Source/BPBIOS/bp34bnk.dat b/Source/BPBIOS/bp34bnk.dat new file mode 100644 index 00000000..e8b2c554 Binary files /dev/null and b/Source/BPBIOS/bp34bnk.dat differ diff --git a/Source/BPBIOS/bp34n.dat b/Source/BPBIOS/bp34n.dat deleted file mode 100644 index bb4c48f3..00000000 Binary files a/Source/BPBIOS/bp34n.dat and /dev/null differ diff --git a/Source/BPBIOS/bp34nbnk.dat b/Source/BPBIOS/bp34nbnk.dat deleted file mode 100644 index bb4c48f3..00000000 Binary files a/Source/BPBIOS/bp34nbnk.dat and /dev/null differ diff --git a/Source/BPBIOS/bp34t.dat b/Source/BPBIOS/bp34t.dat deleted file mode 100644 index ffb28311..00000000 Binary files a/Source/BPBIOS/bp34t.dat and /dev/null differ diff --git a/Source/BPBIOS/bp34tbnk.dat b/Source/BPBIOS/bp34tbnk.dat deleted file mode 100644 index ffb28311..00000000 Binary files a/Source/BPBIOS/bp34tbnk.dat and /dev/null differ diff --git a/Source/BPBIOS/bp41bnk.dat b/Source/BPBIOS/bp41bnk.dat new file mode 100644 index 00000000..8b0ba86a Binary files /dev/null and b/Source/BPBIOS/bp41bnk.dat differ diff --git a/Source/BPBIOS/bp41nbnk.dat b/Source/BPBIOS/bp41nbnk.dat deleted file mode 100644 index 7f6786be..00000000 Binary files a/Source/BPBIOS/bp41nbnk.dat and /dev/null differ diff --git a/Source/BPBIOS/bp41tbnk.dat b/Source/BPBIOS/bp41tbnk.dat deleted file mode 100644 index 736fbe67..00000000 Binary files a/Source/BPBIOS/bp41tbnk.dat and /dev/null differ diff --git a/Source/BPBIOS/bpbio-dx.z80 b/Source/BPBIOS/bpbio-dx.z80 deleted file mode 100644 index 39b2a5ef..00000000 --- a/Source/BPBIOS/bpbio-dx.z80 +++ /dev/null @@ -1,577 +0,0 @@ -;***************************************************************************** -; BP-BIOS. Banked, Portable BIOS. -; Copyright (c) 1989-93 by Cameron W. Cotrill and Harold F. Bower -; -; 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. -; -;---------------------------------------------------------------------------- -; This BIOS is broken into modules that allow it to be ported across a -; wide variety of Z80 compatible systems. All hardware specific drivers -; are isolated to separate modules. All hardware independent modules (such -; as deblocking and IO redirection) are similarly broken out. -; -; The BP BIOS supports IOBYTE, but in a unique manner. Four physical devices -; are defined - COM1, COM2, PIO, and NULL. These are assigned to the CON, -; AUXIN, AUXOUT, and LST logical devices by the I/O byte. The NULL device is -; a bit bucket for output, and returns nulls for input. -; -; IOBYTE DESCRIPTION: LIST AUXOUT AUXIN CON -; D7->D0 XX XX XX XX -; -; XX: 00=COM1 01=COM2 10=PIO 11=NULL -; -;+++++++++++++++++ D-X Designs Pty Ltd P112 Version ++++++++++++++++++ -; -; This configuration of the B/P Bios is for Dave Brooks' Project 112 Single -; board computer. Multifunction chips on the board provide the services -; needed by a CP/M BIOS. The primary chips and the functions provided are: -; -; Zilog Z80182 Z180 Core CPU, MMU, DMA -; ESCC #1 COM1 Serial Port w/handshake signals, RS-232 -; ESCC #2 (available on header, coded as expansion) -; ASCI0, ASCI1 (Serial async, available on header, expansion) -; CTC1 Optional 'heartbeat' clock, GP timer -; -; SMC FDC37C665 Enhanced 765-derivative Floppy Disk Controller -; COM2 - 16550-compatible Serial, RS-232 -; PAR1 - Centronics Parallel port (Printer) -; -; Dallas DS-1202 Primary Realtime clock -; Non-volatile battery-backed RAM (config data) -; -; 28F256 Flash ROM Boot code, device initialization -; (onboard programmable) -; 32/128/512 KB Static RAM -; -; Ver Date Revision Description -; --- --------- ------------------------ -; 1.3 28 Aug 01 - Scrubbed for GPL Release. HFB -; 1.2 - 30 Aug 97 - Expanded SCSI CDB length to 12 bytes for CDROM. HFB -; 1.1 - 11 May 97 - Added IDE Hard Drive instead of Normal SCSI, updated -; files to latest version. HFB -; 1.0 - 13 Aug 96 - Initial Release for P112 from YASBEC release. HFB -;***************************************************************************** - - NAME BPBIO - -FALSE EQU 0 -TRUE EQU NOT FALSE -NO EQU FALSE -YES EQU TRUE - ; << ****** SYSTEM SPECIFIC ****** >> - ; << Insert DEF-xxxx.LIB definition >> - INCLUDE DEF-DX.LIB ; << file for your configuration. >> - - CSEG -;..... -; Ascii Character Equates - -ETX EQU 03H ; End-of-Text -ACK EQU 06H ; Acknowledge -BELL EQU 07H ; Bell Character -CR EQU 0DH -LF EQU 0AH -XON EQU 11H ; X-On (Control-Q) -XOFF EQU 13H ; X-Off (Control-S) -ESC EQU 1BH - -; Miscellaneous Equates - -WRUAL EQU 2 ; DOS code for unallocated write - -LOCKF EQU LOW [NOT AUTOSL] ;Lock flag for format default -ALONE EQU FALSE ; Boot code equate - IF Z3 - MACLIB Z3BASE ; Include ENV definitions - ENDIF - PAGE -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -; BIOS Entry Jump Table - This MUST be in Common Memory -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - - CSEG - -BIOSJT: JP CBOOT ; 00 Cold Boot - JP WBOOT ; 01 Warm Boot - JP CONST ; 02 console input status * (IOP+12) - JP CONIN ; 03 console input * (IOP+15) - JP CONOUT ; 04 console output * (IOP+18) - JP LIST ; 05 list output * (IOP+21) - JP AUXOUT ; 06 aux out (punch) * (IOP+24) - JP AUXIN ; 07 aux in (reader) * (IOP+27) - JP HOME ; 08 seek track 0 - JP SELDSK ; 09 select logical drive - JP SETTRK ; 10 select track - JP SETSEC ; 11 select sector - JP SETDMA ; 12 set dma address for disk xfer - JP READ ; 13 disk read - JP WRITE ; 14 disk write - JP LISTST ; 15 list output status * (IOP+30) - JP SECTRN ; 16 logical -> physical sector xlate - -; --- <<< End of CP/M 2.2 Vectors >>> - - JP CONOST ; 17 Console Output Status - JP AUXIST ; 18 Aux Input Status - JP AUXOST ; 19 Aux Output Status - JP DEVTBL ; 20 CP/M 3 Device Table - JP DEVINI ; 21 Character Device Init (Near CP/M 3) - JP DRVTBL ; 22 DPH Pointer Table for A-P - JP 0 ; 23 RESERVED FOR MULTIO - JP FLUSH ; 24 Flush Deblocker - JP MOVE ; 25 Perform possible Inter-Bank Move - IF CLOCK - JP TIME ; 26 Get/Set RTC (Zsdos params) - ELSE - JP ISTRUE ; 26..return 0FFH (No Clock) if No code - ENDIF ;clock - JP SELMEM ; 27 Select Alternate Memory Bank - JP SETBNK ; 28 Select DMA Memory bank - JP XMOVE ; 29 Set Source/Destination Banks for Move - -; --- <<< End of CP/M 3 Vectors >>> - - JP RETBIO ; 30 Return BIOS Addresses - JP DIRDIO ; 31 Direct Disk I/O - JP STFARC ; 32 Set Bank for FRJP and FRCALL - JP FRJP ; 33 Jump to (HL) in Alternate Bank - JP FRCLR ; 34 Clear Stack switcher from Alt Bank Jumps - ; (used for error exits) - JP FRGETB ; 35 Load A,(HL) from Alternate Bank - JP FRGETW ; 36 Load DE,(HL) from Alternate Bank - JP FRPUTB ; 37 Load (HL),A to Alternate Bank - JP FRPUTW ; 38 Load (HL),DE to Alternate Bank - JP RETMEM ; 39 Return Current Active Memory Bank - -CPR EQU BIOSJT-800H-0E00H -DOS EQU BIOSJT-0E00H - -; End of BIOS Jump Table - PAGE -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -; Boot / Banked Routine Linkage -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - - IF BANKED - COMMON /BANK2/ -ROMJT: - IF INROM - JP INSYNC -INSYNC: JP BOOTER ; Cold start loader - ELSE - JP 0 ; Reserved - JP 0 - ENDIF ; Inrom -JDIRIO: JP DIRIO ; Low Level HDC/FDC Functions -JHDCIO: JP DIRIO ; Low Level HDC Functions (combined w/FDCIO) -JBREAD: JP BREAD ; BIOS Read -JBWRT: JP BWRT ; BIOS Write -JBSTRN: JP BSTRN ; BIOS Sectran - IF INROM - INCLUDE BOOTROM.Z80 ; Boot Routines - ENDIF ; Inrom - ENDIF ; Banked - PAGE -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -; C o n f i g u r a t i o n A r e a -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - ; << ****** HARDWARE SPECIFIC ****** >> - ; << Insert ICFG-xxx to initialize >> - INCLUDE ICFG-DX.Z80 ; << your computer's IO system >> - PAGE - ; << ****** Hardware Specific ****** >> - ; << Enter Low level Byte I/O driver >> - INCLUDE IIO-DX.Z80 ; << routines in file IIO-xxxx.Z80 >> - PAGE -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -; Cold Start Code -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - - DSEG - ; << ***** Hardware Specific ***** >> - ; << Insert the Cold boot routines >> - INCLUDE CBOOT-DX.Z80 ; << in file CBOOT-xx.Z80 >> - -; Deblocking Buffer Allocation - - IF [BANKED OR INROM] - COMMON /B2RAM/ - IF INROM -HSTBUF: DEFS INITCS ; Use a 1k buffer w/below - ELSE -HSTBUF EQU CBOOT0 ; Use CBOOT0 code for part of buffer w/below - ENDIF ;inrom - ELSE - DSEG -HSTBUF EQU CBOOT - ENDIF ;not banked - DEFS 1024-(INITCS) ; Use a 1 k buffer - -HSTSIZ EQU HSTBUF+1024 ; Added label for Hard Drive ext. interface - PAGE -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -; Disk Data Structures -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -MXFDIR EQU 255 ; Max number of dir entries-1 for floppy - -MXFALC EQU 880 ; If High Density or 8" drives can be handled, - ; set this for 880 (1.76 MB), otherwise the - ; value can be reduced to 400 (800 KB), the - ; maximum for 80 track, Double-Sided formats. - CSEG - IF BANKED - COMMON /BANK2/ - ENDIF -DPB: ; Marker for DPB start - .XLIST ; Don't print these due to size - IF AUTOSL - INCLUDE DPB.LIB ; Default selection of common DD formats - IF FLOPYH - INCLUDE DPB-H.LIB ; If "High-Density" Disk formats desired, - ENDIF - IF FLOPY8 - INCLUDE DPB-8.LIB ; If 8" or HD Floppy Disks can be handled, - ENDIF ; add default Autoselect DPB's - IF MORDPB - INCLUDE DPB2.LIB ; Additional assignable DPB's (4+4 unused) - ENDIF ;mordpb - - ELSE ;Not autosl - INCLUDE DPBRAM.LIB ; RAM-based DPB's, 1 per physical Format - ENDIF - -NRDPB EQU [$-DPB]/DPBSIZ ; Calc number of DPB's - - CSEG ; Hard & Ramdisk DPBs and DPHs go in Code Seg - .xlist - IF HARDDSK - ; << ****** Hardware Specific ****** >> - ; << Insert DPB Info for Hard Disk >> - INCLUDE DPBHD-DX.LIB ; << Drives as DPBHD-xx.LIB >> - ENDIF - .list - IF RAMDSK - ; << ****** Hardware Specific ****** >> - ; << Insert DPB Info for RAM Disk >> - INCLUDE DPBM-DX.LIB ; << in file DPBM-xxx.LIB >> - ENDIF - PAGE - INCLUDE DPH.LIB ; Disk parameter headers - .xlist - IF HARDDSK - INCLUDE DPHHD.LIB ; Insert DPH Info for Hard Disk Partitions - ENDIF - .list - IF RAMDSK - INCLUDE DPHM.LIB ; Insert DPH Info for RAM Disk - ENDIF - .LIST - PAGE -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -; Disk Driver Low - Level Function Links -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Direct Disk I / O -; Call with: Function Number in C, Driver number in B, -; Args in A, DE, HL -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - CSEG -DIRDIO: - IF BANKED - CALL BIOSTK - CALL GOSYSB ; Bank in the system bank - JP JDIRIO ; And jump to Banked-BIOS function - - COMMON /BANK2/ - ENDIF - -DIRIO: PUSH HL ; Save user's HL - PUSH AF ; ..and A reg for range checks - LD A,B - CP MAXDDA ; Legal Driver #? - JR NC,DIRIOX ; ..jump Error Exit if Not - PUSH BC - LD HL,DDIOTB - LD C,B ; Driver number - LD B,0 - ADD HL,BC - ADD HL,BC ; Index into table - ADD HL,BC - LD A,(HL) ; Max call number - INC HL - LD C,(HL) - INC HL - LD H,(HL) - LD L,C ; Service vector table address in HL - POP BC ; Requested call - DEC A ; Correct Max Call # for Testing - JP M,DIRIOX ; ..jump Error exit if 0 --> FF (No Calls) - CP C ; Greater than Maximum Function? - JR C,DIRIOX ; ..jump Error exit if so - PUSH BC ; Else Save BC - LD B,0 - ADD HL,BC - ADD HL,BC ; Add twice for Word index - LD B,(HL) - INC HL - LD H,(HL) - LD L,B ; Put vector in HL - POP BC ; Restore User's BC register - POP AF ; .Restore A and Flags - EX (SP),HL ; ..restore HL, Vector to TOS - RET ; Jump to Routine - -DIRIOX: POP AF ; Clear stack - POP HL - OR 0FFH ; Set Error return - RET ; ..and quit - -; Direct Disk Access Table Pointer Table - -DDIOTB: DEFB 0 - DEFW 00 ; No Driver 0 - DEFB MAXFFN - DEFW FDFUNC ; 1 is Primary Floppy Driver - IF HARDDSK - DEFB MAXHFN - DEFW HDFUNC ; 2 is Primary Hard Disk Driver - ENDIF ;harddsk - IF [RAMDSK AND NOT HARDDSK] - DEFB 0 - DEFW 00 ; (Dummy 2 if not installed) - ENDIF ;ramdsk and not harddsk - IF RAMDSK - DEFB 0 - DEFW 00 ; 3 is Primary RAM Disk Driver (No Functions) - ENDIF ;ramdsk - -MAXDDA EQU ($-DDIOTB)/3 ; Number of entries in pointer table - -; Floppy Drive Function Table and Numbers - -FDFUNC: DEFW STMODE ; 00 set mode - DEFW STSIZE ; 01 set drive size - DEFW STHDRV ; 02 set head and drive - DEFW STSECT ; 03 set sector #, size and eot - DEFW SPEC ; 04 specify srt, hlt, hut - DEFW RECAL ; 05 home the floppy - DEFW SEEK ; 06 seek track - DEFW SREAD ; 07 read - DEFW SWRITE ; 08 write - DEFW READID ; 09 read id - DEFW RETDST ; 10 return drive status & result ptr - DEFW FMTTRK ; 11 format a track -MAXFFN EQU [$-FDFUNC]/2 - -; Hard Disk Function Table and Numbers - - IF HARDDSK -HDFUNC: DEFW HDVALS ; 00 Set Xfer Address, Return Interface Parms - DEFW HDSLCT ; 01 Select Device (& Logical Unit w/SCSI) - DEFW HD_RW ; 02 Direct Hard Disk Driver -MAXHFN EQU [$-HDFUNC]/2 - ENDIF ;harddsk - PAGE -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -; Banked Memory Support Routines -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Bank Control Routines. Used only in Banked Systems -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - IF BANKED ; << ****** HARDWARE SPECIFIC ****** >> - ; << Enter the Inter-Bank Movement >> - INCLUDE IBMV-DX.Z80 ; << routines in IBMV-xxx.Z80 >> - - ELSE ; If Not Banked, Use these hooks - -MOVE: LDIR - RET - -SETBNK: -SELMEM: -RETMEM: -XMOVE: -GOSYSB: -FRCLR: -STFARC: RET - -FRJP: JP (HL) - -FRGETB: LD A,(HL) - RET - -FRGETW: LD E,(HL) - INC HL - LD D,(HL) - DEC HL - RET - -FRPUTB: LD (HL),A - RET - -FRPUTW: LD (HL),E - INC HL - LD (HL),D - DEC HL - RET - - ENDIF ;(not) banked - PAGE -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -; Core BIOS Code -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Return BIOS Addresses -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - CSEG - -RETBIO: LD BC,BIOSJT ; Get address of bios base - LD DE,CONFIG ; Point to configuration area - LD HL,DEVCFG ; Point to Char IO Device Table - LD A,VERS ; Return BIOS Version - RET - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Return DPH Table Address -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -DRVTBL: LD HL,DPHTBL ; Point to DPH table - RET - - PAGE - INCLUDE BYTEIO.Z80 ; Con:, aux:, lst: redirection - PAGE - INCLUDE SELRWD.Z80 ; Physical driver link for disks - PAGE - INCLUDE DEBLOCK.Z80 ; Hstbuf deblocker - PAGE - INCLUDE SECTRAN.Z80 ; Sector translation - PAGE - IF AUTOSL - INCLUDE SELFLP2.Z80 ; Floppy disk select - ELSE - INCLUDE SELFLP1.Z80 - ENDIF - PAGE - INCLUDE FLOPPY.Z80 ; Hardware independent floppy routines - PAGE - ; << ****** Hardware Specific ****** >> - ; << This Driver is for the Standard >> - INCLUDE FDC-DX.Z80 ; << MicroSystems (SMC) FDC37C665 >> - PAGE - ; << ****** Hardware Specific ****** >> - ; << Enter routines for your timer >> - INCLUDE TIM-DX.Z80 ; << and clock in TIM-xxxx.Z80 >> - PAGE - - IF HARDDSK ; << ****** Hardware Specific ****** >> - IF IDE ; << Enter driver routines for your >> - INCLUDE HARDIDE.Z80 ; << Hard Disk in HARD-xxx.Z80 >> - ELSE - INCLUDE HARD-DX.Z80 - ENDIF - PAGE - ENDIF - - IF RAMDSK ; << ****** Hardware Specific ****** >> - INCLUDE RAMD-DX.Z80 ; << Enter driver routines for RAM >> - PAGE ; << Disk in RAMD-xxx.Z80 >> - ENDIF - ; << ****** Hardware Specific ****** >> - ; << Enter Warm Boot routines in >> - INCLUDE WBOOT-DX.Z80 ; << WBOOT-xx.Z80 >> -;..... -; Status bytes of general use placed at end of Data area - - DSEG - -HDONE: DEFS 1 ; HDC Flag 0=Ready, 1=Busy, 0FFH=Done -ERFLAG: DEFS 1 ; Disk Operation Error Code - DEFS 3 ; Reserved - -; Add Character IO buffers here to insure they are at end of DSEG - - IF BUFFA0 AND MORDEV AND NOT MOVCPM -COM4Q: DEFS 1 ; Char count in Queue - DEFS QSIZE ; 1 to 255 character type-ahead buffer - ENDIF - - IF BUFFA1 AND MORDEV AND NOT MOVCPM -COM5Q: DEFS 1 ; Char count in Queue - DEFS QSIZE ; 1 to 255 character type-ahead buffer - ENDIF - - IF (BUFFA0 OR BUFFA1) AND MORDEV AND NOT MOVCPM - DEFS 12 ; Stack for Buffered char IO routines -INTSP: DEFS 2 ; Storage for entry Stack Ptr - ENDIF - -; Flags Bytes for Com1/Com2 Flow Control - IF XONOFF -COM1WT: DEFS 1 ; B7=0 - Output Ok, B7=1 - Output Stopped -COM2WT: DEFS 1 ; B0=0 - Input Ok, B0=1 - Input Halted - IF ESCC_B AND MORDEV AND NOT MOVCPM -COM3WT: DEFS 1 ; Flags for Expansion devices - ENDIF - IF ASCI_0 AND MORDEV AND NOT MOVCPM -COM4WT: DEFS 1 - ENDIF - IF ASCI_1 AND MORDEV AND NOT MOVCPM -COM5WT: DEFS 1 - ENDIF - ENDIF ;XonOff - -PAOR: DEFS 1 ; Parallel Output Ready Flag - - IF [BANKED AND ZSDOS2] - COMMON /B2RAM/ ; Put this label in Banked Memory - ENDIF ; ..else in Dseg -BRAME: DEFS 2 ; Use as dynamic sizing label for Hard Drive - ; ALV buffers, and storage area for sizing. - ; ALV Buffers build up from here in memory - CSEG - -; Display warning if we are assembling for MOVCPM integration and the -; combined CSEG/Initialized DSEG size exceeds 1 or 2 Boot Records - -PRINTX MACRO %NN - .printx %NN - ENDM - -LIMIT EQU $-BIOSJT+INITCS - - IF MOVCPM AND LIMIT > 4480 - .printx - .printx **** BIOS too big (>4480) for Boot Tracks! **** - PRINTX %LIMIT - .printx - ELSE - IF MOVCPM AND LIMIT > 4352 - .printx - .printx ++++ BIOS exceeds (>4352) 2-Sector Boot Record ++++ - PRINTX %LIMIT - .printx - ENDIF - ENDIF - -NSECTS EQU ($+INITCS-BIOSJT)/128+1 - IF INROM - INCLUDE BOOTRAM.Z80 - ENDIF - END - \ No newline at end of file diff --git a/Source/BPBIOS/bpbio-ww.z80 b/Source/BPBIOS/bpbio-ww.z80 index 666b2ad2..33c67a4b 100644 --- a/Source/BPBIOS/bpbio-ww.z80 +++ b/Source/BPBIOS/bpbio-ww.z80 @@ -32,35 +32,45 @@ ; ; XX: 00=COM1 01=COM2 10=PIO 11=NULL ; -;+++++++++++++++++ D-X Designs Pty Ltd P112 Version ++++++++++++++++++ +;+++++++++++++++++ Retro-Brew HBIOS Version ++++++++++++++++++ ; -; This configuration of the B/P Bios is for Dave Brooks' Project 112 Single -; board computer. Multifunction chips on the board provide the services -; needed by a CP/M BIOS. The primary chips and the functions provided are: +; This configuration of the B/P Bios is for Retro-Brew (formerly +; called N8VEM) Single board computers with HBIOS. Multifunction +; chips on the board provide the services needed by a CP/M BIOS. +; This version of BPBios was derived from the P-112 version. +; The primary chips and the functions provided are: ; +; For Mark IV or N8 ; Zilog Z80182 Z180 Core CPU, MMU, DMA -; ESCC #1 COM1 Serial Port w/handshake signals, RS-232 -; ESCC #2 (available on header, coded as expansion) ; ASCI0, ASCI1 (Serial async, available on header, expansion) ; CTC1 Optional 'heartbeat' clock, GP timer ; -; SMC FDC37C665 Enhanced 765-derivative Floppy Disk Controller -; COM2 - 16550-compatible Serial, RS-232 -; PAR1 - Centronics Parallel port (Printer) -; ; Dallas DS-1202 Primary Realtime clock ; Non-volatile battery-backed RAM (config data) ; -; 28F256 Flash ROM Boot code, device initialization -; (onboard programmable) -; 32/128/512 KB Static RAM +; 28F512 Flash ROM Boot code, device initialization +; and ROM disk +; 512 KB Static RAM On board RAM +; +; For SBC V1/2, ZETA or SIMH +; Zilog Z80 Z80 core at 4 Mhz +; UART 16650 compatible UART +; Dallas DS-1202 Primary Real time clock +; 28F512 Flash ROM Boot code, device initializtion, monitor and +; ROM disk +; 512k Static RAM On board RAM ; ; Ver Date Revision Description -; --- --------- ------------------------ +; --- --------- ----------------------- +; 1.8 04 Apr 21 - Update for ROMWBW version 3.0.1 LN +; 1.7 01 Jul 17 - Updated for HBIOS version 2.8.1 WW+LN +; 1.6 04 Sep 16 - Updated for HBIOS version 2.8 pre 5 WW+LN +; 1.5 15 May 15 - Updated for new versin of HBIOS WW+LN +; 1.4 24 Mar 14 - Initial HBIOS test Release WW+LN ; 1.3 28 Aug 01 - Scrubbed for GPL Release. HFB -; 1.2 - 30 Aug 97 - Expanded SCSI CDB length to 12 bytes for CDROM. HFB -; 1.1 - 11 May 97 - Added IDE Hard Drive instead of Normal SCSI, updated -; files to latest version. HFB +; 1.2 - 30 Aug 97 - Expanded HD CDB length to 12 bytes for CDROM. HFB +; 1.1 - 11 May 97 - Added IDE Hard Drive, updated files to latest +; version. HFB ; 1.0 - 13 Aug 96 - Initial Release for P112 from YASBEC release. HFB ;***************************************************************************** @@ -70,13 +80,14 @@ FALSE EQU 0 TRUE EQU NOT FALSE NO EQU FALSE YES EQU TRUE - ; << ****** SYSTEM SPECIFIC ****** >> - ; << Insert DEF-xxxx.LIB definition >> - INCLUDE DEF-WW.LIB ; << file for your configuration. >> + ; << ****** SYSTEM SPECIFIC ****** >> + ; << Insert ROMWBW definitions here >> + INCLUDE ROMWBW.LIB ; << for version # in ROM >> + ; << ****** SYSTEM SPECIFIC ****** >> ; << Insert DEF-xxxx.LIB definition >> - INCLUDE ROMWBW.LIB ; << file for your configuration. >> + INCLUDE DEF-WW.LIB ; << file for your configuration. >> CSEG ;..... @@ -97,13 +108,12 @@ WRUAL EQU 2 ; DOS code for unallocated write LOCKF EQU LOW [NOT AUTOSL] ;Lock flag for format default ALONE EQU FALSE ; Boot code equate + ; Include ENV definitions IF Z3 -; MACLIB Z3BASE.LIB ; Include ENV definitions - IF CONF_T - MACLIB Z3BASET.LIB - ENDIF - IF CONF_N - MACLIB Z3BASEN.LIB + IF ZSDOS2 + MACLIB Z3BASEF.LIB + ELSE + MACLIB Z3BASE.LIB ENDIF ENDIF PAGE @@ -147,14 +157,15 @@ BIOSJT: JP CBOOT ; 00 Cold Boot ELSE JP ISTRUE ; 26..return 0FFH (No Clock) if No code ENDIF ;clock - JP SELMEM ; 27 Select Alternate Memory Bank + ;JP SELMEM ; 27 Select Alternate Memory Bank + JP HB_SELMEM ; 27 Select Alternate Memory Bank JP SETBNK ; 28 Select DMA Memory bank JP XMOVE ; 29 Set Source/Destination Banks for Move ; --- <<< End of CP/M 3 Vectors >>> JP RETBIO ; 30 Return BIOS Addresses - JP DIRDIO ; 31 Direct Disk I/O + JP ISTRUE ; 31 Direct Disk I/O - Not implemented JP STFARC ; 32 Set Bank for FRJP and FRCALL JP FRJP ; 33 Jump to (HL) in Alternate Bank JP FRCLR ; 34 Clear Stack switcher from Alt Bank Jumps @@ -177,21 +188,21 @@ DOS EQU BIOSJT-0E00H IF BANKED COMMON /BANK2/ ROMJT: - IF INROM + IF INROM JP INSYNC INSYNC: JP BOOTER ; Cold start loader - ELSE + ELSE JP 0 ; Reserved JP 0 - ENDIF ; Inrom -JDIRIO: JP DIRIO ; Low Level HDC/FDC Functions -JHDCIO: JP DIRIO ; Low Level HDC Functions (combined w/FDCIO) + ENDIF ; Inrom +JDIRIO: JP ISTRUE ; Low Level HDC/FDC Functions +JHDCIO: JP ISTRUE ; Low Level HDC Functions (combined w/FDCIO) JBREAD: JP BREAD ; BIOS Read JBWRT: JP BWRT ; BIOS Write JBSTRN: JP BSTRN ; BIOS Sectran - IF INROM + IF INROM INCLUDE BOOTROM.Z80 ; Boot Routines - ENDIF ; Inrom + ENDIF ; Inrom ENDIF ; Banked PAGE ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -214,19 +225,23 @@ JBSTRN: JP BSTRN ; BIOS Sectran ; << Insert the Cold boot routines >> INCLUDE CBOOT-WW.Z80 ; << in file CBOOT-xx.Z80 >> + ; << ****** Hardware Specific ****** >> + ; << HBIOS interface routines in >> + INCLUDE HBIOS.Z80 ; << HBIOS.Z80 >> + ; Deblocking Buffer Allocation IF [BANKED OR INROM] COMMON /B2RAM/ - IF INROM + IF INROM HSTBUF: DEFS INITCS ; Use a 1k buffer w/below - ELSE + ELSE HSTBUF EQU CBOOT0 ; Use CBOOT0 code for part of buffer w/below - ENDIF ;inrom + ENDIF ;INROM ELSE DSEG HSTBUF EQU CBOOT - ENDIF ;not banked + ENDIF ;[BANKED OR INROM] DEFS 1024-(INITCS) ; Use a 1 k buffer HSTSIZ EQU HSTBUF+1024 ; Added label for Hard Drive ext. interface @@ -249,19 +264,19 @@ DPB: ; Marker for DPB start ;.XLIST ; Don't print these due to size IF AUTOSL INCLUDE DPB.LIB ; Default selection of common DD formats - IF FLOPYH + IF FLOPYH INCLUDE DPB-H.LIB ; If "High-Density" Disk formats desired, - ENDIF - IF FLOPY8 + ENDIF ; FLOPYH + IF FLOPY8 INCLUDE DPB-8.LIB ; If 8" or HD Floppy Disks can be handled, - ENDIF ; add default Autoselect DPB's - IF MORDPB + ENDIF ;FLOPY8 ; add default Autoselect DPB's + IF MORDPB INCLUDE DPB2.LIB ; Additional assignable DPB's (4+4 unused) - ENDIF ;mordpb + ENDIF ;mordpb ELSE ;Not autosl INCLUDE DPBRAM.LIB ; RAM-based DPB's, 1 per physical Format - ENDIF + ENDIF ; AUTOSL NRDPB EQU [$-DPB]/DPBSIZ ; Calc number of DPB's @@ -271,132 +286,17 @@ NRDPB EQU [$-DPB]/DPBSIZ ; Calc number of DPB's ; << ****** Hardware Specific ****** >> ; << Insert DPB Info for Hard Disk >> INCLUDE DPBHD-WW.LIB ; << Drives as DPBHD-xx.LIB >> - ENDIF + ENDIF ; HARDDSK ;.list - IF RAMDSK - ; << ****** Hardware Specific ****** >> - ; << Insert DPB Info for RAM Disk >> - INCLUDE DPBM-WW.LIB ; << in file DPBM-xxx.LIB >> - ENDIF PAGE INCLUDE DPH.LIB ; Disk parameter headers ;.xlist IF HARDDSK INCLUDE DPHHD.LIB ; Insert DPH Info for Hard Disk Partitions - ENDIF + ENDIF ;HARDDSK ;.list - IF RAMDSK - INCLUDE DPHM.LIB ; Insert DPH Info for RAM Disk - ENDIF .LIST - PAGE -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -; Disk Driver Low - Level Function Links -;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Direct Disk I / O -; Call with: Function Number in C, Driver number in B, -; Args in A, DE, HL -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - CSEG -DIRDIO: -; CALL PRTSTRD -; DEFB '[DIRDIO',']$' - - IF BANKED - CALL BIOSTK - CALL GOSYSB ; Bank in the system bank - JP JDIRIO ; And jump to Banked-BIOS function - COMMON /BANK2/ - ENDIF - -DIRIO: PUSH HL ; Save user's HL - PUSH AF ; ..and A reg for range checks - LD A,B - CP MAXDDA ; Legal Driver #? - JR NC,DIRIOX ; ..jump Error Exit if Not - PUSH BC - LD HL,DDIOTB - LD C,B ; Driver number - LD B,0 - ADD HL,BC - ADD HL,BC ; Index into table - ADD HL,BC - LD A,(HL) ; Max call number - INC HL - LD C,(HL) - INC HL - LD H,(HL) - LD L,C ; Service vector table address in HL - POP BC ; Requested call - DEC A ; Correct Max Call # for Testing - JP M,DIRIOX ; ..jump Error exit if 0 --> FF (No Calls) - CP C ; Greater than Maximum Function? - JR C,DIRIOX ; ..jump Error exit if so - PUSH BC ; Else Save BC - LD B,0 - ADD HL,BC - ADD HL,BC ; Add twice for Word index - LD B,(HL) - INC HL - LD H,(HL) - LD L,B ; Put vector in HL - POP BC ; Restore User's BC register - POP AF ; .Restore A and Flags - EX (SP),HL ; ..restore HL, Vector to TOS - RET ; Jump to Routine - -DIRIOX: POP AF ; Clear stack - POP HL - OR 0FFH ; Set Error return - RET ; ..and quit - -; Direct Disk Access Table Pointer Table - -DDIOTB: DEFB 0 - DEFW 00 ; No Driver 0 - DEFB MAXFFN - DEFW FDFUNC ; 1 is Primary Floppy Driver - IF HARDDSK - DEFB MAXHFN - DEFW HDFUNC ; 2 is Primary Hard Disk Driver - ENDIF ;harddsk - IF [RAMDSK AND NOT HARDDSK] - DEFB 0 - DEFW 00 ; (Dummy 2 if not installed) - ENDIF ;ramdsk and not harddsk - IF RAMDSK - DEFB 0 - DEFW 00 ; 3 is Primary RAM Disk Driver (No Functions) - ENDIF ;ramdsk - -MAXDDA EQU ($-DDIOTB)/3 ; Number of entries in pointer table - -; Floppy Drive Function Table and Numbers - -FDFUNC: DEFW STMODE ; 00 set mode - DEFW STSIZE ; 01 set drive size - DEFW STHDRV ; 02 set head and drive - DEFW STSECT ; 03 set sector #, size and eot - DEFW SPEC ; 04 specify srt, hlt, hut - DEFW RECAL ; 05 home the floppy - DEFW SEEK ; 06 seek track - DEFW SREAD ; 07 read - DEFW SWRITE ; 08 write - DEFW READID ; 09 read id - DEFW RETDST ; 10 return drive status & result ptr - DEFW FMTTRK ; 11 format a track -MAXFFN EQU [$-FDFUNC]/2 - -; Hard Disk Function Table and Numbers - - IF HARDDSK -HDFUNC: DEFW HDVALS ; 00 Set Xfer Address, Return Interface Parms - DEFW HDSLCT ; 01 Select Device (& Logical Unit w/SCSI) - DEFW HD_RW ; 02 Direct Hard Disk Driver -MAXHFN EQU [$-HDFUNC]/2 - ENDIF ;harddsk PAGE ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; Banked Memory Support Routines @@ -409,13 +309,23 @@ MAXHFN EQU [$-HDFUNC]/2 ; << Enter the Inter-Bank Movement >> INCLUDE IBMV-WW.Z80 ; << routines in IBMV-xxx.Z80 >> - ELSE ; If Not Banked, Use these hooks + ELSE ; If Not Banked, Use these hooks + + CSEG MOVE: LDIR RET -SETBNK: SELMEM: + IF HB_DEBUG AND FALSE + CALL PRTSTRD + DEFB '[SELMEM (STUB): $' + CALL PRTHEXBYTE + CALL PRTSTRD + DEFB ']',CR,LF,'$' + ENDIF + +SETBNK: RETMEM: XMOVE: GOSYSB: @@ -443,6 +353,21 @@ FRPUTW: LD (HL),E RET ENDIF ;(not) banked + + IF HB_DEBUG + ; << ****** Hardware Specific ****** >> + ; << HBIOS Diagnostic Support >> + INCLUDE UTIL.Z80 ; << Routines >> + + ELSE ; If Not Debug, Use these hooks + + CSEG + +PANIC: DI + HALT + + ENDIF ; HB_DEBUG + PAGE ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; Core BIOS Code @@ -463,8 +388,6 @@ RETBIO: LD BC,BIOSJT ; Get address of bios base ; Return DPH Table Address ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - INCLUDE UTIL.Z80 - DRVTBL: LD HL,DPHTBL ; Point to DPH table RET @@ -481,47 +404,28 @@ DRVTBL: LD HL,DPHTBL ; Point to DPH table INCLUDE SELFLP2.Z80 ; Floppy disk select ELSE INCLUDE SELFLP1.Z80 - ENDIF + ENDIF ;AUTOSL PAGE INCLUDE FLOPPY.Z80 ; Hardware independent floppy routines PAGE ; << ****** Hardware Specific ****** >> - ; << This Driver is for the Standard >> - INCLUDE FDC-WW.Z80 ; << MicroSystems (SMC) FDC37C665 >> + INCLUDE FDC-WW.Z80 ; << This Driver is for HBIOS >> PAGE ; << ****** Hardware Specific ****** >> - ; << Enter routines for your timer >> - INCLUDE TIM-WW.Z80 ; << and clock in TIM-xxxx.Z80 >> + INCLUDE TIM-WW.Z80 ; << This Driver is for HBIOS >> PAGE IF HARDDSK ; << ****** Hardware Specific ****** >> - IF SCSI ; << Enter driver routines for your >> - INCLUDE HARD-WW.Z80 ; << Hard Disk in HARD-xxx.Z80 >> - ENDIF - IF IDE - INCLUDE HARDIDE.Z80 - ENDIF - IF SIMHDSK - INCLUDE HARDSIM.Z80 - ENDIF - IF HBDSK - INCLUDE HARDHB.Z80 - ENDIF + INCLUDE HARD-WW.Z80 ; << This Driver is for HBIOS >> + PAGE - ENDIF + ENDIF ;HARDDSK - IF RAMDSK ; << ****** Hardware Specific ****** >> - INCLUDE RAMD-WW.Z80 ; << Enter driver routines for RAM >> - PAGE ; << Disk in RAMD-xxx.Z80 >> - ENDIF ; << ****** Hardware Specific ****** >> ; << Enter Warm Boot routines in >> INCLUDE WBOOT-WW.Z80 ; << WBOOT-xx.Z80 >> - ; << ****** Hardware Specific ****** >> - ; << HBIOS interface routines in >> - INCLUDE HBIOS.Z80 ; << HBIOS.Z80 >> ;..... ; Status bytes of general use placed at end of Data area @@ -530,44 +434,9 @@ DRVTBL: LD HL,DPHTBL ; Point to DPH table HDONE: DEFS 1 ; HDC Flag 0=Ready, 1=Busy, 0FFH=Done ERFLAG: DEFS 1 ; Disk Operation Error Code DEFS 3 ; Reserved - -; Add Character IO buffers here to insure they are at end of DSEG - - IF BUFFA0 AND MORDEV AND NOT MOVCPM -COM4Q: DEFS 1 ; Char count in Queue - DEFS QSIZE ; 1 to 255 character type-ahead buffer - ENDIF - - IF BUFFA1 AND MORDEV AND NOT MOVCPM -COM5Q: DEFS 1 ; Char count in Queue - DEFS QSIZE ; 1 to 255 character type-ahead buffer - ENDIF - - IF (BUFFA0 OR BUFFA1) AND MORDEV AND NOT MOVCPM - DEFS 12 ; Stack for Buffered char IO routines -INTSP: DEFS 2 ; Storage for entry Stack Ptr - ENDIF - -; Flags Bytes for Com1/Com2 Flow Control - IF XONOFF -COM1WT: DEFS 1 ; B7=0 - Output Ok, B7=1 - Output Stopped -COM2WT: DEFS 1 ; B0=0 - Input Ok, B0=1 - Input Halted - IF ESCC_B AND MORDEV AND NOT MOVCPM -COM3WT: DEFS 1 ; Flags for Expansion devices - ENDIF - IF ASCI_0 AND MORDEV AND NOT MOVCPM -COM4WT: DEFS 1 - ENDIF - IF ASCI_1 AND MORDEV AND NOT MOVCPM -COM5WT: DEFS 1 - ENDIF - ENDIF ;XonOff - -PAOR: DEFS 1 ; Parallel Output Ready Flag - IF [BANKED AND ZSDOS2] COMMON /B2RAM/ ; Put this label in Banked Memory - ENDIF ; ..else in Dseg + ENDIF ;[BANKED AND ZSDOS2] ; ..else in Dseg BRAME: DEFS 2 ; Use as dynamic sizing label for Hard Drive ; ALV buffers, and storage area for sizing. ; ALV Buffers build up from here in memory @@ -588,17 +457,56 @@ LIMIT EQU $-BIOSJT+INITCS PRINTX %LIMIT .printx ELSE - IF MOVCPM AND LIMIT > 4352 + IF MOVCPM AND LIMIT > 4352 .printx .printx ++++ BIOS exceeds (>4352) 2-Sector Boot Record ++++ PRINTX %LIMIT .printx - ENDIF - ENDIF + ENDIF ;IF MOVCPM AND LIMIT > 4352 + ENDIF ;MOVCPM AND LIMIT > 4480 NSECTS EQU ($+INITCS-BIOSJT)/128+1 IF INROM INCLUDE BOOTRAM.Z80 - ENDIF + ENDIF ;INROM + + IF HB_DEBUG + + CSEG +XORG DEFL $ + ORG 0 +ORG_CSEG EQU $ + ORG XORG + + DSEG +XORG DEFL $ + ORG 0 +ORG_DSEG EQU $ + ORG XORG + + IF BANKED + + COMMON /BANK2/ +XORG DEFL $ + ORG 0 +ORG_BANK2 EQU $ + ORG XORG + + COMMON /B2RAM/ +XORG DEFL $ + ORG 0 +ORG_B2RAM EQU $ + ORG XORG + + COMMON /RESVD/ +XORG DEFL $ + ORG 0 +ORG_RESVD EQU $ + ORG XORG + + ENDIF ; BANKED + + ENDIF ; HB_DEBUG + END - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/byteio.z80 b/Source/BPBIOS/byteio.z80 index ed11044e..af8d98df 100644 --- a/Source/BPBIOS/byteio.z80 +++ b/Source/BPBIOS/byteio.z80 @@ -1,5 +1,5 @@ ;************************************************************************** -; BYTEIO. Character IO High-Level Routines. (MUST be in Common Memory) +; BYTEIO. Character IO High-Level Routines. (MUSt be in Common Memory) ; Calling parameters apply to both High and Low-Level routines. ; ; Output Routines - Enter: C = Character to be sent @@ -124,7 +124,8 @@ ISFALSE: XOR A ;..... ; Print routine prints to console the Null or Zero-terminated string at (SP) -PRINT: EX (SP),HL ; Print inline 0 or Hi-bit terminated +PRINT: + EX (SP),HL ; Print inline 0 or Hi-bit terminated PSTR: LD A,(HL) ; General purpose print 0 or Hi-bit INC HL ; Terminated string pointed to by HL OR A @@ -143,4 +144,4 @@ PSTRX: EX (SP),HL ; Else swap Ptr to next instr for entry HL val RET ; ..and return to caller ;========================== End of BYTEIO ================================ - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/cboot-dx.z80 b/Source/BPBIOS/cboot-dx.z80 deleted file mode 100644 index eac62ca0..00000000 --- a/Source/BPBIOS/cboot-dx.z80 +++ /dev/null @@ -1,718 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::::::*********************** -; CBOOT. B/P BIOS Cold Boot Module. ** Hardware Specific ** -; This MUST be the Last Module in the BIOS because ** for prompts, Env ** -; it is overwritten by RAM Data. No Dflt Termcap. ** and Termcap Dflts ** -; - D-X Designs Pty Ltd P112 - *********************** -; -; 1.2 - 30 Aug 01 - Cleaned up for GPL release, Set Bank Numbers on boot -; (TPABNK only if MOVCPM) by reading Regs set by ROM. HFB -; 1.1 - 8 May 97 - Added code to activate ASCI channels. HFB -; 1.0 - 13 Aug 96 - Initial Release for P112. HFB -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - DSEG -;..... -; Cold boot entry. This code is executed only once and so may be -; overwritten subsequently by the BIOS. In Non-banked systems, this code -; is placed in the Host Buffer, HSTBUF, allowing up to 1024 bytes in the -; section, although much less will fit on the boot tracks. In Banked -; systems, a small resident part (up to 128 bytes) occupies the Directory -; Sector Buffer, DIRBUF, while the remainder is placed in the banked -; HSTBUF, allowing both sectors to be overwritten without penalty. -; To insure minimum disruption in assembling and linking the BIOS, this -; module must be one of the first linked to place HSTBUF/DIRBUF at the -; beginning of B2RAM and DSEG. - -CBOOT: DI ; Disable interrupt system - - IN0 A,(DDRA) ; Get Data Definition of Port A - SET 4,A ; Bit 4 is Input for SCSI "Int" input - OUT0 (DDRA),A ; and reset bits - - LD A,(HICOMM) ; Set Common Bank start to Header locn - OUT0 (CBAR),A - - CALL FDRst ; Reset FDC Controller, Re-Initialize - ; (Needed in case ROM Timed out for HD Boot) - CALL MOTOFF ; Turn Floppy motors Off, clear timer - - XOR A ; Get a Byte of Zeros - OUT0 (SCR),A ; and activate ASCI0/ASCI1 vs MIMIC - - LD HL,(IOBYT) ; Get IOBYTE, Default Drive & User - LD (3),HL ; Set values in TPA bank - -; Set BIOS Bank Numbers to the RAM base Number as set by Boot ROM. In-context -; RAM will be reflected in CBR which is base. We adjust other bank numbers -; based on configured differences, except for MaxBnk which remains as config'd. -; Since the bootable systems (MOVCPM set to YES) are not banked, the Fast Boot -; option should be OFF, and only the TPABNK will necessarily be Accurate. - - IN0 C,(CBR) ; Read Current 4k base of RAM - RR C ; divide - RR C ; by - RR C ; 8 for 32k Bank base - LD HL,TPABNK - LD B,(HL) ; Get configured TPA Bank # - LD (HL),C ; (Store actual) - IF NOT MOVCPM - DEC HL - LD A,(HL) ; Get Any User Bank - SUB B ; (compute difference from TPA) - JR C,NoUsrB ; ..jump if None - ADD A,C ; Else Compute new User Bank # - LD (HL),A ; (save) -NoUsrB: INC HL ; advance to System Bank # - INC HL - LD A,(HL) ; fetch - SUB B ; Compute diff from System Bnk to TPA Bnk - ADD A,C ; add new base - LD (HL),A ; (save) - INC HL ; Advance to RAM Drive Start Bank # - LD A,(HL) - SUB B ; compute difference - ADD A,C ; Add true base - LD (HL),A ; (save) - ENDIF ;~Movcpm. Max Bank # Stays as configured - - IF BANKED - LD SP,USP ; Set to User Stack in High memory - - CALL GOSYSB ; Turn on the System bank - XOR A - LD (BIOSTK),A ; Init bank switcher - LD (3),HL ; Set IOBYTE and Default DU in System bank - - CALL CBOOT0 ; Execute main part of Cold Setup - - LD A,(TPABNK) - CALL SELBNK ; Insure TPA is in context - ELSE - LD SP,80H ; Set stack in Low memory - - CALL CBOOT0 ; Execute main part of Cold Setup - ENDIF - - IF NOT MOVCPM - LD HL,003CH ; Point to ZMP Flag - LD (HL),0E5H ; say this is first time run - ENDIF - - IF FASTWB - LD HL,BTTBL ; Point to DMA block moving to Alt Bank - JP WBOOTV ; move it and commence execution - ELSE - JP GOZSYS ; Otherwise just go to Command Processor - ENDIF - - IF BANKED - COMMON /B2RAM/ - ENDIF - -;..... -; If this system is Banked and set for Zsdos2, then ALV Buffers are in the -; system bank and will be dynamically sized during Cold Boot. This permits -; BPCNFG to configure a generic IMG file for specific Hard Drive Partitions. - -CBOOT0: LD HL,BRAME ; Get end of banked RAM - LD (HISAV),HL ; and save for later use - IF HARDDSK - LD HL,DPHTBL ; Point to start of DPH Table - LD B,16 ; do all DPHs -DYNLP: LD E,(HL) - INC HL - LD D,(HL) ; Get the pointer for this one - INC HL ; advance to next - LD A,D ; Anything there? - OR E - JR Z,DYNCHK ; jump to end if Nothing - DEC DE ; Else back up Ptr to Driver - DEC DE - LD A,(DE) ; Get driver # - IF RAMDSK - DEC A - DEC A ; Hard Disk (Driver 2)? - JR Z,ADDSIZ ; ..jump if so - DEC A ; RAM Disk (Driver 3)? - ELSE - CP 2 ; Hard Disk (Driver 2)? - ENDIF ; Ramdsk - JR NZ,DYNCHK ; ..jump to end if Not -ADDSIZ: PUSH BC ; Save loop counter - PUSH HL ; and ptr to DPH - EX DE,HL - LD DE,12 ; Offset to DPB Ptr (+2 for Decs) - ADD HL,DE - LD E,(HL) - INC HL - LD D,(HL) ; Get Addr of this DPB - INC HL - INC HL - INC HL ; Advance to ALV Addr location - LD BC,(HISAV) ; get end of used RAM - LD (HL),C ; and save - INC HL - LD (HL),B ; in DPH - LD HL,5 - ADD HL,DE ; Advance to Size in DPB - LD E,(HL) - INC HL - LD D,(HL) ; and fetch Size-1 - INC DE ; Make = Size in Block - PUSH BC ; (save End Addr in BC) - LD B,3 -DVRAME: SRL D ; Divide by 2 - RR E - DJNZ DVRAME ; *3 = Div 8 - INC DE ; +1 - EX DE,HL - POP BC ; Restore Ram End - ADD HL,BC ; Add size to Starting Location - LD (HISAV),HL ; save for next drive/overflow check - POP HL ; Restore DPH ptr - POP BC ; and loop ctr -DYNCHK: DJNZ DYNLP ; Loop til all 16 tested - ENDIF ;harddsk - IF BANKED - LD DE,USP ; Point above critical Bios Ram storage - ELSE - LD DE,DIRBUF - ENDIF - IF Z3 - LD HL,(ENVADR) ; And top of memory - ELSE - LD HL,0FFFFH - ENDIF - SBC HL,DE ; Calculate # bytes to clear (CF already clr) - EX DE,HL ; Ptr to HL, Cnt to DE -Clr0: LD (HL),0 - INC HL - DEC DE - LD A,D - OR E - JR NZ,Clr0 ; ..loop til all cleared - -; In systems where we have enough space, we clear unused High Memory too - - IF NOT MOVCPM - LD HL,(ENVADR) ; Clear above the ENV as well - LD DE,100H ; Assuming a 2-record ENV - ADD HL,DE ; Are we already at the top of memory? - JR C,ATTOP ; ..bypass clearing if so - EX DE,HL ; Else we must calculate how much to clear - LD HL,0FFFFH ; From the TOP - SBC HL,DE ; subtract the start - LD C,L - LD B,H ; and use for count - LD L,E ; Copy Start to Source - LD H,D - INC DE ; dest is same + 1 - LD (HL),0 ; we fill with Zeros - LDIR ; Do it! -ATTOP: - ENDIF ; ~Movcpm - -; Initialize the ZCPR3 buffers - - IF NOT MOVCPM - LD HL,(ENVADR) ; Should we move our local ENV block? - LD A,H - OR L - JR NZ,BMOVE ; ..jump if we already have one - ENDIF ; (Always move Env if using MOVCPM type load) - LD HL,Z3ENV ; Else set up pointers - LD (ENVADR),HL - LD DE,ENV - EX DE,HL - LD BC,ENVEND-ENV ; count - LDIR ; and move - IF MOVCPM ; Instead of storing Termcap bytes, Zeroize - LD H,D - LD L,E ; Dupe dest addr - LD (HL),0 ; Clear current byte - LD BC,37-1 ; Set count to remaining Termcap area - INC DE ; Dest is next byte - LDIR ; move Zero along - ENDIF ;Movcpm -BMOVE: - IF NOT MOVCPM ; No need to set values on Boot Track System - LD DE,(ENVADR) ; Get pointer to ENV - IF HAVIOP - LD HL,0FH ; Set offset to IOP Addr in ENV - CALL CALCOF ; get the addr and size - LD (IOPPTR),HL ; and set addr - ENDIF ;haviop - LD HL,18H ; Set offset to Mult Comnd Line in ENV - CALL CALCOF ; get addr and size - LD (CLPTR),HL ; set addr - INC HL - INC HL - INC HL ; Advance to CL+3 - LD (CL3PTR),HL ; and set - INC HL ; Advance to CL+4 - LD (CMDSET),HL ; set addr in Command Line ptr - LD (CMDSET+2),A ; and CL Size byte - LD HL,09H ; Set offset to Path addr in ENV - CALL CALCOF ; get addr - LD (PTHPTR),HL ; and set - ENDIF ;Movcpm - IF FASTWB ; Do we restore CPR from Bank? - IF MOVCPM - LD DE,BIOSJT-1600H ; Get CPR Starting Addr - LD HL,0800H ; and Default Length - ELSE - LD HL,(ENVADR) ; Get pointer to ENV start - LD DE,3FH ; offset to CPR start - ADD HL,DE - LD E,(HL) ; and get CPR starting address - INC HL - LD D,(HL) - INC HL ; (advance to length) - LD H,(HL) ; Get length in blocks (*2 at this point) - LD L,0 ; convert to Word - SRL H ; Compute Blks * 128 - RR L ; to give HL = CPR length in bytes - ENDIF ;~Movcpm - LD (BTTBL+6),HL ; Save length in boot block - LD (SARL+6),HL ; and DMA WB block - LD HL,(TPABNK) ; Get TPA (L) and System (H) Banks - LD A,L ; Load TPA Bank # - RL D ; Move MSB of Address to Carry - ADC A,0 ; Add Carry to Bank # (in case cross banks) - RRA ; shift for DMA Bank # - LD (SARL+5),A ; save in Warm Boot DMA Block - LD (BTTBL+2),A ; and initial move to bank - RR D ; Move Bank # LSB (Carry) to MSB of Address - LD (SARL+3),DE ; Save CPR logical address in WB DMA block - LD (BTTBL),DE ; and initial move to bank - LD A,H ; Load System Bank # - LD HL,100H ; Load Bank Address of CPR Image Start - RL H ; get rid of MSB - ; Since we know the MSB=0, bypass adc 0 - RRA ; Shift for DMA Bank # - LD (BTTBL+5),A ; save as initial dest bank byte - LD (SARL+2),A ; and DMA Source Bank byte - RR H ; Rotate Carry (Bank LSB) to MSB of Address - LD (SARL),HL ; Save Source Addr in WB DMA block - LD (BTTBL+3),HL ; and initial move block - ENDIF ;fastwb - - IF BANKED - LD HL,0000 ; If we are banked, set to copy Page 0 - LD A,(TPABNK) ; of TPA to System Bank - OR A - RRA ; Shift TPA Bank # - LD (CPYVEC+2),A ; store in DMA Block - RR H ; adjust Address by Bank LSB (Carry) - LD (CPYVEC),HL ; and store - LD H,0 - LD A,(SYSBNK) - RRA ; Shift System Bank # - LD (CPYVEC+5),A ; store in DMA Block - RR H ; adjust Address by Bank LSB (Carry) - LD (CPYVEC+3),HL ; and store - LD HL,40H ; Set length of move - LD (CPYVEC+6),HL ; and store in DMA Block - ENDIF ;banked - - LD (STKSAV),SP ; Save entry stack since we alter it here - LD A,(BLOCKE-BLOCK)/6 - LD SP,BLOCK -BLKMV: POP BC ; And number of bytes to move - POP HL ; Source - POP DE ; Get destination - LDIR - DEC A ; Another block moved - JR NZ,BLKMV ; Do more as required - - LD SP,(STKSAV) ; Get entry Stack Pointer back so we can return - -; All Buffers above BIOS have been cleared already at this point - - DEC A ; 0 --> FF - LD (Z3WHL),A ; Set the Wheel Byte - - IF HAVIOP - LD HL,IOPRET - LD (BIOSJT+1),HL - ENDIF ;haviop - - LD HL,INTTBL ; Set the Interrupt Vector - LD A,H ; first the page - LD I,A ; to CPU Register - OUT0 (IL),L ; then the segment addr - - IF BANKED - CALL JDVINI ; Call directly because we are in High Stack - ELSE - CALL DEVINI ; Initialize the I/O system - ENDIF ; And any device specific ram - - IF [BANKED AND ZSDOS2] - LD DE,8000H ; If ALVs in Bank, size against Bank2 Top - ELSE - LD DE,(USRSP) ; else against base of User Space - ENDIF - LD HL,(HISAV) ; Load Highest RAM Address used - OR A - SBC HL,DE ; Is Needed Space > Limit? - JR C,MEMOK ; ..jump if So - - CALL PRINT ; Else Warn user - DEFB CR,LF,7,'++ Mem Ovfl +','+'+80H - -; Sign on the system - -MEMOK: CALL PRINT - IF MOVCPM ; Space is critical for boot tracks - DEFB CR,LF,'P112 - ' ; Save all bytes possible - ELSE ; Otherwise sign on with complete name - DEFB CR,LF,'D-X Designs P112 - ' - ENDIF - DEFB 'B/P 50.00k Bios' ;**** Do NOT alter this string **** - - DEFB ' V',VERS/16+'0','.',VERS MOD 16+'0',' ' ; Vers in BCD - DATE - IF BANKED - DEFB ' (Banked) ' - ELSE - IF NOT MOVCPM - DEFB ' (Non-Banked) ' ; Nothing for boot track system - ENDIF - ENDIF - IF BANKED - DEFB ' with:',CR,LF,LF - DEFB ' ZCPR3+ Env' - IF CLOCK - IF DS1202 - DEFB CR,LF,' Dallas DS-1202 Clock, ' - IF CLKSET - DEFB 'with ' - ELSE - DEFB 'NO ' - ENDIF - DEFB 'Set' - ELSE - DEFB CR,LF,' ZSDOS Interrupt Clock' - ENDIF - ENDIF - DEFB CR,LF,' High-Density Floppy' - IF FDDMA - DEFB ' (DMA-driven IO)' - ELSE - DEFB ' (Polled IO)' - ENDIF - IF HARDDSK - IF IDE - DEFB CR,LF,' GIDE Hard Disk Driver' - ELSE - DEFB CR,LF,' SCSI Hard Disk Driver' - IF HDDMA - DEFB ' (DMA-driven IO)' - ELSE - DEFB ' (Polled IO)' - ENDIF - ENDIF - ENDIF - IF FASTWB - DEFB CR,LF,' Warm Boot from RAM' - ENDIF - IF RAMDSK - DEFB CR,LF,' RAM Disk (M:)' - ENDIF - IF BIOERM - DEFB CR,LF,' Full Error Messages' - ENDIF - ENDIF ;Banked - DEFB CR,LF+80H - - EI ; Turn Interrupts back on - RET ; ..and return - -;..... -; Offset to and get ENV Address and respective element size - -CALCOF: ADD HL,DE ; Add offset to Base ENV Addr - LD C,(HL) ; get low byte - INC HL - INC HL ; advance to size byte - LD A,(HL) ; get size - DEC HL ; Back down to Addr hi byte - LD H,(HL) ; and grab - LD L,C ; Ptr to Segment now in HL - RET ; return to caller - -; Block Move Parameters - -BLOCK: DEFW PATH-CMDSET ; # to move - DEFW CMDSET ; Source -CLPTR: DEFW Z3CL ; Destination - - DEFW 10 - DEFW AUTOCMD -CL3PTR: DEFW Z3CL+3 - - DEFW PATHE-PATH - DEFW PATH -PTHPTR: DEFW EXPATH - - IF HAVIOP - DEFW IOPLEN+2 - DEFW IOPENT -IOPPTR: DEFW IOP - ENDIF - - IF HARDDSK AND HDDMA AND (NOT IDE) - DEFW DMALEN - DEFW DMADAT - DEFW DMATBL - ENDIF - -BLOCKE EQU $ - -;..... -; Initial HD DMA Control Block data - - IF HARDDSK AND HDDMA -DMADAT: DEFW HSTBUF ; Physical sector address - DEFB 00 ; BNK2 SHR 1 if banked, BNK0 SHR 1 If not - DEFW DMAACK ; Dack port address - DEFB 0 - DEFW 400H ; Number of bytes to transfer (1Sct+slop=2Scts) -DMALEN EQU $-DMADAT - ENDIF - -CMDSET: DEFW Z3CL+4 ; Point to first character in command buffer - DEFB Z3CLS ; Command buffer size - DEFW 0 ; Clear the command line - -PATH: DEFB '$','$',1,15 ; Current, A15: - DEFB 0 ; End of initial path -PATHE EQU $ - -; Environment Descriptor for ZCPR34 - -ENV: JP 0 ; Leading jump (address is CBIOS when NZCOM) -ENV1: ; ZCPR3 enviornment descriptor ... - DEFB 'Z3ENV' ; Environment id - DEFB 90H ; Env type (=>80H means extended ENV). YASBEC - ; uses 90H to show User Area instead of Prt2 - DEFW EXPATH ; External path (path) - DEFB EXPATHS ; - DEFW RCP ; Resident command package (rcp) - DEFB RCPS ; - DEFW IOP ; Input/output package (iop) - DEFB IOPS ; - DEFW FCP ; Flow command package (fcp) - DEFB FCPS ; - DEFW Z3NDIR ; Named directories (ndr) - DEFB Z3NDIRS ; - DEFW Z3CL ; Command line (cl) - DEFB Z3CLS ; - DEFW Z3ENV ; Environment (env) - DEFB Z3ENVS ; - DEFW SHSTK ; Shell stack (sh) - DEFB SHSTKS ; - DEFB SHSIZE ; - DEFW Z3MSG ; Message buffer (msg) - DEFW EXTFCB ; External fcb (fcb) - DEFW EXTSTK ; External stack (stk) - DEFB 0 ; Quiet flag (1=quiet, 0=not quiet) - DEFW Z3WHL ; Wheel byte (whl) - DEFB 16 ; Processor speed (mhz) - DEFB 'P'-'@' ; Max disk letter - DEFB 31 ; Max user number - DEFB 1 ; 1 = Ok to accept DU:, 0 = Not Ok - DEFB 0 ; Crt selection () - DEFB 0 ; Printer selection () - DEFB 80 ; Crt 0: width - DEFB 24 ; # of lines - DEFB 22 ; # of text lines - -; In Extended ENV, CRT 1 is replaced by System Info - -;; DEFB 132 ; . CRT 1: Width -;; DEFB 24 ; # of lines -;; DEFB 22 ; # of text lines - -; The Drive Vector is a 16-bit word in which a "1" bit indicates that a drive -; is active in the system. The bits are arranged as: PONMLKJIHGFEDCBA. When -; stored in memory, it is in normal form with the Low byte stored first. - -E_DRVL DEFL [DRV_A & 1] + [DRV_B & 2] + [DRV_C & 4] + [DRV_D & 8] -E_DRVL DEFL E_DRVL + [DRV_E & 16] + [DRV_F & 32] + [DRV_G & 64] -E_DRVL DEFL E_DRVL + [DRV_H & 128] ; Low Byte Formed -E_DRVH DEFL [DRV_I & 1] + [DRV_J & 2] + [DRV_K & 4] + [DRV_L & 8] -E_DRVH DEFL E_DRVH + [DRV_M & 16] + [DRV_N & 32] + [DRV_O & 64] -E_DRVH DEFL E_DRVH + [DRV_P & 128] ; High Byte Formed - - DEFW E_DRVH * 256 + E_DRVL - DEFB 0 ; (Reserved) - - DEFB 80 ; Prt 0: width - DEFB 66 ; # of lines - DEFB 58 ; # of text lines - DEFB 1 ; Ff flag (1=can form feed) - -;========= Usurped Prt1 storage for Resident User Space Vectors ========= -;; DEFB 96 ; Prt 1: width -;; DEFB 66 ; # of lines -;; DEFB 58 ; # of text lines -;; DEFB 1 ; Ff flag (1=can form feed) - - DEFB USPCS ; Remaining Free User Space (recs) -USRSP: DEFW USPC ; Res. User Space base Address (xx00h/xx80h) - DEFB USPCS ; Size of Res. User Space in 128-byte recs - -;======================================================================== -; In Extended ENV, Printers 2 and 3 are gone, replaced by System Info - -;; DEFB 132 ; . PRT 2: Width -;; DEFB 66 ; # of lines -;; DEFB 58 ; # of text lines -;; DEFB 1 ; FF flag (1=can form feed) -;; DEFB 132 ; . PRT 3: Width -;; DEFB 88 ; # of lines -;; DEFB 82 ; # of text lines -;; DEFB 1 ; FF flag (1=can form feed) - DEFW CPR ; Ccp base address - DEFB [DOS-CPR]/128 ; Size of ccp in 128 byte records - DEFW DOS ; Bdos base address (xx00h or xx80h) - DEFB [BIOSJT-DOS]/128 ; Bdos buffer size in 128 byte records - DEFW BIOSJT ; Bios base address (nzbio if nzcom running) - DEFB 'SH ' ; Shell variable filename - DEFB 'VAR' ; Shell variable filetype - DEFB ' ' ; File 1 - DEFB ' ' ; - DEFB ' ' ; File 2 - DEFB ' ' ; - DEFB ' ' ; File 3 - DEFB ' ' ; - DEFB ' ' ; File 4 - DEFB ' ' ; - DEFB 0 ; Public drive area (zrdos +) - DEFB 0 ; Public user area (zrdos +) - ; Env 128 bytes long -;*************************************************************************** -; This TermCap Data for the New Z-System complies with VLIB4D specs and more -; fully describes the terminal and its capabilities. Edit the fields with -; values for your terminal characteristics, or use it as a template for an -; outboard definition loaded from the Startup file. - -ENV2: DEFB ' ' ; Terminal Name (13 bytes, space terminated) - - IF MOVCPM ; Dummies for boot track systems -B13: DEFB 0 -B14: DEFB 0 ; Bit 7 = Normal TCAP - ELSE -B13: DEFB GOELD-ENV2 ; Offset to GOELD in graphics section -B14: DEFB 10000000B ; Bit 7 = Extended TCAP, remainder undefined - ENDIF ;~Movcpm - -; B15 b0 Standout 0 = Half-Intensity, 1 = Reverse Video -; B15 b1 Power Up Delay 0 = None, 1 = 10-second delay -; B15 b2 No Wrap 0 = Line Wrap, 1 = No Wrap if char written -; to last character in line -; B15 b3 No Scroll 0 = Scroll, 1 = No Scroll if char written -; to last char in last line of diplay -; B15 b4 ANSI 0 = ASCII, 1 = ANSI - -B15: DEFB 00000000B ; Reverse Vid, Wrap, Scroll, ASCII - ; Additional single character cursor motion bytes - DEFB 'E'-'@' ; Cursor Up - DEFB 'X'-'@' ; Cursor Down - DEFB 'D'-'@' ; Cursor Right - DEFB 'S'-'@' ; Cursor Left - - IF NOT MOVCPM ; Omit in boot systems to save space - ; Instead, we simply zero remainder. - DEFB 0 ; CL Delay for Screen Clear - DEFB 0 ; CM Delay for Cursor Motion - DEFB 0 ; CE Delay for Clear to End-of-Line - ; Strings start here - DEFB 0 ; (CL) Home Cursor and Clear Screen - DEFB 0 ; (CM) Cursor Motion - DEFB 0 ; (CE) Clear to End-of-Line - DEFB 0 ; (SO) Reverse On - DEFB 0 ; (SE) Reverse Off - DEFB 0 ; (TO) Terminal Init - DEFB 0 ; (TE) Terminal De-init - ; Extensions to Standard Z3TCAP - DEFB 0 ; (LD) Delete Line - DEFB 0 ; (LI) Insert Line - DEFB 0 ; (CD) Clear from Cursor to End-of-Scr - ; Attributes setting parameters - DEFB 0 ; Set Attributes - DEFB 0 ; Attributes String - ; Read items from screen - DEFB 0 ; Report Cursor Pos'n (ESC Y Pn Pn) - DEFB 0 ; Read Line Under Cursor - -GOELD: DEFB 0 ; On/Off Delay - ; Graphics strings offset from Delay value. - DEFB 0 ; Graphics On - DEFB 0 ; Graphics Off - DEFB 0 ; Cursor Off - DEFB 0 ; Cursor On - ; Graphics Characters - DEFB '*' ; Upper-Left corner [*] - DEFB '*' ; Upper-right corner [*] - DEFB '*' ; Lower-Left corner [*] - DEFB '*' ; Lower-right corner [*] - DEFB '-' ; Horizontal Line [-] - DEFB '|' ; Vertical Line [|] - DEFB '#' ; Full Block (hashed block) [*] - DEFB 'X' ; Hashed Block (big X) [#] - DEFB '+' ; Upper Intersect (Upside down "T") [+] - DEFB '+' ; Lower Intersect ("T") [+] - DEFB '+' ; Mid Intersect (Crossing Lines) [+] - DEFB '+' ; Right Intersect ("T" rotated left) [+] - DEFB '+' ; Left Intersect ("T" rotated right) [+] - DEFB 0 - DEFB 0 - ENDIF ;~Movcpm -ENVEND: - -; IOP initial data - - IF HAVIOP -IOPENT: JP IOPEND - JP IOPEND - JP IOPEND - JP IOPEND - JP CONST - JP CONIN - JP CONOUT - JP LIST - JP AUXOUT - JP AUXIN - JP LISTST - JP IOPEND - JP IOPEND - JP IOPEND - JP IOPEND - JP IOPEND - DEFB 'Z3IOP' - DEFB 'DUMMY ' -IOPLEN EQU $-IOPENT -IOPEND EQU IOP+IOPLEN - XOR A - RET - ENDIF ;haviop - -BCODEE EQU $ - IF BANKED -INITCS EQU BCODEE-CBOOT0 ; Size of Banked (B2RAM) part of Init Code - ELSE -INITCS EQU BCODEE-CBOOT ; Size of Complete Init Code in DSEG - ENDIF - -STKSAV: DEFS 2 ; Storage for Pointer while moving -HISAV: DEFS 2 ; Storage for Hi-ALV address - - IF FASTWB - DSEG -BTTBL: DEFS 8 ; Initial WB DMA Block - ENDIF -;======================== End of CBOOT ============================= - \ No newline at end of file diff --git a/Source/BPBIOS/cboot-ww.z80 b/Source/BPBIOS/cboot-ww.z80 index 3febd543..9e5c31a9 100644 --- a/Source/BPBIOS/cboot-ww.z80 +++ b/Source/BPBIOS/cboot-ww.z80 @@ -2,8 +2,11 @@ ; CBOOT. B/P BIOS Cold Boot Module. ** Hardware Specific ** ; This MUST be the Last Module in the BIOS because ** for prompts, Env ** ; it is overwritten by RAM Data. No Dflt Termcap. ** and Termcap Dflts ** -; - D-X Designs Pty Ltd P112 - *********************** +; - Retro-Brew Boards W/ RomWBW HBIOS *********************** ; +; 1.5 - 04 Sep 16 - Mods to work with HBIOS V 2.8 LWN+WW +; 1.4 - 15 Apr 15 - Mods to work with HBIOS V 2.7.1 WW+LN_ +; 1.3 - 24 Mar 14 - Initial N8VEM HBIOS test release WW+LN ; 1.2 - 30 Aug 01 - Cleaned up for GPL release, Set Bank Numbers on boot ; (TPABNK only if MOVCPM) by reading Regs set by ROM. HFB ; 1.1 - 8 May 97 - Added code to activate ASCI channels. HFB @@ -23,27 +26,44 @@ ; module must be one of the first linked to place HSTBUF/DIRBUF at the ; beginning of B2RAM and DSEG. -CBOOT: DI ; Disable interrupt system +CBOOT: + DI ; Disable interrupt system + + IF BANKED + LD SP,USP ; Set to User Stack in High memory + ELSE + LD SP,80H ; Set stack in Low memory + ENDIF ; BANKED LD HL,(IOBYT) ; Get IOBYTE, Default Drive & User LD (3),HL ; Set values in TPA bank IF BANKED - LD SP,USP ; Set to User Stack in High memory - CALL HBX_INIT ; WW + ; Copy vectors from TPA page zero to SYS page zero + ; This is done very early to ensure interrupt mode 1 + ; vector is available. + LD BC,(TPABNK) ; C := TPABNK, B := SYSBNK + CALL XMOVE ; Set source/dest banks for copy + LD HL,0 ; Source address is zero + LD DE,0 ; Destination address is zero + LD BC,40H ; Copy 40H bytes + CALL MOVE ; Do it + ENDIF ; BANKED + + IF BANKED CALL GOSYSB ; Turn on the System bank XOR A LD (BIOSTK),A ; Init bank switcher LD (3),HL ; Set IOBYTE and Default DU in System bank + CALL HB_INIT ; Do HBIOS initialization CALL CBOOT0 ; Execute main part of Cold Setup LD A,(TPABNK) CALL SELBNK ; Insure TPA is in context ELSE - LD SP,80H ; Set stack in Low memory - CALL HBX_INIT ; WW + CALL HB_INIT ; Do HBIOS initialization CALL CBOOT0 ; Execute main part of Cold Setup - ENDIF - + ENDIF ; Banked + IF NOT MOVCPM LD HL,003CH ; Point to ZMP Flag LD (HL),0E5H ; say this is first time run @@ -53,20 +73,24 @@ CBOOT: DI ; Disable interrupt system ; Grab a copy of command processor from TPA and ; cache it in (SYSBNK):100H. We assume that the ; original copy of command processor is in high memory. + ; + ; It is critical that we use the HB variants of MOVE and XMOVE + ; because we are moving between banks even in a non-banked + ; system! LD A,(TPABNK) ; Source bank is TPABNK LD C,A ; Put it in C LD A,(SYSBNK) ; Destination bank is SYSBNK LD B,A ; Put it in B - CALL HBX_XCOPY ; Set banks for extended copy + CALL HB_XMOVE ; Set banks for extended copy LD HL,(CPADR) ; Copy from start of command processor LD DE,100H ; .. to $100 in system bank LD BC,(CPLEN) ; Length of command processor - CALL HBX_COPY ; Do it - + CALL HB_MOVE ; Do it + JP WBOOTV ; move it and commence execution ELSE JP GOZSYS ; Otherwise just go to Command Processor - ENDIF + ENDIF ;FASTWB IF BANKED COMMON /B2RAM/ @@ -77,7 +101,8 @@ CBOOT: DI ; Disable interrupt system ; system bank and will be dynamically sized during Cold Boot. This permits ; BPCNFG to configure a generic IMG file for specific Hard Drive Partitions. -CBOOT0: LD HL,BRAME ; Get end of banked RAM +CBOOT0: + LD HL,BRAME ; Get end of banked RAM LD (HISAV),HL ; and save for later use IF HARDDSK LD HL,DPHTBL ; Point to start of DPH Table @@ -92,14 +117,14 @@ DYNLP: LD E,(HL) DEC DE ; Else back up Ptr to Driver DEC DE LD A,(DE) ; Get driver # - IF RAMDSK - DEC A - DEC A ; Hard Disk (Driver 2)? - JR Z,ADDSIZ ; ..jump if so - DEC A ; RAM Disk (Driver 3)? - ELSE +; IF RAMDSK +; DEC A +; DEC A ; Hard Disk (Driver 2)? +; JR Z,ADDSIZ ; ..jump if so +; DEC A ; RAM Disk (Driver 3)? +; ELSE CP 2 ; Hard Disk (Driver 2)? - ENDIF ; Ramdsk +; ENDIF ; Ramdsk JR NZ,DYNCHK ; ..jump to end if Not ADDSIZ: PUSH BC ; Save loop counter PUSH HL ; and ptr to DPH @@ -137,7 +162,7 @@ DVRAME: SRL D ; Divide by 2 DYNCHK: DJNZ DYNLP ; Loop til all 16 tested ENDIF ;harddsk - + IF BANKED LD DE,USP ; Point above critical Bios Ram storage ELSE @@ -146,7 +171,7 @@ DYNCHK: DJNZ DYNLP ; Loop til all 16 tested IF Z3 LD HL,(ENVADR) ; And top of memory ELSE - LD HL,0FFFFH + LD HL,MEMTOP ENDIF SBC HL,DE ; Calculate # bytes to clear (CF already clr) EX DE,HL ; Ptr to HL, Cnt to DE @@ -156,7 +181,7 @@ Clr0: LD (HL),0 LD A,D OR E JR NZ,Clr0 ; ..loop til all cleared - + ; In systems where we have enough space, we clear unused High Memory too IF NOT MOVCPM @@ -184,7 +209,7 @@ ATTOP: LD A,H OR L JR NZ,BMOVE ; ..jump if we already have one - ENDIF ; (Always move Env if using MOVCPM type load) + ENDIF ; NOT MOVCPM ; (Always move Env if using MOVCPM type load) LD HL,Z3ENV ; Else set up pointers LD (ENVADR),HL LD DE,ENV @@ -202,11 +227,11 @@ ATTOP: BMOVE: IF NOT MOVCPM ; No need to set values on Boot Track System LD DE,(ENVADR) ; Get pointer to ENV - IF HAVIOP + IF HAVIOP LD HL,0FH ; Set offset to IOP Addr in ENV CALL CALCOF ; get the addr and size LD (IOPPTR),HL ; and set addr - ENDIF ;haviop + ENDIF ;haviop LD HL,18H ; Set offset to Mult Comnd Line in ENV CALL CALCOF ; get addr and size LD (CLPTR),HL ; set addr @@ -222,10 +247,10 @@ BMOVE: LD (PTHPTR),HL ; and set ENDIF ;Movcpm IF FASTWB ; Do we restore CPR from Bank? - IF MOVCPM + IF MOVCPM LD DE,BIOSJT-1600H ; Get CPR Starting Addr LD HL,0800H ; and Default Length - ELSE + ELSE LD HL,(ENVADR) ; Get pointer to ENV start LD DE,3FH ; offset to CPR start ADD HL,DE @@ -237,11 +262,11 @@ BMOVE: LD L,0 ; convert to Word SRL H ; Compute Blks * 128 RR L ; to give HL = CPR length in bytes - ENDIF ;~Movcpm + ENDIF ; Movcpm - ; - ; SETUP FOR FASTWB - ; +; +; SETUP FOR FASTWB +; LD (CPLEN),HL ; Save command processor length LD (CPADR),DE ; Save command processor address (in TPA) @@ -267,12 +292,12 @@ BLKMV: POP BC ; And number of bytes to move ; Allocate disk buffer in HBIOS bank and ; save it for use later in disk access. - LD B,0F6H ; BIOS FUNC: ALLOCATE HEAP MEMORY - LD HL,512 ; 1 SECTOR, 512 BYTES - CALL HBX_INVOKE ; DO IT - CALL NZ,PANIC ; HANDLE ERROR - LD (HB_DSKBUF),HL ; RECORD THE BUFFER ADDRESS - + LD B,HBF_ALLOC ; HBIOS Func: ALLOCATE Heap Memory + LD HL,512 ; 1 Sector, 512 Bytes + CALL HBX_INVOKE ; Do it + CALL NZ,PANIC ; Handle error + LD (HB_DSKBUF),HL ; Record the buffer address + IF HAVIOP LD HL,IOPRET LD (BIOSJT+1),HL @@ -302,77 +327,74 @@ BLKMV: POP BC ; And number of bytes to move MEMOK: CALL PRINT IF MOVCPM ; Space is critical for boot tracks - DEFB CR,LF,'P112 - ' ; Save all bytes possible + DEFB CR,LF,'RetroB' ; Save all bytes possible ELSE ; Otherwise sign on with complete name - DEFB CR,LF,'RomWBW - ' - ENDIF - DEFB 'B/P 50.00k Bios' ;**** Do NOT alter this string **** + DEFB CR,LF,'Retro-Brew ' +; IF SBC +; DEFB ' SBC V1/2 ' +; ENDIF ;SBC +; IF SIMH +; DEFB 'ON SimH ' +; ENDIF ;SIMH +; IF ZETA +; DEFB ' ZETA ' +; ENDIF ;ZETA +; IF N8 +; DEFB ' N8 ' +; ENDIF ;N8 +; IF MK4 +; DEFB ' Mark IV ' +; ENDIF ;MK4 + ENDIF ; MOVCPM + DEFB 'B/P 50.00k Bios' ;**** Do NOT alter this string **** DEFB ' V',VERS/16+'0','.',VERS MOD 16+'0',' ' ; Vers in BCD DATE IF BANKED DEFB ' (Banked) ' ELSE - IF NOT MOVCPM + IF NOT MOVCPM DEFB ' (Non-Banked) ' ; Nothing for boot track system - ENDIF - ENDIF - IF BANKED + ENDIF ;NOT MOVCPM + ENDIF ; Banked DEFB ' with:',CR,LF,LF DEFB ' ZCPR3+ Env' - IF CLOCK - IF DS1202 + IF CLOCK DEFB CR,LF,' RomWBW HBIOS Clock, ' - IF CLKSET + IF CLKSET DEFB 'with ' - ELSE + ELSE DEFB 'NO ' - ENDIF + ENDIF ; CLKSET DEFB 'Set' - ELSE - DEFB CR,LF,' ZSDOS Interrupt Clock' - ENDIF - ENDIF + ENDIF ; Clock DEFB CR,LF,' High-Density Floppy' - IF FDDMA + IF FDDMA DEFB ' (DMA-driven IO)' - ELSE + ELSE DEFB ' (Polled IO)' - ENDIF - IF HARDDSK - IF SCSI - DEFB CR,LF,' SCSI Hard Disk Driver' - ENDIF - IF IDE - DEFB CR,LF,' GIDE Hard Disk Driver' - ENDIF - IF SIMHDSK - DEFB CR,LF,' SIMH Hard Disk Driver' - ENDIF - IF HBDSK + ENDIF ; FDDMA + IF HARDDSK DEFB CR,LF,' HBIOS Hard Disk Driver' - ENDIF - IF HDDMA + IF HDDMA DEFB ' (DMA-driven IO)' - ELSE + ELSE DEFB ' (Polled IO)' - ENDIF - ENDIF - IF FASTWB + ENDIF ;HDDMA + ENDIF ; HARDDSK + IF FASTWB DEFB CR,LF,' Warm Boot from RAM' - ENDIF - IF RAMDSK - DEFB CR,LF,' RAM Disk (M:)' - ENDIF - IF BIOERM + ENDIF ;FASTWB +; IF RAMDSK + DEFB CR,LF,' RAM Disk (A:)' +; ENDIF ;RAMDSK + IF BIOERM DEFB CR,LF,' Full Error Messages' - ENDIF - ENDIF ;Banked + ENDIF ;BIOERM DEFB CR,LF+80H -;WW EI ; Turn Interrupts back on + EI ; Turn Interrupts back on RET ; ..and return - ;..... ; Offset to and get ENV Address and respective element size @@ -385,6 +407,112 @@ CALCOF: ADD HL,DE ; Add offset to Base ENV Addr LD H,(HL) ; and grab LD L,C ; Ptr to Segment now in HL RET ; return to caller + +;..... +; HBIOS Initialization + +HB_INIT: + IF HB_DEBUG AND FALSE + CALL PRTSTRD + DEFB '[HB_INIT]',CR,LF,'$' + ENDIF + + ;; Setup RST 08 vector + ;LD A,0C3H ; $C3 = JP + ;LD (08H),A + ;LD HL,HBX_INVOKE + ;LD (09H),HL + + ;IF BANKED + ; + ;; Copy vectors from TPA page zero to SYS page zero + ;LD BC,(TPABNK) ; C := TPABNK, B := SYSBNK + ;CALL XMOVE ; Set source/dest banks for copy + ;LD HL,0 ; Source address is zero + ;LD DE,0 ; Destination address is zero + ;LD BC,40H ; Copy 40H bytes + ;CALL MOVE ; Do it + ; + ;ENDIF ;BANKED + + IF HB_DEBUG + + CALL NEWLINE2 + LD DE,HB_STR_TAG + CALL WRITESTR + + LD DE,HB_STR_CSEG + CALL WRITESTR + LD BC,ORG_CSEG + CALL PRTHEXWORD + LD DE,HB_STR_DSEG + CALL WRITESTR + LD BC,ORG_DSEG + CALL PRTHEXWORD + + IF BANKED + LD DE,HB_STR_BANK2 + CALL WRITESTR + LD BC,ORG_BANK2 + CALL PRTHEXWORD + LD DE,HB_STR_B2RAM + CALL WRITESTR + LD BC,ORG_B2RAM + CALL PRTHEXWORD + LD DE,HB_STR_RESVD + CALL WRITESTR + LD BC,ORG_RESVD + CALL PRTHEXWORD + ENDIF ;BANKED + + CALL NEWLINE + + ENDIF ; [HB_DEBUG] + + ; Update RAM and ROM DPB for true RAM/ROM sizes + LD BC,HBF_MEMINFO ; HBIOS Memory Information + CALL HBX_INVOKE ; Do it, D=ROM Banks, E=RAM Banks + PUSH DE ; Save results + LD HL,DPBROM+4 ; EXM byte of ROM DPB + LD A,D ; ROM bank count to accum + SUB HB_ROMRESV ; Less reserved ROM banks + CALL HB_FIXDPB ; Adjust ROM DPB + POP DE ; Recover memory info + LD HL,DPBRAM+4 ; EXM byte of RAM DPB + LD A,E ; ROM bank count to accum + SUB HB_RAMRESV ; Less reserved RAM banks + CALL HB_FIXDPB ; Adjust RAM DPB + RET + +HB_FIXDPB: + CP 16 ; 16 banks = 256 blocks + LD E,0 ; Init EXM value to zero + RL E ; Put CF in E + LD (HL),E ; Save EXM + LD D,0 ; Init blk cnt to bank cnt + LD E,A ; " + LD B,4 ; Multiply by 4 +HB_FIXDPB1: + SLA E ; ... to convert to + RL D ; ... 2K block cnt + DJNZ HB_FIXDPB1 ; Loop + DEC DE ; Convert to blk cnt - 1 + INC HL ; Point to LSB of DSM + LD (HL),E ; Save LSB + INC HL ; Point to MSB of DSM + LD (HL),D ; Save it + RET + + IF HB_DEBUG + +HB_STR_TAG: DB "HBIOS: $" +HB_STR_CSEG: DB "CSEG=$" +HB_STR_DSEG: DB ", DSEG=$" +HB_STR_BANK2: DB ", BANK2=$" +HB_STR_B2RAM: DB ", B2RAM=$" +HB_STR_RESVD: DB ", RESVD=$" + + ENDIF ; HB_DEBUG ; Block Move Parameters @@ -404,13 +532,13 @@ PTHPTR: DEFW EXPATH DEFW IOPLEN+2 DEFW IOPENT IOPPTR: DEFW IOP - ENDIF + ENDIF ;HAVIOP ; IF HARDDSK AND HDDMA AND (NOT IDE) ; DEFW DMALEN ; DEFW DMADAT ; DEFW DMATBL -; ENDIF +; ENDIF ;HARDDSK AND HDDMA AND (NOT IDE) BLOCKE EQU $ @@ -470,7 +598,7 @@ ENV1: ; ZCPR3 enviornment descriptor ... DEFB 0 ; Crt selection () DEFB 0 ; Printer selection () DEFB 80 ; Crt 0: width - DEFB 24 ; # of lines + DEFB 25 ; # of lines DEFB 22 ; # of text lines ; In Extended ENV, CRT 1 is replaced by System Info @@ -659,4 +787,5 @@ HISAV: DEFS 2 ; Storage for Hi-ALV address BTTBL: DEFS 8 ; Initial WB DMA Block ENDIF ;======================== End of CBOOT ============================= - \ No newline at end of file + + \ No newline at end of file diff --git a/Source/BPBIOS/deblock.z80 b/Source/BPBIOS/deblock.z80 index a252c18e..35dc4cbd 100644 --- a/Source/BPBIOS/deblock.z80 +++ b/Source/BPBIOS/deblock.z80 @@ -1,6 +1,7 @@ ;************************************************************************** ; DEBLOCK - Disk Deblocking Buffer Routines. (Based on CP/M Example code) ; +; 1.1 - 14 Jun 16 - eliminated unnecessary disk accessess WW ; 1.0 - 3 Jul 92 - First General Release. HFB ; 0.0 - 8 Jul 91 - Initial Test Release. HFB ;************************************************************************** @@ -267,7 +268,9 @@ MATCH: LD A,(SECMSK) ; Get the sector mask ; ; Modified to use HBIOS host buffer ; - LD A,BID_HB ; HSTBUF is in HBIOS + ; HSTBUF is always in HBIOS bank where I/O is done + LD A,(TPABNK) ; TPA BANK + DEC A ; HBIOS bank is one below LD C,A IF BANKED LD A,(DMABNK) ; Set Read Destination Bank @@ -281,8 +284,7 @@ MATCH: LD A,(SECMSK) ; Get the sector mask LD A,B ; Else reverse banks LD B,C LD C,A -OKBNKS: CALL HBX_XCOPY ; Set source & destination banks -; LD DE,HBBUF ; Host buffer address in HBIOS bank +OKBNKS: CALL HB_XMOVE ; Set source & destination banks LD DE,(HB_DSKBUF) ; Host buffer address in HBIOS bank ADD HL,DE ; Point to the sector LD DE,(DMAADR) ; User's buffer @@ -299,17 +301,19 @@ OKBNKS: CALL HBX_XCOPY ; Set source & destination banks ; Move the data -RWMOVE: CALL HBX_COPY ; Handle possible inter-bank move +RWMOVE: + CALL HB_MOVE ; Handle possible inter-bank move ELSE ; HBIOS - IF BANKED - IF INROM + + IF BANKED + IF INROM LD A,(TPABNK) ; If bank in ROM, HSTBUF is in TPA LD C,A - ELSE + ELSE LD A,(SYSBNK) ; If bank in RAM, HSTBUF is in System Bank LD C,A - ENDIF + ENDIF ;INROM LD A,(DMABNK) ; Set Read Destination Bank LD B,A LD A,(READOP) ; Direction? @@ -319,7 +323,7 @@ RWMOVE: CALL HBX_COPY ; Handle possible inter-bank move LD B,C LD C,A OKBNKS: CALL XMOVE ; Set source & destination banks - ENDIF + ENDIF ;BANKED LD DE,HSTBUF ; Host buffer address ADD HL,DE ; Point to the sector LD DE,(DMAADR) ; User's buffer @@ -413,4 +417,4 @@ UNASEC: DEFS 1 ; Current record UNACNT: DEFS 1 ; Unallocated record count ;========================= End of DEBLOCK ================================= - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/deblock.z80.sav b/Source/BPBIOS/deblock.z80.sav deleted file mode 100644 index a32d5c4b..00000000 --- a/Source/BPBIOS/deblock.z80.sav +++ /dev/null @@ -1,317 +0,0 @@ -;************************************************************************** -; DEBLOCK - Disk Deblocking Buffer Routines. (Based on CP/M Example code) -; -; 1.0 - 3 Jul 92 - First General Release. HFB -; 0.0 - 8 Jul 91 - Initial Test Release. HFB -;************************************************************************** - - CSEG -;..... -; Set DMA address given by registers B and C - -SETDMA: LD (DMAADR),BC ; Save the address - RET - -;..... -; Set track given by BC. While the entire word is saved here, only the -; lower byte is used in Floppy, SCSI and RAM Drivers. - -SETTRK: LD (SEKTRK),BC - RET - -;..... -; Set sector given by register C. This Sector number is the physical number -; of the desired sector and assumes that SECTRAN has been called. This value -; should reflect the Sector Number returned from SECTRAN. While the entire -; word is saved here, only the lower byte is used in Floppy, SCSI and RAM. - -SETSEC: LD (SEKSEC),BC - ;..fall thru to Return.. -;..... -; Home the selected drive - -HOME: RET ; Done by SELDSK - -;..... -; Flush the host buffer to disk if any writes pending - -FLUSH: LD A,(HSTWRT) ; Write pending? - OR A - RET Z ; ..quit if nothing pending - IF BANKED - CALL BIOSTK - CALL GOSYSB - ENDIF - JP WRITEHST ; Write host buffer to disk if so - -;..... -; Sector blocking and de-blocking routines. Drive numbers used in these -; routines are logical drives. - -READ: - IF BANKED - CALL BIOSTK - CALL GOSYSB - JP JBREAD - - COMMON /BANK2/ - ENDIF - -BREAD: LD A,1 ; Non-zero - LD (READOP),A ; Read operation - INC A ; Treat as un-allocated (=wrual) - LD (WRTYPE),A ; Save it - JR ALLOC ; Go to common code - - - CSEG -WRITE: - IF BANKED - CALL BIOSTK - CALL GOSYSB - JP JBWRT - - COMMON /BANK2/ - ENDIF - -BWRT: XOR A - LD (READOP),A ; Write operation - LD A,C ; Get write type from dos - LD (WRTYPE),A ; Save it - CP WRUAL ; Unallocated write? - JR NZ,CHKUNA ; ..jump if Not. check for unallocated sector - -; Write to un-allocated sector, set parameters - - LD A,(UCOUNT) ; Records/allocation group - LD (UNACNT),A ; Unallocated count - LD HL,SEKDSK ; Selcted disk, track & sector for us - LD DE,UNADSK ; (unadsk=sekdsk) - LD BC,4 ; (unatrk=sektrk) - LDIR ; (unasec=cpmsec) - -CHKUNA: LD A,(UNACNT) ; Any unallocated records remaining? - OR A - JR Z,ALLOC ; ..jump if none remain - -; More unallocated records remain. Check for any change. - - DEC A ; Decrement unallocated count - LD (UNACNT),A ; And save it - LD B,4 ; Compare four bytes - LD HL,UNADSK ; Compare Old Disk, Track & Sector - LD DE,SEKDSK ; .to New Disk, Track & Sector -SLP0: LD A,(DE) - CP (HL) ; Same? - JR NZ,ALLOC ; ..jump if not - INC HL ; Else advance to next - INC DE - DJNZ SLP0 ; ..and loop til done - -; Everything matches, anticipate the next sector - - INC (HL) ; Unasec+1 - LD A,(CPMSPT) ; Max sectors per track - CP (HL) ; Compare them - JR NZ,NOOVF ; ..jump if not ready for new track yet - -; Overflow to next track - - LD (HL),0 ; Unasec = 0 - LD HL,(UNATRK) - INC HL - LD (UNATRK),HL ; Unatrk+1 - -; Match found. Pre-read not necessary. - -NOOVF: XOR A ; Indicate no pre-read required - JR ALLOC1 ; ..and jump to common code - -; Not an unallocated record. Requires pre-read - -ALLOC: XOR A ; Clear acc - LD (UNACNT),A ; Start over - INC A -ALLOC1: LD (RSFLAG),A ; Force pre-read if a=1 - -; Read/Write common code - - XOR A ; Clear acc - LD (ERFLAG),A ; Start with no errors - LD A,(SEKSEC) ; Get logical sector number - CALL PHYSEC ; Get physical sector - LD (SEKHST),A ; Physical sector (rel 0) - -; Check host active - - LD HL,HSTACT ; Host active flag - LD A,(HL) ; Get it - LD (HL),1 ; Set it in any case - OR A ; Set flags - JR Z,FILHST ; Flush Host Buffer if needed, then Read - -; Host buffer is active. Same as seek buffer? - - LD B,3 ; Loop compare of Disk and Track - LD HL,HSTDSK ; Compare Old Logical Disk & Trk - LD DE,SEKDSK ; .to New Logical Disk & Trk -SLP1: LD A,(DE) - CP (HL) ; Same? - JR NZ,FILHST ; ..jump if not same - INC HL ; Else advance to next - INC DE - DJNZ SLP1 ; ..loop til done - -; Same track. Same host sector? - - LD A,(SEKHST) ; New physical sector - CP (HL) - JR Z,MATCH ; The same - -; Not a match. - -FILHST: CALL FLUSH ; Empty hstbuf if write pending - -; Fill the host buffer if necessary. - - LD HL,SEKDSK ; Hstdsk=sekdsk - LD DE,HSTDSK ; Hsttrk=sektrk - LD BC,3 - LDIR ; Move it - LD A,(SEKHST) ; Move the Sector too - LD (DE),A - INC DE - INC HL - INC HL ; Skip over logical sector - LD C,4 ; B=0 from above - LDIR ; Set Host DPH and DPB, physical sector - - LD A,(RSFLAG) ; Pre-read necessary? - OR A - CALL NZ,READHST ; Read a sector if so. - XOR A ; Clear acc - LD (HSTWRT),A ; Clear write pending flag - -; We have a match. - -MATCH: LD A,(SECMSK) ; Get the sector mask - LD B,A ; Save it - LD A,(SEKSEC) ; Get new sector - AND B ; Mask off the high bits - RRA - LD H,A ; *128 MSB - LD L,0 - RR L ; And LSB - -; HL now has relative host buffer address of seksec - - IF BANKED - IF INROM - LD A,(TPABNK) ; If bank in ROM, HSTBUF is in TPA - LD C,A - ELSE - LD A,(SYSBNK) ; If bank in RAM, HSTBUF is in System Bank - LD C,A - ENDIF - LD A,(DMABNK) ; Set Read Destination Bank - LD B,A - LD A,(READOP) ; Direction? - OR A - JR NZ,OKBNKS ; ..jump if read - LD A,B ; Else reverse banks - LD B,C - LD C,A -OKBNKS: CALL XMOVE ; Set source & destination banks - ENDIF - LD DE,HSTBUF ; Host buffer address - ADD HL,DE ; Point to the sector - LD DE,(DMAADR) ; User's buffer - LD BC,128 ; Number of bytes to transfer - LD A,(READOP) ; Direction? - OR A ; Set flags - JR NZ,RWMOVE ; ..jump if Read - -; Must be Write. Mark and change direction. - - INC A ; A = 1 - LD (HSTWRT),A ; Set write pending flag - EX DE,HL ; Swap source and destination - -; Move the data - -RWMOVE: CALL MOVE ; Handle possible inter-bank move - -; Data has been moved - - LD A,(WRTYPE) - DEC A ; Directory write? set zero flag - LD A,(ERFLAG) ; In case of error - RET NZ ; ..go home if not a directory write - -; This was a Directory Write. Write it now! - - OR A ; Check error flag - RET NZ ; ..exit here if any error - LD (HSTWRT),A ; Clear write pending flag - CALL WRITEHST ; Write to disk - LD A,(ERFLAG) ; .Load resulting status - RET ; ..return it to caller - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Blocking/De-blocking variables -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - DSEG ; These variables must ALWAYS be visable, so put here -;..... -; Parameters relating to what we need in the Buffer Next - -SEKSEC: DEFS 2 ; New skewed logical sector to seek - -; --- The Following Variables MUST be kept in this order --- -SEKDSK: DEFS 1 ; New disk -SEKTRK: DEFS 2 ; New track -CPMSEC: DEFS 2 ; New logical sector -SEKDPB: DEFS 2 ; DPB for host -SEKDPH: DEFS 2 ; DPH for host -SEKHST: DEFS 1 ; New host physical sector to seek -;----------------------------------------------------------- -; Parameters relating to what's in the Buffer Now - -; --- The Following Variables MUST be kept in this order --- -HSTDSK: DEFS 1 ; Current disk -HSTTRK: DEFS 2 ; Current track -HSTSEC: DEFS 1 ; Current physical sector -HSTDPB: DEFS 2 ; DPB for host -HSTDPH: DEFS 2 ; DPH for host - -HSTACT: DEFS 1 ; Host buffer active flag -HSTWRT: DEFS 1 ; Host buffer write pending flag -;----------------------------------------------------------- - -UCOUNT: DEFS 1 ; Number of logical records per alloc block -CPMSPT: DEFS 2 ; Logical sectors per track (byte) -SECSHF: DEFS 1 ; Sector shift factor -SECMSK: DEFS 1 ; Sector mask -DMAADR: DEFS 2 ; User's DMA buffer - - IF BANKED AND NOT INROM - COMMON /B2RAM/ ; These values only used internally, bank them! - ENDIF - -RSFLAG: DEFS 1 ; Read sector flag 0=skip, 1=read -READOP: DEFS 1 ; Read operation flag 1=read, 0=write -WRTYPE: DEFS 1 ; Write type 0=allocated, 1=dir, 2=unallocated - -;..... -; Parameters to track Pre-Read Requirements - -; --- The Following Variables MUST be kept in this order --- -UNADSK: DEFS 1 ; Current disk -UNATRK: DEFS 2 ; Current track -UNASEC: DEFS 1 ; Current record -;----------------------------------------------------------- - -UNACNT: DEFS 1 ; Unallocated record count - -;========================= End of DEBLOCK ================================= - \ No newline at end of file diff --git a/Source/BPBIOS/def-dx.lib b/Source/BPBIOS/def-dx.lib deleted file mode 100644 index 480af62b..00000000 --- a/Source/BPBIOS/def-dx.lib +++ /dev/null @@ -1,367 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '30 Aug 01' ; Date of this version - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU NO ; Is this a banked BIOS? -ZSDOS2 EQU yes ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU yes ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU yes ; Include IOP code into Jump table? - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU YES ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer - -;--- Character Device Section --- - -MORDEV EQU yes ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU true ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU true ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU true ; Include ASCI1 Driver? -BUFFA1 EQU true ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU yes ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU yes ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU no ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU yes ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU yes ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only -IDE EQU no ; YES = Use IDE Driver, NO = Use SCSI -HDDMA EQU yes ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU yes ; Hard Disk Physical Unit 2 -UNIT_2 EQU NO ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU yes ; Set each of these equates for the drive and -DRV_B EQU yes ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU yes -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU no -DRV_J EQU no -DRV_K EQU no -DRV_L EQU no - IF RAMDSK -DRV_M EQU yes ; This is Yes for RAM drive - ELSE -DRV_M EQU no ; This is for drive if No RAM Drive present - ENDIF -DRV_N EQU yes -DRV_O EQU yes -DRV_P EQU yes - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU no ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU 08H ; First TPA Bank (switched in/out) 40000H -BNK1 EQU 09H ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU 0AH ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 0BH ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU 0CH ; First Bank for RAM disk 60000H -BNKM EQU 1FH ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 98H ;R Receiver Buffer -_THR EQU 98H ;W Transmit Holding Reg -_IER EQU 99H ;RW Interrupt-Enable Reg -_IIR EQU 9AH ;R Interrupt Ident. Reg -_FCR EQU 9AH ;W FIFO Control Reg -_LCR EQU 9BH ;RW Line Control Reg -_MCR EQU 9CH ;RW Modem Control Reg -_LSR EQU 9DH ;RW Line Status Reg -_MMSR EQU 9EH ;RW Modem Status Reg -_SCR EQU 9FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 98H ;RW Divisor LSB | wih DLAB -_DLM EQU 99H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/def-ww-z33.lib b/Source/BPBIOS/def-ww-z33.lib new file mode 100644 index 00000000..d5b833ad --- /dev/null +++ b/Source/BPBIOS/def-ww-z33.lib @@ -0,0 +1,365 @@ +;:::::::::::::::::::::::::::::::::::::::::::::::********************** +; B/P BIOS Configuration and Equate File. ** System Dependant ** +; - Retro-Brew boards /w RomWBW HBIOS - ********************** +; Tailored for Non-banked, external HBIOS proxy System +; Custom tailor your system here. +; +; 02 May 18 - changes made to conform with HBIOS v 2.9.1p2 WW+LN +; 04 Sep 16 - Mods for RomWBW V 2.8 WW+LN +; 30 Apr 15 - changes made to conform with v 2.7.2 of RomWBW WW+LN +; 17 Jan 14 - Initial N8VEM release WW+LN +; 30 Aug 01 - Cleaned up for GPL release. HFB +; 11 May 97 - Added GIDE and adjusted HD equates. HFB +; 5 Jan 97 - Reformatted to Standard. HFB +; 10 Jun 96 - Initial Test Release. HFB +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; BIOS Configuration Equates and Macros + +DATE MACRO + DEFB '07 Oct 21' ; Date of this version + ENDM +AUTOCL MACRO + DEFB 8,'ZEX Z33 ',0 ; Autostart command line + ENDM + +;--- Basic System and Z-System Section --- + +MOVCPM EQU NO ; Integrate into MOVCPM "type" loader? + IF MOVCPM +VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) + ELSE +VERS EQU 21H ; Version number w/Device Swapping permitted + ENDIF +BANKED EQU NO ; Is this a banked BIOS? +ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible +INROM EQU NO ; Alternate bank in ROM? +MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) +FASTWB EQU YES ; Yes if restoring CPR from banked RAM + ; ..No if restoring from Drive A +Z3 EQU YES ; Include ZCPR init code? +HAVIOP EQU NO ; Include IOP code into Jump table? + +;--- Memory configuration Section --- (Expansion Memory configured here) + +IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) + ; No = Include Common RAM transfer buffer + +;--- Character Device Section --- + +MORDEV EQU NO ; YES = Include any extra Char Device Drivers + ; NO = Only use the 4 defined Char Devices + +QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) + ; ..must be 2^n with n<8 +RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? +XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? + +;--- Clock and Time Section --- + +CLOCK EQU YES ; Include ZSDOS Clock Driver Code? +CLKSET EQU YES ; Allow Clock Sets? (Error if No) + +;--- Floppy Diskette Section --- + +FLPYDSK EQU NO ; YES = Make Floppy-Disk Code, NO = No code made + +BIOERM EQU yes ; Print BIOS error messages? +CALCSK EQU YES ; Calculate skew table? +AUTOSL EQU YES ; Auto select floppy formats? + ; If AUTOSL=True, the next two are active... +FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? +FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? +FLOPY8 EQU no ; Include 8" Floppy Formats? +MORDPB EQU NO ; Include additional Floppy DPB Formats? + +;;--- RAM Disk Section --- +; +;RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made + +;--- Hard Disk Section --- + +HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only + ; (Pick 1 of 3 options below) +HBDSK EQU YES ; YES = Use HBIOS Disk Driver +HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? + ; (DMA not implemented for GIDE) +UNIT_0 EQU YES ; Hard Disk Physical Unit 1 +UNIT_1 EQU YES ; Hard Disk Physical Unit 2 +UNIT_2 EQU YES ; Hard Disk Physical Unit 3 + +;--- Logical Drive Section --- +; +; Set each of these equates for the drive and partition complement of +; your system. Set equates to no if drive exists or is wanted. + +DRV_A EQU yes ; A is always RAMDSK on HBIOS Device 0. +DRV_B EQU yes ; B is always ROMDSK on HBIOS Device 1. +DRV_C EQU yes +DRV_D EQU yes +DRV_E EQU yes ; Default is C-J are Hard Disk Slices +DRV_F EQU yes ; on the first hard drive (room for +DRV_G EQU yes ; up to 8 Slices provided) e.g. CF card. +DRV_H EQU yes +DRV_I EQU yes +DRV_J EQU yes +DRV_K EQU yes ; Default is K-N are Hard Disk Slices +DRV_L EQU yes ; on a second hard drive (room for up to +DRV_M EQU yes ; 4 Slices provided) e.g. SD card +DRV_N EQU yes + if FLPYDSK +DRV_O EQU yes ; O & P are floppies +DRV_P EQU yes + else +DRV_O EQU no ; O & P are floppies +DRV_P EQU no + endif + +;========== Configuration Unique Equates =========== +;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< +;>>> Do NOT Alter these unless you KNOW what you're doing <<< +;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +REFRSH EQU NO ; Set to NO for only Static RAM, needed for + ; systems with dynamic RAMs. +NOWAIT EQU NO ; Set to NO to use configured Wait States in + ; Hard Disk Driver. Yes to eliminate Waits. + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; +; RomWBW HBIOS sets these values at runtime during startup. +; +BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H +BNK1 EQU BID_COM ; Second TPA Bank (Common Bank) 48000H +BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H +BNKU EQU 00H ; User Area Bank 58000H + ; (set to 0 to disable) +BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H +BNKM EQU BID_RAMM ; Maximum Bank # F8000H + + IF NO ; REMOVE CODE - NOT NEEDED WITH HBIOS makes a + ; nice resource for Z180 programing in general +;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== + +CNTLA0 EQU 00H ; Control Port ASCI 0 +CNTLA1 EQU 01H ; Control Port ASCI 1 +STAT0 EQU 04H ; Serial port 0 Status +STAT1 EQU 05H ; Serial port 1 Status +TDR0 EQU 06H ; Serial port 0 Output Data +TDR1 EQU 07H ; Serial port 1 Output Data +RDR0 EQU 08H ; Serial port 0 Input Data +RDR1 EQU 09H ; Serial Port 1 Input Data +CNTR EQU 0AH ; HD64180 Counter port +TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) +TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) +RLDR0L EQU 0EH ; CTC0 Reload Count, Low +RLDR0H EQU 0FH ; CTC0 Reload Count, High +TCR EQU 10H ; Interrupt Control Register +TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) +TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) +RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) +RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) +FRC EQU 18H ; Free-Running Counter +CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) +SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) +MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) +DSTAT EQU 30H ; DMA Status/Control port +DMODE EQU 31H ; DMA Mode Control port +DCNTL EQU 32H ; DMA/WAIT Control Register +IL EQU 33H ; Interrupt Segment Register +ITC EQU 34H ; Interrupt/Trap Control Register +RCR EQU 36H ; HD64180 Refresh Control register +CBR EQU 38H ; MMU Common Base Register +BBR EQU 39H ; MMU Bank Base Register +CBAR EQU 3AH ; MMU Common/Bank Area Register +OMCR EQU 3EH ; Operation Mode Control Reg +ICR EQU 3FH ; I/O Control Register + +; Some bit definitions used with the Z-180 on-chip peripherals: + +TDRE EQU 02H ; ACSI Transmitter Buffer Empty +RDRF EQU 80H ; ACSI Received Character available + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Extended Features of Z80182 for P112 + +WSGCS EQU 0D8H ; Wait-State Generator CS +ENH182 EQU 0D9H ; Z80182 Enhancements Register +PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register +RAMUBR EQU 0E6H ; RAM End Boundary +RAMLBR EQU 0E7H ; RAM Start Boundary +ROMBR EQU 0E8H ; ROM Boundary +FIFOCTL EQU 0E9H ; FIFO Control Register +RTOTC EQU 0EAH ; RX Time-Out Time Constant +TTOTC EQU 0EBH ; TX Time-Out Time Constant +FCR EQU 0ECH ; FIFO Register +SCR EQU 0EFH ; System Pin Control +RBR EQU 0F0H ; MIMIC RX Buffer Register (R) +THR EQU 0F0H ; MIMIN TX Holding Register (W) +IER EQU 0F1H ; Interrupt Enable Register +LCR EQU 0F3H ; Line Control Register +MCR EQU 0F4H ; Modem Control Register +LSR EQU 0F5H ; Line Status Register +MDMSR EQU 0F6H ; Modem Status Register +MSCR EQU 0F7H ; MIMIC Scratch Register +DLATL EQU 0F8H ; Divisor Latch (Low) +DLATM EQU 0F9H ; Divisor Latch (High) +TTCR EQU 0FAH ; TX Time Constant +RTCR EQU 0FBH ; RX Time Constant +IVEC EQU 0FCH ; MIMIC Interrupt Vector +MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register +IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register +MMCR EQU 0FFH ; MIMIC Master Control Register + +; Z80182 PIO Registers + +DDRA EQU 0EDH ; Data Direction Register A +DRA EQU 0EEH ; Port A Data +DDRB EQU 0E4H ; Data Direction Register B +DRB EQU 0E5H ; Data B Data +DDRC EQU 0DDH ; Data Direction Register C +DRC EQU 0DEH ; Data C Data + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; ESCC Registers on Z80182 + +SCCACNT EQU 0E0H ; ESCC Control Channel A +SCCAD EQU 0E1H ; ESCC Data Channel A +SCCBCNT EQU 0E2H ; ESCC Control Channel B +SCCBD EQU 0E3H ; ESCC Data Channel B + +; [E]SCC Internal Register Definitions + +RR0 EQU 00H +RR1 EQU 01H +RR2 EQU 02H +RR3 EQU 03H +RR6 EQU 06H +RR7 EQU 07H +RR10 EQU 0AH +RR12 EQU 0CH +RR13 EQU 0DH +RR15 EQU 0FH + +WR0 EQU 00H +WR1 EQU 01H +WR2 EQU 02H +WR3 EQU 03H +WR4 EQU 04H +WR5 EQU 05H +WR6 EQU 06H +WR7 EQU 07H +WR9 EQU 09H +WR10 EQU 0AH +WR11 EQU 0BH +WR12 EQU 0CH +WR13 EQU 0DH +WR14 EQU 0EH +WR15 EQU 0FH + +; FDC37C665/6 Parallel Port in Standard AT Mode + +DPORT EQU 8CH ; Data Port +SPORT EQU 8DH ; Status Port +CPORT EQU 8EH ; Control Port + +; FDC37C665/6 Configuration Control (access internal registers) + +CFCNTL EQU 90H ; Configuration control port +CFDATA EQU 91H ; Configuration data port + +; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) + +DCR EQU 92H ; Drive Control Register (Digital Output) +MSR EQU 94H ; Main Status Register +DR EQU 95H ; Data/Command Register +DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 + +_DMA EQU 0A0H ; Diskette DMA Address + +; FDC37C665/6 Serial Port (National 16550 compatible) + +_RBR EQU 68H ;R Receiver Buffer +_THR EQU 68H ;W Transmit Holding Reg +_IER EQU 69H ;RW Interrupt-Enable Reg +_IIR EQU 6AH ;R Interrupt Ident. Reg +_FCR EQU 6AH ;W FIFO Control Reg +_LCR EQU 6BH ;RW Line Control Reg +_MCR EQU 6CH ;RW Modem Control Reg +_LSR EQU 6DH ;RW Line Status Reg +_MMSR EQU 6EH ;RW Modem Status Reg +_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) +_DDL EQU 68H ;RW Divisor LSB | wih DLAB +_DLM EQU 69H ;RW Divisor MSB | set High + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Equates for the National DP8490/NCR 5380 Prototype SCSI controller + + IF HARDDSK +NCR EQU 40H ; Base of NCR 5380 + +; 5380 Chip Registers + +NCRDAT EQU NCR ; Current SCSI Data (Read) + ; Output Data Register (Write) +NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) +NCRMOD EQU NCR+2 ; Mode Register (Read/Write) +NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) +NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) +NCRST EQU NCR+5 ; Bus & Status Register (Read) + ; Start DMA Send (Write) +NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) + ; Start DMA Initiator Receive (Write) +DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) + +; Bit Assignments for NCR 5380 Ports as indicated + +B_ARST EQU 10000000B ; Assert *RST (NCRCMD) +B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) +B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) +B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) + +B_BSY EQU 01000000B ; *Busy (NCRBUS) +B_REQ EQU 00100000B ; *Request (NCRBUS) +B_MSG EQU 00010000B ; *Message (NCRBUS) +B_CD EQU 00001000B ; *Command/Data (NCRBUS) +B_IO EQU 00000100B ; *I/O (NCRBUS) +B_SEL EQU 00000010B ; *Select (NCRBUS) + +B_PHAS EQU 00001000B ; Phase Match (NCRST) +B_BBSY EQU 00000100B ; Bus Busy (NCRST) + +B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) +B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) + ENDIF ;harddsk + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) +; Set the base GIDE equate to the jumper setting on the GIDE board. + + IF IDE +GIDE EQU 50H ; Set base of 16 byte address range + +IDEDOR EQU GIDE+6 ; Digital Output Register +IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) +IDEErr EQU GIDE+9 ; IDE Error Register +IDESCnt EQU GIDE+0AH ; IDE Sector Count Register +IDESNum EQU GIDE+0BH ; IDE Sector Number Register +IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) +IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) +IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register +IDECmd EQU GIDE+0FH ; IDE Command/Status Register + +CMDHOM EQU 10H ; Home Drive Heads +CMDRD EQU 20H ; Read Sector Command (w/retry) +CMDWR EQU 30H ; Write Sector Command (w/retry) +CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) +CMDFMT EQU 50H ; Format Track Command +CMDDIAG EQU 90H ; Execute Diagnostics Command +CMDINIT EQU 91H ; Initialize Drive Params Command +CMDPW0 EQU 0E0H ; Low Range of Power Control Commands +CMDPW3 EQU 0E3H ; High Range of Power Control Commands +CMDPWQ EQU 0E5H ; Power Status Query Command +CMDID EQU 0ECH ; Read Drive Ident Data Command + ENDIF ;ide +;=================== End Unique Equates ======================= + ENDIF ; REMOVE CODE diff --git a/Source/BPBIOS/def-ww-z33bnk.lib b/Source/BPBIOS/def-ww-z33bnk.lib new file mode 100644 index 00000000..aaae6bf8 --- /dev/null +++ b/Source/BPBIOS/def-ww-z33bnk.lib @@ -0,0 +1,365 @@ +;:::::::::::::::::::::::::::::::::::::::::::::::********************** +; B/P BIOS Configuration and Equate File. ** System Dependant ** +; - Retro-Brew boards /w RomWBW HBIOS - ********************** +; Setup for a banked bios, external HBIOS proxy System +; Custom tailor your system here. +; +; 02 May 18 - changes made to conform with HBIOS v 2.9.1p2 WW+LN +; 04 Sep 16 - Mods for RomWBW V 2.8 WW+LN +; 30 Apr 15 - changes made to conform with v 2.7.2 of RomWBW WW+LN +; 17 Jan 14 - Initial N8VEM release WW+LN +; 30 Aug 01 - Cleaned up for GPL release. HFB +; 11 May 97 - Added GIDE and adjusted HD equates. HFB +; 5 Jan 97 - Reformatted to Standard. HFB +; 10 Jun 96 - Initial Test Release. HFB +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; BIOS Configuration Equates and Macros + +DATE MACRO + DEFB '07 Oct 21' ; Date of this version + ENDM +AUTOCL MACRO + DEFB 8,'ZEX Z33 ',0 ; Autostart command line + ENDM + +;--- Basic System and Z-System Section --- + +MOVCPM EQU NO ; Integrate into MOVCPM "type" loader? + IF MOVCPM +VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) + ELSE +VERS EQU 21H ; Version number w/Device Swapping permitted + ENDIF +BANKED EQU YES ; Is this a banked BIOS? +ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible +INROM EQU NO ; Alternate bank in ROM? +MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) +FASTWB EQU YES ; Yes if restoring CPR from banked RAM + ; ..No if restoring from Drive A +Z3 EQU YES ; Include ZCPR init code? +HAVIOP EQU NO ; Include IOP code into Jump table? + +;--- Memory configuration Section --- (Expansion Memory configured here) + +IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) + ; No = Include Common RAM transfer buffer + +;--- Character Device Section --- + +MORDEV EQU NO ; YES = Include any extra Char Device Drivers + ; NO = Only use the 4 defined Char Devices + +QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) + ; ..must be 2^n with n<8 +RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? +XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? + +;--- Clock and Time Section --- + +CLOCK EQU YES ; Include ZSDOS Clock Driver Code? +CLKSET EQU YES ; Allow Clock Sets? (Error if No) + +;--- Floppy Diskette Section --- + +FLPYDSK EQU NO ; YES = Make Floppy-Disk Code, NO = No code made + +BIOERM EQU yes ; Print BIOS error messages? +CALCSK EQU YES ; Calculate skew table? +AUTOSL EQU YES ; Auto select floppy formats? + ; If AUTOSL=True, the next two are active... +FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? +FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? +FLOPY8 EQU no ; Include 8" Floppy Formats? +MORDPB EQU NO ; Include additional Floppy DPB Formats? + +;;--- RAM Disk Section --- +; +;RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made + +;--- Hard Disk Section --- + +HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only + ; (Pick 1 of 3 options below) +HBDSK EQU YES ; YES = Use HBIOS Disk Driver +HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? + ; (DMA not implemented for GIDE) +UNIT_0 EQU YES ; Hard Disk Physical Unit 1 +UNIT_1 EQU YES ; Hard Disk Physical Unit 2 +UNIT_2 EQU YES ; Hard Disk Physical Unit 3 + +;--- Logical Drive Section --- +; +; Set each of these equates for the drive and partition complement of +; your system. Set equates to no if drive exists or is wanted. + +DRV_A EQU yes ; A is always RAMDSK on HBIOS Device 0. +DRV_B EQU yes ; B is always ROMDSK on HBIOS Device 1. +DRV_C EQU yes +DRV_D EQU yes +DRV_E EQU yes ; Default is C-J are Hard Disk Slices +DRV_F EQU yes ; on the first hard drive (room for +DRV_G EQU yes ; up to 8 Slices provided) e.g. CF card. +DRV_H EQU yes +DRV_I EQU yes +DRV_J EQU yes +DRV_K EQU yes ; Default is K-N are Hard Disk Slices +DRV_L EQU yes ; on a second hard drive (room for up to +DRV_M EQU yes ; 4 Slices provided) e.g. SD card +DRV_N EQU yes + if FLPYDSK +DRV_O EQU yes ; O & P are floppies +DRV_P EQU yes + else +DRV_O EQU no ; O & P are floppies +DRV_P EQU no + endif + +;========== Configuration Unique Equates =========== +;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< +;>>> Do NOT Alter these unless you KNOW what you're doing <<< +;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +REFRSH EQU NO ; Set to NO for only Static RAM, needed for + ; systems with dynamic RAMs. +NOWAIT EQU NO ; Set to NO to use configured Wait States in + ; Hard Disk Driver. Yes to eliminate Waits. + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; +; RomWBW HBIOS sets these values at runtime during startup. +; +BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H +BNK1 EQU BID_COM ; Second TPA Bank (Common Bank) 48000H +BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H +BNKU EQU 00H ; User Area Bank 58000H + ; (set to 0 to disable) +BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H +BNKM EQU BID_RAMM ; Maximum Bank # F8000H + + IF NO ; REMOVE CODE - NOT NEEDED WITH HBIOS makes a + ; nice resource for Z180 programing in general +;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== + +CNTLA0 EQU 00H ; Control Port ASCI 0 +CNTLA1 EQU 01H ; Control Port ASCI 1 +STAT0 EQU 04H ; Serial port 0 Status +STAT1 EQU 05H ; Serial port 1 Status +TDR0 EQU 06H ; Serial port 0 Output Data +TDR1 EQU 07H ; Serial port 1 Output Data +RDR0 EQU 08H ; Serial port 0 Input Data +RDR1 EQU 09H ; Serial Port 1 Input Data +CNTR EQU 0AH ; HD64180 Counter port +TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) +TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) +RLDR0L EQU 0EH ; CTC0 Reload Count, Low +RLDR0H EQU 0FH ; CTC0 Reload Count, High +TCR EQU 10H ; Interrupt Control Register +TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) +TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) +RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) +RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) +FRC EQU 18H ; Free-Running Counter +CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) +SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) +MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) +DSTAT EQU 30H ; DMA Status/Control port +DMODE EQU 31H ; DMA Mode Control port +DCNTL EQU 32H ; DMA/WAIT Control Register +IL EQU 33H ; Interrupt Segment Register +ITC EQU 34H ; Interrupt/Trap Control Register +RCR EQU 36H ; HD64180 Refresh Control register +CBR EQU 38H ; MMU Common Base Register +BBR EQU 39H ; MMU Bank Base Register +CBAR EQU 3AH ; MMU Common/Bank Area Register +OMCR EQU 3EH ; Operation Mode Control Reg +ICR EQU 3FH ; I/O Control Register + +; Some bit definitions used with the Z-180 on-chip peripherals: + +TDRE EQU 02H ; ACSI Transmitter Buffer Empty +RDRF EQU 80H ; ACSI Received Character available + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Extended Features of Z80182 for P112 + +WSGCS EQU 0D8H ; Wait-State Generator CS +ENH182 EQU 0D9H ; Z80182 Enhancements Register +PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register +RAMUBR EQU 0E6H ; RAM End Boundary +RAMLBR EQU 0E7H ; RAM Start Boundary +ROMBR EQU 0E8H ; ROM Boundary +FIFOCTL EQU 0E9H ; FIFO Control Register +RTOTC EQU 0EAH ; RX Time-Out Time Constant +TTOTC EQU 0EBH ; TX Time-Out Time Constant +FCR EQU 0ECH ; FIFO Register +SCR EQU 0EFH ; System Pin Control +RBR EQU 0F0H ; MIMIC RX Buffer Register (R) +THR EQU 0F0H ; MIMIN TX Holding Register (W) +IER EQU 0F1H ; Interrupt Enable Register +LCR EQU 0F3H ; Line Control Register +MCR EQU 0F4H ; Modem Control Register +LSR EQU 0F5H ; Line Status Register +MDMSR EQU 0F6H ; Modem Status Register +MSCR EQU 0F7H ; MIMIC Scratch Register +DLATL EQU 0F8H ; Divisor Latch (Low) +DLATM EQU 0F9H ; Divisor Latch (High) +TTCR EQU 0FAH ; TX Time Constant +RTCR EQU 0FBH ; RX Time Constant +IVEC EQU 0FCH ; MIMIC Interrupt Vector +MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register +IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register +MMCR EQU 0FFH ; MIMIC Master Control Register + +; Z80182 PIO Registers + +DDRA EQU 0EDH ; Data Direction Register A +DRA EQU 0EEH ; Port A Data +DDRB EQU 0E4H ; Data Direction Register B +DRB EQU 0E5H ; Data B Data +DDRC EQU 0DDH ; Data Direction Register C +DRC EQU 0DEH ; Data C Data + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; ESCC Registers on Z80182 + +SCCACNT EQU 0E0H ; ESCC Control Channel A +SCCAD EQU 0E1H ; ESCC Data Channel A +SCCBCNT EQU 0E2H ; ESCC Control Channel B +SCCBD EQU 0E3H ; ESCC Data Channel B + +; [E]SCC Internal Register Definitions + +RR0 EQU 00H +RR1 EQU 01H +RR2 EQU 02H +RR3 EQU 03H +RR6 EQU 06H +RR7 EQU 07H +RR10 EQU 0AH +RR12 EQU 0CH +RR13 EQU 0DH +RR15 EQU 0FH + +WR0 EQU 00H +WR1 EQU 01H +WR2 EQU 02H +WR3 EQU 03H +WR4 EQU 04H +WR5 EQU 05H +WR6 EQU 06H +WR7 EQU 07H +WR9 EQU 09H +WR10 EQU 0AH +WR11 EQU 0BH +WR12 EQU 0CH +WR13 EQU 0DH +WR14 EQU 0EH +WR15 EQU 0FH + +; FDC37C665/6 Parallel Port in Standard AT Mode + +DPORT EQU 8CH ; Data Port +SPORT EQU 8DH ; Status Port +CPORT EQU 8EH ; Control Port + +; FDC37C665/6 Configuration Control (access internal registers) + +CFCNTL EQU 90H ; Configuration control port +CFDATA EQU 91H ; Configuration data port + +; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) + +DCR EQU 92H ; Drive Control Register (Digital Output) +MSR EQU 94H ; Main Status Register +DR EQU 95H ; Data/Command Register +DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 + +_DMA EQU 0A0H ; Diskette DMA Address + +; FDC37C665/6 Serial Port (National 16550 compatible) + +_RBR EQU 68H ;R Receiver Buffer +_THR EQU 68H ;W Transmit Holding Reg +_IER EQU 69H ;RW Interrupt-Enable Reg +_IIR EQU 6AH ;R Interrupt Ident. Reg +_FCR EQU 6AH ;W FIFO Control Reg +_LCR EQU 6BH ;RW Line Control Reg +_MCR EQU 6CH ;RW Modem Control Reg +_LSR EQU 6DH ;RW Line Status Reg +_MMSR EQU 6EH ;RW Modem Status Reg +_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) +_DDL EQU 68H ;RW Divisor LSB | wih DLAB +_DLM EQU 69H ;RW Divisor MSB | set High + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Equates for the National DP8490/NCR 5380 Prototype SCSI controller + + IF HARDDSK +NCR EQU 40H ; Base of NCR 5380 + +; 5380 Chip Registers + +NCRDAT EQU NCR ; Current SCSI Data (Read) + ; Output Data Register (Write) +NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) +NCRMOD EQU NCR+2 ; Mode Register (Read/Write) +NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) +NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) +NCRST EQU NCR+5 ; Bus & Status Register (Read) + ; Start DMA Send (Write) +NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) + ; Start DMA Initiator Receive (Write) +DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) + +; Bit Assignments for NCR 5380 Ports as indicated + +B_ARST EQU 10000000B ; Assert *RST (NCRCMD) +B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) +B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) +B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) + +B_BSY EQU 01000000B ; *Busy (NCRBUS) +B_REQ EQU 00100000B ; *Request (NCRBUS) +B_MSG EQU 00010000B ; *Message (NCRBUS) +B_CD EQU 00001000B ; *Command/Data (NCRBUS) +B_IO EQU 00000100B ; *I/O (NCRBUS) +B_SEL EQU 00000010B ; *Select (NCRBUS) + +B_PHAS EQU 00001000B ; Phase Match (NCRST) +B_BBSY EQU 00000100B ; Bus Busy (NCRST) + +B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) +B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) + ENDIF ;harddsk + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) +; Set the base GIDE equate to the jumper setting on the GIDE board. + + IF IDE +GIDE EQU 50H ; Set base of 16 byte address range + +IDEDOR EQU GIDE+6 ; Digital Output Register +IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) +IDEErr EQU GIDE+9 ; IDE Error Register +IDESCnt EQU GIDE+0AH ; IDE Sector Count Register +IDESNum EQU GIDE+0BH ; IDE Sector Number Register +IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) +IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) +IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register +IDECmd EQU GIDE+0FH ; IDE Command/Status Register + +CMDHOM EQU 10H ; Home Drive Heads +CMDRD EQU 20H ; Read Sector Command (w/retry) +CMDWR EQU 30H ; Write Sector Command (w/retry) +CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) +CMDFMT EQU 50H ; Format Track Command +CMDDIAG EQU 90H ; Execute Diagnostics Command +CMDINIT EQU 91H ; Initialize Drive Params Command +CMDPW0 EQU 0E0H ; Low Range of Power Control Commands +CMDPW3 EQU 0E3H ; High Range of Power Control Commands +CMDPWQ EQU 0E5H ; Power Status Query Command +CMDID EQU 0ECH ; Read Drive Ident Data Command + ENDIF ;ide +;=================== End Unique Equates ======================= + ENDIF ; REMOVE CODE diff --git a/Source/BPBIOS/def-ww-z33n.lib b/Source/BPBIOS/def-ww-z33n.lib deleted file mode 100644 index 3b3faf84..00000000 --- a/Source/BPBIOS/def-ww-z33n.lib +++ /dev/null @@ -1,374 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '17 Jan 14' ; Date of this version - ENDM - -AUTOCL MACRO - DEFB 8,'ZEX Z33 ',0 ; Autostart command line - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU NO ; Is this a banked BIOS? -ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU YES ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU NO ; Include IOP code into Jump table? -INTPXY EQU YES ; Internal HBIOS Mini Proxy -CONF_T EQU NO ; Set for Segment Configuration T -CONF_N EQU YES ; Set for Segment Configuration N - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer - -;--- Character Device Section --- - -MORDEV EQU NO ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU NO ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU false ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU false ; Include ASCI1 Driver? -BUFFA1 EQU false ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU YES ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU YES ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only - ; (Pick 1 of 3 options below) -SCSI EQU NO ; YES = Use SCSI Driver -IDE EQU NO ; YES = Use IDE Driver -SIMHDSK EQU NO ; YES = Use SIMH HDSK Driver -HBDSK EQU YES ; YES = Use HBIOS Disk Driver -HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU YES ; Hard Disk Physical Unit 2 -UNIT_2 EQU YES ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU no ; Set each of these equates for the drive and -DRV_B EQU no ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU no -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU yes -DRV_J EQU yes -DRV_K EQU yes -DRV_L EQU yes -DRV_M EQU RAMDSK ; This is Yes for RAM drive -DRV_N EQU yes -DRV_O EQU ~RAMDSK ; Use HBIOS RAM disk if BPBIOS RAM disk is not enabled -DRV_P EQU no - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU NO ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H -BNK1 EQU BID_HB ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 00H ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H -BNKM EQU BID_RAMM ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 68H ;R Receiver Buffer -_THR EQU 68H ;W Transmit Holding Reg -_IER EQU 69H ;RW Interrupt-Enable Reg -_IIR EQU 6AH ;R Interrupt Ident. Reg -_FCR EQU 6AH ;W FIFO Control Reg -_LCR EQU 6BH ;RW Line Control Reg -_MCR EQU 6CH ;RW Modem Control Reg -_LSR EQU 6DH ;RW Line Status Reg -_MMSR EQU 6EH ;RW Modem Status Reg -_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 68H ;RW Divisor LSB | wih DLAB -_DLM EQU 69H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/def-ww-z33nbnk.lib b/Source/BPBIOS/def-ww-z33nbnk.lib deleted file mode 100644 index c8d940da..00000000 --- a/Source/BPBIOS/def-ww-z33nbnk.lib +++ /dev/null @@ -1,374 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '17 Jan 14' ; Date of this version - ENDM - -AUTOCL MACRO - DEFB 8,'ZEX Z33 ',0 ; Autostart command line - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU YES ; Is this a banked BIOS? -ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU YES ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU NO ; Include IOP code into Jump table? -INTPXY EQU YES ; Internal HBIOS Mini Proxy -CONF_T EQU NO ; Set for Segment Configuration T -CONF_N EQU YES ; Set for Segment Configuration N - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer - -;--- Character Device Section --- - -MORDEV EQU NO ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU no ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU false ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU false ; Include ASCI1 Driver? -BUFFA1 EQU false ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU YES ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU YES ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only - ; (Pick 1 of 3 options below) -SCSI EQU NO ; YES = Use SCSI Driver -IDE EQU NO ; YES = Use IDE Driver -SIMHDSK EQU NO ; YES = Use SIMH HDSK Driver -HBDSK EQU YES ; YES = Use HBIOS Disk Driver -HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU YES ; Hard Disk Physical Unit 2 -UNIT_2 EQU YES ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU no ; Set each of these equates for the drive and -DRV_B EQU no ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU no -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU yes -DRV_J EQU yes -DRV_K EQU yes -DRV_L EQU yes -DRV_M EQU RAMDSK ; This is Yes for RAM drive -DRV_N EQU yes -DRV_O EQU ~RAMDSK ; Use HBIOS RAM disk if BPBIOS RAM disk is not enabled -DRV_P EQU no - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU NO ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H -BNK1 EQU BID_HB ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 00H ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H -BNKM EQU BID_RAMM ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 68H ;R Receiver Buffer -_THR EQU 68H ;W Transmit Holding Reg -_IER EQU 69H ;RW Interrupt-Enable Reg -_IIR EQU 6AH ;R Interrupt Ident. Reg -_FCR EQU 6AH ;W FIFO Control Reg -_LCR EQU 6BH ;RW Line Control Reg -_MCR EQU 6CH ;RW Modem Control Reg -_LSR EQU 6DH ;RW Line Status Reg -_MMSR EQU 6EH ;RW Modem Status Reg -_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 68H ;RW Divisor LSB | wih DLAB -_DLM EQU 69H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/def-ww-z33t.lib b/Source/BPBIOS/def-ww-z33t.lib deleted file mode 100644 index 2c296319..00000000 --- a/Source/BPBIOS/def-ww-z33t.lib +++ /dev/null @@ -1,374 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '17 Jan 14' ; Date of this version - ENDM - -AUTOCL MACRO - DEFB 8,'ZEX Z33 ',0 ; Autostart command line - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU NO ; Is this a banked BIOS? -ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU YES ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU NO ; Include IOP code into Jump table? -INTPXY EQU NO ; Internal HBIOS Mini Proxy -CONF_T EQU YES ; Set for Segment Configuration T -CONF_N EQU NO ; Set for Segment Configuration N - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer - -;--- Character Device Section --- - -MORDEV EQU NO ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU NO ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU false ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU false ; Include ASCI1 Driver? -BUFFA1 EQU false ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU YES ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU YES ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only - ; (Pick 1 of 3 options below) -SCSI EQU NO ; YES = Use SCSI Driver -IDE EQU NO ; YES = Use IDE Driver -SIMHDSK EQU NO ; YES = Use SIMH HDSK Driver -HBDSK EQU YES ; YES = Use HBIOS Disk Driver -HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU YES ; Hard Disk Physical Unit 2 -UNIT_2 EQU YES ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU no ; Set each of these equates for the drive and -DRV_B EQU no ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU no -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU yes -DRV_J EQU yes -DRV_K EQU yes -DRV_L EQU yes -DRV_M EQU RAMDSK ; This is Yes for RAM drive -DRV_N EQU yes -DRV_O EQU ~RAMDSK ; Use HBIOS RAM disk if BPBIOS RAM disk is not enabled -DRV_P EQU no - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU NO ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H -BNK1 EQU BID_HB ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 00H ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H -BNKM EQU BID_RAMM ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 68H ;R Receiver Buffer -_THR EQU 68H ;W Transmit Holding Reg -_IER EQU 69H ;RW Interrupt-Enable Reg -_IIR EQU 6AH ;R Interrupt Ident. Reg -_FCR EQU 6AH ;W FIFO Control Reg -_LCR EQU 6BH ;RW Line Control Reg -_MCR EQU 6CH ;RW Modem Control Reg -_LSR EQU 6DH ;RW Line Status Reg -_MMSR EQU 6EH ;RW Modem Status Reg -_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 68H ;RW Divisor LSB | wih DLAB -_DLM EQU 69H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/def-ww-z33tbnk.lib b/Source/BPBIOS/def-ww-z33tbnk.lib deleted file mode 100644 index ffca7b09..00000000 --- a/Source/BPBIOS/def-ww-z33tbnk.lib +++ /dev/null @@ -1,374 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '17 Jan 14' ; Date of this version - ENDM - -AUTOCL MACRO - DEFB 8,'ZEX Z33 ',0 ; Autostart command line - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU YES ; Is this a banked BIOS? -ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU YES ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU NO ; Include IOP code into Jump table? -INTPXY EQU NO ; Internal HBIOS Mini Proxy -CONF_T EQU YES ; Set for Segment Configuration T -CONF_N EQU NO ; Set for Segment Configuration N - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer - -;--- Character Device Section --- - -MORDEV EQU NO ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU no ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU false ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU false ; Include ASCI1 Driver? -BUFFA1 EQU false ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU YES ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU YES ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only - ; (Pick 1 of 3 options below) -SCSI EQU NO ; YES = Use SCSI Driver -IDE EQU NO ; YES = Use IDE Driver -SIMHDSK EQU NO ; YES = Use SIMH HDSK Driver -HBDSK EQU YES ; YES = Use HBIOS Disk Driver -HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU YES ; Hard Disk Physical Unit 2 -UNIT_2 EQU YES ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU no ; Set each of these equates for the drive and -DRV_B EQU no ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU no -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU yes -DRV_J EQU yes -DRV_K EQU yes -DRV_L EQU yes -DRV_M EQU RAMDSK ; This is Yes for RAM drive -DRV_N EQU yes -DRV_O EQU ~RAMDSK ; Use HBIOS RAM disk if BPBIOS RAM disk is not enabled -DRV_P EQU no - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU NO ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H -BNK1 EQU BID_HB ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 00H ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H -BNKM EQU BID_RAMM ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 68H ;R Receiver Buffer -_THR EQU 68H ;W Transmit Holding Reg -_IER EQU 69H ;RW Interrupt-Enable Reg -_IIR EQU 6AH ;R Interrupt Ident. Reg -_FCR EQU 6AH ;W FIFO Control Reg -_LCR EQU 6BH ;RW Line Control Reg -_MCR EQU 6CH ;RW Modem Control Reg -_LSR EQU 6DH ;RW Line Status Reg -_MMSR EQU 6EH ;RW Modem Status Reg -_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 68H ;RW Divisor LSB | wih DLAB -_DLM EQU 69H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/def-ww-z34.lib b/Source/BPBIOS/def-ww-z34.lib new file mode 100644 index 00000000..d848a30b --- /dev/null +++ b/Source/BPBIOS/def-ww-z34.lib @@ -0,0 +1,365 @@ +;:::::::::::::::::::::::::::::::::::::::::::::::********************** +; B/P BIOS Configuration and Equate File. ** System Dependant ** +; - Retro-Brew boards /w RomWBW HBIOS - ********************** +; Tailored for Non-banked, external HBIOS proxy System +; Custom tailor your system here. +; +; 02 May 18 - changes made to conform with HBIOS v 2.9.1p2 WW+LN +; 04 Sep 16 - Mods for RomWBW V 2.8 WW+LN +; 30 Apr 15 - changes made to conform with v 2.7.2 of RomWBW WW+LN +; 17 Jan 14 - Initial N8VEM release WW+LN +; 30 Aug 01 - Cleaned up for GPL release. HFB +; 11 May 97 - Added GIDE and adjusted HD equates. HFB +; 5 Jan 97 - Reformatted to Standard. HFB +; 10 Jun 96 - Initial Test Release. HFB +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; BIOS Configuration Equates and Macros + +DATE MACRO + DEFB '07 Oct 21' ; Date of this version + ENDM +AUTOCL MACRO + DEFB 8,'ZEX ZST ',0 ; Autostart command line + ENDM + +;--- Basic System and Z-System Section --- + +MOVCPM EQU NO ; Integrate into MOVCPM "type" loader? + IF MOVCPM +VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) + ELSE +VERS EQU 21H ; Version number w/Device Swapping permitted + ENDIF +BANKED EQU NO ; Is this a banked BIOS? +ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible +INROM EQU NO ; Alternate bank in ROM? +MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) +FASTWB EQU YES ; Yes if restoring CPR from banked RAM + ; ..No if restoring from Drive A +Z3 EQU YES ; Include ZCPR init code? +HAVIOP EQU NO ; Include IOP code into Jump table? + +;--- Memory configuration Section --- (Expansion Memory configured here) + +IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) + ; No = Include Common RAM transfer buffer + +;--- Character Device Section --- + +MORDEV EQU NO ; YES = Include any extra Char Device Drivers + ; NO = Only use the 4 defined Char Devices + +QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) + ; ..must be 2^n with n<8 +RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? +XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? + +;--- Clock and Time Section --- + +CLOCK EQU YES ; Include ZSDOS Clock Driver Code? +CLKSET EQU YES ; Allow Clock Sets? (Error if No) + +;--- Floppy Diskette Section --- + +FLPYDSK EQU NO ; YES = Make Floppy-Disk Code, NO = No code made + +BIOERM EQU yes ; Print BIOS error messages? +CALCSK EQU YES ; Calculate skew table? +AUTOSL EQU YES ; Auto select floppy formats? + ; If AUTOSL=True, the next two are active... +FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? +FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? +FLOPY8 EQU no ; Include 8" Floppy Formats? +MORDPB EQU NO ; Include additional Floppy DPB Formats? + +;;--- RAM Disk Section --- +; +;RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made + +;--- Hard Disk Section --- + +HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only + ; (Pick 1 of 3 options below) +HBDSK EQU YES ; YES = Use HBIOS Disk Driver +HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? + ; (DMA not implemented for GIDE) +UNIT_0 EQU YES ; Hard Disk Physical Unit 1 +UNIT_1 EQU YES ; Hard Disk Physical Unit 2 +UNIT_2 EQU YES ; Hard Disk Physical Unit 3 + +;--- Logical Drive Section --- +; +; Set each of these equates for the drive and partition complement of +; your system. Set equates to no if drive exists or is wanted. + +DRV_A EQU yes ; A is always RAMDSK on HBIOS Device 0. +DRV_B EQU yes ; B is always ROMDSK on HBIOS Device 1. +DRV_C EQU yes +DRV_D EQU yes +DRV_E EQU yes ; Default is C-J are Hard Disk Slices +DRV_F EQU yes ; on the first hard drive (room for +DRV_G EQU yes ; up to 8 Slices provided) e.g. CF card. +DRV_H EQU yes +DRV_I EQU yes +DRV_J EQU yes +DRV_K EQU yes ; Default is K-N are Hard Disk Slices +DRV_L EQU yes ; on a second hard drive (room for up to +DRV_M EQU yes ; 4 Slices provided) e.g. SD card +DRV_N EQU yes + if FLPYDSK +DRV_O EQU yes ; O & P are floppies +DRV_P EQU yes + else +DRV_O EQU no ; O & P are floppies +DRV_P EQU no + endif + +;========== Configuration Unique Equates =========== +;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< +;>>> Do NOT Alter these unless you KNOW what you're doing <<< +;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +REFRSH EQU NO ; Set to NO for only Static RAM, needed for + ; systems with dynamic RAMs. +NOWAIT EQU NO ; Set to NO to use configured Wait States in + ; Hard Disk Driver. Yes to eliminate Waits. + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; +; RomWBW HBIOS sets these values at runtime during startup. +; +BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H +BNK1 EQU BID_COM ; Second TPA Bank (Common Bank) 48000H +BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H +BNKU EQU 00H ; User Area Bank 58000H + ; (set to 0 to disable) +BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H +BNKM EQU BID_RAMM ; Maximum Bank # F8000H + + IF NO ; REMOVE CODE - NOT NEEDED WITH HBIOS makes a + ; nice resource for Z180 programing in general +;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== + +CNTLA0 EQU 00H ; Control Port ASCI 0 +CNTLA1 EQU 01H ; Control Port ASCI 1 +STAT0 EQU 04H ; Serial port 0 Status +STAT1 EQU 05H ; Serial port 1 Status +TDR0 EQU 06H ; Serial port 0 Output Data +TDR1 EQU 07H ; Serial port 1 Output Data +RDR0 EQU 08H ; Serial port 0 Input Data +RDR1 EQU 09H ; Serial Port 1 Input Data +CNTR EQU 0AH ; HD64180 Counter port +TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) +TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) +RLDR0L EQU 0EH ; CTC0 Reload Count, Low +RLDR0H EQU 0FH ; CTC0 Reload Count, High +TCR EQU 10H ; Interrupt Control Register +TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) +TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) +RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) +RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) +FRC EQU 18H ; Free-Running Counter +CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) +SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) +MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) +DSTAT EQU 30H ; DMA Status/Control port +DMODE EQU 31H ; DMA Mode Control port +DCNTL EQU 32H ; DMA/WAIT Control Register +IL EQU 33H ; Interrupt Segment Register +ITC EQU 34H ; Interrupt/Trap Control Register +RCR EQU 36H ; HD64180 Refresh Control register +CBR EQU 38H ; MMU Common Base Register +BBR EQU 39H ; MMU Bank Base Register +CBAR EQU 3AH ; MMU Common/Bank Area Register +OMCR EQU 3EH ; Operation Mode Control Reg +ICR EQU 3FH ; I/O Control Register + +; Some bit definitions used with the Z-180 on-chip peripherals: + +TDRE EQU 02H ; ACSI Transmitter Buffer Empty +RDRF EQU 80H ; ACSI Received Character available + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Extended Features of Z80182 for P112 + +WSGCS EQU 0D8H ; Wait-State Generator CS +ENH182 EQU 0D9H ; Z80182 Enhancements Register +PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register +RAMUBR EQU 0E6H ; RAM End Boundary +RAMLBR EQU 0E7H ; RAM Start Boundary +ROMBR EQU 0E8H ; ROM Boundary +FIFOCTL EQU 0E9H ; FIFO Control Register +RTOTC EQU 0EAH ; RX Time-Out Time Constant +TTOTC EQU 0EBH ; TX Time-Out Time Constant +FCR EQU 0ECH ; FIFO Register +SCR EQU 0EFH ; System Pin Control +RBR EQU 0F0H ; MIMIC RX Buffer Register (R) +THR EQU 0F0H ; MIMIN TX Holding Register (W) +IER EQU 0F1H ; Interrupt Enable Register +LCR EQU 0F3H ; Line Control Register +MCR EQU 0F4H ; Modem Control Register +LSR EQU 0F5H ; Line Status Register +MDMSR EQU 0F6H ; Modem Status Register +MSCR EQU 0F7H ; MIMIC Scratch Register +DLATL EQU 0F8H ; Divisor Latch (Low) +DLATM EQU 0F9H ; Divisor Latch (High) +TTCR EQU 0FAH ; TX Time Constant +RTCR EQU 0FBH ; RX Time Constant +IVEC EQU 0FCH ; MIMIC Interrupt Vector +MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register +IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register +MMCR EQU 0FFH ; MIMIC Master Control Register + +; Z80182 PIO Registers + +DDRA EQU 0EDH ; Data Direction Register A +DRA EQU 0EEH ; Port A Data +DDRB EQU 0E4H ; Data Direction Register B +DRB EQU 0E5H ; Data B Data +DDRC EQU 0DDH ; Data Direction Register C +DRC EQU 0DEH ; Data C Data + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; ESCC Registers on Z80182 + +SCCACNT EQU 0E0H ; ESCC Control Channel A +SCCAD EQU 0E1H ; ESCC Data Channel A +SCCBCNT EQU 0E2H ; ESCC Control Channel B +SCCBD EQU 0E3H ; ESCC Data Channel B + +; [E]SCC Internal Register Definitions + +RR0 EQU 00H +RR1 EQU 01H +RR2 EQU 02H +RR3 EQU 03H +RR6 EQU 06H +RR7 EQU 07H +RR10 EQU 0AH +RR12 EQU 0CH +RR13 EQU 0DH +RR15 EQU 0FH + +WR0 EQU 00H +WR1 EQU 01H +WR2 EQU 02H +WR3 EQU 03H +WR4 EQU 04H +WR5 EQU 05H +WR6 EQU 06H +WR7 EQU 07H +WR9 EQU 09H +WR10 EQU 0AH +WR11 EQU 0BH +WR12 EQU 0CH +WR13 EQU 0DH +WR14 EQU 0EH +WR15 EQU 0FH + +; FDC37C665/6 Parallel Port in Standard AT Mode + +DPORT EQU 8CH ; Data Port +SPORT EQU 8DH ; Status Port +CPORT EQU 8EH ; Control Port + +; FDC37C665/6 Configuration Control (access internal registers) + +CFCNTL EQU 90H ; Configuration control port +CFDATA EQU 91H ; Configuration data port + +; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) + +DCR EQU 92H ; Drive Control Register (Digital Output) +MSR EQU 94H ; Main Status Register +DR EQU 95H ; Data/Command Register +DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 + +_DMA EQU 0A0H ; Diskette DMA Address + +; FDC37C665/6 Serial Port (National 16550 compatible) + +_RBR EQU 68H ;R Receiver Buffer +_THR EQU 68H ;W Transmit Holding Reg +_IER EQU 69H ;RW Interrupt-Enable Reg +_IIR EQU 6AH ;R Interrupt Ident. Reg +_FCR EQU 6AH ;W FIFO Control Reg +_LCR EQU 6BH ;RW Line Control Reg +_MCR EQU 6CH ;RW Modem Control Reg +_LSR EQU 6DH ;RW Line Status Reg +_MMSR EQU 6EH ;RW Modem Status Reg +_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) +_DDL EQU 68H ;RW Divisor LSB | wih DLAB +_DLM EQU 69H ;RW Divisor MSB | set High + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Equates for the National DP8490/NCR 5380 Prototype SCSI controller + + IF HARDDSK +NCR EQU 40H ; Base of NCR 5380 + +; 5380 Chip Registers + +NCRDAT EQU NCR ; Current SCSI Data (Read) + ; Output Data Register (Write) +NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) +NCRMOD EQU NCR+2 ; Mode Register (Read/Write) +NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) +NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) +NCRST EQU NCR+5 ; Bus & Status Register (Read) + ; Start DMA Send (Write) +NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) + ; Start DMA Initiator Receive (Write) +DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) + +; Bit Assignments for NCR 5380 Ports as indicated + +B_ARST EQU 10000000B ; Assert *RST (NCRCMD) +B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) +B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) +B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) + +B_BSY EQU 01000000B ; *Busy (NCRBUS) +B_REQ EQU 00100000B ; *Request (NCRBUS) +B_MSG EQU 00010000B ; *Message (NCRBUS) +B_CD EQU 00001000B ; *Command/Data (NCRBUS) +B_IO EQU 00000100B ; *I/O (NCRBUS) +B_SEL EQU 00000010B ; *Select (NCRBUS) + +B_PHAS EQU 00001000B ; Phase Match (NCRST) +B_BBSY EQU 00000100B ; Bus Busy (NCRST) + +B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) +B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) + ENDIF ;harddsk + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) +; Set the base GIDE equate to the jumper setting on the GIDE board. + + IF IDE +GIDE EQU 50H ; Set base of 16 byte address range + +IDEDOR EQU GIDE+6 ; Digital Output Register +IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) +IDEErr EQU GIDE+9 ; IDE Error Register +IDESCnt EQU GIDE+0AH ; IDE Sector Count Register +IDESNum EQU GIDE+0BH ; IDE Sector Number Register +IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) +IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) +IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register +IDECmd EQU GIDE+0FH ; IDE Command/Status Register + +CMDHOM EQU 10H ; Home Drive Heads +CMDRD EQU 20H ; Read Sector Command (w/retry) +CMDWR EQU 30H ; Write Sector Command (w/retry) +CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) +CMDFMT EQU 50H ; Format Track Command +CMDDIAG EQU 90H ; Execute Diagnostics Command +CMDINIT EQU 91H ; Initialize Drive Params Command +CMDPW0 EQU 0E0H ; Low Range of Power Control Commands +CMDPW3 EQU 0E3H ; High Range of Power Control Commands +CMDPWQ EQU 0E5H ; Power Status Query Command +CMDID EQU 0ECH ; Read Drive Ident Data Command + ENDIF ;ide +;=================== End Unique Equates ======================= + ENDIF ; REMOVE CODE diff --git a/Source/BPBIOS/def-ww-z34bnk.lib b/Source/BPBIOS/def-ww-z34bnk.lib new file mode 100644 index 00000000..d67f369a --- /dev/null +++ b/Source/BPBIOS/def-ww-z34bnk.lib @@ -0,0 +1,365 @@ +;:::::::::::::::::::::::::::::::::::::::::::::::********************** +; B/P BIOS Configuration and Equate File. ** System Dependant ** +; - Retro-Brew boards /w RomWBW HBIOS - ********************** +; Setup for a banked bios, external HBIOS proxy System +; Custom tailor your system here. +; +; 02 May 18 - changes made to conform with HBIOS v 2.9.1p2 WW+LN +; 04 Sep 16 - Mods for RomWBW V 2.8 WW+LN +; 30 Apr 15 - changes made to conform with v 2.7.2 of RomWBW WW+LN +; 17 Jan 14 - Initial N8VEM release WW+LN +; 30 Aug 01 - Cleaned up for GPL release. HFB +; 11 May 97 - Added GIDE and adjusted HD equates. HFB +; 5 Jan 97 - Reformatted to Standard. HFB +; 10 Jun 96 - Initial Test Release. HFB +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; BIOS Configuration Equates and Macros + +DATE MACRO + DEFB '07 Oct 21' ; Date of this version + ENDM +AUTOCL MACRO + DEFB 8,'ZEX ZST ',0 ; Autostart command line + ENDM + +;--- Basic System and Z-System Section --- + +MOVCPM EQU NO ; Integrate into MOVCPM "type" loader? + IF MOVCPM +VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) + ELSE +VERS EQU 21H ; Version number w/Device Swapping permitted + ENDIF +BANKED EQU YES ; Is this a banked BIOS? +ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible +INROM EQU NO ; Alternate bank in ROM? +MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) +FASTWB EQU YES ; Yes if restoring CPR from banked RAM + ; ..No if restoring from Drive A +Z3 EQU YES ; Include ZCPR init code? +HAVIOP EQU NO ; Include IOP code into Jump table? + +;--- Memory configuration Section --- (Expansion Memory configured here) + +IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) + ; No = Include Common RAM transfer buffer + +;--- Character Device Section --- + +MORDEV EQU NO ; YES = Include any extra Char Device Drivers + ; NO = Only use the 4 defined Char Devices + +QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) + ; ..must be 2^n with n<8 +RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? +XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? + +;--- Clock and Time Section --- + +CLOCK EQU YES ; Include ZSDOS Clock Driver Code? +CLKSET EQU YES ; Allow Clock Sets? (Error if No) + +;--- Floppy Diskette Section --- + +FLPYDSK EQU NO ; YES = Make Floppy-Disk Code, NO = No code made + +BIOERM EQU yes ; Print BIOS error messages? +CALCSK EQU YES ; Calculate skew table? +AUTOSL EQU YES ; Auto select floppy formats? + ; If AUTOSL=True, the next two are active... +FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? +FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? +FLOPY8 EQU no ; Include 8" Floppy Formats? +MORDPB EQU NO ; Include additional Floppy DPB Formats? + +;;--- RAM Disk Section --- +; +;RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made + +;--- Hard Disk Section --- + +HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only + ; (Pick 1 of 3 options below) +HBDSK EQU YES ; YES = Use HBIOS Disk Driver +HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? + ; (DMA not implemented for GIDE) +UNIT_0 EQU YES ; Hard Disk Physical Unit 1 +UNIT_1 EQU YES ; Hard Disk Physical Unit 2 +UNIT_2 EQU YES ; Hard Disk Physical Unit 3 + +;--- Logical Drive Section --- +; +; Set each of these equates for the drive and partition complement of +; your system. Set equates to no if drive exists or is wanted. + +DRV_A EQU yes ; A is always RAMDSK on HBIOS Device 0. +DRV_B EQU yes ; B is always ROMDSK on HBIOS Device 1. +DRV_C EQU yes +DRV_D EQU yes +DRV_E EQU yes ; Default is C-J are Hard Disk Slices +DRV_F EQU yes ; on the first hard drive (room for +DRV_G EQU yes ; up to 8 Slices provided) e.g. CF card. +DRV_H EQU yes +DRV_I EQU yes +DRV_J EQU yes +DRV_K EQU yes ; Default is K-N are Hard Disk Slices +DRV_L EQU yes ; on a second hard drive (room for up to +DRV_M EQU yes ; 4 Slices provided) e.g. SD card +DRV_N EQU yes + if FLPYDSK +DRV_O EQU yes ; O & P are floppies +DRV_P EQU yes + else +DRV_O EQU no ; O & P are floppies +DRV_P EQU no + endif + +;========== Configuration Unique Equates =========== +;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< +;>>> Do NOT Alter these unless you KNOW what you're doing <<< +;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +REFRSH EQU NO ; Set to NO for only Static RAM, needed for + ; systems with dynamic RAMs. +NOWAIT EQU NO ; Set to NO to use configured Wait States in + ; Hard Disk Driver. Yes to eliminate Waits. + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; +; RomWBW HBIOS sets these values at runtime during startup. +; +BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H +BNK1 EQU BID_COM ; Second TPA Bank (Common Bank) 48000H +BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H +BNKU EQU 00H ; User Area Bank 58000H + ; (set to 0 to disable) +BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H +BNKM EQU BID_RAMM ; Maximum Bank # F8000H + + IF NO ; REMOVE CODE - NOT NEEDED WITH HBIOS makes a + ; nice resource for Z180 programing in general +;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== + +CNTLA0 EQU 00H ; Control Port ASCI 0 +CNTLA1 EQU 01H ; Control Port ASCI 1 +STAT0 EQU 04H ; Serial port 0 Status +STAT1 EQU 05H ; Serial port 1 Status +TDR0 EQU 06H ; Serial port 0 Output Data +TDR1 EQU 07H ; Serial port 1 Output Data +RDR0 EQU 08H ; Serial port 0 Input Data +RDR1 EQU 09H ; Serial Port 1 Input Data +CNTR EQU 0AH ; HD64180 Counter port +TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) +TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) +RLDR0L EQU 0EH ; CTC0 Reload Count, Low +RLDR0H EQU 0FH ; CTC0 Reload Count, High +TCR EQU 10H ; Interrupt Control Register +TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) +TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) +RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) +RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) +FRC EQU 18H ; Free-Running Counter +CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) +SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) +MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) +DSTAT EQU 30H ; DMA Status/Control port +DMODE EQU 31H ; DMA Mode Control port +DCNTL EQU 32H ; DMA/WAIT Control Register +IL EQU 33H ; Interrupt Segment Register +ITC EQU 34H ; Interrupt/Trap Control Register +RCR EQU 36H ; HD64180 Refresh Control register +CBR EQU 38H ; MMU Common Base Register +BBR EQU 39H ; MMU Bank Base Register +CBAR EQU 3AH ; MMU Common/Bank Area Register +OMCR EQU 3EH ; Operation Mode Control Reg +ICR EQU 3FH ; I/O Control Register + +; Some bit definitions used with the Z-180 on-chip peripherals: + +TDRE EQU 02H ; ACSI Transmitter Buffer Empty +RDRF EQU 80H ; ACSI Received Character available + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Extended Features of Z80182 for P112 + +WSGCS EQU 0D8H ; Wait-State Generator CS +ENH182 EQU 0D9H ; Z80182 Enhancements Register +PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register +RAMUBR EQU 0E6H ; RAM End Boundary +RAMLBR EQU 0E7H ; RAM Start Boundary +ROMBR EQU 0E8H ; ROM Boundary +FIFOCTL EQU 0E9H ; FIFO Control Register +RTOTC EQU 0EAH ; RX Time-Out Time Constant +TTOTC EQU 0EBH ; TX Time-Out Time Constant +FCR EQU 0ECH ; FIFO Register +SCR EQU 0EFH ; System Pin Control +RBR EQU 0F0H ; MIMIC RX Buffer Register (R) +THR EQU 0F0H ; MIMIN TX Holding Register (W) +IER EQU 0F1H ; Interrupt Enable Register +LCR EQU 0F3H ; Line Control Register +MCR EQU 0F4H ; Modem Control Register +LSR EQU 0F5H ; Line Status Register +MDMSR EQU 0F6H ; Modem Status Register +MSCR EQU 0F7H ; MIMIC Scratch Register +DLATL EQU 0F8H ; Divisor Latch (Low) +DLATM EQU 0F9H ; Divisor Latch (High) +TTCR EQU 0FAH ; TX Time Constant +RTCR EQU 0FBH ; RX Time Constant +IVEC EQU 0FCH ; MIMIC Interrupt Vector +MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register +IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register +MMCR EQU 0FFH ; MIMIC Master Control Register + +; Z80182 PIO Registers + +DDRA EQU 0EDH ; Data Direction Register A +DRA EQU 0EEH ; Port A Data +DDRB EQU 0E4H ; Data Direction Register B +DRB EQU 0E5H ; Data B Data +DDRC EQU 0DDH ; Data Direction Register C +DRC EQU 0DEH ; Data C Data + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; ESCC Registers on Z80182 + +SCCACNT EQU 0E0H ; ESCC Control Channel A +SCCAD EQU 0E1H ; ESCC Data Channel A +SCCBCNT EQU 0E2H ; ESCC Control Channel B +SCCBD EQU 0E3H ; ESCC Data Channel B + +; [E]SCC Internal Register Definitions + +RR0 EQU 00H +RR1 EQU 01H +RR2 EQU 02H +RR3 EQU 03H +RR6 EQU 06H +RR7 EQU 07H +RR10 EQU 0AH +RR12 EQU 0CH +RR13 EQU 0DH +RR15 EQU 0FH + +WR0 EQU 00H +WR1 EQU 01H +WR2 EQU 02H +WR3 EQU 03H +WR4 EQU 04H +WR5 EQU 05H +WR6 EQU 06H +WR7 EQU 07H +WR9 EQU 09H +WR10 EQU 0AH +WR11 EQU 0BH +WR12 EQU 0CH +WR13 EQU 0DH +WR14 EQU 0EH +WR15 EQU 0FH + +; FDC37C665/6 Parallel Port in Standard AT Mode + +DPORT EQU 8CH ; Data Port +SPORT EQU 8DH ; Status Port +CPORT EQU 8EH ; Control Port + +; FDC37C665/6 Configuration Control (access internal registers) + +CFCNTL EQU 90H ; Configuration control port +CFDATA EQU 91H ; Configuration data port + +; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) + +DCR EQU 92H ; Drive Control Register (Digital Output) +MSR EQU 94H ; Main Status Register +DR EQU 95H ; Data/Command Register +DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 + +_DMA EQU 0A0H ; Diskette DMA Address + +; FDC37C665/6 Serial Port (National 16550 compatible) + +_RBR EQU 68H ;R Receiver Buffer +_THR EQU 68H ;W Transmit Holding Reg +_IER EQU 69H ;RW Interrupt-Enable Reg +_IIR EQU 6AH ;R Interrupt Ident. Reg +_FCR EQU 6AH ;W FIFO Control Reg +_LCR EQU 6BH ;RW Line Control Reg +_MCR EQU 6CH ;RW Modem Control Reg +_LSR EQU 6DH ;RW Line Status Reg +_MMSR EQU 6EH ;RW Modem Status Reg +_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) +_DDL EQU 68H ;RW Divisor LSB | wih DLAB +_DLM EQU 69H ;RW Divisor MSB | set High + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Equates for the National DP8490/NCR 5380 Prototype SCSI controller + + IF HARDDSK +NCR EQU 40H ; Base of NCR 5380 + +; 5380 Chip Registers + +NCRDAT EQU NCR ; Current SCSI Data (Read) + ; Output Data Register (Write) +NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) +NCRMOD EQU NCR+2 ; Mode Register (Read/Write) +NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) +NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) +NCRST EQU NCR+5 ; Bus & Status Register (Read) + ; Start DMA Send (Write) +NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) + ; Start DMA Initiator Receive (Write) +DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) + +; Bit Assignments for NCR 5380 Ports as indicated + +B_ARST EQU 10000000B ; Assert *RST (NCRCMD) +B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) +B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) +B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) + +B_BSY EQU 01000000B ; *Busy (NCRBUS) +B_REQ EQU 00100000B ; *Request (NCRBUS) +B_MSG EQU 00010000B ; *Message (NCRBUS) +B_CD EQU 00001000B ; *Command/Data (NCRBUS) +B_IO EQU 00000100B ; *I/O (NCRBUS) +B_SEL EQU 00000010B ; *Select (NCRBUS) + +B_PHAS EQU 00001000B ; Phase Match (NCRST) +B_BBSY EQU 00000100B ; Bus Busy (NCRST) + +B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) +B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) + ENDIF ;harddsk + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) +; Set the base GIDE equate to the jumper setting on the GIDE board. + + IF IDE +GIDE EQU 50H ; Set base of 16 byte address range + +IDEDOR EQU GIDE+6 ; Digital Output Register +IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) +IDEErr EQU GIDE+9 ; IDE Error Register +IDESCnt EQU GIDE+0AH ; IDE Sector Count Register +IDESNum EQU GIDE+0BH ; IDE Sector Number Register +IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) +IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) +IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register +IDECmd EQU GIDE+0FH ; IDE Command/Status Register + +CMDHOM EQU 10H ; Home Drive Heads +CMDRD EQU 20H ; Read Sector Command (w/retry) +CMDWR EQU 30H ; Write Sector Command (w/retry) +CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) +CMDFMT EQU 50H ; Format Track Command +CMDDIAG EQU 90H ; Execute Diagnostics Command +CMDINIT EQU 91H ; Initialize Drive Params Command +CMDPW0 EQU 0E0H ; Low Range of Power Control Commands +CMDPW3 EQU 0E3H ; High Range of Power Control Commands +CMDPWQ EQU 0E5H ; Power Status Query Command +CMDID EQU 0ECH ; Read Drive Ident Data Command + ENDIF ;ide +;=================== End Unique Equates ======================= + ENDIF ; REMOVE CODE diff --git a/Source/BPBIOS/def-ww-z34n.lib b/Source/BPBIOS/def-ww-z34n.lib deleted file mode 100644 index b6c40f7f..00000000 --- a/Source/BPBIOS/def-ww-z34n.lib +++ /dev/null @@ -1,374 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '17 Jan 14' ; Date of this version - ENDM - -AUTOCL MACRO - DEFB 8,'ZEX Z34 ',0 ; Autostart command line - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU NO ; Is this a banked BIOS? -ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU YES ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU NO ; Include IOP code into Jump table? -INTPXY EQU YES ; Internal HBIOS Mini Proxy -CONF_T EQU NO ; Set for Segment Configuration T -CONF_N EQU YES ; Set for Segment Configuration N - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer - -;--- Character Device Section --- - -MORDEV EQU NO ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU no ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU false ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU false ; Include ASCI1 Driver? -BUFFA1 EQU false ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU YES ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU YES ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only - ; (Pick 1 of 3 options below) -SCSI EQU NO ; YES = Use SCSI Driver -IDE EQU NO ; YES = Use IDE Driver -SIMHDSK EQU NO ; YES = Use SIMH HDSK Driver -HBDSK EQU YES ; YES = Use HBIOS Disk Driver -HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU YES ; Hard Disk Physical Unit 2 -UNIT_2 EQU YES ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU no ; Set each of these equates for the drive and -DRV_B EQU no ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU no -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU yes -DRV_J EQU yes -DRV_K EQU yes -DRV_L EQU yes -DRV_M EQU RAMDSK ; This is Yes for RAM drive -DRV_N EQU yes -DRV_O EQU ~RAMDSK ; Use HBIOS RAM disk if BPBIOS RAM disk is not enabled -DRV_P EQU no - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU NO ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H -BNK1 EQU BID_HB ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 00H ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H -BNKM EQU BID_RAMM ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 68H ;R Receiver Buffer -_THR EQU 68H ;W Transmit Holding Reg -_IER EQU 69H ;RW Interrupt-Enable Reg -_IIR EQU 6AH ;R Interrupt Ident. Reg -_FCR EQU 6AH ;W FIFO Control Reg -_LCR EQU 6BH ;RW Line Control Reg -_MCR EQU 6CH ;RW Modem Control Reg -_LSR EQU 6DH ;RW Line Status Reg -_MMSR EQU 6EH ;RW Modem Status Reg -_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 68H ;RW Divisor LSB | wih DLAB -_DLM EQU 69H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/def-ww-z34nbnk.lib b/Source/BPBIOS/def-ww-z34nbnk.lib deleted file mode 100644 index c5910ba4..00000000 --- a/Source/BPBIOS/def-ww-z34nbnk.lib +++ /dev/null @@ -1,374 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '17 Jan 14' ; Date of this version - ENDM - -AUTOCL MACRO - DEFB 8,'ZEX Z34 ',0 ; Autostart command line - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU YES ; Is this a banked BIOS? -ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU YES ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU NO ; Include IOP code into Jump table? -INTPXY EQU YES ; Internal HBIOS Mini Proxy -CONF_T EQU NO ; Set for Segment Configuration T -CONF_N EQU YES ; Set for Segment Configuration N - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer - -;--- Character Device Section --- - -MORDEV EQU NO ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU no ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU false ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU false ; Include ASCI1 Driver? -BUFFA1 EQU false ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU YES ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU YES ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only - ; (Pick 1 of 3 options below) -SCSI EQU NO ; YES = Use SCSI Driver -IDE EQU NO ; YES = Use IDE Driver -SIMHDSK EQU NO ; YES = Use SIMH HDSK Driver -HBDSK EQU YES ; YES = Use HBIOS Disk Driver -HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU YES ; Hard Disk Physical Unit 2 -UNIT_2 EQU YES ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU no ; Set each of these equates for the drive and -DRV_B EQU no ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU no -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU yes -DRV_J EQU yes -DRV_K EQU yes -DRV_L EQU yes -DRV_M EQU RAMDSK ; This is Yes for RAM drive -DRV_N EQU yes -DRV_O EQU ~RAMDSK ; Use HBIOS RAM disk if BPBIOS RAM disk is not enabled -DRV_P EQU no - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU NO ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H -BNK1 EQU BID_HB ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 00H ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H -BNKM EQU BID_RAMM ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 68H ;R Receiver Buffer -_THR EQU 68H ;W Transmit Holding Reg -_IER EQU 69H ;RW Interrupt-Enable Reg -_IIR EQU 6AH ;R Interrupt Ident. Reg -_FCR EQU 6AH ;W FIFO Control Reg -_LCR EQU 6BH ;RW Line Control Reg -_MCR EQU 6CH ;RW Modem Control Reg -_LSR EQU 6DH ;RW Line Status Reg -_MMSR EQU 6EH ;RW Modem Status Reg -_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 68H ;RW Divisor LSB | wih DLAB -_DLM EQU 69H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/def-ww-z34t.lib b/Source/BPBIOS/def-ww-z34t.lib deleted file mode 100644 index 4b97cca2..00000000 --- a/Source/BPBIOS/def-ww-z34t.lib +++ /dev/null @@ -1,374 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '17 Jan 14' ; Date of this version - ENDM - -AUTOCL MACRO - DEFB 8,'ZEX Z34 ',0 ; Autostart command line - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU NO ; Is this a banked BIOS? -ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU YES ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU NO ; Include IOP code into Jump table? -INTPXY EQU NO ; Internal HBIOS Mini Proxy -CONF_T EQU YES ; Set for Segment Configuration T -CONF_N EQU NO ; Set for Segment Configuration N - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer - -;--- Character Device Section --- - -MORDEV EQU NO ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU no ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU false ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU false ; Include ASCI1 Driver? -BUFFA1 EQU false ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU YES ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU YES ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only - ; (Pick 1 of 3 options below) -SCSI EQU NO ; YES = Use SCSI Driver -IDE EQU NO ; YES = Use IDE Driver -SIMHDSK EQU NO ; YES = Use SIMH HDSK Driver -HBDSK EQU YES ; YES = Use HBIOS Disk Driver -HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU YES ; Hard Disk Physical Unit 2 -UNIT_2 EQU YES ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU no ; Set each of these equates for the drive and -DRV_B EQU no ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU no -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU yes -DRV_J EQU yes -DRV_K EQU yes -DRV_L EQU yes -DRV_M EQU RAMDSK ; This is Yes for RAM drive -DRV_N EQU yes -DRV_O EQU ~RAMDSK ; Use HBIOS RAM disk if BPBIOS RAM disk is not enabled -DRV_P EQU no - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU NO ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H -BNK1 EQU BID_HB ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 00H ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H -BNKM EQU BID_RAMM ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 68H ;R Receiver Buffer -_THR EQU 68H ;W Transmit Holding Reg -_IER EQU 69H ;RW Interrupt-Enable Reg -_IIR EQU 6AH ;R Interrupt Ident. Reg -_FCR EQU 6AH ;W FIFO Control Reg -_LCR EQU 6BH ;RW Line Control Reg -_MCR EQU 6CH ;RW Modem Control Reg -_LSR EQU 6DH ;RW Line Status Reg -_MMSR EQU 6EH ;RW Modem Status Reg -_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 68H ;RW Divisor LSB | wih DLAB -_DLM EQU 69H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/def-ww-z34tbnk.lib b/Source/BPBIOS/def-ww-z34tbnk.lib deleted file mode 100644 index 4b659c3a..00000000 --- a/Source/BPBIOS/def-ww-z34tbnk.lib +++ /dev/null @@ -1,374 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '17 Jan 14' ; Date of this version - ENDM - -AUTOCL MACRO - DEFB 8,'ZEX Z34 ',0 ; Autostart command line - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU YES ; Is this a banked BIOS? -ZSDOS2 EQU NO ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU YES ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU NO ; Include IOP code into Jump table? -INTPXY EQU NO ; Internal HBIOS Mini Proxy -CONF_T EQU YES ; Set for Segment Configuration T -CONF_N EQU NO ; Set for Segment Configuration N - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer - -;--- Character Device Section --- - -MORDEV EQU NO ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU no ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU false ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU false ; Include ASCI1 Driver? -BUFFA1 EQU false ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU YES ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU YES ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only - ; (Pick 1 of 3 options below) -SCSI EQU NO ; YES = Use SCSI Driver -IDE EQU NO ; YES = Use IDE Driver -SIMHDSK EQU NO ; YES = Use SIMH HDSK Driver -HBDSK EQU YES ; YES = Use HBIOS Disk Driver -HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU YES ; Hard Disk Physical Unit 2 -UNIT_2 EQU YES ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU no ; Set each of these equates for the drive and -DRV_B EQU no ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU no -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU yes -DRV_J EQU yes -DRV_K EQU yes -DRV_L EQU yes -DRV_M EQU RAMDSK ; This is Yes for RAM drive -DRV_N EQU yes -DRV_O EQU ~RAMDSK ; Use HBIOS RAM disk if BPBIOS RAM disk is not enabled -DRV_P EQU no - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU NO ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H -BNK1 EQU BID_HB ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 00H ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H -BNKM EQU BID_RAMM ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 68H ;R Receiver Buffer -_THR EQU 68H ;W Transmit Holding Reg -_IER EQU 69H ;RW Interrupt-Enable Reg -_IIR EQU 6AH ;R Interrupt Ident. Reg -_FCR EQU 6AH ;W FIFO Control Reg -_LCR EQU 6BH ;RW Line Control Reg -_MCR EQU 6CH ;RW Modem Control Reg -_LSR EQU 6DH ;RW Line Status Reg -_MMSR EQU 6EH ;RW Modem Status Reg -_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 68H ;RW Divisor LSB | wih DLAB -_DLM EQU 69H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/def-ww-z41bnk.lib b/Source/BPBIOS/def-ww-z41bnk.lib new file mode 100644 index 00000000..29d10136 --- /dev/null +++ b/Source/BPBIOS/def-ww-z41bnk.lib @@ -0,0 +1,365 @@ +;:::::::::::::::::::::::::::::::::::::::::::::::********************** +; B/P BIOS Configuration and Equate File. ** System Dependant ** +; - Retro-Brew boards /w RomWBW HBIOS - ********************** +; Tailored for Fully-banked, external HBIOS proxy System +; Custom tailor your system here. +; +; 02 May 18 - changes made to conform with HBIOS v 2.9.1p2 WW+LN +; 04 Sep 16 - Mods for RomWBW V 2.8 WW+LN +; 30 Apr 15 - changes made to conform with v 2.7.2 of RomWBW WW+LN +; 17 Jan 14 - Initial N8VEM release WW+LN +; 30 Aug 01 - Cleaned up for GPL release. HFB +; 11 May 97 - Added GIDE and adjusted HD equates. HFB +; 5 Jan 97 - Reformatted to Standard. HFB +; 10 Jun 96 - Initial Test Release. HFB +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; BIOS Configuration Equates and Macros + +DATE MACRO + DEFB '07 Oct 21' ; Date of this version + ENDM +AUTOCL MACRO + DEFB 8,'ZEX ZSTF',0 ; Autostart command line + ENDM + +;--- Basic System and Z-System Section --- + +MOVCPM EQU NO ; Integrate into MOVCPM "type" loader? + IF MOVCPM +VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) + ELSE +VERS EQU 21H ; Version number w/Device Swapping permitted + ENDIF +BANKED EQU YES ; Is this a banked BIOS? +ZSDOS2 EQU YES ; Yes = Banked Dos, No = CP/M 2.2 Compatible +INROM EQU NO ; Alternate bank in ROM? +MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) +FASTWB EQU YES ; Yes if restoring CPR from banked RAM + ; ..No if restoring from Drive A +Z3 EQU YES ; Include ZCPR init code? +HAVIOP EQU NO ; Include IOP code into Jump table? + +;--- Memory configuration Section --- (Expansion Memory configured here) + +IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) + ; No = Include Common RAM transfer buffer + +;--- Character Device Section --- + +MORDEV EQU NO ; YES = Include any extra Char Device Drivers + ; NO = Only use the 4 defined Char Devices + +QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) + ; ..must be 2^n with n<8 +RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? +XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? + +;--- Clock and Time Section --- + +CLOCK EQU YES ; Include ZSDOS Clock Driver Code? +CLKSET EQU YES ; Allow Clock Sets? (Error if No) + +;--- Floppy Diskette Section --- + +FLPYDSK EQU NO ; YES = Make Floppy-Disk Code, NO = No code made + +BIOERM EQU yes ; Print BIOS error messages? +CALCSK EQU YES ; Calculate skew table? +AUTOSL EQU YES ; Auto select floppy formats? + ; If AUTOSL=True, the next two are active... +FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? +FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? +FLOPY8 EQU no ; Include 8" Floppy Formats? +MORDPB EQU NO ; Include additional Floppy DPB Formats? + +;;--- RAM Disk Section --- +; +;RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made + +;--- Hard Disk Section --- + +HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only + ; (Pick 1 of 3 options below) +HBDSK EQU YES ; YES = Use HBIOS Disk Driver +HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? + ; (DMA not implemented for GIDE) +UNIT_0 EQU YES ; Hard Disk Physical Unit 1 +UNIT_1 EQU YES ; Hard Disk Physical Unit 2 +UNIT_2 EQU YES ; Hard Disk Physical Unit 3 + +;--- Logical Drive Section --- +; +; Set each of these equates for the drive and partition complement of +; your system. Set equates to no if drive exists or is wanted. + +DRV_A EQU yes ; A is always RAMDSK on HBIOS Device 0. +DRV_B EQU yes ; B is always ROMDSK on HBIOS Device 1. +DRV_C EQU yes +DRV_D EQU yes +DRV_E EQU yes ; Default is C-J are Hard Disk Slices +DRV_F EQU yes ; on the first hard drive (room for +DRV_G EQU yes ; up to 8 Slices provided) e.g. CF card. +DRV_H EQU yes +DRV_I EQU yes +DRV_J EQU yes +DRV_K EQU yes ; Default is K-N are Hard Disk Slices +DRV_L EQU yes ; on a second hard drive (room for up to +DRV_M EQU yes ; 4 Slices provided) e.g. SD card +DRV_N EQU yes + if FLPYDSK +DRV_O EQU yes ; O & P are floppies +DRV_P EQU yes + else +DRV_O EQU no ; O & P are floppies +DRV_P EQU no + endif + +;========== Configuration Unique Equates =========== +;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< +;>>> Do NOT Alter these unless you KNOW what you're doing <<< +;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +REFRSH EQU NO ; Set to NO for only Static RAM, needed for + ; systems with dynamic RAMs. +NOWAIT EQU NO ; Set to NO to use configured Wait States in + ; Hard Disk Driver. Yes to eliminate Waits. + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; +; RomWBW HBIOS sets these values at runtime during startup. +; +BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H +BNK1 EQU BID_COM ; Second TPA Bank (Common Bank) 48000H +BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H +BNKU EQU 00H ; User Area Bank 58000H + ; (set to 0 to disable) +BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H +BNKM EQU BID_RAMM ; Maximum Bank # F8000H + + IF NO ; REMOVE CODE - NOT NEEDED WITH HBIOS makes a + ; nice resource for Z180 programing in general +;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== + +CNTLA0 EQU 00H ; Control Port ASCI 0 +CNTLA1 EQU 01H ; Control Port ASCI 1 +STAT0 EQU 04H ; Serial port 0 Status +STAT1 EQU 05H ; Serial port 1 Status +TDR0 EQU 06H ; Serial port 0 Output Data +TDR1 EQU 07H ; Serial port 1 Output Data +RDR0 EQU 08H ; Serial port 0 Input Data +RDR1 EQU 09H ; Serial Port 1 Input Data +CNTR EQU 0AH ; HD64180 Counter port +TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) +TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) +RLDR0L EQU 0EH ; CTC0 Reload Count, Low +RLDR0H EQU 0FH ; CTC0 Reload Count, High +TCR EQU 10H ; Interrupt Control Register +TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) +TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) +RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) +RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) +FRC EQU 18H ; Free-Running Counter +CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) +SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) +MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) +DSTAT EQU 30H ; DMA Status/Control port +DMODE EQU 31H ; DMA Mode Control port +DCNTL EQU 32H ; DMA/WAIT Control Register +IL EQU 33H ; Interrupt Segment Register +ITC EQU 34H ; Interrupt/Trap Control Register +RCR EQU 36H ; HD64180 Refresh Control register +CBR EQU 38H ; MMU Common Base Register +BBR EQU 39H ; MMU Bank Base Register +CBAR EQU 3AH ; MMU Common/Bank Area Register +OMCR EQU 3EH ; Operation Mode Control Reg +ICR EQU 3FH ; I/O Control Register + +; Some bit definitions used with the Z-180 on-chip peripherals: + +TDRE EQU 02H ; ACSI Transmitter Buffer Empty +RDRF EQU 80H ; ACSI Received Character available + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Extended Features of Z80182 for P112 + +WSGCS EQU 0D8H ; Wait-State Generator CS +ENH182 EQU 0D9H ; Z80182 Enhancements Register +PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register +RAMUBR EQU 0E6H ; RAM End Boundary +RAMLBR EQU 0E7H ; RAM Start Boundary +ROMBR EQU 0E8H ; ROM Boundary +FIFOCTL EQU 0E9H ; FIFO Control Register +RTOTC EQU 0EAH ; RX Time-Out Time Constant +TTOTC EQU 0EBH ; TX Time-Out Time Constant +FCR EQU 0ECH ; FIFO Register +SCR EQU 0EFH ; System Pin Control +RBR EQU 0F0H ; MIMIC RX Buffer Register (R) +THR EQU 0F0H ; MIMIN TX Holding Register (W) +IER EQU 0F1H ; Interrupt Enable Register +LCR EQU 0F3H ; Line Control Register +MCR EQU 0F4H ; Modem Control Register +LSR EQU 0F5H ; Line Status Register +MDMSR EQU 0F6H ; Modem Status Register +MSCR EQU 0F7H ; MIMIC Scratch Register +DLATL EQU 0F8H ; Divisor Latch (Low) +DLATM EQU 0F9H ; Divisor Latch (High) +TTCR EQU 0FAH ; TX Time Constant +RTCR EQU 0FBH ; RX Time Constant +IVEC EQU 0FCH ; MIMIC Interrupt Vector +MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register +IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register +MMCR EQU 0FFH ; MIMIC Master Control Register + +; Z80182 PIO Registers + +DDRA EQU 0EDH ; Data Direction Register A +DRA EQU 0EEH ; Port A Data +DDRB EQU 0E4H ; Data Direction Register B +DRB EQU 0E5H ; Data B Data +DDRC EQU 0DDH ; Data Direction Register C +DRC EQU 0DEH ; Data C Data + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; ESCC Registers on Z80182 + +SCCACNT EQU 0E0H ; ESCC Control Channel A +SCCAD EQU 0E1H ; ESCC Data Channel A +SCCBCNT EQU 0E2H ; ESCC Control Channel B +SCCBD EQU 0E3H ; ESCC Data Channel B + +; [E]SCC Internal Register Definitions + +RR0 EQU 00H +RR1 EQU 01H +RR2 EQU 02H +RR3 EQU 03H +RR6 EQU 06H +RR7 EQU 07H +RR10 EQU 0AH +RR12 EQU 0CH +RR13 EQU 0DH +RR15 EQU 0FH + +WR0 EQU 00H +WR1 EQU 01H +WR2 EQU 02H +WR3 EQU 03H +WR4 EQU 04H +WR5 EQU 05H +WR6 EQU 06H +WR7 EQU 07H +WR9 EQU 09H +WR10 EQU 0AH +WR11 EQU 0BH +WR12 EQU 0CH +WR13 EQU 0DH +WR14 EQU 0EH +WR15 EQU 0FH + +; FDC37C665/6 Parallel Port in Standard AT Mode + +DPORT EQU 8CH ; Data Port +SPORT EQU 8DH ; Status Port +CPORT EQU 8EH ; Control Port + +; FDC37C665/6 Configuration Control (access internal registers) + +CFCNTL EQU 90H ; Configuration control port +CFDATA EQU 91H ; Configuration data port + +; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) + +DCR EQU 92H ; Drive Control Register (Digital Output) +MSR EQU 94H ; Main Status Register +DR EQU 95H ; Data/Command Register +DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 + +_DMA EQU 0A0H ; Diskette DMA Address + +; FDC37C665/6 Serial Port (National 16550 compatible) + +_RBR EQU 68H ;R Receiver Buffer +_THR EQU 68H ;W Transmit Holding Reg +_IER EQU 69H ;RW Interrupt-Enable Reg +_IIR EQU 6AH ;R Interrupt Ident. Reg +_FCR EQU 6AH ;W FIFO Control Reg +_LCR EQU 6BH ;RW Line Control Reg +_MCR EQU 6CH ;RW Modem Control Reg +_LSR EQU 6DH ;RW Line Status Reg +_MMSR EQU 6EH ;RW Modem Status Reg +_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) +_DDL EQU 68H ;RW Divisor LSB | wih DLAB +_DLM EQU 69H ;RW Divisor MSB | set High + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Equates for the National DP8490/NCR 5380 Prototype SCSI controller + + IF HARDDSK +NCR EQU 40H ; Base of NCR 5380 + +; 5380 Chip Registers + +NCRDAT EQU NCR ; Current SCSI Data (Read) + ; Output Data Register (Write) +NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) +NCRMOD EQU NCR+2 ; Mode Register (Read/Write) +NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) +NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) +NCRST EQU NCR+5 ; Bus & Status Register (Read) + ; Start DMA Send (Write) +NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) + ; Start DMA Initiator Receive (Write) +DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) + +; Bit Assignments for NCR 5380 Ports as indicated + +B_ARST EQU 10000000B ; Assert *RST (NCRCMD) +B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) +B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) +B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) + +B_BSY EQU 01000000B ; *Busy (NCRBUS) +B_REQ EQU 00100000B ; *Request (NCRBUS) +B_MSG EQU 00010000B ; *Message (NCRBUS) +B_CD EQU 00001000B ; *Command/Data (NCRBUS) +B_IO EQU 00000100B ; *I/O (NCRBUS) +B_SEL EQU 00000010B ; *Select (NCRBUS) + +B_PHAS EQU 00001000B ; Phase Match (NCRST) +B_BBSY EQU 00000100B ; Bus Busy (NCRST) + +B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) +B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) + ENDIF ;harddsk + +;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) +; Set the base GIDE equate to the jumper setting on the GIDE board. + + IF IDE +GIDE EQU 50H ; Set base of 16 byte address range + +IDEDOR EQU GIDE+6 ; Digital Output Register +IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) +IDEErr EQU GIDE+9 ; IDE Error Register +IDESCnt EQU GIDE+0AH ; IDE Sector Count Register +IDESNum EQU GIDE+0BH ; IDE Sector Number Register +IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) +IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) +IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register +IDECmd EQU GIDE+0FH ; IDE Command/Status Register + +CMDHOM EQU 10H ; Home Drive Heads +CMDRD EQU 20H ; Read Sector Command (w/retry) +CMDWR EQU 30H ; Write Sector Command (w/retry) +CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) +CMDFMT EQU 50H ; Format Track Command +CMDDIAG EQU 90H ; Execute Diagnostics Command +CMDINIT EQU 91H ; Initialize Drive Params Command +CMDPW0 EQU 0E0H ; Low Range of Power Control Commands +CMDPW3 EQU 0E3H ; High Range of Power Control Commands +CMDPWQ EQU 0E5H ; Power Status Query Command +CMDID EQU 0ECH ; Read Drive Ident Data Command + ENDIF ;ide +;=================== End Unique Equates ======================= + ENDIF ; REMOVE CODE diff --git a/Source/BPBIOS/def-ww-z41nbnk.lib b/Source/BPBIOS/def-ww-z41nbnk.lib deleted file mode 100644 index 0eef1948..00000000 --- a/Source/BPBIOS/def-ww-z41nbnk.lib +++ /dev/null @@ -1,373 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '17 Jan 14' ; Date of this version - ENDM - -AUTOCL MACRO - DEFB 8,'ZEX Z41 ',0 ; Autostart command line - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU YES ; Is this a banked BIOS? -ZSDOS2 EQU YES ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU YES ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU NO ; Include IOP code into Jump table? -INTPXY EQU YES ; Internal HBIOS Mini Proxy -CONF_T EQU NO ; Set for Segment Configuration T -CONF_N EQU YES ; Set for Segment Configuration N - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer -;--- Character Device Section --- - -MORDEV EQU NO ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU no ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU false ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU false ; Include ASCI1 Driver? -BUFFA1 EQU false ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU YES ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU YES ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only - ; (Pick 1 of 3 options below) -SCSI EQU NO ; YES = Use SCSI Driver -IDE EQU NO ; YES = Use IDE Driver -SIMHDSK EQU NO ; YES = Use SIMH HDSK Driver -HBDSK EQU YES ; YES = Use HBIOS Disk Driver -HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU YES ; Hard Disk Physical Unit 2 -UNIT_2 EQU YES ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU no ; Set each of these equates for the drive and -DRV_B EQU no ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU no -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU yes -DRV_J EQU yes -DRV_K EQU yes -DRV_L EQU yes -DRV_M EQU RAMDSK ; This is Yes for RAM drive -DRV_N EQU yes -DRV_O EQU ~RAMDSK ; Use HBIOS RAM disk if BPBIOS RAM disk is not enabled -DRV_P EQU no - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU NO ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H -BNK1 EQU BID_HB ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 00H ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H -BNKM EQU BID_RAMM ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 68H ;R Receiver Buffer -_THR EQU 68H ;W Transmit Holding Reg -_IER EQU 69H ;RW Interrupt-Enable Reg -_IIR EQU 6AH ;R Interrupt Ident. Reg -_FCR EQU 6AH ;W FIFO Control Reg -_LCR EQU 6BH ;RW Line Control Reg -_MCR EQU 6CH ;RW Modem Control Reg -_LSR EQU 6DH ;RW Line Status Reg -_MMSR EQU 6EH ;RW Modem Status Reg -_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 68H ;RW Divisor LSB | wih DLAB -_DLM EQU 69H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/def-ww-z41tbnk.lib b/Source/BPBIOS/def-ww-z41tbnk.lib deleted file mode 100644 index ce31179b..00000000 --- a/Source/BPBIOS/def-ww-z41tbnk.lib +++ /dev/null @@ -1,373 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '17 Jan 14' ; Date of this version - ENDM - -AUTOCL MACRO - DEFB 8,'ZEX Z41 ',0 ; Autostart command line - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU YES ; Is this a banked BIOS? -ZSDOS2 EQU YES ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU YES ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU NO ; Include IOP code into Jump table? -INTPXY EQU NO ; Internal HBIOS Mini Proxy -CONF_T EQU YES ; Set for Segment Configuration T -CONF_N EQU NO ; Set for Segment Configuration N - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU NO ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer -;--- Character Device Section --- - -MORDEV EQU NO ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU no ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU false ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU false ; Include ASCI1 Driver? -BUFFA1 EQU false ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU no ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU YES ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU YES ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU no ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU YES ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only - ; (Pick 1 of 3 options below) -SCSI EQU NO ; YES = Use SCSI Driver -IDE EQU NO ; YES = Use IDE Driver -SIMHDSK EQU NO ; YES = Use SIMH HDSK Driver -HBDSK EQU YES ; YES = Use HBIOS Disk Driver -HDDMA EQU NO ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU YES ; Hard Disk Physical Unit 2 -UNIT_2 EQU YES ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU no ; Set each of these equates for the drive and -DRV_B EQU no ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU no -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU yes -DRV_J EQU yes -DRV_K EQU yes -DRV_L EQU yes -DRV_M EQU RAMDSK ; This is Yes for RAM drive -DRV_N EQU yes -DRV_O EQU ~RAMDSK ; Use HBIOS RAM disk if BPBIOS RAM disk is not enabled -DRV_P EQU no - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU NO ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU BID_USR ; First TPA Bank (switched in/out) 40000H -BNK1 EQU BID_HB ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU BID_SYS ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 00H ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU BID_RAMD ; First Bank for RAM disk 60000H -BNKM EQU BID_RAMM ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 68H ;R Receiver Buffer -_THR EQU 68H ;W Transmit Holding Reg -_IER EQU 69H ;RW Interrupt-Enable Reg -_IIR EQU 6AH ;R Interrupt Ident. Reg -_FCR EQU 6AH ;W FIFO Control Reg -_LCR EQU 6BH ;RW Line Control Reg -_MCR EQU 6CH ;RW Modem Control Reg -_LSR EQU 6DH ;RW Line Status Reg -_MMSR EQU 6EH ;RW Modem Status Reg -_SCR EQU 6FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 68H ;RW Divisor LSB | wih DLAB -_DLM EQU 69H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/defbank b/Source/BPBIOS/defbank deleted file mode 100644 index 044fc09d..00000000 --- a/Source/BPBIOS/defbank +++ /dev/null @@ -1,367 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Cleaned up for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '30 Aug 01' ; Date of this version - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU no ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU yes ; Is this a banked BIOS? -ZSDOS2 EQU yes ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU yes ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU yes ; Include IOP code into Jump table? - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU YES ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer - -;--- Character Device Section --- - -MORDEV EQU yes ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU true ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU true ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU true ; Include ASCI1 Driver? -BUFFA1 EQU true ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of interrupt typeahead buffers (if used) - ; ..must be 2^n with n<8 -RTSCTS EQU yes ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU yes ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU no ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU yes ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU yes ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU yes ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only -IDE EQU no ; YES = Use IDE Driver, NO = Use SCSI -HDDMA EQU yes ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU yes ; Hard Disk Physical Unit 2 -UNIT_2 EQU NO ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU yes ; Set each of these equates for the drive and -DRV_B EQU yes ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU yes -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU yes -DRV_H EQU yes -DRV_I EQU no -DRV_J EQU no -DRV_K EQU no -DRV_L EQU no - IF RAMDSK -DRV_M EQU yes ; This is Yes for RAM drive - ELSE -DRV_M EQU no ; This is for drive if No RAM Drive present - ENDIF -DRV_N EQU yes -DRV_O EQU yes -DRV_P EQU yes - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU no ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU 08H ; First TPA Bank (switched in/out) 40000H -BNK1 EQU 09H ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU 0AH ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 0BH ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU 0CH ; First Bank for RAM disk 60000H -BNKM EQU 1FH ; Maximum Bank # F8000H - ; With both on-board RAMs only (MEM1 or MEM2), - ; the maximum Bank number is 11 (0BH). - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 98H ;R Receiver Buffer -_THR EQU 98H ;W Transmit Holding Reg -_IER EQU 99H ;RW Interrupt-Enable Reg -_IIR EQU 9AH ;R Interrupt Ident. Reg -_FCR EQU 9AH ;W FIFO Control Reg -_LCR EQU 9BH ;RW Line Control Reg -_MCR EQU 9CH ;RW Modem Control Reg -_LSR EQU 9DH ;RW Line Status Reg -_MMSR EQU 9EH ;RW Modem Status Reg -_SCR EQU 9FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 98H ;RW Divisor LSB | wih DLAB -_DLM EQU 99H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/defboot b/Source/BPBIOS/defboot deleted file mode 100644 index 9bb8bf2c..00000000 --- a/Source/BPBIOS/defboot +++ /dev/null @@ -1,365 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; Tailor your system here. -; -; 30 Aug 01 - Adjusted values for GPL release. HFB -; 11 May 97 - Added GIDE and adjusted HD equates. HFB -; 5 Jan 97 - Reformatted to Standard. HFB -; 10 Jun 96 - Initial Test Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros - -DATE MACRO - DEFB '30-08-01' ; Date of this version - ENDM - -;--- Basic System and Z-System Section --- - -MOVCPM EQU yes ; Integrate into MOVCPM "type" loader? - IF MOVCPM -VERS EQU 13H ; Version number in BCD (Hex) (Major/Minor) - ELSE -VERS EQU 21H ; Version number w/Device Swapping permitted - ENDIF -BANKED EQU no ; Is this a banked BIOS? -ZSDOS2 EQU no ; Yes = Banked Dos, No = CP/M 2.2 Compatible -INROM EQU NO ; Alternate bank in ROM? -MHZ EQU 18 ; Set to Speed in MHZ (6/9/12/16/18/24) -FASTWB EQU no ; Yes if restoring CPR from banked RAM - ; ..No if restoring from Drive A -Z3 EQU YES ; Include ZCPR init code? -HAVIOP EQU no ; Include IOP code into Jump table? - -;--- Memory configuration Section --- (Expansion Memory configured here) - -IBMOVS EQU YES ; Yes = Inter-bank Moves allowed (Z180/64180) - ; No = Include Common RAM transfer buffer - -;--- Character Device Section --- - -MORDEV EQU no ; YES = Include any extra Char Device Drivers - ; NO = Only use the 4 defined Char Devices -ESCC_B EQU false ; Include ESCC Channel B Driver? - ; The following two devices result in non-standard data rates - ; with the standard 16.00 MHz crystal in the P112. If a more - ; "standard" crystal is used (12.288, 18.432, 24.576 MHz etc) - ; is used, the ports become usable. - ; Driver code for ASCI0 and ASCI1 includes an option for - ; assembling Polled or Interrupt-driven buffered input. - ; Select the desired option for ASCI0 with the BUFFA0 flag, - ; and BUFFA1 for ASCI1. -ASCI_0 EQU false ; Include ASCI0 Driver? -BUFFA0 EQU false ; Use buffered ASCI0 Input Driver? -ASCI_1 EQU false ; Include ASCI1 Driver? -BUFFA1 EQU true ; Use buffered ASCI1 Input Driver? - -QSIZE EQU 32 ; size of COM1 and COM2 typeahead buffers - ; ..must be 2^n with n<8 -RTSCTS EQU yes ; Include RTS/CTS code on Serial Outputs? -XONOFF EQU no ; Include Xon/Xoff handshaking in Serial lines? - -;--- Clock and Time Section --- - -CLOCK EQU YES ; Include ZSDOS Clock Driver Code? -DS1202 EQU no ; Use Dallas DS-1202 instead of Interrupt RTC? -CLKSET EQU no ; Allow DS-1202 Clock Sets? (Error if No) -TICTOC EQU NO ;== NOT USED IN P112 ("heartbeat" count) - -;--- Floppy Diskette Section --- - -BIOERM EQU no ; Print BIOS error messages? -CALCSK EQU YES ; Calculate skew table? -AUTOSL EQU YES ; Auto select floppy formats? - ; If AUTOSL=True, the next two are active... -FDDMA EQU no ; Use DMA Control for Floppy Drive Transfers? -FLOPYH EQU yes ; Include "Hi-Density" Floppy Formats? -FLOPY8 EQU no ; Include 8" Floppy Formats? -MORDPB EQU NO ; Include additional Floppy DPB Formats? - -;--- RAM Disk Section --- - -RAMDSK EQU no ; YES = Make RAM-Disk Code, NO = No code made - -;--- Hard Disk Section --- - -HARDDSK EQU YES ; YES = Add Hard-disk Code, NO = Floppy Only -IDE EQU no ; YES = Use IDE Driver, NO = Use SCSI -HDDMA EQU no ; Use DMA-Controlled Hard Disk Data Transfers? - ; (DMA Not implemented for GIDE) -UNIT_0 EQU YES ; Hard Disk Physical Unit 1 -UNIT_1 EQU no ; Hard Disk Physical Unit 2 -UNIT_2 EQU NO ; Hard Disk Physical Unit 3 - -;--- Logical Drive Section --- - -DRV_A EQU yes ; Set each of these equates for the drive and -DRV_B EQU yes ; partition complement of your system. Assume -DRV_C EQU no ; that A-D are Floppies. -DRV_D EQU no -DRV_E EQU yes ; Assume that E-L and N-P are Hard Disk -DRV_F EQU yes ; Partitions -DRV_G EQU no -DRV_H EQU no -DRV_I EQU no -DRV_J EQU no -DRV_K EQU no -DRV_L EQU no - IF RAMDSK -DRV_M EQU yes ; This is Yes for RAM drive - ELSE -DRV_M EQU no ; This is for drive if No RAM Drive present - ENDIF -DRV_N EQU no -DRV_O EQU no -DRV_P EQU no - -;========== Configuration Unique Equates (P112) =========== -;>>>>>>>>>>>>>>>>>>>>>>>>>>> W A R N I N G <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -;>>> Do NOT Alter these unless you KNOW what you're doing <<< -;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -REFRSH EQU NO ; Set to NO for only Static RAM, needed for - ; systems with dynamic RAMs. -NOWAIT EQU no ; Set to NO to use configured Wait States in - ; Hard Disk Driver. Yes to eliminate Waits. - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; For Z-180/HD64180 systems, The Bank numbers should reflect Physical -; memory in 32k increments. In P112, the ROM occupies the first 32k -; increment and is ambiguously addressed occupying 0-1FFFFH. The upper -; memory bounds (BNKU, BNK3 and BNKM) should be set for your configuration. - -BNK0 EQU 08H ; First TPA Bank (switched in/out) 40000H -BNK1 EQU 09H ; Second TPA Bank (Common Bank) 48000H -BNK2 EQU 0AH ; System Bank (BIOS, DOS, CPR) 50000H -BNKU EQU 0BH ; User Area Bank 58000H - ; (set to 0 to disable) -BNK3 EQU 0CH ; First Bank for RAM disk 60000H -BNKM EQU 1FH ; Maximum Bank # F8000H - -;=========== CPU-dependent Equates, Zilog Z-180/Hitachi HD64180 ========== - -CNTLA0 EQU 00H ; Control Port ASCI 0 -CNTLA1 EQU 01H ; Control Port ASCI 1 -STAT0 EQU 04H ; Serial port 0 Status -STAT1 EQU 05H ; Serial port 1 Status -TDR0 EQU 06H ; Serial port 0 Output Data -TDR1 EQU 07H ; Serial port 1 Output Data -RDR0 EQU 08H ; Serial port 0 Input Data -RDR1 EQU 09H ; Serial Port 1 Input Data -CNTR EQU 0AH ; HD64180 Counter port -TMDR0L EQU 0CH ; HD64180 DMA channel reg (low) -TMDR0H EQU 0DH ; HD64180 DMA channel reg (hi) -RLDR0L EQU 0EH ; CTC0 Reload Count, Low -RLDR0H EQU 0FH ; CTC0 Reload Count, High -TCR EQU 10H ; Interrupt Control Register -TMDR1L EQU 14H ; Timer Data Reg Ch1 (Low) -TMDR1H EQU 15H ; Timer Data Reg Ch1 (High) -RLDR1L EQU 16H ; Timer Reload Reg Ch1 (Low) -RLDR1H EQU 17H ; Timer Reload Reg Ch1 (High) -FRC EQU 18H ; Free-Running Counter -CCR EQU 1FH ; CPU Control Register (ZS8180/Z80182) -SAR0L EQU 20H ; DMA Channel 0 Register start (8 ports) -MAR1L EQU 28H ; DMA Channel 1 Register start (8 ports) -DSTAT EQU 30H ; DMA Status/Control port -DMODE EQU 31H ; DMA Mode Control port -DCNTL EQU 32H ; DMA/WAIT Control Register -IL EQU 33H ; Interrupt Segment Register -ITC EQU 34H ; Interrupt/Trap Control Register -RCR EQU 36H ; HD64180 Refresh Control register -CBR EQU 38H ; MMU Common Base Register -BBR EQU 39H ; MMU Bank Base Register -CBAR EQU 3AH ; MMU Common/Bank Area Register -OMCR EQU 3EH ; Operation Mode Control Reg -ICR EQU 3FH ; I/O Control Register - -; Some bit definitions used with the Z-180 on-chip peripherals: - -TDRE EQU 02H ; ACSI Transmitter Buffer Empty -RDRF EQU 80H ; ACSI Received Character available - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Extended Features of Z80182 for P112 - -WSGCS EQU 0D8H ; Wait-State Generator CS -ENH182 EQU 0D9H ; Z80182 Enhancements Register -PINMUX EQU 0DFH ; Interrupt Edge/Pin Mux Register -RAMUBR EQU 0E6H ; RAM End Boundary -RAMLBR EQU 0E7H ; RAM Start Boundary -ROMBR EQU 0E8H ; ROM Boundary -FIFOCTL EQU 0E9H ; FIFO Control Register -RTOTC EQU 0EAH ; RX Time-Out Time Constant -TTOTC EQU 0EBH ; TX Time-Out Time Constant -FCR EQU 0ECH ; FIFO Register -SCR EQU 0EFH ; System Pin Control -RBR EQU 0F0H ; MIMIC RX Buffer Register (R) -THR EQU 0F0H ; MIMIN TX Holding Register (W) -IER EQU 0F1H ; Interrupt Enable Register -LCR EQU 0F3H ; Line Control Register -MCR EQU 0F4H ; Modem Control Register -LSR EQU 0F5H ; Line Status Register -MDMSR EQU 0F6H ; Modem Status Register -MSCR EQU 0F7H ; MIMIC Scratch Register -DLATL EQU 0F8H ; Divisor Latch (Low) -DLATM EQU 0F9H ; Divisor Latch (High) -TTCR EQU 0FAH ; TX Time Constant -RTCR EQU 0FBH ; RX Time Constant -IVEC EQU 0FCH ; MIMIC Interrupt Vector -MIMIE EQU 0FDH ; MIMIC Interrupt Enable Register -IUSIP EQU 0FEH ; MIMIC Interrupt Under-Service Register -MMCR EQU 0FFH ; MIMIC Master Control Register - -; Z80182 PIO Registers - -DDRA EQU 0EDH ; Data Direction Register A -DRA EQU 0EEH ; Port A Data -DDRB EQU 0E4H ; Data Direction Register B -DRB EQU 0E5H ; Data B Data -DDRC EQU 0DDH ; Data Direction Register C -DRC EQU 0DEH ; Data C Data - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; ESCC Registers on Z80182 - -SCCACNT EQU 0E0H ; ESCC Control Channel A -SCCAD EQU 0E1H ; ESCC Data Channel A -SCCBCNT EQU 0E2H ; ESCC Control Channel B -SCCBD EQU 0E3H ; ESCC Data Channel B - -; [E]SCC Internal Register Definitions - -RR0 EQU 00H -RR1 EQU 01H -RR2 EQU 02H -RR3 EQU 03H -RR6 EQU 06H -RR7 EQU 07H -RR10 EQU 0AH -RR12 EQU 0CH -RR13 EQU 0DH -RR15 EQU 0FH - -WR0 EQU 00H -WR1 EQU 01H -WR2 EQU 02H -WR3 EQU 03H -WR4 EQU 04H -WR5 EQU 05H -WR6 EQU 06H -WR7 EQU 07H -WR9 EQU 09H -WR10 EQU 0AH -WR11 EQU 0BH -WR12 EQU 0CH -WR13 EQU 0DH -WR14 EQU 0EH -WR15 EQU 0FH - -; FDC37C665/6 Parallel Port in Standard AT Mode - -DPORT EQU 8CH ; Data Port -SPORT EQU 8DH ; Status Port -CPORT EQU 8EH ; Control Port - -; FDC37C665/6 Configuration Control (access internal registers) - -CFCNTL EQU 90H ; Configuration control port -CFDATA EQU 91H ; Configuration data port - -; FDC37C665/6 Floppy Controller on P112 (Intel 80277 compatible) - -DCR EQU 92H ; Drive Control Register (Digital Output) -MSR EQU 94H ; Main Status Register -DR EQU 95H ; Data/Command Register -DRR EQU 97H ; Data Rate Register/Disk Changed Bit in B7 - -_DMA EQU 0A0H ; Diskette DMA Address - -; FDC37C665/6 Serial Port (National 16550 compatible) - -_RBR EQU 98H ;R Receiver Buffer -_THR EQU 98H ;W Transmit Holding Reg -_IER EQU 99H ;RW Interrupt-Enable Reg -_IIR EQU 9AH ;R Interrupt Ident. Reg -_FCR EQU 9AH ;W FIFO Control Reg -_LCR EQU 9BH ;RW Line Control Reg -_MCR EQU 9CH ;RW Modem Control Reg -_LSR EQU 9DH ;RW Line Status Reg -_MMSR EQU 9EH ;RW Modem Status Reg -_SCR EQU 9FH ;N/A Scratch Reg. (not avail in XT) -_DDL EQU 98H ;RW Divisor LSB | wih DLAB -_DLM EQU 99H ;RW Divisor MSB | set High - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates for the National DP8490/NCR 5380 Prototype SCSI controller - - IF HARDDSK -NCR EQU 40H ; Base of NCR 5380 - -; 5380 Chip Registers - -NCRDAT EQU NCR ; Current SCSI Data (Read) - ; Output Data Register (Write) -NCRCMD EQU NCR+1 ; Initiator Command Register (Read/Write) -NCRMOD EQU NCR+2 ; Mode Register (Read/Write) -NCRTGT EQU NCR+3 ; Target Command Register (Read/Write) -NCRBUS EQU NCR+4 ; Current SCSI Bus Status (Read) -NCRST EQU NCR+5 ; Bus & Status Register (Read) - ; Start DMA Send (Write) -NCRINT EQU NCR+7 ; Reset Parity/Interrupt (Read) - ; Start DMA Initiator Receive (Write) -DMAACK EQU NCR+8 ; SCSI Dack IO Port (Read/Write) - -; Bit Assignments for NCR 5380 Ports as indicated - -B_ARST EQU 10000000B ; Assert *RST (NCRCMD) -B_AACK EQU 00010000B ; Assert *ACK (NCRCMD) -B_ASEL EQU 00000100B ; Assert *SEL (NCRCMD) -B_ABUS EQU 00000001B ; Assert *Data Bus (NCRCMD) - -B_BSY EQU 01000000B ; *Busy (NCRBUS) -B_REQ EQU 00100000B ; *Request (NCRBUS) -B_MSG EQU 00010000B ; *Message (NCRBUS) -B_CD EQU 00001000B ; *Command/Data (NCRBUS) -B_IO EQU 00000100B ; *I/O (NCRBUS) -B_SEL EQU 00000010B ; *Select (NCRBUS) - -B_PHAS EQU 00001000B ; Phase Match (NCRST) -B_BBSY EQU 00000100B ; Bus Busy (NCRST) - -B_MBSY EQU 00000100B ; Monitor Busy Flag (NCRMOD) -B_DMA EQU 00000010B ; DMA Mode of transfer (NCRMOD) - ENDIF ;harddsk - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Equates reflecting GIDE Base address from Address Jumpers (if GIDE added) -; Set the base GIDE equate to the jumper setting on the GIDE board. - - IF IDE -GIDE EQU 50H ; Set base of 16 byte address range - -IDEDOR EQU GIDE+6 ; Digital Output Register -IDEDat EQU GIDE+8 ; IDE Data Register (16-bit wide) -IDEErr EQU GIDE+9 ; IDE Error Register -IDESCnt EQU GIDE+0AH ; IDE Sector Count Register -IDESNum EQU GIDE+0BH ; IDE Sector Number Register -IDECLo EQU GIDE+0CH ; IDE Cylinder Number (Low) -IDECHi EQU GIDE+0DH ; IDE Cylinter Number (High) -IDESDH EQU GIDE+0EH ; IDE S-Drive-Head Register -IDECmd EQU GIDE+0FH ; IDE Command/Status Register - -CMDHOM EQU 10H ; Home Drive Heads -CMDRD EQU 20H ; Read Sector Command (w/retry) -CMDWR EQU 30H ; Write Sector Command (w/retry) -CMDVER EQU 40H ; Verify Sector(s) Command (w/retry) -CMDFMT EQU 50H ; Format Track Command -CMDDIAG EQU 90H ; Execute Diagnostics Command -CMDINIT EQU 91H ; Initialize Drive Params Command -CMDPW0 EQU 0E0H ; Low Range of Power Control Commands -CMDPW3 EQU 0E3H ; High Range of Power Control Commands -CMDPWQ EQU 0E5H ; Power Status Query Command -CMDID EQU 0ECH ; Read Drive Ident Data Command - ENDIF ;ide -;=================== End Unique Equates ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/diskdefs b/Source/BPBIOS/diskdefs index 937bfcf2..81d962cc 100644 --- a/Source/BPBIOS/diskdefs +++ b/Source/BPBIOS/diskdefs @@ -271,6 +271,19 @@ diskdef interak os 2.2 end +# RomWBW 256KB ROM (128KB reserved, 128KB ROM Disk) + +diskdef wbw_rom256 + seclen 512 + tracks 4 + sectrk 64 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 0 + os 2.2 +end + # RomWBW 512KB ROM (128KB reserved, 384KB ROM Disk) diskdef wbw_rom512 @@ -297,121 +310,430 @@ diskdef wbw_rom1024 os 2.2 end -# UNA 512KB ROM (128KB reserved, 384KB ROM Disk) +# RomWBW 720K floppy media -diskdef una_rom512 +diskdef wbw_fd720 seclen 512 - tracks 12 - sectrk 64 + tracks 160 + sectrk 9 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 4 + os 2.2 +end + +# RomWBW 1.44M floppy media + +diskdef wbw_fd144 + seclen 512 + tracks 160 + sectrk 18 blocksize 2048 maxdir 256 skew 0 - boottrk 0 + boottrk 2 os 2.2 end -# UNA 512KB ROM (128KB reserved, 896KB ROM Disk) +# RomWBW 360K floppy media -diskdef una_rom1024 +diskdef wbw_fd360 seclen 512 - tracks 28 - sectrk 64 + tracks 80 + sectrk 9 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 4 + os 2.2 +end + +# RomWBW 1.20M floppy media + +diskdef wbw_fd120 + seclen 512 + tracks 160 + sectrk 15 blocksize 2048 maxdir 256 skew 0 - boottrk 0 + boottrk 2 os 2.2 end -# RomWBW 8MB Hard Disk, LU 0-3 -diskdef wbw_hd0 +# RomWBW 8320KB Hard Disk Slice (512 directory entry format) +# Legacy format: 512 dir entries, 16,630 sectors / slice + +diskdef wbw_hd512 seclen 512 - tracks 65 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 1 + boottrk 16 os 2.2 end -diskdef wbw_hd1 +# First 4 slices of wbw_hd512 +# Assumes first slice (slice 0) starts at sector 0 +# Offset of any slice (in tracks) = (1040 * ) + +diskdef wbw_hd512_0 seclen 512 - tracks 130 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 66 + boottrk 16 + offset 0T os 2.2 end -diskdef wbw_hd2 +diskdef wbw_hd512_1 seclen 512 - tracks 195 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 131 + boottrk 16 + offset 1040T os 2.2 end -diskdef wbw_hd3 +diskdef wbw_hd512_2 seclen 512 - tracks 260 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 196 + boottrk 16 + offset 2080T os 2.2 end -# RomWBW 720K floppy media -diskdef wbw_fd720 +diskdef wbw_hd512_3 seclen 512 - tracks 160 - sectrk 9 - blocksize 2048 - maxdir 128 + tracks 1040 + sectrk 16 + blocksize 4096 + maxdir 512 skew 0 - boottrk 4 + boottrk 16 + offset 3120T os 2.2 end -# RomWBW 1.44M floppy media -diskdef wbw_fd144 +# RomWBW 8MB Hard Disk (1024 directory entry format) +# New format: 1024 dir entries, 16,384 sectors / slice +# Pure filesystem image, no MBR prefix + +diskdef wbw_hd1k seclen 512 - tracks 160 - sectrk 18 - blocksize 2048 - maxdir 256 + tracks 1024 + sectrk 16 + blocksize 4096 + maxdir 1024 skew 0 boottrk 2 os 2.2 end -# RomWBW 360K floppy media -diskdef wbw_fd360 +# First 4 slices of wbw_hd1k +# Assumes standard 1MB prefix +# Offset of any slice (in tracks) = 128 + (1024 * ) + +diskdef rc2014a + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 1 + offset 0T + os 2.2 +end + +diskdef rc2014b + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 512T + os 2.2 +end + +diskdef rc2014c + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 1024T + os 2.2 +end + +diskdef rc2014d + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 1536T + os 2.2 +end + +diskdef rc2014e + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 2048T + os 2.2 +end + +diskdef rc2014f + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 2560T + os 2.2 +end + +diskdef rc2014g + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 3072T + os 2.2 +end + +diskdef rc2014h + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 3584T + os 2.2 +end + +diskdef rc2014i + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 4096T + os 2.2 +end + +diskdef rc2014j + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 4608T + os 2.2 +end + +diskdef rc2014k + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 5120T + os 2.2 +end + +diskdef rc2014l + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 5632T + os 2.2 +end + +diskdef rc2014m + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 6144T + os 2.2 +end + +diskdef rc2014n + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 6656T + os 2.2 +end + +diskdef rc2014o + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 7168T + os 2.2 +end + +diskdef rc2014p + seclen 512 + tracks 128 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 7680T os 2.2 end diff --git a/Source/BPBIOS/dpb-h.lib b/Source/BPBIOS/dpb-h.lib index e853f99e..10a8217d 100644 --- a/Source/BPBIOS/dpb-h.lib +++ b/Source/BPBIOS/dpb-h.lib @@ -8,10 +8,10 @@ ; these rates without hardware modifications and this file should not be ; included. See DPB.LIB for definitions of Format Type Bytes. ;..... -; D-X Designs Pty Ltd, P112 Board (IBM/MS-DOS Compatible) 3.5" HD Disk +; Retro-Brew Board with RomWBW HBIOS (IBM/MS-DOS Compatible) 3.5" HD Disk ; This format is: 18-512 byte Sectors/Track, Skew=2, 500 kbps, 300 rpm. - DEFB 'D-X Desgn','1'+80H ; Id - 10 bytes + DEFB 'RetroB 3.','5'+80H ; Id - 10 bytes DEFB DSK3+DD+TSBTL ; Format type byte 0 DEFB SPEED8+SEC512+ALC2K ; Format type byte 1 DEFB -2 ; Skew factor @@ -143,4 +143,4 @@ ENDIF ENDIF ;~Movcpm ;======================= End of DPB-H.LIB =========================== - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/dpb2.lib b/Source/BPBIOS/dpb2.lib index 656334d3..af0c97d1 100644 --- a/Source/BPBIOS/dpb2.lib +++ b/Source/BPBIOS/dpb2.lib @@ -1,4 +1,4 @@ -;========= Additional Disk Parameter Blocks if MORDPB is True ========== +;========= Additional Disk Parameter Blocks if MORDPB is True ========= ; See DPB.LIB for descriptions of Format Type Byte bit assignments. ;..... ; Teletek 8" DS/DD - STOCK @@ -255,4 +255,4 @@ DPB15: DEFW 0 ; Sectors per track ; 25 26 ; Logical Sector DEFB 00,00 ; Physical sector ENDIF -;---------------------- End of DPB2.LIB ------------------------------ \ No newline at end of file +;---------------------- End of DPB2.LIB ------------------------------ \ No newline at end of file diff --git a/Source/BPBIOS/dpbhd-dx.lib b/Source/BPBIOS/dpbhd-dx.lib deleted file mode 100644 index cf3a28dd..00000000 --- a/Source/BPBIOS/dpbhd-dx.lib +++ /dev/null @@ -1,317 +0,0 @@ -;======= Hard Disk Parameter Blocks ======= - -; The B/P BIOS DPB's contain prefix information that provide data on the -; logical format. This table contains only DPB Data on Hard Disk Partitions. -; See DPB.LIB for definitions of bit equates used in all DPB files. - -; NOTE: For simplicity, the code always assumes a logical 16 512-byte sectors -; per track for SCSI interface. Translate the actual 17 or 18 sectors -; to an increased track count of 16 sector tracks. - -;..... -; Format Type Byte 0 (Fixed Disk Subset) -; ------------------ -; D D D D D D D D -; 7 6 5 4 3 2 1 0 -; | | | | | +-+-+----- Disk Size 000 = Fixed Disk, remainder unused -; +-+-+-+-+----------- (unused) - -; All DPBs use the equate: FIXDSK EQU 00000000B from DPB.LIB - -; Format Type Byte 1 (Fixed Disk Subset) -; ------------------ -; D D D D D D D D -; 7 6 5 4 3 2 1 0 -; | | | | | +-+-+----- Sector Size: 010 = 512 bytes assumed in driver -; | | +-+-+----------- Allocation Size: 000=1K, 001=2K, 010=4K, 011=8K, 100=16K -; | +----------------- (reserved) -; +------------------- 1 = High Speed. (0 Not Used) - -; Information in this byte is not used in the SCSI driver, but is simply -; maintained for future use and compatibility with other DPB access routines. - -; NOTE: No Skew Table is needed since Hard Disk Format is locked - -;..... -; These are some of the capacities and configurations used with different -; drives and controllers: - -; Shugart Adaptec Seagate -; 1610-3 /------- ACB-4000a ----------\ SCSI -; ST-212 SQ-312 SQ-312A SQ-306 ST-225 ST125N -; ------ ------ ------- ------ ------ ------ -; Size (MB) A=2.6 A=2.7 A=4.0 A=2.0 A=4.0 A=4.0 -; B=2.6 B=2.7 B=7.1 B=3.5 B=7.1 B=8.0 -; C=2.6 C=2.7 - - C=11.1 C=8.1 -; D=2.6 D=2.8 - - - - - -;..... -; Partition A. Conner CP-2045 Bower 4-Partition. - - IF DRV_E - DEFB 'CP-2045 ','A'+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor (== Only the +/- sign used) - DEFB 1 ; Starting sector number - DEFB 16 ; Logical # sectors as defined in DPB - ; even though real layout is 17/18 physical - ; sectors per track - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -HSIZ0 EQU 996 ; # of blocks in first Partition (498 trks) - - ; SQ-312 SQ312A SQ-306 ST-225 ST125N - ; ------ ------ ------ ------ ------ -DPB50: DEFW 64 ; Sctrs/Trk 64 64 64 64 64 - DEFB 5 ; Blk Shf Fctr 5 5 5 5 5 - DEFB 31 ; Block Mask 31 31 31 31 31 - DEFB 1 ; Extent Mask 1 1 1 1 1 - DEFW HSIZ0-1 ; Disk Size-1 683 995 495 995 995 - DEFW 1023 ; Dir Max 767 767 767 767 767 - DEFB 0FFH,0 ; Alloc 0,1 0FC 0FC 0FC 0FC 0FC - DEFW 0 ; Check Size 0 0 0 0 0 - DEFW 2 ; Trk Offset 2 2 2 2 2 - ENDIF - -;..... -; Partition B. Conner CP-2045, Bower 4-Partition. - - IF DRV_F - DEFB 'CP-2045 ','B'+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor - DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -HSIZ1 EQU 2500 ; # of blocks in Second Partition (1250 trks) - - ; SQ-312 SQ312A SQ-306 ST-225 ST125N - ; ------ ------ ------ ------ ------ -DPB51: DEFW 64 ; Scts/Trk 64 64 64 64 64 - DEFB 5 ; Blk Shf Fctr 5 5 5 5 5 - DEFB 31 ; Block Mask 31 31 31 31 31 - DEFB 1 ; Extent Mask 1 1 1 1 1 - DEFW HSIZ1-1 ; Disk Size-1 687 1766 875 1766 1599 - DEFW 1023 ; Dir Max 767 1023 767 1023 1023 - DEFB 0FFH,0 ; Alloc 0,1 0FC 0FF 0FC 0FF 0FF - DEFW 0 ; Check size 0 0 0 0 0 - DEFW 500 ; Track offset 344 500 250 500 500 - ENDIF - -;..... -; Partition C. Conner CP-2045, Bower 4-Partition. - - IF DRV_G - DEFB 'CP-2045 ','C'+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor - DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -HSIZ2 EQU 2500 ; # of blocks in third Partition (1250 tracks) - - ; SQ-312 SQ312A SQ-306 ST-225 ST125N - ; ------ ------ ------ ------ ------ -DPB52: DEFW 64 ; Scts/Trk 64 - - 64 64 - DEFB 5 ; Blk Shf Fctr 5 - - 5 5 - DEFB 31 ; Block Mask 31 - - 31 31 - DEFB 1 ; Extent Mask 1 - - 1 1 - DEFW HSIZ2-1 ; Disk Size-1 687 - - 2766 2639 - DEFW 1023 ; Dir Max 767 - - 1023 1023 - DEFB 0FFH,0 ; Alloc0,1 0FC - - 0FF 0FF - DEFW 0 ; Check size 0 - - 0 0 - DEFW 1750 ; Track offset 688 - - 1384 1300 - ENDIF - -;..... -; Partition D. Conner CP-2045, Bower 4-Partition. - - IF DRV_H - DEFB 'CP-2045 ','D'+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor - DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -HSIZ3 EQU 1912 ; # of blocks in Fourth Partition (956 tracks) - - ; SQ-312 SQ312A SQ-306 ST-225 ST125N - ; ------ ------ ------ ------ ------ -DPB53: DEFW 64 ; Scts/Trk 64 - - - - - DEFB 5 ; Blk Shf Fctr 5 - - - - - DEFB 31 ; Block Mask 31 - - - - - DEFB 1 ; Extent Mask 1 - - - - - DEFW HSIZ3-1 ; Disk Size-1 687 (701) - - - - - DEFW 1023 ; Dir Max 767 - - - - - DEFB 0FFH,0 ; Alloc 0,1 0FC - - - - - DEFW 0 ; Check size 0 - - - - - DEFW 3000 ; Track offset 1032 - - - - - ENDIF - -;---- The rest are dummies for the present. Fill with your needs ---- - - IF DRV_I - DEFB ' ',' '+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor - DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -HSIZ4 EQU 2762 ; Number of blocks in Fourth Logical Drive - -DPB54: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ4-1 ; Disk Size-1 - DEFW 1023 ; Dir Max - DEFB 0FFH,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 2 ; Track offset - ENDIF - - IF DRV_J - DEFB ' ',' '+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor - DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -HSIZ5 EQU 2762 ; Number of blocks in Fourth Logical Drive - -DPB55: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ5-1 ; Disk Size-1 - DEFW 1023 ; Dir Max - DEFB 0FFH,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 2 ; Track offset - ENDIF - - IF DRV_K - DEFB ' ',' '+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor - DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -HSIZ6 EQU 2762 ; Number of blocks in Fourth Logical Drive - -DPB56: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ6-1 ; Disk Size-1 - DEFW 1023 ; Dir Max - DEFB 0FFH,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 2 ; Track offset - ENDIF - - IF DRV_L - DEFB ' ',' '+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor - DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -HSIZ7 EQU 2762 ; Number of blocks in Fourth Logical Drive - -DPB57: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ7-1 ; Disk Size-1 - DEFW 1023 ; Dir Max - DEFB 0FFH,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 2 ; Track offset - ENDIF - -;<<< --- Drive M is used for RAM Drive --- >>> - - IF DRV_N - DEFB ' ',' '+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor - DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -HSIZ8 EQU 2762 ; Number of blocks in Fourth Logical Drive - -DPB58: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ8-1 ; Disk Size-1 - DEFW 1023 ; Dir Max - DEFB 0FFH,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 2 ; Track offset - ENDIF - - IF DRV_O - DEFB ' ',' '+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor - DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -HSIZ9 EQU 2762 ; Number of blocks in Fourth Logical Drive - -DPB59: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ9-1 ; Disk Size-1 - DEFW 1023 ; Dir Max - DEFB 0FFH,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 2 ; Track offset - ENDIF - - IF DRV_P - DEFB ' ',' '+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor - DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -HSIZ10 EQU 2762 ; Number of blocks in Fourth Logical Drive - -DPB60: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ10-1 ; Disk Size-1 - DEFW 1023 ; Dir Max - DEFB 0FFH,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 2 ; Track offset - ENDIF - -;----------- End of Hard Disk DPBs ------------- - \ No newline at end of file diff --git a/Source/BPBIOS/dpbhd-ww.lib b/Source/BPBIOS/dpbhd-ww.lib index 3d3900cc..fbb53a5d 100644 --- a/Source/BPBIOS/dpbhd-ww.lib +++ b/Source/BPBIOS/dpbhd-ww.lib @@ -1,309 +1,490 @@ -;======= Hard Disk Parameter Blocks ======= +;======= Hard Disk Parameter Blocks ======= ************************ +; - Retro-Brew boards w/ RomWBW HBIOS - ** Hardware Dependant ** +; ************************ +; 1.4 - 04 Sep 16 - Mods for HBIOS V 2.8 pre 5 LWN+WW +; 1.3 - 20 Jan 14 - Initial N8VEM test release LWN +; 1.2 - 17 Nov 07 - Initial LabZ80 test release LWN +; 1.1 - 27 Feb 93 - General Release. HFB +; 0.0 - 12 Jun 91 - Initial Test Release. HFB +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; The B/P BIOS DPB's contain prefix information that provide data on the ; logical format. This table contains only DPB Data on Hard Disk Partitions. ; See DPB.LIB for definitions of bit equates used in all DPB files. -; NOTE: For simplicity, the code always assumes a logical 16 512-byte sectors -; per track for SCSI interface. Translate the actual 17 or 18 sectors -; to an increased track count of 16 sector tracks. +; NOTE: For simplicity, BPBIOS always assumes a logical 16 512-byte +; sectors (64 128 byte records) per track for hard disks. +; One must therefore translate the actual number of sectors +; to a track count of 16 sectors per track. ;..... ; Format Type Byte 0 (Fixed Disk Subset) ; ------------------ ; D D D D D D D D ; 7 6 5 4 3 2 1 0 -; | | | | | +-+-+----- Disk Size 000 = Fixed Disk, remainder unused -; +-+-+-+-+----------- (unused) +; \ \ \ \ \ \_\_\____ Disk Size 000 = Fixed Disk +; \_\_\_\_\_________ (unused) -; All DPBs use the equate: FIXDSK EQU 00000000B from DPB.LIB +; Format Type Byte is set to FIXDSK EQU 00000000B. See DPB.LIB for +; def'ns. ; Format Type Byte 1 (Fixed Disk Subset) ; ------------------ ; D D D D D D D D ; 7 6 5 4 3 2 1 0 -; | | | | | +-+-+----- Sector Size: 010 = 512 bytes assumed in driver -; | | +-+-+----------- Allocation Size: 000=1K, 001=2K, 010=4K, 011=8K, 100=16K -; | +----------------- (reserved) -; +------------------- 1 = High Speed. (0 Not Used) +; \ \ \ \ \ \_\_\____ Sector Size +; \ \ \ \ \ 000=128, 001=256, 010=512, 011=1024 +; \ \ \_\_\________ Allocation Size +; \ \ 000=1K, 001=2K, 010=4K, 011=8K, 100=16K +; \ \____________ Reserved +; \_____________ Speed Normal 5.25" (0), 8" or HD Floppy (1) -; Information in this byte is not used in the SCSI driver, but is simply -; maintained for future use and compatibility with other DPB access routines. +; Information in this byte is not used in the driver, but is simply +; maintained for future use and compatibility with other DPB access +; applications such as BPCNFG. Refer to DPB.LIB for bit definitions. -; NOTE: No Skew Table is needed since Hard Disk Format is locked +; NOTE: No Skew Table needed since Hard Disk Format is locked w/No Skew ;..... -; Partition A. HBIOS Disk 0, Slice 0 +; Currently, BPBIOS supports 2 memory drive devices and 3 phyical hard +; drive like devices. BPBIOS can support seven but unfortunately +; BPCNFG only supports 3 hard drive like devices and the source +; code is not available, so menu 4 is meaningless. Devices +; include IDE Hard drives (16 bit), USB and SD card drives. CF +; cards can connect to both 8 and 16 bit IDE interfaces. Note +; that the RAM and ROM drives are handled separately. A default +; system configuration consists of two Floppy drives, an IDE drive +; and an SD drive. The IDE drive is allocated eight 8 MB slices +; while the SD drive will have four 8 MB slices. For SIMH, the +; IDE drive is replaced by SIMH HDSK0 with eight slices and the SD +; drive with SIMH HDSK1 with 4 slices. The configuration +; and/or mix of drives can be altered at any time by using BPCNFG +; Manually or by editting the appropriate .CNF file. The SD card +; could replaced by the USB for example, +; +; Starting with ver 2.8 of HBIOS, devices are discovered at boot +; time and assigned device numbers. Since devices are tested in +; a certain order, the device numbers are somewhat predicably +; assigned. Memory drives are discovered first. IDE drives are +; discovered next so that IDE Hard drives including CF cards are +; assigned device 2 and device 3 if a slave drive is supported by +; the interface. Next comes the SD drive and is assigned device 3 +; or 4 depending on the whether there is an ide slave drive. +; USB drive is assigned device 4 or 5 . For SIMH HDSK0 is device 0 +; and HDSK1 is device 1. Memory drives are now handled as LBA +; devices, ie like hard drives. +; +; The following non-memory drive capacities and configurations used for +; the SIMH, SD and IDE drives: Slice geometry is 256, 512 byte sectors, +; 1 head per track and 1 with one reserved track, a block size of 4096 +; bytes with 512 directory entries. An equivalent geometry is 16 +; sectors and 16 heads per track. Internally BPBIOS uses a uniform +; logical organization with 64 logical records per logical track. +; Thus there are 16 logical tracks per physical track with 1040 +; logical (65 physical) tracks per slice. If all partitions are not +; physically present, the missing partitions can be disabled in the +; BPBCNFG configuration file or by hand. Note that HBIOS uses LBA, +; Logical Block Addressing, for non-floppy drives. +; +; For SBC V1,2, ZETA, MARK IV and N8, the following non-memory partitions +; are available: +; +; These are the capacities and configuration used for the IDE drives: +; +; partition Size Blocks Block Offset in +; MByte Size logical tracks +;==================================================================== +; C 8 2048 4096 1*16 = 16 +; D 8 2048 4096 (1+65)*16 = 1056 +; E 8 2048 4096 (1+2*65)*16 = 2096 +; F 8 2048 4096 (1+3*65)*16 = 3136 +; G 8 2048 4096 (1+4*65)*16 = 4176 +; H 8 2048 4096 (1+5*65)*16 = 5216 +; I 8 2048 4096 (1+6*65)*16 = 6256 +; J 8 2048 4096 (1+7*65)*16 = 7296 +; +; These are capacities and configurations used for SD card: +; +; partition Size Blocks Block Offset +; MByte Size logical tracks +;==================================================================== +; K 8 2048 4096 1*16 = 16 +; L 8 2048 4096 (1+65)*16 = 1056 +; M 8 2048 4096 (1+2*65)*16 = 2096 +; N 8 2048 4096 (1+3*65)*16 = 3136 +; +; RAM drive is paritition A while ROM drive is partition B. +; +; For example, a typical Memory drive configuration is: +; +; partition Size Blocks Block Offset +; MByte Size logical tracks +;==================================================================== +; B 384K 192 2048 0 +; +; For SIMH the IDE and SD drives are replaced by HDSK0 and HDSK1. The +; follow non-RAM partitions are available: +; +; Simh HDSK0 drive configuration is identical to the IDE drive. +; +; Simh HDSK1 drive configuration is identical to the SD drive. +; +; Memory disks are drives A and B +; Hard drives (IDE, SD AND USB) are drives E TO L and M to P +; Floppies are drives O and P +; +;==================================================================== +; +;..... +; Partition A. RAM Disk +; Retro-Brew HBIOS RAM Disk Format assuming 64k for System & HBIOS banks - IF DRV_E - DEFB 'HBDSK0:0 ','A'+80H ; Id - 10 bytes + DEFB 'Ram Drive',' '+80H ; Id - 10 bytes + DEFB FIXDSK ; Format type byte 0 + DEFB SPEED8+SEC512+ALC2K ; Format type byte 1 + DEFB -1 ; Skew factor (== Only the +/- sign used) + DEFB 1 ; Starting sector number + DEFB 16 ; Physical # sectors/trk (16*512=8k per 'track') + DEFB 0 ; Physical tracks/side (No Meaning in HD) + +MSIZR EQU (32*16) ; Maximum blocks in RAM drive (assume 1MB) + +DPBRAM: DEFW 64 ; Records/Track (16 sectors*4 records/sector) + DEFB 4 ; Block Shift Factor (2k per block) + DEFB 0FH ; Block Mask + DEFB 1 ; Extent Mask (updated at boot by HB_INIT) + DEFW MSIZR-1 ; Disk Blocks (updated at boot by HB_INIT) + DEFW 255 ; Dir Max-1 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 + DEFW 0000 ; Check Size + DEFW 0000 ; Trk Offset from beginning of Ram Bank base +; +;..... +; Partition B. ROM Disk +; Retro-Brew HBIOS ROM Disk Format assuming 64k for System & HBIOS banks + + DEFB 'ROM Drive',' '+80H ; Id - 10 bytes + DEFB FIXDSK ; Format type byte 0 +; DEFB SPEED8+SEC128+ALC2K ; Format type byte 1 + DEFB SPEED8+SEC512+ALC2K ; Format type byte 1 + DEFB -1 ; Skew factor (== Only the +/- sign used) +; DEFB 0 ; Starting sector number + DEFB 1 ; Starting sector number +; DEFB 32 ; Physical # sectors/trk (32=4k per 'track') + DEFB 16 ; Physical # sectors/trk (32=4k per 'track') + DEFB 0 ; Physical tracks/side (No Meaning in HD) + +MSIZO EQU (32*16) ; Maximum blocks in ROM drive (assume 1MB) + +DPBROM: DEFW 64 ; Sectors/Track + DEFB 4 ; Block Shift Factor (2k per block) + DEFB 0FH ; Block Mask + DEFB 1 ; Extent Mask (updated at boot by HB_INIT) + DEFW MSIZO-1 ; Disk Blocks (updated at boot by HB_INIT) + DEFW 255 ; Dir Max-1 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 + DEFW 0000 ; Check Size + DEFW 0000 ; Trk Offset from beginning of Ram Bank base +; +;..... +; Partition C. HBIOS Disk 0, Slice 0 + + IF DRV_C + DEFB 'HBDSK0:0 ','C'+80H ; Id - 10 bytes DEFB FIXDSK ; Format type byte 0 DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 DEFB -2 ; Skew factor (== Only the +/- sign used) DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track + DEFB 16 ; 16 Logical sectors are defined in DPB + ; even though real layout is 256 physical + ; sectors per track DEFB 0 ; Physical tracks/side (No Meaning in HD) - HSIZ0 EQU 2048 ; # of blocks in first Partition (1024 trks) - - ; ; -DPB50: DEFW 64 ; Sctrs/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ0-1 ; Disk Size-1 - DEFW 511 ; Dir Max - DEFB 0F0H,0 ; Alloc 0,1 - DEFW 0 ; Check Size - DEFW 16 ; Trk Offset +DPB50: DEFW 64 ; Sctrs/Trk + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ0-1 ; Disk Size-1 + DEFW 511 ; Dir Max-1 - 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 - 4 blocks + DEFW 0 ; Check Size + DEFW 16 ; Trk Offset ENDIF - +; ;..... -; Partition B. HBIOS Disk 0, Slice 1 +; Partition D. HBIOS Disk 0, Slice 1 - IF DRV_F - DEFB 'HBDSK0:1 ','B'+80H ; Id - 10 bytes + IF DRV_D + DEFB 'HBDSK0:1 ','D'+80H ; Id - 10 bytes DEFB FIXDSK ; Format type byte 0 DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 DEFB -2 ; Skew factor DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track + DEFB 16 ; 16 Logical Sectors per track is defined + ; in DPB even though there is 256 physical + ; sectors per track DEFB 0 ; Physical tracks/side (No Meaning in HD) HSIZ1 EQU 2048 ; # of blocks in Second Partition (1024 trks) - - ; - ; -DPB51: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ1-1 ; Disk Size-1 - DEFW 511 ; Dir Max - DEFB 0F0H,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 1056 ; Track offset + ; +DPB51: DEFW 64 ; Scts/Trk + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ1-1 ; Disk Size-1 + DEFW 511 ; Dir Max-1 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 + DEFW 0 ; Check size + DEFW (1+65)*16 ; Track offset 1056 ENDIF - +; ;..... -; Partition C. HBIOS Disk 0, Slice 2 +; Partition E. HBIOS Disk 0, Slice 2 - IF DRV_G - DEFB 'HBDSK0:2 ','C'+80H ; Id - 10 bytes + IF DRV_E + DEFB 'HBDSK0:2 ','E'+80H ; Id - 10 bytes DEFB FIXDSK ; Format type byte 0 DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 DEFB -2 ; Skew factor DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track + DEFB 16 ; 16 Logical Sectors per track is defined + ; in DPB even though there is 256 physical + ; sectors per track DEFB 0 ; Physical tracks/side (No Meaning in HD) HSIZ2 EQU 2048 ; # of blocks in third Partition (1024 tracks) - - ; ; -DPB52: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ2-1 ; Disk Size-1 - DEFW 511 ; Dir Max - DEFB 0F0H,0 ; Alloc0,1 - DEFW 0 ; Check size - DEFW 2096 ; Track offset +DPB52: DEFW 64 ; Scts/Trk + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ2-1 ; Disk Size-1 + DEFW 511 ; Dir Max-1 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 + DEFW 0 ; Check size + DEFW (1+2*65)*16 ; Track offset = 2096 ENDIF - +; ;..... -; Partition D. HBIOS Disk 0, Slice 3 +; Partition F. HBIOS Disk 0, Slice 4 - IF DRV_H - DEFB 'HBDSK0:3 ','D'+80H ; Id - 10 bytes + IF DRV_F + DEFB 'HBDSK0:3 ','F'+80H ; Id - 10 bytes DEFB FIXDSK ; Format type byte 0 DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 DEFB -2 ; Skew factor DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track + DEFB 16 ; 16 Logical Sectors per track is defined + ; in DPB even though there is 256 physical + ; sectors per track DEFB 0 ; Physical tracks/side (No Meaning in HD) HSIZ3 EQU 2048 ; # of blocks in Fourth Partition (1024 tracks) - - ; ; -DPB53: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ3-1 ; Disk Size-1 - DEFW 511 ; Dir Max - DEFB 0F0H,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 3136 ; Track offset +DPB53: DEFW 64 ; Scts/Trk + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ3-1 ; Disk Size-1 + DEFW 511 ; Dir Max-1 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 + DEFW 0 ; Check size + DEFW (1+3*65)*16 ; Track offset = 3136 ENDIF - +; ;..... -; Partition A. HBIOS Disk 1, Slice 0 +; Partition G. HBIOS Disk 0, Slice 4 - IF DRV_I - DEFB 'HBDSK1:0 ','E'+80H ; Id - 10 bytes + IF DRV_G + DEFB 'HBDSK0:4 ','G'+80H ; Id - 10 bytes DEFB FIXDSK ; Format type byte 0 DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 DEFB -2 ; Skew factor (== Only the +/- sign used) DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track + DEFB 16 ; 16 Logical Sectors per track is defined + ; in DPB even though there is 64 physical + ; sectors per track DEFB 0 ; Physical tracks/side (No Meaning in HD) HSIZ4 EQU 2048 ; # of blocks in first Partition (1024 trks) - ; - ; -DPB54: DEFW 64 ; Sctrs/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ4-1 ; Disk Size-1 - DEFW 511 ; Dir Max - DEFB 0F0H,0 ; Alloc 0,1 - DEFW 0 ; Check Size - DEFW 16 ; Trk Offset +DPB54: DEFW 64 ; Sctrs/Trk + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ4-1 ; Disk Size - 1 + DEFW 511 ; Dir Max-1 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 + DEFW 0 ; Check size + DEFW (1+4*65)*16 ; Track offset = 16 ENDIF - +; ;..... -; Partition B. HBIOS Disk 1, Slice 1 +; Partition H. HBIOS Disk 0, Slice 5 - IF DRV_J - DEFB 'HBDSK1:1 ','F'+80H ; Id - 10 bytes + IF DRV_H + DEFB 'HBDSK0:5 ','H'+80H ; Id - 10 bytes DEFB FIXDSK ; Format type byte 0 DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 - DEFB -2 ; Skew factor + DEFB -2 ; Skew factor (== Only the +/- sign used) DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track + DEFB 16 ; 16 Logical sectors is defined in DPB + ; even though real layout is 64 physical + ; sectors per track DEFB 0 ; Physical tracks/side (No Meaning in HD) HSIZ5 EQU 2048 ; # of blocks in Second Partition (1024 trks) - - ; - ; -DPB55: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ5-1 ; Disk Size-1 - DEFW 511 ; Dir Max - DEFB 0F0H,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 1056 ; Track offset + ; +DPB55: DEFW 64 ; Sctrs/Trk - actually 256 + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ5-1 ; Disk Size-1 + DEFW 511 ; Dir Max-1 + DEFB 0F0H,0 ; Alloc 0,1 - 4 blocks + DEFW 0 ; Check Size + DEFW (1+5*65)*16 ; Trk Offset = 1056 ENDIF - +; ;..... -; Partition C. HBIOS Disk 1, Slice 2 +; Partition I. HBIOS Disk 0, Slice 6 - IF DRV_K - DEFB 'HBDSK1:2 ','G'+80H ; Id - 10 bytes + IF DRV_I + DEFB 'HBDSK0:6 ','I'+80H ; Id - 10 bytes DEFB FIXDSK ; Format type byte 0 DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 DEFB -2 ; Skew factor DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track + DEFB 16 ; 16 Logical Sectors per track is defined + ; in DPB even though there is 64 physical + ; sectors per track DEFB 0 ; Physical tracks/side (No Meaning in HD) HSIZ6 EQU 2048 ; # of blocks in third Partition (1024 tracks) - ; - ; -DPB56: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ6-1 ; Disk Size-1 - DEFW 511 ; Dir Max - DEFB 0F0H,0 ; Alloc0,1 - DEFW 0 ; Check size - DEFW 2096 ; Track offset +DPB56: DEFW 64 ; Scts/Trk + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ6-1 ; Disk Size-1 + DEFW 511 ; Dir Max-1 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 + DEFW 0 ; Check size + DEFW (1+6*65)*16 ; Track offset = 2096 ENDIF ;..... -; Partition D. HBIOS Disk 1, Slice 3 +; Partition J. HBIOS Disk 0, Slice 7 - IF DRV_L - DEFB 'HBDSK1:3 ','H'+80H ; Id - 10 bytes + IF DRV_J + DEFB 'HBDSK0:7 ','J'+80H ; Id - 10 bytes DEFB FIXDSK ; Format type byte 0 DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 DEFB -2 ; Skew factor DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track + DEFB 16 ; 16 Logical Sectors per track is defined + ; in DPB even though there is 64 physical + ; sectors per track DEFB 0 ; Physical tracks/side (No Meaning in HD) HSIZ7 EQU 2048 ; # of blocks in Fourth Partition (1024 tracks) + ; +DPB57: DEFW 64 ; Scts/Trk + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ7-1 ; Disk Size-1 + DEFW 511 ; Dir Max-1 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 + DEFW 0 ; Check size + DEFW (1+7*65)*16 ; Track offset = 3136 + ENDIF +; +;..... +; partition K. HBIOS Disk 1, Slice 0 + IF DRV_K + DEFB 'HBDSK1:0 ','K'+80H ; Id - 10 bytes + DEFB FIXDSK ; Format type byte 0 + DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 + DEFB -2 ; Skew factor (== Only the +/- sign used) + DEFB 1 ; Starting sector number + DEFB 16 ; 16 Logical sectors are defined in DPB + ; even though real layout is 256 physical + ; sectors per track + DEFB 0 ; Physical tracks/side (No Meaning in HD) +HSIZ8 EQU 2048 ; # of blocks in first Partition (1024 trks) ; - ; -DPB57: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ7-1 ; Disk Size-1 - DEFW 511 ; Dir Max - DEFB 0F0H,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 3136 ; Track offset +DPB58: DEFW 64 ; Sctrs/Trk + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ8-1 ; Disk Size-1 + DEFW 511 ; Dir Max-1 - 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 - 4 blocks + DEFW 0 ; Check Size + DEFW 16 ; Trk Offset ENDIF +; +;..... +; partition L. HBIOS Disk 1, Slice 1 -;<<< --- Drive M is used for RAM Drive --- >>> - - IF DRV_N - DEFB 'ROM ',' '+80H ; Id - 10 bytes + IF DRV_L + DEFB 'HBDSK1:1 ','L'+80H ; Id - 10 bytes DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC2K ; Format type byte 1 + DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 DEFB -2 ; Skew factor DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track + DEFB 16 ; 16 Logical Sectors per track is defined + ; in DPB even though there is 256 physical + ; sectors per track DEFB 0 ; Physical tracks/side (No Meaning in HD) -HSIZ8 EQU HB_ROMBLKS - -DPB58: DEFW 64 ; Scts/Trk - DEFB 4 ; Blk Shf Fctr - DEFB 15 ; Block Mask - IF ((HSIZ8 - 1) < 256) - DEFB 1 ; Extent Mask - ELSE - DEFB 0 ; Extent Mask - ENDIF - DEFW HSIZ8-1 ; Disk Size-1 - DEFW 255 ; Dir Max - DEFB 0F0H,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 0 ; Track offset +HSIZ9 EQU 2048 ; # of blocks in Second Partition (1024 trks) + ; +DPB59: DEFW 64 ; Scts/Trk + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ9-1 ; Disk Size-1 + DEFW 511 ; Dir Max-1 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 + DEFW 0 ; Check size + DEFW (1+65)*16 ; Track offset 1056 ENDIF +; +;..... +; partition M. HBIOS Disk 1, Slice 2 - IF DRV_O - DEFB 'RAM ',' '+80H ; Id - 10 bytes + IF DRV_M + DEFB 'HBDSK1:2 ','M'+80H ; Id - 10 bytes DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC512+ALC2K ; Format type byte 1 + DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 DEFB -2 ; Skew factor DEFB 1 ; Starting sector number - DEFB 16 ; Logical Sectors per track + DEFB 16 ; 16 Logical Sectors per track is defined + ; in DPB even though there is 256 physical + ; sectors per track DEFB 0 ; Physical tracks/side (No Meaning in HD) -HSIZ9 EQU HB_RAMBLKS - -DPB59: DEFW 64 ; Scts/Trk - DEFB 4 ; Blk Shf Fctr - DEFB 15 ; Block Mask - IF ((HSIZ9 - 1) < 256) - DEFB 1 ; Extent Mask - ELSE - DEFB 0 ; Extent Mask +HSIZ10 EQU 2048 ; # of blocks in Second Partition (1024 trks) + ; +DPB60: DEFW 64 ; Scts/Trk + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ10 ; Disk Size-1 + DEFW 511 ; Dir Max-1 4 blocks + DEFB 0F0H,0 ; Alloc 0,1 + DEFW 0 ; Check size + DEFW (1+2*65)*16 ; Track offset 2096 ENDIF - DEFW HSIZ9-1 ; Disk Size-1 - DEFW 255 ; Dir Max - DEFB 0F0H,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 0 ; Track offset - ENDIF - - IF DRV_P - DEFB ' ',' '+80H ; Id - 10 bytes +; +;..... +; partition N. HBIOS Disk 1, Slice 3 + IF DRV_N + DEFB 'HBDSK1:3 ','N'+80H ; Id - 10 bytes DEFB FIXDSK ; Format type byte 0 DEFB SPEED8+SEC512+ALC4K ; Format type byte 1 DEFB -2 ; Skew factor @@ -311,18 +492,19 @@ DPB59: DEFW 64 ; Scts/Trk DEFB 16 ; Logical Sectors per track DEFB 0 ; Physical tracks/side (No Meaning in HD) -HSIZ10 EQU 2762 ; Number of blocks in Fourth Logical Drive - -DPB60: DEFW 64 ; Scts/Trk - DEFB 5 ; Blk Shf Fctr - DEFB 31 ; Block Mask - DEFB 1 ; Extent Mask - DEFW HSIZ10-1 ; Disk Size-1 - DEFW 1023 ; Dir Max - DEFB 0FFH,0 ; Alloc 0,1 - DEFW 0 ; Check size - DEFW 2 ; Track offset +HSIZ11 EQU 2048 ; # of blocks in Forth Logical Drive + ; (1024 tracks) + +DPB61: DEFW 64 ; Scts/Trk + DEFB 5 ; Blk Shf Fctr + DEFB 31 ; Block Mask + DEFB 1 ; Extent Mask + DEFW HSIZ11-1 ; Disk Size-1 + DEFW 511 ; Dir Max-1 + DEFB 0F0H,0 ; Alloc 0,1 + DEFW 0 ; Check size + DEFW (1+3*65)*16 ; Track offset 3136 ENDIF - -;----------- End of Hard Disk DPBs ------------- - \ No newline at end of file + +;=========== End of Hard Disk DPBs =========== + \ No newline at end of file diff --git a/Source/BPBIOS/dpbm-dx.lib b/Source/BPBIOS/dpbm-dx.lib deleted file mode 100644 index c88799a4..00000000 --- a/Source/BPBIOS/dpbm-dx.lib +++ /dev/null @@ -1,41 +0,0 @@ -;=========== RAM Disk Parameter Block =============************************ -; - D-X Designs Pty Ltd P112 - ** Hardware Dependent ** -; ************************ -; 1.1 - 28 Aug 01 - Cleaned up for GPL release. HFB -; 1.0 - 10 Jun 96 - Initial Release for P112 derived from YASBEC. HFB -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; The B/P BIOS DPB's contain prefix information that provide data on the -; logical format. This table contains only DPB Data on a RAM Disk. - -; Format Type Bytes 0 and 1 are configured in the same way as Hard Disks. -; See DPBHD-xx.LIB and DPB.LIB files for descriptions of these two bytes. - -; NOTE: No Skew Table needed since RAM Disk Format is locked and not needed - -;..... -; P112 RAM Disk Format assuming 32k for a single System bank - - DEFB 'D-X Desig','n'+80H ; Id - 10 bytes - DEFB FIXDSK ; Format type byte 0 - DEFB SPEED8+SEC128+ALC2K ; Format type byte 1 - DEFB -1 ; Skew factor (== Only the +/- sign used) - DEFB 0 ; Starting sector number - DEFB 32 ; Physical # sectors/trk (32=4k per 'track') - DEFB 0 ; Physical tracks/side (No Meaning in HD) - -MSIZ EQU 176 ; # of blocks in Drive (by Memory/Block size) - ; 2x128k = 80 (160k) - 64 (128k) w/User Bank - ; 1x512k = 192 (384k) - 176 (352k) w/User Bank - ; 2x512k = 448 (896k) - 432 (864k) w/User Bank -DPBRAM: DEFW 32 ; Sectors/Track - DEFB 4 ; Block Shift Factor (2k per block) - DEFB 0FH ; Block Mask - DEFB 0 ; Extent Mask - DEFW MSIZ-1 ; Disk Size-1 256 kB 512 kB 1024 kB - DEFW 128 ; Dir Max -or- 64 128 256 - DEFB 0C0H, 00 ; Alloc 0, 1 80H,0 0C0H,0 0F0H,0 - DEFW 0000 ; Check Size - DEFW 0000 ; Trk Offset from beginning of Ram Bank base - -;==================== End of RAM Disk DPB ==================== - \ No newline at end of file diff --git a/Source/BPBIOS/dpbram.lib b/Source/BPBIOS/dpbram.lib index 8ccac9d9..85fb43a9 100644 --- a/Source/BPBIOS/dpbram.lib +++ b/Source/BPBIOS/dpbram.lib @@ -1,6 +1,7 @@ ;================ Disk Parameter Blocks, Fixed Formats ==================== ; Generic File. ; +; 1.1 - 04 Sep 16 - Mods for HBIOS V 2.8 LN+WW ; 1.0 - 31 Aug 92 - General Release. HFB ; 0.1 - 3 Jan 92 - Initial Release. HFB ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -136,4 +137,4 @@ DPBRB: DEFW 40 ; Sectors per track DEFB 00,00 ; Physical sector ENDIF ;======================= End of DPBRAM.LIB =========================== - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/dph.lib b/Source/BPBIOS/dph.lib index 1f6021e6..2e8470c1 100644 --- a/Source/BPBIOS/dph.lib +++ b/Source/BPBIOS/dph.lib @@ -5,104 +5,117 @@ ; All access to DPH's are done through this table. A Zero in this table ; indicates the logical drive does Not exist. The table is indexed by logical ; drive (e.g. A-P). To swap logical drives, exchange entries in this table. +; Default drive ordering is RAM (A), ROM (B), 8 logical drives from 1st +; Hard drive (C-J), 4 logical drives from the second Hard drive (M-P) and +; two Floppy drives (O&P),. BPCNFG can be used to rearrange drive order +; to suit the user. ; ; 1.0 - 31 Aug 92 - General Release. HFB ; 0.1 - 3 Jan 92 - Initial Release. HFB ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: CSEG - -; Table has been reordered so that hard disk entries come before -; floppy entries. This means that "DRV_A" appears as I: and "DRV_E" -; appears as A:. The point is to allow booting from the first -; hard drive which pretty much needs to be A: + +; Note: ROMWBW boots from any disk on demand so order of table not +; important with regards to booting from disks rather than ROM. DPHTBL: + IF DRV_A + DEFW DPH$90 ; Dph for drive A (RAM) + ELSE + DEFW 00 + ENDIF ;DRV_A +; + IF DRV_B + DEFW DPH$91 ; Dph for drive B (ROM) + ELSE + DEFW 00 + ENDIF ;DRV_B +; + IF DRV_C AND HARDDSK + DEFW DPH$50 ; Dph for Hard drive Partition C + ELSE + DEFW 0 + ENDIF ;DRV_C AND HARDDSK +; + IF DRV_D AND HARDDSK + DEFW DPH$51 ; Dph for Hard drive Partition D + ELSE + DEFW 0 + ENDIF ;DRV_D AND HARDDSK +; IF DRV_E AND HARDDSK - DEFW DPH$50 ; Dph for Hard drive Partition E + DEFW DPH$52 ; Dph for Hard drive Partition E ELSE DEFW 00 - ENDIF + ENDIF ;DRV_E AND HARDDSK +; IF DRV_F AND HARDDSK - DEFW DPH$51 ; Dph for Hard drive Partition F + DEFW DPH$53 ; Dph for Hard drive Partition F ELSE - DEFW 00 - ENDIF + DEFW 0 + ENDIF ;DRV_F AND HARDDSK +; IF DRV_G AND HARDDSK - DEFW DPH$52 ; Dph for Hard drive Partition G + DEFW DPH$54 ; Dph for Hard drive Partition G ELSE - DEFW 00 - ENDIF + DEFW 0 + ENDIF ;DRV_G AND HARDDSK +; IF DRV_H AND HARDDSK - DEFW DPH$53 ; Dph for Hard drive Partition H + DEFW DPH$55 ; Dph for Hard drive Partition H ELSE - DEFW 00 - ENDIF - + DEFW 0 + ENDIF ;DRV_H AND HARDDSK +; IF DRV_I AND HARDDSK - DEFW DPH$54 ; Dph for Hard drive Partition I + DEFW DPH$56 ; Dph for Hard drive Partition I ELSE - DEFW 00 - ENDIF + DEFW 0 + ENDIF ;DRV_I AND HARDDSK +; IF DRV_J AND HARDDSK - DEFW DPH$55 ; Dph for Hard drive Partition J + DEFW DPH$57 ; Dph for Hard drive Partition J ELSE DEFW 00 - ENDIF + ENDIF ;DRV_J AND HARDDSK +; IF DRV_K AND HARDDSK - DEFW DPH$56 ; Dph for Hard drive Partition K + DEFW DPH$58 ; Dph for Hard drive Partition K ELSE DEFW 00 - ENDIF + ENDIF ;DRV_K AND HARDDSK +; IF DRV_L AND HARDDSK - DEFW DPH$57 ; Dph for Hard drive Partition L - ELSE - DEFW 00 - ENDIF - - IF DRV_A - DEFW DPH$00 ; Dph for drive A (Floppy) - ELSE - DEFW 00 - ENDIF - IF DRV_B - DEFW DPH$01 ; Dph for drive B (Floppy) + DEFW DPH$59 ; Dph for Hard drive Partition L ELSE DEFW 00 - ENDIF - IF DRV_C - DEFW DPH$02 ; Dph for drive C (Floppy) + ENDIF ;DRV_L AND HARDDSK +; + IF DRV_M AND HARDDSK + DEFW DPH$60 ; Dph for Hard drive Partition M ELSE DEFW 00 - ENDIF - IF DRV_D - DEFW DPH$03 ; Dph for drive D (Floppy) - ELSE - DEFW 0 ; Dph for drive D - ENDIF - - IF DRV_M AND RAMDSK - DEFW DPH$90 ; Dph for RAM Drive M in DPHM-xx.Z80 - ELSE - DEFW 00 ; Dph for drive M - ENDIF ;ramdsk - + ENDIF ;DRV_M AND HARDDSK +; IF DRV_N AND HARDDSK - DEFW DPH$58 ; Dph for Hard drive Partition N + DEFW DPH$61 ; Dph for Hard drive Partition N ELSE DEFW 00 - ENDIF - IF DRV_O AND HARDDSK - DEFW DPH$59 ; Dph for Hard drive Partition O + ENDIF ;DRV_N AND HARDDSK +; + IF DRV_O AND FLPYDSK + DEFW DPH$00 ; Dph for drive O (First Floppy) ELSE DEFW 00 - ENDIF - IF DRV_P AND HARDDSK - DEFW DPH$60 ; Dph for Hard drive Partition P + ENDIF ;DRV_O +; + IF DRV_P AND FLPYDSK + DEFW DPH$01 ; Dph for drive P (Second Floppy) ELSE DEFW 00 - ENDIF - + ENDIF ;DRV_P +; ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; Disk Parameter Headers (DPH) for Drives MUST be in Common Memory ; @@ -140,8 +153,8 @@ DBLSTP EQU 00010000B NODBLS EQU 00000000B CSEG - - IF DRV_A +; Floppy Headers + IF DRV_O AND FLPYDSK XDPH00: DB LOCKF ; Format lock flag DB DSK5+DS+DD+DVSPDL+MTR ; Disk drive type DB 1 ; Driver id @@ -159,8 +172,9 @@ DPH$00: DW 0 ; Skew table pointer XDPHSZ EQU $-XDPH00 ; Calc for xdph size XDPHOF EQU DPH$00-XDPH00 ; Offset from xdph to dph - ENDIF ;Drv_a - IF DRV_B + ENDIF ;Drv_O +; + IF DRV_P AND FLPYDSK XDPH01: DB LOCKF ; Format lock flag DB DSK5+DS+DD+DVSPDL+MTR ; Disk drive type DB 1 ; Driver id @@ -172,42 +186,44 @@ DPH$01: DW 0 ; Skew table pointer DEFW DPB$01+DPHDSZ ; Ram space for DPB #1 ELSE DW DPBRB ; Pointer to current DPB for Drive 1 - ENDIF + ENDIF ;AUTOSL DW CHK$01 ; Wacd for drive 01 DW ALV$01 ; Alloc vector for 01 - ENDIF ;Drv_b - IF DRV_C -XDPH02: DB LOCKF ; Format lock flag - DB DSK5+DS+DD+DVSPDL+MTR ; Disk drive type - DB 1 ; Driver id - DB 2 ; Physical drive number -DPH$02: DW 0 ; Skew table pointer - DW 0,0,0 ; Scratch area - DW DIRBUF ; Directory buffer pointer - IF AUTOSL - DEFW DPB$02+DPHDSZ ; Ram space for DPB #2 - ELSE - DW DPBRA ; Pointer to current DPB for Drive #2 - ENDIF - DW CHK$02 ; Wacd for drive 02 - DW ALV$02 ; Alloc vector for 02 - ENDIF - IF DRV_D -XDPH03: DB LOCKF ; Format lock flag - DB DSK3+sS+DD+DVSPDl+MTR ; Disk drive type - DB 1 ; Driver id - DB 3 ; Physical drive number -DPH$03: DW 0 ; Skew table pointer - DW 0,0,0 ; Scratch area - DW DIRBUF ; Directory buffer pointer - IF AUTOSL - DEFW DPB$03+DPHDSZ ; Ram space for DPB #3 - ELSE - DW DPBRA ; Pointer to current DPB for Drive #3 - ENDIF - DW CHK$03 ; Wacd for drive 03 - DW ALV$03 ; Alloc vector for 03 - ENDIF ;Drv_d + ENDIF ;Drv_P +; +; Third and fourth floppy drives removed +; IF DRV_E +;XDPH02: DB LOCKF ; Format lock flag +; DB DSK5+DS+DD+DVSPDL+MTR ; Disk drive type +; DB 1 ; Driver id +; DB 2 ; Physical drive number +;DPH$02: DW 0 ; Skew table pointer +; DW 0,0,0 ; Scratch area +; DW DIRBUF ; Directory buffer pointer +; IF AUTOSL +; DEFW DPB$02+DPHDSZ ; Ram space for DPB #2 +; ELSE +; DW DPBRA ; Pointer to current DPB for Drive #2 +; ENDIF +; DW CHK$02 ; Wacd for drive 02 +; DW ALV$02 ; Alloc vector for 02 +; ENDIF +; IF DRV_F +;XDPH03: DB LOCKF ; Format lock flag +; DB DSK3+sS+DD+DVSPDl+MTR ; Disk drive type +; DB 1 ; Driver id +; DB 3 ; Physical drive number +;DPH$03: DW 0 ; Skew table pointer +; DW 0,0,0 ; Scratch area +; DW DIRBUF ; Directory buffer pointer +; IF AUTOSL +; DEFW DPB$03+DPHDSZ ; Ram space for DPB #3 +; ELSE +; DW DPBRA ; Pointer to current DPB for Drive #3 +; ENDIF +; DW CHK$03 ; Wacd for drive 03 +; DW ALV$03 ; Alloc vector for 03 +; ENDIF ;Drv_F ; Directory Buffer Allocation. Only One Directory Buffer is required. Since ; we want it to be the first item in DSEG, it must be placed here. @@ -218,7 +234,7 @@ DPH$03: DW 0 ; Skew table pointer DIRBUF EQU CBOOT ; Resident Init code in here ELSE DIRBUF EQU $ - ENDIF + ENDIF ;BANKED ORG DIRBUF+128 ; Directory buffer ; If we are using autoselection of drives, we copy the XDPB/DPB structure @@ -226,58 +242,64 @@ DIRBUF EQU $ ; installing data for the desired format and locking the DPH. For Non-auto- ; select, we simply point to the read-only structure defined in DPB.LIB. - IF AUTOSL - IF DRV_A + IF AUTOSL AND FLPYDSK + IF DRV_O DPB$00: DEFS DPBSIZ ; Size of XDPB+DPB - ENDIF - IF DRV_B + ENDIF ;DRV_O +; + IF DRV_P DPB$01: DEFS DPBSIZ - ENDIF - IF DRV_C -DPB$02: DEFS DPBSIZ - ENDIF - IF DRV_D -DPB$03: DEFS DPBSIZ - ENDIF + ENDIF ;DRV_P +; +; Third and fourth floppy drives removed +; IF DRV_E +;DPB$02: DEFS DPBSIZ +; ENDIF +; IF DRV_F +;DPB$03: DEFS DPBSIZ +; ENDIF ENDIF ;autosel IF [BANKED AND ZSDOS2] COMMON /B2RAM/ ELSE DSEG - ENDIF + ENDIF ; [BANKED AND ZSDOS2] ; Directory Check Buffers. Each Buffer MUST be NDE/4 Bytes long at minimum. ; Each Logical Drive with removable media MUST have its own check buffer. - IF DRV_A + IF DRV_O AND FLPYDSK CHK$00: DEFS [MXFDIR/4]+1 ; Enough for 256 dir entries ENDIF - IF DRV_B +; + IF DRV_P AND FLPYDSK CHK$01: DEFS [MXFDIR/4]+1 ; Enough for 256 dir entries ENDIF - IF DRV_C -CHK$02: DEFS [MXFDIR/4]+1 ; Enough for 256 dir entries - ENDIF - IF DRV_D -CHK$03: DEFS [MXFDIR/4]+1 ; Enough for 256 dir entries - ENDIF +; +; IF DRV_E +;CHK$02: DEFS [MXFDIR/4]+1 ; Enough for 256 dir entries +; ENDIF +; IF DRV_F +;CHK$03: DEFS [MXFDIR/4]+1 ; Enough for 256 dir entries +; ENDIF ; Allocation BitMap Buffers. Each MUST be NAB/8 Bytes at Minimum. ; Each Logical Floppy Drive MUST have an Allocation BitMap Buffer. - - IF DRV_A +; + IF DRV_O AND FLPYDSK ALV$00: DEFS [MXFALC/8]+1 ; Enough for 800 KB or 1.44 MB drives ENDIF - IF DRV_B +; + IF DRV_P AND FLPYDSK ALV$01: DEFS [MXFALC/8]+1 ; Enough for 800 KB or 1.44 MB drives ENDIF - IF DRV_C -ALV$02: DEFS [MXFALC/8]+1 ; Enough for 800 KB or 1.44 MB drives - ENDIF - IF DRV_D -ALV$03: DEFS [MXFALC/8]+1 ; Enough for 800 KB or 1.44 MB drives - ENDIF +; IF DRV_E +;ALV$02: DEFS [MXFALC/8]+1 ; Enough for 800 KB or 1.44 MB drives +; ENDIF +; IF DRV_F +;ALV$03: DEFS [MXFALC/8]+1 ; Enough for 800 KB or 1.44 MB drives +; ENDIF ;======================= End of DPH.LIB ======================= - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/dph.lib.sav b/Source/BPBIOS/dph.lib.sav deleted file mode 100644 index 58b0af34..00000000 --- a/Source/BPBIOS/dph.lib.sav +++ /dev/null @@ -1,274 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::***************************** -; DPH Pointer Table ** Configuration Dependant ** -; (This table may be in Banked Memory) ***************************** -; -; All access to DPH's are done through this table. A Zero in this table -; indicates the logical drive does Not exist. The table is indexed by logical -; drive (e.g. A-P). To swap logical drives, exchange entries in this table. -; -; 1.0 - 31 Aug 92 - General Release. HFB -; 0.1 - 3 Jan 92 - Initial Release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - CSEG - -DPHTBL: - IF DRV_A - DEFW DPH$00 ; Dph for drive A (Floppy) - ELSE - DEFW 00 - ENDIF - IF DRV_B - DEFW DPH$01 ; Dph for drive B (Floppy) - ELSE - DEFW 00 - ENDIF - IF DRV_C - DEFW DPH$02 ; Dph for drive C (Floppy) - ELSE - DEFW 00 - ENDIF - IF DRV_D - DEFW DPH$03 ; Dph for drive D (Floppy) - ELSE - DEFW 0 ; Dph for drive D - ENDIF - IF DRV_E AND HARDDSK - DEFW DPH$50 ; Dph for Hard drive Partition E - ELSE - DEFW 00 - ENDIF - IF DRV_F AND HARDDSK - DEFW DPH$51 ; Dph for Hard drive Partition F - ELSE - DEFW 00 - ENDIF - IF DRV_G AND HARDDSK - DEFW DPH$52 ; Dph for Hard drive Partition G - ELSE - DEFW 00 - ENDIF - IF DRV_H AND HARDDSK - DEFW DPH$53 ; Dph for Hard drive Partition H - ELSE - DEFW 00 - ENDIF - IF DRV_I AND HARDDSK - DEFW DPH$54 ; Dph for Hard drive Partition I - ELSE - DEFW 00 - ENDIF - IF DRV_J AND HARDDSK - DEFW DPH$55 ; Dph for Hard drive Partition J - ELSE - DEFW 00 - ENDIF - IF DRV_K AND HARDDSK - DEFW DPH$56 ; Dph for Hard drive Partition K - ELSE - DEFW 00 - ENDIF - IF DRV_L AND HARDDSK - DEFW DPH$57 ; Dph for Hard drive Partition L - ELSE - DEFW 00 - ENDIF - IF DRV_M AND RAMDSK - DEFW DPH$90 ; Dph for RAM Drive M in DPHM-xx.Z80 - ELSE - DEFW 00 ; Dph for drive M - ENDIF ;ramdsk - IF DRV_N AND HARDDSK - DEFW DPH$58 ; Dph for Hard drive Partition N - ELSE - DEFW 00 - ENDIF - IF DRV_O AND HARDDSK - DEFW DPH$59 ; Dph for Hard drive Partition O - ELSE - DEFW 00 - ENDIF - IF DRV_P AND HARDDSK - DEFW DPH$60 ; Dph for Hard drive Partition P - ELSE - DEFW 00 - ENDIF - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Disk Parameter Headers (DPH) for Drives MUST be in Common Memory -; -; The DPH's used have a two byte prefix which indicates the Physical -; Unit # and the Driver Number for the Drive. The Physical Unit Number -; is Controller specific, while the driver number is used to select -; which service routines are to be called to satisfy service requests. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -; Drive Type Byte -; --------------- -; D D D D D D D D -; 7 6 5 4 3 2 1 0 -; | | | | | +-+-+--- Disk Size: 000=Fixed Disk, 001=8", 010=5.25", 011=3.5" -; | | | | +--------- 0 = Single Sided, 1 = Double Sided -; | | | +----------- 0 = Normal Step, 1 = Double-Step Drive -; | | +------------- 0 = Motor Always On, 1 = Drive Motor Control needed -; | +--------------- 0 = Max Speed is Normal 5.25" (300rpm) -; | 1 = 8" and Hi-Density 5.25" Max Speed (360rpm) -; +----------------- 0 = Double-Density, 1 = Single-Density - -FIXDSK EQU 00000000B -DSK8 EQU 00000001B -DSK5 EQU 00000010B -DSK3 EQU 00000011B -SS EQU 00000000B -DS EQU 00001000B -DD EQU 00000000B -SD EQU 10000000B -DVSPDH EQU 01000000B -DVSPDL EQU 00000000B -MTR EQU 00100000B -NOMTR EQU 00000000B -DBLSTP EQU 00010000B -NODBLS EQU 00000000B - - CSEG - - IF DRV_A -XDPH00: DB LOCKF ; Format lock flag - DB DSK5+DS+DD+DVSPDL+MTR ; Disk drive type - DB 1 ; Driver id - DB 0 ; Physical drive number -DPH$00: DW 0 ; Skew table pointer - DW 0,0,0 ; Scratch area - DW DIRBUF ; Directory buffer pointer - IF AUTOSL ; For autoselection, we need RAM Space - DEFW DPB$00+DPHDSZ ; Ram area for DPB #0 - ELSE - DW DPBRA ; Pointer to current DPB for Drive 0 - ENDIF - DW CHK$00 ; Wacd for drive 00 - DW ALV$00 ; Alloc vector for 00 - -XDPHSZ EQU $-XDPH00 ; Calc for xdph size -XDPHOF EQU DPH$00-XDPH00 ; Offset from xdph to dph - ENDIF ;Drv_a - IF DRV_B -XDPH01: DB LOCKF ; Format lock flag - DB DSK5+DS+DD+DVSPDL+MTR ; Disk drive type - DB 1 ; Driver id - DB 1 ; Physical drive number -DPH$01: DW 0 ; Skew table pointer - DW 0,0,0 ; Scratch area - DW DIRBUF ; Directory buffer pointer - IF AUTOSL - DEFW DPB$01+DPHDSZ ; Ram space for DPB #1 - ELSE - DW DPBRB ; Pointer to current DPB for Drive 1 - ENDIF - DW CHK$01 ; Wacd for drive 01 - DW ALV$01 ; Alloc vector for 01 - ENDIF ;Drv_b - IF DRV_C -XDPH02: DB LOCKF ; Format lock flag - DB DSK5+DS+DD+DVSPDL+MTR ; Disk drive type - DB 1 ; Driver id - DB 2 ; Physical drive number -DPH$02: DW 0 ; Skew table pointer - DW 0,0,0 ; Scratch area - DW DIRBUF ; Directory buffer pointer - IF AUTOSL - DEFW DPB$02+DPHDSZ ; Ram space for DPB #2 - ELSE - DW DPBRA ; Pointer to current DPB for Drive #2 - ENDIF - DW CHK$02 ; Wacd for drive 02 - DW ALV$02 ; Alloc vector for 02 - ENDIF - IF DRV_D -XDPH03: DB LOCKF ; Format lock flag - DB DSK3+sS+DD+DVSPDl+MTR ; Disk drive type - DB 1 ; Driver id - DB 3 ; Physical drive number -DPH$03: DW 0 ; Skew table pointer - DW 0,0,0 ; Scratch area - DW DIRBUF ; Directory buffer pointer - IF AUTOSL - DEFW DPB$03+DPHDSZ ; Ram space for DPB #3 - ELSE - DW DPBRA ; Pointer to current DPB for Drive #3 - ENDIF - DW CHK$03 ; Wacd for drive 03 - DW ALV$03 ; Alloc vector for 03 - ENDIF ;Drv_d - -; Directory Buffer Allocation. Only One Directory Buffer is required. Since -; we want it to be the first item in DSEG, it must be placed here. - - DSEG - - IF BANKED -DIRBUF EQU CBOOT ; Resident Init code in here - ELSE -DIRBUF EQU $ - ENDIF - ORG DIRBUF+128 ; Directory buffer - -; If we are using autoselection of drives, we copy the XDPB/DPB structure -; for the identified format to RAM thereby allowing emulation of formats by -; installing data for the desired format and locking the DPH. For Non-auto- -; select, we simply point to the read-only structure defined in DPB.LIB. - - IF AUTOSL - IF DRV_A -DPB$00: DEFS DPBSIZ ; Size of XDPB+DPB - ENDIF - IF DRV_B -DPB$01: DEFS DPBSIZ - ENDIF - IF DRV_C -DPB$02: DEFS DPBSIZ - ENDIF - IF DRV_D -DPB$03: DEFS DPBSIZ - ENDIF - ENDIF ;autosel - - IF [BANKED AND ZSDOS2] - COMMON /B2RAM/ - ELSE - DSEG - ENDIF - -; Directory Check Buffers. Each Buffer MUST be NDE/4 Bytes long at minimum. -; Each Logical Drive with removable media MUST have its own check buffer. - - IF DRV_A -CHK$00: DEFS [MXFDIR/4]+1 ; Enough for 256 dir entries - ENDIF - IF DRV_B -CHK$01: DEFS [MXFDIR/4]+1 ; Enough for 256 dir entries - ENDIF - IF DRV_C -CHK$02: DEFS [MXFDIR/4]+1 ; Enough for 256 dir entries - ENDIF - IF DRV_D -CHK$03: DEFS [MXFDIR/4]+1 ; Enough for 256 dir entries - ENDIF - -; Allocation BitMap Buffers. Each MUST be NAB/8 Bytes at Minimum. -; Each Logical Floppy Drive MUST have an Allocation BitMap Buffer. - - IF DRV_A -ALV$00: DEFS [MXFALC/8]+1 ; Enough for 800 KB or 1.44 MB drives - ENDIF - IF DRV_B -ALV$01: DEFS [MXFALC/8]+1 ; Enough for 800 KB or 1.44 MB drives - ENDIF - IF DRV_C -ALV$02: DEFS [MXFALC/8]+1 ; Enough for 800 KB or 1.44 MB drives - ENDIF - IF DRV_D -ALV$03: DEFS [MXFALC/8]+1 ; Enough for 800 KB or 1.44 MB drives - ENDIF - -;======================= End of DPH.LIB ======================= - \ No newline at end of file diff --git a/Source/BPBIOS/dphhd.lib b/Source/BPBIOS/dphhd.lib index c1fd3830..89a22a4d 100644 --- a/Source/BPBIOS/dphhd.lib +++ b/Source/BPBIOS/dphhd.lib @@ -3,6 +3,8 @@ ; (MUST be in Common Memory) ; This data must match information contained in the DPB table for Hard Drives. ; +; 1.3 - 04 Sep 16 - Mods for HBIOS V 2.8 WW+LN +; 1.2 - 24 Mar 14 - Initial N8VEM test release WW+LN ; 1.1 - 28 Aug 01 - Made generic module for GPL release. HFB ; 1.0 - 31 Aug 92 - General Release. HFB ; 0.1 - 3 Jan 92 - Initial release. HFB @@ -15,11 +17,38 @@ ; See ICFG-xx.Z80 for a definition of the data. CSEG - IF DRV_E +;<<< --- Drive A is for RAM Drive --- >>> + +XDPH90: DEFB TRUE ; Format lock flag (Lock RAM Drive) + DEFB FIXDSK ; Disk Drive Type + DEFB 2 ; Driver ID = Treat as Hard Drive + DEFB HB_MDRAM ; Physical Drive Number +DPH$90: DEFW 0 ; Skew Table pointer + DEFW 0,0,0 ; Scratch area + DEFW DIRBUF ; Directory buffer pointer + DEFW DPBRAM ; Pointer to DPB for RAM Drive + DEFW 0 ; No Wacd for RAM drive + DEFW ALV$90 ; Alloc vector for RAM Drive +; +;<<< --- Drive B is for ROM Drive --- >>> + +XDPH91: DEFB TRUE ; Format lock flag (Lock ROM Drive) + DEFB FIXDSK ; Disk Drive Type + DEFB 2 ; Driver ID = Treat as Hard Drive + DEFB HB_MDROM ; Physical Drive Number +DPH$91: DEFW 0 ; Skew Table pointer + DEFW 0,0,0 ; Scratch area + DEFW DIRBUF ; Directory buffer pointer + DEFW DPBROM ; Pointer to DPB for ROM Drive + DEFW 0 ; No Wacd for ROM drive + DEFW ALV$91 ; Alloc vector for ROM Drive + +; + IF DRV_C XDPH50: DEFB TRUE ; Format lock flag (Lock First Hard Drive) DEFB FIXDSK ; Disk drive type - DEFB 2 ; Driver ID - DEFB HB_HDDEV + 0 ; Physical drive [0..2] for this Partition + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV0 ; Physical drive [0..6] for this Partition DPH$50: DEFW 0 ; Skew table pointer DEFW 0,0,0 ; Scratch area DEFW DIRBUF ; Directory buffer pointer @@ -27,11 +56,12 @@ DPH$50: DEFW 0 ; Skew table pointer DEFW 0 ; No Wacd for hard drive DEFW ALV$50 ; Alloc vector for first Partition ENDIF - IF DRV_F +; + IF DRV_D XDPH51: DEFB TRUE ; --- Second Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB HB_HDDEV + 0 + DEFB FIXDSK ; Disk drive type + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV0 ; Physical drive [0..6] for this Partition DPH$51: DEFW 0 DEFW 0,0,0 DEFW DIRBUF @@ -39,11 +69,12 @@ DPH$51: DEFW 0 DEFW 0 DEFW ALV$51 ; Alloc vector for second Partition/Drive ENDIF - IF DRV_G +; + IF DRV_E XDPH52: DEFB TRUE ; --- Third Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB HB_HDDEV + 0 + DEFB FIXDSK ; Disk drive type + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV0 ; Physical drive [0..2] for this Partition DPH$52: DEFW 0 DEFW 0,0,0 DEFW DIRBUF @@ -51,11 +82,12 @@ DPH$52: DEFW 0 DEFW 0 DEFW ALV$52 ; Alloc vector for third Partition/Drive ENDIF - IF DRV_H +; + IF DRV_F XDPH53: DEFB TRUE ; --- Fourth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB HB_HDDEV + 0 + DEFB FIXDSK ; Disk drive type + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV0 ; Physical drive [0..6] for this Partition DPH$53: DEFW 0 DEFW 0,0,0 DEFW DIRBUF @@ -63,11 +95,12 @@ DPH$53: DEFW 0 DEFW 0 DEFW ALV$53 ; Alloc vector for fourth Partition/Drive ENDIF - IF DRV_I +; + IF DRV_G XDPH54: DEFB TRUE ; --- Fifth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB HB_HDDEV + 1 + DEFB FIXDSK ; Disk drive type + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV0 ; Physical drive [0..6] for this Partition DPH$54: DEFW 0 DEFW 0,0,0 DEFW DIRBUF @@ -75,11 +108,12 @@ DPH$54: DEFW 0 DEFW 0 DEFW ALV$54 ; Alloc vector for fifth Partition/Drive ENDIF - IF DRV_J +; + IF DRV_H XDPH55: DEFB TRUE ; --- Sixth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB HB_HDDEV + 1 + DEFB FIXDSK ; Disk drive type + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV0 ; Physical drive [0..6] for this Partition DPH$55: DEFW 0 DEFW 0,0,0 DEFW DIRBUF @@ -87,11 +121,12 @@ DPH$55: DEFW 0 DEFW 0 DEFW ALV$55 ; Alloc vector for sixth Partition/Drive ENDIF - IF DRV_K +; + IF DRV_I XDPH56: DEFB TRUE ; --- Seventh Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB HB_HDDEV + 1 + DEFB FIXDSK ; Disk drive type + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV0 ; Physical drive [0..6] for this Partition DPH$56: DEFW 0 DEFW 0,0,0 DEFW DIRBUF @@ -99,11 +134,12 @@ DPH$56: DEFW 0 DEFW 0 DEFW ALV$56 ; Alloc vector for seventh Partition/Drive ENDIF - IF DRV_L +; + IF DRV_J XDPH57: DEFB TRUE ; --- Eighth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB HB_HDDEV + 1 + DEFB FIXDSK ; Disk drive type + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV0 ; Physical drive [0..6] for this Partition DPH$57: DEFW 0 DEFW 0,0,0 DEFW DIRBUF @@ -111,12 +147,12 @@ DPH$57: DEFW 0 DEFW 0 DEFW ALV$57 ; Alloc vector for eighth Partition/Drive ENDIF -;<<< --- Drive M is for RAM Drive --- >>> - IF DRV_N +; + IF DRV_K XDPH58: DEFB TRUE ; --- Ninth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB HB_MDDEV + 1 + DEFB FIXDSK ; Disk drive type + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV1 ; Physical drive [0..6] for this Partition DPH$58: DEFW 0 DEFW 0,0,0 DEFW DIRBUF @@ -124,11 +160,12 @@ DPH$58: DEFW 0 DEFW 0 DEFW ALV$58 ; Alloc vector for ninth Partition/Drive ENDIF - IF DRV_O +; + IF DRV_L XDPH59: DEFB TRUE ; --- Tenth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB HB_MDDEV + 0 + DEFB FIXDSK ; Disk drive type + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV1 ; Physical drive [0..6] for this Partition DPH$59: DEFW 0 DEFW 0,0,0 DEFW DIRBUF @@ -136,11 +173,12 @@ DPH$59: DEFW 0 DEFW 0 DEFW ALV$59 ; Alloc vector for tenth Partition/Drive ENDIF - IF DRV_P +; + IF DRV_M XDPH60: DEFB TRUE ; --- Eleventh Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB 2 + DEFB FIXDSK ; Disk drive type + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV1 ; Physical drive [0..6] for this Partition DPH$60: DEFW 0 DEFW 0,0,0 DEFW DIRBUF @@ -148,45 +186,76 @@ DPH$60: DEFW 0 DEFW 0 DEFW ALV$60 ; Alloc vector for eleventh Partition/Drive ENDIF +; + IF DRV_N +XDPH61: DEFB TRUE ; --- Twelveth Hard Drive/Partition + DEFB FIXDSK ; Disk drive type + DEFB 2 ; Driver ID - 2=hard drive + DEFB HB_HDDEV1 ; Physical drive [0..6] for this Partition +DPH$61: DEFW 0 + DEFW 0,0,0 + DEFW DIRBUF + DEFW DPB61 ; Pointer to DPB for eleventh Partition/Drive + DEFW 0 + DEFW ALV$61 ; Alloc vector for eleventh Partition/Drive + ENDIF ; Allocation BitMap Buffers. Each MUST be # Alloc Blks/8 Bytes at Minimum. ; Each Logical Drive MUST have an Allocation BitMap Buffer. COMMON /RESVD/ ; Reserve space for BPBUILD - IF DRV_E +ALV$90: DEFS MSIZR/8+1 ; Space for RAM Drive Alloc Blocks +; +ALV$91: DEFS MSIZO/8+1 ; Space for ROM Drive Alloc Blocks +; + IF DRV_C ALV$50: DEFS HSIZ0/8+1 ; Space for First Logical Drive Alloc Blocks ENDIF - IF DRV_F +; + IF DRV_D ALV$51: DEFS HSIZ1/8+1 ; Space for Second Logical Drive Alloc Blocks ENDIF - IF DRV_G +; + IF DRV_E ALV$52: DEFS HSIZ2/8+1 ; Space for Third Logical Drive Alloc Blocks ENDIF - IF DRV_H +; + IF DRV_F ALV$53: DEFS HSIZ3/8+1 ; Space for Fourth Logical Drive Alloc Blocks ENDIF +; + IF DRV_G +ALV$54: DEFS HSIZ4/8+1 ; Space for Fifth Logical Drive Alloc Blocks + ENDIF +; + IF DRV_H +ALV$55: DEFS HSIZ5/8+1 ; Space for Sixth Logical Drive Alloc Blocks + ENDIF +; IF DRV_I -ALV$54: DEFS HSIZ4/8+1 +ALV$56: DEFS HSIZ6/8+1 ; Space for Seventh Logical Drive Alloc Blocks ENDIF +; IF DRV_J -ALV$55: DEFS HSIZ5/8+1 +ALV$57: DEFS HSIZ7/8+1 ; Space for Eighth Logical Drive Alloc Blocks ENDIF +; IF DRV_K -ALV$56: DEFS HSIZ6/8+1 +ALV$58: DEFS HSIZ8/8+1 ; Space for Nineth Logical Drive Alloc Blocks ENDIF +; IF DRV_L -ALV$57: DEFS HSIZ7/8+1 +ALV$59: DEFS HSIZ9/8+1 ; Space for Tenth Logical Drive Alloc Blocks ENDIF -;<<< --- Drive M is RAM --- >>> - IF DRV_N -ALV$58: DEFS HSIZ8/8+1 - ENDIF - IF DRV_O -ALV$59: DEFS HSIZ9/8+1 +; + IF DRV_M +ALV$60: DEFS HSIZ10/8+1 ; Space for Eleventh Logical Drive Alloc Blocks ENDIF - IF DRV_P -ALV$60: DEFS HSIZ10/8+1 +; + IF DRV_N +ALV$61: DEFS HSIZ11/8+1 ; Space for Twelveth Logical Drive Alloc Blocks ENDIF ;======================= End of DPHHD.LIB ========================= + \ No newline at end of file diff --git a/Source/BPBIOS/dphhd.lib.sav b/Source/BPBIOS/dphhd.lib.sav deleted file mode 100644 index ec72cd8c..00000000 --- a/Source/BPBIOS/dphhd.lib.sav +++ /dev/null @@ -1,193 +0,0 @@ -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Additional Disk Parameter Headers (DPH) for Hard Drives Generic File -; (MUST be in Common Memory) -; This data must match information contained in the DPB table for Hard Drives. -; -; 1.1 - 28 Aug 01 - Made generic module for GPL release. HFB -; 1.0 - 31 Aug 92 - General Release. HFB -; 0.1 - 3 Jan 92 - Initial release. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; The Physical Drive Number byte (XDPH+3) is simply an index to the Physical -; Drive as specified in the ICFG-xx.Z80 file. Up to three physical drives -; may be defined in that section, the first byte of which defines the -; Physical/Logical Unit Address (Device & LUN for SCSI, Master/Slave for IDE), -; and a flag bit to specify whether or not the drive is physically present. -; See ICFG-xx.Z80 for a definition of the data. - - CSEG - IF DRV_E -XDPH50: DEFB TRUE ; Format lock flag (Lock First Hard Drive) - DEFB FIXDSK ; Disk drive type - DEFB 2 ; Driver ID - DEFB 0 ; Physical drive [0..2] for this Partition -DPH$50: DEFW 0 ; Skew table pointer - DEFW 0,0,0 ; Scratch area - DEFW DIRBUF ; Directory buffer pointer - DEFW DPB50 ; Pointer to DPB for first partition/drive - DEFW 0 ; No Wacd for hard drive - DEFW ALV$50 ; Alloc vector for first Partition - ENDIF - IF DRV_F -XDPH51: DEFB TRUE ; --- Second Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB 0 -DPH$51: DEFW 0 - DEFW 0,0,0 - DEFW DIRBUF - DEFW DPB51 ; Pointer to DPB for second Partition/Drive - DEFW 0 - DEFW ALV$51 ; Alloc vector for second Partition/Drive - ENDIF - IF DRV_G -XDPH52: DEFB TRUE ; --- Third Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB 0 -DPH$52: DEFW 0 - DEFW 0,0,0 - DEFW DIRBUF - DEFW DPB52 ; Pointer to DPB for third Partition/Drive - DEFW 0 - DEFW ALV$52 ; Alloc vector for third Partition/Drive - ENDIF - IF DRV_H -XDPH53: DEFB TRUE ; --- Fourth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB 0 -DPH$53: DEFW 0 - DEFW 0,0,0 - DEFW DIRBUF - DEFW DPB53 ; Pointer to DPB for fourth Partition/Drive - DEFW 0 - DEFW ALV$53 ; Alloc vector for fourth Partition/Drive - ENDIF - IF DRV_I -XDPH54: DEFB TRUE ; --- Fifth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB 1 -DPH$54: DEFW 0 - DEFW 0,0,0 - DEFW DIRBUF - DEFW DPB54 ; Pointer to DPB for fifth Partition/Drive - DEFW 0 - DEFW ALV$54 ; Alloc vector for fifth Partition/Drive - ENDIF - IF DRV_J -XDPH55: DEFB TRUE ; --- Sixth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB 1 -DPH$55: DEFW 0 - DEFW 0,0,0 - DEFW DIRBUF - DEFW DPB55 ; Pointer to DPB for sixth Partition/Drive - DEFW 0 - DEFW ALV$55 ; Alloc vector for sixth Partition/Drive - ENDIF - IF DRV_K -XDPH56: DEFB TRUE ; --- Seventh Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB 1 -DPH$56: DEFW 0 - DEFW 0,0,0 - DEFW DIRBUF - DEFW DPB56 ; Pointer to DPB for seventh Partition/Drive - DEFW 0 - DEFW ALV$56 ; Alloc vector for seventh Partition/Drive - ENDIF - IF DRV_L -XDPH57: DEFB TRUE ; --- Eighth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB 1 -DPH$57: DEFW 0 - DEFW 0,0,0 - DEFW DIRBUF - DEFW DPB57 ; Pointer to DPB for eighth Partition/Drive - DEFW 0 - DEFW ALV$57 ; Alloc vector for eighth Partition/Drive - ENDIF -;<<< --- Drive M is for RAM Drive --- >>> - IF DRV_N -XDPH58: DEFB TRUE ; --- Ninth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB 1 -DPH$58: DEFW 0 - DEFW 0,0,0 - DEFW DIRBUF - DEFW DPB58 ; Pointer to DPB for ninth Partition/Drive - DEFW 0 - DEFW ALV$58 ; Alloc vector for ninth Partition/Drive - ENDIF - IF DRV_O -XDPH59: DEFB TRUE ; --- Tenth Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB 1 -DPH$59: DEFW 0 - DEFW 0,0,0 - DEFW DIRBUF - DEFW DPB59 ; Pointer to DPB for tenth Partition/Drive - DEFW 0 - DEFW ALV$59 ; Alloc vector for tenth Partition/Drive - ENDIF - IF DRV_P -XDPH60: DEFB TRUE ; --- Eleventh Hard Drive/Partition - DEFB FIXDSK - DEFB 2 - DEFB 1 -DPH$60: DEFW 0 - DEFW 0,0,0 - DEFW DIRBUF - DEFW DPB60 ; Pointer to DPB for eleventh Partition/Drive - DEFW 0 - DEFW ALV$60 ; Alloc vector for eleventh Partition/Drive - ENDIF - -; Allocation BitMap Buffers. Each MUST be # Alloc Blks/8 Bytes at Minimum. -; Each Logical Drive MUST have an Allocation BitMap Buffer. - - COMMON /RESVD/ ; Reserve space for BPBUILD - - IF DRV_E -ALV$50: DEFS HSIZ0/8+1 ; Space for First Logical Drive Alloc Blocks - ENDIF - IF DRV_F -ALV$51: DEFS HSIZ1/8+1 ; Space for Second Logical Drive Alloc Blocks - ENDIF - IF DRV_G -ALV$52: DEFS HSIZ2/8+1 ; Space for Third Logical Drive Alloc Blocks - ENDIF - IF DRV_H -ALV$53: DEFS HSIZ3/8+1 ; Space for Fourth Logical Drive Alloc Blocks - ENDIF - IF DRV_I -ALV$54: DEFS HSIZ4/8+1 - ENDIF - IF DRV_J -ALV$55: DEFS HSIZ5/8+1 - ENDIF - IF DRV_K -ALV$56: DEFS HSIZ6/8+1 - ENDIF - IF DRV_L -ALV$57: DEFS HSIZ7/8+1 - ENDIF -;<<< --- Drive M is RAM --- >>> - IF DRV_N -ALV$58: DEFS HSIZ8/8+1 - ENDIF - IF DRV_O -ALV$59: DEFS HSIZ9/8+1 - ENDIF - IF DRV_P -ALV$60: DEFS HSIZ10/8+1 - ENDIF - -;======================= End of DPHHD.LIB ========================= - \ No newline at end of file diff --git a/Source/BPBIOS/fdc-dx.z80 b/Source/BPBIOS/fdc-dx.z80 deleted file mode 100644 index c42724c6..00000000 --- a/Source/BPBIOS/fdc-dx.z80 +++ /dev/null @@ -1,1275 +0,0 @@ -;::::::::::::::::::::::::::::::::::::::::::::****************************** -; Floppy Disk Routines ***** Hardware Dependent ***** -; - D-X Designs Pty Ltd P112 - ****************************** -; -; 1.3 - 26 Aug 01 - Cleaned up for GPL Release. HFB -; 1.2c- 12 May 97 - Cleaned up source, modified STSIZE Code (again). HFB -; 1.2b- 22 Apr 97 - Changed 5.25" Hi/Lo Speed controls. HFB -; 1.0a- 23 Mar 97 - (test) fixes. HFB -; 1.0 - 13 Aug 96 - Initial Release for P112 from YASMIO. HFB -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Floppy Units are accessed on the P112 using the on-board SMC FDC37C665. -; An optional assembly flag controls whether Polled or DMA-controlled IO is -; used in operation. The DMA mode does not use any Interrupts in this -; preliminary version, but instead polls the INT1* line as Bit 6 on Port C -; of the Z182. -; This software uses the following registers: - -; 0DE - Port C, Bit 6=INT1*, Bit 7=INT2* (DRC) - -; 090 - Configuration Control Port (CFCNTL) -; 091 - Configuration Data Port (CFDATA) - -; The Chip configuration must be altered only to change the polarity on the -; Density signal applied to Pin 2 on the Floppy Connectors. Optional code -; which may be used forces this lead Hi/Lo as required for different formats -; using two bits of Configuration Register #5. - -CR5 EQU 5 ; FDC/IDE setups - ;Bit 7 6 5 4 3 2 1 0 - ; | | | | | +-+-+- unused - ; | | | +-+------- 00 = Density Normal (tracks Data Rate) - ; | | | 01 = (reserved), 10 = Force "1", 11 = Force "0" - ; +-+-+----------- unused - -; 092 - Drive Control Register (Write Only) -; 7 6 5 4 3 2 1 0 -; | | | | | | +-+-- Drive (00=0, 01=1, 10=2, 11=3) -; | | | | | +------ 1 = Normal Opn, 0 = Reset Controller -; | | | | +-------- 1 = Enable DMA Pins, 0 = Disable DRQ,DAK,INT pins -; | | | +---------- 1 = Enable Drive 0 Motor -; | | +------------ 1 = Enable Drive 1 Motor -; | +-------------- 1 = Enable Drive 2 Motor -; +---------------- 1 = Enable Drive 3 Motor -; 093 - (Not Used) -; 094 - Data-Rate Select (Write) / Main Status Register (Read) -; 7 6 5 4 3 2 1 0 (Write) - -; 7 6 5 4 3 2 1 0 (Read) -; | | | | +-+-+-+-- Drives Seeking (0=B0 Set, 1=B1 Set,.. 3=B3 Set) -; | | | +---------- 1 = Command In Progress, 0 = Command Ended -; | | +------------ 1 = Non-DMA Execution, 0 = DMA Execution -; | +-------------- 1 = Read, 0 = Write -; +---------------- 1 = Request for Master, 0 = Internal Execution -; -; 095 - Data/Command Register (Read/Write) -; (Byte Writes/Reads) -; 096 - (Not Used) -; 097 - Data Rate Register (Write) / Disk Changed Bit (Read) -; 7 6 5 4 3 2 1 0 (Write) -; | | | | | | +-+-- 00=500 kb/s, RPM/LC Hi, 01=250/300 kb/s (RPM/LC Lo) -; | | | | | | 10=250 kb/s, RPM/LC Lo, 11=1000 kb/s (RPM/LC Hi/Lo) -; +-+-+-+-+-+------ (Not Used) -; -; 7 6 5 4 3 2 1 0 (Read) -; | +-+-+-+-+-+-+-- (Tri-State, used for HD Controller) -; +---------------- 1 = Disk Changed (latched complement of DSKCHG inp) -; -; 0A0 - DMA I/O Select Port (DMA configuration Only) - - IF BANKED - COMMON /BANK2/ - ELSE - CSEG - ENDIF - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; STMODE (Function 0) - Set the FDC mode for Read/Write operations. -; -; Enter : A = Single-Density Flag (0 = Double Dens, 0FFH = Single Dens) -; Return: Nothing -; Uses : AF All other Registers Preserved/Not Affected -; -; Assumes STSIZE and STSECT called first -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -STMODE: PUSH BC ; Save Regs - PUSH HL - CPL ; Flip Bits so 1=MFM, 0=FM - AND 01000000B ; keep only bit of interest - LD (MODE),A ; Set MT, MF, SK for Commands - LD B,A ; (for later) - LD A,(DRVSIZ) - DEC A ; becomes: 8"=0, 5"=1, 3"=2 - LD L,2 ; (prepare for 8") - JR Z,STMOD2 ; ..jump if 8" (same as HD) - DEC L ; Else set to 3/5" Low Speed (1) - LD A,(DRVSPD) - OR A ; Low Speed? - JR Z,STMOD2 ; ..jump if So - INC L ; Else bump to 2 for Hi-Speed - LD A,(DRVSIZ) - SUB 2 ; 5.25" Hi-Density? - JR Z,STMOD2 ; ..jump if So pointing to 8"/5.25"HD - LD L,8+GAP3HD-FM5G3 ; Else Offset to 3.5" HD Gaps - JR STMOD4 ; ..and set SecSize - -STMOD2: BIT 6,B ; MFM Set? - JR Z,STMOD3 ; ..jump if Not - SCF ; Else Set Carry if MFM -STMOD3: RL L ; Shift into LSB, Size * 2 - ADD HL,HL - ADD HL,HL ; Size * 8, MFM * 4 (only 1 matters) -STMOD4: LD A,(RSZ) - LD (NBYTS),A ; save in Comnd Blk - OR A - PUSH AF - ADD A,L ; Add Sector Size to computation - LD L,A ; and Store - POP AF - LD A,129 ; (Prepare default) - JR Z,STMOD1 ; ..jump if 128-byte Sectors (DTL=128) - XOR A ; Else DTL is 0FFH (0-->FF) -STMOD1: DEC A ; Correct DTL Value - LD (DTL),A ; set - LD A,L ; Xfer index to A - LD HL,FM5G3-8 ; No low speed on 8" - CALL ADDAHL ; Index into gap 3 table - LD A,(HL) - LD (GPL),A ; store Gap Length - POP HL - POP BC - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; STSIZE (Function 1) - Set Drive Size (3.5", 5.25", 8"), Drive Speed -; (High/Low) Capability, and a Boolean flag for whether Motor Control is -; needed by the Drive. -; -; Enter : A = Hi Speed Flag ( 0 = Normal, 0FFH = High Speed Capable) -; D = Motor Flag (0 = No Motor Control, 0FFH = Motor needed) -; E = Drive Size (0 = Hard, 001 = 8", 010 = 5.25", 011 = 3.5") -; Return: Nothing -; Uses : AF All other Registers Preserved/Not Affected -; -; Assumes STHDRV Called Previously. Call before calling STMODE. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -STSIZE: LD (DRVSPD),A ; Save Drive Speed Flag - OR A ; (set flag, 0=Normal, FF=Hi-Speed/Density) - LD A,E - LD (DRVSIZ),A ; Save Drive Size Byte - LD A,D - LD (FDMOT),A ; Set Drive Motor Needed flag - PUSH DE ; (Save Regs) - LD A,00000000B ; (Preset Hi 500 kbps, 3.5 & 5.25" Rate) - JR NZ,STSIZ2 ; ..jump if Hi-Density/Speed to Set - DEC E - DEC E ; 5.25" (010B -> 00)? - LD A,00000010B ; (Prepare for 250 kbps) - JR NZ,STSIZ2 ; ..jump if Not 5.25" w/Rate Set - PUSH HL - LD A,(HDR) ; Else use a routine from FLOPPY.Z80 to - CALL PHYSCL ; point to Physical Drive Byte (ICFG-xx) - BIT 6,(HL) ; Hi-Density capable? - POP HL - LD A,00000010B ; (Prepare for 250 kbps) - JR Z,STSIZ2 ; ..jump if No - LD A,00000001B ; Else set to 300 kbps (@360 rpm = 250kbps) -STSIZ2: OUT (DRR),A ; Set Rate in FDC Reg - LD D,A ; preserve Rate bits - IN0 A,(1FH) ; Read Cntrl Reg (B7=1 if Hi Speed) - RLA ; Speed to Bit Carry..Turbo? - LD A,(SPEED) ; (Get Processor Rate in MHz) - JR C,STSIZ8 ; ..jump if Turbo for longer delay - SRL A ; Else divide rate by 2 -STSIZ8: INC D - DEC D ; 500 kb/s (Hi-Speed) Rate (D=0)? - JR NZ,STSIZ9 ; ..jump if Not - LD A,1 ; Else minimum delay for "High-Speed" -STSIZ9: LD (DLYCNT),A ; save delay count - POP DE - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; STHDRV (Function 2) - Set Head and Drive for Disk Operations. -; -; Enter : A = Unit # in D0-D1, Head in D2 -; Return: Nothing -; Uses : AF All other Registers Preserved/Not Affected -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -STHDRV: LD (HDR),A ; Save the Combined Head/Drive Byte - PUSH BC ; Save Regs - LD B,A ; and the HDR byte - SRL A ; Move - SRL A ; Head to B0 - LD (HD),A ; and Save - LD A,(ACTIVE) ; Get current Activation Byte - IF FDDMA - AND 11111000B ; keep only motors and DMA Bit - ELSE - AND 11110000B ; If Polled, keep only motors - ENDIF - OR B ; add drive bit - POP BC ; Restore Regs - JP ACTIV8 ; ..exit saving new byte and activating FDC - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; STSECT (Function 3) - Set Sector Number, Sector Size and Last Sector # -; -; Enter : A = Physical Sector Number -; D = Sector Size (0=128, 1=256, 2=512, 3=1024) -; E = Last Physical Sector # on Side -; Return: Nothing -; Uses : AF All other Registers Preserved/Not Affected -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -STSECT: LD (SECT),A ; Set Sector Number - LD A,D ; Get sector size - LD (RSZ),A ; save for commands - LD A,E ; Get last sector number - LD (EOT),A ; save in Command Block - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; SPEC (Function 4) - Do a Specify Command, setting Step Rate and Head -; Load/Unload Time. Values are rounded up if not even increments. -; -; Enter : A = Step Rate (in mS; Bit 7 = 1 for 8" drive -; D = Head Unload Time (in mS) -; E = Head Load Time (in mS) -; Return: Nothing -; Uses : AF All other Registers Preserved/Not Affected -; -; Assumes STSIZE called previously to set DRVSPD variable. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -SPEC: PUSH BC ; Save Regs - PUSH DE - AND 7FH ; Strip 8" Bit from Step Rate - -; At 250 kb/s MFM (125 kb/s FM), the times are doubled, so we must -; Divide the delays by two, else leave alone for 500 kb/s - - LD B,A ; Save the Step Rate - LD A,(DRVSPD) ; Get Speed (Data Rate) - OR A ; High Speed? - LD A,B ; (restore Step Rate) - JR NZ,SPEC0 ; ..jump if 500 kb/s (High Density) - - SRL A ; Divide Step Rate by 2 - ADC A,0 ; round Up for partial - SRL D ; Divide Head Unload Time by 2 - JR NC,SPEC11 ; ..jump if No Rounding Corr. - INC D -SPEC11: SRL E ; Divide Head Load Time by 2 - JR NC,SPEC0 ; ..jump if No Rounding Corr. - INC E ; Else Round -SPEC0: NEG ; Get 2's Complement of Step Rate - AND 0FH ; mask - LD B,A ; (save) - LD A,D ; Get Head Unload Time in mS - ADD A,0FH ; force Rounding up - JR C,SPEC00 ; ..jump if Overflow to Max - AND 0F0H ; Keep Time MOD 16 - JR NZ,SPEC3 ; ..jump if Not Zero -SPEC00: LD A,0F0H ; Else go to Maximum allowed -SPEC3: OR B ; Add in Step Rate - RLCA - RLCA - RLCA - RLCA ; Swap Nibbles - LD D,A ; put combined byte back in D - CALL WRDY ; Wait for RQM (hope DIO is Low!), retain Ints - LD A,03H ; Do an FDC Specify Command - OUT (DR),A - CALL WRDY - LD A,D ; first Rate Byte (Step Rate, HUT) - OUT (DR),A - CALL WRDY - LD A,E ; Get Head Load Time - ADD A,A ; Shift rate to B7..1 - IF NOT FDDMA ; (Bit 0 = 0 for DMA) - OR 1 ; Insure Non-DMA Operation - ENDIF - OUT (DR),A - POP DE ; Restore Regs - POP BC - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; RECAL (Function 5) - Recalibrate Drive (moves heads to track 0). -; -; Enter : Nothing -; Return: A = 0 if Ok, NZ if Error. Flags reflect A -; Uses : AF All other Registers Preserved/Not Affected -; -; NOTE: BC Must be preserved by this routine. -; Assumes STHDRV, SPEC, STSIZE and STMODE called first. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -RECAL: LD A,3 ; Give this 3 chances to Home -RECAL1: LD (RETRYS),A - PUSH BC ; Save needed regs - LD BC,2*256+7 ; Two bytes, Recalibrate = 7 - PUSH HL - CALL FDCMD ; execute Recalibrate - POP HL - IF NOT FDDMA - CALL FDCDN ; Clear Pending Ints, Wait for Seek Complete - AND 00010000B ; Homed? (B4=1 if No Trk0 found) - ENDIF - POP BC ; (restore regs) - JR Z,RECOK ; ..jump to Store if Ok - - LD A,(RETRYS) - DEC A ; Any trys left? - JR NZ,RECAL1 ; ..loop if So - DEC A ; Else set Error Flag (0-->FF) - RET - -RECOK: PUSH HL ; Save Regs - CALL IDXTRK ; Point to Current Drive in Track Array - XOR A ; get a Zero - LD (HL),A ; set Drive's Trk to 0 - POP HL ; Restore regs - RET ; and return - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; SEEK (Function 6) - Set the Track for disk operations and seek to it. -; -; Enter : A = Desired Track Number -; D = Verify flag (0=No, FF=Yes) -; E = Double-step Flag (E <> 0 for Double-step) -; Return: A = 0, Zero Flag Set (Z) if Ok, A <> 0 Zero Clear (NZ) if Error -; Uses : AF All other Registers Preserved/Not Affected -; -; Assumes STHDRV, SPEC, STSIZE and STMODE are called first. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -SEEK: LD (TTRK),A ; Save Track to Seek - PUSH HL ; Save Regs used here - PUSH DE - PUSH BC - - CALL IDXTRK ; Point to Current Trk for Selected Drive - CP (HL) ; Is desired Track same as last logged? - JR NZ,SEEKNV ; ..jump if Not Same - INC D ; Else Set to No Verify (FF->0) -SEEKNV: LD A,E ; Get Double-step flag - LD (STEP2),A ; ..and save locally - - LD A,(MXRTRY) ; Get the maximum Count -SEEK1: LD (RETRYS),A ; save remaining Retry Count - LD A,E - OR A ; Double Step? - LD A,(TTRK) ; Restore Track # - JR Z,SEEK2 ; ..jump if No Double Step - ADD A,A ; Else double Track # -SEEK2: LD (TRK),A ; Save the Track # in Comnd Block - LD BC,3*256+0FH ; (3-byte Seek Command = 0FH) - PUSH HL - CALL FDCMD ; Execute the Seek - POP HL - IF FDDMA - OR A ; Insure flags set - ELSE - CALL FDCDN ; Clear Pending Int, wait for Seek Complete - AND 01000000B ; Set NZ if Abnormal Termination - ENDIF - JR NZ,SEEKER ; ..jump if Error Seeking - INC D ; Are we Verifying (FF -> 0)? - DEC D ; (Correct for Test, 0 -> FF) - CALL NZ,READID ; Read next ID Mark if So - JR Z,SEEKX ; ..exit if Ok - -SEEKER: LD A,(RETRYS) ; Else get trys remaining - DEC A ; Any left (80-track could need two)? - JR NZ,SEEK1 ; ..loop to try again if More - DEC A ; Else set Error Flag (0->FF) -SEEKX: LD E,A ; (Save status byte) - LD A,(TTRK) - LD (TRK),A ; Restore "Real" Track Number - JR NZ,SEEKXX ; ..jump if Error - LD (HL),A ; Else update Track in Index -SEEKXX: LD A,E ; Restore Status - OR A ; set flags - POP BC ; Restore Regs - POP DE - POP HL - RET - -;......................................................................... -; Actual Read or Write - -ACTRW: LD HL,(ACTDMA) ; Get actual DMA Addr - LD A,(RDOP) - OR A ; Read operation? - JR Z,SWRITE ; No, must be Write - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; SREAD (Function 7) - Read a Sector from the Floppy Disk. The Mode, -; Head/Drive, Track, and Sector must have already been set. -; -; Enter : HL --> Read Buffer -; Return: A = 0, Zero Set (Z) if Ok, A <> 0, Zero Clear (NZ) if Error. -; Uses : AF,HL. All other Registers Preserved/Not Affected -; -; Assumes STMODE, STHDRV, STSECT, SPEC and SEEK Called First. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -SREAD: LD A,0110B ; Load 765 Read Command (06H) - IF FDDMA - PUSH AF ; Save Command - LD A,11001101B ; Set DMA Direction - ; |||||||+- ? - ; ||||||+-- MOD = Cycle Steal (ignored in I/O) - ; ||||++--- Source = I/O (fixed) - ; ||++----- Dest = Memory (Auto-Inc) - ; ++------- ? - ENDIF - JR RW ; ..and continue below - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; SWRITE (Function 8) - Write a Sector to the Floppy Disk. The Mode, -; Head/Drive, Track, and Sector must have already been set. -; -; Enter : HL --> Write Buffer -; Return: A = 0, Zero Flag Set (Z) if Ok, A <> 0 Zero Clear (NZ) if Errors -; Uses : AF,HL. All other registers Preserved/Not Affected. -; Assumes STMODE, STHDRV, STSECT, SPEC and SEEK Called First. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -SWRITE: LD A,0101B ; Load 765 Write Command (05H) - IF FDDMA - PUSH AF ; Save Command - LD A,11110001B ; Set DMA Direction - ; |||||||+- ? - ; ||||||+-- MOD = Cycle Steal (ignored in I/O) - ; ||||++--- Source = Memory (Auto-Inc) - ; ||++----- Dest = I/O (fixed) - ; ++------- ? -RW: OUT0 (DMODE),A ; Set DMA Channel #0 direction - POP AF ; restore Rd/Wr Comnd - ELSE -RW: - ENDIF ;fddma - PUSH BC ; Save Regs - PUSH DE - IF FDDMA - CALL SFDMA ; Set DMA Transfer Regs - LD HL,MODE ; Pt to Mode Flag - OR (HL) ; add to Command - ELSE - LD C,A ; (Save Command) - LD A,(MODE) ; Get Mode Flag - OR C ; add Read/Write Command to Mode Flag - ENDIF ;fddma - LD C,A ; to Reg - LD B,9 ; Read/Write Comnds are 9 bytes - - LD A,(TSBSCF) ; Get Special Format Flag - OR A ; Special? - JR NZ,RW0 ; ..jump if Not - LD (HD),A ; Else Side 1 coded with Hd # 0 -RW0: LD A,(RSZ) ; Get Sector Size Code - LD (NBYTS),A ; and Set in Comnd Blk - - LD A,(EOT) ; Get Last Sctr # - PUSH AF ; (save for Exit) - LD A,(SECT) ; Get Desired Sector # - LD (EOT),A ; make last to Read only one Sector - - PUSH HL - CALL FDCMD ; Execute Read/Write - POP HL - - POP AF ; Restore Last Sctr # - LD (EOT),A ; to Comnd Blk - LD A,(ST1) ; Get Status Reg 1 - AND 34H ; Return Any Error Bits - POP DE ; Restore Regs - POP BC - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; READID (Function 9) - Read the first Valid Address Mark on a track. -; -; Enter : Nothing -; Return: A = 0 if Ok, NZ if Error. Flags reflect A -; Uses : AF All other Registers Preserved/Not Affected -; -; Assumes STHDRV, SPEC, STSIZE and STMODE called first. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -READID: LD A,(MODE) ; Get Command byte from block - OR 0AH ; or in Command - PUSH BC ; Save regs - LD B,2 ; two bytes in ReadID Command - LD C,A ; move Command to C - PUSH HL - CALL FDCMD ; Activate Controller - POP HL - LD A,(ST1) ; Get Status Reg 1 - AND 25H ; Keep only Error Bits - POP BC ; Restore regs - RET ; ..and quit - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; RETDST (Function 10) - Return the status of a drive. -; This routine reports a "765" Controller type instead of actual number. -; -; Enter : Nothing -; Return: A = Status byte -; BC = 765 (FDC Controller Type) -; HL = Address of Status Byte -; Uses : AF,BC,HL All other Registers Preserved/Not Affected -; -; Assumes STHDRV called first -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -RETDST: - IF FDDMA - CALL WRDY ; Wait for RQM to be Set - LD A,0100B ; Load Return Drive Status Command (04H) - OUT0 (DR),A ; send to FDC - CALL WRDY - LD A,(HDR) ; Get Drive and Head - OUT (DR),A ; send it too - CALL FDCIN0 ; Read Stat at Command End - ELSE - LD BC,2*256+04H ; 2-byte Return Drive Status Command - CALL FDCMD - ENDIF ;fddma - LD HL,ST0 ; Point to Status Byte (Reg 3 contents) - LD A,(HL) ; fetch it - LD BC,765 ; load Controller ID - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; FMTTRK (Function 11) - Format a complete track on one side of a Floppy -; Disk. The Mode, Head/Drive, Track, and Sector must have been set. -; -; NOTE: The contents of the Format Data Block varies between controllers, -; so RETDST should be called to determine the controller type before -; setting up data structures. -; -; Enter : D = Formatting Sctrs/Track value -; E = Formatting Gap 3 Byte Count -; HL = Pointer to Controller-dependent Format Data block -; Return: A = 0, Zero Flag Set (Z) if Ok, A <> 0 Zero Clear (NZ) if Errors -; Uses : All Primary Registers -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -FMTTRK: PUSH DE ; Save for Later - IF FDDMA - LD A,11110001B ; Set DMA Direction - ; |||||||+- ? - ; ||||||+-- MOD = Cycle Steal (ignored in I/O) - ; ||||++--- Source = Memory (Auto-Inc) - ; ||++----- Dest = I/O (fixed) - ; ++------- ? - OUT0 (DMODE),A ; Set DMA Channel #0 direction - LD A,(TPABNK) ; Format Data comes from TPA Bank - IF BANKED - RL H ; Eliminate the MSB of DMA Addr - ADC A,0 ; offset bank # by 32k banks - RRA ; shift Bank LSB to Carry - RR H ; Move Bank # LSB (Carry) to Address MSB - ENDIF ;banked - LD (FDMAB+2),A ; Set the Bank Value - LD (FDMAB),HL ; and DMA Address for Bank in DMA Comnd Block - LD HL,_DMA ; Get DMA IO Port addr - LD (FDMAB+3),HL ; place in DMA Comnd Block - XOR A - LD (FDMAB+5),A ; and Null out rest of Dest - CALL STFDMA ; Set DMA for Format - - ELSE ;~fddma - IF BANKED - LD BC,(TPABNK) ; Get Source and Dest Banks - CALL XMOVE ; set them up - ENDIF - LD DE,HSTBUF ; Move the data to Host Buffer - LD BC,256 ; Two Sector's worth should be enough - CALL MOVE ; and move it - POP DE ; Restore SPT (D) and Gap3 (E) - ENDIF ;~fddma - LD A,(MODE) - OR 1101B ; set command to Format - LD C,A ; and place in Reg - LD HL,TRK - LD A,(RSZ) - LD (HL),A ; Place values in Command Block - INC HL - LD (HL),D - INC HL - LD (HL),E - INC HL - LD (HL),0E5H ; Set byte to write as Data - LD B,6 ; Six bytes in Format Command - IF NOT FDDMA - LD HL,HSTBUF - ENDIF - CALL FDCMD ; Execute ! - LD A,(ST1) ; Get Status - AND 92H ; Return Error bits in A - RET - -;============================================================================= -; FDCMD - Send Command to FDC -; Enter: B = # of Bytes in Command, C = Command Byte -; HL -> Buffer for Read/Write Data (If Needed) -; Exit : AF = Status byte -; Uses : AF,BC - -FDCMD: PUSH HL ; save regs - CALL MOTOR ; Insure motors are On - LD HL,COMND ; Point to Command Block - LD (HL),C ; command passed in C - LD C,DR ; Set Data Port Addr -OTLOOP: CALL WRDY ; Wait for RQM (hoping DIO is Low) (No Ints) - OUTI ; Output Command bytes to FDC - JR NZ,OTLOOP ; ..loop til all bytes sent - - POP HL ; Restore Transfer Addr - DI ; No Ints during IO to avoid data loss -FDCI1: - IF FDDMA - CALL FDCINT ; "Call" the Interrupt handler instead of Int - RET C ; ..quit if Timeout Error (C, A=FF) - LD A,(ST0) ; Else get first byte of Status - AND 0C0H ; check for Normal termination - RET ; ..return w/Error Flags set - ELSE - CALL WRDY - BIT 5,A ; In Execution Phase? - JR Z,FDCRES ; ..jump if Not to check result - BIT 6,A ; Write? - JR NZ,FDCI2 ; ..jump if Not to Read - OUTI ; Else Write a Byte from (HL) to (C) - JR FDCI1 ; and check for next - -FDCI2: INI ; Read a byte from (C) to (HL) - JR FDCI1 ; and check for next - -; Enter the Result Phase of the Command. Gather returned bytes - -FDCRES: EI ; Interrupts Ok now if in Result Phase - LD HL,ST0 ; Point to Status Result area -ISGO: CALL WRDY - BIT 4,A ; End of Status/Result? - RET Z ; ..return if So - BIT 6,A ; Another byte Ready? - RET Z ; ..return if Not - INI ; Else Read Result/Status Byte - JR ISGO ; ..loop for next - -;..... -; Check for Proper Termination of Seek/Recalibrate Actions by -; executing a Check Interrupt Command returning ST0 in A. - -FDCDN: PUSH HL ; Don't alter regs - EI ; (Ints Ok Now) -FDCDN0: CALL WRDY ; Ready? (leave Ints alone) - LD A,08H ; Else Issue Sense Interrupt Status Comnd - OUT0 (DR),A - CALL WRDY - IN0 A,(DR) ; Get first Result Byte (ST0) - LD L,A - CP 80H ; Invalid Command? - JR Z,FDCDN0 ; ..jump to exit if So - CALL WRDY - IN0 A,(DR) ; Read Second Result Byte (Trk #) - LD A,L - BIT 5,A ; Command Complete? - JR Z,FDCDN0 ; ..loop if Not - POP HL - RET - ENDIF ;~fddma - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; MOTOR CONTROL. This routine performs final selection of the drive control -; latch and determines if the Motors are already spinning. If they are off -; and Motor control is needed, then the Motors are activated and the spinup -; delay time in tenths-of-seconds is performed before returning. -; -; Enter : Command byte in A -; Return: Head Delay bit set in Command in A if needed -; Uses : None. All Registers Preserved/Not Affected - -MOTOR: PUSH AF ; Save Reg - LD A,(FDMOT) - OR A ; Need Motor? - JR Z,MOTORX ; ..jump to exit if Not - - LD A,(MOTIM) ; Get remaining seconds - OR A ; Already On? - LD A,(MONTIM) ; (get Default On Time) - LD (MOTIM),A ; always reset - EI ; Insure Ints are Active - JR NZ,MOTORX ; ..exit if Motors On..they will stay On - - LD A,(HDR) ; Get current Drive - IF FDDMA - OR 11111100B ; Set All Motors and DMA On, Cntrlr Active - ELSE - OR 11110100B ; Set All Motors On, DMA Off, Cntrlr Active - ENDIF - CALL ACTIV8 ; Do It! - LD A,(SPINUP) ; Get Spinup Time - LD (MTM),A ; to GP Counter -MOTOLP: LD A,(MTM) - OR A ; Up to Speed? - JR NZ,MOTOLP ; ..loop if Not -MOTORX: POP AF ; Restore Reg - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Hardware-Dependent Host Read/Write Routine linked to from FLOPPY module. -; This routine Reads/Writes data from HSTBUF trying up to MXRTRY times -; before giving up. If an error occurs after the next-to-last try, the -; heads are homed to force a re-seek. -; -; Enter: (RDOP Set for desired operation) -; Exit : A = 0, Zero Set if Ok, A <> 0, Zero Reset if Errors -; Uses : AF,HL -; -; RDOP is set to 1 for Read, 0 for Write, TTRK set with desired Track -; number, STHDRV, STSECT, STMODE, SPEC all called previously. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -FHDRW: LD HL,HSTBUF ; Point to the host buffer - LD (ACTDMA),HL ; and set Memory Pointer - - LD (FRWSTK),SP - LD SP,FRWSTK ; Use Local Stack - LD A,(MXRTRY) ; Get the maximum retry count -RWF2: LD (RWRTRY),A - PUSH DE ; (Save Regs) - LD A,(STEP2) ; Get double-Step flag - LD E,A - LD D,0FFH ; (Verify needed) - LD A,(TTRK) ; and track - CALL SEEK ; Try to seek to the desired track - POP DE ; (Restore Regs) - CALL Z,ACTRW ; Call R/W if Seek succeeded - LD (ERFLAG),A ; Save error code in any case - JR Z,FHDRX ; ..jump to return if No Errors - - LD A,(RWRTRY) ; Get retry count - CP 2 ; Are we on Next to last try? - CALL Z,RECAL ; Return to Track 0 if so - LD A,(RWRTRY) ; and re-fetch try count - DEC A ; Do we have more retries left? - JR NZ,RWF2 ; ..jump to try again if more tries remain - - CALL ERROR ; Else print Error Bios Message -FHDRX: LD SP,(FRWSTK) ; Restore Entry Stack - RET ; and Exit - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Gap 3 Length Table -; Index is: ((Drive_Factor * 8) + (MFM * 4) + RSZ) - 8 -; Where Drive_Factor is based on Size and Speed as: -; 5.25"/3.5" Low Speed = 1 -; 8" (Speed Ignored) = 2 -; 3.5" High-Density Disks use special GAP3 Table, while 5.25" High- -; Density disks use 8" DD GAP3 values. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; 5.25"/3.5" Single-Density GAP3. 300 rpm, 125 kbps, FM - -FM5G3: DEFB 7 ; 128 - DEFB 5 ; 256 - DEFB 20 ; 512 - DEFB 27 ; 1024 - -; 5.25"/3.5" Double-Density GAP3. 300 rpm, 250 kbps, MFM - - DEFB 0 ; 128 - DEFB 9 ; 256 - DEFB 13 ; 512 - DEFB 27 ; 1024 - -; 8" Single-Density / 5.25" High-Speed GAP3. 360 rpm, 250 kbps, FM - - DEFB 7 ; 128 - DEFB 5 ; 256 - DEFB 27 ; 512 - DEFB 27 ; 1024 - -; 8" Double-Density / 5.25" High-Speed GAP3. 360 rpm, 500 kbps, MFM - -GAP5HD: DEFB 0 ; 128 - DEFB 15 ; 256 - DEFB 11 ; 512 - DEFB 17 ; 1024 - -; 3.5" Hi-Density GAP3. 300 rpm, 500 kbps, MFM - -GAP3HD: DEFB 0 ; 128 - DEFB 27 ; 256 - DEFB 27 ; 512 - DEFB 17 ; 1024 (27 if 10 spt) - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Error Printing Routine. This routine prints Error messages from the -; High-level Sector Read/Write routine when detected based on various -; parameters in the BIOS. -; Entering a Control-C after the message will cause a warm boot, anything -; else will ignore the error and return status to the caller. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -ERROR: - IF BIOERM - PUSH BC - PUSH DE - CALL PRINT - DEFB BELL,CR,LF - DEFC 'FDC Error, U' - LD A,(HDR) ; Get unit number - AND 3 - CALL PDEC ; ..in decimal - CALL PRINT - DEFC ' ' - - LD A,(COMND) ; Get the command byte - AND 3FH ; Else Mask Command - CP 0FH ; 765 type Seek? - JR NZ,ERR0 ; ..jump if Not - - CALL PRINT - DEFC 'Seek' - JR ERR4 - -ERR0: CP 05H ; 765 type Write? - JR NZ,ERR1 ; ..jump if Not - CALL PRINT - DEFC 'Wr' - JR ERR4 - -ERR1: CP 06H ; 765 type Read? - JR NZ,ERR2 ; ..jump if Not - CALL PRINT - DEFC 'Rd' - JR ERR4 - -ERR2: CALL PRINT - DEFC 'Comnd = ' - LD A,(COMND) - CALL PHEX - -ERR4: CALL PRINT - DEFC ', ' - LD HL,ST0 ; Point to Status Bytes - BIT 7,(HL) ; Abnormal Termination? - JR Z,ERR5 - CALL PRINT - DEFC 'AT' - JR ERR13 - -ERR5: BIT 4,(HL) ; Equipment Check? - JR Z,ERR6 - CALL PRINT - DEFC 'EC' - JR ERR13 - -ERR6: BIT 3,(HL) ; Not Ready? - JR Z,ERR7 - CALL PRINT - DEFC 'NR' - JR ERR13 - -ERR7: INC HL ; Point to ST1 - BIT 5,(HL) ; Data Error? - JR Z,ERR8 - CALL PRINT - DEFC 'DE' -ERR8: BIT 2,(HL) ; No Data? - JR Z,ERR9 - CALL PRINT - DEFC ' ND' -ERR9: BIT 1,(HL) ; Write Protect? - JR Z,ERR10 - CALL PRINT - DEFC ' NW' -ERR10: BIT 0,(HL) ; Missing Address Mark? - JR Z,ERR11 - CALL PRINT - DEFC ' MA' -ERR11: INC HL ; Point to ST2 - BIT 4,(HL) ; Wrong Cylinder? - JR Z,ERR12 - CALL PRINT - DEFC ' WC' -ERR12: CALL PRINT - DEFC ' (T=' - LD A,(TTRK) ; Get Track (Cyl) - CALL PDEC ; Print cylinder (track) - CALL PRINT - DEFC ' H=' - LD A,(HDR) - RRCA - RRCA - AND 0001B - CALL PDEC ; Print head - CALL PRINT - DEFC ' S=' - LD A,(SECT) - CALL PDEC ; Print sector - CALL PRINT - DEFC ')' - -ERR13: POP DE ; Restore Regs - POP BC - CALL CONIN ; Wait for any key - SUB 3 ; ^C (reboot)? - PUSH AF - CALL PRINT - DEFB CR,LF+80H ; Always echo crlf - POP AF - LD A,0FFH - RET NZ ; ..Return Bad Status if Not user abort - IF BANKED - JP ABORT - ELSE - RST 0 ; Vector thru loc 0 so wboot may be - ENDIF ; Intercepted by NZCOM, BGii, etc. - -;..... -; Print value in A as a Decimal number (0-99) - -PDEC: LD DE,10 ; We work in decimal -PD0: INC D - SUB E - JR NC,PD0 - LD E,A - LD A,D - DEC A ; Is the first digit a Zero? - JR Z,PD1 ; ..jump if so and Don't Print - ADD A,'0' - CALL OUTCHR -PD1: LD A,E - ADD A,'0'+10 - JR OUTCHR - -;..... -; Print value in A as two Hex digits - -PHEX: PUSH AF ; Print value in A as 2 Hex digits - RRCA - RRCA - RRCA - RRCA - CALL PHEX0 - POP AF -PHEX0: AND 0FH - ADD A,90H - DAA - ADC A,40H - DAA - ;..if Bioerm, fall thru to Outchr.. - ELSE - OR 0FFH ; Insure NZ - RET - ENDIF ;Bioerm - -OUTCHR: PUSH HL ; Print char in A to Console - PUSH DE - PUSH BC - LD C,A - CALL CONOUT - POP BC - POP DE - POP HL - RET - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Point to Last Track Storage Location for the Current Drive -; Enter: None -; Exit : HL -> Last track storage for this drive -; Uses : HL - -IDXTRK: PUSH AF ; Save regs - LD A,(HDR) ; Get current drive/head - AND 0011B ; mask off head - LD HL,TRKARY ; Point to track storage block - CALL ADDAHL ; Point to the byte - POP AF ; restore regs - RET ; and return to caller - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Wait for FDC RQM to become Ready, and return DIO status in Zero Flag -; Pause before reading status port based on CPU Speed and Data Rate. - -WRDY: LD A,(DLYCNT) ; Get computed delay count -WRDY0: DEC A ; Done? - JR NZ,WRDY0 ; ..loop if Not -WRDYL: IN A,(MSR) ; Read Main Status Register - BIT 7,A ; Interrupt Present? - RET NZ ; Return if So - JR WRDYL ; Else Loop - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; D M A S U P P O R T R O U T I N E S -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - IF FDDMA -; Set DMA Channel #0 for Format - -STFDMA: PUSH AF ; Save regs - XOR A - OUT0 (DSTAT),A ; (No DMA or Interrupts) - LD L,D ; Get SPT value - LD H,0 ; extend to Word value - LD B,2 ; Multiply by 4 for Number of bytes -STDMA2: ADD HL,HL ; * 2 -STDMA3: DJNZ STDMA2 ; ..looping til done - LD (FDMAB+6),HL ; Save Number of bytes to transfer - LD HL,FDMAB ; Point to DMA Control block - LD BC,8*256+SAR0L ; 8 bytes from (HL).. - OTIMR ; to DMA Ch #0 Registers - LD A,01100011B ; Enable DMA on Ch #0 - ; |||||||+- DME - ; ||||||+-- ? - ; ||||++--- DMA Ints (Ch1, Ch0) - ; ||++----- Bit Write En * (Ch1, Ch0) - ; ++------- DMA Enable (Ch1, Ch0) - OUT0 (DSTAT),A ; Command! - POP AF ; Restore regs - RET - -;..... -; SFDMA - Set up DMA Channel #0 for Read/Write Operation. -; Number of sectors in Reg E is multiplied by Base Sector size to obtain -; the full number of bytes to transfer. -; Enter: HL -> Read/Write Buffer -; A = Read/Write Command - -SFDMA: PUSH AF ; Save Rd/Wr Command - XOR A - OUT0 (DSTAT),A ; Disable DMA/DMA Ints - IF BANKED - LD A,(SYSBNK) ; Set System Bank # - ELSE - LD A,(TPABNK) ; If Not Banked, Load TPA Bank # - ENDIF - RL H ; Place Address MSB in Carry - ADC A,0 ; offset Bank # by 32k banks - RRA ; shift Bank LSB to Carry - RR H ; Move Bank # LSB (Carry) to Addr MSB - LD C,A ; Save Bank # - LD DE,_DMA ; Get Floppy DMA IO Port Address - LD B,0 ; and Dummy Bank # - POP AF - PUSH AF ; Restore Rd/Wr Command - AND 00001111B ; keeping only low nibble - CP 0101B ; Write? - JR Z,SFDMA0 ; ..jump if So; CHL = Source, BDE = Dest - EX DE,HL ; Else - LD A,B ; Swap Source - LD B,C ; w/Dest - LD C,A -SFDMA0: LD (FDMAB),HL ; Save Source - LD A,C ; in Block - LD (FDMAB+2),A - LD (FDMAB+3),DE ; and Dest - LD A,B - LD (FDMAB+5),A - LD HL,0080H ; Set 1 Logical Sector Size for Calcs - LD A,(RSZ) ; Get Physical Sector Size (in 128-byte recs) - LD B,A - INC B ; (compensate for first DJNZ) - JR STDMA3 ; ..compute, set and activate - ENDIF ;fddma - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; FDCINT - Used in the P112 as a polled routine in default configuration -; with Interrupts disabled. This code is assembled if the FDDMA equate -; is set TRUE. If your system uses Interrupts, add any additional code -; to save Stack pointer and AF, and insure that it is in the CODE segment. -; NOTE: that the service routine MUST be in the Common Memory if Interrupts -; (instead of polling ) are used to prevent problems when banked. -; -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -;;-- CSEG - IF FDDMA -FDCINT: ; Set local stack if Needed, Disable Interrupts for local calls - PUSH BC - PUSH DE - PUSH HL - LD BC,0000 ; Inner loop timeout - LD D,30 ; Outer loop timeout - LD HL,ST0 ; Point to Status Area -Int00: IN0 A,(DRC) ; Read Port C - BIT 6,A ; Int1* active? - JR Z,Int01 ; ..jump if So - DEC BC ; Else count down - LD A,B - OR C - JR NZ,Int00 ; ..loop if Not timed out - DEC D ; Outer loop done? - JR NZ,Int00 ; ..loop if Not - SUB 1 ; Else set Carry, A=FF - LD (ST1),A ; Save Bad Status - CALL FDRst ; Reset the Controller - JR Int0X ; ..and Quit - -Int01: LD BC,DR ; Else Point BC to Data Port - CALL WRDYw0 - JR C,Int03 ; ..jump if Timeout -Int02: CALL WRDY - BIT 6,A ; Result phase over? - JR Z,Int03 ; ..jump if So to Exit - INI ; Read a byte from (C) to (HL) - INC B ; (correct B for above dec) - JR Int02 ; and check for next - -Int03: CALL WRDY - LD A,08H ; Sense Interrupt Status Comnd - OUT (DR),A - CALL WRDY - IN A,(DR) ; Get first Result Byte (ST0) - CP 80H ; Invalid Command? - JR Z,Int0X ; ..jump to exit if So - LD (ST0),A ; Else save Status Byte 0 - CALL WRDY - IN A,(DR) ; Read Second Result Byte (Trk #) - JR Int03 ; ..and loop - -Int0X: POP HL ; Restore Regs - POP DE - POP BC - ; Restore Stack if Needed - EI ; Insure Interrupts are Enabled - RET - -;..... -; Alternate entry for code that generates no "Interrupt" - -FDCIN0: PUSH BC ; Save regs - PUSH DE - PUSH HL - LD HL,ST0 ; Put Status bytes here - JR Int01 ; ..and continue mainline code - ENDIF ;fddma - -; Wait for Interrupt maintaining watchdog timer - -WRDYw0: PUSH BC ; Save Regs - LD BC,0 ; Set Maximum count -WRDYw1: IN A,(MSR) ; Get Status - RLA ; Int bit to Carry - JR C,WRDYw2 ; ..quit if Int - DEC BC ; Else count down - LD A,B - OR C ; Timed Out? - JR NZ,WRDYw1 ; ..loop if Not - CALL FDRst ; Else Reset Controller -WRDYw2: CCF ; Set Carry appropriately - POP BC ; restore regs - RET - -;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CSEG ;*** Remainder of Code MUST be in Main Memory *** - -;======================================================================== -; Reset the Floppy Disk Controller. Called from CBOOT in case of Hard -; Disk Boot which leaves the controller in a "hung" state, and locally -; if the Controller times out (often due to changing diskettes). - -FDRst: PUSH AF ; Save any status - XOR A - OUT (DCR),A ; Place Controller in Reset state - LD A,(ACTIVE) ; get current settings - AND 0FCH ; keep only motors, DMA and Ready - OUT (DCR),A ; and Restore - POP AF ; Restore Status - RET - -;======================================================================== -; Motor Off routine. Called from TIM-DX and SELFLP2 which forces -; Motors/Timer to be Off state so spinup delay is forced on next selection. - -;;ChgSpd: ; <<-- Required label for SELFLP2. Activate - ; label here if switching motor speed -MOTOFF: XOR A - LD (MOTIM),A ; Insure Motors Timed Out and show OFF - LD A,(ACTIVE) ; Get current settings - IF FDDMA ; - AND 00001111B ; strip of Motor bits - ELSE - AND 00000111B ; strip off Motor bits and DMA - ENDIF -ACTIV8: OR 00000100B ; (insure FDC out of Reset) - LD (ACTIVE),A ; save - OUT (DCR),A ; and Command! -ChgSpd: RET ; <<-- Activate label here if using 300 kb - ; for constant 360 rpm on 5.25" Drives - -;======================== RAM Storage Area ============================== - - IF BANKED - COMMON /B2RAM/ ; If banked, Local stack in Bank - ELSE - DSEG ; ..otherwise in Data Segment - ENDIF ; - - DEFS 30 ; Bios R/W Entry 15-level Local Stack -FRWSTK: DEFS 2 ; Storage for Entry Stack Pointer - - DSEG ; Place in Common memory - -; Add storage for DMA Control Block if using DMA Transfers - IF FDDMA -FDMAB: DEFS 2 ; Source Addr (16-bits) - DEFS 1 ; Source Bank - DEFS 2 ; Dest Addr (16-bits) - DEFS 1 ; Dest Bank - DEFS 2 ; Byte Count of transfer - ENDIF ;fddma - -; NOTE: Variables listed as (** Global **) are accessed by other modules and -; MUST exist as defined. - -COMND: DEFS 1 ; Storage for Command in execution -HDR: DEFS 1 ; Head (B2), Drive (B0,1) (** Global **) -TRK: DEFS 1 ; Track (t) -HD: DEFS 1 ; Head # (h) -SECT: DEFS 1 ; Physical Sector Number -NBYTS: DEFS 1 ; Bytes/Sector (n) -EOT: DEFS 1 ; End-of-Track Sect # -GPL: DEFS 1 ; Gap Length -DTL: DEFS 1 ; Data Length - -RSZ: DEFS 1 ; Bytes/Sector. Must be placed outside of the - ; Comnd Blk for FMTTRK to work. -; FDC Operation Result Storage Area - -ST0: DEFS 1 ; Status Byte 0 -ST1: DEFS 1 ; Status Byte 1 (can also be PCN) -ST2: DEFS 1 ; Status Byte 2 -RC: DEFS 1 ; Track # (** Global **) -RH: DEFS 1 ; Head # (0/1) -RR: DEFS 1 ; Sector # (** Global **) -RN: DEFS 1 ; Sector Size (** Global **) - -ACTDMA: DEFS 2 ; 16-bit DMA Address - -;-->>> Do NOT re-order the following two bytes !! <<<-- - -MTM: DEFS 1 ; Floppy Time down-counter -MOTIM: DEFS 1 ; Motor On Time Counter - -; DISK Subsystem Variable Storage - -FDMOT: DEFS 1 ; Motor on required flag -RDOP: DEFS 1 ; Read/write flag -RETRYS: DEFS 1 ; Number of times to try Opns -RWRTRY: DEFS 1 ; Number of read/write tries -DRVSPD: DEFS 1 ; Drive Speed -DRVSIZ: DEFS 1 ; Drive Size -STEP2: DEFS 1 ; <> 0 for Double Step (** Global **) -MODE: DEFS 1 ; Bit 6 = 1 if MFM, 0 = FM -ACTIVE: DEFS 1 ; Current bits written to Dev Contr Reg (DCR) -DLYCNT: DEFS 1 ; Delay value reading Main Status Reg -FSPT: DEFS 1 ; Format Sectors/Track value -TSBSCF: DEFS 1 ; 0=Hd always 0 (TSBSC) (** Global **) - -TTRK: DEFS 1 ; Storage for Track (** Global **) -TRKARY: DEFS 4 ; Track storage locations for four drives - -;=========================== End of FDC-DX ============================== - \ No newline at end of file diff --git a/Source/BPBIOS/fdc-ww.z80 b/Source/BPBIOS/fdc-ww.z80 index 2def4ed6..69b6ce80 100644 --- a/Source/BPBIOS/fdc-ww.z80 +++ b/Source/BPBIOS/fdc-ww.z80 @@ -1,14 +1,26 @@ ;::::::::::::::::::::::::::::::::::::::::::::****************************** ; Floppy Disk Routines ***** Hardware Dependent ***** -; - D-X Designs Pty Ltd P112 - ****************************** +; - Retro-Brew Hardware with HBIOS - ****************************** ; +; 1.4 - 27 Mar 14 - Initial N8VEM test release WW+LN ; 1.3 - 26 Aug 01 - Cleaned up for GPL Release. HFB ; 1.2c- 12 May 97 - Cleaned up source, modified STSIZE Code (again). HFB ; 1.2b- 22 Apr 97 - Changed 5.25" Hi/Lo Speed controls. HFB ; 1.0a- 23 Mar 97 - (test) fixes. HFB ; 1.0 - 13 Aug 96 - Initial Release for P112 from YASMIO. HFB ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; +; Floppy Units are accessed on Retro-Brew systems using HBIOS function +; calls. These functions include read, write, status and media type. +; For 3.5" drive there are two media types. For 5.25" drive two media +; types are supported, while for 8" drives one type is supported. +; Only high density is supported on 3.5" drives either single or double +; sided. For 5.25" drive either double or high density is supported on +; double sided disks. Only double density double sided 8" disks are +; supported. Many BPBIOS floppy routines are stubbed such as DMA support +; and motor control since all these details are handled behind the scene by +; HBIOS. Currently HBIOS handles the head given the track and sector so +; the interface treats all floppies as single sided. + IF BANKED COMMON /BANK2/ ELSE @@ -248,7 +260,7 @@ FDRst: CALL PANIC RET ;======================================================================== -; Motor Off routine. Called from TIM-DX and SELFLP2 which forces +; Motor Off routine. Called from SELFLP2 which forces ; Motors/Timer to be Off state so spinup delay is forced on next selection. MOTOFF: CALL PANIC @@ -302,4 +314,5 @@ TSBSCF: DEFS 1 ; 0=Hd always 0 (TSBSC) (** Global **) TTRK: DEFS 1 ; Storage for Track (** Global **) ;TRKARY: DEFS 4 ; Track storage locations for four drives -;=========================== End of FDC-DX ============================== +;=========================== End of FDC-WW ============================== + \ No newline at end of file diff --git a/Source/BPBIOS/hard-ww.z80 b/Source/BPBIOS/hard-ww.z80 index 1b52f009..133520f6 100644 --- a/Source/BPBIOS/hard-ww.z80 +++ b/Source/BPBIOS/hard-ww.z80 @@ -1,19 +1,37 @@ ;::::::::::::::::::::::::::::::::::::::::::::::::************************** -; Hard disk routines as implemented for the ** Hardware Dependent ** -; D-X Designs Pty Ltd P112 via an external ** for exact interface ** -; NCR/National 5380 Controller. These routines ************************** -; may be assembled to use Polled or DMA (no Interrupt) transfers without -; Arbitration depending on an equate in the DEF-DX.LIB assembly definition -; file. Direct driver IO routines to Select (SELHD), Read (HDREAD) and -; Write (HDWRIT) are all included here. Thanks to Terry Hazen for -; debugging the polled code while working on the YASBEC and Ampro versions. +; Hard disk routines as implemented for ** Hardware Dependent ** +; Retro-Brew Hardware with HBIOS. ** for exact interface ** +; Uses HBIOS disk routines for all HD access ************************** +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; This file uses modifications of the definitions in ICFG-xx to reflect +; Physical and/or logical definitions for HBIOS drives. A controller type of +; 8xH signifies IDE/ATA drives, in which case the Drive byte at HDRVx is: +; 7 6 5 4 3 2 1 0 +; | | | | | +-+-+- Unit Number (0-7) +; | | | | +------- (reserved) +; | | | +--------- 1 = Active, 0 = Inactive +; +-+-+----------- (reserved) +; Additionally, the first byte of the Reduced Write Cylinder word is re- +; defined to be the number of physical/logical Sectors-Per-Track. +; Uses HBIOS disk routines for all HD access. Direct BIOS disk access +; in not implemented. +; These parameters are used to convert the Track & 16 Sector/Track format +; assumed in the B/P Bios definitions for Hard Drives into Track/Sector/Head +; Sector Number needed for HBIOS Disk accesses. Direct driver IO routines +; to Select (SELHD), Read (HDREAD) and Write (HDWRIT) are all included here. ;-------------------------------------------------------------------------- -; 1.3 - 22 Aug 01 - Cleaned source for GPL Release. HFB -; 1.2a- 15 Sep 97 - Corrected Data saves for Direct Device IO when +; 1.8 - 06 Feb 20 - Updated for HBIOS version 2.9.2 WW +; 1.7 - 28 Nov 16 - Updated for HBIOS version 2.8 WW +; 1.6 - 20 Jan 14 - Initial N8VEM test release WW+LWN +; 1.5 - 31 May 12 - Added ability to handle two IDE devices LN +; 1.4 - 12 Dec 07 - Initial Test LabZ80 Release LN +; 1.3 - 26 Aug 01 - Cleaned up source and included fixes from SCSI. HFB +; 1.2 - 15 Sep 97 - Corrected Data saves for Direct Device IO when ; flushing to/from other SCSI units, added Busy tests. HFB -; 1.2 - 17 Jul 96 - Initial P112 integration, deleted Xebec 1410/Shugart +; 1.1 - 28 Jun 97 - Added Home Drive, Retry Disable bit handling. HFB +; 1.0 - 17 Jul 96 - Initial P112 integration, deleted Xebec 1410/Shugart ; 1610-3 driver, selectable Polled/DMA modes. HFB -; 1.1 - 28 May 93 - Fixed Access to fast drives. JTH +; 0.1 - 28 May 93 - Fixed Access to fast drives. JTH ; 0.0 - 9 Jul 91 - Initial Test Release HFB ;*************************************************************************** @@ -24,157 +42,28 @@ ENDIF ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Function 0 - Set User Data Area Adress for Direct SCSI IO, Return -; Number of Bytes in the SCSI driver Command Block +; Function 0 - Set User Data Area Address for Direct Disk IO, Return +; Number of Bytes in the driver Command Block (SCSI-"like") +; For IDE, a minimum of 6 Bytes is needed (Comnd,Trk(2),Sctr,Head,Drive) +; ***** direct disk IO no longer supported - so this function is not +; implemented ***** ; Enter: DE = Address of User Data Area -; Exit : A = Number of bytes available in the SCSI Command Block +; Exit : A = Number of bytes available in the Command Block ; Uses : A,HL ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -HDVALS: LD (DATADR),DE ; Save the Users Data Area - LD A,CMDSIZ +HDVALS: CALL PANIC ; NOT IMPLEMENTED!!!! RET ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Function 1 - Set Physical Device bit and Logical Unit Number in SCSI -; Command Block (Byte 1, bits 7-5) from byte in A -; Enter: A = Device Byte (See ICFG-xx.Z80) -; Exit : A = Physical Device Bit of selected drive +; Function 1 - Set Unit # and dev/unit in Command Block from A - return +; unit # in A +; Enter: A = Drive Byte +; Exit : A = Unit # ; Uses : AF ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -HDSlct: LD (xUnit),A ; Save Dev/LUN byte for later - RET - -HDSlc0: PUSH BC ; Save regs - LD C,A ; and entry byte - AND 0E0H ; Mask off all but Logical Unit Number - LD (LUNSAV),A ; and save for execution - LD A,C ; Get byte back - AND 07H ; keeping only Physical Device bits - LD B,A ; Prepare for bit rotation - INC B ; by bumping count for initial value - XOR A ; Start with 0 byte - SCF ; and 1 bit in Carry -HDSLCZ: RLA ; Rotate bit around thru Carry - DJNZ HDSLCZ ; ..until properly positioned - LD (HDEVIC),A ; Save for future operations - POP BC ; Restore regs - RET - -;========================================================================= -; Select Hard Disk (SCSI Device and Unit) < Internal Bios routine > - -SELHD: LD A,(SEKPDN) ; Load Device and Unit # to select -SELHDA: LD C,A ; position for calculations - LD B,HDRV1-HDRV0 ; with size - MLT BC ; Calculate offset into table - LD HL,HDRV0 ; from first Physical drive - ADD HL,BC - LD A,(HL) ; Fetch Device/LUN byte - ld (iUnit),a ; save as internal unit # - CALL HDSlc0 ; setting variables for Device and LUN - CALL HDINIT ; Do the actual initialization - JP NZ,SELERR ; ..return Error if Bad - JP SETPARMS ; Else set parameters for DPH/DPB - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Initialize Xebec 1410/Shugart 1610-3 Controller for appropriate -; Drive Specs. Does Nothing if Owl, Adaptec or SCSI. -; <<-- Returns Error for Xebec/Shugart...deleted in 1.2. -->> -; Enter: HL -> Configuration block for desired drive (see ICFG-xx) -; Exit : A = 0, Zero Set (Z) if Ok, A <> 0, Zero Clear (NZ) if Error -; Uses : AF,BC,DE,HL -; NOTE : This routine uses the Physical drive parameters contained -; in ICFG-xx to determine some of the parameters. -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -HDINIT: LD A,(CNTRLR) ; Set Controller type - CP 2 ; Is it Xebec 1410/Shugart 1610-3? - JR NZ,HDINIS ; ..jump if Not to return Ok - DEFB 0F6H ; Fall thru w/"OR 0AFH" and return Error -HDINIS: XOR A ; Else signify this was done Ok - RET ; ..and quit - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Write to SCSI Hard Disk Drive < Internal BIOS Routine > -; Writes from HSTBUF using HSTTRK and HSTSEC to build Block Number. -; NOTE: This routine uses physical drive characteristics from ICFG-xx. - -HDWRIT: XOR A - LD (HSTWRT),A ; Show No pending Write - - LD A,0AH ; Set the SCSI Write Command - DEFB 11H ; ..trash DE, fall thru to save - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Read from SCSI Hard Disk Drive < Internal BIOS Routine > -; Reads to HSTBUF using HSTTRK and HSTSEC to build Block Number. -; NOTE: This routine uses physical drive characteristics from ICFG-xx. - -HDREAD: LD A,08H ; Set the SCSI Read Command - LD (HDCOMD),A ; save command in CDB - LD HL,(HSTDPH) ; Get pointer to desired DPH - DEC HL ; back up to Device # - LD A,(HL) ; and fetch - CALL SELHDA ; Select this device from A-Reg - - LD DE,HDCOMD+1 ; Point to second byte of Command Block - LD BC,4*256+0 ; Count = 4, MSB of Block # = 0 - LD HL,(HSTTRK) ; Get requested track -MUL16: ADD HL,HL ; Multiply C,H,L by 16 for 21-bit block # - RL C ; shifting overflow bit to C - DJNZ MUL16 ; ..and looping til * 16 - LD A,(DE) ; Get LUN/High Address - AND 11100000B ; keep only LUN - OR C ; and add in High 5 bits of Block # - LD (DE),A ; Store back in LUN/High Address - INC DE ; Pt to next - LD A,H ; Get middle Block # - LD (DE),A ; and save - INC DE ; Pt to next - LD A,(HSTSEC) ; Get Logical Host Sector # (4-bits) - ADD A,L ; add in Hi 4-bits of low Block # - LD (DE),A ; save lowest 8 bits of Block # - INC DE ; Pt to next - LD A,1 - LD (DE),A ; Set HDSIZ for 1 block - INC DE ; Pt to next - -; NOTE: Support for Xebec 1410/Shugart 1610-3 removed. They required a -; step rate byte to be stored at this point. - - XOR A ; Get a Zero - LD (DE),A ; Set in Command Block - -; Set Physical/Logical Unit numbers just prior to accessing the Drive - - LD A,(iUnit) ; Get internal unit data - CALL HDSlc0 ; set variables for Device and LUN - -; Try the Command specified. If errors returned (e.g. Attn assertion), -; read the SCSI Sense status and try the command again. - -RWSCSI: CALL HDRW0 ; Try a Normal Data Access - RET Z ; ..exitting if Ok - LD HL,sense ; Set Ptr to Sense Command Block - LD DE,snsDat ; and Sense Data Poiner - CALL HDRW1 ; Try a Sense Read, following thru to Dat Rd -HDRW0: LD DE,HSTBUF ; and Data Pointer for Normal Accesses -STSCSI: LD HL,HDCOMD ; Set Command Block Address -HDRW1: LD (HDCMDV),HL ; Save Command Block Address - LD (HDDATV),DE ; and Data Area Pointer - IF NOWAIT ; If Wait States not desired.. - IN0 A,(DCNTL) ; Get current settings - LD (WTSAVE),A ; save for exit - AND 11001111B ; Keep everything but IO Waits - OUT0 (DCNTL),A ; and set to No IO Wait States - ENDIF ;nowait - ;..fall thru to change phases on the SCSI bus - - CALL SCSI ; Do the Work - AND 00000010B ; Any errors? - LD (ERFLAG),A ; save resulting status here +HDSLCT: CALL PANIC ; NOT IMPLEMENTED!!!! RET ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -197,424 +86,124 @@ HDRW1: LD (HDCMDV),HL ; Save Command Block Address ; set the data transfer source/dest address and logical & physical drive. ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -HD_RW: PUSH AF ; Save User Data Flag - PUSH DE ; and ptr to User's CDB - CALL FLUSH ; Insure Host Buffer is Free - POP HL ; restore User CDB ptr to HL for move - IF BANKED - CALL SHDBNK ; Load Banks for transfer to System fm User - CALL XMOVE ; and Set - ENDIF ;Banked - LD DE,HDCOMD - LD BC,CMDSIZ ; Move Command Descriptor Block - CALL MOVE ; into SCSI Command area (6-12 bytes) - POP AF ; Restore Flag - OR A ; Any User data to write? - JR Z,DOSCS0 ; ..bypass move if not - IF BANKED - CALL SHDBNK ; Load for move from User's to System Banks - CALL XMOVE ; and Set - ENDIF ;Banked - CALL HDDMOV ; Set to move 512 bytes from User to Hstbuf - CALL MOVE ; Do It! -DOSCS0: LD A,(xUnit) ; Get External Device data - CALL HDSlc0 ; set variables for Device & LUN - - CALL RWSCSI ; Set Data Addr and do the operation - IF BANKED - CALL SHDBNK ; Load Bank Numbers - LD A,B ; Swap - LD B,C ; Source - LD C,A ; and Destination Banks - CALL XMOVE ; Set Source/Dest - ENDIF ;Banked - PUSH HL ; Save Status and Message bytes - CALL HDDMOV ; set Addresses and Length - EX DE,HL ; write back to User's area - CALL MOVE ; move without affecting status in A - POP HL ; Restore Status and Message bytes - LD A,L ; Load Status byte for checks - AND 1010B ; keeping only Check (3) and Busy (1) Bits - RET ; ..and quit - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Raw SCSI Driver - -SCSI: - IF HDDMA - LD (DATPTR),DE ; Save Pointer to Data Area - ENDIF - LD HL,LUNSAV ; Address LUN storage location - LD A,(HDUNIT) ; Get LUN/HiBlock byte from Command Blk - AND 1FH ; Strip off old LUN - OR (HL) ; add in New LUN - LD (HDUNIT),A ; save new byte - XOR A - OUT0 (NCRCMD),A ;1.1 Clear any previous Controller status - OUT0 (NCRMOD),A ;1.1 no Mode settings - OUT0 (NCRTGT),A ;1.1 nothing asserted - - IF HDDMA - DEC A ; 0 --> FF - LD (STATUS),A ; Set Initial timeout status - IN0 A,(NCRINT) ; Clear interrupts & Error Bits - ENDIF - - LD A,(HDEVIC) ; Get the Target Device address bit - OR 10000000B ; add Host initiator address bit - OUT0 (NCRDAT),A - IN0 A,(NCRCMD) ; Get Initiator Comnd Reg - OR B_ABUS ; Assert the Data Bus - OUT0 (NCRCMD),A - LD A,B_ASEL+B_ABUS ; Now Assert both Select and Data Bus bits - OUT0 (NCRCMD),A - -; Wait for 200-300 mS for Target to become Busy. The SCSI spec says 250 mS, -; but we don't know when the triggering will occur with our 100ms counter. -; We therefore set it for 300 mS which results in 200-300 mS w/250 on average. - - LD L,0FFH ; Preset Timeout Error Status - LD A,3 ; 3-100mS ticks - LD (MTM),A ; from Now! -BSYWT: LD A,(MTM) ; Get Current Count - OR A ; Have we timed out? - JR Z,TIMOUT ; ..exit to Error if So - IN0 A,(NCRBUS) ; Get the Current Bus Status - AND B_BSY ; Is it BSY? - JR Z,BSYWT ; ..loop if Not - ;..else fall thru.. - LD A,B_ABUS - OUT0 (NCRCMD),A ; Assert Bus w/o Select Command (or free) - XOR A ; get a Zero - OUT0 (NCRCMD),A ; then free the Data Bus - IF HDDMA - LD (HDONE),A ; Start by showing Not Done - ;..fall thru to wait for a Request on the SCSI bus - -RQWAIT: IN0 A,(NCRBUS) ; Get Bus status - AND B_REQ ; Bus Request yet? - JR Z,RQWAIT ; ..jump if Not and wait - -WtCall: CALL NZ,SCSINT ; Call the Interrupt to start transfer - LD A,(HDONE) ; Get Hard Drive Done flag - OR A ; Finished? - JR NZ,WtDonX ; ..exit if So - - IN0 A,(DRA) ; Else fetch Status (from Z182 Port A) - BIT 4,A ; Interrupt? - JR WtCall ; ..check & Read/Write SCSI if So - -WtDonX: LD HL,(STATUS) ; Else get Status and Message bytes -TIMOUT: - IF NOWAIT - LD A,(WTSAVE) ; Get entry Wait state settings - OUT0 (DCNTL),A ; and restore - ENDIF - LD A,L ; get Status Byte - OR A ; set flags - RET ; and return - ELSE ;Not hddma - LD (STATUS),A ; Assume Status is Ok - ;..fall thru to check SCSI Bus phase changes.. - ENDIF ;Not hddma - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; SCSINT - Interrupt routine for the NCR 5380/DP 8490 chip. -; -; This routine handles Interrupts generated by the SCSI controller on phase -; changes or loss of BSY signal meaning that the operation is complete. -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - IF HDDMA -; CSEG ;<-- NOTE: If "True" Interrupts are used,this Vector - ; MUST be in Common Memory (CSEG) in case an - ; interrupt hits unexpectedly. Also, insert - ; code to save registers and set Local Stack. - -SCSINT: DI ; ..disable interrupts here for local calls - XOR A - OUT0 (NCRCMD),A ; Release the SCSI Bus - IN0 A,(NCRST) ; Get status - AND B_BBSY+B_PHAS ; Phase Match or Bus Busy? - JR Z,SCSIN0 ; ..jump if Not to continue - ;..else fall thru to Exit.. -; Exit here when we are done to set the Completed flag - -DISCSI: XOR A ; Turn off any SCSI operations - OUT0 (NCRMOD),A - OUT0 (NCRTGT),A - DEC A ; 0 --> FF - LD (HDONE),A ; Indicate Hard Disk Operation Complete - IN0 A,(NCRINT) ; Discard any pending 5380 Interrupts - IN0 A,(DSTAT) - AND 5FH ; Disable DMA1 Interrupts - OUT0 (DSTAT),A - EI +HD_RW: CALL PANIC ; NOT IMPLEMENTED!!!! RET -; Continue with Transaction - -SCSIN0: XOR A - OUT0 (NCRMOD),A ; Clear DMA mode - IN0 A,(NCRINT) ; Clear SCSI Interrupts - IN0 A,(DSTAT) - AND 5FH ; and Stop Z-180 DMA Ch #1 - OUT0 (DSTAT),A - LD A,B_MBSY+B_DMA ; Monitor Busy and Set DMA Mode - OUT0 (NCRMOD),A - ENDIF ;hddma -;..... -; Come here when phases change (Main Handler for Polled IO Mode) +;======================================================================== +; Select Hard Disk (Unit 0/1, Master/Slave) < Internal Bios routine > -PHASE: IN0 A,(NCRBUS) ; Read the Bus Status - AND B_MSG+B_CD+B_IO ; keep the three phases we are interested in - RRCA ; Rotate Phase status bits - RRCA ; into B0-2 position for testing - OUT0 (NCRTGT),A ; Check for phase match - IF NOT HDDMA ; (only need this with Polled IO) - LD BC,NCRDAT ; with data going to/from this port (B=0) - ENDIF - LD HL,MESSAGE ; (Ph 7 input goes here) - CP 7 ; Are we in Phase 7 ? - JR Z,HDIN ; ..jump if so to Message In Phase - LD HL,(HDDATV) ; (Ph 0/1 IO From/To here) - OR A ; Are we in Phase 0 ? - JR Z,HDOUT ; ..jump to if so to Data Out Phase - DEC A ; Are we in Phase 1 ? - JR Z,HDIN ; ..jump to if so to Data In Phase - LD HL,(HDCMDV) ; (Ph 2 output from here) - DEC A ; Are we in Phase 2 ? - JR Z,HDOUT ; ..jump to if so to Command Out Phase - LD HL,STATUS ; (Ph 3 Input to here) - DEC A ; Are we in Phase 3 ? - JR Z,HDIN ; ..jump to if so to Status In Phase - ;..else fall thru -; Phases 4, 5 and 6 wind up here in an Error +SELHD: ; SET DEVICE - IF NOWAIT - LD A,(WTSAVE) ; Get entry Wait state settings - OUT0 (DCNTL),A ; and restore - ENDIF - CALL PRINT - DEFB CR,LF,' Phase Err',CR,LF+80H - IF HDDMA - CALL DISCSI ; Disable any ongoing DMA/SCSI operation - ENDIF ;..else fall thru to abort. Stack is reset so don't - ; worry about popping and restoring anything - IF BANKED - JP ABORT ; Use this error exit if banked - ELSE - RST 0 ; ..this exit if Non-banked - ENDIF ;banked +; CALL PRTSTRD +; DEFB '[SELHD]$' -;..... -; SCSI Input Routine (Polled IO) -; Enter with HL pointing to buffer, C addressing 5380 Data Port - - IF NOT HDDMA -HDIN: IN0 A,(NCRBUS) ; Check the Bus - BIT 5,A ; Do we have a REQuest? - JR NZ,HDIN1 ; ..jump if so to read it - AND B_BSY ; Is the Bus Busy? - JR NZ,HDIN ; ..loop if so - -HDEXIT: XOR A ; Else we are finished. Clean up & Quit - OUT0 (NCRCMD),A ; Clear Initiator Command Register - OUT0 (NCRTGT),A ; and Target Command Register - LD HL,(STATUS) ; Get Message (H) and Status (L) bytes -TIMOUT: - IF NOWAIT - LD A,(WTSAVE) ; Get entry Wait state settings - OUT0 (DCNTL),A ; and restore - ENDIF - LD A,L ; Get Status byte - OR A ; Set Return Status Ok if Status Byte = 0 - RET + JP SETPARMS ; then set parameters for DPH/DPB -HDIN1: IN0 A,(NCRST) ; Get SCSI Status - AND B_PHAS ; Do the Phases Match? - JR Z,PHASE ; ..quit here if Not and clear - INI ; Get a byte from Port (C) to Memory at (HL) - INC B ; (correct B for decrement in INI) - LD A,B_AACK - OUT0 (NCRCMD),A ; ACKnowledge the byte - XOR A - OUT0 (NCRCMD),A ; clear *ACK bit - JR HDIN ; and back for more - -;..... -; SCSI Output Routine (Polled IO) -; Enter with HL pointing to buffer, C addressing 5380 Data Port - -HDOUT: LD A,B_ABUS ; Assert Data Bus - OUT0 (NCRCMD),A - IN0 A,(NCRBUS) ; Check the SCSI Bus - BIT 5,A ; Do we have a REQuest? - JR NZ,HDOUT1 ; ..jump if So to Send a byte - AND B_BSY ; Else is the Bus Busy? - JR NZ,HDOUT ; ..loop if so because we have more to go - JR HDEXIT ; Quit +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; Write to Hard Disk Drive < Internal BIOS Routine > +; Writes from HSTBUF using HSTTRK and HSTSEC to build Block Number. +; NOTE: This routine uses physical drive characteristics from ICFG-xx. -HDOUT1: IN0 A,(NCRST) ; Get current Status - AND B_PHAS ; Do we have a Phase Match? - JP Z,PHASE ; ..quit here if Not and clear +HDWRIT: - OUTI ; Send a byte from (HL) to Port (C) - INC B ; (Correct B for decrement in OUTI) - LD A,B_AACK+B_ABUS - OUT0 (NCRCMD),A ; Set ACKnowledge and BUS bits XOR A - OUT0 (NCRCMD),A ; clear *ACK and *BUS - JR HDOUT ; and back for more - ENDIF ;Not hddma + LD (HSTWRT),A ; Show no active writes pending + JP HDSK_WRITE ; ..continue -;..... -; SCSI Input routine (DMA Controlled) -; Enter: HL = Address of Receive Buffer start - - IF HDDMA -HDIN: LD C,1010B ; Set for Edge Triggering and Read mode - CALL STDMA ; Set up Transfer and DMA Data - OUT0 (NCRINT),A ; Start DMA Initiator Rcv (bits don't care) - ;<-- NOTE: If using true Interrupts, restore local Stack Ptr - ; and preserved registers here - EI ; Interrupts Ok Now - RET - -;..... -; SCSI Output Routine (DMA Controlled) -; Enter: HL = Address of Send Buffer start - -HDOUT: LD C,1000B ; Set for Edge Triggering bit and Write mode - CALL STDMA ; Set up Transfer and DMA Data - LD A,B_ABUS ; Assert the Data Bus - OUT0 (NCRCMD),A - OUT0 (NCRST),A ; Start DMA Send (bits irrelevant) - ;<-- NOTE: If using true Interrupts, restore local Stack Ptr - ; and preserved registers here - EI ; Interrupts Ok Now - RET - -;..... -; STDMA - Set up DMA Channel 1 for a SCSI Read or Write operation. -; Enter: HL = Start Address of Buffer to Read/Write from/to -; C = Write (1x00B) or Read (1x10B) DMA1 Control bits -; ||++- Mem->IO ||++- IO->Mem -; |+--- DMA0-Sns |+--- DMA0-Sns -; +---- DMA1-Edge +---- DMA1-Edge - -STDMA: IN0 A,(DCNTL) ; Get DMA1 Control bits - AND 0F4H ; mask pertinent bits assuming a Write - OR C ; Add Edge Triggering bit and R/W mode - OUT0 (DCNTL),A ; and Command DMA Chan 1 - - IF BANKED - LD A,(SYSBNK) ; Get system Bank # - ELSE - LD A,(TPABNK) ; If Not Banked, load TPA Bank # - ENDIF ;banked - RL H ; Place Address MSB in Carry - ADC A,0 ; offset Bank # by 32k banks - RRA ; shift Bank LSB to Carry - RR H ; Move Bank # LSB (Carry) to Address MSB - LD (DMATBL+2),A ; Store Bank byte in DMA Block - LD (DMATBL),HL ; save Actual DMA Addr in Ctl Block - LD HL,DMATBL ; Point to DMA Control Block - LD BC,8*256+MAR1L ; Set for 8 bytes to DMA Channel 1 - OTIMR ; and output 8 bytes to 8 ports - IN0 A,(DSTAT) ; Get DMA Chan 1 Status - AND 57H ; set for No Terminating Interrupt - OR 81H ; enable DMA operation - OUT0 (DSTAT),A ; and Start the action! - RET - ENDIF ;hddma - -;..... -; Set registers for Whole Block Move - -HDDMOV: LD HL,(DATADR) ; Get ptr to User's Area - LD DE,HSTBUF ; Pt to local Host Buffer - LD BC,512 ; set length - RET ; ..and return +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; Read from Hard Disk Drive < Internal BIOS Routine > +; Reads to HSTBUF using HSTTRK and HSTSEC to build Block Number. +; NOTE: This routine uses physical drive characteristics from ICFG-xx. +; The routine computes a sequential block number with the algorithm; +; Trk * 16 + Sector, HBIOS uses LBA addressing for hard drive like +; devices i.e. everything but floppies. The Track contains the most +; significant 16 bits, Head the next byte and Sector the least +; significant byte. Note, only 16 bits are needed to address 33 +; megabytes for now 24 bits will be used for the LBA address. For non- +; hard drive like devices, Head, Sector and Track can be computed +; using Physical characteristics (hdHds = Number_of_Heads, +; hdSPT = Sectors_per_Track) according to the algorithm: +; +; Sector := (Block# MOD hdSPT)+1 (* Quotient1 := Block# DIV hdSPT *) +; Head := Quotient1 MOD hdHds (* Quotient2 := Quotient1 DIV hdHds *) +; Track := Quotient2 +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -;..... -; Set banks for Interbank move +HDREAD: + JP HDSK_READ IF BANKED -SHDBNK: LD A,(USP-1) ; Get Source Bank Byte - RRA ; shift to - RRA ; - RRA ; Bank # - AND 1FH ; Mask off any Junk - LD C,A ; position - LD A,(SYSBNK) ; Get System Bank - LD B,A ; position it too - RET ; and return - ENDIF ;banked + COMMON /BANK2/ + ELSE + CSEG + ENDIF +; +;================================================================================================== +; HBIOS Disk Driver Interface +;================================================================================================== +; +; HBIOS disk commands +; +HB_DSKRD EQU 13H +HB_DSKWR EQU 14H +; +HDSK_READ: +; CALL PRTSTRD ; DEBUG +; DEFB '[HDSK READ]$' ; DEBUG -;..... -; SCSI Read Sense Command Data Block + LD B,HB_DSKRD ; HBIOS DISK READ (13H) + JR HDSK_RW +; +HDSK_WRITE: +; CALL PRTSTRD +; DEFB '[HDSK WRITE]$' -sense: DEFB 03H ; SCSI Sense Command - DEFB 0,0,0,SNSLEN,0 ; remainder of Sense Command Block - ; (data length set to available space) + LD B,HB_DSKWR ; HBIOS DISK WRITE (14H) +; +HDSK_RW: + LD HL,(HSTDPH) ; GET ACTIVE DPH POINTER + DEC HL ; ADJUST TO POINT TO UNIT NUMBER + LD C,(HL) ; LOAD IT IN C FOR HBIOS CALL LATER + PUSH BC ; SAVE FUNCTION AND DEVICE FOR LATER + LD HL,(HSTTRK) ; GET TRACK VALUE + LD A,L ; LSB OF TRACK TO A + AND 0FH ; ISOLATE HEAD IN LOW 4 BITS + LD D,A ; STUFF IT IN D + LD A,(HSTSEC) ; GET SECTOR + LD E,A ; STUFF IT IN E + LD B,4 ; PREPARE TO SHIFT OUT 4 BIT HEAD VALUE +HDSK_RW1: + SRL H ; SHIFT ONE BIT OUT + RR L ; ... OF HL + DJNZ HDSK_RW1 ; DO ALL 4 BITS + POP BC ; RECOVER FUNCTION AND DEVICE + PUSH BC ; SAVE INCOMING FUNCTION, DEVICE/UNIT + LD B,12H ; SETUP FOR NEW SEEK CALL + CALL HBX_INVOKE ; DO IT + POP BC ; RESTORE INCOMING FUNCTION, DEVICE/UNIT + RET NZ ; ABORT IF SEEK RETURNED AN ERROR W/ ERROR IN A + LD HL,(HB_DSKBUF) ; GET BUFFER ADDRESS + ;LD D,BID_HB ; BUFFER IN HBIOS BANK + LD A,(HB_BNKBIOS) ; BUFFER IN HBIOS BANK + LD D,A ; PUT IN D + LD E,1 ; ONE SECTOR + CALL HBX_INVOKE ; DO IT + OR A ; SET FLAGS + RET Z ; DONE IF NO ERROR + + OR 0FFH ; A=$FF TO SIGNAL ERROR + RET ; AND DONE W/ ERROR +; +;================================================================================================== +; HDSK DISK DRIVER - DATA +;================================================================================================== +; IF BANKED COMMON /B2RAM/ ELSE DSEG ENDIF -HDCMDV: DEFS 2 ; Storage for Current Command Data Block -HDDATV: DEFS 2 ; Storage for current Data Transfer Area -snsDat: DEFS 18 ; Storage for extended Sense Data Received -SNSLEN EQU $-snsDat -; SCSI Controller Command Block - -HDCOMD: DEFS 1 ; Command Byte -HDUNIT: DEFS 1 ; B7-5 = Unit #, remainder is Hi-Addr -HIBLK: DEFS 1 ; Mid-Addr Byte -LOBLK: DEFS 1 ; Lo-Addr Byte -HDSIZ: DEFS 1 ; Block Size to Read/Write (1=512 byte blk) -HDCTL DEFS 1 ; Control/Step Byte - DEFS 6 ; (pad for 12-byte Command Block) -CMDSIZ EQU $-HDCOMD ; Size of Command Block - - IF HDDMA -DATPTR: DEFS 2 ; Pointer to Data Area - ENDIF -DATADR: DEFS 2 ; Pointer to User Buffer Space (user bank) -HDEVIC: DEFS 1 ; Target Device address bit -LUNSAV: DEFS 1 ; Storage for LUN - -HDSTEP: DEFS 1 ; Step Rate Byte for Xebec/Shugart -INIBUF: DEFS 9 ; Buffer for Xebec/Shugart 1610-3 Init. - -; Z-180 DMA Control Block for SCSI Data Transfers - - IF HDDMA -DMATBL: DEFS 2 ; MAR1L, MAR1H - DEFS 1 ; MAR1B (Bank) - DEFS 2 ; DMAACK Output Port - DEFS 1 ; (unused) -NBYTES: DEFS 2 ; BCR1L, BCR1H - ENDIF ;hddma - -;<<--- WARNING! --- Do not re-order the following Two Bytes --->> - -STATUS: DEFS 1 ; Ending Status Byte -MESSAGE: DEFS 1 ; Ending Message Byte - -; IF HDDMA ;<-- If using True Interrupts, uncomment this - ; Section and add code to Interrupt Handler - ; to save registers here. -; DEFS 12 ; ..fill bytes and stack space -;INTSTK: DEFS 2 ; Storage for Stack Pointer -; ENDIF ;hddma - IF NOWAIT -WTSAVE: DEFS 1 ; Entry Wait State Setting - ENDIF -iUnit: DEFS 1 ; Bios Select Unit/LUN byte -xUnit: DEFS 1 ; Direct Access Unit/LUN byte +HDSK_PDN DEFS 1 ; PHYSICAL DEVICE -;======================= End of HARD-DX =========================== - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/hardhb.z80 b/Source/BPBIOS/hardhb.z80 deleted file mode 100644 index d19ccb40..00000000 --- a/Source/BPBIOS/hardhb.z80 +++ /dev/null @@ -1,215 +0,0 @@ -;::::::::::::::::::::::::::::::::::::::::::::::::************************** -; Hard disk routines as implemented for ** Hardware Dependent ** -; SIMH Altair80 ** for exact interface ** -; D-X Designs Pty Ltd P112. ************************** -;-------------------------------------------------------------------------- -; This file uses modifications of the definitions in ICFG-xx to reflect -; Physical and/or logical definitions for HBIOS drives. A controller type of -; 8xH signifies IDE/ATA drives, in which case the Drive byte at HDRVx is: -; 7 6 5 4 3 2 1 0 -; | | | | | | | +- Unit Number (0 = Master, 1 = Slave) -; | | | | +-+-+--- (reserved) -; | | | +--------- 1 = Active, 0 = Inactive -; +-+-+----------- (reserved) -; Additionally, the first byte of the Reduced Write Cylinder word is re- -; defined to be the number of physical/logical Sectors-Per-Track. -; These parameters are used to convert the Track & 16 Sector/Track format -; assumed in the B/P Bios definitions for Hard Drives into Track/Sector/Head -; Sector Number needed for IDE/ATA Data accesses. Direct driver IO routines -; to Select (SELHD), Read (HDREAD) and Write (HDWRIT) are all included here. -;-------------------------------------------------------------------------- -; 1.0 - 26 Aug 01 - Cleaned up source and included fixes from SCSI. HFB -; 0.2 - 28 Jun 97 - Added Home Drive, Retry Disable bit handling. HFB -; 0.1 - 25 Apr 97 - Initial Test Release HFB -;*************************************************************************** - - IF BANKED - COMMON /BANK2/ - ELSE - CSEG - ENDIF - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Function 0 - Set User Data Area Adress for Direct Disk IO, Return -; Number of Bytes in the driver Command Block (SCSI-"like") -; For IDE, a minimum of 6 Bytes is needed (Comnd,Trk(2),Sctr,Head,Drive) -; Enter: DE = Address of User Data Area -; Exit : A = Number of bytes available in the Command Block -; Uses : A,HL -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -HDVALS: CALL PANIC ; NOT IMPLEMENTED!!!! - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Function 1 - Set Drive bit Command Block from A -; Enter: A = Drive Byte -; Exit : A = Drive Bit in LSB (00/01H, for Master/Slave) -; Uses : AF -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -HDSLCT: CALL PANIC ; NOT IMPLEMENTED!!!! - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Function 2 - Direct SCSI driver. This routine performs the function -; described by the command in the HD Command Block with Data area -; addressed by DE. At the end of the function, 512 bytes of data are -; transferred from the Bios IO Buffer to the Users Space set by Fcn 0. -; -; Enter: DE = Pointer to User Command Descriptor Block -; HDCOMD contains pre-filled SCSI Command Block -; A = 0 if No Data to be Written, FF if User-supplied data to write -; Exit : H = Message Byte value -; L = Status Byte value -; A = Status byte, Flags set accordingly. -; Uses : AF,BC,DE,HL -; NOTE : Routine assumes the Command Block is properly configured for the -; desired function and device. Errors in phasing result in program -; exit and Warm Boot function, while Timeout returns 0FFH. -; For external access, It assumes the user has used Functions 0 and 1 to -; set the data transfer source/dest address and logical & physical drive. -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -HD_RW: CALL PANIC ; NOT IMPLEMENTED!!!! - RET - -;======================================================================== -; Select Hard Disk (Unit 0/1, Master/Slave) < Internal Bios routine > - -SELHD: ; SET DEVICE - -; CALL PRTSTRD -; DEFB '[SELHD]$' - - JP SETPARMS ; then set parameters for DPH/DPB - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Write to Hard Disk Drive < Internal BIOS Routine > -; Writes from HSTBUF using HSTTRK and HSTSEC to build Block Number. -; NOTE: This routine uses physical drive characteristics from ICFG-xx. - -HDWRIT: - - XOR A - LD (HSTWRT),A ; Show no active writes pending - - JP HDSK_WRITE ; ..continue - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Read from Hard Disk Drive < Internal BIOS Routine > -; Reads to HSTBUF using HSTTRK and HSTSEC to build Block Number. -; NOTE: This routine uses physical drive characteristics from ICFG-xx. -; The routine computes a sequential block number (as with SCSI) with -; the algorithm; Trk * 16 + Sector, then computes Head, Sector and Track -; using Physical characteristics (hdHds = Number_of_Heads, -; hdSPT = Sectors_per_Track) according to the algorithm: -; -; Sector := (Block# MOD hdSPT)+1 (* Quotient1 := Block# DIV hdSPT *) -; Head := Quotient1 MOD hdHds (* Quotient2 := Quotient1 DIV hdHds *) -; Track := Quotient2 - -HDREAD: - JP HDSK_READ - - IF BANKED - COMMON /B2RAM/ - ELSE - DSEG - ENDIF - -;======================= End of HARDIDE =========================== - - - IF BANKED - COMMON /BANK2/ - ELSE - CSEG - ENDIF - -; -;================================================================================================== -; HDSK DISK DRIVER -;================================================================================================== -; -; IO PORT ADDRESSES -; -HDSK_IO EQU 0FDH -; -HDSK_CMDNONE EQU 0 -HDSK_CMDRESET EQU 1 -HDSK_CMDREAD EQU 2 -HDSK_CMDWRITE EQU 3 -HDSK_CMDPARAM EQU 4 -; -; STATUS -; -HDSKRC_OK EQU 0 -; -; -; -HDSK_READ: -; CALL PRTSTRD -; DEFB '[HDSK READ]$' - - LD B,13H ; $13 IS HBIOS DISK READ - JR HDSK_RW -; -; -; -HDSK_WRITE: -; CALL PRTSTRD -; DEFB '[HDSK WRITE]$' - - LD B,14H ; $14 IS HBIOS DISK WRITE - JR HDSK_RW -; -; -; -HDSK_RW: - LD HL,(HSTDPH) ; GET ACTIVE DPH POINTER - DEC HL ; ADJUST TO POINT TO UNIT NUMBER - LD C,(HL) ; LOAD IT IN C FOR HBIOS CALL LATER - PUSH BC ; SAVE FUNCTION AND DEVICE FOR LATER - LD HL,(HSTTRK) ; GET TRACK VALUE - LD A,L ; LSB OF TRACK TO A - AND 0FH ; ISOLATE HEAD IN LOW 4 BITS - LD D,A ; STUFF IT IN D - LD A,(HSTSEC) ; GET SECTOR - LD E,A ; STUFF IT IN E - LD B,4 ; PREPARE TO SHIFT OUT 4 BIT HEAD VALUE -HDSK_RW1: - SRL H ; SHIFT ONE BIT OUT - RR L ; ... OF HL - DJNZ HDSK_RW1 ; DO ALL 4 BITS - POP BC ; RECOVER FUNCTION AND DEVICE - PUSH BC ; SAVE INCOMING FUNCTION, DEVICE/UNIT - LD B,12H ; SETUP FOR NEW SEEK CALL - CALL HBX_INVOKE ; DO IT - POP BC ; RESTORE INCOMING FUNCTION, DEVICE/UNIT - RET NZ ; ABORT IF SEEK RETURNED AN ERROR W/ ERROR IN A - LD HL,(HB_DSKBUF) ; GET BUFFER ADDRESS - LD D,BID_HB ; BUFFER IN HBIOS BANK - LD E,1 ; ONE SECTOR - CALL HBX_INVOKE ; DO IT - OR A ; SET FLAGS - RET Z ; DONE IF NO ERROR - - OR 0FFH ; A=$FF TO SIGNAL ERROR - RET ; AND DONE W/ ERROR -; -;================================================================================================== -; HDSK DISK DRIVER - DATA -;================================================================================================== -; - IF BANKED - COMMON /B2RAM/ - ELSE - DSEG - ENDIF - - -HDSK_PDN DEFS 1 ; PHYSICAL DEVICE - - - \ No newline at end of file diff --git a/Source/BPBIOS/hardide.z80 b/Source/BPBIOS/hardide.z80 deleted file mode 100644 index d8f5822a..00000000 --- a/Source/BPBIOS/hardide.z80 +++ /dev/null @@ -1,469 +0,0 @@ -;::::::::::::::::::::::::::::::::::::::::::::::::************************** -; Hard disk routines as implemented for ** Hardware Dependent ** -; Tilmann Reh's GIDE board adapted to the ** for exact interface ** -; D-X Designs Pty Ltd P112. ************************** -; Portions derived from GIDE.Z80 with tips from GIDETEST.PAS by Tilmann Reh. -;-------------------------------------------------------------------------- -; This file uses modifications of the definitions in ICFG-xx to reflect -; Physical and/or logical definitions for IDE drives. A controller type of -; 8xH signifies IDE/ATA drives, in which case the Drive byte at HDRVx is: -; 7 6 5 4 3 2 1 0 -; | | | | | | | +- Unit Number (0 = Master, 1 = Slave) -; | | | | +-+-+--- (reserved) -; | | | +--------- 1 = Active, 0 = Inactive -; +-+-+----------- (reserved) -; Additionally, the first byte of the Reduced Write Cylinder word is re- -; defined to be the number of physical/logical Sectors-Per-Track. -; These parameters are used to convert the Track & 16 Sector/Track format -; assumed in the B/P Bios definitions for Hard Drives into Track/Sector/Head -; Sector Number needed for IDE/ATA Data accesses. Direct driver IO routines -; to Select (SELHD), Read (HDREAD) and Write (HDWRIT) are all included here. -;-------------------------------------------------------------------------- -; 1.0 - 26 Aug 01 - Cleaned up source and included fixes from SCSI. HFB -; 0.2 - 28 Jun 97 - Added Home Drive, Retry Disable bit handling. HFB -; 0.1 - 25 Apr 97 - Initial Test Release HFB -;*************************************************************************** - - IF BANKED - COMMON /BANK2/ - ELSE - CSEG - ENDIF - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Function 0 - Set User Data Area Adress for Direct Disk IO, Return -; Number of Bytes in the driver Command Block (SCSI-"like") -; For IDE, a minimum of 6 Bytes is needed (Comnd,Trk(2),Sctr,Head,Drive) -; Enter: DE = Address of User Data Area -; Exit : A = Number of bytes available in the Command Block -; Uses : A,HL -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -HDVALS: LD (DATADR),DE ; Save the Users Data Area - LD A,CMDSIZ - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Function 1 - Set Drive bit Command Block from A -; Enter: A = Drive Byte -; Exit : A = Drive Bit in LSB (00/01H, for Master/Slave) -; Uses : AF -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -HDSLCT: AND 01H ; Strip any garbage - LD (hdUnit),A ; save in Command Block - RET - -;======================================================================== -; Select Hard Disk (Unit 0/1, Master/Slave) < Internal Bios routine > - -SELHD: LD A,(SEKPDN) ; Load Device and Unit # to select -SELHDA: LD C,A ; position for calculations - LD B,HDRV1-HDRV0 ; with size - MLT BC ; Calculate offset into table - LD HL,HDRV0 ; from first Physical drive - ADD HL,BC - LD A,(CNTRLR) ; Set Controller type - BIT 7,A ; Is it IDE/ATA? - JP Z,SELERR ; ..jump if Not to return Error - - LD A,(HL) ; Fetch Device/LUN byte - CALL HDSLCT ; setting variables for Device and LUN - ; Wait until Drive is ready or 10 Seconds - LD A,100 ; 100-100mS ticks -SelWt: CALL BsyWt ; Wait this long for Drive to come Ready - JP C,SELERR ; ..Error if Timeout - ; Else gather drive geometry specified in ICFG-xx - INC HL ; Advance to Number of Tracks Word - LD BC,4 ; Move Number of Tracks (Word) - LD DE,hdTrks ; Number of Heads (Byte) - LDIR ; and Sctrs/Trk to local storage -SetPmV: JP SETPARMS ; then set parameters for DPH/DPB - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Write to Hard Disk Drive < Internal BIOS Routine > -; Writes from HSTBUF using HSTTRK and HSTSEC to build Block Number. -; NOTE: This routine uses physical drive characteristics from ICFG-xx. - -HDWRIT: XOR A - LD (HSTACT),A ; Show no active writes pending - - LD HL,7CH*256+CMDWR ; Set the IDE Write Command - JR HDRW ; ..continue - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Read from Hard Disk Drive < Internal BIOS Routine > -; Reads to HSTBUF using HSTTRK and HSTSEC to build Block Number. -; NOTE: This routine uses physical drive characteristics from ICFG-xx. -; The routine computes a sequential block number (as with SCSI) with -; the algorithm; Trk * 16 + Sector, then computes Head, Sector and Track -; using Physical characteristics (hdHds = Number_of_Heads, -; hdSPT = Sectors_per_Track) according to the algorithm: -; -; Sector := (Block# MOD hdSPT)+1 (* Quotient1 := Block# DIV hdSPT *) -; Head := Quotient1 MOD hdHds (* Quotient2 := Quotient1 DIV hdHds *) -; Track := Quotient2 - -HDREAD: LD HL,7EH*256+CMDRD ; Set the IDE Read Command -HDRW: LD (hdComd),HL ; save - -; Prepare for Disk Read/Write by Preloading all Registers - - LD HL,(HSTDPH) ; Get pointer to desired DPH - DEC HL ; back up to Device # - LD A,(HL) ; and fetch - CALL SELHDA ; Select this device from A-Reg - LD BC,4*256+0 ; Count = 4, MSB of Block # = 0 - LD HL,(HSTTRK) ; Get requested track -MUL16: ADD HL,HL ; Multiply C,H,L by 16 for 21-bit block # - RL C ; shifting overflow bit to C - DJNZ MUL16 ; ..and looping til * 16 - LD A,(HSTSEC) ; Get Logical Host Sector # (4-bits) - ADD A,L ; add in Hi 4-bits of low Block # - LD L,A ; save back - LD A,(hdSPT) ; Get Sctrs-Per-Trk - LD E,A - CALL Divide ; Divide CHL by E - INC A ; Make Sctr # Base at 1 - LD (hdSec),A ; (save) - LD A,(hdHds) ; Get Number of Heads - LD E,A - CALL Divide ; Divide CHL (Quotient from above) by E - LD (hdHead),A ; (save) - LD A,H ; Swap - LD H,L ; Bytes - LD L,A ; in Track Word - LD (hdTrkH),HL ; save Quotient (Track, Hi & Lo) - LD A,0AAH - LD (hdErr),A ; Activate Retries in case Reading - LD A,1 - LD (hdSCnt),A ; Do only One Sector - - LD A,5 ; Give it a few tries -HDOps0: LD (HRTrys),A ; Save Count - CALL GoGIDE ; Try Read/Write Operation - RET Z ; ..quit if Ok - LD A,(HRTrys) ; Else - DEC A ; Any tries remaining? - JR NZ,HDOps0 ; ..loop if So - DEC A ; Else Return 0FFH - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Function 2 - Direct IDE/ATA driver. This routine performs the function -; described by the command in the HD Command Block with Data area -; addressed by DE. At the end of the function, 512 bytes of data are -; transferred from the Bios IO Buffer to the Users Space set by Fcn 0. -; The IDE/ATA Command Block layout is: -; -; Byte Format R/W/V Init RdID Power Diag PwrSet Home -; 0 [Command ] 50 20/30/40 91 EC E0/E1/E5 90 E2/E3 10 -; 1 [BitMap ] 70 7C/(7E) 74 40 00 00 04 40 -; 2 [Drv/Hd ] 0AnH 0AnH 0AnH-1 0AnH - - - 0An0 -; 3 [Cyl#(Hi)] CylHi CylHi CylHi - - - - - -; 4 [Cyl#(Lo)] CylLo CylLo CylLo - - - - - -; 5 [Sector# ] - Sctr - - - - - - -; 6 [Sctr Cnt] - SCnt NSecs - - - n*5Secs - -; 7 [Err Reg ] - (0AA) - - - - - - -; 8 [Dgtl Out] - - - - - - - - -; Rslts/Stat: Stat Stat Stat Stat SCnt Err - Stat -; Reg Reg Reg Reg Reg Reg Reg -; -; Enter: DE = Pointer to User IDE/ATA Command Block -; "hdComd" contains pre-filled Command Block -; A = 0 if No Data to be Written, FF if User-supplied data to write -; Exit : H = Error Byte value (If any) -; L = Status Byte value (If any) -; A = Status byte, Flags set accordingly. -; Uses : AF,BC,DE,HL -; NOTE : Routine assumes the Command Block is properly configured for the -; desired function and device. Timeout returns 0FFH, Unsupported -; command returns 7FH. -; For external access, It assumes the user has used Functions 0 and 1 to -; set the data transfer source/dest address drive number. -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -HD_RW: PUSH AF ; Save User Data Flag - PUSH DE ; and ptr to User's CDB - CALL FLUSH ; Insure Host Buffer is Free - POP HL ; restore User CDB ptr to HL for move - IF BANKED - CALL SHDBNK ; Load Banks for transfer to System fm User - CALL XMOVE ; and Set - ENDIF ;Banked - LD DE,hdComd - LD BC,10 ; Move a 10-byte block - CALL MOVE ; into the Command area - POP AF ; Restore Flag - OR A ; Any User data to write? - JR Z,HD_RW0 ; ..bypass move if not - IF BANKED - CALL SHDBNK ; Load for move from User's to System Banks - CALL XMOVE ; and Set - ENDIF ;Banked - CALL HDDMOV ; Set to move 512 bytes from User to Hstbuf - CALL MOVE ; Do It! -HD_RW0: CALL GoGIDE ; Set Data Addr and do the operation - PUSH HL ; save Status/Err - IF BANKED - CALL SHDBNK ; Load Bank Numbers - LD A,B ; Swap - LD B,C ; Source - LD C,A ; and Destination Banks - CALL XMOVE ; Set Source/Dest - ENDIF ;Banked - CALL HDDMOV ; set Addresses and Length - EX DE,HL ; write back to User's area - CALL MOVE ; move without affecting status in A - POP HL ; Restore Status/Err bytes for checks - LD A,L ; Get Status - OR A ; set flags - RET ; ..and quit - -;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -; Raw GIDE Driver. Assumes Command in hdComd and Parms in Comnd Data Block - -GoGIDE: - IF NOWAIT ; If Wait States not desired.. - IN0 A,(DCNTL) ; Get current settings - LD (WTSAVE),A ; save for exit - AND 11001111B ; Keep everything but IO Waits - OUT0 (DCNTL),A ; and set to No IO Wait States - ENDIF ;nowait - -; Wait approximately 5 Seconds for Target to become Busy. - - LD L,0FFH ; Preset Timeout Error Status - LD A,50 ; 50-100mS ticks - CALL BsyWt ; Monitor Timeout while checking Busy Bit - JR C,TIMOUT ; ..Reporting Error if Timed Out - ;..else fall thru.. - LD HL,hdHead - LD A,(hdUnit) ; Get Drive # - ADD A,A ; Shift - ADD A,A ; Drive Bit - ADD A,A ; into - ADD A,A ; position - OR (HL) ; Add Head # bits - OR 0A0H ; and Fixed Bits - LD (HL),A - LD BC,IDESDH ; Set Port Address (GIDE+0EH) - DEC HL ; back ptr up to hdBMap byte - LD E,(HL) ; fetch - LD D,7 ; and set number of bytes - RL E ; Shift B7 out - -GoGID0: RL E ; Test bit to Carry - INC HL ; bump Byte ptr - JR NC,GoGID1 ; ..jump if No byte to write - LD A,(HL) ; Else get byte - OUT (C),A ; set IDE Register -GoGID1: DEC BC ; Down to next Register address - DEC D ; Finished? - JR NZ,GoGID0 ; ..loop if Not - - LD HL,HSTBUF ; Always IO to/from Host Buffer - LD BC,IDEDat ; Pre-load Data Reg Adr in C, 0 in B - LD A,(hdComd) ; Get Command Byte - CP CMDVER+2 ; Is it in the range w/retry bit? - JR NC,GoGID2 ; ..jump if Not - AND 0FEH ; Else Ignore Retry disable bit (B0) - CP CMDRD ; Read Sector? - JR Z,HRead - CP CMDWR ; Write Sector? - JR Z,HWrite - CP CMDVER ; Verify Sector(s)? - JR Z,HMisc - BIT 4,A ; Is it Home Comnd? - JR Z,HMisc - ;..else fall thru to error exit.. -GoGID2: CP CMDID ; Read ID Information? - JR Z,HRead - CP CMDDIAG ; Perform Diagnostics? - JR Z,HDiag - CP CMDINIT ; Initialize Drive Parameters? - JR Z,HInit - CP CMDPWQ ; Query Power Status? - JR Z,HPwrQ - CP CMDFMT ; Format Track? - JR Z,HWrite - CP CMDPW0 ; Low range of Power Set Commands? - JR C,GoGIDX ; ..jump if < 0E0H - CP CMDPW3+1 ; High Range of Power Set Commands? - JR C,HMisc ; ..jump if in [E0..E3] -GoGIDX: RES 7,L ; If Not legal Command, Return Error 7FH - POP AF ; (clear command from stack) -TIMOUT: - IF NOWAIT - LD A,(WTSAVE) ; Get entry Wait state settings - OUT0 (DCNTL),A ; and restore - ENDIF - LD A,L ; get Status Byte - LD (ERFLAG),A ; (store) - OR A ; set flags - RET ; and return - -;..... -; Read a Sector from the Disk, or Disk Parameters to the Buffer - -HRead: CALL Cmd_Wt ; Send Command in A, Return when Ready -HRead0: IN A,(IDECmd) ; Get Status - BIT 3,A ; Ready? - JR Z,HRead0 ; ..loop if Not - INIR ; Read 512 bytes - INIR ; in two-256 byte sequences -HdFini: CALL Wt_Rdy ; Wait for drive to become Ready -;; -- May need this with some Older Drives that send ECC bytes with no warning! -;; BIT 4,A ; DRQ Shifted? -;; JR Z,HdFnQ ; ..jump if Not -;; IN A,(IDEDat) ; Else Read data reg (ECC Bytes? -;; JR HdFini ; ..loop til no more data - -HdFnQ: IN A,(IDECmd) ; Restore byte - AND 10001001B ; Busy, DRQ, or Error? - JR Z,HdFnOk ; ..exit if Ok - LD A,02H ; Else Set Error status = 2 -HdFnOk: LD L,A ; store - IN A,(IDEErr) ; Get Any Error Status - LD H,A ; save - JR TIMOUT ; ..and exit thru common location - -;..... -; Write a 512-byte Sector to the Disk - -HWrite: CALL Cmd_Wt ; Send Command in A, Return when Ready -HWrit2: IN A,(IDECmd) - BIT 3,A ; Data Request? - JR Z,HWrit2 ; ..loop if Not - OTIR ; Else Write 512 bytes - OTIR ; in two-256 byte operations -HInit: CALL Wt_Rdy - JR HdFnQ ; ..and finish off above - -;..... -; Execute Drive Diagnostics - -HDiag: CALL Cmd_Wt ; Send Command in A, Return when Ready - IN A,(IDEErr) ; Read Status of Tests - JR HdFnOk ; ..exit with Status - -;..... -; Query Power Save Status - -HPwrQ: CALL Cmd_Wt ; Send Command in A, Return when Ready - IN A,(IDESCnt) ; Get Status (00=Running, FF=Stopped) - JR HdFnOk ; ..exit with Status - -;..... -; Miscellaneous Commands such as Set Various Power Control Features - -HMisc: CALL Cmd_Wt ; Send Command in A, Return When Ready - JR HdFnQ ; ..exit checking Status - -;================== SUPPORT ROUTINES ================== -; Divide 24-bit Number by 8-bit Number returning Quotient and Remainder -; Enter: CHL = 24-bit Unsigned Dividend -; E = 8-bit Unsigned Divisor -; Exit : CHL = 24-bit Quotient -; A = 8-bit Remainder -; Uses : AF,BC,HL - -Divide: LD B,24+1 ; 25 times thru Loop - XOR A ; Clear Remainder and Carry -Div: ADC A,A ; Shift Accum Left + Carry - SBC A,E ; Subtract Divisor - JR NC,Div0 ; ..jump if it Worked - ADD A,E ; Else restore Accum & Carry -Div0: CCF ; Flip Carry Bit - ADC HL,HL ; Shift any Carry into - RL C ; Dividend/Quotient - DJNZ Div ; ..loop til Done - RET - -;..... -; Wait for Drive to become Ready (With Timeout) -; Enter: A = Number of 100 mS increments to wait before timeout -; Exit : Carry Set (C) if Timeout, else Carry Clear (NC), Unit Ready -; Uses : MTM Timer variable, AF - -BsyWt: LD (MTM),A ; Set Timer value -BsyW0: LD A,(MTM) ; Get Current Count - OR A ; Have we timed out? - SCF ; (Set error flag in case) - RET Z ; ..exit w/Error flag if So - IN A,(IDECmd) ; Else Get the Busy Bit - RLA ; Is it BSY? - JR C,BSYW0 ; ..loop if So - RET ; else back to Caller, Carry Clear - -;..... -; Send command to the IDE Command Register, fall thru to wait for Ready Status - -Cmd_Wt: LD A,(hdComd) ; Get Command Byte in case bit stripped - OUT (IDECmd),A ; Start Operation - ;..fall thru to wait for Ready -;..... -; Wait for Drive to become Ready (No Timeout) -; Enter: None -; Exit : None -; Uses : AF - -Wt_Rdy: IN A,(IDECmd) ; Get Drive Status - RLA ; Ready? - JR C,Wt_Rdy ; ..loop if Not - RET - -;..... -; Set registers for Whole Block Move - -HDDMOV: LD HL,(DATADR) ; Get ptr to User's Area - LD DE,HSTBUF ; Pt to local Host Buffer - LD BC,512 ; set length - RET ; ..and return - -;..... -; Set banks for Interbank move - - IF BANKED -SHDBNK: LD A,(USP-1) ; Get Source Bank Byte - RRA ; shift to - RRA ; - RRA ; Bank # - AND 1FH ; Mask off any Junk - LD C,A ; position - LD A,(SYSBNK) ; Get System Bank - LD B,A ; position it too - RET ; and return - ENDIF ;banked - - IF BANKED - COMMON /B2RAM/ - ELSE - DSEG - ENDIF - -HRTrys: DEFS 1 ; Retry counter storage -hdUnit: DEFS 1 ; IDE Drive (0 = Master, 1 = Slave) -hdTrks: DEFS 2 ; Number of Tracks on IDE Drive -hdHds: DEFS 1 ; Number of Heads on IDE Drive -hdSPT: DEFS 1 ; Number of Sectors-Per-Track on IDE Drive - -; IDE Command Block for User Direct Driver Access - -hdComd: DEFS 1 ; Command Byte -hdBMap: DEFS 1 ; Bit Map (B6..0) of Following Bytes to Set -hdHead: DEFS 1 ; Head Number/Number of Heads in B3..0 -hdTrkH: DEFS 1 ; Hi-Track (Cylinder) Byte -hdTrkL: DEFS 1 ; Lo-Track (Cylinder) Byte -hdSec: DEFS 1 ; Sector Number -hdSCnt: DEFS 1 ; Sector Count -hdErr: DEFS 1 ; Error Reg Value -hdDigO: DEFS 1 ; Digital Output Reg Value -CMDSIZ EQU $-hdComd ; Size of Command Block - -DATADR: DEFS 2 ; Pointer to User Buffer Space (user bank) - IF NOWAIT -WTSAVE: DEFS 1 ; Storage for Entry Wait State Setting - ENDIF -;======================= End of HARDIDE =========================== - \ No newline at end of file diff --git a/Source/BPBIOS/hardsim.z80 b/Source/BPBIOS/hardsim.z80 deleted file mode 100644 index ff42da65..00000000 --- a/Source/BPBIOS/hardsim.z80 +++ /dev/null @@ -1,291 +0,0 @@ -;::::::::::::::::::::::::::::::::::::::::::::::::************************** -; Hard disk routines as implemented for ** Hardware Dependent ** -; SIMH Altair80 ** for exact interface ** -; D-X Designs Pty Ltd P112. ************************** -;-------------------------------------------------------------------------- -; This file uses modifications of the definitions in ICFG-xx to reflect -; Physical and/or logical definitions for HBIOS drives. A controller type of -; 8xH signifies IDE/ATA drives, in which case the Drive byte at HDRVx is: -; 7 6 5 4 3 2 1 0 -; | | | | | | | +- Unit Number (0 = Master, 1 = Slave) -; | | | | +-+-+--- (reserved) -; | | | +--------- 1 = Active, 0 = Inactive -; +-+-+----------- (reserved) -; Additionally, the first byte of the Reduced Write Cylinder word is re- -; defined to be the number of physical/logical Sectors-Per-Track. -; These parameters are used to convert the Track & 16 Sector/Track format -; assumed in the B/P Bios definitions for Hard Drives into Track/Sector/Head -; Sector Number needed for IDE/ATA Data accesses. Direct driver IO routines -; to Select (SELHD), Read (HDREAD) and Write (HDWRIT) are all included here. -;-------------------------------------------------------------------------- -; 1.0 - 26 Aug 01 - Cleaned up source and included fixes from SCSI. HFB -; 0.2 - 28 Jun 97 - Added Home Drive, Retry Disable bit handling. HFB -; 0.1 - 25 Apr 97 - Initial Test Release HFB -;*************************************************************************** - - IF BANKED - COMMON /BANK2/ - ELSE - CSEG - ENDIF - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Function 0 - Set User Data Area Adress for Direct Disk IO, Return -; Number of Bytes in the driver Command Block (SCSI-"like") -; For IDE, a minimum of 6 Bytes is needed (Comnd,Trk(2),Sctr,Head,Drive) -; Enter: DE = Address of User Data Area -; Exit : A = Number of bytes available in the Command Block -; Uses : A,HL -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -HDVALS: LD (DATADR),DE ; Save the Users Data Area - LD A,CMDSIZ - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Function 1 - Set Drive bit Command Block from A -; Enter: A = Drive Byte -; Exit : A = Drive Bit in LSB (00/01H, for Master/Slave) -; Uses : AF -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -HDSLCT: AND 01H ; Strip any garbage - LD (hdUnit),A ; save in Command Block - RET - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Function 2 - Direct SCSI driver. This routine performs the function -; described by the command in the HD Command Block with Data area -; addressed by DE. At the end of the function, 512 bytes of data are -; transferred from the Bios IO Buffer to the Users Space set by Fcn 0. -; -; Enter: DE = Pointer to User Command Descriptor Block -; HDCOMD contains pre-filled SCSI Command Block -; A = 0 if No Data to be Written, FF if User-supplied data to write -; Exit : H = Message Byte value -; L = Status Byte value -; A = Status byte, Flags set accordingly. -; Uses : AF,BC,DE,HL -; NOTE : Routine assumes the Command Block is properly configured for the -; desired function and device. Errors in phasing result in program -; exit and Warm Boot function, while Timeout returns 0FFH. -; For external access, It assumes the user has used Functions 0 and 1 to -; set the data transfer source/dest address and logical & physical drive. -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -HD_RW: CALL PANIC ; NOT IMPLEMENTED!!!! - RET - -;======================================================================== -; Select Hard Disk (Unit 0/1, Master/Slave) < Internal Bios routine > - -SELHD: ; SET DEVICE - LD A,(SEKPDN) - LD (HDSK_DEVICE),A - JP SETPARMS ; then set parameters for DPH/DPB - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Write to Hard Disk Drive < Internal BIOS Routine > -; Writes from HSTBUF using HSTTRK and HSTSEC to build Block Number. -; NOTE: This routine uses physical drive characteristics from ICFG-xx. - -HDWRIT: XOR A - LD (HSTACT),A ; Show no active writes pending - - JP HDSK_WRITE ; ..continue - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Read from Hard Disk Drive < Internal BIOS Routine > -; Reads to HSTBUF using HSTTRK and HSTSEC to build Block Number. -; NOTE: This routine uses physical drive characteristics from ICFG-xx. -; The routine computes a sequential block number (as with SCSI) with -; the algorithm; Trk * 16 + Sector, then computes Head, Sector and Track -; using Physical characteristics (hdHds = Number_of_Heads, -; hdSPT = Sectors_per_Track) according to the algorithm: -; -; Sector := (Block# MOD hdSPT)+1 (* Quotient1 := Block# DIV hdSPT *) -; Head := Quotient1 MOD hdHds (* Quotient2 := Quotient1 DIV hdHds *) -; Track := Quotient2 - -HDREAD: - JP HDSK_READ - - IF BANKED - COMMON /B2RAM/ - ELSE - DSEG - ENDIF - -HRTrys: DEFS 1 ; Retry counter storage -hdUnit: DEFS 1 ; IDE Drive (0 = Master, 1 = Slave) -hdTrks: DEFS 2 ; Number of Tracks on IDE Drive -hdHds: DEFS 1 ; Number of Heads on IDE Drive -hdSPT: DEFS 1 ; Number of Sectors-Per-Track on IDE Drive - -; IDE Command Block for User Direct Driver Access - -hdComd: DEFS 1 ; Command Byte -hdBMap: DEFS 1 ; Bit Map (B6..0) of Following Bytes to Set -hdHead: DEFS 1 ; Head Number/Number of Heads in B3..0 -hdTrkH: DEFS 1 ; Hi-Track (Cylinder) Byte -hdTrkL: DEFS 1 ; Lo-Track (Cylinder) Byte -hdSec: DEFS 1 ; Sector Number -hdSCnt: DEFS 1 ; Sector Count -hdErr: DEFS 1 ; Error Reg Value -hdDigO: DEFS 1 ; Digital Output Reg Value -CMDSIZ EQU $-hdComd ; Size of Command Block - -DATADR: DEFS 2 ; Pointer to User Buffer Space (user bank) - IF NOWAIT -;WTSAVE: DEFS 1 ; Storage for Entry Wait State Setting - ENDIF -;======================= End of HARDIDE =========================== - - - IF BANKED - COMMON /BANK2/ - ELSE - CSEG - ENDIF - -; -;================================================================================================== -; HDSK DISK DRIVER -;================================================================================================== -; -; IO PORT ADDRESSES -; -HDSK_IO EQU 0FDH -; -HDSK_CMDNONE EQU 0 -HDSK_CMDRESET EQU 1 -HDSK_CMDREAD EQU 2 -HDSK_CMDWRITE EQU 3 -HDSK_CMDPARAM EQU 4 -; -; STATUS -; -HDSKRC_OK EQU 0 -; -; -; -HDSK_READ: -; CALL PRTSTRD -; DEFB '[HDSK READ]$' - - LD A,HDSK_CMDREAD - JR HDSK_RW -; -; -; -HDSK_WRITE: -; CALL PRTSTRD -; DEFB '[HDSK WRITE]$' - LD A,HDSK_CMDWRITE - JR HDSK_RW -; -; -; -HDSK_RW: - LD (HDSK_CMD),A - - ; CLEAR RESULTS - XOR A ; A = 0 - LD (HDSK_RC),A ; CLEAR RETURN CODE - - ; INIT IF NEEDED - LD A,(HDSK_STAT) ; GET CURRENT STATUS - OR A ; SET FLAGS - CALL NZ,HDSK_RESET ; RESET IF NOT READY - -; ; SET SECTOR (IGNORES MSB) -; LD A,(HSTSEC) -; LD (HDSK_SEC),A - -; ; SET TRACK -; LD BC,(HSTTRK) -; LD (HDSK_TRK),BC - - ; BPBIOS DEFINES 16 SECTORS PER TRACK - ; CONVERT TO 256 SECTORS PER TRACK FOR SIMH DEFINITION - ; FIRST, DIVIDE TRACKS BY 16 SAVING REMAINDER IN TOP NIBBLE OF A - LD HL,(HSTTRK) - XOR A ; CLEAR A - LD B,4 ; ROTATE 4 BITS TO DIVIDE BY 4 -HDSK_RW0: - SRL H - RR L - RR A - DJNZ HDSK_RW0 - LD (HDSK_TRK),HL ; SAVE MODIFIED TRACK FOR HDSK I/O CALL - LD HL,HSTSEC ; POINT TO INCOMING SECTOR - OR (HL) ; COMBINE WITH SECTOR VALUE PASSED IN - LD (HDSK_SEC),A ; SAVE IT FOR HDSK I/O CALL - - ; SET TRANSFER ADDRESS - LD BC,HSTBUF - LD (HDSK_DMA),BC - - ; EXECUTE COMMAND - LD B,7 ; SIZE OF PARAMETER BLOCK - LD HL,HDSK_PARMBLK ; START ADDRESS OF PARAMETER BLOCK -HDSK_RW1: - LD A,(HL) ; GET BYTE OF PARAMETER BLOCK - OUT (0FDH),A ; SEND IT TO PORT - INC HL ; POINT TO NEXT BYTE - DJNZ HDSK_RW1 - - IN A,(0FDH) ; GET RESULT CODE - LD (HDSK_RC),A - OR A - JR Z,HDSK_OK - JR HDSK_ERR - -HDSK_ERR: - XOR A - DEC A ; A=$FF TO SIGNAL ERROR - LD (HDSK_STAT),A ; SAVE IT - RET - -HDSK_OK: - XOR A - RET -; -; -; -HDSK_RESET: - LD B,32 - LD A,HDSK_CMDRESET -HDSK_RESET1: - OUT (0FDH),A - DJNZ HDSK_RESET1 - - XOR A ; STATUS = OK - LD (HDSK_STAT),A ; SAVE IT - - RET -; -;================================================================================================== -; HDSK DISK DRIVER - DATA -;================================================================================================== -; - IF BANKED - COMMON /B2RAM/ - ELSE - DSEG - ENDIF - -HDSK_STAT DEFB 0 -HDSK_RC DEFB 0 -; -HDSK_PARMBLK: -HDSK_CMD DEFB 0 ; COMMAND (HDSK_READ, HDSK_WRITE, ...) -HDSK_DEVICE DEFB 0 ; 0..7, HARD DISK UNIT -HDSK_SEC DEFB 0 ; 0..255 SECTOR -HDSK_TRK DEFW 0 ; 0..2047 TRACK -HDSK_DMA DEFW 0 ; DEFINES WHERE RESULT IS PLACED IN MEMORY - - - - - \ No newline at end of file diff --git a/Source/BPBIOS/hbios.z80 b/Source/BPBIOS/hbios.z80 index c8671c87..aeacf43a 100644 --- a/Source/BPBIOS/hbios.z80 +++ b/Source/BPBIOS/hbios.z80 @@ -1,463 +1,146 @@ ;:::::::::::::::::::::::::::::::::::::::***************************** ; HBIOS - HBios Interface Routines ***** Hardware-Specific ***** ; ***************************** -; +; - Retro Brew - ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; -HB_DEFBNK EQU BID_USR ; Default bank number -; -; LOCATION OF DISPATCH ENTRY IN HBIOS BANK +; HBIOS Functions ; -HB_DISPATCH EQU 403H -HB_STACK EQU 500H +HBF_ALLOC EQU 0F6H ; HBIOS Func: ALLOCATE Heap Memory +HBF_PEEK EQU 0FAH ; HBIOS Func: Peek Byte +HBF_POKE EQU 0FBH ; HBIOS Func: Poke Byte +HBF_MEMINFO EQU 0F8F1H ; HBIOS Func: Get Memory Info +HBF_BNKINFO EQU 0F8F2H ; HBIOS Func: Get Bank Info ; -; PLATFORM SPECIFIC CONSTANTS +; HBIOS Proxy Addresses ; - IF N8VEM OR ZETA OR ZETA2 -SBC_BASE EQU 60H - ENDIF - - IF N8VEM OR ZETA -MPCL_RAM EQU SBC_BASE + 18H ; BASE IO ADDRESS OF RAM MEMORY PAGER CONFIGURATION LATCH -MPCL_ROM EQU SBC_BASE + 1CH ; BASE IO ADDRESS OF ROM MEMORY PAGER CONFIGURATION LATCH - ENDIF - - IF ZETA2 -MPGSEL_0 EQU SBC_BASE + 18H -MPGSEL_1 EQU SBC_BASE + 19H -MPGSEL_2 EQU SBC_BASE + 1AH -MPGSEL_3 EQU SBC_BASE + 1BH -MPGENA EQU SBC_BASE + 1CH - ENDIF - - IF N8 -N8_BASE EQU 80H ; BASE I/O ADDRESS BOARD PERIPHERALS (NON-CPU) -ACR EQU N8_BASE + 14H ; AUXILLARY CONTROL REGISTER -DEFACR EQU 1BH ; DEFAULT VALUE FOR ACR -CPU_BBR EQU 40H + 39H - ENDIF - - IF MK4 -CPU_BBR EQU 40H + 39H - ENDIF - - CSEG - - IF INTPXY - - DB 0 ; Prevents link error in BPBUILD - -HB_XFC EQU 0FFE0H -HB_XFCIMG EQU $ - - .PHASE HB_XFC -HB_CURBNK DB 0 -HB_INVBNK DB 0 -HB_SRCADR DW 0 -HB_SRCBNK DB 0 -HB_DSTADR DW 0 -HB_DSTBNK DB 0 -HB_CPYLEN DW 0 - DB 0,0,0,0,0,0 -HB_INVOKE JP HBX_INVOKE -HB_BNKSEL JP HBX_BNKSEL -HB_BNKCPY JP HBX_BNKCPY -HB_BNKCALL JP 0 ; HBX_BNKCALL (NOT IMPLEMENTED) - DB 0,0 ; RESERVED -HB_IDENT DW 0 ; HBX_IDENT - .DEPHASE - -HB_XFCSIZ EQU $ - HB_XFCIMG - - ELSE - HBX_INVOKE EQU 0FFF0H HBX_BNKSEL EQU 0FFF3H HBX_BNKCPY EQU 0FFF6H HBX_BNKCALL EQU 0FFF9H -HB_CURBNK EQU 0FFE0H -HB_INVBNK EQU 0FFE1H -HB_SRCADR EQU 0FFE2H -HB_SRCBNK EQU 0FFE4H -HB_DSTADR EQU 0FFE5H -HB_DSTBNK EQU 0FFE7H -HB_CPYLEN EQU 0FFE8H - - ENDIF - -; -;================================================================================================== -; HBIOS INTERFACE -;================================================================================================== -; -HBX_INIT: - - IF INTPXY - - ; Copy HB_XFCIMG to target location - LD HL,HB_XFCIMG - LD DE,HB_XFC ; point to HBIOS comm block - LD BC,HB_XFCSIZ - LDIR - - ; Setup RST 08 vector - LD A,0C3H ; $C3 = JP - LD (08H),A - LD HL,HBX_INVOKE - LD (09H),HL - - ENDIF - - ; Init HB data fields - LD A,BID_USR - LD (HB_CURBNK),A - LD (HB_SRCBNK),A - LD (HB_DSTBNK),A - - IF BANKED - - ; Copy vectors from TPA page zero to SYS page zero - LD BC,(TPABNK) ; C := TPABNK, B := SYSBNK - CALL XMOVE ; Set source/dest banks for copy - LD HL,0 ; Source address is zero - LD DE,0 ; Destination address is zero - LD BC,40H ; Copy 40H bytes - CALL MOVE ; Do it - LD A,(TPABNK) ; Set all Bank regs to TPA - - ENDIF - -; CSEG -;ORG_CSEG EQU $ -; DSEG -;ORG_DSEG EQU $ - IF BANKED - COMMON /BANK2/ -ORG_BANK2 EQU $ - COMMON /B2RAM/ -ORG_B2RAM EQU $ - ENDIF +HBX_CURBNK EQU 0FFE0H +HBX_INVBNK EQU 0FFE1H +HBX_SRCADR EQU 0FFE2H +HBX_SRCBNK EQU 0FFE4H +HBX_DSTADR EQU 0FFE5H +HBX_DSTBNK EQU 0FFE7H +HBX_CPYLEN EQU 0FFE8H CSEG - - CALL NEWLINE2 - LD DE,HB_STR_TAG - CALL WRITESTR - IF INTPXY - LD DE,HB_STR_INTPXY - ELSE - LD DE,HB_STR_EXTPXY - ENDIF - CALL WRITESTR + +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; Trap initial SELMEM call and fixup HBIOS bank ids. +; A = Bank +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +; LDSYS calls the SELMEM entry point of BIOSJT in order to +; place memory contents in SYSBNK. It does this prior to +; calling CBOOT to start the system. Since we need to adjust +; the bank numbers on-the-fly at startup to adjust for +; HBIOS actual RAM size, we intercept the initial HB_SELMEM +; call here, make required changes, then update the +; BIOSJT to point directly to the normal SELMEM routine for +; all subsequent calls. + + ; BPBIOS HBIOS Typical + ; ------------ -------------- -------------- + ; -1: BID_COM 90h - 1 = 8Fh + ; -2: TPABNK BID_USR 90h - 2 = 8Eh + ; -3: BID_BIOS 90h - 3 = 8Dh + ; -4: SYSBNK BID_AUX 90h - 4 = 8Ch + ; -9: BNKM BID_AUX-5 90h - 9 = 87h + ; -16: RAMBNK RAMD0 90h - 16 = 80h - CALL NEWLINE - LD DE,HB_STR_CSEG - CALL WRITESTR - LD BC,BIOSJT - CALL PRTHEXWORD - LD DE,HB_STR_DSEG - CALL WRITESTR - LD BC,CBOOT - CALL PRTHEXWORD +HB_SELMEM: + PUSH AF + PUSH BC + PUSH DE + PUSH HL - IF BANKED - LD DE,HB_STR_BANK2 - CALL WRITESTR - LD BC,ROMJT - CALL PRTHEXWORD - LD DE,HB_STR_B2RAM - CALL WRITESTR - LD BC,CBOOT0 - CALL PRTHEXWORD - LD DE,HB_STR_RESVD - CALL WRITESTR - LD BC,ALV$50 - CALL PRTHEXWORD - ENDIF + IF HB_DEBUG AND FALSE + CALL PRTSTRD + DEFB '[HB_SELMEM: $' + CALL PRTHEXBYTE + CALL PRTSTRD + DEFB ']',CR,LF,'$' + ENDIF - CALL NEWLINE + LD BC,HBF_BNKINFO ; HBIOS BNKINFO function + CALL HBX_INVOKE ; DO IT, D=BID_BIOS, E=BID_USER + LD A,D ; BID_BIOS + LD (HB_BNKBIOS),A ; SET HB_BNKBIOS + ADD A,3 ; HBIOS + 3 + LD (HB_BNKEND),A ; ... is the ending RAM bank + IF BANKED + LD (BNKADJ+1),A ; Dynamically update SELBNK + ENDIF + + LD HL,SELMEM ; Future SELMEM calls will + LD (BIOSJT+(27*3)+1),HL ; ... go to real SELMEM - RET + POP HL + POP DE + POP BC + POP AF + JP SELMEM -HB_STR_TAG DB "HBIOS: $" -HB_STR_INTPXY DB "Internal Proxy$" -HB_STR_EXTPXY DB "External Proxy$" -HB_STR_CSEG DB "CSEG=$" -HB_STR_DSEG DB ", DSEG=$" -HB_STR_BANK2 DB ", BANK2=$" -HB_STR_B2RAM DB ", B2RAM=$" -HB_STR_RESVD DB ", RESVD=$" +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; Move Data - Possibly between banks. This resembles CP/M 3, but +; usage of the HL and DE registers is reversed. +; Enter: HL = Source Address +; DE = Destination Address +; BC = Number of bytes to move +; Exit : None +; Uses : AF,BC,DE,HL +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -HBX_XCOPY: - LD A,C - LD (HB_SRCBNK),A - LD A,B - LD (HB_DSTBNK),A +HB_MOVE: + PUSH HL + LD HL,HB_BNKEND + LD A,(HB_SRCBNK) + ADD A,(HL) ; Adjust for HBIOS bank ids + LD (HBX_SRCBNK),A + LD A,(HB_DSTBNK) + ADD A,(HL) ; Adjust for HBIOS bank ids + LD (HBX_DSTBNK),A + POP HL + CALL HBX_BNKCPY + PUSH HL + LD HL,(TPABNK) ; Get TPA Bank # + LD H,L ; .to both H and L + LD (HB_SRCBNK),HL ; ..set Source & Destination Bank # to TPA + POP HL RET -HBX_COPY: - JP HBX_BNKCPY - - IF INTPXY +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; Set Banks for Inter-Bank Xfer. Save all Registers. +; B = Destination Bank, C = Source Bank +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -;================================================================================================== -; SELECT MEMORY BANK FOR LOWER 32K -;================================================================================================== - -HBX_BNKSEL: - LD (HB_CURBNK),A +HB_XMOVE: + IF HB_DEBUG AND FALSE + CALL PRTSTRD + DEFB '[HB_XMOVE: $' + CALL PRTHEXWORD + CALL PRTSTRD + DEFB ']',CR,LF,'$' + ENDIF - IF N8VEM OR ZETA - OUT (MPCL_ROM),A - OUT (MPCL_RAM),A + LD (HB_SRCBNK),BC RET - ENDIF - - IF ZETA2 - BIT 7,A ; BIT 7 SET REQUESTS RAM PAGE - JR Z,HBX_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 -; -HBX_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 N8 - BIT 7,A - JR Z,HBX_ROM -; -HBX_RAM: - RES 7,A - RLCA - RLCA - RLCA - OUT0 (CPU_BBR),A - LD A,DEFACR | 80H - OUT0 (ACR),A - RET ; -HBX_ROM: - OUT0 (RMAP),A - XOR A - OUT0 (CPU_BBR),A - LD A,DEFACR - OUT0 (ACR),A - RET - ENDIF - - IF MK4 - RLCA - JR NC,HBX_BNKSEL1 - XOR 00100001B -HBX_BNKSEL1: - RLCA - RLCA - OUT0 (CPU_BBR),A - RET - - ENDIF - ;================================================================================================== -; INTERBANK MEMORY COPY +; HBIOS INITIALIZATION ;================================================================================================== - -HBX_BNKCPY: - HB_DI ; NOTE: ONLY REQUIRED WHEN USING IM 1 - - LD (HBX_STKSAV),SP - LD SP,HBX_TMPSTK - LD A,(HB_CURBNK) ; GET CURRENT BANK - PUSH AF ; AND SAVE TO RESTORE LATER - PUSH BC ; CUR LEN -> (SP) -; -HBX_BC_LOOP: - EX (SP),HL ; HL := CUR LEN, (SP) := CUR SRC - LD BC,HBX_BUFSIZ ; SET BC TO BOUNCE BUFFER SIZE - OR A ; CLEAR CARRY FLAG - SBC HL,BC ; CUR LEN := CUR LEN - BBUF SIZE - JR C,HBX_BC_LAST ; END GAME, LESS THAN BBUF BYTES LEFT - EX (SP),HL ; HL := CUR SRC, (SP) := REM LEN - CALL HBX_BC_ITER ; DO A FULL BBUF SIZE CHUNK - JR HBX_BC_LOOP ; AND REPEAT TILL DONE -; -HBX_BC_LAST: - ; HL IS BETWEEN -(BBUF SIZE) AND -1, BC = BBUF SIZE - OR A ; CLEAR CARRY - ADC HL,BC ; HL := REM LEN (0 - 127) - EX (SP),HL ; HL := CUR SRC, (SP) := REM LEN - POP BC ; BC := REM LEN - CALL NZ,HBX_BC_ITER ; DO FINAL CHUNK, BUT ONLY IF NOT ZERO BYTES - POP AF ; RECOVER ORIGINAL BANK - CALL HBX_BNKSEL ; SWITCH TO CURRENT BANK AND EXIT - LD SP,(HBX_STKSAV) - - HB_EI ; NOTE: ONLY REQUIRED WHEN USING IM 1 - - RET ; -HBX_BC_ITER: - ; HL = SRC ADR, DE = DEST ADR, BC = LEN - PUSH BC ; SAVE COPY LEN - PUSH DE ; FINAL DEST ON STACK - LD DE,HBX_BUF ; SET DEST TO BUF - LD A,(HB_SRCBNK) ; GET SOURCE BANK - CALL HBX_BNKSEL ; SWITCH TO SOURCE BANK - LDIR ; HL -> BUF (DE), BC BYTES, HL UPDATED SRC ADR - POP DE ; DE := FINAL DEST - POP BC ; GET LEN BACK IN BC - PUSH HL ; SAVE UPDATED SRC ADR - LD HL,HBX_BUF ; SET SRC ADR TO BUF - LD A,(HB_DSTBNK) ; GET DEST BANK - CALL HBX_BNKSEL ; SWITCH TO DEST BANK - LDIR ; BUF (HL) -> DE, BC BYTES, DE UPDATED DEST ADR - POP HL ; RECOVER UPDATED SRC ADR - ; HL = UPD SRC, DE = UPD DEST, BC = 0 - RET - -;================================================================================================== -; ENTRY POINT FOR BIOS FUNCTIONS (TARGET OF RST 08) -;================================================================================================== - -HBX_INVOKE: - LD (HBX_INVSP),SP ; SAVE ORIGINAL STACK FRAME - LD A,(HB_CURBNK) ; GET CURRENT BANK - LD (HB_INVBNK),A ; SAVE INVOCATION BANK - -; HB_DI - LD SP,HBX_TMPSTK ; USE SMALL TEMP STACK FRAME IN HI MEM FOR BANK SWITCH - LD A,BID_HB ; HBIOS BANK - CALL HBX_BNKSEL ; SELECT IT - LD SP,HB_STACK ; NOW USE FULL HBIOS STACK IN HBIOS BANK -; HB_EI - - CALL HB_DISPATCH ; CALL HBIOS FUNCTION DISPATCHER - -; HB_DI - LD SP,HBX_TMPSTK ; USE SMALL TEMP STACK FRAME IN HI MEM FOR BANK SWITCH - PUSH AF ; SAVE AF (FUNCTION RETURN) - LD A,(HB_INVBNK) ; LOAD ORIGINAL BANK - CALL HBX_BNKSEL ; SELECT IT - POP AF ; RESTORE AF - LD SP,0 ; RESTORE ORIGINAL STACK FRAME -HBX_INVSP EQU $ - 2 -; HB_EI - - RET ; RETURN TO CALLER - - ENDIF - -;================================================================================================== -; LD A,(C:HL) -;================================================================================================== - -HBX_FRGETB: - LD (HBX_STKSAV),SP ; Save current stack - LD SP,HBX_TMPSTK ; Activate our private stack - LD A,(HB_CURBNK) ; Get current bank - LD (HBX_BNKSAV),A ; Save current bank - PUSH BC - LD A,C - HB_DI - CALL HBX_BNKSEL - LD C,(HL) - LD A,(HBX_BNKSAV) - CALL HBX_BNKSEL - HB_EI - LD A,C - POP BC - LD SP,(HBX_STKSAV) ; RESTORE ORIGINAL STACK FRAME - RET - -;================================================================================================== -; LD DE,(C:HL) -;================================================================================================== - -HBX_FRGETW: - LD (HBX_STKSAV),SP ; Save current stack - LD SP,HBX_TMPSTK ; Activate our private stack - LD A,(HB_CURBNK) ; Get current bank - LD (HBX_BNKSAV),A ; Save current bank - LD A,C - HB_DI - CALL HBX_BNKSEL - LD E,(HL) - INC HL - LD D,(HL) - DEC HL - LD A,(HBX_BNKSAV) - CALL HBX_BNKSEL - HB_EI - LD SP,(HBX_STKSAV) ; RESTORE ORIGINAL STACK FRAME - RET - -;================================================================================================== -; LD (C:HL),A -;================================================================================================== - -HBX_FRPUTB: - LD (HBX_STKSAV),SP ; Save current stack - LD SP,HBX_TMPSTK ; Activate our private stack - PUSH AF - LD A,(HB_CURBNK) ; Get current bank - LD (HBX_BNKSAV),A ; Save current bank - POP AF - PUSH BC - LD B,A - LD A,C - HB_DI - CALL HBX_BNKSEL - LD (HL),B - LD A,(HBX_BNKSAV) - CALL HBX_BNKSEL - HB_EI - POP BC - LD SP,(HBX_STKSAV) ; RESTORE ORIGINAL STACK FRAME - RET - -;================================================================================================== -; LD (C:HL),DE -;================================================================================================== - -HBX_FRPUTW: - LD (HBX_STKSAV),SP ; Save current stack - LD SP,HBX_TMPSTK ; Activate our private stack - LD A,(HB_CURBNK) ; Get current bank - LD (HBX_BNKSAV),A ; Save current bank - LD A,C - HB_DI - CALL HBX_BNKSEL - LD (HL),E - INC HL - LD (HL),D - DEC HL - LD A,(HBX_BNKSAV) - CALL HBX_BNKSEL - HB_EI - LD SP,(HBX_STKSAV) ; RESTORE ORIGINAL STACK FRAME - RET - -;================================================================================================== -; PRIVATE DATA -;================================================================================================== - - DSEG - -HB_DSKBUF DEFW 0 ; Address of physical disk buffer in HBIOS bank -HBX_BNKSAV DEFB 0 ; Saved bank id during HBIOS calls -HBX_STKSAV DEFW 0 ; Saved stack pointer during HBIOS calls - DEFS 32 ; Private stack for HBIOS -HBX_TMPSTK EQU $ ; Top of private stack - - IF INTPXY - -HBX_BUFSIZ EQU 40H -HBX_BUF DEFS HBX_BUFSIZ ; Interbank copy buffer + CSEG - ENDIF +HB_SRCBNK: DEFS 1 ; Move Source Bank # +HB_DSTBNK: DEFS 1 ; Move Destination Bank # +HB_BNKBIOS: DEFS 1 ; Bank id of HBIOS bank +HB_BNKEND: DEFS 1 ; End of available RAM banks (last bank + 1) +HB_DSKBUF: DEFS 2 ; Address of physical disk buffer in HBIOS bank + \ No newline at end of file diff --git a/Source/BPBIOS/ibmv-dx.z80 b/Source/BPBIOS/ibmv-dx.z80 deleted file mode 100644 index f5b302bb..00000000 --- a/Source/BPBIOS/ibmv-dx.z80 +++ /dev/null @@ -1,302 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::***************************** -; IBMOVE - Inter-Bank Move Routines ***** Hardware-Specific ***** -; D-X Designs Pty Ltd P112 ***************************** -; -; 1.0a- 17 Aug 01 - Cleaned up for GPL Release. HFB -; 1.0 - 10 Jun 96 - Initial Release for P112 from YASBEC. HFB -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - CSEG - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Move Data - Possibly between banks. This resembles CP/M 3, but -; usage of the HL and DE registers is reversed. -; Enter: HL = Source Address -; DE = Destination Address -; BC = Number of bytes to move -; Exit : None -; Uses : AF,BC,DE,HL -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -MOVE: LD (ICNT),BC ; Save length of move - LD BC,(SRCBNK) ; Get Source (C) and Dest (B) Banks - RL H ; Move MSB of Source Addr to Carry - LD A,C ; .get Source Bank - JR NC,MOVB0 ; ..jump if Source < 8000H (Not Common Bank) - LD A,(TPABNK) ; Else Set to TPA Bank for Common Access -MOVB0: ADC A,0 ; ..add Carry to Bank # - RRA ; ...shift Bank # in position for Z-180 DMA - RR H ; .move Carry to Address Bit 7 - LD (ISRC+2),A ; Save Source Bank physical byte - LD (ISRC),HL ; ..and Save Source Address - RL D ; Move MSB of Dest Addr to Carry - LD A,B ; .Get Destination Bank - JR NC,MOVB1 ; ..jump if Source < 8000H (Not Common Bank) - LD A,(TPABNK) ; Else Set to TPA Bank for Common Access -MOVB1: ADC A,0 ; ..add Carry to Bank # - RRA ; ...shift into position for Z-180 DMA - RR D ; .move Carry to Address Bit 7 - LD (IDST+2),A ; Save Destination Bank byte - LD (IDST),DE ; ..and Save Destination Address - - LD HL,ISRC ; Point to DMA Initialization block - CALL DMAMOV ; ..and use the Z-180 DMA - - LD HL,(TPABNK) ; Get TPA Bank # - LD H,L ; .to both H and L - LD (SRCBNK),HL ; ..set Source & Destination Bank # to TPA - RET - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Routine to Switch to Local Stack for Banked Operations -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - CSEG - -BIOSTK: DEFB 0 ; NOP if not currently in bank, - ; ..RET if we are - LD (USP-7),HL ; Save entry HL - POP HL ; Retrieve caller's return address from stack - LD (USP-5),HL ; ..and set in our stack for local return - DI ; No interrupts while we play with the stack - LD (USP),SP ; Save User's Stack Pointer - LD SP,USP-1 ; ..and point locally, saving 1 byte for Bank - PUSH AF ; Save entry A and Flags - IN0 A,(BBR) ; Get current bank address - LD (USP-1),A ; ..and save for exitting - LD A,0C9H ; Disable other calls here - LD (BIOSTK),A ; ..by poking a RETurn at entry - POP AF ; Restore entry AF - LD HL,USRSTK ; Set banked return address - PUSH HL ; ..at USP-2 & 3 - LD SP,USP-7 ; Point stack pointer to do local return - POP HL ; .restoring entry HL - EI ; ..enabling interrupts - RET ; And return to caller - -; Restore User Stack and Bank Routine - -USRSTK: PUSH AF - LD A,(USP-1) ; Get bank control byte from entry - OUT0 (BBR),A ; ..and make it current - XOR A - LD (BIOSTK),A ; Patch NOP back in at start of code - POP AF - LD SP,(USP) ; Restore user stack - RET ; And return to caller - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Restore Bank and Stack Ptr to Entry and Jump to (HL) -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -FRCLR: PUSH AF ; Save any entry in AF - LD A,(USP-1) ; Get bank control byte - OUT0 (BBR),A ; ..and make current - XOR A - LD (BIOSTK),A ; Patch NOP to enable stack switcher - POP AF - LD SP,(USP) ; Restore User Stack - JP (HL) ; ..and jump to vector - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Abort a Process (possibly in Alternate Bank) and Warm Boot -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -ABORT: LD SP,USP ; Insure stack is in Common Memory - LD A,(TPABNK) - CALL SELBNK ; Insure TPA in Context - XOR A - LD (BIOSTK),A ; Remove patch - RST 0 ; ..And Warm Boot - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Return Current Memory Bank in Context -; Entry: none -; Exit : A = Current Memory Bank -; Uses : AF -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -RETMEM: IN0 A,(BBR) ; Read Bank Base Register - RRA ; Shift - RRA ; .to right - RRA ; ..to give Bank # - AND 1FH ; Mask off junk - RET ; ..and return it to caller - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Set Bank into context. Save all Registers. -; A = Bank -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -SELMEM: LD (USRBNK),A ; Update user bank - ;..fall thru to set specified bank.. -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; SELBNK - Switch Memory Bank to Bank in A and show as current. -; Must preserve all Registers including Flags. -; All Bank Switching MUST be done by this routine -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -SELBNK: PUSH AF ; Save regs -SELBN0: LD (CURBNK),A ; Save as current bank # - ADD A,A ; Shift into position for Z-180 DMA regs - ADD A,A - ADD A,A - OUT0 (BBR),A ; ..and Set the bank offset - POP AF ; restore regs - RET - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Set Bank for DMA Xfer. Preserve All Registers -; A = Bank Number -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -SETBNK: LD (DMABNK),A - RET - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Set Banks for Inter-Bank Xfer. Save all Registers. -; B = Destination Bank, C = Source Bank -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -XMOVE: LD (SRCBNK),BC - RET - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Select System Bank -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -GOSYSB: PUSH AF - LD A,(SYSBNK) ; Get system bank - JR SELBN0 ; ..and set - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Set Bank for FRJP and FRCALL (Reg A) -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -STFARC: LD (JPBNK),A - RET - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Jump to (HL) in Alternate Bank -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -FRJP: CALL BIOSTK ; Insure we are in a common stack - PUSH AF - LD A,(JPBNK) - CALL SELBNK ; Select the destination bank - POP AF - JP (HL) ; ..and go - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Load A,(HL) from Alternate Bank (in Reg C) -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -FRGETB: IN0 A,(BBR) ; Get current bank control byte - PUSH BC ; Save regs - LD B,A ; ..and entry bank - LD A,C ; Get source bank - ADD A,A ; Shift into position for Z-180 DMA regs - ADD A,A - ADD A,A - DI ; .no Ints here - OUT0 (BBR),A ; ..and Set the bank offset - LD C,(HL) ; Get the byte - LD A,B ; .entry bank - OUT0 (BBR),A ; ..and restore entry bank - EI - LD A,C ; Get the byte - POP BC ; ..and restore regs - RET - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Load DE,(HL) from Alternate Bank -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -FRGETW: PUSH BC ; Save regs - LD B,A ; ..and entry bank - IN0 A,(BBR) ; Get current Bank Byte - LD (ASAVE),A ; ..saving locally - LD A,C ; Get source bank - ADD A,A ; Shift into position for Z-180 DMA regs - ADD A,A - ADD A,A - DI ; .no ints allowed here - OUT0 (BBR),A ; ..and Set the bank offset - LD E,(HL) ; Get Low byte - INC HL - LD D,(HL) ; ..and High byte - DEC HL ; Retain addr pointer - JR GPEX ; ..and exit - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Load (HL),A to Alternate Bank (in Reg C) -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -FRPUTB: PUSH BC ; Save all regs - LD B,A ; Store byte temporarily - IN0 A,(BBR) ; Get current bank byte - LD (ASAVE),A ; ..saving in Common Memory - LD A,C ; Get destination bank - ADD A,A ; Shift into position for Z-180 DMA regs - ADD A,A - ADD A,A - DI ; .allowing no interrupts - OUT0 (BBR),A ; ..and Set the bank offset - LD (HL),B ; ..and stuff the byte -GPEX: LD A,(ASAVE) ; Retrieve Entry Bank byte - OUT0 (BBR),A ; ..and restore to active - EI ; Interrupts Ok now - LD A,B ; Restore byte - POP BC ; ..and rest of regs - RET - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Load (HL),DE to Alternate Bank -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -FRPUTW: PUSH BC ; Save regs - LD B,A ; ..and entry bank - IN0 A,(BBR) ; Get current Bank Byte - LD (ASAVE),A ; ..saving locally - LD A,C ; Get source bank - ADD A,A ; Shift into position for Z-180 DMA regs - ADD A,A - ADD A,A - DI ; .no Ints allowed - OUT0 (BBR),A ; ..and Set the bank offset - LD (HL),E ; Save Low byte - INC HL - LD (HL),D ; ..and High byte - DEC HL ; Retain addr pointer - JR GPEX ; ..and exit - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - DSEG - -JPBNK: DEFS 1 ; Bank # for Far Jump or Call -USRBNK: DEFS 1 ; User's selected bank # -CURBNK: DEFS 1 ; Current bank # -SRCBNK: DEFS 1 ; Move Source Bank # -DSTBNK: DEFS 1 ; Move Destination Bank # -DMABNK: DEFS 1 ; Target bank # for disk xfers - DEFS 64 ; 32 level stack -USP: DEFS 2 ; User stack pointer -ASAVE: DEFS 1 ; Temp storage for User's A-Register - -; Z-180 DMA transfer block for inter-bank moves - -ISRC: DEFS 2 ; Source Segment address - DEFS 1 ; ..Source Bank in physical RAM -IDST: DEFS 2 ; Destination Segment address - DEFS 1 ; ..Destination Bank in physical RAM -ICNT: DEFS 2 ; Number of bytes to move - -; The P112 does not need this buffer, but other versions might - - IF INROM OR [NOT IBMOVS] - DSEG -IBMVBF: DEFS 256 ; Inter-bank move buffer - ENDIF - -;======================= End of IBMV-DX =========================== - \ No newline at end of file diff --git a/Source/BPBIOS/ibmv-ww.z80 b/Source/BPBIOS/ibmv-ww.z80 index 540cf8a8..2c984758 100644 --- a/Source/BPBIOS/ibmv-ww.z80 +++ b/Source/BPBIOS/ibmv-ww.z80 @@ -1,6 +1,6 @@ ;:::::::::::::::::::::::::::::::::::::::***************************** ; IBMOVE - Inter-Bank Move Routines ***** Hardware-Specific ***** -; for RomWBW HBIOS ***************************** +; using RomWBW HBIOS ***************************** ; ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -16,8 +16,7 @@ ; Uses : AF,BC,DE,HL ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -MOVE: - JP HBX_COPY +MOVE EQU HB_MOVE ; Defer to HBIOS (see HBIOS.Z80) ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; Routine to Switch to Local Stack for Banked Operations @@ -34,7 +33,8 @@ BIOSTK: DEFB 0 ; NOP if not currently in bank, LD (USP),SP ; Save User's Stack Pointer LD SP,USP-1 ; ..and point locally, saving 1 byte for Bank PUSH AF ; Save entry A and Flags - LD A,(HB_CURBNK) ; Get current bank + ;LD A,(HB_CURBNK) ; Get current bank + LD A,(CURBNK) ; Get current bank LD (USP-1),A ; ..and save for exitting LD A,0C9H ; Disable other calls here LD (BIOSTK),A ; ..by poking a RETurn at entry @@ -50,7 +50,7 @@ BIOSTK: DEFB 0 ; NOP if not currently in bank, USRSTK: PUSH AF LD A,(USP-1) ; Get bank control byte from entry - CALL HBX_BNKSEL + CALL SELBNK XOR A LD (BIOSTK),A ; Patch NOP back in at start of code POP AF @@ -63,7 +63,7 @@ USRSTK: PUSH AF FRCLR: PUSH AF ; Save any entry in AF LD A,(USP-1) ; Get bank control byte - CALL HBX_BNKSEL + CALL SELBNK XOR A LD (BIOSTK),A ; Patch NOP to enable stack switcher POP AF @@ -88,9 +88,10 @@ ABORT: LD SP,USP ; Insure stack is in Common Memory ; Uses : AF ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -RETMEM: LD A,(HB_CURBNK) +RETMEM: LD A,(CURBNK) RET + ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; Set Bank into context. Save all Registers. ; A = Bank @@ -99,6 +100,16 @@ RETMEM: LD A,(HB_CURBNK) SELMEM: LD (USRBNK),A ; Update user bank ;..fall thru to set specified bank.. + IF HB_DEBUG AND FALSE + + CALL PRTSTRD + DEFB '[SELMEM: $' + CALL PRTHEXBYTE + CALL PRTSTRD + DEFB ']$' + + ENDIF + ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; SELBNK - Switch Memory Bank to Bank in A and show as current. ; Must preserve all Registers including Flags. @@ -106,7 +117,9 @@ SELMEM: LD (USRBNK),A ; Update user bank ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: SELBNK: PUSH AF ; Save regs -SELBN0: CALL HBX_BNKSEL +SELBN0: LD (CURBNK),A ; Save as current bank # +BNKADJ: ADD A,90H ; Adjust for HBIOS bank ids + CALL HBX_BNKSEL POP AF ; restore regs RET @@ -123,8 +136,7 @@ SETBNK: LD (DMABNK),A ; B = Destination Bank, C = Source Bank ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -XMOVE: - JP HBX_XCOPY +XMOVE: EQU HB_XMOVE ; Defer to HBIOS (see HBIOS.Z80) ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; Select System Bank @@ -157,36 +169,75 @@ FRJP: CALL BIOSTK ; Insure we are in a common stack ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: FRGETB: - JP HBX_FRGETB + PUSH BC ; Save BC + PUSH DE ; Save DE + LD B,0FAH ; HBIOS Peek function + LD D,C ; Bank in D + CALL HBX_INVOKE ; Do it + LD A,E ; Value to A + POP DE ; Restore DE + POP BC ; Restore BC + RET ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; Load DE,(HL) from Alternate Bank ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: FRGETW: - JP HBX_FRGETW + PUSH AF ; Save AF + CALL FRGETB ; Get LSB + LD E,A ; ... into E + INC HL ; Next address + CALL FRGETB ; Get MSB + LD D,A ; ... into D + DEC HL ; Restore HL + POP AF ; Restore AF + RET ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; Load (HL),A to Alternate Bank (in Reg C) ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: FRPUTB: - JP HBX_FRPUTB + PUSH AF ; Save AF + PUSH BC ; Save BC + PUSH DE ; Save DE + LD B,0FBH ; HBIOS Poke function + LD D,C ; Bank in D + LD E,A ; Value in E + CALL HBX_INVOKE ; Do it + POP DE ; Restore DE + POP BC ; Restore BC + POP AF ; Restore AF + RET ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; Load (HL),DE to Alternate Bank ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: FRPUTW: - JP HBX_FRPUTW + PUSH AF ; Save AF + LD A,E ; LSB to A + CALL FRPUTB ; Put LSB + LD A,D ; MSB to A + INC HL ; Next address + CALL FRPUTB ; Put MSB + DEC HL ; Restore HL + POP AF ; Restore AF + RET ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: DSEG JPBNK: DEFS 1 ; Bank # for Far Jump or Call USRBNK: DEFS 1 ; User's selected bank # +CURBNK: DEFS 1 ; Current bank # +SRCBNK: EQU HB_SRCBNK ; Move Source Bank # +DSTBNK: EQU HB_DSTBNK ; Move Destination Bank # DMABNK: DEFS 1 ; Target bank # for disk xfers DEFS 64 ; 32 level stack USP: DEFS 2 ; User stack pointer -;======================= End of IBMV-DX =========================== + +;======================= End of IBMV-WW =========================== + \ No newline at end of file diff --git a/Source/BPBIOS/icfg-dx.z80 b/Source/BPBIOS/icfg-dx.z80 deleted file mode 100644 index fcef45eb..00000000 --- a/Source/BPBIOS/icfg-dx.z80 +++ /dev/null @@ -1,187 +0,0 @@ -;::::::::::::::::::::::::::::::::::::::::::******************************** -; I/O Configuration Area ****** Hardware Specific ****** -; - D-X Designs Pty Ltd P112 - ******************************** -; -; 1.2 - 22 Aug 01 - Cleaned up for GPL release. HFB -; 1.1 - 18 Apr 97 - Modified to Add GIDE Definitions. HFB -; 1.0 - 27 Jan 97 - Initial Release for P112. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -;*** * * * * * * * * * * W A R N I N G ! ! ! * * * * * * * * * * * * *** -;*** Do NOT alter any of the ordering or sizing of the following data *** -;*** locations or utilities will probably NOT function correctly! *** -;*** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *** - - CSEG -; Form Option Byte 1 - -OPT1 DEFL [BANKED AND 1] ; Bit 0 = unbanked/banked -OPT1 DEFL OPT1+[INROM AND 2] ; Bit 1 = Bank in RAM/Bank in ROM -OPT1 DEFL OPT1+[AUTOSL AND 4] ; Bit 2 = DPB Fixed/DPB Assignable -OPT1 DEFL OPT1+[BANKED AND ZSDOS2 AND 8] ; Bit 3 = ALV/CSV in Banked RAM -; Bit 7 is "Lock" flag for system loads -; If set to 1, LDSYS will not load a -; new system over the running one. - - DEFB 'B/P-DX' ; Six-char string for Text ID Matching - -CONFIG: -IOBYT: DEFB 10010100B ; LST:=PIO, AUX:=COM2, CON:=COM1 -SYSDRV: DEFB 0 ; System drive (a=0, b=1...) -OPTF1: DEFB OPT1 ; Option flags - -UABNK: DEFB BNKU ; Beginning of User Bank(s) if Banked System - ; (Ending Bank denoted by SYSBNK-1) -TPABNK: DEFB BNK0 ; TPA Bank Number if Banked System -SYSBNK: DEFB BNK2 ; Beginning of System Bank(s) if Banked System - ; (Ending Bank denoted by RAMBNK-1) -RAMBNK: DEFB BNK3 ; Base Bank Number for Ram Disk -MAXBNK: DEFB BNKM ; Highest permissible Bank Number -HICOMM: DEFB 80H ; Page address of start of high Common Memory -DPBSZ: DEFB DPBSIZ ; Size of DPB -NUMDPB: - IF BANKED - DEFB 0 ; Number of DPBs in Common RAM - DEFB NRDPB ; Number of Banked DPBs - ELSE - DEFB NRDPB ; Number of DPBs in Common RAM - DEFB 0 ; Number of Banked DPBs - ENDIF -DPBADR: - IF BANKED - DEFW 0 ; Pointer to dirst Common RAM XDPB - DEFW DPB ; Pointer to first XDPB in Alternate Bank - ELSE - DEFW DPB ; Pointer to first Common RAM XDPB - DEFW 0 ; Pointer to first XDPB in Alternate Bank - ENDIF - -AUTOCMD: DEFB 8,'STARTUP ',0 ; Startup command for Z3 - -ENVADR: DEFW Z3ENV ; Pointer to the Environment Descriptor - -;------------ Banked User Area Control Information --------------- -; An existing User Area cannot exist in Bank 0 by decree. The User Area -; can therefore be used as a flag to determine whether such an area exists. -; The Bank Number is set in DEF-xx.LIB. To keep Page 0 equivalent free in -; the user bank, we offset values to 80H (it's just a good number). The -; top of each User Bank is 7FFFH as with all of the switched banks in -; a B/P Bios System. Banked applications should chain themselves together -; sequentially so that the end can be determined and space managed. - -UADAT: DEFB BNKU ; Flag for Banked User Area (0 if None) - DEFW 0080H ; Pointer to Start of User area in Bank - -;---------------- CPU Configuration Information ------------------ - -SPEED: DEFB MHZ ; Set to processor speed value in Configuration -WAITS: DEFB 00010010B ; Number of additional Memory & IO Wait states -; ||||++++--- # of IO Wait States (bits 3-0, only 1 & 0 used) -; ++++------- # of Memory Wait States (bits 7-4, only 5 & 4 used) - -RELOD0: DEFW 2560*MHZ ; 16-bit constant for counter/timer refresh - ; based on 50 mS Interrupts to Down Timer. - ; Use 2560 for 12.288/18.432MHz etc. Crystals, - ; 2500 for 16.000MHz Crystals. - -;-------- Physical Floppy Disk Configuration Information --------- -; The Physical Drive table consists of 5 bytes for each of 4 Floppy Drives -; thereby providing all necessary data to all types of controllers. -; -; 1 - Drive Characteristics Bits. The Bits have the following meanings: -; D D D D D D D D -; 7 6 5 4 3 2 1 0 -; | | | | | +-+-+---- Disk Size 000=Fixed; 001=8"; 010=5.25"; 011=3.5" (*) -; | | | | +---------- Single-Sided (0); Double-Sided (1) -; | | | +------------ (Reserved for Double-Step(1) in XDPH) -; | | +-------------- Drive Motor Control (1); Motor Always On (0) -; | +---------------- Max Speed is 5.25" (0); 8" & Hard Disk & Hi-Dens (1) -; +------------------ (Reserved for Single(1)/Double(0) Density in XDPH) -; (*) - 3.5" and 5.25" drives are treated the same for many formats with -; the drive bits being reduced to 010B in the BIOS code. -; 2 - Drive Step Rate (1 to 16 in increments of 1) in milliseconds -; 3 - Head Load Time (2 to 254 in increments of 2) in milliseconds -; 4 - Head Unload Time (16 to 240 in increments of 16) in milliseconds -; 5 - Number of Physical Tracks on Drive - -FDCSPEC: DEFB 6BH,3, 4,240,80 ; #1 (3"DSHD,3 mS Step,4mS HLT,255 mS HUT,80t) - DEFB 2AH,6,24,240,40 ; #2 (5"DS,6 mS Step,24mS HLT,255 mS HUT,40t) - DEFB 2AH,4,24,240,80 ; #3 (5"DS,4 mS Step,24mS HLT,255 mS HUT,80t) - DEFB 6AH,3, 4,240,80 ; #4 (5"DS,3 mS Step, 4mS HLT,255 mS HUT,80t) - -MONTIM: DEFB 100 ; Motor On Time (1 to 255) in tenths-of-seconds -SPINUP: DEFB 8 ; Spinup delay (1 to 255) in tenths-of-seconds -MXRTRY: DEFB 4 ; Maximum Number of retries on Floppy Opns - -IVCT: DEFW INTTBL ; Pointer to interrupt vectors - -;-------- Physical Hard Drive Configuration Information ---------- -; Hard Disk data begins w/Controller Type, followed by data for 3 drives. -; The first byte for each drive consists of a byte containing bit codes -; for SCSI Device, Logical Unit, and a bit indicating whether or not the -; drive is physically connected to the system. The configuration should -; match that contained in DPHHD-xx.LIB for Hard Drive partitions. -; Bit 7 6 5 4 3 2 1 0 -; | | | | | | | | -; | | | | | +-+-+-- Physical Device Number (0..6, 7 = Host) -; | | | | +-------- (reserved) -; | | | +---------- 1 = Drive Active, 0 = No Drive -; +-+-+------------ Logical Unit Number (usually 0 or 1) - -;..... -; The Controller Type Byte contains information needed to dictate the specific -; bytes to be used to communicate to a SASI/SCSI-connected Hard Drive. -; Additional bytes will be defined as needed, so please coordinate any -; extensions with the Authors to insure the generality of tools. - -CNTRLR: DEFB 80H ; Controller Types recognized are: - ; 0- Owl 5- Conner SCSI - ; 1- Adaptec ACB-4000A 6- Quantum SCSI - ; 2- Xebec 1410A/Shugart 1610-3 7- Maxtor SCSI - ; 3- Seagate SCSI 8- Syquest SCSI - ; 4- Shugart 1610-4 Minimal SCSI 80H- GIDE (IDE/ATA) - -; First drive (Parameters for Toshiba MK-1544 IDE) - -BITS DEFL 00000000B ; SCSI - Physical Device 0, Logical Unit 0 - ; IDE - Drive 0 = Master -BITS DEFL BITS+[UNIT_0 AND 10H] ; If active, set Bit 4 - -HDRV0: DEFB BITS ; Set Device, Unit, and Active bits - DEFW 581 ; Number of Cylinders - DEFB 2 ; Number of Heads - DEFW 36 ; SCSI - Cylinder # to start reduced write - ; IDE - Number of Sectors Per Track - DEFW 0000 ; Cylinder # to start precompensation - DEFB 0 ; Step Rate (0=3ms, 1=28us, 2=12us) - -; Second drive (Parameters for Seagate ST-125N SCSI) - -BITS DEFL 00000001B ; SCSI - Physical Device 1, Logical Unit 0 - ; IDE - Drive 1 = Slave -BITS DEFL BITS+[UNIT_1 AND 10H] ; If active, set Bit 4 - -HDRV1: DEFB BITS ; Set Device, Unit, and Active bits - DEFW 615 ; Syquest ST-125N - DEFB 4 - DEFW 0000 - DEFW 0000 - DEFB 0 - -; Third drive (Parameters for Miniscribe 8425 SCSI) - -BITS DEFL 00000010B ; Physical Device 2, Logical Unit 0 - ; IDE - (undefined) -BITS DEFL BITS+[UNIT_2 AND 10H] ; If active, set Bit 4 - - DEFB BITS ; Set Device, Unit, and Active bits - DEFW 615 - DEFB 4 - DEFW 615 - DEFW 300 - DEFB 2 - - DEFB 0,0,0,0,0 ; (Reserved) - -;======= End of Fixed Config ======== Device Config follows ======== - \ No newline at end of file diff --git a/Source/BPBIOS/icfg-ww.z80 b/Source/BPBIOS/icfg-ww.z80 index 4b17951a..566edc54 100644 --- a/Source/BPBIOS/icfg-ww.z80 +++ b/Source/BPBIOS/icfg-ww.z80 @@ -1,7 +1,9 @@ ;::::::::::::::::::::::::::::::::::::::::::******************************** ; I/O Configuration Area ****** Hardware Specific ****** -; - D-X Designs Pty Ltd P112 - ******************************** +; - Retro-Brew Computers w/ HBIOS- ******************************** ; +; 1.4 - 29 Nov 16 - Updated for HBIOS version 2.8 WW +; 1.3 - 17 Jan 14 - N8VEM Initial Test release WW+LN ; 1.2 - 22 Aug 01 - Cleaned up for GPL release. HFB ; 1.1 - 18 Apr 97 - Modified to Add GIDE Definitions. HFB ; 1.0 - 27 Jan 97 - Initial Release for P112. HFB @@ -26,8 +28,9 @@ OPT1 DEFL OPT1+[BANKED AND ZSDOS2 AND 8] ; Bit 3 = ALV/CSV in Banked RAM DEFB 'B/P-WW' ; Six-char string for Text ID Matching CONFIG: -IOBYT: DEFB 10010100B ; LST:=PIO, AUX:=COM2, CON:=COM1 -SYSDRV: DEFB 0 ; System drive (a=0, b=1...) +;IOBYT: DEFB 10010100B ; LST:=PIO, AUX:=COM2, CON:=COM1 +IOBYT: DEFB 11111100B ; LST:=Null, AUX:=Null, CON:=COM1 +SYSDRV: DEFB 2 ; System drive (a=0, b=1...) OPTF1: DEFB OPT1 ; Option flags UABNK: DEFB BNKU ; Beginning of User Bank(s) if Banked System @@ -57,6 +60,7 @@ DPBADR: ENDIF AUTOCMD: AUTOCL ; Startup command for Z3 +;AUTOCMD: DEFB 8,'startupf',0 ; Startup command for Z3 ENVADR: DEFW Z3ENV ; Pointer to the Environment Descriptor @@ -104,51 +108,79 @@ RELOD0: DEFW 2560*MHZ ; 16-bit constant for counter/timer refresh ; 4 - Head Unload Time (16 to 240 in increments of 16) in milliseconds ; 5 - Number of Physical Tracks on Drive -FDCSPEC: DEFB 6BH,3, 4,240,80 ; #1 (3"DSHD,3 mS Step,4mS HLT,255 mS HUT,80t) - DEFB 2AH,6,24,240,40 ; #2 (5"DS,6 mS Step,24mS HLT,255 mS HUT,40t) - DEFB 2AH,4,24,240,80 ; #3 (5"DS,4 mS Step,24mS HLT,255 mS HUT,80t) - DEFB 6AH,3, 4,240,80 ; #4 (5"DS,3 mS Step, 4mS HLT,255 mS HUT,80t) +FDCSPEC: DEFB 6BH,4,24,240,80 ; #1 (3"DSHD,4 mS Step,24mS HLT,240 mS HUT,80t) + DEFB 2AH,4,24,240,40 ; #2 (5"DS,4 mS Step,24mS HLT,240 mS HUT,40t) + DEFB 2AH,4,24,240,80 ; #3 (5"DS,4 mS Step,24mS HLT,240 mS HUT,80t) + DEFB 6AH,4,24,240,80 ; #4 (3"DS,4 mS Step, 24mS HLT,240 mS HUT,80t) MONTIM: DEFB 100 ; Motor On Time (1 to 255) in tenths-of-seconds SPINUP: DEFB 8 ; Spinup delay (1 to 255) in tenths-of-seconds MXRTRY: DEFB 4 ; Maximum Number of retries on Floppy Opns +;IVCT: DEFW INTTBL ; Pointer to interrupt vectors - WW IVCT: DEFW 0 ; Pointer to interrupt vectors ;-------- Physical Hard Drive Configuration Information ---------- ; Hard Disk data begins w/Controller Type, followed by data for 3 drives. -; The first byte for each drive consists of a byte containing bit codes -; for SCSI Device, Logical Unit, and a bit indicating whether or not the -; drive is physically connected to the system. The configuration should -; match that contained in DPHHD-xx.LIB for Hard Drive partitions. -; Bit 7 6 5 4 3 2 1 0 +; BPCNFG only supports 3 devices. Originally BPBIOS systems used a SCSI +; interface that could support up to 7 physical drives. Thus the hard disk +; data begins w/ controller type (read SCSI type). Later the GIDE adapter +; became available. It supported only two drives. IDE drives usually have +; much larger capacity and so more drives were never needed with the IDE. +; In the extended DPH the drive associated with each logical CPM drive is +; specified. In ver 2.8 of HBIOS, disk devices are discovered dynamically, +; in the order RAM, ROM, IDE then SD and assigned at that time a +; device number. So the ROM drive is usually device 1, the IDE or HDSK0 is +; device 2 and the SD or HDSK1 is device 3. In this situation, the hard +; disk data below seems redundant. To maintain compatibility it will be +; retained but mostly not used. Controller type will be set GIDE and the +; rest of the data will be set to describe a generic 8 mB drive. The data +; for each drive consists of a byte containing bit codes for Device and a +; bit indicating whether or not the drive is physically connected to the +; system. The configuration should match that contained in DPHHD-xx.LIB +; for Hard Drive partitions, i.e. the unit specified in DPHHD-NH will be +; used in the hard disk driver. The byte for Hard Drive partitions +; contains the following bit fields +;. +; Bit 7 6 5 4 3 2 1 0 ; | | | | | | | | ; | | | | | +-+-+-- Physical Device Number (0..6, 7 = Host) ; | | | | +-------- (reserved) ; | | | +---------- 1 = Drive Active, 0 = No Drive -; +-+-+------------ Logical Unit Number (usually 0 or 1) - +; +-+-+------------ Logical Unit Number (usually 0 or 1 +; i.e. master or slave for IDE) ;..... ; The Controller Type Byte contains information needed to dictate the specific -; bytes to be used to communicate to a SASI/SCSI-connected Hard Drive. +; bytes to be used to communicate to a BPBIOS-connected Hard Drive. ; Additional bytes will be defined as needed, so please coordinate any -; extensions with the Authors to insure the generality of tools. +; extensions with the Authors to insure the generality of tools. Note that +; this byte is not used since HBIOS presents a unified interface to BPBIOS. +; Also note that BPCNFG only knows about the first ten controller types, +; Second IDE and HBIOS are "Unknown" devices to BPCNFG but it will accept +; these types if input. CNTRLR: DEFB 80H ; Controller Types recognized are: - ; 0- Owl 5- Conner SCSI - ; 1- Adaptec ACB-4000A 6- Quantum SCSI - ; 2- Xebec 1410A/Shugart 1610-3 7- Maxtor SCSI - ; 3- Seagate SCSI 8- Syquest SCSI - ; 4- Shugart 1610-4 Minimal SCSI 80H- GIDE (IDE/ATA) - + ; 0 = Owl + ; 1 = Adaptec ACB4000a + ; 2 = Xebec 1410A, Shugart 1610-3 + ; 3 = Seagate SCSI + ; 4 = Shugart 1610-4 (Minimal SCSI) + ; 5 = Conner SCSI + ; 6 = Quantum SCSI + ; 7 = Maxtor SCSI + ; 8 = Syquest SCSI + ; 80H = First IDE + ; 81H = Second IDE + ; 90H = HBIOS Disk IO ; First drive (Generic HBIOS drive configuration) -BITS DEFL 00000000B ; First HBIOS Hard Disk Drive +BITS DEFL HB_HDDEV0 ; First HBIOS Hard Disk Drive BITS DEFL BITS+[UNIT_0 AND 10H] ; If active, set Bit 4 -HDRV0: DEFB BITS ; Set Device, Unit, and Active bits - DEFW 520 ; Number of Cylinders +HDRV0: ; used to convert logical to physical sector addressing + DEFB BITS ; Set Device, Unit, and Active bits + DEFW 520 ; # Cylinders - nuf for 8 8mB partitions DEFB 16 ; Number of Heads DEFW 16 ; IDE - Number of Sectors Per Track DEFW 0000 ; Cylinder # to start precompensation @@ -156,7 +188,7 @@ HDRV0: DEFB BITS ; Set Device, Unit, and Active bits ; Second drive (Generic HBIOS drive configuration) -BITS DEFL 00000001B ; Second HBIOS Hard Disk Drive +BITS DEFL HB_HDDEV1 ; Second HBIOS Hard Disk Drive BITS DEFL BITS+[UNIT_1 AND 10H] ; If active, set Bit 4 @@ -169,7 +201,7 @@ HDRV1: DEFB BITS ; Set Device, Unit, and Active bits ; Third drive (Generic HBIOS drive configuration) -BITS DEFL 00000010B ; Third HBIOS Hard Disk Drive +BITS DEFL HB_HDDEV2 ; Third HBIOS Hard Disk Drive BITS DEFL BITS+[UNIT_2 AND 10H] ; If active, set Bit 4 @@ -183,4 +215,4 @@ HDRV2: DEFB BITS ; Set Device, Unit, and Active bits DEFB 0,0,0,0,0 ; (Reserved) ;======= End of Fixed Config ======== Device Config follows ======== - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/iio-dx.z80 b/Source/BPBIOS/iio-dx.z80 deleted file mode 100644 index b8d0f4dc..00000000 --- a/Source/BPBIOS/iio-dx.z80 +++ /dev/null @@ -1,1296 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::::************************* -; Byte I/O Routines *** Hardware Specific *** -; - D-X Designs Pty Ltd P112 - ************************* -; -; Several serial and parallel options exist on the P112, with two serial -; ports available at RS-232 signalling levels. The primary port defined here -; as COM1 uses SCC Channel A of the Z80182. A 16550-compatible serial port -; on the SMC FDC37C665 is used as COM2. Three other serial ports (the two -; ACSI ports in the Z180 core, and SCC Channel B) are available at TTL -; voltage levels on a single header and may be defined as COM3-5 if the pins -; from the Z182 are not otherwise used. -; This code supports the additional serial channels if the MORDEV equate -; is set to YES. If any of the three additional serial ports are defined -; (ESCC_B, ASCI_0, ASCI_1), then the System Configuration Register is set to -; Zero activating the additional signals in the conditions specified herein -; as activated by options in DEF-DX.LIB. -; A full Parallel port on the SMC FDC37C655 (in Normal Centronics mode) is -; used as the primary List (Printer) Device. -; -; NOTE: At the present time, it appears that port 0D9H (ENH182) cannot be set -; so ESCC operation at 24 MHz will occur at the full clock rate instead -; of being divided by Two as specified in Zilog documentation. Code -; managing ENH182 is commented out with ";;--" markers (HFB). -; -; 1.2 - 28 Aug 01 - Final scrub for GPL release. HFB -; 1.1a- 11 May 97 - Cleaned code, fixed added port accesses. HFB -; 1.1 - 25 Jan 97 - Revised ESCC Baud rate calcs, added COM3-5. HFB -; 1.0 - 19 Jun 96 - Initial Release for the P112 from YASBEC. HFB -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Place constants for Expansions here - - CSEG -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Byte Device Control Tables -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -DEVCFG: - -; The Clock Rate for the SCC channels on the Z80182 is based on a divider -; constant loaded in extended registers, the Processor Crystal frequency, -; and the setting of the divider in the SCC Register (1FH). -; -; NOTE: Divisor values are computed based on a compromise between the Crystal -; rates considered "standard" (6.144, 9.216, 12.288 MHz, etc) and the -; 16.000 MHz initially placed on the P112. Higher data rates (38.4 kbps -; and higher) may be out of tolerance, particularly at low CPU speeds. -; -; Clock rates for the serial port on the SMC 37C655 are based on a software -; programmable divider from the 24 MHz crystal driving the chip. - -COM1: DEFB 'COM1' ; 4-Char ID - DEFB 11101011B ; Baud Rate -; ||||++++--- Baud Rate setting (19.2 kbps) -; ++++------- Maximum Baud Rate (115.2 kbps) -; Rates are as: -; 0000 = None 0001 = 134.5 0011 = 50 0011 = 75 -; 0100 = 150 0101 = 300 0110 = 600 0111 = 1200 -; 1000 = 2400 1001 = 4800 1010 = 9600 1011 = 19200 -; 1100 = 38400 1101 = 76800 1110 = 115200 1111 = Fixed - - DEFB 11100001B ; Config Byte (In,Out,CTS/RTS control,1 Stop) -; |||||||+---------- Stop Bits 1 (1), 2 (0) -; ||||||+----------- Parity Enable (1), Disable (0) -; |||||+------------ Parity Even (1), Odd (0) -; ||||+------------- Data Bits 8 (0), 7 (1) -; |||+-------------- Xon-Xoff Handshake -; ||+--------------- CTS/RTS Handshake -; |+---------------- Input Device No (0), Yes (1) -; +----------------- Output Device No (0), Yes (1) - - DEFB 0FFH ; Input Data Mask - DEFB 0FFH ; Output Data Mask - - DEFW COM1OT ; COM 1 Byte Output - DEFW COM1OS ; COM 1 Output Status - DEFW COM1IN ; COM 1 Byte Input - DEFW COM1IS ; COM 1 Input Status - -COM2: DEFB 'COM2' ; 4-Char ID - DEFB 11101010B ; Baud Rate (115.2k Max, 9600 Set) - DEFB 11100001B ; Config Byte (In,Out,CTS/RTS control,1 Stop) - DEFB 0FFH ; Input Data Mask - DEFB 0FFH ; Output Data Mask - - DEFW COM2OT ; COM 2 Byte Output - DEFW COM2OS ; COM 2 Output Status - DEFW COM2IN ; COM 2 Byte Input - DEFW COM2IS ; COM 2 Input Status - -PIO1: DEFB 'PIO1' ; 4-Char ID - DEFB 00000000B ; Baud Rate (None) - DEFB 10000000B ; Config Byte (Output Only) - DEFB 0FFH ; Input Data Mask - DEFB 07FH ; Output Data Mask - - DEFW PIO1OT ; PIO Byte Output - DEFW PIO1OS ; PIO Output Status - DEFW PIO1IN ; PIO Byte Input - DEFW PIO1IS ; PIO Input Status - - IF MOVCPM OR [MORDEV AND NOT [ESCC_B OR ASCI_0 OR ASCI_1]] - DEFB 'NULL' ; 4-Char ID - DEFB 00000000B ; Baud Rate (None) - DEFB 11000000B ; Config Byte - DEFB 0FFH ; Input Data Mask - DEFB 0FFH ; Output Data Mask - - DEFW ISFALSE ; Null Output - DEFW ISTRUE ; Null Output Status - DEFW ISFALSE ; Null Input - DEFW ISTRUE ; Null Input Status - ENDIF - - IF MORDEV AND NOT MOVCPM ; Include additional devices -; Add Expansion Char IO here with Device format as above - - IF ESCC_B -COM3: DEFB 'COM3' ; 4-Char ID - DEFB 11101010B ; Baud Rate (115.2k Max, 9600 Set) - DEFB 11100001B ; Config Byte (In,Out,CTS/RTS control,1 Stop) - DEFB 0FFH ; Input Data Mask - DEFB 0FFH ; Output Data Mask - - DEFW COM3OT ; COM 3 Byte Output - DEFW COM3OS ; COM 3 Output Status - DEFW COM3IN ; COM 3 Byte Input - DEFW COM3IS ; COM 3 Input Status - ENDIF - IF ASCI_0 -COM4: DEFB 'COM4' ; 4-Char ID - DEFB 11001010B ; Baud Rate (38.4k Max, 9600 Set) - DEFB 11100001B ; Config Byte (In,Out,CTR/RTS control, 1 Stop) - DEFB 0FFH ; Input Data Mask - DEFB 0FFH ; Output Data Mask - - DEFW COM4OT ; COM 4 Byte Output - DEFW COM4OS ; COM 4 Output Status - DEFW COM4IN ; COM 4 Byte Input - DEFW COM4IS ; COM 4 Input Status - ENDIF - IF ASCI_1 -COM5: DEFB 'COM5' ; 4-Char ID - DEFB 11001010B ; Baud Rate (38.4k Max, 9600 Set) - DEFB 11100001B ; Config Byte (In,Out,CTR/RTS control, 1 Stop) - DEFB 0FFH ; Input Data Mask - DEFB 0FFH ; Output Data Mask - - DEFW COM5OT ; COM 5 Byte Output - DEFW COM5OS ; COM 5 Output Status - DEFW COM5IN ; COM 5 Byte Input - DEFW COM5IS ; COM 5 Input Status - ENDIF - ENDIF ;Mordev & Not Movcpm - - DEFB 0 ; - End-of-Table marker -MAXBDV EQU [$-DEVCFG-1]/[COM2-COM1] ; Number of Character Devices Defined - -DEVTBL: LD HL,DEVCFG ; BYTE device table - RET ; CP/M-3 device init - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; COM1 Drivers -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Uses Z80182 SCC Channel A (Default to Console) -;..... -; COM1 Input Status Test -; Bit 0 of SCC Ch.A Control Port signifies Char Ready - -COM1IS: IN0 A,(SCCACNT) ; Console Input Status - RRA ; Input Ready = Bit0 -> Carry - SBC A,A ; A=00 if Not Ready, FF if Char Ready - RET - -;..... -; COM1 Input Routine -; Remain in Loop until Char ready, then Return Char in A - -COM1IN: CALL COM1IS ; Console input from SCC Ch.A Ready? - JR Z,COM1IN ; ..loop if Not - IN0 A,(SCCAD) ; Else Read SCC Ch.A Data - IF MOVCPM ; (No Swap allowed) - LD C,A ; Store byte temporarily - LD A,(COM1+6) ; .get Input mask - AND C ; ..and apply to byte - ELSE ; (Swapping permitted) -IPAT1: AND $-$ ; Char Mask patched in Config - ENDIF ;Movcpm - RET - -;..... -; COM1 Output Status Test - -COM1OS: - IF XONOFF - LD A,(COM1+5) ; Get this Chan's Config settings - AND 00010000B ; Xon/Xoff in use? - JR Z,COM1O0 ; ..jump if Not - LD A,(COM1WT) ; Else get Current flow status - RLA - LD A,00 ; (prepare for stopped) - JR C,SOSTV ; ..jump to return Not Ready if Stopped -COM1O0: - ENDIF ;Xonoff - IN0 A,(SCCACNT) ; Read SCC Ch.A Control Reg - RRA ; Output Ready = Bit 2 - RRA - RRA ; -> Carry - SBC A,A ; A=00 if Not Ready, FF if Xmt Buffer Empty - RET - -;..... -; COM1 Output Routine (Byte to Send in C) - -COM1OT: CALL COM1OS ; Output to SCC Ch.A Ready? - JR Z,COM1OT ; ..loop if Not - IF MOVCPM ; (No Swap allowed) - LD A,(COM1+7) ; Get output mask - AND C ; .apply to byte - ELSE ; (Swapping permitted) - LD A,C ; Get Char -OPAT1: AND $-$ ; mask as set in Config - ENDIF ; Movcpm - OUT0 (SCCAD),A ; and send - RET - - PAGE -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; COM2 Drivers -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Uses 16550-compatible SMC FDC37C665 Serial Port (defaults to Aux) -;..... -; COM2 Input Status Test - -COM2IS: IN0 A,(_LSR) ; Input Status Reg Byte - RRA ; Rcv Rdy Bit[0] -> Carry - SBC A,A ; A=00 if Not Ready, FF if Char received - RET - -;..... -; COM2 Input Routine - -COM2IN: CALL COM2IS ; Char Ready? - JR Z,COM2IN ; ..loop if Not - IN0 A,(_RBR) ; Else Read Receive Buffer - IF MOVCPM ; (No Swap allowed) - LD C,A ; Save byte - LD A,(COM2+6) ; .get mask - AND C ; ..apply it - ELSE ; (Swapping permitted) -IPAT2: AND $-$ ; Mask as set in Config - ENDIF ;Movcpm - RET - -;..... -; COM2 Output Status Test - -COM2OS: - IF XONOFF - LD A,(COM2+5) ; Get Config Byte - AND 00010000B ; Xon/Xoff Active? - JR Z,COM2O0 ; ..jump if Not - LD A,(COM2WT) ; Get Flags Byte - RLA ; Xoff to Carry - LD A,0 ; (prepare for Xoff active) - JR C,SOSTV ; ..jump if Waiting to Return Not Rdy -COM2O0: ;..else fall thru to Check Real Status.. - ENDIF ;xonoff - IF RTSCTS - LD A,(COM2+5) ; Get this Chan's Config settings - AND 00100000B ; RTS/CTS in use? - JR Z,COM2O1 ; ..jump if Not - IN0 A,(_MMSR) ; Else Get Port 1 Modem Status - BIT 4,A ; Clear-To-Send? - LD A,0 ; (prepare for No) - JR Z,SOSTV ; ..jump if Not -COM2O1: - ENDIF ;Rtscts - IN0 A,(_LSR) ; Read Status Reg -SOSTV: AND 20H ; Mask Bit of interest -RETST: RET Z ; ..return if nothing valid -ISTRUE: OR 0FFH ; Else set flags for Ready - RET - -;..... -; COM2 Output Routine - -COM2OT: CALL COM2OS ; Test if ready - JR Z,COM2OT ; ..loop if not - IF MOVCPM ; (No Swap allowed) - LD A,(COM2+7) ; Get output mask - AND C ; apply - ELSE ; (Swapping permitted) - LD A,C ; Get Output Char -OPAT2: AND $-$ ; mask as set in Config - ENDIF ;Movcpm - OUT0 (_THR),A ; and send char to Xmt Holding Reg - RET - - PAGE -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Parallel I/O Drivers -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Uses "Standard" Parallel Centronics mode of SMC37C655 (output only) -;..... -; Parallel Input Status Test - -PIO1IS: JR ISTRUE ; Not implemented - -;..... -; Parallel Input Data fetch - -PIO1IN: JP ISFALSE ; Not implemented - -;..... -; Parallel Output Status Test - -PIO1OS: IN0 A,(SPORT) ; Read Port Status - RLA ; Status Bit [7] -> Carry - SBC A,A ; A=0 if Not Ready, FF if Ready to Send - RET - -;..... -; Parallel Output Routine - -PIO1OT: CALL PIO1OS ; List on the parallel device - JR Z,PIO1OT - IF MOVCPM ; (No Swap Allowed) - LD A,(PIO1+7) ; Get output mask - AND C ; ..and apply to char - ELSE ; (Swapping permitted) - LD A,C ; Get Output Char -OPATP: AND $-$ ; .mask as set in Config - ENDIF ;Movcpm - OUT0 (DPORT),A ; Latch the output byte to Data Port - LD A,0DH - OUT0 (CPORT),A ; Strobe (STB) = 1 to Control Port - NOP ; (delay) - NOP - LD A,0CH - OUT0 (CPORT),A ; then Strobe = 0 to Control Port - RET - PAGE - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -;---->> Additional Driver Code goes Here <<---- -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; To constrain the size of the boot system to available space on -; Floppy Disks, The additional drivers are only included if a -; banked system is being assembled, and "MorDev" is set TRUE. - - IF MORDEV AND NOT MOVCPM -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; COM3 Driver -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Z80182 SCC Channel B, Auxiliary Serial Port - IF ESCC_B -;..... -; COM3 Input Status Test -; Bit 0 of SCC Ch.B Control Port signifies Char Ready - -COM3IS: IN0 A,(SCCBCNT) ; Input Status - RRA ; Input Ready = Bit0 -> Carry - SBC A,A ; A=00 if Not Ready, FF if Char Ready - RET - -;..... -; COM3 Input Routine -; Remain in Loop until Char ready, then Return Char in A - -COM3IN: CALL COM3IS ; Console input from SCC Ch.B Ready? - JR Z,COM3IN ; ..loop if Not - IN0 A,(SCCBD) ; Else Read SCC Ch.B Data - IF MOVCPM ; (No Swap allowed) - LD C,A ; Store byte temporarily - LD A,(COM3+6) ; .get Input mask - AND C ; ..and apply to byte - ELSE ; (Swapping permitted) -IPAT3: AND $-$ ; Char Mask patched in Config - ENDIF ;Movcpm - RET - -;..... -; COM3 Output Status Test - -COM3OS: - IF XONOFF - LD A,(COM3+5) ; Get this Chan's Config settings - AND 00010000B ; Xon/Xoff in use? - JR Z,COM3O0 ; ..jump if Not - LD A,(COM3WT) ; Else get Current flow status - RLA - LD A,00 ; (prepare for stopped) - JR C,SOSTV ; ..jump to return Not Ready if Stopped -COM3O0: - ENDIF ;Xonoff - IN0 A,(SCCACNT) ; Read SCC Ch.A Control Reg - RRA ; Output Ready = Bit 2 - RRA - RRA ; -> Carry - SBC A,A ; A=00 if Not Ready, FF if Xmt Buffer Empty - RET - -;..... -; COM3 Output Routine (Byte to Send in C) - -COM3OT: CALL COM3OS ; Output to SCC Ch.B Ready? - JR Z,COM3OT ; ..loop if Not - IF MOVCPM ; (No Swap allowed) - LD A,(COM3+7) ; Get output mask - AND C ; .apply to byte - ELSE ; (Swapping permitted) - LD A,C ; Get Char -OPAT3: AND $-$ ; mask as set in Config - ENDIF ;Movcpm - OUT0 (SCCBD),A ; and send - RET - ENDIF ;Escc_b - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; ASCI0 Driver Routines -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - IF ASCI_0 - IF NOT BUFFA0 -;..... -; COM4 Input Status Test - -COM4IS: IN0 A,(STAT0) ; Get Status byte - RLA ; RDRF Bit to Carry - SBC A,A ; set A=0 if Not Rdy, FF if Ready - RET - -;..... -; COM4 Input Routine - -COM4IN: CALL COM4IS ; Anything ready? - JR Z,COM4IN ; ..loop if Not - IN0 A,(RDR0) - IF MOVCPM ; (No Swap allowed) - LD C,A ; Store byte temporarily - LD A,(COM4+6) ; get input mask - AND C ; apply to byte - ELSE ; (swapping permitted) -IPAT4: AND $-$ ; Char Mask patched in Config - ENDIF ;Movcpm - RET - ELSE ; Proceed with Buffered input -;..... -; COM4 Input Status Test (Buffered) - -COM4IS: LD A,(COM4Q) ; Get COM4 Queue Char Count - OR A ; Anything there? - JR RETST ; ..set appropriate flag and exit - -;..... -; COM4 Input Routine (Buffered) - -COM4IN: CALL COM4IS ; Anything there? - JR Z,COM4IN ; ..loop if Not - DI - PUSH HL ; Save Regs - PUSH BC - LD HL,COM4Q+QSIZE ; Point to end of Input Buffer - LD BC,QSIZE*256 ; length to B, Null in C - -; "Pop" character from the Buffer - -COM4LP: LD A,(HL) ; Get a byte - LD (HL),C ; store Null 1st time, else character - LD C,A ; move previous char for later save - DEC HL ; down to previous char - DJNZ COM4LP ; ..loop til Done - DEC (HL) ; Decrement Count in Queue - IF MOVCPM ; (No Swap Allowed) - LD A,(COM4+6) ; Get Input Mask - AND C ; apply setting flags based on Char - ELSE ; (swapping permitted) -IPAT4: AND $-$ ; Mask as set in Config - ENDIF ;Movcpm - POP BC ; Restore Regs - POP HL - EI - RET - ENDIF ;BuffA0 - -;..... -; COM4 Output Status Test - -COM4OS: IN0 A,(STAT0) ; ASCI0 Output Status - RRA ; TDRE Bit - RRA ; to Carry - SBC A,A ; set status, A=0 if Not ready, FF if Rdy - RET - -;..... -; COM4 Output Routine - -COM4OT: CALL COM4OS ; Ready to Send? - JR Z,COM4OT ; ..loop if Not - IF MOVCPM ; (No Swap allowed) - LD A,(COM4+7) ; Get output mask - AND C ; apply to byte - ELSE ; (swapping permitted) - LD A,C ; Get Char -OPAT4: AND $-$ ; mask as set in Config - ENDIF ;Movcpm - OUT0 (TDR0),A ; and Send - RET - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Interrupt service routines for ASCI0 -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - IF BUFFA0 -RCAA: LD (INTSP),SP - LD SP,INTSP - PUSH AF - PUSH BC - PUSH HL - - IN0 A,(RDR0) ; Get character from ASCI0 - LD C,A ; ..save it - - IF XONOFF - LD A,(COM4+5) ; Get Config Byte - AND 00010000B ; Xon/Xoff Active? - JR Z,RCAA0 ; ..jump if Not - LD HL,COM4WT ; Else Point to Flags Byte - LD A,C ; get Byte Back - CP XON ; Is it Xon? - JR NZ,RCAA1 ; ..jump if Not - RES 7,(HL) ; Else Enable Sending again - JR RCAAX ; and Exit - -RCAA1: CP XOFF ; Is it Xoff? - JR NZ,RCAA0 ; ..jump if Not to add to Queue - SET 7,(HL) ; Else Stop Sending - JR RCAAX ; and Exit - ENDIF ;Xonoff - -RCAA0: LD HL,COM4Q ; Point to char count - LD A,(HL) ; ..and get it - INC A ; Bump - CP QSIZE ; Buffer Full? - JR NC,RCAAX ; ..exit if so - LD (HL),A ; Else save new char count - CALL ADDAHL ; Offset to storage in Queue - LD (HL),C ; ..and save the character -RCAAX: POP HL ; Restore Regs - POP BC - POP AF - LD SP,(INTSP) ; and Entry Stack Ptr - EI ; Ints back On - RET - ENDIF ;BuffA0 - ENDIF ;Asci_0 - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; ASCI1 Driver Routines -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - IF ASCI_1 - IF NOT BUFFA1 -;..... -; COM5 Input Status Test - -COM5IS: IN0 A,(STAT1) ; Get Status byte - RLA ; RDRF Bit to Carry - SBC A,A ; set A=0 if Not Rdy, FF if Ready - RET - -;..... -; COM5 Input Routine - -COM5IN: CALL COM5IS ; Anything ready? - JR Z,COM5IN ; ..loop if Not - IN0 A,(RDR1) - IF MOVCPM ; (No Swap allowed) - LD C,A ; Store byte temporarily - LD A,(COM5+6) ; get input mask - AND C ; apply to byte - ELSE ; (swapping permitted) -IPAT5: AND $-$ ; Char Mask patched in Config - ENDIF ;Movcpm - RET - - ELSE ;proceed w/buffered input -;..... -; COM5 Input Status Test (Buffered) - -COM5IS: LD A,(COM5Q) ; Get COM5 Queue Char Count - OR A ; Anything there? - JP RETST - -;..... -; COM5 Input Routine (Buffered) - -COM5IN: CALL COM5IS ; COM5 input - JR Z,COM5IN - DI - PUSH HL ; Save registers - PUSH BC - LD HL,COM5Q+QSIZE ; Point to end of Type ahead Buffer - LD BC,QSIZE*256 ; Length in B, Null in C - -; "Pop" character from the Buffer - -COM5LP: LD A,(HL) ; Get a character - LD (HL),C ; Store Null 1st time, else character - LD C,A ; Move previous char for later save - DEC HL ; down to previous char - DJNZ COM5LP ; Loop til done - DEC (HL) ; Decrement Count in Queue - IF MOVCPM ; (No Swap Allowed) - LD A,(COM5+6) ; Get input mask - AND C ; apply setting flags based on char - ELSE ; (Swapping permitted) -IPAT5: AND $-$ ; Mask as set in Config - ENDIF ;Movcpm - POP BC ; Restore regs - POP HL - EI - RET - ENDIF ;buffered - -;..... -; COM5 Output Status Test - -COM5OS: IN0 A,(STAT1) ; ASCI1 Output Status - RRA ; TDRE Bit - RRA ; to Carry - SBC A,A ; set status, A=0 if Not ready, FF if Rdy - RET - -;..... -; COM5 Output Routine - -COM5OT: CALL COM5OS ; Ready to Send? - JR Z,COM5OT ; ..loop if Not - IF MOVCPM ; (No Swap allowed) - LD A,(COM5+7) ; Get output mask - AND C ; apply to byte - ELSE ; (swapping permitted) - LD A,C ; Get Char -OPAT5: AND $-$ ; mask as set in Config - ENDIF ;Movcpm - OUT0 (TDR1),A ; and Send - RET - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Interrupt service routines for ASCI1 -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - IF BUFFA1 -RCAB: LD (INTSP),SP - LD SP,INTSP - PUSH AF - PUSH BC - PUSH HL - - IN0 A,(RDR1) ; Get character from ASCI1 - LD C,A ; ..save it - - IF XONOFF - LD A,(COM5+5) ; Get Config Byte - AND 00010000B ; Xon/Xoff Active? - JR Z,RCAB0 ; ..jump if Not - LD HL,COM5WT ; Else Point to Flags Byte - LD A,C ; get Byte Back - CP XON ; Is it Xon? - JR NZ,RCAB1 ; ..jump if Not - RES 7,(HL) ; Else Enable Sending again - JR RCABX ; and Exit - -RCAB1: CP XOFF ; Is it Xoff? - JR NZ,RCAB0 ; ..jump if Not to add to Queue - SET 7,(HL) ; Else Stop Sending - JR RCABX ; and Exit - ENDIF ;Xonoff -RCAB0: LD HL,COM5Q ; Point to char count - LD A,(HL) ; ..and get it - INC A ; Bump - CP QSIZE ; Buffer Full? - JR NC,RCABX ; ..exit if so - LD (HL),A ; Else save new char count - CALL ADDAHL ; Offset to storage in Queue - LD (HL),C ; ..and save the character -RCABX: POP HL ; Restore Regs - POP BC - POP AF - LD SP,(INTSP) ; and Entry Stack Ptr - EI ; Ints back On - RET - ENDIF ;BuffA1 - ENDIF ;Asci_1 - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; Skeletons for Additional Expansion IO -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -;..... -; COMx Input Status (Non-buffered) -COMxIS: -;..... -; COMx Input Routine (Non-buffered) -COMxIN: -;..... -; COMx Output Status (Non-buffered) -COMxOS: -;..... -; COMx Output Routine (Non-buffered) -COMxOT: - ENDIF ;Mordev - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -;:: I n t e r r u p t T a b l e :: -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; The Z80182 Interrupt Vector table is placed here on a 32-byte -; boundary for internal peripherals. - - DEFS 32-[$-BIOSJT AND 31] ; Align -INTTBL: - DEFW BADINT ; FDC Controller w/Ints (FDCINT if Real Ints) - DEFW BADINT ; Parallel output port (INTPIO if Real Ints) - DEFW TIMER ; Timer0 - DEFW BADINT ; Timer1 - DEFW BADINT ; DMA Channel 0 - DEFW BADINT ; DMA Channel 1 - DEFW BADINT ; Clocked Serial IO - IF MORDEV AND ASCI_0 AND BUFFA0 - DEFW RCAA ; ASCI 0 - ELSE - DEFW BADINT ; ASCI 0 if Not Interrupt/Mordev - ENDIF - IF MORDEV AND ASCI_1 AND BUFFA1 - DEFW RCAB ; ASCI 1 - ELSE - DEFW BADINT ; ASCI 1 if Not Interrupt/Mordev - ENDIF - -; Error trap for unimplemented Interrupts - -BADINT: CALL PRINT - DEFC CR,LF,'Bad Int.' - JP WBOOT - -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -;:: D e v i c e I n i t i a l i z a t i o n :: -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - CSEG -DEVINI: - IF BANKED - CALL BIOSTK - CALL GOSYSB - JP JDVINI - COMMON /BANK2/ -JDVINI: - ENDIF - -; Synchronize Environment Descriptor Speed byte to Bios CPU Clock Speed setting - - LD A,(SPEED) ; Get Processor Speed from Bios Setting - LD HL,(ENVADR) ; Get ENV Address - LD L,2BH ; offset to CPU Clock rate - LD (HL),A ; and slam it into the ENV - -; Set Clock Rate and Dividers before we initialize devices - ;;--(ENH182 doesn't seem to be variable at present) - -;;-- LD C,0 ; (preset ESCC Div-by-1, No Halt) -;;-- CP 20 ; < 20 MHz? -;;-- JR C,IsBy1 ; ..jump if So -;;-- LD C,00001000B ; Else Divide ESCC clock by 2 - ; |||||+++- (reserved) - ; ||||+---- 0 = ESCC Clk Div-by-1, 1 = ESCC Clk Div-by-2 - ; |||+----- 1 = TxDA Disable on Halt - ; ||+------ 1 = Force Halt - ; ++------- (reserved) -;;--IsBy1: OUT0 (ENH182),C ; Set ESC Divider - - LD C,10000000B ; (preset flags) - ; |+++++++- Normal Drive, Standby/Idle Disabled - ; +-------- 0 = XTAL/2 Rate, 1 = XTAL/1 Rate - CP 12+1 ; Is Clock Speed > 12 MHz? - JR NC,ISHI ; jump if Yes - LD C,0 ; Else Set for Low (Xtal / 2) Speed -ISHI: OUT0 (1FH),C ; and Set Speed - -; Set Configured Wait States for IO and Memory - - LD A,(WAITS) ; Get # Wait states for Memory & IO - AND 00110011B ; Mask off all but 2 LSBs in each nybble - RLCA ; move Mem bits to B7,6 - RLCA - LD C,A ; Save partially shifted byte - RLCA ; Move IO to Bits 5,4 - RLCA - OR C ; OR in Memory waits - AND 11110000B ; and mask off all others - OR 00001100B ; Edge Triggering for both DMA channels - OUT0 (DCNTL),A ; set parameters - -; Set Refresh to Assembled Setting - - IF REFRSH ; (Must be TRUE if using Dynamic RAM) - LD A,83H ; Set refreshing on for Dynamic Rams - ELSE ; (Don't need wasted time if Static Memory) - LD A,00H ; Else disable Refresh cycles - ENDIF - OUT0 (RCR),A ; Set Refresh timing specs - -; Set Reload constant to values in header - - LD HL,(RELOD0) ; Get the timer reload constant - OUT0 (RLDR0L),L ; send low byte - OUT0 (RLDR0H),H ; and hi byte - -; Configure COM1 IO Masks and Channel characteristics - - IF NOT MOVCPM ; (Swapping permitted) - LD DE,C1NAM ; Point to COM1 Name String - CALL SETPTR ; locate data returning ptr - JR Z,DEVIN0 ; jump to next if No Device Name - LD A,(HL) ; Else Get Dev+7 Mask - LD (OPAT1+1),A ; patch - DEC HL ; Down to Input Mask @ Dev+6 - LD A,(HL) ; fetch - LD (IPAT1+1),A ; and patch - DEC HL ; Down to Config byte @ Dev+5 - ELSE ; (No Swap Allowed) - LD HL,DEVCFG+5 ; Point to second COM1 Config byte - ENDIF ;Movcpm - LD BC,SCCACNT ; Point to SCC Channel A Control Port - CALL INSCC ; Set the SCC parameters - -; Configure COM2 IO Masks and Channel Characteristics - -DEVIN0: - IF NOT MOVCPM ; (Swapping permitted) - LD DE,C2NAM ; Point to COM2 Name String - CALL SETPTR ; locate data returning ptr - JR Z,DEVIN1 ; ..jump to next if No Device Name - LD A,(HL) ; Else Get Dev+7 Mask - LD (OPAT2+1),A ; patch - DEC HL ; Down to Input Mask @ Dev+6 - LD A,(HL) ; fetch - LD (IPAT2+1),A ; and patch - DEC HL ; Down to Config Byte @ Dev+5 - ELSE ; (No Swap Allowed) - LD HL,DEVCFG+[COM2-COM1]+5 ; Point to second COM2 Config byte - ENDIF ;Movcpm - CALL IOI550 ; Initialize 16550-compatible 37C665 Port - -; Configure Parallel Port IO Masks and Characteristics and Reset - - IF NOT MOVCPM ; (No Swap Allowed) -DEVIN1: LD DE,P1NAM ; Point to PIO1 Name String - CALL SETPTR ; locate data returning ptr - JR Z,DEVIN2 ; jump if No Device Name - LD A,(HL) ; Get Dev+7 Mask - LD (OPATP+1),A ; and patch -DEVIN2: - ENDIF ;Movcpm - ; Reset Parallel port on FDC37C665 Multi-IO Chip - LD A,00001000B ; Command to Reset Parallel Port - OUT0 (CPORT),A ; by bringing INIT Low - LD BC,4000 -PDly: DEC BC ; and - LD A,B - OR C - JR NZ,PDly ; holding there for a while - LD A,00001100B ; Re-activate Port - OUT0 (CPORT),A ; by bringing INIT High - IN0 A,(SPORT) ; Clear by - IN0 A,(SPORT) ; reading status twice - - IF MORDEV AND NOT MOVCPM -; -- Add necessary Initialization for Expansion Drivers here -- - IF ESCC_B - ; Initialize ESCC Channel B - LD DE,C3NAM ; Point to COM3 Name String - CALL SETPTR ; locate data returning ptr - JR Z,DEVIN3 ; jump to next if No Device Name - LD A,(HL) ; Else Get Dev+7 Mask - LD (OPAT3+1),A ; patch - DEC HL ; Down to Input Mask @ Dev+6 - LD A,(HL) ; fetch - LD (IPAT3+1),A ; and patch - DEC HL ; Down to Config byte @ Dev+5 - LD BC,SCCBCNT ; Point to SCC Channel B Control Port - CALL INSCC ; Set the SCC parameters - ENDIF ;Escc_b -DEVIN3: - IF ASCI_0 - ; Initialize ASCI0 - LD DE,C4NAM ; Point to COM4 Name String - CALL SETPTR ; locate data returning ptr - JR Z,DEVIN4 ; jump to next if No Device Name - LD A,(HL) ; Else Get Dev+7 Mask - LD (OPAT4+1),A ; patch - DEC HL ; Down to Input Mask @ Dev+6 - LD A,(HL) ; fetch - LD (IPAT4+1),A ; and patch - DEC HL ; Down to Config byte @ Dev+5 - LD BC,CNTLA0 ; B=0 for Hi-order IO Address, C=CNTLA0 Port - LD E,01100000B ; CNTLA0 Mask, RE, TE, RTS* - CALL INASCI ; and set a couple of bytes -DEVIN4: - IF BUFFA0 - LD A,00001000B ; Enable ASCI0 Interrupts - ELSE - XOR A ; No Interrupts - ENDIF - OUT0 (STAT0),A - ENDIF ;Asci_0 - IF ASCI_1 - ; Initialize ASCI1 - LD DE,C5NAM ; Point to COM5 Name String - CALL SETPTR ; locate data returning ptr - JR Z,DEVIN5 ; jump to next if No Device Name - LD A,(HL) ; Else Get Dev+7 Mask - LD (OPAT5+1),A ; patch - DEC HL ; Down to Input Mask @ Dev+6 - LD A,(HL) ; fetch - LD (IPAT5+1),A ; and patch - DEC HL ; Down to Config byte @ Dev+5 - LD BC,CNTLA1 ; B=0 for Hi-order IO Address, C=CNTLA1 Port - LD E,01110000B ; CNTLA1 Mask, RE, TE, Internal Clk - CALL INASCI ; and set a couple of bytes -DEVIN5: - IF BUFFA1 - LD A,00001100B ; Enable ASCI1 Interrupts & CTS1* - ELSE - LD A,00000100B ; No Interrupts, Enable CTS1* - ENDIF - OUT0 (STAT1),A - ENDIF ;Asci_1 - ENDIF ;Mordev & Not Movcpm - -; Set IOByte(s) to Configured Device Settings - - IF BANKED - LD A,(TPABNK) ; Get Bank # for TPA - LD C,A ; and set for destination - LD HL,0003H ; Point to IOBYTE - LD A,(IOBYT) ; get the new settings - CALL FRPUTB ; and stuff it in TPA bank - ENDIF - LD A,(IOBYT) ; If Non-banked, just get the byte - LD (0003H),A ; and stuff it, else stuff in SYStem bank - -; De-Select any IDE Drives to force re-initialization on first select - - IF IDE - OR 0FFH ; Set all bits - LD (hdUnit),A ; to mismatch select on current unit - ENDIF - -; Set Interrupt Conditions - - LD A,00010001B ; Turn Ints On and enable downcounting - OUT0 (TCR),A - - LD A,00000111B ; Activate INT0 and Internals - OUT0 (ITC),A - EI ; Insure interrupts enabled - RET - -;..... -; Z182 [E]SCC Configuration Routine. -; Enter= BC -> respective Control Register SCCACNT/SCCBCNT. -; HL -> Dev+5 Configuration byte - -INSCC: LD DE,0100010000101010B ; Skeleton WR4 (D), WR5 (E) contents - ; |||||||||||||||+- Tx CRC Enable \---------------+ - ; ||||||||||||||+-- RTS | - ; |||||||||||||+--- /SDLC/CRC-16 | - ; ||||||||||||+---- Tx Enable WR5 - ; |||||||||||+----- Send Break | - ; |||||||||++------ Bits/Char (00=5, 01=7, 10=6, 11=8) | - ; ||||||||+-------- DTR /---------------+ - ; |||||||+--------- Parity Enable \---------------+ - ; ||||||+---------- Parity EVEN/ODD | WR4 - ; ||||++----------- 00=Sync, 01=1 Stop, 10=1.5 Stop, 11=2 - ; ||++------------- Sync Char Settings | - ; ++--------------- Clock 00=X1,01=X16,10=X32,11=X64 /-+ - BIT 0,(HL) ; One Stop Bit? - JR NZ,INSCC0 ; ..jump if So - SET 3,D ; Else Set for 2 Stop bits -INSCC0: BIT 1,(HL) ; Parity On? - JR Z,INSCC1 ; ..jump if Not - SET 0,D ; Else Turn it On - BIT 2,(HL) ; Is Odd parity desired? - JR NZ,INSCC1 ; ..jump if Even parity - SET 1,D ; Else set to Odd -INSCC1: BIT 3,(HL) ; 7-bit Data? - JR NZ,INSCC2 ; ..jump if So - SET 6,E ; Else set for 8-bit data -INSCC2: LD A,WR4 - CALL IWdOut ; Set basic Parms - LD A,E ; Get WR4 Config Byte - SCF ; (prep to set LSB) - ADC A,A ; Move old B6/5 to B7/6 and Set LSB - AND 0C1H ; strip off Garbage - BIT 5,(HL) ; RTS/CTS Handshake selected? - JR Z,INSCC8 ; ..jump if Not - OR 00100000B ; Else Set Auto-Enables -INSCC8: LD E,A ; (position) - LD A,WR3 - CALL IBytO ; Set Receive Bits/Char & activate - - CALL ChkRat ; Can we set the Data Rate? - RET Z ; ..quit if Not - - PUSH BC ; Else Save regs (A [0..3] = Rate index) - DEC A ; adjust index to Base 0 - LD C,A ; store - LD HL,brSCC ; Pt to Start of Baud Rate Table - CALL ADDAHL ; -> appropriate constant - LD L,(HL) ; fetch constant -;;-- IN0 A,(ENH182) ; Get Enhancement Reg -;;-- AND 00001000B ; Keep ESCC Divide Rate Bit - LD A,(SPEED) ; Fetch Clock speed -;;-- JR Z,INSCC9 ; ..jump if Div-by-1 -;;-- SRL A ; Else Divide Rate by 2 (by dividing Clk) -;;--INSCC9: - LD H,A - LD A,C - CP 3 ; Rate In [134.5, 50, 75]? - JR NC,INSCC3 ; ..jump if Not - LD A,H ; Else - ADD A,A ; Multiply - ADD A,H ; constant * 3 - LD H,A -INSCC3: MLT HL ; Multiply Clock Rate by Constant - LD A,C - CP 7 ; Rate < 2400 bps? - JR C,INSCC4 ; ..jump if Yes - LD C,18 ; Else Compute Divisor / 18 - LD B,17 ; 17 times thru loop for 16 bits - XOR A ; start w/Carry Clear - -; Divide computed value in HL by 18 (in C), Ret: Remainder in A, Quotient in HL - -SDiv0: ADC A,A - SBC A,C - JR NC,SDiv1 - ADD A,C ; correct for underflow -SDiv1: CCF - ADC HL,HL - DJNZ SDiv0 ; ..loop til Done - SRL C ; Dividend / 2 - CP C ; Rounding Needed? - JR C,INSCC4 ; ..jump if Not - INC HL ; Else round up - -INSCC4: POP BC - DEC HL ; Compute Divisor - DEC HL ; - 2 - LD A,H - OR L ; If Divisor = 0 - JR NZ,INSCC5 - INC L ; default to 1 -INSCC5: LD A,WR12 ; Address Divisor Reg pair - LD E,H ; swap - LD D,L ; bytes to send Lower first - -IWdOut: DI - OUT (C),A ; Address WR4 - OUT (C),D ; Set values - INC A ; Bump to WR5 -IBytO: OUT (C),A ; address it - OUT (C),E ; Set values - EI - RET - -;..... -; Divisor factors are computed as: -; (Xtal Freq (Hz) / (2 * bps * Divisor)) - 2 -; These rate constants represent a compromise between the "standard" rates of -; multiples of 6.144 and 9.216 MHz, and the 8.000/16.000 MHz used in the P112. -; All factors are based on a x16 clock divisor. - -brSCC: DEFB 79 ; 1 = 134.5 bps / 3 - DEFB 213 ; 2 = 50 bps / 3 - DEFB 142 ; 3 = 75 bps / 3 - DEFB 213 ; 4 = 150 bps - DEFB 106 ; 5 = 300 bps - DEFB 53 ; 6 = 600 bps - DEFB 26 ; 7 = 1200 bps - DEFB 240 ; 8 = 2400 bps * 18 - DEFB 120 ; 9 = 4800 bps * 18 - DEFB 60 ; 10 = 9600 bps * 18 - DEFB 30 ; 11 = 19.2 kbps * 18 - DEFB 15 ; 12 = 38.4 kbps * 18 - DEFB 10 ; 13 = 57.6 kbps * 18 - DEFB 5 ; 14 = 115.2 kbps * 18 - -;..... -; 16550-compatible Configuration Routine - -IOI550: LD E,00000011B ; Start w/byte going to Line Contr Reg (LCR) - ; ||||||++- Word Len in Bits (00=5, 01=6, 10=7, 11=8) - ; |||||+--- Stop Bits (0=1, 1=1.5 or 2) - ; ||||+---- 0 = No Parity, 1 = Parity Enabled - ; ||++----- (If Parity) 00=Odd, 01=Even, 10=Mark, 11=Space - ; |+-------- 0 = Normal, 1 = Send Break - ; +--------- 0 = Normal, 1 = Set Baud Rate - BIT 0,(HL) ; One Stop Bit? - JR NZ,IOI55a ; ..jump if So - SET 2,E ; Else Set for 2 Stop Bits -IOI55a: BIT 1,(HL) ; Parity On? - JR Z,IOI55b ; ..jump if Not - SET 3,E ; Else Turn it On - BIT 2,(HL) ; Even Parity? - JR Z,IOI55b ; ..jump if Odd - SET 4,E ; Else Set Even Parity -IOI55b: CALL ChkRat ; Can we set the Data Rate? - JR Z,IOI55c ; ..jump if Not - ADD A,A ; Else double index - LD C,A - LD B,0 - LD HL,RATE55-2 ; Pt to compensated Table - ADD HL,BC - SET 7,E ; Address DLAB - OUT0 (_LCR),E - LD A,(HL) - OUT0 (_DDL),A ; send Low Byte - INC HL - LD A,(HL) - OUT0 (_DLM),A ; and High Byte -IOI55c: RES 7,E ; Clear DLAB Bit - OUT0 (_LCR),E ; and Set configuration - LD A,00000011B - ; |||||||+-- 1 = DTR Active - ; ||||||+--- 1 = RTS Active - ; |||||+---- (unused) - ; ||||+----- 1 = Send Ints to CPU, 0 = Ints Hi-Z - ; |||+------ 1 = Line Loopback - ; +++------- (unused) - OUT0 (_MCR),A ; Activate Port - LD A,00000000B - ; |||||||+-- 1 = Enable Rcv Buff Full Interrupt - ; ||||||+--- 1 = Enable Xmt Buff Empty Interrupt - ; |||||+---- 1 = Enable Line Status Interrupt - ; ||||+----- 1 = Enable Delta Status Signals Inerrupt - ; ++++------ (unused) - OUT0 (_IER),A ; Set Interrupt Settings - RET - -; Clock Divisor factors for various rates - -RATE55: DEFW 857 ; 1 = 134.5 bps - DEFW 2304 ; 2 = 50 bps - DEFW 1536 ; 3 = 75 bps - DEFW 768 ; 4 = 150 bps - DEFW 384 ; 5 = 300 bps - DEFW 192 ; 6 = 600 bps - DEFW 96 ; 7 = 1200 bps - DEFW 48 ; 8 = 2400 bps - DEFW 24 ; 9 = 4800 bps - DEFW 12 ; 10 = 9600 bps - DEFW 6 ; 11 = 19.2 kbps - DEFW 3 ; 12 = 38.4 kbps - DEFW 2 ; 13 = 57.6 kbps (non-std) - DEFW 1 ; 14 = 115.2 kbps - -;..... -; Expansion Common routines may be places here - IF MORDEV AND NOT MOVCPM - IF ASCI_0 OR ASCI_1 -INASCI: BIT 0,(HL) ; One Stop Bit? - JR NZ,INASC0 ; ..jump if Not - SET 0,E ; Else Set for 2 Stop bits -INASC0: BIT 1,(HL) ; Parity On? - JR Z,INASC1 ; ..jump if Not - SET 1,E ; Else Turn it On -INASC1: BIT 3,(HL) ; 7-bit Data? - JR NZ,INASC2 ; ..jump if So - SET 2,E ; Else set for 8-bit Data -INASC2: OUT (C),E ; Send the byte to CNTLA0/1 - INC C ; advance to CNTLB0/1 - INC C - DEC HL ; Back up to first Config byte - LD A,(HL) ; fetch - AND 0F0H ; Check Config Status - LD E,0111B ; (preset for External clock in case) - JR Z,INASCX ; ..jump if No rate to Set - LD A,(HL) ; Refetch the rate byte - AND 0FH ; masking off all but desired rate - PUSH HL ; Save Config byte pointer - LD HL,ASCRAT-1 ; pt to Rate Table (Correcting for Base 0) - CALL ADDAHL ; offsetting to desired byte - LD E,0 ; Prepare an initial mask - LD A,(SPEED) ; Check processor speed - CP 6+1 ; Is it 6 or below? - JR C,INASC8 ; ..jump assuming 6.144 MHz if <= 6 - DEC HL ; (prepare for 12 test) - CP 12 ; Is it 12 MHz? - JR Z,INASC8 ; ..jump assuming 12.288 MHz if = 12 - DEC HL ; (prepare for 24 test) - CP 24 ; Is it 24 MHz? - JR NC,INASC8 ; ..jump if >= 24 MHz - INC HL ; Else correct pointer - INC HL ; Advance for 18 MHz - SET 5,E ; Set additional divisor bit for 9/18 MHz - CP 16 ; Is it >= 16 MHz? (including 18 MHz) - JR NC,INASC8 ; ..jump to use 6 MHz rates if So - INC HL ; Else bump up one in Rate Table -INASC8: LD A,(HL) ; Get the Rate Setting Byte - OR E ; add in any additional divisor - LD E,A ; back to output reg - POP HL ; Restore Config byte ptr -INASCX: INC HL ; advance to second byte - BIT 2,(HL) ; Is Odd parity desired? - JR NZ,INASC9 ; ..jump if Even parity - SET 4,E ; Else set to Odd -INASC9: OUT (C),E ; Send the byte to CNTLB0/1 - RET - - ; bps @ 6MHz 9MHz 12MHz 18MHz 24MHz - DEFB 00001110B ; 0 (protection) -ASCRAT: DEFB 00001110B ; 1 = default to lowest rate - DEFB 00001110B ; 2 = default to lowest rate - DEFB 00001110B ; 3 = default to lowest rate - DEFB 00001110B ; 4 = 150 75 300 150 600 - DEFB 00001101B ; 5 = 300 150 600 300 1200 - DEFB 00000110B ; 6 = 600 300 1200 600 2400 - DEFB 00000101B ; 7 = 1200 600 2400 1200 4800 - DEFB 00000100B ; 8 = 2400 1200 4800 2400 9600 - DEFB 00000011B ; 9 = 4800 2400 9600 4800 19.2k - DEFB 00000010B ; 10 = 9600 4800 19.2k 9600 38.4k - DEFB 00000001B ; 11 = 19.2 k 9600 38.4k 19.2k 76.8k - DEFB 00000000B ; 12 = 38.4 k 19.2 k 76.8k 38.4k 153.6k - DEFB 00000000B ; 13 = default to highest rate - DEFB 00000000B ; 14 = default to highest rate - DEFB 00000000B ; 15 = default to highest rate - ENDIF ;Asci_0 | Asci_1 - ENDIF ;Mordev - -;..... -; Check Data Rate Config byte for authority and limits on configuration -; Enter: HL -> Second Config byte (back up to get rate byte) -; Exit : Zero Set if Can't configure - -ChkRat: DEC HL ; Pt to Data Rate - LD A,(HL) ; fetch - AND 0F0H ; Any Allowed rate to set? - RET Z ; ..quit if Not (Z Set) - LD A,(HL) ; Fetch byte again - AND 0FH ; Anything to Set? - RET Z ; ..quit if Not (Z Set) - CP 0FH ; Fixed Rate? - RET ; ..exit w/Z Set if Fixed, else NZ for Ok - -;..... -; Locate Named Device and return pointer to last Config byte - IF NOT MOVCPM -SETPTR: LD HL,DEVCFG-[COM2-COM1] ; Point ahead of start -SETPTL: LD BC,COM2-COM1 ; Set size of entries - ADD HL,BC ; advance to next entry - LD B,4 ; Set # chars to compare - LD A,(HL) ; Get first char - OR A ; Is it Table End? - RET Z ; ..return Zero Set if so - PUSH DE ; (save source & dest strings) - PUSH HL -SETPT0: LD A,(DE) - CP (HL) ; Compare each char - JR NZ,SETPTX ; ..quitting if mismatch - INC DE ; Else advance to next - INC HL - DJNZ SETPT0 ; ..loop to next char -SETPTX: POP HL ; Restore source & dest ptrs - POP DE - JR NZ,SETPTL ; ..try next entry if mismatch - LD DE,7 ; Else advance to Dev+7 - ADD HL,DE - OR 0FFH ; Insure Zero Clear on Return - RET ; ..and quit - -C1NAM: DEFB 'COM1' ; Device needing Configuration to match -C2NAM: DEFB 'COM2' -P1NAM: DEFB 'PIO1' - ENDIF ;Movcpm -; Name strings for Expansion IO added here after Primary Devices - IF MORDEV AND ESCC_B AND NOT MOVCPM -C3NAM: DEFB 'COM3' ; ESCC Channel B Expansion Device - ENDIF - IF MORDEV AND ASCI_0 AND NOT MOVCPM -C4NAM: DEFB 'COM4' ; ASCI0 Expansion Device - ENDIF - IF MORDEV AND ASCI_1 AND NOT MOVCPM -C5NAM: DEFB 'COM5' ; ASCI1 Expansion Device - ENDIF -;..... -; NOTE: BuffA0 and BuffA1 Intrpt Buffers are located at end of B/P Root module. - -;===================== End of IIO-DX.Z80 ========================== - \ No newline at end of file diff --git a/Source/BPBIOS/iio-ww.z80 b/Source/BPBIOS/iio-ww.z80 index 64f4fbae..6923e20c 100644 --- a/Source/BPBIOS/iio-ww.z80 +++ b/Source/BPBIOS/iio-ww.z80 @@ -1,7 +1,17 @@ ;:::::::::::::::::::::::::::::::::::::::::::::::::************************* ; Byte I/O Routines *** Hardware Specific *** -; - D-X Designs Pty Ltd P112 - ************************* +; - Retro-Brew Processor boards w/ HBIOS - ************************* ; +; Several serial and parallel options exist with HBIOS. With SBC, SIMH or +; ZETA two serial ports are available at RS-232 signalling levels via a +; 16650 compatible UART. For Mark IV or N8, the internal ACSI ports +; are used. The primary port defined here as COM1 uses ASCI Channel A of +; the Z80182. COM2 uses ACSI Channel B are available at TTL voltage levels +; A full Parallel port is available on SBC and ZETA is used as the +; primary List (Printer) Device. +; +; +; 1.3 - 27 Mar 14 - Initial N8VEM test release WW+LN ; 1.2 - 28 Aug 01 - Final scrub for GPL release. HFB ; 1.1a- 11 May 97 - Cleaned code, fixed added port accesses. HFB ; 1.1 - 25 Jan 97 - Revised ESCC Baud rate calcs, added COM3-5. HFB @@ -67,7 +77,7 @@ PIO1: DEFB 'PIO1' ; 4-Char ID DEFW PIO1IN ; PIO Byte Input DEFW PIO1IS ; PIO Input Status - IF MOVCPM OR [MORDEV AND NOT [ESCC_B OR ASCI_0 OR ASCI_1]] + IF MOVCPM OR [MORDEV] DEFB 'NULL' ; 4-Char ID DEFB 00000000B ; Baud Rate (None) DEFB 11000000B ; Config Byte @@ -215,3 +225,4 @@ JDVINI: ENDIF RET ; WW + \ No newline at end of file diff --git a/Source/BPBIOS/movp112.com b/Source/BPBIOS/movp112.com deleted file mode 100644 index 41111647..00000000 Binary files a/Source/BPBIOS/movp112.com and /dev/null differ diff --git a/Source/BPBIOS/myterm.z3t b/Source/BPBIOS/myterm.z3t deleted file mode 100644 index 8c905b96..00000000 Binary files a/Source/BPBIOS/myterm.z3t and /dev/null differ diff --git a/Source/BPBIOS/p112boot.doc b/Source/BPBIOS/p112boot.doc deleted file mode 100644 index 85f18fce..00000000 --- a/Source/BPBIOS/p112boot.doc +++ /dev/null @@ -1,46 +0,0 @@ - 21 July 1996 -The boot record is NOT executable. Any attempt to execute it will produce -varied effects ranging from a HALT to only a single load or jump. The -arguments of the instructions are simply intended to make addresses available -to the ROM Boot loader. The layout is: - - ORG 8000H - - DB 76H ; HALT instruction - LD HL,CCP-80H ; Base load point assuming 128 bytes for - ; this Boot Record size. - RET ; (safety) - JP BIOS ; This address is for the CBOOT entry in the - ; relocated System image. Execution should - ; commence at the argument of this jump. - -Accessing the relevant parameters from the ROM, then, normally consists of -getting the Load Address from 8002H, and the BIOS CBOOT Entry point from -8006H. It is recommended that the jump itself not be executed, but use a -vectored approach such as the sequence: - - LD HL,(8006H) - JP (HL) - -The remainder of this record is available for transferring parameters to the -Bios as part of the CBOOT setup. Parameters may be addressed by absolute -values such as 8020H, etc. - -Since the two location addresses are variable depending on the system size -generated, a checksum of the boot record is not feasible without generating -an entirely new, unique utility. That defeats the intent of this effort which -is to retain a common suite of utilities across multiple platforms. Validation -of the Boot record instead can check the absolute bytes at any or all of the -following locations: - - 8000 - 76H - 8001 - 21H - 8004 - 0C9H - 8005 - 0C3H - -Another possibility which may be implemented is to embed an ASCII Text string -in the available space. This may be a visual thing, but there comes a limit -to complexity vs reliability. - -Hal - \ No newline at end of file diff --git a/Source/BPBIOS/ramd-dx.z80 b/Source/BPBIOS/ramd-dx.z80 deleted file mode 100644 index e6fb93ce..00000000 --- a/Source/BPBIOS/ramd-dx.z80 +++ /dev/null @@ -1,112 +0,0 @@ -;===============================================************************ -; RAM Disk Driver. ** Hardware Specific ** -; D-X Designs Pty Ltd P112 ************************ -; -; 1.1 - 28 Jul 01 - Updated to latest fix for external driver. HFB -; 1.0 - 10 Jun 96 - Initial Release for P112 from YASBEC. HFB -;======================================================================= - - CSEG - IF BANKED - COMMON /BANK2/ - ENDIF - -; This module creates a RAM Drive using the available memory (if available) -; above the TPA and possible System banks. For a banked system, the minimum -; needed is a 64k Main TPA and a 32k System Bank. - -;..... -; Select the RAM Drive. This routine performs any setup required in a select. - -SELRAM: JP SETPARMS ; No action locally. - -;..... -; Read a 128-byte logical sector from the RAM Drive to main memory. -; This routine uses the HSTxxx values from the base BIOS routines. - -RAMRD: OR 0FFH ; Set Read flag (non-0) - JR RamRW ; ..go to common code - -;..... -; Write a 128-byte logical sector from main memory to the RAM Drive. -; This routine uses the HSTxxx values from the base BIOS routines. - -RAMWR: XOR A ; Set Write flag with 0, Read w/AFH - LD (HSTWRT),A ; clear pending write flag - ;..fall thru to common code.. -; The following performs calculations for the proper address and bank, sets -; the DMA block and executes the Move to/from the Host Buffer. - -RamRW: PUSH AF ; Save R/W flag for later - LD A,(RAMBNK) ; Get 1st Bank of Ram Drive - ADD A,A - ADD A,A ; .converting - ADD A,A ; ..to DMA Bank addr - LD HL,HSTTRK ; Point to Track # - ADD A,(HL) ; ..and add in - LD HL,0000 ; ..prepare address - LD B,4 -SHFTR: SRL A ; Shift low 4 bits - RR H ; ..to high of H - DJNZ SHFTR - LD C,A ; Save High byte of A - LD A,(HSTSEC) ; Get sector # - SRL A - RR L ; .multiply by 128 - ADD A,H ; Add Remaining High bits to MSB of address - LD H,A ; ..and store Addr - LD A,C ; Get Bank # - ADC A,0 ; .adjust for possible overflow - LD C,A ; ..and re-save - - IF BANKED - LD A,(SYSBNK) ; Point to system bank for HSTBUF - ELSE - LD A,(TPABNK) ; Point to TPA bank if Unbanked - ENDIF - LD DE,HSTBUF ; Point to Host Buffer - RL D ; Place MSB of address in Carry - ADC A,0 ; .add to Bank Number - RRA ; Shift Bnk # to DMA Bank Byte (LSB to Carry) - LD B,A ; ..and place in destination register - RR D ; Bank # LSB (Carry) to Address MSB - - POP AF ; Read or Write? - JR NZ,RAMRD0 ; ..jump if Read - EX DE,HL ; Else swap things around - LD A,C - LD C,B - LD B,A -RAMRD0: LD (RAMSRC),HL ; Stuff values in DMA block - LD A,C - LD (RAMSRC+2),A - LD (RAMDST),DE - LD A,B - LD (RAMDST+2),A - LD HL,128 ; ..including length of move - LD (MLEN),HL - -; Set the Z-180 registers and start the move - - LD HL,RAMSRC ; Point to the DMA Control block - CALL DMAMOV ; .and use the Z-180 DMA to move - XOR A ; Return Ok status - RET - -;..... -; We need a little data area to set a DMA control block. Put in scratch RAM - - IF BANKED - COMMON /B2RAM/ - ELSE - DSEG - ENDIF - -RAMSRC: DEFS 2 ; Address of Source - DEFS 1 ; .Bank of Source -RAMDST: DEFS 2 ; Address of Destination - DEFS 1 ; .Bank of Destination -MLEN: DEFS 2 ; Length of Data Area to move - -;================== End of RAM Disk Code ==================== - \ No newline at end of file diff --git a/Source/BPBIOS/ramd-ww.z80 b/Source/BPBIOS/ramd-ww.z80 index c5592030..2cdc8267 100644 --- a/Source/BPBIOS/ramd-ww.z80 +++ b/Source/BPBIOS/ramd-ww.z80 @@ -69,6 +69,8 @@ RAMWR2: ; SETUP FOR INTERBANK COPY LD C,A ; SOURCE BANK TO C LD B,BID_HB ; DEST BANK TO B (HSTBUF IN HBIOS) + ;LD A,(HB_BNKBIOS) ; DEST BANK (HSTBUF IN HBIOS) + ;LD B,A ; PUT IN B LD DE,(HB_DSKBUF) ; DEST ADDRESS TO DE; HL ALREADY HAS SOURCE ADDRESS ; REVERSE VALUES IF WRITE POP AF ; Read or Write? @@ -79,9 +81,9 @@ RAMWR2: LD B,A RAMWR3: ; PERFORM THE COPY - CALL HBX_XCOPY ; SET BANKS FOR COPY + CALL XMOVE ; SET BANKS FOR COPY LD BC,128 ; SET LENGTH OF COPY (ONE SECTOR) - CALL HBX_COPY ; DO THE COPY + CALL MOVE ; DO THE COPY ; CLEAN UP AND RETURN XOR A ; SIGNAL SUCCESS RET ; AND RETURN diff --git a/Source/BPBIOS/romwbw-mk4.lib b/Source/BPBIOS/romwbw-mk4.lib deleted file mode 100644 index e4dcf70f..00000000 --- a/Source/BPBIOS/romwbw-mk4.lib +++ /dev/null @@ -1,82 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; HBIOS specific customizations -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros -; -; NOTE: Must make sure settings below match hardware and -; HBIOS configuration. -; -HBIOS EQU YES ; Use HBIOS functions -HBLOC EQU 0FE00H ; Location of HBIOS proxy (used if not INTPXY) -; -; Set exactly one of the following to YES to specify platform -; -N8VEM EQU NO -ZETA EQU NO -ZETA2 EQU NO -N8 EQU NO -MK4 EQU YES -; -; Set either the following to YES (or both to NO for no clock code) -; -SIMHCLK EQU NO ; Direct SIMH clock access -HBCLK EQU YES ; HBIOS clock driver -; -; Set HB_IODEV to appropriate console device -; -HB_IODEV EQU 0 ; Assume we want to use first HBIOS serial device -; -; Set HB_HDDEV to appropriate hard disk driver -; -HB_HDDEV EQU 2 ; Assumes disk device #2 is first hard disk device -; -; Set HB_MDDEV to appropriate memory disk driver -; -HB_MDDEV EQU 0 ; Assumes disk device #0 is ROM disk device -; -; RAM/ROM disk sizes expressed as count of 2K blocks -; -HB_RAMBLKS EQU 192 ; 512K - 128K reserved / 2K per block -HB_ROMBLKS EQU 192 ; 512K - 128K reserved / 2K per block -;HB_ROMBLKS EQU 448 ; 1024K - 128K reserved / 2K per block -; -; Layout of RAM banks -; - IF N8VEM OR ZETA OR ZETA2 OR MK4 -BID_RAMD EQU 80H -BID_RAMM EQU 8BH -BID_SYS EQU 8CH -BID_HB EQU 8DH -BID_USR EQU 8EH -BID_COM EQU 8FH - ENDIF - IF N8 -BID_RAMD EQU 80H -BID_RAMM EQU 9BH -BID_SYS EQU 9CH -BID_HB EQU 9DH -BID_USR EQU 9EH -BID_COM EQU 9FH - ENDIF -; - IF INTPXY -MEMTOP EQU 0FFE0H - 1 ; Start of HBIOS 32 byte control block - ELSE -MEMTOP EQU HBLOC - 1 ; Start of HBIOS 512 byte proxy - ENDIF - - IF INTPXY -HB_EI MACRO - ENDM -HB_DI MACRO - ENDM - ELSE -HB_EI MACRO - EI - ENDM -HB_DI MACRO - DI - ENDM - ENDIF diff --git a/Source/BPBIOS/romwbw-sim.lib b/Source/BPBIOS/romwbw-sim.lib deleted file mode 100644 index d666295f..00000000 --- a/Source/BPBIOS/romwbw-sim.lib +++ /dev/null @@ -1,82 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::::::::::********************** -; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** -; HBIOS specific customizations -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; BIOS Configuration Equates and Macros -; -; NOTE: Must make sure settings below match hardware and -; HBIOS configuration. -; -HBIOS EQU YES ; Use HBIOS functions -HBLOC EQU 0FE00H ; Location of HBIOS proxy (used if not INTPXY) -; -; Set exactly one of the following to YES to specify platform -; -N8VEM EQU YES -ZETA EQU NO -ZETA2 EQU NO -N8 EQU NO -MK4 EQU NO -; -; Set either the following to YES (or both to NO for no clock code) -; -SIMHCLK EQU NO ; Direct SIMH clock access -HBCLK EQU YES ; HBIOS clock driver -; -; Set HB_IODEV to appropriate console device -; -HB_IODEV EQU 0 ; Assume we want to use first HBIOS serial device -; -; Set HB_HDDEV to appropriate hard disk driver -; -HB_HDDEV EQU 2 ; Assumes disk device #2 is first hard disk device -; -; Set HB_MDDEV to appropriate memory disk driver -; -HB_MDDEV EQU 0 ; Assumes disk device #0 is ROM disk device -; -; RAM/ROM disk sizes expressed as count of 2K blocks -; -HB_RAMBLKS EQU 192 ; 512K - 128K reserved / 2K per block -HB_ROMBLKS EQU 192 ; 512K - 128K reserved / 2K per block -;HB_ROMBLKS EQU 448 ; 1024K - 128K reserved / 2K per block -; -; Layout of RAM banks -; - IF N8VEM OR ZETA OR ZETA2 OR MK4 -BID_RAMD EQU 80H -BID_RAMM EQU 8BH -BID_SYS EQU 8CH -BID_HB EQU 8DH -BID_USR EQU 8EH -BID_COM EQU 8FH - ENDIF - IF N8 -BID_RAMD EQU 80H -BID_RAMM EQU 9BH -BID_SYS EQU 9CH -BID_HB EQU 9DH -BID_USR EQU 9EH -BID_COM EQU 9FH - ENDIF -; - IF INTPXY -MEMTOP EQU 0FFE0H - 1 ; Start of HBIOS 32 byte control block - ELSE -MEMTOP EQU HBLOC - 1 ; Start of HBIOS 512 byte proxy - ENDIF - - IF INTPXY -HB_EI MACRO - ENDM -HB_DI MACRO - ENDM - ELSE -HB_EI MACRO - EI - ENDM -HB_DI MACRO - DI - ENDM - ENDIF diff --git a/Source/BPBIOS/romwbw.lib b/Source/BPBIOS/romwbw.lib index d666295f..36cc0d2c 100644 --- a/Source/BPBIOS/romwbw.lib +++ b/Source/BPBIOS/romwbw.lib @@ -1,6 +1,6 @@ ;:::::::::::::::::::::::::::::::::::::::::::::::********************** ; B/P BIOS Configuration and Equate File. ** System Dependant ** -; - D-X Designs Pty Ltd P112 CPU Board - ********************** +; - Retro-Brew Processors W/ RomWBW HBIOS - ********************** ; HBIOS specific customizations ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; BIOS Configuration Equates and Macros @@ -9,74 +9,64 @@ ; HBIOS configuration. ; HBIOS EQU YES ; Use HBIOS functions -HBLOC EQU 0FE00H ; Location of HBIOS proxy (used if not INTPXY) +HBLOC EQU 0FE00H ; Location of HBIOS proxy +MEMTOP EQU HBLOC - 1 ; Last usable address ; -; Set exactly one of the following to YES to specify platform +HB_DEBUG EQU FALSE ; See hbios.z80 file ; -N8VEM EQU YES -ZETA EQU NO -ZETA2 EQU NO -N8 EQU NO -MK4 EQU NO +; Set HB_IODEV to desired HBIOS character device unit number ; -; Set either the following to YES (or both to NO for no clock code) +; TODO: Query system via HBIOS API to determine number of serial +; devices available and assign up to 3 of them to the 3 serial +; device slots in BPBIOS at boot. ; -SIMHCLK EQU NO ; Direct SIMH clock access -HBCLK EQU YES ; HBIOS clock driver +HB_IODEV EQU 80H ; 0x80 is current HBIOS console ; -; Set HB_IODEV to appropriate console device +; Set HB_MDRAM/ROM to desired HBIOS disk device numbers ; -HB_IODEV EQU 0 ; Assume we want to use first HBIOS serial device +HB_MDRAM EQU 0 ; HBIOS Disk Unit #0 is usually the RAM Disk +HB_MDROM EQU 1 ; HBIOS Disk Unit #1 is usually the ROM Disk ; -; Set HB_HDDEV to appropriate hard disk driver +; Set HB_HDDEVN to appropriate HBIOS disk device numbers ; -HB_HDDEV EQU 2 ; Assumes disk device #2 is first hard disk device +; If the RomWBW system has no floppy drives, then the hard disk units +; will start right after the memory disk units. So, the first hard disk +; will be unit #2. Refer to the DPH entries to see how the HBIOS +; units are mapped to drive letters. ; -; Set HB_MDDEV to appropriate memory disk driver +HB_HDDEV0 EQU 2 ; If no floppy drives in system, first HBIOS hard disk is unit #2 +HB_HDDEV1 EQU 3 ; Second hard disk is HBIOS Disk Device #3 +HB_HDDEV2 EQU 4 ; Third hard disk is HBIOS Disk Device #4 ; -HB_MDDEV EQU 0 ; Assumes disk device #0 is ROM disk device +; Floppy disk support ; -; RAM/ROM disk sizes expressed as count of 2K blocks +; TODO: Query HBIOS to see if system has floppy drive(s). For now +; we do not really support floppy drives. ; -HB_RAMBLKS EQU 192 ; 512K - 128K reserved / 2K per block -HB_ROMBLKS EQU 192 ; 512K - 128K reserved / 2K per block -;HB_ROMBLKS EQU 448 ; 1024K - 128K reserved / 2K per block +DRV_O SET NO ; YES if system has flopy drives +DRV_P SET NO ; YES if system has flopy drives +; +; RAM/ROM Bank Reserve +; +HB_RAMRESV EQU 8 ; RAM reserve is 8 banks +HB_ROMRESV EQU 4 ; ROM reserve is 4 banks ; ; Layout of RAM banks ; - IF N8VEM OR ZETA OR ZETA2 OR MK4 -BID_RAMD EQU 80H -BID_RAMM EQU 8BH -BID_SYS EQU 8CH -BID_HB EQU 8DH -BID_USR EQU 8EH -BID_COM EQU 8FH - ENDIF - IF N8 -BID_RAMD EQU 80H -BID_RAMM EQU 9BH -BID_SYS EQU 9CH -BID_HB EQU 9DH -BID_USR EQU 9EH -BID_COM EQU 9FH - ENDIF -; - IF INTPXY -MEMTOP EQU 0FFE0H - 1 ; Start of HBIOS 32 byte control block - ELSE -MEMTOP EQU HBLOC - 1 ; Start of HBIOS 512 byte proxy - ENDIF - - IF INTPXY -HB_EI MACRO - ENDM -HB_DI MACRO - ENDM - ELSE +; TODO: Query system via HBIOS API to determine the actual bank +; assignments, then adjust BPBIOS operation accordingly. +; +BID_RAMD EQU -16 ; 90h - 16 = 80h +BID_RAMM EQU -9 ; 90h - 9 = 87h +BID_SYS EQU -4 ; 90h - 4 = 8Ch +BID_HB EQU -3 ; 90h - 3 = 8Dh +BID_USR EQU -2 ; 90h - 2 = 8Eh +BID_COM EQU -1 ; 90h - 1 = 8Fh +; HB_EI MACRO EI ENDM HB_DI MACRO DI ENDM - ENDIF + \ No newline at end of file diff --git a/Source/BPBIOS/sectran.z80 b/Source/BPBIOS/sectran.z80 index 5b021f93..bbe05dde 100644 --- a/Source/BPBIOS/sectran.z80 +++ b/Source/BPBIOS/sectran.z80 @@ -1,9 +1,9 @@ -;************************************************************************ -; S e c t o r T r a n s l a t i o n R o u t i n e +;****************************************************************** +; S e c t o r T r a n s l a t i o n R o u t i n e ; ; 1.0 - 3 Jul 92 - First General Release. HFB ; 0.0 - 12 Jun 91 - Initial Test Release HFB -;************************************************************************ +;****************************************************************** CSEG @@ -102,4 +102,4 @@ PHYLP1: DJNZ PHYLOP ; Loop as required RET ; Exit w/ logical host sector in A ;========================== End of SECTRAN ================================ - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/selrwd.z80 b/Source/BPBIOS/selrwd.z80 index efb7665e..255878bd 100644 --- a/Source/BPBIOS/selrwd.z80 +++ b/Source/BPBIOS/selrwd.z80 @@ -18,7 +18,7 @@ SELDSK: JP SELDKV COMMON /BANK2/ SELDKV: - ENDIF + ENDIF ; BANKED LD A,C ; Set disk to seek LD (SEKDSK),A PUSH DE ; Save new mount flag @@ -33,7 +33,8 @@ SELDKV: DEC HL LD A,(HL) LD (SEKPDN),A ; Save physical drive number - DEC HL ; advance to Driver Type (Hard/Floppy/RAM) + DEC HL ; advance to Driver Type (1=Floppy, + ; 2=Hard drive & 3=Memory drive) LD A,(HL) ; and Get it DEC HL ; Now advance to Drive Type Byte CP 1 ; Is this a Floppy Drive? @@ -114,17 +115,17 @@ DVRVCT: DEFW SELERR ; Driver 0 Select DEFW HDREAD ; Driver 2 Read DEFW HDWRIT ; Driver 2 Write ENDIF ; harddsk - IF [RAMDSK AND NOT HARDDSK] - DEFW SELERR ; Driver 2 Select (Dummy if No Hard Drive) - DEFW ISTRUE ; Driver 2 Read - DEFW ISTRUE ; Driver 2 Write - ENDIF ;ramdsk & not harddsk - - IF RAMDSK - DEFW SELRAM ; Driver 3 Select (RAM Drive) - DEFW RAMRD ; Driver 3 Read - DEFW RAMWR ; Driver 3 Write - ENDIF ;ramdsk +; IF [RAMDSK AND NOT HARDDSK] +; DEFW SELERR ; Driver 2 Select (Dummy if No Hard Drive) +; DEFW ISTRUE ; Driver 2 Read +; DEFW ISTRUE ; Driver 2 Write +; ENDIF ;ramdsk & not harddsk + +; IF RAMDSK +; DEFW SELHD ; Driver 3 Select (RAM Drive) +; DEFW HDREAD ; Driver 3 Read +; DEFW HDWRIT ; Driver 3 Write +; ENDIF ;ramdsk SELERR: LD HL,0 ; Send null DPH pointer back to caller RET @@ -236,4 +237,4 @@ SEKPDN: DEFS 1 ; Physical drive number to use SEKDVT: DEFS 1 ; Drive type byte for selected drive ;============================= End of SELRWD ============================== - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/suportww.lbr b/Source/BPBIOS/suportww.lbr new file mode 100644 index 00000000..04760f13 Binary files /dev/null and b/Source/BPBIOS/suportww.lbr differ diff --git a/Source/BPBIOS/support.txt b/Source/BPBIOS/support.txt new file mode 100644 index 00000000..db70c39d --- /dev/null +++ b/Source/BPBIOS/support.txt @@ -0,0 +1,95 @@ +This library contains a number of support files, programs and scripts needed +to bring up a fully functioning BPBIOS Zsystem. These programs and files +are used and/or loaded by the startup scripts. + +Some of the support files are startup ZEX scripts, some are Z3+ segment files, +others are Date and Time stamp drivers, some are command line editors and +history shells others are needed to initialize the RAMDRIVE as well as help files. + +The following table shows which files are needed to support each of the ten +BPBIOS variants (BP33, BP33BNK, BP34, BP34BNK & BBP41BNK). + +Variant Name BP33 BP33BNK BP34 BP34BNK BP41BNK +================================================================ +bpbio.ndr X X X +bpbioz33.ndr X X +BPCNFG.COM X X X X X +EASE.COM X X +EASE.HLP X X +fcp-4.zrl X X +fcp-4t.zrl X X X +RELOG X X X X X +HELPLSH.COM X X X +IF.COM X X X X +jetldr.com X X X X X +LDTIMEC.COM X X X +LSH.COM X X X +LSHF.COM* X X X +LSHF.VAR* X X X +myterm.z3t X X X X X +nzdec23d.z3t X X X X X +PUTDS.COM X X X X X +RAMFILES.TXT X X X X X +RCOPY.COM X X X X X +rcp-16h.zrl X X X X +SAVE.COM X X X X +Z33.ZEX X X +ZEX.COM X X X X X +ZPATH.COM X X X X X +ZSCFG2.COM X +ZSTF.ZEX X +ZST.ZEX X X + + +Instructions: + The support files are "crunched" and stored in the library file +SUPPORT.LBR. Place SUPPORT.LBR on the RAMDRIVE using for example +XModem. Use LBREXT with the /U option to extract and uncrunch the +files. First extract ZEX.COM while logged onto the A: drive with the +following command: + B0:LBREXT SUPPORT C0:ZEX.C?M /U +Next place all the .COM files on C15: by typing: + B0:LBREXT SUPPORT C15:*.C?M /U +The remaining files should be placed on C0:. + B0:LBREXT SUPPORT C0:*.Z?X /U + B0:LBREXT SUPPORT C0:*.Z?L /U + B0:LBREXT SUPPORT C0:*.N?R /U + B0:LBREXT SUPPORT C0:*.Z?T /U + B0:LBREXT SUPPORT C0:*.T?T /U + B0:LBREXT SUPPORT C0:*.H?P /U + +Note in all BPBIOS variants that A: is the RAMDRIVE, B: is +the ROMDRIVE and C: is the system drive. Hard drive slices occupy C: +through N: and floppy drives are O: & P:. A short desciption +of each of the support files follows: + +bpbioz33.ndr - Named Directory Table for Z33 +bpbio.ndr - Named Directory Table for Z34 & Z41 +BPCNFG.COM - BPBIOS configuration program +EASE.COM - Command line editor & history shell for Z33* +EASE.HLP - Help file for EASE +fcp-4.zrl - Z33 Flow Control Processor (handles IF, ELSE etc) +fcp-4t.zrl - Z34 & Z41 Flow Control Processor (IF is transient) +RELOG.COM - Enables date stamping on RAM drive. +HELPLSH.COM - Help file for LSH +if.com - Adds tests to fcp-4t +jetldr.com - Loads Zsystem segments +LDTIMEC.COM - Date stamping & clock drivers for z33* & Z34* variants +LSH.COM - Command line editor & history shell for Z34 & Z41 +LSHF.COM - LSH with a fixed length History file (runs faster) +LSHF.VAR - History file for LSHF +myterm.z3t - Terminal Capabilities file (defines ESC sequences etc) +NZDEC23D.Z3T - VT100 Terminal Capabilities File. +PUTDS.COM - Installs date stamping for RAM drive. +RAMFILES.TXT - List of frequently used command (edit to suit) +RCOPY.COM - Copies files listed in RAMFILES.TXT to RAMDRIVE +rcp-16h.zrl - Zsystem Resident Command Processor +SAVE.COM - Transient save command loads at 8000h +Z33.ZEX - Automatically executed Startup script for Z33 variants +ZEX.COM - Memory resident SUBMIT - executes startup scripts +ZPATH.COM - Loads the Zsystem & ZSDOS search paths +ZSCFG2.COM - Configures ZSDOS 2 +ZSTF.ZEX - Automatically executed Startup script for BP41BNK +ZST.ZEX - Automatically executed Startup script for BP34* + +Note that clock & datestamping drivers are builtin to Z41. \ No newline at end of file diff --git a/Source/BPBIOS/tim-dx.z80 b/Source/BPBIOS/tim-dx.z80 deleted file mode 100644 index 7b15f523..00000000 --- a/Source/BPBIOS/tim-dx.z80 +++ /dev/null @@ -1,415 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::*************************** -; Time-handling Routines ** Machine-Dependant ** -; D-X Designs Pty Ltd, P112 *************************** -; -; This module incorporates provisions for an interrupt-driven clock, or -; the Dallas DS-1202 Real Time Clock for obtaining Time and Date Info. -; -; 1.0 - 18 Jul 96 - Initial Release. HFB -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -; This code module should handle all Time-related segments, to include -; Interrupt handlers for Real Time update, motor timeouts, user down- -; counter and any necessary time format conversion routines. - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; TIMER -; This routine keeps the Real Time Clock, Diskette Time Out -; counter, and General-Purpose down-counters. An interrupt is -; generated every 50 mS by the Z-182 Programmable Interrupt Timer -; and used to update parameters. Every other interrupt (100 mS -; intervals) is used to update the 100 mS counters and Time string -; if using Interrupt-driven Time and Date. -; Enter: No parameters needed (Interrupt) -; Exit : None -; Uses : None. All registers preserved. Decrements MTM, User and BIOS -; general-purpose counter bytes every 100 mS. -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - CSEG - -; Come here every 50 milliseconds from Programmable Reload Timer 0 - -TIMER: DI ; Don't Interrupt from here - LD (TIMSTK),SP ; Save entry Stack Pointer - LD SP,TIMSTK ; ..set up Local Interrupt Stack - PUSH HL - PUSH AF ; Save the registers - - IN0 A,(TCR) - IN0 A,(TMDR0L) - IN0 A,(TMDR0H) ; Clear the interrupt - - LD HL,FLAG50 ; Point to 50 mS Flag - LD A,(HL) ; fetch - XOR 01H ; and toggle LSB - LD (HL),A ; Re-save - JR NZ,TDONE ; ..exit if Odd 50 mS Tick - - LD HL,DCNTR ; Adjust User GP Down-Counter - DEC (HL) - - LD HL,MTM ; Adjust Bios GP Down-Counter - DEC (HL) - - INC HL ; Point to Motor On-timer (MOTIM) - LD A,(HL) - OR A ; Already Timed Out? - JR Z,TIMER0 ; ..jump if So - DEC (HL) ; Else count down - CALL Z,MOTOFF ; turning Motors Off if timed out -TIMER0: - -; Adjust the Interrupt-driven Real Clock (if no Real Time Clock exists). -; This "Clock" maintains Date and Time in a DateStamper(C) compatible -; string per ZSDOS specifications. - - IF CLOCK AND [NOT DS1202] - LD HL,TENTHS ; 100ms counter - INC (HL) ; Bump Tenths-of-Seconds - LD A,(HL) ; get the value - SUB 10 ; Subtract limit value (in decimal times 2) - JR NZ,TDONE ; jump to exit if no rollover - LD (HL),A ; Else save a zero - DEC HL ; back down time string - - LD A,(HL) ; Get Seconds - INC A ; bump - DAA ; in BCD - LD (HL),A ; and save - SUB 60H ; Subtract limit value - JR NZ,TDONE ; ..jump to exit if no rollover - LD (HL),A ; Else save a zero - DEC HL ; back down time string - - LD A,(HL) ; Get Minutes - INC A ; bump - DAA ; in BCD - LD (HL),A ; and save - SUB 60H ; Subtract limit value - JR NZ,TDONE ; ..jump to exit if no rollover - LD (HL),A ; Else save a zero - DEC HL ; back down time string - - LD A,(HL) ; Get Hours - INC A ; bump - DAA ; in BCD - LD (HL),A ; and save - SUB 24H ; Subtract limit value - JR NZ,TDONE ; ..jump to exit if no rollover - LD (HL),A ; Else save a zero - DEC HL ; back down time string - - LD A,(HL) ; Get Day - INC A ; bump - DAA ; in BCD - LD (HL),A ; and save - PUSH DE ; Save regs - PUSH AF - EX DE,HL - LD HL,DPM-1 ; Point to days per month table indexed base 1 - DEC DE ; back up to Months byte - LD A,(DE) - INC DE ; move ptr back - CP 10 ; >Sept? - JR C,TIMER1 ; ..jump if Not - SUB 6 ; Else convert BCD to binary -TIMER1: CALL ADDAHL ; Offset into table based on Month - POP AF ; Get current day count - CP (HL) ; Time for new month? - EX DE,HL ; (put regs back) - POP DE - JR C,TDONE ; ..exit here if not time - LD (HL),1 ; Else start out on first of month - DEC HL ; back down to month - - LD A,(HL) ; Get month - INC A ; Bump - DAA ; in BCD - LD (HL),A ; and save - SUB 13H ; Time for new year? - JR C,TDONE ; ..exit if not - LD (HL),1 ; Else start at month 1 (Jan) - DEC HL ; back up to Years byte - - LD A,(HL) ; Get Year - INC A ; bump - DAA ; in BCD - LD (HL),A ; and save - SUB 99H ; Time for next century? - JR NZ,TDONE ; ..exit if not - LD (HL),A ; Else save 0 year - - ENDIF ;Clock & Not DS1202 - -TDONE: POP AF - POP HL ; Restore registers - LD SP,(TIMSTK) ; and Stack Pointer - EI ; allow Ints again - RET - - IF CLOCK AND [NOT DS1202] ; Table of Days-per-Month -DPM: DEFB 31H+1, 28H+1, 31H+1 ; January, February, March - DEFB 30H+1, 31H+1, 30H+1 ; April, May, June - DEFB 31H+1, 31H+1, 30H+1 ; July, August, September - DEFB 31H+1, 30H+1, 31H+1 ; October, November, December - ENDIF ;Clock & Not Ds1202 - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; TIME - Set or Return the time string as defined for ZSDOS. If Reading, -; The Six digit BCD ZSDOS Clock string is copied to the location -; addressed by Register pair DE. As an enhancement, the tenths-of-seconds -; value is returned in Reg D. If Setting the Clock, the RTC clock string -; will be set from the 6 bytes addressed by DE. -; -; ENTER: C - 0 to Read the Clock, Non-0 (1 recommended) to Set the Clock -; DE = Pointer to receive 6-byte Time/Date on Read, Source for Set -; -; EXIT : E = Original contents of Target Seconds field -; D = Tenths of Seconds field -; HL = Pointer to Target Seconds field -; A = 1 for success, 0 if Unable to Set or Read -; BC = Address of User General-Purpose Down-Counter -; -; NOTE: The Wall Clock string is arranged as BCD digits with Tenths- -; of-Seconds byte appended. The entire string is: -; -; YR MO DA HH MM SS TT -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - IF CLOCK AND DS1202 -; Dallas DS-1202 Clock Interface on the D-X Designs Pty Ltd P112. -; Read the Clock to a buffer area in Memory. Seven bytes (Six used) are -; read in burst mode from the clock chip, one bit at a time via three bits -; from one of the Z-182 parallel ports. When Setting the clock from this -; code fragment, the DOW is forced to 01H, which will probably be invalid. -; The Clock is accessed serially (LSB first) one byte at a time with a -; command byte being written to begin the Read/Write. Burst Mode is used -; with a 0BFH byte for Reading, 0BEH for Writing as the Command. Clock -; Setting clears the Write Protect bit before setting, and resets the chip -; to Read-Only when finished. The Entire Date/Time String is eight bytes -; read as: -; -; Sec Min Hour Day Mon DOW Year WProt -; (12/24) (MSB) -; -; In this implementation, the DOW field is not used, and the 12/24 hour bit -; is always set to 24-hour mode by setting the MSB to 1. - -RTCRst EQU 2 ; DS-1202 Reset\ Bit -RTCClk EQU 1 ; DS-1202 Clock Bit -RTCDat EQU 0 ; DS-1202 Data IO Bit - -TIME: DI ; NO INTERRUPTS in This Routine - LD (TIMSTK),SP ; Save Entry Stack Ptr - LD SP,TIMSTK ; and Set Local Stack - LD A,C ; Get Clock Operation Flag - OR A ; Is it a Write? - PUSH AF ; (save) - CALL CSETUP ; Set Clock to Read, returning BC->DRA Port - LD DE,5 ; (above also moved ptr to HL) - ADD HL,DE ; offset to Seconds Field - POP AF ; (restore Write flag) - IF CLKSET - JR NZ,TIMSET ; ..jump if Write and Set allowed - ELSE - LD A,00 ; (preset Error Condition) - JR NZ,NOCLOK ; ..jump to Error if Set Not allowed - ENDIF - LD E,(HL) ; Else Read, so fetch orig contents - PUSH DE ; (Save for Exit) - PUSH HL ; (and preserve ptr) - -; Command the DS-1202 for Burst Read of Clock - - LD A,0BFH ; Load the Burst Clock Read Command - CALL Wr1202 ; and Send it - -; Read the Clock Data. D still 0 from above Load, use as Byte Index - -RdTim0: PUSH HL ; Save Ptr - LD E,8 ; Gather 8 bit for a byte -RdTim1: IN A,(C) ; Read Port - RES RTCClk,A ; Clock LO - OUT (C),A ; Set - NOP ; (settle) - IN A,(C) ; Read Bit to LSB - RRCA ; Data Bit to Carry - RR L ; to MSB of Accum - RLCA ; restore Parallel Port bits - SET RTCClk,A ; Clock HI - OUT (C),A ; Set - DEC E ; Byte Done? - JR NZ,RdTim1 ; ..jump if Not - - LD E,L ; Else Get Byte - POP HL ; Restore Ptr to Dest - LD A,D ; Get Index - CP 5 ; Day-Of-Week? - JR Z,RdTim2 ; ..jump if So, bypassing save - LD (HL),E ; Save value in output string - DEC HL ; back down to previous byte in output -RdTim2: INC D ; increment index - CP 6 ; Did we just save Year? - JR NZ,RdTim0 ; ..get another byte if So - CALL CClose ; Else Deselect Clock - POP HL ; Restore Ptr - POP DE ; Orig Seconds content (and 0 Tenths) -ClkExt: LD A,01H ; Set Good Exit -NOCLOK: LD SP,(TIMSTK) ; Restore entry Stack - LD BC,DCNTR ; Get Address of User Down-Counter - EI ; Ints Ok now - RET ; and Quit - -;..... -; Set the Clock if code assembly option set -; Enter: BC = DRA Address -; D = 0 (used as count of bytes written) -; HL -> Seconds of ZSTime string - - IF CLKSET -WrTim: LD A,8EH - CALL Wr1202 ; Turn Write Protect OFF - XOR A - CALL Wr1202 ; by clearing MSB of Time+6 - CALL CClose ; then terminate Clock Access - CALL COpen ; Start Clock access again -WrTim0: LD A,D ; Get Index 0..7 of Write String - CP 8 ; At End? - JR Z,WrTimX ; ..quit if So - CP 6 ; Year or WrProtect? - JR C,WrTim1 ; .jump if Not - JR Z,WrTim2 ; ..jump if Year - LD A,80H ; Else Write Protect On since last byte - JR WrTim3 ; ..do It! - -WrTim1: CP 5 ; DOW? - LD A,01H ; (set default if So) - JR Z,WrTim3 ; ..set if So -WrTim2: LD A,(HL) ; Else Get Byte from ZSTime String - DEC HL ; back up for Next Byte -WrTim3: CALL Wr1202 ; Write Byte to Clock - INC D ; bump index of bytes written - JR WrTim0 ; ..continue til Done - -WrTimX: CALL CClose ; Terminate Clock Access - JR ClkExt ; ..and Exit - ENDIF - -;..... -; Set up DS-1202 interface from Z80182 Parallel port -; Entry: None -; Exit : BC -> Data Port w/Clk at bits 0-2 -; Uses : AF,BC,DE - -CSETUP: EX DE,HL ; Move Pointer to HL -COpen: LD BC,DDRA ; Address Parallel Port A Control - IN A,(C) ; Read Settings - SET RTCDat,A ; Data Line to Input - OUT (C),A ; and Set - INC BC ; Address Parallel Port A (DRA) - IN A,(C) ; Fetch settings - RES RTCClk,A ; Clk LO to Start - OUT (C),A ; (set) - SET RTCRst,A ; Clear Reset to HI - OUT (C),A ; (set) - RET - -;..... -; Write the Byte in A to the clock (used for Command) -; Entry: BC -> Data Port (DRA) -; Exit : None -; Uses : AF,E - -Wr1202: PUSH HL ; Save Regs - LD L,A ; Store byte - LD E,8 ; set bit count - IN0 A,(DDRA) ; Fetch Def'n Reg contents - RES RTCDat,A ; Data Line to Output - OUT0 (DDRA),A ; (set) -Wr120L: IN A,(C) ; Read Parallel Port - RES RTCClk,A ; Clk LO - OUT (C),A ; (set) - SRL A ; (clear LSB) - RR L ; Data Byte LSB to Carry - RLA ; then to Parallel Port LSB - OUT (C),A ; (set) - SET RTCClk,A ; Clk HI - OUT (C),A ; (set) - DEC E ; Eight Bits Sent? - JR NZ,Wr120L ; ..loop if Not - - IN0 A,(DDRA) - SET RTCDat,A ; Set Port to Data IN - OUT0 (DDRA),A - POP HL ; Restore Regs - RET - -;..... -; Deselect the Clock for Exit -; Enter: BC -> Z80182 Parallel Port A -; Exit : None -; Uses : AF - -CClose: IN A,(C) ; Fetch Parallel Port - SET RTCClk,A ; Clk to HI - OUT (C),A - RES RTCRst,A ; Reset Active LO - OUT (C),A - RET - - ENDIF ;Clock & Ds1202 -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - IF CLOCK AND [NOT DS1202] ; Not Dallas, make Intrpt Code - -TIME: LD A,C ; Get Clock Operation Flag - LD BC,5 ; and set up for ZSDOS Read/Write - LD HL,YEAR ; Pointing to Clock String - OR A ; Is it a Read? - JR Z,TIMES ; ..jump it so - EX DE,HL ; Else swap pointers for write -TIMES: DI ; disable Interrupts - LDIR ; and move 5 bytes of 6 bytes (.1 Sec = 7) - LD C,(HL) ; Get the Seconds byte - INC HL ; bump to 1/10th Seconds - LD H,(HL) ; and Get - EI ; Re-enable Interrupts - EX DE,HL ; Swap pointers - LD E,(HL) ; Preserve original Sec field contents in E - LD (HL),C ; and store the Seconds byte (.1 Sec in D) - LD BC,DCNTR ; Get Address of User Down-Counter - LD A,01 ; Set Ok exit value of 1 - RET - - ENDIF ;Clock & Not Ds1202 - IF NOT CLOCK ; If No Clock.. - XOR A ; Set Error Return - RET ; and exit - - ELSE - DSEG - -; Real Time Clock Buffer - IF NOT DS1202 ; Don't need this if D-X Designs P112 -YEAR: DEFS 1 ; Year - packed BCD - DEFS 1 ; Month - packed BCD - DEFS 1 ; Day - packed BCD - DEFS 1 ; Hour - packed BCD - DEFS 1 ; Minute - packed BCD - DEFS 1 ; Seconds - packed BCD -TENTHS: DEFS 1 ; Tenths of Seconds - Binary (Int, else..) - ENDIF - ENDIF ;Clock - -;..... -; Save some space in the Common RAM Area for a local stack - - DSEG -DCNTR: DEFS 1 ; User 100 mS General-Purpose Down-Counter -FLAG50: DEFS 1 ; Flag for dividing 50mS to 100mS ticks - DEFS 12 ; We use 6 levels of stack (worst case) -TIMSTK: DEFS 2 ; Store the entry Stack pointer here - CSEG ; End up by restoring CSEG - -;=========================== END of TIM-DX ================================== - \ No newline at end of file diff --git a/Source/BPBIOS/tim-ww.z80 b/Source/BPBIOS/tim-ww.z80 index ab2563d7..ba6b519a 100644 --- a/Source/BPBIOS/tim-ww.z80 +++ b/Source/BPBIOS/tim-ww.z80 @@ -1,36 +1,19 @@ ;:::::::::::::::::::::::::::::::::::::::*************************** ; Time-handling Routines ** Machine-Dependant ** -; D-X Designs Pty Ltd, P112 *************************** +; Retro-Brew Hardware with HBIOS *************************** ; -; This module incorporates provisions for an interrupt-driven clock, or -; the Dallas DS-1202 Real Time Clock for obtaining Time and Date Info. +; This module incorporates provisions for an HBIOS clock for +; obtaining Time and Date Info. ; +; 1.1 - 24 Mar 14 - Initial N8VEM test release WW-LN ; 1.0 - 18 Jul 96 - Initial Release. HFB -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; This code module should handle all Time-related segments, to include -; Interrupt handlers for Real Time update, motor timeouts, user down- -; counter and any necessary time format conversion routines. - -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -; TIMER -; This routine keeps the Real Time Clock, Diskette Time Out -; counter, and General-Purpose down-counters. An interrupt is -; generated every 50 mS by the Z-182 Programmable Interrupt Timer -; and used to update parameters. Every other interrupt (100 mS -; intervals) is used to update the 100 mS counters and Time string -; if using Interrupt-driven Time and Date. -; Enter: No parameters needed (Interrupt) -; Exit : None -; Uses : None. All registers preserved. Decrements MTM, User and BIOS -; general-purpose counter bytes every 100 mS. -;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; This code module should handle all Time-related segments +; including any necessary time format conversion routines. CSEG -TIMER: - RET ; NOT IMPLEMENTED FOR HBIOS - ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; TIME - Set or Return the time string as defined for ZSDOS. If Reading, ; The Six digit BCD ZSDOS Clock string is copied to the location @@ -55,46 +38,15 @@ TIMER: IF CLOCK - IF SIMHCLK -SIMHPORT EQU 0FEH -READCLOCK EQU 7 -WRITECLOCK EQU 8 -PARBLOCKSIZE EQU 6 - TIME: - EX DE,HL ; GET DE TO HL LD A,C OR A JR NZ,WRCLK ; -GETTIM: LD A,READCLOCK - OUT (SIMHPORT),A - LD BC,256*(PARBLOCKSIZE-1)+SIMHPORT ; B := 5, C := 0FEH - INIR - LD E,(HL) ; Save original seconds in E - INI ; READ SECONDS - DEC HL - LD A,1 ; Set OK status return - LD BC,DCNTR ; Get Address of User Down-Counter - RET ; -WRCLK: LD A,WRITECLOCK - OUT (SIMHPORT),A - LD A,L - OUT (SIMHPORT),A - LD A,H - OUT (SIMHPORT),A - LD A,1 - LD BC,DCNTR ; Get Address of User Down-Counter - RET - ENDIF ; SIMHCLK - - IF HBCLK - -TIME: - LD A,C - OR A - JR NZ,WRCLK +;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - +; R e a d T h e C l o c k +;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; RDCLK: PUSH DE ; Save the final destination @@ -117,6 +69,11 @@ RDCLK: LD A,1 ; Signal success RET +; + if CLKSET +;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +; S e t T h e C l o c k +;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; WRCLK: EX DE,HL ; Make incoming DE the copy source in HL @@ -131,26 +88,21 @@ WRCLK: LD A,1 ; Signal success RET - - ENDIF ; HBCLK - + else XOR A ; Set Error Return RET ; and exit - + endif ; clkset ENDIF ; Clock ;..... -; Save some space in the Common RAM Area for a local stack +; Buffer space in the Common RAM Area for Time & Date DSEG - -DCNTR: DEFS 1 ; User 100 mS General-Purpose Down-Counter - - IF HBCLK -TIMBUF DEFS 6 - ENDIF +DCNTR: DEFS 1 +TIMBUF: DEFS 6 CSEG ; End up by restoring CSEG -;=========================== END of TIM-DX ================================== +;=========================== END of TIM-WW ================================== + \ No newline at end of file diff --git a/Source/BPBIOS/util.z80 b/Source/BPBIOS/util.z80 index 4602fcfa..b5ba21fb 100644 --- a/Source/BPBIOS/util.z80 +++ b/Source/BPBIOS/util.z80 @@ -1,5 +1,5 @@ ;:::::::::::::::::::::::::::::::::::::::***************************** -; UTIL - N8VEM Utility Routines ***** Hardware-Specific ***** +; UTIL - Retro-Brew Utility Routines ***** Hardware-Specific ***** ; ***************************** ; ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -306,8 +306,11 @@ COUT: PUSH BC PUSH DE PUSH HL - LD C,A - CALL CONOUT + ;LD C,A + ;CALL CONOUT + LD E,A ; OUTPUT CHAR TO E + LD BC,0180H + CALL HBX_INVOKE POP HL POP DE POP BC @@ -333,3 +336,4 @@ STR_EMPTY DEFB "$" ; DSEG ; Put the following areas in Data Segment (uninitialized REAM) ; ;======================= End of UTIL ============================== + \ No newline at end of file diff --git a/Source/BPBIOS/wboot-dx.z80 b/Source/BPBIOS/wboot-dx.z80 deleted file mode 100644 index 03fd31d0..00000000 --- a/Source/BPBIOS/wboot-dx.z80 +++ /dev/null @@ -1,183 +0,0 @@ -;:::::::::::::::::::::::::::::::::::::::************************************ -; Warm Boot Routine *** Machine Dependant for Moves *** -; - D-X Designs Pty Ltd P112 - *** and custom load formatting *** -; ************************************ -; 1.0 - 12 Jun 96 - Initial Release for P112 from YASBEC. HFB -;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - CSEG - -WBOOT: - IF BANKED - LD A,(TPABNK) ; Get TPA Bank # in case currently in Bank - CALL SELMEM ; ..and make current - LD SP,USP ; Set stack in high memory - ELSE - LD SP,80H ; Use space below default buffer - ENDIF - IF FASTWB - LD HL,SARL ; Point to DMA Initialization block -WBOOTV: CALL DMAMOV - XOR A ; Indicate "A" logged as Host Disk - LD (HSTDSK),A ; ..by showing Host Disk already logged - ELSE - IF BANKED - LD SP,USP ; If banked, use stack in high common memory - CALL GOSYSB ; Disk routines are in banked memory - ELSE - LD SP,EXTSTK+32 ; Place default stack up high - ENDIF - LD A,0FFH ; Insure the default drive is logged - LD (HSTDSK),A ; ..by unlogging the Host Disk - LD A,(SYSDRV) - LD C,A ; Select system disk - LD E,0 ; Declare new mount - CALL SELDSK ; We're going to use the system disk - LD BC,0 - CALL SETTRK ; Set track 0 - LD BC,10H*256+1 ; B sectors remaining, C first sector - LD DE,0 ; DE beginning track - -; Note that we begin by reading track 0, sector 1 since sector 0 -; contains the cold start loader, which is skipped in a warm start - - LD HL,CPR ; Base of CP/M (initial load point) -LOAD1: PUSH DE ; Load a Sector, Save Current Track - PUSH BC ; Save sectors remaining and next sector - PUSH HL ; Save DMA address - LD (DMAADR),HL ; ..in deblocker - LD HL,(SEKDPH) - LD E,(HL) - INC HL - LD D,(HL) ; Get sector XLATE address - CALL SECTRN ; Skew sector as needed - LD (SEKSEC),HL ; Save Sector # directly in deblocker - -; Drive = 0, track set, sector set, DMA address set - - CALL READ - OR A ; Any errors? - JR NZ,WBOOT ; Retry the entire boot if an error occurs - -; No error, move to next sector - - POP HL ; Recall DMA address - LD DE,128 ; DMA=DMA+128 - ADD HL,DE ; New DMA address is in H,L - POP BC ; Recall NSECTS and current sector - POP DE ; Recall current track - DEC B ; Sectors=sectors-1 - JR Z,GOZSYS ; Go to Z-System if all have been loaded - -; More sectors remain to load, check for track change - - INC C ; Increment sector count - LD A,(CPMSPT) ; Max sector +1 - CP C ; Have we reached the end? - JR NZ,LOAD1 ; If not - -; End of current track, go to next track - - INC DE ; Track=track+1 - LD C,0 ; First sector on next track - -; Save register state, and set new track - - LD (SEKTRK),DE ; Save track directly - JR LOAD1 ; For another sector - ENDIF ;fastwb - -; End load operation, set parameters & go to Z-System - -GOZSYS: LD BC,80H ; Default DMA address is 80H - CALL SETDMA - - LD A,0C3H ; C3 is a JMP instruction - LD (0),A ; For JMP to WBOOT - LD (5),A ; For JMP to BDOS - LD HL,BIOSJT+3 ; Wboot entry point - LD (1),HL ; Set address field for JMP at 0 - LD HL,(ENVADR) ; Get the pointer to the ENV - LD DE,43H ; Offset to high byte of Dos Start - ADD HL,DE - LD D,(HL) ; Load Dos start - DEC HL - LD E,(HL) - EX DE,HL ; Put Dos in HL - LD BC,6 ; .offset to Entry - ADD HL,BC - LD (6),HL ; ..and set Address field of jump at 5 to BDOS - EX DE,HL - DEC HL ; Back down to CCP entry - DEC HL - LD D,(HL) ; Get the vector - DEC HL - LD E,(HL) - IF BANKED - LD HL,CPYVEC ; Copy Page0 Vectors and RSTs to System Bank - CALL DMAMOV - LD A,(TPABNK) ; Set all Bank regs to TPA - LD (SRCBNK),A - LD (DSTBNK),A - LD (DMABNK),A - CALL SELMEM ; Insure TPA in context (also set USRBNK) - XOR A - LD (BIOSTK),A ; Init bank switcher - ENDIF - LD A,(4) ; Get current disk number - LD C,A ; Send to the CCP - EI ; Enable the interrupt system - EX DE,HL ; ..put destination in HL - JP (HL) ; Go to Z-System for further processing - -;..... -; Common DMA move sequence placed here in CSEG for Common access -; Enter with HL pointing to a DMA definition block - - IF [BANKED OR FASTWB OR RAMDSK] -DMAMOV: LD BC,8*256+SAR0L ; Send 8 bytes to Ports SAR0L - OTIMR - LD A,00000010B ; Set DMA Mode control to Burst Mode - OUT0 (DMODE),A - LD A,40H ; Enable DMA0 - OUT0 (DSTAT),A ; ..and move the block - RET - ENDIF - - IF [Z3 AND HAVIOP] -; Aux Jump Table so IOP's can find routines. After Cold Boot, the -; address of this table is placed in BIOSJT+1. - -IOPRET: JP CONST - JP CONIN - JP CONOUT - JP LIST - JP AUXOUT - JP AUXIN - JP LISTST - ENDIF - - DSEG ; Put the following areas in Data Segment - -; This table in unitialized RAM is filled from the Cold Boot module. - - IF FASTWB -SARL: DEFS 2 ; Source Segment address - DEFS 1 ; Source Bank Number - DEFS 2 ; Destination Segment address - DEFS 1 ; Destination Bank Number (TPA) - DEFS 2 ; Number of bytes to move - ENDIF ;fastwb - -; This table is used to copy Page 0 vectors from TPA to base of System bank -; on Warm Boots to insure that needed IO can vector to the correct devices. - - IF BANKED -CPYVEC: DEFS 2 ; Offset of Source area - DEFS 1 ; ..Source Bank (Base of TPA) [BNK0 SHR 1] - DEFS 2 ; Offset of Destination - DEFS 1 ; ..Dest Bank (Base of System Bank) [BNK2 SHR 1] - DEFS 2 ; Length of move - ENDIF -;========================= End of WBOOT ============================ - \ No newline at end of file diff --git a/Source/BPBIOS/wboot-ww.z80 b/Source/BPBIOS/wboot-ww.z80 index df9d135c..d23743d3 100644 --- a/Source/BPBIOS/wboot-ww.z80 +++ b/Source/BPBIOS/wboot-ww.z80 @@ -1,7 +1,8 @@ ;:::::::::::::::::::::::::::::::::::::::************************************ ; Warm Boot Routine *** Machine Dependant for Moves *** -; - D-X Designs Pty Ltd P112 - *** and custom load formatting *** +; - Retro-Brew Hardware with HBIOS - *** and custom load formatting *** ; ************************************ +; 1.1 - 28 Nov 16 - Modified for version 2.8 of HBIOS WW ; 1.0 - 12 Jun 96 - Initial Release for P112 from YASBEC. HFB ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -16,24 +17,34 @@ WBOOT: LD SP,80H ; Use space below default buffer ENDIF + ;CALL PRTSTRD ; DEBUG + ;DEFB '[WBOOT]$' ; DEBUG + IF FASTWB ; Restore command processor from ; cache in (SYSBNK):100H. We assume that the ; command processor lives in high memory. + ; + ; It is critical that we use the HB variants of MOVE and XMOVE + ; because we are moving between banks even in a non-banked + ; system! LD A,(SYSBNK) ; Source bank is SYSBNK LD C,A ; Put it in C LD A,(TPABNK) ; Destination bank is TPABNK LD B,A ; Put it in B - CALL HBX_XCOPY ; Set banks for extended copy + CALL HB_XMOVE ; Set banks for extended copy LD HL,100H ; Copy from start of cache in SYS LD DE,(CPADR) ; .. to location of command processor in TPA LD BC,(CPLEN) ; Length of command processor - CALL HBX_COPY ; Do it - + CALL HB_MOVE ; Do it +; call PRTSTRD ; DEBUG +; defb CR,LF ; DEBUG +; defb 'WB - copied C' ; DEBUG +; defb 'P','$' ; DEBUG WBOOTV: XOR A ; Indicate "A" logged as Host Disk LD (HSTDSK),A ; ..by showing Host Disk already logged - ELSE + ELSE ; FASTWB IF BANKED LD SP,USP ; If banked, use stack in high common memory CALL GOSYSB ; Disk routines are in banked memory @@ -149,7 +160,11 @@ GOZSYS: LD BC,80H ; Default DMA address is 80H ; EI ; Enable the interrupt system ; EX DE,HL ; ..put destination in HL POP HL ; Restore CCP entry address - +; call PRTSTRD ; DEBUG +; defb CR,LF ; DEBUG +; defb 'WB exi' ; DEBUG +; defb 't$' ; DEBUG +; HALT ; DEBUG JP (HL) ; Go to Z-System for further processing IF [Z3 AND HAVIOP] @@ -174,4 +189,4 @@ CPADR DEFS 2 ; Command processor address CPLEN DEFS 2 ; Command processor length ENDIF ;fastwb ;========================= End of WBOOT ============================ - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/z33.zex b/Source/BPBIOS/z33.zex index ea1e714e..8ed8d4af 100644 --- a/Source/BPBIOS/z33.zex +++ b/Source/BPBIOS/z33.zex @@ -1,3 +1,20 @@ -IOPINIT -JETLDR RCP.ZRL,SYS.NDR,FCP.ZRL,MYTERM.Z3T +;; Set the ZCPR and ZSDOS paths +c15:zpath $$$$ a0 b0 c15 c0 /d=$$$$ c15 c0 +;; Load ZCPR segments +jetldr rcp-16h.zrl,fcp-4t.zrl,bpbio.ndr,nzdec23d.z3t +;; Load date/time extension into user space +ldtimec +;; Initialize the RAM disk if needed and copy some useful files there +if ~ex a0:-ram.000 +;; Load datestamping file on a: +putds -d=a: +;; Enable datestamping +relog +save 0 a:-ram.000 +rcopy ramfiles.txt a0: /q +fi +;; Print Time & Date as a reminder in case they need setting +td +;; Load the command history shell and editor +ease  \ No newline at end of file diff --git a/Source/BPBIOS/z34.zex b/Source/BPBIOS/z34.zex deleted file mode 100644 index ea1e714e..00000000 --- a/Source/BPBIOS/z34.zex +++ /dev/null @@ -1,3 +0,0 @@ -IOPINIT -JETLDR RCP.ZRL,SYS.NDR,FCP.ZRL,MYTERM.Z3T - \ No newline at end of file diff --git a/Source/BPBIOS/z34.zrl b/Source/BPBIOS/z34.zrl new file mode 100644 index 00000000..0459f044 Binary files /dev/null and b/Source/BPBIOS/z34.zrl differ diff --git a/Source/BPBIOS/z3base.lib b/Source/BPBIOS/z3base.lib index 520777ce..b48156f6 100644 --- a/Source/BPBIOS/z3base.lib +++ b/Source/BPBIOS/z3base.lib @@ -1,8 +1,13 @@ -; B/P Bios System Z3 Definition File. +; z3base.fp -- B/P Bios System Z3 Definition File for not or partially +; banked system with 512 byte external HBIOS proxy (no +; internal proxy). ; This file is adapted from the basic Z3BASE.LIB configuration file used for ; most ZCPR33 systems. It has added the new definitions for the Resident -; User Space defined in B/P Bios descriptions. +; User Space defined in B/P Bios descriptions and modified for an HBIOS +; implementation with a full external HBIOS proxy (i.e. proxy not internal +; to BPBIOS). +; ;========================================================================= ;== NOTE: The Starting Address of the User Space marks the lower == ;== base of memory and MUST be entered. B/P Bios Utilities use == @@ -14,29 +19,30 @@ ; alternative, just leave this file alone and configure everything with ; the utilities provided. -; FFD0 - FFFF 48 Bytes ZCPR3 External Stack -; FF00 - FFCF 208 Bytes Multiple Command Line Buffer -; FE00 - FEFF 256 Bytes Environment Descriptor +; FE00 - FFFF 512 Bytes HBIOS proxy AREA in the top of ram +; FD00 - FDFF 256 Bytes Multiple Command Line Buffer +; FC00 - FCFF 256 Bytes Environment Descriptor ; Bytes 00H-7FH: Z3 Parameters ; Bytes 80H-FFH: Z3 TCAP -; FDFF 1 Byte Wheel byte -; FDF4 - FDFE 11 Bytes Path (5 elements) -; FDD0 - FDF3 36 Bytes ZCPR3 External FCB -; FD80 - FDCF 80 Bytes ZCPR3 Message Buffers -; FD00 - FD7F 128 Bytes ZCPR3 Shell Stack -; FC00 - FCFF 256 Bytes Named Directory Buffer -; FA00 - FBFF 512 Bytes Flow Command Package -; F200 - F9FF 2.0 KBytes Resident Command Package -; EC00 - F1FF 1.5 KBytes IO Package -; E900 - EBFF .75 KBytes Resident User Space +; FBFF 1 Byte Wheel byte +; FBF4 - FBFE 11 Bytes Path (5 elements) +; FBD0 - FBF3 36 Bytes ZCPR3 External FCB +; FB80 - FBCF 80 Bytes ZCPR3 Message Buffers +; FB00 - FB7F 128 Bytes ZCPR3 Shell Stack (4x32) +; FAD0 - FAFF 48 Bytes ZCPR3 External Stack (must be 48 bytes) +; F900 - FACF 464 Bytes Named Directory Buffer (25 entries) +; F700 - F9FF 512 Bytes Flow Command Package +; EF00 - F6FF 2.0 KBytes Resident Command Package +; EF00 - EF00 0 KBytes IO Package - no IOP +; EC00 - EEFF 768 Bytes Resident User Space (room for clock driver) ; The remainder is for the Operating System. Exact sizes vary depending -; primarily on the Number and sizes of Hard Drive Partitions, but may be: +; primarily on the Number and sizes of Hard Drive Partitions, typically: -; D100 - EBFF 5.0 KBytes B/P BIOS (unbanked version) -; C300 - D0FF 3.5 KBytes ZSDOS 1.0 BDOS -; BB00 - C2FF 2 KBytes ZCPR 3.3 Command Processor -; 0100 - BAFF ~46 KBytes Transient Program Area +; E100 - EBFF 4.5 KBytes B/P BIOS (banked version) +; D300 - E0FF 3.5 KBytes ZSDOS 1.0 BDOS +; CB00 - D2FF 2 KBytes ZCPR 3.4 Command Processor +; 0100 - C5FF ~50 KBytes Transient Program Area ; 0000 - 00FF 256 Bytes Standard CP/M Buffers ;======================================================================== @@ -46,80 +52,98 @@ TRUE EQU NOT FALSE YES EQU TRUE NO EQU FALSE -; The External Stack is placed in the very top position in memory. It is -; mandatory for B/P Bios and ZCPR 3.3. - -EXTSTK EQU 0FFD0H ; ZCPR3 External Stack -EXTSTKS EQU YES - -; The Multiple Command Line Buffer is placed in the Top Page of Memory to -; place it above the Environment. It is mandatory for ZCPR 3.3. - -Z3CL EQU 0FF00H ; ZCPR3 Command Line Buffer -Z3CLS EQU 208-5 ; Size of Command Line Buffer-5 +; The Multiple Command Line Buffer is mandatory for ZCPR 3.3. 3.4 & 4.1. +; FD00 - FDCF 208 Bytes +;Z3CL EQU 0FB00H ; ZCPR3 Command Line Buffer +Z3CLS EQU 256-5 ; Size of Command Line Buffer-5 +Z3CL EQU MEMTOP+1-Z3CLS-5 ; ZCPR3 Command Line Buffer ; The ZCPR3 External Environment Descriptor is mandatory B/P Bios & ZCPR 3.3. ; The Environment Descriptor MUST begin on an even Page Boundary (xx00H). - -Z3ENV EQU 0FE00H ; Environment Descriptors +; FC00 - FCFF 256 Bytes Environment Descriptor Z3ENVS EQU 2 ; Size of Env Descriptor in 128-Byte Blks +Z3ENV EQU (Z3CL-Z3ENVS*128) and 0FF00H ; The ZCPR3 Wheel Byte is mandatory for ZCPR 3.3. -Z3WHL EQU 0FDFFH ; Wheel Byte Address +; FBFF 1 Byte Wheel byte Z3WHLS EQU YES +Z3WHL EQU Z3ENV-1 ; Wheel Byte Address ; The Path is mandatory for ZCPR 3.3. -EXPATH EQU 0FDF4H ; External Path starting Address +; FBF4 - FBFE 11 Bytes Path (5 elements) EXPATHS EQU 5 ; (Path Size = EXPATHS*2 + 1 = 11 bytes) ; This defines 5 2-byte Path Elements +EXPATH EQU Z3WHL-EXPATHS*2-1 ; External Path starting Address ; The ZCPR3 External FCB is mandatory for ZCPR 3.3. -EXTFCB EQU 0FDD0H ; 36-Byte ZCPR3 External FCB +; FBD0 - FBF3 36 Bytes ZCPR3 External FCB EXTFCBS EQU YES +EXFCBSZ EQU 36 +EXTFCB EQU EXPATH-EXFCBSZ ; 36-Byte ZCPR3 External FCB ; The ZCPR3 Message Buffers are mandatory for ZCPR 3.3. -Z3MSG EQU 0FD80H ; 80-Byte ZCPR3 Message Buffer +; FB80 - FBCF 80 Bytes ZCPR3 Message Buffers Z3MSGS EQU YES +Z3MSGSZ EQU 80 ; size of buffer +Z3MSG EQU EXTFCB-Z3MSGSZ ; 80-Byte ZCPR3 Message Buffer ; Shell Stack definition. Set SHSTKS to 0 to eliminate Shell Stack -SHSTK EQU 0FD00H ; Shell Stack Starting Address +; FB00 - FB7F 128 Bytes ZCPR3 Shell Stack SHSTKS EQU 4 ; Number of SHSIZE-Byte Shell Stack entries SHSIZE EQU 32 ; (Stack Size = SHSTKS * SHSIZE = 128 Bytes) +SHSTK EQU Z3MSG-SHSTKS*SHSIZE ; Shell Stack Starting Address + +; The External Stack is mandatory for B/P Bios and ZCPR 3.3, 3.4 & 4.1 +; FAD0 - FAFF 48 Bytes ; ZCPR3 External Stack (must be 48 bytes) +;EXTSTK EQU 0FAD0H ; ZCPR3 External Stack +EXTSTK EQU SHSTK-48 ; ZCPR3 External Stack +EXTSTKS EQU YES ; ZCPR3 Named Directory Buffer definition. Set Z3NDIRS to 0 to eliminate ; the named directory buffer. - -Z3NDIR EQU 0FC00H ; Start of Named Directory Buffer -Z3NDIRS EQU 14 ; Number of Named Directory Elements - ; (NDIR Size = Z3NDIRS * 18 + 1 = 253 Bytes) +; F900 - FACF 464 Bytes ; Named Directory Buffer - 25 NAMES +Z3NDIRS EQU 25 ; Number of Named Directory Elements +NDIRSZ EQU Z3NDIRS * 18 + 1 + ; (NDIR Size = Z3NDIRS * 18 + 1 = 451 Bytes) +Z3NDIR EQU SHSTK-(NDIRSZ/256+1)*256 ; Start of Named Directory Buffer ; Flow Command Package definition. Set FCPS to 0 to eliminate FCP -FCP EQU 0FA00H ; Start of Flow Command Package +; F700 - F8FF 512 Bytes Flow Command Package FCPS EQU 4 ; (FCP Size = 128 * FCPS = 512 Bytes) +;FCPS EQU 0 ; (FCP Size = 128 * FCPS = 0 Bytes) +FCP EQU Z3NDIR-FCPS*128 ; Start of Flow Command Package ; Resident Command Processor Definition. Set RCPS to 0 to eliminate RCP -RCP EQU 0F200H ; Start of Resident Command Processor +; EF00 - F6FF 2.0 KBytes Resident Command Package RCPS EQU 16 ; (RCP Size = 128 * RCPS = 2 kBytes) +;RCPS EQU 0 ; (RCP Size = 128 * RCPS = 0 kBytes) +RCP EQU FCP-RCPS*128 ; Start of Resident Command Processor -; IO Package definition. Set IOPS to 0 to eliminate IOP +; IO Package definition. Set IOPS to 0 which eliminates IOP -IOP EQU 0EC00H ; Start of IO Package -IOPS DEFL 12 ; (IOP Size = 128 * IOPS = 1.5 kBytes) +;IOP EQU 0EC00H ; Start of IO Package +; EF00 - EF00 0 KBytes IO Package +IOPS DEFL 0 ; (IOP Size = 128 * IOPS = 0 kBytes) +;IOPS DEFL 12 ; (IOP Size = 128 * IOPS = 1.5 kBytes) +;IOPS DEFL 10 ; (IOP Size = 128 * IOPS = 1.25 kBytes) +IOP EQU RCP-IOPS*128 ; Start of IO Package ;========================================================================= ; Resident User Space Definition. Set USPCS to 0 to eliminate USPC. ; The USPC Value marks the Lower Limit of Reserved Common High Memory and ; MUST BE PRESENT! -USPC EQU 0E900H ; Start of Resident User Space (MANDATORY) +;USPCS EQU 0 ; (USPC Size = 128 * USPCS = 0 kBytes) USPCS EQU 6 ; (USPC Size = 128 * USPCS = 0.75 kBytes) +; EC00 - EEFF 0.75 KBytes Resident User Space +USPC EQU IOP-USPCS*128 ; Start of Resident User Space (MANDATORY) ;--- End of Z3BASE.LIB --- - \ No newline at end of file + \ No newline at end of file diff --git a/Source/BPBIOS/z3basef.lib b/Source/BPBIOS/z3basef.lib new file mode 100644 index 00000000..465ae070 --- /dev/null +++ b/Source/BPBIOS/z3basef.lib @@ -0,0 +1,148 @@ +; z3base.fp -- fully banked B/P Bios System Z3 Definition File for HBIOS +; with 512 byte external proxy (no internal proxy). + +; This file is adapted from the basic Z3BASE.LIB configuration file used for +; most ZCPR33 systems. It has added the new definitions for the Resident +; User Space defined in B/P Bios descriptions and modified for an HBIOS +; implementation with a full external HBIOS proxy (i.e. proxy not internal +; to BPBIOS). +; +;========================================================================= +;== NOTE: The Starting Address of the User Space marks the lower == +;== base of memory and MUST be entered. B/P Bios Utilities use == +;== this address to locate many portions of the operating system. == +;========================================================================= +; To change your systems definition, first sketch out the memory map in the +; comment table, then set the equates to reflect the memory map, doing any +; required calculations for element sizes and required spaces. As an +; alternative, just leave this file alone and configure everything with +; the utilities provided. + +; FE00 - FFFF 512 Bytes HBIOS proxy AREA in the top of ram +; FD00 - FDFF 256 Bytes Multiple Command Line Buffer +; FC00 - FCFF 256 Bytes Environment Descriptor +; Bytes 00H-7FH: Z3 Parameters +; Bytes 80H-FFH: Z3 TCAP +; FBFF 1 Byte Wheel byte +; FBF4 - FBFE 11 Bytes Path (5 elements) +; FBD0 - FBF3 36 Bytes ZCPR3 External FCB +; FB80 - FBCF 80 Bytes ZCPR3 Message Buffers +; FB00 - FB7F 128 Bytes ZCPR3 Shell Stack (4x32) +; FAD0 - FAFF 48 Bytes ZCPR3 External Stack (must be 48 bytes) +; F900 - FACF 464 Bytes Named Directory Buffer (25 entries) +; F700 - F9FF 512 Bytes Flow Command Package +; F700 - F700 0 KBytes Resident Command Package +; F700 - F700 0 KBytes IO Package - no IOP +; F700 - F700 0 Bytes Resident User Space (no clock driver needed) + +; The remainder is for the Operating System. Exact sizes vary depending +; primarily on the Number and sizes of Hard Drive Partitions, typically: + +; EC00 - F6FF 22 recs B/P BIOS (unbanked version) +; E280 - EBFF 19 recs ZSDOS 2.0 BDOS +; DA80 - E27F 2 KBytes ZCPR 4.1 Command Processor +; 0100 - C5FF ~50 KBytes Transient Program Area +; 0000 - 00FF 256 Bytes Standard CP/M Buffers +;======================================================================== + +FALSE EQU 0 +TRUE EQU NOT FALSE + +YES EQU TRUE +NO EQU FALSE + +; The Multiple Command Line Buffer is mandatory for ZCPR 3.3. 3.4 & 4.1. +; FD00 - FDCF 208 Bytes +;Z3CL EQU 0FB00H ; ZCPR3 Command Line Buffer +Z3CLS EQU 256-5 ; Size of Command Line Buffer-5 +Z3CL EQU MEMTOP+1-Z3CLS-5 ; ZCPR3 Command Line Buffer + +; The ZCPR3 External Environment Descriptor is mandatory B/P Bios & ZCPR 3.3. +; The Environment Descriptor MUST begin on an even Page Boundary (xx00H). +; FC00 - FCFF 256 Bytes Environment Descriptor +Z3ENVS EQU 2 ; Size of Env Descriptor in 128-Byte Blks +Z3ENV EQU (Z3CL-Z3ENVS*128) and 0FF00H + +; The ZCPR3 Wheel Byte is mandatory for ZCPR 3.3. + +; FBFF 1 Byte Wheel byte +Z3WHLS EQU YES +Z3WHL EQU Z3ENV-1 ; Wheel Byte Address + +; The Path is mandatory for ZCPR 3.3. + +; FBF4 - FBFE 11 Bytes Path (5 elements) +EXPATHS EQU 5 ; (Path Size = EXPATHS*2 + 1 = 11 bytes) + ; This defines 5 2-byte Path Elements +EXPATH EQU Z3WHL-EXPATHS*2-1 ; External Path starting Address + +; The ZCPR3 External FCB is mandatory for ZCPR 3.3. + +; FBD0 - FBF3 36 Bytes ZCPR3 External FCB +EXTFCBS EQU YES +EXFCBSZ EQU 36 +EXTFCB EQU EXPATH-EXFCBSZ ; 36-Byte ZCPR3 External FCB + +; The ZCPR3 Message Buffers are mandatory for ZCPR 3.3. + +; FB80 - FBCF 80 Bytes ZCPR3 Message Buffers +Z3MSGS EQU YES +Z3MSGSZ EQU 80 ; size of buffer +Z3MSG EQU EXTFCB-Z3MSGSZ ; 80-Byte ZCPR3 Message Buffer + +; Shell Stack definition. Set SHSTKS to 0 to eliminate Shell Stack + +; FB00 - FB7F 128 Bytes ZCPR3 Shell Stack +SHSTKS EQU 4 ; Number of SHSIZE-Byte Shell Stack entries +SHSIZE EQU 32 ; (Stack Size = SHSTKS * SHSIZE = 128 Bytes) +SHSTK EQU Z3MSG-SHSTKS*SHSIZE ; Shell Stack Starting Address + +; The External Stack is mandatory for B/P Bios and ZCPR 3.3. +; FAD0 - FAFF 48 Bytes ZCPR3 External Stack (must be 48 bytes) +;EXTSTK EQU 0FAD0H ; ZCPR3 External Stack +EXTSTK EQU SHSTK-48 ; ZCPR3 External Stack +EXTSTKS EQU YES + +; ZCPR3 Named Directory Buffer definition. Set Z3NDIRS to 0 to eliminate +; the named directory buffer. +; F900 - FACF 464 Bytes ; Named Directory Buffer - 25 NAMES +Z3NDIRS EQU 25 ; Number of Named Directory Elements +NDIRSZ EQU Z3NDIRS * 18 + 1 + ; (NDIR Size = Z3NDIRS * 18 + 1 = 451 Bytes) +Z3NDIR EQU SHSTK-(NDIRSZ/256+1)*256 ; Start of Named Directory Buffer + +; Flow Command Package definition. Set FCPS to 0 to eliminate FCP + +; F700 - F8FF 512 Bytes Flow Command Package +FCPS EQU 4 ; (FCP Size = 128 * FCPS = 512 Bytes) +;FCPS EQU 0 ; (FCP Size = 128 * FCPS = 0 Bytes) +FCP EQU Z3NDIR-FCPS*128 ; Start of Flow Command Package + +; Resident Command Processor Definition. Set RCPS to 0 to eliminate RCP + +; F700 - F700 0 KBytes Resident Command Package +;RCPS EQU 16 ; (RCP Size = 128 * RCPS = 2 kBytes) +RCPS EQU 0 ; (RCP Size = 128 * RCPS = 0 kBytes) +RCP EQU FCP-RCPS*128 ; Start of Resident Command Processor + +; IO Package definition. Set IOPS to 0 which eliminates IOP + +;IOP EQU 0EC00H ; Start of IO Package +; F700 - F700 0 KBytes IO Package +IOPS DEFL 0 ; (IOP Size = 128 * IOPS = 0 kBytes) +;IOPS DEFL 12 ; (IOP Size = 128 * IOPS = 1.5 kBytes) +;IOPS DEFL 10 ; (IOP Size = 128 * IOPS = 1.25 kBytes) +IOP EQU RCP-IOPS*128 ; Start of IO Package + +;========================================================================= +; Resident User Space Definition. Set USPCS to 0 to eliminate USPC. +; The USPC Value marks the Lower Limit of Reserved Common High Memory and +; MUST BE PRESENT! + +USPCS EQU 0 ; (USPC Size = 128 * USPCS = 0 kBytes) +;USPCS EQU 6 ; (USPC Size = 128 * USPCS = 0.75 kBytes) +; F700 - F700 0 KBytes Resident User Space +USPC EQU IOP-USPCS*128 ; Start of Resident User Space (MANDATORY) + +;--- End of Z3BASE.LIB --- + \ No newline at end of file diff --git a/Source/BPBIOS/z3basen.lib b/Source/BPBIOS/z3basen.lib deleted file mode 100644 index 0a84f197..00000000 --- a/Source/BPBIOS/z3basen.lib +++ /dev/null @@ -1,131 +0,0 @@ -; B/P Bios System Z3 Definition File. - -; This file is adapted from the basic Z3BASE.LIB configuration file used for -; most ZCPR33 systems. It has added the new definitions for the Resident -; User Space defined in B/P Bios descriptions. -;========================================================================= -;== NOTE: The Starting Address of the User Space marks the lower == -;== base of memory and MUST be entered. B/P Bios Utilities use == -;== this address to locate many portions of the operating system. == -;========================================================================= -; To change your systems definition, first sketch out the memory map in the -; comment table, then set the equates to reflect the memory map, doing any -; required calculations for element sizes and required spaces. As an -; alternative, just leave this file alone and configure everything with -; the utilities provided. - -; FFE0 - FFFF 32 Bytes HBIOS Reserved -; FFB0 - FFDF 48 Bytes ZCPR3 External Stack -; FF00 - FFAF 176 Bytes Multiple Command Line Buffer -; FE00 - FEFF 256 Bytes Environment Descriptor -; Bytes 00H-7FH: Z3 Parameters -; Bytes 80H-FFH: Z3 TCAP -; FDFF 1 Byte Wheel byte -; FDF4 - FDFE 11 Bytes Path (5 elements) -; FDD0 - FDF3 36 Bytes ZCPR3 External FCB -; FD80 - FDCF 80 Bytes ZCPR3 Message Buffers -; FD00 - FD7F 128 Bytes ZCPR3 Shell Stack -; FC00 - FCFF 256 Bytes Named Directory Buffer -; FA00 - FBFF 512 Bytes Flow Command Package -; F200 - F9FF 2.0 KBytes Resident Command Package -; EC00 - F1FF 1.5 KBytes IO Package -; E900 - EBFF .75 KBytes Resident User Space - -; The remainder is for the Operating System. Exact sizes vary depending -; primarily on the Number and sizes of Hard Drive Partitions, but may be: - -; CE00 - E8FF 5.0 KBytes B/P BIOS (unbanked version) -; C000 - CDFF 3.5 KBytes ZSDOS 1.0 BDOS -; B800 - BFFF 2 KBytes ZCPR 3.3 Command Processor -; 0100 - B7FF ~46 KBytes Transient Program Area -; 0000 - 00FF 256 Bytes Standard CP/M Buffers -;======================================================================== - -FALSE EQU 0 -TRUE EQU NOT FALSE - -YES EQU TRUE -NO EQU FALSE - -BASE EQU 0 - -CCP EQU 0C000H ; ZCPR3 COMMAND PROCESSOR - -; The External Stack is placed in the very top position in memory. It is -; mandatory for B/P Bios and ZCPR 3.3. - -;EXTSTK EQU 0FFD0H ; ZCPR3 External Stack -EXTSTK EQU 0FFB0H ; ZCPR3 External Stack -EXTSTKS EQU YES - -; The Multiple Command Line Buffer is placed in the Top Page of Memory to -; place it above the Environment. It is mandatory for ZCPR 3.3. - -Z3CL EQU 0FF00H ; ZCPR3 Command Line Buffer -;Z3CLS EQU 208-5 ; Size of Command Line Buffer-5 -Z3CLS EQU 176-5 ; Size of Command Line Buffer-5 - -; The ZCPR3 External Environment Descriptor is mandatory B/P Bios & ZCPR 3.3. -; The Environment Descriptor MUST begin on an even Page Boundary (xx00H). - -Z3ENV EQU 0FE00H ; Environment Descriptors -Z3ENVS EQU 2 ; Size of Env Descriptor in 128-Byte Blks - -; The ZCPR3 Wheel Byte is mandatory for ZCPR 3.3. - -Z3WHL EQU 0FDFFH ; Wheel Byte Address -Z3WHLS EQU YES - -; The Path is mandatory for ZCPR 3.3. - -EXPATH EQU 0FDF4H ; External Path starting Address -EXPATHS EQU 5 ; (Path Size = EXPATHS*2 + 1 = 11 bytes) - ; This defines 5 2-byte Path Elements - -; The ZCPR3 External FCB is mandatory for ZCPR 3.3. - -EXTFCB EQU 0FDD0H ; 36-Byte ZCPR3 External FCB -EXTFCBS EQU YES - -; The ZCPR3 Message Buffers are mandatory for ZCPR 3.3. - -Z3MSG EQU 0FD80H ; 80-Byte ZCPR3 Message Buffer -Z3MSGS EQU YES - -; Shell Stack definition. Set SHSTKS to 0 to eliminate Shell Stack - -SHSTK EQU 0FD00H ; Shell Stack Starting Address -SHSTKS EQU 4 ; Number of SHSIZE-Byte Shell Stack entries -SHSIZE EQU 32 ; (Stack Size = SHSTKS * SHSIZE = 128 Bytes) - -; ZCPR3 Named Directory Buffer definition. Set Z3NDIRS to 0 to eliminate -; the named directory buffer. - -Z3NDIR EQU 0FC00H ; Start of Named Directory Buffer -Z3NDIRS EQU 14 ; Number of Named Directory Elements - ; (NDIR Size = Z3NDIRS * 18 + 1 = 253 Bytes) - -; Flow Command Package definition. Set FCPS to 0 to eliminate FCP - -FCP EQU 0FA00H ; Start of Flow Command Package -FCPS EQU 4 ; (FCP Size = 128 * FCPS = 512 Bytes) - -; Resident Command Processor Definition. Set RCPS to 0 to eliminate RCP - -RCP EQU 0F200H ; Start of Resident Command Processor -RCPS EQU 16 ; (RCP Size = 128 * RCPS = 2 kBytes) - -; IO Package definition. Set IOPS to 0 to eliminate IOP - -IOP EQU 0EC00H ; Start of IO Package -IOPS DEFL 12 ; (IOP Size = 128 * IOPS = 1.5 kBytes) - -;========================================================================= -; Resident User Space Definition. Set USPCS to 0 to eliminate USPC. -; The USPC Value marks the Lower Limit of Reserved Common High Memory and -; MUST BE PRESENT! - -USPC EQU 0E900H ; Start of Resident User Space (MANDATORY) -USPCS EQU 6 ; (USPC Size = 128 * USPCS = 0.75 kBytes) - -;--- End of Z3BASE.LIB --- diff --git a/Source/BPBIOS/z3baset.lib b/Source/BPBIOS/z3baset.lib deleted file mode 100644 index 8ee0fa35..00000000 --- a/Source/BPBIOS/z3baset.lib +++ /dev/null @@ -1,129 +0,0 @@ -; B/P Bios System Z3 Definition File. - -; This file is adapted from the basic Z3BASE.LIB configuration file used for -; most ZCPR33 systems. It has added the new definitions for the Resident -; User Space defined in B/P Bios descriptions. -;========================================================================= -;== NOTE: The Starting Address of the User Space marks the lower == -;== base of memory and MUST be entered. B/P Bios Utilities use == -;== this address to locate many portions of the operating system. == -;========================================================================= -; To change your systems definition, first sketch out the memory map in the -; comment table, then set the equates to reflect the memory map, doing any -; required calculations for element sizes and required spaces. As an -; alternative, just leave this file alone and configure everything with -; the utilities provided. - -; FE00 - FFFF 512 Bytes HBIOS Reserved -; FDFF 1 Byte Wheel byte -; FDF4 - FDFE 11 Bytes Path (5 elements) -; FDD0 - FDF3 36 Bytes ZCPR3 External FCB -; FD80 - FDCF 80 Bytes ZCPR3 Message Buffers -; FD00 - FD7F 128 Bytes ZCPR3 Shell Stack -; FC00 - FCFF 256 Bytes Named Directory Buffer -; FA00 - FBFF 512 Bytes Flow Command Package -; F200 - F9FF 2.0 KBytes Resident Command Package -; EC00 - F1FF 1.5 KBytes IO Package -; EBD0 - EBFF 48 Bytes ZCPR3 External Stack -; EB00 - EBAF 176 Bytes Multiple Command Line Buffer -; EA00 - EAFF 256 Bytes Environment Descriptor -; Bytes 00H-7FH: Z3 Parameters -; Bytes 80H-FFH: Z3 TCAP -; E700 - E9FF .75 KBytes Resident User Space - -; The remainder is for the Operating System. Exact sizes vary depending -; primarily on the Number and sizes of Hard Drive Partitions, but may be: - -; D300 - E6FF 5.0 KBytes B/P BIOS (unbanked version) -; C500 - D2FF 3.5 KBytes ZSDOS 1.0 BDOS -; BD00 - C4FF 2 KBytes ZCPR 3.3 Command Processor -; 0100 - BCFF ~47 KBytes Transient Program Area -; 0000 - 00FF 256 Bytes Standard CP/M Buffers -;======================================================================== - -FALSE EQU 0 -TRUE EQU NOT FALSE - -YES EQU TRUE -NO EQU FALSE - -BASE EQU 0 - -CCP EQU 0BD00H ; ZCPR3 COMMAND PROCESSOR - -; The External Stack is placed in the very top position in memory. It is -; mandatory for B/P Bios and ZCPR 3.3. - -EXTSTK EQU 0EBD0H ; ZCPR3 External Stack -EXTSTKS EQU YES - -; The Multiple Command Line Buffer is placed in the Top Page of Memory to -; place it above the Environment. It is mandatory for ZCPR 3.3. - -Z3CL EQU 0EB00H ; ZCPR3 Command Line Buffer -Z3CLS EQU 208-5 ; Size of Command Line Buffer-5 - -; The ZCPR3 External Environment Descriptor is mandatory B/P Bios & ZCPR 3.3. -; The Environment Descriptor MUST begin on an even Page Boundary (xx00H). - -Z3ENV EQU 0EA00H ; Environment Descriptors -Z3ENVS EQU 2 ; Size of Env Descriptor in 128-Byte Blks - -; The ZCPR3 Wheel Byte is mandatory for ZCPR 3.3. - -Z3WHL EQU 0FDFFH ; Wheel Byte Address -Z3WHLS EQU YES - -; The Path is mandatory for ZCPR 3.3. - -EXPATH EQU 0FDF4H ; External Path starting Address -EXPATHS EQU 5 ; (Path Size = EXPATHS*2 + 1 = 11 bytes) - ; This defines 5 2-byte Path Elements - -; The ZCPR3 External FCB is mandatory for ZCPR 3.3. - -EXTFCB EQU 0FDD0H ; 36-Byte ZCPR3 External FCB -EXTFCBS EQU YES - -; The ZCPR3 Message Buffers are mandatory for ZCPR 3.3. - -Z3MSG EQU 0FD80H ; 80-Byte ZCPR3 Message Buffer -Z3MSGS EQU YES - -; Shell Stack definition. Set SHSTKS to 0 to eliminate Shell Stack - -SHSTK EQU 0FD00H ; Shell Stack Starting Address -SHSTKS EQU 4 ; Number of SHSIZE-Byte Shell Stack entries -SHSIZE EQU 32 ; (Stack Size = SHSTKS * SHSIZE = 128 Bytes) - -; ZCPR3 Named Directory Buffer definition. Set Z3NDIRS to 0 to eliminate -; the named directory buffer. - -Z3NDIR EQU 0FC00H ; Start of Named Directory Buffer -Z3NDIRS EQU 14 ; Number of Named Directory Elements - ; (NDIR Size = Z3NDIRS * 18 + 1 = 253 Bytes) - -; Flow Command Package definition. Set FCPS to 0 to eliminate FCP - -FCP EQU 0FA00H ; Start of Flow Command Package -FCPS EQU 4 ; (FCP Size = 128 * FCPS = 512 Bytes) - -; Resident Command Processor Definition. Set RCPS to 0 to eliminate RCP - -RCP EQU 0F200H ; Start of Resident Command Processor -RCPS EQU 16 ; (RCP Size = 128 * RCPS = 2 kBytes) - -; IO Package definition. Set IOPS to 0 to eliminate IOP - -IOP EQU 0EC00H ; Start of IO Package -IOPS DEFL 12 ; (IOP Size = 128 * IOPS = 1.5 kBytes) - -;========================================================================= -; Resident User Space Definition. Set USPCS to 0 to eliminate USPC. -; The USPC Value marks the Lower Limit of Reserved Common High Memory and -; MUST BE PRESENT! - -USPC EQU 0E700H ; Start of Resident User Space (MANDATORY) -USPCS EQU 6 ; (USPC Size = 128 * USPCS = 0.75 kBytes) - -;--- End of Z3BASE.LIB --- diff --git a/Source/BPBIOS/z41.zex b/Source/BPBIOS/z41.zex deleted file mode 100644 index aa944b80..00000000 --- a/Source/BPBIOS/z41.zex +++ /dev/null @@ -1,4 +0,0 @@ -IOPINIT -JETLDR SYS.NDR,FCP.ZRL,MYTERM.Z3T -ZSCFG2 CB - \ No newline at end of file diff --git a/Source/BPBIOS/zs227g.zrl b/Source/BPBIOS/zs227g.zrl new file mode 100644 index 00000000..9d3b6559 Binary files /dev/null and b/Source/BPBIOS/zs227g.zrl differ diff --git a/Source/BPBIOS/zst.zex b/Source/BPBIOS/zst.zex new file mode 100644 index 00000000..94ff4afb --- /dev/null +++ b/Source/BPBIOS/zst.zex @@ -0,0 +1,20 @@ +;; Set the ZCPR and ZSDOS paths +c15:zpath $$$$ a0 b0 c15 c0 /d=$$$$ c15 c0 +;; Load ZCPR segments +jetldr rcp-16h.zrl,fcp-4t.zrl,bpbio.ndr,nzdec23d.z3t +;; Load date/time extension into user space +ldtimec +;; Initialize the RAM disk if needed and copy some useful files there +if ~ex a0:-ram.000 +;; Load datestamping file on a: +putds -d=a: +;; Enable datestamping +relog +save 0 a:-ram.000 +rcopy ramfiles.txt a0: /q +fi +;; Print Time & Date as a reminder in case they need setting +td +;; Load the command history shell and editor +lsh + \ No newline at end of file diff --git a/Source/BPBIOS/zstf.zex b/Source/BPBIOS/zstf.zex new file mode 100644 index 00000000..397b91eb --- /dev/null +++ b/Source/BPBIOS/zstf.zex @@ -0,0 +1,20 @@ +;; Set the ZCPR and ZSDOS paths +c15:zpath $$$$ a0 b0 c15 c0 /d=$$$$ c15 c0 +;; Enable clock and turn off last access stamping +zscfg2 cb +a- +;; Load ZCPR segments +jetldr fcp-4t.zrl,bpbio.ndr,nzdec23d.z3t +;; Initialize the RAM disk if needed and copy some useful files there +if ~ex a0:-ram.000 +;; Load datestamping file on a: +putds -d=a: +;; Enable datestamping +relog +save 0 a:-ram.000 +rcopy ramfiles.txt a0: /q +fi +;; Print Time & Date as a reminder in case they need setting +td +;; Load the command history shell and editor +lsh + \ No newline at end of file diff --git a/Source/Build.cmd b/Source/Build.cmd index 9419b3ce..e349a4d1 100644 --- a/Source/Build.cmd +++ b/Source/Build.cmd @@ -1,9 +1,15 @@ @echo off setlocal -REM setlocal & call BuildDoc || exit /b 1 & endlocal -setlocal & call BuildProp || exit /b 1 & endlocal -setlocal & call BuildShared || exit /b 1 & endlocal -REM setlocal & call BuildBP || exit /b 1 & endlocal -setlocal & call BuildImages || exit /b 1 & endlocal -setlocal & call BuildROM %* || exit /b 1 & endlocal \ No newline at end of file +:: call BuildDoc || exit /b +call BuildProp || exit /b +call BuildShared || exit /b +:: call BuildBP || exit /b +call BuildImages || exit /b +call BuildROM %* || exit /b +call BuildZRC || exit /b +call BuildZZRC || exit /b + +if "%1" == "dist" ( + call Clean || exit /b +) \ No newline at end of file diff --git a/Source/BuildBP.cmd b/Source/BuildBP.cmd index e6dfc646..c1139fdd 100644 --- a/Source/BuildBP.cmd +++ b/Source/BuildBP.cmd @@ -1,4 +1,4 @@ @echo off setlocal -setlocal & cd BPBIOS && call Build || exit /b 1 & endlocal \ No newline at end of file +pushd BPBIOS && call Build || exit /b & popd \ No newline at end of file diff --git a/Source/BuildDoc.cmd b/Source/BuildDoc.cmd new file mode 100644 index 00000000..6710a7f5 --- /dev/null +++ b/Source/BuildDoc.cmd @@ -0,0 +1,4 @@ +@echo off +setlocal + +pushd Doc && call Build || exit /b & popd diff --git a/Source/BuildImages.cmd b/Source/BuildImages.cmd index e98e5c93..d22e66da 100644 --- a/Source/BuildImages.cmd +++ b/Source/BuildImages.cmd @@ -1,4 +1,4 @@ @echo off setlocal -setlocal & cd Images && call Build || exit /b 1 & endlocal \ No newline at end of file +pushd Images && call Build || exit /b & popd \ No newline at end of file diff --git a/Source/BuildProp.cmd b/Source/BuildProp.cmd index 1f8cc189..39c02fa1 100644 --- a/Source/BuildProp.cmd +++ b/Source/BuildProp.cmd @@ -1,4 +1,4 @@ @echo off setlocal -setlocal & cd Prop && call Build || exit /b 1 & endlocal +pushd Prop && call Build || exit /b & popd diff --git a/Source/BuildROM.cmd b/Source/BuildROM.cmd index cd70252e..f1d11f4e 100644 --- a/Source/BuildROM.cmd +++ b/Source/BuildROM.cmd @@ -1,4 +1,4 @@ @echo off setlocal -setlocal & cd HBIOS && Powershell -ExecutionPolicy Unrestricted .\Build.ps1 %* || exit /b 1 & endlocal +pushd HBIOS && call Build %* || exit /b & popd diff --git a/Source/BuildShared.cmd b/Source/BuildShared.cmd index 578af84e..8b7e0442 100644 --- a/Source/BuildShared.cmd +++ b/Source/BuildShared.cmd @@ -1,13 +1,17 @@ @echo off setlocal -setlocal & cd CBIOS && call Build || exit /b 1 & endlocal -setlocal & cd CPM22 && call Build || exit /b 1 & endlocal -setlocal & cd ZCPR && call Build || exit /b 1 & endlocal -setlocal & cd ZCPR-DJ && call Build || exit /b 1 & endlocal -setlocal & cd ZSDOS && call Build || exit /b 1 & endlocal -setlocal & cd CPM3 && call Build || exit /b 1 & endlocal -setlocal & cd ZPM3 && call Build || exit /b 1 & endlocal -setlocal & cd Apps && call Build || exit /b 1 & endlocal -setlocal & cd Forth && call Build || exit /b 1 & endlocal -setlocal & cd Fonts && call Build || exit /b 1 & endlocal +pushd HDIAG && call Build || exit /b & popd +pushd CBIOS && call Build || exit /b & popd +pushd CPM22 && call Build || exit /b & popd +pushd ZCPR && call Build || exit /b & popd +pushd ZCPR-DJ && call Build || exit /b & popd +pushd ZSDOS && call Build || exit /b & popd +pushd CPM3 && call Build || exit /b & popd +pushd ZPM3 && call Build || exit /b & popd +pushd pSys && call Build || exit /b & popd +pushd Apps && call Build || exit /b & popd +pushd Forth && call Build || exit /b & popd +pushd TastyBasic && call Build || exit /b & popd +pushd Fonts && call Build || exit /b & popd +pushd RomDsk && call Build || exit /b & popd diff --git a/Source/BuildZRC.cmd b/Source/BuildZRC.cmd new file mode 100644 index 00000000..6c6763e7 --- /dev/null +++ b/Source/BuildZRC.cmd @@ -0,0 +1,4 @@ +@echo off +setlocal + +pushd ZRC && call Build || exit /b & popd diff --git a/Source/BuildZZRC.cmd b/Source/BuildZZRC.cmd new file mode 100644 index 00000000..4f5d2fa1 --- /dev/null +++ b/Source/BuildZZRC.cmd @@ -0,0 +1,4 @@ +@echo off +setlocal + +pushd ZZRC && call Build || exit /b & popd diff --git a/Source/CBIOS/Build.cmd b/Source/CBIOS/Build.cmd index f26912d1..c79ba552 100644 --- a/Source/CBIOS/Build.cmd +++ b/Source/CBIOS/Build.cmd @@ -3,22 +3,20 @@ setlocal set TOOLS=../../Tools -set PATH=%TOOLS%\tasm32;%TOOLS%\zx;%PATH% +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%PATH% set TASMTABS=%TOOLS%\tasm32 -set ZXBINDIR=%TOOLS%/cpm/bin/ -set ZXLIBDIR=%TOOLS%/cpm/lib/ -set ZXINCDIR=%TOOLS%/cpm/include/ +set CPMDIR80=%TOOLS%/cpm/ echo. echo Building CBIOS for RomWBW... echo. -tasm -t80 -g3 -dPLTWBW cbios.asm cbios_wbw.bin cbios_wbw.lst +tasm -t80 -g3 -dPLTWBW cbios.asm cbios_wbw.bin cbios_wbw.lst || exit /b if errorlevel 1 goto :eof echo. echo Building CBIOS for UNA... echo. -tasm -t80 -g3 -dPLTUNA cbios.asm cbios_una.bin cbios_una.lst +tasm -t80 -g3 -dPLTUNA cbios.asm cbios_una.bin cbios_una.lst || exit /b if errorlevel 1 goto :eof diff --git a/Source/CBIOS/cbios.asm b/Source/CBIOS/cbios.asm index a822887f..8eef64f2 100644 --- a/Source/CBIOS/cbios.asm +++ b/Source/CBIOS/cbios.asm @@ -10,8 +10,8 @@ ; 1) STACK LOCATION DURING BOOT OR WBOOT??? ; 2) REVIEW USE OF DI/EI IN INIT ; -FALSE .EQU 0 -TRUE .EQU ~FALSE +FALSE .EQU 0 +TRUE .EQU ~FALSE ; BDOS .EQU 5 ; BDOS FUNC INVOCATION VECTOR ; @@ -56,8 +56,8 @@ DEV_NUL .EQU $FF ; NUL: ; ; MEMORY LAYOUT ; -IOBYTE .EQU 3 ; LOC IN PAGE 0 OF I/O DEFINITION BYTE -CDISK .EQU 4 ; LOC IN PAGE 0 OF CURRENT DISK NUMBER 0=A,...,15=P +IOBYTE .EQU 3 ; LOC IN PAGE 0 OF I/O DEFINITION BYTE +CDISK .EQU 4 ; LOC IN PAGE 0 OF CURRENT DISK NUMBER 0=A,...,15=P ; CCP_LOC .EQU CPM_LOC CCP_SIZ .EQU $800 @@ -78,7 +78,7 @@ MEMTOP .EQU $10000 #INCLUDE "../UBIOS/ubios.inc" #ENDIF ; - .ORG CBIOS_LOC ; DEFINED IN STD.ASM + .ORG CBIOS_LOC ; DEFINED IN STD.ASM ; STACK .EQU CBIOS_END ; USE SLACK SPACE FOR STACK AS NEEDED ; @@ -112,7 +112,7 @@ WBOOTE JP WBOOT ; #1 - WARM START ; ; 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 +; 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. @@ -130,7 +130,7 @@ STPIMG: .DB 'W',~'W' ; MARKER 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 +; RomWBW CBIOS. A pointer to the start of this section is stored with ; with the CBX data in page zero at $44 (see above). ; CBX: @@ -144,6 +144,43 @@ CBXSIZ .EQU $ - CBX .ECHO " bytes.\n" ; ;================================================================================================== +; TIMDAT ROUTINE FOR QP/M +;================================================================================================== +; +#IFDEF PLTWBW + #IF QPMTIMDAT +; +TIMDAT: + ; GET CURRENT DATE/TIME FROM RTC INTO BUFFER + LD B,BF_RTCGETTIM ; HBIOS GET TIME FUNCTION + LD HL,CLKDAT ; POINTER TO BUFFER + RST 08 ; DO IT +; + ; CONVERT ALL BYTES FROM BCD TO BINARY + LD HL,CLKDAT ; BUFFER + LD B,7 ; DO 7 BYTES +TIMDAT1: + LD A,(HL) + CALL BCD2BYTE + LD (HL),A + INC HL + DJNZ TIMDAT1 +; + ; SWAP BYTES 0 & 2 TO MAKE BUFFER INTO QP/M ORDER + LD A,(CLKDAT+0) + PUSH AF + LD A,(CLKDAT+2) + LD (CLKDAT+0),A + POP AF + LD (CLKDAT+2),A +; + LD HL,CLKDAT ; RETURN BUFFER ADDRESS + RET +; + #ENDIF +#ENDIF +; +;================================================================================================== ; CHARACTER DEVICE MAPPING ;================================================================================================== ; @@ -152,15 +189,15 @@ CBXSIZ .EQU $ - CBX ; IOBYTE (0003H) ; ============== ; -; Device LST: PUN: RDR: CON: -; Bit positions 7 6 5 4 3 2 1 0 +; Device LST: PUN: RDR: CON: +; Bit positions 7 6 5 4 3 2 1 0 ; -; Dec Binary +; 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: +; 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) @@ -235,7 +272,7 @@ DEVMAP: ;================================================================================================== ; ; 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 +; 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 position of the entry indicates ; the drive letter, so the first entry is A:, the second entry is B:, etc. @@ -245,27 +282,27 @@ DEVMAP: ; DPH: DPH ADDRESS OF DRIVE (WORD) ; ; DRVMAP --+ -; | DRIVE A | DRIVE B | | DRIVE N | -; +-----V------+-------+-----+--------------------+ +--------------------+ -; | N | UNIT | SLICE | DPH | UNIT | SLICE | DPH | ... | UNIT | SLICE | DPH | -; +----8+-----8+------8+-+-16+-----8+------8+-+-16+ +-----8+------8+-+-16+ -; | | | -; +--------------------+ +-> [DPH] +-> [DPH] -; | -; V-----+-------+-------+-------+--------+-----+-----+-----+ -; DPH: | XLT | 0000H | 0000H | 0000H | DIRBUF | DPB | CSV | ALV | -; +---16+-----16+-----16+-----16+------16+-+-16+-+-16+-+-16+ -; (ONE DPH PER DRIVE) | | | -; | | +----------+ -; | | | -; +----------------------+ V-------------+ V-------------+ -; | | CSV BUF | | ALV BUF | -; | +-------------+ +-------------+ -; | (CSZ BYTES) (ASZ BYTES) -; | -; +-----+-----+-----V-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ -; DPB: | CSZ | ASZ | BLS | SPT | BSH | BLM | EXM | DSM | DRM | AL0 | AL1 | CKS | OFF | -; +---16+---16+----8+---16+----8+----8+----8+---16+---16+----8+----8+---16+---16+ +; | DRIVE A | DRIVE B | | DRIVE N | +; +-----V------+-------+-----+--------------------+ +--------------------+ +; | N | UNIT | SLICE | DPH | UNIT | SLICE | DPH | ... | UNIT | SLICE | DPH | +; +----8+-----8+------8+-+-16+-----8+------8+-+-16+ +-----8+------8+-+-16+ +; | | | +; +--------------------+ +-> [DPH] +-> [DPH] +; | +; V-----+-------+-------+-------+--------+-----+-----+-----+--------+ +; DPH: | XLT | 0000H | 0000H | 0000H | DIRBUF | DPB | CSV | ALV | LBAOFF | +; +---16+-----16+-----16+-----16+------16+-+-16+-+-16+-+-16+------32+ +; (ONE DPH PER DRIVE) | | | +; | | +----------+ +; | | | +; +----------------------+ V-------------+ V-------------+ +; | | CSV BUF | | ALV BUF | +; | +-------------+ +-------------+ +; | (CSZ BYTES) (ASZ BYTES) +; | +; +-----+-----+-----V-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ +; DPB: | CSZ | ASZ | BLS | SPT | BSH | BLM | EXM | DSM | DRM | AL0 | AL1 | CKS | OFF | +; +---16+---16+----8+---16+----8+----8+----8+---16+---16+----8+----8+---16+---16+ ; |<--- PREFIX ---->|<------------------- STANDARD CP/M DPB ------------------->| ; ;================================================================================================== @@ -289,6 +326,7 @@ DPBMAP: .DW DPB_FD360 ; MID_FD360 .DW DPB_FD120 ; MID_FD120 .DW DPB_FD111 ; MID_FD111 + .DW DPB_HDNEW ; MID_HDNEW (1024 DIR ENTRIES) ; DPBCNT .EQU ($ - DPBMAP) / 2 ; @@ -299,7 +337,15 @@ DPBCNT .EQU ($ - DPBMAP) / 2 ;__________________________________________________________________________________________________ BOOT: ; STANDARD BOOT INVOCATION - LD SP,STACK ; STACK FOR INITIALIZATION + ;LD SP,STACK ; STACK FOR INITIALIZATION + LD SP,CCP_LOC ; PUT STACK JUST BELOW CCP +; +#IF DEBUG + CALL PRTSTRD + .DB "\r\nCBIOS Starting...$" + CALL PRTSTRD + .DB "\r\nCopying INIT code to 0x8000...$" +#ENDIF ; ; COPY INITIALIZATION CODE TO RUNNING LOCATION $8000 LD HL,BUFPOOL @@ -309,6 +355,11 @@ BOOT: PUSH HL ; SAVE START ADR AGAIN FOR BELOW PUSH BC ; SAVE LENGTH FOR BELOW LDIR ; COPY THE CODE +; +#IF DEBUG + CALL PRTSTRD + .DB "\r\nClearing disk buffer...$" +#ENDIF ; ; CLEAR BUFFER POP BC ; RECOVER LENGTH @@ -318,26 +369,51 @@ BOOT: INC DE ; OFFSET DEST DEC BC ; REDUCE LEN BY ONE LDIR ; USE LDIR TO FILL +; +#IF DEBUG + CALL PRTSTRD + .DB "\r\nStarting INIT routine at 0x8000$" +#ENDIF ; CALL INIT ; PERFORM COLD BOOD ROUTINE +; +#IF DEBUG + CALL PRTSTRD + .DB "\r\nResetting CP/M...$" +#ENDIF CALL RESCPM ; RESET CPM +; +#IF AUTOSUBMIT + #IF DEBUG + CALL PRTSTRD + .DB "\r\nPerforming Auto Submit...$" + #ENDIF CALL AUTOSUB ; PREP AUTO SUBMIT, IF APPROPRIATE +#ENDIF +; +#IF DEBUG + CALL PRTSTRD + .DB "\r\nLaunching CP/M...$" +#ENDIF ; JR GOCPM ; THEN OFF TO CP/M WE GO... ; ;__________________________________________________________________________________________________ REBOOT: - ; REBOOT FROM ROM, REPLACES BOOT AFTER INIT + ; RESTART, REPLACES BOOT AFTER INIT #IFDEF PLTUNA + ; FOR UNA, COLD BOOT DI ; NO INTERRUPTS LD BC,$01FB ; UNA FUNC = SET BANK LD DE,0 ; ROM BOOT BANK CALL $FFFD ; DO IT (RST 08 NOT SAFE HERE) #ENDIF +; #IFDEF PLTWBW - DI ; NO INTERRUPTS - LD A,0 ; ROM BOOT BANK - CALL HB_BNKSEL ; SELECT IT INTO LOW MEMORY + ; WARM START + LD B,BF_SYSRESET ; SYSTEM RESTART + LD C,BF_SYSRES_WARM ; WARM START + CALL $FFF0 ; CALL HBIOS #ENDIF ; ; JUMP TO RESTART ADDRESS @@ -345,33 +421,43 @@ REBOOT: ; ;__________________________________________________________________________________________________ WBOOT: - LD SP,STACK ; STACK FOR INITIALIZATION +; +#IFDEF PLTWBW + ; GIVE HBIOS A CHANCE TO DIAGNOSE ISSUES, PRIMARILY + ; THE OCCURRENCE OF A Z180 INVALID OPCODE TRAP + POP HL ; SAVE PC FOR DIAGNOSIS + LD SP,STACK ; STACK FOR INITIALIZATION + LD BC,$F003 ; HBIOS USER RESET FUNCTION + RST 08 ; DO IT +#ENDIF ; #IFDEF PLTUNA + LD SP,STACK ; STACK FOR INITIALIZATION + ; RESTORE COMMAND PROCESSOR FROM UNA BIOS CACHE - LD BC,$01FB ; UNA FUNC = SET BANK - LD DE,(BNKBIOS) ; UBIOS_PAGE (SEE PAGES.INC) - RST 08 ; DO IT - PUSH DE ; SAVE PREVIOUS BANK + LD BC,$01FB ; UNA FUNC = SET BANK + LD DE,(BNKBIOS) ; 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,CCP_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 + LD HL,(CCPBUF) ; ADDRESS OF CCP BUF IN BIOS MEM + LD DE,CCP_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_SYSSETCPY ; HBIOS FUNC: SETUP BANK COPY - LD DE,(BNKBIOS) ; D = DEST (USER BANK), E = SRC (BIOS BANK) - LD HL,CCP_SIZ ; HL = COPY LEN = SIZE OF COMMAND PROCESSOR - RST 08 ; DO IT - LD B,BF_SYSBNKCPY ; HBIOS FUNC: PERFORM BANK COPY - LD HL,(CCPBUF) ; COPY FROM FIXED LOCATION IN HB BANK - LD DE,CCP_LOC ; TO CCP LOCATION IN USR BANK - RST 08 ; DO IT + LD B,BF_SYSSETCPY ; HBIOS FUNC: SETUP BANK COPY + LD DE,(BNKBIOS) ; D = DEST (USER BANK), E = SRC (BIOS BANK) + LD HL,CCP_SIZ ; HL = COPY LEN = SIZE OF COMMAND PROCESSOR + RST 08 ; DO IT + LD B,BF_SYSBNKCPY ; HBIOS FUNC: PERFORM BANK COPY + LD HL,(CCPBUF) ; COPY FROM FIXED LOCATION IN HB BANK + LD DE,CCP_LOC ; TO CCP LOCATION IN USR BANK + RST 08 ; DO IT #ENDIF ; ; SOME APPLICATIONS STEAL THE BDOS SERIAL NUMBER STORAGE @@ -383,11 +469,11 @@ WBOOT: LD BC,6 XOR A CALL FILL -; +; CALL RESCPM ; RESET CPM JR GOCPM ; THEN OFF TO CP/M WE GO... ; -;__________________________________________________________________________________________________ +;__________________________________________________________________________________________________ RESCPM: ; LD A,$C3 ; LOAD A WITH 'JP' INSTRUCTION (USED BELOW) @@ -397,23 +483,13 @@ RESCPM: 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 HL,STPIMG ; FROM STAMP DATA IMAGE LD DE,STPLOC ; TO IT'S LOCATION IN PAGE ZERO LD BC,STPSIZ ; SIZE OF BLOCK TO COPY LDIR ; DO IT @@ -427,7 +503,7 @@ RESCPM: ; RET ; -;__________________________________________________________________________________________________ +;__________________________________________________________________________________________________ GOCPM: ; ; ENSURE VALID DISK AND JUMP TO CCP @@ -441,28 +517,14 @@ GOCPM: CURDSK: LD A,(CDISK) ; GET CURRENT USER/DISK GOCCP: - LD C,A ; SETUP C WITH CURRENT USER/DISK, ASSUME IT IS OK - JP CCP_LOC ; JUMP TO COMMAND PROCESSOR -; -;__________________________________________________________________________________________________ -GOMON: - CALL PANIC -; -; DI -; IM 1 ; -; LD SP,STACK +#IF DEBUG + CALL PRTSTRD + .DB "\r\nTransfer to CCP...$" +#ENDIF ; -; ; 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 + LD C,A ; SETUP C WITH CURRENT USER/DISK, ASSUME IT IS OK + JP CCP_LOC ; JUMP TO COMMAND PROCESSOR ; ; ;================================================================================================== @@ -470,8 +532,6 @@ GOMON: ;================================================================================================== ; ;__________________________________________________________________________________________________ -; -;__________________________________________________________________________________________________ CONST: ; CONSOLE STATUS, RETURN $FF IF CHARACTER READY, $00 IF NOT ; @@ -479,7 +539,7 @@ CONST: LD HL,CIOST ; HL = ADDRESS OF COMPLETION ROUTINE JR CONIO ; -;__________________________________________________________________________________________________ +;__________________________________________________________________________________________________ CONIN: ; CONSOLE CHARACTER INTO REGISTER A ; @@ -487,7 +547,7 @@ CONIN: LD HL,CIOIN ; HL = ADDRESS OF COMPLETION ROUTINE JR CONIO -;__________________________________________________________________________________________________ +;__________________________________________________________________________________________________ CONOUT: ; CONSOLE CHARACTER OUTPUT FROM REGISTER C ; @@ -496,7 +556,7 @@ CONOUT: LD E,C ; E = CHARACTER TO SEND ; JR CONIO ; COMMENTED OUT, FALL THROUGH OK ; -;__________________________________________________________________________________________________ +;__________________________________________________________________________________________________ CONIO: ; LD A,(IOBYTE) ; GET IOBYTE @@ -504,8 +564,8 @@ CONIO: ;OR $00 ; PUT LOGICAL DEVICE IN BITS 2-3 (CON:=$00, RDR:=$04, PUN:=$08, LST:=$0C JR CIO_DISP ; -;__________________________________________________________________________________________________ -LIST: +;__________________________________________________________________________________________________ +LIST: ; LIST CHARACTER FROM REGISTER C ; LD B,BF_CIOOUT ; B = FUNCTION @@ -513,7 +573,7 @@ LIST: LD E,C ; E = CHARACTER TO SEND JR LISTIO ; -;__________________________________________________________________________________________________ +;__________________________________________________________________________________________________ LISTST: ; RETURN LIST STATUS (0 IF NOT READY, 1 IF READY) ; @@ -521,7 +581,7 @@ LISTST: LD HL,CIOST ; HL = ADDRESS OF COMPLETION ROUTINE ;JR LISTIO ; COMMENTED OUT, FALL THROUGH OK ; -;__________________________________________________________________________________________________ +;__________________________________________________________________________________________________ LISTIO: ; LD A,(IOBYTE) ; GET IOBYTE @@ -531,7 +591,7 @@ LISTIO: 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 ; @@ -540,7 +600,7 @@ PUNCH: LD E,C ; E = CHARACTER TO SEND ;JR PUNCHIO ; COMMENTED OUT, FALL THROUGH OK ; -;__________________________________________________________________________________________________ +;__________________________________________________________________________________________________ PUNCHIO: ; LD A,(IOBYTE) ; GET IOBYTE @@ -552,7 +612,7 @@ PUNCHIO: 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 ; @@ -560,7 +620,7 @@ READER: LD HL,CIOIN ; HL = ADDRESS OF COMPLETION ROUTINE JR READERIO ; -;__________________________________________________________________________________________________ +;__________________________________________________________________________________________________ READERST: ; RETURN READER STATUS (0 IF NOT READY, 1 IF READY) ; @@ -568,7 +628,7 @@ READERST: LD HL,CIOST ; HL = ADDRESS OF COMPLETION ROUTINE ; JR READERIO ; COMMENTED OUT, FALL THROUGH OK ; -;__________________________________________________________________________________________________ +;__________________________________________________________________________________________________ READERIO: ; LD A,(IOBYTE) ; GET IOBYTE @@ -578,20 +638,20 @@ READERIO: 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) ; @@ -621,7 +681,7 @@ CIO_DISP: LD HL,DEVMAP ; HL = ADDRESS OF DEVICE MAP CALL ADDHLA ; ADD OFFSET - + LD A,(HL) ; LOOKUP DEVICE CODE #IFDEF PLTUNA LD C,B ; MOVE FUNCTION TO C @@ -695,13 +755,13 @@ SELDSK: ; JP DSK_SELECT ; -;__________________________________________________________________________________________________ +;__________________________________________________________________________________________________ HOME: ; SELECT TRACK 0 (BC = 0) AND FALL THRU TO SETTRK #IF DSKTRACE CALL PRTHOME #ENDIF -; +; LD A,(HSTWRT) ; CHECK FOR PENDING WRITE OR A ; SET FLAGS JR NZ,HOMED ; BUFFER IS DIRTY @@ -764,7 +824,7 @@ BLKRES: XOR A LD (HSTACT),A ; BUFFER NO LONGER VALID LD (UNACNT),A ; CLEAR UNALLOC COUNT - + RET ;__________________________________________________________________________________________________ ; @@ -812,7 +872,7 @@ BLKRW: 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: @@ -821,7 +881,7 @@ BLKRW1: 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 @@ -835,11 +895,11 @@ BLKRW2: 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 @@ -870,16 +930,16 @@ BLKRW4: ; 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 @@ -896,7 +956,7 @@ BLKRW6: 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 @@ -904,7 +964,7 @@ BLKRW7: ; 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 @@ -974,24 +1034,24 @@ 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 ; @@ -1022,15 +1082,15 @@ BLKRW1: 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 @@ -1172,6 +1232,11 @@ DSK_GETINF: RLCA ; ... TO USE AS OFFSET INTO DRVMAP CALL ADDHLA ; ADD OFFSET LD D,(HL) ; D := UNIT + + LD A,D ; PUT UNIT IN ACCUM + INC A ; $FF -> $00 + JR Z,DSK_GETINF1 ; HANDLE UNASSIGNED DRIVE LETTER + INC HL ; BUMP TO SLICE LD E,(HL) ; E := SLICE INC HL ; POINT TO DPH LSB @@ -1179,9 +1244,11 @@ DSK_GETINF: 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 + + ;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 ; @@ -1199,6 +1266,7 @@ DSK_GETINF1: ; ERROR RETURN DSK_SELECT: LD B,E ; SAVE E IN B FOR NOW CALL DSK_GETINF ; GET D=UNIT, E=SLICE, HL=DPH ADDRESS + ;CALL NZ,PANIC ; *DEBUG* RET NZ ; RETURN IF INVALID DRIVE (A=1, NZ SET, HL=0) PUSH BC ; WE NEED B LATER, SAVE ON STACK ; @@ -1209,23 +1277,50 @@ DSK_SELECT: LD (SEKUNIT),A ; SAVE UNIT LD (SEKDPH),HL ; SAVE DPH ADDRESS ; - ; 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 + LD A,E ; A := SLICE + LD (SLICE),A ; SAVE IT + ; UPDATE LBAOFF FROM DPH + LD HL,(SEKDPH) + LD A,16 + CALL ADDHLA + LD DE,SEKLBA + LD BC,4 + LDIR ; ; RESTORE DE TO BC (FOR ACCESS TO DRIVE LOGIN BIT) POP BC ; GET ORIGINAL E INTO B -; -#IFDEF PLTWBW ; ; 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 +; +#IFDEF PLTUNA +; + LD A,(SEKUNIT) ; GET DISK UNIT + 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 + CP $40 ; RAM/ROM DRIVE? + JR Z,DSK_SELECT1 ; HANDLE RAM/ROM DRIVE + LD A,MID_HD ; OTHERWISE WE HAVE A HARD DISK + JR DSK_SELECT1A ; DONE +; +DSK_SELECT1: + ; UNA RAM/ROM DRIVE + LD C,$45 ; UNA FUNC: GET DISK INFO + LD DE,(DSKBUF) ; 512 BYTE BUFFER + CALL $FFFD ; CALL UNA + BIT 7,B ; TEST RAM DRIVE BIT + LD A,MID_MDROM ; ASSUME ROM + JR Z,DSK_SELECT1A ; IS ROM, DONE + LD A,MID_MDRAM ; MUST BE RAM +; +DSK_SELECT1A: + LD (MEDID),A +; +#ELSE ; ; DETERMINE MEDIA IN DRIVE LD A,(SEKUNIT) ; GET UNIT @@ -1234,11 +1329,48 @@ DSK_SELECT: LD E,1 ; ENABLE MEDIA CHECK/DISCOVERY RST 08 ; DO IT LD A,E ; RESULTANT MEDIA ID TO ACCUM + LD (MEDID),A ; SAVE IT 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 +#ENDIF +; + ; CLEAR LBA OFFSET (DWORD) + ; SET HI BIT FOR LBA ACCESS FOR NOW + LD HL,0 ; ZERO + LD (SEKLBA),HL ; CLEAR FIRST WORD + SET 7,H ; ASSUME LBA ACCESS FOR NOW + LD (SEKLBA+2),HL ; CLEAR SECOND WORD +; +#IFDEF PLTWBW +; + LD A,(SEKUNIT) ; GET UNIT + LD C,A ; STORE IN C + LD B,BF_DIODEVICE ; HBIOS FUNC: REPORT DEVICE INFO + RST 08 ; GET UNIT INFO, DEVICE TYPE IN D + LD A,D ; DEVICE TYPE -> A + AND $F0 ; ISOLATE HIGH BITS + CP DIODEV_FD ; FLOPPY? + JR NZ,DSK_SELECT1B ; IF NOT, DO LBA IO + LD HL,SEKLBA+3 ; POINT TO HIGH ORDER BYTE + RES 7,(HL) ; SWITCH FROM LBA -> CHS +; +#ENDIF +; +DSK_SELECT1B: + ; SET LEGACY SECTORS PER SLICE + LD HL,16640 ; LEGACY SECTORS PER SLICE + LD (SPS),HL ; SAVE IT +; + ; CHECK MBR OF PHYSICAL DISK BEING SELECTED + ; WILL UPDATE MEDID AND LBAOFF IF VALID CP/M PARTITION EXISTS + CALL DSK_MBR ; UPDATE MEDIA FROM MBR + LD HL,0 ; ASSUME FAILURE + RET NZ ; ABORT ON I/O ERROR +; + ; SET HL TO DPBMAP ENTRY CORRESPONDING TO MEDIA ID + LD A,(MEDID) ; GET MEDIA ID LD HL,DPBMAP ; HL = DPBMAP RLCA ; DPBMAP ENTRIES ARE 2 BYTES EACH CALL ADDHLA ; ADD OFFSET TO HL @@ -1247,21 +1379,169 @@ DSK_SELECT: 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 HL,(SEKDPH) ; POINT TO START OF DPH 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 +; + ; PLUG LBA OFFSET INTO ACTIVE DPH + LD HL,(SEKDPH) ; POINT TO START OF DPH + LD BC,16 ; OFFSET OF LBA OFFSET IN DPH + ADD HL,BC ; HL := DPH.LBAOFF PTR + EX DE,HL ; DEST IS DPH.LBAOFF PTR + LD HL,SEKLBA ; SOURCE IS LBAOFF + LD BC,4 ; 4 BYTES + LDIR ; DO IT ; DSK_SELECT2: LD HL,(SEKDPH) ; HL = DPH ADDRESS FOR CP/M XOR A ; FLAG SUCCESS RET ; NORMAL RETURN ; +; CHECK MBR OF DISK TO SEE IF IT HAS A PARTITION TABLE. +; IF SO, LOOK FOR A CP/M PARTITION. IF FOUND, GET +; UPDATE THE PARTITION OFFSET (LBAOFF) AND UPDATE +; THE MEDIA ID (MEDID). +; +DSK_MBR: + ; CHECK MEDIA TYPE, ONLY HARD DISK IS APPLICABLE + LD A,(MEDID) ; GET MEDIA ID + CP MID_HD ; HARD DISK? + JR Z,DSK_MBR0 ; IF SO, CONTINUE + XOR A ; ELSE, N/A, SIGNAL SUCCESS + RET ; AND RETURN + +DSK_MBR0: +; +#IFDEF PLTWBW + ; ACTIVATE BIOS BANK TO ACCESS DISK BUFFER + LD (STKSAV),SP ; SAVE CUR STACK + LD SP,STACK ; NEW STACK IN HI MEM + LD A,(BNKBIOS) ; ACTIVATE HBIOS BANK + PUSH IX ; SAVE IX + LD IX,DSK_MBR1 ; ROUTINE TO RUN + CALL HB_BNKCALL ; DO IT + POP IX ; RESTORE IX + LD SP,(STKSAV) ; RESTORE ORIGINAL STACK + RET +#ENDIF +; +DSK_MBR1: + ; FLUSH DSKBUF TO MAKE SURE IT IS SAFE TO USE IT. + CALL BLKFLSH ; MAKE SURE DISK BUFFER IS NOT DIRTY + XOR A ; CLEAR ACCUM + LD (HSTACT),A ; CLEAR HOST BUFFER ACTIVE FLAG +; + ; READ SECTOR ZERO (MBR) + LD B,BF_DIOREAD ; READ FUNCTION + LD A,(SEKUNIT) ; GET UNIT + LD C,A ; PUT IN C + LD DE,0 ; LBA SECTOR ZERO + LD HL,0 ; ... +#IFDEF PLTWBW + SET 7,D ; MAKE SURE LBA ACCESS BIT SET +#ENDIF + CALL DSK_IO2 ; DO IT + RET NZ ; ABORT ON ERROR +; + ; CHECK SIGNATURE + LD HL,(DSKBUF) ; DSKBUF ADR + LD DE,$1FE ; OFFSET TO SIGNATURE + ADD HL,DE ; POINT TO SIGNATURE + LD A,(HL) ; GET FIRST BYTE + CP $55 ; CHECK FIRST BYTE + JR NZ,DSK_MBR5 ; NO MATCH, NO PART TABLE + INC HL ; NEXT BYTE + LD A,(HL) ; GET SECOND BYTE + CP $AA ; CHECK SECOND BYTE + JR NZ,DSK_MBR5 ; NO MATCH, NO PART TABLE, ABORT +; + ; TRY TO FIND OUR ENTRY IN PART TABLE AND CAPTURE LBA OFFSET + LD B,4 ; FOUR ENTRIES IN PART TABLE + LD HL,(DSKBUF) ; DSKBUF ADR + LD DE,$1BE+4 ; OFFSET OF FIRST ENTRY PART TYPE + ADD HL,DE ; POINT TO IT +DSK_MBR2: + LD A,(HL) ; GET PART TYPE + CP $2E ; CP/M PARTITION? + JR Z,DSK_MBR3 ; COOL, GRAB THE LBA OFFSET + LD DE,16 ; PART TABLE ENTRY SIZE + ADD HL,DE ; BUMP TO NEXT ENTRY PART TYPE + DJNZ DSK_MBR2 ; LOOP THRU TABLE + JR DSK_MBR5 ; TOO BAD, NO CP/M PARTITION +; +DSK_MBR3: + ; WE HAVE LOCATED A VALID CP/M PARTITION + ; HL POINTS TO PART TYPE FIELD OF PART ENTRY +; + ; CAPTURE THE LBA OFFSET + LD DE,4 ; LBA IS 4 BYTES AFTER PART TYPE + ADD HL,DE ; POINT TO IT + LD DE,SEKLBA ; LOC TO STORE LBA OFFSET + LD BC,4 ; 4 BYTES (32 BITS) + LDIR ; COPY IT +; + ; CHECK THAT REQUESTED SLICE IS "INSIDE" PARTITION + ; SLICE SIZE IS EXACTLY 16,384 SECTORS (8MB), SO WE CAN JUST + ; RIGHT SHIFT PARTITION SECTOR COUNT BY 14 BITS + LD E,(HL) ; HL POINTS TO FIRST BYTE + INC HL ; ... OF 32 BIT PARTITION + LD D,(HL) ; ... SECTOR COUNT, + INC HL ; ... LOAD SECTOR COUNT + PUSH DE ; ... INTO DE:HL + LD E,(HL) ; ... + INC HL ; ... + LD D,(HL) ; ... + POP HL ; ... DE:HL = PART SIZE IN SECTORS + LD B,2 ; DE = DE:HL >> 2 (TRICKY!) + CALL RL32 ; DE = SLICECNT + EX DE,HL ; HL = SLICECNT + LD A,(SLICE) ; GET TARGET SLICE + LD C,A ; PUT IN C + LD B,0 ; BC := REQUESTED SLICE # + SCF ; SET CARRY! + SBC HL,BC ; MAX SLICES - SLICE - 1 + JR NC,DSK_MBR4 ; NO OVERFLOW, OK TO CONTINUE + OR $FF ; SLICE TOO HIGH, SIGNAL ERROR + RET ; AND BAIL OUT +; +DSK_MBR4: + ; IF BOOT FROM PARTITION, USE NEW SECTORS PER SLICE VALUE + LD HL,16384 ; NEW SECTORS PER SLICE + LD (SPS),HL ; SAVE IT + + ; UPDATE MEDIA ID + LD A,MID_HDNEW ; NEW MEDIA ID + LD (MEDID),A ; SAVE IT +; +DSK_MBR5: + ; ADJUST LBA OFFSET BASED ON TARGET SLICE + LD A,(SLICE) ; GET SLICE, A IS LOOP CNT + LD HL,(SEKLBA) ; SET DE:HL + LD DE,(SEKLBA+2) ; ... TO STARTING LBA + LD BC,(SPS) ; SECTORS PER SLICE +DSK_MBR6: + OR A ; SET FLAGS TO CHECK LOOP CNTR + JR Z,DSK_MBR8 ; DONE IF COUNTER EXHAUSTED + ADD HL,BC ; ADD ONE SLICE TO LOW WORD + JR NC,DSK_MBR7 ; CHECK FOR CARRY + INC DE ; IF SO, BUMP HIGH WORD +DSK_MBR7: + DEC A ; DEC LOOP DOWNCOUNTER + JR DSK_MBR6 ; AND LOOP +DSK_MBR8: + SET 7,D ; SET LBA ACCESS FLAG + ; RESAVE IT + LD (SEKLBA),HL ; LOWORD + LD (SEKLBA+2),DE ; HIWORD + ; SUCCESSFUL FINISH + XOR A ; SUCCESS + RET ; DONE +; ; ; DSK_STATUS: @@ -1272,7 +1552,7 @@ DSK_STATUS: ; C HAS CPM DRIVE, LOOKUP UNIT AND CHECK FOR INVALID DRIVE CALL DSK_GETINF ; B := UNIT RET NZ ; INVALID DRIVE ERROR - + ; VALID DRIVE, DISPATCH TO DRIVER LD C,D ; C := UNIT LD B,BF_DIOSTATUS ; B := FUNCTION: STATUS @@ -1296,71 +1576,18 @@ DSK_WRITE: ; ; ; -#IFDEF PLTUNA - DSK_IO: - PUSH BC - LD DE,(HSTTRK) ; GET TRACK INTO HL - LD B,4 ; PREPARE TO LEFT SHIFT BY 4 BITS -DSK_IO1: - SLA E ; SHIFT DE LEFT BY 4 BITS - RL D - DJNZ DSK_IO1 ; 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 ADCHLA ; ADD OFFSET - POP BC ; RECOVER FUNCTION IN B - LD A,(HSTUNIT) ; GET THE 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,(DSKBUF) ; SET BUFFER ADDRESS - LD HL,1 ; 1 SECTOR - ; DISPATCH TO UBIOS - RST 08 - OR A ; SET FLAGS BASED ON RESULT - RET - -#ELSE - -DSK_IO: -; -; TRANSLATE CP/M TRACK/SECTOR -> HBIOS TRACK/HEAD/SECTOR -; NEEDS TO HANDLE FLOPPY SEPARATE FROM HARD DISK -; -CHS: LD A,(HSTUNIT) ; GET UNIT LD C,A ; UNIT -> C - PUSH BC ; SAVE FUNC/UNIT - LD B,BF_DIODEVICE ; HBIOS FUNC: REPORT DEVICE INFO - RST 08 ; GET UNIT INFO, DEVICE TYPE IN D - POP BC ; GET FUNC/UNIT BACK TO BC - LD A,D ; DEVICE TYPE -> A - AND $F0 ; ISOLATE HIGH BITS - CP DIODEV_FD ; FLOPPY? - JR NZ,CHSHD ; IF NOT, DO HD CHS XLAT +; +#IFDEF PLTWBW + LD A,(HSTLBA+3) ; GET HIGH ORDER BYTE + BIT 7,A ; LBA ACCESS? + JR NZ,LBA_IO ; IF SET, GO TO LBA I/O ; ; FLOPPY SPECIFIC TRANSLATION ASSUMES FLOPPY IS DOUBLE-SIDED AND ; USES LOW ORDER BIT OF TRACK AS HEAD VALUE -; +; ; HBIOS SEEK: HL=CYLINDER, D=HEAD, E=SECTOR ; LD DE,(HSTSEC) ; SECTOR -> DE, HEAD(D) BECOMES ZERO @@ -1368,53 +1595,74 @@ CHS: SRL H ; SHIFT HEAD BIT OUT OF HL RR L ; ... AND INTO CARRY RL D ; CARRY BIT (HEAD) INTO D - JR CHS2 + JR DSK_IO2 ; DO THE DISK I/O ; -; HARD DISK SPECIFIC TRANSLATION -; ASSUMES 16 HEADS PER CYLINDER AND 16 SECTORS PER TRACK +#ENDIF ; -CHSHD: - LD HL,(HSTTRK) ; GET TRACK VALUE - LD A,L ; LSB OF TRACK TO A - AND $0F ; ISOLATE HEAD IN LOW 4 BITS - LD D,A ; STUFF IT IN D +LBA_IO: + PUSH BC ; SAVE FUNC/UNIT + ; GET TRACK AND SHIFT TO MAKE ROOM FOR 4 BIT SECTOR VALUE + LD HL,(HSTTRK) ; GET TRACK + LD DE,0 ; CLEAR HIWORD + LD B,4 ; X16 (16 SPT ASSUMED) + CALL RL32 ; DO IT + ; COMBINE WITH SECTOR LD A,(HSTSEC) ; GET SECTOR - LD E,A ; STUFF IT IN E - LD A,B ; SAVE B (HBIOS FUNC) - LD B,4 ; PREPARE TO SHIFT OUT 4 BIT HEAD VALUE -CHSHD1: - SRL H ; SHIFT ONE BIT OUT - RR L ; ... OF HL - DJNZ CHSHD1 ; DO ALL 4 BITS - LD B,A ; RESTORE B (HBIOS FUNC) - ; FALL THRU TO CHS2 -; -; ALL TYPES OF TRANSLATION WIND UP HERE TO -; MAKE THE ACTUAL HBIOS CALL -; -CHS2: - PUSH DE ; SAVE HEAD/SECTOR + COULD MOVE - LD DE,(HSTOFF) ; NOW GET SLICE OFFSET | TO CHSHD, - ADD HL,DE ; ADD IT TO TRACK VALUE | NO SLICES - POP DE ; RECOVER HEAD/SECTOR + FOR FLOPPY + OR L + LD L,A + ; ADD IN LBA OFFSET FOR PARTITION AND/OR SLICE + LD BC,(HSTLBA) ; LBA OFFSET LOWORD + ADD HL,BC + EX DE,HL + LD BC,(HSTLBA+2) ; LBA OFFSET HIWORD + ADC HL,BC + EX DE,HL + POP BC ; RESTORE FUNC/UNIT + ;JR DSK_IO2 ; DO THE DISK I/O (FALL THRU) +; +#IFDEF PLTUNA +; +; MAKE UNA UBIOS CALL +; HBIOS FUNC SHOULD STILL BE IN B +; UNIT SHOULD STILL BE IN C +; +DSK_IO2: + PUSH BC ; SAVE INCOMING FUNCTION, UNIT + RES 7,D ; CLEAR LBA BIT FOR UNA + LD B,C ; UNIT TO B + LD C,$41 ; UNA SET LBA + RST 08 ; CALL UNA + POP BC ; RECOVER B=FUNC, C=UNIT + RET NZ ; ABORT IF SEEK RETURNED AN ERROR W/ ERROR IN A + LD E,C ; UNIT TO E + LD C,B ; FUNC TO C + LD B,E ; UNIT TO B + LD DE,(DSKBUF) ; SET BUFFER ADDRESS + LD HL,1 ; 1 SECTOR + ; DISPATCH TO UBIOS + RST 08 ; CALL UNA + RET ; DONE +; +#ELSE ; ; MAKE HBIOS CALL ; HBIOS FUNC SHOULD STILL BE IN B ; UNIT SHOULD STILL BE IN C ; - PUSH BC ; SAVE INCOMING FUNCTION, DEVICE/UNIT - LD B,BF_DIOSEEK ; SETUP FOR NEW SEEK CALL +DSK_IO2: + PUSH BC ; SAVE INCOMING FUNCTION, UNIT + LD B,BF_DIOSEEK ; SETUP FOR NEW SEEK CALL RST 08 ; DO IT - POP BC ; RESTORE INCOMING FUNCTION, DEVICE/UNIT - RET NZ ; ABORT IF SEEK RETURNED AN ERROR W/ ERROR IN A - LD HL,(DSKBUF) ; GET BUFFER ADDRESS + POP BC ; RESTORE INCOMING FUNCTION, DEVICE/UNIT + RET NZ ; ABORT IF SEEK RETURNED AN ERROR W/ ERROR IN A + LD HL,(DSKBUF) ; GET BUFFER ADDRESS LD A,(BNKBIOS) ; GET BIOS BANK LD D,A ; TRANSFER TO/FROM BIOS BANK - LD E,1 ; TRANSFER ONE SECTOR + LD E,1 ; TRANSFER ONE SECTOR RST 08 ; DO IT OR A ; SET FLAGS RET ; DONE - +; #ENDIF ; ;================================================================================================== @@ -1501,12 +1749,22 @@ STR_SEC .DB " SEC=$" ; DATA ;================================================================================================== ; -;STR_READONLY .DB "\r\nCBIOS Err: Read Only Drive$" -;STR_STALE .DB "\r\nCBIOS Err: Stale Drive$" +;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 +;SECADR .DW 0 ; ADDRESS OF SECTOR IN ROM/RAM PAGE DEFDRIVE .DB 0 ; DEFAULT DRIVE CCPBUF .DW 0 ; ADDRESS OF CCP BUF IN BIOS BANK +MEDID .DB 0 ; TEMP STORAGE FOR MEDIA ID +SLICE .DB 0 ; CURRENT SLICE +SPS .DW 0 ; SECTORS PER SLICE +STKSAV .DW 0 ; TEMP SAVED STACK POINTER +; +#IFDEF PLTWBW + #IF QPMTIMDAT +CLKDAT .FILL 7,0 ; RTC CLOCK DATA BUFFER + #ENDIF +#ENDIF ; #IFDEF PLTWBW BNKBIOS .DB 0 ; BIOS BANK ID @@ -1521,21 +1779,22 @@ BNKUSER .DW 0 ; USER BANK ID ; 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 +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 DSKBUF .DW 0 ; ADDRESS OF PHYSICAL SECTOR BUFFER ; ; LOGICAL 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) -SEKUNIT .DB 0 ; DISK UNIT +SEKDSK .DB 0 ; DISK NUMBER 0-15 +SEKTRK .DW 0 ; TWO BYTES FOR TRACK # (LOGICAL) +SEKSEC .DW 0 ; TWO BYTES FOR SECTOR # (LOGICAL) +SEKUNIT .DB 0 ; DISK UNIT SEKDPH .DW 0 ; ADDRESS OF ACTIVE (SELECTED) DPH SEKOFF .DW 0 ; TRACK OFFSET IN EFFECT FOR SLICE SEKACT .DB TRUE ; ALWAYS TRUE! +SEKLBA .FILL 4,0 ; LBA OFFSET ; ; RESULT OF CPM TO PHYSICAL TRANSLATION ; @@ -1547,6 +1806,7 @@ XLTUNIT .DB 0 XLTDPH .DW 0 XLTOFF .DW 0 XLTACT .DB TRUE ; ALWAYS TRUE! +XLTLBA .FILL 4,0 ; LBA OFFSET ; XLTSIZ .EQU $ - XLT ; @@ -1560,13 +1820,14 @@ HSTUNIT .DB 0 ; DISK UNIT IN BUFFER HSTDPH .DW 0 ; CURRENT DPH ADDRESS HSTOFF .DW 0 ; TRACK OFFSET IN EFFECT FOR SLICE HSTACT .DB 0 ; TRUE = BUFFER HAS VALID DATA +HSTLBA .FILL 4,0 ; LBA OFFSET ; ; SEQUENTIAL WRITE TRACKING FOR (UNA)LLOCATED 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) +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 ; @@ -1595,13 +1856,13 @@ ALS_HD .EQU 256 ; ALS: BLKS / 8 = 2048 / 8 = 256 (ROUNDED UP) ; 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 +; 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) +; 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 ; @@ -1623,21 +1884,21 @@ ALS_HD .EQU 256 ; ALS: BLKS / 8 = 2048 / 8 = 256 (ROUNDED UP) .DW ALS_ROM ; ALS: BLKS / 8 .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 + .DW 64 ; SPT: SECTORS PER TRACK + .DB 4 ; BSH: BLOCK SHIFT FACTOR + .DB 15 ; BLM: BLOCK MASK .DB 1 ; EXM: (BLKS <= 256) ? 1 : 0 .DW 192 - 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 + .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 - 128K RESERVED FOR SYSTEM USE +; RAM DISK SIZE = TOTAL RAM - 256K RESERVED FOR SYSTEM USE ; ; ALS_RAM, EXM, DSM MUST BE FILLED DYNAMICALLY: ; - ALS_RAM := (BANKS * 2) @@ -1650,16 +1911,16 @@ DPB_ROM: .DW ALS_RAM ; ALS: BLKS / 8 .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 + .DW 64 ; SPT: SECTORS PER TRACK + .DB 4 ; BSH: BLOCK SHIFT FACTOR + .DB 15 ; BLM: BLOCK MASK .DB 1 ; EXM: (BLKS <= 256) ? 1 : 0 - .DW 192 - 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 + .DW 128 - 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 @@ -1669,16 +1930,16 @@ DPB_RAM: .DW ALS_HD .DB (2048 / 128) ; RECORDS PER BLOCK (BLS / 128) DPB_RF: - .DW 64 ; 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 511 ; DRM: DIR ENTRIES - 1 = 256 - 1 = 255 - .DB 11111111B ; 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 + .DW 64 ; 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 511 ; DRM: DIR ENTRIES - 1 = 256 - 1 = 255 + .DB 11111111B ; 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) @@ -1690,16 +1951,33 @@ DPB_RF: .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 + .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 512 - 1 ; DRM: DIR ENTRIES - 1 + .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 +; +; BLOCKSIZE (BLS) = 4K, DIRECTORY ENTRIES = 1024 +; + .DW CKS_HD + .DW ALS_HD + .DB (4096 / 128) ; RECORDS PER BLOCK (BLS / 128) +DPB_HDNEW: + .DW 64 ; SPT: SECTORS PER TRACK + .DB 5 ; BSH: BLOCK SHIFT FACTOR + .DB 31 ; BLM: BLOCK MASK + .DB 1 ; EXM: EXTENT MASK + .DW 2048 - 1 - 4 ; DSM: STORAGE BLOCKS - 1 - RES TRKS + .DW 1024 - 1 ; DRM: DIR ENTRIES - 1 + .DB 11111111B ; 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 2 ; OFF: RESERVED TRACKS ;__________________________________________________________________________________________________ ; ; IBM 720KB 3.5" FLOPPY DRIVE, 80 TRKS, 36 SECS/TRK, 512 BYTES/SEC @@ -1709,16 +1987,16 @@ DPB_HD: .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 + .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 @@ -1728,16 +2006,16 @@ DPB_FD720: .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 + .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 @@ -1747,16 +2025,16 @@ DPB_FD144: .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 + .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 @@ -1766,16 +2044,16 @@ DPB_FD360: .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 + .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 @@ -1785,16 +2063,16 @@ DPB_FD120: .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 + .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 ; #IFDEF PLTUNA SECBUF .FILL 512,0 ; PHYSICAL DISK SECTOR BUFFER @@ -1819,7 +2097,13 @@ BUFPOOL .EQU $ ; START OF BUFFER POOL HEAPEND .EQU CBIOS_END - 64 ; TOP OF HEAP MEM, END OF CBIOS LESS 32 ENTRY STACK ; INIT: - DI ; NO INTERRUPTS FOR NOW +; +#IF DEBUG + CALL PRTSTRD + .DB "\r\nStarting INIT....$" +#ENDIF +; + ;DI ; NO INTERRUPTS FOR NOW ; ADJUST BOOT VECTOR TO REBOOT ROUTINE LD HL,REBOOT ; GET REBOOT ADDRESS @@ -1846,12 +2130,12 @@ INIT: LD DE,(BNKBIOS) ; UBIOS_PAGE (SEE PAGES.INC) CALL $FFFD ; DO IT (RST 08 NOT YET INSTALLED) PUSH DE ; SAVE PREVIOUS BANK - + LD HL,0 ; FROM ADDRESS 0 (PAGE ZERO) LD DE,SECBUF ; USE SECBUF AS BOUNCE BUFFER LD BC,256 ; ONE PAGE IS 256 BYTES LDIR ; DO IT - + LD BC,$01FB ; UNA FUNC = SET BANK POP DE ; RECOVER OPERATING BANK CALL $FFFD ; DO IT (RST 08 NOT YET INSTALLED) @@ -1860,7 +2144,7 @@ INIT: LD DE,0 ; TO PAGE ZERO OF OPERATING BANK LD BC,256 ; ONE PAGE IS 256 BYTES LDIR ; DO IT - + ; INSTALL UNA INVOCATION VECTOR FOR RST 08 LD A,$C3 ; JP INSTRUCTION LD (8),A ; STORE AT 0x0008 @@ -1876,11 +2160,21 @@ INIT: LD (BNKBIOS),A ; ... AND SAVE IT LD A,E ; GET USER BANK RETURNED IN E LD (BNKUSER),A ; ... AND SAVE IT - +; + #IF DEBUG + CALL PRTSTRD + .DB "\r\nReseting HBIOS....$" + #ENDIF +; ; SOFT RESET HBIOS LD B,BF_SYSRESET ; HB FUNC: RESET + LD C,BF_SYSRES_INT ; WARM START RST 08 ; DO IT - +; + #IF DEBUG + CALL PRTSTRD + .DB "\r\nCopying HCB....$" + #ENDIF ; CREATE A TEMP COPY OF THE HBIOS CONFIG BLOCK (HCB) ; FOR REFERENCE USE DURING INIT LD B,BF_SYSSETCPY ; HBIOS FUNC: SETUP BANK COPY @@ -1891,7 +2185,7 @@ INIT: LD HL,HCB_LOC ; COPY FROM FIXED LOCATION IN HB BANK LD DE,HCB ; TO TEMP LOCATION IN USR BANK RST 08 ; DO IT - + ; CAPTURE RAM DRIVE STARTING BANK LD A,(HCB + HCB_BIDRAMD0) LD (BNKRAMD),A @@ -1905,13 +2199,33 @@ INIT: CALL NEWLINE2 ; FORMATTING LD DE,STR_BANNER ; POINT TO BANNER CALL WRITESTR ; DISPLAY IT - + +#IFDEF PLTWBW + ; CHECK FPR HBIOS/CBIOS VERSION MISMATCH + LD B,BF_SYSVER ; HBIOS VERSION + RST 08 ; DO IT, DE=MAJ/MIN/UP/PAT + LD A,D ; A := MAJ/MIN + CP ((RMJ << 4) | RMN) ; MATCH? + JR NZ,INIT1 ; HANDLE VER MISMATCH + LD A,E ; A := OS UP/PAT + AND $F0 ; PAT NOT INCLUDED IN MATCH + CP (RUP << 4) ; MATCH? + JR NZ,INIT1 ; HANDLE VER MISMATCH + JR INIT2 ; ALL GOOD, CONTINUE +INIT1: + ; DISPLAY VERSION MISMATCH + CALL NEWLINE2 ; FORMATTING + LD DE,STR_VERMIS ; VERSION MISMATCH + CALL WRITESTR ; DISPLAY IT +INIT2: +#ENDIF +; #IFDEF PLTUNA ; 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 + CALL NZ,ERR_BIOMEM ; BIG PROBLEM LD (CCPBUF),HL ; SAVE THE ADDRESS (IN BIOS MEM) LD BC,$01FB ; UNA FUNC = SET BANK @@ -1932,7 +2246,7 @@ INIT: LD B,BF_SYSALLOC ; HBIOS FUNC: ALLOCATE HEAP MEMORY LD HL,CCP_SIZ ; SIZE TO ALLOC (SIZE OF CCP) RST 08 ; DO IT - CALL NZ,PANIC ; BIG PROBLEM + CALL NZ,ERR_BIOMEM ; BIG PROBLEM LD (CCPBUF),HL ; SAVE THE ADDRESS (IN BIOS MEM) LD B,BF_SYSSETCPY ; HBIOS FUNC: SETUP BANK COPY LD A,(BNKUSER) ; GET USER BANK @@ -1953,6 +2267,56 @@ INIT: CALL MD_INIT ; INITIALIZE MEMORY DISK DRIVER (RAM/ROM) CALL DRV_INIT ; INITIALIZE DRIVE MAP CALL DPH_INIT ; INITIALIZE DPH TABLE AND BUFFERS +; + ; SET THE DEFAULT DRIVE + XOR A ; ZERO ACCUM + LD (DEFDRIVE),A ; SET DEFAULT DRIVE TO A: TO START +; +#IFDEF PLTWBW +; + ; IF WE HAVE MULTIPLE DRIVES AND THE FIRST DRIVE IS RAM DRIVE + ; AND THE SECOND DRIVE IS ROM DRIVE OR FLASH DRIVE + ; THEN MAKE OUR DEFAULT STARTUP DRIVE THE SECOND DRIVE (B:) +; + ; CHECK FOR 2+ DRIVES + LD HL,(DRVMAPADR) ; POINT TO DRIVE MAP + DEC HL ; BUMP BACK TO DRIVE COUNT + LD A,(HL) ; GET IT + CP 2 ; COMPARE TO 2 + JR C,INIT2X ; IF LESS THAN 2, THEN DONE +; + ; CHECK IF FIRST UNIT IS RAM + LD B,BF_DIODEVICE ; HBIOS FUNC: REPORT DEVICE INFO + INC HL ; POINT TO UNIT FIELD OF FIRST DRIVE + LD C,(HL) ; PUT UNIT NUM IN C + RST 08 ; CALL HBIOS + LD A,C ; GET ATTRIBUTES + AND %00111000 ; ISOLATE TYPE BITS + CP %00101000 ; TYPE = RAM? + JR NZ,INIT2X ; IF NOT THEN DONE +; + ; CHECK IF SECOND UNIT IS ROM OR FLASH + LD B,BF_DIODEVICE ; HBIOS FUNC: REPORT DEVICE INFO + LD HL,(DRVMAPADR) ; POINT TO DRIVE MAP + LD A,4 ; 4 BYTES PER ENTRY + CALL ADDHLA ; POINT TO UNIT FIELD OF SECOND DRIVE + LD C,(HL) ; PUT UNIT NUM IN C + RST 08 ; CALL HBIOS + LD A,C ; GET ATTRIBUTES + AND %00111000 ; ISOLATE TYPE BITS + CP %00100000 ; TYPE = ROM? + JR Z,INIT2A ; IF SO, ADJUST DEF DRIVE + CP %00111000 ; TYPE = FLASH? + JR NZ,INIT2X ; IF NOT THEN DONE +; +INIT2A: + ; CRITERIA MET, ADJUST DEF DRIVE TO B: + LD A,1 ; USE SECOND DRIVE AS DEFAULT + LD (DEFDRIVE),A ; RECORD DEFAULT DRIVE +; +INIT2X: +; +#ENDIF ; #IFDEF PLTUNA ; USE A DEDICATED BUFFER FOR UNA PHYSICAL DISK I/O @@ -1978,7 +2342,7 @@ INIT: 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 ; @@ -1987,9 +2351,9 @@ INIT: 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 + JR NZ,INIT3 ; NOPE, CP/M IS RIGHT LD DE,STR_ZSDOS ; SWITCH TO ZSDOS LABEL -INIT2: +INIT3: CALL WRITESTR ; DISPLAY OS LABEL LD DE,STR_TPA1 ; TPA PREFIX CALL WRITESTR @@ -1997,14 +2361,35 @@ INIT2: CALL PRTDECB ; PRINT IT CALL PC_PERIOD ; DECIMAL POINT LD A,0 + (((BDOS_LOC % 1024) * 100) / 1024) - CALL PRTDECB ; MANTISSA + CALL PRTDECB ; MANTISSA LD DE,STR_TPA2 ; AND TPA SUFFIX CALL WRITESTR CALL NEWLINE ; FORMATTING +; +; SETUP QP/M TIMDAT ROUTINE VECTOR IN ZERO PAGE AT 0x0010 +; +#IFDEF PLTWBW + #IF QPMTIMDAT + LD A,$C3 ; JP INSTRUCTION + LD ($0010),A ; STORE AT 0x0008 + LD HL,TIMDAT ; ROUTINE ADDRESS + LD ($0011),HL ; SET VECTOR + #ENDIF +#ENDIF +; RET ; DONE ; +ERR_BIOMEM: + CALL NEWLINE2 ; FORMATTING + LD DE,STR_HEAPOVF ; HBIOS HEAP MEM OVERFLOW + CALL WRITESTR ; TELL THE USER + CALL PANIC ; AND GRIND TO A SCREACHING HALT +; ; ;__________________________________________________________________________________________________ +; +#IF AUTOSUBMIT +; AUTOSUB: ; ; SETUP AUTO SUBMIT COMMAND (IF REQUIRED FILES EXIST) @@ -2036,6 +2421,8 @@ AUTOSUB: LDIR ; PATCH COMMAND LINE INTO CCP RET ; DONE ; +#ENDIF +; ; ;__________________________________________________________________________________________________ DEV_INIT: @@ -2045,7 +2432,7 @@ DEV_INIT: ; PATCH IN CRT: DEVICE LD A,(HCB + HCB_CRTDEV) ; GET CONSOLE DEVICE CP $FF ; NUL MEANS NO CRT DEVICE - JR Z,DEV_INIT00 ; IF SO, LEAVE IT ALONE + JR Z,DEV_INIT000 ; IF SO, LEAVE IT ALONE LD (DEVMAP + 1),A ; CONSOLE CRT LD (DEVMAP + 13),A ; LIST CRT ; @@ -2054,31 +2441,43 @@ DEV_INIT: LD B,A ; SAVE IN B LD A,(HCB + HCB_CONDEV) ; GET CONSOLE DEVICE CP B ; COMPARE - JR NZ,DEV_INIT00 ; IF DIFFERENT (CRT NOT ACTIVE), LEAVE IOBYTE ALONE + JR NZ,DEV_INIT000 ; IF DIFFERENT (CRT NOT ACTIVE), LEAVE IOBYTE ALONE LD A,1 ; IF SAME (CRT ACTIVE), SET IOBYTE FOR CON: = CRT: LD (IOBYTE),A ; STORE IN IOBYTE + LD HL,DEV_INIT1 ; INIT FIRST DEV ASSIGN ADR + JR DEV_INIT00 ; SKIP AHEAD +; +DEV_INIT000: + ; CONSOLE IS NOT THE CRT, SO + ; ASSIGN CURRENT CONSOLE AS TTY + LD A,(HCB + HCB_CONDEV) ; GET CONSOLE DEVICE + CALL DEV_INIT1 ; ASSIGN AS TTY ; DEV_INIT00: - ; LOOP THRU DEVICES ADDING NON-CRT DEVICES TO DEVMAP + ; LOOP THRU DEVICES ADDING DEVICES TO DEVMAP + ; CONSOLE DEVICE WAS ALREADY DONE, SO IT IS SKIPPED HERE LD B,BF_SYSGET ; HBIOS FUNC: GET SYS INFO LD C,BF_SYSGET_CIOCNT ; SUBFUNC: GET CIO UNIT COUNT RST 08 ; E := SERIAL UNIT COUNT LD B,E ; COUNT TO B LD C,0 ; UNIT INDEX - LD HL,DEV_INIT1 ; POINTER FOR FIRST ENTRY FOUND DEV_INIT0: - PUSH BC ; SAVE LOOP CONTROL - PUSH HL ; SAVE TARGET - LD B,BF_CIODEVICE ; HBIOS FUNC: GET DEVICE INFO - RST 08 ; D := DEVICE TYPE, E := PHYSICAL UNIT NUMBER - POP HL ; RESTORE TARGET - LD A,D ; DEVICE TYPE TO A - ; FIX: BELOW SHOULD TEST THE "TERMINAL" BIT INSTEAD OF CHECKING DEVICE NUMBER - CP CIODEV_TERM ; COMPARE TO FIRST VIDEO DEVICE - POP BC ; RESTORE LOOP CONTROL + ;PUSH BC ; SAVE LOOP CONTROL + ;PUSH HL ; SAVE TARGET + ;LD B,BF_CIODEVICE ; HBIOS FUNC: GET DEVICE INFO + ;RST 08 ; D := DEVICE TYPE, E := PHYSICAL UNIT NUMBER + ;POP HL ; RESTORE TARGET + ;LD A,D ; DEVICE TYPE TO A + ;; FIX: BELOW SHOULD TEST THE "TERMINAL" BIT INSTEAD OF CHECKING DEVICE NUMBER + ;CP CIODEV_TERM ; COMPARE TO FIRST VIDEO DEVICE + ;POP BC ; RESTORE LOOP CONTROL + ;LD A,C ; UNIT INDEX TO ACCUM + ;;CALL C,JPHL ; DO IT IF DEVICE TYPE < VDU + + LD A,(HCB + HCB_CONDEV) ; CURRENT CONSOLE UNIT + CP C ; IS CURRENT CONSOLE? LD A,C ; UNIT INDEX TO ACCUM - ;CALL C,JPHL ; DO IT IF DEVICE TYPE < VDU - CALL JPHL ; DO FOR ANY CHARACTER DEVICE TYPE + CALL NZ,JPHL ; DO IF NOT CURRENT CONSOLE INC C ; NEXT UNIT DJNZ DEV_INIT0 ; LOOP TILL DONE RET ; ALL DONE @@ -2130,11 +2529,20 @@ MD_INIT: ; UDPATE THE RAM/ROM DPB STRUCTURES BASED ON HARDWARE ; #IFDEF PLTWBW + ; TODO: HANDLE DISABLED RAM/ROM DISK BETTER. + ; IF RAM OR ROM DISK ARE DISABLED, BELOW WILL STILL + ; TRY TO ADJUST THE DPB BASED ON RAM BANK CALCULATIONS. + ; IT SHOULD NOT MATTER BECAUSE THE DPB SHOULD NEVER BE + ; USED. IT WOULD BE BETTER TO GET RAMD0/ROMD0 AND + ; RAMDN/ROMDN FROM THE HCB AND USE THOSE TO CALC THE + ; DPB ADJUSTMENT. IF DN-D0=0, BYPASS ADJUSTMENT. LD A,(HCB + HCB_ROMBANKS) ; ROM BANK COUNT + SUB 4 ; REDUCE BANK COUNT BY RESERVED PAGES LD IX,DPB_ROM ; ADDRESS OF DPB CALL MD_INIT1 ; FIX IT UP ; LD A,(HCB + HCB_RAMBANKS) ; RAM BANK COUNT + SUB 8 ; REDUCE BANK COUNT BY RESERVED PAGES LD IX,DPB_RAM ; ADDRESS OF DPB CALL MD_INIT1 ; FIX IT UP ; @@ -2143,7 +2551,6 @@ MD_INIT: MD_INIT1: ; ; PUT USABLE BANK COUNT IN HL - SUB 4 ; REDUCE BANK COUNT BY RESERVED PAGES LD L,A ; PUT IN LSB OF HL LD H,0 ; MSB IS ALWAYS ZERO ; @@ -2186,8 +2593,19 @@ MD_INIT4: LD BC,$01FB ; UNA FUNC = SET BANK LD DE,(BNKRAMD) ; FIRST BANK OF RAM DISK CALL $FFFD ; DO IT (RST 08 NOT SAFE HERE) - +; #IF (CLRRAMDISK == CLR_AUTO) + ; CHECK THE FIRST SECTOR (512 BYTES) FOR ALL ZEROES. IF SO, + ; IT IMPLIES THE RAM IS UNINITIALIZED. + LD HL,0 ; START AT BEGINING OF RAM DISK + LD BC,512 ; COMPARE 512 BYTES + XOR A ; COMPARE TO ZERO +CLRRAM000: + CPI ; A - (HL), HL++, BC-- + JR NZ,CLRRAM00 ; IF NOT ZERO, GO TO NEXT TEST + JP PE,CLRRAM000 ; LOOP THRU ALL BYTES + JR CLRRAM2 ; ALL ZEROES, JUMP TO INIT +CLRRAM00: ; 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). @@ -2211,15 +2629,15 @@ CLRRAM2: LD BC,$01FB ; UNA FUNC = SET BANK LD DE,(BNKUSER) ; SWITCH BACK TO EXEC BANK FOR WRITESTR CALL $FFFD ; DO IT (RST 08 NOT SAFE HERE) - +; CALL NEWLINE2 ; FORMATTING LD DE,STR_INITRAMDISK ; RAM DISK INIT MESSAGE CALL WRITESTR ; DISPLAY IT - +; LD BC,$01FB ; UNA FUNC = SET BANK LD DE,(BNKRAMD) ; 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 @@ -2229,20 +2647,33 @@ CLRRAM3: LD DE,(BNKUSER) ; SWITCH BACK TO EXEC BANK CALL $FFFD ; DO IT (RST 08 NOT SAFE HERE) EI ; RESUME INTERRUPTS - +; #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) - DI ; NO INTERRUPTS LD A,(BNKRAMD) ; FIRST BANK OF RAM DISK + CP $FF ; $FF SIGNIFIES NO RAM DISK + RET Z ; BAIL OUT IF NO RAM DISK + DI ; NO INTERRUPTS CALL HB_BNKSEL ; SELECT BANK #IF (CLRRAMDISK == CLR_AUTO) + ; CHECK THE FIRST SECTOR (512 BYTES) FOR ALL ZEROES. IF SO, + ; IT IMPLIES THE RAM IS UNINITIALIZED. + LD HL,0 ; START AT BEGINING OF RAM DISK + LD BC,512 ; COMPARE 512 BYTES + XOR A ; COMPARE TO ZERO +CLRRAM000: + CPI ; A - (HL), HL++, BC-- + JR NZ,CLRRAM00 ; IF NOT ZERO, GO TO NEXT TEST + JP PE,CLRRAM000 ; LOOP THRU ALL BYTES + JR CLRRAM2 ; ALL ZEROES, JUMP TO INIT +CLRRAM00: ; 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). @@ -2296,8 +2727,16 @@ DRV_INIT: ; GET BOOT UNIT/SLICE INFO LD BC,$00FC ; UNA FUNC: GET BOOTSTRAP HISTORY RST 08 ; CALL UNA - LD D,L ; SAVE L AS UNIT - LD E,0 ; SLICE IS ZERO + LD A,L ; PUT IN ACCUM + AND $0F ; UNIT IN LOW NIBBLE + LD D,A ; UNIT NUM TO D + LD A,L ; GET ORIGINAL VALUE BACK + RLCA ; MOVE SLICE TO LOW NIBBLE + RLCA ; ... + RLCA ; ... + RLCA ; ... + AND $0F ; SLICE NOW IN LOW NIBBLE + LD E,A ; SLICE TO E LD (BOOTVOL),DE ; D -> UNIT, E -> SLICE ; ; INIT DEFAULT @@ -2438,14 +2877,6 @@ DRV_INIT: ; GET BOOT UNIT/SLICE INFO LD DE,(HCB + HCB_BOOTVOL) ; BOOT VOLUME (UNIT, SLICE) LD (BOOTVOL),DE ; D -> UNIT, E -> SLICE -; - ; INIT DEFAULT - LD A,D ; BOOT UNIT? - CP 1 ; IF ROM BOOT, DEF DRIVE SHOULD BE B: - JR Z,DRV_INIT1 ; ... SO LEAVE AS IS AND SKIP AHEAD - XOR A ; ELSE FORCE TO DRIVE A: -DRV_INIT1: - LD (DEFDRIVE),A ; STORE IT ; ; SETUP THE DRVMAP STRUCTURE LD HL,(HEAPTOP) ; GET CURRENT HEAP TOP @@ -2502,7 +2933,7 @@ DRV_INIT3A: PUSH DE ; SAVE DE (HARD DISK VOLUME COUNTER) PUSH HL ; SAVE DRIVE LIST PTR PUSH BC ; SAVE LOOP CONTROL - + LD B,BF_DIOMEDIA ; HBIOS FUNC: SENSE MEDIA LD E,1 ; PERFORM MEDIA DISCOVERY RST 08 @@ -2510,9 +2941,9 @@ DRV_INIT3A: POP BC ; RESTORE LOOP CONTROL POP HL ; RESTORE DRIVE LIST PTR POP DE ; RESTORE DE - + RET NZ ; IF NO MEDIA, JUST RETURN - + ; IF ACTIVE... LD (HL),C ; SAVE UNIT NUM IN LIST INC HL ; BUMP PTR @@ -2534,11 +2965,8 @@ DRV_INIT5: LD A,E ; SLICES PER VOLUME VALUE TO ACCUM LD (HDSPV),A ; SAVE IT LD DE,(BOOTVOL) ; BOOT VOLUME (UNIT, SLICE) - LD A,1 ; ROM DISK UNIT? - CP D ; CHECK IT - JR Z,DRV_INIT5A ; IF SO, SKIP BOOT DRIVE LD B,1 ; JUST ONE SLICE PLEASE - CALL DRV_INIT8A ; DO THE BOOT DEVICE + CALL DRV_INIT8A ; DO THE BOOT UNIT & SLICE FIRST ; DRV_INIT5A: LD A,(DRVLSTC) ; ACTIVE DRIVE LIST COUNT TO ACCUM @@ -2574,9 +3002,10 @@ DRV_INIT7: ; PROCESS UNIT DRV_INIT8: ; SLICE CREATION LOOP ; DE=UNIT/SLICE, B=SLICE CNT +; + ; FIRST, CHECK TO SEE IF THIS IS THE BOOT VOL & SLICE. + ; IF SO, IT HAS ALREADY BEEN PROCESSED ABOVE, SO SKIP IT HERE. LD A,(BOOTVOL + 1) ; GET BOOT UNIT - CP 1 ; ROM BOOT? - JR Z,DRV_INIT8A ; IF SO, OK TO CONTINUE CP D ; COMPARE TO CUR UNIT JR NZ,DRV_INIT8A ; IF NE, OK TO CONTINUE LD A,(BOOTVOL) ; GET BOOT SLICE @@ -2630,7 +3059,8 @@ DPH_INIT: LD H,0 ; ... INTO HL ADD HL,HL ; MULTIPLY ADD HL,HL ; ... BY SIZE - ADD HL,HL ; ... OF DPH (16) + CALL ADDHLA ; ... + ADD HL,HL ; ... OF DPH (20) ADD HL,HL ; ... FOR TOTAL SIZE CALL ALLOC ; ALLOCATE THE SPACE CALL C,PANIC ; SHOULD NEVER ERROR @@ -2669,7 +3099,7 @@ DPH_INIT1: CALL PRTDRV ; PRINT DRIVE INFO LD A,D ; A := UNIT PUSH HL ; SAVE DRIVE MAP POINTER -DPH_INIT1A: +DPH_INIT1A: LD DE,(DPHTOP) ; GET ADDRESS OF NEXT DPH PUSH DE ; ... AND SAVE IT ; INVOKE THE DPH BUILD ROUTINE @@ -2687,7 +3117,8 @@ DPH_INIT2: 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 + ;LD A,16 ; SIZE OF A DPH ENTRY + LD A,20 ; SIZE OF A DPH ENTRY EX DE,HL ; HL := DPH POINTER CALL ADDHLA ; CALC NEW DPHTOP LD (DPHTOP),HL ; SAVE IT @@ -2752,12 +3183,12 @@ MAKDPH0: ; RAM/ROM DISK DPB DERIVATION ; TYPE OF MEMORY DISK (RAM/ROM) DETERMINED BY PHYSICAL UNIT NUMBER LD A,E ; LOAD PHYSICAL UNIT NUMBER - LD DE,DPB_ROM ; PRELOAD ROM DISK DPB - OR A ; UNIT=0 (ROM)? - JR Z,MAKDPH1 ; IF UNIT=0, IT IS ROM, PROCEED TO DPH CREATION LD DE,DPB_RAM ; PRELOAD RAM DISK DPB - CP $01 ; UNIT=1 (RAM)? - JR Z,MAKDPH1 ; IF UNIT=0, IT IS ROM, PROCEED TO DPH CREATION + OR A ; UNIT=0 (RAM)? + JR Z,MAKDPH1 ; IF SO, CREATE RAM DISK DPH + LD DE,DPB_ROM ; PRELOAD ROM DISK DPB + CP $01 ; UNIT=1 (ROM)? + JR Z,MAKDPH1 ; IF SO, CREATE ROM DISK DPH CALL PANIC ; OTHERWISE UNKNOWN, NOT POSSIBLE, JUST PANIC ; #ENDIF @@ -2768,7 +3199,7 @@ MAKDPH1: 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 @@ -2805,7 +3236,7 @@ MAKDPH2: LD (HL),C ; SAVE CKS/ALS BUF INC HL ; ... ADDRESS IN LD (HL),B ; ... DPH AND BUMP - INC HL ; ... TO NEXT DPH ENTRY + INC HL ; ... TO NEXT DPH ENTRY XOR A ; SIGNAL SUCCESS RET ; @@ -2823,9 +3254,9 @@ ALLOC: EX DE,HL ; DE=NEW HEAPTOP, HL=HEAPLIM SBC HL,DE ; HEAPLIM - HEAPTOP JR C,ALLOCX ; C SET ON OVERFLOW ERROR - ; ALLOCATION SUCCEEDED, COMMIT NEW HEAPTOP + ; ALLOCATION SUCCEEDED, COMMIT NEW HEAPTOP LD (HEAPTOP),DE ; SAVE NEW HEAPTOP -ALLOCX: +ALLOCX: POP HL ; RETURN VALUE TO HL POP DE ; RECOVER DE RET @@ -2854,15 +3285,15 @@ PRTDRV: 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,PRTDRV1 ; IF SO, HANDLE RAM/ROM - + LD DE,DEVIDE ; IDE STRING CP $41 ; IDE? JR Z,PRTDRVX ; IF YES, PRINT @@ -3003,10 +3434,11 @@ FCB_PRO .DB '?' ; DRIVE CODE, 0 = CURRENT DRIVE STR_BANNER .DB "CBIOS v", BIOSVER, " [", PLTSTR, "]$" STR_INITRAMDISK .DB "Formatting RAMDISK...$" STR_LDR2 .DB "\r\n" -STR_LDR .DB "\r\n $" +STR_LDR .DB "\r\n $" STR_DPHINIT .DB "Configuring Drives...$" -STR_HEAPOVF .DB " *** Insufficient Memory ***$" +STR_HEAPOVF .DB " *** Insufficient HBIOS Heap Memory ***$" STR_INVMED .DB " *** Invalid Device ID ***$" +STR_VERMIS .DB 7,"*** WARNING: HBIOS/CBIOS Version Mismatch ***$" STR_MEMFREE .DB " Disk Buffer Bytes Free$" STR_CPM .DB "CP/M-80 v2.2$" STR_ZSDOS .DB "ZSDOS v1.1$" diff --git a/Source/CBIOS/config.asm b/Source/CBIOS/config.asm index 1ad85aee..31eae617 100644 --- a/Source/CBIOS/config.asm +++ b/Source/CBIOS/config.asm @@ -2,13 +2,16 @@ ; CBIOS BUILD CONFIGURATION OPTIONS ; CLRRAMDISK .EQU CLR_AUTO ; CLR_ALWAYS, CLR_NEVER, CLR_AUTO (CLEAR IF INVALID DIR AREA) +AUTOSUBMIT .EQU TRUE ; PROCESS PROFILE.SUB AT STARTUP +QPMTIMDAT .EQU TRUE ; SUPPORT QP/M TIMDAT ROUTINE WRTCACHE .EQU TRUE ; ENABLE WRITE CACHING IN CBIOS (DE)BLOCKING ALGORITHM DSKTRACE .EQU FALSE ; ENABLE TRACING OF CBIOS DISK FUNCTION CALLS +DEBUG .EQU FALSE ; MISCELLANEOUS DEBUG TRACING ; CPM_LOC .EQU $D000 ; LOCATION OF START OF CCP ; #IFDEF PLTWBW -CPM_END .EQU $FE00 ; ROMWBW HBIOS PROXY OCCUPIES TOP 2 PAGES OF MEMORY +CPM_END .EQU $FE00 ; ROMWBW HBIOS PROXY OCCUPIES TOP $280 BYTES OF MEMORY #ENDIF ; #IFDEF PLTUNA diff --git a/Source/CBIOS/util.asm b/Source/CBIOS/util.asm index 023688ed..4ff1ea5d 100644 --- a/Source/CBIOS/util.asm +++ b/Source/CBIOS/util.asm @@ -105,14 +105,61 @@ WRITESTR2: POP AF RET ; +#IF DEBUG +; +; PRINT A STRING AT ADDRESS SPECIFIED IN HL +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; LD HL,MYSTR +; CALL PRTSTR +; ... +; MYSTR: .DB "HELLO$" +; +PRTSTR: + LD A,(HL) + INC HL + CP '$' + RET Z + CALL COUT + JR PRTSTR ; +; PRINT A STRING DIRECT: REFERENCED BY POINTER AT TOP OF STACK +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; CALL PRTSTRD +; .DB "HELLO$" +; ... ; -TSTPT: - PUSH DE - LD DE,STR_TSTPT - CALL WRITESTR - POP DE - JR REGDMP ; DUMP REGISTERS AND RETURN +PRTSTRD: + EX (SP),HL + PUSH AF + CALL PRTSTR + POP AF + EX (SP),HL + RET +; +; PRINT A STRING INDIRECT: REFERENCED BY INDIRECT POINTER AT TOP OF STACK +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; CALL PRTSTRI(MYSTRING) +; MYSTRING .DB "HELLO$" +; +PRTSTRI: + EX (SP),HL + PUSH AF + LD A,(HL) + INC HL + PUSH HL + LD H,(HL) + LD L,A + CALL PRTSTR + POP HL + INC HL + POP AF + EX (SP),HL + RET +; +#ENDIF ; ; PANIC: TRY TO DUMP MACHINE STATE ; @@ -413,7 +460,52 @@ HEXCONV: DAA ADC A,40H DAA - RET + RET +; +;**************************** +; A(BCD) => A(BIN) +; [00H..99H] -> [0..99] +;**************************** +; +BCD2BYTE: + PUSH BC + LD C,A + AND 0F0H + SRL A + LD B,A + SRL A + SRL A + ADD A,B + LD B,A + LD A,C + AND 0FH + ADD A,B + POP BC + RET +; +;***************************** +; A(BIN) => A(BCD) +; [0..99] => [00H..99H] +;***************************** +; +BYTE2BCD: + PUSH BC + LD B,10 + LD C,-1 +BYTE2BCD1: + INC C + SUB B + JR NC,BYTE2BCD1 + ADD A,B + LD B,A + LD A,C + ADD A,A + ADD A,A + ADD A,A + ADD A,A + OR B + POP BC + RET ; ; PRINT A BYTE BUFFER IN HEX POINTED TO BY DE ; REGISTER A HAS SIZE OF BUFFER @@ -430,3 +522,15 @@ PRTHEXBUF1: INC DE DJNZ PRTHEXBUF1 RET +; +; LEFT SHIFT DE:HL BY B BITS (B > 0) +; +RL32: + OR A ; CLEAR CARRY + RL L + RL H + RL E + RL D + DJNZ RL32 + RET + diff --git a/Source/CPM22/Build.cmd b/Source/CPM22/Build.cmd index 5c1effaa..7eabae15 100644 --- a/Source/CPM22/Build.cmd +++ b/Source/CPM22/Build.cmd @@ -3,47 +3,45 @@ setlocal set TOOLS=../../Tools -set PATH=%TOOLS%\tasm32;%TOOLS%\zx;%PATH% +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%PATH% set TASMTABS=%TOOLS%\tasm32 -set ZXBINDIR=%TOOLS%/cpm/bin/ -set ZXLIBDIR=%TOOLS%/cpm/lib/ -set ZXINCDIR=%TOOLS%/cpm/include/ +set CPMDIR80=%TOOLS%/cpm/ call :asm ccpb03 || goto :eof call :asm bdosb01 || goto :eof -zx MAC -CCP.ASM -$PO -zx MLOAD25 -CCP.BIN=CCP.HEX +zxcc MAC -CCP.ASM -$PO || exit /b +zxcc MLOAD25 -CCP.BIN=CCP.HEX || exit /b -zx MAC -BDOS.ASM -$PO -zx MLOAD25 -BDOS.BIN=BDOS.HEX +zxcc MAC -BDOS.ASM -$PO || exit /b +zxcc MLOAD25 -BDOS.BIN=BDOS.HEX || exit /b -zx MAC -CCP22.ASM -$PO -zx MLOAD25 -CCP22.BIN=CCP22.HEX +zxcc MAC -CCP22.ASM -$PO || exit /b +zxcc MLOAD25 -CCP22.BIN=CCP22.HEX || exit /b -zx MAC -BDOS22.ASM -$PO -zx MLOAD25 -BDOS22.BIN=BDOS22.HEX +zxcc MAC -BDOS22.ASM -$PO || exit /b +zxcc MLOAD25 -BDOS22.BIN=BDOS22.HEX || exit /b -zx MAC -OS2CCP.ASM -$PO -zx MLOAD25 -OS2CCP.BIN=OS2CCP.HEX +zxcc MAC -OS2CCP.ASM -$PO || exit /b +zxcc MLOAD25 -OS2CCP.BIN=OS2CCP.HEX || exit /b -zx MAC -OS3BDOS.ASM -$PO -zx MLOAD25 -OS3BDOS.BIN=OS3BDOS.HEX +zxcc MAC -OS3BDOS.ASM -$PO || exit /b +zxcc MLOAD25 -OS3BDOS.BIN=OS3BDOS.HEX || exit /b -tasm -t80 -g3 -fFF loader.asm loader.bin loader.lst +tasm -t80 -g3 -fFF loader.asm loader.bin loader.lst || exit /b -copy /b os2ccp.bin + os3bdos.bin + ..\cbios\cbios_wbw.bin cpm_wbw.bin -copy /b os2ccp.bin + os3bdos.bin + ..\cbios\cbios_una.bin cpm_una.bin +copy /b os2ccp.bin + os3bdos.bin + ..\cbios\cbios_wbw.bin cpm_wbw.bin || exit /b +copy /b os2ccp.bin + os3bdos.bin + ..\cbios\cbios_una.bin cpm_una.bin || exit /b -copy /b loader.bin + cpm_wbw.bin cpm_wbw.sys -copy /b loader.bin + cpm_una.bin cpm_una.sys +copy /b loader.bin + cpm_wbw.bin cpm_wbw.sys || exit /b +copy /b loader.bin + cpm_una.bin cpm_una.sys || exit /b goto :eof :asm echo. echo Building %1... -tasm -t80 -b -g3 -fFF %1.asm %1.bin %1.lst +tasm -t80 -b -g3 -fFF %1.asm %1.bin %1.lst || exit /b goto :eof diff --git a/Source/CPM22/License.pdf b/Source/CPM22/License.pdf new file mode 100644 index 00000000..94912501 Binary files /dev/null and b/Source/CPM22/License.pdf differ diff --git a/Source/CPM22/loader.asm b/Source/CPM22/loader.asm index bdebc314..6703e9aa 100644 --- a/Source/CPM22/loader.asm +++ b/Source/CPM22/loader.asm @@ -167,11 +167,56 @@ STR_ERR .DB " Read Error!",0 ; .FILL PT_LOC - $,0 ; FILL TO START OF PARTITION TABLE ; -; RESERVE SPACE FOR STANDARD IBM-PC PARTITION TABLE. ALTHOUGH A +; STANDARD IBM-PC PARTITION TABLE. ALTHOUGH A ; PARTITION TABLE IS NOT RELEVANT FOR A FLOPPY DISK, IT DOES NO HARM. -; THE CONTENTS OF THE PARTITION TABLE MUST BE MANAGED BY FDISK80. -; -PARTTBL .FILL PT_SIZ,0 ; PARTITION TABLE, FILL WITH ZEROES +; THE CONTENTS OF THE PARTITION TABLE CAN BE MANAGED BY FDISK80. +; +; BELOW WE ALLOW FOR 32 SLICES OF ROMWBW CP/M FILESYSTEMS +; FOLLOWED BY A FAT16 PARTITION. THE SLICES FOLLOW THE ORIGINAL +; HD512 ROMWBW FORMAT. IF THE DISK IS USING HD1K, A SEPARATE +; PARTITION TABLE WILL BE IN PLACE AND RENDER THIS PARTITION TABLE +; IRRELEVANT. +; +; THE CYL/SEC FIELDS ENCODE CYLINDER AND SECTOR AS: +; CCCCCCCC:CCSSSSSS +; 76543210:98543210 +; +PART0: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) +PART1: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW %1111111111000001 ; CHS START ADDRESS (CYL/SEC) + .DB 6 ; PART TYPE ID + .DB 15 ; CHS LAST ADDRESS (HEAD) + .DW %1111111111010000 ; CHS LAST ADDRESS (CYL/SEC) + .DW $4000,$0010 ; LBA FIRST (DWORD) + .DW $0000,$000C ; LBA COUNT (DWORD) +PART2: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) +PART3: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) ; ; THE END OF THE FIRST SECTOR MUST CONTAIN THE TWO BYTE BOOT SIGNATURE. ; diff --git a/Source/CPM3/Build.cmd b/Source/CPM3/Build.cmd index 1d0e1a9c..7b0f1afe 100644 --- a/Source/CPM3/Build.cmd +++ b/Source/CPM3/Build.cmd @@ -3,101 +3,122 @@ setlocal set TOOLS=../../Tools -set PATH=%TOOLS%\tasm32;%TOOLS%\zx;%TOOLS%\cpmtools;%PATH% +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%TOOLS%\cpmtools;%PATH% set TASMTABS=%TOOLS%\tasm32 -set ZXBINDIR=%TOOLS%/cpm/bin/ -set ZXLIBDIR=%TOOLS%/cpm/lib/ -rem set ZXINCDIR=%TOOLS%/cpm/include/ -set ZXINCDIR=../ +set CPMDIR80=%TOOLS%/cpm/ +set INCDIR80=../ echo. echo. echo *** CPM Loader *** echo. -zx RMAC -CPMLDR -copy optdsk.lib ldropts.lib -zx Z80ASM -BIOSLDR/MF -move /Y biosldr.rel biosldrd.rel -zx LINK -CPMLDRD[L100]=CPMLDR,BIOSLDRD -move /Y cpmldrd.com cpmldr.bin -copy optcmd.lib ldropts.lib -zx Z80ASM -BIOSLDR/MF -move /Y biosldr.rel biosldrc.rel -zx LINK -CPMLDRC[L100]=CPMLDR,BIOSLDRC -move /Y cpmldrc.com cpmldr.com +zxcc RMAC -CPMLDR || exit /b +zxcc Z80ASM -UTIL/MF || exit /b +copy optdsk.lib ldropts.lib || exit /b +zxcc Z80ASM -BIOSLDR/MF || exit /b +move /Y biosldr.rel biosldrd.rel || exit /b +move /Y biosldr.lst biosldrd.lst || exit /b +zxcc LINK -CPMLDRD[L100]=CPMLDR,BIOSLDRD,UTIL || exit /b +move /Y cpmldrd.com cpmldr.bin || exit /b +copy optcmd.lib ldropts.lib || exit /b +zxcc Z80ASM -BIOSLDR/MF || exit /b +move /Y biosldr.rel biosldrc.rel || exit /b +move /Y biosldr.lst biosldrd.lst || exit /b +zxcc LINK -CPMLDRC[L100]=CPMLDR,BIOSLDRC,UTIL || exit /b +move /Y cpmldrc.com cpmldr.com || exit /b rem pause echo. echo. echo *** Resident CPM3 BIOS *** echo. -copy optres.lib options.lib -copy genres.dat gencpm.dat -zx RMAC -BIOSKRNL -zx RMAC -SCB -zx Z80ASM -BOOT/MF -zx Z80ASM -CHARIO/MF -zx Z80ASM -MOVE/MF -zx Z80ASM -DRVTBL/MF -zx Z80ASM -DISKIO/MF -zx Z80ASM -UTIL/MF -zx LINK -BIOS3[OS]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL -zx GENCPM -AUTO -DISPLAY -copy cpm3.sys cpm3res.sys +copy optres.lib options.lib || exit /b +copy genres.dat gencpm.dat || exit /b +zxcc RMAC -BIOSKRNL || exit /b +zxcc RMAC -SCB || exit /b +zxcc Z80ASM -BOOT/MF || exit /b +zxcc Z80ASM -CHARIO/MF || exit /b +zxcc Z80ASM -MOVE/MF || exit /b +zxcc Z80ASM -DRVTBL/MF || exit /b +zxcc Z80ASM -DISKIO/MF || exit /b +zxcc Z80ASM -UTIL/MF || exit /b +zxcc LINK -BIOS3[OS]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL || exit /b +zxcc GENCPM -AUTO -DISPLAY || exit /b +copy cpm3.sys cpm3res.sys || exit /b rem pause echo. echo. echo *** Banked CPM3 BIOS *** echo. -copy optbnk.lib options.lib -copy genbnk.dat gencpm.dat -zx RMAC -BIOSKRNL -zx RMAC -SCB -zx Z80ASM -BOOT/MF -zx Z80ASM -CHARIO/MF -zx Z80ASM -MOVE/MF -zx Z80ASM -DRVTBL/MF -zx Z80ASM -DISKIO/MF -zx Z80ASM -UTIL/MF -zx LINK -BNKBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL -zx GENCPM -AUTO -DISPLAY -copy cpm3.sys cpm3bnk.sys +copy optbnk.lib options.lib || exit /b +copy genbnk.dat gencpm.dat || exit /b +zxcc RMAC -BIOSKRNL || exit /b +zxcc RMAC -SCB || exit /b +zxcc Z80ASM -BOOT/MF || exit /b +zxcc Z80ASM -CHARIO/MF || exit /b +zxcc Z80ASM -MOVE/MF || exit /b +zxcc Z80ASM -DRVTBL/MF || exit /b +zxcc Z80ASM -DISKIO/MF || exit /b +zxcc Z80ASM -UTIL/MF || exit /b +zxcc LINK -BNKBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL || exit /b +zxcc GENCPM -AUTO -DISPLAY || exit /b +copy cpm3.sys cpm3bnk.sys || exit /b rem pause echo. echo. echo *** Banked ZPM3 BIOS *** echo. -copy optzpm.lib options.lib -copy genbnk.dat gencpm.dat -zx RMAC -BIOSKRNL -zx RMAC -SCB -zx Z80ASM -BOOT/MF -zx Z80ASM -CHARIO/MF -zx Z80ASM -MOVE/MF -zx Z80ASM -DRVTBL/MF -zx Z80ASM -DISKIO/MF -zx Z80ASM -UTIL/MF -zx LINK -ZPMBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL -rem zx GENCPM -AUTO -DISPLAY -rem copy cpm3.sys zpm3.sys +copy optzpm.lib options.lib || exit /b +copy genbnk.dat gencpm.dat || exit /b +zxcc RMAC -BIOSKRNL || exit /b +zxcc RMAC -SCB || exit /b +zxcc Z80ASM -BOOT/MF || exit /b +zxcc Z80ASM -CHARIO/MF || exit /b +zxcc Z80ASM -MOVE/MF || exit /b +zxcc Z80ASM -DRVTBL/MF || exit /b +zxcc Z80ASM -DISKIO/MF || exit /b +zxcc Z80ASM -UTIL/MF || exit /b +zxcc LINK -ZPMBIOS3[B]=BIOSKRNL,SCB,BOOT,CHARIO,MOVE,DRVTBL,DISKIO,UTIL || exit /b +rem zxcc GENCPM -AUTO -DISPLAY || exit /b +rem copy cpm3.sys zpm3.sys || exit /b rem pause rem *** Resident *** -rem copy cpm3res.sys cpm3.sys -rem copy genres.dat getcpm.dat +rem copy cpm3res.sys cpm3.sys || exit /b +rem copy genres.dat getcpm.dat || exit /b rem *** Banked *** -copy cpm3bnk.sys cpm3.sys -copy genbnk.dat gencpm.dat +copy cpm3bnk.sys cpm3.sys || exit /b +copy genbnk.dat gencpm.dat || exit /b rem Loader -tasm -t80 -g3 -fFF loader.asm loader.bin loader.lst +tasm -t80 -g3 -fFF loader.asm loader.bin loader.lst || exit /b -copy /b loader.bin + cpmldr.bin cpmldr.sys +copy /b loader.bin + cpmldr.bin cpmldr.sys || exit /b + +rem Copy OS files to Binary directory + +copy cpmldr.com ..\..\Binary\CPM3 || exit /b +copy cpmldr.sys ..\..\Binary\CPM3 || exit /b +copy ccp.com ..\..\Binary\CPM3 || exit /b +copy gencpm.com ..\..\Binary\CPM3 || exit /b +copy genres.dat ..\..\Binary\CPM3 || exit /b +copy genbnk.dat ..\..\Binary\CPM3 || exit /b +copy bios3.spr ..\..\Binary\CPM3 || exit /b +copy bnkbios3.spr ..\..\Binary\CPM3 || exit /b +copy bdos3.spr ..\..\Binary\CPM3 || exit /b +copy bnkbdos3.spr ..\..\Binary\CPM3 || exit /b +copy resbdos3.spr ..\..\Binary\CPM3 || exit /b +copy cpm3res.sys ..\..\Binary\CPM3 || exit /b +copy cpm3bnk.sys ..\..\Binary\CPM3 || exit /b +copy gencpm.dat ..\..\Binary\CPM3 || exit /b +copy cpm3.sys ..\..\Binary\CPM3 || exit /b +copy readme.1st ..\..\Binary\CPM3 || exit /b +copy cpm3fix.pat ..\..\Binary\CPM3 || exit /b \ No newline at end of file diff --git a/Source/CPM3/License.pdf b/Source/CPM3/License.pdf new file mode 100644 index 00000000..94912501 Binary files /dev/null and b/Source/CPM3/License.pdf differ diff --git a/Source/CPM3/Makefile b/Source/CPM3/Makefile index 4eb2a352..684aac83 100644 --- a/Source/CPM3/Makefile +++ b/Source/CPM3/Makefile @@ -4,14 +4,23 @@ # # it does this by overriding OBJECTS in an invoked sub-make # -OBJECTS = cpmldr.com cpmldr.sys cpm3res cpm3bnk zpmbios3 cpm3.sys gencpm.dat -OTHERS = cpmldr.rel biosldr.rel cpm3res.sys cpm3bnk.sys zpmbios3.spr loader.bin cpmldr.bin +OBJECTS = cpmldr.com cpmldr.sys cpm3res.sys cpm3bnk.sys zpmbios3 +OBJECTS += ccp.com gencpm.com genres.dat genbnk.dat +OBJECTS += bdos3.spr bnkbdos3.spr resbdos3.spr +OBJECTS += readme.1st cpm3fix.pat cpm3.sys gencpm.dat +NOCOPY = zpmbios3 +OTHERS = cpmldr.rel biosldr.rel cpm3res.sys cpm3bnk.sys loader.bin cpmldr.bin OTHERS += biosldrc.rel biosldrd.rel +NODELETE = ccp.com gencpm.com genres.dat genbnk.dat bdos3.spr bnkbdos3.spr resbdos3.spr +NODELETE += readme.1st cpm3fix.pat +NODIFF = zpmbios3 +DEST = ../../Binary/CPM3 TOOLS = ../../Tools + include $(TOOLS)/Makefile.inc -export ZXINCDIR = ../ +export INCDIR80 = ../ BIOSOBJS = bioskrnl.rel scb.rel boot.rel chario.rel BIOSOBJS += move.rel drvtbl.rel diskio.rel util.rel @@ -25,11 +34,11 @@ DEFCPM3 = bnk clean:: biosclean @rm -f bios3.spr bnkbios3.spr zpmbios3.spr cpmldr.com gencpm.dat options.lib ldropts.lib - + biosclean: @rm -f $(BIOSOBJS) -cpm3res: +cpm3res.sys: make biosclean cp optres.lib options.lib cp genres.dat gencpm.dat @@ -38,7 +47,7 @@ cpm3res: mv cpm3.sys cpm3res.sys rm gencpm.dat -cpm3bnk: +cpm3bnk.sys: make biosclean cp optbnk.lib options.lib cp genbnk.dat gencpm.dat @@ -50,36 +59,34 @@ cpm3bnk: zpmbios3: make biosclean cp optzpm.lib options.lib - cp genbnk.dat gencpm.dat - make OBJECTS=zpmbios3.spr - rm gencpm.dat + make OBJECTS=zpmbios3.spr DEST= -cpmldr.bin: biosldrd.rel cpmldr.rel - $(ZXCC) $(TOOLS)/cpm/bin/LINK -CPMLDRD[L100]=CPMLDR,BIOSLDRD +cpmldr.bin: biosldrd.rel cpmldr.rel util.rel + $(ZXCC) LINK -CPMLDRD[L100]=CPMLDR,BIOSLDRD,UTIL mv cpmldrd.com cpmldr.bin -cpmldr.com: biosldrc.rel cpmldr.rel - $(ZXCC) $(TOOLS)/cpm/bin/LINK -CPMLDRC[L100]=CPMLDR,BIOSLDRC +cpmldr.com: biosldrc.rel cpmldr.rel util.rel + $(ZXCC) LINK -CPMLDRC[L100]=CPMLDR,BIOSLDRC,UTIL mv cpmldrc.com cpmldr.com biosldrc.rel: biosldr.z80 optcmd.lib cp optcmd.lib ldropts.lib - $(ZXCC) $(TOOLS)/cpm/bin/Z80ASM -BIOSLDR/MF + $(ZXCC) Z80ASM -BIOSLDR/MF mv biosldr.rel biosldrc.rel biosldrd.rel: biosldr.z80 optdsk.lib cp optdsk.lib ldropts.lib - $(ZXCC) $(TOOLS)/cpm/bin/Z80ASM -BIOSLDR/MF + $(ZXCC) Z80ASM -BIOSLDR/MF mv biosldr.rel biosldrd.rel bios3.spr: $(BIOSOBJS) - $(ZXCC) $(CPM)/LINK -bios3[OS]=$(BIOSNAMES) + $(ZXCC) LINK -bios3[OS]=$(BIOSNAMES) bnkbios3.spr: $(BIOSOBJS) - $(ZXCC) $(CPM)/LINK -bnkbios3[B]=$(BIOSNAMES) + $(ZXCC) LINK -bnkbios3[B]=$(BIOSNAMES) zpmbios3.spr: $(BIOSOBJS) - $(ZXCC) $(TOOLS)/cpm/bin/LINK -zpmbios3[B]=$(BIOSNAMES) + $(ZXCC) LINK -zpmbios3[B]=$(BIOSNAMES) cpm3.sys: cpm3$(DEFCPM3).sys cp cpm3$(DEFCPM3).sys cpm3.sys @@ -89,3 +96,4 @@ gencpm.dat: gen$(DEFCPM3).dat cpmldr.sys: loader.bin cpmldr.bin cat loader.bin cpmldr.bin > $@ + diff --git a/Source/CPM3/bioskrnl.asm b/Source/CPM3/bioskrnl.asm index ab3a9ccd..85effacf 100644 --- a/Source/CPM3/bioskrnl.asm +++ b/Source/CPM3/bioskrnl.asm @@ -172,7 +172,10 @@ boot$1: ; Entry for system restarts. wboot: - lxi sp,boot$stack + pop h ; WBW: save PC for diagnosis + lxi sp,boot$stack ; reset stack + lxi b,0F003H ; WBW: HBIOS user reset func + rst 1 ; WBW: do it call set$jumps ; initialize page zero call ?rlccp ; reload CCP jmp ccp ; then reset jmp vectors and exit to ccp @@ -507,6 +510,11 @@ seldsk: mov a,m ! inx h ! mov h,m ! mov l,a ; get address of LOGIN routine call ipchl ; call LOGIN pop h ; recover DPH pointer + ; WBW Start + ora a + rz ; successful return + lxi h,0 ; error occurred, clear HL + ; WBW End not$first$select: ret diff --git a/Source/CPM3/biosldr.z80 b/Source/CPM3/biosldr.z80 index 9fc960d3..86083212 100644 --- a/Source/CPM3/biosldr.z80 +++ b/Source/CPM3/biosldr.z80 @@ -4,6 +4,12 @@ maclib cpm3.lib cseg + + extrn phex16, phex8 + extrn cin, cout + extrn crlf, crlf2 + + debug equ false ; BIOS Jump vector. @@ -51,109 +57,211 @@ jp 0 ; reserved for future expansion jp 0 ; reserved for future expansion -boot: - - if cmdline +mbrsec equ dtabuf +boot: + ; The main module (cpmldr.asm) does not expect the + ; boot call to use much stack. We use our own during + ; this routine to avoid issues. ld (stksav),sp ld sp,stack - -boot1: - ld de,msgunit - call writestr - call cin - push af - call cout - pop af - sub '0' - ld (unit),a - jr c,selerr - - ld bc,0F810h ; HBIOS, get disk unit count - call 0FFF0h ; do it, E := disk unit count - ld a,(unit) ; get unit num back - cp e ; compare to entry - jr nc,selerr ; loop if too high + ; Do the real work + call boot0 - ld de,msgslc - call writestr - call cin - push af - call cout - pop af - - sub '0' - ld (slice),a - jr c,selerr - cp 10 - jr nc,selerr + ; Restore original stack and return + ld sp,(stksav) + ret - jr boot2 +boot0: + + if cmdline + +boot1: + ; Get disk unit from user + ld de,msgunit ; disk unit prompt + call writestr ; display on console + call cin ; get a character + push af ; save it + call cout ; echo character + pop af ; restore it + sub '0' ; convert to binary + ld (unit),a ; save it + jr c,selerr ; loop if below 0 entered + ld bc,0F810h ; HBIOS, get disk unit count + call 0FFF0h ; do it, E := disk unit count + ld a,(unit) ; get unit num back + cp e ; compare to entry + jr nc,selerr ; loop if too high + + ; Get disk slice from user + ld de,msgslc ; slice prompt + call writestr ; display on console + call cin ; get a character + push af ; save it + call cout ; echo it + pop af ; restore it + sub '0' ; convert to binary + ld (slice),a ; save it + jr c,selerr ; loop if below 0 entered + cp 10 ; check for over 9 + jr nc,selerr ; loop if over 9 + ld de,msgcrlf ; linefeed + call writestr ; ... to console + jr boot2 ; boot w/ unit & slice selerr: - ld de,msginv - call writestr - jr boot1 + ; Display invalid entry message and restart + ld de,msginv ; error message + call writestr ; display on console + jr boot1 ; loop boot2: - ld de,crlf - call writestr - - ld sp,(stksav) + ; Record unit & slice w/ HBIOS + ld bc,0F9E0h ; HBIOS func: set boot info + ld a,(unit) ; get unit + ld d,a ; put in D + ld a,(slice) ; get slice + ld e,a ; put in E + ld l,0 ; Bank is always zero + call 0FFF0h ; do it - ld bc,0F9E0h ; HBIOS func: set boot info - ld a,(unit) ; get unit - ld d,a ; put in D - ld a,(slice) ; get slice - ld e,a ; put in E - ld l,0 ; Bank is always zero - call 0FFF0h ; do it - else - - ld bc,0F8E0h ; HBIOS func: get boot info - call 0FFF0h ; do it, D := boot unit, E: := slice - ld a,d ; move unit to A - ld (unit),a ; save it - ld a,e ; move slice to A - ld (slice),a ; save it + + ; Get unit & slice from HBIOS + ld bc,0F8E0h ; HBIOS func: get boot info + call 0FFF0h ; do it, D := boot unit, E: := slice + ld a,d ; move unit to A + ld (unit),a ; save it + ld a,e ; move slice to A + ld (slice),a ; save it endif - ld a,(unit) ; Get boot unit - ld c,a ; put in C - ld b,18h ; HBIOS Media function - ld e,1 ; Enable media check/discovery - call 0FFF0H ; HBIOS call - ld a,e ; Resultant media id to accum - or a ; Set flags - ;halt - ; - ; !!! Need to do something on error !!! - ; - ret z ; Bail out on error - + ; Check that drive actually exists + ld bc,0F810h ; HBIOS func: get disk count + call 0FFF0h ; do it, E=disk count + ld a,(unit) ; get boot disk unit + cp e ; compare to count + jp nc,err_nodisk ; handle no disk err + + ; Sense media to determine media format + ld a,(unit) ; Get boot unit + ld c,a ; put in C + ld b,18h ; HBIOS Media function + ld e,1 ; Enable media check/discovery + call 0FFF0H ; HBIOS call + jp nz,err_diskio ; handle error + ld a,e ; resultant media id to accum + ld (medid),a ; save media id + or a ; set flags, 0 is no media + jp z,err_diskio ; handle no media error + + ; Initialize slice start LBA & sectors per slice + ld hl,0 ; assume slice starts + ld (lba),hl ; ... at LBA offset + ld (lba+2),hl ; ... of zero + ld hl,16640 ; assume legacy value for + ld (sps),hl ; ... sectors per slice + + ; If not hard disk, skip partition & slice stuff + ld a,(medid) ; get media id + cp 4 ; hard disk? + jr nz,boot9 ; if not, jump ahead + + ; Read MBR + ld de,8000h ; LBA address zero + ld hl,0 ; ... to read first sector + ld bc,mbrsec ; read into MBR buffer + ld (dma),bc ; save + ld b,1 ; one sector + ld a,(unit) ; get bootunit + ld c,a ; put in C + call diskread ; do it, no return on err + + ; Check signature + ld hl,(mbrsec+1FEh) ; get signature + ld a,l ; first byte + cp 055h ; should be $55 + jr nz,boot5 ; if not, no part table + ld a,h ; second byte + cp 0AAh ; should be $AA + jr nz,boot5 ; if not, no part table + + ; Search part table for CP/M entry (type 0x2E) + ld b,4 ; four entries in part table + ld hl,mbrsec+1BEh+4 ; offset of first part type +boot3: + ld a,(hl) ; get part type + cp 2Eh ; CP/M partition? + jr z,boot4 ; cool, grab the LBA offset + ld de,16 ; part table entry size + add hl,de ; bump to next part type + djnz boot3 ; loop thru table + jr boot5 ; too bad, no CP/M partition + +boot4: + ; Capture the starting LBA of the CP/M partition we found + ld de,4 ; LBA is 4 bytes after part type + add hl,de ; point to it + ld de,lba ; loc to store lba offset + ld bc,4 ; 4 bytes (32 bits) + ldir ; copy it + + ; For now, it is implied that a slice within a partition + ; table will be in the "new" disk format. So, we now + ; adjust the sectors per slice and media id. + + ; Use new slice format sectors per slice value + ld hl,16384 ; new sectors per slice + ld (sps),hl ; save it + + ; Update media id for new hard disk format + ld a,10 ; new media id + ld (medid),a ; save it + +boot5: + ; Adjust LBA offset based on target slice + ld a,(slice) ; get boot slice, A is loop cnt + ld hl,(lba) ; set DE:HL + ld de,(lba+2) ; ... to starting LBA + ld bc,(sps) ; sectors per slice +boot6: + or a ; set flags to check loop cntr + jr z,boot8 ; done if counter exhausted + add hl,bc ; add one slice to low word + jr nc,boot7 ; check for carry + inc de ; if so, bump high word +boot7: + dec a ; dec loop downcounter + jr boot6 ; and loop +boot8: + ld (lba),hl ; save new lba, low word + ld (lba+2),de ; save new lba, high word + +boot9: + ; Locate DPB corresponding to media id ld hl,dpb$start - dpb$sz ld de,dpb$sz - ld b,a ; loop count -dsk$login1: - add hl,de ; next dpb - djnz dsk$login1 ; loop as needed - - ; hl is ptr to desired dpb - ld de,dph0 ; load DPH pointer - ex de,hl ; de = DPB adr, hl = DPH adr - push de ; save DPB adr - ld de,12 ; offset of DPB in DPH - add hl,de ; hl = adr of DPB field in DPH - pop de ; recover DPB adr - ld (hl),e ; update LSB - inc hl - ld (hl),d ; udpate MSB + ld a,(medid) ; get media id + ld b,a ; to loop count +boot10: + add hl,de ; next dpb + djnz boot10 ; loop as needed + + ; Stuff DPB ptr (HL) into DPH + ld de,dph0 ; load DPH pointer + ex de,hl ; de = DPB adr, hl = DPH adr + push de ; save DPB adr + ld de,12 ; offset of DPB in DPH + add hl,de ; hl = adr of DPB field in DPH + pop de ; recover DPB adr + ld (hl),e ; update LSB + inc hl ; point to MSB + ld (hl),d ; update MSB + + ret ; done - ret - wboot: ld a,81H halt @@ -162,15 +270,14 @@ const: ld a,82H halt conin: - ld bc,0080H ; unit 80h (console), func 0 = CIN - call 0FFF0H - + ld bc,0080h ; unit 80h (console), func 0 = CIN + call 0FFF0h ; do it + ld a,e ; put in C + ret ; done conout: - ld e,c ; output character in E - ld bc,0180H ; unit 80h (console), func 1 = COUT - ;rst 08 ; do it - call 0FFF0H - ret ; return + ld e,c ; output character in E + ld bc,0180h ; unit 80h (console), func 1 = COUT + jp 0FFF0h list: ld a,85H halt @@ -195,63 +302,122 @@ setsec: ld (sect),bc ret setdma: + + if debug + + push hl + push bc + pop hl + call crlf + call phex16 + pop hl + + endif + ld (dma),bc ret + read: - ld a,(unit) ; get unit - ld c,a ; BIOS Disk Unit in C - ld b,12H ; HBIOS SEEK function - push bc ; save it - ;push de ; save XDPH pointer - ld b,17h ; HBIOS DEVICE function - rst 08 ; Do it, D=device type - ld a,d ; put in accum - and 0F0h ; isolate high bits - ld b,1 ; assume it is floppy, 1 head bit - ld c,01h ; 1 bit head mask - cp 10h ; floppy? - jr z,seek0 ; yup, skip ahead - ld b,4 ; must be hard disk, 4 head bits - ld c,0Fh ; 4 bit head mask -seek0: - ;pop de ; recover XDPH pointer - push bc ; save bc - ld a,(slice) ; get slice - ld e,a ; slice to E - ld h,65 ; number of tracks per slice - call mult8 ; HL now has track offset for slice - pop bc ; recover bc - push hl ; save track offset for now - ld hl,(trk) ; get track value - ld a,l ; lsb of track to a - and c ; apply mask - ld d,a ; save in d -seek1: - srl h ; shift one bit out - rr l ; ... of hl - djnz seek1 ; do all bits - ld a,(sect) ; get sector - ld e,a ; stuff it in e - ex de,hl ; de=track, hl=head/sect - ex (sp),hl ; save head/sect, hl = offset - add hl,de ; hl has final track value - pop de ; recover head/sect to de - pop bc ; recover function & unit - ;rst 08 ; perform seek - call 0FFF0H - - ; Read Sector - ld b,13h ; HBIOS read - ld a,(unit) ; get boot unit - ld c,a ; put in C - ld hl,(dma) ; dma address - ld a,(0FFE0H) ; current bank - ld d,a ; ... to D - ld e,1 ; 1 sector - ;rst 08 - call 0FFF0H + if debug + + call crlf + ld a,(unit) + call phex8 + ld a,' ' + call cout + ld hl,(trk) + call phex16 + ld a,' ' + call cout + ld hl,(sect) + call phex16 + ld a,' ' + call cout + ld hl,(lba+2) + call phex16 + ld hl,(lba+0) + call phex16 - ret + endif + + ; Check device type + ld a,(unit) ; get unit + ld c,a ; BIOS Disk Unit in C + ld b,17h ; HBIOS DEVICE function + rst 08 ; Do it, D=device type + ld a,d ; put in accum + and 0F0h ; isolate high bits + cp 10h ; floppy? + jr nz,read2 ; if not, do LBA i/o + + ; Floppy I/O + ld de,(sect) ; sector -> de, head(d) becomes zero + ld hl,(trk) ; track -> hl (low bit has head) + srl h ; shift head bit out of hl + rr l ; ... and into carry + rl d ; carry bit (head) into d + jr read3 ; do the disk i/o + + ; LBA I/O +read2: + ld hl,(trk) ; get track + ld de,0 ; clear hiword + ld b,4 ; x16 (16 spt assumed) + call rl32 ; do it + ; combine with sector + ld a,(sect) ; get sector + or l ; combine + ld l,a ; and back to L + ; add in lba offset + ld bc,(lba) ; lba offset loword + add hl,bc ; add to cur loword + ex de,hl ; swap + ld bc,(lba+2) ; lba offset hiword + adc hl,bc ; add w/ carry to cur hiword + ex de,hl ; swap back + set 7,d ; set lba access bit + +read3: + + if debug + + ld a,' ' + call cout + ex de,hl + call phex16 + ex de,hl + call phex16 + + endif + + ; DE:HL has sector address to read (LBA or CHS) + ld a,(unit) ; get disk unit + ld c,a ; put in C + ld b,1 ; read 1 sector + jr diskread ; read sector and return + +diskread: + ; Read disk sector(s) + ; DE:HL is LBA, B is sector count, C is disk unit + + ; Seek to requested sector in DE:HL + push bc ; save unit & count + ld b,012h ; HBIOS func: seek + call 0FFF0h ; do it + pop bc ; recover unit & count + jp nz,err_diskio ; handle error + + ; Read sector(s) into buffer + ld e,b ; transfer count + ld b,013h ; HBIOS func: disk read + ld hl,(dma) ; read into info sec buffer + ld a,(0FFE0h) ; get current bank + ld d,a ; put in D + call 0FFF0h ; do it + jp nz,err_diskio ; handle error + xor a ; signal success + ret ; and done + write: ld a,8EH halt @@ -291,10 +457,11 @@ flush: halt move: - ex de,hl ; we are passed source in DE and dest in HL - ldir ; use Z80 block move instruction - ex de,hl ; need next addresses in same regs - ret + ; On input, DE=src, HL=dest + ex de,hl ; swap HL/DE for LDIR + ldir ; Z80 block move + ex de,hl ; swap back (required!) + ret ; done time: ld a,9AH halt @@ -307,22 +474,21 @@ setbnk: xmove: ld a,9DH halt - -cin: - ; input character from console via hbios - ld c,080H ; console unit to c - ld b,00H ; hbios func: input char - call 0FFF0H ; hbios reads character - ld a,e ; move character to a for return - ret -cout: - ; output character to console via hbios - ld e,a ; output char to e - ld c,080H ; console unit to c - ld b,01H ; hbios func: output char - call 0FFF0H ; hbios outputs character - ret +;cin: +; ; Input character from console via HBIOS +; ld c,080H ; console unit to C +; ld b,00H ; HBIOS func: input char +; call 0FFF0H ; HBIOS reads character +; ld a,e ; To A for return +; ret ; done + +;cout: +; ; Output character to console via HBIOS +; ld e,a ; output char to E +; ld c,080H ; console unit to C +; ld b,01H ; HBIOS func: output char +; jp 0FFF0H ; output & return writestr: push af @@ -339,153 +505,190 @@ writestr2: pop af ret -; -; multiply 8-bit values -; in: multiply h by e -; out: hl = result, e = 0, b = 0 -; -mult8: - ld d,0 - ld l,d - ld b,8 -mult8_loop: - add hl,hl - jr nc,mult8_noadd - add hl,de -mult8_noadd: - djnz mult8_loop - ret +rl32: + ; Left shift DE:HL by B bits (B > 0) + or a ; clear carry + rl l ; rotate L thru carry + rl h ; rotate H thru carry + rl e ; rotate E thru carry + rl d ; rotate D thru carry + djnz rl32 ; loop B times + ret ; done + +err_nodisk: + ld hl,str_err_nodisk + jr err +err_noslice: + ld hl,str_err_noslice + jr err +err_diskio: + ld hl,str_err_diskio + jr err +err_sig: + ld hl,str_err_sig + jr err +err_api: + ld hl,str_err_api + jr err +err: + push hl + ld de,str_err_prefix + call writestr + pop de + call writestr + halt + +str_err_prefix db "\r\n\r\n*** ","$" +str_err_nodisk db "Disk unit not available","$" +str_err_noslice db "Disk unit does not support slices","$" +str_err_diskio db "Disk I/O failure","$" +str_err_sig db "No system image on disk","$" +str_err_api db "HBIOS API failure","$" msgunit db 13,10,13,10,'Boot CP/M 3 from Disk Unit: $' msgslc db ' Slice: $' msginv db 13,10,13,10,'*** Invalid Selection ***$' -crlf db 13,10,'$' +msgcrlf db 13,10,'$' dpb$start: dpb$rom: ; 384K ROM Drive - dw 64 ; spt: sectors per track - db 4 ; bsh: block shift factor - db 15 ; blm: block mask - db 1 ; exm: extent mask - dw 192 - 1 ; dsm: total storage in blocks - 1 = (384kb / 2k bls) - 1 = 191 - dw 256 - 1 ; 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 8000h ; cks: directory check vector size - permanent storage = 8000H - dw 0 ; off: reserved tracks = 16 trks * (16 trks * 16 heads * 16 secs * 512 bytes) = 128k + dw 64 ; spt: sectors per track + db 4 ; bsh: block shift factor + db 15 ; blm: block mask + db 1 ; exm: extent mask + dw 192 - 1 ; dsm: total storage in blocks - 1 = (384kb / 2k bls) - 1 = 191 + dw 256 - 1 ; 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 8000h ; cks: directory check vector size - permanent storage = 8000H + dw 0 ; off: reserved tracks = 16 trks * (16 trks * 16 heads * 16 secs * 512 bytes) = 128k db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 dpb$sz equ $ - dpb$start dpb$ram: ; 256K RAM Drive - dw 64 ; spt: sectors per track - db 4 ; bsh: block shift factor - db 15 ; blm: block mask - db 1 ; exm: extent mask - dw 128 - 1 ; dsm: total storage in blocks - 1 = (256kb / 2k bls) - 1 = 127 - dw 256 - 1 ; 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 8000h ; cks: directory check vector size - permanent storage = 8000H - dw 0 ; off: reserved tracks = 16 trks * (16 trks * 16 heads * 16 secs * 512 bytes) = 128k + dw 64 ; spt: sectors per track + db 4 ; bsh: block shift factor + db 15 ; blm: block mask + db 1 ; exm: extent mask + dw 128 - 1 ; dsm: total storage in blocks - 1 = (256kb / 2k bls) - 1 = 127 + dw 256 - 1 ; 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 8000h ; cks: directory check vector size - permanent storage = 8000H + dw 0 ; off: reserved tracks = 16 trks * (16 trks * 16 heads * 16 secs * 512 bytes) = 128k db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 dpb$rf: ; 4MB RAM Floppy Drive - dw 64 ; 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 = (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 8000h ; cks: directory check vector size - permanent storage = 8000H - dw 0 ; off: reserved tracks = 0 trks + dw 64 ; 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 = (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 8000h ; cks: directory check vector size - permanent storage = 8000H + dw 0 ; off: reserved tracks = 0 trks db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 dpb$hd: ; 8MB Hard Disk Drive - 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 8000h ; cks: directory check vector size - permanent storage = 8000H - dw 16 ; off: reserved tracks = 16 trks * (16 trks * 16 heads * 16 secs * 512 bytes) = 128k + 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 512-1 ; 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 8000h ; cks: directory check vector size - permanent storage = 8000H + dw 16 ; off: reserved tracks = 16 trks * (16 trks * 16 heads * 16 secs * 512 bytes) = 128k db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 dpb$fd720: ; 3.5" DS/DD Floppy Drive (720K) - 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 + 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 db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 dpb_fd144: ; 3.5" DS/HD Floppy Drive (1.44M) - 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 + 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 db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 -dpb_fd360: ; 5.25" DS/DD Floppy Drive (360K) - 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 +dpb_fd360: ; 5.25" DS/DD Floppy Drive (360K) + 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 db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 dpb_fd120: ; 5.25" DS/HD Floppy Drive (1.2M) - 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 + 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 db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 dpb_fd111: ; 8" DS/DD Floppy Drive (1.11M) - 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 + 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 + db 2 ; psh: 2 for 512 byte sectors + db 3 ; phm: (512 / 128) - 1 + +dpb$hdnew: ; 8MB Hard Disk Drive (new format) + dw 64 ; spt: sectors per track + db 5 ; bsh: block shift factor + db 31 ; blm: block mask + db 1 ; exm: extent mask + dw 2048 - 1 - 4 ; dsm: total storage in blocks - 1 = 2048 - 1 - resvd tracks + dw 1024 - 1 ; drm: dir entries + db 11111111b ; al0: dir blk bit map, first byte + db 00000000b ; al1: dir blk bit map, second byte + dw 8000h ; cks: directory check vector size - permanent storage = 8000H + dw 2 ; off: reserved tracks db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 @@ -493,13 +696,13 @@ dph0: dw 0 ; xlt, 0 means no translation db 0,0,0,0,0,0,0,0,0 ; scratch (9 bytes) db 0 ; mf: media flag dw dpb$hd ; dpb - dw csvbuf ; csv: - dw alvbuf ; alv: + dw csvbuf ; csv: + dw alvbuf ; alv: dw dirbcb ; dirbcb dw dtabcb ; dtabcb dw 0ffffh ; hash (disabled) db 0 ; hbank - + dtbl: dtbl dph0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dirbcb: db 0ffh ; drv @@ -524,13 +727,32 @@ trk ds 2 ; current track sect ds 2 ; current sector dma ds 2 ; current DMA address -csvbuf ds 128 ; length (CSV) = ((DRM+1)/4) -alvbuf ds 512 ; length (ALV) = ((DSM+1)/4) -dirbuf ds 512 ; sector buffer -dtabuf ds 512 ; sector buffer +medid ds 1 ; media id +lba ds 4 ; current lba +sps ds 2 ; sectors per slice ds 64 stack equ $ -stksav dw 0 +stksav ds 2 + +csvbufs equ 256 +alvbufs equ 512 +dirbufs equ 512 +dtabufs equ 512 + +;csvbuf ds 256 ; length (CSV) = ((DRM+1)/4) +;alvbuf ds 512 ; length (ALV) = ((DSM+1)/4) +;dirbuf ds 512 ; sector buffer +;dtabuf ds 512 ; sector buffer + +; Trying to save space. The loader must fit underneath +; the start of BNKBDOS3 and we have a big BNKBDOS because +; of all the disk allocations. Putting these buffers +; in upper memory actually helps quite a bit. + +csvbuf equ 8000h +alvbuf equ csvbuf + csvbufs +dirbuf equ alvbuf + alvbufs +dtabuf equ dirbuf + dirbufs end diff --git a/Source/CPM3/boot.z80 b/Source/CPM3/boot.z80 index b80d7631..ce3fef1b 100644 --- a/Source/CPM3/boot.z80 +++ b/Source/CPM3/boot.z80 @@ -14,9 +14,12 @@ extrn @date,@hour,@min,@sec extrn @srch1 extrn @hbbio - extrn addhla, bcd2bin, bin2bcd - extrn cout, phex8, phex16, crlf, crlf2 - + extrn addhla + extrn phex16, phex8 + extrn cin, cout + extrn crlf, crlf2 + extrn bcd2bin, bin2bcd + include c:ver.lib bdos equ 5 @@ -41,7 +44,7 @@ tpa$bank equ 0 if banked ; Clone page zero from bank 0 to additional banks - ld b,3 ; last bank + ld b,4 ; last bank ld c,0 ; src bank init$2: push bc ; save bank id's @@ -59,6 +62,23 @@ init$2: ld hl,signon$msg ; signon message call ?pmsg ; print it + ; Check for HBIOS/CBIOS mismatch + ld b,0F1h ; hbios version + rst 08 ; do it, de=maj/min/up/pat + ld a,d ; a := maj/min + cp ((rmj << 4) | rmn) ; match? + jr nz,init$3 ; handle ver mismatch + ld a,e ; a := os up/pat + and 0F0h ; pat not included in match + cp (rup << 4) ; match? + jr nz,init$3 ; handle ver mismatch + jr init$4 ; all good, continue +init$3: + ; display version mismatch + ld hl,vermis$msg ; version mismatch + call ?pmsg ; display it +init$4: + ; Get boot disk unit and save it ld bc,0F8E0h ; HBIOS func: get boot info rst 08 ; do it, D := boot unit, E: := boot slice @@ -228,25 +248,7 @@ dinit6: pop de ; restore drive list ptr inc de ; increment active drive list ptr djnz dinit6 ; loop as needed - - ; zero out remaining dph table entries - ld a,16 ; dph table entries - sub l ; subtract entries used - ret z ; return if all entries used - ld b,a ; save as loop counter - ld a,l ; current dph to accum - rlca ; *2 for word entry - ld hl,@dtbl ; start of dtbl - call addhla ; hl now points to entry - -dinit6a: - xor a ; zero accum - ld (hl),a ; zero lsb - inc hl ; next byte - ld (hl),a ; zero msb - inc hl ; next byte - djnz dinit6a - ret ; finished + ret dinit7: ; process a unit (all slices) ld e,0 ; initialize slice index @@ -315,11 +317,28 @@ clrram: di ; no interrupts ld a,(0FFE0h) ; get current bank push af ; save it - ;ld a,(bnkramd) ; first bank of ram disk - ld a,080h ; first bank of ram disk + ld b,0FAh ; HBIOS Peek Function + ld a,(@hbbio) ; HBIOS bank id + ld d,a ; ... goes in D + ld hl,1DCh ; Offset 1DCh is ram disk bank 0 + rst 08 ; Call HBIOS, value in E + ld a,e ; move to A for bank sel + cp 0FFh + jr z,clrram3 ;call hb_bnksel ; select bank call 0FFF3h ; select bank + ; Check the first sector (512 bytes) for all zeroes. If so, + ; it implies the RAM is uninitialized. + ld hl,0 ; start at begining of ram disk + ld bc,512 ; compare 512 bytes + xor a ; compare to zero +clrram000: + cpi ; a - (hl), hl++, bc-- + jr nz,clrram00 ; if not zero, go to next test + jp pe,clrram000 ; loop thru all bytes + jr clrram2 ; all zeroes, jump to init +clrram00: ; 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). @@ -346,7 +365,6 @@ clrram2: or 0ffh ; flag value for cleared ld (clrflg),a ; save it clrram3: - ;ld a,(bnkuser) ; usr bank (tpa) pop af ; recover original bank ;call hb_bnksel ; select bank call 0FFF3h ; select bank @@ -380,18 +398,18 @@ fill: ?ldccp: ; Force CCP to use system boot drive as initial default - ld a,(@sysdr) ; get system boot drive - ld (@ccpdr),a ; set CCP current drive + ;ld a,(@sysdr) ; get system boot drive + ;ld (@ccpdr),a ; set CCP current drive ; First time, load the CCP.COM file into TPA - ld a,(@sysdr) ; get system boot drive - ;ld (4),a ; save in page zero??? - inc a ; drive + 1 for FCB - ld (ccp$fcb),a ; stuff into FCB - add 'A' - 1 ; drive letter - ld (ccp$msg$drv),a ; save for load msg - xor a - ld (ccp$fcb+15),a + ;ld a,(@sysdr) ; get system boot drive + ;;ld (4),a ; save in page zero??? + ;inc a ; drive + 1 for FCB + ;ld (ccp$fcb),a ; stuff into FCB + ;add 'A' - 1 ; drive letter + ;ld (ccp$msg$drv),a ; save for load msg + ;xor a + ;ld (ccp$fcb+15),a ld hl,0 ld (fcb$nr),hl ld de,ccp$fcb @@ -490,7 +508,7 @@ time$ret: time$get: ; RTC -> cpm date/time in SCB - + ; read time from RTC ld b,020h ; HBIOS func: get time ld hl,tim$buf ; time buffer @@ -500,6 +518,7 @@ time$get: ; convert yymmss in time buffer -> cpm3 epoch date offset call date2cpm ; time buf (yr, mon, day) -> SCB (@date) +time$get1: ; set time fields in SCB ld a,(tim$hr) ; get hour from time buf ld (@hour),a ; ... and put in SCB @@ -515,7 +534,7 @@ time$set: ; convert CPM3 epoch date offset in SCB -> yymmss in time buffer call cpm2date ; SCB (@date) -> time buf (yr, mon, day) - + ; copy CPM3 time values from SCB -> time buffer ld a,(@hour) ; get hour from SCB ld (tim$hr),a ; ... and put in tim$hr @@ -523,7 +542,7 @@ time$set: ld (tim$min),a ; ... and put in tim$min ld a,(@sec) ; get second from SCB ld (tim$sec),a ; ... and put in tim$sec - + ; send time to RTC ld b,021h ; HBIOS func: set time ld hl,tim$buf ; ... from time buffer @@ -535,7 +554,7 @@ date2cpm: ; Convert YYMMSS from time buffer at HL ; into offset from CPM epoch and store ; result in SCB. - + ld hl,0 ; initialize day counter ; Add in days for elapsed years ld a,(tim$yr) ; get current year @@ -552,33 +571,31 @@ d2c1: d2c2: add hl,de ; add non-leap days dec c ; dec leap counter - jr nz,d2c3 ; if not leap, bypss leap inc + jr nz,d2c3 ; if not leap, bypass leap inc inc hl ; add leap day ld c,4 ; reset leap year counter d2c3: djnz d2c2 ; loop for all years + d2c10: ; Add in days for elapsed months - ex de,hl ; save HL in DE - ld hl,daystbl ; point to table of cum days by month + ld de,daysmon ; point to start of days per mon tbl ld a,(tim$mon) ; get current month call bcd2bin ; convert to binary - dec a ; index from zero - rlca ; table entries are 2 bytes - call addhla ; offset to desired month entry - ld a,(hl) ; get the entry into HL - inc hl ; ... - ld h,(hl) ; ... - ld l,a ; ... - ex de,hl ; HL = day count, DE = months count - add hl,de ; add months count into day count - ; Add leap day for current year if appropriate - dec c ; C still has leap counter - jr nz,d2c20 ; skip if not leap year - ld a,(tim$mon) ; get cur mon - cp 3 ; March? - jr c,d2c20 ; skip if mon less than March - inc hl ; add leap day for cur year + dec a ; don't include cur mon + jr z,d2c20 ; done if Jan + ld b,a ; save as loop counter + cp 2 ; Mar = 2 + jr c,d2c11 ; bypass if < Mar (no leap month) + dec c ; C still has leap year counter + jr nz,d2c11 ; skip if not leap year + inc hl ; add in the leap day +d2c11: + ld a,(de) ; get days for cur mon + call addhla ; add to running count + inc de ; bump to next mon ptr + djnz d2c11 ; loop for # of months + d2c20: ; Add in days elapsed within month ; Note that we don't adjust the date to be a zero @@ -590,37 +607,104 @@ d2c20: call bcd2bin ; make binary call addhla ; add in days ld (@date),hl ; store in SCB + ;call phex16 ; *debug* + ;call crlf ; *debug* ret cpm2date: ; Convert CPM epoch date offset in SCB ; into YYMMSS values and store result in ; time buffer at HL. - ld a,019h - ld (tim$yr),a - ld a,001h - ld (tim$mon),a - ld a,001h - ld (tim$day),a + + ; We start by subtracting years keeping a count + ; of the number of years. Every fourth year is a leap + ; year, so we account for that as we go. + ld hl,(@date) ; get the count of days since epoch + dec hl ; because we want 1/1/78 to be offset 0 + ld c,78 ; init the years value +c2d1: + ld de,365 ; normal number of days per year + ld a,c + ld b,0 ; init leap year flag + and 03h ; check for leap year + jr nz,c2d2 ; if not zero, no need to adjust + inc de ; add a day for leap year + ld b,1 ; leap year flag for later +c2d2: + or a ; clear carry + sbc hl,de ; subtract + jr c,c2d3 ; get out if we went too far + inc c ; add a year to year value + ld a,c ; to accum + cp 100 ; century rollover? + jr nz,c2d1 ; nope, loop + ld c,0 ; reset for start of century + jr c2d1 ; loop +c2d3: + ld a,c ; years to accum + call bin2bcd ; convert to bcd + ld (tim$yr),a ; ... and save it + ;call phex8 ; *debug* +; + ; Now we use the days per month table to find the + ; month. + add hl,de ; restore days remaining + ld c,0 ; init month value (zero indexed) +c2d4: + ld a,c ; get month value + push hl ; save hl (days remaining) + ld hl,daysmon ; point to start of table + call addhla ; point to month entry + ld e,(hl) ; get months day count to E + ld d,0 ; zero msb, DE is days in month + pop hl ; recover hl (days remaining) + ld a,c ; month value to accum + cp 1 ; leap month? check for Feb + jr nz,c2d5 ; no, leave alone + ld a,b ; get leap year flag (set above) + or a ; leap year? + jr z,c2d5 ; if not, skip ahead + inc de ; account for leap year +c2d5: + or a ; clear carry + sbc hl,de ; subtract days for the month + jr c,c2d6 ; get out if we went too far + inc c ; next month + jr c2d4 ; continue +c2d6: + inc c ; switch from 0 to 1 offset + ld a,c ; move to accum + call bin2bcd ; convert to bcd + ld (tim$mon),a ; save it + ;call phex8 ; *debug* +; + ; Leftover days is day value + add hl,de ; restore days remaining + ld a,l ; only need lsb + inc a ; switch from 0 to 1 offset + call bin2bcd ; convert to bcd + ld (tim$day),a ; save it + ;call phex8 ; *debug* ret -daystbl: - ; cumulative days elapsed by month (non-leap year) - dw 0 ; January - dw 31 ; February (non-leap) - dw 59 ; March - dw 90 ; April - dw 120 ; May - dw 151 ; June - dw 181 ; July - dw 212 ; August - dw 243 ; September - dw 273 ; October - dw 304 ; November - dw 334 ; December - - ; RTC time buffer (all values packed bcd) +daysmon: + ; days per month + db 31 ; January + db 28 ; February (non-leap) + db 31 ; March + db 30 ; April + db 31 ; May + db 30 ; June + db 31 ; July + db 31 ; August + db 30 ; September + db 31 ; October + db 30 ; November + db 31 ; December + +; RTC time buffer (all values packed bcd) + tim$buf: tim$yr db 80h tim$mon db 05h @@ -647,6 +731,7 @@ read: clrflg db 0 ; RAM disk cleared flag clr$msg db 'RAM Disk Initialized',13,10,13,10,0 +vermis$msg db 7,'*** WARNING: HBIOS/CBIOS Version Mismatch ***',13,10,13,10,0 if zpm @@ -654,16 +739,16 @@ signon$msg db 13,10,'ZPM3' if banked db ' [BANKED]' endif - db ' on HBIOS v' + db ' for HBIOS v' biosver db 13,10,13,10,0 ccp$msg db 13,10,'BIOS Err on ' -ccp$msg$drv db '?' +ccp$msg$drv db 'A' db ': No ZCCP.COM file',0 -ccp$fcb db 0,'ZCCP ','COM',0,0,0,0 +ccp$fcb db 1,'ZCCP ','COM',0,0,0,0 ds 16 fcb$nr db 0,0,0 @@ -673,16 +758,16 @@ signon$msg db 13,10,'CP/M v3.0' if banked db ' [BANKED]' endif - db ' on HBIOS v' + db ' for HBIOS v' biosver db 13,10,13,10,0 ccp$msg db 13,10,'BIOS Err on ' -ccp$msg$drv db '?' +ccp$msg$drv db 'A' db ': No CCP.COM file',0 -ccp$fcb db 0,'CCP ','COM',0,0,0,0 +ccp$fcb db 1,'CCP ','COM',0,0,0,0 ds 16 fcb$nr db 0,0,0 diff --git a/Source/CPM3/diskio.z80 b/Source/CPM3/diskio.z80 index 154d601d..2d87a132 100644 --- a/Source/CPM3/diskio.z80 +++ b/Source/CPM3/diskio.z80 @@ -15,6 +15,7 @@ public @sysdr extrn @bootdu,@bootsl + extrn @hbbio ; Variables containing parameters passed by BDOS @@ -37,7 +38,7 @@ extrn ?bnkxlt - ;extrn phex8, cout + extrn phex8, cout ; CP/M 3 Disk definition macros @@ -60,113 +61,129 @@ bell equ 7 dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph0: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph1: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph2: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph3: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph4: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph5: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph6: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph7: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph8: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph9: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph10: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph11: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph12: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph13: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph14: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset dw dsk$write dw dsk$read dw dsk$login dw dsk$init - db 0,0 ; HBIOS Disk Unit/Slice (filled in at boot) + db 0FFh,0FFh ; HBIOS Disk Unit/Slice (filled in at boot) dph15: dph 0,dpb$max ; Real DPB filled in at disk login + dw 0, 0 ; LBA Offset cseg ; DPB must be resident @@ -175,11 +192,12 @@ dpb$max: 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 + dw 2048 - 1 ; dsm: total storage in blocks - 1 = (8mb / 4k bls) - 1 = 2047 + dw 1024 - 1 ; drm: dir entries - 1 + db 11111111b ; 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 64 ; cks: directory check vector size - 256 / 4 + dw 256 ; cks: directory check vector size - 1024 / 4 dw 0 ; off: reserved tracks = 16 trks * (16 trks * 16 heads * 16 secs * 512 bytes) = 128k db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 @@ -194,7 +212,7 @@ dpb$rom: ; 384K ROM Drive dw 256 - 1 ; 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 8000h ; cks: directory check vector size - permanent storage = 8000H + dw 8040h ; cks: directory check vector size - permanent storage = 8000H dw 0 ; off: reserved tracks = 16 trks * (16 trks * 16 heads * 16 secs * 512 bytes) = 128k db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 @@ -209,7 +227,7 @@ dpb$ram: ; 256K RAM Drive dw 256 - 1 ; 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 8000h ; cks: directory check vector size - permanent storage = 8000H + dw 8040h ; cks: directory check vector size - permanent storage = 8000H dw 0 ; off: reserved tracks = 16 trks * (16 trks * 16 heads * 16 secs * 512 bytes) = 128k db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 @@ -219,25 +237,25 @@ dpb$rf: ; 4MB RAM Floppy Drive db 4 ; bsh: block shift factor db 15 ; blm: block mask db 0 ; exm: extent mask - dw 2047 ; dsm: total storage in blocks - 1 = (4mb / 2k bls) - 1 = 2047 - dw 255 ; drm: dir entries - 1 = 256 - 1 = 255 + dw 2048 - 1 ; dsm: total storage in blocks - 1 = (4mb / 2k bls) - 1 = 2047 + dw 256 - 1 ; 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 8000h ; cks: directory check vector size - permanent storage = 8000H + dw 8040h ; cks: directory check vector size - permanent storage = 8000H dw 0 ; off: reserved tracks = 0 trks db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 -dpb$hd: ; 8MB Hard Disk Drive +dpb$hd: ; 8MB Hard Disk Drive w/ 512 dir entries 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 + dw 2048 - 1 ; dsm: total storage in blocks - 1 = (8mb / 4k bls) - 1 = 2047 + dw 512 - 1 ; 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 8000h ; cks: directory check vector size - permanent storage = 8000H + dw 8080h ; cks: directory check vector size - permanent storage = 8000H dw 16 ; off: reserved tracks = 16 trks * (16 trks * 16 heads * 16 secs * 512 bytes) = 128k db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 @@ -247,8 +265,8 @@ dpb$fd720: ; 3.5" DS/DD Floppy Drive (720K) 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 + dw 351 - 1 ; dsm: total storage in blocks - 1 blk = ((720k - 18k off) / 2k bls) - 1 = 350 + dw 128 - 1 ; 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 @@ -261,8 +279,8 @@ dpb_fd144: ; 3.5" DS/HD Floppy Drive (1.44M) 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 + dw 711 - 1 ; dsm: total storage in blocks - 1 blk = ((1,440k - 18k off) / 2k bls) - 1 = 710 + dw 256 - 1 ; 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 @@ -275,8 +293,8 @@ dpb_fd360: ; 5.25" DS/DD Floppy Drive (360K) 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 + dw 171 - 1 ; dsm: total storage in blocks - 1 blk = ((360k - 18k off) / 2k bls) - 1 = 170 + dw 128 - 1 ; 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 @@ -289,8 +307,8 @@ dpb_fd120: ; 5.25" DS/HD Floppy Drive (1.2M) 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 + dw 592 - 1 ; dsm: total storage in blocks - 1 blk = ((1,200k - 15k off) / 2k bls) - 1 = 591 + dw 256 - 1 ; 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 @@ -303,8 +321,8 @@ dpb_fd111: ; 8" DS/DD Floppy Drive (1.11M) 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 + dw 570 - 1 ; dsm: total storage in blocks - 1 blk = ((1,155k - 15k off) / 2k bls) - 1 = 569 + dw 256 - 1 ; 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 @@ -312,6 +330,20 @@ dpb_fd111: ; 8" DS/DD Floppy Drive (1.11M) db 2 ; psh: 2 for 512 byte sectors db 3 ; phm: (512 / 128) - 1 +dpb$hdnew: ; 8MB Hard Disk Drive (new format) + dw 64 ; spt: sectors per track + db 5 ; bsh: block shift factor + db 31 ; blm: block mask + db 1 ; exm: extent mask + dw 2048 - 1 - 4 ; dsm: total storage in blocks - 1 = 2048 - 1 - resvd tracks + dw 1024 - 1 ; drm: dir entries + db 11111111b ; al0: dir blk bit map, first byte + db 00000000b ; al1: dir blk bit map, second byte + dw 8100h ; cks: directory check vector size - permanent storage = 8000H + dw 2 ; off: reserved tracks + db 2 ; psh: 2 for 512 byte sectors + db 3 ; phm: (512 / 128) - 1 + dseg ; rest is banked @@ -323,6 +355,61 @@ dpb_fd111: ; 8" DS/DD Floppy Drive (1.11M) ; called for first time initialization. dsk$init: + ; TODO: Handle disabled RAM/ROM disk better. + ; If RAM or ROM disk are disabled, below will still + ; try to adjust the DPB based on RAM bank calculations. + ; It should not matter because the DPB should never be + ; used. It would be better to get RAMD0/ROMD0 and + ; RAMDN/ROMDN from the HCB and use those to calc the + ; DPB adjustment. If DN-D0=0, bypass adjustment. + ld b,0FAh ; HBIOS Peek Function + ld a,(@hbbio) ; HBIOS bank id + ld d,a ; ... goes in D + ld hl,10Ch ; Offset 10Ch is ROM bank cnt + rst 08 ; Call HBIOS, value in E + ld a,e ; move count to accum + sub 4 ; reduce by # reserved banks + ld ix,dpb$rom ; address of DPB + call dsk$init1 ; fix it up + + ld b,0FAh ; HBIOS Peek Function + ld a,(@hbbio) ; HBIOS bank id + ld d,a ; ... goes in D + ld hl,10Bh ; Offset 10Bh is RAM bank cnt + rst 08 ; Call HBIOS, value in E + ld a,e ; move count to accum + sub 8 ; reduce by # reserved banks + ld ix,dpb$ram ; address of DPB + call dsk$init1 ; fix it up + + ret ; done + +dsk$init1: + ; Setup HL with bank count + ld l,a ; lsb + ld h,0 ; msb is always zero + + ; Update EXM field + ld a,l ; lsb of bank count + cp 16 + 1 ; compare to EXM threshold + ld a,1 ; assume <= 16 banks, EXM := 0 + jr c,dsk$init2 ; done if so + xor a ; > 16 banks, EXM := 0 +dsk$init2: + ld (ix + 4),a ; save new EXM value + + ; Update DSM field + ld b,4 ; prepare to mult by 16 +dsk$init3: + sla l ; shift lsb + rl h ; shift msb w/ carry + djnz dsk$init3 ; repeat as needed + dec hl ; subtract 1 for proper DSM value + ld (ix+5),l ; save updated + ld (ix+6),h ; ... DSM value + + ret + ;ld a,(@rdrv) ; unit being initialized ;ld hl,@bootdu ;cp (hl) ; compare to boot unit @@ -370,48 +457,191 @@ dsk$login: ;ld a,'L' ;call cout + + ld (curdph),de ; save working DPH + ex de,hl ; DPH adr to HL + dec hl ; point to slice + ld a,(hl) ; get slice + ld (slice),a ; save it + dec hl ; point to disk unit + ld a,(hl) ; get unit + ld (unit),a ; save it + inc a ; 0FFh -> 000h + jp z,err_ret ; bail out on no disk mapped here + + ;call media ; update DPH for media + ;ret - push de ; save DPH ptr +media: + ; Set retry address + ld hl,media + ld (retry$adr),hl - ; check media - ld a,(@rdrv) ; get disk unit - ;halt - ld c,a ; put in C - ld b,18h ; HBIOS Media function - ld e,1 ; Enable media check/discovery - ;rst 08 - call 0FFF0H ; HBIOS call - ld a,e ; Resultant media id to accum - or a ; Set flags - ;halt - ; - ; !!! Need to do something on error !!! - ; - jr nz,dsk$login0 ; continue if OK - pop de ; else error - ret ; return + ; Sense media to determine media format + ld a,(unit) ; get disk unit + ld c,a ; put in C + ld b,18h ; HBIOS Media function + ld e,1 ; Enable media check/discovery + call 0FFF0H ; HBIOS call + jp nz,err_diskio ; handle error + ld a,e ; resultant media id to accum + ld (medid),a ; save media id + or a ; set flags, 0 is no media + jp z,err_nodisk ; handle no media error + + ; Initialize slice start LBA & sectors per slice + ld hl,0 ; assume slice starts + ld (lba),hl ; ... at LBA offset + set 7,h ; ... of zero + ld (lba+2),hl ; ... w/ LBA access + + ; Check device type + ld a,(unit) ; get disk unit + ld c,a ; put in C + ld b,17h ; HBIOS func: report device info + call 0FFF0h ; get unit info, device type in D + ld a,d ; device type -> A + and 0F0h ; isolate high bits + cp 10h ; floppy? + jr nz,media1 ; if not, do LBA I/O + ld hl,lba+3 ; point to high order byte + res 7,(hl) ; switch from LBA -> CHS + +media1: + ld hl,16640 ; assume legacy value for + ld (sps),hl ; ... sectors per slice + + ; If not hard disk, skip partition & slice stuff + ld a,(medid) ; get media id + cp 4 ; hard disk? + jp nz,media9 ; if not, jump ahead + + ; Read MBR + ld de,8000h ; LBA address zero + ld hl,0 ; ... to read first sector + ld bc,mbrsec ; read into MBR buffer + ld (dma),bc ; save + ld a,(0FFE0h) ; get current HBIOS bank + ld (bank),a ; set DMA bank + ld a,(unit) ; get bootunit + ld c,a ; put in C + ld b,013h ; HBIOS func: disk read + call dsk$io ; do it + ret nz ; abort on error + + ; Check signature + ld hl,(mbrsec+1FEh) ; get signature + ld a,l ; first byte + cp 055h ; should be $55 + jr nz,media5 ; if not, no part table + ld a,h ; second byte + cp 0AAh ; should be $AA + jr nz,media5 ; if not, no part table + + ; Search part table for CP/M entry (type 0x2E) + ld b,4 ; four entries in part table + ld hl,mbrsec+1BEh+4 ; offset of first part type +media3: + ld a,(hl) ; get part type + cp 2Eh ; CP/M partition? + jr z,media4 ; cool, grab the LBA offset + ld de,16 ; part table entry size + add hl,de ; bump to next part type + djnz media3 ; loop thru table + jr media5 ; too bad, no CP/M partition + +media4: + ; Capture the starting LBA of the CP/M partition we found + ld de,4 ; LBA is 4 bytes after part type + add hl,de ; point to it + ld de,lba ; loc to store lba offset + ld bc,4 ; 4 bytes (32 bits) + ldir ; copy it -dsk$login0: + ; Check that requested slice is "inside" partition. + ; Slice size is exactly 16,384 sectors (8mb), so we can just + ; right shift partition sector count by 14 bits + ld e,(hl) ; HL points to first byte + inc hl ; ... of 32 bit partition + ld d,(hl) ; ... sector count, + inc hl ; ... load sector count + push de ; ... into DE:HL + ld e,(hl) ; ... + inc hl ; ... + ld d,(hl) ; ... + pop hl ; ... DE:HL = part size in sectors + ld b,2 ; DE = DE:HL >> 2 (tricky!) + call rl32 ; DE = slicecnt + ex de,hl ; HL = slicecnt + ld a,(slice) ; get target slice + ld c,a ; put in C + ld b,0 ; BC := requested slice # + scf ; set carry! + sbc hl,bc ; max slices - slice - 1 + jp c,err_noslice ; slice too high, error exit + + ; For now, it is implied that a slice within a partition + ; table will be in the "new" disk format. So, we now + ; adjust the sectors per slice and media id. + + ; Use new slice format sectors per slice value + ld hl,16384 ; new sectors per slice + ld (sps),hl ; save it + + ; Update media id for new hard disk format + ld a,10 ; new media id + ld (medid),a ; save it + +media5: + ; Adjust LBA offset based on target slice + ld a,(slice) ; get slice, A is loop cnt + ld hl,(lba) ; set DE:HL + ld de,(lba+2) ; ... to starting LBA + ld bc,(sps) ; sectors per slice +boot6: + or a ; set flags to check loop cntr + jr z,boot8 ; done if counter exhausted + add hl,bc ; add one slice to low word + jr nc,boot7 ; check for carry + inc de ; if so, bump high word +boot7: + dec a ; dec loop downcounter + jr boot6 ; and loop +boot8: + set 7,d ; set LBA access flag + ld (lba),hl ; save new lba, low word + ld (lba+2),de ; save new lba, high word + +media9: + ; Locate DPB corresponding to media id ld hl,dpb$start - dpb$sz ld de,dpb$sz - ld b,a ; loop count -dsk$login1: - add hl,de ; next dpb - djnz dsk$login1 ; loop as needed - - ; hl is ptr to desired dpb - pop de ; restore DPH ptr - ;halt - ex de,hl ; de = DPB adr, hl = DPH adr - push de ; save DPB adr - ld de,12 ; offset of DPB in DPH - add hl,de ; hl = adr of DPB field in DPH - pop de ; recover DPB adr - ld (hl),e ; update LSB - inc hl - ld (hl),d ; udpate MSB - ret ; done - + ld a,(medid) ; get media id + ld b,a ; to loop count +media10: + add hl,de ; next dpb + djnz media10 ; loop as needed + + ; Stuff DPB ptr (HL) and LBA offset into DPH + ; DPH: DPB @ +12, LBA @ +25 + ld de,(curdph) ; load DPH pointer + ex de,hl ; de = DPB adr, hl = DPH adr + push de ; save DPB adr + ld de,12 ; offset of DPB in DPH + add hl,de ; hl = adr of DPB field in DPH + pop de ; recover DPB adr + ld (hl),e ; update LSB + inc hl ; point to MSB + ld (hl),d ; update MSB + ld de,12 ; 12 more bytes to LBA + add hl,de ; HL points to LBA offset field + ld de,lba ; DE points to LBA offset + ex de,hl ; swap for copy + ld bc,4 ; 4 bytes + ldir ; do it + + xor a ; signal success + ret ; done ; disk READ and WRITE entry points. @@ -429,116 +659,115 @@ dsk$login1: ; if necessary, then return an error code in dsk$read: -; ld ix,30H -; halt + ld a,13h ; HBIOS disk read function + ld (func),a ; save it + jr dsk$rw ; common disk read/write code - ;ld a,'R' - ;call cout +dsk$write: + ld a,14h ; HBIOS disk write function + ld (func),a ; save it + jr dsk$rw ; common disk read/write code - push de ; save XDPH pointer - call dsk$seek ; disk seek - pop hl ; restore pointer to HL - ret nz ; abort on seek error -; - dec hl ; point to unit field of XDPH - dec hl - ld c,(hl) ; BIOS Disk Unit in C - ld b,13H ; HBIOS READ function - ld hl,(@dma) ; Dest buffer adr +dsk$rw: + ; Common disk read/write routine + ; Assumes func is set to HBIOS read or write + + ; Set retry address + ld hl,dsk$rw$retry + ld (retry$adr),hl + + ; Save XDPH address + ld (curdph),de ; save to curdph + +dsk$rw$retry: + ; Get LBA offset from DPH to DE:HL + ld hl,(curdph) ; HL := DPH adr + ld de,25 ; LBA value adr + add hl,de ; HL := LBA offset + ld e,(hl) ; lobyte of loword + inc hl ; bump + ld d,(hl) ; hibyte of loword + inc hl ; bump + push de ; save loword + ld e,(hl) ; lobyte of hiword + inc hl ; bump + ld d,(hl) ; hibyte of hiword + pop hl ; recover loword + + bit 7,d ; LBA access bit set? + jr nz,dsk$rw2 ; if so, go to LBA I/O + + ; Floppy I/O + ld de,(@sect) ; sector -> de, head(d) becomes zero + ld hl,(@trk) ; track -> hl (low bit has head) + srl h ; shift head bit out of hl + rr l ; ... and into carry + rl d ; carry bit (head) into d + jr dsk$rw9 ; do the disk I/O + +dsk$rw2: + ; LBA I/O + push de ; save hiword of LBA + push hl ; save loword of LBA + + ; Get track and shift into correct bits + ld hl,(@trk) ; get track + ld de,0 ; clear hiword + ld b,4 ; x16 (16 spt assumed) + call rl32 ; do it + + ; Combine with sector + ld a,(@sect) ; get sector + or l ; combine + ld l,a ; and back to L + + ; Add in LBA offset + pop bc ; lba offset loword + add hl,bc ; add to cur loword + ex de,hl ; swap + pop bc ; lba offset hiword + adc hl,bc ; add w/ carry to cur hiword + ex de,hl ; swap back + +dsk$rw9: + ; DE:HL has sector address to read (LBA or CHS) + ld bc,(@dma) ; get dma address + ld (dma),bc ; save for dsk$io if banked - ld a,(@dbnk) ; destination bank - call ?bnkxlt + ld a,(@dbnk) ; destination bank + call ?bnkxlt ; xlat to HBIOS else - ld a,(0FFE0H) ; get current bank + ld a,(0FFE0H) ; get current bank endif - ld d,a ; set desk bank - ld e,1 ; 1 sector - rst 08 ; do it - ;call 0FFF0H + ld (bank),a + ld a,(func) ; get HBIOS func code + ld b,a ; put in B + ld a,(@rdrv) ; get disk unit + ld c,a ; put in C + ;jr dsk$io ; fall thru to dsk$io! + +dsk$io: + ; Read/write a disk sector + ; DE:HL is CHS/LBA, B is HBIOS func, C is disk unit + + ; Seek to requested sector in DE:HL + push bc ; save func & unit + ld b,012h ; HBIOS func: seek + call 0FFF0h ; do it + pop bc ; recover func & unit + jp nz,err_diskio ; handle error + + ; Read sector(s) into buffer + ld e,1 ; transfer count + ld hl,(dma) ; read into info sec buffer + ld a,(bank) ; HBIOS DMA bank + ld d,a ; put in D + call 0FFF0h ; do it + jp nz,err_diskio ; handle error + xor a ; signal success + ret ; and done - ;call phex8 - ret ; return -; lxi h,read$msg ; point at " Read " -; mvi a,88h ! mvi b,01h ; 1797 read + Z80DMA direction -; jmp rw$common - -dsk$write: - ;ld ix,32H - ;halt - - push de ; save XDPH pointer - call dsk$seek ; disk seek - pop hl ; restore pointer to XDPH - ret nz ; abort on seek error -; - dec hl ; point to unit field of XDPH - dec hl - ld c,(hl) ; BIOS Disk Unit in C - ld b,14H ; HBIOS WRITE function - ld hl,(@dma) ; Dest buffer adr - if banked - ld a,(@dbnk) ; destination bank - call ?bnkxlt - else - ld a,(0FFE0H) ; get current bank - endif - ld d,a ; set desk bank - ld e,1 ; 1 sector - rst 08 ; do it - ;call 0FFF0H - ret ; return - -; lxi h,write$msg ; point at " Write " -; mvi a,0A8h ! mvi b,05h ; 1797 write + Z80DMA direction -; ; jmp wr$common - -dsk$seek: - dec de ; point to unit field of XDPH - dec de - ld a,(de) ; get it - ld c,a ; BIOS Disk Unit in C - ld b,12H ; HBIOS SEEK function - push bc ; save it - push de ; save XDPH pointer - ld b,17h ; HBIOS DEVICE function - rst 08 ; Do it, D=device type - ld a,d ; put in accum - and 0F0h ; isolate high bits - ld b,1 ; assume it is floppy, 1 head bit - ld c,01h ; 1 bit head mask - cp 10h ; floppy? - jr z,seek0 ; yup, skip ahead - ld b,4 ; must be hard disk, 4 head bits - ld c,0Fh ; 4 bit head mask -seek0: - pop de ; recover XDPH pointer - push bc ; save bc - inc de ; point to slice field of XDPH - ld a,(de) ; get it - ld e,a ; slice to E - ld h,65 ; number of tracks per slice - call mult8 ; HL now has track offset for slice - pop bc ; recover bc - push hl ; save track offset for now - ld hl,(@trk) ; get track value - ld a,l ; lsb of track to a - and c ; apply mask - ld d,a ; save in d -seek1: - srl h ; shift one bit out - rr l ; ... of hl - djnz seek1 ; do all bits - ld a,(@sect) ; get sector - ld e,a ; stuff it in e - ex de,hl ; de=track, hl=head/sect - ex (sp),hl ; save head/sect, hl = offset - add hl,de ; hl has final track value - pop de ; recover head/sect to de - pop bc ; recover function & unit - rst 08 ; perform seek - ;call 0FFF0H - ret ; ; multiply 8-bit values @@ -557,6 +786,103 @@ mult8_noadd: djnz mult8_loop ret +rl32: + ; Left shift DE:HL by B bits (B > 0) + or a ; clear carry + rl l ; rotate L thru carry + rl h ; rotate H thru carry + rl e ; rotate E thru carry + rl d ; rotate D thru carry + djnz rl32 ; loop B times + ret ; done + +cin$echo: ; get console input, echo it, and shift to upper case + call ?const ; check for char + or a ; set flags + jr z,cin$echo1 ; nope, continue + call ?conin ; eat extraneous char + jr cin$echo ; and loop +cin$echo1: + call ?conin ; get char + push af ; save it + ld c,a ; put in C + call ?cono ; echo + pop af ; recover it + cp 'a' ; compare + ret c ; done if carry + sub 'a' - 'A' ; make upper case + ret ; and done + +; call ?const ! ora a ! jz u$c1 ; see if any char already struck +; call ?conin ! jmp u$conin$echo ; yes, eat it and try again +;u$c1: +; call ?conin ! push psw +; mov c,a ! call ?cono +; pop psw ! cpi 'a' ! rc +; sui 'a'-'A' ; make upper case +; ret + + +err_nodisk: + ld hl,str_err_nodisk + jr err_perm +err_noslice: + ld hl,str_err_noslice + jr err_perm +err_perm: + call prt_err + jr err_ret +err_diskio: + cp -10 ; HBIOS read only error + jr z,err_rdonly ; if so, handle special + ld a,(@ermde) ; get error mode + cp 0FFh ; FFh means suppress + jr z,err_ret ; if so, go to err return + ld hl,str_err_diskio + call prt_err + ld hl,str_err_retry + call ?pmsg + call cin$echo + cp 'Y' + jr nz,err_ret ; return error to caller + ld hl,(retry$adr) ; get retry address + jp (hl) ; and go there +err_rdonly: + ld hl,str_err_rdonly + call prt_err + ld a,2 ; signal readonly media + ret +prt_err: + ld a,(@ermde) ; get error mode + cp 0FFh ; FFh means suppress + ret z ; if so, go to err return + push hl + call ?pderr + pop hl + jp ?pmsg +err_ret: + ld a,0FFh ; signal error + ret ; and done + +str_err_retry db ", Retry (Y/N)?",0 +str_err_nodisk db ", No disk",0 +str_err_noslice db ", No slice",0 +str_err_diskio db ", Disk I/O",0 +str_err_rdonly db ", Read Only",0 +str_err_prefix db 13,10,"BIOS Error: ",0 + +retry$adr dw ?wboot ; error retry address +curdph dw 0 ; working dph value +medid db 0 ; working media id value +unit db 0 ; working disk unit num +slice db 0 ; working slice num +lba dw 0,0 ; working lba +sps dw 0 ; sectors per slice +mbrsec ds 512 ; MBR sector buffer +dma dw 0 ; current DMA address +bank db 0 ; HBIOS DMA bank +func db 0 ; HBIOS function + ;rw$common: ; seek to correct track (if necessary), ; ; initialize DMA controller, ; ; and issue 1797 command. diff --git a/Source/CPM3/genbnk.dat b/Source/CPM3/genbnk.dat index 4a542bd3..4dccf1fb 100644 --- a/Source/CPM3/genbnk.dat +++ b/Source/CPM3/genbnk.dat @@ -8,12 +8,12 @@ MEMTOP = FD BNKSWT = Y COMBAS = 80 LERROR = Y -NUMSEGS = 03 -MEMSEG00 = 01,43,00 +NUMSEGS = 04 +MEMSEG00 = 01,17,00 MEMSEG01 = 0E,72,02 MEMSEG02 = 01,7F,03 MEMSEG03 = 01,7F,04 -MEMSEG04 = 00,C0,05 +MEMSEG04 = 01,7F,05 MEMSEG05 = 00,C0,06 MEMSEG06 = 00,C0,07 MEMSEG07 = 00,C0,08 @@ -57,7 +57,7 @@ ALTBNKSM = Y ALTBNKSN = Y ALTBNKSO = Y ALTBNKSP = Y -NDIRRECA = 02 +NDIRRECA = 08 NDIRRECB = 00 NDIRRECC = 00 NDIRRECD = 00 @@ -73,7 +73,7 @@ NDIRRECM = 00 NDIRRECN = 00 NDIRRECO = 00 NDIRRECP = 00 -NDTARECA = 02 +NDTARECA = 10 NDTARECB = 00 NDTARECC = 00 NDTARECD = 00 diff --git a/Source/CPM3/loader.asm b/Source/CPM3/loader.asm index ef80711d..3e770243 100644 --- a/Source/CPM3/loader.asm +++ b/Source/CPM3/loader.asm @@ -27,9 +27,13 @@ ; #INCLUDE "../ver.inc" ; +; BELOW, SYS_END MUST BE SET TO THE SIZE OF CPMLDR.BIN + SYS_LOC. IF +; THE SIZE OF CPMLDR.BIN CHANGES, SYS_SIZ MUST BE UPDATED!!! +; +SYS_SIZ .EQU $0F00 ; SIZE OF CPMLDR.BIN SYS_ENT .EQU $0100 ; SYSTEM (OS) ENTRY POINT ADDRESS SYS_LOC .EQU $0100 ; STARTING ADDRESS TO LOAD SYSTEM IMAGE -SYS_END .EQU $1480 ; ENDING ADDRESS OF SYSTEM IMAGE +SYS_END .EQU SYS_SIZ + SYS_LOC ; ENDING ADDRESS OF SYSTEM IMAGE ; SEC_SIZE .EQU 512 ; DISK SECTOR SIZE BLK_SIZE .EQU 128 ; OS BLOCK/RECORD SIZE @@ -167,11 +171,56 @@ STR_ERR .DB " Read Error!",0 ; .FILL PT_LOC - $,0 ; FILL TO START OF PARTITION TABLE ; -; RESERVE SPACE FOR STANDARD IBM-PC PARTITION TABLE. ALTHOUGH A +; STANDARD IBM-PC PARTITION TABLE. ALTHOUGH A ; PARTITION TABLE IS NOT RELEVANT FOR A FLOPPY DISK, IT DOES NO HARM. -; THE CONTENTS OF THE PARTITION TABLE MUST BE MANAGED BY FDISK80. -; -PARTTBL .FILL PT_SIZ,0 ; PARTITION TABLE, FILL WITH ZEROES +; THE CONTENTS OF THE PARTITION TABLE CAN BE MANAGED BY FDISK80. +; +; BELOW WE ALLOW FOR 32 SLICES OF ROMWBW CP/M FILESYSTEMS +; FOLLOWED BY A FAT16 PARTITION. THE SLICES FOLLOW THE ORIGINAL +; HD512 ROMWBW FORMAT. IF THE DISK IS USING HD1K, A SEPARATE +; PARTITION TABLE WILL BE IN PLACE AND RENDER THIS PARTITION TABLE +; IRRELEVANT. +; +; THE CYL/SEC FIELDS ENCODE CYLINDER AND SECTOR AS: +; CCCCCCCC:CCSSSSSS +; 76543210:98543210 +; +PART0: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) +PART1: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW %1111111111000001 ; CHS START ADDRESS (CYL/SEC) + .DB 6 ; PART TYPE ID + .DB 15 ; CHS LAST ADDRESS (HEAD) + .DW %1111111111010000 ; CHS LAST ADDRESS (CYL/SEC) + .DW $4000,$0010 ; LBA FIRST (DWORD) + .DW $0000,$000C ; LBA COUNT (DWORD) +PART2: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) +PART3: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) ; ; THE END OF THE FIRST SECTOR MUST CONTAIN THE TWO BYTE BOOT SIGNATURE. ; diff --git a/Source/CPM3/move.z80 b/Source/CPM3/move.z80 index 1b5dc067..73cc13bb 100644 --- a/Source/CPM3/move.z80 +++ b/Source/CPM3/move.z80 @@ -69,7 +69,8 @@ xbnkmov: ; 1: TPA BID_AUX 8Ch ; 2: BUFS BID_AUX-1 8Bh ; 3: BUFS BID_AUX-2 8Ah -; ... +; 4: BUFS BID_AUX-3 89h +; 5: BUFS BID_AUX-4 88h ; ; N.B., Below BID_AUX is considered RAM disk bank. Need to ; make sure RAM disk is kept small enough to stay below diff --git a/Source/CPM3/optzpm.lib b/Source/CPM3/optzpm.lib index eba22e9b..62c2499d 100644 --- a/Source/CPM3/optzpm.lib +++ b/Source/CPM3/optzpm.lib @@ -1,5 +1,4 @@ - ; global assembler options for BANKED BIOS - ; with Boot Drive swapped into Drive A + ; global assembler options for ZPM BIOS true equ -1 false equ not true diff --git a/Source/CPM3/util.z80 b/Source/CPM3/util.z80 index 28b39244..7967727d 100644 --- a/Source/CPM3/util.z80 +++ b/Source/CPM3/util.z80 @@ -1,9 +1,10 @@ title 'Utility module for RomWBW' - maclib options.lib - - public addhla, bcd2bin, bin2bcd - public phex16, phex8, cout, crlf, crlf2 + public addhla + public phex16, phex8 + public cin, cout + public crlf, crlf2 + public bcd2bin, bin2bcd cseg @@ -14,45 +15,6 @@ addhla: inc h ret -bcd2bin: - ; convert A from packed bcd to binary - push bc - ld c,a - and 0F0h - srl a - ld b,a - srl a - srl a - add a,b - ld b,a - ld a,c - and 0Fh - add a,b - pop bc - ret - -bin2bcd: - ; convert A from binary to packed bcd - push bc - ld b,10 - ld c,-1 -bin2bcd1: - inc c - sub b - jr nc,bin2bcd1 - add a,b - ld b,a - ld a,c - add a,a - add a,a - add a,a - add a,a - or b - pop bc - ret - - if 0 -; ; Print the hex word value in HL ; phex16: @@ -104,16 +66,29 @@ hexconv: daa ret ; +; input character to A +; +cin: + push bc + push de + push hl + ld bc,0080h + rst 08 + ld a,e + pop hl + pop de + pop bc + ret +; ; output character from A ; cout: - ; save all incoming registers push af push bc push de push hl ld e,a - ld bc,0100h + ld bc,0180h rst 08 pop hl pop de @@ -134,16 +109,44 @@ crlf: call cout pop af ret - - else - -phex16: -phex8: -cout: -crlf2: -crlf: - halt - - endif +; +; Convert A from packed BCD to binary +; +bcd2bin: + push bc + ld c,a + and 0F0h + srl a + ld b,a + srl a + srl a + add a,b + ld b,a + ld a,c + and 0Fh + add a,b + pop bc + ret +; +; Convert A from binary to packed BCD +; +bin2bcd: + push bc + ld b,10 + ld c,-1 +bin2bcd1: + inc c + sub b + jr nc,bin2bcd1 + add a,b + ld b,a + ld a,c + add a,a + add a,a + add a,a + add a,a + or b + pop bc + ret end diff --git a/Source/Clean.cmd b/Source/Clean.cmd index b097dc88..ebd9f7d4 100644 --- a/Source/Clean.cmd +++ b/Source/Clean.cmd @@ -1,17 +1,24 @@ @echo off setlocal -setlocal & cd Apps && call Clean.cmd & endlocal -setlocal & cd CPM22 && call Clean.cmd & endlocal -setlocal & cd ZCPR && call Clean.cmd & endlocal -setlocal & cd ZCPR-DJ && call Clean.cmd & endlocal -setlocal & cd ZSDOS && call Clean.cmd & endlocal -setlocal & cd CBIOS && call Clean.cmd & endlocal -setlocal & cd CPM3 && call Clean.cmd & endlocal -setlocal & cd ZPM3 && call Clean.cmd & endlocal -setlocal & cd Forth && call Clean.cmd & endlocal -setlocal & cd Fonts && call Clean.cmd & endlocal -setlocal & cd BPBIOS && call Clean.cmd & endlocal -setlocal & cd HBIOS && call Clean.cmd & endlocal -setlocal & cd Images && call Clean & endlocal -setlocal & cd Prop && call Clean & endlocal +pushd HDIAG && call Clean.cmd & popd +pushd Apps && call Clean.cmd & popd +pushd CPM22 && call Clean.cmd & popd +pushd ZCPR && call Clean.cmd & popd +pushd ZCPR-DJ && call Clean.cmd & popd +pushd ZSDOS && call Clean.cmd & popd +pushd CBIOS && call Clean.cmd & popd +pushd CPM3 && call Clean.cmd & popd +pushd ZPM3 && call Clean.cmd & popd +pushd pSys && call Clean.cmd & popd +pushd Forth && call Clean.cmd & popd +pushd TastyBasic && call Clean & popd +pushd Fonts && call Clean.cmd & popd +pushd BPBIOS && call Clean.cmd & popd +pushd HBIOS && call Clean.cmd & popd +pushd Images && call Clean & popd +pushd Prop && call Clean & popd +pushd RomDsk && call Clean & popd +pushd Doc && call Clean & popd +pushd ZRC && call Clean & popd +pushd ZZRC && call Clean & popd diff --git a/Source/Doc/Applications.md b/Source/Doc/Applications.md index 4a145533..8cec1c78 100644 --- a/Source/Doc/Applications.md +++ b/Source/Doc/Applications.md @@ -1,34 +1,5 @@ -!include(Common.inc) -!def(document)(Applications) ---- -title: !product !document -author: !author (mailto:!authmail) -date: !date -institution: !orgname -documentclass: article -toc: true -toc-depth: 1 -classoption: - - oneside -papersize: letter -geometry: - - top=1.5in - - bottom=1.5in - - left=1.5in - - right=1.5in -# - showframe -linestretch: 1.25 -colorlinks: true -fontfamily: helvet -fontsize: 12pt -header-includes: - - | - ```{=latex} - \renewcommand*{\familydefault}{\sfdefault} - ``` ---- - -`\clearpage % new page after TOC`{=latex} +$define{doc_title}{Applications}$ +$include{"Book.h"}$ # Summary @@ -76,7 +47,8 @@ found: | TALK | Yes | Yes | Yes | | RTC | Yes | Yes | Yes | | TIMER | Yes | Yes | Yes | -| INTTEST | Yes | Yes | Yes | +| CPUSPD | Yes | Yes | Yes | +| INTTEST | No | Yes | Yes | | FAT | No | Yes | Yes | | TUNE | No | Yes | Yes | @@ -132,7 +104,7 @@ The `ASSIGN` command supports "stacking" of instructions. For example, two slices of IDE 0 and will unassign E:. When the command runs it will echo the resultant assignments to the -console to confirm it's actions. It will also display the remaining +console to confirm its actions. It will also display the remaining space available in disk buffers. ## Notes @@ -186,7 +158,7 @@ should only be specified for hard disk devices (SD, IDE, PPIDE). Only one drive letter may be assigned to a specific device/unit/slice at a time. Attempts to assign a duplicate drive letter will fail and display an error. If you wish to assign a different drive letter to a -device/unit/slice, unassign the the existing drive letter first. +device/unit/slice, unassign the existing drive letter first. Be aware that this command will allow you to reassign or remove the assignment of your system drive letter. This can cause your operating @@ -196,6 +168,11 @@ This command is particularly sensitive to being matched to the appropriate version of the RomWBW ROM you are using. Be very careful to keep all copies of `ASSIGN.COM` up to date with your ROM. +Additionally, the `ASSIGN` command must be able to adjust to CP/M 2.2 +vs. CP/M 3. If you utilize an RSX that modifies the BDOS version +returned, you are likely to have serious problems. In this case, be +sure to use `ASSIGN` prior to loading the RSX or after it is unloaded. + ## Etymology The `ASSIGN` command is an original product and the source code is @@ -258,8 +235,8 @@ confusing that ZPM3 is in the file called CPM3.SYS, but it is normal for ZPM3. For the purposes of booting an operating system, each disk slice is -considered it's own operating system. Each slice can be made bootable -with it's own system tracks. +considered its own operating system. Each slice can be made bootable +with its own system tracks. `SYSCOPY` uses drive letters to specify where to read/write the system boot images. However, at startup, the boot loaded will require you to @@ -269,7 +246,7 @@ to a drive letter so you will know what to enter at the boot loader prompt. By way of explanation, the boot loader does not know about drive letters because the operating system is not loaded yet. -If you want to put a a boot system image on a device and slice that is +If you want to put a boot system image on a device and slice that is not currently assigned to a drive letter, you will need to assign a drive letter first. @@ -360,7 +337,7 @@ message. ## Etymology -The `SYSCOPY` command is an original product and the source code is +The `MODE` command is an original product and the source code is provided in the RomWBW distribution. `\clearpage`{=latex} @@ -489,7 +466,7 @@ control is fully functional (end to end). The `XM` application provided in RomWBW is an adaptation of a pre-existing XModem application. Based on the source code comments, it was originally adapted from Ward Christensen's MODEM2 by Keith -Petersen and is labeled version 12.5. +Petersen and is labelled version 12.5. The original source of the application was found in the Walnut Creek CD-ROM and is called XMDM125.ARK dated 7/15/86. @@ -521,15 +498,20 @@ This application is provided by Will Sowerbutts. *``* is the filename of the ROM image file -Options: (access method is auto-detected by default) +FLASH4 will auto-detect most parameters so additional options should not +normally be required. -| `/PARTIAL`: Allow flashing a large ROM from a smaller image file +Options: + +| `/V`: Enable verbose output (one line per sector) +| `/P` or `/PARTIAL`: Allow flashing a large ROM from a smaller image file | `/ROM`: Allow read-only use of unknown chip types | `/Z180DMA`: Force Z180 DMA engine | `/UNABIOS`: Force UNA BIOS bank switching | `/ROMWBW`: Force RomWBW (v2.6+) bank switching | `/ROMWBWOLD`: Force RomWBW (v2.5 and earlier) bank switching | `/P112`: Force P112 bank switching +| `/N8VEMSBC`: Force N8VEM SBC (v1, v2), Zeta (v1) SBC bank switching ## Usage @@ -547,14 +529,14 @@ manually perform a verification function with the `FLASH VERIFY` form of the command. The author's documentation for the application is found in the RomWBW -distribution in the Doc\\Contrib directory. +distribution in the Doc/Contrib directory. ## Notes The application supports a significant number of EEPROM parts. It should automatically detect your part. If it does not recognize your chip, make sure that you do not have a write protect jumper set -- -this jumper will cause the ROM chip type to be unrecognized. +this jumper can prevent the ROM chip from being recognized. Reprogramming a ROM chip in-place is inherently dangerous. If anything goes wrong, you will be left with a non-functional system and no @@ -575,12 +557,17 @@ GitHub repository](https://github.com/willsowerbutts/flash4). # FDISK80 -RomWBW supports disk media with MS-DOS FAT filesystems (see FAT -application). If you wish to put a FAT filesystem on your media, the -FDISK80 application can be used to partition your media which is -required in order to add a FAT filesystem. +`FDISK80` allows you to create and manage traditional partitions on +your hard disk media. Depending on the hard disk format and features +you are using, RomWBW may need hard disk partitions defined. + +Please refer to the $doc_user$ for more information on the use of +partitions within RomWBW. It is very important to understand that +RomWBW slices are completely different from disk partitions. -This application is provided by John Coffman. +This application is provided by John Coffman. The primary +documentation is in the file "FDisk Manual.pdf" found in the +Doc directory of the RomWBW distribution. ## Usage @@ -595,20 +582,15 @@ applications. Please refer to the file called "FDisk Manual.pdf" in the Doc directory of the RomWBW distribution for further instructions. There is also more information on using FAT partitions with RomWBW in -the "RomWBW Getting Started.pdf" document in the Doc directory of the -distribution. +the $doc_user$ document in the Doc directory of the distribution. ## Notes -Partitioning of RomWBW media is **only** required if you want to add a -FAT filesystem to your media. Do not partition your media if you are -simply using it for RomWBW. To be clear, RomWBW slices do not require -partitioning. - -As described in "RomWBW Getting Started.pdf", you should be careful -when adding a FAT partition to your media that the partition does not -overlap with the area of the media being used for RomWBW slices. The -"(R)eserve" function in `FDISK80` can help prevent this. +Hard disk partition tables allow a maximum of 1024 cylinders when +defining partitions. However, RomWBW uses exclusively Logical Block +Addressing (LBA) which does not have this limitation. When defining +partitions is usually best to define the start and size of of the +partition using bytes or sectors. ## Etymology @@ -679,7 +661,7 @@ After startup, the application provides the following options: | `R)aw` | will read the minute/second of the RTC clock iteratively every time the space key is pressed. Press enter to end. | | `L)oop` | will read the full date/time of the RTC clock iteratively every time the space key is pressed. Press enter to end. | | `C)harge` | will enable the battery charging function of the RTC. | -| `N)ocharge` | will disable the battery charging functino of the RTC. | +| `N)ocharge` | will disable the battery charging function of the RTC. | | `D)elay` | allows you to test the built-in timing delay in the program. It is not unusual for it to be wrong. | | `I)nit` | allows you to enter a date/time value for subsequent programming of the RTC using the S)et option. | | `G)et` | allows you to read the value of a non-volatile register in the RTC. | @@ -701,7 +683,7 @@ bypassing HBIOS. ## Etymology -The `RTC` application was originally written by Andrew Lync as part of +The `RTC` application was originally written by Andrew Lynch as part of the original ECB SBC board development. It has since been modified to support most of the hardware variations included with RomWBW. @@ -940,7 +922,7 @@ for the hardware found. If no hardware is detected, it will abort with an error message. On Z180 systems, I/O wait states are added when writing to the sound -chip to avoid exceeding it's speed limitations. On Z80 systems, you +chip to avoid exceeding its speed limitations. On Z80 systems, you will need to ensure that the CPU clock speed of your system does not exceed the timing limitations of your sound chip. @@ -949,6 +931,24 @@ accurately pace the sound file output. If no system timer is available, a delay loop is calculated instead. The delay loop will not be as accurate as the system timer. +There are two modes of operations. A direct hardware interface for the +AY-3-8910 or YM2149 chips, or a compatibility layer thru HBIOS supporting +the SN76489 chip. + +By default the application will attempt to interface directly to the sound +chip. The optional argument `--hbios` supplied after the filename, will +enable the application to use the HBIOS sound driver. + +The HBIOS mode also support other switch as described below. + +| Switch | Description | +| ----------- | ------------------------------------------------------ | +| `--hbios` | Utilise HBIOS' sound driver | +| `+t1` | Play tune an octave higher | +| `+t2` | Play tune two octaves higher | +| `-t1` | Play tune an octave lower | +| `-t2` | Play tune two octaves lower | + All RomWBW operating system boot disks include a selection of sound files in user area 3. @@ -960,4 +960,71 @@ software was adapted and embedded from pre-existing sources. The YM player code is from MYMPLAY 0.4 by Lieves!Tuore and the PT player code is (c)2004-2007 S.V.Bulba . -The source code is provided in the RomWBW distribution. \ No newline at end of file +The source code is provided in the RomWBW distribution. + +# CPUSPD + +The `CPUSPD` application is used to change the running speed and wait +states of a RomWBW system. + + The functionality is highly dependent on +the capabilities of your system. + +At present, all Z180 systems can change their CPU speed and their +wait states. SBC and MBC systems may be able to change their CPU +speed if the hardware supports it and it is enabled in the HBIOS +configuration. + +## Syntax + +| `CPUSPD [`*``*`[,[`*``*`][,[`*``*`]]]` + +*``* is one of HALF, FULL, or DOUBLE. +*``* is a number specifying the desired memory wait states. +*``* is a number specifying the desired I/O wait states. + +## Usage + +Entering `CPUSPD` with no parameters will display the current CPU speed +and wait state information of the running system. Wait state +information is not available for all systems. + +To modify the running speed of a system, you can specify the +`*``*` parameter. To modify either or both of the wait +states, you can enter the desired number. Either or both of the wait +state parameters may be omitted and the current wait state settings +will remain in effect. + +## Notes + +The ability to modify the running speed and wait states of a system +varies widely depending on the hardware capabilities and the HBIOS +configuration settings. + +Note that it is frequently impossible to tell if a system is capable +of dynamic speed changes. This function makes the changes blindly. +If an attempt is made to change the speed of a system +that is definitely incapable of doing so, then an error result is +returned. + +The `CPUSPD` command makes no attempt to ensure that the new CPU +speed will actually work on the current hardware. Setting a CPU +speed that exceeds the capabilities of the system will result in +unstable operation or a system stall. + +Some peripherals are dependent on the CPU speed. For example, the Z180 +ASCI baud rate and system timer are derived from the CPU speed. The +CPUSPD application will attempt to adjust these peripherals for +correct operation after modifying the CPU speed. However, in some +cases this may not be possible. The baud rate of ASCI ports have a +limited set of divisors. If there is no satisfactory divisor to +retain the existing baud rate under the new CPU speed, then the baud +rate of the ASCI port(s) will be affected. + +## Etymology + +The `CPUSPD` application was custom written for RomWBW. All of the +hardware interface code is specific to RomWBW and the application will +not operate correctly on non-RomWBW systems. + +The source code is provided in the RomWBW distribution. diff --git a/Source/Doc/Architecture.md b/Source/Doc/Architecture.md deleted file mode 100644 index 90d531ba..00000000 --- a/Source/Doc/Architecture.md +++ /dev/null @@ -1,1723 +0,0 @@ -!include(Common.inc) -!def(document)(Architecture) ---- -title: | - | !product - | - | !document -author: !author (mailto:!authmail) -date: !date -institution: !orgname -documentclass: book -classoption: -- oneside -toc: true -toc-depth: 1 -numbersections: true -secnumdepth: 1 -papersize: letter -geometry: -- top=1.5in -- bottom=1.5in -- left=1.5in -- right=1.5in -# - showframe -# - pass -linestretch: 1.25 -colorlinks: true -fontfamily: helvet -fontsize: 12pt -header-includes: -- \setlength{\headheight}{15pt} -- | - ```{=latex} - \usepackage{fancyhdr} - \usepackage{xcolor} - \usepackage{xhfill} - \renewcommand*{\familydefault}{\sfdefault} - \renewcommand{\maketitle}{ - \begin{titlepage} - \centering - \par - \vspace*{0pt} - \includegraphics[width=\paperwidth]{Graphics/Logo.pdf} \par - \vfill - \raggedleft - {\scshape \bfseries \fontsize{48pt}{56pt} \selectfont !product \par} - {\bfseries \fontsize{32pt}{36pt} \selectfont !document \par} - \vspace{24pt} - {\huge Version !ver \\ !date \par} - \vspace{24pt} - {\large \itshape !orgname \\ \href{http://!orgurl}{!orgurl} \par} - \vspace{12pt} - {\large \itshape !author \\ \href{mailto:authmail}{!authmail} \par} - \end{titlepage} - } - \pagestyle{empty} - ``` -include-before: -- \renewcommand{\chaptername}{Section} -- | - ```{=latex} - \pagestyle{fancyplain} - \fancyhf{} - \lfoot{\small RetroBrew Computing Group ~~ {\xrfill[3pt]{1pt}[cyan]} ~~ \thepage} - \pagenumbering{roman} - ``` ---- - -```{=latex} -\clearpage -\pagenumbering{arabic} -\lhead{\fancyplain{}{\nouppercase{\footnotesize \bfseries \leftmark \hfill !product !document}}} -``` - -Overview -======== - -RomWBW provides a complete firmware package for all of the Z80 and Z180 -based systems that are available in the RetroBrew Computers Community -(see -[http://www.retrobrewcomputers.org](http://www.retrobrewcomputers.org/)) -as well as support for the RC2014 platform. Each of these systems -provides for a fairly large ROM memory (typically, 512KB or more). -RomWBW allows you to configure and build appropriate contents for such a -ROM. - -Typically, a computer will contain a small ROM that contains the BIOS -(Basic Input/Output System) functions as well as code to start the -system by booting an operating system from a disk. Since the RetroBrew -Computers Projects provide a large ROM space, RomWBW provides a much -more comprehensive software package. In fact, it is entirely possible to -run a fully functioning RetroBrew Computers System with nothing but the -ROM. - -RomWBW firmware includes: - -* System startup code (bootstrap) - -* A basic system/debug monitor - -* HBIOS (Hardware BIOS) providing support for the vast majority of -RetroBrew Computers I/O components - -* A complete operating system (either CP/M 2.2 or ZSDOS 1.1) - -* A built-in CP/M filesystem containing the basic applications and -utilities for the operating system and hardware being used - -It is appropriate to note that much of the code and components that make -up a complete RomWBW package are derived from pre-existing work. Most -notably, the embedded operating system is simply a ROM-based copy of -generic CP/M or ZSDOS. Much of the hardware support code was originally -produced by other members of the RetroBrew Computers Community. - -The remainder of this document will focus on the HBIOS portion of the -ROM. HBIOS contains the vast majority of the custom-developed code for -the RetroBrew Computers hardware platforms. It provides a formal, -structured interface that allows the operating system to be hosted with -relative ease. - -Background -========== - -The Z80 CPU architecture has a limited, 64K address range. In general, -this address space must accommodate a running application, disk -operating system, and hardware support code. - -All RetroBrew Computers Z80 CPU platforms provide a physical address -space that is much larger than the CPU address space (typically 512K or -1MB physical RAM). This additional memory can be made available to the -CPU using a technique called bank switching. To achieve this, the -physical memory is divided up into chunks (banks) of 32K each. A -designated area of the CPU's 64K address space is then reserved to "map" -any of the physical memory chunks. You can think of this as a window -that can be adjusted to view portions of the physical memory in 32K -blocks. In the case of RetroBrew Computers platforms, the lower 32K of -the CPU address space is used for this purpose (the window). The upper -32K of CPU address space is assigned a fixed 32K area of physical memory -that never changes. The lower 32K can be "mapped" on the fly to any of -the 32K banks of physical memory at a time. The only constraint is that -the CPU cannot be executing code in the lower 32K of CPU address space -at the time that a bank switch is performed. - -By cleverly utilizing the pages of physical RAM for specific purposes -and swapping in the correct page when needed, it is possible to utilize -substantially more than 64K of RAM. Because the RetroBrew Computers -Project has now produced a very large variety of hardware, it has become -extremely important to implement a bank switched solution to accommodate -the maximum range of hardware devices and desired functionality. - -General Design Strategy -======================= - -The design goal is to locate as much of the hardware dependent code as -possible out of normal 64KB CP/M address space and into a bank switched -area of memory. A very small code shim (proxy) is located in the top 512 -bytes of CPU memory. This proxy is responsible for redirecting all -hardware BIOS (HBIOS) calls by swapping the "driver code" bank of -physical RAM into the lower 32K and completing the request. The -operating system is unaware this has occurred. As control is returned to -the operating system, the lower 32KB of memory is switched back to the -original memory bank. - -HBIOS is completely agnostic with respect to the operating system (it -does not know or care what operating system is using it). The operating -system makes simple calls to HBIOS to access any desired hardware -functions. Since the HBIOS proxy occupies only 512 bytes at the top of -memory, the vast majority of the CPU memory is available to the -operating system and the running application. As far as the operating -system is concerned, all of the hardware driver code has been magically -implemented inside of a small 512 byte area at the top of the CPU -address space. - -Unlike some other Z80 bank switching schemes, there is no attempt to -build bank switching into the operating system itself. This is -intentional so as to ensure that any operating system can easily be -adapted without requiring invasive modifications to the operating system -itself. This also keeps the complexity of memory management completely -away from the operating system and applications. - -There are some operating systems that have built-in support for bank -switching (e.g., CP/M 3). These operating systems are allowed to make -use of the bank switched memory and are compatible with HBIOS. However, -it is necessary that the customization of these operating systems take -into account the banks of memory used by HBIOS and not attempt to use -those specific banks. - -Note that all code and data are located in RAM memory during normal -execution. While it is possible to use ROM memory to run code, it would -require that more upper memory be reserved for data storage. It is -simpler and more memory efficient to keep everything in RAM. At startup -(boot) all required code is copied to RAM for subsequent execution. - -Runtime Memory Layout -===================== - -![Banked Switched Memory Layout](Graphics/Bank Switched Memory){ width=80% } - -System Boot Process -=================== - -A multi-phase boot strategy is employed. This is necessary because at -cold start, the CPU is executing code from ROM in lower memory which is -the same area that is bank switched. - -Boot Phase 1 copies the phase 2 code to upper memory and jumps to it to -continue the boot process. This is required because the CPU starts at -address \$0000 in low memory. However, low memory is used as the area -for switching ROM/RAM banks in and out. Therefore, it is necessary to -relocate execution to high memory in order to initialize the RAM memory -banks. - -Boot Phase 2 manages the setup of the RAM page banks for HBIOS -operation, performs hardware initialization, and then executes the boot -loader. - -Boot Phase 3 is the loading of the selecting operating system (or debug -monitor) by the Boot Loader. The Boot Loader is responsible for -prompting the user to select a target operating system to load, loading -it into RAM, then transferring control to it. The Boot Loader is capable -of loading a target operating system from a variety of locations -including disk drives and ROM. - -Note that the entire boot process is entirely operating system agnostic. -It is unaware of the operating system being loaded. The Boot Loader -prompts the user for the location of the binary image to load, but does -not know anything about what is being loaded (the image is usually an -operating system, but could be any executable code image). Once the Boot -Loader has loaded the image at the selected location, it will transfer -control to it. Assuming the typical situation where the image was an -operating system, the loaded operating system will then perform it's own -initialization and begin normal operation. - -There are actually two ways to perform a system boot. The first, and -most commonly used, method is a "ROM Boot". This refers to booting the -system directly from the startup code contained on the physical ROM -chip. A ROM Boot is always performed upon power up or when a hardware -reset is performed. - -Once the system is running (operating system loaded), it is possible to -reboot the system from a system image contained on the file system. This -is referred to as an "Application Boot". This mechanism allows a -temporary copy of the system to be uploaded and stored on the file -system of an already running system and then used to boot the system. -This boot technique is useful to: 1) test a new build of a system image -before programming it to the ROM; or 2) easily switch between system -images on the fly. - -A more detailed explanation of these two boot processes is presented -below. - -ROM Boot --------- - -At power on (or hardware reset), ROM page 0 is automatically mapped to -lower memory by hardware level system initialization. Page Zero (first -256 bytes of the CPU address space) is reserved to contain dispatching -instructions for interrupt instructions. Address \$0000 performs a jump -to the start of the phase 1 code so that this first page can be -reserved. - -The phase 1 code now copies the phase 2 code from lower memory to upper -memory and jumps to it. The phase 2 code now initializes the HBIOS by -copying the ROM resident HBIOS from ROM to RAM. It subsequently calls -the HBIOS initialization routine. Finally, it starts the Boot Loader -which prompts the user for the location of the target system image to -execute. - -Once the boot loader transfers control to the target system image, all -of the Phase 1, Phase 2, and Boot Loader code is abandoned and the space -it occupied is normally overwritten by the operating system. - -Application Boot ----------------- - -When a new system image is built, one of the output files produced is an -actual CP/M application (an executable .COM program file). Once you have -a running CP/M (or compatible) system, you can upload/copy this -application file to the filesystem. By executing this file, you will -initiate an Application Boot using the system image contained in the -application file itself. - -Upon execution, the Application Boot program is loaded into memory by -the previously running operating system starting at \$0100. Note that -program image contains a copy of the HBIOS to be installed and run. Once -the Application Boot program is loaded by the previous operating system, -control is passed to it and it performs a system initialization similar -to the ROM Boot, but using the image loaded in RAM. - -Specifically, the code at \$0100 (in low memory) copies phase 2 boot -code to upper memory and transfers control to it. The phase 2 boot code -copies the HBIOS image from application RAM to RAM, then calls the HBIOS -initialization routine. At this point, the prior HBIOS code has been -discarded and overwritten. Finally, the Boot Loader is invoked just like -a ROM Boot. - -Notes ------ - -1. Size of ROM disk and RAM disk will be decreased as needed to -accommodate RAM and ROM memory bank usage for the banked BIOS. - -2. There is no support for interrupt driven drivers at this time. Such -support should be possible in a variety of ways, but none are yet -implemented. - -Driver Model -============ - -The framework code for bank switching also allows hardware drivers to be -implemented mostly without concern for memory management. Drivers are -coded to simply implement the HBIOS functions appropriate for the type -of hardware being supported. When the driver code gets control, it has -already been mapped to the CPU address space and simply performs the -requested function based on parameters passed in registers. Upon return, -the bank switching framework takes care of restoring the original memory -layout expected by the operating system and application. - -However, the one constraint of hardware drivers is that any data buffers -that are to be returned to the operating system or applications must be -allocated in high memory. Buffers inside of the driver's memory bank -will be swapped out of the CPU address space when control is returned to -the operating system. - -If the driver code must make calls to other code, drivers, or utilities -in the driver bank, it must make those calls directly (it must not use -RST 08). This is to avoid a nested bank switch which is not supported at -this time. - -Character / Emulation / Video Services -====================================== - -In addition to a generic set of routines to handle typical character -input/output, HBIOS also includes functionality for managing built-in -video display adapters. To start with there is a basic set of character -input/output functions, the CIOXXX functions, which allow for simple -character data streams. These functions fully encompass routing byte -stream data to/from serial ports. Note that there is a special character -pseudo-device called "CRT". When characters are read/written to/from the -CRT character device, the data is actually passed to a built-in terminal -emulator which, in turn, utilizes a set of VDA (Video Display Adapter) -functions (such as cursor positioning, scrolling, etc.). - -Figure 7.1 depicts the relationship between these components -of HBIOS video processing: - -![Character / Emulation / Video Services](Graphics/Character Emulation Video Services){ width=100% } - -Normally, the operating system will simply utilize the CIOXXX functions -to send and receive character data. The Character I/O Services will -route I/O requests to the specified physical device which is most -frequently a serial port (such as UART or ASCI). As shown above, if the -CRT device is targeted by a CIOXXX function, it will actually be routed -to the Emulation Services which implement TTY, ANSI, etc. escape -sequences. The Emulation Services subsequently rely on the Video Display -Adapter Services as an additional layer of abstraction. This allows the -emulation code to be completely unaware of the actual physical device -(device independent). Video Display Adapter (VDA) Services contains -drivers as needed to handle the available physical video adapters. - -Note that the Emulation and VDA Services API functions are available to -be called directly. Doing so must be done carefully so as to not corrupt -the "state" of the emulation logic. - -Before invoking CIOXXX functions targeting the CRT device, it is -necessary that the underlying layers (Emulation and VDA) be properly -initialized. The Emulation Services must be initialized to specify the -desired emulation and specific physical VDA device to target. Likewise, -the VDA Services may need to be initialized to put the specific video -hardware into the proper mode, etc. - -HBIOS Reference -=============== - -Invocation ----------- - -HBIOS functions are invoked by placing the required parameters in CPU -registers and executing an RST 08 instruction. Note that HBIOS does not -preserve register values that are unused. However, it will not modify the -Z80 alternate registers or IX/IY (these registers may be used within HBIOS, -but will be saved and restored internally). - -Normally, applications will not call HBIOS functions directly. It is -intended that the operating system makes all HBIOS function calls. -Applications that are considered system utilities may use HBIOS, but must -be careful not to modify the operating environment in any way that the -operating system does not expect. - -In general, the desired function is placed in the B register. Register C is -frequently used to specify a subfunction or a target device unit number. -Additional registers are used as defined by the specific function. Register -A should be used to return function result information. A=0 should -indicate success, other values are function specific. - -The character, disk, and video device functions all refer to target devices -using a logical device unit number that is passed in the C register. Keep -in mind that these unit numbers are assigned dynamically at HBIOS -initialization during the device discovery process. The assigned unit -numbers are displayed on the consoled at the conclusion of device -initialization. The unit assignments will never change after HBIOS -initialization. However, they can change at the next boot if there have -been hardware or BIOS customization changes. Code using HBIOS functions -should not assume fixed unit assignments. - -Some functions utilize pointers to memory buffers. Unless otherwise stated, -such buffers can be located anywhere in the Z80 CPU 64K address space. -However, performance sensitive buffers (primarily disk I/O buffers) will -require double-buffering if the caller’s buffer is in the lower 32K of CPU -address space. For optimal performance, such buffers should be placed in -the upper 32K of CPU address space. - -`\clearpage`{=latex} - -Character Input/Output (CIO) ----------------------------- - -Character input/output functions require that a Character Unit be specified -in the C register. This is the logical device unit number assigned during -the boot process that identifies all character I/O devices uniquely. A -special value of 0x80 can be used for Unit to refer to the current console -device. - -Character devices can usually be configured with line characteristics -such as speed, framing, etc. A word value (16 bit) is used to describe -the line characteristics as indicated below: - -_Bits_ | _Function_ ------- | ---------- -15-14 | Reserved (set to 0) -13 | RTS -12-8 | Baud Rate (see below) -7 | DTR -6 | XON/XOFF Flow Control -5-3 | Parity (???) -2 | Stop Bits (???) -1-0 | Data Bits (???) - -The 5-bit baud rate value (V) is encoded as V = 75 \* 2\^X \* 3\^Y. The -bits are defined as YXXXX. - -### Function 0x00 -- Character Input (CIOIN) - -| _Entry Parameters_ -| B: 0x00 -| C: Serial Device Unit Number - -| _Exit Results_ -| A: Status (0=OK, else error) -| E: Character Received - -Read a character from the device unit specified in register C and return -the character value in E. If no character(s) are available, this function -will wait indefinitely. - -### Function 0x01 -- Character Output (CIOOUT) - -| _Entry Parameters_ -| B: 0x01 -| C: Serial Device Unit Number -| E: Character to Send - -| _Exit Results_ -| A: Status (0=OK, else error) - -Send character value in register E to device specified in register C. If -device is not ready to send, function will wait indefinitely. - -### Function 0x02 -- Character Input Status (CIOIST) - -| _Entry Parameters_ -| B: 0x02 -| C: Serial Device Unit Number - -| _Exit Results_ -| A: Bytes Pending - -Return the number of characters available to read in the input buffer of -the unit specified. If the device has no input buffer, it is acceptable to -return simply 0 or 1 where 0 means there is no character available to read -and 1 means there is at least one character available to read. - -### Function 0x03 -- Character Output Status (CIOOST) - -| _Entry Parameters_ -| B: 0x03 -| C: Serial Device Unit Number - -| _Exit Results_ -| A: Output Buffer Bytes Available - -Return the space available in the output buffer expressed as a character -count. If a 16 byte output buffer contained 6 characters waiting to be -sent, this function would return 10, the number of positions available in -the output buffer. If the port has no output buffer, it is acceptable to -return simply 0 or 1 where 0 means the port is busy and 1 means the port is -ready to output a character. - -### Function 0x04 -- Character IO Initialization (CIOINIT) - -| _Entry Parameters_ -| B: 0x04 -| C: Serial Device Unit Number -| DE: Line Characteristics - -| _Exit Results_ -| A: Status (0=OK, else error) - -Setup line characteristics (baudrate, framing, etc.) of the specified unit. -Register pair DE specifies line characteristics. If DE contains -1 -(0xFFFF), then the device will be reinitialized with the last line -characteristics used. Result of function is returned in A with zero -indicating success. - -### Function 0x05 -- Character IO Query (CIOQUERY) - -| _Entry Parameters_ -| B: 0x05 -| C: Serial Device Unit Number - -| _Exit Results_ -| A: Status (0=OK, else error) -| DE: Line Characteristics - -Reports the line characteristics (baudrate, framing, etc.) of the specified -unit. Register pair DE contains the line characteristics upon return. - -### Function 0x06 -- Character IO Device (CIODEVICE) - -| _Entry Parameters_ -| B: 0x06 -| C: Serial Device Unit Number - -| _Exit Results_ -| A: Status (0=OK, else error) -| C: Serial Device Attributes -| D: Serial Device Type -| E: Serial Device Number - -Reports information about the character device unit specified. Register C -indicates the device attributes: 0=RS-232 and 1=Terminal. Register D -indicates the device type (driver) and register E indicates the physical -device number assigned by the driver. - -Each character device is handled by an appropriate driver (UART, ASCI, -etc.). The driver can be identified by the Device Type. The assigned Device -Types are listed below. - -_Id_ | _Device Type / Driver_ ----- | ---------------------- -0x00 | UART -0x10 | ASCI -0x20 | Terminal -0x30 | PropIO VGA -0x40 | ParPortProp VGA -0x50 | SIO -0x60 | ACIA -0x70 | PIO -0x80 | UF - -`\clearpage`{=latex} - -Disk Input/Output (DIO) ------------------------ - -Character input/output functions require that a character unit be specified -in the C register. This is the logical disk unit number assigned during -the boot process that identifies all disk i/o devices uniquely. - -A fixed set of media types are defined. The currently defined media types -are listed below. Each driver will support a subset of the defined media -types. - -**Media ID** | **Value** | **Format** ------------- | --------- | ---------- -MID\_NONE | 0 | No media installed -MID\_MDROM | 1 | ROM Drive -MID\_MDRAM | 2 | RAM Drive -MID\_RF | 3 | RAM Floppy (LBA) -MID\_HD | 4 | Hard Disk (LBA) -MID\_FD720 | 5 | 3.5" 720K Floppy -MID\_FD144 | 6 | 3.5" 1.44M Floppy -MID\_FD360 | 7 | 5.25" 360K Floppy -MID\_FD120 | 8 | 5.25" 1.2M Floppy -MID\_FD111 | 9 | 8" 1.11M Floppy - -### Function 0x10 -- Disk Status (DIOSTATUS) - -| _Entry Parameters_ -| B: 0x10 - -| _Exit Results_ -| A: Status (0=OK, else error) - -### Function 0x11 -- Disk Status (DIORESET) - -| _Entry Parameters_ -| B: 0x11 -| C: Disk Device Unit ID - -| _Exit Results_ -| A: Status (0=OK, else error) - -Reset the physical interface associated with the specified unit. Flag -all units associated with the interface for unit initialization at next -I/O call. Clear media identified unless locked. Reset result code of all -associated units of the physical interface. - -### Function 0x12 -- Disk Seek (DIOSEEK) - -| _Entry Parameters_ -| B: 0x12 -| C: Disk Device Unit ID -| D7: Address Type (0=CHS, 1=LBA) - -| if CHS: -| D6-0: Head -| E: Sector -| HL: Track - -| if LBA: -| DE:HL: Block Address - -| _Exit Results_ -| A: Status (0=OK, else error) - -Update target CHS or LBA for next I/O request on designated unit. Physical -seek is typically deferred until subsequent I/O operation. - -Bit 7 of D indicates whether the disk seek address is specified as -cylinder/head/sector (CHS) or Logical Block Address (LBA). If D:7=1, then -the remaining bits of of the 32 bit register set DE:HL specify a linear, -zero offset, block number. If D:7=0, then the remaining bits of D specify -the head, E specifies sector, and HL specifies track. - -Note that not all devices will accept both types of addresses. -Specifically, floppy disk devices must have CHS addresses. All other -devices will accept either CHS or LBA. The DIOGEOM function can be used to -determine if the device supports LBA addressing. - -### Function 0x13 -- Disk Read (DIOREAD) - -| _Entry Parameters_ -| B: 0x13 -| C: Disk Device Unit ID -| E: Block Count -| HL: Buffer Address - -| _Exit Results_ -| A: Status (0=OK, else error) -| E: Blocks Read - -Read Block Count sectors to buffer address starting at current target -sector. Current sector must be established by prior seek function; however, -multiple read/write/verify function calls can be made after a seek -function. Current sector is incremented after each sector successfully -read. On error, current sector is sector is sector where error occurred. -Blocks read indicates number of sectors successfully read. - -Caller must ensure: 1) buffer address is large enough to contain data for -all sectors requested, and 2) entire buffer area resides in upper 32K of -memory. - -### Function 0x14 -- Disk Write (DIOWRITE) - -| _Entry Parameters_ -| B: 0x14 -| C: Disk Device Unit ID -| E: Block Count -| HL: Buffer Address - -| _Exit Results_ -| A: Status (0=OK, else error) -| E: Blocks Written - -Write Block Count sectors to buffer address starting at current target -sector. Current sector must be established by prior seek function; however, -multiple read/write/verify function calls can be made after a seek -function. Current sector is incremented after each sector successfully -written. On error, current sector is sector is sector where error occurred. -Blocks written indicates number of sectors successfully written. - -Caller must ensure: 1) buffer address is large enough to contain data for -all sectors being written, and 2) entire buffer area resides in upper 32K -of memory. - -### Function 0x15 -- Disk Verify (DIOVERIFY) - -| _Entry Parameters_ -| B: 0x15 -| C: Disk Device Unit ID -| HL: Buffer Address -| E: Block Count - -| _Exit Results_ -| A: Status (0=OK, else error) -| E: Blocks Verified - -\*\*\*Not Implemented\*\*\* - -### Function 0x16 -- Disk Format (DIOFORMAT) - -| _Entry Parameters_ -| B: 0x16 -| C: Disk Device Unit ID -| D: Head -| E: Fill Byte -| HL: Cylinder - -| _Exit Results_ -| A: Status (0=OK, else error) - -\*\*\*Not Implemented\*\*\* - -### Function 0x17 -- Disk DEVICE (DIODEVICE) - -| _Entry Parameters_ -| B: 0x17 -| C: Disk Device Unit ID - -| _Exit Results_ -| A: Status (0=OK, else error) -| C: Attributes -| D: Device Type -| E: Device Number - -Reports information about the character device unit specified. Register D -indicates the device type (driver) and register E indicates the physical -device number assigned by the driver. - -Register C reports the following device attributes: - -Bit 7: 1=Floppy, 0=Hard Disk (or similar, e.g. CF, SD, RAM) - -| If Floppy: -| Bits 6-5: Form Factor (0=8", 1=5.25", 2=3.5", 3=Other) -| Bit 4: Sides (0=SS, 1=DS) -| Bits 3-2: Density (0=SD, 1=DD, 2=HD, 3=ED) -| Bits 1-0: Reserved - -| If Hard Disk: -| Bit 6: Removable\ -| Bits: 5-3: Type (0=Hard, 1=CF, 2=SD, 3=USB, -| 4=ROM, 5=RAM, 6=RAMF, 7=Reserved) -| Bits 2-0: Reserved - -Each disk device is handled by an appropriate driver (IDE, SD, -etc.) which is identified by a device type id from the table below. - -**Type ID** | **Disk Device Type** ------------ | -------------------- -0x00 | Memory Disk -0x10 | Floppy Disk -0x20 | RAM Floppy -0x30 | IDE Disk -0x40 | ATAPI Disk (not implemented) -0x50 | PPIDE Disk -0x60 | SD Card -0x70 | PropIO SD Card -0x80 | ParPortProp SD Card -0x90 | SIMH HDSK Disk - -### Function 0x18 -- Disk Media (DIOMEDIA) - -| _Entry Parameters_ -| B: 0x18 -| C: Disk Device Unit ID -| E0: Enable Media Discovery - -| _Exit Results_ -| A: Status (0=OK, else error) -| E: Media ID - -Report the media definition for media in specified unit. If bit 0 of E is -set, then perform media discovery or verification. If no media in device, -function will return an error status. - -### Function 0x19 -- Disk Define Media (DIODEFMED) - -| _Entry Parameters_ -| B: 0x19 -| C: Disk Device Unit ID -| E: Media ID - -| _Exit Results_ -| A: Status (0=OK, else error) - -\*\*\* Not implemented \*\*\* - -### Function 0x1A -- Disk Capacity (DIOCAPACITY) - -| _Entry Parameters_ -| B: 0x1A -| C: Disk Device Unit ID -| HL: Buffer Address - -| _Exit Results_ -| A: Status (0=OK, else error) -| DE:HL: Blocks on Device -| BC: Block Size - -Report current media capacity information. DE:HL is a 32 bit number -representing the total number of blocks on the device. BC contains the -block size. If media is unknown, an error will be returned. - -### Function 0x1B -- Disk Geometry (DIOGEOMETRY) - -| _Entry Parameters_ -| B: 0x1B -| C: Disk Device Unit ID - -| _Exit Results_ -| A: Status (0=OK, else error) -| HL: Cylinders -| D7: LBA Capability -| BC: Block Size - -Report current media geometry information. If media is unknown, return -error (no media). - -`\clearpage`{=latex} - -Real Time Clock (RTC) ---------------------- - -The Real Time Clock functions provide read/write access to the clock and -related Non-Volatile RAM. - -The time functions (RTCGTM and RTCSTM) require a 6 byte date/time buffer -of the following format. Each byte is BCD encoded. - -**Offset** | **Contents** ----------- | ------------ -0 | Year (00-99) -1 | Month (01-12) -2 | Date (01-31) -3 | Hours (00-24) -4 | Minutes (00-59) -5 | Seconds (00-59) - -### Function 0x20 -- RTC Get Time (RTCGETTIM) - -| _Entry Parameters_ -| B: 0x20 -| HL: Time Buffer Address - -| _Exit Results_ -| A: Status (0=OK, else error) - -Read the current value of the clock and store the date/time in the -buffer pointed to by HL. - -### Function 0x21 -- RTC Set Time (RTCSETTIM) - -| _Entry Parameters_ -| B: 0x21 -| HL: Time Buffer Address - -| _Exit Results_ -| A: Status (0=OK, else error) - -Set the current value of the clock based on the date/time in the buffer -pointed to by HL. - -### Function 0x22 -- RTC Get NVRAM Byte (RTCGETBYT) - -| _Entry Parameters_ -| B: 0x22 -| C: Index - -| _Exit Results_ -| A: Status (0=OK, else error) -| E: Value - -Read a single byte value from the Non-Volatile RAM at the index specified -by C. The value is returned in register E. - -### Function 0x23 -- RTC Set NVRAM Byte (RTCSETBYT) - -| _Entry Parameters_ -| B: 0x23 -| C: Index - -| _Exit Results_ -| A: Status (0=OK, else error) -| E: Value - -Write a single byte value into the Non-Volatile RAM at the index specified -by C. The value to be written is specified in E. - -### Function 0x24 -- RTC Get NVRAM Block (RTCGETBLK) - -| _Entry Parameters_ -| B: 0x24 -| HL: Buffer - -| _Exit Results_ -| A: Status (0=OK, else error) - -Read the entire contents of the Non-Volatile RAM into the buffer pointed -to by HL. HL must point to a location in the top 32K of CPU address space. - -### Function 0x25 -- RTC Set NVRAM Block (RTCSETBLK) - -| _Entry Parameters_ -| B: 0x25 -| HL: Buffer - -| _Exit Results_ -| A: Status (0=OK, else error) - -Write the entire contents of the Non-Volatile RAM from the buffer pointed -to by HL. HL must point to a location in the top 32K of CPU address space. - -`\clearpage`{=latex} - -Video Display Adapter (VDA) ---------------------------- - -The VDA functions are provided as a common interface to Video Display -Adapters. Not all VDAs will include keyboard hardware. In this case, the -keyboard functions should return a failure status. - -Depending on the capabilities of the hardware, the use of colors and -attributes may or may not be supported. If the hardware does not support -these capabilities, they will be ignored. - -Color byte values are constructed using typical RGBI -(Red/Green/Blue/Intensity) bits. The high four bits of the value determine -the background color and the low four bits determine the foreground color. -This results in 16 unique color values for both foreground and background. -The following table illustrates the color byte value construction: - -  | **Bit** | **Color** ----------- | ------- | --------- -Background | 7 | Intensity -  | 6 | Blue -  | 5 | Green -  | 4 | Red -Foreground | 3 | Intensity -  | 2 | Blue -  | 1 | Green -  | 0 | Red - -The following table illustrates the resultant color for each of the -possible 16 values for foreground or background: - -**Foreground** | **Background** | **Color** ------------------- | ------------------ | ---------------- -\_0 \_\_\_\_0000 | 0\_ 0000\_\_\_\_ | Black -\_1 \_\_\_\_0001 | 1\_ 0001\_\_\_\_ | Red -\_2 \_\_\_\_0010 | 2\_ 0010\_\_\_\_ | Green -\_3 \_\_\_\_0011 | 3\_ 0011\_\_\_\_ | Brown -\_4 \_\_\_\_0100 | 4\_ 0100\_\_\_\_ | Blue -\_5 \_\_\_\_0101 | 5\_ 0101\_\_\_\_ | Magenta -\_6 \_\_\_\_0110 | 6\_ 0110\_\_\_\_ | Cyan -\_7 \_\_\_\_0111 | 7\_ 0111\_\_\_\_ | White -\_8 \_\_\_\_1000 | 8\_ 1000\_\_\_\_ | Gray -\_9 \_\_\_\_1001 | 9\_ 1001\_\_\_\_ | Light Red -\_A \_\_\_\_1010 | A\_ 1010\_\_\_\_ | Light Green -\_B \_\_\_\_1011 | B\_ 1011\_\_\_\_ | Yellow -\_C \_\_\_\_1100 | C\_ 1100\_\_\_\_ | Light Blue -\_D \_\_\_\_1101 | D\_ 1101\_\_\_\_ | Light Magenta -\_E \_\_\_\_1110 | E\_ 1110\_\_\_\_ | Light Cyan -\_F \_\_\_\_1111 | F\_ 1111\_\_\_\_ | Bright White - -Attribute byte values are constructed using the following bit encoding: - -**Bit** | **Effect** -------- | ---------- -7 | n/a (0) -6 | n/a (0) -5 | n/a (0) -4 | n/a (0) -3 | n/a (0) -2 | Reverse -1 | Underline -0 | Blink - -The following codes are returned by a keyboard read to signify non-ASCII -keystrokes: - -**Value** | **Keystroke** | **Value** | **Keystroke** ---------- | ------------- | --------- | ------------- -0xE0 | F1 | 0xF0 | Insert -0xE1 | F2 | 0xF1 | Delete -0xE2 | F3 | 0xF2 | Home -0xE3 | F4 | 0xF3 | End -0xE4 | F5 | 0xF4 | PageUp -0xE5 | F6 | 0xF5 | PadeDown -0xE6 | F7 | 0xF6 | UpArrow -0xE7 | F8 | 0xF7 | DownArrow -0xE8 | F9 | 0xF8 | LeftArrow -0xE9 | F10 | 0xF9 | RightArrow -0xEA | F11 | 0xFA | Power -0xEB | F12 | 0xFB | Sleep -0xEC | SysReq | 0xFC | Wake -0xED | PrintScreen | 0xFD | Break -0xEE | Pause | 0xFE | -0xEF | App | 0xFF | - -### Function 0x40 -- Video Initialize (VDAINI) - -| _Entry Parameters_ -| B: 0x40 -| C: Video Device Unit ID -| E: Video Mode (device specific) -| HL: Font Bitmap Buffer Address (optional) - -| _Exit Results_ -| A: Status (0=OK, else error) - -Performs a full (re)initialization of the specified video device. The -screen is cleared and the keyboard buffer is flushed. If the specified -VDA supports multiple video modes, the requested mode can be specified -in E (set to 0 for default/not specified). Mode values are specific to -each VDA. - -HL may point to a location in memory with the character bitmap to be -loaded into the VDA video processor. The location MUST be in the top 32K -of the CPU memory space. HL must be set to zero if no character bitmap -is specified (the VDA video processor will utilize a default character -bitmap). - -### Function 0x41 -- Video Query (VDAQRY) - -| _Entry Parameters_ -| B: 0x41 -| C: Video Device Unit ID -| HL: Font Bitmap Buffer Address (optional) - -| _Exit Results_ -| A: Status (0=OK, else error) -| C: Video Mode -| D: Row Count -| E: Column Count -| HL: Font Bitmap Buffer Address (0 if N/A) - -Return information about the specified video device. C will be set to -the current video mode. DE will return the dimensions of the video -display as measured in rows and columns. Note that this is the **count** -of rows and columns, not the **last** row/column number. - -If HL is not zero, it must point to a suitably sized memory buffer in -the upper 32K of CPU address space that will be filled with the current -character bitmap data. It is critical that HL be set to zero if it does -not point to a proper buffer area or memory corruption will result. The -video device driver may not have the ability to provide character bitmap -data. In this case, on return, HL will be set to zero. - -### Function 0x42 -- Video Reset (VDARES) - -| _Entry Parameters_ -| B: 0x42 -| C: Video Device Unit ID - -| _Exit Results_ -| A: Status (0=OK, else error) - -Performs a soft reset of the Video Display Adapter. Should clear the -screen, home the cursor, restore active attribute and color to defaults. -Keyboard should be flushed. - -### Function 0x43 -- Video Device (VDADEV) - -| _Entry Parameters_ -| B: 0x43 -| C: Video Device Unit ID - -| _Exit Results_ -| A: Status (0=OK, else error) -| D=Device Type -| E=Device Number - -Reports information about the video device unit specified. - -Register D reports the video device type (see below). - -Register E reports the driver relative physical device number. - -The currently defined video device types are: - -VDA ID | Value | Device ----------- | ----- | ------ -VDA\_NONE | 0x00 | No VDA -VDA\_VDU | 0x10 | ECB VDU board -VDA\_CVDU | 0x20 | ECB Color VDU board -VDA\_7220 | 0x30 | ECB uPD7220 video display board -VDA\_N8 | 0x40 | TMS9918 video display built-in to N8 -VDA\_VGA | 0x50 | ECB VGA board - -### Function 0x44 -- Video Set Cursor Style (VDASCS) - -| _Entry Parameters_ -| B: 0x44 -| C: Video Device Unit ID -| D: Start/End Pixel Row -| E: Style - -| _Exit Results_ -| A: Status (0=OK, else error) - -If supported by the video hardware, adjust the format of the cursor such -that the cursor starts at the pixel specified in the top nibble of D and -end at the pixel specified in the bottom nibble of D. So, if D=\$08, a -block cursor would be used that starts at the top pixel of the character -cell and ends at the ninth pixel of the character cell. - -Register E is reserved to control the style of the cursor (blink, -visibility, etc.), but is not yet implemented. - -Adjustments to the cursor style may or may not be possible for any given -video hardware. - -### Function 0x45 -- Video Set Cursor Position (VDASCP) - -| _Entry Parameters_ -| B: 0x45 -| C: Video Device Unit ID -| D: Row (0 indexed) -| E: Column (0 indexed) - -| _Exit Results_ -| A: Status (0=OK, else error) - -Reposition the cursor to the specified row and column. Specifying a -row/column that exceeds the boundaries of the display results in -undefined behavior. Cursor coordinates are 0 based (0,0 is the upper -left corner of the display). - -### Function 0x46 -- Video Set Character Attribute (VDASAT) - -| _Entry Parameters_ -| B: 0x46 -| C: Video Device Unit ID -| E: Character Attribute Code - -| _Exit Results_ -| A: Status (0=OK, else error) - -Assign the specified character attribute code to be used for all -subsequent character writes/fills. This attribute is used to fill new -lines generated by scroll operations. Refer to the character attribute -for a list of the available attribute codes. Note that a given video -display may or may not support any/all attributes. - -### Function 0x47 -- Video Set Character Color (VDASCO) - -| _Entry Parameters_ -| B: 0x47 -| C: Video Device Unit ID -| E: Character Color Code - -| _Exit Results_ -| A: Status (0=OK, else error) - -Assign the specified color code to be used for all subsequent character -writes/fills. This color is also used to fill new lines generated by -scroll operations. Refer to color code table for a list of the available -color codes. Note that a given video display may or may not support -any/all colors. - -### Function 0x48 -- Video Set Write Character (VDAWRC) - -| _Entry Parameters_ -| B: 0x48 -| C: Video Device Unit ID -| E: Character - -| _Exit Results_ -| A: Status (0=OK, else error) - -Write the character specified in E. The character is written starting at -the current cursor position and the cursor is advanced. If the end of -the line is encountered, the cursor will be advanced to the start of the -next line. The display will **not** scroll if the end of the screen is -exceeded. - -### Function 0x49 -- Video Fill (VDAFIL) - -| _Entry Parameters_ -| B: 0x49 -| C: Video Device Unit ID -| E: Character -| HL: Count - -| _Exit Results_ -| A: Status (0=OK, else error) - -Write the character specified in E to the display the number of times -specified in HL. Characters are written starting at the current cursor -position and the cursor is advanced by the number of characters written. -If the end of the line is encountered, the characters will continue to -be written starting at the next line as needed. The display will **not** -scroll if the end of the screen is exceeded. - -### Function 0x4A -- Video Copy (VDACPY) - -| _Entry Parameters_ -| B: 0x4A -| C: Video Device Unit ID -| D: Source Row -| E: Source Column -| L: Count - -| _Exit Results_ -| A: Status (0=OK, else error) - -Copy count (L) bytes from the source row/column (DE) to current cursor -position. The cursor position is not updated. The maximum count is 255. -Copying to/from overlapping areas is not supported and will have an -undefined behavior. The display will **not** scroll if the end of the -screen is exceeded. Copying beyond the active screen buffer area is not -supported and results in undefined behavior. - -### Function 0x4B -- Video Scroll (VDASCR) - -| _Entry Parameters_ -| B: 0x4B -| C: Video Device Unit ID -| E: Scroll Distance (Line Count) - -| _Exit Results_ -| A: Status (0=OK, else error) - -Scroll the video display by the number of lines specified in E. If E -contains a negative number, then reverse scroll should be performed. - -### Function 0x4C -- Video Keyboard Status (VDAKST) - -| _Entry Parameters_ -| B: 0x4C -| C: Video Device Unit ID - -| _Exit Results_ -| A:Count of Key Codes in Keyboard Buffer - -Return a count of the number of key codes in the keyboard buffer. If it -is not possible to determine the actual number in the buffer, it is -acceptable to return 1 to indicate there are key codes available to read -and 0 if there are none available. - -### Function 0x4D -- Video Keyboard Flush (VDAKFL) - -| _Entry Parameters_ -| B: 0x4D -| C: Video Device Unit ID - -| _Exit Results_ -| A: Status (0=OK, else error) - -If a keyboard buffer is in use, it should be purged and all contents -discarded. - -### Function 0x4E -- Video Keyboard Read (VDAKRD) - -| _Entry Parameters_ -| B: 0x4E -| C: Video Device Unit ID - -| _Exit Results_ -| A: Status (0=OK, else error) -| C: Scancode -| D: Keystate -| E: Keycode - -Read next key code from keyboard. If a keyboard buffer is used, return -the next key code in the buffer. If no key codes are available, wait for -a keypress and return the keycode. - -The scancode value is the raw scancode from the keyboard for the -keypress. Scancodes are from scancode set 2 standard. - -The keystate is a bitmap representing the value of all modifier keys and -shift states as they existed at the time of the keystroke. The bitmap is -defined as: - -Bit | Keystate Indication ---- | -------------------------------- -7 | Key pressed was from the num pad -6 | Caps Lock was active -5 | Num Lock was active -4 | Scroll Lock was active -3 | Windows key was held down -2 | Alt key was held down -1 | Control key was held down -0 | Shift key was held down - -Keycodes are generally returned as appropriate ASCII values, if -possible. Special keys, like function keys, are returned as reserved -codes as described at the start of this section. - -`\clearpage`{=latex} - -System (SYS) ------------- - -### Function 0xF0 -- System Reset (SYSRESET) - -| _Entry Parameters_ -| B: 0xF0 - -| _Exit Results_ -| A: Status (0=OK, else error) - -Perform a soft reset of HBIOS. Releases all HBIOS memory allocated by -current OS. Does not reinitialize physical devices. - -### Function 0xF1 -- System Version (SYSVER) - -| _Entry Parameters_ -| B: 0xF1 -| C: Reserved (set to 0) - -| _Exit Results_ -| A: Status (0=OK, else error) -| DE: Version (Maj/Min/Upd/Pat) -| L: Platform ID - -This function will return the HBIOS version number. The version number -is returned in DE. High nibble of D is the major version, low nibble of -D is the minor version, high nibble of E is the patch number, and low -nibble of E is the build number. - -The hardware platform is identified in L: - -Id | Platform --- | --------------------------------------------------- -1 | SBC V1 or V2 -2 | Zeta -3 | Zeta V2 -4 | N8 -5 | Mark IV -6 | UNA -7 | RC2014 w/ Z80 -8 | RC2014 w/ Z180 & banked memory module -9 | RC2014 w/ Z180 & linear memory module -10 | SCZ180 (SC126, SC130, SC131) -11 | Dyno - -### Function 0xF2 -- System Set Bank (SYSSETBNK) - -| _Entry Parameters_ -| B: 0xF2 -| C: Bank ID - -| _Exit Results_ -| A: Status (0=OK, else error) -| C: Previously Active Bank ID - -Activates the Bank ID specified in C and returns the previously active -Bank ID in C. The caller MUST be invoked from code located in the upper -32K and the stack **must** be in the upper 32K. - -### Function 0xF3 -- System Get Bank (SYSGETBNK) - -| _Entry Parameters_ -| B: 0xF3 - -| _Exit Results_ -| A: Status (0=OK, else error) -| C: Active Bank ID - -Returns the currently active Bank ID in C. - -### Function 0xF4 -- System Set Copy (SYSSETCPY) - -| _Entry Parameters_ -| B: 0xF4 -| D: Destination Bank ID -| E: Source Bank ID -| HL: Count of Bytes to Copy - -| _Exit Results_ -| A: Status (0=OK, else error) - -Prepare for a subsequent interbank memory copy (SYSBNKCPY) function by -setting the source bank, destination bank, and byte count for the copy. -The bank id's are not range checked and must be valid for the system in -use. - -No bytes are copied by this function. The SYSBNKCPY must be called to -actually perform the copy. The values setup by this function will remain -unchanged until another call is make to this function. So, after calling -SYSSETCPY, you may make multiple calls to SYSBNKCPY as long as you want -to continue to copy between the already established Source/Destination -Banks and the same size copy if being performed. - -### Function 0xF5 -- System Bank Copy (SYSBNKCPY) - -| _Entry Parameters_ -| B: 0xF5 -| DE: Destination Address -| HL: Source Address - -| _Exit Results_ -| A: Status (0=OK, else error) - -Copy memory between banks. The source bank, destination bank, and byte -count to copy MUST be established with a prior call to SYSSETCPY. -However, it is not necessary to call SYSSETCPY prior to subsequent calls -to SYSBNKCPY if the source/destination banks and copy length do not -change. - -WARNINGS: - -* This function is inherently dangerous and does not prevent you from -corrupting critical areas of memory. Use with **extreme** caution. - -* Overlapping source and destination memory ranges are not supported and -will result in undetermined behavior. - -* Copying of byte ranges that cross bank boundaries is undefined. - -### Function 0xF6 -- System Alloc (SYSALLOC) - -| _Entry Parameters_ -| B: 0xF6 -| HL: Size in Bytes - -| _Exit Results_ -| A: Status (0=OK, else error) -| HL: Address of Allocated Memory - -This function will attempt to allocate a block of memory of HL bytes -from the internal HBIOS heap. The HBIOS heap resides in the HBIOS bank -in the area of memory left unused by HBIOS. If the allocation is -successful, the address of the allocated memory block is returned in HL. -You will typically want to use the SYSBNKCPY function to read/write the -allocated memory. - -### Function 0xF7 -- System Free (SYSFREE) - -| _Entry Parameters_ -| B: 0xF7 -| HL: Address of Memory Block to Free - -| _Returned Values_ -| A: Status (0=OK, else error) - -\*\*\* This function is not yet implemented \*\*\* - -### Function 0xF8 -- System Get (SYSGET) - -| _Entry Parameters_ -| B: 0xF8 -| C: Subfunction (see below) - -| _Returned Values_ -| A: Status (0=OK, else error) - -This function will report various system information based on the -sub-function value. The following lists the subfunctions -available along with the registers/information returned. - -#### SYSGET Subfunction 0x00 -- Get Serial Device Unit Count (CIOCNT) - -| _Entry Parameters_ -| BC: 0xF800 - -| _Returned Values_ -| A: Status (0=OK, else error) -| E: Count of Serial Device Units - -#### SYSGET Subfunction 0x10 -- Get Disk Device Unit Count (DIOCNT) - -| _Entry Parameters_ -| BC: 0xF810 - -| _Returned Values_ -| A: Status (0=OK, else error) -| E: Count of Disk Device Units - -#### SYSGET Subfunction 0x40 -- Get Video Device Unit Count (VDACNT) - -| _Entry Parameters_ -| BC: 0xF840 - -| _Returned Values_ -| A: Status (0=OK, else error) -| E: Count of Video Device Units - -#### SYSGET Subfunction 0xD0 -- Get Timer Tick Count (TIMER) - -| _Entry Parameters_ -| BC: 0xF8D0 - -| _Returned Values_ -| A: Status (0=OK, else error) -| DE:HL: Current Timer Tick Count Value - -#### SYSGET Subfunction 0xD1 -- Get Seconds Count (SECONDS) - -| _Entry Parameters_ -| BC: 0xF8D1 - -| _Returned Values_ -| A: Status (0=OK, else error) -| DE:HL: Current Seconds Count Value -| C: Ticks within Second Value - -#### SYSGET Subfunction 0xE0 -- Get Boot Information (BOOTINFO) - -| _Entry Parameters_ -| BC: 0xF8E0 - -| _Returned Values_ -| A: Status (0=OK, else error) -| L: Boot Bank ID -| D: Boot Disk Device Unit ID -| E: Boot Disk Slice - -#### SYSGET Subfunction 0xF0 -- Get CPU Information (CPUINFO) - -| _Entry Parameters_ -| BC: 0xF8F0 - -| _Returned Values_ -| A: Status (0=OK, else error) -| H: Z80 CPU Variant -| L: CPU Speed in MHz -| DE: CPU Speed in KHz - -#### SYSGET Subfunction 0xF1 -- Get Memory Information (MEMINFO) - -| _Entry Parameters_ -| BC: 0xF8F1 - -| _Returned Values_ -| A: Status (0=OK, else error) -| D: Count of 32K ROM Banks -| E: Count of 32K RAM Banks - -#### SYSGET Subfunction 0xF2 -- Get Bank Information (BNKINFO) - -| _Entry Parameters_ -| BC: 0xF8F2 - -| _Returned Values_ -| A: Status (0=OK, else error) -| D: BIOS Bank ID -| E: User Bank ID - -### Function 0xF9 -- System Set (SYSSET) - -| _Entry Parameters_ -| B: 0xF9 -| C: Subfunction (see below) - -| _Returned Values_ -| A: Status (0=OK, else error) - -This function will set various system parameters based on the -sub-function value. The following lists the subfunctions -available along with the registers/information used as input. - -#### SYSSET Subfunction 0xD0 -- Set Timer Tick Count (TIMER) - -| _Entry Parameters_ -| BC: 0xF9D0 -| DE:HL: Timer Tick Count Value - -| _Returned Values_ -| A: Status (0=OK, else error) - - -#### SYSSET Subfunction 0xD1 -- Set Seconds Count (SECONDS) - -| _Entry Parameters_ -| BC: 0xF9D1 -| DE:HL: Seconds Count Value - -| _Returned Values_ -| A: Status (0=OK, else error) - - -#### SYSSET Subfunction 0xE0 -- Set Boot Information (BOOTINFO) - -| _Entry Parameters_ -| BC: 0xF9E0 -| L: Boot Bank ID -| D: Boot Disk Device Unit ID -| E: Boot Disk Slice - -| _Returned Values_ -| A: Status (0=OK, else error) - -### Function 0xFA -- System Peek (SYSPEEK) - -| _Entry Parameters_ -| B: 0xFA -| D: Bank ID -| HL: Memory Address - -| _Returned Values_ -| A: Status (0=OK, else error) -| E: Byte Value - -This function gets a single byte value at the specified bank/address. -The bank specified is not range checked. - -### Function 0xFB -- System Poke (SYSPOKE) - -| _Entry Parameters_ -| B: 0xFB -| D: Bank ID -| E: Value -| HL: Memory Address - -| _Returned Values_ -| A: Status (0=OK, else error) - -This function sets a single byte value at the specified bank/address. -The bank specified is not range checked. - -### Function 0xFC -- System Interrupt Management (SYSINT) - -| _Entry Parameters_ -| B: 0xFC -| C: Subfunction (see below) - -| _Returned Values_ -| A: Status (0=OK, else error) - -This function allows the caller to query information about the interrupt -configuration of the running system and allows adding or hooking interrupt -handlers dynamically. Register C is used to specify a subfunction. -Additional input and output registers may be used as defined by the -sub-function. - -Note that during interrupt processing, the lower 32K of CPU address space -will contain the RomWBW HBIOS code bank, not the lower 32K of application -TPA. As such, a dynamically installed interrupt handler does not have -access to the lower 32K of TPA and must be careful to avoid modifying the -contents of the lower 32K of memory. Invoking RomWBW HBIOS functions -within an interrupt handler is not supported. - -Interrupt handlers are different for IM1 or IM2. - -For IM1: - -> The new interrupt handler is responsible for chaining (JP) to the -previous vector if the interrupt is not handled. If the interrupt is -handled, the new handler may simply return (RET). When chaining to the -previous interrupt handler, ZF must be set if interrupt is handled and -ZF cleared if not handled. The interrupt management framework takes care -of saving and restoring AF, BC, DE, HL, and IY. Any other registers -modified must be saved and restored by the interrupt handler. - -For IM2: - -> The new interrupt handler may either replace or hook the previous -interrupt handler. To replace the previous interrupt handler, the new -handler just returns (RET) when done. To hook the previous handler, the -new handler can chain (JP) to the previous vector. Note that initially -all IM2 interrupt vectors are set to be handled as “BAD†meaning that the -interrupt is unexpected. In most cases, you do not want to chain to the -previous vector because it will cause the interrupt to display a “BAD -INT†system panic message. - -The interrupt framework will take care of issuing an EI and RETI -instruction. Do not put these instructions in your new handler. -Additionally, interrupt management framework takes care of saving and -restoring AF, BC, DE, HL, and IY. Any other registers modified must be -saved and restored by the interrupt handler. - -If the caller is transient, then the caller must remove the new interrupt -handler and restore the original one prior to termination. This is -accomplished by calling this function with the Interrupt Vector set to the -Previous Vector returned in the original call. - -The caller is responsible for disabling interrupts prior to making an -INTSET call and enabling them afterwards. The caller is responsible for -ensuring that a valid interrupt handler is installed prior to enabling any -hardware interrupts associated with the handler. Also, if the handler is -transient, the caller must disable the hardware interrupt(s) associated -with the handler prior to uninstalling it. - -#### SYSINT Subfunction 0x00 -- Interrupt Info (INTINF) - -| _Entry Parameters_ -| BC: 0xFC00 - -| _Returned Values_ -| A: Status (0=OK, else error) -| D: Interrupt Mode -| E: Size (# entries) of Interrupt Vector Table - -Return interrupt mode in D and size of interrupt vector table in E. For -IM1, the size of the table is the number of vectors chained together. -For IM2, the size of the table is the number of slots in the vector -table. - -#### SYSINT Subfunction 0x10) -- Get Interrupt (INTGET) - -| _Entry Parameters_ -| BC: 0xFC10 -| E: Interrupt Vector Table Index - -| _Returned Values_ -| A: Status (0=OK, else error) -| HL: Current Interrupt Vector Address - -On entry, register E must contain an index into the interrupt vector -table. On return, HL will contain the address of the current interrupt -vector at the specified index. - -#### SYSINT Subfunction 0x20) -- Set Interrupt (INTSET) - -| _Entry Parameters_ -| BC: 0xFC20 -| E: Interrupt Vector Table Index -| HL: Interrupt Address to be Assigned - -| _Returned Values_ -| A: Status (0=OK, else error) -| HL: Previous Interrupt Vector Address -| DE: Interrupt Routing Engine Address (IM2) - -On entry, register E must contain an index into the interrupt vector table -and register HL must contain the address of the new interrupt vector to -be inserted in the table at the index. On return, HL will contain the -previous address in the table at the index. diff --git a/Source/Doc/Basic.h b/Source/Doc/Basic.h new file mode 100644 index 00000000..7431818c --- /dev/null +++ b/Source/Doc/Basic.h @@ -0,0 +1,65 @@ +$define{doc_ver}{Version 3.2}$ +$define{doc_product}{RomWBW}$ +$define{doc_root}{https://github.com/wwarthen/RomWBW/raw/Doc}$ +$ifndef{doc_title}$ $define{doc_title}{Document Title}$ $endif$ +$ifndef{doc_author}$ $define{doc_author}{Wayne Warthen}$ $endif$ +$define{doc_date}{$date{%d %b %Y}$}$ +$ifndef{doc_authmail}$ $define{doc_authmail}{wwarthen@gmail.com}$ $endif$ +$define{doc_orgname}{RetroBrew Computers Group}$ +$define{doc_orgurl}{www.retrobrewcomputers.org}$ +$define{doc_user}{[RomWBW User Guide]($doc_root$/RomWBW User Guide.pdf)}$ +$define{doc_sys}{[RomWBW System Guide]($doc_root$/RomWBW System Guide.pdf)}$ +$define{doc_apps}{[RomWBW Applications]($doc_root$/RomWBW Applications.pdf)}$ +$define{doc_romapps}{[RomWBW ROM Applications]($doc_root$/RomWBW ROM Applications.pdf)}$ +$define{doc_catalog}{[RomWBW Disk Catalog]($doc_root$/RomWBW Disk Catalog.pdf)}$ +$define{doc_errata}{[RomWBW Errata]($doc_root$/RomWBW Errata.pdf)}$ + +--- +title: $doc_product$ $doc_title$ +subtitle: $doc_ver$ +author: $doc_author$ ([$doc_authmail$](mailto:$doc_authmail$)) +date: $doc_date$ +institution: $doc_orgname$ +papersize: letter +geometry: +- top=1.5in +- bottom=1.5in +- left=1.5in +- right=1.5in +# - showframe +# - pass +fontsize: 12pt +# linestretch: 1.25 +colorlinks: true +# sansfont: helvetic +sansfont: roboto +# sansfont: bera +# sansfont: DejaVuSans +# sansfont: arial +monofont: roboto-mono +# monofont: bera +# monofont: inconsolata +# monofont: DejaVuSansMono +monofontoptions: 'Scale=0.75' +header-includes: +- | + ```{=latex} + \renewcommand*{\familydefault}{\sfdefault} + ``` +--- + +```{=gfm} +**$doc_product$ $doc_title$** \ +$doc_ver$ \ +$doc_author$ ([$doc_authmail$](mailto:$doc_authmail$)) \ +$doc_date$ + +``` + +```{=dokuwiki} +**$doc_product$ $doc_title$**\\ +$doc_ver$\\ +$doc_author$ <$doc_authmail$>\\ +$doc_date$\\ + +``` diff --git a/Source/Doc/Book.h b/Source/Doc/Book.h new file mode 100644 index 00000000..6c7d3b93 --- /dev/null +++ b/Source/Doc/Book.h @@ -0,0 +1,57 @@ +$include{"Basic.h"}$ + +--- +# Force pandoc to enable graphics for Logo in title page! +graphics: true +documentclass: book +classoption: +- oneside +toc: true +toc-depth: 2 +numbersections: true +secnumdepth: 2 +header-includes: +- | + ```{=latex} + \setlength{\headheight}{15pt} + \usepackage{fancyhdr} + \usepackage{xcolor} + \usepackage{xhfill} + \usepackage{tocloft} + \renewcommand*{\familydefault}{\sfdefault} + \renewcommand{\maketitle}{ + \begin{titlepage} + \centering + \par + \vspace*{0pt} + \includegraphics[width=\textwidth]{Graphics/Logo.pdf} \par + \vfill + \raggedleft + {\scshape \bfseries \fontsize{48pt}{56pt} \selectfont $doc_product$ \par} + {\bfseries \fontsize{32pt}{36pt} \selectfont $doc_title$ \par} + \vspace{24pt} + {\huge $doc_ver$ \\ $doc_date$ \par} + \vspace{24pt} + {\large \itshape $doc_orgname$ \\ \href{http://$doc_orgurl$}{$doc_orgurl$} \par} + \vspace{12pt} + {\large \itshape $doc_author$ \\ \href{mailto:$doc_authmail$}{$doc_authmail$} \par} + \end{titlepage} + } + \pagestyle{empty} + ``` +include-before: +# - \renewcommand{\chaptername}{Section} +- | + ```{=latex} + \pagestyle{fancyplain} + \fancyhf{} + \lhead{\fancyplain{}{\nouppercase{\bfseries \leftmark \hfill $doc_product$ $doc_title$}}} + \lfoot{\small RetroBrew Computing Group ~~ {\xrfill[3pt]{1pt}[cyan]} ~~ \thepage} + \pagenumbering{roman} + ``` +--- + +```{=latex} +\clearpage +\pagenumbering{arabic} +``` diff --git a/Source/Doc/Build.cmd b/Source/Doc/Build.cmd new file mode 100644 index 00000000..14ac1187 --- /dev/null +++ b/Source/Doc/Build.cmd @@ -0,0 +1,57 @@ +@echo off +setlocal + +:: +:: NOTE: Pandoc and Latex (MiKTeX or TexLive) must be installed +:: and available on commandline for this build to work!!! +:: + +set TOOLS=..\..\Tools +set PATH=%TOOLS%\gpp;%PATH% + +if not "%1"=="" (call :GenDoc %1 & goto :eof) + +call :GenDoc ReadMe +call :GenDoc UserGuide +call :GenDoc SystemGuide +call :GenDoc Applications +call :GenDoc ROM_Applications +call :GenDoc Catalog +call :GenDoc Errata + +if exist ReadMe.gfm copy Readme.gfm ..\..\ReadMe.md || exit /b +if exist ReadMe.txt copy ReadMe.txt ..\..\ReadMe.txt || exit /b +if exist UserGuide.pdf copy UserGuide.pdf "..\..\Doc\RomWBW User Guide.pdf" || exit /b +if exist SystemGuide.pdf copy SystemGuide.pdf "..\..\Doc\RomWBW System Guide.pdf" || exit /b +if exist Applications.pdf copy Applications.pdf "..\..\Doc\RomWBW Applications.pdf" || exit /b +if exist ROM_Applications.pdf copy ROM_Applications.pdf "..\..\Doc\RomWBW ROM Applications.pdf" || exit /b +if exist Catalog.pdf copy Catalog.pdf "..\..\Doc\RomWBW Disk Catalog.pdf" || exit /b +if exist Errata.pdf copy Errata.pdf "..\..\Doc\RomWBW Errata.pdf" || exit /b + +echo. +goto :eof + +:GenDoc + +echo. + +echo Processing document %1... + +::gpp -o %1.tmp %1.md +::gpp -o %1.tmp -U "\\" "" "{" "}{" "}" "{" "}" "#" "" %1.md +::gpp -o %1.tmp -U "" "" "(" "," ")" "(" ")" "#" "" -M "#" "\n" " " " " "\n" "(" ")" %1.md +gpp -o %1.tmp -U "$" "$" "{" "}{" "}$" "{" "}" "@@@" "" -M "$" "$" "{" "}{" "}$" "{" "}" %1.md || exit /b + +::pandoc %1.tmp -f markdown -t latex -s -o %1.tex --default-image-extension=pdf || exit /b +::::rem texify --pdf --clean %1.ltx || exit /b +::texify --pdf --clean --engine=luatex --verbose %1.tex || exit /b +::goto :eof + +pandoc %1.tmp -f markdown -t pdf -s -o %1.pdf --default-image-extension=pdf --pdf-engine=lualatex || exit /b +pandoc %1.tmp -f markdown -t html -s -o %1.html --default-image-extension=png --css pandoc.css --embed-resources || exit /b +pandoc %1.tmp -f markdown -t dokuwiki -s -o %1.dw --default-image-extension=png || exit /b +pandoc %1.tmp -f markdown -t gfm-yaml_metadata_block -s -o %1.gfm --default-image-extension=png || exit /b +::pandoc %1.tmp -f markdown -t gfm-yaml_metadata_block -s -o %1.txt --markdown-headings=setext --default-image-extension=png || exit /b +pandoc %1.tmp -f markdown -t plain+gutenberg -s -o %1.txt || exit /b + +goto :eof \ No newline at end of file diff --git a/Source/Doc/Catalog.md b/Source/Doc/Catalog.md new file mode 100644 index 00000000..b13b86d2 --- /dev/null +++ b/Source/Doc/Catalog.md @@ -0,0 +1,787 @@ +$define{doc_title}{Disk Catalog}$ +$define{doc_author}{Mykl Orders}$ +$define{doc_authmail}{}$ +$include{"Book.h"}$ + +# RomWBW Distribution File Catalog + +This document is a reference to the files found on the disk media +distributed with RomWBW. Specifically, RomWBW provides a set +of floppy and hard disk images in the Binary directory of the +distribution. The contents of these images is listed here. + +The files on the disk images were sourced from a variety of locations. +The primary sources of these files are listed below. Note that the +primary documentation for each of these sources is listed. You are +strongly encouraged to refer to this documentation for more information +on using the applications and files listed. + +## Sources + +- **RomWBW**: RomWBW Custom Applications + + Documentation: RomWBW Applications.pdf* + + These files are custom applications built exclusively to enhance the + functionality of RomWBW. In some cases they are built from scratch + while others are customized versions of well known CP/M tools. + +- **CPM22**: Digital Research CP/M-80 2.2 Distribution Files + + Documentation: CPM Manual.pdf + + These files are from the official Digital Research distribution + of CP/M 2.2. Applications have been patched according to the + DRI patch list. + +- **ZSDOS**: ZSDOS 1.1 Disk Operating System Distribution Files + + Documentation: *ZSDOS Manual.pdf* + + These files are from the official ZSDOS 1.1 distribution. Some of + the files are redistributions of applications from other sources. + +- **ZCPR**: ZCPR 1.0 Command Processor Distribution Files + + Documentation: *ZCPR Manual.pdf* + + These files are from the ZCPR 1.0 distribution. + +- **NZCOM**: NZCOM Automatic Z-System Distribution Files + + Documentation: *NZCOM Users Manual.pdf* + + These files are from the last official release of NZCOM. + +- **CPM3**: Digital Research CP/M 3 Distribution Files + + Documentation: *CPM3 Users Guide.pdf*, *CPM3 System Guide.pdf*, + *CPM3 Programmers Guide.pdf*, *CPM3 Command Summary.pdf* + + These files are from the official Digital Research distribution of + CP/M 3. Applications have been patched according to the DRI + patch list. + +- **ZPM3**: Digital Research CP/M-80 2.2 Distribution Files + + Documentation: *CPM Manual.pdf* + + These files are from Simeon Cran's ZPM3 operating system distribution. + +`\clearpage`{=latex} + +# CPM 2.2 Boot Disk + +| Floppy Disk Image: **fd_cpm22.img** +| Hard Disk Image: **hd_cpm22.img** +| Combo Disk Image: **Slice 0** + +| **User 0** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `ASM.COM` | CPM22 | DRI 8080 Assembler | +| `CR.COM` | -- | Crunch archiver | +| `DDT.COM` | CPM22 | DRI Dynamic Debugger | +| `DDTZ.DOC` | -- | Z80 replacement for DDT | +| `DIRX.COM` | -- | Directory lister with file sizes | +| `DUMP.COM` | CPM22 | DRI type contents of disk file in hex | +| `ED.COM` | CPM22 | DRI context editor | +| `KERMIT.COM` | -- | Generic CP/M 2.2 Kermit communication application | +| `LBREXT.COM` | -- | Extract library files | +| `LIB.COM` | -- | DRI Library manager | +| `LINK.COM` | -- | DRI CPM relocatable linker | +| `LOAD.COM` | -- | DRI hex file loader into memory | +| `MAC.COM` | -- | DRI CPM macro assembler | +| `MBASIC.COM` | -- | Microsoft Basic | +| `PIP.COM` | CPM22 | DRI Periperal Interchange Program | +| `PMARC.COM` | -- | LHA file compressor | +| `PMEXT.COM` | -- | Extractor for PMARC archives | +| `RMAC.COM` | -- | DRI Relocatable Macro Assembler | +| `STAT.COM` | CPM22 | DRI statistices about file storage and device assignment | +| `SUBMIT.COM` | CPM22 | DRI batch processor | +| `UNCR.COM` | -- | NZCOM Uncrunch decompression | +| `UNZIP.COM` | -- | Extractor for ZIP archives | +| `XSUB.COM` | CPM22 | DRI eXtended submit | +| `ZSID.COM` | -- | DRI Z80 symbolic instruction debugger | +| `ASSIGN.COM` | RomWBW | RomWBW Drive/Slice mapper | +| `FAT.COM` | RomWBW | RomWBW FAT filesystem access | +| `FDU.COM` | RomWBW | RomWBW Floppy Disk Utility | +| `FORMAT.COM` | RomWBW | RomWBW media formatter (placeholder) | +| `INTTEST.COM` | RomWBW | RomWBW Interrupt test | +| `MODE.COM` | RomWBW | RomWBW Modify serial port characteristics | +| `RTC.COM` | RomWBW | RomWBW Display and set RTC | +| `SURVEY.COM` | RomWBW | System survey | +| `SYSCOPY.COM` | RomWBW | RomWBW Read/write system boot image | +| `SYSGEN.COM` | RomWBW | DRI CPM SYSGEN to put CPM onto a new drive | +| `TALK.COM` | RomWBW | RomWBW Direct console I/O to a serial port | +| `TIMER.COM` | RomWBW | RomWBW Display timer tick counter | +| `TUNE.COM` | RomWBW | RomWBW Play PT or MYM sound files | +| `XM.COM` | RomWBW | RomWBW XMODEM file transfer | +| `CPM.SYS` | RomWBW | CPM2.2 system image | +| `CLRDIR.COM` | -- | Max Scane's disk directory cleaner | +| `COMPARE.COM` | -- | FoxHollow compare two files | +| `DDTZ.COM` | -- | Z80 replacement for DDT | +| `FDISK80.COM` | -- | John Coffman's Partition editor for FAT filesystem | +| `FLASH.COM` | -- | Will Sowerbutts' in-situ EEPROM programmer | +| `NULU.COM` | -- | NZCOM new library utility | +| `UNARC.COM` | -- | Extractor for ARC archives | +| `ZAP.COM` | -- | Disk editor/patcher | +| `ZDE.COM` | -- | Z-system display editor | +| `ZDENST.COM` | -- | ZDE Installer | + +| **User 1** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `SAMPKEY.DOC` | -- | ZDE Distribution File | +| `SAMPKEY.ZDK` | -- | ZDE Distribution File | +| `SAMPKEY.ZDT` | -- | ZDE Distribution File | +| `ZDE10.DOC` | -- | ZDE Distribution File | +| `ZDE10.FOR` | -- | ZDE Distribution File | +| `ZDE10.NEW` | -- | ZDE Distribution File | +| `ZDE10.QRF` | -- | ZDE Distribution File | +| `ZDE10.TOC` | -- | ZDE Distribution File | +| `ZDE13.FOR` | -- | ZDE Distribution File | +| `ZDE13.NEW` | -- | ZDE Distribution File | +| `ZDE16.COM` | -- | ZDE Distribution File | +| `ZDE16.DIR` | -- | ZDE Distribution File | +| `ZDE16.FIX` | -- | ZDE Distribution File | +| `ZDE16.FOR` | -- | ZDE Distribution File | +| `ZDE16.NEW` | -- | ZDE Distribution File | +| `ZDE16A.COM` | -- | ZDE Distribution File | +| `ZDE16A.PAT` | -- | ZDE Distribution File | +| `ZDENST16.COM` | -- | ZDE Distribution File | +| `ZDEPROP.DOC` | -- | ZDE Distribution File | +| `ZDEPROP.Z80` | -- | ZDE Distribution File | +| `ZDKCOM13.COM` | -- | ZDE Distribution File | +| `ZDKCOM13.DOC` | -- | ZDE Distribution File | + +| **User 3** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `ATTACK.PT3` | -- | Sound File | +| `BACKUP.PT3` | -- | Sound File | +| `BADMICE.PT3` | -- | Sound File | +| `DEMO.MYM` | -- | Sound File | +| `DEMO1.MYM` | -- | Sound File | +| `DEMO3.MYM` | -- | Sound File | +| `DEMO3MIX.MYM` | -- | Sound File | +| `DEMO4.MYM` | -- | Sound File | +| `HOWRU.PT3` | -- | Sound File | +| `ITERATN.PT3` | -- | Sound File | +| `LOOKBACK.PT3` | -- | Sound File | +| `LOUBOUTN.PT3` | -- | Sound File | +| `NAMIDA.PT3` | -- | Sound File | +| `RECOLL.PT3` | -- | Sound File | +| `SANXION.PT3` | -- | Sound File | +| `SYNCH.PT3` | -- | Sound File | +| `TOSTAR.PT3` | -- | Sound File | +| `VICTORY.PT3` | -- | Sound File | +| `WICKED.PT3` | -- | Sound File | +| `YEOLDE.PT3` | -- | Sound File | +| `YEOVIL.PT3` | -- | Sound File | + +`\clearpage`{=latex} + +# ZSDOS 1.1 Boot Disk + +| Floppy Disk Image: **fd_zsdos.img** +| Hard Disk Image: **hd_zsdos.img** +| Combo Disk Image: **Slice 1** + +| **User 0** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `ASM.COM` | CPM22 | DRI 8080 Assembler | +| `CLOCKS.DAT` | ZSDOS | ZSDOS Library of clock drivers | +| `COPY.CFG` | ZSDOS | ZSDOS Configuration file for COPY.COM | +| `COPY.COM` | ZSDOS | ZSDOS File copier with file dates and archiving | +| `COPY.UPD` | ZSDOS | ZSDOS ??? | +| `CR.COM` | -- | Crunch archiver | +| `DATSWEEP.COM` | ZSDOS | ZSDOS Comprehensive file management utility | +| `DDT.COM` | CPM22 | DRI Dynamic Debugger | +| `DDTZ.DOC` | -- | Z80 replacement for DDT | +| `DIRX.COM` | -- | Directory lister with file sizes | +| `DSCONFIG.COM` | ZSDOS | ZSDOS DATSWEEP configuration tool | +| `DUMP.COM` | CPM22 | DRI type contents of disk file in hex | +| `ED.COM` | CPM22 | DRI context editor | +| `FA16.CFG` | ZSDOS | ZSDOS FILEATTR.COM v1.6 configuration file | +| `FA16.DOC` | ZSDOS | ZSDOS FILEATTR.COM v1.6 documentation | +| `FA16A.FOR` | ZSDOS | ZSDOS FILEATTR.COM v1.6a information | +| `FA16CFG.TXT` | ZSDOS | ZSDOS FILEATTR.COM v1.6 configuration instructions | +| `FILEATTR.COM` | ZSDOS | ZSDOS Modify file attributes | +| `FILEDATE.CFG` | ZSDOS | ZSDOS Configuration file for FILEDATE.COM | +| `FILEDATE.COM` | ZSDOS | ZSDOS Disk directory that allows sorting and selecting by date and name | +| `FILEDATE.COM` | ZSDOS | ZSDOS Disk directory that allows sorting and selecting by date and name | +| `INITDIR.CFG` | ZSDOS | ZSDOS Configuration file for INITDIR.COM | +| `INITDIR.COM` | ZSDOS | ZSDOS Prepare disks for P2DOS Stamps | +| `KERMIT.COM` | -- | Generic CP/M 2.2 Kermit communication application | +| `LBREXT.COM` | -- | Extract library files | +| `LDDS.COM` | ZSDOS | Clock driver | +| `LDNZT.COM` | ZSDOS | Clock driver | +| `LDP2D.COM` | ZSDOS | Clock driver | +| `LIB.COM` | -- | DRI Library manager | +| `LINK.COM` | -- | DRI CPM relocatable linker | +| `LOAD.COM` | -- | DRI hex file loader into memory | +| `MAC.COM` | -- | DRI CPM macro assembler | +| `MBASIC.COM` | -- | Microsoft Basic | +| `PIP.COM` | CPM22 | DRI Periperal Interchange Program | +| `PMARC.COM` | -- | LHA file compressor | +| `PMEXT.COM` | -- | Extractor for PMARC archives | +| `PUTBG.COM` | ZSDOS | ZSDOS Prepare disk for backgrounder | +| `PUTDS.COM` | ZSDOS | ZSDOS Prepare disk for datestamper | +| `RELOG.COM` | ZSDOS | ZSDOS relog disks after program that bypasses BDOS | +| `RMAC.COM` | -- | DRI Relocatable Macro Assembler | +| `SETTERM.COM` | ZSDOS | ZSDOS Installs terminal control codes into DateSamper utilities | +| `SETUPZST.COM` | ZSDOS | ZSDOS Select clock driver | +| `STAMPS.DAT` | ZSDOS | ZSDOS Library of stamping routines | +| `STAT.COM` | CPM22 | DRI statistices about file storage and device assignment | +| `SUBMIT.COM` | CPM22 | DRI batch processor | +| `SUPERSUB.COM` | ZSDOS | | +| `TD.CFG` | ZSDOS | ZSDOS Configuration file for TD.COM | +| `TD.COM` | ZSDOS | ZSDOS Time/Date utility | +| `TERMBASE.DAT` | ZSDOS | ZSDOS Terminal information library for SETTERM | +| `TESTCLOK.COM` | ZSDOS | ZSDOS Test various clock drivers | +| `UNCR.COM` | -- | NZCOM Uncrunch decompression | +| `UNZIP.COM` | -- | Extractor for ZIP archives | +| `XSUB.COM` | CPM22 | DRI eXtended submit | +| `ZCAL.COM` | ZSDOS | ZSDOS Show month calendar | +| `ZCNFG.COM` | ZSDOS | ZSDOS Configure various utilities | +| `ZCNFG24.CFG` | ZSDOS | ZSDOS Configuration file for ZCNFG.COM | +| `ZPATH.COM` | ZSDOS | ZSDOS Set BDOS and/or ZCPR command path | +| `ZSCONFIG.COM` | ZSDOS | ZSDOS Dynamically regulate many of ZSDOS features | +| `ZSID.COM` | -- | DRI Z80 symbolic instruction debugger | +| `ZSVSTAMP.COM` | ZSDOS | ZSDOS Save/restore file timestamp | +| `ZSVSTAMP.DOC` | ZSDOS | ZSDOS ZSVSTAMP.COM documentation | +| `ZXD.CFG` | ZSDOS | ZSDOS Configuration file for ZXD.COM | +| `ZXD.COM` | ZSDOS | ZSDOS Extended directory utility | +| `ASSIGN.COM` | RomWBW | RomWBW Drive/Slice mapper | +| `FAT.COM` | RomWBW | RomWBW FAT filesystem access | +| `FDU.COM` | RomWBW | RomWBW Floppy Disk Utility | +| `FORMAT.COM` | RomWBW | RomWBW media formatter (placeholder) | +| `INTTEST.COM` | RomWBW | RomWBW Interrupt test | +| `MODE.COM` | RomWBW | RomWBW Modify serial port characteristics | +| `RTC.COM` | RomWBW | RomWBW Display and set RTC | +| `SURVEY.COM` | RomWBW | System survey | +| `SYSCOPY.COM` | RomWBW | RomWBW Read/write system boot image | +| `SYSGEN.COM` | RomWBW | DRI CPM SYSGEN to put CPM onto a new drive | +| `TALK.COM` | RomWBW | RomWBW Direct console I/O to a serial port | +| `TIMER.COM` | RomWBW | RomWBW Display timer tick counter | +| `TUNE.COM` | RomWBW | RomWBW Play PT or MYM sound files | +| `XM.COM` | RomWBW | RomWBW XMODEM file transfer | +| `ZSYS.SYS` | RomWBW | ZSDOS system image | +| `CLRDIR.COM` | -- | Max Scane's disk directory cleaner | +| `COMPARE.COM` | -- | FoxHollow compare two files | +| `DDTZ.COM` | -- | Z80 replacement for DDT | +| `FDISK80.COM` | -- | John Coffman's Partition editor for FAT filesystem | +| `FLASH.COM` | -- | Will Sowerbutts' in-situ EEPROM programmer | +| `NULU.COM` | -- | NZCOM new library utility | +| `UNARC.COM` | -- | Extractor for ARC archives | +| `ZAP.COM` | -- | Disk editor/patcher | +| `ZDE.COM` | -- | Z-system display editor | +| `ZDENST.COM` | -- | ZDE Installer | + +| **User 1** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `SAMPKEY.DOC` | -- | ZDE Distribution File | +| `SAMPKEY.ZDK` | -- | ZDE Distribution File | +| `SAMPKEY.ZDT` | -- | ZDE Distribution File | +| `ZDE10.DOC` | -- | ZDE Distribution File | +| `ZDE10.FOR` | -- | ZDE Distribution File | +| `ZDE10.NEW` | -- | ZDE Distribution File | +| `ZDE10.QRF` | -- | ZDE Distribution File | +| `ZDE10.TOC` | -- | ZDE Distribution File | +| `ZDE13.FOR` | -- | ZDE Distribution File | +| `ZDE13.NEW` | -- | ZDE Distribution File | +| `ZDE16.COM` | -- | ZDE Distribution File | +| `ZDE16.DIR` | -- | ZDE Distribution File | +| `ZDE16.FIX` | -- | ZDE Distribution File | +| `ZDE16.FOR` | -- | ZDE Distribution File | +| `ZDE16.NEW` | -- | ZDE Distribution File | +| `ZDE16A.COM` | -- | ZDE Distribution File | +| `ZDE16A.PAT` | -- | ZDE Distribution File | +| `ZDENST16.COM` | -- | ZDE Distribution File | +| `ZDEPROP.DOC` | -- | ZDE Distribution File | +| `ZDEPROP.Z80` | -- | ZDE Distribution File | +| `ZDKCOM13.COM` | -- | ZDE Distribution File | +| `ZDKCOM13.DOC` | -- | ZDE Distribution File | + +| **User 3** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `ATTACK.PT3` | -- | Sound File | +| `BACKUP.PT3` | -- | Sound File | +| `BADMICE.PT3` | -- | Sound File | +| `DEMO.MYM` | -- | Sound File | +| `DEMO1.MYM` | -- | Sound File | +| `DEMO3.MYM` | -- | Sound File | +| `DEMO3MIX.MYM` | -- | Sound File | +| `DEMO4.MYM` | -- | Sound File | +| `HOWRU.PT3` | -- | Sound File | +| `ITERATN.PT3` | -- | Sound File | +| `LOOKBACK.PT3` | -- | Sound File | +| `LOUBOUTN.PT3` | -- | Sound File | +| `NAMIDA.PT3` | -- | Sound File | +| `RECOLL.PT3` | -- | Sound File | +| `SANXION.PT3` | -- | Sound File | +| `SYNCH.PT3` | -- | Sound File | +| `TOSTAR.PT3` | -- | Sound File | +| `VICTORY.PT3` | -- | Sound File | +| `WICKED.PT3` | -- | Sound File | +| `YEOLDE.PT3` | -- | Sound File | +| `YEOVIL.PT3` | -- | Sound File | + +`\clearpage`{=latex} + +# NZCOM Boot Disk + +| Floppy Disk Image: **fd_nzcom.img** +| Hard Disk Image: **hd_nzcom.img** +| Combo Disk Image: **Slice 2** + +| **User 0** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `!(C)1988` | NZCOM | | +| `!NZ-COM` | NZCOM | | +| `!VERS--1.2H` | NZCOM | | +| `ALIAS.CMD` | NZCOM | NZCOM Aliases file for ARUNZ.COM | +| `ARUNZ.COM` | NZCOM | NZCOM Invoke an alias in ALIAS.CMD | +| `BGZRDS19.LBR` | NZCOM | | +| `CLEDINST.COM` | NZCOM | Command line editing and history shell installer | +| `CLEDSAVE.COM` | NZCOM | Write command line history to disk | +| `CONFIG.LBR` | NZCOM | | +| `COPY.COM` | NZCOM | ZSDOS File copier with file dates and archiving | +| `CPSET.COM` | NZCOM | NZCOM Create multiple definitions for CRT and PRT | +| `CRUNCH.COM` | NZCOM | NZCOM Text compression | +| `DOCFILES.LBR` | NZCOM | | +| `EDITNDR.COM` | NZCOM | NZCOM Associate names with directories | +| `FCP.LBR` | NZCOM | NZCOM ??? Flow control | +| `FF.COM` | NZCOM | NZCOM File finder | +| `HELP.COM` | NZCOM | DRI CPM+ | +| `HLPFILES.LBR` | NZCOM | | +| `IF.COM` | NZCOM | NZCOM Flow condition tester for FCP | +| `JETLDR.COM` | NZCOM | NZCOM General-purpose module loader | +| `KERMIT.COM` | -- | Generic CP/M 2.2 Kermit communication application | +| `LBREXT.COM` | NZCOM | Extract library files | +| `LBRHELP.COM` | NZCOM | | +| `LDIR.COM` | NZCOM | NZCOM Display the directory of a library | +| `LPUT.COM` | NZCOM | NZCOM Put files into a library | +| `LSH-HELP.COM` | NZCOM | | +| `LSH.COM` | NZCOM | | +| `LSH.WZ` | NZCOM | | +| `LSHINST.COM` | NZCOM | | +| `LX.COM` | NZCOM | NZCOM Extract and execute a memeber of a library | +| `MKZCM.COM` | NZCOM | NZCOM NZCOM system defining utility | +| `NAME.COM` | NZCOM | NZCOM Name a drive/user | +| `NZ-DBASE.INF` | NZCOM | NZCOM Dbase information | +| `NZBLITZ.COM` | NZCOM | | +| `NZBLTZ14.CFG` | NZCOM | | +| `NZBLTZ14.HZP` | NZCOM | | +| `NZCOM.COM` | NZCOM | NZCOM system loader from CP/M | +| `NZCOM.LBR` | NZCOM | NZCOM Library of NZCOM system modules | +| `NZCPR.LBR` | NZCOM | NZCOM Default command processor | +| `PATH.COM` | NZCOM | NZCOM Set/display command search path | +| `PUBLIC.COM` | NZCOM | | +| `PWD.COM` | NZCOM | | +| `RCP.LBR` | NZCOM | NZCOM Resident command package | +| `RELEASE.NOT` | NZCOM | | +| `SAINST.COM` | NZCOM | | +| `SALIAS.COM` | NZCOM | NZCOM Screen alias | +| `SAVENDR.COM` | NZCOM | NZCOM Save named directory assignments to a file | +| `SDZ.COM` | NZCOM | NZCOM Super directory | +| `SHOW.COM` | NZCOM | NZCOM Show resident commands | +| `SUB.COM` | NZCOM | | +| `SUBMIT.COM` | -- | DRI batch processor | +| `TCAP.LBR` | NZCOM | NZCOM Terminal capability descriptor library | +| `TCJ.INF` | NZCOM | | +| `TCJ25.WZ` | NZCOM | | +| `TCJ26.WZ` | NZCOM | | +| `TCJ27.WZ` | NZCOM | | +| `TCJ28.WZ` | NZCOM | | +| `TCJ29.WZ` | NZCOM | | +| `TCJ30.WZ` | NZCOM | | +| `TCJ31UPD.WZ` | NZCOM | | +| `TCJ32.WZ` | NZCOM | | +| `TCJ33UPD.WZ` | NZCOM | | +| `TCSELECT.COM` | NZCOM | NZCOM Create terminal capability file | +| `TY3ERA.COM` | NZCOM | NZCOM Type-3 transient program to erase a file | +| `TY3REN.COM` | NZCOM | NZCOM Type-3 transient program to rename a file | +| `TY4ERA.COM` | NZCOM | NZCOM Type-4 transient program to erase a file | +| `TY4REN.COM` | NZCOM | NZCOM Type-4 transient program to rename a file | +| `TY4SAVE.COM` | NZCOM | NZCOM Type-4 transient program to save memory to a file | +| `TY4SP.COM` | NZCOM | NZCOM Type-4 transient program ti display disk space | +| `UNCRUNCH.COM` | NZCOM | NZCOM Text decompressor | +| `VIEW.COM` | NZCOM | | +| `XTCAP.COM` | NZCOM | | +| `Z3LOC.COM` | NZCOM | NZCOM Display the addresses of the ZCPR3 CCP, BDOS, and BIOS | +| `Z3TCAP.TCP` | NZCOM | NZCOM Database of terminal descriptors | +| `ZCNFG.COM` | NZCOM | ZSDOS Configure various utilities | +| `ZERR.COM` | NZCOM | | +| `ZEX.COM` | NZCOM | NZCOM Memory-based batch processor | +| `ZF-DIM.COM` | NZCOM | NZCOM ZFILER shell for dim-video terminals | +| `ZF-REV.COM` | NZCOM | NZCOM ZFILER shell for reverse-video terminals | +| `ZFILEB38.LZT` | NZCOM | | +| `ZFILER.CMD` | NZCOM | NZCOM Macro script file for ZFILER | +| `ZHELPERS.LZT` | NZCOM | | +| `ZLT.COM` | NZCOM | | +| `ZNODES66.LZT` | NZCOM | | +| `ZSDOS.ZRL` | NZCOM | | +| `ZSYSTEM.IZF` | NZCOM | | +| `ASSIGN.COM` | RomWBW | RomWBW Drive/Slice mapper | +| `FAT.COM` | RomWBW | RomWBW FAT filesystem access | +| `FDU.COM` | RomWBW | RomWBW Floppy Disk Utility | +| `FORMAT.COM` | RomWBW | RomWBW media formatter (placeholder) | +| `INTTEST.COM` | RomWBW | RomWBW Interrupt test | +| `MODE.COM` | RomWBW | RomWBW Modify serial port characteristics | +| `RTC.COM` | RomWBW | RomWBW Display and set RTC | +| `SURVEY.COM` | RomWBW | System survey | +| `SYSCOPY.COM` | RomWBW | RomWBW Read/write system boot image | +| `SYSGEN.COM` | RomWBW | DRI CPM SYSGEN to put CPM onto a new drive | +| `TALK.COM` | RomWBW | RomWBW Direct console I/O to a serial port | +| `TIMER.COM` | RomWBW | RomWBW Display timer tick counter | +| `TUNE.COM` | RomWBW | RomWBW Play PT or MYM sound files | +| `XM.COM` | RomWBW | RomWBW XMODEM file transfer | +| `CPM.SYS` | RomWBW | | +| `ZSYS.SYS` | RomWBW | | +| `CLRDIR.COM` | -- | Max Scane's disk directory cleaner | +| `COMPARE.COM` | -- | FoxHollow compare two files | +| `DDTZ.COM` | -- | Z80 replacement for DDT | +| `FDISK80.COM` | -- | John Coffman's Partition editor for FAT filesystem | +| `FLASH.COM` | -- | Will Sowerbutts' in-situ EEPROM programmer | +| `NULU.COM` | -- | NZCOM new library utility | +| `UNARC.COM` | -- | Extractor for ARC archives | +| `ZAP.COM` | -- | Disk editor/patcher | +| `ZDE.COM` | -- | Z-system display editor | +| `ZDENST.COM` | -- | ZDE Installer | + +| **User 3** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `ATTACK.PT3` | -- | Sound File | +| `BACKUP.PT3` | -- | Sound File | +| `BADMICE.PT3` | -- | Sound File | +| `DEMO.MYM` | -- | Sound File | +| `DEMO1.MYM` | -- | Sound File | +| `DEMO3.MYM` | -- | Sound File | +| `DEMO3MIX.MYM` | -- | Sound File | +| `DEMO4.MYM` | -- | Sound File | +| `HOWRU.PT3` | -- | Sound File | +| `ITERATN.PT3` | -- | Sound File | +| `LOOKBACK.PT3` | -- | Sound File | +| `LOUBOUTN.PT3` | -- | Sound File | +| `NAMIDA.PT3` | -- | Sound File | +| `RECOLL.PT3` | -- | Sound File | +| `SANXION.PT3` | -- | Sound File | +| `SYNCH.PT3` | -- | Sound File | +| `TOSTAR.PT3` | -- | Sound File | +| `VICTORY.PT3` | -- | Sound File | +| `WICKED.PT3` | -- | Sound File | +| `YEOLDE.PT3` | -- | Sound File | +| `YEOVIL.PT3` | -- | Sound File | + +`\clearpage`{=latex} + +# CP/M 3 Boot Disk + +| Floppy Disk Image: **fd_cpm3.img** +| Hard Disk Image: **hd_cpm3.img** +| Combo Disk Image: **Slice 3** + +| **User 0** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `DATE.COM` | CPM3 | DRI CPM+ Set or display the date and time | +| `DEVICE.COM` | CPM3 | DRI CPM+ Assign logical devices with one or more physical devices | +| `DIR.COM` | CPM3 | DRI CPM+ DIR with options | +| `DUMP.COM` | CPM3 | DRI type contents of disk file in hex | +| `ED.COM` | CPM3 | DRI context editor | +| `ERASE.COM` | CPM3 | DRI file deletion | +| `GENCOM.COM` | CPM3 | DRI CPM+ Generate special COM file with attached RSX files | +| `GET.COM` | CPM3 | DRI CPM+ Temporarily get console input form a disk file | +| `HELP.COM` | CPM3 | DRI CPM+ Display information on how to use commands | +| `HELP.HLP` | CPM3 | DRI CPM+ Databse of help information for HELP.COM | +| `HEXCOM.CPM` | CPM3 | DRI CPM+ Create a COM file from a nex file output by MAC | +| `INITDIR.COM` | CPM3 | DRI CPM+ Initializes a disk to allow time and date stamping | +| `KERMIT.COM` | -- | Generic CP/M 3 Kermit communication application | +| `PATCH.COM` | CPM3 | DRI CPM+ Display or install patch to the CPM+ system or command files | +| `PIP.COM` | CPM3 | DRI Periperal Interchange Program | +| `PUT.COM` | CPM3 | DIR CPM+ Temporarily redirect printer or console output to a disk file | +| `RENAME.COM` | CPM3 | DRI CPM+ Rename a file | +| `ROMWBW.TXT` | RomWBW | | +| `SAVE.COM` | CPM3 | DRI CPM+ Copy the contents of memory to a file | +| `SET.COM` | CPM3 | DIR CPM+ Set file options | +| `SETDEF.COM` | CPM3 | DIR CPM+ Set system options including the drive search chain | +| `SHOW.COM` | CPM3 | DIR CPM+ Display disk and drive statistics | +| `SUBMIT.COM` | CPM3 | DRI batch processor | +| `TYPE.COM` | CPM3 | DIR CPM+ Display the contents of an ASCII character file | +| `ZSID.COM` | CPM3 | DRI Z80 symbolic instruction debugger | +| `CPMLDR.COM` | RomWBW | DRI CPM 3.0 loader | +| `CPMLDR.SYS` | RomWBW | DRI CPM 3.0 loader | +| `CCP.COM` | CPM3 | DRI CPM+ Console Command Processor | +| `GENCPM.COM` | CPM3 | DRI CPM+ Create a memory image of CPM3.SYS | +| `GENRES.DAT` | RomWBW | | +| `GENBNK.DAT` | RomWBW | | +| `BIOS3.SPR` | RomWBW | DRI CPM+ GENCPM input file for non-banked BIOS | +| `BNKBIOS3.SPR` | RomWBW | DRI CPM+ GENCPM input file for banked BIOS | +| `BDOS3.SPR` | CPM3 | DRI CPM+ GENCPM input file for the non-banked BDOS | +| `BNKBDOS3.SPR` | CPM3 | DRI CPM+ GENCPM input file for banked BDOS | +| `RESBDOS3.SPR` | CPM3 | DRI CPM+ GENCPM input file for resident BDOS | +| `CPM3RES.SYS` | RomWBW | DRI CPM+ (non-banked) memory image | +| `CPM3BNK.SYS` | RomWBW | DRI CPM+ (banked) memory image | +| `GENCPM.DAT` | RomWBW | DRI CPM+ System generation tool data file | +| `CPM3.SYS` | RomWBW | DRI CPM+ (non-banked) memory image | +| `README.1ST` | CPM3 | | +| `CPM3FIX.PAT` | CPM3 | | +| `ASSIGN.COM` | RomWBW | RomWBW Drive/Slice mapper | +| `FAT.COM` | RomWBW | RomWBW FAT filesystem access | +| `FDU.COM` | RomWBW | RomWBW Floppy Disk Utility | +| `FORMAT.COM` | RomWBW | RomWBW media formatter (placeholder) | +| `INTTEST.COM` | RomWBW | RomWBW Interrupt test | +| `MODE.COM` | RomWBW | RomWBW Modify serial port characteristics | +| `RTC.COM` | RomWBW | RomWBW Display and set RTC | +| `SURVEY.COM` | RomWBW | System survey | +| `SYSCOPY.COM` | RomWBW | RomWBW Read/write system boot image | +| `SYSGEN.COM` | RomWBW | DRI CPM SYSGEN to put CPM onto a new drive | +| `TALK.COM` | RomWBW | RomWBW Direct console I/O to a serial port | +| `TIMER.COM` | RomWBW | RomWBW Display timer tick counter | +| `TUNE.COM` | RomWBW | RomWBW Play PT or MYM sound files | +| `XM.COM` | RomWBW | RomWBW XMODEM file transfer | +| `CLRDIR.COM` | -- | Max Scane's disk directory cleaner | +| `COMPARE.COM` | -- | FoxHollow compare two files | +| `DDTZ.COM` | -- | Z80 replacement for DDT | +| `FDISK80.COM` | -- | John Coffman's Partition editor for FAT filesystem | +| `FLASH.COM` | -- | Will Sowerbutts' in-situ EEPROM programmer | +| `NULU.COM` | -- | NZCOM new library utility | +| `UNARC.COM` | -- | Extractor for ARC archives | +| `ZAP.COM` | -- | Disk editor/patcher | +| `ZDE.COM` | -- | Z-system display editor | +| `ZDENST.COM` | -- | ZDE Installer | + +| **User 3** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `ATTACK.PT3` | -- | Sound File | +| `BACKUP.PT3` | -- | Sound File | +| `BADMICE.PT3` | -- | Sound File | +| `DEMO.MYM` | -- | Sound File | +| `DEMO1.MYM` | -- | Sound File | +| `DEMO3.MYM` | -- | Sound File | +| `DEMO3MIX.MYM` | -- | Sound File | +| `DEMO4.MYM` | -- | Sound File | +| `HOWRU.PT3` | -- | Sound File | +| `ITERATN.PT3` | -- | Sound File | +| `LOOKBACK.PT3` | -- | Sound File | +| `LOUBOUTN.PT3` | -- | Sound File | +| `NAMIDA.PT3` | -- | Sound File | +| `RECOLL.PT3` | -- | Sound File | +| `SANXION.PT3` | -- | Sound File | +| `SYNCH.PT3` | -- | Sound File | +| `TOSTAR.PT3` | -- | Sound File | +| `VICTORY.PT3` | -- | Sound File | +| `WICKED.PT3` | -- | Sound File | +| `YEOLDE.PT3` | -- | Sound File | +| `YEOVIL.PT3` | -- | Sound File | + +`\clearpage`{=latex} + +# ZPM3 Boot Disk + +| Floppy Disk Image: **fd_zpm3.img** +| Hard Disk Image: **hd_zpm3.img** +| Combo Disk Image: **Slice 4** + +| **User 0** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `HELP.HLP` | ZPM3 | | +| `ROMWBW.TXT` | RomWBW | | +| `ZPMLDR.COM` | RomWBW | | +| `ZPMLDR.SYS` | RomWBW | | +| `CPMLDR.COM` | RomWBW | | +| `CPMLDR.SYS` | RomWBW | | +| `CPM3.SYS` | RomWBW | | +| `ZCCP.COM` | ZPM3 | | +| `ZINSTAL.ZPM` | ZPM3 | | +| `STARTZPM.COM` | ZPM3 | | +| `MAKEDOS.COM` | ZPM3 | | +| `GENCPM.DAT` | RomWBW | | +| `BNKBIOS3.SPR` | RomWBW | | +| `BNKBDOS3.SPR` | ZPM3 | | +| `RESBDOS3.SPR` | ZPM3 | | + +| **User 3** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `ATTACK.PT3` | -- | Sound File | +| `BACKUP.PT3` | -- | Sound File | +| `BADMICE.PT3` | -- | Sound File | +| `DEMO.MYM` | -- | Sound File | +| `DEMO1.MYM` | -- | Sound File | +| `DEMO3.MYM` | -- | Sound File | +| `DEMO3MIX.MYM` | -- | Sound File | +| `DEMO4.MYM` | -- | Sound File | +| `HOWRU.PT3` | -- | Sound File | +| `ITERATN.PT3` | -- | Sound File | +| `LOOKBACK.PT3` | -- | Sound File | +| `LOUBOUTN.PT3` | -- | Sound File | +| `NAMIDA.PT3` | -- | Sound File | +| `RECOLL.PT3` | -- | Sound File | +| `SANXION.PT3` | -- | Sound File | +| `SYNCH.PT3` | -- | Sound File | +| `TOSTAR.PT3` | -- | Sound File | +| `VICTORY.PT3` | -- | Sound File | +| `WICKED.PT3` | -- | Sound File | +| `YEOLDE.PT3` | -- | Sound File | +| `YEOVIL.PT3` | -- | Sound File | + +| **User 10** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `ALIAS.HLP` | -- | | +| `HP-RPN.HLP` | -- | | +| `HP-ZP.HLP` | -- | | +| `IF.HLP` | -- | | +| `MENU.HLP` | -- | | +| `VLU.HLP` | -- | | +| `ZFHIST.HLP` | -- | | +| `ZFILER.HLP` | -- | | +| `ZFMACRO.HLP` | -- | | +| `ZP.HLP` | -- | | + +| **User 14** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `COPY.CFG` | -- | | +| `ERASE.CFG` | -- | | +| `HELPC15.CFG` | -- | | +| `ZCNFG24.CFG` | -- | | +| `ZEX.CFG` | -- | | +| `ZF11.CFG` | -- | | +| `ZP17.CFG` | -- | | + +| **User 15** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `ALIAS.COM` | -- | | +| `ARUNZ.COM` | -- | | +| `COPY.COM` | -- | | +| `DATE.COM` | CPM3 | | +| `DEV.COM` | -- | | +| `DEVICE.COM` | CPM3 | | +| `DIR.COM` | CPM3 | | +| `DISKINFO.COM` | -- | | +| `DU.COM` | -- | | +| `DUMP.COM` | CPM3 | | +| `ED.COM` | CPM3 | | +| `ERASE.COM` | CPM3 | | +| `GENCOM.COM` | CPM3 | | +| `GENCPM.COM` | CPM3 | | +| `GET.COM` | CPM3 | | +| `GOTO.COM` | -- | | +| `HELP.COM` | CPM3 | | +| `HEXCOM.COM` | CPM3 | | +| `IF.COM` | -- | | +| `INITDIR.COM` | CPM3 | | +| `KERMIT.COM` | CPM3 | | +| `LBREXT.COM` | -- | | +| `LIB.COM` | -- | | +| `LINK.COM` | -- | | +| `LOADSEG.COM` | -- | | +| `MAC.COM` | -- | | +| `MBASIC.COM` | -- | | +| `NAMES.NDR` | -- | | +| `PATCH.COM` | CPM3 | | +| `PIP.COM` | CPM3 | | +| `PUT.COM` | CPM3 | | +| `REMOVE.COM` | -- | | +| `RENAME.COM` | CPM3 | | +| `RMAC.COM` | -- | | +| `RSXDIR.COM` | -- | | +| `SAINST.COM` | -- | | +| `SALIAS.COM` | -- | | +| `SAVE.COM` | CPM3 | | +| `SET.COM` | CPM3 | | +| `SETDEF.COM` | CPM3 | | +| `SETPATH.COM` | -- | | +| `SHOW.COM` | CPM3 | | +| `SUBMIT.COM` | CPM3 | | +| `TCAP.Z3T` | -- | | +| `TYPE.COM` | CPM3 | | +| `VERROR.COM` | -- | | +| `VLU.COM` | -- | | +| `XREF.COM` | -- | | +| `ZCNFG.COM` | -- | | +| `ZERASE.COM` | -- | | +| `ZEX.COM` | -- | | +| `ZFILER.COM` | -- | | +| `ZHELP.COM` | -- | | +| `ZP.COM` | -- | | +| `ZSHOW.COM` | -- | | +| `ZSID.COM` | -- | | +| `ZXD.COM` | -- | | +| `AUTOTOG.COM` | ZPM3 | | +| `CLRHIST.COM` | ZPM3 | | +| `SETZ3.COM` | ZPM3 | | +| `ASSIGN.COM` | RomWBW | | +| `FAT.COM` | RomWBW | | +| `FDU.COM` | RomWBW | | +| `FORMAT.COM` | RomWBW | | +| `INTTEST.COM` | RomWBW | | +| `MODE.COM` | RomWBW | | +| `RTC.COM` | RomWBW | | +| `SURVEY.COM` | RomWBW | | +| `SYSCOPY.COM` | RomWBW | | +| `SYSGEN.COM` | RomWBW | | +| `TALK.COM` | RomWBW | | +| `TIMER.COM` | RomWBW | | +| `TUNE.COM` | RomWBW | | +| `XM.COM` | RomWBW | | +| `CLRDIR.COM` | -- | | +| `COMP.COM` | -- | | +| `DDTZ.COM` | -- | | +| `FDISK80.COM` | -- | | +| `FLASH.COM` | -- | | +| `NULU.COM` | -- | | +| `TCVIEW.COM` | -- | | +| `UNARC.COM` | -- | | +| `Z3LOC.COM` | -- | | +| `ZAP.COM` | -- | | +| `ZDE.COM` | -- | | +| `ZDENST.COM` | -- | | + +`\clearpage`{=latex} + +# WordStar 4 Application Disk + +| Floppy Disk Image: **fd_ws4.img** +| Hard Disk Image: **hd_ws4.img** +| Combo Disk Image: **Slice 5** + +| **User 0** | **Source** | **Description** | +| -------------- | ---------- | ------------------------------------------------------------ | +| `ANAGRAM.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `CHAPTER1.DOC` | WS4 | MicroPro WordStar 4 Distribution File | +| `CHAPTER2.DOC` | WS4 | MicroPro WordStar 4 Distribution File | +| `CHAPTER3.DOC` | WS4 | MicroPro WordStar 4 Distribution File | +| `DIARY.DOC` | WS4 | MicroPro WordStar 4 Distribution File | +| `DICTSORT.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `FIND.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `HOMONYMS.TXT` | WS4 | MicroPro WordStar 4 Distribution File | +| `HYEXCEPT.TXT` | WS4 | MicroPro WordStar 4 Distribution File | +| `HYPHEN.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `LOOKUP.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `MAINDICT.CMP` | WS4 | MicroPro WordStar 4 Distribution File | +| `MARKFIX.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `MOVEPRN.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `PATCH.LST` | WS4 | MicroPro WordStar 4 Distribution File | +| `PRINT.TST` | WS4 | MicroPro WordStar 4 Distribution File | +| `READ.ME` | WS4 | MicroPro WordStar 4 Distribution File | +| `README.` | WS4 | MicroPro WordStar 4 Distribution File | +| `REVIEW.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `RULER.DOC` | WS4 | MicroPro WordStar 4 Distribution File | +| `SAMPLE1.DOC` | WS4 | MicroPro WordStar 4 Distribution File | +| `SAMPLE2.DOC` | WS4 | MicroPro WordStar 4 Distribution File | +| `SAMPLE3.DOC` | WS4 | MicroPro WordStar 4 Distribution File | +| `SPELL.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `TABLE.DOC` | WS4 | MicroPro WordStar 4 Distribution File | +| `TEXT.DOC` | WS4 | MicroPro WordStar 4 Distribution File | +| `TW.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `WC.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `WINSTALL.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `WORDFREQ.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `WS.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `WS.OVR` | WS4 | MicroPro WordStar 4 Distribution File | +| `WSCHANGE.COM` | WS4 | MicroPro WordStar 4 Distribution File | +| `WSCHANGE.OVR` | WS4 | MicroPro WordStar 4 Distribution File | +| `WSCHHELP.OVR` | WS4 | MicroPro WordStar 4 Distribution File | +| `WSHELP.OVR` | WS4 | MicroPro WordStar 4 Distribution File | +| `WSINDEX.XCL` | WS4 | MicroPro WordStar 4 Distribution File | +| `WSMSGS.OVR` | WS4 | MicroPro WordStar 4 Distribution File | +| `WSPRINT.OVR` | WS4 | MicroPro WordStar 4 Distribution File | +| `WSSHORT.OVR` | WS4 | MicroPro WordStar 4 Distribution File | diff --git a/Source/Doc/Clean.cmd b/Source/Doc/Clean.cmd new file mode 100644 index 00000000..6eccea83 --- /dev/null +++ b/Source/Doc/Clean.cmd @@ -0,0 +1,15 @@ +@echo off +setlocal + +if exist *.gfm del *.gfm +if exist *.txt del *.txt +if exist *.dw del *.dw +if exist *.html del *.html +if exist *.tex del *.tex +if exist *.pdf del *.pdf +if exist *.tmp del *.tmp +if exist *.aux del *.aux +if exist *.ilg del *.ilg +if exist *.ind del *.ind +if exist *.log del *.log +if exist *.toc del *.toc \ No newline at end of file diff --git a/Source/Doc/Common.inc b/Source/Doc/Common.inc deleted file mode 100644 index 71a252d8..00000000 --- a/Source/Doc/Common.inc +++ /dev/null @@ -1,7 +0,0 @@ -!def(ver)(3.0.1) -!def(date)(!mdate) -!def(product)(RomWBW) -!def(author)(Wayne Warthen) -!def(authmail)(wwarthen@gmail.com) -!def(orgname)(RetroBrew Computers Group) -!def(orgurl)(www.retrobrewcomputers.org) \ No newline at end of file diff --git a/Source/Doc/Errata.md b/Source/Doc/Errata.md new file mode 100644 index 00000000..892f2ece --- /dev/null +++ b/Source/Doc/Errata.md @@ -0,0 +1,19 @@ +$define{doc_title}{Errata}$ +$include{"Book.h"}$ + +# Errata + +The following errata apply to $doc_product$ $doc_ver$: + +* The use of high density floppy disks requires a CPU speed of 8 MHz or + greater. + +* The PropIO support is based on RomWBW specific firmware. Be sure to + program/update your PropIO firmware with the corresponding firmware + image provided in the Binary directory of the RomWBW distribution. + +* Reading bytes from the video memory of the VDU board (not Color + VDU) appears to be problematic. This is only an issue when the driver + needs to scroll a portion of the screen which is done by applications + such as WordStar or ZDE. You are likely to see screen corruption in + this case. \ No newline at end of file diff --git a/Source/Doc/GettingStarted.md b/Source/Doc/GettingStarted.md deleted file mode 100644 index c3d486d7..00000000 --- a/Source/Doc/GettingStarted.md +++ /dev/null @@ -1,1222 +0,0 @@ -!include(Common.inc) -!def(document)(Getting Started) ---- -title: | - | !product - | - | !document -author: !author (mailto:!authmail) -date: !date -institution: !orgname -documentclass: article -classoption: - - oneside -toc: true -papersize: letter -geometry: - - top=1.5in - - bottom=1.5in - - left=1.5in - - right=1.5in -# - showframe -linestretch: 1.25 -colorlinks: true -fontfamily: helvet -fontsize: 12pt -header-includes: - - | - ```{=latex} - \renewcommand*{\familydefault}{\sfdefault} - \setstretch{1.25} % for TOC - ``` ---- - -`\clearpage % new page after TOC`{=latex} - -# RomWBW - -## Z80/Z180 System Software - -| Version !ver -| !date - -!author() [!authmail](mailto:!authmail) - -### Download - -* [RomWBW Distribution Package](https://github.com/wwarthen/RomWBW/releases) - -### Related Pages - -* [RomWBW Architecture Document](https://www.retrobrewcomputers.org/lib/exe/fetch.php?media=software:firmwareos:romwbw:romwbw_architecture.pdf) -* [RomWBW Applications](https://www.retrobrewcomputers.org/doku.php?id=software:firmwareos:romwbw:apps) -* [RomWBW Errata](https://www.retrobrewcomputers.org/doku.php?id=software:firmwareos:romwbw:errata) - -# Overview - -RomWBW provides a complete software system for a wide variety of hobbyist -Z80/Z180 CPU-based systems produced by these developer communities: - -* [RetroBrew Computers](https://www.retrobrewcomputers.org) -* [RC2014](https://rc2014.co.uk) -* [retro-comp](https://groups.google.com/forum/#!forum/retro-comp) - -General features include: - -* Banked memory services for several banking designs -* Disk drivers for RAM, ROM, Floppy, IDE, CF, and SD -* Serial drivers including UART (16550-like), ASCI, ACIA, SIO -* Video drivers including TMS9918, SY6545, MOS8563, HD6445 -* Real time clock drivers including DS1322, BQ4845 -* Multiple OS support including CP/M 2.2, ZSDOS, CP/M 3, ZPM3 -* Built-in VT-100 terminal emulation support - -RomWBW is distributed as both source code and pre-built ROM and disk -images. Some of the provided software can be launched directly from the -ROM firmware itself: - -* System Monitor -* Operating Systems (CP/M 2.2, ZSDOS) -* ROM BASIC (Nascom BASIC and Tasty BASIC) -* ROM Forth - -A dynamic disk drive letter assignment mechanism allows mapping -operating system drive letters to any available disk media. -Additionally, mass media devices (IDE Disk, CF Card, SD Card) support -the use of multiple slices (up to 256 per device). Each slice contains -a complete CP/M filesystem and can be mapped independently to any -drive letter. This overcomes the inherent size limitations in legacy -OSes and allows up to 2GB of accessible storage on a single device. - -The pre-built ROM firmware images are generally optimal for most -users. However, it is also very easy to modify and build custom ROM -images that fully tailor the firmware to your specific preferences. -All tools required to build custom ROM firmware are included -- no -need to install assemblers, etc. Any modern computer running Windows, -Linux, or MacOS can be used. - -Multiple disk images are provided in the distribution. Most disk -images contain a complete, bootable, ready-to-run implementation of a -specific operating system. A "combo" disk image contains multiple -slices, each with a full operating system implementation. If you use -this disk image, you can easily pick whichever operating system you -want to boot without changing media. - -# Installation - -The latest RomWBW distribution downloads are maintained on GitHub in the -[RomWBW Repository](https://github.com/wwarthen/RomWBW). The fully-built -distributions are found on the -[releases page](https://github.com/wwarthen/RomWBW/releases) of the -repository. On this page, you will probably see both pre-releases as -well as normal releases. Unless you have a specific reason, I suggest -you stick to the most recent normal release (not pre-release). Expand -the "Assets" drop-down for the release you want to download, then -select the asset named RomWBW-vX.X.X-Package.zip. The Package asset -includes all pre-built ROM and Disk images as well as full source -code. The other assets are Source Code only and do not have the -pre-built ROM or disk images. - -The pre-built ROM images will automatically detect and support a -reasonable range of devices including serial ports, video adapters, -on-board disk interfaces, and PropIO/ParPortProp boards without -building a custom ROM. The distribution is a .zip archive. After -downloading it to a working directory on your modern computer -(Windows/Linux/Mac) use any zip tool to extract the contents of the -archive. - -In general, you will just program your system's ROM chip with the -appropriate ROM image from the RomWBW distribution. Depending on how -you got your system, you may have already been provided with a -pre-programmed ROM chip. If so, use that initially. Otherwise, you -will need to use a ROM programmer to initially program your ROM chip. -Please refer to the documentation that came with your ROM programmer -for more information. Once you have a running RomWBW system, you can -generally update your ROM to a newer version in-situ with an included -ROM Flashing tool (Will Sowerbutts' FLASH application) as described in -the Upgrading section below. - -Looking at the extracted distribution archive, You will see that the -distribution is broken up into a few sub-directories. The Binary -directory contains the pre-built ROM and disk images. The ROM image -files all end in ".rom". Based on the table below, **carefully** pick -the appropriate ROM image for your hardware. - -| Platform | ROM Image File | Baud | Description | -| -------------- | ------------------------ | ----------: | ------------------------------------------------ | -| SBC | SBC_std.rom | 38400 | RetroBrew SBC v1 or v2 ECB Z80 | -| Zeta V1 | ZETA_std.rom | 38400 | RetroBrew Zeta V1 Z80, ParPortProp (optional) | -| Zeta V2 | ZETA2_std.rom | 38400 | RetroBrew Zeta V2 Z80, ParPortProp (optional) | -| N8 | N8_std.rom | 38400 | RetroBrew N8 Z180, date code >= 2312 | -| Mark IV | MK4_std.rom | 38400 | RetroBrew Mark IV ECB Z180 | -| RC Z80 | RCZ80_std.rom | 115200 | RC2014 w/ Z80 CPU, requires 512K RAM/ROM module | -| RC Z180\* | RCZ180_ext.rom | 115200 | RC2014 w/ Z180 CPU & 512K banked RAM/ROM module | -| RC Z180\* | RCZ180_nat.rom | 115200 | RC2014 w/ Z180 CPU & 512K native RAM/ROM module | -| Easy Z80 | EZZ80_std.rom | 115200 | Sergey Kiselev's Easy Z80 | -| Tiny Z80 | EZZ80_tz80.rom | 115200 | Sergey Kiselev's Tiny Z80 | -| SC126 | SCZ180_126.rom | 115200 | Stephen Cousin's SC126 Z180 | -| SC130 | SCZ180_130.rom | 115200 | Stephen Cousin's SC130 Z180 | -| SC131 | SCZ180_131.rom | 115200 | Stephen Cousin's SC131 Z180 | -| Dyno | DYNO_std.rom | 38400 | Steve Garcia's Z180 Dyno Computer | - -\*The RC2014 Z180 requires a separate RAM/ROM memory module. There are -two types of these modules and you must pick the ROM for your type of -memory module. The "ext" ROM supports Spencer's official 512K RAM/ROM -banked memory module. The "nat" ROM supports any of the third-party -Z180 native memory modules. - -RomWBW will automatically attempt to detect and support typical add-on -components for each of the systems supported. More information on the -required system configuration and optional supported components for -each ROM is found in the file called "RomList.txt" in the Binary -directory. All pre-built ROM images are simple 512KB binary images. If -your system utilizes a larger ROM chip, you can just program the -image into the first 512KB of the ROM. - -Connect a serial terminal or computer with terminal emulation software -to the primary serial port of your CPU board. You may need to refer -to your hardware provider's documentation for details. A null-modem -connection may be required. Set the baud rate as indicated in the -table above. Set the line characteristics to 8 data bits, 1 stop bit, -no parity, and no flow control. If possible, 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, application, or boot -from a disk device. - -Initially, you should try the ROM boot options. By selecting either -CP/M 2.2 or Z-System, the selected operating system will be loaded -from ROM and you will see the a `B>` disk prompt. In this scenario, A: -will be an empty RAM disk and B: will refer to your ROM disk -containing some common applications. This provides a simple -environment for learning to use your system. Be aware that files saved -to the RAM disk (A:) will disappear at the next power on (RAM is -generally not persistent). Also note that attempts to save files to -the ROM disk (B:) will fail because ROM is not writable. - -# General Usage - -Each of the operating systems and ROM applications included with -RomWBW are sophisticated tools in their own right. It is not -reasonable to document their usage here. However, you will find -complete manuals in PDF format in the Doc directory of the -distribution. The intention of this section is to document the RomWBW -specific enhancements to these operating systems. - -## Inbuilt ROM Applications - -In addition to CP/M 2.2 and Z-System, there are several ROM -applications that can be launched directly from ROM. These -applications are not hosted by an operating system and so they are -unable to save files to disk devices. - -The following ROM applications are available at the boot loader prompt: - -| Application | | -| ----------- | -------------------------------------------------------------- | -| Monitor | Z80 system debug monitor w/ Intel Hex loader | -| Forth | Brad Rodriguez's ANSI compatible Forth language | -| Basic | Nascom 8K BASIC language | -| Tasty BASIC | Dimitri Theuling's Tiny BASIC implementation | -| Play | A simple video game (requires ANSI terminal emulation) | - -In general, the command to exit these applications and restart the -system is `BYE`. The exceptions are the Monitor which uses `B` and -Play which uses `Q`. - -Space is available in the ROM image for the inclusion of other -software. Any inbuilt application can be set up to launch -automatically at startup. - -## Devices and Units - -In order to support a wide variety of hardware, RomWBW HBIOS uses a -modular approach to implementing device drivers and presenting devices -to the operating system. In general, all devices are classified as -one of the following: - -* Disk (Hard Disk, CF Card, SD Card, RAM/ROM Disk, etc.) -* Character (Serial Ports, Parallel Ports, etc.) -* Video (Video Display/Keyboard Interfaces) -* RTC/NVRAM (Real Time Clock, Non-volatile RAM) - -HBIOS uses the concept of unit numbers to present a complex set of -hardware devices to the operating system. As an example, a typical -system might have a ROM Disk, RAM Disk, Floppy Drives, and Disk -Drives. All of these are considered Disk devices and are presented -to the operating system as generic block devices. This means that -the operating system does not need to understand the difference between -a floppy drive and a ROM disk. - -As RomWBW boots, it assigns a unit number to each device. This unit -number is used by the operating system to refer to the device. It is, -therefore, important to know the unit number assigned to each device. -This information is displayed in the unit summary table at startup. -Here is an example: - -``` -Unit Device Type Capacity/Mode ----------- ---------- ---------------- -------------------- -Char 0 UART0: RS-232 38400,8,N,1 -Char 1 UART1: RS-232 38400,8,N,1 -Disk 0 MD1: RAM Disk 384KB,LBA -Disk 1 MD0: ROM Disk 384KB,LBA -Disk 2 FD0: Floppy Disk 3.5",DS/HD,CHS -Disk 3 FD1: Floppy Disk 3.5",DS/HD,CHS -Disk 4 IDE0: CompactFlash 3815MB,LBA -Disk 5 IDE1: Hard Disk -- -Disk 6 PRPSD0: SD Card 1886MB,LBA -Video 0 CVDU0: CRT Text,80x25 -``` - -In this example, you can see that the system has a total of 7 Disk -Units numbered 0-6. There are also 2 Character Units and 1 Video -Unit. The table shows the unit numbers assigned to each of the -devices. Notice how the unit numbers are assigned sequentially -regardless of the specific device. - -There may or may not be media in the disk devices listed. For example, -the floppy disk devices (Disk Units 2 & 3) may not have a floppy in -the drive. Also note that Disk Unit 4 shows a disk capacity, but -Disk Unit 5 does not. This is because the PPIDE interface of the -system supports up to two drives, but there is only one actual drive -attached. A unit number is assigned to all possible devices -regardless of whether they have actual media installed at boot time. - -Note that Character Unit 0 is **always** the initial system console -by definition. - -If your system has an RTC/NVRAM device, it will not be listed in the -unit summary table. Since only a single RTC/NVRAM device can exist in -one system, unit numbers are not required nor used for this type of -device. - -## Drive Letter Assignment - -In legacy CP/M-type operating systems, drive letters were generally -mapped to disk drives in a completely fixed way. For example, drive A: -would **always** refer to the first floppy drive. Since RomWBW -supports a wide variety of hardware configurations, it implements a -much more flexible drive letter assignment mechanism so that any drive -letter can be assigned to any disk device. - -At boot, you will notice that RomWBW automatically assigns drive -letters to the available disk devices. These assignments are -displayed during the startup of the selected operating system. -Additionally, you can review the current drive assignments at any -time using the `ASSIGN` command. CP/M 3 and ZPM3 do not automatically -display the assignments at startup, but you can use `ASSIGN` do -display them. - -The drive letter assignments **do not** change during an OS session -unless you use the `ASSIGN` command yourself to do it. Additionally, -the assignments at boot will stay the same on each boot as long as you -do not make changes to your hardware configuration. Note that the -assignments **are** dependent on the media currently inserted in hard -disk drives. So, notice that if you insert or remove an SD Card or CF -Card, the drive assignments will change. Since drive letter -assignments can change, you must be careful when doing destructive -things like using `CLRDIR` to make sure the drive letter you use is -referring to the desired media. - -When performing a ROM boot of an operating system, note that A: will -be your RAM disk and B: will be your ROM disk. When performing a disk -boot, the disk you are booting from will be assigned to A: and the -rest of the drive letters will be offset to accommodate this. This is -done because most legacy operating systems expect that A: will be the -boot drive. - -## Slices - -The vintage operating systems included with RomWBW were produced at a -time when mass storage devices were quite small. CP/M 2.2 could only -handle filesystems up to 8MB. In order to achieve compatibility across -all of the operating systems supported by RomWBW, the hard disk -filesystem format used is 8MB. This ensures any filesystem will be -accessible to any of the operating systems. - -Since storage devices today are quite large, RomWBW implements a -mechanism called slicing to allow up to 256 8MB filesystems on a -single large storage device. This allows up to 2GB of usable space on -a single media. You can think of slices as a way to refer to any of -the first 256 8MB chunks of space on a single media. - -Of course, the problem is that CP/M-like operating systems have only -16 drive letters (A:-P:) available. Under the covers, RomWBW allows -you to use any drive letter to refer to any slice of any media. The -`ASSIGN` command is allows you to view or change the drive letter -mappings at any time. At startup, the operating system will -automatically allocate a reasonable number of drive letters to the -available storage devices. The allocation will depend on the number of -large storage devices available at boot. For example, if you have -only one hard disk type media, you will see that 8 drive letters are -assigned to the first 8 slices of that media. If you have two large -storage devices, you will see that each device is allocated four drive -letters. - -Referring to slices within a storage device is done by appending a : -** where ** is the device relative slice number from 0-255. For -example, if you have an IDE device, it will show up as IDE0: in the -boot messages meaning the first IDE device. To refer to the fourth -slice of IDE0, you would type "IDE0:3". Here are some examples: - -| | | -| -------- | ---------------------------- | -| `IDE0:0` | First slice of disk in IDE0 | -| `IDE0:` | First slice of disk in IDE0 | -| `IDE0:3` | Fourth slice of disk in IDE0 | - -So, if I wanted to use drive letter L: to refer to the fourth slice -of IDE0, I could use the command `ASSIGN L:=IDE0:3`. There are a -couple of rules to be aware of when assigning drive letters. First, -you may only refer to a specific device/slice with one drive letter. -Said another way, you cannot have multiple drive letters referring -to a single device/slice at the same time. Second, there must always -be a drive assigned to A:. Any attempt to violate these rules will -be blocked by the `ASSIGN` command. - -Unlike MS-DOS partitions, slices are not allocated -- there is no -partitioning for slices. Think of every hard disk type device as -having a pre-allocated set of 256 8MB slices at the start of the -media. You can refer to any of them simply by assigning a drive -letter. RomWBW will not check to see if there is anything else on the -hard disk in the slice you are referring to, nor will it verify that -the hard disk media is large enough to have a slice at the location -you refer to. If you attempt to write past the end of your media, you -will get an I/O error displayed, so you will know if you make a -mistake. There is no tracking of your use of slices -- you will need -to keep track of your use of slices yourself. - -Nothing automatically initializes a slice as a file system. You must -do that yourself using `CLRDIR`. Since `CLRDIR` works on drive -letters, make absolutely sure you know what media and slice are -assigned to that drive letter before using `CLRDIR`. - -While it is probably obvious, you cannot use slices on any media less -than 8MB in size. Specifically, you cannot slice RAM disks, ROM -disks, floppy disks, etc. - -# RomWBW Custom Applications - -The operation of the RomWBW hosted operating systems is enhanced -through several custom applications. These applications are -functional on all of the OS variants included with RomWBW. - -The following custom applications are found on the ROM disk and are, -therefore, globally available. - -| Application | Description | -| ----------- | ---------------------------------------------------------------------------------------------------- | -| ASSIGN | Add, change, and delete drive letter assignments. Use ASSIGN /? for usage instructions. | -| SYSCOPY | Copy system image to a device to make it bootable. Use SYSCOPY with no parms for usage instructions. | -| MODE | Reconfigures serial ports dynamically. | -| FDU | Format and test floppy disks. Menu driven interface. | -| FORMAT | Will someday be a command line tool to format floppy disks. Currently does nothing! | -| XM | XModem file transfer program adapted to hardware. Automatically uses primary serial port on system. | -| FLASH | Will Sowerbutts' in-situ ROM programming utility. | -| FDISK80 | John Coffman's Z80 hard disk partitioning tool. See documentation in Doc directory. | -| TALK | Direct console I/O to a specified character device. | -| RTC | Manage and test the Real Time Clock hardware. | -| TIMER | Display value of running periodic system timer. | -| INTTEST | Test interrupt vector hooking. | - -Some custom applications do not fit on the ROM disk. They are found on the -disk image files or the individual files can be found in the Binary\\Apps -directory of the distribution. - -| Application | Description | -| ----------- | -------------------------------------------------------------- | -| TUNE | Play .PT2, .PT3, .MYM audio files. | -| FAT | Access MS-DOS FAT filesystems from RomWBW (based on FatFs). | - -Additional documentation on all of these applications can be found in -"RomWBW Applications.pdf" in the Doc directory of the distribution. - -# Using Disks - -## ROM & RAM Disks - -RomWBW utilizes a portion of the ROM and RAM memory in your system to -implement small memory-based disks. - -The RAM disk provides a small CP/M filesystem that you can use for the -temporary storage of files. Unless your system has a battery backed -mechanism for persisting your RAM contents, the RAM disk contents will -be lost at each power-off. However, the RAM disk is an excellent -choice for storing temporary files because it is very fast. - -Like the RAM disk, the ROM disk also provides a small CP/M -filesystem, but it's contents are static -- they are part of the -ROM. As such, you cannot save files to the ROM disk. Any attempt to -do this will result in a disk I/O error. The contents of the ROM -disk have been chosen to provide a core set of tools and -applications that are helpful for either CP/M 2.2 or ZSDOS. Since -ZSDOS is CP/M 2.2 compatible, this works fairly well. However, you -will find some files on the ROM disk that will work with ZSDOS, but -will not work on CP/M 2.2. For example, `LDDS`, which loads the -ZSDOS date/time stamper will only run on ZSDOS. - -## Disk Devices - -While the RAM/ROM disks provide a functional system, they are not -useful in the long term because you cannot save data across power -cycles. They are also constrained by limited space. - -The systems supported by RomWBW all have the ability to use persistent -disk media. A wide variety of disk devices are supported including -floppy drives, hard disks, CF Cards, and SD Cards. Some systems have -disk interfaces built-in, while others will require add-in cards. You -will need to refer to the documentation for your system for your -specific options. - -In the RomWBW boot messages, you will see hardware discovery messages. -If you have a disk drive interface, you should see messages listing -device types like FD:, IDE:, PPIDE:, SD:. Additionally, you will see -messages indicating the media that has been found on the interfaces. -As an example, here are the messages you might see if you have an IDE -interface in your system with a single CF Card inserted in the -primary side of the interface: - -``` -IDE: IO=0x80 MODE=MK4 -IDE0: 8-BIT LBA BLOCKS=0x00773800 SIZE=3815MB -IDE1: NO MEDIA -``` - -The messages you see will vary depending on your hardware and the -media you have installed. But, they will all have the same general -format as the example above. - -Once your your system has working disk devices, you can boot an -operating system and the operating system will have access to the -media. At the boot loader prompt, select either either CP/M 2.2 or -Z-System to boot from ROM. As the operating system starts up, you -should see a list of drive letters assigned to the disk media you have -installed. Here is an example of this: - -``` -Configuring Drives... - - A:=MD1:0 - B:=MD0:0 - C:=IDE0:0 - D:=IDE0:1 -``` - -You will probably see more drive letters than this. The drive letter -assignment process is described above in the Drive Letter Assignment -section. Be aware that RomWBW will only assign drive letters to disk -interfaces that actually have media in them. If you do not see drive -letters assigned as expected, refer to the prior system boot messages -to ensure media has been detected in the interface. Actually, there -is one exception to this rule: floppy drives will be assigned a drive -letter regardless of whether there is any media inserted at boot. - -Notice how each drive letter refers back to a specific disk hardware -interface like IDE0. This is important as it is telling you what each -drive letter refers to. Also notice that mass storage disks (like IDE) -will normally have multiple drive letters assigned. The extra drive -letters refer to additional "slices" on the disk. The concept of slices -is described above in the Slices section. - -Once you are seeing drive letters referring to your disk media, you -can follow the instructions below to begin using the disk media with -the operating system. Your disk media **must** be initialized prior -to being used. There are two ways to initialize your media for use. - -One option is to initialize the media in-place using your RomWBW -system. This process is described below under Disk Initialization. In -this scenario, you will need to subsequently copy any files you want -to use onto the newly initialized disk (see Transferring Files). - -Alternatively, you can use your modern Windows, Linux, or Mac computer -to copy a disk image onto the disk media. RomWBW comes with a variety -of disk images that are ready to use and have a much more complete -set of files than you will find on the ROM disk. This process is -covered below under Disk Images. - -## Disk Initialization - -To use a disk device, you will need to initialize the directory of -the filesystem. On RomWBW, the initialization is done using the -CLRDIR application. For example if your C: drive has been assigned to -a storage device, you would use `CLRDIR C:` to initialize C: and -prepare it hold files. Note that CLRDIR will prompt you for -confirmation and you must respond with a **capital** 'Y' to confirm. -Once `CLDIR` has completed, you can copy files onto the drive, for -example `COPY *.* C:`. Be very careful to pay attention to your -drive letter assignments prior to running `CLRDIR` to avoid -accidentally wiping out a filesystem that has data on it. - -Running `CLRDIR` on a disk device is roughly equivalent to running -FORMAT on MS-DOS. Note that unlike MS-DOS you do **not** partition -your mass storage device. CP/M knows nothing about disk partitions. -You may notice a partitioning application on your ROM disk (FDISK80), -but this is strictly for an advanced technique of adding an MS-DOS -FAT filesystem to your media in addition to the CP/M area. Do not -use FDISK80 unless you are specifically attempting to add an MS-DOS -FAT filesystem to your media. - -If you are using a floppy drive, you will need to physically format -your floppy disk prior to use. This is only required for floppy -disks, not hard disk, CF Cards, or SD Cards, etc. To format a floppy -drive, you can use the interactive application `FDU`. FDU is not -terribly user friendly, but is generally documented in the file -"FDU.txt" found in the Doc directory of the distribution. It is not -necessary to run `CLRDIR` on a floppy disk after physically -formatting it -- the directory is cleared as part of the formatting. - -Once you have initialized a disk device and copied your desired files -onto it, you may want to make the disk bootable. On CP/M filesystems, -you must perform one additional step to make a disk bootable. -Specifically, you need to place a copy of the operating system on the -system tracks of the disk. This is done using the `SYSCOPY` command. -Let's say you have prepared drive C: by initializing it with `CLRDIR` -and copied some files onto it. You can now make C: bootable by -running the following command: - -`B>SYSCOPY C:=B:ZSYS.SYS` - -This command means: copy the Z-System operating system onto the -system tracks of drive C:. In this example, it is assumed that you -have booted from ROM, so B: is the ROM disk drive. Additionally, this -example assumes you want the Z-System operating system to be booted -from C:. If you want CP/M 2.2 instead, you would replace `B:ZSYS.SYS` -with `B:CPM.SYS`. Here is a full example of this process. - -``` -B>SYSCOPY C:=B:ZSYS.SYS - -SYSCOPY v2.0 for RomWBW CP/M, 17-Feb-2020 (CP/M 2 Mode) -Copyright 2020, Wayne Warthen, GNU GPL v3 - -Transfer system image from B:ZSYS.SYS to C: (Y/N)? Y -Reading image... Writing image... Done -``` - -Once this process succeeds, you will be able to boot directly to the -disk from the boot loader prompt. See the instructions in Booting -Disks for details on this. - -## Disk Images - -As mentioned previously, RomWBW includes a variety of disk images -that contain a full set of applications for the operating systems -supported. It is generally easier to use these disk images instead -of copying all the files over using XModem. You use your modern -computer (Windows, Linux, MacOS) to place the disk image onto the -disk media, then just move the media over to your system. In this -scenario you **do not** run `CLRDIR` or `SYSCOPY` on the drive(s). -The directory is prepared and the disk is already bootable, if it is -an operating system boot disk image. - -To copy the disk image files onto your actual media (floppy disk, CF -Card, SD Card, etc.), you need to use an image writing utility on -your modern computer. Your modern computer will need to have an -appropriate interface or slot that accepts the media. To actually -copy the image, you can use the `dd` command on Linux or MacOS. On -Windows, in the "Tools" directory of the distribution there are two -tools you can use. For floppy media, you can use RawWriteWin and for -hard disk media, you can use Win32DiskImager. In all cases, the image -file should be written to the media starting at the very first block -or sector of the media. This will **destroy** any other data on the -media. - -The disk image files are found in the Binary directory of the -distribution. Floppy disk images are prefixed with "fd_" and hard -disk images are prefixed with "hd_". The floppy images are -specifically for 1.44M floppy media only. Each disk image has the -complete set of normal applications and tools distributed with the -associated operating system or application suite. - -The following table shows the disk image files available. Note that -the images in the "Hard" column are fine for use on CF Cards, SD -Cards, as well as real spinning hard disks. - -| Floppy | Hard | Description | -| --------------- | --------------- | -------------------------------------- | -| fd_cpm22.img | hd_cpm22.img | DRI CP/M 2.2 boot disk | -| fd_zsdos.img | hd_zsdos.img | ZSDOS 1.1 boot disk | -| fd_nzcom.img | hd_nzcom.img | NZCOM boot disk | -| fd_cpm3 | hd_cpm3.img | DRI CP/M 3 boot disk | -| fd_zpm3 | hd_zpm3.img | ZPM3 boot disk | -| fd_ws4 | hd_ws4.img | WordStar v4 application disk | - -In addition to the disk images above, there is also a special hard -disk image called hd_combo.img. This image contains all of the images -above, but in a single image with 6 slices. At the boot loader -prompt, you can choose a disk with the combo image, then select the -specific slice you want. This allows a single disk to have all of the -possible operating system options. - -This is the layout of the hd_combo disk image: - -| Slice | Description | -| ------- | ---------------------------------------------------------------- | -| Slice 0 | DRI CP/M 2.2 boot disk | -| Slice 1 | ZSDOS 1.1 boot disk | -| Slice 2 | NZCOM boot disk | -| Slice 3 | DRI CP/M 3 boot disk | -| Slice 4 | ZPM3 boot disk | -| Slice 5 | WordStar v4 application disk | - -Note that unlike the ROM firmware, you do **not** need to choose a -disk image specific to your hardware. Because the RomWBW firmware -provides a hardware abstraction layer, all hard disk images will work -on all hardware variations. Yes, this means you can remove an SD Card -from one system and put it in a different system. The only constraint -is that the applications on the disk media must be up to date with -the firmware on the system being used. - -All of the disk images that indicate they are bootable (boot disk) will -boot from disk as is. You do not need to run `SYSCOPY` on them to make -them bootable. However, if you upgrade your ROM, you should use `SYSCOPY` -to update the system tracks. - -## Booting Disks - -When starting your system, following the hardware initialization, you -will see the Boot Loader prompt. In addition, to the ROM boot -options, you will see another line listing the Disk boot options. -This line lists the disk devices that you can choose to boot directly. - -You will notice that you do not have an option to boot a drive letter -here (like C:). This is because the operating system is not yet -loaded. When you ran `SYSCOPY` previously, remember that C: was -assigned to IDE0:0 which means device IDE0, slice 0. So, to boot the -disk that you just setup with `SYSCOPY`, you would choose option 2. -You will then be prompted for the slice on IDE0 that you want to -boot. For now, just press enter to choose slice 0. Once you are -familiar with slices, you can `SYSCOPY` and boot alternate slices. -Here is what you would see when booting to a disk device: - -``` -MARK IV Boot Loader - -ROM: (M)onitor (C)P/M (Z)-System (F)orth (B)ASIC (T)-BASIC (P)LAY (U)SER ROM -Disk: (0)MD1 (1)MD0 (2)IDE0 (3)IDE1 - -Boot Selection? 2 Slice(0-9)[0]? - -Booting Disk Unit 2, Slice 0... - -Reading disk information... -Loc=D000 End=FE00 Ent=E600 Label=Unlabeled Drive - -Loading... -``` - -Following this, you would see the normal operating system startup -messages. However, your operating system prompt will be `A>` and -when you look at the drive letter assignments, you should see that A: -has been assigned to the disk you selected to boot. - -If you receive the error message "Disk not bootable!", you have -either failed to properly run `SYSCOPY` on the target disk or you -have selected the wrong disk/slice. - -Note that although MD1 (RAM disk) and MD0 (ROM disk) drives are -listed in the Disk boot line, they are not "bootable" disks because -they have no system tracks on them. Attempting to boot to one of -them, will fail with a "Disk not bootable!" error message and return -to the loader prompt. - -# Operating Systems - -One of the primary goals of RomWBW is to expose a set of generic -hardware functions that make it easy to adapt operating systems to -any hardware supported by RomWBW. As a result, there are now 5 -operating systems that have been adapted to run under RomWBW. The -adaptations are identical for all hardware supported by RomWBW -because RomWBW hides all hardware specifics from the operating system. - -Note that all of the operating systems included with RomWBW support -the same basic filesystem format. As a result, a formatted filesystem -will be accessible to any operating system. The only possible issue -is that if you turn on date/time stamping using the newer OSes, the -older OSes will not understand this. Files will not be corrupted, but -the date/time stamps may be lost. - -The following sections briefly describe the operating system options -currently available. - -## Digital Research CP/M 2.2 - -This is the most widely used variant of the Digital Research -operating system. It has the most basic feature set, but is -essentially the compatibility metric for all other CP/M-like -operating systems including all of those listed below. The Doc -directory contains a manual for CP/M usage ("CPM Manual.pdf"). If you -are new to the CP/M world, I would recommend using this CP/M variant -to start with simply because it is the most stable and you are less -likely to encounter problems. - -### Notes - -- The original versions of DDT, DDTZ, and ZSID used the RST 38 -vector which conflicts with interrupt mode 1 use of this vector. -The DDT, DDTZ, and ZSID applications in RomWBW have been modified -to use RTS 30 to avoid this issue. - -- Z-System applications will not run under CP/M 2.2. For example, -the `LDDS` date stamper with not run. - -## ZSDOS 1.1 - -ZSDOS is the most popular non-DRI CP/M "clone" which is generally -referred to as Z-System. Z-System is intended to be an enhanced -version of CP/M and should run all CP/M 2.2 applications. It is -optimized for the Z80 CPU (as opposed to 8080 for CP/M) and has some -significant improvements such as date/time stamping of files. For -further information on the RomWBW implementation of Z-System, see the -wiki page -[Z-System Notes](https://www.retrobrewcomputers.org/doku.php?id=software:firmwareos:romwbw:zsystem). -Additionally, the official documentation for Z-System is included in -the RomWBW distribution Doc directory ("ZSDOS Manual.pdf" and "ZCPR -Manual.pdf"). - -### Notes - -- Although most CP/M 2.2 applications will run under Z-System, some -may not work as expected. The best example is PIP which is not aware -of the ZSDOS paths and will fail in some scenarios (use `COPY` instead). - -## NZCOM Automatic Z-System - -NZCOM is a much further refined version of Z-System (ZCPR 3.4). NZCOM -was sold as an enhancement for existing users of CP/M 2.2 or ZSDOS. -For this reason, (by design) NZCOM does not provide a way to boot -directly from disk. Rather, it is loaded after the system boots into -a host OS. On the RomWBW NZCOM disk images, the boot OS is ZSDOS 1.1. -After you configure NZCOM, you can add a `PROFILE.SUB` file to -automatically launch NZCOM at boot. - -NZCOM is not pre-configured. You must run through a simple -configuration process before loading it. Run MKZCM to do this. - -NZCOM has substantially more functionality than CP/M or basic -Z-System. It is important to read the the "NZCOM Users -Manual.pdf" file in the RomWBW Doc directory. - -### Notes - -- There is no `DIR` command, you must use `SDZ` instead. If you don't -like this, look into the ALIAS facility. - -## Digital Research CP/M 3 - -This is the Digital Research follow-up product to their very popular -CP/M 2.2 operating system. While highly compatible with CP/M 2.2, it -features many enhancements. It makes direct use of banked memory to -increase the user program space (TPA). It also has a new suite of -support tools and help system. - -Note that to make a CP/M 3 boot disk, you actually place CPMLDR.SYS -on the system tracks of the disk. You do not place CPM3.SYS on the -system tracks. `CPMLDR.SYS` chain loads `CPM3.SYS`. - -### Notes - -- The `DATE` command cannot yet be used to **set** the RTC. The RTC is -used to read the current date/time for file stamping, etc. You can -use the `RTC` app to set the RTC clock. - -## Simeon Cran's ZPM3 - -ZPM3 is an interesting combination of the features of both CP/M 3 and -ZCPR 3. Essentially, it has the features of and compatibility with -both. - -Like CP/M 3, to make ZPM3 boot disk, you put CPMLDR.SYS on the system -tracks of the disk. - -### Notes - -- `ZPMLDR` is included with ZPM3, but it is not working correctly. - -- The ZPM operating system is contained in the file called CPM3.SYS -which is confusing, but it is the author's intended way of using ZPM3. - -## FreeRTOS - -Phillip Stevens has ported FreeRTOS to run under RomWBW. FreeRTOS is -not provided in the RomWBW distribution. FreeRTOS is available under -the -[MIT licence](https://www.freertos.org/a00114.html) and further general -information is available at -[FreeRTOS](https://www.freertos.org/RTOS.html). - -You can also contact Phillip for detailed information on the Z180 -implementation of FreeRTOS for RomWBW. -[feilipu](https://github.com/feilipu) - -# Transferring Files - -Transferring files between your modern computer and your RomWBW -system can be achieved in a variety of ways. The most common of these -are described below. All of these have a certain degree of complexity -and I encourage new users to use the available community forums to -seek assistance as needed. - -## Serial Port Transfers - -RomWBW provides an serial file transfer program called XModem that -has been adapted to run under RomWBW hardware. The program is called -`XM` and is on your ROM disk as well as all of the pre-built disk -images. - -You can type `XM` by itself to get usage information. In general, you -will run `XM` with parameters to indicate you want to send or receive -a file on your RomWBW system. Then, you will use your modern -computers terminal program to complete the process. - -The `XM` application generally tries to detect the hardware you are -using and adapt to it. However, you must ensure that you have a -reliable serial connection. You must also ensure that the speed of -the connection is not too fast for XModem to service. Alternatively, -you can ensure that hardware flow control is working properly. - -There is an odd interaction between XModem and partner terminal -programs that can occur. Essentially, after launching `XM`, you must -start the protocol on your modern computer fairly quickly (usually in -about 20 seconds or so). So, if you do not pick a file on your modern -computer quickly enough, you will find that the transfer completes -about 16K, then hangs. The interaction that causes this is beyond the -scope of this document. - -## Disk Image Transfers - -It is possible to pass disk images between your RomWBW system and -your modern computer. This assumes you have an appropriate media slot -on your modern computer for the media you want to use (CF Card, SD -Card, or floppy drive). - -The general process to get files from your modern computer to a RomWBW -computer is: - -1. Use `cpmtools` on your modern computer to create a RomWBW CP/M -filesystem image. - -2. Insert your RomWBW media (CF Card, SD Card, or floppy disk) in your -modern computer. - -3. Use a disk imaging tool to copy the RomWBW filesystem image onto the -media. - -4. Move the media back to the RomWBW computer. - -This process is a little complicated, but it has the benefit of -allowing you to get a lot of files over to your RomWBW system quickly -and with little chance of corruption. - -The process can be run in reverse to get files from your RomWBW -computer to a modern computer. - -The exact use of these tools is a bit too much for this document, but -the tools are all included in the RomWBW distribution along with -usage documents. - -Note that the build scripts for RomWBW create the default disk images -supplied with RomWBW. It is relatively easy to customize the contents -of the disk images that are part of RomWBW. This is described in more -detail in the Source\\Images directory of the distribution. - -## FAT Filesystem Transfers - -RomWBW provides a mechanism that allows it to read and write files on -a FAT formatted disk. This means that you can generally use your -modern computer to make an SD Card or CF Card with a standard FAT32 -filesystem on it, then place that media in your RomWBW computer and -access the files. - -When formatting the media on your modern computer, be sure to pick -the FAT filesystem. NTFS and other filesystems will not work. - -On your RomWBW computer you can use the `FAT` application to access -the FAT media. The `FAT` application allows you to read files, write -files, list a directory, and erase files on the FAT media. It can -handle subdirectories as well. It will only see 8.3 character -filenames however. Longer filenames will show up as a truncated -version. - -The `FAT` application is not on your ROM disk because it is too large -to fit. You will find it on all of the pre-built disk images as well -as in the Binary\\Apps directory of the distribution. - -For advanced users, it is possible to create a hybrid disk that -contains CP/M slices at the beginning and a FAT filesystem after. -Such a hybrid disk can be used to boot an operating system and still -have access to FAT files on the FAT portion of the disk. David Reese -has prepared a document describing how to do this. It is called -"SC126_How-To_No_2_Preparing_an_SD_Card_for_Use_with_SC126_Rev_1-5.pdf" -and can be found in the Doc\\Contrib directory of the distribution. - -# Startup Command Processing - -Each of the operating systems supported by RomWBW provide a mechanism -to run commands at boot. This is similar to the AUTOEXEC.BAT files -from MS-DOS. - -With the exception of ZPM3, all operating systems will look for a -file called `PROFILE.SUB` on the system drive at boot. If it is -found, it will be processed as a standard CP/M submit file. You can -read about the use of the SUBMIT facility in the CP/M manuals -included in the RomWBW distribution. Note that the boot disk must -also have a copy of `SUBMIT.EXE`. - -In the case of ZPM3, the file called `STARTZPM.COM` will be run at -boot. To customize this file, you use the ZCPR ALIAS facility. You -will need to refer to ZCPR documentation for more information on the -ALIAS facility. - -Note that the automatic startup processing generally requires booting -to a disk drive. Since the ROM disk is not writable, there is no -simple way to add/edit a `PROFILE.SUB` file there. If you want to -customize your ROM and add a `PROFILE.SUB` file to the ROM Disk, it -will work, but is a lot harder than using a boot disk. - -# ROM Customization - -The pre-built ROM images are configured for the basic capabilities of -each platform. Additionally, some of the typical add-on hardware for -each platform will be automatically detected and used. If you want to -go beyond this, RomWBW provides a very flexible configuration -mechanism based on configuration files. Creating a customized ROM -requires running a build script, but it is quite easy to do. - -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 and disk images. There are build -scripts for Windows, Linux, and MacOS to accommodate virtually all -users. All required build tools (compilers, assemblers, etc.) are -included in the distribution, so it is not necessary to setup a build -environment on your computer. - -The process for building a custom ROM is documented in the ReadMe.txt -file in the Source directory of the distribution. - -For those who are interested in more than basic system customization, -note that all source code is provided (including the operating -systems). Modification of the source code is considered an expert -level task and is left to the reader to pursue. - -Note that the ROM customization process does not apply to UNA. All -UNA customization is performed within the ROM setup script. - -# UNA Hardware BIOS - -John Coffman has produced a new generation of hardware BIOS called -UNA. The standard RomWBW distribution includes it's own hardware -BIOS. However, RomWBW can alternatively be constructed with UNA as -the hardware BIOS portion of the ROM. If you wish to use 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. - -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 the 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 -* Terminal Emulation -* Zeta 1, N8, RC2014, Easy Z80, and Dyno Systems -* Some older support boards - -The UNA version embedded in RomWBW is the latest production release -of UNA. RomWBW will be updated with John's upcoming UNA release with -support for VGA3 as soon as it reaches production status. - -Please refer to the -[UNA BIOS Firmware Page](https://www.retrobrewcomputers.org/doku.php?id=software:firmwareos:una:start) -for more information on UNA. - -# Upgrading - -Upgrading to a newer release of RomWBW is essentially just a matter of -updating the ROM chip in your system. If you have spare ROM chips for -your system and a ROM programmer, it is always safest to retain your -existing, working ROM chip and program a new one with the new -firmware. If the new one fails to boot, you can easily return to the -known working ROM. - -Prior to attempting to reprogram your actual ROM chip, you may wish to -"try" the upgrade. With RomWBW, you can upload a new system image -executable and load it from the command line. For each ROM image file -(.rom) in the Binary directory, you will also find a corresponding -application file (.com). For example, for SBC_std.rom, there is also -an SBC_std.com file. You can upload the .com file to your system using -XModem, then simply run the .com file. You will see your system go -through the normal startup process just like it was started from ROM. -However, your ROM has not been updated and the next time you boot your -system, it will revert to the system image contained in ROM. - -There are two restrictions to be aware of related to loading a system -image as a .com application. First, this is only supported under -Z-System and CP/M 2.2. You must boot into one of these OSes before -attempting to launch the .com file. Second, you may find that you -are unable to load the .com file because it is too large to fit in -available application RAM (TPA). Your only recourse in this -situation is to build a custom ROM with fewer features. - -If you do not have easy access to a ROM programmer, it is usually -possible to reprogram your system ROM using the FLASH utility from -Will Sowerbutts. This application, called FLASH.COM, can be found on the -ROM drive of any running system. In this case, you would need to -transfer the new ROM image (.rom) over to your system using XModem (or -one of the other mechanisms described in the Transferring Files -section). The ROM image is too large to fit on your RAM drive, -so you will need to transfer it to a larger storage drive. Once the -ROM image is on your system, you can use the FLASH application to -update your ROM. The following is a typical example of transferring -ROM image using XModem and flashing the chip in-situ. - -``` -E>xm r rom.img - -XMODEM v12.5 - 07/13/86 -RBC, 28-Aug-2019 [WBW], ASCI - -Receiving: E0:ROM.IMG -7312k available for uploads -File open - ready to receive -To cancel: Ctrl-X, pause, Ctrl-X - -Thanks for the upload - -E>flash write rom.img -FLASH4 by Will Sowerbutts version 1.2.3 - -Using RomWBW (v2.6+) bank switching. -Flash memory chip ID is 0xBFB7: 39F040 -Flash memory has 128 sectors of 4096 bytes, total 512KB -Write complete: Reprogrammed 2/128 sectors. -Verify (128 sectors) complete: OK! -``` - -Obviously, there is some risk to this approach since any issues with the -programming or ROM image could result in a non-functional system. - -To confirm your ROM chip has been successfully updated, restart your -system and boot an operating system from ROM. Do not boot from a disk -device yet. Review the boot messages to see if any issues have -occurred. - -Once you are satisfied that the ROM is working well, you will need to -update the system images and RomWBW custom applications on your disk -drives. The system images and custom applications are matched to the -RomWBW ROM firmware in use. If you attempt to boot a disk or run -applications that have not been updated to match the current ROM -firmware, you are likely to have odd problems. - -The simplest way to update your disk media is to just use your modern -computer to overwrite the entire media with the latest disk image of -your choice. This process is described below in the Disk Images -section. If you wish to update existing disk media in your system, you -need to perform the following steps. - -If the disk is bootable, you need to update the system tracks of the -disk. This is done using a SYSCOPY command such as `SYSCOPY -C:=B:ZSYS.SYS`. For a ZSDOS boot disk, use ZSYS.SYS. For a CP/M 2.2 -disk, use CPM.SYS. For a CP/M 3 or ZPM3 disk, use CPMLDR.SYS. -CPMLDR.SYS is not provided on the ROM disk, so you will need to -upload it from the distribution. - -Finally, if you have copies of any of the RomWBW custom applications -on your hard disk, you need to update them with the latest copies. The -following applications are found on your ROM disk. Use COPY to copy -them over any older versions of the app on your disk: - -* ASSIGN.COM -* SYSCOPY.COM -* MODE.COM -* FDU.COM (was FDTST.COM) -* FORMAT.COM -* XM.COM -* FLASH.COM -* FDISK80.COM -* TALK.COM -* RTC.COM -* TIMER.COM -* INTTEST.COM - -For example: `B>COPY ASSIGN.COM C:` - -Some RomWBW custom applications are too large to fit on the ROM disk. -If you are using any of these you will need to transfer them to your -system and then update all copies. These applications are found in -the Binary\\Apps directory of the distribution and in all of the disk -images. - -* FAT.COM -* TUNE.COM - -# RomWBW Distribution - -All source code and distributions are maintained on GitHub. Code -contributions are very welcome. - -[RomWBW GitHub Repository](https://github.com/wwarthen/RomWBW|https://github.com/wwarthen/RomWBW) - -## Distribution Directory Layout - -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: - -| Application | Description | -| ----------- | -------------------------------------------------------------- | -| 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". | -| Doc | Contains various detailed documentation including the operating systems, RomWBW architecture, etc. | -| 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. | - -# Acknowledgments - -While I have heavily modified much of the code, I want to acknowledge -that much of the work is derived from the work of others in the -RetroBrew Computers Community 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 contributed support for the CSIO support in the SD Card -driver. -* Ed Brindley contributed some of the code that supports the RC2014 -platform. -* Phil Summers contributed Forth and BASIC in ROM as well as a long -list of general code enhancements. -* Phillip Stevens contributed support for FreeRTOS. -* Curt Mayer contributed the Linux / MacOS build process. -* UNA BIOS and FDISK80 is a product of John Coffman. -* FLASH4 is a product of Will Sowerbutts. - -Contributions of all kinds to RomWBW are very welcome. - -# Getting Assistance - -The best way to get assistance with RomWBW or any aspect of the -RetroBrew Computers projects is via the community forums: - -* [RetroBrew Computers Forum](https://www.retrobrewcomputers.org/forum/) -* [RC2014 Google Group](https://groups.google.com/forum/#!forum/rc2014-z80) -* [retro-comp Google Group](https://groups.google.com/forum/#!forum/retro-comp) - -Submission of issues and bugs are welcome at the [RomWBW GitHub Repository](https://github.com/wwarthen/RomWBW). - -Also feel free to email !author at [!authmail](mailto:!authmail). diff --git a/Source/Doc/Graphics/Bank Switched Memory.pdf b/Source/Doc/Graphics/BankSwitchedMemory.pdf similarity index 100% rename from Source/Doc/Graphics/Bank Switched Memory.pdf rename to Source/Doc/Graphics/BankSwitchedMemory.pdf diff --git a/Source/Doc/Graphics/Bank Switched Memory.png b/Source/Doc/Graphics/BankSwitchedMemory.png similarity index 100% rename from Source/Doc/Graphics/Bank Switched Memory.png rename to Source/Doc/Graphics/BankSwitchedMemory.png diff --git a/Source/Doc/Graphics/Bank Switched Memory.vsd b/Source/Doc/Graphics/BankSwitchedMemory.vsd similarity index 100% rename from Source/Doc/Graphics/Bank Switched Memory.vsd rename to Source/Doc/Graphics/BankSwitchedMemory.vsd diff --git a/Source/Doc/Graphics/Character Emulation Video Services.pdf b/Source/Doc/Graphics/CharacterEmulationVideoServices.pdf similarity index 100% rename from Source/Doc/Graphics/Character Emulation Video Services.pdf rename to Source/Doc/Graphics/CharacterEmulationVideoServices.pdf diff --git a/Source/Doc/Graphics/Character Emulation Video Services.png b/Source/Doc/Graphics/CharacterEmulationVideoServices.png similarity index 100% rename from Source/Doc/Graphics/Character Emulation Video Services.png rename to Source/Doc/Graphics/CharacterEmulationVideoServices.png diff --git a/Source/Doc/Graphics/Character Emulation Video Services.vsd b/Source/Doc/Graphics/CharacterEmulationVideoServices.vsd similarity index 100% rename from Source/Doc/Graphics/Character Emulation Video Services.vsd rename to Source/Doc/Graphics/CharacterEmulationVideoServices.vsd diff --git a/Source/Doc/Graphics/Hard Disk Anatomy.vsd b/Source/Doc/Graphics/Hard Disk Anatomy.vsd index 680e16e3..e335b109 100644 Binary files a/Source/Doc/Graphics/Hard Disk Anatomy.vsd and b/Source/Doc/Graphics/Hard Disk Anatomy.vsd differ diff --git a/Source/Doc/Makefile b/Source/Doc/Makefile new file mode 100644 index 00000000..0992f954 --- /dev/null +++ b/Source/Doc/Makefile @@ -0,0 +1,41 @@ +# +# NOTE: Pandoc, Latex (MiKTeX or TexLive), and gpp must be installed +# and available on commandline for this build to work!!! +# Typically "sudo apt install pandoc, texlive-latex-extra, gpp" +# +OBJECTS = ReadMe.gfm ReadMe.txt UserGuide.pdf SystemGuide.pdf Applications.pdf ROM_Applications.pdf Catalog.pdf Errata.pdf +# DEST = ../../Doc +TOOLS = ../../Tools +OTHERS = *.tmp + +include $(TOOLS)/Makefile.inc + +all :: deploy + +%.tmp : %.md + gpp -o $@ -U "$$" "$$" "{" "}{" "}$$" "{" "}" "@@@" "" -M "$$" "$$" "{" "}{" "}$$" "{" "}" $< + +%.pdf : %.tmp + pandoc $< -f markdown -t latex -s -o $@ --default-image-extension=pdf + +%.html : %.tmp + pandoc $< -f markdown -t html -s -o $@ --default-image-extension=pdf + +%.dw : %.tmp + pandoc $< -f markdown -t dokuwiki -s -o $@ --default-image-extension=pdf + +%.gfm : %.tmp + pandoc $< -f markdown -t gfm -s -o $@ --default-image-extension=pdf + +%.txt : %.tmp + pandoc $< -f markdown -t plain -s -o $@ --default-image-extension=pdf + +deploy : + cp ReadMe.gfm "../../ReadMe.md" + cp ReadMe.txt "../../ReadMe.txt" + cp UserGuide.pdf "../../Doc/RomWBW User Guide.pdf" + cp SystemGuide.pdf "../../Doc/RomWBW System Guide.pdf" + cp Applications.pdf "../../Doc/RomWBW Applications.pdf" + cp ROM_Applications.pdf "../../Doc/RomWBW ROM Applications.pdf" + cp Catalog.pdf "../../Doc/RomWBW Disk Catalog.pdf" + cp Errata.pdf "../../Doc/RomWBW Errata.pdf" diff --git a/Source/Doc/ROM_Applications.md b/Source/Doc/ROM_Applications.md new file mode 100644 index 00000000..7a3f1a83 --- /dev/null +++ b/Source/Doc/ROM_Applications.md @@ -0,0 +1,631 @@ +$define{doc_title}{ROM Applications}$ +$define{doc_author}{Phillip Summers}$ +$define{doc_authmail}{}$ +$include{"Book.h"}$ + +# Summary + +RomWBW includes a small selection of built in utilities and +programming languages. + +`\clearpage`{=latex} + +# ROMWBW Monitor + +The Monitor program is a low level utility that can be used +for testing and programming. It allows programs to be entered, +memory to be examined, and input/output devices to be read or +written to. + +It's key advantage is that is available at boot up. + +Its key disadvantages are that code cannot be entered in assembly +language and there is no ability to save to memory devices. + +The available memory area for programming is `0200-EDFFh`. +The following areas are reserved: + +Memory Area | Function +------------|----------------------------------- +`0000-00FFh`| Jump and restart (RST) vectors +`0100-01FFh`| HBIOS configuration block +`EE00-FDFFh`| MONITOR +`FE00-FFFFh`| HBIOS proxy + +Commands can be entered at the command prompt `>` +Automatic case conversion takes place on command entry and all +arguments are expected to be in hex format. + +The current memory bank in low memory is displayed before the prompt i.e.: + +`8E>` + +The Monitor allows access to all memory locations but ROM and +Flash memory cannot be written to. Memory outside the normal +address range can be accessed using the B command. The first +256 bytes `0000-01FF` is critical for the HBIOS operation. +Changing banks may make this information inaccessible. + +Refer to the RomWBW Architecture manual for details memory banking. + +A quick guide to using the Monitor program follows: + +## ? - Displays a summary of available commands. + +``` +Monitor Commands (all values in hex): +B - Boot system +D xxxx [yyyy] - Dump memory from xxxx to yyyy +F xxxx yyyy zz - Fill memory from xxxx to yyyy with zz +H - Halt system +I xxxx - Input from port xxxx +K - Keyboard echo +L - Load Intel hex data +M xxxx yyyy zzzz - Move memory block xxxx-yyyy to zzzz +O xxxx yy - Output value yy to port xxxx +P xxxx - Program RAM at address xxxx +R xxxx [[yy] [zzzz]] - Run code at address xxxx + Pass yy and zzzz to register A and BC +T xxxx - X-modem transfer to memory location xxxx +S xx - Set bank to xx +X - Exit monitor +``` + +## Cold Boot + +B - Performs a cold boot of the ROMWBW system. A complete +re-initialization of the system is performed and the system +returns to the Boot Loader prompt. + +## Dump Memory + +D xxxx [yyyy] - Dump memory from hex location xxxx to yyyy +on the screen as lines of 16 hexadecimal bytes with their +ASCII equivalents (if within a set range, else a '.' is +printed). If the end address is omitted then 256 bytes is +displayed. + +A good tool to see where code is located, check +for version id, obtain details for chip configurations and +execution paths. + +Examples: `D 100 1FF` + +``` +0100: 10 0B 01 5A 33 45 4E 56 01 00 00 2A 06 00 F9 11 ...Z3ENV...*..ù. +0110: DE 38 37 ED 52 4D 44 0B 6B 62 13 36 00 ED B0 21 Þ87íRMD.kb.6.í°! +0120: 7D 32 E5 21 80 00 4E 23 06 00 09 36 00 21 81 00 }2Ã¥!..N#...6.!.. +0130: E5 CD 6C 1F C1 C1 E5 2A C9 8C E5 CD 45 05 E5 CD Ã¥Ãl.ÃÃÃ¥*É.Ã¥ÃE.åà +0140: 59 1F C3 00 00 C3 AE 01 C3 51 04 C3 4C 02 C3 57 Y.Ã..î.ÃQ.ÃL.ÃW +0150: 02 C3 64 02 C3 75 02 C3 88 02 C3 B2 03 C3 0D 04 .Ãd.Ãu.Ã..ò.Ã.. +0160: C3 19 04 C3 22 04 C3 2A 04 C3 35 04 C3 40 04 C3 Ã..Ã".Ã*.Ã5.Ã@.à +0170: 48 04 C3 50 04 C3 50 04 C3 50 04 C3 8F 02 C3 93 H.ÃP.ÃP.ÃP.Ã..Ã. +0180: 02 C3 94 02 C3 95 02 C3 85 04 C3 C7 04 C3 D1 01 .Ã..Ã..Ã..ÃÇ.ÃÑ. +0190: C3 48 02 C3 E7 04 C3 56 03 C3 D0 01 C3 D0 01 C3 ÃH.Ãç.ÃV.ÃÃ.ÃÃ.à +01A0: D0 01 C3 D0 01 C3 D0 01 C3 D0 01 01 02 01 CD 6B Ã.ÃÃ.ÃÃ.ÃÃ....Ãk +01B0: 04 54 68 69 73 20 66 75 6E 63 74 69 6F 6E 20 6E .This function n +01C0: 6F 74 20 73 75 70 70 6F 72 74 65 64 2E 0D 0A 00 ot supported.... +01D0: C9 3E FF 32 3C 00 3A 5D 00 FE 20 28 14 D6 30 32 É>ÿ2<.:].þ (.Ö02 +01E0: AB 01 32 AD 01 3A 5E 00 FE 20 28 05 D6 30 32 AC «.2­.:^.þ (.Ö02¬ +01F0: 01 C5 01 F0 F8 CF E5 26 00 0E 0A CD 39 02 7D 3C .Ã….ðøÃÃ¥&...Ã9.}< +``` + +## Fill Memory + +F xxxx yyyy zz - Fill memory from hex xxxx to yyyy with +a single value of zz over the full range. The Dump command +can be used to confirm that the fill completed as expected. A +good way to zero out memory areas before writing machine data +for debug purposes. + +## Halt System + +H - Halt system. A Z80 HALT instruction is executed. The +system remains in the halt state until the system is +physically rebooted. Interrupts will not restart the +system. On systems that support a HALT status LED, the +LED will be illuminated. + +## Input from port + +I xxxx - Input data from port xxxx and display to the screen. +This command is used to read values from hardware I/O ports +and display the contents in hexadecimal. + +## Keyboard Echo + +K - Echo any key-presses from the terminal. Press 'ESC' key +to quit. This facility provides that any key stroke sent to +the computer will be echoed back to the terminal. File down +loads will be echoed as well while this facility is ‘on’. + +## Load Hex format file into memory + +L - Load a Intel Hex format file via the terminal program. +The load address is defined in the hex file of the +assembled code. + +The terminal emulator program should be configured to +give a delay at the end of each line to allow the monitor +enough time to parse the line and move the data to memory. + +Keep in mind that this will be a transient unless the +system support battery backed memory. Saving to memory drive +is not supported. + +## Move memory + +M xxxx yyyy zzzz - Move hex memory block xxxx to yyyy to +memory starting at hex location zzzz. Care should be taken +to insure that there is enough memory at the destination so +that code does not get over-written or memory wrapped around. + +## Output to port + +O xxxx yy - Output data byte xx to port xxxx. This command is +used to send hexadecimal values to hardware I/O ports to +verify their operation and is the companion to the I operation. +Use clip leaded LEDs to confirm the data written. + +## Program memory location + +P xxxx - Program memory location xxxx. This routine will +allow you to program a hexadecimal value 'into memory starting +at location xxxx. Press 'Enter' on a blank line to +return to the Monitor prompt. + +The limitation around programming memory is that it must be +entered in hexadecimal. An alternative is to use the L command +to load a program that has been assembled to a hex file on the +remote computer. + +An excellent online resource for looking up opcodes for entry +can be found here: [https://clrhome.org/table](https://clrhome.org/table) + +## Run program + +R xxxx [[yy] [zzzz]] - Run program at location xxxx. If optional +arguments yy and zzzz are entered they are loaded into the +A and BC register respectively. The return address of the +Monitor is saved on the stack so the program can return +to the monitor. On return to the monitor, the contents of +the A, HL, DE and BC registers are displayed. + +## Set bank + +S xx - Change the bank in memory to xx. Memory addresses +0000-7FFF (i.e. bottom 32k) are affected. Because the +interrupt vectors are stored in the bottom page of this +range, this function is disable when interrupt mode 1 is +being used (IM1). Interrupt mode 2 is not affected as the +associated jump vectors are stored in high memory. + +Changing the bank also impacts the restart vectors (RST), +so executing code that call the HBIOS using the RST 08 +assembly code will not work. + +The monitor stack resides in high memory and is not affected +but any code that changes the stack to low memory will be +affected. + +### Bank codes and descriptions + +TYPE | DESCRIPTION |BANK| DETAILS +-----|--------------------|----|--------------------- +RAM | COMMON BANK | 9F | 1024K RAM SYSTEM +RAM | USER BANK | 9E | 1024K RAM SYSTEM +RAM | BIOS BANK | 9D | 1024K RAM SYSTEM +RAM | AUX BANK | 9C | 1024K RAM SYSTEM +RAM | OS BUFFERS END | 9B | 1024K RAM SYSTEM +RAM | OS BUFFERS START | 98 | 1024K RAM SYSTEM +RAM | RAM DRIVE END | 97 | 1024K RAM SYSTEM +RAM | COMMON BANK | 8F | 512K RAM SYSTEM +RAM | USER BANK | 8E | 512K RAM SYSTEM +RAM | BIOS BANK | 8D | 512K RAM SYSTEM +RAM | AUX BANK | 8C | 512K RAM SYSTEM +RAM | OS BUFFERS | 8B | 512K RAM SYSTEM +RAM | OS BUFFERS | 8A | 512K RAM SYSTEM +RAM | OS BUFFERS | 89 | 512K RAM SYSTEM +RAM | OS BUFFERS | 88 | 512K RAM SYSTEM +RAM | RAM DRIVE END | 87 | 512K RAM SYSTEM +RAM | RAM DRIVE START | 80 | +ROM | BOOT BANK | 00 | COLD START & HBIOS +ROM | LOADER & IMAGES | 01 | MONITOR, FORTH +ROM | ROM IMAGES CONTD. | 02 | BASIC, ETC +ROM | FAT FILESYSTEM | 03 | UNA ONLY, ELSE UNUSED +ROM | ROM DRIVE START | 04 | +ROM | ROM DRIVE END | 0F | 512K ROM SYSTEM +ROM | ROM DRIVE END | 1F | 1024K ROM SYSTEM + +## X-modem transfer + +T xxxx - Receive an X-modem file transfer and load it into +memory starting at location xxxx. + +128 byte blocks and checksum mode is the only supported +protocol. + +If the monitor is assembled with the DSKY functionality, +this feature will be exclude due to space limitations. + + +## NOTES: + +The RTC utility on the CP/M ROM disk provides facilities +to manipulate the Real Time Clock non-volatile Memory. +Use the C or Z option from the Boot Loader to load CP/M +and then run RTC to see the options list. + +# FORTH + +CamelForth is the version of Forth included as part of the boot +ROM in ROMWBW. It has been converted from the Z80 CP/M version +published here [www.camelforth.com/page.php?5](www.camelforth.com/page.php?5). The author is Brad +Rodriguez who is a prolific Forth enthusiast, whose work can be +found here: [www.bradrodriguez/papers/index.html](www.bradrodriguez/papers/index.html) + +For those are who are not familiar with Forth, I recommend the +wikipedia article [en.wikipedia.org/wiki/Forth_(programming_language](en.wikipedia.org/wiki/Forth_(programming_language)) +and the Forth Interest Group website [www.forth.org](www.forth.org) + +## Important things to know + +Forth is case sensitive. + +To exit back to the boot loader type ***bye*** + +To get a list of available words type ***WORDS*** + +To reset Forth to its initial state type ***COLD*** + +Most of the code you find on the internet will not run unless modified or additional Forth +words are added to the dictionary. + +This implementation does not support loading or saving of programs. All programs +need to be typed in. Additionally, screen editing and code blocks are not supported. + +## Structure of Forth source files + +File | Description +--------------|----------------------------- +camel80.azm | Code Primitives + camel80d.azm | CPU Dependencies + camel80h.azm | High Level words + camel80r.azm | ROMWBW additions +glosshi.txt | Glossary of high level words +glosslo.txt | Glossary of low level words +glossr.txt | Glossary of ROMWBW additions + +## ROMWBW Additions + +Extensions and changes to this implementation compared to the original distribution are: + +The source code has been converted from Z80mr assembler to Hector Peraza's zsm. + +An additional file camel80r.azm has been added for including additional words to +the dictionary at build time. However, as currently configured there is very little space +allocated for addition words. Exceeding the allocated ROM space will generate an error +message when building. + +James Bowman's double precision words have been added from his RC2014 version: +[https://github.com/jamesbowman/camelforth-z80](https://github.com/jamesbowman/camelforth-z80) + +Word | Syntax | Description +--------|----------------------------|--------------------------------- +D+ | d1 d2 -- d1+d2 | Add double numbers +2>R | d -- | 2 to R +2R> | d -- | fetch 2 from R +M*/ | d1 n2 u3 -- d=(d1*n2)/u3 | double precision mult. div +SVC | hl de bc n -- hl de bc af | Execute a ROMWBW function +P! | n p -- | Write a byte to a I/O port +P@ | p -- n | Read a byte from and I/O port + +# BASIC + +For those who are not familiar with BASIC, it stands for Beginners All purpose Symbolic +Instruction Code. + +ROMWBW contains two versions of ROM BASIC, a full implementation and a "tiny" BASIC. + +The full implementation is a version of Microsoft BASIC from the NASCOM Computer. + +A comprehensive instruction manual is available in the Doc\\Contrib directory. + +## ROMWBW specific features + +- Sound +- Graphics +- Terminal Support + +## ROMWBW unsupported features + +- Cassette loading +- Cassette saving + +# TastyBASIC + +TastyBASIC offers a minimal implementation of BASIC that is only 2304 bytes in size. +It originates from Li-Chen Wang's Palo Alto Tiny BASIC from around 1976. It's small size suited the tiny memory capacities of the time. This implementation is by Dimitri Theulings and his +original source can be found here [https://github.com/dimitrit/tastybasic](https://github.com/dimitrit/tastybasic) + +## Features / Limitations + + Integer arithmetic, numbers -32767 to 32767 + Singles letter variables A-Z + 1-dimensional array support + Strings are not supported + +## Direct Commands + +- `LIST`,`RUN`, `NEW`, `CLEAR`, `BYE` + +## Statements + +- `LET`, `IF`, `GOTO`, `GOSUB RETURN`, `REM`, `FOR TO NEXT STEP`, `INPUT`, `PRINT`, `POKE`, `END` + +## Functions + +- `PEEK`, `RND`, `ABS`, `USR`, `SIZE` + +## Operators + +- `>=`, `#`, `>`, `=`, `<=`, `<` + +- Operator precedence is supported. + +Type ***BYE*** to return to the monitor. + +# Play a Game + +## 2048 + +2048 is a puzzle game that can be both mindless and challenging. It +appears deceptively simple but failure can creep up on you suddenly. + +It requires an ANSI/VT-100 compatible colour terminal to play. + +2048 is like a sliding puzzle game except the puzzle tiles are +numbers instead of pictures. Instead of moving a single tile all +tiles are moved simultaneously in the same direction. Where two +tiles of the same number collide, they are reduced to one tile with +the combined value. After every move a new tile is added with +a starting value of 2. + +The goal is to create a tile of 2048 before all tile locations are +occupied. Reaching the highest points score, which is the sum of all +the tiles is a secondary goal. The game will automatically end when +there are no more possible moves. + +Play consists of entering a direction to move. Directions can be entered +using any of three different keyboard direction sets. + +``` +Direction | Keys +----------|---------- +Up | w ^E 8 +Down | s ^X 2 +Left | a ^S 4 +Right | d ^D 6 +``` +The puzzle board is a 4x4 grid. At start, the grid will be populated +with two 2 tiles. An example game sequence is shown below with new +tiles to the game shown in brackets. + +``` +Start Move 1 - Up Move 2 - Left Move 3 - Left ++---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +| | | |(2)| | | | | 4 | | 4 | | | | | 4 | | | | ++---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +| | | | | | | | | | | | | |(4)| | 4 | | | | ++---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +| | | |(2)| | | | | | | | | | | | | | | | ++---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +| | | | | | | |(2)| | | 2 | | | | | 2 | |(2)| | ++---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +---+---+---+---+ + +Move 4 - Left Move 5 - Up Move 6 - Right Move 7 - Up ++---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +| 4 | | | | | 8 | | | 4 | | | | 8 | 4 | | | | 8 | 8 | ++---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +| 4 | | |(4)| | 4 | | | | | | | | 4 | | | | | 2 | ++---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +| | | | | | | | | | | | | | | | | | | | ++---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +| 4 | | | | |(2)| | | | |(2)| | | 2 | |(2)| | | | ++---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +---+---+---+---+ +``` +This is how I lost this game: +``` ++---+---+---+---+ +| 4 | 2 | 16| 4 | ++---+---+---+---+ +| 32| 64| 8 | 2 | ++---+---+---+---+ +| 4 | 8 |128| 32| ++---+---+---+---+ +|(2)| 16| 8 | 4 | ++---+---+---+---+ +``` +Press Q at any time to bring up the option to Quit or Restart the game. + +# Network Boot + +# Xmodem Flash Updater + +The ROMWBW Xmodem flash updater provides the capability to update ROMWBW from the boot loader using an x-modem file transfer. It offers similar capabilities to Will Sowerbutts FLASH4 utility except that the flashing process occurs during the file transfer. + +These are the key differences between the two methods are: + +Xmodem Flash Updater | FLASH4 +--------------------------------|----------------- +Available from the boot loader | Well proven and tested +Xmodem transfer is integrated | Wider range of supported chips and hardware +Integrated checksum utilities | Wider range of supported platforms +Capability to copy a ROM image | Only reprograms sectors that have changed +More convenient one step process | Ability save and verify ROM images +No intermediate storage required | Progress display while flashing +. | Displays chip identification information +. | Faster file transfer + +The major disadvantages of the Updater is that it is new and relatively untested. There is the risk that a failed transfer will result in a partially flashed and unbootable ROM. There are some limitations on serial transfer speeds. + +The updater utility was initially intended to support the Retrobrew SBC-V2-005 platform using Atmel 39SF040 flash chips but has now been extended to be more generic in operation. + +Supported flash chips are +39SF040, 29F040, AT49F040, AT29C040, M29F040 , MX29F040, A29010B, A29040B + +The Atmel 39SF040 chip is recommended as it can erase and write 4Kb sectors. Other chips require the whole chip to be erased. + +## Usage + +In most cases, completing a ROM update is a simple as: + +1. Booting to the boot loader prompt +2. Selecting option X - Xmodem Flash Updater +3. Selecting option U - Update +4. Initiating an X-modem transfer of your ROM image on your console device +5. Selecting option R - Reboot + +If your console device is not able to transfer a ROM image i.e. your console is a VDU then you will have to use the console options to identify which character-input/output device is to be used as the serial device for transfer. + +When your console is the serial device used for the transfer, no progress information is displayed as this would disrupt the x-modem file transfer. If you use an alternate character-input/output devices as the serial device for the transfer then progress information will be displayed on the console device. + +Due to different platform processor speeds, serials speeds and flow control capabilities the default console or serial device speed may need to be reduced for a successful transfer and flash to occur. The **Set Console Interface/Baud code** option at the Boot Loader can be used to change the speed if required. Additionally, the Updater has options to set to and revert from a recommended speed. + +See the ROMWBW Applications guide for additional information on performing upgrades. + + ## Console Options +Option ( C ) - Set Console Device + +Option ( S ) - Set Serial Device + +By default the updater assumes that the current console is a serial device and that the ROM file to be flashed will also be transferred across this device, so the Console and Serial device are both the same. + +Either device can be can be change to another character-input/output device but the updater will always expect to receive the x-modem transfer on the **Serial Device** + +The advantage of transferring on a different device to the console is that progress information can be displayed during the transfer. + +Option ( > ) - Set Recommended Baud Rate + +Option ( < ) - Revert to Original Baud Rate + +## Programming options + +Option ( U ) - Begin Update + +The will begin the update process. The updater will expect to start receiving +an x-modem file on the serial device unit. + +X-modem sends the file in packets of 128 bytes. The updater will cache 32 +packets which is 1 flash sector and then write that sector to the +flash device. + +If using separate console, bank and sector progress information will shown + +``` +BANK 00 s00 s01 s02 s03 s04 s05 s06 s06 s07 +BANK 01 s00 s01 s02 s03 s04 s05 s06 s06 s07 +BANK 02 s00 s01 s02 s03 s04 s05 s06 s06 s07 etc +``` + +The x-modem file transfer protocol does not provide any filename or size +information for the transfer so the updater does not perform any checks +on the file suitability. + +The updater expects the file size to be a multiple of 4 kilobytes and +will write all data received to the flash device. A system update +file (128kb .img) or complete ROM can be received and written (512kb or +1024kb .rom) + +If the update fails it is recommended that you retry before rebooting or +exiting to the Boot loader as your machine may not be bootable. + +Option ( D ) - Duplicate flash #1 to flash #2 + +This option will make a copy of flash #1 onto flash #2. The purpose of this is to enable + making a backup copy of the current flash. Intended for systems using 2x512Kb Flash devices. + +Option ( V ) - Toggle Write Verify + +By default each flash sector will be verified after being written. Slight +performance improvements can be gained if turned off and could be used if +you are experiencing reliable transfers and flashing. + +## Exit options + +Option ( R ) - Reboot + +Execute a cold reboot. This should be done after a successful update. If +you perform a cold reboot after a failed update then it is likely that +your system will be unusable and removing and reprogramming the flash +will be required. + +Option ( Q ) - Quit to boot loader. + +The SBC Boot Loader is reloaded from ROM and +executed. After a successful update a Reboot should be performed. However, +in the case of a failed update this option could be used to attempt to +load CP/M and perform the normal x-modem / flash process to recover. + +## CRC Utility options + +Option ( 1 ) and ( 2 ) - Calculate and display CRC32 of 1st or 2nd 512k ROM. +Option ( 3 ) - Calculate and display CRC32 of a 1024k (2x512Kb) ROM. + +Can be used to verify if a ROM image has been transferred and flashed correctly. Refer to the Teraterm section below for details on configuring the automatic display of a files CRC after it has been transferred. + +In Windows, right clicking on a file should also give you a context menu option CRC SHA which will allow you to select a CRC32 calculation to be done on the selected file. + +## Teraterm macro configuration + +Macros are a useful tool for automatic common tasks. There are a number of instances where using macros to facilitate the update process could be worthwhile if you are: + +* Following the ROMWBW development builds. +* Doing lots of configuration changes. +* Doing development on ROMWBW drivers + +Macros can be used to automate sending ROM updates or images and for my own purposed I have set up a separate macro for transferring each of the standard build ROM, my own custom configuration ROM and update ROM. + +An example macro file to send an *.upd file, using checksum mode and display the crc32 value of the transmitted file: + +``` +Xmodem send, checksum, display crc32 +xmodemsend '\\desktop\users\phillip\documents\github\romwbw\binary\sbc_std_cust.upd' 1 +crc32file crc '\\desktop\users\phillip\documents\github\romwbw\binary\sbc_std_cust.rom' +sprintf '0x%08x' crc +messagebox inputstr 'crc32' +``` +## Serial speed guidelines + +As identified in the introduction, there are limitations on serial speed depending on processor speed and flow control settings. Listed below are some of the results identified during testing. + +Platform / Configuration | Processor Speed | Maximum Serial Speed +-------------------------------|-----------------|--------------------- +Sbc-v2 uart no flow control | 2mhz | 9600 +sbc-v2 uart no flow control | 4mhz | 19200 +sbc-v2 uart no flow control | 5mhz | 19200 +sbc-v2 uart no flow control | 8mhz | 38400 +sbc-v2 uart no flow control | 10mhz | 38400 +sbc-v2 usb-fifo 2mhz+ | | n/a +sbc-mk4 asci no flow control | 18.432mhz | 9600 +sbc-mk4 asci with flow control | 18.432mhz | 38400 + +The **Set Recommend Baud Rate** option in the Updater menu follows the following guidelines. + +Processor Speed | Baud Rate +----------------|---------- +1Mhz | 4800 +2-3Mhz | 9600 +4-7Mhz | 19200 +8-20Mhz | 38400 + +These can be customized in the updater.asm source code in the CLKTBL table if desired. +Feedback to the ROMWBW developers on these guidelines would be appreciated. + +## Notes: +All testing was done with Teraterm x-modem, Forcing checksum mode using macros was found to give the most reliable transfer. +Partial writes can be completed with 39SF040 chips. Other chips require entire flash to be erased before being written. +An SBC V2-005 MegaFlash or Z80 MBC required for 1mb flash support. The Updater assumes both chips are same type +Failure handling has not been tested. +Timing broadly calibrated on a Z80 SBC-v2 +Unabios not supported diff --git a/Source/Doc/ReadMe.md b/Source/Doc/ReadMe.md new file mode 100644 index 00000000..d62fe67f --- /dev/null +++ b/Source/Doc/ReadMe.md @@ -0,0 +1,233 @@ +$define{doc_title}{ReadMe}$ +$include{"Basic.h"}$ + +# Overview + +RomWBW software provides a complete, commercial quality +implementation of CP/M (and workalike) operating systems and +applications for modern Z80/180/280 retro-computing hardware systems. +A wide variety of platforms are supported including those +produced by these developer communities: + +* [RetroBrew Computers](https://www.retrobrewcomputers.org) +* [RC2014](https://rc2014.co.uk), [RC2014-Z80](https://groups.google.com/g/rc2014-z80) +* [retro-comp](https://groups.google.com/forum/#!forum/retro-comp) +* [Small Computer Central](https://smallcomputercentral.com/) + +General features include: + +* Banked memory services for several banking designs +* Disk drivers for RAM, ROM, Floppy, IDE, CF, and SD +* Serial drivers including UART (16550-like), ASCI, ACIA, SIO +* Video drivers including TMS9918, SY6545, MOS8563, HD6445 +* Keyboard (PS/2) drivers via VT8242 or PPI interfaces +* Real time clock drivers including DS1302, BQ4845 +* OSes: CP/M 2.2, ZSDOS, CP/M 3, NZ-COM, ZPM3, QPM, p-System, and FreeRTOS +* Built-in VT-100 terminal emulation support + +RomWBW is distributed as both source code and pre-built ROM and disk +images. Some of the provided software can be launched directly from the +ROM firmware itself: + +* System Monitor +* Operating Systems (CP/M 2.2, ZSDOS) +* ROM BASIC (Nascom BASIC and Tasty BASIC) +* ROM Forth + +A dynamic disk drive letter assignment mechanism allows mapping +operating system drive letters to any available disk media. +Additionally, mass storage devices (IDE Disk, CF Card, SD Card) support +the use of multiple slices (up to 256 per device). Each slice contains +a complete CP/M filesystem and can be mapped independently to any +drive letter. This overcomes the inherent size limitations in legacy +OSes and allows up to 2GB of accessible storage on a single device. + +The pre-built ROM firmware images are generally suitable for most +users. However, it is also very easy to modify and build custom ROM +images that fully tailor the firmware to your specific preferences. +All tools required to build custom ROM firmware under Windows are +included -- no need to install assemblers, etc. The firmware can also +be built using Linux or MacOS after confirming a few standard tools +have been installed. + +Multiple disk images are provided in the distribution. Most disk +images contain a complete, bootable, ready-to-run implementation of a +specific operating system. A "combo" disk image contains multiple +slices, each with a full operating system implementation. If you use +this disk image, you can easily pick whichever operating system you +want to boot without changing media. + +By design, RomWBW isolates all of the hardware specific functions in +the ROM chip itself. The ROM provides a hardware abstraction layer +such that all of the operating systems and applications on a disk +will run on any RomWBW-based system. To put it simply, you can take +a disk (or CF/SD Card) and move it between systems transparently. + +A tool is provided that allows you to access a FAT-12/16/32 filesystem. +The FAT filesystem may be coresident on the same disk media as RomWBW +slices or on stand-alone media. This makes exchanging files with modern +OSes such as Windows, MacOS, and Linux very easy. + +# Acquiring RomWBW + +The [RomWBW Repository](https://github.com/wwarthen/RomWBW) on GitHub is +the official distribution location for all project source and +documentation. The fully-built distribution releases are available on +the [RomWBW Releases Page](https://github.com/wwarthen/RomWBW/releases) +of the repository. On this page, you will normally see a Development +Snapshot as well as recent stable releases. Unless you have a specific +reason, I suggest you stick to the most recent stable release. Expand +the "Assets" drop-down for the release you want to download, then select +the asset named RomWBW-vX.X.X-Package.zip. The Package asset includes +all pre-built ROM and Disk images as well as full source code. The other +assets contain only source code and do not have the pre-built ROM or +disk images. + +All source code and distributions are maintained on GitHub. Code +contributions are very welcome. + +# Installation & Operation + +In general, installation of RomWBW on your platform is very simple. You +just need to program your ROM with the correct ROM image from the RomWBW +distribution. Subsequently, you can write disk images on your disk +drives (IDE disk, CF Card, SD Card, etc.) which then provides even more +functionality. + +Complete instructions for installation and operation of RomWBW are +found in the $doc_user$. + +## Documentation + +Documentation for $doc_product$ includes: + +* $doc_user$ +* $doc_sys$ +* $doc_apps$ +* $doc_romapps$ +* $doc_errata$ + +# Acknowledgments + +I want to acknowledge that a great deal of the code and inspiration +for RomWBW has been provided by or derived from the work of others +in the RetroBrew Computers Community. I sincerely appreciate all of +their contributions. The list below is probably missing many names -- +please let me know if I missed you! + +* Andrew Lynch started it all when he created the N8VEM Z80 SBC + which became the first platform RomWBW supported. Some of his + original code can still be found in RomWBW. + +* Dan Werner wrote much of the code from which RomWBW was originally + derived and he has always been a great source of knowledge and + advice. + +* Douglas Goodall contributed code, time, testing, and advice in "the + early days". He created an entire suite of application programs to + enhance the use of RomWBW. Unfortunately, they have become unusable + due to internal changes within RomWBW. As of RomWBW 2.6, these + applications are no longer provided. + +* Sergey Kiselev created several hardware platforms for RomWBW + including the very popular Zeta. + +* David Giles created support for the Z180 CSIO which is now included + SD Card driver. + +* Phil Summers contributed the Forth and BASIC adaptations in ROM, the + AY-3-8910 sound driver, DMA support, and a long list of general code + and documentation enhancements. + +* Ed Brindley contributed some of the code that supports the RCBus + platform. + +* Spencer Owen created the RC2014 series of hobbyist kit computers + which has exponentially increased RomWBW usage. Some of his kits + include RomWBW. + +* Stephen Cousins has likewise created a series of hobbyist kit + computers at Small Computer Central and is distributing RomWBW + with many of them. + +* Alan Cox has contributed some driver code and has provided a great + deal of advice. + +* The CP/NET client files were developed by Douglas Miller. + +* Phillip Stevens contributed support for FreeRTOS. + +* Curt Mayer contributed the original Linux / MacOS build process. + +* UNA BIOS and FDISK80 are the products of John Coffman. + +* FLASH4 is a product of Will Sowerbutts. + +* CLRDIR is a product of Max Scane. + +* Tasty Basic is a product of Dimitri Theulings. + +* Dean Netherton contributed the sound driver interface and + the SN76489 sound driver. + +* The RomWBW Disk Catalog document was produced by Mykl Orders. + +Contributions of all kinds to RomWBW are very welcome. + +# Licensing + +RomWBW 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. + +RomWBW 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 RomWBW. If not, see . + +Portions of RomWBW were created by, contributed by, or derived from +the work of others. It is believed that these works are being used +in accordance with the intentions and/or licensing of their creators. + +If anyone feels their work is being used outside of its intended +licensing, please notify: + +> $doc_author$ \ +> [$doc_authmail$](mailto:$doc_authmail$) + +RomWBW is an aggregate work. It is composed of many individual, +standalone programs that are distributed as a whole to function as +a cohesive system. Each program may have its own licensing which +may be different from other programs within the aggregate. + +In some cases, a single program (e.g., CP/M Operating System) is +composed of multiple components with different licenses. It is +believed that in all such cases the licenses are compatible with +GPL version 3. + +RomWBW encourages code contributions from others. Contributors +may assert their own copyright in their contributions by +annotating the contributed source code appropriately. Contributors +are further encouraged to submit their contributions via the RomWBW +source code control system to ensure their contributions are clearly +documented. + +All contributions to RomWBW are subject to this license. + +# Getting Assistance + +The best way to get assistance with RomWBW or any aspect of the +RetroBrew Computers projects is via one of the community forums: + +* [RetroBrew Computers Forum](https://www.retrobrewcomputers.org/forum/) +* [RC2014 Google Group](https://groups.google.com/forum/#!forum/rc2014-z80) +* [retro-comp Google Group](https://groups.google.com/forum/#!forum/retro-comp) + +Submission of issues and bugs are welcome at the +[RomWBW GitHub Repository](https://github.com/wwarthen/RomWBW). + +Also feel free to email $doc_author$ at [$doc_authmail$](mailto:$doc_authmail$). diff --git a/Source/Doc/SIO+CTC Baud Rate Options.xlsx b/Source/Doc/SIO+CTC Baud Rate Options.xlsx new file mode 100644 index 00000000..c2693ba6 Binary files /dev/null and b/Source/Doc/SIO+CTC Baud Rate Options.xlsx differ diff --git a/Source/Doc/SystemGuide.md b/Source/Doc/SystemGuide.md new file mode 100644 index 00000000..e89fada4 --- /dev/null +++ b/Source/Doc/SystemGuide.md @@ -0,0 +1,2535 @@ +$define{doc_title}{System Guide}$ +$include{"Book.h"}$ + +# Overview + +The objective of RomWBW is to provide firmware, operating systems, +and applications targeting the Z80 family of CPUs. The firmware, +in the form of a ROM module, acts as the hardware interface layer +with a well-defined API (the HBIOS). The associated operating +systems and applications are adapted to the HBIOS API, not specific +hardware. + +The HBIOS is modular and configurable. New hardware interfaces can +be added in the form of straightforward driver modules. Within certain +constraints, new hardware platforms can be supported by simply +adjusting values in a build configuration file. + +RomWBW is geared toward hardware being developed in modern +retro-computing hobbyist communities, not as a replacement for +legacy hardware. As a result, RomWBW requires at least 128KB +of bank switched RAM. + +The CP/M family of operating systems has been adapted to run under +RomWBW including CP/M 2.2, Z-System, CP/M 3, and several other +variants. + +RomWBW firmware (ROM) includes: + +* System startup code (bootstrap) and bootloader + +* A basic system/debug monitor + +* HBIOS (Hardware BIOS) with support for most typical hardware + components used in Z80 family computers + +* Diagnostics and customizable debugging information. + +* ROM-hosted operating systems (both CP/M 2.2 and Z-System) + +* A ROM disk containing the standard OS applications and a + RAM disk for working storage. + +It is appropriate to note that much of the code and components that make +up a complete RomWBW package are derived from pre-existing work. Most +notably, the embedded operating system is simply a ROM-based copy of +generic CP/M or ZSDOS. Much of the hardware support code was originally +produced by other members of the RetroBrew Computers Community. + +The remainder of this document focuses on HBIOS which is the +fundamental basis of RomWBW. + +# Background + +The Z80 CPU architecture has a limited, 64K address range. In general, +this address space must accommodate a running application, disk +operating system, and hardware support code. + +Modern retro-computing Z80 CPU platforms provide a physical address +space that is much larger than the CPU address space (typically 512K or +1MB of physical RAM). This additional memory can be made available to +the CPU using a technique called bank switching. To achieve this, the +physical memory is divided up into chunks (banks) of 32K each. A +designated area of the CPU's 64K address space is then reserved to "map" + any of the physical memory chunks. You can think of this as a window +that can be adjusted to view portions of the physical memory in 32K +blocks. In the case of RomWBW, the lower 32K of the CPU address space is + used for this purpose (the window). The upper 32K of CPU address space +is assigned a fixed 32K area of physical memory that never changes. The +lower 32K can be "mapped" on the fly to any of the 32K banks of physical + memory at a time. The only constraint is that the CPU cannot be +executing code in the lower 32K of CPU address space at the time that a +bank switch is performed. + +By utilizing the pages of physical RAM for specific purposes and +swapping in the correct page when needed, it is possible to utilize +substantially more than 64K of RAM. Because the retro-computing +community has now produced a very large variety of hardware, it has +become extremely important to implement a bank switched solution to +accommodate the maximum range of hardware devices and desired +functionality. + +# General Design Strategy + +The design goal is to locate as much of the hardware dependent code as +possible out of normal 64KB CP/M address space and into a bank switched +area of memory. A very small code shim (proxy) is located in the top 512 +bytes of CPU memory. This proxy is responsible for redirecting all +hardware BIOS (HBIOS) calls by swapping the "driver code" bank of +physical RAM into the lower 32K and completing the request. The +operating system is unaware this has occurred. As control is returned to +the operating system, the lower 32KB of memory is switched back to the +original memory bank. + +HBIOS is completely agnostic with respect to the operating system (it +does not know or care what operating system is using it). The operating +system makes simple calls to HBIOS to access any desired hardware +functions. Since the HBIOS proxy occupies only 512 bytes at the top of +memory, the vast majority of the CPU memory is available to the +operating system and the running application. As far as the operating +system is concerned, all of the hardware driver code has been magically +implemented inside of the small 512 byte area at the top of the CPU +address space. + +Unlike some other Z80 bank switching schemes, there is no attempt to +build bank switching into the operating system itself. This is +intentional so as to ensure that any operating system can easily be +adapted without requiring invasive modifications to the operating system +itself. This also keeps the complexity of memory management completely +away from the operating system and applications. + +There are some operating systems that have built-in support for bank +switching (e.g., CP/M 3). These operating systems are allowed to make +use of the bank switched memory and are compatible with HBIOS. However, +it is necessary that the customization of these operating systems take +into account the banks of memory used by HBIOS and not attempt to use +those specific banks. + +Note that all code and data are located in RAM memory during normal +execution. While it is possible to use ROM memory to run code, it would +require that more upper memory be reserved for data storage. It is +simpler and more memory efficient to keep everything in RAM. At startup +(boot) all required code is copied to RAM (shadowed) for subsequent +execution. + +# Runtime Memory Layout + +![Bank Switched Memory Layout](Graphics/BankSwitchedMemory){ width=100% } + +# System Boot Process + +A multi-phase boot strategy is employed. This is necessary because at +cold start, the CPU is executing code from ROM in lower memory which is +the same area that is bank switched. + +RomWBW supports multiple boot techniques as described below. The +most common of these is the ROM boot. + +## ROM Boot + +The ROM boot process normally begins with a system cold start (power on +or hardware reset). The hardware is responsible for ensuring that the +lower 32K of CPU memory (bank window) is mapped to the initial 32K of +the ROM. The Z80 CPU begins execution at address zero which will be +address zero of the ROM. + +The following steps occur during the ROM boot process: + +#. The ROM code performs basic hardware initialization and ensures + that the top 32K of CPU memory is mapped to the proper RAM bank. + +#. The ROM code installs the HBIOS proxy code into the top 512 + bytes of the CPU memory (0xFE00-0xFFFF). + +#. Using the proxy code services, the full HBIOS code is copied + from the ROM bank to the RAM bank that it will use for normal + processing. + +#. Again using the proxy code services, the RAM copy of HBIOS is + activated in the bank window and execution transitions to the + RAM copy of HBIOS. + +#. The HBIOS initializes the system console so that output can now + be displayed to the user. + +#. The HBIOS now performs the full hardware discovery and initialization + process while displaying it's progress. + +#. The HBIOS displays a final summary of the hardware device unit + assignments and various configuration information. + +#. The HBIOS loads the RomWBW Boot Loader from ROM into RAM and + jumps to it. + +At this point, the user would normally use Boot Loader commands +to select and launch an operating system or applications from either +ROM or disk. + +Note that the boot process is entirely operating system agnostic. +It is unaware of the operating system being loaded. The Boot Loader +prompts the user for the location of the binary image to load, but does +not know anything about what is being loaded (the image is usually an +operating system, but could be any executable code image). Once the Boot +Loader has loaded the image at the selected location, it will transfer +control to it. Assuming the typical situation where the image was an +operating system, the loaded operating system will then perform its own +initialization and begin normal operation. + +## Application Boot + +Once the system is running (operating system loaded), it is possible to +reboot the system from a system image (file) contained on the OS file +system. This is referred to as an "Application Boot". The process is +similar to a ROM boot, but the HBIOS code is loaded from an image file +instead of ROM. This boot technique is useful to: 1) test a new build +of a system image before programming it to the ROM; or 2) easily switch +between system images on the fly. + +During the RomWBW build process, one of the output files produced is an +actual CP/M application (an executable .COM program file). Once you have +a running CP/M (or compatible) system, you can upload/copy this +application file to the filesystem. By executing this file, you will +initiate an Application Boot using the system image contained in the +application file itself. + +Upon execution, the Application Boot program is loaded into memory by +the previously running operating system starting at $0100. Note that the +program image contains a full copy of the HBIOS to be installed and run. Once +the Application Boot program is loaded by the previous operating system, +control is passed to it and it performs a system initialization similar +to the ROM Boot, but using the image loaded in RAM. Once the new +HBIOS completes its initialization, it will launch the Boot Loader +just like a ROM boot. + +The Application Boot program actually contains two other components +beyond the new HBIOS. It has a copy of the Boot Loader and a copy of +the Z-System OS. This is done in case the new HBIOS requires updated +versions of the Boot Loader or OS to run. The Boot Loader is aware +of this boot mode and automatically adapts it's menu appropriately. + +If you restart your system, then it will revert to a ROM Boot from +the currently installed ROM. + +## RAM Boot + +Some hardware supported by RomWBW has a special mechanism for loading +the boot and HBIOS code. These systems have no ROM chips. However, +they have a small hardware bootstrap that loads a chunk of code from a +disk device directly into RAM at system startup. + +The startup then proceeds very much like the Application Boot +process described above. HBIOS is installed in its operating bank +and control is passed to the Boot Loader. + +# Driver Model + +The framework code for bank switching also allows hardware drivers to be +implemented mostly without concern for memory management. Drivers are +coded to simply implement the HBIOS functions appropriate for the type +of hardware being supported. When the driver code gets control, it has +already been mapped to the CPU address space and simply performs the +requested function based on parameters passed in registers. Upon return, +the bank switching framework takes care of restoring the original memory +layout expected by the operating system and application. + +Drivers do need to be aware of the bank switching if a buffer address +is being used in the function call. + +* If the buffer address is in the lower 32K of RAM, then the memory + it points to will be from the User Bank, not the HBIOS bank which + is now active. In this case, the driver must use an inter-bank + copy to access the data. + +* If the buffer address is in the top 32K of RAM, then the driver will + have access to it directly even after a bank switch, so no special + steps are required. + +For some functions, the location of the buffer is required to be +in the top 32K of RAM to simplify the operation of the driver. + +It is usually better if the OS or application calling a buffered +function places the buffer in the top 32K because this may avoid +a double-copy operation. + +If driver code must make calls to other code, drivers, or utilities in +the HBIOS bank, it must make those calls directly (it must not use RST +08). This is to avoid a nested bank switch which is not supported at +this time. + +# Character / Emulation / Video Services + +In addition to a generic set of routines to handle typical character +input/output, HBIOS also includes functionality for managing built-in +video display adapters. To start with there is a basic set of character +input/output functions, the CIOXXX functions, which allow for simple +character data streams. These functions fully encompass routing byte +stream data to/from serial ports. Note that there is a special character +pseudo-device called "CRT". When characters are read/written to/from the +CRT character device, the data is actually passed to a built-in terminal +emulator which, in turn, utilizes a set of VDA (Video Display Adapter) +functions (such as cursor positioning, scrolling, etc.). + +Figure 7.1 depicts the relationship between these components +of HBIOS video processing: + +![Character / Emulation / Video Services](Graphics/CharacterEmulationVideoServices){ width=100% } + +Normally, the operating system will simply utilize the CIOXXX functions +to send and receive character data. The Character I/O Services will +route I/O requests to the specified physical device which is most +frequently a serial port (such as UART or ASCI). As shown above, if the +CRT device is targeted by a CIOXXX function, it will actually be routed +to the Emulation Services which implement TTY, ANSI, etc. escape +sequences. The Emulation Services subsequently rely on the Video Display +Adapter Services as an additional layer of abstraction. This allows the +emulation code to be completely unaware of the actual physical device +(device independent). Video Display Adapter (VDA) Services contains +drivers as needed to handle the available physical video adapters. + +Note that the Emulation and VDA Services API functions are available to +be called directly. Doing so must be done carefully so as to not corrupt +the "state" of the emulation logic. + +Before invoking CIOXXX functions targeting the CRT device, it is +necessary that the underlying layers (Emulation and VDA) be properly +initialized. The Emulation Services must be initialized to specify the +desired emulation and specific physical VDA device to target. Likewise, +the VDA Services may need to be initialized to put the specific video +hardware into the proper mode, etc. + +# HBIOS Reference + +## Invocation + +HBIOS functions are invoked by placing the required parameters in CPU +registers and executing an RST 08 instruction. Note that HBIOS does not +preserve register values that are unused. However, the values of the Z80 +alternate registers and IX/IY will be preserved (these registers may be +used within HBIOS, but will be saved and restored internally). + +An alternate method of invoking HBIOS functions is to use `CALL 0xFFF0`. +Since the RST 08 vector exists in page zero of the CPU address space, +it may be paged out when alternate memory banks are selected. If this +may be true when you are invoking a function, you should use the `CALL` +method. + +Normally, applications will not call HBIOS functions directly. It is +intended that the operating system makes all HBIOS function calls. +Applications that are considered system utilities may use HBIOS, but +must be careful not to modify the operating environment in any way that +the operating system does not expect. + +In general, the desired function is placed in the B register. Register C +is frequently used to specify a subfunction or a target device unit +number. Additional registers are used as defined by the specific +function. Register A should be used to return function result +information. See below for result code definitions. + +The character, disk, and video device functions all refer to target +devices using a logical device unit number that is passed in the C +register. Keep in mind that these unit numbers are assigned dynamically +at HBIOS initialization during the device discovery process. The +assigned unit numbers are displayed on the console at the conclusion of +device initialization. The unit assignments will never change after +HBIOS initialization. However, they can change at the next boot if there +have been hardware or BIOS customization changes. Code using HBIOS +functions should not assume fixed unit assignments. + +Some functions utilize pointers to memory buffers. Unless otherwise +stated, such buffers can be located anywhere in the Z80 CPU 64K address +space. However, performance sensitive buffers (primarily disk I/O +buffers) will require double-buffering if the caller’s buffer is in the +lower 32K of CPU address space. For optimal performance, such buffers +should be placed in the upper 32K of CPU address space. + +## Result Codes + +The following function result codes are defined generically for all +HBIOS functions. Most function calls will return a result in register A. + +| **Code** | **Definition** | +|---------:|----------------------------------------| +| 0 | function succeeded | +| -1 | undefined error | +| -2 | function not implemented | +| -3 | invalid function | +| -4 | invalid unit number | +| -5 | out of memory | +| -6 | parameter out of range | +| -7 | media not present | +| -8 | hardware not present | +| -9 | I/O error | +| -10 | write request to read-only media | +| -11 | device timeout | +| -12 | invalid configuration | + +`\clearpage`{=latex} + +## Character Input/Output (CIO) + +Character Input/Output functions require that a Character Unit number be +specified in register C. This is the logical device unit number +assigned during the boot process that identifies all character +devices uniquely. A special value of 0x80 can be used for the Character +Unit to refer to the current console device. + +All character units are assigned a Device Type ID which indicates +the specific hardware device driver that handles the unit. The table +below enumerates these values. + +| **Device Type** | **ID** | **Description** | **Driver** | +|-----------------|-------:|------------------------------------------|------------| +| CIODEV_UART | 0x00 | 16C550 Family Serial Interface | uart.asm | +| CIODEV_ASCI | 0x10 | Z180 Built-in Serial Ports | asci.asm | +| CIODEV_TERM | 0x20 | Terminal | ansi.asm | +| CIODEV_PRPCON | 0x30 | PropIO Serial Console Interface | prp.asm | +| CIODEV_PPPCON | 0x40 | ParPortProp Serial Console Interface | ppp.asm | +| CIODEV_SIO | 0x50 | Zilog Serial Port Interface | sio.asm | +| CIODEV_ACIA | 0x60 | MC68B50 Asynchronous Interface | acia.asm | +| CIODEV_PIO | 0x70 | Zilog Parallel Interface Controller | pio.asm | +| CIODEV_UF | 0x80 | FT232H-based ECB USB FIFO | uf.asm | +| CIODEV_DUART | 0x90 | SCC2681 Family Dual UART | duart.asm | +| CIODEV_Z2U | 0xA0 | Zilog Z280 Built-in Serial Ports | z2u.asm | +| CIODEV_LPT | 0xB0 | Parallel I/O Controller | lpt.asm | + +Character devices can usually be configured with line characteristics +such as speed, framing, etc. A word value (16 bit) is used to describe +the line characteristics as indicated below: + +| **Bits** | **Characteristic** | +|---------:|----------------------------------------| +| 15-14 | Reserved (set to 0) | +| 13 | RTS | +| 12-8 | Baud Rate (see below) | +| 7 | DTR | +| 6 | XON/XOFF Flow Control | +| 5 | Stick Parity (set for true) | +| 4 | Even Parity (set for true) | +| 3 | Parity Enable (set for true) | +| 2 | Stop Bits (set for true) | +| 1-0 | Data Bits (5-8 encoded as 0-3) | + +The 5-bit Baud Rate value (V) is encoded as V = 75 * 2^X * 3^Y. The +bits are defined as YXXXX. + +Actual character values are a single byte (8 bits). The Character I/O +functions do not modify or interpret the values being sent/received +so they can be used to pass 8-bit binary data without corruption. Note +that some OSes will modify character data (truncate to 7 bits, etc.). + +### Function 0x00 -- Character Input (CIOIN) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x00 | A: Status | +| C: Character Unit | E: Character | + +Read and return a Character (E) from the specified Character Unit +(C). If no character(s) are available in the unit's input buffer, this +function will wait indefinitely. The returned Status (A) is a standard +HBIOS result code. + +### Function 0x01 -- Character Output (CIOOUT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x01 | A: Status (0-OK, else error) | +| C: Character Unit | | +| E: Character | | + +Send a Character (E) via the specified Character Unit (C). If +there is no space available in the unit's output buffer, the function +will wait indefinitely. The returned Status (A) is a standard HBIOS result code. + +### Function 0x02 -- Character Input Status (CIOIST) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x02 | A: Status / Characters Pending | +| C: Character Unit | | + +Return the count of Characters Pending (A) in the input buffer of the +specified Character Unit (C). If the unit has no input buffer or the +buffer utilization is not available, the function may return simply 0 or +1 where 0 means there is no character available and 1 means there is at +least one character available. + +The value returned in register A is used as both a Status (A) code and +the return value. Negative values (bit 7 set) indicate a standard HBIOS +result (error) code. Otherwise, the return value represents the number +of characters in the input buffer. + +### Function 0x03 -- Character Output Status (CIOOST) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x03 | A: Status / Space Free | +| C: Character Unit | | + +Return the count of buffer Space Free (A) for the specified +Character Unit (C). For example, if a 16 byte output buffer contains 6 +characters waiting to be sent out the unit's serial interface, this +function would return 10; the number of positions available in the +output buffer. If the port has no output buffer or the buffer +utilization is not available, the function may return simply 0 or 1 +where 0 means there is no buffer space available and 1 means there is +space in the output buffer for at least one character. + +The return value in register A is used as both a status code and the +return value. Negative values (bit 7 set) indicate a standard HBIOS +result (error) code. Otherwise, the return value represents the buffer +space available. + +### Function 0x04 -- Character I/O Initialization (CIOINIT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x04 | A: Status | +| C: Character Unit | | +| DE: Line Characteristics | | + +Condition the interface of the specified Character Unit (C) according to +the specified Line Characteristics (DE). The definition of the line +characteristics value is described above. If DE contains -1 (0xFFFF), +then the device will be reinitialized with the previous line +characteristics used (a reset) and any buffer contents will be flushed. +The Status (A) is a standard HBIOS result code. + +Not all line characteristics are supported by all character interfaces. +It is up to the driver of the character unit to decide how to deal +with characteristics that are not available. For example, many +character drivers do not allow flow control settings (RTS/CTS, XON/XOFF) +to be modified dynamically. In most cases, these settings are ignored +by the driver in this function call. + +### Function 0x05 -- Character I/O Query (CIOQUERY) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x05 | A: Status | +| C: Character Unit | DE: Line Characteristics | + +Returns the current Line Characteristics (DE) of the specified Character + Unit (C). The definition of the line characteristics value is described + above. The returned status (A) is a standard HBIOS result code. + +### Function 0x06 -- Character I/O Device (CIODEVICE) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x06 | A: Status | +| C: Character Unit | C: Device Attributes | +| | D: Device Type | +| | E: Device Number | +| | H: Device Mode | +| | L: Device I/O Base Address | + +Returns device information for the specified Character Unit (C). The +status (A) is a standard HBIOS result code. + +Device Attribute (C) values are: 0 = RS/232, 1 = Terminal, 2 = Parallel. + +Device Type (D) indicates the specific hardware driver that handles the +specified Character Unit. Values are listed at the start of this +section. Device Number (E) indicates the physical device number assigned +per driver. For example, a Device Type of 0x50 with a Device Number +of 2 refers to the third port being handled by the SIO driver. + +Device Mode (H) is used to indicate the variant of the chip or +circuit that is used by the specified unit. For example, for a UART, +the value indicates the chip variant. The Device I/O Base Address (L) +indicates the starting port address of the hardware interface that is +servicing the specified unit. Both of these values are considered +driver specific. Refer to the associated hardware driver for the +values used. + +`\clearpage`{=latex} + +## Disk Input/Output (DIO) + +Disk Input/Output functions require that a Disk Unit number be specified +in register C. This is the logical device unit number assigned +during the boot process that identifies all disk devices uniquely. + +All character units are assigned a Device Type ID which indicates +the specific hardware device driver that handles the unit. The table +below enumerates there values. + +| **Device Type** | **ID** | **Description** | **Driver** | +|-----------------|-------:|------------------------------------------|------------| +| DIODEV_MD | 0x00 | Memory Disk | md.asm | +| DIODEV_FD | 0x10 | Floppy Disk | fd.asm | +| DIODEV_RF | 0x20 | RAM Floppy | rf.asm | +| DIODEV_IDE | 0x30 | IDE Disk | ide.asm | +| DIODEV_ATAPI | 0x40 | ATAPI Disk (not implemented) | | +| DIODEV_PPIDE | 0x50 | PPIDE Disk | ppide.asm | +| DIODEV_SD | 0x60 | SD Card | sd.asm | +| DIODEV_PRPSD | 0x70 | PropIO SD Card | prp.asm | +| DIODEV_PPPSD | 0x80 | ParPortProp SD Card | ppp.asm | +| DIODEV_HDSK | 0x90 | SIMH HDSK Disk | hdsk.asm | + +A fixed set of media types are defined. The currently defined media +types identifiers are listed below. Each driver will support one or +more of the defined media types. + +| **Media** | **ID** | **Format** | +|---------------|-------:|--------------------------------------------| +| MID_NONE | 0 | No media installed | +| MID_MDROM | 1 | ROM Drive | +| MID_MDRAM | 2 | RAM Drive | +| MID_RF | 3 | RAM Floppy (LBA) | +| MID_HD512 | 4 | Hard Disk (LBA) w/ 512 directory entries | +| MID_FD720 | 5 | 3.5" 720K Floppy | +| MID_FD144 | 6 | 3.5" 1.44M Floppy | +| MID_FD360 | 7 | 5.25" 360K Floppy | +| MID_FD120 | 8 | 5.25" 1.2M Floppy | +| MID_FD111 | 9 | 8" 1.11M Floppy | +| MID_HD1K | 10 | Hard Disk (LBA) w/ 1024 directory entries | + +HBIOS supports both Cylinder/Head/Sector (CHS) and Logical Block +Addresses (CHS) when locating a sector for I/O (see DIOSEEK function). +For devices that are natively CHS (e.g., floppy disk), the HBIOS driver +can convert LBA values to CHS values according to the geometry of the +current media. For devices that are natively LBA (e.g., hard disk), the + HBIOS driver simulates CHS using a fictitious geometry provided by the +driver (typically 16 sectors per track and 16 heads per cylinder). + +### Function 0x10 -- Disk Status (DIOSTATUS) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x10 | A: Status | +| C: Disk Unit | | + +Returns the driver specific Status (A) of the specified disk device unit +(C) based on the last operation performed. + +The return value in register A is used as both a device status and a +standard HBIOS result code. Negative values (bit 7 set) indicate a +standard HBIOS result (error) code. Otherwise, the return value +represents a driver-specific device status. In all cases, the value 0 +means OK. + +### Function 0x11 -- Disk Reset (DIORESET) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x11 | A: Status | +| C: Disk Unit | | + +This function performs a device dependent reset operation on the Disk +Unit specified (C). The driver will clear any error status on the disk +unit, attempt to reset the interface, and flag the disk unit for +initialization on the next I/O function call. Any prior media +identification will be cleared. The returned Status (A) is a standard +HBIOS result code. + +If the specified disk unit (C) is one of multiple units on a single +hardware bus, then all units on that bus will be reset. For example, +if the master disk on an IDE bus is reset, then the slave disk will +also be reset. + +### Function 0x12 -- Disk Seek (DIOSEEK) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x12 | A: Status | +| C: Disk Unit | | +| DEHL: Sector Address | | + +This function will set the desired sector to be used for the next I/O +operation on the specified Disk Unit (C). The returned Status (A) is a +standard HBIOS result code. + +An actual seek operation is generally not performed on the disk hardware +by this function. The function typically just records the sector +address for subsequent I/O function calls. + +The double-word Sector Address (DEHL) can represent either a Logical +Block Address (LBA) or a Cylinder/Head/Sector (CHS). If the high bit of +register D is set, then an LBA value is specified. Otherwise, the +value is CHS. + +For LBA mode operation, the high bit is cleared and the entire +double-word is then treated as the logical sector address. + +For CHS mode operation, the Sector Address (DEHL) registers are +interpreted as: D=Head, E=Sector, and HL=Track. All values (including +sector) are 0 relative. + +Prior versions of the floppy driver did not accept LBA mode addresses. +However, this restriction has been removed as of HBIOS v3.1. At this +point, all disk drivers support both LBA and CHS addressing. + +### Function 0x13 -- Disk Read (DIOREAD) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x13 | A: Status | +| C: Disk Unit | E: Sectors Read | +| D: Buffer Bank ID | | +| E: Sector Count | | +| HL: Buffer Address | | + +Read Sector Count (E) sectors into the buffer located in Buffer Bank ID (D) +at Buffer Address (HL) starting at the Current Sector. The returned +Status (A) is a standard HBIOS result code. + +The Current Sector is established by a prior DIOSEEK function call; +however, multiple read/write/verify function calls can be made after a +seek function. The Current Sector is incremented after each sector +successfully read. On error, the Current Sector will be the sector where +the error occurred. Sectors Read (E) indicates the number of sectors +successfully read. + +The caller must ensure that the Buffer Address is large enough to +contain all sectors requested. Disk data transfers will be faster if +the buffer resides in the top 32K of memory because it avoids a +double buffer copy. + +### Function 0x14 -- Disk Write (DIOWRITE) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x14 | A: Status | +| C: Disk Unit | E: Sectors Written | +| D: Buffer Bank ID | | +| E: Sector Count | | +| HL: Buffer Address | | + +Write Sector Count (E) sectors from the buffer located in Buffer Bank ID (D) +at Buffer Address (HL) starting at the Current Sector. The returned +Status (A) is a standard HBIOS result code. + +The Current Sector is established by a prior DIOSEEK function call; +however, multiple read/write/verify function calls can be made after a +seek function. The Current Sector is incremented after each sector +successfully written. On error, the Current Sector will be the sector +where the error occurred. Sectors Written (E) indicates the number of +sectors successfully written. + +Disk data transfers will be faster if the buffer resides in the top 32K +of memory because it avoids a double copy. + +### Function 0x15 -- Disk Verify (DIOVERIFY) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x15 | A: Status | +| C: Disk Unit | E: Sectors Verified | +| E: Sector Count | | + +**\*\*\* Function Not Implemented \*\*\*** + +### Function 0x16 -- Disk Format (DIOFORMAT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x16 | A: Status | +| C: Disk Unit | | +| D: Head | | +| E: Fill Byte | | +| HL: Cylinder | | + +**\*\*\* Function Not Implemented \*\*\*** + +### Function 0x17 -- Disk Device (DIODEVICE) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x17 | A: Status | +| C: Disk Unit | C: Device Attributes | +| | D: Device Type | +| | E: Device Number | +| | H: Device Unit Mode | +| | L: Device I/O Base Address | + +Reports device information about the specified Disk Unit (C). The +Status (A) is a standard HBIOS result code. + +Bit 7 of the Device Attribute (C) value returned indicates whether the +device is a floppy disk. If it is a floppy disk, the Device Attribute +(C) value is encoded as follows: + +| **Bits** | **Definition** | +|---------:|--------------------------------------------------| +| 7 | = 1 (Floppy Disk) | +| 6-5 | Form Factor: 0=8", 1=5.25", 2=3.5", 3=Other | +| 4 | Sides: 0=SS, 1=DS | +| 3-2 | Density: 0=SD, 1=DD, 2=HD, 3=ED | +| 1-0 | Reserved | + +If the Disk Unit (C) specified is a not floppy disk, then the Device +Attribute (C) encoding is as follows: + +| **Bits** | **Definition** | +|---------:|--------------------------------------------------| +| 7 | = 0 (not Floppy Disk) | +| 6 | Removable | +| 5-3 | Type: 0=Hard, 1=CF, 2=SD, 3=USB, | +| | 4=ROM, 5=RAM, 6=RAMF, 7=FLASH | +| 2-0 | Reserved | + +Device Type (D) indicates the specific hardware driver that handles the +specified Disk Unit (C). Values are listed at the start of this +section. Device Number (E) indicates the physical device number assigned +per driver. For example, a Device Type of 0x30 with a Device Number +of 1 refers to the second disk being handled by the IDE driver. + +Device Mode (H) is used to indicate the variant of the chip or circuit +that is used by the specified unit. For example, for an IDE unit, the +value indicates the IDE circuit variant. The Device I/O Base Address +(L) indicates the starting port address of the hardware interface that +is servicing the specified unit. Both of these values are considered +driver specific. Refer to the associated hardware driver for the values +used. + +### Function 0x18 -- Disk Media (DIOMEDIA) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x18 | A: Status | +| C: Disk Unit | E: Media ID | +| E: Flags | | + +Report the Media ID (E) for the for media in the specified Disk Unit +(C). If bit 0 of Flags (E) is set, then media discovery or verification +will be performed. The Status (A) is a standard HBIOS result code. If +there is no media in device, function will return an error status. + +### Function 0x19 -- Disk Define Media (DIODEFMED) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x19 | A: Status | +| C: Disk Unit | | +| E: Media ID | | + +**\*\*\* Function Not Implemented \*\*\*** + +### Function 0x1A -- Disk Capacity (DIOCAPACITY) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x1A | A: Status | +| C: Disk Unit | DEHL: Sector Count | +| | BC: Block Size | + +Report the current media capacity information for the specified Disk Unit (C). +The Sector Count (DEHL) is a double-word number representing the +total number of blocks on the device. Block Size (BC) contains the block +size in bytes. The Status (A) is a standard HBIOS result code. If the +media is unknown, an error will be returned. + +This function will not attempt to discover or verify the media loaded in +the unit specified. You can use precede this function with the +DIOMEDIA function to force this if desired. + +### Function 0x1B -- Disk Geometry (DIOGEOMETRY) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x1B | A: Status | +| C: Disk Unit | D: Heads | +| | E: Sectors | +| | HL: Cylinder Count | +| | BC: Block Size | + +Report the geometry for the media in the specified Disk Unit (C). If a +device uses LBA mode addressing natively, then the drivers simulated +geometry will be returned. The Status (A) is a standard HBIOS result +code. If the media is unknown, an error will be returned. + +Heads (D) refers to the number of heads per cylinder. Sectors (E) +refers to the number of sectors per track. Cylinder Count (HL) is the +total number of cylinders addressable for the media. Block Size (BC) +is the number of bytes in one sector. + +`\clearpage`{=latex} + +## Real Time Clock (RTC) + +The Real Time Clock functions provide read/write access to the clock and +related Non-Volatile RAM. + +HBIOS only supports a single RTC device since there is no reason to have +more than one at a time. The RTC unit is assigned a Device Type ID +which indicates the specific hardware device driver that handles the +unit. The table below enumerates these values. + +| **Device Type** | **ID** | **Description** | **Driver** | +|-----------------|-------:|------------------------------------------|------------| +| RTCDEV_DS | 0x00 | Maxim DS1302 Real-Time Clock w/ NVRAM | dsrtc.asm | +| RTCDEV_BQ | 0x10 | BQ4845P Real Time Clock | bqrtc.asm | +| RTCDEV_SIMH | 0x20 | SIMH Simulator Real-Time Clock | simrtc.asm | +| RTCDEV_INT | 0x30 | Interrupt-based Real Time Clock | intrtc.asm | +| RTCDEV_DS7 | 0x40 | Maxim DS1307 PCF I2C RTC w/ NVRAM | ds7rtc.asm | +| RTCDEV_RP5 | 0x50 | Ricoh RPC01A Real-Time Clock w/ NVRAM | rp5rtc.asm | + +The time functions to get and set the time (RTCGTM and RTCSTM) require a +6 byte date/time buffer in the following format. Each byte is BCD +encoded. + +| **Offset** | **Contents** | +|-----------:|-----------------------------------------| +| 0 | Year (00-99) | +| 1 | Month (01-12) | +| 2 | Date (01-31) | +| 3 | Hours (00-24) | +| 4 | Minutes (00-59) | +| 5 | Seconds (00-59) | + +### Function 0x20 -- RTC Get Time (RTCGETTIM) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x20 | A: Status | +| HL: Date/Time Buffer Address | | + +Read the current value of the real-time clock and store the date/time in +the Date/Time Buffer pointed to by HL. The Status (A) is a standard +HBIOS result code. + +### Function 0x21 -- RTC Set Time (RTCSETTIM) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x21 | A: Status | +| HL: Date/Time Buffer Address | | + +Set the current value of the real-time clock based on the Date/Time +Buffer pointed to by HL. The Status (A) is a standard HBIOS result +code. + +### Function 0x22 -- RTC Get NVRAM Byte (RTCGETBYT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x22 | A: Status | +| C: Index | E: Value | + +Read a single byte Value (E) from the Non-Volatile RAM of the RTC at the +byte offset Index (C). The Status (A) is a standard HBIOS result code. + +### Function 0x23 -- RTC Set NVRAM Byte (RTCSETBYT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x23 | A: Status | +| C: Index | | +| E: Value | | + +Set a single byte Value (E) of the Non-Volatile RAM of the RTC at the +byte offset Index (C). The Status (A) is a standard HBIOS result code. + +### Function 0x24 -- RTC Get NVRAM Block (RTCGETBLK) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x24 | A: Status | +| HL: Buffer Address | | + +Read the entire contents of the Non-Volatile RAM into to a buffer +pointed to by Buffer Address (HL). The Status (A) is a standard HBIOS +result code. + +### Function 0x25 -- RTC Set NVRAM Block (RTCSETBLK) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x25 | A: Status | +| HL: Buffer Address | | + +Write the entire contents of the Non-Volatile RAM from the buffer +pointed to by Buffer Address (HL). The Status (A) is a standard HBIOS +result code. + +### Function 0x26 -- RTC Get Alarm (RTCGETALM) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x26 | A: Status | +| HL: Date/Time Buffer Address | | + +Work in progress, documentation required... + +### Function 0x27 -- RTC Set Alarm (RTCSETALM) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x27 | A: Status | +| HL: Date/Time Buffer Address | | + +Work in progress, documentation required... + +### Function 0x28 -- RTC DEVICE (RTCDEVICE) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x28 | A: Status | +| | C: Device Attributes | +| | D: Device Type | +| | E: Device Number | +| | H: Device Unit Mode | +| | L: Device I/O Base Address | + +Returns device information for the RTC unit. The Status (A) is a +standard HBIOS result code. + +Device Attribute (C) values are not yet defined. Device Type (D) +indicates the specific hardware driver that handles the specified +character unit. Values are listed at the start of this section. Device +Number (E) indicates the physical device number assigned per driver +which is always 0 for RTC. + +Device Mode (H) is used to indicate the variant of the chip or circuit +that is used by the specified unit. The Device I/O Base Address (L) +indicates the starting port address of the hardware interface that is +servicing the specified unit. Both of these values are considered +driver specific. Refer to the associated hardware driver for the values +used. + +`\clearpage`{=latex} + +## Video Display Adapter (VDA) + +The VDA functions are provided as a common interface to Video Display +Adapters. Not all VDAs will include keyboard hardware. In this case, the +keyboard functions should return a failure status. + +All video units are assigned a Device Type ID which indicates +the specific hardware device driver that handles the unit. The table +below enumerates there values. + +| **Device Type** | **ID** | **Description** | **Driver** | +|-----------------|-------:|------------------------------------------|------------| +| VDADEV_VDU | 0x00 | MC6845 Family Video Display Controller | vdu.asm | +| VDADEV_CVDU | 0x10 | MC8563-based Video Display Controller | cvdu.asm | +| VDADEV_GDC | 0x20 | uPD7220 Video Display Controller | gdc.asm | +| VDADEV_TMS | 0x30 | TMS9918/38/58 Video Display Controller | tms.asm | +| VDADEV_VGA | 0x40 | HD6445CP4-based Video Display Controller | vga.asm | + +Depending on the capabilities of the hardware, the use of colors and +attributes may or may not be supported. If the hardware does not support +these capabilities, they will be ignored. + +Color byte values are constructed using typical RGBI +(Red/Green/Blue/Intensity) bits. The high four bits of the value determine +the background color and the low four bits determine the foreground color. +This results in 16 unique color values for both foreground and background. +The following table illustrates the color byte value construction: + +|   | **Bit** | **Color** | +|------------|--------:|-----------| +| Background | 7 | Intensity | +|   | 6 | Blue | +|   | 5 | Green | +|   | 4 | Red | +| Foreground | 3 | Intensity | +|   | 2 | Blue | +|   | 1 | Green | +|   | 0 | Red | + +The following table illustrates the resultant color for each of the +possible 16 values for foreground or background: + +| **Foreground** | **Background** | **Color** | +|--------------------|--------------------| ----------------| +| n0 nnnn0000 | 0n 0000nnnn | Black | +| n1 nnnn0001 | 1n 0001nnnn | Red | +| n2 nnnn0010 | 2n 0010nnnn | Green | +| n3 nnnn0011 | 3n 0011nnnn | Brown | +| n4 nnnn0100 | 4n 0100nnnn | Blue | +| n5 nnnn0101 | 5n 0101nnnn | Magenta | +| n6 nnnn0110 | 6n 0110nnnn | Cyan | +| n7 nnnn0111 | 7n 0111nnnn | White | +| n8 nnnn1000 | 8n 1000nnnn | Gray | +| n9 nnnn1001 | 9n 1001nnnn | Light Red | +| nA nnnn1010 | An 1010nnnn | Light Green | +| nB nnnn1011 | Bn 1011nnnn | Yellow | +| nC nnnn1100 | Cn 1100nnnn | Light Blue | +| nD nnnn1101 | Dn 1101nnnn | Light Magenta | +| nE nnnn1110 | En 1110nnnn | Light Cyan | +| nF nnnn1111 | Fn 1111nnnn | Bright White | + +Attribute byte values are constructed using the following bit encoding: + +| **Bit** | **Effect** | +|--------:|------------| +| 7 | n/a (0) | +| 6 | n/a (0) | +| 5 | n/a (0) | +| 4 | n/a (0) | +| 3 | n/a (0) | +| 2 | Reverse | +| 1 | Underline | +| 0 | Blink | + +The following codes are returned by a keyboard read to signify non-ASCII +keystrokes: + +| **Value** | **Keystroke** | **Value** | **Keystroke** | +|----------:|---------------|----------:|---------------| +| 0xE0 | F1 | 0xF0 | Insert | +| 0xE1 | F2 | 0xF1 | Delete | +| 0xE2 | F3 | 0xF2 | Home | +| 0xE3 | F4 | 0xF3 | End | +| 0xE4 | F5 | 0xF4 | PageUp | +| 0xE5 | F6 | 0xF5 | PadeDown | +| 0xE6 | F7 | 0xF6 | UpArrow | +| 0xE7 | F8 | 0xF7 | DownArrow | +| 0xE8 | F9 | 0xF8 | LeftArrow | +| 0xE9 | F10 | 0xF9 | RightArrow | +| 0xEA | F11 | 0xFA | Power | +| 0xEB | F12 | 0xFB | Sleep | +| 0xEC | SysReq | 0xFC | Wake | +| 0xED | PrintScreen | 0xFD | Break | +| 0xEE | Pause | 0xFE | | +| 0xEF | App | 0xFF | | + +### Function 0x40 -- Video Initialize (VDAINI) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x40 | A: Status | +| C: Video Unit | | +| E: Video Mode | | +| HL: Font Bitmap | | + +Performs a full (re)initialization of the specified Video Unit (C). The +screen is cleared and the keyboard buffer is flushed. If the specified +Video Unit (C) supports multiple video modes, a Video Mode (E) can be +specified (set to 0 for default/not specified). Video Mode (E) values +are specific to each VDA. The returned Status (A) is a standard HBIOS +result code. + +If the hardware and driver support it, you can specify a Font Bitmap +(HL) buffer address containing the character bitmap data to be loaded +into the video processor. The buffer **must** be located entirely in the +top 32K of the CPU memory space. HL must be set to zero if no character +bitmap is specified (the driver will utilize a default character +bitmap). + +### Function 0x41 -- Video Query (VDAQRY) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x41 | A: Status | +| C: Video Unit | C: Video Mode | +| HL: Font Bitmap | D: Rows | +| | E: Columns | +| | HL: Font Bitmap | + +Return information about the specified Video Unit (C). Video Mode (C) +will be set to the current video mode. Rows (D) and Columns (E) will +return the dimensions of the video display as measured in rows and +columns. Note that this is the **count** of rows and columns, not the +**last** row/column number. The returned Status (A) is a standard HBIOS +result code. + +If the hardware and driver support it, you can specify a Font Bitmap (HL) +buffer address that will be filled with the current +character bitmap data. The buffer **must** be located entirely in the +top 32K of the CPU memory space. Font Bitmap (HL) **must** be set to +zero if it does not point to a proper buffer area or memory corruption +will result. + +If HL is not zero, it must point to a suitably sized memory buffer in +the upper 32K of CPU address space that will be filled with the current +character bitmap data. It is critical that HL be set to zero if it does +not point to a proper buffer area or memory corruption will result. If +the video device driver does not have the ability to provide character bitmap +data, then Font Bitmap (HL) will be set to zero on return. + +### Function 0x42 -- Video Reset (VDARES) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x42 | A: Status | +| C: Video Unit | | + +Performs a soft reset of the specified Video Unit (C). Will clear the +screen, home the cursor, and restore active attribute/color to defaults. +Keyboard will be flushed. The current video mode will not be changed. +The returned Status (A) is a standard HBIOS result code. + +### Function 0x43 -- Video Device (VDADEV) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x43 | A: Status | +| C: Video Unit | C: Device Attributes | +| | D: Device Type | +| | E: Device Number | +| | H: Device Unit Mode | +| | L: Device I/O Base Address | + +Reports device information about the specified Video Unit (C). The +Status (A) is a standard HBIOS result code. + +Device Attribute (C) values are not yet defined. + +Device Type (D) indicates the specific hardware driver that handles the +specified Video Unit (C). Values are listed at the start of this +section. Device Number (E) indicates the physical device number assigned +per driver. + +Device Mode (H) is used to indicate the variant of the chip or circuit +that is used by the specified unit. For example, for an TMS video unit, the +value indicates the TMS circuit variant. The Device I/O Base Address +(L) indicates the starting port address of the hardware interface that +is servicing the specified unit. Both of these values are considered +driver specific. Refer to the associated hardware driver for the values +used. + +### Function 0x44 -- Video Set Cursor Style (VDASCS) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x44 | A: Status | +| C: Video Unit | | +| D: Start/End | | +| E: Style | | + +If supported by the specified Video Unit (C), adjust the format of the +cursor such that the cursor starts at the pixel specified in the top +nibble of Start/End (D) and ends at the pixel specified in the bottom +nibble of Start/End (D). So, if D=0x08, a block cursor would be used +that starts at the top pixel of the character cell and ends at the ninth +pixel of the character cell. The Status (A) is a standard HBIOS result +code. + +Style (E) is reserved to control the style of the cursor (blink, +visibility, etc.), but is not yet implemented. + +Adjustments to the cursor style may or may not be possible for any given +video hardware and may be dependent on the active video mode. + +### Function 0x45 -- Video Set Cursor Position (VDASCP) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x45 | A: Status | +| C: Video Unit | | +| D: Row | | +| E: Column | | + +Reposition the cursor of the specified Video Unit (C) to the specified +Row (D) and Column (E). Specifying a row/column that exceeds the +boundaries of the display results in undefined behavior. Cursor +coordinates are 0 based (0,0 is the upper left corner of the display). +The Status (A) is a standard HBIOS result code. + +### Function 0x46 -- Video Set Character Attribute (VDASAT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x46 | A: Status | +| C: Video Unit | | +| E: Attribute | | + +Assign the specified character Attribute (E) code to be used for all +subsequent character writes/fills on the specified Video Unit (C). This +attribute is used to fill new lines generated by scroll operations. The +character attributes values are listed above. Note that a given video +display may or may not support any/all attributes. The Status (A) is a +standard HBIOS result code. + +### Function 0x47 -- Video Set Character Color (VDASCO) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x47 | A: Status | +| C: Video Unit | | +| E: Color | | + +Assign the specified Color (E) code to be used for all subsequent +character writes/fills. This color is also used to fill new lines +generated by scroll operations. Refer to the color code table above for +a list of the available color codes. Note that a given video display may +or may not support any/all colors. The Status (A) is a standard HBIOS +result code. + +### Function 0x48 -- Video Write Character (VDAWRC) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x48 | A: Status | +| C: Video Unit | | +| E: Character | | + +Write the Character (E) value to the display of the specified Video Unit +(C). The character is written starting at the current cursor position +and the cursor is advanced. If the end of the line is encountered, the +cursor will be advanced to the start of the next line. The display will +**not** scroll if the end of the screen is exceeded. The Status (A) is +a standard HBIOS result code. + +### Function 0x49 -- Video Fill (VDAFIL) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x49 | A: Status | +| C: Video Unit | | +| E: Character | | +| HL: Count | | + +Write the Character (E) value to the Video Unit (C) display the number +of times specified by Count (HL). Characters are written starting at the +current cursor position and the cursor is advanced by the number of +characters written. If the end of the line is encountered, the +characters will continue to be written starting at the next line as +needed. The display will **not** scroll if the end of the screen is +exceeded. Writing characters beyond the end of the screen results in +undefined behavior. The Status (A) is a standard HBIOS result code. + +### Function 0x4A -- Video Copy (VDACPY) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x4A | A: Status | +| C: Video Unit | | +| D: Source Row | | +| E: Source Column | | +| L: Count | | + +Copy Count (L) bytes from the specified Video Unit (C) display Source +Row (D) and Source Column (E) to the current cursor position. The cursor +position is not updated. The maximum Count (L) value is 255. Copying +to/from overlapping areas is not supported and will have an undefined +behavior. The display will **not** scroll if the end of the screen is +exceeded. Copying beyond the active screen buffer area is not supported +and results in undefined behavior. The Status (A) is a standard HBIOS +result code. + +### Function 0x4B -- Video Scroll (VDASCR) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x4B | A: Status | +| C: Video Unit | | +| E: Lines | | + +Scroll the video display of the specified Video Unit (C) forward or +backwards by number of Lines (E) specified. If Lines (E) is positive, +then a forward scroll is performed. If Lines (E) contains a negative +number, then a reverse scroll will be performed. This function will +scroll the entire screen contents. New lines revealed during the scroll + operation will be filled with space characters (0x20) using the active +character attribute and color. The cursor position will **not** be +updated. The Status (A) is a standard HBIOS result code. + +### Function 0x4C -- Video Keyboard Status (VDAKST) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x4C | A: Status / Codes Pending | +| C: Video Unit | | + +Return a count of the number of key Codes Pending (A) in the keyboard +buffer for the specified Video Unit (C). If it is not possible to +determine the actual number in the buffer, it is acceptable to return 1 +to indicate there are key codes available to read and 0 if there are +none available. + +The value returned in register A is used as both a Status (A) code and +the return value. Negative values (bit 7 set) indicate a standard HBIOS +result (error) code. Otherwise, the return value represents the number +of key codes pending. + +### Function 0x4D -- Video Keyboard Flush (VDAKFL) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x4D | A: Status | +| C: Video Unit | | + +If a keyboard buffer is in use on the Video Unit (C) specified, it +should be purged and all contents discarded. The Status (A) is a +standard HBIOS result code. + +### Function 0x4E -- Video Keyboard Read (VDAKRD) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x4E | A: Status | +| C: Video Unit | C: Scancode | +| | D: Keystate | +| | E: Keycode | + +Read the next key data from keyboard of the specified Video Unit (C). If + a keyboard buffer is used, return the next key code in the buffer. If +no key data is available, this function will wait indefinitely for a +keypress. The Status (A) is a standard HBIOS result code. + +The Scancode (C) value is the raw scancode from the keyboard for the +keypress. Scancodes are from the PS/2 scancode set 2 standard. + +The Keystate (D) is a bitmap representing the value of all modifier keys + and shift states as they existed at the time of the keystroke. The +bitmap is defined as: + +| **Bit** | **Keystate Indication** | +|---------|----------------------------------| +| 7 | Key pressed was from the num pad | +| 6 | Caps Lock was active | +| 5 | Num Lock was active | +| 4 | Scroll Lock was active | +| 3 | Windows key was held down | +| 2 | Alt key was held down | +| 1 | Control key was held down | +| 0 | Shift key was held down | + +The Keycode (E) is generally returned as appropriate ASCII values, if +possible. Special keys, like function keys and arrows, are returned as +reserved codes as described at the start of this section. + +`\clearpage`{=latex} + +### Function 0x4F -- Read a character at current video position (VDARDC) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x4F | A: Status | +| C: Video Unit | E: Character | +| | B: Color | +| | E: Attribute | + +This function will return the character data from the current cursor +position of the display of the specified Video Unit (C). The data +returned includes the Character (E) value, the Color (B), and the +Attribute (E) corresponding to the current cursor position. If the +display does not support colors or attributes then this function will +return color white on black with no attributes. The ability to perform +this function may not be available for all video devices. The Status (A) +is a standard HBIOS result code. + +`\clearpage`{=latex} + +## Sound (SND) + +Sound functions require that a Sound Unit number be specified in +register C. This is the logical device unit number assigned during the +boot process that identifies all sound devices uniquely. + +All sound units are assigned a Device Type ID which indicates +the specific hardware device driver that handles the unit. The table +below enumerates these values. + +| **Device Type** | **ID** | **Description** | **Driver** | +|-----------------|-------:|----------------------------------------------|-------------| +| SNDDEV_SN76489 | $00 | SN76489 Programmable Sound Generator | sn76489.asm | +| SNDDEV_AY38910 | $10 | AY-3-8910/YM2149 Programmable Sound Generator| ay38910.asm | +| SNDDEV_BITMODE | $20 | Bit-bang Speaker | spk.asm | +| SNDDEV_YM2612 | $30 | YM2612 Programmable Sound Generator | ym2612.asm | + +The Sound functions defer the actual programming of the sound chip +until the SNDPLAY function is called. You will call the volume +and period/note functions to preset the desired sound output, then +call SNDPLAY when you want the sound to change. + +The Sound functions do not manage the duration of the sound +played. A sound will play +indefinitely -- the caller must implement an appropriate timing +mechanism to manage the playing of a series of sounds. + +``` +HBIOS B=51 C=00 L=80 ; Set volume to half level +HBIOS B=53 C=00 HL=152 ; Select Middle C (C4) +HBIOS B=54 C=00 D=01 ; Play note on Channel 1 +``` + +### Function 0x50 -- Sound Reset (SNDRESET) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x50 | A: Status | +| C: Sound Unit | | + +Reset the sound chip of specified Sound Unit (C). Turn off all sounds +and set volume on all channels to silence. The returned Status (A) is a +standard HBIOS result code. + +### Function 0x51 -- Sound Volume (SNDVOL) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x51 | A: Status | +| C: Sound Unit | | +| L: Volume | | + +This function sets the sound chip Volume (L) for the specified Sound +Unit (C). Volume (L) is a binary value ranging from 0 (silence) to 255 +(maximum). The volume will be applied when the next SNDPLAY function is +invoked. The returned Status (A) is a standard HBIOS result code. + +Note that not all sounds chips implement 256 volume levels. The +driver will scale the volume to the closest possible level the +chip provides. + +### Function 0x52 -- Sound Period (SNDPRD) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x52 | A: Status | +| C: Sound Unit | | +| HL: Period | | + +This function sets the sound chip Period (HL) for the specified Sound +Unit (C). The period will be applied when the next SNDPLAY function is +invoked. The returned Status (A) is a standard HBIOS result code. + +The Period (HL) value is **not** a standardized value. The value is +programmed directly into the period or frequency register of the sound +chip. It is therefore a hardware dependent value. To play standardized +notes, use the SNDNOTE function. + +### Function 0x53 -- Sound Note (SNDNOTE) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x53 | A: Status | +| C: Sound Unit | | +| HL: Note | | + +This function sets the frequency generated by the sound of the specified +Sound Unit (C). The frequency is standardized and is specified by +using values that correspond to musical notes. The frequency will be +applied when the next SNDPLAY function is invoked. The returned Status +(A) is a standard HBIOS result code. + +The Note (HL) values correspond to quarter notes. Increasing/decreasing +the value by 4 results in a full note increment/decrement. +Increasing/decreasing the value by 48 results in a full octave +increment/decrement. The value 0 corresponds to Bb/A# in octave 0. + +The sound chip resolution and its oscillator limit the range and +accuracy of the notes played. The typical range of the AY-3-8910 is six +octaves: Bb2/A#2 to A7, where each value is a unique tone. Values above +and below can still be played but each quarter tone step may not result +in a note change. + +The following table shows the mapping of the Note (HL) value to the +corresponding octave and note. + ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| | **Octave** | +| +-------+-------+-------+-------+-------+-------+-------+-------+ +| **Note** | **0** | **1** | **2** | **3** | **4** | **5** | **6** | **7** | ++============+=======+=======+=======+=======+=======+=======+=======+=======+ +| **C** | \- | 8 | 56 | 104 | 152 | 200 | 248 | 296 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| **C#/Db** | \- | 12 | 60 | 108 | 156 | 204 | 252 | 300 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| **D** | \- | 16 | 64 | 112 | 160 | 208 | 256 | 304 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| **D#/Eb** | \- | 20 | 68 | 116 | 164 | 212 | 260 | 308 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| **E** | \- | 24 | 72 | 120 | 168 | 216 | 264 | 312 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| **F** | \- | 28 | 76 | 124 | 172 | 220 | 268 | 316 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| **F#/Gb** | \- | 32 | 80 | 128 | 176 | 224 | 272 | 320 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| **G** | \- | 36 | 84 | 132 | 180 | 228 | 276 | 324 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| **G#/Ab** | \- | 40 | 88 | 136 | 184 | 232 | 280 | 328 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| **A** | \- | 44 | 92 | 140 | 188 | 236 | 284 | 332 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| **A#/Bb** | 0 | 48 | 96 | 144 | 192 | 240 | 288 | 336 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ +| **B** | 4 | 52 | 100 | 148 | 196 | 244 | 292 | 340 | ++------------+-------+-------+-------+-------+-------+-------+-------+-------+ + +### Function 0x54 -- Sound Play (SNDPLAY) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x54 | A: Status | +| C: Sound Unit | | +| D: Channel | | + +This function applies the previously specified volume and frequency of +the specified Sound Unit (C) by programming the sound chip with the +appropriate values. The values are applied to the specified Channel (D) +of the chip. The returned Status (A) is a standard HBIOS result code. + +Note that there is no duration for the sound output -- the programmed +sound will be played indefinitely. It is up to the user to wait the +desired amount of time, then change or silence the sound output as +desired. + +The number of channels available on a sound chip varies. It is up to +the caller to ensure that the appropriate number of channels are being +programmed. + +### Function 0x55 -- Sound Query (SNDQUERY) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x55 | A: Status | +| C: Sound Unit | | +| E: Subfunction | | + +This function will return a variety of information for a specified Sound +Unit (C) according to the Subfunction (E) specified. The returned +Status (A) is a standard HBIOS result code. + +#### SNDQUERY Subfunction 0x01 -- Get count of audio channels supported (SNDQ_CHCNT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x55 | A: Status | +| C: Sound Unit | B: Tone Channels | +| E: 0x01 | C: Noise Channels | + +#### SNDQUERY Subfunction 0x02 -- Get current volume setting (SNDQ_VOL) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x55 | A: Status | +| C: Sound Unit | L: Volume | +| E: 0x02 | | + +#### SNDQdERY Subfunction 0x03 -- Get current period setting (SNDQ_PERIOD) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x55 | A: Status | +| C: Sound Unit | HL: Period | +| E: 0x03 | | + +#### SNDQUERY Subfunction 0x04 -- Get device details (SNDQ_DEV) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x55 | A: Status | +| C: Sound Unit | B: Driver Identity | +| E: 0x04 | HL: Ports | +| | DE: Ports | + +This subfunction reports detailed device information for the specified +Sound Unit (C). + +Driver Identity (B) reports the audio device type. Ports (HL & DE) +return relevant port addresses for the hardware specific to each device +type. + +The following table defines the specific port information per device +type: + +| *Audio ID* | *Value* | *Device* | *Returned Registers* | +|----------------| -------:|------------|---------------------------------------------| +| SND_SN76489 | 0x01 | SN76489 | E=Left channel port, L=Right channel port | +| SND_AY38910 | 0x02 | AY-3-8910 | D=Address port, E=Data port | +| SND_BITMODE | 0x03 | I/O PORT | D=Address port, E=Bit mask | +| SND_YM2612 | 0x04 | YM2612 | Part 0: D=Address port, E=Data port | +| | | | Part 1: D=Address port, L=Part 1 Data port | + +### Function 0x56 -- Sound Duration (SNDDUR) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x56 | A: Status | +| C: Sound Unit | | +| HL: Duration | | + +This function sets the Duration (HL) of the note to be played in +milliseconds for the specified Sound Unit (C). This function just sets +the duration, the actual duration is applied in the SNDPLAY function. + +If the Duration (HL) is set to zero, then the SNDPLAY function will +operate in a non-blocking mode. i.e. a tone will start playing and the +play function will return. The tone will continue to play until the next + tone is played. If the Duration (HL) is greater than zero, the +sound will play for the duration defined in HL and then return. + +**\*\*\* Function Not Implemented \*\*\** + +### Function 0x57 -- Sound Device (SNDDEVICE) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0x57 | A: Status | +| C: Disk Unit | C: Device Attributes | +| | D: Device Type | +| | E: Device Number | +| | H: Device Unit Mode | +| | L: Device I/O Base Address | + +Reports device information about the specified Sound Unit (C). The +Status (A) is a standard HBIOS result code. + +The Device Attributes (C) value is not yet defined. + +Device Type (D) indicates the specific hardware driver that handles the +specified Sound Unit (C). Values are listed at the start of this +section. Device Number (E) indicates the physical device number assigned +per driver. + +Device Mode (H) is used to indicate the variant of the chip or circuit +that is used by the specified unit. The Device I/O Base Address +(L) indicates the starting port address of the hardware interface that +is servicing the specified unit. Both of these values are considered +driver specific. Refer to the associated hardware driver for the values +used. + +`\clearpage`{=latex} + +## System (SYS) + +### Function 0xF0 -- System Reset (SYSRESET) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF0 | A: Status | +| C: Subfunction | | + +This function performs various forms of a system reset depending on +the value of Subfunction (C): + +Soft Reset (0x00): + + : Perform a soft reset of HBIOS. Releases all HBIOS memory allocated + by current OS. Does not reinitialize physical devices. + +Warm Start (0x01): + + : Warm start the system returning to the boot loader prompt. Does not + reinitialize physical devices. + +Cold Start (0x02): + + : Perform a system cold start (like a power on). All devices are + reinitialized. + +The Status (A) is a standard HBIOS result code. + +### Function 0xF1 -- System Version (SYSVER) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF1 | A: Status | +| C: Reserved | DE: Version | +| | L: Platform | + +This function will return the HBIOS Version (DE) number and Platform (L) +identifier. The Status (A) is a standard HBIOS result code. + +The Version (DE)number is encoded as BCD where the 4 digits are: + + [Major Version][Minor Version][Patch Level][Build Number] + +So, for example, a Version (L) number of 0x3102 would indicate +version 3.1.0, build 2. + +The hardware Platform (L) is identified as follows: + +| **Name** | **Id** | **Platform ** | +|---------------|-------:|-----------------------------------------| +| PLT_SBC |1 | ECB Z80 SBC | +| PLT_ZETA |2 | ZETA Z80 SBC | +| PLT_ZETA2 |3 | ZETA Z80 V2 SBC | +| PLT_N8 |4 | N8 (HOME COMPUTER) Z180 SBC | +| PLT_MK4 |5 | MARK IV | +| PLT_UNA |6 | UNA BIOS | +| PLT_RCZ80 |7 | RCBUS W/ Z80 | +| PLT_RCZ180 |8 | RCBUS W/ Z180 | +| PLT_EZZ80 |9 | EASY/TINY Z80 | +| PLT_SCZ180 |10 | RCBUS SC126, SC130, SC131, SC140 | +| PLT_DYNO |11 | DYNO MICRO-ATX MOTHERBOARD | +| PLT_RCZ280 |12 | RCBUS W/ Z280 | +| PLT_MBC |13 | NHYODYNE MULTI-BOARD COMPUTER | +| PLT_RPH |14 | RHYOPHYRE GRAPHICS SBC | + +### Function 0xF2 -- System Set Bank (SYSSETBNK) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF2 | A: Status | +| C: Bank ID | C: Prior Bank ID | + +Activates the specified memory Bank ID (C) and returns the Prior Bank ID + (C). The function **must** be invoked from code located in the upper +32K and the stack **must** be in the upper 32K. The Status (A) is a +standard HBIOS result code. + +### Function 0xF3 -- System Get Bank (SYSGETBNK) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF3 | A: Status | +| | C: Bank ID | + +Returns the currently active Bank ID (C). The Status (A) is a standard +HBIOS result code. + +### Function 0xF4 -- System Set Copy (SYSSETCPY) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF4 | A: Status | +| D: Destination Bank ID | | +| E: Source Bank ID | | +| HL: Byte Count | | + +Prepare for a subsequent interbank memory copy (SYSBNKCPY) function call +by setting the Source Bank ID (E), Destination Bank ID (D), and Byte Count +(HL) to be copied. The bank ID's are not range checked and must +be valid for the system in use. The Status (A) is a standard +HBIOS result code. + +No bytes are copied by this function. The SYSBNKCPY function must be +called to actually perform the copy. The values setup by this function +will remain unchanged until another call is make to this function. So, +after calling SYSSETCPY, you may make multiple calls to SYSBNKCPY as +long as you want to continue to copy between the already established +Source/Destination Banks and the same size copy is being performed. + +### Function 0xF5 -- System Bank Copy (SYSBNKCPY) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF5 | A: Status | +| DE: Destination Address | DE: New Destination Address | +| HL: Source Address | HL: New Source Address | + +Copy a block of memory between banks. The Source Bank, Destination Bank, and Byte +Count to copy **must** be established with a prior call to SYSSETCPY. +However, it is not necessary to call SYSSETCPY prior to subsequent calls +to SYSBNKCPY if the source/destination banks and copy length do not +change. + +On return, the New Destination Address (DE) will be value of the +original Destination Address (DE) incremented by the count of bytes +copied. Likewise for the New Source Address (HL). This allows +iterative invocations of this function to continue copying where the +prior invocation left off. + +The Status (A) is a standard HBIOS result code. + +WARNINGS: + +* This function is inherently dangerous and does not prevent you from + corrupting critical areas of memory. Use with **extreme** caution. + +* Overlapping source and destination memory ranges are not supported and + will result in undetermined behavior. + +* Copying of byte ranges that cross bank boundaries is undefined. + +### Function 0xF6 -- System Alloc (SYSALLOC) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF6 | A: Status | +| HL: Block Size | HL: Block Address | + +This function will attempt to allocate a Block Size (HL) bytes block of +memory from the internal HBIOS heap. The HBIOS heap resides in the HBIOS +bank in the area of memory left unused by HBIOS. If the allocation is +successful, the Block Address (HL) of the allocated memory block is +returned in HL. You will typically need to use the SYSBNKCPY function to +read/write the allocated memory. The Status (A) is a standard HBIOS +result code. + +### Function 0xF7 -- System Free (SYSFREE) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF7 | A: Status | +| HL: Block Address | | + +**\*\*\* Function Not Implemented \*\*\*** + +Note that all allocated memory can be freed by calling the SYSRESET +function with a subfunction code of 0x00 (Soft Reset). + +### Function 0xF8 -- System Get (SYSGET) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: Subfunction | | + +This function will report various system information based on the +sub-function value. The following lists the subfunctions available along +with the registers/information utilized. The Status (A) is a standard +HBIOS result code. + +#### SYSGET Subfunction 0x00 -- Get Character Device Unit Count (CIOCNT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0x00 | E: Count | + +Return the Count (E) of character device units. The Status (A) is a +standard HBIOS result code. + +#### SYSGET Subfunction 0x01 -- Get Serial Unit Function (CIOFN) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0x01 | HL: Function Address | +| D: Function | DE: Unit Data Address | +| E: Unit | | + +This function will lookup the actual driver function address and +unit data address inside the HBIOS driver. On entry, place the +CIO function number to lookup in D and the CIO unit number in E. +On return, HL will contain the address of the requested function +in the HBIOS driver (in the HBIOS bank). DE will contain the +associated unit data address (also in the HBIOS bank). See +Appendix A for details. The returned Status (A) is a standard HBIOS +result code. + +This function can be used to speed up HBIOS calls by looking up the +function and data address for a specific driver function. After this, +the caller can use interbank calls directly to the function in the +driver which bypasses the overhead of the normal function invocation +lookup. + +#### SYSGET Subfunction 0x10 -- Get Disk Device Unit Count (DIOCNT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0x10 | E: Count | + +Return the Count (E) of disk device units. The Status (A) is a +standard HBIOS result code. + +#### SYSGET Subfunction 0x11 -- Get Disk Unit Function (DIOFN) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0x11 | HL: Function Address | +| D: Function | DE: Unit Data Address | +| E: Unit | | + +This function will lookup the actual driver function address and +unit data address inside the HBIOS driver. On entry, place the +DIO function number to lookup in D and the DIO unit number in E. +On return, HL will contain the address of the requested function +in the HBIOS driver (in the HBIOS bank). DE will contain the +associated unit data address (also in the HBIOS bank). See +Appendix A for details. The returned Status (A) is a standard HBIOS +result code. + +This function can be used to speed up HBIOS calls by looking up the +function and data address for a specific driver function. After this, +the caller can use interbank calls directly to the function in the +driver which bypasses the overhead of the normal function invocation +lookup. + +#### SYSGET Subfunction 0x20 -- Get RTC Device Unit Count (RTCCNT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0x20 | E: Count | + +Return the Count (E) of RTC device units. The Status (A) is a +standard HBIOS result code. + +#### SYSGET Subfunction 0x40 -- Get Video Device Unit Count (VDACNT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0x40 | E: Count | + +Return the Count (E) of video device units. The Status (A) is a +standard HBIOS result code. + +#### SYSGET Subfunction 0x41 -- Get Video Unit Function (VDAFN) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0x41 | HL: Function Address | +| D: Function | DE: Unit Data Address | +| E: Unit | | + +This function will lookup the actual driver function address and +unit data address inside the HBIOS driver. On entry, place the +VDA function number to lookup in D and the VDA unit number in E. +On return, HL will contain the address of the requested function +in the HBIOS driver (in the HBIOS bank). DE will contain the +associated unit data address (also in the HBIOS bank). See +Appendix A for details. The returned Status (A) is a standard HBIOS +result code. + +This function can be used to speed up HBIOS calls by looking up the +function and data address for a specific driver function. After this, +the caller can use interbank calls directly to the function in the +driver which bypasses the overhead of the normal function invocation +lookup. + +#### SYSGET Subfunction 0x50 -- Get Sound Device Unit Count (SNDCNT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0x50 | E: Count | + +Return the Count (E) of sound device units. The Status (A) is a +standard HBIOS result code. + +#### SYSGET Subfunction 0x51 -- Get Sound Unit Function (SNDFN) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0x51 | HL: Function Address | +| D: Function | DE: Unit Data Address | +| E: Unit | | + +This function will lookup the actual driver function address and +unit data address inside the HBIOS driver. On entry, place the +SND function number to lookup in D and the SND unit number in E. +On return, HL will contain the address of the requested function +in the HBIOS driver (in the HBIOS bank). DE will contain the +associated unit data address (also in the HBIOS bank). See +Appendix A for details. The returned Status (A) is a standard HBIOS +result code. + +This function can be used to speed up HBIOS calls by looking up the +function and data address for a specific driver function. After this, +the caller can use interbank calls directly to the function in the +driver which bypasses the overhead of the normal function invocation +lookup. + +#### SYSGET Subfunction 0xD0 -- Get Timer Tick Count (TIMER) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0xD0 | DEHL: Tick Count | +| | C: Frequency | + +Return the value of the global system timer Tick Count (DEHL). This is +a double-word binary value. The frequency of the system timer in Hertz +is returned in Frequency (C). The returned Status (A) is a standard HBIOS +result code. + +Note that not all hardware configuration have a system timer. You +can determine if a timer exists by calling this function repeatedly +to see if it is incrementing. + +#### SYSGET Subfunction 0xD1 -- Get Seconds Count (SECONDS) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0xD1 | DEHL: Seconds Count | +| | C: Ticks per Second | + +Return the a Seconds Count (DEHL) with the number of seconds that have +elapsed since the system was started. This is a double-word binary +value. Additionally, the number of Ticks per Second (C) is returned. +The returned Status (A) is a standard HBIOS result code. + +This availability of the Seconds Count (DEHL) is dependent on having a +system timer active. If the hardware configuration has no system timer, +then Seconds Count (DEHL) will not increment. + +#### SYSGET Subfunction 0xE0 -- Get Boot Information (BOOTINFO) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0xE0 | L: Boot Bank ID | +| | D: Boot Disk Unit | +| | E: Boot Disk Slice | + +This function returns information about the most recent boot operation +performed. It includes the Boot Bank ID (L), the Boot Disk Unit (D), +and the Boot Disk Slice (E). The returned Status (A) is a standard +HBIOS result code. + +#### SYSGET Subfunction 0xF0 -- Get CPU Information (CPUINFO) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0xF0 | H: Z80 CPU Variant | +| | L: CPU Speed MHz | +| | DE: CPU Speed KHz | +| | BC: Oscillator Speed KHz | + +This function returns information about the active CPU environment. The +Z80 CPU Variant (H) will be one of: 0=Z80, 1=Z180, 2=Z180-K, 3=Z180-N, +4=Z280. The current CPU speed is provided as both CPU Speed MHz (L) and +CPU Speed KHz (DE). The raw oscillator speed is provided as Oscillator +Speed KHz (BC). The returned Status (A) is a standard HBIOS result +code. + +#### SYSGET Subfunction 0xF1 -- Get Memory Information (MEMINFO) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0xF1 | D: ROM Bank Count | +| | E: RAM Bank Count | + +This function returns the systems ROM Bank Count (D) and RAM Bank Count +(E). Each bank is 32KB by definition. The returned Status (A) is a +standard HBIOS result code. + +#### SYSGET Subfunction 0xF2 -- Get Bank Information (BNKINFO) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0xF2 | D: BIOS Bank ID | +| | E: User Bank ID | + +Certain memory banks within a RomWBW system are special. The exact bank +id for each of these varies depending on the configuration of the +system. This function can be used to determine the BIOS Bank ID (D) and +the User Bank ID (E). The returned Status (A) is a standard HBIOS +result code. + +#### SYSGET Subfunction 0xF3 -- Get CPU Speed (CPUSPD) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF8 | A: Status | +| C: 0xF3 | L: Clock Mult | +| | D: Memory Wait States | +| | E: I/O Wait States | + +This function will return the running CPU speed attributes of a system. +The Clock Mult (L) returned indicates the frequency multiple being +applied to the raw oscillator clock. If is defined as: 0=Half, 1=Full, +and 2=Double. The wait states for the system are also provided as +Memory Wait States (D) and I/O Wait States (E). The value of Memory +Wait States (D) is the actual number of wait states, not the number +of wait states added. The returned Status (A) is a standard HBIOS +result code. + +### Function 0xF9 -- System Set (SYSSET) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF9 | A: Status | +| C: Subfunction | | + +This function will set various system parameters based on the +sub-function value. The following lists the subfunctions available along +with the registers/information utilized. The Status (A) is a standard +HBIOS result code. + +#### SYSSET Subfunction 0xD0 -- Set Timer Tick Count (TIMER) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF9 | A: Status | +| C: 0xD0 | DEHL: Timer Tick Count | + +This function will explicitly set the system Timer Tick Count (DEHL) +value. DEHL is a double-word binary value. The Status (A) is a +standard HBIOS result code. + +#### SYSSET Subfunction 0xD1 -- Set Seconds Count (SECONDS) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF9 | A: Status | +| C: 0xD1 | | +| DEHL: Seconds Count | | + +This function will explicitly set the system Seconds Count (DEHL) value. +DEHL is a double-word binary value. The Status (A) is a standard +HBIOS result code. + +#### SYSSET Subfunction 0xE0 -- Set Boot Information (BOOTINFO) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF9 | A: Status | +| C: 0xE0 | | +| L: Boot Bank ID | | +| D: Boot Disk Unit | | +| E: Boot Disk Slice | | + +This function sets information about the most recent boot operation +performed. It includes the Boot Bank ID (L), the Boot Disk Unit (D), +and the Boot Disk Slice (E). The returned Status (A) is a standard +HBIOS result code. + +#### SYSSET Subfunction 0xF3 -- Set CPU Speed (CPUSPD) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xF9 | A: Status | +| C: 0xF3 | | +| L: Clock Mult | | +| D: Memory Wait States | | +| E: I/O Wait States | | + +This function will modify the running CPU speed attributes of a system. +Note that it is frequently impossible to tell if a system is capable +of dynamic speed changes. This function makes the changes blindly. +You can specify 0xFF for either of the wait state settings to have them +left alone. If an attempt is made to change the speed of a system +that is definitely incapable of doing so, then an error result is +returned. The returned Status (A) is a standard HBIOS result code. + +The function will attempt to set the CPU speed based on the Clock Mult +(L) value: 0=Half, 1=Full, 2=Double. Memory Wait States (D) and I/O +Wait States (E) will be set if possible. The value of Memory Wait +States (D) is the actual number of wait states, not the number of wait +states added. + +Some peripherals are dependent on the CPU speed. For example, the Z180 +ASCI baud rate and system timer are derived from the CPU speed. The +Set CPU Speed function will attempt to adjust these peripherals for +correct operation after modifying the CPU speed. However, in some +cases this may not be possible. The baud rate of ASCI ports have a +limited set of divisors. If there is no satisfactory divisor to +retain the existing baud rate under the new CPU speed, then the baud +rate of the ASCI port(s) will be affected. + +### Function 0xFA -- System Peek (SYSPEEK) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xFA | A: Status | +| D: Bank ID | E: Byte Value | +| HL: Memory Address | | + +This function retrieves and returns the Byte Value from the specified +Bank ID (D) and Memory Address (HL). The bank specified is not range +checked. The Status (A) is a standard HBIOS result code. + +### Function 0xFB -- System Poke (SYSPOKE) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xFB | A: Status | +| D: Bank ID | | +| HL: Memory Address | | +| E: Byte Value | | + +This function sets the Byte Value (E) in the specified Bank ID (D) and +Memory Address (HL). The bank specified is not range checked. The +Status (A) is a standard HBIOS result code. + +### Function 0xFC -- System Interrupt Management (SYSINT) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xFC | A: Status | +| C: Subfunction | | + +This function allows the caller to query information about the interrupt + configuration of the running system and allows adding or hooking +interrupt handlers dynamically. Register C is used to specify a +subfunction. Additional input and output registers may be used as +defined by the sub-function. The Status (A) is a standard +HBIOS result code. + +Note that during interrupt processing, the lower 32K of CPU address +space will contain the RomWBW HBIOS code bank, not the lower 32K of +application TPA. As such, a dynamically installed interrupt handler does +not have access to the lower 32K of TPA and must be careful to avoid +modifying the contents of the lower 32K of memory. Invoking RomWBW HBIOS +functions within an interrupt handler is not supported. + +Interrupt handlers are different under IM1 and IM2. + +Interrupt Mode 1: + +: The new interrupt handler is responsible for chaining (JP) to the +previous vector if the interrupt is not handled. If the interrupt is +handled, the new handler may simply return (RET). When chaining to the +previous interrupt handler, ZF must be set if interrupt is handled and +ZF cleared if not handled. The interrupt management framework takes care +of saving and restoring AF, BC, DE, HL, and IY. Any other registers +modified must be saved and restored by the interrupt handler. + +Interrupt Mode 2: + +: The new interrupt handler may either replace or hook the previous +interrupt handler. To replace the previous interrupt handler, the new +handler just returns (RET) when done. To hook the previous handler, the +new handler can chain (JP) to the previous vector. Note that initially +all IM2 interrupt vectors are set to be handled as “BAD†meaning that the +interrupt is unexpected. In most cases, you do not want to chain to the +previous vector because it will cause the interrupt to display a "BAD +INT" system panic message. + +The interrupt framework will take care of issuing an EI and RETI +instruction. Do not put these instructions in your new handler. +Additionally, interrupt management framework takes care of saving and +restoring AF, BC, DE, HL, and IY. Any other registers modified must be +saved and restored by the interrupt handler. + +If the caller is transient, then the caller must remove the new interrupt +handler and restore the original one prior to termination. This is +accomplished by calling this function with the Interrupt Vector set to the +Previous Vector returned in the original call. + +The caller is responsible for disabling interrupts prior to making an +INTSET call and enabling them afterwards. The caller is responsible for +ensuring that a valid interrupt handler is installed prior to enabling any +hardware interrupts associated with the handler. Also, if the handler is +transient, the caller must disable the hardware interrupt(s) associated +with the handler prior to uninstalling it. + +#### SYSINT Subfunction 0x00 -- Interrupt Info (INTINF) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xFC | A: Status | +| C: 0x00 | D: Interrupt Mode | +| | E: IVT Size | + +Return current Interrupt Mode (D) of the system. Also return the +number of Interrupt Vector Table (IVT) entries in IVT Size (E). +interrupt mode in D and size of interrupt vector table in E. For +IM1, the size of the table is the number of vectors chained together. +For IM2, the size of the table is the number of slots in the vector +table. The Status (A) is a standard +HBIOS result code. + +#### SYSINT Subfunction 0x10 -- Get Interrupt (INTGET) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xFC | A: Status | +| C: 0x10 | HL: IVT Address | +| E: IVT Index | | + +This function will return the IVT Address (HL) of the current interrupt +vector for the specified IVT Index (C). The Status (A) is a standard +HBIOS result code. + +#### SYSINT Subfunction 0x20 -- Set Interrupt (INTSET) + +| **Entry Parameters** | **Returned Values** | +|----------------------------------------|----------------------------------------| +| B: 0xFC | A: Status | +| C: 0x20 | HL: Previous Interrupt Address | +| E: IVT Index | | +| HL: Interrupt Address | | + +This function will set a new Interrupt Address (HL) at the IVT Index (E) +specified. On return, the Previous Interrupt Address (HL) will be +provided. + +`\clearpage`{=latex} + + +# Errors and diagnostics + +ROMWBW tries to provide useful information when a run time or build time +error occurs. Many sections of the code also have code blocks that can be +enable to aid in debugging and in some cases the level of reporting detail +can be customized. + +## Run Time Errors + +### PANIC + +A panic error indicates a non-recoverable error. The processor status is displayed on the console +and interrupts are disabled and execution is halted. A cold boot or reset is required to restart. + +Example error message: + +``` +>>> PANIC: @06C4[DFA3:DFC3:0100:F103:04FC:0000:2B5E] + +*** System Halted *** +``` + +The format of the information provided is + +`@XXXX [-AF-:-BC-:-DE-:-HL-:-SP-:-IX-:-IY-]` + +Where `@XXXX` is the address the panic was called from. The other information +is the CPU register contents. + +Possible reasons a PANIC may occur are: + +- RAM Bank range error when attempting a read or write to a RAM disk. +- Sector read function has not been setup but a read was attempted. +- An interrupt vector has not been set up when an interrupt was received. +- There was an attempt to add more devices than the device table had room for. +- An illegal SD card command was encountered. + +The `@XXXX` memory address can be cross referenced with the build source code to identify +which section of the software or hardware caused the fault. + +### SYSCHK + +A syschk error is identified when an internal error is detected. When this +occurs an error code is returned to the calling program in the A register. +A non-zero result indicates an error. + +Syschk errors may be reported to the console. Whether this occurs depends on +the value of the diagnosis level equate DIAGLVL. By default syschk errors +are not reported to the console. + +If the diagnosis level is set to display the diagnosis information, then +memory address, register dump and error code is displayed. +A key difference with the PANIC error is that execution may be continued. + +Example error message: + +\>>> SYSCHK: @06C4[DFA3:DFC3:0100:F103:04FC:0000:2B5E] FD +Continue (Y/N) + +The format of the information provided is similar the PANIC report. + +@XXXX [-AF-:-BC-:-DE-:-HL-:-SP-:-IX-:-IY-] YY + +The syschk error codes YY is returned in the A register. + +| Error | Code YY | +| ----------------------------------- | -------- | +| Success | 0x00 | +| Undefined Error | 0xFF | +| Function Not Implemented | 0xFE | +| Invalid Function | 0xFD | +| Invalid Unit Number | 0xFC | +| Out Of Memory | 0xFB | +| Parameter Out Of Range | 0xFA | +| Media Not Present | 0xF9 | +| Hardware Not Present | 0xF8 | +| I/O Error | 0xF7 | +| Write Request To Read-Only Media | 0xF6 | +| Device Timeout | 0xF5 | +| Invalid Configuration | 0xF4 | +| Internal Error | 0xF3 | + +### Error Level reporting + +placeholder + +## Build time errors + +### Build chain tool errors + +place holder + +### Assembly time check errors + +placeholder + +## Diagnostics + +### Diagnostic LEDs + +Progress through the boot and initialization process can be difficult to monitor +due to the lack of console or video output. Access to these output devices does +not become available until late the in the boot process. If these output devices +are also involved with the issue trying to be resolved then trouble shooting is +even more difficult. + +ROMWBW can be configured to display boot progress with the assistance of additional +hardware. This take the form of an LED breakout debugging board connected to an +8-bit output port. As the boot code executes, the LED output display is updated. + +To use a LED breakout board, it must be connected the computers data, reset and port +select lines. + +To enable the DIAG option the following settings must be made in the systems .ini +configuration file, where 0xnn is the port address. + +DIAGENABLE .SET TRUE +DIAGPORT .SET 0xnn + +The following table shows the ROMWBW process steps in relation to the LED display. + +| **LED** | **RomWBW Processes** | +|------------|------------------------------------------------| +| `........` | Initial boot | +| | Jump to start address | +| | Disable interrupts | +| | Set interrupt mode | +| | Initialize critical ports and baud rate | +| `.......O` | Setup initial stack | +| | Memory manager and CPU configuration | +| | Set top bank to be RAM | +| `......OO` | Get and save battery condition | +| | Install HBIOS proxy in upper memory | +| | If platform is MBC reconfigure memory manager | +| | Setup "ROMLESS" HBIOS image or ... | +| | Copy HBIOS from ROM to RAM if RAM flag not set | +| | Jump to HBIOS in RAM | +| | Set running in RAM flag | +| `.....OOO` | Finalize configuration for running in RAM | +| | Check battery condition | +| | Check for recovery mode boot | +| `....OOOO` | Identify CPU type | +| `...OOOOO` | Set cpu oscillator speed | +| | Setup counter-timers | +| | Setup heap | +| `..OOOOOO` | Preconsole initialization | +| `.OOOOOOO` | Boot delay | +| | Set boot console device | +| | Bios announcement | +| `OOOOOOOO` | Display platform information | +| | Display memory configuration | +| | Display CPU family | +| | Verify ROM checksum | +| | Report battery condition | +| | Perform device driver initialization | +| | Report watchdog status | +| | Mark HBIOS heap so it is preserved | +| | Switch from boot console to CRT if active | +| | Display device summary | +| | Execute boot loader | + +`\clearpage`{=latex} + +### Appendix A Driver Instance Data fields + +**This section is a work in progress...** + +The following section outlines the read only data referenced by the +`SYSGET`, subfunctions `xxxFN` for specific drivers. + + +#### TMS9918 Driver: + +| **Name** | **Offset** | **Bytes** | **Description** | +|--------|----|----|-----------------------| +| PPIA | 0 | 1 | PPI PORT A | +| PPIB | 1 | 1 | PPI PORT B | +| PPIC | 2 | 1 | PPI PORT C | +| PPIX | 3 | 1 | PPI CONTROL PORT | +| DATREG | 4 | 1 | IO PORT ADDRESS FOR MODE 0 | +| CMDREG | 5 | 1 | IO PORT ADDRESS FOR MODE 1 | +| | | | _Below are the register mirror values_ | +| | | | _that HBIOS used for initialisation_ | +| REG. 0 | 6 | 1 | $00 - NO EXTERNAL VID +| REG. 1 | 7 | 1 | $50 or $70 - SET MODE 1 and interrupt if enabled | +| REG. 2 | 8 | 1 | $00 - PATTERN NAME TABLE := 0 | +| REG. 3 | 9 | 1 | $00 - NO COLOR TABLE | +| REG. 4 | 10 | 1 | $01 - SET PATTERN GENERATOR TABLE TO $800 | +| REG. 5 | 11 | 1 | $00 - SPRITE ATTRIBUTE IRRELEVANT | +| REG. 6 | 12 | 1 | $00 - NO SPRITE GENERATOR TABLE | +| REG. 7 | 13 | 1 | $F0 - WHITE ON BLACK | +| DCNTL* | 14 | 1 | Z180 DMA/WAIT CONTROL | + +* ONLY PRESENT FOR Z180 BUILDS + + diff --git a/Source/Doc/UART Baud Rate Options.xlsx b/Source/Doc/UART Baud Rate Options.xlsx new file mode 100644 index 00000000..0a422a9e Binary files /dev/null and b/Source/Doc/UART Baud Rate Options.xlsx differ diff --git a/Source/Doc/UserGuide.md b/Source/Doc/UserGuide.md new file mode 100644 index 00000000..d7cfd36d --- /dev/null +++ b/Source/Doc/UserGuide.md @@ -0,0 +1,3861 @@ +$define{doc_title}{User Guide}$ +$include{"Book.h"}$ + +#### Preface + +This document is a general usage guide for the RomWBW software and is +generally the best place to start with RomWBW. There are several +companion documents you should refer to as appropriate: + +* $doc_sys$ discusses much of the internal design and construction + of RomWBW. It includes a reference for the RomWBW HBIOS API + functions. + +* $doc_apps$ is a reference for the OS-hosted proprietary command + line applications that were created to enhance RomWBW. + +* $doc_romapps$ is a reference for the ROM-hosted applications provided + with RomWBW including the monitor, programming languages, etc. + +* $doc_catalog$ is a reference for the contents of the disk images + provided with RomWBW. It is somewhat out of date at this time. + +* $doc_errata$ is updated as needed to document issues or anomalies + discovered in the current software distribution. + +Since RomWBW is purely a software product for many different platforms, +the documentation does **not** cover hardware construction, +configuration, or troubleshooting -- please see your hardware provider +for this information. + +Each of the operating systems and ROM applications included with RomWBW +are sophisticated tools in their own right. It is not reasonable to +fully document their usage here. However, you will find complete manuals +in PDF format in the Doc directory of the distribution. The intention +of this document is to describe the operation of RomWBW and the ways in +which it enhances the operation of the included applications and +operating systems. + +On a personal note, I found this document very difficult to write. +Members of the retro-computing community have dramatically different +experiences, skill levels, and desires. I realize some readers will +find this document far too basic. Others will find it lacking in many +areas. I am doing my best and encourage you to provide constructive +feedback. + +# Overview + +RomWBW software provides a complete, commercial quality +implementation of CP/M (and workalike) operating systems and +applications for modern Z80/180/280 retro-computing hardware systems. +A wide variety of platforms are supported including those +produced by these developer communities: + +* [RetroBrew Computers](https://www.retrobrewcomputers.org) +* [RC2014](https://rc2014.co.uk), [RC2014-Z80](https://groups.google.com/g/rc2014-z80) +* [retro-comp](https://groups.google.com/forum/#!forum/retro-comp) +* [Small Computer Central](https://smallcomputercentral.com/) + +General features include: + +* Banked memory services for several banking designs +* Disk drivers for RAM, ROM, Floppy, IDE, CF, and SD +* Serial drivers including UART (16550-like), ASCI, ACIA, SIO +* Video drivers including TMS9918, SY6545, MOS8563, HD6445 +* Keyboard (PS/2) drivers via VT8242 or PPI interfaces +* Real time clock drivers including DS1302, BQ4845 +* OSes: CP/M 2.2, ZSDOS, CP/M 3, NZ-COM, ZPM3, QPM, p-System, and FreeRTOS +* Built-in VT-100 terminal emulation support + +RomWBW is distributed as both source code and pre-built ROM and disk +images. Some of the provided software can be launched directly from the +ROM firmware itself: + +* System Monitor +* Operating Systems (CP/M 2.2, ZSDOS) +* ROM BASIC (Nascom BASIC and Tasty BASIC) +* ROM Forth + +A dynamic disk drive letter assignment mechanism allows mapping +operating system drive letters to any available disk media. +Additionally, mass storage devices (IDE Disk, CF Card, SD Card) support +the use of multiple slices (up to 256 per device). Each slice contains +a complete CP/M filesystem and can be mapped independently to any +drive letter. This overcomes the inherent size limitations in legacy +OSes and allows up to 2GB of accessible storage on a single device. + +The pre-built ROM firmware images are generally suitable for most +users. However, it is also very easy to modify and build custom ROM +images that fully tailor the firmware to your specific preferences. +All tools required to build custom ROM firmware under Windows are +included -- no need to install assemblers, etc. The firmware can also +be built using Linux or MacOS after confirming a few standard tools +have been installed. + +Multiple disk images are provided in the distribution. Most disk +images contain a complete, bootable, ready-to-run implementation of a +specific operating system. A "combo" disk image contains multiple +slices, each with a full operating system implementation. If you use +this disk image, you can easily pick whichever operating system you +want to boot without changing media. + +By design, RomWBW isolates all of the hardware specific functions in +the ROM chip itself. The ROM provides a hardware abstraction layer +such that all of the operating systems and applications on a disk +will run on any RomWBW-based system. To put it simply, you can take +a disk (or CF/SD Card) and move it between systems transparently. + +A tool is provided that allows you to access a FAT-12/16/32 filesystem. +The FAT filesystem may be coresident on the same disk media as RomWBW +slices or on stand-alone media. This makes exchanging files with modern +OSes such as Windows, MacOS, and Linux very easy. + +# Getting Started + +## Acquiring RomWBW + +The [RomWBW Repository](https://github.com/wwarthen/RomWBW) on GitHub is +the official distribution location for all project source and +documentation. The fully-built distribution releases are available on +the [RomWBW Releases Page](https://github.com/wwarthen/RomWBW/releases) +of the repository. On this page, you will normally see a Development +Snapshot as well as recent stable releases. Unless you have a specific +reason, I suggest you stick to the most recent stable release. Expand +the "Assets" drop-down for the release you want to download, then select +the asset named RomWBW-vX.X.X-Package.zip. The Package asset includes +all pre-built ROM and Disk images as well as full source code. The other +assets contain only source code and do not have the pre-built ROM or +disk images. + +All source code and distributions are maintained on GitHub. Code +contributions are very welcome. + +#### Distribution Directory Layout + +The RomWBW distribution is a compressed zip archive file organized in +a set of directories. Each of these directories has its own +ReadMe.txt file describing the contents in detail. In summary, these +directories are: + +| **Directory** | **Description** | +|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Binary** | The final output files of the build process are placed here. Most importantly, the ROM images with the file names ending in ".rom" and disk images ending in .img. | +| **Doc** | Contains various detailed documentation, both RomWBW specifically as well as the operating systems and applications. | +| **Source** | Contains the source code files used to build the software and ROM images. | +| **Tools** | Contains the programs that are used by the build process or that may be useful in setting up your system. | + +## Installation + +In general, installation of RomWBW on your platform is very simple. You +just need to program your ROM with the correct ROM image from the RomWBW +distribution. Subsequently, you can write disk images on your disk +drives (IDE disk, CF Card, SD Card, etc.) which then provides even more +functionality. + +The pre-built ROM images will automatically detect and support typical +devices for their corresponding platform including serial ports, video +adapters, on-board disk interfaces, and PropIO/ParPortProp boards +without building a custom ROM. The distribution is a .zip archive. After +downloading it to a working directory on your modern computer +(Windows/Linux/Mac) use any zip tool to extract the contents of the +archive. + +Depending on how you got your hardware, you may have already been +provided with a pre-programmed ROM chip. If so, use that initially. +Otherwise, you will need to use a ROM programmer to initially program +your ROM chip. Please refer to the documentation that came with your ROM +programmer for more information. Once you have a running RomWBW system, +you can generally update your ROM to a newer version in-situ with the +included ROM Flashing tool (Will Sowerbutts' FLASH application) as +described in the Upgrading section of this document. + +The Binary directory of the distribution contains the pre-built ROM and +disk images. The ROM image files all end in ".rom". Based on the table +below, **carefully** pick the appropriate ROM image for your hardware. + +| **Description** | **Bus** | **ROM Image File** | **Baud Rate** | +|----------------------------------------------------------------|---------|--------------------|--------------:| +| [RetroBrew Z80 SBC]^1^ | ECB | SBC_std.rom | 38400 | +| [RetroBrew Z80 SimH]^1^ | - | SBC_simh.rom | 38400 | +| [RetroBrew N8 Z180 SBC]^1^ (date code >= 2312) | ECB | N8_std.rom | 38400 | +| [Zeta Z80 SBC]^2^, ParPortProp | - | ZETA_std.rom | 38400 | +| [Zeta V2 Z80 SBC]^2^, ParPortProp | - | ZETA2_std.rom | 38400 | +| [Mark IV Z180 SBC]^3^ | ECB | MK4_std.rom | 38400 | +| [RCBus Z80 CPU Module]^4^, 512K RAM/ROM | RCBus | RCZ80_std.rom | 115200 | +| [RCBus Z80 CPU Module]^4^, 512K RAM/ROM, KIO | RCBus | RCZ80_kio.rom | 115200 | +| [RCBus Z180 CPU Module]^4^ w/ external banking | RCBus | RCZ180_ext.rom | 115200 | +| [RCBus Z180 CPU Module]^4^ w/ native banking | RCBus | RCZ180_nat.rom | 115200 | +| [RCBus Z280 CPU Module]^4^ w/ external banking | RCBus | RCZ180_ext.rom | 115200 | +| [RCBus Z280 CPU Module]^4^ w/ native banking | RCBus | RCZ180_nat.rom | 115200 | +| [Easy Z80 SBC]^2^ | RCBus | RCZ80_easy.rom | 115200 | +| [Tiny Z80 SBC]^2^ | RCBus | RCZ80_tiny.rom | 115200 | +| [Z80-512K CPU/RAM/ROM Module]^2^ | RCBus | RCZ80_skz.rom | 115200 | +| [Small Computer SC126 Z180 SBC]^5^ | BP80 | SCZ180_sc126.rom | 115200 | +| [Small Computer SC130 Z180 SBC]^5^ | RCBus | SCZ180_sc130.rom | 115200 | +| [Small Computer SC131 Z180 Pocket Computer]^5^ | - | SCZ180_sc131.rom | 115200 | +| [Small Computer SC140 Z180 CPU Module]^5^ | Z50 | SCZ180_sc140.rom | 115200 | +| [Small Computer SC503 Z180 CPU Module]^5^ | Z50 | SCZ180_sc503.rom | 115200 | +| [Dyno Z180 SBC]^6^ | Dyno | DYNO_std.rom | 38400 | +| [Nhyodyne Z80 MBC]^1^ | MBC | MBC_std.rom | 38400 | +| [Rhyophyre Z180 SBC]^1^ | - | RPH_std.rom | 38400 | +| [Z80 ZRC CPU Module]^7^ | RCBus | RCZ80_zrc.rom | 115200 | +| [Z280 ZZRCC CPU Module]^7^ | RCBus | RCZ280_zzrc.rom | 115200 | +| [Z280 ZZ80MB SBC]^7^ | RCBus | RCZ280_zz80mb.rom | 115200 | + +| ^1^Designed by Andrew Lynch +| ^2^Designed by Sergey Kiselev +| ^3^Designed by John Coffman +| ^4^RCBus compliant (multiple products/designers) +| ^5^Designed by Stephen Cousins +| ^6^Designed by Steve Garcia +| ^7^Designed by Bill Shen + +RCBus refers to Spencer Owen's RC2014 bus specification and derivatives +including RC26, RC40, RC80, and BP80. + +Additional information for each of the system configurations supported +by the ROM images listed above is found in +[Appendix A - Pre-built ROM Images]. + +The RCBus Z180 & Z280 require a separate RAM/ROM memory module. There +are two types of these modules and you must pick the correct ROM for +your type of memory module. The first option is the same as the 512K +RAM/ROM module for RC/BP80 Bus. This is called external ("ext") because +the bank switching is performed externally from the CPU. The second +type of RAM/ROM module has no bank switching logic -- this is called +native ("nat") because the CPU itself provides the bank switching logic. +Only Z180 and Z280 CPUs have the ability to do bank switching in the +CPU, so the ext/nat selection only applies to them. Z80 CPUs have no +built-in bank switching logic, so they are always configured for +external bank switching. + +All pre-built ROM images are pure binary files (they are not "hex" +files). They are intended to be programmed starting at the very start +of the ROM chip (address 0). Most of the pre-built images are +512KB in size. If your system utilizes a larger ROM, you can just +program the image into the first 512KB of the ROM for now. + +Initially, don't worry about trying to write a disk image to any disk +(or CF/SD) devices you have. This will be covered later. You will be +able to boot and check out your system with just the ROM. + +Connect a serial terminal or computer with terminal emulation software +to the primary serial port of your CPU board. You may need to refer to +your hardware provider's documentation for details. A null-modem +connection may be required. Set the baud rate as indicated in the table +above. Set the line characteristics to 8 data bits, 1 stop bit, no +parity, and no flow control. If possible, select ANSI or VT-100 terminal +emulation. + +RomWBW will automatically attempt to detect and support typical add-on +components for each of the systems supported. More information on the +required system configuration and optional supported components for +each ROM is found in [Appendix A - Pre-built ROM Images]. + +## System Startup + +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, application, or boot +from a disk device. + +Here is an example of a fairly typical startup. Your system will have +different devices and configuration, but the startup should look +similar. + +``` +RomWBW HBIOS v3.1.1-pre.183, 2022-10-04 + +RCBus [RCZ80_kio] Z80 @ 7.372MHz +0 MEM W/S, 1 I/O W/S, INT MODE 2, Z2 MMU +512KB ROM, 512KB RAM +ROM VERIFY: 00 00 00 00 PASS + +KIO: IO=0x80 ENABLED +CTC: IO=0x84 TIMER MODE=TIM16 +AY: MODE=RCZ80 IO=0xD8 NOT PRESENT +SIO0: IO=0x89 SIO MODE=115200,8,N,1 +SIO1: IO=0x8B SIO MODE=115200,8,N,1 +DSRTC: MODE=STD IO=0xC0 NOT PRESENT +MD: UNITS=2 ROMDISK=384KB RAMDISK=256KB +FD: MODE=RCWDC IO=0x50 NOT PRESENT +IDE: IO=0x10 MODE=RC +IDE0: NO MEDIA +IDE1: NO MEDIA +PPIDE: IO=0x20 +PPIDE0: LBA BLOCKS=0x00773800 SIZE=3815MB +PPIDE1: NO MEDIA + +Unit Device Type Capacity/Mode +---------- ---------- ---------------- -------------------- +Char 0 SIO0: RS-232 115200,8,N,1 +Char 1 SIO1: RS-232 115200,8,N,1 +Disk 0 MD0: RAM Disk 256KB,LBA +Disk 1 MD1: ROM Disk 384KB,LBA +Disk 2 IDE0: Hard Disk -- +Disk 3 IDE1: Hard Disk -- +Disk 4 PPIDE0: CompactFlash 3815MB,LBA +Disk 5 PPIDE1: Hard Disk -- +``` + +If your system completes the ROM-based boot process successfully, you +should see the RomWBW Boot Loader prompt. For example: + +``` +RCBus [RCZ80_kio] Boot Loader + +Boot [H=Help]: +``` + +If you get to this prompt, your system has completed the boot process +and is ready to accept commands. Note that the Boot Loader is not +an operating system or application. It is essentially the point where +you choose which operating system or application you want RomWBW to +execute. + +The Boot Loader is explained in detail in the next section. For now, +you can try a few simple commands to confirm that you can interact +with the system. + +At the Boot Loader prompt, you can type `H ` for help. You +can type `L ` to list the available built-in ROM applications. +If your terminal supports ANSI escape sequences, you can try the +'G' command to play a simple on-screen game. + +If all of this seems fine, your ROM has been successfully programmed. +See the [Boot Loader Operation] section of this document for further +instructions on use of the Boot Loader. + +## Core System Information + +During startup, the first few lines of information displayed provide the +most basic information on your system. In the example above, these +lines are the Core System Information: + +``` +RomWBW HBIOS v3.1.1-pre.183, 2022-10-04 + +RCBus [RCZ80_kio] Z80 @ 7.372MHz +0 MEM W/S, 1 I/O W/S, INT MODE 2, Z2 MMU +512KB ROM, 512KB RAM +ROM VERIFY: 00 00 00 00 PASS +``` + +The first line is a version identification banner for RomWBW. After +that you see a group of 4 lines describing the basic system. In this +example, the platform is the RCBus running a configuration named +"RCZ80_kio". The CPU is a Z80 with a current clock speed of 7.372 MHz. +There are 0 memory wait states and 1 I/O wait state. Z80 interrupt mode +2 is active and the bank memory manager is type "Z2" which is standard +for RCBus. The system has 512KB of ROM total and 512KB of RAM total. +Finally, a verification of the checksum of the critical ROM banks is +shown (all 4 should be 00). + +RomWBW attempts to detect the running configuration of the +system at startup. Depending on your hardware, there may be +inaccuracies in this section. For example, in some cases the CPU clock +speed is assumed rather than actually measured. This does not generally +affect the operation of your system. If you want to correct any of the +information displayed, you can create a custom ROM which is described +later. + +## Hardware Discovery + +The next set of messages during boot show the hardware devices as +they are probed and initially configured. In the example above, these +lines are: + +``` +KIO: IO=0x80 ENABLED +CTC: IO=0x84 TIMER MODE=TIM16 +AY: MODE=RCZ80 IO=0xD8 NOT PRESENT +SIO0: IO=0x89 SIO MODE=115200,8,N,1 +SIO1: IO=0x8B SIO MODE=115200,8,N,1 +DSRTC: MODE=STD IO=0xC0 NOT PRESENT +MD: UNITS=2 ROMDISK=384KB RAMDISK=256KB +FD: MODE=RCWDC IO=0x50 NOT PRESENT +IDE: IO=0x10 MODE=RC +IDE0: NO MEDIA +IDE1: NO MEDIA +PPIDE: IO=0x20 +PPIDE0: LBA BLOCKS=0x00773800 SIZE=3815MB +PPIDE1: NO MEDIA +``` + +What you see will depend on your specific system and ROM, but should +match the hardware present in your system. Each device has a tag that +precedes the colon. This tag identifies the driver and instance of each +device. For example, the tag "SIO0:" refers to the SIO serial port +driver and specifically the first channel. The "SIO1:" tag refers to +the second channel. + +In many cases you will see IO=0xNN in the data following the tag. This +identifies the base I/O port address of the hardware device and is +useful for identifying hardware conflicts. + +Note that you may see some lines indicating that the associated +hardware is not present. Above, you can see that the FD driver +did not find a floppy interface. Lines such as these are completely +normal when your system does not have the associated hardware. + +Finally, be aware that all ROMs are configured to identify specific +hardware devices at specific port addresses. If you add hardware +to your system that is not automatically identified, you may need +to build a custom ROM to add support for it. Building a custom ROM +is covered later. + +[Appendix B - Device Summary] contains a list of the RomWBW hardware +devices which may help you identify the hardware discovered in your +system. + +## Device Unit Assignments + +In order to support a wide variety of hardware, RomWBW HBIOS uses a +modular approach to implementing device drivers and presenting devices +to an operating system. In general, all devices are classified as +one of the following: + +* Disk (RAM/ROM Disk, Floppy Disk, Hard Disk, CF Card, SD Card, etc.) +* Character (Serial Ports, Parallel Ports, etc.) +* Video (Video Display/Keyboard Interfaces) +* Sound (Audio Playback Devices) +* RTC/NVRAM (Real Time Clock, Non-volatile RAM) +* System (Internal Services, e.g. Timer, DMA, etc.) + +HBIOS uses the concept of unit numbers to present a generic set of +hardware devices to the operating system. As an example, a typical +system might have a ROM Disk, RAM Disk, Floppy Drives, and Disk +Drives. All of these are considered disk devices and are presented +to the operating system as generic block devices. This means that +each operating system does not need to embed code to interact directly +with all of the different hardware devices -- RomWBW takes care of that. + +In the final group of startup messages, a device unit summary table is +displayed so that you can see how the actual hardware devices have +been mapped to unit numbers during startup. + +``` +Unit Device Type Capacity/Mode +---------- ---------- ---------------- -------------------- +Char 0 UART0: RS-232 38400,8,N,1 +Char 1 UART1: RS-232 38400,8,N,1 +Disk 0 MD1: RAM Disk 384KB,LBA +Disk 1 MD0: ROM Disk 384KB,LBA +Disk 2 FD0: Floppy Disk 3.5",DS/HD,CHS +Disk 3 FD1: Floppy Disk 3.5",DS/HD,CHS +Disk 4 IDE0: CompactFlash 3815MB,LBA +Disk 5 IDE1: Hard Disk -- +Disk 6 PRPSD0: SD Card 1886MB,LBA +Video 0 CVDU0: CRT Text,80x25 +``` + +In this example, you can see that the system has a total of 7 Disk +Units numbered 0-6. There are also 2 Character Units and 1 Video +Unit. The table shows the unit numbers assigned to each of the +devices. Notice how the unit numbers are assigned sequentially +regardless of the specific device. + +There may or may not be media in the disk devices listed. For example, +the floppy disk devices (Disk Units 2 & 3) may not have a floppy in +the drive. Also note that Disk Unit 4 shows a disk capacity, but +Disk Unit 5 does not. This is because the PPIDE interface of the +system supports up to two drives, but there is only one actual drive +attached. A unit number is assigned to all available devices +regardless of whether they have actual media installed at boot time. + +Note that Character Unit 0 is normally the initial system console. + +If your system has an RTC/NVRAM device, it will not be listed in the +unit summary table. Since only a single RTC/NVRAM device can exist in +one system, unit numbers are not required nor used for this type of +device. Also, System devices are not listed because they are entirely +internal to RomWBW. + +# Boot Loader Operation + +Once your system has completed the startup process, it presents a +Boot Loader command prompt. The purpose of the Boot Loader is to +select and launch a desired application or operating system. It also +has the ability to configure some aspects of system operation. + +After starting your system, following the hardware initialization, you +will see the RomWBW Boot Loader prompt. Below is an example: + +``` +Mark IV [MK4_wbw] Boot Loader + +Boot [H=Help]: +``` + +From the Boot Loader prompt, you can enter commands to select and launch any of +the RomWBW operating systems or ROM applications. It also allows you to +manage some basic settings of the system. To enter a command, just +enter the command followed by ***\***. + +For example, typing `H` will display a short command summary: + +``` +Boot [H=Help]: h + + L - List ROM Applications + D - Disk Device Inventory + R - Reboot System + I [] - Set Console Interface/Baud code + V [] - View/Set HBIOS Diagnostic Verbosity + [.] - Boot Disk Unit/Slice +``` + +Likewise the `L` command will display the list of ROM Applications that +you can launch right from the Boot Loader: + +``` +Boot [H=Help]: L + +ROM Applications: + + M: Monitor + Z: Z-System + C: CP/M 2.2 + F: Forth + B: BASIC + T: Tasty BASIC + P: Play a Game + N: Network Boot + X: XModem Flash Updater + U: User App +``` + +## Starting Applications from ROM + +To start a ROM application you just enter the corresponding letter at +the Boot Loader prompt. In the following example, we launch the +built-in Microsoft BASIC interpreter. From within BASIC, we use the +`BYE` command to return to the Boot Loader: + +``` +Boot [H=Help]: b + +Loading BASIC... +Memory top? +Z80 BASIC Ver 4.7b +Copyright (C) 1978 by Microsoft +55603 Bytes free +Ok +bye + + +Mark IV [MK4_wbw] Boot Loader + +Boot [H=Help]: +``` + +The following ROM applications and OSes are available at the boot loader +prompt: + +| **Application** | **Description** | +|-------------------|----------------------------------------------------------------| +| Monitor | Z80 system debug monitor w/ Intel Hex loader | +| CP/M 2.2 | Digital Research CP/M 2.2 OS | +| Z-System | ZSDOS 1.1 w/ ZCPR 1 (Enhanced CP/M compatible OS) | +| Forth | Brad Rodriguez's ANSI compatible Forth language | +| Tasty BASIC | Dimitri Theuling's Tiny BASIC implementation | +| Play | A simple video game (requires ANSI terminal emulation) | +| Network Boot | Boot system via Wiznet MT011 device | +| Flash Update | Upload and flash a new ROMWBW image using xmodem | + +Each of the ROM Applications is documented in $doc_romapps$. Some +of the applications (such as BASIC) also have their own independent +manual in the Doc directory of the distribution. The OSes included +in the ROM (CP/M 2.2 & Z-System) are described in the Operating Systems +section of this document. + +In general, the command to exit any of these applications and restart +the system is `BYE`. The exceptions are the Monitor which uses `B` and +Play which uses `Q`. + +Two of the ROM Applications are, in fact, complete operating systems. +Specifically, "CP/M 2.2" and "Z-System" are provided so that you can +actually start either operating system directly from your ROM. This +technique is useful when: + +* You don't yet have any real disk drives in your system +* You want to setup real disk drives for the first time +* You are upgrading your system and need to upgrade your real disk drives + +The RAM disk and ROM disk drives will be available even if you have +no physical disk devices attached to your system. + +## Starting Operating Systems from Disk + +In order to make use of the more sophisticated operating systems +available with RomWBW, you will need to boot an operating system +from a disk. Setting up disks is described in detail later. For now, +we will just go over the command line for performing this type of boot. + +From the Boot Loader prompt, you can enter a number (***\***) +and optionally a dot followed by a second number (***\***). The +***\*** unit number refers to a disk unit that was displayed +when the system was booted -- essentially it specifies the specific +physical disk drive you want to boot. The ***\*** numbers refers +to a portion of the disk unit to boot. If no slice is specified, then +it is equivalent to booting from the first slice (slice 0). Disk units +and slices are described in more detail later. + +Following this, you should see the operating system startup +messages. Your operating system prompt will typically be `A>` and +when you look at the drive letter assignments, you should see that A: +has been assigned to the disk and slice you selected to boot. + +If you receive the error message "Disk not bootable!", you have +either failed to properly initialize the disk and slice requested +or you have selected the wrong disk/slice. + +The following example shows a disk boot into the first slice of disk +unit 4 which happens to be the CP/M 2.2 operating system on this disk. +This is accomplished by entering just the number '4' and pressing +***\***. + +``` +Boot [H=Help]: 4 + +Booting Disk Unit 4, Slice 0, Sector 0x00000800... + +Volume "Unlabelled" [0xD000-0xFE00, entry @ 0xE600]... + +CBIOS v3.1.1-pre.194 [WBW] + +Formatting RAMDISK... + +Configuring Drives... + + A:=IDE0:0 + B:=MD0:0 + C:=MD1:0 + D:=FD0:0 + E:=FD1:0 + F:=IDE0:1 + G:=IDE0:2 + H:=IDE0:3 + I:=PRPSD0:0 + J:=PRPSD0:1 + K:=PRPSD0:2 + L:=PRPSD0:3 + + 1081 Disk Buffer Bytes Free + +CP/M-80 v2.2, 54.0K TPA + +A> +``` + +Notice that a list of drive letters and their assignments to RomWBW +devices and slices is displayed during the initialization of the +operating system. + +Here is another example where we are booting disk unit 4, slice 3 +which is the CP/M 3 operating system on this disk: + +``` +Boot [H=Help]: 4.3 + +Booting Disk Unit 4, Slice 3, Sector 0x0000C800... + +Volume "Unlabelled" [0x0100-0x1000, entry @ 0x0100]... + +CP/M V3.0 Loader +Copyright (C) 1998, Caldera Inc. + + BNKBIOS3 SPR F600 0800 + BNKBIOS3 SPR 4500 3B00 + RESBDOS3 SPR F000 0600 + BNKBDOS3 SPR 1700 2E00 + + 60K TPA + +CP/M v3.0 [BANKED] for HBIOS v3.1.1-pre.194 + +A> +``` + +Some operating systems (such as CP/M 3 shown above) do not list the +drive assignments during initialization. In this case, you can use the +`ASSIGN` command to display the current assignments. + +The Boot Loader simply launches whatever is in the disk unit/slice you +have specified. It does not know what operating system is at that +location. The layout of operating systems on disk media is described in +the Using Disks section of this document. + +## System Management + +### Listing Disk Device Inventory + +The disk device units available in your system are listed in the +boot messages. However, if that list has scrolled off of your +screen, you can use the 'D' command to display a list of them at +any time from the Boot Loader prompt. + +``` +Boot [H=Help]: d + +Disk Devices: + + Disk Unit 0 on MD0: + Disk Unit 1 on MD1: + Disk Unit 2 on FD0: + Disk Unit 3 on FD1: + Disk Unit 4 on IDE0: + Disk Unit 5 on IDE1: + Disk Unit 6 on IDE2: + Disk Unit 7 on IDE3: + Disk Unit 8 on IDE4: + Disk Unit 9 on IDE5: + Disk Unit 10 on SD0: + Disk Unit 11 on PRPSD0: +``` + +### Rebooting the System + +The 'R' command within the Boot Loader performs a software reset of +the system. It is the software equivalent of pressing the reset +button. + +There is generally no need to do this, but it can be convenient when +you want to see the boot messages again or ensure your system is in +a clean state. + +``` +Boot [H=Help]: r + +Restarting System... +``` + +### Changing Console and Console speed + +Your system can support a number of devices for the console. They may +be VDU type devices or serial devices. If you want to change which +device is the console, the ***I*** menu option can be used to choose +the unit and its speed. + +The command format is ```I []``` + +where ***\*** is the character unit to select and ***\*** +is the optional baud rate. + +Supported baud rates are: +``` + 75 450 1800 7200 38400 115200 460800 1843200 +150 600 2400 9600 28800 153600 614400 2457600 +225 900 3600 14400 57600 230400 921600 3686400 +300 1200 4800 19200 76800 307200 1228800 7372800 +``` + +Here is an example of changing the console to unit #1 (the second +serial port) and switching the port to 9600 baud: + +``` +Boot [H=Help]: i 1 9600 + + Change speed now. Press a key to resume. + + Console on Unit #1 +``` + +At this point, the Boot Loader prompt will be displayed on character +unit #1. + +Note that not all character devices support changing baud rates and +some only support a limited subset of the baud rates listed. If you +attempt to select an invalid baud rate for your system, you will get +an error message. + +### HBIOS Diagnostic Verbosity + +The 'V' command of the Boot Loader allows you to view and optionally +change the level of diagnostic messages that RomWBW will produce. +The normal verbosity level is 4, which means to display only fatal +errors. You can increase this level to see more warnings when function +calls to RomWBW HBIOS detect problems. + +The use of diagnostic levels above 4 are really intended only for +software developers. I do not recommend changing this under +normal circumstances. + +# Disk Management + +The systems supported by RomWBW all have the ability to use persistent +disk media. A wide variety of disk devices are supported including +floppy drives, hard disks, CF Cards, and SD Cards. RomWBW also +supports the use of extra RAM and ROM memory as pseudo-disk devices. + +RomWBW supports a variety of storage devices which will be discussed +in more detail later. + +* ROM Disk +* RAM Disk +* Floppy Disk +* Hard Disk (includes CF Cards and SD Cards) + +We will start by discussing each of these types of storage devices and +how to prepare them so files can be stored on them. Subsequently, we +will describe how to install the pre-built disk images with bootable +operating systems and ready-to-run content. + +Some systems have disk interfaces built-in, while others will require +add-in cards. You will need to refer to the documentation for your +system for your specific options. + +In the RomWBW boot messages, you will see hardware discovery messages. +If you have a disk drive interface, you should see messages listing +device types like FD:, IDE:, PPIDE:, SD:. Additionally, you will see +messages indicating the media that has been found on the interfaces. +As an example, here are the messages you might see if you have an IDE +interface in your system with a single CF Card inserted in the +primary side of the interface: + +``` +IDE: IO=0x80 MODE=MK4 +IDE0: 8-BIT LBA BLOCKS=0x00773800 SIZE=3815MB +IDE1: NO MEDIA +``` + +The messages you see will vary depending on your hardware and the +media you have installed. But, they will all have the same general +format as the example above. + +Once your system has working disk devices, they will be accessible +from any operating system you choose to run. Disk storage is available +whether you boot your OS from ROM or from the disk media itself. + +Referring back to the Boot Loader section on "Launching from ROM", you +could start CP/M 2.2 using the 'C' command. As the operating system +starts up, you should see a list of drive letters assigned to the disk +media you have installed. Here is an example of this: + +``` +Configuring Drives... + + A:=MD1:0 + B:=MD0:0 + C:=IDE0:0 + D:=IDE0:1 +``` + +You will probably see more drive letters than this. The drive letter +assignment process is described below in the Drive Letter Assignment +section. Be aware that RomWBW will only assign drive letters to disk +interfaces that actually have media in them. If you do not see drive +letters assigned as expected, refer to the prior system boot messages +to ensure media has been detected in the interface. Actually, there +is one exception to this rule: floppy drives will be assigned a drive +letter regardless of whether there is any media inserted at boot. + +Notice how each drive letter refers back to a specific disk hardware +interface like IDE0. This is important as it is telling you what each +drive letter refers to. Also notice that mass storage disks (like IDE) +will normally have multiple drive letters assigned. The extra drive +letters refer to additional "slices" on the disk. The concept of slices +is described below in the Slices section. + +## Drive Letter Assignment + +In legacy CP/M-type operating systems, drive letters were generally +mapped to disk drives in a completely fixed way. For example, drive A: +would **always** refer to the first floppy drive. Since RomWBW +supports a wide variety of hardware configurations, it implements a +much more flexible drive letter assignment mechanism so that any drive +letter can be assigned to any disk device. + +At boot, you will notice that RomWBW automatically assigns drive +letters to the available disk devices. These assignments are +displayed during the startup of the selected operating system. +Additionally, you can review the current drive assignments at any +time using the `ASSIGN` command. CP/M 3 and ZPM3 do not automatically +display the assignments at startup, but you can use `ASSIGN` to +display them. Refer to $doc_apps$ for more information on +use of the `ASSIGN` command. + +Here is an example of the list of drive letter assignments made during +the startup of Z-System: + +``` +Loading Z-System... + +CBIOS v3.1.1-pre.194 [WBW] + +Formatting RAMDISK... + +Configuring Drives... + + A:=MD0:0 + B:=MD1:0 + C:=FD0:0 + D:=FD1:0 + E:=IDE0:0 + F:=IDE0:1 + G:=IDE0:2 + H:=IDE0:3 + + 1081 Disk Buffer Bytes Free + +ZSDOS v1.1, 54.0K TPA +``` + +Above you can see that drive A: has been assigned to MD0 which is the +RAM Disk device. Drives C: and D: have been assigned to floppy drives. +Drives E: thru L: have been assigned to the IDE0 hard disk device. The +4 entries for IDE0 are referring to 4 slices on that disk. Slices are +discussed later. + +The drive letter assignments **do not** change during an OS session +unless you use the `ASSIGN` command yourself to do it. Additionally, +the assignments at boot will stay the same on each boot as long as you +do not make changes to your hardware configuration. Note that the +assignments **are** dependent on the media currently inserted in hard +disk drives. So, notice that if you insert or remove an SD Card or CF +Card, the drive assignments will change. Since drive letter +assignments can change, you must be careful when doing destructive +things like using `CLRDIR` to make sure the drive letter you use is +referring to the desired media. + +When performing a ROM boot of an operating system, note that A: will +be your RAM disk and B: will be your ROM disk. When performing a disk +boot, the disk you are booting from will be assigned to A: and the +rest of the drive letters will be offset to accommodate this. This is +done because most legacy operating systems expect that A: will be the +boot drive. + +## ROM & RAM Disks + +A typical RomWBW system has 512KB of ROM and 512KB of RAM. Some +portions of each are dedicated to loading and running applications +and operating system. The space left over is available for an +operating system to use as a pseudo-disk device. + +The RAM disk provides a small CP/M filesystem that you can use for the +temporary storage of files. Unless your system has a battery backed +mechanism for persisting your RAM contents, the RAM disk contents will +be lost at each power-off. However, the RAM disk is an excellent +choice for storing temporary files because it is very fast. You will +notice that the first time an operating system is started after the +power was turned off, you will see a message indicating that the +RAM disk is being formatted. If you reset your system without +turning off power, the RAM disk will not be reformatted and it's +contents will still be intact. + +Like the RAM disk, the ROM disk also provides a small CP/M +filesystem, but it's contents are static -- they are part of the +ROM. As such, you cannot save files to the ROM disk. Any attempt to +do this will result in a disk I/O error. The contents of the ROM +disk have been chosen to provide a core set of tools and +applications that are helpful for either CP/M 2.2 or ZSDOS. Since +ZSDOS is CP/M 2.2 compatible, this works fairly well. However, you +will find some files on the ROM disk that will work with ZSDOS, but +will not work on CP/M 2.2. For example, `LDDS`, which loads the +ZSDOS date/time stamper will only run under ZSDOS. + +Unlike other types of disk devices, ROM and RAM Disks do not contain an +actual operating system and are not "bootable". However, they are +accessible to any operating system (whether the operating system is +loaded from ROM or a different disk device). + +Neither RAM not ROM disks require explicit formatting or initialization. +ROM disks are pre-formatted and RAM disks are formatted automatically +with an empty directory when first used. + +#### Flash ROM Disks + +The limitation of ROM disks being read only can be overcome on some +platforms with the appropriate selection of Flash ROM chip and +system configuration. In this case the flash-file system can be +enabled which will allow the ROM disk to be read and written to. +Flash devices have a limited write lifespan and continual usage will +eventually wear out the device. It is not suited for high usage +applications. Enabling ROM disk writing requires building a +custom ROM. + +## Floppy Disks + +If your system has the appropriate hardware, RomWBW will support the use +of floppy disks. The supported floppy disk formats are generally +derived from the IBM PC floppy disk formats: + +* 5.25" 360K Double-sided, Double-density +* 5.25" 1.2M Double-sided, High-density +* 3.5" 720K Double-sided, Double-density +* 3.5" 1.44M Double-sided, High-density + +When supported, RomWBW is normally configured for 2 3.5" floppy drives. +If a high-density drive is used, then RomWBW automatically detects and +adapts to double-density or high-density media. It cannot automatically +detect 3.5" vs. 5.25" drive types -- the ROM must be pre-configured +for the drive type. + +Floppy media must be physically formatted before it can be used. This +is normally accomplished by using the supplied Floppy Disk Utility (FDU) +application. This application interacts directly with your hardware +and therefore you must specify your floppy interface hardware at startup. +Additionally, you need to specify the floppy drive and media format to +use for formatting. + +Below is a sample session using FDU to format a 1.44M floppy disk in +the first (primary) floppy disk drive: + +``` +B>fdu + +Floppy Disk Utility (FDU) v5.8, 26-Jul-2021 [HBIOS] +Copyright (C) 2021, Wayne Warthen, GNU GPL v3 + +SELECT FLOPPY DISK CONTROLLER: + (A) Disk IO ECB Board + (B) Disk IO 3 ECB Board + (C) Zeta SBC Onboard FDC + (D) Zeta 2 SBC Onboard FDC + (E) Dual IDE ECB Board + (F) N8 Onboard FDC + (G) RCBus SMC (SMB) + (H) RCBus WDC (SMB) + (I) SmallZ80 Expansion + (J) Dyno-Card FDC, D1030 + (K) RCBus EPFDC + (L) Multi-Board Computer FDC + (X) Exit +=== OPTION ===> D-IDE + +===== D-IDE ===========<< FDU MAIN MENU >>====================== +(S)ETUP: UNIT=00 MEDIA=720KB DS/DD MODE=POLL TRACE=00 +---------------------------------------------------------------- +(R)EAD (W)RITE (F)ORMAT (V)ERIFY +(I)NIT BUFFER (D)UMP BUFFER FDC (C)MDS E(X)IT +=== OPTION ===> SETUP +ENTER UNIT [00-03] (00): +00: 3.5" 720KB - 9 SECTORS, 2 SIDES, 80 TRACKS, DOUBLE DENSITY +01: 3.5" 1.44MB - 18 SECTORS, 2 SIDES, 80 TRACKS, HIGH DENSITY +02: 5.25" 320KB - 8 SECTORS, 2 SIDES, 40 TRACKS, DOUBLE DENSITY +03: 5.25" 360KB - 9 SECTORS, 2 SIDES, 40 TRACKS, DOUBLE DENSITY +04: 5.25" 1.2MB - 15 SECTORS, 2 SIDES, 80 TRACKS, HIGH DENSITY +05: 8" 1.11MB - 15 SECTORS, 2 SIDES, 77 TRACKS, DOUBLE DENSITY +06: 5.25" 160KB - 8 SECTORS, 1 SIDE, 40 TRACKS, DOUBLE DENSITY +07: 5.25" 180KB - 9 SECTORS, 1 SIDE, 40 TRACKS, DOUBLE DENSITY +08: 5.25" 320KB - 8 SECTORS, 1 SIDE, 80 TRACKS, DOUBLE DENSITY +09: 5.25" 360KB - 9 SECTORS, 1 SIDE, 80 TRACKS, DOUBLE DENSITY +ENTER MEDIA [00-09] (00): 01 +00: POLLING (RECOMMENDED) +01: INTERRUPT (!!! READ MANUAL !!!) +02: FAST INTERRUPT (!!! READ MANUAL !!!) +03: INT/WAIT (!!! READ MANUAL !!!) +04: DRQ/WAIT (!!! NOT YET IMPLEMENTED!!!) +ENTER MODE [00-04] (00): +ENTER TRACE LEVEL [00-01] (00): + +===== D-IDE ===========<< FDU MAIN MENU >>====================== +(S)ETUP: UNIT=00 MEDIA=1.44MB DS/HD MODE=POLL TRACE=00 +---------------------------------------------------------------- +(R)EAD (W)RITE (F)ORMAT (V)ERIFY +(I)NIT BUFFER (D)UMP BUFFER FDC (C)MDS E(X)IT +=== OPTION ===> FORMAT (T)RACK, (D)ISK ===> DISK +ENTER INTERLEAVE [01-12] (02): + + + +RESET DRIVE... +PROGRESS: TRACK=4F HEAD=01 SECTOR=01 + +===== D-IDE ===========<< FDU MAIN MENU >>====================== +(S)ETUP: UNIT=00 MEDIA=1.44MB DS/HD MODE=POLL TRACE=00 +---------------------------------------------------------------- +(R)EAD (W)RITE (F)ORMAT (V)ERIFY +(I)NIT BUFFER (D)UMP BUFFER FDC (C)MDS E(X)IT +=== OPTION ===> EXIT +``` + +Since the physical format of floppy media is the same as that used +in a standard MS-DOS/Windows computer, you can also physical format +floppy media in a modern computer. However, the directory format +itself will not be compatible with CP/M OSes. In this case, you +can use the `CLRDIR` application supplied with RomWBW to reformat +the directory area. + +Once a floppy disk is formatted, you can read/write files on it +using any of the RomWBW operating systems. The specific commands +will depend on the operating system or application in use -- refer to +the appropriate OS/application documentation as needed. + +**WARNING:** Some of the operating systems provided with RomWBW require +that a soft-reset be performed when swapping floppy disk media. For +example, under CP/M 2.2, you must press control-C at the CP/M prompt +after inserting a new floppy disk. + +## Hard Disks + +Under RomWBW, a hard disk is similar to a floppy disk in that it is +considered a disk unit. However, RomWBW has multiple features that +allow its legacy operating systems to take advantage of modern +mass storage media. + +To start with, the concept of a hard disk in RomWBW applies to any +storage device that provides at least 8MB of space. The actual +media can be a real spinning hard disk, a CompactFlash Card, a +SD Card, etc. In this document, the term hard disk will apply +equally to all of these. + +RomWBW uses Logical Block Addressing (LBA) to interact with all hard +disks. The RomWBW operating systems use older Cylinder/Head/Sector +(CHS) addressing. To accommodate the operating systems, RomWBW emulates +CHS addressing. Specifically, it makes all hard disks look like they +have 16 sectors and 16 heads. The number of tracks varies with the size +of the physical hard disk. + +It is recommended that hard disk media used with RomWBW be 1GB or +greater in capacity. The reasons for this are discussed later, but it +allows you to use the recommended disk layout for RomWBW that +accommodates 64 CP/M filesystem slices and a 384KB FAT filesystem. + +>>> Although we have not yet discussed how to get content on your disk +>>> units, it is necessary to have a basic understanding of how RomWBW +>>> handles disk devices as background. The following sections explain how +>>> disk units are managed within the operating systems. We will +>>> subsequently discuss how to actually setup disk devices with usable +>>> content. + +## Slices + +The vintage operating systems included with RomWBW were produced at a +time when mass storage devices were quite small. CP/M 2.2 could only +handle filesystems up to 8MB. In order to achieve compatibility across +all of the operating systems supported by RomWBW, the hard disk +filesystem format used is 8MB. This ensures any filesystem will be +accessible to any of the operating systems. + +Since storage devices today are quite large, RomWBW implements a +mechanism called slicing to allow up to 256 8MB filesystems on a +single large storage device. This allows up to 2GB of usable space on +one media. You can think of slices as a way to refer to any of +the first 256 8MB chunks of space on a single media. + +Note that although you can use up to 256 slices per physical disk, this +large number of slices is rarely used. The recommended RomWBW disk +layout provides for 64 slices which is more than enough for most +use cases. + +Of course, the problem is that CP/M-like operating systems have only +16 drive letters (A:-P:) available. Under the covers, RomWBW allows +you to use any drive letter to refer to any slice of any media. The +`ASSIGN` command is used to view or change the current drive letter +mappings at any time. At startup, the operating system will +automatically allocate a reasonable number of drive letters to the +available storage devices. The allocation will depend on the number of +mass storage devices available at boot. For example, if you have +only one hard disk type media, you will see that 8 drive letters are +assigned to the first 8 slices of that media. If you have two large +storage devices, you will see that each device is allocated four drive +letters. + +Referring to slices within a storage device is done by appending a : +** where ** is the device relative slice number from 0-255. For +example, if you have an IDE device, it will show up as IDE0: in the +boot messages meaning the first IDE device. To refer to the fourth +slice of IDE0, you would type "IDE0:3". Here are some examples: + +| | | +|----------|------------------------------| +| `IDE0:0` | First slice of disk in IDE0 | +| `IDE0:` | First slice of disk in IDE0 | +| `IDE0:3` | Fourth slice of disk in IDE0 | + +So, if you wanted to use drive letter L: to refer to the fourth slice +of IDE0, you could use the command `ASSIGN L:=IDE0:3`. There are a +couple of rules to be aware of when assigning drive letters. First, +you may only refer to a specific device/slice with one drive letter at a time. +Said another way, you cannot have multiple drive letters referring +to a the same device/slice at the same time. Second, there must always +be a drive assigned to A:. Any attempt to violate these rules will +be blocked by the `ASSIGN` command. + +In case this wasn't already clear, you **cannot** refer directly +to slices using CP/M. CP/M only understands drive letters, so +to access a given slice, you must assign a drive letter to it first. + +While it may be obvious, you cannot use slices on any media less +than 8MB in size. Specifically, you cannot slice RAM disks, ROM +disks, floppy disks, etc. All of these are considered to have a single +slice and any attempt to ASSIGN a drive letter to a slice beyond that +will result in an error message. + +It is very important to understand that RomWBW slices are not +individually created or allocated on your hard disk. RomWBW uses a +single, large chunk of space on your hard disk to contain the slices. +You should think of slices as just an index into a sequential set of 8MB +areas that exist in this large chunk of space. The next section will +go into more detail on how slices are located on your hard disk. + +Although you do not need to allocate slices individually, you do need to +initialize each slice for CP/M to use it. This is somewhat analogous +to doing a FORMAT operation on other systems. With RomWBW you use the +`CLRDIR` command to do this. This command is merely "clearing out" the +directory space of the slice referred to by a drive letter and setting +up the new empty directory. Since `CLRDIR` works on drive letters, make +absolutely sure you know what media and slice are assigned to that +drive letter before using `CLRDIR` because CLRDIR will wipe out any +pre-existing contents of the slice. + +Here is an example of using `CLRDIR`. In this example, the `ASSIGN` +command is used to show the current drive letter assignments. Then +the `CLRDIR` command is used to initialize the directory of drive 'G' +which is slice 2 of hard disk device IDE0 ("IDE0:2"). + +``` +B>assign + + A:=MD0:0 + B:=MD1:0 + C:=FD0:0 + D:=FD1:0 + E:=IDE0:0 + F:=IDE0:1 + G:=IDE0:2 + H:=IDE0:3 + +B>clrdir G: +CLRDIR Version 1.2 April 2020 by Max Scane + +Warning - this utility will overwrite the directory sectors of Drive: G +Type Y to proceed, any key other key to exit. Y +Directory cleared. +B> +``` + +## Hard Disk Layouts + +As previously discussed, when RomWBW uses a hard disk, it utilizes a +chunk of space for a sequential series of slices that contain the +actual CP/M filesystems referred to by drive letters. + +Originally, RomWBW always used the very start of the hard disk media +for the location of the slices. In this layout, slice 0 referred to +the first chunk of ~8MB on the disk, slice 1 referred to the second +chunk of ~8MB on the disk, and so on. The number of slices is limited +to the size of the disk media -- if you attempted to read/write to a +slice that would exceed the disk size, you would see I/O errors. This +is considered the "legacy" disk layout for RomWBW. + +RomWBW has subsequently been enhanced to support the concept of +partitioning. The partition mechanism is entirely compliant with Master + Boot Record (MBR) Partition Tables introduced by IBM for the PC. The +Wikipedia article on the +[Master Boot Record](https://en.wikipedia.org/wiki/Master_boot_record) +is excellent if you are not familiar with them. This is considered the +"modern" disk layout for RomWBW. RomWBW uses the partition type id +0x2E. RomWBW does not support extended partitions -- only a single +primary partition can be used. + +Both the legacy and modern disk layouts continue to be fully supported +by RomWBW. There are no plans to deprecate the legacy layout. In fact, +the legacy format takes steps to allow a partition table to still be +used for other types of filesystems such as DOS/FAT. It just does not +use a partition table entry to determine the start of the RomWBW slices. + +There is one more difference between the legacy and modern disk layouts +that should be highlighted. The CP/M filesystem in the slices of +the legacy disk layout contain 512 directory entries. The modern disk +layout filesystems provide 1024 directory entries. In fact, you will +subsequently see that the prefixes "hd512" and "hd1k" are used to +identify disk images appropriate for the legacy and modern format. + +You **cannot** mix disk layouts on a single disk device. To say it +another way, the existence of a partition table entry for RomWBW on +a hard disk makes it behave in the modern mode. The lack of a RomWBW +partition table entry will cause legacy behavior. Adding a partition +table entry on an existing legacy RomWBW hard disk will cause the +existing data to be unavailable and/or corrupted. Likewise, removing +the RomWBW partition entry from a modern hard disk layout will cause +the same problems. It is perfectly fine for one system to have +multiple hard disks with different layouts -- each physical disk +device is handled separately. + +If you are setting up a new disk, the modern (hd1k) layout is +recommended for the following reasons: + +* Larger number of directory entries per filesystem +* Simplifies creation of coresident FAT filesystem +* Reduces chances of data corruption + +### Checking Hard Disk Layout + +If you are not sure which hard disk layout was used for your existing +media, you can use the CP/M `STAT` command to determine this. This +command displays the number of directory entries on a filesystem. If +it indicates 512, your disk layout is legacy (hd512). If it indicates +1024, your disk layout is modern (hd1k). + +Here is an example of checking the disk layout. We want to check the +CompactFlash Card inserted in IDE interface 0. We start the system +and boot to Z-System in ROM by using the 'Z' command at the Boot Loader. +As Z-System starts, we see the following disk assignments: + +``` +Boot [H=Help]: z + +Loading Z-System... + +CBIOS v3.1.1-pre.194 [WBW] + +Configuring Drives... + + A:=MD0:0 + B:=MD1:0 + C:=FD0:0 + D:=FD1:0 + E:=IDE0:0 + F:=IDE0:1 + G:=IDE0:2 + H:=IDE0:3 + I:=PRPSD0:0 + J:=PRPSD0:1 + K:=PRPSD0:2 + L:=PRPSD0:3 + + 1081 Disk Buffer Bytes Free + +ZSDOS v1.1, 54.0K TPA +``` + +You can see that the IDE0 interface (which contains the CF Card) has +been assigned to drive letters E: to H:. We can use the STAT command +on any of these drive letters. So, for example: + +``` +B>stat e:dsk: + + E: Drive Characteristics +65408: 128 Byte Record Capacity + 8176: Kilobyte Drive Capacity + 1024: 32 Byte Directory Entries + 0: Checked Directory Entries + 256: Records/ Extent + 32: Records/ Block + 64: Sectors/ Track + 2: Reserved Tracks +``` + +It is critical that you include "dsk:" after the drive letter in the +`STAT` command line. The important line to look at is labelled "32 Byte +Directory Entries". In this case, the value is 1024 which implies that +this drive is located on a modern (hd1k) disk layout. If the value +was 512, it would indicate a legacy (hd512) disk layout. + +# Disk Content Preparation + +With some understanding of how RomWBW presents disk space to the +operating systems, we need to go over the options for actually setting +up your disk(s) with content. + +Since it would be quite a bit of work to transfer over all the files you +might want initially to your disk(s), RomWBW provides a much easier way +to get initial contents on your disks. You can use your modern +Windows, Linux, or Mac computer to copy a disk image onto the disk +media, then just move the media over to your RomWBW computer. RomWBW +comes with a variety of disk images that are ready to use and have a +much more complete set of files than you will find on the ROM disk. This +process is covered below under [Disk Images]. + +If you do not want to start with pre-built disk images, you can +alternatively initialize the media in-place using your RomWBW system. +Essentially, this means you are creating a set of blank directories on +your disk so that files can be saved there. This process is described +below under Disk Initialization. In this scenario, you will need to +subsequently copy any files you want to use onto the newly initialized +disk (see [Transferring Files]). + +You will notice that in the following instructions there is no mention +of specific hardware. Because the RomWBW firmware provides a +hardware abstraction layer, all disk images will work on all +hardware variations. Yes, this means you can remove an CF/SD Card from +one RomWBW system and put it in a different RomWBW system. The only +constraint is that the applications on the disk media must be up to date +with the firmware on the system being used. + +## Disk Images + +As mentioned previously, RomWBW includes a variety of disk images +that contain a full set of applications for the operating systems +supported. It is generally easier to use these disk images than +transferring your files over individually. You use your modern +computer (Windows, Linux, MacOS) to write the disk image onto the +disk media, then just move the media over to your system. + +The disk image files are found in the Binary directory of the +distribution. Floppy disk images are prefixed with "fd_" and hard +disk images are prefixed with either "hd512_" or "hd1k_" depending on the +hard disk layout they are for. + +Each disk image has the complete set of normal applications and tools +distributed with the associated operating system or application suite. +The following table shows the disk images available. + +| **Disk Image** | **Description** | **Boot** | +|-----------------|----------------------------------------|----------| +| xxx_cpm22.img | DRI CP/M 2.2 Operating System | Yes | +| xxx_zsdos.img | ZCPR-DJ & ZSDOS 1.1 Operating System | Yes | +| xxx_nzcom.img | NZCOM ZCPR 3.4 Operating System | Yes | +| xxx_cpm3.img | DRI CP/M 3 Operating System | Yes | +| xxx_zpm3.img | ZPM3 Operating System | Yes | +| xxx_qpm.img | QPM Operating System | Yes | +| xxx_dos65.img | DOS/65 Operating System | Yes | +| xxx_ws4.img | WordStar v4 & ZDE Applications | No | + +You will find 3 sets of these .img files in the distribution. The +"xxx" portion of the filename will be "fd_" for a floppy image, +"hd512" for a legacy layout hard disk image, and "hd1K" for a modern +layout hard disk image. + +There is also an image file called "psys.img" which contains a bootable +p-System hard disk image. It contains 6 p-System filesystem slices, but +these are not interoperable with the CP/M slices described above. This +file is discussed separately under p-System in the [Operating Systems] +section. + +### Floppy Disk Images + +The floppy disk images are all intended to be used with 3.5" high-density, +double-sided 1.44 MB floppy disk media. This is ideal for the default +floppy drive support included in RomWBW standard ROMs. + +For floppy disks, the .img file is written directly to the floppy media +as is. The floppy .img files are 1.44 MB which is the exact size of a +single 3.5" high density floppy disk. You will need a floppy disk +drive of the same type connected to your modern computer to write this +image. Although modern computers do not come equipped with a floppy +drive, you can still find USB floppy drives that work well for this. + +The floppy disk must be physically formatted **before** writing the +image onto it. You can do this with RomWBW using FDU as described +in the [Floppy Disks] section of this document. You can also format +the floppy using your modern computer, but using FDU on RomWBW is +preferable because it will allow you to use optimal physical sector +interleaving. + +RomWBW includes a Windows application called RawWriteWin in the Tools +directory of the distribution. This simple application will let you +choose a file and write it to an attached floppy drive. For Linux/MacOS, +I think you can use the dd command (but I have not actually tried +this). It is probably obvious, but writing an image to a floppy disk +will overwrite and destroy all previous contents. + +Once the image has been written to the floppy disk, you can insert +the floppy disk in your RomWBW floppy disk and read/write files +on it according to the specific operating system instructions. If the +image is bootable, then you will be able to boot from it by entering +the floppy drive's corresponding unit number at the RomWBW Boot Loader +command prompt. + +### Hard Disk Images + +Keeping in mind that a RomWBW hard disk (including CF /SD Cards) +allows you to have multiple slices (CP/M filesystems), there are a +couple ways to image hard disk media. The easiest approach is to +use the "combo" disk image. This image is already prepared +with 6 slices containing 5 ready-to-run OSes and a slice with +the WordStar application. Alternatively, you can create your own +hard disk image with the specific slice contents you choose. + +#### Combo Hard Disk Image + +The combo disk image is essentially just a single image that has several +of the individual filesystem images already concatenated together. The +combo disk image contains the following 6 slices in the positions +indicated: + +| **Slice** | **Description** | +|-----------|------------------------------------------------------------------| +| Slice 0 | DRI CP/M 2.2 Operating System | +| Slice 1 | ZCPR-DJ & ZSDOS 1.1 Operating System | +| Slice 2 | NZCOM ZCPR 3.4 Operating System | +| Slice 3 | DRI CP/M 3 Operating System | +| Slice 4 | ZPM3 Operating System | +| Slice 5 | WordStar v4 & ZDE Applications | + +You will notice that there are actually 2 combo disk images in the +distribution. One for an hd512 disk layout (hd512_combo.img) and one +for an hd1k disk layout (hd1k_combo.img). Simply use the image file that +corresponds to your desired hard disk layout. + +#### Custom Hard Disk Image + +If you want to use specific slices in a specific order, you can easily +generate a custom hard disk image file. + +For hard disks, each .img file represents a single slice (CP/M +filesystem). Since a hard disk can contain many slices, you can just +concatenate the slices (.img files) together to create your desired hard +disk image. For example, if you want to create a hard disk image that +has slices for CP/M 2.2, CP/M 3, and WordStar in the hd512 format, you would use +the command line of your modern computer to create the final image: + +Windows: + +`COPY /B hd512_cpm22.img + hd512_cpm3.img + hd512_ws hd.img` + +Linux/MacOS: + +`cat hd512_cpm22.img hd512_cpm3.img hd512_ws >hd.img` + +**NOTE:** For the hd1k disk layout, you **must** prepend the +prefix file called hd1k_prefix.dat which contains the required +partition table. So, for an hd1k layout you would use the following: + +Windows: + +`COPY /B hd1k_prefix.dat + hd1k_cpm22.img + hd1k_cpm3.img + hd1k_ws hd.img` + +Linux/MacOS: + +`cat hd1k_prefix.dat hd1k_cpm22.img hd1k_cpm3.img hd1k_ws >hd.img` + +In all of the examples above, the resulting file (hd.img) would now be +written to your hard disk media and would be ready to use in a RomWBW +system. + +If you wish to further customize or create new disk image definitions, +please refer to the ReadMe.txt file in the Source/Images directory. + +#### Writing Hard Disk Images + +Once you have chosen a combo hard disk image file or prepared your own +custom hard disk image file, it will need to be written to the media +using your modern computer. Note that you **do not** run `CLRDIR` or +`SYSCOPY` on the slices that contain the data. When using this method, +the disk will be partitioned and setup with 1 or more slices containing +ready-to-run bootable operating systems. + +To write a hard disk image file onto your actual media (actual hard +disk or CF/SD Card), you need to use an image writing utility on your +modern computer. Your modern computer will need to have an appropriate +interface or slot that accepts the media. To actually copy the image, +you can use the `dd` command on Linux or MacOS. On Windows, in the +"Tools" directory of the distribution, there is an application called +Win32DiskImager. In all cases, the image file should be written to the +media starting at the very first block or sector of the media. + +You are not limited to the number of slices that are contained in the +image that you write to your hard disk media. You can use additional +slices as long your media has room for them. However, writing the disk +image will not initialize the additional slices. If these additional +slices were previously initialized, they will not be corrupted when you +write the new image and will still contain their previous contents. If +the additional slices were not previously initialized, you can use +`CLRDIR` to do so and optionally `SYSCOPY` if you want them to be +bootable. + +To be entirely clear, writing a disk image file to your hard disk media +will overwrite an pre-existing partition table and the number of slices +that your image file contains. It will not overwrite or corrupt slices +beyond those in the image file. As a result, you can use additional +slices as a place to maintain your personal data because these slices +will survive re-imaging of the media. If you setup a FAT partition +on your media, it will also survive the imaging process. + +**WARNING**: In order for your additional slices and/or FAT partition to +survive re-imaging, you **must** follow these rules: + +* Do not modify the partition table of the media using FDISK80 or any + other partition management tools. +* Ensure that your hard disk image file uses the same disk layout + approach (hd512 or hd1k) as previously used on the media. + +Once you have copied the image onto the hard disk media, you can +move the media over to your RomWBW system. You can then boot to the +operating system slices by specify "." at the +RomWBW Boot Loader command prompt. + +## In-situ Disk Preparation + +If you do not wish to use the pre-built disk images, it is entirely +possible to setup your disks manually and transfer contents to them. + +In this scenario, you will initialize the disk media entirely from +your RomWBW system. So, you need to start by inserting the disk +media, booting RomWBW, and confirming that the media is being +recognized. If RomWBW recognizes the media, it will indicate this +in the boot messages even though the media has not yet been prepared +for use. + +The following instructions are one way to proceed. This does not mean +to imply it is the only possible way. Also, note that RAM/ROM disk +media is prepared automatically. ROM disks are part of the ROM image +and RAM disks are initialized when an operating system is started. + +Start by booting RomWBW and launching either CP/M 2.2 or Z-System +from ROM using the Boot Loader 'C' or 'Z' commands respectively. You +can now use the tools on the ROM disk to prepare your disks. Note +that you will see the operating system assign disks/slices to +drives even though the disks/slices are not yet initialized. This is +normal and does not mean the disks/slices are ready to use. + +Preparation of floppy disk media is very simple. The floppy disk must +be physically formatted as discussed in [Floppy Disks] previously using +`FDU`. If a floppy is already physically formatted, you can wipe out +it's contents (make it empty again) by running `CLRDIR` on it. You can +confirm a floppy disk is ready for content by simply running a `DIR` +command on it. The `DIR` command should complete without error and +should list no files. At this point, you can proceed to copy files to +the floppy disk and (optionally) make the floppy bootable using +`SYSCOPY`. + +The rest of this section will cover preparation of hard disk media. To +start, it is critical that you decide which disk layout approach to use +(either hd512 or hd1k). Review the [Hard Disk Layouts] section if you +are not sure. + +#### Partition Setup + +Since the disk layout is determined by the existence (or lack) of +a RomWBW partition, you must start by running `FDISK80`. When FDISK80 +starts, enter the disk unit number of the new media. At this point, +use the 'I' command to initialize (reset) the partition table to an +empty state. If you are going to use the hd512 layout, then use 'W' to +write the empty table to the disk and exit. Remember that the lack of a +partition for RomWBW implies the legacy (hd512) layout. + +If you are going to use an hd1k layout, then you must create a partition +for the RomWBW CP/M slices. The partition can be placed anywhere you +want and can be any size >= 8MB. Keeping the size of the partition to +increments of 8MB makes sense. The partition type **must** be set to +'2e'. The typical location for the RomWBW partition is at 1MB with a +size of 512MB (64 slices). Below is an example of creating a RomWBW +partition following these guidelines. + +``` +FDISK80 for RomWBW, UNA, Mini-M68k, KISS-68030, SBC-188 ---- + Version 1.1-22 created 7-May-2020 + (Running under RomWBW HBIOS) + +HBIOS unit number [0..11]: 4 +Capacity of disk 4: ( 4G) 7813120 Geom 77381010 +Nr ---Type- A -- Start End LBA start LBA count Size + 1 00 *** empty *** + 2 00 *** empty *** + 3 00 *** empty *** + 4 00 *** empty *** +>>i +>>n +New partition number: 1 +Starting Cylinder (default 0): 1Mb +Ending Cylinder (or Size= "+nnn"): +512Mb +>>t +Change type of partition number: 1 +New type (in hex), "L" lists types: 2e +>>p +Nr ---Type- A -- Start End LBA start LBA count Size + 1 RomWBW 2e 8:0:1 1023:15:16 2048 1048576 512M + 2 00 *** empty *** + 3 00 *** empty *** + 4 00 *** empty *** +>>w +Do you really want to write to disk? [N/y]: y +Okay +FDISK exit. +``` + +At this point, it is best to restart your system to make sure that +the operating system is aware of the partition table updates. Start +CP/M 2.2 or Z-System from ROM again. + +You are now ready to initialize the individual slices of your hard disk +media. On RomWBW, slice initialization is done using the CLRDIR +application. Since the CLRDIR application works on OS drive letters, +you must pay attention to how the OS drive letters are mapped to your +disk devices which is listed when the OS starts. Let's assume that C: +has been assigned to slice 0 of the disk you are initializing. You +would use `CLRDIR C:` to initialize C: and prepare it hold files. Note +that CLRDIR will prompt you for confirmation and you must respond with a +**capital** 'Y' to confirm. + +After CLRDIR completes, the slice should be ready to use by the operating +system via the drive letter assigned. Start by using the `DIR` command +on the drive (`DIR C:`). This should return without error, but list +no files. Next, use the `STAT` command to confirm that the disk is +using the layout you intended. For example, use `STAT C:DSK:` and +look at the number of "32 Byte Directory Entries". It should say +512 for a legacy (hd512) disk layout and 1024 for a modern (hd1024) +disk layout. + +Assuming you want to use additional slices, you should initialize them +using the same process. You may need to reassign OS drive letters to +access some slices that are beyond the ones automatically assigned. +You can use the `ASSIGN` command to handle this. + +Once you have your slice(s) initialized, you can begin transferring +files to the associated drive letters. Refer to the [Transferring +Files] section for options to do this. If you want to make a slice +bootable, you will need to use `SYSCOPY` to setup the system track(s) +of the slice. The use of `SYSCOPY` depends on the operating system +and is described in the [Operating Systems] section of this document. + +As an example, let's assume you want to setup C: as a bootable +Z-System disk and add to it all the files from the ROM disk. To +setup the system track you would use: + +``` +B>SYSCOPY C:=B:ZSYS.SYS + +SYSCOPY v2.0 for RomWBW CP/M, 17-Feb-2020 (CP/M 2 Mode) +Copyright 2020, Wayne Warthen, GNU GPL v3 + +Transfer system image from B:ZSYS.SYS to C: (Y/N)? Y +Reading image... Writing image... Done +``` + +Then, to copy all of the files from the ROM disk to C:, you could use +the `COPY` command as shown below. In this example, the list of files +being copied has been truncated. + +``` +B>copy *.* m: +COPY Version 1.73 (for ZSDOS) 2 Jul 2001 +Copying B0:????????.??? to M0: + -> ASM .COM..Ok Verify..Ok + -> ASSIGN .COM..Ok Verify..Ok + -> CLRDIR .COM..Ok Verify..Ok + -> COMPARE .COM..Ok Verify..Ok + -> COPY .COM..Ok Verify..Ok + -> CPM .SYS..Ok Verify..Ok + 0 Errors +``` + +Once this process succeeds, you will be able to boot directly to the +disk slice from the boot loader prompt. See the instructions in +[Starting Operating Systems from Disk] for details on this. + +# Operating Systems + +One of the primary goals of RomWBW is to expose a set of generic +hardware functions that make it easy to adapt operating systems to +any hardware supported by RomWBW. As a result, there are now 8 +operating systems that have been adapted to run under RomWBW. The +adaptations are identical for all hardware supported by RomWBW +because RomWBW hides all hardware specifics from the operating system. + +By design, the operating systems provided with RomWBW are original and +unmodified from their original distribution. Patches published by the +authors are generally included or applied. The various enhancements +RomWBW provides (such as hard disk slices) are implemented entirely +within the system adaptation component of each operating system (e.g., +CP/M CBIOS). As a result, each operating system should function +exactly as documented by the authors and retain maximum compatibility +with original applications. + +Note that all of the operating systems included with RomWBW support the +same basic filesystem format from DRI CP/M 2.2 (except for p-System). As +a result, a formatted filesystem will be accessible to any operating +system. The only possible issue is that if you turn on date/time +stamping using the newer OSes, the older OSes will not understand this. +Files will not be corrupted, but the date/time stamps will not be +maintained. + +The following sections briefly describe the operating system options +currently available and brief operating notes. + +## Digital Research CP/M 2.2 + +This is the most widely used variant of the Digital Research +operating systems. It has the most basic feature set, but is +essentially the compatibility metric for all other CP/M-like +operating systems including those listed below. + +If you are new to the CP/M world, I would recommend using this CP/M +variant to start with simply because it is the most stable and you are +less likely to encounter compatibility issues. + +#### Documentation + +* [CPM Manual]($doc_root$/CPM Manual.pdf) + +#### Boot Disk + +To make a bootable CP/M disk, use the RomWBW `SYSCOPY` tool +to place a copy of the operating system on the boot track of +the disk. The RomWBW ROM disk has a copy of the boot track +call "CPM.SYS". For example: + +`SYSCOPY C:=B:CPM.SYS` + +#### Notes + +* You can change media, but it must be done while at the OS + command prompt and you **must** warm start CP/M by pressing + ctrl-C. This is a CP/M 2.2 constraint and is well documented + in the DRI manual. + +* `SUBMIT.COM` has been patched per DRI to always place submit + files on A:. This ensures the submitted file will always be + properly executed. + +* The original versions of DDT, DDTZ, and ZSID used the RST 38 + vector which conflicts with interrupt mode 1 use of this vector. + The DDT, DDTZ, and ZSID applications in RomWBW have been modified + to use RST 30 to avoid this issue. + +* Z-System applications will not run under CP/M 2.2. For example, + the `LDDS` date stamper will not work. + +## Z-System + +Z-System is the most popular non-DRI CP/M workalike "clone" which is generally +referred to as Z-System. Z-System is intended to be an enhanced +version of CP/M and should run all CP/M 2.2 applications. It is +optimized for the Z80 CPU (as opposed to 8080 for CP/M) and has some +significant improvements such as date/time stamping of files. + +Z-System is a somewhat ambiguous term because there are multiple +generations of this software. RomWBW Z-System is a combination of both +ZCPR-DJ (the CCP) and ZSDOS 1.1 (the BDOS) when referring to Z-System. +The latest version of Z-System (ZCPR 3.4) is also provided with RomWBW +via the NZ-COM adaptation (see below). + +#### Documentation + +* [ZCPR Manual]($doc_root$/ZCPR Manual.pdf) +* [ZCPR-DJ]($doc_root$/ZCPR-DJ.doc) +* [ZSDOS Manual]($doc_root$/ZSDOS Manual.pdf) + +#### Boot Disk + +To make a bootable Z-System disk, use the RomWBW `SYSCOPY` tool +to place a copy of the operating system on the boot track of +the disk. The RomWBW ROM disk has a copy of the boot track +call "ZSYS.SYS". For example: + +`SYSCOPY C:=B:ZSYS.SYS` + +#### Notes + +* Although most CP/M 2.2 applications will run under Z-System, some + may not work as expected. The best example is PIP which is not aware + of the ZSDOS paths and will fail in some scenarios (use `COPY` instead). + +* Although ZSDOS can recognize a media change in some cases, it will not + always work. You should only change media at a command prompt and be + sure to warm start the OS with a ctrl-C. + +* ZSDOS has a concept of fast relog of drives. This means that after a + warm start, it avoids the overhead of relogging all the disk drives. + There are times when this causes issues. After using tools like CLRDIR + or MAP, you may need to run “RELOG†to get the drive properly + recognized by ZSDOS. + +* RomWBW fully supports both DateStamper and P2DOS file date/time + stamping. You must load the desired stamping module (`LDDS` for + DateStamper or `LDP2D` for P2DOS). This could be automated using + a `PROFILE.SUB` file. Follow the ZSDOS documentation to initialize + a disk for stamping. + +* ZSVSTAMP expects to be running under the ZCPR 3.X command processor. + By default, RomWBW uses ZCPR 1.0 (intentionally, to reduce space usage) + and ZSVSTAMP will just abort in this case. It will work fine if you + implement NZCOM. ZSVSTAMP is included solely to facilitate usage + if/when you install NZCOM. + +* FILEDATE only works with DateStamper style date stamping. If you run + it on a drive that is not initialized for DateStamper, it will complain + `FILEDATE, !!!TIME&.DAT missing`. This is normal and just means that + you have not initialized that drive for DateStamper (using PUTDS). + +* ZXD will handle either DateStamper or P2DOS type date stamping. + However, it **must** be configured appropriately. As distributed, it will + look for P2DOS date stamps. Use ZCNFG to reconfigure it for P2DOS if + that is what you are using. + +* Many of the tools can be configured (using either ZCNFG or DSCONFIG). + The configuration process modifies the actual application file itself. + This will fail if you try to modify one that is on the ROM disk because + it will not be able to update the image. + +* DATSWEEP can be configured using DSCONFIG. However, DSCONFIG itself + needs to be configured first for proper terminal emulation by using + SETTERM. So, run SETTERM on DSCONFIG before using DSCONFIG to configure + DATSWEEP! + +* After using PUTDS to initialize a directory for ZDS date stamping, I + am finding that it is necessary to run RELOG before the stamping + routines will actually start working. + +* Generic CP/M PIP and ZSDOS path searching do not mix well if you use + PIP to copy to or from a directory in the ZSDOS search path. Best to + use COPY from the ZSDOS distribution. + +## NZCOM Automatic Z-System + +NZCOM is a much further refined version of Z-System (ZCPR 3.4). NZCOM +was sold as an enhancement for existing users of CP/M 2.2 or ZSDOS. +For this reason, (by design) NZCOM does not provide a way to boot +directly from disk. Rather, it is loaded after the system boots into +a host OS. On the RomWBW NZCOM disk images, the boot OS is ZSDOS 1.1. +A `PROFILE.SUB` file is included which automatically launches NZCOM +as soon as ZSDOS loads. + +NZCOM is highly configurable. The RomWBW distribution has been +configured in the most basic way possible. You should refer to the +documentation and use `MKZCM` as desired to customize your system. + +NZCOM has substantially more functionality than CP/M or basic +Z-System. It is important to read the "NZCOM Users +Manual.pdf" document in order to use this operating system effectively. + +#### Documentation + +* [NZCOM Users Manual]($doc_root$/NZCOM Users Manual.pdf) + +#### Boot Disk + +Since NZ-COM boots via Z-System, you can make a bootable +NZ-COM disk using `ZSYS.SYS` as described in [Z-System] above. You +will need to add a `PROFILE.SUB` file to auto-start NZ-COM itself. + +#### Notes + +* All of the notes for [Z-System] above generally apply to NZCOM. + +* There is no `DIR` command, you must use `SDZ` instead. If you don't + like this, look into the `ALIAS` facility. + +## Digital Research CP/M 3 + +This is the Digital Research follow-up product to their very popular +CP/M 2.2 operating system. While highly compatible with CP/M 2.2, it +features many enhancements and is not 100% compatible. It makes direct +use of banked memory to increase the user program space (TPA). It also +has a new suite of support tools and help system. + +#### Documentation + +* [CPM3 Users Guide]($doc_root$/CPM3 Users Guide.pdf) +* [CPM3 Command Summary]($doc_root$/CPM3 Command Summary.pdf) +* [CPM3 Programmers Guide]($doc_root$/CPM3 Programmers Guide.pdf) +* [CPM3 System Guide]($doc_root$/CPM3 System Guide.pdf) + +#### Boot Disk + +To create (or update) a CP/M 3 boot drive, you must place `CPMLDR.SYS` on +the system track of the disk. You must also place `CPM3.SYS` and +`CCP.COM` on the target drive as regular files. Do **not** place +CPM3.SYS on the boot track. `CPMLDR.SYS` chain loads `CPM3.SYS` which +must exist as a regular file on the disk. Subsequently, `CPM3.SYS` +loads `CCP.COM`. + +The CP/M 3 boot files are not included on the ROM disk due to +space constraints. You will need to transfer the following files to +your system from the RomWBW distribution directory Binary/CPM3. You +can use XModem for this (or any of the mechanisms in [Transferring +Files]. + +- `CPMLDR.SYS` +- `CPM3.SYS` or `CPM3BNK.SYS` +- `CCP.COM` + +The `CPM3.SYS` boot file is provided in 2 versions. In the Binary/CPM3 +distribution directory, `CPM3.SYS` is the "non-banked" version of +CP/M 3. The `CPM3BNK.SYS` file is the "banked" version of CP/M 3. You +almost certainly want to transfer the banked `CPM3BNK.SYS` version. + +After transferring the boot files to your RomWBW system, you will +need to use `SYSCOPY` to place `CPMLDR.SYS` on the boot track of the +target drive. `CPM3.SYS` and `CCP.COM` can be copied to the target +drive using any standard file copy tool such as `PIP` or `COPY`. + +You do not need to be booted into CP/M 3 to create or update a CP/M 3 +disk. The recommended approach is to boot CP/M 2.2 or Z-System from +ROM. Transfer the boot files to the RAM disk. Then simply copy the +files onto the CP/M 3 disk. Assuming the target CP/M 3 disk is F:, you +can use the following commands to place the files on the target drive: + +``` +SYSCOPY F:=A:CPMLDR.SYS +COPY A:CPM3BNK.SYS F:CPM3.SYS +COPY A:CCP.COM F: +``` + +Note in the example above that `CPM3BNK.SYS` is renamed to `CPM3.SYS` +in the copy command. + +#### Notes + +- The `COPYSYS` command described in the DRI CP/M 3 documentation is + not provided with RomWBW. The RomWBW `SYSCOPY` command is used + instead. + +- Although CP/M 3 is generally able to run CP/M 2.2 programs, this is + not universally true. This is especially true of the utility programs + included with the operating system. For example, the `SUBMIT` + program of CP/M 3 is completely different/incompatible from the + `SUBMIT` program of CP/M 2.2. + +- RomWBW fully supports CP/M 3 file date/time stamping, but this + requires that the disk be properly initialized for it. This process + has not been performed on the CP/M 3 disk image. Follow the + CP/M 3 documentation to complete this process, if desired. + +## ZPM3 + +Simeon Cran's ZPM3 is an interesting combination of the features of both +CP/M 3 and ZCPR3. Essentially, it has the features of and +compatibility with both. + +Due to this dual compatibility, the ZPM3 distribution image contains +most of the standard CP/M 3 files as well as a variety of common ZCPR3 +applications. However, you will notice that user area 0 of the disk has +only a few files. Most of the files are distributed among other user +areas which is standard practice for ZCPR3. Most importantly, you will +see most of the applications in user area 15. The applications can be +executed from any user area because ZPM3 has a default search path that +includes User 15. + +The ZPM3 distribution comes with essentially no utility programs at +all. In addition to the standard CP/M 3 utilities, RomWBW includes +a variety of common ZCPR3 utilities. + +#### Documentation + +ZPM3 has no real documentation. You are expected to understand both +CP/M 3 and ZCPR 3. + +#### Boot Disk + +To create (or update) a ZPM3 boot drive, you must place `ZPMLDR.SYS` on +the system track of the disk. You must also place `CPM3.SYS`, +`ZCCP.COM`, `ZINSTAL.ZPM`, and `STARTZPM.COM` on the target drive as +regular files. Do **not** place CPM3.SYS on the boot track. +`ZPMLDR.SYS` chain loads `CPM3.SYS` which must exist as a regular file +on the disk. Subsequently, `CPM3.SYS` loads `CCP.COM`. + +The CP/M 3 boot files are not included on the ROM disk due to space +constraints. You will need to transfer the following files to your +system from the RomWBW distribution directory Binary/ZPM3. You can use +XModem for this (or any of the mechanisms in [Transferring Files]. + +- `ZPMLDR.SYS` +- `CPM3.SYS` +- `ZCCP.COM` +- `ZINSTAL.ZPM` +- `STARTZPM.COM` + +You may be surprised to see the file called `CPM3.SYS`. This is not a +typo. Although it is called `CPM3.SYS`, it is ZPM and not the same as +`CPM3.SYS` in the CPM3 directory. Also, unlike CP/M 3, ZPM3 is always +banked, so you will not find two versions of the file. `CPM3.SYS` is a +banked implementation of ZPM3. + +After transferring the boot files to your RomWBW system, you will +need to use `SYSCOPY` to place `ZPMLDR.SYS` on the boot track of the +target drive. The remaining boot files can be copied to the target +drive using any standard file copy tool such as `PIP` or `COPY`. + +You do not need to be booted into ZPM3 to create or update a ZPM3 +disk. The recommended approach is to boot CP/M 2.2 or Z-System from +ROM. Transfer the boot files to the RAM disk. Then simply copy the +files onto the ZPM disk. Assuming the target ZPM3 disk is F:, you +can use the following commands to place the files on the target drive: + +``` +SYSCOPY F:=A:ZPMLDR.SYS +COPY A:CPM3.SYS F:CPM3.SYS +COPY A:CCP.COM F: +COPY A:ZINSTAL.ZPM F: +COPY A:STARTZPM.COM F: +``` + +#### Notes + +- The ZPM3 operating system is contained in the file called CPM3.SYS + which is confusing, but this is as intended by the ZPM3 distribution. + I believe it was done this way to make it easier for users to + transition from CP/M 3 to ZPM3. + +## QP/M + +QP/M is another OS providing compatibility with and enhancements +to CP/M 2.2. It is provided as a bootable disk image for RomWBW. + +Refer to the ReadMe.txt file in Source/Images/d_qpm for more details +regarding the RomWBW adaptation and customizations. + +#### Documentation + +* [QP/M 2.7 Installation Guide and Supplements]($doc_root$/qpm27.pdf) +* [QP/M 2.7 Interface Guide]($doc_root$/qdos27.pdf) +* [QP/M 2.7 Features and Facilities]($doc_root$/qcp27.pdf) + +#### Boot Disk + +There is no RomWBW-specific boot disk creation procedure. QP/M +comes with a QINSTALL which is used to install QPM over an existing +CP/M 2 installation or to update an existing QPM disk. `QINSTALL.COM` +is included with the RomWBW distribution. + +#### Notes + +- QPM is not available as source. This implementation was based + on the QPM binary distribution and has been minimally customized + for RomWBW. + +- QINSTALL is used to customize QPM. It is included on the + disk image. You should review the notes in the ReadMe.txt + file in Source/Images/d_qpm before making changes. + +- In addition to the QPM disk image, all of the QPM distribution + files can be found in the RomWBW distribution in the + Source/Images/d_qpm/u0 directory. + +- The QPM disk image is not included as one of the slices on the + RomWBW combo disk image. If you want to include QPM, you can do + so by following the directions in Source/Images/Readme.txt. + +## UCSD p-System + +This is a full implementation of the UCSD p-System IV.0 for Z80 +running under RomWBW. Unlike the OSes above, p-System uses its +own unique filesystem and is not interoperable with other OSes. + +It was derived from the p-System Adaptable Z80 System. Unlike +some other distributions, this implements a native p-System +Z80 Extended BIOS, it does not rely on a CP/M BIOS layer. + +The p-System is provided on a hard disk image file called +psys.img. This must be copied to its own dedicated hard +disk media (CF Card, SD Card, etc.). It is booted by +selecting slice 0 of the corresponding hard disk unit at +the RomWBW Boot Loader prompt. Do not attempt to use +CP/M slices on the same disk. + +Refer to the ReadMe.txt file in Source/pSys for more details. + +#### Documentation + +* [UCSD p-System Users Manual]($doc_root$/UCSD p-System Users Manual.pdf) + +#### Boot Disk + +There is no mechanism provided to create a p-System boot disk from +scratch under RomWBW. This has already been done as part of the +porting process. You must use the provided p-System hard disk image +file which is bootable. + +#### Notes + +* There is no floppy support at this time. + +* The hard disk image contains 6 p-System slices which are + assigned to p-System unit numbers 4, 5, 9, 10, 11, and 12 which + is standard for p-System. Slices 0-5 are assigned + sequentially to these p-System unit numbers and it is + not possible to reassign them. Unit #4 (slice 0) is + bootable and contains all of the p-System distribution + files. Unit #5 (slice 1) is just a blank p-System filesystem. + The other units (9-12) have not been initialized, but this + can be done from Filer using the Zero command. + +* p-System relies heavily on the use of a full screen + terminal. This implementation has been setup to expect + an ANSI or DEC VT-100 terminal or emulator. The screen + output will be garbled if no such terminal or emulator + is used for console output. + +* There is no straightforward mechanism to move files in + and out of p-System. However, the .vol files in Source/pSys + can be read and modified by CiderPress. CiderPress is able + to add and remove individual files. + +## FreeRTOS + +Phillip Stevens has ported FreeRTOS to run under RomWBW. FreeRTOS is +not provided in the RomWBW distribution. FreeRTOS is available under +the +[MIT licence](https://www.freertos.org/a00114.html) and further general +information is available at +[FreeRTOS](https://www.freertos.org/RTOS.html). + +You can also contact Phillip for detailed information on the Z180 +implementation of FreeRTOS for RomWBW. +[feilipu](https://github.com/feilipu) + +# Custom Applications + +The operation of the RomWBW hosted operating systems is enhanced through +several custom applications. You have already read about one of these -- +the `ASSIGN` command. These applications are functional on all of the +OS variants included with RomWBW. + +The applications discussed here are **not** the same as the built-in +ROM applications mentioned previously. These applications run as +commands within the operating systems provided by RomWBW. So, these +commands are only available at an operating system prompt after an +operating system has been loaded. + +All of the RomWBW Custom Applications are built to function under all +of the RomWBW Operating Systems (except for p-System). In general, +the applications will automatically adapt as needed to the currently +running operating system. One exception is `FDU` -- the Floppy Disk +Utility. This application requires that you pick the floppy disk +interface you want to interact with. + +There is more complete documentation of all of these applications in +the related RomWBW manual "$doc_apps$" found in the Doc +directory of the distribution. + +The following custom applications are found on the ROM disk and are, +therefore, globally available. + +| **Application** | **Description | +|-----------------|------------------------------------------------------------------------------------------------------| +| ASSIGN | Add, change, and delete drive letter assignments. Use ASSIGN /? for usage instructions. | +| SYSCOPY | Copy system image to a device to make it bootable. Use SYSCOPY with no parms for usage instructions. | +| MODE | Reconfigures serial ports dynamically. | +| FDU | Format and test floppy disks. Menu driven interface. | +| FORMAT | Will someday be a command line tool to format floppy disks. Currently does nothing! | +| XM | XModem file transfer program adapted to hardware. Automatically uses primary serial port on system. | +| FLASH | Will Sowerbutts' in-situ ROM programming utility. | +| FDISK80 | John Coffman's Z80 hard disk partitioning tool. See documentation in Doc directory. | +| TALK | Direct console I/O to a specified character device. | +| RTC | Manage and test the Real Time Clock hardware. | +| TIMER | Display value of running periodic system timer. | +| CPUSPD | Change the running CPU speed and wait states of the system. | + +Some custom applications do not fit on the ROM disk. They are found on the +disk image files or the individual files can be found in the Binary/Apps +directory of the distribution. + +| **Application** | **Description** | +|-----------------|--------------------------------------------------------------------| +| TUNE | Play .PT2, .PT3, .MYM audio files. | +| FAT | Access MS-DOS FAT filesystems from RomWBW (based on FatFs). | +| INTTEST | Test interrupt vector hooking. | + +# FAT Filesystem + +The FAT filesystem format that originated with MS-DOS has been almost +ubiquitous across modern computers. Virtually all operating systems +now support reading and writing files to a FAT filesystem. For this +reason, RomWBW now has the ability to read and write files on FAT +filesystems. + +This is accomplished by running a RomWBW custom application called `FAT`. +This application understands both FAT filesystems as well as CP/M filesystems. + +* Files can be copied between a FAT filesystem and a CP/M filesystem, + but you cannot execute files directly from a FAT filesystem. +* FAT12, FAT16, and FAT32 formats are supported. +* Long filenames are not supported. Files with long filenames will + show up with their names truncated into the older 8.3 convention. +* A FAT filesystem can be located on floppy or hard disk media. For + hard disk media, the FAT filesystem must be located within a valid + FAT partition. + +## FAT Filesystem Preparation + +In general, you can create media formatted with a FAT filesystem on +your RomWBW computer or on your modern computer. We will only be +discussing the RomWBW-based approach here. + +In the case of a floppy disk, you can use the `FAT` application to +format the floppy disk. For example, if your floppy disk is on RomWBW +disk unit 2, you could use `FAT FORMAT 2:`. This will overwrite the +floppy with a FAT filesystem and all previous contents will be lost. +Once formatted this way, the floppy disk can be used in a floppy drive +attached to a modern computer or it can be used on RomWBW using the +other `FAT` tool commands. + +In the case of hard disk media, it is necessary to have a FAT +partition. If you prepared your RomWBW hard disk media using the +disk image process, then this partition will already be present and +you do not need to recreate it. This default FAT partition is located +at approximately 512MB from the start of your disk and it is 384MB in +size. So, your hard disk media must be 1GB or greater to use this +default FAT partition. + +You can confirm the existence of the FAT partition with `FDISK80` by +using the 'P' command to show the current partition table. Here is an +example of a partition table listing from `FDISK80` that includes the +FAT partition (labelled "FAT16"): + +``` +Capacity of disk 4: ( 4G) 7813120 Geom 77381010 +Nr ---Type- A -- Start End LBA start LBA count Size + 1 RomWBW 2e 8:0:1 1023:15:16 2048 1048576 512M + 2 FAT16 06 1023:0:1 1023:15:16 1050624 786432 384M + 3 00 *** empty *** + 4 00 *** empty *** +``` + +If your hard disk media does not have a FAT partition already defined, +you will need to define one using FDISK80 by using the 'N' command. +Ensure that the location and size of the FAT partition does not +overlap any of the CP/M slice area and that it fits within the size +of your media. + +Once the partition is defined, you will still need to format it. Just +as with a floppy disk, you use the `FAT` tool to do this. If your +hard disk media is on RomWBW disk unit 4, you would use `FAT FORMAT 4:`. +This will look something like this: + +``` +E>fat format 4: + +About to format FAT Filesystem on Disk Unit #4. +All existing FAT partition data will be destroyed!!! + +Continue (y/n)? + +Formatting... Done +``` + +Your FAT filesystem is now ready to use. + +If your RomWBW system has multiple disk drives/slots, you can also just +create a disk with your modern computer that is a dedicated FAT +filesystem disk. You can use your modern computer to format the disk +(floppy, CF Card, SD Card, etc.), then insert the disk in your RomWBW +computer and access if using `FAT` based on its RomWBW unit number. + +## FAT Application Usage + +Complete instructions for the `FAT` application are found in $doc_apps$. +Here, we will just provide a couple of simple examples. Note that the +FAT application is not on the ROM disk because it is too large to +include there. + +The most important thing to understand about the `FAT` application is +how it refers to FAT filesystems vs. CP/M filesystems. It infers this +based on the file specification provided. If you use a specification +like `C:SAMPLE.TXT`, it will use the C: drive of your CP/M operating +system. If you use a specification like `4:SAMPLE.TXT`, it will use +the FAT filesystem on the disk in RomWBW disk unit 4. Basically, if +you start your file or directory specification with a number followed +by a colon, it means FAT filesystem. Anything else will mean CP/M +filesystem. + +Here are a few examples. This first example shows how to get a FAT +directory listing from RomWBW disk unit 4: + +``` +E>fat dir 4: + +Directory of 4: + + +E> +``` + +As you can see, there are currently no files there. Now let's copy +a file from CP/M to the FAT directory: + +``` +E>fat copy sample.txt 4: + +Copying... + +SAMPLE.TXT ==> 4:/SAMPLE.TXT ... [OK] + + 1 File(s) Copied +``` + +If we list the FAT directory again, you will see the file: + +``` +E>fat dir 4: + +Directory of 4: + +01/30/2023 17:50:14 29952 ---A SAMPLE.TXT + +``` + +Now let's copy the file from the FAT filesystem back to CP/M. This +time we will get a warning about overwriting the file. For this +example, we don't want to do that, so we abort and reissue the +command specifying a new filename to use: + +``` +E>fat copy 4:sample.txt e: + +Copying... + +4:/SAMPLE.TXT ==> E:SAMPLE.TXT Overwrite? (Y/N) [Skipped] + + 0 File(s) Copied + +E>fat copy 4:sample.txt e:sample2.txt + +Copying... + +4:/SAMPLE.TXT ==> E:SAMPLE2.TXT ... [OK] + + 1 File(s) Copied +``` + +Finally, let's try using wildcards: + +``` +E>fat copy sample*.* 4: + +Copying... + +SAMPLE.TXT ==> 4:/SAMPLE.TXT Overwrite? (Y/N) ... [OK] +SAMPLE2.TXT ==> 4:/SAMPLE2.TXT ... [OK] + + 2 File(s) Copied +``` + +# CP/NET Networking + +Digital Research created a simple network file sharing system called +CP/NET. This allowed a network server running CP/NOS to host files +available to network attached CP/M computers. Essentially, the host +becomes a simple file sharing server. + +RomWBW disk images include an adaptation of the DRI CP/NET client +software provided by Douglas Miller. RomWBW does not support operation +as a network server itself. However, Douglas has also developed a +Java-based implementation of the DRI network server that can be used to +provide host services from a modern computer. + +Both CP/NET 1.2 and 3.0 clients are provided. Version 1.2 is for use +with CP/M 2.2 and compatible OSes. Version 3.0 is for use with CP/M 3 +and compatible OSes. + +The CP/NET client software provided with RomWBW is specifically for the +MT011 Module developed by Mark T for the RCBus. The client software +interacts directly with this hardware. In a future version of RomWBW, I +hope to add a generic networking API that will allow a greater range of +network hardware to be used. + +To use CP/NET effectively, you will want to review the documentation +provided by Douglas on his +[cpnet-z80 GitHub Project](https://github.com/durgadas311/cpnet-z80). +Additionally, you should consult the DRI documentation which is not +included with RomWBW, but is available on the +[cpnet-z80](https://github.com/durgadas311/cpnet-z80) site. + +Below, I will provide the general steps involved in setting up a +network using MT011 with RomWBW. The examples are all based on +Z-System. + +## CP/NET Client Setup + +The CP/NET client files are included on the RomWBW disk images, but +they are found in user area 4. They are placed there to avoid +confusing anyone that is not specifically trying to run a network +client. + +First, you need to merge the files from user area 4 into user area 0. +After booting into Z-System (disk boot), you can copy the files +using the following command: + +`COPY 4:*.* 0:` + +You will be asked if you want to overwrite `README.TXT`. It doesn't +really matter, but I suggest you do not overwrite it. + +The MT011 Module uses a WizNet network module. At this point, you will +need to configure it for your local network. The definitive guide to +the use of `WIZCFG` is on the +[cpnet-z80](https://github.com/durgadas311/cpnet-z80) site in the +document called "CPNET-WIZ850io.pdf". Here is an example of the commands +needed to configure the WizNet: + +| | | +|------------------------------------|----------------------------------------| +| `wizcfg w n F0` | set CP/NET node id | +| `wizcfg w i 192.168.1.201` | set WizNet IP address | +| `wizcfg w g 192.168.1.1` | set local network gateway IP address | +| `wizcfg w s 255.255.255.0` | set WizNet subnet mask | +| `wizcfg w 0 00 192.168.1.3 31100` | set server node ID, IP address, & port | + +You will need to use values appropriate for your local network. You can +use the command `wiznet w` to display the current values which is +useful to confirm they have been set as intended. + +``` +A>wizcfg w +Node ID: F0H +IP Addr: 192.168.1.201 +Gateway: 192.168.1.1 +Subnet: 255.255.255.0 +MAC: 98:76:B6:11:00:C4 +Socket 0: 00H 192.168.1.3 31100 0 +``` + +You will need to reapply these commands every time you power cycle +your RomWBW computer, so I recommend putting them into a `SUBMIT` file. + +After applying these commands, you should be able ping the WizNet from +another computer on the local network. If this works, then the +client-side is ready. + +## CP/NET Sever Setup + +These instructions will assume you are using Douglas' CpnetSocketServer +as the server on your network. The definitive guide to this software +is also on the [cpnet-z80](https://github.com/durgadas311/cpnet-z80) +site and is called "CpnetSocketServer.pdf". + +The software is a Java application, so it can generally run anywhere +there is a Java runtime environment available. I have normally used +it on a Linux system and have had good results with that. + +You will need to download the application called "CpnetSocketServer.jar" +from the [cpnet-z80](https://github.com/durgadas311/cpnet-z80) site. The +application uses a configuration file. My configuration file is called +"cpnet00.rc" and has these contents: + +``` +cpnetserver_host = 192.168.1.3 +cpnetserver_port = 31100 +cpnetserver_temp = P +cpnetserver_sid = 00 +cpnetserver_max = 16 +cpnetserver_root_dir = /home/wayne/cpnet/root +``` + +You will also need to setup a directory structure with the drive +letters per the documentation. + +To start the server, you would use a command like this: + +`java -jar CpnetSocketServer.jar conf=cpnet00.rc` + +At this point, the server should start and you should see the following: + +``` +CpnetSocketServer v1.3 +Using config in cpnet00.rc +Server 00 Listening on 192.168.1.3 port 31100 debug false +``` + +Your CP/NET server should now be ready to accept client connections. + +## CP/NET Usage + +With both the client and server configured, you are ready to load and +use CP/NET on your RomWBW system. CP/NET documentation is available +on the [cpnet-z80](https://github.com/durgadas311/cpnet-z80) site. +The document is called "dri-cpnet.pdf". + +After booting your computer, you will always need to start CP/NET using +the `CPNETLDR` command. If that works, you can map network drives as +local drives using the `NETWORK` command. The `CPNETSTS` command is +useful for displaying the current status. Here is a sample session: + +``` +A>cpnetldr + + +CP/NET 1.2 Loader +================= + +BIOS E600H 1A00H +BDOS D800H 0E00H +SNIOS SPR D400H 0400H +NDOS SPR C800H 0C00H +TPA 0000H C800H + +CP/NET 1.2 loading complete. + +A>network k:=c:[0] + +A>dir k: +K: TELNET COM : ZDENST COM : CLRDIR COM : RTC COM +K: DDTZ COM : MBASIC COM : XSUBNET COM : NETWORK COM +K: WGET COM : UNCR COM : FLASH COM : PIP COM +K: TIMEZONE COM : COMPARE COM : ZAP COM + +A>cpnetsts + +CP/NET 1.2 Status +================= +Requester ID = F0H +Network Status Byte = 10H +Disk device status: + Drive A: = LOCAL + Drive B: = LOCAL + Drive C: = LOCAL + Drive D: = LOCAL + Drive E: = LOCAL + Drive F: = LOCAL + Drive G: = LOCAL + Drive H: = LOCAL + Drive I: = LOCAL + Drive J: = LOCAL + Drive K: = Drive C: on Network Server ID = 00H + Drive L: = LOCAL + Drive M: = LOCAL + Drive N: = LOCAL + Drive O: = LOCAL + Drive P: = LOCAL +Console Device = LOCAL +List Device = LOCAL +``` + +You will see some additional messages on your server when clients +connect. Here are the messages issued by the server in the above +example: + +``` +Connection from 192.168.1.201 (31100) +Remote 192.168.1.201 is f0 +Creating HostFileBdos 00 device with root dir /home/wayne/cpnet/root +``` + +At this point CP/NET is ready for general use. + +## Network Boot + +It is possible to boot your MT011 equipped RomWBW system directly +from a network server. This means that the operating system will be +loaded directly from the network server and all of your drive letters +will be provided by the network server. + +It is important to understand that the operating system that is loaded +in this case is **not** a RomWBW enhanced operating system. Some +commands (such as the `ASSIGN` command) will not be possible. Also, +you will only have access to drives provided by the network server -- +no local disk drives will be available. + +In order to do this, your MT011 Module must be enhanced with an NVRAM +SPI FRAM mini-board. The NVRAM is used to store your WizNet +configuration values so they do not need to be re-entered every time you +cold boot your system. + +Using the same values from the previous example, you would +issue the WizNet commands: + +``` +wizcfg n F0 +wizcfg i 192.168.1.201 +wizcfg g 192.168.1.1 +wizcfg s 255.255.255.0 +wizcfg 0 00 192.168.1.3 31100 +``` + +Note that the 'w' parameter is now omitted which causes these values to +be written to NVRAM. + +As before, your network server will need to be running +CpnetSocketServer. However, you will need to setup a directory that +contains some files that will be sent to your RomWBW system when the +Network boot is performed. By default the directory will be +`~/NetBoot`. In this directory you need to place the following files: + +* `cpnos-wbw.sys` found in the Binary directory of RomWBW +* `ndos.spr` found in the Source/Images/cpnet12 directory of RomWBW +* `snios.spr` found in the Source/Images/cpnet12 directory of RomWBW + +You also need to make sure CpnetSocketServer is configured with an 'A' +drive and that drive must contain (at an absolute minimum) the following +file: + +* `ccp.spr` found in the Source/Images/cpnet12 directory of RomWBW + +Finally, you need to add the following line to your CpnetSocketServer +configuration file: + +`netboot_default = cpnos-wbw.sys` + +To perform the network boot, you start your RomWBW system normally which +should leave you at the Boot Loader prompt. The 'N' command will +initiate the network boot. Here is an example of what this looks like: + +``` +RCBus [RCZ180_nat_wbw] Boot Loader + +Boot [H=Help]: n + +Loading Network Boot... +MT011 WizNET Network Boot + +WBWBIOS SPR FD00 0100 +COBDOS SPR FA00 0300 +SNIOS SPR F600 0400 +NDOS SPR EA00 0C00 + +58K TPA + +A> +``` + +The CP/M operating system and the CP/NET components have been loaded +directly from the network server. All of your drive letters are +automatically mapped directly to the drive letters configured with +CpnetSocketServer. + +``` +A>cpnetsts + +CP/NET 1.2 Status +================= +Requester ID = F0H +Network Status Byte = 10H +Disk device status: + Drive A: = Drive A: on Network Server ID = 00H + Drive B: = Drive B: on Network Server ID = 00H + Drive C: = Drive C: on Network Server ID = 00H + Drive D: = Drive D: on Network Server ID = 00H + Drive E: = Drive E: on Network Server ID = 00H + Drive F: = Drive F: on Network Server ID = 00H + Drive G: = Drive G: on Network Server ID = 00H + Drive H: = Drive H: on Network Server ID = 00H + Drive I: = Drive I: on Network Server ID = 00H + Drive J: = Drive J: on Network Server ID = 00H + Drive K: = Drive K: on Network Server ID = 00H + Drive L: = Drive L: on Network Server ID = 00H + Drive M: = Drive M: on Network Server ID = 00H + Drive N: = Drive N: on Network Server ID = 00H + Drive O: = Drive O: on Network Server ID = 00H + Drive P: = Drive P: on Network Server ID = 00H +Console Device = LOCAL +List Device = LOCAL +``` + +At this point you can use CP/M and CP/NET normally, but all disk +access will be to/from the network drives. + +# Transferring Files + +Transferring files between your modern computer and your RomWBW +system can be achieved in a variety of ways. The most common of these +are described below. All of these have a certain degree of complexity +and I encourage new users to use the available community forums to +seek assistance as needed. + +## Serial Port Transfers + +RomWBW provides an serial file transfer program called XModem that +has been adapted to run under RomWBW hardware. The program is called +`XM` and is on your ROM disk as well as all of the pre-built disk +images. + +You can type `XM` by itself to get usage information. In general, you +will run `XM` with parameters to indicate you want to send or receive +a file on your RomWBW system. Then, you will use your modern +computers terminal program to complete the process. + +The `XM` application generally tries to detect the hardware you are +using and adapt to it. However, you must ensure that you have a +reliable serial connection. You must also ensure that the speed of +the connection is not too fast for XModem to service. Alternatively, +you can ensure that hardware flow control is working properly. + +There is an odd interaction between XModem and partner terminal +programs that can occur. Essentially, after launching `XM`, you must +start the protocol on your modern computer fairly quickly (usually in +about 20 seconds or so). So, if you do not pick a file on your modern +computer quickly enough, you will find that the transfer completes +about 16K, then hangs. The interaction that causes this is beyond the +scope of this document. + +## Disk Image Transfers + +It is possible to pass disk images between your RomWBW system and +your modern computer. This assumes you have an appropriate media slot +on your modern computer for the media you want to use (CF Card, SD +Card, or floppy drive). + +The general process to get files from your modern computer to a RomWBW +computer is: + +1. Use `cpmtools` on your modern computer to create a RomWBW CP/M +filesystem image. + +2. Insert your RomWBW media (CF Card, SD Card, or floppy disk) in your +modern computer. + +3. Use a disk imaging tool to copy the RomWBW filesystem image onto the +media. + +4. Move the media back to the RomWBW computer. + +This process is a little complicated, but it has the benefit of +allowing you to get a lot of files over to your RomWBW system quickly +and with little chance of corruption. + +The process can be run in reverse to get files from your RomWBW +computer to a modern computer. + +The exact use of these tools is a bit too much for this document, but +the tools are all included in the RomWBW distribution along with +usage documents. + +Note that the build scripts for RomWBW create the default disk images +supplied with RomWBW. It is relatively easy to customize the contents +of the disk images that are part of RomWBW. This is described in more +detail in the Source/Images directory of the distribution. + +## FAT Filesystem Transfers + +The ability to interact with FAT filesystems was covered in [FAT +Filesystem]. This capability means that you can generally use your +modern computer to make an SD Card or CF Card with a standard FAT32 +filesystem on it, then place that media in your RomWBW computer and +access the files. + +When formatting the media on your modern computer, be sure to pick the +FAT filesystem. NTFS and other filesystems will not work. As previously +mentioned, the `FAT` application does not understand long filenames, +only the traditional 8.3 filenames. If you have files on your modern +computer with long filenames, it is usually easiest to rename them on +the modern computer. + +To copy files from your modern computer to your RomWBW computer, start +by putting the disk media with the FAT filesystem in your modern +computer. The modern computer should recognize it. Then copy the files +you want to get to your RomWBW computer onto this media. Once done, +remove the media from your modern computer and insert it in the RomWBW +computer. Finally, use the `FAT` tool to copy the files onto a CP/M +drive. + +This process works just fine in reverse if you want to copy files from a +CP/M filesystem to your modern computer. + +**WARNING**: If you are using media that contains both a FAT partition +and a RomWBW partition, your modern computer may be confused by the +RomWBW partition. In some cases, it will prompt you to format the +RomWBW partition because it doesn't know what it is. You will be +prompted before it does this -- just be careful not to allow it. + +# Customizing RomWBW + +## Startup Command Processing + +Most of the operating systems supported by RomWBW provide a mechanism to +run commands at boot. This is similar to the AUTOEXEC.BAT files from +MS-DOS. + +With the exception of ZPM3 and p-System, all operating systems will look +for a file called `PROFILE.SUB` on the system drive at boot. If it is +found, it will be processed as a standard CP/M submit file. You can read +about the use of the SUBMIT facility in the CP/M manuals included in +the RomWBW distribution. Note that the boot disk must also have a copy +of `SUBMIT.EXE`. + +Note that the automatic startup processing generally requires booting +to a disk drive. Since the ROM disk is not writable, there is no +simple way to add/edit a `PROFILE.SUB` file there. If you want to +customize your ROM and add a `PROFILE.SUB` file to the ROM Disk, it +will work, but is a lot harder than using a boot disk. + +In the case of ZPM3, the file called `STARTZPM.COM` will be run at +boot. To customize this file, you use the ZCPR ALIAS facility. You +will need to refer to ZCPR documentation for more information on the +ALIAS facility. + +p-System has its own startup command processing mechanism that is +covered in the p-System documentation. + +## ROM Customization + +The pre-built ROM images are configured for the basic capabilities of +each platform. Additionally, some of the typical add-on hardware for +each platform will be automatically detected and used. If you want to +go beyond this, RomWBW provides a very flexible configuration +mechanism based on configuration files. Creating a customized ROM +requires running a build script, but it is quite easy to do. + +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 and disk images. There are build +scripts for Windows, Linux, and MacOS to accommodate virtually all +users. All required build tools (compilers, assemblers, etc.) are +included in the distribution, so it is not necessary to setup a build +environment on your computer. + +RomWBW can be built on modern Windows, Linux, or MacOS computers. The +process for building a custom ROM is documented in the ReadMe.txt file +in the Source directory of the distribution. + +For those who are interested in more than basic system customization, +note that all source code is provided (including the operating +systems). Modification of the source code is considered an expert +level task and is left to the reader to pursue. + +Note that the ROM customization process does not apply to UNA. All +UNA customization is performed within the ROM setup script that is +built into the ROM. + +# UNA Hardware BIOS + +John Coffman has produced a new generation of hardware BIOS called +UNA. The standard RomWBW distribution includes its own hardware +BIOS. However, RomWBW can alternatively be constructed with UNA as +the hardware BIOS portion of the ROM. If you wish to use 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. + +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 the 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 +* Terminal Emulation +* Zeta 1, N8, RCBus, Easy Z80, and Dyno Systems +* Some older support boards + +The UNA version embedded in RomWBW is the latest production release +of UNA. RomWBW will be updated with John's upcoming UNA release with +support for VGA3 as soon as it reaches production status. + +Please refer to the +[UNA BIOS Firmware Page](https://www.retrobrewcomputers.org/doku.php?id=software:firmwareos:una:start) +for more information on UNA. + +## UNA Usage Notes + +- At startup, UNA will display a prompt similar to this: + + `Boot UNA unit number or ROM? [R,X,0..3] (R):` + + You generally want to choose 'R' which will then launch the RomWBW + loader. Attempting to boot from a disk using a number at the UNA + prompt will only work for the legacy (hd512) disk format. However, + if you go to the RomWBW loader, you will be able to perform a disk + boot on either disk format. + +- The disk images created and distributed with RomWBW do not have the + correct system track code for UNA. In order to boot to disk under + UNA, you must first use SYSCOPY to update the system track of the + target disk. The UNA ROM disk has the correct system track files + for UNA: `CPM.SYS` and `ZSYS.SYS`. So, you can boot a ROM OS and + then use one of these files to update the system track. + +- Only Z-System and CP/M 2 are available OSes under UNA at this time. + Since NZ-COM launches from CP/M 2, it is usable. p-System is not + usable under UNA. + +- Some of the RomWBW-specific applications are not UNA compatible. + +# Upgrading + +Upgrading to a newer release of RomWBW is essentially just a matter of +updating the ROM chip in your system. If you have spare ROM chips for +your system and a ROM programmer, it is always safest to retain your +existing, working ROM chip and program a new one with the new +firmware. If the new one fails to boot, you can easily return to the +known working ROM. + +Prior to attempting to reprogram your actual ROM chip, you may wish to +"try" the update to ensure it will work on your system. With RomWBW, you +can upload a new ROM image executable and load it from the command +line. For each ROM image file (.rom) in the Binary directory, you will +find a corresponding application file (.com). For example, for +SBC_std.rom, there is also an SBC_std.com file. You can upload the .com +file to your system using XModem, then simply run the .com file. You +will see your system go through the normal startup process just like it +was started from ROM. However, your ROM has not been updated and the +next time you boot your system, it will revert to the system image +contained in ROM. + +## Upgrading via Flash Utility + +If you do not have easy access to a ROM programmer, it is usually +possible to reprogram your system ROM using the FLASH utility from +Will Sowerbutts. This application, called FLASH.COM, can be found on the +ROM drive of any running system. In this case, you would need to +transfer the new ROM image (.rom) over to your system using XModem (or +one of the other mechanisms described in the Transferring Files +section). The ROM image is too large to fit on your RAM drive, +so you will need to transfer it to a larger storage drive. Once the +ROM image is on your system, you can use the FLASH application to +update your ROM. The following is a typical example of transferring +ROM image using XModem and flashing the chip in-situ. + +``` +E>xm r rom.rom + +XMODEM v12.5 - 07/13/86 +RBC, 28-Aug-2019 [WBW], ASCI + +Receiving: E0:ROM.IMG +7312k available for uploads +File open - ready to receive +To cancel: Ctrl-X, pause, Ctrl-X + +Thanks for the upload + +E>flash write rom.rom +FLASH4 by Will Sowerbutts version 1.2.3 + +Using RomWBW (v2.6+) bank switching. +Flash memory chip ID is 0xBFB7: 39F040 +Flash memory has 128 sectors of 4096 bytes, total 512KB +Write complete: Reprogrammed 2/128 sectors. +Verify (128 sectors) complete: OK! +``` + +Obviously, there is some risk to this approach since any issues with the +programming or ROM image could result in a non-functional system. + +To confirm your ROM chip has been successfully updated, restart your +system and boot an operating system from ROM. Do not boot from a disk +device yet. Review the boot messages to see if any issues have +occurred. + +## Upgrading via XModem Flash Updater + +Similar to using the Flash utility, the system ROM can be updated +or upgraded through the ROM based updater utility. This works by +by reprogrammed the flash ROM as the file is being transferred. + +This has the advantage that secondary storage is not required to +hold the new image. + +From the Boot Loader menu select X (Xmodem Flash Updater) and then +U (Begin Update). Then initiate the Xmodem transfer of the .img or +.upd file. + +More information can be found in the ROM Applications document. + +## Post Upgrade System Image and Application Update Process + +Once you are satisfied that the ROM is working well, you will need to +update the system images and RomWBW custom applications on your disk +drives. The system images and custom applications are matched to the +RomWBW ROM firmware in use. If you attempt to boot a disk or run +applications that have not been updated to match the current ROM +firmware, you are likely to have odd problems. + +The simplest way to update your disk media is to just use your modern +computer to overwrite the entire media with the latest disk image of +your choice. This process is described below in the [Disk Images] +section. If you wish to update existing disk media in your system, you +need to perform the following steps. + +If the disk is bootable, you need to update the system image on the +disk using the procedure described in the [Operating Systems] section +of this document. + +Finally, if you have copies of any of the RomWBW custom applications +on your hard disk, you need to update them with the latest copies. The +following applications are found on your ROM disk. Use COPY to copy +them over any older versions of the app on your disk: + +* ASSIGN.COM +* SYSCOPY.COM +* MODE.COM +* FDU.COM +* FORMAT.COM +* XM.COM +* FLASH.COM +* FDISK80.COM +* TALK.COM +* RTC.COM +* TIMER.COM + +For example: `B>COPY ASSIGN.COM C:` + +Some RomWBW custom applications are too large to fit on the ROM disk. +If you are using any of these you will need to transfer them to your +system and then update all copies. These applications are found in +the Binary/Apps directory of the distribution and in all of the disk +images. + +* FAT.COM +* TUNE.COM + +## System Update + +As previously described, a RomWBW ROM contains ROM applications as well +as a ROM disk image. If you are upgrading your ROM with a new patch +level release, you may wish to upgrade just the application portion of +the ROM. This is referred to as a System Update. + +If the system running ROMWBW utilizes the SST39SF040 Flash chip then it +is possible to do a System Update in place of a System Upgrade in some +cases. A System Update would involve only updating the BIOS, ROM +applications and ROM-hosted operating systems. + +A System Update may be more favorable than a System Upgrade in cases +such as: + + - Overwriting of the ROM drive contents is not desired. + - Temporary disk space is unavailable to hold a full ROM image. + - To reduce the time taken to transfer and flash a full ROM. + - Configuration changes are only minor and do not impact disk + applications. + +The RomWBW build process generates a system update file along with +the normal ROM image and can be identified by the extension ".upd". It +will be 128Kb in size. In comparison the normal ROM image will have +the extension ".rom" and be 512Kb or 1024Kb in size. + +Transferring and flashing the System Update is accomplished in the same +manner as described above in [Upgrading via Flash Utility] with the +required difference being that the flash application needs to be +directed to complete a partial flash using the /P command line switch. + +`E>FLASH WRITE ROM.UPD /P` + +# Acknowledgments + +I want to acknowledge that a great deal of the code and inspiration +for RomWBW has been provided by or derived from the work of others +in the RetroBrew Computers Community. I sincerely appreciate all of +their contributions. The list below is probably missing many names -- +please let me know if I missed you! + +* Andrew Lynch started it all when he created the N8VEM Z80 SBC + which became the first platform RomWBW supported. Some of his + original code can still be found in RomWBW. + +* Dan Werner wrote much of the code from which RomWBW was originally + derived and he has always been a great source of knowledge and + advice. + +* Douglas Goodall contributed code, time, testing, and advice in "the + early days". He created an entire suite of application programs to + enhance the use of RomWBW. Unfortunately, they have become unusable + due to internal changes within RomWBW. As of RomWBW 2.6, these + applications are no longer provided. + +* Sergey Kiselev created several hardware platforms for RomWBW + including the very popular Zeta. + +* David Giles created support for the Z180 CSIO which is now included + SD Card driver. + +* Phil Summers contributed the Forth and BASIC adaptations in ROM, the + AY-3-8910 sound driver, DMA support, and a long list of general code + and documentation enhancements. + +* Ed Brindley contributed some of the code that supports the RCBus + platform. + +* Spencer Owen created the RC2014 series of hobbyist kit computers + which has exponentially increased RomWBW usage. Some of his kits + include RomWBW. + +* Stephen Cousins has likewise created a series of hobbyist kit + computers at Small Computer Central and is distributing RomWBW + with many of them. + +* Alan Cox has contributed some driver code and has provided a great + deal of advice. + +* The CP/NET client files were developed by Douglas Miller. + +* Phillip Stevens contributed support for FreeRTOS. + +* Curt Mayer contributed the original Linux / MacOS build process. + +* UNA BIOS and FDISK80 are the products of John Coffman. + +* FLASH4 is a product of Will Sowerbutts. + +* CLRDIR is a product of Max Scane. + +* Tasty Basic is a product of Dimitri Theulings. + +* Dean Netherton contributed the sound driver interface and + the SN76489 sound driver. + +* The RomWBW Disk Catalog document was produced by Mykl Orders. + +Contributions of all kinds to RomWBW are very welcome. + +# Licensing + +RomWBW 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. + +RomWBW 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 RomWBW. If not, see . + +Portions of RomWBW were created by, contributed by, or derived from +the work of others. It is believed that these works are being used +in accordance with the intentions and/or licensing of their creators. + +If anyone feels their work is being used outside of its intended +licensing, please notify: + +> $doc_author$ \ +> [$doc_authmail$](mailto:$doc_authmail$) + +RomWBW is an aggregate work. It is composed of many individual, +standalone programs that are distributed as a whole to function as +a cohesive system. Each program may have its own licensing which +may be different from other programs within the aggregate. + +In some cases, a single program (e.g., CP/M Operating System) is +composed of multiple components with different licenses. It is +believed that in all such cases the licenses are compatible with +GPL version 3. + +RomWBW encourages code contributions from others. Contributors +may assert their own copyright in their contributions by +annotating the contributed source code appropriately. Contributors +are further encouraged to submit their contributions via the RomWBW +source code control system to ensure their contributions are clearly +documented. + +All contributions to RomWBW are subject to this license. + +# Getting Assistance + +The best way to get assistance with RomWBW or any aspect of the +RetroBrew Computers projects is via one of the community forums: + +* [RetroBrew Computers Forum](https://www.retrobrewcomputers.org/forum/) +* [RC2014 Google Group](https://groups.google.com/forum/#!forum/rc2014-z80) +* [retro-comp Google Group](https://groups.google.com/forum/#!forum/retro-comp) + +Submission of issues and bugs are welcome at the +[RomWBW GitHub Repository](https://github.com/wwarthen/RomWBW). + +Also feel free to email $doc_author$ at [$doc_authmail$](mailto:$doc_authmail$). + +# Appendixes + +`\clearpage`{=latex} + +## Appendix A - Pre-built ROM Images + +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. + +By default, RomWBW will use the first available character device it +discovers for the initial console. Serial devices are scanned in +the following order: + +#. ASCI: Zilog Z180 CPU Built-in Serial Ports +#. Z2U: Zilog Z280 CPU Built-in Serial Ports +#. UART: 16C550 Family Serial Interface +#. DUART: SCC2681 or compatible Dual UART +#. SIO: Zilog Serial Port Interface +#. ACIA: MC68B50 Asynchronous Communications Interface Adapter + +In some cases, support for multiple hardware components with potentially +conflicting resource usage are handled by a single ROM image. It is up +to the user to ensure that no conflicting hardware is in use. + +The RomWBW `TUNE` application will detect an AY-3-8910/YM2149 +Sound Module regardless of whether support for it is included in +the RomWBW HBIOS configuration. + +`\clearpage`{=latex} + +### RetroBrew Z80 SBC + +| | | +|-------------------|---------------| +| ROM Image File | SBC_std.rom | +| Console Baud Rate | 38400 | +| Interrupts | None | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 8.000 MHz assumed + - Hardware auto-detected: + - Onboard DS1302 RTC + - Onboard UART Serial Adapter + - Onboard PPIDE Hard Disk Interface + - Zilog Peripherals SIO Serial Interface + - CVDU Display Adapter + - VGA3 Display Adapter + - DiskIO V3 Floppy Disk Controller w/ 3.5" HD Drives + - PropIO Video, Keyboard, & SD Card + - 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. + +`\clearpage`{=latex} + +### RetroBrew Z80 SimH + +| | | +|-------------------|---------------| +| ROM Image File | SBC_simh.rom | +| Console Baud Rate | 38400 | +| Interrupts | Mode 1 | + + - System timer is generated by SimH + - Hardware auto-detected: + - SimH emulated 8250 Serial Adapter + - SimH emulated hard disk drives + - SimH RTC + +`\clearpage`{=latex} + +### RetroBrew N8 Z180 SBC + +| | | +|-------------------|---------------| +| ROM Image File | N8_std.rom | +| Console Baud Rate | 38400 | +| Interrupts | Mode 2 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 18.432 MHz assumed + - System timer is generated by Z180 CPU + - Hardware auto-detected: + - Onboard DS1302 RTC + - Onboard Z180 ASCI Serial Ports + - Onboard Floppy Disk Controller w/ 3.5" HD Drives + - Onboard TMS9918 Video Controller + - Onboard PS/2 Keyboard Controller + - Onboard SD Card Interface via CSIO + - Assumes N8 with date code >= 2312 for CSIO interface to SD Card + +`\clearpage`{=latex} + +### Zeta Z80 SBC + +| | | +|-------------------|---------------| +| ROM Image File | ZETA_std.rom | +| Console Baud Rate | 38400 | +| Interrupts | None | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 20.000 MHz assumed + - Hardware auto-detected: + - Onboard DS1302 RTC + - Onboard UART Serial Adapter + - Onboard Floppy Disk Controller w/ 1 3.5" HD Drive + - ParPortProp Video, Keyboard, & SD Card + - If ParPortProp is installed, initial console output is determined + by JP1: + - Shorted: console to on-board serial port + - Open: console to ParPortProp video and keyboard + +`\clearpage`{=latex} + +### Zeta V2 Z80 SBC + +| | | +|-------------------|---------------| +| ROM Image File | ZETA2_std.rom | +| Console Baud Rate | 38400 | +| Interrupts | Mode 2 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 20.000 MHz assumed + - System timer is generated by onboard CTC + - Hardware auto-detected: + - Onboard DS1302 RTC + - Onboard CTC + - Onboard UART Serial Adapter + - Onboard Floppy Disk Controller w/ 1 3.5" HD Drive + - ParPortProp Video, Keyboard, & SD Card + - If ParPortProp is installed, initial console output is determined + by JP1: + - Shorted: console to on-board serial port + - Open: console to ParPortProp video and keyboard + +`\clearpage`{=latex} + +### Mark IV Z180 SBC + +| | | +|-------------------|---------------| +| ROM Image File | MK4_std.rom | +| Console Baud Rate | 38400 | +| Interrupts | Mode 2 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 18.432 MHz assumed + - System timer is generated by Z180 CPU + - Hardware auto-detected: + - Onboard DS1302 RTC + - Onboard Z180 ASCI Serial Ports + - UART Serial Interfaces (CAS, MFP, UART4) + - CVDU Display Adapter + - VGA3 Display Adapter + - Onboard SD Card Interface via CSIO + - Onboard IDE CF Card Interface + - DIDE Floppy Disk Controller w/ 3.5" HD Drives + - DIDE IDE Hard Disk Controller + - PropIO Video, Keyboard, & SD Card + +`\clearpage`{=latex} + +### RCBus Z80 CPU Module + +| | | +|-------------------|---------------| +| ROM Image File | RCZ80_std.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 1 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 7.3728 MHz assumed + - Requires 512K RAM/ROM Module + - Hardware auto-detected: + - DS1302 RTC + - ACIA Serial Interface Module + - SIO Serial Interface Module + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - Serial baud rate is usually determined by hardware for ACIA and + SIO interfaces + +| | | +|-------------------|---------------| +| ROM Image File | RCZ80_kio.rom | +| Console Baud Rate | 38400 | +| Interrupts | Mode 2 | + + - Equivalent to RCZ80_std w/ following modifications: + - KIO-SIO Serial Interface uses KIO port standards + - KIO-CTC generates system timer + - SIO Serial baud rate managed by KIO-CTC + - Use of Interrupt Mode 2 requires proper IEI/IEO configuration + for all peripherals generating interrupts + +`\clearpage`{=latex} + +### RCBus Z180 CPU Module + +| | | +|-------------------|----------------| +| ROM Image Files | RCZ180_ext.rom | +| | RCZ180_nat.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 2 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 18.432 MHz assumed + - System timer is generated by Z180 CPU + - Hardware auto-detected: + - DS1302 RTC + - Z180 ASCI Serial Ports + - SIO Serial Interface Module + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - Specific ROM image determined by memory module used: + - RCZ180_ext - Bank switching on memory module (external of CPU) + - RCZ180_nat - Linear memory module (native CPU bank switching) + - Use of Interrupt Mode 2 requires proper IEI/IEO configuration + for all peripherals generating interrupts + +`\clearpage`{=latex} + +### RCBus Z280 CPU Module + +| | | +|-------------------|----------------| +| ROM Image Files | RCZ280_ext.rom | +| | RCZ280_nat.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 1 (ext) | +| | Mode 3 (nat) | + + - CPU speed is assumed to be 12 MHz (24 MHz oscillator) + - System timer is generated by Z280 CPU + - Hardware auto-detected: + - DS1302 RTC + - Z280 Z2U Serial Ports + - ACIA Serial Interface Module (ext only) + - SIO Serial Interface Module + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - Serial baud rate is usually determined by hardware for ACIA and + SIO interfaces + - Requires 512K RAM/ROM module + - Specific ROM image determined by memory module used: + - RCZ180_ext - Bank switching on memory module (external of CPU) + - RCZ180_nat - Linear memory module (native CPU bank switching) + +`\clearpage`{=latex} + +### Easy Z80 SBC + +| | | +|-------------------|----------------| +| ROM Image File | RCZ80_easy.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 2 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 10.000 MHz assumed + - System timer is generated by onboard CTC + - Hardware auto-detected: + - DS1302 RTC + - Onboard SIO Serial Interface + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - SIO Serial baud rate managed by CTC + +`\clearpage`{=latex} + +### Tiny Z80 SBC + +| | | +|-------------------|----------------| +| ROM Image File | RCZ80_tiny.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 2 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 16.000 MHz assumed + - System timer is generated by onboard CTC + - Hardware auto-detected: + - DS1302 RTC + - Onboard SIO Serial Interface + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - SIO Serial baud rate managed by CTC + +`\clearpage`{=latex} + +### Z80-512K CPU/RAM/ROM Module + +| | | +|-------------------|----------------| +| ROM Image File | RCZ80_skz.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 1 | + + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 7.3728 MHz assumed + - Hardware auto-detected: + - DS1302 RTC + - ACIA Serial Interface Module + - SIO Serial Interface Module + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - Serial baud rate is determined by hardware for ACIA and SIO + interfaces + +`\clearpage`{=latex} + +### Small Computer SC126 Z180 SBC + +| | | +|-------------------|------------------| +| ROM Image Files | SCZ180_sc126.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 2 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 18.432 MHz assumed + - System timer is generated by Z180 CPU + - Hardware auto-detected: + - DS1302 RTC + - Z180 ASCI Serial Ports + - SIO Serial Interface Module + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - Onboard SD Card Interface + - Use of Interrupt Mode 2 requires proper IEI/IEO configuration + for all peripherals generating interrupts + +`\clearpage`{=latex} + +### Small Computer SC130 Z180 SBC + +| | | +|-------------------|------------------| +| ROM Image Files | SCZ180_sc130.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 2 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 18.432 MHz assumed + - System timer is generated by Z180 CPU + - Hardware auto-detected: + - DS1302 RTC + - Z180 ASCI Serial Ports + - SIO Serial Interface Module + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - Onboard SD Card Interface + - Use of Interrupt Mode 2 requires proper IEI/IEO configuration + for all peripherals generating interrupts + +`\clearpage`{=latex} + +### Small Computer SC131 Z180 Pocket Computer + +| | | +|-------------------|------------------| +| ROM Image Files | SCZ180_sc131.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 2 | + + - CPU speed assumed to be 18.432 MHz + - System timer is generated by Z180 CPU + - Hardware auto-detected: + - Interrupt-driven RTC + - Z180 ASCI Serial Ports + - Onboard SD Card Interface + +`\clearpage`{=latex} + +### Small Computer SC140 Z180 CPU Module + +| | | +|-------------------|------------------| +| ROM Image Files | SCZ180_sc140.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 2 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 18.432 MHz assumed + - System timer is generated by Z180 CPU + - Hardware auto-detected: + - DS1302 RTC + - Z180 ASCI Serial Ports + - SIO Serial Interface Module + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - Onboard SD Card Interface + - Use of Interrupt Mode 2 requires proper IEI/IEO configuration + for all peripherals generating interrupts + +`\clearpage`{=latex} + +### Small Computer SC503 Z180 CPU Module + +| | | +|-------------------|------------------| +| ROM Image Files | SCZ180_sc503.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 2 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 18.432 MHz assumed + - System timer is generated by Z180 CPU + - Hardware auto-detected: + - DS1302 RTC + - Z180 ASCI Serial Ports + - SIO Serial Interface Module + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - Onboard SD Card Interface + - Use of Interrupt Mode 2 requires proper IEI/IEO configuration + for all peripherals generating interrupts + +`\clearpage`{=latex} + +### Dyno Z180 SBC + +| | | +|-------------------|----------------| +| ROM Image Files | DYNO0_std.rom | +| Console Baud Rate | 38400 | +| Interrupts | Mode 2 | + + - CPU speed is assumed to be 18.432 MHz + - System timer is generated by Z180 CPU + - Hardware auto-detected: + - BQ4845P RTC + - Z180 ASCI Serial Ports + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - Onboard PPIDE Hard Disk Interface Module + +`\clearpage`{=latex} + +### Nhyodyne Z80 MBC + +| | | +|-------------------|---------------| +| ROM Image File | MBC_std.rom | +| Console Baud Rate | 38400 | +| Interrupts | None | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 8.000 MHz assumed + - System timer is generated by CTC if available + - Hardware auto-detected: + - DS1302 RTC + - Zilog CTC + - Zilog DMA Module + - UART Serial Adapter + - SIO Serial Interface + - LPT Printer Interface + - Zilog Parallel Interface + - CVDU Display Adapter + - TMS9938/58 Display Adapter + - PS/2 Keyboard Interface + - AY-3-8910/YM2149 Sound Module + - Floppy Disk Controller w/ 3.5" HD Drives + - PPIDE Hard Disk Interface + - Interrupts may be enabled in build options + +`\clearpage`{=latex} + +### Rhyophyre Z180 SBC + +| | | +|-------------------|---------------| +| ROM Image File | RPH_std.rom | +| Console Baud Rate | 38400 | +| Interrupts | None | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 18.432 MHz assumed + - System timer is generated by Z180 CPU + - Hardware auto-detected: + - Onboard Z180 ASCI Serial Ports + - Onboard PPIDE CF Interface + - Onboard PS/2 Keyboard Controller + - Interrupts may be enabled in build options + +`\clearpage`{=latex} + +### Z80 ZRC CPU Module + +| | | +|-------------------|--------------------| +| ROM Image Files | RCZ80_zrc.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 1 | + + - CPU speed is detected at startup if DS1302 RTC is active + - Otherwise 14.7456 MHz assumed + - Hardware auto-detected: + - DS1302 RTC + - ACIA Serial Interface Module + - SIO Serial Interface Module + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - Onboard IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - Serial baud rate is usually determined by hardware for ACIA and + SIO interfaces + +`\clearpage`{=latex} + +### Z280 ZZRCC CPU Module + +| | | +|-------------------|--------------------| +| ROM Image Files | RCZ280_zzrc.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 3 | + + - CPU speed is assumed to be 12 MHz (24 MHz oscillator) + - System timer is generated by Z280 CPU + - Hardware auto-detected: + - DS1302 RTC + - Z280 Z2U Serial Ports + - SIO Serial Interface Module + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - Onboard IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - Serial baud rate is usually determined by hardware for ACIA and + SIO interfaces + +`\clearpage`{=latex} + +### Z280 ZZ80MB SBC + +| | | +|-------------------|-------------------| +| ROM Image Files | RCZ280_zz80mb.rom | +| Console Baud Rate | 115200 | +| Interrupts | Mode 3 | + + - CPU speed is assumed to be 12 MHz (24 MHz oscillator) + - System timer is generated by Z280 CPU + - Hardware auto-detected: + - DS1302 RTC + - Z280 Z2U Serial Ports + - SIO Serial Interface Module + - EP Dual UART Serial Interface Module + - WDC Floppy Disk Controller w/ 3.5" HD Drives + - Onboard IDE Hard Disk Interface Module + - PPIDE Hard Disk Interface Module + - Serial baud rate is usually determined by hardware for ACIA and + SIO interfaces + +`\clearpage`{=latex} + +## Appendix B - Device Summary + +The table below briefly describes each of the possible devices that +may be discovered by RomWBW in your system. + +| **ID** | **Type** | **Description** | +|-----------|----------|--------------------------------------------------------| +| ACIA | Char | MC68B50 Asynchronous Communications Interface Adapter | +| ASCI | Char | Zilog Z180 CPU Built-in Serial Ports | +| AY | Audio | AY-3-8910/YM2149 Programmable Sound Generator | +| BQRTC | RTC | BQ4845P Real Time Clock | +| CTC | System | Zilog Clock/Timer | +| CVDU | Video | MC8563-based Video Display Controller | +| DMA | System | Zilog DMA Controller | +| DS1307 | RTC | Maxim DS1307 PCF I2C Real-Time Clock w/ NVRAM | +| DS1501RTC | RTC | Maxim DS1501/DS1511 Watchdog Real-Time Clock | +| DSKY | System | Keypad & Display | +| DSRTC | RTC | Maxim DS1302 Real-Time Clock w/ NVRAM | +| DUART | Char | SCC2681 or compatible Dual UART | +| FD | Disk | 8272 of compatible Floppy Disk Controller | +| GDC | Video | uPD7220 Video Display Controller | +| HDSK | Disk | SIMH Simulator Hard Disk | +| IDE | Disk | IDE/ATA Hard Disk Interface | +| INTRTC | RTC | Interrupt-based Real Time Clock | +| KBD | Kbd | 8242 PS/2 Keyboard Controller | +| KIO | System | Zilog Serial/ Parallel Counter/Timer | +| LPT | Char | Parallel I/O Controller | +| MD | Disk | ROM/RAM Disk | +| MSXKYB | Kbd | MSX Compliant Matrix Keyboard | +| I2C | System | I2C Interface | +| PIO | Char | Zilog Parallel Interface Controller | +| PPIDE | Disk | 8255 IDE/ATA Hard Disk Interface | +| PPK | Kbd | Matrix Keyboard | +| PPPSD | Disk | ParPortProp SD Card Interface | +| PPPCON | Serial | ParPortProp Serial Console Interface | +| PRPSD | Disk | PropIO SD Card Interface | +| PRPCON | Serial | PropIO Serial Console Interface | +| RF | Disk | RAM Floppy Disk Interface | +| RP5C01 | RTC | Ricoh RPC01A Real-Time Clock w/ NVRAM | +| SD | Disk | SD Card Interface | +| SIMRTC | RTC | SIMH Simulator Real-Time Clock | +| SIO | Char | Zilog Serial Port Interface | +| SN76489 | Sound | SN76489 Programmable Sound Generator | +| SPK | Sound | Bit-bang Speaker | +| TMS | Video | TMS9918/38/58 Video Display Controller | +| UART | Char | 16C550 Family Serial Interface | +| USB-FIFO | Char | FT232H-based ECB USB FIFO | +| VDU | Video | MC6845 Family Video Display Controller | +| VGA | Video | HD6445CP4-based Video Display Controller | +| YM | Audio | YM2612 Programmable Sound Generator | +| Z2U | Char | Zilog Z280 CPU Built-in Serial Ports | diff --git a/Source/Doc/Z180 ASCI Baud Rate Options.xlsx b/Source/Doc/Z180 ASCI Baud Rate Options.xlsx index b808a5f9..9ee75209 100644 Binary files a/Source/Doc/Z180 ASCI Baud Rate Options.xlsx and b/Source/Doc/Z180 ASCI Baud Rate Options.xlsx differ diff --git a/Source/Doc/pandoc.css b/Source/Doc/pandoc.css new file mode 100644 index 00000000..dab2decd --- /dev/null +++ b/Source/Doc/pandoc.css @@ -0,0 +1,327 @@ +/* + * I add this to html files generated with pandoc. + */ + +html { + font-size: 100%; + overflow-y: scroll; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} + +body { + color: #444; + font-family: sans-serif; + font-size: 12px; + line-height: 1.7; + padding: 1em; + margin: auto; + max-width: 42em; + background: #fefefe; +} + +a { + color: #0645ad; + text-decoration: none; +} + +a:visited { + color: #0b0080; +} + +a:hover { + color: #06e; +} + +a:active { + color: #faa700; +} + +a:focus { + outline: thin dotted; +} + +*::-moz-selection { + background: rgba(255, 255, 0, 0.3); + color: #000; +} + +*::selection { + background: rgba(255, 255, 0, 0.3); + color: #000; +} + +a::-moz-selection { + background: rgba(255, 255, 0, 0.3); + color: #0645ad; +} + +a::selection { + background: rgba(255, 255, 0, 0.3); + color: #0645ad; +} + +p { + margin: 1em 0; +} + +img { + max-width: 100%; +} + +h1, h2, h3, h4, h5, h6 { + color: #111; + line-height: 125%; + margin-top: 2em; + font-weight: normal; +} + +h4, h5, h6 { + font-weight: bold; +} + +h1 { + font-size: 2.5em; +} + +h2 { + font-size: 2em; +} + +h3 { + font-size: 1.5em; +} + +h4 { + font-size: 1.2em; +} + +h5 { + font-size: 1em; +} + +h6 { + font-size: 0.9em; +} + +blockquote { + color: #666666; + margin: 0; + padding-left: 3em; + border-left: 0.5em #EEE solid; +} + +hr { + display: block; + height: 2px; + border: 0; + border-top: 1px solid #aaa; + border-bottom: 1px solid #eee; + margin: 1em 0; + padding: 0; +} + +pre, code, kbd, samp { + color: #000; + font-family: monospace, monospace; + _font-family: 'courier new', monospace; + font-size: 0.98em; +} + +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +b, strong { + font-weight: bold; +} + +dfn { + font-style: italic; +} + +ins { + background: #ff9; + color: #000; + text-decoration: none; +} + +mark { + background: #ff0; + color: #000; + font-style: italic; + font-weight: bold; +} + +sub, sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +ul, ol { + margin: 1em 0; + padding: 0 0 0 2em; +} + +li p:last-child { + margin-bottom: 0; +} + +ul ul, ol ol { + margin: .3em 0; +} + +dl { + margin-bottom: 1em; +} + +dt { + font-weight: bold; + margin-bottom: .8em; +} + +dd { + margin: 0 0 .8em 2em; +} + +dd:last-child { + margin-bottom: 0; +} + +img { + border: 0; + -ms-interpolation-mode: bicubic; + vertical-align: middle; +} + +figure { + display: block; + text-align: center; + margin: 1em 0; +} + +figure img { + border: none; + margin: 0 auto; +} + +figcaption { + font-size: 0.8em; + font-style: italic; + margin: 0 0 .8em; +} + +table { + margin-bottom: 2em; + border-bottom: 1px solid #ddd; + border-right: 1px solid #ddd; + border-spacing: 0; + border-collapse: collapse; +} + +table th { + padding: .2em 1em; + background-color: #eee; + border-top: 1px solid #ddd; + border-left: 1px solid #ddd; +} + +table td { + padding: .2em 1em; + border-top: 1px solid #ddd; + border-left: 1px solid #ddd; + vertical-align: top; +} + +.author { + font-size: 1.2em; +} + +@media only screen and (min-width: 480px) { + body { + font-size: 14px; + } +} +@media only screen and (min-width: 768px) { + body { + font-size: 16px; + } +} +@media print { + * { + background: transparent !important; + color: black !important; + filter: none !important; + -ms-filter: none !important; + } + + body { + font-size: 12pt; + max-width: 100%; + } + + a, a:visited { + text-decoration: underline; + } + + hr { + height: 1px; + border: 0; + border-bottom: 1px solid black; + } + + a[href]:after { + content: " (" attr(href) ")"; + } + + abbr[title]:after { + content: " (" attr(title) ")"; + } + + .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { + content: ""; + } + + pre, blockquote { + border: 1px solid #999; + padding-right: 1em; + page-break-inside: avoid; + } + + tr, img { + page-break-inside: avoid; + } + + img { + max-width: 100% !important; + } + + @page :left { + margin: 15mm 20mm 15mm 10mm; +} + + @page :right { + margin: 15mm 10mm 15mm 20mm; +} + + p, h2, h3 { + orphans: 3; + widows: 3; + } + + h2, h3 { + page-break-after: avoid; + } +} diff --git a/Source/Fonts/Build.cmd b/Source/Fonts/Build.cmd index cec086aa..d41f7a41 100644 --- a/Source/Fonts/Build.cmd +++ b/Source/Fonts/Build.cmd @@ -8,13 +8,18 @@ set PATH=%TOOLS%\lzsa;%TOOLS%\fonttool;%PATH% echo. echo Preparing compressed font files... -lzsa -f2 -r font8x8u.bin font8x8c.bin -lzsa -f2 -r font8x11u.bin font8x11c.bin -lzsa -f2 -r font8x16u.bin font8x16c.bin +lzsa -f2 -r font8x8u.bin font8x8c.bin || exit /b +lzsa -f2 -r font8x11u.bin font8x11c.bin || exit /b +lzsa -f2 -r font8x16u.bin font8x16c.bin || exit /b -fonttool font8x8u.bin > font8x8u.asm -fonttool font8x11u.bin > font8x11u.asm -fonttool font8x16u.bin > font8x16u.asm -fonttool font8x8c.bin > font8x8c.asm -fonttool font8x11c.bin > font8x11c.asm -fonttool font8x16c.bin > font8x16c.asm +lzsa -f2 -r fontcgau.bin fontcgac.bin || exit /b + +fonttool font8x8u.bin > font8x8u.asm || exit /b +fonttool font8x11u.bin > font8x11u.asm || exit /b +fonttool font8x16u.bin > font8x16u.asm || exit /b +fonttool font8x8c.bin > font8x8c.asm || exit /b +fonttool font8x11c.bin > font8x11c.asm || exit /b +fonttool font8x16c.bin > font8x16c.asm || exit /b + +fonttool fontcgau.bin > fontcgau.asm || exit /b +fonttool fontcgac.bin > fontcgac.asm || exit /b diff --git a/Source/Fonts/Clean.cmd b/Source/Fonts/Clean.cmd index 8712ec61..006ab5e7 100644 --- a/Source/Fonts/Clean.cmd +++ b/Source/Fonts/Clean.cmd @@ -1,6 +1,5 @@ @echo off setlocal - if exist *.asm del *.asm if exist *c.bin del *c.bin diff --git a/Source/Fonts/Makefile b/Source/Fonts/Makefile index c9a06b35..dae4a305 100644 --- a/Source/Fonts/Makefile +++ b/Source/Fonts/Makefile @@ -1,10 +1,9 @@ OBJECTS = \ - font8x8u.asm font8x11u.asm font8x16u.asm \ - font8x8c.asm font8x11c.asm font8x16c.asm + font8x8u.asm font8x11u.asm font8x16u.asm fontcgau.asm \ + font8x8c.asm font8x11c.asm font8x16c.asm fontcgac.asm -OTHERS = font8x8c.bin font8x11c.bin font8x16c.bin +OTHERS = font8x8c.bin font8x11c.bin font8x16c.bin fontcgac.bin -DEST = ../HBIOS TOOLS = ../../Tools include $(TOOLS)/Makefile.inc @@ -24,5 +23,8 @@ font8x11c.bin: font8x11u.bin font8x16c.bin: font8x16u.bin $(BINDIR)/lzsa -f2 -r $< $@ +fontcgac.bin: fontcgau.bin + $(BINDIR)/lzsa -f2 -r $< $@ + %.asm: %.bin $(BINDIR)/bin2asm $< > $@ diff --git a/Source/Fonts/fontcgau.bin b/Source/Fonts/fontcgau.bin new file mode 100644 index 00000000..8f20e538 Binary files /dev/null and b/Source/Fonts/fontcgau.bin differ diff --git a/Source/Fonts/fonts.txt b/Source/Fonts/fonts.txt index 2f720b44..4075bd73 100644 --- a/Source/Fonts/fonts.txt +++ b/Source/Fonts/fonts.txt @@ -1,14 +1,36 @@ Font files for ROMWBW. -There are three fonts associated with ROMWBW supported hardware - ECB-SCG, ECB-CVDU and the ECB-VGA3. - -Name Format Size Board & Display Mode ------------------------------------------------------------------------------------- -font8x8u.bin 8x8 2048 ECB-SCG, ECB-VGA3 (80x60) -font8x11u.bin 8x11 2816 ECB-VGA3 (80x43) -font8x16u.bin 8x16 4096 ECB-CVDU (80x25), ECB-VGA3 (80x24, 80x25, 80x30) - -For inclusion in HBIOS the .bin format files must be convert to assembler .asm format. +8x8: 8x8 cell, mostly IBM CGA, first 16 differ, thin font +8x11: 8x11 cell, possibly VT-100? +8x16: 8x16 cell, IBM MDA +CGA: 8x16 cell, IBM CGA, normal (thick) CGA font, rows 8-15 are unused padding + +There are multiple fonts associated with ROMWBW supported hardware: + + Board Driver Chip + -------- -------- -------- + ECB-SCG tms.asm 9918 + ECB-VDU vdu.asm 6545 + ECB-CVDU cvdu.asm 8563 + ECB-VGA3 vga.asm 6445 + MBC-VDC cvdu.asm 8568 + MBC-VDP tms.asm 9938/9958 + +Name Font Storage Size Board & Display Mode +-------------------------------------------------------------------------------------------- +font8x8u.bin 6x8 8x8 2048 ECB-SCG, ECB-VGA3 (80x60), MBC-VDP +font8x11u.bin 8x11 8x11 2816 ECB-VGA3 (80x43) +font8x16u.bin 8x14 8x16 4096 ECB-CVDU (80x25), ECB-VGA3 (80x24, 80x25, 80x30), MBC-VDC +fontcgau.bin 8x8 8x16 4096 ECB-CVDU (80x25), MBC-VDC + +Notes: + +- The CGA font is roughly equivalent to the 8x8 font, but padded out to 8x16. Scan lines + 8-15 are unused. The CVDU driver (8563 chip) always uses fonts defined in an 8x16 cell. + When the CVDU is configured for use with a CGA monitor, an 8x8 character cell is used, + but the font definition must still be 8x16. The CGA font is used for this. + +For inclusion in HBIOS the .bin format files must be converted to assembler .asm format. This is acheived using the fonttool utility and is completed automatically as part of the build process. i.e. fonts files are converted to .asm format and then copied to the HBIOS directory. diff --git a/Source/Forth/Build.cmd b/Source/Forth/Build.cmd index 08fb735b..59f19957 100644 --- a/Source/Forth/Build.cmd +++ b/Source/Forth/Build.cmd @@ -3,15 +3,13 @@ setlocal set TOOLS=../../Tools -set PATH=%TOOLS%\tasm32;%TOOLS%\zx;%PATH% +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%PATH% set TASMTABS=%TOOLS%\tasm32 -set ZXBINDIR=%TOOLS%/cpm/bin/ -set ZXLIBDIR=%TOOLS%/cpm/lib/ -set ZXINCDIR=%TOOLS%/cpm/include/ +set CPMDIR80=%TOOLS%/cpm/ -zx zsm =camel80.azm -zx link -CAMEL80.BIN=CAMEL80 +zxcc zsm =camel80.azm -/l || exit /b +zxcc link -CAMEL80.BIN[L200]=CAMEL80 || exit /b diff --git a/Source/Forth/Makefile b/Source/Forth/Makefile index 51fbdee2..be6e1607 100644 --- a/Source/Forth/Makefile +++ b/Source/Forth/Makefile @@ -1,6 +1,5 @@ OBJECTS = camel80.bin TOOLS = ../../Tools OTHERS = *.rel -DEST = ../HBIOS include $(TOOLS)/Makefile.inc diff --git a/Source/Forth/camel80.azm b/Source/Forth/camel80.azm index c74af4fc..c1a83e6b 100644 --- a/Source/Forth/camel80.azm +++ b/Source/Forth/camel80.azm @@ -1,15 +1,17 @@ -CIODEV_CONSOLE EQU 0D0h -CIOIN EQU 00h ; CHARACTER INPUT -CIOOUT EQU 01h ; CHARACTER OUTPUT -CIOIST EQU 02h ; CHARACTER INPUT STATUS -BID_BOOT EQU 00h -HB_BNKCALL EQU 0fff9h +CIODEV_CONSOLE EQU 0D0h +CIOIN EQU 00h ; CHARACTER INPUT +CIOOUT EQU 01h ; CHARACTER OUTPUT +CIOIST EQU 02h ; CHARACTER INPUT STATUS +BF_SYSRESET EQU 0F0h ; RESTART SYSTEM +BF_SYSRES_WARM EQU 01h ; WARM START (RESTART BOOT LOADER) + ; THE FOLLOWING NEED TO BE SYNCED WITH STD.ASM SO ROMLDR ; KNOWS WHERE THIS EXECUTES AT FTH_SIZ EQU 1700h FTH_LOC EQU 0200h +HB_LOC EQU 0FD80h ; Listing 2. ; =============================================== @@ -66,6 +68,18 @@ FTH_LOC EQU 0200h ; keywords are being passed in a ; macro. ; b1ackmai1er difficultylevelhigh@gmail.com +; 03-Dec 20 v1.02 Add James Bowmans double +; precision words as per RC2014 +; version. Increase terminal +; input buffer (TIB) size. +; b1ackmai1er difficultylevelhigh@gmail.com +; 22-Jan 21 v1.02 Adjust for revised HBIOS +; proxy size. +; b1ackmai1er difficultylevelhigh@gmail.com +; 07-Sep 21 v1.02 Separate additions. +; 05-Oct 21 v1.02 Add Douglas Beattie Jr.'s +; API call and port read and +; write words. ; =============================================== ; Macros to define Forth headers ; HEAD label,length,name,action @@ -131,9 +145,10 @@ nexthl MACRO ; RELOCATED ENTRY POINT + CSEG .PHASE FTH_LOC -reset: ld hl,0FDFFh ; HBIOS address, rounded down +reset: ld hl,HB_LOC ; HBIOS address, rounded down ld l,0 ; = end of avail.mem (EM) dec h ; EM-100h ld sp,hl ; = top of param stack @@ -148,15 +163,17 @@ reset: ld hl,0FDFFh ; HBIOS address, rounded down jp COLD ; enter top-level Forth word ; Memory map: -; Terminal Input Buffer, 128 bytes + ; FTH_LOC Forth kernel = starts after ROMLDR ; ? h Forth dictionary (user RAM) +; EM-400h Terminal Input Buffer, 512 bytes +; Below user area ; EM-200h User area, 128 bytes ; EM-180h Parameter stack, 128B, grows down ; EM-100h HOLD area, 40 bytes, grows down ; EM-0D8h PAD buffer, 88 bytes ; EM-80h Return stack, 128 B, grows down -; EM End of RAM = start of HBIOS +; EM=HB_LOC End of RAM = start of HBIOS ; See also the definitions of U0, S0, and R0 ; in the "system variables & constants" area. ; A task w/o terminal input requires 200h bytes. @@ -332,10 +349,9 @@ KEY2: DW SAVEKEY,CFETCH,LIT,0,SAVEKEY,CSTORE ;X BYE i*x -- return to CP/M head bye,3,bye,docode - LD A,BID_BOOT ; BOOT BANK - LD HL,0 ; ADDRESS ZERO - CALL HB_BNKCALL ; DOES NOT RETURN - HALT + LD B,BF_SYSRESET ; SYSTEM RESTART + LD C,BF_SYSRES_WARM ; WARM START + JP 0FFF0h ; CALL HBIOS ; STACK OPERATIONS ============================== @@ -1058,13 +1074,21 @@ snext: next INCLUDE camel80d.azm ; CPU Dependencies INCLUDE camel80h.azm ; High Level words +INCLUDE camel80r.azm ; ROMWBW additions +;INCLUDE cameltst.azm ; Test Functions lastword EQU link ; nfa of last word in dict. enddict EQU $ ; user's code starts here ; force padding to page boundary - ds (FTH_SIZ-(enddict-reset)-1) - nop +IF ((enddict-reset) GT FTH_SIZ) + IF2 + FORTH SIZE ERROR + ENDIF +ELSE + ds (FTH_SIZ-(enddict-reset)-1) + nop +ENDIF .DEPHASE END diff --git a/Source/Forth/camel80d.azm b/Source/Forth/camel80d.azm index b2d15fda..8365b8c8 100644 --- a/Source/Forth/camel80d.azm +++ b/Source/Forth/camel80d.azm @@ -23,7 +23,7 @@ ; ; =============================================== ; CAMEL80D.AZM: CPU and Model Dependencies -; Source code is for the Z80MR macro assembler. +; Source code is for the ZSM macro assembler. ; Forth words are documented as follows: ;* NAME stack -- stack description ; Word names in upper case are from the ANS diff --git a/Source/Forth/camel80h.azm b/Source/Forth/camel80h.azm index 85990346..e28466ca 100644 --- a/Source/Forth/camel80h.azm +++ b/Source/Forth/camel80h.azm @@ -39,7 +39,7 @@ ;Z tibsize -- n size of TIB head TIBSIZE,7,TIBSIZE,docon - dw 124 ; 2 chars safety zone + dw 512-2 ; 2 chars safety zone ;X tib -- a-addr Terminal Input Buffer ; HEX 82 CONSTANT TIB CP/M systems: 126 bytes @@ -47,7 +47,7 @@ ; head TIB,3,TIB,docon ; dw 82h head TIB,3,TIB,douser - dw -80h + dw -512 ;Z u0 -- a-addr current user area adrs ; 0 USER U0 @@ -1020,7 +1020,8 @@ DOTS2: DW EXIT DW UINIT,U0,NINIT,CMOVE ; DW LIT,80h,COUNT,INTERPRET DW XSQUOTE - DB 55,'Z80 CamelForth v1.02 25 Jan 1995, ROMWBW 19 Oct 2019' + DB 59,0dh,0ah,0dh,0ah + DB 'Z80 CamelForth v1.02 25 Jan 1995, RomWBW 07 Sep 2021' DB 0dh,0ah DW TYPE,ABORT ; ABORT never returns ; DON'T FORGET TO UPDATE THE BYTE COUNT IF YOU CHANGE THE SIZE OF THE BOOT MSG diff --git a/Source/Forth/camel80r.azm b/Source/Forth/camel80r.azm new file mode 100644 index 00000000..edf33d52 --- /dev/null +++ b/Source/Forth/camel80r.azm @@ -0,0 +1,144 @@ +; LISTING 4. +; +; =============================================== +; CamelForth for the Zilog Z80 +; Copyright (c) 1994,1995 Bradford J. Rodriguez +; +; 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 . + +; Commercial inquiries should be directed to the author at +; 115 First St., #105, Collingwood, Ontario L9Y 4W3 Canada +; or via email to bj@camelforth.com +; +; =============================================== +; CAMEL80R.AZM: ROMWBW additions +; Source code is for the ZSM assembler. +; Forth words are documented as follows: +;* NAME stack -- stack description +; Word names in upper case are from the ANS +; Forth Core word set. Names in lower case are +; "internal" implementation words & extensions. +; =============================================== +; +; DOUBLE PRECISION WORDS ================== +; +;C D. d -- display d signed + head DDOT,2,D.,docolon + DW LESSNUM,DUP,TOR,DABS,NUMS + DW RFROM,SIGN,NUMGREATER,TYPE,SPACE,EXIT + +;X D+ d1 d2 -- d1+d2 Add double numbers + head DPLUS,2,D+,docode + exx + pop bc ; BC'=d2lo + exx + pop hl ; HL=d1hi,BC=d2hi + exx + pop hl ; HL'=d1lo + add hl,bc + push hl ; 2OS=d1lo+d2lo + exx + adc hl,bc ; HL=d1hi+d2hi+cy + ld b,h + ld c,l + next + +;C 2>R d -- 2 to R + head TWOTOR,3,2!>R,docolon + DW SWOP,RFROM,SWOP,TOR,SWOP,TOR,TOR,EXIT + +;C 2R> d -- fetch 2 from R + head TWORFROM,3,2R!>,docolon + DW RFROM,RFROM,RFROM,SWOP,ROT,TOR,EXIT + +TNEGATE: + call docolon + DW TOR,TWODUP,OR,DUP,qbranch,TNEG1,DROP,DNEGATE,lit,1 +TNEG1: + DW RFROM,PLUS,NEGATE,EXIT + +qtneg: + call docolon + DW ZEROLESS,qbranch,qtneg1,TNEGATE +qtneg1: + DW EXIT + +TSTAR: + call docolon + DW TWODUP,XOR,TOR + DW TOR,DABS,RFROM,ABS + DW TWOTOR + DW RFETCH,UMSTAR,lit,0 + DW TWORFROM,UMSTAR + DW DPLUS + DW RFROM + DW qtneg + DW EXIT + +TDIV: + call docolon + DW OVER,TOR,TOR + DW DUP,qtneg + DW RFETCH,UMSLASHMOD + DW ROT,ROT + DW RFROM,UMSLASHMOD + DW NIP,SWOP + DW RFROM,ZEROLESS,qbranch,tdiv1,DNEGATE +tdiv1: + DW EXIT + +;C M*/ d1 n2 u3 -- d=(d1*n2)/u3 double precision mult. div + head MSTARSLASH,3,M*/,docolon + DW TOR,TSTAR,RFROM,TDIV,EXIT +; +; ROMWBW APPLICATION INTERFACE ================== +; +;C SVC ( hl de bc n -- hl de bc af ) +;execute ROMWBW API Call) + head API,3,API,docode + LD A,C + EXX + POP BC + POP DE + POP HL + RST 08 + PUSH HL + PUSH DE + PUSH BC + EXX + PUSH AF + POP BC + next +; +; BYTE INPUT/OUTPUT ================== +; +;C P! ( n p -- ) write byte n to i/o port p + + head PSTORE,2,P!!,docode +;; LD A,C ;save portnum in reg A +;; POP BC ;get datum +;; LD B,C ; xfer datum to reg B +;; LD C,A ;xfer portnum to reg C +;; OUT (C),B ;write byte to I/O port. + POP HL + OUT (C),L + POP BC ; get new TOS + next + +;C P@ ( p -- n ) read byte n from i/o port p + + head PFETCH,2,P@,docode + IN C,(C) ;simple stuff... + next + diff --git a/Source/Forth/cameltst.azm b/Source/Forth/cameltst.azm index ad480ed2..d9f6ca39 100644 --- a/Source/Forth/cameltst.azm +++ b/Source/Forth/cameltst.azm @@ -18,7 +18,7 @@ ; =============================================== ;Z >< u1 -- u2 swap the bytes of TOS - head SWAB,2,><,docode + head SWAB,2,!>!<,docode ld a,b ld b,c ld c,a @@ -45,7 +45,7 @@ next ;Z >HEX c1 -- c2 convert nybble to hex char - head TOHEX,4,>HEX,docode + head TOHEX,4,!>HEX,docode ld a,c sub 0ah jr c,numeric diff --git a/Source/Forth/glossr.txt b/Source/Forth/glossr.txt new file mode 100644 index 00000000..f5c9e8c3 --- /dev/null +++ b/Source/Forth/glossr.txt @@ -0,0 +1,12 @@ + ROMWBW Extensions + +D. d -- display d signed +D+ d1 d2 -- d1+d2 Add double numbers +2>R d -- 2 to R +2R> d -- fetch 2 from R +M*/ d1 n2 u3 -- d=(d1*n2)/u3 + double precision mult. div +API hl de bc n -- hl de bc af + execute ROMWBW API Call +P! n p -- write byte n to i/o port p +P@ p -- n read byte n from i/o port p diff --git a/Source/HBIOS/API.txt b/Source/HBIOS/API.txt index 7b97b0cd..af68ecfe 100644 --- a/Source/HBIOS/API.txt +++ b/Source/HBIOS/API.txt @@ -45,14 +45,42 @@ GET ($F8): BC=Function/Subfunction A=Result E=Serial Unit Count + CIOFN ($01): + BC=Function/Subfunction A=Result + HL=Function Address + DE=Unit Data Address + DIOCNT ($10): BC=Function/Subfunction A=Result E=Disk Unit Count + DIOFN ($11): + BC=Function/Subfunction A=Result + HL=Function Address + DE=Unit Data Address + + RTCCNT ($20): + BC=Function/Subfunction A=Result + E=RTC Unit Count + VDACNT ($40): BC=Function/Subfunction A=Result E=Video Unit Count + VDAFN ($41): + BC=Function/Subfunction A=Result + HL=Function Address + DE=Unit Data Address + + SNDCNT ($50): + BC=Function/Subfunction A=Result + E=Sound Unit Count + + SNDFN ($51): + BC=Function/Subfunction A=Result + HL=Function Address + DE=Unit Data Address + TIMER ($D0): BC=Function/Subfunction A=Result DE:HL=Timer Value (32 bit) @@ -72,9 +100,10 @@ GET ($F8): H=Z80 CPU Variant L=CPU Speed in MHz DE=CPU Speed in KHz + BC=Oscillator Freq in KHz MEMINFO ($F1): - BC=Function/Subfunction A=Result + BC=FuSnction/Subfunction A=Result D=# ROM Banks E=# RAM Banks @@ -83,6 +112,13 @@ GET ($F8): D=BIOS Bank Id E=User Bank Id + CPUSPD ($F3): + BC=Function/Subfunction A=Result + L=Clock Mult (0:Half, 1:Full, 2: Double) + D=Memory Wait States + E=I/O Wait States + + SET ($F9): BC=Function/Subfunction A=Result @@ -99,6 +135,13 @@ SET ($F9): DE=Boot Volume (Disk Unit/Slice) L=Boot Bank Id + CPUSPD ($F3): + BC=Function/Subfunction A=Result + L=Clock Mult (0:Half, 1:Full, 2: Double) + D=Memory Wait States + E=I/O Wait States + + PEEK ($FA): B=Function A=Result D=Bank E=Byte Value @@ -239,6 +282,8 @@ DEVICE ($06): D=Device Type E=Device Number C=Device Attributes + H=Device Mode + L=Base I/O Adr Serial Device Attributes Byte: 7: 0=RS-232, 1=Terminal @@ -303,6 +348,8 @@ DEVICE ($17) D=Device Type (MD, FD, IDE, etc.) E=Device Number (0..n) C=Device Attributes + H=Device Mode + L=Base I/O Adr Report the Device Type (Floppy, IDE, SD, etc.) and Device Number. Call does not perform any I/O and succeeds even if the device is in an error state. diff --git a/Source/HBIOS/Build.cmd b/Source/HBIOS/Build.cmd index d0e084a1..802e6182 100644 --- a/Source/HBIOS/Build.cmd +++ b/Source/HBIOS/Build.cmd @@ -1,5 +1,227 @@ @echo off +setlocal + +if "%1" == "dist" goto :dist + +:: +:: Build [ [ []]] +:: set TOOLS=../../Tools -PowerShell .\Build.ps1 %* +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%PATH% + +set TASMTABS=%TOOLS%\tasm32 + +set CPMDIR80=%TOOLS%/cpm/ + +:: +:: This PowerShell script validates the build variables passed in. If +:: necessary, the user is prmopted to pick the variables. It then creates +:: an include file that is imbedded in the HBIOS assembly (build.inc). +:: It also creates a batch command file that sets environment variables +:: for use by the remainder of this batch file (build_env.cmd). +:: + +PowerShell -ExecutionPolicy Unrestricted .\Build.ps1 %* || exit /b + +:: +:: Below, we process the command file created by the PowerShell script. +:: This sets the environment variables: Platform, Config, ROMName, +:: & CPUType. +:: + +call build_env.cmd + +:: +:: Create a small app that is used to export key build variables of the build. +:: Then run the app to output a file with the variables. Finally, read the +:: file into variables usable in this batch file. +:: + +tasm -t80 -g3 -dCMD hbios_env.asm hbios_env.com hbios_env.lst || exit /b +zxcc hbios_env >hbios_env.cmd +call hbios_env.cmd + +:: +:: Start of the actual build process for a given ROM. +:: + +echo Building %ROMSize%K ROM %ROMName% for Z%CPUType% CPU... + +:: +:: UNA is a special case, check for it and jump if needed. +:: + +if %Platform%==UNA goto :UNA + +:: +:: Bring the previously build font files into this directory +:: + +copy ..\Fonts\font*.asm . || exit /b + +:: +:: Build HBIOS Core (all variants) +:: + +tasm -t%CPUType% -g3 -dROMBOOT hbios.asm hbios_rom.bin hbios_rom.lst || exit /b +tasm -t%CPUType% -g3 -dAPPBOOT hbios.asm hbios_app.bin hbios_app.lst || exit /b +tasm -t%CPUType% -g3 -dIMGBOOT hbios.asm hbios_img.bin hbios_img.lst || exit /b + +:: +:: Build ROM Components +:: + +call :asm dbgmon || exit /b +call :asm romldr || exit /b + +call :asm eastaegg || exit /b +call :asm nascom || exit /b +:: call :asm tastybasic || exit /b +call :asm game || exit /b +call :asm usrrom || exit /b +call :asm updater || exit /b +call :asm imgpad2 || exit /b + +:: +:: Create additional ROM bank images by assembling components into +:: 32K chunks which can be concatenated later. Note that +:: osimg_small is a special case because it is 20K in size. This +:: image is subsequently used to generate the .com loadable file. +:: + +copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_wbw.bin + ..\cpm22\cpm_wbw.bin osimg.bin || exit /b +copy /b ..\Forth\camel80.bin + nascom.bin + ..\tastybasic\src\tastybasic.bin + game.bin + eastaegg.bin + netboot.mod + updater.bin + usrrom.bin osimg1.bin || exit /b +copy /b imgpad2.bin osimg2.bin || exit /b + +copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_wbw.bin osimg_small.bin || exit /b + +:: +:: Inject one byte checksum at the last byte of all 4 ROM bank image files. +:: This means that computing a checksum over any of the 32K osimg banks +:: should yield a result of zero. +:: + +if %ROMSize% gtr 0 ( + for %%f in (hbios_rom.bin osimg.bin osimg1.bin osimg2.bin) do ( + "%TOOLS%\srecord\srec_cat.exe" %%f -Binary -Crop 0 0x7FFF -Checksum_Negative_Big_Endian 0x7FFF 1 1 -o %%f -Binary || exit /b + ) +) + +:: +:: Create final images (.rom, .upd, & .com) +:: The previously created bank images are concatenated as needed. +:: +:: The .rom image is made up of 4 banks followed by the ROM Disk. This +:: is for programming onto a ROM. +:: +:: The .upd image is the same as above, but without the the ROM Disk. +:: This is so you can update just the code portion of your ROM without +:: updating the ROM Disk contents. +:: +:: The .com image is a scaled down version of the ROM that you can run +:: as a standard application under an OS and it will replace your +:: HBIOS on the fly for testing purposes. +:: + +if %ROMSize% gtr 0 ( + copy /b hbios_rom.bin + osimg.bin + osimg1.bin + osimg2.bin + ..\RomDsk\rom%ROMSize%_wbw.dat %ROMName%.rom || exit /b + copy /b hbios_rom.bin + osimg.bin + osimg1.bin + osimg2.bin %ROMName%.upd || exit /b + copy /b hbios_app.bin + osimg_small.bin %ROMName%.com || exit /b +) else ( + copy /b hbios_rom.bin + osimg_small.bin %ROMName%.rom || exit /b + copy /b hbios_rom.bin + osimg_small.bin %ROMName%.upd || exit /b + copy /b hbios_app.bin + osimg_small.bin %ROMName%.com || exit /b +) + +:: +:: Copy results to output directory +:: + +if exist %ROMName%.rom copy %ROMName%.rom ..\..\Binary || exit /b +if exist %ROMName%.upd copy %ROMName%.upd ..\..\Binary || exit /b +if exist %ROMName%.com copy %ROMName%.com ..\..\Binary || exit /b + +goto :eof + +:: +:: UNA specific ROM creation +:: + +:UNA + +:: +:: This process is basically equivalent to the one above, but tailored +:: for the UNA BIOS. +:: + +:: Build ROM components required by UNA +call :asm dbgmon || exit /b +call :asm romldr || exit /b + +:: Create the OS bank +copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_una.bin + ..\cpm22\cpm_una.bin osimg.bin || exit /b + +:: Copy OS Bank and ROM Disk image files to output +copy /b osimg.bin ..\..\Binary\UNA_WBW_SYS.bin || exit /b +copy /b ..\RomDsk\rom%ROMSize%_una.dat ..\..\Binary\UNA_WBW_ROM%ROMSize%.bin || exit /b + +:: Create the final ROM image +copy /b ..\UBIOS\UNA-BIOS.BIN + osimg.bin + ..\UBIOS\FSFAT.BIN + ..\RomDsk\rom%ROMSize%_una.dat %ROMName%.rom || exit /b + +:: Copy to output +copy %ROMName%.rom ..\..\Binary || exit /b + +goto :eof + +:: +:: Simple procedure to assemble a specified component via TASM. +:: + +:asm + +echo. +echo Building %1... +tasm -t80 -g3 -fFF %1.asm %1.bin %1.lst || exit /b + +goto :eof + +:: +:: Build all of the official distribution ROMs +:: + +:dist + +call Build SBC std || exit /b +call Build SBC simh || exit /b +call Build MBC std || exit /b +call Build ZETA std || exit /b +call Build ZETA2 std || exit /b +call Build N8 std || exit /b +call Build MK4 std || exit /b +call Build RCZ80 std || exit /b +call Build RCZ80 kio || exit /b +call Build RCZ80 easy || exit /b +call Build RCZ80 tiny || exit /b +call Build RCZ80 skz || exit /b +:: call Build RCZ80 mt || exit /b +:: call Build RCZ80 duart || exit /b +call Build RCZ80 zrc || exit /b +call Build RCZ80 zrc_ram || exit /b +call Build RCZ180 ext || exit /b +call Build RCZ180 nat || exit /b +call Build RCZ280 ext || exit /b +call Build RCZ280 nat || exit /b +call Build RCZ280 zz80mb || exit /b +call Build RCZ280 zzrc || exit /b +call Build SCZ180 sc126 || exit /b +call Build SCZ180 sc130 || exit /b +call Build SCZ180 sc131 || exit /b +call Build SCZ180 sc140 || exit /b +call Build SCZ180 sc503 || exit /b +call Build DYNO std || exit /b +call Build UNA std || exit /b +call Build RPH std || exit /b + +goto :eof diff --git a/Source/HBIOS/Build.ps1 b/Source/HBIOS/Build.ps1 index ff098d8e..518dbae4 100644 --- a/Source/HBIOS/Build.ps1 +++ b/Source/HBIOS/Build.ps1 @@ -1,9 +1,16 @@ -param([string]$Platform = "", [string]$Config = "", [string]$RomSize = "512", [string]$RomName = "") +param([string]$Platform = "", [string]$Config = "", [string]$ROMName = "") -# -# This PowerShell script performs the heavy lifting in the build of RomWBW. It handles the assembly -# of the HBIOS and then creates the final ROM image imbedding the other components such as the OS -# images, boot loader, and ROM disk image. +# If a PowerShell exception occurs, just stop the script immediately. +$ErrorAction = 'Stop' + +# This PowerShell script is used to prepare the build environment for +# HBIOS. It starts by validating and/or prompting the user for several +# key variables that control the build: Platform, Config, ROM size, and +# optionally an override for the output ROM name. These variables are +# then placed in a generated batch command file allowing them to be +# exposed to the subsequent build steps. Next, it generates a +# small TASM include file that exposes some variables to the subsequent +# assembly process. # # The RomWBW build is heavily dependent on the concept of a hardware "platform" and the associated # "configuration". The build process selects a pair of files that are included in the HBIOS assembly @@ -19,15 +26,18 @@ param([string]$Platform = "", [string]$Config = "", [string]$RomSize = "512", [s # setup mechanism so that multiple configuration are not needed. When building for UNA, the pre-built # UNA BIOS is simply imbedded, it is not built here. # -$PlatformListZ80 = "SBC", "ZETA", "ZETA2", "RCZ80", "EZZ80", "UNA" -$PlatformListZ180 = "N8", "MK4", "RCZ180", "SCZ180", "DYNO" + +$PlatformListZ80 = "SBC", "MBC", "ZETA", "ZETA2", "RCZ80", "UNA" +$PlatformListZ180 = "N8", "MK4", "RCZ180", "SCZ180", "DYNO", "RPH" +$PlatformListZ280 = "RCZ280" # # Establish the build platform. It may have been passed in on the command line. Validate # $Platform and loop requesting a new value as long as it is not valid. The valid platform # names are just hard-coded for now. # -$PlatformList = $PlatformListZ80 + $PlatformListZ180 + +$PlatformList = $PlatformListZ80 + $PlatformListZ180 + $PlatformListZ280 $Prompt = "Platform [" ForEach ($PlatformName in $PlatformList) {$Prompt += $PlatformName + "|"} $Prompt = $Prompt.Substring(0, $Prompt.Length - 1) + "]" @@ -44,6 +54,7 @@ while ($true) # if the requested ConfigFile exists. Config files must be named _.asm where is # the platform name established above and is the value of $Config determined here. # + while ($true) { $PlatformConfigFile = "Config/plt_${Platform}.asm" @@ -56,190 +67,58 @@ while ($true) $Config = (Read-Host -prompt "Configuration").Trim() } -# -# Establish the ROM size (in KB). It may have been passed in on the command line. Validate -# $RomSize and loop requesting a new value as long as it is not valid. The valid ROM sizes -# are just hard-coded for now. The ROM size does nothing more than determine the size of the -# ROM disk portion of the ROM image. -# -while ($true) -{ - if (($RomSize -eq "512") -or ($RomSize -eq "1024")) {break} - $RomSize = (Read-Host -prompt "ROM Size [512|1024]").Trim() -} - # # TASM should be invoked with the proper CPU type. Below, the CPU type is inferred # from the platform. # -if ($PlatformListZ180 -contains $Platform) {$CPUType = "180"} else {$CPUType = "80"} + +$CPUType = "80" +if ($PlatformListZ180 -contains $Platform) {$CPUType = "180"} +if ($PlatformListZ280 -contains $Platform) {$CPUType = "280"} # -# The $RomName variable determines the name of the image created by the script. By default, +# The $ROMName variable determines the name of the image created by the script. By default, # this will be _.rom. Unless the script was invoked with a specified # ROM filename, the name is established below. # -if ($RomName -eq "") {$RomName = "${Platform}_${Config}"} -while ($RomName -eq "") + +if ($ROMName -eq "") {$ROMName = "${Platform}_${Config}"} +while ($ROMName -eq "") { $CP = (Read-Host -prompt "ROM Name [${Config}]").Trim() - if ($RomName -eq "") {$RomName = $Config} + if ($ROMName -eq "") {$ROMName = $Config} } -# If a PowerShell exception occurs, just stop the script immediately. -$ErrorAction = 'Stop' - -# Directories of required build tools (TASM & cpmtools) -$TasmPath = '..\..\tools\tasm32' -$CpmToolsPath = '..\..\tools\cpmtools' - -# Add tool directories to PATH and setup TASM's TABS directory path -$env:TASMTABS = $TasmPath -$env:PATH = $TasmPath + ';' + $CpmToolsPath + ';' + $env:PATH - -# Initialize working variables -$OutDir = "../../Binary" # Output directory for final image file -$RomFmt = "wbw_rom${RomSize}" # Location of files to imbed in ROM disk -$BlankROM = "Blank${RomSize}KB.dat" # An initial "empty" image for the ROM disk of propoer size -$RomDiskFile = "RomDisk.tmp" # Temporary filename used to create ROM disk image -$RomFile = "${OutDir}/${RomName}.rom" # Final name of ROM image -$ComFile = "${OutDir}/${RomName}.com" # Final name of COM image (command line loadable HBIOS/CBIOS) -$ImgFile = "${OutDir}/${RomName}.img" # Final name of IMG image (memory loadable HBIOS/CBIOS image) - -# Select the proper CBIOS to include in the ROM. UNA is special. -if ($Platform -eq "UNA") {$Bios = 'una'} else {$Bios = 'wbw'} - -# List of RomWBW proprietary apps to imbed in ROM disk. -$RomApps = "assign","fdu","format","mode","rtc","survey","syscopy","sysgen","talk","timer","xm","inttest" - -"" -"Building ${RomName} ${ROMSize}KB ROM configuration ${Config} for Z${CPUType}..." -"" - # Current date/time is queried here to be subsequently imbedded in image -$TimeStamp = '"' + (Get-Date -Format 'yyyy-MM-dd') + '"' - -# Function to run TASM and throw an exception if an error occurs. -Function Asm($Component, $Opt, $Architecture=$CPUType, $Output="${Component}.bin", $List="${Component}.lst") -{ - $Cmd = "tasm -t${Architecture} -g3 -e ${Opt} ${Component}.asm ${Output} ${List}" - $Cmd | write-host - Invoke-Expression $Cmd | write-host - if ($LASTEXITCODE -gt 0) {throw "TASM returned exit code $LASTEXITCODE"} -} - -# Function to concatenate two binary files. -Function Concat($InputFileList, $OutputFile) -{ - Set-Content $OutputFile -Value $null - foreach ($InputFile in $InputFileList) - { - Add-Content $OutputFile -Value ([System.IO.File]::ReadAllBytes($InputFile)) -Encoding byte - } -} +$TimeStamp = (Get-Date -Format 'yyyy-MM-dd') # # Since TASM has no mechanism to include files dynamically based on variables, a file # is built on-the-fly here for imbedding in the build process. This file is basically # just used to include the platform and config files. It also passes in some values -# from the build to include in the build. +# from the build to include in the assembly. +# @" ; RomWBW Configured for ${Platform} ${Config}, $(Get-Date -Format "s") ; -#DEFINE TIMESTAMP ${TimeStamp} -; -ROMSIZE .EQU ${ROMSize} +#DEFINE TIMESTAMP "${TimeStamp}" +#DEFINE CONFIG "${Platform}_${Config}" ; #INCLUDE "${ConfigFile}" ; "@ | Out-File "build.inc" -Encoding ASCII -# # Bring over previously assembled binary copy of Forth for later use. -# Copy-Item '..\Forth\camel80.bin' 'camel80.bin' - -# Bring over previously generated font files. -Copy-Item '..\Fonts\font*.asm' '.' - -# Assemble individual components. Note in the case of UNA, there is less to build. -$RomComponentList = "dbgmon", "romldr", "eastaegg", "imgpad" -ForEach ($RomComponentName in $RomComponentList) {Asm $RomComponentName} - -if ($Platform -ne "UNA") -{ - Asm 'hbios' '-dROMBOOT' -Output 'hbios_rom.bin' -List 'hbios_rom.lst' - Asm 'hbios' '-dAPPBOOT' -Output 'hbios_app.bin' -List 'hbios_app.lst' - Asm 'hbios' '-dIMGBOOT' -Output 'hbios_img.bin' -List 'hbios_img.lst' - - Asm 'nascom' - Asm 'tastybasic' - Asm 'game' - Asm 'usrrom' - Asm 'imgpad0' -} - -# -# Once all of the individual binary components have been created above, the final -# ROM image is created by simply concatenating the pieces together as needed. -# -"Building ${RomName} output files..." - -# Build 32K OS chunk containing the loader, debug monitor, and OS images -Concat 'romldr.bin', 'eastaegg.bin','dbgmon.bin', "..\cpm22\cpm_${Bios}.bin", "..\zsdos\zsys_${Bios}.bin" osimg.bin - -# Build second 32K chunk containing supplemental ROM apps (not for UNA) -if ($Platform -ne "UNA") -{ - Concat '..\Forth\camel80.bin', 'nascom.bin', 'tastybasic.bin', 'game.bin', 'imgpad0.bin', 'usrrom.bin' osimg1.bin -} - -# -# Now the ROM disk image is created. This is done by starting with a -# blank ROM disk image of the correct size, then cpmtools is used to -# add the desired files. -# - -"Building ${RomSize}KB ${RomName} ROM disk data file..." - -# Create a blank ROM disk image to create a working ROM disk image -Set-Content -Value ([byte[]](0xE5) * (([int]${RomSize} * 1KB) - 128KB)) -Encoding byte -Path $RomDiskFile - -# Copy all files from the appropriate directory to the working ROM disk image -cpmcp -f $RomFmt $RomDiskFile ../RomDsk/ROM_${RomSize}KB/*.* 0: - -# Add any platform specific files to the working ROM disk image -if (Test-Path "../RomDsk/${Platform}/*.*") -{ - cpmcp -f $RomFmt $RomDiskFile ../RomDsk/${Platform}/*.* 0: -} - -# Add the proprietary RomWBW applications to the working ROM disk image -foreach ($App in $RomApps) -{ - cpmcp -f $RomFmt $RomDiskFile ../../Binary/Apps/$App.com 0: -} - -# Add the CP/M and ZSystem system images to the ROM disk (used by SYSCOPY) -cpmcp -f $RomFmt $RomDiskFile ..\cpm22\cpm_${Bios}.sys 0:cpm.sys -cpmcp -f $RomFmt $RomDiskFile ..\zsdos\zsys_${Bios}.sys 0:zsys.sys - # -# Finally, the individual binary components are concatenated together to produce -# the final images. +# We need to pass the key variables controling the assembly process back +# out to the calling batch file. We do this by generating a small +# batch file which can be invoked by the calling batch file to expose +# the variables. # -if ($Platform -eq "UNA") -{ - Copy-Item 'osimg.bin' ${OutDir}\UNA_WBW_SYS.bin - Copy-Item $RomDiskFile ${OutDir}\UNA_WBW_ROM${ROMSize}.bin - - Concat '..\UBIOS\UNA-BIOS.BIN','osimg.bin','..\UBIOS\FSFAT.BIN',$RomDiskFile $RomFile -} -else -{ - Concat 'hbios_rom.bin','osimg.bin','osimg1.bin','osimg.bin',$RomDiskFile $RomFile - Concat 'hbios_app.bin','osimg.bin' $ComFile - # Concat 'hbios_img.bin','osimg.bin' $ImgFile -} -# Remove the temporary working ROM disk file -Remove-Item $RomDiskFile +@" +set Platform=${Platform} +set Config=${Config} +set ROMName=${ROMName} +set CPUType=${CPUType} +"@ | Out-File "build_env.cmd" -Encoding ASCII diff --git a/Source/HBIOS/Build.sh b/Source/HBIOS/Build.sh index 24abfa41..69c1c1b5 100755 --- a/Source/HBIOS/Build.sh +++ b/Source/HBIOS/Build.sh @@ -3,151 +3,105 @@ # fail on any error set -e -CPMCP=../../Tools/`uname`/cpmcp - -timestamp=$(date +%Y-%m-%d) -#timestamp="2020-02-24" - -if [ $1 == '-d' ] ; then - shift - diffdir=$1 - shift - if [ -f $diffdir/build.inc ] ; then - timestamp=$(grep TIMESTAMP $diffdir/build.inc | awk '{print $3}' | tr -d '\015"') - echo diff build using $timestamp - fi +export ROM_PLATFORM +export ROM_CONFIG +export ROMSIZE +export CPUFAM + +if [ "${ROM_PLATFORM}" == "dist" ] ; then + echo "!!!DISTRIBUTION BUILD!!!" + ROM_PLATFORM="DYNO"; ROM_CONFIG="std"; bash Build.sh + ROM_PLATFORM="MK4"; ROM_CONFIG="std"; bash Build.sh + ROM_PLATFORM="N8"; ROM_CONFIG="std"; bash Build.sh + ROM_PLATFORM="RCZ180"; ROM_CONFIG="ext"; bash Build.sh + ROM_PLATFORM="RCZ180"; ROM_CONFIG="nat"; bash Build.sh + ROM_PLATFORM="RCZ280"; ROM_CONFIG="ext"; bash Build.sh + ROM_PLATFORM="RCZ280"; ROM_CONFIG="nat"; bash Build.sh + ROM_PLATFORM="RCZ280"; ROM_CONFIG="zz80mb"; bash Build.sh + ROM_PLATFORM="RCZ280"; ROM_CONFIG="zzrc"; bash Build.sh +# ROM_PLATFORM="RCZ80"; ROM_CONFIG="mt"; bash Build.sh +# ROM_PLATFORM="RCZ80"; ROM_CONFIG="duart"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="std"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="kio"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="easy"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="tiny"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="skz"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="zrc"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="zrc_ram"; bash Build.sh + ROM_PLATFORM="RPH"; ROM_CONFIG="std"; bash Build.sh + ROM_PLATFORM="SBC"; ROM_CONFIG="std"; bash Build.sh + ROM_PLATFORM="SBC"; ROM_CONFIG="simh"; bash Build.sh + ROM_PLATFORM="MBC"; ROM_CONFIG="std"; bash Build.sh + ROM_PLATFORM="SCZ180"; ROM_CONFIG="sc126"; bash Build.sh + ROM_PLATFORM="SCZ180"; ROM_CONFIG="sc130"; bash Build.sh + ROM_PLATFORM="SCZ180"; ROM_CONFIG="sc131"; bash Build.sh + ROM_PLATFORM="SCZ180"; ROM_CONFIG="sc140"; bash Build.sh + ROM_PLATFORM="SCZ180"; ROM_CONFIG="sc503"; bash Build.sh + ROM_PLATFORM="UNA"; ROM_CONFIG="std"; bash Build.sh + ROM_PLATFORM="ZETA"; ROM_CONFIG="std"; bash Build.sh + ROM_PLATFORM="ZETA2"; ROM_CONFIG="std"; bash Build.sh + exit fi -# positional arguments -platform=$1 -config=$2 -romsize=$3 -romname=$4 - # prompt if no match platforms=($(find Config -name \*.asm -print | \ sed -e 's,Config/,,' -e 's/_.*$//' | sort -u)) -while ! echo ${platforms[@]} | grep -q -w -s "$platform" ; do +while ! echo ${platforms[@]} | grep -q -w -s "${ROM_PLATFORM}" ; do echo -n "Enter platform [" ${platforms[@]} "] :" - read platform + read ROM_PLATFORM done -configs=$(find Config -name ${platform}_\* -print | \ - sed -e 's,Config/,,' -e "s/${platform}_//" -e "s/.asm//") -while ! echo ${configs[@]} | grep -s -w -q "$config" ; do +configs=$(find Config -name ${ROM_PLATFORM}_\* -print | \ + sed -e 's,Config/,,' -e "s/${ROM_PLATFORM}_//" -e "s/.asm//") +while ! echo ${configs[@]} | grep -s -w -q "${ROM_CONFIG}" ; do echo -n "Enter config for $platform [" ${configs[@]} "] :" - read config + read ROM_CONFIG done -configfile=Config/${platform}_${config}.asm -while [ ! '(' "$romsize" = 1024 -o "$romsize" = 512 ')' ] ; do - echo -n "Romsize :" - read romsize -done +CONFIGFILE=Config/${ROM_PLATFORM}_${ROM_CONFIG}.asm -if [ -z "$romname" ] ; then - romname=${platform}_${config} +if [ -z "${ROMNAME}" ] ; then + ROMNAME=${ROM_PLATFORM}_${ROM_CONFIG} fi -echo Building for $romname for $platform $config $romsize -if [ $platform == UNA ] ; then - BIOS=una -else - BIOS=wbw -fi +echo -e "\n\nBuilding $ROM_PLATFORM $ROM_CONFIG\n\n" -Apps=(assign fdu format mode rtc survey syscopy sysgen talk timer xm inttest) +TIMESTAMP=$(date +%Y-%m-%d) -blankfile=Blank${romsize}KB.dat -romdiskfile=RomDisk.tmp -romfmt=wbw_rom${romsize} -outdir=../../Binary +if [ "$1" = "-d" ] ; then + shift + diffdir=$1 + shift + if [ -f $diffdir/build.inc ] ; then + timestamp=$(grep TIMESTAMP $diffdir/build.inc | awk '{print $3}' | tr -d '\015"') + echo diff build using $timestamp + fi +fi -echo "creating empty rom disk of size $romsize in $blankfile" -LANG=en_US.US-ASCII tr '\000' '\345' build.inc -; RomWBW Configured for $platform $config $timestamp -; -#DEFINE TIMESTAMP "$timestamp" +; RomWBW Configured for ${ROM_PLATFORM} ${ROM_CONFIG} ${TIMESTAMP} ; -ROMSIZE .EQU $romsize +#DEFINE TIMESTAMP "${TIMESTAMP}" +#DEFINE CONFIG "${ROM_PLATFORM}_${ROM_CONFIG}" ; -#INCLUDE "$configfile" +#INCLUDE "${CONFIGFILE}" ; EOF -echo "checking prerequisites" -for need in ../CPM22/cpm_$BIOS.bin ../ZSDOS/zsys_$BIOS.bin \ - ../Forth/camel80.bin font8x11c.asm font8x11u.asm font8x16c.asm \ - font8x16u.asm font8x8c.asm font8x8u.asm ; do - if [ ! -f $need ] ; then - echo $need missing - exit 2 - fi -done - -cp ../Forth/camel80.bin . - -make dbgmon.bin romldr.bin eastaegg.bin imgpad.bin - -if [ $platform != UNA ] ; then - make nascom.bin tastybasic.bin game.bin usrrom.bin imgpad0.bin - make hbios_rom.bin hbios_app.bin hbios_img.bin -fi - -echo "Building $romname output files..." - -cat romldr.bin eastaegg.bin dbgmon.bin ../CPM22/cpm_$BIOS.bin ../ZSDOS/zsys_$BIOS.bin >osimg.bin - -if [ $platform != UNA ] ; then - cat camel80.bin nascom.bin tastybasic.bin game.bin imgpad0.bin usrrom.bin >osimg1.bin -fi - -echo "Building ${romsize}KB $romname ROM disk data file..." - -cp $blankfile $romdiskfile +make hbios_env.sh +source hbios_env.sh -echo placing files into $romdiskfile - -for file in $(ls -1 ../RomDsk/ROM_${romsize}KB/* | sort -V) ; do - echo " " $file - $CPMCP -f $romfmt $romdiskfile $file 0: -done +echo Creating ${ROMSIZE}K ROM named ${ROMNAME}.rom -if [ -d ../RomDsk/$platform ] ; then - for file in ../RomDsk/$platform/* ; do - echo " " $file - $CPMCP -f $romfmt $romdiskfile $file 0: - done +export OBJECTS +OBJECTS="${ROMNAME}.rom" +if [ "${ROM_PLATFORM}" != "UNA" ] ; then + OBJECTS+=" ${ROMNAME}.com ${ROMNAME}.upd" fi -echo "adding apps to $romdiskfile" -for i in ${Apps[@]} ; do - set +e - f=$(../../Tools/unix/casefn.sh ../../Binary/Apps/$i.com) - set -e - if [ -z "$f" ] ; then - echo " " $i "not found" - else - echo " " $f - $CPMCP -f $romfmt $romdiskfile $f 0: - fi -done - -echo "copying systems to $romdiskfile" -$CPMCP -f $romfmt $romdiskfile ../CPM22/cpm_$BIOS.sys 0:cpm.sys -$CPMCP -f $romfmt $romdiskfile ../ZSDOS/zsys_$BIOS.sys 0:zsys.sys - -if [ $platform = UNA ] ; then - cp osimg.bin $outdir/UNA_WBW_SYS.bin - cp $romdiskfile $outdir/UNA_WBW_ROM$romsize.bin - cat ../UBIOS/UNA-BIOS.BIN osimg.bin ../UBIOS/FSFAT.BIN $romdiskfile >$romname.rom -else - cat hbios_rom.bin osimg.bin osimg1.bin osimg.bin $romdiskfile >$romname.rom - cat hbios_app.bin osimg.bin > $romname.com - cat hbios_img.bin osimg.bin > $romname.img -fi +#echo OBJECTS=${OBJECTS} -#rm $romdiskfile +make ROM_PLATFORM=${ROM_PLATFORM} ROM_CONFIG=${ROM_CONFIG} ROMSIZE=${ROMSIZE} diff --git a/Source/HBIOS/Clean.cmd b/Source/HBIOS/Clean.cmd index c2194335..432d4166 100644 --- a/Source/HBIOS/Clean.cmd +++ b/Source/HBIOS/Clean.cmd @@ -5,10 +5,13 @@ if exist *.bin del *.bin if exist *.com del *.com if exist *.img del *.img if exist *.rom del *.rom +if exist *.upd del *.upd if exist *.lst del *.lst if exist *.exp del *.exp if exist *.tmp del *.tmp if exist *.mrk del *.mrk if exist *.sys del *.sys if exist build.inc del build.inc -if exist font*.asm del font*.asm \ No newline at end of file +if exist font*.asm del font*.asm +if exist build_env.cmd del build_env.cmd +if exist hbios_env.cmd del hbios_env.cmd diff --git a/Source/HBIOS/Config/DYNO_std.asm b/Source/HBIOS/Config/DYNO_std.asm index f5019f0e..176b9786 100644 --- a/Source/HBIOS/Config/DYNO_std.asm +++ b/Source/HBIOS/Config/DYNO_std.asm @@ -22,9 +22,12 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; #include "cfg_dyno.asm" ; CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP ; Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) @@ -34,6 +37,6 @@ ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) ;ASCI0CFG .SET SER_115200_8N1 ; ASCI 0: SERIAL LINE CONFIG ;ASCI1CFG .SET SER_115200_8N1 ; ASCI 1: SERIAL LINE CONFIG ; -FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) ; PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) diff --git a/Source/HBIOS/Config/EZZ80_std.asm b/Source/HBIOS/Config/EZZ80_std.asm deleted file mode 100644 index ae480bcd..00000000 --- a/Source/HBIOS/Config/EZZ80_std.asm +++ /dev/null @@ -1,31 +0,0 @@ -; -;================================================================================================== -; EASY Z80 STANDARD CONFIGURATION -;================================================================================================== -; -; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE -; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS -; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE -; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. -; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY -; YOUR FILE IN THE BUILD PROCESS. -; -; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. -; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO -; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON -; SETTINGS. -; -; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, -; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING -; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! -; -; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO -; DIRECTORIES ABOVE THIS ONE). -; -#include "cfg_ezz80.asm" -; -CPUOSC .SET 10000000 ; CPU OSC FREQ IN MHZ -; -IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -; -PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) diff --git a/Source/HBIOS/Config/EZZ80_tz80.asm b/Source/HBIOS/Config/EZZ80_tz80.asm deleted file mode 100644 index 93a45e94..00000000 --- a/Source/HBIOS/Config/EZZ80_tz80.asm +++ /dev/null @@ -1,41 +0,0 @@ -; -;================================================================================================== -; EASY Z80 STANDARD CONFIGURATION -;================================================================================================== -; -; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE -; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS -; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE -; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. -; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY -; YOUR FILE IN THE BUILD PROCESS. -; -; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. -; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO -; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON -; SETTINGS. -; -; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, -; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING -; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! -; -; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO -; DIRECTORIES ABOVE THIS ONE). -; -#DEFINE PLATFORM_NAME "TINYZ80" -; -#include "cfg_ezz80.asm" -; -CPUOSC .SET 16000000 ; CPU OSC FREQ IN MHZ -; -IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -; -PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -; -EIPCENABLE .SET TRUE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION -; -CTCBASE .SET $10 ; CTC BASE I/O ADDRESS -LEDENABLE .SET TRUE ; ENABLES STATUS LED (SINGLE LED) -LEDPORT .SET $6E ; STATUS LED PORT ADDRESS -SIO0BASE .SET $18 ; SIO 0: REGISTERS BASE ADR -IDE0BASE .SET $90 ; IDE 0: IO BASE ADDRESS diff --git a/Source/HBIOS/Config/MBC_std.asm b/Source/HBIOS/Config/MBC_std.asm new file mode 100644 index 00000000..f7370980 --- /dev/null +++ b/Source/HBIOS/Config/MBC_std.asm @@ -0,0 +1,55 @@ +; +;================================================================================================== +; MBC CONFIGURATION +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_mbc.asm" +; +CPUOSC .SET 8000000 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +INTMODE .SET 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) +; +DMAENABLE .SET FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +; +BATCOND .SET FALSE ; ENABLE LOW BATTERY WARNING MESSAGE +; +CPUSPDDEF .SET SPD_LOW ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW +; +ROMSIZE .SET 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +RAMSIZE .SET 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) +; +MDFFENABLE .SET FALSE ; MD: ENABLE FLASH FILE SYSTEM +; +DSKYENABLE .SET FALSE ; ENABLES DSKY +DSKYMODE .SET DSKYMODE_NG ; DSKY VERSION: DSKYMODE_[V1|NG] +; +UARTINTS .SET FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +;UARTCFG .SET UARTCFG | SER_RTS +; +CVDUMON .SET CVDUMON_CGA ; CVDU: CVDU MONITOR SETUP: CVDUMON_[NONE|CGA|EGA] +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +; +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) diff --git a/Source/HBIOS/Config/MK4_std.asm b/Source/HBIOS/Config/MK4_std.asm index 4909dc00..e3faf56b 100644 --- a/Source/HBIOS/Config/MK4_std.asm +++ b/Source/HBIOS/Config/MK4_std.asm @@ -22,25 +22,35 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; #include "cfg_mk4.asm" ; +CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ +INTMODE .SET 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) ; -CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +UARTCAS .SET TRUE ; UART: AUTO-DETECT ECB CASSETTE UART +UARTMFP .SET TRUE ; UART: AUTO-DETECT MF/PIC UART +UART4 .SET TRUE ; UART: AUTO-DETECT 4UART UART +SIOENABLE .SET FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) ; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) VDUENABLE .SET FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) CVDUENABLE .SET TRUE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) VGAENABLE .SET TRUE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ; -FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .SET FDMODE_DIDE ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_DIDE ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] ; IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -; PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -; SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .SET SDMODE_MK4 ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC] ; diff --git a/Source/HBIOS/Config/N8_std.asm b/Source/HBIOS/Config/N8_std.asm index d8654771..9c632cdb 100644 --- a/Source/HBIOS/Config/N8_std.asm +++ b/Source/HBIOS/Config/N8_std.asm @@ -22,12 +22,23 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; #include "cfg_n8.asm" ; +CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ +INTMODE .SET 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) ; -CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +TMSENABLE .SET TRUE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) ; +PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) SDMODE .SET SDMODE_CSIO ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +; +AY38910ENABLE .SET TRUE ; AY: AY-3-8910 / YM2149 SOUND DRIVER diff --git a/Source/HBIOS/Config/RCZ180_ext.asm b/Source/HBIOS/Config/RCZ180_ext.asm index a1dbad03..3e321620 100644 --- a/Source/HBIOS/Config/RCZ180_ext.asm +++ b/Source/HBIOS/Config/RCZ180_ext.asm @@ -1,6 +1,6 @@ ; ;================================================================================================== -; RC2014 Z180 STANDARD CONFIGURATION (EXTERNAL 512K RAM/ROM BANKED MEMORY MODULE) +; RCBUS Z180 STANDARD CONFIGURATION (EXTERNAL MMU ON 512K RAM/ROM BANKED MEMORY MODULE) ;================================================================================================== ; ; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE @@ -22,9 +22,12 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; #include "cfg_rcz180.asm" ; CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP ; MEMMGR .SET MM_Z2 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] ; @@ -32,14 +35,30 @@ Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) ; -ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +INTRTCENABLE .SET TRUE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) ; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) -SIOENABLE .SET FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) ; -FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ; -IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) ; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ180 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ180_nat.asm b/Source/HBIOS/Config/RCZ180_nat.asm index 46f9c43f..edb084e0 100644 --- a/Source/HBIOS/Config/RCZ180_nat.asm +++ b/Source/HBIOS/Config/RCZ180_nat.asm @@ -1,6 +1,6 @@ ; ;================================================================================================== -; RC2014 Z180 STANDARD CONFIGURATION (NATIVE Z180 LINEAR MEMORY) +; RCBUS Z180 STANDARD CONFIGURATION (NATIVE Z180 MMU W/ LINEAR MEMORY MODULE) ;================================================================================================== ; ; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE @@ -22,9 +22,12 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; #include "cfg_rcz180.asm" ; CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP ; MEMMGR .SET MM_Z180 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] ; @@ -32,14 +35,30 @@ Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) ; -ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +INTRTCENABLE .SET TRUE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) ; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) -SIOENABLE .SET FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) ; -FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ; -IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) ; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ180 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ280_ext.asm b/Source/HBIOS/Config/RCZ280_ext.asm new file mode 100644 index 00000000..a7574e8b --- /dev/null +++ b/Source/HBIOS/Config/RCZ280_ext.asm @@ -0,0 +1,62 @@ +; +;================================================================================================== +; RCBUS Z280 STANDARD CONFIGURATION (EXTERNAL MMU ON 512K RAM/ROM BANKED MEMORY MODULE) +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_rcz280.asm" +; +CPUOSC .SET 12000000 ; CPU OSC FREQ IN MHZ +INTMODE .SET 1 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +MEMMGR .SET MM_Z2 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] +; +Z280_MEMLOWAIT .SET 0 ; Z280: LOW 8MB MEMORY WAIT STATES (0-3) +Z280_MEMHIWAIT .SET 0 ; Z280: HIGH 8MB MEMORY WAIT STATES (0-3) +Z280_IOWAIT .SET 1 ; Z280: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z280_INTWAIT .SET 0 ; Z280: INT ACK WAIT STATUS (0-3) +; +Z2UENABLE .SET TRUE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ACIAENABLE .SET TRUE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ280_nat.asm b/Source/HBIOS/Config/RCZ280_nat.asm new file mode 100644 index 00000000..415b925d --- /dev/null +++ b/Source/HBIOS/Config/RCZ280_nat.asm @@ -0,0 +1,62 @@ +; +;================================================================================================== +; RCBUS Z280 STANDARD CONFIGURATION (NATIVE Z280 MMU W/ LINEAR MEMORY) +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_rcz280.asm" +; +CPUOSC .SET 12000000 ; CPU OSC FREQ IN MHZ +INTMODE .SET 3 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +MEMMGR .SET MM_Z280 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280] +; +Z280_MEMLOWAIT .SET 0 ; Z280: LOW 8MB MEMORY WAIT STATES (0-3) +Z280_MEMHIWAIT .SET 0 ; Z280: HIGH 8MB MEMORY WAIT STATES (0-3) +Z280_IOWAIT .SET 1 ; Z280: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z280_INTWAIT .SET 0 ; Z280: INT ACK WAIT STATUS (0-3) +; +Z2UENABLE .SET TRUE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ280_zz80mb.asm b/Source/HBIOS/Config/RCZ280_zz80mb.asm new file mode 100644 index 00000000..82129e2b --- /dev/null +++ b/Source/HBIOS/Config/RCZ280_zz80mb.asm @@ -0,0 +1,68 @@ +; +;================================================================================================== +; RCBUS Z280 STANDARD CONFIGURATION (NATIVE Z280 MMU W/ LINEAR MEMORY ON ZZ80MB) +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE PLATFORM_NAME "ZZ80MB", " [", CONFIG, "]" +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_rcz280.asm" +; +CPUOSC .SET 12000000 ; CPU OSC FREQ IN MHZ +INTMODE .SET 3 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +MEMMGR .SET MM_Z280 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280] +; +RAMLOC .SET 23 ; START OF RAM AS POWER OF 2 (2^N) IN PHYSICAL ADDRESS SPACE +RAMBIAS .SET (1 << (RAMLOC - 10)) ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE +; +Z280_MEMLOWAIT .SET 0 ; Z280: LOW 8MB MEMORY WAIT STATES (0-3) +Z280_MEMHIWAIT .SET 0 ; Z280: HIGH 8MB MEMORY WAIT STATES (0-3) +Z280_IOWAIT .SET 1 ; Z280: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z280_INTWAIT .SET 0 ; Z280: INT ACK WAIT STATUS (0-3) +; +Z2UENABLE .SET TRUE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +Z2U0HFC .SET TRUE ; Z2U 0: ENABLE HARDWARE FLOW CONTROL +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ280_zzrc.asm b/Source/HBIOS/Config/RCZ280_zzrc.asm new file mode 100644 index 00000000..c173c1bb --- /dev/null +++ b/Source/HBIOS/Config/RCZ280_zzrc.asm @@ -0,0 +1,76 @@ +; +;================================================================================================== +; RCBUS Z280 STANDARD CONFIGURATION (NATIVE Z280 MMU W/ LINEAR MEMORY ON ZZRC) +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE PLATFORM_NAME "ZZRC", " [", CONFIG, "]" +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_rcz280.asm" +; +CPUOSC .SET 14745600 ; CPU OSC FREQ IN MHZ +INTMODE .SET 3 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +MEMMGR .SET MM_Z280 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280] +; +RAMSIZE .SET 256 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE .SET 256 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .SET 256 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +; +RAMLOC .SET 18 ; START OF RAM AS POWER OF 2 (2^N) IN PHYSICAL ADDRESS SPACE +RAMBIAS .SET (1 << (RAMLOC - 10)) ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE +; +Z280_MEMLOWAIT .SET 0 ; Z280: LOW 8MB MEMORY WAIT STATES (0-3) +Z280_MEMHIWAIT .SET 0 ; Z280: HIGH 8MB MEMORY WAIT STATES (0-3) +Z280_IOWAIT .SET 1 ; Z280: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z280_INTWAIT .SET 0 ; Z280: INT ACK WAIT STATUS (0-3) +; +MDROM .SET TRUE ; MD: ENABLE ROM DISK +MDRAM .SET FALSE ; MD: ENABLE RAM DISK +; +Z2UENABLE .SET TRUE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +Z2UOSC .SET (CPUOSC / 8) ; Z2U: OSC FREQUENCY IN MHZ +Z2U0HFC .SET TRUE ; Z2U0: ENABLE HARDWARE FLOW CONTROL +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ80_easy.asm b/Source/HBIOS/Config/RCZ80_easy.asm new file mode 100644 index 00000000..dd6f0312 --- /dev/null +++ b/Source/HBIOS/Config/RCZ80_easy.asm @@ -0,0 +1,77 @@ +; +;================================================================================================== +; EASY Z80 STANDARD CONFIGURATION +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE PLATFORM_NAME "Easy-Z80", " [", CONFIG, "]" +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_rcz80.asm" +; +PLATFORM .SET PLT_EZZ80 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUOSC .SET 10000000 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +INTMODE .SET 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) +; +WDOGMODE .SET WDOG_EZZ80 ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] +WDOGIO .SET $6F ; WATCHDOG REGISTER ADR +; +DIAGENABLE .SET FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT +; +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +RP5RTCENABLE .SET FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +CTCENABLE .SET TRUE ; ENABLE ZILOG CTC SUPPORT +CTCTIMER .SET TRUE ; ENABLE CTC PERIODIC TIMER +CTCMODE .SET CTCMODE_CTR ; CTC MODE: CTCMODE_[NONE|CTR|TIM16|TIM256] +CTCOSC .SET 921600 ; CTC CLOCK FREQUENCY +; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +SIO0MODE .SET SIOMODE_STD ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] +SIO0ACLK .SET 1843200 ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0BCLK .SET 1843200 ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO1ACLK .SET 7372800 ; SIO 1A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO1BCLK .SET 7372800 ; SIO 1B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +DUARTENABLE .SET FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSTIMENABLE .SET FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ80_kio.asm b/Source/HBIOS/Config/RCZ80_kio.asm index e88df73d..ee7d74de 100644 --- a/Source/HBIOS/Config/RCZ80_kio.asm +++ b/Source/HBIOS/Config/RCZ80_kio.asm @@ -1,6 +1,6 @@ ; ;================================================================================================== -; RC2014 Z80 STANDARD CONFIGURATION W/ KIO +; RCBUS Z80 STANDARD CONFIGURATION W/ KIO ;================================================================================================== ; ; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE @@ -22,23 +22,51 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; -#DEFINE PLATFORM_NAME "RC2014 (KIO)" +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT ; -#include "Config/RCZ80_std.asm" +#include "cfg_rcz80.asm" ; +CPUOSC .SET 7372800 ; CPU OSC FREQ IN MHZ INTMODE .SET 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP ; +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +RP5RTCENABLE .SET FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) KIOENABLE .SET TRUE ; ENABLE ZILOG KIO SUPPORT ; CTCENABLE .SET TRUE ; ENABLE ZILOG CTC SUPPORT +CTCTIMER .SET TRUE ; ENABLE CTC PERIODIC TIMER CTCBASE .SET KIOBASE+$04 ; CTC BASE I/O ADDRESS ; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +DUARTENABLE .SET FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) ; SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) SIOCNT .SET 1 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP -SIO0MODE .SET SIOMODE_EZZ80 ; SIO 0: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] +SIO0MODE .SET SIOMODE_STD ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] SIO0BASE .SET KIOBASE+$08 ; SIO 0: REGISTERS BASE ADR -SIO0CTCC .SET 0 ; SIO 0: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE SIO0ACLK .SET 1843200 ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0ACTCC .SET 0 ; SIO 0A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE SIO0BCLK .SET 1843200 ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0BCTCC .SET 1 ; SIO 0B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSTIMENABLE .SET FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ80_mt.asm b/Source/HBIOS/Config/RCZ80_mt.asm deleted file mode 100644 index 8806bedd..00000000 --- a/Source/HBIOS/Config/RCZ80_mt.asm +++ /dev/null @@ -1,30 +0,0 @@ -; -;================================================================================================== -; RC2014 Z80 CONFIGURATION W/ MT011 -;================================================================================================== -; -; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE -; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS -; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE -; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. -; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY -; YOUR FILE IN THE BUILD PROCESS. -; -; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. -; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO -; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON -; SETTINGS. -; -; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, -; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING -; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! -; -; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO -; DIRECTORIES ABOVE THIS ONE). -; -#DEFINE PLATFORM_NAME "RC2014 (MT)" -; -#include "Config/RCZ80_std.asm" -; -SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDMODE .SET SDMODE_MT ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] diff --git a/Source/HBIOS/Config/RCZ80_skz.asm b/Source/HBIOS/Config/RCZ80_skz.asm new file mode 100644 index 00000000..d3380a37 --- /dev/null +++ b/Source/HBIOS/Config/RCZ80_skz.asm @@ -0,0 +1,67 @@ +; +;================================================================================================== +; RCBUS Z80 STANDARD CONFIGURATION W/ SERGEY KISELEV Z80 + 512K CPU +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_rcz80.asm" +; +CPUOSC .SET 7372800 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +SKZENABLE .SET TRUE ; ENABLE SERGEY'S Z80-512K FEATURES +SKZDIV .SET DIV_12 ; UART CLK (CLK2) DIVIDER FOR Z80-512K +WDOGMODE .SET WDOG_SKZ ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] +; +LEDENABLE .SET TRUE ; ENABLES STATUS LED (SINGLE LED) +LEDPORT .SET $6E ; STATUS LED PORT ADDRESS +; +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +RP5RTCENABLE .SET FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ACIAENABLE .SET TRUE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +SIO0BCLK .SET CPUOSC / 12 ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0BCFG .SET SER_38400_8N1 ; SIO 0B: SERIAL LINE CONFIG +DUARTENABLE .SET FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSTIMENABLE .SET FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ80_std.asm b/Source/HBIOS/Config/RCZ80_std.asm index f9e0f1fa..6707b13d 100644 --- a/Source/HBIOS/Config/RCZ80_std.asm +++ b/Source/HBIOS/Config/RCZ80_std.asm @@ -1,6 +1,6 @@ ; ;================================================================================================== -; RC2014 Z80 STANDARD CONFIGURATION +; RCBUS Z80 STANDARD CONFIGURATION ;================================================================================================== ; ; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE @@ -22,17 +22,37 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; #include "cfg_rcz80.asm" ; CPUOSC .SET 7372800 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP ; -ACIAENABLE .SET TRUE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +RP5RTCENABLE .SET FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) ; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ACIAENABLE .SET TRUE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +DUARTENABLE .SET FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) ; -FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSTIMENABLE .SET FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ; -IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER ; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ80_tiny.asm b/Source/HBIOS/Config/RCZ80_tiny.asm new file mode 100644 index 00000000..d5da8791 --- /dev/null +++ b/Source/HBIOS/Config/RCZ80_tiny.asm @@ -0,0 +1,83 @@ +; +;================================================================================================== +; TINY Z80 STANDARD CONFIGURATION +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE PLATFORM_NAME "Tiny-Z80", " [", CONFIG, "]" +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_rcz80.asm" +; +PLATFORM .SET PLT_EZZ80 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUOSC .SET 16000000 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +INTMODE .SET 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) +; +EIPCENABLE .SET TRUE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +WDOGMODE .SET WDOG_EZZ80 ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] +WDOGIO .SET $6F ; WATCHDOG REGISTER ADR +; +DIAGENABLE .SET FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT +LEDENABLE .SET TRUE ; ENABLES STATUS LED (SINGLE LED) +LEDPORT .SET $6E ; STATUS LED PORT ADDRESS +; +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +RP5RTCENABLE .SET FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +CTCENABLE .SET TRUE ; ENABLE ZILOG CTC SUPPORT +CTCBASE .SET $10 ; CTC BASE I/O ADDRESS +CTCTIMER .SET TRUE ; ENABLE CTC PERIODIC TIMER +CTCMODE .SET CTCMODE_CTR ; CTC MODE: CTCMODE_[NONE|CTR|TIM16|TIM256] +CTCOSC .SET 921600 ; CTC CLOCK FREQUENCY +; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +SIO0MODE .SET SIOMODE_STD ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] +SIO0BASE .SET $18 ; SIO 0: REGISTERS BASE ADR +SIO0ACLK .SET 1843200 ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0BCLK .SET 1843200 ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO1ACLK .SET 7372800 ; SIO 1A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO1BCLK .SET 7372800 ; SIO 1B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +DUARTENABLE .SET FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSTIMENABLE .SET FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +IDE0BASE .SET $90 ; IDE 0: IO BASE ADDRESS +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ80_zrc.asm b/Source/HBIOS/Config/RCZ80_zrc.asm new file mode 100644 index 00000000..55566dc9 --- /dev/null +++ b/Source/HBIOS/Config/RCZ80_zrc.asm @@ -0,0 +1,59 @@ +; +;================================================================================================== +; RCBUS Z80 ZRC CONFIGURATION +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE PLATFORM_NAME "ZRC", " [", CONFIG, "]" +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_rcz80.asm" +CPUOSC .SET 14745600 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +RAMSIZE .SET 1536 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) +MEMMGR .SET MM_ZRC ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] +; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ACIAENABLE .SET TRUE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +DUARTENABLE .SET FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSTIMENABLE .SET FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RCZ80_zrc_ram.asm b/Source/HBIOS/Config/RCZ80_zrc_ram.asm new file mode 100644 index 00000000..7ec945db --- /dev/null +++ b/Source/HBIOS/Config/RCZ80_zrc_ram.asm @@ -0,0 +1,63 @@ +; +;================================================================================================== +; RCBUS Z80 ZRC CONFIGURATION +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE PLATFORM_NAME "ZRC", " [", CONFIG, "]" +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_rcz80.asm" +; +CPUOSC .SET 7372800 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +RAMSIZE .SET 2048 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE .SET 0 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +MEMMGR .SET MM_ZRC ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] +; +MDROM .SET FALSE ; MD: ENABLE ROM DISK +; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ACIAENABLE .SET TRUE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +DUARTENABLE .SET FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSTIMENABLE .SET FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/RPH_std.asm b/Source/HBIOS/Config/RPH_std.asm new file mode 100644 index 00000000..3dedea59 --- /dev/null +++ b/Source/HBIOS/Config/RPH_std.asm @@ -0,0 +1,40 @@ +; +;================================================================================================== +; RHYOPHYRE STANDARD CONFIGURATION +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_rph.asm" +; +CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +INTMODE .SET 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) +; +Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 +Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) +Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +; +RAMSIZE .SET 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) +; +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) diff --git a/Source/HBIOS/Config/SBC_max.asm b/Source/HBIOS/Config/SBC_max.asm new file mode 100644 index 00000000..c2537aca --- /dev/null +++ b/Source/HBIOS/Config/SBC_max.asm @@ -0,0 +1,69 @@ +; +;================================================================================================== +; SBC MAXIMUM CONFIGURATION +;================================================================================================== +; +; THIS CONFIGURATION FILE IS *NOT* MEANT TO GENERATE A FUNCTIONAL ROM. +; IT IS USED TO HELP TEST BUILDS WITH MOST FEATURES ENABLED. +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .SET OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .SET BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_sbc.asm" +; +BATCOND .SET TRUE ; ENABLE LOW BATTERY WARNING MESSAGE +HBIOS_MUTEX .SET TRUE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) +USELZSA2 .SET TRUE ; ENABLE FONT COMPRESSION +; +KIOENABLE .SET TRUE ; ENABLE ZILOG KIO SUPPORT +; +DIAGENABLE .SET TRUE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT +; +DSKYENABLE .SET TRUE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) +; +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +; +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +; +VDUENABLE .SET TRUE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) +CVDUENABLE .SET TRUE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) +TMSENABLE .SET TRUE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +VGAENABLE .SET TRUE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +; +RFENABLE .SET TRUE ; RF: ENABLE RAM FLOPPY DRIVER +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +; +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +; +SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +; +PRPENABLE .SET TRUE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) +; +AY38910ENABLE .SET TRUE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER (AY38910.ASM) +; +SN76489ENABLE .SET TRUE ; SN: ENABLE SN76489 SOUND DRIVER (SN76489.ASM) +; +YM2612ENABLE .SET TRUE ; YM2612: ENABLE ECB VGM YM2612 SOUND DRIVER (YM2612.ASM) diff --git a/Source/HBIOS/Config/SBC_simh.asm b/Source/HBIOS/Config/SBC_simh.asm index 85600427..2ee17a8b 100644 --- a/Source/HBIOS/Config/SBC_simh.asm +++ b/Source/HBIOS/Config/SBC_simh.asm @@ -22,7 +22,7 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; -#DEFINE PLATFORM_NAME "SBC (simh)" +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT ; #include "cfg_sbc.asm" ; @@ -30,7 +30,7 @@ INTMODE .SET 1 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 ; HTIMENABLE .SET TRUE ; ENABLE SIMH TIMER SUPPORT ; -SIMRTCENABLE .SET TRUE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) -DSRTCENABLE .SET FALSE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +UARTSBCFORCE .SET TRUE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) ; HDSKENABLE .SET TRUE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) diff --git a/Source/HBIOS/Config/SBC_std.asm b/Source/HBIOS/Config/SBC_std.asm index d5cb313a..b2a2474c 100644 --- a/Source/HBIOS/Config/SBC_std.asm +++ b/Source/HBIOS/Config/SBC_std.asm @@ -22,21 +22,33 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; #include "cfg_sbc.asm" ; -CRTACT .SET TRUE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +CPUOSC .SET 8000000 ; CPU OSC FREQ IN MHZ +INTMODE .SET 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +UARTSBC .SET TRUE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTCAS .SET TRUE ; UART: AUTO-DETECT ECB CASSETTE UART +UARTMFP .SET TRUE ; UART: AUTO-DETECT MF/PIC UART +UART4 .SET TRUE ; UART: AUTO-DETECT 4UART UART +UARTRC .SET FALSE ; UART: AUTO-DETECT RC UART +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) ; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) VDUENABLE .SET FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) CVDUENABLE .SET TRUE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) VGAENABLE .SET TRUE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ; -FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .SET FDMODE_DIO3 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_DIO3 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] ; IDEENABLE .SET FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -; PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -; SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .SET SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC] ; diff --git a/Source/HBIOS/Config/SCZ180_126.asm b/Source/HBIOS/Config/SCZ180_126.asm deleted file mode 100644 index d1f1cd1d..00000000 --- a/Source/HBIOS/Config/SCZ180_126.asm +++ /dev/null @@ -1,51 +0,0 @@ -; -;================================================================================================== -; SC126 STANDARD CONFIGURATION -;================================================================================================== -; -; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE -; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS -; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE -; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. -; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY -; YOUR FILE IN THE BUILD PROCESS. -; -; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. -; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO -; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON -; SETTINGS. -; -; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, -; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING -; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! -; -; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO -; DIRECTORIES ABOVE THIS ONE). -; -#DEFINE PLATFORM_NAME "SC126" -; -#include "cfg_scz180.asm" -; -CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ -; -Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 -Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) -Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) -; -HBIOS_MUTEX .SET FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) -; -ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) -; -ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) -; -SIOENABLE .SET FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) -; -FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] -; -IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -; -PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -; -SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY diff --git a/Source/HBIOS/Config/SCZ180_130.asm b/Source/HBIOS/Config/SCZ180_130.asm deleted file mode 100644 index 9b838598..00000000 --- a/Source/HBIOS/Config/SCZ180_130.asm +++ /dev/null @@ -1,56 +0,0 @@ -; -;================================================================================================== -; SC130 STANDARD CONFIGURATION -;================================================================================================== -; -; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE -; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS -; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE -; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. -; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY -; YOUR FILE IN THE BUILD PROCESS. -; -; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. -; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO -; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON -; SETTINGS. -; -; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, -; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING -; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! -; -; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO -; DIRECTORIES ABOVE THIS ONE). -; -#DEFINE PLATFORM_NAME "SC130" -; -#include "cfg_scz180.asm" -; -CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ -; -Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 -Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) -Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) -; -HBIOS_MUTEX .SET FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) -; -LEDENABLE .SET TRUE ; ENABLE STATUS LED (SINGLE LED) -; -DIAGENABLE .SET FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT -; -DSRTCENABLE .SET FALSE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) -; -ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) -; -ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) -; -SIOENABLE .SET FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) -; -FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] -; -IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -; -PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -; -SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) diff --git a/Source/HBIOS/Config/SCZ180_131.asm b/Source/HBIOS/Config/SCZ180_131.asm deleted file mode 100644 index 9bdcbb99..00000000 --- a/Source/HBIOS/Config/SCZ180_131.asm +++ /dev/null @@ -1,56 +0,0 @@ -; -;================================================================================================== -; SC131 STANDARD CONFIGURATION -;================================================================================================== -; -; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE -; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS -; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE -; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. -; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY -; YOUR FILE IN THE BUILD PROCESS. -; -; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. -; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO -; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON -; SETTINGS. -; -; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, -; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING -; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! -; -; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO -; DIRECTORIES ABOVE THIS ONE). -; -#DEFINE PLATFORM_NAME "SC131" -; -#include "cfg_scz180.asm" -; -CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ -; -Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 -Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) -Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) -; -HBIOS_MUTEX .SET FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) -; -LEDENABLE .SET TRUE ; ENABLE STATUS LED (SINGLE LED) -; -DIAGENABLE .SET FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT -; -DSRTCENABLE .SET FALSE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) -; -ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) -; -ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) -; -SIOENABLE .SET FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) -; -FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3] -; -IDEENABLE .SET FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -; -PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -; -SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) diff --git a/Source/HBIOS/Config/SCZ180_sc126.asm b/Source/HBIOS/Config/SCZ180_sc126.asm new file mode 100644 index 00000000..2550da0d --- /dev/null +++ b/Source/HBIOS/Config/SCZ180_sc126.asm @@ -0,0 +1,68 @@ +; +;================================================================================================== +; SC126 STANDARD CONFIGURATION +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE PLATFORM_NAME "Small Computer SC126", " [", CONFIG, "]" +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_scz180.asm" +; +CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 +Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) +Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +; +DIAGENABLE .SET TRUE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT +DIAGPORT .SET $0D ; DIAGNOSTIC PORT ADDRESS +; +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +INTRTCENABLE .SET TRUE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSTIMENABLE .SET FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET TRUE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ180 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDMODE .SET SDMODE_SC ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/SCZ180_sc130.asm b/Source/HBIOS/Config/SCZ180_sc130.asm new file mode 100644 index 00000000..ed6e7284 --- /dev/null +++ b/Source/HBIOS/Config/SCZ180_sc130.asm @@ -0,0 +1,68 @@ +; +;================================================================================================== +; SC130 STANDARD CONFIGURATION +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE PLATFORM_NAME "Small Computer SC130", " [", CONFIG, "]" +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_scz180.asm" +; +CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ +CRTACT .SET FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +; +Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 +Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) +Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +; +LEDENABLE .SET TRUE ; ENABLE STATUS LED (SINGLE LED) +DIAGENABLE .SET FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT +; +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +INTRTCENABLE .SET TRUE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +; +TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSTIMENABLE .SET FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +MKYENABLE .SET FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +VDAEMU_SERKBD .SET 0 ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +; +AY38910ENABLE .SET TRUE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_RCZ180 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDMODE .SET SDMODE_SC ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) diff --git a/Source/HBIOS/Config/SCZ180_sc131.asm b/Source/HBIOS/Config/SCZ180_sc131.asm new file mode 100644 index 00000000..93f3f383 --- /dev/null +++ b/Source/HBIOS/Config/SCZ180_sc131.asm @@ -0,0 +1,52 @@ +; +;================================================================================================== +; SC131 STANDARD CONFIGURATION +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE PLATFORM_NAME "Small Computer SC131", " [", CONFIG, "]" +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_scz180.asm" +; +CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ +; +Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 +Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) +Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +; +LEDENABLE .SET TRUE ; ENABLE STATUS LED (SINGLE LED) +DIAGENABLE .SET FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT +; +DSRTCENABLE .SET FALSE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +INTRTCENABLE .SET TRUE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +UARTENABLE .SET FALSE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +; +IDEENABLE .SET FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDMODE .SET SDMODE_SC ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY diff --git a/Source/HBIOS/Config/SCZ180_sc140.asm b/Source/HBIOS/Config/SCZ180_sc140.asm new file mode 100644 index 00000000..14dedad5 --- /dev/null +++ b/Source/HBIOS/Config/SCZ180_sc140.asm @@ -0,0 +1,63 @@ +; +;================================================================================================== +; SC140 STANDARD CONFIGURATION +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE PLATFORM_NAME "Small Computer SC140", " [", CONFIG, "]" +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_scz180.asm" +; +CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ +; +Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 +Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) +Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +; +LEDENABLE .SET TRUE ; ENABLE STATUS LED (SINGLE LED) +DIAGENABLE .SET TRUE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT +DIAGPORT .SET $A0 ; DIAGNOSTIC PORT ADDRESS +; +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +INTRTCENABLE .SET TRUE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_LINC ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) +; +IDE0BASE .SET $90 ; IDE 0: IO BASE ADDRESS diff --git a/Source/HBIOS/Config/SCZ180_sc503.asm b/Source/HBIOS/Config/SCZ180_sc503.asm new file mode 100644 index 00000000..ac0070b5 --- /dev/null +++ b/Source/HBIOS/Config/SCZ180_sc503.asm @@ -0,0 +1,63 @@ +; +;================================================================================================== +; SC503 STANDARD CONFIGURATION +;================================================================================================== +; +; THE COMPLETE SET OF DEFAULT CONFIGURATION SETTINGS FOR THIS PLATFORM ARE FOUND IN THE +; CFG_.ASM INCLUDED FILE WHICH IS FOUND IN THE PARENT DIRECTORY. THIS FILE CONTAINS +; COMMON CONFIGURATION SETTINGS THAT OVERRIDE THE DEFAULTS. IT IS INTENDED THAT YOU MAKE +; YOUR CUSTOMIZATIONS IN THIS FILE AND JUST INHERIT ALL OTHER SETTINGS FROM THE DEFAULTS. +; EVEN BETTER, YOU CAN MAKE A COPY OF THIS FILE WITH A NAME LIKE _XXX.ASM AND SPECIFY +; YOUR FILE IN THE BUILD PROCESS. +; +; THE SETTINGS BELOW ARE THE SETTINGS THAT ARE MOST COMMONLY MODIFIED FOR THIS PLATFORM. +; MANY OF THEM ARE EQUAL TO THE SETTINGS IN THE INCLUDED FILE, SO THEY DON'T REALLY DO +; ANYTHING AS IS. THEY ARE LISTED HERE TO MAKE IT EASY FOR YOU TO ADJUST THE MOST COMMON +; SETTINGS. +; +; N.B., SINCE THE SETTINGS BELOW ARE REDEFINING VALUES ALREADY SET IN THE INCLUDED FILE, +; TASM INSISTS THAT YOU USE THE .SET OPERATOR AND NOT THE .EQU OPERATOR BELOW. ATTEMPTING +; TO REDEFINE A VALUE WITH .EQU BELOW WILL CAUSE TASM ERRORS! +; +; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO +; DIRECTORIES ABOVE THIS ONE). +; +#DEFINE PLATFORM_NAME "Small Computer SC503", " [", CONFIG, "]" +; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; +#include "cfg_scz180.asm" +; +CPUOSC .SET 18432000 ; CPU OSC FREQ IN MHZ +; +Z180_CLKDIV .SET 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 +Z180_MEMWAIT .SET 0 ; Z180: MEMORY WAIT STATES (0-3) +Z180_IOWAIT .SET 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +; +LEDENABLE .SET TRUE ; ENABLE STATUS LED (SINGLE LED) +DIAGENABLE .SET TRUE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT +DIAGPORT .SET $A0 ; DIAGNOSTIC PORT ADDRESS +; +DSRTCENABLE .SET TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +INTRTCENABLE .SET TRUE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ASCIENABLE .SET TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +; +AY38910ENABLE .SET FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +AYMODE .SET AYMODE_LINC ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC] +SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER +; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +IDEENABLE .SET TRUE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +SDENABLE .SET TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT SC ONLY +; +PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) +; +IDE0BASE .SET $90 ; IDE 0: IO BASE ADDRESS diff --git a/Source/HBIOS/Config/UNA_std.asm b/Source/HBIOS/Config/UNA_std.asm index 9ddd4fc9..ee28f83a 100644 --- a/Source/HBIOS/Config/UNA_std.asm +++ b/Source/HBIOS/Config/UNA_std.asm @@ -22,5 +22,6 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; -#include "cfg_una.asm" +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT ; +#include "cfg_una.asm" diff --git a/Source/HBIOS/Config/ZETA2_std.asm b/Source/HBIOS/Config/ZETA2_std.asm index 7128d885..5c6673c3 100644 --- a/Source/HBIOS/Config/ZETA2_std.asm +++ b/Source/HBIOS/Config/ZETA2_std.asm @@ -22,14 +22,22 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; -#include "cfg_zeta2.asm" +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT ; -UARTCFG .SET UARTCFG | SER_RTS +#include "cfg_zeta2.asm" ; +CPUOSC .SET 20000000 ; CPU OSC FREQ IN MHZ +INTMODE .SET 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 CRTACT .SET TRUE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP ; -PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +;UARTCFG .SET UARTCFG | SER_RTS +UARTSBC .SET TRUE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART ; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_ZETA ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) ; PPPENABLE .SET TRUE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) diff --git a/Source/HBIOS/Config/ZETA_std.asm b/Source/HBIOS/Config/ZETA_std.asm index fe720ac7..2b44c968 100644 --- a/Source/HBIOS/Config/ZETA_std.asm +++ b/Source/HBIOS/Config/ZETA_std.asm @@ -22,12 +22,22 @@ ; PLEASE REFER TO THE CUSTOM BUILD INSTRUCTIONS (README.TXT) IN THE SOURCE DIRECTORY (TWO ; DIRECTORIES ABOVE THIS ONE). ; +#DEFINE BOOT_DEFAULT "H" ; DEFAULT BOOT LOADER CMD ON OR AUTO BOOT +; #include "cfg_zeta.asm" ; +CPUOSC .SET 20000000 ; CPU OSC FREQ IN MHZ +INTMODE .SET 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 CRTACT .SET TRUE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP ; -PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +UARTENABLE .SET TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +;UARTCFG .SET UARTCFG | SER_RTS +UARTSBC .SET TRUE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART ; +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_ZETA ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] +; +PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) ; PPPENABLE .SET TRUE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) diff --git a/Source/HBIOS/Makefile b/Source/HBIOS/Makefile index 294ddf1a..f002e93b 100644 --- a/Source/HBIOS/Makefile +++ b/Source/HBIOS/Makefile @@ -1,66 +1,116 @@ -OBJECTS = - -ifeq (1,1) -OBJECTS += DYNO_std.rom DYNO_std.com -OBJECTS += EZZ80_std.rom EZZ80_std.com -OBJECTS += EZZ80_tz80.rom EZZ80_tz80.com -OBJECTS += MK4_std.rom MK4_std.com -OBJECTS += N8_std.rom N8_std.com -OBJECTS += RCZ180_ext.rom RCZ180_ext.com -OBJECTS += RCZ180_nat.rom RCZ180_nat.com -OBJECTS += RCZ80_kio.rom RCZ80_kio.com -OBJECTS += RCZ80_mt.rom RCZ80_mt.com -OBJECTS += RCZ80_std.rom RCZ80_std.com -OBJECTS += SBC_simh.rom SBC_simh.com -OBJECTS += SBC_std.rom SBC_std.com -OBJECTS += SCZ180_126.rom SCZ180_126.com -OBJECTS += SCZ180_130.rom SCZ180_130.com -OBJECTS += SCZ180_131.rom SCZ180_131.com -OBJECTS += UNA_std.rom -OBJECTS += ZETA_std.rom ZETA_std.com -OBJECTS += ZETA2_std.rom ZETA2_std.com -else -OBJECTS += ZETA2_std.rom ZETA2_std.com -endif -MOREDIFF = camel80.bin game.bin hbios_rom.bin nascom.bin prefix.bin usrrom.bin \ - dbgmon.bin hbios_app.bin imgpad0.bin osimg1.bin romldr.bin \ - eastaegg.bin hbios_img.bin imgpad.bin osimg.bin tastybasic.bin \ - game.bin usrrom.bin +MOREDIFF = game.bin hbios_rom.bin nascom.bin usrrom.bin \ + dbgmon.bin hbios_app.bin imgpad2.bin osimg1.bin osimg2.bin romldr.bin \ + eastaegg.bin hbios_img.bin osimg.bin game.bin updater.bin usrrom.bin -SUBDIRS = +SUBDIRS = DEST = ../../Binary TOOLS =../../Tools -OTHERS = *.img *.rom *.com *.bin *.z80 cpm.sys zsys.sys Build.inc RomDisk.tmp font*.asm *.dat -include $(TOOLS)/Makefile.inc +OTHERS = *.img *.rom *.com *.upd *.bin *.z80 cpm.sys zsys.sys Build.inc font*.asm *.dat hbios_env.sh + +# DIFFMAKE = 1 + +# DIFFPATH = $(DIFFTO)/Binary ifeq ($(DIFFMAKE),1) DIFFBUILD := -d $(DIFFTO)/Source/HBIOS endif -DIFFPATH = $(DIFFTO)/Binary +ifeq ($(OBJECTS),) +start: + chmod +x Build.sh + bash Build.sh $(DIFFBUILD) +endif + +include $(TOOLS)/Makefile.inc + +FONTS := font8x11c.asm font8x11u.asm font8x16c.asm font8x16u.asm font8x8c.asm font8x8u.asm fontcgac.asm fontcgau.asm + +ifeq ($(CPUFAM),2) + TASM=$(BINDIR)/uz80as -t hd64180 +else ifeq ($(CPUFAM),3) + TASM=$(BINDIR)/uz80as -t z280 +endif + +DEPS=prereq dbgmon.bin romldr.bin nascom.bin tastybasic.bin game.bin eastaegg.bin updater.bin usrrom.bin imgpad2.bin +ifeq ($(ROM_PLATFORM),UNA) + ROMDEPS=romldr.bin dbgmon.bin + BIOS=una +else + ROMDEPS=hbios_rom.bin hbios_app.bin hbios_img.bin + BIOS=wbw +endif -ROMSIZE=512 +ROMNAME=${ROM_PLATFORM}_${ROM_CONFIG} -N8_std.rom: ROMSIZE=512 +# $(info DEPS=$(DEPS)) +# $(info ROM_PLATFORM=$(ROM_PLATFORM)) +# $(info ROM_CONFIG=$(ROM_CONFIG)) +# $(info ROMSIZE=$(ROMSIZE)) +# $(info ROMNAME=$(ROMNAME)) +# $(info CPUFAM=$(CPUFAM)) +# $(info TASM=$(TASM)) -%.rom: - bash Build.sh $(DIFFBUILD) $(shell echo $* | sed 's/_/ /') $(ROMSIZE) +$(OBJECTS) : $(ROMDEPS) + cat romldr.bin dbgmon.bin ../ZSDOS/zsys_$(BIOS).bin ../CPM22/cpm_$(BIOS).bin >osimg.bin + cat romldr.bin dbgmon.bin ../ZSDOS/zsys_$(BIOS).bin >osimg_small.bin + if [ $(ROM_PLATFORM) != UNA ] ; then \ + cat camel80.bin nascom.bin tastybasic.bin game.bin eastaegg.bin netboot.mod updater.bin usrrom.bin >osimg1.bin ; \ + cat imgpad2.bin >osimg2.bin ; \ + if [ $(ROMSIZE) -gt 0 ] ; then \ + for f in hbios_rom.bin osimg.bin osimg1.bin osimg2.bin ; do \ + srec_cat $$f -Binary -Crop 0 0x7FFF -Checksum_Negative_Big_Endian 0x7FFF 1 1 -o $$f -Binary ; \ + done \ + fi \ + fi + if [ $(ROM_PLATFORM) = UNA ] ; then \ + cp osimg.bin $(DEST)/UNA_WBW_SYS.bin ; \ + cp ../RomDsk/rom$(ROMSIZE)_una.dat $(DEST)/UNA_WBW_ROM$(ROMSIZE).bin ; \ + cat ../UBIOS/UNA-BIOS.BIN osimg.bin ../UBIOS/FSFAT.BIN ../RomDsk/rom$(ROMSIZE)_una.dat >$(ROMNAME).rom ; \ + else \ + if [ $(ROMSIZE) -gt 0 ] ; then \ + cat hbios_rom.bin osimg.bin osimg1.bin osimg2.bin ../RomDsk/rom$(ROMSIZE)_wbw.dat >$(ROMNAME).rom ; \ + cat hbios_rom.bin osimg.bin osimg1.bin osimg2.bin >$(ROMNAME).upd ; \ + cat hbios_app.bin osimg_small.bin > $(ROMNAME).com ; \ + else \ + cat hbios_rom.bin osimg_small.bin > $(ROMNAME).rom ; \ + cat hbios_rom.bin osimg_small.bin > $(ROMNAME).upd ; \ + cat hbios_app.bin osimg_small.bin > $(ROMNAME).com ; \ + fi \ + fi -hbios_rom.bin: hbios.asm build.inc +prereq: $(FONTS) camel80.bin tastybasic.bin + +font%.asm: + cp ../Fonts/$@ . + +camel80.bin: + cp ../Forth/$@ . + +tastybasic.bin: + cp ../TastyBasic/src/$@ . + +hbios_rom.bin: hbios.asm build.inc $(DEPS) $(TASM) -dROMBOOT hbios.asm hbios_rom.bin hbios_rom.lst -hbios_app.bin: hbios.asm build.inc +hbios_app.bin: hbios.asm build.inc $(DEPS) $(TASM) -dAPPBOOT hbios.asm hbios_app.bin hbios_app.lst -hbios_img.bin: hbios.asm build.inc +hbios_img.bin: hbios.asm build.inc $(DEPS) $(TASM) -dIMGBOOT hbios.asm hbios_img.bin hbios_img.lst +hbios_env.com: hbios_env.asm build.inc + $(TASM) -dBASH hbios_env.asm hbios_env.com hbios_env.lst + +hbios_env.sh: hbios_env.com + $(ZXCC) hbios_env.com >hbios_env.sh + romldr.bin: build.inc dbgmon.bin: build.inc nascom.bin: build.inc eastaegg.bin: build.inc +updater.bin: build.inc dumps: for i in $(MOREDIFF) ; do \ diff --git a/Source/HBIOS/ROM Layout.txt b/Source/HBIOS/ROM Layout.txt new file mode 100644 index 00000000..c15694a3 --- /dev/null +++ b/Source/HBIOS/ROM Layout.txt @@ -0,0 +1,27 @@ +RomWBW ROM Layout Notes + +Bank Module Start Size +------ ------ ------ ------ +0 hbios 0x0000 0x8000 + 0x8000 + +1 loader 0x0000 0x1000 + dbgmon 0x1000 0x2000 + cpm22 0x2000 0x3000 + zsys 0x5000 0x3000 + 0x8000 + +2 forth 0x0000 0x1700 + basic 0x1700 0x2000 + tbasic 0x3700 0x0900 + game 0x4000 0x0900 + egg 0x4900 0x0200 + netboot 0x4B00 0x1000 + updater 0x5B00 0x0D00 + usrrom 0x6800 0x1800 + 0x8000 + +3 imgpad2 0x0000 0x8000 + 0x8000 + +4-N ROM Disk Data \ No newline at end of file diff --git a/Source/HBIOS/acia.asm b/Source/HBIOS/acia.asm index 2e030a76..f670298c 100644 --- a/Source/HBIOS/acia.asm +++ b/Source/HBIOS/acia.asm @@ -25,42 +25,37 @@ ; | RIE | TC2 | TC1 | WS3 | WS2 | WS1 | CDS2 | CDS1 | ; +-------+-------+-------+-------+-------+-------+-------+-------+ ; -; RIE: RECEIVE INTERRUPT ENABLE (RECEIVE DATA REGISTER FULL) -; -; TC: TRANSMIT CONTROL (TRANSMIT DATA REGISTER EMPTY) -; 0 0 - /RTS=LOW, TDRE INT DISABLED -; 0 1 - /RTS=LOW, TDRE INT ENABLED -; 1 0 - /RTS=HIGH, TDRE INT DISABLED -; 1 1 - /RTS=LOW, TRANSMIT BREAK, TDRE INT DISABLED -; -; WS: WORD SELECT (DATA BITS, PARITY, STOP BITS) -; 0 0 0 - 7,E,2 -; 0 0 1 - 7,O,2 -; 0 1 0 - 7,E,1 -; 0 1 1 - 7,O,1 -; 1 0 0 - 8,N,2 -; 1 0 1 - 8,N,1 -; 1 1 0 - 8,E,1 -; 1 1 1 - 8,O,1 -; -; CDS: COUNTER DIVIDE SELECT -; 0 0 - DIVIDE BY 1 -; 0 1 - DIVIDE BY 16 -; 1 0 - DIVIDE BY 64 -; 1 1 - MASTER RESET -; -ACIA_BUFSZ .EQU 32 ; RECEIVE RING BUFFER SIZE +; RIE: RECEIVE INTERRUPT ENABLE (RECEIVE DATA REGISTER FULL) +; +; TC: TRANSMIT CONTROL (TRANSMIT DATA REGISTER EMPTY) +; 0 0 - /RTS=LOW, TDRE INT DISABLED +; 0 1 - /RTS=LOW, TDRE INT ENABLED +; 1 0 - /RTS=HIGH, TDRE INT DISABLED +; 1 1 - /RTS=LOW, TRANSMIT BREAK, TDRE INT DISABLED +; +; WS: WORD SELECT (DATA BITS, PARITY, STOP BITS) +; 0 0 0 - 7,E,2 +; 0 0 1 - 7,O,2 +; 0 1 0 - 7,E,1 +; 0 1 1 - 7,O,1 +; 1 0 0 - 8,N,2 +; 1 0 1 - 8,N,1 +; 1 1 0 - 8,E,1 +; 1 1 1 - 8,O,1 +; +; CDS: COUNTER DIVIDE SELECT +; 0 0 - DIVIDE BY 1 +; 0 1 - DIVIDE BY 16 +; 1 0 - DIVIDE BY 64 +; 1 1 - MASTER RESET +; +ACIA_BUFSZ .EQU 32 ; RECEIVE RING BUFFER SIZE ; ACIA_NONE .EQU 0 ACIA_ACIA .EQU 1 ; -ACIA_RTSON .EQU %00000000 ; BIT MASK TO ASSERT RTS -ACIA_RTSOFF .EQU %01000000 ; BIT MASK TO DEASSERT RTS -; -#IF (INTMODE > 1) - .ECHO "*** ERROR: UNSUPPORTED INTMODE FOR ACIA DRIVER!!!\n" - !!! ; FORCE AN ASSEMBLY ERROR -#ENDIF +ACIA_RTSON .EQU %10111111 ; BIT MASK TO ASSERT RTS +ACIA_RTSOFF .EQU %01000000 ; BIT MASK TO DEASSERT RTS ; ; ; @@ -70,34 +65,34 @@ ACIA_PREINIT: ; NOTE: INTS WILL BE DISABLED WHEN PREINIT IS CALLED AND THEY MUST REMIAIN ; DISABLED. ; - LD B,ACIA_CFGCNT ; LOOP CONTROL + LD B,ACIA_CFGCNT ; LOOP CONTROL XOR A ; ZERO TO ACCUM LD (ACIA_DEV),A ; CURRENT DEVICE NUMBER - LD IY,ACIA_CFG ; POINT TO START OF CFG TABLE + LD IY,ACIA_CFG ; POINT TO START OF CFG TABLE ACIA_PREINIT0: - PUSH BC ; SAVE LOOP CONTROL - CALL ACIA_INITUNIT ; HAND OFF TO GENERIC INIT CODE - POP BC ; RESTORE LOOP CONTROL -; - LD A,(IY+1) ; GET THE ACIA TYPE DETECTED - OR A ; SET FLAGS - JR Z,ACIA_PREINIT2 ; SKIP IT IF NOTHING FOUND -; - PUSH BC ; SAVE LOOP CONTROL - PUSH IY ; CFG ENTRY ADDRESS - POP DE ; ... TO DE - LD BC,ACIA_FNTBL ; BC := FUNCTION TABLE ADDRESS - CALL NZ,CIO_ADDENT ; ADD ENTRY IF ACIA FOUND, BC:DE - POP BC ; RESTORE LOOP CONTROL -; -ACIA_PREINIT2: - LD DE,ACIA_CFGSIZ ; SIZE OF CFG ENTRY - ADD IY,DE ; BUMP IY TO NEXT ENTRY - DJNZ ACIA_PREINIT0 ; LOOP UNTIL DONE + PUSH BC ; SAVE LOOP CONTROL + CALL ACIA_INITUNIT ; HAND OFF TO GENERIC INIT CODE + POP BC ; RESTORE LOOP CONTROL +; + LD A,(IY+1) ; GET THE ACIA TYPE DETECTED + OR A ; SET FLAGS + JR Z,ACIA_PREINIT2 ; SKIP IT IF NOTHING FOUND +; + PUSH BC ; SAVE LOOP CONTROL + PUSH IY ; CFG ENTRY ADDRESS + POP DE ; ... TO DE + LD BC,ACIA_FNTBL ; BC := FUNCTION TABLE ADDRESS + CALL NZ,CIO_ADDENT ; ADD ENTRY IF ACIA FOUND, BC:DE + POP BC ; RESTORE LOOP CONTROL +; +ACIA_PREINIT2: + LD DE,ACIA_CFGSIZ ; SIZE OF CFG ENTRY + ADD IY,DE ; BUMP IY TO NEXT ENTRY + DJNZ ACIA_PREINIT0 ; LOOP UNTIL DONE ; ACIA_PREINIT3: - XOR A ; SIGNAL SUCCESS - RET ; AND RETURN + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN ; ; ACIA INITIALIZATION ROUTINE ; @@ -115,22 +110,17 @@ ACIA_INITUNIT: ; #IF (INTMODE == 1) ; ADD IM1 INT CALL LIST ENTRY - LD L,(IY+8) ; GET INT HANDLER PTR - LD H,(IY+9) ; ... INTO HL + LD L,(IY+8) ; GET INT HANDLER PTR + LD H,(IY+9) ; ... INTO HL CALL HB_ADDIM1 ; ADD TO IM1 CALL LIST #ENDIF ; -#IF (INTMODE > 1) - .ECHO "*** ERROR: ACIA DEVICE DOES NOT SUPPORT INTMODE 2!!!\n" - !!! ; FORCE AN ASSEMBLY ERROR -#ENDIF -; - ; IT IS EASY TO SPECIFY A SERIAL CONFIG THAT CANNOT BE IMPLEMENTED - ; DUE TO THE CONSTRAINTS OF THE ACIA. HERE WE FORCE A GENERIC - ; FAILSAFE CONFIG ONTO THE CHANNEL. IF THE SUBSEQUENT "REAL" - ; CONFIG FAILS, AT LEAST THE CHIP WILL BE ABLE TO SPIT DATA OUT - ; AT A RATIONAL BAUD/DATA/PARITY/STOP CONFIG. - CALL ACIA_INITSAFE + ; IT IS EASY TO SPECIFY A SERIAL CONFIG THAT CANNOT BE IMPLEMENTED + ; DUE TO THE CONSTRAINTS OF THE ACIA. HERE WE FORCE A GENERIC + ; FAILSAFE CONFIG ONTO THE CHANNEL. IF THE SUBSEQUENT "REAL" + ; CONFIG FAILS, AT LEAST THE CHIP WILL BE ABLE TO SPIT DATA OUT + ; AT A RATIONAL BAUD/DATA/PARITY/STOP CONFIG. + CALL ACIA_INITSAFE ; ; SET DEFAULT CONFIG LD DE,-1 ; LEAVE CONFIG ALONE @@ -141,45 +131,45 @@ ACIA_INITUNIT: ; ; ACIA_INIT: - LD B,ACIA_CFGCNT ; COUNT OF POSSIBLE ACIA UNITS - LD IY,ACIA_CFG ; POINT TO START OF CFG TABLE + LD B,ACIA_CFGCNT ; COUNT OF POSSIBLE ACIA UNITS + LD IY,ACIA_CFG ; POINT TO START OF CFG TABLE ACIA_INIT1: - PUSH BC ; SAVE LOOP CONTROL - LD A,(IY+1) ; GET ACIA TYPE - OR A ; SET FLAGS - CALL NZ,ACIA_PRTCFG ; PRINT IF NOT ZERO - POP BC ; RESTORE LOOP CONTROL - LD DE,ACIA_CFGSIZ ; SIZE OF CFG ENTRY - ADD IY,DE ; BUMP IY TO NEXT ENTRY - DJNZ ACIA_INIT1 ; LOOP TILL DONE -; - XOR A ; SIGNAL SUCCESS - RET ; DONE + PUSH BC ; SAVE LOOP CONTROL + LD A,(IY+1) ; GET ACIA TYPE + OR A ; SET FLAGS + CALL NZ,ACIA_PRTCFG ; PRINT IF NOT ZERO + POP BC ; RESTORE LOOP CONTROL + LD DE,ACIA_CFGSIZ ; SIZE OF CFG ENTRY + ADD IY,DE ; BUMP IY TO NEXT ENTRY + DJNZ ACIA_INIT1 ; LOOP TILL DONE +; + XOR A ; SIGNAL SUCCESS + RET ; DONE ; ; INTERRUPT HANDLERS ; -#IF (INTMODE == 0) +#IF (INTMODE != 1) ; ; NO INTERRUPT HANDLERS UNDER INTMODE 0. GENERATE A PANIC ; IF SOMETHING TRIES TO CALL THEM. ; ACIA0_INT: ACIA1_INT: - CALL PANIC + CALL PANIC ; NO RETURN ; #ENDIF ; -#IF (INTMODE > 0) +#IF (INTMODE == 1) ; ACIA0_INT: - LD IY,ACIA0_CFG ; POINT TO ACIA0 CFG - JR ACIA_INTRCV ; TRY TO RECEIVE FROM IT AND RETURN + LD IY,ACIA0_CFG ; POINT TO ACIA0 CFG + JR ACIA_INTRCV ; TRY TO RECEIVE FROM IT AND RETURN ; #IF (ACIACNT >= 2) ; ACIA1_INT: - LD IY,ACIA1_CFG ; POINT TO ACIA1 CFG - JR ACIA_INTRCV ; TRY TO RECEIVE FROM IT AND RETURN + LD IY,ACIA1_CFG ; POINT TO ACIA1 CFG + JR ACIA_INTRCV ; TRY TO RECEIVE FROM IT AND RETURN ; #ENDIF ; @@ -187,62 +177,62 @@ ACIA1_INT: ; BASED ON UNIT CFG POINTED TO BY IY ; ACIA_INTRCV: - ; CHECK TO SEE IF SOMETHING IS ACTUALLY THERE - LD C,(IY+3) ; CMD/STAT PORT TO C - IN A,(C) ; GET STATUS - AND $01 ; ISOLATE RECEIVE READY BIT - RET Z ; NOTHING AVAILABLE ON CURRENT CHANNEL + ; CHECK TO SEE IF SOMETHING IS ACTUALLY THERE + LD C,(IY+3) ; CMD/STAT PORT TO C + IN A,(C) ; GET STATUS + RRA ; READY BIT TO CF + RET NC ; NOTHING AVAILABLE ON CURRENT CHANNEL ; ACIA_INTRCV1: - ; RECEIVE CHARACTER INTO BUFFER + ; RECEIVE CHARACTER INTO BUFFER INC C ; DATA PORT - IN A,(C) ; READ PORT + IN A,(C) ; READ PORT DEC C ; BACK TO CONTROL PORT - LD B,A ; SAVE BYTE READ - LD L,(IY+6) ; SET HL TO - LD H,(IY+7) ; ... START OF BUFFER STRUCT - LD A,(HL) ; GET COUNT - CP ACIA_BUFSZ ; COMPARE TO BUFFER SIZE - JR Z,ACIA_INTRCV4 ; BAIL OUT IF BUFFER FULL, RCV BYTE DISCARDED - INC A ; INCREMENT THE COUNT - LD (HL),A ; AND SAVE IT - CP ACIA_BUFSZ / 2 ; BUFFER GETTING FULL? - JR NZ,ACIA_INTRCV2 ; IF NOT, BYPASS CLEARING RTS - LD A,(ACIA_CMD) ; CONFIG BYTE W/O RTS BIT - OR ACIA_RTSOFF ; CLEAR RTS - OUT (C),A ; DO IT + LD B,A ; SAVE BYTE READ + LD L,(IY+6) ; SET HL TO + LD H,(IY+7) ; ... START OF BUFFER STRUCT + LD A,(HL) ; GET COUNT + CP ACIA_BUFSZ ; COMPARE TO BUFFER SIZE + JR Z,ACIA_INTRCV4 ; BAIL OUT IF BUFFER FULL, RCV BYTE DISCARDED + INC A ; INCREMENT THE COUNT + LD (HL),A ; AND SAVE IT + CP ACIA_BUFSZ / 2 ; BUFFER GETTING FULL? + JR NZ,ACIA_INTRCV2 ; IF NOT, BYPASS CLEARING RTS + LD A,(ACIA_CMD) ; CONFIG BYTE W/O RTS BIT + OR ACIA_RTSOFF ; DEASSERT RTS + OUT (C),A ; DO IT ACIA_INTRCV2: - INC HL ; HL NOW HAS ADR OF HEAD PTR - PUSH HL ; SAVE ADR OF HEAD PTR - LD A,(HL) ; DEREFERENCE HL - INC HL - LD H,(HL) - LD L,A ; HL IS NOW ACTUAL HEAD PTR - LD (HL),B ; SAVE CHARACTER RECEIVED IN BUFFER AT HEAD - INC HL ; BUMP HEAD POINTER - POP DE ; RECOVER ADR OF HEAD PTR - LD A,L ; GET LOW BYTE OF HEAD PTR - SUB ACIA_BUFSZ+4 ; SUBTRACT SIZE OF BUFFER AND POINTER - CP E ; IF EQUAL TO START, HEAD PTR IS PAST BUF END - JR NZ,ACIA_INTRCV3 ; IF NOT, BYPASS - LD H,D ; SET HL TO - LD L,E ; ... HEAD PTR ADR - INC HL ; BUMP PAST HEAD PTR - INC HL - INC HL - INC HL ; ... SO HL NOW HAS ADR OF ACTUAL BUFFER START + INC HL ; HL NOW HAS ADR OF HEAD PTR + PUSH HL ; SAVE ADR OF HEAD PTR + LD A,(HL) ; DEREFERENCE HL + INC HL + LD H,(HL) + LD L,A ; HL IS NOW ACTUAL HEAD PTR + LD (HL),B ; SAVE CHARACTER RECEIVED IN BUFFER AT HEAD + INC HL ; BUMP HEAD POINTER + POP DE ; RECOVER ADR OF HEAD PTR + LD A,L ; GET LOW BYTE OF HEAD PTR + SUB ACIA_BUFSZ+4 ; SUBTRACT SIZE OF BUFFER AND POINTER + CP E ; IF EQUAL TO START, HEAD PTR IS PAST BUF END + JR NZ,ACIA_INTRCV3 ; IF NOT, BYPASS + LD H,D ; SET HL TO + LD L,E ; ... HEAD PTR ADR + INC HL ; BUMP PAST HEAD PTR + INC HL + INC HL + INC HL ; ... SO HL NOW HAS ADR OF ACTUAL BUFFER START ACIA_INTRCV3: - EX DE,HL ; DE := HEAD PTR VAL, HL := ADR OF HEAD PTR - LD (HL),E ; SAVE UPDATED HEAD PTR - INC HL - LD (HL),D - ; CHECK FOR MORE PENDING... - IN A,(C) ; GET STATUS - RRA ; READY BIT TO CF - JR C,ACIA_INTRCV1 ; IF SET, DO SOME MORE + EX DE,HL ; DE := HEAD PTR VAL, HL := ADR OF HEAD PTR + LD (HL),E ; SAVE UPDATED HEAD PTR + INC HL + LD (HL),D + ; CHECK FOR MORE PENDING... + IN A,(C) ; GET STATUS + RRA ; READY BIT TO CF + JR C,ACIA_INTRCV1 ; IF SET, DO SOME MORE ACIA_INTRCV4: - OR $FF ; NZ SET TO INDICATE INT HANDLED - RET ; AND RETURN + OR $FF ; NZ SET TO INDICATE INT HANDLED + RET ; AND RETURN ; #ENDIF ; @@ -263,7 +253,7 @@ ACIA_FNTBL: ; ; ; -#IF (INTMODE == 0) +#IF (INTMODE != 1) ; ACIA_IN: CALL ACIA_IST ; CHAR WAITING? @@ -277,49 +267,49 @@ ACIA_IN: #ELSE ; ACIA_IN: - CALL ACIA_IST ; SEE IF CHAR AVAILABLE - JR Z,ACIA_IN ; LOOP UNTIL SO - HB_DI ; AVOID COLLISION WITH INT HANDLER - LD L,(IY+6) ; SET HL TO - LD H,(IY+7) ; ... START OF BUFFER STRUCT - LD A,(HL) ; GET COUNT - DEC A ; DECREMENT COUNT - LD (HL),A ; SAVE UPDATED COUNT - CP ACIA_BUFSZ / 4 ; BUFFER LOW THRESHOLD - JR NZ,ACIA_IN1 ; IF NOT, BYPASS SETTING RTS - LD C,(IY+3) ; C IS CMD/STATUS PORT ADR - LD A,(ACIA_CMD) ; CONFIG BYTE W/O RTS BIT - OR ACIA_RTSON ; SET RTS - OUT (C),A ; DO IT + CALL ACIA_IST ; SEE IF CHAR AVAILABLE + JR Z,ACIA_IN ; LOOP UNTIL SO + HB_DI ; AVOID COLLISION WITH INT HANDLER + LD L,(IY+6) ; SET HL TO + LD H,(IY+7) ; ... START OF BUFFER STRUCT + LD A,(HL) ; GET COUNT + DEC A ; DECREMENT COUNT + LD (HL),A ; SAVE UPDATED COUNT + CP ACIA_BUFSZ / 4 ; BUFFER LOW THRESHOLD + JR NZ,ACIA_IN1 ; IF NOT, BYPASS SETTING RTS + LD C,(IY+3) ; C IS CMD/STATUS PORT ADR + LD A,(ACIA_CMD) ; CONFIG BYTE W/O RTS BIT + AND ACIA_RTSON ; ASSERT RTS + OUT (C),A ; DO IT ACIA_IN1: - INC HL - INC HL - INC HL ; HL NOW HAS ADR OF TAIL PTR - PUSH HL ; SAVE ADR OF TAIL PTR - LD A,(HL) ; DEREFERENCE HL - INC HL - LD H,(HL) - LD L,A ; HL IS NOW ACTUAL TAIL PTR - LD C,(HL) ; C := CHAR TO BE RETURNED - INC HL ; BUMP TAIL PTR - POP DE ; RECOVER ADR OF TAIL PTR - LD A,L ; GET LOW BYTE OF TAIL PTR - SUB ACIA_BUFSZ+2 ; SUBTRACT SIZE OF BUFFER AND POINTER - CP E ; IF EQUAL TO START, TAIL PTR IS PAST BUF END - JR NZ,ACIA_IN2 ; IF NOT, BYPASS - LD H,D ; SET HL TO - LD L,E ; ... TAIL PTR ADR - INC HL ; BUMP PAST TAIL PTR - INC HL ; ... SO HL NOW HAS ADR OF ACTUAL BUFFER START + INC HL + INC HL + INC HL ; HL NOW HAS ADR OF TAIL PTR + PUSH HL ; SAVE ADR OF TAIL PTR + LD A,(HL) ; DEREFERENCE HL + INC HL + LD H,(HL) + LD L,A ; HL IS NOW ACTUAL TAIL PTR + LD C,(HL) ; C := CHAR TO BE RETURNED + INC HL ; BUMP TAIL PTR + POP DE ; RECOVER ADR OF TAIL PTR + LD A,L ; GET LOW BYTE OF TAIL PTR + SUB ACIA_BUFSZ+2 ; SUBTRACT SIZE OF BUFFER AND POINTER + CP E ; IF EQUAL TO START, TAIL PTR IS PAST BUF END + JR NZ,ACIA_IN2 ; IF NOT, BYPASS + LD H,D ; SET HL TO + LD L,E ; ... TAIL PTR ADR + INC HL ; BUMP PAST TAIL PTR + INC HL ; ... SO HL NOW HAS ADR OF ACTUAL BUFFER START ACIA_IN2: - EX DE,HL ; DE := TAIL PTR VAL, HL := ADR OF TAIL PTR - LD (HL),E ; SAVE UPDATED TAIL PTR - INC HL - LD (HL),D - LD E,C ; MOVE CHAR TO RETURN TO E - HB_EI ; INTERRUPTS OK AGAIN - XOR A ; SIGNAL SUCCESS - RET ; AND DONE + EX DE,HL ; DE := TAIL PTR VAL, HL := ADR OF TAIL PTR + LD (HL),E ; SAVE UPDATED TAIL PTR + INC HL + LD (HL),D + LD E,C ; MOVE CHAR TO RETURN TO E + HB_EI ; INTERRUPTS OK AGAIN + XOR A ; SIGNAL SUCCESS + RET ; AND DONE ; #ENDIF ; @@ -336,7 +326,7 @@ ACIA_OUT: ; ; ; -#IF (INTMODE == 0) +#IF (INTMODE != 1) ; ACIA_IST: LD C,(IY+3) ; STATUS PORT @@ -350,12 +340,12 @@ ACIA_IST: #ELSE ; ACIA_IST: - LD L,(IY+6) ; GET ADDRESS - LD H,(IY+7) ; ... OF RECEIVE BUFFER - LD A,(HL) ; BUFFER UTILIZATION COUNT - OR A ; SET FLAGS - JP Z,CIO_IDLE ; NOT READY, RETURN VIA IDLE PROCESSING - RET + LD L,(IY+6) ; GET ADDRESS + LD H,(IY+7) ; ... OF RECEIVE BUFFER + LD A,(HL) ; BUFFER UTILIZATION COUNT + OR A ; SET FLAGS + JP Z,CIO_IDLE ; NOT READY, RETURN VIA IDLE PROCESSING + RET ; #ENDIF ; @@ -384,153 +374,160 @@ ACIA_INITDEV: ACIA_INITDEVX: ; #IF (ACIADEBUG) - CALL NEWLINE - PRTS("ACIA$") - LD A,(IY+2) - CALL PRTDECB - CALL COUT - CALL PC_COLON + CALL NEWLINE + PRTS("ACIA$") + LD A,(IY+2) + CALL PRTDECB + CALL COUT + CALL PC_COLON #ENDIF ; - ; TEST FOR -1 WHICH MEANS USE CURRENT CONFIG (JUST REINIT) - LD A,D ; TEST DE FOR - AND E ; ... VALUE OF -1 - INC A ; ... SO Z SET IF -1 - JR NZ,ACIA_INITDEV1 ; IF DE == -1, REINIT CURRENT CONFIG + ; TEST FOR -1 WHICH MEANS USE CURRENT CONFIG (JUST REINIT) + LD A,D ; TEST DE FOR + AND E ; ... VALUE OF -1 + INC A ; ... SO Z SET IF -1 + JR NZ,ACIA_INITDEV1 ; IF DE == -1, REINIT CURRENT CONFIG ; - ; LOAD EXISTING CONFIG TO REINIT - LD E,(IY+4) ; LOW BYTE - LD D,(IY+5) ; HIGH BYTE + ; LOAD EXISTING CONFIG TO REINIT + LD E,(IY+4) ; LOW BYTE + LD D,(IY+5) ; HIGH BYTE ; ACIA_INITDEV1: + LD (ACIA_NEWCFG),DE ; SAVE NEW CONFIG ; #IF (ACIADEBUG) - PUSH DE - POP BC - PRTS(" CFG=$") - CALL PRTHEXWORD + PUSH DE + POP BC + PRTS(" CFG=$") + CALL PRTHEXWORD #ENDIF ; - LD A,E ; GET CONFIG LSB - AND $E0 ; CHECK FOR DTR, XON, PARITY=MARK/SPACE - JR NZ,ACIA_INITFAIL ; IF ANY BIT SET, FAIL, NOT SUPPORTED + LD A,E ; GET CONFIG LSB + AND $E0 ; CHECK FOR DTR, XON, PARITY=MARK/SPACE + JR NZ,ACIA_INITFAIL ; IF ANY BIT SET, FAIL, NOT SUPPORTED ; - LD A,D ; GET CONFIG MSB - AND $1F ; ISOLATE ENCODED BAUD RATE + LD A,D ; GET CONFIG MSB + AND $1F ; ISOLATE ENCODED BAUD RATE ; #IF (ACIADEBUG) - PRTS(" ENC=$") - CALL PRTHEXBYTE + PRTS(" ENC=$") + CALL PRTHEXBYTE #ENDIF ; - ; BAUD RATE - PUSH DE ; SAVE REQUESTED CONFIG - LD L,(IY+10) ; LOAD CLK FREQ - LD H,(IY+11) ; ... INTO DE:HL - LD E,(IY+12) ; ... " - LD D,(IY+13) ; ... " - LD C,75 ; BAUD RATE ENCODING CONSTANT - CALL ENCODE ; C = TEST BAUD RATE (ENCODED) = BAUDTST - POP DE ; GET REQ CONFIG BACK, D = BAUDREQ -; - ; BIT 4 (DIV 3) OF BAUDREQ AND BAUDTST MUST MATCH! - LD A,C ; A = BAUDTST - XOR D ; XOR WITH BAUDREQ - BIT 4,A ; DO BIT 4 VALS MATCH? - JR NZ,ACIA_INITFAIL ; IF NOT, BAIL OUT -; - LD A,C ; BAUDTST TO A - AND $0F ; ISOLATE DIV 2 BAUD BITS - LD C,A ; C = BAUDTST -; - LD A,D ; MSB W/ BAUD RATE TO A - AND $0F ; ISOLATE DIV 2 BAUD BITS - LD L,A ; L = BAUDREQ -; - LD A,C ; A = BAUDTST - LD B,%00000000 ; ACIA VAL FOR DIV 1 - CP L ; BAUDTST = BAUDREQ? - JR Z,ACIA_INITBROK ; IF MATCH, WE ARE DONE -; - SUB 4 ; DIVIDE BY 16 (NOW DIV 16 TOT) - JR C,ACIA_INITFAIL ; FAIL IF UNDERFLOW - LD B,%00000001 ; ACIA VAL FOR DIV 16 - CP L ; BAUDTST = BAUDREQ? - JR Z,ACIA_INITBROK ; IF MATCH, WE ARE DONE -; - SUB 2 ; DIVIDE BY 4 (NOW DIV 64 TOT) - JR C,ACIA_INITFAIL ; FAIL IF UNDERFLOW - LD B,%00000010 ; ACIA R4 VAL FOR DIV 32 - CP L ; BAUDTST = BAUDREQ? - JR Z,ACIA_INITBROK ; IF MATCH, WE ARE DONE + ; BAUD RATE + PUSH DE ; SAVE REQUESTED CONFIG + LD L,(IY+10) ; LOAD CLK FREQ + LD H,(IY+11) ; ... INTO DE:HL + LD E,(IY+12) ; ... " + LD D,(IY+13) ; ... " + LD C,75 ; BAUD RATE ENCODING CONSTANT + CALL ENCODE ; C = TEST BAUD RATE (ENCODED) = BAUDTST + POP DE ; GET REQ CONFIG BACK, D = BAUDREQ +; + ; BIT 4 (DIV 3) OF BAUDREQ AND BAUDTST MUST MATCH! + LD A,C ; A = BAUDTST + XOR D ; XOR WITH BAUDREQ + BIT 4,A ; DO BIT 4 VALS MATCH? + JR NZ,ACIA_INITFAIL ; IF NOT, BAIL OUT +; + LD A,C ; BAUDTST TO A + AND $0F ; ISOLATE DIV 2 BAUD BITS + LD C,A ; C = BAUDTST +; + LD A,D ; MSB W/ BAUD RATE TO A + AND $0F ; ISOLATE DIV 2 BAUD BITS + LD L,A ; L = BAUDREQ +; + LD A,C ; A = BAUDTST + LD B,%00000000 ; ACIA VAL FOR DIV 1 + CP L ; BAUDTST = BAUDREQ? + JR Z,ACIA_INITBROK ; IF MATCH, WE ARE DONE +; + SUB 4 ; DIVIDE BY 16 (NOW DIV 16 TOT) + JR C,ACIA_INITFAIL ; FAIL IF UNDERFLOW + LD B,%00000001 ; ACIA VAL FOR DIV 16 + CP L ; BAUDTST = BAUDREQ? + JR Z,ACIA_INITBROK ; IF MATCH, WE ARE DONE +; + SUB 2 ; DIVIDE BY 4 (NOW DIV 64 TOT) + JR C,ACIA_INITFAIL ; FAIL IF UNDERFLOW + LD B,%00000010 ; ACIA R4 VAL FOR DIV 32 + CP L ; BAUDTST = BAUDREQ? + JR Z,ACIA_INITBROK ; IF MATCH, WE ARE DONE ; ACIA_INITFAIL: ; #IF (ACIADEBUG) - PRTS(" BAD CFG$") + PRTS(" BAD CFG$") #ENDIF ; - OR $FF - RET ; INVALID CONFIG -; + OR $FF + RET ; INVALID CONFIG +; ACIA_INITBROK: - ; REG B HAS WORKING CONFIG VALUE W/ BAUD RATE BITS - LD C,B ; WORKING VAL TO C - LD A,E ; LSB OF INCOMING CONFIG - AND %00111111 ; ISOLATE LOW 6 BITS TO COMPARE - LD B,8 ; WORD SELECT TABLE SIZE - LD HL,ACIA_WSTBL ; POINT TO TABLE + ; REG B HAS WORKING CONFIG VALUE W/ BAUD RATE BITS + LD C,B ; WORKING VAL TO C + LD A,E ; LSB OF INCOMING CONFIG + AND %00111111 ; ISOLATE LOW 6 BITS TO COMPARE + LD B,8 ; WORD SELECT TABLE SIZE + LD HL,ACIA_WSTBL ; POINT TO TABLE ACIA_INITWS: - CP (HL) ; MATCH? - JR Z,ACIA_INITWS2 ; IF SO, REG B HAS ACIA VAL + 1 - INC HL ; NEXT ENTRY - DJNZ ACIA_INITWS ; KEEP CHECKING TILL DONE - JR ACIA_INITFAIL ; FAIL IF NO MATCH - + CP (HL) ; MATCH? + JR Z,ACIA_INITWS2 ; IF SO, REG B HAS ACIA VAL + 1 + INC HL ; NEXT ENTRY + DJNZ ACIA_INITWS ; KEEP CHECKING TILL DONE + JR ACIA_INITFAIL ; FAIL IF NO MATCH + ACIA_WSTBL: - .DB %00001011 ; 8/O/1 - .DB %00011011 ; 8/E/1 - .DB %00000011 ; 8/N/1 - .DB %00000111 ; 8/N/2 - .DB %00001010 ; 7/O/1 - .DB %00011010 ; 7/E/1 - .DB %00001110 ; 7/O/2 - .DB %00011110 ; 7/E/2 + .DB %00001011 ; 8/O/1 + .DB %00011011 ; 8/E/1 + .DB %00000011 ; 8/N/1 + .DB %00000111 ; 8/N/2 + .DB %00001010 ; 7/O/1 + .DB %00011010 ; 7/E/1 + .DB %00001110 ; 7/O/2 + .DB %00011110 ; 7/E/2 ACIA_INITWS2: - LD A,B ; PUT FANAL VALUE IN A - DEC A ; ZERO INDEX ADJUSTMENT - RLA ; MOVE BITS TO - RLA ; ... PROPER LOCATION - OR C ; COMBINE WITH WORKING VALUE - JR ACIA_INITGO + LD A,B ; PUT FANAL VALUE IN A + DEC A ; ZERO INDEX ADJUSTMENT + RLA ; MOVE BITS TO + RLA ; ... PROPER LOCATION + OR C ; COMBINE WITH WORKING VALUE +; + ; SAVE CONFIG PERMANENTLY NOW + LD DE,(ACIA_NEWCFG) ; GET NEW CONFIG BACK + LD (IY+4),E ; SAVE LOW WORD + LD (IY+5),D ; SAVE HI WORD +; + JR ACIA_INITGO ; ACIA_INITSAFE: - LD A,%00010110 ; DEFAULT CONFIG + LD A,%00010110 ; DEFAULT CONFIG ; ACIA_INITGO: ; -#IF (INTMODE > 0) - OR %10000000 ; ENABLE RCV INT +#IF (INTMODE == 1) + OR %10000000 ; ENABLE RCV INT #ENDIF ; - LD (ACIA_CMD),A ; SAVE SHADOW REGISTER + LD (ACIA_CMD),A ; SAVE SHADOW REGISTER ; #IF (ACIADEBUG) - PRTS(" CMD=$") - CALL PRTHEXBYTE - LD DE,65 - CALL VDELAY ; WAIT FOR FINAL CHAR TO SEND + PRTS(" CMD=$") + CALL PRTHEXBYTE + LD DE,65 + CALL VDELAY ; WAIT FOR FINAL CHAR TO SEND #ENDIF ; ; PROGRAM THE ACIA CHIP LD C,(IY+3) ; COMMAND PORT - LD A,$FF ; MASTER RESET + LD A,$03 ; MASTER RESET OUT (C),A ; DO IT - LD A,(ACIA_CMD) ; RESTORE CONFIG VALUE + LD A,(ACIA_CMD) ; RESTORE CONFIG VALUE OUT (C),A ; DO IT ; -#IF (INTMODE > 0) +#IF (INTMODE == 1) ; ; RESET THE RECEIVE BUFFER LD E,(IY+6) @@ -571,21 +568,16 @@ ACIA_DEVICE: LD D,CIODEV_ACIA ; D := DEVICE TYPE LD E,(IY) ; E := PHYSICAL UNIT LD C,$00 ; C := DEVICE TYPE, 0x00 IS RS-232 + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,(IY+3) ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; ; ACIA DETECTION ROUTINE ; -; NOTE THAT THE ACIA MODULES ONLY QUALIFY ADDRESS BITS 7 & 6, SO -; THE ACIA'S TWO PORTS APPEAR REPEATEDLY OVER AN ADDRESS RANGE -; OF $40 STARTING FROM THE REAL BASE PORT. -; WE TAKE ADVANTAGE OF THIS TO AVOID CONFLICTING WITH SIO -; AND COMPACT FLASH MODULES DURING DETECTION PROBES. -; ACIA_DETECT: - LD A,(IY+3) ; BASE PORT ADDRESS - ADD A,$20 ; OFFSET (SEE ABOVE) - LD C,A ; PUT IN C FOR I/O + LD A,(IY+3) ; BASE PORT ADDRESS + LD C,A ; PUT IN C FOR I/O CALL ACIA_DETECT2 ; CHECK IT JR Z,ACIA_DETECT1 ; FOUND IT, RECORD IT LD A,ACIA_NONE ; NOTHING FOUND @@ -605,6 +597,7 @@ ACIA_DETECT2: RET NZ ; RETURN IF NOT ZERO LD A,$02 ; CLEAR MASTER RESET OUT (C),A ; DO IT + IN A,(C) ; GET STATUS AGAIN ; CHECK FOR EXPECTED BITS: ; TDRE=1, DCD & CTS = 0 AND %00001110 ; BIT MASK FOR "STABLE" BITS @@ -659,9 +652,10 @@ ACIA_STR_ACIA .DB "ACIA$" ; WORKING VARIABLES ; ACIA_DEV .DB 0 ; DEVICE NUM USED DURING INIT -ACIA_CMD .DB 0 ; COMMAND PORT SHADOW REGISTER +ACIA_CMD .DB 0 ; COMMAND PORT SHADOW REGISTER +ACIA_NEWCFG .DW 0 ; TEMP STORE FOR NEW CFG ; -#IF (INTMODE == 0) +#IF (INTMODE != 1) ; ACIA0_RCVBUF .EQU 0 ACIA1_RCVBUF .EQU 0 @@ -674,7 +668,7 @@ ACIA0_RCVBUF: ACIA0_BUFCNT .DB 0 ; CHARACTERS IN RING BUFFER ACIA0_HD .DW ACIA0_BUF ; BUFFER HEAD POINTER ACIA0_TL .DW ACIA0_BUF ; BUFFER TAIL POINTER -ACIA0_BUF .FILL 32,0 ; RECEIVE RING BUFFER +ACIA0_BUF .FILL ACIA_BUFSZ,0 ; RECEIVE RING BUFFER ACIA0_BUFEND .EQU $ ; END OF BUFFER ACIA0_BUFSZ .EQU $ - ACIA0_BUF ; SIZE OF RING BUFFER ; @@ -684,7 +678,7 @@ ACIA1_RCVBUF: ACIA1_BUFCNT .DB 0 ; CHARACTERS IN RING BUFFER ACIA1_HD .DW ACIA1_BUF ; BUFFER HEAD POINTER ACIA1_TL .DW ACIA1_BUF ; BUFFER TAIL POINTER -ACIA1_BUF .FILL 32,0 ; RECEIVE RING BUFFER +ACIA1_BUF .FILL ACIA_BUFSZ,0 ; RECEIVE RING BUFFER ACIA1_BUFEND .EQU $ ; END OF BUFFER ACIA1_BUFSZ .EQU $ - ACIA1_BUF ; SIZE OF RING BUFFER ; @@ -704,11 +698,11 @@ ACIA0_CFG: .DB ACIA0BASE ; BASE PORT .DW ACIA0CFG ; LINE CONFIGURATION .DW ACIA0_RCVBUF ; POINTER TO RCV BUFFER STRUCT - .DW ACIA0_INT ; INT HANDLER POINTER - .DW (ACIA0CLK / ACIA0DIV) & $FFFF ; CLOCK FREQ AS - .DW (ACIA0CLK / ACIA0DIV) >> 16 ; ... DWORD VALUE + .DW ACIA0_INT ; INT HANDLER POINTER + .DW (ACIA0CLK / ACIA0DIV) & $FFFF ; CLOCK FREQ AS + .DW (ACIA0CLK / ACIA0DIV) >> 16 ; ... DWORD VALUE ; -ACIA_CFGSIZ .EQU $ - ACIA_CFG ; SIZE OF ONE CFG TABLE ENTRY +ACIA_CFGSIZ .EQU $ - ACIA_CFG ; SIZE OF ONE CFG TABLE ENTRY ; #IF (ACIACNT >= 2) ; @@ -720,10 +714,10 @@ ACIA1_CFG: .DB ACIA1BASE ; BASE PORT .DW ACIA1CFG ; LINE CONFIGURATION .DW ACIA1_RCVBUF ; POINTER TO RCV BUFFER STRUCT - .DW ACIA1_INT ; INT HANDLER POINTER - .DW (ACIA1CLK / ACIA1DIV) & $FFFF ; CLOCK FREQ AS - .DW (ACIA1CLK / ACIA1DIV) >> 16 ; ... DWORD VALUE + .DW ACIA1_INT ; INT HANDLER POINTER + .DW (ACIA1CLK / ACIA1DIV) & $FFFF ; CLOCK FREQ AS + .DW (ACIA1CLK / ACIA1DIV) >> 16 ; ... DWORD VALUE ; #ENDIF ; -ACIA_CFGCNT .EQU ($ - ACIA_CFG) / ACIA_CFGSIZ +ACIA_CFGCNT .EQU ($ - ACIA_CFG) / ACIA_CFGSIZ diff --git a/Source/HBIOS/ansi.asm b/Source/HBIOS/ansi.asm index 1f2d5f8a..a761542d 100644 --- a/Source/HBIOS/ansi.asm +++ b/Source/HBIOS/ansi.asm @@ -114,6 +114,10 @@ ANSI_FNTBL: ; ANSI_IN: ; HANDLE INPUT REQUEST ; +#IF (VDAEMU_SERKBD != $FF) + LD C,VDAEMU_SERKBD + JP CIO_DISPATCH +#ELSE ; RETURN QUEUED DATA IF WE HAVE ANY LD A,(ANSI_QLEN) ; GET THE CURRENT QUEUE LENGTH OR A ; SET FLAGS @@ -140,6 +144,7 @@ ANSI_IN1: ; PERFORM ACTUAL KEYBOARD INPUT ANSI_IN2: ; HANDLE SPECIAL KEY CALL ANSI_KDISP ; IF $80 OR HIGHER, DISPATCH JR ANSI_IN ; AND LOOP +#ENDIF ; ; WRITE A CHARACTER W/ EMULATION ; @@ -166,6 +171,11 @@ ANSI_OUT2: ; SET RESULT AND RETURN ; CHECK INPUT STATUS ; ANSI_IST: ; CHECK QUEUE FIRST +; +#IF (VDAEMU_SERKBD != $FF) + LD C,VDAEMU_SERKBD + JP CIO_DISPATCH +#ELSE LD A,(ANSI_QLEN) ; GET CURRENT QUEUE LENGTH OR A ; SET FLAGS RET NZ ; RETURN IF CHAR(S) WAITING @@ -196,6 +206,7 @@ ANSI_IST: ; CHECK QUEUE FIRST ANSI_IST1: ; HANDLE SPECIAL KEY CALL ANSI_KDISP ; DO SPECIAL KEY HANDLING JR ANSI_IST ; REPEAT +#ENDIF ; ; CHECK OUTPUT STATUS ; @@ -280,6 +291,8 @@ ANSI_STSTR: ; STATE == STRING DATA ;================================================================================================== ; ANSI_C0DISP: + CP $07 ; BEL + JP Z,ANSI_BEL CP $08 ; BS: BACKSPACE JP Z,ANSI_BS CP $09 ; HT: TAB @@ -615,6 +628,9 @@ ANSI_FF: CALL ANSI_VDADISP ; PERFORM FILL JP ANSI_XY ; HOME CURSOR AND RETURN ; +ANSI_BEL: + JP SND_BEEP ; BEEP THE SPEAKER +; ANSI_BS: LD A,(ANSI_COL) ; GET CURRENT COLUMN DEC A ; BACK IT UP BY ONE diff --git a/Source/HBIOS/asci.asm b/Source/HBIOS/asci.asm index 26a71d87..2d118f7b 100644 --- a/Source/HBIOS/asci.asm +++ b/Source/HBIOS/asci.asm @@ -75,10 +75,14 @@ ASCI1_BASE .EQU Z180_BASE + 1 ; RELATIVE TO Z180 INTERNAL IO PORTS ; ASCI_RTS .EQU %00010000 ; ~RTS BIT OF CNTLA REG ; -#IF (INTMODE == 2) +#IF (ASCIINTS) +; + #IF (INTMODE == 2) ; ASCI0_IVT .EQU IVT(INT_SER0) ASCI1_IVT .EQU IVT(INT_SER1) +; + #ENDIF ; #ENDIF ; @@ -87,7 +91,7 @@ ASCI1_IVT .EQU IVT(INT_SER1) ASCI_PREINIT: ; ; SETUP THE DISPATCH TABLE ENTRIES -; NOTE: INTS WILL BE DISABLED WHEN PREINIT IS CALLED AND THEY MUST REMIAIN +; NOTE: INTS WILL BE DISABLED WHEN PREINIT IS CALLED AND THEY MUST REMAIN ; DISABLED. ; LD B,ASCI_CFGCNT ; LOOP CONTROL @@ -115,25 +119,29 @@ ASCI_PREINIT2: ADD IY,DE ; BUMP IY TO NEXT ENTRY DJNZ ASCI_PREINIT0 ; LOOP UNTIL DONE ; -#IF (INTMODE >= 1) +#IF (ASCIINTS) +; + #IF (INTMODE >= 1) ; SETUP INT VECTORS AS APPROPRIATE LD A,(ASCI_DEV) ; GET DEVICE COUNT OR A ; SET FLAGS JR Z,ASCI_PREINIT3 ; IF ZERO, NO ASCI DEVICES, ABORT ; -#IF (INTMODE == 1) + #IF (INTMODE == 1) ; ADD IM1 INT CALL LIST ENTRY LD HL,ASCI_INT ; GET INT VECTOR CALL HB_ADDIM1 ; ADD TO IM1 CALL LIST -#ENDIF + #ENDIF ; -#IF (INTMODE == 2) + #IF (INTMODE == 2) ; SETUP IM2 VECTORS LD HL,ASCI_INT0 LD (ASCI0_IVT),HL ; IVT INDEX LD HL,ASCI_INT1 LD (ASCI1_IVT),HL ; IVT INDEX -#ENDIF + #ENDIF +; + #ENDIF ; #ENDIF ; @@ -188,7 +196,9 @@ ASCI_INIT1: ; ; RECEIVE INTERRUPT HANDLER ; -#IF (INTMODE > 0) +#IF (ASCIINTS) +; + #IF (INTMODE > 0) ; ; IM1 ENTRY POINT ; @@ -232,6 +242,10 @@ ASCI_INTRCV1: ADD A,8 ; BUMP TO RDR PORT LD C,A ; PUT IN C, B IS STILL ZERO IN A,(C) ; READ PORT + #IF (ASCIBOOT != 0) + CP ASCIBOOT ; REBOOT REQUEST? + JP Z,SYS_RESCOLD ; IF SO, DO IT, NO RETURN + #ENDIF LD B,A ; SAVE BYTE READ LD L,(IY+6) ; SET HL TO LD H,(IY+7) ; ... START OF BUFFER STRUCT @@ -288,6 +302,8 @@ ASCI_INTRCV3: ASCI_INTRCV4: OR $FF ; NZ SET TO INDICATE INT HANDLED RET ; AND RETURN +; + #ENDIF ; #ENDIF ; @@ -305,7 +321,7 @@ ASCI_FNTBL: .ECHO "*** INVALID ASCI FUNCTION TABLE ***\n" #ENDIF ; -#IF (INTMODE == 0) +#IF ((!ASCIINTS) | (INTMODE == 0)) ; ASCI_IN: CALL ASCI_IST ; CHECK FOR CHAR READY @@ -391,7 +407,7 @@ ASCI_OUT: ; ; ; -#IF (INTMODE == 0) +#IF ((!ASCIINTS) | (INTMODE == 0)) ; ASCI_IST: CALL ASCI_ICHK ; ASCI INPUT CHECK @@ -518,7 +534,7 @@ ASCI_INITGO: OUT (C),L ; WRITE CNTLB VALUE INC C ; BUMP TO INC C ; ... STAT REG, B IS STILL 0 -#IF (INTMODE > 0) +#IF ((ASCIINTS) & (INTMODE > 0)) LD A,$08 ; SET RIE BIT ON #ELSE XOR A ; CLEAR RIE/TIE @@ -530,7 +546,7 @@ ASCI_INITGO: LD A,$66 ; STATIC VALUE FOR ASEXT OUT (C),A ; WRITE ASEXT REG ; -#IF (INTMODE > 0) +#IF ((ASCIINTS) & (INTMODE > 0)) ; ; RESET THE RECEIVE BUFFER LD E,(IY+6) @@ -575,6 +591,8 @@ ASCI_DEVICE: LD D,CIODEV_ASCI ; D := DEVICE TYPE LD E,(IY) ; E := PHYSICAL UNIT LD C,$00 ; C := DEVICE TYPE, 0x00 IS RS-232 + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,(IY+3) ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -603,6 +621,24 @@ ASCI_DETECT: ; DUE TO ENCODING BAUD IS ALWAYS DIVISIBLE BY 75 ; Z180 DIVISOR IS ALWAYS A FACTOR OF 160 ; +; CNTLB= XXPXDSSS +; FAILSAVE = 00100000 +; +; PS (PRESCALE): 0=/10, 1=/30 +; DR (DIVIDE RATIO): 0=/16, 1=/64 +; SS2 SS1 SS0 +; --- --- --- +; 0 0 0 /1 +; 0 0 1 /2 +; 0 1 0 /4 +; 0 1 1 /8 +; 1 0 0 /16 +; 1 0 1 /32 +; 1 1 0 /64 +; +; FAILSAFE: CLOCK / 30 / 16 / 1 = CLOCK / 480 +; IF CLOCK=18432000, BAUD=38400 +; ; X := CPU_HZ / 160 / 75 ==> SIMPLIFIED ==> X := CPU_KHZ / 12 ; X := X / (BAUD / 75) ; IF X % 3 == 0, THEN (PS := 1, X := X / 3) ELSE PS=0 @@ -763,7 +799,7 @@ ASCI_STR_ASCIB .DB "ASCI W/BRG$" ; ASCI_DEV .DB 0 ; DEVICE NUM USED DURING INIT ; -#IF (INTMODE == 0) +#IF ((!ASCIINTS) | (INTMODE == 0)) ; ASCI0_RCVBUF .EQU 0 ASCI1_RCVBUF .EQU 0 @@ -776,7 +812,7 @@ ASCI0_RCVBUF: ASCI0_BUFCNT .DB 0 ; CHARACTERS IN RING BUFFER ASCI0_HD .DW ASCI0_BUF ; BUFFER HEAD POINTER ASCI0_TL .DW ASCI0_BUF ; BUFFER TAIL POINTER -ASCI0_BUF .FILL 32,0 ; RECEIVE RING BUFFER +ASCI0_BUF .FILL ASCI_BUFSZ,0 ; RECEIVE RING BUFFER ASCI0_BUFEND .EQU $ ; END OF BUFFER ASCI0_BUFSZ .EQU $ - ASCI0_BUF ; SIZE OF RING BUFFER ; @@ -784,7 +820,7 @@ ASCI1_RCVBUF: ASCI1_BUFCNT .DB 0 ; CHARACTERS IN RING BUFFER ASCI1_HD .DW ASCI1_BUF ; BUFFER HEAD POINTER ASCI1_TL .DW ASCI1_BUF ; BUFFER TAIL POINTER -ASCI1_BUF .FILL 32,0 ; RECEIVE RING BUFFER +ASCI1_BUF .FILL ASCI_BUFSZ,0 ; RECEIVE RING BUFFER ASCI1_BUFEND .EQU $ ; END OF BUFFER ASCI1_BUFSZ .EQU $ - ASCI1_BUF ; SIZE OF RING BUFFER ; @@ -794,8 +830,32 @@ ASCI1_BUFSZ .EQU $ - ASCI1_BUF ; SIZE OF RING BUFFER ; ASCI_CFG: ; +#IF (ASCISWAP) +; +ASCI1_CFG: + ; ASCI CHANNEL B CONFIG + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; ASCI TYPE (SET DURING INIT) + .DB 1 ; MODULE ID + .DB ASCI1_BASE ; BASE PORT + .DW ASCI1CFG ; LINE CONFIGURATION + .DW ASCI1_RCVBUF ; POINTER TO RCV BUFFER STRUCT +; +ASCI_CFGSIZ .EQU $ - ASCI_CFG ; SIZE OF ONE CFG TABLE ENTRY +; ASCI0_CFG: - ; ASCI MODULE A CONFIG + ; ASCI CHANNEL A CONFIG + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; ASCI TYPE (SET DURING INIT) + .DB 0 ; MODULE ID + .DB ASCI0_BASE ; BASE PORT + .DW ASCI0CFG ; LINE CONFIGURATION + .DW ASCI0_RCVBUF ; POINTER TO RCV BUFFER STRUCT +; +#ELSE +; +ASCI0_CFG: + ; ASCI CHANNEL A CONFIG .DB 0 ; DEVICE NUMBER (SET DURING INIT) .DB 0 ; ASCI TYPE (SET DURING INIT) .DB 0 ; MODULE ID @@ -806,7 +866,7 @@ ASCI0_CFG: ASCI_CFGSIZ .EQU $ - ASCI_CFG ; SIZE OF ONE CFG TABLE ENTRY ; ASCI1_CFG: - ; ASCI MODULE B CONFIG + ; ASCI CHANNEL B CONFIG .DB 0 ; DEVICE NUMBER (SET DURING INIT) .DB 0 ; ASCI TYPE (SET DURING INIT) .DB 1 ; MODULE ID @@ -814,4 +874,7 @@ ASCI1_CFG: .DW ASCI1CFG ; LINE CONFIGURATION .DW ASCI1_RCVBUF ; POINTER TO RCV BUFFER STRUCT ; +#ENDIF +; +; ASCI_CFGCNT .EQU ($ - ASCI_CFG) / ASCI_CFGSIZ diff --git a/Source/HBIOS/audio.inc b/Source/HBIOS/audio.inc new file mode 100644 index 00000000..fcb686c7 --- /dev/null +++ b/Source/HBIOS/audio.inc @@ -0,0 +1,102 @@ +#IF AUDIOTRACE +; +#DEFINE AUDTRACE(STR) PUSH DE \ LD DE, STR \ CALL WRITESTR \ POP DE +#DEFINE AUDTRACE_A CALL PRTHEXBYTE +#DEFINE AUDTRACE_B PUSH AF \ LD A, B \ CALL PRTHEXBYTE \ POP AF +#DEFINE AUDTRACE_D PUSH AF \ LD A, D \ CALL PRTHEXBYTE \ POP AF +#DEFINE AUDTRACE_E PUSH AF \ LD A, E \ CALL PRTHEXBYTE \ POP AF +#DEFINE AUDTRACE_L PUSH AF \ LD A, L \ CALL PRTHEXBYTE \ POP AF +#DEFINE AUDTRACE_HL CALL PRTHEXWORDHL +#DEFINE AUDTRACE_BC PUSH HL \ PUSH BC \ POP HL \ CALL PRTHEXWORDHL \ POP HL +#DEFINE AUDTRACE_DE PUSH HL \ PUSH DE \ POP HL \ CALL PRTHEXWORDHL \ POP HL +#DEFINE AUDTRACE_IY PUSH HL \ PUSH IY \ POP HL \ CALL PRTHEXWORDHL \ POP HL +; +#DEFINE AUDDEBUG(S) push hl \ CALL PRTSTRD \ .TEXT S \ .TEXT "$" \ pop hl ; $$$$$$ PRINT STRING S TO CONSOLE - PRTD("HELLO") - NO TRAILING $ REQUIRED +; +#DEFINE AUDTRACE_CR AUDDEBUG("\r\n$") +; +#ELSE +; +#DEFINE AUDTRACE(S) +#DEFINE AUDTRACE_A +#DEFINE AUDTRACE_B +#DEFINE AUDTRACE_D +#DEFINE AUDTRACE_E +#DEFINE AUDTRACE_L +#DEFINE AUDTRACE_BC +#DEFINE AUDTRACE_HL +#DEFINE AUDTRACE_DE +#DEFINE AUDTRACE_IY +; +#DEFINE AUDDEBUG(STR) +; +#DEFINE AUDTRACE_CR +; +#ENDIF +; +#IFNDEF AUDIO_INC +#DEFINE AUDIO_INC +; +; NOTE TABLE VALUES ARE SHIFTED A FEW EXTRA BITS TO MAKE THE +; DIVISION AS ACCURATE AS POSSIBLE. +; +AUD_SCALE .EQU 3 +; +; ON ENTRY, DE IS ADDRESS OF NOTE TABLE, HL IS NOTE TO PLAY +; NOTE VALUE 0 MEANS B0b/A0# IN OCTAVE 0 WHICH IS THE FIRST ENTRY +; OF THE NOTE TABLE. THE NOTE TABLE REPRESENTS THE FREQUENCIES +; FOR 1 FULL OCTAVE IN QUARTER NOTES. SINCE THERE ARE 12 NOTES +; IN AN OCTAVE, THE TABLE HAS 48 ENTRIES FOR ALL QUARTER NOTES. +; +; ON EXIT, HL CONTAINS THE PERIOD VALUE TO PROGRAM INTO THE PSG +; DERIVED FROM THE NOTE TABLE SCALED TO THE REQUESTED OCTAVE. +; +AUD_NOTE: + AUDDEBUG("AUDNOTE ") + AUDTRACE_HL + AUDTRACE_CR + AUDTRACE_DE + AUDTRACE_CR +; + ; START BY SEPARATING THE NOTE AND OCTAVE PORTION + ; OF THE INCOMING TONE VALUE IN HL + PUSH DE ; SAVE NOTE TABLE ADR + LD DE,48 ; 48 QUARTERNOTES PER OCTAVE + CALL DIV16 ; SEPARATE OCTAVE AND NOTE +; + ; THE QUOTIENT (BC) IS THE OCTAVE NUMBER REQUESTED + ; THE REMAINDER (HL) IS THE QUARTER NOTE WITHIN THE OCTAVE. +; + ; NOW USE THE QUARTER NOTE VALUE TO LOOKUP THE CORRESPONDING + ; PSG PERIOD VALUE IN THE NOTE TABLE. + ADD HL,HL ; SCALE FOR 2 BYTE TABLE ENTRY SIZE + POP DE ; RECOVER THE TABLE ADR + ADD HL,DE ; HL := DESIRED TABLE ENTRY ADR + LD A,(HL) ; GET LOW BYTE OF PERIOD TO A + INC HL ; POINT TO HIGH BYTE VALUE + LD H,(HL) ; GET HIGH BYTE OF PERIOD TO H + LD L,A ; PUT LOW BYTE INTO L +; + ; NOW WE SCALE THE PERIOD VALUE DOWN BASED ON THE OCTAVE VALUE IN C + ; AND BY THE AUD_SCALE VALUE THAT WAS USED IN THE NOTE TABLE. + ; FOR EACH OCTAVE, THE PERIOD IS HALVED WHICH DOUBLES THE FREQUENCY + ; THAT WILL BE PRODUCED BY THE PSG. SINCE MOVING UP AN OCTAVE + ; SHOULD PRODUCE A FREQUENCY THAT IS TWICE THE LOWER OCTIAVE, THIS + ; WORKS NICELY, ALTHOUGH SOME ERROR MAY BE INTRODUCED. +; + LD A,AUD_SCALE ; SHIFT BY AUD_SCALE BITS + ADD A,C ; ... AND OCTAVE + LD B,A ; USE AS LOOP COUNTER +AUD_NOTE1: + SRL H ; RIGHT SHIFT HL + RR L ; ... BY ONE BIT + DJNZ AUD_NOTE1 ; LOOP UNTIL DONE +; + ; IF THE RESULTANT PERIOD IS ZERO, IT MEANS THAT THE REQUESTED + ; PERIOD IS TOO LOW (FREQUENCY TOO HIGH) FOR THE PSG TO PRODUCE. + LD A, L ; CHECK FOR ZERO + OR H ; ... MEANING PSG CAN'T DO IT + RET NZ ; IF NOT ZERO, RETURN THE CALCULATED PERIOD + DEC HL ; OTHERWISE RETURN -1 PERIOD (ERROR) + RET +#ENDIF diff --git a/Source/HBIOS/ay.asm b/Source/HBIOS/ay.asm deleted file mode 100644 index 85d9b9e2..00000000 --- a/Source/HBIOS/ay.asm +++ /dev/null @@ -1,122 +0,0 @@ -; -;====================================================================== -; PSG AY-3-8910 DRIVER FOR CONSOLE BELL -; WILL ALSO WORK WITH YM2149 -;====================================================================== -; -#IF (AYMODE == AYMODE_SCG) -AY_RSEL .EQU $9A -AY_RDAT .EQU $9B -AY_ACR .EQU $9C -#ENDIF -; -#IF (AYMODE == AYMODE_N8) -AY_RSEL .EQU $9C -AY_RDAT .EQU $9D -AY_ACR .EQU N8_DEFACR -#ENDIF -; -#IF (AYMODE == AYMODE_RCZ80) -AY_RSEL .EQU $D8 -AY_RDAT .EQU $D0 -#ENDIF -; -#IF (AYMODE == AYMODE_RCZ180) -AY_RSEL .EQU $68 -AY_RDAT .EQU $60 -#ENDIF -; -AY_R0CHAP .EQU $00 -AY_R1CHAP .EQU $01 -AY_R2CHBP .EQU $02 -AY_R3CHBP .EQU $03 -AY_R7ENAB .EQU $07 -AY_R8AVOL .EQU $08 -AY_R9BVOL .EQU $09 -; -;====================================================================== -; PSG AY-3-8910 DRIVER - INITIALIZATION -;====================================================================== -; -AY_INIT: - CALL NEWLINE ; FORMATTING - PRTS("AY: IO=0x$") - LD A,AY_RSEL - CALL PRTHEXBYTE - CALL AY_PROBE ; CHECK FOR HW EXISTENCE - JR Z,AY_INIT1 ; CONTINUE IF PRESENT -; -; HARDWARE NOT PRESENT -; - PRTS(" NOT PRESENT$") - OR $FF ; SIGNAL FAILURE - RET -; -AY_INIT1: - CALL AY_INIT2 - CALL AY_BEEP -AY_INIT2: - LD D,AY_R7ENAB ; SET MIXER CONTROL / IO ENABLE - LD E,$FF ; $FF - 11 111 111 - CALL AY_WRTPSG ; I/O PORTS DISABLED, NOISE CHANNEL C, B, A DISABLE, TONE CHANNEL C, B, A DISABLE -; - LD B,2 - LD D,AY_R8AVOL ; SET VOLUME TO 0 - LD E,$00 -AY_QUIET: - CALL AY_WRTPSG ; CYCLING THROUGH ALL CHANNELS - INC A - DJNZ AY_QUIET - RET -; -; PLAY A BEEP TONE ON CENTER CHANNEL (LEFT AND RIGHT SPEAKERS) -; -AY_BEEP: - LD D,AY_R2CHBP ; SET TONE PERIOD - LD E,$55 ; CHANNEL B - R00 & R01 - CALL AY_WRTPSG ; $0055 = XXXX0000 01010101 - LD D,AY_R3CHBP - LD E,0 - CALL AY_WRTPSG -; - LD D,AY_R7ENAB ; $FD = 11 111 101 - LD E,$FD ; SET MIXER CONTROL / IO ENABLE - CALL AY_WRTPSG ; I/O PORTS DISABLED, NOISE CHANNEL C, B, A DISABLE, TONE CHANNEL B ENABLE -; - LD D,AY_R9BVOL - LD E,$07 ; SET CHANNEL B VOLUME TO 50% (7/16) - CALL AY_WRTPSG -; - CALL LDELAY ; HALF SECOND - RET -; -; WRITE DATA E TO PSG REG A -; -AY_WRTPSG: - HB_DI -#IF (CPUFAM == CPU_Z180) - IN0 A,(Z180_DCNTL) ; GET WAIT STATES - PUSH AF ; SAVE VALUE - OR %00110000 ; FORCE SLOW OPERATION (I/O W/S=3) - OUT0 (Z180_DCNTL),A ; AND UPDATE DCNTL -#ENDIF - LD A,D - OUT (AY_RSEL),A - LD A,E - OUT (AY_RDAT),A -#IF (CPUFAM == CPU_Z180) - POP AF ; GET SAVED DCNTL VALUE - OUT0 (Z180_DCNTL),A ; AND RESTORE IT -#ENDIF - HB_EI - RET -; -; CHECK THERE IS A DEVICE PRESENT -; -AY_PROBE: -#IF ((AYMODE == AYMODE_SCG) | (AYMODE == AYMODE_N8)) - LD A,$FF - OUT (AY_ACR),A ; INIT AUX CONTROL REG -#ENDIF - XOR A - RET diff --git a/Source/HBIOS/ay38910.asm b/Source/HBIOS/ay38910.asm new file mode 100644 index 00000000..45b97f00 --- /dev/null +++ b/Source/HBIOS/ay38910.asm @@ -0,0 +1,672 @@ +;====================================================================== +; +; AY-3-8910 / YM2149 SOUND DRIVER +; +;====================================================================== +; +; AY-3-8910 & YM2149 PSG CHIPS NEED AN INPUT CLOCK FREQUENCY OF +; NO MORE THAN 2 MHZ. THE CLOSEST THING THERE IS TO A STANDARD +; IS THE MSX FREQ OF 1.7897725 MHZ. +; +; @1.7897725 OCTAVE RANGE IS 2 - 7 (Bb2/A#2 .. A7) +; @2.0000000 OCTAVE RANGE IS 2 - 7 (B2 .. A7) +; +; DIFFENCES BETWEEN AY-3-8910 AND YM2149 +; THE AY-3-8910 HAS 16 ENVELOPE LEVELS, YM2149 HAS 32. +; THIS AFFECTS AUDIO OUTPUT ONLY. THERE IS NO PROGRAMMING IMPACT. +; UNUSED BITS IN REGISTERS ARE READ AS ZERO ON AY-3-8910. +; UNUSED BITS CAN BE READ BACK AND WRITTEN ON YM. +; VOLTAGE LEVEL OUTPUT ON A AY-3-8910 IS LOW AND AROUND 2V ON YM2149. +; +AY_RCSND .EQU 0 ; 0 = EB MODULE, 1=MF MODULE +; +#IF (AYMODE == AYMODE_SCG) +AY_RSEL .EQU $9A +AY_RDAT .EQU $9B +AY_RIN .EQU AY_RSEL +AY_ACR .EQU $9C +#ENDIF +; +#IF (AYMODE == AYMODE_N8) +AY_RSEL .EQU $9C +AY_RDAT .EQU $9D +AY_RIN .EQU AY_RSEL +AY_ACR .EQU N8_DEFACR +#ENDIF +; +#IF (AYMODE == AYMODE_RCZ80) +AY_RSEL .EQU $D8 +AY_RDAT .EQU $D0 +AY_RIN .EQU AY_RSEL+AY_RCSND +#ENDIF +; +#IF (AYMODE == AYMODE_RCZ180) +AY_RSEL .EQU $68 +AY_RDAT .EQU $60 +AY_RIN .EQU AY_RSEL+AY_RCSND +#ENDIF +; +#IF (AYMODE == AYMODE_MSX) +AY_RSEL .EQU $A0 +AY_RDAT .EQU $A1 +AY_RIN .EQU $A2 +#ENDIF +; +#IF (AYMODE == AYMODE_LINC) +AY_RSEL .EQU $33 +AY_RDAT .EQU $32 +AY_RIN .EQU $32 +#ENDIF +; +#IF (AYMODE == AYMODE_MBC) +AY_RSEL .EQU $A0 +AY_RDAT .EQU $A1 +AY_RIN .EQU AY_RSEL +AY_ACR .EQU $A2 +#ENDIF +; +;====================================================================== +; +; REGISTERS +; +AY_R2CHBP .EQU $02 +AY_R3CHBP .EQU $03 +AY_R7ENAB .EQU $07 +AY_R8AVOL .EQU $08 +; +;====================================================================== +; +; DRIVER FUNCTION TABLE AND INSTANCE DATA +; +AY_FNTBL: + .DW AY_RESET + .DW AY_VOLUME + .DW AY_PERIOD + .DW AY_NOTE + .DW AY_PLAY + .DW AY_QUERY + .DW AY_DURATION + .DW AY_DEVICE +; +#IF (($ - AY_FNTBL) != (SND_FNCNT * 2)) + .ECHO "*** INVALID SND FUNCTION TABLE ***\n" + !!!!! +#ENDIF +; +AY_IDAT .EQU 0 ; NO INSTANCE DATA ASSOCIATED WITH THIS DEVICE +; +;====================================================================== +; +; DEVICE CAPABILITIES AND CONFIGURATION +; +AY_TONECNT .EQU 3 ; COUNT NUMBER OF TONE CHANNELS +AY_NOISECNT .EQU 1 ; COUNT NUMBER OF NOISE CHANNELS +;; +;#IF (AY_CLK > 3579545) ; DEPENDING ON THE +;AY_SCALE .EQU 2 ; INPUT CLOCK FREQUENCY +;#ELSE ; PRESCALE THE TONE PERIOD +;AY_SCALE .EQU 3 ; DATA TO MAINTAIN MAXIMUM +;#ENDIF ; RANGE AND ACCURACY +; + .ECHO "AY38910 CLOCK: " + .ECHO AY_CLK + .ECHO "\n" +; +#INCLUDE "audio.inc" +; +;====================================================================== +; +; DRIVER INITIALIZATION (THERE IS NO PRE-INITIALIZATION) +; +; ANNOUNCE DEVICE ON CONSOLE. ACTIVATE DEVICE IF REQUIRED. +; SETUP FUNCTION TABLES. SETUP THE DEVICE. +; ANNOUNCE DEVICE WITH BEEP. SET VOLUME OFF. +; RETURN INITIALIZATION STATUS +; +AY38910_INIT: + CALL NEWLINE ; ANNOUNCE + PRTS("AY:$") +; +#IF (AYMODE == AYMODE_SCG) + PRTS(" MODE=SCG$") +#ENDIF +; +#IF (AYMODE == AYMODE_N8) + PRTS(" MODE=N8$") +#ENDIF +; +#IF (AYMODE == AYMODE_RCZ80) + PRTS(" MODE=RCZ80$") +#ENDIF +; +#IF (AYMODE == AYMODE_RCZ180) + PRTS(" MODE=RCZ180$") +#ENDIF +; +#IF (AYMODE == AYMODE_MSX) + PRTS(" MODE=MSX$") +#ENDIF +; +#IF (AYMODE == AYMODE_MBC) + PRTS(" MODE=MBC$") +#ENDIF +; +#IF (AYMODE == AYMODE_LINC) + PRTS(" MODE=LINC$") +#ENDIF +; + PRTS(" IO=0x$") + LD A,AY_RSEL + CALL PRTHEXBYTE +; +#IF ((AYMODE == AYMODE_SCG) | (AYMODE == AYMODE_N8) | (AYMODE == AYMODE_MBC)) + LD A,$FF ; ACTIVATE DEVICE BIT 4 IS AY RESET CONTROL, BIT 3 IS ACTIVE LED + OUT (AY_ACR),A ; SET INIT AUX CONTROL REG +#ENDIF +; + LD DE,(AY_R2CHBP*256)+$55 ; SIMPLE HARDWARE PROBE + CALL AY_WRTPSG ; WRITE AND + CALL AY_RDPSG ; READ TO A + LD A,$55 ; SOUND CHANNEL + CP E ; REGISTER + JR Z,AY_FND +; + CALL PRTSTRD \ .TEXT " NOT PRESENT$" +; + LD A,$FF ; UNSUCCESSFULL INIT + RET +; +AY_FND: LD IY, AY_IDAT ; SETUP FUNCTION TABLE + LD BC, AY_FNTBL ; POINTER TO INSTANCE DATA + LD DE, AY_IDAT ; BC := FUNCTION TABLE ADDRESS + CALL SND_ADDENT ; DE := INSTANCE DATA PTR +; + CALL AY_INIT ; SET DEFAULT CHIP CONFIGURATION +; + LD E,$07 ; SET VOLUME TO 50% + CALL AY_SETV ; ON ALL CHANNELS +; +; LD DE,(AY_R2CHBP*256)+$55 ; BEEP ON CHANNEL B (CENTER) +; CALL AY_WRTPSG ; R02 = $55 = 01010101 + LD DE,(AY_R3CHBP*256)+$00 + CALL AY_WRTPSG ; R03 = $00 = XXXX0000 +; +#IF (SYSTIM != TM_NONE) + LD A, TICKFREQ / 3 ; SCHEDULE IN 1/3 SECOND TO TURN OFF SOUND + LD (AY_TIMTIK), A +; + LD HL, (VEC_TICK + 1) ; GET CUR TICKS VECTOR + LD (AY_TIMHOOK), HL ; SAVE IT INTERNALLY + LD HL, AY_TIMER ; INSTALL TIMER HOOK HANDLER + LD (VEC_TICK + 1), HL +; + LD A, $02 ; NOT READY & IN INTERUPT HANDLER + LD (AY_READY), A +#ELSE + CALL LDELAY ; HALF SECOND DELAY + LD E,$00 ; SET VOLUME OFF + CALL AY_SETV ; ON ALL CHANNELS + LD A, $01 ; READY & NOT IN INTERUPT HANDLER + LD (AY_READY), A +#ENDIF +; + XOR A ; SUCCESSFULL INIT + RET +; +#IF (SYSTIM != TM_NONE) +AY_TIMER: + LD A, (AY_TIMTIK) + DEC A + LD (AY_TIMTIK), A + JR NZ, AY_TIMER1 +; + LD E,$00 ; SET VOLUME OFF + CALL AY_SETV ; ON ALL CHANNELS + LD A, $01 ; READY & NOT IN INTERUPT HANDLER + LD (AY_READY), A +; + LD DE, AY_TIMER ; MAKE AY_TIMER A NO_OP HANDLER + LD HL, AY_TIMER1 + LD BC, 3 + LDIR +; +AY_TIMER1: + JP 0 ; OVERWRITTEN WITH NEXT HANDLER +AY_TIMHOOK: .EQU $ - 2 + +AY_TIMTIK .DB 0 ; COUNT DOWN TO FINISH BOOT BEEP +#ENDIF +; +;====================================================================== +; INITIALIZE DEVICE +;====================================================================== +; +AY_INIT: + LD DE,(AY_R7ENAB*256)+$F8 ; SET MIXER CONTROL / IO ENABLE. $F8 - 11 111 000 + JP AY_WRTPSG ; I/O PORTS = OUTPUT, NOISE CHANNEL C, B, A DISABLE, TONE CHANNEL C, B, A ENABLE +; +AY_CHKREDY: + LD A, (AY_READY) + BIT 0, A + RET NZ + + POP HL ; REMOVE LAST RETURN ADDRESS + OR $FF + RET ; RETURN NZ +; +;====================================================================== +; SET VOLUME ALL CHANNELS +;====================================================================== +; +AY_SETV: + PUSH BC + LD B,AY_TONECNT ; NUMBER OF CHANNELS + LD D,AY_R8AVOL ; BASE REGISTER FOR VOLUME +AY_SV: CALL AY_WRTPSG ; CYCLING THROUGH ALL CHANNELS + INC D + DJNZ AY_SV + POP BC + RET +; +;====================================================================== +; SOUND DRIVER FUNCTION - RESET +; +; INITIALIZE DEVICE. SET VOLUME OFF. RESET VOLUME AND TONE VARIABLES. +; +;====================================================================== +; +AY_RESET: + AUDTRACE(AYT_INIT) + CALL AY_CHKREDY ; RETURNS TO OUR CALLER IF NOT READY +; + PUSH DE + PUSH HL + CALL AY_INIT ; SET DEFAULT CHIP CONFIGURATION +; + AUDTRACE(AYT_VOLOFF) + LD E,0 ; SET VOLUME OFF + CALL AY_SETV ; ON ALL CHANNELS +; + XOR A ; SIGNAL SUCCESS + LD (AY_PENDING_VOLUME),A ; SET VOLUME TO ZERO + LD H,A + LD L,A + LD (AY_PENDING_PERIOD),HL ; SET TONE PERIOD TO ZERO +; + POP HL + POP DE + RET +; +;====================================================================== +; SOUND DRIVER FUNCTION - VOLUME +;====================================================================== +; +AY_VOLUME: + AUDTRACE(AYT_VOL) + AUDTRACE_L + AUDTRACE_CR + + LD A,L ; SAVE VOLUME + LD (AY_PENDING_VOLUME), A +; + XOR A ; SIGNAL SUCCESS + RET +; +;====================================================================== +; SOUND DRIVER FUNCTION - NOTE +;====================================================================== +; +AY_NOTE: + LD DE, AY3NOTETBL + CALL AUD_NOTE ; RETURNS PERIOD IN HL, FALL THRU +; +;====================================================================== +; SOUND DRIVER FUNCTION - PERIOD +;====================================================================== +; +AY_PERIOD: + AUDTRACE(AYT_PERIOD) + AUDTRACE_HL + AUDTRACE_CR +; + LD A,H ; IF ZERO - ERROR + OR L + JR Z,AY_PERIOD1 +; + LD A,H ; MAXIMUM TONE PERIOD IS 12-BITS + AND 11110000B ; ALLOWED RANGE IS 0001-0FFF (4095) + JR NZ,AY_PERIOD1 ; RETURN NZ IF NUMBER TOO LARGE + LD (AY_PENDING_PERIOD),HL ; SAVE AND RETURN SUCCESSFUL + XOR A ; SET SUCCESS + RET +; +AY_PERIOD1: + LD HL,$FFFF ; REQUESTED PERIOD IS LARGER + LD (AY_PENDING_PERIOD),HL ; THAN PSG CAN SUPPORT, SO + OR $FF ; SET PERIOD TO $FFFF + RET ; AND RETURN FAILURE +; +;====================================================================== +; SOUND DRIVER FUNCTION - PLAY +; B = FUNCTION +; C = AUDIO DEVICE +; D = CHANNEL +; A = EXIT STATUS +;====================================================================== +; +AY_PLAY: + AUDTRACE(AYT_PLAY) + AUDTRACE_D + AUDTRACE_CR + CALL AY_CHKREDY ; RETURNS TO OUR CALLER IF NOT READY +; + LD A, (AY_PENDING_PERIOD + 1) ; CHECK THE HIGH BYTE OF THE PERIOD + INC A + JR Z, AY_PLAY1 ; PERIOD IS TOO LARGE, UNABLE TO PLAY +; + PUSH HL + PUSH DE + LD A,D ; LIMIT CHANNEL 0-2 + AND $3 ; AND INDEX TO THE + ADD A,A ; CHANNEL REGISTER + LD D,A ; FOR THE TONE PERIOD +; + AUDTRACE(AYT_REGWR) + AUDTRACE_A + AUDTRACE_CR +; + LD HL,AY_PENDING_PERIOD ; WRITE THE LOWER + ld E,(HL) ; 8-BITS OF THE TONE PERIOD + CALL AY_WRTPSG + INC D ; NEXT REGISTER + INC HL ; NEXT BYTE + LD E,(HL) ; WRITE THE UPPER + CALL AY_WRTPSG ; 8-BITS OF THE TONE PERIOD +; + POP DE ; RECALL CHANNEL + PUSH DE ; SAVE CHANNEL +; + LD A,D ; LIMIT CHANNEL 0-2 + AND $3 ; AND INDEX TO THE + ADD A,AY_R8AVOL ; CHANNEL VOLUME + LD D,A ; REGISTER +; + AUDTRACE(AYT_REGWR) + AUDTRACE_A + AUDTRACE_CR +; + INC HL ; NEXT BYTE + LD A,(HL) ; PENDING VOLUME + RRCA ; MAP THE VOLUME + RRCA ; FROM 00-FF + RRCA ; TO 00-0F + RRCA + AND $0F + LD E,A + CALL AY_WRTPSG ; SET VOL (E) IN CHANNEL REG (D) +; + POP DE ; RECALL CHANNEL + POP HL +; + XOR A ; SIGNAL SUCCESS + RET +; +AY_PLAY1: + PUSH DE ; TURN VOLUME OFF TO STOP PLAYING + LD A,D ; LIMIT CHANNEL 0-2 + AND $3 ; AND INDEX TO THE + ADD A,AY_R8AVOL ; CHANNEL VOLUME + LD D,A ; REGISTER + LD E,0 + CALL AY_WRTPSG ; SET VOL (E) IN CHANNEL REG (D) + POP DE + OR $FF ; SIGNAL FAILURE + RET +; +;====================================================================== +; SOUND DRIVER FUNCTION - QUERY AND SUBFUNCTIONS +;====================================================================== +; +AY_QUERY: + LD A, E + CP BF_SNDQ_CHCNT ; SUB FUNCTION 01 + JR Z, AY_QUERY_CHCNT +; + CP BF_SNDQ_VOLUME ; SUB FUNCTION 02 + JR Z, AY_QUERY_VOLUME +; + CP BF_SNDQ_PERIOD ; SUB FUNCTION 03 + JR Z, AY_QUERY_PERIOD +; + CP BF_SNDQ_DEV ; SUB FUNCTION 04 + JR Z, AY_QUERY_DEV +; + OR $FF ; SIGNAL FAILURE + RET +; +AY_QUERY_CHCNT: + LD BC,(AY_TONECNT*256)+AY_NOISECNT ; RETURN NUMBER OF + XOR A ; TONE AND NOISE + RET ; CHANNELS IN BC +; +AY_QUERY_PERIOD: + LD HL, (AY_PENDING_PERIOD) ; RETURN 16-BIT PERIOD + XOR A ; IN HL REGISTER + RET +; +AY_QUERY_VOLUME: + LD A, (AY_PENDING_VOLUME) ; RETURN 8-BIT VOLUME + LD L, A ; IN L REGISTER + XOR A +; LD H, A + RET +; +AY_QUERY_DEV: + LD B, SNDDEV_AY38910 ; RETURN DEVICE IDENTIFIER + LD DE, (AY_RSEL*256)+AY_RDAT ; AND ADDRESS AND DATA PORT + XOR A + RET +; +;====================================================================== +; SOUND DRIVER FUNCTION - DURATION +;====================================================================== +; +AY_DURATION: + LD (AY_PENDING_DURATION),HL ; SET TONE DURATION + XOR A + RET +; +;====================================================================== +; SOUND DRIVER FUNCTION - DEVICE +;====================================================================== +; +AY_DEVICE: + LD D,SNDDEV_AY38910 ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL UNIT + LD C,$00 ; C := DEVICE TYPE + LD H,AYMODE ; H := MODE + LD L,AY_RSEL ; L := BASE I/O ADDRESS + XOR A + RET +; +;====================================================================== +; NON-BLOCKING INTERRUPT CODE +;====================================================================== +; +AY_DI: + LD A, (AY_READY) + BIT 1, A + RET NZ + HB_DI + RET +; +AY_EI: + LD A, (AY_READY) + BIT 1, A + RET NZ + HB_EI + RET +; +;====================================================================== +; +; WRITE DATA IN E REGISTER TO DEVICE REGISTER D +; INTERRUPTS DISABLE DURING WRITE. WRITE IN SLOW MODE IF Z180 CPU. +; +;====================================================================== +; +AY_WRTPSG: + CALL AY_DI +#IFDEF SBCV2004 + LD A,(HB_RTCVAL) ; GET CURRENT RTC LATCH VALUE + OR %00001000 ; SBC-V2-004 CHANGE + OUT (RTCIO),A ; TO HALF CLOCK SPEED +#ENDIF +#IF (CPUFAM == CPU_Z180) + IN0 A,(Z180_DCNTL) ; GET WAIT STATES + PUSH AF ; SAVE VALUE + OR %00110000 ; FORCE SLOW OPERATION (I/O W/S=3) + OUT0 (Z180_DCNTL),A ; AND UPDATE DCNTL +#ENDIF + LD A,D ; SELECT THE REGISTER WE + OUT (AY_RSEL),A ; WANT TO WRITE TO + LD A,E ; WRITE THE VALUE TO + OUT (AY_RDAT),A ; THE SELECTED REGISTER +#IF (CPUFAM == CPU_Z180) + POP AF ; GET SAVED DCNTL VALUE + OUT0 (Z180_DCNTL),A ; AND RESTORE IT +#ENDIF +#IFDEF SBCV2004 + LD A,(HB_RTCVAL) ; SBC-V2-004 CHANGE TO + OUT (RTCIO),A ; NORMAL CLOCK SPEED +#ENDIF + JP AY_EI +; +;====================================================================== +; +; READ FROM REGISTER D AND RETURN WITH RESULT IN E +; +AY_RDPSG: + CALL AY_DI +#IFDEF SBCV2004 + LD A,(HB_RTCVAL) ; GET CURRENT RTC LATCH VALUE + OR %00001000 ; SBC-V2-004 CHANGE + OUT (RTCIO),A ; TO HALF CLOCK SPEED +#ENDIF +#IF (CPUFAM == CPU_Z180) + IN0 A,(Z180_DCNTL) ; GET WAIT STATES + PUSH AF ; SAVE VALUE + OR %00110000 ; FORCE SLOW OPERATION (I/O W/S=3) + OUT0 (Z180_DCNTL),A ; AND UPDATE DCNTL +#ENDIF + LD A,D ; SELECT THE REGISTER WE + OUT (AY_RSEL),A ; WANT TO READ + IN A,(AY_RIN) ; READ SELECTED REGISTER + LD E,A +#IF (CPUFAM == CPU_Z180) + POP AF ; GET SAVED DCNTL VALUE + OUT0 (Z180_DCNTL),A ; AND RESTORE IT +#ENDIF +#IFDEF SBCV2004 + LD A,(HB_RTCVAL) ; SBC-V2-004 CHANGE TO + OUT (RTCIO),A ; NORMAL CLOCK SPEED +#ENDIF + JP AY_EI +; +;====================================================================== +; +AY_PENDING_PERIOD .DW 0 ; PENDING PERIOD (12 BITS) ; ORDER +AY_PENDING_VOLUME .DB 0 ; PENDING VOL (8 BITS) ; SIGNIFICANT +AY_PENDING_DURATION .DW 0 ; PENDING DURATION (16 BITS) +AY_READY .DB 0 ; BIT 0 -> NZ DRIVER IS READY TO RECEIVE PLAY COMMAND + ; BIT 1 -> NZ EXECUTING WITHIN TIMER HANDLER = DO NOT DIS/ENABLE INT +; +#IF AUDIOTRACE +AYT_INIT .DB "\r\nAY_INIT\r\n$" +AYT_VOLOFF .DB "\r\nAY_VOLUME OFF\r\n$" +AYT_VOL .DB "\r\nAY_VOLUME: $" +AYT_NOTE .DB "\r\nAY_NOTE: $" +AYT_PERIOD .DB "\r\nAY_PERIOD $" +AYT_PLAY .DB "\r\nAY_PLAY CH: $" +AYT_REGWR .DB "\r\nOUT AY-3-8910 $" +#ENDIF +; +;====================================================================== +; QUARTER TONE FREQUENCY TABLE +;====================================================================== +; +; THE FOLLOWING TABLE MAPS A FULL OCTAVE OF QUARTER-NOTES +; STARTING AT A# IN OCTAVE 0 TO THE CORRESPONDING PERIOD +; VALUE TO USE ON THE PSG TO ACHIEVE THE DESIRED NOTE FREQUENCY. +; +; THE FREQUENCY PRODUCED BY THE AY-3-8910 IS: +; FREQ = CLOCK / 16 / PERIOD +; +; SO, TO MAP A DESIRED FREQUENCY TO A PERIOD, WE USE: +; PERIOD = CLOCK / 16 / FREQ +; +; IN ORDER TO IMPROVE THE RESOLUTION OF THE FREQUENCY +; VALUE USED, WE ALSO MULTPLY BOTH SIDES OF THE EQUATION +; BY 100: +; PERIOD * 100 = (CLOCK / 16 / FREQ) * 100 +; +; THE RESULTING PERIOD VALUE CAN BE REPEATEDLY HALVED +; TO TO JUMP UP AS MANY OCTAVES AS DESIRED. +; +; THE FINAL VALUE IS SHIFTED BY AUD_SCALE BITS +; IN ORDER TO IMPROVE THE RESOLUTION. THIS FINAL SHIFT +; IS REMOVED WHEN IN THE AY_NOTE ROUTINE. +; +; ASSUMING A CLOCK OF 1.7897725 MHZ, THE FIRST PLAYABLE +; NOTE WILL BE A0#/B0b (HBIOS NOTE CODE 0). +; +AY_RATIO .EQU (AY_CLK * 100) / (16 >> AUD_SCALE) +; +AY3NOTETBL: + .DW AY_RATIO / 2913 ; A0#/B0b 178977250 / 2913 = 61440; PROOF: 61440 >> 3 = 7680, 3579545 / 7680 / 16 = 29.13 + .DW AY_RATIO / 2956 ; + .DW AY_RATIO / 2999 ; + .DW AY_RATIO / 3042 ; + .DW AY_RATIO / 3086 ; B0 + .DW AY_RATIO / 3131 ; + .DW AY_RATIO / 3177 ; + .DW AY_RATIO / 3223 ; + .DW AY_RATIO / 3270 ; C1 + .DW AY_RATIO / 3318 ; + .DW AY_RATIO / 3366 ; + .DW AY_RATIO / 3415 ; + .DW AY_RATIO / 3464 ; C1#/D1b + .DW AY_RATIO / 3515 ; + .DW AY_RATIO / 3566 ; + .DW AY_RATIO / 3618 ; + .DW AY_RATIO / 3670 ; D1 + .DW AY_RATIO / 3724 ; + .DW AY_RATIO / 3778 ; + .DW AY_RATIO / 3833 ; + .DW AY_RATIO / 3889 ; D1#/E1b + .DW AY_RATIO / 3945 ; + .DW AY_RATIO / 4003 ; + .DW AY_RATIO / 4061 ; + .DW AY_RATIO / 4120 ; E1 + .DW AY_RATIO / 4180 ; + .DW AY_RATIO / 4241 ; + .DW AY_RATIO / 4302 ; + .DW AY_RATIO / 4365 ; F1 + .DW AY_RATIO / 4428 ; + .DW AY_RATIO / 4493 ; + .DW AY_RATIO / 4558 ; + .DW AY_RATIO / 4624 ; F1#/G1b + .DW AY_RATIO / 4692 ; + .DW AY_RATIO / 4760 ; + .DW AY_RATIO / 4829 ; + .DW AY_RATIO / 4899 ; G1 + .DW AY_RATIO / 4971 ; + .DW AY_RATIO / 5043 ; + .DW AY_RATIO / 5116 ; + .DW AY_RATIO / 5191 ; G1#/A1b + .DW AY_RATIO / 5266 ; + .DW AY_RATIO / 5343 ; + .DW AY_RATIO / 5421 ; + .DW AY_RATIO / 5499 ; A1 + .DW AY_RATIO / 5579 ; + .DW AY_RATIO / 5661 ; + .DW AY_RATIO / 5743 ; diff --git a/Source/HBIOS/bqrtc.asm b/Source/HBIOS/bqrtc.asm index d35889e2..ce0daeb5 100644 --- a/Source/HBIOS/bqrtc.asm +++ b/Source/HBIOS/bqrtc.asm @@ -94,6 +94,10 @@ BQRTC_BUFSIZE .EQU 6 ; 6 BYTE BUFFER (YYMMDDHHMMSS) ; RTC Device Initialization Entry BQRTC_INIT: + LD A,(RTC_DISPACT) ; RTC DISPATCHER ALREADY SET? + OR A ; SET FLAGS + RET NZ ; IF ALREADY ACTIVE, ABORT +; CALL NEWLINE ; Formatting PRTS("BQRTC: IO=0x$") LD A, BQRTC_BASE @@ -127,6 +131,9 @@ BQRTC_INIT: LD A, (BQRTC_BUF_SEC) CALL PRTHEXBYTE + LD BC,BQRTC_DISPATCH + CALL RTC_SETDISP + XOR A ; Signal success RET @@ -152,6 +159,11 @@ BQRTC_DISPATCH: JP Z, BQRTC_GETALM ; Get Alarm DEC A JP Z, BQRTC_SETALM ; Set Alarm + DEC A + JP Z, BQRTC_DEVICE ; Report RTC device info + SYSCHKERR(ERR_NOFUNC) + RET + ; ; NVRAM FUNCTIONS ARE NOT AVAILABLE ; @@ -159,7 +171,8 @@ BQRTC_GETBYT: BQRTC_SETBYT: BQRTC_GETBLK: BQRTC_SETBLK: - CALL PANIC + SYSCHKERR(ERR_NOTIMPL) + RET ; RTC Get Time ; A: Result (OUT), 0=OK, Z=OK, NZ=Error @@ -321,6 +334,16 @@ BQRTC_SETALM: ; clean up and return XOR A ; Signal success RET ; And return +; +; REPORT RTC DEVICE INFO +; +BQRTC_DEVICE: + LD D,RTCDEV_BQ ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL DEVICE NUMBER + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,BQRTC_BASE ; L := BASE I/O ADDRESS + XOR A ; SIGNAL SUCCESS + RET BQRTC_SUSPEND: IN0 A, (BQRTC_CONTROL) ; Suspend Clock diff --git a/Source/HBIOS/cfg_dyno.asm b/Source/HBIOS/cfg_dyno.asm index 41c41471..66bbf61c 100644 --- a/Source/HBIOS/cfg_dyno.asm +++ b/Source/HBIOS/cfg_dyno.asm @@ -11,26 +11,33 @@ ; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS ; FOR THE PLATFORM. ; -#DEFINE PLATFORM_NAME "DYNO" +#DEFINE PLATFORM_NAME "Dyno", " [", CONFIG, "]" ; -PLATFORM .EQU PLT_DYNO ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] -CPUFAM .EQU CPU_Z180 ; CPU FAMILY: CPU_[Z80|Z180] +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_DYNO ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z180 ; CPU FAMILY: CPU_[Z80|Z180|Z280] BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) ; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT ; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW CPUOSC .EQU 18432000 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) DEFSERCFG .EQU SER_38400_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) ; RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) -MEMMGR .EQU MM_Z180 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] -RAMBIAS .EQU 512 ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_Z180 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] +RAMLOC .EQU 19 ; START OF RAM AS POWER OF 2 (2^N) IN PHYSICAL ADDRESS SPACE +RAMBIAS .EQU (1 << (RAMLOC - 10)) ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE MPGSEL_0 .EQU $78 ; Z2 MEM MGR BANK 0 PAGE SELECT REG (WRITE ONLY) MPGSEL_1 .EQU $79 ; Z2 MEM MGR BANK 1 PAGE SELECT REG (WRITE ONLY) MPGSEL_2 .EQU $7A ; Z2 MEM MGR BANK 2 PAGE SELECT REG (WRITE ONLY) @@ -41,6 +48,7 @@ Z180_BASE .EQU $C0 ; Z180: I/O BASE ADDRESS FOR INTERNAL REGISTERS Z180_CLKDIV .EQU 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .EQU 0 ; Z180: MEMORY WAIT STATES (0-3) Z180_IOWAIT .EQU 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z180_TIMER .EQU TRUE ; Z180: ENABLE Z180 SYSTEM PERIODIC TIMER ; RTCIO .EQU $0C ; RTC LATCH REGISTER ADR ; @@ -48,59 +56,132 @@ KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS ; CTCENABLE .EQU FALSE ; ENABLE ZILOG CTC SUPPORT +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT +CTCBASE .EQU $88 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU FALSE ; ENABLE CTC PERIODIC TIMER +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] ; DIAGENABLE .EQU FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING ; LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) +LEDMODE .EQU LEDMODE_STD ; LEDMODE_[STD|RTC] LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED ; DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) ; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -; -HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT -SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +PPKTRACE .EQU 1 ; PPK DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +KBDTRACE .EQU 1 ; KBD DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPKKBLOUT .EQU KBD_US ; PPK KEYBOARD LANGUAGE: KBD_[US|DE] +KBDKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +MKYKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] ; DSRTCENABLE .EQU FALSE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) ; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; BQRTCENABLE .EQU TRUE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS ; +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +DUARTCNT .EQU 1 ; DUART: NUMBER OF CHIPS TO DETECT (1-2) +DUART0BASE .EQU $A0 ; DUART 0: BASE ADDRESS OF CHIP +DUART0ACFG .EQU DEFSERCFG ; DUART 0A: SERIAL LINE CONFIG +DUART0BCFG .EQU DEFSERCFG ; DUART 0B: SERIAL LINE CONFIG +DUART1BASE .EQU $40 ; DUART 1: BASE ADDRESS OF CHIP +DUART1ACFG .EQU DEFSERCFG ; DUART 1A: SERIAL LINE CONFIG +DUART1BCFG .EQU DEFSERCFG ; DUART 1B: SERIAL LINE CONFIG +; UARTENABLE .EQU FALSE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +UARTCFG .EQU DEFSERCFG | SER_RTS ; UART: LINE CONFIG FOR UART PORTS +UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) +UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART +UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART +UART4 .EQU FALSE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU TRUE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART ; ASCIENABLE .EQU TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ASCIINTS .EQU TRUE ; ASCI: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +ASCISWAP .EQU FALSE ; ASCI: SWAP CHANNELS +ASCIBOOT .EQU 0 ; ASCI: REBOOT ON RCV CHAR (0=DISABLED) ASCI0CFG .EQU DEFSERCFG ; ASCI 0: SERIAL LINE CONFIG ASCI1CFG .EQU DEFSERCFG ; ASCI 1: SERIAL LINE CONFIG ; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +; ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) ; SIOENABLE .EQU FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +SIODEBUG .EQU FALSE ; SIO: ENABLE DEBUG OUTPUT +SIOBOOT .EQU 0 ; SIO: REBOOT ON RCV CHAR (0=DISABLED) +SIOCNT .EQU 2 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +SIO0MODE .EQU SIOMODE_RC ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] +SIO0BASE .EQU $80 ; SIO 0: REGISTERS BASE ADR +SIO0ACLK .EQU 7372800 ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0ACFG .EQU SER_115200_8N1 ; SIO 0A: SERIAL LINE CONFIG +SIO0ACTCC .EQU -1 ; SIO 0A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO0BCLK .EQU 7372800 ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0BCFG .EQU SER_115200_8N1 ; SIO 0B: SERIAL LINE CONFIG +SIO0BCTCC .EQU -1 ; SIO 0B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO1MODE .EQU SIOMODE_RC ; SIO 1: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] +SIO1BASE .EQU $84 ; SIO 1: REGISTERS BASE ADR +SIO1ACLK .EQU 7372800 ; SIO 1A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO1ACFG .EQU SER_115200_8N1 ; SIO 1A: SERIAL LINE CONFIG +SIO1ACTCC .EQU -1 ; SIO 1A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO1BCLK .EQU 7372800 ; SIO 1B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO1BCFG .EQU SER_115200_8N1 ; SIO 1B: SERIAL LINE CONFIG +SIO1BCTCC .EQU -1 ; SIO 1B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE ; XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG ; VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) -NECENABLE .EQU FALSE ; NEC: ENABLE NEC UPD7220 VIDEO/KBD DRIVER (NEC.ASM) +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .EQU TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) ; -SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) -; -AYENABLE .EQU FALSE ; AY: ENABLE AY PSG SOUND DRIVER -AYMODE .EQU AYMODE_RCZ180 ; AY: DRIVER MODE: AYMODE_[SCG/N8/RCZ80/RCZ180] -; MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM ; FDENABLE .EQU FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .EQU FDMODE_DYNO ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3|DYNO] +FDMODE .EQU FDMODE_DYNO ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 2 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] @@ -136,23 +217,57 @@ PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP PPIDE0BASE .EQU $4C ; PPIDE 0: PPI REGISTERS BASE ADR PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE1BASE .EQU $00 ; PPIDE 1: PPI REGISTERS BASE ADR +PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER +PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE2BASE .EQU $00 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] -SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU $60 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE +SDMTSWAP .EQU FALSE ; SD: SWAP THE LOGICAL ORDER OF THE SPI PORTS OF THE MT011 ; PRPENABLE .EQU FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) +PRPSDENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER SD CARD SUPPORT +PRPSDTRACE .EQU 1 ; PRP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PRPCONENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER VIDEO/KBD SUPPORT ; PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) ; HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) ; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +PIOCNT .EQU 2 ; PIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +PIO0BASE .EQU $B8 ; PIO 0: REGISTERS BASE ADR +PIO1BASE .EQU $BC ; PIO 1: REGISTERS BASE ADR +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +; PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) -PPI_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP ; UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) ; -EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +SN76489ENABLE .EQU FALSE ; SN: ENABLE SN76489 SOUND DRIVER +AUDIOTRACE .EQU FALSE ; ENABLE TRACING TO CONSOLE OF SOUND DRIVER +SN7CLK .EQU 3579545 ; SN: PSG CLOCK FREQ, ASSUME MSX STD +SNMODE .EQU SNMODE_NONE ; SN: DRIVER MODE: SNMODE_[NONE|RC|VGM] +; +AY38910ENABLE .EQU FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER +AY_CLK .EQU 1789772 ; AY: PSG CLOCK FREQ, ASSUME MSX STD +AYMODE .EQU AYMODE_NONE ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC] +; +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_Z180 ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/cfg_ezz80.asm b/Source/HBIOS/cfg_ezz80.asm deleted file mode 100644 index 20e9c5ef..00000000 --- a/Source/HBIOS/cfg_ezz80.asm +++ /dev/null @@ -1,173 +0,0 @@ -; -;================================================================================================== -; ROMWBW 2.X CONFIGURATION DEFAULTS FOR EASY Z80 -;================================================================================================== -; -; THIS FILE CONTAINS THE FULL SET OF DEFAULT CONFIGURATION SETTINGS FOR THE PLATFORM -; INDICATED ABOVE. THIS FILE SHOULD *NOT* NORMALLY BE CHANGED. INSTEAD, YOU SHOULD -; OVERRIDE ANY SETTINGS YOU WANT USING A CONFIGURATION FILE IN THE CONFIG DIRECTORY -; UNDER THIS DIRECTORY. -; -; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS -; FOR THE PLATFORM. -; -#DEFINE PLATFORM_NAME "EASYZ80" -; -PLATFORM .EQU PLT_EZZ80 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] -CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180] -BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] -BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE -HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) -USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION -; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT -; -CPUOSC .EQU 10000000 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 -DEFSERCFG .EQU SER_115200_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) -; -RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) -MEMMGR .EQU MM_Z2 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] -MPGSEL_0 .EQU $78 ; Z2 MEM MGR BANK 0 PAGE SELECT REG (WRITE ONLY) -MPGSEL_1 .EQU $79 ; Z2 MEM MGR BANK 1 PAGE SELECT REG (WRITE ONLY) -MPGSEL_2 .EQU $7A ; Z2 MEM MGR BANK 2 PAGE SELECT REG (WRITE ONLY) -MPGSEL_3 .EQU $7B ; Z2 MEM MGR BANK 3 PAGE SELECT REG (WRITE ONLY) -MPGENA .EQU $7C ; Z2 MEM MGR PAGING ENABLE REGISTER (BIT 0, WRITE ONLY) -; -RTCIO .EQU $C0 ; RTC LATCH REGISTER ADR -WDOGIO .EQU $6F ; WATCHDOG REGISTER ADR -; -KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT -KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS -; -CTCENABLE .EQU TRUE ; ENABLE ZILOG CTC SUPPORT -CTCMODE .EQU CTCMODE_EZ ; CTC MODE: CTCMODE_[ZP|Z2|EZ|RC] -CTCBASE .EQU $88 ; CTC BASE I/O ADDRESS -; -DIAGENABLE .EQU FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT -DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS -DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS -; -LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) -LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS -LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED -; -DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) -; -CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP -VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] -ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -; -HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT -SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) -; -DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) -DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] -DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) -; -BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) -BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS -; -UARTENABLE .EQU FALSE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) -; -ASCIENABLE .EQU FALSE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) -; -ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) -; -SIOENABLE .EQU TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) -SIODEBUG .EQU FALSE ; SIO: ENABLE DEBUG OUTPUT -SIOCNT .EQU 2 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP -SIO0MODE .EQU SIOMODE_EZZ80 ; SIO 0: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] -SIO0CTCC .EQU -1 ; SIO 0: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE -SIO0BASE .EQU $80 ; SIO 0: REGISTERS BASE ADR -SIO0ACLK .EQU 1843200 ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0ADIV .EQU 1 ; SIO 0A: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) -SIO0ACFG .EQU DEFSERCFG ; SIO 0A: SERIAL LINE CONFIG -SIO0BCLK .EQU 1843200 ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0BDIV .EQU 1 ; SIO 0B: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) -SIO0BCFG .EQU DEFSERCFG ; SIO 0B: SERIAL LINE CONFIG -SIO1MODE .EQU SIOMODE_RC ; SIO 1: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] -SIO1CTCC .EQU -1 ; SIO 1: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE -SIO1BASE .EQU $84 ; SIO 1: REGISTERS BASE ADR -SIO1ACLK .EQU 7372800 ; SIO 1A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO1ADIV .EQU 1 ; SIO 1A: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) -SIO1ACFG .EQU DEFSERCFG ; SIO 1A: SERIAL LINE CONFIG -SIO1BCLK .EQU 7372800 ; SIO 1B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO1BDIV .EQU 1 ; SIO 1B: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) -SIO1BCFG .EQU DEFSERCFG ; SIO 1B: SERIAL LINE CONFIG -; -XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG -; -VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) -CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) -NECENABLE .EQU FALSE ; NEC: ENABLE NEC UPD7220 VIDEO/KBD DRIVER (NEC.ASM) -TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) -VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) -; -SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) -; -AYENABLE .EQU FALSE ; AY: ENABLE AY PSG SOUND DRIVER -AYMODE .EQU AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG/N8/RCZ80/RCZ180] -; -MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) -MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -; -FDENABLE .EQU FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .EQU FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3|DYNO] -FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) -FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] -FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] -FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS -; -RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER -; -IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) -IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH -IDE0MODE .EQU IDEMODE_RC ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] -IDE0BASE .EQU $10 ; IDE 0: IO BASE ADDRESS -IDE0DATLO .EQU $00 ; IDE 0: DATA LO PORT FOR 16-BIT I/O -IDE0DATHI .EQU $00 ; IDE 0: DATA HI PORT FOR 16-BIT I/O -IDE0A8BIT .EQU TRUE ; IDE 0A (MASTER): 8 BIT XFER -IDE0B8BIT .EQU TRUE ; IDE 0B (MASTER): 8 BIT XFER -IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] -IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS -IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O -IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O -IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER -IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER -IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] -IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS -IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O -IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O -IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER -IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER -; -PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) -PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP -PPIDE0BASE .EQU $20 ; PPIDE 0: PPI REGISTERS BASE ADR -PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER -PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER -; -SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] -SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY -SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE -; -PRPENABLE .EQU FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) -; -PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) -; -HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) -; -PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD -PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) -PPI_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP -; -UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) -; -EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION diff --git a/Source/HBIOS/cfg_master.asm b/Source/HBIOS/cfg_master.asm index 17a84abc..c14de563 100644 --- a/Source/HBIOS/cfg_master.asm +++ b/Source/HBIOS/cfg_master.asm @@ -8,26 +8,33 @@ ; USED ONLY AS A REFERENCE TO HELP MANAGE THE FULL SET OF POSSIBLE SETTINGS AND ; KEEP THINGS CONSISTENT. ; -#DEFINE PLATFORM_NAME "ROMWBW" +#DEFINE PLATFORM_NAME "RomWBW", " [", CONFIG, "]" ; -PLATFORM .EQU PLT_SBC ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] -CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180] +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_SBC ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180|Z280] BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) ; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT ; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW CPUOSC .EQU 8000000 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +INTMODE .EQU 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) DEFSERCFG .EQU SER_38400_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) ; RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) -MEMMGR .EQU MM_NONE ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] -RAMBIAS .EQU 0 ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_NONE ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] +RAMLOC .EQU 19 ; START OF RAM AS POWER OF 2 (2^N) IN PHYSICAL ADDRESS SPACE +RAMBIAS .EQU (1 << (RAMLOC - 10)) ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE MPCL_RAM .EQU $78 ; SBC MEM MGR RAM PAGE SELECT REG (WRITE ONLY) MPCL_ROM .EQU $7C ; SBC MEM MGR ROM PAGE SELECT REG (WRITE ONLY) MPGSEL_0 .EQU $78 ; Z2 MEM MGR BANK 0 PAGE SELECT REG (WRITE ONLY) @@ -40,6 +47,13 @@ Z180_BASE .EQU $40 ; Z180: I/O BASE ADDRESS FOR INTERNAL REGISTERS Z180_CLKDIV .EQU 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .EQU 0 ; Z180: MEMORY WAIT STATES (0-3) Z180_IOWAIT .EQU 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z180_TIMER .EQU FALSE ; Z180: ENABLE Z180 SYSTEM PERIODIC TIMER +; +Z280_MEMLOWAIT .EQU 0 ; Z280: LOW 8MB MEMORY WAIT STATES (0-3) +Z280_MEMHIWAIT .EQU 0 ; Z280: HIGH 8MB MEMORY WAIT STATES (0-3) +Z280_IOWAIT .EQU 1 ; Z280: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z280_INTWAIT .EQU 0 ; Z280: INT ACK WAIT STATUS (0-3) +Z280_TIMER .EQU FALSE ; Z280: ENABLE INTERNAL Z280 SYSTEM PERIODIC TIMER ; N8_PPI0 .EQU $80 ; N8: FIRST PARALLEL PORT REGISTERS BASE ADR N8_PPI1 .EQU $84 ; N8: SECOND PARALLEL PORT REGISTERS BASE ADR @@ -48,63 +62,122 @@ N8_ACR .EQU $94 ; N8: AUXILLARY CONTROL REGISTER (ACR) ADR N8_RMAP .EQU $96 ; N8: ROM PAGE REGISTER ADR N8_DEFACR .EQU $1B ; N8: AUX CTL REGISTER DEFAULT VALUE (QUIESCIENT STATE) ; +RPH_PPI0 .EQU $88 ; RPH: FIRST PARALLEL PORT REGISTERS BASE ADR +RPH_RTC .EQU $84 ; RPH: RTC LATCH REGISTER ADR +RPH_ACR .EQU $80 ; RPH: AUXILLARY CONTROL REGISTER (ACR) ADR +RPH_DEFACR .EQU $00 ; RPH: AUX CTL REGISTER DEFAULT VALUE (QUIESCIENT STATE) +; MK4_IDE .EQU $80 ; MK4: IDE REGISTERS BASE ADR MK4_XAR .EQU $88 ; MK4: EXTERNAL ADDRESS REGISTER (XAR) ADR MK4_SD .EQU $89 ; MK4: SD CARD CONTROL REGISTER ADR MK4_RTC .EQU $8A ; MK4: RTC LATCH REGISTER ADR ; RTCIO .EQU $70 ; RTC LATCH REGISTER ADR -WDOGIO .EQU $6F ; WATCHDOG REGISTER ADR -PPIBASE .EQU $60 ; PRIMARY PARALLEL PORT REGISTERS BASE ADR ; KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS ; CTCENABLE .EQU FALSE ; ENABLE ZILOG CTC SUPPORT -CTCMODE .EQU CTCMODE_ZP ; CTC MODE: CTCMODE_[ZP|Z2|EZ|RC] -CTCBASE .EQU $20 ; CTC BASE I/O ADDRESS +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT +CTCBASE .EQU $B0 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU FALSE ; ENABLE CTC PERIODIC TIMER +CTCMODE .EQU CTCMODE_CTR ; CTC MODE: CTCMODE_[NONE|CTR|TIM16|TIM256] +CTCPRE .EQU 256 ; PRESCALE CONSTANT (1-256) +CTCPRECH .EQU 2 ; PRESCALE CHANNEL (0-3) +CTCTIMCH .EQU 3 ; TIMER CHANNEL (0-3) +CTCOSC .EQU 614400 ; CTC CLOCK FREQUENCY +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +SKZDIV .EQU DIV_1 ; UART CLK (CLK2) DIVIDER FOR Z80-512K +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] +WDOGIO .EQU $6F ; WATCHDOG REGISTER ADR ; DIAGENABLE .EQU FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING ; LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) +LEDMODE .EQU LEDMODE_STD ; LEDMODE_[STD|RTC] LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED ; -DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) +DSKYENABLE .EQU FALSE ; ENABLES DSKY +DSKYMODE .EQU DSKYMODE_V1 ; DSKY VERSION: DSKYMODE_[V1|NG] +DSKYPPIBASE .EQU $60 ; BASE I/O ADDRESS OF DSKY PPI +DSKYOSC .EQU 3000000 ; OSCILLATOR FREQ FOR DSKYNG (IN HZ) ; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPKTRACE .EQU 1 ; PPK DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) KBDTRACE .EQU 1 ; KBD DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPKKBLOUT .EQU KBD_US ; PPK KEYBOARD LANGUAGE: KBD_[US|DE] KBDKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] -; -HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT -SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +MKYENABLE .EQU FALSE ; MSX 8255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +MKYKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] ; DSRTCENABLE .EQU FALSE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) ; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS ; +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +DUARTCNT .EQU 1 ; DUART: NUMBER OF CHIPS TO DETECT (1-2) +DUART0BASE .EQU $A0 ; DUART 0: BASE ADDRESS OF CHIP +DUART0ACFG .EQU DEFSERCFG ; DUART 0A: SERIAL LINE CONFIG +DUART0BCFG .EQU DEFSERCFG ; DUART 0B: SERIAL LINE CONFIG +DUART1BASE .EQU $40 ; DUART 1: BASE ADDRESS OF CHIP +DUART1ACFG .EQU DEFSERCFG ; DUART 1A: SERIAL LINE CONFIG +DUART1BCFG .EQU DEFSERCFG ; DUART 1B: SERIAL LINE CONFIG +; UARTENABLE .EQU FALSE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS UARTCASSPD .EQU SER_300_8N1 ; UART: ECB CASSETTE UART DEFAULT SPEED UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART UART4 .EQU FALSE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU FALSE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART ; ASCIENABLE .EQU FALSE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ASCIINTS .EQU TRUE ; ASCI: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +ASCISWAP .EQU FALSE ; ASCI: SWAP CHANNELS +ASCIBOOT .EQU 0 ; ASCI: REBOOT ON RCV CHAR (0=DISABLED) ASCI0CFG .EQU DEFSERCFG ; ASCI 0: SERIAL LINE CONFIG ASCI1CFG .EQU DEFSERCFG ; ASCI 1: SERIAL LINE CONFIG ; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +Z2UOSC .EQU 1843200 ; Z2U: OSC FREQUENCY IN MHZ +Z2UOSCEXT .EQU TRUE ; Z2U: USE EXTERNAL OSCILLATOR +Z2U0BASE .EQU $10 ; Z2U 0: BASE I/O ADDRESS +Z2U0CFG .EQU DEFSERCFG ; Z2U 0: SERIAL LINE CONFIG +Z2U0HFC .EQU FALSE ; Z2U 0: ENABLE HARDWARE FLOW CONTROL +; ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) ACIADEBUG .EQU FALSE ; ACIA: ENABLE DEBUG OUTPUT ACIACNT .EQU 1 ; ACIA: NUMBER OF CHIPS TO DETECT (1-2) @@ -119,47 +192,50 @@ ACIA1CFG .EQU DEFSERCFG ; ACIA 1: SERIAL LINE CONFIG (SEE STD.ASM) ; SIOENABLE .EQU FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) SIODEBUG .EQU FALSE ; SIO: ENABLE DEBUG OUTPUT +SIOBOOT .EQU 0 ; SIO: REBOOT ON RCV CHAR (0=DISABLED) SIOCNT .EQU 2 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP -SIO0MODE .EQU SIOMODE_RC ; SIO 0: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] -SIO0CTCC .EQU -1 ; SIO 0: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE +SIO0MODE .EQU SIOMODE_RC ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] SIO0BASE .EQU $80 ; SIO 0: REGISTERS BASE ADR SIO0ACLK .EQU CPUOSC ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0ADIV .EQU 1 ; SIO 0A: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO0ACFG .EQU DEFSERCFG ; SIO 0A: SERIAL LINE CONFIG +SIO0ACTCC .EQU -1 ; SIO 0A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE SIO0BCLK .EQU CPUOSC ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0BDIV .EQU 1 ; SIO 0B: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO0BCFG .EQU DEFSERCFG ; SIO 0B: SERIAL LINE CONFIG -SIO1MODE .EQU SIOMODE_RC ; SIO 1: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] -SIO1CTCC .EQU -1 ; SIO 1: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE +SIO0BCTCC .EQU -1 ; SIO 0B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO1MODE .EQU SIOMODE_RC ; SIO 1: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] SIO1BASE .EQU $84 ; SIO 1: REGISTERS BASE ADR SIO1ACLK .EQU CPUOSC ; SIO 1A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO1ADIV .EQU 1 ; SIO 1A: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO1ACFG .EQU DEFSERCFG ; SIO 1A: SERIAL LINE CONFIG +SIO1ACTCC .EQU -1 ; SIO 1A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE SIO1BCLK .EQU CPUOSC ; SIO 1B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO1BDIV .EQU 1 ; SIO 1B: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO1BCFG .EQU DEFSERCFG ; SIO 1B: SERIAL LINE CONFIG +SIO1BCTCC .EQU -1 ; SIO 1B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE ; XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG ; VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) VDUSIZ .EQU V80X25 ; VDU: DISPLAY FORMAT [V80X24|V80X25|V80X30] CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) -NECENABLE .EQU FALSE ; NEC: ENABLE NEC UPD7220 VIDEO/KBD DRIVER (NEC.ASM) +CVDUMODE .EQU CVDUMODE_ECB ; CVDU: CVDU MODE: CVDUMODE_[NONE|ECB|MBC] +CVDUMON .EQU CVDUMON_CGA ; CVDU: CVDU MONITOR SETUP: CVDUMON_[NONE|CGA|EGA] +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) +GDCMODE .EQU GDCMODE_RPH ; GDC: GDC MODE: GDCMODE_[NONE|ECB|RPH] +GDCMON .EQU GDCMON_EGA ; GDC: GDC MONITOR SETUP: GDCMON_[NONE|CGA|EGA] TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) -TMSMODE .EQU TMSMODE_NONE ; TMS: DRIVER MODE: TMSMODE_[SCG/N8] +TMSMODE .EQU TMSMODE_NONE ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) VGASIZ .EQU V80X25 ; VGA: DISPLAY FORMAT [V80X25|V80X30|V80X43] ; -SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) -; -AYENABLE .EQU FALSE ; AY: ENABLE AY PSG SOUND DRIVER -AYMODE .EQU AYMODE_NONE ; AY: DRIVER MODE: AYMODE_[SCG/N8/RCZ80/RCZ180] -; MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM ; FDENABLE .EQU FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .EQU FDMODE_NONE ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3|DYNO] +FDMODE .EQU FDMODE_NONE ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 2 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] @@ -199,15 +275,17 @@ PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER PPIDE1BASE .EQU $20 ; PPIDE 1: PPI REGISTERS BASE ADR PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER -PPIDE2BASE .EQU $44 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2BASE .EQU $14 ; PPIDE 2: PPI REGISTERS BASE ADR PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDMODE .EQU SDMODE_NONE ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] -SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +SDMODE .EQU SDMODE_NONE ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU $60 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE +SDMTSWAP .EQU FALSE ; SD: SWAP THE LOGICAL ORDER OF THE SPI PORTS OF THE MT011 ; PRPENABLE .EQU FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) PRPSDENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER SD CARD SUPPORT @@ -215,6 +293,7 @@ PRPSDTRACE .EQU 1 ; PRP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PRPCONENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER VIDEO/KBD SUPPORT ; PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) +PPPBASE .EQU $60 ; PPP: PPI REGISTERS BASE ADDRESS PPPSDENABLE .EQU TRUE ; PPP: ENABLE PPP DRIVER SD CARD SUPPORT PPPSDTRACE .EQU 1 ; PPP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPPCONENABLE .EQU TRUE ; PPP: ENABLE PPP DRIVER VIDEO/KBD SUPPORT @@ -222,13 +301,40 @@ PPPCONENABLE .EQU TRUE ; PPP: ENABLE PPP DRIVER VIDEO/KBD SUPPORT HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) HDSKTRACE .EQU 1 ; HDSK: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) ; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +PIOCNT .EQU 2 ; PIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +PIO0BASE .EQU $B8 ; PIO 0: REGISTERS BASE ADR +PIO1BASE .EQU $BC ; PIO 1: REGISTERS BASE ADR +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +LPTCNT .EQU 1 ; LPT: NUMBER OF CHIPS TO DETECT (1-2) +LPT0BASE .EQU $E8 ; LPT 0: REGISTERS BASE ADR +LPT1BASE .EQU $EC ; LPT 1: REGISTERS BASE ADR +; PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD PIO4BASE .EQU $90 ; PIO: PIO REGISTERS BASE ADR FOR ECB 4P BOARD PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) PIOZBASE .EQU $88 ; PIO: PIO REGISTERS BASE ADR FOR ECB ZP BOARD -PPI_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIOSBASE .EQU $60 ; PIO: PIO REGISTERS BASE ADR FOR SBC PPI ; UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) UFBASE .EQU $0C ; UF: REGISTERS BASE ADR ; -EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +SN76489ENABLE .EQU FALSE ; SN: ENABLE SN76489 SOUND DRIVER +AUDIOTRACE .EQU FALSE ; ENABLE TRACING TO CONSOLE OF SOUND DRIVER +SN7CLK .EQU 3579545 ; SN: PSG CLOCK FREQ, ASSUME MSX STD +SNMODE .EQU SNMODE_NONE ; SN: DRIVER MODE: SNMODE_[NONE|RC|VGM] +; +AY38910ENABLE .EQU FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER +AY_CLK .EQU 1789772 ; AY: PSG CLOCK FREQ, ASSUME MSX STD +AYMODE .EQU AYMODE_NONE ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC] +; +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_NONE ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/cfg_mbc.asm b/Source/HBIOS/cfg_mbc.asm new file mode 100644 index 00000000..e8b42400 --- /dev/null +++ b/Source/HBIOS/cfg_mbc.asm @@ -0,0 +1,265 @@ +; +;================================================================================================== +; ROMWBW 2.X CONFIGURATION DEFAULTS FOR MBC +;================================================================================================== +; +; THIS FILE CONTAINS THE FULL SET OF DEFAULT CONFIGURATION SETTINGS FOR THE PLATFORM +; INDICATED ABOVE. THIS FILE SHOULD *NOT* NORMALLY BE CHANGED. INSTEAD, YOU SHOULD +; OVERRIDE ANY SETTINGS YOU WANT USING A CONFIGURATION FILE IN THE CONFIG DIRECTORY +; UNDER THIS DIRECTORY. +; +; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS +; FOR THE PLATFORM. +; +#DEFINE PLATFORM_NAME "Nhyodyne", " [", CONFIG, "]" +; +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_MBC ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180|Z280] +BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] +BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE +HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) +USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) +; +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT +; +CPUSPDCAP .EQU SPD_HILO ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_LOW ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW +CPUOSC .EQU 8000000 ; CPU OSC FREQ IN MHZ +INTMODE .EQU 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) +DEFSERCFG .EQU SER_38400_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) +; +RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_MBC ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] +MPCL_RAM .EQU $78 ; SBC MEM MGR RAM PAGE SELECT REG (WRITE ONLY) +MPCL_ROM .EQU $7C ; SBC MEM MGR ROM PAGE SELECT REG (WRITE ONLY) +; +RTCIO .EQU $70 ; RTC LATCH REGISTER ADR +; +KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT +KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS +; +CTCENABLE .EQU TRUE ; ENABLE ZILOG CTC SUPPORT +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT +CTCBASE .EQU $B0 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU TRUE ; ENABLE CTC PERIODIC TIMER +CTCMODE .EQU CTCMODE_CTR ; CTC MODE: CTCMODE_[NONE|CTR|TIM16|TIM256] +CTCPRE .EQU 256 ; PRESCALE CONSTANT (1-256) +CTCPRECH .EQU 2 ; PRESCALE CHANNEL (0-3) +CTCTIMCH .EQU 3 ; TIMER CHANNEL (0-3) +CTCOSC .EQU (4915200/8) ; CTC CLOCK FREQUENCY +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] +; +DIAGENABLE .EQU FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT +DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS +DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING +; +LEDENABLE .EQU TRUE ; ENABLES STATUS LED +LEDMODE .EQU LEDMODE_RTC ; LEDMODE_[STD|RTC] +LEDPORT .EQU RTCIO ; STATUS LED PORT ADDRESS +LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED +; +DSKYENABLE .EQU FALSE ; ENABLES DSKY +DSKYMODE .EQU DSKYMODE_V1 ; DSKY VERSION: DSKYMODE_[V1|NG] +DSKYPPIBASE .EQU $60 ; BASE I/O ADDRESS OF DSKY PPI +DSKYOSC .EQU 3000000 ; OSCILLATOR FREQ FOR DSKYNG (IN HZ) +; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE +CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPKTRACE .EQU 1 ; PPK DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +KBDTRACE .EQU 1 ; KBD DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPKKBLOUT .EQU KBD_US ; PPK KEYBOARD LANGUAGE: KBD_[US|DE] +KBDKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +MKYKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] +; +DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] +DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) +; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; +BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) +BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS +; +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; +UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS +UARTCASSPD .EQU SER_300_8N1 ; UART: ECB CASSETTE UART DEFAULT SPEED +UARTSBC .EQU TRUE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) +UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART +UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART +UART4 .EQU FALSE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU FALSE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU TRUE ; UART: AUTO-DETECT DUAL UART +; +ASCIENABLE .EQU FALSE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +; +ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +; +SIOENABLE .EQU TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +SIODEBUG .EQU FALSE ; SIO: ENABLE DEBUG OUTPUT +SIOBOOT .EQU 0 ; SIO: REBOOT ON RCV CHAR (0=DISABLED) +SIOCNT .EQU 1 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +SIO0MODE .EQU SIOMODE_ZP ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] +SIO0BASE .EQU $B0 ; SIO 0: REGISTERS BASE ADR +SIO0ACLK .EQU (4915200/8) ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0ACFG .EQU DEFSERCFG ; SIO 0A: SERIAL LINE CONFIG +SIO0ACTCC .EQU -1 ; SIO 0A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO0BCLK .EQU (4915200/8) ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0BCFG .EQU DEFSERCFG ; SIO 0B: SERIAL LINE CONFIG +SIO0BCTCC .EQU -1 ; SIO 0B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +; +XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG +; +VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) +VDUSIZ .EQU V80X25 ; VDU: DISPLAY FORMAT [V80X24|V80X25|V80X30] +CVDUENABLE .EQU TRUE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) +CVDUMODE .EQU CVDUMODE_MBC ; CVDU: CVDU MODE: CVDUMODE_[NONE|ECB|MBC] +CVDUMON .EQU CVDUMON_CGA ; CVDU: CVDU MONITOR SETUP: CVDUMON_[NONE|CGA|EGA] +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) +TMSENABLE .EQU TRUE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .EQU TMSMODE_MBC ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) +VGASIZ .EQU V80X25 ; VGA: DISPLAY FORMAT [V80X25|V80X30|V80X43] +; +MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK +MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM +; +; +FDENABLE .EQU FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .EQU FDMODE_MBC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 2 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) +FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) +FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] +FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] +FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS +; +RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER +RFCNT .EQU 1 ; RF: NUMBER OF RAM FLOPPY UNITS (1-4) +; +IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_DIO ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $20 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $20 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $28 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU FALSE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU FALSE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER +; +PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $60 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE1BASE .EQU $20 ; PPIDE 1: PPI REGISTERS BASE ADR +PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER +PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE2BASE .EQU $14 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +; +SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDMODE .EQU SDMODE_JUHA ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU $60 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY +SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE +; +PRPENABLE .EQU FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) +PRPSDENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER SD CARD SUPPORT +PRPSDTRACE .EQU 1 ; PRP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PRPCONENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER VIDEO/KBD SUPPORT +; +PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) +; +HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) +HDSKTRACE .EQU 1 ; HDSK: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +; +PIOENABLE .EQU TRUE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +PIOCNT .EQU 2 ; PIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +PIO0BASE .EQU $B8 ; PIO 0: REGISTERS BASE ADR +PIO1BASE .EQU $BC ; PIO 1: REGISTERS BASE ADR +; +LPTENABLE .EQU TRUE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +LPTCNT .EQU 1 ; LPT: NUMBER OF CHIPS TO DETECT (1-2) +LPT0BASE .EQU $E8 ; LPT 0: REGISTERS BASE ADR +LPT1BASE .EQU $EC ; LPT 1: REGISTERS BASE ADR +; +PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD +PIO4BASE .EQU $90 ; PIO: PIO REGISTERS BASE ADR FOR ECB 4P BOARD +PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) +PIOZBASE .EQU $88 ; PIO: PIO REGISTERS BASE ADR FOR ECB ZP BOARD +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIOSBASE .EQU $60 ; PIO: PIO REGISTERS BASE ADR FOR SBC PPI +; +UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) +UFBASE .EQU $0C ; UF: REGISTERS BASE ADR +; +SN76489ENABLE .EQU FALSE ; SN: ENABLE SN76489 SOUND DRIVER +AUDIOTRACE .EQU FALSE ; ENABLE TRACING TO CONSOLE OF SOUND DRIVER +SN7CLK .EQU 3579545 ; SN: PSG CLOCK FREQ, ASSUME MSX STD +SNMODE .EQU SNMODE_NONE ; SN: DRIVER MODE: SNMODE_[NONE|RC|VGM] +; +AY38910ENABLE .EQU FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER +AY_CLK .EQU 1789772 ; AY: PSG CLOCK FREQ, ASSUME MSX STD +AYMODE .EQU AYMODE_MBC ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC] +; +SPKENABLE .EQU TRUE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_MBC ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) + diff --git a/Source/HBIOS/cfg_mk4.asm b/Source/HBIOS/cfg_mk4.asm index e8f9da73..2a3f618a 100644 --- a/Source/HBIOS/cfg_mk4.asm +++ b/Source/HBIOS/cfg_mk4.asm @@ -11,31 +11,39 @@ ; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS ; FOR THE PLATFORM. ; -#DEFINE PLATFORM_NAME "MARK IV" +#DEFINE PLATFORM_NAME "Mark IV", " [", CONFIG, "]" ; -PLATFORM .EQU PLT_MK4 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] -CPUFAM .EQU CPU_Z180 ; CPU FAMILY: CPU_[Z80|Z180] +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_MK4 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z180 ; CPU FAMILY: CPU_[Z80|Z180|Z280] BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) ; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT ; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW CPUOSC .EQU 18432000 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) DEFSERCFG .EQU SER_38400_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) ; RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) -MEMMGR .EQU MM_Z180 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] -RAMBIAS .EQU 512 ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_Z180 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] +RAMLOC .EQU 19 ; START OF RAM AS POWER OF 2 (2^N) IN PHYSICAL ADDRESS SPACE +RAMBIAS .EQU (1 << (RAMLOC - 10)) ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE ; Z180_BASE .EQU $40 ; Z180: I/O BASE ADDRESS FOR INTERNAL REGISTERS Z180_CLKDIV .EQU 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .EQU 0 ; Z180: MEMORY WAIT STATES (0-3) Z180_IOWAIT .EQU 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z180_TIMER .EQU TRUE ; Z180: ENABLE Z180 SYSTEM PERIODIC TIMER ; MK4_IDE .EQU $80 ; MK4: IDE REGISTERS BASE ADR MK4_XAR .EQU $88 ; MK4: EXTERNAL ADDRESS REGISTER (XAR) ADR @@ -48,73 +56,125 @@ KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS ; CTCENABLE .EQU FALSE ; ENABLE ZILOG CTC SUPPORT +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT +CTCBASE .EQU $B0 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU FALSE ; ENABLE CTC PERIODIC TIMER +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] ; DIAGENABLE .EQU FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING ; LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) +LEDMODE .EQU LEDMODE_STD ; LEDMODE_[STD|RTC] LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED ; -DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) +DSKYENABLE .EQU FALSE ; ENABLES DSKY +DSKYMODE .EQU DSKYMODE_V1 ; DSKY VERSION: DSKYMODE_[V1|NG] +DSKYPPIBASE .EQU $60 ; BASE I/O ADDRESS OF DSKY PPI +DSKYOSC .EQU 3000000 ; OSCILLATOR FREQ FOR DSKYNG (IN HZ) ; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPKTRACE .EQU 1 ; PPK DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) KBDTRACE .EQU 1 ; KBD DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPKKBLOUT .EQU KBD_US ; PPK KEYBOARD LANGUAGE: KBD_[US|DE] KBDKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] -; -HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT -SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +MKYKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] ; DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) ; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS ; +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS UARTCASSPD .EQU SER_300_8N1 ; UART: ECB CASSETTE UART DEFAULT SPEED UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) UARTCAS .EQU TRUE ; UART: AUTO-DETECT ECB CASSETTE UART UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART UART4 .EQU TRUE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU FALSE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART ; ASCIENABLE .EQU TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ASCIINTS .EQU TRUE ; ASCI: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +ASCISWAP .EQU FALSE ; ASCI: SWAP CHANNELS +ASCIBOOT .EQU 0 ; ASCI: REBOOT ON RCV CHAR (0=DISABLED) ASCI0CFG .EQU DEFSERCFG ; ASCI 0: SERIAL LINE CONFIG ASCI1CFG .EQU DEFSERCFG ; ASCI 1: SERIAL LINE CONFIG ; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +; ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) ; SIOENABLE .EQU FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +SIODEBUG .EQU FALSE ; SIO: ENABLE DEBUG OUTPUT +SIOBOOT .EQU 0 ; SIO: REBOOT ON RCV CHAR (0=DISABLED) +SIOCNT .EQU 1 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +SIO0MODE .EQU SIOMODE_ZP ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] +SIO0BASE .EQU $B0 ; SIO 0: REGISTERS BASE ADR +SIO0ACLK .EQU (4915200/8) ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0ACFG .EQU DEFSERCFG ; SIO 0A: SERIAL LINE CONFIG +SIO0ACTCC .EQU -1 ; SIO 0A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO0BCLK .EQU (4915200/8) ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0BCFG .EQU DEFSERCFG ; SIO 0B: SERIAL LINE CONFIG +SIO0BCTCC .EQU -1 ; SIO 0B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE ; XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG ; VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) VDUSIZ .EQU V80X25 ; VDU: DISPLAY FORMAT [V80X24|V80X25|V80X30] CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) -NECENABLE .EQU FALSE ; NEC: ENABLE NEC UPD7220 VIDEO/KBD DRIVER (NEC.ASM) +CVDUMODE .EQU CVDUMODE_ECB ; CVDU: CVDU MODE: CVDUMODE_[NONE|ECB|MBC] +CVDUMON .EQU CVDUMON_EGA ; CVDU: CVDU MONITOR SETUP: CVDUMON_[NONE|CGA|EGA] +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) -TMSMODE .EQU TMSMODE_SCG ; TMS: DRIVER MODE: TMSMODE_[SCG/N8] +TMSMODE .EQU TMSMODE_SCG ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) VGASIZ .EQU V80X25 ; VGA: DISPLAY FORMAT [V80X25|V80X30|V80X43] ; -SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) -; -AYENABLE .EQU FALSE ; AY: ENABLE AY PSG SOUND DRIVER -AYMODE .EQU AYMODE_SCG ; AY: DRIVER MODE: AYMODE_[SCG/N8/RCZ80/RCZ180] -; MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM ; FDENABLE .EQU FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .EQU FDMODE_N8 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3|DYNO] +FDMODE .EQU FDMODE_DIDE ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 2 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] @@ -148,7 +208,7 @@ IDE2B8BIT .EQU FALSE ; IDE 2B (MASTER): 8 BIT XFER PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPIDECNT .EQU 2 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP -PPIDE0BASE .EQU $44 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0BASE .EQU $14 ; PPIDE 0: PPI REGISTERS BASE ADR PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER PPIDE1BASE .EQU $20 ; PPIDE 1: PPI REGISTERS BASE ADR @@ -159,8 +219,9 @@ PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDMODE .EQU SDMODE_MK4 ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] -SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +SDMODE .EQU SDMODE_MK4 ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU $60 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) SDCSIOFAST .EQU TRUE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE ; @@ -170,19 +231,47 @@ PRPSDTRACE .EQU 1 ; PRP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PRPCONENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER VIDEO/KBD SUPPORT ; PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) +PPPBASE .EQU $60 ; PPP: PPI REGISTERS BASE ADDRESS PPPSDENABLE .EQU TRUE ; PPP: ENABLE PPP DRIVER SD CARD SUPPORT PPPSDTRACE .EQU 1 ; PPP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPPCONENABLE .EQU TRUE ; PPP: ENABLE PPP DRIVER VIDEO/KBD SUPPORT ; HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) ; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +PIOCNT .EQU 2 ; PIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +PIO0BASE .EQU $B8 ; PIO 0: REGISTERS BASE ADR +PIO1BASE .EQU $BC ; PIO 1: REGISTERS BASE ADR +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +LPTCNT .EQU 1 ; LPT: NUMBER OF CHIPS TO DETECT (1-2) +LPT0BASE .EQU $E8 ; LPT 0: REGISTERS BASE ADR +LPT1BASE .EQU $EC ; LPT 1: REGISTERS BASE ADR +; PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD PIO4BASE .EQU $90 ; PIO: PIO REGISTERS BASE ADR FOR ECB 4P BOARD PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) PIOZBASE .EQU $88 ; PIO: PIO REGISTERS BASE ADR FOR ECB ZP BOARD -PPI_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIOSBASE .EQU $60 ; PIO: PIO REGISTERS BASE ADR FOR SBC PPI ; UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) UFBASE .EQU $0C ; UF: REGISTERS BASE ADR ; -EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +SN76489ENABLE .EQU FALSE ; SN: ENABLE SN76489 SOUND DRIVER +AUDIOTRACE .EQU FALSE ; ENABLE TRACING TO CONSOLE OF SOUND DRIVER +SN7CLK .EQU 3579545 ; SN: PSG CLOCK FREQ, ASSUME MSX STD +SNMODE .EQU SNMODE_VGM ; SN: DRIVER MODE: SNMODE_[NONE|RC|VGM] +; +AY38910ENABLE .EQU FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER +AY_CLK .EQU 1789772 ; AY: PSG CLOCK FREQ, ASSUME MSX STD +AYMODE .EQU AYMODE_SCG ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC] +; +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_ECB ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/cfg_n8.asm b/Source/HBIOS/cfg_n8.asm index 6e60cd26..3d98e44d 100644 --- a/Source/HBIOS/cfg_n8.asm +++ b/Source/HBIOS/cfg_n8.asm @@ -11,31 +11,39 @@ ; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS ; FOR THE PLATFORM. ; -#DEFINE PLATFORM_NAME "N8" +#DEFINE PLATFORM_NAME "RetroBrew N8", " [", CONFIG, "]" ; -PLATFORM .EQU PLT_N8 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] -CPUFAM .EQU CPU_Z180 ; CPU FAMILY: CPU_[Z80|Z180] +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_N8 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z180 ; CPU FAMILY: CPU_[Z80|Z180|Z280] BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) ; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT ; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW CPUOSC .EQU 18432000 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) DEFSERCFG .EQU SER_38400_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) ; RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) -MEMMGR .EQU MM_N8 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_N8 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] RAMBIAS .EQU 0 ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE +RAMLOC .EQU 0 ; START OF RAM AS POWER OF 2 (2^N) IN PHYSICAL ADDRESS SPACE ; Z180_BASE .EQU $40 ; Z180: I/O BASE ADDRESS FOR INTERNAL REGISTERS Z180_CLKDIV .EQU 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .EQU 0 ; Z180: MEMORY WAIT STATES (0-3) Z180_IOWAIT .EQU 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z180_TIMER .EQU TRUE ; Z180: ENABLE Z180 SYSTEM PERIODIC TIMER ; N8_PPI0 .EQU $80 ; N8: FIRST PARALLEL PORT REGISTERS BASE ADR N8_PPI1 .EQU $84 ; N8: SECOND PARALLEL PORT REGISTERS BASE ADR @@ -45,79 +53,130 @@ N8_RMAP .EQU $96 ; N8: ROM PAGE REGISTER ADR N8_DEFACR .EQU $1B ; N8: AUX CTL REGISTER DEFAULT VALUE (QUIESCIENT STATE) ; RTCIO .EQU N8_RTC ; RTC LATCH REGISTER ADR -PPIBASE .EQU N8_PPI0 ; PRIMARY PARALLEL PORT REGISTERS BASE ADR ; KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS ; CTCENABLE .EQU FALSE ; ENABLE ZILOG CTC SUPPORT +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT +CTCBASE .EQU $B0 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU FALSE ; ENABLE CTC PERIODIC TIMER +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] ; DIAGENABLE .EQU FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING ; -LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) -LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS +LEDENABLE .EQU FALSE ; ENABLES STATUS LED +LEDMODE .EQU LEDMODE_RTC ; LEDMODE_[STD|RTC] +LEDPORT .EQU RTCIO ; STATUS LED PORT ADDRESS LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED ; -DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) +DSKYENABLE .EQU FALSE ; ENABLES DSKY +DSKYMODE .EQU DSKYMODE_V1 ; DSKY VERSION: DSKYMODE_[V1|NG] +DSKYPPIBASE .EQU N8_PPI0 ; BASE I/O ADDRESS OF DSKY PPI +DSKYOSC .EQU 3000000 ; OSCILLATOR FREQ FOR DSKYNG (IN HZ) ; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPKTRACE .EQU 1 ; PPK DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) KBDTRACE .EQU 1 ; KBD DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPKKBLOUT .EQU KBD_US ; PPK KEYBOARD LANGUAGE: KBD_[US|DE] KBDKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] -; -HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT -SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +MKYKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] ; DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) ; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS ; +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS UARTCASSPD .EQU SER_300_8N1 ; UART: ECB CASSETTE UART DEFAULT SPEED UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) UARTCAS .EQU TRUE ; UART: AUTO-DETECT ECB CASSETTE UART UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART UART4 .EQU TRUE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU FALSE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART ; ASCIENABLE .EQU TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ASCIINTS .EQU TRUE ; ASCI: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +ASCISWAP .EQU FALSE ; ASCI: SWAP CHANNELS +ASCIBOOT .EQU 0 ; ASCI: REBOOT ON RCV CHAR (0=DISABLED) ASCI0CFG .EQU DEFSERCFG ; ASCI 0: SERIAL LINE CONFIG ASCI1CFG .EQU DEFSERCFG ; ASCI 1: SERIAL LINE CONFIG ; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +; ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) ; SIOENABLE .EQU FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +SIODEBUG .EQU FALSE ; SIO: ENABLE DEBUG OUTPUT +SIOBOOT .EQU 0 ; SIO: REBOOT ON RCV CHAR (0=DISABLED) +SIOCNT .EQU 1 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +SIO0MODE .EQU SIOMODE_ZP ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] +SIO0BASE .EQU $B0 ; SIO 0: REGISTERS BASE ADR +SIO0ACLK .EQU (4915200/8) ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0ACFG .EQU DEFSERCFG ; SIO 0A: SERIAL LINE CONFIG +SIO0ACTCC .EQU -1 ; SIO 0A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO0BCLK .EQU (4915200/8) ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0BCFG .EQU DEFSERCFG ; SIO 0B: SERIAL LINE CONFIG +SIO0BCTCC .EQU -1 ; SIO 0B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE ; XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG ; VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) VDUSIZ .EQU V80X25 ; VDU: DISPLAY FORMAT [V80X24|V80X25|V80X30] CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) -NECENABLE .EQU FALSE ; NEC: ENABLE NEC UPD7220 VIDEO/KBD DRIVER (NEC.ASM) +CVDUMODE .EQU CVDUMODE_ECB ; CVDU: CVDU MODE: CVDUMODE_[NONE|ECB|MBC] +CVDUMON .EQU CVDUMON_EGA ; CVDU: CVDU MONITOR SETUP: CVDUMON_[NONE|CGA|EGA] +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) TMSENABLE .EQU TRUE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) -TMSMODE .EQU TMSMODE_N8 ; TMS: DRIVER MODE: TMSMODE_[SCG/N8] +TMSMODE .EQU TMSMODE_N8 ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) VGASIZ .EQU V80X25 ; VGA: DISPLAY FORMAT [V80X25|V80X30|V80X43] ; -SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) -; -AYENABLE .EQU TRUE ; AY: ENABLE AY PSG SOUND DRIVER -AYMODE .EQU AYMODE_N8 ; AY: DRIVER MODE: AYMODE_[SCG/N8/RCZ80/RCZ180] -; MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM ; FDENABLE .EQU TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .EQU FDMODE_N8 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3|DYNO] +FDMODE .EQU FDMODE_N8 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 2 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] @@ -151,7 +210,7 @@ IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP -PPIDE0BASE .EQU $80 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0BASE .EQU N8_PPI0 ; PPIDE 0: PPI REGISTERS BASE ADR PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER PPIDE1BASE .EQU $00 ; PPIDE 1: PPI REGISTERS BASE ADR @@ -163,7 +222,8 @@ PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .EQU SDMODE_CSIO ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] -SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +SDPPIBASE .EQU N8_PPI0 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE ; @@ -176,13 +236,37 @@ PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (P ; HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) ; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +PIOCNT .EQU 2 ; PIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +PIO0BASE .EQU $B8 ; PIO 0: REGISTERS BASE ADR +PIO1BASE .EQU $BC ; PIO 1: REGISTERS BASE ADR +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +; PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD PIO4BASE .EQU $90 ; PIO: PIO REGISTERS BASE ADR FOR ECB 4P BOARD PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) PIOZBASE .EQU $88 ; PIO: PIO REGISTERS BASE ADR FOR ECB ZP BOARD -PPI_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIOSBASE .EQU N8_PPI0 ; PIO: PIO REGISTERS BASE ADR FOR SBC PPI ; UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) FIFO_BASE .EQU $0C ; UF: REGISTERS BASE ADR ; -EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +SN76489ENABLE .EQU FALSE ; SN: ENABLE SN76489 SOUND DRIVER +AUDIOTRACE .EQU FALSE ; ENABLE TRACING TO CONSOLE OF SOUND DRIVER +SN7CLK .EQU 3579545 ; SN: PSG CLOCK FREQ, ASSUME MSX STD +SNMODE .EQU SNMODE_VGM ; SN: DRIVER MODE: SNMODE_[NONE|RC|VGM] +; +AY38910ENABLE .EQU FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER +AY_CLK .EQU 1789772 ; AY: PSG CLOCK FREQ, ASSUME MSX STD +AYMODE .EQU AYMODE_N8 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC] +; +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_Z180 ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/cfg_rcz180.asm b/Source/HBIOS/cfg_rcz180.asm index 5f6c0354..df1f9839 100644 --- a/Source/HBIOS/cfg_rcz180.asm +++ b/Source/HBIOS/cfg_rcz180.asm @@ -1,6 +1,6 @@ ; ;================================================================================================== -; ROMWBW 2.X CONFIGURATION DEFAULTS FOR RC2014 +; ROMWBW 2.X CONFIGURATION DEFAULTS FOR RCBUS Z180 CPU ;================================================================================================== ; ; THIS FILE CONTAINS THE FULL SET OF DEFAULT CONFIGURATION SETTINGS FOR THE PLATFORM @@ -11,26 +11,33 @@ ; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS ; FOR THE PLATFORM. ; -#DEFINE PLATFORM_NAME "RC2014" +#DEFINE PLATFORM_NAME "RCBus", " [", CONFIG, "]" ; -PLATFORM .EQU PLT_RCZ180 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] -CPUFAM .EQU CPU_Z180 ; CPU FAMILY: CPU_[Z80|Z180] +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_RCZ180 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z180 ; CPU FAMILY: CPU_[Z80|Z180|Z280] BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) ; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT ; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW CPUOSC .EQU 18432000 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) DEFSERCFG .EQU SER_115200_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) ; RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) -MEMMGR .EQU MM_Z180 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] -RAMBIAS .EQU 512 ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_Z180 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] +RAMLOC .EQU 19 ; START OF RAM AS POWER OF 2 (2^N) IN PHYSICAL ADDRESS SPACE +RAMBIAS .EQU (1 << (RAMLOC - 10)) ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE MPGSEL_0 .EQU $78 ; Z2 MEM MGR BANK 0 PAGE SELECT REG (WRITE ONLY) MPGSEL_1 .EQU $79 ; Z2 MEM MGR BANK 1 PAGE SELECT REG (WRITE ONLY) MPGSEL_2 .EQU $7A ; Z2 MEM MGR BANK 2 PAGE SELECT REG (WRITE ONLY) @@ -41,6 +48,7 @@ Z180_BASE .EQU $C0 ; Z180: I/O BASE ADDRESS FOR INTERNAL REGISTERS Z180_CLKDIV .EQU 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .EQU 0 ; Z180: MEMORY WAIT STATES (0-3) Z180_IOWAIT .EQU 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z180_TIMER .EQU TRUE ; Z180: ENABLE Z180 SYSTEM PERIODIC TIMER ; RTCIO .EQU $0C ; RTC LATCH REGISTER ADR ; @@ -48,79 +56,132 @@ KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS ; CTCENABLE .EQU FALSE ; ENABLE ZILOG CTC SUPPORT +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT +CTCBASE .EQU $88 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU FALSE ; ENABLE CTC PERIODIC TIMER +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] ; DIAGENABLE .EQU TRUE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING ; LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) +LEDMODE .EQU LEDMODE_STD ; LEDMODE_[STD|RTC] LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED ; DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) ; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -; -HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT -SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +PPKTRACE .EQU 1 ; PPK DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +KBDTRACE .EQU 1 ; KBD DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPKKBLOUT .EQU KBD_US ; PPK KEYBOARD LANGUAGE: KBD_[US|DE] +KBDKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +MKYKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] ; DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) ; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS ; -UARTENABLE .EQU FALSE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +DUARTCNT .EQU 1 ; DUART: NUMBER OF CHIPS TO DETECT (1-2) +DUART0BASE .EQU $A0 ; DUART 0: BASE ADDRESS OF CHIP +DUART0ACFG .EQU DEFSERCFG ; DUART 0A: SERIAL LINE CONFIG +DUART0BCFG .EQU DEFSERCFG ; DUART 0B: SERIAL LINE CONFIG +DUART1BASE .EQU $40 ; DUART 1: BASE ADDRESS OF CHIP +DUART1ACFG .EQU DEFSERCFG ; DUART 1A: SERIAL LINE CONFIG +DUART1BCFG .EQU DEFSERCFG ; DUART 1B: SERIAL LINE CONFIG +; +UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +UARTCFG .EQU DEFSERCFG | SER_RTS ; UART: LINE CONFIG FOR UART PORTS +UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) +UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART +UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART +UART4 .EQU FALSE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU TRUE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART ; ASCIENABLE .EQU TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ASCIINTS .EQU TRUE ; ASCI: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +ASCISWAP .EQU FALSE ; ASCI: SWAP CHANNELS +ASCIBOOT .EQU 0 ; ASCI: REBOOT ON RCV CHAR (0=DISABLED) ASCI0CFG .EQU DEFSERCFG ; ASCI 0: SERIAL LINE CONFIG ASCI1CFG .EQU DEFSERCFG ; ASCI 1: SERIAL LINE CONFIG ; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +; ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) ; SIOENABLE .EQU TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) SIODEBUG .EQU FALSE ; SIO: ENABLE DEBUG OUTPUT +SIOBOOT .EQU 0 ; SIO: REBOOT ON RCV CHAR (0=DISABLED) SIOCNT .EQU 2 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP -SIO0MODE .EQU SIOMODE_RC ; SIO 0: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] -SIO0CTCC .EQU -1 ; SIO 0: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE +SIO0MODE .EQU SIOMODE_RC ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] SIO0BASE .EQU $80 ; SIO 0: REGISTERS BASE ADR SIO0ACLK .EQU 7372800 ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0ADIV .EQU 1 ; SIO 0A: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) -SIO0ACFG .EQU SER_115200_8N1 ; SER_115200_8N1 0A: SERIAL LINE CONFIG +SIO0ACFG .EQU SER_115200_8N1 ; SIO 0A: SERIAL LINE CONFIG +SIO0ACTCC .EQU -1 ; SIO 0A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE SIO0BCLK .EQU 7372800 ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0BDIV .EQU 1 ; SIO 0B: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO0BCFG .EQU SER_115200_8N1 ; SIO 0B: SERIAL LINE CONFIG -SIO1MODE .EQU SIOMODE_RC ; SIO 1: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] -SIO1CTCC .EQU -1 ; SIO 1: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE +SIO0BCTCC .EQU -1 ; SIO 0B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO1MODE .EQU SIOMODE_RC ; SIO 1: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] SIO1BASE .EQU $84 ; SIO 1: REGISTERS BASE ADR SIO1ACLK .EQU 7372800 ; SIO 1A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO1ADIV .EQU 1 ; SIO 1A: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) -SIO1ACFG .EQU SER_115200_8N1 ; SER_115200_8N1 1A: SERIAL LINE CONFIG +SIO1ACFG .EQU SER_115200_8N1 ; SIO 1A: SERIAL LINE CONFIG +SIO1ACTCC .EQU -1 ; SIO 1A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE SIO1BCLK .EQU 7372800 ; SIO 1B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO1BDIV .EQU 1 ; SIO 1B: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO1BCFG .EQU SER_115200_8N1 ; SIO 1B: SERIAL LINE CONFIG +SIO1BCTCC .EQU -1 ; SIO 1B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE ; XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG ; VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) -NECENABLE .EQU FALSE ; NEC: ENABLE NEC UPD7220 VIDEO/KBD DRIVER (NEC.ASM) +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .EQU TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) ; -SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) -; -AYENABLE .EQU FALSE ; AY: ENABLE AY PSG SOUND DRIVER -AYMODE .EQU AYMODE_RCZ180 ; AY: DRIVER MODE: AYMODE_[SCG/N8/RCZ80/RCZ180] -; MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM ; FDENABLE .EQU FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .EQU FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3|DYNO] +FDMODE .EQU FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 2 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] @@ -161,23 +222,52 @@ PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER PPIDE2BASE .EQU $00 ; PPIDE 2: PPI REGISTERS BASE ADR PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER -PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER; +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] -SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +SDMODE .EQU SDMODE_MT ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU $60 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 2 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE +SDMTSWAP .EQU FALSE ; SD: SWAP THE LOGICAL ORDER OF THE SPI PORTS OF THE MT011 ; PRPENABLE .EQU FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) +PRPSDENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER SD CARD SUPPORT +PRPSDTRACE .EQU 1 ; PRP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PRPCONENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER VIDEO/KBD SUPPORT ; PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) ; HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) ; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +PIOCNT .EQU 2 ; PIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +PIO0BASE .EQU $B8 ; PIO 0: REGISTERS BASE ADR +PIO1BASE .EQU $BC ; PIO 1: REGISTERS BASE ADR +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +; PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) -PPI_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP ; UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) ; -EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +SN76489ENABLE .EQU FALSE ; SN: ENABLE SN76489 SOUND DRIVER +AUDIOTRACE .EQU FALSE ; ENABLE TRACING TO CONSOLE OF SOUND DRIVER +SN7CLK .EQU 3579545 ; SN: PSG CLOCK FREQ, ASSUME MSX STD +SNMODE .EQU SNMODE_RC ; SN: DRIVER MODE: SNMODE_[NONE|RC|VGM] +; +AY38910ENABLE .EQU FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER +AY_CLK .EQU 1789772 ; AY: PSG CLOCK FREQ, ASSUME MSX STD +AYMODE .EQU AYMODE_RCZ180 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC] +; +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_Z180 ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/cfg_rcz280.asm b/Source/HBIOS/cfg_rcz280.asm new file mode 100644 index 00000000..87691c91 --- /dev/null +++ b/Source/HBIOS/cfg_rcz280.asm @@ -0,0 +1,283 @@ +; +;================================================================================================== +; ROMWBW 2.X CONFIGURATION DEFAULTS FOR RCBUS Z280 CPU +;================================================================================================== +; +; THIS FILE CONTAINS THE FULL SET OF DEFAULT CONFIGURATION SETTINGS FOR THE PLATFORM +; INDICATED ABOVE. THIS FILE SHOULD *NOT* NORMALLY BE CHANGED. INSTEAD, YOU SHOULD +; OVERRIDE ANY SETTINGS YOU WANT USING A CONFIGURATION FILE IN THE CONFIG DIRECTORY +; UNDER THIS DIRECTORY. +; +; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS +; FOR THE PLATFORM. +; +#DEFINE PLATFORM_NAME "RCBus", " [", CONFIG, "]" +; +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_RCZ280 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z280 ; CPU FAMILY: CPU_[Z80|Z180|Z280] +BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] +BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE +HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) +USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) +; +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT +; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW +CPUOSC .EQU 12000000 ; CPU OSC FREQ IN MHZ +INTMODE .EQU 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) +DEFSERCFG .EQU SER_115200_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) +; +RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_Z2 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] +RAMLOC .EQU 19 ; START OF RAM AS POWER OF 2 (2^N) IN PHYSICAL ADDRESS SPACE +RAMBIAS .EQU (1 << (RAMLOC - 10)) ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE +MPGSEL_0 .EQU $78 ; Z2 MEM MGR BANK 0 PAGE SELECT REG (WRITE ONLY) +MPGSEL_1 .EQU $79 ; Z2 MEM MGR BANK 1 PAGE SELECT REG (WRITE ONLY) +MPGSEL_2 .EQU $7A ; Z2 MEM MGR BANK 2 PAGE SELECT REG (WRITE ONLY) +MPGSEL_3 .EQU $7B ; Z2 MEM MGR BANK 3 PAGE SELECT REG (WRITE ONLY) +MPGENA .EQU $7C ; Z2 MEM MGR PAGING ENABLE REGISTER (BIT 0, WRITE ONLY) +; +Z280_MEMLOWAIT .EQU 0 ; Z280: LOW 8MB MEMORY WAIT STATES (0-3) +Z280_MEMHIWAIT .EQU 0 ; Z280: HIGH 8MB MEMORY WAIT STATES (0-3) +Z280_IOWAIT .EQU 1 ; Z280: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z280_INTWAIT .EQU 0 ; Z280: INT ACK WAIT STATUS (0-3) +Z280_TIMER .EQU TRUE ; Z280: ENABLE INTERNAL Z280 SYSTEM PERIODIC TIMER +; +RTCIO .EQU $C0 ; RTC LATCH REGISTER ADR +; +KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT +KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS +; +CTCENABLE .EQU FALSE ; ENABLE ZILOG CTC SUPPORT +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT +CTCBASE .EQU $88 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU FALSE ; ENABLE CTC PERIODIC TIMER +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] +; +DIAGENABLE .EQU TRUE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT +DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS +DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING +; +LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) +LEDMODE .EQU LEDMODE_STD ; LEDMODE_[STD|RTC] +LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS +LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED +; +DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) +; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE +CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPKTRACE .EQU 1 ; PPK DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +KBDTRACE .EQU 1 ; KBD DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPKKBLOUT .EQU KBD_US ; PPK KEYBOARD LANGUAGE: KBD_[US|DE] +KBDKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +MKYKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] +; +DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] +DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) +; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; +BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) +BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS +; +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +DUARTCNT .EQU 1 ; DUART: NUMBER OF CHIPS TO DETECT (1-2) +DUART0BASE .EQU $A0 ; DUART 0: BASE ADDRESS OF CHIP +DUART0ACFG .EQU DEFSERCFG ; DUART 0A: SERIAL LINE CONFIG +DUART0BCFG .EQU DEFSERCFG ; DUART 0B: SERIAL LINE CONFIG +DUART1BASE .EQU $40 ; DUART 1: BASE ADDRESS OF CHIP +DUART1ACFG .EQU DEFSERCFG ; DUART 1A: SERIAL LINE CONFIG +DUART1BCFG .EQU DEFSERCFG ; DUART 1B: SERIAL LINE CONFIG +; +UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +UARTCFG .EQU DEFSERCFG | SER_RTS ; UART: LINE CONFIG FOR UART PORTS +UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) +UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART +UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART +UART4 .EQU FALSE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU TRUE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART +; +ASCIENABLE .EQU FALSE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +Z2UOSC .EQU 1843200 ; Z2U: OSC FREQUENCY IN MHZ +Z2UOSCEXT .EQU TRUE ; Z2U: USE EXTERNAL OSCILLATOR +Z2U0BASE .EQU $10 ; Z2U 0: BASE I/O ADDRESS +Z2U0CFG .EQU DEFSERCFG ; Z2U 0: SERIAL LINE CONFIG +Z2U0HFC .EQU FALSE ; Z2U 0: ENABLE HARDWARE FLOW CONTROL +; +ACIAENABLE .EQU TRUE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +ACIADEBUG .EQU FALSE ; ACIA: ENABLE DEBUG OUTPUT +ACIACNT .EQU 1 ; ACIA: NUMBER OF CHIPS TO DETECT (1-2) +ACIA0BASE .EQU $80 ; ACIA 0: REGISTERS BASE ADR +ACIA0CLK .EQU 7372800 ; ACIA 0: OSC FREQ IN HZ +ACIA0DIV .EQU 1 ; ACIA 0: SERIAL CLOCK DIVIDER +ACIA0CFG .EQU DEFSERCFG ; ACIA 0: SERIAL LINE CONFIG (SEE STD.ASM) +ACIA1BASE .EQU $40 ; ACIA 1: REGISTERS BASE ADR +ACIA1CLK .EQU 7372800 ; ACIA 1: OSC FREQ IN HZ +ACIA1DIV .EQU 1 ; ACIA 1: SERIAL CLOCK DIVIDER +ACIA1CFG .EQU DEFSERCFG ; ACIA 1: SERIAL LINE CONFIG (SEE STD.ASM) +; +SIOENABLE .EQU TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +SIODEBUG .EQU FALSE ; SIO: ENABLE DEBUG OUTPUT +SIOBOOT .EQU 0 ; SIO: REBOOT ON RCV CHAR (0=DISABLED) +SIOCNT .EQU 2 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +SIO0MODE .EQU SIOMODE_RC ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] +SIO0BASE .EQU $80 ; SIO 0: REGISTERS BASE ADR +SIO0ACLK .EQU 7372800 ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0ACFG .EQU DEFSERCFG ; SIO 0A: SERIAL LINE CONFIG +SIO0ACTCC .EQU -1 ; SIO 0A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO0BCLK .EQU 7372800 ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO0BCFG .EQU DEFSERCFG ; SIO 0B: SERIAL LINE CONFIG +SIO0BCTCC .EQU -1 ; SIO 0B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO1MODE .EQU SIOMODE_RC ; SIO 1: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] +SIO1BASE .EQU $84 ; SIO 1: REGISTERS BASE ADR +SIO1ACLK .EQU 7372800 ; SIO 1A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO1ACFG .EQU DEFSERCFG ; SIO 1A: SERIAL LINE CONFIG +SIO1ACTCC .EQU -1 ; SIO 1A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO1BCLK .EQU 7372800 ; SIO 1B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 +SIO1BCFG .EQU DEFSERCFG ; SIO 1B: SERIAL LINE CONFIG +SIO1BCTCC .EQU -1 ; SIO 1B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +; +XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG +; +VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) +CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) +TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .EQU TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) +; +MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK +MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM +; +FDENABLE .EQU FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .EQU FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 2 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) +FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) +FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] +FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] +FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS +; +RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER +; +IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_RC ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $10 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $00 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $00 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU TRUE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU TRUE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER +; +PPIDEENABLE .EQU FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU $20 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE1BASE .EQU $00 ; PPIDE 1: PPI REGISTERS BASE ADR +PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER +PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE2BASE .EQU $00 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +; +SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDMODE .EQU SDMODE_MT ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU $60 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 2 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY +SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE +SDMTSWAP .EQU FALSE ; SD: SWAP THE LOGICAL ORDER OF THE SPI PORTS OF THE MT011 +; +PRPENABLE .EQU FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) +PRPSDENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER SD CARD SUPPORT +PRPSDTRACE .EQU 1 ; PRP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PRPCONENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER VIDEO/KBD SUPPORT +; +PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) +; +HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) +; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +PIOCNT .EQU 2 ; PIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +PIO0BASE .EQU $B8 ; PIO 0: REGISTERS BASE ADR +PIO1BASE .EQU $BC ; PIO 1: REGISTERS BASE ADR +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +; +PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD +PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +; +UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) +; +SN76489ENABLE .EQU FALSE ; SN: ENABLE SN76489 SOUND DRIVER +AUDIOTRACE .EQU FALSE ; ENABLE TRACING TO CONSOLE OF SOUND DRIVER +SN7CLK .EQU 3579545 ; SN: PSG CLOCK FREQ, ASSUME MSX STD +SNMODE .EQU SNMODE_RC ; SN: DRIVER MODE: SNMODE_[NONE|RC|VGM] +; +AY38910ENABLE .EQU FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER +AY_CLK .EQU 1789772 ; AY: PSG CLOCK FREQ, ASSUME MSX STD +AYMODE .EQU AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC] +; +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_Z280 ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/cfg_rcz80.asm b/Source/HBIOS/cfg_rcz80.asm index de1476f4..9bb247e1 100644 --- a/Source/HBIOS/cfg_rcz80.asm +++ b/Source/HBIOS/cfg_rcz80.asm @@ -1,6 +1,6 @@ ; ;================================================================================================== -; ROMWBW 2.X CONFIGURATION DEFAULTS FOR RC2014 Z80 +; ROMWBW 2.X CONFIGURATION DEFAULTS FOR RCBUS Z80 ;================================================================================================== ; ; THIS FILE CONTAINS THE FULL SET OF DEFAULT CONFIGURATION SETTINGS FOR THE PLATFORM @@ -11,25 +11,31 @@ ; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS ; FOR THE PLATFORM. ; -#DEFINE PLATFORM_NAME "RC2014" +#DEFINE PLATFORM_NAME "RCBus", " [", CONFIG, "]" ; -PLATFORM .EQU PLT_RCZ80 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] -CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180] +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_RCZ80 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180|Z280] BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) ; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT ; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW CPUOSC .EQU 7372800 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 1 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +INTMODE .EQU 1 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) DEFSERCFG .EQU SER_115200_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) ; RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) -MEMMGR .EQU MM_Z2 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_Z2 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] MPGSEL_0 .EQU $78 ; Z2 MEM MGR BANK 0 PAGE SELECT REG (WRITE ONLY) MPGSEL_1 .EQU $79 ; Z2 MEM MGR BANK 1 PAGE SELECT REG (WRITE ONLY) MPGSEL_2 .EQU $7A ; Z2 MEM MGR BANK 2 PAGE SELECT REG (WRITE ONLY) @@ -42,37 +48,92 @@ KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS ; CTCENABLE .EQU FALSE ; ENABLE ZILOG CTC SUPPORT -CTCMODE .EQU CTCMODE_RC ; CTC MODE: CTCMODE_[ZP|Z2|EZ|RC] +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT CTCBASE .EQU $88 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU FALSE ; ENABLE CTC PERIODIC TIMER +CTCMODE .EQU CTCMODE_TIM16 ; CTC MODE: CTCMODE_[NONE|CTR|TIM16|TIM256] +CTCPRE .EQU 256 ; PRESCALE CONSTANT (1-256) +CTCPRECH .EQU 2 ; PRESCALE CHANNEL (0-3) +CTCTIMCH .EQU 3 ; TIMER CHANNEL (0-3) +CTCOSC .EQU CPUOSC ; CTC CLOCK FREQUENCY +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +SKZDIV .EQU DIV_1 ; UART CLK (CLK2) DIVIDER FOR Z80-512K +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] +WDOGIO .EQU $6E ; WATCHDOG REGISTER ADR ; DIAGENABLE .EQU TRUE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING ; LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) +LEDMODE .EQU LEDMODE_STD ; LEDMODE_[STD|RTC] LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED ; DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) ; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -; -HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT -SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +PPKTRACE .EQU 1 ; PPK DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +KBDTRACE .EQU 1 ; KBD DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPKKBLOUT .EQU KBD_US ; PPK KEYBOARD LANGUAGE: KBD_[US|DE] +KBDKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +MKYKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] ; DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) ; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS ; -UARTENABLE .EQU FALSE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +DUARTCNT .EQU 1 ; DUART: NUMBER OF CHIPS TO DETECT (1-2) +DUART0BASE .EQU $A0 ; DUART 0: BASE ADDRESS OF CHIP +DUART0ACFG .EQU DEFSERCFG ; DUART 0A: SERIAL LINE CONFIG +DUART0BCFG .EQU DEFSERCFG ; DUART 0B: SERIAL LINE CONFIG +DUART1BASE .EQU $40 ; DUART 1: BASE ADDRESS OF CHIP +DUART1ACFG .EQU DEFSERCFG ; DUART 1A: SERIAL LINE CONFIG +DUART1BCFG .EQU DEFSERCFG ; DUART 1B: SERIAL LINE CONFIG +; +UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +UARTCFG .EQU DEFSERCFG | SER_RTS ; UART: LINE CONFIG FOR UART PORTS +UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) +UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART +UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART +UART4 .EQU FALSE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU TRUE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART ; ASCIENABLE .EQU FALSE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) ; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +; ACIAENABLE .EQU TRUE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) ACIADEBUG .EQU FALSE ; ACIA: ENABLE DEBUG OUTPUT ACIACNT .EQU 1 ; ACIA: NUMBER OF CHIPS TO DETECT (1-2) @@ -87,44 +148,44 @@ ACIA1CFG .EQU DEFSERCFG ; ACIA 1: SERIAL LINE CONFIG (SEE STD.ASM) ; SIOENABLE .EQU TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) SIODEBUG .EQU FALSE ; SIO: ENABLE DEBUG OUTPUT +SIOBOOT .EQU 0 ; SIO: REBOOT ON RCV CHAR (0=DISABLED) SIOCNT .EQU 2 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP -SIO0MODE .EQU SIOMODE_RC ; SIO 0: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] -SIO0CTCC .EQU -1 ; SIO 0: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE +SIO0MODE .EQU SIOMODE_RC ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] SIO0BASE .EQU $80 ; SIO 0: REGISTERS BASE ADR SIO0ACLK .EQU CPUOSC ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0ADIV .EQU 1 ; SIO 0A: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO0ACFG .EQU DEFSERCFG ; SIO 0A: SERIAL LINE CONFIG +SIO0ACTCC .EQU -1 ; SIO 0A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE SIO0BCLK .EQU CPUOSC ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0BDIV .EQU 1 ; SIO 0B: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO0BCFG .EQU DEFSERCFG ; SIO 0B: SERIAL LINE CONFIG -SIO1MODE .EQU SIOMODE_RC ; SIO 1: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] -SIO1CTCC .EQU -1 ; SIO 1: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE +SIO0BCTCC .EQU -1 ; SIO 0B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO1MODE .EQU SIOMODE_RC ; SIO 1: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] SIO1BASE .EQU $84 ; SIO 1: REGISTERS BASE ADR SIO1ACLK .EQU CPUOSC ; SIO 1A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO1ADIV .EQU 1 ; SIO 1A: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO1ACFG .EQU DEFSERCFG ; SIO 1A: SERIAL LINE CONFIG +SIO1ACTCC .EQU -1 ; SIO 1A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE SIO1BCLK .EQU CPUOSC ; SIO 1B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO1BDIV .EQU 1 ; SIO 1B: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO1BCFG .EQU DEFSERCFG ; SIO 1B: SERIAL LINE CONFIG +SIO1BCTCC .EQU -1 ; SIO 1B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE ; XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG ; VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) -NECENABLE .EQU FALSE ; NEC: ENABLE NEC UPD7220 VIDEO/KBD DRIVER (NEC.ASM) +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .EQU TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) ; -SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) -; -AYENABLE .EQU FALSE ; AY: ENABLE AY PSG SOUND DRIVER -AYMODE .EQU AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG/N8/RCZ80/RCZ180] -; MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM ; FDENABLE .EQU FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .EQU FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3|DYNO] +FDMODE .EQU FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 2 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] @@ -168,21 +229,49 @@ PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] -SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +SDMODE .EQU SDMODE_MT ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU $60 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 2 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE +SDMTSWAP .EQU FALSE ; SD: SWAP THE LOGICAL ORDER OF THE SPI PORTS OF THE MT011 ; PRPENABLE .EQU FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) +PRPSDENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER SD CARD SUPPORT +PRPSDTRACE .EQU 1 ; PRP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PRPCONENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER VIDEO/KBD SUPPORT ; PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) ; HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) ; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +PIOCNT .EQU 2 ; PIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +PIO0BASE .EQU $B8 ; PIO 0: REGISTERS BASE ADR +PIO1BASE .EQU $BC ; PIO 1: REGISTERS BASE ADR +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +; PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) -PPI_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP ; UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) ; -EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +SN76489ENABLE .EQU FALSE ; SN: ENABLE SN76489 SOUND DRIVER +AUDIOTRACE .EQU FALSE ; ENABLE TRACING TO CONSOLE OF SOUND DRIVER +SN7CLK .EQU 3579545 ; SN: PSG CLOCK FREQ, ASSUME MSX STD +SNMODE .EQU SNMODE_RC ; SN: DRIVER MODE: SNMODE_[NONE|RC|VGM] +; +AY38910ENABLE .EQU FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER +AY_CLK .EQU 1789772 ; AY: PSG CLOCK FREQ, ASSUME MSX STD +AYMODE .EQU AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC] +; +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_RC ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/cfg_rph.asm b/Source/HBIOS/cfg_rph.asm new file mode 100644 index 00000000..7df16a4b --- /dev/null +++ b/Source/HBIOS/cfg_rph.asm @@ -0,0 +1,261 @@ +; +;================================================================================================== +; ROMWBW 2.X CONFIGURATION FOR RHYOPHYRE +;================================================================================================== +; +; THIS FILE CONTAINS THE FULL SET OF DEFAULT CONFIGURATION SETTINGS FOR THE PLATFORM +; INDICATED ABOVE. THIS FILE SHOULD *NOT* NORMALLY BE CHANGED. INSTEAD, YOU SHOULD +; OVERRIDE ANY SETTINGS YOU WANT USING A CONFIGURATION FILE IN THE CONFIG DIRECTORY +; UNDER THIS DIRECTORY. +; +; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS +; FOR THE PLATFORM. +; +#DEFINE PLATFORM_NAME "Rhyophyre", " [", CONFIG, "]" +; +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_RPH ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z180 ; CPU FAMILY: CPU_[Z80|Z180|Z280] +BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] +BATCOND .EQU TRUE ; ENABLE LOW BATTERY WARNING MESSAGE +HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) +USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) +; +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT +; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW +CPUOSC .EQU 18432000 ; CPU OSC FREQ IN MHZ +INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) +DEFSERCFG .EQU SER_38400_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) +; +RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_RPH ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] +RAMBIAS .EQU 0 ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE +RAMLOC .EQU 0 ; START OF RAM AS POWER OF 2 (2^N) IN PHYSICAL ADDRESS SPACE +; +Z180_BASE .EQU $40 ; Z180: I/O BASE ADDRESS FOR INTERNAL REGISTERS +Z180_CLKDIV .EQU 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 +Z180_MEMWAIT .EQU 0 ; Z180: MEMORY WAIT STATES (0-3) +Z180_IOWAIT .EQU 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z180_TIMER .EQU TRUE ; Z180: ENABLE Z180 SYSTEM PERIODIC TIMER +; +RPH_PPI0 .EQU $88 ; RPH: FIRST PARALLEL PORT REGISTERS BASE ADR +RPH_RTC .EQU $84 ; RPH: RTC LATCH REGISTER ADR +RPH_ACR .EQU $80 ; RPH: AUXILLARY CONTROL REGISTER (ACR) ADR +RPH_DEFACR .EQU $20 ; RPH: AUX CTL REGISTER DEFAULT VALUE (QUIESCIENT STATE) +; +RTCIO .EQU RPH_RTC ; RTC LATCH REGISTER ADR +; +KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT +KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS +; +CTCENABLE .EQU FALSE ; ENABLE ZILOG CTC SUPPORT +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT +CTCBASE .EQU $B0 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU FALSE ; ENABLE CTC PERIODIC TIMER +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] +; +DIAGENABLE .EQU FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT +DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS +DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING +; +LEDENABLE .EQU FALSE ; ENABLES STATUS LED +LEDMODE .EQU LEDMODE_RTC ; LEDMODE_[STD|RTC] +LEDPORT .EQU RTCIO ; STATUS LED PORT ADDRESS +LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED +; +DSKYENABLE .EQU FALSE ; ENABLES DSKY +DSKYMODE .EQU DSKYMODE_V1 ; DSKY VERSION: DSKYMODE_[V1|NG] +DSKYPPIBASE .EQU RPH_PPI0 ; BASE I/O ADDRESS OF DSKY PPI +DSKYOSC .EQU 3000000 ; OSCILLATOR FREQ FOR DSKYNG (IN HZ) +; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE +CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP +VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD +ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPKTRACE .EQU 1 ; PPK DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +KBDTRACE .EQU 1 ; KBD DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPKKBLOUT .EQU KBD_US ; PPK KEYBOARD LANGUAGE: KBD_[US|DE] +KBDKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +MKYKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] +; +DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) +DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] +DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) +; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; +BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) +BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS +; +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; +UARTENABLE .EQU FALSE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS +UARTCASSPD .EQU SER_300_8N1 ; UART: ECB CASSETTE UART DEFAULT SPEED +UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) +UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART +UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART +UART4 .EQU FALSE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU FALSE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART +; +ASCIENABLE .EQU TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ASCIINTS .EQU TRUE ; ASCI: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +ASCISWAP .EQU FALSE ; ASCI: SWAP CHANNELS +ASCIBOOT .EQU 0 ; ASCI: REBOOT ON RCV CHAR (0=DISABLED) +ASCI0CFG .EQU DEFSERCFG ; ASCI 0: SERIAL LINE CONFIG +ASCI1CFG .EQU DEFSERCFG ; ASCI 1: SERIAL LINE CONFIG +; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +; +ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +; +SIOENABLE .EQU FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +; +XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG +; +VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) +VDUSIZ .EQU V80X25 ; VDU: DISPLAY FORMAT [V80X24|V80X25|V80X30] +CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) +CVDUMODE .EQU CVDUMODE_ECB ; CVDU: CVDU MODE: CVDUMODE_[NONE|ECB|MBC] +CVDUMON .EQU CVDUMON_EGA ; CVDU: CVDU MONITOR SETUP: CVDUMON_[NONE|CGA|EGA] +GDCENABLE .EQU TRUE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) +GDCMODE .EQU GDCMODE_RPH ; GDC: GDC MODE: GDCMODE_[NONE|ECB|RPH] +GDCMON .EQU GDCMON_EGA ; GDC: GDC MONITOR SETUP: GDCMON_[NONE|CGA|EGA] +TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .EQU TMSMODE_N8 ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) +VGASIZ .EQU V80X25 ; VGA: DISPLAY FORMAT [V80X25|V80X30|V80X43] +; +MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK +MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM +; +FDENABLE .EQU FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .EQU FDMODE_N8 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 2 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) +FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) +FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] +FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] +FDMAUTO .EQU TRUE ; FD: AUTO SELECT DEFAULT/ALTERNATE MEDIA FORMATS +; +RFENABLE .EQU FALSE ; RF: ENABLE RAM FLOPPY DRIVER +RFCNT .EQU 1 ; RF: NUMBER OF RAM FLOPPY UNITS (1-4) +; +IDEENABLE .EQU FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +IDETRACE .EQU 1 ; IDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +IDECNT .EQU 1 ; IDE: NUMBER OF IDE INTERFACES TO DETECT (1-3), 2 DRIVES EACH +IDE0MODE .EQU IDEMODE_DIO ; IDE 0: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE0BASE .EQU $20 ; IDE 0: IO BASE ADDRESS +IDE0DATLO .EQU $20 ; IDE 0: DATA LO PORT FOR 16-BIT I/O +IDE0DATHI .EQU $28 ; IDE 0: DATA HI PORT FOR 16-BIT I/O +IDE0A8BIT .EQU FALSE ; IDE 0A (MASTER): 8 BIT XFER +IDE0B8BIT .EQU FALSE ; IDE 0B (MASTER): 8 BIT XFER +IDE1MODE .EQU IDEMODE_NONE ; IDE 1: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE1BASE .EQU $00 ; IDE 1: IO BASE ADDRESS +IDE1DATLO .EQU $00 ; IDE 1: DATA LO PORT FOR 16-BIT I/O +IDE1DATHI .EQU $00 ; IDE 1: DATA HI PORT FOR 16-BIT I/O +IDE1A8BIT .EQU TRUE ; IDE 1A (MASTER): 8 BIT XFER +IDE1B8BIT .EQU TRUE ; IDE 1B (MASTER): 8 BIT XFER +IDE2MODE .EQU IDEMODE_NONE ; IDE 2: DRIVER MODE: IDEMODE_[DIO|DIDE|MK4|RC] +IDE2BASE .EQU $00 ; IDE 2: IO BASE ADDRESS +IDE2DATLO .EQU $00 ; IDE 2: DATA LO PORT FOR 16-BIT I/O +IDE2DATHI .EQU $00 ; IDE 2: DATA HI PORT FOR 16-BIT I/O +IDE2A8BIT .EQU TRUE ; IDE 2A (MASTER): 8 BIT XFER +IDE2B8BIT .EQU TRUE ; IDE 2B (MASTER): 8 BIT XFER +; +PPIDEENABLE .EQU TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +PPIDETRACE .EQU 1 ; PPIDE: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPIDECNT .EQU 1 ; PPIDE: NUMBER OF PPI CHIPS TO DETECT (1-3), 2 DRIVES PER CHIP +PPIDE0BASE .EQU RPH_PPI0 ; PPIDE 0: PPI REGISTERS BASE ADR +PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER +PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE1BASE .EQU $00 ; PPIDE 1: PPI REGISTERS BASE ADR +PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER +PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +PPIDE2BASE .EQU $00 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER +PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER +; +SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) +SDMODE .EQU SDMODE_CSIO ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU RPH_PPI0 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY +SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE +; +PRPENABLE .EQU FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) +PRPSDENABLE .EQU FALSE ; PRP: ENABLE PROPIO DRIVER SD CARD SUPPORT +PRPSDTRACE .EQU 1 ; PRP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PRPCONENABLE .EQU FALSE ; PRP: ENABLE PROPIO DRIVER VIDEO/KBD SUPPORT +; +PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) +; +HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) +; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +PIOCNT .EQU 2 ; PIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +PIO0BASE .EQU $B8 ; PIO 0: REGISTERS BASE ADR +PIO1BASE .EQU $BC ; PIO 1: REGISTERS BASE ADR +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +; +PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD +PIO4BASE .EQU $90 ; PIO: PIO REGISTERS BASE ADR FOR ECB 4P BOARD +PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) +PIOZBASE .EQU $88 ; PIO: PIO REGISTERS BASE ADR FOR ECB ZP BOARD +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIOSBASE .EQU RPH_PPI0 ; PIO: PIO REGISTERS BASE ADR FOR SBC PPI +; +UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) +FIFO_BASE .EQU $0C ; UF: REGISTERS BASE ADR +; +SN76489ENABLE .EQU FALSE ; SN: ENABLE SN76489 SOUND DRIVER +AUDIOTRACE .EQU FALSE ; ENABLE TRACING TO CONSOLE OF SOUND DRIVER +SN7CLK .EQU 3579545 ; SN: PSG CLOCK FREQ, ASSUME MSX STD +SNMODE .EQU SNMODE_NONE ; SN: DRIVER MODE: SNMODE_[NONE|RC|VGM] +; +AY38910ENABLE .EQU FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER +AY_CLK .EQU 1789772 ; AY: PSG CLOCK FREQ, ASSUME MSX STD +AYMODE .EQU AYMODE_N8 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC] +; +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_Z180 ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/cfg_sbc.asm b/Source/HBIOS/cfg_sbc.asm index 0e83b015..1a5eedbe 100644 --- a/Source/HBIOS/cfg_sbc.asm +++ b/Source/HBIOS/cfg_sbc.asm @@ -11,113 +11,160 @@ ; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS ; FOR THE PLATFORM. ; -#DEFINE PLATFORM_NAME "SBC" +#DEFINE PLATFORM_NAME "RetroBrew SBC", " [", CONFIG, "]" ; -PLATFORM .EQU PLT_SBC ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] -CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180] +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_SBC ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180|Z280] BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) ; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT ; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW CPUOSC .EQU 8000000 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +INTMODE .EQU 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) DEFSERCFG .EQU SER_38400_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) ; RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) -MEMMGR .EQU MM_SBC ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_SBC ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] MPCL_RAM .EQU $78 ; SBC MEM MGR RAM PAGE SELECT REG (WRITE ONLY) MPCL_ROM .EQU $7C ; SBC MEM MGR ROM PAGE SELECT REG (WRITE ONLY) ; RTCIO .EQU $70 ; RTC LATCH REGISTER ADR -PPIBASE .EQU $60 ; PRIMARY PARALLEL PORT REGISTERS BASE ADR ; KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS ; CTCENABLE .EQU FALSE ; ENABLE ZILOG CTC SUPPORT -CTCMODE .EQU CTCMODE_ZP ; CTC MODE: CTCMODE_[ZP|Z2|EZ|RC] -CTCBASE .EQU $80 ; CTC BASE I/O ADDRESS +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT +CTCBASE .EQU $B0 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU TRUE ; ENABLE CTC PERIODIC TIMER +CTCMODE .EQU CTCMODE_CTR ; CTC MODE: CTCMODE_[NONE|CTR|TIM16|TIM256] +CTCPRE .EQU 256 ; PRESCALE CONSTANT (1-256) +CTCPRECH .EQU 2 ; PRESCALE CHANNEL (0-3) +CTCTIMCH .EQU 3 ; TIMER CHANNEL (0-3) +CTCOSC .EQU 614400 ; CTC CLOCK FREQUENCY +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] ; DIAGENABLE .EQU FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING ; -LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) -LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS +LEDENABLE .EQU FALSE ; ENABLES STATUS LED +LEDMODE .EQU LEDMODE_RTC ; LEDMODE_[STD|RTC] +LEDPORT .EQU RTCIO ; STATUS LED PORT ADDRESS LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED ; -DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) +DSKYENABLE .EQU FALSE ; ENABLES DSKY +DSKYMODE .EQU DSKYMODE_V1 ; DSKY VERSION: DSKYMODE_[V1|NG] +DSKYPPIBASE .EQU $60 ; BASE I/O ADDRESS OF DSKY PPI +DSKYOSC .EQU 3000000 ; OSCILLATOR FREQ FOR DSKYNG (IN HZ) ; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPKTRACE .EQU 1 ; PPK DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) KBDTRACE .EQU 1 ; KBD DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPKKBLOUT .EQU KBD_US ; PPK KEYBOARD LANGUAGE: KBD_[US|DE] KBDKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] -; -HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT -SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +MKYKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] ; DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) ; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS ; +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS UARTCASSPD .EQU SER_300_8N1 ; UART: ECB CASSETTE UART DEFAULT SPEED UARTSBC .EQU TRUE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) UARTCAS .EQU TRUE ; UART: AUTO-DETECT ECB CASSETTE UART UARTMFP .EQU TRUE ; UART: AUTO-DETECT MF/PIC UART UART4 .EQU TRUE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU FALSE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART ; ASCIENABLE .EQU FALSE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) ; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +; ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) ; SIOENABLE .EQU TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) SIODEBUG .EQU FALSE ; SIO: ENABLE DEBUG OUTPUT +SIOBOOT .EQU 0 ; SIO: REBOOT ON RCV CHAR (0=DISABLED) SIOCNT .EQU 1 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP -SIO0MODE .EQU SIOMODE_ZP ; SIO 0: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] -SIO0CTCC .EQU -1 ; SIO 0: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE +SIO0MODE .EQU SIOMODE_ZP ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] SIO0BASE .EQU $B0 ; SIO 0: REGISTERS BASE ADR -SIO0ACLK .EQU 4915200 ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0ADIV .EQU 8 ; SIO 0A: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) +SIO0ACLK .EQU (4915200/8) ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 SIO0ACFG .EQU DEFSERCFG ; SIO 0A: SERIAL LINE CONFIG -SIO0BCLK .EQU 4915200 ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0BDIV .EQU 8 ; SIO 0B: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) +SIO0ACTCC .EQU -1 ; SIO 0A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO0BCLK .EQU (4915200/8) ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 SIO0BCFG .EQU DEFSERCFG ; SIO 0B: SERIAL LINE CONFIG +SIO0BCTCC .EQU -1 ; SIO 0B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE ; XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG ; VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) VDUSIZ .EQU V80X25 ; VDU: DISPLAY FORMAT [V80X24|V80X25|V80X30] CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) -NECENABLE .EQU FALSE ; NEC: ENABLE NEC UPD7220 VIDEO/KBD DRIVER (NEC.ASM) +CVDUMODE .EQU CVDUMODE_ECB ; CVDU: CVDU MODE: CVDUMODE_[NONE|ECB|MBC] +CVDUMON .EQU CVDUMON_EGA ; CVDU: CVDU MONITOR SETUP: CVDUMON_[NONE|CGA|EGA] +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) -TMSMODE .EQU TMSMODE_SCG ; TMS: DRIVER MODE: TMSMODE_[SCG/N8] +TMSMODE .EQU TMSMODE_SCG ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) VGASIZ .EQU V80X25 ; VGA: DISPLAY FORMAT [V80X25|V80X30|V80X43] ; -SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) -; -AYENABLE .EQU FALSE ; AY: ENABLE AY PSG SOUND DRIVER -AYMODE .EQU AYMODE_SCG ; AY: DRIVER MODE: AYMODE_[SCG/N8/RCZ80/RCZ180] -; MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM +; ; FDENABLE .EQU FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .EQU FDMODE_DIO3 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3|DYNO] +FDMODE .EQU FDMODE_DIO3 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 2 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] @@ -157,13 +204,14 @@ PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER PPIDE1BASE .EQU $20 ; PPIDE 1: PPI REGISTERS BASE ADR PPIDE1A8BIT .EQU FALSE ; PPIDE 1A (MASTER): 8 BIT XFER PPIDE1B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER -PPIDE2BASE .EQU $44 ; PPIDE 2: PPI REGISTERS BASE ADR +PPIDE2BASE .EQU $14 ; PPIDE 2: PPI REGISTERS BASE ADR PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDMODE .EQU SDMODE_JUHA ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] -SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +SDMODE .EQU SDMODE_JUHA ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU $60 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE ; @@ -177,13 +225,40 @@ PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (P HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) HDSKTRACE .EQU 1 ; HDSK: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) ; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +PIOCNT .EQU 2 ; PIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +PIO0BASE .EQU $B8 ; PIO 0: REGISTERS BASE ADR +PIO1BASE .EQU $BC ; PIO 1: REGISTERS BASE ADR +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +LPTCNT .EQU 1 ; LPT: NUMBER OF CHIPS TO DETECT (1-2) +LPT0BASE .EQU $E8 ; LPT 0: REGISTERS BASE ADR +LPT1BASE .EQU $EC ; LPT 1: REGISTERS BASE ADR +; PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD PIO4BASE .EQU $90 ; PIO: PIO REGISTERS BASE ADR FOR ECB 4P BOARD PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) PIOZBASE .EQU $88 ; PIO: PIO REGISTERS BASE ADR FOR ECB ZP BOARD -PPI_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIOSBASE .EQU $60 ; PIO: PIO REGISTERS BASE ADR FOR SBC PPI ; UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) UFBASE .EQU $0C ; UF: REGISTERS BASE ADR ; -EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +SN76489ENABLE .EQU FALSE ; SN: ENABLE SN76489 SOUND DRIVER +AUDIOTRACE .EQU FALSE ; ENABLE TRACING TO CONSOLE OF SOUND DRIVER +SN7CLK .EQU 3579545 ; SN: PSG CLOCK FREQ, ASSUME MSX STD +SNMODE .EQU SNMODE_VGM ; SN: DRIVER MODE: SNMODE_[NONE|RC|VGM] +; +AY38910ENABLE .EQU FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER +AY_CLK .EQU 1789772 ; AY: PSG CLOCK FREQ, ASSUME MSX STD +AYMODE .EQU AYMODE_SCG ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC] +; +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_ECB ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/cfg_scz180.asm b/Source/HBIOS/cfg_scz180.asm index 77f06047..70220ddc 100644 --- a/Source/HBIOS/cfg_scz180.asm +++ b/Source/HBIOS/cfg_scz180.asm @@ -11,31 +11,44 @@ ; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS ; FOR THE PLATFORM. ; -#DEFINE PLATFORM_NAME "SCZ180" +#DEFINE PLATFORM_NAME "Small Computer", " [", CONFIG, "]" ; -PLATFORM .EQU PLT_SCZ180 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] -CPUFAM .EQU CPU_Z180 ; CPU FAMILY: CPU_[Z80|Z180] +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_SCZ180 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z180 ; CPU FAMILY: CPU_[Z80|Z180|Z280] BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) ; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT ; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW CPUOSC .EQU 18432000 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) DEFSERCFG .EQU SER_115200_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) ; RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) -MEMMGR .EQU MM_Z180 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] -RAMBIAS .EQU 512 ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_Z180 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] +RAMLOC .EQU 19 ; START OF RAM AS POWER OF 2 (2^N) IN PHYSICAL ADDRESS SPACE +RAMBIAS .EQU (1 << (RAMLOC - 10)) ; OFFSET OF START OF RAM IN PHYSICAL ADDRESS SPACE +MPGSEL_0 .EQU $78 ; Z2 MEM MGR BANK 0 PAGE SELECT REG (WRITE ONLY) +MPGSEL_1 .EQU $79 ; Z2 MEM MGR BANK 1 PAGE SELECT REG (WRITE ONLY) +MPGSEL_2 .EQU $7A ; Z2 MEM MGR BANK 2 PAGE SELECT REG (WRITE ONLY) +MPGSEL_3 .EQU $7B ; Z2 MEM MGR BANK 3 PAGE SELECT REG (WRITE ONLY) +MPGENA .EQU $7C ; Z2 MEM MGR PAGING ENABLE REGISTER (BIT 0, WRITE ONLY) ; Z180_BASE .EQU $C0 ; Z180: I/O BASE ADDRESS FOR INTERNAL REGISTERS Z180_CLKDIV .EQU 1 ; Z180: CHK DIV: 0=OSC/2, 1=OSC, 2=OSC*2 Z180_MEMWAIT .EQU 0 ; Z180: MEMORY WAIT STATES (0-3) Z180_IOWAIT .EQU 1 ; Z180: I/O WAIT STATES TO ADD ABOVE 1 W/S BUILT-IN (0-3) +Z180_TIMER .EQU TRUE ; Z180: ENABLE Z180 SYSTEM PERIODIC TIMER ; RTCIO .EQU $0C ; RTC LATCH REGISTER ADR ; @@ -43,79 +56,132 @@ KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS ; CTCENABLE .EQU FALSE ; ENABLE ZILOG CTC SUPPORT +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT +CTCBASE .EQU $88 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU FALSE ; ENABLE CTC PERIODIC TIMER +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] ; DIAGENABLE .EQU TRUE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT DIAGPORT .EQU $0D ; DIAGNOSTIC PORT ADDRESS DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING ; LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) +LEDMODE .EQU LEDMODE_STD ; LEDMODE_[STD|RTC] LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED ; DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) ; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -; -HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT -SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +PPKTRACE .EQU 1 ; PPK DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +KBDTRACE .EQU 1 ; KBD DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PPKKBLOUT .EQU KBD_US ; PPK KEYBOARD LANGUAGE: KBD_[US|DE] +KBDKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) +MKYKBLOUT .EQU KBD_US ; KBD KEYBOARD LANGUAGE: KBD_[US|DE] ; DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) ; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS ; -UARTENABLE .EQU FALSE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +DUARTCNT .EQU 1 ; DUART: NUMBER OF CHIPS TO DETECT (1-2) +DUART0BASE .EQU $A0 ; DUART 0: BASE ADDRESS OF CHIP +DUART0ACFG .EQU DEFSERCFG ; DUART 0A: SERIAL LINE CONFIG +DUART0BCFG .EQU DEFSERCFG ; DUART 0B: SERIAL LINE CONFIG +DUART1BASE .EQU $40 ; DUART 1: BASE ADDRESS OF CHIP +DUART1ACFG .EQU DEFSERCFG ; DUART 1A: SERIAL LINE CONFIG +DUART1BCFG .EQU DEFSERCFG ; DUART 1B: SERIAL LINE CONFIG +; +UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +UARTCFG .EQU DEFSERCFG | SER_RTS ; UART: LINE CONFIG FOR UART PORTS +UARTSBC .EQU FALSE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) +UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART +UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART +UART4 .EQU FALSE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU TRUE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART ; ASCIENABLE .EQU TRUE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) +ASCIINTS .EQU TRUE ; ASCI: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 +ASCISWAP .EQU FALSE ; ASCI: SWAP CHANNELS +ASCIBOOT .EQU 0 ; ASCI: REBOOT ON RCV CHAR (0=DISABLED) ASCI0CFG .EQU DEFSERCFG ; ASCI 0: SERIAL LINE CONFIG ASCI1CFG .EQU DEFSERCFG ; ASCI 1: SERIAL LINE CONFIG ; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +; ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) ; SIOENABLE .EQU TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) SIODEBUG .EQU FALSE ; SIO: ENABLE DEBUG OUTPUT +SIOBOOT .EQU 0 ; SIO: REBOOT ON RCV CHAR (0=DISABLED) SIOCNT .EQU 2 ; SIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP -SIO0MODE .EQU SIOMODE_RC ; SIO 0: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] -SIO0CTCC .EQU -1 ; SIO 0: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE +SIO0MODE .EQU SIOMODE_RC ; SIO 0: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] SIO0BASE .EQU $80 ; SIO 0: REGISTERS BASE ADR SIO0ACLK .EQU 7372800 ; SIO 0A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0ADIV .EQU 1 ; SIO 0A: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO0ACFG .EQU SER_115200_8N1 ; SIO 0A: SERIAL LINE CONFIG +SIO0ACTCC .EQU -1 ; SIO 0A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE SIO0BCLK .EQU 7372800 ; SIO 0B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO0BDIV .EQU 1 ; SIO 0B: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO0BCFG .EQU SER_115200_8N1 ; SIO 0B: SERIAL LINE CONFIG -SIO1MODE .EQU SIOMODE_RC ; SIO 1: CHIP TYPE: SIOMODE_[RC|SMB|ZP|EZZ80] -SIO1CTCC .EQU -1 ; SIO 1: CTC CHANNEL CLOCK SCALER, (0-3), -1 FOR NONE +SIO0BCTCC .EQU -1 ; SIO 0B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE +SIO1MODE .EQU SIOMODE_RC ; SIO 1: CHIP TYPE: SIOMODE_[STD|RC|SMB|ZP] SIO1BASE .EQU $84 ; SIO 1: REGISTERS BASE ADR SIO1ACLK .EQU 7372800 ; SIO 1A: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO1ADIV .EQU 1 ; SIO 1A: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO1ACFG .EQU SER_115200_8N1 ; SIO 1A: SERIAL LINE CONFIG +SIO1ACTCC .EQU -1 ; SIO 1A: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE SIO1BCLK .EQU 7372800 ; SIO 1B: OSC FREQ IN HZ, ZP=2457600/4915200, RC/SMB=7372800 -SIO1BDIV .EQU 1 ; SIO 1B: SERIAL CLOCK DIVIDER, RC2014/SMB=1, ZP=2/4/8/16/32/64/128/256 (X5) SIO1BCFG .EQU SER_115200_8N1 ; SIO 1B: SERIAL LINE CONFIG +SIO1BCTCC .EQU -1 ; SIO 1B: CTC CHANNEL 0=A, 1=B, 2=C, 3=D, -1 FOR NONE ; XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG ; VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) -NECENABLE .EQU FALSE ; NEC: ENABLE NEC UPD7220 VIDEO/KBD DRIVER (NEC.ASM) +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .EQU TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) ; -SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) -; -AYENABLE .EQU FALSE ; AY: ENABLE AY PSG SOUND DRIVER -AYMODE .EQU AYMODE_RCZ180 ; AY: DRIVER MODE: AYMODE_[SCG/N8/RCZ80/RCZ180] -; MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM ; FDENABLE .EQU FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .EQU FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3|DYNO] +FDMODE .EQU FDMODE_RCWDC ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 2 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] @@ -159,21 +225,49 @@ PPIDE2A8BIT .EQU FALSE ; PPIDE 2A (MASTER): 8 BIT XFER PPIDE2B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU TRUE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDMODE .EQU SDMODE_SC ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] -SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +SDMODE .EQU SDMODE_SC ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU $60 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE +SDMTSWAP .EQU FALSE ; SD: SWAP THE LOGICAL ORDER OF THE SPI PORTS OF THE MT011 ; PRPENABLE .EQU FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) +PRPSDENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER SD CARD SUPPORT +PRPSDTRACE .EQU 1 ; PRP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +PRPCONENABLE .EQU TRUE ; PRP: ENABLE PROPIO DRIVER VIDEO/KBD SUPPORT ; PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) ; HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) ; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +PIOCNT .EQU 2 ; PIO: NUMBER OF CHIPS TO DETECT (1-2), 2 CHANNELS PER CHIP +PIO0BASE .EQU $B8 ; PIO 0: REGISTERS BASE ADR +PIO1BASE .EQU $BC ; PIO 1: REGISTERS BASE ADR +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +; PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) -PPI_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP ; UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) ; -EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +SN76489ENABLE .EQU FALSE ; SN: ENABLE SN76489 SOUND DRIVER +AUDIOTRACE .EQU FALSE ; ENABLE TRACING TO CONSOLE OF SOUND DRIVER +SN7CLK .EQU 3579545 ; SN: PSG CLOCK FREQ, ASSUME MSX STD +SNMODE .EQU SNMODE_RC ; SN: DRIVER MODE: SNMODE_[NONE|RC|VGM] +; +AY38910ENABLE .EQU FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER +AY_CLK .EQU 1789772 ; AY: PSG CLOCK FREQ, ASSUME MSX STD +AYMODE .EQU AYMODE_RCZ180 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC] +; +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_Z180 ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/cfg_una.asm b/Source/HBIOS/cfg_una.asm index 622f53ab..0041d1c8 100644 --- a/Source/HBIOS/cfg_una.asm +++ b/Source/HBIOS/cfg_una.asm @@ -11,20 +11,26 @@ ; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS ; FOR THE PLATFORM. ; -#DEFINE PLATFORM_NAME "UNA" +#DEFINE PLATFORM_NAME "UNA", " [", CONFIG, "]" ; -PLATFORM .EQU PLT_UNA ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] +#INCLUDE "../UBIOS/ubios.inc" +; +;PLATFORM .EQU PLT_UNA ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180|Z280] BIOS .EQU BIOS_UNA ; HARDWARE BIOS: BIOS_[WBW|UNA] ; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE ; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW CPUOSC .EQU 18432000 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +INTMODE .EQU 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) ; RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) ; RTCIO .EQU $70 ; RTC LATCH REGISTER ADR ; DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) + +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING diff --git a/Source/HBIOS/cfg_zeta.asm b/Source/HBIOS/cfg_zeta.asm index f13aeb61..33d614bc 100644 --- a/Source/HBIOS/cfg_zeta.asm +++ b/Source/HBIOS/cfg_zeta.asm @@ -11,71 +11,108 @@ ; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS ; FOR THE PLATFORM. ; -#DEFINE PLATFORM_NAME "ZETA" +#DEFINE PLATFORM_NAME "Zeta", " [", CONFIG, "]" ; -PLATFORM .EQU PLT_ZETA ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] -CPUFAM .EQU CPU_Z80 ; CPU_[Z80|Z180]: CPU FAMILY +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_ZETA ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180|Z280] BIOS .EQU BIOS_WBW ; BIOS_[WBW|UNA]: HARDWARE BIOS BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) ; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO] IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT ; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW CPUOSC .EQU 20000000 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 0 ; INTERRUPT MODE: 0=NONE, 1=MODE 1, 2=MODE 2 +INTMODE .EQU 0 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) DEFSERCFG .EQU SER_38400_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) ; RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) -MEMMGR .EQU MM_SBC ; MM_[SBC|Z2|N8|Z180]: MEMORY MANAGER +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_SBC ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] MPCL_RAM .EQU $78 ; SBC MEM MGR RAM PAGE SELECT REG (WRITE ONLY) MPCL_ROM .EQU $7C ; SBC MEM MGR ROM PAGE SELECT REG (WRITE ONLY) ; RTCIO .EQU $70 ; RTC LATCH REGISTER ADR -PPIBASE .EQU $60 ; PRIMARY PARALLEL PORT REGISTERS BASE ADR ; KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS ; CTCENABLE .EQU FALSE ; ENABLE ZILOG CTC SUPPORT ; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] +; DIAGENABLE .EQU FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING ; -LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) -LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS +LEDENABLE .EQU FALSE ; ENABLES STATUS LED +LEDMODE .EQU LEDMODE_RTC ; LEDMODE_[STD|RTC] +LEDPORT .EQU RTCIO ; STATUS LED PORT ADDRESS LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED ; -DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) +DSKYENABLE .EQU FALSE ; ENABLES DSKY +DSKYMODE .EQU DSKYMODE_V1 ; DSKY VERSION: DSKYMODE_[V1|NG] +DSKYPPIBASE .EQU $60 ; BASE I/O ADDRESS OF DSKY PPI +DSKYOSC .EQU 3000000 ; OSCILLATOR FREQ FOR DSKYNG (IN HZ) ; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -; -HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT -SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) ; DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) ; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS ; +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS UARTCASSPD .EQU SER_300_8N1 ; UART: ECB CASSETTE UART DEFAULT SPEED UARTSBC .EQU TRUE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART UART4 .EQU FALSE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU FALSE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART ; ASCIENABLE .EQU FALSE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) ; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +; ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) ; SIOENABLE .EQU FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) @@ -84,19 +121,21 @@ XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG ; VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) -NECENABLE .EQU FALSE ; NEC: ENABLE NEC UPD7220 VIDEO/KBD DRIVER (NEC.ASM) +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .EQU TMSMODE_NONE ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) ; -SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) -; -AYENABLE .EQU FALSE ; AY: ENABLE AY PSG SOUND DRIVER -; MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM ; FDENABLE .EQU TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .EQU FDMODE_ZETA ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3|DYNO] +FDMODE .EQU FDMODE_ZETA ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 1 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] @@ -114,24 +153,40 @@ PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] -SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU $60 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE ; PRPENABLE .EQU FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) ; PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) +PPPBASE .EQU $60 ; PPP: PPI REGISTERS BASE ADDRESS PPPSDENABLE .EQU TRUE ; PPP: ENABLE PPP DRIVER SD CARD SUPPORT PPPSDTRACE .EQU 1 ; PPP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPPCONENABLE .EQU TRUE ; PPP: ENABLE PPP DRIVER VIDEO/KBD SUPPORT ; HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) ; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +; PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) -PPI_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIOSBASE .EQU $60 ; PIO: PIO REGISTERS BASE ADR FOR SBC PPI ; UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) ; -EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +SN76489ENABLE .EQU FALSE ; SN76489 SOUND DRIVER +AY38910ENABLE .EQU FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_NONE ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/cfg_zeta2.asm b/Source/HBIOS/cfg_zeta2.asm index a91ad204..bcb5cdd7 100644 --- a/Source/HBIOS/cfg_zeta2.asm +++ b/Source/HBIOS/cfg_zeta2.asm @@ -11,25 +11,31 @@ ; THIS FILE CAN BE CONSIDERED A REFERENCE THAT LISTS ALL POSSIBLE CONFIGURATION SETTINGS ; FOR THE PLATFORM. ; -#DEFINE PLATFORM_NAME "ZETA V2" +#DEFINE PLATFORM_NAME "Zeta 2", " [", CONFIG, "]" ; -PLATFORM .EQU PLT_ZETA2 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO] -CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180] +#INCLUDE "hbios.inc" +; +PLATFORM .EQU PLT_ZETA2 ; PLT_[SBC|ZETA|ZETA2|N8|MK4|UNA|RCZ80|RCZ180|EZZ80|SCZ180|DYNO|RCZ280|MBC|RPH] +CPUFAM .EQU CPU_Z80 ; CPU FAMILY: CPU_[Z80|Z180|Z280] BIOS .EQU BIOS_WBW ; HARDWARE BIOS: BIOS_[WBW|UNA] BATCOND .EQU FALSE ; ENABLE LOW BATTERY WARNING MESSAGE HBIOS_MUTEX .EQU FALSE ; ENABLE REENTRANT CALLS TO HBIOS (ADDS OVERHEAD) USELZSA2 .EQU TRUE ; ENABLE FONT COMPRESSION +TICKFREQ .EQU 50 ; DESIRED PERIODIC TIMER INTERRUPT FREQUENCY (HZ) ; -BOOTTYPE .EQU BT_MENU ; BT_[MENU|AUTO], IF AUTO, BOOT DEFAULT AFTER TIMEOUT -BOOT_TIMEOUT .EQU 20 ; AUTO BOOT TIMEOUT IN SECONDS, 0 FOR IMMEDIATE BOOT -BOOT_DEFAULT .EQU 'Z' ; AUTO BOOT SELECTION TO INVOKE AT TIMEOUT +BOOT_TIMEOUT .EQU -1 ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE +BOOT_DELAY .EQU 0 ; FIXED BOOT DELAY IN SECONDS PRIOR TO CONSOLE OUTPUT ; +CPUSPDCAP .EQU SPD_FIXED ; CPU SPEED CHANGE CAPABILITY SPD_FIXED|SPD_HILO +CPUSPDDEF .EQU SPD_HIGH ; CPU SPEED DEFAULT SPD_UNSUP|SPD_HIGH|SPD_LOW CPUOSC .EQU 20000000 ; CPU OSC FREQ IN MHZ -INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2 +INTMODE .EQU 2 ; INTERRUPTS: 0=NONE, 1=MODE 1, 2=MODE 2, 3=MODE 3 (Z280) DEFSERCFG .EQU SER_38400_8N1 ; DEFAULT SERIAL LINE CONFIG (SEE STD.ASM) ; RAMSIZE .EQU 512 ; SIZE OF RAM IN KB (MUST MATCH YOUR HARDWARE!!!) -MEMMGR .EQU MM_Z2 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180] +ROMSIZE .EQU 512 ; SIZE OF ROM IN KB (MUST MATCH YOUR HARDWARE!!!) +ROMSIZE_CHK .EQU 0 ; ROMSIZE VALUE VERIFICATION (0=DISABLED) +MEMMGR .EQU MM_Z2 ; MEMORY MANAGER: MM_[SBC|Z2|N8|Z180|Z280|MBC|RPH] MPGSEL_0 .EQU $78 ; Z2 MEM MGR BANK 0 PAGE SELECT REG (WRITE ONLY) MPGSEL_1 .EQU $79 ; Z2 MEM MGR BANK 1 PAGE SELECT REG (WRITE ONLY) MPGSEL_2 .EQU $7A ; Z2 MEM MGR BANK 2 PAGE SELECT REG (WRITE ONLY) @@ -37,50 +43,87 @@ MPGSEL_3 .EQU $7B ; Z2 MEM MGR BANK 3 PAGE SELECT REG (WRITE ONLY) MPGENA .EQU $7C ; Z2 MEM MGR PAGING ENABLE REGISTER (BIT 0, WRITE ONLY) ; RTCIO .EQU $70 ; RTC LATCH REGISTER ADR -PPIBASE .EQU $60 ; PRIMARY PARALLEL PORT REGISTERS BASE ADR ; KIOENABLE .EQU FALSE ; ENABLE ZILOG KIO SUPPORT KIOBASE .EQU $80 ; KIO BASE I/O ADDRESS ; CTCENABLE .EQU TRUE ; ENABLE ZILOG CTC SUPPORT -CTCMODE .EQU CTCMODE_Z2 ; CTC MODE: CTCMODE_[ZP|Z2|EZ|RC] +CTCDEBUG .EQU FALSE ; ENABLE CTC DRIVER DEBUG OUTPUT CTCBASE .EQU $20 ; CTC BASE I/O ADDRESS +CTCTIMER .EQU TRUE ; ENABLE CTC PERIODIC TIMER +CTCMODE .EQU CTCMODE_CTR ; CTC MODE: CTCMODE_[NONE|CTR|TIM16|TIM256] +CTCPRE .EQU 256 ; PRESCALE CONSTANT (1-256) +CTCPRECH .EQU 0 ; PRESCALE CHANNEL (0-3) +CTCTIMCH .EQU 1 ; TIMER CHANNEL (0-3) +CTCOSC .EQU 921600 ; CTC CLOCK FREQUENCY +; +EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +; +SKZENABLE .EQU FALSE ; ENABLE SERGEY'S Z80-512K FEATURES +; +WDOGMODE .EQU WDOG_NONE ; WATCHDOG MODE: WDOG_[NONE|EZZ80|SKZ] ; DIAGENABLE .EQU FALSE ; ENABLES OUTPUT TO 8 BIT LED DIAGNOSTIC PORT DIAGPORT .EQU $00 ; DIAGNOSTIC PORT ADDRESS DIAGDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON DIAGNOSTIC LEDS +DIAGLVL .EQU DL_CRITICAL ; ERROR LEVEL REPORTING ; -LEDENABLE .EQU FALSE ; ENABLES STATUS LED (SINGLE LED) -LEDPORT .EQU $0E ; STATUS LED PORT ADDRESS +LEDENABLE .EQU FALSE ; ENABLES STATUS LED +LEDMODE .EQU LEDMODE_RTC ; LEDMODE_[STD|RTC] +LEDPORT .EQU RTCIO ; STATUS LED PORT ADDRESS LEDDISKIO .EQU TRUE ; ENABLES DISK I/O ACTIVITY ON STATUS LED ; -DSKYENABLE .EQU FALSE ; ENABLES DSKY (DO NOT COMBINE WITH PPIDE) +DSKYENABLE .EQU FALSE ; ENABLES DSKY +DSKYMODE .EQU DSKYMODE_V1 ; DSKY VERSION: DSKYMODE_[V1|NG] +DSKYPPIBASE .EQU $60 ; BASE I/O ADDRESS OF DSKY PPI +DSKYOSC .EQU 3000000 ; OSCILLATOR FREQ FOR DSKYNG (IN HZ) ; +BOOTCON .EQU 0 ; BOOT CONSOLE DEVICE CRTACT .EQU FALSE ; ACTIVATE CRT (VDU,CVDU,PROPIO,ETC) AT STARTUP VDAEMU .EQU EMUTYP_ANSI ; VDA EMULATION: EMUTYP_[TTY|ANSI] +VDAEMU_SERKBD .EQU $FF ; VDA EMULATION: SERIAL KBD UNIT #, OR $FF FOR HW KBD ANSITRACE .EQU 1 ; ANSI DRIVER TRACE LEVEL (0=NO,1=ERRORS,2=ALL) -; -HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT -SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +MKYENABLE .EQU FALSE ; MSX 5255 PPI KEYBOARD COMPATIBLE DRIVER (REQUIRES TMS VDA DRIVER) ; DSRTCENABLE .EQU TRUE ; DSRTC: ENABLE DS-1302 CLOCK DRIVER (DSRTC.ASM) DSRTCMODE .EQU DSRTCMODE_STD ; DSRTC: OPERATING MODE: DSRTC_[STD|MFPIC] DSRTCCHG .EQU FALSE ; DSRTC: FORCE BATTERY CHARGE ON (USE WITH CAUTION!!!) ; +DS1501RTCENABLE .EQU FALSE ; DS1501RTC: ENABLE DS-1501 CLOCK DRIVER (DS1501RTC.ASM) +DS1501RTC_BASE .EQU $50 ; DS1501RTC: I/O BASE ADDRESS +; BQRTCENABLE .EQU FALSE ; BQRTC: ENABLE BQ4845 CLOCK DRIVER (BQRTC.ASM) BQRTC_BASE .EQU $50 ; BQRTC: I/O BASE ADDRESS ; +INTRTCENABLE .EQU FALSE ; ENABLE PERIODIC INTERRUPT CLOCK DRIVER (INTRTC.ASM) +; +RP5RTCENABLE .EQU FALSE ; RP5C01 RTC BASED CLOCK (RP5RTC.ASM) +; +HTIMENABLE .EQU FALSE ; ENABLE SIMH TIMER SUPPORT +SIMRTCENABLE .EQU FALSE ; ENABLE SIMH CLOCK DRIVER (SIMRTC.ASM) +; +DS7RTCENABLE .EQU FALSE ; DS7RTC: ENABLE DS-1307 I2C CLOCK DRIVER (DS7RTC.ASM) +DS7RTCMODE .EQU DS7RTCMODE_PCF ; DS7RTC: OPERATING MODE: DS7RTC_[PCF] +; +DUARTENABLE .EQU FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +; UARTENABLE .EQU TRUE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) UARTOSC .EQU 1843200 ; UART: OSC FREQUENCY IN MHZ +UARTINTS .EQU FALSE ; UART: INCLUDE INTERRUPT SUPPORT UNDER IM1/2/3 UARTCFG .EQU DEFSERCFG ; UART: LINE CONFIG FOR UART PORTS UARTCASSPD .EQU SER_300_8N1 ; UART: ECB CASSETTE UART DEFAULT SPEED UARTSBC .EQU TRUE ; UART: AUTO-DETECT SBC/ZETA ONBOARD UART +UARTSBCFORCE .EQU FALSE ; UART: FORCE DETECTION OF SBC UART (FOR SIMH) UARTCAS .EQU FALSE ; UART: AUTO-DETECT ECB CASSETTE UART UARTMFP .EQU FALSE ; UART: AUTO-DETECT MF/PIC UART UART4 .EQU FALSE ; UART: AUTO-DETECT 4UART UART +UARTRC .EQU FALSE ; UART: AUTO-DETECT RC UART +UARTDUAL .EQU FALSE ; UART: AUTO-DETECT DUAL UART ; ASCIENABLE .EQU FALSE ; ASCI: ENABLE Z180 ASCI SERIAL DRIVER (ASCI.ASM) ; +Z2UENABLE .EQU FALSE ; Z2U: ENABLE Z280 UART SERIAL DRIVER (Z2U.ASM) +; ACIAENABLE .EQU FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) ; SIOENABLE .EQU FALSE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) @@ -89,19 +132,21 @@ XIOCFG .EQU DEFSERCFG ; XIO: SERIAL LINE CONFIG ; VDUENABLE .EQU FALSE ; VDU: ENABLE VDU VIDEO/KBD DRIVER (VDU.ASM) CVDUENABLE .EQU FALSE ; CVDU: ENABLE CVDU VIDEO/KBD DRIVER (CVDU.ASM) -NECENABLE .EQU FALSE ; NEC: ENABLE NEC UPD7220 VIDEO/KBD DRIVER (NEC.ASM) +GDCENABLE .EQU FALSE ; GDC: ENABLE 7220 GDC VIDEO/KBD DRIVER (GDC.ASM) TMSENABLE .EQU FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .EQU TMSMODE_NONE ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MBC|MSX|MSX9958|MSXKBD|COLECO] +TMSTIMENABLE .EQU FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) VGAENABLE .EQU FALSE ; VGA: ENABLE VGA VIDEO/KBD DRIVER (VGA.ASM) ; -SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) -; -AYENABLE .EQU FALSE ; AY: ENABLE AY PSG SOUND DRIVER -; MDENABLE .EQU TRUE ; MD: ENABLE MEMORY (ROM/RAM) DISK DRIVER (MD.ASM) +MDROM .EQU TRUE ; MD: ENABLE ROM DISK +MDRAM .EQU TRUE ; MD: ENABLE RAM DISK MDTRACE .EQU 1 ; MD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) +MDFFENABLE .EQU FALSE ; MD: ENABLE FLASH FILE SYSTEM ; FDENABLE .EQU TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) -FDMODE .EQU FDMODE_ZETA2 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|DIDE|N8|DIO3|DYNO] +FDMODE .EQU FDMODE_ZETA2 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPFDC|MBC] +FDCNT .EQU 1 ; FD: NUMBER OF FLOPPY DRIVES ON THE INTERFACE (1-2) FDTRACE .EQU 1 ; FD: TRACE LEVEL (0=NO,1=FATAL,2=ERRORS,3=ALL) FDMEDIA .EQU FDM144 ; FD: DEFAULT MEDIA FORMAT FDM[720|144|360|120|111] FDMEDIAALT .EQU FDM720 ; FD: ALTERNATE MEDIA FORMAT FDM[720|144|360|120|111] @@ -119,24 +164,40 @@ PPIDE0A8BIT .EQU FALSE ; PPIDE 0A (MASTER): 8 BIT XFER PPIDE0B8BIT .EQU FALSE ; PPIDE 0B (SLAVE): 8 BIT XFER ; SDENABLE .EQU FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) -SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT] -SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD & SC ONLY +SDMODE .EQU SDMODE_PPI ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR] +SDPPIBASE .EQU $60 ; SD: BASE I/O ADDRESS OF PPI FOR PPI MODDE +SDCNT .EQU 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY SDTRACE .EQU 1 ; SD: TRACE LEVEL (0=NO,1=ERRORS,2=ALL) SDCSIOFAST .EQU FALSE ; SD: ENABLE TABLE-DRIVEN BIT INVERTER IN CSIO MODE ; PRPENABLE .EQU FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) ; PPPENABLE .EQU FALSE ; PPP: ENABLE ZETA PARALLEL PORT PROPELLER BOARD DRIVER (PPP.ASM) +PPPBASE .EQU $60 ; PPP: PPI REGISTERS BASE ADDRESS PPPSDENABLE .EQU TRUE ; PPP: ENABLE PPP DRIVER SD CARD SUPPORT PPPSDTRACE .EQU 1 ; PPP: SD CARD TRACE LEVEL (0=NO,1=ERRORS,2=ALL) PPPCONENABLE .EQU TRUE ; PPP: ENABLE PPP DRIVER VIDEO/KBD SUPPORT ; HDSKENABLE .EQU FALSE ; HDSK: ENABLE SIMH HDSK DISK DRIVER (HDSK.ASM) ; +PIOENABLE .EQU FALSE ; PIO: ENABLE ZILOG PIO DRIVER (PIO.ASM) +; +LPTENABLE .EQU FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) +; PIO_4P .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB 4P BOARD PIO_ZP .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR ECB ZILOG PERIPHERALS BOARD (PIO.ASM) -PPI_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIO_SBC .EQU FALSE ; PIO: ENABLE PARALLEL PORT DRIVER FOR 8255 CHIP +PIOSBASE .EQU $60 ; PIO: PIO REGISTERS BASE ADR FOR SBC PPI ; UFENABLE .EQU FALSE ; UF: ENABLE ECB USB FIFO DRIVER (UF.ASM) ; -EIPCENABLE .EQU FALSE ; EIPC: ENABLE Z80 EIPC (Z84C15) INITIALIZATION +SN76489ENABLE .EQU FALSE ; SN76489 SOUND DRIVER +AY38910ENABLE .EQU FALSE ; AY: AY-3-8910 / YM2149 SOUND DRIVER +SPKENABLE .EQU FALSE ; SPK: ENABLE RTC LATCH IOBIT SOUND DRIVER (SPK.ASM) +; +DMAENABLE .EQU FALSE ; DMA: ENABLE DMA DRIVER (DMA.ASM) +DMABASE .EQU $E0 ; DMA: DMA BASE ADDRESS +DMAMODE .EQU DMAMODE_NONE ; DMA: DMA MODE (NONE|ECB|Z180|Z280|RC|MBC) +; +YM2612ENABLE .EQU FALSE ; YM2612: ENABLE YM2612 DRIVER (MUTE STUB) +VGMBASE .EQU $C0 ; YM2612: BASE ADDRESS FOR VGM BOARD (YM2612/SN76469s/CTC) diff --git a/Source/HBIOS/ctc.asm b/Source/HBIOS/ctc.asm index 814fd110..701ea245 100644 --- a/Source/HBIOS/ctc.asm +++ b/Source/HBIOS/ctc.asm @@ -5,120 +5,285 @@ ; DISPLAY CONFIGURATION DETAILS ;______________________________________________________________________________________________________________________ ; -; ONLY IM2 IMPLEMENTED BELOW. I DON'T SEE ANY REASONABLE WAY TO -; IMPLEMENT AN IM1 TIMER BECAUSE THE CTC PROVIDES NO WAY TO -; DETERMINE IF IT WAS THE CAUSE OF AN INTERRUPT OR A WAY TO +CTC_DEFCFG .EQU %01010011 ; CTC DEFAULT CONFIG +CTC_CTRCFG .EQU %01010111 ; CTC COUNTER MODE CONFIG +CTC_TIM16CFG .EQU %00010111 ; CTC TIMER/16 MODE CONFIG +CTC_TIM256CFG .EQU %00110111 ; CTC TIMER/256 MODE CONFIG +CTC_TIMCFG .EQU %11010111 ; CTC TIMER CHANNEL CONFIG + ; |||||||+-- CONTROL WORD FLAG + ; ||||||+--- SOFTWARE RESET + ; |||||+---- TIME CONSTANT FOLLOWS + ; ||||+----- AUTO TRIGGER WHEN TIME CONST LOADED + ; |||+------ RISING EDGE TRIGGER + ; ||+------- TIMER MODE PRESCALER (0=16, 1=256) + ; |+-------- COUNTER MODE + ; +--------- INTERRUPT ENABLE +; +;================================================================================================== +; ONLY IM2 IMPLEMENTED BELOW. I DON'T SEE ANY REASONABLE WAY TO IMPLEMENT AN IM1 TIMER BECAUSE +; THE CTC PROVIDES NO WAY TO DETERMINE IF IT WAS THE CAUSE OF AN INTERRUPT OR A WAY TO ; DETERMINE WHICH CHANNEL CAUSED AN INTERRUPT. +;================================================================================================== ; #IF (INTMODE != 2) - .ECHO "*** ERROR: CTC REQUIRES INTMODE 2!!!\n" - !!! ; FORCE AN ASSEMBLY ERROR + .ECHO "*** WARNING: CTC TIMER DISABLED -- INTMODE 2 REQUIRED!!!\n" #ENDIF ; -; CONFIGURATION +#IF (CTCTIMER & (INTMODE == 2)) ; -#IF (CTCMODE == CTCMODE_ZP) -CTCPC .EQU CTCC ; PRESCALE CHANNEL -CTCPCC .EQU 0 ; PRESCALE CHANNEL CONSTANT -CTCTC .EQU CTCD ; TIMER CHANNEL -CTCTCC .EQU 48 ; TIMER CHANNEL CONSTANT -CTCTIVT .EQU INT_CTC0D ; TIMER CHANNEL IVT ENTRY -#ENDIF + #IF (INT_CTC0A % 4) + + .ECHO INT_CTC0A + .ECHO "\n" + .ECHO (INT_CTC0A % 4) + .ECHO "\n" + + .ECHO "*** ERROR: CTC BASE VECTOR NOT DWORD ALIGNED!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR + #ENDIF ; -#IF (CTCMODE == CTCMODE_Z2) -CTCPC .EQU CTCA ; PRESCALE CHANNEL -CTCPCC .EQU 0 ; PRESCALE CHANNEL CONSTANT -CTCTC .EQU CTCB ; TIMER CHANNEL -CTCTCC .EQU 72 ; TIMER CHANNEL CONSTANT -CTCTIVT .EQU INT_CTC0B ; TIMER CHANNEL IVT ENTRY -#ENDIF +;================================================================================================== +; TIMER SETUP ; -#IF (CTCMODE == CTCMODE_EZ) -CTCPC .EQU CTCC ; PRESCALE CHANNEL -CTCPCC .EQU 0 ; PRESCALE CHANNEL CONSTANT -CTCTC .EQU CTCD ; TIMER CHANNEL -CTCTCC .EQU 72 ; TIMER CHANNEL CONSTANT -CTCTIVT .EQU INT_CTC0D ; TIMER CHANNEL IVT ENTRY -#ENDIF +; A PERIODIC INTERRUPT TIMER CAN BE SETUP USING EITHER THE CPU SYSTEM CLOCK OR AN EXTERNAL +; OSCILLATOR CONNECTED TO THE CTC. THE DEFACTO PERIOD FOR THIS TIMER IS 50Hz OR 60Hz. +; +; THE DESIRED TIMER PERIOD IS SET IN THE CONFIGURATION: +; TICKFREQ .SET 60 ; OR +; TICKFREQ .SET 50 +; +; THIS DRIVER USES TWO CTC CHANNELS TO CREATE A TWO STEP DIVIDER THAT DIVIDES THE CPU SYSTEM +; CLOCK OR EXTERNAL OSCILLATOR INTO A PERIODIC TICK THAT GENERATES AN INTERRUPT. +; +; THE CPU CLOCK OR CTC EXTERNAL OSCILLATOR NEEDS TO BE LESS THAN 3.932160MHz FOR A 60HZ TIMER +; TICK OR 3.276800MHz FOR A 50Hz TIMER TICK. +; +; THE CHANNELS USED ARE DEFINED BY THE CTCPRECH AND CTCTIMCH DEFINITIONS - TYPICALLY 2 & 3. +; EXTERNAL HARDWARE MUST BE CONFIGURED TO MATCH THIS CONFIGURATION. +; +; EACH CHANNEL SUCCESSIVELY DIVIDES THE CLOCK OR OSCILLATOR FREQUENCY DOWN TO A 50 OR 60Hz TICK. +; THE FIRST DIVIDER CHANNEL IS THE PRESCALER, THE SECOND IS THE TIMER CHANNEL. +; +; IF CTCMODE IS CTCMODE_CTR THEN THE OSCILLATOR CONNECTED TO CTC PRESCALER CHANNEL IS USED. +; +; THE CONFIGURATION FILES DEFINE THE OSCILLATOR FREQUENCY THAT IS CONNECTED TO THE PRESCALER +; CHANNEL. I.E. THE EXTERNAL HARDWARE CONNECTED TO THE CTC. +; +; FOR A 60Hz TIMER WITH A 3.579545Mhz OSCILLATOR USE: +; CTCMODE .SET CTCMODE_CTR +; TICKFREQ .SET 60 +; CTCOSC .SET 3579545 +; +; IF CTCMODE IS CTCMODE_TIM16 OR CTCMODE_TIM256 THE CPU SYSTEM CLOCK FREQUENCY IS USED. +; +; THIS MODE HAS LIMITED VALUE AS MANY SYSTEMS OPERATE ABOVE THE USABLE TOP FREQUENCY. +; THE CONFIGURATION FILE MUST BE UPDATED TO MATCH YOUR CPU CLOCK FREQUENCY. +; +; FOR A 60Hz TIMER WITH A 2Mhz OSCILLATOR USE: +; CTCMODE .SET CTCMODE_TIM256 +; TICKFREQ .SET 60 +; CTCOSC .SET 2000000 +; +; NOTE THAT IF CPU SPEED IS CHANGED IN THIS MODE, THE TIMER SPEED WILL ALSO CHANGE. +; +;================================================================================================== +; +CTC_PREIO .EQU CTCBASE + CTCPRECH +CTC_SCLIO .EQU CTCBASE + CTCTIMCH +; + #IF (CTCMODE == CTCMODE_CTR) +CTC_PRECFG .EQU CTC_CTRCFG +CTC_PRESCL .EQU 1 + #ENDIF + #IF (CTCMODE == CTCMODE_TIM16) +CTC_PRECFG .EQU CTC_TIM16CFG +CTC_PRESCL .EQU 16 + #ENDIF + #IF (CTCMODE == CTCMODE_TIM256) +CTC_PRECFG .EQU CTC_TIM256CFG +CTC_PRESCL .EQU 256 + #ENDIF +; +CTC_DIV .EQU CTCOSC / CTC_PRESCL / TICKFREQ +; +CTC_DIVHI .EQU CTCPRE +CTC_DIVLO .EQU (CTC_DIV / CTC_DIVHI) +; + .ECHO "CTC DIVISOR: " + .ECHO CTC_DIV + .ECHO ", HI: " + .ECHO CTC_DIVHI + .ECHO ", LO: " + .ECHO CTC_DIVLO + .ECHO "\n" +; + #IF ((CTC_DIV == 0) | (CTC_DIV > $FFFF)) + .ECHO "COMPUTED CTC DIVISOR IS UNUSABLE!\n" + !!! + #ENDIF +; + #IF ((CTC_DIVHI > $100) | (CTC_DIVLO > $100)) + .ECHO "COMPUTED CTC DIVISOR IS UNUSABLE!\n" + !!! + #ENDIF +; + #IF ((CTC_DIVHI * CTC_DIVLO * CTC_PRESCL * TICKFREQ) != CTCOSC) + .ECHO "WARNING: COMPUTED CTC DIVISOR IS INACCURATE!\n" + #ENDIF +; +CTCTIVT .EQU INT_CTC0A + CTCTIMCH ; -#IF (CTCMODE == CTCMODE_RC) -CTCPC .EQU CTCC ; PRESCALE CHANNEL -CTCPCC .EQU 0 ; PRESCALE CHANNEL CONSTANT -CTCTC .EQU CTCD ; TIMER CHANNEL -CTCTCC .EQU 144 ; TIMER CHANNEL CONSTANT -CTCTIVT .EQU INT_CTC0D ; TIMER CHANNEL IVT ENTRY #ENDIF ; +;================================================================================================== +; CTC PRE-INITIALIZATION +; +; CHECK TO SEE IF A CTC EXISTS. IF IT EXISTS, ALL FOUR CTC CHANNELS ARE PROGRAMMED TO: +; INTERRUPTS DISABLED, COUNTER MODE, RISING EDGE TRIGGER, RESET STATE. ; +; IF THE CTCTIMER CONFIGURATION IS SET, THEN A PERIOD INTERRUPT TIMER IS SET UP USING CTC CHANNELS +; 2 (CTCPRECH) & 3 (CTCTIMCH). THE TIMER WILL BE SETUP TO 50 OR 60HZ DEPENDING ON CONFIGURATION +; SETTING TICKFREQ. CHANNEL 3 WILL GENERATE THE TICK INTERRUPT.. +;================================================================================================== ; CTC_PREINIT: + CALL CTC_DETECT ; DO WE HAVE ONE? + LD (CTC_EXIST),A ; SAVE IT + RET NZ ; ABORT IF NONE +; + ; RESET ALL CTC CHANNELS + LD B,4 ; 4 CHANNELS + LD C,CTCBASE ; FIRST CHANNEL PORT +CTC_PREINIT1: + LD A,CTC_DEFCFG ; CTC DEFAULT CONFIG + OUT (C),A ; CTC COMMAND + INC C ; NEXT CHANNEL PORT + DJNZ CTC_PREINIT1 +; +#IF (CTCTIMER & (INTMODE == 2)) ; SETUP TIMER INTERRUPT IVT SLOT LD HL,HB_TIMINT ; TIMER INT HANDLER ADR LD (IVT(CTCTIVT)),HL ; IVT ENTRY FOR TIMER CHANNEL ; ; CTC USES 4 CONSECUTIVE VECTOR POSITIONS, ONE FOR ; EACH CHANNEL. BELOW WE SET THE BASE VECTOR TO THE - ; START OF THE IVT, SO THE FIRST FOUR ENTIRES OF THE - ; IVT CORRESPOND TO CTC CHANNELS A-D - LD A,0 + ; START OF THE IVT, SO THE FIRST FOUR ENTRIES OF THE + ; IVT CORRESPOND TO CTC CHANNELS A-D. + LD A,INT_CTC0A * 2 OUT (CTCBASE),A ; SETUP CTC BASE INT VECTOR ; ; IN ORDER TO DIVIDE THE CTC INPUT CLOCK DOWN TO THE - ; DESIRED 50 HZ PERIODIC INTERRUPT, WE NEED TO CONFIGURE ONE + ; DESIRED PERIODIC INTERRUPT, WE NEED TO CONFIGURE ONE ; CTC CHANNEL AS A PRESCALER AND ANOTHER AS THE ACTUAL ; TIMER INTERRUPT. THE PRESCALE CHANNEL OUTPUT MUST BE WIRED ; TO THE TIMER CHANNEL TRIGGER INPUT VIA HARDWARE. - LD A,%01010111 ; PRESCALE CHANNEL CONTROL WORD VALUE - ; |||||||+-- 1=CONTROL WORD FLAG - ; ||||||+--- 1=SOFTWARE RESET - ; |||||+---- 1=TIME CONSTANT FOLLOWS - ; ||||+----- 0=AUTO TRIGGER WHEN TIME CONST LOADED - ; |||+------ 1=RISING EDGE TRIGGER - ; ||+------- 0=PRESCALER OF 16 (NOT USED) - ; |+-------- 1=COUNTER MODE - ; +--------- 0=NO INTERRUPTS - OUT (CTCPC),A ; SETUP PRESCALE CHANNEL - LD A,CTCPCC ; PRESCALE CHANNEL CONSTANT - OUT (CTCPC),A ; SET PRESCALE CONSTANT - ; - LD A,%11010111 ; TIMER CHANNEL CONTROL WORD VALUE - ; |||||||+-- 1=CONTROL WORD FLAG - ; ||||||+--- 1=SOFTWARE RESET - ; |||||+---- 1=TIME CONSTANT FOLLOWS - ; ||||+----- 0=AUTO TRIGGER WHEN TIME CONST LOADED - ; |||+------ 1=RISING EDGE TRIGGER - ; ||+------- 0=PRESCALER OF 16 (NOT USED) - ; |+-------- 1=COUNTER MODE - ; +--------- 1=ENABLE INTERRUPTS - OUT (CTCTC),A ; SETUP TIMER CHANNEL - LD A,CTCTCC ; TIMER CHANNEL CONSTANT - OUT (CTCTC),A ; SET TIMER CONSTANT + LD A,CTC_PRECFG ; PRESCALE CHANNEL CONFIGURATION + OUT (CTC_PREIO),A ; SETUP PRESCALE CHANNEL + LD A,CTC_DIVHI & $FF ; PRESCALE CHANNEL CONSTANT + OUT (CTC_PREIO),A ; SET PRESCALE CONSTANT +; + LD A,CTC_TIMCFG ; TIMER CHANNEL CONTROL WORD VALUE + OUT (CTC_SCLIO),A ; SETUP TIMER CHANNEL + LD A,CTC_DIVLO & $FF ; TIMER CHANNEL CONSTANT + OUT (CTC_SCLIO),A ; SET TIMER CONSTANT +; +#ENDIF ; XOR A RET ; -; +;================================================================================================== +; DRIVER INITIALIZATION +;================================================================================================== ; CTC_INIT: ; MINIMAL INIT CTC_PRTCFG: ; ANNOUNCE PORT CALL NEWLINE ; FORMATTING - PRTS("CTC: MODE=$") ; FORMATTING -#IF (CTCMODE == CTCMODE_ZP) - PRTS("ZP$") -#ENDIF -#IF (CTCMODE == CTCMODE_Z2) - PRTS("Z2$") -#ENDIF -#IF (CTCMODE == CTCMODE_EZ) - PRTS("EZ$") -#ENDIF -#IF (CTCMODE == CTCMODE_RC) - PRTS("RC$") -#ENDIF + PRTS("CTC:$") ; FORMATTING +; PRTS(" IO=0x$") ; FORMATTING LD A,CTCBASE ; GET BASE PORT CALL PRTHEXBYTE ; PRINT BASE PORT +; + LD A,(CTC_EXIST) ; IS IT THERE? + OR A ; 0 MEANS YES + JR Z,CTC_PRTCFG1 ; IF SO, CONTINUE +; + ; NOTIFY NO CTC HARDWARE + PRTS(" NOT PRESENT$") + OR $FF + RET +; +CTC_PRTCFG1: +; +#IF (CTCTIMER & (INTMODE == 2)) +; + PRTS(" TIMER MODE=$") ; FORMATTING + #IF (CTCMODE == CTCMODE_CTR) + PRTS("CTR$") + #ENDIF + #IF (CTCMODE == CTCMODE_TIM16) + PRTS("TIM16$") + #ENDIF + #IF (CTCMODE == CTCMODE_TIM256) + PRTS("TIM256$") + #ENDIF +; + #IF (CTCDEBUG) + PRTS(" DIVHI=$") + LD A,CTC_DIVHI & $FF + CALL PRTHEXBYTE +; + PRTS(" DIVLO=$") + LD A,CTC_DIVLO & $FF + CALL PRTHEXBYTE +; + PRTS(" PREIO=$") + LD A,CTC_PREIO + CALL PRTHEXBYTE +; + PRTS(" SCLIO=$") + LD A,CTC_SCLIO + CALL PRTHEXBYTE +; + PRTS(" DIV=$") + LD BC,CTC_DIV + CALL PRTHEXWORD + #ENDIF +; +#ENDIF ; XOR A RET +; +;================================================================================================== +; DETECT CTC BY CHECKING REGISTER CAN BE WRITTEN AND READ, AND THEN BY SETTING UP ONE CHANNEL IN +; TIMER MODE AND CHECKING IT IS COUNTING DOWN. +;================================================================================================== +; +CTC_DETECT: + LD A,CTC_TIM256CFG + OUT (CTCBASE),A + XOR A + OUT (CTCBASE),A + ; CTC SHOULD NOW BE RUNNING WITH TIME CONSTANT 0 + LD A,CTC_TIM256CFG ; RESET + OUT (CTCBASE),A + IN A,(CTCBASE) ; SHOULD READ 0 NOW + CP 0 + JR NZ,CTC_NO + LD A,$FF ; TIME CONSTANT $FF + OUT (CTCBASE),A + IN A,(CTCBASE) ; SHOULD NOT BE 0 NOW + CP 0 + JR Z,CTC_NO + XOR A + RET +CTC_NO: + OR $FF + RET +; +; +; +CTC_EXIST .DB $FF diff --git a/Source/HBIOS/cvdu.asm b/Source/HBIOS/cvdu.asm index 9ee98c40..b0dd0b7b 100644 --- a/Source/HBIOS/cvdu.asm +++ b/Source/HBIOS/cvdu.asm @@ -18,17 +18,34 @@ ; CVDU_BASE .EQU $E0 ; +#IF (CVDUMODE == CVDUMODE_ECB) 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 +#ENDIF +; +#IF (CVDUMODE == CVDUMODE_MBC) +CVDU_KBDDATA .EQU CVDU_BASE + $02 ; KBD CTLR DATA PORT +CVDU_KBDST .EQU CVDU_BASE + $03 ; 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 + $05 ; READ/WRITE M8563 DATA +#ENDIF ; CVDU_ROWS .EQU 25 CVDU_COLS .EQU 80 ; -#DEFINE USEFONT8X16 -#DEFINE CVDU_FONT FONT8X16 +#IF (CVDUMON == CVDUMON_CGA) + #DEFINE USEFONTCGA + #DEFINE CVDU_FONT FONTCGA +#ENDIF +; +#IF (CVDUMON == CVDUMON_EGA) + #DEFINE USEFONT8X16 + #DEFINE CVDU_FONT FONT8X16 +#ENDIF ; TERMENABLE .SET TRUE ; INCLUDE TERMINAL PSEUDODEVICE DRIVER ; @@ -38,9 +55,24 @@ TERMENABLE .SET TRUE ; INCLUDE TERMINAL PSEUDODEVICE DRIVER ; CVDU_INIT: LD IY,CVDU_IDAT ; POINTER TO INSTANCE DATA - - CALL NEWLINE ; FORMATTING - PRTS("CVDU: IO=0x$") + + CALL NEWLINE + PRTS("CVDU: MODE=$") +#IF (CVDUMODE == CVDUMODE_ECB) + PRTS("ECB$") +#ENDIF +#IF (CVDUMODE == CVDUMODE_MBC) + PRTS("MBC$") +#ENDIF +; +#IF (CVDUMON == CVDUMON_CGA) + PRTS(" CGA$") +#ENDIF +#IF (CVDUMON == CVDUMON_EGA) + PRTS(" EGA$") +#ENDIF +; + PRTS(" IO=0x$") LD A,CVDU_STAT CALL PRTHEXBYTE CALL CVDU_PROBE ; CHECK FOR HW PRESENCE @@ -94,8 +126,10 @@ CVDU_FNTBL: .DW KBD_STAT .DW KBD_FLUSH .DW KBD_READ + .DW CVDU_VDARDC #IF (($ - CVDU_FNTBL) != (VDA_FNCNT * 2)) .ECHO "*** INVALID CVDU FUNCTION TABLE ***\n" + !!!!! #ENDIF CVDU_VDAINI: @@ -112,11 +146,11 @@ CVDU_VDAQRY: LD HL,0 ; EXTRACTION OF CURRENT BITMAP DATA NOT SUPPORTED YET XOR A ; SIGNAL SUCCESS RET - + CVDU_VDARES: LD A,$0E ; ATTRIBUTE IS STANDARD WHITE ON BLACK LD (CVDU_ATTR),A ; SAVE IT - + LD DE,0 ; ROW = 0, COL = 0 CALL CVDU_XY ; SEND CURSOR TO TOP LEFT LD A,' ' ; BLANK THE SCREEN @@ -124,24 +158,27 @@ CVDU_VDARES: CALL CVDU_FILL ; DO IT LD DE,0 ; ROW = 0, COL = 0 CALL CVDU_XY ; SEND CURSOR TO TOP LEFT - + XOR A RET CVDU_VDADEV: LD D,VDADEV_CVDU ; D := DEVICE TYPE LD E,0 ; E := PHYSICAL UNIT IS ALWAYS ZERO + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,CVDU_BASE ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET - + CVDU_VDASCS: - CALL PANIC ; NOT IMPLEMENTED (YET) - + SYSCHKERR(ERR_NOTIMPL) ; NOT IMPLEMENTED (YET) + RET + CVDU_VDASCP: CALL CVDU_XY ; SET CURSOR POSITION XOR A ; SIGNAL SUCCESS RET - + CVDU_VDASAT: ; INCOMING IS: -----RUB (R=REVERSE, U=UNDERLINE, B=BLINK) ; TRANSFORM TO: -RUB---- @@ -158,7 +195,7 @@ CVDU_VDASAT: LD (CVDU_ATTR),A ; AND SAVE THE RESULT XOR A ; SIGNAL SUCCESS RET - + CVDU_VDASCO: ; INCOMING IS: IBGRIBGR (I=INTENSITY, B=BLUE, G=GREEN, R=RED) ; TRANSFORM TO: ----RGBI (DISCARD BACKGROUND COLOR IN HIGH NIBBLE) @@ -175,13 +212,13 @@ CVDU_VDASCO1: LD (CVDU_ATTR),A ; AND SAVE THE RESULT XOR A ; SIGNAL SUCCESS RET - + CVDU_VDAWRC: LD A,E ; CHARACTER TO WRITE GOES IN A CALL CVDU_PUTCHAR ; PUT IT ON THE SCREEN XOR A ; SIGNAL SUCCESS RET - + CVDU_VDAFIL: LD A,E ; FILL CHARACTER GOES IN A EX DE,HL ; FILL LENGTH GOES IN DE @@ -197,7 +234,7 @@ CVDU_VDACPY: POP BC ; RECOVER LENGTH IN BC LD DE,(CVDU_POS) ; PUT DEST IN DE JP CVDU_BLKCPY ; DO A BLOCK COPY - + CVDU_VDASCR: LD A,E ; LOAD E INTO A OR A ; SET FLAGS @@ -213,6 +250,15 @@ CVDU_VDASCR1: POP DE ; RECOVER E INC E ; INCREMENT IT JR CVDU_VDASCR ; LOOP + +;---------------------------------------------------------------------- +; READ VALUE AT CURRENT VDU BUFFER POSITION +; RETURN E = CHARACTER, B = COLOUR, C = ATTRIBUTES +;---------------------------------------------------------------------- + +CVDU_VDARDC: + OR $FF ; UNSUPPORTED FUNCTION + RET ; ;====================================================================== ; CVDU DRIVER - PRIVATE DRIVER FUNCTIONS @@ -246,7 +292,7 @@ CVDU_WRX: ;---------------------------------------------------------------------- ; READ M8563 REGISTERS ; CVDU_RD READS VDU REGISTER SPECIFIED IN C AND RETURNS VALUE IN A -; CVDU_RDX READS VDU REGISTER PAIR SPECIFIED BY C, C+1 +; CVDU_RDX READS VDU REGISTER PAIR SPECIFIED BY C, C+1 ; AND RETURNS VALUE IN HL ;---------------------------------------------------------------------- ; @@ -317,7 +363,7 @@ CVDU_CRTINIT1: ; ASSUMES THAT VDU RAM SIZE IS SET FOR 64KB ABOVE ; A. WRITE ZERO TO ADDRESS $0000 ; B. WRITE NON-ZERO TO ADDRESS $0100 -; C. CHECK THE VALUE IN ADDRESS $0000; IF IT CHANGED, +; C. CHECK THE VALUE IN ADDRESS $0000; IF IT CHANGED, ; 16K DRAM CHIPS INSTALLED; IF NOT, 64K DRAM CHIPS INSTALLED ; IF 16KB RAM DETECTED, ADJUST VDU REGISTERS APPROPRIATELY ; @@ -367,7 +413,7 @@ CVDU_LOADFONT: LD (CVDU_STACK),SP ; SAVE STACK LD HL,(CVDU_STACK) ; AND SHIFT IT LD DE,$2000 ; DOWN 4KB TO - CCF ; CREATE A + OR A ; CREATE A SBC HL,DE ; DECOMPRESSION BUFFER LD SP,HL ; HL POINTS TO BUFFER EX DE,HL ; START OF STACK BUFFER @@ -424,7 +470,7 @@ CVDU_XY2IDX: RET ; RETURN ; ;---------------------------------------------------------------------- -; WRITE VALUE IN A TO CURRENT VDU BUFFER POSTION, ADVANCE CURSOR +; WRITE VALUE IN A TO CURRENT VDU BUFFER POSITION, ADVANCE CURSOR ;---------------------------------------------------------------------- ; CVDU_PUTCHAR: @@ -436,7 +482,7 @@ CVDU_PUTCHAR: CALL CVDU_WRX ; DO IT ; PUT THE CHARACTER THERE - POP AF ; RECOVER CHARACTER VALLUE TO WRITE + POP AF ; RECOVER CHARACTER VALUE TO WRITE LD C,31 ; DATA REGISTER CALL CVDU_WR ; DO IT @@ -475,19 +521,19 @@ CVDU_FILL: POP DE ; RECOVER FILL COUNT LD A,(CVDU_ATTR) ; SET ATTRIBUTE VALUE FOR ATTRIBUTE FILL JR CVDU_FILL1 ; DO ATTRIBUTE FILL AND RETURN - + CVDU_FILL1: LD B,A ; SAVE REQUESTED FILL VALUE - + ; CHECK FOR VALID FILL LENGTH LD A,D ; LOAD D OR E ; OR WITH E RET Z ; BAIL OUT IF LENGTH OF ZERO SPECIFIED - + ; POINT TO BUFFER LOCATION TO START FILL LD C,18 ; UPDATE ADDRESS REGISTER PAIR CALL CVDU_WRX ; DO IT - + ; SET MODE TO BLOCK WRITE LD C,24 ; BLOCK MODE CONTROL REGISTER CALL CVDU_RD ; GET CURRENT VALUE @@ -499,7 +545,7 @@ CVDU_FILL1: LD C,31 ; DATA REGISTER CALL CVDU_WR ; DO IT DEC DE ; REFLECT ONE CHARACTER WRITTEN - + ; LOOP TO DO BULK WRITE (UP TO 255 BYTES PER LOOP) EX DE,HL ; NOW USE HL FOR COUNT LD C,30 ; BYTE COUNT REGISTER @@ -527,7 +573,7 @@ CVDU_SCROLL: LD A,' ' ; CHAR VALUE TO FILL NEW EXPOSED LINE LD HL,0 ; SOURCE ADDRESS OF CHARACER BUFFER CALL CVDU_SCROLL1 ; SCROLL CHARACTER BUFFER - + ; SCROLL THE ATTRIBUTE BUFFER LD A,(CVDU_ATTR) ; ATTRIBUTE VALUE TO FILL NEW EXPOSED LINE LD HL,$800 ; SOURCE ADDRESS OF ATTRIBUTE BUFFER @@ -535,7 +581,7 @@ CVDU_SCROLL: CVDU_SCROLL1: PUSH AF ; SAVE FILL VALUE FOR NOW - + ; SET MODE TO BLOCK COPY LD C,24 ; BLOCK MODE CONTROL REGISTER CALL CVDU_RD ; GET CURRENT VALUE @@ -563,13 +609,13 @@ CVDU_SCROLL2: ; LOOP TILL DONE WITH ALL LINES DJNZ CVDU_SCROLL2 ; REPEAT FOR ALL LINES - + ; SET MODE TO BLOCK WRITE TO CLEAR NEW LINE EXPOSED BY SCROLL LD C,24 ; BLOCK MODE CONTROL REGISTER CALL CVDU_RD ; GET CURRENT VALUE AND $7F ; CLEAR BIT 7 FOR FILL MODE CALL CVDU_WR ; DO IT - + ; SET VALUE TO WRITE POP AF ; RESTORE THE FILL VALUE PASSED IN LD C,31 ; DATA REGISTER @@ -579,7 +625,7 @@ CVDU_SCROLL2: LD A,CVDU_COLS - 1 ; SET WRITE COUNT TO LINE LENGTH - 1 (1 CHAR ALREADY WRITTEN) LD C,30 ; WORD COUNT REGISTER CALL CVDU_WR ; DO IT - + RET ; ;---------------------------------------------------------------------- @@ -591,7 +637,7 @@ CVDU_RSCROLL: LD A,' ' ; CHAR VALUE TO FILL NEW EXPOSED LINE LD HL,$0 + ((CVDU_ROWS - 1) * CVDU_COLS) ; SOURCE ADDRESS OF CHARACER BUFFER CALL CVDU_RSCROLL1 ; SCROLL CHARACTER BUFFER - + ; SCROLL THE ATTRIBUTE BUFFER LD A,(CVDU_ATTR) ; ATTRIBUTE VALUE TO FILL NEW EXPOSED LINE LD HL,$800 + ((CVDU_ROWS - 1) * CVDU_COLS) ; SOURCE ADDRESS OF ATTRIBUTE BUFFER @@ -599,7 +645,7 @@ CVDU_RSCROLL: CVDU_RSCROLL1: PUSH AF ; SAVE FILL VALUE FOR NOW - + ; SET MODE TO BLOCK COPY LD C,24 ; BLOCK MODE CONTROL REGISTER CALL CVDU_RD ; GET CURRENT VALUE @@ -629,7 +675,7 @@ CVDU_RSCROLL2: CALL CVDU_WR ; DO IT DJNZ CVDU_RSCROLL2 ; REPEAT FOR ALL LINES - + ; SET FILL DESTINATION (USING HL PASSED IN) LD C,18 ; UPDATE ADDRESS (DESTINATION) REGISTER CALL CVDU_WRX ; DO IT @@ -639,7 +685,7 @@ CVDU_RSCROLL2: CALL CVDU_RD ; GET CURRENT VALUE AND $7F ; CLEAR BIT 7 FOR FILL MODE CALL CVDU_WR ; DO IT - + ; SET VALUE TO WRITE POP AF ; RESTORE THE FILL VALUE PASSED IN LD C,31 ; DATA REGISTER @@ -649,7 +695,7 @@ CVDU_RSCROLL2: LD A,CVDU_COLS - 1 ; SET WRITE COUNT TO LINE LENGTH - 1 (1 CHAR ALREADY WRITTEN) LD C,30 ; WORD COUNT REGISTER CALL CVDU_WR ; DO IT - + RET ; ;---------------------------------------------------------------------- @@ -759,9 +805,59 @@ CVDU_POS .DW 0 ; CURRENT DISPLAY POSITION ; ; CVDU_INIT8563: -#IF 1 -; EGA 720X368 9-BIT CHARACTERS +; +#IF (CVDUMON == CVDUMON_CGA) +; +; CGA 640x200 8-BIT CHARACTERS +; - requires 16.000Mhz oscillator frequency +; + .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 $47 ; 10: cursor mode, start line +; .DB $E7 ; 11: cursor end line + .DB $07 ; 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 $00 ; 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 +; +#IF (CVDUMON == CVDUMON_EGA) +; +; EGA 720X350 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 @@ -799,44 +895,6 @@ CVDU_INIT8563: .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 ; ;================================================================================================== diff --git a/Source/HBIOS/dbgmon.asm b/Source/HBIOS/dbgmon.asm index ddfe411e..69736962 100644 --- a/Source/HBIOS/dbgmon.asm +++ b/Source/HBIOS/dbgmon.asm @@ -5,7 +5,7 @@ ; MODIFIED BY : DAN WERNER 03 09.2009 ; ;__REFERENCES_________________________________________________________________ -; THOMAS SCHERRER BASIC HAR.DWARE TEST ASSEMBLER SOURCES FROM THE Z80 INFO PAGE +; THOMAS SCHERRER BASIC HARDWARE TEST ASSEMBLER SOURCES FROM THE Z80 INFO PAGE ; INCLUDING ORIGINAL SCHEMATIC CONCEPT ; HTTP://Z80.INFO/Z80SOURC.TXT ; CODE SAMPLES FROM BRUCE JONES PUBLIC DOMAIN ROM MONITOR FOR THE SBC-200C @@ -31,8 +31,14 @@ BUFLEN .EQU 40 ; INPUT LINE LENGTH JP DSKY_ENTRY JP UART_ENTRY ; -#DEFINE USEDELAY -#INCLUDE "util.asm" +#IF DSKYENABLE + #DEFINE USEDELAY +ENA_XM .EQU FALSE ; NO ROOM FOR BOTH DSKY+XMODEM +#ELSE +ENA_XM .EQU TRUE ; INCLUDE XMODEM IF SPACE AVAILABLE +#ENDIF +; +ENA_MBC6502 .EQU FALSE ; ENABLE OR DISABLE MBC6502 OPTION ; ;__UART_ENTRY_________________________________________________________________ ; @@ -41,7 +47,7 @@ BUFLEN .EQU 40 ; INPUT LINE LENGTH ; UART_ENTRY: LD SP,MON_STACK ; SET THE STACK POINTER - EI ; INTS OK NOW + ;EI ; INTS OK NOW LD HL,UART_ENTRY ; RESTART ADDRESS CALL INITIALIZE ; INITIALIZE SYSTEM @@ -50,16 +56,22 @@ UART_ENTRY: ; ;__SERIAL_MONITOR_COMMANDS____________________________________________________ ; -; B - BOOT SYSTEM -; D XXXX YYYY - DUMP MEMORY FROM XXXX TO YYYY -; F XXXX YYYY ZZ - FILL MEMORY FROM XXXX TO YYYY WITH ZZ -; I XX - SHOW VALUE AT PORT XX -; K - ECHO KEYBOARD INPUT -; L - LOAD INTEL HEX FORMAT DATA -; M XXXX YYYY ZZZZ - MOVE MEMORY BLOCK XXXX-YYYY TO ZZZZ -; O XX YY - WRITE VALUE YY TO PORT XX -; P XXXX - PROGRAM RAM STARTING AT XXXX, PROMPT FOR VALUES -; R XXXX - RUN A PROGRAM AT ADDRESS XXXX +; B - BOOT SYSTEM +; D XXXX YYYY - DUMP MEMORY IN RANGE XXXX-YYYY +; F XXXX YYYY ZZ - FILL MEMORY IN RANGE XXXX-YYYY WITH ZZ +; H - HALT SYSTEM +; I XXXX - SHOW VALUE AT PORT XXXX +; K - ECHO KEYBOARD INPUT +; L - LOAD INTEL HEX FORMAT DATA +; M XXXX YYYY ZZZZ - MOVE MEMORY BLOCK XXXX-YYYY TO ZZZZ +; O XXXX YY - OUTPUT VALUE YY TO PORT XX +; P XXXX - PROGRAM RAM STARTING AT XXXX, PROMPT FOR VALUES +; R XXXX - RUN A PROGRAM AT ADDRESS XXXX +; S XX - SET ACTIVE BANK TO XX +; T XXXX - X-MODEM TRANSFER TO MEMORY LOCATION XXXX +; U - SET BANK TO PREVIOUS BANK +; 6 XX - TRANSFER CONTROL TO MBC6502 UNIT XX +; X - EXIT MONITOR ; ;__COMMAND_PARSE______________________________________________________________ ; @@ -68,8 +80,14 @@ UART_ENTRY: ; SERIALCMDLOOP: LD SP,MON_STACK ; RESET STACK - LD HL,TXT_PROMPT ; - CALL PRTSTR ; + CALL NEWLINE +#IF (BIOS == BIOS_WBW) + LD A,($FFE0) ; DISPLAY CURRENTLY ACTIVE + CALL PRTHEXBYTE ; BANK IN LOW MEMORY +#ENDIF + LD A,'>' + CALL COUT + LD HL,KEYBUF ; SET POINTER TO KEYBUF AREA CALL GETLN ; GET A LINE OF INPUT FROM THE USER LD HL,KEYBUF ; RESET POINTER TO START OF KEYBUF @@ -87,6 +105,10 @@ SERIALCMDLOOP: JP Z,PROGRM ; IF YES GO PROGRAM ROUTINE CP 'O' ; IS IT AN "O" (Y/N) JP Z,POUT ; PORT OUTPUT +#IF (ENA_XM) + CP 'T' ; IS IT A "T" (Y/N) + JP Z,XMLOAD ; XMODEM TRANSFER +#ENDIF CP 'L' ; IS IT A "L" (Y/N) JP Z,HXLOAD ; INTEL HEX FORMAT LOAD DATA CP 'I' ; IS IT AN "I" (Y/N) @@ -99,8 +121,22 @@ SERIALCMDLOOP: JP Z,MOVEMEM ; MOVE MEMORY COMMAND CP 'F' ; IS IT A "F" (Y/N) JP Z,FILLMEM ; FILL MEMORY COMMAND - CP 'H' ; IS IT A "H" (Y/N) + CP '?' ; IS IT A "?" (Y/N) JP Z,HELP ; HELP COMMAND + CP 'H' ; IS IT A "H" (Y/N) + JP Z,HALT ; HALT COMMAND +#IF (BIOS == BIOS_WBW) + CP 'S' ; IS IT A "S" (Y/N) + JP Z,SETBNK ; SET BANK COMMAND + CP 'U' ; IS IT A "U" (Y/N) + JP Z,UNSETBNK ; UNSET (REVERT) BANK COMMAND + #IF ((PLATFORM = PLT_MBC) & ENA_MBC6502) + CP '6' ; IS IT A "6" (Y/N) + JP Z,MBC6502 ; TRANSFER TO MBC6502 COMMAND + #ENDIF +#ENDIF + CP 'X' ; IS IT A "X" (Y/N) + JP Z,EXIT ; EXIT COMMAND LD HL,TXT_COMMAND ; POINT AT ERROR TEXT CALL PRTSTRH ; PRINT COMMAND LABEL @@ -113,9 +149,9 @@ SERIALCMDLOOP: ;_____________________________________________________________________________ ; INITIALIZE: - LD A,$C3 ; JP OPCODE - LD (0),A ; STORE AT $0000 - LD (1),HL ; STORE AT $0001 + ;LD A,$C3 ; JP OPCODE + ;LD (0),A ; STORE AT $0000 + ;LD (1),HL ; STORE AT $0001 #IF (BIOS == BIOS_UNA) ; INSTALL UNA INVOCATION VECTOR FOR RST 08 @@ -125,10 +161,14 @@ INITIALIZE: LD (9),HL ; STORE AT 0x0009 #ENDIF -#IF (BIOS == BIOS_WBW) +#IF DSKYENABLE + LD B,BF_SYSGET ; HBIOS FUNC=GET SYS INFO + LD C,BF_SYSGET_CPUINFO ; HBIOS SUBFUNC=GET CPU INFO + CALL $FFF0 ; CALL HBIOS + LD A,L ; PUT SPEED IN MHZ IN ACCUM CALL DELAY_INIT #ENDIF - +; RET ; ;__BOOT_______________________________________________________________________ @@ -143,26 +183,121 @@ BOOT: CALL $FFFD ; DO IT (RST 08 NOT SAFE HERE) JP 0 ; JUMP TO RESTART ADDRESS #ELSE - LD A,BID_BOOT ; BOOT BANK - LD HL,0 ; ADDRESS ZERO - CALL HB_BNKCALL ; DOES NOT RETURN + ;LD A,BID_BOOT ; BOOT BANK + ;LD HL,0 ; ADDRESS ZERO + ;CALL HB_BNKCALL ; DOES NOT RETURN + LD B,BF_SYSRESET ; SYSTEM RESTART + LD C,BF_SYSRES_COLD ; COLD START + CALL $FFF0 ; CALL HBIOS +#ENDIF +; +;__EXIT_______________________________________________________________________ +; +; PERFORM EXIT ACTION +;_____________________________________________________________________________ +; +EXIT: +#IF (BIOS == BIOS_UNA) + JR BOOT +#ELSE + LD B,BF_SYSRESET ; SYSTEM RESTART + LD C,BF_SYSRES_WARM ; WARM START + CALL $FFF0 ; CALL HBIOS +#ENDIF +; +;__HALT_______________________________________________________________________ +; +; PERFORM HALT ACTION +;_____________________________________________________________________________ +; +HALT: + DI + HALT +; +;__SETBNK_____________________________________________________________________ +; +; PERFORM SET BANK ACTION +;_____________________________________________________________________________ +; +#IF (BIOS == BIOS_WBW) +; +SETBNK: +#IF (INTMODE == 1) + LD HL,TXT_IMERR + CALL PRTSTR +#ELSE + LD A,($FFE0) ; GET AND SAVE + LD (BNKSAV),A ; CURRENT BANK + CALL BYTEPARM ; GET BANK NUMBER + JP C,ERR ; HANDLE DATA ENTRY ERROR + LD C,A ; PUT IN C FOR FOR FUNC CALL + LD B,BF_SYSSETBNK ; SET BANK FUNCTION + CALL $FFF0 ; C HAS BANK, DO IT +#ENDIF + JP SERIALCMDLOOP ; NEXT COMMAND +; +;__UNSETBNK___________________________________________________________________ +; +; PERFORM UNSET BANK ACTION - REVERT TO BANK BEFORE PREVIOUS SET +;_____________________________________________________________________________ +; +UNSETBNK: +#IF (INTMODE == 1) + LD HL,TXT_IMERR + CALL PRTSTR +#ELSE + LD A,(BNKSAV) + LD C,A ; PUT IN C FOR FOR FUNC CALL + LD B,BF_SYSSETBNK ; SET BANK FUNCTION + CALL $FFF0 ; C HAS BANK, DO IT #ENDIF + JP SERIALCMDLOOP ; NEXT COMMAND +; +BNKSAV .DB 00H ; OLD BANK FROM BEFORE SET +; +#ENDIF +; ;__RUN________________________________________________________________________ ; ; TRANSFER OUT OF MONITOR, USER OPTION "R" -; SYNTAX: R +; SYNTAX: R [ []] ;_____________________________________________________________________________ ; RUN: CALL WORDPARM ; GET START ADDRESS JP C,ERR ; HANDLE ERRORS PUSH DE ; SAVE VALUE + CALL BYTEPARM ; GET OPTIONAL + PUSH AF ; A REGISTER VALUE + CALL WORDPARM ; GET OPTIONAL + PUSH DE ; BC REGISTER VALUE CALL NONBLANK ; LOOK FOR EXTRANEOUS PARAMETERS CP 0 ; TEST FOR TERMINATING NULL JP NZ,ERR ; ERROR IF NOT TERMINATING NULL + POP BC ; RECOVER BC REGISTER VALUE TO PASS + POP AF ; RECOVER A REGISTER VALUE TO PASS POP HL ; RECOVER START ADDRESS +; + LD DE,PREG1 ; SETUP A RETURN + PUSH DE ; ADDRESS +; JP (HL) ; GO ; +PREG1: PUSH BC ; SAVE + PUSH DE ; REGISTERS + PUSH HL ; FOR DISPLAY +; + CALL NEWLINE + CALL PRTHEXBYTE ; DISPLAY A + CALL PC_SPACE ; REGISTER +; + LD B,3 +PREG2: POP HL ; DISPLAY + CALL PHL ; HL DE BC + CALL PC_SPACE ; REGISTER + DJNZ PREG2 + JP SERIALCMDLOOP +; ;__PROGRM_____________________________________________________________________ ; ; PROGRAM RAM LOCATIONS, USER OPTION "P" @@ -180,11 +315,16 @@ PROGRM1: POP HL PUSH HL CALL PHL - CALL PC_COLON + CALL PC_COLON ; DISPLAY + CALL PC_SPACE ; CURRENT + POP HL ; VALUE + PUSH HL + LD A,(HL) + CALL PRTHEXBYTE CALL PC_SPACE - LD HL,KEYBUF - CALL GETLN - LD HL,KEYBUF + LD HL,KEYBUF ; GET AND + CALL GETLN ; SAVE NEW + LD HL,KEYBUF ; VALUE CALL NONBLANK CP 0 JP Z,SERIALCMDLOOP @@ -214,6 +354,184 @@ KLOP1: CALL COUT ; OUTPUT KEY TO SCREEN JR KLOP1 ; LOOP ; +#IF (ENA_XM) +; +;__XMLOAD_____________________________________________________________________ +; +; LOAD A FILE INTO MEMORY FROM THE SERIAL PORT USING X-MODEM PROTOCOL +; +SOH: .EQU 'A'-40h ; ^A CTRL-A +EOT: .EQU 'D'-40h ; ^D = End of Transmission +ACK: .EQU 'F'-40h ; ^F = Positive Acknowledgement +NAK: .EQU 'U'-40h ; ^U = Negative Acknowledgement +CAN: .EQU 'X'-40h ; ^X = Cancel +; +CPKTN .DB 0 ; CALCULATED PACKET NUMBER +CPKTN1C .DB 0 ; CALCULATED PACKET NUMBER COMPLEMENT +RETRYC .DB 0 ; RETRY COUNT +RPKTN: .DB 0 ; RECEIVED PACKET NUMBER +RPKTN1C:.DB 0 ; RECEIVED PACKET NUMBER COMPLEMENT +PKTCS .DB 0 ; CHECKSUM +; +PSADDR: .DW 0 ; START OF PACKET ADDR +; +XMLOAD: CALL WORDPARM ; GET STARTING LOCATION + JP C,ERR ; HANDLE SYNTAX ERRORS + PUSH DE ; SAVE VALUE + CALL NONBLANK ; LOOK FOR EXTRANEOUS PARAMETERS + CP 0 ; TEST FOR TERMINATING NULL + JP NZ,ERR ; ERROR IF NOT TERMINATING NULL +; + LD HL,TXT_READY ; READY FOR + CALL PRTSTR ; TRANSFER + CALL NEWLINE +; + LD BC,$F8F0 ; GET CPU SPEED + CALL $FFF0 ; CALL HBIOS +; RST 08 ; AND MULTIPLY + LD A,L ; BY 4 + PUSH AF + ADD A,A ; TO CREATE + ADD A,A ; TIMEOUT DELAY + LD (TMOFCT),A ; FACTOR + POP AF +; + LD BC,$FE01 ; SET FIRST NUMBER TO 1 + LD (CPKTN),BC ; ALSO STORE THE 1-COMPLEMENT +; + POP DE ; POINT TO WHERE TO SAVE THE PACKET + LD (PSADDR),DE ; SAVE IF FOR THE CHECKSUM CALCULATION +; +GETNP: LD HL,RETRYC ; WE RETRY 20 TIMES BEFORE GIVING UP + LD (HL),20 +; +NPLOOP: LD B,6 ; 6 SECONDS OF TIMEOUT BEFORE EACH NEW BLOCK + CALL GCTO + JP NC,NOTOUT ; NO TIMEOUT ? +; + DEC (HL) ; REACHED MAX NUMBER OF RETRIES? + JP Z,FAILRT ; YES, PRINT MESSAGE AND EXIT +; + LD A,NAK ; SEND A NAK TO THE UPLOADER + CALL COUT + JR NPLOOP ; LOOP UNTIL WE GET A GET A CHARACTOR OR TIMEOUT +; +NOTOUT: CP EOT ; DID UPLOADER SAY WE'RE FINISHED? + JP Z,XMDONE ; YES, THEN WE'RE DONE + CP CAN ; UPLOADER WANTS TO FAIL TRANSFER? + JP Z,FAILCN ; YES, THEN WE'RE ALSO DONE + CP SOH ; DID WE GET A START-OF-NEW-PACKET? + JR NZ,NPLOOP ; NO, GO BACK AND TRY AGAIN +; + LD HL,RPKTN ; WE SAVE PACKET NUMBER HERE +; + CALL GCTO1 ; WAIT ONE SECOND FOR A CHARACTER + LD (HL),A ; SHOULD BE PACKET NUMBER + INC HL + JR C,FAILTO ; TIMOUT ERROR? +; + CALL GCTO1 ; WAIT ONE SECOND FOR A CHARACTER + LD (HL),A ; SHOULD BE PACKET NUMBER COMPLEMENT + JR C,FAILTO ; TIMOUT ERROR? + + LD C,128 ; GET 128 MORE CHARACTERS FOR A FULL PACKET +PCKRCV: CALL GCTO1 ; WAIT ONE SECOND FOR A CHARACTER + JR C,FAILTO ; TIMOUT ERROR? + LD (DE),A ; SAVE THE RECEIVED CHAR + INC DE + DEC C + JP NZ,PCKRCV +; + CALL GCTO1 ; WAIT ONE SECOND FOR A CHARACTER + JR C,FAILTO ; TIMOUT ERROR? + LD (PKTCS),A ; SHOULD BE CHECKSUM +; + LD HL,(PSADDR) ; CALCULATE CHECKSUM FROM 128 BYTES OF DATA + LD B,128 + XOR A +CSLOOP: ADD A,(HL) ; JUST ADD UP THE BYTES + INC HL + DJNZ CSLOOP +; + LD (PSADDR),DE ; SAVE THE NEW PACKET START ADDRESS +; + LD HL,PKTCS + XOR (HL) ; HL POINTS TO THE RECEIVED CHECKSUM SO + JR NZ,FAILCS ; BY XORING IT TO OUR SUM WE CHECK FOR EQUALITY +; + LD HL,(CPKTN) ; CHECK + LD BC,(RPKTN) ; AGREEMENT +; XOR A ; PACKET + SBC HL,BC ; NUMBERS + JR NZ,FAILPN +; + LD HL,CPKTN ; UPDATE THE PACKET COUNTERS + INC (HL) + INC HL + DEC (HL) +; + LD A,ACK ; TELL UPLOADER THAT WE'RE HAPPY WITH WITH + CALL COUT ; PACKET AND GO BACK AND FETCH SOME MORE + JP GETNP +; +FAILRT: LD HL,TXT_RETRYERR ; FAILED ON RETRY + JR XMERR +FAILCN: LD HL,TXT_CANCLERR ; TRANSFER CANCELLED + JR XMERR +FAILCS: LD HL,TXT_CKSUMERR ; CHECKSUM ERROR + JR XMERR +FAILPN: LD HL,TXT_PKNUMERR ; PACKET NUMBER ERROR + JR XMERR +FAILTO: LD HL,TXT_TMOUTERR ; TIMEOUT ERROR + JR XMERR +; +XMDONE: LD A,ACK ; TELL REMOTE + CALL COUT ; WE'RE DONE + LD HL,TXT_LOADED ; TELL USER +XMERR: CALL PRTSTR ; WE'RE DONE + JP SERIALCMDLOOP ; BACK TO MENU +; +; WAITS FOR UP TO B SECONDS FOR A CHARACTER TO BECOME AVAILABLE AND +; RETURNS IT IN A WITHOUT ECHO AND CARRY CLEAR. IF TIMEOUT THEN CARRY +; IT SET. +; +; 4MHZ 20 SECONDS TMOFCT = 16 +; 10MHZ 20 SECONDS TMOFCT = 39 +; +GCTO1: LD B,1 ; WAIT 1 SECOND FOR SERIAL INPUT +GCTO: CALL CST ; IF THERE IS A + OR A ; CHARACTER AVAILABLE + JR NZ,GETCHRX ; EXIT NOW OTHERWISE POLL +GCTOA: PUSH BC + LD BC,255 ; C=CONSTANT (255) FOR INNER TIMING LOOP +TMOFCT: .EQU $-1 ; B=SPEED FACTOR WHICH GETS UPDATED AT START +GCTOB: PUSH BC + LD B,C +GCTOC: PUSH BC + CALL CST + OR A ; A CHAR AVAILABLE? + JR NZ,GETCHR ; YES, GET OUT OF LOOP + POP BC + DJNZ GCTOC + POP BC + DJNZ GCTOB + POP BC + DJNZ GCTO + SCF ; SET CARRY SIGNALS + RET ; TIMEOUT OCCURRED +GETCHR: POP BC + POP BC + POP BC +GETCHRX:CALL CIN ; GET THE CHARACTER + OR A ; CLEAR CARRY + RET ; SIGNALS SUCCESS + +TXT_PKNUMERR .TEXT "\r\nPacket Number Error$" +TXT_TMOUTERR .TEXT "\r\nTimeout Error$" +TXT_RETRYERR .TEXT "\r\nRetry Error$" +TXT_CANCLERR .TEXT "\r\nTransfer Cancelled$" +#ENDIF +; ;__HXLOAD_____________________________________________________________________ ; ; LOAD INTEL HEX FORMAT FILE FROM THE SERIAL PORT, USER OPTION "H" @@ -323,7 +641,8 @@ PIN: ;__DUMPMEM____________________________________________________________________ ; ; PRINT A MEMORY DUMP, USER OPTION "D" -; SYNTAX: D +; SYNTAX: D [END ADR] +; IF NO END ADDRESS, DUMP 100H BYTES ;_____________________________________________________________________________ ; DUMPMEM: @@ -331,12 +650,14 @@ DUMPMEM: JP C,ERR ; HANDLE ERRORS PUSH DE ; SAVE IT CALL WORDPARM ; GET END ADDRESS - JP C,ERR ; HANDLE ERRORS - PUSH DE ; SAVE IT - - POP DE ; DE := END ADDRESS - POP HL ; HL := START ADDRESS - + POP HL ; RECOVER START + JR NC,GDATA ; +; + LD D,H ; DEFAULT TO 100H + LD E,L ; BYTES IF NO + INC D ; END ADDRESS + DEC DE ; IS GIVEN +; GDATA: INC DE ; BUMP DE FOR LATER COMPARE CALL NEWLINE ; @@ -369,13 +690,15 @@ PCRLF: LD C,16 ; SET FOR 16 CHARS POP HL ; GET BACK START PCRLF0: - LD A,(HL) ; GET BYTE - AND 060H ; SEE IF A 'DOT' - LD A,(HL) ; O K. TO GET - JR NZ,PDOT ; -DOT: - LD A,2EH ; LOAD A DOT + LD A,(HL) ; GET BYTE TO PRINT + CP $20 ; CONTROL CHAR (UNPRINTABLE)? + JR C,PDOT ; IF SO, PRINT A DOT + CP $7F ; 127 OR MORE (UNPRINTABLE)? + JR NC,PDOT ; IF SO, PRINT A DOT + JR PCHAR ; PRINT ACTUAL CHAR PDOT: + LD A,2EH ; OTHERWISE SUBSTITUTE A DOT +PCHAR: CALL COUT ; PRINT IT INC HL ; LD A,D ; @@ -450,7 +773,7 @@ FILLMEM: CALL NONBLANK ; LOOK FOR EXTRANEOUS PARAMETERS CP 0 ; TEST FOR TERMINATING NULL JP NZ,ERR ; ERROR IF NOT TERMINATING NULL - + POP DE ; END ADR TO DE POP HL ; START ADR TO HL DEC HL ; PRE-DECREMENT @@ -476,6 +799,30 @@ HELP: CALL PRTSTR ; DISPLAY IT JP SERIALCMDLOOP ; AND BACK TO COMMAND LOOP ; +;__MBC6502____________________________________________________________________ +; +; TRANSFER CONTROL TO MBC6502 +;_____________________________________________________________________________ +; +; +#IF (BIOS == BIOS_WBW) + #IF ((PLATFORM = PLT_MBC) & ENA_MBC6502) +MBC6502: + CALL BYTEPARM ; GET BYTE VALUE (FILL VALUE) INTO A + CPL ; UNIT 0 = FFH, 1 = FEH ETC + LD C,A +; + IN A,(C) ; EXECUTE + NOP ; TRANSFER +; + LD A,($FFE0) ; GET PREVIOUS BANK + OUT (MPCL_RAM),A ; SET RAM PAGE SELECTOR + OUT (MPCL_ROM),A ; SET ROM PAGE SELECTOR +; + JP SERIALCMDLOOP ; AND BACK TO COMMAND LOOP + #ENDIF +#ENDIF +; ;__ERR________________________________________________________________________ ; ; SYNTAX ERROR @@ -613,7 +960,7 @@ ISHEX1: JR C,ISHEX2 ; YES, NOT A-F, FAIL CP 'F' + 1 ; > 'F' JR NC,ISHEX2 ; YES, NOT A-F, FAIL - XOR A ; MUST BE 0-9, SET ZF + XOR A ; MUST BE A-F, SET ZF RET ; AND DONE ISHEX2: OR $FF ; CLEAR ZF @@ -750,7 +1097,7 @@ COUT: ; OUTPUT CHARACTER TO CONSOLE VIA UBIOS LD E,A LD BC,$12 - RST 08 + CALL $FFFD ; ; RESTORE ALL REGISTERS POP HL @@ -772,7 +1119,7 @@ CIN: ; ; INPUT CHARACTER FROM CONSOLE VIA UBIOS LD BC,$11 - RST 08 + CALL $FFFD LD A,E ; ; RESTORE REGISTERS (AF IS OUTPUT) @@ -794,7 +1141,7 @@ CST: ; ; GET CONSOLE INPUT STATUS VIA UBIOS LD BC,$13 - RST 08 + CALL $FFFD LD A,E ; ; RESTORE REGISTERS (AF IS OUTPUT) @@ -821,7 +1168,7 @@ COUT: LD E,A ; OUTPUT CHAR TO E LD C,CIO_CONSOLE ; CONSOLE UNIT TO C LD B,BF_CIOOUT ; HBIOS FUNC: OUTPUT CHAR - RST 08 ; HBIOS OUTPUTS CHARACTER + CALL $FFF0 ; HBIOS OUTPUTS CHARACTER ; ; RESTORE ALL REGISTERS POP HL @@ -844,7 +1191,7 @@ CIN: ; INPUT CHARACTER FROM CONSOLE VIA HBIOS LD C,CIO_CONSOLE ; CONSOLE UNIT TO C LD B,BF_CIOIN ; HBIOS FUNC: INPUT CHAR - RST 08 ; HBIOS READS CHARACTER + CALL $FFF0 ; HBIOS READS CHARACTER LD A,E ; MOVE CHARACTER TO A FOR RETURN ; ; RESTORE REGISTERS (AF IS OUTPUT) @@ -867,7 +1214,7 @@ CST: ; GET CONSOLE INPUT STATUS VIA HBIOS LD C,CIO_CONSOLE ; CONSOLE UNIT TO C LD B,BF_CIOIST ; HBIOS FUNC: INPUT STATUS - RST 08 ; HBIOS RETURNS STATUS IN A + CALL $FFF0 ; HBIOS RETURNS STATUS IN A ; ; RESTORE REGISTERS (AF IS OUTPUT) POP HL @@ -889,32 +1236,53 @@ KEYBUF: .FILL BUFLEN,0 ; SYSTEM TEXT STRINGS ;_____________________________________________________________________________ ; -TXT_PROMPT .TEXT "\r\n>$" -TXT_READY .TEXT "\r\nMonitor Ready$" +;TXT_PROMPT .TEXT "\r\n>$" +TXT_READY .TEXT "\r\n\r\nMonitor Ready$" TXT_COMMAND .TEXT "\r\nUnknown Command$" TXT_ERR .TEXT "\r\nSyntax Error$" +TXT_IMERR .TEXT "\r\nCommand not available under interrupt mode 1$" TXT_CKSUMERR .TEXT "\r\nChecksum Error$" TXT_RECORDERR .TEXT "\r\nRecord Type Error$" TXT_LOADED .TEXT "\r\nLoaded$" TXT_BADNUM .TEXT " *Invalid Hex Byte Value*$" -TXT_MINIHELP .TEXT " (H for Help)$" +TXT_MINIHELP .TEXT " (? for Help)$" TXT_HELP .TEXT "\r\nMonitor Commands (all values in hex):" .TEXT "\r\nB - Boot system" - .TEXT "\r\nD xxxx yyyy - Dump memory from xxxx to yyyy" + .TEXT "\r\nD xxxx [yyyy] - Dump memory from xxxx to yyyy" .TEXT "\r\nF xxxx yyyy zz - Fill memory from xxxx to yyyy with zz" - .TEXT "\r\nI xx - Input from port xx" + .TEXT "\r\nH - Halt system" + .TEXT "\r\nI xxxx - Input from port xxxx" .TEXT "\r\nK - Keyboard echo" .TEXT "\r\nL - Load Intel hex data" .TEXT "\r\nM xxxx yyyy zzzz - Move memory block xxxx-yyyy to zzzz" - .TEXT "\r\nO xx yy - Output to port xx value yy" - .TEXT "\r\nP xxxx - Program RAM at xxxx" - .TEXT "\r\nR xxxx - Run code at xxxx" + .TEXT "\r\nO xxxx yy - Output value yy to port xxxx" + .TEXT "\r\nP xxxx - Program RAM at address xxxx" + .TEXT "\r\nR xxxx [[yy] [zzzz]] - Run code at address xxxx" + .TEXT "\r\n Pass yy and zzzz to register A and BC" +#IF (BIOS == BIOS_WBW) + .TEXT "\r\nS xx - Set bank to xx" + .TEXT "\r\nU - Set bank to previous bank" +#ENDIF +#IF (ENA_XM) + .TEXT "\r\nT xxxx - X-modem transfer to memory location xxxx" +#ENDIF +#IF (BIOS == BIOS_WBW) + #IF ((PLATFORM == PLT_MBC) & ENA_MBC6502) + .TEXT "\r\n6 xx - Transfer control to MBC6502 unit xx" + #ENDIF +#ENDIF + .TEXT "\r\nX - Exit monitor" .TEXT "$" ; #IF DSKYENABLE ; -#DEFINE DSKY_KBD +#DEFINE DSKY_KBD + #IF (DSKYMODE == DSKYMODE_V1) #INCLUDE "dsky.asm" + #ENDIF + #IF (DSKYMODE == DSKYMODE_NG) +#INCLUDE "dskyng.asm" + #ENDIF ; KY_PR .EQU KY_FW ; USE [FW] FOR [PR] (PORT READ) KY_PW .EQU KY_BK ; USE [BW] FOR [PW] (PORT WRITE) @@ -926,7 +1294,7 @@ KY_PW .EQU KY_BK ; USE [BW] FOR [PW] (PORT WRITE) ; DSKY_ENTRY: LD SP,MON_STACK ; SET THE STACK POINTER - EI ; INTS OK NOW + ;EI ; INTS OK NOW LD HL,DSKY_ENTRY ; RESTART ADDRESS CALL INITIALIZE ; @@ -935,7 +1303,12 @@ DSKY_ENTRY: ; START UP THE SYSTEM WITH THE FRONT PANEL INTERFACE ;_____________________________________________________________________________ ; - CALL DSKY_INIT ; INIT 8255 + CALL DSKY_PREINIT ; INITIALIZE DSKY + + #IF (DSKYMODE == DSKYMODE_NG) + CALL DSKY_BEEP + #ENDIF + ; ;__COMMAND_PARSE______________________________________________________________ ; @@ -944,10 +1317,19 @@ DSKY_ENTRY: ; FRONTPANELLOOP: LD HL,CPUUP ; SET POINTER TO CPU UP MSG - CALL DSKY_SHOWSEG ; DISPLAY UNENCODED + CALL DSKY_SHOW ; DISPLAY UNENCODED + + #IF (DSKYMODE == DSKYMODE_NG) + CALL DSKY_HIGHLIGHTCMDKEYS + CALL DSKY_L1ON + #ENDIF CALL KB_GET ; GET KEY FROM KB + #IF (DSKYMODE == DSKYMODE_NG) + CALL DSKY_L1OFF + #ENDIF + FRONTPANELLOOP1: CP KY_PR ; IS PORT READ? JP Z,DOPORTREAD ; YES, JUMP @@ -963,8 +1345,6 @@ FRONTPANELLOOP1: JP Z,DOBOOT ; YES, JUMP JR FRONTPANELLOOP ; LOOP -EXIT: - RET ; ;__DOBOOT_____________________________________________________________________ ; @@ -973,7 +1353,7 @@ EXIT: ; DOBOOT: LD HL,MSGBOOT ; SET POINTER TO BOOT MESSAGE - CALL DSKY_SHOWSEG ; DISPLAY UNENCODED + CALL DSKY_SHOW ; DISPLAY UNENCODED JP BOOT ; DO BOOT ; ;__DOPORTREAD_________________________________________________________________ @@ -984,6 +1364,11 @@ DOBOOT: ;_____________________________________________________________________________ ; DOPORTREAD: + + #IF (DSKYMODE == DSKYMODE_NG) + CALL DSKY_HIGHLIGHTNUMKEYS + #ENDIF + CALL GETPORT ; GET PORT INTO A PORTREADLOOP: LD C,A ; STORE PORT IN "C" @@ -1006,6 +1391,11 @@ PORTREADGETKEY: ;_____________________________________________________________________________ ; DOPORTWRITE: + + #IF (DSKYMODE == DSKYMODE_NG) + CALL DSKY_HIGHLIGHTNUMKEYS + #ENDIF + CALL GETPORT ; GET PORT INTO A PORTWRITELOOP: LD L,A ; SAVE PORT NUM @@ -1027,7 +1417,17 @@ PORTWRITEGETKEY: ;_____________________________________________________________________________ ; DOGO: + +#IF (DSKYMODE == DSKYMODE_NG) + CALL DSKY_HIGHLIGHTNUMKEYS + #ENDIF + CALL GETADDR ; GET ADDRESS INTO HL + + #IF (DSKYMODE == DSKYMODE_NG) + CALL DSKY_HIGHLIGHTKEYSOFF + #ENDIF + PUSH HL ; EXEC ADR TO TOS LD HL,GOTO ; POINT TO "GO" MSG CALL INITBUF @@ -1048,6 +1448,11 @@ DOGO: ;_____________________________________________________________________________ ; DOEXAMINE: + + #IF (DSKYMODE == DSKYMODE_NG) + CALL DSKY_HIGHLIGHTNUMKEYS + #ENDIF + CALL GETADDR ; GET ADDRESS INTO HL EXAMINELOOP: LD DE,DISPLAYBUF+0 @@ -1063,6 +1468,11 @@ EXAMINELOOP: LD A,(HL) ; GET VALUE FROM ADDRESS IN HL CALL PUTVALUE CALL ENCDISPLAY ; DISPLAY BUFFER ON DISPLAYS + + #IF (DSKYMODE == DSKYMODE_NG) + CALL DSKY_HIGHLIGHTFWDKEYS + #ENDIF + EXAMINEGETKEY: CALL KB_GET ; GET KEY FROM KB CP KY_EN ; [EN] PRESSED, INC ADDRESS AND LOOP @@ -1080,6 +1490,11 @@ EXAMINEFW: ;_____________________________________________________________________________ ; DODEPOSIT: + + #IF (DSKYMODE == DSKYMODE_NG) + CALL DSKY_HIGHLIGHTNUMKEYS + #ENDIF + CALL GETADDR ; GET ADDRESS INTO HL DEPOSITLOOP: LD DE,DISPLAYBUF+0 @@ -1096,6 +1511,11 @@ DEPOSITLOOP: LD DE,DISPLAYBUF+6 ; DISPLAY WRITTEN MEM VALUE CALL PUTVALUE ; ... WITHOUT DP'S CALL ENCDISPLAY ; DISPLAY BUFFER CONTENTS + + #IF (DSKYMODE == DSKYMODE_NG) + CALL DSKY_HIGHLIGHTFWDKEYS + #ENDIF + DEPOSITGETKEY: CALL KB_GET ; GET KEY FROM KB CP KY_EN ; [EN] PRESSED, INC ADDRESS AND LOOP @@ -1314,7 +1734,7 @@ ENCBUF1: INC HL ; BUMP TO NEXT BYTE FOR NEXT PASS PUSH AF ; SAVE IT AND $80 ; ISOLATE HI BIT (DP) - XOR $80 ; FLIP IT + ;XOR $80 ; FLIP IT LD C,A ; SAVE IN C POP AF ; RECOVER ORIGINAL AND $7F ; REMOVE HI BIT (DP) @@ -1328,15 +1748,17 @@ ENCBUF1: POP HL ; RESTORE POINTER DJNZ ENCBUF1 ; LOOP THRU ALL BUF POSITIONS LD HL,DSKY_BUF ; POINT TO DECODED BUFFER - CALL DSKY_SHOWSEG ; DISPLAY IT + CALL DSKY_SHOW ; DISPLAY IT POP DE ; RESTORE DE POP BC ; RESTORE BC POP AF ; RESTORE AF POP HL ; RESTORE HL RET ; -CPUUP .DB $84,$CB,$EE,$BB,$80,$BB,$EE,$84 ; "-CPU UP-" (RAW SEG) -MSGBOOT .DB $FF,$9D,$9D,$8F,$20,$80,$80,$80 ; "Boot! " (RAW SEG) +#IF (DSKYMODE == DSKYMODE_V1) +; +CPUUP .DB $04,$4B,$6E,$3B,$00,$3B,$6E,$04 ; "-CPU UP-" (RAW SEG) +MSGBOOT .DB $7F,$1D,$1D,$0F,$A0,$00,$00,$00 ; "Boot! " (RAW SEG) ADDR .DB $17,$18,$19,$10,$00,$00,$00,$00 ; "Adr 0000" (ENCODED) PORT .DB $13,$14,$15,$16,$10,$10,$00,$00 ; "Port 00" (ENCODED) GOTO .DB $1A,$14,$10,$10,$00,$00,$00,$00 ; "Go 0000" (ENCODED) @@ -1347,6 +1769,7 @@ GOTO .DB $1A,$14,$10,$10,$00,$00,$00,$00 ; "Go 0000" (ENCODED) ;_____________________________________________________________________________ ; SEGDECODE: +; ; POS $00 $01 $02 $03 $04 $05 $06 $07 ; GLYPH '0' '1' '2' '3' '4' '5' '6' '7' .DB $7B, $30, $6D, $75, $36, $57, $5F, $70 @@ -1359,16 +1782,297 @@ SEGDECODE: ; GLYPH ' ' '-' '.' 'P' 'o' 'r' 't' 'A' 'd' 'r' 'G' .DB $00, $04, $00, $6E, $1D, $0C, $0F, $7E, $3D, $0C, $5B ; +#ENDIF +; +#IF (DSKYMODE == DSKYMODE_NG) +; +CPUUP .DB $40,$39,$73,$3E,$00,$3E,$73,$40 ; "-CPU UP-" (RAW SEG) +MSGBOOT .DB $7F,$5C,$5C,$78,$82,$00,$00,$00 ; "Boot! " (RAW SEG) +ADDR .DB $17,$18,$19,$10,$00,$00,$00,$00 ; "Adr 0000" (ENCODED) +PORT .DB $13,$14,$15,$16,$10,$10,$00,$00 ; "Port 00" (ENCODED) +GOTO .DB $1A,$14,$10,$10,$00,$00,$00,$00 ; "Go 0000" (ENCODED) +; +;_HEX_7_SEG_DECODE_TABLE______________________________________________________ +; +; SET BIT 7 TO DISPLAY W/ DECIMAL POINT +;_____________________________________________________________________________ +; +SEGDECODE: +; + ; POS $00 $01 $02 $03 $04 $05 $06 $07 + ; GLYPH '0' '1' '2' '3' '4' '5' '6' '7' + .DB $3F, $06, $5B, $4F, $66, $6D, $7D, $07 +; + ; POS $08 $09 $0A $0B $0C $0D $0E $0F + ; GLYPH '8' '9' 'A' 'B' 'C' 'D' 'E' 'F' + .DB $7F, $67, $77, $7C, $39, $5E, $79, $71 +; + ; POS $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $1A + ; GLYPH ' ' '-' '.' 'P' 'o' 'r' 't' 'A' 'd' 'r' 'G' + .DB $00, $40, $00, $73, $5C, $50, $78, $77, $5E, $50, $3D +; + +DSKY_HIGHLIGHTFWDKEYS: + CALL DSKY_PUTLED + .DB $00,$00,$00,$30,$00,$00,$00,$00 + RET + +DSKY_HIGHLIGHTCMDKEYS: + + CALL DSKY_PUTLED + .DB $20,$00,$20,$3F,$00,$00,$00,$00 + RET + +DSKY_HIGHLIGHTNUMKEYS: + CALL DSKY_PUTLED + .DB $1F,$3F,$1F,$30,$00,$00,$00,$00 + RET + +DSKY_HIGHLIGHTKEYSOFF: + + CALL DSKY_PUTLED + .DB $00,$00,$00,$00,$00,$00,$00,$00 + RET +#ENDIF +; DISPLAYBUF: .FILL 8,0 ; #ELSE ; DSKY_ENTRY: - CALL PANIC + JP EXIT ; #ENDIF ; +;================================================================================================== +; UTILITY FUNCTIONS +;================================================================================================== +; +; +CHR_BEL .EQU 07H +CHR_CR .EQU 0DH +CHR_LF .EQU 0AH +CHR_BS .EQU 08H +CHR_ESC .EQU 1BH +; +;__________________________________________________________________________________________________ +; +; UTILITY PROCS TO PRINT SINGLE CHARACTERS WITHOUT TRASHING ANY REGISTERS +; +PC_SPACE: + PUSH AF + LD A,' ' + JR PC_PRTCHR +PC_COLON: + PUSH AF + LD A,':' + JR PC_PRTCHR +PC_CR: + PUSH AF + LD A,CHR_CR + JR PC_PRTCHR + +PC_LF: + PUSH AF + LD A,CHR_LF + JR PC_PRTCHR + +PC_PRTCHR: + CALL COUT + POP AF + RET + +NEWLINE2: + CALL NEWLINE +NEWLINE: + CALL PC_CR + CALL PC_LF + RET +PRTSTR: + LD A,(HL) + INC HL + CP '$' + RET Z + CALL COUT + JR PRTSTR ; +; PRINT THE HEX BYTE VALUE IN A +; +PRTHEXBYTE: + PUSH AF + PUSH DE + CALL HEXASCII + LD A,D + CALL COUT + LD A,E + CALL COUT + POP DE + POP AF + RET +; +; CONVERT BINARY VALUE IN A TO ASCII HEX CHARACTERS IN DE +; +HEXASCII: + LD D,A + CALL HEXCONV + LD E,A + LD A,D + RLCA + RLCA + RLCA + RLCA + CALL HEXCONV + LD D,A + RET +; +; CONVERT LOW NIBBLE OF A TO ASCII HEX +; +HEXCONV: + AND 0FH ;LOW NIBBLE ONLY + ADD A,90H + DAA + ADC A,40H + DAA + RET +; +; ADD HL,A +; +; A REGISTER IS DESTROYED! +; +ADDHLA: + ADD A,L + LD L,A + RET NC + INC H + RET +; +; DELAY 16US (CPU SPEED COMPENSATED) INCUDING CALL/RET INVOCATION +; REGISTER A AND FLAGS DESTROYED +; NO COMPENSATION FOR Z180 MEMORY WAIT STATES +; THERE IS AN OVERHEAD OF 3TS PER INVOCATION +; IMPACT OF OVERHEAD DIMINISHES AS CPU SPEED INCREASES +; +; CPU SCALER (CPUSCL) = (CPUHMZ - 2) FOR 16US + 3TS DELAY +; NOTE: CPUSCL MUST BE >= 1! +; +; EXAMPLE: 8MHZ CPU (DELAY GOAL IS 16US) +; LOOP = ((6 * 16) - 5) = 91TS +; TOTAL COST = (91 + 40) = 131TS +; ACTUAL DELAY = (131 / 8) = 16.375US +; + ; --- TOTAL COST = (LOOP COST + 40) TS -----------------+ +DELAY: ; 17TS (FROM INVOKING CALL) | + LD A,(CPUSCL) ; 13TS | +; | +DELAY1: ; | + ; --- LOOP = ((CPUSCL * 16) - 5) TS ------------+ | + DEC A ; 4TS | | + #IF (BIOS == BIOS_WBW) ; | | + #IF (CPUFAM == CPU_Z180) ; | | + OR A ; +4TS FOR Z180 | | + #ENDIF ; | | + #ENDIF ; | | + JR NZ,DELAY1 ; 12TS (NZ) / 7TS (Z) | | + ; ----------------------------------------------+ | +; | + RET ; 10TS (RETURN) | + ;-------------------------------------------------------+ +; +; DELAY 16US * DE (CPU SPEED COMPENSATED) +; REGISTER DE, A, AND FLAGS DESTROYED +; NO COMPENSATION FOR Z180 MEMORY WAIT STATES +; THERE IS A 27TS OVERHEAD FOR CALL/RET PER INVOCATION +; IMPACT OF OVERHEAD DIMINISHES AS DE AND/OR CPU SPEED INCREASES +; +; CPU SCALER (CPUSCL) = (CPUHMZ - 2) FOR 16US OUTER LOOP COST +; NOTE: CPUSCL MUST BE > 0! +; +; EXAMPLE: 8MHZ CPU, DE=6250 (DELAY GOAL IS .1 SEC OR 100,000US) +; INNER LOOP = ((16 * 6) - 5) = 91TS +; OUTER LOOP = ((91 + 37) * 6250) = 800,000TS +; ACTUAL DELAY = ((800,000 + 27) / 8) = 100,003US +; + ; --- TOTAL COST = (OUTER LOOP + 27) TS ------------------------+ +VDELAY: ; 17TS (FROM INVOKING CALL) | +; | + ; --- OUTER LOOP = ((INNER LOOP + 37) * DE) TS ---------+ | + LD A,(CPUSCL) ; 13TS | | +; | | +VDELAY1: ; | | + ; --- INNER LOOP = ((CPUSCL * 16) - 5) TS ------+ | | + #IF (BIOS == BIOS_WBW) ; | | | + #IF (CPUFAM == CPU_Z180) ; | | | + OR A ; +4TS FOR Z180 | | | + #ENDIF ; | | | + #ENDIF ; | | | + DEC A ; 4TS | | | + JR NZ,VDELAY1 ; 12TS (NZ) / 7TS (Z) | | | + ; ----------------------------------------------+ | | +; | | + DEC DE ; 6TS | | + #IF (BIOS == BIOS_WBW) ; | | | + #IF (CPUFAM == CPU_Z180) ; | | + OR A ; +4TS FOR Z180 | | + #ENDIF ; | | + #ENDIF ; | | + LD A,D ; 4TS | | + OR E ; 4TS | | + JP NZ,VDELAY ; 10TS | | + ;-------------------------------------------------------+ | +; | + RET ; 10TS (FINAL RETURN) | + ;---------------------------------------------------------------+ +; +; DELAY ABOUT 0.5 SECONDS +; 500000US / 16US = 31250 +; +LDELAY: + PUSH AF + PUSH DE + LD DE,31250 + CALL VDELAY + POP DE + POP AF + RET +; +; INITIALIZE DELAY SCALER BASED ON OPERATING CPU SPEED +; ENTER WITH A = CPU SPEED IN MHZ +; +DELAY_INIT: + CP 3 ; TEST FOR <= 2 (SPECIAL HANDLING) + JR C,DELAY_INIT1 ; IF <= 2, SPECIAL PROCESSING + SUB 2 ; ADJUST AS REQUIRED BY DELAY FUNCTIONS + JR DELAY_INIT2 ; AND CONTINUE +DELAY_INIT1: + LD A,1 ; USE THE MIN VALUE OF 1 +DELAY_INIT2: + LD (CPUSCL),A ; UPDATE CPU SCALER VALUE + RET + + #IF (CPUMHZ < 3) +CPUSCL .DB 1 ; CPU SCALER MUST BE > 0 + #ELSE +CPUSCL .DB CPUMHZ - 2 ; OTHERWISE 2 LESS THAN PHI MHZ + #ENDIF +; +; SHORT DELAY FUNCTIONS. NO CLOCK SPEED COMPENSATION, SO THEY +; WILL RUN LONGER ON SLOWER SYSTEMS. THE NUMBER INDICATES THE +; NUMBER OF CALL/RET INVOCATIONS. A SINGLE CALL/RET IS +; 27 T-STATES ON A Z80, 25 T-STATES ON A Z180 +; +; ; Z80 Z180 +; ; ---- ---- +DLY64: CALL DLY32 ; 1728 1600 +DLY32: CALL DLY16 ; 864 800 +DLY16: CALL DLY8 ; 432 400 +DLY8: CALL DLY4 ; 216 200 +DLY4: CALL DLY2 ; 108 100 +DLY2: CALL DLY1 ; 54 50 +DLY1: RET ; 27 25 +; +; +; + .FILL 16,0 ; SET MINIMUM STACK DEPTH SLACK .EQU (MON_END - $) .FILL SLACK,00H ; @@ -1377,13 +2081,5 @@ MON_STACK .EQU $ .ECHO "DBGMON space remaining: " .ECHO SLACK .ECHO " bytes.\n" -; -; DBGMON CURRENTLY OCCUPIES $F000-$FDFF BECAUSE THE -; HBIOS PROXY OCCUPIES $FE00-$FFFF. HOWEVER THE DBGMON -; IMAGE MUST OCCUPY A FULL $1000 BYTES IN THE ROM. -; BELOW WE JUST PAD OUT THE IMAGE BY $200 SO IT -; OCCUPIES THE FULL $1000 BYTES IN ROM. -; - .FILL $200,$00 ; .END diff --git a/Source/HBIOS/diskdefs b/Source/HBIOS/diskdefs deleted file mode 100644 index 937bfcf2..00000000 --- a/Source/HBIOS/diskdefs +++ /dev/null @@ -1,417 +0,0 @@ -diskdef ibm-3740 - seclen 128 - tracks 77 - sectrk 26 - blocksize 1024 - maxdir 64 - skew 6 - boottrk 2 - os p2dos -end - -diskdef 4mb-hd - seclen 128 - tracks 1024 - sectrk 32 - blocksize 2048 - maxdir 256 - skew 1 - boottrk 0 - os p2dos -end - -diskdef pcw - seclen 512 - tracks 40 - sectrk 9 - blocksize 1024 - maxdir 64 - skew 1 - boottrk 1 - os 3 -end - -diskdef pc1.2m - seclen 512 - tracks 80 - # this format uses 15 sectors per track, but 30 per cylinder - sectrk 30 - blocksize 4096 - maxdir 256 - skew 1 - boottrk 0 - os 3 -end - -# CP/M 86 on 1.44MB floppies -diskdef cpm86-144feat - seclen 512 - tracks 160 - sectrk 18 - blocksize 4096 - maxdir 256 - skew 1 - boottrk 2 - os 3 -end - -diskdef cf2dd - seclen 512 - tracks 160 - sectrk 9 - blocksize 2048 - maxdir 256 - skew 1 - boottrk 1 - os 3 -end - -#amstrad: values are read from super block (special name hardcoded) - -# Royal alphatronic -# setfdprm /dev/fd1 dd ssize=256 cyl=40 sect=16 head=2 -diskdef alpha - seclen 256 - tracks 40 - sectrk 32 - blocksize 2048 - maxdir 128 - skew 1 - boottrk 2 - os 2.2 -end - -# Apple II CP/M skew o Apple II DOS 3.3 skew -diskdef apple-do - seclen 256 - tracks 35 - sectrk 16 - blocksize 1024 - maxdir 64 - skew 0 - boottrk 3 - os 2.2 -end - -# Apple II CP/M skew o Apple II PRODOS skew -diskdef apple-po - seclen 256 - tracks 35 - sectrk 16 - blocksize 1024 - maxdir 64 - skew 0 - boottrk 3 - os 2.2 -end - -# MYZ80 hard drive (only works with libdsk, because it has a 256-byte header) -diskdef myz80 - seclen 1024 - tracks 64 - sectrk 128 - blocksize 4096 - maxdir 1024 - skew 1 - boottrk 0 - os 3 -end - -# Despite being Amstrad formats, CPC System and CPC Data don't have an Amstrad -# superblock. You'll need to use libdsk to access them because the Linux -# and Windows kernel drivers won't touch them. -diskdef cpcsys - seclen 512 - tracks 40 - sectrk 9 - blocksize 1024 - maxdir 64 - skew 1 - boottrk 2 - os 3 -end -diskdef cpcdata - seclen 512 - tracks 40 - sectrk 9 - blocksize 1024 - maxdir 64 - skew 1 - boottrk 0 - os 3 -end - -# after being read in with no sector skew. -diskdef nigdos - seclen 512 - # NigDos double sided disk format, 42 tracks * 2 sides - tracks 84 - sectrk 10 - blocksize 2048 - maxdir 128 - skew 1 - boottrk 0 - # this format wastes half of the directory entry - logicalextents 1 - os 3 -end - -diskdef epsqx10 - seclen 512 - tracks 40 - sectrk 20 - blocksize 2048 - maxdir 128 - skew 0 - boottrk 2 - os 2.2 -end - -diskdef ibm-8ss - seclen 512 - tracks 40 - sectrk 8 - blocksize 1024 - maxdir 64 - skew 0 - boottrk 1 - os 2.2 -end - -diskdef ibm-8ds - seclen 512 - tracks 40 - sectrk 8 - blocksize 1024 - maxdir 64 - skew 0 - boottrk 1 - os 2.2 -end - -diskdef electroglas - seclen 512 - tracks 80 - sectrk 10 - blocksize 2048 - maxdir 256 - skew 0 - boottrk 1 - os 3 -end - -# IBM CP/M-86 -# setfdprm /dev/fd1 sect=8 dtr=1 hd ssize=512 tpi=48 head=1 -diskdef ibmpc-514ss - seclen 512 - tracks 40 - sectrk 8 - blocksize 1024 - maxdir 64 - skew 1 - boottrk 1 - os 2.2 -end - -# IBM CP/M-86 -# setfdprm /dev/fd1 sect=8 dtr=1 hd ssize=512 tpi=48 -diskdef ibmpc-514ds - seclen 512 - tracks 80 - sectrk 8 - blocksize 2048 - maxdir 64 - skew 0 - boottrk 2 - os 2.2 -end - -diskdef p112 - seclen 512 - tracks 160 - sectrk 18 - blocksize 2048 - maxdir 256 - skew 1 - boottrk 2 - os 3 -end - -diskdef p112-old - seclen 512 - tracks 160 - sectrk 18 - blocksize 2048 - maxdir 128 - skew 1 - boottrk 1 - os 3 -end - -diskdef kpii - seclen 512 - tracks 40 - sectrk 10 - blocksize 1024 - maxdir 32 - skew 0 - boottrk 1 - os 2.2 -end - -# setfdprm /dev/fd0 dd sect=10 -diskdef interak - seclen 512 - tracks 80 - sectrk 20 - blocksize 4096 - maxdir 256 - skew 0 - boottrk 2 - os 2.2 -end - -# RomWBW 512KB ROM (128KB reserved, 384KB ROM Disk) - -diskdef wbw_rom512 - seclen 512 - tracks 12 - sectrk 64 - blocksize 2048 - maxdir 256 - skew 0 - boottrk 0 - os 2.2 -end - -# RomWBW 1024KB ROM (128KB reserved, 896KB ROM Disk) - -diskdef wbw_rom1024 - seclen 512 - tracks 28 - sectrk 64 - blocksize 2048 - maxdir 256 - skew 0 - boottrk 0 - os 2.2 -end - -# UNA 512KB ROM (128KB reserved, 384KB ROM Disk) - -diskdef una_rom512 - seclen 512 - tracks 12 - sectrk 64 - blocksize 2048 - maxdir 256 - skew 0 - boottrk 0 - os 2.2 -end - -# UNA 512KB ROM (128KB reserved, 896KB ROM Disk) - -diskdef una_rom1024 - seclen 512 - tracks 28 - sectrk 64 - blocksize 2048 - maxdir 256 - skew 0 - boottrk 0 - os 2.2 -end - -# RomWBW 8MB Hard Disk, LU 0-3 -diskdef wbw_hd0 - seclen 512 - tracks 65 - sectrk 256 - blocksize 4096 - maxdir 512 - skew 0 - boottrk 1 - os 2.2 -end - -diskdef wbw_hd1 - seclen 512 - tracks 130 - sectrk 256 - blocksize 4096 - maxdir 512 - skew 0 - boottrk 66 - os 2.2 -end - -diskdef wbw_hd2 - seclen 512 - tracks 195 - sectrk 256 - blocksize 4096 - maxdir 512 - skew 0 - boottrk 131 - os 2.2 -end - -diskdef wbw_hd3 - seclen 512 - tracks 260 - sectrk 256 - blocksize 4096 - maxdir 512 - skew 0 - boottrk 196 - os 2.2 -end - -# RomWBW 720K floppy media -diskdef wbw_fd720 - seclen 512 - tracks 160 - sectrk 9 - blocksize 2048 - maxdir 128 - skew 0 - boottrk 4 - os 2.2 -end - -# RomWBW 1.44M floppy media -diskdef wbw_fd144 - seclen 512 - tracks 160 - sectrk 18 - blocksize 2048 - maxdir 256 - skew 0 - boottrk 2 - os 2.2 -end - -# RomWBW 360K floppy media -diskdef wbw_fd360 - seclen 512 - tracks 80 - sectrk 9 - blocksize 2048 - maxdir 128 - skew 0 - boottrk 4 - os 2.2 -end - -# RomWBW 1.20M floppy media -diskdef wbw_fd120 - seclen 512 - tracks 160 - sectrk 15 - blocksize 2048 - maxdir 256 - skew 0 - boottrk 2 - os 2.2 -end diff --git a/Source/HBIOS/dma.asm b/Source/HBIOS/dma.asm new file mode 100644 index 00000000..c63412e1 --- /dev/null +++ b/Source/HBIOS/dma.asm @@ -0,0 +1,339 @@ +;================================================================================================== +; Z80 DMA DRIVER +;================================================================================================== +; +DMA_CONTINUOUS .equ %10111101 ; + Pulse +DMA_BYTE .equ %10011101 ; + Pulse +DMA_BURST .equ %11011101 ; + Pulse +DMA_LOAD .equ $cf ; %11001111 +DMA_ENABLE .equ $87 ; %10000111 +DMA_FORCE_READY .equ $b3 +DMA_DISABLE .equ $83 +DMA_START_READ_SEQUENCE .equ $a7 +DMA_READ_STATUS_BYTE .equ $bf +DMA_READ_MASK_FOLLOWS .equ $bb +DMA_RESET .equ $c3 +;DMA_RESET_PORT_A_TIMING .equ $c7 +;DMA_RESET_PORT_B_TIMING .equ $cb +;DMA_CONTINUE .equ $d3 +;DMA_DISABLE_INTERUPTS .equ $af +;DMA_ENABLE_INTERUPTS .equ $ab +;DMA_RESET_DISABLE_INTERUPTS .equ $a3 +;DMA_ENABLE_AFTER_RETI .equ $b7 +;DMA_REINIT_STATUS_BYTE .equ $8b +; +DMA_FBACK .equ TRUE ; ALLOW FALLBACK TO SOFTWARE +DMA_RDY .EQU %00001000 +DMA_FORCE .EQU 0 +; +;================================================================================================== +; DMA CLOCK SPEED CONTROL - OPTION TO SWITCH TO HALF CLOCK SPEED. MOST SYSTEMS NEED THIS. +;================================================================================================== +; +DMA_USEHALF .equ TRUE ; USE CLOCK DIVIDER +; +#IF (DMA_USEHALF & (DMAMODE=DMAMODE_MBC)) +#DEFINE DMAIOHALF LD A,(HB_RTCVAL) \ AND ~%00001000 \ OUT (RTCIO),A +#DEFINE DMAIOFULL PUSH AF \ LD A,(HB_RTCVAL) \ OUT (RTCIO),A \ POP AF +#ENDIF +; +#IF (DMA_USEHALF & (DMAMODE=DMAMODE_ECB)) +#DEFINE DMAIOHALF LD A,(HB_RTCVAL) \ OR %00001000 \ OUT (RTCIO),A +#DEFINE DMAIOFULL PUSH AF \ LD A,(HB_RTCVAL) \ OUT (RTCIO),A \ POP AF +#ENDIF +; +#IF (!DMA_USEHALF) +#DEFINE DMAIOHALF \; +#DEFINE DMAIOFULL \; +#ENDIF +; +;================================================================================================== +; DMA INITIALIZATION CODE +;================================================================================================== +; +DMA_INIT: + CALL NEWLINE + PRTS("DMA: IO=0x$") ; announce + LD A, DMABASE + CALL PRTHEXBYTE +; + LD A,DMA_FORCE + out (DMABASE+1),a ; force ready off +; + DMAIOHALF +; + call DMAProbe ; do we have a dma? + jr nz,DMA_NOTFOUND +; + ld hl,DMACode ; program the + ld b,DMACode_Len ; dma command + ld c,DMABASE ; block +; + di + otir ; load dma + ei + + xor a ; set status + ld (DMA_FAIL_FLAG),a ; ok to use dma +; +DMA_EXIT: + DMAIOFULL + + ret +; +DMA_NOTFOUND: + push af + call PRTSTRD + .db " NOT PRESENT$" + +#IF (DMA_FBACK) + call PRTSTRD + .db ". USING SOFTWARE$" + LD A,ERR_NOHW + LD (DMA_FAIL_FLAG),A +#ENDIF + pop af + jr DMA_EXIT +; +DMA_FAIL_FLAG: + .db DMA_FAIL_FLAG +; +;================================================================================================== +; DMA PROBE - WRITE TO ADDRESS REGISTER AND READ BACK +;================================================================================================== +; +DMAProbe: + ld a,DMA_RESET + out (DMABASE),a + ld a,%01111101 ; R0-Transfer mode, A -> B, start address follows + out (DMABASE),a + ld a,$cc + out (DMABASE),a + ld a,$dd + out (DMABASE),a + ld a,$e5 + out (DMABASE),a + ld a,$1a + out (DMABASE),a + ld a,DMA_LOAD + out (DMABASE),a +; + ld a,DMA_READ_MASK_FOLLOWS ; set up + out (DMABASE),a ; for + ld a,%00011000 ; register + out (DMABASE),a ; read + ld a,DMA_START_READ_SEQUENCE + out (DMABASE),a +; + in a,(DMABASE) ; read in + ld c,a ; address + in a,(DMABASE) + ld b,a +; + xor a ; is it + ld hl,$ddcc ; a match + sbc hl,bc ; return with + ret z ; status + cpl + ret +; +DMACode ;.db DMA_DISABLE ; R6-Command Disable DMA + .db %01111101 ; R0-Transfer mode, A -> B, start address, block length follow + .dw 0 ; R0-Port A, Start address + .dw 0 ; R0-Block length + .db %00010100 ; R1-No timing bytes follow, address increments, is memory + .db %00010000 ; R2-No timing bytes follow, address increments, is memory + .db %10000000 ; R3-DMA, interrupt, stop on match disabled + .db DMA_CONTINUOUS ; R4-Continuous mode, destination address, interrupt and control byte follow + .dw 0 ; R4-Port B, Destination address + .db %00001100 ; R4-Pulse byte follows, Pulse generated + .db 0 ; R4-Pulse offset + .db %10010010+DMA_RDY; R5-Stop on end of block, ce/wait multiplexed, READY active config + .db DMA_LOAD ; R6-Command Load +; .db DMA_FORCE_READY ; R6-Command Force ready +; .db DMA_ENABLE ; R6-Command Enable DMA +DMACode_Len .equ $-DMACode +; +;================================================================================================== +; DMA COPY BLOCK CODE - ASSUMES DMA PREINITIALIZED +;================================================================================================== +; +DMALDIR: + ld (DMASource),hl ; populate the dma + ld (DMADest),de ; register template + ld (DMALength),bc +; + ld hl,DMACopy ; program the + ld b,DMACopy_Len ; dma command + ld c,DMABASE ; block +; + DMAIOHALF +; + di + otir ; load and execute dma + ei +; + ld a,DMA_READ_STATUS_BYTE ; check status + out (DMABASE),a ; of transfer + in a,(DMABASE) ; set non-zero + and %00111011 ; if failed + sub %00011011 + + DMAIOFULL + + ret +; +DMACopy ;.db DMA_DISABLE ; R6-Command Disable DMA + .db %01111101 ; R0-Transfer mode, A -> B, start address, block length follow +DMASource .dw 0 ; R0-Port A, Start address +DMALength .dw 0 ; R0-Block length + .db %00010100 ; R1-No timing bytes follow, address increments, is memory + .db %00010000 ; R2-No timing bytes follow, address increments, is memory + .db %10000000 ; R3-DMA, interrupt, stop on match disabled + .db DMA_CONTINUOUS ; R4-Continuous mode, destination address, interrupt and control byte follow +DMADest .dw 0 ; R4-Port B, Destination address + .db %00001100 ; R4-Pulse byte follows, Pulse generated + .db 0 ; R4-Pulse offset +; .db %10010010+DMA_RDY;R5-Stop on end of block, ce/wait multiplexed, READY active config + .db DMA_LOAD ; R6-Command Load + .db DMA_FORCE_READY ; R6-Command Force ready + .db DMA_ENABLE ; R6-Command Enable DMA +DMACopy_Len .equ $-DMACopy +; +;================================================================================================== +; DMA I/O OUT BLOCK CODE - ADDRESS TO I/O PORT +;================================================================================================== +; +DMAOTIR: + ld (DMAOutSource),hl ; populate the dma + ld (DMAOutDest),a ; register template + ld (DMAOutLength),bc +; + ld hl,DMAOutCode ; program the + ld b,DMAOut_Len ; dma command + ld c,DMABASE ; block +; + DMAIOHALF + + di + otir ; load and execute dma + ei +; + ld a,DMA_READ_STATUS_BYTE ; check status + out (DMABASE),a ; of transfer + in a,(DMABASE) ; set non-zero + and %00111011 ; if failed + sub %00011011 +; + DMAIOFULL + + ret +; +DMAOutCode ;.db DMA_DISABLE ; R6-Command Disable DMA + .db %01111001 ; R0-Transfer mode, B -> A (temp), start address, block length follow +DMAOutSource .dw 0 ; R0-Port A, Start address +DMAOutLength .dw 0 ; R0-Block length + + .db %00010100 ; R1-No timing bytes follow, fixed incrementing address, is memory + .db %00101000 ; R2-No timing bytes follow, address static, is i/o + .db %10000000 ; R3-DMA, interrupt, stop on match disabled + + .db %10100101 ; R4-Continuous mode, destination port, interrupt and control byte follow +DMAOutDest .db 0 ; R4-Port B, Destination port +; .db %00001100 ; R4-Pulse byte follows, Pulse generated +; .db 0 ; R4-Pulse offset + + .db %10010010+DMA_RDY;R5-Stop on end of block, ce/wait multiplexed, READY active config + .db DMA_LOAD ; R6-Command Load + .db %00000101 ; R0-Port A is Source + .db DMA_LOAD ; R6-Command Load + .db DMA_FORCE_READY ; R6-Command Force ready + .db DMA_ENABLE ; R6-Command Enable DMA +DMAOut_Len .equ $-DMAOutCode +; +;================================================================================================== +; DMA I/O INPUT BLOCK CODE - I/O PORT TO ADDRESS +;================================================================================================== +; +DMAINIR: + ld (DMAInDest),hl ; populate the dma + ld (DMAInSource),a ; register template + ld (DMAInLength),bc +; + ld hl,DMAInCode ; program the + ld b,DMAIn_Len ; dma command + ld c,DMABASE ; block +; + DMAIOHALF +; + di + otir ; load and execute dma + ei +; + ld a,DMA_READ_STATUS_BYTE ; check status + out (DMABASE),a ; of transfer + in a,(DMABASE) ; set non-zero + and %00111011 ; if failed + sub %00011011 +; + DMAIOFULL +; + ret +; +DMAInCode ;.db DMA_DISABLE ; R6-Command Disable DMA + .db %01111001 ; R0-Transfer mode, B -> A, start address, block length follow +DMAInDest .dw 0 ; R0-Port A, Start address +DMAInLength .dw 0 ; R0-Block length + .db %00010100 ; R1-No timing bytes follow, address increments, is memory + .db %00111000 ; R2-No timing bytes follow, address static, is i/o + .db %10000000 ; R3-DMA, interrupt, stop on match disabled + .db %10100101 ; R4-Continuous mode, destination port, no interrupt, control byte. +DMAInSource .db 0 ; R4-Port B, Destination port +; .db %00001100 ; R4-Pulse byte follows, Pulse generated +; .db 0 ; R4-Pulse offset + .db %10010010+DMA_RDY;R5-Stop on end of block, ce/wait multiplexed, READY active config + .db DMA_LOAD ; R6-Command Load + .db DMA_FORCE_READY ; R6-Command Force ready + .db DMA_ENABLE ; R6-Command Enable DMA + +DMAIn_Len .equ $-DMAInCode +; +;================================================================================================== +; DEBUG - READ START, DESTINATION AND COUNT REGISTERS +;================================================================================================== +; +#IF (0) +; +DMARegDump: + ld a,DMA_READ_MASK_FOLLOWS + out (DMABASE),a + ld a,%01111110 + out (DMABASE),a + ld a,DMA_START_READ_SEQUENCE + out (DMABASE),a +; + in a,(DMABASE) + ld c,a + in a,(DMABASE) + ld b,a + call PRTHEXWORD + ld a,':' + call COUT +; + in a,(DMABASE) + ld c,a + in a,(DMABASE) + ld b,a + call PRTHEXWORD + ld a,':' + call COUT +; + in a,(DMABASE) + ld c,a + in a,(DMABASE) + ld b,a + call PRTHEXWORD +; + call NEWLINE + ret +#ENDIF diff --git a/Source/HBIOS/ds1501rtc.asm b/Source/HBIOS/ds1501rtc.asm new file mode 100644 index 00000000..4121ebad --- /dev/null +++ b/Source/HBIOS/ds1501rtc.asm @@ -0,0 +1,397 @@ + +; +;================================================================================================== +; Maxim DS1501/DS1511 Y2K-Compliant Watchdog RTC Driver +;================================================================================================== +; +; THIS DRIVER CODE WAS CONTRIBUTED TO ROMWBW BY JPELLETIER 3:59 PM 7/24/2022 +; +; Register Addresses (HEX / BCD): +; +; +---+-----+---------------+-------------------+------------------+----------------+ +; |ADR| D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 | RANGE | REGISTER | +; +---+-----+---------------+-------------------+------------------+----------------+ +; | 0 | 0 | 10-Second | 1-Second | 00-59 | Seconds | +; +---+-----+-----+---------+-------------------+------------------+----------------+ +; | 1 | 0 | 10-Minute | 1-Minute | 00-59 | Minutes | +; +---+-----+-----+---------+-------------------+------------------+----------------+ +; | 2 | 0 | 0 | 10-Hour | 1-Hour | 00-23 | Hours | +; +---+-----+-----+----+----+-------------------+------------------+----------------+ +; | 3 | 0 | 0 | 0 | 0 | 0 | Day Of Week | 01-07 | Day Of Week | +; +---+-----+-----+----+----+----+--------------+------------------+----------------+ +; | 4 | 0 | 0 | 10-Date | 1-Date | 01-31 | Date | +; +---+-----+-----+----+----+-------------------+------------------+----------------+ +; | 5 |/EOSC|/E32K|BB32|10Mo| 1-Month | 01-12 | Month | +; +---+-----+-----+----+----+-------------------+------------------+----------------+ +; | 6 | 10-Year | 1-Year | 00-99 | Year | +; +---+-----+-----+----+----+----+----+----+----+------------------+----------------+ +; | 7 | 10-Century | 1-Century | 00-39 | Century | +; +---+-----+-----+----+----+----+----+----+----+------------------+----------------+ +; | 8 | AM1| 10-Second | 1-Second | 00-59 | Seconds Alarm | +; +---+-----+---------------+-------------------+------------------+----------------+ +; | 9 | AM2| 10-Minute | 1-Minute | 00-59 | Minutes Alarm | +; +---+-----+-----+---------+-------------------+------------------+----------------+ +; | A | AM3| 0 | 10-Hour | 1-Hour | 00-23 | Hours Alarm | +; +---+-----+-----+----+----+-------------------+------------------+----------------+ +; | B | AM4|DY/DT| 10-date | Day/Date | 1-7/01-31 | Day/Date Alarm | +; +---+-----+-----+----+----+----+--------------+------------------+----------------+ +; | C | 0.1-Second | 0.01-Second | 00-99 | Watchdog | +; +---+-----+-----+---------+-------------------+------------------+----------------+ +; | D | 10-Second | 1-Second | 00-99 | Watchdog | +; +---+-----+-----+---------+-------------------+------------------+----------------+ +; | E | BLF1| BLF2| PRS| PAB| TDF| KSF| WDF|IRQF| | ControlA | +; +---+-----+-----+----+----+----+----+----+----+------------------+----------------+ +; | F | TE| CS| BME| TPE| TIE| KIE| WDE| WDS| | ControlB | +; +---+-----+-----+----+----+----+----+----+----+------------------+----------------+ +; |10 | Extended RAM Address | 00-FF | RAM Address | +; +---+-----+-----+----+----+----+----+----+----+------------------+----------------+ +; |11 | Reserved | | | +; +---+-----+-----+----+----+----+----+----+----+------------------+----------------+ +; |12 | Reserved | | | +; +---+--+--+-----+----+----+----+----+----+----+------------------+----------------+ +; |13 | Extended RAM Data | 00-FF | RAM Data | +; +---+--+--+-----+----+----+----+----+----+----+------------------+----------------+ +; |14-1F | Reserved | | | +; +------+--+-----+----+----+----+----+----+----+------------------+----------------+ + +; * = Unused bits; unwritable and read as 0. +; 0 = should be set to 0 for valid time/calendar range. +; Clock calendar data is BCD. Automatic leap year adjustment. +; Day-Of-Week coded as Sunday = 1 through Saturday = 7. + +; Constants + +;By defining 2 bases, this allows some flexibility for address decoding +DS1501NVM_BASE .EQU DS1501RTC_BASE + $10 + +DS1501RTC_SEC .EQU DS1501RTC_BASE + $00 +DS1501RTC_MIN .EQU DS1501RTC_BASE + $01 +DS1501RTC_HOUR .EQU DS1501RTC_BASE + $02 +DS1501RTC_WEEK_DAY .EQU DS1501RTC_BASE + $03 +DS1501RTC_DAY .EQU DS1501RTC_BASE + $04 +DS1501RTC_MONTH .EQU DS1501RTC_BASE + $05 +DS1501RTC_YEAR .EQU DS1501RTC_BASE + $06 +DS1501RTC_CENT .EQU DS1501RTC_BASE + $07 +DS1501RTC_SEC_ALM .EQU DS1501RTC_BASE + $08 +DS1501RTC_MIN_ALM .EQU DS1501RTC_BASE + $09 +DS1501RTC_HOUR_ALM .EQU DS1501RTC_BASE + $0A +DS1501RTC_DAY_ALM .EQU DS1501RTC_BASE + $0B +DS1501RTC_WDOG1 .EQU DS1501RTC_BASE + $0C +DS1501RTC_WDOG2 .EQU DS1501RTC_BASE + $0D +DS1501RTC_CONTROLA .EQU DS1501RTC_BASE + $0E +DS1501RTC_CONTROLB .EQU DS1501RTC_BASE + $0F + +DS1501RTC_RAMADDR .EQU DS1501NVM_BASE + $00 +DS1501RTC_RAMDATA .EQU DS1501NVM_BASE + $03 + +DS1501RTC_HIGH .EQU %11110000 +DS1501RTC_LOW .EQU %00001111 + +;ControlA bit masks +;BLF1| BLF2| PRS| PAB| TDF| KSF| WDF|IRQF +DS1501RTC_IRQF .EQU %00000001 +DS1501RTC_WDF .EQU %00000010 +DS1501RTC_KSF .EQU %00000100 +DS1501RTC_TDF .EQU %00001000 +DS1501RTC_PAB .EQU %00010000 +DS1501RTC_PRS .EQU %00100000 +DS1501RTC_BLF2 .EQU %01000000 +DS1501RTC_BLF1 .EQU %10000000 + +;ControlB bit masks +;TE| CS| BME| TPE| TIE| KIE| WDE| WDS| +DS1501RTC_WDS .EQU %00000001 +DS1501RTC_WDE .EQU %00000010 +DS1501RTC_KIE .EQU %00000100 +DS1501RTC_TIE .EQU %00001000 +DS1501RTC_TPE .EQU %00010000 +DS1501RTC_BME .EQU %00100000 +DS1501RTC_CS .EQU %01000000 +DS1501RTC_TE .EQU %10000000 + +DS1501RTC_BUFSIZE .EQU 6 ; 6 BYTE BUFFER (YYMMDDHHMMSS) + +; RTC Device Initialization Entry + +DS1501RTC_INIT: + CALL NEWLINE ; Formatting + PRTS("DS1501RTC: IO=0x$") + LD A, DS1501RTC_BASE + CALL PRTHEXBYTE + + CALL NEWLINE ; Formatting + PRTS("DS1501NVM: IO=0x$") + LD A, DS1501NVM_BASE + CALL PRTHEXBYTE + + IN A,(DS1501RTC_CONTROLB) ;clear any pending interrupt flags + + XOR A ; Zero A + OR DS1501RTC_TE ;enable time updates + OUT (DS1501RTC_CONTROLB), A + + CALL DS1501RTC_LOAD + ; DISPLAY CURRENT TIME + PRTS(" $") + LD A, (DS1501RTC_BUF_MON) + CALL PRTHEXBYTE + PRTS("/$") + LD A, (DS1501RTC_BUF_DAY) + CALL PRTHEXBYTE + PRTS("/$") + LD A, (DS1501RTC_BUF_YEAR) + CALL PRTHEXBYTE + PRTS(" $") + LD A, (DS1501RTC_BUF_HOUR) + CALL PRTHEXBYTE + PRTS(":$") + LD A, (DS1501RTC_BUF_MIN) + CALL PRTHEXBYTE + PRTS(":$") + LD A, (DS1501RTC_BUF_SEC) + CALL PRTHEXBYTE + + LD BC,DS1501RTC_DISPATCH + CALL RTC_SETDISP + + XOR A ; Signal success + RET + +; RTC Device Function Dispatch Entry +; A: Result (OUT), 0=OK, Z=OK, NZ=Error +; B: Function (IN) + +DS1501RTC_DISPATCH: + LD A, B ; Get requested function + AND $0F ; Isolate Sub-Function + JP Z, DS1501RTC_GETTIM ; Get Time + DEC A + JP Z, DS1501RTC_SETTIM ; Set Time + DEC A + JP Z, DS1501RTC_GETBYT ; Get NVRAM Byte Value + DEC A + JP Z, DS1501RTC_SETBYT ; Set NVRAM Byte Value + DEC A + JP Z, DS1501RTC_GETBLK ; Get NVRAM Data Block Value + DEC A + JP Z, DS1501RTC_SETBLK ; Set NVRAM Data Block Value + DEC A + JP Z, DS1501RTC_GETALM ; Get Alarm + DEC A + JP Z, DS1501RTC_SETALM ; Set Alarm +; +; NVRAM FUNCTIONS ARE NOT IMPLEMENTED YET +; +DS1501RTC_GETBYT: +DS1501RTC_SETBYT: +DS1501RTC_GETBLK: +DS1501RTC_SETBLK: + CALL PANIC + +; RTC Get Time +; A: Result (OUT), 0=OK, Z=OK, NZ=Error +; HL: Date/Time Buffer (OUT) +; Buffer format is BCD: YYMMDDHHMMSS +; 24 hour time format is assumed +; +DS1501RTC_GETTIM: + EX DE, HL + CALL DS1501RTC_LOAD + ; Now copy to read destination (Interbank Save) + LD A, BID_BIOS ; Copy from BIOS bank + LD (HB_SRCBNK), A ; Set it + LD A, (HB_INVBNK) ; Copy to current user bank + LD (HB_DSTBNK), A ; Set it + LD BC, DS1501RTC_BUFSIZE ; Length is 6 bytes +#IF (INTMODE == 1) + DI +#ENDIF + CALL HB_BNKCPY ; Copy the clock data +#IF (INTMODE == 1) + EI +#ENDIF +; + ; CLEAN UP AND RETURN + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; +; RTC Set Time +; A: Result (OUT), 0=OK, Z=OK, NZ=Error +; HL: Date/Time Buffer (IN) +; Buffer Format is BCD: YYMMDDHHMMSS +; 24 hour time format is assumed +; +DS1501RTC_SETTIM: +; + ; Copy incoming time data to our time buffer + LD A, (HB_INVBNK) ; Copy from current user bank + LD (HB_SRCBNK), A ; Set it + LD A, BID_BIOS ; Copy to BIOS bank + LD (HB_DSTBNK), A ; Set it + LD DE, DS1501RTC_BUF ; Destination Address + LD BC, DS1501RTC_BUFSIZE ; Length is 6 bytes +#IF (INTMODE == 1) + DI +#ENDIF + CALL HB_BNKCPY ; Copy the clock data +#IF (INTMODE == 1) + EI +#ENDIF + ; Write to clock + LD HL, DS1501RTC_BUF + CALL DS1501RTC_SUSPEND + LD A, (HL) + OUT (DS1501RTC_YEAR), A ; Write Year + INC HL + LD A, (HL) + OUT (DS1501RTC_MONTH), A ; Write Month + INC HL + LD A, (HL) + OUT (DS1501RTC_DAY), A ; Write Day + INC HL + LD A, (HL) + OUT (DS1501RTC_HOUR), A ; Write Hour + INC HL + LD A, (HL) + OUT (DS1501RTC_MIN), A ; Write Minute + INC HL + LD A, (HL) + OUT (DS1501RTC_SEC), A ; Write Second + CALL DS1501RTC_RESUME + ; clean up and return + XOR A ; Signal success + RET ; And return + +; RTC Get Alarm +; A: Result (OUT), 0=OK, Z=OK, NZ=Error +; HL: Date/Time Buffer (OUT) +; Buffer format is BCD: YYMMDDHHMMSS +; 24 hour time format is assumed +; +DS1501RTC_GETALM: + EX DE, HL + LD HL, DS1501RTC_BUF + PUSH HL ; Save address of source buffer + CALL DS1501RTC_SUSPEND + XOR A + LD (HL), A ; Read Year + INC HL + LD (HL), A ; Read Month + INC HL + IN A, (DS1501RTC_DAY_ALM) ; Read Day + LD (HL), A + INC HL + IN A, (DS1501RTC_HOUR_ALM) ; Read Hour + LD (HL), A + INC HL + IN A, (DS1501RTC_MIN_ALM) ; Read Minute + LD (HL), A + INC HL + IN A, (DS1501RTC_SEC_ALM) ; Read Second + LD (HL), A + CALL DS1501RTC_RESUME + POP HL ; Restore address of source buffer + ; Now copy to read destination (Interbank Save) + LD A, BID_BIOS ; Copy from BIOS bank + LD (HB_SRCBNK), A ; Set it + LD A, (HB_INVBNK) ; Copy to current user bank + LD (HB_DSTBNK), A ; Set it + LD BC, DS1501RTC_BUFSIZE ; Length is 6 bytes +#IF (INTMODE == 1) + DI +#ENDIF + CALL HB_BNKCPY ; Copy the clock data +#IF (INTMODE == 1) + EI +#ENDIF +; + ; CLEAN UP AND RETURN + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; +; RTC Set Alarm +; A: Result (OUT), 0=OK, Z=OK, NZ=Error +; HL: Date/Time Buffer (IN) +; Buffer Format is BCD: YYMMDDHHMMSS +; 24 hour time format is assumed +; +DS1501RTC_SETALM: + ; Copy incoming time data to our time buffer + LD A, (HB_INVBNK) ; Copy from current user bank + LD (HB_SRCBNK), A ; Set it + LD A, BID_BIOS ; Copy to BIOS bank + LD (HB_DSTBNK), A ; Set it + LD DE, DS1501RTC_BUF ; Destination Address + LD BC, DS1501RTC_BUFSIZE ; Length is 6 bytes +#IF (INTMODE == 1) + DI +#ENDIF + CALL HB_BNKCPY ; Copy the clock data +#IF (INTMODE == 1) + EI +#ENDIF + ; Write to clock + LD HL, DS1501RTC_BUF_DAY + CALL DS1501RTC_SUSPEND + LD A, (HL) + OUT (DS1501RTC_DAY_ALM), A ; Write Day + INC HL + LD A, (HL) + OUT (DS1501RTC_HOUR_ALM), A ; Write Hour + INC HL + LD A, (HL) + OUT (DS1501RTC_MIN_ALM), A ; Write Minute + INC HL + LD A, (HL) + OUT (DS1501RTC_SEC_ALM), A ; Write Second + CALL DS1501RTC_RESUME + ; clean up and return + XOR A ; Signal success + RET ; And return + +DS1501RTC_SUSPEND: + IN A, (DS1501RTC_CONTROLB) ; Suspend Clock + AND ~DS1501RTC_TE + OUT (DS1501RTC_CONTROLB), A + RET + +DS1501RTC_RESUME: + IN A, (DS1501RTC_CONTROLB) ; Resume Clock + OR DS1501RTC_TE + OUT (DS1501RTC_CONTROLB), A + RET + +DS1501RTC_LOAD: + LD HL, DS1501RTC_BUF + PUSH HL ; Save address of source buffer + CALL DS1501RTC_SUSPEND + IN A, (DS1501RTC_YEAR) ; Read Year + LD (HL), A + INC HL + IN A, (DS1501RTC_MONTH) ; Read Month + LD (HL), A + INC HL + IN A, (DS1501RTC_DAY) ; Read Day + LD (HL), A + INC HL + IN A, (DS1501RTC_HOUR) ; Read Hour + LD (HL), A + INC HL + IN A, (DS1501RTC_MIN) ; Read Minute + LD (HL), A + INC HL + IN A, (DS1501RTC_SEC) ; Read Second + LD (HL), A + CALL DS1501RTC_RESUME + POP HL ; Restore address of source buffer + RET + +; Working Variables + +DS1501RTC_BUF: +DS1501RTC_BUF_YEAR: .DB 0 ; Year +DS1501RTC_BUF_MON: .DB 0 ; Month +DS1501RTC_BUF_DAY: .DB 0 ; Day +DS1501RTC_BUF_HOUR: .DB 0 ; Hour +DS1501RTC_BUF_MIN: .DB 0 ; Minute +DS1501RTC_BUF_SEC: .DB 0 ; Second diff --git a/Source/HBIOS/ds7rtc.asm b/Source/HBIOS/ds7rtc.asm new file mode 100644 index 00000000..82987e02 --- /dev/null +++ b/Source/HBIOS/ds7rtc.asm @@ -0,0 +1,441 @@ +;================================================================================================== +; DS1307 PCF I2C CLOCK DRIVER +; +; LABELS STARTING WITH PCF ARE REFERENCING THE PCF8584 LIBRARY +; +;================================================================================================== +; +DS7_OUT .EQU 10000000B ; SELECT SQUARE WAVE FUNCTION +DS7_SQWE .EQU 00010000B ; ENABLE SQUARE WAVE OUTPUT +DS7_RATE .EQU 00000000B ; SET 1HZ OUPUT +; +DS7_DS1307 .EQU 11010000B ; DEVICE IDENTIFIER +DS7_W .EQU 00000000B ; DEVICE WRITE +DS7_R .EQU 00000001B ; DEVICE READ +; +DS7_READ .EQU (DS7_DS1307 | DS7_R) ; READ +DS7_WRITE .EQU (DS7_DS1307 | DS7_W) ; WRITE +; +DS7_CTL .EQU (DS7_OUT | DS7_SQWE | DS7_RATE) +; +;----------------------------------------------------------------------------- +; DS1307 INITIALIZATION +; +; ASSUMES PCF8584 I2C HAS ALREADY BEEN INITIALIZED +; CHECKS IF OSCILLATOR IS RUNNING. IF IT ISN'T THE +; CLOCK IS RESTARTED WITH DEFAULT VALUES. +; +; DRIVER WILL NOT BE INSTALLED AS PART OF HBIOS IF +; THERE IS ALREADY AND EXISTING RTC INSTALLED. +; +; 12HR MODE IS CURRENTLY ASSUMED +; +DS7RTC_INIT: + PRTS("DS1307: $") ; ANNOUNCE DRIVER +; + LD A,(PCF_FAIL_FLAG) ; CHECK IF THE + OR A ; I2C DRIVER + JR NZ,RTC_INIT_FAIL ; INITIALIZED + + CALL DS7_RDC ; READ CLOCK DATA + LD HL,DS7_BUF ; IF NOT RUNNING OR + BIT 7,(HL) ; INVALID, RESTART + JR Z,DS7_CSET ; AND RESET. + CALL DS7_SETC + CALL DS7_RDC ; READ AND DISPLAY +DS7_CSET: + CALL DS7_DISP ; DATE AND TIME +; + LD A,(RTC_DISPACT) ; CHECK RTC DISPATCHER STATUS. + OR A ; RETURN NOW IF WE ALREADY HAVE + RET NZ ; A PRIMARY RTC INSTALLED. +; + LD BC,DS7_DISPATCH ; SETUP CLOCK HBIOS DISATCHER + CALL RTC_SETDISP +; +; CALL DS7_GETTIM +; + XOR A ; SIGNAL SUCCESS + RET +; +RTC_INIT_FAIL: ; EXIT + CALL PRTSTRD ; WITH + .DB "NO I2C DRIVER$" ; ERROR + PUSH AF ; MESSAGE +RTC_INIT_ERR: ; EXIT + POP AF ; WITH + LD A,ERR_NOHW ; ERROR + OR A ; STATUS + RET +; +;----------------------------------------------------------------------------- +; DS1307 HBIOS DISPATCHER +; +; A: RESULT (OUT), 0=OK, Z=OK, NZ=ERROR +; B: FUNCTION (IN) +; +DS7_DISPATCH: + PUSH AF ; CHECK IF WE + LD A,(PCF_FAIL_FLAG) ; HAVE HARDWARE + OR A ; AND ASSOCIATED + JR NZ,RTC_INIT_ERR ; DRIVER + POP AF +; + LD A, B ; GET REQUESTED FUNCTION + AND $0F ; ISOLATE SUB-FUNCTION + JP Z, DS7_GETTIM ; GET TIME + DEC A + JP Z, DS7_SETTIM ; SET TIME + DEC A + JP Z, DS7_GETBYT ; GET NVRAM BYTE VALUE + DEC A + JP Z, DS7_SETBYT ; SET NVRAM BYTE VALUE + DEC A + JP Z, DS7_GETBLK ; GET NVRAM DATA BLOCK VALUE + DEC A + JP Z, DS7_SETBLK ; SET NVRAM DATA BLOCK VALUE + DEC A + JP Z, DS7_GETALM ; GET ALARM + DEC A + JP Z, DS7_SETALM ; SET ALARM + DEC A + JP Z, DS7_DEVICE ; REPORT RTC DEVICE INFO + SYSCHKERR(ERR_NOFUNC) + RET +; +;----------------------------------------------------------------------------- +; DS1307 GET TIME +; +; HL POINTS TO A BUFFER TO STORE THE CURRENT TIME AND DATE IN. +; THE TIME AND DATE INFORMATION MUST BE TRANSLATED TO THE +; HBIOS FORMAT AND COPIED FROM THE HBIOS DRIVER BANK TO +; CALLER INVOKED BANK. +; +; HBIOS FORMAT = YYMMDDHHMMSS +; DS1307 FORMAT = SSMMHH..DDMMYY.. +; +DS7_GETTIM: + PUSH HL ; SAVE DESTINATION + CALL DS7_RDC ; READ THE CLOCK INTO THE BUFFER +; + LD HL,DS7_BUF+2 + LD DE,DS7_BUF+3 ; TRANSLATE + LD B,3 ; FORMAT +DS7_GT0:LD A,(HL) + LD (DE),A + INC DE + LD A,(DE) + LD (HL),A + DEC HL + DJNZ DS7_GT0 +; + INC HL ; POINT TO SECONDS + RES 7,(HL) ; REMOVE OSCILLATOR BIT + POP DE ; HL POINT TO SOURCE +; ; DE POINT TO DESTINATION +#IF (0) + PUSH HL + PUSH DE + EX DE,HL + LD A,6 + CALL PRTHEXBUF + POP DE + POP HL +#ENDIF +; + LD A,BID_BIOS ; COPY FROM BIOS BANK + LD (HB_SRCBNK),A ; SET IT + LD A, (HB_INVBNK) ; COPY TO CURRENT USER BANK + LD (HB_DSTBNK),A ; SET IT + LD BC, 6 ; LENGTH IS 6 BYTES +#IF (INTMODE == 1) + DI +#ENDIF + CALL HB_BNKCPY ; COPY THE CLOCK DATA +#IF (INTMODE == 1) + EI +#ENDIF + XOR A ; SIGNAL SUCCESS + RET +; +;----------------------------------------------------------------------------- +; DS1307 SET TIME +; +; A: RESULT (OUT), 0=OK, Z=OK, NZ=ERROR +; HL: DATE/TIME BUFFER (IN) +; +; HBIOS FORMAT = YYMMDDHHMMSS +; DS1307 FORMAT = SSMMHH..DDMMYY.. +; +DS7_SETTIM: +; CALL PCF_DBG ; [0] + + + LD A, (HB_INVBNK) ; COPY FROM CURRENT USER BANK + LD (HB_SRCBNK), A ; SET IT + LD A, BID_BIOS ; COPY TO BIOS BANK + LD (HB_DSTBNK), A ; SET IT + LD DE, DS7_BUF ; DESTINATION ADDRESS + LD BC,6 ; LENGTH IS 6 BYTES +#IF (INTMODE == 1) + DI +#ENDIF + CALL HB_BNKCPY ; Copy the clock data +#IF (INTMODE == 1) + EI +#ENDIF +; +; CALL PCF_DBG ; [1] + + CALL PCF_WAIT_FOR_BB + JP NZ,PCF_BBERR +; + LD A,DS7_WRITE ; SET SLAVE ADDRESS + OUT (PCF_RS0),A +; + CALL PCF_START ; GENERATE START CONDITION + CALL PCF_WAIT_FOR_PIN; AND ISSUE THE SLAVE ADDRESS + CALL NZ,PCF_PINERR +; + LD A,00H ; REGISTER 00 + OUT (PCF_RS0),A ; PUT ADDRESS ON BUS + CALL PCF_WAIT_FOR_PIN + CALL NZ,PCF_PINERR +; + LD DE,5 + CALL DS7_SET3 ; STARTING AT REGISTER 0 +; + CALL PCF_STOP + + CALL PCF_WAIT_FOR_BB + JP NZ,PCF_BBERR + +; CALL PCF_DBG ; [2] +; + LD A,DS7_WRITE ; SET SLAVE ADDRESS + OUT (PCF_RS0),A +; + CALL PCF_START ; GENERATE START CONDITION + CALL PCF_WAIT_FOR_PIN; AND ISSUE THE SLAVE ADDRESS + CALL NZ,PCF_PINERR + +; CALL PCF_DBG ; [3] +; + LD A,04H ; REGISTER 04 + OUT (PCF_RS0),A ; PUT ADDRESS ON BUS + CALL PCF_WAIT_FOR_PIN + CALL NZ,PCF_PINERR +; + LD DE,2 + CALL DS7_SET3 + +; CALL PCF_DBG ; [4] +; + CALL PCF_STOP + XOR A + RET +; +DS7_SET3: + LD B,3 + LD HL,DS7_BUF + ADD HL,DE +DS7_SC1:PUSH BC + + LD A,(HL) + +; CALL PRTHEXBYTE + + OUT (PCF_RS0),A ; PUT DATA ON BUS + CALL PCF_WAIT_FOR_ACK + CALL NZ,PCF_ACKERR + POP BC + DEC HL + DJNZ DS7_SC1 + RET +; +; HBIOS FORMAT = YYMMDDHHMMSS +; 991122083100 +; DS1307 FORMAT = SSMMHH..DDMMYY.. +; 003108..221199 +; +;----------------------------------------------------------------------------- +; FUNCTIONS THAT ARE NOT AVAILABLE OR IMPLEMENTED +; +DS7_GETBYT: +DS7_SETBYT: +DS7_GETBLK: +DS7_SETBLK: +DS7_SETALM +DS7_GETALM + SYSCHKERR(ERR_NOTIMPL) + RET +;----------------------------------------------------------------------------- +; REPORT RTC DEVICE INFO +; +; THE I2C BUS ADDRESS IS REPORTED RATHER THAN THE I2C PORT ADDRESS. +; ONLY ONE CLOCK CAN BE INSTALLED IN HBIOS SO DEVICE NUMBER IS ALWAYS 0. +; +DS7_DEVICE: + LD D,RTCDEV_DS7 ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL DEVICE NUMBER + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,DS7_DS1307 ; L := BUS ADDRESS + XOR A ; SIGNAL SUCCESS + RET +;----------------------------------------------------------------------------- +; RTC READ +; +; 1. ISSUE SLAVE ADDRESS WITH START CONDITION AND WRITE STATUS +; 2. OUTPUT THE ADDRESS TO ACCESS. (00H = START OF DS1307 REGISTERS) +; 3. OUTPUT REPEAT START TO TRANSITION TO READ PROCESS +; 4. ISSUE SLAVE ADDRESS WITH READ STATUS +; 5. DO A DUMMY READ +; 6. READ 8 BYTES STARTING AT ADDRESS PREVIOUSLY SET +; 7. END READ WITH NON-ACKNOWLEDGE +; 8. ISSUE STOP AND RELEASE BUS +; +DS7_RDC:LD A,DS7_WRITE ; SET SLAVE ADDRESS + OUT (PCF_RS0),A +; + CALL PCF_WAIT_FOR_BB + JP NZ,PCF_BBERR +; + CALL PCF_START ; GENERATE START CONDITION + CALL PCF_WAIT_FOR_PIN; AND ISSUE THE SLAVE ADDRESS + CALL NZ,PCF_PINERR +; + LD A,0 + OUT (PCF_RS0),A ; PUT ADDRESS MSB ON BUS + CALL PCF_WAIT_FOR_PIN + CALL NZ,PCF_PINERR +; + CALL PCF_REPSTART ; REPEAT START +; + LD A,DS7_READ ; ISSUE CONTROL BYTE + READ + OUT (PCF_RS0),A +; + CALL PCF_READI2C ; DUMMY READ +; + LD HL,DS7_BUF ; READ 8 BYTES INTO BUFFER + LD B,8 +DS7_RL1:CALL PCF_READI2C + LD (HL),A + INC HL + DJNZ DS7_RL1 +; +#IF (0) + LD A,8 + LD DE,DS7_BUF ; DISPLAY DATA READ + CALL PRTHEXBUF ; + CALL NEWLINE +#ENDIF +; + LD A,PCF_ES0 ; END WITH NOT-ACKNOWLEDGE + OUT (PCF_RS1),A ; AND RELEASE BUS + NOP + IN A,(PCF_RS0) + NOP +DS7_WTPIN: + IN A,(PCF_RS1) ; READ S1 REGISTER + BIT 7,A ; CHECK PIN STATUS + JP NZ,DS7_WTPIN + CALL PCF_STOP +; + IN A,(PCF_RS0) + RET +; +;----------------------------------------------------------------------------- +; SET CLOCK +; +; IF THE CLOCK IS HALTED AS IDENTIFIED BY BIT 7 REGISTER 0, THEN ASSUME THE +; CLOCK HAS NOT BEEN SET AND SO SET THE CLOCK UP WITH A DEFAULT SET OF +; VALUES AS DEFINED IN THE DS7_CLKDATA TABLE. +; +DS7_SETC: + CALL PCF_WAIT_FOR_BB + JP NZ,PCF_BBERR +; + LD A,DS7_WRITE ; SET SLAVE ADDRESS + OUT (PCF_RS0),A +; + CALL PCF_START ; GENERATE START CONDITION + CALL PCF_WAIT_FOR_PIN; AND ISSUE THE SLAVE ADDRESS + CALL NZ,PCF_PINERR +; + LD A,00H ; REGISTER 00 + OUT (PCF_RS0),A ; PUT ADDRESS ON BUS + CALL PCF_WAIT_FOR_PIN + CALL NZ,PCF_PINERR +; + LD DE,DS7_CLKDATA +DS7_SC: LD A,(DE) + CP 0FFH + JR Z,DS7_ESC + OUT (PCF_RS0),A ; PUT DATA ON BUS + CALL PCF_WAIT_FOR_ACK + CALL NZ,PCF_ACKERR + INC DE + JR DS7_SC +; +DS7_ESC:CALL PCF_STOP + RET +; +DS7_CLKDATA: + .DB 00H ; SECONDS + .DB 00H ; MINUTES + .DB 00H ; HOURS + .DB 01H ; DAY + .DB 01H ; DATE + .DB 01H ; MONTH + .DB 21H ; YEAR + .DB DS7_CTL ; CONTROL (00010011B) + .DB 0FFH ; END FLAG +; +;----------------------------------------------------------------------------- +; DISPLAY CLOCK INFORMATION FROM DATA STORED IN BUFFER +; +DS7_DISP: + LD HL,DS7_CLKTBL +DS7_CLP:LD C,(HL) + INC HL + LD D,(HL) + CALL DS7_BCD + INC HL + LD A,(HL) + OR A + RET Z + CALL COUT + INC HL + JR DS7_CLP + RET +; +DS7_CLKTBL: + .DB 04H, 00111111B, '/' + .DB 05H, 00011111B, '/' + .DB 06H, 11111111B, ' ' + .DB 02H, 00011111B, ':' + .DB 01H, 01111111B, ':' + .DB 00H, 01111111B, 00H +; +DS7_BCD:PUSH HL + LD HL,DS7_BUF ; READ VALUE FROM + LD B,0 ; BUFFER, INDEXED BY A + ADD HL,BC + LD A,(HL) + AND D ; MASK OFF UNNEEDED + SRL A + SRL A + SRL A + SRL A + ADD A,30H + CALL COUT + LD A,(HL) + AND 00001111B + ADD A,30H + CALL COUT + POP HL + RET +; +DS7_BUF: .FILL 8,0 ; BUFFER FOR TIME, DATE AND CONTROL +;DS7_COLD .DB $80,$00,$00,$01,$01,$01,$00 ; COLD START RTC SETTINGS +; diff --git a/Source/HBIOS/dsky.asm b/Source/HBIOS/dsky.asm index 26b9e92a..c0da58e7 100644 --- a/Source/HBIOS/dsky.asm +++ b/Source/HBIOS/dsky.asm @@ -1,26 +1,18 @@ ; ;================================================================================================== -; DSKY ROUTINES +; DSKY (DISPLAY AND KEYBOARD) ROUTINES ;================================================================================================== ; -PPIA .EQU PPIBASE + 0 ; PORT A -PPIB .EQU PPIBASE + 1 ; PORT B -PPIC .EQU PPIBASE + 2 ; PORT C -PPIX .EQU PPIBASE + 3 ; PPI CONTROL PORT -; -; ICM7218A KEYPAD PPISD -; -------- -------- -------- -; PA0-7 IO0-7 -; PB0-5 COLS 0-5 -; PB6 -; PB7 DO (SD) -; PC1 ROW 1 CLK (>SD) -; PC2-3 ROWS 2-3 -; PC4 /CS (PRI) -; PC5 /CS (SEC) -; PC6 /WR -; PC7 MODE +; THE DSKY MAY COINCIDE ON THE SAME PPI BUS AS A PPISD. IT MAY NOT +; SHARE A PPI BUS WITH A PPIDE. SEE PPI_BUS.TXT FOR MORE INFORMATION. +; +; LED SEGMENTS (BIT VALUES) +; +; +--40--+ +; 02 20 +; +--04--+ +; 08 10 +; +--01--+ 80 ; ; DSKY SCAN CODES ARE ONE BYTE: CCRRRRRR ; BITS 7-6 IDENTFY THE COLUMN OF THE KEY PRESSED @@ -34,16 +26,22 @@ PPIX .EQU PPIBASE + 3 ; PPI CONTROL PORT ; PB1 | $02 [1] $42 [2] $82 [3] $C2 [EN] ; PB0 | $01 [FW] $41 [0] $81 [BK] $C1 [CL] ; +; +PPIA .EQU DSKYPPIBASE + 0 ; PORT A +PPIB .EQU DSKYPPIBASE + 1 ; PORT B +PPIC .EQU DSKYPPIBASE + 2 ; PORT C +PPIX .EQU DSKYPPIBASE + 3 ; PPI CONTROL PORT +; ;__DSKY_INIT_________________________________________________________________________________________ ; ; CONFIGURE PARALLEL PORT AND CLEAR KEYPAD BUFFER ;____________________________________________________________________________________________________ ; -DSKY_INIT: +DSKY_PREINIT: OR $FF ; SIGNAL TO WAIT FOR KEY RELEASE LD (DSKY_KEYBUF),A ; SET IT - - ; PPI PORT B IS NORMALLY SET TO INPUT, BUT DURING HERE WE +; + ; PPI PORT B IS NORMALLY SET TO INPUT, BUT HERE WE ; TEMPORARILY SET IT TO OUTPUT. WHILE IN OUTPUT MODE, WE ; WRITE A VALUE OF $FF WHICH WILL BE PERSISTED BY THE PPI ; CHIP BUS HOLD CIRCUIT IF THERE IS NO DSKY PRESENT. SO, @@ -55,22 +53,47 @@ DSKY_INIT: OUT (PPIX),A LD A,$FF ; SET PPIB=$FF, BUS HOLD OUT (PPIB),A - +; LD A,$82 ; PA OUT, PB IN, PC OUT OUT (PPIX),A - +; ;IN A,(PPIB) ; *DEBUG* ;CALL PRTHEXBYTE ; *DEBUG* - +; + IN A,(PPIB) ; READ PPIB + XOR $FF ; INVERT RESULT + LD (DSKY_PRESENT),A ; SAVE AS PRESENT FLAG +; DSKY_RESET: PUSH AF - +; LD A,$70 ; PPISD AND 7218 INACTIVE OUT (PPIC),A - +; POP AF RET ; +#IFDEF HBIOS +; +DSKY_INIT: + CALL NEWLINE ; FORMATTING + PRTS("DSKY:$") ; FORMATTING +; + PRTS(" IO=0x$") ; FORMATTING + LD A,DSKYPPIBASE ; GET BASE PORT + CALL PRTHEXBYTE ; PRINT BASE PORT + PRTS(" MODE=$") ; FORMATTING + PRTS("V1$") ; PRINT DSKY TYPE +; + LD A,(DSKY_PRESENT) ; PRESENT? + OR A ; SET FLAGS + RET NZ ; YES, ALL DONE + PRTS(" NOT PRESENT$") ; NOT PRESENT +; + RET +; +#ENDIF +; #IFDEF DSKY_KBD ; KY_0 .EQU $00 @@ -104,6 +127,10 @@ KY_BO .EQU $17 ; BOOT ;____________________________________________________________________________________________________ ; DSKY_GETKEY: + LD A,(DSKY_PRESENT) ; DOES IT EXIST? + OR A ; SET FLAGS + JR Z,DSKY_GETKEY1A ; ABORT IF NOT PRESENT +; CALL DSKY_STAT ; CHECK STATUS JR Z,DSKY_GETKEY ; LOOP IF NOTHING READY LD A,(DSKY_KEYBUF) @@ -116,6 +143,7 @@ DSKY_GETKEY1: INC HL INC C ; BUMP INDEX DJNZ DSKY_GETKEY1 ; LOOP UNTIL EOT +DSKY_GETKEY1A: LD A,$FF ; NOT FOUND ERR, RETURN $FF RET DSKY_GETKEY2: @@ -131,6 +159,10 @@ DSKY_GETKEY2: ;____________________________________________________________________________________________________ ; DSKY_STAT: + LD A,(DSKY_PRESENT) ; DOES IT EXIST? + OR A ; SET FLAGS + RET Z ; ABORT WITH A=0 IF NOT THERE +; LD A,(DSKY_KEYBUF) ; GET CURRENT BUF VAL CP $FF ; $FF MEANS WE ARE WAITING FOR PREV KEY TO BE RELEASED JR Z,DSKY_STAT1 ; CHECK FOR PREV KEY RELEASE @@ -199,7 +231,7 @@ DSKY_SCAN1: INC E ; BUMP COL ID DJNZ DSKY_SCAN1 ; LOOP THROUGH ALL COLS XOR A ; NOTHING FOUND, RETURN ZERO - JR DSKY_RESET ; RETURN VIA RESET + JP DSKY_RESET ; RETURN VIA RESET DSKY_SCAN2: RRC E ; MOVE COL ID RRC E ; ... TO HIGH BITS 6 & 7 @@ -228,57 +260,68 @@ DSKY_KEYBUF .DB 0 #ENDIF ; DSKY_KBD ; ;================================================================================================== -; DSKY HEX DISPLAY +; CONVERT 32 BIT BINARY TO 8 BYTE HEX SEGMENT DISPLAY ;================================================================================================== ; -DSKY_HEXOUT: - LD B,DSKY_HEXBUFLEN - LD HL,DSKY_BUF - LD DE,DSKY_HEXBUF -DSKY_HEXOUT1: +; HL: ADR OF 32 BIT BINARY +; DE: ADR OF DEST LED SEGMENT DISPLAY BUFFER (8 BYTES) +; +DSKY_BIN2SEG: + PUSH HL + PUSH DE + LD B,4 ; 4 BYTES OF INPUT + EX DE,HL +DSKY_BIN2SEG1: LD A,(DE) ; FIRST NIBBLE SRL A SRL A SRL A SRL A + PUSH HL + LD HL,DSKY_HEXMAP + CALL DSKY_ADDHLA + LD A,(HL) + POP HL LD (HL),A INC HL LD A,(DE) ; SECOND NIBBLE AND 0FH + PUSH HL + LD HL,DSKY_HEXMAP + CALL DSKY_ADDHLA + LD A,(HL) + POP HL LD (HL),A INC HL INC DE ; NEXT BYTE - DJNZ DSKY_HEXOUT1 - LD HL,DSKY_BUF - JR DSKY_SHOWHEX + DJNZ DSKY_BIN2SEG1 + POP DE + POP HL + RET ; ;================================================================================================== ; DSKY SHOW BUFFER ; HL: ADDRESS OF BUFFER -; ENTER @ SHOWHEX FOR HEX DECODING -; ENTER @ SHOWSEG FOR SEGMENT DECODING ;================================================================================================== ; -DSKY_SHOWHEX: - LD A,$D0 ; 7218 -> (DATA COMING, HEXA DECODE) - JR DSKY_SHOW -; -DSKY_SHOWSEG: - LD A,$F0 ; 7218 -> (DATA COMING, NO DECODE) - JR DSKY_SHOW -; DSKY_SHOW: - PUSH AF ; SAVE 7218 CONTROL BITS + ;;PUSH AF ; SAVE 7218 CONTROL BITS LD A,82H ; SETUP PPI OUT (PPIX),A CALL DSKY_COFF - POP AF + ;;POP AF + LD A,$F0 ; 7218 -> (DATA COMING, NO DECODE) OUT (PPIA),A CALL DSKY_STROBEC ; STROBE COMMAND LD B,DSKY_BUFLEN ; NUMBER OF DIGITS LD C,PPIA DSKY_HEXOUT2: - OUTI + ;OUTI + LD A,(HL) + XOR $80 ; FIX DOT POLARITY + OUT (C),A + INC HL + DEC B JP Z,DSKY_STROBE ; DO FINAL STROBE AND RETURN CALL DSKY_STROBE ; STROBE BYTE VALUE JR DSKY_HEXOUT2 @@ -296,30 +339,47 @@ DSKY_COFF: ; CALL DSKY_DELAY ; WAIT RET ; +;================================================================================================== +; UTILTITY FUNCTIONS +;================================================================================================== +; +DSKY_ADDHLA: + ADD A,L + LD L,A + RET NC + INC H + RET +; +;================================================================================================== +; STORAGE +;================================================================================================== +; ; CODES FOR NUMERICS -; HIGH BIT ALWAYS SET TO SUPPRESS DECIMAL POINT -; CLEAR HIGH BIT TO SHOW DECIMAL POINT -; -DSKY_NUMS: - .DB $FB ; 0 - .DB $B0 ; 1 - .DB $ED ; 2 - .DB $F5 ; 3 - .DB $B6 ; 4 - .DB $D7 ; 5 - .DB $DF ; 6 - .DB $F0 ; 7 - .DB $FF ; 8 - .DB $F7 ; 9 - .DB $FE ; A - .DB $9F ; B - .DB $CB ; C - .DB $BD ; D - .DB $CF ; E - .DB $CE ; F +; HIGH BIT ALWAYS CLEAR TO SUPPRESS DECIMAL POINT +; SET HIGH BIT TO SHOW DECIMAL POINT +; +DSKY_HEXMAP: + .DB $7B ; 0 + .DB $30 ; 1 + .DB $6D ; 2 + .DB $75 ; 3 + .DB $36 ; 4 + .DB $57 ; 5 + .DB $5F ; 6 + .DB $70 ; 7 + .DB $7F ; 8 + .DB $77 ; 9 + .DB $7E ; A + .DB $1F ; B + .DB $4B ; C + .DB $3D ; D + .DB $4F ; E + .DB $4E ; F ; ; SEG DISPLAY WORKING STORAGE ; +DSKY_PRESENT .DB 0 +; DSKY_BUF .FILL 8,0 DSKY_BUFLEN .EQU $ - DSKY_BUF DSKY_HEXBUF .FILL 4,0 diff --git a/Source/HBIOS/dskyng.asm b/Source/HBIOS/dskyng.asm new file mode 100644 index 00000000..fde11a51 --- /dev/null +++ b/Source/HBIOS/dskyng.asm @@ -0,0 +1,774 @@ +; +;================================================================================================== +; DSKYNG (DISPLAY AND KEYBOARD NEXT GENERATION) ROUTINES +;================================================================================================== +; +; A DSKYNG CAN SHARE A PPI BUS WITH EITHER A PPIDE OR PPISD. +; SEE PPI_BUS.TXT FOR MORE INFORMATION. +; +; LED SEGMENTS (BIT VALUES) +; +; +--01--+ +; 20 02 +; +--40--+ +; 10 04 +; +--08--+ 80 +; +; KEY CODE MAP (KEY CODES) CSCCCRRR +; |||||||| +; |||||+++-- ROW +; ||+++----- COL +; |+-------- SHIFT +; +--------- CONTROL +; +; 00 08 10 18 23 +; 01 09 11 19 22 +; 02 0A 12 1A 21 +; 03 0B 13 1B 20 +; 04 0C 14 1C SHIFT +; 05 0D 15 1D CTRL +; +; LED BIT MAP (BIT VALUES) +; +; $08 $09 $0A $0B $0C $0D $0E $0F +; --- --- --- --- --- --- --- --- +; 01 01 01 01 01 +; 02 02 02 02 02 +; 04 04 04 04 04 +; 08 08 08 08 08 +; 10 10 10 10 10 +; 20 20 20 20 20 L1 L2 BUZZ +; +PPIA .EQU DSKYPPIBASE + 0 ; PORT A +PPIB .EQU DSKYPPIBASE + 1 ; PORT B +PPIC .EQU DSKYPPIBASE + 2 ; PORT C +PPIX .EQU DSKYPPIBASE + 3 ; PPI CONTROL PORT +; +DSKY_PPIX_RD: .EQU %10010010 ; PPIX VALUE FOR READS +DSKY_PPIX_WR: .EQU %10000010 ; PPIX VALUE FOR WRITES +; +; PIO CHANNEL C: +; +; 7 6 5 4 3 2 1 0 +; RES 0 0 CS CS /RD /WR A0 +; +; SETTING BITS 3 & 4 WILL ASSERT /CS ON 3279 +; CLEAR BITS 1 OR 2 TO ASSERT READ/WRITE +; +DSKY_PPI_IDLE: .EQU %00000110 +; +DSKY_CMD_CLR: .EQU %11011111 ; CLEAR (ALL OFF) +DSKY_CMD_CLRX: .EQU %11010011 ; CLEAR (ALL ON) +DSKY_CMD_WDSP: .EQU %10010000 ; WRITE DISPLAY RAM +DSKY_CMD_RDSP: .EQU %01110000 ; READ DISPLAY RAM +DSKY_CMD_CLK: .EQU %00100000 ; SET CLK PRESCALE +DSKY_CMD_FIFO: .EQU %01000000 ; READ FIFO +; +DSKY_PRESCL: .EQU DSKYOSC/100000 ; PRESCALER +; +;__DSKY_PREINIT______________________________________________________________________________________ +; +; CONFIGURE PARALLEL PORT AND INITIALIZE 8279 +;____________________________________________________________________________________________________ +; +; +; HARDWARE RESET 8279 BY PULSING RESET LINE +; +DSKY_PREINIT: + ; CHECK FOR PPI + CALL DSKY_PPIDETECT ; TEST FOR PPI HARDWARE + RET NZ ; BAIL OUT IF NOT THERE + ; SETUP PPI TO DEFAULT MODE + CALL DSKY_PPIRD + ; INIT 8279 VALUES TO IDLE STATE + LD A,DSKY_PPI_IDLE + OUT (PPIC),A + ; PULSE RESET SIGNAL ON 8279 + SET 7,A + OUT (PPIC),A + RES 7,A + OUT (PPIC),A + ; INITIALIZE 8279 + CALL DSKY_REINIT + ; NOW SEE IF A DSKYNG IS REALLY THERE... + LD A,$A5 + LD (DSKY_BUF),A + LD HL,DSKY_BUF + LD C,0 + LD B,1 + CALL DSKY_PUTSTR + LD HL,DSKY_BUF + LD C,0 + LD B,1 + CALL DSKY_GETSTR + LD A,(DSKY_BUF) + CP $A5 + RET NZ ; BAIL OUT IF MISCOMPARE + LD A,$FF + LD (DSKY_PRESENT),A + RET +; +DSKY_REINIT: + CALL DSKY_PPIIDLE + ; SET CLOCK SCALER TO 20 + LD A,DSKY_CMD_CLK | DSKY_PRESCL + CALL DSKY_CMD + ; FALL THRU +; +DSKY_RESET: + ; RESET DSKY -- CLEAR RAM AND FIFO + LD A,DSKY_CMD_CLR + CALL DSKY_CMD +; + ; 8259 TAKES ~160US TO CLEAR RAM DURING WHICH TIME WRITES TO + ; DISPLAY RAM ARE INHIBITED. HIGH BIT OF STATUS BYTE IS SET + ; DURING THIS WINDOW. TO PREVENT A DEADLOCK, A LOOP COUNTER + ; IS USED TO IMPLEMENT A TIMEOUT. + LD B,0 ; TIMEOUT LOOP COUNTER +DSKY_RESET1: + PUSH BC ; SAVE COUNTER + CALL DSKY_ST ; GET STATUS BYTE + POP BC ; RECOVER COUNTER + BIT 7,A ; BIT 7 IS DISPLAY RAM BUSY + JR Z,DSKY_RESET2 ; MOVE ON IF DONE + DJNZ DSKY_RESET1 ; LOOP TILL TIMEOUT +; +DSKY_RESET2: + RET +; +;__DSKY_INIT_________________________________________________________________________________________ +; +; DISPLAY DSKY INFO +;____________________________________________________________________________________________________ +; +#IFDEF HBIOS +; +DSKY_INIT: + CALL NEWLINE ; FORMATTING + PRTS("DSKY:$") ; FORMATTING +; + PRTS(" IO=0x$") ; FORMATTING + LD A,DSKYPPIBASE ; GET BASE PORT + CALL PRTHEXBYTE ; PRINT BASE PORT + PRTS(" MODE=$") ; FORMATTING + PRTS("NG$") ; PRINT DSKY TYPE +; + LD A,(DSKY_PRESENT) ; PRESENT? + OR A ; SET FLAGS + RET NZ ; YES, ALL DONE + PRTS(" NOT PRESENT$") ; NOT PRESENT + RET ; DONE +; +#ENDIF +; +;__DSKY_PPIDETECT____________________________________________________________________________________ +; +; PROBE FOR PPI HARDWARE +;____________________________________________________________________________________________________ +; +DSKY_PPIDETECT: +; + ; TEST FOR PPI EXISTENCE + ; WE SETUP THE PPI TO WRITE, THEN WRITE A VALUE OF ZERO + ; TO PORT A (DATALO), THEN READ IT BACK. IF THE PPI IS THERE + ; THEN THE BUS HOLD CIRCUITRY WILL READ BACK THE ZERO. SINCE + ; WE ARE IN WRITE MODE, AN IDE CONTROLLER WILL NOT BE ABLE TO + ; INTERFERE WITH THE VALUE BEING READ. + CALL DSKY_PPIWR +; + LD C,PPIA ; PPI PORT A + XOR A ; VALUE ZERO + OUT (C),A ; PUSH VALUE TO PORT + IN A,(C) ; GET PORT VALUE + OR A ; SET FLAGS + RET ; AND RETURN +; +#IFDEF DSKY_KBD +; +KY_0 .EQU $00 +KY_1 .EQU $01 +KY_2 .EQU $02 +KY_3 .EQU $03 +KY_4 .EQU $04 +KY_5 .EQU $05 +KY_6 .EQU $06 +KY_7 .EQU $07 +KY_8 .EQU $08 +KY_9 .EQU $09 +KY_A .EQU $0A +KY_B .EQU $0B +KY_C .EQU $0C +KY_D .EQU $0D +KY_E .EQU $0E +KY_F .EQU $0F +KY_FW .EQU $10 ; FORWARD +KY_BK .EQU $11 ; BACKWARD +KY_CL .EQU $12 ; CLEAR +KY_EN .EQU $13 ; ENTER +KY_DE .EQU $14 ; DEPOSIT +KY_EX .EQU $15 ; EXAMINE +KY_GO .EQU $16 ; GO +KY_BO .EQU $17 ; BOOT +KY_F4 .EQU $18 ; F4 +KY_F3 .EQU $19 ; F3 +KY_F2 .EQU $20 ; F2 +KY_F1 .EQU $21 ; F1 +; +;__DSKY_STAT_________________________________________________________________________________________ +; +; CHECK FOR KEY PRESS, SAVE RAW VALUE, RETURN STATUS +;____________________________________________________________________________________________________ +; +DSKY_STAT: + LD A,(DSKY_PRESENT) ; DOES IT EXIST? + OR A ; SET FLAGS + RET Z ; ABORT WITH A=0 IF NOT THERE + CALL DSKY_ST + AND $0F ; ISOLATE THE CUR FIFO LEN + RET +; +;__DSKY_GETKEY_____________________________________________________________________________________ +; +; WAIT FOR A DSKY KEYPRESS AND RETURN +;____________________________________________________________________________________________________ +; +DSKY_GETKEY: + LD A,(DSKY_PRESENT) ; DOES IT EXIST? + OR A ; SET FLAGS + JR Z,DSKY_GETKEY1A ; ABORT IF NOT PRESENT + CALL DSKY_STAT + JR Z,DSKY_GETKEY ; LOOP IF NOTHING THERE + LD A,DSKY_CMD_FIFO + CALL DSKY_CMD + CALL DSKY_DIN + XOR %11000000 ; FLIP POLARITY OF SHIFT/CTL BITS + PUSH AF ; SAVE VALUE + AND $3F ; STRIP SHIFT/CTL BITS FOR LOOKUP + LD B,28 ; SIZE OF DECODE TABLE + LD C,0 ; INDEX + LD HL,DSKY_KEYMAP ; POINT TO BEGINNING OF TABLE +DSKY_GETKEY1: + CP (HL) ; MATCH? + JR Z,DSKY_GETKEY2 ; FOUND, DONE + INC HL + INC C ; BUMP INDEX + DJNZ DSKY_GETKEY1 ; LOOP UNTIL EOT + POP AF ; FIX STACK +DSKY_GETKEY1A: + LD A,$FF ; NOT FOUND ERR, RETURN $FF + RET +DSKY_GETKEY2: + ; RETURN THE INDEX POSITION WHERE THE SCAN CODE WAS FOUND + ; THE ORIGINAL SHIFT/CTRL BITS ARE RESTORED + POP AF ; RESTORE RAW VALUE + AND %11000000 ; ISOLATE SHIFT/CTRL BITS + OR C ; COMBINE WITH INDEX VALUE + RET +; +;_KEYMAP_TABLE_____________________________________________________________________________________________________________ +; +DSKY_KEYMAP: + ; POS $00 $01 $02 $03 $04 $05 $06 $07 + ; KEY [0] [1] [2] [3] [4] [5] [6] [7] + .DB $0D, $04, $0C, $14, $03, $0B, $13, $02 +; + ; POS $08 $09 $0A $0B $0C $0D $0E $0F + ; KEY [8] [9] [A] [B] [C] [D] [E] [F] + .DB $0A, $12, $01, $09, $11, $00, $08, $10 +; + ; POS $10 $11 $12 $13 $14 $15 $16 $17 + ; KEY [FW] [BK] [CL] [EN] [DE] [EX] [GO] [BO] + .DB $05, $15, $1D, $1C, $1B, $1A, $19, $18 + + ; POS $18 $19 $20 $21 + ; KEY [F4] [F3] [F2] [F1] + .DB $23, $22, $21, $20 + +; +#ENDIF ; DSKY_KBD +; +;================================================================================================== +; CONVERT 32 BIT BINARY TO 8 BYTE HEX SEGMENT DISPLAY +;================================================================================================== +; +; HL: ADR OF 32 BIT BINARY +; DE: ADR OF DEST LED SEGMENT DISPLAY BUFFER (8 BYTES) +; +DSKY_BIN2SEG: + PUSH HL + PUSH DE + LD B,4 ; 4 BYTES OF INPUT + EX DE,HL +DSKY_BIN2SEG1: + LD A,(DE) ; FIRST NIBBLE + SRL A + SRL A + SRL A + SRL A + PUSH HL + LD HL,DSKY_HEXMAP + CALL DSKY_ADDHLA + LD A,(HL) + POP HL + LD (HL),A + INC HL + LD A,(DE) ; SECOND NIBBLE + AND 0FH + PUSH HL + LD HL,DSKY_HEXMAP + CALL DSKY_ADDHLA + LD A,(HL) + POP HL + LD (HL),A + INC HL + INC DE ; NEXT BYTE + DJNZ DSKY_BIN2SEG1 + POP DE + POP HL + RET +; +;================================================================================================== +; DSKY SHOW BUFFER +; HL: ADDRESS OF BUFFER +;================================================================================================== +; +DSKY_SHOW: + LD C,0 ; STARTING DISPLAY POSITION + LD B,DSKY_BUFLEN ; NUMBER OF CHARS + JP DSKY_PUTSTR +; +;================================================================================================== +; DSKYNG OUTPUT ROUTINES +;================================================================================================== +; +; SEND DSKY COMMAND BYTE IN REGISTER A +; TRASHES BC +; +DSKY_CMD: + LD B,$01 + JR DSKY_DOUT2 +; +; SEND DSKY DATA BYTE IN REGISTER A +; TRASHES BC +; +DSKY_DOUT: + LD B,$00 +; +DSKY_DOUT2: +; + ; SAVE INCOMING DATA BYTE + PUSH AF +; + ; SET PPI LINE CONFIG TO WRITE MODE + CALL DSKY_PPIWR +; + ; SETUP + LD C,PPIC +; + ; SET ADDRESS FIRST + LD A,DSKY_PPI_IDLE + OR B + OUT (C),A +; + ; ASSERT 8279 /CS + SET 3,A + SET 4,A + OUT (C),A +; + ; PPIC WORKING VALUE TO REG B NOW + LD B,A +; + ; ASSERT DATA BYTE VALUE + POP AF + OUT (PPIA),A +; + ; PULSE /WR + RES 1,B + OUT (C),B + NOP ; MAY NOT BE NEEDED + SET 1,B + OUT (C),B +; + ; DEASSERT /CS + RES 3,B + RES 4,B + OUT (C),B +; + ; CLEAR ADDRESS BIT + RES 0,B + OUT (C),B +; + ; DONE + CALL DSKY_PPIIDLE + RET +; +;================================================================================================== +; DSKYNG OUTPUT ROUTINES +;================================================================================================== +; +; RETURN DSKY STATUS VALUE IN A +; TRASHES BC +; +DSKY_ST: + LD B,$01 + JR DSKY_DIN2 +; +; RETURN NEXT DATA VALUE IN A +; TRASHES BC +; +DSKY_DIN: + LD B,$00 +; +DSKY_DIN2: + ; SET PPI LINE CONFIG TO READ MODE + CALL DSKY_PPIRD +; + ; SETUP + LD C,PPIC +; + ; SET ADDRESS FIRST + LD A,DSKY_PPI_IDLE + OR B + OUT (C),A +; + ; ASSERT 8279 /CS + SET 3,A + SET 4,A + OUT (C),A +; + ; PPIC WORKING VALUE TO REG B NOW + LD B,A +; + ; ASSERT /RD + RES 2,B + OUT (C),B +; + ; GET VALUE + IN A,(PPIA) +; + ; DEASSERT /RD + SET 2,B + OUT (C),B +; + ; DEASSERT /CS + RES 3,B + RES 4,B + OUT (C),B +; + ; CLEAR ADDRESS BIT + RES 0,B + OUT (C),B +; + ; DONE + CALL DSKY_PPIIDLE + RET +; +;================================================================================================== +; DSKYNG UTILITY ROUTINES +;================================================================================================== +; +; BLANK DSKYNG DISPLAY (WITHOUT USING CLEAR) +; +DSKY_BLANK: + LD A,DSKY_CMD_WDSP + CALL DSKY_CMD + LD B,16 +DSKY_BLANK1: + PUSH BC + LD A,$FF + CALL DSKY_DOUT + POP BC + DJNZ DSKY_BLANK1 + RET +; +; WRITE A RAW BYTE VALUE TO DSKY DISPLAY RAM +; AT LOCATION IN REGISTER C, VALUE IN A. +; +DSKY_PUTBYTE: + PUSH BC + PUSH AF + LD A,C + ADD A,DSKY_CMD_WDSP + CALL DSKY_CMD + POP AF + XOR $FF + CALL DSKY_DOUT + POP BC + RET +; +; READ A RAW BYTE VALUE FROM DSKY DISPLAY RAM +; AT LOCATION IN REGISTER C, VALUE RETURNED IN A +; +DSKY_GETBYTE: + PUSH BC + LD A,C + ADD A,DSKY_CMD_RDSP + CALL DSKY_CMD + CALL DSKY_DIN + XOR $FF + POP BC + RET +; +; WRITE A STRING OF RAW BYTE VALUES TO DSKY DISPLAY RAM +; AT LOCATION IN REGISTER C, LENGTH IN B, ADDRESS IN HL. +; +DSKY_PUTSTR: + PUSH BC + LD A,C + ADD A,DSKY_CMD_WDSP + CALL DSKY_CMD + POP BC +; +DSKY_PUTSTR1: + LD A,(HL) + XOR $FF + INC HL + PUSH BC + CALL DSKY_DOUT + POP BC + DJNZ DSKY_PUTSTR1 + RET +; +; READ A STRING OF RAW BYTE VALUES FROM DSKY DISPLAY RAM +; AT LOCATION IN REGISTER C, LENGTH IN B, ADDRESS IN HL. +; +DSKY_GETSTR: + PUSH BC + LD A,C + ADD A,DSKY_CMD_RDSP + CALL DSKY_CMD + POP BC +; +DSKY_GETSTR1: + PUSH BC + CALL DSKY_DIN + POP BC + XOR $FF + LD (HL),A + INC HL + DJNZ DSKY_GETSTR1 + RET +; +; This function is intended to update the LEDs. It expects 8 bytes +; following the call, and updates the entire matrix. +; +; EXAMPLE: +; CALL DSKY_PUTLED +; .DB $00,$00,$00,$00,$00,$00,$00,$00 +; +DSKY_PUTLED: + EX (SP),HL + PUSH AF + PUSH BC + LD C,8 +DSKY_PUTLED_1: + LD A,(HL) + PUSH BC + CALL DSKY_PUTBYTE + POP BC + INC C + INC HL + LD A,C + CP $10 + JP NZ,DSKY_PUTLED_1 + POP BC + POP AF + EX (SP),HL + RET +; +; This function is intended to beep the speaker on the DSKY +; +DSKY_BEEP: + PUSH AF + PUSH BC + + LD C,$0F + CALL DSKY_GETBYTE + OR $20 + LD C,$0F + CALL DSKY_PUTBYTE + +;;; timer . . . + PUSH HL + LD hl,$8FFF +DSKY_BEEP1: + DEC HL + LD A,H + CP 0 + JP NZ,DSKY_BEEP1 + POP HL + + LD C,$0F + CALL DSKY_GETBYTE + AND $DF + LD C,$0F + CALL DSKY_PUTBYTE + + POP BC + POP AF + RET +; +; This function is intended to turn on DSKY L1 +; +DSKY_L1ON: + PUSH AF + PUSH BC + + LD C,$0D + CALL DSKY_GETBYTE + OR $20 + LD C,$0D + CALL DSKY_PUTBYTE + + POP BC + POP AF + RET +; +; This function is intended to turn on DSKY L2 +; +DSKY_L2ON: + PUSH AF + PUSH BC + + LD C,$0E + CALL DSKY_GETBYTE + OR $20 + LD C,$0E + CALL DSKY_PUTBYTE + + POP BC + POP AF + RET +; +; This function is intended to turn off DSKY L1 +; +DSKY_L1OFF: + PUSH AF + PUSH BC + + LD C,$0D + CALL DSKY_GETBYTE + AND $DF + LD C,$0D + CALL DSKY_PUTBYTE + + POP BC + POP AF + RET +; +; This function is intended to turn off DSKY L2 +; +DSKY_L2OFF: + PUSH AF + PUSH BC + + LD C,$0E + CALL DSKY_GETBYTE + AND $DF + LD C,$0E + CALL DSKY_PUTBYTE + + POP BC + POP AF + RET +; +;================================================================================================== +; DSKYNG LINE CONTROL ROUTINES +;================================================================================================== +; +; SETUP PPI FOR WRITING: PUT PPI PORT A IN OUTPUT MODE +; AVOID REWRTING PPIX IF ALREADY IN OUTPUT MODE +; +DSKY_PPIWR: + PUSH AF +; + ; CHECK FOR WRITE MODE + LD A,(DSKY_PPIX_VAL) + CP DSKY_PPIX_WR + JR Z,DSKY_PPIWR1 +; + ; SET PPI TO WRITE MODE + LD A,DSKY_PPIX_WR + OUT (PPIX),A + LD (DSKY_PPIX_VAL),A +; + ; RESTORE PORT C (MAY NOT BE NEEDED) + LD A,DSKY_PPI_IDLE + OUT (PPIC),A +; +DSKY_PPIWR1: +; + POP AF + RET +; +; SETUP PPI FOR READING: PUT PPI PORT A IN INPUT MODE +; AVOID REWRTING PPIX IF ALREADY IN INPUT MODE +; +DSKY_PPIRD: + PUSH AF +; + ; CHECK FOR READ MODE + LD A,(DSKY_PPIX_VAL) + CP DSKY_PPIX_RD + JR Z,DSKY_PPIRD1 +; + ; SET PPI TO READ MODE + LD A,DSKY_PPIX_RD + OUT (PPIX),A + LD (DSKY_PPIX_VAL),A +; +DSKY_PPIRD1: + POP AF + RET +; +; RELEASE USE OF PPI +; +DSKY_PPIIDLE: + JR DSKY_PPIRD ; SAME AS READ MODE +; +;================================================================================================== +; UTILTITY FUNCTIONS +;================================================================================================== +; +DSKY_ADDHLA: + ADD A,L + LD L,A + RET NC + INC H + RET +; +;================================================================================================== +; STORAGE +;================================================================================================== +; +; CODES FOR NUMERICS +; HIGH BIT ALWAYS CLEAR TO SUPPRESS DECIMAL POINT +; SET HIGH BIT TO SHOW DECIMAL POINT +; +DSKY_HEXMAP: + .DB $3F ; 0 + .DB $06 ; 1 + .DB $5B ; 2 + .DB $4F ; 3 + .DB $66 ; 4 + .DB $6D ; 5 + .DB $7D ; 6 + .DB $07 ; 7 + .DB $7F ; 8 + .DB $67 ; 9 + .DB $77 ; A + .DB $7C ; B + .DB $39 ; C + .DB $5E ; D + .DB $79 ; E + .DB $71 ; F +; +DSKY_PPIX_VAL: .DB 0 +DSKY_PRESENT: .DB 0 +; +; SEG DISPLAY WORKING STORAGE +; +DSKY_BUF .FILL 8,0 +DSKY_BUFLEN .EQU $ - DSKY_BUF +DSKY_HEXBUF .FILL 4,0 +DSKY_HEXBUFLEN .EQU $ - DSKY_HEXBUF diff --git a/Source/HBIOS/dsrtc.asm b/Source/HBIOS/dsrtc.asm index 7fa819db..be29dc5e 100644 --- a/Source/HBIOS/dsrtc.asm +++ b/Source/HBIOS/dsrtc.asm @@ -63,29 +63,35 @@ ; ; CONSTANTS ; -; RTC SBC SBC-004 MFPIC N8 N8-CSIO SC -; ----- ------- ------- ------- ------- ------- ------- -; D7 WR RTC_OUT RTC_OUT -- RTC_OUT RTC_OUT RTC_OUT, I2C_SDA -; D6 WR RTC_CLK RTC_CLK -- RTC_CLK RTC_CLK RTC_CLK -; D5 WR /RTC_WE /RTC_WE -- /RTC_WE /RTC_WE /RTC_WE -; D4 WR RTC_CE RTC_CE -- RTC_CE RTC_CE RTC_CE -; D3 WR NC SPK /RTC_CE NC NC /SPI_CS2 -; D2 WR NC CLKHI RTC_CLK SPI_CS SPI_CS /SPI_CS1 -; D1 WR -- -- RTC_WE SPI_CLK NC FS -; D0 WR -- -- RTC_OUT SPI_DI NC I2C_SCL -; -; D7 RD -- -- -- -- -- I2C_SDA -; D6 RD CFG CFG -- SPI_DO CFG -- -; D5 RD -- -- -- -- -- -- -; D4 RD -- -- -- -- -- -- -; D3 RD -- -- -- -- -- -- -; D2 RD -- -- -- -- -- -- -; D1 RD -- -- -- -- -- -- -; D0 RD RTC_IN RTC_IN RTC_IN RTC_IN RTC_IN RTC_IN +; RTC LATCH WRITE +; --------------- +; +; BIT SBC SBC-004 MFPIC N8 N8-CSIO MK4 SC130 SC131 SC126 MBC RPH +; ----- ------- ------- ------- ------- ------- ------- ------- ------- --------------- ------- ------- +; D7 RTC_OUT RTC_OUT -- RTC_OUT RTC_OUT RTC_OUT -- -- RTC_OUT,I2C_SDA RTC_OUT RTC_OUT +; D6 RTC_CLK RTC_CLK -- RTC_CLK RTC_CLK RTC_CLK -- -- RTC_CLK RTC_CLK RTC_CLK +; D5 /RTC_WE /RTC_WE -- /RTC_WE /RTC_WE /RTC_WE -- -- /RTC_WE /RTC_WE /RTC_WE +; D4 RTC_CE RTC_CE -- RTC_CE RTC_CE RTC_CE -- -- RTC_CE RTC_CE RTC_CE +; D3 NC CLKSEL /RTC_CE NC NC NC -- -- /SPI_CS2 CLKSEL -- +; D2 NC SPK RTC_CLK SPI_CS SPI_CS NC /SPI_CS1/SPI_CS1/SPI_CS1 SPK -- +; D1 -- -- RTC_WE SPI_CLK NC NC -- -- FS LED1 -- +; D0 -- -- RTC_OUT SPI_DI NC NC -- -- I2C_SCL LED0 -- +; +; RTC LATCH READ +; -------------- +; +; D7 -- -- -- -- -- -- -- -- I2C_SDA -- -- +; D6 CFG CFG -- SPI_DO CFG -- -- -- -- CFG -- +; D5 -- -- -- -- -- -- -- -- -- -- -- +; D4 -- -- -- -- -- -- -- -- -- -- -- +; D3 -- -- -- -- -- -- -- -- -- -- -- +; D2 -- -- -- -- -- -- -- -- -- -- -- +; D1 ---- -- -- -- -- -- -- -- -- CLKSEL -- +; D0 RTC_IN RTC_IN RTC_IN RTC_IN RTC_IN RTC_IN -- -- RTC_IN RTC_IN RTC_IN ; #IF (DSRTCMODE == DSRTCMODE_STD) ; -DSRTC_BASE .EQU RTCIO ; RTC PORT +DSRTC_IO .EQU RTCIO ; RTC PORT ; DSRTC_DATA .EQU %10000000 ; BIT 7 IS RTC DATA OUT DSRTC_CLK .EQU %01000000 ; BIT 6 IS RTC CLOCK (CLK) @@ -95,6 +101,10 @@ DSRTC_CE .EQU %00010000 ; BIT 4 IS CHIP ENABLE (CE) DSRTC_MASK .EQU %11110000 ; MASK FOR BITS WE OWN IN RTC LATCH PORT DSRTC_IDLE .EQU %00100000 ; QUIESCENT STATE ; +RTCDEF .SET RTCDEF | DSRTC_IDLE ; FOR HBIOS MAINLINE +; +#DEFINE DSRTC_OPRVAL HB_RTCVAL +; ; VALUES FOR DIFFERENT BATTERY OR SUPERCAPACITOR CHARGE RATES ; DS1d2k .EQU %10100101 ; 1 DIODE 2K RESISTOR (DEFAULT) @@ -108,7 +118,7 @@ DS2d8k .EQU %10101011 ; 2 DIODES 8K RESISTOR ; #IF (DSRTCMODE == DSRTCMODE_MFPIC) ; -DSRTC_BASE .EQU $43 ; RTC PORT ON MF/PIC +DSRTC_IO .EQU $13 ; RTC PORT ON MF/PIC ; DSRTC_DATA .EQU %00000001 ; BIT 0 IS RTC DATA OUT DSRTC_CLK .EQU %00000100 ; BIT 2 IS RTC CLOCK (CLK) @@ -116,7 +126,9 @@ DSRTC_WR .EQU %00000010 ; BIT 1 IS DATA DIRECTION (WE) DSRTC_CE .EQU %00001000 ; BIT 3 CHIP ENABLE (/CE) ; DSRTC_MASK .EQU %00001111 ; MASK FOR BITS WE OWN IN RTC LATCH PORT -DSRTC_IDLE .EQU %00101000 ; QUIESCENT STATE +DSRTC_IDLE .EQU %00001000 ; QUIESCENT STATE +; +#DEFINE DSRTC_OPRVAL DSRTC_RTCVAL ; #ENDIF ; @@ -126,12 +138,12 @@ DSRTC_BUFSIZ .EQU 7 ; 7 BYTE BUFFER (YYMMDDHHMMSSWW) ; DSRTC_PREINIT: ; - ; SET RELEVANT BITS IN RTC LATCH SHADOW REGISTER - ; TO THEIR QUIESENT STATE - LD A,(RTCVAL) ; GET CURRENT SHADOW REG VAL - AND DSRTC_MASK ; CLEAR OUR BITS - OR DSRTC_IDLE ; SET OUR IDLE BITS - LD (RTCVAL),A ; SAVE IT + ;; SET RELEVANT BITS IN RTC LATCH SHADOW REGISTER + ;; TO THEIR QUIESENT STATE + ;LD A,(DSRTC_OPRVAL) ; GET CURRENT SHADOW REG VAL + ;AND ~DSRTC_MASK ; CLEAR OUR BITS + ;OR DSRTC_IDLE ; SET OUR IDLE BITS + ;LD (DSRTC_OPRVAL),A ; SAVE IT ; CALL DSRTC_DETECT ; HARDWARE DETECTION LD (DSRTC_STAT),A ; SAVE RESULT @@ -153,6 +165,10 @@ DSRTC_PREINIT1: ; RTC DEVICE INITIALIZATION ENTRY ; DSRTC_INIT: + LD A,(RTC_DISPACT) ; RTC DISPATCHER ALREADY SET? + OR A ; SET FLAGS + RET NZ ; IF ALREADY ACTIVE, ABORT +; CALL NEWLINE ; FORMATTING PRTS("DSRTC: MODE=$") ; @@ -165,7 +181,7 @@ DSRTC_INIT: ; ; PRINT RTC LATCH PORT ADDRESS PRTS(" IO=0x$") ; LABEL FOR IO ADDRESS - LD A,DSRTC_BASE ; GET IO ADDRESS + LD A,DSRTC_IO ; GET IO ADDRESS CALL PRTHEXBYTE ; PRINT IT ; ; CHECK PRESENCE STATUS @@ -185,7 +201,7 @@ DSRTC_INIT1: CALL DSRTC_CLK2TIM LD HL,DSRTC_TIMBUF CALL PRTDT -; +; #IF DSRTCCHG ; FORCE_RTC_CHARGE_ENABLE LD C,$90 ; ACCESS CHARGE REGISTER LD E,DS1d2k ; STD CHARGE VALUES @@ -200,6 +216,10 @@ DSRTC_INIT1: NOCHG1: PRTS("OFF$") NOCHG2: +; + LD BC,DSRTC_DISPATCH + CALL RTC_SETDISP +; XOR A ; SIGNAL SUCCESS RET ; @@ -220,14 +240,24 @@ DSRTC_DISPATCH: DEC A JP Z,DSRTC_GETBLK ; GET NVRAM DATA BLOCK VALUES DEC A - JP Z,DSRTC_SETBLK ; SET NVRAM DATA BLOCK VALUES - CALL PANIC + JP Z,DSRTC_SETBLK ; SET NVRAM DATA BLOCK VALUES + DEC A + JP Z,DSRTC_GETALM ; GET ALARM + DEC A + JP Z,DSRTC_SETALM ; SET ALARM + DEC A + JP Z,DSRTC_DEVICE ; REPORT RTC DEVICE INFO + SYSCHKERR(ERR_NOFUNC) + RET ; ; NVRAM FUNCTIONS ARE NOT AVAILABLE IN SIMULATOR ; DSRTC_GETBLK: DSRTC_SETBLK: - CALL PANIC +DSRTC_GETALM: +DSRTC_SETALM: + SYSCHKERR(ERR_NOTIMPL) + RET ; ; RTC GET TIME ; A: RESULT (OUT), 0=OK, Z=OK, NZ=ERR @@ -336,6 +366,16 @@ DSRTC_SETBYT: XOR A ; SIGNAL SUCCESS RET ; DONE ; +; REPORT RTC DEVICE INFO +; +DSRTC_DEVICE: + LD D,RTCDEV_DS ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL DEVICE NUMBER + LD H,DSRTCMODE ; H := MODE + LD L,DSRTC_IO ; L := BASE I/O ADDRESS + XOR A ; SIGNAL SUCCESS + RET +; ; CONVERT DATA IN CLOCK BUFFER TO TIME BUFFER AT HL ; DSRTC_CLK2TIM: @@ -355,7 +395,7 @@ DSRTC_CLK2TIM: LD (HL),A INC HL LD A,(DSRTC_SEC) - LD (HL),A + LD (HL),A RET ; ; CONVERT DATA IN TIME BUFFER AT HL TO CLOCK BUFFER @@ -393,20 +433,20 @@ DSRTC_TSTCHG: LD A,E ; VALUE TO A AND %11110000 ; CHECK FOR CP %10100000 ; ... ENABLED FLAG - RET + RET ; ; DETECT RTC HARDWARE PRESENCE ; DSRTC_DETECT: - LD C,31 ; NVRAM INDEX 31 + LD C,30 ; NVRAM INDEX 30 CALL DSRTC_GETBYT ; GET VALUE LD A,E ; TO ACCUM LD (DSRTC_TEMP),A ; SAVE IT XOR $FF ; FLIP ALL BITS LD E,A ; TO E - LD C,31 ; NVRAM INDEX 31 + LD C,30 ; NVRAM INDEX 30 CALL DSRTC_SETBYT ; WRITE IT - LD C,31 ; NVRAM INDEX 31 + LD C,30 ; NVRAM INDEX 30 CALL DSRTC_GETBYT ; GET VALUE LD A,(DSRTC_TEMP) ; GET SAVED VALUE XOR $FF ; FLIP ALL BITS @@ -417,7 +457,7 @@ DSRTC_DETECT: DSRTC_DETECT1: PUSH AF ; SAVE STATUS LD A,(DSRTC_TEMP) ; GET SAVED VALUE - LD C,31 ; NVRAM INDEX 31 + LD C,30 ; NVRAM INDEX 30 CALL DSRTC_SETBYT ; SAVE IT POP AF ; RECOVER STATUS OR A ; SET FLAGS @@ -440,6 +480,7 @@ DSRTC_TSTCLK: ; E=VALUE (OUTPUT) ; DSRTC_RDBYT: + CALL DSRTC_START LD E,C CALL DSRTC_CMD CALL DSRTC_GET @@ -451,6 +492,7 @@ DSRTC_RDBYT: ; E=VALUE ; DSRTC_WRBYT: + CALL DSRTC_START PUSH DE ; SAVE VALUE TO WRITE LD E,C ; CMD TO E CALL DSRTC_CMD @@ -466,7 +508,7 @@ DSRTC_WRBYT: DSRTC_WRBYTWP: LD D,C ; WRITE CMD TO D PUSH DE ; SAVE PARMS -; +; ; TURN OFF WRITE PROTECT LD C,$8E ; CMD LD E,0 ; WRITE PROTECT OFF @@ -477,7 +519,7 @@ DSRTC_WRBYTWP: LD C,D ; WRITE CMD BACK TO C CALL DSRTC_WRBYT ; DO IT ; - ; TURN WRITE PROTECT BACK ON + ; TURN WRITE PROTECT BACK ON LD C,$8E ; WRITE CMD TO D LD E,$80 ; WRITE PROTECT ON CALL DSRTC_WRBYT ; DO IT @@ -487,6 +529,7 @@ DSRTC_WRBYTWP: ; BURST READ CLOCK DATA INTO BUFFER AT HL ; DSRTC_RDCLK: + CALL DSRTC_START LD E,$BF ; COMMAND = $BF TO BURST READ CLOCK CALL DSRTC_CMD ; SEND COMMAND TO RTC LD B,DSRTC_BUFSIZ ; B IS LOOP COUNTER @@ -502,6 +545,7 @@ DSRTC_RDCLK1: ; BURST WRITE CLOCK DATA FROM BUFFER AT HL ; DSRTC_WRCLK: + CALL DSRTC_START LD E,$8E ; COMMAND = $8E TO WRITE CONTROL REGISTER CALL DSRTC_CMD ; SEND COMMAND LD E,$00 ; $00 = UNPROTECT @@ -539,15 +583,15 @@ DSRTC_WRCLK1: ; 5) PUT COMMAND ; DSRTC_CMD: - LD A,(RTCVAL) ; INIT A WITH QUIESCENT STATE - OUT (DSRTC_BASE),A ; WRITE TO PORT + LD A,(DSRTC_OPRVAL) ; INIT A WITH QUIESCENT STATE + OUT (DSRTC_IO),A ; WRITE TO PORT CALL DLY2 ; DELAY 2 * 27 T-STATES #IF (DSRTCMODE == DSRTCMODE_MFPIC) AND ~DSRTC_CE ; ASSERT CE (LOW) #ELSE OR DSRTC_CE ; ASSERT CE (HIGH) #ENDIF - OUT (DSRTC_BASE),A ; WRITE TO RTC PORT + OUT (DSRTC_IO),A ; WRITE TO RTC PORT CALL DLY2 ; DELAY 2 * 27 T-STATES CALL DSRTC_PUT ; WRITE IT RET @@ -575,9 +619,9 @@ DSRTC_PUT: #ENDIF DSRTC_PUT1: AND ~DSRTC_CLK ; SET CLOCK LOW - OUT (DSRTC_BASE),A ; DO IT + OUT (DSRTC_IO),A ; DO IT CALL DLY1 ; DELAY 27 T-STATES - + #IF (DSRTCMODE == DSRTCMODE_MFPIC) RRA ; PREP ACCUM TO GET DATA BIT IN CARRY RR E ; ROTATE NEXT BIT TO SEND INTO CARRY @@ -586,10 +630,10 @@ DSRTC_PUT1: RLA ; PREP ACCUM TO GET DATA BIT IN CARRY RR E ; ROTATE NEXT BIT TO SEND INTO CARRY RRA ; ROTATE BITS BACK TO CORRECT POSTIIONS -#ENDIF - OUT (DSRTC_BASE),A ; ASSERT DATA BIT ON BUS +#ENDIF + OUT (DSRTC_IO),A ; ASSERT DATA BIT ON BUS OR DSRTC_CLK ; SET CLOCK HI - OUT (DSRTC_BASE),A ; DO IT + OUT (DSRTC_IO),A ; DO IT CALL DLY1 ; DELAY 27 T-STATES DJNZ DSRTC_PUT1 ; LOOP IF NOT DONE RET @@ -618,18 +662,37 @@ DSRTC_GET: #ENDIF DSRTC_GET1: AND ~DSRTC_CLK ; SET CLK LO - OUT (DSRTC_BASE),A ; WRITE TO RTC PORT + OUT (DSRTC_IO),A ; WRITE TO RTC PORT CALL DLY1 ; DELAY 2 * 27 T-STATES PUSH AF ; SAVE PORT VALUE - IN A,(DSRTC_BASE) ; READ THE RTC PORT + IN A,(DSRTC_IO) ; READ THE RTC PORT RRA ; DATA BIT TO CARRY RR E ; SHIFT INTO WORKING VALUE POP AF ; RESTORE PORT VALUE OR DSRTC_CLK ; CLOCK BACK TO HI - OUT (DSRTC_BASE),A ; WRITE TO RTC PORT + OUT (DSRTC_IO),A ; WRITE TO RTC PORT CALL DLY1 ; DELAY 27 T-STATES DJNZ DSRTC_GET1 ; LOOP IF NOT DONE (13) RET + + +; +; START A COMMAND SEQUENCE +; INITIATES A COMMAND SEQUENCE +; DOES NOT DESTROY ANY REGISTERS. +; +; 1) CAPTURE RTC LATCH BITS +; +DSRTC_START: + ; SET RELEVANT BITS IN RTC LATCH SHADOW REGISTER + ; TO THEIR QUIESENT STATE + PUSH AF + LD A,(DSRTC_OPRVAL) ; GET CURRENT SHADOW REG VAL + AND ~DSRTC_MASK ; CLEAR OUR BITS + OR DSRTC_IDLE ; SET OUR IDLE BITS + LD (DSRTC_OPRVAL),A ; SAVE IT + POP AF + RET ; ; COMPLETE A COMMAND SEQUENCE ; FINISHES UP A COMMAND SEQUENCE. @@ -638,8 +701,10 @@ DSRTC_GET1: ; 1) SET ALL LINES BACK TO QUIESCENT STATE ; DSRTC_END: - LD A,(RTCVAL) ; INIT A WITH QUIESCENT STATE - OUT (DSRTC_BASE),A ; WRITE TO PORT + ;PUSH AF + LD A,(DSRTC_OPRVAL) ; INIT A WITH QUIESCENT STATE + OUT (DSRTC_IO),A ; WRITE TO PORT + ;POP AF RET ; RETURN ; ; WORKING VARIABLES @@ -647,6 +712,10 @@ DSRTC_END: DSRTC_STAT .DB 0 ; DEVICE STATUS (0=OK) DSRTC_TEMP .DB 0 ; TEMP VALUE STORAGE ; +#IF (DSRTCMODE == DSRTCMODE_MFPIC) +DSRTC_RTCVAL .DB DSRTC_IDLE ; LOCAL LATCH SHADOW FOR MFPIC +#ENDIF +; ; DSRTC_BUF IS USED FOR BURST READ/WRITE OF CLOCK DATA TO DS-1302 ; FIELDS BELOW MATCH ORDER OF DS-1302 FIELDS (BCD) ; diff --git a/Source/HBIOS/duart.asm b/Source/HBIOS/duart.asm new file mode 100644 index 00000000..f49182be --- /dev/null +++ b/Source/HBIOS/duart.asm @@ -0,0 +1,865 @@ +; +;================================================================================================== +; DUART DRIVER (SERIAL PORT) +;================================================================================================== +; +; SETUP PARAMETER WORD: +; +-------+---+-------------------+ +---+---+-----------+---+-------+ +; | |RTS| ENCODED BAUD RATE | |DTR|XON| PARITY |STP| 8/7/6 | +; +-------+---+---+---------------+ ----+---+-----------+---+-------+ +; F E D C B A 9 8 7 6 5 4 3 2 1 0 +; -- MSB (D REGISTER) -- -- LSB (E REGISTER) -- +; +; MODE REGISTER 1 +; +; D7 D6 D5 D4 D3 D2 D1 D0 +; +-------+-------+-------+-------+-------+-------+-------+-------+ +; | RXRTS | RXINT | EMODE | PARITY MODE | SEL | BITS/CHAR | +; +-------+-------+-------+-------+-------+-------+-------+-------+ +; +; RXRTS: AUTOMATIC CONTROL OF /RTS BY RECEIVER +; 0 = NO +; 1 = YES +; RXINT: RECEIVE INTERRUPT SELECT +; 0 = RXRDY +; 1 = FFULL +; EMODE: ERROR MODE +; 0 = BY CHARACTER +; 1 = BY BLOCK +; PARITY MODE: +; 00 = WITH PARITY +; 01 = FORCE PARITY +; 10 = NO PARITY +; 11 = MULTIDROP MODE +; SEL: PARITY TYPE +; 0 = EVEN / SPACE +; 1 = ODD / MARK +; BITS/CHAR: +; 00 = 5 +; 01 = 6 +; 10 = 7 +; 11 = 8 +; +; MODE REGISTER 2 +; +; D7 D6 D5 D4 D3 D2 D1 D0 +; +-------+-------+-------+-------+-------+-------+-------+-------+ +; | CHANNEL MODE | TXRTS | TXCTS | STOP BIT LENGTH | +; +-------+-------+-------+-------+-------+-------+-------+-------+ +; +; CHANNEL MODE: +; 00 = NORMAL +; 01 = AUTO-ECHO +; 10 = LOCAL LOOP +; 11 = REMOTE LOOP +; TXRTS: AUTOMATIC CONTROL OF /RTS BY TRANSMITTER +; 0 = NO +; 1 = YES +; TXCTS: AUTOMATIC CONTROL OF TRANSMITTER BY /CTS +; 0 = NO +; 1 = YES +; STOP BIT LENGTH: +; 0 = 9/16 +; 1 = 10/16 = 5/8 +; 2 = 11/16 +; 3 = 12/16 = 3/4 +; 4 = 13/16 +; 5 = 14/16 = 7/8 +; 6 = 15/16 +; 7 = 16/16 = 1 +; 8-F = LENGTHS OF 0-7 PLUS ONE +; IF BITS/CHAR = 5 THEN ADD AN ADDITIONAL HALF BIT +; +DUART_DEBUG .EQU FALSE +; +DUART_NONE .EQU 0 ; UNKNOWN OR NOT PRESENT +DUART_2681 .EQU 1 ; OLD '681 WITHOUT IVR/GPR +DUART_26C92 .EQU 2 ; '92 WITH MR0 +DUART_XR88C681 .EQU 3 ; EXAR/MAXLINEAR CHIP WITH Z-MODE +; +DUART_BAUD_INV .EQU $FF ; INVALID BAUD RATE +DUART_BAUD_ACR7 .EQU %10000000 ; ACR BIT 7 = 1 +DUART_BAUD_X1 .EQU %01000000 ; BRG EXTEND BIT = 1 ('681) +DUART_BAUD_EXT1 .EQU %00100000 ; EXTENDED TABLE 1 ('92) +DUART_BAUD_EXT2 .EQU %00010000 ; EXTENDED TABLE 2 ('92) +; +; PER CHANNEL REGISTERS (CHANNEL A AT OFFSET 0, CHANNEL B AT OFFSET 8) +; +DUART_MR .EQU $00 ; MODE REGISTER (R/W) +DUART_SR .EQU $01 ; STATUS REGISTER (READ) +DUART_CSR .EQU $01 ; CLOCK SELECT REGISTER (WRITE) +DUART_CR .EQU $02 ; COMMAND REGISTER (WRITE) +DUART_RX .EQU $03 ; RECEIVER HOLDING REGISTER (READ) +DUART_TX .EQU $03 ; TRANSMITTER HOLDING REGISTER (WRITE) +; +; PER CHIP REGISTERS +; +DUART_IPCR .EQU $04 ; INPUT PORT CHANGE REGISTER (READ) +DUART_ACR .EQU $04 ; AUXILLIARY CONTROL REGISTER (WRITE) +DUART_ISR .EQU $05 ; INTERRUPT STATUS REGISTER (READ) +DUART_IMR .EQU $05 ; INTERRUPT MASK REGISTER (WRITE) +DUART_CTU .EQU $06 ; COUNTER/TIMER UPPER BYTE REGISTER (R/W) +DUART_CTL .EQU $07 ; COUNTER/TIMER LOWER BYTE REGISTER (R/W) +DUART_GPR .EQU $0C ; GENERAL PURPOSE REGISTER (R/W) +DUART_IVR .EQU $0C ; INTERRUPT VECTOR REGISTER (R/W) +DUART_IPR .EQU $0D ; INPUT PORT REGISTER (READ) +DUART_OPCR .EQU $0D ; OUTPUT PORT CONFIGURATION REGISTER (WRITE) +DUART_STCR .EQU $0E ; START COUNTER/TIMER COMMAND (READ) +DUART_SOPR .EQU $0E ; SET OUTPUT PORT REGISTER (WRITE) +DUART_SPCR .EQU $0F ; STOP COUNTER/TIMER COMMAND (READ) +DUART_ROPR .EQU $0F ; RESET OUTPUT PORT REGISTER (WRITE) +; +; COMMAND REGISTER +; +DUART_CR_ENA_RX .EQU %00000100 ; ENABLE RECEIVER +DUART_CR_DIS_RX .EQU %00001000 ; DISABLE RECEIVER +DUART_CR_ENA_TX .EQU %00000001 ; ENABLE TRANSMITTER +DUART_CR_DIS_TX .EQU %00000010 ; DISABLE TRANSMITTER +DUART_CR_NOP .EQU $00 ; NULL COMMAND +DUART_CR_MR1 .EQU $10 ; RESET MR POINTER TO MR1 +DUART_CR_RESET_RX .EQU $20 ; RESET RECEIVER +DUART_CR_RESET_TX .EQU $30 ; RESET TRANSMITTER +DUART_CR_RESET_ERR .EQU $40 ; RESET ERROR STATUS +DUART_CR_RESET_BRK .EQU $50 ; RESET BREAK STATUS +DUART_CR_START_BRK .EQU $60 ; START BREAK +DUART_CR_STOP_BRK .EQU $70 ; STOP BREAK +DUART_CR_SET_RX_X .EQU $80 ; SET RECEIVER BRG EXTEND BIT (X=1) +DUART_CR_CLR_RX_X .EQU $90 ; CLEAR RECEIVER BRG EXTEND BIT (X=0) +DUART_CR_SET_TX_X .EQU $A0 ; SET TRANSMITTER BRG EXTEND BIT (X=1) +DUART_CR_CLR_TX_X .EQU $B0 ; CLEAR TRANSMITTER BRG EXTEND BIT (X=0) +DUART_CR_MR0 .EQU $B0 ; RESET MR POINTER TO MR0 (26C92 ONLY) +DUART_CR_STANDBY .EQU $C0 ; SET STANDBY MODE (CHANNEL A ONLY) +DUART_CR_RESET_IUS .EQU $C0 ; RESET IUS LATCH (CHANNEL B ONLY) +DUART_CR_ACTIVE .EQU $D0 ; SET ACTIVE MODE (CHANNEL A ONLY) +DUART_CR_ZMODE .EQU $D0 ; SET Z-MODE (CHANNEL B ONLY) +; +; DUART STATUS REGISTER +; +DUART_SR_RXRDY .EQU %00000001 ; RECEIVER READY +DUART_SR_RXFULL .EQU %00000010 ; RECEIVE FIFO FULL +DUART_SR_TXRDY .EQU %00000100 ; TRANSMITTER READY +DUART_SR_TXEMPTY .EQU %00001000 ; TRANSMITTER FIFO EMPTY +DUART_SR_OVERRUN .EQU %00010000 ; OVERRUN ERROR +DUART_SR_PARITY .EQU %00100000 ; PARITY ERROR +DUART_SR_FRAMING .EQU %01000000 ; FRAMING ERROR +DUART_SR_BREAK .EQU %10000000 ; RECEIVED BREAK +; +; DUART MODE REGISTER 0 +; +DUART_MR0_NORMAL .EQU %00000000 ; NORMAL BAUD RATE TABLE +DUART_MR0_EXT1 .EQU %00000001 ; EXTENDED BAUD RATE TABLE 1 +DUART_MR0_EXT2 .EQU %00000100 ; EXTENDED BAUD RATE TABLE 2 +; +; DUART MODE REGISTER 1 +; +DUART_MR1_RXRTS .EQU %10000000 ; RECEIVER CONTROLS RTS +DUART_MR1_PARNONE .EQU %00010000 ; NO PARITY +DUART_MR1_PARODD .EQU %00000100 ; ODD PARITY +DUART_MR1_PAREVEN .EQU %00000000 ; EVEN PARITY +DUART_MR1_PARMARK .EQU %00001100 ; MARK PARITY +DUART_MR1_PARSPACE .EQU %00001000 ; SPACE PARITY +; +; DUART MODE REGISTER 2 +; +DUART_MR2_TXCTS .EQU %00010000 ; CTS CONTROLS TRANSMITTER +DUART_MR2_STOP1 .EQU %00000111 ; 1 STOP BIT (1.5 IF 5 BITS/CHAR) +DUART_MR2_STOP2 .EQU %00001111 ; 2 STOP BITS (2.5 IF 5 BITS/CHAR) +; +; +#DEFINE DUART_INP(RID) CALL DUART_INP_IMP \ .DB RID +#DEFINE DUART_OUTP(RID) CALL DUART_OUTP_IMP \ .DB RID +; +; +; +DUART_PREINIT: +; +; SETUP THE DISPATCH TABLE ENTRIES +; + LD B,DUART_CFGCNT ; LOOP CONTROL + XOR A ; ZERO TO ACCUM + LD (DUART_DEV),A ; CURRENT DEVICE NUMBER + LD IY,DUART_CFG ; POINT TO START OF CFG TABLE +DUART_PREINIT0: + PUSH BC ; SAVE LOOP CONTROL + CALL DUART_DETECT ; DETERMINE DUART TYPE + POP BC ; RESTORE LOOP CONTROL + LD (IY + 1),A ; SAVE TYPE IN CONFIG TABLE + OR A ; SET FLAGS + JR Z,DUART_PREINIT1 ; SKIP IT IF NOTHING FOUND +; + PUSH BC ; SAVE LOOP CONTROL + PUSH IY + POP DE ; DE := UNIT INSTANCE TABLE ADDRESS + LD BC,DUART_FNTBL ; BC := FUNCTION TABLE ADDRESS + CALL NZ,CIO_ADDENT ; ADD ENTRY IF DUART FOUND, BC:DE + POP BC ; RESTORE LOOP CONTROL +; +DUART_PREINIT1: + LD DE,DUART_CFGSIZ ; SIZE OF CFG ENTRY + ADD IY,DE ; BUMP IY TO NEXT ENTRY + DJNZ DUART_PREINIT0 ; LOOP UNTIL DONE +; + LD B,DUART_CFGCNT ; LOOP CONTROL + LD IY,DUART_CFG ; POINT TO START OF CFG TABLE +DUART_PREINIT2: + PUSH BC ; SAVE LOOP CONTROL + CALL DUART_INITUNIT ; INITIALIZE UNIT + POP BC ; RESTORE LOOP CONTROL + LD DE,DUART_CFGSIZ ; SIZE OF CFG ENTRY + ADD IY,DE ; BUMP IY TO NEXT ENTRY + DJNZ DUART_PREINIT2 ; LOOP UNTIL DONE +; + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; +; DUART INITIALIZATION ROUTINE +; +DUART_INITUNIT: + ; CHECK IF PORT IS PRESENT + LD A,(IY + 1) ; GET TYPE FROM CONFIG TABLE + OR A ; SET FLAGS + RET Z ; ABORT IF NOTHING THERE + + ; UPDATE WORKING DUART DEVICE NUM + LD HL,DUART_DEV ; POINT TO CURRENT DUART DEVICE NUM + LD A,(HL) ; PUT IN ACCUM + INC (HL) ; INCREMENT IT (FOR NEXT LOOP) + LD (IY),A ; UDPATE UNIT NUM + + ; SET DEFAULT CONFIG + LD DE,-1 ; LEAVE CONFIG ALONE + JP DUART_INITDEV ; IMPLEMENT IT AND RETURN +; +; +; +DUART_INIT: + LD B,DUART_CFGCNT ; COUNT OF POSSIBLE DUART UNITS + LD IY,DUART_CFG ; POINT TO START OF CFG TABLE +DUART_INIT1: + PUSH BC ; SAVE LOOP CONTROL + LD A,(IY + 1) ; GET DUART TYPE + OR A ; SET FLAGS + CALL NZ,DUART_PRTCFG ; PRINT IF NOT ZERO + + POP BC ; RESTORE LOOP CONTROL + LD DE,DUART_CFGSIZ ; SIZE OF CFG ENTRY + ADD IY,DE ; BUMP IY TO NEXT ENTRY + DJNZ DUART_INIT1 ; LOOP TILL DONE +; + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; DRIVER FUNCTION TABLE +; +DUART_FNTBL: + .DW DUART_IN + .DW DUART_OUT + .DW DUART_IST + .DW DUART_OST + .DW DUART_INITDEV + .DW DUART_QUERY + .DW DUART_DEVICE +#IF (($ - DUART_FNTBL) != (CIO_FNCNT * 2)) + .ECHO "*** INVALID DUART FUNCTION TABLE ***\n" +#ENDIF +; +; +; +DUART_IN: + CALL DUART_IST ; RECEIVED CHAR READY? + JR Z,DUART_IN ; LOOP IF NOT + DUART_INP(DUART_RX) ; GET CHAR READ IN A + LD E,A ; CHAR READ TO E + XOR A ; SIGNAL SUCCESS + RET ; AND DONE +; +; +; +DUART_OUT: + CALL DUART_OST ; READY FOR CHAR? + JR Z,DUART_OUT ; LOOP IF NOT + LD A,E ; GET CHAR TO SEND IN A + DUART_OUTP(DUART_TX) ; SEND CHAR FROM A + XOR A ; SIGNAL SUCCESS + RET +; +; +; +DUART_IST: + DUART_INP(DUART_SR) ; GET CHANNEL STATUS REGISTER IN A + AND DUART_SR_RXRDY ; ISOLATE RXRDY BIT + JP Z,CIO_IDLE ; NOT READY, RETURN VIA IDLE PROCESSING + XOR A ; ZERO ACCUM + INC A ; ACCUM := 1 TO SIGNAL 1 CHAR WAITING + RET ; DONE +; +; +; +DUART_OST: + DUART_INP(DUART_SR) ; GET CHANNEL STATUS REGISTER IN A + AND DUART_SR_TXRDY ; ISOLATE TXRDY BIT + JP Z,CIO_IDLE ; NOT READY, RETURN VIA IDLE PROCESSING + XOR A ; ZERO ACCUM + INC A ; ACCUM := 1 TO SIGNAL 1 BUFFER POSITION + RET ; DONE +; +; +; +DUART_INITDEV: + ; TEST FOR -1 WHICH MEANS USE CURRENT CONFIG (JUST REINIT) + LD A,D ; TEST DE FOR + AND E ; ... VALUE OF -1 + INC A ; ... SO Z SET IF -1 + JR NZ,DUART_INITDEV1 ; IF DE == -1, REINIT CURRENT CONFIG +; + ; LOAD EXISTING CONFIG TO REINIT + LD E,(IY + 8) ; LOW BYTE + LD D,(IY + 9) ; HIGH BYTE +; +DUART_INITDEV1: + ; GET CLOCK SELECT FROM TABLE + LD HL,DUART_BAUDTBL_681 ; GET START OF XR88C681 TABLE IN HL + LD A,(IY + 1) ; GET DUART TYPE + CP DUART_26C92 ; IS IT A 26C92? + JR NZ,DUART_INITDEV1A ; NO, SKIP NEXT INSTRUCTION + LD HL,DUART_BAUDTBL_92 ; GET START OF SC26C92 TABLE IN HL +; +DUART_INITDEV1A: + LD A,D ; GET CONFIG MSB + AND $1F ; ISOLATE ENCODED BAUD RATE + CALL ADDHLA ; HL -> ENTRY + LD A,(HL) ; A = ENTRY + INC A ; A = $FF? + JP Z,DUART_INITDEVZ ; INVALID RATE, ERROR OUT + DEC A ; GET ORIGINAL VALUE BACK +; + ; GOT A VALID RATE, COMMIT NEW CONFIG + LD (IY + 8),E ; SAVE LOW WORD + LD (IY + 9),D ; SAVE HI WORD +; + ; START OF ACTUAL DUART CHANNEL CONFIGURATION + LD L,A ; SAVE BAUD TABLE ENTRY IN L + LD A,DUART_CR_DIS_RX | DUART_CR_DIS_TX + DUART_OUTP(DUART_CR) ; DISABLE RECEIVER AND TRANSMITTER + LD A,DUART_CR_RESET_RX + DUART_OUTP(DUART_CR) ; RESET RECEIVER + LD A,DUART_CR_RESET_TX + DUART_OUTP(DUART_CR) ; RESET TRANSMITTER + LD A,DUART_CR_RESET_ERR + DUART_OUTP(DUART_CR) ; RESET ERROR STATUS + LD A,(IY + 1) ; GET DUART TYPE + CP DUART_26C92 ; IS IT A 26C92? + JR Z,DUART_INITDEV1B ; YES + CALL DUART_SETBAUD_681 ; NO, CALL '681 BRG SETUP + JR DUART_INITDEV2 +; +DUART_INITDEV1B: + CALL DUART_SETBAUD_92 ; CALL '92 BRG SETUP +; +DUART_INITDEV2: +; + ; SET PARITY AND WORD SIZE + LD A,DUART_CR_MR1 + DUART_OUTP(DUART_CR) ; SET MR POINTER TO MR1 + LD A,E ; GET LOW WORD OF CONFIG IN A + AND %00111000 ; KEEP ONLY PARITY BITS + RRA + RRA + RRA ; SHIFT PARITY BITS INTO AN INDEX + LD HL,DUART_PARTBL ; GET START OF TABLE IN HL + CALL ADDHLA ; HL -> ENTRY + LD B,(HL) ; BUILD MR1 IN B + LD A,E ; GET LOW WORD OF CONFIG IN A + AND %00000011 ; WORD LENGTH BITS ARE THE SAME + OR B ; MERGE PARITY BITS + OR DUART_MR1_RXRTS ; ALWAYS ENABLE RECEIVER CONTROL OF RTS + DUART_OUTP(DUART_MR) ; WRITE MR1 (AND SET MR POINTER TO MR2) +; + ; SET STOP BITS + LD A,E ; GET LOW WORD OF CONFIG IN A + LD B,DUART_MR2_STOP1 ; BUILD MR2 IN B + AND %00000100 ; KEEP ONLY STOP BITS + JR Z,DUART_INITDEV4 ; 1 STOP BIT + LD B,DUART_MR2_STOP2 ; 2 STOP BITS, REPLACE B +; +DUART_INITDEV4: + LD A,B ; GET MR2 IN A + ;OR DUART_MR2_TXCTS ; ALWAYS ENABLE CTS CONTROL OF TRANSMITTER + DUART_OUTP(DUART_MR) ; WRITE MR2 +; + ; RE-ENABLE RECEIVER AND TRANSMITTER + LD A,DUART_CR_ENA_RX | DUART_CR_ENA_TX + DUART_OUTP(DUART_CR) ; ENABLE RECEIVER AND TRANSMITTER +; + ; EXPLICITLY ASSERT RTS (SEEMS TO BE REQUIRED FOR SOME CHIPS TO DO AUTO-RTS) + LD L,%00000001 ; RTS FOR CHANNEL A IS IN BIT 0 + LD A,(IY) ; GET UNIT NUMBER IN A + AND L ; MASK ALL BUT CHANNEL + JR Z,DUART_INITDEV5 ; ZERO INDICATES CHANNEL A + SLA L ; MOVE INTO BIT 1, RTS FOR CHANNEL B +; +DUART_INITDEV5: + LD A,(IY + 2) ; GET BASE ADDRESS OF CHIP + ADD A,DUART_SOPR ; SET OUTPUT BITS + LD C,A ; GET PORT IN C + OUT (C),L ; OUTPUT PORT IS INVERTED BUT SO IS RTS +; + XOR A ; SIGNAL SUCCESS + RET +; +DUART_INITDEVZ: +; + ; INVALID BAUD RATE + DEC A ; A WAS $00, GET BACK $FF + RET ; RETURN ERROR STATUS +; +; INITIALIZE BRG FOR '681 DUART +; +DUART_SETBAUD_681: + ; SET ACR + LD C,(IY + 6) ; GET SHADOW ACR FOR THIS CHIP + LD B,(IY + 7) ; BC IS POINTER + LD A,(BC) ; GET SHADOW ACR IN A + AND %01111111 ; MASK OUT BIT 7 + LD H,A ; SAVE IT IN H + LD A,L ; TABLE ENTRY IS IN L, GET IT IN A + AND DUART_BAUD_ACR7 ; SEE IF ACR[7] SHOULD BE SET (BIT MASK SHOULD ACTUALLY _BE_ BIT 7) + OR H ; MERGE IN REST OF ACR + LD H,A ; SAVE IT IN H + LD A,(IY + 2) ; GET CHIP BASE IN A + ADD A,DUART_ACR ; ADD OFFSET OF ACR + LD C,A ; C = ACR PORT + ; YES, THIS OVERWRITES ACR[7] REGARDLESS OF THE OTHER CHANNEL, + ; BUT CURRENTLY THE TABLE IS SET SO EVERY VALID RATE HAS ACR[7] SET + OUT (C),H ; WRITE VALUE + ; SELECT PER-CHANNEL EXTENDED TABLE + LD A,L ; CALLED WITH TABLE ENTRY IN L, MOVE IT TO A + AND DUART_BAUD_X1 ; SEE IF SELECT EXTEND BIT SHOULD BE SET + JR Z,DUART_SETBAUD_681A ; NO, CLEAR IT + LD A,DUART_CR_SET_RX_X ; YES, SET EXTEND BIT + DUART_OUTP(DUART_CR) ; SET FOR RECEIVER + LD A,DUART_CR_SET_TX_X + DUART_OUTP(DUART_CR) ; SET FOR TRANSMITTER + JR DUART_SETBAUD_681B +; +DUART_SETBAUD_681A: + ; CLEAR EXTEND BIT + LD A,DUART_CR_CLR_RX_X + DUART_OUTP(DUART_CR) ; CLEAR FOR RECEIVER + LD A,DUART_CR_CLR_TX_X + DUART_OUTP(DUART_CR) ; CLEAR FOR TRANSMITTER +; +DUART_SETBAUD_681B: + ; SET BRG CLOCK SELECT + LD A,L ; GET BAUD TABLE ENTRY IN A + AND $0F ; GET CLOCK SELECT BITS + LD L,A ; SAVE IT IN L + RLA + RLA + RLA + RLA ; MOVE IT INTO THE HIGH NIBBLE + OR L ; AND MERGE BACK IN LOW NIBBLE + DUART_OUTP(DUART_CSR) ; SET CLOCK SELECT + RET +; +DUART_BAUDTBL_681: + ; ASSUME XR88C681 RUNS AT 3.6864MHZ + .DB %0000 | DUART_BAUD_X1 ; 75 + .DB %0011 | DUART_BAUD_X1 ; 150 + .DB %0100 ; 300 + .DB %0101 ; 600 + .DB %0110 ; 1200 + .DB %1000 ; 2400 + .DB %1001 ; 4800 + .DB %1011 ; 9600 + .DB %1100 | DUART_BAUD_X1 ; 19200 + .DB %1100 ; 38400 + .DB DUART_BAUD_INV ; 76800 + .DB DUART_BAUD_INV ; 153600 + .DB DUART_BAUD_INV ; 307200 + .DB DUART_BAUD_INV ; 614400 + .DB DUART_BAUD_INV ; 1228800 + .DB DUART_BAUD_INV ; 2457600 + .DB DUART_BAUD_INV ; 225 + .DB DUART_BAUD_INV ; 450 + .DB DUART_BAUD_INV ; 900 + .DB %1010 | DUART_BAUD_X1 ; 1800 + .DB %0100 | DUART_BAUD_X1 ; 3600 + .DB %1010 ; 7200 + .DB %0101 | DUART_BAUD_X1 ; 14400 + .DB %0110 | DUART_BAUD_X1 ; 28800 + .DB %0111 | DUART_BAUD_X1 ; 57600 + .DB %1000 | DUART_BAUD_X1 ; 115200 + .DB DUART_BAUD_INV ; 230400 + .DB DUART_BAUD_INV ; 460800 + .DB DUART_BAUD_INV ; 921600 + .DB DUART_BAUD_INV ; 1843200 + .DB DUART_BAUD_INV ; 3686400 + .DB DUART_BAUD_INV ; 7372800 +; +; INITIALIZE BRG FOR '92 DUART +; +DUART_SETBAUD_92: + ; SET ACR + LD C,(IY + 6) ; GET SHADOW ACR FOR THIS CHIP + LD B,(IY + 7) ; BC IS POINTER + LD A,(BC) ; GET SHADOW ACR IN A + AND %01111111 ; MASK OUT BIT 7 + LD H,A ; SAVE IT IN H + LD A,L ; TABLE ENTRY IS IN L, GET IT IN A + AND DUART_BAUD_ACR7 ; SEE IF ACR[7] SHOULD BE SET (BIT MASK SHOULD ACTUALLY _BE_ BIT 7) + OR H ; MERGE IN REST OF ACR + LD H,A ; SAVE IT IN H + LD A,(IY + 2) ; GET CHIP BASE IN A + ADD A,DUART_ACR ; ADD OFFSET OF ACR + LD C,A ; C = ACR PORT + ; YES, THIS OVERWRITES ACR[7] REGARDLESS OF THE OTHER CHANNEL, + ; BUT CURRENTLY THE TABLE IS SET SO EVERY VALID RATE HAS ACR[7] SET + OUT (C),H ; WRITE VALUE + ; SELECT NORMAL OR EXTENDED BAUD RATE TABLES + LD H,DUART_MR0_NORMAL ; ASSUME NORMAL + LD A,L ; GET TABLE ENTRY IN A AGAIN + AND DUART_BAUD_EXT1 ; SHOULD EXT1 BE SET? + JR Z,DUART_SETBAUD_92A ; NO, CHECK NEXT VALUE + LD H,DUART_MR0_EXT1 ; YES, SET IT + JR DUART_SETBAUD_92C +; +DUART_SETBAUD_92A: + LD A,L ; GET TABLE ENTRY IN A ONCE MORE + AND DUART_BAUD_EXT2 ; SHOULD EXT2 BE SET? + JR Z,DUART_SETBAUD_92C ; NO, CONTINUE + LD H,DUART_MR0_EXT2 ; YES, SET IT +; +DUART_SETBAUD_92C: + ; H NOW CONTAINS MR0 + LD A,(IY + 2) ; GET CHIP BASE IN A + ADD A,DUART_CR ; WE WANT TO WRITE THE COMMAND REGISTER OF CHANNEL A, EVEN IF WE'RE CHANNEL B + LD C,A ; C = CRA + LD A,DUART_CR_MR0 ; RESET MR POINTER TO MR0 + OUT (C),A ; WRITE COMMAND + LD A,(IY + 2) ; GET CHIP BASE IN A + ADD A,DUART_MR ; NOW WE WANT TO WRITE TO MR0 OF CHANNEL A + LD C,A ; C = MRA + ; AS WITH ACR[7] THE TABLE IS SET SO EVERY VALID RATE IS FROM + ; THE SAME TABLE + OUT (C),H + ; SET BRG CLOCK SELECT + LD A,L ; GET BAUD TABLE ENTRY IN A YET AGAIN + AND $0F ; GET CLOCK SELECT BITS + LD L,A ; SAVE IT IN L + RLA + RLA + RLA + RLA ; MOVE IT INTO THE HIGH NIBBLE + OR L ; AND MERGE BACK IN LOW NIBBLE + DUART_OUTP(DUART_CSR) ; SET CLOCK SELECT OF CURRENT CHANNEL + RET +; +DUART_BAUDTBL_92: + ; ASSUME SC26C92 RUNS AT 7.3728MHZ + .DB DUART_BAUD_INV ; 75 + .DB DUART_BAUD_INV ; 150 + .DB DUART_BAUD_INV ; 300 + .DB DUART_BAUD_INV ; 600 + .DB DUART_BAUD_INV ; 1200 + .DB DUART_BAUD_INV ; 2400 + .DB DUART_BAUD_INV ; 4800 + .DB %1001 | DUART_BAUD_EXT2 | DUART_BAUD_ACR7 ; 9600 + .DB %1011 | DUART_BAUD_EXT2 | DUART_BAUD_ACR7 ; 19200 + .DB %1100 | DUART_BAUD_EXT2 | DUART_BAUD_ACR7 ; 38400 + .DB DUART_BAUD_INV ; 76800 + .DB DUART_BAUD_INV ; 153600 + .DB DUART_BAUD_INV ; 307200 + .DB DUART_BAUD_INV ; 614400 + .DB DUART_BAUD_INV ; 1228800 + .DB DUART_BAUD_INV ; 2457600 + .DB DUART_BAUD_INV ; 225 + .DB DUART_BAUD_INV ; 450 + .DB DUART_BAUD_INV ; 900 + .DB DUART_BAUD_INV ; 1800 + .DB DUART_BAUD_INV ; 3600 + .DB DUART_BAUD_INV ; 7200 + .DB %0000 | DUART_BAUD_EXT2 | DUART_BAUD_ACR7 ; 14400 + .DB %0011 | DUART_BAUD_EXT2 | DUART_BAUD_ACR7 ; 28800 + .DB %0100 | DUART_BAUD_EXT2 | DUART_BAUD_ACR7 ; 57600 + .DB %0101 | DUART_BAUD_EXT2 | DUART_BAUD_ACR7 ; 115200 + .DB %0110 | DUART_BAUD_EXT2 | DUART_BAUD_ACR7 ; 230400 + .DB DUART_BAUD_INV ; 460800 + .DB DUART_BAUD_INV ; 921600 + .DB DUART_BAUD_INV ; 1843200 + .DB DUART_BAUD_INV ; 3686400 + .DB DUART_BAUD_INV ; 7372800 +; +DUART_PARTBL: + .DB DUART_MR1_PARNONE ; 0 = NO PARITY (ALSO ALL EVEN ENTRIES) + .DB DUART_MR1_PARODD ; 1 = ODD PARITY + .DB DUART_MR1_PARNONE + .DB DUART_MR1_PAREVEN ; 3 = EVEN PARITY + .DB DUART_MR1_PARNONE + .DB DUART_MR1_PARMARK ; 5 = MARK PARITY + .DB DUART_MR1_PARNONE + .DB DUART_MR1_PARSPACE ; 7 = SPACE PARITY +; +; +; +DUART_QUERY: + LD E,(IY + 8) ; FIRST CONFIG BYTE TO E + LD D,(IY + 9) ; SECOND CONFIG BYTE TO D + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; +; +DUART_DEVICE: + LD D,CIODEV_DUART ; D := DEVICE TYPE + LD E,(IY) ; E := PHYSICAL UNIT + LD C,$00 ; C := DEVICE TYPE, 0x00 IS RS-232 + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,(IY+3) ; L := BASE I/O ADDRESS + XOR A ; SIGNAL SUCCESS + RET +; +; DUART DETECTION ROUTINE +; +DUART_DETECT: +; + ; FIRST SEE IF IT LOOKS LIKE A 16X50-STYLE UART + LD A,(IY + 2) ; GET BASE PORT OF CHIP + ADD A,4 ; BASE + 4 = ACR (DUART), MCR (1ST 16X50) + LD H,A ; H := ACR/MCR PORT ADDRESS + ADD A,2 ; BASE + 6 = CTU (DUART), MSR (1ST 16X50) + LD B,A ; B := CTU/MSR PORT ADDRESS + INC A ; BASE + 7 = CTL (DUART), SCR (1ST 16X50) + LD D,A ; D := CTL/SCR PORT ADDRESS + ADD A,7 ; BASE + 14 = STCR (DUART), MSR (2ND 16X50) + LD E,A ; E := STCR/MSR PORT ADDRESS + INC A ; BASE + 15 = SPCR (DUART), SCR (2ND 16X50) + LD C,A ; SPCR + IN A,(C) ; STOP COUNTER/TIMER, JUST IN CASE + LD C,H ; ACR/MCR + IN L,(C) ; GET ORIGINAL VALUE (ACTUALLY IPCR ON DUART) IN L + LD A,$30 ; ENABLE A SOURCE FOR THE COUNTER/TIMER + OUT (C),A ; WRITE TO ACR/MCR + LD A,$A5 ; TEST VALUE + LD C,B ; CTU + OUT (C),A ; WRITE TEST VALUE TO CTU + LD A,$FF ; LARGE VALUE TO PREVENT CTL FROM ROLLING OVER WHILE WE TEST + LD C,D ; CTL + OUT (C),A ; WRITE LARGE VALUE TO CTL + LD C,E ; STCR + IN A,(C) ; START COUNTER/TIMER (LATCH CTU, CTL) + INC C ; C := SPCR + IN A,(C) ; STOP COUNTER/TIMER + LD C,H ; ACR/MCR + OUT (C),L ; WRITE ORIGINAL VALUE OF MCR (ACR GETS SET ON DUART LATER) + LD C,B ; CTU + IN A,(C) ; READ BACK TEST VALUE + CP $A5 ; CHECK FOR TEST VALUE + JR NZ,DUART_DETECT_NONE ; NO, PROBABLY NOT A DUART + IN A,(C) ; CHECK TEST VALUE AGAIN, + CP $A5 ; ... IN RARE CASE DELTAS IN MSR WERE SET TO OUR TEST + JR NZ,DUART_DETECT_NONE ; ALMOST CERTAINLY NOT A DUART + ; SEE IF MR1 AND MR2 ARE DISTINCT + LD A,DUART_CR_MR1 ; SET MR POINTER TO MR1 + DUART_OUTP(DUART_CR) ; SEND COMMAND + LD A,1 ; WRITE TEST VALUE TO MR1 + DUART_OUTP(DUART_MR) ; WRITE MR1 AND SET POINTER TO MR2 + XOR A ; WRITE 0 TO MR2 + DUART_OUTP(DUART_MR) ; WRITE MR2 AND KEEP POINTER TO MR2 + LD A,DUART_CR_MR1 ; SET MR POINTER TO MR1 (AGAIN) + DUART_OUTP(DUART_CR) ; SEND COMMAND + DUART_INP(DUART_MR) ; GET VALUE OF MR1 IN A + CP 1 ; CHECK FOR TEST VALUE + JR NZ,DUART_DETECT_NONE ; NOPE, UNKNOWN DEVICE OR NOT PRESENT +; + ; TEST FOR FUNCTIONAL GENERAL PURPOSE REG, IF NOT, WE HAVE A 2681 + LD A,$5A ; LOAD TEST VALUE + DUART_OUTP(DUART_GPR) ; PUT IT IN GENERAL PURPOSE REGISTER + DUART_INP(DUART_GPR) ; READ IT BACK + CP $5A ; CHECK IT + JR NZ,DUART_DETECT_2681 ; OLD CHIP +; + ; TEST FOR MR0 REGISTER, IN WHICH CASE WE HAVE A 26C92 OF SOME SORT + LD A,DUART_CR_MR0 ; SET MR POINTER TO MR0 + DUART_OUTP(DUART_CR) ; THIS IS HARMLESS ON OTHER CHIPS + LD A,1 ; WRITE TEST VALUE TO MR0 + DUART_OUTP(DUART_MR) ; WRITE TO MR0 ON 26C92, MR2 STILL SET ON OTHERS + LD A,DUART_CR_MR1 ; SET MR POINTER TO MR1 + DUART_OUTP(DUART_CR) ; THIS WORKS ON ALL CHIPS + XOR A ; WRITE 0 TO MR1 + DUART_OUTP(DUART_MR) ; WRITE MR1 AND SET POINTER TO MR2 + XOR A ; ALSO WRITE 0 TO MR2 + DUART_OUTP(DUART_MR) ; WRITE MR2 AND KEEP POINTER TO MR2 + LD A,DUART_CR_MR0 ; SET POINTER TO MR0 + DUART_OUTP(DUART_CR) ; POINTER IS STILL MR2 ON OTHER CHIPS + DUART_INP(DUART_MR) ; GET VALUE OF MR0 IN A + AND 1 ; MASK TEST VALUE IN BIT 1 + JR NZ,DUART_DETECT_26C92 ; IF IT'S SET, THIS MUST BE A '92 WITH MR0 + + JR DUART_DETECT_XR88C681 ; ASSUME WE HAVE A FANCY EXAR CHIP +; +DUART_DETECT_NONE: + LD A,DUART_NONE + RET +; +DUART_DETECT_2681: + LD A,DUART_2681 + RET +; +DUART_DETECT_26C92: + LD A,DUART_26C92 + RET +; +DUART_DETECT_XR88C681 + LD A,DUART_XR88C681 + RET +; +; +; +DUART_PRTCFG: + ; ANNOUNCE PORT + CALL NEWLINE ; FORMATTING + PRTS("DUART$") ; FORMATTING + LD A,(IY) ; DEVICE NUM + CALL PRTDECB ; PRINT DEVICE NUM + PRTS(": IO=0x$") ; FORMATTING + LD A,(IY + 3) ; GET CHANNEL BASE PORT + CALL PRTHEXBYTE ; PRINT BASE PORT + + ; PRINT THE DUART TYPE + CALL PC_SPACE ; FORMATTING + LD A,(IY + 1) ; GET DUART TYPE BYTE + RLCA ; MAKE IT A WORD OFFSET + LD HL,DUART_TYPE_MAP ; POINT HL TO TYPE MAP TABLE + CALL ADDHLA ; HL := ENTRY + LD E,(HL) ; DEREFERENCE + INC HL ; ... + LD D,(HL) ; ... TO GET STRING POINTER + CALL WRITESTR ; PRINT IT +; + ; ALL DONE IF NO DUART WAS DETECTED + LD A,(IY + 1) ; GET DUART TYPE BYTE + OR A ; SET FLAGS + RET Z ; IF ZERO, NOT PRESENT +; + PRTS(" MODE=$") ; FORMATTING + LD E,(IY + 8) ; LOAD CONFIG + LD D,(IY + 9) ; ... WORD TO DE + CALL PS_PRTSC0 ; PRINT CONFIG +; + XOR A + RET +; +; ROUTINES TO READ/WRITE PORTS INDIRECTLY +; +; READ VALUE OF DUART PORT ON TOS INTO REGISTER A +; +DUART_INP_IMP: + EX (SP),HL ; SWAP HL AND TOS + PUSH BC ; PRESERVE BC + LD A,(IY + 3) ; GET DUART IO BASE PORT + OR (HL) ; OR IN REGISTER ID BITS + LD C,A ; C := PORT + IN A,(C) ; READ PORT INTO A + POP BC ; RESTORE BC + INC HL ; BUMP HL PAST REG ID PARM + EX (SP),HL ; SWAP BACK HL AND TOS + RET +; +; WRITE VALUE IN REGISTER A TO DUART PORT ON TOS +; +DUART_OUTP_IMP: + EX (SP),HL ; SWAP HL AND TOS + PUSH BC ; PRESERVE BC + LD B,A ; PUT VALUE TO WRITE IN B + LD A,(IY + 3) ; GET DUART IO BASE PORT + OR (HL) ; OR IN REGISTER ID BITS + LD C,A ; C := PORT + OUT (C),B ; WRITE VALUE TO PORT + POP BC ; RESTORE BC + INC HL ; BUMP HL PAST REG ID PARM + EX (SP),HL ; SWAP BACK HL AND TOS + RET +; +; +; +DUART_TYPE_MAP: + .DW DUART_STR_NONE + .DW DUART_STR_2681 + .DW DUART_STR_26C92 + .DW DUART_STR_XR88C681 + +DUART_STR_NONE .DB "$" +DUART_STR_2681 .DB "2681$" +DUART_STR_26C92 .DB "26C92$" +DUART_STR_XR88C681 .DB "XR88C681$" +; +; WORKING VARIABLES +; +DUART_DEV .DB 0 ; DEVICE NUM USED DURING INIT +; +; PER-CHIP VARIABLES +; +DUART0_ACR .DB 0 ; SHADOW ACR (DUART 0) +; +#IF (DUARTCNT >= 2) +; +DUART1_ACR .DB 0 ; SHADOW ACR (DUART 1) +; +#ENDIF +; +; DUART PORT TABLE +; +DUART_CFG: +; +DUART0A_CFG: + ; 1ST DUART MODULE CHANNEL A + .DB 0 ; IY DEVICE NUMBER (SET DURING INIT) + .DB 0 ; IY+1 DUART TYPE (SET DURING INIT) + .DB DUART0BASE ; IY+2 BASE PORT (CHIP) + .DB DUART0BASE + $00 ; IY+3 BASE PORT (CHANNEL) + .DW DUART0B_CFG ; IY+4 POINTER TO OTHER CHANNEL + .DW DUART0_ACR ; IY+6 POINTER TO SHADOW ACR FOR THIS CHIP + .DW DUART0ACFG ; IY+8 LINE CONFIGURATION + .DB 1 ; IY+10 MULTIPLIER WRT 3.6864MHZ CLOCK +; +DUART_CFGSIZ .EQU $ - DUART_CFG ; SIZE OF ONE CFG TABLE ENTRY +; +DUART0B_CFG: + ; 1ST DUART MODULE CHANNEL B + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; DUART TYPE (SET DURING INIT) + .DB DUART0BASE ; BASE PORT (CHIP) + .DB DUART0BASE + $08 ; BASE PORT (CHANNEL) + .DW DUART0A_CFG ; POINTER TO OTHER CHANNEL + .DW DUART0_ACR ; POINTER TO SHADOW ACR FOR THIS CHIP + .DW DUART0BCFG ; LINE CONFIGURATION + .DB 1 ; MULTIPLIER WRT 3.6864MHZ CLOCK +; +#IF (DUARTCNT >= 2) +; +DUART1A_CFG: + ; 2ND DUART MODULE CHANNEL A + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; DUART TYPE (SET DURING INIT) + .DB DUART1BASE ; BASE PORT (CHIP) + .DB DUART1BASE + $00 ; BASE PORT (CHANNEL) + .DW DUART1B_CFG ; POINTER TO OTHER CHANNEL + .DW DUART1_ACR ; POINTER TO SHADOW ACR FOR THIS CHIP + .DW DUART1ACFG ; LINE CONFIGURATION + .DB 1 ; MULTIPLIER WRT 3.6864MHZ CLOCK +; +DUART1B_CFG: + ; 2ND DUART MODULE CHANNEL B + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; DUART TYPE (SET DURING INIT) + .DB DUART1BASE ; BASE PORT (CHIP) + .DB DUART1BASE + $08 ; BASE PORT (CHANNEL) + .DW DUART1A_CFG ; POINTER TO OTHER CHANNEL + .DW DUART1_ACR ; POINTER TO SHADOW ACR FOR THIS CHIP + .DW DUART1BCFG ; LINE CONFIGURATION + .DB 1 ; MULTIPLIER WRT 3.6864MHZ CLOCK +; +#ENDIF +; +DUART_CFGCNT .EQU ($ - DUART_CFG) / DUART_CFGSIZ diff --git a/Source/HBIOS/eastaegg.asm b/Source/HBIOS/eastaegg.asm index 35c4c982..7d291165 100644 --- a/Source/HBIOS/eastaegg.asm +++ b/Source/HBIOS/eastaegg.asm @@ -179,10 +179,15 @@ waitch LD B,BF_CIOIN ; HBIOS FUNC: INPUT CHAR RST 08 ; DO IT - ; RETURN TO THE LOADER - LD A,BID_BOOT ; BOOT BANK - LD HL,0 ; ADDRESS ZERO - CALL HB_BNKCALL ; DOES NOT RETURN + ;; RETURN TO THE LOADER + ;LD A,BID_BOOT ; BOOT BANK + ;LD HL,0 ; ADDRESS ZERO + ;CALL HB_BNKCALL ; DOES NOT RETURN + + LD B,BF_SYSRESET ; SYSTEM RESTART + LD C,BF_SYSRES_WARM ; WARM START + CALL $FFF0 ; CALL HBIOS + HALT #ENDIF #IF (BIOS == BIOS_UNA) diff --git a/Source/HBIOS/fd.asm b/Source/HBIOS/fd.asm index df2673be..17de8693 100644 --- a/Source/HBIOS/fd.asm +++ b/Source/HBIOS/fd.asm @@ -61,6 +61,20 @@ FDC_DOR .EQU FDC_BASE + $02 ; DIGITAL OUTPUT REGISTER FDC_DCR .EQU FDC_BASE + $03 ; CONFIGURATION CONTROL REGISTER FDC_TC .EQU FDC_BASE + $02 ; TERMINAL COUNT (W/ DACK) #ENDIF +#IF (FDMODE == FDMODE_EPFDC) +FDC_MSR .EQU $48 ; 8272 MAIN STATUS REGISTER +FDC_DATA .EQU $49 ; 8272 DATA PORT +FDC_DOR .EQU $4A ; DIGITAL OUTPUT REGISTER +FDC_DCR .EQU $4B ; CONFIGURATION CONTROL REGISTER +FDC_TC .EQU $4C ; TERMINAL COUNT (W/ DACK) +#ENDIF +#IF (FDMODE == FDMODE_MBC) +FDC_MSR .EQU $30 ; 8272 MAIN STATUS REGISTER +FDC_DATA .EQU $31 ; 8272 DATA PORT +FDC_DOR .EQU $36 ; DIGITAL OUTPUT REGISTER +FDC_DCR .EQU $35 ; CONFIGURATION CONTROL REGISTER +FDC_TC .EQU $37 ; TERMINAL COUNT (W/ DACK) +#ENDIF ; ; DISK OPERATIONS ; @@ -94,7 +108,7 @@ FRC_TOSEEKWT .EQU -15H ; EB ; ; FD DEVICE CONFIGURATION ; -FD_DEVCNT .EQU 2 ; 2 DEVICES SUPPORTED +FD_DEVCNT .EQU FDCNT ; 2 DEVICES SUPPORTED FD_CFGSIZ .EQU 8 ; SIZE OF CFG TBL ENTRIES ; ; PER DEVICE DATA OFFSETS @@ -399,7 +413,7 @@ DOR_INIT .EQU 11100000B ; INITIAL DEFAULT LATCH VALUE ; ; *** DIDE/N8/ZETA V2 *** ; -#IF ((FDMODE == FDMODE_DIDE) | (FDMODE == FDMODE_N8) | (FDMODE == FDMODE_ZETA2) | (FDMODE == FDMODE_RCWDC) | (FDMODE == FDMODE_DYNO)) +#IF ((FDMODE == FDMODE_DIDE) | (FDMODE == FDMODE_N8) | (FDMODE == FDMODE_ZETA2) | (FDMODE == FDMODE_RCWDC) | (FDMODE == FDMODE_DYNO) | (FDMODE == FDMODE_EPFDC) | (FDMODE == FDMODE_MBC)) DOR_INIT .EQU 00001100B ; SOFT RESET INACTIVE, DMA ENABLED DOR_BR250 .EQU DOR_INIT DOR_BR500 .EQU DOR_INIT @@ -476,7 +490,8 @@ FD_FNTBL: FD_VERIFY: FD_FORMAT: FD_DEFMED: - CALL PANIC ; INVALID SUB-FUNCTION + SYSCHKERR(ERR_NOTIMPL) ; INVALID SUB-FUNCTION + RET ; ; ; @@ -498,6 +513,8 @@ FD_DEVICE: #IF (FDMEDIA == FDM111) LD C,%10010100 ; 8" DS/DD #ENDIF + LD H,FDMODE ; H := MODE + LD L,FDC_MSR ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -548,7 +565,8 @@ FD_MEDIARETRY: ;LD (HL),0 ; SET TO NO MEDIA LD (IY+FD_MEDTYP),0 ; SET DRIVE = NO MEDIA LD E,0 - OR $FF ; SIGNAL ERROR + LD A,ERR_NOMEDIA ; SIGNAL ERROR + OR A ; SET FLAGS RET FD_TESTMEDIA: @@ -635,10 +653,65 @@ FD_GEOM: ; FD_INIT: CALL NEWLINE ; FORMATTING - PRTS("FD: IO=0x$") + PRTS("FD: MODE=$") +; +#IF (FDMODE == FDMODE_DIO) + PRTS("DIO$") +#ENDIF +; +#IF (FDMODE == FDMODE_ZETA) + PRTS("ZETA$") +#ENDIF +; +#IF (FDMODE == FDMODE_DIO3) + PRTS("DIO3$") +#ENDIF +; +#IF (FDMODE == FDMODE_ZETA2) + PRTS("ZETA2$") +#ENDIF +; +#IF (FDMODE == FDMODE_DIDE) + PRTS("DIDE$") +#ENDIF +; +#IF (FDMODE == FDMODE_N8) + PRTS("N8$") +#ENDIF +; +#IF (FDMODE == FDMODE_RCSMC) + PRTS("RCSMC$") +#ENDIF +; +#IF (FDMODE == FDMODE_RCWDC) + PRTS("RCWDC$") +#ENDIF +; +#IF (FDMODE == FDMODE_DYNO) + PRTS("DYNO$") +#ENDIF +; +#IF (FDMODE == FDMODE_EPFDC) + PRTS("EPFDC$") +#ENDIF +; +#IF (FDMODE == FDMODE_MBC) + PRTS("MBC$") +#ENDIF +; + PRTS(" IO=0x$") LD A,FDC_MSR CALL PRTHEXBYTE - PRTS(" UNITS=2$") + CALL FD_DETECT ; CHECK FOR FDC + JR Z,FD_INIT00 ; CONTINUE IF FOUND + PRTS(" NOT PRESENT$") ; NOT ZERO, H/W NOT PRESENT + OR $FF ; SIGNAL FAILURE + RET ; BAIL OUT +; +FD_INIT00: + PRTS(" UNITS=$") + LD A, FD_DEVCNT + '0' + CALL COUT ; ; SETUP THE DISPATCH TABLE ENTRIES ; @@ -673,6 +746,34 @@ FD_INIT0: ; RET ; +; HARDWARE PRESENCE DETECTION +; +; CURRENTLY JUST DETERMINES IF FDC EXISTS AT PRE-DEFINED ADDRESS, +; DOES NOT ATTEMPT TO DETERMINE THE ACTUAL VARIANT. +; +FD_DETECT: + ; BLINDLY RESET FDC (WHICH MAY OR MAY NOT EXIST) + LD A,DOR_INIT ; MAKE SURE INITIAL DOR VALUE IS SETUP + LD (FST_DOR),A ; AND PUT IN SHADOW REGISTER + CALL FC_RESETFDC ; RESET FDC + + IN A,(FDC_MSR) ; READ MSR + ;CALL PC_SPACE ; *DEBUG* + ;CALL PRTHEXBYTE ; *DEBUG* + CP $80 + JR Z,FD_DETECT1 ; $80 IS OK + CP $D0 + JR Z,FD_DETECT1 ; $D0 IS OK + RET ; NOPE, ABORT WITH ZF=NZ +; +FD_DETECT1: + CALL DLY32 ; WAIT A BIT FOR FDC + IN A,(FDC_MSR) ; READ MSR AGAIN + ;CALL PC_SPACE ; *DEBUG* + ;CALL PRTHEXBYTE ; *DEBUG* + CP $80 + RET ; $80 OK, ELSE NOT PRESENT +; ; UNIT INITIALIZATION ; FD_INITUNIT: @@ -775,7 +876,7 @@ FD_FDCRESET: LD (FCD_FDCRDY),A ; MARK ALL DRIVES AS NEEDING RECALIBRATION - ; NOTE THAT IF THE VALUE IS CURRENT $FF, + ; NOTE THAT IF THE VALUE IS CURRENTLY $FF, ; WE NEED TO LEAVE IT ALONE, SO WE 'OR' IN THE ; $FE TO AVOID THIS SCENARIO. @@ -963,13 +1064,26 @@ FD_RETRY: CALL FC_PRTRESULTS #ENDIF + ; RETURN APPROPRIATE HBIOS ERROR LD A,(FST_RC) - OR A ; OTHERWISE SET FLAGS BASED ON RC (IN A) + CP FRC_NOTWRIT + LD A,ERR_READONLY ; ASSUME WRITE PROTECTED ERROR + JR Z,FD_RETRY1 + LD A,ERR_IO ; OTHERWISE I/O ERROR +FD_RETRY1: + OR A ; SET FLAGS RET ; AND GIVE UP ; ; ; FD_START: +; +#IF (DSKYENABLE) + LD A,4 + CALL LDHLIYA + CALL HB_DSKACTCHS ; SHOW ACTIVITY +#ENDIF +; LD A,(FCD_FDCRDY) CP TRUE CALL NZ,FD_FDCRESET @@ -1033,12 +1147,13 @@ FD_RUN1: JR Z,FC_WRITE CP DOP_READID JR Z,FC_READID - CALL PANIC + SYSCHKERR(ERR_NOFUNC) + RET FD_RUNCHK: -#IF (DSKYENABLE) - CALL FD_DSKY -#ENDIF +;;#IF (DSKYENABLE) +;; CALL FD_DSKY +;;#ENDIF FD_RUNEXIT: LD A,(FST_RC) @@ -1055,23 +1170,23 @@ FD_RUNERR: JP FD_RETRC -#IF (DSKYENABLE) -FD_DSKY: - LD HL,DSKY_HEXBUF - LD A,(FCD_C) - LD (HL),A - INC HL - LD A,(FCD_R) - LD (HL),A - INC HL - LD A,(FRB_ST0) - LD (HL),A - INC HL - LD A,(FRB_ST1) - LD (HL),A - CALL DSKY_HEXOUT - RET -#ENDIF +;;#IF (DSKYENABLE) +;;FD_DSKY: +;; LD HL,DSKY_HEXBUF +;; LD A,(FCD_C) +;; LD (HL),A +;; INC HL +;; LD A,(FCD_R) +;; LD (HL),A +;; INC HL +;; LD A,(FRB_ST0) +;; LD (HL),A +;; INC HL +;; LD A,(FRB_ST1) +;; LD (HL),A +;; CALL DSKY_HEXOUT +;; RET +;;#ENDIF ; ;=============================================================================== ; FLOPPY DISK CONTROL SERVICES (PHYSICAL DEVICE CONTROL FOR FDC HARDWARE) @@ -1218,7 +1333,7 @@ FC_SETUPSPECIFY: ; ; SET FST_DOR ; -FC_SETDOR +FC_SETDOR: LD (FST_DOR),A OUT (FDC_DOR),A #IF (FDTRACE >= 3) @@ -1235,7 +1350,7 @@ FC_SETDOR ; ; SET FST_DCR ; -#IF ((FDMODE == FDMODE_DIDE) | (FDMODE == FDMODE_N8) | (FDMODE == FDMODE_ZETA2) | (FDMODE == FDMODE_RCWDC) | (FDMODE == FDMODE_DYNO)) +#IF ((FDMODE == FDMODE_DIDE) | (FDMODE == FDMODE_N8) | (FDMODE == FDMODE_ZETA2) | (FDMODE == FDMODE_RCWDC) | (FDMODE == FDMODE_DYNO) | (FDMODE == FDMODE_EPFDC) | (FDMODE == FDMODE_MBC)) ; FC_SETDCR LD (FST_DCR),A @@ -1267,7 +1382,7 @@ FC_RESETFDC: #IF ((FDMODE == FDMODE_ZETA) | (FDMODE == FDMODE_DIO3) | (FDMODE == FDMODE_RCSMC)) RES 7,A #ENDIF -#IF ((FDMODE == FDMODE_DIDE) | (FDMODE == FDMODE_N8) | (FDMODE == FDMODE_ZETA2) | (FDMODE == FDMODE_RCWDC) | (FDMODE == FDMODE_DYNO)) +#IF ((FDMODE == FDMODE_DIDE) | (FDMODE == FDMODE_N8) | (FDMODE == FDMODE_ZETA2) | (FDMODE == FDMODE_RCWDC) | (FDMODE == FDMODE_DYNO) | (FDMODE == FDMODE_EPFDC) | (FDMODE == FDMODE_MBC)) LD A,0 #ENDIF CALL FC_SETDOR @@ -1282,7 +1397,7 @@ FC_RESETFDC: ; PULSE TERMCT TO TERMINATE ANY ACTIVE EXECUTION PHASE ; FC_PULSETC: -#IF ((FDMODE == FDMODE_DIDE) | (FDMODE == FDMODE_N8) | (FDMODE == FDMODE_ZETA2) | (FDMODE == FDMODE_RCWDC) | (FDMODE == FDMODE_DYNO)) +#IF ((FDMODE == FDMODE_DIDE) | (FDMODE == FDMODE_N8) | (FDMODE == FDMODE_ZETA2) | (FDMODE == FDMODE_RCWDC) | (FDMODE == FDMODE_DYNO) | (FDMODE == FDMODE_EPFDC) | (FDMODE == FDMODE_MBC)) IN A,(FDC_TC) #ELSE LD A,(FST_DOR) @@ -1299,7 +1414,7 @@ FC_MOTORON: ; LD BC,300H ; LD BC,50H ; LD (FCD_IDLECNT),BC - + LD A,(CB_CPUMHZ) RLCA LD (FCD_IDLECNT),A @@ -1339,7 +1454,7 @@ FC_MOTORON1: CP C ; COMPARE TO NEW MOTOR BITS RET Z ; SKIP DELAY, MOTOR WAS ALREADY ON #ENDIF -#IF ((FDMODE == FDMODE_DIDE) | (FDMODE == FDMODE_N8) | (FDMODE == FDMODE_ZETA2) | (FDMODE == FDMODE_RCWDC) | (FDMODE == FDMODE_DYNO)) +#IF ((FDMODE == FDMODE_DIDE) | (FDMODE == FDMODE_N8) | (FDMODE == FDMODE_ZETA2) | (FDMODE == FDMODE_RCWDC) | (FDMODE == FDMODE_DYNO) | (FDMODE == FDMODE_EPFDC) | (FDMODE == FDMODE_MBC)) ; SETUP DCR FOR DIDE HARDWARE LD A,(FCD_DCR) ; GET NEW DCR VALUE CALL FC_SETDCR ; AND IMPLEMENT IT diff --git a/Source/HBIOS/flashlib.inc b/Source/HBIOS/flashlib.inc new file mode 100644 index 00000000..f9cc6fa3 --- /dev/null +++ b/Source/HBIOS/flashlib.inc @@ -0,0 +1,373 @@ +;====================================================================== +; FLASH LIBRARY +;====================================================================== +; FLASH IDENTIFY +; SELECT THE APPROPRIATE BANK / ADDRESS +; ISSUE ID COMMAND +; READ IN ID WORD +; ISSUE ID EXIT COMMAND +; SELECT ORIGINAL BANK +; +; ON ENTRY BC CONTAINS BANK AND SECTOR DATA +; A CONTAINS CURRENT BANK +; ON EXIT BC CONTAINS ID WORD +; NO STATUS IS RETURNED +;====================================================================== +; + .DB MD_I_SZ ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED +MD_FIDEN_R: ; THIS CODE GETS RELOCATED TO HIGH MEMORY +; + LD D,A ; SAVE CURRENT BANK +; + LD A,B ; SELECT BANK + CALL HBX_BNKSEL ; TO PROGRAM +; + LD HL,$5555 ; LD A,$AA ; COMMAND + LD (HL),$AA ; LD ($5555),A ; SETUP + LD A,H ; LD A,$55 + LD ($2AAA),A ; LD ($2AAA),A + LD (HL),$90 ; LD A,$90 +; ; LD ($5555),A + LD BC,($0000) ; READ ID +; + LD A,$F0 ; LD A,$F0 ; EXIT + LD (HL),A ; LD ($5555),A ; COMMAND +; + LD A,D ; RETURN TO ORIGINAL BANK + JP HBX_BNKSEL ; WHICH IS OUR RAM BIOS COPY +; +MD_I_SZ .EQU $-MD_FIDEN_R ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED +; +;====================================================================== +; ERASE FLASH SECTOR. +; +; SELECT THE APPROPRIATE BANK / ADDRESS +; ISSUE ERASE SECTOR COMMAND +; POLL TOGGLE BIT FOR COMPLETION STATUS. +; SELECT ORIGINAL BANK +; +; ON ENTRY BC CONTAINS BANK AND SECTOR DATA +; A CONTAINS CURRENT BANK +; ON EXIT C RETURNS STATUS 0=SUCCESS NZ=FAIL +;====================================================================== +; + .DB MD_S_SZ ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED +MD_FERAS_R: ; THIS CODE GETS RELOCATED TO HIGH MEMORY +; + PUSH AF ; SAVE CURRENT BANK + LD A,B ; SELECT BANK + CALL HBX_BNKSEL ; TO PROGRAM +; + LD HL,$5555 ; LD ($5555),A + LD DE,$2AAA ; LD A,$55 + LD A,L ; LD ($2AAA),A + LD (HL),E ; LD A,$80 + LD (DE),A ; LD ($5555),A + LD (HL),$80 ; LD A,$AA + LD (HL),E ; LD ($5555),A + LD (DE),A ; LD A,$55 +; ; LD ($2AAA),A + LD H,C ; SECTOR + LD L,$00 ; ADDRESS +; + LD A,$30 ; SECTOR ERASE + LD (HL),A ; COMMAND +; +MD_WT4: LD A,(HL) ; DO TWO SUCCESSIVE READS + LD C,(HL) ; FROM THE SAME FLASH ADDRESS. + XOR C ; IF THE SAME ON BOTH READS + BIT 6,A ; THEN ERASE IS COMPLETE SO EXIT. +; + JR Z,MD_WT5 ; BIT 6 = 0 IF SAME ON SUCCESSIVE READS = COMPLETE + ; BIT 6 = 1 IF DIFF ON SUCCESSIVE READS = INCOMPLETE +; + LD A,C ; OPERATION IS NOT COMPLETE. CHECK TIMEOUT BIT (BIT 5). + BIT 5,C ; IF NO TIMEOUT YET THEN LOOP BACK AND KEEP CHECKING TOGGLE STATUS + JR Z,MD_WT4 ; IF BIT 5=0 THEN RETRY; NZ TRUE IF BIT 5=1 +; + LD A,(HL) ; WE GOT A TIMOUT. RECHECK TOGGLE BIT IN CASE WE DID COMPLETE + XOR (HL) ; THE OPERATION. DO TWO SUCCESSIVE READS. ARE THEY THE SAME? + BIT 6,A ; IF THEY ARE THEN OPERATION WAS COMPLETED + JR Z,MD_WT5 ; OTHERWISE ERASE OPERATION FAILED OR TIMED OUT. +; + LD C,$F0 ; COMMON FAIL STATUS / PREPARE DEVICE RESET CODE + LD (HL),C ; WRITE DEVICE RESET + JR MD_WT6 +MD_WT5: LD C,L ; SET SUCCESS STATUS +; +MD_WT6: POP AF ; RETURN TO ORIGINAL BANK + JP HBX_BNKSEL ; WHICH IS OUR RAM BIOS COPY +; +MD_S_SZ .EQU $-MD_FERAS_R ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED +; +;====================================================================== +; FLASH READ SECTOR. +; +; SELECT THE APPROPRIATE BANK / ADDRESS +; READ SECTOR OF 4096 BYTES, BYTE AT A TIME +; SELECT SOURCE BANK, READ DATA, +; SELECT DESTINATION BANK, WRITE DATA +; DESTINATION BANK IS ALWAYS CURRENT BANK +; +; ON ENTRY BC CONTAINS BANK AND SECTOR DATA +; DE = 0000 BYTE COUNT +; IX POINTS TO DATA TO BE WRITTEN +; A CONTAINS CURRENT BANK +; ON EXIT NO STATUS RETURNED +;====================================================================== +; + .DB MD_R_SZ ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED +MD_FREAD_R: ; THIS CODE GETS RELOCATED TO HIGH MEMORY +; + LD H,C ; SECTOR + LD L,D ; ADDRESS +; + PUSH AF ; SAVE CURRENT BANK +; +MD_FRD1:LD A,B ; CHANGE TO SOURCE BANK + CALL HBX_BNKSEL ; READ + LD C,(HL) ; BYTE +; + POP AF ; RESTORE CURRENT BANK + PUSH AF ; AND SAVE A COPY FOR NEXT LOOP + CALL HBX_BNKSEL ; SELECT BANK TO WRITE TO +; + LD (IX+0),C ; WRITE BYTE +; + INC HL ; NEXT SOURCE LOCATION + INC IX ; NEXT DESTINATION LOCATION +; + INC DE ; CONTINUE READING UNTIL + BIT 4,D ; WE HAVE DONE ONE SECTOR + JR Z,MD_FRD1 +; + POP AF + RET +; +MD_R_SZ .EQU $-MD_FREAD_R ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED +; +;====================================================================== +; FLASH VERIFY SECTOR. +; +; SELECT THE APPROPRIATE BANK / ADDRESS +; VERIFY SECTOR OF 4096 BYTES, BYTE AT A TIME +; SELECT SOURCE BANK, READ DATA, +; SELECT DESTINATION BANK, COMPARE DATA +; DESTINATION BANK IS ALWAYS CURRENT BANK +; +; ON ENTRY BC CONTAINS BANK AND SECTOR DATA +; DE = 0000 BYTE COUNT +; IX POINTS TO DATA TO BE VERIFIED +; A CONTAINS CURRENT BANK +; ON EXIT C RETURNS STATUS 0=SUCCESS NZ=FAIL +;====================================================================== +; + .DB MD_V_SZ ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED +MD_FVERI_R: ; THIS CODE GETS RELOCATED TO HIGH MEMORY +; + LD H,C ; SECTOR + LD L,D ; ADDRESS +; + PUSH AF ; SAVE CURRENT BANK +; +MD_FVE1:LD A,B ; SELECT BANK + CALL HBX_BNKSEL ; TO READ + LD C,(HL) ; READ BYTE +; + POP AF ; RESTORE CURRENT BANK + PUSH AF ; AND SAVE A COPY FOR NEXT LOOP + CALL HBX_BNKSEL ; TO VERIFY AGAINST +; + LD A,C + SUB (IX+0) ; COMPARE BYTE + LD C,A ; SET STATUS + JR NZ,MD_FVE2 ; EXIT IF MISMATCH +; + INC HL ; NEXT SOURCE LOCATION + INC IX ; NEXT DESTINATION LOCATION +; + INC DE ; CONTINUE READING UNTIL + BIT 4,D ; WE HAVE DONE ONE SECTOR + JR Z,MD_FVE1 +; +MD_FVE2:POP AF + RET +; +MD_V_SZ .EQU $-MD_FVERI_R ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED +; +;====================================================================== +; FLASH WRITE SECTOR. +; +; SELECT THE APPROPRIATE BANK / ADDRESS +; WRITE 1 SECTOR OF 4096 BYTES, BYTE AT A TIME +; ISSUE WRITE BYTE COMMAND AND WRITE THE DATA BYTE +; POLL TOGGLE BIT FOR COMPLETION STATUS. +; SELECT ORIGINAL BANK +; +; ON ENTRY BC CONTAINS BANK AND SECTOR DATA +; IX POINTS TO DATA TO BE WRITTEN +; DE = 0000 BYTE COUNT +; A CONTAINS CURRENT BANK +; ON EXIT NO STATUS IS RETURNED +;====================================================================== +; + .DB MD_W_SZ ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED +MD_FWRIT_R: ; THIS CODE GETS RELOCATED TO HIGH MEMORY +; + LD H,C ; SECTOR + LD L,D ; ADDRESS +; + PUSH AF ; SAVE CURRENT BANK +MD_FWR1:CALL HBX_BNKSEL ; SELECT BANK TO READ +; + LD C,(IX+0) ; READ IN BYTE +; + LD A,B ; SELECT BANK + CALL HBX_BNKSEL ; TO PROGRAM +; + LD A,$AA ; COMMAND + LD ($5555),A ; SETUP + LD A,$55 + LD ($2AAA),A +; + LD A,$A0 ; WRITE + LD ($5555),A ; COMMAND +; + LD (HL),C ; WRITE OUT BYTE +; +; ; DO TWO SUCCESSIVE READS +MD_FWR2:LD A,(HL) ; FROM THE SAME FLASH ADDRESS. + LD C,(HL) ; IF TOGGLE BIT (BIT 6) + XOR C ; IS THE SAME ON BOTH READS + BIT 6,A ; THEN WRITE IS COMPLETE SO EXIT. + JR NZ,MD_FWR2 ; Z TRUE IF BIT 6=0 I.E. "NO TOGGLE" WAS DETECTED. +; + INC HL ; NEXT DESTINATION LOCATION + INC IX ; NEXT SOURCE LOCATION +; + POP AF ; RESTORE CURRENT BANK + PUSH AF ; AND SAVE A COPY FOR NEXT LOOP +; + INC DE ; CONTINUE WRITING UNTIL + BIT 4,D ; WE HAVE DONE ONE SECTOR + JR Z,MD_FWR1 +; + POP AF ; RESTORE CURRENT BANK + JP HBX_BNKSEL ; RETURN TO ORIGINAL BANK WHICH IS OUR RAM BIOS COPY +; +MD_W_SZ .EQU $-MD_FWRIT_R ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED +; +;====================================================================== +; ERASE FLASH CHIP. +; +; SELECT THE APPROPRIATE BANK / ADDRESS +; ISSUE ERASE COMMAND +; POLL TOGGLE BIT FOR COMPLETION STATUS. +; SELECT ORIGINAL BANK +; +; ON ENTRY BC CONTAINS BANK AND SECTOR DATA +; A CONTAINS CURRENT BANK +; ON EXIT A RETURNS STATUS 0=SUCCESS FF=FAIL +;====================================================================== +; + .DB MD_E_SZ ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED +MD_FERAC_R: ; THIS CODE GETS RELOCATED TO HIGH MEMORY +; + PUSH AF ; SAVE CURRENT BANK + LD A,B ; SELECT BANK + CALL HBX_BNKSEL ; TO PROGRAM +; + LD HL,$5555 ; LD A,$AA ; COMMAND + LD (HL),$AA ; LD ($5555),A ; SETUP + LD A,L ; LD A,$55 + LD ($2AAA),A ; LD ($2AAA),A + LD (HL),$80 ; LD A,$80 + LD (HL),$AA ; LD ($5555),A + LD A,L ; LD A,$AA + LD ($2AAA),A ; LD ($5555),A + LD (HL),$10 ; LD A,$55 + ; LD ($2AAA),A + ; LD A,$10 + ; LD ($5555),A +; +FF_WT2: LD A,(HL) ; DO TWO SUCCESSIVE READS FROM THE SAME FLASH ADDRESS. + LD C,(HL) ; IF TOGGLE BIT (BIT 6) + XOR C ; IS THE SAME ON BOTH READS + BIT 6,A ; THEN ERASE IS COMPLETE SO EXIT. + JR Z,FF_WT1 ; Z TRUE IF BIT 6=0 I.E. "NO TOGGLE" WAS DETECTED. +; + LD A,C ; OPERATION IS NOT COMPLETE. CHECK TIMEOUT BIT (BIT 5). + BIT 5,C ; IF NO TIMEOUT YET THEN LOOP BACK AND KEEP CHECKING TOGGLE STATUS + JR Z,FF_WT2 ; IF BIT 5=0 THEN RETRY; NZ TRUE IF BIT 5=1 +; + LD A,(HL) ; WE GOT A TIMEOUT. RECHECK TOGGLE BIT IN CASE WE DID COMPLETE + XOR (HL) ; THE OPERATION. DO TWO SUCCESSIVE READS. ARE THEY THE SAME? + BIT 6,A ; IF THEY ARE THEN OPERATION WAS COMPLETED + JR Z,FF_WT1 ; OTHERWISE ERASE OPERATION FAILED OR TIMED OUT. +; + LD (HL),$F0 ; WRITE DEVICE RESET + LD C,$FF ; SET FAIL STATUS + JR FF_WT3 +; +FF_WT1: LD C,0 ; SET SUCCESS STATUS +FF_WT3: POP AF +; LD A,B ; RETURN TO ORIGINAL BANK + JP HBX_BNKSEL ; WHICH IS OUR RAM BIOS COPY +; +MD_E_SZ .EQU $-MD_FERAC_R ; SIZE OF RELOCATABLE CODE BUFFER REQUIRED + +;====================================================================== +; +; RELOCATABLE CODE SPACE REQUIREMENTS CHECK +; +;====================================================================== +; +MD_CSIZE .EQU 0 +; +#IF (MD_W_SZ>MD_CSIZE) +MD_CSIZE .SET MD_W_SZ +#ENDIF +#IF (MD_S_SZ>MD_CSIZE) +MD_CSIZE .SET MD_S_SZ +#ENDIF +#IF (MD_I_SZ>MD_CSIZE) +MD_CSIZE .SET MD_I_SZ +#ENDIF +#IF (MD_R_SZ>MD_CSIZE) +MD_CSIZE .SET MD_R_SZ +#ENDIF +#IF (MD_V_SZ>MD_CSIZE) +MD_CSIZE .SET MD_V_SZ +#ENDIF +#IF (MD_E_SZ>MD_CSIZE) +MD_CSIZE .SET MD_E_SZ +#ENDIF +; +#IF (MD_CSIZE>64) + .ECHO "Warning: Flash code exceeds available space by " + .ECHO MD_CSIZE-64 + .ECHO " bytes.\n" + .ECHO "MD_FIDEN_R " + .ECHO MD_I_SZ + .ECHO "\n" +; + .ECHO "MD_FREAD_R " + .ECHO MD_R_SZ + .ECHO "\n" +; + .ECHO "MD_FVERI_R " + .ECHO MD_V_SZ + .ECHO "\n" +; + .ECHO "MD_FERAS_R " + .ECHO MD_S_SZ + .ECHO "\n" +; + .ECHO "MD_FWRIT_R " + .ECHO MD_W_SZ + .ECHO "\n" +; + .ECHO "MD_FERAC_R " + .ECHO MD_E_SZ + .ECHO "\n" +#ENDIF \ No newline at end of file diff --git a/Source/HBIOS/game.asm b/Source/HBIOS/game.asm index 8bbce38b..1ea2303c 100644 --- a/Source/HBIOS/game.asm +++ b/Source/HBIOS/game.asm @@ -300,9 +300,14 @@ EXIT: ; CALL BDOS CALL PRTSTRDE - LD A,00H - LD HL,0000H - JP 0FFF9H + ;LD A,00H + ;LD HL,0000H + ;JP 0FFF9H + + LD B,0F0H + LD C,01H + CALL 0FFF0H + ; RET ISOVER: @@ -1177,10 +1182,12 @@ PRTSTR: COUT: PUSH AF PUSH BC PUSH DE + PUSH HL LD B,01H - LD C,0 + LD C,80H LD E,A RST 08 + POP HL POP DE POP BC POP AF @@ -1197,10 +1204,14 @@ COUTE: PUSH AF ; WAIT FOR A CHARACTER FROM THE CONSOLE DEVICE AND RETURN IT IN A ; CIN: PUSH BC + PUSH DE + PUSH HL LD B,00H - LD C,00H + LD C,80H RST 08 LD A,E + POP HL + POP DE POP BC RET diff --git a/Source/HBIOS/gdc.asm b/Source/HBIOS/gdc.asm new file mode 100644 index 00000000..8ddd7603 --- /dev/null +++ b/Source/HBIOS/gdc.asm @@ -0,0 +1,329 @@ +;====================================================================== +; UPD7220 GRAPHICS DEVICE CONTROLLER +;====================================================================== +; +;====================================================================== +; GDC DRIVER - CONSTANTS +;====================================================================== +; +#IF (GDCMODE == GDCMODE_ECB) +GDC_BASE .EQU $?? ; GDC BASE I/O PORT +GDC_DAC_BASE .EQU $?? ; RAMDAC BASE I/O PORT +#ENDIF +; +#IF (GDCMODE == GDCMODE_RPH) +GDC_KBDDATA .EQU $8C ; KBD CTLR DATA PORT +GDC_KBDST .EQU $8D ; KBD CTLR STATUS/CMD PORT +GDC_BASE .EQU $90 ; GDC BASE I/O PORT +GDC_DAC_BASE .EQU $98 ; RAMDAC BASE I/O PORT +#ENDIF +; +GDC_STAT .EQU GDC_BASE + 0 ; STATUS PORT +GDC_CMD .EQU GDC_BASE + 1 ; COMMAND PORT +GDC_PARAM .EQU GDC_BASE + 0 ; PARAM PORT +GDC_READ .EQU GDC_BASE + 1 ; READ PORT +GDC_DAC_WR .EQU GDC_DAC_BASE + 0 ; RAMDAC ADR WRITE +GDC_DAC_RD .EQU GDC_DAC_BASE + 3 ; RAMDAC ADR READ +GDC_DAC_PALRAM .EQU GDC_DAC_BASE + 1 ; RAMDAC PALETTE RAM +GDC_DAC_PIXMSK .EQU GDC_DAC_BASE + 2 ; RAMDAC PIXEL READ MASK +GDC_DAC_OVL_WR .EQU GDC_DAC_BASE + 4 ; RAMDAC OVERLAY WRITE +GDC_DAC_OVL_RD .EQU GDC_DAC_BASE + 7 ; RAMDAC OVERLAY READ +GDC_DAC_OVL_RAM .EQU GDC_DAC_BASE + 5 ; RAMDAC OVERLAY RAM +; +GDC_ROWS .EQU 25 +GDC_COLS .EQU 80 +; +; *** TODO: CGA AND EGA ARE PLACEHOLDERS. THESE EQUATES SHOULD +; BE USED TO ALLOW FOR MULTIPLE MONITOR TIMINGS AND/OR FONT +; DEFINITIONS. +; +#IF (GDCMON == GDCMON_CGA) + #DEFINE USEFONTCGA + #DEFINE GDC_FONT FONTCGA +#ENDIF +; +#IF (GDCMON == GDCMON_EGA) + #DEFINE USEFONT8X16 + #DEFINE GDC_FONT FONT8X16 +#ENDIF +; +TERMENABLE .SET TRUE ; INCLUDE TERMINAL PSEUDODEVICE DRIVER +; +;====================================================================== +; GDC DRIVER - INITIALIZATION +;====================================================================== +; +GDC_INIT: + LD IY,GDC_IDAT ; POINTER TO INSTANCE DATA + + CALL NEWLINE + PRTS("GDC: MODE=$") +#IF (GDCMODE == GDCMODE_ECB) + PRTS("ECB$") +#ENDIF +#IF (GDCMODE == GDCMODE_RPH) + PRTS("RPH$") +#ENDIF +; +#IF (GDCMON == GDCMON_CGA) + PRTS(" CGA$") +#ENDIF +#IF (GDCMON == GDCMON_EGA) + PRTS(" EGA$") +#ENDIF +; + PRTS(" IO=0x$") + LD A,GDC_BASE + CALL PRTHEXBYTE + CALL GDC_PROBE ; CHECK FOR HW PRESENCE + JR Z,GDC_INIT1 ; CONTINUE IF HW PRESENT +; + ; HARDWARE NOT PRESENT + PRTS(" NOT PRESENT$") + OR $FF ; SIGNAL FAILURE + RET +; +GDC_INIT1: + CALL GDC_CRTINIT ; SETUP THE GDC CHIP REGISTERS + CALL GDC_VDARES ; RESET GDC + CALL KBD_INIT ; INITIALIZE KEYBOARD DRIVER + + ; ADD OURSELVES TO VDA DISPATCH TABLE + LD BC,GDC_FNTBL ; BC := FUNCTION TABLE ADDRESS + LD DE,GDC_IDAT ; DE := GDC INSTANCE DATA PTR + CALL VDA_ADDENT ; ADD ENTRY, A := UNIT ASSIGNED + + ; INITIALIZE EMULATION + LD C,A ; C := ASSIGNED VIDEO DEVICE NUM + LD DE,GDC_FNTBL ; DE := FUNCTION TABLE ADDRESS + LD HL,GDC_IDAT ; HL := GDC INSTANCE DATA PTR + CALL TERM_ATTACH ; DO IT + + XOR A ; SIGNAL SUCCESS + RET +; +;====================================================================== +; GDC DRIVER - VIDEO DISPLAY ADAPTER (VDA) FUNCTIONS +;====================================================================== +; +GDC_FNTBL: + .DW GDC_VDAINI + .DW GDC_VDAQRY + .DW GDC_VDARES + .DW GDC_VDADEV + .DW GDC_VDASCS + .DW GDC_VDASCP + .DW GDC_VDASAT + .DW GDC_VDASCO + .DW GDC_VDAWRC + .DW GDC_VDAFIL + .DW GDC_VDACPY + .DW GDC_VDASCR + .DW KBD_STAT + .DW KBD_FLUSH + .DW KBD_READ + .DW GDC_VDARDC +#IF (($ - GDC_FNTBL) != (VDA_FNCNT * 2)) + .ECHO "*** INVALID GDC FUNCTION TABLE ***\n" + !!!!! +#ENDIF +; +GDC_VDAINI: + ; RESET VDA + CALL GDC_VDARES ; RESET VDA + XOR A ; SIGNAL SUCCESS + RET +; +GDC_VDAQRY: ; VIDEO INFORMATION QUERY + LD C,$00 ; MODE ZERO IS ALL WE KNOW + LD D,GDC_ROWS ; ROWS + LD E,GDC_COLS ; COLS + LD HL,0 ; EXTRACTION OF CURRENT BITMAP DATA NOT SUPPORTED YET + XOR A ; SIGNAL SUCCESS + RET +; +GDC_VDARES: ; VIDEO SYSTEM RESET + ; *** TODO: RESET VIDEO SYSTEM HERE, CLEAR SCREEN, + ; CURSOR TO TOP LEFT, CLEAR ATTRIBUTES + XOR A + RET +; +GDC_VDADEV: ; VIDEO DEVICE INFORMATION + LD D,VDADEV_GDC ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL UNIT IS ALWAYS ZERO + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,GDC_BASE ; L := BASE I/O ADDRESS + XOR A ; SIGNAL SUCCESS + RET +; +GDC_VDASCS: ; SET CURSOR STYLE + SYSCHKERR(ERR_NOTIMPL) + RET + +GDC_VDASCP: ; SET CURSOR POSITION + CALL GDC_XY ; SET CURSOR POSITION + XOR A ; SIGNAL SUCCESS + RET + +GDC_VDASAT: ; SET ATTRIBUTES + LD A,E ; GET THE INCOMING ATTRIBUTE + LD (GDC_ATTR),A ; AND SAVE FOR LATER + XOR A ; SIGNAL SUCCESS + RET + +GDC_VDASCO: ; SET COLOR + LD A,E ; GET THE INCOMING COLOR + LD (GDC_COLOR),A ; AND SAVE FOR LATER + XOR A ; SIGNAL SUCCESS + RET + +GDC_VDAWRC: ; WRITE CHARACTER + LD A,E ; CHARACTER TO WRITE GOES IN A + CALL GDC_PUTCHAR ; PUT IT ON THE SCREEN + XOR A ; SIGNAL SUCCESS + RET + +GDC_VDAFIL: ; FILL WITH CHARACTER + LD A,E ; FILL CHARACTER GOES IN A + EX DE,HL ; FILL LENGTH GOES IN DE + CALL GDC_FILL ; DO THE FILL + XOR A ; SIGNAL SUCCESS + RET + +GDC_VDACPY: ; COPY CHARACTERS/ATTRIBUTES + ; LENGTH IN HL, SOURCE ROW/COL IN DE, DEST IS GDC_POS + ; BLKCPY USES: HL=SOURCE, DE=DEST, BC=COUNT + PUSH HL ; SAVE LENGTH + CALL GDC_XY2IDX ; ROW/COL IN DE -> SOURCE ADR IN HL + POP BC ; RECOVER LENGTH IN BC + LD DE,(GDC_POS) ; PUT DEST IN DE + JP GDC_BLKCPY ; DO A BLOCK COPY + +GDC_VDASCR: ; SCROLL ENTIRE SCREEN + LD A,E ; LOAD E INTO A + OR A ; SET FLAGS + RET Z ; IF ZERO, WE ARE DONE + PUSH DE ; SAVE E + JP M,GDC_VDASCR1 ; E IS NEGATIVE, REVERSE SCROLL + CALL GDC_SCROLL ; SCROLL FORWARD ONE LINE + POP DE ; RECOVER E + DEC E ; DECREMENT IT + JR GDC_VDASCR ; LOOP +GDC_VDASCR1: + CALL GDC_RSCROLL ; SCROLL REVERSE ONE LINE + POP DE ; RECOVER E + INC E ; INCREMENT IT + JR GDC_VDASCR ; LOOP +; +GDC_VDARDC: ; READ CHAR/ATTR VALUE FROM VIDEO BUFFER + OR $FF ; UNSUPPORTED FUNCTION + RET +; +;====================================================================== +; GDC DRIVER - PRIVATE DRIVER FUNCTIONS +;====================================================================== +; +;---------------------------------------------------------------------- +; PROBE FOR GDC HARDWARE +;---------------------------------------------------------------------- +; +; ON RETURN, ZF SET INDICATES HARDWARE FOUND +; +; *** TODO: IMPLEMENT THIS +; +GDC_PROBE: + XOR A ; SIGNAL SUCCESS + RET ; RETURN WITH ZF SET BASED ON CP +; +;---------------------------------------------------------------------- +; DISPLAY CONTROLLER CHIP INITIALIZATION +;---------------------------------------------------------------------- +; +; *** TODO: IMPLEMENT THIS +; +GDC_CRTINIT: + XOR A ; SIGNAL SUCCESS + RET +; +;---------------------------------------------------------------------- +; SET CURSOR POSITION TO ROW IN D AND COLUMN IN E +;---------------------------------------------------------------------- +; +GDC_XY: + CALL GDC_XY2IDX ; CONVERT ROW/COL TO BUF IDX + LD (GDC_POS),HL ; SAVE THE RESULT (DISPLAY POSITION) + ; *** TODO: MOVE THE CURSOR + RET +; +;---------------------------------------------------------------------- +; CONVERT XY COORDINATES IN DE INTO LINEAR INDEX IN HL +; D=ROW, E=COL +;---------------------------------------------------------------------- +; +GDC_XY2IDX: + LD A,E ; SAVE COLUMN NUMBER IN A + LD H,D ; SET H TO ROW NUMBER + LD E,GDC_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 POSITION, ADVANCE CURSOR +;---------------------------------------------------------------------- +; +GDC_PUTCHAR: + ; *** TODO: IMPLEMENT THIS + RET +; +;---------------------------------------------------------------------- +; 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 +;---------------------------------------------------------------------- +; +GDC_FILL: + ; *** TODO: IMPLEMENT THIS + RET +; +;---------------------------------------------------------------------- +; SCROLL ENTIRE SCREEN FORWARD BY ONE LINE (CURSOR POSITION UNCHANGED) +;---------------------------------------------------------------------- +; +GDC_SCROLL: + ; *** TODO: IMPLEMENT THIS + RET +; +;---------------------------------------------------------------------- +; REVERSE SCROLL ENTIRE SCREEN BY ONE LINE (CURSOR POSITION UNCHANGED) +;---------------------------------------------------------------------- +; +GDC_RSCROLL: + ; *** TODO: IMPLEMENT THIS + RET +; +;---------------------------------------------------------------------- +; BLOCK COPY BC BYTES FROM HL TO DE +;---------------------------------------------------------------------- +; +GDC_BLKCPY: + ; *** TODO: IMPLEMENT THIS + RET +; +;================================================================================================== +; GDC DRIVER - DATA +;================================================================================================== +; +GDC_ATTR .DB 0 ; CURRENT ATTRIBUTES +GDC_COLOR .DB 0 ; CURRENT COLOR +GDC_POS .DW 0 ; CURRENT DISPLAY POSITION +; +;================================================================================================== +; GDC DRIVER - INSTANCE DATA +;================================================================================================== +; +GDC_IDAT: + .DB GDC_KBDST + .DB GDC_KBDDATA diff --git a/Source/HBIOS/hbios.asm b/Source/HBIOS/hbios.asm index 4e9a5f8a..4210ffd9 100644 --- a/Source/HBIOS/hbios.asm +++ b/Source/HBIOS/hbios.asm @@ -53,6 +53,8 @@ ; - build.inc ; - config/_.asm ; - cfg_.asm +; - [z180.inc|z280.inc] +; - [eipc.inc] ; - .asm ; - .asm ; - util.asm @@ -61,14 +63,15 @@ ; - decode.asm ; - encode.asm ; - [xio|mio].asm -; - dsky.asm +; - [dsky.asm|dskyng.asm] ; - unlzsa2s.asm ; -; ; INCLUDE GENERIC STUFF ; #INCLUDE "std.asm" ; +#DEFINE HBIOS +; ; MAKE SURE EXACTLY ONE OF ROMBOOT, APPBOOT, IMGBOOT IS DEFINED. ; MODCNT .EQU 0 @@ -86,6 +89,20 @@ MODCNT .SET MODCNT + 1 !!! ; FORCE AN ASSEMBLY ERROR #ENDIF ; +; SOME HARDWARE REQUIRES A SPECIFIC ROMSIZE (NOTABLY ZZRCC) OR THE +; RESULTING BUILD IMAGES WILL BE CORRUPT. ROMSIZE_CHK IS SPECIFIED +; IN THE CONFIG FILE AND IS VERIFIED AGAINST THE ROMSIZE BEING USED +; BY THE BUILD. A ROMSIZE_CHK VALUE OF 0 INDICATES THE VERIFICATION +; IS DISABLED (WHICH IT USUALLY IS). +; +#IF (ROMSIZE_CHK != 0) & (ROMSIZE != ROMSIZE_CHK) + .ECHO "*** ERROR: ROMSIZE VALUE VERIFICATION FAILURE.\n" + .ECHO "THIS CONFIGURATION REQUIRES A ROMSIZE OF " \ .ECHO ROMSIZE_CHK \ .ECHO ".\n" + .ECHO "BUILD IS USING A ROMSIZE OF " \ .ECHO ROMSIZE \ .ECHO ".\n" + .ECHO "SEE COMMENTS IN HBIOS.ASM.\n" + !!! ; FORCE AN ASSEMBLY ERROR +#ENDIF +; ; ; #IF (DIAGENABLE) @@ -97,39 +114,109 @@ MODCNT .SET MODCNT + 1 #DEFINE DIAG(N) \; #ENDIF ; +; SCxxx: LED Port=0x0E, bit 2, inverted, dedicated port +; TinyZ80: LED Port=0x6E, bit 0, inverted, dedicated port +; Z80-512K: LED Port=0x6E, bit 0, inverted, dedicated port +; MBC: LED Port=0x70, bits 1-0, normal, shared w/ RTC port +; #IF (LEDENABLE) -#DEFINE LED(N) PUSH AF - #DEFCONT \ LD A,~N - #DEFCONT \ OUT (LEDPORT),A - #DEFCONT \ POP AF + #IF (LEDMODE == LEDMODE_STD) +#DEFINE LED(N) PUSH AF + #DEFCONT \ LD A,~N + #DEFCONT \ OUT (LEDPORT),A + #DEFCONT \ POP AF + #ENDIF + #IF (LEDMODE == LEDMODE_RTC) +#DEFINE LED(N) PUSH AF + #DEFCONT \ LD A,(HB_RTCVAL) + #DEFCONT \ AND %11111100 + #DEFCONT \ OR (N & %00000011) + #DEFCONT \ LD (HB_RTCVAL),A + #DEFCONT \ OUT (LEDPORT),A + #DEFCONT \ POP AF + #ENDIF #ELSE #DEFINE LED(N) \; #ENDIF ; +#DEFINE SYSCHKERR(HB_ERR) \ + #DEFCONT \ CALL SYSCHKA + #DEFCONT \ LD A,HB_ERR + #DEFCONT \ OR A +; ; ; #IF (INTMODE == 0) ; NO INTERRUPT HANDLING #DEFINE HB_DI ; #DEFINE HB_EI ; -#ENDIF -#IF ((INTMODE == 1) | (INTMODE == 2)) -; MODE 1 OR 2 INTERRUPT HANDLING +#ELSE + #IF (CPUFAM == CPU_Z280) + #IF (INTMODE == 3) +; Z280 MODE 3 INTERRUPT HANDLING (INTA, C/T 0, & UART RCVR ENABLED) +#DEFINE HB_DI DI +#DEFINE HB_EI EI $0B + #ELSE +; Z280 MODE 1/2 INTERRUPT HANDLING +#DEFINE HB_DI DI +#DEFINE HB_EI EI + #ENDIF + #ELSE #DEFINE HB_DI DI #DEFINE HB_EI EI + #ENDIF #ENDIF -#IF (INTMODE > 2) +; +#IF (INTMODE > 3) .ECHO "*** ERROR: INVALID INTMODE SETTING!!!\n" !!! ; FORCE AN ASSEMBLY ERROR #ENDIF ; +#IF (INTMODE == 3) + #IF (CPUFAM != CPU_Z280) + .ECHO "*** ERROR: INTMODE 3 REQUIRES Z280 FAMILY CPU!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR + #ENDIF + #IF (MEMMGR != MM_Z280) + .ECHO "*** ERROR: INTMODE 3 REQUIRES Z280 MEMORY MANAGER!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR + #ENDIF +#ENDIF +; +#IF (MEMMGR == MM_Z280) + #IF (INTMODE != 3) + .ECHO "*** ERROR: Z280 MEMORY MANAGER REQUIRES INTMODE 3!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR + #ENDIF + #IF (CPUFAM != CPU_Z280) + .ECHO "*** ERROR: Z280 MEMORY MANAGER REQUIRES Z280 FAMILY CPU!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR + #ENDIF +#ENDIF +; ; ; -#IF (CTCENABLE) -CTCA .EQU CTCBASE + 0 ; CTC: CHANNEL A REGISTER ADR -CTCB .EQU CTCBASE + 1 ; CTC: CHANNEL B REGISTER ADR -CTCC .EQU CTCBASE + 2 ; CTC: CHANNEL C REGISTER ADR -CTCD .EQU CTCBASE + 3 ; CTC: CHANNEL D REGISTER ADR +; THE RTCDEF EQUATE IS INITIALIZED HERE AND UPDATED BY DRIVER INCLUDES +; THAT SHARE THE RTC LATCH. AS EACH DRIVER FILE IS INCLUDED, IT CAN +; USE .SET TO SET ANY BITS THEY OWN WITHIN THE RTC LATCH BYTE. +; SINCE RTCDEF IS CHANGED AFTER IT NEEDS TO BE USED BY THE CODE, IT +; CANNOT BE USED DIRECTLY TO SET THE LATCH. INSTEAD, THE FINAL VALUE +; OF RTCDEF IS USED TO INITIALIZE A STORAGE BYTE CALLED RTCDEFVAL AT +; THE END OF HBIOS.ASM. SO (RTCDEFVAL) CAN BE USED ANYWHERE IN +; HBIOS.ASM TO ACCESS THE FINAL RTCDEF VALUE. +; +RTCDEF .EQU 0 ; ALLOWS DRIVERS TO SET BITS +; +#IF (PLATFORM == PLT_SCZ180) +RTCDEF .SET RTCDEF | %00000001 ; SC128 I2C SCL BIT +#ENDIF +; +#IF ((CPUSPDCAP==SPD_HILO) & (PLATFORM==PLT_MBC)) +RTCDEF .SET RTCDEF & ~%00001000 ; INITIAL SPEED LOW +#ENDIF +; +#IF ((CPUSPDCAP==SPD_HILO) & (PLATFORM==PLT_SBC)) +RTCDEF .SET RTCDEF | %00001000 ; INITIAL SPEED LOW #ENDIF ; ; @@ -144,6 +231,7 @@ CTCD .EQU CTCBASE + 3 ; CTC: CHANNEL D REGISTER ADR ; .FILL (000H - $),0FFH ; RST 0 JP HB_START + .DB 0 ; SIG PTR STARTS AT $0004 .DW ROM_SIG .FILL (008H - $),0FFH ; RST 8 JP HB_INVOKE ; INVOKE HBIOS FUNCTION @@ -158,11 +246,11 @@ CTCD .EQU CTCBASE + 3 ; CTC: CHANNEL D REGISTER ADR .FILL (030H - $),0FFH ; RST 30 RET .FILL (038H - $),0FFH ; RST 38 / IM1 INT -#IF (INTMODE == 1) + #IF (INTMODE == 1) JP INT_IM1 ; JP TO INTERRUPT HANDLER IN HI MEM -#ELSE - RETI ; RETURN W/ INTS DISABLED -#ENDIF + #ELSE + RET ; RETURN W/ INTS DISABLED + #ENDIF .FILL (066H - $),0FFH ; NMI RETN ; @@ -209,6 +297,8 @@ CB_SERDEV .DB 0 ; PRIMARY SERIAL UNIT IS UNIT #0 BY FIAT CB_CRTDEV .DB $FF ; PRIMARY CRT UNIT, $FF UNTIL AFTER HBIOS INIT CB_CONDEV .DB $FF ; CONSOLE UNIT, $FF UNTIL AFTER HBIOS INIT ; +CB_DIAGLVL .DB DIAGLVL ; ROMWBW HBIOS DIAGNOSTIC LEVEL +; ; MEMORY MANAGEMENT VARIABLES START AT $20 ; .FILL (HCB + $20 - $),0 @@ -216,7 +306,7 @@ CB_CONDEV .DB $FF ; CONSOLE UNIT, $FF UNTIL AFTER HBIOS INIT CB_HEAP .DW 0 CB_HEAPTOP .DW 0 ; -; STANDARD BANK ID'S START AT $D8 +; STANDARD BANK ID'S START AT $D8. DEFAULT VALUES FOR 512KB SYSTEM WITH NO RESERVED BANKS ; .FILL (HCB + $D8 - $),0 ; @@ -269,13 +359,10 @@ HBX_IDENT: ; ACCOMMODATE FREERTOS. HBX_BUF IS ONLY USED AS A BOUNCE BUFFER, SO IT'S ; USE WILL NEVER OVERLAP WITH BELOW. ; -; HBX_INVOKE IS NOT RE-ENTRANT! HB_INVBNK CAN BE USED GLOBALLY TO DETERMINE -; IF HBIOS IS ALREADY ACTIVE. HB_INVBNK WILL HAVE A VALUE != $FF WHEN HBIOS -; IS ACTIVE. ON RETURN, HB_INVBNK IS SET TO $FF TO INDICATE HBIOS IS NOT -; ACTIVE. +; WARNING: HBX_INVOKE IS *NOT* REENTRANT! ; HBX_INVOKE: - +; #IF (HBIOS_MUTEX == TRUE) PUSH HL ; SAVE HL LD HL,HB_LOCK ; POINT TO LOCK @@ -283,35 +370,54 @@ HBX_INVOKE: JR C,$-2 ; KEEP TRYING ON FAILURE POP HL ; RESTORE HL #ENDIF - +; +#IF (MEMMGR == MM_Z280) +; + LD A,(HB_CURBNK) ; GET CURRENT BANK + LD (HB_INVBNK),A ; SAVE INVOCATION BANK +; + LD A,BID_BIOS ; HBIOS BANK + LD (HB_CURBNK),A ; SET AS CURRENT BANK +; + SC HB_DISPATCH +; + PUSH AF + LD A,(HB_INVBNK) + LD (HB_CURBNK),A + POP AF +; +#ELSE +; LD (HBX_INVSP),SP ; SAVE ORIGINAL STACK FRAME LD SP,HBX_BUF_END ; BORROW HBX_BUF FOR TEMP STACK - +; LD A,(HB_CURBNK) ; GET CURRENT BANK LD (HB_INVBNK),A ; SAVE INVOCATION BANK - +; LD A,BID_BIOS ; HBIOS BANK CALL HBX_BNKSEL ; SELECT IT LD SP,HB_STACK ; NOW USE FULL HBIOS STACK IN HBIOS BANK - +; CALL HB_DISPATCH ; CALL HBIOS FUNCTION DISPATCHER - +; LD SP,HBX_BUF_END ; BORROW HBX_BUF FOR TEMP STACK PUSH AF ; SAVE AF (FUNCTION RETURN) - +; LD A,(HB_INVBNK) ; LOAD ORIGINAL BANK CALL HBX_BNKSEL ; SELECT IT POP AF ; RESTORE AF LD SP,0 ; RESTORE ORIGINAL STACK FRAME HBX_INVSP .EQU $ - 2 - +; +#ENDIF +; #IF (HBIOS_MUTEX == TRUE) PUSH HL ; SAVE HL LD HL,HB_LOCK ; POINT TO LOCK LD (HL),$FE ; RELEASE MUTEX LOCK POP HL ; RESTORE HL #ENDIF - +; RET ; RETURN TO CALLER ; ;;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -353,6 +459,7 @@ HBX_ROM: OUT (MPCL_ROM),A ; SET ROM PAGE SELECTOR RET ; DONE #ENDIF +; #IF (MEMMGR == MM_Z2) BIT 7,A ; BIT 7 SET REQUESTS RAM PAGE JR Z,HBX_ROM ; NOT SET, SELECT ROM PAGE @@ -362,17 +469,20 @@ HBX_ROM: HBX_ROM: RLCA ; TIMES 2 - GET 16K PAGE INSTEAD OF 32K OUT (MPGSEL_0),A ; BANK_0: 0K - 16K - ;OUT (DIAGPORT),A ; *DEBUG* INC A ; OUT (MPGSEL_1),A ; BANK_1: 16K - 32K + #IF (CPUFAM == CPU_Z280) + PCACHE + #ENDIF RET ; DONE #ENDIF +; #IF (MEMMGR == MM_N8) BIT 7,A ; TEST BIT 7 FOR RAM VS. ROM JR Z,HBX_ROM ; IF NOT SET, SELECT ROM PAGE ; HBX_RAM: - RES 7,A ; CLEAR BIT 7 FROM ABOVE + AND %00011111 ; AVOID WRAPPING BITS RLCA ; SCALE SELECTOR TO RLCA ; ... GO FROM Z180 4K PAGE SIZE RLCA ; ... TO DESIRED 32K PAGE SIZE @@ -388,19 +498,99 @@ HBX_ROM: LD A,N8_DEFACR ; SELECT ROM BY CLEARING BIT 7 OUT0 (N8_ACR),A ; ... IN N8 ACR REGISTER RET ; DONE -; #ENDIF +; #IF (MEMMGR == MM_Z180) RLCA ; RAM FLAG TO CARRY FLAG AND BIT 0 JR NC,HBX_BNKSEL1 ; IF NC, WANT ROM PAGE, SKIP AHEAD XOR %00100001 ; SET BIT FOR HI 512K, CLR BIT 0 HBX_BNKSEL1: + AND %00111111 ; AVOID WRAPPING BITS 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 ; +#IF (MEMMGR == MM_Z280) + PUSH BC ; SAVE BC + PUSH HL ; SAVE HL + LD B,$00 ; FIRST USER PDR + SC Z280_BNKSEL ; SYSCALL + POP HL ; RESTORE HL + POP BC ; RESTORE BC + RET ; DONE +#ENDIF +; +#IF (MEMMGR == MM_ZRC) + BIT 7,A ; BIT 7 SET REQUESTS RAM PAGE + JR Z,HBX_ROM ; NOT SET, SELECT ROM PAGE + RES 7,A ; RAM PAGE REQUESTED: CLEAR ROM BIT + ADD A,ROMSIZE / 32 ; STARTING RAM BANK NUMBER OFFSET +; +HBX_ROM: + OUT ($1F),A ; HCS WRITE TO THE BANK CONTROL REGISTER + RET ; DONE +#ENDIF +; +#IF (MEMMGR == MM_MBC) +; + #IF (INTMODE == 1) + LD (HBX_MMA),A ; SAVE ACCUM + LD A,I ; GET INT CTL REG + HB_DI ; DISABLE INTS + PUSH AF ; SAVE INT CTL REG + LD A,(HBX_MMA) ; RESTORE ACCUM + #ENDIF +; + OR A ; SET FLAGS + JP P,HBX_ROM ; BIT 7 INDICATES RAM + OUT (MPCL_ROM),A ; ENSURE ROM PAGE OUT OF MEMORY BEFORE SWITCH + ; SEE MBC RUNTIME MEMORY SIZE ADJUSTMENT +HBX_MBCMSK .EQU $+1 ; FORCE TOP 32K ; MASK POPULATED + XOR %00000000 ; TO BE IN FIRST CHIP ; DURING INITIALIZATION + OUT (MPCL_RAM),A ; SET RAM PAGE SELECTOR + JR HBX_RAMX +HBX_ROM: + OUT (MPCL_RAM),A ; ENSURE RAM PAGE OUT OF MEMORY BEFORE SWITCH + OUT (MPCL_ROM),A ; SET ROM PAGE SELECTOR +; +HBX_RAMX: +; + #IF (INTMODE == 1) + POP AF ; RESTORE INT CTL REG + JP PO,$+4 ; WERE INTS DISABLED AT ENTRY? + EI ; *** DO NOT USE HB_EI HERE *** + LD A,(HBX_MMA) ; RESTORE INCOMING ACCUM + #ENDIF +; + RET +; +HBX_MMA .DB 0 ; TEMPORARY STORAGE FOR REG A +#ENDIF +; +#IF (MEMMGR == MM_RPH) + BIT 7,A ; TEST BIT 7 FOR RAM VS. ROM + JR Z,HBX_ROM ; IF NOT SET, SELECT ROM PAGE +; +HBX_RAM: + AND %00011111 ; AVOID WRAPPING BITS + 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,RPH_DEFACR | 80H ; SELECT RAM BY SETTING BIT 7 + OUT0 (RPH_ACR),A ; ... IN RPH ACR REGISTER + RET ; DONE +; +HBX_ROM: + OR RPH_DEFACR ; COMBINE WITH DEFAULT BITS + OUT0 (RPH_ACR),A ; BANK INDEX TO RPH ACR REGISTER + XOR A ; ZERO ACCUM + OUT0 (Z180_BBR),A ; ZERO BANK BASE + RET ; DONE +#ENDIF +; ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; Copy Data - Possibly between banks. This resembles CP/M 3, but ; usage of the HL and DE registers is reversed. @@ -416,11 +606,26 @@ HBX_BNKSEL1: ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; HBX_BNKCPY: -#IF (INTMODE > 0) +#IF (MEMMGR == MM_Z280) + SC Z280_BNKCPYX ; SYSCALL TO BNKCPYX + RET +; +IOPRSAV .DW 0 ; TEMP STORAGE FOR IOPR +; +#ELSE + #IF (CPUFAM == CPU_Z280) + PUSH HL + PUSH BC + LD C,Z280_MSR + LDCTL HL,(C) + POP BC + EX (SP),HL + HB_DI + #ELSE LD A,I - DI + HB_DI PUSH AF -#ENDIF + #ENDIF LD (HBX_BC_SP),SP ; PUT STACK LD SP,HBX_TMPSTK ; ... IN HI MEM @@ -450,11 +655,18 @@ HBX_BC_LAST: LD SP,$FFFF ; RESTORE STACK HBX_BC_SP .EQU $ - 2 ; ... TO ORIGINAL VALUE -#IF (INTMODE > 0) + #IF (CPUFAM == CPU_Z280) + EX (SP),HL ; SAVE HL, RECOVER MSR + PUSH BC ; SAVE BC + LD C,Z280_MSR + LDCTL (C),HL + POP BC ; RECOVER BC + POP HL ; RECOVER HL + #ELSE POP AF JP PO,$+4 - EI -#ENDIF + EI ; *** DO NOT USE HB_EI HERE *** + #ENDIF RET ; HBX_BC_ITER: @@ -475,25 +687,40 @@ HBX_BC_ITER: POP HL ; RECOVER UPDATED SRC ADR ; HL = UPDATED SRC, DE = UPDATED DEST, BC = 0 RET +#ENDIF ; ; CALL A ROUTINE IN ANOTHER BANK. ; CALLER MUST ENSURE STACK IS ALREADY IN HIGH MEMORY AND HAS ADEQUATE SPACE. ; IF IM1 INTERRUPTS ARE POSSIBLE, CALLER MUST EITHER DISABLE THEM PRIOR TO ; BNKCALL OR MAKE SURE THAT PAGE ZERO IN TARGET BANK IS PREPARED FOR THEM. -; ON INPUT A=TARGET BANK, HL=TARGET ADDRESS +; ON INPUT A=TARGET BANK, IX=TARGET ADDRESS ; HBX_BNKCALL: - LD (HBX_TGTBNK),A ; STUFF TARGET BANK TO CALL INTO CODE BELOW - LD (HBX_TGTADR),HL ; STUFF ADDRESS TO CALL INTO CODE BELOW +; +#IF (MEMMGR == MM_Z280) + CP BID_BIOS ; CALLING HBIOS? + JR NZ,HBX_BNKCALL3 ; NOPE, DO NORMAL PROCESSING + SC HBX_BNKCALL2 ; SYSCALL TO BNKCALL2 + RET ; THEN RETURN +; +HBX_BNKCALL2: + HB_EI ; INTS ARE OK + LD (HBX_BNKCALL_GO+1),IX ; SETUP DEST ADR + PCACHE ; CRITICAL!!! +HBX_BNKCALL_GO: + JP $FFFF ; DO THE REAL WORK AND RETURN +#ENDIF +; +HBX_BNKCALL3: + LD (HBX_BNKCALL_BNK+1),A ; STUFF TARGET BANK TO CALL INTO CODE BELOW + LD (HBX_BNKCALL_ADR+1),IX ; STUFF ADDRESS TO CALL INTO CODE BELOW LD A,(HB_CURBNK) ; GET CURRENT BANK PUSH AF ; SAVE FOR RETURN -HBX_TGTBNK .EQU $ + 1 +HBX_BNKCALL_BNK: LD A,$FF ; LOAD BANK TO CALL ($FF OVERLAID AT ENTRY) CALL HBX_BNKSEL ; ACTIVATE THE NEW BANK - -HBX_TGTADR .EQU $ + 1 +HBX_BNKCALL_ADR: CALL $FFFF ; CALL ROUTINE ($FFFF IS OVERLAID ABOVE) - EX (SP),HL ; SAVE HL AND GET BANK TO RESTORE IN HL PUSH AF ; SAVE AF LD A,H ; BANK TO RESTORE TO A @@ -537,11 +764,38 @@ HBX_POKE: ; HBX_PPRET: POP AF +#IF (MEMMGR == MM_Z280) + LD A,(HB_INVBNK) ; SPECIAL CASE FOR Z280 MEM MGR +#ENDIF CALL HBX_BNKSEL LD SP,0 ; RESTORE ORIGINAL STACK FRAME HBX_PPSP .EQU $ - 2 RET ; +; SPECIAL ROUTINE IN HIGH MEMORY TO PERFORM A COLD START ON Z280 +; THIS REQUIRES US TO REMAP LOW MEMORY, THEN JUMP TO ZERO +; +#IF (MEMMGR == MM_Z280) +; +Z280_RESTART: + DI ; KILL INTERRUPTS + LD SP,HBX_LOC ; STACK IN HIGH MEMORY +; + ; COPY Z280 BANK SELECT ROUTINE TO HIGH MEMORY + LD HL,Z280_BNKSEL + LD DE,$8000 + LD BC,Z280_BNKSEL_LEN + LDIR +; + ; MAKE ROM BOOT BANK ACTIVE IN LOW SYS MEM + LD A,BID_BOOT + LD B,$10 ; FIRST SYS PDR + CALL $8000 ; DO IT +; + ; NOW JUST JUMP TO START OF ROM BOOT CODE + JP 0 +#ENDIF +; ; PRIVATE STACK AT END OF HBIOS CODE ; OCCUPIES SPACE BEFORE IVT ; @@ -552,12 +806,13 @@ HBX_INTSTKSIZ .EQU $FF00 - $ .FILL HBX_INTSTKSIZ,$FF HBX_INTSTK .EQU $ ; -#IF (HBX_INTSTKSIZ < 24) +;#IF (HBX_INTSTKSIZ < 24) +#IF (HBX_INTSTKSIZ < 22) .ECHO "*** ERROR: INTERRUPT STACK IS TOO SMALL!!!\n" !!! ; FORCE AN ASSEMBLY ERROR #ENDIF ; -#IF (INTMODE == 2) +#IF ((INTMODE == 2) | (INTMODE == 3)) ; ; HBIOS INTERRUPT SLOT ASSIGNMENTS ; @@ -567,8 +822,8 @@ HBX_INTSTK .EQU $ ; 1 CTC0B INT2 | ; 2 CTC0C TIM0 | ; 3 CTC0D TIM1 | -; 4 DMA0 +- Z180 INTERNAL -; 5 DMA1 | +; 4 UART0 DMA0 +- Z180 INTERNAL +; 5 UART1 DMA1 | ; 6 CSIO | ; 7 SIO0 SER0 | ; 8 SIO1 SER1 -+ @@ -629,47 +884,89 @@ INT_IM1: ; #IF (INTMODE > 0) ; -; COMMON INTERRUPT DISPATCHING CODE -; SETUP AND CALL HANDLER IN BIOS BANK -; HBX_INT: ; COMMON INTERRUPT ROUTING CODE +; + #IF (MEMMGR == MM_Z280) +; +; THIS CODE ASSUMES Z280 IM 3. IM 1 AND IM 2 ON Z280 +; DO NOT SAVE MSR AT INTERRUPT MAKING IT VIRTUALLY IMPOSSIBLE +; TO RETURN FROM THE INTERRUPT TO THE CORRECT MODE (SYSTEM +; OR USER). THIS IS BECAUSE THERE IS NO WAY TO KNOW WHETHER +; SYSTEM OR USER MODE WAS ACTIVE AT THE TIME OF THE INTERRUPT. ; EX (SP),HL ; SAVE HL AND GET INT JP TABLE OFFSET + ; SAVE STATE (HL SAVED PREVIOUSLY ON ORIGINAL STACK FRAME) + PUSH AF ; SAVE AF + PUSH BC ; SAVE BC + PUSH DE ; SAVE DE + PUSH IY ; SAVE IY +; + ; HANDLE INT VIA JP TABLE IN HBIOS + LD L,(HL) ; OFFSET INTO JP TABLE FOR THIS INT + LD H,HB_IVT >> 8 ; MSB OF HBIOS INT JP TABLE + CALL JPHL ; CALL HANDLER VIA INT JP TABLE +; + ; RESTORE STATE + POP IY ; RESTORE IY + POP DE ; RESTORE DE + POP BC ; RESTORE BC + POP AF ; RESTORE AF + POP HL ; RESTORE HL +; + ; BURN THE REASON CODE + EX (SP),HL ; HL TO STK, RC TO HL + POP HL ; RESTORE HL +; + CALL HBX_RETI ; RETI FOR Z80 PERIPHERALS + RETIL +; +HBX_RETI: + RETI +; + #ELSE +; +; COMMON INTERRUPT DISPATCHING CODE +; SETUP AND CALL HANDLER IN BIOS BANK +; + EX (SP),HL ; SAVE HL AND GET INT JP TABLE OFFSET +; LD (HBX_INT_SP),SP ; SAVE ORIGINAL STACK FRAME LD SP,HBX_INTSTK ; USE DEDICATED INT STACK FRAME IN HI MEM - +; ; SAVE STATE (HL SAVED PREVIOUSLY ON ORIGINAL STACK FRAME) PUSH AF ; SAVE AF PUSH BC ; SAVE BC PUSH DE ; SAVE DE PUSH IY ; SAVE IY - +; LD A,BID_BIOS ; HBIOS BANK CALL HBX_BNKSEL_INT ; SELECT IT - +; LD L,(HL) ; OFFSET INTO JP TABLE FOR THIS INT LD H,HB_IVT >> 8 ; MSB OF HBIOS INT JP TABLE - +; CALL JPHL ; CALL HANDLER VIA INT JP TABLE - +; LD A,(HB_CURBNK) ; GET PRE-INT BANK CALL HBX_BNKSEL ; SELECT IT - +; ; RESTORE STATE POP IY ; RESTORE IY POP DE ; RESTORE DE POP BC ; RESTORE BC POP AF ; RESTORE AF - +; LD SP,$FFFF ; RESTORE ORIGINAL STACK FRAME HBX_INT_SP .EQU $ - 2 - +; POP HL ; RESTORE HL - +; HB_EI ; ENABLE INTERRUPTS RETI ; AND RETURN ; + #ENDIF + #ENDIF ; ; SMALL TEMPORARY STACK FOR USE BY HBX_BNKCPY @@ -703,7 +1000,8 @@ HBX_BUF_END .EQU $ .DW 0 ; HB_DSTADR: BNKCPY DESTINATION ADDRESS .DB BID_USR ; HB_DSTBNK: BNKCPY DESTINATION BANK ID .DW 0 ; HB_CPYLEN: BNKCPY LENGTH - .FILL 5,0 ; FILLER, RESERVED FOR FUTURE HBIOS USE + .FILL 4,0 ; FILLER, RESERVED FOR FUTURE HBIOS USE + .DB 0 ; SHADOW VALUE FOR RTC LATCH PORT .DB $FE ; HB_LOCK: HBIOS MUTEX LOCK JP HBX_INVOKE ; HB_INVOKE: FIXED ADR ENTRY FOR HBX_INVOKE (ALT FOR RST 08) JP HBX_BNKSEL ; HB_BNKSEL: FIXED ADR ENTRY FOR HBX_BNKSEL @@ -727,8 +1025,11 @@ HB_ENTRYTBL .EQU $ ; JP HB_START ; HBIOS INITIALIZATION JP HB_DISPATCH ; VECTOR TO DISPATCHER + JP PRTSUM + ; !!! DO NOT ADD ADDTIONAL VECTORS HERE WITHOUT + ; CHECKING W/ WAYNE !!! ; -HB_STKSIZ .EQU HB_ENTRYTBL + 256 - $ +HB_STKSIZ .EQU $100 - ($ & $FF) ; .FILL HB_STKSIZ,$FF ; USE REMAINDER OF PAGE FOR HBIOS STACK HB_STACK .EQU $ ; TOP OF HBIOS STACK @@ -778,7 +1079,7 @@ HB_IVT: ; NOTE THAT EACH ENTRY HAS A FILLER BYTE OF VALUE ZERO. THIS BYTE ; HAS NO FUNCTION. IT IS JUST USED TO MAKE ENTRIES AN EVEN 4 BYTES. ; -#IF (INTMODE == 2) +#IF ((INTMODE == 2) | (INTMODE == 3)) ; HB_IVT: HB_IVT00: JP HB_BADINT \ .DB 0 @@ -805,22 +1106,156 @@ HB_IVT0F: JP HB_BADINT \ .DB 0 ;================================================================================================== ; HB_START: +; +#IFDEF APPBOOT + #IF (MEMMGR == MM_Z280) + LD A,DIAG_01 + OUT (DIAGPORT),A + LD DE,Z280_BOOTERR + LD C,9 + LD A,DIAG_02 + OUT (DIAGPORT),A + CALL $0005 + LD A,DIAG_04 + OUT (DIAGPORT),A + RET +; +Z280_BOOTERR .TEXT "\r\n\r\n*** Application mode boot not supported under Z280 native memory management!!!\r\n\r\n$" + #ENDIF +#ENDIF +; DI ; NO INTERRUPTS IM 1 ; INTERRUPT MODE 1 + +;#IF ((PLATFORM == PLT_MBC) | (PLATFORM == PLT_SBC)) + ; INITIALIZE RTC LATCH BYTE + ; FOR SOME PLATFORMS THIS CONTROLS HI/LO SPEED CIRCUIT + LD A,(RTCDEFVAL) ; GET DEFAULT VALUE + OUT (RTCIO),A ; SET IT +;#ENDIF +; +#IF (PLATFORM == PLT_N8) + LD A,N8_DEFACR ; ENSURE N8 ACR + OUT0 (N8_ACR),A ; ... REGISTER IS INITIALIZED +#ENDIF +; +#IF (PLATFORM == PLT_RPH) + LD A,RPH_DEFACR ; ENSURE RPH ACR + OUT0 (RPH_ACR),A ; ... REGISTER IS INITIALIZED +#ENDIF ; #IF (DIAGENABLE) - LD A,%00000001 + LD A,DIAG_01 OUT (DIAGPORT),A #ENDIF +#IF (LEDENABLE) + #IF (LEDMODE == LEDMODE_STD) + XOR A ; LED IS INVERTED, TURN IT ON + #ENDIF + #IF (LEDMODE == LEDMODE_RTC) + LD A,(RTCDEFVAL) ; DEFAULT LATCH VALUE + OR %00000001 ; LED 0 ON + #ENDIF + OUT (LEDPORT),A +#ENDIF ; + ; WARNING: ALTHOUGH WE ARE INITIALIZING SP HERE, IT IS NOT YET + ; SAFE TO PUSH VALUES TO THE STACK BECAUSE SOME PLATFORMS WILL + ; NOT YET HAVE RAM MAPPED TO THE UPPER 32K YET! LD SP,HBX_LOC ; SETUP INITIAL STACK JUST BELOW HBIOS PROXY ; +#IF (CPUFAM == CPU_Z280) + ; SET MAXIMUM I/O WAIT STATES FOR NOW + LD C,Z280_BTCR ; BUS TIMING AND CONTROL REGISTER + LD HL,$0033 ; 3 I/O WAIT STATES ADDED + LDCTL (C),HL +; + ; START BY SELECTING I/O PAGE $FF + LD L,$FF ; MMU AND DMA PAGE I/O REG IS $FF + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; + #IF (MEMMGR == MM_Z280) +; + ; INITIALIZE ALL OF THE SYSTEM PAGE DESCRIPTORS WITH BLOCK MOVE + XOR A ; FIRST USER PDR + OUT (Z280_MMUPDRPTR),A ; SET THE PDR POINTER + LD HL,Z280_BOOTPDRTBL ; START OF PDR VALUES TABLE + LD C,Z280_MMUBLKMOV ; PDR BLOCK MOVE PORT + LD B,16 ; PROGRAM 16 PDRS + OTIRW ; OTIRW +; + ; INITIALIZE ALL OF THE USER PAGE DESCRIPTORS WITH BLOCK MOVE + LD A,$10 ; FIRST SYSTEM PDR + OUT (Z280_MMUPDRPTR),A ; SET THE PDR POINTER + LD HL,Z280_BOOTPDRTBL ; START OF PDR VALUES TABLE + LD C,Z280_MMUBLKMOV ; PDR BLOCK MOVE PORT + LD B,16 ; PROGRAM 16 PDRS + OTIRW ; OTIRW +; + ; ENABLE MMU (SYSTEM AND USER TRANSLATION) + LD C,Z280_MMUMCR ; MMU MASTER CONTROL REGISTER + LD HL,$BBFF ; ENABLE USER & SYSTEM TRANSLATE + OUTW (C),HL +; + ; DISABLE MEMORY REFRESH CYCLES + LD A,$08 ; DISABLED + OUT (Z280_RRR),A ; SET REFRESH RATE REGISTER +; + ; CONFIGURE Z280 INT/TRAP VECTOR TABLE POINTER REGISTER + ; WILL POINT TO ROM COPY FOR NOW, UPDATED TO RAM LATER ON + LD C,Z280_VPR + LD HL,Z280_IVT >> 8 ; TOP 16 BITS OF PHYSICAL ADR OF IVT + LDCTL (C),HL +; + JR Z280_INITZ ; JUMP TO CODE CONTINUATION +; + #IF (($ % 2) == 1) + ; WORD ALIGN THE TABLE + .DB 0 + #ENDIF +; +Z280_BOOTPDRTBL: + ; LOWER 32 K (BANKED) + .DW ($000 << 4) | $A + .DW ($001 << 4) | $A + .DW ($002 << 4) | $A + .DW ($003 << 4) | $A + .DW ($004 << 4) | $A + .DW ($005 << 4) | $A + .DW ($006 << 4) | $A + .DW ($007 << 4) | $A + ; UPPER 32 K (COMMON) + .DW (((((BID_COM & $7F) * 8) + 0) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 1) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 2) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 3) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 4) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 5) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 6) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 7) + (1 << (RAMLOC - 12))) << 4) | $A +; +Z280_INITZ: +; + #ENDIF +; + ; RESTORE I/O PAGE TO $00 + LD L,$00 ; NORMAL I/O REG IS $00 + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; +#ENDIF +; #IF (CPUFAM == CPU_Z180) ; SET BASE FOR CPU IO REGISTERS + ; DO NOT USE Z180_ICR FROM Z180.INC BECAUSE THE ICR + ; IS NOT YET AT THE RUNNING LOCATION. AT RESET, THE Z180 + ; REGISTER BASE I/O ADDRESS IS ZERO, SO INITIALLY, ICR IS + ; AT $3F. LD A,Z180_BASE - OUT0 (Z180_ICR),A + OUT0 ($3F),A ; AT RESET, ICR IS AT $3F - DIAG(%00000010) + DIAG(DIAG_02) ; DISABLE REFRESH XOR A @@ -834,9 +1269,9 @@ HB_START: ; SET DEFAULT CPU CLOCK MULTIPLIERS (XTAL / 2) ; ; IT HAS BEEN REPORTED THAT CMR NEEDS TO BE SET PRIOR TO CCR - ; SEEMS COUNTER-INTUITIVE AND I NEVER EXPERIENCED A PROBLEM - ; RELATED TO ORDER, BUT JUST FOR GOOD MEASURE, CMR - ; IS SET PRIOR TO CCR BELOW. + ; WHEN USING AN INPUT FREQUENCY THAT IS XTAL / 2. + ; I NEVER EXPERIENCED A PROBLEM RELATED TO ORDER, BUT JUST + ; FOR GOOD MEASURE, CMR IS SET PRIOR TO CCR BELOW. ; https://www.retrobrewcomputers.org/forum/index.php?t=msg&th=316&#msg_5045 XOR A OUT0 (Z180_CMR),A @@ -846,7 +1281,7 @@ HB_START: LD A,$F0 OUT0 (Z180_DCNTL),A -#IF ((MEMMGR == MM_Z180) | (MEMMGR == MM_N8)) + #IF ((MEMMGR == MM_Z180) | (MEMMGR == MM_N8) | (MEMMGR == MM_RPH)) ; Z180 MMU SETUP LD A,$80 OUT0 (Z180_CBAR),A ; SETUP FOR 32K/32K BANK CONFIG @@ -856,7 +1291,11 @@ HB_START: ;#ENDIF LD A,(RAMSIZE + RAMBIAS - 64) >> 2 OUT0 (Z180_CBR),A ; COMMON BASE = LAST (TOP) BANK -#ENDIF +; + ; SET DEFAULT CSIO SPEED (INTERNAL CLOCK, SLOW AS POSSIBLE) + LD A,Z180_CNTR_DEF ; DIV 1280, 14KHZ @ 18MHZ CLK + OUT0 (Z180_CNTR),A + #ENDIF ; #ENDIF ; @@ -876,14 +1315,23 @@ HB_START: OUT (EIPC_SCDP),A ; SET SYSTEM CONTROL DATA PORT (SCDP) #ENDIF ; +#IF ((MEMMGR == MM_SBC) | (MEMMGR == MM_MBC)) + ; SET PAGING REGISTERS + #IFDEF ROMBOOT + XOR A + OUT (MPCL_RAM),A ; REMOVE RAM FIRST! + OUT (MPCL_ROM),A ; SELECT ROM PAGE 0 + #ENDIF +#ENDIF +; #IF (MEMMGR == MM_Z2) ; SET PAGING REGISTERS -#IFDEF ROMBOOT + #IFDEF ROMBOOT XOR A OUT (MPGSEL_0),A INC A OUT (MPGSEL_1),A -#ENDIF + #ENDIF LD A,62 OUT (MPGSEL_2),A INC A @@ -893,32 +1341,295 @@ HB_START: OUT (MPGENA),A #ENDIF ; - DIAG(%00000011) - LED($00) +; AT THIS POINT, RAM SHOULD BE AVAILABLE IN THE COMMON BANK +; (TOP 32K). +; +; NOTIFICATION THAT WE HAVE MADE THE JUMP TO RAM BANK! +; THE DIAG() MACRO IS NOT USED BECAUSE IT USES THE STACK AND WE DO +; NOT WANT TO EFFECT RAM UNTIL AFTER THE BACKUP BATTERY STATUS CHECK +; IS PERFORMED NEXT. +; +#IF (DIAGENABLE) + LD A,DIAG_02 + OUT (DIAGPORT),A +#ENDIF +; +; WE USE THE TWO BYTES IMMEDIATELY BELOW THE PROXY TO STORE A COUPLE +; VALUES TEMPORARILY BECAUSE WE MAY BE OPERATING IN ROM AT THIS POINT. +; (HBX_LOC - 1) = BATCOND, (HBX_LOC - 2) = APPBANK +; THERE IS NOTHING ON THE STACK AT THIS POINT SO, HERE, WE JUST RESET +; THE STACK TO HBX_LOC - 2. ; -; CHECK BATTERY BACKUP STATUS BEFORE WE COPY PROXY TO UPPER MEMORY + LD SP,HBX_LOC - 2 +; +; CHECK BATTERY BACKUP STATUS BEFORE WE TOUCH RAM (UPPER MEMORY) ; ; IF A DS1210 POWER CONTROLLER IS INSTALLED AND BATTERY BACKUP IS NOT INSTALLED ; OR IS LESS THAN 2V THEN THE DS1210 WILL BLOCK THE SECOND RAM ACCESS. ; FAILURE TO COMPLETE TWO RAM ACCESSES BEFORE INSTALLING PROXY WILL RESULT ; IN THE ROM ID BYTES NOT BEING COPIED CORRECTLY AND CP/M APPLICATIONS ; WILL NOT START CORRECTLY WHEN THEY CHECK THE ROM ID VERSION BYTES. -; THE BATTERY CONDITION VALUE IS TEMPORARILY STORED AT HBX_LOC - 1. +; THE BATTERY CONDITION VALUE IS TEMPORARILY STORED AT HBX_LOC - 1 +; BECAUSE WE ARE CURRENTLY RUNNING IN ROM. AFTER WE TRANSITION HBIOS +; TO RAM, THE VALUE IS MOVED TO IT'S REAL LOCATION AT HB_BATCOND. ; IF THERE IS NO DS1210 IN THE SYSTEM, THE CODE BELOW DOES NO HARM. ; - DEC SP ; RESERVE A STACK BYTE + LD HL,HBX_LOC - 1 ; POINT TO BYTE XOR A ; ZERO MEANS LOW BAT - LD (HBX_LOC - 1),A ; WRITE IT (SHOULD ALWAYS WORK) + LD (HL),A INC A ; 1 MEANS BAT OK - LD (HBX_LOC - 1),A ; OVERWRITE IF NVC ALLOWS IT + LD (HL),A ; ; INSTALL PROXY IN UPPER MEMORY +; THE HB_CURBNK MUST BE PRESERVED IF THIS IS AN APPBOOT. ; + LD A,(HB_CURBNK) ; SAVE EXISTING HB_CURBNK LD DE,HBX_LOC ; AS PER ABOVE LD HL,HBX_IMG LD BC,HBX_SIZ LDIR ; +#IFDEF APPBOOT + LD (HB_CURBNK),A ; RESTORE HB_CURBNK +#ENDIF +; +; SAVE CURRENT BANKID +; +; THIS IS NOT GOING TO WORK IF THE APP BOOT IMAGE IS LOADED +; USING THE UNA FAT32 LOADER. SHOULD PROBABLY CHECK THAT THERE +; IS A VALID ROMWBW PROXY IN MEMORY BEFORE DOING THIS. HOWEVER, +; THIS USE CASE IS PROBABLY NON-EXISTENT. THE IMG BOOT IMAGE +; SHOULD WORK FINE WITH THE UNA FAT32 LOADER. +; +; THIS VALUE IS TEMPORARILY STORED AT HBX_LOC - 2 +; BECAUSE WE ARE CURRENTLY RUNNING IN ROM. AFTER WE TRANSITION HBIOS +; TO RAM, THE VALUE IS MOVED TO IT'S REAL LCOATION AT HB_APPBNK. +; + LD A,(HB_CURBNK) ; GET HB_CURBNK + LD (HBX_LOC - 2),A ; ... AND SAVE TEMP FOR APPBNK +; +; THE RTCVAL FIELD OF THE PROXY DATA NEEDS TO BE INITIALIZED HERE +; BECAUSE IT CANNOT BE PRE-INITIALIZED (SEE COMMENTS ABOVE WHERE +; RTCVAL EQUATE IS DEFINED). +; + LD A,(RTCDEFVAL) + LD (HB_RTCVAL),A +; +#IFDEF TESTING +; +; THIS IS WHERE WE PROBE FOR THE ACTUAL NUMBER OF RAM +; BANKS AVAILABLE IN THE SYSTEM. THE PROBE CODE NEEDS +; TO BE COPIED TO AND RUN FROM THE COMMON RAM BANK. +; + LD DE,$F000 + LD HL,RS_IMAGE + LD BC,RS_LEN + LDIR + CALL RS_START + JP RS_IMAGE + RS_LEN +; +; CODE THAT IS COPIED TO $F000 TO PERFORM RAM SIZE DETECTION +; +RS_IMAGE: + .ORG $F000 +RS_START: + LD A,(HB_CURBNK) ; GET CURRENT BANK + PUSH AF ; SAVE IT + + LD C,0 ; RUNNING BANK COUNT + LD HL,$7FFF ; BYTE TEST ADDRESS + LD IX,RS_ARY ; ORIG BYTE STORAGE ARRAY PTR +RS_LOOP1: + LD A,C + ADD A,$80 ; OFFSET BY START OF RAM BANKS + CALL HBX_BNKSEL ; SELECT THE BANK + + LD A,(HL) ; GET ORIGINAL VALUE + LD (IX),A ; SAVE IT TO RESTORE LATER + INC IX ; BUMP IX + + LD A,$AA ; TEST LOC WITH $AA + LD (HL),A ; AVOID PROBLEMS WITH + LD (HL),A ; ... DS1210 + LD (HL),A + LD A,(HL) + CP $AA + JR NZ,RS_DONE + + LD A,$55 ; TEST LOC WITH $55 + LD (HL),A + LD A,(HL) + CP $55 + JR NZ,RS_DONE + + ; STORE A UNIQUE VALUE + LD A,C + LD (HL),A + OR A ; ZERO? + JR Z,RS_NEXT ; SKIP STORED VALUE CHECK + + ; VERIFY ALL STORED VALUES + LD B,C ; INIT LOOP COUNTER + LD E,0 ; INIT BANK ID +RS_LOOP3: + LD A,E + ADD A,$80 + CALL HBX_BNKSEL + LD A,(HL) + CP E ; VERIFY + JR NZ,RS_DONE ; ABORT IF MISCOMPARE + INC E ; NEXT BANK + DJNZ RS_LOOP3 +; +RS_NEXT: + INC C ; ADD 1 TO RAM BANK COUNT + JR RS_LOOP1 ; AND LOOP TILL DONE +; +RS_DONE: + LD E,C ; FINAL BANK COUNT TO E + LD A,C + OR A + JR Z,RS_LOOPZ + ; RESTORE SAVED VALUES + LD IX,RS_ARY + LD B,C ; LOOP COUNT + LD C,$80 ; BANK ID +RS_LOOP2: + LD A,C + CALL HBX_BNKSEL + INC C + LD A,(IX) ; GET VALUE + LD (HL),A ; RESTORE IT + INC IX + DJNZ RS_LOOP2 ; ALL BANKS +RS_LOOPZ: +; +; MBC RUNTIME MEMORY SIZE ADJUSTMENT +; +; THE MBC RAM BOARD CAN CONTAIN 1 OR 2 RAM CHIPS. THEY CAN BE +; EITHER 128K OR 512K EACH. SO THE MBC RAM BOARD CAN HAVE A +; TOTAL OF 128K, 256K, 512K, OR 1024K. THE COMMON (HIMEM) RAM +; IS ALWAYS MAPPED TO THE LAST 32K OF THE FIRST CHIP ON THE BOARD. +; IF THERE ARE TWO CHIPS ON THE BOARD, THIS MEANS THE COMMON +; BANK WILL APPEAR IN THE "MIDDLE" OF THE PHYSICAL RAM BANKS. +; ROMWBW NEEDS THE COMMON BANK TO BE AT THE LAST BANK OF PHYSICAL +; RAM IN ORDER TO HAVE SEQUENTIAL RAM BANKS AVAILABLE FOR THE +; RAM DISK. TO WORK AROUND THIS, WE FLIP THE HIGH BIT OF THE +; BANK ID FOR AN MBC SYSTEM IFF IT HAS 2 CHIPS (256K OR 1024K). +; THE CODE BELOW GENERATES THE CORRECT MASK TO ACCOMPLISH THIS +; AND THEN POKES THE MASK INTO AN XOR INSTRUCTION IN THE MBC +; MEMORY MANAGER. +; + #IF (MEMMGR == MM_MBC) +; + ;LD HL,CB_RAMBANKS ; IN NUMBER OF RAMBANKS DETECTED FOR MBC + LD A,%11101011 ; IS 4 (128KB) OR 16 (512KB) THEN + ;AND (HL) ; ZERO THE LAST BANK MASK OTHERWISE + AND E ; ZERO THE LAST BANK MASK OTHERWISE + JR Z,MBC_SINGLE ; CALCULATE THE LAST BANK MASK (BANKS/2) + RRA ; 256K = %00000100, 1024K = %00010000 +MBC_SINGLE: + LD (HBX_MBCMSK),A +; + #ENDIF +; + ; RETURN TO ORIGINAL BANK + POP AF + CALL HBX_BNKSEL + LD A,E ; RETURN BANK COUNT + LD ($FFEA),A ; STASH HERE FOR A BIT + RET +; +RS_ARY .EQU $ +; +RS_LEN .EQU $ - RS_START + .ORG RS_IMAGE + RS_LEN +; +#ELSE +; +; MBC RUNTIME MEMORY SIZE ADJUSTMENT +; +; THE MBC RAM BOARD CAN CONTAIN 1 OR 2 RAM CHIPS. THEY CAN BE +; EITHER 128K OR 512K EACH. SO THE MBC RAM BOARD CAN HAVE A +; TOTAL OF 128K, 256K, 512K, OR 1024K. THE COMMON (HIMEM) RAM +; IS ALWAYS MAPPED TO THE LAST 32K OF THE FIRST CHIP ON THE BOARD. +; IF THERE ARE TWO CHIPS ON THE BOARD, THIS MEANS THE COMMON +; BANK WILL APPEAR IN THE "MIDDLE" OF THE PHYSICAL RAM BANKS. +; ROMWBW NEEDS THE COMMON BANK TO BE AT THE LAST BANK OF PHYSICAL +; RAM IN ORDER TO HAVE SEQUENTIAL RAM BANKS AVAILABLE FOR THE +; RAM DISK. TO WORK AROUND THIS, WE FLIP THE HIGH BIT OF THE +; BANK ID FOR AN MBC SYSTEM IFF IT HAS 2 CHIPS (256K OR 1024K). +; THE CODE BELOW GENERATES THE CORRECT MASK TO ACCOMPLISH THIS +; AND THEN POKES THE MASK INTO AN XOR INSTRUCTION IN THE MBC +; MEMORY MANAGER. +; + #IF (MEMMGR == MM_MBC) + LD HL,CB_RAMBANKS ; IF NUMBER OF RAMBANKS DETECTED FOR MBC + LD A,%11101011 ; IS 4 (128KB) OR 16 (512KB) THEN + AND (HL) ; ZERO THE LAST BANK MASK OTHERWISE + JR Z,MBC_SINGLE ; CALCULATE THE LAST BANK MASK (BANKS/2) + RRA ; 256K = %00000100, 1024K = %00010000 +MBC_SINGLE: + LD (HBX_MBCMSK),A + #ENDIF +; +#ENDIF +; +; IF THIS IS A ROM-LESS SYSTEM, THEN WE NEED TO COPY THE PAYLOAD +; (LOADER, MONITOR, ZSDOS) THAT HAS BEEN LOADED TO PHYSICAL RAM +; BANKS 0 AND 1 TO THE USER TPA BANK TO RUN AFTER BOOT. +; IT IS DONE PRIOR TO COPYING HBIOS TO IT'S FINAL BANK BECAUSE +; THE PAYLOAD MAY EXTEND INTO THE HBIOS OPERATING BANK. THIS +; HAPPENS PRIMARILY IN THE CASE WHERE THE +; SYSTEM HAS THE MINIMUM 128KB OF RAM. +; +#IFDEF ROMBOOT + #IF (ROMSIZE == 0) + ; + ; THE PAYLOAD IS LIKELY TO CROSS OVER THE RAM BANK 0/1 + ; BOUNDARY. BNKCPY DOES NOT HANDLE THIS BECAUSE IT ASSUMES + ; THE COMMON BANK IS USED AFTER PASSING OVER THE BANK + ; BOUNDARY. WE WORK AROUND THAT HERE BY DOING TWO COPIES. + ; THE FIRST ONE HANDLES THE PORTION OF THE PAYLOAD FROM THE + ; END OF HBIOS TO THE BANK BOUNDARY ($8000). THE SECOND + ; ONE HANDLES THE PORTION THAT EXTENDS INTO THE SECOND + ; PHYSICAL RAM BANK. +; + ; COPY PORTION OF PAYLOAD FOLLOWING HBIOS TO THE BANK + ; BOUNDARY AT $8000 INTO START OF TPA. + LD A,BID_RAM0 + LD (HB_SRCBNK),A + LD A,BID_USR + LD (HB_DSTBNK),A + LD HL,HB_END + LD DE,0 + LD BC,$8000-HB_END +; + #IF (MEMMGR == MM_Z280) + CALL Z280_BNKCPY + #ELSE + CALL HBX_BNKCPY + #ENDIF +; + ; COPY REMAINDER OF PAYLOAD EXTENDING INTO THE SECOND PHYSICAL + ; RAM BANK. NOTE THAT THE DESTINATION ADDRESS (DE) IS + ; ALREADY CORRECT FROM THE PRIOR COPY. + LD A,BID_RAM0+1 + LD (HB_SRCBNK),A + LD HL,$0000 + ; DE IS ALREADY CORRECT + LD BC,$8000-($8000-HB_END) +; + #IF (MEMMGR == MM_Z280) + CALL Z280_BNKCPY + #ELSE + CALL HBX_BNKCPY + #ENDIF +; + #ENDIF +; +#ENDIF +; ; IF ALREADY EXECUTING IN RAM, BYPASS RAM BANK INSTALLATION ; LD A,(HB_RAMFLAG) @@ -934,14 +1645,25 @@ HB_START: LD HL,0 LD DE,0 LD BC,$8000 +#IF (MEMMGR == MM_Z280) + CALL Z280_BNKCPY +#ELSE CALL HBX_BNKCPY +#ENDIF ; ; TRANSITION TO HBIOS IN RAM BANK ; +#IF (MEMMGR == MM_Z280) + LD A,BID_BIOS + LD B,$10 ; FIRST SYSTEM PDR + CALL Z280_BNKSEL + JR HB_START1 +#ELSE LD A,BID_BIOS ; BIOS BANK ID - LD HL,HB_START1 ; EXECUTION RESUMES HERE + LD IX,HB_START1 ; EXECUTION RESUMES HERE CALL HBX_BNKCALL ; CONTINUE IN RAM BANK, DO NOT RETURN HALT ; WE SHOULD NOT COME BACK HERE! +#ENDIF ; HB_RAMFLAG .DB FALSE ; INITIALLY FALSE, SET TO TRUE BELOW AFTER RAM TRANSITION ; @@ -949,18 +1671,44 @@ HB_RAMFLAG .DB FALSE ; INITIALLY FALSE, SET TO TRUE BELOW AFTER RAM TRANSITION ; HB_START1: ; BNKCALL ARRIVES HERE, BUT NOW RUNNING IN RAM BANK ; - DIAG(%00000111) + ; WE RESET THE STACK HERE BECAUSE WE ARE NOT GOING TO RETURN + ; FROM THE BNKCALL. REMEMBER THAT WE STORED A COUPLE BYTES + ; RIGHT BELOW HBX_LOC, SO THE STACK IS SET TO START JUST BELOW + ; THAT. + LD SP,HBX_LOC - 2 ; RESET STACK ; - LD A,(HBX_LOC - 1) ; RECALL BATTERY STATE AND SAVE - LD (HB_BATCOND),A ; FOR FUTURE REFERENCE + ; NOTIFY THAT WE MADE THE TRANSITION! + DIAG(DIAG_03) + LED(%00000010) ; - LD SP,HBX_LOC ; RESET STACK SINCE WE DO NOT RETURN + ; SET THE IN-RAM FLAG LD A,TRUE ; ACCUM := TRUE LD (HB_RAMFLAG),A ; SET RAMFLAG +; + ; RECOVER DATA PASSED PRIOR TO RAM TRANSITION + ; (HBX_LOC - 1) = BATCOND, (HBX_LOC - 2) = APPBNK + POP HL ; POP 2 BYTES + LD A,H ; GET FIRST BYTE PUSHED + LD (HB_BATCOND),A ; ... AND SAVE AS BAT COND +; +#IFDEF APPBOOT + LD A,L ; GET SECOND BYTE PUSHED + LD (HB_APPBNK),A ; ... AND SAVE AS APPBNK +#ENDIF +; +#IF (MEMMGR == MM_Z280) + ; NOW POINT TO RAM COPY OF Z280 INT/TRAP TABLE + ; HL IS TOP 16 BITS OF PHYSICAL ADDRESS OF IVT + ; IVT *MUST* BE ON A 4K BOUNDARY + LD C,Z280_VPR + LD HL,0 + ((((BID_BIOS & $7F) * 8) + (1 << (RAMLOC - 12))) << 4) + (Z280_IVT >> 8) + LDCTL (C),HL +#ENDIF ; ; IF APPBOOT, WE NEED TO FIX UP A FEW THINGS IN PAGE ZERO ; #IFDEF APPBOOT +; ; MAKE SURE RST 08 VECTOR IS RIGHT LD A,$C3 LD ($0008),A @@ -983,6 +1731,39 @@ HB_START1: ; BNKCALL ARRIVES HERE, BUT NOW RUNNING IN RAM BANK #ENDIF #ENDIF ; +#IF FALSE +; +; POPULATE THE CRITICAL RAM BANK NUMBERS. +; +; ASSUME THAT CB_RAMBANKS IS THE NUMBER OF 32K RAM BANKS THAT HAS BEEN SET EITHER +; AT ASSEMBLY TIME OR BY PROBING THE ACTUAL AVAILABLE MEMORY (NOT IMPLEMENTED YET). +; + LD A,(CB_RAMBANKS) ; CALCULATE TOP RAMBANK + ADD A,BID_RAM0 ; AS FIRST RAMBANK + + DEC A ; #RAMBANKS - 1 +; + LD HL,CB_BIDCOM + LD B,4 +CB_IDS: LD (HL),A ; POPULATE CB_BIDCOM + INC HL ; POPULATE CB_BIDUSR + DEC A ; POPULATE CB_BIDBIOS + DJNZ CB_IDS ; POPULATE CB_BIDAUX +; + LD A,(CB_BIDUSR) + LD (HB_SRCBNK),A ; POPULATE HB_SRCBNK + LD (HB_DSTBNK),A ; POPULATE HB_DSTBNK +; + LD A,BID_RAM0 ; POPULATE CB_BIDRAMD0 ; START RAMBANK + LD (HL),A + INC HL +; + LD A,(CB_RAMBANKS) ; POPULATE CB_BIDRAMDN ; END RAMBANK + DEC A + SUB TOT_RAM_RB + LD (HL),A +; +#ENDIF +; ;================================================================================================== ; RECOVERY MODE ;================================================================================================== @@ -994,7 +1775,7 @@ HB_START1: ; BNKCALL ARRIVES HERE, BUT NOW RUNNING IN RAM BANK LD A,1 ; SET FOR RECOVERY MODE LD (HB_BOOT_REC),A ; SAVE FOR LATER #ENDIF - #IF (PLATFORM == PLT_SBC) + #IF ((PLATFORM == PLT_SBC) | (PLATFORM == PLT_MBC)) #IF (BT_REC_TYPE == BT_REC_SBC01) LD A,%00100000 ; DISABLE RTC AND OUT (RTCIO),A ; DRQ DRIVER READ @@ -1013,7 +1794,7 @@ SAVE_REC_M: LD (HB_BOOT_REC),A ; SAVE FOR LATER #ENDIF #IF (BT_REC_TYPE == BT_REC_SBCRI) - IN A,($68 + 6) ; UART_MSR MODEM + IN A,($68 + 6) ; UART_MSR MODEM BIT 6,A ; STATUS REGISTER LD A,0 ; BIT 6 JR Z,SAVE_REC_M ; IS RECOVERY MODE @@ -1024,29 +1805,13 @@ SAVE_REC_M: #ENDIF #ENDIF ; - DIAG(%00001111) -; -#IF (DSKYENABLE) - LD HL,MSG_HBVER + 5 - LD A,(DSKY_NUMS + RMJ) - AND $7F - LD (HL),A - INC HL - LD A,(DSKY_NUMS + RMN) - AND $7F - LD (HL),A - INC HL - LD A,(DSKY_NUMS + RUP) - LD (HL),A - LD HL,MSG_HBVER - CALL DSKY_SHOWSEG -#ENDIF + DIAG(DIAG_04) ; #IF (WBWDEBUG == USEMIO) ; BUFFER OUTPUT UNTIL CALL MIO_INIT ; WE GET TO BOOT MESSAGE #ENDIF ; -#IF 0 +#IF FALSE ; ; TEST DEBUG *************************************************************************************** ; @@ -1061,12 +1826,13 @@ SAVE_REC_M: ; ; DISCOVER CPU TYPE ; -; THIS CODE IS DERIVED FROM UNA BY JOHN COFFMAN +; SOME OF THIS CODE IS DERIVED FROM UNA BY JOHN COFFMAN ; ; 0: Z80 ; 1: Z80180 - ORIGINAL Z180 (EQUIVALENT TO HD64180) ; 2: Z8S180 - ORIGINAL S-CLASS, REV. K, AKA SL1960, NO ASCI BRG ; 3: Z8S180 - REVISED S-CLASS, REV. N, W/ ASCI BRG +; 4: Z8280 ; LD HL,0 ; L = 0 MEANS Z80 ; @@ -1081,22 +1847,34 @@ SAVE_REC_M: INC L ; FLAG Z80180 OR BETTER ; ; TEST FOR OLDER S-CLASS (REV K) - IN0 A,(Z180_CCR) ; SUPPOSEDLY ONLY ON S-CLASS - INC A ; FF -> 0 + IN0 A,(Z180_CCR) ; SUPPOSEDLY ONLY ON S-CLASS + INC A ; FF -> 0 JR Z,HB_CPU1 INC L ; FLAG Z8S180 REV K (SL1960) OR BETTER ; ; TEST FOR NEWER S-CLASS (REV N) ; ON OLDER S-CLASS, ASCI TIME CONSTANT REG DOES NOT EXIST ; AND WILL ALWYAS READ BACK AS $FF - OUT0 (Z180_ASTC1L),D ; D = 0 AT THIS POINT - IN0 A,(Z180_ASTC1L) ; ASCI TIME CONSTANT REG - INC A ; FF -> 0 + OUT0 (Z180_ASTC1L),D ; D = 0 AT THIS POINT + IN0 A,(Z180_ASTC1L) ; ASCI TIME CONSTANT REG + INC A ; FF -> 0 JR Z,HB_CPU1 INC L ; FLAG Z8S180 REV N W/ ASCI BRG ; #ENDIF ; +#IF (CPUFAM == CPU_Z280) +; + ; TEST FOR Z280 PER ZILOG DOC + LD A,$40 ; INITIALIZE THE OPERAND + .DB $CB,$37 ; THIS INSTRUCTION WILL SET THE S FLAG + ; ON THE Z80 CPU AND CLEAR THE S FLAG + ; ON THE Z280 MPU. + JP M,HB_CPU1 ; IF Z80, SKIP AHEAD + LD L,4 ; WE ARE Z280 +; +#ENDIF +; HB_CPU1: LD A,L LD (HB_CPUTYPE),A @@ -1105,54 +1883,133 @@ HB_CPU1: CALL DSRTC_PREINIT #ENDIF ; +#IF (SKZENABLE) +; + ; SET THE SK Z80-512K UART CLK2 DIVIDER AS + ; CONFIGURED. NOTE THAT THIS IMPLICITLY + ; CLEARS THE WATCHDOG BIT. THE WATCHDOG + ; WILL BE ENABLED LATER IF CONFIGURED. + LD A,SKZDIV ; GET DIVIDER CODE + OUT ($6D),A ; IMPLEMENT IT +; +#ENDIF +; + DIAG(DIAG_05) +; +; INIT OSCILLATOR SPEED FROM CONFIG +; + LD HL,CPUOSC / 1000 + LD (HB_CPUOSC),HL +; +; ATTEMPT DYNAMIC CPU SPEED DERIVATION +; NOTE THAT FOR PLATFORMS WITH SOFTWARE SELECTABLE CPU SPEED, +; THIS IS BEING DONE WITH THE CPU SPEED SET TO THE LOWEST +; POSSIBLE SETTING. THE FINAL CPU SPEED WILL BE ADJUSTED +; LATER. +; + CALL HB_CPUSPD ; CPU SPEED DETECTION + JR NZ,HB_CPUSPD2 ; SKIP IF FAILED +; +; RECORD THE UPDATED CPU OSCILLATOR SPEED +; +#IF ((CPUFAM == CPU_Z180) | (CPUSPDCAP == SPD_HILO)) + ; SPEED MEASURED WILL BE HALF OSCILLATOR SPEED + ; SO RECORD DOUBLE THE MEASURED VALUE + SLA L + RL H + LD (HB_CPUOSC),HL +#ENDIF +; +HB_CPUSPD2: +; +; INIT CPUKHZ BASED ON OSCILLATOR SPEED +; + LD HL,(HB_CPUOSC) +; +; TRANSITION TO FINAL DESIRED CPU SPEED FOR THOSE PLATFORMS +; THAT SUPPORT SOFTWARE SELECTABLE CPU SPEED. UPDATE CB_CPUKHZ +; IN HCB AS WE DO THIS. +; +#IF ((CPUSPDCAP==SPD_HILO) & (PLATFORM==PLT_MBC)) + #IF (CPUSPDDEF==SPD_HIGH) + ; SET HIGH SPEED VIA RTC LATCH + LD A,(HB_RTCVAL) + OR %00001000 ; SET HI SPEED BIT + LD (HB_RTCVAL),A ; SAVE SHADOW + OUT (RTCIO),A ; IMPLEMENT + ; HL IS ALREADY CORRECT FOR FULL SPEED OPERATION + #ELSE + ; ADJUST HL TO REFLECT HALF SPEED OPERATION + SRL H ; ADJUST HL ASSUMING + RR L ; HALF SPEED OPERATION + #ENDIF +#ENDIF +; +#IF ((CPUSPDCAP==SPD_HILO) & (PLATFORM==PLT_SBC)) + #IF (CPUSPDDEF==SPD_HIGH) + ; SET HIGH SPEED VIA RTC LATCH + LD A,(HB_RTCVAL) + AND ~%00001000 ; CLEAR HI SPEED BIT + LD (HB_RTCVAL),A ; SAVE SHADOW + OUT (RTCIO),A ; IMPLEMENT + ; HL IS ALREADY CORRECT FOR FULL SPEED OPERATION + #ELSE + ; ADJUST HL TO REFLECT HALF SPEED OPERATION + SRL H ; ADJUST HL ASSUMING + RR L ; HALF SPEED OPERATION + #ENDIF +#ENDIF +; #IF (CPUFAM == CPU_Z180) ; - ; AT BOOT, Z180 PHI IS OSC / 2 - LD C,(CPUOSC / 2) / 1000000 - LD DE,(CPUOSC / 2) / 1000 + LD HL,(HB_CPUOSC) ; INIT HL TO CPU OSC FREQ (KHZ) ; -#IF (Z180_CLKDIV >= 1) + ; ADJUST HL TO REFLECT HALF SPEED OPERATION + SRL H ; ADJUST HL ASSUMING + RR L ; HALF SPEED OPERATION +; + #IF (Z180_CLKDIV >= 1) LD A,(HB_CPUTYPE) ; GET CPU TYPE CP 2 ; Z8S180 REV K OR BETTER? - JR C,HB_CPU2 ; IF NOT, NOT POSSIBLE! + JR C,HB_CPU3 ; IF NOT, NOT POSSIBLE! ; SET CLOCK DIVIDE TO 1 RESULTING IN FULL XTAL SPEED LD A,$80 OUT0 (Z180_CCR),A - ; REFLECT SPEED CHANGE - LD C,CPUOSC / 1000000 - LD DE,CPUOSC / 1000 -#ENDIF - -#IF (Z180_CLKDIV >= 2) + ; ADJUST HL TO REFLECT FULL SPEED OPERATION + SLA L + RL H + #ENDIF +; + #IF (Z180_CLKDIV >= 2) LD A,(HB_CPUTYPE) ; GET CPU TYPE CP 3 ; Z8S180 REV N OR BETTER? - JR C,HB_CPU2 ; IF NOT, NOT POSSIBLE! + JR C,HB_CPU3 ; IF NOT, NOT POSSIBLE! ; SET CPU MULTIPLIER TO 1 RESULTING IN XTAL * 2 SPEED ; ALSO SET CCR AGAIN BECAUSE OF REPORTS THAT CCR ; *MUST* BE SET AFTER CMR. LD A,$80 OUT0 (Z180_CMR),A ; CPU MULTIPLIER OUT0 (Z180_CCR),A ; CLOCK DIVIDE - ; REFLECT SPEED CHANGE - LD C,(CPUOSC * 2) / 1000000 - LD DE,(CPUOSC * 2) / 1000 -#ENDIF -; -HB_CPU2: - ; SAVE CPU SPEED IN CONFIG BLOCK - LD A,C - LD (CB_CPUMHZ),A - LD (CB_CPUKHZ),DE + ; ADJUST HL TO REFLECT DOUBLE SPEED OPERATION + SLA L + RL H + #ENDIF ; +HB_CPU3: #ENDIF ; - DIAG(%00011111) -; -; PERFORM DYNAMIC CPU SPEED DERIVATION -; - CALL HB_CPUSPD ; CPU SPEED DETECTION +; HL SHOULD NOW HAVE FINAL CPU RUNNING SPEED IN KHZ. +; UPDATE CB_CPUMHZ/CB_CPUKHZ WITH THIS VALUE. ; - CALL DELAY_INIT ; INITIALIZE SPEED COMPENSATED DELAY FUNCTIONS + LD (CB_CPUKHZ),HL ; UPDATE CPUKHZ + LD DE,1000 ; SET UP TO DIV BY 1000 FOR MHZ + CALL DIV16 ; BC=CPU MHZ, HL=REMAINDER + LD DE,500 ; SET UP TO ROUND UP + XOR A ; IF WITHIN 500 KHZ + SBC HL,DE ; REMAINDER - 500 + CCF ; COMPLEMENT CF + ADC A,C ; C -> A; ADD CF FOR ROUNDING + LD (CB_CPUMHZ),A ; SAVE IT ; #IF (CPUFAM == CPU_Z180) ; @@ -1162,6 +2019,31 @@ HB_CPU2: ; #ENDIF ; +#IF (CPUFAM == CPU_Z280) +; + LD C,Z280_BTCR ; BUS TIMING AND CONTROL REG + LDCTL HL,(C) + LD A,L ; PUT IN A + AND %00111100 ; CLEAR DC,HM, AND IO FIELDS + OR Z280_INTWAIT << 6 ; SET INT ACK WAIT STATE BITS (DC) + OR Z280_MEMHIWAIT << 2 ; SET HIGH 8MB WAIT STATE BITS (HM) + OR Z280_IOWAIT ; SET I/O WAIT STATE BITS + LD L,A ; BACK TO L + LDCTL (C),HL +; + LD C,Z280_BTIR ; BUS TIMING AND INIT REG + LDCTL HL,(C) + LD A,L ; PUT IN A + AND %11110011 ; CLEAR LM FIELD + OR Z280_MEMLOWAIT << 2 ; SET LOW 8MB WAIT STATE BITS + LD L,A ; BACK TO L + LDCTL (C),HL +; +#ENDIF +; + LD A,(CB_CPUMHZ) ; CPU SPEED TO ACCUM AND INIT + CALL DELAY_INIT ; .. SPEED COMPENSATED DELAY +; #IF (INTMODE == 2) ; SETUP Z80 IVT AND INT MODE 2 LD A,HBX_IVT >> 8 ; SETUP HI BYTE OF IVT ADDRESS @@ -1176,6 +2058,17 @@ HB_CPU2: IM 2 ; SWITCH TO INT MODE 2 #ENDIF ; +#IF (INTMODE == 3) +; + ; SETUP Z280 INT A FOR VECTORED INTERRUPTS + LD HL,%0010000000000000 + LD C,Z280_ISR + LDCTL (C),HL +; + IM 3 +; +#ENDIF +; #IF (PLATFORM == PLT_SBC) ; #IF (HTIMENABLE) ; SIMH TIMER @@ -1190,8 +2083,7 @@ HB_CPU2: #ENDIF ; #IF (KIOENABLE) - LD A,%11111001 ; RESET ALL DEVICES, SET DAISYCHAIN - OUT (KIOBASE+$0E),A ; DO IT + CALL KIO_PREINIT #ENDIF ; #IF (CTCENABLE) @@ -1205,12 +2097,30 @@ HB_CPU2: ; MASK ALL EXTERNAL INTERRUPTS FOR NOW LD A,$01 ; INT0 ENABLED, INT1-2 DISABLED OUT0 (Z180_ITC),A ; WRITE TO INT/TRAP CONTROL REGISTER +; + #IF (Z180_TIMER) ; ; SETUP Z180 TIMER0 INTERRUPT VECTOR IN IVT LD HL,HB_TIMINT LD (IVT(INT_TIM0)),HL ; Z180 TIMER 0 ; SETUP PERIODIC TIMER INTERRUPT ON TIMER 0 + ; *** THIS ASSUMES A TICKFREQ OF 50HZ!!! *** +; +#IF (TICKFREQ != 50) + .ECHO "TICKFREQ *MUST* BE 50 FOR Z180 TIMER\n" + !!! +#ENDIF +; + ; Z180 PRESCALES THE COUNTER BY 20 SO, + ; RLDR = CPU CLK / 20 / TICKFREQ + ; IF WE ASSUME TICKFREQ = 50, WE CAN SIMPIFY TO + ; RLDR = CPU CLK / 1000 + ; NOW IF DIVIDE BOTH SIDES BY 1000, WE CAN USE + ; CPUKHZ VALUE AND SIMPLIFY TO + ; RLDR = CPUKHZ + XOR A ; ALL BITS ZERO + OUT0 (Z180_TCR),A ; ... INHIBITS TIMER OPERATION LD HL,(CB_CPUKHZ) ; 50HZ = 18432000 / 20 / 50 / X, SO X = CPU KHZ OUT0 (Z180_TMDR0L),L ; INITIALIZE TIMER 0 DATA REGISTER OUT0 (Z180_TMDR0H),H @@ -1219,6 +2129,47 @@ HB_CPU2: OUT0 (Z180_RLDR0H),H LD A,%00010001 ; ENABLE TIMER0 INT AND DOWN COUNTING OUT0 (Z180_TCR),A +; + #ENDIF +; + #ENDIF +; +#ENDIF +; +#IF (CPUFAM == CPU_Z280) +; + #IF (MEMMGR == MM_Z280) +; + #IF (Z280_TIMER) +; +Z280_TC .EQU CPUOSC / 4 / 50 / 2 ; TIME CONSTANT +; + LD HL,Z280_TIMINT + LD (Z280_IVT+$16),HL ; Z280 T/C VECTOR +; + ; SELECT I/O PAGE $FE + LD C,Z280_IOPR ; I/O PAGE REGISTER + LDCTL HL,(C) ; GET CURRENT I/O PAGE + PUSH HL ; SAVE IT + LD L,$FE ; I/O PAGE $FE + LDCTL (C),HL +; + LD A,%10100000 ; CONFIG: C, RE, IE + OUT (Z280_CT0_CFG),A ; SET C/T 0 + LD HL,CPUOSC / 50 / 16 ; TIME CONSTANT & COUNTER + LD C,Z280_CT0_TC ; SET C/T 0 + OUTW (C),HL + LD C,Z280_CT0_CT ; SET C/T 0 + OUTW (C),HL + LD A,%11100000 ; CMD: EN, GT + OUT (Z280_CT0_CMDST),A ; SET C/T 0 +; + ; RESTORE I/O PAGE + LD C,Z280_IOPR ; I/O PAGE REGISTER + POP HL ; RESTORE I/O PAGE + LDCTL (C),HL +; + #ENDIF ; #ENDIF ; @@ -1235,8 +2186,9 @@ HB_CPU2: LD A,$FF ; FILL WITH $FF CALL FILL ; DO IT ; - DIAG(%00111111) -#IF 0 + DIAG(DIAG_06) +; +#IF FALSE ; ; TEST DEBUG *************************************************************************************** ; @@ -1249,26 +2201,9 @@ HB_CPU2: ; ; PRE-CONSOLE INITIALIZATION ; - LD A,FORCECON ; CALCULATE PRE-INIT TABLE ; A IS INDEX OF CONSOLE DEVICE ENTRY - RLCA ; ENTRY THAT WE WANT TO ; A IS OFFSET OF CONSOLE DEVICE ENTRY - LD DE,(HB_PCINITTBL) ; EXECUTE FIRST ; DE IS VALUE OF TOP ENTRY - LD HL,HB_PCINITTBL ; HL IS ADDRESS OF TOP OF TABLE - PUSH HL ; PUSH (1) TOP OF TABLE - PUSH DE ; PUSH (2) VALUE OF TOP ENTRY - PUSH HL ; PUSH (3) TOP OF TABLE - CALL ADDHLA ; HL IS ADDRESS OF DESIRED CONSOLE ENTRY - POP DE ; PLACE IT AT THE TOP OF THE ; POP (3) DE IS TOP OF TABLE - PUSH HL ; TABLE BY SWAPPING IT ; PUSH (3) ADDRESS OF DESIRED CONSOLE ENTRY - LDI ; WITH THE FIRST (DUMMY) ; COPY DESIRED ENTRY - LDI ; ENTRY ; ... TO TOP OF TABLE - POP HL ; POP (3) HL IS ADDRESS OF DESIRED CONSOLE ENTRY - POP DE ; POP (2) DE IS VALUE OF ORIGINAL TOP ENTRY - LD (HL),E ; SAVE DE OVER ORIGINAL ENTRY - INC HL - LD (HL),D - LD B,HB_PCINITTBLLEN - POP DE ; POP (1) DE IS ADDRESS OF TOP OF TABLE - + LD DE,HB_PCINITTBL ; POINT TO PRECONSOLE INIT TABLE + LD B,HB_PCINITTBLLEN ; NUMBER OF ENTRIES +; #IF (BT_REC_TYPE != BT_REC_NONE) LD A,(HB_BOOT_REC) ; IF WE ARE IN RECOVERY MODE OR A ; POINT TO THE RECOVER MODE @@ -1276,11 +2211,27 @@ HB_CPU2: LD B,HB_PCINITRLEN LD DE,HB_PCINIT_REC NOT_REC_M0: - +; #ENDIF CALL CALLLIST ; PROCESS THE PRE-INIT CALL TABLE ; -#IF 0 +#IF (DSKYENABLE) + LD HL,MSG_HBVER + 5 + LD A,(DSKY_HEXMAP + RMJ) + OR $80 + LD (HL),A + INC HL + LD A,(DSKY_HEXMAP + RMN) + OR $80 + LD (HL),A + INC HL + LD A,(DSKY_HEXMAP + RUP) + LD (HL),A + LD HL,MSG_HBVER + CALL DSKY_SHOW +#ENDIF +; +#IF FALSE ; ; TEST DEBUG *************************************************************************************** ; @@ -1291,15 +2242,37 @@ NOT_REC_M0: ; #ENDIF ; - DIAG(%01111111) - LED($FF) + DIAG(DIAG_07) + LED(%00000111) +; +; +; +; +#IF (BOOT_DELAY > 100) + .ECHO "*** ERROR: INVALID BOOT_DELAY (BOOT_DELAY > 100)!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR +#ENDIF +; +#IF (BOOT_DELAY > 0) + LD B,BOOT_DELAY * 2 ; SCALE TO 1/2 SEC +HB_BOOTDLY: + CALL LDELAY ; 1/2 SECOND DELAY + DJNZ HB_BOOTDLY ; LOOP TILL DONE +#ENDIF ; ; PRIOR TO THIS POINT, CONSOLE I/O WAS NOT AVAILABLE UNLESS DIRECTED TO DEBUG OUTPUT I.E. XIO ; NOW THAT HBIOS IS READY, SET THE CONSOLE UNIT TO ACTIVATE CONSOLE I/O ; VIA HBIOS. ; - XOR A ; INITIALLY, FIRST SERIAL UNIT IS CONSOLE - LD (CB_CONDEV),A ; SAVE IT, ACTIVATES CONSOLE ON HBIOS + XOR A ; FAILSAFE VALUE FOR BOOT CONSOLE DEVICE + LD (CB_CONDEV),A ; SAVE IT +; + LD A,(CIO_CNT) ; GET COUNT OF CHAR DEVICES + CP BOOTCON + 1 ; COUNT - (DEVICE + 1) + JR C,HB_CONRDY ; IF TOO HIGH, JUST USE FAILSAFE + LD A,BOOTCON ; GET REQUESTED CONSOLE DEV + LD (CB_CONDEV),A ; SAVE IT +HB_CONRDY: #IF (WBWDEBUG == USEMIO) ; OUTPUT ANY CACHED DEBUG TEXT LD HL,MIOOUTPTR @@ -1319,7 +2292,7 @@ NXTMIO: LD A,(HL) ; CALL WRITESTR ; WRITESTR WILL WORK WILL ONLY PRINT UP TO FIRST $ #ENDIF ; -#IF 0 +#IF FALSE ; ; TEST DEBUG *************************************************************************************** ; @@ -1345,11 +2318,23 @@ NXTMIO: LD A,(HL) .TEXT "HBIOS MUTEX ENABLED$" #ENDIF ; - DIAG(%11111111) +; DISPLAY RECOVERY MODE MESSAGE +; +#IF (BT_REC_TYPE != BT_REC_NONE) + LD A,(HB_BOOT_REC) ; IF WE ARE IN RECOVERY MODE + OR A ; DISPLAY RECOVERY MODE MESSAGE + JR Z,NOT_REC_M2 + CALL NEWLINE + CALL PRTSTRD + .TEXT "RECOVERY MODE$" +#ENDIF +NOT_REC_M2: +; + DIAG(DIAG_08) ; ; IO PORT SCAN ; -#IF 0 +#IF FALSE PSCN: LD C,0 ; IO PORT NUMBER LD B,0 ; LOOP COUNTER @@ -1376,7 +2361,7 @@ PSCNX .EQU $ + 1 DJNZ PSCN1 #ENDIF ; -#IF 0 +#IF FALSE HB_SPDTST: CALL HB_CPUSPD ; CPU SPEED DETECTION CALL NEWLINE @@ -1407,25 +2392,72 @@ HB_SPDTST: CALL PRTHEXBYTE #ENDIF ; +#IF (CPUFAM == CPU_Z280) + CALL PRTSTRD + .TEXT ", BUS @ $" + LD C,Z280_BTIR ; BUS TIMING AND CTL REG + LDCTL HL,(C) + LD A,L ; MOVE TO A + AND %00000011 ; ISOLATE CS FIELD + LD HL,(CB_CPUKHZ) ; GET CPU SPEED + CP %00000001 ; BUS @ 1/1 + JR Z,HB_Z280BUS ; GOT IT, SHOW IT + SRL H ; DIVIDE + RR L ; ... BY 2 + CP %00000000 ; BUS @ 1/2 + JR Z,HB_Z280BUS ; GOT IT, SHOW IT + SRL H ; DIVIDE + RR L ; ... BY 2 + CP %00000010 ; BUS @ 1/4 + JR Z,HB_Z280BUS ; GOT IT, SHOW IT + PRTS("???$") ; INVALID VALUE + JR HB_Z280BUS1 ; CONTINUE +HB_Z280BUS: + CALL PRTD3M ; PRINT AS DECIMAL WITH 3 DIGIT MANTISSA +HB_Z280BUS1: + PRTS("MHz$") ; SUFFIX +#ENDIF +; ; DISPLAY CPU CONFIG ; CALL NEWLINE -#IF (CPUFAM == CPU_Z180) - LD A,Z180_MEMWAIT + +#IF (CPUFAM == CPU_Z280) + LD A,Z280_MEMLOWAIT + CALL PRTDECB + LD A,'/' + CALL COUT + LD A,Z280_MEMHIWAIT + CALL PRTDECB + CALL PRTSTRD + .TEXT " MEM W/S, $" #ELSE - LD A,0 -#ENDIF + XOR A + #IF (CPUFAM == CPU_Z180) + LD A,Z180_MEMWAIT + #ENDIF CALL PRTDECB CALL PRTSTRD .TEXT " MEM W/S, $" +#ENDIF + LD A,1 #IF (CPUFAM == CPU_Z180) LD A,Z180_IOWAIT + 1 -#ELSE - LD A,1 +#ENDIF +#IF (CPUFAM == CPU_Z280) + LD A,Z280_IOWAIT + 1 #ENDIF CALL PRTDECB CALL PRTSTRD .TEXT " I/O W/S$" +#IF (CPUFAM == CPU_Z280) + CALL PRTSTRD + .TEXT ", $" + LD A,Z280_INTWAIT + CALL PRTDECB + CALL PRTSTRD + .TEXT " INT W/S$" +#ENDIF #IF (INTMODE > 0) CALL PRTSTRD .TEXT ", INT MODE $" @@ -1433,18 +2465,184 @@ HB_SPDTST: CALL PRTDECB #ENDIF ; -; DISPLAY MEMORY CONFIG -; - CALL NEWLINE + CALL PRTSTRD + .TEXT ", $" + CALL PRTSTRD +#IF (MEMMGR == MM_NONE) + .TEXT "NONE$" +#ENDIF +#IF (MEMMGR == MM_SBC) + .TEXT "SBC$" +#ENDIF +#IF (MEMMGR == MM_Z2) + .TEXT "Z2$" +#ENDIF +#IF (MEMMGR == MM_N8) + .TEXT "N8$" +#ENDIF +#IF (MEMMGR == MM_Z180) + .TEXT "Z180$" +#ENDIF +#IF (MEMMGR == MM_Z280) + .TEXT "Z280$" +#ENDIF +#IF (MEMMGR == MM_ZRC) + .TEXT "ZRC$" +#ENDIF +#IF (MEMMGR == MM_MBC) + .TEXT "MBC$" +#ENDIF +#IF (MEMMGR == MM_RPH) + .TEXT "RPH$" +#ENDIF + CALL PRTSTRD + .TEXT " MMU$" +; +; DISPLAY MEMORY CONFIG +; + CALL NEWLINE LD HL,ROMSIZE CALL PRTDEC CALL PRTSTRD .TEXT "KB ROM, $" - LD HL,RAMSIZE +; + LD HL,(CB_RAMBANKS) ; GET NUMBER OF BANKS IN L + LD H,0 ; CALCULATE RAM SIZE + ADD HL,HL + ADD HL,HL ; X4 + ADD HL,HL ; X8 + ADD HL,HL ; X16 + ADD HL,HL ; X32 +; CALL PRTDEC CALL PRTSTRD .TEXT "KB RAM$" ; +#IFDEF TESTING +; + CALL PRTSTRD + .TEXT ", RAMBANKS=0x$" + LD A,($FFEA) + CALL PRTHEXBYTE +; + CALL PRTSTRD + .TEXT ", RTCDEF=0x$" + LD A,(RTCDEFVAL) + CALL PRTHEXBYTE +; +#ENDIF +; +#IF 0 +; +; DIAGNOSTIC DISPLAY OF BANK IDS IN HCB +; + CALL PRTSTRD + .TEXT ", BANK IDS:$" + LD DE,CB_BIDCOM + LD A,8 + CALL PRTHEXBUF +; +#ENDIF +; +#IF (CPUFAM == CPU_Z280) + CALL NEWLINE + PRTS("Z280: $") + PRTS("MSR=$") + LD C,Z280_MSR ; MASTER STATUS REGISTER + LDCTL HL,(C) + CALL PRTHEXWORDHL + CALL PC_SPACE + PRTS("BTCR=$") + LD C,Z280_BTCR ; BUS TIMING AND CONTROL REGISTER + LDCTL HL,(C) + CALL PRTHEXWORDHL + CALL PC_SPACE + PRTS("BTIR=$") + LD C,Z280_BTIR ; BUS TIMING AND CONTROL REGISTER + LDCTL HL,(C) + CALL PRTHEXWORDHL + CALL PC_SPACE + PRTS("CCR=$") + LD C,Z280_CCR ; CACHE CONTROL REGISTER + LDCTL HL,(C) + CALL PRTHEXWORDHL +#ENDIF +; +#IFDEF ROMBOOT + #IF (ROMSIZE > 0) +; +; ROM CHECKSUM VERIFICATION +; EACH OF THE FIRST 4 ROM BANKS HAS A CHECKSUM INJECTED SUCH THAT +; A COMPUTED CHECKSUM ACROSS THE ENTIRE BANK SHOULD ALWAYS BE ZERO +; +HB_ROMCK: + CALL NEWLINE + PRTS("ROM VERIFY:$") +; + ; COPY CHECKSUM ROUTINE TO UPPER RAM + LD HL,HB_CKBNK + LD DE,$F000 + LD BC,HB_CKBNKSIZ + LDIR +; + ; TEST FIRST 4 BANKS OF ROM + LD B,4 ; 4 BANKS + LD C,0 ; STARTING AT BANK 0 +HB_ROMCK1: + PUSH BC ; SAVE LOOP CONTROL + CALL $F000 ; TEST THE BANK + CALL PC_SPACE ; FORMATTING + CALL PRTHEXBYTE ; PRINT RESULT + POP BC ; RESTORE LOOP CONTROL + OR A ; SET FLAGS + JR NZ,HB_ROMCK2 ; HANDLE FAILURE + INC C ; NEXT BANK + DJNZ HB_ROMCK1 ; LOOP FOR BANKS + PRTS(" PASS$") ; DISPLAY SUCCESS + JR HB_ROMCKZ ; CONTINUE BOOT +HB_ROMCK2: + PRTS(" FAIL$") ; DISPLAY ERROR + JR HB_ROMCKZ ; CONTINUE BOOT +; +; VERIFY ROM CHECKSUM BANK SPECIFIED IN REG C +; THIS MUST BE COPIED TO UPPER RAM TO RUN +; INTERRUPTS ARE DISABLED SINCE PAGE ZERO VECTOR WILL BE +; SWAPPED OUT. ASSUMES THAT INTERRUPTS ARE ENABLED AT ENTRY. +; +HB_CKBNK: + HB_DI ; SUPPRESS INTERRUPTS + LD A,(HB_CURBNK) ; GET CURRENT BANK + LD E,A ; SAVE IN E + LD A,C ; BANK TO TEST + CALL HBX_BNKSEL ; SELECT BANK IT + LD HL,$7FFF ; START AT BANK END + LD BC,1 ; DECREMENT VALUE + XOR A ; ZERO ACCUM +HB_CKBNK1: +#IF (MEMMGR == MM_Z280) + LD D,A ; WORKING VALUE TO D + LDUD A,(HL) ; GRAB NEXT BYTE FROM USER SPACE + ADD A,D ; ADD NEXT BYTE +#ELSE + ADD A,(HL) ; ADD NEXT BYTE +#ENDIF + OR A ; CLEAR CARRY + SBC HL,BC ; DECREMENT + JR NC,HB_CKBNK1 ; LOOP TILL DONE + PUSH AF ; SAVE RESULT + LD A,E ; BANK TO RESTORE + CALL HBX_BNKSEL ; RESTORE ORIG BANK + POP AF ; RECOVER RESULT + HB_EI ; ALLOW INTERRUPTS AGAIN + RET ; AND DONE +; +HB_CKBNKSIZ .EQU $-HB_CKBNK ; SIZE OF ROUTINE +; +HB_ROMCKZ: +; + #ENDIF +#ENDIF +; ; LOW BATTERY DIAGNOSTIC MESSAGE ; #IF (BATCOND) @@ -1473,6 +2671,47 @@ NOT_REC_M1: IS_REC_M1: CALL CALLLIST ; +; IF WATCHDOG FUNCTIONALITY IS REQUESTED, CHECK TO MAKE SURE +; WE ARE GETTING INTERRUPTS. IF SO, ENABLE THE WATCHDOG. +; +#IF (WDOGMODE != WDOG_NONE) + CALL NEWLINE + PRTS("WDOG: $") + PRTS("MODE=$") + + #IF (WDOGMODE == WDOG_EZZ80) + PRTS("EZZ80$") + #ENDIF + #IF (WDOGMODE == WDOG_SKZ) + PRTS("SKZ$") + #ENDIF +; + PRTS(" IO=0x$") + LD A,WDOGIO + CALL PRTHEXBYTE +; + #IF (WDOGMODE == WDOG_SKZ) + ; SKZ WATCHDOG IS DISABLED EARLY IN BOOT PROCESS + ; HERE, WE ONLY NEED TO ENABLE IT, IF APPROPRIATE + LD HL,(HB_TICKS) ; GET LOW WORD + LD A,H ; CHECK FOR + OR L ; ... ZERO + JR Z,HB_WDOFF ; SKIP IF NOT TICKING + IN A,($6D) ; GET PORT VALUE + SET 5,A ; SET THE WATCHDOG ENABLE BIT + OUT ($6D),A ; ACTIVATE WATCHDOG + #ENDIF +; + PRTS(" ENABLED$") + JR HB_WDZ +; +HB_WDOFF: + PRTS(" DISABLED$") +; +HB_WDZ: +; +#ENDIF +; ; RECORD HEAP CURB AT THE CURRENT VALUE OF HEAP TOP. HEAP CURB ; MARKS THE POINT IN THE HEAP AFTER WHICH MEMORY IS RELEASED ; WHEN AN HBIOS RESET IS PEFORMED. @@ -1494,11 +2733,11 @@ IS_REC_M1: ; IF PLATFORM HAS A CONFIG JUMPER, CHECK TO SEE IF IT IS JUMPERED. ; IF SO, BYPASS SWITCH TO CRT CONSOLE (FAILSAFE MODE) ; -#IF ((PLATFORM == PLT_SBC) | (PLATFORM == PLT_ZETA) | (PLATFORM == PLT_ZETA2)) + #IF ((PLATFORM == PLT_SBC) | (PLATFORM == PLT_ZETA) | (PLATFORM == PLT_ZETA2) | (PLATFORM == PLT_MBC)) IN A,(RTCIO) ; RTC PORT, BIT 6 HAS STATE OF CONFIG JUMPER BIT 6,A ; BIT 6 HAS CONFIG JUMPER STATE JR Z,INITSYS3 ; Z=SHORTED, BYPASS CONSOLE SWITCH -#ENDIF + #ENDIF ; ; NOTIFY USER OF CONSOLE SWITCH ON BOOT CONSOLE CALL NEWLINE2 @@ -1514,46 +2753,170 @@ IS_REC_M1: #ENDIF ; INITSYS3: -; CALL PRTSUM ; PRINT UNIT/DEVICE SUMMARY TABLE ; -; CHAIN TO OS LOADER +#IF 0 + CALL NEWLINE + CALL NEWLINE + CALL NEWLINE + + ; SRC & DEST BELOW BND + CALL NEWLINE + LD HL,$4000 + LD DE,$5000 + LD BC,$3000 + CALL NEWLINE + CALL REGDMP + CALL Z280_BNKCPYX + + ; SRC & DEST ABOVE BND + CALL NEWLINE + LD HL,$8000 + LD DE,$9000 + LD BC,$1000 + CALL NEWLINE + CALL REGDMP + CALL Z280_BNKCPYX + + ; SRC CROSSOVER + CALL NEWLINE + LD HL,$7000 + LD DE,$9000 + LD BC,$2000 + CALL NEWLINE + CALL REGDMP + CALL Z280_BNKCPYX + + ; DEST CROSSOVER + CALL NEWLINE + LD HL,$9000 + LD DE,$7000 + LD BC,$2000 + CALL NEWLINE + CALL REGDMP + CALL Z280_BNKCPYX + + ; DOUBLE CROSSOVER + CALL NEWLINE + LD HL,$7800 + LD DE,$7000 + LD BC,$2000 + CALL NEWLINE + CALL REGDMP + CALL Z280_BNKCPYX + + ; DOUBLE CROSSOVER SINGLE BYTES + CALL NEWLINE + LD HL,$7FFE + LD DE,$7FFF + LD BC,$0500 + CALL NEWLINE + CALL REGDMP + CALL Z280_BNKCPYX + + CALL NEWLINE + CALL NEWLINE + CALL NEWLINE +; +#ENDIF +; +#IF 0 +; + LD HL,0 + CALL DBG_NOTE + LD HL,48 + CALL DBG_NOTE + LD HL,204 + CALL DBG_NOTE + LD HL,268 + CALL DBG_NOTE + LD HL,436 + CALL DBG_NOTE +; + JP INITSYS4 +; +DBG_NOTE: + PUSH HL + CALL NEWLINE + PRTS("AY: $") + CALL PRTDEC16 + PRTS("=$") + CALL AY_NOTE + LD HL,(AY_PENDING_PERIOD) + CALL PRTDEC16 + POP HL +; + PRTS(" SN: $") + CALL PRTDEC16 + PRTS("=$") + CALL SN7_NOTE + LD HL,(SN7_PENDING_PERIOD) + CALL PRTDEC16 +; + RET +; +#ENDIF +; +INITSYS4: +; +#IF (MEMMGR == MM_Z280) + ; LEAVE SYSTEM MODE STACK POINTING TO AN OK PLACE + LD SP,HB_STACK ; NOW USE REAL SYSTEM STACK LOC +; + HB_DI ; NOT SURE THIS IS NEEDED +; + ; ACTIVATE THE CORRECT USER MODE BANK + LD A,(HB_CURBNK) ; GET CURRENT BANK + CALL HBX_BNKSEL +; + ; PRESET THE USER MODE STACK + LD HL,HBX_LOC + LDCTL USP,HL +; + HB_EI ; NOT SURE THIS IS NEEDED +; + ; SWITCH TO USER MODE NOW + LD C,Z280_MSR + LD HL,$407F + LDCTL (C),HL +#ENDIF +; +#IFDEF TESTING + CALL SND_BEEP +#ENDIF +; +#IFNDEF ROMBOOT +; + ; COPY OS IMAGE: BID_USR: --> BID_USR:0 + LD B,BF_SYSSETCPY ; HBIOS FUNC: SETUP BANK COPY + LD D,BID_USR ; D = DEST BANK = USER BANK + ;LD E,BID_USR ; E = SRC BANK = USER BANK + LD A,(HB_APPBNK) ; GET APP LOAD BANK + LD E,A ; USE AS SOURCE + LD HL,$8000 ; HL = COPY LEN = ENTIRE BANK + RST 08 ; DO IT + LD B,BF_SYSBNKCPY ; HBIOS FUNC: PERFORM BANK COPY + LD HL,HB_END ; COPY FROM END OF HBIOS + LD DE,0 ; TO USER ADDRESS 0 + RST 08 ; DO IT +; +#ENDIF +; +; CHAIN TO LOADER ; #IFDEF ROMBOOT - ; PERFORM BANK CALL TO OS IMAGES BANK IN ROM + #IF (ROMSIZE > 0) LD A,BID_IMG0 ; CHAIN TO OS IMAGES BANK - LD HL,0 ; ENTER AT ADDRESS 0 - CALL HBX_BNKCALL ; GO THERE - HALT ; WE SHOULD NEVER COME BACK! + #ELSE + LD A,BID_USR ; CHAIN TO USER BANK + #ENDIF #ELSE - ; COPY OS IMAGE: BID_USR: --> BID_USR:0 - ;LD A,BID_USR - ;LD (HB_SRCBNK),A - ;LD (HB_DSTBNK),A - ;LD HL,HB_END - ;LD DE,0 - ;LD BC,$8000 - ;CALL HBX_BNKCPY - LD B,BF_SYSSETCPY ; HBIOS FUNC: SETUP BANK COPY - LD D,BID_USR ; D = DEST BANK = USER BANK - LD E,BID_USR ; E = SRC BANK = USER BANK - LD HL,$8000 ; HL = COPY LEN = ENTIRE BANK - RST 08 ; DO IT - LD B,BF_SYSBNKCPY ; HBIOS FUNC: PERFORM BANK COPY - LD HL,HB_END ; COPY FROM END OF OF HBIOS - LD DE,0 ; TO USER ADDRESS 0 - RST 08 ; DO IT -; - ; PERFORM BANK CALL TO USER BANK - LD A,BID_USR ; CHAIN TO OS IMAGES BANK - LD HL,0 ; ENTER AT ADDRESS 0 + LD A,BID_USR ; CHAIN TO USER BANK +#ENDIF + LD IX,0 ; ENTER AT ADDRESS 0 CALL HBX_BNKCALL ; GO THERE HALT ; WE SHOULD NEVER COME BACK! ; -#ENDIF -; - RET -; ; CALL A LIST OF ROUTINES POINTED TO BY DE OF LENGTH B. ; CALLLIST: @@ -1582,16 +2945,17 @@ CALLDUMMY: #IF (BT_REC_TYPE != BT_REC_NONE) ; HB_PCINIT_REC: - #IF (PLATFORM == PLT_SBC) + #IF ((PLATFORM == PLT_SBC) | (PLATFORM == PLT_MBC)) .DW UART_PREINIT ; .DW CALLDUMMY #ENDIF HB_PCINITRLEN .EQU (($ - HB_PCINIT_REC) / 2) ; HB_INIT_REC: - #IF (PLATFORM == PLT_SBC) + #IF ((PLATFORM == PLT_SBC) | (PLATFORM == PLT_MBC)) .DW UART_INIT .DW MD_INIT + .DW PPIDE_INIT #ENDIF HB_INITRLEN .EQU (($ - HB_INIT_REC) / 2) ; @@ -1602,25 +2966,42 @@ HB_INITRLEN .EQU (($ - HB_INIT_REC) / 2) ;================================================================================================== ; HB_PCINITTBL: - .DW CALLDUMMY ; RESERVED FOR FORCING PRIMARY CONSOLE +#IF (DSKYENABLE) + .DW DSKY_PREINIT +#ENDIF #IF (ASCIENABLE) .DW ASCI_PREINIT #ENDIF +#IF (Z2UENABLE) + .DW Z2U_PREINIT +#ENDIF #IF (UARTENABLE) .DW UART_PREINIT #ENDIF +#IF (DUARTENABLE) + .DW DUART_PREINIT +#ENDIF #IF (SIOENABLE) .DW SIO_PREINIT #ENDIF #IF (ACIAENABLE) .DW ACIA_PREINIT #ENDIF +#IF (PIOENABLE) + .DW PIO_PREINIT +#ENDIF +#IF LPTENABLE) + .DW LPT_PREINIT +#ENDIF #IF (PIO_4P | PIO_ZP) .DW PIO_PREINIT #ENDIF #IF (UFENABLE) .DW UF_PREINIT #ENDIF +#IF (TMSENABLE) + .DW TMS_PREINIT +#ENDIF HB_PCINITTBLLEN .EQU (($ - HB_PCINITTBL) / 2) ;================================================================================================== @@ -1628,36 +3009,79 @@ HB_PCINITTBLLEN .EQU (($ - HB_PCINITTBL) / 2) ;================================================================================================== ; HB_INITTBL: +#IF (KIOENABLE) + .DW KIO_INIT +#ENDIF #IF (CTCENABLE) .DW CTC_INIT #ENDIF -#IF (SPKENABLE) - .DW SPK_INIT ; AUDIBLE INDICATOR OF BOOT START +#IF (DSKYENABLE) + .DW DSKY_INIT +#ENDIF +#IF (AY38910ENABLE) + .DW AY38910_INIT ; AUDIBLE INDICATOR OF BOOT START #ENDIF -#IF (AYENABLE) - .DW AY_INIT ; AUDIBLE INDICATOR OF BOOT START +#IF (SN76489ENABLE) + .DW SN76489_INIT +#ENDIF +#IF (YM2612ENABLE) + .DW YM2612_INIT +#ENDIF +#IF (SPKENABLE) + .DW SP_INIT ; AUDIBLE INDICATOR OF BOOT START #ENDIF #IF (ASCIENABLE) .DW ASCI_INIT #ENDIF +#IF (Z2UENABLE) + .DW Z2U_INIT +#ENDIF #IF (UARTENABLE) .DW UART_INIT #ENDIF +#IF (DUARTENABLE) + .DW DUART_INIT +#ENDIF #IF (SIOENABLE) .DW SIO_INIT #ENDIF #IF (ACIAENABLE) .DW ACIA_INIT #ENDIF -#IF (SIMRTCENABLE) - .DW SIMRTC_INIT +#IF (PIOENABLE) + .DW PIO_INIT +#ENDIF +#IF (LPTENABLE) + .DW LPT_INIT +#ENDIF +#IF (PIO_4P | PIO_ZP) + .DW PIO_INIT +#ENDIF +#IF (UFENABLE) + .DW UF_INIT #ENDIF #IF (DSRTCENABLE) .DW DSRTC_INIT #ENDIF +#IF (DS1501RTCENABLE) + .DW DS1501RTC_INIT +#ENDIF #IF (BQRTCENABLE) .DW BQRTC_INIT #ENDIF +#IF (SIMRTCENABLE) + .DW SIMRTC_INIT +#ENDIF +#IF (INTRTCENABLE) + .DW INTRTC_INIT +#ENDIF +#IF (DS7RTCENABLE) + .DW PCF8584_INIT + .DW DS7RTC_INIT +#ENDIF +#IF (RP5RTCENABLE) + .DW RP5RTC_INIT +#ENDIF #IF (VDUENABLE) .DW VDU_INIT #ENDIF @@ -1667,14 +3091,17 @@ HB_INITTBL: #IF (VGAENABLE) .DW VGA_INIT #ENDIF -#IF (NECENABLE) - .DW NEC_INIT +#IF (GDCENABLE) + .DW GDC_INIT #ENDIF #IF (TMSENABLE) .DW TMS_INIT #ENDIF -#IF (DSKYENABLE) - .DW DSKY_INIT +;#IF (DSKYENABLE) +; .DW DSKY_INIT +;#ENDIF +#IF (DMAENABLE) + .DW DMA_INIT #ENDIF #IF (MDENABLE) .DW MD_INIT @@ -1703,12 +3130,6 @@ HB_INITTBL: #IF (PPPENABLE) .DW PPP_INIT #ENDIF -#IF (PIO_4P | PIO_ZP) - .DW PIO_INIT -#ENDIF -#IF (UFENABLE) - .DW UF_INIT -#ENDIF ; HB_INITTBLLEN .EQU (($ - HB_INITTBL) / 2) ; @@ -1744,20 +3165,29 @@ IDLE: ; HB_DISPATCH: ; -#IF 0 ; *DEBUG* START +#IF (MEMMGR == MM_Z280) + ; FOR Z280 MEMMGR, WE DISPATCH VIA THE Z280 SYSCALL. + ; THE SYSCALL MECHANISM WILL CLEAR INTERRUPTS. IN + ; GENERAL, INTERRUPTS ARE OK DURING API PROCESSING, + ; SO ENABLE THEM HERE. + HB_EI +#ENDIF +; ; - CALL HB_DISPCALL ; DO THE WORK +#IF FALSE ; *DEBUG* START +; + CALL HB_DISPATCH1 ; DO THE WORK ; ; CHECK STACK INTEGRITY PUSH AF LD A,(HB_STACK - HB_STKSIZ + $08) CP $FF - CALL NZ,PANIC + SYSCHKERR(ERR_INTERNAL) LD A,$FF LD (HB_STACK - HB_STKSIZ + $08),A POP AF RET -HB_DISPCALL: +HB_DISPATCH1: ; #ENDIF ; *DEBUG* END ; @@ -1769,13 +3199,18 @@ HB_DISPCALL: CP BF_RTC + $10 ; $20-$2F: REAL TIME CLOCK (RTC) JP C,RTC_DISPATCH CP BF_EMU + $10 ; $30-$3F: EMULATION - CALL C,PANIC ; OBSOLETE! + JR C,HB_DISPERR CP BF_VDA + $10 ; $40-$4F: VIDEO DISPLAY ADAPTER JP C,VDA_DISPATCH + CP BF_SND + $08 ; $50-$58: SOUND DRIVERS + JP C,SND_DISPATCH CP BF_SYS ; SKIP TO BF_SYS VALUE AT $F0 - CALL C,PANIC ; PANIC IF LESS THAN BF_SYS + JR C,HB_DISPERR ; ERROR IF LESS THAN BF_SYS JP SYS_DISPATCH ; OTHERWISE SYS CALL - CALL PANIC ; THIS SHOULD NEVER BE REACHED + ; FALL THRU +; +HB_DISPERR: + SYSCHKERR(ERR_NOFUNC) RET ; ;================================================================================================== @@ -1792,7 +3227,7 @@ CIO_DISPATCH: PUSH IY ; SAVE INCOMING IY - LD IY,CIO_TBL ; POINT IY TO START OF DIO TABLE + LD IY,CIO_TBL ; POINT IY TO START OF CIO TABLE CALL HB_DISPCALL ; GO TO GENERIC API CALL CODE POP IY ; RESTORE IY @@ -1843,7 +3278,7 @@ CIO_TBL .FILL CIO_SIZ,0 ; SPACE FOR ENTRIES ; DIO_DISPATCH: ; -#IF 0 ; *DEBUG* START +#IF FALSE ; *DEBUG* START ; ; DUMP INCOMING CALL CALL NEWLINE @@ -1903,10 +3338,11 @@ DIO_TBL .FILL DIO_SIZ,0 ; SPACE FOR ENTRIES ; IMPLEMENTS MULTI SECTOR READS AND I/O TO/FROM ; BANKED RAM VIA BOUNCE BUFFER ; -; TOS=READ FN ADR -; HL=BUF ADR -; E=SEC COUNT -; D=BUF BANK ID +; ON ENTRY: +; TOS=READ FN ADR +; HL=BUF ADR +; E=SEC COUNT +; D=BUF BANK ID ; HB_DSKREAD: ; @@ -1914,6 +3350,8 @@ HB_DSKREAD: EX (SP),HL ; SAVE HL TO TOS, HL := READ FN ADR LD (HB_DSKFNADR),HL ; IMBED IN CALL OP BELOW POP HL ; RECOVER HL +; + LD (HB_DSKCMD),BC ; SAVE HBIOS FUNC & UNIT ; #IF (DIAGENABLE) ; SAVE DISK UNIT NUMBER BIT MASK @@ -2002,6 +3440,8 @@ HB_DSKWRITE: EX (SP),HL ; SAVE HL TO TOS, HL := READ FN ADR LD (HB_DSKFNADR),HL ; IMBED IN CALL OP BELOW POP HL ; RECOVER HL +; + LD (HB_DSKCMD),BC ; SAVE HBIOS FUNC & UNIT ; #IF (DIAGENABLE) ; SAVE DISK UNIT NUMBER BIT MASK @@ -2105,13 +3545,13 @@ HB_DSKFN: OUT (DIAGPORT),A ; DISPLAY ON DIAG LEDS #ENDIF #IF (LEDENABLE & LEDDISKIO) - LED($FF) + LED(%00000101) ; BIT 0 FOR TINY Z80 & MBC, BIT 2 FOR SCXXX #ENDIF LD E,1 ; ONE SECTOR HB_DSKFNADR .EQU $+1 CALL PANIC ; READ ONE SECTOR #IF (DIAGENABLE & DIAGDISKIO) - DIAG(0) ; CLEAR DIAG LEDS + DIAG(DIAG_00) ; CLEAR DIAG LEDS #ENDIF #IF (LEDENABLE & LEDDISKIO) LED($00) @@ -2122,6 +3562,101 @@ HB_DSKFNADR .EQU $+1 HB_DSKBIT .DB 0 ; ACTIVE DISK UNIT HB_IOBUF .DW 0 ; CURRENT IO BUFFER ADR HB_IOBNK .DB 0 ; CURRENT IO BUFFER BANK ID +HB_DSKCMD: +HB_DSKUNIT .DB 0 ; CURRENT DISK UNIT +HB_DSKFUNC .DB 0 ; CURRENT DISK FUNCTION +; +#IF (DSKYENABLE) +; +;================================================================================================== +; DSKY DISK ACTIVITY MONITOR +;================================================================================================== +; +; THIS FUNCTION IS CALLED BY DISK DRIVERS JUST PRIOR TO +; THE START OF A DISK I/O OPERATION. +; +; THE CURRENT DISK UNIT NUMBER WILL BE DISPLAYED IN THE FIRST +; 2 SEG DISPLAYS. THE LOWER 24 BITS OF THE SECTOR WILL BE +; DISPLAYED IN THE LAST 6 SEG DISPLAYS. +; +; A DOT IS DISPLAYED TO SEPARATE THE UNIT NUMBER FROM THE ADDRESS +; DISPLAY. ALSO, A TRAILING DOT IS DISPLAYED IF THE I/O FUNCTION +; IS A WRITE. +; +; HL: ADDRESS OF 32-BIT SECTOR NUMBER (LITTLE-ENDIAN) +; ALL REGISTERS PERSERVED +; +HB_DSKACT: + PUSH AF + PUSH BC + PUSH DE + PUSH HL + LD DE,DSKY_HEXBUF+3 ; START AT END + LD B,3 ; 3 BYTES OF SECTOR ADDRESS +HB_DSKACT1: + LD A,(HL) ; GET FIRST BYTE + LD (DE),A ; AND STORE IN BUF + INC HL ; NEXT SRC BYTE + DEC DE ; NEXT DEST BYTE + DJNZ HB_DSKACT1 ; LOOP + LD A,(HB_DSKUNIT) ; GET DISK UNIT NUM + LD (DE),A ; PUT AT HEAD OF BUF +HB_DSKACT2: + LD HL,DSKY_HEXBUF ; BINARY BUF + LD DE,DSKY_BUF ; DISPLAY BUF + CALL DSKY_BIN2SEG ; CONVERT TO SEG DISPLAY BUF + LD A,(DSKY_BUF+1) ; SECOND SEGMENT + OR %10000000 ; TURN ON DOT + LD (DSKY_BUF+1),A ; SAVE IT + LD A,(HB_DSKFUNC) ; GET CURRENT I/O FUNCTION + CP BF_DIOWRITE ; IS IT A WRITE? + JR NZ,HB_DSKACT3 ; IF NOT, NO DOT, SKIP AHEAD + LD A,(DSKY_BUF+7) ; LAST SEGMENT + OR %10000000 ; TURN ON DOT + LD (DSKY_BUF+7),A ; SAVE IT +HB_DSKACT3: + EX DE,HL ; SEG DISPLAY BUF TO HL + CALL DSKY_SHOW ; DISPLAY ON DSKY + POP HL + POP DE + POP BC + POP AF + RET +; +; THIS IS THE CHS VARIANT OF THE ABOVE. THIS IS USED BY CHS ORIENTED +; DISK DRIVERS (BASICALLY JUST FLOPPY). +; +; THE CURRENT DISK UNIT NUMBER WILL BE DISPLAYED IN THE FIRST +; 2 SEG DISPLAYS. THE TRACK, HEAD, AND SECTOR WILL BE DISPLAYED IN +; THE LAST 6 SEG DISPLAYS +; +; HL: ADDRESS OF CYL,HD,SEC IN THE FORMAT CCSH +; ALL REGISTERS PRESERVED +; +HB_DSKACTCHS: + PUSH AF + PUSH BC + PUSH DE + PUSH HL + LD DE,DSKY_HEXBUF ; START OF HEX BUF + LD A,(HB_DSKUNIT) ; GET DISK UNIT NUM + LD (DE),A ; PUT AT HEAD OF BUF + INC DE ; NEXT BYTE OF BUF + LD A,(HL) ; LSB OF TRACK + LD (DE),A ; ADD TO BUF + INC DE ; NEXT BYTE OF BUF + INC HL ; BUMP TO HEAD + INC HL ; " + INC HL ; " + LD A,(HL) ; GET HEAD + LD (DE),A ; ADD TO BUF + INC DE ; NEXT BYTE OF BUF + DEC HL ; BACK TO SECTOR + LD A,(HL) ; GET SECTOR + LD (DE),A ; ADD TO BUF + JR HB_DSKACT2 +; +#ENDIF ; ;================================================================================================== ; REAL TIME CLOCK DEVICE DISPATCHER @@ -2131,19 +3666,30 @@ HB_IOBNK .DB 0 ; CURRENT IO BUFFER BANK ID ; B: FUNCTION ; RTC_DISPATCH: -#IF (SIMRTCENABLE) - JP SIMRTC_DISPATCH -#ENDIF -#IF (DSRTCENABLE) - JP DSRTC_DISPATCH -#ENDIF -#IF (BQRTCENABLE) - JP BQRTC_DISPATCH -#ENDIF - ;CALL PANIC - OR $FF + PUSH HL ; SAVE INCOMING HL + LD HL,(RTC_DISPADR) ; + EX (SP),HL RET ; +RTC_DISPERR: + SYSCHKERR(ERR_NOHW) + RET +; +; SET RTC DISPATCH ADDRESS, USED BY RTC DRIVERS DURING INIT +; BC HAS ADDRESS OF DISPATCH ADDRESS +; WILL ONLY SAVE THE FIRST ADDRESS SET +; +RTC_SETDISP: + LD (RTC_DISPADR),BC ; SAVE THE ADDRESS + OR $FF ; FLAG ACTIVE VALUE + LD (RTC_DISPACT),A ; SAVE IT + RET ; AND DONE +; +; +; +RTC_DISPADR .DW RTC_DISPERR ; RTC DISPATCH ADDRESS +RTC_DISPACT .DB 0 ; SET WHEN DISPADR SET +; ;================================================================================================== ; VIDEO DISPLAY ADAPTER DEVICE DISPATCHER ;================================================================================================== @@ -2178,7 +3724,7 @@ VDA_ADDENT: ; WORD DRIVER FUNCTION TABLE ADDRESS ; WORD UNIT SPECIFIC DATA (TYPICALLY A DEVICE INSTANCE DATA ADDRESS) ; -VDA_FNCNT .EQU 15 ; NUMBER OF VDA FUNCS (FOR RANGE CHECK) +VDA_FNCNT .EQU 16 ; NUMBER OF VDA FUNCS (FOR RANGE CHECK) VDA_MAX .EQU 16 ; UP TO 16 UNITS VDA_SIZ .EQU VDA_MAX * 4 ; EACH ENTRY IS 4 BYTES ; @@ -2186,6 +3732,94 @@ VDA_SIZ .EQU VDA_MAX * 4 ; EACH ENTRY IS 4 BYTES .DB VDA_MAX ; MAX ENTRY COUNT TABLE PREFIX VDA_CNT .DB 0 ; ENTRY COUNT PREFIX VDA_TBL .FILL VDA_SIZ,0 ; SPACE FOR ENTRIES + +; +; +;================================================================================================== +; SOUND ADAPTER DEVICE DISPATCHER +;================================================================================================== +; +; ROUTE CALL TO SPECIFIED SOUND DEVICE DRIVER +; B: FUNCTION +; C: UNIT NUMBER +; +SND_DISPATCH: + PUSH IY ; SAVE INCOMING IY + + LD IY, SND_TBL ; POINT IY TO START OF DIO TABLE + CALL HB_DISPCALL ; GO TO GENERIC API CALL CODE + + POP IY ; RESTORE IY + RET ; AND DONE +; +; ADD AN ENTRY TO THE SND UNIT TABLE (SEE HB_ADDENT FOR DETAILS) +; +SND_ADDENT: + LD HL, SND_TBL ; POINT TO SND TABLE + JP HB_ADDENT ; ... AND GO TO COMMON CODE +; +; HBIOS VIDEO DEVICE UNIT TABLE +; +; TABLE IS BUILT DYNAMICALLY BY EACH DRIVER DURING INITIALIZATION. +; THE TABLE IS PREFIXED BY TWO BYTES. TABLE - 1 CONTAINS THE CURRENT +; NUMBER OF ENTRIES. TABLE - 2 CONTAINS THE MAXIMUM NUMBER OF ENTRIES. +; TABLE - 3 CONTAINS THE NUMBER OF SND FUNCTION IDS +; EACH ENTRY IS DEFINED AS: +; +; WORD DRIVER FUNCTION TABLE ADDRESS +; WORD UNIT SPECIFIC DATA (TYPICALLY A DEVICE INSTANCE DATA ADDRESS) +; +SND_FNCNT .EQU 8 ; NUMBER OF SND FUNCS (FOR RANGE CHECK) +SND_MAX .EQU 5 ; UP TO 5 UNITS +SND_SIZ .EQU SND_MAX * 4 ; EACH ENTRY IS 4 BYTES +; + .DB SND_FNCNT ; SND FUNCTION COUNT (FOR RANGE CHECK) + .DB SND_MAX ; MAX ENTRY COUNT TABLE PREFIX +SND_CNT .DB 0 ; ENTRY COUNT PREFIX +SND_TBL .FILL SND_SIZ,0 ; SPACE FOR ENTRIES +; +;================================================================================================== +; SPEAKER BEEP ROUTINE +;================================================================================================== +; +; ROUTINE TO BEEP THE DEFAULT SOUND UNIT +; NEED TO CHECK FOR EXISTENCE OF SOUND UNIT +; WHICH CHANNEL SHOULD BE USED? IS THERE A GOOD DEFAULT CHANNEL? +; +SND_BEEP: + ; CHECK FOR AT LEAST 1 SOUND DEVICE + LD A,(SND_CNT) ; GET SOUND UNIT COUNT + OR A ; CHECK FOR ZERO + RET Z ; BAIL OUT IF NO SOUND UNITS + + ; PLAY A BEEP ON SOUND DEVICE UNIT 0 + LD B,$50 ; SOUND RESET FUNCTION + LD C,0 ; SOUND UNIT NUMBER + CALL SND_DISPATCH ; DO IT + LD B,$51 ; VOLUME + LD C,0 ; SOUND UNIT NUMBER + LD L,$FF ; MAX + CALL SND_DISPATCH ; DO IT + LD B,$53 ; SELECT NOTE + LD C,0 ; SOUND UNIT NUMBER + ;LD HL,0 ; A0# + LD HL,244 ; B5 (CLOSE TO 1 KHZ) + CALL SND_DISPATCH ; DO IT + ;LD B,$56 ; DURATION + ;LD C,0 ; SOUND UNIT NUMBER + ;LD HL,500 ; 1/2 SECOND + ;CALL SND_DISPATCH ; DO IT + LD B,$54 ; PLAY SOUND + LD C,0 ; SOUND UNIT NUMBER + LD D,0 ; CHANNEL 0 + CALL SND_DISPATCH ; DO IT + LD DE,15625 ; PLAY FOR 1/4 SECOND + CALL VDELAY ; WAIT WHILE TONE IS PLAYED + ;CALL LDELAY ; LET SOUND PLAY 1/2 SECOND + LD B,$50 ; SOUND RESET FUNCTION + LD C,0 ; SOUND UNIT NUMBER + CALL SND_DISPATCH ; DO IT + RET ; DONE ; ;================================================================================================== ; SYSTEM FUNCTION DISPATCHER @@ -2221,16 +3855,129 @@ SYS_DISPATCH: JP Z,SYS_POKE ; $FB DEC A JP Z,SYS_INT ; $FC - CALL PANIC ; INVALID + DEC A ; -; SOFT RESET HBIOS, RELEASE HEAP MEMORY NOT USED BY HBIOS +; RESTART SYSTEM +; SUBFUNCTION IN C ; SYS_RESET: + LD A,C ; GET REQUESTED SUB-FUNCTION + CP BF_SYSRES_INT + JR Z,SYS_RESINT + CP BF_SYSRES_WARM + JR Z,SYS_RESWARM + CP BF_SYSRES_COLD + JR Z,SYS_RESCOLD + CP BF_SYSRES_USER + JR Z,SYS_RESUSER + SYSCHKERR(ERR_NOFUNC) + RET +; +; SOFT RESET HBIOS, RELEASE HEAP MEMORY NOT USED BY HBIOS +; +SYS_RESINT: +; + ; RESET THE HEAP LD HL,(HEAPCURB) ; GET HBIOS HEAP THRESHOLD LD (CB_HEAPTOP),HL ; RESTORE HEAP TOP +;; +; ; MAKE SURE THE PROPER RESET VECTOR IS AT ADDRESS $0000 +; LD HL,$0040 ; USER RESET CODE STUB +; LD ($0001),HL ; OPERAND OF JP AT $0000 +; XOR A RET ; +; GO BACK TO ROM BOOT LOADER +; +SYS_RESWARM: +; +#IF (ROMSIZE == 0) + JR SYS_RESCOLD +#ENDIF +; + CALL SYS_RESINT +; +#IF (MEMMGR == MM_Z280) + JP INITSYS4 +#ELSE + ; PERFORM BANK CALL TO OS IMAGES BANK IN ROM + LD SP,HBX_LOC ; STACK JUST BELOW HBIOS PROXY + LD A,BID_IMG0 ; CHAIN TO OS IMAGES BANK + LD IX,0 ; ENTER AT ADDRESS 0 + CALL HBX_BNKCALL ; GO THERE + HALT ; WE SHOULD NEVER COME BACK! +#ENDIF +; +; RESTART SYSTEM AS THOUGH POWER HAD JUST BEEN TURNED ON +; +SYS_RESCOLD: +; +#IF (ROMSIZE == 0) + LD DE,STR_RESTART + CALL Z,WRITESTR + DI + HALT +#ENDIF +; +#IF (MEMMGR == MM_Z280) + JP Z280_RESTART +#ELSE + DI + LD SP,HBX_LOC ; STACK JUST BELOW HBIOS PROXY + LD A,BID_BOOT ; BOOT BANK + LD IX,0 ; ADDRESS ZERO + CALL HB_BNKCALL ; DOES NOT RETURN +#ENDIF +; +; HOOK CALLED WHEN A USERLAND RESET IS INVOKED, TYPICALLY VIA A JUMP +; TO LOGICAL CPU ADDRESS $0000 +; +; CREDIT TO PHILLIP STEVENS FOR SUGGESTING AND SIGNIFICANT CONTRIBUTIONS +; TO THE Z180 INVALID OPCODE TRAP ENHANCEMENT. +; +SYS_RESUSER: +; +#IF (CPUFAM == CPU_Z180) +; + IN0 A,(Z180_ITC) ; GET ITC REGISTER + XOR $80 ; PRECLEAR TRAP BIT + RET M ; IF TRAP BIT NOT SET, DONE +; + ; HANDLE INVALID OPCODE + DEC HL ; BACK UP TO OPCODE START + BIT 6,A ; CHECK UFO BIT (2 BYTE OPCODE) + JR Z,SYS_RESUSER1 ; IF NOT, ALL SET + DEC HL ; OTHERWISE, BACK UP 1 MORE BYTE +; +SYS_RESUSER1: + OUT0 (Z180_ITC),A ; SAVE IT +; + CALL PRTSTRD ; PRINT ERROR TAG + .TEXT "\r\n\r\n+++ INVALID Z180 OPCODE @$" + CALL PRTHEXWORDHL ; PRINT OPCODE ADDRESS + PRTS("H:$") ; FORMATTING +; + LD B,8 ; SHOW 8 BYTES +SYS_RESUSER2: + PUSH BC ; SAVE BC + PUSH HL ; SAVE HL + LD A,(HB_INVBNK) ; GET BYTE FROM INVOKING BANK + LD D,A ; PUT IN D + CALL SYS_PEEK ; PEEK TO GET BYTE VALUE + LD A,E ; PUT IN A + CALL PC_SPACE ; FORMATTING + CALL PRTHEXBYTE ; DISPLAY BYTE + POP HL ; RECOVER HL + POP BC ; RECOVER BC + INC HL ; NEXT BYTE + DJNZ SYS_RESUSER2 ; LOOP TIL DONE + JP NEWLINE ; FORMATTING & EXIT +; +#ENDIF +; + RET ; ELSE RETURN WITH USER RESET VECTOR IN HL +; ; GET THE CURRENT HBIOS VERSION ; ON INPUT, C=0 ; RETURNS VERSION IN DE AS BCD @@ -2247,9 +3994,24 @@ SYS_VER: ; SET ACTIVE MEMORY BANK AND RETURN PREVIOUSLY ACTIVE MEMORY BANK ; NOTE THAT IT GOES INTO EFFECT AS HBIOS FUNCTION IS EXITED ; HERE, WE JUST SET THE CURRENT BANK -; CALLER MUST EXTABLISH UPPER MEMORY STACK BEFORE INVOKING THIS FUNCTION! +; CALLER MUST ESTABLISH UPPER MEMORY STACK BEFORE INVOKING THIS FUNCTION! ; SYS_SETBNK: +#IF (MEMMGR == MM_Z280) + ; FOR Z280 MEMMGR, WE ARE IN SYSTEM MODE HERE, SO WE CAN UPDATE + ; THE USER MODE BANK WITHOUT IMPACTING THE RUNNING CODE. IT + ; TAKE EFFECT UPON RETURN TO USER MODE. + LD A,(HB_INVBNK) ; GET PREVIOUS BANK + PUSH AF ; SAVE IT + LD A,C ; NEW BANK TO A + LD (HB_INVBNK),A ; UPDATE INVBNK + LD B,$00 ; FIRST USER PDR + CALL Z280_BNKSEL ; DO IT + POP AF ; RECOVER PREV BANK + LD C,A ; PREVIOUS BANK TO C + XOR A ; SIGNAL SUCCESS + RET ; DONE +#ELSE PUSH HL ; SAVE INCOMING HL LD HL,HB_INVBNK ; POINT TO HBIOS INVOKE BANK ID ADDRESS LD A,(HL) ; GET EXISTING BANK ID TO A @@ -2258,6 +4020,7 @@ SYS_SETBNK: POP HL ; RESTORE ORIGINAL HL XOR A ; SIGNAL SUCCESS RET ; DONE +#ENDIF ; ; GET ACTIVE MEMORY BANK ; @@ -2311,8 +4074,7 @@ SYS_ALLOC: ; ALL OTHER REGISTERS PRESERVED ; SYS_FREE: - CALL PANIC ; NOT YET IMPLEMENTED - OR $FF + SYSCHKERR(ERR_NOTIMPL) ; NOT YET IMPLEMENTED RET ; ; GET SYSTEM INFORMATION @@ -2321,24 +4083,38 @@ SYS_FREE: SYS_GET: LD A,C ; GET REQUESTED SUB-FUNCTION CP BF_SYSGET_CIOCNT - JR Z,SYS_GETCIOCNT + JP Z,SYS_GETCIOCNT + CP BF_SYSGET_CIOFN + JP Z,SYS_GETCIOFN CP BF_SYSGET_DIOCNT - JR Z,SYS_GETDIOCNT + JP Z,SYS_GETDIOCNT + CP BF_SYSGET_DIOFN + JP Z,SYS_GETDIOFN + CP BF_SYSGET_RTCCNT + JP Z,SYS_GETRTCCNT CP BF_SYSGET_VDACNT - JR Z,SYS_GETVDACNT + JP Z,SYS_GETVDACNT + CP BF_SYSGET_VDAFN + JP Z,SYS_GETVDAFN + CP BF_SYSGET_SNDCNT + JP Z, SYS_GETSNDCNT + CP BF_SYSGET_SNDFN + JP Z,SYS_GETSNDFN CP BF_SYSGET_TIMER - JR Z,SYS_GETTIMER + JP Z,SYS_GETTIMER CP BF_SYSGET_SECS - JR Z,SYS_GETSECS + JP Z,SYS_GETSECS CP BF_SYSGET_BOOTINFO - JR Z,SYS_GETBOOTINFO + JP Z,SYS_GETBOOTINFO CP BF_SYSGET_CPUINFO - JR Z,SYS_GETCPUINFO + JP Z,SYS_GETCPUINFO CP BF_SYSGET_MEMINFO - JR Z,SYS_GETMEMINFO + JP Z,SYS_GETMEMINFO CP BF_SYSGET_BNKINFO - JR Z,SYS_GETBNKINFO - OR $FF ; SIGNAL ERROR + JP Z,SYS_GETBNKINFO + CP BF_SYSGET_CPUSPD + JP Z,SYS_GETCPUSPD + SYSCHKERR(ERR_NOFUNC) ; SIGNAL ERROR RET ; ; GET TIMER @@ -2350,6 +4126,7 @@ SYS_GETTIMER: HB_DI CALL LD32 HB_EI + LD C, TICKFREQ XOR A RET ; @@ -2365,7 +4142,7 @@ SYS_GETSECS: LD A,(HB_SECTCK) HB_EI NEG ; CONVERT DOWNCOUNTER TO UPCOUNTER - ADD A,TICKSPERSEC + ADD A,TICKFREQ LD C,A XOR A RET @@ -2394,6 +4171,7 @@ SYS_GETCPUINFO: LD A,(CB_CPUMHZ) LD L,A LD DE,(CB_CPUKHZ) + LD BC,(HB_CPUOSC) XOR A RET ; @@ -2403,8 +4181,10 @@ SYS_GETCPUINFO: ; E: COUNT OF RAM BANKS ; SYS_GETMEMINFO: - LD D,ROMSIZE / 32 - LD E,RAMSIZE / 32 + LD A,(CB_ROMBANKS) + LD D,A + LD A,(CB_RAMBANKS) + LD E,A XOR A RET ; @@ -2421,6 +4201,79 @@ SYS_GETBNKINFO: XOR A RET ; +; GET SYSTEM CPU SPEED PERFORMANCE ATTRIBUTES +; RETURNS: +; L: CLOCK MULT (0:HALF, 1:FULL, 2: DOUBLE) +; D: MEMORY WAIT STATES +; E: I/O WAIT STATES +; +SYS_GETCPUSPD: +; +#IF (((PLATFORM == PLT_SBC) | (PLATFORM == PLT_MBC)) & (CPUSPDCAP==SPD_HILO)) + LD A,(HB_RTCVAL) +#IF (PLATFORM == PLT_SBC) + XOR %00001000 ; SBC SPEED BIT IS INVERTED +#ENDIF + BIT 3,A + LD L,0 ; ASSUME HALF SPEED + JR Z,SYS_GETCPUSPD1 + LD L,1 +SYS_GETCPUSPD1: + LD DE,$FFFF ; UNKNOWN WAIT STATES +; + XOR A + RET +#ENDIF +; +#IF (CPUFAM == CPU_Z180) + LD HL,0 ; INIT CPU SPEED TO HALF + LD A,(HB_CPUTYPE) ; LOAD CPUTYPE + CP 2 ; S-CLASS OR ABOVE? + JR C,SYS_GETCPUSPD1 ; IF NOT, NO CCR/CMR +; + ; GET CCR BIT + IN0 A,(Z180_CCR) ; GET CLOCK CONTROL + RLCA ; ROTATE BIT TO BIT 0 + AND %00000001 ; ISOLATE IT + LD L,A ; SAVE IN L +; + LD A,(HB_CPUTYPE) ; LOAD CPUTYPE + CP 3 ; REV. N? + JR C,SYS_GETCPUSPD1 ; IF NOT, NO CMR +; + ; GET CMR BIT + IN0 A,(Z180_CMR) ; GET CLOCK MULTIPLIER + RLCA ; ROTATE BIT TO BIT 0 + AND %00000001 ; ISOLATE IT + LD H,A ; SAVE IN H +; +SYS_GETCPUSPD1: + ; CALC FINAL MULTIPLIER TO L + XOR A ; CLEAR ACCUM + ADD A,H ; ADD IN CMR BIT + ADD A,L ; ADD IN CCR BIT + LD L,A ; SAVE RESULT IN L + ; DCNTL = MMII???? + IN0 A,(Z180_DCNTL) ; GET WAIT STATES + RLCA ; ROTATE MEM WS BITS + RLCA ; ... TO LOW BITS + PUSH AF ; SAVE FOR NOW + AND %00000011 ; ISOLATE BITS + LD D,A ; PUT IN D + POP AF ; RECOVER A + RLCA ; ROTATE I/O WS BITS + RLCA ; ... TO LOW BITS + AND %00000011 ; ISOLATE BITS + INC A ; ADD 1 FOR BUILT-IN WS + LD E,A ; PUT IN E +; + XOR A + RET +#ENDIF +; + OR $FF + RET +; ; GET SERIAL UNIT COUNT ; SYS_GETCIOCNT: @@ -2429,6 +4282,26 @@ SYS_GETCIOCNT: XOR A ; SIGNALS SUCCESS RET ; +; GET SERIAL UNIT API FN ADR AND DATA ADR +; ENTRY: +; D: FUNCTION +; E: UNIT +; RETURNS: +; HL: FUNCTION ADDRESS +; DE: DATA BLOB ADDRESS +; +SYS_GETCIOFN: + BIT 7,E ; CHECK FOR SPECIAL UNIT CODE + CALL NZ,SYS_GETCIOFN1 ; IF SO, HANDLE IT + LD IY,CIO_TBL ; POINT TO UNIT TABLE + JP SYS_GETFN ; GO TO COMMON CODE +; +SYS_GETCIOFN1: + LD A,(CB_CONDEV) ; UNIT $80 -> CONSOLE UNIT + LD E,A ; REPLACE UNIT VALUE IN C + RET ; AND BACK TO REGULAR FLOW +; +; ; GET DISK UNIT COUNT ; SYS_GETDIOCNT: @@ -2437,6 +4310,30 @@ SYS_GETDIOCNT: XOR A ; SIGNALS SUCCESS RET ; +; GET DISK UNIT API FN ADR AND DATA ADR +; ENTRY: +; D: FUNCTION +; E: UNIT +; RETURNS: +; HL: FUNCTION ADDRESS +; DE: DATA BLOB ADDRESS +; +SYS_GETDIOFN: + LD IY,DIO_TBL ; POINT TO UNIT TABLE + JP SYS_GETFN ; GO TO COMMON CODE +; +; GET RTC UNIT COUNT +; +SYS_GETRTCCNT: + LD E,0 ; ASSUME 0 RTC DEVICES + LD A,(RTC_DISPACT) ; IS RTC ACTIVE? + OR A ; SET FLAGS + JR Z,SYS_GETRTCCNT1 ; IF NONE, DONE + INC E ; SET ONE DEVICE +SYS_GETRTCCNT1: + XOR A ; SIGNALS SUCCESS + RET +; ; GET VIDEO UNIT COUNT ; SYS_GETVDACNT: @@ -2445,6 +4342,57 @@ SYS_GETVDACNT: XOR A ; SIGNALS SUCCESS RET ; +; GET VIDEO UNIT API FN ADR AND DATA ADR +; ENTRY: +; D: FUNCTION +; E: UNIT +; RETURNS: +; HL: FUNCTION ADDRESS +; DE: DATA BLOB ADDRESS +; +SYS_GETVDAFN: + LD IY,VDA_TBL ; POINT TO UNIT TABLE + JP SYS_GETFN ; GO TO COMMON CODE +; +; GET SOUND UNIT COUNT +; +SYS_GETSNDCNT: + LD A,(SND_CNT) ; GET DEVICE COUNT (FIRST BYTE OF LIST) + LD E,A ; PUT IT IN E + XOR A ; SIGNALS SUCCESS + RET +; +; GET SOUND UNIT API FN ADR AND DATA ADR +; ENTRY: +; D: FUNCTION +; E: UNIT +; RETURNS: +; HL: FUNCTION ADDRESS +; DE: DATA BLOB ADDRESS +; +SYS_GETSNDFN: + LD IY,SND_TBL ; POINT TO UNIT TABLE + JP SYS_GETFN ; GO TO COMMON CODE +; +; SHARED CODE TO COMPLETE A FUNCTION LOOKUP +; ENTRY: +; IY: DISPATCH FUNCTION TABLE +; D: FUNCTION ID +; E: UNIT NUMBER +; EXIT: +; HL: DRIVER FUNCTION ADDRESS +; DE: DRIVER UNIT DATA ADDRESS +; +SYS_GETFN: + LD A,D ; GET FUNC NUM FROM D + LD B,A ; AND PUT IN B + LD A,E ; GET UNIT NUM FROM E + LD C,A ; AND PUT IN C + CALL HB_DISPCALC ; CALC FN ADR & BLOB ADR + PUSH IY ; MOVE DATA ADR + POP DE ; ... TO DE + RET ; AF STILL HAS RESULT OF CALC +; ; SET SYSTEM PARAMETERS ; PARAMETER(S) TO SET INDICATED IN C ; @@ -2456,7 +4404,9 @@ SYS_SET: JR Z,SYS_SETSECS CP BF_SYSSET_BOOTINFO JR Z,SYS_SETBOOTINFO - OR $FF ; SIGNAL ERROR + CP BF_SYSSET_CPUSPD + JR Z,SYS_SETCPUSPD + SYSCHKERR(ERR_NOFUNC) ; SIGNAL ERROR RET ; ; SET BOOT INFORMATION @@ -2495,6 +4445,242 @@ SYS_SETSECS: XOR A RET ; +; SET SYSTEM CPU SPEED ATTRIBUTES +; ON ENTRY: +; L: CLOCK MULT (0:HALF, 1:FULL, 2: DOUBLE) +; D: MEMORY WAIT STATES +; E: I/O WAIT STATES +; +SYS_SETCPUSPD: +; +#IF (((PLATFORM == PLT_SBC) | (PLATFORM == PLT_MBC)) & (CPUSPDCAP==SPD_HILO)) +; +; NOTE: WAIT STATE SETTINGS ARE IGNORED FOR Z80 +; + LD A,L ; CLK SPD TO ACCUM + CP $FF ; NO CHANGE? + JR Z,SYS_SETCPUSPD3 ; DONE IF SO + LD C,%00000000 ; HALF SPEED + CP 0 + JR Z,SYS_SETCPUSPD1 + LD C,%00001000 ; FULL SPEED + CP 1 + JR Z,SYS_SETCPUSPD1 + JR SYS_SETCPUSPD_ERR ; SPD NOT SUPPORTED +SYS_SETCPUSPD1: + LD A,(HB_RTCVAL) + AND ~%00001000 ; CLEAR SPEED BIT + OR C ; IMPLEMENT NEW SPEED BIT +#IF (PLATFORM == PLT_SBC) + ; SBC SPEED BIT IS INVERTED, ADJUST IT + LD A,C + XOR %00001000 + LD C,A +#ENDIF + LD (HB_RTCVAL),A ; SAVE IN SHADOW REGISTER + OUT (RTCIO),A ; UPDATE HARDWARE REGISTER +; + ; UPDATE THE CURRENT CPU SPEED IN HCB! + LD A,L + LD HL,(HB_CPUOSC) ; ASSUME FULL SPEED + CP 1 ; CHECK FOR 1 (FULL SPEED) + JR Z,SYS_SETCPUSPD2 ; IF SO, ALL DONE + ; ADJUST HL TO REFLECT HALF SPEED OPERATION + SRL H ; ADJUST HL ASSUMING + RR L ; HALF SPEED OPERATION +; +SYS_SETCPUSPD2: +; +; HL SHOULD NOW HAVE FINAL CPU RUNNING SPEED IN KHZ. +; UPDATE CB_CPUMHZ/CB_CPUKHZ WITH THIS VALUE. +; + LD (CB_CPUKHZ),HL ; UPDATE CPUKHZ + LD DE,1000 ; SET UP TO DIV BY 1000 FOR MHZ + CALL DIV16 ; BC=CPU MHZ, HL=REMAINDER + LD DE,500 ; SET UP TO ROUND UP + XOR A ; IF WITHIN 500 KHZ + SBC HL,DE ; REMAINDER - 500 + CCF ; COMPLEMENT CF + ADC A,C ; C -> A; ADD CF FOR ROUNDING + LD (CB_CPUMHZ),A ; SAVE IT +; + ; REINIT DELAY ROUTINE + LD A,(CB_CPUMHZ) ; CPU SPEED TO ACCUM AND INIT + CALL DELAY_INIT ; .. SPEED COMPENSATED DELAY +; +SYS_SETCPUSPD3: + XOR A + RET +#ENDIF +; +#IF (CPUFAM == CPU_Z180) + ; VERIFY THAT REQUESTED SETTINGS ARE ALLOWED BY HARDWARE + LD A,L ; GET SPEED REQUESTED + CP $FF ; NO CHANGE? + JR Z,SYS_SETCPUSPD0A ; SKIP CHECK + LD A,(HB_CPUTYPE) ; 1=ORIG, 2=REVK, 3=REVN + INC L ; 1=HALF,2=FULL,3=DOUBLE + CP L ; TOO HIGH FOR CPU TYPE? + JP C,SYS_SETCPUSPD_ERR ; CPU CAN'T DO SPD MULT + DEC L ; RESTORE ORIG REQUEST +SYS_SETCPUSPD0A: + LD A,D ; MEM WS + CP $FF ; NO CHANGE? + JR Z,SYS_SETCPUSPD0B ; SKIP CHECK + CP 4 ; TOO HIGH? + JP NC,SYS_SETCPUSPD_ERR ; >3 IS TOO HIGH +SYS_SETCPUSPD0B: + LD A,D ; I/O WS + CP $FF ; NO CHANGE? + JR Z,SYS_SETCPUSPD0C ; SKIP CHECK + CP 4 ; TOO HIGH? + JP NC,SYS_SETCPUSPD_ERR ; >3 IS TOO HIGH +SYS_SETCPUSPD0C: +; + PUSH DE ; SAVE WAIT STATES FOR NOW + ; BEFORE IMPLEMENTING THE NEW CPU SPEED, WE SWITCH THE + ; WAIT STATES TO MAXIMUM BECAUSE WE MAY BE IMPLEMENTING + ; SLOWER WAIT STATES REQUIRED BY THE NEW SPEED. WE SAVE + ; THE ORIGINAL WAIT STATES REGISTER VALUE ON STACK + IN0 A,(Z180_DCNTL) ; GET CURRENT REGISTER VALUE + LD E,A ; PUT IN E + PUSH DE ; SAVE FOR LATER + OR %11110000 ; MAX WAIT STATES + OUT0 (Z180_DCNTL),A ; DO IT +; + LD A,L ; NEW CLK SPD TO ACCUM + CP $FF ; NO CHANGE? + JR Z,SYS_SETCPUSPD2B ; IF SO, SKIP TO WAIT STATES +; + LD B,0 ; B HAS BIT FOR CMR + LD C,0 ; C HAS BIT FOR CCR + CP 2 ; DOUBLE SPEED? + JR C,SYS_SETCPUSPD1 ; <2?, SKIP AHEAD + LD B,%10000000 ; SET CMR BIT +SYS_SETCPUSPD1: + CP 1 ; FULL SPEED? + JR C,SYS_SETCPUSPD2 ; <1?, SKIP AHEAD + LD C,%10000000 ; SET CCR BIT +SYS_SETCPUSPD2: +; + ; IMPLEMENT THE NEW CPU SPEED + IN0 A,(Z180_CMR) + AND ~%10000000 + OR B + OUT0 (Z180_CMR),A + IN0 A,(Z180_CCR) + AND ~%10000000 + OR C + OUT0 (Z180_CCR),A +; + ; UPDATE THE CURRENT CPU SPEED IN HCB! + LD A,L ; SETTING TO A + LD HL,(HB_CPUOSC) ; START WITH CPU OSC VALUE + ; ADJUST HL TO REFLECT HALF SPEED OPERATION + SRL H ; ADJUST HL ASSUMING + RR L ; HALF SPEED OPERATION + OR A ; CHECK FOR HALF SPEED + JR Z,SETCPUSPD2A ; IF SO, DONE + ; ADJUST HL TO REFLECT FULL SPEED OPERATION + SLA L + RL H + CP 1 ; CHECK FOR FULL SPEED + JR Z,SETCPUSPD2A ; IF SO DONE + ; ADJUST HL TO REFLECT DOUBLE SPEED OPERATION + SLA L + RL H +; +SETCPUSPD2A: +; +; HL SHOULD NOW HAVE FINAL CPU RUNNING SPEED IN KHZ. +; UPDATE CB_CPUMHZ/CB_CPUKHZ WITH THIS VALUE. +; + LD (CB_CPUKHZ),HL ; UPDATE CPUKHZ + LD DE,1000 ; SET UP TO DIV BY 1000 FOR MHZ + CALL DIV16 ; BC=CPU MHZ, HL=REMAINDER + LD DE,500 ; SET UP TO ROUND UP + XOR A ; IF WITHIN 500 KHZ + SBC HL,DE ; REMAINDER - 500 + CCF ; COMPLEMENT CF + ADC A,C ; C -> A; ADD CF FOR ROUNDING + LD (CB_CPUMHZ),A ; SAVE IT +; +SYS_SETCPUSPD2B: + ; NOW IMPLEMENT ANY WAIT STATE CHANGES. + POP HL ; INIT L WITH ORIG DCNTL VALUE + POP DE ; RECOVER WAIT STATES + LD A,D ; GET MEM WS + CP $FF ; SKIP? + JR Z,SYS_SETCPUSPD3 ; IF SO, GO AHEAD + AND %00000011 ; JUST TWO BITS + RRCA ; MEM WS IS TOP TWO BITS + RRCA + LD H,A ; MOVE WS BITS TO H + LD A,L ; CUR VALUE TO A + AND %00111111 ; MASK OFF MEM WS BITS + OR H ; SET NEW MEM WS BITS + LD L,A ; BACK TO L +; +SYS_SETCPUSPD3: +; + LD A,E ; GET I/O WS + CP $FF ; SKIP? + JR Z,SYS_SETCPUSPD4 ; IF SO, GO AHEAD + DEC A ; ADJUST FOR BUILT-IN I/O WS + AND %00000011 ; JUST TWO BITS + RRCA ; I/O WS IS BITS 5-4 + RRCA + RRCA + RRCA + LD H,A ; MOVE WS BITS TO H + LD A,L ; CUR VALUE TO A + AND %11001111 ; MASK OFF I/O WS BITS + OR H ; SET NEW I/O WS BITS + LD L,A ; BACK TO L +; +SYS_SETCPUSPD4: + LD A,L ; WORKING VALUE TO A + OUT0 (Z180_DCNTL),A ; IMPLEMENT NEW VALUE +; + ; REINIT DELAY ROUTINE + LD A,(CB_CPUMHZ) ; CPU SPEED TO ACCUM AND INIT + CALL DELAY_INIT ; .. SPEED COMPENSATED DELAY +; + #IF ((INTMODE == 2) & (Z180_TIMER)) + ; THE Z180 TIMER IS BASED ON CPU SPEED. SO HERE + ; WE RECOMPUTE THE TIMER CONSTANTS BASED ON THE NEW SPEED. + XOR A ; ALL BITS ZERO + OUT0 (Z180_TCR),A ; ... INHIBITS TIMER OPERATION + LD HL,(CB_CPUKHZ) ; 50HZ = 18432000 / 20 / 50 / X, SO X = CPU KHZ + OUT0 (Z180_TMDR0L),L ; INITIALIZE TIMER 0 DATA REGISTER + OUT0 (Z180_TMDR0H),H + DEC HL ; RELOAD OCCURS *AFTER* ZERO + OUT0 (Z180_RLDR0L),L ; INITIALIZE TIMER 0 RELOAD REGISTER + OUT0 (Z180_RLDR0H),H + LD A,%00010001 ; ENABLE TIMER0 INT AND DOWN COUNTING + OUT0 (Z180_TCR),A + #ENDIF +; + #IF (ASCIENABLE) + ; RESET THE ASCI PORTS IN CASE SPEED CHANGED! + ; N.B., THIS WILL FAIL IF THE CURRENT BAUD RATE + ; IS IMPOSSIBLE TO IMPLEMENT AT THE NEW CPU SPEED!!! + LD DE,-1 + LD IY,ASCI0_CFG + CALL ASCI_INITDEV + LD DE,-1 + LD IY,ASCI1_CFG + CALL ASCI_INITDEV + #ENDIF +; + XOR A + RET +#ENDIF +; +SYS_SETCPUSPD_ERR: + OR $FF ; NOT SUPPORTED + RET +; ; RETURN A BYTE OF MEMORY FROM SPECIFIED BANK ; ENTRY: D=BANK ID, HL=ADDRESS ; RETURN: E=BYTE VALUE @@ -2505,15 +4691,30 @@ SYS_SETSECS: ; SYS_PEEK: #IF (INTMODE == 1) - LD A,I - DI + #IF (CPUFAM == CPU_Z280) + PUSH IY + LD C,Z280_MSR + LDCTL IY,(C) + PUSH IY + HB_DI + #ELSE + LD A,I ; SAVE THE INTERRUPT STATUS + DI ; COPY IFF2 TO P/V FLAG PUSH AF + #ENDIF #ENDIF CALL HBX_PEEK ; IMPLEMENTED IN PROXY #IF (INTMODE == 1) - POP AF - JP PO,$+4 - EI + #IF (CPUFAM == CPU_Z280) + LD C,Z280_MSR + POP IY + LDCTL (C),IY + POP IY + #ELSE + POP AF ; RECALL INITIAL INTERRUPT STATUS + JP PO,$+4 ; RETURN TO INITIAL STATE + EI ; *** DO NOT USE HB_EI HERE *** + #ENDIF #ENDIF XOR A RET @@ -2527,15 +4728,30 @@ SYS_PEEK: ; SYS_POKE: #IF (INTMODE == 1) - LD A,I - DI + #IF (CPUFAM == CPU_Z280) + PUSH IY + LD C,Z280_MSR + LDCTL IY,(C) + PUSH IY + HB_DI + #ELSE + LD A,I ; SAVE THE INTERRUPT STATUS + HB_DI ; COPY IFF2 TO P/V FLAG PUSH AF + #ENDIF #ENDIF CALL HBX_POKE ; IMPLEMENTED IN PROXY #IF (INTMODE == 1) - POP AF - JP PO,$+4 - EI + #IF (CPUFAM == CPU_Z280) + LD C,Z280_MSR + POP IY + LDCTL (C),IY + POP IY + #ELSE + POP AF ; RECALL INITIAL INTERRUPT STATUS + JP PO,$+4 ; RETURN TO INITIAL STATE + EI ; *** DO NOT USE HB_EI HERE *** + #ENDIF #ENDIF XOR A RET @@ -2551,7 +4767,7 @@ SYS_INT: JR Z,SYS_INTGET CP BF_SYSINT_SET JR Z,SYS_INTSET - OR $FF ; SIGNAL ERROR + SYSCHKERR(ERR_NOFUNC) ; SIGNAL ERROR RET ; ; GET INTERRUPT SYSTEM INFORMATION @@ -2577,8 +4793,7 @@ SYS_INTINFO: ; SYS_INTVECADR: #IF (INTMODE == 0) - CALL PANIC ; INVALID FOR INT MODE 0 - OR $FF + SYSCHKERR(ERR_BADCFG) ; SIGNAL ERROR. INVALID FOR INT MODE 0 RET #ENDIF #IF (INTMODE == 1) @@ -2592,8 +4807,7 @@ SYS_INTVECADR: LD A,E ; INCOMING INDEX POSITION TO A CP C ; COMPARE TO VECTOR COUNT JR C,SYS_INTGET1 ; CONTINUE IF POSITION IN RANGE - CALL PANIC ; ELSE ERROR - OR $FF + SYSCHKERR(ERR_RANGE) ; ELSE ERROR RET SYS_INTGET1: OR A ; CLEAR CARRY @@ -2623,7 +4837,7 @@ SYS_INTGET: ; ; SET AN INTERRUPT VECTOR FOR A SPECIFIED POSITION IN THE INT VECTOR LIST / TABLE ; ENTRY: E=LIST/TABLE POSITION, HL=NEW INTERRUPT VECTOR -; RETURN: HL=PREVIOUS INTERRUPT VECTOR, DE=ADR OF INT ROUTING ENGINE FOR IM2 +; RETURN: HL=PREVIOUS INTERRUPT VECTOR ; SYS_INTSET: PUSH HL ; SAVE NEW VECTOR @@ -2688,42 +4902,91 @@ HB_IM1PTR .DW HB_IVT ; POINTER FOR NEXT IM1 ENTRY ; #ENDIF ; -; TIMER INTERRUPT ; -HB_TIMINT: - ; INCREMENT TICK COUNTER (32 BIT) - LD HL,HB_TICKS ; POINT TO TICK COUNTER - CALL INC32HL ; -HB_TIMINT1: +#IF (MEMMGR == MM_Z280) ; -#IF 0 +Z280_TIMINT: + ; DISCARD REASON CODE + INC SP + INC SP +; + ; SAVE INCOMING REGISTERS + PUSH AF + PUSH BC + PUSH DE + PUSH HL ; - LD HL,TEMPCNT - DEC (HL) - JR NZ,HB_TIMINT2 - LD (HL),250 + ; CALL PRIMARY TIMER LOGIC ON EVERY OTHER INT + LD A,(Z280_TIMCTR) + XOR $FF + LD (Z280_TIMCTR),A + CALL Z,HB_TIMINT +; + ; SELECT I/O PAGE $FE (SAVING PREVIOUS VALUE) + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL HL,(C) ; GET CURRENT I/O PAGE + PUSH HL ; SAVE IT + LD L,$FE ; NEW COUNTER/TIMER I/O PAGE + LDCTL (C),HL +; + ; CLEAR END OF COUNT CONDITION TO RESET INTERRUPT + IN A,(Z280_CT0_CMDST) ; GET STATUS + RES 1,A ; CLEAR CC + OUT (Z280_CT0_CMDST),A ; SET C/T 0 +; + ; RESTORE I/O PAGE + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + POP HL ; RECOVER ORIGINAL I/O PAGE + LDCTL (C),HL +; + ; RESTORE REGISTERS + POP HL + POP DE + POP BC + POP AF ; - LD A,'*' - CALL COUT - JR HB_TIMINT2 + RETIL ; -TEMPCNT .DB 250 +Z280_TIMCTR .DB 0 ; USED TO DIVIDE TIMER INTS ; #ENDIF ; -HB_TIMINT2: +; +; +HB_TIMINT: +#IF FALSE ; *DEBUG* + LD HL,HB_TIMDBGCNT + INC (HL) + LD A,(HL) + OUT (DIAGPORT),A + JR HB_TIMDBG1 +HB_TIMDBGCNT .DB 0 +HB_TIMDBG1: +#ENDIF ; *DEBUG* +; +; TIMER HANDLER VECTORS +; THESE CAN BE HOOKED AS DESIRED BY DRIVERS +; +VEC_TICK: + JP HB_TICK ; TICK PROCESSING VECTOR +VEC_SECOND: + JP HB_SECOND ; SECOND PROCESSING VECTOR +; +; TIMER HANDLERS +; +HB_TICK: + ; INCREMENT TICK COUNTER (32 BIT) + LD HL,HB_TICKS ; POINT TO TICK COUNTER + CALL INC32HL LD HL,HB_SECTCK ; POINT TO SECONDS TICK COUNTER - DEC (HL) ; COUNTDOWN 50 TICKS - JR NZ,HB_TIMINT3 ; NOT ZERO YET, DONE FOR THIS CYCLE - ; 50 TICKS HAVE ELAPSED - LD A,TICKSPERSEC ; 50 TICKS PER SECOND + DEC (HL) ; COUNTDOWN ONE SECOND OF TICKS + JR NZ,HB_TICK1 ; NOT DONE, SKIP AHEAD + LD A,TICKFREQ ; TICKS PER SECOND LD (HL),A ; RESET COUNTDOWN REGISTER - ; INCREMENT SECONDS COUNTER - LD HL,HB_SECS ; POINT TO SECONDS COUNTER - CALL INC32HL + CALL VEC_SECOND ; DO SECONDS PROCESSING VIA VECTOR ; -HB_TIMINT3: +HB_TICK1: ; #IF (CPUFAM == CPU_Z180) ; ACK/RESET Z180 TIMER INTERRUPT @@ -2731,19 +4994,28 @@ HB_TIMINT3: IN0 A,(Z180_TMDR0L) #ENDIF ; -#IF (PLATFORM == PLT_EZZ80) +#IF (WDOGMODE != WDOG_NONE) ; PULSE WATCHDOG OUT (WDOGIO),A ; VALUE IS IRRELEVANT #ENDIF +; +#IF MKYENABLE + CALL MKY_INT +#ENDIF ; OR $FF ; NZ SET TO INDICATE INT HANDLED RET ; +HB_SECOND: + ; INCREMENT SECONDS COUNTER + LD HL,HB_SECS ; POINT TO SECONDS COUNTER + JP INC32HL ; INCREMENT AND RETURN +; ; BAD INTERRUPT HANDLER ; HB_BADINT: -#IF 0 ; *DEBUG* +#IF FALSE ; *DEBUG* LD HL,HB_BADINTCNT INC (HL) LD A,(HL) @@ -2766,26 +5038,223 @@ HB_BADINTCNT .DB 0 OR $FF ; SIGNAL INTERRUPT HANDLED RET ; +; Z280 BAD INT HANDLER +; +#IF (MEMMGR == MM_Z280) +; +Z280_BADINT: + ; SAVE REASON CODE FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_RCSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK + ; SAVE MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_BADINTSTR + CALL NEWLINE2 + PRTS("+++ $") + CALL WRITESTR + POP DE + CALL XREGDMP +; + ; RECOVER MSR, THEN RETURN VIA RETIL + PUSH HL ; SAVE HL + LD HL,(HB_RCSAV) ; GET SAVED REASON CODE + PRTS(" RC=$") + CALL PRTHEXWORDHL ; DUMP MSR + LD HL,(HB_MSRSAV) ; GET SAVED MSR + PRTS(" MSR=$") + CALL PRTHEXWORDHL ; DUMP MSR + EX (SP),HL ; MSR TO STK, RECOVER HL +; + RETIL ; RETURN FROM INT +; +Z280_SSTEP: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_SSTEPSTR + JP Z280_DIAG +; +Z280_BRKHLT: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_BRKHLTSTR + JP Z280_DIAG +; +Z280_DIVEXC: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_DIVEXCSTR + JP Z280_DIAG +; +Z280_STKOVR: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_STKOVRSTR + JP Z280_DIAG +; +Z280_ACCVIO: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_ACCVIOSTR + JP Z280_DIAG +; +Z280_DIAG: + CALL NEWLINE2 + PRTS("+++ $") + CALL WRITESTR + POP DE + CALL XREGDMP +; + ; RECOVER MSR, THEN RETURN VIA RETIL + PUSH HL ; SAVE HL + LD HL,(HB_MSRSAV) ; GET SAVED MSR + PRTS(" MSR=$") + CALL PRTHEXWORDHL ; DUMP MSR + EX (SP),HL ; MSR TO STK, RECOVER HL +; + ;RETIL + DI + HALT +; +Z280_BADINTSTR .TEXT "BAD INT $" +Z280_SSTEPSTR .TEXT "SINGLE STEP $" +Z280_BRKHLTSTR .TEXT "BREAK HALT $" +Z280_DIVEXCSTR .TEXT "DIVISION EXCEPTION $" +Z280_STKOVRSTR .TEXT "STACK OVERFLOW $" +Z280_ACCVIOSTR .TEXT "ACCESS VIOLATION $" +; +#ENDIF +; +; Z280 PRIVILEGED INSTRUCTION HANDLER +; +#IF (MEMMGR == MM_Z280) +; +Z280_PRIVINST: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK + EX (SP),HL ; GET ADR, SAVE HL +; + PUSH AF + PUSH BC + PUSH DE +; + LDUP A,(HL) ; BYTE FROM USER SPACE +; + ; HANDLE DI + CP $F3 ; DI? + JR NZ,Z280_PRIVINST2 + HB_DI ; DO THE DI + INC HL ; BUMP PAST IT + JR Z280_PRIVINSTX +; +Z280_PRIVINST2: + ; HANDLE EI + CP $FB ; EI? + JR NZ,Z280_PRIVINST3 + HB_EI ; DO THE EI + INC HL ; BUMP PAST IT + JR Z280_PRIVINSTX +; +Z280_PRIVINST3: + ; SOMETHING ELSE, DIAGNOSE & HALT SYSTEM + LD DE,Z280_PRIVSTR + CALL WRITESTR + CALL PRTHEXWORDHL +; + ; DUMP 16 BYTES OF USER ADDRESS SPACE + CALL PC_SPACE + CALL PC_LBKT + LD B,$10 +Z280_PRIVINST4: + LDUP A,(HL) ; BYTE FROM USER SPACE + CALL PRTHEXBYTE + INC HL + DJNZ Z280_PRIVINST4 + CALL PC_RBKT +; + ; GO NO FURTHER + DI + HALT +; +Z280_PRIVINSTX: + ; RESTORE REGISTERS + POP DE + POP BC + POP AF +; + ; RECOVER HL AND MSR, THEN RETURN VIA RETIL + EX (SP),HL ; RECOVER HL, ADR TO STK + PUSH HL ; SAVE HL + LD HL,(HB_MSRSAV) ; GET SAVED MSR + EX (SP),HL ; MSR TO STK, RECOVER HL + RETIL ; RETURN FROM INT +; +HB_MSRSAV .DW 0 ; SAVED MSR +HB_RCSAV .DW 0 ; SAVED REASON CODE +; +Z280_PRIVSTR .TEXT "\r\n\r\n*** Privileged Instruction @$" +; +#ENDIF +; ; COMMON API FUNCTION DISPATCH CODE ; -; ON ENTRY C IS UNIT # (INDEX INTO XXX_TBL OF UNITS) -; AND IY POINTS TO START OF UNIT TABLE. +; ON ENTRY B IS API FUNCTION NUMBER AND C IS UNIT # +; (INDEX INTO XXX_TBL OF UNITS) AND IY POINTS TO START OF UNIT TABLE. ; USE UNIT # IN C TO LOOKUP XXX_TBL ENTRY. THE XXX_TBL ; ENTRY CONTAINS THE START OF THE DRIVER FUNCTION TABLE AND ; THE DEVICE SPECIFIC INSTANCE DATA (BLOB). SET IY TO BLOB ADDRESS ; AND CALL THE SPECIFIC FUNCTION REQUESTED IN THE DRIVER. ; HB_DISPCALL: - ; CHECK INCOMING UNIT INDEX IN C FOR VAILIDITY + PUSH HL ; SAVE INCOMING HL VALUE + CALL HB_DISPCALC ; IY = BLOB ADR, HL = FN ADR + JR NZ,HB_DISPCALL1 ; ABORT ON ERROR + EX (SP),HL ; RESTORE HL & FN ADR TO TOS + RET ; JUMP TO FN ADR +HB_DISPCALL1: + POP HL ; RECOVER HL + RET ; AND DONE +; +; ENTRY: BC=FUNC/UNIT, IY=DISPATCH TABLE +; EXIT: HL=FUNC ADR, IY=DATA BLOB ADR +; +HB_DISPCALC: + ; CHECK INCOMING UNIT INDEX IN C FOR VALIDITY LD A,C ; A := INCOMING DISK UNIT INDEX CP (IY-1) ; COMPARE TO COUNT - JR NC,HB_DISPERR ; HANDLE INVALID UNIT INDEX + JR NC,HB_UNITERR ; HANDLE INVALID UNIT INDEX ; CHECK FUNCTION INDEX FOR VALIDITY LD A,B ; A := INCOMING FUNCTION NUMBER AND $0F ; LOW NIBBLE ONLY FOR FUNC INDEX CP (IY-3) ; CHECK FN NUM AGAINST MAX - JR NC,HB_DISPERR ; HANDLE FN NUM OUT OF RANGE ERROR + JR NC,HB_FUNCERR ; HANDLE FN NUM OUT OF RANGE ERROR ; BUMP IY TO ACTUAL XXX_TBL ENTRY FOR INCOMING UNIT INDEX PUSH BC ; SAVE BC @@ -2796,7 +5265,7 @@ HB_DISPCALL: POP BC ; RESTORE BC ; DERIVE DRIVER FUNC ADR TO CALL - PUSH HL ; SAVE INCOMING HL + ;PUSH HL ; SAVE INCOMING HL LD L,(IY+0) ; COPY DRIVER FUNC TABLE LD H,(IY+1) ; ... START TO HL RLCA ; CONV UNIT (STILL IN A) TO FN ADR OFFSET @@ -2805,21 +5274,26 @@ HB_DISPCALL: INC HL ; ... TO GET LD H,(HL) ; ... ACTUAL LD L,A ; ... TARGET FUNCTION ADDRESS - EX (SP),HL ; RESTORE HL, FUNC ADR ON STACK + ;EX (SP),HL ; RESTORE HL, FUNC ADR ON STACK ; GET UNIT INSTANCE DATA BLOB ADDRESS TO IY - PUSH HL ; SAVE INCOMING HL + ;PUSH HL ; SAVE INCOMING HL + PUSH HL ; SAVE FUNC ADR LD L,(IY+2) ; HL := DATA BLOB ADDRESS LD H,(IY+3) ; ... EX (SP),HL ; RESTORE HL, BLOB ADR ON TOS POP IY ; IY := BLOB ADR + XOR A ; SIGNAL SUCCESS RET ; JUMP TO DRIVER FUNC ADR ON TOS ; -HB_DISPERR: - CALL PANIC ; PANIC - OR $FF ; SIGNAL ERROR - RET ; AND RETURN VIA DISPEXIT +HB_FUNCERR: + SYSCHKERR(ERR_NOFUNC) ; SIGNAL ERROR + RET +; +HB_UNITERR: + SYSCHKERR(ERR_NOUNIT) ; SIGNAL ERROR + RET ; ; ADD AN ENTRY TO THE UNIT TABLE AT ADDRESS IN HL ; BC: DRIVER FUNCTION TABLE @@ -2856,7 +5330,7 @@ HB_ADDENT: ; ALL OTHER REGISTERS PRESERVED ; ; A 4 BYTE HEADER IS PLACED IN FRONT OF THE ALLOCATED MEMORY -; - DWORD: SIZE OF MEMROY ALLOCATED (DOES NOT INCLUDE 4 BYTE HEADER) +; - DWORD: SIZE OF MEMORY ALLOCATED (DOES NOT INCLUDE 4 BYTE HEADER) ; - DWORD: ADDRESS WHERE ALLOC WAS CALLED (VALUE ON TOP OF STACK AT CALL) ; HB_ALLOC: @@ -2905,25 +5379,426 @@ HB_ALLOC: HB_ALLOC1: ; ERROR RETURN POP DE ; RESTORE INCOMING DE - OR $FF ; SIGNAL ERROR - RET ; AND RETURN + SYSCHKERR(ERR_NOMEM) ; SIGNAL ERROR + RET +; +HB_TMPSZ .DW 0 +HB_TMPREF .DW 0 +; +;================================================================================================== +; Z280 INTERRUPT VECTOR TABLE +;================================================================================================== +; +#IF (MEMMGR == MM_Z280) +; + ; THE Z280 IVT MUST BE ON A 4K BOUNDARY. IT HAS BEEN LOCATED + ; HERE IN AN EFFORT TO MINIMIZE WASTED SPACE. THERE SHOULD BE + ; A LITTLE LESS THAN 4K OF CODE ABOVE. +; + .FILL $1000 - ($ & $FFF) ; MUST BE 4K ALIGNED! +; +Z280_IVT: + .DW 0, 0 ; RESERVED + .DW 0 ; NMI MSR + .DW 0 ; NMI VECTOR + .DW $0000 ; INT A MSR + .DW Z280_BADINT ; INT A VECTOR + .DW $0000 ; INT B MSR + .DW Z280_BADINT ; INT B VECTOR + .DW $0000 ; INT C MSR + .DW Z280_BADINT ; INT C VECTOR + .DW $0000 ; COUNTER/TIMER 0 MSR + .DW Z280_BADINT ; COUNTER/TIMER 0 VECTOR + .DW $0000 ; COUNTER/TIMER 1 MSR + .DW Z280_BADINT ; COUNTER/TIMER 1 VECTOR + .DW 0, 0 ; RESERVED + .DW $0000 ; COUNTER/TIMER 2 MSR + .DW Z280_BADINT ; COUNTER/TIMER 2 VECTOR + .DW $0000 ; DMA CHANNEL 0 MSR + .DW Z280_BADINT ; DMA CHANNEL 0 VECTOR + .DW $0000 ; DMA CHANNEL 1 MSR + .DW Z280_BADINT ; DMA CHANNEL 1 VECTOR + .DW $0000 ; DMA CHANNEL 2 MSR + .DW Z280_BADINT ; DMA CHANNEL 2 VECTOR + .DW $0000 ; DMA CHANNEL 3 MSR + .DW Z280_BADINT ; DMA CHANNEL 3 VECTOR + .DW $0000 ; UART RECEIVER MSR + .DW Z280_BADINT ; UART RECEIVER VECTOR + .DW $0000 ; UART TRANSMITTER MSR + .DW Z280_BADINT ; UART TRANSMITTER VECTOR + .DW $0000 ; SINGLE STEP TRAP MSR + .DW Z280_SSTEP ; SINGLE STEP TRAP VECTOR + .DW $0000 ; BREAK ON HALT TRAP MSR + .DW Z280_BRKHLT ; BREAK ON HALT TRAP VECTOR + .DW $0000 ; DIVISION EXCEPTION TRAP MSR + .DW Z280_DIVEXC ; DIVISION EXCEPTION TRAP VECTOR + .DW $0000 ; STACK OVERFLOW WARNING TRAP MSR + .DW Z280_STKOVR ; STACK OVERFLOW WARNING TRAP VECTOR + .DW $0000 ; ACCESS VIOLATION TRAP MSR + .DW Z280_ACCVIO ; ACCESS VIOLATION TRAP VECTOR + .DW $0000 ; SYSTEM CALL TRAP MSR + .DW Z280_SYSCALL ; SYSTEM CALL TRAP VECTOR + .DW $0000 ; PRIVILEGED INSTRUCTION TRAP MSR + .DW Z280_PRIVINST ; PRIVILEGED INSTRUCTION TRAP VECTOR + .DW $0000 ; EPU <- MEMORY EXTENDED INSTRUCTION TRAP MSR + .DW $0000 ; EPU <- MEMORY EXTENDED INSTRUCTION TRAP VECTOR + .DW $0000 ; MEMORY <- EPU EXTENDED INSTRUCTION TRAP MSR + .DW $0000 ; MEMORY <- EPU EXTENDED INSTRUCTION TRAP VECTOR + .DW $0000 ; A <- EPU EXTENDED INSTRUCTION TRAP MSR + .DW $0000 ; A <- EPU EXTENDED INSTRUCTION TRAP VECTOR + .DW $0000 ; EPU INTERNAL OPERATION EXTENDED INSTRUCTION TRAP MSR + .DW $0000 ; EPU INTERNAL OPERATION EXTENDED INSTRUCTION TRAP VECTOR + .DW 0, 0 ; RESERVED + .DW 0, 0 ; RESERVED + ; PROGRAM COUNTER VALUES FOR NMI/INTA (16) + .DW HBX_IV00 + .DW HBX_IV01 + .DW HBX_IV02 + .DW HBX_IV03 + .DW HBX_IV04 + .DW HBX_IV05 + .DW HBX_IV06 + .DW HBX_IV07 + .DW HBX_IV08 + .DW HBX_IV09 + .DW HBX_IV0A + .DW HBX_IV0B + .DW HBX_IV0C + .DW HBX_IV0D + .DW HBX_IV0E + .DW HBX_IV0F + ; THE REMAINDER OF THE Z280 IVT IS TRUNCATED HERE BECAUSE IT + ; TAKES A BUNCH OF SPACE AND IS NOT USED. WE SUPPORT ONLY + ; 16 VECTORED INTERRUPTS AND THEY MUST BE CONNECTED TO INTA. +; +#ENDIF +; +; Z280 BANK SELECTION (CALLED FROM PROXY) +; +#IF (MEMMGR == MM_Z280) +; +; REG A HAS BANK ID, REG B HAS INITIAL PDR TO PROGRAM +; REGISTERS AF, BC, HL DESTROYED +; +; THIS ROUTINE MAY BE RELOCATED TO RUN IN HIGH MEMORY IN CERTAIN CASES +; LIKE A SYSTEM RESTART. IT MUST BE KEPT ENTIRELY RELOCATABLE. +; +Z280_BNKSEL: + ;; *DEBUG* + ;CALL PC_LBKT + ;CALL PRTHEXBYTE + ;CALL PC_RBKT + + ; SELECT I/O PAGE $FE (SAVING PREVIOUS VALUE) + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL HL,(C) ; GET CURRENT I/O PAGE + PUSH HL ; SAVE IT + LD L,$FF ; NEW I/O PAGE + LDCTL (C),HL +; + ; CONVERT BANK ID TO TOP 12 BITS OF PHYSICAL ADDRESS + ; WITH $0A IN THE LOW ORDER NIBBLE: + ; BANK ID: R000 BBBB + ; PDR: R000 0BBB B000 1010 (RCBUS) + ; PDR: 0000 RBBB B000 1010 (ZZ80MB) +; + MULTU A,$80 ; HL=0R00 0BBB B000 0000 + BIT 6,H ; RAM BIT SET? + JR Z,Z280_BNKSEL2 ; IF NOT, ALL DONE + RES 6,H ; OTHERWISE, MOVE RAM BIT + SET RAMLOC-16,H ; HL=0000 RBBB B000 0000 +; +Z280_BNKSEL2: +; + ; SET LOW NIBBLE + LD A,$0A ; VALUE FOR LOW NIBBLE + ADD HL,A ; ADD HL,A ; HL=0000 RBBB B000 1010 +; + ; POINT TO FIRST PDR TO PROGRAM + LD A,B ; INITIAL PDR TO PROG + OUT (Z280_MMUPDRPTR),A ; SET THE PDR POINTER +; + ; PROGRAM 8 PDRS + LD C,Z280_MMUBLKMOV ; PDR BLOCK MOVE PORT + ;LD B,8 ; PROGRAM 8 PDRS + LD A,$10 ; PDR VALUE INCREMENT +Z280_BNKSEL3: + ; PROGRAM 8 PDR VALUES + ; LOOP UNROLLED FOR SPEED + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + ;DJNZ Z280_BNKSEL3 ; DO ALL PDRS +; + ; RESTORE I/O PAGE + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + POP HL ; RECOVER ORIGINAL I/O PAGE + LDCTL (C),HL +; + RET +; +Z280_BNKSEL_LEN .EQU $ - Z280_BNKSEL +; +#ENDIF +; +; Z280 BANK COPY (CALLED FROM PROXY) +; +; USE Z280 PHYSICAL MEMORY DMA COPY TO PERFORM AN INTERBANK COPY. +; COPY FROM (HB_SRCBNK):(HL) TO (HB_DSTBNK):(DE) FOR BC BYTES. BOTH +; HB_SRCBNK AND HB_DSTBNK MUST BE INITIALIZED PRIOR TO CALLING THIS +; ROUTINE. +; +; ADDRESSES ARE TRANSLATED FROM LOGICAL (Z80) TO PHYSICAL (Z280) TO +; SETUP THE DMA COPY PARAMETERS. IF THE SOURCE OR DESTINATION RANGE +; CROSSES OVER THE BANKED/COMMON BOUNDARY AT $8000, THEN SPECIAL STEPS +; MUST BE TAKEN BECAUSE THE BANKED AND COMMON AEAS ARE PROBABLY NOT +; SEQUENTIALLY LOCATED IN PHYSICAL MEMORY. TWO ENTRY POINTS ARE +; PROVIDED. Z280_BNKCPY IS MUCH FASTER, BUT DOES NOT ACCOUNT FOR THE +; COPY RANGES CROSSING OVER THE BANKED/COMMON BOUNDARY (WORKS GREAT +; FOR ANY COPY KNOWN TO STAY WITHIN IT'S OWN AREA). Z280_BNKCPYX +; WILL HANDLE COPIES WHERE THE SOURCE AND/OR DESTINATION RANGES +; CROSS OVER THE BANKED/COMMON MEMORY BOUNDARY. IT DOES THIS BY +; BREAKING UP THE COPY REQUESTS INTO MULTIPLE REQUESTS THAT ALL FIT +; WITHIN A SINGLE BANKED/COMMON MEMORY SEGMENT AND CALLING Z280_BNKCPY +; ITERATIVELY UNTIL THE COPY IS COMPLETE. +; +; THERE IS ESSENTIALLY NO PROTECTION FOR CALLING THESE ROUTINES WITH +; INVALID PARAMETERS. FOR EXAMPLE, A REQUEST TO COPY $2000 BYTES +; STARTING AT $F000 EXCEEDS THE SIZE OF THE Z80 MEMORY SPACES AND +; RESULTS IN UNDEFINED BEHAVIOR. +; +; THE COPY IS ALWAYS DONE FROM START TO END. IF THE SOURCE AND +; DESTINATION RANGES OVERLAP, THEN YOU MUST TAKE THIS INTO ACCOUNT. +; +; THE ROUTINE FUNCTIONS LOGICALLY LIKE THE Z80 LDIR INSTRUCTION. ON +; RETURN THE SOURCE (HL) AND DESTINATION (DE) REGISTERS WILL BE LEFT +; POINTING TO THE NEXT BYTE THAT WOULD BE COPIED IF THE COPY ROUTINE +; CONTINUED. BC WILL BE 0. AF IS UNDEFINED. +; +#IF (MEMMGR == MM_Z280) +; +; ADJUST THE LENGTH OF THE COPY SUCH THAT BOTH THE SOURCE AND +; DESTINATION RANGES DO NOT CROSS OVER THE BANKED/COMMON MEMORY +; BOUNDARY. CALL Z280_BNKCPY TO DO AS MANY ITERATIONS AS NEEDED TO +; COMPLETE THE COPY. +; +; +Z280_BNKCPYX: + LD (Z280_BNKCPY_LEN),BC ; SAVE LENGTH +; + CALL Z280_BNKCPY_XOVER ; ADJUST FOR XOVER AS NEEDED + EX DE,HL ; SWAP SOURCE/DEST + CALL Z280_BNKCPY_XOVER ; ADJUST FOR XOVER AS NEEDED + EX DE,HL ; SWAP BACK +; + ; DO THE WORK, SAVE THE LEN OF THIS ITERATION + PUSH BC ; SAVE ITER LENGTH + CALL Z280_BNKCPY ; DO THE WORK +; + ;;; *DEBUG* SIMULATE CALL TO Z280_BNKCPY + ;;CALL NEWLINE + ;;CALL REGDMP ; *DEBUG* + ;;ADD HL,BC ; INCREMENT SRC ADR BY COUNT + ;;EX DE,HL ; SWAP + ;;ADD HL,BC ; INCREMENT DST ADR BY COUNT + ;;EX DE,HL ; SWAP BACK + ;;LD BC,0 ; COUNT IS NOW ZERO + ;;; END *DEBUG* +; + POP BC ; RECOVER ITER LENGTH +; + ; ACCUNT FOR WORK ACTUALLY PERFORMED + PUSH HL ; SAVE SOURCE ADR + LD HL,(Z280_BNKCPY_LEN) ; GET PENDING LENGTH + OR A ; CLEAR CARRY + SBC HL,BC ; SUBTRACT WHAT WE DID + PUSH HL ; MOVE NEW PENDING LEN + POP BC ; TO BC + POP HL ; RECOVER SOURCE ADR +; + ; SEE IF WE NEED TO ITERATE + LD A,B ; IS LENGTH + OR C ; ... NOW ZERO? + RET Z ; IF SO, ALL DONE + JR Z280_BNKCPYX ; ELSE ITERATE UNTIL DONE +; +Z280_BNKCPY_LEN .DW 0 ; TEMP STORAGE FOR BC +; +Z280_BNKCPY_XOVER: + ; DETECT XOVER IN RANGE AND ADJUST COPY LEN IF SO + ; HL=START, BC=LEN + ; BC IS REDUCED AS NEEDED TO AVOID XOVER + BIT 7,H ; START ABOVE 32K? + RET NZ ; YES, NO XOVER + PUSH HL ; SAVE START ADR + ADD HL,BC ; ADD COPY LEN + DEC HL ; CONVERT TO "LAST" BYTE OF RANGE + BIT 7,H ; ABOVE 32K? + POP HL ; RESTORE HL + RET Z ; IF NOT, NO XOVER +; + ; START IS BELOW 32K, END IS OVER 32K, XOVER IN SOURCE! + ; REDUCE LENGTH TO AVOID IT + ; COMPUTE (32K - START) FOR NEW LEN + PUSH DE ; SAVE DEST (DE) + PUSH HL ; SAVE START (HL) + LD DE,$8000 + EX DE,HL ; DE=START, HL=32K + OR A ; CLEAR CARRY + SBC HL,DE ; HL = NEW LEN + PUSH HL ; MOVE NEW LEN + POP BC ; ... TO BC + POP HL ; RECOVER START + POP DE ; RECOVER DEST + RET ; RETURN +; +Z280_BNKCPY: + ; Z280 MEMORY TO MEMORY DMA + ; USE FLOW THROUGH MODE + ; SINGLE BYTE TRANSFER + ; TRANSACTION DESCRIPTION REGISTER (TDR) + ; %0000 0000 0000 0000 + ; - AUTO INCREMENT MEMORY + ; - FLOWTHROUGH OPERATION + ; - SINGLE TRANSACTION (CAN WE USE CONTINUOUS???) + ; - 1 BYTE XFER SIZE +; + ; SAVE INCOMING REGISTERS + PUSH HL + PUSH DE + PUSH BC +; + PUSH BC ; SAVE COUNT + PUSH HL ; SAVE SOURCE ADDRESS +; + ; SELECT I/O PAGE $FF + LD C,Z280_IOPR ; I/O PAGE REGISTER + LDCTL HL,(C) ; GET CURRENT I/O PAGE + LD (IOPRSAV),HL ; SAVE IT + LD L,$FF ; I/O PAGE $FF + LDCTL (C),HL +; + LD C,Z280_DMA0_DSTL ; START WITH DEST REG LO +; + LD A,(HB_DSTBNK) ; DEST BANK TO ACCUM + CALL Z2DMAADR ; SETUP DEST ADR REGS +; + POP DE ; SRC ADR TO DE + LD A,(HB_SRCBNK) ; DEST BANK TO ACCUM + CALL Z2DMAADR ; SETUP SOURCE ADR REGS +; + POP HL ; COUNT TO HL + OUTW (C),HL + INC C ; BUMP TO TDR +; + LD HL,$8000 ; ENABLE DMA0 TO RUN! + OUTW (C),HL +; + ; WAIT FOR XFER TO COMPLETE +Z2DMALOOP: + INW HL,(C) ; WORD INPUT + BIT 7,H ; CHECK EN BIT OF TDR + JR NZ,Z2DMALOOP ; LOOP WHILE ACTIVE +; + ; RESTORE I/O PAGE + LD C,Z280_IOPR ; I/O PAGE REGISTER + LD HL,(IOPRSAV) ; RESTORE I/O PAGE + LDCTL (C),HL +; + ; SETUP RETURN VALUES + POP BC ; RECOVER ORIGINAL BC + POP DE ; RECOVER ORIGINAL DE + POP HL ; RECOVER ORIGINAL HL + ADD HL,BC ; INCREMENT SRC ADR BY COUNT + EX DE,HL ; SWAP + ADD HL,BC ; INCREMENT DST ADR BY COUNT + EX DE,HL ; SWAP BACK + LD BC,0 ; COUNT IS NOW ZERO +; + RET +; +Z2DMAADR: + ; SET ADDRESS REGISTERS, BANK IN A, ADDRESS IN DE + ; C POINTS TO FIRST DMA ADR PORT TO SET + ; A=R000 BBBB, DE=0AAA AAAA AAAA AAAA + ; RC: DMA HI=0000 RBBB BAAA 1111 LO=1111 AAAA AAAA AAAA + ; ZZ: DMA HI=R000 0BBB BAAA 1111 LO=1111 AAAA AAAA AAAA + BIT 7,D ; HIGH RAM? + JR Z,Z2DMAADR1 ; NO, SKIP + LD A,$8F ; SUBSTITUTE COMMON RAM BANK ID +; +Z2DMAADR1: + ; ADR HI FROM A:DE + LD L,D ; L=?AAA AAAA + LD H,A ; H=R000 BBBB + SLA L ; L=AAAA AAA0 ? + SRL H ; H=0R00 0BBB B + RR L ; L=BAAA AAAA 0 + LD A,$0F ; A=0000 1111 + OR L ; A=BAAA 1111 + LD L,A ; L=BAAA 1111 +; + ; MOVE THE RAM/ROM BIT. + ; RCBUS DMA HI=0000 RBBB BAAA 1111 LO=1111 AAAA AAAA AAAA + ; ZZ80MB DMA HI=R000 0BBB BAAA 1111 LO=1111 AAAA AAAA AAAA + BIT 6,H + JR Z,Z2DMAADR2 + RES 6,H + SET RAMLOC-16,H +; +Z2DMAADR2: + PUSH HL ; SAVE IT FOR NOW + + ; ADR LO FROM DE: + LD L,E ; L=AAAA AAAA + LD A,$F0 ; A=1111 0000 + OR D ; A=1111 AAAA + LD H,A ; HL=1111 AAAA AAAA AAAA +; + ; SET ADR LO REG + OUTW (C),HL + INC C ; BUMP TO ADR HI REG +; + ; SET ADR HI REG + POP HL ; RECOVER THE HI VAL + OUTW (C),HL + INC C ; BUMP TO NEXT REG +; + RET +; +#ENDIF +; +; Z280 SYSCALL VECTOR ENTRY POINT. TAKES STACK PARAMETER AS A BRANCH +; ADDRESS AND CALLS IT. ALLOWS ANY USER MODE CODE TO CALL INTO AN +; ARBITRARY LOCATION OF SYSTEM MODE CODE. ; -HB_TMPSZ .DW 0 -HB_TMPREF .DW 0 +#IF (MEMMGR == MM_Z280) +Z280_SYSCALL: + EX (SP),HL + LD (Z280_SYSCALL_GO+1),HL + POP HL +Z280_SYSCALL_GO: + CALL $FFFF ; PARM SET ABOVE + RETIL ; RETURN FROM INT +#ENDIF ; ;================================================================================================== ; DEVICE DRIVERS ;================================================================================================== ; -#IF (SIMRTCENABLE) -ORG_SIMRTC .EQU $ - #INCLUDE "simrtc.asm" -SIZ_SIMRTC .EQU $ - ORG_SIMRTC - .ECHO "SIMRTC occupies " - .ECHO SIZ_SIMRTC - .ECHO " bytes.\n" -#ENDIF -; #IF (DSRTCENABLE) ORG_DSRTC .EQU $ #INCLUDE "dsrtc.asm" @@ -2933,6 +5808,15 @@ SIZ_DSRTC .EQU $ - ORG_DSRTC .ECHO " bytes.\n" #ENDIF ; +#IF (DS1501RTCENABLE) +ORG_DS1501RTC .EQU $ + #INCLUDE "ds1501rtc.asm" +SIZ_DS1501RTC .EQU $ - ORG_DS1501RTC + .ECHO "DS1501RTC occupies " + .ECHO SIZ_DS1501RTC + .ECHO " bytes.\n" +#ENDIF +; #IF (BQRTCENABLE) ORG_BQRTC .EQU $ #INCLUDE "bqrtc.asm" @@ -2941,7 +5825,49 @@ SIZ_BQRTC .EQU $ - ORG_BQRTC .ECHO SIZ_BQRTC .ECHO " bytes.\n" #ENDIF +#IF (SIMRTCENABLE) +ORG_SIMRTC .EQU $ + #INCLUDE "simrtc.asm" +SIZ_SIMRTC .EQU $ - ORG_SIMRTC + .ECHO "SIMRTC occupies " + .ECHO SIZ_SIMRTC + .ECHO " bytes.\n" +#ENDIF +#IF (DS7RTCENABLE & (DS7RTCMODE=DS7RTCMODE_PCF)) +ORG_PCF8584 .EQU $ + #INCLUDE "pcf8584.asm" +SIZ_PCF8584 .EQU $ - ORG_PCF8584 + .ECHO "PCF8584 occupies " + .ECHO SIZ_PCF8584 + .ECHO " bytes.\n" +#ENDIF + +#IF (DS7RTCENABLE) +ORG_DS7RTC .EQU $ + #INCLUDE "ds7rtc.asm" +SIZ_DS7RTC .EQU $ - ORG_DS7RTC + .ECHO "DS7RTC occupies " + .ECHO SIZ_DS7RTC + .ECHO " bytes.\n" +#ENDIF +; +#IF (INTRTCENABLE) +ORG_INTRTC .EQU $ + #INCLUDE "intrtc.asm" +SIZ_INTRTC .EQU $ - ORG_INTRTC + .ECHO "INTRTC occupies " + .ECHO SIZ_INTRTC + .ECHO " bytes.\n" +#ENDIF ; +#IF (RP5RTCENABLE) +ORG_RP5RTC .EQU $ + #INCLUDE "rp5rtc.asm" +SIZ_RP5RTC .EQU $ - ORG_RP5RTC + .ECHO "RP5RTC occupies " + .ECHO SIZ_RP5RTC + .ECHO " bytes.\n" +#ENDIF #IF (ASCIENABLE) ORG_ASCI .EQU $ #INCLUDE "asci.asm" @@ -2951,6 +5877,15 @@ SIZ_ASCI .EQU $ - ORG_ASCI .ECHO " bytes.\n" #ENDIF ; +#IF (Z2UENABLE) +ORG_Z2U .EQU $ + #INCLUDE "z2u.asm" +SIZ_Z2U .EQU $ - ORG_Z2U + .ECHO "Z2U occupies " + .ECHO SIZ_Z2U + .ECHO " bytes.\n" +#ENDIF +; #IF (UARTENABLE) ORG_UART .EQU $ #INCLUDE "uart.asm" @@ -2960,6 +5895,15 @@ SIZ_UART .EQU $ - ORG_UART .ECHO " bytes.\n" #ENDIF ; +#IF (DUARTENABLE) +ORG_DUART .EQU $ + #INCLUDE "duart.asm" +SIZ_DUART .EQU $ - ORG_DUART + .ECHO "DUART occupies " + .ECHO SIZ_DUART + .ECHO " bytes.\n" +#ENDIF +; #IF (SIOENABLE) ORG_SIO .EQU $ #INCLUDE "sio.asm" @@ -2978,6 +5922,42 @@ SIZ_ACIA .EQU $ - ORG_ACIA .ECHO " bytes.\n" #ENDIF ; +#IF (PIOENABLE) +ORG_PIO .EQU $ + #INCLUDE "pio.asm" +SIZ_PIO .EQU $ - ORG_PIO + .ECHO "PIO occupies " + .ECHO SIZ_PIO + .ECHO " bytes.\n" +#ENDIF +; +#IF (LPTENABLE) +ORG_LPT .EQU $ + #INCLUDE "lpt.asm" +SIZ_LPT .EQU $ - ORG_LPT + .ECHO "LPT occupies " + .ECHO SIZ_LPT + .ECHO " bytes.\n" +#ENDIF +; +#IF (PIO_4P | PIO_ZP | PIO_SBC) +ORG_PIO .EQU $ + #INCLUDE "pio.asm" +SIZ_PIO .EQU $ - ORG_PIO + .ECHO "PIO occupies " + .ECHO SIZ_PIO + .ECHO " bytes.\n" +#ENDIF +; +#IF (UFENABLE) +ORG_UF .EQU $ + #INCLUDE "uf.asm" +SIZ_UF .EQU $ - ORG_UF + .ECHO "UF occupies " + .ECHO SIZ_UF + .ECHO " bytes.\n" +#ENDIF +; #IF (VGAENABLE) ORG_VGA .EQU $ #INCLUDE "vga.asm" @@ -3014,12 +5994,21 @@ SIZ_TMS .EQU $ - ORG_TMS .ECHO " bytes.\n" #ENDIF ; -#IF (NECENABLE) -ORG_NEC .EQU $ - ;#INCLUDE "nec.asm" -SIZ_NEC .EQU $ - ORG_NEC - .ECHO "NEC occupies " - .ECHO SIZ_NEC +#IF (GDCENABLE) +ORG_GDC .EQU $ + #INCLUDE "gdc.asm" +SIZ_GDC .EQU $ - ORG_GDC + .ECHO "GDC occupies " + .ECHO SIZ_GDC + .ECHO " bytes.\n" +#ENDIF +; +#IF (DMAENABLE) +ORG_DMA .EQU $ +#INCLUDE "dma.asm" +SIZ_DMA .EQU $ - ORG_DMA + .ECHO "DMA occupies " + .ECHO SIZ_DMA .ECHO " bytes.\n" #ENDIF ; @@ -3059,12 +6048,22 @@ FONT8X16: .ECHO " 8X16" #ENDIF ; +#IFDEF USEFONTCGA +FONTCGA: + #IF USELZSA2 + #INCLUDE "fontcgac.asm" + #ELSE + #INCLUDE "fontcgau.asm" + #ENDIF + .ECHO " CGA" +#ENDIF +; SIZ_FONTS .EQU $ - ORG_FONTS .ECHO " occupy " .ECHO SIZ_FONTS .ECHO " bytes.\n" ; -#IF (CVDUENABLE | VGAENABLE) +#IF (CVDUENABLE | VGAENABLE) | GDCENABLE | (TMSENABLE & ((TMSMODE == TMSMODE_MSXKBD) | (TMSMODE == TMSMODE_MBC))) ORG_KBD .EQU $ #INCLUDE "kbd.asm" SIZ_KBD .EQU $ - ORG_KBD @@ -3073,7 +6072,7 @@ SIZ_KBD .EQU $ - ORG_KBD .ECHO " bytes.\n" #ENDIF ; -#IF (VDUENABLE | (TMSENABLE & (PLATFORM == PLT_N8))) +#IF (VDUENABLE | (TMSENABLE & (TMSMODE == TMSMODE_N8))) ORG_PPK .EQU $ #INCLUDE "ppk.asm" SIZ_PPK .EQU $ - ORG_PPK @@ -3082,6 +6081,15 @@ SIZ_PPK .EQU $ - ORG_PPK .ECHO " bytes.\n" #ENDIF ; +#IF (MKYENABLE) +ORG_MKY .EQU $ + #INCLUDE "mky.asm" +SIZ_MKY .EQU $ - ORG_MKY + .ECHO "MKY occupies " + .ECHO SIZ_MKY + .ECHO " bytes.\n" +#ENDIF +; #IF (PRPENABLE) ORG_PRP .EQU $ #INCLUDE "prp.asm" @@ -3181,31 +6189,12 @@ SIZ_SPK .EQU $ - ORG_SPK .ECHO SIZ_SPK .ECHO " bytes.\n" #ENDIF -; -#IF (AYENABLE) -ORG_AY .EQU $ - #INCLUDE "ay.asm" -SIZ_AY .EQU $ - ORG_AY - .ECHO "AY occupies " - .ECHO SIZ_AY - .ECHO " bytes.\n" -#ENDIF -; -#IF (PIO_4P | PIO_ZP | PPI_SBC) -ORG_PIO .EQU $ - #INCLUDE "pio.asm" -SIZ_PIO .EQU $ - ORG_PIO - .ECHO "PIO occupies " - .ECHO SIZ_PIO - .ECHO " bytes.\n" -#ENDIF -; -#IF (UFENABLE) -ORG_UF .EQU $ - #INCLUDE "uf.asm" -SIZ_UF .EQU $ - ORG_UF - .ECHO "UF occupies " - .ECHO SIZ_UF +#IF (KIOENABLE) +ORG_KIO .EQU $ + #INCLUDE "kio.asm" +SIZ_KIO .EQU $ - ORG_KIO + .ECHO "KIO occupies " + .ECHO SIZ_KIO .ECHO " bytes.\n" #ENDIF #IF (CTCENABLE) @@ -3216,6 +6205,34 @@ SIZ_CTC .EQU $ - ORG_CTC .ECHO SIZ_CTC .ECHO " bytes.\n" #ENDIF +#IF (SN76489ENABLE) +ORG_SN76489 .EQU $ + #INCLUDE "sn76489.asm" +SIZ_SN76489 .EQU $ - ORG_SN76489 + .ECHO "SN76489 occupies " + .ECHO SIZ_SN76489 + .ECHO " bytes.\n" +#ENDIF +#IF (AY38910ENABLE) +ORG_AY38910 .EQU $ + #INCLUDE "ay38910.asm" +SIZ_AY38910 .EQU $ - ORG_AY38910 + .ECHO "AY38910 occupies " + .ECHO SIZ_AY38910 + .ECHO " bytes.\n" +#ENDIF +#IF (YM2612ENABLE) +ORG_YM2612 .EQU $ + #INCLUDE "ym2612.asm" +SIZ_YM2612 .EQU $ - ORG_YM2612 + .ECHO "YM2612 occupies " + .ECHO SIZ_YM2612 + .ECHO " bytes.\n" +#ENDIF +; + .ECHO "RTCDEF=" + .ECHO RTCDEF + .ECHO "\n" ; #DEFINE USEDELAY #INCLUDE "util.asm" @@ -3233,12 +6250,17 @@ SIZ_CTC .EQU $ - ORG_CTC ; #IF (DSKYENABLE) #DEFINE DSKY_KBD + #IF (DSKYMODE == DSKYMODE_V1) #INCLUDE "dsky.asm" + #ENDIF + #IF (DSKYMODE == DSKYMODE_NG) +#INCLUDE "dskyng.asm" + #ENDIF #ENDIF ; ; INCLUDE LZSA2 decompression engine if required. ; -#IF ((VGAENABLE | CVDUENABLE | TMSENABLE) & USELZSA2) +#IF ((VGAENABLE | CVDUENABLE | TMSENABLE | GDCENABLE) & USELZSA2) #INCLUDE "unlzsa2s.asm" #ENDIF ; @@ -3246,35 +6268,36 @@ SIZ_CTC .EQU $ - ORG_CTC ; HB_CPUSPD: ; -#IF (DSRTCENABLE) +#IF (DSRTCENABLE & ((CPUFAM == CPU_Z80) | (CPUFAM == CPU_Z180))) ; LD A,(DSRTC_STAT) ; GET RTC STATUS OR A ; SET FLAGS RET NZ ; NOT ZERO IS ERROR ; HB_CPUSPD1: -#IF (CPUFAM == CPU_Z180) + #IF (CPUFAM == CPU_Z180) ; USE MEM W/S = 2 AND I/O W/S = 3 FOR TEST IN0 A,(Z180_DCNTL) PUSH AF LD A,$B0 ;LD A,$F0 OUT0 (Z180_DCNTL),A -#ENDIF + #ENDIF ; WAIT FOR AN INITIAL TICK TO ALIGN, THEN WAIT ; FOR SECOND TICK AND TO GET A FULL ONE SECOND LOOP COUNT + CALL DSRTC_START CALL HB_RDSEC ; GET SECONDS LD (HB_CURSEC),A ; AND INIT CURSEC CALL HB_WAITSEC ; WAIT FOR SECONDS TICK LD (HB_CURSEC),A ; SAVE NEW VALUE CALL HB_WAITSEC ; WAIT FOR SECONDS TICK ; -#IF (CPUFAM == CPU_Z180) + #IF (CPUFAM == CPU_Z180) ; RESTORE W/S SETTINGS FROM BEFORE TEST POP AF OUT0 (Z180_DCNTL),A -#ENDIF + #ENDIF ; LD A,H OR L @@ -3291,12 +6314,8 @@ HB_CPUSPD1: SLA L RL H ; - LD (CB_CPUKHZ),HL - LD DE,1000 - CALL DIV16 - LD A,C - LD (CB_CPUMHZ),A -; + ; RETURN CURRENT CPU SPD (KHZ) IN HL + XOR A ; SIGNAL SUCCESS RET ; HB_WAITSEC: @@ -3305,7 +6324,7 @@ HB_WAITSEC: LD DE,0 ; INIT LOOP COUNTER HB_WAITSEC1: ; -#IF (CPUFAM == CPU_Z80) + #IF (CPUFAM == CPU_Z80) ; LOOP TARGET IS 4000 T-STATES, SO CPU FREQ IN KHZ = LOOP COUNT * 4 CALL DLY32 CALL DLY16 @@ -3314,9 +6333,9 @@ HB_WAITSEC1: SBC HL,HL ; 15 TSTATES INC HL ; 6 TSTATES INC HL ; 6 TSTATES -#ENDIF + #ENDIF ; -#IF (CPUFAM == CPU_Z180) + #IF (CPUFAM == CPU_Z180) ; LOOP TARGET IS 4000 T-STATES, SO CPU FREQ IN KHZ = LOOP COUNT * 4 CALL DLY2 ADD IX,BC ; 10 + 4 = 14 TSTATES @@ -3324,7 +6343,7 @@ HB_WAITSEC1: NOP ; 5 TSTATES NOP ; 5 TSTATES NOP ; 5 TSTATES -#ENDIF + #ENDIF ; PUSH DE ; SAVE COUNTER CALL HB_RDSEC ; GET SECONDS @@ -3347,12 +6366,87 @@ HB_RDSEC: LD A,E ; VALUE TO A RET ; -#ELSE + #ELSE ; + OR $FF ; SIGNAL ERROR RET ; NO RTC, ABORT ; #ENDIF ; +; SYSTEM CHECK: DUMP MACHINE STATE AND CONTINUE? +; +SYSCHKA: + ; CHECK DIAG LEVEL TO SEE IF WE SHOULD DISPLAY + PUSH AF ; PRESERVE INCOMING AF VALUE + LD A,(CB_DIAGLVL) ; GET DIAGNOSTIC LEVEL + CP DL_ERROR ; >= ERROR LEVEL + JR C,SYSCHK1 ; IF NOT, GO HOME + POP AF ; RESTORE INCOMING AF VALUE +; + ; DISPLAY SYSCHK MESSAGE + PUSH DE ; PRESERVE DE VALUE + LD DE,STR_SYSCHK ; POINT TO PREFIX STRING + CALL WRITESTR ; PRINT IT + POP DE ; RESTORE DE VALUE + CALL XREGDMP ; DUMP REGISTERS + + ; DISPLAY ERROR CODE. IT IS AT RETURN ADDRESS+1 .. LD A,XX + EX (SP),HL ; GET RETURN ADDRESS + INC HL ; POINT TO THE ERROR CODE + PUSH AF + LD A,(HL) ; DISPLAY + CALL PRTHEXBYTE + POP AF + DEC HL ; RESTORE RETURN ADDRESS + EX (SP),HL +; + JR CONTINUE ; CHECK W/ USER +; +SYSCHK1: + ; RETURN IF MESSAGING BYPASSED BY DIAG LEVEL + POP AF + RET +; +; PANIC: DUMP MACHINE STATE AND HALT +; +PANIC: + PUSH DE + LD DE,STR_PANIC + CALL WRITESTR + POP DE + CALL XREGDMP ; DUMP REGISTERS + JR SYSHALT ; FULL STOP +; +; +; +CONTINUE: + PUSH AF +CONTINUE1: + PUSH DE + LD DE,STR_CONTINUE + CALL WRITESTR + POP DE + CALL CIN + RES 5,A ; FORCE UPPERCASE (IMPERFECTLY) + CALL COUT ; ECHO + CP 'Y' + JR Z,CONTINUE3 + CP 'N' + JR Z,SYSHALT + JR CONTINUE1 +CONTINUE3: + CALL NEWLINE + POP AF + RET +; +; +; +SYSHALT: + LD DE,STR_HALT + CALL WRITESTR + DI + HALT +; ; PRINT VALUE OF HL AS THOUSANDTHS, IE. 0.000 ; PRTD3M: @@ -3405,10 +6499,14 @@ PRTSUM: LD C,BF_SYSGET_DIOCNT ; DISK DRIVES LD HL,PS_DISK CALL PRT_ALLD - +; LD C,BF_SYSGET_VDACNT ; VIDEO DEVICES LD HL,PS_VIDEO CALL PRT_ALLD +; + LD C,BF_SYSGET_SNDCNT ; SOUND DEVICES + LD HL,PS_SOUND + CALL PRT_ALLD RET ; PRT_ALLD: @@ -3448,7 +6546,7 @@ PS_DISK: LD B,BF_DIODEVICE ; FUNC=GET DEVICE INFO, UNIT NUM STILL IN C RST 08 ; DE:=DEVTYP/NUM, H:=DISK ATTRIBUTES PUSH BC ; SAVE ATTRIBUTES - LD HL,PS_DDSTRREF ; POINT TO DISK DEVICE TYPE NAME TABLE + LD HL,PS_DDMD ; POINT TO DISK DEVICE TYPE NAME TABLE CALL PS_PRTDEV ; PRINT DISK DEVICE NMEMONIC PADDED TO FIELD WIDTH POP DE ; RECOVER ATTRIBUTES TO DE PUSH DE ; SAVE ATTRIBUTES AGAIN @@ -3466,25 +6564,14 @@ PS_PRTDT: LD A,E ; ATTRIBUTES TO A BIT 7,A ; FLOPPY BIT SET? LD HL,PS_DTFLOP ; ASSUME FLOPPY - JR NZ,PS_PRTDT1 ; IF FLOPPY, JUMP AHEAD - RRCA ; SHIFT TYPE BITS - RRCA - RRCA - AND $07 ; AND ISOLATE THEM - RLCA ; X2 FOR WORD OFFSET IN STRING TABLE - LD HL,PS_DTSTRREF + 2 ; POINT TO STR REF TABLE (SKIP FLOPPY STRING) - CALL ADDHLA - LD A,(HL) - INC HL - LD H,(HL) - LD L,A -; -PS_PRTDT1: - CALL PS_PRT ; PRINT $ TERM STRING AT (HL), C:=CHARS PRINTED - LD A,18 ; 18 CHAR FIELD - SUB C - CALL PS_PAD ; PAD N SPACES (SPECIFIED IN A) - RET + JP NZ,PS_PRT18 ; IF FLOPPY, JUMP AHEAD + + LD C,E + LD DE,PS_DTHARD + LD A,00111000B + CALL PRTIDXMSK + CALL PS_PAD18 ; PAD TO 18 SPACES + RET ; ; PRINT DISK CAPACITY (UNIT IN C, ATTRIBUTE IN E) ; @@ -3501,6 +6588,8 @@ PS_PRTDC: JR Z,PS_PRTDC1 ; PRINT CAPACITY IN KB CP 5 ; RAM DISK? JR Z,PS_PRTDC1 ; PRINT CAPACITY IN KB + CP 7 ; FLASH DISK? + JR Z,PS_PRTDC1 ; PRINT CAPACITY IN KB ; ; PRINT HARD DISK STORAGE SIZE IN MB LD B,BF_DIOCAP ; HBIOS FUNC: GET CAPACTIY @@ -3509,21 +6598,23 @@ PS_PRTDC: RES 7,D ; CLEAR LBA BIT LD B,11 ; 11 BIT SHIFT TO CONVERT BLOCKS --> MB CALL SRL32 ; RIGHT SHIFT - CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + ;CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + CALL PRTDEC32 ; PRINT DWORD IN DECIMAL PRTS("MB$") ; PRINT SUFFIX CALL PC_COMMA PRTS("LBA$") ; FOR NOW, WE ASSUME HARD DISK DOES LBA RET ; DONE ; PS_PRTDC1: - ; PRINT ROM/ROM DISK CAPACITY IN KB + ; PRINT ROM/RAM DISK CAPACITY IN KB LD B,BF_DIOCAP ; HBIOS FUNC: GET CAPACTIY RST 08 ; DE:HL := BLOCKS JP NZ,PS_PRTNUL ; MEDIA PROBLEM RES 7,D ; CLEAR LBA BIT LD B,1 ; 11 BIT SHIFT TO CONVERT BLOCKS --> MB CALL SRL32 ; RIGHT SHIFT - CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + ;CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + CALL PRTDEC32 ; PRINT DWORD IN DECIMAL PRTS("KB$") ; PRINT SUFFIX CALL PC_COMMA PRTS("LBA$") ; FOR NOW, WE ASSUME HARD DISK DOES LBA @@ -3564,7 +6655,7 @@ PS_SERIAL: LD B,BF_CIODEVICE ; FUNC=GET DEVICE INFO, UNIT NUM STILL IN C RST 08 ; DE:=DEVTYP/NUM, C:=DEVICE ATTRIBUTES PUSH BC ; SAVE ATTRIBUTES - LD HL,PS_SDSTRREF ; POINT TO SERIAL DEVICE TYPE NAME TABLE + LD HL,PS_SDUART ; POINT TO SERIAL DEVICE TYPE NAME TABLE CALL PS_PRTDEV ; PRINT SERIAL DEVICE NMEMONIC PADDED TO FIELD WIDTH POP BC ; RECOVER ATTRIBUTES PUSH BC ; SAVE ATTRIBUTES AGAIN @@ -3581,23 +6672,17 @@ PS_SERIAL: PS_PRTST: LD HL,PS_STPPT BIT 6,C - JR NZ,PS_PRTST1 ; PARALLEL TYPE? + JP NZ,PS_PRT18 ; PARALLEL TYPE? LD HL,PS_STRS232 ; ASSUME RS-232 BIT 7,C ; 0=RS-232, 1=TERMINAL - JR Z,PS_PRTST1 ; HANDLE TERMINAL TYPE + JP Z,PS_PRT18 ; HANDLE TERMINAL TYPE LD HL,PS_STTERM ; TYPE IS TERMINAL -; -PS_PRTST1: - CALL PS_PRT ; PRINT $ TERM STRING AT (HL), C:=CHARS PRINTED - LD A,18 ; 18 CHAR FIELD - SUB C - CALL PS_PAD ; PAD N SPACES (SPECIFIED IN A) - RET + JP PS_PRT18 ; ; PRINT SERIAL CONFIG (UNIT IN E, ATTRIBUTE IN C) ; PS_PRTSC: - BIT 6,C ; PARALLEL TYPE? + BIT 6,C ; PARALLEL TYPE? JR NZ,PSPRTPC0 BIT 7,C ; 0=RS-232, 1=TERMINAL @@ -3714,7 +6799,7 @@ PS_VIDEO: LD B,BF_VDADEV ; FUNC=GET DEVICE INFO, UNIT NUM STILL IN C RST 08 ; DE:=DEVTYP/NUM, H:=DISK ATTRIBUTES PUSH BC ; SAVE ATTRIBUTES - LD HL,PS_VDSTRREF ; POINT TO VIDEO DEVICE TYPE NAME TABLE + LD HL,PS_VDVDU ; POINT TO VIDEO DEVICE TYPE NAME TABLE CALL PS_PRTDEV ; PRINT VIDEO DEVICE NMEMONIC PADDED TO FIELD WIDTH POP DE ; RECOVER ATTRIBUTES PUSH DE ; SAVE ATTRIBUTES AGAIN @@ -3730,11 +6815,7 @@ PS_VIDEO: ; PS_PRTVT: LD HL,PS_VTCRT ; ASSUME CRT - CALL PS_PRT ; PRINT $ TERM STRING AT (HL), C:=CHARS PRINTED - LD A,18 ; 18 CHAR FIELD - SUB C - CALL PS_PAD ; PAD N SPACES (SPECIFIED IN A) - RET + JP PS_PRT18 ; PRINT ; ; PRINT VIDEO CONFIG (UNIT IN C, ATTRIBUTE IN E) ; @@ -3751,40 +6832,90 @@ PS_PRTVC: CALL PRTDECB RET ; +; PRINT SOUND CONFIG +; +PS_SOUND: + PUSH BC + + ; UNIT COLUMN + PRTS("Sound $") + LD A,C ; MOVE UNIT NUM TO A + CALL PRTDECB ; PRINT IT + CP 10 ; CHECK FOR MULTIPLE DIGITS + CALL C,PC_SPACE ; EXTRA SPACE IF NEEDED + PRTS(" $") ; PAD TO NEXT COLUMN + + ; DEVICE COLUMN + + PUSH BC + LD E,C + XOR A + LD DE,PS_SDSND ; POINT TO DEVICE TYPE NAME TABLE + CALL PRTIDXDEA ; PRINT DEVICE NMEMONIC PADDED TO FIELD WIDTH + LD A,C ; MOVE UNIT NUM TO A + CALL PRTDECB ; PRINT IT + CALL PC_COLON + LD A,(PRTIDXCNT) + SUB 12-1 ; SUBTRACT FIELD WIDTH (LESS THE COLON) + NEG ; MAKE IT A POSITIVE NUMBER + CALL PS_PAD ; PAD AS NEEDED + POP BC + + ; DEVICE TYPE +; + LD B,BF_SNDQUERY ; FUNC=GET DEVICE INFO, UNIT NUM STILL IN C + LD E,BF_SNDQ_DEV + RST 08 + PUSH BC + LD C,B + LD A,11110000B ; TYPE IS IN UPPER NIBBLE + LD DE,PS_SDSN76489 + CALL PRTIDXMSK + CALL PS_PAD18 + POP BC +; + ; DEVICE CHARACTERISTICS +; + LD B,BF_SNDQUERY ; FUNC=GET DEVICE INFO, UNIT NUM STILL IN C + LD E,BF_SNDQ_CHCNT + RST 08 + LD A,B + CALL PRTDECB + LD A,'+' + CALL COUT + LD A,C + CALL PRTDECB + PRTS(" CHANNELS$") + CALL NEWLINE +; + POP BC + RET +; ; PRINT DEVICE NMEMONIC, DEVTYP/NUM SPECIFIED IN DE ; PS_PRTDEV: - LD A,D - RRCA ; TYPE IS IN UPPER NIBBLE, MOVE TO LOWER NIBBLE - RRCA - RRCA - RRCA - RLCA ; X2 FOR WORD OFFSET IN STRING TABLE - CALL ADDHLA - LD A,(HL) - INC HL - LD H,(HL) - LD L,A - CALL PS_PRT ; PRINT $ TERM STRING AT (HL), C:=CHARS PRINTED - LD A,E ; NUM + EX DE,HL + LD C,H + LD A,11110000B ; TYPE IS IN UPPER NIBBLE + CALL PRTIDXMSK + LD A,L ; UNIT NUMBER CALL PRTDECB ; PRINT NUM, ASSUME 1 CHAR CALL PC_COLON ; PRINT COLON - LD A,12 - 2 ; 12 CHAR FIELD - 1 POS FOR UNIT NUM AND 1 POS FOR COLON - SUB C + LD A,(PRTIDXCNT) + SUB 12-2+1 ; 12 CHAR FIELD - 1 POS FOR UNIT NUM AND 1 POS FOR COLON + NEG CALL PS_PAD ; PAD N SPACES (SPECIFIED IN A) RET ; -; PRINT DEVICE NMEMONIC, DEVTYP/NUM SPECIFIED IN DE +; PRINT DEVICE MNEMONIC, DEVTYP/NUM SPECIFIED IN DE ; PS_PRTNUL: LD HL,PS_STRNUL ; FALL THRU TO PS_PRT ; +; PRINT STRING AT (HL), $ TERM, RETURN CHARS PRINTED IN C ; -; -PS_PRT: - ; PRINT STRING AT (HL), $ TERM, RETURN CHARS PRINTED IN C - LD C,0 ; INIT CHAR COUNT +PS_PRT: LD C,0 ; INIT CHAR COUNT PS_PRT1: LD A,(HL) ; GET CHAR INC HL ; BUMP INDEX @@ -3794,30 +6925,41 @@ PS_PRT1: INC C ; BUMP COUNTER JR PS_PRT1 ; AND LOOP ; +; PAD 18 CHARACTER FIELD +; +PS_PAD18: + LD A,(PRTIDXCNT) + LD C,A + JR PS_PRT18A +; +; PRINT STRING AT HL IN 18 CHARACTER FIELD +; +PS_PRT18: + CALL PS_PRT ; PRINT $ TERM STRING AT (HL), C:=CHARS PRINTED +PS_PRT18A: + LD A,18 ; 18 CHAR FIELD + SUB C +; CALL PS_PAD ; PAD N SPACES (SPECIFIED IN A) ; +; PAD N SPACES SPECIFIED IN A ; -PS_PAD: - ; PAD N SPACES SPECIFIED IN A - LD B,A +PS_PAD: LD B,A LD A,' ' PS_PAD1: CALL COUT DJNZ PS_PAD1 RET ; -HB_CPU_STR: .TEXT " Z80$" ; HB_STRZ80 - .TEXT " Z80180$" ; HB_STRZ180 - .TEXT " Z8S180-K$" ; HB_STRZS180K - .TEXT " Z8S180-N$" ; HB_STRZS180N +HB_CPU_STR: .TEXT " Z80$" + .TEXT " Z80180$" + .TEXT " Z8S180-K$" + .TEXT " Z8S180-N$" + .TEXT " Z80280$" ; PS_STRNUL .TEXT "--$" ; DISPLAY STRING FOR NUL VALUE ; ; DISK DEVICE STRINGS ; -PS_DDSTRREF: - .DW PS_DDMD, PS_DDFD, PS_DDRF, PS_DDIDE, PS_DDATAPI, PS_DDPPIDE - .DW PS_DDSD, PS_DDPRPSD, PS_DDPPPSD, PS_DDHDSK -; PS_DDMD .TEXT "MD$" PS_DDFD .TEXT "FD$" PS_DDRF .TEXT "RF$" @@ -3831,10 +6973,6 @@ PS_DDHDSK .TEXT "HDSK$" ; ; DISK TYPE STRINGS ; -PS_DTSTRREF: - .DW PS_DTFLOP, PS_DTHARD, PS_DTCF, PS_DTSD - .DW PS_DTUSB, PS_DTROM, PS_DTRAM, PS_DTRF -; PS_DTFLOP .TEXT "Floppy Disk$" PS_DTHARD .TEXT "Hard Disk$" PS_DTCF .TEXT "CompactFlash$" @@ -3843,6 +6981,7 @@ PS_DTUSB .TEXT "USB Drive$" PS_DTROM .TEXT "ROM Disk$" PS_DTRAM .TEXT "RAM Disk$" PS_DTRF .TEXT "RAM Floppy$" +PS_DTFSH .TEXT "Flash Drive$" PS_DTOTHER .TEXT "???$" ; ; FLOPPY ATTRIBUTE STRINGS @@ -3855,17 +6994,13 @@ PS_FLP_FSTR: .TEXT "8\",$" ; PS_FLP8 PS_FLP_SSTR: .TEXT "SS/$" ; PS_FLPSS .TEXT "DS/$" ; PS_FLPDS ; -PS_FLP_DSTR: .TEXT "SD$" ; PS_FLPSD +PS_FLP_DSTR: .TEXT "SD$" ; PS_FLPSD .TEXT "DD$" ; PS_FLPDD .TEXT "HD$" ; PS_FLPHD .TEXT "ED$" ; PS_FLPED ; ; CHARACTER DEVICE STRINGS ; -PS_SDSTRREF: - .DW PS_SDUART, PS_SDASCI, PS_SDTERM - .DW PS_SDPRPCON, PS_SDPPPCON, PS_SDSIO, PS_SDACIA, PS_SDPIO,PS_SDUF -; PS_SDUART .TEXT "UART$" PS_SDASCI .TEXT "ASCI$" PS_SDTERM .TEXT "TERM$" @@ -3873,8 +7008,11 @@ PS_SDPRPCON .TEXT "PRPCON$" PS_SDPPPCON .TEXT "PPPCON$" PS_SDSIO .TEXT "SIO$" PS_SDACIA .TEXT "ACIA$" -PS_SDPIO .TEXT "PORT$" +PS_SDPIO .TEXT "PIO$" PS_SDUF .TEXT "UF$" +PS_SDDUART .TEXT "DUART$" +PS_SDZ2U .TEXT "Z2U$" +PS_SDLPT .TEXT "LPT$" ; ; CHARACTER SUB TYPE STRINGS ; @@ -3893,12 +7031,9 @@ PIO_MODE_STR: .TEXT "Output$" ; ; VIDEO DEVICE STRINGS ; -PS_VDSTRREF: - .DW PS_VDVDU, PS_VDCVDU, PS_VDNEC, PS_VDTMS, PS_VDVGA -; PS_VDVDU .TEXT "VDU$" PS_VDCVDU .TEXT "CVDU$" -PS_VDNEC .TEXT "NEC$" +PS_VDGDC .TEXT "GDC$" PS_VDTMS .TEXT "TMS$" PS_VDVGA .TEXT "VGA$" ; @@ -3906,6 +7041,17 @@ PS_VDVGA .TEXT "VGA$" ; PS_VTCRT .TEXT "CRT$" ; +; SOUND DEVICE STRINGS +; +PS_SDSND .TEXT "SND$" +; +; SOUND TYPE STRINGS +; +PS_SDSN76489 .TEXT "SN76489$" +PS_SDAY38910 .TEXT "AY-3-8910$" +PS_SDBITMODE .TEXT "I/O PORT$" +PS_SDYM2612 .TEXT "YM2612$" +; ; 0 1 2 3 4 5 6 7 ; 01234567890123456789012345678901234567890123456789012345678901234567890123456789 PS_STRHDR .TEXT "Unit Device Type Capacity/Mode\r\n" @@ -4075,15 +7221,16 @@ IDLECOUNT .DB 0 HEAPCURB .DW 0 ; MARK HEAP ADDRESS AFTER INITIALIZATION ; HB_TICKS .FILL 4,0 ; 32 BIT TICK COUNTER -HB_SECTCK .DB TICKSPERSEC ; TICK COUNTER FOR FRACTIONAL SECONDS +HB_SECTCK .DB TICKFREQ ; TICK COUNTER FOR FRACTIONAL SECONDS HB_SECS .FILL 4,0 ; 32 BIT SECONDS COUNTER ; HB_CPUTYPE .DB 0 ; 0=Z80, 1=80180, 2=SL1960, 3=ASCI BRG -; -RTCVAL .DB 0 ; SHADOW VALUE FOR RTC LATCH PORT +HB_CPUOSC .DW CPUOSC ; ACTUAL CPU HARDWARE OSC FREQ IN KHZ ; HB_BATCOND .DB 0 ; BATTERY CONDITION (0=LOW, 1=OK) ; +RTCDEFVAL .DB RTCDEF ; STORAGE FOR RTC DEFAULT VALUE +; #IF (BT_REC_TYPE != BT_REC_NONE) HB_BOOT_REC .DB 0 ; BOOT MODE (0=NORMAL, 1=RECOVERY MODE) #ENDIF @@ -4094,10 +7241,22 @@ STR_SWITCH .DB "*** Activating CRT Console ***$" STR_BADINT .DB "\r\n*** BAD INT ***\r\n$" STR_LOWBAT .DB "\r\n\r\n+++ LOW BATTERY +++$" ; +STR_PANIC .TEXT "\r\n>>> PANIC: $" +STR_SYSCHK .TEXT "\r\n>>> SYSCHK: $" +STR_CONTINUE .TEXT "\r\nContinue (Y/N)? $" +STR_RESTART .TEXT "\r\n\r\n>>> Press hardware reset button to restart system\r\n\r\n$" +; #IF (DSKYENABLE) ; 'H','B','I','O',' ',' ',' ',' ' -MSG_HBVER .DB $BE,$FF,$8A,$FB,$80,$80,$80,$80 ; "HBIO " + #IF (DSKYMODE == DSKYMODE_V1) +MSG_HBVER .DB $3E,$7F,$0A,$7B,$00,$00,$00,$00 ; "HBIO " + #ENDIF + #IF (DSKYMODE == DSKYMODE_NG) +MSG_HBVER .DB $76,$7F,$30,$3F,$00,$00,$00,$00 ; "HBIO " + #ENDIF #ENDIF ; +HB_APPBNK .DB 0 ; START BANK WHEN RUN IN APP MODE +; HB_CURSEC .DB 0 ; CURRENT SECOND (TEMP) ; HB_BCDTMP .FILL 5,0 ; BCD NUMBER STORAGE (TEMP) @@ -4110,9 +7269,21 @@ SLACK .EQU BNKTOP - $ .ECHO "HBIOS space remaining: " .ECHO SLACK .ECHO " bytes.\n" + +#IF (SLACK<0) + .ECHO "*** ERROR: HBIOS too big.\n" + !!! ; FORCE AN ASSEMBLY ERROR +#ENDIF +; +#IF (CCP_SIZ > SLACK) + .ECHO "*** ERROR: Insufficient space for CCP cache.\n" + !!! ; FORCE AN ASSEMBLY ERROR +#ENDIF ; #IFDEF ROMBOOT + #IF (ROMSIZE > 0) .FILL SLACK + #ENDIF #ENDIF ; .END diff --git a/Source/HBIOS/hbios.inc b/Source/HBIOS/hbios.inc index 6c166307..1b858342 100644 --- a/Source/HBIOS/hbios.inc +++ b/Source/HBIOS/hbios.inc @@ -32,6 +32,9 @@ BF_RTCGETBYT .EQU BF_RTC + 2 ; GET NVRAM BYTE BY INDEX BF_RTCSETBYT .EQU BF_RTC + 3 ; SET NVRAM BYTE BY INDEX BF_RTCGETBLK .EQU BF_RTC + 4 ; GET NVRAM DATA BLOCK BF_RTCSETBLK .EQU BF_RTC + 5 ; SET NVRAM DATA BLOCK +BF_RTCGETALM .EQU BF_RTC + 6 ; GET ALARM +BF_RTCSETALM .EQU BF_RTC + 7 ; SET ALARM +BF_RTCDEVICE .EQU BF_RTC + 8 ; RTC DEVICE INFO REPORT ; BF_EMU .EQU $30 ; DEPRECATED ; @@ -51,6 +54,24 @@ BF_VDASCR .EQU BF_VDA + 11 ; SCROLL BF_VDAKST .EQU BF_VDA + 12 ; GET KEYBOARD STATUS BF_VDAKFL .EQU BF_VDA + 13 ; FLUSH KEYBOARD BUFFER BF_VDAKRD .EQU BF_VDA + 14 ; READ KEYBOARD +BF_VDARDC .EQU BF_VDA + 15 ; READ CHARACTER +; +BF_SND .EQU $50 +BF_SNDRESET .EQU BF_SND + 0 ; RESET SOUND SYSTEM +BF_SNDVOL .EQU BF_SND + 1 ; REQUEST SOUND VOL - L CONTAINS VOLUME (255 MAX, 0 SILENT) - SCALED AS REQUIRED BY DRIVER (EG: MAPS TO JUST 4 BIT RESOLUTION FOR SN76489) +BF_SNDPRD .EQU BF_SND + 2 ; REQUEST SOUND PERIOD - HL CONTAINS DRIVER SPECIFIC VALUE +BF_SNDNOTE .EQU BF_SND + 3 ; REQUEST NOTE - L CONTAINS NOTE - EACH VALUE IS QUARTER NOTE +BF_SNDPLAY .EQU BF_SND + 4 ; INITIATE THE REQUESTED SOUND COMMAND +BF_SNDQUERY .EQU BF_SND + 5 ; E IS SUBFUNCTION +BF_SNDDURATION .EQU BF_SND + 6 ; REQUEST DURATION HL MILLISECONDS +BF_SNDDEVICE .EQU BF_SND + 7 ; SOUND DEVICE INFO REQUEST +; +; BF_SNDQUERY SUBCOMMANDS +BF_SNDQ_STATUS .EQU 0 +BF_SNDQ_CHCNT .EQU BF_SNDQ_STATUS + 1 ; RETURN COUNT OF CHANNELS +BF_SNDQ_VOLUME .EQU BF_SNDQ_STATUS + 2 ; 8 BIT NUMBER +BF_SNDQ_PERIOD .EQU BF_SNDQ_STATUS + 3 ; 16 BIT NUMBER +BF_SNDQ_DEV .EQU BF_SNDQ_STATUS + 4 ; RETURN DEVICE TYPE CODE AND IO PORTS - TYPE IN B, PORTS IN DE, HL ; BF_SYS .EQU $F0 BF_SYSRESET .EQU BF_SYS + 0 ; SOFT RESET HBIOS @@ -67,19 +88,32 @@ BF_SYSPEEK .EQU BF_SYS + 10 ; GET A BYTE VALUE FROM ALT BANK BF_SYSPOKE .EQU BF_SYS + 11 ; SET A BYTE VALUE IN ALT BANK BF_SYSINT .EQU BF_SYS + 12 ; MANAGE INTERRUPT VECTORS ; +BF_SYSRES_INT .EQU $00 ; RESET HBIOS INTERNAL +BF_SYSRES_WARM .EQU $01 ; WARM START (RESTART BOOT LOADER) +BF_SYSRES_COLD .EQU $02 ; COLD START +BF_SYSRES_USER .EQU $03 ; USER RESET REQUEST +; BF_SYSGET_CIOCNT .EQU $00 ; GET CHAR UNIT COUNT +BF_SYSGET_CIOFN .EQU $01 ; GET CIO UNIT FN/DATA ADR BF_SYSGET_DIOCNT .EQU $10 ; GET DISK UNIT COUNT +BF_SYSGET_DIOFN .EQU $11 ; GET DIO UNIT FN/DATA ADR +BF_SYSGET_RTCCNT .EQU $20 ; GET RTC UNIT COUNT BF_SYSGET_VDACNT .EQU $40 ; GET VDA UNIT COUNT +BF_SYSGET_VDAFN .EQU $41 ; GET VDA UNIT FN/DATA ADR +BF_SYSGET_SNDCNT .EQU $50 ; GET VDA UNIT COUNT +BF_SYSGET_SNDFN .EQU $51 ; GET SND UNIT FN/DATA ADR BF_SYSGET_TIMER .EQU $D0 ; GET CURRENT TIMER VALUE BF_SYSGET_SECS .EQU $D1 ; GET CURRENT SECONDS VALUE BF_SYSGET_BOOTINFO .EQU $E0 ; GET BOOT INFORMATION BF_SYSGET_CPUINFO .EQU $F0 ; GET CPU INFORMATION BF_SYSGET_MEMINFO .EQU $F1 ; GET MEMORY CAPACTITY INFO BF_SYSGET_BNKINFO .EQU $F2 ; GET BANK ASSIGNMENT INFO +BF_SYSGET_CPUSPD .EQU $F3 ; GET CLOCK SPEED & WAIT STATES ; BF_SYSSET_TIMER .EQU $D0 ; SET TIMER VALUE BF_SYSSET_SECS .EQU $D1 ; SET SECONDS VALUE BF_SYSSET_BOOTINFO .EQU $E0 ; SET BOOT INFORMATION +BF_SYSSET_CPUSPD .EQU $F3 ; SET CLOCK SPEED & WAIT STATES ; BF_SYSINT_INFO .EQU $00 ; GET INTERRUPT SYSTEM INFO BF_SYSINT_GET .EQU $10 ; GET INT VECTOR ADDRESS @@ -87,6 +121,160 @@ BF_SYSINT_SET .EQU $20 ; SET INT VECTOR ADDRESS ; CIO_CONSOLE .EQU $80 ; CIO UNIT NUM FOR CUR CON ; +; PRIMARY HARDWARE PLATFORMS +; +PLT_SBC .EQU 1 ; SBC ECB Z80 SBC +PLT_ZETA .EQU 2 ; ZETA Z80 SBC +PLT_ZETA2 .EQU 3 ; ZETA Z80 V2 SBC +PLT_N8 .EQU 4 ; N8 (HOME COMPUTER) Z180 SBC +PLT_MK4 .EQU 5 ; MARK IV +PLT_UNA .EQU 6 ; UNA BIOS +PLT_RCZ80 .EQU 7 ; RCBUS W/ Z80 +PLT_RCZ180 .EQU 8 ; RCBUS W/ Z180 +PLT_EZZ80 .EQU 9 ; EASY Z80 +PLT_SCZ180 .EQU 10 ; SCZ180 +PLT_DYNO .EQU 11 ; DYNO MICRO-ATX MOTHERBOARD +PLT_RCZ280 .EQU 12 ; RCBUS W/ Z280 +PLT_MBC .EQU 13 ; MULTI BOARD COMPUTER +PLT_RPH .EQU 14 ; RHYOPHYRE GRAPHICS COMPUTER +; +; HBIOS GLOBAL ERROR RETURN VALUES +; +ERR_NONE .EQU 0 ; SUCCESS +; +ERR_UNDEF .EQU -1 ; UNDEFINED ERROR +ERR_NOTIMPL .EQU -2 ; FUNCTION NOT IMPLEMENTED +ERR_NOFUNC .EQU -3 ; INVALID FUNCTION +ERR_NOUNIT .EQU -4 ; INVALID UNIT NUMBER +ERR_NOMEM .EQU -5 ; OUT OF MEMORY +ERR_RANGE .EQU -6 ; PARAMETER OUT OF RANGE +ERR_NOMEDIA .EQU -7 ; MEDIA NOT PRESENT +ERR_NOHW .EQU -8 ; HARDWARE NOT PRESENT +ERR_IO .EQU -9 ; I/O ERROR +ERR_READONLY .EQU -10 ; WRITE REQUEST TO READ-ONLY MEDIA +ERR_TIMEOUT .EQU -11 ; DEVICE TIMEOUT +ERR_BADCFG .EQU -12 ; INVALID CONFIGURATION +ERR_INTERNAL .EQU -13 ; INTERNAL ERROR +; +; HBIOS DIAG OPTIONS +; +DIAG_PROG .EQU 0 ; PROGRESS BAR +DIAG_STEP .EQU 1 ; STEP BAR +DIAG_ASCII .EQU 2 ; 8-BIT ASCII 30H - 39H +DIAG_BINARY .EQU 3 ; BINARY 00H - 09H +DIAG_7SEG .EQU 4 ; 7-SEGMENT +DIAG_FLASH .EQU 5 ; FLASH +DIAG_TRIG .EQU 6 ; TRIGGER +; +DIAG_DISP .EQU DIAG_PROG ; DEFAULT +; +#IF (DIAG_DISP == DIAG_PROG) +DIAG_00 .EQU 00000000B +DIAG_01 .EQU 00000001B +DIAG_02 .EQU 00000011B +DIAG_03 .EQU 00000111B +DIAG_04 .EQU 00001111B +DIAG_05 .EQU 00011111B +DIAG_06 .EQU 00111111B +DIAG_07 .EQU 01111111B +DIAG_08 .EQU 11111111B +DIAG_09 .EQU 11111111B +#ENDIF +; +#IF (DIAG_DISP == DIAG_STEP) +DIAG_00 .EQU 00000000B +DIAG_01 .EQU 00000001B +DIAG_02 .EQU 00000010B +DIAG_03 .EQU 00000100B +DIAG_04 .EQU 00001000B +DIAG_05 .EQU 00010000B +DIAG_06 .EQU 00100000B +DIAG_07 .EQU 01000000B +DIAG_08 .EQU 10000000B +DIAG_09 .EQU 11111111B +#ENDIF +; +#IF (DIAG_DISP == DIAG_ASCII) +DIAG_00 .EQU '0' +DIAG_01 .EQU '1' +DIAG_02 .EQU '2' +DIAG_03 .EQU '3' +DIAG_04 .EQU '4' +DIAG_05 .EQU '5' +DIAG_06 .EQU '6' +DIAG_07 .EQU '7' +DIAG_08 .EQU '8' +DIAG_09 .EQU '9' +#ENDIF +; +#IF (DIAG_DISP == DIAG_BINARY) +DIAG_00 .EQU 0 +DIAG_01 .EQU 1 +DIAG_02 .EQU 2 +DIAG_03 .EQU 3 +DIAG_04 .EQU 4 +DIAG_05 .EQU 5 +DIAG_06 .EQU 6 +DIAG_07 .EQU 7 +DIAG_08 .EQU 8 +DIAG_09 .EQU 9 +#ENDIF +; +#IF (DIAG_DISP == DIAG_7SEG) +; abcdefg +DIAG_00 .EQU 00000000B ; BLANK +DIAG_01 .EQU 01111110B ; 0 +DIAG_02 .EQU 00110000B ; 1 +DIAG_03 .EQU 01101101B ; 2 +DIAG_04 .EQU 01111001B ; 3 +DIAG_05 .EQU 00110011B ; 4 +DIAG_06 .EQU 01011011B ; 5 +DIAG_07 .EQU 00011111B ; 6 +DIAG_08 .EQU 01110000B ; 7 +DIAG_09 .EQU 01111111B ; 8 +DIAG_10 .EQU 01110011B ; 9 +#ENDIF +; +#IF (DIAG_DISP == DIAG_FLASH) +DIAG_00 .EQU 00000000B ; OFF +DIAG_01 .EQU 11111111B ; ON +DIAG_02 .EQU 00000000B ; OFF +DIAG_03 .EQU 11111111B ; ON +DIAG_04 .EQU 00000000B ; OFF +DIAG_05 .EQU 11111111B ; ON +DIAG_06 .EQU 00000000B ; OFF +DIAG_07 .EQU 11111111B ; ON +DIAG_08 .EQU 00000000B ; OFF +DIAG_09 .EQU 11111111B ; ON +#ENDIF +; +#IF (DIAG_DISP == DIAG_TRIG) +DIAG_00 .EQU 11111111B ; ON +DIAG_01 .EQU 11111111B ; ON +DIAG_02 .EQU 11111111B ; ON +DIAG_03 .EQU 11111111B ; ON +DIAG_04 .EQU 11111111B ; ON +DIAG_05 .EQU 11111111B ; ON +DIAG_06 .EQU 11111111B ; ON +DIAG_07 .EQU 11111111B ; ON +DIAG_08 .EQU 11111111B ; ON +DIAG_09 .EQU 11111111B ; ON +#ENDIF +; +; MEDIA ID VALUES +; +MID_NONE .EQU 0 +MID_MDROM .EQU 1 +MID_MDRAM .EQU 2 +MID_RF .EQU 3 +MID_HD .EQU 4 +MID_FD720 .EQU 5 +MID_FD144 .EQU 6 +MID_FD360 .EQU 7 +MID_FD120 .EQU 8 +MID_FD111 .EQU 9 +MID_HDNEW .EQU 10 +; ; CHAR DEVICE IDS ; CIODEV_UART .EQU $00 @@ -98,6 +286,9 @@ CIODEV_SIO .EQU $50 CIODEV_ACIA .EQU $60 CIODEV_PIO .EQU $70 CIODEV_UF .EQU $80 +CIODEV_DUART .EQU $90 +CIODEV_Z2U .EQU $A0 +CIODEV_LPT .EQU $B0 ; ; SUB TYPES OF CHAR DEVICES ; @@ -119,19 +310,30 @@ DIODEV_PRPSD .EQU $70 DIODEV_PPPSD .EQU $80 DIODEV_HDSK .EQU $90 ; +; RTC DEVICE IDS +; +RTCDEV_DS .EQU $00 ; DS1302 +RTCDEV_BQ .EQU $10 ; BQ4845P +RTCDEV_SIMH .EQU $20 ; SIMH +RTCDEV_INT .EQU $30 ; PERIODIC INT TIMER +RTCDEV_DS7 .EQU $40 ; DS1307 (I2C) +RTCDEV_RP5 .EQU $50 ; RP5C01 +; ; VIDEO DEVICE IDS ; 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_GDC .EQU $20 ; GRAPHICS DISPLAY CTLR - UPD7220 VDADEV_TMS .EQU $30 ; N8 ONBOARD VDA SUBSYSTEM - TMS 9918 VDADEV_VGA .EQU $40 ; ECB VGA3 - HITACHI HD6445 -;; -;; EMULATION TYPES - moved to std.asm -;; -;EMUTYP_NONE .EQU 0 ; NONE -;EMUTYP_TTY .EQU 1 ; TTY -;EMUTYP_ANSI .EQU 2 ; ANSI +;VDADEV_V9958 .EQU $50 ; V9958 VDU +; +; SOUND DEVICE IDS +; +SNDDEV_SN76489 .EQU $00 +SNDDEV_AY38910 .EQU $10 +SNDDEV_BITMODE .EQU $20 +SNDDEV_YM2612 .EQU $30 ; ; HBIOS CONTROL BLOCK OFFSETS ; WARNING: THESE OFFSETS WILL CHANGE SIGNIFICANTLY BETWEEN RELEASES @@ -152,8 +354,7 @@ HCB_BOOTBID .EQU $0F ; BANK ID OF ROM PAGE BOOTED (BYTE) HCB_SERDEV .EQU $10 ; PRIMARY SERIAL DEVICE/UNIT (BYTE) HCB_CRTDEV .EQU $11 ; CRT DISPLAY DEVICE/UNIT (BYTE) HCB_CONDEV .EQU $12 ; ACTIVE CONSOLE DEVICE/UNIT (BYTE) -;HCB_CUREMU .EQU $13 ; CURRENT VDA TERMINAL EMULATION (DEPRECATED) -;HCB_CURVDA .EQU $14 ; CURRENT VDA TARGET FOR EMULATION (DEPRECATED) +HCB_DIAGLVL .EQU $13 ; HBIOS DIAGNOSTIC LEVEL (BYTE) ; HCB_HEAP .EQU $20 ; DWORD ADDRESS OF START OF HEAP HCB_HEAPTOP .EQU $22 ; DWORD ADDRESS OF TOP OF HEAP @@ -181,6 +382,7 @@ HB_SRCBNK .EQU HBX_XFCDAT + 4 ; BNKCPY: SOURCE BANK ID HB_DSTADR .EQU HBX_XFCDAT + 5 ; BNKCPY: DESTINATION ADDRESS HB_DSTBNK .EQU HBX_XFCDAT + 7 ; BNKCPY: SOURCE ADDRESS HB_CPYLEN .EQU HBX_XFCDAT + 8 ; BNKCPY: COPY LENGTH +HB_RTCVAL .EQU HBX_XFCDAT + 14 ; RTC LATCH SHADOW VALUE HB_LOCK .EQU HBX_XFCDAT + 15 ; INVOKE: HBIOS MUTEX LOCK ; HBX_XFCFNS .EQU HBX_XFC + $10 ; JUMP TABLE PORTION OF HBIOS PROXY INTERFACE AREA diff --git a/Source/HBIOS/hbios_env.asm b/Source/HBIOS/hbios_env.asm new file mode 100644 index 00000000..92b81ca3 --- /dev/null +++ b/Source/HBIOS/hbios_env.asm @@ -0,0 +1,82 @@ +; +;================================================================================================== +; HBIOS ENVIRONMENT CONFIG VALUE EXPORT TOOL +;================================================================================================== +; +; Do we need a private stack??? +; +#include "std.asm" +; +; Macro to make it simple to print a config value +; +#define prtval(tag,val) \ +#defcont \ call PREFIX +#defcont \ call PRTSTRD +#defcont \ .text tag +#defcont \ call PRTEQ +#defcont \ ld hl,val +#defcont \ call PRTDEC +#defcont \ call EOL +; +; Program starts here +; + .org $100 ; Normal CP/M start address +; +; Print all desired config values... +; + prtval("ROMSIZE$", ROMSIZE) + prtval("CPUFAM$", CPUFAM) +; + ret +; +; Output correct prefix for command/shell +; +PREFIX: +#ifdef CMD + call PRTSTRD + .text "set $" +#endif + ret +; +; Output an equal sign +; +PRTEQ: + ld a,'=' + call COUT + ret +; +; Output end-of-line. Handles differences between +; DOS/Windows and Unix. +; +EOL: +#ifdef CMD + ld a,13 + call COUT +#endif + ld a,10 + call COUT + ret + +; +; Print a single character from register A. +; This routine is required by the utility routines included below. +; +COUT: + push af + push bc + push de + push hl + ld e,a + ld c,2 + call $0005 + pop hl + pop de + pop bc + pop af + ret +; +; Include the utility routines +; +#include "util.asm" +; + .end \ No newline at end of file diff --git a/Source/HBIOS/hdsk.asm b/Source/HBIOS/hdsk.asm index 3c8825bb..172595a6 100644 --- a/Source/HBIOS/hdsk.asm +++ b/Source/HBIOS/hdsk.asm @@ -27,10 +27,12 @@ HDSK_CFGTBL: .DB 0 ; DRIVER DEVICE NUMBER .DB 0 ; DEVICE STATUS .DW 0,0 ; CURRENT LBA +#IF (HDSK_DEVCNT >= 2) ; DEVICE 1 .DB 1 ; DEVICE NUMBER .DB 0 ; DEVICE STATUS .DW 0,0 ; CURRENT LBA +#ENDIF ; #IF ($ - HDSK_CFGTBL) != (HDSK_DEVCNT * HDSK_CFGSIZ) .ECHO "*** INVALID HDSK CONFIG TABLE ***\n" @@ -119,7 +121,8 @@ HDSK_FNTBL: HDSK_VERIFY: HDSK_FORMAT: HDSK_DEFMED: - CALL PANIC ; INVALID SUB-FUNCTION + SYSCHKERR(ERR_NOTIMPL) ; INVALID SUB-FUNCTION + RET ; ; ; @@ -135,15 +138,11 @@ HDSK_RESET: ; ; GET DISK CAPACITY ; RETURN DE:HL=BLOCK COUNT, BC=BLOCK SIZE -; SLICE C/H/S = 65/16/16 OR 16,640 TOTAL SECTORS -; ASSUME 8 SLICES, SO 16640 X 8 = 133,120 TOTAL SECTORS -; -; 2048 TRKS X 16 HDS X 16 SPT = 524288 OR 80000H +; ASSUME 1GB MEDIA SIZE, SO 1GB / 512B +; IS $200000 SECTORS ; HDSK_CAP: - ;LD DE,133120 >> 16 ; BLOCK COUNT MSW - ;LD HL,133120 & $FFFF ; BLOCK COUNT LSW - LD DE,8 ; BLOCK COUNT MSW + LD DE,$20 ; BLOCK COUNT MSW LD HL,0 ; BLOCK COUNT LSW LD BC,512 ; 512 BYTE SECTOR XOR A ; SIGNAL SUCCESS @@ -168,6 +167,8 @@ HDSK_DEVICE: LD D,DIODEV_HDSK ; D := DEVICE TYPE LD E,(IY+HDSK_DEV) ; E := PHYSICAL DEVICE NUMBER LD C,%00000000 ; C := ATTRIBUTES, NON-REMOVABLE HARD DISK + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,HDSK_IO ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -231,7 +232,13 @@ HDSK_RW0: PUSH BC ; SAVE COUNTERS XOR A ; A = 0 LD (HDSK_RC),A ; CLEAR RETURN CODE - +; +#IF (DSKYENABLE) + LD A,HDSK_LBA + CALL LDHLIYA + CALL HB_DSKACT ; SHOW ACTIVITY +#ENDIF +; ; CONVERT LBA HHHH:LLLL (4 BYTES) ; TO HDSK TRACK/SECTOR TTTT:SS (3 BYTES) ; SAVING TO HDSK PARM BLOCK @@ -293,7 +300,10 @@ HDSK_RW6: LD E,C ; SECTOR READ COUNT TO E LD HL,(HDSK_DMA) ; CURRENT DMA TO HL OR A ; SET FLAGS BASED ON RETURN CODE - RET ; AND RETURN, A HAS RETURN CODE + RET Z ; RETURN IF SUCCESS + LD A,ERR_IO ; SIGNAL IO ERROR + OR A ; SET FLAGS + RET ; AND DONE ; ; ; diff --git a/Source/HBIOS/ide.asm b/Source/HBIOS/ide.asm index c018384a..ea823fc4 100644 --- a/Source/HBIOS/ide.asm +++ b/Source/HBIOS/ide.asm @@ -192,7 +192,7 @@ IDE_CFGTBL: #IF (IDECNT >= 1) ; IDE_DEV0M: ; DEVICE 0, MASTER - .DB 0 ; DRIVER DEVICE NUMBER + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB IDE0MODE ; DRIVER DEVICE MODE .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE @@ -206,7 +206,7 @@ IDE_DEV0M: ; DEVICE 0, MASTER .DW IDE_DEV0S ; PARTNER ; IDE_DEV0S: ; DEVICE 0, SLAVE - .DB 0 ; DRIVER DEVICE NUMBER + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB IDE0MODE ; DRIVER DEVICE MODE .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE @@ -223,7 +223,7 @@ IDE_DEV0S: ; DEVICE 0, SLAVE #IF (IDECNT >= 2) ; IDE_DEV1M: ; DEVICE 1, MASTER - .DB 0 ; DRIVER DEVICE NUMBER + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB IDE1MODE ; DRIVER DEVICE MODE .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE @@ -237,7 +237,7 @@ IDE_DEV1M: ; DEVICE 1, MASTER .DW IDE_DEV1S ; PARTNER ; IDE_DEV1S: ; DEVICE 1, SLAVE - .DB 0 ; DRIVER DEVICE NUMBER + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB IDE1MODE ; DRIVER DEVICE MODE .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE @@ -254,7 +254,7 @@ IDE_DEV1S: ; DEVICE 1, SLAVE #IF (IDECNT >= 3) ; IDE_DEV2M: ; DEVICE 2, MASTER - .DB 0 ; DRIVER DEVICE NUMBER + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB IDE2MODE ; DRIVER DEVICE MODE .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE @@ -268,7 +268,7 @@ IDE_DEV2M: ; DEVICE 2, MASTER .DW IDE_DEV2S ; PARTNER ; IDE_DEV2S: ; DEVICE 2, SLAVE - .DB 0 ; DRIVER DEVICE NUMBER + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB IDE2MODE ; DRIVER DEVICE MODE .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE @@ -415,7 +415,8 @@ IDE_INIT5: PRTS(" SIZE=$") ; PRINT FIELD LABEL LD B,11 ; 11 BIT SHIFT TO CONVERT BLOCKS --> MB CALL SRL32 ; RIGHT SHIFT - CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + ;CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + CALL PRTDEC32 ; PRINT DWORD IN DECIMAL PRTS("MB$") ; PRINT SUFFIX ; RET @@ -461,7 +462,8 @@ IDE_FNTBL: IDE_VERIFY: IDE_FORMAT: IDE_DEFMED: - CALL PANIC ; NOT IMPLEMENTED + SYSCHKERR(ERR_NOTIMPL) ; NOT IMPLEMENTED + RET ; ; ; @@ -520,7 +522,10 @@ IDE_IO3: LD E,C ; SECTOR READ COUNT TO E LD HL,(IDE_DSKBUF) ; CURRENT DMA TO HL OR A ; SET FLAGS BASED ON RETURN CODE - RET ; AND RETURN, A HAS RETURN CODE + RET Z ; RETURN IF SUCCESS + LD A,ERR_IO ; SIGNAL IO ERROR + OR A ; SET FLAGS + RET ; AND DONE ; ; ; @@ -540,6 +545,8 @@ IDE_DEVICE: JR Z,IDE_DEVICE1 ; IF Z, WE ARE DONE LD C,%01001000 ; OTHERWISE REMOVABLE COMPACT FLASH IDE_DEVICE1: + LD H,(IY+IDE_MODE) ; H := MODE + LD L,(IY+IDE_IOBASE) ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -574,6 +581,8 @@ IDE_MEDIA2: LD E,MID_HD ; ASSUME WE ARE OK RET Z ; RETURN IF GOOD INIT LD E,MID_NONE ; SIGNAL NO MEDIA + LD A,ERR_NOMEDIA ; NO MEDIA ERROR + OR A ; SET FLAGS RET ; AND RETURN ; ; @@ -717,6 +726,12 @@ IDE_WRSEC: ; ; IDE_SETADDR: +; +#IF (DSKYENABLE) + LD A,IDE_LBA + CALL LDHLIYA + CALL HB_DSKACT ; SHOW ACTIVITY +#ENDIF ; SEND 3 LOWEST BYTES OF LBA IN REVERSE ORDER ; IDE_IO_LBA3 HAS ALREADY BEEN SET ; HSTLBA2-0 --> IDE_IO_LBA2-0 @@ -751,10 +766,10 @@ IDE_SETADDR: #ENDIF CALL IDE_OUT .DB IDE_REG_COUNT -; -#IF (DSKYENABLE) - CALL IDE_DSKY -#ENDIF +;;; +;;#IF (DSKYENABLE) +;; CALL IDE_DSKY +;;#ENDIF ; RET ; @@ -922,38 +937,17 @@ IDE_RESET: PRTS(" RESET$") #ENDIF ; -;#IF (IDEMODE == IDEMODE_MK4) -; - LD A,(IY+IDE_MODE) ; GET MODE - CP IDEMODE_MK4 ; MK4? - JR NZ,IDE_RESET1 ; IF NOT, BYPASS -; - ; USE HARDWARE RESET LINE -#IF (IDETRACE >= 3) - PRTS(" HARD$") -#ENDIF - LD A,$80 ; HIGH BIT OF XAR IS IDE RESET - ;OUT (IDE_IO_XAR),A - CALL IDE_OUT - .DB IDE_REG_XAR - LD DE,2 ; DELAY 32US (SPEC IS >= 25US) - CALL VDELAY - XOR A ; CLEAR RESET BIT - ;OUT (IDE_IO_XAR),A - CALL IDE_OUT - .DB IDE_REG_XAR -; -IDE_RESET1: -; -;#ENDIF -; ;#IF (IDEMODE == IDEMODE_RC) ; - LD A,(IY+IDE_MODE) ; GET MODE - CP IDEMODE_RC ; RC2014? - JR NZ,IDE_RESET2 ; IF NOT, BYPASS + ; OLDER CF CARDS DO NOT SEEM TO SET THE + ; REGISTERS ON RESET, SO HERE WE FAKE THINGS BY + ; SETTING THEM AS A RESET WOULD. SO WE ALWAYS + ; DO THE FAKE. + ;LD A,(IY+IDE_MODE) ; GET MODE + ;CP IDEMODE_RC ; RCBUS? + ;JR NZ,IDE_RESET2 ; IF NOT, BYPASS ; - ; RC2014 CANNOT ADDRESS THE DEVICE CONTROL PORT AND + ; RCBUS CANNOT ADDRESS THE DEVICE CONTROL PORT AND ; HAS NO WAY TO PERFORM A HARD RESET FROM SOFTWARE, ; SO FAKE IT BY SETTING THE REGISTERS TO THE SAME ; VALUES THAT A RESET WOULD CAUSE. @@ -979,12 +973,39 @@ IDE_RESET2: ; ;#ENDIF ; +;#IF (IDEMODE == IDEMODE_MK4) +; + LD A,(IY+IDE_MODE) ; GET MODE + CP IDEMODE_MK4 ; MK4? + JR NZ,IDE_RESET1 ; IF NOT, BYPASS +; + ; USE HARDWARE RESET LINE +#IF (IDETRACE >= 3) + PRTS(" HARD$") +#ENDIF + LD A,$80 ; HIGH BIT OF XAR IS IDE RESET + ;OUT (IDE_IO_XAR),A + CALL IDE_OUT + .DB IDE_REG_XAR + LD DE,20 ; DELAY 32US (SPEC IS >= 25US) + CALL VDELAY + XOR A ; CLEAR RESET BIT + ;OUT (IDE_IO_XAR),A + CALL IDE_OUT + .DB IDE_REG_XAR + LD DE,20 + CALL VDELAY +; +IDE_RESET1: +; +;#ENDIF +; ;#IF ((IDEMODE != IDEMODE_MK4) & (IDEMODE != IDEMODE_RC)) ; LD A,(IY+IDE_MODE) ; GET MODE CP IDEMODE_MK4 ; MK4? JR Z,IDE_RESET3 ; IF SO, BYPASS - CP IDEMODE_RC ; RC2014? + CP IDEMODE_RC ; RCBUS? JR Z,IDE_RESET3 ; IF SO, BYPASS ; ; INITIATE SOFT RESET @@ -1006,7 +1027,7 @@ IDE_RESET3: ;#IF (IDEMODE != IDEMODE_RC) ; LD A,(IY+IDE_MODE) ; GET MODE - CP IDEMODE_RC ; RC2014? + CP IDEMODE_RC ; RCBUS? JR Z,IDE_RESET4 ; IF SO, BYPASS ; ; CONFIGURE OPERATION AND END SOFT RESET @@ -1224,19 +1245,50 @@ IDE_INITDEV00: CALL DUMP_BUFFER ; DUMP IT IF DEBUGGING #ENDIF ; - XOR A LD (IY+IDE_MED),0 ; CLEAR FLAGS - - ; DETERMINE IF CF DEVICE - LD HL,HB_WRKBUF ; FIRST WORD OF IDENTIFY DATA HAS CF FLAG - LD A,$8A ; FIRST BYTE OF MARKER IS $8A - CP (HL) ; COMPARE - JR NZ,IDE_INITDEV1 ; IF NO MATCH, NOT CF - INC HL - LD A,$84 ; SECOND BYTE OF MARKER IS $84 - CP (HL) ; COMPARE - JR NZ,IDE_INITDEV1 ; IF NOT MATCH, NOT CF - SET 0,(IY+IDE_MED) ; SET FLAGS BIT FOR CF MEDIA +; + ; DETERMINE IF CF DEVICE BY TESTING FOR CF CARD SIGNATURES + ; IN THEORY, THERE ARE SOME OTHER POSSIBLE VARIATIONS, BUT + ; THEY ARE NOT RECOMMENDED BY THE CF CARD SPEC AND MIGHT + ; OVERLAP WITH "REAL" HARD DISK SIGNATURES. I HAVE NEVER + ; SEEN A CF CARD THAT DID NOT USE ONE OF THE BELOW. + ; CREDIT TO LASZLO SZOLNOKI +; +#IF (IDETRACE >= 3) + CALL IDE_PRTPREFIX + PRTS(" SIG=0x$") + LD BC,(HB_WRKBUF) + CALL PRTHEXWORD +#ENDIF +; +; SEE PAGE 114 OF CF+ & CF SPECIFICATION REV. 3.0 FOR CF CARD +; SIGNATURE VALUES. ALL OF THE BELOW ARE DOCUMENTED THERE EXCEPT +; $045A WHICH IS A VALUE DISCOVERED ON A CF<->SD CARD ADAPTER. +; +; SIGNATURE $045A IS NOT LISTED IN THE CF SPEC. IT WAS ADDED BECAUSE +; IT WAS SEEN IN THE WILD ON A CF-SD ADAPTER. HOWEVER IT HAS NOW +; ALSO BEEN SEEN ON A SPINNING HARD DISK. SINCE IT IS AMBIGUOUS, I +; WILL CONSIDER IT TO BE A HARD DISK. +; + LD BC,$848A ; STANDARD CF CARD SIGNATURE %1000 1111 1000 1010 + CALL IDE_INITDEV000 ; TEST & SET + LD BC,$044A ; ALT SIG FOR CF NON-REMOVABLE %0000 0100 0100 1010 + CALL IDE_INITDEV000 ; TEST & SET + ;LD BC,$045A ; ?ALT SIG FOR CF NON-REMOVABLE %0000 0100 0101 1010 + ;CALL IDE_INITDEV000 ; TEST & SET + LD BC,$0040 ; ALT SIG FOR CF NON-REMOVABLE %0000 0000 0100 0000 + CALL IDE_INITDEV000 ; TEST & SET + JR IDE_INITDEV1 ; CONTINUE INIT +; +IDE_INITDEV000: + ; CHECK IF FIRST WORD OF IDENTIFY DATA MATCHES VALUE IN BC + ; AND SET CF FLAG IF SO + LD HL,(HB_WRKBUF) ; FIRST WORD OF IDENTIFY DATA + OR A ; CLEAR CARRY + SBC HL,BC ; COMPARE + RET NZ ; ABORT IF NOT EQUAL + SET 0,(IY+IDE_MED) ; ELSE SET FLAGS BIT FOR CF MEDIA + RET ; AND RETURN ; IDE_INITDEV1: ; DETERMINE IF LBA CAPABLE @@ -1437,6 +1489,7 @@ IDE_PRTSTAT: PUSH AF PUSH DE PUSH HL + LD A,(IY+IDE_STAT) OR A LD DE,IDE_STR_STOK JR Z,IDE_PRTSTAT1 @@ -1508,35 +1561,37 @@ IDE_PRTPREFIX: CALL NEWLINE PRTS("IDE$") LD A,(IY+IDE_DEV) ; GET CURRENT DEVICE NUM - ADD A,'0' - CALL COUT + CP $FE ; NOT YET ASSIGNED? + JR Z,IDE_PRTPREFIX1 ; SKIP DEV NUM IF SO + CALL PRTDECB +IDE_PRTPREFIX1: CALL PC_COLON POP AF RET -; -; -; -#IF (DSKYENABLE) -IDE_DSKY: - LD HL,DSKY_HEXBUF ; POINT TO DSKY BUFFER - CALL IDE_IN - .DB IDE_REG_DRVHD - LD (HL),A ; SAVE IN BUFFER - INC HL ; INCREMENT BUFFER POINTER - CALL IDE_IN - .DB IDE_REG_CYLHI - LD (HL),A ; SAVE IN BUFFER - INC HL ; INCREMENT BUFFER POINTER - CALL IDE_IN - .DB IDE_REG_CYLLO - LD (HL),A ; SAVE IN BUFFER - INC HL ; INCREMENT BUFFER POINTER - CALL IDE_IN - .DB IDE_REG_SECT - LD (HL),A ; SAVE IN BUFFER - CALL DSKY_HEXOUT ; SEND IT TO DSKY - RET -#ENDIF +;;; +;;; +;;; +;;#IF (DSKYENABLE) +;;IDE_DSKY: +;; LD HL,DSKY_HEXBUF ; POINT TO DSKY BUFFER +;; CALL IDE_IN +;; .DB IDE_REG_DRVHD +;; LD (HL),A ; SAVE IN BUFFER +;; INC HL ; INCREMENT BUFFER POINTER +;; CALL IDE_IN +;; .DB IDE_REG_CYLHI +;; LD (HL),A ; SAVE IN BUFFER +;; INC HL ; INCREMENT BUFFER POINTER +;; CALL IDE_IN +;; .DB IDE_REG_CYLLO +;; LD (HL),A ; SAVE IN BUFFER +;; INC HL ; INCREMENT BUFFER POINTER +;; CALL IDE_IN +;; .DB IDE_REG_SECT +;; LD (HL),A ; SAVE IN BUFFER +;; CALL DSKY_HEXOUT ; SEND IT TO DSKY +;; RET +;;#ENDIF ; ;============================================================================= ; STRING DATA diff --git a/Source/HBIOS/imgpad.asm b/Source/HBIOS/imgpad.asm deleted file mode 100644 index 8ca47e5d..00000000 --- a/Source/HBIOS/imgpad.asm +++ /dev/null @@ -1,12 +0,0 @@ -#INCLUDE "std.asm" -; -SLACK .EQU ($8000-LDR_SIZ-MON_SIZ-SYS_SIZ-SYS_SIZ-EGG_SIZ) - .FILL SLACK,00H -; -MON_STACK .EQU $ -; - .ECHO "Padspace space created: " - .ECHO SLACK - .ECHO " bytes.\n" - - .END diff --git a/Source/HBIOS/imgpad0.asm b/Source/HBIOS/imgpad0.asm deleted file mode 100644 index 2aa54841..00000000 --- a/Source/HBIOS/imgpad0.asm +++ /dev/null @@ -1,12 +0,0 @@ -#INCLUDE "std.asm" -; -SLACK .EQU ($8000-BAS_SIZ-TBC_SIZ-FTH_SIZ-GAM_SIZ-USR_SIZ) - .FILL SLACK,00H -; -MON_STACK .EQU $ -; - .ECHO "Padspace space created: " - .ECHO SLACK - .ECHO " bytes.\n" - - .END \ No newline at end of file diff --git a/Source/HBIOS/imgpad2.asm b/Source/HBIOS/imgpad2.asm new file mode 100644 index 00000000..43099f3d --- /dev/null +++ b/Source/HBIOS/imgpad2.asm @@ -0,0 +1,10 @@ +#INCLUDE "std.asm" +; +SLACK .EQU $8000 + .FILL SLACK,00H +; + .ECHO "Padspace space created: " + .ECHO SLACK + .ECHO " bytes.\n" + + .END \ No newline at end of file diff --git a/Source/HBIOS/intrtc.asm b/Source/HBIOS/intrtc.asm new file mode 100644 index 00000000..cbb2184f --- /dev/null +++ b/Source/HBIOS/intrtc.asm @@ -0,0 +1,257 @@ +; +;================================================================================================== +; SYSTEM TIMER BASED CLOCK DRIVER +;================================================================================================== +; +INTRTC_BUFSIZ .EQU 6 ; SIX BYTE BUFFER (YYMMDDHHMMSS) +; +; RTC DEVICE INITIALIZATION ENTRY +; +INTRTC_INIT: + LD A,(RTC_DISPACT) ; RTC DISPATCHER ALREADY SET? + OR A ; SET FLAGS + RET NZ ; IF ALREADY ACTIVE, ABORT +; + CALL NEWLINE ; FORMATTING + PRTS("INTRTC: $") +; + ; HOOK THE HBIOS SECONDS VECTOR + LD HL,(VEC_SECOND+1) ; GET CUR SECONDS VECTOR + LD (INTRTC_VEC),HL ; SAVE IT INTERNALLY + LD HL,INTRTC_INT ; OUR SECONDS INT ENTRY + LD (VEC_SECOND+1),HL ; REPLACE IT +; + ; DISPLAY CURRENT TIME + CALL INTRTC_GETTIM0 + LD HL,INTRTC_BCDBUF ; POINT TO BCD BUF + CALL PRTDT +; + LD BC,INTRTC_DISPATCH + CALL RTC_SETDISP +; + XOR A ; SIGNAL SUCCESS + RET +; +; RTC DEVICE FUNCTION DISPATCH ENTRY +; A: RESULT (OUT), 0=OK, Z=OK, NZ=ERR +; B: FUNCTION (IN) +; +INTRTC_DISPATCH: + LD A,B ; GET REQUESTED FUNCTION + AND $0F ; ISOLATE SUB-FUNCTION + JP Z,INTRTC_GETTIM ; GET TIME + DEC A + JP Z,INTRTC_SETTIM ; SET TIME + DEC A + JP Z,INTRTC_GETBYT ; GET NVRAM BYTE VALUE + DEC A + JP Z,INTRTC_SETBYT ; SET NVRAM BYTE VALUE + DEC A + JP Z,INTRTC_GETBLK ; GET NVRAM DATA BLOCK VALUES + DEC A + JP Z,INTRTC_SETBLK ; SET NVRAM DATA BLOCK VALUES + DEC A + JP Z,INTRTC_GETALM ; GET ALARM + DEC A + JP Z,INTRTC_SETALM ; SET ALARM + DEC A + JP Z,INTRTC_DEVICE ; REPORT RTC DEVICE INFO + SYSCHKERR(ERR_NOFUNC) + RET +; +; NVRAM FUNCTIONS ARE NOT AVAILABLE IN SIMULATOR +; +INTRTC_GETBYT: +INTRTC_SETBYT: +INTRTC_GETBLK: +INTRTC_SETBLK: +INTRTC_GETALM: +INTRTC_SETALM: + SYSCHKERR(ERR_NOTIMPL) + RET +; +; RTC GET TIME +; A: RESULT (OUT), 0=OK, Z=OK, NZ=ERR +; HL: DATE/TIME BUFFER (OUT) +; BUFFER FORMAT IS BCD: YYMMDDHHMMSS +; 24 HOUR TIME FORMAT IS ASSUMED +; +INTRTC_GETTIM: + ; GET THE TIME INTO TEMP BUF + PUSH HL ; SAVE PTR TO CALLERS BUFFER + CALL INTRTC_GETTIM0 ; GET TIME TO WORK BUFFER +; + ; NOW COPY TO REAL DESTINATION (INTERBANK SAFE) + LD A,BID_BIOS ; COPY FROM BIOS BANK + LD (HB_SRCBNK),A ; SET IT + LD A,(HB_INVBNK) ; COPY TO CURRENT USER BANK + LD (HB_DSTBNK),A ; SET IT + LD HL,INTRTC_BCDBUF ; SOURCE ADR + POP DE ; DEST ADR + LD BC,INTRTC_BUFSIZ ; LENGTH + CALL HB_BNKCPY ; COPY THE CLOCK DATA +; + LD DE,60 ; DELAY 60 * 16US = ~1MS + CALL VDELAY ; SLOW DOWN SIMH FOR CLOCK TICKING TEST + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; +INTRTC_GETTIM0: + LD HL,INTRTC_BINBUF ; FROM BINARY BUFFER + LD DE,INTRTC_BCDBUF ; TO BCD BUFFER + HB_DI + CALL INTRTC_BIN2BCD ; COPY AND CONVERT + HB_EI + RET +; +; RTC SET TIME +; A: RESULT (OUT), 0=OK, Z=OK, NZ=ERR +; HL: DATE/TIME BUFFER (IN) +; BUFFER FORMAT IS BCD: YYMMDDHHMMSSWW +; 24 HOUR TIME FORMAT IS ASSUMED +; +INTRTC_SETTIM: + ; COPY TO BCD BUF + LD A,(HB_INVBNK) ; COPY FROM CURRENT USER BANK + LD (HB_SRCBNK),A ; SET IT + LD A,BID_BIOS ; COPY TO BIOS BANK + LD (HB_DSTBNK),A ; SET IT + LD DE,INTRTC_BCDBUF ; DEST ADR + LD BC,INTRTC_BUFSIZ ; LENGTH + CALL HB_BNKCPY ; COPY THE CLOCK DATA +; + LD HL,INTRTC_BCDBUF ; FROM BCD BUF + LD DE,INTRTC_BINBUF ; TO BIN BUF + HB_DI + CALL INTRTC_BCD2BIN ; COPY AND CONVERT + HB_EI +; + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; +; REPORT RTC DEVICE INFO +; +INTRTC_DEVICE: + LD D,RTCDEV_INT ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL DEVICE NUMBER + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,0 ; L := 0, NO I/O ADDRESS + XOR A ; SIGNAL SUCCESS + RET +; +; HANDLER FOR TIMER SECONDS INTERRUPT +; +INTRTC_INT: + LD HL,INTRTC_BINBUF + INTRTC_BUFSIZ - 1 + INC (HL) ; INC SECONDS + LD A,59 ; MAX VALUE + CP (HL) ; OVERFLOW? + JR NC,INTRTC_INTX ; NOPE, DONE + LD (HL),0 ; BACK TO ZERO + + DEC HL ; POINT TO MINUTES + INC (HL) ; INCREMENT MINUTE + CP (HL) ; OVERFLOW? + JR NC,INTRTC_INTX ; NOPE, DONE + LD (HL),0 ; BACK TO ZERO + + DEC HL ; POINT TO HOURS + INC (HL) ; INCREMENT HOURS + LD A,23 ; MAX VALUE + CP (HL) ; OVERFLOW? + JR NC,INTRTC_INTX ; NOPE, DONE + LD (HL),0 ; BACK TO ZERO + + DEC HL ; POINT TO DATE + LD A,(INTRTC_MO) ; GET CURRENT MONTH + DEC A ; ZERO OFFSET + LD DE,INTRTC_MONTBL ; POINT TO DAYS IN MON TBL + ADD A,E ; ADD OFFSET + LD E,A ; BACK TO E + JR NC,INTRTC_INT1 ; NO CARRY, SKIP + INC D ; HANDLE CARRY +INTRTC_INT1: + LD A,(DE) ; A := DAYS IN MONTH + LD C,A ; COPY TO C FOR LATER + LD A,(INTRTC_MO) ; GET CURRENT MONTH + CP 2 ; FEBRUARY? + JR NZ,INTRTC_INT2 ; IF NOT, NOT LEAY, SKIP + LD A,(INTRTC_YR) ; GET CURRENT YEAR + AND $03 ; CHECK FOR LEAP + JR NZ,INTRTC_INT2 ; IF NOT LEAP, SKIP AHEAD + INC C ; BUMP DAYS IN FEB FOR LEAP +INTRTC_INT2: + INC (HL) ; INCREMENT DATE + LD A,C ; A := TRUE DAYS IN MONTH + 1 + CP (HL) ; OVERFLOW? + JR NZ,INTRTC_INTX ; NOPE, DONE + LD (HL),1 ; BACK TO DAY ONE + + DEC HL ; POINT TO MONTH + INC (HL) ; INCREMENT MONTH + LD A,13 ; PAST MAX? + CP (HL) ; OVERFLOW? + JR NZ,INTRTC_INTX ; NOPE, DONE + LD (HL),1 ; BACK TO MONTH ONE + + DEC HL ; POINT TO YEAR + INC (HL) ; INCREMENT YEAR + LD A,100 ; PAST MAX? + CP (HL) ; OVERFLOW? + JR NZ,INTRTC_INTX ; NOPE, DONE + LD (HL),0 ; BACK TO YEAR ZERO +INTRTC_INTX: + JP PANIC +INTRTC_VEC .EQU $-2 +; +; CONVERT FROM BINARY BUF (HL) TO BCD BUF (DE) +; +INTRTC_BIN2BCD: + LD B,INTRTC_BUFSIZ +INTRTC_BIN2BCD1: + LD A,(HL) + CALL BYTE2BCD + LD (DE),A + INC HL + INC DE + DJNZ INTRTC_BIN2BCD1 + RET +; +; CONVERT FROM BCD BUF (HL) TO BINARY BUF (DE) +; +INTRTC_BCD2BIN + LD B,INTRTC_BUFSIZ +INTRTC_BCD2BIN1: + LD A,(HL) + CALL BCD2BYTE + LD (DE),A + INC HL + INC DE + DJNZ INTRTC_BCD2BIN1 + RET +; +; WORKING VARIABLES +; +INTRTC_BINBUF: ; ALL IN BINARY +INTRTC_YR .DB 20 +INTRTC_MO .DB 01 +INTRTC_DT .DB 01 +INTRTC_HH .DB 00 +INTRTC_MM .DB 00 +INTRTC_SS .DB 00 +; +INTRTC_BCDBUF .FILL INTRTC_BUFSIZ +; +INTRTC_MONTBL: ; DAYS IN MONTH + 1 + .DB 32 ; JANUARY + .DB 29 ; FEBRUARY (NON-LEAP) + .DB 32 ; MARCH + .DB 31 ; APRIL + .DB 32 ; MAY + .DB 31 ; JUNE + .DB 32 ; JULY + .DB 32 ; AUGUST + .DB 31 ; SEPTEMBER + .DB 32 ; OCTOBER + .DB 31 ; NOVEMBER + .DB 32 ; DECEMBER diff --git a/Source/HBIOS/kbd.asm b/Source/HBIOS/kbd.asm index 2d39197c..4ae36c51 100644 --- a/Source/HBIOS/kbd.asm +++ b/Source/HBIOS/kbd.asm @@ -73,6 +73,13 @@ KBD_INIT: LD A,$AA ; CONTROLLER SELF TEST CALL KBD_PUTCMD ; SEND IT CALL KBD_GETDATA ; CONTROLLER SHOULD RESPOND WITH $55 (ACK) + + CP $55 ; IS IT THERE? + JR Z,KBD_INIT1 ; IF SO, CONTINUE + PRTS(" NOT PRESENT$") ; DIAGNOSE PROBLEM + RET ; BAIL OUT + +KBD_INIT1: LD A,$60 ; SET COMMAND REGISTER CALL KBD_PUTCMD ; SEND IT ; LD A,$60 ; XLAT ENABLED, MOUSE DISABLED, NO INTS diff --git a/Source/HBIOS/kio.asm b/Source/HBIOS/kio.asm new file mode 100644 index 00000000..8c7867c7 --- /dev/null +++ b/Source/HBIOS/kio.asm @@ -0,0 +1,92 @@ +;___KIO________________________________________________________________________________________________________________ +; +; Z80 KIO +; +; DISPLAY CONFIGURATION DETAILS +;______________________________________________________________________________________________________________________ +; +; +; +KIO_PIOADAT .EQU KIOBASE + $00 +KIO_PIOACMD .EQU KIOBASE + $01 +KIO_PIOBDAT .EQU KIOBASE + $02 +KIO_PIOBCMD .EQU KIOBASE + $03 +KIO_CTC0 .EQU KIOBASE + $04 +KIO_CTC1 .EQU KIOBASE + $05 +KIO_CTC2 .EQU KIOBASE + $06 +KIO_CTC3 .EQU KIOBASE + $07 +KIO_SIOADAT .EQU KIOBASE + $08 +KIO_SIOACMD .EQU KIOBASE + $09 +KIO_SIOBDAT .EQU KIOBASE + $0A +KIO_SIOBCMD .EQU KIOBASE + $0B +KIO_PIACDAT .EQU KIOBASE + $0C +KIO_PIACCMD .EQU KIOBASE + $0D +KIO_KIOCMD .EQU KIOBASE + $0E +KIO_KIOCMDB .EQU KIOBASE + $0F +; +; +; +KIO_PREINIT: + CALL KIO_DETECT + RET NZ +; + ; RECORD PRESENCE + LD A,$FF + LD (KIO_EXISTS),A + ; INITIALIZE KIO + LD A,%11111001 ; RESET ALL DEVICES, SET DAISYCHAIN + OUT (KIO_KIOCMD),A ; DO IT +; + XOR A + RET +; +; +; +KIO_INIT: + ; ANNOUNCE PORT + CALL NEWLINE ; FORMATTING + PRTS("KIO:$") ; FORMATTING +; + PRTS(" IO=0x$") ; FORMATTING + LD A,KIOBASE ; GET BASE PORT + CALL PRTHEXBYTE ; PRINT BASE PORT +; + LD A,(KIO_EXISTS) + OR A + JR Z,KIO_INIT2 +; + PRTS(" ENABLED$") ; DISPLAY ENABLED + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +KIO_INIT2: + PRTS(" NOT PRESENT$") ; NOT ZERO, H/W NOT PRESENT + OR $FF ; SIGNAL FAILURE + RET ; BAIL OUT +; +; +; +KIO_DETECT: + LD C,KIO_SIOBCMD ; USE SIOB COMMAND PORT + LD B,2 ; SIO REG 2 +; + OUT (C),B + XOR A ; ZERO + OUT (C),A ; WRITE IT + OUT (C),B + IN A,(C) + AND $F0 ; TOP NIBBLE ONLY + RET NZ ; FAIL IF NOT ZERO +; + OUT (C),B + LD A,$FF ; $FF + OUT (C),A ; WRITE IT + OUT (C),B + IN A,(C) + AND $F0 ; TOP NIBBLE ONLY + CP $F0 ; COMPARE + RET ; DONE, Z IF FOUND, NZ IF MISCOMPARE +; +; +; +KIO_EXISTS .DB 0 diff --git a/Source/HBIOS/lpt.asm b/Source/HBIOS/lpt.asm new file mode 100644 index 00000000..2c007389 --- /dev/null +++ b/Source/HBIOS/lpt.asm @@ -0,0 +1,328 @@ +; +;================================================================================================== +; CENTRONICS (LPT) INTERFACE DRIVER +;================================================================================================== +; +; CENTRONICS-STYLE PARALLEL PRINTER DRIVER. ASSUMES IBM STYLE +; HARDWARE INTERFACE AS DESCRIBED BELOW. +; +; IMPLEMENTED AS A ROMWBW CHARACTER DEVICE. CURRENTLY HANDLES OUPUT +; ONLY. +; +; PORT 0 (INPUT/OUTPUT): +; +; D7 D6 D5 D4 D3 D2 D1 D0 +; +-------+-------+-------+-------+-------+-------+-------+-------+ +; | PD7 | PD6 | PD5 | PD4 | PD3 | PD2 | PD1 | PD0 | +; +-------+-------+-------+-------+-------+-------+-------+-------+ +; +; PORT 1 (INPUT): +; +; D7 D6 D5 D4 D3 D2 D1 D0 +; +-------+-------+-------+-------+-------+-------+-------+-------+ +; | BUSY | ACK | POUT | SEL | ERR | 0 | 0 | 0 | +; +-------+-------+-------+-------+-------+-------+-------+-------+ +; +; PORT 2 (INPUT/OUTPUT): +; +; D7 D6 D5 D4 D3 D2 D1 D0 +; +-------+-------+-------+-------+-------+-------+-------+-------+ +; | STAT1 | STAT0 | ENBL | PINT | SEL | RES | LF | STB | +; +-------+-------+-------+-------+-------+-------+-------+-------+ +; +LPT_NONE .EQU 0 ; NOT PRESENT +LPT_IBM .EQU 1 ; IBM PC STYLE INTERFACE +; +; PRE-CONSOLE INITIALIZATION - DETECT AND INIT HARDWARE +; +LPT_PREINIT: +; +; SETUP THE DISPATCH TABLE ENTRIES +; NOTE: INTS WILL BE DISABLED WHEN PREINIT IS CALLED AND THEY MUST REMIAIN +; DISABLED. +; + LD B,LPT_CFGCNT ; LOOP CONTROL + XOR A ; ZERO TO ACCUM + LD (LPT_DEV),A ; CURRENT DEVICE NUMBER + LD IY,LPT_CFG ; POINT TO START OF CFG TABLE +LPT_PREINIT0: + PUSH BC ; SAVE LOOP CONTROL + CALL LPT_INITUNIT ; HAND OFF TO UNIT INIT CODE + POP BC ; RESTORE LOOP CONTROL +; + LD A,(IY+1) ; GET THE LPT TYPE DETECTED + OR A ; SET FLAGS + JR Z,LPT_PREINIT2 ; SKIP IT IF NOTHING FOUND +; + PUSH BC ; SAVE LOOP CONTROL + PUSH IY ; CFG ENTRY ADDRESS + POP DE ; ... TO DE + LD BC,LPT_FNTBL ; BC := FUNCTION TABLE ADDRESS + CALL NZ,CIO_ADDENT ; ADD ENTRY IF LPT FOUND, BC:DE + POP BC ; RESTORE LOOP CONTROL +; +LPT_PREINIT2: + LD DE,LPT_CFGSIZ ; SIZE OF CFG ENTRY + ADD IY,DE ; BUMP IY TO NEXT ENTRY + DJNZ LPT_PREINIT0 ; LOOP UNTIL DONE +; +LPT_PREINIT3: + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; +; LPT INITIALIZATION ROUTINE +; +LPT_INITUNIT: + CALL LPT_DETECT ; DETERMINE LPT TYPE + LD (IY+1),A ; SAVE IN CONFIG TABLE + OR A ; SET FLAGS + RET Z ; ABORT IF NOTHING THERE +; + ; UPDATE WORKING LPT DEVICE NUM + LD HL,LPT_DEV ; POINT TO CURRENT DEVICE NUM + LD A,(HL) ; PUT IN ACCUM + INC (HL) ; INCREMENT IT (FOR NEXT LOOP) + LD (IY),A ; UPDATE UNIT NUM +; + ; SET DEFAULT CONFIG + LD DE,-1 ; LEAVE CONFIG ALONE + ; CALL INITDEV TO IMPLEMENT CONFIG, BUT NOTE THAT WE CALL + ; THE INITDEV ENTRY POINT THAT DOES NOT ENABLE/DISABLE INTS! + JP LPT_INITDEVX ; IMPLEMENT IT AND RETURN +; +; +; +LPT_INIT: + LD B,LPT_CFGCNT ; COUNT OF POSSIBLE LPT UNITS + LD IY,LPT_CFG ; POINT TO START OF CFG TABLE +LPT_INIT1: + PUSH BC ; SAVE LOOP CONTROL + LD A,(IY+1) ; GET LPT TYPE + OR A ; SET FLAGS + CALL NZ,LPT_PRTCFG ; PRINT IF NOT ZERO + POP BC ; RESTORE LOOP CONTROL + LD DE,LPT_CFGSIZ ; SIZE OF CFG ENTRY + ADD IY,DE ; BUMP IY TO NEXT ENTRY + DJNZ LPT_INIT1 ; LOOP TILL DONE +; + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; DRIVER FUNCTION TABLE +; +LPT_FNTBL: + .DW LPT_IN + .DW LPT_OUT + .DW LPT_IST + .DW LPT_OST + .DW LPT_INITDEV + .DW LPT_QUERY + .DW LPT_DEVICE +#IF (($ - LPT_FNTBL) != (CIO_FNCNT * 2)) + .ECHO "*** INVALID LPT FUNCTION TABLE ***\n" + !!! ; FORCE AN ASSEMBLY ERROR +#ENDIF +; +; BYTE INTPUT +; +LPT_IN: + ; INPUT NOT SUPPORTED - RETURN NULL BYTE + LD E,0 ; NULL BYTE + XOR A ; SIGNAL SUCCESS + RET +; +; BYTE OUTPUT +; +LPT_OUT: + CALL LPT_OST ; READY TO SEND? + JR Z,LPT_OUT ; LOOP IF NOT + LD A,(IY+3) + LD C,A ; PORT 0 (DATA) + OUT (C),E ; OUTPUT DATA TO PORT + CALL DELAY ; IGNORE ANYTHING BACK AFTER A RESET + LD A,%00001101 ; SELECT & STROBE, LEDS OFF + INC C ; PUT CONTROL PORT IN C + INC C + OUT (C),A ; OUTPUT DATA TO PORT + CALL DELAY ; IGNORE ANYTHING BACK AFTER A RESET + LD A,%00001100 ; SELECT, LEDS OFF + OUT (C),A ; OUTPUT DATA TO PORT + + XOR A ; SIGNAL SUCCESS + RET +; +; INPUT STATUS +; +LPT_IST: + ; INPUT NOT SUPPORTED - RETURN NOT READY + XOR A ; ZERO BYTES AVAILABLE + RET ; DONE +; +; OUTPUT STATUS +; +LPT_OST: + LD A,(IY+3) + LD C,A ; PORT 0 (DATA) + INC C ; SELECT STATUS PORT + IN A,(C) ; GET STATUS INFO + AND %10000000 ; ONLY INTERESTED IN BUSY FLAG + RET ; DONE +; +; INITIALIZE DEVICE +; +LPT_INITDEV: + HB_DI ; AVOID CONFLICTS + CALL LPT_INITDEVX ; DO THE REAL WORK + HB_EI ; INTS BACK ON + RET ; DONE +; +; THIS ENTRY POINT BYPASSES DISABLING/ENABLING INTS WHICH IS REQUIRED BY +; PREINIT ABOVE. PREINIT IS NOT ALLOWED TO ENABLE INTS! +; +LPT_INITDEVX: + LD A,(IY+3) + LD C,A ; PORT 0 (DATA) + XOR A ; CLEAR ACCUM + OUT (C),A ; SEND IT + INC C ; BUMP TO + INC C ; ... PORT 2 + LD A,%00001000 ; SELECT AND ASSERT RESET, LEDS OFF + OUT (C),A ; SEND IT + CALL LDELAY ; HALF SECOND DELAY + LD A,%00001100 ; SELECT AND DEASSERT RESET, LEDS OFF + OUT (C),A ; SEND IT + XOR A ; SIGNAL SUCCESS + RET ; RETURN +; +; +; +LPT_QUERY: + LD E,(IY+4) ; FIRST CONFIG BYTE TO E + LD D,(IY+5) ; SECOND CONFIG BYTE TO D + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; +; +LPT_DEVICE: + LD D,CIODEV_LPT ; D := DEVICE TYPE + LD E,(IY) ; E := PHYSICAL UNIT + LD C,$40 ; C := DEVICE TYPE, 0x40 IS PIO + LD H,(IY+1) ; H := MODE + LD L,(IY+3) ; L := BASE I/O ADDRESS + XOR A ; SIGNAL SUCCESS + RET +; +; LPT DETECTION ROUTINE +; +LPT_DETECT: + LD A,(IY+3) ; BASE PORT ADDRESS + LD C,A ; PUT IN C FOR I/O + CALL LPT_DETECT2 ; CHECK IT + JR Z,LPT_DETECT1 ; FOUND IT, RECORD IT + LD A,LPT_NONE ; NOTHING FOUND + RET ; DONE +; +LPT_DETECT1: + ; LPT FOUND, RECORD IT + LD A,LPT_IBM ; RETURN CHIP TYPE + RET ; DONE +; +LPT_DETECT2: + ; LOOK FOR LPT AT BASE PORT ADDRESS IN C + INC C ; PORT C FOR I/O + INC C ; ... + XOR A ; DEFAULT VALUE (TRI-STATE OFF) + OUT (C),A ; SEND IT +; + ;IN A,(C) ; READ IT + ;AND %11000000 ; ISOLATE STATUS BITS + ;CP %00000000 ; CORRECT VALUE? + ;RET NZ ; IF NOT, RETURN + ;LD A,%11000000 ; STATUS BITS ON (LEDS OFF) + ;OUT (C),A ; SEND IT + ;IN A,(C) ; READ IT + ;AND %11000000 ; ISOLATE STATUS BITS + ;CP %11000000 ; CORRECT VALUE? +; + DEC C ; BACK TO BASE PORT + DEC C ; ... + LD A,$A5 ; TEST VALUE + OUT (C),A ; SEND IT + IN A,(C) ; READ IT BACK + CP $A5 ; CORRECT? + RET ; RETURN (ZF SET CORRECTLY) +; +; +; +LPT_PRTCFG: + ; ANNOUNCE PORT + CALL NEWLINE ; FORMATTING + PRTS("LPT$") ; FORMATTING + LD A,(IY) ; DEVICE NUM + CALL PRTDECB ; PRINT DEVICE NUM + PRTS(": IO=0x$") ; FORMATTING + LD A,(IY+3) ; GET BASE PORT + CALL PRTHEXBYTE ; PRINT BASE PORT + + ; PRINT THE LPT TYPE + CALL PC_SPACE ; FORMATTING + LD A,(IY+1) ; GET LPT TYPE BYTE + RLCA ; MAKE IT A WORD OFFSET + LD HL,LPT_TYPE_MAP ; POINT HL TO TYPE MAP TABLE + CALL ADDHLA ; HL := ENTRY + LD E,(HL) ; DEREFERENCE + INC HL ; ... + LD D,(HL) ; ... TO GET STRING POINTER + CALL WRITESTR ; PRINT IT +; + ; ALL DONE IF NO LPT WAS DETECTED + LD A,(IY+1) ; GET LPT TYPE BYTE + OR A ; SET FLAGS + RET Z ; IF ZERO, NOT PRESENT +; + ; *** ADD MORE DEVICE INFO??? *** +; + XOR A + RET +; +; +; +LPT_TYPE_MAP: + .DW LPT_STR_NONE + .DW LPT_STR_IBM +; +LPT_STR_NONE .DB "$" +LPT_STR_IBM .DB "IBM$" +; +; WORKING VARIABLES +; +LPT_DEV .DB 0 ; DEVICE NUM USED DURING INIT +; +; LPT DEVICE CONFIGURATION TABLE +; +LPT_CFG: +; +LPT0_CFG: + ; LPT MODULE A CONFIG + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; LPT TYPE (SET DURING INIT) + .DB 0 ; MODULE ID + .DB LPT0BASE ; BASE PORT + .DW 0 ; LINE CONFIGURATION +; +LPT_CFGSIZ .EQU $ - LPT_CFG ; SIZE OF ONE CFG TABLE ENTRY +; +#IF (LPTCNT >= 2) +; +LPT1_CFG: + ; LPT MODULE B CONFIG + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; LPT TYPE (SET DURING INIT) + .DB 1 ; MODULE ID + .DB LPT1BASE ; BASE PORT + .DW 0 ; LINE CONFIGURATION +; +#ENDIF +; +LPT_CFGCNT .EQU ($ - LPT_CFG) / LPT_CFGSIZ diff --git a/Source/HBIOS/md.asm b/Source/HBIOS/md.asm index 2b9c9c0a..8277468e 100644 --- a/Source/HBIOS/md.asm +++ b/Source/HBIOS/md.asm @@ -5,24 +5,52 @@ ; ; MD DEVICE CONFIGURATION ; -MD_DEVCNT .EQU 2 ; NUMBER OF MD DEVICES SUPPORTED -MD_CFGSIZ .EQU 6 ; SIZE OF CFG TBL ENTRIES +; +; DISK DEVICE TYPE ID MEDIA ID ATTRIBUTE +;-------------------------------------------------------------------------------------------------- +; 0x00 MEMORY DISK 0x02 RAM DRIVE %00101000 HD STYLE, NON-REMOVABLE, TYPE-RAM +; 0x00 MEMORY DISK 0x01 ROM DRIVE %00100000 HD STYLE, NON-REMOVABLE, TYPE-ROM +; 0x00 MEMORY DISK 0x01 ROM DRIVE %00111000 HD STYLE, NON-REMOVABLE, TYPE-FLASH +; +;MD_DEVCNT .EQU 2 ; NUMBER OF MD DEVICES SUPPORTED +MD_CFGSIZ .EQU 8 ; SIZE OF CFG TBL ENTRIES ; MD_DEV .EQU 0 ; OFFSET OF DEVICE NUMBER (BYTE) MD_STAT .EQU 1 ; OFFSET OF STATUS (BYTE) MD_LBA .EQU 2 ; OFFSET OF LBA (DWORD) +MD_MID .EQU 6 ; OFFSET OF MEDIA ID (BYTE) +MD_ATTRIB .EQU 7 ; OFFSET OF ATTRIBUTE (BYTE) +; +MD_AROM .EQU %00100000 ; ROM ATTRIBUTE +MD_ARAM .EQU %00101000 ; RAM ATTRIBUTE +MD_AFSH .EQU %00111000 ; FLASH ATTRIBUTE +; +MD_FDBG .EQU 0 ; FLASH DEBUG CODE +MD_FVBS .EQU 1 ; FLASH VERBOSE OUTPUT +MD_FVAR .EQU 1 ; FLASH VERIFY AFTER WRITE ; ; DEVICE CONFIG TABLE (RAM DEVICE FIRST TO MAKE IT ALWAYS FIRST DRIVE) ; MD_CFGTBL: - ; DEVICE 1 (RAM) - .DB 1 ; DRIVER DEVICE NUMBER +#IF (MDRAM) + ; DEVICE 0 (RAM) + .DB 0 ; DEVICE NUMBER .DB 0 ; DEVICE STATUS .DW 0,0 ; CURRENT LBA - ; DEVICE 0 (ROM) - .DB 0 ; DEVICE NUMBER + .DB MID_MDRAM ; DEVICE MEDIA ID + .DB MD_ARAM ; DEVICE ATTRIBUTE +#ENDIF +; +#IF (MDROM) + ; DEVICE 1 (ROM) + .DB 1 ; DEVICE NUMBER .DB 0 ; DEVICE STATUS .DW 0,0 ; CURRENT LBA + .DB MID_MDROM ; DEVICE MEDIA ID + .DB MD_AROM ; DEVICE ATTRIBUTE +#ENDIF +; +MD_DEVCNT .EQU ($ - MD_CFGTBL) / MD_CFGSIZ ; #IF ($ - MD_CFGTBL) != (MD_DEVCNT * MD_CFGSIZ) .ECHO "*** INVALID MD CONFIG TABLE ***\n" @@ -33,28 +61,77 @@ MD_CFGTBL: ; ; MD_INIT: +#IF (MDFFENABLE) + CALL MD_FINIT ; PROBE FLASH CAPABILITY +#ENDIF +; CALL NEWLINE ; FORMATTING - PRTS("MD: UNITS=2 $") - PRTS("ROMDISK=$") - LD HL,ROMSIZE - 128 + PRTS("MD: UNITS=$") + LD A,MD_DEVCNT + CALL PRTDECB +; +#IF (MDROM) + PRTS(" ROMDISK=$") +; LD HL,ROMSIZE - 128 + LD A,(HCB + HCB_ROMBANKS) ; GET NUMBER OF BANKS + SUB (TOT_ROM_RB) + LD L,A + LD H,0 ; CALCULATE RAM SIZE + ADD HL,HL ; X2 + ADD HL,HL ; X4 + ADD HL,HL ; X8 + ADD HL,HL ; X16 + ADD HL,HL ; X32 CALL PRTDEC - PRTS("KB RAMDISK=$") - LD HL,RAMSIZE - 128 + PRTS("KB$") +#ENDIF +; +#IF (MDRAM) + PRTS(" RAMDISK=$") +; LD HL,RAMSIZE - 256 + LD A,(HCB + HCB_RAMBANKS) ; GET NUMBER OF BANKS + SUB (TOT_RAM_RB) ; LESS RESERVED BANKS + LD L,A + LD H,0 ; CALCULATE RAM SIZE + ADD HL,HL ; X2 + ADD HL,HL ; X4 + ADD HL,HL ; X8 + ADD HL,HL ; X16 + ADD HL,HL ; X32 CALL PRTDEC PRTS("KB$") +#ENDIF ; ; SETUP THE DIO TABLE ENTRIES ; - LD BC,MD_FNTBL +#IF (MDROM & MDFFENABLE) + LD A,(MD_FFSEN) ; IF FLASH + OR A ; FILESYSTEM + JR NZ,MD_INIT1 ; CAPABLE, + LD A,MD_AFSH ; UPDATE ROM DIO + LD (MD_CFGTBL + MD_CFGSIZ + MD_ATTRIB),A +MD_INIT1: +#ENDIF +; LD DE,MD_CFGTBL - PUSH BC - CALL DIO_ADDENT - POP BC - LD DE,MD_CFGTBL + MD_CFGSIZ - CALL DIO_ADDENT ; - XOR A ; INIT SUCCEEDED - RET ; RETURN +MD_INIT2: + LD A,(DE) ; FIRST BYTE OF CONFIG + CP $FF ; END OF TABLE? + JR NZ,MD_INIT3 ; IF NOT END OF TABLE, CONTINUE + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; +MD_INIT3: + LD BC,MD_FNTBL ; BC IS FUNT TBL + PUSH DE ; SAVE CFG PTR + CALL DIO_ADDENT ; ADD DIO TBL ENTRY + POP DE ; RECOVER CFG PTR + EX DE,HL ; CFG PTR TO HL + LD BC,MD_CFGSIZ ; ENTRY SIZ TO BC + ADD HL,BC ; BUMP TO NEXT ENTRY + EX DE,HL ; CFG PTR BACK TO DE + JR MD_INIT2 ; REPEAT ; ; ; @@ -80,13 +157,14 @@ MD_FNTBL: MD_VERIFY: MD_FORMAT: MD_DEFMED: - CALL PANIC ; INVALID SUB-FUNCTION + SYSCHKERR(ERR_NOTIMPL) ; INVALID SUB-FUNCTION + RET ; ; ; MD_STATUS: - XOR A ; ALWAYS OK - RET +; XOR A ; ALWAYS OK +; RET ; ; ; @@ -95,25 +173,29 @@ MD_RESET: RET ; ; -; -MD_CAP: +; +MD_CAP: ; ASSUMES THAT UNIT 0 IS RAM, UNIT 1 IS ROM LD A,(IY+MD_DEV) ; GET DEVICE NUMBER OR A ; SET FLAGS JR Z,MD_CAP0 ; UNIT 0 DEC A ; TRY UNIT 1 JR Z,MD_CAP1 ; UNIT 1 - CALL PANIC ; PANIC ON INVALID UNIT + SYSCHKERR(ERR_NOUNIT) ; INVALID UNIT + RET MD_CAP0: - LD A,(HCB + HCB_ROMBANKS) ; POINT TO ROM BANK COUNT + LD A,(HCB + HCB_RAMBANKS) ; POINT TO RAM BANK COUNT + LD B,TOT_RAM_RB ; SET # RESERVED RAM BANKS JR MD_CAP2 MD_CAP1: - LD A,(HCB + HCB_RAMBANKS) ; POINT TO RAM BANK COUNT + LD A,(HCB + HCB_ROMBANKS) ; POINT TO ROM BANK COUNT + LD B,TOT_ROM_RB ; SET # RESERVED ROM BANKS MD_CAP2: - SUB 4 ; SUBTRACT OUT RESERVED BANKS + SUB B ; SUBTRACT OUT RESERVED BANKS LD H,A ; H := # BANKS LD E,64 ; # 512 BYTE BLOCKS / BANK CALL MULT8 ; HL := TOTAL # 512 BYTE BLOCKS LD DE,0 ; NEVER EXCEEDS 64K, ZERO HIGH WORD + LD BC,512 ; 512 BYTE SECTOR XOR A RET ; @@ -123,36 +205,33 @@ MD_GEOM: ; RAM/ROM DISKS ALLOW CHS STYLE ACCESS BY EMULATING ; A DISK DEVICE WITH 1 HEAD AND 16 SECTORS / TRACK. CALL MD_CAP ; HL := CAPACITY IN BLOCKS + PUSH BC ; SAVE SECTOR SIZE LD D,1 | $80 ; HEADS / CYL := 1 BY DEFINITION, SET LBA CAPABILITY BIT - LD E,16 ; SECTORS / TRACK := 16 BY DEFINTION + LD E,16 ; SECTORS / TRACK := 16 BY DEFINITION LD B,4 ; PREPARE TO DIVIDE BY 16 MD_GEOM1: SRL H ; SHIFT H RR L ; SHIFT L DJNZ MD_GEOM1 ; DO 4 BITS TO DIVIDE BY 16 + POP BC ; RECOVER SECTOR SIZE XOR A ; SIGNAL SUCCESS RET ; DONE ; ; ; MD_DEVICE: - LD D,DIODEV_MD ; D := DEVICE TYPE - LD A,(IY+MD_DEV) ; GET DEVICE NUMBER - LD E,A ; PUT IN E FOR RETURN - OR A ; SET FLAGS - LD C,%00100000 ; ASSUME ROM DISK ATTRIBUTES - JR Z,MD_DEVICE1 ; IF ZERO, IT IS ROM DISK, DONE - LD C,%00101000 ; USE RAM DISK ATTRIBUTES -MD_DEVICE1: + LD D,DIODEV_MD ; D := DEVICE TYPE - ALL ARE MEMORY DISKS + LD E,(IY+MD_DEV) ; GET DEVICE NUMBER + LD C,(IY+MD_ATTRIB) ; GET ATTRIBUTE + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,0 ; L := 0, NO BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; ; ; MD_MEDIA: - LD A,(IY+MD_DEV) ; GET DEVICE NUM - ADD A,MID_MDROM ; OFFSET BY MD ROM - LD E,A ; RESULTANT MEDIA ID TO E + LD E,(IY+MD_MID) ; GET MEDIA ID LD D,0 ; D:0=0 MEANS NO MEDIA CHANGE XOR A ; SIGNAL SUCCESS RET @@ -169,28 +248,46 @@ MD_SEEK: LD (IY+MD_LBA+3),D ; ... XOR A ; SIGNAL SUCCESS RET ; AND RETURN - ; ; ; MD_READ: CALL HB_DSKREAD ; HOOK HBIOS DISK READ SUPERVISOR - LD BC,MD_RDSEC ; GET ADR OF SECTOR READ FUNC +; +; HL POINTS TO HB_WRKBUF +; +#IF (MDFFENABLE) + LD A,(IY+MD_ATTRIB) ; GET ADR OF SECTOR READ FUNC + LD BC,MD_RDSECF ; + CP MD_AFSH ; RAM / ROM = MD_RDSEC + JR Z,MD_RD1 ; FLASH = MD_RDSECF +#ENDIF + LD BC,MD_RDSEC +MD_RD1: LD (MD_RWFNADR),BC ; SAVE IT AS PENDING IO FUNC JR MD_RW ; CONTINUE TO GENERIC R/W ROUTINE - ; ; ; MD_WRITE: CALL HB_DSKWRITE ; HOOK HBIOS DISK WRITE SUPERVISOR - LD BC,MD_WRSEC ; GET ADR OF SECTOR WRITE FUNC +; +#IF (MDFFENABLE) + LD A,(IY+MD_ATTRIB) ; GET ADR OF SECTOR WRITE FUNC + LD BC,MD_WRSECF ; + CP MD_AFSH ; RAM / ROM = MD_WRSEC + JR Z,MD_WR1 ; FLASH = MD_WRSECF +#ENDIF + LD BC,MD_WRSEC +MD_WR1: + LD (MD_RWFNADR),BC ; SAVE IT AS PENDING IO FUNC - LD A,(IY+MD_DEV) ; GET DEVICE NUMBER - OR A ; SET FLAGS TO TEST FOR ROM (UNIT 0) - JR NZ,MD_RW ; NOT ROM, SO OK TO WRITE, CONTINUE + LD A,(IY+MD_ATTRIB) ; IF THE DEVICES ATTRIBUTE + CP MD_AROM ; IS NOT ROM THEN WE CAN + JR NZ,MD_RW ; WRITE TO IT LD E,0 ; UNIT IS READ ONLY, ZERO SECTORS WRITTEN - OR $FF ; SIGNAL ERROR + LD A,ERR_READONLY ; SIGNAL ERROR + OR A ; SET FLAGS RET ; AND DONE ; ; @@ -204,8 +301,21 @@ MD_RW: LD C,0 ; INIT SECTOR READ/WRITE COUNT MD_RW1: PUSH BC ; SAVE COUNTERS +; +#IF (DSKYENABLE) + LD A,MD_LBA + CALL LDHLIYA + CALL HB_DSKACT ; SHOW ACTIVITY +#ENDIF +; LD HL,(MD_RWFNADR) ; GET PENDING IO FUNCTION ADDRESS +#IF (MDFFENABLE) + PUSH IX + CALL JPHL ; ... AND CALL IT + POP IX +#ELSE CALL JPHL ; ... AND CALL IT +#ENDIF JR NZ,MD_RW2 ; IF ERROR, SKIP INCREMENT ; INCREMENT LBA LD A,MD_LBA ; LBA OFFSET IN CFG ENTRY @@ -227,7 +337,229 @@ MD_RW3: OR A ; SET FLAGS BASED ON RETURN CODE RET ; AND RETURN, A HAS RETURN CODE ; +; READ FLASH +; +#IF (MDFFENABLE) +MD_RDSECF: ; CALLED FROM MD_RW +; + CALL MD_IOSETUPF ; SETUP SOURCE ADDRESS +; + PUSH HL ; IS THE SECTOR + LD HL,(MD_LBA4K) ; WE WANT TO + XOR A ; READ ALREADY + SBC HL,BC ; IN THE 4K + POP HL ; BLOCK WE HAVE + JR Z,MD_SECM ; IN THE BUFFER? +; + ; DESIRED SECTOR IS NOT IN BUFFER + LD (MD_LBA4K),BC ; WE WILL READ IN A NEW 4K SECTOR. + ; SAVE THE 4K LBA FOR FUTURE CHECKS +; + CALL MD_CALBAS ; SETUP BANK AND SECTOR ; + LD IX,MD_F4KBUF ; SET DESTINATION ADDRESS + LD HL,MD_FREAD_R ; PUT ROUTINE TO CALL + CALL MD_FNCALL ; EXECUTE: READ 4K SECTOR +; +MD_SECM: + LD A,(IY+MD_LBA+0) ; GET SECTOR WITHIN 4K BLOCK + AND %00000111 ; AND CALCULATE OFFSET OFFSET + ADD A,A + LD D,A ; FROM THE START + LD E,0 +; + LD HL,MD_F4KBUF ; POINT TO THE SECTOR WE + ADD HL,DE ; WANT TO COPY + LD DE,(MD_DSKBUF) +; +#IF (DMAENABLE & (DMAMODE!=DMAMODE_NONE)) +#IF (DMA_FBACK) + LD A,(DMA_FAIL_FLAG) + OR A + JR NZ,MD_NODMA +#ENDIF + LD BC,512-1 ; COPY ONE 512B SECTOR FROM THE + JP DMALDIR ; 4K SECTOR TO THE DISK BUFFER +#ENDIF +MD_NODMA: +#IF (!(DMAENABLE & (DMAMODE!=DMAMODE_NONE))) + LD BC,512 ; COPY ONE 512B SECTOR FROM THE + LDIR ; 4K SECTOR TO THE DISK BUFFER + XOR A + RET +#ELSE +#IF (DMA_FBACK) + LD BC,512 ; COPY ONE 512B SECTOR FROM THE + LDIR ; 4K SECTOR TO THE DISK BUFFER + XOR A + RET +#ENDIF +#ENDIF +; +; SETUP DE:HL AS THE SECTOR ADDRESS TO READ OR WRITE +; +; ON EXIT +; BC = LBA 4K BLOCK WE ARE ACCESSING +; DE:HL = MEMORY ADDRESS TO ACCESS IN FLASH +; +MD_IOSETUPF: + LD L,(IY+MD_LBA+0) ; HL := LOW WORD OF LBA + LD H,(IY+MD_LBA+1) + INC H ; SKIP FIRST 128MB (256 SECTORS) +; + LD A,L ; SAVE LBA 4K + AND %11111000 ; BLOCK WE ARE + LD C,A ; GOING TO + LD B,H ; ACCESS +; + LD D,0 ; CONVERT LBA + LD E,H ; TO ADDRESS + LD H,L ; MULTIPLY BY 512 + LD L,D ; DE:HL = HLX512 + SLA H + RL E + RL D +; + RET +; +;====================================================================== +; CALCULATE BANK AND ADDRESS DATA FROM MEMORY ADDRESS +; +; ON ENTRY DE:HL CONTAINS 32 BIT MEMORY ADDRESS. +; ON EXIT B CONTAINS BANK SELECT BYTE +; C CONTAINS HIGH BYTE OF SECTOR ADDRESS +; +; DDDDDDDDEEEEEEEE HHHHHHHHLLLLLLLL +; 3322222222221111 1111110000000000 +; 1098765432109876 5432109876543210 +; XXXXXXXXXXXXSSSS SSSSXXXXXXXXXXXX < S = SECTOR +; XXXXXXXXXXXXBBBB BXXXXXXXXXXXXXXX < B = BANK +;====================================================================== +; +MD_CALBAS: +; +#IF (MD_FDBG==1) + CALL PC_SPACE ; DISPLAY SECTOR + CALL PRTHEX32 ; SECTOR ADDRESS + CALL PC_SPACE ; IN DE:HL +#ENDIF +; + PUSH HL + LD A,E ; BOTTOM PORTION OF SECTOR + AND $0F ; ADDRESS THAT GETS WRITTEN + RLC H ; WITH ERASE COMMAND BYTE + RLA ; A15 GETS DROPPED OFF AND + LD B,A ; ADDED TO BANK SELECT +; + LD A,H ; TOP SECTION OF SECTOR + RRA ; ADDRESS THAT GETS WRITTEN + AND $70 ; TO BANK SELECT PORT + LD C,A + + POP HL +; + LD (MD_FBAS),BC ; SAVE BANK AND SECTOR FOR USE IN FLASH ROUTINES +; +#IF (MD_FDBG==1) + CALL PRTHEXWORD ; DISPLAY BANK AND + CALL PC_SPACE ; SECTOR RESULT +#ENDIF + + RET +; +; WRITE FLASH +; +MD_WRSECF: ; CALLED FROM MD_RW + CALL MD_IOSETUPF ; SETUP DESTINATION ADDRESS +; + PUSH HL ; IS THE SECTOR + LD HL,(MD_LBA4K) ; WE WANT TO + XOR A ; WRITE ALREADY + SBC HL,BC ; IN THE 4K + POP HL ; BLOCK WE HAVE + JR Z,MD_SECM1 ; IN THE BUFFER +; + LD (MD_LBA4K),BC ; SAVE 4K LBA +; + CALL MD_CALBAS ; SETUP BANK AND SECTOR +; + LD IX,MD_F4KBUF ; SET DESTINATION ADDRESS + LD HL,MD_FREAD_R ; PUT ROUTINE TO CALL + CALL MD_FNCALL ; EXECUTE: READ 4K SECTOR +; +MD_SECM1: ; DESIRED SECTOR IS IN BUFFER + LD HL,MD_FERAS_R ; PUT ROUTINE TO CALL + CALL MD_FNCALL ; EXECUTE: ERASE 4K SECTOR + OR A + RET NZ ; RETURN IF ERROR + ; + ; COPY 512B SECTOR INTO 4K SECTOR + ; + LD A,(IY+MD_LBA+0) ; GET SECTOR WITHIN 4K BLOCK + AND %00000111 ; AND CALCULATE OFFSET OFFSET + ADD A,A + LD D,A ; FROM THE START + LD E,0 +; + LD HL,MD_F4KBUF ; POINT TO THE SECTOR WE + ADD HL,DE ; WANT TO COPY + EX DE,HL +; + LD HL,(MD_DSKBUF) +#IF (DMAENABLE & (DMAMODE!=DMAMODE_NONE)) +#IF (DMA_FBACK) + LD A,(DMA_FAIL_FLAG) + OR A + JR NZ,MD_NODMA1 +#ENDIF + LD BC,512-1 ; COPY ONE 512B SECTOR FROM THE + CALL DMALDIR ; THE DISK BUFFER TO 4K SECTOR + RET NZ ; EXIT IF DMA COPY ERROR + JR MD_NODMAERR +#ENDIF +MD_NODMA1: +#IF (!(DMAENABLE & (DMAMODE!=DMAMODE_NONE))) + LD BC,512 ; COPY ONE 512B SECTOR FROM THE + LDIR +#ELSE +#IF (DMA_FBACK) ; THE DISK BUFFER TO 4K SECTOR + LD BC,512 + LDIR +#ENDIF +#ENDIF +MD_NODMAERR: + LD IX,MD_F4KBUF ; SET SOURCE ADDRESS + LD HL,MD_FWRIT_R ; PUT ROUTINE TO CALL + CALL MD_FNCALL ; EXECUTE: WRITE 4K SECTOR +; + XOR A ; PRESUME SUCCESS STATUS +; +#IF (MD_FVAR==1) + LD IX,MD_F4KBUF ; SET SOURCE ADDRESS + LD HL,MD_FVERI_R ; PUT ROUTINE TO CALL + CALL MD_FNCALL ; EXECUTE: VERIFY 4K SECTOR +; + OR A + RET Z ; RETURN IF SUCCESSFUL +; + LD IX,MD_F4KBUF ; SET SOURCE ADDRESS ; RETRY + LD HL,MD_FWRIT_R ; PUT ROUTINE TO CALL ; WRITE + CALL MD_FNCALL ; EXECUTE: WRITE 4K SECTOR ; ONCE +; + LD IX,MD_F4KBUF ; SET SOURCE ADDRESS ; VERIFY + LD HL,MD_FVERI_R ; PUT ROUTINE TO CALL ; AGAIN + CALL MD_FNCALL ; EXECUTE: VERIFY 4K SECTOR +; + OR A ; SET FINAL STATUS AFTER RETRY +#ENDIF +; + RET +; +MD_LBA4K .DW $FFFF ; LBA OF CURRENT SECTOR +MD_FBAS .DW $FFFF ; BANK AND SECTOR +#ENDIF +; +; READ RAM / ROM ; MD_RDSEC: CALL MD_IOSETUP ; SETUP FOR MEMORY COPY @@ -258,7 +590,7 @@ MD_RDSEC: XOR A RET ; -; +; WRITE RAM ; MD_WRSEC: CALL MD_IOSETUP ; SETUP FOR MEMORY COPY @@ -346,27 +678,28 @@ MD_IOSETUP: POP AF ; GET BANK AND FLAGS BACK JR Z,MD_IOSETUP2 ; DO ROM DRIVE, ELSE FALL THRU FOR RAM DRIVE ; -MD_IOSETUP1: ; RAM - ADD A,BID_RAMD0 +MD_IOSETUP1: ; ROM + ADD A,BID_ROMD0 RET ; -MD_IOSETUP2: ; ROM - ADD A,BID_ROMD0 +MD_IOSETUP2: ; RAM + ADD A,BID_RAMD0 RET ; ; ; +#IF (MDTRACE >= 2) MD_PRT: PUSH AF PUSH BC PUSH DE PUSH HL - +; CALL NEWLINE - +; LD DE,MDSTR_PREFIX CALL WRITESTR - +; CALL PC_SPACE LD DE,MDSTR_SRC CALL WRITESTR @@ -375,7 +708,7 @@ MD_PRT: CALL PC_COLON LD BC,(MD_SRC) CALL PRTHEXWORD - +; CALL PC_SPACE LD DE,MDSTR_DST CALL WRITESTR @@ -384,33 +717,323 @@ MD_PRT: CALL PC_COLON LD BC,(MD_DST) CALL PRTHEXWORD - +; CALL PC_SPACE LD DE,MDSTR_LEN CALL WRITESTR LD BC,(MD_LEN) CALL PRTHEXWORD - +; POP HL POP DE POP BC POP AF +; + RET +; +MDSTR_PREFIX .TEXT "MD:$" +MDSTR_SRC .TEXT "SRC=$" +MDSTR_DST .TEXT "DEST=$" +MDSTR_LEN .TEXT "LEN=$" +#ENDIF +; +;================================================================================================== +; FLASH DRIVERS +;================================================================================================== +; +; UPPER RAM BANK IS ALWAYS AVAILABLE REGARDLESS OF MEMORY BANK SELECTION. +; HBX_BNKSEL AND HB_CURBNK ARE ALWAYS AVAILABLE IN UPPER MEMORY. +; +; THE STACK IS IN UPPER MEMORY DURING BIOS INITIALIZATION BUT IS IN LOWER +; MEMORY DURING HBIOS CALLS. +; +; TO ACCESS THE FLASH CHIP FEATURES, CODE IS COPIED TO THE UPPER RAM BANK (HBX_BUF) +; AND THE FLASH CHIP IS SWITCHED INTO THE LOWER BANK. +; +; EACH FLASH ROUTINE MUST FIT INTO TO THE HBX_BUF, INCLUDING IT'S LOCAL STACK WHICH +; IS REQUIRED FOR CALLING THE BANK SWITCH ROUTINES. +; +; INSPIRED BY WILL SOWERBUTTS FLASH4 UTILITY - https://github.com/willsowerbutts/flash4/ +; +; REFERENCE ww1.microchip.com/downloads/en/DeviceDoc/SST39SF040.txt +; +;================================================================================================== +; +#IF (MDFFENABLE) +; +;====================================================================== +; BIOS FLASH INITIALIZATION +; +; IDENTIFY AND DISPLAY FLASH CHIPS IN SYSTEM. +; USES MEMORY SIZE DEFINED BY BUILD CONFIGURATION. +;====================================================================== +; +MD_FINIT: + CALL MD_CALCU ; DISPLAY +; +#IF (MD_FVBS==1) + CALL NEWLINE ; OF UNITS + PRTS("MD: FLASH=$") + CALL PRTDECB ; CONFIGURED FOR. +#ENDIF + LD B,A ; NUMBER OF DEVICES TO PROBE + LD C,$00 ; START ADDRESS IS 0000:0000 IN DE:HL +MD_PROBE: + LD D,$00 ; SET ADDRESS IN DE:HL + LD E,C ; + LD H,D ; WE INCREASE E BY $08 + LD L,D ; ON EACH CYCLE THROUGH +; + PUSH BC +#IF (MD_FVBS==1) + CALL PC_SPACE + CALL MD_CALCU + INC A + SUB B ; PRINT + CALL PRTDECB ; DEVICE + LD A,'=' ; NUMBER + CALL COUT +#ENDIF + PUSH HL + CALL MD_CALBAS ; SETUP BANK AND SECTOR + LD HL,MD_FIDEN_R ; PUT ROUTINE TO CALL + CALL MD_FNCALL ; EXECUTE: IDENTIFY FLASH CHIP +; + LD HL,(MD_TGTDEV) ; IF WE MATCH WITH + XOR A ; A NON 39SF040 + SBC HL,BC ; CHIP SET THE + JR Z,MD_PR2 ; R/W FLAG TO R/O + LD HL,MD_FFSEN ; A NON ZERO VALUE + SET 0,(HL) ; MEANS WE CAN'T + ; ENABLE FLASH WRITING +MD_PR2: + POP HL +#IF (MD_FVBS==1) + CALL MD_LAND ; LOOKUP AND DISPLAY +#ENDIF + POP BC +; + LD A,C ; UPDATE ADDRESS + ADD A,$08 ; TO NEXT DEVICE + LD C,A +; + DJNZ MD_PROBE ; ALWAYS AT LEAST ONE DEVICE + +#IF (MD_FVBS==1) + CALL PRTSTRD + .TEXT " FLASH FILE SYSTEM $" + LD DE,MD_FFMSGDIS + LD A,(MD_FFSEN) + OR A + JR NZ,MD_PR1 + LD DE,MD_FFMSGENA +MD_PR1: CALL WRITESTR +#ENDIF + XOR A ; INIT SUCCEEDED RET ; +; CALCULATE NUMBER OF 512KB ROMS FROM NUMBER OF ROM BANKS ; +MD_CALCU: +; LD A,+(ROMSIZE/512) ; DISPLAY NUMBER + LD A,(HCB + HCB_ROMBANKS) ; GET NUMBER OF BANKS + SRL A ; /2 CALCULATE + SRL A ; /4 NUMBER OF 512KB + SRL A ; /8 CHIPS THAT IS + SRL A ; /16 + RET ; -MD_RWFNADR .DW 0 +;====================================================================== +; LOOKUP AND DISPLAY CHIP ; -MD_DSKBUF .DW 0 +; ON ENTRY BC CONTAINS CHIP ID +; ON EXIT A CONTAINS STATUS 0=SUCCESS, NZ=NOT IDENTIFIED +;====================================================================== +; +MD_LAND: +; +#IF (MD_FDBG==1) + PRTS(" ID:$") + LD A,C + CALL PRTHEXBYTE ; DISPLAY FLASH ID + LD A,B + CALL PRTHEXBYTE + CALL PC_SPACE +#ENDIF +; + LD HL,MD_TABLE ; SEARCH THROUGH THE FLASH + LD DE,MD_T_CNT-1 ; TABLE TO FIND A MATCH +MD_NXT1: + LD A,(HL) + CP C + JR NZ,MD_NXT0 ; FIRST BYTE DOES NOT MATCH +; + INC HL + LD A,(HL) + CP B + DEC HL + JR NZ,MD_NXT0 ; SECOND BYTE DOES NOT MATCH +; + INC HL + INC HL + JR MD_NXT2 ; MATCH SO EXIT +; +MD_NXT0:PUSH BC ; WE DIDN'T MATCH SO POINT + LD BC,MD_T_SZ ; TO THE NEXT TABLE ENTRY + ADD HL,BC + POP BC +; + LD A,D ; CHECK IF WE REACHED THE + OR E ; END OF THE TABLE + DEC DE + JR NZ,MD_NXT1 ; NOT AT END YET +; + LD HL,MD_FFMSGUNK ; WE REACHED THE END WITHOUT A MATCH +; +MD_NXT2: +#IF (MD_FVBS==1) + CALL PRTSTR ; AFTER SEARCH DISPLAY THE RESULT +#ENDIF + RET +; +;====================================================================== +; COMMON FUNCTION CALL FOR: +; +; MD_FIDEN_R - IDENTIFY FLASH CHIP +; ON ENTRY MD_FBAS HAS BEEN SET WITH BANK AND SECTOR BEING ACCESSED +; HL POINTS TO THE ROUTINE TO BE RELOCATED AND CALLED +; ON EXIT BC CONTAINS THE CHIP ID BYTES. +; A NO STATUS IS RETURNED +; +; MD_FERAS_R - ERASE FLASH SECTOR +; ON ENTRY MD_FBAS HAS BEEN SET WITH BANK AND SECTOR BEING ACCESSED +; HL POINTS TO THE ROUTINE TO BE RELOCATED AND CALLED +; ON EXIT A RETURNS STATUS 0=SUCCESS NZ=FAIL +; +; MD_FREAD_R - READ FLASH SECTOR +; ON ENTRY MD_FBAS HAS BEEN SET WITH BANK AND SECTOR BEING ACCESSED +; HL POINTS TO THE ROUTINE TO BE RELOCATED AND CALLED +; IX POINTS TO WHERE TO SAVE DATA +; ON EXIT A NO STATUS IS RETURNED +; +; MD_FVERI_R - VERIFY FLASH SECTOR +; ON ENTRY MD_FBAS HAS BEEN SET WITH BANK AND SECTOR BEING ACCESSED +; HL POINTS TO THE ROUTINE TO BE RELOCATED AND CALLED +; IX POINTS TO DATA TO COMPARE. +; ON EXIT A RETURNS STATUS 0=SUCCESS NZ=FAIL +; +; MD_FWRIT_R - WRITE FLASH SECTOR +; ON ENTRY MD_FBAS HAS BEEN SET WITH BANK AND SECTOR BEING ACCESSED +; HL POINTS TO THE ROUTINE TO BE RELOCATED AND CALLED +; IX POINTS TO DATA TO BE WRITTEN +; ON EXIT A NO STATUS IS RETURNED +; +; GENERAL OPERATION: +; COPY FLASH CODE TO CODE BUFFER +; CALL RELOCATED FLASH CODE +; RETURN WITH ID CODE. +;====================================================================== +; +MD_FNCALL: ; USING HBX_BUF FOR CODE AREA +; + LD B,0 ; RETREIVE THE + DEC HL ; CODE SIZE TO + LD C,(HL) ; BE COPIED + INC HL ; MAXIMUM 64 BYTES +; + LD DE,HBX_BUF ; EXECUTE / START ADDRESS + LDIR ; COPY OUR RELOCATABLE CODE TO THE BUFFER +; + LD D,B ; PRESET DE TO ZERO TO REDUCE + LD E,B ; CODE SIZE IN RELOCATABLE CODE +; + LD BC,(MD_FBAS) ; PUT BANK AND SECTOR DATA IN BC +; +#IF (MD_FDBG==1) + CALL PRTHEXWORD +#ENDIF +; + LD A,(HB_CURBNK) ; WE ARE STARTING IN HB_CURBNK +; + HB_DI + LD (MD_SAVSTK),SP ; SAVE CURRENT STACK + LD SP,HBX_BUF_END ; SETUP A NEW HIMEM STACK AT END OF HX_BUF + CALL HBX_BUF ; EXECUTE RELOCATED CODE + LD SP,(MD_SAVSTK) ; RESTORE STACK + HB_EI ; +#IF (MD_FDBG==1) + CALL PC_SPACE + CALL PRTHEXWORD + CALL PC_SPACE + EX DE,HL + CALL PRTHEXWORDHL + CALL PC_SPACE + EX DE,HL +#ENDIF +; + LD A,C ; RETURN WITH STATUS IN A + RET ; RETURN TO MD_READF, MD_WRITEF +; +MD_SAVSTK .DW 0 +; +#INCLUDE "flashlib.inc" +; +;====================================================================== +; +; FLASH CHIP LIST +; +;====================================================================== +; +#DEFINE FF_CHIP(FFROMID,FFROMNM) \ +#DEFCONT \ .DB (FFROMID >> 8) & $FF +#DEFCONT \ .DB (FFROMID & $FF) +#DEFCONT \ .DB FFROMNM +; +MD_TABLE: +FF_CHIP(00120H,"29F010$ ") +FF_CHIP(001A4H,"29F040$ ") +FF_CHIP(01F04H,"AT49F001NT$") +FF_CHIP(01F05H,"AT49F001N$ ") +FF_CHIP(01F07H,"AT49F002N$ ") +FF_CHIP(01F08H,"AT49F002NT$") +FF_CHIP(01F13H,"AT49F040$ ") +FF_CHIP(01F5DH,"AT29C512$ ") +FF_CHIP(01FA4H,"AT29C040$ ") +FF_CHIP(01FD5H,"AT29C010$ ") +FF_CHIP(01FDAH,"AT29C020$ ") +FF_CHIP(02020H,"M29F010$ ") +FF_CHIP(020E2H,"M29F040$ ") +FF_CHIP(037A4H,"A29010B$ ") +FF_CHIP(03786H,"A29040B$ ") +FF_CHIP(0BFB5H,"39F010$ ") +FF_CHIP(0BFB6H,"39F020$ ") +MD_TGTDEV: ; TARGET CHIP FOR R/W FILESYSTEM 39SF040 +FF_CHIP(0BFB7H,"39F040$ ") +FF_CHIP(0C2A4H,"MX29F040$ ") +; +MD_T_CNT .EQU 19 +MD_T_SZ .EQU ($-MD_TABLE) / MD_T_CNT +MD_FFMSGUNK .DB "UNKNOWN$" +MD_FFMSGDIS .DB "DISABLED$" +MD_FFMSGENA .DB "ENABLED$" +; +;====================================================================== +; +; 4K FLASH SECTOR BUFFER +; +;====================================================================== +; +MD_F4KBUF .FILL 4096,$FF +MD_FFSEN .DB 00h ; FLASH FILES SYSTEM ENABLE +; +#ENDIF +; +MD_RWFNADR .DW 0 +MD_DSKBUF .DW 0 MD_SRCBNK .DB 0 MD_DSTBNK .DB 0 MD_SRC .DW 0 MD_DST .DW 0 MD_LEN .DW 0 -; -MDSTR_PREFIX .TEXT "MD:$" -MDSTR_SRC .TEXT "SRC=$" -MDSTR_DST .TEXT "DEST=$" -MDSTR_LEN .TEXT "LEN=$" \ No newline at end of file diff --git a/Source/HBIOS/mky.asm b/Source/HBIOS/mky.asm new file mode 100644 index 00000000..0a86dd16 --- /dev/null +++ b/Source/HBIOS/mky.asm @@ -0,0 +1,1155 @@ +;====================================================================== +; MSX 8255 PPI KEYBOARD COMPATIBLE DRIVER +; +; CREATED BY: DEAN NETHERTON +; KBD.ASM DRIVER USED AS TEMPLATE +; +;====================================================================== +; USAGE: +; THIS DRIVER CAN BE ACTIVED WITHIN THE TMS VIDEO DRIVER +; ADD THE OPTION TO YOUR BUILD CONFIGURATION TO ACTIVATE THE KEYBOARD +; DRIVER: +; MKYENABLE .SET TRUE +; +;====================================================================== +; +; TODO: +; IMPLEMENT MULTIBYTE SCAN CODES (ARROW KEYS, ETC) +; BACKSPACE DOES NOT AUTO-REPEAT +; AUTO DETECT PPI +; +#IF (SYSTIM == TM_NONE) + .ECHO "*** ERROR: MKY REQUIRES SYSTEM TIMER -- NONE CONFIGURED!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR +#ENDIF +; +;====================================================================== +; DRIVER - CONSTANTS +;====================================================================== +; +MKY_REGA .EQU $A8 +MKY_REGB .EQU $A9 +MKY_REGC .EQU $AA +MKY_REGCMD .EQU $AB + +PPICMD_CLOW_IN .EQU 1 +PPICMD_CLOW_OUT .EQU 0 +PPICMD_B_IN .EQU 2 +PPICMD_B_OUT .EQU 0 +PPICMD_GB_MODE_0 .EQU 0 +PPICMD_GB_MODE_1 .EQU 4 +PPICMD_CHIGH_IN .EQU 8 +PPICMD_CHIGH_OUT .EQU 0 +PPICMD_A_IN .EQU 16 +PPICMD_A_OUT .EQU 0 +PPICMD_GA_MODE_0 .EQU 0 +PPICMD_GA_MODE_1 .EQU 32 +PPICMD_GA_MODE_2 .EQU 64 +PPICMD_COMMAND .EQU 128 + +; COUNT FOR PERIOD TO START REPEATING CHARACTERS +KEY_REPEAT_INIT: .EQU 30 + +; COUNT FOR PERIOD BETWEEN AUTO REPEATING CHARACTERS +KEY_REPEAT_PERIOD: .EQU 3 + +; COUNT FOR INTERRUPT HANDLER TO TRIGGER KEYBOARD SCANNER (EG: SCAN KEYBOARD ONLY EVERY 3RD INTERRUPT (3/60)) +SCAN_INT_PERIOD: .EQU 3 + +; NUMBER OF ROWS SUPPORTED BY THE KEYBOARD +MATRIX_ROW_COUNT: .EQU 9 + +; ASSEMBLER SEEMS TO HAVE WEIRD PROBLEM WITH "'" +SINGLE_QUOTE .EQU 39 + +; SPECIAL MADE UP VALUE TO MAP FOR CAPS LOCK +CAPS_CODE: .EQU $D8 + +; TIMING CONSTANTS +; +MKY_WAITTO .EQU 0 ; 0 IS MAX WAIT (256) +; +; STATUS BITS (FOR MKY_STATUS) +; +MKY_EXT .EQU 01H ; BIT 0, EXTENDED SCANCODE ACTIVE +MKY_BREAK .EQU 02H ; BIT 1, THIS IS A KEY UP (BREAK) EVENT +MKY_KEYRDY .EQU 80H ; BIT 7, INDICATES A DECODED KEYCODE IS READY +; +; STATE BITS (FOR MKY_STATE, MKY_LSTATE, MKY_RSTATE) +; +MKY_SHIFT .EQU 01H ; BIT 0, SHIFT ACTIVE (PRESSED) +MKY_CTRL .EQU 02H ; BIT 1, CONTROL ACTIVE (PRESSED) +MKY_ALT .EQU 04H ; BIT 2, ALT ACTIVE (PRESSED) +MKY_WIN .EQU 08H ; BIT 3, WIN ACTIVE (PRESSED) +MKY_SCRLCK .EQU 10H ; BIT 4, CAPS LOCK ACTIVE (TOGGLED ON) +MKY_NUMLCK .EQU 20H ; BIT 5, NUM LOCK ACTIVE (TOGGLED ON) +MKY_CAPSLCK .EQU 40H ; BIT 6, SCROLL LOCK ACTIVE (TOGGLED ON) +MKY_NUMPAD .EQU 80H ; BIT 7, NUM PAD KEY (KEY PRESSED IS ON NUM PAD) +; +MKY_DEFRPT .EQU $40 ; DEFAULT REPEAT RATE (.5 SEC DELAY, 30CPS) +MKY_DEFSTATE .EQU MKY_NUMLCK ; DEFAULT STATE (NUM LOCK ON) + +; --------------.----------------------- +; SCAN CODE TABL.ES + +S_A .EQU $1C +S_B .EQU $32 +S_C .EQU $21 +S_D .EQU $23 +S_E .EQU $24 +S_F .EQU $2B +S_G .EQU $34 +S_H .EQU $33 +S_I .EQU $43 +S_J .EQU $3B +S_K .EQU $42 +S_L .EQU $4B +S_M .EQU $3A +S_N .EQU $31 +S_O .EQU $44 +S_P .EQU $4D +S_Q .EQU $15 +S_R .EQU $2D +S_S .EQU $1B +S_T .EQU $2C +S_U .EQU $3C +S_V .EQU $2A +S_W .EQU $1D +S_X .EQU $22 +S_Y .EQU $35 +S_Z .EQU $1A +S_0 .EQU $45 +S_1 .EQU $16 +S_2 .EQU $1E +S_3 .EQU $26 +S_4 .EQU $25 +S_5 .EQU $2E +S_6 .EQU $36 +S_7 .EQU $3D +S_8 .EQU $3E +S_9 .EQU $46 +S_SEMICOLON .EQU $4C +S_RBRACKET .EQU $5B +S_LBRACKET .EQU $54 +S_BSLASH .EQU $5D +S_EQUALS .EQU $55 +S_MINUS .EQU $4E +S_SLASH .EQU $4A +S_PERIOD .EQU $49 +S_COMMA .EQU $41 +S_TILDA .EQU $0E +S_QUOTE .EQU $52 +S_SHIFT .EQU $12 +S_CTRL .EQU $14 +S_CAPSLOCK .EQU $58 +S_DEAD .EQU $00 +S_GRAPH .EQU $00 +S_CODE .EQU $00 ; perhaps can be mapped to RIGHT ALT +S_F1 .EQU $05 +S_F2 .EQU $06 +S_F3 .EQU $04 +S_F4 .EQU $0C +S_F5 .EQU $03 +S_ESC .EQU $76 +S_TAB .EQU $0D +S_STOP .EQU $00 ; MAKE -> E0 69, BREAK -> E0 F0 69 +S_BACKSPACE .EQU $66 +S_SELECT .EQU $00 +S_RETURN .EQU $5A + +S_RIGHT .EQU $00 ; E0 74 --- E0 F0 74 +S_DOWN .EQU $00 ; E0 72 --- E0 F0 72 +S_UP .EQU $00 ; E0 75 --- E0 F0 75 +S_LEFT .EQU $00 ; E0 6B --- E0 F0 6B +S_DELETE .EQU $00 ; E0 71 --- E0 F0 71 +S_INSERT .EQU $00 ; E0 70 --- E0 F0 70 +S_HOME .EQU $00 ; E0 6C --- E0 F0 6C +S_SPACE .EQU $29 + +SCANCODE_TBL: + .DB S_7, S_6, S_5, S_4, S_3, S_2, S_1, S_0 ; 00 + .DB S_SEMICOLON, S_RBRACKET, S_LBRACKET, S_BSLASH, S_EQUALS, S_MINUS, S_9, S_8 ; 01 + .DB S_B, S_A, S_DEAD, S_SLASH, S_PERIOD, S_COMMA, S_TILDA, S_QUOTE ; 02 + .DB S_J, S_I, S_H, S_G, S_F, S_E, S_D, S_C ; 03 + .DB S_R, S_Q, S_P, S_O, S_N, S_M, S_L, S_K ; 04 + .DB S_Z, S_Y, S_X, S_W, S_V, S_U, S_T, S_S ; 05 + .DB S_F3, S_F2, S_F1, S_CODE, S_CAPSLOCK, S_GRAPH, S_CTRL, S_SHIFT ; 06 + .DB S_RETURN, S_SELECT, S_BACKSPACE, S_STOP, S_TAB, S_ESC, S_F5, S_F4 ; 07 + .DB S_RIGHT, S_DOWN, S_UP, S_LEFT, S_DELETE, S_INSERT, S_HOME, S_SPACE ; 08 + +;__________________________________________________________________________________________________ +; KEYBOARD INITIALIZATION +;__________________________________________________________________________________________________ +; + +MKY_INIT: + CALL NEWLINE ; FORMATTING + PRTS("MSXKYB: IO=0x$") + LD A, MKY_REGA + CALL PRTHEXBYTE + CALL PC_SPACE ; FORMATTING + +#IF (MKYKBLOUT == KBD_US) + PRTS("US LAYOUT$") +#ELSE +#IF (MKYKBLOUT == KBD_DE) + PRTS("GERMAN LAYOUT$") +#ELSE + FAIL !!! + UKNOWN KEYBOARD TYPE +#ENDIF +#ENDIF + + ; CONFIGURE 8255 PPI PORTS + ; A - INPUT (NOT USED) + ; B - INPUT (COLUMN LINES) + ; C - OUTPUT (ROW LINE SELECTION) + + LD A, PPICMD_COMMAND | PPICMD_GA_MODE_0 | PPICMD_GB_MODE_0 | PPICMD_A_IN | PPICMD_B_IN | PPICMD_CLOW_OUT | PPICMD_CHIGH_OUT + OUT (MKY_REGCMD), A + LD A, 64 ; CAPS OFF + OUT (MKY_REGC), A + RET +; +;__________________________________________________________________________________________________ +; KEYBOARD FLUSH +;__________________________________________________________________________________________________ +; +MKY_FLUSH: + XOR A ; A = 0 + LD (MKY_STATUS),A ; CLEAR STATUS + RET +; +;__________________________________________________________________________________________________ +; KEYBOARD STATUS +;__________________________________________________________________________________________________ +; +MKY_STAT: + CALL MKY_SCAN ; SCAN AND SET SCANCODE FOR DETECTED KEY EVENT + CALL MKY_DECODE ; DECODE THE SCANCODE INTO A KEYCODE + JP Z, CIO_IDLE ; RET VIA IDLE PROCESSING IF NO KEY + RET +; +;__________________________________________________________________________________________________ +; KEYBOARD READ +; +; RETURNS ASCII VALUE IN E. SEE END OF FILE FOR VALUES RETURNED FOR SPECIAL KEYS +; LIKE PGUP, ARROWS, FUNCTION KEYS, ETC. +;__________________________________________________________________________________________________ +; +MKY_READ: + CALL MKY_STAT ; KEY READY? +; + JR Z, MKY_READ ; NOT READY, KEEP TRYING + LD A, (MKY_STATE) ; GET STATE + AND $01 ; ISOLATE EXTENDED SCANCODE BIT + RRCA ; ROTATE IT TO HIGH ORDER BIT + LD E, A ; SAVE IT IN E FOR NOW + LD A, (MKY_SCANCODE) ; GET SCANCODE + OR E ; COMBINE WITH EXTENDED BIT + LD C, A ; STORE IT IN C FOR RETURN + LD A, (MKY_KEYCODE) ; GET KEYCODE + LD E, A ; SAVE IT IN E + LD A, (MKY_STATE) ; GET STATE FLAGS + LD D, A ; SAVE THEM IN D + XOR A ; SIGNAL SUCCESS + LD (MKY_STATUS), A ; CLEAR STATUS TO INDICATE BYTE RECEIVED + RET +; +;__________________________________________________________________________________________________ +; RETRIEVE THE NEXT SCAN BYTES AVAILABLE +; +; RETURNS +; ; SUCUESS/FAILURE IN A +; ; NUMBER OF BYTES RETURNED IN B (ZERO IF NO SCAN CODES AVAILABLE) +; ; SCAN CODE BYTES IN D, E, H, L, C +; WORK - IN - PROGRESS +;__________________________________________________________________________________________________ +MKY_RDSCAN: + LD A, (MKY_SCANBUFFLEN) + CALL Z, MKY_GENSCODE + LD A, (MKY_SCANBUFFLEN) + LD B, A + LD A, (MKY_SCANBUFF) + LD D, A + LD A, (MKY_SCANBUFF+1) + LD E, A + LD A, (MKY_SCANBUFF+2) + LD H, A + LD A, (MKY_SCANBUFF+3) + LD L, A + LD A, (MKY_SCANBUFF+4) + LD C, A + + XOR A + LD (MKY_SCANBUFFLEN), A + RET + +MKY_SCAN: + LD A, (MKY_SCANNED) ; NEED TO WAIT UNTIL A NEW SCAN HAS COMPLETED (MKY_INT) + OR A + RET Z + + DI ; CAPTURE THE LATEST KEYBOARD SCANNED STATE + XOR A ; CLEAR SCANNED STATE + LD (MKY_SCANNED), A + + LD DE, MKY_SCNKEY ; COPY NEWKEY TO SCNKEY + LD HL, MKY_NEWKEY ; AND RESET NEWKEY TO $FF + LD B, MATRIX_ROW_COUNT + LD C, 255 +MKY_SCAN_LP1: + LD A, (HL) + LD (DE), A + LD (HL), C + INC HL + INC DE + DJNZ MKY_SCAN_LP1 + EI + + EX AF, AF' + PUSH AF + CALL MKY_GENSCODE + CALL MKY_RPTGEN + POP AF + EX AF, AF' + RET +; +;__________________________________________________________________________________________________ +; HARDWARE INTERFACE +; +; +; KEYBOARD INPUT STATUS +; A=0, Z SET FOR NOTHING PENDING, OTHERWISE DATA PENDING +; +#define MKY_IST LD A, (MKY_SCANBUFFLEN) \ OR A +;__________________________________________________________________________________________________ +; +; GET A RAW DATA BYTE FROM KEYBOARD INTERFACE INTO A WITH TIMEOUT +; +MKY_GETDATA: + LD B, MKY_WAITTO ; SETUP TO LOOP +MKY_GETDATA0: + MKY_IST ; GET INPUT REGISTER STATUS + JR NZ, MKY_GETDATA1 ; BYTE PENDING, GO GET IT + CALL DELAY ; WAIT A BIT + DJNZ MKY_GETDATA0 ; LOOP UNTIL COUNTER EXHAUSTED + XOR A ; NO DATA, RETURN ZERO + RET +MKY_GETDATA1: + CALL MKY_READBYT + OR A ; SET FLAGS + RET +;__________________________________________________________________________________________________ +; +; GET A RAW DATA BYTE FROM KEYBOARD INTERFACE INTO A WITH NOTIMEOUT +; +MKY_GETDATAX: + MKY_IST ; GET INPUT REGISTER STATUS + RET Z ; NOTHING THERE, DONE + JR MKY_GETDATA1 ; GO GET IT + +;__________________________________________________________________________________________________ +; UPDATE KEYBOARD LEDS BASED ON CURRENT TOGGLE FLAGS +;__________________________________________________________________________________________________ +; +MKY_SETLEDS: + LD A,(MKY_STATE) ; LOAD THE STATE FLAGS + AND MKY_CAPSLCK ; CHECK CAPS LOCK + JR Z, MKY_LEDCAPSOFF +; +;__________________________________________________________________________________________________ +; +; TURN THE CAPS LED LIGHT ON +; +MKY_LEDCAPSON: + IN A, (MKY_REGC) + RES 6, A + OUT (MKY_REGC), A + RET +; +;__________________________________________________________________________________________________ +; +; TURN THE CAPS LED LIGHT OFF +; +MKY_LEDCAPSOFF: + IN A, (MKY_REGC) + SET 6, A + OUT (MKY_REGC), A + RET + +;__________________________________________________________________________________________________ +; DECODING ENGINE +;__________________________________________________________________________________________________ +MKY_DECODE: +; +; RUN THE DECODING ENGINE UNTIL EITHER: 1) NO MORE SCANCODES ARE AVAILABLE +; FROM THE KEYBOARD, OR 2) A DECODED KEY VALUE IS AVAILABLE +; +; RETURNS A=0 AND Z SET IF NO KEYCODE READY, OTHERWISE A DECODED KEY VALUE IS AVAILABLE. +; THE DECODED KEY VALUE AND KEY STATE IS STORED IN MKY_KEYCODE AND MKY_STATE. +; +; MKY_STATUS IS NOT CLEARED AT START. IT IS THE CALLER'S RESPONSIBILITY +; TO CLEAR MKY_STATUS WHEN IT HAS RETRIEVED A PENDING VALUE. IF DECODE IS CALLED +; WITH A KEYCODE STILL PENDING, IT WILL JUST RETURN WITHOUT DOING ANYTHING. +; +; Step 0: Check keycode buffer +; if status[keyrdy] +; return +; +; Step 1: Get scancode +; if no scancode ready +; return +; read scancode +; +; Step 2: Detect and handle special keycodes +; if scancode == $AA +; *** handle hot insert somehow *** +; +; Step 3: Detect and handle scancode prefixes +; if scancode == $E0 +; set status[extended] +; goto Step 1 +; +; if scancode == $E1 +; *** handle pause key somehow *** +; +; Step 4: Detect and flag break event +; *** scancode set #1 variation *** +; set status[break] = high bit of scancode +; clear high order bit +; continue to Step 5 +; *** scancode set #2 variation *** +; if scancode == $F0 +; set status[break] +; goto Step 1 +; +; Step 5: Map scancode to keycode +; if status[extended] +; apply extended-map[scancode] -> keycode +; else if state[shifted] +; apply shifted-map[scancode] -> keycode +; else +; apply normal-map[scancode] -> keycode +; +; Step 6: Handle modifier keys +; if keycode is modifier (shift, ctrl, alt, win) +; set (l/r)state[] = not status[break] +; clear modifier bits in state +; set state = (lstate OR rstate OR state) +; goto New Key +; +; Step 7: Complete procesing of key break events +; if status[break] +; goto New Key +; +; Step 8: Handle toggle keys +; if keycode is toggle (capslock, numlock, scrolllock) +; invert (XOR) state[] +; update keyboard LED's +; goto New Key +; +; Step 9: Adjust keycode for control modifier +; if state[ctrl] +; if keycode is 'a'-'z' +; subtract 20 (clear bit 5) from keycode +; if keycode is '@'-'_' +; subtract 40 (clear bit 6) from keycode +; +; Step 10: Adjust keycode for caps lock +; if state[capslock] +; if keycode is 'a'-'z' OR 'A'-'Z' +; toggle (XOR) bit 5 of keycode +; +; Step 11: Handle num pad keys +; REMOVED +; +; Step 12: Detect unknown/invalid keycodes +; if keycode == $FF +; goto New Key +; +; Step 13: Done +; set status[keyrdy] +; return +; +; New Key: +; clear status +; goto Step 1 +; +MKY_DEC0: ; CHECK KEYCODE BUFFER + LD A,(MKY_STATUS) ; GET CURRENT STATUS + AND MKY_KEYRDY ; ISOLATE KEY READY FLAG + RET NZ ; ABORT IF KEY IS ALREADY PENDING + +MKY_DEC1: ; PROCESS NEXT SCANCODE + CALL MKY_GETDATAX ; GET THE SCANCODE + RET Z ; NO KEY READY, RETURN WITH A=0, Z SET + LD (MKY_SCANCODE),A ; SAVE SCANCODE + +MKY_DEC2: ; DETECT AND HANDLE SPECIAL KEYCODES + LD A,(MKY_SCANCODE) ; GET THE CURRENT SCANCODE + CP $AA ; KEYBOARD INSERTION? + JR NZ,MKY_DEC3 ; NOPE, BYPASS + CALL MKY_SETLEDS ; SET LEDS + JP MKY_DECNEW ; RESTART THE ENGINE + +MKY_DEC3: ; DETECT AND HANDLE SCANCODE PREFIXES + LD A,(MKY_SCANCODE) ; GET THE CURRENT SCANCODE + +MKY_DEC3A: ; HANDLE SCANCODE PREFIX $E0 (EXTENDED SCANCODE FOLLOWS) + CP $E0 ; EXTENDED KEY PREFIX $E0? + JR NZ,MKY_DEC3B ; NOPE MOVE ON + LD A,(MKY_STATUS) ; GET STATUS + OR MKY_EXT ; SET EXTENDED BIT + LD (MKY_STATUS),A ; SAVE STATUS + JR MKY_DEC1 ; LOOP TO DO NEXT SCANCODE + +MKY_DEC3B: ; HANDLE SCANCODE PREFIX $E1 (PAUSE KEY) + CP $E1 ; EXTENDED KEY PREFIX $E1 + JR NZ,MKY_DEC4 ; NOPE MOVE ON + LD A,$EE ; MAP TO KEYCODE $EE + LD (MKY_KEYCODE),A ; SAVE IT + ; SWALLOW NEXT 7 SCANCODES + LD B,7 ; LOOP 5 TIMES +MKY_DEC3B1: + PUSH BC + CALL MKY_GETDATA ; RETRIEVE NEXT SCANCODE + POP BC + DJNZ MKY_DEC3B1 ; LOOP AS NEEDED + JP MKY_DEC6 ; RESUME AFTER MAPPING + +MKY_DEC4: ; DETECT AND FLAG BREAK EVENT + CP $F0 ; BREAK (KEY UP) PREFIX? + JR NZ,MKY_DEC5 ; NOPE MOVE ON + LD A,(MKY_STATUS) ; GET STATUS + OR MKY_BREAK ; SET BREAK BIT + LD (MKY_STATUS),A ; SAVE STATUS + JR MKY_DEC1 ; LOOP TO DO NEXT SCANCODE + +MKY_DEC5: ; MAP SCANCODE TO KEYCODE + LD A,(MKY_STATUS) ; GET STATUS + AND MKY_EXT ; EXTENDED BIT SET? + JR Z,MKY_DEC5C ; NOPE, MOVE ON + + ; PERFORM EXTENDED KEY MAPPING + LD A,(MKY_SCANCODE) ; GET SCANCODE + LD E,A ; STASH IT IN E + LD HL,MKY_MAPEXT ; POINT TO START OF EXT MAP TABLE +MKY_DEC5A: + LD A,(HL) ; GET FIRST BYTE OF PAIR + CP $00 ; END OF TABLE? + JP Z,MKY_DECNEW ; UNKNOWN OR BOGUS, START OVER + INC HL ; INC HL FOR FUTURE + CP E ; DOES MATCH BYTE EQUAL SCANCODE? + JR Z,MKY_DEC5B ; YES! JUMP OUT + INC HL ; BUMP TO START OF NEXT PAIR + JR MKY_DEC5A ; LOOP TO CHECK NEXT TABLE ENTRY +MKY_DEC5B: + LD A,(HL) ; GET THE KEYCODE VIA MAPPING TABLE + LD (MKY_KEYCODE),A ; SAVE IT + JR MKY_DEC6 + +MKY_DEC5C: ; PERFORM REGULAR KEY (NOT EXTENDED) KEY MAPPING + LD A,(MKY_SCANCODE) ; GET THE SCANCODE + CP MKY_MAPSIZ ; COMPARE TO SIZE OF TABLE + JR NC,MKY_DEC6 ; PAST END, SKIP OVER LOOKUP + + ; SETUP POINTER TO MAPPING TABLE BASED ON SHIFTED OR UNSHIFTED STATE + LD A,(MKY_STATE) ; GET STATE + AND MKY_SHIFT ; SHIFT ACTIVE? + LD HL,MKY_MAPSTD ; LOAD ADDRESS OF NON-SHIFTED MAPPING TABLE + JR Z,MKY_DEC5D ; NON-SHIFTED, MOVE ON + LD HL,MKY_MAPSHIFT ; LOAD ADDRESS OF SHIFTED MAPPING TABLE +MKY_DEC5D: + LD A,(MKY_SCANCODE) ; GET THE SCANCODE + LD E,A ; SCANCODE TO E FOR TABLE OFFSET + LD D,0 ; D -> 0 + ADD HL,DE ; COMMIT THE TABLE OFFSET TO HL + LD A,(HL) ; GET THE KEYCODE VIA MAPPING TABLE + LD (MKY_KEYCODE),A ; SAVE IT + +MKY_DEC6: ; HANDLE MODIFIER KEYS + LD A,(MKY_KEYCODE) ; MAKE SURE WE HAVE KEYCODE + CP $B8 ; END OF MODIFIER KEYS + JR NC,MKY_DEC7 ; BYPASS MODIFIER KEY CHECKING + CP $B0 ; START OF MODIFIER KEYS + JR C,MKY_DEC7 ; BYPASS MODIFIER KEY CHECKING + + LD B,4 ; LOOP COUNTER TO LOOP THRU 4 MODIFIER BITS + LD E,$80 ; SETUP E TO ROATE THROUGH MODIFIER STATE BITS + SUB $B0 - 1 ; SETUP A TO DECREMENT THROUGH MODIFIER VALUES + +MKY_DEC6A: + RLC E ; SHIFT TO NEXT MODIFIER STATE BIT + DEC A ; L-MODIFIER? + JR Z,MKY_DEC6B ; YES, HANDLE L-MODIFIER MAKE/BREAK + DEC A ; R-MODIFIER? + JR Z,MKY_DEC6C ; YES, HANDLE R-MODIFIER MAKE/BREAK + DJNZ MKY_DEC6A ; LOOP THRU 4 MODIFIER BITS + JR MKY_DEC7 ; FAILSAFE, SHOULD NEVER GET HERE! + +MKY_DEC6B: ; LEFT STATE KEY MAKE/BREAK (STATE BIT TO SET/CLEAR IN E) + LD HL,MKY_LSTATE ; POINT TO LEFT STATE BYTE + JR MKY_DEC6D ; CONTINUE + +MKY_DEC6C: ; RIGHT STATE KEY MAKE/BREAK (STATE BIT TO SET/CLEAR IN E) + LD HL,MKY_RSTATE ; POINT TO RIGHT STATE BYTE + JR MKY_DEC6D ; CONTINUE + +MKY_DEC6D: ; BRANCH BASED ON WHETHER THIS IS A MAKE OR BREAK EVENT + LD A,(MKY_STATUS) ; GET STATUS FLAGS + AND MKY_BREAK ; BREAK EVENT? + JR Z,MKY_DEC6E ; NO, HANDLE A MODIFIER KEY MAKE EVENT + JR MKY_DEC6F ; YES, HANDLE A MODIFIER BREAK EVENT + +MKY_DEC6E: ; HANDLE STATE KEY MAKE EVENT + LD A,E ; GET THE BIT TO SET + OR (HL) ; OR IN THE CURRENT BITS + LD (HL),A ; SAVE THE RESULT + JR MKY_DEC6G ; CONTINUE + +MKY_DEC6F: ; HANDLE STATE KEY BREAK EVENT + LD A,E ; GET THE BIT TO CLEAR + XOR $FF ; FLIP ALL BITS TO SETUP FOR A CLEAR OPERATION + AND (HL) ; AND IN THE FLIPPED BITS TO CLEAR DESIRED BIT + LD (HL),A ; SAVE THE RESULT + JR MKY_DEC6G ; CONTINUE + +MKY_DEC6G: ; COALESCE L/R STATE FLAGS + LD A,(MKY_STATE) ; GET EXISTING STATE BITS + AND $F0 ; GET RID OF OLD MODIFIER BITS + LD DE,(MKY_LSTATE) ; LOAD BOTH L/R STATE BYTES IN D/E + OR E ; MERGE IN LEFT STATE BITS + OR D ; MERGE IN RIGHT STATE BITS + LD (MKY_STATE),A ; SAVE IT + JP MKY_DECNEW ; DONE WITH CURRENT KEYSTROKE + +MKY_DEC7: ; COMPLETE PROCESSING OF EXTENDED AND KEY BREAK EVENTS + LD A,(MKY_STATUS) ; GET CURRENT STATUS FLAGS + AND MKY_BREAK ; IS THIS A KEY BREAK EVENT? + JP NZ,MKY_DECNEW ; PROCESS NEXT KEY + +MKY_DEC8: ; HANDLE TOGGLE KEYS + LD A,(MKY_KEYCODE) ; GET THE CURRENT KEYCODE INTO A + LD E,MKY_CAPSLCK ; SETUP E WITH CAPS LOCK STATE BIT + CP $BC ; IS THIS THE CAPS LOCK KEY? + JR Z,MKY_DEC8A ; YES, GO TO BIT SET ROUTINE + LD E,MKY_NUMLCK ; SETUP E WITH NUM LOCK STATE BIT + CP $BD ; IS THIS THE NUM LOCK KEY? + JR Z,MKY_DEC8A ; YES, GO TO BIT SET ROUTINE + LD E,MKY_SCRLCK ; SETUP E WITH SCROLL LOCK STATE BIT + CP $BE ; IS THIS THE SCROLL LOCK KEY? + JR Z,MKY_DEC8A ; YES, GO TO BIT SET ROUTINE + JR MKY_DEC9 ; NOT A TOGGLE KEY, CONTINUE + +MKY_DEC8A: ; RECORD THE TOGGLE + LD A,(MKY_STATE) ; GET THE CURRENT STATE FLAGS + XOR E ; SET THE TOGGLE KEY BIT FROM ABOVE + LD (MKY_STATE),A ; SAVE IT + CALL MKY_SETLEDS ; UPDATE LED LIGHTS ON KBD + JP MKY_DECNEW ; RESTART DECODER FOR A NEW KEY + +MKY_DEC9: ; ADJUST KEYCODE FOR CONTROL MODIFIER + LD A,(MKY_STATE) ; GET THE CURRENT STATE BITS + AND MKY_CTRL ; CHECK THE CONTROL BIT + JR Z,MKY_DEC10 ; CONTROL KEY NOT PRESSED, MOVE ON + LD A,(MKY_KEYCODE) ; GET CURRENT KEYCODE IN A + CP 'a' ; COMPARE TO LOWERCASE A + JR C,MKY_DEC9A ; BELOW IT, BYPASS + CP 'z' + 1 ; COMPARE TO LOWERCASE Z + JR NC,MKY_DEC9A ; ABOVE IT, BYPASS + RES 5,A ; KEYCODE IN LOWERCASE A-Z RANGE CLEAR BIT 5 TO MAKE IT UPPERCASE +MKY_DEC9A: + CP '@' ; COMPARE TO @ + JR C,MKY_DEC10 ; BELOW IT, BYPASS + CP '_' + 1 ; COMPARE TO _ + JR NC,MKY_DEC10 ; ABOVE IT, BYPASS + RES 6,A ; CONVERT TO CONTROL VALUE BY CLEARING BIT 6 + LD (MKY_KEYCODE),A ; UPDATE KEYCODE TO CONTROL VALUE + +MKY_DEC10: ; ADJUST KEYCODE FOR CAPS LOCK + LD A,(MKY_STATE) ; LOAD THE STATE FLAGS + AND MKY_CAPSLCK ; CHECK CAPS LOCK + JR Z,MKY_DEC12 ; CAPS LOCK NOT ACTIVE, MOVE ON + LD A,(MKY_KEYCODE) ; GET THE CURRENT KEYCODE VALUE + CP 'a' ; COMPARE TO LOWERCASE A + JR C,MKY_DEC10A ; BELOW IT, BYPASS + CP 'z' + 1 ; COMPARE TO LOWERCASE Z + JR NC,MKY_DEC10A ; ABOVE IT, BYPASS + JR MKY_DEC10B ; IN RANGE LOWERCASE A-Z, GO TO CASE SWAPPING LOGIC +MKY_DEC10A: + CP 'A' ; COMPARE TO UPPERCASE A + JR C,MKY_DEC12 ; BELOW IT, BYPASS + CP 'Z' + 1 ; COMPARE TO UPPERCASE Z + JR NC,MKY_DEC12 ; ABOVE IT, BYPASS + JR MKY_DEC10B ; IN RANGE UPPERCASE A-Z, GO TO CASE SWAPPING LOGIC +MKY_DEC10B: + LD A,(MKY_KEYCODE) ; GET THE CURRENT KEYCODE + XOR $20 ; FLIP BIT 5 TO SWAP UPPER/LOWER CASE + LD (MKY_KEYCODE),A ; SAVE IT + +MKY_DEC12: ; DETECT UNKNOWN/INVALID KEYCODES + LD A,(MKY_KEYCODE) ; GET THE FINAL KEYCODE + CP $FF ; IS IT $FF (UNKNOWN/INVALID) + JP Z,MKY_DECNEW ; IF SO, JUST RESTART THE ENGINE + +MKY_DEC13: ; DONE - RECORD RESULTS + LD A,(MKY_STATUS) ; GET CURRENT STATUS + OR MKY_KEYRDY ; SET KEY READY BIT + LD (MKY_STATUS),A ; SAVE IT + XOR A ; A=0 + INC A ; SIGNAL SUCCESS WITH A=1 + RET + +MKY_DECNEW: ; START NEW KEYPRESS (CLEAR ALL STATUS BITS) + XOR A ; A = 0 + LD (MKY_STATUS),A ; CLEAR STATUS + JP MKY_DEC1 ; RESTART THE ENGINE + +; +;__________________________________________________________________________________________________ +; INTERRUPT HANDLER +; +; SCAN KEYBOARD AND IN THE NEWKEY SCAN STATS +; +;__________________________________________________________________________________________________ +; +MKY_INT: + LD A, (MKY_RPTACTIVE) ; NO REPEAT KEY IS HELD? + OR A + JR Z, MKY_INTSCAN1 + LD A, (MKY_RPTCNT) ; DECREMENT REPEAT COUNTER + DEC A ; DOWN TO ZERO + CP $FF + JR Z, MKY_INTSCAN1 + LD (MKY_RPTCNT), A + +MKY_INTSCAN1: + LD A, (MKY_SCNCNT) ; SCAN THE KEYBOARD EVERY 'SCAN_INT_PERIOD' INTERRUPTS. + DEC A + LD (MKY_SCNCNT), A + RET NZ + + LD A, SCAN_INT_PERIOD + LD (MKY_SCNCNT), A + +; SCAN KEYBOARD AND STORE ALL COLUMN RESULTS PER ROW AT MKY_NEWKEY +; + IN A, (MKY_REGC) ; READ AND MASK THE CURRENT STATE OF PPI PORT C + AND $F0 + LD D, A + LD B, MATRIX_ROW_COUNT ; PREPARE TO LOOP THRU THE SCAN ROWS + LD HL, MKY_NEWKEY + LD C, MKY_REGC +MKY_SCAN_LP: + OUT (C), D ; SET ACTIVE ROW + IN A, (MKY_REGB) ; READ ACTIVE COLUMN DATA + LD (HL), A ; STORE COLUMN READ VALUE + INC HL + INC D + DJNZ MKY_SCAN_LP ; LOOP UNTIL ALL ROWS READ + + LD A, $FF ; NOTE THAT A SCAN HAS BEEN DONE + LD (MKY_SCANNED), A + RET + +; +;__________________________________________________________________________________________________ +; COMPARE MKY_OLDKEY O MKY_NEWKEY +; GENERATE SCAN CODES +; +; FOR EACH BIT IN MKY_OLDKEY CP WITH CORRESPONDING BIT IN MKY_SCNKEY +; IF BOTH = 1, THEN NO KEY PRESS - NOTHING CHANGED +; IF BOTH = 0, THEN KEY WAS AND IS STILL PRESSED - NOTHING CHANGED +; IF OLD = 1 AND SCN = 0, KEY WAS PRESSED +; IF OLD = 0 AND SCN = 1, KEY WAS RELEASED +; STOP OF FIRST CHANGE - STORE IN BUFFER, AND RESET/CLEAR BIT IN MKY_OLDKEY +; ALSO SET MKY_RPTACTIVE. NZ -> A KEY IS HELD DOWN, ZERO -> NO KEYS HELD DOWN +; +MKY_GENSCODE: + XOR A + LD (MKY_RPTACTIVE), A ; CLEAR FLAG TO INDICATE A KEYHOLD STATE + + LD HL, MKY_OLDKEY + LD DE, MKY_SCNKEY + XOR A + EX AF, AF' ; ROW COUNT IN A' + +MKY_GENSCODE_LPR: + LD C, (HL) + LD A, (DE) + + AND C + CP $FF + JR Z, MKY_GENSCODENXT1 ; ALL KEYS ARE UP AND WERE UP? + + LD B, 8 ; 8 COLUMN BITS + LD A, (DE) + +MKY_GENSCODE_LPC: + RRCA ; ROTATE NEW COLUMN BIT INTO CARRY + JR NC, MKY_NEWDWN ; IS KEY DOWN? + + ; KEY IS UP + RRC C ; ROTATE OLD COLUMN BIT INTO CARRY + JR C, MKY_GENSCODENXT ; BOTH KEYS UP? + + ; NEW KEY IS UP, OLD KEY WAS DOWN + JR MKY_KEYUP ; STORE NEW KEY RELEASE IN BUFF (A' IF ROW, B IS COLUMN) + +MKY_NEWDWN: + RRC C ; ROTATE OLD COLUMN BIT INTO CARRY + JR NC, MKY_KEYHOLD ; BOTH KEYS DOWN? + + ; NEW KEY IS DOWN, OLD KEY WAS UP + JR MKY_KEYDOWN ; STORE NEW KEY PRESS IN BUFF (A' IF ROW, B IS COLUMN) + +MKY_GENSCODENXT: + DJNZ MKY_GENSCODE_LPC + +MKY_GENSCODENXT1: + EX AF, AF' + INC A + CP MATRIX_ROW_COUNT + RET Z + EX AF, AF' + + INC HL + INC DE + JR MKY_GENSCODE_LPR + + ; KEY IS PRESSED +MKY_KEYHOLD: + EX AF, AF' ; GET ROW COUNT + CP 6 + JR NC, MKY_NORPT ; IF >=6 THEN WE DONT REPEAT + + LD (MKY_NRPTROW), A + EX AF, AF' + + PUSH AF + LD A, B + LD (MKY_NRPTCOL), A + + LD A, $FF ; RECORD FACT THAT A KEY HAS BEEN HELD - FOR LATER TESTING + LD (MKY_RPTACTIVE), A ; OF REPEAT FUNCTION + + POP AF + JR MKY_GENSCODENXT + +MKY_NORPT: + EX AF, AF' + JR MKY_GENSCODENXT + +MKY_KEYDOWN: + PUSH AF + LD A, KEY_REPEAT_INIT ; SET COUNTER FOR REPEAT TRIGGER + LD (MKY_RPTCNT), A + POP AF + +MKY_KEYDOWN_RPT: + CALL MKY_RESOLDBIT + CALL MKY_SCANADDR + LD A, (HL) + OR A ; IF NO SCANCODE - IGNORE IT + RET Z + + LD (MKY_SCANBUFF), A + LD A, 1 + LD (MKY_SCANBUFFLEN), A + RET + +MKY_KEYUP: + CALL MKY_SETOLDBIT + CALL MKY_SCANADDR + + LD A, (HL) + OR A ; IF NO SCANCODE - IGNORE IT + RET Z + LD (MKY_SCANBUFF+1), A + LD A, $F0 + LD (MKY_SCANBUFF), A + LD A, 2 + LD (MKY_SCANBUFFLEN), A + RET + +MKY_RPTGEN: + LD A, (MKY_SCANBUFFLEN) ; IF ALREADY A CODE IN BUFFER + OR A ; THEN WE CANT GENERATE A REPEAT + RET NZ + + LD A, (MKY_RPTACTIVE) ; NO KEY IS HELD + OR A + RET Z + + LD A, (MKY_RPTCNT) + OR A + RET NZ + + ; GENERATE THE KEY DOWN SCAN CODE FOR THE REPEATING KEY + LD A, KEY_REPEAT_PERIOD + LD (MKY_RPTCNT), A + LD A, (MKY_NRPTCOL) + LD B, A + LD A, (MKY_NRPTROW) + EX AF, AF' + JR MKY_KEYDOWN_RPT +; +;__________________________________________________________________________________________________ +; +; RETRIEVE ADDRESS AND BIT MASK WITHIN MKY_OLDKEY RRAY +; +; INPUT: +; B = 1 TO 8 - COLUMN COUNT +; A' IS ROW COUNT - 0 TO MATRIX_ROW_COUNT +; OUTPUT: +; HL = BYTE WITHIN MKY_OLDKEY ARRAY +; A = BIT MASK FOR COLUMN COUNT (EG: B = 3, A = 8) +; PROTECTS: +; A' IS UNCHANGED +; B IS UNCHANGED + +MKY_GETKEYIDX: + LD HL, MKY_OLDKEY + LD A, $80 + LD C, B ; SAVE B (COLUMN COUNT - 1 TO 8) +MKY_SETOLDBIT_LP: + DEC B + JR Z, SKIP + RRCA + JR MKY_SETOLDBIT_LP + +SKIP: + EX AF, AF' ; RETRIEVE ROW COUNT + LD E, A + EX AF, AF' + LD D, 0 + LD B, C ; RETORE B (COLUMN COUNT) + ADD HL, DE + RET +; +;__________________________________________________________________________________________________ +; +; SET BIT WITHIN THE KEY MATRIX ARRAY +; HL -> ADDRESS WITHIN MKY_OLDKEY ARRAY +; C BIT MASK TO BE OR'ED +; +MKY_SETOLDBIT: + CALL MKY_GETKEYIDX + OR (HL) + LD (HL), A + RET +; +;__________________________________________________________________________________________________ +; +; RESET BIT WITHIN THE KEY MATRIX ARRAY +; HL -> ADDRESS WITHIN MKY_OLDKEY ARRAY +; C CPL BIT MASK TO BE AND'ED +; +MKY_RESOLDBIT: + CALL MKY_GETKEYIDX + CPL + AND (HL) + LD (HL), A + RET +; +;__________________________________________________________________________________________________ +; +; CALCULATE THE ADDRESS WITHIN THE SCANCODE_TABLE FOR A SPECIFIC KEY +; +MKY_SCANADDR: + ; ASSUMING SINGLE BYTE CODE CODE + EX AF, AF' ; RETRIVE ROW COUNT + + ; CODE ADDR = SCANCODE_TBL + (A * 8) + B - 1 + LD L, A + LD H, 0 + ADD HL, HL + ADD HL, HL + ADD HL, HL + DEC B + LD C, B + LD B, 0 + ADD HL, BC + LD DE, SCANCODE_TBL + ADD HL, DE + RET +; +;__________________________________________________________________________________________________ +; READ A SINGLE BYTE FROM THE SCANCODE BUFFER +; RETURNED IN A +; +MKY_READBYT: + LD A, (MKY_SCANBUFFLEN) + OR A + RET Z + + LD A, (MKY_SCANBUFF) + LD DE, MKY_SCANBUFF + LD HL, MKY_SCANBUFF + 1 + LD BC, 4 + LDIR + LD C, A + LD A, (MKY_SCANBUFFLEN) + DEC A + LD (MKY_SCANBUFFLEN), A + LD A, C + RET + +; DYNAMIC DATA STORAGE: +; +; STORAGE OF KEYBOARD MATRIX, USED FOR DETECTING KEY REPETITION +MKY_OLDKEY: .FILL MATRIX_ROW_COUNT, $FF +; +; CURRENT STATE OF THE KEYBOARD MATRIX +MKY_NEWKEY: .FILL MATRIX_ROW_COUNT, $FF +; +; COPY OF MKY_NEWKEY FOR USE IN GENERATING SCANCODE +MKY_SCNKEY: .FILL MATRIX_ROW_COUNT, $FF +; +; SET TO NZ WHEN A SCAN IS COMPLETED +; SET TO ZERO AFTER A SCAN CODE CONVERSION +MKY_SCANNED: .DB 0 +; +; F3F6: VDP-INTERUPT COUNTER THAT COUNTS FROM SCAN_INT_PERIOD TO 0, WHEN IT REACHES ZERO, THE +; KEYBOARD MATRIX IS SCANNED, AND THE COUNTERS IS RESET AT SCAN_INT_PERIOD +MKY_SCNCNT: .DB SCAN_INT_PERIOD + +; INITIALL SET TO FALSE, AND THUS DISABLING INTERRUPT HANDLER'S SCAN FUNCTION +; AS SOON AT THE KEY REQUEST FUNCTIONS (STATUS, READ), THIS IS SET AND INTERRUPT HANDLER +; IS PERMANETLY ON. +; MKY_SCANON: .DB 0 + +; +MKY_NRPTCOL: .DB 0 +MKY_NRPTROW: .DB 0 +MKY_RPTACTIVE: .DB 0 +MKY_RPTCNT: .DB KEY_REPEAT_INIT + +MKY_SCANBUFF: .FILL 5, 0 +MKY_SCANBUFFLEN: .DB 0 + +MKY_SCANCODE: .DB 0 ; RAW SCANCODE +MKY_KEYCODE: .DB 0 ; RESULTANT KEYCODE AFTER DECODING +MKY_STATE: .DB 0 ; STATE BITS (SEE ABOVE) +MKY_LSTATE: .DB 0 ; STATE BITS FOR "LEFT" KEYS +MKY_RSTATE: .DB 0 ; STATE BITS FOR "RIGHT" KEYS +MKY_STATUS: .DB 0 ; CURRENT STATUS BITS (SEE ABOVE) + +#IF (MKYKBLOUT == KBD_US) +;__________________________________________________________________________________________________ +; +; MAPPING TABLES US/ENGLISH +;__________________________________________________________________________________________________ +MKY_MAPSTD: ; SCANCODE IS INDEX INTO TABLE TO RESULTANT LOOKUP KEYCODE + .DB $FF,$E8,$FF,$E4,$E2,$E0,$E1,$EB,$FF,$E9,$E7,$E5,$E3,$09,'`',$FF + .DB $FF,$B4,$B0,$FF,$B2,'q','1',$FF,$FF,$FF,'z','s','a','w','2',$FF + .DB $FF,'c','x','d','e','4','3',$FF,$FF,' ','v','f','t','r','5',$FF + .DB $FF,'n','b','h','g','y','6',$FF,$FF,$FF,'m','j','u','7','8',$FF + .DB $FF,',','k','i','o','0','9',$FF,$FF,'.','/','l',';','p','-',$FF + .DB $FF,$FF,$27,$FF,'[','=',$FF,$FF,$BC,$B1,$0D,']',$FF,'\',$FF,$FF + .DB $FF,$FF,$FF,$FF,$FF,$FF,$08,$FF,$FF,$C0,$FF,$C3,$C6,$FF,$FF,$FF + .DB $C9,$CA,$C1,$C4,$C5,$C7,$1B,$BD,$FA,$CE,$C2,$CD,$CC,$C8,$BE,$FF + .DB $FF,$FF,$FF,$E6,$EC +; +MKY_MAPSIZ .EQU ($ - MKY_MAPSTD) +; +MKY_MAPSHIFT: ; SCANCODE IS INDEX INTO TABLE TO RESULTANT LOOKUP KEYCODE WHEN SHIFT ACTIVE + .DB $FF,$E8,$FF,$E4,$E2,$E0,$E1,$EB,$FF,$E9,$E7,$E5,$E3,$09,'~',$FF + .DB $FF,$B4,$B0,$FF,$B2,'Q','!',$FF,$FF,$FF,'Z','S','A','W','@',$FF + .DB $FF,'C','X','D','E','$','#',$FF,$FF,' ','V','F','T','R','%',$FF + .DB $FF,'N','B','H','G','Y','^',$FF,$FF,$FF,'M','J','U','&','*',$FF + .DB $FF,'<','K','I','O',')','(',$FF,$FF,'>','?','L',':','P','_',$FF + .DB $FF,$FF,$22,$FF,'{','+',$FF,$FF,$BC,$B1,$0D,'}',$FF,'|',$FF,$FF + .DB $FF,$FF,$FF,$FF,$FF,$FF,$08,$FF,$FF,$D0,$FF,$D3,$D6,$FF,$FF,$FF + .DB $D9,$DA,$D1,$D4,$D5,$D7,$1B,$BD,$FA,$DE,$D2,$DD,$DC,$D8,$BE,$FF + .DB $FF,$FF,$FF,$E6,$EC +; +MKY_MAPEXT: ; PAIRS ARE [SCANCODE,KEYCODE] FOR EXTENDED SCANCODES + .DB $11,$B5, $14,$B3, $1F,$B6, $27,$B7 + .DB $2F,$EF, $37,$FA, $3F,$FB, $4A,$CB + .DB $5A,$CF, $5E,$FC, $69,$F3, $6B,$F8 + .DB $6C,$F2, $70,$F0, $71,$F1, $72,$F7 + .DB $74,$F9, $75,$F6, $7A,$F5, $7C,$ED + .DB $7D,$F4, $7E,$FD, $00,$00 +; +#ENDIF +#IF (MKYKBLOUT == KBD_DE) +;__________________________________________________________________________________________________ +; +; MAPPING TABLES GERMAN +;__________________________________________________________________________________________________ +; +MKY_MAPSTD: ; SCANCODE IS INDEX INTO TABLE TO RESULTANT LOOKUP KEYCODE ROW + +; Column 0 1 2 3 4 5 6 7 8 9 A B C D E F ; Special adjustments listed below + .DB $FF,$E8,$FF,$E4,$E2,$E0,$E1,$EB,$FF,$E9,$E7,$E5,$E3,$09,'^',$FF ;0 for German keyboard keys that give + .DB $FF,$B4,$B0,$FF,$B2,'q','1',$FF,$FF,$FF,'y','s','a','w','2',$FF ;1 different characters than are printed + .DB $FF,'c','x','d','e','4','3',$FF,$FF,' ','v','f','t','r','5',$FF ;2 on the keys. + .DB $FF,'n','b','h','g','z','6',$FF,$FF,$FF,'m','j','u','7','8',$FF ;3 'german key' --> 'new occupied with' + .DB $FF,',','k','i','o','0','9',$FF,$FF,'.','-','l','[','p',$5C,$FF ;4 Assembler ERROR: '\'-->$5C ; 'ö'-->'[' + .DB $FF,$FF,'@',$FF,']','|',$FF,$FF,$BC,$B1,$0D,'+',$FF,'#',$FF,$FF ;5 'ä'-->'@' ; 'ü'-->']' + .DB $FF,'<',$FF,$FF,$FF,$FF,$08,$FF,$FF,$C0,$FF,$C3,$C6,'<',$FF,$FF ;6 + .DB $C9,$CA,$C1,$C4,$C5,$C7,$1B,$BD,$FA,$CE,$C2,$CD,$CC,$C8,$BE,$FF ;7 + .DB $FF,$FF,$FF,$E6,$EC ;8 + +MKY_MAPSIZ .EQU ($ - MKY_MAPSTD) +; +MKY_MAPSHIFT: ; SCANCODE IS INDEX INTO TABLE TO RESULTANT LOOKUP KEYCODE WHEN SHIFT ACTIVE + + .DB $FF,$E8,$FF,$E4,$E2,$E0,$E1,$EB,$FF,$E9,$E7,$E5,$E3,$09,'~',$FF ; '°' --> '~' + .DB $FF,$B4,$B0,$FF,$B2,'Q','!',$FF,$FF,$FF,'Y','S','A','W',$22,$FF + .DB $FF,'C','X','D','E','$',$20,$FF,$FF,' ','V','F','T','R','%',$FF ; '§'-->$20; '§'=Paragraph not used in CP/M + .DB $FF,'N','B','H','G','Z','&',$FF,$FF,$FF,'M','J','U','/','(',$FF + .DB $FF,';','K','I','O','=',')',$FF,$FF,':','_','L','{','P','?',$FF ; 'Ö'-->'{' + .DB $FF,$FF,'@',$FF,'}','`',$FF,$FF,$BC,$B1,$0D,'*',$FF,$27,$FF,$FF ; 'Ä'-->'@' ; 'Ü'-->'}' + .DB $FF,'>',$FF,$FF,$FF,$FF,$08,$FF,$FF,$D0,$FF,$D3,$D6,'>',$FF,$FF + .DB $D9,$DA,$D1,$D4,$D5,$D7,$1B,$BD,$FA,$DE,$D2,$DD,$DC,$D8,$BE,$FF + .DB $FF,$FF,$FF,$E6,$EC + +MKY_MAPEXT: ; PAIRS ARE [SCANCODE,KEYCODE] FOR EXTENDED SCANCODES + .DB $11,$B5, $14,$B3, $1F,$B6, $27,$B7 + .DB $2F,$EF, $37,$FA, $3F,$FB, $4A,$CB ; All keys listed below are customized for Wordstar. + .DB $5A,$CF, $5E,$FC, $69,$06, $6B,$13 ; n.a , n.a , word right , n.a. + .DB $6C,$01, $70,$16, $71,$07, $72,$18 ; Word left , Toggle Insert/Overwrite , Del Char , Cursor down + .DB $74,$04, $75,$05, $7A,$1A, $7C,$ED ; Cursor right , Cursor up , Page down + .DB $7D,$17, $7E,$FD, $00,$00 ; Page up , n.a. , END MKY_MAPEXT (Pairs end) +; +#ENDIF +; +;__________________________________________________________________________________________________ +; KEYCODE VALUES RETURNED BY THE DECODER +;__________________________________________________________________________________________________ +; +; VALUES 0-127 ARE STANDARD ASCII, SPECIAL KEYS WILL HAVE THE FOLLOWING VALUES: +; +; F1 $E0 +; F2 $E1 +; F3 $E2 +; F4 $E3 +; F5 $E4 +; F6 $E5 +; F7 $E6 +; F8 $E7 +; F9 $E8 +; F10 $E9 +; F11 $EA +; F12 $EB +; SYSRQ $EC +; PRTSC $ED +; PAUSE $EE +; APP $EF +; INS $F0 +; DEL $F1 +; HOME $F2 +; END $F3 +; PGUP $F4 +; PGDN $F5 +; UP $F6 +; DOWN $F7 +; LEFT $F8 +; RIGHT $F9 +; POWER $FA +; SLEEP $FB +; WAKE $FC +; BREAK $FD diff --git a/Source/HBIOS/nascom.asm b/Source/HBIOS/nascom.asm index 1449c741..8b2839d1 100644 --- a/Source/HBIOS/nascom.asm +++ b/Source/HBIOS/nascom.asm @@ -78,7 +78,7 @@ DEL .EQU 7FH ; Delete ; ; 0200H - 2000H BASIC EXECUTABLE ; 2000H - 2090H STACK -; 2090H - 20F8H BASIC EXECUTABLE VARAIABLES / WORKSPACE +; 2090H - 20F8H BASIC EXECUTABLE VARIABLES / WORKSPACE ; 20F9H - BASIC PROGRAM START WRKSPC .EQU BAS_END+90H ; BASIC Work space @@ -4715,9 +4715,13 @@ MONOUT: POP AF RET -MONITR: LD A,BID_BOOT ; BOOT BANK - LD HL,0 ; ADDRESS ZERO - CALL HB_BNKCALL ; DOES NOT RETURN +MONITR: ;LD A,BID_BOOT ; BOOT BANK + ;LD HL,0 ; ADDRESS ZERO + ;CALL HB_BNKCALL ; DOES NOT RETURN + + LD B,BF_SYSRESET ; SYSTEM RESTART + LD C,BF_SYSRES_WARM ; WARM START + CALL $FFF0 ; CALL HBIOS INITST: LD A,0 ; Clear break flag LD (BRKFLG),A @@ -4851,7 +4855,7 @@ MULDLP: DJNZ MULSKP ; DIVIDE BY 8 LD B,$00 LD IX,SPK_DLYADJ ; The base address of the timing loop. ADD IX,BC ; Alter the length of the timing loop. Use an earlier starting point for each '1' lost by taking INT (L/4). - LD A,(RTCVAL) ; Fetch the present border colour from BORDCR and move it to bits 2, 1 and 0 of the A register. + LD A,(HB_RTCVAL) ; Fetch the present border colour from BORDCR and move it to bits 2, 1 and 0 of the A register. ; ; The HL register holds the 'length of the timing loop' with 16 T states being used for each '1' in the L register and 1024 T states for each '1' in the H register. ; @@ -4893,8 +4897,8 @@ BE_END: EI POP BC ; RECALL SYNTAX POINTER POP HL RET -; -RTCVAL .DB 0 +;; +;RTCVAL .DB 0 ; ; SETUP THE ONE SECOND TONE DURATION TABLE BASED ON PROCESSOR SPEED AND TONE FREQUENCY ; diff --git a/Source/HBIOS/netboot.mod b/Source/HBIOS/netboot.mod new file mode 100644 index 00000000..674d9e9b Binary files /dev/null and b/Source/HBIOS/netboot.mod differ diff --git a/Source/HBIOS/pcf8584.asm b/Source/HBIOS/pcf8584.asm new file mode 100644 index 00000000..54dfe6a4 --- /dev/null +++ b/Source/HBIOS/pcf8584.asm @@ -0,0 +1,506 @@ +;================================================================================================== +; PCF8584 I2C CLOCK DRIVER +;================================================================================================== +; +PCF_BASE .EQU 0F0H +PCF_ID .EQU 0AAH +CPU_CLK .EQU 12 + +PCF_RS0 .EQU PCF_BASE +PCF_RS1 .EQU PCF_RS0+1 +PCF_OWN .EQU (PCF_ID >> 1) ; PCF'S ADDRESS IN SLAVE MODE +; +;T4LC512D .EQU 10100000B ; DEVICE IDENTIFIER +;T4LC512A1 .EQU 00000000B ; DEVICE ADDRESS +;T4LC512A2 .EQU 00001110B ; DEVICE ADDRESS +;T4LC512A3 .EQU 00000010B ; DEVICE ADDRESS +;T4LC512W .EQU 00000000B ; DEVICE WRITE +;T4LC512R .EQU 00000001B ; DEVICE READ +; +;I2CDEV1W .EQU (T4LC512D+T4LC512A1+T4LC512W) +;I2CDEV1R .EQU (T4LC512D+T4LC512A1+T4LC512R) +; +;I2CDEV2W .EQU (T4LC512D+T4LC512A2+T4LC512W) +;I2CDEV2R .EQU (T4LC512D+T4LC512A2+T4LC512R) +; +;I2CDEV3W .EQU (T4LC512D+T4LC512A3+T4LC512W) +;I2CDEV3R .EQU (T4LC512D+T4LC512A3+T4LC512R) +; +; CONTROL REGISTER BITS +; +PCF_PIN .EQU 10000000B +PCF_ES0 .EQU 01000000B +PCF_ES1 .EQU 00100000B +PCF_ES2 .EQU 00010000B +PCF_EN1 .EQU 00001000B +PCF_STA .EQU 00000100B +PCF_STO .EQU 00000010B +PCF_ACK .EQU 00000001B +; +PCF_START_ .EQU (PCF_PIN | PCF_ES0 | PCF_STA | PCF_ACK) +PCF_STOP_ .EQU (PCF_PIN | PCF_ES0 | PCF_STO | PCF_ACK) +PCF_REPSTART_ .EQU ( PCF_ES0 | PCF_STA | PCF_ACK) +PCF_IDLE_ .EQU (PCF_PIN | PCF_ES0 | PCF_ACK) +; +; STATUS REGISTER BITS +; +;PCF_PIN .EQU 10000000B +PCF_INI .EQU 01000000B ; 1 if not initialized +PCF_STS .EQU 00100000B +PCF_BER .EQU 00010000B +PCF_AD0 .EQU 00001000B +PCF_LRB .EQU 00001000B +PCF_AAS .EQU 00000100B +PCF_LAB .EQU 00000010B +PCF_BB .EQU 00000001B +; +; CLOCK CHIP FREQUENCIES +; +PCF_CLK3 .EQU 000H +PCF_CLK443 .EQU 010H +PCF_CLK6 .EQU 014H +PCF_CLK8 .EQU 018H +PCF_CLK12 .EQU 01cH +; +; TRANSMISSION FREQUENCIES +; +PCF_TRNS90 .EQU 000H ; 90 kHz */ +PCF_TRNS45 .EQU 001H ; 45 kHz */ +PCF_TRNS11 .EQU 002H ; 11 kHz */ +PCF_TRNS15 .EQU 003H ; 1.5 kHz */ +; +; TIMEOUT AND DELAY VALUES (ARBITRARY) +; +PCF_PINTO .EQU 65000 +PCF_ACKTO .EQU 65000 +PCF_BBTO .EQU 65000 +PCF_LABDLY .EQU 65000 +; +; DATA PORT REGISTERS +; +#IF (CPU_CLK = 443) +PCF_CLK .EQU PCF_CLK4433 +#ELSE + #IF (CPU_CLK = 8) +PCF_CLK .EQU PCF_CLK8 + #ELSE + #IF (CPU_CLK = 12) +PCF_CLK .EQU PCF_CLK12 + #ELSE ***ERROR + #ENDIF + #ENDIF +#ENDIF +; +; THE PCF8584 TARGETS A TOP I2C CLOCK SPEED OF 90KHZ AND SUPPORTS DIVIDERS FOR +; 3, 4.43, 6, 8 AND 12MHZ TO ACHEIVE THIS. +; +; +--------------------------------------------------------------------------------------------+ +; | div/clk | 2MHz | 4MHz | 6MHz | 7.38Mhz | 10MHz | 12MHz | 16MHz | 18.432Mhz | 20MHz | +; +----------------------------------------------------------------------------------+---------+ +; | 3MHz | 60Khz | 120Khz | | | | | | | | +; | 4.43MHz | | 81Khz | | | | | | | | +; | 6MHz | | | 90Khz | 110Khz | | | | | | +; | 8MHz | | | | 83Khz | 112Khz | | | | | +; | 12MHz | | | | | | 90Khz | 120Khz | 138Khz | 150Khz | +; +----------------------------------------------------------------------------------+---------+ +; +PCF8584_INIT: + CALL NEWLINE ; Formatting + PRTS("I2C: IO=0x$") + LD A, PCF_BASE + CALL PRTHEXBYTE + CALL PC_SPACE + CALL PCF_INIT + CALL NEWLINE + RET +; +; LINUX DRIVER BASED CODE +; +; I2C_INB = IN A,(PCF_RS0) +; I2C_OUTB = LD A,* | OUT (PCF_RS0),A +; SET_PCF -= LD A,* | OUT (PCF_RS1),A +; GET_PCF = IN A,(PCF_RS1) +; +;----------------------------------------------------------------------------- +PCF_START: + LD A,PCF_START_ + OUT (PCF_RS1),A + RET +; +;----------------------------------------------------------------------------- +PCF_REPSTART: + LD A,PCF_REPSTART_ + OUT (PCF_RS1),A + RET +; +;----------------------------------------------------------------------------- +PCF_STOP: + LD A,PCF_STOP_ + OUT (PCF_RS1),A + RET +; +;----------------------------------------------------------------------------- +; +PCF_INIT: + LD A,PCF_PIN ; S1=80H: S0 SELECTED, SERIAL + OUT (PCF_RS1),A ; INTERFACE OFF + NOP + IN A,(PCF_RS1) ; CHECK TO SEE S1 NOW USED AS R/W + AND 07FH ; CTRL. PCF8584 DOES THAT WHEN ESO + JR NZ,PCF_FAIL ; IS ZERO +; + LD A,PCF_OWN ; LOAD OWN ADDRESS IN S0, + OUT (PCF_RS0),A ; EFFECTIVE ADDRESS IS (OWN <<1) + NOP + IN A,(PCF_RS0) ; CHECK IT IS REALLY WRITTEN + CP PCF_OWN + JP NZ,PCF_SETERR +; + LD A,+(PCF_PIN | PCF_ES1) ; S1=0A0H + OUT (PCF_RS1),A ; NEXT BYTE IN S2 + NOP + IN A,(PCF_RS1) + AND 07FH + CP PCF_ES1 + JP NZ,PCF_REGERR +; + LD A,PCF_CLK ; LOAD CLOCK REGISTER S2 + OUT (PCF_RS0),A + NOP + IN A,(PCF_RS0) ; CHECK IT'S REALLY WRITTEN, ONLY + AND 1FH ; THE LOWER 5 BITS MATTER + CP PCF_CLK + JP NZ,PCF_CLKERR +; + LD A,PCF_IDLE_ + OUT (PCF_RS1),A + NOP + IN A,(PCF_RS1) + CP +(PCF_PIN | PCF_BB) + JP NZ,PCF_IDLERR +; + XOR A + RET +; +PCF_FAIL: + CALL PCF_INIERR + LD A,ERR_NOHW + LD (PCF_FAIL_FLAG),A + RET +; +PCF_FAIL_FLAG: + .DB 0 +; +;----------------------------------------------------------------------------- +PCF_HANDLE_LAB: +; + LD A,PCF_PIN + OUT (PCF_RS1),A + LD A,PCF_ES0 + OUT (PCF_RS1),A +; + LD HL,PCF_LABDLY +PCF_LABLP: + LD A,H + OR L + DEC HL + JR NZ,PCF_LABLP +; + IN A,(PCF_RS1) + RET +; +;----------------------------------------------------------------------------- +; +; RETURN A=00/Z IF SUCCESSFULL +; RETURN A=FF/NZ IF TIMEOUT +; RETURN A=01/NZ IF LOST ARBITRATION +; PCF_STATUS HOLDS LAST PCF STATUS +; +PCF_WAIT_FOR_PIN: + PUSH HL + LD HL,PCF_PINTO ; SET TIMEOUT VALUE + +PCF_WFP0: + IN A,(PCF_RS1) ; GET BUS + LD (PCF_STATUS),A ; STATUS + LD B,A + + DEC HL ; HAVE WE + LD A,H ; TIMED OUT + OR L + JR Z,PCF_WFP1 ; YES WE HAVE, GO ACTION IT + + LD A,B ; + AND PCF_PIN ; IS TRANSMISSION COMPLETE? + JR NZ,PCF_WFP0 ; KEEP ASKING IF NOT OR + POP HL ; YES COMPLETE (PIN=0) RETURN WITH ZERO + RET +PCF_WFP1: + LD A,B ; DID WE LOSE ARBITRATION? + AND PCF_LAB ; IF A=0 THEN NO + CPL + JR NZ,PCF_WFP2 ; NO + CALL PCF_HANDLE_LAB ; YES GO HANDLE IT + LD (PCF_STATUS),A + XOR A ; RETURN NZ, A=01H + INC A +PCF_WFP2: + POP HL ; RET NZ, A=FF IF TIMEOUT + RET +; +PCF_STATUS .DB 00H + +;-------------------------------------------------------------------------------- +; +; RETURN NZ/FF IF TIMEOUT ERROR +; RETURN NZ/01 IF FAILED TO RECEIVE ACKNOWLEDGE +; RETURN Z/00 IF RECEIVED ACKNOWLEDGE +; +PCF_WAIT_FOR_ACK: + PUSH HL + LD HL,PCF_ACKTO +; +PCF_WFA0: + IN A,(PCF_RS1) ; READ PIN + LD (PCF_STATUS),A ; STATUS + LD B,A +; + DEC HL ; SEE IF WE HAVE TIMED + LD A,H ; OUT WAITING FOR PIN + OR L ; EXIT IF + JR Z,PCF_WFA1 ; WE HAVE +; + LD A,B ; OTHERWISE KEEP LOOPING + AND PCF_PIN ; UNTIL WE GET PIN + JR NZ,PCF_WFA0 ; OR TIMEOUT +; + LD A,B ; WE GOT PIN SO NOW + AND PCF_LRB ; CHECK WE HAVE + LD A,1 + JR Z,PCF_WFA2 ; RECEIVED ACKNOWLEDGE + XOR A + JR PCF_WFA2 +PCF_WFA1: + CPL ; TIMOUT ERROR +PCF_WFA2: + POP HL ; EXIT WITH NZ = FF + RET +; +;-------------------------------------------------------------------------------- +; +; HL POINTS TO DATA +; DE = COUNT +; A = 0 LAST A=1 NOT LAST +; +; +;PCF_READBYTES: ; NOT FUNCTIONAL YET + + LD (PCF_LBF),A ; SAVE LAST BYTE FLAG +; + INC DE ; INCREMENT NUMBER OF BYTES TO READ BY ONE -- DUMMY READ BYTE + LD BC,0 ; SET BYTE COUNTER +; +PCF_RBL:PUSH BC + CALL PCF_WAIT_FOR_PIN ; DO WE HAVE THE BUS? + POP BC + JR Z,PCF_RB1 ; YES + CP 01H + JR Z,PCF_RB3 ; NO - LOST ARBITRATION + JR PCF_RB2 ; NO - TIMEOUT +; +PCF_RB1: + LD A,(PCF_STATUS) + AND PCF_LRB + + + ; IS THIS THE SECOND TO LAST BYTE TO GO? + + PUSH DE ; SAVE COUNT + DEC DE ; COUNT (DE) = NUMBER OF BYTES TO READ LESS 1 + EX DE,HL ; SAVE POINTER, PUT COUNT IN DE + XOR A ; CLEAR CARRY FLAG + SBC HL,BC ; DOES BYTE COUNTER = HL (NUMBER OF BYTES TO READ LESS 1) + EX DE,HL ; RESTORE POINTER + POP DE ; RESTORE COUNT + + ; Z = YES IT IS + ; NZ = NO IT ISN'T + JR NZ,PCF_RB4 +; +PCF_RB4:LD A,B ; IF FIRST READ DO A DUMMY + OR C ; READ OTHERWISE READ AND SAVE + JR NZ,PCF_RB5 + + IN A,(PCF_RS0) ; DUMMY READ + JR PCF_RB6 + +PCF_RB5:IN A,(PCF_RS0) ; READ AND SAVE + LD (HL),A +; +PCF_RB6: ; HAVE WE DONE ALL? + + PUSH DE ; SAVE COUNT + EX DE,HL ; SAVE POINTER, PUT COUNT IN DE + XOR A ; CLEAR CARRY FLAG + SBC HL,BC ; DOES BYTE COUNTER = HL (NUMBER OF BYTES TO READ) + EX DE,HL ; RESTORE POINTER + POP DE ; RESTORE COUNT +; + INC HL ; BUFFER POINTER + INC BC ; COUNT +; + JR NZ,PCF_RBL ; REPEAT UNTIL COUNTS MATCH + RET +; +PCF_RB2: ; TIMEOUT + CALL PCF_STOP + CALL PCF_TOERR + RET +; +PCF_RB3: ; LOST ARBITRATION + CALL PCF_ARBERR + RET +; +PCF_LBF: + .DB 0 ; LAST BYTE FLAG +; +;----------------------------------------------------------------------------- +; READ ONE BYTE FROM I2C +; RETURNS DATA IN A +; Z FLAG SET IS ACKNOWLEDGE RECEIVED (CORRECT OPERATION) +; +PCF_READI2C: + IN A,(PCF_RS1) ; READ S1 REGISTER + BIT 7,A ; CHECK PIN STATUS + JP NZ,PCF_READI2C + BIT 3,A ; CHECK LRB=0 + JP NZ,PCF_RDERR + IN A,(PCF_RS0) ; GET DATA + RET +;----------------------------------------------------------------------------- +; +; POLL THE BUS BUSY BIT TO DETERMINE IF BUS IS FREE. +; RETURN WITH A=00H/Z STATUS IF BUS IS FREE +; RETURN WITH A=FFH/NZ STATUS IF BUS +; +; AFTER RESET THE BUS BUSY BIT WILL BE SET TO 1 I.E. NOT BUSY +; +PCF_WAIT_FOR_BB: + LD HL,PCF_BBTO +PCF_WFBB0: + IN A,(PCF_RS1) + AND PCF_BB + RET Z ; BUS IS FREE RETURN ZERO + DEC HL + LD A,H + OR L + JR NZ,PCF_WFBB0 ; REPEAT IF NOT TIMED OUT + CPL ; RET NZ IF TIMEOUT + RET +; +;----------------------------------------------------------------------------- +; DISPLAY ERROR MESSAGES +; +PCF_RDERR: + PUSH HL + LD HL,PCF_RDFAIL + JR PCF_PRTERR +; +PCF_INIERR: + PUSH HL + LD HL,PCF_NOPCF + JR PCF_PRTERR +; +PCF_SETERR: + PUSH HL + LD HL,PCF_WRTFAIL + JR PCF_PRTERR +; +PCF_REGERR: + PUSH HL + LD HL,PCF_REGFAIL + JR PCF_PRTERR +; +PCF_CLKERR: + PUSH HL + LD HL,PCF_CLKFAIL + JR PCF_PRTERR +; +PCF_IDLERR: + PUSH HL + LD HL,PCF_IDLFAIL + JR PCF_PRTERR +; +PCF_ACKERR: + PUSH HL + LD HL,PCF_ACKFAIL + JR PCF_PRTERR +; +PCF_RDBERR: + PUSH HL + LD HL,PCF_RDBFAIL + JR PCF_PRTERR +; +PCF_TOERR: + PUSH HL + LD HL,PCF_TOFAIL + JR PCF_PRTERR +; +PCF_ARBERR: + PUSH HL + LD HL,PCF_ARBFAIL + JR PCF_PRTERR +; +PCF_PINERR: + PUSH HL + LD HL,PCF_PINFAIL + JR PCF_PRTERR +; +PCF_BBERR: + PUSH HL + LD HL,PCF_BBFAIL + JR PCF_PRTERR +; +PCF_PRTERR: + CALL PRTSTR +; CALL NEWLINE + POP HL + RET +; +;----------------------------------------------------------------------------- +; DEBUG HELPER +; +#IF (1) +PCF_DBG: + PUSH AF + PUSH DE + PUSH HL + LD A,'[' + CALL COUT + LD HL,PCF_DBGF + LD A,(HL) + ADD A,'0' + INC (HL) + CALL COUT + LD A,']' + CALL COUT + POP HL + POP DE + POP AF + RET +PCF_DBGF: + .DB 0 ; DEBUG STAGE COUNTER +#ENDIF +; +PCF_NOPCF .DB "NOT PRESENT$" +PCF_WRTFAIL .DB "SETTING DEVICE ID FAILED$" +PCF_REGFAIL .DB "CLOCK REGISTER SELECT ERROR$" +PCF_CLKFAIL .DB "CLOCK SET FAIL$" +PCF_IDLFAIL .DB "BUS IDLE FAILED$" +PCF_ACKFAIL .DB "FAILED TO RECEIVE ACKNOWLEDGE$" +PCF_RDFAIL .DB "READ FAILED$" +PCF_RDBFAIL .DB "READBYTES FAILED$" +PCF_TOFAIL .DB "TIMEOUT ERROR$" +PCF_ARBFAIL .DB "LOST ARBITRATION$" +PCF_PINFAIL .DB "PIN FAIL$" +PCF_BBFAIL .DB "BUS BUSY$" diff --git a/Source/HBIOS/pio.asm b/Source/HBIOS/pio.asm index 349858a2..18016f4f 100644 --- a/Source/HBIOS/pio.asm +++ b/Source/HBIOS/pio.asm @@ -1,774 +1,254 @@ -; PIO driver sets up the parallel port as a subtype of Serial/Char device. ; +;================================================================================================== +; PIO DRIVER (PARALLEL PORT) +;================================================================================================== ; -; HBIOS initializes driver by: +; SETUP PARAMETER WORD: +; +-------+---+-------------------+ +---+---+-----------+---+-------+ +; | |RTS| ENCODED BAUD RATE | |DTR|XON| PARITY |STP| 8/7/6 | +; +-------+---+---+---------------+ ----+---+-----------+---+-------+ +; F E D C B A 9 8 7 6 5 4 3 2 1 0 +; -- MSB (D REGISTER) -- -- LSB (E REGISTER) -- ; -; 1) Calling Pre-initialization +; THIS DRIVER IS JUST A STUB TO DETECT AND INITIALIZE PIO HARDWARE +; IF IT EXISTS. FOR NOW, IT DOES NOT REGISTER ANY OF THE PIO CHANNELS +; AS CHARACTER DEVICE UNITS. ; -; This involves setting up all the data structures describing the devices. -; If possible, do a hardware test to verify it is available for adding to available devices. -; -; 2) Calling device initialization. -; -; Hardware initialization. -; Configure to initial state or to a new state. -; -; Implementation limitations: -; -; The fully functionality of the Z80 PIO can only be realized by using Z80 interrupt mode 2. -; Registers cannot be interrogated for interrupts status and the originating interrupt -; device cannot be determine. -; -; Full implementation of IM2 functionality for an ECB-ZP and ECB-4P board would require the -; allocation of an interrupt handler for each chip channel. Thus, 12 interrupt handlers -; would be required to support this configuration. As the HBIOS only has an allocation of -; 16, a full implmentation is impractical. -; -; The compromise solution is to allow 4 interrupts for the PIO driver. All remaining PIO's -; are limited to Bit mode or blind read and write to the input/output ports. -; -; Zilog PIO reset state: -; -; Both port mask registers are reset to inhibit All port data bits. -; Port data bus lines are set to a high-impedance state and the Ready "handshake" -; Mode 1 (output) is automatically selected. -; The vector address registers are not reset. -; Both port interrupt enable flip-flops are reset. -; Both port output registers are reset. -; -; Register addressing for ECB-ZP and ECB-4P assuming base address 90h and 88h respectively. +PIO_NONE .EQU 0 +PIO_PIO .EQU 1 ; -; PIO ----ZP---- ----4P---- -; 0 DATA 0 90h DATA 0 B8h -; 0 DATA 1 91h DATA 1 B9h -; 0 CMD 0 92h CMD 0 BAh -; 0 CMD 1 93h CMD 1 BBh -; 1 DATA 0 94h DATA 0 BCh -; 1 DATA 1 95h DATA 1 BDh -; 1 CMD 0 96h CMD 0 BEh -; 1 CMD 1 97h CMD 1 BFh -; 2 DATA 0 C0h -; 2 DATA 1 C1h -; 2 CMD 0 C2h -; 2 CMD 1 C3h -; 3 DATA 0 C4h -; 3 DATA 1 C5h -; 3 CMD 0 C6h -; 3 CMD 1 C7h +PIO0A_CTL .EQU PIO0BASE + $02 +PIO0A_DAT .EQU PIO0BASE + $00 +PIO0B_CTL .EQU PIO0BASE + $03 +PIO0B_DAT .EQU PIO0BASE + $01 ; -PIODEBUG .EQU 1 +#IF (PIOCNT >= 2) ; -M_Output .EQU $00 << 6 -M_Input .EQU $01 << 6 -M_Bidir .EQU $02 << 6 -M_BitCtrl .EQU $03 << 6 -M_BitAllIn .EQU $FF -M_BitAllOut .EQU $00 +PIO1A_CTL .EQU PIO1BASE + $02 +PIO1A_DAT .EQU PIO1BASE + $00 +PIO1B_CTL .EQU PIO1BASE + $03 +PIO1B_DAT .EQU PIO1BASE + $01 ; -PIO_NONE .EQU 0 -PIO_ZPIO .EQU 1 -PIO_8255 .EQU 2 -PIO_PORT .EQU 3 - -; SET MAXIMUM NUMBER OF INTERRUPTS AVAILABLE FOR ALL -; ENSURE INTERRUPTS ARE NOT TURNED ON IF IM2 IS NOT SET. - -INT_ALLOC .DB 0 -INT_N .EQU 00000000B -#IF (INTMODE == 2) -INT_Y .EQU 00000100B -INT_ALLOW .EQU 4 -#ELSE -INT_Y .EQU INT_N -INT_ALLOW .EQU 0 #ENDIF ; -INT0 .EQU 00000000B -INT1 .EQU 00000001B -INT2 .EQU 00000010B -INT3 .EQU 00000011B - +PIO_PREINIT: ; ; SETUP THE DISPATCH TABLE ENTRIES +; NOTE: INTS WILL BE DISABLED WHEN PREINIT IS CALLED AND THEY MUST REMAIN +; DISABLED. ; -; PIO_CNT HOLDS THE NUMBER OF DEVICED CALCULATED FROM THE NUMBER OF DEFPIO MACROS -; PIO_CNT SHOULD INCREASE BY 2 FOR EVERY PIO CHIP ADDED. + CALL PIO_PROBE ; PROBE FOR CHIPS ; -; PIO_PREINIT WILL READ THROUGH ALL PIOCFG TABLES AND CONFIGURE EACH TABLE. -; IT WITH THEN CALL PIO_INITUNIT TO INITIALIZE EACH DEVICE TO ITS DEFAULT STATE -; -; EXPECTS NOTHING ON ENTRY -; -PIO_PREINIT: - CALL NEWLINE ;D - LD B,PIO_CNT ; LOOP CONTROL - LD C,0 ; PHYSICAL UNIT INDEX + LD B,PIO_CFGCNT ; LOOP CONTROL XOR A ; ZERO TO ACCUM -; LD (PIO_DEV),A ; CURRENT DEVICE NUMBER - LD (INT_ALLOC),A ; START WITH NO INTERRUPTS ALLOCATED + LD (PIO_DEV),A ; CURRENT DEVICE NUMBER + LD IY,PIO_CFG ; POINT TO START OF CFG TABLE PIO_PREINIT0: PUSH BC ; SAVE LOOP CONTROL -; LD A,C ; INITIALIZE THE UNIT - -; PUSH AF ;D -; LD A,'u' ;D -; CALL COUT ;D -; POP AF ;D -; CALL PRTHEXBYTE ;D UNIT -; CALL PC_SPACE ;D - -; RLCA ; MULTIPLY BY CFG TABLE ENTRY SIZE (32 BYTES) -; RLCA ; ... -; RLCA ; ... TO GET OFFSET INTO CFG TABLE -; RLCA -;; RLCA -; LD HL,PIO_CFG ; POINT TO START OF CFG TABLE -; PUSH AF -; CALL ADDHLA ; HL := ENTRY ADDRESS -; POP AF -; CALL ADDHLA ; HL := ENTRY ADDRESS -; PUSH HL ; SAVE IT -; POP IY ; ... TO IY - - CALL IDXCFG - - LD (HL),C - - PUSH AF ;D - LD A,'c' ;D - CALL COUT ;D - POP AF ;D - PUSH BC ;D - PUSH HL ;D - POP BC ;D - CALL PRTHEXWORD ;D CONFIG TABLE - CALL PC_SPACE ;D - POP BC ;D - + CALL PIO_INITUNIT ; HAND OFF TO GENERIC INIT CODE + POP BC ; RESTORE LOOP CONTROL +; LD A,(IY+1) ; GET THE PIO TYPE DETECTED - CP PIO_PORT ; SET FLAGS - - PUSH AF ;D - LD A,'t' ;D - CALL COUT ;D - POP AF ;D - CALL PRTHEXBYTE ;D TYPE - CALL PC_SPACE ;D - -; JR Z,BADINIT - -; PUSH BC ; SAVE LOOP CONTROL -; LD BC,PIO_FNTBL ; BC := FUNCTION TABLE ADDRESS -; DEC A -; JR Z,TYPFND ; SKIP IT IF NOTHING FOUND -; LD BC,PPI_FNTBL ; BC := FUNCTION TABLE ADDRESS -; DEC A -; JR Z,TYPFND ; ADD ENTRY IF PIO FOUND, BC:DE -; LD BC,PRT_FNTBL -; DEC A -; JR Z,TYPFND -; POP BC -; JR BADINIT - - PUSH HL - LD DE,-1 ; INITIALIZE THIS DEVICE WITH - CALL PIO_INITDEV ; DEFAULT VALUES - POP HL - -; JR NZ,SKPINIT - - ; AT THIS POINT WE KNOW WE - ; HAVE A VALID DEVICE SO ADD IT - - LD A,8 ; CALCULATE THE FUNCTION TABLE - CALL ADDHLA ; POSITION WHICH FOLLOWS THE - PUSH HL ; CONFIGURATION TABLE OF EACH - POP BC ; DEVICE - -TYPFND: PUSH AF ;D - LD A,'f' ;D - CALL COUT ;D - POP AF ;D - PUSH BC ;D - CALL PRTHEXWORD ;D FUNCTION TABLE - POP BC ;D - CALL NEWLINE ;D - - PUSH IY ; ADD ENTRY IF PIO FOUND, BC:DE - POP DE ; BC: DRIVER FUNCTION TABLE - CALL CIO_ADDENT ; DE: ADDRESS OF UNIT INSTANCE DATA - -BADINIT:POP BC ; RESTORE LOOP CONTROL - - INC C ; NEXT PHYSICAL UNIT -SKPINIT:DJNZ PIO_PREINIT0 ; LOOP UNTIL DONE - - PUSH AF ;D - PRTS("INTS=$") ;D - LD A,(INT_ALLOC) ;D - CALL PRTHEXBYTE ;D - POP AF ;D - PUSH DE ;D - LD DE,CIO_TBL-3 ;D - CALL DUMP_BUFFER ;D - POP DE ;D + OR A ; SET FLAGS + JR Z,PIO_PREINIT2 ; SKIP IT IF NOTHING FOUND +; + PUSH BC ; SAVE LOOP CONTROL + PUSH IY ; CFG ENTRY ADDRESS + POP DE ; ... TO DE + LD BC,PIO_FNTBL ; BC := FUNCTION TABLE ADDRESS + ; REGISTRATION OF CHARACTER UNIT IN HBIOS IS BYPASSED + ; FOR NOW. NOT SURE WHAT TO DO WITH THIS HARDWARE YET. + ;CALL NZ,CIO_ADDENT ; ADD ENTRY IF PIO FOUND, BC:DE + POP BC ; RESTORE LOOP CONTROL +; +PIO_PREINIT2: + LD DE,PIO_CFGSIZ ; SIZE OF CFG ENTRY + ADD IY,DE ; BUMP IY TO NEXT ENTRY + DJNZ PIO_PREINIT0 ; LOOP UNTIL DONE +; XOR A ; SIGNAL SUCCESS RET ; AND RETURN ; -; INDEX INTO THE CONFIG TABLE -; ON ENTRY C = UNIT NUMBER -; ON EXIT IY = CONFIG DATA POINTER -; ON EXIT DE = CONFIG TABLE START -; -; EACH CONFIG TABLE IS 24 BYTES LONG -; -CFG_SIZ .EQU 24 -; -IDXCFG: LD A,C - RLCA ; X 2 - RLCA ; X 4 - RLCA ; X 8 - LD H,0 - LD L,A ; HL = X 8 - PUSH HL - ADD HL,HL ; HL = X 16 - POP DE - ADD HL,DE ; HL = X 24 - LD DE,PIO_CFG - ADD HL,DE - PUSH HL ; COPY CFG DATA PTR - POP IY ; ... TO IY - RET - -; PIO_INITDEV - INITIALIZE DEVICE +; PIO INITIALIZATION ROUTINE ; -; IF DE = FFFF THEN THE SETUP PARAMETER WORD WILL BE READ FROM THE DEVICE CONFIGURATION -; TABLE POINTED TO BY IY AND THE PIO PORT WILL BE PROGRAMMED BASED ON THAT CONFIGURATION. +PIO_INITUNIT: + CALL PIO_DETECT ; DETERMINE PIO TYPE + LD (IY+1),A ; SAVE IN CONFIG TABLE + OR A ; SET FLAGS + RET Z ; ABORT IF NOTHING THERE ; -; OTHERWISE THE PIO PORT WILL BE PROGRAMMED BY THE SETUP PARAMETER WORD IN DE AND THIS -; WILL BE SAVED IN THE DEVICE CONFIGURATION TABLE POINTED TO BY IY. + ; UPDATE WORKING PIO DEVICE NUM + LD HL,PIO_DEV ; POINT TO CURRENT UART DEVICE NUM + LD A,(HL) ; PUT IN ACCUM + INC (HL) ; INCREMENT IT (FOR NEXT LOOP) + LD (IY),A ; UPDATE UNIT NUM +; + ; SET DEFAULT CONFIG + LD DE,-1 ; LEAVE CONFIG ALONE + ; CALL INITDEVX TO IMPLEMENT CONFIG, BUT NOTE THAT WE CALL + ; THE INITDEVX ENTRY POINT THAT DOES NOT ENABLE/DISABLE INTS! + JP PIO_INITDEVX ; IMPLEMENT IT AND RETURN ; -; ALL OTHER CONFIGURATION OF THE DEVICE CONFIGURATION TABLE IS DONE UPSTEAM BY PIO_PREINIT - -PIO_INITDEV: - ; TEST FOR -1 (FFFF) WHICH MEANS USE CURRENT CONFIG (JUST REINIT) - LD A,D ; TEST DE FOR - AND E ; ... VALUE OF -1 - INC A ; ... SO Z SET IF -1 - JR NZ,PIO_INITDEV1 ; IF DE == -1, REINIT CURRENT CONFIG -PIO_INITDEV0: - ; LOAD EXISTING CONFIG (DCW) TO REINIT - LD E,(IY+4) ; LOW BYTE - LD D,(IY+5) ; HIGH BYTE -; -PIO_INITDEV1: ; WHICH DEVICE TYPE? - LD A,(IY+1) - CP PIO_ZPIO - JR Z,SETPIO0 - CP PIO_8255 - JP Z,SET_8255 - CP PIO_PORT - JP Z,SET_PORT -BAD_SET:OR $FF ; UNKNOWN DEVICE - RET - -SETPIO0:LD A,E ; GET MODE - AND 11000000B ; BITS (B7B6) - CP 10000000B ; IS IT BIDIR? - JR NZ,SETPIO1 - LD A,(IY+2) ; GET CHANNEL - OR A - JR NZ,BAD_SET ; CAN'T DO ON CH1 - - ; VALIDATE INTERRUPT REQUEST - ; GRANT INTERRUPT IF THERE IS A FREE INTERRUPT - ; GRANT INTERRUPT IF AN INTERRUPT IS ALREADY ALLOCATED TO THIS UNIT - -SETPIO1:PUSH AF ;D - LD A,'[' ;D - CALL COUT ;D - LD A,(IY) ;D - CALL PRTHEXBYTE ;D - LD A,']' ;D - CALL COUT ;D - POP AF ;D - - BIT 2,E ; SKIP IF WE ARE NOT REQUESTING - JP Z,SETPIO2 ; AN INTERRUPT - - PRTS("[INTREQ]$") ;D - -; LD A,(IY+4) ; GET CURRENT INTERRUPT SETTING -; BIT 2,A ; SKIP IF IT IS ALREADY -; JP NZ,SETPIO2 ; ALLOCATED TO THIS UNIT - - LD A,(INT_ALLOC) ; WE NEED TO ALLOCATE AN - CP INT_ALLOW ; INTERRUPT. DO WE HAVE - JR NC,BAD_SET ; ONE FREE? - - PRTS("[ALLOCINT]$") ;D - - ; WHICH INTERRUPT IS FREE ? - ; SCAN THROUGH THE CFG TABLES - ; AND FIND A FREE ONE - - PUSH AF ; NESTED LOOP - LD DE,CFG_SIZ ; OUTSIDE LOOP IS INTERRUPT - LD B,INT_ALLOW ; INSIDE LOOP IS DEVICE -SETPIOP: LD C,B - DEC C - PUSH BC - LD B,PIO_CNT - LD HL,PIO_CFG+4 -SETPIOX: LD A,(HL) - BIT 2,A ; JUMP TO NEXT DEVICE - JR Z,SETPIOY ; IF NO INTERRUPT ON - AND 00000011B ; THIS DEVICE - - CP C ; IF WE MATCH AN INTERRUPT HERE THEN IT IS NOT FREE. - JR NZ,SETPIOY ; SO EXIT INSIDE LOOP AND TRY NEXT INTERRUPT - - XOR A ; WE MATCH INT 0 - IF WE ARE CHECKING FOR IT THEN - OR C ; WE REGARD IS AS FREE. - JR NZ,SETPIOZ - -SETPIOY: ADD HL,DE - DJNZ SETPIOX - - JR SETPIOQ ; WE GET HERE IF THE CURRENT INTERRUPT - ; WAS NOT MATCHED SO IT IS FREE -SETPIOZ: POP BC - DJNZ SETPIOP - POP AF - - PRTS("[NONEFREE]$") - RET - -SETPIOQ:PUSH AF ; AVAILABLE INTERRUPT IS IN C - PRTS("[FREE]=$") - LD A,C - CALL PRTHEXBYTE - POP AF - - POP AF - POP AF - -SETPIOR:LD HL,INT_ALLOC ; INCREASE THE COUNT - INC (HL) ; OF USED INTERRUPTS - LD A,(HL) - -; LD A,(IY) ; IS THIS UNIT -; INC A ; UNITIALIZED? -; JR Z,SETPIO6 - - LD A,(IY+4) ; IT IS UNITIALIZED SO - OR C ; SAVE THE ALLOCATES - LD (IY+4),A ; INTERRUPT -; -; FOR THIS DEVICE AND INTERRUPT, UPDATE THE CONFIG TABLE FOR THIS DEVICE. -; PIO_IN, PIO_OUT, PIO_IST, PIO_OST ENTRIES NEED TO BE REDIRECTED. -; INTERRUPT VECTOR NEEDS TO BE UPDATED -; - LD A,(IY+0) - LD HL,0 - ; SETUP PIO INTERRUPT VECTOR IN IVT - LD HL,HBX_IV09+1 - -; CALL SPK_BEEP ; -SETPIO6:RET - - ; EXIT WITH FREE INTERRUPT IN C - - LD A,C - LD (INT_ALLOC),A - - LD A,E - AND 11000000B - OR 00000100B - OR C - LD E,A - LD (IY+5),A ; - ; TODO: DEALLOCATE AN INTERRUPT +PIO_INIT: + LD B,PIO_CFGCNT ; COUNT OF POSSIBLE PIO UNITS + LD IY,PIO_CFG ; POINT TO START OF CFG TABLE +PIO_INIT1: + PUSH BC ; SAVE LOOP CONTROL + LD A,(IY+1) ; GET PIO TYPE + OR A ; SET FLAGS + CALL NZ,PIO_PRTCFG ; PRINT IF NOT ZERO + POP BC ; RESTORE LOOP CONTROL + LD DE,PIO_CFGSIZ ; SIZE OF CFG ENTRY + ADD IY,DE ; BUMP IY TO NEXT ENTRY + DJNZ PIO_INIT1 ; LOOP TILL DONE ; -; LD A,(INT_ALLOC) -; DEC A -; LD (INT_ALLOC),A + XOR A ; SIGNAL SUCCESS + RET ; DONE ; -SETPIO2: - -; DE CONTAINS THE MODE IF INTERRUPT ROUTINE SKIPPED - - PRTS("[NOINTREQ]$") ;D - -; LD A,(IY+4) - LD A,E ; GET MODE AND CREATE COMMAND - AND 11000000B ; $B0 - OR 00001111B ; $0F - - LD C,(IY+3) ; GET DATA PORT - INC C ; POINT TO CMD - INC C ; PORT - OUT (C),A ; SET MODE - CP (M_BitCtrl | $0F) ; IF MODE 3 - JR NZ,SETPIO3 - LD A,(IY+5) ; SET I/O DIRECTION - OUT (C),A ; FOR MODE 3 - -SETPIO3:; INTERUPT HANDLING - - JP SETPIO4 - - ; SETUP THE INTERRUPT VECTOR - - LD A,E - AND 00000011B -; DEC A ; INDEX INTO THE - ADD A,A ; THE VECTOR TABLE - ADD A,A ; - LD C,A - LD B,0 - LD HL,HBX_IV09+1 - ADD HL,BC ; GET THE ADDRESS OF - PUSH DE - LD D,(HL) ; THAT INTERRUPT - INC HL ; HANDLER - LD E,(HL) - LD HL,0 ;HBX_IVT+IVT_PIO0 ; POPULATE THE - LD A,L ; GET LOW BYTE OF IVT ADDRESS - ADD HL,BC ; INTERRUPT TABLE - LD (HL),D ; WITH THE INTERRUPT - INC HL ; HANDLER ADDRESS FOR - LD (HL),E ; THIS UNIT - POP DE - LD HL,INT_ALLOC - LD C,(HL) - LD B,0 - LD HL,PRTTAB-1 ; SAVE THE DATA - ADD HL,BC ; PORT FOR EACH INTERRUPT - LD C,(IY+3) - LD (HL),C - - INC C ; POINT TO CMD PORT - INC C - DI ; SET THE VECTOR ADDRESS - OUT (C),A - -; LD A,10000011B ; ENABLE INTERRUPTS ON - OUT (C),A ; THIS UNIT - EI -; JR GUD_SET +; DRIVER FUNCTION TABLE +; +PIO_FNTBL: + .DW PIO_IN + .DW PIO_OUT + .DW PIO_IST + .DW PIO_OST + .DW PIO_INITDEV + .DW PIO_QUERY + .DW PIO_DEVICE +#IF (($ - PIO_FNTBL) != (CIO_FNCNT * 2)) + .ECHO "*** INVALID PIO FUNCTION TABLE ***\n" +#ENDIF ; -SETPIO4:LD A,00000111B ; $07 - OUT (C),A ; NO INTERRUPTS ; -; SUCCESSFULL SO SAVE DEVICE CONFIGURATION WORD (DCW) ; -GUD_SET:LD (IY+4),E ; LOW BYTE - LD (IY+5),D ; HIGH BYTE +PIO_IN: + LD E,0 ; DUMMY VALUE + XOR A ; SIGNAL SUCCESS + RET ; -; UPDATE THE DEVICE TABLE WITH THE ADDRESSES FOR THE CORRECT ROUTINE. ; - LD A,E - AND 00000111B - LD HL,INTMATRIX ; POINT TO EITHER THE INTERRUPT - JR NZ, USEIM - LD HL,POLMATRIX ; MATRIX OR THE POLLED MATRIX -USEIM: PUSH HL - - PUSH IY ; CALCULATE THE DESTINATION - POP HL ; ADDRESS IN THE PIO_CFG TABLE - LD BC,8 ; FOR THE FOUR ADDESSES TO BE - ADD HL,BC ; COPIED TO - -; LD B,0 ; 00000000 CALCULATE THE SOURCE ADDRESS - LD C,E ; XX?????? FROM THE MATRIX. EACH ENTRY - SRL C ; 0XX????? IN THE MATRIX IS 8 BYTES SO - SRL C ; 00XX???? SOURCE = MATRIX BASE + (8 * MODE) - SRL C ; 000XX??? - POP DE ; LOAD THE MATRIX BASE -; LD DE,POLMATRIX - EX DE,HL - ADD HL,BC ; HL = SOURCE - - LD C,8 ; COPY 8 BYTES - LDIR - -; PUSH IY -; POP DE -; CALL DUMP_BUFFER - - XOR A - RET - -PRTTAB: .DB 0 - .DB 0 - .DB 0 - .DB 0 -; -;----------------------------------------------------------------------------- -; -; INPUT INTERRUPT VECTOR MACRO AND DEFINITION FOR FOUR PORTS -; -#DEFINE PIOMIVT(PIOIN,PIOIST,PIOPRT) \ -#DEFCONT ;\ -#DEFCONT ; RETURN WITH ERROR IF THERE IS \ -#DEFCONT ; ALREADY A CHARACTER IN BUFFER \ -#DEFCONT ;\ -#DEFCONT ; OTHERWISE CHANGE THE STATUS TO \ -#DEFCONT ; SHOW THERE IS ONE CHARACTER IN \ -#DEFCONT ; THE BUFFER AND READ IT IN AND \ -#DEFCONT ; AND STORE IT.RETURN GOOD STATUS.\ -#DEFCONT ;\ -#DEFCONT \ LD A,(_CIST) -#DEFCONT \ OR A -#DEFCONT \ JR NZ,_OVFL -#DEFCONT \ LD A,(PIOPRT) -#DEFCONT \ LD C,A -#DEFCONT \ LD A,1 -#DEFCONT \ LD (_CIST),A -#DEFCONT \ IN A,(C) -#DEFCONT \ LD (_CICH),A -#DEFCONT \ OR $FF -#DEFCONT \ RET -#DEFCONT \_OVFL:XOR A -#DEFCONT \ RET -#DEFCONT ;\ -#DEFCONT ;\ -#DEFCONT ;\ -#DEFCONT ;\ -#DEFCONT ;\ -#DEFCONT ;\ -#DEFCONT \PIOIN:CALL PIOIST -#DEFCONT \ JR Z,PIOIN -#DEFCONT \ LD A,(_CICH) -#DEFCONT \ LD E,A -#DEFCONT \ XOR A -#DEFCONT \ LD (_CIST),A -#DEFCONT \ RET -#DEFCONT ;\ -#DEFCONT ; If THERE A CHARACTER \ -#DEFCONT ; AVAILABLE? RETURN NUMBER \ -#DEFCONT ; IN A - 0 OR 1 \ -#DEFCONT ;\ -#DEFCONT \PIOIST:LD A,(_CIST) -#DEFCONT \ AND 00000001B -#DEFCONT \ RET -#DEFCONT ;\ -#DEFCONT ; CIST : 01 = CHARACTER READY ELSE NOT READY \ -#DEFCONT ; CISH : CHARACTER STORED BY INTERRUPT \ -#DEFCONT ;\ -#DEFCONT \_CIST .DB 00 -#DEFCONT \_CICH .DB 00 -; -PIOIVT0:.MODULE PIOIVT0 -PIOMIVT(PIO0IN,PI0_IST,PRTTAB+0) -PIOIVT1:.MODULE PIOIVT1 -PIOMIVT(PIO1IN,PI1_IST,PRTTAB+1) -PIOIVT2:.MODULE PIOIVT2 -PIOMIVT(PIO2IN,PI2_IST,PRTTAB+2) -PIOIVT3:.MODULE PIOIVT3 -PIOMIVT(PIO3IN,PI3_IST,PRTTAB+3) -; -;----------------------------------------------------------------------------- -; -; OUTPUT INTERRUPT VECTOR MACRO AND DEFINITION FOR FOUR PORTS -; -; AN INTERRUPT IS GENERATED WHEN THE RECEIVING DEVICE CAN ACCEPT A CHARACTER -; -#DEFINE PIOMOVT(PIOOUT,PIOOST,PIOPRT) \ -#DEFCONT ;\ -#DEFCONT ; RETURN IF WE ARE WAITING FOR A \ -#DEFCONT ; CHARACTER (COST = 00) \ -#DEFCONT ;\ -#DEFCONT ; IF ZERO CHARACTERS READY -#DEFCONT ; (COST = 01) CHANGE STATUS TO \ -#DEFCONT ; WAITING FOR CHARACTER (COST 00) \ -#DEFCONT ;\ -#DEFCONT ; IF A CHARACTER IS READY THEN \ -#DEFCONT ; OUTPUT AND CHANGE STATUS TO \ -#DEFCONT ; ZERO CHARACTERS READY \ -#DEFCONT ;\ -#DEFCONT \ LD A,(_COST) -#DEFCONT \ DEC A -#DEFCONT \ RET M -#DEFCONT \ JR Z,_WFC -#DEFCONT \ LD A,(_COCH) -#DEFCONT \ LD E,A -#DEFCONT \_ONOW:LD A,(PIOPRT) -#DEFCONT \ LD C,A -#DEFCONT \ OUT (C),E -#DEFCONT \ LD A,1 -#DEFCONT \_WFC: LD (_COST),A -#DEFCONT \ RET -#DEFCONT ;\ -#DEFCONT ; WAIT FOR SPACE FOR THE CHARACTER\ -#DEFCONT ; IF WE ARE WAITING FOR A \ -#DEFCONT ; CHARACTRE THEN OUTPUT IT NOW \ -#DEFCONT ; OTHERWISE STORE IT UNTIL THE \ -#DEFCONT ; INTERRUPT CALLS FOR IT \ -#DEFCONT ;\ -#DEFCONT \PIOOUT:LD A,(_COST) -#DEFCONT \ CP 2 -#DEFCONT \ JR C,_ONOW -#DEFCONT \ LD A,E -#DEFCONT \ LD (_COCH),A -#DEFCONT \ LD A,2 -#DEFCONT \ LD (_COST),A -#DEFCONT \ JR PIOOUT -#DEFCONT ;\ -#DEFCONT ; RETURN WITH NUMBER OF \ -#DEFCONT ; CHARACTERS AVAILABLE 0 or 1 \ -#DEFCONT ;\ -#DEFCONT \PIOOST:LD A,(_COST) -#DEFCONT \ DEC A -#DEFCONT \ DEC A -#DEFCONT \ RET Z -#DEFCONT \ LD A,1 -#DEFCONT \ RET -#DEFCONT ;\ -#DEFCONT ; COST : 00 WAITING FOR CHARACTER\ -#DEFCONT ; 01 ZERO CHARACTERS READY\ -#DEFCONT ; 02 ONE CHARACTER READY \ -#DEFCONT ; COCH : CHARACTER TO OUTPUT \ -#DEFCONT ;\ -#DEFCONT \_COST .DB 01 -#DEFCONT \_COCH .DB 00 -; -PIOOVT0:.MODULE PIOOVT0 -PIOMOVT(PIO0OUT,PI0_OST,PRTTAB+0) -PIOOVT1:.MODULE PIOOVT1 -PIOMOVT(PIO1OUT,PI1_OST,PRTTAB+1) -PIOOVT2:.MODULE PIOOVT2 -PIOMOVT(PIO2OUT,PI2_OST,PRTTAB+2) -PIOOVT3:.MODULE PIOOVT3 -PIOMOVT(PIO3OUT,PI3_OST,PRTTAB+3) -; -;----------------------------------------------------------------------------- -; -; NON INTERRUPT OUTPUT ROUTINE - SHARED -; -; INPUT WILL ALWAYS RETURN ERROR, CHARACTER RETURNED IS UNDEFINED. -; OUTPUT WILL ALWAYS RETURN SUCCESS -; INPUT-STATUS WILL ALWAYS RETURN 0 CHARACTERS IN BUFFER. -; OUTPUT-STATUS WILL ALWAYS RETURN 1 CHARACTER SPACE IN BUFFER. - -PIOSHO_IN: - LD A,1 - RET ; -PIOSHO_OUT: - LD C,(IY+3) - OUT (C),E - XOR A +PIO_OUT: + XOR A ; SIGNAL SUCCESS RET ; -PIOSHO_IST: XOR A - RET ; -PIOSH_OST: - LD A,1 - RET ; -;----------------------------------------------------------------------------- +PIO_IST: + XOR A ; NO CHARS WAITING + RET ; -; NON INTERRUPT INPUT ROUTINE - SHARED ; -; INPUT WILL ALWAYS A CHARACTER AND SUCCESS. -; OUTPUT WILL ALWAYS RETURN FAILURE -; INPUT STATUS WILL ALWAYS RETURN 1 CHARACTER IN BUFFER. -;OUTPUT-STATUS WILL ALWAYS RETURN 0 CHARACTER SPACE IN BUFFER. ; -PIOSHI_IN: - LD C,(IY+3) - IN A,(C) - LD E,A - XOR A +PIO_OST: + XOR A ; NO BUFFER SPACE AVAIL RET ; -PIOSHI_OUT: - LD A,1 - RET +; NOTE THAT THERE ARE TWO ENTRY POINTS. INITDEV WILL DISABLE/ENABLE INTS +; AND INITDEVX WILL NOT. THIS IS DONE SO THAT THE PREINIT ROUTINE ABOVE +; CAN AVOID ENABLING/DISABLING INTS. ; -PIOSH_IST: - LD A,1 - RET +PIO_INITDEV: + HB_DI ; DISABLE INTS + CALL PIO_INITDEVX ; DO THE WORK + HB_EI ; INTS BACK ON + RET ; DONE ; -PIOSHI_OST: - XOR A +PIO_INITDEVX: +; +; THIS ENTRY POINT BYPASSES DISABLING/ENABLING INTS WHICH IS REQUIRED BY +; PREINIT ABOVE. PREINIT IS NOT ALLOWED TO ENABLE INTS! +; + LD C,(IY+3) ; CONTROL PORT + LD A,%00010111 ; CLEAR INTERRUPT CTL WORD + OUT (C),A + LD A,%11111111 ; CLEAR MASK + OUT (C),A + LD A,%00000000 ; CLEAR INTERRUPT VECTOR + OUT (C),A + LD A,%01001111 ; SET MODE 1 (INPUT) + OUT (C),A RET ; -;----------------------------------------------------------------------------- ; -; ON ENTRY IY POINTS TO THE DEVICE RECORD. GET AND RETURN THE CONFIGURATION WORD IN DE ; PIO_QUERY: -PPI_QUERY: - LD E,(IY+4) ; FIRST CONFIG BYTE TO E - LD D,(IY+5) ; SECOND CONFIG BYTE TO D + LD E,(IY+5) ; FIRST CONFIG BYTE TO E + LD D,(IY+6) ; SECOND CONFIG BYTE TO D XOR A ; SIGNAL SUCCESS - RET + RET ; DONE ; -;----------------------------------------------------------------------------- ; -; ON ENTRY IY POINTS TO THE DEVICE RECORD. FOR CHARACTER DEVICES BIT 6 OF ATTRIBUTE -; INDICATES PARALLEL PORT IF 1 SO WE SET IT. COMMON TO ALL PORTS ; PIO_DEVICE: -PPI_DEVICE: LD D,CIODEV_PIO ; D := DEVICE TYPE LD E,(IY) ; E := PHYSICAL UNIT - LD C,$40 ; C := ATTRIBUTE + LD C,$40 ; C := DEVICE TYPE, 0x40 IS PIO + LD H,(IY+1) ; H := MODE + LD L,(IY+3) ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; -INTMATRIX: - .DW PIO0IN, PIO0OUT, PI0_IST, PI0_OST - .DW PIO1IN, PIO1OUT, PI1_IST, PI1_OST - .DW PIO2IN, PIO2OUT, PI2_IST, PI2_OST - .DW PIO3IN, PIO3OUT, PI3_IST, PI3_OST -POLMATRIX: - .DW PIOSHO_IN, PIOSHO_OUT, PIOSHO_IST, PIOSH_OST ; OUTPUT - .DW PIOSHI_IN, PIOSHI_OUT, PIOSH_IST, PIOSHI_OST ; INPUT - .DW 0,0,0,0 ; BIDIR - .DW 0,0,0,0 ; BIT MODE - -SET_8255: - RET +; PIO CHIP PROBE +; CHECK FOR PRESENCE OF PIO CHIPS AND POPULATE THE +; PIO_MAP BITMAP (ONE BIT PER CHIP). THIS DETECTS +; CHIPS, NOT CHANNELS. EACH CHIP HAS 2 CHANNELS. +; MAX OF TWO CHIPS CURRENTLY. INT VEC VALUE IS TRASHED! +; +PIO_PROBE: + ; CLEAR THE PRESENCE BITMAP + LD HL,PIO_MAP ; HL POINTS TO BITMAP + XOR A ; ZERO + LD (PIO_MAP),A ; CLEAR CHIP PRESENT BITMAP +; + ; FIRST POSSIBLE CHIP + LD C,PIO0A_CTL ; FIRST CHIP CMD/STAT PORT + CALL PIO_PROBECHIP ; PROBE IT + JR NZ,PIO_PROBE1 ; IF NOT ZERO, NOT FOUND + SET 0,(HL) ; SET BIT FOR FIRST CARD +PIO_PROBE1: +; +#IF (PIOCNT >= 2) + LD C,PIO1A_CTL ; SECOND CHIP CMD/STAT PORT + CALL PIO_PROBECHIP ; PROBE IT + JR NZ,PIO_PROBE2 ; IF NOT ZERO, NOT FOUND + SET 1,(HL) ; SET BIT FOR SECOND CARD +PIO_PROBE2: +#ENDIF ; -SET_BYE: - XOR A ; SIGNAL SUCCESS RET ; -; ------------------------------------ -; i8255 FUNCTION TABLE ROUTINES -;------------------------------------- - -PPI_IN: - XOR A ; SIGNAL SUCCESS - RET -; -PPI_OUT: - XOR A ; SIGNAL SUCCESS - RET -; -PPI_IST: - RET -; -PPI_OST: +PIO_PROBECHIP: + ; PIO IS HARD TO DETECT DEFINITIVELY. BEST I CAN THINK + ; OF IS TO CHECK THE VALUE READ FROM THE CONTROL PORT. + ; IT APPEARS TO BE ZERO CONSISTENTLY IF CHIP EXISTS. + IN A,(C) ; GET VALUE + OR A ; COMPARE TO ZERO RET ; -; PIO_INITDEV - Configure device. -; If DE = FFFF then extract the configuratio information from the table of devices and program the device using those settings. -; Otherwise use the configuration information in DE to program those settings and save them in the device table - -PPI_INITDEV: - XOR A ; SIGNAL SUCCESS - RET -PPI_INT:OR $FF ; NZ SET TO INDICATE INT HANDLED - RET -; +; PIO DETECTION ROUTINE +; THERE IS ONLY ONE VARIATION OF PIO CHIP, SO HERE WE JUST CHECK THE +; CHIP PRESENCE BITMAP TO SET THE CHIP TYPE OF EITHER NONE OR PIO. +; +PIO_DETECT: + LD B,(IY+2) ; GET CHIP/CHANNEL + SRL B ; SHIFT AWAY THE CHANNEL BIT + INC B ; NUMBER OF TIMES TO ROTATE BITS + LD A,(PIO_MAP) ; BIT MAP IN A +PIO_DETECT1: + ; ROTATE DESIRED CHIP BIT INTO CF + RRA ; ROTATE NEXT BIT INTO CF + DJNZ PIO_DETECT1 ; DO THIS UNTIL WE HAVE DESIRED BIT + ; RETURN CHIP TYPE + LD A,PIO_NONE ; ASSUME NOTHING HERE + RET NC ; IF CF NOT SET, RETURN + LD A,PIO_PIO ; CHIP TYPE IS PIO + RET ; DONE +; +; +; PIO_PRTCFG: ; ANNOUNCE PORT CALL NEWLINE ; FORMATTING @@ -778,220 +258,90 @@ PIO_PRTCFG: PRTS(": IO=0x$") ; FORMATTING LD A,(IY+3) ; GET BASE PORT CALL PRTHEXBYTE ; PRINT BASE PORT -; + ; PRINT THE PIO TYPE CALL PC_SPACE ; FORMATTING LD A,(IY+1) ; GET PIO TYPE BYTE - LD DE,PIO_TYPE_STR ; POINT HL TO TYPE MAP TABLE - CALL PRTIDXDEA - - ; ALL DONE IF NO PIO WAS DETECTED - LD A,(IY+1) ; GET PIO TYPE BYTE - OR A ; SET FLAGS - RET Z ; IF ZERO, NOT PRESENT -; - PRTS(" MODE=$") ; FORMATTING - LD E,(IY+4) ; LOAD CONFIG - LD D,(IY+5) ; ... WORD TO DE - CALL PS_PRTPC0 ; PRINT CONFIG -; - LD A,(IY+4) ; PRINT - BIT 2,A ; ALLOCATED - JR Z,NOINT ; INTERRUPT - PRTS("/i$") - LD A,(IY+4) - AND 00000011B - CALL PRTDECB -NOINT: XOR A + RLCA ; MAKE IT A WORD OFFSET + LD HL,PIO_TYPE_MAP ; POINT HL TO TYPE MAP TABLE + CALL ADDHLA ; HL := ENTRY + LD E,(HL) ; DEREFERENCE + INC HL ; ... + LD D,(HL) ; ... TO GET STRING POINTER + CALL WRITESTR ; PRINT IT +; + XOR A RET ; -; WORKING VARIABLES ; -PIO_DEV .DB 0 ; DEVICE NUM USED DURING INIT -; -; DESCRIPTION OF DIFFERENT PORT TYPES -; -PIO_TYPE_STR: - .TEXT "$" ; IDX 0 - .TEXT "Zilog PIO$" ; IDX 1 - .TEXT "i8255 PPI$" ; IDX 2 - .TEXT "IO Port$" ; IDX 3 -; -; Z80 PIO PORT TABLE - EACH ENTRY IS FOR 1 CHIP I.E. TWO PORTS -; -; 32 BYTE DATA STRUCTURE FOR EACH PORT -; -; .DB 0 ; IY+0 CIO DEVICE NUMBER (SET DURING PRE-INIT, THEN FIXED) -; .DB 0 ; IY+1 PIO TYPE (SET AT ASSEMBLY, FIXED) -; .DB 0 ; IY+2 PIO CHANNEL (SET AT ASSEMBLY, FIXED) -; .DB PIOBASE+2 ; IY+3 BASE DATA PORT (SET AT ASSEMBLY, FIXED) -; .DB 0 ; IY+4 SPW - MODE 3 I/O DIRECTION BYTE (SET AT ASSEMBLE, SET WITH INIT) -; .DB 0 ; IY+5 SPW - MODE, INTERRUPT (SET AT ASSEMBLY, SET WITH INIT) -; .DW 0 ; IY+6/7 FUNCTION TABLE (SET AT ASSEMBLY, SET DURING PRE-INIT AND AT INIT) -; .DW PIO_IN ; IY+8 ADDR FOR DEVICE INPUT (SET WITH INIT) -; .DW PIO_OUT ; IY+10 ADDR FOR DEVICE OUTPUT (SET WITH INIT) -; .DW PIO_IST ; IY+12 ADDR FOR DEVICE INPUT STATUS (SET WITH INIT) -; .DW PIO_OST ; IY+14 ADDR FOR DEVICE OUTPUT STATUS (SET WITH INIT) -; .DW PIO_INITDEV ; IY+16 ADDR FOR INITIALIZE DEVICE ROUTINE (SET AT ASSEMBLY, FIXED) -; .DW PIO_QUERY ; IY+18 ADDR FOR QUERY DEVICE RECORD ROUTINE (SET AT ASSEMBLY, FIXED) -; .DW PIO_DEVICE ; IY+20 ADDR FOR DEVICE TYPE ROUTINE (SET AT ASSEMBLY, FIXED) -; .FILL 10 -; -; SETUP PARAMETER WORD: -; -; +-------------------------------+ +-------+-----------+---+-------+ -; | BIT CONTROL | | MODE | | A | INT | -; +-------------------------------+ --------------------+-----------+ -; F E D C B A 9 8 7 6 5 4 3 2 1 0 -; -- MSB (D REGISTER) -- -- LSB (E REGISTER) -- -; -; -; MSB = BIT CONTROL MAP USE IN MODE 3 -; -; MODE B7 B6 = 00 Mode 0 Output -; 01 Mode 1 Input -; 10 Mode 2 Bidir -; 11 Mode 3 Bit Mode -; -; INTERRUPT ALLOCATED B2 = 0 NOT ALLOCATED -; = 1 IS ALLOCATED -; -; WHICH IVT IS ALLOCATES B1 B0 00 IVT_PIO0 -; 01 IVT_PIO1 -; 10 IVT_PIO2 -; 11 IVT_PIO3 -; -#DEFINE DEFPIO(MPIOBASE,MPIOCH0,MPIOCH1,MPIOCH0X,MPIOCH1X,MPIOIN0,MPIOIN1) \ -#DEFCONT \ .DB 0 -#DEFCONT \ .DB PIO_ZPIO -#DEFCONT \ .DB 0 -#DEFCONT \ .DB MPIOBASE -#DEFCONT \ .DB (MPIOCH0|MPIOIN0) -#DEFCONT \ .DB MPIOCH0X -#DEFCONT \ .DW 0 -#DEFCONT \ .DW 0,0,0,0, PIO_INITDEV,PIO_QUERY,PIO_DEVICE -#DEFCONT \ .FILL 2 -#DEFCONT \ .DB 0 -#DEFCONT \ .DB PIO_ZPIO -#DEFCONT \ .DB 1 -#DEFCONT \ .DB MPIOBASE+1 -#DEFCONT \ .DB (MPIOCH1|MPIOIN1) -#DEFCONT \ .DB MPIOCH1X -#DEFCONT \ .DW 0 -#DEFCONT \ .DW 0,0,0,0, PIO_INITDEV,PIO_QUERY,PIO_DEVICE -#DEFCONT \ .FILL 2 -; -; i8255 PORT TABLE - EACH ENTRY IS FOR 1 CHIP I.E. THREE PORTS -; -#DEFINE DEFPPI(MPPIBASE,MPPICH1,MPPICH2,MPPICH3,MPPICH1X,MPPICH2X,MPPICH3X) \ -#DEFCONT \ .DB 0 -#DEFCONT \ .DB PIO_8255 -#DEFCONT \ .DB 0 -#DEFCONT \ .DB MPPIBASE -#DEFCONT \ .DB (MPPICH1|00001000B) -#DEFCONT \ .DB MPPICH1X -#DEFCONT \ .DW 0 -#DEFCONT \ .DW PPI_IN,PPI_OUT,PPI_IST,PPI_OST,PPI_INITDEV,PPI_QUERY,PPI_DEVICE -#DEFCONT \ .FILL 2 -#DEFCONT \ .DB 0 -#DEFCONT \ .DB PIO_8255 -#DEFCONT \ .DB 1 -#DEFCONT \ .DB MPPIBASE+2 -#DEFCONT \ .DB (MPPICH2|00010000B) -#DEFCONT \ .DB MPPICH2X -#DEFCONT \ .DW 0 -#DEFCONT \ .DW PPI_IN,PPI_OUT,PPI_IST,PPI_OST,PPI_INITDEV,PPI_QUERY,PPI_DEVICE -#DEFCONT \ .FILL 2 -#DEFCONT \ .DB 0 -#DEFCONT \ .DB PIO_8255 -#DEFCONT \ .DB 2 -#DEFCONT \ .DB MPPIBASE+4 -#DEFCONT \ .DB (MPPICH3|00100000B) -#DEFCONT \ .DB MPPICH3X -#DEFCONT \ .DW 0 -#DEFCONT \ .DW PPI_IN,PPI_OUT,PPI_IST,PPI_OST,PPI_INITDEV,PPI_QUERY,PPI_DEVICE -#DEFCONT \ .FILL 2 -; -; HERE WE ACTUALLY DEFINE THE HARDWARE THAT THE HBIOS CAN ACCESS -; THE INIT ROUTINES READ AND SET THE INITIAL MODES FROM THIS INFO ; -PIO_CFG: -; -#IF PIO_4P -DEFPIO(PIO4BASE+0,M_Output,M_Input,M_BitAllOut,M_BitAllOut,INT_N,INT_N) -DEFPIO(PIO4BASE+4,M_Input,M_Input,M_BitAllOut,M_BitAllOut,INT_N,INT_N) -DEFPIO(PIO4BASE+8,M_Output,M_Output,M_BitAllOut,M_BitAllOut,INT_N,INT_N) -DEFPIO(PIO4BASE+12,M_Output,M_Output,M_BitAllOut,M_Output,INT_N,INT_N) -#ENDIF -#IF PIO_ZP -DEFPIO(PIOZBASE+0,M_Input,M_Input,M_BitAllOut,M_BitAllOut,INT_N,INT_N) -DEFPIO(PIOZBASE+4,M_Output,M_Output,M_BitAllOut,M_BitAllOut,INT_N,INT_N) -#ENDIF -; PPI_SBC & (PLATFORM == PLT_SBC) & (PPIDEMODE != PPIDEMODE_SBC)) +PIO_TYPE_MAP: + .DW PIO_STR_NONE + .DW PIO_STR_PIO -#IF PPI_SBC -DEFPPI(PPIBASE,M_Output,M_Output,M_Output,M_BitAllOut,M_BitAllOut,M_BitAllOut) -#ENDIF +PIO_STR_NONE .DB "$" +PIO_STR_PIO .DB "PIO$" ; -PIO_CNT .EQU ($ - PIO_CFG) / CFG_SIZ +; WORKING VARIABLES ; -;------------------------------------------------------------------- -; WHEN WE GET HERE IY POINTS TO THE PIO_CFG TABLE WE ARE WORKING ON. -; C IS THE UNIT NUMBER -;------------------------------------------------------------------- +PIO_DEV .DB 0 ; DEVICE NUM USED DURING INIT +PIO_MAP .DB 0 ; CHIP PRESENCE BITMAP ; -;PIO_INITUNIT: -; LD A,C ; SET THE UNIT NUMBER -; LD (IY),A +PIO0A_RCVBUF .EQU 0 +PIO0B_RCVBUF .EQU 0 ; -; LD DE,-1 ; LEAVE CONFIG ALONE -; CALL PIO_INITDEV ; IMPLEMENT IT AND RETURN -; XOR A ; SIGNAL SUCCESS -; RET ; AND RETURN +#IF (PIOCNT >= 2) +PIO1A_RCVBUF .EQU 0 +PIO1B_RCVBUF .EQU 0 +#ENDIF ; -PIO_INIT: -; CALL SPK_BEEP - LD B,PIO_CNT ; COUNT OF POSSIBLE PIO UNITS - LD C,0 ; INDEX INTO PIO CONFIG TABLE -PIO_INIT1: - PUSH BC ; SAVE LOOP CONTROL - -; LD A,C ; PHYSICAL UNIT TO A -; RLCA ; MULTIPLY BY CFG TABLE ENTRY SIZE (32 BYTES) -; RLCA ; ... -; RLCA ; ... TO GET OFFSET INTO CFG TABLE -; RLCA -;; RLCA -; LD HL,PIO_CFG ; POINT TO START OF CFG TABLE -; PUSH AF -; CALL ADDHLA ; HL := ENTRY ADDRESS -; POP AF -; CALL ADDHLA ; HL := ENTRY ADDRESS -; PUSH HL ; COPY CFG DATA PTR -; POP IY ; ... TO IY -; POP IY ; ... TO IY - - CALL IDXCFG - - LD A,(IY+1) ; GET PIO TYPE - OR A ; SET FLAGS - CALL NZ,PIO_PRTCFG ; PRINT IF NOT ZERO - -; PUSH DE -; LD DE,$FFFF ; INITIALIZE DEVICE/CHANNEL -; CALL PIO_INITDEV ; BASED ON DPW -; POP DE - - POP BC ; RESTORE LOOP CONTROL - INC C ; NEXT UNIT - DJNZ PIO_INIT1 ; LOOP TILL DONE +; PIO PORT TABLE ; - XOR A ; SIGNAL SUCCESS - RET ; DONE +PIO_CFG: + ; PIO0 CHANNEL A +PIO0A_CFG: + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; PIO TYPE (SET DURING INIT) + .DB $00 ; CHIP 0 / CHANNEL A (LOW BIT IS CHANNEL) + .DB PIO0A_CTL ; CMD/STATUS PORT + .DB PIO0A_DAT ; DATA PORT + .DW DEFSERCFG ; LINE CONFIGURATION + .DW PIO0A_RCVBUF ; POINTER TO RCV BUFFER STRUCT +; +PIO_CFGSIZ .EQU $ - PIO_CFG ; SIZE OF ONE CFG TABLE ENTRY +; + ; PIO0 CHANNEL B +PIO0B_CFG: + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; PIO TYPE (SET DURING INIT) + .DB $01 ; CHIP 0 / CHANNEL B (LOW BIT IS CHANNEL) + .DB PIO0B_CTL ; CMD/STATUS PORT + .DB PIO0B_DAT ; DATA PORT + .DW DEFSERCFG ; LINE CONFIGURATION + .DW PIO0B_RCVBUF ; POINTER TO RCV BUFFER STRUCT +; +#IF (PIOCNT >= 2) +; + ; PIO1 CHANNEL A +PIO1A_CFG: + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; PIO TYPE (SET DURING INIT) + .DB $02 ; CHIP 1 / CHANNEL A (LOW BIT IS CHANNEL) + .DB PIO1A_CTL ; CMD/STATUS PORT + .DB PIO1A_DAT ; DATA PORT + .DW DEFSERCFG ; LINE CONFIGURATION + .DW PIO1A_RCVBUF ; POINTER TO RCV BUFFER STRUCT +; + ; PIO1 CHANNEL B +PIO1B_CFG: + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; PIO TYPE (SET DURING INIT) + .DB $03 ; CHIP 1 / CHANNEL B (LOW BIT IS CHANNEL) + .DB PIO1B_CTL ; CMD/STATUS PORT + .DB PIO1B_DAT ; DATA PORT + .DW DEFSERCFG ; LINE CONFIGURATION + .DW PIO1B_RCVBUF ; POINTER TO RCV BUFFER STRUCT ; -SET_PORT: - ; DEVICE TYPE IS I/O PORT SO JUST WRITE $00 TO IT - LD C,(IY+3) - OUT (C),A - XOR A - RET +#ENDIF +; +PIO_CFGCNT .EQU ($ - PIO_CFG) / PIO_CFGSIZ diff --git a/Source/HBIOS/pio_ps.asm b/Source/HBIOS/pio_ps.asm new file mode 100644 index 00000000..d0c9f7ff --- /dev/null +++ b/Source/HBIOS/pio_ps.asm @@ -0,0 +1,999 @@ +; PIO driver sets up the parallel port as a subtype of Serial/Char device. +; +; +; HBIOS initializes driver by: +; +; 1) Calling Pre-initialization +; +; This involves setting up all the data structures describing the devices. +; If possible, do a hardware test to verify it is available for adding to available devices. +; +; 2) Calling device initialization. +; +; Hardware initialization. +; Configure to initial state or to a new state. +; +; Implementation limitations: +; +; The fully functionality of the Z80 PIO can only be realized by using Z80 interrupt mode 2. +; Registers cannot be interrogated for interrupts status and the originating interrupt +; device cannot be determine. +; +; Full implementation of IM2 functionality for an ECB-ZP and ECB-4P board would require the +; allocation of an interrupt handler for each chip channel. Thus, 12 interrupt handlers +; would be required to support this configuration. As the HBIOS only has an allocation of +; 16, a full implmentation is impractical. +; +; The compromise solution is to allow 4 interrupts for the PIO driver. All remaining PIO's +; are limited to Bit mode or blind read and write to the input/output ports. +; +; Zilog PIO reset state: +; +; Both port mask registers are reset to inhibit All port data bits. +; Port data bus lines are set to a high-impedance state and the Ready "handshake" +; Mode 1 (output) is automatically selected. +; The vector address registers are not reset. +; Both port interrupt enable flip-flops are reset. +; Both port output registers are reset. +; +; Register addressing example for ECB-ZP and ECB-4P assuming base address 90h and 88h respectively. +; +; PIO ----ZP---- ----4P---- +; 0 DATA 0 90h DATA 0 B8h +; 0 DATA 1 91h DATA 1 B9h +; 0 CMD 0 92h CMD 0 BAh +; 0 CMD 1 93h CMD 1 BBh +; 1 DATA 0 94h DATA 0 BCh +; 1 DATA 1 95h DATA 1 BDh +; 1 CMD 0 96h CMD 0 BEh +; 1 CMD 1 97h CMD 1 BFh +; 2 DATA 0 C0h +; 2 DATA 1 C1h +; 2 CMD 0 C2h +; 2 CMD 1 C3h +; 3 DATA 0 C4h +; 3 DATA 1 C5h +; 3 CMD 0 C6h +; 3 CMD 1 C7h +; +PIODEBUG .EQU 1 +; +M_Output .EQU $00 << 6 +M_Input .EQU $01 << 6 +M_Bidir .EQU $02 << 6 +M_BitCtrl .EQU $03 << 6 +M_BitAllIn .EQU $FF +M_BitAllOut .EQU $00 +; +PIO_NONE .EQU 0 +PIO_ZPIO .EQU 1 +PIO_8255 .EQU 2 +PIO_PORT .EQU 3 + +; SET MAXIMUM NUMBER OF INTERRUPTS AVAILABLE FOR ALL +; ENSURE INTERRUPTS ARE NOT TURNED ON IF IM2 IS NOT SET. + +INT_ALLOC .DB 0 +INT_N .EQU 00000000B +#IF (INTMODE == 2) +INT_Y .EQU 00000100B +INT_ALLOW .EQU 4 +#ELSE +INT_Y .EQU INT_N +INT_ALLOW .EQU 0 +#ENDIF +; +INT0 .EQU 00000000B +INT1 .EQU 00000001B +INT2 .EQU 00000010B +INT3 .EQU 00000011B + +; +; SETUP THE DISPATCH TABLE ENTRIES +; +; PIO_CNT HOLDS THE NUMBER OF DEVICED CALCULATED FROM THE NUMBER OF DEFPIO MACROS +; PIO_CNT SHOULD INCREASE BY 2 FOR EVERY PIO CHIP ADDED. +; +; PIO_PREINIT WILL READ THROUGH ALL PIOCFG TABLES AND CONFIGURE EACH TABLE. +; IT WITH THEN CALL PIO_INITUNIT TO INITIALIZE EACH DEVICE TO ITS DEFAULT STATE +; +; EXPECTS NOTHING ON ENTRY +; +PIO_PREINIT: + CALL NEWLINE ;D + LD B,PIO_CNT ; LOOP CONTROL + LD C,0 ; PHYSICAL UNIT INDEX + XOR A ; ZERO TO ACCUM +; LD (PIO_DEV),A ; CURRENT DEVICE NUMBER + LD (INT_ALLOC),A ; START WITH NO INTERRUPTS ALLOCATED +PIO_PREINIT0: + PUSH BC ; SAVE LOOP CONTROL +; LD A,C ; INITIALIZE THE UNIT + +; PUSH AF ;D +; LD A,'u' ;D +; CALL COUT ;D +; POP AF ;D +; CALL PRTHEXBYTE ;D UNIT +; CALL PC_SPACE ;D + +; RLCA ; MULTIPLY BY CFG TABLE ENTRY SIZE (32 BYTES) +; RLCA ; ... +; RLCA ; ... TO GET OFFSET INTO CFG TABLE +; RLCA +;; RLCA +; LD HL,PIO_CFG ; POINT TO START OF CFG TABLE +; PUSH AF +; CALL ADDHLA ; HL := ENTRY ADDRESS +; POP AF +; CALL ADDHLA ; HL := ENTRY ADDRESS +; PUSH HL ; SAVE IT +; POP IY ; ... TO IY + + CALL IDXCFG + + LD (HL),C + + PUSH AF ;D + LD A,'c' ;D + CALL COUT ;D + POP AF ;D + PUSH BC ;D + PUSH HL ;D + POP BC ;D + CALL PRTHEXWORD ;D CONFIG TABLE + CALL PC_SPACE ;D + POP BC ;D + + LD A,(IY+1) ; GET THE PIO TYPE DETECTED + CP PIO_PORT ; SET FLAGS + + PUSH AF ;D + LD A,'t' ;D + CALL COUT ;D + POP AF ;D + CALL PRTHEXBYTE ;D TYPE + CALL PC_SPACE ;D + +; JR Z,BADINIT + +; PUSH BC ; SAVE LOOP CONTROL +; LD BC,PIO_FNTBL ; BC := FUNCTION TABLE ADDRESS +; DEC A +; JR Z,TYPFND ; SKIP IT IF NOTHING FOUND +; LD BC,PPI_FNTBL ; BC := FUNCTION TABLE ADDRESS +; DEC A +; JR Z,TYPFND ; ADD ENTRY IF PIO FOUND, BC:DE +; LD BC,PRT_FNTBL +; DEC A +; JR Z,TYPFND +; POP BC +; JR BADINIT + + PUSH HL + LD DE,-1 ; INITIALIZE THIS DEVICE WITH + CALL PIO_INITDEV ; DEFAULT VALUES + POP HL + +; JR NZ,SKPINIT + + ; AT THIS POINT WE KNOW WE + ; HAVE A VALID DEVICE SO ADD IT + + LD A,8 ; CALCULATE THE FUNCTION TABLE + CALL ADDHLA ; POSITION WHICH FOLLOWS THE + PUSH HL ; CONFIGURATION TABLE OF EACH + POP BC ; DEVICE + +TYPFND: PUSH AF ;D + LD A,'f' ;D + CALL COUT ;D + POP AF ;D + PUSH BC ;D + CALL PRTHEXWORD ;D FUNCTION TABLE + POP BC ;D + CALL NEWLINE ;D + + PUSH IY ; ADD ENTRY IF PIO FOUND, BC:DE + POP DE ; BC: DRIVER FUNCTION TABLE + CALL CIO_ADDENT ; DE: ADDRESS OF UNIT INSTANCE DATA + +BADINIT:POP BC ; RESTORE LOOP CONTROL + + INC C ; NEXT PHYSICAL UNIT +SKPINIT:DJNZ PIO_PREINIT0 ; LOOP UNTIL DONE + + PUSH AF ;D + PRTS("INTS=$") ;D + LD A,(INT_ALLOC) ;D + CALL PRTHEXBYTE ;D + POP AF ;D + PUSH DE ;D + LD DE,CIO_TBL-3 ;D + CALL DUMP_BUFFER ;D + POP DE ;D + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; +; INDEX INTO THE CONFIG TABLE +; ON ENTRY C = UNIT NUMBER +; ON EXIT IY = CONFIG DATA POINTER +; ON EXIT DE = CONFIG TABLE START +; +; EACH CONFIG TABLE IS 24 BYTES LONG +; +CFG_SIZ .EQU 24 +; +IDXCFG: LD A,C + RLCA ; X 2 + RLCA ; X 4 + RLCA ; X 8 + LD H,0 + LD L,A ; HL = X 8 + PUSH HL + ADD HL,HL ; HL = X 16 + POP DE + ADD HL,DE ; HL = X 24 + LD DE,PIO_CFG + ADD HL,DE + PUSH HL ; COPY CFG DATA PTR + POP IY ; ... TO IY + RET + +; PIO_INITDEV - INITIALIZE DEVICE +; +; IF DE = FFFF THEN THE SETUP PARAMETER WORD WILL BE READ FROM THE DEVICE CONFIGURATION +; TABLE POINTED TO BY IY AND THE PIO PORT WILL BE PROGRAMMED BASED ON THAT CONFIGURATION. +; +; OTHERWISE THE PIO PORT WILL BE PROGRAMMED BY THE SETUP PARAMETER WORD IN DE AND THIS +; WILL BE SAVED IN THE DEVICE CONFIGURATION TABLE POINTED TO BY IY. +; +; ALL OTHER CONFIGURATION OF THE DEVICE CONFIGURATION TABLE IS DONE UPSTEAM BY PIO_PREINIT + +PIO_INITDEV: + ; TEST FOR -1 (FFFF) WHICH MEANS USE CURRENT CONFIG (JUST REINIT) + LD A,D ; TEST DE FOR + AND E ; ... VALUE OF -1 + INC A ; ... SO Z SET IF -1 + JR NZ,PIO_INITDEV1 ; IF DE == -1, REINIT CURRENT CONFIG +PIO_INITDEV0: + ; LOAD EXISTING CONFIG (DCW) TO REINIT + LD E,(IY+4) ; LOW BYTE + LD D,(IY+5) ; HIGH BYTE +; +PIO_INITDEV1: ; WHICH DEVICE TYPE? + LD A,(IY+1) + CP PIO_ZPIO + JR Z,SETPIO0 + CP PIO_8255 + JP Z,SET_8255 + CP PIO_PORT + JP Z,SET_PORT +BAD_SET:OR $FF ; UNKNOWN DEVICE + RET + +SETPIO0:LD A,E ; GET MODE + AND 11000000B ; BITS (B7B6) + CP 10000000B ; IS IT BIDIR? + JR NZ,SETPIO1 + LD A,(IY+2) ; GET CHANNEL + OR A + JR NZ,BAD_SET ; CAN'T DO ON CH1 + + ; VALIDATE INTERRUPT REQUEST + ; GRANT INTERRUPT IF THERE IS A FREE INTERRUPT + ; GRANT INTERRUPT IF AN INTERRUPT IS ALREADY ALLOCATED TO THIS UNIT + +SETPIO1:PUSH AF ;D + LD A,'[' ;D + CALL COUT ;D + LD A,(IY) ;D + CALL PRTHEXBYTE ;D + LD A,']' ;D + CALL COUT ;D + POP AF ;D + + BIT 2,E ; SKIP IF WE ARE NOT REQUESTING + JP Z,SETPIO2 ; AN INTERRUPT + + PRTS("[INTREQ]$") ;D + +; LD A,(IY+4) ; GET CURRENT INTERRUPT SETTING +; BIT 2,A ; SKIP IF IT IS ALREADY +; JP NZ,SETPIO2 ; ALLOCATED TO THIS UNIT + + LD A,(INT_ALLOC) ; WE NEED TO ALLOCATE AN + CP INT_ALLOW ; INTERRUPT. DO WE HAVE + JR NC,BAD_SET ; ONE FREE? + + PRTS("[ALLOCINT]$") ;D + + ; WHICH INTERRUPT IS FREE ? + ; SCAN THROUGH THE CFG TABLES + ; AND FIND A FREE ONE + + PUSH AF ; NESTED LOOP + LD DE,CFG_SIZ ; OUTSIDE LOOP IS INTERRUPT + LD B,INT_ALLOW ; INSIDE LOOP IS DEVICE +SETPIOP: LD C,B + DEC C + PUSH BC + LD B,PIO_CNT + LD HL,PIO_CFG+4 +SETPIOX: LD A,(HL) + BIT 2,A ; JUMP TO NEXT DEVICE + JR Z,SETPIOY ; IF NO INTERRUPT ON + AND 00000011B ; THIS DEVICE + + CP C ; IF WE MATCH AN INTERRUPT HERE THEN IT IS NOT FREE. + JR NZ,SETPIOY ; SO EXIT INSIDE LOOP AND TRY NEXT INTERRUPT + + XOR A ; WE MATCH INT 0 - IF WE ARE CHECKING FOR IT THEN + OR C ; WE REGARD IS AS FREE. + JR NZ,SETPIOZ + +SETPIOY: ADD HL,DE + DJNZ SETPIOX + + JR SETPIOQ ; WE GET HERE IF THE CURRENT INTERRUPT + ; WAS NOT MATCHED SO IT IS FREE +SETPIOZ: POP BC + DJNZ SETPIOP + POP AF + + PRTS("[NONEFREE]$") + RET + +SETPIOQ:PUSH AF ; AVAILABLE INTERRUPT IS IN C + PRTS("[FREE]=$") + LD A,C + CALL PRTHEXBYTE + POP AF + + POP AF + POP AF + +SETPIOR:LD HL,INT_ALLOC ; INCREASE THE COUNT + INC (HL) ; OF USED INTERRUPTS + LD A,(HL) + +; LD A,(IY) ; IS THIS UNIT +; INC A ; UNITIALIZED? +; JR Z,SETPIO6 + + LD A,(IY+4) ; IT IS UNITIALIZED SO + OR C ; SAVE THE ALLOCATES + LD (IY+4),A ; INTERRUPT +; +; FOR THIS DEVICE AND INTERRUPT, UPDATE THE CONFIG TABLE FOR THIS DEVICE. +; PIO_IN, PIO_OUT, PIO_IST, PIO_OST ENTRIES NEED TO BE REDIRECTED. +; INTERRUPT VECTOR NEEDS TO BE UPDATED +; + LD A,(IY+0) + LD HL,0 + ; SETUP PIO INTERRUPT VECTOR IN IVT + LD HL,HBX_IV09+1 + +; CALL SPK_BEEP +; +SETPIO6:RET + + ; EXIT WITH FREE INTERRUPT IN C + + LD A,C + LD (INT_ALLOC),A + + LD A,E + AND 11000000B + OR 00000100B + OR C + LD E,A + LD (IY+5),A +; + ; TODO: DEALLOCATE AN INTERRUPT +; +; LD A,(INT_ALLOC) +; DEC A +; LD (INT_ALLOC),A +; +SETPIO2: + +; DE CONTAINS THE MODE IF INTERRUPT ROUTINE SKIPPED + + PRTS("[NOINTREQ]$") ;D + +; LD A,(IY+4) + LD A,E ; GET MODE AND CREATE COMMAND + AND 11000000B ; $B0 + OR 00001111B ; $0F + + LD C,(IY+3) ; GET DATA PORT + INC C ; POINT TO CMD + INC C ; PORT + OUT (C),A ; SET MODE + CP (M_BitCtrl | $0F) ; IF MODE 3 + JR NZ,SETPIO3 + LD A,(IY+5) ; SET I/O DIRECTION + OUT (C),A ; FOR MODE 3 + +SETPIO3:; INTERUPT HANDLING + + JP SETPIO4 + + ; SETUP THE INTERRUPT VECTOR + + LD A,E + AND 00000011B +; DEC A ; INDEX INTO THE + ADD A,A ; THE VECTOR TABLE + ADD A,A ; + LD C,A + LD B,0 + LD HL,HBX_IV09+1 + ADD HL,BC ; GET THE ADDRESS OF + PUSH DE + LD D,(HL) ; THAT INTERRUPT + INC HL ; HANDLER + LD E,(HL) + LD HL,0 ;HBX_IVT+IVT_PIO0 ; POPULATE THE + LD A,L ; GET LOW BYTE OF IVT ADDRESS + ADD HL,BC ; INTERRUPT TABLE + LD (HL),D ; WITH THE INTERRUPT + INC HL ; HANDLER ADDRESS FOR + LD (HL),E ; THIS UNIT + POP DE + LD HL,INT_ALLOC + LD C,(HL) + LD B,0 + LD HL,PRTTAB-1 ; SAVE THE DATA + ADD HL,BC ; PORT FOR EACH INTERRUPT + LD C,(IY+3) + LD (HL),C + + INC C ; POINT TO CMD PORT + INC C + DI ; SET THE VECTOR ADDRESS + OUT (C),A + +; LD A,10000011B ; ENABLE INTERRUPTS ON + OUT (C),A ; THIS UNIT + EI +; JR GUD_SET +; +SETPIO4:LD A,00000111B ; $07 + OUT (C),A ; NO INTERRUPTS +; +; SUCCESSFULL SO SAVE DEVICE CONFIGURATION WORD (DCW) +; +GUD_SET:LD (IY+4),E ; LOW BYTE + LD (IY+5),D ; HIGH BYTE +; +; UPDATE THE DEVICE TABLE WITH THE ADDRESSES FOR THE CORRECT ROUTINE. +; + LD A,E + AND 00000111B + LD HL,INTMATRIX ; POINT TO EITHER THE INTERRUPT + JR NZ, USEIM + LD HL,POLMATRIX ; MATRIX OR THE POLLED MATRIX +USEIM: PUSH HL + + PUSH IY ; CALCULATE THE DESTINATION + POP HL ; ADDRESS IN THE PIO_CFG TABLE + LD BC,8 ; FOR THE FOUR ADDESSES TO BE + ADD HL,BC ; COPIED TO + +; LD B,0 ; 00000000 CALCULATE THE SOURCE ADDRESS + LD C,E ; XX?????? FROM THE MATRIX. EACH ENTRY + SRL C ; 0XX????? IN THE MATRIX IS 8 BYTES SO + SRL C ; 00XX???? SOURCE = MATRIX BASE + (8 * MODE) + SRL C ; 000XX??? + POP DE ; LOAD THE MATRIX BASE +; LD DE,POLMATRIX + EX DE,HL + ADD HL,BC ; HL = SOURCE + + LD C,8 ; COPY 8 BYTES + LDIR + +; PUSH IY +; POP DE +; CALL DUMP_BUFFER + + XOR A + RET + +PRTTAB: .DB 0 + .DB 0 + .DB 0 + .DB 0 +; +;----------------------------------------------------------------------------- +; +; INPUT INTERRUPT VECTOR MACRO AND DEFINITION FOR FOUR PORTS +; +#DEFINE PIOMIVT(PIOIN,PIOIST,PIOPRT) \ +#DEFCONT ;\ +#DEFCONT ; RETURN WITH ERROR IF THERE IS \ +#DEFCONT ; ALREADY A CHARACTER IN BUFFER \ +#DEFCONT ;\ +#DEFCONT ; OTHERWISE CHANGE THE STATUS TO \ +#DEFCONT ; SHOW THERE IS ONE CHARACTER IN \ +#DEFCONT ; THE BUFFER AND READ IT IN AND \ +#DEFCONT ; AND STORE IT.RETURN GOOD STATUS.\ +#DEFCONT ;\ +#DEFCONT \ LD A,(_CIST) +#DEFCONT \ OR A +#DEFCONT \ JR NZ,_OVFL +#DEFCONT \ LD A,(PIOPRT) +#DEFCONT \ LD C,A +#DEFCONT \ LD A,1 +#DEFCONT \ LD (_CIST),A +#DEFCONT \ IN A,(C) +#DEFCONT \ LD (_CICH),A +#DEFCONT \ OR $FF +#DEFCONT \ RET +#DEFCONT \_OVFL:XOR A +#DEFCONT \ RET +#DEFCONT ;\ +#DEFCONT ;\ +#DEFCONT ;\ +#DEFCONT ;\ +#DEFCONT ;\ +#DEFCONT ;\ +#DEFCONT \PIOIN:CALL PIOIST +#DEFCONT \ JR Z,PIOIN +#DEFCONT \ LD A,(_CICH) +#DEFCONT \ LD E,A +#DEFCONT \ XOR A +#DEFCONT \ LD (_CIST),A +#DEFCONT \ RET +#DEFCONT ;\ +#DEFCONT ; If THERE A CHARACTER \ +#DEFCONT ; AVAILABLE? RETURN NUMBER \ +#DEFCONT ; IN A - 0 OR 1 \ +#DEFCONT ;\ +#DEFCONT \PIOIST:LD A,(_CIST) +#DEFCONT \ AND 00000001B +#DEFCONT \ RET +#DEFCONT ;\ +#DEFCONT ; CIST : 01 = CHARACTER READY ELSE NOT READY \ +#DEFCONT ; CISH : CHARACTER STORED BY INTERRUPT \ +#DEFCONT ;\ +#DEFCONT \_CIST .DB 00 +#DEFCONT \_CICH .DB 00 +; +PIOIVT0:.MODULE PIOIVT0 +PIOMIVT(PIO0IN,PI0_IST,PRTTAB+0) +PIOIVT1:.MODULE PIOIVT1 +PIOMIVT(PIO1IN,PI1_IST,PRTTAB+1) +PIOIVT2:.MODULE PIOIVT2 +PIOMIVT(PIO2IN,PI2_IST,PRTTAB+2) +PIOIVT3:.MODULE PIOIVT3 +PIOMIVT(PIO3IN,PI3_IST,PRTTAB+3) +; +;----------------------------------------------------------------------------- +; +; OUTPUT INTERRUPT VECTOR MACRO AND DEFINITION FOR FOUR PORTS +; +; AN INTERRUPT IS GENERATED WHEN THE RECEIVING DEVICE CAN ACCEPT A CHARACTER +; +#DEFINE PIOMOVT(PIOOUT,PIOOST,PIOPRT) \ +#DEFCONT ;\ +#DEFCONT ; RETURN IF WE ARE WAITING FOR A \ +#DEFCONT ; CHARACTER (COST = 00) \ +#DEFCONT ;\ +#DEFCONT ; IF ZERO CHARACTERS READY +#DEFCONT ; (COST = 01) CHANGE STATUS TO \ +#DEFCONT ; WAITING FOR CHARACTER (COST 00) \ +#DEFCONT ;\ +#DEFCONT ; IF A CHARACTER IS READY THEN \ +#DEFCONT ; OUTPUT AND CHANGE STATUS TO \ +#DEFCONT ; ZERO CHARACTERS READY \ +#DEFCONT ;\ +#DEFCONT \ LD A,(_COST) +#DEFCONT \ DEC A +#DEFCONT \ RET M +#DEFCONT \ JR Z,_WFC +#DEFCONT \ LD A,(_COCH) +#DEFCONT \ LD E,A +#DEFCONT \_ONOW:LD A,(PIOPRT) +#DEFCONT \ LD C,A +#DEFCONT \ OUT (C),E +#DEFCONT \ LD A,1 +#DEFCONT \_WFC: LD (_COST),A +#DEFCONT \ RET +#DEFCONT ;\ +#DEFCONT ; WAIT FOR SPACE FOR THE CHARACTER\ +#DEFCONT ; IF WE ARE WAITING FOR A \ +#DEFCONT ; CHARACTER THEN OUTPUT IT NOW \ +#DEFCONT ; OTHERWISE STORE IT UNTIL THE \ +#DEFCONT ; INTERRUPT CALLS FOR IT \ +#DEFCONT ;\ +#DEFCONT \PIOOUT:LD A,(_COST) +#DEFCONT \ CP 2 +#DEFCONT \ JR C,_ONOW +#DEFCONT \ LD A,E +#DEFCONT \ LD (_COCH),A +#DEFCONT \ LD A,2 +#DEFCONT \ LD (_COST),A +#DEFCONT \ JR PIOOUT +#DEFCONT ;\ +#DEFCONT ; RETURN WITH NUMBER OF \ +#DEFCONT ; CHARACTERS AVAILABLE 0 or 1 \ +#DEFCONT ;\ +#DEFCONT \PIOOST:LD A,(_COST) +#DEFCONT \ DEC A +#DEFCONT \ DEC A +#DEFCONT \ RET Z +#DEFCONT \ LD A,1 +#DEFCONT \ RET +#DEFCONT ;\ +#DEFCONT ; COST : 00 WAITING FOR CHARACTER\ +#DEFCONT ; 01 ZERO CHARACTERS READY\ +#DEFCONT ; 02 ONE CHARACTER READY \ +#DEFCONT ; COCH : CHARACTER TO OUTPUT \ +#DEFCONT ;\ +#DEFCONT \_COST .DB 01 +#DEFCONT \_COCH .DB 00 +; +PIOOVT0:.MODULE PIOOVT0 +PIOMOVT(PIO0OUT,PI0_OST,PRTTAB+0) +PIOOVT1:.MODULE PIOOVT1 +PIOMOVT(PIO1OUT,PI1_OST,PRTTAB+1) +PIOOVT2:.MODULE PIOOVT2 +PIOMOVT(PIO2OUT,PI2_OST,PRTTAB+2) +PIOOVT3:.MODULE PIOOVT3 +PIOMOVT(PIO3OUT,PI3_OST,PRTTAB+3) +; +;----------------------------------------------------------------------------- +; +; NON INTERRUPT OUTPUT ROUTINE - SHARED +; +; INPUT WILL ALWAYS RETURN ERROR, CHARACTER RETURNED IS UNDEFINED. +; OUTPUT WILL ALWAYS RETURN SUCCESS +; INPUT-STATUS WILL ALWAYS RETURN 0 CHARACTERS IN BUFFER. +; OUTPUT-STATUS WILL ALWAYS RETURN 1 CHARACTER SPACE IN BUFFER. + +PIOSHO_IN: + LD A,1 + RET +; +PIOSHO_OUT: + LD C,(IY+3) + OUT (C),E + XOR A + RET +; +PIOSHO_IST: XOR A + RET +; +PIOSH_OST: + LD A,1 + RET +; +;----------------------------------------------------------------------------- +; +; NON INTERRUPT INPUT ROUTINE - SHARED +; +; INPUT WILL ALWAYS A CHARACTER AND SUCCESS. +; OUTPUT WILL ALWAYS RETURN FAILURE +; INPUT STATUS WILL ALWAYS RETURN 1 CHARACTER IN BUFFER. +;OUTPUT-STATUS WILL ALWAYS RETURN 0 CHARACTER SPACE IN BUFFER. +; +PIOSHI_IN: + LD C,(IY+3) + IN A,(C) + LD E,A + XOR A + RET +; +PIOSHI_OUT: + LD A,1 + RET +; +PIOSH_IST: + LD A,1 + RET +; +PIOSHI_OST: + XOR A + RET +; +;----------------------------------------------------------------------------- +; +; ON ENTRY IY POINTS TO THE DEVICE RECORD. GET AND RETURN THE CONFIGURATION WORD IN DE +; +PIO_QUERY: +PPI_QUERY: + LD E,(IY+4) ; FIRST CONFIG BYTE TO E + LD D,(IY+5) ; SECOND CONFIG BYTE TO D + XOR A ; SIGNAL SUCCESS + RET +; +;----------------------------------------------------------------------------- +; +; ON ENTRY IY POINTS TO THE DEVICE RECORD. FOR CHARACTER DEVICES BIT 6 OF ATTRIBUTE +; INDICATES PARALLEL PORT IF 1 SO WE SET IT. COMMON TO ALL PORTS +; +PIO_DEVICE: +PPI_DEVICE: + LD D,CIODEV_PIO ; D := DEVICE TYPE + LD E,(IY) ; E := PHYSICAL UNIT + LD C,$40 ; C := ATTRIBUTE + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,(IY+3) ; L := BASE I/O ADDRESS + XOR A ; SIGNAL SUCCESS + RET +; +INTMATRIX: + .DW PIO0IN, PIO0OUT, PI0_IST, PI0_OST + .DW PIO1IN, PIO1OUT, PI1_IST, PI1_OST + .DW PIO2IN, PIO2OUT, PI2_IST, PI2_OST + .DW PIO3IN, PIO3OUT, PI3_IST, PI3_OST +POLMATRIX: + .DW PIOSHO_IN, PIOSHO_OUT, PIOSHO_IST, PIOSH_OST ; OUTPUT + .DW PIOSHI_IN, PIOSHI_OUT, PIOSH_IST, PIOSHI_OST ; INPUT + .DW 0,0,0,0 ; BIDIR + .DW 0,0,0,0 ; BIT MODE + +SET_8255: + RET +; +SET_BYE: + XOR A ; SIGNAL SUCCESS + RET +; +; ------------------------------------ +; i8255 FUNCTION TABLE ROUTINES +;------------------------------------- + +PPI_IN: + XOR A ; SIGNAL SUCCESS + RET +; +PPI_OUT: + XOR A ; SIGNAL SUCCESS + RET +; +PPI_IST: + RET +; +PPI_OST: + RET +; +; PIO_INITDEV - Configure device. +; If DE = FFFF then extract the configuration information from the table of devices and program the device using those settings. +; Otherwise use the configuration information in DE to program those settings and save them in the device table + +PPI_INITDEV: + XOR A ; SIGNAL SUCCESS + RET +PPI_INT:OR $FF ; NZ SET TO INDICATE INT HANDLED + RET +; +PIO_PRTCFG: + ; ANNOUNCE PORT + CALL NEWLINE ; FORMATTING + PRTS("PIO$") ; FORMATTING + LD A,(IY) ; DEVICE NUM + CALL PRTDECB ; PRINT DEVICE NUM + PRTS(": IO=0x$") ; FORMATTING + LD A,(IY+3) ; GET BASE PORT + CALL PRTHEXBYTE ; PRINT BASE PORT +; + ; PRINT THE PIO TYPE + CALL PC_SPACE ; FORMATTING + LD A,(IY+1) ; GET PIO TYPE BYTE + LD DE,PIO_TYPE_STR ; POINT HL TO TYPE MAP TABLE + CALL PRTIDXDEA + + ; ALL DONE IF NO PIO WAS DETECTED + LD A,(IY+1) ; GET PIO TYPE BYTE + OR A ; SET FLAGS + RET Z ; IF ZERO, NOT PRESENT +; + PRTS(" MODE=$") ; FORMATTING + LD E,(IY+4) ; LOAD CONFIG + LD D,(IY+5) ; ... WORD TO DE + CALL PS_PRTPC0 ; PRINT CONFIG +; + LD A,(IY+4) ; PRINT + BIT 2,A ; ALLOCATED + JR Z,NOINT ; INTERRUPT + PRTS("/i$") + LD A,(IY+4) + AND 00000011B + CALL PRTDECB +NOINT: XOR A + RET +; +; WORKING VARIABLES +; +PIO_DEV .DB 0 ; DEVICE NUM USED DURING INIT +; +; DESCRIPTION OF DIFFERENT PORT TYPES +; +PIO_TYPE_STR: + .TEXT "$" ; IDX 0 + .TEXT "Zilog PIO$" ; IDX 1 + .TEXT "i8255 PPI$" ; IDX 2 + .TEXT "IO Port$" ; IDX 3 +; +; Z80 PIO PORT TABLE - EACH ENTRY IS FOR 1 CHIP I.E. TWO PORTS +; +; 32 BYTE DATA STRUCTURE FOR EACH PORT +; +; .DB 0 ; IY+0 CIO DEVICE NUMBER (SET DURING PRE-INIT, THEN FIXED) +; .DB 0 ; IY+1 PIO TYPE (SET AT ASSEMBLY, FIXED) +; .DB 0 ; IY+2 PIO CHANNEL (SET AT ASSEMBLY, FIXED) +; .DB PIOBASE+2 ; IY+3 BASE DATA PORT (SET AT ASSEMBLY, FIXED) +; .DB 0 ; IY+4 SPW - MODE 3 I/O DIRECTION BYTE (SET AT ASSEMBLE, SET WITH INIT) +; .DB 0 ; IY+5 SPW - MODE, INTERRUPT (SET AT ASSEMBLY, SET WITH INIT) +; .DW 0 ; IY+6/7 FUNCTION TABLE (SET AT ASSEMBLY, SET DURING PRE-INIT AND AT INIT) +; .DW PIO_IN ; IY+8 ADDR FOR DEVICE INPUT (SET WITH INIT) +; .DW PIO_OUT ; IY+10 ADDR FOR DEVICE OUTPUT (SET WITH INIT) +; .DW PIO_IST ; IY+12 ADDR FOR DEVICE INPUT STATUS (SET WITH INIT) +; .DW PIO_OST ; IY+14 ADDR FOR DEVICE OUTPUT STATUS (SET WITH INIT) +; .DW PIO_INITDEV ; IY+16 ADDR FOR INITIALIZE DEVICE ROUTINE (SET AT ASSEMBLY, FIXED) +; .DW PIO_QUERY ; IY+18 ADDR FOR QUERY DEVICE RECORD ROUTINE (SET AT ASSEMBLY, FIXED) +; .DW PIO_DEVICE ; IY+20 ADDR FOR DEVICE TYPE ROUTINE (SET AT ASSEMBLY, FIXED) +; .FILL 10 +; +; SETUP PARAMETER WORD: +; +; +-------------------------------+ +-------+-----------+---+-------+ +; | BIT CONTROL | | MODE | | A | INT | +; +-------------------------------+ --------------------+-----------+ +; F E D C B A 9 8 7 6 5 4 3 2 1 0 +; -- MSB (D REGISTER) -- -- LSB (E REGISTER) -- +; +; +; MSB = BIT CONTROL MAP USE IN MODE 3 +; +; MODE B7 B6 = 00 Mode 0 Output +; 01 Mode 1 Input +; 10 Mode 2 Bidir +; 11 Mode 3 Bit Mode +; +; INTERRUPT ALLOCATED B2 = 0 NOT ALLOCATED +; = 1 IS ALLOCATED +; +; WHICH IVT IS ALLOCATES B1 B0 00 IVT_PIO0 +; 01 IVT_PIO1 +; 10 IVT_PIO2 +; 11 IVT_PIO3 +; +#DEFINE DEFPIO(MPIOBASE,MPIOCH0,MPIOCH1,MPIOCH0X,MPIOCH1X,MPIOIN0,MPIOIN1) \ +#DEFCONT \ .DB 0 +#DEFCONT \ .DB PIO_ZPIO +#DEFCONT \ .DB 0 +#DEFCONT \ .DB MPIOBASE +#DEFCONT \ .DB (MPIOCH0|MPIOIN0) +#DEFCONT \ .DB MPIOCH0X +#DEFCONT \ .DW 0 +#DEFCONT \ .DW 0,0,0,0, PIO_INITDEV,PIO_QUERY,PIO_DEVICE +#DEFCONT \ .FILL 2 +#DEFCONT \ .DB 0 +#DEFCONT \ .DB PIO_ZPIO +#DEFCONT \ .DB 1 +#DEFCONT \ .DB MPIOBASE+1 +#DEFCONT \ .DB (MPIOCH1|MPIOIN1) +#DEFCONT \ .DB MPIOCH1X +#DEFCONT \ .DW 0 +#DEFCONT \ .DW 0,0,0,0, PIO_INITDEV,PIO_QUERY,PIO_DEVICE +#DEFCONT \ .FILL 2 +; +; i8255 PORT TABLE - EACH ENTRY IS FOR 1 CHIP I.E. THREE PORTS +; +#DEFINE DEFPPI(MPPIBASE,MPPICH1,MPPICH2,MPPICH3,MPPICH1X,MPPICH2X,MPPICH3X) \ +#DEFCONT \ .DB 0 +#DEFCONT \ .DB PIO_8255 +#DEFCONT \ .DB 0 +#DEFCONT \ .DB MPPIBASE +#DEFCONT \ .DB (MPPICH1|00001000B) +#DEFCONT \ .DB MPPICH1X +#DEFCONT \ .DW 0 +#DEFCONT \ .DW PPI_IN,PPI_OUT,PPI_IST,PPI_OST,PPI_INITDEV,PPI_QUERY,PPI_DEVICE +#DEFCONT \ .FILL 2 +#DEFCONT \ .DB 0 +#DEFCONT \ .DB PIO_8255 +#DEFCONT \ .DB 1 +#DEFCONT \ .DB MPPIBASE+2 +#DEFCONT \ .DB (MPPICH2|00010000B) +#DEFCONT \ .DB MPPICH2X +#DEFCONT \ .DW 0 +#DEFCONT \ .DW PPI_IN,PPI_OUT,PPI_IST,PPI_OST,PPI_INITDEV,PPI_QUERY,PPI_DEVICE +#DEFCONT \ .FILL 2 +#DEFCONT \ .DB 0 +#DEFCONT \ .DB PIO_8255 +#DEFCONT \ .DB 2 +#DEFCONT \ .DB MPPIBASE+4 +#DEFCONT \ .DB (MPPICH3|00100000B) +#DEFCONT \ .DB MPPICH3X +#DEFCONT \ .DW 0 +#DEFCONT \ .DW PPI_IN,PPI_OUT,PPI_IST,PPI_OST,PPI_INITDEV,PPI_QUERY,PPI_DEVICE +#DEFCONT \ .FILL 2 +; +; HERE WE ACTUALLY DEFINE THE HARDWARE THAT THE HBIOS CAN ACCESS +; THE INIT ROUTINES READ AND SET THE INITIAL MODES FROM THIS INFO +; +PIO_CFG: +; +#IF PIO_4P +DEFPIO(PIO4BASE+0,M_Output,M_Input,M_BitAllOut,M_BitAllOut,INT_N,INT_N) +DEFPIO(PIO4BASE+4,M_Input,M_Input,M_BitAllOut,M_BitAllOut,INT_N,INT_N) +DEFPIO(PIO4BASE+8,M_Output,M_Output,M_BitAllOut,M_BitAllOut,INT_N,INT_N) +DEFPIO(PIO4BASE+12,M_Output,M_Output,M_BitAllOut,M_Output,INT_N,INT_N) +#ENDIF +#IF PIO_ZP +DEFPIO(PIOZBASE+0,M_Input,M_Input,M_BitAllOut,M_BitAllOut,INT_N,INT_N) +DEFPIO(PIOZBASE+4,M_Output,M_Output,M_BitAllOut,M_BitAllOut,INT_N,INT_N) +#ENDIF +; PIO_SBC & (PLATFORM == PLT_SBC) & (PPIDEMODE != PPIDEMODE_SBC)) + +#IF PIO_SBC +DEFPPI(PIOSBASE,M_Output,M_Output,M_Output,M_BitAllOut,M_BitAllOut,M_BitAllOut) +#ENDIF +; +PIO_CNT .EQU ($ - PIO_CFG) / CFG_SIZ +; +;------------------------------------------------------------------- +; WHEN WE GET HERE IY POINTS TO THE PIO_CFG TABLE WE ARE WORKING ON. +; C IS THE UNIT NUMBER +;------------------------------------------------------------------- +; +;PIO_INITUNIT: +; LD A,C ; SET THE UNIT NUMBER +; LD (IY),A +; +; LD DE,-1 ; LEAVE CONFIG ALONE +; CALL PIO_INITDEV ; IMPLEMENT IT AND RETURN +; XOR A ; SIGNAL SUCCESS +; RET ; AND RETURN +; +PIO_INIT: +; CALL SPK_BEEP + LD B,PIO_CNT ; COUNT OF POSSIBLE PIO UNITS + LD C,0 ; INDEX INTO PIO CONFIG TABLE +PIO_INIT1: + PUSH BC ; SAVE LOOP CONTROL + +; LD A,C ; PHYSICAL UNIT TO A +; RLCA ; MULTIPLY BY CFG TABLE ENTRY SIZE (32 BYTES) +; RLCA ; ... +; RLCA ; ... TO GET OFFSET INTO CFG TABLE +; RLCA +;; RLCA +; LD HL,PIO_CFG ; POINT TO START OF CFG TABLE +; PUSH AF +; CALL ADDHLA ; HL := ENTRY ADDRESS +; POP AF +; CALL ADDHLA ; HL := ENTRY ADDRESS +; PUSH HL ; COPY CFG DATA PTR +; POP IY ; ... TO IY +; POP IY ; ... TO IY + + CALL IDXCFG + + LD A,(IY+1) ; GET PIO TYPE + OR A ; SET FLAGS + CALL NZ,PIO_PRTCFG ; PRINT IF NOT ZERO + +; PUSH DE +; LD DE,$FFFF ; INITIALIZE DEVICE/CHANNEL +; CALL PIO_INITDEV ; BASED ON DPW +; POP DE + + POP BC ; RESTORE LOOP CONTROL + INC C ; NEXT UNIT + DJNZ PIO_INIT1 ; LOOP TILL DONE +; + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +SET_PORT: + ; DEVICE TYPE IS I/O PORT SO JUST WRITE $00 TO IT + LD C,(IY+3) + OUT (C),A + XOR A + RET diff --git a/Source/HBIOS/ppide.asm b/Source/HBIOS/ppide.asm index 637ed394..9fc40047 100644 --- a/Source/HBIOS/ppide.asm +++ b/Source/HBIOS/ppide.asm @@ -209,7 +209,7 @@ PPIDE_CFGTBL: #IF (PPIDECNT >= 1) ; PPIDE_DEV0M: ; DEVICE 0, MASTER - .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE .DB PPIDE_ACC_MAS | (PPIDE0A8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS @@ -222,7 +222,7 @@ PPIDE_DEV0M: ; DEVICE 0, MASTER .DW PPIDE_DEV0S ; PARTNER ; PPIDE_DEV0S: ; DEVICE 0, SLAVE - .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE .DB (PPIDE0B8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS @@ -239,7 +239,7 @@ PPIDE_DEV0S: ; DEVICE 0, SLAVE #IF (PPIDECNT >= 2) ; PPIDE_DEV1M: ; DEVICE 1, MASTER - .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE .DB PPIDE_ACC_MAS | (PPIDE1A8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS @@ -252,7 +252,7 @@ PPIDE_DEV1M: ; DEVICE 1, MASTER .DW PPIDE_DEV1S ; PARTNER ; PPIDE_DEV1S: ; DEVICE 1, SLAVE - .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE .DB (PPIDE1B8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS @@ -269,7 +269,7 @@ PPIDE_DEV1S: ; DEVICE 1, SLAVE #IF (PPIDECNT >= 3) ; PPIDE_DEV2M: ; DEVICE 2, MASTER - .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE .DB PPIDE_ACC_MAS | (PPIDE2A8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS @@ -282,7 +282,7 @@ PPIDE_DEV2M: ; DEVICE 2, MASTER .DW PPIDE_DEV2S ; PARTNER ; PPIDE_DEV2S: ; DEVICE 2, SLAVE - .DB 0 ; DRIVER RELATIVE DEVICE NUMBER (ASSIGNED DURING INIT) + .DB $FE ; DRIVER DEVICE NUMBER (FILLED DYNAMICALLY) .DB 0 ; DEVICE STATUS .DB 0 ; DEVICE TYPE .DB (PPIDE2B8BIT & PPIDE_ACC_8BIT) ; UNIT ACCESS FLAGS @@ -411,7 +411,8 @@ PPIDE_INIT5: PRTS(" SIZE=$") ; PRINT FIELD LABEL LD B,11 ; 11 BIT SHIFT TO CONVERT BLOCKS --> MB CALL SRL32 ; RIGHT SHIFT - CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) +; CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + CALL PRTDEC32 ; PRINT DWORD IN DECIMAL PRTS("MB$") ; PRINT SUFFIX ; RET @@ -470,7 +471,8 @@ PPIDE_FNTBL: PPIDE_VERIFY: PPIDE_FORMAT: PPIDE_DEFMED: - CALL PANIC ; NOT IMPLEMENTED + SYSCHKERR(ERR_NOTIMPL) ; NOT IMPLEMENTED + RET ; ; ; @@ -529,7 +531,10 @@ PPIDE_IO3: LD E,C ; SECTOR READ COUNT TO E LD HL,(PPIDE_DSKBUF) ; CURRENT DMA TO HL OR A ; SET FLAGS BASED ON RETURN CODE - RET ; AND RETURN, A HAS RETURN CODE + RET Z ; RETURN IF SUCCESS + LD A,ERR_IO ; SIGNAL IO ERROR + OR A ; SET FLAGS + RET ; AND DONE ; ; ; @@ -549,6 +554,8 @@ PPIDE_DEVICE: JR Z,PPIDE_DEVICE1 ; IF Z, WE ARE DONE LD C,%01001000 ; OTHERWISE REMOVABLE COMPACT FLASH PPIDE_DEVICE1: + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,(IY+PPIDE_DATALO) ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -583,6 +590,8 @@ PPIDE_MEDIA2: LD E,MID_HD ; ASSUME WE ARE OK RET Z ; RETURN IF GOOD INIT LD E,MID_NONE ; SIGNAL NO MEDIA + LD A,ERR_NOMEDIA ; NO MEDIA ERROR + OR A ; SET FLAGS RET ; AND RETURN ; ; @@ -728,6 +737,12 @@ PPIDE_WRSEC: ; ; PPIDE_SETADDR: +; +#IF (DSKYENABLE) + LD A,PPIDE_LBA + CALL LDHLIYA + CALL HB_DSKACT ; SHOW ACTIVITY +#ENDIF ; SEND 3 LOWEST BYTES OF LBA IN REVERSE ORDER ; IDE_IO_LBA3 HAS ALREADY BEEN SET ; HSTLBA2-0 --> IDE_IO_LBA2-0 @@ -763,9 +778,9 @@ PPIDE_SETADDR: CALL PPIDE_OUT .DB PPIDE_REG_COUNT ; -#IF (DSKYENABLE) - CALL PPIDE_DSKY -#ENDIF +;;#IF (DSKYENABLE) +;; CALL PPIDE_DSKY +;;#ENDIF ; RET ; @@ -974,12 +989,49 @@ PPIDE_RESET: CALL PPIDE_PRTPREFIX PRTS(" RESET$") #ENDIF +; + ; OLDER CF CARDS DO NOT SEEM TO SET THE + ; REGISTERS ON RESET, SO HERE WE FAKE THINGS BY + ; SETTING THEM AS A RESET WOULD +#IF (PPIDETRACE >= 3) + PRTS(" FAKE$") +#ENDIF + XOR A + ;OUT (IDE_IO_CYLLO),A + CALL PPIDE_OUT + .DB PPIDE_REG_CYLLO + ;OUT (IDE_IO_CYLHI),A + CALL PPIDE_OUT + .DB PPIDE_REG_CYLHI + INC A + ;OUT (IDE_IO_COUNT),A + CALL PPIDE_OUT + .DB PPIDE_REG_COUNT + ;OUT (IDE_IO_SECT),A + CALL PPIDE_OUT + .DB PPIDE_REG_SECT ; ; SETUP PPI TO READ LD A,PPIDE_DIR_READ ; SET DATA BUS DIRECTION TO READ ;OUT (PPIDE_IO_PPI),A ; DO IT LD C,(IY+PPIDE_PPI) ; PPI CONTROL WORD OUT (C),A ; WRITE IT +; +; IF A DSKYNG IS ACTIVE AND IS ON THE SAME PPI PORT AS THE PPISD BEING +; RESET, THEN THE DSKYNG WILL ALSO BE RESET. SO, THE RESET CODE IS +; BRACKETED WITH CODE TO SAVE AND RESTORE THE STATE OF THE DSKYNG. +; THERE IS NO CHECK FOR THE SPECIFIC PPI PORT SINCE IT DOES NO HARM +; IF THE DSKYNG IS SAVED AND RESTORED. +; +#IF (DSKYENABLE) + #IF (DSKYMODE == DSKYMODE_NG) + ; SAVE CONTENTS OF DSKY DISPLAY ACROSS RESET + LD B,8 + LD C,0 + LD HL,DSKY_BUF + CALL DSKY_GETSTR + #ENDIF +#ENDIF ; ; PULSE IDE RESET LINE LD A,PPIDE_CTL_RESET @@ -993,6 +1045,17 @@ PPIDE_RESET: OUT (C),A LD DE,20 CALL VDELAY +; +#IF (DSKYENABLE) + #IF (DSKYMODE == DSKYMODE_NG) + ; REININT DSKY AND RESTORE CONTENTS + CALL DSKY_REINIT + LD B,8 + LD C,0 + LD HL,DSKY_BUF + CALL DSKY_PUTSTR + #ENDIF +#ENDIF ; LD A,%00001010 ; SET ~IEN, NO INTERRUPTS ;OUT (PPIDE_REG_CTRL),A @@ -1209,16 +1272,48 @@ PPIDE_INITDEV00: ; LD (IY+PPIDE_MED),0 ; CLEAR MEDIA FLAGS ; - ; DETERMINE IF CF DEVICE - LD HL,HB_WRKBUF ; FIRST WORD OF IDENTIFY DATA HAS CF FLAG - LD A,$8A ; FIRST BYTE OF MARKER IS $8A - CP (HL) ; COMPARE - JR NZ,PPIDE_INITDEV1 ; IF NO MATCH, NOT CF - INC HL - LD A,$84 ; SECOND BYTE OF MARKER IS $84 - CP (HL) ; COMPARE - JR NZ,PPIDE_INITDEV1 ; IF NOT MATCH, NOT CF - SET 0,(IY+PPIDE_MED) ; SET FLAGS BIT FOR CF MEDIA + ; DETERMINE IF CF DEVICE BY TESTING FOR CF CARD SIGNATURES + ; IN THEORY, THERE ARE SOME OTHER POSSIBLE VARIATIONS, BUT + ; THEY ARE NOT RECOMMENDED BY THE CF CARD SPEC AND MIGHT + ; OVERLAP WITH "REAL" HARD DISK SIGNATURES. I HAVE NEVER + ; SEEN A CF CARD THAT DID NOT USE ONE OF THE BELOW. + ; CREDIT TO LASZLO SZOLNOKI +; +#IF (PPIDETRACE >= 3) + CALL PPIDE_PRTPREFIX + PRTS(" SIG=0x$") + LD BC,(HB_WRKBUF) + CALL PRTHEXWORD +#ENDIF +; +; SEE PAGE 114 OF CF+ & CF SPECIFICATION REV. 3.0 FOR CF CARD +; SIGNATURE VALUES. ALL OF THE BELOW ARE DOCUMENTED THERE EXCEPT +; $045A WHICH IS A VALUE DISCOVERED ON A CF<->SD CARD ADAPTER. +; +; SIGNATURE $045A IS NOT LISTED IN THE CF SPEC. IT WAS ADDED BECAUSE +; IT WAS SEEN IN THE WILD ON A CF-SD ADAPTER. HOWEVER IT HAS NOW +; ALSO BEEN SEEN ON A SPINNING HARD DISK. SINCE IT IS AMBIGUOUS, I +; WILL CONSIDER IT TO BE A HARD DISK. +; + LD BC,$848A ; STANDARD CF CARD SIGNATURE %1000 1111 1000 1010 + CALL PPIDE_INITDEV000 ; TEST & SET + LD BC,$044A ; ALT SIG FOR CF NON-REMOVABLE %0000 0100 0100 1010 + CALL PPIDE_INITDEV000 ; TEST & SET + ;LD BC,$045A ; ?ALT SIG FOR CF NON-REMOVABLE %0000 0100 0101 1010 + ;CALL PPIDE_INITDEV000 ; TEST & SET + LD BC,$0040 ; ALT SIG FOR CF NON-REMOVABLE %0000 0000 0100 0000 + CALL PPIDE_INITDEV000 ; TEST & SET + JR PPIDE_INITDEV1 ; CONTINUE INIT +; +PPIDE_INITDEV000: + ; CHECK IF FIRST WORD OF IDENTIFY DATA MATCHES VALUE IN BC + ; AND SET CF FLAG IF SO + LD HL,(HB_WRKBUF) ; FIRST WORD OF IDENTIFY DATA + OR A ; CLEAR CARRY + SBC HL,BC ; COMPARE + RET NZ ; ABORT IF NOT EQUAL + SET 0,(IY+PPIDE_MED) ; ELSE SET FLAGS BIT FOR CF MEDIA + RET ; AND RETURN ; PPIDE_INITDEV1: ; DETERMINE IF LBA CAPABLE @@ -1454,6 +1549,7 @@ PPIDE_PRTSTAT: PUSH AF PUSH DE PUSH HL + LD A,(IY+PPIDE_STAT) OR A LD DE,PPIDE_STR_STOK JR Z,PPIDE_PRTSTAT1 @@ -1544,35 +1640,37 @@ PPIDE_PRTPREFIX: CALL NEWLINE PRTS("PPIDE$") LD A,(IY+PPIDE_DEV) ; GET CURRENT DEVICE NUM - ADD A,'0' - CALL COUT + CP $FE ; NOT YET ASSIGNED? + JR Z,PPIDE_PRTPREFIX1 ; SKIP DEV NUM IF SO + CALL PRTDECB +PPIDE_PRTPREFIX1: CALL PC_COLON POP AF RET -; -; -; -#IF (DSKYENABLE) -PPIDE_DSKY: - LD HL,DSKY_HEXBUF ; POINT TO DSKY BUFFER - CALL PPIDE_IN - .DB PPIDE_REG_DRVHD - LD (HL),A ; SAVE IN BUFFER - INC HL ; INCREMENT BUFFER POINTER - CALL PPIDE_IN - .DB PPIDE_REG_CYLHI - LD (HL),A ; SAVE IN BUFFER - INC HL ; INCREMENT BUFFER POINTER - CALL PPIDE_IN - .DB PPIDE_REG_CYLLO - LD (HL),A ; SAVE IN BUFFER - INC HL ; INCREMENT BUFFER POINTER - CALL PPIDE_IN - .DB PPIDE_REG_SECT - LD (HL),A ; SAVE IN BUFFER - CALL DSKY_HEXOUT ; SEND IT TO DSKY - RET -#ENDIF +;;; +;;; +;;; +;;#IF (DSKYENABLE) +;;PPIDE_DSKY: +;; LD HL,DSKY_HEXBUF ; POINT TO DSKY BUFFER +;; CALL PPIDE_IN +;; .DB PPIDE_REG_DRVHD +;; LD (HL),A ; SAVE IN BUFFER +;; INC HL ; INCREMENT BUFFER POINTER +;; CALL PPIDE_IN +;; .DB PPIDE_REG_CYLHI +;; LD (HL),A ; SAVE IN BUFFER +;; INC HL ; INCREMENT BUFFER POINTER +;; CALL PPIDE_IN +;; .DB PPIDE_REG_CYLLO +;; LD (HL),A ; SAVE IN BUFFER +;; INC HL ; INCREMENT BUFFER POINTER +;; CALL PPIDE_IN +;; .DB PPIDE_REG_SECT +;; LD (HL),A ; SAVE IN BUFFER +;; CALL DSKY_HEXOUT ; SEND IT TO DSKY +;; RET +;;#ENDIF ; ;============================================================================= ; STRING DATA diff --git a/Source/HBIOS/ppp.asm b/Source/HBIOS/ppp.asm index 0b45b1eb..c8cc27d6 100644 --- a/Source/HBIOS/ppp.asm +++ b/Source/HBIOS/ppp.asm @@ -6,9 +6,9 @@ ; TODO: ; 1) ADD SUPPORT FOR DSKY ; -PPP_IO .EQU PPIBASE + 0 ; PPP DATA I/O (PPI PORT A) -PPP_CTL .EQU PPIBASE + 2 ; PPP CTL LINES (PPI PORT C) -PPP_PPICTL .EQU PPIBASE + 3 ; PPI CONTROL PORT +PPP_IO .EQU PPPBASE + 0 ; PPP DATA I/O (PPI PORT A) +PPP_CTL .EQU PPPBASE + 2 ; PPP CTL LINES (PPI PORT C) +PPP_PPICTL .EQU PPPBASE + 3 ; PPI CONTROL PORT ; ; COMMAND BYTES ; @@ -49,7 +49,7 @@ PPP_CMDVER .EQU $F1 ; SEND FIRMWARE VERSION PPP_INIT: CALL NEWLINE ; FORMATTING PRTS("PPP: IO=0x$") - LD A,PPIBASE + LD A,PPPBASE CALL PRTHEXBYTE ; CALL PPP_INITPPP ; INIT PPP BOARD @@ -338,7 +338,8 @@ PPPCON_OST: ; ; PPPCON_INITDEV: - CALL PANIC + SYSCHKERR(ERR_NOTIMPL) + RET ; ; ; @@ -354,6 +355,8 @@ PPPCON_DEVICE: LD D,CIODEV_PPPCON ; D := DEVICE TYPE LD E,0 ; E := DEVICE NUM, ALWAYS 0 LD C,$BF ; C := DEVICE TYPE, 0xBF IS PROP TERM + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,PPPBASE ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -471,7 +474,8 @@ PPPSD_INITUNIT: PRTS(" SIZE=$") ; PRINT FIELD LABEL LD B,11 ; 11 BIT SHIFT TO CONVERT BLOCKS --> MB CALL SRL32 ; RIGHT SHIFT - CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + ;CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + CALL PRTDEC32 ; PRINT DWORD IN DECIMAL PRTS("MB$") ; PRINT SUFFIX ; XOR A ; SIGNAL SUCCESS @@ -499,7 +503,8 @@ PPPSD_FNTBL: PPPSD_VERIFY: PPPSD_FORMAT: PPPSD_DEFMED: - CALL PANIC ; INVALID SUB-FUNCTION + SYSCHKERR(ERR_NOTIMPL) ; INVALID SUB-FUNCTION + RET ; ; ; @@ -566,8 +571,11 @@ PPPSD_IO2: PPPSD_IO3: LD E,C ; SECTOR READ COUNT TO E LD HL,(PPPSD_DSKBUF) ; CURRENT BUF ADR TO HL + OR A ; SET FLAGS BASED ON RETURN CODE + RET Z ; RETURN IF SUCCESS + LD A,ERR_IO ; SIGNAL IO ERROR OR A ; SET FLAGS - RET ; RETURN WITH A = STATUS + RET ; AND DONE ; ; ; @@ -682,6 +690,8 @@ PPPSD_DEVICE: LD D,DIODEV_PPPSD ; D := DEVICE TYPE LD E,(IY+PPPSD_DEV) ; E := PHYSICAL DEVICE NUMBER LD C,%01010000 ; C := ATTRIBUTES, REMOVABLE, SD CARD + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,PPPBASE ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -697,6 +707,8 @@ PPPSD_MEDIA: LD E,MID_HD ; ASSUME WE ARE OK RET Z ; RETURN IF GOOD INIT LD E,MID_NONE ; SIGNAL NO MEDA + LD A,ERR_NOMEDIA ; NO MEDIA ERROR + OR A ; SET FLAGS RET ; AND RETURN ; ; @@ -929,6 +941,9 @@ PPPSD_SENDBLK: LD A,PPPSD_LBA ; OFFSET OF LBA CALL LDHLIYA ; HL := IY + A, REG A TRASHED +#IF (DSKYENABLE) + CALL HB_DSKACT ; SHOW ACTIVITY +#ENDIF LD B,4 PPPSD_SENDBLK1: LD A,(HL) @@ -1009,6 +1024,7 @@ PPPSD_PRTSTAT: PUSH AF PUSH DE PUSH HL + LD A,(IY+PPPSD_STAT) OR A LD DE,PPPSD_STR_STOK JR Z,PPPSD_PRTSTAT1 diff --git a/Source/HBIOS/prp.asm b/Source/HBIOS/prp.asm index bb95606f..f34c6cf9 100644 --- a/Source/HBIOS/prp.asm +++ b/Source/HBIOS/prp.asm @@ -211,7 +211,8 @@ PRPCON_OST1: ; ; PRPCON_INITDEV: - CALL PANIC + SYSCHKERR(ERR_NOTIMPL) + RET ; ; ; @@ -227,6 +228,8 @@ PRPCON_DEVICE: LD D,CIODEV_PRPCON ; D := DEVICE TYPE LD E,0 ; E := DEVICE NUM, ALWAYS 0 LD C,$BF ; C := DEVICE TYPE, 0xBF IS PROP TERM + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,PRP_IOBASE ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -368,7 +371,8 @@ PRPSD_INITUNIT: PRTS(" SIZE=$") ; PRINT FIELD LABEL LD B,11 ; 11 BIT SHIFT TO CONVERT BLOCKS --> MB CALL SRL32 ; RIGHT SHIFT - CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + ;CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + CALL PRTDEC32 ; PRINT DWORD IN DECIMAL PRTS("MB$") ; PRINT SUFFIX ; XOR A ; SIGNAL SUCCESS @@ -396,7 +400,8 @@ PRPSD_FNTBL: PRPSD_VERIFY: PRPSD_FORMAT: PRPSD_DEFMED: - CALL PANIC ; INVALID SUB-FUNCTION + SYSCHKERR(ERR_NOTIMPL) ; INVALID SUB-FUNCTION + RET ; ; ; @@ -463,8 +468,11 @@ PRPSD_IO2: PRPSD_IO3: LD E,C ; SECTOR READ COUNT TO E LD HL,(PRPSD_DSKBUF) ; CURRENT BUF ADR TO HL + OR A ; SET FLAGS BASED ON RETURN CODE + RET Z ; RETURN IF SUCCESS + LD A,ERR_IO ; SIGNAL IO ERROR OR A ; SET FLAGS - RET ; RETURN WITH A = STATUS + RET ; AND DONE ; ; ; @@ -539,6 +547,8 @@ PRPSD_DEVICE: LD D,DIODEV_PRPSD ; D := DEVICE TYPE LD E,(IY+PRPSD_DEV) ; E := PHYSICAL DEVICE NUMBER LD C,%01010000 ; C := ATTRIBUTES, REMOVABLE, SD CARD + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,PRP_IOBASE ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -553,6 +563,8 @@ PRPSD_MEDIA: LD E,MID_HD ; ASSUME WE ARE OK RET Z ; RETURN IF GOOD INIT LD E,MID_NONE ; SIGNAL NO MEDA + LD A,ERR_NOMEDIA ; NO MEDIA ERROR + OR A ; SET FLAGS RET ; AND RETURN ; ; @@ -863,6 +875,9 @@ PRPSD_SETBLK: LD B,4 ; 4 BYTES LD A,PRPSD_LBA ; OFFSET OF LBA CALL LDHLIYA ; HL := IY + A, REG A TRASHED +#IF (DSKYENABLE) + CALL HB_DSKACT ; SHOW ACTIVITY +#ENDIF OTIR RET ; @@ -934,6 +949,7 @@ PRPSD_PRTSTAT: PUSH AF PUSH DE PUSH HL + LD A,(IY+PRPSD_STAT) OR A LD DE,PRPSD_STR_STOK JR Z,PRPSD_PRTSTAT1 diff --git a/Source/HBIOS/rf.asm b/Source/HBIOS/rf.asm index 2ecba90f..17aa5305 100644 --- a/Source/HBIOS/rf.asm +++ b/Source/HBIOS/rf.asm @@ -12,7 +12,7 @@ RF_U3IO .EQU $AC ; BASED ADDRESS OF RAMFLOPPY 4 ; ; IO PORT OFFSETS ; -RF_DAT .EQU 0 ; DATA IN/OUT ONLT TO SRAM - R/W +RF_DAT .EQU 0 ; DATA IN/OUT ONLY TO SRAM - R/W RF_AL .EQU 1 ; ADDRESS LOW FOR RAMF MEMORY - W/O RF_AH .EQU 2 ; ADDRESS HIGH FOR RAMF MEMORY - W/O RF_ST .EQU 3 ; STATUS PORT - R/O @@ -138,7 +138,8 @@ RF_FNTBL: RF_VERIFY: RF_FORMAT: RF_DEFMED: - CALL PANIC ; INVALID SUB-FUNCTION + SYSCHKERR(ERR_NOTIMPL) ; INVALID SUB-FUNCTION + RET ; ; ; @@ -178,6 +179,8 @@ RF_DEVICE: LD D,DIODEV_RF ; D := DEVICE TYPE LD E,(IY+RF_DEV) ; E := PHYSICAL DEVICE NUMBER LD C,%00110000 ; C := ATTRIBUTES, NON-REMOVABLE RAM FLOPPY + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,(IY+RF_IOAD) ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -219,7 +222,8 @@ RF_WRITE: CALL RF_CHKWP ; WRITE PROTECTED? JR Z,RF_RW ; IF 0, NOT WP, CONTINUE WITH GENERIC R/W ROUTINE LD E,0 ; ZERO SECTORS WRITTEN - OR $FF ; SIGNAL ERROR + LD A,ERR_READONLY ; SIGNAL ERROR + OR A ; SET FLAGS RET ; AND DONE ; ; @@ -255,20 +259,28 @@ RF_RW3: LD E,C ; SECTOR READ COUNT TO E LD HL,(RF_DSKBUF) ; CURRENT DMA TO HL OR A ; SET FLAGS BASED ON RETURN CODE - RET ; AND RETURN, A HAS RETURN CODE + RET Z ; RETURN SUCCESS + LD A,ERR_IO ; SIGNAL IO ERROR + OR A ; SET FLAGS + RET ; AND DONE ; ; READ SECTOR ; RF_RDSEC: CALL RF_SETADR ; SEND SECTOR STARTING ADDRESS TO CARD LD HL,(RF_DSKBUF) ; HL := DISK BUFFER ADDRESS - LD B,0 ; INIT BYTE COUNTER LD A,(RF_IO) ; GET IO PORT BASE +#IF (DMAENABLE & (DMAMODE=DMAMODE_ECB)) + LD BC,512-1 ; READ 512 BYTES + CALL DMAINIR ; USING DMA +#ELSE OR RF_DAT ; OFFSET TO DAT PORT LD C,A ; PUT IN C FOR PORT IO + LD B,0 ; INIT BYTE COUNTER INIR ; READ 256 BYTES INIR ; AND ANOTHER 256 BYTES FOR 512 TOTAL XOR A ; SIGNAL SUCCESS +#ENDIF RET ; AND DONE ; ; WRITE SECTOR @@ -276,13 +288,18 @@ RF_RDSEC: RF_WRSEC: CALL RF_SETADR ; SEND SECTOR STARTING ADDRESS TO CARD LD HL,(RF_DSKBUF) ; HL := DISK BUFFER ADDRESS - LD B,0 ; INIT BYTE COUNTER LD A,(RF_IO) ; GET IO PORT BASE OR RF_DAT ; OFFSET TO DAT PORT +#IF (DMAENABLE & (DMAMODE=DMAMODE_ECB)) + LD BC,512-1 ; WRITE 512 BYTES + CALL DMAOTIR ; USING DMA +#ELSE LD C,A ; PUT IN C FOR PORT IO + LD B,0 ; INIT BYTE COUNTER OTIR ; WRITE 256 BYTES OTIR ; AND ANOTHER 256 BYTES FOR 512 TOTAL XOR A ; SIGNAL SUCCESS +#ENDIF RET ; AND DONE ; ; @@ -294,8 +311,15 @@ RF_SETIO: ; ; ; -RF_SETADR: ; OUTPUT THE - LD A,(RF_IO) ; LOGICAL BLOCK +RF_SETADR: +; +#IF (DSKYENABLE) + LD A,RF_LBA + CALL LDHLIYA + CALL HB_DSKACT ; SHOW ACTIVITY +#ENDIF +; + LD A,(RF_IO) ; OUTPUT THE LOGICAL BLOCK OR RF_AL ; ADDRESS TO THE LD C,A ; TO THE MSB AND LD A,(IY+RF_LBA+0) ; LSB SECTRK diff --git a/Source/HBIOS/romldr.asm b/Source/HBIOS/romldr.asm index 22294698..364382de 100644 --- a/Source/HBIOS/romldr.asm +++ b/Source/HBIOS/romldr.asm @@ -1,1247 +1,2244 @@ ; -;================================================================================================== -; ROMWBW LOADER -;================================================================================================== -; -; THE LOADER CODE IS INVOKED IMMEDIATELY AFTER HBIOS COMPLETES SYSTEM INITIALIZATION. -; IT IS RESPONSIBLE FOR LOADING A RUNNABLE IMAGE (OPERATING SYSTEM, ETC.) INTO MEMORY -; AND TRANSFERRING CONTROL TO THAT IMAGE. THE IMAGE MAY COME FROM ROM (ROMBOOT), -; RAM (APPBOOT/IMGBOOT) OR FROM DISK (DISK BOOT). -; -; IN THE CASE OF A ROM BOOT, THE SELECTED EXECUTABLE IMAGE IS COPIED FROM ROM -; INTO A THE DEFAULT RAM AND THEN CONTROL IS PASSED TO THE STARTING ADDRESS -; IN RAM. IN THE CASE OF AN APPBOOT OR IMGBOOT STARTUP (SEE HBIOS.ASM) -; THE SOURCE OF THE IMAGE MAY BE RAM. -; -; IN THE CASE OF A DISK BOOT, SECTOR 2 (THE THIRD SECTOR) OF THE DISK DEVICE WILL -; BE READ -- THIS IS REFERRED TO AS THE BOOT INFO SECTOR AND IS EXPECTED TO HAVE -; THE FORMAT DEFINED AT BL_INFOSEC BELOW. THE LAST THREE WORDS OF DATA IN THIS -; SECTOR DETERMINE THE FINAL DESTINATION STARTING AND ENDING ADDRESS FOR THE DISK -; LOAD OPERATION AS WELL AS THE ENTRY POINT TO TRANSFER CONTROL TO. THE ACTUAL -; IMAGE TO BE LOADED *MUST* BE ON THE DISK IN THE SECTORS IMMEDIATELY FOLLOWING -; THE BOOT INFO SECTOR. THIS MEANS THE IMAGE TO BE LOADED MUST BEGIN IN SECTOR -; 3 (THE FOURTH SECTOR) AND OCCUPY SECTORS CONTIGUOUSLY AFTER THAT. -; -; THE CODE BELOW RELOCATES ITSELF AT STARTUP TO THE START OF COMMON RAM -; AT $8000. THIS MEANS THAT THE CODE, DATA, AND STACK WILL ALL STAY -; WITHIN $8000-$8FFF. SINCE ALL CODE IMAGES LIKE TO BE LOADED EITHER -; HIGH OR LOW (NEVER IN THE MIDDLE), THE $8000-$8FFF LOCATION TENDS -; TO AVOID THE PROBLEM WHERE THE CODE IS OVERLAID DURING THE LOADING -; OF THE DESIRED EXECUTABLE IMAGE. -; -; INCLUDE GENERIC STUFF -; -#INCLUDE "std.asm" -; -INT_IM1 .EQU $FF00 -; -BID_CUR .EQU -1 ; SPECIAL BANK ID VALUE INDICATES CURRENT BANK -; - .ORG 0 -; -;================================================================================================== -; NORMAL PAGE ZERO SETUP, RET/RETI/RETN AS APPROPRIATE -;================================================================================================== -; - JP $100 ; RST 0: JUMP TO BOOT CODE - .FILL (008H - $),0FFH -#IF (BIOS == BIOS_UNA) - JP $FFFD ; RST 8: INVOKE UBIOS FUNCTION -#ELSE - JP HB_INVOKE ; RST 8: INVOKE HBIOS FUNCTION -#ENDIF - .FILL (010H - $),0FFH - RET ; RST 10 - .FILL (018H - $),0FFH - RET ; RST 18 - .FILL (020H - $),0FFH - RET ; RST 20 - .FILL (028H - $),0FFH - RET ; RST 28 - .FILL (030H - $),0FFH - RET ; RST 30 - .FILL (038H - $),0FFH -#IF (BIOS == BIOS_UNA) - RETI ; RETURN W/ INTS DISABLED -#ELSE - #IF (INTMODE == 1) - JP INT_IM1 ; JP TO INTERRUPT HANDLER IN HI MEM - #ELSE - RETI ; RETURN W/ INTS DISABLED - #ENDIF -#ENDIF - .FILL (066H - $),0FFH - RETN ; NMI -; - .FILL (100H - $),0FFH ; PAD REMAINDER OF PAGE ZERO -; -;================================================================================================== -; STARTUP AND LOADER INITIALIZATION -;================================================================================================== -; - DI ; NO INTERRUPTS FOR NOW -; - ; RELOCATE TO START OF COMMON RAM AT $8000 - LD HL,0 - LD DE,$8000 - LD BC,LDR_SIZ - LDIR - JP START +;======================================================================= +; RomWBW Loader +;======================================================================= +; +; The loader code is invoked immediately after HBIOS completes system +; initialization. it is responsible for loading a runnable image +; (operating system, etc.) into memory and transferring control to that +; image. The image may come from ROM (romboot), RAM (appboot/imgboot) +; or from disk (disk boot). +; +; In the case of a ROM boot, the selected executable image is copied +; from ROM into the default RAM and then control is passed to the +; starting address in RAM. In the case of an appboot or imgboot +; startup (see hbios.asm) the source of the image may be RAM. +; +; In the case of a disk boot, sector 2 (the third sector) of the disk +; device will be read -- this is the boot info sector and is expected +; to have the format defined at bl_infosec below. the last three words +; of data in this sector determine the final destination starting and +; ending address for the disk load operation as well as the entry point +; to transfer control to. The actual image to be loaded *must* be on +; the disk in the sectors immediately following the boot info sector. +; This means the image to be loaded must begin in sector 3 (the fourth +; sector) and occupy sectors contiguously after that. +; +; The code below relocates itself at startup to the start of common RAM +; at $8000. This means that the code, data, and stack will all stay +; within $8000-$8FFF. Since all code images like to be loaded either +; high or low (never in the middle), the $8000-$8FFF location tends to +; avoid the problem where the code is overlaid during the loading of +; the desired executable image. +; +#INCLUDE "std.asm" ; standard RomWBW constants +; +#ifndef BOOT_DEFAULT +#define BOOT_DEFAULT "H" +#endif +; +bel .equ 7 ; ASCII bell +bs .equ 8 ; ASCII backspace +lf .equ 10 ; ASCII linefeed +cr .equ 13 ; ASCII carriage return +; +cmdbuf .equ $80 ; cmd buf is in second half of page zero +cmdmax .equ 60 ; max cmd len (arbitrary), must be < bufsiz +bufsiz .equ $80 ; size of cmd buf +; +int_im1 .equ $FF00 ; IM1 vector target for RomWBW HBIOS proxy +; +bid_cur .equ -1 ; used below to indicate current bank +; + .org 0 ; we expect to be loaded at $0000 +; +;======================================================================= +; Normal page zero setup, ret/reti/retn as appropriate +;======================================================================= +; + jp $100 ; rst 0: jump to boot code + .fill ($08 - $) +#if (BIOS == BIOS_WBW) + jp HB_INVOKE ; rst 8: invoke HBIOS function +#else + jp $FFFD ; rst 8: invoke UBIOS function +#endif + .fill ($10 - $) + ret ; rst 10 + .fill ($18 - $) + ret ; rst 18 + .fill ($20 - $) + ret ; rst 20 + .fill ($28 - $) + ret ; rst 28 + .fill ($30 - $) + ret ; rst 30 + .fill ($38 - $) +#if (BIOS == BIOS_WBW) + #if (INTMODE == 1) + jp int_im1 ; go to handler in hi mem + #else + ret ; return w/ ints left disabled + #endif +#else + ret ; return w/ ints disabled +#endif +; +#if (BIOS == BIOS_WBW) + .fill ($40 - $),$FF + ; After initial bootup, it is conventional for a jp 0 to + ; cause a warm start of the system. If there is no OS running + ; then this bit of code will suffice. After bootup, the + ; jp instruction at $0 is modified to point here. + pop hl ; save PC in case needed for ... + ld bc,$F003 ; HBIOS user reset function + call HB_INVOKE ; do it + ld bc,$F001 ; HBIOS warm start function + call HB_INVOKE ; do it +#endif +; + .fill ($66 - $) + retn ; nmi +; + .fill ($100 - $) ; pad remainder of page zero +; +;======================================================================= +; Startup and loader initialization +;======================================================================= +; +; Note: at startup, we should not assume which bank we are operating in. +; + ; Relocate to start of common ram at $8000 + ld hl,0 + ld de,$8000 + ld bc,LDR_SIZ + ldir +; + jp start ; .ORG $8000 + $ ; -START: LD SP,BL_STACK ; SETUP STACK -; -#IF (BIOS == BIOS_WBW) - CALL DELAY_INIT ; INIT DELAY FUNCTIONS -#ENDIF -; -#IF (BIOS == BIOS_UNA) -; ; COPY UNA BIOS PAGE ZERO TO USER BANK, LEAVE USER BANK ACTIVE -; LD BC,$01FB ; UNA FUNC = SET BANK -; LD DE,BID_BIOS ; UBIOS_PAGE (SEE PAGES.INC) -; CALL $FFFD ; DO IT (RST 08 NOT YET INSTALLED) -; PUSH DE ; SAVE PREVIOUS BANK -;; -; LD HL,0 ; FROM ADDRESS 0 (PAGE ZERO) -; LD DE,$9000 ; USE $9000 AS BOUNCE BUFFER -; LD BC,256 ; ONE PAGE IS 256 BYTES -; LDIR ; DO IT -;; -; LD BC,$01FB ; UNA FUNC = SET BANK -; ;POP DE ; RECOVER OPERATING BANK -; LD DE,BID_USR ; TO USER BANK -; CALL $FFFD ; DO IT (RST 08 NOT YET INSTALLED) -;; -; LD HL,$9000 ; USE $9000 AS BOUNCE BUFFER -; LD DE,0 ; TO PAGE ZERO OF OPERATING BANK -; LD BC,256 ; ONE PAGE IS 256 BYTES -; LDIR ; DO IT -;; -;; ; INSTALL UNA INVOCATION VECTOR FOR RST 08 -;; ; *** IS THIS REDUNDANT? *** -;; 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,$01FB ; UNA FUNC = SET BANK -; POP DE ; RECOVER OPERATING BANK -; CALL $FFFD ; DO IT (RST 08 NOT YET INSTALLED) -#ELSE - ; PREP THE USER BANK (SETUP PAGE ZERO) - LD B,BF_SYSSETCPY ; HBIOS FUNC: SETUP BANK COPY - LD D,BID_USR ; D = DEST BANK = USER BANK - LD E,BID_BIOS ; E = SRC BANK = BIOS BANK - LD HL,256 ; HL = COPY LEN = 1 PAGE = 256 BYTES - RST 08 ; DO IT - LD B,BF_SYSBNKCPY ; HBIOS FUNC: PERFORM BANK COPY - LD HL,0 ; COPY FROM BIOS ADDRESS 0 - LD DE,0 ; TO USER ADDRESS 0 - RST 08 ; DO IT -#ENDIF - EI -; -;================================================================================================== -; BOOT LOADER MENU DISPLAY -;================================================================================================== -; - LD DE,STR_BANNER ; DISPLAY BOOT BANNER -; -MENU: - CALL WRITESTR ; DISPLAY MESSAGE OR ERROR - CALL NEWLINE2 -; -#IF (DSKYENABLE) - CALL DSKY_RESET - ; DISPLAY DSKY BOOT MESSAGE - LD HL,MSG_SEL ; POINT TO BOOT MESSAGE - CALL DSKY_SHOWSEG ; DISPLAY MESSAGE -#ENDIF -; -#IF (BOOTTYPE == BT_AUTO) - ; INITIALIZE BOOT TIMEOUT DOWNCOUNTER - LD BC,100 * BOOT_TIMEOUT - LD (BL_TIMEOUT),BC -#ENDIF -; - ; DISPLAY ROM MENU ENTRIES - PRTS("ROM: $") - LD B,MENU_N ; B IS LOOP COUNTER, # OF ENTRIES - LD HL,MENU_S ; HL POINTS TO START OF ENTRY -MENU1: - ; PROCESS A TABLE ENTRY - PUSH HL ; COPY HL TO - POP DE ; ... DE FOR USE AS CHAR PTR -MENU2: - LD A,(DE) ; GET NEXT CHAR - INC DE ; BUMP CHAR PTR FOR FUTURE - CP '$' ; TERMINATOR? - JR Z,MENU4 ; IF YES, DONE WITH THIS ENTRY - CP '~' ; HOT KEY PREFIX? - JR NZ,MENU3 ; IF NOT, JUST SKIP AHEAD - CALL PC_LPAREN ; L PAREN BEFORE HOT KEY - LD A,(DE) ; GET THE ACTUAL HOT KEY - INC DE ; BUMP CHAR PTR FOR FUTURE - CALL COUT ; OUTPUT HOT KEY - LD A,')' ; R PAREN WILL PRINT BELOW -MENU3: - CALL COUT ; OUTPUT CHAR - JR MENU2 ; AND LOOP -MENU4: - ; END OF AN ENTRY - CALL PC_SPACE ; PRINT SEPARATOR - LD A,MENU_V ; LOAD ENTRY LENGTH - CALL ADDHLA ; BUMP HL TO NEXT ENTRY - DJNZ MENU1 ; LOOP UNTIL COUNT EXPIRES -; - ; DISPLAY AVAILABLE DISK DRIVES - PRTS("\r\nDisk: $") - CALL PRTALL ; PRINT DRIVE LIST -; - LD DE,STR_BOOTSEL - CALL WRITESTR -; -;================================================================================================== -; BOOT SELECTION PROCESSING -;================================================================================================== -; -SEL: ; HANDLE SERIAL CONSOLE INPUT - CALL CST ; CHECK CONSOLE INPUT - OR A ; ZERO? - JR Z,SEL1 ; IF NOT, CONTINUE -#IF (BIOS == BIOS_WBW) - #IF (DIAGENABLE) - XOR A ; ZERO ACCUM - OUT (DIAGPORT),A ; CLEAR DIAG LEDS - #ENDIF - #IF (LEDENABLE) - OR $FF ; LED IS INVERTED - OUT (LEDPORT),A ; CLEAR LED - #ENDIF -#ENDIF - CALL CINUC ; GET THE KEY - CALL COUT ; ECHO KEY - CP 'R' ; CHECK FOR - JP Z,REBOOT ; REBOOT REQUEST - LD DE,MENU_S+10-MENU_V ; POINT TO SERIAL MENU COLUMN - LD C,2 ; SET SERIAL FLAG - JR MATS ; GO CHECK MENU SELECTION -; -SEL1: -#IF (DSKYENABLE) - ; HANDLE DSKY KEY INPUT - CALL DSKY_STAT ; CHECK DSKY INPUT - OR A ; TEST FOR ZERO - JR Z,SEL2 ; IF ZERO, NO KEY PRESSED -#IF (BIOS == BIOS_WBW) - #IF (DIAGENABLE) - XOR A ; ZERO ACCUM - OUT (DIAGPORT),A ; CLEAR DIAG LEDS - #ENDIF - #IF (LEDENABLE) - OR $FF ; LED IS INVERTED - OUT (LEDPORT),A ; CLEAR LED - #ENDIF -#ENDIF - CALL DSKY_GETKEY ; GET PENDING KEY PRESS ; NOTE DESKY_GETKEY - CP $FF ; CHECK FOR ERROR - JR Z,SEL2 ; IF SO, IGNORE KEY, AND CONT LOOPING - CP KY_BO ; CHECK FOR REBOOT ; CAN RETURN AN INVALID - JP Z,REBOOT ; REBOOT REQUEST ; KEYSCAN AS FFH WHICH - LD DE,MENU_S+11-MENU_V ; POINT TO DSKY MENU COLUMN ; MAY BE MATCHED WITH - LD C,1 ; SET DSKY FLAG ; DUMMY MENU ENTRIES - JR MATS ; GO CHECK MENU SELECTION -#ENDIF -; -SEL2: -#IF (BOOTTYPE == BT_AUTO) - ; CHECK FOR AUTOBOOT TIMEOUT - LD DE,625 ; DELAY FOR 10MS TO MAKE TIMEOUT CALC EASY - CALL VDELAY ; 16US * 625 = 10MS - LD BC,(BL_TIMEOUT) ; CHECK/INCREMENT TIMEOUT - DEC BC - LD (BL_TIMEOUT),BC - LD A,B - OR C - JP NZ,SEL3 -; -#IF (BIOS == BIOS_WBW) - #IF (DIAGENABLE) - XOR A ; ZERO ACCUM - OUT (DIAGPORT),A ; CLEAR DIAG LEDS - #ENDIF - #IF (LEDENABLE) - OR $FF ; LED IS INVERTED - OUT (LEDPORT),A ; CLEAR LED - #ENDIF -#ENDIF - LD A,BOOT_DEFAULT ; TIMEOUT EXPIRED, - LD DE,MENU_S+10-MENU_V ; POINT TO SERIAL MENU COLUMN - LD C,2 ; SET SERIAL FLAG - JR MATS ; PERFORM DEFAULT BOOT ACTION -#ENDIF -; -SEL3: - ; NO USER SELECTION YET - JR SEL ; LOOP -; -;================================================================================================== -; ROM MENU TABLE MATCHING -;================================================================================================== -; -MATS: LD B,MENU_N ; LOOP THROUGH THE ; ON ENTRY DE POINTS TO - LD HL,MENU_V ; MENU TABLE AND ; THE MENU COLUMN WE ARE -MATS1: EX DE,HL ; CHECK IF THE ; CHECKING AND C CONTAINS - ADD HL,DE ; KEYPRESS MATCHES ; A FLAG TELLING US IF WE - CP (HL) ; ANY OF ; HAVE DSKY OR SERIAL INPUT - EX DE,HL ; THE MENU ITEMS. - JR Z,MATS2 - DJNZ MATS1 ; IF WE REACH THE TABLE END AND DON'T HAVE - JR MATD ; A MATCH GO AND CHECK FOR A DISK SELECTION -; -MATS2: LD B,0 ; WE GOT A MATCH FROM THE MENU TABLE. POINT - EX DE,HL ; TO THE ROM ADDRESS TO EXECUTE. ADJUST THE - ADD HL,BC ; POINTER TO THE ROM ENTRY BASED ON WHETHER WE - EX DE,HL ; GOT A MATCH IN THE DSKY OR SERIAL MENU COLUMN - JP GOROM ; JUMP TO THE ROM HANDLER. -; -MATD: LD B,A - LD A,C ; IF INPUT WAS SERIAL - LD (BL_INPFLG),A ; SAVE INPUT FLAG - DEC C ; CONVERT TO FROM. - LD A,B ; ASCII TO DECIMAL. - JR Z,MATD1 ; DSKY NUMBERS ARE - SUB '0' ; ALREADY DECIMAL -MATD1: CP 10 ; DO A RANGE CHECK - JR NC,MATX ; NOT VALID, HANDLE IT BELOW -; -#IF (BIOS == BIOS_WBW) - PUSH BC - PUSH AF ; HOW MANY DISK - LD B,BF_SYSGET ; DEVICES DO WE - LD C,BF_SYSGET_DIOCNT ; HAVE IN THE - RST 08 ; SYSTEM ? - POP AF - POP BC -#ELSE - LD E,9 ; HACK TO HANDLE UNA, NEED TO FIX -#ENDIF -; JR MATD2 ; IF MORE THEN 9 ; UNCOMMENT TO TEST DOUBLE CHAR ENTRY - CP 10 ; THEN WE NEED TO GET - JR NC,MATD2 ; ANOTHER CHARACTER -; - CP E ; WE DON'T HAVE MORE THAN 10 DEVICES SO ; A = REQUESTED UNIT - JP C,GOBOOTDISK ; CHECK IT IS IN RANGE. BOOT IF IT IS ; E = AVAILABLE UNITS - JR MATX ; IT IF NOT VALID, HANDLE IT BELOW +start: + ld sp,bl_stack ; setup private stack + call delay_init ; init delay functions +; +; Disable interrupts if IM1 is active because we are switching to page +; zero in user bank and it has not been prepared with IM1 vector yet. +; +#if (INTMODE == 1) + di +#endif +; +; Switch to user RAM bank +; +#if (BIOS == BIOS_WBW) + ld b,BF_SYSSETBNK ; HBIOS func: set bank + ld c,BID_USR ; select user bank + rst 08 ; do it + ld a,c ; previous bank to A + ld (bid_ldr),a ; save previous bank for later + bit 7,a ; starting from ROM? +#endif +; +#if (BIOS == BIOS_UNA) + ld bc,$01FB ; UNA func: set bank + ld de,BID_USR ; select user bank + rst 08 ; do it + ld (bid_ldr),de ; ... for later + bit 7,d ; starting from ROM? +#endif +; + ; For app mode startup, use alternate table + ld hl,ra_tbl ; assume ROM startup + jr z,start1 ; if so, ra_tbl OK, skip ahead + ld hl,ra_tbl_app ; not ROM boot, get app tbl loc +start1: + ld (ra_tbl_loc),hl ; and overlay pointer +; +; Copy original page zero into user page zero +; + ld hl,$8000 ; page zero was copied here + ld de,0 ; put it in user page zero + ld bc,$100 ; full page + ldir ; do it + ld hl,$0040 ; adr of user reset code + ld (1),hl ; save at $0000 +; +; Page zero in user bank is ready for interrupts now. +; +#if (INTMODE == 1) + ei +#endif +; +;======================================================================= +; Loader prompt +;======================================================================= +; + call nl2 ; formatting + ld hl,str_banner ; display boot banner + call pstr ; do it + call clrbuf ; zero fill the cmd buffer +; +#if (BOOT_TIMEOUT != -1) + ; Initialize auto command timeout downcounter + or $FF ; auto cmd active value + ld (acmd_act),a ; set flag + ld bc,BOOT_TIMEOUT * 100 ; hundredths of seconds + ld (acmd_to),bc ; save auto cmd timeout +; + ; If timeout is zero, boot auto command immediately + ld a,b ; check for + or c ; ... zero + jr nz,prompt ; not zero, prompt w/ timeout + call nl2 ; formatting + ld hl,str_autoboot ; auto command prefix + call pstr ; show it + call autocmd ; handle w/o prompt + jr reprompt ; restart w/ autocmd disable +#endif +; +prompt: + ld hl,reprompt ; adr of prompt restart routine + push hl ; put it on stack + call nl2 ; formatting + ld hl,str_prompt ; display boot prompt + call pstr ; do it + call clrbuf ; zero fill the cmd buffer +; +#if (DSKYENABLE) + call DSKY_PREINIT ; *** TEMPORARY *** + call DSKY_RESET ; clear DSKY + ld hl,msg_sel ; boot select msg + call DSKY_SHOW ; show on DSKY -MATD2: LD B,A ; PROCESS FURTHER INPUT ; B = REQUESTED UNIT - LD A,C ; CHECK WHERE TO GET ; C = DSKY/SERIAL FLAG - DEC C ; THE INPUT FROM AND GO - JR NZ,MATD3 ; GET ANOTHER CHARACTER -; -#IF (DSKYENABLE) ; INPUT DSKY -; -MATD4: ;CALL DSKY_STAT ; WAIT FOR - ;OR A ; ANOTHER - ;JR Z,MATD4 ; KEY FROM - ;CALL DSKY_GETKEY ; DSKY - CALL DSKY_KEY + #IF (DSKYMODE == DSKYMODE_NG) + call DSKY_PUTLED + .db $3f,$3f,$3f,$3f,$00,$00,$00,$00 + call DSKY_BEEP + call DSKY_L2ON + #ENDIF - CP KY_EN ; IF NEXT KEY IS ENTER - JR Z,MATD6 ; OR GO, PROCESS AS A - CP KY_GO ; SINGLE DIGIT NUMBER - JR Z,MATD6 ; OTHERWISE JOIN TWO - JR MATD5 ; CHARCTERS IN ONE DECIMAL -#ENDIF -; -; ; INPUT SERIAL -; -MATD3: ;CALL CST ; WAIT FOR - ;OR A ; ANOTHER - ;JR Z,MATD3 ; KEY FROM - CALL CINUC ; SERIAL - CALL COUT -; - CP CHR_CR ; IF NEXT KEY IS RETURN PROCESS - JR Z,MATD6 ; AS A SINGLE DIGIT NUMBER -; - SUB '0' ; CONVERT THE SERIAL NUMBER TO DECIMAL - CP 10 ; DO A RANGE CHECK - JR NC,MATX ; NOT VALID, HANDLE IT BELOW +#endif +; +wtkey: + ; wait for a key or timeout + call cst ; check for keyboard key + jr nz,concmd ; if pending, do console command +; +#if (DSKYENABLE) + call DSKY_STAT ; check DSKY for keypress + or a ; set flags + jp nz,dskycmd ; if pending, do DSKY command +#endif +; +#if (BOOT_TIMEOUT != -1) + ; check for timeout and handle auto boot here + ld a,(acmd_act) ; get auto cmd active flag + or a ; set flags + jr z,wtkey ; if not active, just loop + ld bc,(acmd_to) ; load timeout value + ld a,b ; test for + or c ; ... zero + jr z,autocmd ; if so, handle it + dec bc ; decrement + ld (acmd_to),bc ; resave it + ld de,625 ; 16us * 625 = 10ms + call vdelay ; 10ms delay +#endif +; + jr wtkey ; loop +; +reprompt: + xor a ; zero accum + ld (acmd_act),a ; set auto cmd inactive + jr prompt ; back to loader prompt +; +clrbuf: + ld hl,cmdbuf + ld b,bufsiz + xor a +clrbuf1: + ld (hl),a + djnz clrbuf1 + ret +; +;======================================================================= +; Process a command line from buffer +;======================================================================= +; +concmd: + call clrled ; clear LEDs +; +#if (DSKYENABLE) + #if (DSKYMODE == DSKYMODE_NG) + call DSKY_PUTLED + .db $00,$00,$00,$00,$00,$00,$00,$00 + call DSKY_L2OFF + #endif +#endif +; + ; Get a command line from console and handle it + call rdln ; get a line from the user + ld de,cmdbuf ; point to buffer + call skipws ; skip whitespace + or a ; set flags to check for null + jr nz,runcmd ; got a cmd, process it + ; if no cmd entered, fall thru to process default cmd +; +autocmd: + ; Copy autocmd string to buffer and process it + ld hl,acmd ; auto cmd string + call pstr ; display it + ld hl,acmd ; auto cmd string + ld de,cmdbuf ; cmd buffer adr + ld bc,acmd_len ; auto cmd length + ldir ; copy to command line buffer +; +runcmd: + ; Process command line +; + ld de,cmdbuf ; point to start of buf + call skipws ; skip whitespace + or a ; check for null terminator + ret z ; if empty line, just bail out + ld a,(de) ; get character + call upcase ; make upper case +; + ; Attempt built-in commands + cp 'H' ; H = display help + jp z,help ; if so, do it + cp '?' ; '?' alias for help + jp z,help ; if so, do it + cp 'L' ; L = List ROM applications + jp z,applst ; if so, do it + cp 'D' ; D = device inventory + jp z,devlst ; if so, do it + cp 'R' ; R = reboot system + jp z,reboot ; if so, do it +#if (BIOS == BIOS_WBW) + cp 'I' ; C = set console interface + jp z,setcon ; if so, do it + cp 'V' ; V = diagnostic verbosity + jp z,setdl ; is so, do it +#endif +; + ; Attempt ROM application launch + ld ix,(ra_tbl_loc) ; point to start of ROM app tbl + ld c,a ; save command in C +runcmd1: + ld a,(ix+ra_conkey) ; get match char + and ~$80 ; clear "hidden entry" bit + cp c ; compare + jp z,romload ; if match, load it + ld de,ra_entsiz ; table entry size + add ix,de ; bump IX to next entry + ld a,(ix) ; check for end + or (ix+1) ; ... of table + jr nz,runcmd1 ; loop till done +; + ; Attempt disk boot + ld de,cmdbuf ; start of buffer + call skipws ; skip whitespace + call isnum ; do we have a number? + jp nz,err_invcmd ; invalid format if empty + call getnum ; parse a number + jp c,err_invcmd ; handle overflow error + ld (bootunit),a ; save boot unit + xor a ; zero accum + ld (bootslice),a ; save default slice + call skipws ; skip possible whitespace + ld a,(de) ; get separator char + or a ; test for terminator + jp z,diskboot ; if so, boot the disk unit + cp '.' ; otherwise, is '.'? + jr z,runcmd2 ; yes, handle slice spec + cp ':' ; or ':'? + jr z,runcmd2 ; alt sep for slice spec + jp err_invcmd ; if not, format error +runcmd2: + inc de ; bump past separator + call skipws ; skip possible whitespace + call isnum ; do we have a number? + jp nz,err_invcmd ; if not, format error + call getnum ; get number + jp c,err_invcmd ; handle overflow error + ld (bootslice),a ; save boot slice + jp diskboot ; boot the disk unit/slice +; +;======================================================================= +; Process a DSKY command from key in A +;======================================================================= +; +#if (DSKYENABLE) +; +dskycmd: + call clrled ; clear LEDs +; + call DSKY_GETKEY ; get DSKY key + cp $FF ; check for error + ret z ; abort if so +; + #if (DSKYMODE == DSKYMODE_NG) + call DSKY_PUTLED + .db $00,$00,$00,$00,$00,$00,$00,$00 + call DSKY_L2OFF + #endif +; + ; Attempt built-in commands + cp KY_BO ; reboot system + jp z,reboot ; if so, do it +; + ; Attempt ROM application launch + ld ix,(ra_tbl_loc) ; point to start of ROM app tbl + ld c,a ; save DSKY key in C +dskycmd1: + ld a,(ix+ra_dskykey) ; get match char + cp c ; compare + jp z,romload ; if match, load it + ld de,ra_entsiz ; table entry size + add ix,de ; bump IX to next entry + ld a,(ix) ; check for end + or (ix+1) ; ... of table + jr nz,dskycmd1 ; loop till done +; + ; Attempt disk boot + ld a,c ; copy key to A + cp KY_F + 1 ; over max? + ret nc ; abort if so + ld (bootunit),a ; set as boot unit + xor a ; zero A + ld (bootslice),a ; boot slice always zero here + jp diskboot ; go do it +; +#endif +; +;======================================================================= +; Special command processing +;======================================================================= +; +; Display Help +; +help: + ld hl,str_help ; point to help string + call pstr ; display it + ret +; +; List ROM apps +; +applst: + ld hl,str_applst + call pstr + call nl + ld ix,(ra_tbl_loc) +applst1: + ; check for end of table + ld a,(ix) + or (ix+1) + ret z +; + ld a,(ix+ra_conkey) + bit 7,a + jr nz,applst2 + push af + call nl + ld a,' ' + call cout + call cout + pop af + call cout + ld a,':' + call cout + ld a,' ' + call cout + ld l,(ix+ra_name) + ld h,(ix+ra_name+1) + call pstr +; +applst2: + ld bc,ra_entsiz + add ix,bc + jr applst1 -MATD5: LD C,A ; C CONTAINS SECOND CHARACTER INPUT 0..9 - LD A,B ; A CONTAINS FIRST NUMBER INPUT 0..9 - ADD A,A - LD B,A ; MULTIPLY FIRST DIGIT BY 10 - ADD A,A ; AND ADD SECOND DIGIT - ADD A,A - ADD A,B ; CONVERT TWO INPUTTED - ADD A,C ; CHARACTERS TO DECIMAL. - LD B,A -; -MATD6: LD A,B ; PUT THE DEVICE NUMBER TO BOOT - JP GOBOOTDISK ; IN A AND GO BOOT DEVICE -; -MATX: LD DE,STR_INVALID ; SET ERROR STRING MESSAGE - JP MENU ; AND RESTART MENU LOOP -; -;================================================================================================== -; ROM MENU TABLE -;================================================================================================== -; -#DEFINE MENU_L(M1,M2,M3,M4,M5,M6,M7,M8,M9,M10) \ -#DEFCONT \ .DB M1 -#DEFCONT \ .DB M2 -#IF (DSKYENABLE) -#DEFCONT \ .DB M3 -#ELSE -#DEFCONT \ .DB $FF -#ENDIF -#DEFCONT \ .DW M4 -#DEFCONT \ .DW M5 -#DEFCONT \ .DW M6 -#DEFCONT \ .DW M7 -#DEFCONT \ .DB M8 -#DEFCONT \ .DB M9 -#DEFCONT \ .DB M10 -; -; NOTE: THE FORMATTING OF THE FOLLOWING IS CRITICAL. TASM DOES NOT PASS MACRO ARGUMENTS WELL. -; ENSURE STD.ASM HOLDS THE DEFINITIONS FOR *_LOC, *_SIZ *_END AND ANY CODE GENERATED WHICH DOES NOT -; INCLUDE STD.ASM IS SYNCED. -; -; NOTE: THE LOADABLE ROM IMAGES ARE PLACED IN ROM BANKS BID_IMG0 AND BID_IMG1. HOWEVER, ROMWBW -; SUPPORTS A MECHANISM TO LOAD A COMPLETE NEW SYSTEM DYNAMICALLY AS A RUNNABLE APPLICATION -; (SEE APPBOOT AND IMGBOOT IN HBIOS.ASM). IN THIS CASE, THE CONTENTS OF BID_IMG0 WILL -; PRE-LOADED INTO THE CURRENTLY EXECUTING RAM BANK THEREBY ALLOWING THOSE IMAGES TO BE -; DYNAMICALLY LOADED AS WELL. TO SUPPORT THIS CONCEPT, A PSEUDO-BANK CALLED BID_CUR -; IS USED TO SPECIFY THE IMAGES NORMALLY FOUND IN BID_IMG0. IN GOROM, THIS SPECIAL -; VALUE WILL CAUSE THE ASSOCIATED IMAGE TO BE LOADED FROM THE CURRENTLY EXECUTING BANK -; WHICH WILL BE CORRECT REGARDLESS OF THE LOAD MODE. IMAGES IN OTHER BANKS (BID_IMG1) -; WILL ALWAYS BE LOADED DIRECTLY FROM ROM. -; -; name menu dsky dest-exec source dest-addr img-size source-bank dest desc -; DB DB DB DW DW DW DW DB DB DB -MENU_S: MENU_L("~Monitor$ ", "M", KY_CL, MON_SERIAL, 1000h, MON_LOC, MON_SIZ, BID_CUR, BID_USR, "Monitor$ ") -MENU_1: MENU_L("~CP/M$ ", "C", KY_BK, CPM_ENT, 2000h, CPM_LOC, CPM_SIZ, BID_CUR, BID_USR, "CP/M 80 v2.2$") - MENU_L("~Z-System$", "Z", KY_FW, CPM_ENT, 5000h, CPM_LOC, CPM_SIZ, BID_CUR, BID_USR, "ZSDOS v1.1$ ") -#IF (BIOS == BIOS_WBW) - MENU_L("~Forth$ ", "F", KY_EX, FTH_LOC, 0000h, FTH_LOC, FTH_SIZ, BID_IMG1, BID_USR, "Camel Forth$ ") - MENU_L("~BASIC$ ", "B", KY_DE, BAS_LOC, 1700h, BAS_LOC, BAS_SIZ, BID_IMG1, BID_USR, "Nascom BASIC$") - MENU_L("~T-BASIC$ ", "T", KY_EN, TBC_LOC, 3700h, TBC_LOC, TBC_SIZ, BID_IMG1, BID_USR, "Tasty BASIC$ ") - MENU_L("~PLAY$ ", "P", $FF, GAM_LOC, 4000h, GAM_LOC, GAM_SIZ, BID_IMG1, BID_USR, "Game$ ") - MENU_L("~USER ROM$", "U", $FF, USR_LOC, 7000h, USR_LOC, USR_SIZ, BID_IMG1, BID_USR, "User ROM$ ") -#ENDIF -#IF (DSKYENABLE) - MENU_L("~DSKY$ ", "D", KY_GO, MON_DSKY, 1000h, MON_LOC, MON_SIZ, BID_CUR, BID_USR, "DSKY Monitor$") -#ENDIF - MENU_L("$ ", "E", $FF, EGG_LOC, 0E00h, EGG_LOC, EGG_SIZ, BID_CUR, BID_USR, "Easter Egg$ ") -; -MENU_E .EQU $ ; END OF TABLE -MENU_V .EQU MENU_1 - MENU_S ; LENGTH OF EACH MENU RECORD -MENU_N .EQU ((MENU_E - MENU_S) / MENU_V) ; NUMBER OF MENU ITEMS -; -;================================================================================================== -; SYSTEM REBOOT HANDLER -;================================================================================================== -; -REBOOT: -; - LD DE,STR_REBOOT ; POINT TO MESSAGE - CALL WRITESTR ; PRINT IT -; - ; WAIT FOR MESSAGE TO BE DISPLAYED - LD HL,10000 -REBOOT1: ; LOOP IS 26TS - DEC HL ; 6TS - LD A,H ; 4TS - OR L ; 4TS - JR NZ,REBOOT1 ; 12TS -; -#IF (BIOS == BIOS_WBW) -; -#IF (DSKYENABLE) - LD HL,MSG_BOOT ; POINT TO BOOT MESSAGE - CALL DSKY_SHOWSEG ; DISPLAY MESSAGE -#ENDIF -; - ; SWITCH TO ROM BANK 0 AND JUMP TO ADDRESS 0 - LD A,BID_BOOT ; BOOT BANK - LD HL,0 ; ADDRESS ZERO - CALL HB_BNKCALL ; DOES NOT RETURN -#ENDIF -; -#IF (BIOS == BIOS_UNA) - ; SWITCH TO ROM BANK 0 AND JUMP TO ADDRESS 0 - LD BC,$01FB ; UNA FUNC = SET BANK - LD DE,0 ; ROM BANK 0 - RST 08 ; DO IT - JP 0 ; JUMP TO RESTART ADDRESS -#ENDIF -; -;================================================================================================== -; ROM IMAGE LOAD HANDLER -;================================================================================================== -; -; AT ENTRY, DE POINTS TO THE EXEC ADR FIELD OF THE ACTIVE ROM -; TABLE ENTRY -; -; ROM IMAGES MUST NOT OVERLAY THE SPACE OCCUPIED BY THE LOADER WHICH -; IS $8000-$8FFF. -; -GOROM: PUSH DE ; SAVE ROM TABLE ENTRY EXEC ADR PTR - LD DE,STR_BOOTROM ; ROM LOADING MSG PREFIX - CALL WRITESTR ; PRINT IT -#IF (DSKYENABLE) - LD HL,MSG_LOAD ; POINT TO LOAD MESSAGE - CALL DSKY_SHOWSEG ; DISPLAY MESSAGE -#ENDIF - POP HL ; EXEC ADR TO HL - PUSH HL ; AND RESAVE IT - LD A,10 ; OFFSET TO IMAGE DESC - CALL ADDHLA ; APPLY IT - EX DE,HL ; MOVE TO DE, ORIG VALUE TO HL - CALL WRITESTR ; AND PRINT IT - PRTS("...$") ; ADD SOME DOTS - POP HL ; RESTORE EXEC ADR TO HL -; - LD B,5 ; PUT NEXT FIVE WORDS ON STACK -GOROM1: LD E,(HL) ; (1) EXEC ADR - INC HL ; (2) SOURCE ADR - LD D,(HL) ; (3) DEST ADR - INC HL ; (4) IMAGE SIZE - PUSH DE ; (5) SRC/DEST BANKS - DJNZ GOROM1 ; LOOP TILL DONE -; -#IF (BIOS == BIOS_UNA) -; -; NOTE: UNA HAS NO INTERBANK MEMORY COPY, SO WE CAN ONLY LOAD -; IMAGES FROM THE CURRENT BANK. A SIMPLE LDIR IS USED TO -; RELOCATE THE IMAGES. AT SOME POINT AN UNA INTERBANK COPY -; SHOULD BE IMPLEMENTED HERE. -; - ; COPY IMAGE TO IT'S RUNNING LOCATION - POP HL ; POP AND DISCARD BANKS - POP BC ; GET IMAGE SIZE TO BC - POP DE ; GET DESTINATION ADR TO DE - POP HL ; GET SOURCE ADR TO HL - LDIR ; MOVE IT -; - ; RECORD BOOT INFO - LD BC,$00FB ; GET LOWER PAGE ID - RST 08 ; DE := LOWER PAGE ID == BOOT ROM PAGE - LD L,1 ; BOOT DISK UNIT IS ROM (UNIT ID = 1) - LD BC,$01FC ; UNA FUNC: SET BOOTSTRAP HISTORY - RST 08 ; CALL UNA -; - ; LAUNCH IMAGE W/ USER BANK ACTIVE - ; NOTE: UNA EXEC CHAIN CALL USES ADDRESS ON TOS - CALL NEWLINE2 - LD DE,BID_USR ; TARGET BANK ID - PUSH DE ; ... ON STACK - ;DI ; ENTER WITH INTS DISABLED - JP $FFF7 ; UNA INTER-PAGE EXEC CHAIN -#ELSE -; -; NOTE: CHECK FOR SPECIAL CASE WHERE SOURCE BANK IS BID_CUR. IN THIS CASE -; WE COPY THE IMAGE FROM THE BANK THAT WE ARE CURRENTLY RUNNING IN. THIS -; IS DONE TO SUPPORT THE APPBOOT AND IMGBOOT MODES AS DEFINED IN HBIOS. -; IN THE CASE OF THESE MODES IT IS INTENDED THAT THE IMAGES BE LOADED -; FROM THE CURRENT RAM BANK AND NOT FROM THEIR NORMAL ROM LOCATIONS. -; - ; COPY IMAGE TO IT'S RUNNING LOCATION - POP DE ; GET BANKS (E=SRC, D=DEST) - POP HL ; GET IMAGE SIZE - LD A,E ; SOURCE BANK TO A - CP BID_CUR ; SPECIAL CASE, BID_CUR? - JR NZ,GOROM2 ; IF NOT, GO RIGHT TO COPY - LD A,(HB_CURBNK) ; GET CURRENT BANK - LD E,A ; AND SUBSTITUE THE VALUE -GOROM2: LD B,BF_SYSSETCPY ; HBIOS FUNC: SETUP BANK COPY - RST 08 ; DO IT - POP DE ; GET DEST ADR - POP HL ; GER SOURCE ADR - LD B,BF_SYSBNKCPY ; HBIOS FUNC: PERFORM BANK COPY - RST 08 ; DO IT -; - ; RECORD BOOT INFO - LD A,(HB_CURBNK) ; GET CURRENT BANK ID FROM PROXY DATA - LD B,BF_SYSSET ; HB FUNC: SET HBIOS PARAMETER - LD C,BF_SYSSET_BOOTINFO ; HB SUBFUNC: SET BOOT INFO - LD L,A ; ... AND SAVE AS BOOT BANK - LD DE,$0100 ; BOOT VOLUME (UNIT, SLICE) - RST 08 -; -#IF (DSKYENABLE) - LD HL,MSG_GO ; POINT TO BOOT MESSAGE - CALL DSKY_SHOWSEG ; DISPLAY MESSAGE -#ENDIF -; - ; LAUNCH IMAGE W/ USER BANK ACTIVE - CALL NEWLINE2 - LD A,BID_USR ; ACTIVATE USER BANK - POP HL ; RECOVER EXEC ADDRESS - ;DI ; ENTER WITH INTS DISABLED - CALL HB_BNKCALL ; AND GO - HALT ; WE SHOULD NEVER RETURN!!! -#ENDIF -; -;================================================================================================== -; DISK BOOT HANDLER -;================================================================================================== -; -GOBOOTDISK: - LD (BL_BOOTID),A ; SAVE INCOMING BOOTID -; - ; SET THE INITIAL BOOT UNIT AND SLICE - ;LD A,(BL_BOOTID) ; GET BOOTID - LD (BL_DEVICE),A ; STORE IT - XOR A ; LU DEFAULTS TO 0 - LD (BL_LU),A ; STORE IT -; -#IF (BIOS == BIOS_WBW) -; - LD A,(BL_INPFLG) ; GET INPUT FLAG - CP 1 ; DSKY? - JR Z,GOBOOTDISK1 ; IF SO, SLICE 0 IS ASSUMED -; - LD A,(BL_DEVICE) ; GET BOOT DEVICE - LD C,A ; PUT IN C - LD B,BF_DIODEVICE ; HBIOS: DIO DEVICE FUNC - RST 08 - LD A,D ; DEVICE TYPE TO A - CP DIODEV_IDE ; HARD DISK DEVICE? - JR C,GOBOOTDISK1 ; NOT SLICE WORTHY, SKIP AHEAD -; - LD DE,STR_SLICESEL ; SLICE SELECTION STRING - CALL WRITESTR ; DISPLAY IT - CALL CINUC ; GET THE KEY - CALL COUT ; ECHO KEY -; - LD DE,STR_INVALID ; SETUP IN CASE OF INVALID - CP 13 ; ENTER? - JR Z,GOBOOTDISK1 ; IF SO, DONE - CP '0' ; START OF RANGE? - JP C,MENU ; BACK TO MENU IF TOO LOW - CP '9' + 1 ; END OF RANGE - JP NC,MENU ; BACK TO MENU IF TOO HIGH - SUB '0' ; CONVERT TO BINARY - LD (BL_LU),A ; AND SAVE IT -GOBOOTDISK1: -; -#ENDIF -; - LD DE,STR_BOOTDISK - CALL WRITESTR - LD A,(BL_DEVICE) - CALL PRTDECB - LD DE,STR_BOOTDISK1 - CALL WRITESTR - LD A,(BL_LU) - CALL PRTDECB - PRTS("...$") -#IF (DSKYENABLE) - LD HL,MSG_LOAD ; POINT TO LOAD MESSAGE - CALL DSKY_SHOWSEG ; DISPLAY MESSAGE -#ENDIF -; - LD DE,STR_BOOTREAD ; DISK BOOT MESSAGE - CALL WRITESTR ; PRINT IT -; -#IF (BIOS == BIOS_UNA) - LD A,(BL_BOOTID) ; GET BOOT DEVICE ID - LD B,A ; MOVE TO B -; - ; LOAD SECTOR 2 (BOOT INFO) - LD C,$41 ; UNA FUNC: SET LBA - LD DE,0 ; HI WORD OF LBA IS ALWAYS ZERO - LD HL,2 ; LOAD STARTING INFO SECTOR 2 - RST 08 ; SET LBA - JP NZ,DB_ERR ; HANDLE ERROR -; - LD C,$42 ; UNA FUNC: READ SECTORS - LD DE,BL_INFOSEC ; DEST OF CPM IMAGE - LD L,1 ; SECTORS TO READ - RST 08 ; DO READ - JP NZ,DB_ERR ; HANDLE ERROR -#ELSE - ; CHECK FOR VALID DRIVE LETTER - LD A,(BL_BOOTID) ; BOOT DEVICE TO A - PUSH AF ; SAVE BOOT DEVICE - LD B,BF_SYSGET - LD C,BF_SYSGET_DIOCNT - RST 08 ; E := DISK UNIT COUNT - POP AF ; RESTORE BOOT DEVICE - CP E ; CHECK MAX (INDEX - COUNT) - JP NC,DB_NODISK ; HANDLE INVALID SELECTION -; - ; SENSE MEDIA - LD A,(BL_DEVICE) ; GET DEVICE/UNIT - LD C,A ; STORE IN C - LD B,BF_DIOMEDIA ; DRIVER FUNCTION = DISK MEDIA - LD E,1 ; ENABLE MEDIA CHECK/DISCOVERY - RST 08 ; CALL HBIOS - JP NZ,DB_ERR ; HANDLE ERROR -; - ; SEEK TO SECTOR 2 OF LU - LD A,(BL_LU) ; GET LU SPECIFIED - LD E,A ; LU INDEX - LD H,65 ; 65 TRACKS PER LU - CALL MULT8 ; HL := H * E - LD DE,$02 ; HEAD 0, SECTOR 2 - LD B,BF_DIOSEEK ; SETUP FOR NEW SEEK CALL - LD A,(BL_DEVICE) ; GET BOOT DISK UNIT - LD C,A ; PUT IN C - RST 08 ; DO IT - JP NZ,DB_ERR ; HANDLE ERROR -; - ; READ - LD B,BF_DIOREAD ; FUNCTION IN B - LD A,(BL_DEVICE) ; GET BOOT DISK UNIT - LD C,A ; PUT IN C - LD HL,BL_INFOSEC ; READ INTO INFO SEC BUFFER - LD D,BID_USR ; USER BANK ; - LD E,1 ; TRANSFER ONE SECTOR - RST 08 ; DO IT - JP NZ,DB_ERR ; HANDLE ERROR -; -#ENDIF -; - ; CHECK SIGNATURE - LD DE,(BB_SIG) ; GET THE SIGNATURE - LD A,$A5 ; FIRST BYTE SHOULD BE $A5 - CP D ; COMPARE - JP NZ,DB_NOBOOT ; ERROR IF NOT EQUAL - LD A,$5A ; SECOND BYTE SHOULD BE $5A - CP E ; COMPARE - JP NZ,DB_NOBOOT ; ERROR IS NOT EQUAL -; - ; PRINT CPMLOC VALUE - PRTS("\r\nLoc=$") - LD BC,(BB_CPMLOC) - CALL PRTHEXWORD -; - ; PRINT CPMEND VALUE - PRTS(" End=$") - LD BC,(BB_CPMEND) - CALL PRTHEXWORD -; - ; PRINT CPMENT VALUE - PRTS(" Ent=$") - LD BC,(BB_CPMENT) - CALL PRTHEXWORD -; - ; PRINT DISK LABEL - PRTS(" Label=$") - LD DE,BB_LABEL ; if it is there, then a printable - LD A,(BB_TERM) ; Display Disk Label if Present - CP '$' ; (dwg 2/7/2012) - CALL Z,WRITESTR ; label is there as well even if spaces. -; - LD DE,STR_LOADING ; LOADING MESSAGE - CALL WRITESTR ; PRINT IT -; - ; COMPUTE NUMBER OF SECTORS TO LOAD - LD HL,(BB_CPMEND) ; HL := END - LD DE,(BB_CPMLOC) ; DE := START - OR A ; CLEAR CARRY - SBC HL,DE ; HL := LENGTH TO LOAD - LD A,H ; DETERMINE 512 BYTE SECTOR COUNT - RRA ; ... BY DIVIDING MSB BY TWO - LD (BL_COUNT),A ; ... AND SAVE IT -; -#IF (BIOS == BIOS_UNA) -; - ; START OS LOAD AT SECTOR 3 - LD C,$41 ; UNA FUNC: SET LBA - LD A,(BL_BOOTID) ; GET BOOT DEVICE ID - LD B,A ; MOVE TO B - LD DE,0 ; HI WORD OF LBA IS ALWAYS ZERO - LD HL,3 ; LOAD STARTING INFO SECTOR 2 - RST 08 ; SET LBA - JP NZ,DB_ERR ; HANDLE ERROR -; - ; READ OS IMAGE INTO MEMORY - LD C,$42 ; UNA FUNC: READ SECTORS - LD A,(BL_BOOTID) ; GET BOOT DEVICE ID - LD B,A ; MOVE TO B - LD DE,(BB_CPMLOC) ; DEST OF CPM IMAGE - LD A,(BL_COUNT) ; GET SECTORS TO READ - LD L,A ; SECTORS TO READ - RST 08 ; DO READ - JP NZ,DB_ERR ; HANDLE ERROR -; - ; PASS BOOT DEVICE/UNIT/LU TO CBIOS COLD BOOT - LD DE,-1 ; BOOT ROM PAGE, -1 FOR N/A - LD A,(BL_BOOTID) ; GET BOOT DISK UNIT ID - LD L,A ; PUT IN L - LD BC,$01FC ; UNA FUNC: SET BOOTSTRAP HISTORY - RST 08 ; CALL UNA - JP NZ,DB_ERR ; HANDLE ERROR -; - ; JUMP TO COLD BOOT ENTRY - LD HL,(BB_CPMENT) ; GET THE ENTRY POINT - PUSH HL ; PUT ON STACK FOR UNA CHAIN FUNC - LD DE,BID_USR ; TARGET BANK ID IS USER BANK - PUSH DE ; PUT ON STACK FOR UNA CHAIN FUNC - ;DI ; ENTER WITH INTS DISABLED - JP $FFF7 ; UNA INTER-PAGE EXEC CHAIN -; -#ELSE -; - ; READ OS IMAGE INTO MEMORY - LD B,BF_DIOREAD ; FUNCTION IN B - LD A,(BL_DEVICE) ; GET BOOT DISK UNIT - LD C,A ; PUT IN C - LD HL,(BB_CPMLOC) ; LOAD ADDRESS - LD D,BID_USR ; USER BANK - LD A,(BL_COUNT) ; GET SECTORS TO READ - LD E,A ; NUMBER OF SECTORS TO LOAD - RST 08 - JP NZ,DB_ERR ; HANDLE ERRORS -; - ; PASS BOOT DEVICE/UNIT/LU TO CBIOS COLD BOOT - LD B,BF_SYSSET ; HB FUNC: SET HBIOS PARAMETER - LD C,BF_SYSSET_BOOTINFO ; HB SUBFUNC: SET BOOT INFO - LD A,(HB_CURBNK) ; GET CURRENT BANK ID FROM PROXY DATA - LD L,A ; ... AND SAVE AS BOOT BANK - LD A,(BL_DEVICE) ; LOAD BOOT DEVICE/UNIT - LD D,A ; SAVE IN D - LD A,(BL_LU) ; LOAD BOOT LU - LD E,A ; SAVE IN E - RST 08 - JP NZ,DB_ERR ; HANDLE ERRORS -; -#IF (DSKYENABLE) - LD HL,MSG_GO ; POINT TO BOOT MESSAGE - CALL DSKY_SHOWSEG ; DISPLAY MESSAGE -#ENDIF -; - ; JUMP TO COLD BOOT ENTRY - LD A,BID_USR ; ACTIVATE USER BANK - LD HL,(BB_CPMENT) ; OS ENTRY ADDRESS - ;DI ; ENTER WITH INTS DISABLED - CALL HB_BNKCALL ; AND GO - HALT ; WE SHOULD NEVER RETURN!!! -; -#ENDIF -; -DB_NODISK: - ; SELDSK DID NOT LIKE DRIVE SELECTION - LD DE,STR_NODISK - JP MENU -; -DB_NOBOOT: - ; DISK IS NOT BOOTABLE - LD DE,STR_NOBOOT - JP MENU -; -DB_ERR: - ; I/O ERROR DURING BOOT ATTEMPT - LD DE,STR_BOOTERR - JP MENU -; -#IF (BIOS == BIOS_UNA) -; -; PRINT LIST OF ALL DRIVES UNDER UNA -; -PRTALL: - LD B,0 ; START WITH UNIT 0 -; -PRTALL1: ; LOOP THRU ALL UNITS AVAILABLE - LD C,$48 ; UNA FUNC: GET DISK TYPE - LD L,0 ; PRESET UNIT COUNT TO ZERO - RST 08 ; CALL UNA, B IS ASSUMED TO BE UNTOUCHED!!! - LD A,L ; UNIT COUNT TO A - OR A ; PAST END? - RET Z ; WE ARE DONE - PUSH BC ; SAVE UNIT - CALL PRTDRV ; PROCESS THE UNIT - POP BC ; RESTORE UNIT - INC B ; NEXT UNIT - JR PRTALL1 ; LOOP -; -; PRINT THE UNA UNIT INFO -; ON INPUT B HAS UNIT -; -PRTDRV: - PUSH BC ; SAVE UNIT - PUSH DE ; SAVE DISK TYPE - LD A,'(' ; NEWLINE AND SPACING - CALL COUT ; PRINT IT - LD A,B ; DRIVE LETTER TO A - CALL PRTDECB - LD A,')' ; DRIVE LETTER COLON - CALL COUT ; PRINT IT - POP DE ; RECOVER DISK TYPE - LD A,D ; DISK TYPE TO A - CP $40 ; RAM/ROM? - JR Z,PRTDRV1 ; HANDLE RAM/ROM - LD DE,DEVIDE ; ASSUME IDE - CP $41 ; IDE? - JR Z,PRTDRV2 ; PRINT IT - LD DE,DEVPPIDE ; ASSUME PPIDE - CP $42 ; PPIDE? - JR Z,PRTDRV2 ; PRINT IT - LD DE,DEVSD ; ASSUME SD - CP $43 ; SD? - JR Z,PRTDRV2 ; PRINT IT - LD DE,DEVDSD ; ASSUME DSD - CP $44 ; DSD? - JR Z,PRTDRV2 ; PRINT IT - LD DE,DEVUNK ; OTHERWISE UNKNOWN - JR PRTDRV2 -; -PRTDRV1: ; HANDLE RAM/ROM - LD C,$45 ; UNA FUNC: GET DISK INFO - LD DE,BL_INFOSEC ; 512 BYTE BUFFER - RST 08 ; CALL UNA - BIT 7,B ; TEST RAM DRIVE BIT - LD DE,DEVROM ; ASSUME ROM - JR Z,PRTDRV2 ; IF SO, PRINT IT - LD DE,DEVRAM ; OTHERWISE RAM - JR PRTDRV2 ; PRINT IT -; -PRTDRV2: ; PRINT DEVICE - POP BC ; RECOVER UNIT - CALL WRITESTR ; PRINT DEVICE NAME - LD A,B ; UNIT TO A - ADD A,'0' ; MAKE IT PRINTABLE NUMERIC - CALL COUT ; PRINT IT - LD A,',' ; DEVICE NAME SEPARATOR - CALL COUT ; PRINT IT - RET ; DONE -; -DEVRAM .DB "RAM$" -DEVROM .DB "ROM$" -DEVIDE .DB "IDE$" -DEVPPIDE .DB "PPIDE$" -DEVSD .DB "SD$" -DEVDSD .DB "DSD$" -DEVUNK .DB "UNK$" -; -#ELSE -; -; PRINT LIST OF ALL DRIVES -; -PRTALL: -; - LD B,BF_SYSGET - LD C,BF_SYSGET_DIOCNT - RST 08 ; E := DISK UNIT COUNT - LD B,E ; COUNT TO B - LD A,B ; COUNT TO A - OR A ; SET FLAGS - RET Z ; BAIL OUT IF ZERO - LD C,0 ; INIT DEVICE INDEX -; -PRTALL1: - LD A,'(' ; FORMATTING - CALL COUT ; PRINT IT - LD A,C ; INDEX TO A - CALL PRTDECB - LD A,')' ; FORMATTING - CALL COUT ; PRINT IT - PUSH BC ; SAVE LOOP CONTROL - LD B,BF_DIODEVICE ; HBIOS FUNC: REPORT DEVICE INFO - RST 08 ; CALL HBIOS - CALL PRTDRV ; PRINT IT - POP BC ; RESTORE LOOP CONTROL - INC C ; BUMP INDEX - DJNZ PRTALL1 ; LOOP AS NEEDED - RET ; DONE -; -; PRINT THE DRIVER DEVICE/UNIT INFO -; ON INPUT D HAS DRIVER ID, E HAS DRIVER MODE/UNIT -; DESTROY NO REGISTERS OTHER THAN A -; -PRTDRV: - 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,E ; LOAD DRIVER MODE/UNIT - AND $0F ; ISOLATE UNIT - CALL PRTDECB ; PRINT IT - CALL PC_SPACE ; FORMATTING - ;LD A,E ; LOAD LU - ;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 -; -;================================================================================================== -; STRINGS -;================================================================================================== -; -STR_BANNER .DB "\r\n\r\n", PLATFORM_NAME, " Boot Loader$" -STR_BOOTSEL .DB "\r\n\r\nBoot Selection? $" -STR_SLICESEL .DB " Slice(0-9)[0]? $" -STR_BOOTDISK .DB "\r\n\r\nBooting Disk Unit $" -STR_BOOTDISK1 .DB ", Slice $" -STR_BOOTROM .DB "\r\n\r\nLoading $" -STR_REBOOT .DB "\r\n\r\nRestarting System...$" -STR_INVALID .DB "\r\n\r\n*** Invalid Selection ***$" -STR_NODISK .DB "\r\n\r\nNo disk!$" -STR_NOBOOT .DB "\r\n\r\nDisk not bootable!$" -STR_BOOTERR .DB "\r\n\r\nBoot failure!$" -STR_BOOTREAD .DB "\r\n\r\nReading disk information...$" -STR_LOADING .DB "\r\n\r\nLoading...$" -; -#IF (DSKYENABLE) -MSG_SEL .DB $FF,$9D,$9D,$8F,$EC,$80,$80,$80 ; "Boot? " -MSG_BOOT .DB $FF,$9D,$9D,$8F,$00,$00,$00,$80 ; "Boot... " -MSG_LOAD .DB $8B,$9D,$FD,$BD,$00,$00,$00,$80 ; "Load... " -MSG_GO .DB $DB,$9D,$00,$00,$00,$80,$80,$80 ; "Go... " -#ENDIF + ret +; +; Device list +; +devlst: + jp prtall ; do it +; +; Set console interface unit +; +#if (BIOS == BIOS_WBW) +; +setcon: + ; On entry DE is expected to be pointing to start + ; of command. Get unit number. + call findws ; skip command + call skipws ; and skip it + call isnum ; do we have a number? + jp nz,err_invcmd ; if not, invalid + call getnum ; parse number into A + jp c,err_nocon ; handle overflow error +; + ; Check against max char unit + push de + push af ; save requested unit + ld b,BF_SYSGET ; HBIOS func: SYS GET + ld c,BF_SYSGET_CIOCNT ; HBIOS subfunc: CIO unit count + rst 08 ; E := unit count + pop af ; restore requested unit + cp e ; compare + pop de + jp nc,err_nocon ; handle invalid unit + ld (newcon),a ; save validated console +; + ; Get baud rate + call findws + call skipws ; skip whitespace + call isnum ; do we have a number? + jp nz,docon ; if no we don't change baudrate + call getbnum ; return in HL:BC +; + ld e,32 ; search baud rate table + push de ; for a matching entry + ld de,tbl_baud +nextbaud: + ex de,hl ; hl = tbl_baud, de = msw + ld a,d ; check all four bytes + cp (hl) ; against HL:BC + inc hl ; exit to next table + jr nz,mm1 ; entry on mismatch + ld a,e + cp (hl) + inc hl + jr nz,mm2 + ld a,b + cp (hl) + inc hl + jr nz,mm3 + ld a,c + cp (hl) + inc hl + jr nz,mm4 +; + ; we have a match + pop de ; get our count value + ld a,32 + sub e + jr setspd +; +mm1: inc hl +mm2: inc hl +mm3: inc hl +mm4: ex (sp),hl ; hl = count value, stack = tbl_baud, de = msw + dec l + ex (sp),hl ; hl = tbl_baud, stack= count + ex de,hl ; hl = msw, de = tbl_baud + jr nz,nextbaud +; + ; Failed to match + pop de + jp err_invcmd +; +setspd: ld (newspeed),a ; save validated baud rate +; + ld hl,str_chspeed ; notify user + call pstr ; to change + call cin ; speed +; + ; Get the current settings for chosen console + ld b,BF_CIOQUERY ; BIOS serial device query + ld a,(newcon) ; get device unit num + ld c,a ; ... and put in C + rst 08 ; call H/UBIOS, DE := line characteristics + jp nz,err_invcmd ; abort on error +; + ld a,d ; mask off current + and $11100000 ; baud rate + ld hl,newspeed ; and load in new + or (hl) ; baud rate + ld d,a +; + ld b,BF_CIOINIT ; BIOS serial init + ld a,(newcon) ; get serial device unit + ld c,a ; ... into C + rst 08 ; call HBIOS + jp nz,err_invcmd ; handle error +; + ; Notify user, we're outta here.... +docon: ld hl,str_newcon ; new console msg + call pstr ; print string on cur console + ld a,(newcon) ; restore new console unit + call prtdecb ; print unit num +; + ; Set console unit + ld b,BF_SYSPOKE ; HBIOS func: POKE + ld d,BID_BIOS ; BIOS bank + ld e,a ; Char unit value + ld hl,HCB_LOC + HCB_CONDEV ; Con unit num in HCB + rst 08 ; do it +; + ; Display loader prompt on new console + call nl2 ; formatting + ld hl,str_banner ; display boot banner + call pstr ; do it + ret +; +;======================================================================= +; Get numeric chars at DE and convert to BCD number returned in HL:BC +;======================================================================= +; +getbnum:ld bc,0 ; lsw + ld hl,0 ; msw +getbnum1: + ld a,(de) ; get the active char + cp '0' ; compare to ascii '0' + jr c,getbnum2 ; abort if below + cp '9' + 1 ; compare to ascii '9' + jr nc,getbnum2 ; abort if above +; + sub '0' ; convert '0'-'9' to 0-9 +; + push de ; save char posn + push hl ; save hl bcd +; + ld hl,tmpbcd ; rotate 1 nyble in A + ld (hl),c ; through HL:BC + rld + ld c,(hl) + ld (hl),b + rld + ld b,(hl) + pop de ; get hl bcd + ld (hl),e + rld + ld e,(hl) + ld (hl),d + rld + ld d,(hl) + ld h,d + ld l,e +; + pop de ; get char posn + inc de ; bump to next char + jr getbnum1 ; loop +; +getbnum2: + or a ; with flags set, CF is cleared + ret +; +tmpbcd: .db 0 +; +#DEFINE PACK(a,b,c,d,e,f,g) \ +#DEFCONT \ .db (16*('0'-'0'))+(a-'0')) +#DEFCONT \ .db (16*(b-'0'))+(c-'0')) +#DEFCONT \ .db (16*(d-'0'))+(e-'0')) +#DEFCONT \ .db (16*(f-'0'))+(g-'0')) +; +tbl_baud: + PACK('0','0','0','0','0','7','5') ; 75 0 > 0 + PACK('0','0','0','0','1','5','0') ; 150 1 > 1 + PACK('0','0','0','0','3','0','0') ; 300 3 > 2 + PACK('0','0','0','0','6','0','0') ; 600 5 > 3 + PACK('0','0','0','1','2','0','0') ; 1200 7 > 4 + PACK('0','0','0','2','4','0','0') ; 2400 9 > 5 + PACK('0','0','0','4','8','0','0') ; 4800 11 > 6 + PACK('0','0','0','9','6','0','0') ; 9600 13 > 7 + PACK('0','0','1','9','2','0','0') ; 19200 15 > 8 + PACK('0','0','3','8','4','0','0') ; 38400 17 > 9 + PACK('0','0','7','6','8','0','0') ; 76800 19 > 10 + PACK('0','1','5','3','6','0','0') ; 153600 21 > 11 + PACK('0','3','0','7','2','0','0') ; 307200 23 > 12 + PACK('0','6','1','4','4','0','0') ; 614400 25 > 13 + PACK('1','2','2','8','8','0','0') ; 1228800 27 > 14 + PACK('2','4','5','7','6','0','0') ; 2457600 29 > 15 + PACK('0','0','0','0','2','2','5') ; 225 2 > 16 + PACK('0','0','0','0','4','5','0') ; 450 4 > 17 + PACK('0','0','0','0','9','0','0') ; 900 6 > 18 + PACK('0','0','0','1','8','0','0') ; 1800 8 > 19 + PACK('0','0','0','3','6','0','0') ; 3600 10 > 20 + PACK('0','0','0','7','2','0','0') ; 7200 12 > 21 + PACK('0','0','1','4','4','0','0') ; 14400 14 > 22 + PACK('0','0','2','8','8','0','0') ; 28800 16 > 23 + PACK('0','0','5','7','6','0','0') ; 57600 18 > 24 + PACK('0','1','1','5','2','0','0') ; 115200 20 > 25 + PACK('0','2','3','0','4','0','0') ; 230400 22 > 26 + PACK('0','4','6','0','8','0','0') ; 460800 24 > 27 + PACK('0','9','2','1','6','0','0') ; 921600 26 > 28 + PACK('1','8','4','3','2','0','0') ; 1843200 28 > 29 + PACK('3','6','8','6','4','0','0') ; 3686400 30 > 30 + PACK('7','3','7','2','8','0','0') ; 7372800 31 > 31 +#endif +; +; Set RomWBW HBIOS Diagnostic Level +; +#if (BIOS == BIOS_WBW) +; +setdl: + ; On entry DE is expected to be pointing to start + ; of command + call findws ; skip command + call skipws ; and skip it + or a ; set flags to check for null + jr z,showdl ; no parm, just display + call isnum ; do we have a number? + jp nz,err_invcmd ; if not, invalid + call getnum ; parse number into A + jp c,err_invcmd ; handle overflow error +; + ; Set diagnostic level + ld b,BF_SYSPOKE ; HBIOS func: POKE + ld d,BID_BIOS ; BIOS bank + ld e,a ; diag level value + ld hl,HCB_LOC + HCB_DIAGLVL ; offset into HCB + rst 08 ; do it + ; Fall thru to display new value +; +showdl: + ; Display current diagnostic level + ld hl,str_diaglvl ; diag level tag + call pstr ; print it + ld b,BF_SYSPEEK ; HBIOS func: PEEK + ld d,BID_BIOS ; BIOS bank + ld hl,HCB_LOC + HCB_DIAGLVL ; offset into HCB + rst 08 ; do it, E := level value + ld a,e ; put in accum + call prtdecb ; print it + ret ; done +; +#endif +; +; Restart system +; +reboot: + ld hl,str_reboot ; point to message + call pstr ; print it + call ldelay ; wait for message to display +; +#if (BIOS == BIOS_WBW) +; +#if (DSKYENABLE) + ld hl,msg_boot ; point to boot message + call DSKY_SHOW ; display message +#endif +; + ; cold boot system + ld b,BF_SYSRESET ; system restart + ld c,BF_SYSRES_COLD ; cold start + rst 08 ; do it, no return +#endif +; +#if (BIOS == BIOS_UNA) + ; switch to rom bank 0 and jump to address 0 + ld bc,$01FB ; UNA func = set bank + ld de,0 ; ROM bank 0 + rst 08 ; do it + jp 0 ; jump to restart address +#endif +; +;======================================================================= +; Load and run a ROM application, IX=ROM app table entry +;======================================================================= +; +romload: +; + ; Notify user + ld hl,str_load + call pstr + ld l,(ix+ra_name) + ld h,(ix+ra_name+1) + call pstr +; +#if (DSKYENABLE) + ld hl,msg_load ; point to load message + call DSKY_SHOW ; display message +#endif +; +#if (BIOS == BIOS_WBW) +; + ; Copy image to it's running location + ld a,(ix+ra_bnk) ; get image source bank id + cp bid_cur ; special value? + jr nz,romload1 ; if not, continue + ld a,(bid_ldr) ; else substitute +romload1: + push af ; save source bank + ld e,a ; source bank to E + ld d,BID_USR ; dest is user bank + ld l,(ix+ra_siz) ; HL := image size + ld h,(ix+ra_siz+1) ; ... + ld b,BF_SYSSETCPY ; HBIOS func: setup bank copy + rst 08 ; do it + ld a,'.' ; dot character + call cout ; show progress + ld e,(ix+ra_dest) ; DE := run dest adr + ld d,(ix+ra_dest+1) ; ... + ld l,(ix+ra_src) ; HL := image source adr + ld h,(ix+ra_src+1) ; ... + ld b,BF_SYSBNKCPY ; HBIOS func: bank copy + rst 08 ; do it + ld a,'.' ; dot character + call cout ; show progress +; + ; Record boot information + pop af ; recover source bank + ld l,a ; L := source bank + ld de,$0000 ; boot vol=0, slice=0 + ld b,BF_SYSSET ; HBIOS func: system set + ld c,BF_SYSSET_BOOTINFO ; BBIOS subfunc: boot info + rst 08 ; do it + ld a,'.' ; dot character + call cout ; show progress +; +#endif +; +#if (BIOS == BIOS_UNA) +; +; Note: UNA has no interbank memory copy, so we can only load +; images from the current bank. We switch to the original bank +; use a simple ldir to relocate the image, then switch back to the +; user bank to launch. This will only work if the images are in +; the lower 32K and the relocation adr is in the upper 32K. +; + ; Switch to original bank + ld bc,$01FB ; UNA func: set bank + ld de,(bid_ldr) ; select user bank + rst 08 ; do it + ld a,'.' ; dot character + call cout ; show progress +; + ; Copy image to running location + ld l,(ix+ra_src) ; HL := image source adr + ld h,(ix+ra_src+1) ; ... + ld e,(ix+ra_dest) ; DE := run dest adr + ld d,(ix+ra_dest+1) ; ... + ld c,(ix+ra_siz) ; BC := image size + ld b,(ix+ra_siz+1) ; ... + ldir ; copy image + ld a,'.' ; dot character + call cout ; show progress +; + ; Switch back to user bank + ld bc,$01FB ; UNA func: set bank + ld de,(bid_ldr) ; select user bank + rst 08 ; do it + ld a,'.' ; dot character + call cout ; show progress +; + ; Record boot information + ld de,(bid_ldr) ; original bank + ld l,$01 ; encoded boot slice/unit + ld bc,$01FC ; UNA func: set bootstrap hist + rst 08 ; call una +; +#endif +; +#if (DSKYENABLE) + ld hl,msg_go ; point to go message + call DSKY_SHOW ; display message +#endif +; + ld l,(ix+ra_ent) ; HL := app entry address + ld h,(ix+ra_ent+1) ; ... + jp (hl) ; go +; +;======================================================================= +; Boot disk unit/slice +;======================================================================= +; +diskboot: +; + ; Notify user + ld hl,str_boot1 + call pstr + ld a,(bootunit) + call prtdecb + ld hl,str_boot2 + call pstr + ld a,(bootslice) + call prtdecb +; +#if (DSKYENABLE) + ld hl,msg_load ; point to load message + call DSKY_SHOW ; display message +#endif +; +#if (BIOS == BIOS_WBW) +; + ; Check that drive actually exists + ld b,BF_SYSGET ; HBIOS func: sys get + ld c,BF_SYSGET_DIOCNT ; HBIOS sub-func: disk count + rst 08 ; do it, E=disk count + ld a,(bootunit) ; get boot disk unit + cp e ; compare to count + jp nc,err_nodisk ; handle no disk err +; + ; Sense media + ld a,(bootunit) ; get boot disk unit + ld c,a ; put in C for func call + ld b,BF_DIOMEDIA ; HBIOS func: media + ld e,1 ; enable media check/discovery + rst 08 ; do it + jp nz,err_diskio ; handle error + ld a,e ; media id to A + ld (mediaid),a ; save media id +; + ; If non-zero slice requested, confirm device can handle it + ld a,(bootslice) ; get slice + or a ; set flags + jr z,diskboot1 ; slice 0, skip slice check + ld a,(bootunit) ; get disk unit + ld c,a ; put in C for func call + ld b,BF_DIODEVICE ; HBIOS func: device info + rst 08 ; do it + ld a,d ; device type to A + cp DIODEV_IDE ; IDE is max slice device type + jp c,err_noslice ; no such slice, handle err +; +#endif +; +#if (BIOS == BIOS_UNA) +; + ; Check that drive actually exists + ld a,(bootunit) ; get disk unit to boot + ld b,a ; put in B for func call + ld c,$48 ; UNA func: get disk type + rst 08 ; call UNA, B preserved + jp nz,err_nodisk ; handle error if no such disk +; + ; If non-zero slice requested, confirm device can handle it + ld a,(bootslice) ; get slice + or a ; set flags + jr z,diskboot0 ; slice 0, skip slice check + ld a,d ; disk type to A + cp $41 ; IDE? + jr z,diskboot0 ; if so, OK + cp $42 ; PPIDE? + jr z,diskboot0 ; if so, OK + cp $43 ; SD? + jr z,diskboot0 ; if so, OK + cp $44 ; DSD? + jr z,diskboot0 ; if so, OK + jp err_noslice ; no such slice, handle err +; +diskboot0: + ; Below is wrong. It assumes we are booting from a hard + ; disk, but it could also be a RAM/ROM disk. However, it is + ; not actually possible to boot from those, so not gonna + ; worry about this. + ld a,4 ; assume legacy hard disk + ld (mediaid),a ; save media id +; +#endif +; +diskboot1: + ; Initialize working LBA value + ld hl,0 ; zero HL + ld (lba),hl ; init + ld (lba+2),hl ; ... LBA +; + ; Set legacy sectors per slice + ld hl,16640 ; legacy sectors per slice + ld (sps),hl ; save it +; + ; Check for hard disk + ld a,(mediaid) ; load media id + cp 4 ; legacy hard disk? + jr nz,diskboot8 ; if not hd, no part table +; + ; Attempt to read MBR + ld de,0 ; MBR is at + ld hl,0 ; ... first sector + ld bc,bl_mbrsec ; read into MBR buffer + ld (dma),bc ; save + ld b,1 ; one sector + ld a,(bootunit) ; get bootunit + ld c,a ; put in C + call diskread ; do it + ret nz ; abort on error +; + ; Check signature + ld hl,(bl_mbrsec+$1FE) ; get signature + ld a,l ; first byte + cp $55 ; should be $55 + jr nz,diskboot4 ; if not, no part table + ld a,h ; second byte + cp $AA ; should be $AA + jr nz,diskboot4 ; if not, no part table +; + ; Try to find our entry in part table and capture lba offset + ld b,4 ; four entries in part table + ld hl,bl_mbrsec+$1BE+4 ; offset of first entry part type +diskboot2: + ld a,(hl) ; get part type + cp $2E ; cp/m partition? + jr z,diskboot3 ; cool, grab the lba offset + ld de,16 ; part table entry size + add hl,de ; bump to next entry part type + djnz diskboot2 ; loop thru table + jr diskboot4 ; too bad, no cp/m partition +; +diskboot3: + ; Capture the starting LBA of the CP/M partition we found + ld de,4 ; LBA is 4 bytes after part type + add hl,de ; point to it + ld de,lba ; loc to store lba offset + ld bc,4 ; 4 bytes (32 bits) + ldir ; copy it + ; If boot from partition, use new sectors per slice value + ld hl,16384 ; new sectors per slice + ld (sps),hl ; save it +; +diskboot4: + ; Add slice offset + ld a,(bootslice) ; get boot slice, A is loop cnt + ld hl,(lba) ; set DE:HL + ld de,(lba+2) ; ... to starting LBA + ld bc,(sps) ; sectors per slice +diskboot5: + or a ; set flags to check loop ctr + jr z,diskboot7 ; done if counter exhausted + add hl,bc ; add one slice to low word + jr nc,diskboot6 ; check for carry + inc de ; if so, bump high word +diskboot6: + dec a ; dec loop downcounter + jr diskboot5 ; and loop +; +diskboot7: + ld (lba),hl ; update lba, low word + ld (lba+2),de ; update lba, high word +; +diskboot8: + ; Note that we could be coming from diskboot1! + ld hl,str_ldsec ; display prefix + call pstr ; do it + ld hl,(lba) ; recover lba loword + ld de,(lba+2) ; recover lba hiword + call prthex32 ; display starting sector + call pdot ; show progress +; + ; Read boot info sector, third sector + ld bc,2 ; sector offset + add hl,bc ; add to LBA value low word + jr nc,diskboot9 ; check for carry + inc de ; if so, bump high word +diskboot9: + ld bc,bl_infosec ; read buffer + ld (dma),bc ; save + ld a,(bootunit) ; disk unit to read + ld c,a ; put in C + ld b,1 ; one sector + call diskread ; do it + ret nz ; abort on error + call pdot ; show progress +; + ; Check signature + ld de,(bb_sig) ; get signature read + ld a,$A5 ; expected value of first byte + cp d ; compare + jp nz,err_sig ; handle error + ld a,$5A ; expected value of second byte + cp e ; compare + jp nz,err_sig ; handle error + call pdot ; show progress +; + ; Print disk boot info + ; Volume "xxxxxxx" (0xXXXX-0xXXXX, entry @ 0xXXXX) + ld hl,str_binfo1 ; load string + call pstr ; print + push hl ; save string ptr + ld hl,bb_label ; point to label + call pvol ; print it + pop hl ; restore string ptr + call pstr ; print + push hl ; save string ptr + ld bc,(bb_cpmloc) ; get load loc + call prthexword ; print it + pop hl ; restore string ptr + call pstr ; print + push hl ; save string ptr + ld bc,(bb_cpmend) ; get load end + call prthexword ; print it + pop hl ; restore string ptr + call pstr ; print + push hl ; save string ptr + ld bc,(bb_cpment) ; get load end + call prthexword ; print it + pop hl ; restore string ptr + call pstr ; print +; + ; Compute number of sectors to load + ld hl,(bb_cpmend) ; hl := end + ld de,(bb_cpmloc) ; de := start + or a ; clear carry + sbc hl,de ; hl := length to load + ; If load length is not a multiple of sector size (512) + ; we need to round up to get everything loaded! + ld de,511 ; 1 less than sector size + add hl,de ; ... and roundup + ld a,h ; determine 512 byte sector count + rra ; ... by dividing msb by two + ld (loadcnt),a ; ... and save it + call pdot ; show progress +; + ; Start OS load at sector 3 + ld hl,(lba) ; low word of saved LBA + ld de,(lba+2) ; high word of saved LBA + ld bc,3 ; offset for sector 3 + add hl,bc ; apply it + jr nc,diskboot10 ; check for carry + inc de ; bump high word if so +diskboot10: + ld bc,(bb_cpmloc) ; load address + ld (dma),bc ; and save it + ld a,(loadcnt) ; get sectors to read + ld b,a ; put in B + ld a,(bootunit) ; get boot disk unit + ld c,a ; put in C + call diskread ; read image + ret nz ; abort on error + call pdot ; show progress +; +#if (BIOS == BIOS_WBW) +; + ; Record boot unit/slice + ld b,BF_SYSSET ; hb func: set hbios parameter + ld c,BF_SYSSET_BOOTINFO ; hb subfunc: set boot info + ld a,(bid_ldr) ; original bank is boot bank + ld l,a ; ... and save as boot bank + ld a,(bootunit) ; load boot unit + ld d,a ; save in D + ld a,(bootslice) ; load boot slice + ld e,a ; save in E + rst 08 + jp nz,err_api ; handle errors +; +#endif +; +#if (BIOS == BIOS_UNA) +; + ; Record boot unit/slice + ; UNA provides only a single byte to record the boot unit + ; so we encode the unit/slice into one byte by using the + ; high nibble for unit and low nibble for slice. + ld de,-1 ; boot rom page, -1 for n/a + ld a,(bootslice) ; get boot slice + and $0F ; 4 bits only + rlca ; rotate to high bits + rlca ; ... + rlca ; ... + rlca ; ... + ld l,a ; put in L + ld a,(bootunit) ; get boot disk unit + and $0F ; 4 bits only + or l ; combine + ld l,a ; back to L + ld bc,$01FC ; UNA func: set bootstrap hist + rst 08 ; call UNA + jp nz,err_api ; handle error +; +#endif +; + call pdot ; show progress +; +#if (DSKYENABLE) + ld hl,msg_go ; point to go message + call DSKY_SHOW ; display message +#endif +; + ; Jump to entry vector + ld hl,(bb_cpment) ; get entry vector + jp (hl) ; and go there +; +; Read disk sector(s) +; DE:HL is LBA, B is sector count, C is disk unit +; +diskread: +; +#if (BIOS == BIOS_UNA) +; + ; Seek to requested sector in DE:HL + push bc ; save unit and count + ld b,c ; unit to read in B + ld c,$41 ; UNA func: set lba + rst 08 ; set lba + pop bc ; recover unit and count + jp nz,err_api ; handle error +; + ; Read sector(s) into buffer + ld l,b ; sectors to read + ld b,c ; unit to read in B + ld c,$42 ; UNA func: read sectors + ld de,(dma) ; dest for read + rst 08 ; do read + jp nz,err_diskio ; handle error + xor a ; signal success + ret ; and done +; +#endif +; +#if (BIOS == BIOS_WBW) +; + ; Seek to requested sector in DE:HL + push bc ; save unit & count + set 7,d ; set LBA access flag + ld b,BF_DIOSEEK ; HBIOS func: seek + rst 08 ; do it + pop bc ; recover unit & count + jp nz,err_diskio ; handle error +; + ; Read sector(s) into buffer + ld e,b ; transfer count + ld b,BF_DIOREAD ; HBIOS func: disk read + ld hl,(dma) ; read into info sec buffer + ld d,BID_USR ; user bank + rst 08 ; do it + jp nz,err_diskio ; handle error + xor a ; signal success + ret ; and done +; +#endif +; +;======================================================================= +; Utility functions +;======================================================================= +; +; Clear LEDs +; +clrled: +#if (BIOS == BIOS_WBW) + #if (DIAGENABLE) + xor a ; zero accum + out (DIAGPORT),a ; clear diag leds + #endif + #if (LEDENABLE) + #if (LEDMODE == LEDMODE_STD) + ld a,$FF ; led is inverted + out (LEDPORT),a ; clear led + #endif + #if (LEDMODE == LEDMODE_RTC) + ; Bits 0 and 1 of the RTC latch are for the LEDs. + ld a,(HB_RTCVAL) + and ~%00000011 + out (RTCIO),a ; clear led + ld (HB_RTCVAL),a + #endif + #endif +#endif + ret +; +; Print string at HL on console, null terminated +; +pstr: + ld a,(hl) ; get next character + or a ; set flags + inc hl ; bump pointer regardless + ret z ; done if null + call cout ; display character + jr pstr ; loop till done +; +; Print volume label string at HL, '$' terminated, 16 chars max +; +pvol: + ld b,16 ; init max char downcounter +pvol1: + ld a,(hl) ; get next character + cp '$' ; set flags + inc hl ; bump pointer regardless + ret z ; done if null + call cout ; display character + djnz pvol1 ; loop till done + ret ; hit max of 16 chars +; +; Start a newline on console (cr/lf) +; +nl2: + call nl ; double newline +nl: + ld a,cr ; cr + call cout ; send it + ld a,lf ; lf + jp cout ; send it and return +; +; Print a dot on console +; +pdot: + push af + ld a,'.' + call cout + pop af + ret +; +; Read a string on the console +; +; Uses address $0080 in page zero for buffer +; Input is zero terminated +; +rdln: + ld de,cmdbuf ; init buffer address ptr +rdln_nxt: + call cin ; get a character + cp bs ; backspace? + jr z,rdln_bs ; handle it if so + cp cr ; return? + jr z,rdln_cr ; handle it if so +; + ; check for non-printing characters + cp ' ' ; first printable is space char + jr c,rdln_bel ; too low, beep and loop + cp '~'+1 ; last printable char + jr nc,rdln_bel ; too high, beep and loop +; + ; need to check for buffer overflow here!!! + ld hl,cmdbuf+cmdmax ; max cmd length + or a ; clear carry + sbc hl,de ; test for max + jr z,rdln_bel ; at max, beep and loop +; + ; good to go, echo and store character + call cout ; echo character input + ld (de),a ; save in buffer + inc de ; inc buffer ptr + jr rdln_nxt ; loop till done +; +rdln_bs: + ld hl,cmdbuf ; start of buffer + or a ; clear carry + sbc hl,de ; subtract from cur buf ptr + jr z,rdln_bel ; at buf start, just beep + ld hl,str_bs ; backspace sequence + call pstr ; send it + dec de ; backup buffer pointer + jr rdln_nxt ; and loop +; +rdln_bel: + ld a,bel ; Bell characters + call cout ; send it + jr rdln_nxt ; and loop +; +rdln_cr: + xor a ; null to A + ld (de),a ; store terminator + ret ; and return +; +; Find next whitespace character at buffer adr in DE, returns with first +; whitespace character in A. +; +findws: + ld a,(de) ; get next char + or a ; check for eol + ret z ; done if so + cp ' ' ; blank? + ret z ; nope, done + inc de ; bump buffer pointer + jr findws ; and loop +; +; Skip whitespace at buffer adr in DE, returns with first +; non-whitespace character in A. +; +skipws: + ld a,(de) ; get next char + or a ; check for eol + ret z ; done if so + cp ' ' ; blank? + ret nz ; nope, done + inc de ; bump buffer pointer + jr skipws ; and loop +; +; Uppercase character in A +; +upcase: + cp 'a' ; below 'a'? + ret c ; if so, nothing to do + cp 'z'+1 ; above 'z'? + ret nc ; if so, nothing to do + and ~$20 ; convert character to lower + ret ; done +; +; Get numeric chars at DE and convert to number returned in A +; Carry flag set on overflow +; +getnum: + ld c,0 ; C is working register +getnum1: + ld a,(de) ; get the active char + cp '0' ; compare to ascii '0' + jr c,getnum2 ; abort if below + cp '9' + 1 ; compare to ascii '9' + jr nc,getnum2 ; abort if above +; + ; valid digit, add new digit to C + ld a,c ; get working value to A + rlca ; multiply by 10 + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + add a,c ; ... + ret c ; overflow, return with carry set + rlca ; ... + ret c ; overflow, return with carry set + ld c,a ; back to C + ld a,(de) ; get new digit + sub '0' ; make binary + add a,c ; add in working value + ret c ; overflow, return with carry set + ld c,a ; back to C +; + inc de ; bump to next char + jr getnum1 ; loop +; +getnum2: ; return result + ld a,c ; return result in A + or a ; with flags set, CF is cleared + ret +; +; Is character in A numeric? NZ if not +; +isnum: + cp '0' ; compare to ascii '0' + jr c,isnum1 ; abort if below + cp '9' + 1 ; compare to ascii '9' + jr nc,isnum1 ; abort if above + cp a ; set Z + ret +isnum1: + or $FF ; set NZ + ret ; and done +; +; Delay 16us (cpu speed compensated) including call/ret invocation +; Register A and flags destroyed +; No compensation for z180 memory wait states +; There is an overhead of 3ts per invocation +; Impact of overhead diminishes as cpu speed increases +; +; cpu scaler (cpuscl) = (cpuhmz - 2) for 16us + 3ts delay +; note: cpuscl must be >= 1! +; +; example: 8mhz cpu (delay goal is 16us) +; loop = ((6 * 16) - 5) = 91ts +; total cost = (91 + 40) = 131ts +; actual delay = (131 / 8) = 16.375us +; + ; --- total cost = (loop cost + 40) ts -----------------+ +delay: ; 17ts (from invoking call) | + ld a,(cpuscl) ; 13ts | +; | +delay1: ; | + ; --- loop = ((cpuscl * 16) - 5) ts ------------+ | + dec a ; 4ts | | +#if (BIOS == BIOS_WBW) ; | | + #if (CPUFAM == CPU_Z180) ; | | + or a ; +4ts for z180 | | + #endif ; | | +#endif ; | | + jr nz,delay1 ; 12ts (nz) / 7ts (z) | | + ; ----------------------------------------------+ | +; | + ret ; 10ts (return) | + ;-------------------------------------------------------+ +; +; Delay 16us * DE (cpu speed compensated) +; Register DE, A, and flags destroyed +; No compensation for z180 memory wait states +; There is a 27ts overhead for call/ret per invocation +; Impact of overhead diminishes as DE and/or cpu speed increases +; +; cpu scaler (cpuscl) = (cpuhmz - 2) for 16us outer loop cost +; note: cpuscl must be > 0! +; +; Example: 8MHz cpu, DE=6250 (delay goal is .1 sec or 100,000us) +; inner loop = ((16 * 6) - 5) = 91ts +; outer loop = ((91 + 37) * 6250) = 800,000ts +; actual delay = ((800,000 + 27) / 8) = 100,003us +; + ; --- total cost = (outer loop + 27) ts ------------------------+ +vdelay: ; 17ts (from invoking call) | +; | + ; --- outer loop = ((inner loop + 37) * de) ts ---------+ | + ld a,(cpuscl) ; 13ts | | +; | | +vdelay1: ; | | + ; --- inner loop = ((cpuscl * 16) - 5) ts ------+ | | +#if (BIOS == BIOS_WBW) ; | | | + #if (CPUFAM == CPU_Z180) ; | | | + or a ; +4ts for z180 | | | + #endif ; | | | +#endif ; | | | + dec a ; 4ts | | | + jr nz,vdelay1 ; 12ts (nz) / 7ts (z) | | | + ; ----------------------------------------------+ | | +; | | + dec de ; 6ts | | +#if (BIOS == BIOS_WBW) ; | | | + #if (CPUFAM == CPU_Z180) ; | | + or a ; +4ts for z180 | | + #endif ; | | +#endif ; | | + ld a,d ; 4ts | | + or e ; 4ts | | + jp nz,vdelay ; 10ts | | + ;-------------------------------------------------------+ | +; | + ret ; 10ts (final return) | + ;---------------------------------------------------------------+ +; +; Delay about 0.5 seconds +; 500000us / 16us = 31250 +; +ldelay: + push af + push de + ld de,31250 + call vdelay + pop de + pop af + ret +; +; Initialize delay scaler based on operating cpu speed +; HBIOS *must* be installed and available via rst 8!!! +; CPU scaler := max(1, (phimhz - 2)) +; +delay_init: +#if (BIOS == BIOS_UNA) + ld c,$F8 ; UNA bios get phi function + rst 08 ; returns speed in hz in de:hl + ld b,4 ; divide mhz in de:hl by 100000h +delay_init0: + srl d ; ... to get approx cpu speed in + rr e ; ...mhz. throw away hl, and + djnz delay_init0 ; ...right shift de by 4. + inc e ; fix up for value truncation + ld a,e ; put in a +#else + ld b,BF_SYSGET ; HBIOS func=get sys info + ld c,BF_SYSGET_CPUINFO ; HBIOS subfunc=get cpu info + rst 08 ; call HBIOS, rst 08 not yet installed + ld a,l ; put speed in mhz in accum +#endif + cp 3 ; test for <= 2 (special handling) + jr c,delay_init1 ; if <= 2, special processing + sub 2 ; adjust as required by delay functions + jr delay_init2 ; and continue +delay_init1: + ld a,1 ; use the min value of 1 +delay_init2: + ld (cpuscl),a ; update cpu scaler value + ret - -; -;================================================================================================== -; INCLUDES -;================================================================================================== -; -#DEFINE USEDELAY -#INCLUDE "util.asm" -; -#IF (DSKYENABLE) -#DEFINE DSKY_KBD -#INCLUDE "dsky.asm" -#ENDIF -; -;================================================================================================== -; CONSOLE CHARACTER I/O HELPER ROUTINES (REGISTERS PRESERVED) -;================================================================================================== -; -#IF (BIOS == BIOS_WBW) -; -; OUTPUT CHARACTER FROM A -; -COUT: - ; SAVE ALL INCOMING REGISTERS - PUSH AF - PUSH BC - PUSH DE - PUSH HL -; - ; OUTPUT CHARACTER TO CONSOLE VIA HBIOS - LD E,A ; OUTPUT CHAR TO E - LD C,CIO_CONSOLE ; CONSOLE UNIT TO C - LD B,BF_CIOOUT ; HBIOS FUNC: OUTPUT CHAR - RST 08 ; HBIOS OUTPUTS CHARACTDR -; - ; RESTORE ALL REGISTERS - POP HL - POP DE - POP BC - POP AF - RET -; -; INPUT CHARACTER TO A -; -CIN: - ; SAVE INCOMING REGISTERS (AF IS OUTPUT) - PUSH BC - PUSH DE - PUSH HL -; - ; INPUT CHARACTER FROM CONSOLE VIA HBIOS - LD C,CIO_CONSOLE ; CONSOLE UNIT TO C - LD B,BF_CIOIN ; HBIOS FUNC: INPUT CHAR - RST 08 ; HBIOS READS CHARACTDR - LD A,E ; MOVE CHARACTER TO A FOR RETURN -; - ; RESTORE REGISTERS (AF IS OUTPUT) - POP HL - POP DE - POP BC - RET -; -; RETURN INPUT STATUS IN A (0 = NO CHAR, !=0 CHAR WAITING) -; -CST: - ; SAVE INCOMING REGISTERS (AF IS OUTPUT) - PUSH BC - PUSH DE - PUSH HL -; - ; GET CONSOLE INPUT STATUS VIA HBIOS - LD C,CIO_CONSOLE ; CONSOLE UNIT TO C - LD B,BF_CIOIST ; HBIOS FUNC: INPUT STATUS - RST 08 ; HBIOS RETURNS STATUS IN A -; - ; RESTORE REGISTERS (AF IS OUTPUT) - POP HL - POP DE - POP BC - RET -; -#ENDIF -; -#IF (BIOS == BIOS_UNA) -; -; OUTPUT CHARACTER FROM A -; -COUT: - ; SAVE ALL INCOMING REGISTERS - PUSH AF - PUSH BC - PUSH DE - PUSH HL -; - ; OUTPUT CHARACTER TO CONSOLE VIA UBIOS - LD E,A - LD BC,$12 - RST 08 -; - ; RESTORE ALL REGISTERS - POP HL - POP DE - POP BC - POP AF - RET -; -; INPUT CHARACTER TO A -; -CIN: - ; SAVE INCOMING REGISTERS (AF IS OUTPUT) - PUSH BC - PUSH DE - PUSH HL -; - ; INPUT CHARACTER FROM CONSOLE VIA UBIOS - LD BC,$11 - RST 08 - LD A,E -; - ; RESTORE REGISTERS (AF IS OUTPUT) - POP HL - POP DE - POP BC - RET -; -; RETURN INPUT STATUS IN A (0 = NO CHAR, !=0 CHAR WAITING) -; -CST: - ; SAVE INCOMING REGISTERS (AF IS OUTPUT) - PUSH BC - PUSH DE - PUSH HL -; - ; GET CONSOLE INPUT STATUS VIA UBIOS - LD BC,$13 - RST 08 - LD A,E -; - ; RESTORE REGISTERS (AF IS OUTPUT) - POP HL - POP DE - POP BC - RET -; -#ENDIF -; -; 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 -; -;================================================================================================== -; FILL REMAINDER OF BANK -;================================================================================================== -; -SLACK: .EQU ($8000 + LDR_SIZ - $) - .FILL SLACK -; - .ECHO "LOADER space remaining: " - .ECHO SLACK - .ECHO " bytes.\n" -; -;================================================================================================== -; WORKING DATA STORAGE -;================================================================================================== - .ORG $8000 + LDR_SIZ -; - .DS 64 ; 32 LEVEL STACK -BL_STACK .EQU $ ; ... TOP IS HERE -; -BL_INPFLG .DS 1 ; INPUT FLAG, 1=DSKY, 2=SERIAL -BL_COUNT .DS 1 ; LOAD COUNTER -BL_TIMEOUT .DS 2 ; AUTOBOOT TIMEOUT COUNTDOWN COUNTER -BL_BOOTID .DS 1 ; BOOT DEVICE ID CHOSEN BY USER -BL_DEVICE .DS 1 ; DEVICE TO LOAD FROM -BL_LU .DS 1 ; LU TO LOAD FROM -; -; BOOT INFO SECTOR IS READ INTO AREA BELOW -; THE THIRD SECTOR OF A DISK DEVICE IS RESERVED FOR BOOT INFO -; -BL_INFOSEC .EQU $ - .DS (512 - 128) -BB_METABUF .EQU $ -BB_SIG .DS 2 ; SIGNATURE (WILL BE 0A55AH IF SET) -BB_PLATFORM .DS 1 ; FORMATTING PLATFORM -BB_DEVICE .DS 1 ; FORMATTING DEVICE -BB_FORMATTER .DS 8 ; FORMATTING PROGRAM -BB_DRIVE .DS 1 ; PHYSICAL DISK DRIVE # -BB_LU .DS 1 ; LOGICAL UNIT (LU) - .DS 1 ; MSB OF LU, NOW DEPRECATED - .DS (BB_METABUF + 128) - $ - 32 -BB_PROTECT .DS 1 ; WRITE PROTECT BOOLEAN -BB_UPDATES .DS 2 ; UPDATE COUNTER -BB_RMJ .DS 1 ; RMJ MAJOR VERSION NUMBER -BB_RMN .DS 1 ; RMN MINOR VERSION NUMBER -BB_RUP .DS 1 ; RUP UPDATE NUMBER -BB_RTP .DS 1 ; RTP PATCH LEVEL -BB_LABEL .DS 16 ; 16 CHARACTER DRIVE LABEL -BB_TERM .DS 1 ; LABEL TERMINATOR ('$') -BB_BILOC .DS 2 ; LOC TO PATCH BOOT DRIVE INFO TO (IF NOT ZERO) -BB_CPMLOC .DS 2 ; FINAL RAM DESTINATION FOR CPM/CBIOS -BB_CPMEND .DS 2 ; END ADDRESS FOR LOAD -BB_CPMENT .DS 2 ; CP/M ENTRY POINT (CBIOS COLD BOOT) -; - .END +#if (CPUMHZ < 3) +cpuscl .db 1 ; cpu scaler must be > 0 +#else +cpuscl .db CPUMHZ - 2 ; otherwise 2 less than phi mhz +#endif +; +; Print value of a in decimal with leading zero suppression +; +prtdecb: + push hl + push af + ld l,a + ld h,0 + call prtdec + pop af + pop hl + ret +; +; Print value of HL in decimal with leading zero suppression +; +prtdec: + push bc + push de + push hl + ld e,'0' + ld bc,-10000 + call prtdec1 + ld bc,-1000 + call prtdec1 + ld bc,-100 + call prtdec1 + ld c,-10 + call prtdec1 + ld e,0 + ld c,-1 + call prtdec1 + pop hl + pop de + pop bc + ret +prtdec1: + ld a,'0' - 1 +prtdec2: + inc a + add hl,bc + jr c,prtdec2 + sbc hl,bc + cp e + jr z,prtdec3 + ld e,0 + call cout +prtdec3: + ret +; +; Short delay functions. No clock speed compensation, so they +; will run longer on slower systems. The number indicates the +; number of call/ret invocations. A single call/ret is +; 27 t-states on a z80, 25 t-states on a z180. +; +; ; z80 z180 +; ; ---- ---- +dly64: call dly32 ; 1728 1600 +dly32: call dly16 ; 864 800 +dly16: call dly8 ; 432 400 +dly8: call dly4 ; 216 200 +dly4: call dly2 ; 108 100 +dly2: call dly1 ; 54 50 +dly1: ret ; 27 25 +; +; Add hl,a +; +; A register is destroyed! +; +addhla: + add a,l + ld l,a + ret nc + inc h + ret +; +; Print the hex byte value in A +; +prthexbyte: + push af + push de + call hexascii + ld a,d + call cout + ld a,e + call cout + pop de + pop af + ret +; +; Print the hex word value in BC +; +prthexword: + push af + ld a,b + call prthexbyte + ld a,c + call prthexbyte + pop af + ret +; +; Print the hex dword value in DE:HL +; +prthex32: + push bc + push de + pop bc + call prthexword + push hl + pop bc + call prthexword + pop bc + ret +; +; Convert binary value in A to ASCII hex characters in DE +; +hexascii: + ld d,a + call hexconv + ld e,a + ld a,d + rlca + rlca + rlca + rlca + call hexconv + ld d,a + ret +; +; Convert low nibble of A to ASCII hex +; +hexconv: + and 0Fh ; low nibble only + add a,90h + daa + adc a,40h + daa + ret +; +;======================================================================= +; Console character I/O helper routines (registers preserved) +;======================================================================= +; +#if (BIOS == BIOS_WBW) +; +; Output character from A +; +cout: + ; Save all incoming registers + push af + push bc + push de + push hl +; + ; Output character to console via HBIOS + ld e,a ; output char to E + ld c,CIO_CONSOLE ; console unit to C + ld b,BF_CIOOUT ; HBIOS func: output char + rst 08 ; HBIOS outputs character +; + ; Restore all registers + pop hl + pop de + pop bc + pop af + ret +; +; Input character to A +; +cin: + ; Save incoming registers (AF is output) + push bc + push de + push hl +; + ; Input character from console via hbios + ld c,CIO_CONSOLE ; console unit to c + ld b,BF_CIOIN ; HBIOS func: input char + rst 08 ; HBIOS reads character + ld a,e ; move character to A for return +; + ; Restore registers (AF is output) + pop hl + pop de + pop bc + ret +; +; Return input status in A (0 = no char, != 0 char waiting) +; +cst: + ; Save incoming registers (AF is output) + push bc + push de + push hl +; + ; Get console input status via HBIOS + ld c,CIO_CONSOLE ; console unit to C + ld b,BF_CIOIST ; HBIOS func: input status + rst 08 ; HBIOS returns status in A +; + ; Restore registers (AF is output) + pop hl + pop de + pop bc + ret +; +#endif +; +#if (BIOS == BIOS_UNA) +; +; Output character from A +; +cout: + ; Save all incoming registers + push af + push bc + push de + push hl +; + ; Output character to console via UBIOS + ld e,a + ld bc,$12 + rst 08 +; + ; Restore all registers + pop hl + pop de + pop bc + pop af + ret +; +; Input character to A +; +cin: + ; Save incoming registers (AF is output) + push bc + push de + push hl +; + ; Input character from console via UBIOS + ld bc,$11 + rst 08 + ld a,e +; + ; Restore registers (AF is output) + pop hl + pop de + pop bc + ret +; +; Return input status in A (0 = no char, != 0 char waiting) +; +cst: + ; Save incoming registers (AF is output) + push bc + push de + push hl +; + ; Get console input status via UBIOS + ld bc,$13 + rst 08 + ld a,e + or a +; + ; Restore registers (AF is output) + pop hl + pop de + pop bc + ret +; +#endif +; +; Generic console I/O +; +CIN .equ cin +COUT .equ cout +CST .equ cst +; +;======================================================================= +; Device inventory display +;======================================================================= +; +#if (BIOS == BIOS_WBW) +; +; Print list of all drives (WBW) +; +; Just invoke the existing HBIOS routine... +; +prtall: + ld a,BID_BIOS ; BIOS Bank please + ld ix,$0406 ; HBIOS PRTSUM vector + jp HB_BNKCALL ; do it +; +#endif +; +#if (BIOS == BIOS_UNA) +; +; Print list of all drives (UNA) +; +prtall: + ld hl,str_devlst ; device list header string + call pstr ; display it + call nl ; formatting + ld b,0 ; start with unit 0 +; +prtall1: ; loop thru all units available + ld c,$48 ; UNA func: get disk type + ld l,0 ; preset unit count to zero + rst 08 ; call UNA, B preserved + ld a,l ; unit count to a + or a ; past end? + ret z ; we are done + push bc ; save unit + call prtdrv ; process the unit + pop bc ; restore unit + inc b ; next unit + jr prtall1 ; loop +; +; print the una unit info +; on input b has unit +; +prtdrv: + push bc ; save unit + push de ; save disk type + ld hl,str_disk ; prefix string + call pstr ; display it + ld a,b ; index + call prtdecb ; print it + ld a,' ' ; formatting + call cout ; do it + ld a,'=' ; formatting + call cout ; do it + ld a,' ' ; formatting + call cout ; do it + pop de ; recover disk type + ld a,d ; disk type to a + cp $40 ; ram/rom? + jr z,prtdrv1 ; handle ram/rom + ld hl,devide ; assume ide + cp $41 ; ide? + jr z,prtdrv2 ; print it + ld hl,devppide ; assume ppide + cp $42 ; ppide? + jr z,prtdrv2 ; print it + ld hl,devsd ; assume sd + cp $43 ; sd? + jr z,prtdrv2 ; print it + ld hl,devdsd ; assume dsd + cp $44 ; dsd? + jr z,prtdrv2 ; print it + ld hl,devunk ; otherwise unknown + jr prtdrv2 +; +prtdrv1: ; handle ram/rom + ld c,$45 ; una func: get disk info + ld de,bl_infosec ; 512 byte buffer + rst 08 ; call una + bit 7,b ; test ram drive bit + ld hl,devrom ; assume rom + jr z,prtdrv2 ; if so, print it + ld hl,devram ; otherwise ram + jr prtdrv2 ; print it +; +prtdrv2: ; print device + pop bc ; recover unit + call pstr ; print device name + ld a,b ; unit to a + call prtdecb ; print it + ld a,':' ; device name suffix + call cout ; print it + ret ; done +; +devram .db "RAM",0 +devrom .db "ROM",0 +devide .db "IDE",0 +devppide .db "PPIDE",0 +devsd .db "SD",0 +devdsd .db "DSD",0 +devunk .db "UNK",0 +; +str_devlst .db "\r\n\r\nDisk Devices:",0 +; +#endif +; +;======================================================================= +; Error handlers +;======================================================================= +; +err_invcmd: + ld hl,str_err_invcmd + jr err +; +err_nodisk: + ld hl,str_err_nodisk + jr err +; +err_noslice: + ld hl,str_err_noslice + jr err +; +err_nocon: + ld hl,str_err_nocon + jr err +; +err_diskio: + ld hl,str_err_diskio + jr err +; +err_sig: + ld hl,str_err_sig + jr err +; +err_api: + ld hl,str_err_api + jr err +; +err: + push hl +; ld a,(acmd_act) ; get auto cmd active flag +; or a ; set flags +; call nz,showcmd ; if auto cmd act, show cmd +; ld a,bel ; bel character +; call cout ; beep + ld hl,str_err_prefix + call pstr + pop hl + jp pstr +; +str_err_prefix .db bel,"\r\n\r\n*** ",0 +str_err_invcmd .db "Invalid command",0 +str_err_nodisk .db "Disk unit not available",0 +str_err_noslice .db "Disk unit does not support slices",0 +str_err_nocon .db "Invalid character unit specification",0 +str_err_diskio .db "Disk I/O failure",0 +str_err_sig .db "No system image on disk",0 +str_err_api .db "Unexpected hardware BIOS API failure",0 +; +;======================================================================= +; Includes +;======================================================================= +; +#if (DSKYENABLE) +#define DSKY_KBD + #if (DSKYMODE == DSKYMODE_V1) +VDELAY .equ vdelay +DLY2 .equ dly2 +#include "dsky.asm" + #endif + #if (DSKYMODE == DSKYMODE_NG) +#include "dskyng.asm" + #endif +#endif +; +;======================================================================= +; Working data storage (initialized) +;======================================================================= +; +acmd .db BOOT_DEFAULT ; auto cmd string + .db 0 +acmd_len .equ $ - acmd ; len of auto cmd +acmd_act .db $FF ; auto cmd active +acmd_to .dw BOOT_TIMEOUT ; auto cmd timeout +; +;======================================================================= +; Strings +;======================================================================= +; +str_banner .db PLATFORM_NAME," Boot Loader",0 +str_autoboot .db "AutoBoot: ",0 +str_prompt .db "Boot [H=Help]: ",0 +str_bs .db bs,' ',bs,0 +str_reboot .db "\r\n\r\nRestarting System...",0 +str_newcon .db "\r\n\r\n Console on Unit #",0 +str_chspeed .db "\r\n\r\n Change speed now. Press a key to resume.",0 +str_applst .db "\r\n\r\nROM Applications:",0 +str_invcmd .db "\r\n\r\n*** Invalid Command ***",bel,0 +str_load .db "\r\n\r\nLoading ",0 +str_disk .db "\r\n Disk Unit ",0 +str_on .db " on ",0 +str_boot1 .db "\r\n\r\nBooting Disk Unit ",0 +str_boot2 .db ", Slice ",0 +str_binfo1 .db "\r\n\r\nVolume ",$22,0 +str_binfo2 .db $22," [0x",0 +str_binfo3 .db "-0x",0 +str_binfo4 .db ", entry @ 0x",0 +str_binfo5 .db "]",0 +str_ldsec .db ", Sector 0x",0 +str_diaglvl .db "\r\n\r\nHBIOS Diagnostic Level: ",0 +; +str_help .db "\r\n" + .db "\r\n L - List ROM Applications" + .db "\r\n D - Device Inventory" + .db "\r\n R - Reboot System" +#if (BIOS == BIOS_WBW) + .db "\r\n I [] - Set Console Interface/Baud code" + .db "\r\n V [] - View/Set HBIOS Diagnostic Verbosity" +#endif + .db "\r\n [.] - Boot Disk Unit/Slice" + .db 0 +; +#if (DSKYENABLE) + #if (DSKYMODE == DSKYMODE_V1) +msg_sel .db $7f,$1d,$1d,$0f,$6c,$00,$00,$00 ; "boot? " +msg_boot .db $7f,$1d,$1d,$0f,$80,$80,$80,$00 ; "boot... " +msg_load .db $0b,$1d,$7d,$3d,$80,$80,$80,$00 ; "load... " +msg_go .db $5b,$1d,$80,$80,$80,$00,$00,$00 ; "go... " + #endif + #if (DSKYMODE == DSKYMODE_NG) +msg_sel .db $7f,$5c,$5c,$78,$53,$00,$00,$00 ; "boot? " +msg_boot .db $7f,$5c,$5c,$78,$80,$80,$80,$00 ; "boot... " +msg_load .db $38,$5c,$5f,$5e,$80,$80,$80,$00 ; "load... " +msg_go .db $3d,$5c,$80,$80,$80,$00,$00,$00 ; "go... " + #endif +#endif +; +;======================================================================= +; ROM Application Table +;======================================================================= +; +; Macro ra_ent: +; +; WBW UNA +; p1: Application name string adr word (+0) word (+0) +; p2: Console keyboard selection key byte (+2) byte (+2) +; p3: DSKY selection key byte (+3) byte (+3) +; p4: Application image bank byte (+4) word (+4) +; p5: Application image source address word (+5) word (+6) +; p6: Application image dest load address word (+7) word (+8) +; p7: Application image size word (+9) word (+10) +; p8: Application entry address word (+11) word (+12) +; +#if (BIOS == BIOS_WBW) +ra_name .equ 0 +ra_conkey .equ 2 +ra_dskykey .equ 3 +ra_bnk .equ 4 +ra_src .equ 5 +ra_dest .equ 7 +ra_siz .equ 9 +ra_ent .equ 11 +#endif +; +#if (BIOS == BIOS_UNA) +ra_name .equ 0 +ra_conkey .equ 2 +ra_dskykey .equ 3 +ra_bnk .equ 4 +ra_src .equ 6 +ra_dest .equ 8 +ra_siz .equ 10 +ra_ent .equ 12 +#endif +; +#define ra_ent(p1,p2,p3,p4,p5,p6,p7,p8) \ +#defcont .dw p1 \ +#defcont .db p2 \ +#if (DSKYENABLE) +#defcont .db p3 \ +#else +#defcont .db $FF \ +#endif +#if (BIOS == BIOS_WBW) +#defcont .db p4 \ +#endif +#if (BIOS == BIOS_UNA) +#defcont .dw p4 \ +#endif +#defcont .dw p5 \ +#defcont .dw p6 \ +#defcont .dw p7 \ +#defcont .dw p8 +; +; Note: The formatting of the following is critical. TASM does not pass +; macro arguments well. Ensure std.asm holds the definitions for *_LOC, +; *_SIZ *_END and any code generated which does not include std.asm is +; synced. +; +; Note: The loadable ROM images are placed in ROM banks BID_IMG0 and +; BID_IMG1. However, RomWBW supports a mechanism to load a complete +; new system dynamically as a runnable application (see appboot and +; imgboot in hbios.asm). In this case, the contents of BID_IMG0 will +; be pre-loaded into the currently executing ram bank thereby allowing +; those images to be dynamically loaded as well. To support this +; concept, a pseudo-bank called bid_cur is used to specify the images +; normally found in BID_IMG0. In romload, this special value will cause +; the associated image to be loaded from the currently executing bank +; which will be correct regardless of the load mode. Images in other +; banks (BID_IMG1) will always be loaded directly from ROM. +; +ra_tbl: +; +; Name Key Dsky Bank Src Dest Size Entry +; --------- ------- ----- -------- ----- ------- ------- ---------- +ra_ent(str_mon, 'M', KY_CL, BID_IMG0, MON_IMGLOC, MON_LOC, MON_SIZ, MON_SERIAL) +ra_entsiz .equ $ - ra_tbl +ra_ent(str_zsys, 'Z', KY_FW, BID_IMG0, ZSYS_IMGLOC, CPM_LOC, CPM_SIZ, CPM_ENT) +ra_ent(str_cpm22, 'C', KY_BK, BID_IMG0, CPM_IMGLOC, CPM_LOC, CPM_SIZ, CPM_ENT) +#if (BIOS == BIOS_WBW) +ra_ent(str_fth, 'F', KY_EX, BID_IMG1, FTH_IMGLOC, FTH_LOC, FTH_SIZ, FTH_LOC) +ra_ent(str_bas, 'B', KY_DE, BID_IMG1, BAS_IMGLOC, BAS_LOC, BAS_SIZ, BAS_LOC) +ra_ent(str_tbas, 'T', KY_EN, BID_IMG1, TBC_IMGLOC, TBC_LOC, TBC_SIZ, TBC_LOC) +ra_ent(str_play, 'P', $FF, BID_IMG1, GAM_IMGLOC, GAM_LOC, GAM_SIZ, GAM_LOC) +ra_ent(str_egg, 'E'+$80, $FF, BID_IMG1, EGG_IMGLOC, EGG_LOC, EGG_SIZ, EGG_LOC) +ra_ent(str_net, 'N', $FF, BID_IMG1, NET_IMGLOC, NET_LOC, NET_SIZ, NET_LOC) +ra_ent(str_upd, 'X', $FF, BID_IMG1, UPD_IMGLOC, UPD_LOC, UPD_SIZ, UPD_LOC) +ra_ent(str_user, 'U', $FF, BID_IMG1, USR_IMGLOC, USR_LOC, USR_SIZ, USR_LOC) +#endif +#if (DSKYENABLE) +ra_ent(str_dsky, 'Y'+$80, KY_GO, BID_IMG0, MON_IMGLOC, MON_LOC, MON_SIZ, MON_DSKY) +#endif + .dw 0 ; table terminator +; +ra_tbl_app: +; +; Name Key Dsky Bank Src Dest Size Entry +; --------- ------- ----- -------- ----- ------- ------- ---------- +ra_ent(str_mon, 'M', KY_CL, bid_cur, MON_IMGLOC, MON_LOC, MON_SIZ, MON_SERIAL) +ra_ent(str_zsys, 'Z', KY_FW, bid_cur, ZSYS_IMGLOC, CPM_LOC, CPM_SIZ, CPM_ENT) +#if (DSKYENABLE) +ra_ent(str_dsky, 'Y'+$80, KY_GO, bid_cur, MON_IMGLOC, MON_LOC, MON_SIZ, MON_DSKY) +#endif + .dw 0 ; table terminator +; +str_mon .db "Monitor",0 +str_cpm22 .db "CP/M 2.2",0 +str_zsys .db "Z-System",0 +str_dsky .db "DSKY Monitor",0 +str_fth .db "Forth",0 +str_bas .db "BASIC",0 +str_tbas .db "Tasty BASIC",0 +str_play .db "Play a Game",0 +str_upd .db "XModem Flash Updater",0 +str_user .db "User App",0 +str_egg .db "",0 +str_net .db "Network Boot",0 +newcon .db 0 +newspeed .db 0 +; +;======================================================================= +; Working data storage +;======================================================================= +; + .fill 64,0 ; 32 level stack +bl_stack .equ $ ; ... top is here +; +#if (BIOS == BIOS_WBW) +bid_ldr .db 0 ; bank at startup +#endif +#if (BIOS == BIOS_UNA) +bid_ldr .dw 0 ; bank at startup +#endif +; +lba .fill 4,0 ; lba for load, dword +dma .dw 0 ; address for load +sps .dw 0 ; sectors per slice +mediaid .db 0 ; media id +; +ra_tbl_loc .dw 0 ; points to active ra_tbl +bootunit .db 0 ; boot disk unit +bootslice .db 0 ; boot disk slice +loadcnt .db 0 ; num disk sectors to load +; +;======================================================================= +; Pad remainder of ROM Loader +;======================================================================= +; +slack .equ ($8000 + LDR_SIZ - $) + .fill slack +; + .echo "LOADER space remaining: " + .echo slack + .echo " bytes.\n" +; +; +;======================================================================= +; Disk buffers (uninitialized) +;======================================================================= +; +; Master Boot Record sector is read into area below. +; Note that this buffer is actually shared with bl_infosec +; buffer below. +; +bl_mbrsec .equ $ +; +; Boot info sector is read into area below. +; The third sector of a disk device is reserved for boot info. +; +bl_infosec .equ $ + .ds (512 - 128) +bb_metabuf .equ $ +bb_sig .ds 2 ; signature (0xA55A if set) +bb_platform .ds 1 ; formatting platform +bb_device .ds 1 ; formatting device +bb_formatter .ds 8 ; formatting program +bb_drive .ds 1 ; physical disk drive # +bb_lu .ds 1 ; logical unit (lu) + .ds 1 ; msb of lu, now deprecated + .ds (bb_metabuf + 128) - $ - 32 +bb_protect .ds 1 ; write protect boolean +bb_updates .ds 2 ; update counter +bb_rmj .ds 1 ; rmj major version number +bb_rmn .ds 1 ; rmn minor version number +bb_rup .ds 1 ; rup update number +bb_rtp .ds 1 ; rtp patch level +bb_label .ds 16 ; 16 character drive label +bb_term .ds 1 ; label terminator ('$') +bb_biloc .ds 2 ; loc to patch boot drive info +bb_cpmloc .ds 2 ; final ram dest for cpm/cbios +bb_cpmend .ds 2 ; end address for load +bb_cpment .ds 2 ; CP/M entry point (cbios boot) +; + .end diff --git a/Source/HBIOS/rp5rtc.asm b/Source/HBIOS/rp5rtc.asm new file mode 100644 index 00000000..df74a42d --- /dev/null +++ b/Source/HBIOS/rp5rtc.asm @@ -0,0 +1,442 @@ +; +;================================================================================================== +; RP5C01 CLOCK DRIVER +;================================================================================================== +; +RP5RTC_BUFSIZ .EQU 6 ; SIX BYTE BUFFER (YYMMDDHHMMSS) +; +; RTC DEVICE INITIALIZATION ENTRY +; + +; TODO: +; set the day of week register +; read block of nvram +; write block of nvram +; set alarm/get alarm???? + +;; NOTES FOR USING DRIVER IN Z-DOS +; First load the LDDS datestamper +; A:LDDS +; next prepare and drives with datestamper info: +; eg: a:putds -d=g: -V +; then view date time of files with: +; a:filedate + + +RP5RTC_REG .EQU $B4 +RP5RTC_DAT .EQU $B5 + +REG_1SEC .EQU $00 +REG_10SEC .EQU $01 +REG_1MIN .EQU $02 +REG_10MIN .EQU $03 +REG_1HR .EQU $04 +REG_10HR .EQU $05 +REG_DAYWEEK .EQU $06 ; NOT USED BY THIS DRIVER +REG_1DAY .EQU $07 +REG_10DAY .EQU $08 +REG_1MNTH .EQU $09 +REG_10MNTH .EQU $0A +REG_1YEAR .EQU $0B +REG_10YEAR .EQU $0C +REG_MODE .EQU $0D +REG_TEST .EQU $0E +REG_RESET .EQU $0F + + +REG_12_24 .EQU $0A +REG_LEAPYR .EQU $0B + +MODE_TIMEST .EQU 0 +MODE_ALRMST .EQU 1 +MODE_RAM0 .EQU 2 +MODE_RAM1 .EQU 3 + +MD_TIME .EQU 8 +MD_ALRM .EQU 4 + +RP5RTC_INIT: + LD A, (RTC_DISPACT) ; RTC DISPATCHER ALREADY SET? + OR A ; SET FLAGS + RET NZ ; IF ALREADY ACTIVE, ABORT + + CALL NEWLINE ; FORMATTING + PRTS("RP5C01 RTC: $") + + ; PRINT RTC LATCH PORT ADDRESS + PRTS("IO=0x$") ; LABEL FOR IO ADDRESS + LD A,RP5RTC_REG ; GET IO ADDRESS + CALL PRTHEXBYTE ; PRINT IT + CALL PC_SPACE ; FORMATTING + + ; CHECK PRESENCE STATUS + CALL RP5RTC_DETECT ; HARDWARE DETECTION + JR Z, RP5RTC_INIT1 ; IF ZERO, ALL GOOD + PRTS("NOT PRESENT$") ; NOT ZERO, H/W NOT PRESENT + OR $FF ; SIGNAL FAILURE + RET ; BAIL OUT + +RP5RTC_INIT1: +; ENSURE DEVICE IS RESET AND NOT IN TEST MODE + LD A, REG_TEST ; SELECT TEST REGISTER + OUT (RP5RTC_REG), A + CALL DLY16 + XOR A + OUT (RP5RTC_DAT), A ; TURN OFF ALL TEST MODE BITS + + LD B, MODE_ALRMST + CALL RP5RTC_SETMD + + CALL RP5RTC_ENTIME + + LD A, REG_12_24 ; SET TO 24 HOUR CLOCK + OUT (RP5RTC_REG), A + LD A, 1 + OUT (RP5RTC_DAT), A + + CALL RP5RTC_RDTIM + + ; DISPLAY CURRENT TIME + LD HL, RP5RTC_BCDBUF ; POINT TO BCD BUF + CALL PRTDT +; + LD BC, RP5RTC_DISPATCH + CALL RTC_SETDISP +; + XOR A ; SIGNAL SUCCESS + RET +; +; DETECT RTC HARDWARE PRESENCE +; +RP5RTC_DETECT: + LD C, 0 ; NVRAM INDEX 0 + CALL RP5RTC_GETBYT ; GET VALUE + LD A, E ; TO ACCUM + LD L, A ; SAVE IT + XOR $FF ; FLIP ALL BITS + LD E, A ; TO E + LD C, 0 ; NVRAM INDEX 0 + CALL RP5RTC_SETBYT ; WRITE IT + LD C, 0 ; NVRAM INDEX 0 + CALL RP5RTC_GETBYT ; GET VALUE + LD A, L ; GET SAVED VALUE + XOR $FF ; FLIP ALL BITS + CP E ; COMPARE WITH VALUE READ + LD A, 0 ; ASSUME OK + JR Z, RP5RTC_DETECT1 ; IF MATCH, GO AHEAD + LD A, $FF ; ELSE STATUS IS ERROR + +RP5RTC_DETECT1: + PUSH AF ; SAVE STATUS + LD A, L ; GET SAVED VALUE + LD C, 0 ; NVRAM INDEX 0 + CALL RP5RTC_SETBYT ; SAVE IT + POP AF ; RECOVER STATUS + OR A ; SET FLAGS + RET +; +; RTC DEVICE FUNCTION DISPATCH ENTRY +; A: RESULT (OUT), 0=OK, Z=OK, NZ=ERR +; B: FUNCTION (IN) +; +RP5RTC_DISPATCH: + LD A,B ; GET REQUESTED FUNCTION + AND $0F ; ISOLATE SUB-FUNCTION + JP Z,RP5RTC_GETTIM ; GET TIME + DEC A + JP Z,RP5RTC_SETTIM ; SET TIME + DEC A + JP Z,RP5RTC_GETBYT ; GET NVRAM BYTE VALUE + DEC A + JP Z,RP5RTC_SETBYT ; SET NVRAM BYTE VALUE + DEC A + JP Z,RP5RTC_GETBLK ; GET NVRAM DATA BLOCK VALUES + DEC A + JP Z,RP5RTC_SETBLK ; SET NVRAM DATA BLOCK VALUES + DEC A + JP Z,RP5RTC_GETALM ; GET ALARM + DEC A + JP Z,RP5RTC_SETALM ; SET ALARM + DEC A + JP Z,RP5RTC_DEVICE ; REPORT RTC DEVICE INFO + SYSCHKERR(ERR_NOFUNC) + RET +; +; RTC GET NVRAM BYTE +; C: INDEX +; E: VALUE (OUTPUT) +; A:0 IF OK, ERR_RANGE IF OUT OF RANGE +; +RP5RTC_GETBYT: + LD A, C + CP $0D + JR NC, RP5RTC_BADIDX + + LD B, MODE_RAM0 + CALL RP5RTC_SETMD + LD A, C ; SELECT NVRAM INDEX + OUT (RP5RTC_REG), A + IN A, (RP5RTC_DAT) + AND $0F ; RETRIEVE UNIT NIBBLE + LD E, A + + LD B, MODE_RAM1 + CALL RP5RTC_SETMD + LD A, C ; SELECT NVRAM INDEX + OUT (RP5RTC_REG), A + IN A, (RP5RTC_DAT) + AND $0F ; RETRIEVE UNIT NIBBLE + RLCA + RLCA + RLCA + RLCA + OR E + LD E, A + + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN + +RP5RTC_BADIDX: + LD E, 00 + LD A, ERR_RANGE + RET +; +; RTC SET NVRAM BYTE +; C: INDEX +; E: VALUE +; A:0 IF OK, ERR_RANGE IF OUT OF RANGE +; +RP5RTC_SETBYT: + LD A, C + CP $0D + JR NC, RP5RTC_BADIDX + + LD B, MODE_RAM0 + CALL RP5RTC_SETMD + LD A, C ; SELECT NVRAM INDEX + OUT (RP5RTC_REG), A + LD A, E + AND $0F + OUT (RP5RTC_DAT), A + + LD B, MODE_RAM1 + CALL RP5RTC_SETMD + LD A, C ; SELECT NVRAM INDEX + OUT (RP5RTC_REG), A + LD A, E + AND $F0 + RRCA + RRCA + RRCA + RRCA + OUT (RP5RTC_DAT), A + + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN + +RP5RTC_GETBLK: +RP5RTC_SETBLK: +RP5RTC_GETALM: +RP5RTC_SETALM: + SYSCHKERR(ERR_NOTIMPL) + RET +; +; RTC GET TIME +; A: RESULT (OUT), 0=OK, Z=OK, NZ=ERR +; HL: DATE/TIME BUFFER (OUT) +; BUFFER FORMAT IS BCD: YYMMDDHHMMSS +; 24 HOUR TIME FORMAT IS ASSUMED +; +RP5RTC_GETTIM: + ; GET THE TIME INTO TEMP BUF + PUSH HL ; SAVE PTR TO CALLERS BUFFER +; + CALL RP5RTC_RDTIM + + ; NOW COPY TO REAL DESTINATION (INTERBANK SAFE) + LD A,BID_BIOS ; COPY FROM BIOS BANK + LD (HB_SRCBNK),A ; SET IT + LD A,(HB_INVBNK) ; COPY TO CURRENT USER BANK + LD (HB_DSTBNK),A ; SET IT + LD HL,RP5RTC_BCDBUF ; SOURCE ADR + POP DE ; DEST ADR + LD BC,RP5RTC_BUFSIZ ; LENGTH + CALL HB_BNKCPY ; COPY THE CLOCK DATA + + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; +; +; RTC SET TIME +; A: RESULT (OUT), 0=OK, Z=OK, NZ=ERR +; HL: DATE/TIME BUFFER (IN) +; BUFFER FORMAT IS BCD: YYMMDDHHMMSSWW +; 24 HOUR TIME FORMAT IS ASSUMED +; +RP5RTC_SETTIM: + ; COPY TO BCD BUF + LD A,(HB_INVBNK) ; COPY FROM CURRENT USER BANK + LD (HB_SRCBNK),A ; SET IT + LD A,BID_BIOS ; COPY TO BIOS BANK + LD (HB_DSTBNK),A ; SET IT + LD DE,RP5RTC_BCDBUF ; DEST ADR + LD BC,RP5RTC_BUFSIZ ; LENGTH + CALL HB_BNKCPY ; COPY THE CLOCK DATA +; + LD B, MODE_TIMEST + CALL RP5RTC_SETMD + + LD B, REG_1SEC + LD A, (RP5RTC_SS) + CALL RP5RTC_WRVL + + LD B, REG_1MIN + LD A, (RP5RTC_MM) + CALL RP5RTC_WRVL + + LD B, REG_1HR + LD A, (RP5RTC_HH) + CALL RP5RTC_WRVL + + LD B, REG_1DAY + LD A, (RP5RTC_DT) + CALL RP5RTC_WRVL + + LD B, REG_1MNTH + LD A, (RP5RTC_MO) + CALL RP5RTC_WRVL + + LD B, REG_1YEAR + LD A, (RP5RTC_YR) + CALL RP5RTC_WRVL + + LD B, MODE_ALRMST + CALL RP5RTC_SETMD + + LD A, (RP5RTC_YR) + CALL BCD2BYTE + AND 3 + LD B, REG_LEAPYR + CALL RP5RTC_WRVL + + CALL RP5RTC_ENTIME + + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; +; REPORT RTC DEVICE INFO +; +RP5RTC_DEVICE: + LD D,RTCDEV_RP5 ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL DEVICE NUMBER + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,0 ; L := 0, NO I/O ADDRESS + XOR A ; SIGNAL SUCCESS + RET + +; +; READ OUT THE TIME +RP5RTC_RDTIM: + LD B, MODE_TIMEST + CALL RP5RTC_SETMD + + LD B, REG_1SEC + CALL RP5RTC_RDVL + LD (RP5RTC_SS), A + + LD B, REG_1MIN + CALL RP5RTC_RDVL + LD (RP5RTC_MM), A + + LD B, REG_1HR + CALL RP5RTC_RDVL + LD (RP5RTC_HH), A + + LD B, REG_1DAY + CALL RP5RTC_RDVL + LD (RP5RTC_DT), A + + LD B, REG_1MNTH + CALL RP5RTC_RDVL + LD (RP5RTC_MO), A + + LD B, REG_1YEAR + CALL RP5RTC_RDVL + LD (RP5RTC_YR), A + + RET + +; SET MODE +; MODE IN B (MODE_TIMEST, MODE_ALRMST, MODE_RAM0, MODE_RAM1) +RP5RTC_SETMD: + LD A, REG_MODE ; SELECT MODE REGISTER + OUT (RP5RTC_REG), A + + IN A, (RP5RTC_DAT) + AND MD_TIME | MD_ALRM + OR B + OUT (RP5RTC_DAT), A ; ASSIGN MODE + RET + +; ENABLE THE TIME COUNTER +RP5RTC_ENTIME: + LD B, MD_TIME + JP RP5RTC_SETMD + +; READ OUT 2 REGISTERS - 2 NIBBLES TO 1 BYTE +; REGISTER IN B +RP5RTC_RDVL: + LD A, B ; SELECT UNIT REGISTER + OUT (RP5RTC_REG), A + IN A, (RP5RTC_DAT) + AND $0F ; RETRIEVE UNIT NIBBLE + LD L, A + + INC B + LD A, B ; SELECT TENS REGISTER + OUT (RP5RTC_REG), A + IN A, (RP5RTC_DAT) + AND $0F + RLCA + RLCA + RLCA + RLCA ; MOVE TO TOP NIBBLE + OR L ; MERGE IN LOW NIBBLE + LD H, A ; A = VALUE AS BCD + + RET + +; WRITE OUT 2 REGISTERS - 1 BYTE TO 2 NIBBLES +; REGISTER IN B (B+1) +; VALUE IN A +RP5RTC_WRVL: + LD C, A + LD A, B ; SELECT UNIT REGISTER + OUT (RP5RTC_REG), A + + LD A, C ; WRITE C (ONLY LOW NIBBLE WILL BE USED) + OUT (RP5RTC_DAT), A + + INC B + LD A, B ; SELECT TENS REGISTER + OUT (RP5RTC_REG), A + + LD A, C ; SHIFT TOP NIBBLE TO LOW NIBBLE + RRCA + RRCA + RRCA + RRCA + OUT (RP5RTC_DAT), A ; WRITE IT + + RET +; +; REGISTER EXTRACTED VALUES +; +RP5RTC_BCDBUF: +RP5RTC_YR .DB 20 +RP5RTC_MO .DB 01 +RP5RTC_DT .DB 01 +RP5RTC_HH .DB 00 +RP5RTC_MM .DB 00 +RP5RTC_SS .DB 00 + diff --git a/Source/HBIOS/sd.asm b/Source/HBIOS/sd.asm index 70ee71d9..57440e13 100644 --- a/Source/HBIOS/sd.asm +++ b/Source/HBIOS/sd.asm @@ -20,8 +20,8 @@ ; ; CS = CHIP SELECT (AKA DAT3 FOR NON-SPI MODE) ; CLK = CLOCK -; DI = DATA IN (HOST -> CARD, AKA CMD FOR NON-SPI MODE) -; DO = DATA OUT (HOST <- CARD, AKA DAT0 FOR NON-SPI MODE) +; DI = MOSI = DATA IN (HOST -> CARD, AKA CMD FOR NON-SPI MODE) +; DO = MISO = DATA OUT (HOST <- CARD, AKA DAT0 FOR NON-SPI MODE) ; ; NOTES: ; 1) SIGNAL NAMES ARE FROM THE SD CARD SPEC AND ARE NAMED FROM THE @@ -41,7 +41,7 @@ ; THE CLOCK IS LOW. THE DATA IS CAPTURED ON THE CLOCK'S LOW-TO-HIGH ; TRANSITION AND PROPAGATED ON HIGH-TO-LOW CLOCK TRANSITION. ; -; NOTE: THE CSIO IMPLEMENTATION (INCLUDE MK4) USES SPI MODE 4 +; NOTE: THE CSIO IMPLEMENTATION (INCLUDE MK4) USES SPI MODE 3 ; (CPOL=1, CPHA=1) BECAUSE THAT IS THE WAY THAT THE Z180 CSIO ; INTERFACE WORKS. ALL OF THE CLOCK TRANSITIONS LISTED ABOVE ; ARE REVERSED FOR CSIO. @@ -104,7 +104,7 @@ ; IS FLOATING IT IS IMPOSSIBLE TO DETERMINE IF THE BYTE RECEIVED IS A FILL ; BYTE OR NOT. BASED ON WHAT I HAVE READ, THERE WILL ALWAYS BE AT LEAST ; ONE FILL BYTE PRIOR TO THE ACTUAL RESULT. ADDITIONALLY, THE SD CARD WILL -; START DRIVING MISO SOMETIME WITHING THAT FIRST FILL BYTE. SO, WE NOW +; START DRIVING MISO SOMETIME WITHIN THAT FIRST FILL BYTE. SO, WE NOW ; JUST DISCARD THE FIRST BYTE RECEIVED AFTER A COMMAND IS SENT WITH THE ; ASSUMPTION THAT IT MUST BE A FILL BYTE AND IS NOT RELIABLE DUE TO FLOATING ; MISO. @@ -115,43 +115,60 @@ ; SD_NOPULLUP .EQU TRUE ; ASSUME NO PULLUP ; +SD_DEVCNT .EQU SDCNT ; SET SD_DEVCNT TO SDCNT CONFIG VAR +; #IF (SDMODE == SDMODE_JUHA) ; JUHA MINI-BOARD -SD_DEVCNT .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) +SD_DEVMAX .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) SD_OPRREG .EQU RTCIO ; USES RTC LATCHES FOR OPERATION SD_OPRDEF .EQU %00000001 ; QUIESCENT STATE +SD_OPRMSK .EQU %10000111 ; MASK FOR BITS WE OWN IN RTC LATCH PORT SD_INPREG .EQU RTCIO ; INPUT REGISTER IS RTC SD_CS0 .EQU %00000100 ; RTC:2 IS SELECT SD_CLK .EQU %00000010 ; RTC:1 IS CLOCK SD_DI .EQU %00000001 ; RTC:0 IS DATA IN (CARD <- CPU) SD_DO .EQU %10000000 ; RTC:7 IS DATA OUT (CARD -> CPU) +SD_IOBASE .EQU SD_OPRREG ; IOBASE +SD_INVCS .EQU FALSE ; INVERT CS +; +RTCDEF .SET RTCDEF | SD_OPRDEF ; SET DEFAULT IN HBIOS MAINLINE #ENDIF ; #IF (SDMODE == SDMODE_N8) ; UNMODIFIED N8-2511 -SD_DEVCNT .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) +SD_DEVMAX .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) SD_OPRREG .EQU RTCIO ; USES RTC LATCHES FOR OPERATION SD_OPRDEF .EQU %00000001 ; QUIESCENT STATE +SD_OPRMSK .EQU %01000111 ; MASK FOR BITS WE OWN IN RTC LATCH PORT SD_INPREG .EQU RTCIO ; INPUT REGISTER IS RTC SD_CS0 .EQU %00000100 ; RTC:2 IS SELECT SD_CLK .EQU %00000010 ; RTC:1 IS CLOCK SD_DI .EQU %00000001 ; RTC:0 IS DATA IN (CARD <- CPU) SD_DO .EQU %01000000 ; RTC:6 IS DATA OUT (CARD -> CPU) +SD_IOBASE .EQU SD_OPRREG ; IOBASE +SD_INVCS .EQU FALSE ; INVERT CS +; +RTCDEF .SET RTCDEF | SD_OPRDEF ; SET DEFAULT IN HBIOS MAINLINE #ENDIF ; #IF (SDMODE == SDMODE_CSIO) ; N8-2312 -SD_DEVCNT .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) +SD_DEVMAX .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) SD_OPRREG .EQU RTCIO ; USES RTC LATCHES FOR OPERATION SD_OPRDEF .EQU %00000000 ; QUIESCENT STATE +SD_OPRMSK .EQU %00000100 ; MASK FOR BITS WE OWN IN RTC LATCH PORT SD_CS0 .EQU %00000100 ; RTC:2 IS SELECT SD_CNTR .EQU Z180_CNTR SD_TRDR .EQU Z180_TRDR +SD_IOBASE .EQU SD_OPRREG ; IOBASE +SD_INVCS .EQU FALSE ; INVERT CS +; +RTCDEF .SET RTCDEF | SD_OPRDEF ; SET DEFAULT IN HBIOS MAINLINE #ENDIF ; #IF (SDMODE == SDMODE_PPI) ; PPISD -SD_DEVCNT .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) -SD_PPIBASE .EQU PPIBASE ; BASE IO PORT FOR PPI -SD_PPIB .EQU PPIBASE + 1 ; PPI PORT B (INPUT: DOUT) -SD_PPIC .EQU PPIBASE + 2 ; PPI PORT C (OUTPUT: CS, CLK, DIN) -SD_PPIX .EQU PPIBASE + 3 ; PPI CONTROL PORT +SD_DEVMAX .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) +SD_PPIBASE .EQU SDPPIBASE ; BASE IO PORT FOR PPI +SD_PPIB .EQU SDPPIBASE + 1 ; PPI PORT B (INPUT: DOUT) +SD_PPIC .EQU SDPPIBASE + 2 ; PPI PORT C (OUTPUT: CS, CLK, DIN) +SD_PPIX .EQU SDPPIBASE + 3 ; PPI CONTROL PORT SD_OPRREG .EQU SD_PPIC ; PPI PORT C IS OPR REG SD_OPRDEF .EQU %00110001 ; CS HI, DI HI SD_INPREG .EQU SD_PPIB ; INPUT REGISTER IS PPI PORT B @@ -159,21 +176,26 @@ SD_CS0 .EQU %00010000 ; PPIC:4 IS SELECT SD_CLK .EQU %00000010 ; PPIC:1 IS CLOCK SD_DI .EQU %00000001 ; PPIC:0 IS DATA IN (CARD <- CPU) SD_DO .EQU %10000000 ; PPIB:7 IS DATA OUT (CARD -> CPU) +SD_IOBASE .EQU SD_PPIBASE ; IOBASE +SD_INVCS .EQU TRUE ; INVERT CS #ENDIF ; #IF (SDMODE == SDMODE_UART) -SD_DEVCNT .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) +SD_DEVMAX .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) SD_OPRREG .EQU SIO_MCR ; UART MCR PORT (OUTPUT: CS, CLK, DIN) SD_OPRDEF .EQU %00001100 ; QUIESCENT STATE +SD_OPRMSK .EQU %00101101 ; MASK FOR BITS WE OWN IN RTC LATCH PORT SD_INPREG .EQU SIO_MSR ; INPUT REGISTER IS MSR SD_CS0 .EQU %00001000 ; UART MCR:3 IS SELECT SD_CLK .EQU %00000100 ; UART MCR:2 IS CLOCK SD_DI .EQU %00000001 ; UART MCR:0 IS DATA IN (CARD <- CPU) SD_DO .EQU %00100000 ; UART MSR:5 IS DATA OUT (CARD -> CPU) +SD_IOBASE .EQU UARTIOB ; IOBASE +SD_INVCS .EQU TRUE ; INVERT CS #ENDIF ; #IF (SDMODE == SDMODE_DSD) ; DUAL SD -SD_DEVCNT .EQU SDCNT ; NUMBER OF PHYSICAL UNITS (SOCKETS) +SD_DEVMAX .EQU 2 ; NUMBER OF PHYSICAL UNITS (SOCKETS) SD_OPRREG .EQU $08 ; DEDICATED OPERATIONS REGISTER SD_OPRDEF .EQU %00000001 ; QUIESCENT STATE SD_INPREG .EQU SD_OPRREG ; INPUT REGISTER IS OPRREG @@ -183,47 +205,108 @@ SD_CS0 .EQU %00000100 ; RTC:2 IS SELECT SD_CLK .EQU %00000010 ; RTC:1 IS CLOCK SD_DI .EQU %00000001 ; RTC:6 IS DATA IN (CARD <- CPU) SD_DO .EQU %00000001 ; RTC:0 IS DATA OUT (CARD -> CPU) +SD_IOBASE .EQU SD_OPRREG ; IOBASE +SD_INVCS .EQU FALSE ; INVERT CS #ENDIF ; #IF (SDMODE == SDMODE_MK4) ; MARK IV (CSIO STYLE INTERFACE) -SD_DEVCNT .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) +SD_DEVMAX .EQU 1 ; NUMBER OF PHYSICAL UNITS (SOCKETS) SD_OPRREG .EQU $89 ; DEDICATED MK4 SDCARD REGISTER SD_OPRDEF .EQU %00000000 ; QUIESCENT STATE SD_CS0 .EQU %00000100 ; SELECT ACTIVE SD_CNTR .EQU Z180_CNTR SD_TRDR .EQU Z180_TRDR +SD_IOBASE .EQU SD_OPRREG ; IOBASE +SD_INVCS .EQU FALSE ; INVERT CS #ENDIF ; #IF (SDMODE == SDMODE_SC) ; SC -SD_DEVCNT .EQU SDCNT ; NUMBER OF PHYSICAL UNITS (SOCKETS) +SD_DEVMAX .EQU 2 ; NUMBER OF PHYSICAL UNITS (SOCKETS) SD_OPRREG .EQU RTCIO ; USES RTC LATCHES FOR OPERATION SD_OPRDEF .EQU %00001100 ; QUIESCENT STATE (/CS1 & /CS2 DEASSERTED) +SD_OPRMSK .EQU %00001100 ; MASK FOR BITS WE OWN IN RTC LATCH PORT SD_CS0 .EQU %00000100 ; RTC:2 IS SELECT FOR PRIMARY SPI CARD SD_CS1 .EQU %00001000 ; RTC:3 IS SELECT FOR SECONDARY SPI CARD SD_CNTR .EQU Z180_CNTR SD_TRDR .EQU Z180_TRDR +SD_IOBASE .EQU SD_OPRREG ; IOBASE +SD_INVCS .EQU TRUE ; INVERT CS +; +RTCDEF .SET RTCDEF | SD_OPRDEF ; SET DEFAULT IN HBIOS MAINLINE #ENDIF ; -#IF (SDMODE == SDMODE_MT) ; MT shift register for RC2014 (ref SDMODE_CSIO) +#IF (SDMODE == SDMODE_MT) ; MT shift register for RCBUS (ref SDMODE_CSIO) ; ; 3 SPI CHANNELS. CHANNEL 0 (CDX & CSX) IS A DEDICATED CONNECTION TO ONBOARD ; WIZNET W5500 AND IS NOT USED HERE. CHANNEL 1 (CD0 & CS0) & 2 (CD1 & CS1) ; ARE ASSUMED TO BE CONNECTED TO SD CARDS. ; +; NOTE THAT DOING AN "IN RDTR" WILL RETURN THE *EXISTING* CONTENTS +; OF THE SHIFT REGISTER, THEN INITIATE AN SPI READ. SO THE "IN" WILL BE +; RETURNING THE DATA RECEIVED FROM THE PRIOR "IN RDTR", OR "OUT WRTR". +; "IN RDNTR" WILL RETURN THE EXISTING SHIFT REGISTER CONTENTS WITHOUT +; INITIATING A NEW SPI READ. +; +; THANKS TO DOUGLAS MILLER FOR BRINGING THIS BEHAVIOR TO MY ATTENTION +; AND SUPPLYING ASSOCIATED FIXES. +; SD_BASE .EQU $5C ; Module base address -SD_DEVCNT .EQU 2 ; NUMBER OF PHYSICAL UNITS (SOCKETS) +SD_DEVMAX .EQU 2 ; NUMBER OF PHYSICAL UNITS (SOCKETS) SD_WRTR .EQU SD_BASE + 0 ; Write data and transfer SD_RDTR .EQU SD_BASE + 1 ; Read data and transfer SD_RDNTR .EQU SD_BASE + 0 ; Read data and NO transfer SD_OPRREG .EQU SD_BASE + 2 ; SD CHIP SELECTOR SD_OPRDEF .EQU %00000000 ; QUIESCENT STATE SD_CDX .EQU %00000001 ; IN/OUT:SD_OPREG:0 = CD0, PMOD pull CD0 low + #IF (!SDMTSWAP) + ; USE NATURAL ORDER SD_CD0 .EQU %00000010 ; IN:SD_OPREG:1 = CD1, IN=0 Card detect switch SD_CD1 .EQU %00000100 ; IN:SD_OPREG:2 = CD2, IN=0 Card detect switch + #ELSE + ; REVERSE THE PORTS +SD_CD0 .EQU %00000100 ; IN:SD_OPREG:2 = CD2, IN=0 Card detect switch +SD_CD1 .EQU %00000010 ; IN:SD_OPREG:1 = CD1, IN=0 Card detect switch + #ENDIF SD_CSX .EQU %00001000 ; IN/OUT:SD_OPREG:3 = CS0, PMOD SPI CS + #IF (!SDMTSWAP) + ; USE NATURAL ORDER SD_CS0 .EQU %00010000 ; IN/OUT:SD_OPREG:4 = CS1, SDCARD1 CS, IN=1 Card present SD_CS1 .EQU %00100000 ; IN/OUT:SD_OPREG:5 = CS2, SDCARD2 CS, IN=1 Card present - + #ELSE + ; REVERSE THE PORTS +SD_CS0 .EQU %00100000 ; IN/OUT:SD_OPREG:5 = CS2, SDCARD2 CS, IN=1 Card present +SD_CS1 .EQU %00010000 ; IN/OUT:SD_OPREG:4 = CS1, SDCARD1 CS, IN=1 Card present + #ENDIF +SD_IOBASE .EQU SD_BASE ; IOBASE +SD_INVCS .EQU FALSE ; INVERT CS +#ENDIF +; +; +#IF (SDMODE == SDMODE_USR) ; USER DEFINED HARDWARE CONFIGURATION +; +; THIS MODE IS INTENDED TO ALLOW A USER TO EASILY CONFIGURE A CUSTOM +; SD CARD INTERFACE. IT IS NOT YET COMPLETE OR TESTED AND PROBABLY DOES +; NOT YET WORK. +; +SD_DEVMAX .EQU 2 ; NUMBER OF PHYSICAL UNITS (SOCKETS) +SD_IOBASE .EQU $01 ; IO BASE ADDRESS FOR SD INTERFACE +SD_OPRREG .EQU SD_IOBASE ; OUTPUT PORT (OUTPUT: CS, CLK, DIN) +SD_OPRDEF .EQU %00000101 ; OUTPUT PORT DEFAULT STATE +SD_OPRMSK .EQU %00001111 ; OUTPUT PORT MASK +SD_INPREG .EQU SD_IOBASE ; INPUT REGISTER +SD_CS0 .EQU %00001000 ; SELECT +SD_CLK .EQU %00000100 ; CLOCK +SD_DI .EQU %00000010 ; DATA IN (CARD <- CPU) MOSI +SD_DO .EQU %00000001 ; DATA OUT (CARD -> CPU) MISO +SD_CINIT .EQU TRUE ; INITIALIZE OUTPUT PORT +SD_DDR .EQU $03 ; DATA DIRECTION REGISTER +SD_DDRVAL .EQU %00001101 ; DATA DIRECTION REGISTER VALUE +SD_INVCS .EQU FALSE ; INVERT CS +#ENDIF +; +#IF (SD_DEVCNT > SD_DEVMAX) + .ECHO "*** ERROR: SDCNT EXCEEDS MAXIMUM SUPPORTED BY INTERFACE!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR #ENDIF ; ; SD CARD COMMANDS @@ -317,9 +400,10 @@ SD_INIT: LD A,SD_OPRREG CALL PRTHEXBYTE ; - LD A,(RTCVAL) ; GET RTC PORT SHADOW VALUE + LD A,(HB_RTCVAL) ; GET RTC PORT SHADOW VALUE + AND ~SD_OPRMSK ; CLEAR OUR BITS OR SD_OPRDEF ; SET OUR BIT DEFAULTS - LD (RTCVAL),A ; SAVE IT + LD (HB_RTCVAL),A ; SAVE IT #ENDIF ; #IF (SDMODE == SDMODE_N8) @@ -328,9 +412,10 @@ SD_INIT: LD A,SD_OPRREG CALL PRTHEXBYTE ; - LD A,(RTCVAL) ; GET RTC PORT SHADOW VALUE + LD A,(HB_RTCVAL) ; GET RTC PORT SHADOW VALUE + AND ~SD_OPRMSK ; CLEAR OUR BITS OR SD_OPRDEF ; SET OUR BIT DEFAULTS - LD (RTCVAL),A ; SAVE IT + LD (HB_RTCVAL),A ; SAVE IT #ENDIF ; #IF (SDMODE == SDMODE_CSIO) @@ -348,9 +433,10 @@ SD_INIT: LD A,SD_TRDR CALL PRTHEXBYTE ; - LD A,(RTCVAL) ; GET RTC PORT SHADOW VALUE + LD A,(HB_RTCVAL) ; GET RTC PORT SHADOW VALUE + AND ~SD_OPRMSK ; CLEAR OUR BITS OR SD_OPRDEF ; SET OUR BIT DEFAULTS - LD (RTCVAL),A ; SAVE IT + LD (HB_RTCVAL),A ; SAVE IT #ENDIF ; #IF (SDMODE == SDMODE_PPI) @@ -411,9 +497,10 @@ SD_INIT: LD A,SD_TRDR CALL PRTHEXBYTE ; - LD A,(RTCVAL) ; GET RTC PORT SHADOW VALUE + LD A,(HB_RTCVAL) ; GET RTC PORT SHADOW VALUE + AND ~SD_OPRMSK ; CLEAR OUR BITS OR SD_OPRDEF ; SET OUR BIT DEFAULTS - LD (RTCVAL),A ; SAVE IT + LD (HB_RTCVAL),A ; SAVE IT #ENDIF ; #IF (SDMODE == SDMODE_MT) @@ -422,6 +509,13 @@ SD_INIT: LD A,SD_BASE CALL PRTHEXBYTE #ENDIF +; +#IF (SDMODE == SDMODE_USR) + PRTS(" MODE=USER$") + PRTS(" IO=0x$") + LD A,SD_IOBASE + CALL PRTHEXBYTE +#ENDIF ; CALL SD_PROBE ; CHECK FOR HARDWARE JR Z,SD_INIT00 ; CONTINUE IF PRESENT @@ -545,7 +639,8 @@ SD_INITUNIT2: PRTS(" SIZE=$") ; PRINT FIELD LABEL LD B,11 ; 11 BIT SHIFT TO CONVERT BLOCKS --> MB CALL SRL32 ; RIGHT SHIFT - CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + ;CALL PRTDEC ; PRINT LOW WORD IN DECIMAL (HIGH WORD DISCARDED) + CALL PRTDEC32 ; PRINT DWORD IN DECIMAL PRTS("MB$") ; PRINT SUFFIX ; ; CHECK FOR WRITE PROTECT AND NOTIFY USER IF SO @@ -553,6 +648,7 @@ SD_INITUNIT2: RET Z ; IF NOT, DONE PRTS(" WP$") ; NOTIFY USER ; + XOR A ; SIGNAL SUCCESS RET ; DONE ; ;---------------------------------------------------------------------- @@ -654,7 +750,8 @@ SD_FNTBL: SD_VERIFY: SD_FORMAT: SD_DEFMED: - CALL PANIC ; INVALID SUB-FUNCTION + SYSCHKERR(ERR_NOTIMPL) ; INVALID SUB-FUNCTION + RET ; ; ; @@ -679,10 +776,26 @@ SD_IO: LD (SD_BLKCNT),A ; ... AND SAVE IT OR A ; SET FLAGS RET Z ; ZERO SECTOR I/O, RETURN W/ E=0 & A=0 +; +#IF ((SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_SC)) + ; CONSIDER CAPTURING CURRENT CNTR VALUE HERE AND USE IT + ; IN SD_CSIO_DEF + + ; SET CSIO FOR HIGH SPEED OPERATION + CALL SD_WAITTX ; MAKE SURE WE ARE DONE SENDING + CALL DLY32 ; WAIT A BIT MORE FOR FINAL BIT + XOR A ; ZERO MEANS MAX SPEED + OUT0 (SD_CNTR),A ; NOW SET CSIO PORT + ; HOOK RETURN TO RESTORE CSIO TO DEFAULT SPEED + LD HL,SD_CSIO_DEF ; ROUTE RETURN + PUSH HL ; ... THRU CSIO RESTORE +#ENDIF +; #IF (SDTRACE == 1) LD HL,SD_PRTERR ; SET UP SD_PRTERR PUSH HL ; ... TO FILTER ALL EXITS #ENDIF +; CALL SD_SELUNIT ; HARDWARE SELECTION OF TARGET UNIT RET NZ ; ABORT ON ERROR LD A,(SD_CMDVAL) ; GET COMMAND VALUE @@ -719,7 +832,10 @@ SD_IO3: LD E,C ; SECTOR READ COUNT TO E LD HL,(SD_DSKBUF) ; CURRENT DMA TO HL OR A ; SET FLAGS BASED ON RETURN CODE - RET ; AND RETURN, A HAS RETURN CODE + RET Z ; RETURN IF SUCCESS + LD A,ERR_IO ; SIGNAL IO ERROR + OR A ; SET FLAGS + RET ; AND DONE ; ; ; @@ -747,6 +863,8 @@ SD_DEVICE: LD D,DIODEV_SD ; D := DEVICE TYPE LD E,(IY+SD_DEV) ; E := PHYSICAL DEVICE NUMBER LD C,%01010000 ; C := ATTRIBUTES, REMOVABLE, SD CARD + LD H,SDMODE ; H := MODE + LD L,(SD_IOBASE) ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -784,6 +902,8 @@ SD_MEDIA2: LD E,MID_HD ; ASSUME WE ARE OK RET Z ; RETURN IF GOOD INIT LD E,MID_NONE ; SIGNAL NO MEDIA + LD A,ERR_NOMEDIA ; NO MEDIA ERROR + OR A ; SET FLAGS RET ; AND RETURN ; ; @@ -835,6 +955,10 @@ SD_INITCARD: ; CALL SD_CHKCD ; CHECK CARD DETECT JP Z,SD_NOMEDIA ; Z=NO MEDIA, HANDLE IF SO +; +#IF ((SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_SC)) + CALL SD_CSIO_DEF ; ENSURE CSIO AT DEFAULT SPEED +#ENDIF ; ; WAKE UP THE CARD, KEEP DIN HI (ASSERTED) AND /CS HI (DEASSERTED) LD B,$10 ; MIN 74 CLOCKS REQUIRED, WE USE 128 ($10 * 8) @@ -844,6 +968,12 @@ SD_INITCARD1: CALL SD_PUT ; SEND 8 CLOCKS POP BC ; RESTORE LOOP CONTROL DJNZ SD_INITCARD1 ; LOOP AS NEEDED +; + ; MAKE SURE WE FINISH SENDING +#IF ((SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_SC)) + CALL SD_WAITTX ; WAIT FOR TE TO CLEAR + CALL DLY32 ; WAIT A BIT MORE FOR FINAL BIT +#ENDIF ; ; PUT CARD IN IDLE STATE CALL SD_GOIDLE ; GO TO IDLE @@ -874,9 +1004,6 @@ SD_INITCARD3: CALL VDELAY ; CPU SPEED NORMALIZED DELAY ; SEND APP CMD INTRODUCER CALL SD_EXECACMD ; SEND APP COMMAND INTRODUCER -;#IF (SDMODE == SDMODE_MT) -; CALL NZ,SD_EXECACMD ; retry any fail -;#ENDIF CP SD_STCMDERR ; COMMAND ERROR? JR Z,SD_INITCARD3A ; IF SO, TRY MMC CARD INIT OR A ; SET FLAGS @@ -887,7 +1014,11 @@ SD_INITCARD3: LD A,$40 ; P0 = $40 INDICATES WE SUPPORT V2 CARDS LD (SD_CMDP0),A ; SET COMMAND PARM 0 CALL SD_EXECCMDND ; EXEC COMMAND W/ NO DATA RETURNED - RET NZ ; ABORT ON ERROR + ;RET NZ ; ABORT ON ERROR + CP SD_STCMDERR ; COMMAND ERROR? + JR Z,SD_INITCARD3A ; IF SO, TRY MMC CARD INIT + OR A ; SET FLAGS + RET NZ ; ABORT IF ANY OTHER ERROR ; CHECK FOR IDLE, EXIT LOOP IF IDLE CLEARED LD A,(SD_RC) ; GET CARD RESULT CODE OR A ; SET FLAGS @@ -997,13 +1128,16 @@ SD_INITCARD5: CALL SD_EXECCMDND ; EXEC COMMAND W/ NO DATA RET NZ ; ABORT ON ERROR -#IF ((SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_SC)) - ; PER SPEC, THE CARD SHOULD NOW BE ABLE TO HANDLE FULL SPEED OPERATION - ; SO, FOR CSIO OPERATION, WE SET CSIO TO MAXIMUM SPEED - CALL SD_WAITTX ; MAKE SURE WE ARE DONE SENDING - XOR A ; ZERO MEANS MAX SPEED - OUT (Z180_CNTR),A ; NOW SET CSIO PORT -#ENDIF +; HIGH SPEED CSIO OPERATION IS NOW SET AT THE START OF SD_IO +; +;#IF ((SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_SC)) +; ; PER SPEC, THE CARD SHOULD NOW BE ABLE TO HANDLE FULL SPEED OPERATION +; ; SO, FOR CSIO OPERATION, WE SET CSIO TO MAXIMUM SPEED +; CALL SD_WAITTX ; MAKE SURE WE ARE DONE SENDING +; CALL DLY32 ; WAIT A BIT MORE FOR FINAL BIT +; XOR A ; ZERO MEANS MAX SPEED +; OUT0 (SD_CNTR),A ; NOW SET CSIO PORT +;#ENDIF ; ; ISSUE SEND_CSD (TO DERIVE CARD CAPACITY) LD A,SD_CMD_SEND_CSD ; SEND_CSD @@ -1029,10 +1163,16 @@ SD_INITCARD5: ; GET SIZE OF DEVICE IN BLOCKS LD A,(IY+SD_TYPE) ; GET CARD TYPE OR A ; SET FLAGS - CALL Z,PANIC ; PANIC IF CARD TYPE UNKNOWN + JR Z,SD_INITCARD5A ; HANDLE CARD TYPE UNKNOWN CP SD_TYPESDHC ; COMPARE TO SDHC (V2) JP NC,SD_INITCARD8 ; HANDLE SDHC (V2) OR BETTER JR SD_INITCARD6 ; HANDLE MMC OR SDSC +; +SD_INITCARD5A: + PUSH AF + SYSCHKERR(ERR_NOMEDIA) + POP AF + JP SD_NOMEDIA ; ; CAPACITY CALCULATION FOR MMC OR SDSC (V1) CARDS: ; BYTES = (C_SIZE + 1) * 2^(2+C_SIZE_MULT+READ_BL_LEN) = (C_SIZE+1) << (2+C_SIZE_MULT+READ_BL_LEN) @@ -1140,6 +1280,9 @@ SD_SECTIO: CP SD_CMD_WRITE_BLOCK ; WRITE_BLOCK? JR Z,SD_SECTIO2 ; HANDLE WRITE CALL PANIC ; PANIC ON ANYTHING ELSE + LD A,ERR_INTERNAL + OR A + RET SD_SECTIO1: ; GET SECTOR DATA CALL SD_GETDATA ; GET THE BLOCK @@ -1172,6 +1315,9 @@ SD_SETADDR: PUSH AF ; SAVE IT LD A,SD_LBA ; OFFSET OF LBA VALUE CALL LDHLIYA ; HL := IY + A, REG A TRASHED +#IF (DSKYENABLE) + CALL HB_DSKACT ; SHOW ACTIVITY +#ENDIF CALL LD32 ; LOAD IT TO DE:HL, AF IS TRASHED POP AF ; GET CARD TYPE BACK CP SD_TYPESDHC ; IS IT V2 OR BETTER? @@ -1247,6 +1393,13 @@ SD_INITCMD1: INC HL ; POINT TO NEXT BYTE LD (HL),A ; CLEAR IT DJNZ SD_INITCMD1 ; LOOP TILL DONE + ; THE CRC POSITION IS ACTUALLY 7 BITS OF CRC (HIGH BITS) AND + ; 1 BIT INDICATING END OF COMMAND. MOST CARDS DON'T REALLY + ; CARE ABOUT THE END OF COMMAND BIT, BUT I HAVE WORKED WITH + ; AT LEAST ONE PERSON THAT HAD A CARD THAT NEEDED THIS. + ; SO, BELOW WE STUFF THE CRC POSITION WITH $FF. + DEC A ; $FF TO ACCUM + LD (SD_CMDCRC),A ; PUT $FF IN CRC POSITION RET ; ; EXECUTE APP COMMAND @@ -1310,11 +1463,27 @@ SD_EXECCMD1: ; THE FIRST FILL BYTE IS DISCARDED! THIS HACK IS REQUIRED BY ; STUPID SD CARD ADAPTERS THAT NOW OMIT THE MISO PULL-UP. SEE ; COMMENTS AT TOP OF THIS FILE. - CALL SD_GET ; GET A BYTE AND DISCARD IT +; + ;CALL SD_GET ; GET A BYTE AND DISCARD IT +; + ; THE Z180 -K REVISION CSIO DOES NOT KEEP MOSI HIGH WHEN + ; RECEIVING VIA MISO. INSTEAD MOSI IS LEFT AT WHICHEVER LOGIC + ; LEVEL IT WAS LAST SET TO. THIS CAUSES SOME SD CARDS A PROBLEM + ; BECAUSE THEY EXPECT MOSI TO BE CONSISTENTLY HIGH WHEN IDLE. + ; BY USING A PUT INSTEAD OF A GET, WE CAN FORCE MOSI TO BE + ; LEFT AT THE PROPER LOGIC LEVEL. THE SD CARD DOES NOT CARE + ; IF A PUT OR A GET IS USED TO IGNORE THE BYTE BECAUSE THE + ; CLOCK RUNS IN EITHER CASE. + LD A,$FF ; KEEP MOSI HI + CALL SD_PUT ; SEND 8 CLOCKS #ENDIF ; ; GET RESULT LD E,0 ; INIT TIMEOUT LOOP COUNTER +#IF (SDMODE == SDMODE_MT) + CALL SD_GET ; DISCARD STALE DATA FROM PUT +#ENDIF +; SD_EXECCMD2: CALL SD_GET ; GET A BYTE FROM THE CARD OR A ; SET FLAGS @@ -1329,11 +1498,11 @@ SD_EXECCMD3: #IF (SDTRACE >= 3) CALL SD_PRTRC ; IF MAX TRACING, PRINT RC #ENDIF -#IF (DSKYENABLE) - PUSH AF - CALL SD_DSKY ; IF USING DSKY, SHOW IT THERE - POP AF -#ENDIF +;;#IF (DSKYENABLE) +;; PUSH AF +;; CALL SD_DSKY ; IF USING DSKY, SHOW IT THERE +;; POP AF +;;#ENDIF AND ~$01 ; MASK OFF IDLE BIT AND SET FLAGS RET Z ; IF RC = 0, NO ERROR, RETURN CALL SD_DONE ; IF ERROR, COMPLETE TRANSACTION @@ -1442,6 +1611,7 @@ SD_PUTDATA1: OUT (SD_WRTR),A ; SEND IT TWICE LD DE,$7FFF ; LOOP MAX (TIMEOUT) + IN A,(SD_RDTR) ; DISCARD STALE DATA FROM OUT SD_PUTDATA2: IN A,(SD_RDTR) #ELSE @@ -1491,6 +1661,9 @@ SD_PUTDATA3: ; SD_WAITRDY: LD DE,$FFFF ; LOOP MAX (TIMEOUT) +#IF (SDMODE == SDMODE_MT) + CALL SD_GET ; DISCARD STALE DATA - UNKNOWN CONTEXT +#ENDIF SD_WAITRDY1: CALL SD_GET INC A ; $FF -> $00 @@ -1538,31 +1711,46 @@ SD_SETUP: ; #IF ((SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_SC)) ; CSIO SETUP FOR Z180 CSIO -; LD A,2 ; 18MHz/20 <= 400kHz - LD A,6 ; ??? +; LD A,2 ; DIV 80, 225KHZ @ 18MHZ CLK + LD A,6 ; DIV 1280, 14KHZ @ 18MHZ CLK OUT0 (SD_CNTR),A #ENDIF ; #IF ((SDMODE == SDMODE_JUHA) | (SDMODE == SDMODE_N8) | (SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_SC)) - LD A,(RTCVAL) + LD A,(HB_RTCVAL) LD (SD_OPRVAL),A OUT (SD_OPRREG),A #ENDIF ; -#IF ((SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_DSD) | (SDMODE == SDMODE_PPI)| (SDMODE == SDMODE_MT)) +#IF ((SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_DSD) | (SDMODE == SDMODE_PPI) | (SDMODE == SDMODE_MT)) LD A,SD_OPRDEF LD (SD_OPRVAL),A OUT (SD_OPRREG),A #ENDIF ; #IF (SDMODE == SDMODE_UART) -SD_OPRMSK .EQU (SD_CS0 | SD_CLK | SD_DI) IN A,(SD_OPRREG) ; OPRREG == SIO_MCR AND ~SD_OPRMSK ; MASK OFF SD CONTROL BITS OR SD_OPRDEF ; SET DEFAULT BITS LD (SD_OPRVAL),A ; RECORD THE WORKING VALLUE OUT (SD_OPRREG),A ; OPRREG == SIO_MCR #ENDIF +; +#IF (SDMODE == SDMODE_USR) + #IF (SD_CINIT == TRUE) + LD A,(SD_OPRMSK) ; GET OUTPUT PORT MASK + CPL ; INVERT ACCUMULATOR + LD C,A ; SAVE IT FOR LATER + LD A,(SD_DDR) ; GET DATA DIRECTION REGISTER VALUE + AND C ; ZERO ALL INTERESTING BITS + OR (SD_DDRVAL) ; ADD OUR VALUE + LD (SD_DDR),A ; WRITE IT + #ENDIF +; + LD A,SD_OPRDEF + LD (SD_OPRVAL),A + OUT (SD_OPRREG),A +#ENDIF ; XOR A RET @@ -1605,26 +1793,38 @@ SD_CHKWP: ; SELECT CARD ; SD_SELECT: +; ; FINISH SENDING BEFORE ASSERTING CS! +;#IF ((SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_SC)) +; CALL SD_WAITTX +;#ENDIF +; +#IF ((SDMODE == SDMODE_SC) | SDMODE == SDMODE_MT)) LD A,(IY+SD_DEV) ; GET CURRENT DEVICE OR A ; SET FLAGS LD A,(SD_OPRVAL) ; GET CURRENT OPRVAL BACK JR NZ,SD_SELECT1 ; IF NOT ZERO, DO SECONDARY ; ASSERT PRIMARY CS, DEASSERT SECONDARY (IF ANY) OR SD_CS0 -#IF (SD_DEVCNT > 1) + #IF (SD_DEVCNT > 1) AND ~SD_CS1 -#ENDIF + #ENDIF JR SD_SELECT2 SD_SELECT1: ; DEASSERT PRIMARY CS, ASSERT SECONDARY (IF ANY) AND ~SD_CS0 -#IF (SD_DEVCNT > 1) + #IF (SD_DEVCNT > 1) OR SD_CS1 + #ENDIF +#ELSE + LD A,(SD_OPRVAL) ; GET CURRENT OPRVAL BACK + OR SD_CS0 #ENDIF +; SD_SELECT2: ; ADJUST BIT(S) FOR INTERFACES USING INVERTED CS BITS -#IF ((SDMODE == SDMODE_PPI) | (SDMODE == SDMODE_UART) | (SDMODE == SDMODE_SC)) - #IF (SD_DEVCNT > 1) +;#IF ((SDMODE == SDMODE_PPI) | (SDMODE == SDMODE_UART) | (SDMODE == SDMODE_SC)) +#IF (SD_INVCS) + #IF ((SDMODE == SDMODE_SC) & (SD_DEVCNT > 1)) XOR SD_CS0 | SD_CS1 #ELSE XOR SD_CS0 @@ -1632,20 +1832,39 @@ SD_SELECT2: #ENDIF LD (SD_OPRVAL),A OUT (SD_OPRREG),A +;; +;#IF ((SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_SC)) +; CALL DLY32 ; DELAY FOR FINAL BIT +;#ENDIF +; RET ; ; DESELECT CARD ; SD_DESELECT: +#IF ((SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_SC)) + ; DON'T REMOVE CS UNTIL WE ARE DONE SENDING! + CALL SD_WAITTX ; WAIT FOR TE TO CLEAR +; + ; ACCORDING TO Z180 DOCS, IT MAY TAKE UP TO 1 BIT TIME TO + ; FINISH SENDING AFTER TE IS CLEARED. THE DELAY BELOW WILL + ; DO THIS FOR THE SLOWEST POSSIBLE SEND RATE WHICH IS + ; CLK / 1320, SO DELAY AT LEAST 1320 T-STATES +; + ; IN PRACTICE, A SMALLER DELAY IS FINE BASED ON LOGIC ANALYZER + ; TRACES. + CALL DLY32 ; DELAY FOR FINAL BIT +#ENDIF +; LD A,(SD_OPRVAL) -#IF (SD_DEVCNT > 1) +#IF (((SDMODE == SDMODE_SC) | (SDMODE_MT)) & (SD_DEVCNT > 1)) AND ~(SD_CS0 | SD_CS1) #ELSE AND ~SD_CS0 #ENDIF ; ADJUST BIT(S) FOR INTERFACES USING INVERTED CS BITS #IF ((SDMODE == SDMODE_PPI) | (SDMODE == SDMODE_UART) | (SDMODE == SDMODE_SC)) - #IF (SD_DEVCNT > 1) + #IF ((SDMODE == SDMODE_SC) & (SD_DEVCNT > 1)) XOR SD_CS0 | SD_CS1 #ELSE XOR SD_CS0 @@ -1659,19 +1878,19 @@ SD_DESELECT: ; ; CSIO WAIT FOR TRANSMIT READY (TX REGSITER EMPTY) ; -SD_WAITTX: ; WAIT FOR TX EMPTY +SD_WAITTX: IN0 A,(SD_CNTR) ; GET CSIO STATUS BIT 4,A ; TX EMPTY? - JR NZ,SD_WAITTX - RET + JR NZ,SD_WAITTX ; LOOP WHILE BUSY + RET ; DONE ; ; CSIO WAIT FOR RECEIVER READY (BYTE AVAILABLE) ; SD_WAITRX: IN0 A,(SD_CNTR) ; WAIT FOR RECEIVER TO FINISH - BIT 5,A - JR NZ,SD_WAITRX - RET + BIT 5,A ; RX EMPTY? + JR NZ,SD_WAITRX ; LOOP WHILE BUSY + RET ; DONE ; #ENDIF ; @@ -1723,11 +1942,11 @@ SD_GET: #ELSE #IF ((SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_SC)) CALL SD_WAITTX ; MAKE SURE WE ARE DONE SENDING - IN0 A,(Z180_CNTR) ; GET CSIO STATUS + IN0 A,(SD_CNTR) ; GET CSIO STATUS SET 5,A ; START RECEIVER - OUT0 (Z180_CNTR),A + OUT0 (SD_CNTR),A CALL SD_WAITRX - IN0 A,(Z180_TRDR) ; GET RECEIVED BYTE + IN0 A,(SD_TRDR) ; GET RECEIVED BYTE CALL MIRROR ; MSB<-->LSB MIRROR BITS LD A,C ; KEEP RESULT #ELSE @@ -1764,6 +1983,23 @@ SD_GET1: #ENDIF RET ; +; SET CSIO TO DEFAULT SPEED +; +#IF ((SDMODE == SDMODE_CSIO) | (SDMODE == SDMODE_MK4) | (SDMODE == SDMODE_SC)) +; +SD_CSIO_DEF: + ; SET CSIO FOR DEFAULT OPERATION + PUSH AF ; PRESERVE AF + CALL SD_WAITTX ; MAKE SURE WE ARE DONE SENDING + CALL DLY32 ; WAIT A BIT MORE FOR FINAL BIT + LD A,Z180_CNTR_DEF ; DIV 1280, 14KHZ @ 18MHZ CLK + OUT0 (SD_CNTR),A ; DO IT + POP AF ; RESTORE AF + RET +; +#ENDIF +; +; ;============================================================================= ; ERROR HANDLING AND DIAGNOSTICS ;============================================================================= @@ -1835,6 +2071,7 @@ SD_PRTSTAT: PUSH AF PUSH DE PUSH HL + LD A,(IY+SD_STAT) OR A LD DE,SD_STR_STOK JR Z,SD_PRTSTAT1 @@ -1939,29 +2176,29 @@ SD_PRTPREFIX: CALL PC_COLON POP AF RET -; -; DISPLAY COMMAND, LOW ORDER WORD OF PARMS, AND RC -; -#IF (DSKYENABLE) -SD_DSKY: - PUSH AF - PUSH HL - LD HL,DSKY_HEXBUF - LD A,(SD_CMD) - LD (HL),A - INC HL - LD A,(SD_CMDP2) - LD (HL),A - INC HL - LD A,(SD_CMDP3) - LD (HL),A - INC HL - LD A,(SD_RC) - CALL DSKY_HEXOUT - POP HL - POP AF - RET -#ENDIF +;;; +;;; DISPLAY COMMAND, LOW ORDER WORD OF PARMS, AND RC +;;; +;;#IF (DSKYENABLE) +;;SD_DSKY: +;; PUSH AF +;; PUSH HL +;; LD HL,DSKY_HEXBUF +;; LD A,(SD_CMD) +;; LD (HL),A +;; INC HL +;; LD A,(SD_CMDP2) +;; LD (HL),A +;; INC HL +;; LD A,(SD_CMDP3) +;; LD (HL),A +;; INC HL +;; LD A,(SD_RC) +;; CALL DSKY_HEXOUT +;; POP HL +;; POP AF +;; RET +;;#ENDIF ; ;============================================================================= ; STRING DATA diff --git a/Source/HBIOS/simrtc.asm b/Source/HBIOS/simrtc.asm index 2962f098..521b806d 100644 --- a/Source/HBIOS/simrtc.asm +++ b/Source/HBIOS/simrtc.asm @@ -11,6 +11,10 @@ SIMRTC_BUFSIZ .EQU 6 ; SIX BYTE BUFFER (YYMMDDHHMMSS) ; RTC DEVICE INITIALIZATION ENTRY ; SIMRTC_INIT: + LD A,(RTC_DISPACT) ; RTC DISPATCHER ALREADY SET? + OR A ; SET FLAGS + RET NZ ; IF ALREADY ACTIVE, ABORT +; CALL NEWLINE ; FORMATTING PRTS("SIMRTC: $") ; @@ -20,6 +24,9 @@ SIMRTC_INIT: CALL SIMRTC_GETTIM0 POP HL CALL PRTDT +; + LD BC,SIMRTC_DISPATCH + CALL RTC_SETDISP ; XOR A ; SIGNAL SUCCESS RET @@ -42,7 +49,14 @@ SIMRTC_DISPATCH: JP Z,SIMRTC_GETBLK ; GET NVRAM DATA BLOCK VALUES DEC A JP Z,SIMRTC_SETBLK ; SET NVRAM DATA BLOCK VALUES - CALL PANIC + DEC A + JP Z,SIMRTC_GETALM ; GET ALARM + DEC A + JP Z,SIMRTC_SETALM ; SET ALARM + DEC A + JP Z,SIMRTC_DEVICE ; REPORT RTC DEVICE INFO + SYSCHKERR(ERR_NOFUNC) + RET ; ; NVRAM FUNCTIONS ARE NOT AVAILABLE IN SIMULATOR ; @@ -50,7 +64,10 @@ SIMRTC_GETBYT: SIMRTC_SETBYT: SIMRTC_GETBLK: SIMRTC_SETBLK: - CALL PANIC +SIMRTC_GETALM: +SIMRTC_SETALM: + SYSCHKERR(ERR_NOTIMPL) + RET ; ; RTC GET TIME ; A: RESULT (OUT), 0=OK, Z=OK, NZ=ERR @@ -71,13 +88,7 @@ SIMRTC_GETTIM: LD HL,SIMRTC_BUF ; SOURCE ADR POP DE ; DEST ADR LD BC,SIMRTC_BUFSIZ ; LENGTH -#IF (INTMODE == 1) - DI -#ENDIF CALL HB_BNKCPY ; COPY THE CLOCK DATA -#IF (INTMODE == 1) - EI -#ENDIF ; LD DE,60 ; DELAY 60 * 16US = ~1MS CALL VDELAY ; SLOW DOWN SIMH FOR CLOCK TICKING TEST @@ -107,13 +118,7 @@ SIMRTC_SETTIM: LD (HB_DSTBNK),A ; SET IT LD DE,SIMRTC_BUF ; DEST ADR LD BC,SIMRTC_BUFSIZ ; LENGTH -#IF (INTMODE == 1) - DI -#ENDIF CALL HB_BNKCPY ; COPY THE CLOCK DATA -#IF (INTMODE == 1) - EI -#ENDIF ; LD HL,SIMRTC_BUF ; POINT TO TEMP BUF LD A,SIMRTC_CLKWRITE ; WRITE CLOCK COMMAND @@ -126,6 +131,16 @@ SIMRTC_SETTIM: XOR A ; SIGNAL SUCCESS RET ; AND RETURN ; +; REPORT RTC DEVICE INFO +; +SIMRTC_DEVICE: + LD D,RTCDEV_SIMH ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL DEVICE NUMBER + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,SIMRTC_IO ; L := BASE I/O ADDRESS + XOR A ; SIGNAL SUCCESS + RET +; ; WORKING VARIABLES ; SIMRTC_BUF: ; ALL IN BCD!!! diff --git a/Source/HBIOS/sio.asm b/Source/HBIOS/sio.asm index 31000849..4342d9f2 100644 --- a/Source/HBIOS/sio.asm +++ b/Source/HBIOS/sio.asm @@ -30,7 +30,7 @@ SIO_WR1VAL .EQU $00 ; WR1 VALUE FOR NO INTS SIO_WR1VAL .EQU $18 ; WR1 VALUE FOR INT ON RECEIVED CHARS #ENDIF ; -#IF (INTMODE == 2) +#IF ((INTMODE == 2) | (INTMODE == 3)) ; SIO0_IVT .EQU IVT(INT_SIO0) SIO1_IVT .EQU IVT(INT_SIO1) @@ -39,6 +39,13 @@ SIO1_VEC .EQU VEC(INT_SIO1) ; #ENDIF ; +#IF (SIO0MODE == SIOMODE_STD) +SIO0A_CMD .EQU SIO0BASE + $01 +SIO0A_DAT .EQU SIO0BASE + $00 +SIO0B_CMD .EQU SIO0BASE + $03 +SIO0B_DAT .EQU SIO0BASE + $02 +#ENDIF +; #IF (SIO0MODE == SIOMODE_RC) SIO0A_CMD .EQU SIO0BASE + $00 SIO0A_DAT .EQU SIO0BASE + $01 @@ -60,42 +67,35 @@ SIO0B_CMD .EQU SIO0BASE + $07 SIO0B_DAT .EQU SIO0BASE + $05 #ENDIF ; -#IF (SIO0MODE == SIOMODE_EZZ80) -SIO0A_CMD .EQU SIO0BASE + $01 -SIO0A_DAT .EQU SIO0BASE + $00 -SIO0B_CMD .EQU SIO0BASE + $03 -SIO0B_DAT .EQU SIO0BASE + $02 -#ENDIF -; #IF (SIOCNT >= 2) ; -#IF (SIO1MODE == SIOMODE_RC) + #IF (SIO1MODE == SIOMODE_STD) +SIO1A_CMD .EQU SIO1BASE + $01 +SIO1A_DAT .EQU SIO1BASE + $00 +SIO1B_CMD .EQU SIO1BASE + $03 +SIO1B_DAT .EQU SIO1BASE + $02 + #ENDIF +; + #IF (SIO1MODE == SIOMODE_RC) SIO1A_CMD .EQU SIO1BASE + $00 SIO1A_DAT .EQU SIO1BASE + $01 SIO1B_CMD .EQU SIO1BASE + $02 SIO1B_DAT .EQU SIO1BASE + $03 -#ENDIF + #ENDIF ; -#IF (SIO1MODE == SIOMODE_SMB) + #IF (SIO1MODE == SIOMODE_SMB) SIO1A_CMD .EQU SIO1BASE + $02 SIO1A_DAT .EQU SIO1BASE + $00 SIO1B_CMD .EQU SIO1BASE + $03 SIO1B_DAT .EQU SIO1BASE + $01 -#ENDIF + #ENDIF ; -#IF (SIO1MODE == SIOMODE_ZP) + #IF (SIO1MODE == SIOMODE_ZP) SIO1A_CMD .EQU SIO1BASE + $06 SIO1A_DAT .EQU SIO1BASE + $04 SIO1B_CMD .EQU SIO1BASE + $07 SIO1B_DAT .EQU SIO1BASE + $05 -#ENDIF -; -#IF (SIO1MODE == SIOMODE_EZZ80) -SIO1A_CMD .EQU SIO1BASE + $01 -SIO1A_DAT .EQU SIO1BASE + $00 -SIO1B_CMD .EQU SIO1BASE + $03 -SIO1B_DAT .EQU SIO1BASE + $02 -#ENDIF + #ENDIF ; #ENDIF ; @@ -138,62 +138,24 @@ SIO_PREINIT2: OR A ; SET FLAGS JR Z,SIO_PREINIT3 ; IF ZERO, NO SIO DEVICES, ABORT ; -#IF (INTMODE == 1) + #IF (INTMODE == 1) ; ADD IM1 INT CALL LIST ENTRY LD HL,SIO_INT ; GET INT VECTOR CALL HB_ADDIM1 ; ADD TO IM1 CALL LIST -#ENDIF + #ENDIF ; -#IF (INTMODE == 2) - ; SETUP IM2 VECTORS + #IF ((INTMODE == 2) | (INTMODE == 3)) + ; SETUP IM2/3 VECTORS LD HL,SIO_INT0 LD (SIO0_IVT),HL ; IVT INDEX ; -#IF (SIOCNT >= 2) + #IF (SIOCNT >= 2) LD HL,SIO_INT1 LD (SIO1_IVT),HL ; IVT INDEX -#ENDIF -; -#ENDIF + #ENDIF ; -#ENDIF -; -; FOR NOW, THIS IS SPECIFICALLY FOR A CTC TO DRIVE AN SIO -; AT 1:1 USING CTC CHANNELS A & B. IN OTHER WORDS, IT JUST -; PASSES THE INCOMING TRIGGER OUT AT 1:1. -; -#IF (SIOCNT >= 1) - #IF (SIO0CTCC >= 0) - LD A,%01010111 ; CTCC CONTROL WORD VALUE - ; |||||||+-- 1=CONTROL WORD FLAG - ; ||||||+--- 1=SOFTWARE RESET - ; |||||+---- 1=TIME CONSTANT FOLLOWS - ; ||||+----- 0=AUTO TRIGGER WHEN TIME CONST LOADED - ; |||+------ 1=RISING EDGE TRIGGER - ; ||+------- 0=PRESCALER OF 16 (NOT USED) - ; |+-------- 1=COUNTER MODE - ; +--------- 0=NO INTERRUPTS - OUT (CTCA + SIO0CTCC),A ; SETUP CTCC - LD A,1 ; CTC TIMER CONSTANT = 1 - OUT (CTCA + SIO0CTCC),A ; SETUP CTC TIMER CONSTANT #ENDIF -#ENDIF ; -#IF (SIOCNT >= 2) - #IF (SIO1CTCC >= 0) - LD A,%01010111 ; CTCC CONTROL WORD VALUE - ; |||||||+-- 1=CONTROL WORD FLAG - ; ||||||+--- 1=SOFTWARE RESET - ; |||||+---- 1=TIME CONSTANT FOLLOWS - ; ||||+----- 0=AUTO TRIGGER WHEN TIME CONST LOADED - ; |||+------ 1=RISING EDGE TRIGGER - ; ||+------- 0=PRESCALER OF 16 (NOT USED) - ; |+-------- 1=COUNTER MODE - ; +--------- 0=NO INTERRUPTS - OUT (CTCA + SIO1CTCC),A ; SETUP CTCC - LD A,1 ; CTC TIMER CONSTANT = 1 - OUT (CTCA + SIO1CTCC),A ; SETUP CTC TIMER CONSTANT - #ENDIF #ENDIF ; SIO_PREINIT3: @@ -258,12 +220,12 @@ SIO_INT: CALL NZ,SIO_INT0 ; CALL IF CARD EXISTS RET NZ ; DONE IF INT HANDLED ; -#IF (SIOCNT >= 2) + #IF (SIOCNT >= 2) ; CHECK/HANDLE SECOND CARD (SIO1) IF IT EXISTS LD A,(SIO1A_CFG + 1) ; GET SIO TYPE FOR FIRST CHANNEL OF SECOND SIO OR A ; SET FLAGS CALL NZ,SIO_INT1 ; CALL IF CARD EXISTS -#ENDIF + #ENDIF ; RET ; DONE ; @@ -277,7 +239,7 @@ SIO_INT0: LD IY,SIO0B_CFG ; POINT TO SIO0B CFG JR SIO_INTRCV ; TRY TO RECEIVE FROM IT AND RETURN ; -#IF (SIOCNT >= 2) + #IF (SIOCNT >= 2) ; SIO_INT1: ; INTERRUPT HANDLER FOR SECOND SIO (SIO1) @@ -287,7 +249,7 @@ SIO_INT1: LD IY,SIO1B_CFG ; POINT TO SIO1B CFG JR SIO_INTRCV ; TRY TO RECEIVE FROM IT AND RETURN ; -#ENDIF + #ENDIF ; ; HANDLE INT FOR A SPECIFIC CHANNEL ; BASED ON UNIT CFG POINTED TO BY IY @@ -305,6 +267,10 @@ SIO_INTRCV1: ; RECEIVE CHARACTER INTO BUFFER LD C,(IY+4) ; DATA PORT TO C IN A,(C) ; READ PORT + #IF (SIOBOOT != 0) + CP SIOBOOT ; REBOOT REQUEST? + JP Z,SYS_RESCOLD ; IF SO, DO IT, NO RETURN + #ENDIF LD B,A ; SAVE BYTE READ LD L,(IY+7) ; SET HL TO LD H,(IY+8) ; ... START OF BUFFER STRUCT @@ -538,72 +504,245 @@ SIO_INITDEV1: CALL PRTHEXWORD #ENDIF ; - LD A,E ; GET CONFIG LSB - AND $E0 ; CHECK FOR DTR, XON, PARITY=MARK/SPACE - JR NZ,SIO_INITFAIL ; IF ANY BIT SET, FAIL, NOT SUPPORTED + PUSH DE ; SAVE TARGET CONFIG ; + ; WE WANT TO DETERMINE A DIVISOR FOR THE SIO CLOCK + ; THAT RESULTS IN THE DESIRED BAUD RATE. + ; BAUD RATE = SIO CLK / DIVISOR, OR TO SOLVE FOR DIVISOR + ; DIVISOR = SIO CLK / BAUDRATE. + ; TAKE ADVANTAGE OF ENCODED BAUD RATES ALWAYS BEING A FACTOR OF 75. + ; SO, WE CAN USE (SIO OSC / 75) / (BAUDRATE / 75) +; + ; GET SERIAL CLOCK VALUE AND DIVIDE IT BY 75 + PUSH IY ; GET CONFIG TABLE ENTRY PTR + POP HL ; MOVE TO HL + LD A,9 ; OFFSET TO CLK VALUE + CALL ADDHLA ; HL IS NOW PTR TO 32 BIT CLK + CALL LD32 ; LOAD DE:HL W/ RAW CLK VAL + LD C,75 ; DIVIDE BY 75 LIKE BAUD RATE + CALL DIV32X8 ; HL NOW HAS (CLK / 75) +; +#IF (SIODEBUG) + PRTS(" CLK75=$") + CALL PRTHEX32 +#ENDIF +; + ; SCALE DOWN THE 32 BIT VALUE TO FIT IN 16 BITS KEEPING + ; TRACK OF THE NUMBER OF BITS SHIFTED OUT IN B + LD B,0 ; SHIFT COUNTER +SIO_INITDEV1A: + LD A,D ; TEST MSB + OR E ; ... FOR ZERO + JR Z,SIO_INITDEV1B ; IF SO, DONE + SRL D ; 32 BIT RIGHT SHIFT + RR E ; ... + RR H ; ... + RR L ; ... + INC B ; INCREMENT SHIFT COUNTER + JR SIO_INITDEV1A ; AND LOOP +SIO_INITDEV1B: +; +#IF (SIODEBUG) + PRTS(" CLK=$") + CALL PRTHEX32 +#ENDIF +; + POP DE ; RECOVER INCOMING TARGET CFG + PUSH DE ; RESAVE IT + PUSH HL ; SAVE CLK VALUE + PUSH BC ; SAVE BITS SHIFTED + + ; NOW DECODE THE BAUDRATE, BUT WE USE A CONSTANT OF 1 INSTEAD + ; OF THE NORMAL 75. THIS PRODUCES (BAUDRATE / 75). LD A,D ; GET CONFIG MSB AND $1F ; ISOLATE ENCODED BAUD RATE + LD L,A ; PUT IN L + LD H,0 ; H IS ALWAYS ZERO + LD DE,1 ; USE 1 FOR ENCODING CONSTANT + CALL DECODE ; DE:HL := BAUD RATE, ERRORS IGNORED ; #IF (SIODEBUG) - PRTS(" ENC=$") - CALL PRTHEXBYTE + PRTS(" BAUD75=$") + CALL PRTHEX32 #ENDIF -; - PUSH DE ; SAVE REQUESTED CONFIG - LD L,(IY+9) ; LOAD CLK FREQ - LD H,(IY+10) ; ... INTO DE:HL - LD E,(IY+11) ; ... " - LD D,(IY+12) ; ... " - LD C,75 ; BAUD RATE ENCODING CONSTANT - CALL ENCODE ; C = TEST BAUD RATE (ENCODED) = BAUDTST - POP DE ; GET REQ CONFIG BACK, D = BAUDREQ -; - ; BIT 4 (DIV 3) OF BAUDREQ AND BAUDTST MUST MATCH! - LD A,C ; A = BAUDTST - XOR D ; XOR WITH BAUDREQ - BIT 4,A ; DO BIT 4 VALS MATCH? - JR NZ,SIO_INITFAIL ; IF NOT, BAIL OUT -; - LD A,C ; BAUDTST TO A - AND $0F ; ISOLATE DIV 2 BAUD BITS - LD C,A ; C = BAUDTST ; - LD A,D ; MSB W/ BAUD RATE TO A - AND $0F ; ISOLATE DIV 2 BAUD BITS - LD L,A ; L = BAUDREQ -; -; PUSH AF ; *DEBUG* -; CALL NEWLINE ; *DEBUG* -; LD A,L ; *DEBUG* -; CALL PRTHEXBYTE ; *DEBUG* -; LD A,C ; *DEBUG* -; CALL PRTHEXBYTE ; *DEBUG* -; CALL NEWLINE ; *DEBUG* -; POP AF ; *DEBUG* -; - LD A,C ; A = BAUDTST - LD B,$04 ; SIO R4 VAL FOR DIV 1 - CP L ; BAUDTST = BAUDREQ? - JR Z,SIO_INITBROK ; IF MATCH, WE ARE DONE -; - SUB 4 ; DIVIDE BY 16 (NOW DIV 16 TOT) - JR C,SIO_INITFAIL ; FAIL IF UNDERFLOW - LD B,$44 ; SIO R4 VAL FOR DIV 16 - CP L ; BAUDTST = BAUDREQ? - JR Z,SIO_INITBROK ; IF MATCH, WE ARE DONE -; - SUB 1 ; DIVIDE BY 2 (NOW DIV 32 TOT) - JR C,SIO_INITFAIL ; FAIL IF UNDERFLOW - LD B,$84 ; SIO R4 VAL FOR DIV 32 - CP L ; BAUDTST = BAUDREQ? - JR Z,SIO_INITBROK ; IF MATCH, WE ARE DONE + ; SCALE DOWN CLK BY SAME AMOUNT AS BAUD RATE + POP BC ; RESTORE BITS TO SHIFT + LD A,B ; PUT IN ACCUM + OR A ; TEST FOR ZERO + JR Z,SIO_INITDEV1D ; IF ZERO, NO SHIFT, SKIP +SIO_INITDEV1C: + SRL D ; 32 BIT RIGHT SHIFT + RR E ; ... + RR H ; ... + RR L ; ... + DJNZ SIO_INITDEV1C ; LOOP UNTIL DONE SHIFTING +SIO_INITDEV1D: +; +#IF (SIODEBUG) + PRTS(" BAUD=$") + CALL PRTHEX32 +#ENDIF ; - SUB 1 ; DIVIDE BY 2 (NOW DIV 64 TOT) - JR C,SIO_INITFAIL ; FAIL IF UNDERFLOW - LD B,$C4 ; SIO R4 VAL FOR DIV 64 - CP L ; BAUDTST = BAUDREQ? - JR Z,SIO_INITBROK ; IF MATCH, WE ARE DONE + POP DE ; RECOVER CLOCK + EX DE,HL ; SWAP CLOCK & BAUD FOR DIV + ; *** HANDLE DIVIDE BY ZERO??? *** + CALL DIV16 ; BC := HL/DE == TARGET DIVISOR +; +#IF (SIODEBUG) + PRTS(" DIV=$") + CALL PRTHEXWORD +#ENDIF +; +#IF (CTCENABLE) +; + LD A,(IY+13) ; GET CTC CHANNEL + INC A ; $FF -> 0 + JR Z,SIO_ADJDONE ; NO CTC CHANNEL, BYPASS +; + ; HERE WE NEED TO ACCOUNT FOR A SPECIAL CASE OF THE CTC. + ; IF THE CTC TRIGGER RATE IS MORE THAN HALF OF THE CTC CLOCK, + ; THEN THE CTC WILL ONLY COUNT EVERY OTHER TRIGGER PULSE. + ; IN THIS SITUATION, WE NEED TO CUT THE DIVISOR IN HALF + ; TO ACCOUNT FOR THIS. + ; FOR NOW, I JUST TEST TO SEE IF THE CTC TRIGGER AND THE CTC + ; CLOCK ARE THE SAME. I DOUBT THERE IS ANY REALISTIC + ; SCENARIO WHERE THE TRIGGER IS GREATER THAN HALF THE + ; CLOCK BUT ALSO NOT EQUAL TO THE CLOCK. + ; I DON'T DEFINITELY KNOW THE CTC CLOCK FREQ, BUT ASSUME IT + ; IS THE SAME AS THE CPU CLOCK, WHICH IT SHOULD BE. + ; FINALLY, NOTE THAT I AM COMPARING AGAINST THE CPU SPEED + ; DECLARED IN THE BUILD CONFIG, NOT THE DYNAMICALLY MEASURED + ; CPU SPEED. THIS IS CORRECT BECAUSE WE ARE REALLY TRYING TO + ; TEST IF THE CPU CLOCK AND THE TRIGGER FREQ ARE THE *SAME*. + ; ONLY COMPARING THE HIGH WORD VALUES, THAT SHOULD BE ENOUGH. +; + LD A,$FF & (CPUOSC >> 24) ; HIGH BYTE OF CPU FREQ + CP (IY+12) ; CP TO HIGH BYTE OF TRG + JR NZ,SIO_ADJDONE ; IF NE, SKIP ADJUSTMENT + LD A,$FF & (CPUOSC >> 16) ; HIGH BYTE OF CPU FREQ + CP (IY+11) ; CP TO HIGH BYTE OF TRG + JR NZ,SIO_ADJDONE ; IF NE, SKIP ADJUSTMENT +; + SRL B ; RIGHT SHIFT HL + RR C ; ... TO DIVIDE BY 2 + JR NC,SIO_ADJDONE ; DONE IF NO CARRY +; + ; IF CARRY, RESULTANT DIVISOR IS UNWORKABLE + POP DE ; POP STACK + JR SIO_INITFAIL ; AND FAIL + + ; *** CHECK FOR CARRY??? *** +; + #IF (SIODEBUG) + PRTS(" DIV=$") + CALL PRTHEXWORD + #ENDIF +; +SIO_ADJDONE: +; +#ENDIF +; + ; NOW THAT WE HAVE THE TARGET BAUD RATE DIVISOR, WE WILL + ; ATTEMPT TO IMPLEMENT IT. THE SIO ITSELF CAN APPLY + ; A DIVISOR OF 1, 16, 32, OR 64. IF A CTC CHANNEL IS + ; CONFIGURED FOR THIS SERIAL PORT, THEN WE CAN ADDITIONALLY + ; APPLY A SCALER OF 1-256. +; + ; WE START BY DETERMINING THE MAXIMUM POSSIBLE SIO + ; SCALING. +; + ; WARNING: IF THE INCOMING SIO CLOCK IS THE SAME AS THE + ; CPU CLOCK AND WE USE THE 1:1 DIVISOR, THE SIO WILL NOT + ; WORK WELL. +; + PUSH BC ; MOVE WORKING DIVISOR VALUE + POP HL ; ... TO HL + LD A,L ; LOAD LSB OF DIVISOR + LD BC,$0004 ; SHIFT 0 BITS / SIO WR4 DIV 1 + LD A,L ; LOAD LSB OF DIVISOR + AND %00001111 ; DIV 16 POSSIBLE? + JR NZ,SIO_INITDEV2 ; NOPE, DONE TRYING + LD BC,$0444 ; SHIFT 4 BITS / SIO WR4 DIV 16 + LD A,L ; LOAD LSB OF DIVISOR + AND %00011111 ; DIV 32 POSSIBLE? + JR NZ,SIO_INITDEV2 ; NOPE, DONE TRYING + LD BC,$0584 ; SHIFT 5 BITS / SIO WR4 DIV 32 + LD A,L ; LOAD LSB OF DIVISOR + AND %00111111 ; DIV 32 POSSIBLE? + JR NZ,SIO_INITDEV2 ; NOPE, DONE TRYING + LD BC,$06C4 ; SHIFT 6 BITS / SIO WR4 DIV 64 +; + ; NOW APPLY THE SIO DIVISOR TO THE WORKING DIVISOR + ; AND SAVE THE RESULTANT SIO REGISTER VALUE TO APPLY LATER. +SIO_INITDEV2: + ; SHIFT BITS + XOR A ; ZERO ACCUM + OR B ; ZERO BITS TO SHIFT? + JR Z,SIO_INITDEV4 ; BYPASS SHIFTING IF SO +SIO_INITDEV3: + SRL H ; SHIFT HL RIGHT BY + RR L ; ONE BIT + DJNZ SIO_INITDEV3 ; UNTIL ALL BITS DONE +SIO_INITDEV4: + LD B,C ; MOVE SIO WR4 VALUE TO B +; + POP DE ; RESTORE DE = SERIAL CONFIG +; +#IF (SIODEBUG) + PUSH BC + PUSH HL + POP BC + PRTS(" CTCDIV=$") + CALL PRTHEXWORD + POP BC +#ENDIF +; +#IF (CTCENABLE) +; + LD A,(IY+13) ; GET CTC CHANNEL + INC A ; $FF -> 0 + JR Z,SIO_NOCTC ; NO CTC CHANNEL, BYPASS +; + ; HL HAS THE DIVISOR THAT WE WANT TO PROGRAM INTO THE + ; DESIGNATED CTC CHANNEL. HOWEVER, THE CTC REGISTER IS ONE + ; BYTE. A VALUE OF 0 MEANS 256. SO WE NEED TO VALIDATE + ; THAT HL IS BETWEEN 1 AND 256. + DEC HL ; 1-256 -> 0-255 + LD A,H ; MSB NOW MUST BE ZERO + OR A ; SET FLAGS + JR NZ,SIO_INITFAIL ; IF ANY BIT SET, FAIL + INC HL ; RESTORE HL +; + ; ALL GOOD. PROGRAM THE CTC CHANNEL + LD A,(IY+13) ; GET CTC CHANNEL + ADD A,CTCBASE ; ADD TO CTC BASE PORT ADR + #IF (SIODEBUG) + PRTS(" CTC=$") + CALL PRTHEXBYTE + #ENDIF + LD C,A ; AND PUT IN C FOR I/O + LD A,%01010111 ; CTCC CONTROL WORD VALUE + ; |||||||+-- 1=CONTROL WORD FLAG + ; ||||||+--- 1=SOFTWARE RESET + ; |||||+---- 1=TIME CONSTANT FOLLOWS + ; ||||+----- 0=AUTO TRIGGER WHEN TIME CONST LOADED + ; |||+------ 1=RISING EDGE TRIGGER + ; ||+------- 0=PRESCALER OF 16 (NOT USED) + ; |+-------- 1=COUNTER MODE + ; +--------- 0=NO INTERRUPTS + OUT (C),A ; PREP CTC CHANNEL + OUT (C),L ; SET CTC TIMER CONSTANT + JR SIO_INITBROK ; AND REJOIN MAIN SETUP +; +#ENDIF +; +SIO_NOCTC: + ; IF THERE IS NO CTC, THEN THE REMAINING DIVISOR + ; NEEDS TO BE EXACTLY 1 OR WE HAVE A PROBLEM. + LD A,L ; GET REMAINING DIVISOR + DEC A ; 1 -> 0 + JR Z,SIO_INITBROK ; FAIL IF NOT 1 ; SIO_INITFAIL: ; @@ -665,6 +804,28 @@ SIO_INITBROK: ; FAILS. ; SIO_INITSAFE: +; +#IF (CTCENABLE) +; + ; CHECK IF A CTC CHANNEL IS CONFIGURED + LD A,(IY+13) ; GET CTC CHANNEL + INC A ; $FF -> 0 + JR Z,SIO_INITSAFE2 ; NO CTC CHANNEL, BYPASS +; + ; IF A CTC CHANNEL IS CONFIGURED, PROGRAM IT FOR + ; SIMPLE 1:1 SCALING. + LD A,(IY+13) ; GET CTC CHANNEL + ADD A,CTCBASE ; ADD TO CTC BASE PORT ADR + LD C,A ; AND PUT IN C FOR I/O + LD A,%01010111 ; CTCC CONTROL WORD VALUE + OUT (C),A ; PREP CTC CHANNEL + LD A,1 ; TIMER CONSTANT IS 1 + OUT (C),A ; SET CTC TIMER CONSTANT +; +#ENDIF +; +SIO_INITSAFE2: + ; SETUP DEFAULT VALUES FOR SIO REGISTERS LD HL,SIO_INITDEFS LD DE,SIO_INITVALS LD BC,SIO_INITLEN @@ -674,7 +835,7 @@ SIO_INITGO: ; ; SET INTERRUPT VECTOR OFFSET WR2 ; -#IF (INTMODE == 2) +#IF ((INTMODE == 2) | (INTMODE == 3)) LD A,(IY+2) ; CHIP / CHANNEL SRL A ; SHIFT AWAY CHANNEL BIT LD L,SIO0_VEC ; ASSUME CHIP 0 @@ -682,7 +843,8 @@ SIO_INITGO: LD L,SIO1_VEC ; ASSUME CHIP 1 DEC A ; CHIP 1? JR Z,SIO_INITIVT ; IF SO, DO IT - CALL PANIC ; IMPOSSIBLE SITUATION + SYSCHKERR(ERR_NOUNIT) ; IMPOSSIBLE SITUATION + RET SIO_INITIVT: LD A,L ; VALUE TO A LD (SIO_WR2),A ; SAVE IT @@ -789,6 +951,8 @@ SIO_DEVICE: LD D,CIODEV_SIO ; D := DEVICE TYPE LD E,(IY) ; E := PHYSICAL UNIT LD C,$00 ; C := DEVICE TYPE, 0x00 IS RS-232 + LD H,(IY+14) ; H := MODE + LD L,(IY+3) ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET ; @@ -931,10 +1095,10 @@ SIO_MAP .DB 0 ; CHIP PRESENCE BITMAP SIO0A_RCVBUF .EQU 0 SIO0B_RCVBUF .EQU 0 ; -#IF (SIOCNT >= 2) + #IF (SIOCNT >= 2) SIO1A_RCVBUF .EQU 0 SIO1B_RCVBUF .EQU 0 -#ENDIF + #ENDIF ; #ELSE ; @@ -952,7 +1116,7 @@ SIO0B_HD .DW SIO0B_BUF ; BUFFER HEAD POINTER SIO0B_TL .DW SIO0B_BUF ; BUFFER TAIL POINTER SIO0B_BUF .FILL SIO_BUFSZ,0 ; RECEIVE RING BUFFER ; -#IF (SIOCNT >= 2) + #IF (SIOCNT >= 2) ; ; SIO1 CHANNEL A RECEIVE BUFFER SIO1A_RCVBUF: @@ -968,7 +1132,7 @@ SIO1B_HD .DW SIO1B_BUF ; BUFFER HEAD POINTER SIO1B_TL .DW SIO1B_BUF ; BUFFER TAIL POINTER SIO1B_BUF .FILL SIO_BUFSZ,0 ; RECEIVE RING BUFFER ; -#ENDIF + #ENDIF ; #ENDIF ; @@ -984,8 +1148,10 @@ SIO0A_CFG: .DB SIO0A_DAT ; DATA PORT .DW SIO0ACFG ; LINE CONFIGURATION .DW SIO0A_RCVBUF ; POINTER TO RCV BUFFER STRUCT - .DW (SIO0ACLK / SIO0ADIV) & $FFFF ; CLOCK FREQ AS - .DW (SIO0ACLK / SIO0ADIV) >> 16 ; ... DWORD VALUE + .DW SIO0ACLK & $FFFF ; CLOCK FREQ AS + .DW SIO0ACLK >> 16 ; ... DWORD VALUE + .DB SIO0ACTCC ; CTC CHANNEL + .DB SIO0MODE ; MODE ; SIO_CFGSIZ .EQU $ - SIO_CFG ; SIZE OF ONE CFG TABLE ENTRY ; @@ -998,8 +1164,10 @@ SIO0B_CFG: .DB SIO0B_DAT ; DATA PORT .DW SIO0BCFG ; LINE CONFIGURATION .DW SIO0B_RCVBUF ; POINTER TO RCV BUFFER STRUCT - .DW (SIO0BCLK / SIO0BDIV) & $FFFF ; CLOCK FREQ AS - .DW (SIO0BCLK / SIO0BDIV) >> 16 ; ... DWORD VALUE + .DW SIO0BCLK & $FFFF ; CLOCK FREQ AS + .DW SIO0BCLK >> 16 ; ... DWORD VALUE + .DB SIO0BCTCC ; CTC CHANNEL + .DB SIO0MODE ; MODE ; #IF (SIOCNT >= 2) ; @@ -1012,8 +1180,10 @@ SIO1A_CFG: .DB SIO1A_DAT ; DATA PORT .DW SIO1ACFG ; LINE CONFIGURATION .DW SIO1A_RCVBUF ; POINTER TO RCV BUFFER STRUCT - .DW (SIO1ACLK / SIO1ADIV) & $FFFF ; CLOCK FREQ AS - .DW (SIO1ACLK / SIO1ADIV) >> 16 ; ... DWORD VALUE + .DW SIO1ACLK & $FFFF ; CLOCK FREQ AS + .DW SIO1ACLK >> 16 ; ... DWORD VALUE + .DB SIO1ACTCC ; CTC CHANNEL + .DB SIO1MODE ; MODE ; ; SIO1 CHANNEL B SIO1B_CFG: @@ -1024,8 +1194,10 @@ SIO1B_CFG: .DB SIO1B_DAT ; DATA PORT .DW SIO1BCFG ; LINE CONFIGURATION .DW SIO1B_RCVBUF ; POINTER TO RCV BUFFER STRUCT - .DW (SIO1BCLK / SIO1BDIV) & $FFFF ; CLOCK FREQ AS - .DW (SIO1BCLK / SIO1BDIV) >> 16 ; ... DWORD VALUE + .DW SIO1BCLK & $FFFF ; CLOCK FREQ AS + .DW SIO1BCLK >> 16 ; ... DWORD VALUE + .DB SIO1BCTCC ; CTC CHANNEL + .DB SIO1MODE ; MODE ; #ENDIF ; diff --git a/Source/HBIOS/sn76489.asm b/Source/HBIOS/sn76489.asm new file mode 100644 index 00000000..59570c07 --- /dev/null +++ b/Source/HBIOS/sn76489.asm @@ -0,0 +1,487 @@ +;====================================================================== +; SN76489 SOUND DRIVER +; +; WRITTEN BY: DEAN NETHERTON +;====================================================================== +; +; SN74489 PSG CHIP NEEDS AN INPUT CLOCK FREQUENCY OF +; NO MORE THAN 4 MHZ. THE CLOSEST THING THERE IS TO A STANDARD +; IS THE MSX FREQ OF 3.579545 MHZ. +; +; TODO: +; 1. PROVIDE SUPPORT FOR NOISE CHANNEL +; 2. DOES THIS WORK FOR FASTER CPUS? ONLY BEEN TESTED ON A Z80 7MHZ UNIT +; +;====================================================================== +; CONSTANTS +;====================================================================== +; +#IF (SNMODE == SNMODE_VGM) +SN76489_PORT_LEFT .EQU $C6 ; PORTS FOR ACCESSING THE SN76489 CHIP (LEFT) +SN76489_PORT_RIGHT .EQU $C7 ; PORTS FOR ACCESSING THE SN76489 CHIP (RIGHT) +#ENDIF +; +#IF (SNMODE == SNMODE_RC) +SN76489_PORT_LEFT .EQU $FF ; PORTS FOR ACCESSING THE SN76489 CHIP (LEFT) +SN76489_PORT_RIGHT .EQU $FB ; PORTS FOR ACCESSING THE SN76489 CHIP (RIGHT) +#ENDIF +; +SN7_IDAT .EQU 0 +SN7_TONECNT .EQU 3 ; COUNT NUMBER OF TONE CHANNELS +SN7_NOISECNT .EQU 1 ; COUNT NUMBER OF NOISE CHANNELS +SN7_CHCNT .EQU SN7_TONECNT + SN7_NOISECNT +CHANNEL_0_SILENT .EQU $9F +CHANNEL_1_SILENT .EQU $BF +CHANNEL_2_SILENT .EQU $DF +CHANNEL_3_SILENT .EQU $FF +; + .ECHO "SN76489 CLOCK: " + .ECHO SN7CLK + .ECHO "\n" +; +#INCLUDE "audio.inc" +; +SN76489_INIT: + LD IY, SN7_IDAT ; POINTER TO INSTANCE DATA + LD BC, SN7_FNTBL ; BC := FUNCTION TABLE ADDRESS + LD DE, SN7_IDAT ; DE := SN7 INSTANCE DATA PTR + CALL SND_ADDENT ; ADD ENTRY, A := UNIT ASSIGNED + + LD DE,STR_MESSAGELT + CALL WRITESTR + LD A, SN76489_PORT_LEFT + CALL PRTHEXBYTE + + LD DE,STR_MESSAGERT + CALL WRITESTR + LD A, SN76489_PORT_RIGHT + CALL PRTHEXBYTE + + CALL SN7_VOLUME_OFF + XOR A ; SIGNAL SUCCESS + RET + +;====================================================================== +; SN76489 DRIVER - SOUND ADAPTER (SND) FUNCTIONS +;====================================================================== +; +SN7_RESET: + AUDTRACE(SNT_INIT) + CALL SN7_VOLUME_OFF + XOR A ; SIGNAL SUCCESS + RET + +SN7_VOLUME_OFF: + AUDTRACE(SNT_VOLOFF) + + +#IFDEF SBCV2004 + LD A,(HB_RTCVAL) + OR %00001000 ; SBC-V2-004+ CHANGE + OUT (RTCIO),A ; TO HALF CLOCK SPEED +#ENDIF + + LD A, CHANNEL_0_SILENT + OUT (SN76489_PORT_LEFT), A + OUT (SN76489_PORT_RIGHT), A + + LD A, CHANNEL_1_SILENT + OUT (SN76489_PORT_LEFT), A + OUT (SN76489_PORT_RIGHT), A + + LD A, CHANNEL_2_SILENT + OUT (SN76489_PORT_LEFT), A + OUT (SN76489_PORT_RIGHT), A + + LD A, CHANNEL_3_SILENT + OUT (SN76489_PORT_LEFT), A + OUT (SN76489_PORT_RIGHT), A + +#IFDEF SBCV2004 + LD A,(HB_RTCVAL) + AND %11110111 ; SBC-V2-004+ CHANGE TO + OUT (RTCIO),A ; NORMAL CLOCK SPEED +#ENDIF + + RET + +; BIT MAPPING +; SET TONE: +; 1 CC 0 PPPP (LOW) +; 0 0 PPPPPP (HIGH) + +; 1 CC 1 VVVV + +SN7_VOLUME: + AUDTRACE(SNT_VOL) + AUDTRACE_L + AUDTRACE_CR + LD A, L + LD (SN7_PENDING_VOLUME), A + + XOR A ; SIGNAL SUCCESS + RET + +SN7_NOTE: + LD DE, SN7NOTETBL + CALL AUD_NOTE ; RETURNS PERIOD IN HL, FALL THRU +; +SN7_PERIOD: + AUDTRACE(SNT_PERIOD) + AUDTRACE_HL + AUDTRACE_CR +; + LD A,H ; IF ZERO - ERROR + OR L + JR Z,SN7_PERIOD1 +; + LD A,H ; MAXIMUM TONE PERIOD IS 10-BITS + AND 11111100B ; ALLOWED RANGE IS 0001-03FF (1023) + JR NZ,SN7_PERIOD1 ; RETURN NZ IF NUMBER TOO LARGE + LD (SN7_PENDING_PERIOD),HL ; SAVE AND RETURN SUCCESSFUL + XOR A ; SET SUCCESS + RET +; +SN7_PERIOD1: + LD HL,$FFFF ; REQUESTED PERIOD IS LARGER + LD (SN7_PENDING_PERIOD),HL ; THAN PSG CAN SUPPORT, SO + OR $FF ; SET PERIOD TO $FFFF + RET ; AND RETURN FAILURE +; +SN7_PLAY: + AUDTRACE(SNT_PLAY) + AUDTRACE_D + AUDTRACE_CR + + LD A, (SN7_PENDING_PERIOD + 1) + CP $FF + JR Z, SN7_PLAY1 ; PERIOD IS TOO LARGE, UNABLE TO PLAY + CALL SN7_APPLY_VOL + CALL SN7_APPLY_PRD + + XOR A ; SIGNAL SUCCESS + RET + +SN7_PLAY1: ; TURN CHANNEL VOL TO OFF AND STOP PLAYING + LD A, (SN7_PENDING_VOLUME) + PUSH AF + LD A, 0 + LD (SN7_PENDING_VOLUME), A + CALL SN7_APPLY_VOL + POP AF + LD (SN7_PENDING_VOLUME), A + + OR $FF ; SIGNAL FAILURE + RET + +SN7_QUERY: + LD A, E + CP BF_SNDQ_CHCNT + JR Z, SN7_QUERY_CHCNT + + CP BF_SNDQ_PERIOD + JR Z, SN7_QUERY_PERIOD + + CP BF_SNDQ_VOLUME + JR Z, SN7_QUERY_VOLUME + + CP BF_SNDQ_DEV + JR Z, SN7_QUERY_DEV + + OR $FF ; SIGNAL FAILURE + RET + +SN7_QUERY_CHCNT: + LD B, SN7_TONECNT + LD C, SN7_NOISECNT + XOR A + RET + +SN7_QUERY_PERIOD: + LD HL, (SN7_PENDING_PERIOD) + XOR A + RET + +SN7_QUERY_VOLUME: + LD A, (SN7_PENDING_VOLUME) + LD L, A + LD H, 0 + + XOR A + RET + +SN7_QUERY_DEV: + + LD B, SNDDEV_SN76489 + LD DE, SN76489_PORT_LEFT ; E WITH LEFT PORT + LD HL, SN76489_PORT_RIGHT ; L WITH RIGHT PORT + + XOR A + RET +; +; UTIL FUNCTIONS +; + +SN7_APPLY_VOL: ; APPLY VOLUME TO BOTH LEFT AND RIGHT CHANNELS + PUSH BC ; D CONTAINS THE CHANNEL NUMBER + PUSH AF + LD A, D + AND $3 + RLCA + RLCA + RLCA + RLCA + RLCA + OR $90 + LD B, A + + LD A, (SN7_PENDING_VOLUME) + RRCA + RRCA + RRCA + RRCA + + AND $0F + LD C, A + LD A, $0F + SUB C + AND $0F + OR B ; A CONTAINS COMMAND TO SET VOLUME FOR CHANNEL + + AUDTRACE(SNT_REGWR) + AUDTRACE_A + AUDTRACE_CR + +#IFDEF SBCV2004 + PUSH AF + LD A,(HB_RTCVAL) + OR %00001000 ; SBC-V2-004+ CHANGE + OUT (RTCIO),A ; TO HALF CLOCK SPEED + POP AF +#ENDIF + + OUT (SN76489_PORT_LEFT), A + OUT (SN76489_PORT_RIGHT), A + +#IFDEF SBCV2004 + LD A,(HB_RTCVAL) + AND %11110111 ; SBC-V2-004+ CHANGE TO + OUT (RTCIO),A ; NORMAL CLOCK SPEED +#ENDIF + + POP AF + POP BC + RET + +SN7_APPLY_PRD: + PUSH DE + PUSH BC + PUSH AF + LD HL, (SN7_PENDING_PERIOD) + + LD A, D + AND $3 + RLCA + RLCA + RLCA + RLCA + RLCA + OR $80 + LD B, A ; PERIOD COMMAND 1 - CONTAINS CHANNEL ONLY + + LD A, L ; GET LOWER 4 BITS FOR COMMAND 1 + AND $F + OR B ; A NOW CONTAINS FIRST PERIOD COMMAND + + AUDTRACE(SNT_REGWR) + AUDTRACE_A + AUDTRACE_CR + +#IFDEF SBCV2004 + PUSH AF + LD A,(HB_RTCVAL) + OR %00001000 ; SBC-V2-004+ CHANGE + OUT (RTCIO),A ; TO HALF CLOCK SPEED + POP AF +#ENDIF + + OUT (SN76489_PORT_LEFT), A + OUT (SN76489_PORT_RIGHT), A + +#IFDEF SBCV2004 + LD A,(HB_RTCVAL) + AND %11110111 ; SBC-V2-004+ CHANGE TO + OUT (RTCIO),A ; NORMAL CLOCK SPEED +#ENDIF + + LD A, L ; RIGHT SHIFT OUT THE LOWER 4 BITS + RRCA + RRCA + RRCA + RRCA + AND $F + LD B, A + + LD A, H + AND $3 + RLCA + RLCA + RLCA + RLCA ; AND PLACE IN BITS 5 AND 6 + OR B ; OR THE TWO SETS OF BITS TO MAKE 2ND PERIOD COMMAND + + AUDTRACE(SNT_REGWR) + AUDTRACE_A + AUDTRACE_CR + +#IFDEF SBCV2004 + PUSH AF + LD A,(HB_RTCVAL) + OR %00001000 ; SBC-V2-004+ CHANGE + OUT (RTCIO),A ; TO HALF CLOCK SPEED + POP AF +#ENDIF + + OUT (SN76489_PORT_LEFT), A + OUT (SN76489_PORT_RIGHT), A + +#IFDEF SBCV2004 + LD A,(HB_RTCVAL) + AND %11110111 ; SBC-V2-004+ CHANGE TO + OUT (RTCIO),A ; NORMAL CLOCK SPEED +#ENDIF + + POP AF + POP BC + POP DE + RET + +SN7_DURATION: + LD (SN7_PENDING_DURATION),HL ; SET TONE DURATION + XOR A + RET + +SN7_DEVICE: + LD D,SNDDEV_SN76489 ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL UNIT + LD C,$00 ; C := DEVICE TYPE + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,SN76489_PORT_LEFT ; L := BASE I/O ADDRESS + XOR A + RET + +SN7_FNTBL: + .DW SN7_RESET + .DW SN7_VOLUME + .DW SN7_PERIOD + .DW SN7_NOTE + .DW SN7_PLAY + .DW SN7_QUERY + .DW SN7_DURATION + .DW SN7_DEVICE +; +#IF (($ - SN7_FNTBL) != (SND_FNCNT * 2)) + .ECHO "*** INVALID SND FUNCTION TABLE ***\n" + !!!!! +#ENDIF + +SN7_PENDING_PERIOD + .DW 0 ; PENDING PERIOD (10 BITS) +SN7_PENDING_VOLUME + .DB 0 ; PENDING VOL (8 BITS -> DOWNCONVERTED TO 4 BITS AND INVERTED) +SN7_PENDING_DURATION + .DW 0 ; PENDING DURATION (16 BITS) + +STR_MESSAGELT .DB "\r\nSN76489: LEFT IO=0x$" +STR_MESSAGERT .DB ", RIGHT IO=0x$" + +#IF AUDIOTRACE +SNT_INIT .DB "\r\nSN7_INIT\r\n$" +SNT_VOLOFF .DB "\r\nSN7_VOLUME OFF\r\n$" +SNT_VOL .DB "\r\nSN7_VOLUME: $" +SNT_NOTE .DB "\r\nSN7_NOTE: $" +SNT_PERIOD .DB "\r\nSN7_PERIOD: $" +SNT_PLAY .DB "\r\nSN7_PLAY CH: $" +SNT_REGWR .DB "\r\nOUT SN76489, $" +#ENDIF +; +;====================================================================== +; QUARTER TONE FREQUENCY TABLE +;====================================================================== +; +; THE FOLLOWING TABLE MAPS A FULL OCTAVE OF QUARTER-NOTES +; STARTING AT A# IN OCTAVE 0 TO THE CORRESPONDING PERIOD +; VALUE TO USE ON THE PSG TO ACHIEVE THE DESIRED NOTE FREQUENCY. +; +; THE FREQUENCY PRODUCED BY THE SN76489 IS: +; FREQ = CLOCK / 32 / PERIOD +; +; SO, TO MAP A DESIRED FREQUENCY TO A PERIOD, WE USE: +; PERIOD = CLOCK / 32 / FREQ +; +; IN ORDER TO IMPROVE THE RESOLUTION OF THE FREQUENCY +; VALUE USED, WE ALSO MULTPLY BOTH SIDES OF THE EQUATION +; BY 100: +; PERIOD * 100 = (CLOCK / 32 / FREQ) * 100 +; +; THE RESULTING PERIOD VALUE CAN BE REPEATEDLY HALVED +; TO TO JUMP UP AS MANY OCTAVES AS DESIRED. +; +; THE FINAL VALUE IS SHIFTED BY AUD_SCALE BITS +; IN ORDER TO IMPROVE THE RESOLUTION. THIS FINAL SHIFT +; IS REMOVED WHEN IN THE AY_NOTE ROUTINE. +; +; ASSUMING A CLOCK OF 3.579545 MHZ, THE FIRST PLAYABLE +; NOTE WILL BE A2 (HBIOS NOTE CODE 92). +; +SN7RATIO .EQU (SN7CLK * 100) / (32 >> AUD_SCALE) +; +SN7NOTETBL: + .DW SN7RATIO / 2913 ; A0#/B0b + .DW SN7RATIO / 2956 ; + .DW SN7RATIO / 2999 ; + .DW SN7RATIO / 3042 ; + .DW SN7RATIO / 3086 ; B0 + .DW SN7RATIO / 3131 ; + .DW SN7RATIO / 3177 ; + .DW SN7RATIO / 3223 ; + .DW SN7RATIO / 3270 ; C1 + .DW SN7RATIO / 3318 ; + .DW SN7RATIO / 3366 ; + .DW SN7RATIO / 3415 ; + .DW SN7RATIO / 3464 ; C1#/D1b + .DW SN7RATIO / 3515 ; + .DW SN7RATIO / 3566 ; + .DW SN7RATIO / 3618 ; + .DW SN7RATIO / 3670 ; D1 + .DW SN7RATIO / 3724 ; + .DW SN7RATIO / 3778 ; + .DW SN7RATIO / 3833 ; + .DW SN7RATIO / 3889 ; D1#/E1b + .DW SN7RATIO / 3945 ; + .DW SN7RATIO / 4003 ; + .DW SN7RATIO / 4061 ; + .DW SN7RATIO / 4120 ; E1 + .DW SN7RATIO / 4180 ; + .DW SN7RATIO / 4241 ; + .DW SN7RATIO / 4302 ; + .DW SN7RATIO / 4365 ; F1 + .DW SN7RATIO / 4428 ; + .DW SN7RATIO / 4493 ; + .DW SN7RATIO / 4558 ; + .DW SN7RATIO / 4624 ; F1#/G1b + .DW SN7RATIO / 4692 ; + .DW SN7RATIO / 4760 ; + .DW SN7RATIO / 4829 ; + .DW SN7RATIO / 4899 ; G1 + .DW SN7RATIO / 4971 ; + .DW SN7RATIO / 5043 ; + .DW SN7RATIO / 5116 ; + .DW SN7RATIO / 5191 ; G1#/A1b + .DW SN7RATIO / 5266 ; + .DW SN7RATIO / 5343 ; + .DW SN7RATIO / 5421 ; + .DW SN7RATIO / 5499 ; A1 + .DW SN7RATIO / 5579 ; + .DW SN7RATIO / 5661 ; + .DW SN7RATIO / 5743 ; diff --git a/Source/HBIOS/spk.asm b/Source/HBIOS/spk.asm index e1575660..ee3b803c 100644 --- a/Source/HBIOS/spk.asm +++ b/Source/HBIOS/spk.asm @@ -1,46 +1,190 @@ +;====================================================================== +; +; BIT MODE SOUND DRIVER FOR SBC V2 USING BIT 0 OF RTC DRIVER ; ;====================================================================== -; I/O BIT DRIVER FOR CONSOLE BELL FOR SBC V2 USING BIT 0 OF RTC DRIVER +; +; LIMITATIONS - CPU FREQUENCY ADJUSTMENT LIMITED TO 1MHZ RESOLUTION +; QUARTER TONES NOT SUPPORTED +; DURATION FIXED TO 1 SECOND. +; NO VOLUME ADJUSTMENT DUE TO HARDWARE LIMITATION ;====================================================================== ; -SPK_INIT: - CALL NEWLINE ; FORMATTING +; DRIVER FUNCTION TABLE AND INSTANCE DATA +; +SP_FNTBL: + .DW SP_STUB ; SP_RESET + .DW SP_STUB ; SP_VOLUME + .DW SP_PERIOD + .DW SP_NOTE + .DW SP_PLAY + .DW SP_QUERY + .DW SP_DURATION + .DW SP_DEVICE +; +#IF (($ - SP_FNTBL) != (SND_FNCNT * 2)) + .ECHO "*** INVALID SND FUNCTION TABLE ***\n" + !!!!! +#ENDIF +; +SP_IDAT .EQU 0 ; NO INSTANCE DATA ASSOCIATED WITH THIS DEVICE +; +SP_TONECNT .EQU 1 ; COUNT NUMBER OF TONE CHANNELS +SP_NOISECNT .EQU 0 ; COUNT NUMBER OF NOISE CHANNELS +; +SP_RTCIOMSK .EQU 00000100B +; +; FOR OTHER DRIVERS, THE PERIOD VALUE FOR THE TONE IS STORED AT PENDING_PERIOD +; FOR THE SPK DRIVER THE ADDRESS IN THE TONE TABLE IS STORED IN PENDING_PERIOD +; +SP_PENDING_PERIOD .DW SP_NOTE_C8 ; PENDING PERIOD (16 BITS) +SP_PENDING_VOLUME .DB $FF ; PENDING VOL (8 BITS) +SP_PENDING_DURATION .DW 0 ; PENDING DURATION (16 BITS) +; +;====================================================================== +; DRIVER INITIALIZATION +;====================================================================== +; +SP_INIT: + LD IY, SP_IDAT ; SETUP FUNCTION TABLE + LD BC, SP_FNTBL ; POINTER TO INSTANCE DATA + LD DE, SP_IDAT ; BC := FUNCTION TABLE ADDRESS + CALL SND_ADDENT ; DE := INSTANCE DATA PTR +; + CALL NEWLINE ; ANNOUNCE DEVICE PRTS("SPK: IO=0x$") LD A,RTCIO CALL PRTHEXBYTE - CALL SPK_SETTBL - CALL SPK_BEEP ; PLAY A NOTE + CALL SP_SETTBL ; SETUP TONE TABLE + CALL SP_PLAY ; PLAY DEFAULT NOTE XOR A RET ; -; SETUP THE SPEAKER NOTE TABLE ACCORDING TO THE CPU SPEED. -; FREQUENCY ACCURACY DECREASES AS CLOCK SPEED MULITPLIER INCREASES. -; 1MHZ ERROR MAY OCCUR IF CPU CLOCK IS UNDER. I.E 3.999 = 3MHZ - -SPK_SETTBL: - LD A,(CB_CPUMHZ) ; GET CPU SPEED. - LD C,A - - LD B,SPK_NOTCNT ; SET NUMBER OF NOTES TO - LD HL,SPK_TUNTBL+2 ; ADJUST AND START POINT - -SPK_SETTBL2: +;====================================================================== +; SOUND DRIVER FUNCTION - RESET +;====================================================================== +; +;SP_RESET: +; XOR A ; SUCCESSFULL RESET +; RET +; +;====================================================================== +; SOUND DRIVER FUNCTION - VOLUME +;====================================================================== +; +;SP_VOLUME: +; XOR A ; SIGNAL SUCCESS +; RET +; +;====================================================================== +; SOUND DRIVER FUNCTION - PERIOD +;====================================================================== +; +SP_PERIOD: + LD (SP_PENDING_PERIOD), HL ; SAVE AND RETURN SUCCESSFUL +SP_STUB: + XOR A + RET +; +;====================================================================== +; SOUND DRIVER FUNCTION - NOTE +;====================================================================== +; +SP_NOTE: +; CALL PRTHEXWORDHL +; CALL PC_COLON PUSH HL - LD A,(HL) ; READ - LD E,A ; IN - INC HL ; THE - LD A,(HL) ; 1MHZ - LD D,A ; NOTE - + PUSH DE ; ON ENTRY HL IS A NOTE INDEX + LD A,L ; CONVERT THIS NOTE INDEX + AND 00000011B ; TO THE ASSOCIATED ENTRY + JR Z,SP_NOTE1 ; IN THE TUNE TABLE. +; + LD HL,$FFFF ; QUARTER NOTES + JR SP_NOTE2 ; NOT SUPPORTED +; +SP_NOTE1: + LD DE,SP_TUNTBL ; SAVE THIS ADDRESS AS + ADD HL,DE ; THE PERIOD +SP_NOTE2: +; CALL PRTHEXWORDHL +; CALL NEWLINE + LD (SP_PENDING_PERIOD),HL + POP DE + POP HL + RET +; +;====================================================================== +; SOUND DRIVER FUNCTION - QUERY AND SUBFUNCTIONS +;====================================================================== +; +SP_QUERY: + LD A, E + CP BF_SNDQ_CHCNT ; SUB FUNCTION 01 + JR Z, SP_QUERY_CHCNT +; + CP BF_SNDQ_VOLUME ; SUB FUNCTION 02 + JR Z, SP_QUERY_VOLUME +; + CP BF_SNDQ_PERIOD ; SUB FUNCTION 03 + JR Z, SP_QUERY_PERIOD +; + CP BF_SNDQ_DEV ; SUB FUNCTION 04 + JR Z, SP_QUERY_DEV +; + OR $FF ; SIGNAL FAILURE + RET +; +SP_QUERY_CHCNT: + LD BC,(SP_TONECNT*256)+SP_NOISECNT ; RETURN NUMBER OF + XOR A ; TONE AND NOISE + RET ; CHANNELS IN BC +; +SP_QUERY_PERIOD: + LD HL, (SP_PENDING_PERIOD) ; RETURN 16-BIT PERIOD + XOR A ; IN HL REGISTER + RET +; +SP_QUERY_VOLUME: + LD L, 255 ; RETURN 8-BIT VOLUME + XOR A ; IN L REGISTER + RET +; +SP_QUERY_DEV: + LD B, SNDDEV_BITMODE ; RETURN DEVICE IDENTIFIER + LD DE, (RTCIO*256)+SP_RTCIOMSK ; AND ADDRESS AND DATA PORT + XOR A + RET +; +;====================================================================== +; INITIALIZE THE TONE TABLE - ONLY ACCURATE FOR 1MHZ INCREMENTS +;====================================================================== +; +SP_SETTBL: + LD BC,(CB_CPUMHZ) ; GET MHZ CPU SPEED (IN C). +; +SP_SETTBL3: + LD B,SP_NOTCNT ; SET NUMBER OF NOTES TO + LD HL,SP_TUNTBL+2 ; ADJUST AND START POINT +; +SP_SETTBL2: + PUSH HL + LD E,(HL) ; READ IN + INC HL ; THE 1MHZ + LD D,(HL) ; NOTE +; PUSH BC LD B,C - LD HL,0 ; MULTIPLY -SPK_SETTBL1: ; 1MHZ NOTE - ADD HL,DE ; VALUE BY - DJNZ SPK_SETTBL1 ; SYSTEM MHZ + LD HL,0 ; MULTIPLY 1MHZ +SP_SETTBL1: ; NOTE VALUE BY + ADD HL,DE ; SYSTEM MHZ + JR NC,SP_SETBL4 + LD HL,$FFFF ; FOR CPU > 10MHz + LD B,1 ; HANDLE OVERFLOW +SP_SETBL4: + DJNZ SP_SETTBL1 POP BC ; - LD DE,30 ; ADD OVEREAD + LD DE,15 ; ADD OVERHEAD ADD HL,DE ; COMPENSATION ; POP DE ; RECALL NOTE @@ -52,34 +196,49 @@ SPK_SETTBL1: ; 1MHZ NOTE INC HL ; NOTE INC HL ; AND MOVE INC HL ; TO NEXT - - DJNZ SPK_SETTBL2 ; NEXT NOTE +; + DJNZ SP_SETTBL2 ; NEXT NOTE RET - -SPK_BEEP: - LD HL,SPK_NOTE_C8 ; SELECT NOTE ; - LD A,(HL) ; LOAD 1ST ARG +;====================================================================== +; SOUND DRIVER FUNCTION - PLAY +;====================================================================== +; +SP_PLAY: + LD HL,(SP_PENDING_PERIOD) ; SELECT NOTE +; + LD A,$FF ; EXIT WITH ERROR + CP H ; STATUS IF INVALID + JR NZ,SP_PLAY1 ; PERIOD ($FFFF) + CP L + RET Z + +SP_PLAY1: + LD E,(HL) ; LOAD 1ST ARG INC HL ; IN DE - LD E,A - LD A,(HL) + LD D,(HL) INC HL - LD D,A ; - LD A,(HL) ; LOAD 2ND ARG + LD C,(HL) ; LOAD 2ND ARG INC HL ; IN BC - LD C,A - LD A,(HL) + LD B,(HL) INC HL - LD B,A +; +; LD A,$FF ; EXIT WITH ERROR + CP B ; STATUS IF INVALID + JR NZ,SP_PLAY2 ; NOTE ($FFFF) + CP C + RET Z +; +SP_PLAY2: PUSH BC ; SETUP ARG IN HL POP HL ; - CALL SPK_BEEPER ; PLAY +; CALL SP_BEEPER ; PLAY ; - RET +; RET ; -; The following SPK_BEEPER routine is a modification of code from +; The following SP_BEEPER routine is a modification of code from ; "The Complete SPECTRUM ROM DISSASSEMBLY" by Dr Ian Logan & Dr Frank O’Hara ; ; https://www.esocop.org/docs/CompleteSpectrumROMDisassemblyThe.pdf @@ -87,9 +246,9 @@ SPK_BEEP: ; DE Number of passes to make through the sound generation loop ; HL Loop delay parameter ; -SPK_BEEPER: +SP_BEEPER: PUSH IX - DI ; Disable the interrupt for the duration of a 'beep'. + HB_DI ; Disable the interrupt for the duration of a 'beep'. LD A,L ; Save L temporarily. SRL L ; Each '1' in the L register is to count 4 T states, but take INT (L/4) and count 16 T states instead. SRL L @@ -99,7 +258,7 @@ SPK_BEEPER: LD B,$00 LD IX,SPK_DLYADJ ; The base address of the timing loop. ADD IX,BC ; Alter the length of the timing loop. Use an earlier starting point for each '1' lost by taking INT (L/4). - LD A,(RTCVAL) ; Fetch the present border colour from BORDCR and move it to bits 2, 1 and 0 of the A register. + LD A,(HB_RTCVAL) ; Fetch the present border colour from BORDCR and move it to bits 2, 1 and 0 of the A register. ; ; The HL register holds the 'length of the timing loop' with 16 T states being used for each '1' in the L register and 1024 T states for each '1' in the H register. ; @@ -118,7 +277,7 @@ BE_H_L_LP: ; ; The loudspeaker is now alternately activated and deactivated. ; - XOR %00000100 ; Flip bit 2. + XOR SP_RTCIOMSK ; Flip bit 2. OUT (RTCIO),A ; Perform the 'OUT' operation, leaving other bits unchanged. LD B,H ; Reset the B register. LD C,A ; Save the A register. @@ -142,122 +301,151 @@ BE_AGAIN: INC C ; Add 16 T states as this path is shorter. JP (IX) ; Jump back. BE_END: - EI + HB_EI POP IX + RET ; ALWAYS EXITS WITH SUCCESS STATUS (A=0) +; +;====================================================================== +; SOUND DRIVER FUNCTION - DURATION +;====================================================================== +; +SP_DURATION: + LD (SP_PENDING_DURATION),HL; SET TONE PERIOD TO ZERO + XOR A RET ; -; STANDARD ONE SECOND TONE TABLES AT 1MHZ (UNCOMPENSATED). FOR SPK_BEEPER, FIRST WORD LOADED INTO DE, SECOND INTO HL -; -; EXCEL SPREADSHEET FOR CALCULATION CAN BE FOUND HERE: -; -; https://www.retrobrewcomputers.org/lib/exe/fetch.php?media=boards:sbc:sbc_v2:sbc_v2-004:spk_beep_tuntbl.xlsx -; -SPK_TUNTBL: - .DW $13, $191A ; D - .DW $14, $17B3 ; E0 - .DW $15, $165E ; F0 - .DW $17, $151E ; F - .DW $18, $13EE ; G0 - .DW $19, $12CF ; G - .DW $1B, $11C1 ; A0 - .DW $1D, $10C1 ; A - .DW $1E, $FD1 ; B0 - .DW $20, $EEE ; C1 - .DW $22, $E17 ; C - .DW $24, $D4D ; D1 - .DW $26, $C8E ; D - .DW $29, $BD9 ; E1 - .DW $2B, $B2F ; F1 - .DW $2E, $A8E ; F - .DW $31, $9F7 ; G1 - .DW $33, $968 ; G - .DW $37, $8E0 ; A1 - .DW $3A, $861 ; A - .DW $3D, $7E8 ; B1 - .DW $41, $777 ; C2 - .DW $45, $70B ; C - .DW $49, $6A6 ; D2 - .DW $4D, $647 ; D - .DW $52, $5EC ; E2 - .DW $57, $597 ; F2 - .DW $5C, $547 ; F - .DW $62, $4FB ; G2 - .DW $67, $4B3 ; G - .DW $6E, $470 ; A2 - .DW $74, $430 ; A - .DW $7B, $3F4 ; B2 - .DW $82, $3BB ; C3 - .DW $8A, $385 ; C - .DW $92, $353 ; D3 - .DW $9B, $323 ; D - .DW $A4, $2F6 ; E3 - .DW $AE, $2CB ; F3 - .DW $B9, $2A3 ; F - .DW $C4, $27D ; G3 - .DW $CF, $259 ; G - .DW $DC, $238 ; A3 - .DW $E9, $218 ; A - .DW $F6, $1FA ; B3 - .DW $105, $1DD ; C4 - .DW $115, $1C2 ; C - .DW $125, $1A9 ; D4 - .DW $137, $191 ; D - .DW $149, $17B ; E4 - .DW $15D, $165 ; F4 - .DW $171, $151 ; F - .DW $188, $13E ; G4 - .DW $19F, $12C ; G - .DW $1B8, $11C ; A4 - .DW $1D2, $10C ; A - .DW $1ED, $FD ; B4 - .DW $20B, $EE ; C5 - .DW $22A, $E1 ; C - .DW $24B, $D4 ; D5 - .DW $26E, $C8 ; D - .DW $293, $BD ; E5 - .DW $2BA, $B2 ; F5 - .DW $2E3, $A8 ; F - .DW $30F, $9F ; G5 - .DW $33E, $96 ; G - .DW $370, $8E ; A5 - .DW $3A4, $86 ; A - .DW $3DB, $7E ; B5 - .DW $416, $77 ; C6 - .DW $454, $70 ; C - .DW $496, $6A ; D6 - .DW $4DC, $64 ; D - .DW $526, $5E ; E6 - .DW $574, $59 ; F6 - .DW $5C7, $54 ; F - .DW $61F, $4F ; G6 - .DW $67D, $4B ; G - .DW $6E0, $47 ; A6 - .DW $748, $43 ; A - .DW $7B7, $3F ; B6 - .DW $82D, $3B ; C7 - .DW $8A9, $38 ; C - .DW $92D, $35 ; D7 - .DW $9B9, $32 ; D - .DW $A4D, $2F ; E7 - .DW $AE9, $2C ; F7 - .DW $B8F, $2A ; F - .DW $C3F, $27 ; G7 - .DW $CFA, $25 ; G - .DW $DC0, $23 ; A7 - .DW $E91, $21 ; A - .DW $F6F, $1F ; B7 -SPK_NOTE_C8: - .DW $105A, $1D ; C8 - .DW $1152, $1C ; C - .DW $125A, $1A ; D8 - .DW $1372, $19 ; D - .DW $149A, $17 ; E8 - .DW $15D3, $16 ; F8 - .DW $171F, $15 ; F - .DW $187F, $13 ; G8 - .DW $19F4, $12 ; G - .DW $1B80, $11 ; A8 - .DW $1D22, $10 ; A - .DW $1EDE, $F ; B8 - -SPK_NOTCNT .EQU ($-SPK_TUNTBL) / 4 +;====================================================================== +; SOUND DRIVER FUNCTION - DEVICE +;====================================================================== +; +SP_DEVICE: + LD D,SNDDEV_BITMODE ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL UNIT + LD C,$00 ; C := DEVICE TYPE + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,RTCIO ; L := BASE I/O ADDRESS + XOR A + RET +; +;====================================================================== +; +; STANDARD ONE SECOND TONE TABLES AT 1MHZ. +; FOR SP_BEEPER ROUTINE, FIRST WORD LOADED INTO DE, SECOND INTO HL +; +;====================================================================== +; +#DEFINE SP_TONESET(SP_FREQ) .DW SP_FREQ/100, 12500000/SP_FREQ +; +SP_TUNTBL: + SP_TONESET(1635) ; C0 + SP_TONESET(1732) ; C + SP_TONESET(1835) ; D0 + SP_TONESET(1945) ; D + SP_TONESET(2060) ; E0 + SP_TONESET(2183) ; F0 + SP_TONESET(2312) ; F + SP_TONESET(2450) ; G0 + SP_TONESET(2596) ; G + SP_TONESET(2750) ; A0 + SP_TONESET(2914) ; A + SP_TONESET(3087) ; B0 + SP_TONESET(3270) ; C1 + SP_TONESET(3465) ; C + SP_TONESET(3671) ; D1 + SP_TONESET(3889) ; D + SP_TONESET(4120) ; E1 + SP_TONESET(4365) ; F1 + SP_TONESET(4625) ; F + SP_TONESET(4900) ; G1 + SP_TONESET(5191) ; G + SP_TONESET(5500) ; A1 + SP_TONESET(5827) ; A + SP_TONESET(6174) ; B1 + SP_TONESET(6541) ; C2 + SP_TONESET(6930) ; C + SP_TONESET(7342) ; D2 + SP_TONESET(7778) ; D + SP_TONESET(8241) ; E2 + SP_TONESET(8731) ; F2 + SP_TONESET(9250) ; F + SP_TONESET(9800) ; G2 + SP_TONESET(10383) ; G + SP_TONESET(11000) ; A2 + SP_TONESET(11654) ; A + SP_TONESET(12347) ; B2 + SP_TONESET(13081) ; C3 + SP_TONESET(13859) ; C + SP_TONESET(14683) ; D3 + SP_TONESET(15556) ; D + SP_TONESET(16481) ; E3 + SP_TONESET(17461) ; F3 + SP_TONESET(18500) ; F + SP_TONESET(19600) ; G3 + SP_TONESET(20765) ; G + SP_TONESET(22000) ; A3 + SP_TONESET(23308) ; A + SP_TONESET(24694) ; B3 + SP_TONESET(26163) ; C4 + SP_TONESET(27718) ; C + SP_TONESET(29366) ; D4 + SP_TONESET(31113) ; D + SP_TONESET(32963) ; E4 + SP_TONESET(34923) ; F4 + SP_TONESET(36999) ; F + SP_TONESET(39200) ; G4 + SP_TONESET(41530) ; G + SP_TONESET(44000) ; A4 + SP_TONESET(46616) ; A + SP_TONESET(49388) ; B4 + SP_TONESET(52325) ; C5 + SP_TONESET(55437) ; C + SP_TONESET(58733) ; D5 + SP_TONESET(62225) ; D + SP_TONESET(65925) ; E5 + SP_TONESET(69846) ; F5 + SP_TONESET(73999) ; F + SP_TONESET(78399) ; G5 + SP_TONESET(83061) ; G + SP_TONESET(88000) ; A5 + SP_TONESET(93233) ; A + SP_TONESET(98777) ; B5 + SP_TONESET(104650) ; C6 + SP_TONESET(110873) ; C + SP_TONESET(117466) ; D6 + SP_TONESET(124451) ; D + SP_TONESET(131851) ; E6 + SP_TONESET(139691) ; F6 + SP_TONESET(147998) ; F + SP_TONESET(156798) ; G6 + SP_TONESET(166122) ; G + SP_TONESET(179000) ; A6 + SP_TONESET(186466) ; A + SP_TONESET(197553) ; B6 + SP_TONESET(209300) ; C7 + SP_TONESET(221746) ; C + SP_TONESET(234932) ; D7 + SP_TONESET(248902) ; D + SP_TONESET(263702) ; E7 + SP_TONESET(279383) ; F7 + SP_TONESET(295996) ; F + SP_TONESET(313596) ; G7 + SP_TONESET(332244) ; G + SP_TONESET(352000) ; A7 + SP_TONESET(372931) ; A + SP_TONESET(395107) ; B7 +SP_NOTE_C8: + SP_TONESET(418601) ; C8 + SP_TONESET(443492) ; C + SP_TONESET(469863) ; D8 + SP_TONESET(497803) ; D + SP_TONESET(527404) ; E8 + SP_TONESET(558765) ; F8 + SP_TONESET(591991) ; F + SP_TONESET(627193) ; G8 + SP_TONESET(664488) ; G + SP_TONESET(704000) ; A8 + SP_TONESET(745862) ; A + SP_TONESET(790213) ; B8 +; +SP_NOTCNT .EQU ($-SP_TUNTBL) / 4 +; diff --git a/Source/HBIOS/std.asm b/Source/HBIOS/std.asm index 9a51672a..a4d3729e 100644 --- a/Source/HBIOS/std.asm +++ b/Source/HBIOS/std.asm @@ -2,17 +2,20 @@ ; the requested build configuraton file to bring in platform specifics. ; There are several hardware platforms supported by SBC. -; 1. SBC Z80 SBC (v1 or v2) w/ ECB interface +; 1. SBC Z80 SBC (v1 or v2) w/ ECB interface ; 2. ZETA Standalone Z80 SBC w/ SBC compatibility ; 3. ZETA2 Second version of ZETA with enhanced memory bank switching ; 4. N8 MSX-ish Z180 SBC w/ onboard video and sound ; 5. MK4 Mark IV Z180 based SBC w/ ECB interface ; 6. UNA Any Z80/Z180 computer with UNA BIOS -; 7. RCZ80 RC2014 based system with 512K banked RAM/ROM card -; 8. RCZ180 RC2014 based system with Z180 CPU -; 9. EZZ80 Easy Z80, Z80 SBC w/ RC2014 bus and CTC +; 7. RCZ80 RCBUS based system with 512K banked RAM/ROM card +; 8. RCZ180 RCBUS based system with Z180 CPU +; 9. EZZ80 Easy Z80, Z80 SBC w/ RCBUS and CTC ; 10. SCZ180 Steve Cousins Z180 based system -; 11. DYNO Steve Garcia's Dyno Micro-ATX Motherboard +; 11. DYNO Steve Garcia's Dyno Micro-ATX Motherboard +; 12. RCZ280 Z280 CPU on RCBUS or ZZ80MB +; 13. MBC Andrew Lynch's Multi Board Computer +; 14. RPH Andrew Lynch's RHYOPHYRE Graphics Computer ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; @@ -20,8 +23,8 @@ ; #INCLUDE "../ver.inc" ; ADD BIOSVER ; -FALSE .EQU 0 -TRUE .EQU ~FALSE +FALSE .EQU 0 +TRUE .EQU ~FALSE ; ; DEBUGGING OPTIONS ; @@ -30,20 +33,15 @@ USEXIO .EQU 1 ; BASIC SERIAL DRIVER USEMIO .EQU 2 ; MEMORY BUFFER DRIVER WBWDEBUG .EQU USENONE ; -; PRIMARY HARDWARE PLATFORMS -; -PLT_SBC .EQU 1 ; SBC ECB Z80 SBC -PLT_ZETA .EQU 2 ; ZETA Z80 SBC -PLT_ZETA2 .EQU 3 ; ZETA Z80 V2 SBC -PLT_N8 .EQU 4 ; N8 (HOME COMPUTER) Z180 SBC -PLT_MK4 .EQU 5 ; MARK IV -PLT_UNA .EQU 6 ; UNA BIOS -PLT_RCZ80 .EQU 7 ; RC2014 W Z80 -PLT_RCZ180 .EQU 8 ; RC2014 W/ Z180 -PLT_EZZ80 .EQU 9 ; EASY Z80 -PLT_SCZ180 .EQU 10 ; SCZ180 -PLT_DYNO .EQU 11 ; DYNO MICRO-ATX MOTHERBOARD +; DIAGNOSTIC LEVEL OPTIONS ; +DL_NONE .EQU 0 ; HBIOS DISPLAY NO MESSAGES +DL_CRITICAL .EQU 4 ; HBIOS DISPLAY CRITICAL ERROR MESSAGES +DL_ERROR .EQU 8 ; HBIOS DISPLAYS ALL ERROR MESSAGES +DL_WARNING .EQU 12 ; HBIOS DISPLAYS WARNING MESSAGES +DL_INFO .EQU 16 ; HBIOS DISPLAYS INFORMATIONAL MESSAGES +DL_DETAIL .EQU 20 ; HBIOS DISPLAYS DETAILED DIAGNOSTIC MESSAGES +DL_VERBOSE .EQU 24 ; HBIOS DISPLAYS ANYTHING IT KNOWS HOW TO ; ; CPU TYPES ; @@ -65,6 +63,10 @@ MM_SBC .EQU 1 ; ORIGINAL N8VEM/RBC Z80 SBC BANKED MEMORY MM_Z2 .EQU 2 ; 16K X 4 BANKED MEMORY INTRODUCED ON ZETA2 MM_N8 .EQU 3 ; Z180 CUSTOMIZED FOR N8 MEMORY EXTENSIONS MM_Z180 .EQU 4 ; Z180 NATIVE MEMORY MANAGER +MM_Z280 .EQU 5 ; Z280 NATIVE MEMORY MANAGER +MM_ZRC .EQU 6 ; ZRC BANK SWITCHING +MM_MBC .EQU 7 ; MBC MEMORY MANAGER +MM_RPH .EQU 8 ; Z180 WITH RPH EXTENSIONS ; ; BOOT STYLE ; @@ -89,40 +91,31 @@ FDM360 .EQU 2 ; 5.25" FLOPPY, 360KB, 2 SIDES, 40 TRKS, 9 SECTORS FDM120 .EQU 3 ; 5.25" FLOPPY, 1.2MB, 2 SIDES, 80 TRKS, 15 SECTORS FDM111 .EQU 4 ; 8" FLOPPY, 1.11MB, 2 SIDES, 74 TRKS, 15 SECTORS ; -; MEDIA ID VALUES -; -MID_NONE .EQU 0 -MID_MDROM .EQU 1 -MID_MDRAM .EQU 2 -MID_RF .EQU 3 -MID_HD .EQU 4 -MID_FD720 .EQU 5 -MID_FD144 .EQU 6 -MID_FD360 .EQU 7 -MID_FD120 .EQU 8 -MID_FD111 .EQU 9 -; ; ZILOG CTC MODE SELECTIONS ; CTCMODE_NONE .EQU 0 ; NO CTC -CTCMODE_ZP .EQU 1 ; ZILOG PERIPHERALS ECB CTC -CTCMODE_Z2 .EQU 2 ; ZETA2 ONBOARD CTC -CTCMODE_EZ .EQU 3 ; EASY Z80 ONBOARD CTC -CTCMODE_RC .EQU 4 ; RC2014 CTC MODULE (ALSO KIO) +CTCMODE_CTR .EQU 1 ; CTC COUNTER +CTCMODE_TIM16 .EQU 2 ; CTC TIMER W/ DIV 16 +CTCMODE_TIM256 .EQU 3 ; CTC TIMER W/ DIV 256 ; -; DS RTC MODE SELECTIONS +; DS1302 RTC MODE SELECTIONS ; DSRTCMODE_NONE .EQU 0 ; NO DSRTC DSRTCMODE_STD .EQU 1 ; ORIGINAL DSRTC CIRCUIT (SBC, ZETA, MK4) DSRTCMODE_MFPIC .EQU 2 ; MF/PIC VARIANT ; +; DS1307 RTC MODE SELECTIONS +; +DS7RTCMODE_NONE .EQU 0 ; NO DSRTC +DS7RTCMODE_PCF .EQU 1 ; PCF8584 I2C +; ; SIO MODE SELECTIONS ; SIOMODE_NONE .EQU 0 -SIOMODE_RC .EQU 1 ; RC2014 SIO MODULE (SPENCER OWEN) -SIOMODE_SMB .EQU 2 ; RC2014 SIO MODULE (SCOTT BAKER) -SIOMODE_ZP .EQU 3 ; ECB-ZILOG PERIPHERALS BOARD -SIOMODE_EZZ80 .EQU 4 ; EASY Z80 ON-BOARD SIO/0 +SIOMODE_STD .EQU 1 ; STD SIO REG CFG (EZZ80, KIO) +SIOMODE_RC .EQU 2 ; RCBUS SIO MODULE (SPENCER OWEN) +SIOMODE_SMB .EQU 3 ; RCBUS SIO MODULE (SCOTT BAKER) +SIOMODE_ZP .EQU 4 ; ECB-ZILOG PERIPHERALS BOARD ; ; TYPE OF CONSOLE BELL TO USE ; @@ -130,6 +123,18 @@ CONBELL_NONE .EQU 0 CONBELL_PSG .EQU 1 CONBELL_IOBIT .EQU 2 ; +; LED MODE SELECTIONS +; +LEDMODE_NONE .EQU 0 +LEDMODE_STD .EQU 1 +LEDMODE_RTC .EQU 2 +; +; DSKY MODE SELECTIONS +; +DSKYMODE_NONE .EQU 0 +DSKYMODE_V1 .EQU 1 +DSKYMODE_NG .EQU 2 +; ; FD MODE SELECTIONS ; FDMODE_NONE .EQU 0 @@ -139,9 +144,11 @@ FDMODE_ZETA2 .EQU 3 ; ZETA V2 FDMODE_DIDE .EQU 4 ; DUAL IDE FDMODE_N8 .EQU 5 ; N8 FDMODE_DIO3 .EQU 6 ; DISKIO V3 -FDMODE_RCSMC .EQU 7 ; RC2014 SMC 9266 @ $40 (SCOTT BAKER) -FDMODE_RCWDC .EQU 8 ; RC2014 WDC 37C65 @ $40 (SCOTT BAKER) +FDMODE_RCSMC .EQU 7 ; RCBUS SMC 9266 @ $40 (SCOTT BAKER) +FDMODE_RCWDC .EQU 8 ; RCBUS WDC 37C65 @ $40 (SCOTT BAKER) FDMODE_DYNO .EQU 9 ; DYNO WDC 37C65 @ $84 +FDMODE_EPFDC .EQU 10 ; RCBUS ETCHED PIXELS FDC +FDMODE_MBC .EQU 11 ; MULTI-BOARD COMPUTER FDC ; ; IDE MODE SELECTIONS ; @@ -149,7 +156,7 @@ IDEMODE_NONE .EQU 0 IDEMODE_DIO .EQU 1 ; DISKIO V1 IDEMODE_DIDE .EQU 2 ; DUAL IDE IDEMODE_MK4 .EQU 3 ; MARK IV ONBOARD IDE (8 BIT ONLY) -IDEMODE_RC .EQU 4 ; RC2014 CF MODULE (8 BIT ONLY) +IDEMODE_RC .EQU 4 ; RCBUS CF MODULE (8 BIT ONLY) ; ; PPIDE MODE SELECTIONS ; @@ -158,8 +165,9 @@ PPIDEMODE_SBC .EQU 1 ; STANDARD SBC PARALLEL PORT PPIDEMODE_DIO3 .EQU 2 ; DISKIO V3 PARALLEL PORT PPIDEMODE_MFP .EQU 3 ; MULTIFUNCTION / PIC PPIDEMODE_N8 .EQU 4 ; MULTIFUNCTION / PIC -PPIDEMODE_RC .EQU 5 ; RC2014 PPIDE MODULE @ $20 (ED BRINDLEY) +PPIDEMODE_RC .EQU 5 ; RCBUS PPIDE MODULE @ $20 (ED BRINDLEY) PPIDEMODE_DYNO .EQU 6 ; DYNO PPIDE @ $4C +PPIDEMODE_RPH .EQU 7 ; RHYOPHYRE (RPH) ; ; SD MODE SELECTIONS ; @@ -172,21 +180,69 @@ SDMODE_UART .EQU 5 ; SD INTERFACE VIA UART SDMODE_DSD .EQU 6 ; DUAL SD SDMODE_MK4 .EQU 7 ; MARK IV SDMODE_SC .EQU 8 ; SC (Steve Cousins) -SDMODE_MT .EQU 9 ; MT (Shift register SPI WIZNET for RC2014) +SDMODE_MT .EQU 9 ; MT (Shift register SPI WIZNET for RCBUS) +SDMODE_USR .EQU 10 ; USER DEFINED (in sd.asm) (NOT COMPLETE) ; -; SOUND CHIP MODE SELECTIONS +; AY SOUND CHIP MODE SELECTIONS ; AYMODE_NONE .EQU 0 AYMODE_N8 .EQU 1 ; N8 BUILT-IN SOUND AYMODE_SCG .EQU 2 ; SCG ECB BOARD -AYMODE_RCZ80 .EQU 3 ; RC2014 SOUND MODULE BY ED BRINDLEY ON Z80 -AYMODE_RCZ180 .EQU 4 ; RC2014 SOUND MODULE BY ED BRINDLEY ON Z180 +AYMODE_RCZ80 .EQU 3 ; RCBUS SOUND MODULE BY ED BRINDLEY ON Z80 +AYMODE_RCZ180 .EQU 4 ; RCBUS SOUND MODULE BY ED BRINDLEY ON Z180 +AYMODE_MSX .EQU 5 ; RCBUS SOUND MODULE REV6 BY ED BRINDLEY ON Z80/Z180 AT MSX PORTS +AYMODE_LINC .EQU 6 ; LINC Z50 AY SOUND CARD +AYMODE_MBC .EQU 7 ; MBC SOUND BOARD +; +; SN SOUND CHIP MODE SELECTIONS +; +SNMODE_NONE .EQU 0 +SNMODE_RC .EQU 1 ; RCBUS SOUND MODULE +SNMODE_VGM .EQU 2 ; VGM ECB BOARD ; ; TMS VIDEO MODE SELECTIONS ; TMSMODE_NONE .EQU 0 TMSMODE_SCG .EQU 1 ; SCG ECB BOARD TMSMODE_N8 .EQU 2 ; N8 BUILT-IN VIDEO +TMSMODE_MSX .EQU 3 ; MSX PORT MAPPING +TMSMODE_MSX9958 .EQU 4 ; MSX PORTS, V9958 CHIP +TMSMODE_MSXKBD .EQU 5 ; MSX PORTS + PS2 KEYBOARD +TMSMODE_MBC .EQU 6 ; MBC V9938/58 VIDEO BOARD +TMSMODE_COLECO .EQU 7 ; COLECOVISION PORT MAPPING +; +; CVDU VIDEO MODE SELECTIONS +; +CVDUMODE_NONE .EQU 0 +CVDUMODE_ECB .EQU 1 ; SCG ECB BOARD +CVDUMODE_MBC .EQU 2 ; MBC VDC BOARD +; +; CVDU MONITOR SELECTIONS +; +CVDUMON_NONE .EQU 0 +CVDUMON_CGA .EQU 1 ; CGA MONITOR TIMING (16.000 MHZ OSC) +CVDUMON_EGA .EQU 2 ; EGA MONITOR TIMING (16.257 MHZ OSC) +; +; GDC VIDEO MODE SELECTIONS +; +GDCMODE_NONE .EQU 0 +GDCMODE_ECB .EQU 1 ; ECB GDC +GDCMODE_RPH .EQU 2 ; RPH GDC +; +; GDC MONITOR SELECTIONS +; +GDCMON_NONE .EQU 0 +GDCMON_CGA .EQU 1 ; CGA MONITOR TIMING (16.000 MHZ OSC) +GDCMON_EGA .EQU 2 ; EGA MONITOR TIMING (16.257 MHZ OSC) +; +; DMA MODE SELECTIONS +; +DMAMODE_NONE .EQU 0 +DMAMODE_ECB .EQU 1 ; ECB-DMA WOLFGANG KABATZKE'S Z80 DMA ECB BOARD +DMAMODE_Z180 .EQU 2 ; Z180 INTEGRATED DMA +DMAMODE_Z280 .EQU 3 ; Z280 INTEGRATED DMA +DMAMODE_RC .EQU 4 ; RCBUS Z80 DMA +DMAMODE_MBC .EQU 5 ; MBC ; ; SERIAL DEVICE CONFIGURATION CONSTANTS ; @@ -208,7 +264,7 @@ SER_STOP2 .EQU 1 << 2 ; AND STORED AS 5 BITS: YXXXX ; SER_BAUD75 .EQU $00 << 8 -SER_BAUD150 .EQU $01 << 8 +SER_BAUD150 .EQU $01 << 8 SER_BAUD300 .EQU $02 << 8 SER_BAUD600 .EQU $03 << 8 SER_BAUD1200 .EQU $04 << 8 @@ -218,34 +274,70 @@ SER_BAUD9600 .EQU $07 << 8 SER_BAUD19200 .EQU $08 << 8 SER_BAUD38400 .EQU $09 << 8 SER_BAUD76800 .EQU $0A << 8 -SER_BAUD153600 .EQU $0B << 8 -SER_BAUD307200 .EQU $0C << 8 -SER_BAUD614400 .EQU $0D << 8 -SER_BAUD1228800 .EQU $0E << 8 -SER_BAUD2457600 .EQU $0F << 8 -SER_BAUD225 .EQU $10 << 8 -SER_BAUD450 .EQU $11 << 8 -SER_BAUD900 .EQU $12 << 8 -SER_BAUD1800 .EQU $13 << 8 -SER_BAUD3600 .EQU $14 << 8 -SER_BAUD7200 .EQU $15 << 8 -SER_BAUD14400 .EQU $16 << 8 -SER_BAUD28800 .EQU $17 << 8 -SER_BAUD57600 .EQU $18 << 8 +SER_BAUD153600 .EQU $0B << 8 +SER_BAUD307200 .EQU $0C << 8 +SER_BAUD614400 .EQU $0D << 8 +SER_BAUD1228800 .EQU $0E << 8 +SER_BAUD2457600 .EQU $0F << 8 +SER_BAUD225 .EQU $10 << 8 +SER_BAUD450 .EQU $11 << 8 +SER_BAUD900 .EQU $12 << 8 +SER_BAUD1800 .EQU $13 << 8 +SER_BAUD3600 .EQU $14 << 8 +SER_BAUD7200 .EQU $15 << 8 +SER_BAUD14400 .EQU $16 << 8 +SER_BAUD28800 .EQU $17 << 8 +SER_BAUD57600 .EQU $18 << 8 SER_BAUD115200 .EQU $19 << 8 SER_BAUD230400 .EQU $1A << 8 SER_BAUD460800 .EQU $1B << 8 -SER_BAUD921600 .EQU $1C << 8 -SER_BAUD1843200 .EQU $1D << 8 -SER_BAUD3686400 .EQU $1E << 8 -SER_BAUD7372800 .EQU $1F << 8 +SER_BAUD921600 .EQU $1C << 8 +SER_BAUD1843200 .EQU $1D << 8 +SER_BAUD3686400 .EQU $1E << 8 +SER_BAUD7372800 .EQU $1F << 8 +; +; UART DIVIDER VALUES +; STORED AS 5 BITS: YXXXX +; +DIV_1 .EQU $00 +DIV_2 .EQU $01 +DIV_4 .EQU $02 +DIV_8 .EQU $03 +DIV_16 .EQU $04 +DIV_32 .EQU $05 +DIV_64 .EQU $06 +DIV_128 .EQU $07 +DIV_256 .EQU $08 +DIV_512 .EQU $09 +DIV_1024 .EQU $0A +DIV_2048 .EQU $0B +DIV_4096 .EQU $0C +DIV_8192 .EQU $0D +DIV_16384 .EQU $0E +DIV_32768 .EQU $0F +DIV_3 .EQU $10 +DIV_6 .EQU $11 +DIV_12 .EQU $12 +DIV_24 .EQU $13 +DIV_48 .EQU $14 +DIV_96 .EQU $15 +DIV_192 .EQU $16 +DIV_384 .EQU $17 +DIV_768 .EQU $18 +DIV_1536 .EQU $19 +DIV_3072 .EQU $1A +DIV_6144 .EQU $1B +DIV_12288 .EQU $1C +DIV_24576 .EQU $1D +DIV_49152 .EQU $1E +DIV_98304 .EQU $1F ; SER_XON .EQU 1 << 6 SER_DTR .EQU 1 << 7 SER_RTS .EQU 1 << 13 ; -SER_75_8N1 .EQU SER_BAUD75 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_150_8N1 .EQU SER_BAUD150 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_75_8N1 .EQU SER_BAUD75 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_150_8N1 .EQU SER_BAUD150 | SER_DATA8 | SER_PARNONE | SER_STOP1 SER_300_8N1 .EQU SER_BAUD300 | SER_DATA8 | SER_PARNONE | SER_STOP1 SER_600_8N1 .EQU SER_BAUD600 | SER_DATA8 | SER_PARNONE | SER_STOP1 SER_1200_8N1 .EQU SER_BAUD1200 | SER_DATA8 | SER_PARNONE | SER_STOP1 @@ -255,27 +347,27 @@ SER_9600_8N1 .EQU SER_BAUD9600 | SER_DATA8 | SER_PARNONE | SER_STOP1 SER_19200_8N1 .EQU SER_BAUD19200 | SER_DATA8 | SER_PARNONE | SER_STOP1 SER_38400_8N1 .EQU SER_BAUD38400 | SER_DATA8 | SER_PARNONE | SER_STOP1 SER_76800_8N1 .EQU SER_BAUD76800 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_153600_8N1 .EQU SER_BAUD153600 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_307200_8N1 .EQU SER_BAUD307200 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_614400_8N1 .EQU SER_BAUD614400 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_1228800_8N1 .EQU SER_BAUD1228800 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_2457600_8N1 .EQU SER_BAUD2457600 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_225_8N1 .EQU SER_BAUD225 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_450_8N1 .EQU SER_BAUD450 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_900_8N1 .EQU SER_BAUD900 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_1800_8N1 .EQU SER_BAUD1800 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_3600_8N1 .EQU SER_BAUD3600 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_7200_8N1 .EQU SER_BAUD7200 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_14400_8N1 .EQU SER_BAUD14400 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_28800_8N1 .EQU SER_BAUD28800 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_57600_8N1 .EQU SER_BAUD57600 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_153600_8N1 .EQU SER_BAUD153600 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_307200_8N1 .EQU SER_BAUD307200 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_614400_8N1 .EQU SER_BAUD614400 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_1228800_8N1 .EQU SER_BAUD1228800 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_2457600_8N1 .EQU SER_BAUD2457600 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_225_8N1 .EQU SER_BAUD225 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_450_8N1 .EQU SER_BAUD450 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_900_8N1 .EQU SER_BAUD900 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_1800_8N1 .EQU SER_BAUD1800 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_3600_8N1 .EQU SER_BAUD3600 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_7200_8N1 .EQU SER_BAUD7200 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_14400_8N1 .EQU SER_BAUD14400 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_28800_8N1 .EQU SER_BAUD28800 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_57600_8N1 .EQU SER_BAUD57600 | SER_DATA8 | SER_PARNONE | SER_STOP1 SER_115200_8N1 .EQU SER_BAUD115200 | SER_DATA8 | SER_PARNONE | SER_STOP1 SER_230400_8N1 .EQU SER_BAUD230400 | SER_DATA8 | SER_PARNONE | SER_STOP1 SER_460800_8N1 .EQU SER_BAUD460800 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_921600_8N1 .EQU SER_BAUD921600 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_1843200_8N1 .EQU SER_BAUD1843200 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_3686400_8N1 .EQU SER_BAUD3686400 | SER_DATA8 | SER_PARNONE | SER_STOP1 -SER_7372800_8N1 .EQU SER_BAUD7372800 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_921600_8N1 .EQU SER_BAUD921600 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_1843200_8N1 .EQU SER_BAUD1843200 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_3686400_8N1 .EQU SER_BAUD3686400 | SER_DATA8 | SER_PARNONE | SER_STOP1 +SER_7372800_8N1 .EQU SER_BAUD7372800 | SER_DATA8 | SER_PARNONE | SER_STOP1 ; ; TERMENABLE CONTROLS INCLUSION OF TERMINAL PSEUDO-DEVICE DRIVER ; IT IS SET TO TRUE BY THE INCLUSION OF ANY VDA DRIVER. @@ -299,27 +391,28 @@ KBD_DE .EQU 1 ; GERMAN ; ; EMULATION TYPES ; -EMUTYP_NONE .EQU 0 ; NONE -EMUTYP_TTY .EQU 1 ; TTY -EMUTYP_ANSI .EQU 2 ; ANSI +EMUTYP_NONE .EQU 0 ; NONE +EMUTYP_TTY .EQU 1 ; TTY +EMUTYP_ANSI .EQU 2 ; ANSI ; -; DEVICE DRIVER TO BE INITIALIZED FIRST. FIRST CIO DRIVER, UNIT 0 INITIALIZED BECOMES PRIMARY CONSOLE. -; IS AN INDEX INTO THE ENABLED INITIALIZATION DRIVER LIST i.e. ASCI, UART, SIO, ACIA, PIO, UF ETC. -; EXAMPLE: IF ONLY UART, SIO AND PIO ARE ENABLE AND THE SIO IS DESIRED AS THE PRIMARY CONSOLE, -; SET FORCECON TO 2 IN YOUR CUSTOM CONFIGURATION FILE i.e. "FORCECON: .SET 2" +; WATCHDOG TYPES ; -FORCECON .EQU 0 ; DEFAULT IS TO FOLLOW NORMAL SEQUENCE +WDOG_NONE .EQU 0 ; NONE +WDOG_EZZ80 .EQU 1 ; EASY Z80 WATCHDOG +WDOG_SKZ .EQU 2 ; SK Z80 CPU W/ 512K ; -#INCLUDE "build.inc" ; INCLUDE USER CONFIG, ADD VARIANT, TIMESTAMP, & ROMSIZE +; SYSTEM SPEED CAPABILITIES ; -#IF (BIOS == BIOS_WBW) -#INCLUDE "hbios.inc" -#ENDIF +SPD_FIXED .EQU 0 ; PLATFORM SPEED FIXED AND CANNOT CHANGE SPEEDS +SPD_HILO .EQU 1 ; PLATFORM CAN CHANGE BETWEEN TWO SPEEDS ; -#IF (BIOS == BIOS_UNA) -#INCLUDE "../UBIOS/ubios.inc" -#ENDIF +; SYSTEM SPEED CHARACTERISTICS ; +SPD_UNSUP .EQU 0 ; PLATFORM CAN CHANGE SPEEDS BUT IS UNSUPPORTED +SPD_HIGH .EQU 1 ; PLATFORM CAN CHANGE SPEED, STARTS HIGH +SPD_LOW .EQU 2 ; PLATFORM CAN CHANGE SPEED, STARTS LOW +; +#INCLUDE "build.inc" ; INCLUDE USER CONFIG, ADD VARIANT, TIMESTAMP, & ROMSIZE ; ; INCLUDE Z180 REGISTER DEFINITIONS ; @@ -327,6 +420,9 @@ FORCECON .EQU 0 ; DEFAULT IS TO FOLLOW NORMAL SEQUENCE #IF (CPUFAM == CPU_Z180) #INCLUDE "z180.inc" #ENDIF + #IF (CPUFAM == CPU_Z280) + #INCLUDE "z280.inc" + #ENDIF #IF (EIPCENABLE) #INCLUDE "eipc.inc" #ENDIF @@ -345,14 +441,77 @@ CPUKHZ .SET CPUKHZ / 2 ; ADJUST FOR HALF SPEED OPERATION CPUKHZ .SET CPUKHZ * 2 ; ADJUST FOR DOUBLE SPEED OPERATION #ENDIF #ENDIF + #IF (CPUFAM == CPU_Z280) +CPUKHZ .SET CPUKHZ / 2 ; Z180 PHI IS ALWAYS 1/2 OSC + #ENDIF #ENDIF ; CPUMHZ .EQU CPUKHZ / 1000 ; CPU FREQ IN MHZ ; -TICKSPERSEC .EQU 50 +; SYSTEM PERIODIC TIMER MODE +; +#IF (BIOS == BIOS_WBW) +; +TM_NONE .EQU 0 +TM_CTC .EQU 1 +TM_TMS .EQU 2 +TM_SIMH .EQU 3 +TM_Z180 .EQU 4 +TM_Z280 .EQU 5 +; + .ECHO "SYSTEM TIMER:" +SYSTIM .EQU TM_NONE +; + #IF (CTCENABLE & (INTMODE == 2)) + #IF (CTCTIMER) +SYSTIM .SET TM_CTC + .ECHO " CTC" + #ENDIF + #ENDIF +; + #IF (TMSENABLE & (INTMODE == 1)) + #IF (TMSTIMENABLE) +SYSTIM .SET TM_TMS + .ECHO " TMS9918/V9958" + #ENDIF + #ENDIF +; + #IF ((PLATFORM == PLT_SBC) & (INTMODE == 1)) + #IF (HTIMENABLE) +SYSTIM .SET TM_SIMH + .ECHO " SIMH" + #ENDIF + #ENDIF +; + #IF ((CPUFAM == CPU_Z180) & (INTMODE == 2)) + #IF (Z180_TIMER) +SYSTIM .SET TM_Z180 + .ECHO " Z180" + #ENDIF + #ENDIF +; + #IF ((CPUFAM == CPU_Z280) & (MEMMGR == MM_Z280)) + #IF (Z280_TIMER) +SYSTIM .SET TM_Z280 + .ECHO " Z280" + #ENDIF + #ENDIF +; + #IF SYSTIM == TM_NONE + .ECHO " NONE" + #ENDIF +; + .ECHO "\n" +; +#ENDIF ; ; MEMORY BANK CONFIGURATION ; +WBW_ROM_R .EQU 128 ; 128K ; RESERVED ROM REQUIRED FOR ROMWBW +WBW_RAM_R .EQU 256 ; 256K ; RESERVED RAM REQUIRED FOR ROMWBW +TOT_ROM_RB .EQU (WBW_ROM_R / 32) ; TOTAL ROM BANKS RESERVED +TOT_RAM_RB .EQU (WBW_RAM_R / 32) ; TOTAL RAM BANKS RESERVED +; #IF (BIOS == BIOS_UNA) BID_ROM0 .EQU $0000 BID_RAM0 .EQU $8000 @@ -365,22 +524,63 @@ BID_RAM0 .EQU $80 BID_ROMN .EQU (BID_ROM0 + ((ROMSIZE / 32) - 1)) BID_RAMN .EQU (BID_RAM0 + ((RAMSIZE / 32) - 1)) +; +BID_RAMD0 .EQU BID_RAM0 ; FIRST RAM DRIVE BANK ^ RAM +BID_RAMDN .EQU BID_RAMN - TOT_RAM_RB ; LAST RAM DRIVE BANK | DRIVE +; ; OS BUFFERS CP/M3? -+ THESE CPM3 BNK 5 (BUF) +; ; OS BUFFERS CP/M3? | MAKE CPM3 BNK 4 (BUF) +; ; OS BUFFERS CP/M3? | UP CPM3 BNK 3 (BUF) +; ; OS BUFFERS CP/M3? | THE CPM3 BNK 2 (BUF) +BID_AUX .EQU BID_RAMN - 3 ; AUX BANK (BPBIOS, ETC.) | 256KB CPM3 BNK 1 (TPA) +BID_BIOS .EQU BID_RAMN - 2 ; BIOS BANK | RESERVED +BID_USR .EQU BID_RAMN - 1 ; USER BANK (CP/M TPA, ETC.) | RAM CPM3 BNK 0 (OS) +BID_COM .EQU BID_RAMN - 0 ; COMMON BANK, UPPER 32K -+ BANKS +BID_BOOT .EQU BID_ROM0 + 0 ; BOOT BANK -+ THESE MAKE +BID_IMG0 .EQU BID_ROM0 + 1 ; ROM LOADER AND FIRST IMAGES BANK | UP THE 128KB +BID_IMG1 .EQU BID_ROM0 + 2 ; SECOND IMAGES BANK | RESERVED +BID_IMG2 .EQU BID_ROM0 + 3 ; NETWORK BOOT -+ ROM BANKS +BID_ROMD0 .EQU BID_ROM0 + 4 ; FIRST ROM DRIVE BANK | ROM +BID_ROMDN .EQU BID_ROMN ; LAST ROM DRIVE BANK V DRIVE +; +#IF (ROMSIZE == 0) +BID_BOOT .SET BID_RAM0 ; SPECIAL CASE ROM-LESS SYSTEM +#ENDIF +; +#IF (BIOS == BIOS_WBW) +; + #IF (!MDRAM) +BID_RAMD0 .SET $FF ; RAM DRIVE DISABLED +BID_RAMDN .SET $FF ; RAM DRIVE DISABLED + #ENDIF +; + #IF (!MDROM) +BID_ROMD0 .SET $FF ; ROM DRIVE DISABLED +BID_ROMDN .SET $FF ; ROM DRIVE DISABLED + #ENDIF +; +#ENDIF +; +#IF FALSE + .ECHO "BID_AUX: " \ .ECHO BID_AUX \ .ECHO "\n" + .ECHO "BID_BIOS: " \ .ECHO BID_BIOS \ .ECHO "\n" + .ECHO "BID_USR: " \ .ECHO BID_USR \ .ECHO "\n" + .ECHO "BID_COM: " \ .ECHO BID_COM \ .ECHO "\n" -BID_BOOT .EQU BID_ROM0 ; BOOT BANK -;BID_BIOSIMG .EQU BID_ROM0 + 1 ; BIOS IMAGE BANK -;BID_OSIMG .EQU BID_ROM0 + 2 ; ROM LOADER AND IMAGES BANK -BID_IMG0 .EQU BID_ROM0 + 1 ; ROM LOADER AND FIRST IMAGES BANK -BID_IMG1 .EQU BID_ROM0 + 2 ; SECOND IMAGES BANK -BID_FSFAT .EQU BID_ROM0 + 3 ; FAT FILESYSTEM DRIVER BANK -BID_ROMD0 .EQU BID_ROM0 + 4 ; FIRST ROM DRIVE BANK -BID_ROMDN .EQU BID_ROMN ; LAST ROM DRIVE BANK - -BID_RAMD0 .EQU BID_RAM0 ; FIRST RAM DRIVE BANK -BID_RAMDN .EQU BID_RAMN - 4 ; LAST RAM DRIVE BANK -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 + .ECHO "BID_BOOT: " \ .ECHO BID_BOOT \ .ECHO "\n" + .ECHO "BID_IMG0: " \ .ECHO BID_IMG0 \ .ECHO "\n" + .ECHO "BID_IMG1: " \ .ECHO BID_IMG1 \ .ECHO "\n" + .ECHO "BID_IMG2: " \ .ECHO BID_IMG2 \ .ECHO "\n" + + .ECHO "BID_ROMD0: " \ .ECHO BID_ROMD0 \ .ECHO "\n" + .ECHO "BID_ROMDN: " \ .ECHO BID_ROMDN \ .ECHO "\n" + .ECHO "BID_RAMD0: " \ .ECHO BID_RAMD0 \ .ECHO "\n" + .ECHO "BID_RAMDN: " \ .ECHO BID_RAMDN \ .ECHO "\n" + + .ECHO "BID_ROM0: " \ .ECHO BID_ROM0 \ .ECHO "\n" + .ECHO "BID_ROMN: " \ .ECHO BID_ROMN \ .ECHO "\n" + .ECHO "BID_RAM0: " \ .ECHO BID_RAM0 \ .ECHO "\n" + .ECHO "BID_RAMN: " \ .ECHO BID_RAMN \ .ECHO "\n" +#ENDIF ; ; MEMORY LAYOUT ; @@ -408,44 +608,74 @@ CBIOS_LOC .EQU CBIOS_END - CBIOS_SIZ ; START OF CBIOS CPM_ENT .EQU CBIOS_LOC ; CPM ENTRY POINT (IN CBIOS) -LDR_SIZ .EQU $0E00 +CPM_IMGSIZ .EQU $3000 + +; ROM BANK 1 -MON_LOC .EQU $F000 ; LOCATION OF MONITOR FOR RUNNING SYSTEM -MON_SIZ .EQU $0E00 ; SIZE OF MONITOR BINARY IMAGE +LDR_LOC .EQU $0000 +LDR_SIZ .EQU $1000 +LDR_END .EQU LDR_LOC +LDR_SIZ +LDR_IMGLOC .EQU $0000 + +MON_LOC .EQU $EE00 ; LOCATION OF MONITOR FOR RUNNING SYSTEM +MON_SIZ .EQU $1000 ; SIZE OF MONITOR BINARY IMAGE MON_END .EQU MON_LOC + MON_SIZ ; END OF MONITOR +MON_IMGLOC .EQU LDR_IMGLOC + LDR_SIZ + +ZSYS_IMGLOC .EQU MON_IMGLOC + MON_SIZ + +CPM_IMGLOC .EQU ZSYS_IMGLOC + CPM_IMGSIZ + +; ROM BANK 2 + +FTH_LOC .EQU $0200 ; CAMEL FORTH +FTH_SIZ .EQU $1700 +FTH_END .EQU FTH_LOC + FTH_SIZ +FTH_IMGLOC .EQU $0000 BAS_LOC .EQU $0200 ; NASCOM BASIC BAS_SIZ .EQU $2000 BAS_END .EQU BAS_LOC + BAS_SIZ +BAS_IMGLOC .EQU FTH_IMGLOC + FTH_SIZ TBC_LOC .EQU $0A00 ; TASTYBASIC -TBC_SIZ .EQU $0900 +TBC_SIZ .EQU $0A00 TBC_END .EQU TBC_LOC + TBC_SIZ +TBC_IMGLOC .EQU BAS_IMGLOC + BAS_SIZ + +GAM_LOC .EQU $0200 ; GAME 2048 +GAM_SIZ .EQU $0900 +GAM_END .EQU GAM_LOC + GAM_SIZ +GAM_IMGLOC .EQU TBC_IMGLOC + TBC_SIZ EGG_LOC .EQU $F000 ; EASTER EGG EGG_SIZ .EQU $0200 EGG_END .EQU EGG_LOC + EGG_SIZ +EGG_IMGLOC .EQU GAM_IMGLOC + GAM_SIZ -FTH_LOC .EQU $0200 ; CAMEL FORTH -FTH_SIZ .EQU $1700 -FTH_END .EQU FTH_LOC + FTH_SIZ +NET_LOC .EQU $0100 ; NETWORK BOOT +NET_SIZ .EQU $1000 +NET_END .EQU NET_LOC + NET_SIZ +NET_IMGLOC .EQU EGG_IMGLOC + EGG_SIZ -GAM_LOC .EQU $0200 ; GAME 2048 -GAM_SIZ .EQU $0900 -GAM_END .EQU GAM_LOC + GAM_SIZ +UPD_LOC .EQU $0200 ; ROM UPDATER +UPD_SIZ .EQU $0D00 +UPD_END .EQU UPD_LOC + UPD_SIZ +UPD_IMGLOC .EQU NET_IMGLOC + NET_SIZ -USR_LOC .EQU $0200 ; USER -USR_SIZ .EQU $1000 +USR_LOC .EQU $0200 ; USER +USR_SIZ .EQU BNKTOP - UPD_IMGLOC - UPD_SIZ USR_END .EQU USR_LOC + USR_SIZ +USR_IMGLOC .EQU UPD_IMGLOC + UPD_SIZ MON_DSKY .EQU MON_LOC + (0 * 3) ; MONITOR ENTRY (DSKY) MON_SERIAL .EQU MON_LOC + (1 * 3) ; MONITOR ENTRY (SERIAL PORT) ; ; INTERRUPT MODE 2 SLOT ASSIGNMENTS ; -#IF (INTMODE == 2) +#IF ((INTMODE == 2) | (INTMODE == 3)) - #IF (CPUFAM == CPU_Z180) + #IF ((CPUFAM == CPU_Z180) | (CPUFAM == CPU_Z280)) ; Z180-BASED SYSTEMS @@ -461,30 +691,65 @@ INT_SER1 .EQU 8 ; Z180 SERIAL 0 INT_PIO0A .EQU 9 ; ZILOG PIO 0, CHANNEL A INT_PIO0B .EQU 10 ; ZILOG PIO 0, CHANNEL B INT_PIO1A .EQU 11 ; ZILOG PIO 1, CHANNEL A -INT_PIO1B .EQU 12 ; ZILOG PIO 1, CHANNEL B +INT_PIO1B .EQU 12 ; ZILOG PIO 1, CHANNEL B INT_SIO0 .EQU 13 ; ZILOG SIO 0, CHANNEL A & B INT_SIO1 .EQU 14 ; ZILOG SIO 1, CHANNEL A & B #ELSE - + ; Z80-BASED SYSTEMS + + #IF (PLATFORM == PLT_MBC) + +;INT_CTC0A .EQU 0 ; ZILOG CTC 0, CHANNEL A +;INT_CTC0B .EQU 1 ; ZILOG CTC 0, CHANNEL B +;INT_CTC0C .EQU 2 ; ZILOG CTC 0, CHANNEL C +;INT_CTC0D .EQU 3 ; ZILOG CTC 0, CHANNEL D +INT_UART0 .EQU 4 ; MBC UART 0 +INT_UART1 .EQU 5 ; MBC UART 1 +INT_SIO0 .EQU 8 ; ZILOG SIO 0, CHANNEL A & B +INT_SIO1 .EQU 9 ; ZILOG SIO 1, CHANNEL A & B +INT_CTC0A .EQU 12 ; ZILOG CTC 0, CHANNEL A +INT_CTC0B .EQU 13 ; ZILOG CTC 0, CHANNEL B +INT_CTC0C .EQU 14 ; ZILOG CTC 0, CHANNEL C +INT_CTC0D .EQU 15 ; ZILOG CTC 0, CHANNEL D +;INT_PIO0A .EQU 9 ; ZILOG PIO 0, CHANNEL A +;INT_PIO0B .EQU 10 ; ZILOG PIO 0, CHANNEL B +;INT_PIO1A .EQU 11 ; ZILOG PIO 1, CHANNEL A +;INT_PIO1B .EQU 12 ; ZILOG PIO 1, CHANNEL B + + #ELSE + INT_CTC0A .EQU 0 ; ZILOG CTC 0, CHANNEL A INT_CTC0B .EQU 1 ; ZILOG CTC 0, CHANNEL B INT_CTC0C .EQU 2 ; ZILOG CTC 0, CHANNEL C INT_CTC0D .EQU 3 ; ZILOG CTC 0, CHANNEL D +INT_UART0 .EQU 4 ; MBC UART 0 +INT_UART1 .EQU 5 ; MBC UART 1 INT_SIO0 .EQU 7 ; ZILOG SIO 0, CHANNEL A & B -INT_SIO1 .EQU 8 ; ZILOG SIO 1, CHANNEL A & B +INT_SIO1 .EQU 8 ; ZILOG SIO 1, CHANNEL A & B INT_PIO0A .EQU 9 ; ZILOG PIO 0, CHANNEL A -INT_PIO0B .EQU 10 ; ZILOG PIO 0, CHANNEL B -INT_PIO1A .EQU 11 ; ZILOG PIO 1, CHANNEL A -INT_PIO1B .EQU 12 ; ZILOG PIO 1, CHANNEL B +INT_PIO0B .EQU 10 ; ZILOG PIO 0, CHANNEL B +INT_PIO1A .EQU 11 ; ZILOG PIO 1, CHANNEL A +INT_PIO1B .EQU 12 ; ZILOG PIO 1, CHANNEL B + + #ENDIF #ENDIF - + #DEFINE IVT(INTX) HB_IVT+(INTX * 4)+1 #DEFINE VEC(INTX) INTX*2 +#ENDIF +; +; SET DEFAULT CSIO SPEED (INTERNAL CLOCK, SLOW AS POSSIBLE) +; DIV 1280, 14KHZ @ 18MHZ CLK +; +#IF (BIOS == BIOS_WBW) + #IF (CPUFAM == CPU_Z180) +Z180_CNTR_DEF .EQU $06 ; DEFAULT VALUE FOR Z180 CSIO CONFIG + #ENDIF #ENDIF ; ; HELPER MACROS @@ -492,6 +757,7 @@ INT_PIO1B .EQU 12 ; ZILOG PIO 1, CHANNEL B #DEFINE PRTC(C) CALL PRTCH \ .DB C ; PRINT CHARACTER C TO CONSOLE - PRTC('X') #DEFINE PRTS(S) CALL PRTSTRD \ .TEXT S ; PRINT STRING S TO CONSOLE - PRTD("HELLO") #DEFINE PRTX(X) CALL PRTSTRI \ .DW X ; PRINT STRING AT ADDRESS X TO CONSOLE - PRTI(STR_HELLO) +#DEFINE DEBUG(S) CALL PRTSTRD \ .TEXT S \ .TEXT "$" ; $$$$$$ PRINT STRING S TO CONSOLE - PRTD("HELLO") - NO TRAILING $ REQUIRED ; #DEFINE XIO_PRTC(C) CALL XIO_PRTCH \ .DB C ; PRINT CHARACTER C TO CONSOLE - PRTC('X') #DEFINE XIO_PRTS(S) CALL XIO_PRTSTRD \ .DB S ; PRINT STRING S TO CONSOLE - PRTD("HELLO") diff --git a/Source/HBIOS/tastybasic.asm b/Source/HBIOS/tastybasic.asm deleted file mode 100644 index 243cce39..00000000 --- a/Source/HBIOS/tastybasic.asm +++ /dev/null @@ -1,1902 +0,0 @@ - -; ----------------------------------------------------------------------------- -; Copyright 2018 Dimitri Theulings -; -; This file is part of Tasty Basic. -; -; Tasty Basic 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. -; -; Tasty Basic 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 Tasty Basic. If not, see . -; ----------------------------------------------------------------------------- -; Tasty Basic is derived from earlier works by Li-Chen Wang, Peter Rauskolb, -; and Doug Gabbard. Refer to the source code repository for details -; . -; ----------------------------------------------------------------------------- - -#define dwa(addr) .db (addr >> 8) + 080h\ .db addr & 0ffh - -ctrlc .equ 03h -bs .equ 08h -lf .equ 0ah -cr .equ 0dh -ctrlo .equ 0fh -ctrlu .equ 15h - -#ifdef ZEMU ; Z80 Emulator -tty_data .equ 7ch -tty_status .equ 7dh -rx_full .equ 1 -tx_empty .equ 0 -TBC_LOC .equ 0 -#else ; RomWBW -#include "std.asm" -#endif - - .org TBC_LOC -start: - ld sp,stack ; ** Cold Start ** - ld a,0ffh - jp init -testc: - ex (sp),hl ; ** TestC ** - call skipspace ; ignore spaces - cp (hl) ; test character - inc hl ; compare the byte that follows the - jr z,tc1 ; call instruction with the text pointer - push bc - ld c,(hl) ; if not equal, ad the seond byte - ld b, 0h ; that follows the call to the old pc - add hl,bc - pop bc - dec de -tc1: - inc de ; if equal, skip those bytes - inc hl ; and continue - ex (sp),hl - ret - -skipspace: - ld a,(de) ; ** SkipSpace ** - cp ' ' ; ignore spaces - ret nz ; in text (where de points) - inc de ; and return the first non-blank - jp skipspace ; character in A - -expr: - call expr2 ; ** Expr ** - push hl ; evaluate expression - jp expr1 - -comp: - ld a,h ; ** Compare ** - cp d ; compare hl with de - ret nz ; return c and z flags - ld a,l ; old a is lost - cp e - ret - -finish: - pop af ; ** Finish ** - call fin ; check end of command - jp qwhat - -;************************************************************* -; -; *** REM *** IF *** INPUT *** & LET (& DEFLT) *** -; -; 'REM' CAN BE FOLLOWED BY ANYTHING AND IS IGNORED BY TBI. -; TBI TREATS IT LIKE AN 'IF' WITH A FALSE CONDITION. -; -; 'IF' IS FOLLOWED BY AN EXPR. AS A CONDITION AND ONE OR MORE -; COMMANDS (INCLUDING OTHER 'IF'S) SEPERATED BY SEMI-COLONS. -; NOTE THAT THE WORD 'THEN' IS NOT USED. TBI EVALUATES THE -; EXPR. IF IT IS NON-ZERO, EXECUTION CONTINUES. IF THE -; EXPR. IS ZERO, THE COMMANDS THAT FOLLOWS ARE IGNORED AND -; EXECUTION CONTINUES AT THE NEXT LINE. -; -; 'INPUT' COMMAND IS LIKE THE 'PRINT' COMMAND, AND IS FOLLOWED -; BY A LIST OF ITEMS. IF THE ITEM IS A STRING IN SINGLE OR -; DOUBLE QUOTES, OR IS A BACK-ARROW, IT HAS THE SAME EFFECT AS -; IN 'PRINT'. IF AN ITEM IS A VARIABLE, THIS VARIABLE NAME IS -; PRINTED OUT FOLLOWED BY A COLON. THEN TBI WAITS FOR AN -; EXPR. TO BE TYPED IN. THE VARIABLE IS THEN SET TO THE -; VALUE OF THIS EXPR. IF THE VARIABLE IS PROCEDED BY A STRING -; (AGAIN IN SINGLE OR DOUBLE QUOTES), THE STRING WILL BE -; PRINTED FOLLOWED BY A COLON. TBI THEN WAITS FOR INPUT EXPR. -; AND SET THE VARIABLE TO THE VALUE OF THE EXPR. -; -; IF THE INPUT EXPR. IS INVALID, TBI WILL PRINT "WHAT?", -; "HOW?" OR "SORRY" AND REPRINT THE PROMPT AND REDO THE INPUT. -; THE EXECUTION WILL NOT TERMINATE UNLESS YOU TYPE CONTROL-C. -; THIS IS HANDLED IN 'INPERR'. -; -; 'LET' IS FOLLOWED BY A LIST OF ITEMS SEPERATED BY COMMAS. -; EACH ITEM CONSISTS OF A VARIABLE, AN EQUAL SIGN, AND AN EXPR. -; TBI EVALUATES THE EXPR. AND SET THE VARIABLE TO THAT VALUE. -; TBI WILL ALSO HANDLE 'LET' COMMAND WITHOUT THE WORD 'LET'. -; THIS IS DONE BY 'DEFLT'. -;************************************************************* -rem: - ld hl,0000h ; ** Rem ** - jr if1 ; this is like 'IF 0' -iff: - call expr ; ** If ** -if1: - ld a,h ; is the expr = 0? - or l - jp nz,runsml ; no, continue - call findskip ; yes, skip rest of line - jp nc,runtsl ; and run the next line - jp rstart ; if no, restart -inputerror: - ld hl,(stkinp) ; ** InputError ** - ld sp,hl ; restore old sp and old current - pop hl - ld (current),hl - pop de ; and old text pointer - pop de ; redo current -input: - push de ; ** Input ** - call qtstg ; is next item a string? - jp ip2 ; no - call testvar ; yes and followed by a variable? - jp c,ip4 ; no - jp ip3 ; yes, input variable -ip2: - push de ; save for printstr - call testvar ; must be variable - jp c,qwhat ; no, what? - ld a,(de) ; prepare for printstr - ld c,a - sub a - ld (de),a - pop de - call printstr ; print string as prompt - ld a,c ; restore text - dec de - ld (de),a -ip3: - push de ; save text pointer - ex de,hl - ld hl,(current) ; also save current - push hl - ld hl,input - ld (current),hl - ld hl,0000h - add hl,sp - ld (stkinp),hl - push de - ld a,':' - call getline - ld de,buffer - call expr - nop - nop - nop - pop de - ex de,hl - ld (hl),e - inc hl - ld (hl),d - pop hl - ld (current),hl - pop de -ip4: - pop af ; purge stack - call testc ; is next character ','? - .db ',' - .db ip5-$-1 - jr input ; yes, more items -ip5: - call finish -deflt: - ld a,(de) ; ** DEFLT ** - cp cr ; empty line is fine - jr z,lt1 ; else it's 'LET' -let: - call setval ; ** Let ** - call testc ; set value to var - .db ',' - .db lt1-$-1 - jr let ; item by item -lt1: - call finish - -;************************************************************* -; -; *** PEEK *** POKE *** IN *** & OUT *** -; -; 'PEEK()' RETURNS THE VALUE OF THE BYTE AT THE GIVEN -; ADDRESS. -; 'POKE ,' SETS BYTE AT ADDRESS TO -; VALUE -; -;************************************************************* -peek: - call parn ; ** Peek(expr) ** - ld a,h ; expression must be positive - or a - jp m,qhow - ld a,(hl) - ld h,0 - ld l,a - ret -poke: - call expr ; ** Poke ** - ld a,h ; address must be positive - or a - jp m,qhow - push hl - call testc ; is next char a comma? - .db ',' - .db pk1-$-1 ; what, no? - call expr ; get value to store - ld a,0 ; is it > 255? - cp h - jp z,pk2 ; no, all good - pop hl - jp m,qhow -pk2: - ld a,l ; save value - pop hl - ld (hl),a - call finish -pk1: - pop hl - jp qwhat -usrexec: - call parn ; ** Usr(expr) ** - push de - ex de,hl - ld hl,ue1 - push hl - ld ix,(usrptr) - jp (ix) -ue1: - ex de,hl - pop de - ret -;************************************************************* -; -; *** EXPR *** -; -; 'EXPR' EVALUATES ARITHMETICAL OR LOGICAL EXPRESSIONS. -; :: -; -; WHERE IS ONE OF THE OPERATORS IN TAB8 AND THE -; RESULT OF THESE OPERATIONS IS 1 IF TRUE AND 0 IF FALSE. -; ::=(+ OR -)(+ OR -)(....) -; WHERE () ARE OPTIONAL AND (....) ARE OPTIONAL REPEATS. -; ::=(* OR />)(....) -; ::= -; -; () -; IS RECURSIVE SO THAT VARIABLE '@' CAN HAVE AN -; AS INDEX, FUNCTIONS CAN HAVE AN AS ARGUMENTS, AND -; CAN BE AN IN PARANTHESE. -;************************************************************* - -expr1: - ld hl,tab8-1 ; look up rel.op - jp exec ; go do it -xp11: - call xp18 ; rel.op.'>=' - ret c ; no, return hl=0 - ld l,a ; yes, return hl=1 - ret -xp12: - call xp18 ; rel.op.'#' - ret z ; no, return hl=0 - ld l,a ; yes, return hl=1 - ret -xp13: - call xp18 ; rel.op.'>' - ret z ; no - ret c ; also, no - ld l,a ; yes, return hl=1 - ret -xp14: - call xp18 ; rel.op.'<=' - ld l,a ; set hl=1 - ret z ; yes, return hl=1 - ret c - ld l,h ; else set hl=0 - ret -xp15: - call xp18 ; rel.op.'=' - ret nz ; no, return hl=0 - ld l,a ; else hl=1 - ret -xp16: - call xp18 ; rel.op.'<' - ret nc ; no, return hl=0 - ld l,a ; else hl=1 - ret -xp17: - pop hl ; not rel.op - ret ; return hl= -xp18: - ld a,c ; routine for all rel.ops - pop hl - pop bc - push hl - push bc ; reverse top of stack - ld c,a - call expr2 ; get second - ex de,hl ; value now in de - ex (sp),hl ; first in hl - call ckhlde ; compare them - pop de ; restore text pointer - ld hl,0000h ; set hl=0, a=1 - ld a,1 - ret -expr2: - call testc ; is it minus sign? - .db '-' - .db xp21-$-1 - ld hl,0000h ; yes, fake 0 - - jr xp26 ; treat like subtract -xp21: - call testc ; is it plus sign? - .db '+' - .db xp22-$-1 -xp22: - call expr3 ; first -xp23: - call testc ; addition? - .db '+' - .db xp25-$-1 - push hl ; yes, save value - call expr3 ; get second -xp24: - ex de,hl ; 2nd in de - ex (sp),hl ; 1st in hl - ld a,h ; compare sign - xor d - ld a,d - add hl,de - pop de ; restore text pointer - jp m,xp23 ; first and second sign differ - xor h ; first and second sign are equal - jp p,xp23 ; so is the result - jp qhow ; else we have overflow -xp25: - call testc ; subtract? - .db '-' - .db xp42-$-1 -xp26: - push hl ; yes, save first - call expr3 ; get second - call changesign ; negate - jr xp24 ; and add them -expr3: - call expr4 ; get first expr4 -xp31: - call testc ; multiply? - .db '*' - .db xp34-$-1 - push hl ; yes, save first and get second - call expr4 ; - ld b,0 ; clear b for sign - call checksign - ex (sp),hl ; first in hl - call checksign ; check sign of first - ex de,hl - ex (sp),hl - ld a,h ; is hl > 255? - or a - jr z,xp32 ; no - ld a,d ; yes, what about de - or d - ex de,hl - jp nz,ahow -xp32: - ld a,l - ld hl,0000h - or a - jr z,xp35 -xp33: - add hl,de - jp c,ahow - dec a - jr nz,xp33 - jr xp35 -xp34: - call testc ; divide - .db '/' - .db xp42-$-1 - push hl ; yes, save first - call expr4 ; and get the second one - ld b,0h ; clear b for sign - call checksign ; check sign of the second - ex (sp),hl ; get the first in hl - call checksign ; check sign of first - ex de,hl - ex (sp),hl - ex de,hl - ld a,d ; divide by 0? - or e - jp z,ahow ; err...how? - push bc ; else save sign - call divide - ld h,b - ld l,c - pop bc ; retrieve sign -xp35: - pop de ; and text pointer - ld a,h ; hl must be positive - or a - jp m,qhow ; else it's overflow - ld a,b - or a - call m,changesign ; change sign if needed - jp xp31 ; look for more terms -expr4: - ld hl,tab4-1 ; find function in tab4 - jp exec ; and execute it -xp40: - call testvar - jr c,xp41 ; nor a variable - ld a,(hl) - inc hl - ld h,(hl) ; value in hl - ld l,a - ret -xp41: - call testnum ; or is it a number - ld a,b ; number of digits - or a - ret nz ; ok - -parn: - call testc - .db '(' - .db xp43-$-1 - call expr ; "(expr)" - call testc - .db ')' - .db xp43-$-1 -xp42: - ret -xp43: - jp qwhat ; what? -rnd: - call parn ; ** Rnd(expr) ** - ld a,h ; expression must be positive - or a - jp m,qhow - or l ; and non-zero - jp z,qhow - push de ; save de and hl - push hl - ld hl,(rndptr) ; get memory as random number - ld de,LST_ROM - call comp - jr c,ra1 ; wrap around if last - ld hl,start -ra1: - ld e,(hl) - inc hl - ld d,(hl) - ld (rndptr),hl - pop hl - ex de,hl - push bc - call divide ; rnd(n)=mod(m,n)+1 - pop bc - pop de - inc hl - ret -abs: - call parn ; ** Abs (expr) ** - dec de - call checksign - inc de - ret -size: - ld hl,(textunfilled) ; ** Size ** - push de ; get the number of free bytes between - ex de,hl ; and varbegin - ld hl,varbegin - call subde - pop de - ret -clrvars: - ld hl,(textunfilled) ; ** ClearVars** - push de ; get the number of bytes available - ex de,hl ; for variable storge - ld hl,varend - call subde - ld b,h ; and save in bc - ld c,l - ld hl,(textunfilled) ; clear the first byte - ld d,h - ld e,l - inc de - ld (hl),0h - ldir ; and repeat for all the others - pop de - ret - -;************************************************************* -; -; *** DIVIDE *** SUBDE *** CHKSGN *** CHGSGN *** & CKHLDE *** -; -; 'DIVIDE' DIVIDES HL BY DE, RESULT IN BC, REMAINDER IN HL -; -; 'SUBDE' SUBSTRACTS DE FROM HL -; -; 'CHKSGN' CHECKS SIGN OF HL. IF +, NO CHANGE. IF -, CHANGE -; SIGN AND FLIP SIGN OF B. -; -; 'CHGSGN' CHECKS SIGN N OF HL AND B UNCONDITIONALLY. -; -; 'CKHLDE' CHECKS SIGN OF HL AND DE. IF DIFFERENT, HL AND DE -; ARE INTERCHANGED. IF SAME SIGN, NOT INTERCHANGED. EITHER -; CASE, HL DE ARE THEN COMPARED TO SET THE FLAGS. -;************************************************************* -divide: - push hl ; ** Divide ** - ld l,h ; divide h by de - ld h,0h - call dv1 - ld b,c ; save result in b - ld a,l ; (remainder + l) / de - pop hl - ld h,a -dv1: - ld c,0ffh ; result in c -dv2: - inc c ; dumb routine - call subde ; divide using subtract and count - jr nc,dv2 - add hl,de - ret -subde: - ld a,l ; ** subde ** - sub e ; subtract de from hl - ld l,a - ld a,h - sbc a,d - ld h,a - ret - -checksign: - ld a,h ; ** CheckSign ** - or a ; check sign of hl - ret p -changesign: - ld a,h ; ** ChangeSign ** - or l ; check if hl is zero - jp nz,cs1 ; no, try to change sign - ret ; yes, return -cs1: - ld a,h ; change sign of hl - push af - cpl - ld h,a - ld a,l - cpl - ld l,a - inc hl - pop af - xor h - jp p,qhow - ld a,b ; and also flip b - xor 80h - ld b,a - ret -ckhlde: - ld a,h ; same sign? - xor d ; yes, compare - jp p,ck1 ; no, exchange and compare - ex de,hl -ck1: - call comp - ret - -;************************************************************* -; -; *** SETVAL *** FIN *** ENDCHK *** & ERROR (& FRIENDS) *** -; -; "SETVAL" EXPECTS A VARIABLE, FOLLOWED BY AN EQUAL SIGN AND -; THEN AN EXPR. IT EVALUATES THE EXPR. AND SET THE VARIABLE -; TO THAT VALUE. -; -; "FIN" CHECKS THE END OF A COMMAND. IF IT ENDED WITH ":", -; EXECUTION CONTINUES. IF IT ENDED WITH A CR, IT FINDS THE -; NEXT LINE AND CONTINUE FROM THERE. -; -; "ENDCHK" CHECKS IF A COMMAND IS ENDED WITH CR. THIS IS -; REQUIRED IN CERTAIN COMMANDS. (GOTO, RETURN, AND STOP ETC.) -; -; "ERROR" PRINTS THE STRING POINTED BY DE (AND ENDS WITH CR). -; IT THEN PRINTS THE LINE POINTED BY 'CURRNT' WITH A "?" -; INSERTED AT WHERE THE OLD TEXT POINTER (SHOULD BE ON TOP -; OF THE STACK) POINTS TO. EXECUTION OF TB IS STOPPED -; AND TBI IS RESTARTED. HOWEVER, IF 'CURRNT' -> ZERO -; (INDICATING A DIRECT COMMAND), THE DIRECT COMMAND IS NOT -; PRINTED. AND IF 'CURRNT' -> NEGATIVE # (INDICATING 'INPUT' -; COMMAND), THE INPUT LINE IS NOT PRINTED AND EXECUTION IS -; NOT TERMINATED BUT CONTINUED AT 'INPERR'. -; -; RELATED TO 'ERROR' ARE THE FOLLOWING: -; 'QWHAT' SAVES TEXT POINTER IN STACK AND GET MESSAGE "WHAT?" -; 'AWHAT' JUST GET MESSAGE "WHAT?" AND JUMP TO 'ERROR'. -; 'QSORRY' AND 'ASORRY' DO SAME KIND OF THING. -; 'AHOW' AND 'AHOW' IN THE ZERO PAGE SECTION ALSO DO THIS. -;************************************************************* -setval: - call testvar ; ** SetVal ** - jp c,qwhat ; no variable - push hl ; save address of var - call testc ; do we have =? - .db '=' - .db sv1-$-1 - call expr ; evaluate expression - ld b,h ; value is in bc now - ld c,l - pop hl ; get address - ld (hl),c ; save value - inc hl - ld (hl),b - ret -sv1: - jp qwhat -fin: - call testc ; test for ':' - .db ':' - .db fi1 - $ - 1 - pop af ; yes, purge return address - jp runsml ; continue on same line -fi1: - call testc ; not ':', is it cr - .db cr - .db fi2 - $ - 1 - pop af ; yes, purge return address - jp runnxl ; run next line -fi2: - ret ; else return to caller -endchk: - call skipspace ; ** EndChk ** - cp cr ; ends with cr? - ret z ; ok, otherwise say 'what?' -qwhat: - push de ; ** QWhat ** -awhat: - ld de,what ; ** AWhat ** -handleerror: - sub a ; ** Error ** - call printstr ; print error message - pop de - ld a,(de) ; save the character - push af ; at where old de points - sub a ; and put a 0 (zero) there - ld (de),a - ld hl,(current) ; get the current line number - push hl - ld a,(hl) ; check the value - inc hl - or (hl) - pop de - jp z,rstart ; if zero, just rerstart - ld a,(hl) ; if negative - or a - jp m,inputerror ; then redo input - call printline ; else print the line - dec de ; up to where the 0 is - pop af ; restore the character - ld (de),a - ld a,'?' ; print a ? - call outc - sub a ; and the rest of the line - call printstr - jp rstart -qsorry: - push de ; ** Sorry ** -asorry: - ld de,sorry - jr handleerror - -;************************************************************* -; -; *** GETLN *** FNDLN (& FRIENDS) *** -; -; 'GETLN' READS A INPUT LINE INTO 'BUFFER'. IT FIRST PROMPT -; THE CHARACTER IN A (GIVEN BY THE CALLER), THEN IT FILLS -; THE BUFFER AND ECHOS. IT IGNORES LF'S AND NULLS, BUT STILL -; ECHOS THEM BACK. RUB-OUT IS USED TO CAUSE IT TO DELETE -; THE LAST CHARACTER (IF THERE IS ONE), AND ALT-MOD IS USED TO -; CAUSE IT TO DELETE THE WHOLE LINE AND START IT ALL OVER. -; CR SIGNALS THE END OF A LINE, AND CAUSE 'GETLN' TO RETURN. -; -; 'FNDLN' FINDS A LINE WITH A GIVEN LINE # (IN HL) IN THE -; TEXT SAVE AREA. DE IS USED AS THE TEXT POINTER. IF THE -; LINE IS FOUND, DE WILL POINT TO THE BEGINNING OF THAT LINE -; (I.E., THE LOW BYTE OF THE LINE #), AND FLAGS ARE NC & Z. -; IF THAT LINE IS NOT THERE AND A LINE WITH A HIGHER LINE # -; IS FOUND, DE POINTS TO THERE AND FLAGS ARE NC & NZ. IF -; WE REACHED THE END OF TEXT SAVE AREA AND CANNOT FIND THE -; LINE, FLAGS ARE C & NZ. -; 'FNDLN' WILL INITIALIZE DE TO THE BEGINNING OF THE TEXT SAVE -; AREA TO START THE SEARCH. SOME OTHER ENTRIES OF THIS -; ROUTINE WILL NOT INITIALIZE DE AND DO THE SEARCH. -; 'FNDLNP' WILL START WITH DE AND SEARCH FOR THE LINE #. -; 'FNDNXT' WILL BUMP DE BY 2, FIND A CR AND THEN START SEARCH. -; 'FNDSKP' USE DE TO FIND A CR, AND THEN START SEARCH. -;************************************************************* -getline: - call outc ; ** GetLine ** - ld de,buffer ; prompt and initalise pointer -gl1: - call chkio ; check keyboard - jr z,gl1 ; no input, so wait - cp bs ; erase last character? - jr z,gl3 ; yes - call outc ; echo character - cp lf ; ignore lf - jr z,gl1 - or a ; ignore null - jr z,gl1 - cp ctrlu ; erase the whole line? - jr z,gl4 ; yes - ld (de),a ; save the input - inc de ; and increment pointer - cp cr ; was it cr? - ret z ; yes, end of line - ld a,e ; any free space left? - cp bufend & 0ffh - jr nz,gl1 ; yes, get next char -gl3: - ld a,e ; delete last character - cp buffer & 0ffh ; if there are any? - jr z,gl4 ; no, redo whole line - dec de ; yes, back pointer - ld a,08h ; and echo a backspace - call outc - jr gl1 ; and get next character -gl4: - call crlf ; redo entire line - ld a,'>' - jr getline -findline: - ld a,h ; ** FindLine ** - or a ; check the sign of hl - jp m,qhow ; it cannot be negative - ld de,textbegin ; initialise the text pointer -findlineptr: -fl1: - push hl ; save line number - ld hl,(textunfilled) ; check if we passed end - dec hl - call comp - pop hl ; retrieve line number - ret c ; c,nz passed end - ld a,(de) ; we didn't; get first byte - sub l ; is this the line? - ld b,a ; compare low order - inc de - ld a,(de) ; get second byte - sbc a,h ; compare high order - jr c,fl2 ; no, not there yet - dec de ; else we either found it - or b ; or it's not there - ret ; nc,z:found; nc,nz:no -findnext: - inc de ; find next line -fl2: - inc de ; just passed first and second byte -findskip: - ld a,(de) ; ** FindSkip ** - cp cr ; try to find cr - jr nz,fl2 ; keep looking - inc de ; found cr, skip over - jr fl1 ; check if end of text - -;************************************************************* -; -; *** PRTSTG *** QTSTG *** PRTNUM *** & PRTLN *** -; -; 'PRTSTG' PRINTS A STRING POINTED BY DE. IT STOPS PRINTING -; AND RETURNS TO CALLER WHEN EITHER A CR IS PRINTED OR WHEN -; THE NEXT BYTE IS THE SAME AS WHAT WAS IN A (GIVEN BY THE -; CALLER). OLD A IS STORED IN B, OLD B IS LOST. -; -; 'QTSTG' LOOKS FOR A BACK-ARROW, SINGLE QUOTE, OR DOUBLE -; QUOTE. IF NONE OF THESE, RETURN TO CALLER. IF BACK-ARROW, -; OUTPUT A CR WITHOUT A LF. IF SINGLE OR DOUBLE QUOTE, PRINT -; THE STRING IN THE QUOTE AND DEMANDS A MATCHING UNQUOTE. -; AFTER THE PRINTING THE NEXT 3 BYTES OF THE CALLER IS SKIPPED -; OVER (USUALLY A JUMP INSTRUCTION. -; -; 'PRTNUM' PRINTS THE NUMBER IN HL. LEADING BLANKS ARE ADDED -; IF NEEDED TO PAD THE NUMBER OF SPACES TO THE NUMBER IN C. -; HOWEVER, IF THE NUMBER OF DIGITS IS LARGER THAN THE # IN -; C, ALL DIGITS ARE PRINTED ANYWAY. NEGATIVE SIGN IS ALSO -; PRINTED AND COUNTED IN, POSITIVE SIGN IS NOT. -; -; 'PRTLN' PRINTS A SAVED TEXT LINE WITH LINE # AND ALL. -;************************************************************* -printstr: - ld b,a -ps1: - ld a,(de) ; get a character - inc de ; bump pointer - cp b ; same as old A? - ret z ; yes, return - call outc ; no, show character - cp cr ; was it a cr? - jr nz,ps1 ; no, next character - ret ; yes, returns -qtstg: - call testc ; ** Qtstg ** - .db 22h ; is it a double quote - .db qt3-$-1 - ld a,22h -qt1: - call printstr ; print until another - cp cr - pop hl - jp z,runnxl -qt2: - inc hl ; skip 3 bytes on return - inc hl - inc hl - jp (hl) ; return -qt3: - call testc ; is it a single quote - .db 27h - .db qt4-$-1 - ld a,27h - jr qt1 -qt4: - call testc ; is it back-arrow - .db '_' - .db qt5-$-1 - ld a,8dh ; yes, cr without lf - call outc - call outc - pop hl ; return address - jr qt2 -qt5: - ret ; none of the above - -printnum: - ld b,0h ; ** PrintNum ** - call checksign ; check sign - jp p,pn1 ; no sign - ld b,'-' - dec c -pn1: - push de ; save - ld de, 000ah ; decimal - push de ; save as flag - dec c ; c=spaces - push bc ; save sign & space -pn2: - call divide ; divide hl by 10 - ld a,b ; result 0? - or c - jr z,pn3 ; yes, we got all - ex (sp),hl ; no, save remainder - dec l ; and count space - push hl ; hl is old bc - ld h,b ; moved result to bc - ld l,c - jr pn2 ; and divide by 10 -pn3: - pop bc ; we got all digits -pn4: - dec c - ld a,c ; look at space count - or a - jp m,pn5 ; no leading spaces - ld a,' ' ; print a leading space - call outc - jr pn4 ; any more? -pn5: - ld a,b ; print sign - or a - call nz,outc - ld e,l ; last remainder in e -pn6: - ld a,e ; check digit in e - cp lf ; lf is flag for no more - pop de - ret z ; if yes, return - add a,30h ; else convert to ascii - call outc ; and print the digit - jr pn6 ; next digit -printhex: - ld c,h ; ** PrintHex ** - call ph1 ; first hex byte -printhex8: - ld c,l ; then second -ph1: - ld a,c ; get left nibble into position - rra - rra - rra - rra - call ph2 ; and turn into hex digit - ld a,c ; then convert right nibble -ph2: - and 0fh ; mask right nibble - add a,90h ; and convert to ascii character - daa - adc a,40h - daa - call outc ; print character - ret -printline: - ld a,(de) ; ** PrintLine ** - ld l,a ; low order line number - inc de - ld a,(de) ; high order - ld h,a - inc de - ld c,04h ; print 4 digit line number - call printnum - ld a,' ' ; followed by a space - call outc - sub a ; and the the rest - call printstr - ret - -;************************************************************* -; -; *** MVUP *** MVDOWN *** POPA *** & PUSHA *** -; -; 'MVUP' MOVES A BLOCK UP FROM WHERE DE-> TO WHERE BC-> UNTIL -; DE = HL -; -; 'MVDOWN' MOVES A BLOCK DOWN FROM WHERE DE-> TO WHERE HL-> -; UNTIL DE = BC -; -; 'POPA' RESTORES THE 'FOR' LOOP VARIABLE SAVE AREA FROM THE -; STACK -; -; 'PUSHA' STACKS THE 'FOR' LOOP VARIABLE SAVE AREA INTO THE -; STACK -;************************************************************* -mvup: - call comp ; ** mvup ** - ret z ; de = hl, return - ld a,(de) ; get one byte - ld (bc),a ; then copy it - inc de ; increase both pointers - inc bc - jr mvup ; until done -mvdown: - ld a,b ; ** mvdown ** - sub d ; check if de = bc - jp nz,md1 ; no, go move - ld a,c ; maybe, other byte - sub e - ret z ; yes, return -md1: - dec de ; else move a byte - dec hl ; but first decrease both pointers - ld a,(de) ; and then do it - ld (hl),a - jr mvdown ; loop back -popa: - pop bc ; bc = return address - pop hl ; restore loopvar - ld (loopvar),hl - ld a,h - or l - jr z,pp1 ; all done, so return - pop hl - ld (loopinc),hl - pop hl - ld (looplmt),hl - pop hl - ld (loopln),hl - pop hl - ld (loopptr),hl -pp1: - push bc ; bc = return address - ret -pusha: - ld hl,stacklimit ; ** PushA ** - call changesign - pop bc ; bc = return address - add hl,sp ; is stack near the top? - jp nc,qsorry ; yes, sorry - ld hl,(loopvar) ; else save loop variables - ld a,h - or l - jr z,pu1 ; only when loopvar not 0 - ld hl,(loopptr) - push hl - ld hl,(loopln) - push hl - ld hl,(looplmt) - push hl - ld hl,(loopinc) - push hl - ld hl,(loopvar) -pu1: - push hl - push bc ; bc = return address - ret - -testvar: - call skipspace ; ** testvar ** - sub '@' ; test variables - ret c ; not a variable - jr nz,tv1 ; not @ array - inc de ; is is the @ array - call parn ; @ should be followed by (expr) - add hl,hl ; as its index - jr c,qhow ; is index too big? - push de ; will it override text? - ex de,hl - call size ; find the size of free - call comp - jp c,asorry ; yes, sorry - ld hl,varbegin ; no, get address of @(expr) and - call subde ; put it in hl - pop de - ret -tv1: - cp 1bh ; not @, is it A to Z - ccf - ret c - inc de ; if A trhough Z - ld hl,varbegin ; calculate address of that variable - rlca ; and return it in hl - add a,l ; with the c flag cleared - ld l,a - ld a,0 - adc a,h - ld h,a - ret - -testnum: - ld hl,0000h ; ** TestNum ** - ld b,h ; test if the text is a number - call skipspace -tn1: - cp '0' ; if not,return 0 in b and hl - ret c - cp ':' ; if a digit, convert to binary in - ret nc ; b and hl - ld a,0f0h ; set b to number of digits - and h ; if h>255, there is no room for - jr nz,qhow ; next digit - inc b ; b counts number of digits - push bc - ld b,h ; hl=10*hl+(new digit) - ld c,l - add hl,hl ; where 10* is done by shift and add - add hl,hl - add hl,bc - add hl,hl - ld a,(de) ; and (digit) is by stripping the - inc de ; ascii code - and 0fh - add a,l - ld l,a - ld a,0 - adc a,h - ld h,a - pop bc - ld a,(de) - jp p,tn1 -qhow: - push de ; ** Error How? ** -ahow: - ld de,how - jp handleerror - -msg1 .db "TASTY BASIC",cr -msg2 .db " BYTES FREE",cr -how .db "HOW?",cr -ok .db "OK",cr -what .db "WHAT?",cr -sorry .db "SORRY",cr - -;************************************************************* -; -; *** MAIN *** -; -; THIS IS THE MAIN LOOP THAT COLLECTS THE TINY BASIC PROGRAM -; AND STORES IT IN THE MEMORY. -; -; AT START, IT PRINTS OUT "(CR)OK(CR)", AND INITIALIZES THE -; STACK AND SOME OTHER INTERNAL VARIABLES. THEN IT PROMPTS -; ">" AND READS A LINE. IF THE LINE STARTS WITH A NON-ZERO -; NUMBER, THIS NUMBER IS THE LINE NUMBER. THE LINE NUMBER -; (IN 16 BIT BINARY) AND THE REST OF THE LINE (INCLUDING CR) -; IS STORED IN THE MEMORY. IF A LINE WITH THE SAME LINE -; NUMBER IS ALREADY THERE, IT IS REPLACED BY THE NEW ONE. IF -; THE REST OF THE LINE CONSISTS OF A CR ONLY, IT IS NOT STORED -; AND ANY EXISTING LINE WITH THE SAME LINE NUMBER IS DELETED. -; -; AFTER A LINE IS INSERTED, REPLACED, OR DELETED, THE PROGRAM -; LOOPS BACK AND ASKS FOR ANOTHER LINE. THIS LOOP WILL BE -; TERMINATED WHEN IT READS A LINE WITH ZERO OR NO LINE -; NUMBER; AND CONTROL IS TRANSFERED TO "DIRECT". -; -; TINY BASIC PROGRAM SAVE AREA STARTS AT THE MEMORY LOCATION -; LABELED "TXTBGN" AND ENDS AT "TXTEND". WE ALWAYS FILL THIS -; AREA STARTING AT "TXTBGN", THE UNFILLED PORTION IS POINTED -; BY THE CONTENT OF A MEMORY LOCATION LABELED "TXTUNF". -; -; THE MEMORY LOCATION "CURRNT" POINTS TO THE LINE NUMBER -; THAT IS CURRENTLY BEING INTERPRETED. WHILE WE ARE IN -; THIS LOOP OR WHILE WE ARE INTERPRETING A DIRECT COMMAND -; (SEE NEXT SECTION). "CURRNT" SHOULD POINT TO A 0. -;************************************************************* -rstart: - ld sp,stack -st1: - call crlf - sub a ; a=0 - ld de,ok ; print ok - call printstr - ld hl,st2 + 1 ; literal zero - ld (current),hl ; reset current line pointer -st2: - ld hl,0000h - ld (loopvar),hl - ld (stkgos),hl -st3: - ld a,'>' ; initialise prompt - call getline - push de ; de points to end of line - ld de,buffer ; point de to beginning of line - call testnum ; check if it is a number - call skipspace - ld a,h ; hl = value of the number, or - or l ; 0 if no number was found - pop bc ; bc points to end of line - jp z,direct - dec de ; back up de and save the value of - ld a,h ; the value of the line number there - ld (de),a - dec de - ld a,l - ld (de),a - push bc ; bc,de point to begin,end - push de - ld a,c - sub e - - push af ; a = number of bytes in line - call findline ; find this line in save area - push de ; de points to save area - jr nz,st4 ; nz: line not found - push de ; z: found, delete it - call findnext ; find next line - ; de -> next line - pop bc ; bc -> line to be deleted - ld hl,(textunfilled) ; hl -> unfilled text area - call mvup ; move up to delete - ld h,b ; txtunf -> unfilled area - ld l,c - ld (textunfilled),hl -st4: - pop bc ; get ready to insert - ld hl,(textunfilled) ; but first check if the length - pop af ; of new line is 3 (line# and cr) - push hl - cp 3h ; if so, do not insert - jr z,rstart ; must clear the stack - add a,l ; calculate new txtunf - ld l,a - ld a,0 - adc a,h - ld h,a ; hl -> new unfilled area - ld de,textend ; check to see if there is space - call comp - jp nc,qsorry ; no, sorry - ld (textunfilled),hl ; ok, update textunfilled - pop de ; de -> old unfilled area - call mvdown - pop de ; de,hl -> begin,end - pop hl - call mvup ; copy new line to save area - jr st3 - -;************************************************************* -; -; WHAT FOLLOWS IS THE CODE TO EXECUTE DIRECT AND STATEMENT -; COMMANDS. CONTROL IS TRANSFERED TO THESE POINTS VIA THE -; COMMAND TABLE LOOKUP CODE OF 'DIRECT' AND 'EXEC' IN LAST -; SECTION. AFTER THE COMMAND IS EXECUTED, CONTROL IS -; TRANSFERED TO OTHERS SECTIONS AS FOLLOWS: -; -; FOR 'LIST', 'NEW', AND 'STOP': GO BACK TO 'RSTART' -; FOR 'RUN': GO EXECUTE THE FIRST STORED LINE IF ANY, ELSE -; GO BACK TO 'RSTART'. -; FOR 'GOTO' AND 'GOSUB': GO EXECUTE THE TARGET LINE. -; FOR 'RETURN' AND 'NEXT': GO BACK TO SAVED RETURN LINE. -; FOR ALL OTHERS: IF 'CURRENT' -> 0, GO TO 'RSTART', ELSE -; GO EXECUTE NEXT COMMAND. (THIS IS DONE IN 'FINISH'.) -;************************************************************* -; -; *** NEW *** CLEAR *** STOP *** RUN (& FRIENDS) *** GOTO *** -; -; 'NEW(CR)' SETS 'TXTUNF' TO POINT TO 'TXTBGN' -; -; 'CLEAR(CR)' CLEARS ALL VARIABLES -; -; 'END(CR)' GOES BACK TO 'RSTART' -; -; 'RUN(CR)' FINDS THE FIRST STORED LINE, STORE ITS ADDRESS (IN -; 'CURRENT'), AND START EXECUTE IT. NOTE THAT ONLY THOSE -; COMMANDS IN TAB2 ARE LEGAL FOR STORED PROGRAM. -; -; THERE ARE 3 MORE ENTRIES IN 'RUN': -; 'RUNNXL' FINDS NEXT LINE, STORES ITS ADDR. AND EXECUTES IT. -; 'RUNTSL' STORES THE ADDRESS OF THIS LINE AND EXECUTES IT. -; 'RUNSML' CONTINUES THE EXECUTION ON SAME LINE. -; -; 'GOTO EXPR(CR)' EVALUATES THE EXPRESSION, FIND THE TARGET -; LINE, AND JUMP TO 'RUNTSL' TO DO IT. -;************************************************************* -#ifndef ZEMU -bye: - call endchk ; ** Reboot ** - LD A,BID_BOOT ; BOOT BANK - LD HL,0 ; ADDRESS ZERO - CALL HB_BNKCALL ; DOES NOT RETURN - HALT -#endif -new: - call endchk ; ** New ** - ld hl,textbegin - ld (textunfilled),hl -clear: - call clrvars ; ** Clear ** - jp rstart -endd: - call endchk ; ** End ** - jp rstart -run: - call endchk ; ** Run ** - ld de,textbegin -runnxl: - ld hl,0h ; ** Run Next Line ** - call findlineptr - jp c,rstart -runtsl: - ex de,hl ; ** Run Tsl - ld (current),hl ; set current -> line # - ex de,hl - inc de - inc de -runsml: - call chkio ; ** Run Same Line ** - ld hl, tab2-1 ; find the command in table 2 - jp exec ; and execute it -goto: - call expr - push de ; save for error routine - call endchk ; must find a cr - call findline ; find the target line - jp nz, ahow ; no such line # - pop af ; clear the pushed de - jr runtsl ; go do it - -;************************************************************* -; -; *** LIST *** & PRINT *** -; -; LIST HAS TWO FORMS: -; 'LIST(CR)' LISTS ALL SAVED LINES -; 'LIST #(CR)' START LIST AT THIS LINE # -; YOU CAN STOP THE LISTING BY CONTROL C KEY -; -; PRINT COMMAND IS 'PRINT ....;' OR 'PRINT ....(CR)' -; WHERE '....' IS A LIST OF EXPRESIONS, FORMATS, BACK- -; ARROWS, AND STRINGS. THESE ITEMS ARE SEPERATED BY COMMAS. -; -; A FORMAT IS A POUND SIGN FOLLOWED BY A NUMBER. IT CONTROLS -; THE NUMBER OF SPACES THE VALUE OF A EXPRESION IS GOING TO -; BE PRINTED. IT STAYS EFFECTIVE FOR THE REST OF THE PRINT -; COMMAND UNLESS CHANGED BY ANOTHER FORMAT. IF NO FORMAT IS -; SPECIFIED, 6 POSITIONS WILL BE USED. -; -; A STRING IS QUOTED IN A PAIR OF SINGLE QUOTES OR A PAIR OF -; DOUBLE QUOTES. -; -; A BACK-ARROW MEANS GENERATE A (CR) WITHOUT (LF) -; -; A (CRLF) IS GENERATED AFTER THE ENTIRE LIST HAS BEEN -; PRINTED OR IF THE LIST IS A NULL LIST. HOWEVER IF THE LIST -; ENDED WITH A COMMA, NO (CRLF) IS GENERATED. -;************************************************************* -list: - call testnum ; check if there is a number - call endchk ; if no number we get a 0 - call findline ; find this or next line -ls1: - jp c,rstart - call printline ; print the line - call chkio ; stop on ctrl-c - call findlineptr ; find the next line - jr ls1 ; and loop back - -print: - ld c,6 ; c = number of spaces - call testc ; is it a semicolon? - .db ':' - .db pr2-$-1 - call crlf - jr runsml -pr2: - call testc ; is it a cr? - .db cr - .db pr0-$-1 - call crlf - jr runnxl -pr0: - call testc ; is it format? - .db '#' - .db pr1-$-1 - call expr - ld c,l - jr pr3 -pr1: - call testc ; is it a dollar? - .db '$' - .db pr4-$-1 - call expr - ld c,l - call testc ; do we have a comma? - .db ',' - .db pr6-$-1 - push bc - call expr - pop bc - ld a,8 ; 8 bits? - cp c - jp nz,pr9 ; no, try 16 - call printhex8 ; yes, print a single hex byte - jp pr3 -pr9: - ld a,10h ; 16 bits? - cp c - jp nz,qhow ; no, show error message - call printhex ; yes, print two hex bytes - jp pr3 -pr4: - call qtstg ; is it a string? - jr pr8 -pr3: - call testc ; is it a comma? - .db ',' - .db pr6-$-1 - call fin - jr pr0 -pr6: - call crlf ; list ends - call finish -pr8: - call expr ; evaluate the expression - push bc - call printnum - pop bc - jr pr3 - -;************************************************************* -; -; *** GOSUB *** & RETURN *** -; -; 'GOSUB EXPR;' OR 'GOSUB EXPR (CR)' IS LIKE THE 'GOTO' -; COMMAND, EXCEPT THAT THE CURRENT TEXT POINTER, STACK POINTER -; ETC. ARE SAVE SO THAT EXECUTION CAN BE CONTINUED AFTER THE -; SUBROUTINE 'RETURN'. IN ORDER THAT 'GOSUB' CAN BE NESTED -; (AND EVEN RECURSIVE), THE SAVE AREA MUST BE STACKED. -; THE STACK POINTER IS SAVED IN 'STKGOS', THE OLD 'STKGOS' IS -; SAVED IN THE STACK. IF WE ARE IN THE MAIN ROUTINE, 'STKGOS' -; IS ZERO (THIS WAS DONE BY THE "MAIN" SECTION OF THE CODE), -; BUT WE STILL SAVE IT AS A FLAG FOR NO FURTHER 'RETURN'S. -; -; 'RETURN(CR)' UNDOS EVERYTHING THAT 'GOSUB' DID, AND THUS -; RETURN THE EXECUTION TO THE COMMAND AFTER THE MOST RECENT -; 'GOSUB'. IF 'STKGOS' IS ZERO, IT INDICATES THAT WE -; NEVER HAD A 'GOSUB' AND IS THUS AN ERROR. -;************************************************************* -gosub: - call pusha ; ** Gosub ** - call expr ; save the current "FOR" params - push de ; and text pointer - call findline ; find the target line - jp nz,ahow ; how? because it doesn't exist - ld hl,(current) ; found it, save old 'current' - push hl - ld hl,(stkgos) ; and 'stkgos' - push hl - ld hl,0000h ; and load new ones - ld (loopvar),hl - add hl,sp - ld (stkgos),hl - jp runtsl ; and run the line -return: - call endchk ; there must be a cr - ld hl,(stkgos) ; check old stack pointer - ld a,h ; - or l - jp z,what ; what? not found - ld sp,hl ; otherwise restore it - pop hl - ld (stkgos),hl - pop hl - ld (current),hl ; and old 'current' - pop de ; and old text pointer - call popa ; and old 'FOR' params - call finish ; and we're back - -;************************************************************* -; -; *** FOR *** & NEXT *** -; -; 'FOR' HAS TWO FORMS: -; 'FOR VAR=EXP1 TO EXP2 STEP EXP3' AND 'FOR VAR=EXP1 TO EXP2' -; THE SECOND FORM MEANS THE SAME THING AS THE FIRST FORM WITH -; EXP3=1. (I.E., WITH A STEP OF +1.) -; TBI WILL FIND THE VARIABLE VAR, AND SET ITS VALUE TO THE -; CURRENT VALUE OF EXP1. IT ALSO EVALUATES EXP2 AND EXP3 -; AND SAVE ALL THESE TOGETHER WITH THE TEXT POINTER ETC. IN -; THE 'FOR' SAVE AREA, WHICH CONSISTS OF 'LOPVAR', 'LOPINC', -; 'LOPLMT', 'LOPLN', AND 'LOPPT'. IF THERE IS ALREADY SOME- -; THING IN THE SAVE AREA (THIS IS INDICATED BY A NON-ZERO -; 'LOPVAR'), THEN THE OLD SAVE AREA IS SAVED IN THE STACK -; BEFORE THE NEW ONE OVERWRITES IT. -; TBI WILL THEN DIG IN THE STACK AND FIND OUT IF THIS SAME -; VARIABLE WAS USED IN ANOTHER CURRENTLY ACTIVE 'FOR' LOOP. -; IF THAT IS THE CASE, THEN THE OLD 'FOR' LOOP IS DEACTIVATED. -; (PURGED FROM THE STACK..) -; -; 'NEXT VAR' SERVES AS THE LOGICAL (NOT NECESSARILLY PHYSICAL) -; END OF THE 'FOR' LOOP. THE CONTROL VARIABLE VAR. IS CHECKED -; WITH THE 'LOPVAR'. IF THEY ARE NOT THE SAME, TBI DIGS IN -; THE STACK TO FIND THE RIGHT ONE AND PURGES ALL THOSE THAT -; DID NOT MATCH. EITHER WAY, TBI THEN ADDS THE 'STEP' TO -; THAT VARIABLE AND CHECK THE RESULT WITH THE LIMIT. IF IT -; IS WITHIN THE LIMIT, CONTROL LOOPS BACK TO THE COMMAND -; FOLLOWING THE 'FOR'. IF OUTSIDE THE LIMIT, THE SAVE AREA -; IS PURGED AND EXECUTION CONTINUES. -;************************************************************* - -for: - call pusha ; save old save area - call setval ; set the control variable - dec hl ; its address is hl - ld (loopvar),hl ; save that - ld hl,tab5-1 ; use 'exec' to find 'TO' - jp exec -fr1: - call expr ; evaluate the limit - ld (looplmt),hl ; and save it - ld hl,tab6-1 ; use 'exec' to find 'STEP' - jp exec -fr2: - call expr ; found 'STEP' - jr fr4 -fr3: - ld hl,0001h ; no 'STEP' so set to 1 -fr4: - ld (loopinc),hl ; and save that too -fr5: - ld hl,(current) ; save current line number - ld (loopln),hl - ex de,hl ; and text pointer - ld (loopptr),hl - ld bc,0ah ; dig into stack to find loopvar - ld hl,(loopvar) - ex de,hl - ld h,b - ld l,b - add hl,sp - .db 3eh -fr7: - add hl,bc - ld a,(hl) - inc hl - or (hl) - jr z,fr8 - ld a,(hl) - dec hl - cp d - jr nz,fr7 - ld a,(hl) - cp e - jr nz,fr7 - ex de,hl - ld hl,0000h - add hl,sp - ld b,h - ld c,l - ld hl,000ah - add hl,de - call mvdown - ld sp,hl -fr8: - ld hl,(loopptr) ; all done - ex de,hl - call finish -next: - call testvar ; get address of variable - jp c,qwhat ; what, no variable - ld (varnext),hl ; yes, save it -nx0: - push de ; save the text pointer - ex de,hl - ld hl,(loopvar) ; get the variable in 'FOR' - ld a,h - or l ; if 0, there never was one - jp z,awhat - call comp ; else check them - jr z,nx3 ; yes, they agree - pop de ; no, complete current loop - call popa - ld hl,(varnext) ; and pop one level - jr nx0 ; go check again -nx3: - ld e,(hl) - inc hl - ld d,(hl) ; de = value of variable - ld hl,(loopinc) - push hl - ld a,h - xor d - ld a,d - add hl,de - jp m,nx4 - xor h - jp m,nx5 -nx4: - ex de,hl - ld hl,(loopvar) - ld (hl),e - inc hl - ld (hl),d - ld hl,(looplmt) - pop af - or a - jp p,nx1 ; step > 0 - ex de,hl ; step < 0 -nx1: - call ckhlde ; compare with limit - pop de ; restore the text pointer - jr c,nx2 ; over the limit - ld hl,(loopln) ; within the limit - ld (current),hl - ld hl,(loopptr) - ex de,hl - call finish -nx5: - pop hl - pop de -nx2: - call popa ; purge this loop - call finish ; - -init: - ld hl,start ; initialise random pointer - ld (rndptr),hl - ld hl,usrfunc ; initialise user defined function - ld (usrptr),hl - ld a,0c3h - ld (usrfunc),a ; initiase default USR() behaviour - ld hl,qhow ; (i.e. HOW? error) - ld (usrfunc+1),hl - ld hl,textbegin ; initialise text area pointers - ld (textunfilled),hl - ld (ocsw),a ; enable output control switch - call clrvars ; clear variables - call crlf - ld de,msg1 ; output welcome message - call printstr - call crlf - call size ; output free size message - call printnum - ld de,msg2 - call printstr - jp rstart - -chkio: - call haschar ; check if character available - ret z ; no, return - call getchar ; get the character - push bc ; is it a lf? - ld b,a - sub lf - jr z,io1 ; yes, ignore an return - ld a,b ; no, restore a and bc - pop bc - cp ctrlo ; is it ctrl-o? - jr nz,io2 ; no, done - ld a,(ocsw) ; toggle output control switch - cpl - ld (ocsw),a - jr chkio ; get next character -io1: - ld a,0h ; clear - or a ; set the z-flag - pop bc ; restore bc - ret ; return with z set -io2: - cp 60h ; is it lower case? - jp c,io3 ; no - and 0dfh ; yes, make upper case -io3: - cp ctrlc ; is it ctrl-c? - ret nz ; no - jp rstart ; yes, restart tasty basic -crlf: - ld a,cr -outc: - push af - ld a,(ocsw) ; check output control switch - or a - jr nz,oc1 ; output is enabled - pop af ; output is disabled - ret ; so return -oc1: - pop af - call putchar - cp cr ; was it a cr? - ret nz ; no, return - ld a,lf ; send a lf - call outc - ld a,cr ; restore register - ret ; and return -putchar: -#ifdef ZEMU - call uart_tx_ready ; see if transmit is available - out (tty_data),a ; and send it - ret -uart_tx_ready: - push af -uart_tx_ready_loop: - in a,(tty_status) - bit tx_empty,a - jp z,uart_tx_ready_loop - pop af -#else - PUSH AF - PUSH BC - PUSH DE - PUSH HL - ; OUTPUT CHARACTER TO CONSOLE VIA HBIOS - LD E,A ; OUTPUT CHAR TO E - LD C,CIO_CONSOLE ; CONSOLE UNIT TO C - LD B,BF_CIOOUT ; HBIOS FUNC: OUTPUT CHAR - RST 08 ; HBIOS OUTPUTS CHARACTER - POP HL - POP DE - POP BC - POP AF -#endif - ret -haschar: -#ifdef ZEMU - in a,(tty_status) ; check if character available - bit rx_full,a -#else - PUSH BC - PUSH DE - PUSH HL - ; GET CONSOLE INPUT STATUS VIA HBIOS - LD C,CIO_CONSOLE ; CONSOLE UNIT TO C - LD B,BF_CIOIST ; HBIOS FUNC: INPUT STATUS - RST 08 ; HBIOS RETURNS STATUS IN A - POP HL - POP DE - POP BC -#endif - ret - -getchar: -#ifdef ZEMU - in a,(tty_data) ; get the character -#else - PUSH BC - PUSH DE - PUSH HL - ; INPUT CHARACTER FROM CONSOLE VIA HBIOS - LD C,CIO_CONSOLE ; CONSOLE UNIT TO C - LD B,BF_CIOIN ; HBIOS FUNC: INPUT CHAR - RST 08 ; HBIOS READS CHARACTDR - LD A,E ; MOVE CHARACTER TO A FOR RETURN - ; RESTORE REGISTERS (AF IS OUTPUT) - POP HL - POP DE - POP BC -#endif - ret - -;************************************************************* -; -; *** TABLES *** DIRECT *** & EXEC *** -; -; THIS SECTION OF THE CODE TESTS A STRING AGAINST A TABLE. -; WHEN A MATCH IS FOUND, CONTROL IS TRANSFERED TO THE SECTION -; OF CODE ACCORDING TO THE TABLE. -; -; AT 'EXEC', DE SHOULD POINT TO THE STRING AND HL SHOULD POINT -; TO THE TABLE-1. AT 'DIRECT', DE SHOULD POINT TO THE STRING. -; HL WILL BE SET UP TO POINT TO TAB1-1, WHICH IS THE TABLE OF -; ALL DIRECT AND STATEMENT COMMANDS. -; -; A '.' IN THE STRING WILL TERMINATE THE TEST AND THE PARTIAL -; MATCH WILL BE CONSIDERED AS A MATCH. E.G., 'P.', 'PR.', -; 'PRI.', 'PRIN.', OR 'PRINT' WILL ALL MATCH 'PRINT'. -; -; THE TABLE CONSISTS OF ANY NUMBER OF ITEMS. EACH ITEM -; IS A STRING OF CHARACTERS WITH BIT 7 SET TO 0 AND -; A JUMP ADDRESS STORED HI-LOW WITH BIT 7 OF THE HIGH -; BYTE SET TO 1. -; -; END OF TABLE IS AN ITEM WITH A JUMP ADDRESS ONLY. IF THE -; STRING DOES NOT MATCH ANY OF THE OTHER ITEMS, IT WILL -; MATCH THIS NULL ITEM AS DEFAULT. -;************************************************************* -tab1: ; direct commands - .db "LIST" - dwa(list) - .db "RUN" - dwa(run) - .db "NEW" - dwa(new) - .db "CLEAR" - dwa(clear) -#ifndef ZEMU - .db "BYE" - dwa(bye) -#endif -tab2: ; direct/statement - .db "NEXT" - dwa(next) - .db "LET" - dwa(let) - .db "IF" - dwa(iff) - .db "GOTO" - dwa(goto) - .db "GOSUB" - dwa(gosub) - .db "RETURN" - dwa(return) - .db "REM" - dwa(rem) - .db "FOR" - dwa(for) - .db "INPUT" - dwa(input) - .db "PRINT" - dwa(print) - .db "POKE" - dwa(poke) - .db "END" - dwa(endd) - dwa(deflt) -tab4: ; functions - .db "PEEK" - dwa(peek) - .db "RND" - dwa(rnd) - .db "ABS" - dwa(abs) - .db "USR" - dwa(usrexec) - .db "SIZE" - dwa(size) - dwa(xp40) -tab5: ; 'TO' in 'FOR' - .db "TO" - dwa(fr1) -tab6: ; 'STEP' in 'FOR' - .db "STEP" - dwa(fr2) - dwa(fr3) -tab8: ; relational operators - .db ">=" - dwa(xp11) - .db "#" - dwa(xp12) - .db ">" - dwa(xp13) - .db "=" - dwa(xp15) - .db "<=" - dwa(xp14) - .db "<" - dwa(xp16) - dwa(xp17) - -direct: - ld hl,tab1-1 ; ** Direct ** -exec: - call skipspace ; ** Exec ** - push de -ex1: - ld a,(de) - inc de - cp '.' - jr z,ex3 - inc hl - cp (hl) - jr z,ex1 - ld a,7fh - dec de - cp (hl) - jr c,ex5 -ex2: - inc hl - cp (hl) - jr nc,ex2 - inc hl - pop de - jr exec -ex3: - ld a,7fh -ex4: - inc hl - cp (hl) - jr nc,ex4 -ex5: - ld a,(hl) - inc hl - ld l,(hl) - and 7fh - ld h,a - pop af - jp (hl) - -;------------------------------------------------------------------------------- -LST_ROM: ; all the above _can_ be in rom - ; all following *must* be in ram - .org (TBC_LOC + 09feh) -usrptr: .ds 2 ; -> user defined function area - .org (TBC_LOC + 0a00h) -usrfunc .ds 2 ; start of user defined function area - .org (TBC_LOC + 0c00h) ; start of state -ocsw .ds 1 ; output control switch -current .ds 2 ; points to current line -stkgos .ds 2 ; saves sp in 'GOSUB' -varnext .ds 2 ; temp storage -stkinp .ds 2 ; save sp in 'INPUT' -loopvar .ds 2 ; 'FOR' loop save area -loopinc .ds 2 ; loop increment -looplmt .ds 2 ; loop limit -loopln .ds 2 ; loop line number -loopptr .ds 2 ; loop text pointer -rndptr .ds 2 ; random number pointer -textunfilled .ds 2 ; -> unfilled text area -textbegin .ds 2 ; start of text save area - .org (TBC_LOC + 07dffh) -textend .ds 0 ; end of text area -varbegin .ds 55 ; variable @(0) -varend .ds 0 ; end of variable area -buffer .ds 72 ; input buffer -bufend .ds 1 -stacklimit .ds 1 - .org (TBC_LOC + 07fffh) -stack .equ $ - -#ifndef ZEMU -SLACK .EQU (TBC_END - LST_ROM) - .FILL SLACK,'t' - - .ECHO "TASTYBASIC space remaining: " - .ECHO SLACK - .ECHO " bytes.\n" -#endif - .end diff --git a/Source/HBIOS/time.asm b/Source/HBIOS/time.asm index 315bde39..9bdd8c3e 100644 --- a/Source/HBIOS/time.asm +++ b/Source/HBIOS/time.asm @@ -83,7 +83,7 @@ DOW_YR .DB 0 DOW_DT .DB 0 DOW_MO .DB 0 ; -; DERIVE DOW FROM STARNDARD TIME BUFFER AT HL +; DERIVE DOW FROM STANDARD TIME BUFFER AT HL ; RETURN DOW IN A (0-6: SUN-SAT) ; TIMDOW: diff --git a/Source/HBIOS/tms.asm b/Source/HBIOS/tms.asm index 4759cf61..2dcc6253 100644 --- a/Source/HBIOS/tms.asm +++ b/Source/HBIOS/tms.asm @@ -1,8 +1,9 @@ ;====================================================================== -; N8 VDU DRIVER FOR SBC PROJECT +; TM9918 AND V9958 VDU DRIVER ; ; WRITTEN BY: DOUGLAS GOODALL ; UPDATED BY: WAYNE WARTHEN -- 4/7/2013 +; UPDATED BY: DEAN NETHERTON -- 5/26/2021 - V9958 SUPPORT ;====================================================================== ; ; TODO: @@ -14,68 +15,154 @@ ; TMS DRIVER - CONSTANTS ;====================================================================== ; -#IF (TMSMODE == TMSMODE_N8) +TMSCTRL1: .EQU 1 ; CONTROL BITS +TMSINTEN: .EQU 5 ; INTERRUPT ENABLE BIT + +#IF TMSTIMENABLE + .ECHO "TMS INTERRUPTS ENABLED\n" +#ENDIF + +#IF ((TMSMODE == TMSMODE_MSX) | (TMSMODE == TMSMODE_MSX9958)) +TMS_DATREG .EQU $98 ; READ/WRITE DATA +TMS_CMDREG .EQU $99 ; READ STATUS / WRITE REG SEL +TMS_PPIA .EQU 0 ; PPI PORT A +TMS_PPIB .EQU 0 ; PPI PORT B +TMS_PPIC .EQU 0 ; PPI PORT C +TMS_PPIX .EQU 0 ; PPI CONTROL PORT +#ENDIF + +#IF (TMSMODE == TMSMODE_COLECO)) +TMS_DATREG .EQU $BE ; READ/WRITE DATA +TMS_CMDREG .EQU $BF ; READ STATUS / WRITE REG SEL +TMS_PPIA .EQU 0 ; PPI PORT A +TMS_PPIB .EQU 0 ; PPI PORT B +TMS_PPIC .EQU 0 ; PPI PORT C +TMS_PPIX .EQU 0 ; PPI CONTROL PORT +#ENDIF + +#IF (TMSMODE == TMSMODE_MSXKBD) TMS_DATREG .EQU $98 ; READ/WRITE DATA TMS_CMDREG .EQU $99 ; READ STATUS / WRITE REG SEL +TMS_KBDDATA .EQU $E0 ; KBD CTLR DATA PORT +TMS_KBDST .EQU $E1 ; KBD CTLR STATUS/CMD PORT +#ENDIF +#IF (TMSMODE == TMSMODE_N8) +TMS_DATREG .EQU $98 ; READ/WRITE DATA +TMS_CMDREG .EQU $99 ; READ STATUS / WRITE REG SEL TMS_PPIA .EQU $84 ; PPI PORT A TMS_PPIB .EQU $85 ; PPI PORT B TMS_PPIC .EQU $86 ; PPI PORT C TMS_PPIX .EQU $87 ; PPI CONTROL PORT - #ENDIF #IF (TMSMODE == TMSMODE_SCG) - TMS_DATREG .EQU $98 ; READ/WRITE DATA TMS_CMDREG .EQU $99 ; READ STATUS / WRITE REG SEL TMS_ACR .EQU $9C ; AUX CONTROL REGISTER - TMS_PPIA .EQU 0 ; PPI PORT A TMS_PPIB .EQU 0 ; PPI PORT B TMS_PPIC .EQU 0 ; PPI PORT C TMS_PPIX .EQU 0 ; PPI CONTROL PORT - #ENDIF ; +#IF (TMSMODE == TMSMODE_MBC) + +TMS_DATREG .EQU $98 ; READ/WRITE DATA +TMS_CMDREG .EQU $99 ; READ STATUS / WRITE REG SEL +TMS_ACR .EQU $9C ; AUX CONTROL REGISTER +TMS_PPIA .EQU 0 ; PPI PORT A +TMS_PPIB .EQU 0 ; PPI PORT B +TMS_PPIC .EQU 0 ; PPI PORT C +TMS_PPIX .EQU 0 ; PPI CONTROL PORT +TMS_KBDDATA .EQU $E2 ; KBD CTLR DATA PORT +TMS_KBDST .EQU $E3 ; KBD CTLR STATUS/CMD PORT +#ENDIF + TMS_ROWS .EQU 24 + +#IF ((TMSMODE == TMSMODE_MSX9958) | (TMSMODE == TMSMODE_MBC)) +TMS_FNTVADDR .EQU $1000 ; VRAM ADDRESS OF FONT DATA +TMS_COLS .EQU 80 +#ELSE +TMS_FNTVADDR .EQU $0800 ; VRAM ADDRESS OF FONT DATA TMS_COLS .EQU 40 +#ENDIF ; #DEFINE USEFONT8X8 #DEFINE TMS_FONT FONT8X8 ; TERMENABLE .SET TRUE ; INCLUDE TERMINAL PSEUDODEVICE DRIVER ; -; TMS_IODELAY IS USED TO ADD RECOVERY TIME TO TMS9918 ACCESSES +; TMS_IODELAY IS USED TO ADD RECOVERY TIME TO TMS9918/V9958 ACCESSES ; IF YOU SEE SCREEN CORRUPTION, ADJUST THIS!!! ; -#IF (TMSMODE == TMSMODE_N8) -; BELOW WAS TUNED FOR N8 AT 18MHZ +#IF (CPUFAM == CPU_Z180) +; BELOW WAS TUNED FOR Z180 AT 18MHZ #DEFINE TMS_IODELAY EX (SP),HL \ EX (SP),HL ; 38 W/S #ELSE ; BELOW WAS TUNED FOR SBC AT 8MHZ -#DEFINE TMS_IODELAY NOP \ NOP ; 8 W/S +#IF ((TMSMODE == TMSMODE_MSX9958) | (TMSMODE == TMSMODE_MBC)) +#DEFINE TMS_IODELAY NOP \ NOP \ NOP \ NOP \ NOP \ NOP \ NOP ; V9958 NEEDS AT WORST CASE, APPROX 4us (28T) DELAY BETWEEN I/O (WHEN IN TEXT MODE) +#ELSE +#DEFINE TMS_IODELAY NOP \ NOP ; 8 W/S +#ENDIF #ENDIF ; ;====================================================================== ; TMS DRIVER - INITIALIZATION ;====================================================================== ; +TMS_PREINIT: + ; DISABLE INTERRUPT GENERATION + LD A, (TMS_INITVDU_REG_1) + RES TMSINTEN, A ; RESET INTERRUPT ENABLE BIT + LD (TMS_INITVDU_REG_1), A + LD C, TMSCTRL1 + JP TMS_SET +; TMS_INIT: #IF (CPUFAM == CPU_Z180) CALL TMS_Z180IO #ENDIF ; -#IF (TMSMODE == TMSMODE_SCG) +#IF ((TMSMODE == TMSMODE_SCG) | (TMSMODE == TMSMODE_MBC)) LD A,$FF OUT (TMS_ACR),A ; INIT AUX CONTROL REG #ENDIF ; + CALL NEWLINE ; FORMATTING + PRTS("TMS: MODE=$") + +#IF ((TMSMODE == TMSMODE_MBC)) + LD A,$FE + OUT (TMS_ACR),A ; INIT AUX CONTROL REG +#ENDIF + + LD IY,TMS_IDAT ; POINTER TO INSTANCE DATA ; - CALL NEWLINE ; FORMATTING - PRTS("TMS: IO=0x$") +#IF (TMSMODE == TMSMODE_SCG) + PRTS("SCG$") +#ENDIF +#IF (TMSMODE == TMSMODE_MBC) + PRTS("MBC$") +#ENDIF +#IF (TMSMODE == TMSMODE_N8) + PRTS("N8$") +#ENDIF +#IF (TMSMODE == TMSMODE_MSX) + PRTS("MSX$") +#ENDIF +#IF (TMSMODE == TMSMODE_MSXKBD) + PRTS("RCKBD$") +#ENDIF +#IF (TMSMODE == TMSMODE_MSX9958) + PRTS("RC_V9958$") +#ENDIF +; + PRTS(" IO=0x$") LD A,TMS_DATREG CALL PRTHEXBYTE CALL TMS_PROBE ; CHECK FOR HW EXISTENCE @@ -91,7 +178,25 @@ TMS_INIT1: CALL TMS_LOADFONT ; LOAD FONT DATA FROM ROM TO TMS STRORAGE CALL TMS_VDARES1 #IF (TMSMODE == TMSMODE_N8) - CALL PPK_INIT ; INITIALIZE KEYBOARD DRIVER + CALL PPK_INIT ; INITIALIZE PPI KEYBOARD DRIVER +#ENDIF +#IF ((TMSMODE == TMSMODE_MSXKBD) | (TMSMODE == TMSMODE_MBC)) + CALL KBD_INIT ; INITIALIZE 8242 KEYBOARD DRIVER +#ENDIF +#IF MKYENABLE + CALL MKY_INIT ; INITIALIZE MKY KEYBOARD DRIVER +#ENDIF + +#IF (INTMODE == 1 & TMSTIMENABLE) + ; ADD IM1 INT CALL LIST ENTRY + LD HL, TMS_TSTINT ; GET INT VECTOR + CALL HB_ADDIM1 ; ADD TO IM1 CALL LIST + + LD A, (TMS_INITVDU_REG_1) + SET TMSINTEN, A ; SET INTERRUPT ENABLE BIT + LD (TMS_INITVDU_REG_1), A + LD C, TMSCTRL1 + CALL TMS_SET #ENDIF ; ; ADD OURSELVES TO VDA DISPATCH TABLE @@ -107,7 +212,7 @@ TMS_INIT1: ; XOR A ; SIGNAL SUCCESS RET -; +; ;====================================================================== ; TMS DRIVER - VIDEO DISPLAY ADAPTER (VDA) FUNCTIONS ;====================================================================== @@ -130,12 +235,27 @@ TMS_FNTBL: .DW PPK_FLUSH .DW PPK_READ #ELSE - .DW TMS_STAT - .DW TMS_FLUSH - .DW TMS_READ + #IF ((TMSMODE == TMSMODE_MSXKBD) | (TMSMODE == TMSMODE_MBC)) + .DW KBD_STAT + .DW KBD_FLUSH + .DW KBD_READ + #ELSE + #IF MKYENABLE + .DW MKY_STAT + .DW MKY_FLUSH + .DW MKY_READ + + #ELSE + .DW TMS_STAT + .DW TMS_FLUSH + .DW TMS_READ + #ENDIF + #ENDIF #ENDIF + .DW TMS_VDARDC #IF (($ - TMS_FNTBL) != (VDA_FNCNT * 2)) .ECHO "*** INVALID TMS FUNCTION TABLE ***\n" + !!!!! #ENDIF TMS_VDAINI: @@ -169,19 +289,22 @@ TMS_VDARES1: ; ENTRY POINT TO AVOID TMS_Z180IO RECURSION DEC A LD (TMS_CURSAV),A CALL TMS_SETCUR ; SET CURSOR - + XOR A ; SIGNAL SUCCESS RET - + TMS_VDADEV: LD D,VDADEV_TMS ; D := DEVICE TYPE LD E,0 ; E := PHYSICAL UNIT IS ALWAYS ZERO + LD H,TMSMODE ; H := MODE + LD L,TMS_DATREG ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET - + TMS_VDASCS: - CALL PANIC ; NOT IMPLEMENTED (YET) - + SYSCHKERR(ERR_NOTIMPL) ; NOT IMPLEMENTED (YET) + RET + TMS_VDASCP: #IF (CPUFAM == CPU_Z180) CALL TMS_Z180IO @@ -191,15 +314,15 @@ TMS_VDASCP: CALL TMS_SETCUR XOR A ; SIGNAL SUCCESS RET - + TMS_VDASAT: XOR A ; NOT POSSIBLE, JUST SIGNAL SUCCESS RET - + TMS_VDASCO: XOR A ; NOT POSSIBLE, JUST SIGNAL SUCCESS RET - + TMS_VDAWRC: #IF (CPUFAM == CPU_Z180) CALL TMS_Z180IO @@ -210,7 +333,7 @@ TMS_VDAWRC: CALL TMS_SETCUR XOR A ; SIGNAL SUCCESS RET - + TMS_VDAFIL: #IF (CPUFAM == CPU_Z180) CALL TMS_Z180IO @@ -238,7 +361,7 @@ TMS_VDACPY: CALL TMS_SETCUR XOR A RET - + TMS_VDASCR: #IF (CPUFAM == CPU_Z180) CALL TMS_Z180IO @@ -264,6 +387,15 @@ TMS_VDASCR2: XOR A RET +;---------------------------------------------------------------------- +; READ VALUE AT CURRENT VDU BUFFER POSITION +; RETURN E = CHARACTER, B = COLOUR, C = ATTRIBUTES +;---------------------------------------------------------------------- + +TMS_VDARDC: + OR $FF ; UNSUPPORTED FUNCTION + RET + ; DUMMY FUNCTIONS BELOW BECAUSE SCG BOARD HAS NO ; KEYBOARD INTERFACE @@ -293,18 +425,28 @@ TMS_SET: OUT (TMS_CMDREG),A ; WRITE IT TMS_IODELAY LD A,C ; GET THE DESIRED REGISTER - OR $80 ; SET BIT 7 + OR $80 ; SET BIT 7 OUT (TMS_CMDREG),A ; SELECT THE DESIRED REGISTER TMS_IODELAY RET ; ;---------------------------------------------------------------------- ; SET TMS9918 READ/WRITE ADDRESS -; TMS_WR SETS TMS9918 TO BEGIN WRITING TO ADDRESS SPECIFIED IN HL -; TMS_RD SETS TMS9918 TO BEGIN READING TO ADDRESS SPECIFIED IN HL +; TMS_WR SETS TMS9918 TO BEGIN WRITING AT VDU ADDRESS SPECIFIED IN HL +; TMS_RD SETS TMS9918 TO BEGIN READING AT VDU ADDRESS SPECIFIED IN HL ;---------------------------------------------------------------------- ; TMS_WR: +#IF ((TMSMODE == TMSMODE_MSX9958) | (TMSMODE == TMSMODE_MBC)) + ; CLEAR R#14 FOR V9958 + XOR A + OUT (TMS_CMDREG), A + TMS_IODELAY + LD A, $80 | 14 + OUT (TMS_CMDREG), A + TMS_IODELAY +#ENDIF + PUSH HL SET 6,H ; SET WRITE BIT CALL TMS_RD @@ -333,21 +475,27 @@ TMS_PROBE: ; WRITE TEST PATTERN TO FIRST TWO BYTES LD A,$A5 ; FIRST BYTE OUT (TMS_DATREG),A ; OUTPUT - TMS_IODELAY ; DELAY + ;TMS_IODELAY ; DELAY + CALL DLY64 ; DELAY CPL ; COMPLEMENT ACCUM OUT (TMS_DATREG),A ; SECOND BYTE - TMS_IODELAY ; DELAY + ;TMS_IODELAY ; DELAY + CALL DLY64 ; DELAY ; SET READ ADDRESS TO $0 LD HL,0 CALL TMS_RD ; READ TEST PATTERN LD C,$A5 ; VALUE TO EXPECT IN A,(TMS_DATREG) ; READ FIRST BYTE - TMS_IODELAY ; DELAY + ;CALL PRTHEXBYTE + ;TMS_IODELAY ; DELAY + CALL DLY64 ; DELAY CP C ; COMPARE RET NZ ; RETURN ON MISCOMPARE IN A,(TMS_DATREG) ; READ SECOND BYTE - TMS_IODELAY ; DELAY + ;CALL PRTHEXBYTE + ;TMS_IODELAY ; DELAY + CALL DLY64 ; DELAY CPL ; COMPLEMENT IT CP C ; COMPARE RET ; RETURN WITH RESULT IN Z @@ -374,14 +522,21 @@ TMS_CRTINIT1: ; ; INITIALIZE VDU REGISTERS LD C,0 ; START WITH REGISTER 0 - LD B,TMS_INIT9918LEN ; NUMBER OF REGISTERS TO INIT - LD HL,TMS_INIT9918 ; HL = POINTER TO THE DEFAULT VALUES + LD B,TMS_INITVDULEN ; NUMBER OF REGISTERS TO INIT + LD HL,TMS_INITVDU ; HL = POINTER TO THE DEFAULT VALUES TMS_CRTINIT2: LD A,(HL) ; GET VALUE CALL TMS_SET ; WRITE IT INC HL ; POINT TO NEXT VALUE INC C ; POINT TO NEXT REGISTER DJNZ TMS_CRTINIT2 ; LOOP +; + ; ENABLE WAIT SIGNAL IF 9938/58 +#IF ((TMSMODE == TMSMODE_MSX9958) | (TMSMODE == TMSMODE_MBC)) + LD C,25 ; REGISTER 25 + LD A,%00000100 ; ONLY WTE BIT SET + CALL TMS_SET ; DO IT +#ENDIF RET ; ;---------------------------------------------------------------------- @@ -389,15 +544,15 @@ TMS_CRTINIT2: ;---------------------------------------------------------------------- ; TMS_LOADFONT: - ; SET WRITE ADDRESS TO $800 - LD HL,$800 + ; SET WRITE ADDRESS TO TMS_FNTVADDR + LD HL,TMS_FNTVADDR CALL TMS_WR #IF USELZSA2 LD (TMS_STACK),SP ; SAVE STACK LD HL,(TMS_STACK) ; AND SHIFT IT LD DE,$2000 ; DOWN 4KB TO - CCF ; CREATE A + CCF ; CREATE A SBC HL,DE ; DECOMPRESSION BUFFER LD SP,HL ; HL POINTS TO BUFFER EX DE,HL ; START OF STACK BUFFER @@ -409,8 +564,8 @@ TMS_LOADFONT: LD HL,TMS_FONT ; START OF FONT DATA #ENDIF ; - ; FILL $800 BYTES FROM FONTDATA - LD DE,$800 + ; FILL TMS_FNTVADDR BYTES FROM FONTDATA + LD DE,TMS_FNTVADDR TMS_LOADFONT1: LD A,(HL) OUT (TMS_DATREG),A @@ -471,7 +626,7 @@ TMS_SETCUR0: ; MULT BY 8 FOR FONT INDEX SLA L ; SHIFT LSB INTO CARRY RL H ; SHFT MSB FROM CARRY DJNZ TMS_SETCUR0 ; LOOP 3 TIMES - LD DE,$800 ; OFFSET TO START OF FONT TABLE + LD DE,TMS_FNTVADDR ; OFFSET TO START OF FONT TABLE ADD HL,DE ; ADD TO FONT INDEX CALL TMS_RD ; SETUP TO READ GLYPH LD B,8 ; 8 BYTES @@ -484,7 +639,7 @@ TMS_SETCUR1: ; READ GLYPH LOOP DJNZ TMS_SETCUR1 ; LOOP FOR 8 BYTES ; ; NOW WRITE INVERTED GLYPH INTO FONT INDEX 255 - LD HL,$800 + (255 * 8) ; LOC OF GLPYPH DATA FOR CHAR 255 + LD HL,TMS_FNTVADDR + (255 * 8) ; LOC OF GLPYPH DATA FOR CHAR 255 CALL TMS_WR ; SETUP TO WRITE THE INVERTED GLYPH LD B,8 ; 8 BYTES PER GLYPH LD HL,TMS_BUF ; POINT TO BUFFER @@ -546,6 +701,7 @@ TMS_PUTCHAR: CALL TMS_WR ; SET THE WRITE ADDRESS POP AF ; RECOVER CHARACTER TO WRITE OUT (TMS_DATREG),A ; WRITE THE CHARACTER + TMS_IODELAY LD HL,(TMS_POS) ; LOAD CURRENT POSITION INTO HL INC HL LD (TMS_POS),HL @@ -596,7 +752,7 @@ TMS_SCROLL1: INC DE DJNZ TMS_SCROLL1 POP HL ; RECOVER THE DESTINATION -; +; ; WRITE THE BUFFERED LINE TO CURRENT DESTINATION CALL TMS_WR ; SET UP TO WRITE LD DE,TMS_BUF @@ -732,7 +888,7 @@ TMS_Z180IO: OUT0 (Z180_DCNTL),A ; IMPLEMENT IT POP AF ; RESTORE AF ; BACK TO CALLER -TMS_Z180IOR .EQU $+1 +TMS_Z180IOR .EQU $+1 JP $0000 ; BACK TO CALLER ; TMS_Z180IOX: @@ -744,6 +900,25 @@ TMS_Z180IOX: RET ; DONE ; #ENDIF + +#IF (INTMODE == 1 & TMSTIMENABLE) +TMS_TSTINT: + IN A, (TMS_CMDREG) ; TEST FOR INT FLAG + AND $80 + JR NZ, TMS_INTHNDL + AND $00 ; RETURN Z - NOT HANDLED + RET + +TMS_INTHNDL: + +;#IF MKYENABLE +; CALL MKY_INT +;#ENDIF + + CALL HB_TIMINT ; RETURN NZ - HANDLED + OR $FF + RET +#ENDIF ; ;================================================================================================== ; TMS DRIVER - DATA @@ -752,6 +927,29 @@ TMS_Z180IOX: TMS_POS .DW 0 ; CURRENT DISPLAY POSITION TMS_CURSAV .DB 0 ; SAVES ORIGINAL CHARACTER UNDER CURSOR TMS_BUF .FILL 256,0 ; COPY BUFFER + +; +;================================================================================================== +; TMS DRIVER - INSTANCE DATA +;================================================================================================== +; + +TMS_IDAT: +#IF ((TMSMODE == TMSMODE_MSX) | (TMSMODE == TMSMODE_MSX9958) | (TMSMODE == TMSMODE_N8) | (TMSMODE == TMSMODE_SCG)) + .DB TMS_PPIA ; PPI PORT A + .DB TMS_PPIB ; PPI PORT B + .DB TMS_PPIC ; PPI PORT C + .DB TMS_PPIX ; PPI CONTROL PORT +#ENDIF +#IF ((TMSMODE == TMSMODE_MSXKBD) | (TMSMODE == TMSMODE_MBC)) + .DB TMS_KBDST ; 8242 CMD/STATUS PORT + .DB TMS_KBDDATA ; 8242 DATA PORT + .DB 0 ; FILLER + .DB 0 ; FILER +#ENDIF +; + .DB TMS_DATREG + .DB TMS_CMDREG ; ;================================================================================================== ; TMS DRIVER - TMS9918 REGISTER INITIALIZATION @@ -795,28 +993,38 @@ TMS_BUF .FILL 256,0 ; COPY BUFFER ; 5S Fifth sprite (not displayed) detected. Value in FS* is valid. ; INT Set at each screen update, used for interrupts. ; -TMS_INIT9918: +#IF ((TMSMODE == TMSMODE_MSX9958) | (TMSMODE == TMSMODE_MBC)) +TMS_INITVDU: + .DB $04 ; REG 0 - NO EXTERNAL VID, SET M4 = 1 +TMS_INITVDU_REG_1: + .DB $50 ; REG 1 - ENABLE SCREEN, SET MODE 1 + .DB $03 ; REG 2 - PATTERN NAME TABLE := 0 + .DB $00 ; REG 3 - NO COLOR TABLE + .DB $02 ; REG 4 - SET PATTERN GENERATOR TABLE TO (TMS_FNTVADDR -> $1000) + .DB $00 ; REG 5 - SPRITE ATTRIBUTE IRRELEVANT + .DB $00 ; REG 6 - NO SPRITE GENERATOR TABLE + .DB $F0 ; REG 7 - WHITE ON BLACK + + .DB $88 ; REG 8 - COLOUR BUS INPUT, DRAM 64K + .DB $00 ; REG 9 + .DB $00 ; REG 10 - COLOUR TABLE A14-A16 (TMS_FNTVADDR - $1000) + +#ELSE ; TMS REGISTER SET +TMS_INITVDU: .DB $00 ; REG 0 - NO EXTERNAL VID +TMS_INITVDU_REG_1: .DB $50 ; REG 1 - ENABLE SCREEN, SET MODE 1 .DB $00 ; REG 2 - PATTERN NAME TABLE := 0 .DB $00 ; REG 3 - NO COLOR TABLE - .DB $01 ; REG 4 - SET PATTERN GENERATOR TABLE TO $800 + .DB $01 ; REG 4 - SET PATTERN GENERATOR TABLE TO (TMS_FNTVADDR -> $0800) .DB $00 ; REG 5 - SPRITE ATTRIBUTE IRRELEVANT .DB $00 ; REG 6 - NO SPRITE GENERATOR TABLE .DB $F0 ; REG 7 - WHITE ON BLACK +#ENDIF +; +TMS_INITVDULEN .EQU $ - TMS_INITVDU ; -TMS_INIT9918LEN .EQU $ - TMS_INIT9918 ; #IF (CPUFAM == CPU_Z180) TMS_DCNTL .DB $00 ; SAVE Z180 DCNTL AS NEEDED #ENDIF -; -;================================================================================================== -; TMS DRIVER - INSTANCE DATA -;================================================================================================== -; -TMS_IDAT: - .DB TMS_PPIA - .DB TMS_PPIB - .DB TMS_PPIC - .DB TMS_PPIX diff --git a/Source/HBIOS/tty.asm b/Source/HBIOS/tty.asm index 8571af88..65d09a49 100644 --- a/Source/HBIOS/tty.asm +++ b/Source/HBIOS/tty.asm @@ -73,8 +73,13 @@ TTY_FNTBL: ; ; TTY_IN: +#IF (VDAEMU_SERKBD != $FF) + LD C,VDAEMU_SERKBD + JP CIO_DISPATCH +#ELSE LD B,BF_VDAKRD ; SET FUNCTION TO KEYBOARD READ JP TTY_VDADISP ; CHAIN TO VDA DISPATCHER +#ENDIF ; ; ; @@ -86,8 +91,13 @@ TTY_OUT: ; ; TTY_IST: +#IF (VDAEMU_SERKBD != $FF) + LD C,VDAEMU_SERKBD + JP CIO_DISPATCH +#ELSE LD B,BF_VDAKST ; SET FUNCTION TO KEYBOARD STATUS JP TTY_VDADISP ; CHAIN TO VDA DISPATCHER +#ENDIF ; ; ; @@ -131,6 +141,8 @@ TTY_DEVICE: ; TTY_DOCHAR: LD A,E ; CHARACTER TO PROCESS + CP 7 ; BEL + JP Z,SND_BEEP CP 8 ; BACKSPACE JR Z,TTY_BS CP 12 ; FORMFEED diff --git a/Source/HBIOS/uart.asm b/Source/HBIOS/uart.asm index 220749d6..1aa6150a 100644 --- a/Source/HBIOS/uart.asm +++ b/Source/HBIOS/uart.asm @@ -20,6 +20,8 @@ ; UART_DEBUG .EQU FALSE ; +UART_BUFSZ .EQU 32 ; RECEIVE RING BUFFER SIZE +; UART_NONE .EQU 0 ; UNKNOWN OR NOT PRESENT UART_8250 .EQU 1 UART_16450 .EQU 2 @@ -43,9 +45,32 @@ UART_SCR .EQU 7 ; SCRATCH REGISTER (READ/WRITE) UART_DLL .EQU 0 ; DLAB=1: DIVISOR LATCH (LS) (READ/WRITE) UART_DLM .EQU 1 ; DLAB=1: DIVISOR LATCH (MS) (READ/WRITE) UART_EFR .EQU 2 ; LCR=$BF: ENHANCED FEATURE REG (READ/WRITE) -;; -;UART_FIFO .EQU 0 ; FIFO ENABLE BIT -;UART_AFC .EQU 1 ; AUTO FLOW CONTROL ENABLE BIT +; +; THESE BITS ARE SET IN THE UART TYPE BYTE TO FURTHER +; IDENTIFY THE FEATURES OF THE CHIP +; +UART_INTACT .EQU 7 ; INT RCV ACTIVE BIT +UART_FIFOACT .EQU 6 ; FIFO ACTIVE BIT +UART_AFCACT .EQU 5 ; AUTO FLOW CONTROL ACTIVE BIT +; +UARTSBASE .EQU $68 +UARTCBASE .EQU $80 +UARTMBASE .EQU $18 +UART4BASE .EQU $C0 +UARTRBASE .EQU $A0 +UARTDBASE .EQU $80 +; +#IF (UARTINTS) +; + #IF ((INTMODE == 2) | (INTMODE == 3)) +; +UART0_IVT .EQU IVT(INT_UART0) +UART1_IVT .EQU IVT(INT_UART1) +; + #ENDIF +; +#ENDIF + ; #DEFINE UART_INP(RID) CALL UART_INP_IMP \ .DB RID #DEFINE UART_OUTP(RID) CALL UART_OUTP_IMP \ .DB RID @@ -53,11 +78,13 @@ UART_EFR .EQU 2 ; LCR=$BF: ENHANCED FEATURE REG (READ/WRITE) ; ; UART_PREINIT: +#IF (UART4) ; ; INIT UART4 BOARD CONFIG REGISTER (NO HARM IF IT IS NOT THERE) ; LD A,$80 ; SELECT 7.3728MHZ OSC & LOCK CONFIG REGISTER - OUT ($CF),A ; DO IT + OUT (UART4BASE+$0F),A ; DO IT +#ENDIF ; ; SETUP THE DISPATCH TABLE ENTRIES ; @@ -80,7 +107,7 @@ UART_PREINIT0: POP DE ; GET ENTRY ADDRESS BACK, BUT PUT IN DE POP BC ; RESTORE LOOP CONTROL ; - LD A,(IY + 1) ; GET THE UART TYPE DETECTED + LD A,(IY+1) ; GET THE UART TYPE DETECTED OR A ; SET FLAGS JR Z,UART_PREINIT2 ; SKIP IT IF NOTHING FOUND ; @@ -92,6 +119,39 @@ UART_PREINIT0: UART_PREINIT2: INC C ; NEXT PHYSICAL UNIT DJNZ UART_PREINIT0 ; LOOP UNTIL DONE +; +#IF ((UARTINTS) & (INTMODE > 0)) + ; *** FIXME *** WE SHOULD CHECK TO SEE IF ANY UNITS ARE ACTUALLY + ; USING INT RCV. IF NOT, WE SHOULD NOT HOOK IM1!!! +; + ; SETUP INT VECTORS AS APPROPRIATE + LD A,(UART_DEV) ; GET DEVICE COUNT + OR A ; SET FLAGS + JR Z,UART_PREINIT3 ; IF ZERO, NO UART DEVICES, ABORT +; + #IF (INTMODE == 1) + ; ADD IM1 INT CALL LIST ENTRY + LD HL,UART_INT ; GET INT VECTOR + CALL HB_ADDIM1 ; ADD TO IM1 CALL LIST + #ENDIF +; + #IF ((INTMODE == 2) | (INTMODE == 3)) + ; SETUP IM2/3 VECTORS + #IF (UARTSBC) + LD HL,UART_INTSBC + LD (UART0_IVT),HL ; IVT INDEX + #ENDIF +; + #IF (UARTCAS) + LD HL,UART_INTCAS + LD (UART1_IVT),HL ; IVT INDEX + #ENDIF +; + #ENDIF +; +#ENDIF +; +UART_PREINIT3: XOR A ; SIGNAL SUCCESS RET ; AND RETURN ; @@ -100,19 +160,19 @@ UART_PREINIT2: UART_INITUNIT: ; DETECT THE UART TYPE CALL UART_DETECT ; DETERMINE UART TYPE - LD (IY + 1),A ; ALSO SAVE IN CONFIG TABLE + LD (IY+1),A ; AND SAVE IN CONFIG TABLE OR A ; SET FLAGS RET Z ; ABORT IF NOTHING THERE - +; ; UPDATE WORKING UART DEVICE NUM LD HL,UART_DEV ; POINT TO CURRENT UART DEVICE NUM LD A,(HL) ; PUT IN ACCUM INC (HL) ; INCREMENT IT (FOR NEXT LOOP) LD (IY),A ; UDPATE UNIT NUM - +; ; SET DEFAULT CONFIG LD DE,-1 ; LEAVE CONFIG ALONE - JP UART_INITDEV ; IMPLEMENT IT AND RETURN + JP UART_INITDEVX ; IMPLEMENT IT AND RETURN ; ; ; @@ -131,10 +191,10 @@ UART_INIT1: PUSH HL ; COPY CFG DATA PTR POP IY ; ... TO IY - LD A,(IY + 1) ; GET UART TYPE + LD A,(IY+1) ; GET UART TYPE OR A ; SET FLAGS CALL NZ,UART_PRTCFG ; PRINT IF NOT ZERO - + POP BC ; RESTORE LOOP CONTROL INC C ; NEXT UNIT DJNZ UART_INIT1 ; LOOP TILL DONE @@ -142,6 +202,140 @@ UART_INIT1: XOR A ; SIGNAL SUCCESS RET ; DONE ; +; RECEIVE INTERRUPT HANDLER +; +#IF ((UARTINTS) & (INTMODE > 0)) +; +; IM1 ENTRY POINT +; +; POLL ALL DEVICES THAT MIGHT ENABLE INTERRUPT DRIVEN +; RECEIVE. HANDLE FIRST INTERRUPT ENCOUNTERED (IF ANY). +; MOST BOARDS REQUIRE UARTS THAT WILL HAVE AFC. THE +; ONLY BOARDS THAT MAY NOT ARE THE SBC AND THE CAS. +; +; THIS COULD BE IMPROVED BY DYNAMICALLY SETTING UP THE +; POLLING CHAIN WHEN DEVICES ARE INITIALIZED SUCH THAT +; ONLY DEVICES ACTUALLY USING INTS ARE POLLED HERE. +; + #IF (INTMODE == 1) + +UART_INT: +; + #IF (UARTSBC) + LD IY,UART_CFG_SBC + CALL UART_INTRCV + RET NZ + #ENDIF +; + #IF (UARTCAS) + LD IY,UART_CFG_CAS + CALL UART_INTRCV + RET NZ + #ENDIF +; + #ENDIF +; + #IF ((INTMODE == 2) | (INTMODE == 3)) +; + #IF (UARTSBC) +UART_INTSBC: + LD IY,UART_CFG_SBC + JR UART_INTRCV + #ENDIF +; + #IF (UARTCAS) +UART_INTCAS: + LD IY,UART_CFG_CAS + JR UART_INTRCV + #ENDIF +; + #ENDIF +; + XOR A ; CLEAR ACCUM (INT NOT HANDLED) + RET ; DONE +; +; IM2 ENTRY POINTS +; + +; +; HANDLE INT FOR A SPECIFIC CHANNEL +; BASED ON UNIT CFG POINTED TO BY IY +; +UART_INTRCV: + ; ARE INTERRUPTS IN USE ON THIS DEVICE? + LD A,(IY+1) ; GET UART TYPE + AND %10000000 ; ISOLATE INT RCV BIT + RET Z ; INTS NOT SUPPORTED + ; CHECK TO SEE IF SOMETHING IS ACTUALLY THERE + LD C,(IY+3) ; STATUS PORT TO C + IN A,(C) ; GET LSR + AND $01 ; ISOLATE RECEIVE READY BIT + RET Z ; NOTHING AVAILABLE ON CURRENT CHANNEL +; +UART_INTRCV1: + ; RECEIVE CHARACTER INTO BUFFER + LD C,(IY+2) ; DATA PORT TO C + IN A,(C) ; READ PORT + LD B,A ; SAVE BYTE READ + LD L,(IY+6) ; SET HL TO + LD H,(IY+7) ; ... START OF BUFFER STRUCT + LD A,(HL) ; GET COUNT + CP UART_BUFSZ ; COMPARE TO BUFFER SIZE + JR Z,UART_INTRCV4 ; BAIL OUT IF BUFFER FULL, RCV BYTE DISCARDED + INC A ; INCREMENT THE COUNT + LD (HL),A ; AND SAVE IT + + + ; *** FIXME *** THE FOLLOWING SHOULD ONLY BE DONE IF RTS FLOW CONTROL IS ON!!! + ; SOMETHING LIKE THIS MAY WORK... + ;BIT 5,(IY+5) + ;JR Z,UART_INTRCV2 + + + CP UART_BUFSZ / 2 ; BUFFER GETTING FULL? + JR NZ,UART_INTRCV2 ; IF NOT, BYPASS CLEARING RTS + LD C,(IY+3) ; LSR PORT TO C + DEC C ; POINT TO MCR PORT + IN A,(C) ; GET MCR VALUE + AND ~%00000010 ; CLEAR RTS + OUT (C),A ; AND SAVE IT +; +UART_INTRCV2: + INC HL ; HL NOW HAS ADR OF HEAD PTR + PUSH HL ; SAVE ADR OF HEAD PTR + LD A,(HL) ; DEREFERENCE HL + INC HL + LD H,(HL) + LD L,A ; HL IS NOW ACTUAL HEAD PTR + LD (HL),B ; SAVE CHARACTER RECEIVED IN BUFFER AT HEAD + INC HL ; BUMP HEAD POINTER + POP DE ; RECOVER ADR OF HEAD PTR + LD A,L ; GET LOW BYTE OF HEAD PTR + SUB UART_BUFSZ+4 ; SUBTRACT SIZE OF BUFFER AND POINTER + CP E ; IF EQUAL TO START, HEAD PTR IS PAST BUF END + JR NZ,UART_INTRCV3 ; IF NOT, BYPASS + LD H,D ; SET HL TO + LD L,E ; ... HEAD PTR ADR + INC HL ; BUMP PAST HEAD PTR + INC HL + INC HL + INC HL ; ... SO HL NOW HAS ADR OF ACTUAL BUFFER START +UART_INTRCV3: + EX DE,HL ; DE := HEAD PTR VAL, HL := ADR OF HEAD PTR + LD (HL),E ; SAVE UPDATED HEAD PTR + INC HL + LD (HL),D + ; CHECK FOR MORE PENDING... + LD C,(IY+3) ; STATUS PORT TO C + IN A,(C) ; GET LSR + AND $01 ; ISOLATE RECEIVE READY BIT + JR NZ,UART_INTRCV1 ; IF SET, DO SOME MORE +UART_INTRCV4: + OR $FF ; NZ SET TO INDICATE INT HANDLED + RET +; +#ENDIF +; ; DRIVER FUNCTION TABLE ; UART_FNTBL: @@ -161,17 +355,81 @@ UART_FNTBL: UART_IN: CALL UART_IST ; RECEIVED CHAR READY? JR Z,UART_IN ; LOOP IF NOT - LD C,(IY + 2) ; C := BASE UART PORT (WHICH IS ALSO RBR REG) +#IF ((UARTINTS) & (INTMODE > 0)) + BIT UART_INTACT,(IY+1) ; INT RCV BIT + JR Z,UART_IN1 ; NORMAL INPUT IF NOT SET + JR UART_INTIN ; INT RCV INPUT +#ENDIF +; +UART_IN1: + LD C,(IY+2) ; C := BASE UART PORT (WHICH IS ALSO RBR REG) IN E,(C) ; CHAR READ TO E XOR A ; SIGNAL SUCCESS RET ; AND DONE ; +#IF ((UARTINTS) & (INTMODE > 0)) +; +UART_INTIN: + HB_DI ; AVOID COLLISION WITH INT HANDLER + LD L,(IY+6) ; SET HL TO + LD H,(IY+7) ; ... START OF BUFFER STRUCT + LD A,(HL) ; GET COUNT + DEC A ; DECREMENT COUNT + LD (HL),A ; SAVE UPDATED COUNT + + + ; *** FIXME *** THE FOLLOWING SHOULD ONLY BE DONE IF RTS FLOW CONTROL IS ON!!! + ; SOMETHING LIKE THIS MAY WORK... + ;BIT 5,(IY+5) + ;JR Z,UART_INTIN1 + + + CP UART_BUFSZ / 4 ; BUFFER LOW THRESHOLD + JR NZ,UART_INTIN1 ; IF NOT, BYPASS SETTING RTS + LD C,(IY+3) ; LSR PORT TO C + DEC C ; POINT TO MCR PORT + IN A,(C) ; GET MCR VALUE + OR %00000010 ; SET RTS + OUT (C),A ; AND SAVE IT +; +UART_INTIN1: + INC HL + INC HL + INC HL ; HL NOW HAS ADR OF TAIL PTR + PUSH HL ; SAVE ADR OF TAIL PTR + LD A,(HL) ; DEREFERENCE HL + INC HL + LD H,(HL) + LD L,A ; HL IS NOW ACTUAL TAIL PTR + LD C,(HL) ; C := CHAR TO BE RETURNED + INC HL ; BUMP TAIL PTR + POP DE ; RECOVER ADR OF TAIL PTR + LD A,L ; GET LOW BYTE OF TAIL PTR + SUB UART_BUFSZ+2 ; SUBTRACT SIZE OF BUFFER AND POINTER + CP E ; IF EQUAL TO START, TAIL PTR IS PAST BUF END + JR NZ,UART_INTIN2 ; IF NOT, BYPASS + LD H,D ; SET HL TO + LD L,E ; ... TAIL PTR ADR + INC HL ; BUMP PAST TAIL PTR + INC HL ; ... SO HL NOW HAS ADR OF ACTUAL BUFFER START +UART_INTIN2: + EX DE,HL ; DE := TAIL PTR VAL, HL := ADR OF TAIL PTR + LD (HL),E ; SAVE UPDATED TAIL PTR + INC HL + LD (HL),D + LD E,C ; MOVE CHAR TO RETURN TO E + HB_EI ; INTERRUPTS OK AGAIN + XOR A ; SIGNAL SUCCESS + RET ; AND DONE +; +#ENDIF +; ; ; UART_OUT: CALL UART_OST ; READY FOR CHAR? JR Z,UART_OUT ; LOOP IF NOT - LD C,(IY + 2) ; C := BASE UART PORT (WHICH IS ALSO THR REG) + LD C,(IY+2) ; C := BASE UART PORT (WHICH IS ALSO THR REG) OUT (C),E ; SEND CHAR FROM E XOR A ; SIGNAL SUCCESS RET @@ -179,7 +437,14 @@ UART_OUT: ; ; UART_IST: - LD C,(IY + 3) ; C := LINE STATUS REG (LSR) +#IF ((UARTINTS) & (INTMODE > 0)) + BIT UART_INTACT,(IY+1) ; INT RCV BIT + JR Z,UART_IST1 ; NORMAL INPUT IF NOT SET + JR UART_INTIST ; ELSE INT RCV +#ENDIF +; +UART_IST1: + LD C,(IY+3) ; C := LINE STATUS REG (LSR) IN A,(C) ; GET STATUS AND $01 ; ISOLATE BIT 0 (RECEIVE DATA READY) JP Z,CIO_IDLE ; NOT READY, RETURN VIA IDLE PROCESSING @@ -187,10 +452,22 @@ UART_IST: INC A ; ACCUM := 1 TO SIGNAL 1 CHAR WAITING RET ; DONE ; +#IF ((UARTINTS) & (INTMODE > 0)) +; +UART_INTIST: + LD L,(IY+6) ; GET ADDRESS + LD H,(IY+7) ; ... OF RECEIVE BUFFER + LD A,(HL) ; BUFFER UTILIZATION COUNT + OR A ; SET FLAGS + JP Z,CIO_IDLE ; NOT READY, RETURN VIA IDLE PROCESSING + RET +; +#ENDIF +; ; ; UART_OST: - LD C,(IY + 3) ; C := LINE STATUS REG (LSR) + LD C,(IY+3) ; C := LINE STATUS REG (LSR) IN A,(C) ; GET STATUS AND $20 ; ISOLATE BIT 5 () JP Z,CIO_IDLE ; NOT READY, RETURN VIA IDLE PROCESSING @@ -200,7 +477,18 @@ UART_OST: ; ; ; +; +; NOTE THAT THERE ARE TWO ENTRY POINTS. INITDEV WILL DISABLE/ENABLE INTS +; AND INITDEVX WILL NOT. THIS IS DONE SO THAT THE PREINIT ROUTINE ABOVE +; CAN AVOID ENABLING/DISABLING INTS. +; UART_INITDEV: + HB_DI ; DISABLE INTS + CALL UART_INITDEVX ; DO THE WORK + HB_EI ; INTS BACK ON + RET ; DONE +; +UART_INITDEVX: ; TEST FOR -1 WHICH MEANS USE CURRENT CONFIG (JUST REINIT) LD A,D ; TEST DE FOR AND E ; ... VALUE OF -1 @@ -208,8 +496,8 @@ UART_INITDEV: JR NZ,UART_INITDEV1 ; IF DE == -1, REINIT CURRENT CONFIG ; ; LOAD EXISTING CONFIG TO REINIT - LD E,(IY + 4) ; LOW BYTE - LD D,(IY + 5) ; HIGH BYTE + LD E,(IY+4) ; LOW BYTE + LD D,(IY+5) ; HIGH BYTE ; UART_INITDEV1: ; DETERMINE DIVISOR @@ -219,8 +507,8 @@ UART_INITDEV1: RET NZ ; ABORT IF COMPDIV FAILS! ; ; GOT A DIVISOR, COMMIT NEW CONFIG - LD (IY + 4),E ; SAVE LOW WORD - LD (IY + 5),D ; SAVE HI WORD + LD (IY+4),E ; SAVE LOW WORD + LD (IY+5),D ; SAVE HI WORD ; ; START OF ACTUAL UART CONFIGURATION LD A,80H ; DLAB IS BIT 7 OF LCR @@ -230,23 +518,74 @@ UART_INITDEV1: LD A,C UART_OUTP(UART_DLL) ; SET DIVISOR (LS) ; - ; SETUP FCR (DLAB MUST STILL BE ON FOR ACCESS TO BIT 5) - LD A,%00100111 ; FIFO ENABLE & RESET, 64 BYTE FIFO ENABLE ON 750+ + ; FOR 750+, WE ENABLE THE 64-BYTE FIFO + ; DLAB MUST STILL BE ON FOR ACCESS TO BIT 5 + ; WE DO *NOT* ENABLE ANY OTHER FCR BITS HERE + ; BECAUSE IT WILL SCREW UP THE 2552!!! + LD A,%00100000 UART_OUTP(UART_FCR) ; DO IT ; - ; SETUP LCR FROM SECOND CONFIG BYTE (DLAB IS CLEARED) - LD A,(IY + 4) ; GET CONFIG BYTE + XOR A ; DLAB OFF NOW + UART_OUTP(UART_LCR) ; DO IT +; + XOR A ; IER VALUE FOR NO INTS +; +#IF ((UARTINTS) & (INTMODE > 0)) +; + BIT UART_INTACT,(IY+1) ; CHECK INT RCV BIT + JR Z,UART_INITDEV1A ; SKIP IF NOT SET + INC A ; DATA RCVD INT BIT OF IER +; +UART_INITDEV1A: +; +#ENDIF +; + UART_OUTP(UART_IER) ; SETUP IER REGISTER +; + ; SETUP FCR, BIT 5 IS KEPT ON EVEN THOUGH IT IS PROBABLY + ; IRRELEVANT BECAUSE IT ONLY APPLIES TO 750 AND DLAB IS + ; NOW OFF, BUT DOESN'T HURT. + ; BITS 7-6 DEFINE THE FIFO RECEIVE INTERRUPT THRESHOLD. WE + ; USE A VALUE 0F %01 FOR THESE BITS WHICH REDUCES THE + ; FREQUENCY OF INTERRUPTS DURING HEAVY RECEIVE OPERATIONS. + LD A,%01100111 ; FIFO ENABLE & RESET + UART_OUTP(UART_FCR) ; DO IT +; + ; SETUP LCR FROM SECOND CONFIG BYTE + LD A,(IY+4) ; GET CONFIG BYTE AND ~$C0 ; ISOLATE PARITY, STOP/DATA BITS UART_OUTP(UART_LCR) ; SAVE IT ; ; SETUP MCR FROM FIRST CONFIG BYTE - LD A,(IY + 5) ; GET CONFIG BYTE + LD A,(IY+5) ; GET CONFIG BYTE AND ~$1F ; REMOVE ENCODED BAUD RATE BITS OR $03 ; FORCE RTS & DTR - UART_OUTP(UART_MCR) ; SAVE IT +; + ; SOME NEWER UARTS USE MCR:3 TO ACTIVATE THE INTERRUPT LINE. + ; ALTHOUGH OTHER UARTS USE MCR:3 TO CONTROL A GPIO LINE CALLED + ; OUT2, NO ROMWBW HARDWARE USES THIS GPIO LINE. SO, HERE, WE + ; JUST SET MCR:3 TO ACTIVATE THE INTERRUPT LINE. NOTE THAT + ; EVEN IF WE ARE NOT USING INTERRUPTS FOR THIS UART, THE + ; INTERRUPT LINE MUST STILL BE ACTIVATED SO THAT IT WILL + ; PRESENT A DEASSERTED CONDITION TO THE CPU. OTHERWISE, THE + ; INTERRUPT LINE MAY BE LEFT FLOATING WHICH IS DEFINITELY BAD. + OR $08 ; ACTIVATE INT LINE +; + ; THE MCR REGISTER AFE BIT WILL NORMALLY BE SET/RESET BY THE + ; VALUE OF THE CONFIG BYTE. HOWEVER, IF THE CHIP IS NOT AFC CAPABLE + ; WE ARE PROBABLY USING INT RCV FOR FLOW CONTROL. ALTHOUGH THE + ; CHIP PROBABLY IGNORES THE AFE BIT, WE FORCE CLEAR IT ANYWAY. IT WOULD + ; BE BAD IF AFC AND INT RCV ARE ACTIVE AT THE SAME TIME. + BIT UART_AFCACT,(IY+1) ; IS AFC SUPPOSED TO BE ON? + JR NZ,UART_INITDEV1B ; IF SO, AFE BIT IS OK BASED ON CONFIG BYTE + RES 5,A ; ELSE FORCE IT OFF +; +UART_INITDEV1B: + UART_OUTP(UART_MCR) ; SAVE MCR VALUE ; ; TEST FOR EFR CAPABLE CHIPS - LD A,(IY + 1) ; GET UART TYPE + LD A,(IY+1) ; GET UART TYPE + AND $0F ; ISOLATE LOW NIBBLE CP UART_16650 ; 16650? JR Z,UART_INITDEV2 ; USE EFR REGISTER CP UART_16850 ; 16850? @@ -255,11 +594,12 @@ UART_INITDEV1: ; UART_INITDEV2: ; WE HAVE AN EFR CAPABLE CHIP, SET EFR REGISTER + ; NOTE THAT AN EFR CAPABLE CHIP IMPLIES IT IS CAPABLE OF AFC! UART_INP(UART_LCR) ; GET CURRENT LCR VALUE PUSH AF ; SAVE IT LD A,$BF ; VALUE TO ACCESS EFR UART_OUTP(UART_LCR) ; SET VALUE IN LCR - LD A,(IY + 5) ; GET CONFIG BYTE + LD A,(IY+5) ; GET CONFIG BYTE BIT 5,A ; AFC REQUESTED? LD A,$C0 ; ASSUME AFC ON JR NZ,UART_INITDEV3 ; YES, IMPLEMENT IT @@ -271,11 +611,42 @@ UART_INITDEV3: UART_OUTP(UART_LCR) ; AND PUT IT BACK ; UART_INITDEV4: +; +#IF ((UARTINTS) & (INTMODE > 0)) +; + LD A,(IY+7) ; MSB OF BUFFER + OR A ; SET FLAGS + JR Z,UART_INITDEV5 ; BYPASS IF NO BUFFER + ; RESET THE RECEIVE BUFFER + LD E,(IY+6) + LD D,(IY+7) ; DE := _CNT + XOR A ; A := 0 + LD (DE),A ; _CNT = 0 + INC DE ; DE := ADR OF _HD + PUSH DE ; SAVE IT + INC DE + INC DE + INC DE + INC DE ; DE := ADR OF _BUF + POP HL ; HL := ADR OF _HD + LD (HL),E + INC HL + LD (HL),D ; _HD := _BUF + INC HL + LD (HL),E + INC HL + LD (HL),D ; _TL := _BUF +; +UART_INITDEV5: +; +#ENDIF +; +; #IF (UART_DEBUG) PRTS(" [$") ; DEBUG: DUMP UART TYPE - LD A,(IY + 1) + LD A,(IY+1) CALL PRTHEXBYTE ; DEBUG: DUMP IIR @@ -316,23 +687,61 @@ UART_INITDEV4: ; ; UART_QUERY: - LD E,(IY + 4) ; FIRST CONFIG BYTE TO E - LD D,(IY + 5) ; SECOND CONFIG BYTE TO D + LD E,(IY+4) ; FIRST CONFIG BYTE TO E + LD D,(IY+5) ; SECOND CONFIG BYTE TO D XOR A ; SIGNAL SUCCESS RET ; DONE ; ; ; UART_DEVICE: - LD D,CIODEV_UART ; D := DEVICE TYPE - LD E,(IY) ; E := PHYSICAL UNIT - LD C,$00 ; C := DEVICE TYPE, 0x00 IS RS-232 - XOR A ; SIGNAL SUCCESS + LD D,CIODEV_UART ; D := DEVICE TYPE + LD E,(IY) ; E := PHYSICAL UNIT + LD C,$00 ; C := DEVICE TYPE, 0x00 IS RS-232 + LD H,(IY+1) ; H := UART TYPE BYTE + LD L,(IY+2) ; L := BASE I/O ADDRESS + XOR A ; SIGNAL SUCCESS RET ; ; UART DETECTION ROUTINE ; UART_DETECT: + CALL UART_CHIP ; DETECT CHIP VARIANT + ;LD A,UART_16550A ; *DEBUG* + OR A + RET Z ; DONE IF NO CHIP + LD C,A ; PUT CHIP VARIANT IN C +; +#IF ((UARTINTS) & (INTMODE > 0)) +; + ; CHECK TO SEE IF INT RCV WANTED ON THIS DEVICE + PUSH AF ; SAVE CHIP ID + CP UART_16550C ; 16550C OR LATER? + JR NC,UART_DETECT1 ; NO INTS, USE AFC INSTEAD + LD A,(IY+7) ; MSB OF RING BUFFER + OR A ; SET FLAGS + JR Z,UART_DETECT1 ; NO BUFFER, NO INTS ALLOWED + SET UART_INTACT,C ; SET INT RCV BIT +; +UART_DETECT1: + POP AF ; RESTORE CHIP ID +; +#ENDIF +; + CP UART_16550 ; 16550 OR GREATER? + JR C,UART_DETECT2 ; NO MORE FEATURES + SET UART_FIFOACT,C ; RECORD FIFO FEATURE + CP UART_16550C ; 16550C OR GREATER? + JR C,UART_DETECT2 ; NO MORE FEATURES + SET UART_AFCACT,C ; RECORD AFC FEATURE +; +UART_DETECT2: + LD A,C ; RETURN RESULT IN A + RET +; +; DETERMINE TEH UART CHIP VARIANT AND RETURN IN A +; +UART_CHIP: ; ; SEE IF UART IS THERE BY CHECKING DLAB FUNCTIONALITY XOR A ; ZERO ACCUM @@ -343,29 +752,30 @@ UART_DETECT: UART_OUTP(UART_DLM) ; OUTPUT TO DLM UART_INP(UART_DLM) ; READ IT BACK CP $5A ; CHECK FOR TEST VALUE - JP NZ,UART_DETECT_NONE ; NOPE, UNKNOWN UART OR NOT PRESENT + JP NZ,UART_CHIP_NONE ; NOPE, UNKNOWN UART OR NOT PRESENT XOR A ; DLAB BIT OFF UART_OUTP(UART_LCR) ; OUTPUT TO LCR (DLAB REGS NOW INACTIVE) UART_INP(UART_IER) ; READ IER CP $5A ; CHECK FOR TEST VALUE - JP Z,UART_DETECT_NONE ; IF STILL $5A, UNKNOWN OR NOT PRESENT + JP Z,UART_CHIP_NONE ; IF STILL $5A, UNKNOWN OR NOT PRESENT ; ; TEST FOR FUNCTIONAL SCRATCH REG, IF NOT, WE HAVE AN 8250 LD A,$5A ; LOAD TEST VALUE UART_OUTP(UART_SCR) ; PUT IT IN SCRATCH REGISTER UART_INP(UART_SCR) ; READ IT BACK CP $5A ; CHECK IT - JR NZ,UART_DETECT_8250 ; STUPID 8250 + JR NZ,UART_CHIP_8250 ; STUPID 8250 ; ; TEST FOR EFR REGISTER WHICH IMPLIES 16650/850 LD A,$BF ; VALUE TO ENABLE EFR UART_OUTP(UART_LCR) ; WRITE IT TO LCR UART_INP(UART_SCR) ; READ SCRATCH REGISTER CP $5A ; SPR STILL THERE? - JR NZ,UART_DETECT1 ; NOPE, HIDDEN, MUST BE 16650/850 + JR NZ,UART_CHIP1 ; NOPE, HIDDEN, MUST BE 16650/850 ; - ; RESET LCR TO DEFAULT - LD A,$80 ; DLAB BIT ON + ; RESET LCR TO DEFAULT (DLAB OFF) + ;LD A,$80 ; DLAB BIT ON + XOR A ; DLAB BIT OFF UART_OUTP(UART_LCR) ; RESET LCR ; ; TEST FCR TO ISOLATE 16450/550/550A @@ -373,19 +783,21 @@ UART_DETECT: UART_OUTP(UART_FCR) ; PUT IT IN FCR UART_INP(UART_IIR) ; READ BACK FROM IIR BIT 6,A ; BIT 6 IS FIFO ENABLE, LO BIT - JR Z,UART_DETECT_16450 ; IF NOT SET, MUST BE 16450 + JR Z,UART_CHIP_16450 ; IF NOT SET, MUST BE 16450 BIT 7,A ; BIT 7 IS FIFO ENABLE, HI BIT - JR Z,UART_DETECT_16550 ; IF NOT SET, MUST BE 16550 + JR Z,UART_CHIP_16550 ; IF NOT SET, MUST BE 16550 BIT 5,A ; BIT 5 IS 64 BYTE FIFO - JR Z,UART_DETECT2 ; IF NOT SET, MUST BE 16550A/C - JR UART_DETECT_16750 ; ONLY THING LEFT IS 16750 + JR Z,UART_CHIP2 ; IF NOT SET, MUST BE 16550A/C + JR UART_CHIP_16750 ; ONLY THING LEFT IS 16750 ; -UART_DETECT1: ; PICK BETWEEN 16650/850 +UART_CHIP1: ; PICK BETWEEN 16650/850 + ; RESET LCR TO DEFAULT (DLAB OFF) + XOR A ; DLAB BIT OFF + UART_OUTP(UART_LCR) ; RESET LCR ; NOT SURE HOW TO DIFFERENTIATE 16650 FROM 16850 YET - JR UART_DETECT_16650 ; ASSUME 16650 - RET + JR UART_CHIP_16650 ; ASSUME 16650 ; -UART_DETECT2: ; PICK BETWEEN 16550A/C +UART_CHIP2: ; PICK BETWEEN 16550A/C ; SET AFC BIT IN FCR LD A,$20 ; SET AFC BIT, MCR:5 UART_OUTP(UART_MCR) ; WRITE NEW FCR VALUE @@ -393,45 +805,52 @@ UART_DETECT2: ; PICK BETWEEN 16550A/C ; READ IT BACK, IF SET, WE HAVE 16550C UART_INP(UART_MCR) ; READ BACK MCR BIT 5,A ; CHECK AFC BIT - JR Z,UART_DETECT_16550A ; NOT SET, SO 16550A - JR UART_DETECT_16550C ; IS SET, SO 16550C -; -UART_DETECT_NONE: - LD A,(IY + 2) ; BASE IO PORT - CP $68 ; IS THIS PRIMARY SBC PORT? - JR Z,UART_DETECT_8250 ; SPECIAL CASE FOR PRIMARY UART! - LD A,UART_NONE ; IF SO, TREAT AS 8250 NO MATTER WHAT + JR Z,UART_CHIP_16550A ; NOT SET, SO 16550A + JR UART_CHIP_16550C ; IS SET, SO 16550C +; +UART_CHIP_NONE: +; +#IF (UARTSBCFORCE) + ; SIMH DOES NOT EMULATE A UART WELL ENOUGH TO BE DETECTED, SO + ; THIS BIT OF CODE CAN BE ENABLED TO FORCE THE PRIMARY SBC + ; UART TO BE HANDLED AS AN 8250. + LD A,(IY+2) ; BASE IO PORT + CP UARTSBASE ; IS THIS PRIMARY SBC PORT? + JR Z,UART_CHIP_8250 ; SPECIAL CASE FOR PRIMARY UART! +#ENDIF +; + LD A,UART_NONE ; NO UART DETECTED AT THIS PORT RET ; -UART_DETECT_8250: +UART_CHIP_8250: LD A,UART_8250 RET ; -UART_DETECT_16450: +UART_CHIP_16450: LD A,UART_16450 RET ; -UART_DETECT_16550: +UART_CHIP_16550: LD A,UART_16550 RET ; -UART_DETECT_16550A: +UART_CHIP_16550A: LD A,UART_16550A RET ; -UART_DETECT_16550C: +UART_CHIP_16550C: LD A,UART_16550C RET ; -UART_DETECT_16650: +UART_CHIP_16650: LD A,UART_16650 RET ; -UART_DETECT_16750: +UART_CHIP_16750: LD A,UART_16750 RET ; -UART_DETECT_16850: +UART_CHIP_16850: LD A,UART_16850 RET ; @@ -468,12 +887,13 @@ UART_PRTCFG: LD A,(IY) ; DEVICE NUM CALL PRTDECB ; PRINT DEVICE NUM PRTS(": IO=0x$") ; FORMATTING - LD A,(IY + 2) ; GET BASE PORT + LD A,(IY+2) ; GET BASE PORT CALL PRTHEXBYTE ; PRINT BASE PORT ; PRINT THE UART TYPE CALL PC_SPACE ; FORMATTING - LD A,(IY + 1) ; GET UART TYPE BYTE + LD A,(IY+1) ; GET UART TYPE BYTE + AND $0F ; LOW BITS ONLY RLCA ; MAKE IT A WORD OFFSET LD HL,UART_TYPE_MAP ; POINT HL TO TYPE MAP TABLE CALL ADDHLA ; HL := ENTRY @@ -483,25 +903,31 @@ UART_PRTCFG: CALL WRITESTR ; PRINT IT ; ; ALL DONE IF NO UART WAS DETECTED - LD A,(IY + 1) ; GET UART TYPE BYTE + LD A,(IY+1) ; GET UART TYPE BYTE OR A ; SET FLAGS RET Z ; IF ZERO, NOT PRESENT ; PRTS(" MODE=$") ; FORMATTING - LD E,(IY + 4) ; LOAD CONFIG - LD D,(IY + 5) ; ... WORD TO DE + LD E,(IY+4) ; LOAD CONFIG + LD D,(IY+5) ; ... WORD TO DE CALL PS_PRTSC0 ; PRINT CONFIG ; -; ; PRINT FEATURES ENABLED -; LD A,(UART_FEAT) -; BIT UART_FIFO,A -; JR Z,UART_INITUNIT2 -; PRTS(" FIFO$") -;UART_INITUNIT2: -; BIT UART_AFC,A -; JR Z,UART_INITUNIT3 -; PRTS(" AFC$") -;UART_INITUNIT3: + ; PRINT FEATURES ENABLED + BIT UART_INTACT,(IY+1) ; GET INT RCV BIT + JR Z,UART_PRTCFG1 + PRTS(" INT$") +; +UART_PRTCFG1: + BIT UART_FIFOACT,(IY+1) ; GET FIFO BIT + JR Z,UART_PRTCFG2 + PRTS(" FIFO$") +; +UART_PRTCFG2: + BIT UART_AFCACT,(IY+1) ; GET AFC BIT + JR Z,UART_PRTCFG3 + PRTS(" AFC$") +; +UART_PRTCFG3: ; XOR A RET @@ -513,7 +939,7 @@ UART_PRTCFG: UART_INP_IMP: EX (SP),HL ; SWAP HL AND TOS PUSH BC ; PRESERVE BC - LD A,(IY + 2) ; GET UART IO BASE PORT + LD A,(IY+2) ; GET UART IO BASE PORT OR (HL) ; OR IN REGISTER ID BITS LD C,A ; C := PORT IN A,(C) ; READ PORT INTO A @@ -528,7 +954,7 @@ UART_OUTP_IMP: EX (SP),HL ; SWAP HL AND TOS PUSH BC ; PRESERVE BC LD B,A ; PUT VALUE TO WRITE IN B - LD A,(IY + 2) ; GET UART IO BASE PORT + LD A,(IY+2) ; GET UART IO BASE PORT OR (HL) ; OR IN REGISTER ID BITS LD C,A ; C := PORT OUT (C),B ; WRITE VALUE TO PORT @@ -570,61 +996,129 @@ UART_DEV .DB 0 ; DEVICE NUM USED DURING INIT ; UART_CFG: #IF (UARTSBC) +UART_CFG_SBC: ; SBC/ZETA ONBOARD SERIAL PORT .DB 0 ; DEVICE NUMBER (UPDATED DURING INIT) .DB 0 ; UART TYPE - .DB $68 ; IO PORT BASE (RBR, THR) - .DB $68 + UART_LSR ; LINE STATUS PORT (LSR) + .DB UARTSBASE ; IO PORT BASE (RBR, THR) + .DB UARTSBASE + UART_LSR ; LINE STATUS PORT (LSR) .DW UARTCFG ; LINE CONFIGURATION - .FILL 2,$FF ; FILLER + .DW UARTSBC_RCVBUF ; POINTER TO RCV BUFFER STRUCT #ENDIF #IF (UARTCAS) +UART_CFG_CAS: ; CASSETTE INTERFACE SERIAL PORT .DB 0 ; DEVICE NUMBER (UPDATED DURING INIT) .DB 0 ; UART TYPE - .DB $80 ; IO PORT BASE (RBR, THR) - .DB $80 + UART_LSR ; LINE STATUS PORT (LSR) + .DB UARTCBASE ; IO PORT BASE (RBR, THR) + .DB UARTCBASE + UART_LSR ; LINE STATUS PORT (LSR) .DW UARTCASSPD ; LINE CONFIGURATION - .FILL 2,$FF ; FILLER + .DW UARTCAS_RCVBUF ; POINTER TO RCV BUFFER STRUCT #ENDIF #IF (UARTMFP) +UART_CFG_MFP: ; MF/PIC SERIAL PORT .DB 0 ; DEVICE NUMBER (UPDATED DURING INIT) .DB 0 ; UART TYPE - .DB $48 ; IO PORT BASE (RBR, THR) - .DB $48 + UART_LSR ; LINE STATUS PORT (LSR) + .DB UARTMBASE ; IO PORT BASE (RBR, THR) + .DB UARTMBASE + UART_LSR ; LINE STATUS PORT (LSR) .DW UARTCFG ; LINE CONFIGURATION - .FILL 2,$FF ; FILLER + .DW 0 ; SHOULD NEVER NEED INT HANDLER #ENDIF #IF (UART4) ; 4UART SERIAL PORT A .DB 0 ; DEVICE NUMBER (UPDATED DURING INIT) .DB 0 ; UART TYPE - .DB $C0 ; IO PORT BASE (RBR, THR) - .DB $C0 + UART_LSR ; LINE STATUS PORT (LSR) + .DB UART4BASE+0 ; IO PORT BASE (RBR, THR) + .DB UART4BASE+0 + UART_LSR ; LINE STATUS PORT (LSR) .DW UARTCFG ; LINE CONFIGURATION - .FILL 2,$FF ; FILLER + .DW 0 ; SHOULD NEVER NEED INT HANDLER ; 4UART SERIAL PORT B .DB 0 ; DEVICE NUMBER (UPDATED DURING INIT) .DB 0 ; UART TYPE - .DB $C8 ; IO PORT BASE (RBR, THR) - .DB $C8 + UART_LSR ; LINE STATUS PORT (LSR) + .DB UART4BASE+8 ; IO PORT BASE (RBR, THR) + .DB UART4BASE+8 + UART_LSR ; LINE STATUS PORT (LSR) .DW UARTCFG ; LINE CONFIGURATION - .FILL 2,$FF ; FILLER + .DW 0 ; SHOULD NEVER NEED INT HANDLER ; 4UART SERIAL PORT C .DB 0 ; DEVICE NUMBER (UPDATED DURING INIT) .DB 0 ; UART TYPE - .DB $D0 ; IO PORT BASE (RBR, THR) - .DB $D0 + UART_LSR ; LINE STATUS PORT (LSR) + .DB UART4BASE+16 ; IO PORT BASE (RBR, THR) + .DB UART4BASE+16 + UART_LSR ; LINE STATUS PORT (LSR) .DW UARTCFG ; LINE CONFIGURATION - .FILL 2,$FF ; FILLER + .DW 0 ; SHOULD NEVER NEED INT HANDLER ; 4UART SERIAL PORT D .DB 0 ; DEVICE NUMBER (UPDATED DURING INIT) .DB 0 ; UART TYPE - .DB $D8 ; IO PORT BASE (RBR, THR) - .DB $D8 + UART_LSR ; LINE STATUS PORT (LSR) + .DB UART4BASE+24 ; IO PORT BASE (RBR, THR) + .DB UART4BASE+24 + UART_LSR ; LINE STATUS PORT (LSR) + .DW UARTCFG ; LINE CONFIGURATION + .DW 0 ; SHOULD NEVER NEED INT HANDLER +#ENDIF +#IF (UARTRC) + ; UARTRC SERIAL PORT A + .DB 0 ; DEVICE NUMBER (UPDATED DURING INIT) + .DB 0 ; UART TYPE + .DB UARTRBASE ; IO PORT BASE (RBR, THR) + .DB UARTRBASE + UART_LSR ; LINE STATUS PORT (LSR) + .DW UARTCFG ; LINE CONFIGURATION + .DW 0 ; SHOULD NEVER NEED INT HANDLER + ; UARTRC SERIAL PORT B + .DB 0 ; DEVICE NUMBER (UPDATED DURING INIT) + .DB 0 ; UART TYPE + .DB UARTRBASE+8 ; IO PORT BASE (RBR, THR) + .DB UARTRBASE+8 + UART_LSR ; LINE STATUS PORT (LSR) + .DW UARTCFG ; LINE CONFIGURATION + .DW 0 ; SHOULD NEVER NEED INT HANDLER +#ENDIF +#IF (UARTDUAL) + ; DUAL UART CHANNEL A + .DB 0 ; DEVICE NUMBER (UPDATED DURING INIT) + .DB 0 ; UART TYPE + .DB UARTDBASE ; IO PORT BASE (RBR, THR) + .DB UARTDBASE + UART_LSR ; LINE STATUS PORT (LSR) + .DW UARTCFG ; LINE CONFIGURATION + .DW 0 ; SHOULD NEVER NEED INT HANDLER + ; DUAL UART CHANNEL B + .DB 0 ; DEVICE NUMBER (UPDATED DURING INIT) + .DB 0 ; UART TYPE + .DB UARTDBASE+8 ; IO PORT BASE (RBR, THR) + .DB UARTDBASE+8 + UART_LSR ; LINE STATUS PORT (LSR) .DW UARTCFG ; LINE CONFIGURATION - .FILL 2,$FF ; FILLER + .DW 0 ; SHOULD NEVER NEED INT HANDLER #ENDIF ; UART_CNT .EQU ($ - UART_CFG) / 8 +; +#IF ((!UARTINTS) | (INTMODE == 0)) +; +UARTSBC_RCVBUF .EQU 0 +UARTCAS_RCVBUF .EQU 0 +; +#ELSE +; +; UART SBC RECEIVE BUFFER +; + #IF (UARTSBC) +; +UARTSBC_RCVBUF: +UARTSBC_CNT .DB 0 ; CHARACTERS IN RING BUFFER +UARTSBC_HD .DW UARTSBC_BUF ; BUFFER HEAD POINTER +UARTSBC_TL .DW UARTSBC_BUF ; BUFFER TAIL POINTER +UARTSBC_BUF .FILL UART_BUFSZ,0 ; RECEIVE RING BUFFER +; + #ENDIF +; +; UART CASSETTE RECEIVE BUFFER +; + #IF (UARTCAS) +; +UARTCAS_RCVBUF: +UARTCAS_CNT .DB 0 ; CHARACTERS IN RING BUFFER +UARTCAS_HD .DW UARTCAS_BUF ; BUFFER HEAD POINTER +UARTCAS_TL .DW UARTCAS_BUF ; BUFFER TAIL POINTER +UARTCAS_BUF .FILL UART_BUFSZ,0 ; RECEIVE RING BUFFER +; + #ENDIF +; +#ENDIF diff --git a/Source/HBIOS/uf.asm b/Source/HBIOS/uf.asm index efc3d9b3..049167c0 100644 --- a/Source/HBIOS/uf.asm +++ b/Source/HBIOS/uf.asm @@ -64,7 +64,7 @@ UF_INIT: OR A ; REQUIRES TERMINAL PROGRAM RET NZ ; TO HAVE INITIALIZED PORT CALL PRTSTRD ; ON PC SIDE. - .TEXT " No connection$" + .TEXT " NO CONNECTION$" RET ; ; INPUT A CHARACTER AND RETURN IT IN E @@ -90,13 +90,13 @@ UF_OUT: XOR A ; SIGNAL SUCCESS RET ; -; INPUT STATUS - CAN WE SEND A CHARACTER +; INPUT STATUS - CAN WE RECEIVE A CHARACTER ; UF_IST: IN A,(FIFO_STATUS) ; IS THE QUEUE EMPTY? - RLCA - CPL - AND 00000001B + RLCA ; SET BIT 1 : 0 = DATA AVAIL. 1 = NO DATA AVAIL + CPL ; INVERT BIT 1 : 1 = DATA AVAIL. 0 = NO DATA AVAIL + AND 00000001B ; SET BYTE PENDING, 0 OR 1 AND STATUS RET ; ; OUTPUT STATUS - CAN WE OUTPUT A CHARACTER @@ -137,6 +137,7 @@ UF_FLUSH: UFBUFEMPTY: LD (IY+0),E ; SAVE LOW WORD LD (IY+1),D ; SAVE HI WORD + XOR A RET ; NZ STATUS HERE INDICATES FAIL. ; ; USB-FIFO WILL APPEAR AS A SERIAL DEVICE AT DEFAULT SERIAL MODE @@ -154,6 +155,8 @@ UF_DEVICE: XOR A ; SIGNAL SUCCESS LD E,A ; E := PHYSICAL UNIT, ALWAYS 0 LD C,A ; C := DEVICE TYPE, 0x00 IS RS-232 + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,UFBASE ; L := BASE I/O ADDRESS RET ; ; USB-FIFO DETECTION ROUTINE diff --git a/Source/HBIOS/unlzsa2s.asm b/Source/HBIOS/unlzsa2s.asm index 5709fc07..26957db2 100644 --- a/Source/HBIOS/unlzsa2s.asm +++ b/Source/HBIOS/unlzsa2s.asm @@ -1,5 +1,5 @@ ; -; Size-optimized LZSA2 decompressor by spke & uniabis (139 bytes) +; Size-optimized LZSA2 decompressor by spke & uniabis (134 bytes) ; ; ver.00 by spke for LZSA 1.0.0 (02-09/06/2019, 145 bytes); ; ver.01 by spke for LZSA 1.0.5 (24/07/2019, added support for backward decompression); @@ -8,6 +8,9 @@ ; ver.04 by spke for LZSA 1.1.0 (26/09/2019, removed usage of IY, added full revision history) ; ver.05 by spke for LZSA 1.1.1 (11/10/2019, 139(-1) bytes, +0.1% speed) ; ver.051 by PSummers (14/1/2020), ROMWBW version. +; ver.06 by spke (11-12/04/2021, added some comments) +; ver.07 by spke (04-05/04/2022, 134(-5) bytes, +1% speed, using self-modifying code by default) +; ver.071 by PSummers (6/1/2023), ROMWBW version. ; ; The data must be compressed using the command line compressor by Emmanuel Marty ; The compression is done as follows: @@ -56,8 +59,8 @@ ; 3. This notice may not be removed or altered from any source distribution. ; -; DEFINE BACKWARD_DECOMPRESS ; uncomment for data compressed with option -b -; DEFINE HD64180 ; uncomment for systems using Hitachi HD64180 +; #DEFINE BACKWARD_DECOMPRESS ; uncomment for data compressed with option -b (+5 bytes, -3% speed) +; #DEFINE AVOID_SELFMODIFYING_CODE ; uncomment to disallow self-modifying code (-1 byte, -4% speed) #IFNDEF BACKWARD_DECOMPRESS @@ -65,102 +68,106 @@ #DEFCONT \ inc hl #DEFINE ADD_OFFSET \ - #DEFCONT \ ex de,hl \ add hl,de + #DEFCONT \ add hl,de #DEFINE BLOCKCOPY \ #DEFCONT \ ldir - #ELSE - #DEFINE NEXT_HL \ #DEFCONT \ dec hl #DEFINE ADD_OFFSET \ - #DEFCONT \ push hl \ or a \ sbc hl,de \ pop de + #DEFCONT \ ld a,e \ sub l \ ld l,a + #DEFCONT \ ld a,d \ sbc h \ ld h,a ; 6*4 = 24t / 6 bytes #DEFINE BLOCKCOPY \ #DEFCONT \ lddr - - #ENDIF - - #IFDEF HD64180 - - .ECHO "HD64180 " - - #DEFINE LD_IX_DE \ - #DEFCONT \ ld ixl,e \ ld ixh,d - - #DEFINE LD_DE_IX \ - #DEFCONT \ ld e,ixl \ ld d,ixh - - #ELSE - - .ECHO "Z80 " - - #DEFINE LD_IX_DE \ - #DEFCONT \ push de \ pop ix - - #DEFINE LD_DE_IX \ - #DEFCONT \ push ix \ pop de - #ENDIF DLZSA2: + ; in many places we assume that B = 0 + ; flag P in A' signals the need to re-load the nibble store xor a \ ld b,a \ ex af,af' \ jr ReadToken -CASE00x: call ReadNibble - ld e,a \ ld a,c - cp %00100000 \ rl e \ jr SaveOffset +CASE00x: ; token "00Z" stands for 5-bit offsets + ; (read a nibble for offset bits 1-4 and use the inverted bit Z + ; of the token as bit 0 of the offset; set bits 5-15 of the offset to 1) + push af + call skipLDCA \ ld c,a + pop af + cp %00100000 \ rl c \ jr SaveOffset -CASE0xx ld d,$FF \ cp %01000000 \ jr c,CASE00x +CASE0xx dec b \ cp %01000000 \ jr c,CASE00x -CASE01x: cp %01100000 \ rl d +CASE01x: ; token "01Z" stands for 9-bit offsets + ; (read a byte for offset bits 0-7 and use the inverted bit Z + ; for bit 8 of the offset; set bits 9-15 of the offset to 1) + cp %01100000 +doRLB rl b -OffsetReadE: ld e,(hl) \ NEXT_HL +OffsetReadC: ld c,(hl) \ NEXT_HL -SaveOffset: LD_IX_DE + #IFNDEF AVOID_SELFMODIFYING_CODE +SaveOffset: ld (PrevOffset),bc \ ld b,0 + #ELSE +SaveOffset: push bc \ pop ix \ ld b,0 + #ENDIF -MatchLen: and %00000111 \ add a,2 \ cp 9 \ call z,ExtendedCode +MatchLen: and %00000111 \ add a,2 \ cp 9 + call z,ExtendedCode -CopyMatch: ld c,a - ex (sp),hl ; BC = len, DE = -offset, HL = dest, SP -> [src] - ADD_OFFSET ; BC = len, DE = dest, HL = dest+(-offset), SP -> [src] - BLOCKCOPY ; BC = 0, DE = dest - pop hl ; HL = src +CopyMatch: ld c,a + push hl ; BC = len, DE = dest, HL = -offset, SP -> [src] + + #IFNDEF AVOID_SELFMODIFYING_CODE +PrevOffset .EQU $+1 \ ld hl,0 + #ELSE + push ix \ pop hl + #ENDIF + ADD_OFFSET + BLOCKCOPY ; BC = 0, DE = dest + pop hl ; HL = src ReadToken: ld a,(hl) \ NEXT_HL \ push af and %00011000 \ jr z,NoLiterals - rrca \ rrca \ rrca - call pe,ExtendedCode - - ld c,a - BLOCKCOPY + rrca \ rrca \ rrca + call pe,ExtendedCode -NoLiterals: pop af \ push de - or a \ jp p,CASE0xx + ld c,a + BLOCKCOPY -CASE1xx: cp %11000000 \ jr nc,CASE11x +NoLiterals: pop af \ or a \ jp p,CASE0xx -CASE10x: call ReadNibble - ld d,a \ ld a,c - cp %10100000 ;: rl d - dec d \ rl d \ .DB $CA ; jr OffsetReadE ; #CA is JP Z,.. to skip all commands in CASE110 before jr OffsetReadE +CASE1xx cp %11000000 \ jr c,CASE10x + ; token "111" stands for repeat offsets + ; (reuse the offset value of the previous match command) + cp %11100000 \ jr nc,MatchLen -CASE110: ld d,(hl) \ NEXT_HL \ jr OffsetReadE +CASE110: ; token "110" stands for 16-bit offset + ; (read a byte for offset bits 8-15, then another byte for offset bits 0-7) + ld b,(hl) \ NEXT_HL \ jr OffsetReadC -CASE11x: cp %11100000 \ jr c,CASE110 +CASE10x: ; token "10Z" stands for 13-bit offsets + ; (read a nibble for offset bits 9-12 and use the inverted bit Z + ; for bit 8 of the offset, then read a byte for offset bits 0-7. + ; set bits 13-15 of the offset to 1. substract 512 from the offset to get the final value) + call ReadNibble \ ld b,a + ld a,c \ cp %10100000 + dec b \ jr doRLB -CASE111: LD_DE_IX \ jr MatchLen ExtendedCode: call ReadNibble \ inc a \ jr z,ExtraByte sub $F0+1 \ add a,c \ ret ExtraByte ld a,15 \ add a,c \ add a,(hl) \ NEXT_HL \ ret nc ld a,(hl) \ NEXT_HL ld b,(hl) \ NEXT_HL \ ret nz - pop de \ pop de ; RET is not needed, because RET from ReadNibble is sufficient + pop bc ; RET is not needed, because RET from ReadNibble is sufficient -ReadNibble: ld c,a \ xor a \ ex af,af' \ ret m -UpdateNibble ld a,(hl) \ or $F0 \ ex af,af' + +ReadNibble: ld c,a +skipLDCA xor a \ ex af,af' \ ret m + ld a,(hl) \ or $F0 \ ex af,af' ld a,(hl) \ NEXT_HL \ or $0F rrca \ rrca \ rrca \ rrca \ ret + diff --git a/Source/HBIOS/updater.asm b/Source/HBIOS/updater.asm new file mode 100644 index 00000000..24cbb2ba --- /dev/null +++ b/Source/HBIOS/updater.asm @@ -0,0 +1,1521 @@ +;***************************************************************************** +; ROMWBW XMODEM FLASH UPDATER +; +; PROVIDES THE CAPABILITY TO UPDATE ROMWBW FROM THE SBC BOOT LOADER USING +; AN XMODEM FILE TRANSFER. +; +; THIS TOOL CAN BE LAUNCHED FROM THE ROMWBW BOOT LOADER USING OPTION 'X'. +; +; OPTION (C) AND (S) - CONSOLE AND SERIAL DEVICE +; +; BY DEFAULT THE UPDATER IS SET TO USE THE CURRENT CONSOLE DEVICE FOR +; DISPLAY OUTPUT AND FILES TRANSFER. IF YOU USE A DIFFERENT SERIAL DEVICE FOR +; THE FILE TRANSFER, PROGRESS INFORMATION WILL BE DISPLAYED. +; +; OPTION (>) AND (<) - SET AND REVERT BAUD RATE +; +; THE MAXIMUM TRANSFER RATE IS LOWER IN THE UPDATER UTILITY COMPARED TO +; THE STANDALONE XMODEM APPLICATION. THIS IS BECAUSE THE SENDER CAN OVERFLOW +; THE INPUT RECEIVE BUFFER WHILE THE PREVIOUSLY SENT DATA IS BEING WRITTEN +; TO THE FLASH DEVICE (THE FLASH SECTOR ALSO HAS TO BE ERASED BEFORE THIS WRITE). +; LOWERING THE BAUD RATE HELPS PREVENT THIS TRANSFER/WRITE FAILURE. +; (>) WILL CHANGE THE PLATFORM BOARD RATE TO THE RECOMMENDED BAUD RATE FOR +; THE PLATFORMS CURRENT SPEED. YOU MUST CHANGE THE SENDERS SPEED TO MATCH. +; (<) WILL REVERT THE PLATFORMS BAUD RATE TO ITS ORIGINAL SPEED. AGAIN YOU +; MUST CHANGE THE SENDERS SPEED TO MATCH +; +; OPTION (V) - WRITE VERIFY +; +; BY DEFAULT EACH FLASH SECTOR WILL BE VERIFIED AFTER BEING WRITTEN. SLIGHT +; PERFORMANCE IMPROVEMENTS CAN BE GAINED IF TURNED OFF AND COULD BE USED IF +; YOU ARE EXPERIENCING RELIABLE TRANSFERS AND FLASHING. +; +; OPTION (R) - REBOOT +; EXECUTE A COLD REBOOT. THIS SHOULD BE DONE AFTER A SUCCESSFUL UPDATE. IF +; YOU PERFORM A COLD REBOOT AFTER A FAILED UPDATE THEN IT IS LIKELY THAT +; YOUR SYSTEM WILL BE UNUSABLE AND REMOVING AND REPROGRAMMING THE FLASH +; WILL BE REQUIRED. +; +; OPTION (U) - BEGIN UPDATE +; WILL BEGIN THE UPDATE PROCESS. THE UPDATER WILL EXPECT TO START RECEIVING +; AN XMODEM FILE ON THE SERIAL DEVICE UNIT. +; +; XMODEM SENDS THE FILE IN PACKETS OF 128 BYTES. THE UPDATER WILL CACHE 32 +; PACKETS WHICH IS 1 FLASH SECTOR AND THEN WRITE THAT SECTOR TO THE +; FLASH DEVICE. +; +; IF USING SEPARATE CONSOLE, BANK AND SECTOR PROGRESS INFORMATION WILL SHOWN +; +; BANK 00 S00 S01 S02 S03 S04 S05 S06 S06 S07 +; BANK 01 S00 S01 S02 S03 S04 S05 S06 S06 S07 +; BANK 02 S00 S01 S02 S03 S04 S05 S06 S06 S07 etc +; +; THE XMODEM FILE TRANSFER PROTOCOL DOES NOT PROVIDE ANY FILENAME OR SIZE +; INFORMATION FOR THE TRANSFER SO THE UPDATER DOES NOT PERFORM ANY CHECKS +; ON THE FILE SUITABILITY. +; +; THE UPDATER EXPECTS THE FILE SIZE TO BE A MULTIPLE OF 4 KILOBYTES AND +; WILL WRITE ALL DATA RECEIVED TO THE FLASH DEVICE. A SYSTEM UPDATE +; FILE (128KB .IMG) OR COMPLETE ROM CAN BE RECEIVED AND WRITTEN (512KB OR +; 1024KB .ROM) +; +; IF THE UPDATE FAILS IT IS RECOMMENDED THAT YOU RETRY BEFORE REBOOTING OR +; EXITING TO THE SBC BOOT LOADER AS YOUR MACHINE MAY NOT BE BOOTABLE. +; +; OPTION (Q) - EXIT TO THE SBC BOOT LOADER. THE SBC IS RELOADED FROM ROM AND +; EXECUTED. AFTER A SUCCESSFUL UPDATE A REBOOT SHOULD BE PERFORMED. HOWEVER, +; IN THE CASE OF A FAILED UPDATE THIS OPTION COULD BE USED TO ATTEMPT TO +; LOAD CP/M AND PERFORM THE NORMAL XMODEM / FLASH PROCESS TO RECOVER. +; +; OPTION (D) - DUPLICATE FLASH #1 TO FLASH #2 WILL MAKE A COPY OF FLASH #1 +; ONTO FLASH #2. THE PURPOSE OF THIS IS TO ENABLE MAKING A BACKUP COPY OF +; THE CURRENT FLASH. +; +; OPTION (1) AND (2) - CALCULATE AND DISPLAY CRC32 OF 1ST OR 2ND 512K ROM. +; OPTION (3) - CALCULATE AND DISPLAY CRC32 OF A 1024K ROM. +; +; OPTION (H) - DEBUG OPTION - SWITCH ON CPU CLOCK DIVIDER ON +; OPTION (T) - DEBUG OPTION - TEST TIMER FOR 32S, 16S, 8S, 4S, 2S & 1S +; +; V.1 5/1/2023 PHIL SUMMERS, DIFFICULTYLEVELHIGH@GMAIL.COM +; b1ackmai1er ON RETROBREWCOMPUTERS.ORG +; +; +; NOTES: +; TESTED WITH TERATERM XMODEM. +; PARTIAL WRITES CAN BE COMPLETED WITH 39SF040 CHIPS. +; OTHER CHIPS REQUIRE ENTIRE FLASH TO BE ERASED BEFORE BEFORE BEING WRITTEN. +; SBC V2-005 MEGAFLASH REQUIRED FOR 1MB FLASH SUPPORT. +; ASSUMES BOTH CHIPS ARE SAME TYPE +; FAILURE HANDLING HAS NOT BEEN TESTED. +; TIMING BROADLY CALIBRATED ON A Z80 SBC-V2 +; UNABIOS NOT SUPPORTED +; +; TERATERM: +; +; MACROS CAN BE USED TO AUTOMATE SENDING ROM UPDATES OR ROMS IMAGES. +; TRANSMISSION STARTUP IS MORE RELIABLE WHEN THE CHECKSUM OPTION (1) IS SPECIFIED +; +; EXAMPLE MACRO FILE TO SEND *.UPD FILE, SELECT CHECKSUM MODE AND DISPLAY CRC32 +; +; ;XMODEM send, checksum, display CRC32 +; xmodemsend '\\DESKTOP-FI43VI2\Users\Phillip\Documents\GitHub\RomWBW\Binary\SBC_std_cust.upd' 1 +; crc32file crc '\\DESKTOP-FI43VI2\Users\Phillip\Documents\GitHub\RomWBW\Binary\SBC_std_cust.rom' +; sprintf '0x%08X' crc +; messagebox inputstr 'CRC32' +; +; MAXIMUM SERIAL SPEED LIMITATIONS: +; +; SBC-V2 UART NO FLOW CONTROL 2MHZ | 9600 +; SBC-V2 UART NO FLOW CONTROL 4MHZ | 19200 +; SBC-V2 UART NO FLOW CONTROL 5MHZ | 19200 +; SBC-V2 UART NO FLOW CONTROL 8MHZ | 38400 +; SBC-V2 UART NO FLOW CONTROL 10MHZ | 38400 +; SBC-V2 USB-FIFO 2MHZ+ | N/A +; SBC-MK4 ASCI NO FLOW CONTROL 18.432MHZ | 9600 +; SBC-MK4 ASCI WITH FLOW CONTROL 18.432MHZ | 38400 +; +; ACKNOWLEDGEMENTS: +; +; XR - Xmodem Receive for Z80 CP/M 2.2 using CON: +; Copyright 2017 Mats Engstrom, SmallRoomLabs +; Licensed under the MIT license +; https://github.com/SmallRoomLabs/xmodem80/blob/master/XR.Z80 +; +; md.asm - ROMWBW memory disk driver +; https://github.com/wwarthen/RomWBW/blob/master/Source/HBIOS/md.asm +; +; CRC32 - J.G. HARSTON - mdfs.net/Info/Comp/Comms/CRC32.htm +; +;***************************************************************************** +; +#INCLUDE "std.asm" +; +HBX_BNKSEL .EQU $FE2B +; +#DEFINE HB_DI DI +#DEFINE HB_EI EI +; +XFUDBG .EQU 0 ; Enabling will cause a build failure + ; Insufficient space for debug features +; + .ORG UPD_LOC +; +; ASCII codes +; +LF: .EQU 'J'-40h ; ^J LF +CR: .EQU 'M'-40h ; ^M CR/ENTER +SOH: .EQU 'A'-40h ; ^A CTRL-A +EOT: .EQU 'D'-40h ; ^D = End of Transmission +ACK: .EQU 'F'-40h ; ^F = Positive Acknowledgement +NAK: .EQU 'U'-40h ; ^U = Negative Acknowledgement +CAN: .EQU 'X'-40h ; ^X = Cancel +BSPC: .EQU 'H'-40h ; ^H = Backspace +; +; Start of code +; + LD (oldSP),SP ; SETUP STACK BELOW HBIOS + LD SP,HBX_LOC-MD_CSIZ ; ALLOW FOR RELOCATABLE CODE AREA +; + LD HL,MD_FSTART ; COPY FLASH + LD DE,HBX_LOC-MD_CSIZ ; ROUTINES TO + LD BC,MD_CSIZ ; HIGH MEMORY + LDIR +; + LD BC,$F8F2 ; LOOKUP + RST 08 ; CURRENT + LD B,$FA ; CONSOLE + LD HL,$112 ; DEVICE + RST 08 ; TO USE AS + LD A,E ; DEFAULT + LD (CONDEV),A +; + LD BC,$F8F2 ; LOOKUP + RST 08 ; CURRENT + LD B,$FA ; SERIAL + LD HL,$110 ; DEVICE + RST 08 ; TO USE AS + LD A,E ; DEFAULT + LD (SERDEV),A + + CALL GETDINFO ; SAVE INITIAL + LD (ORISPD),A ; SERIAL SPEED +; + LD HL,msgHeader ; PRINT + CALL PRTSTR0 ; GREETING +; +RESTART: + LD DE,$0000 ; SET UP START + LD (MD_FBAS),DE ; BANK AND SECTOR +; + LD HL,MD_FIDEN ; IDENTIFY CHIP + CALL MD_FNCALL ; AT THIS BANK/SECTOR +; + LD A,0-1 ; SEARCH DEVICE + LD HL,DEVICES ; TABLE FOR +NXTDEV: LD D,(HL) ; VALID DEVICE + INC HL ; + LD E,(HL) + INC HL + INC A + CP +((LSTDEV-DEVICES)/2) + JP Z,FAILBC ; SUPPORTED CHIP NOT FOUND + OR A + EX DE,HL + SBC HL,BC + EX DE,HL + JR NZ,NXTDEV +; +CHPFND: LD (ERATYP),A ; SAVE ERASE TYPE +; + LD BC,$F8F0 ; GET CPU SPEED + RST 08 ; AND MULTIPLY + LD A,L ; BY 4 + PUSH AF + ADD A,A ; TO CREATE + ADD A,A ; TIMEOUT DELAY + LD (TmoFct),A ; FACTOR + POP AF +; + LD HL,CLKTBL-1 ; DETERMINE + ADD A,L ; RECOMMENDED + LD L,A ; SPEED BASED + ADC A,H ; ON CPU CLOCK + SUB L + LD H,A ; LOOK IT + LD A,(HL) ; UP IN THE + LD (RECSPD),A ; CLOCK TABLE +; +MENULP: LD DE,$0000 ; ENSURE WE ARE STARTING + LD (MD_FBAS),DE ; AT BANK 0 SECTOR 0 + + LD HL,ERATYP ; RESET THE ERASE + RES 7,(HL) ; SKIP FLAG +; + CALL MENU ; DISPLAY MENU + CALL GETINP ; GET SELECTION +; + CP '>' ; CHANGE TO + JP Z,OPTIONG ; RECOMMENDED BAUD RATE +; + CP '<' ; REVERT TO + JP Z,OPTIONL ; ORIGINAL BAUD RATE +; + CP 'U' ; BEGIN + JR Z,BEGUPD ; TRANSFER +; + CP 'V' ; CHECK FOR + JP Z,OPTIONV ; VERIFY TOGGLE +; + CP 'Q' ; CHECK FOR + JP Z,FAILUX ; USER EXIT +; + CP 'R' ; CHECK FOR + JP Z,REBOOT ; COLD REBOOT REQUEST +; + CP 'C' ; CHECK FOR + JP Z,OPTIONC ; CONSOLE CHANGE +; + CP 'S' ; CHECK FOR + JP Z,OPTIONS ; SERIAL CHANGE +; + CP 'D' ; DUPLICATE + JP Z,OPTIOND ; FLASH +; + CP '1' ; CALCULATE + JP Z,OPTION1 ; CRC FLASH #1 +; + CP '2' ; CALCULATE + JP Z,OPTION2 ; CRC FLASH #2 +; + CP '3' ; CALCULATE + JP Z,OPTION3 ; CRC 1024K FLASH +; +#IF (XFUDBG) + CP 'T' ; TEST TIMEOUT + JP Z,OPTIONT ; LOOP +; + CP 'H' ; HALF + JP Z,OPTIONH ; SPEED SWITCH +; + CP 'F' ; DEBUG + JP Z,OPTIONF ; DUMP +; + CP 'E' ; ERASE + JP Z,OPTIONE ; CHIP #1 +; + CP 'Z' ; ERASE + JP Z,OPTIONR ; CHIP #2 +#ENDIF +; + JR MENULP +; +BEGUPD: CALL SERST ; EMPTY SERIAL BUFFER + OR A ; SO WE HAVE A CLEAN + JR Z,SERCLR ; START ON TRANSFER + CALL SERIN + JR BEGUPD +; +SERCLR: LD HL,msgInstr ; PROVIDE + CALL PRTSTR0 ; INSTRUCTION +; + LD A,(SERDEV) ; IF CONSOLE AND SERIAL + LD HL,CONDEV ; DEVICE ARE THE SAME, + SUB (HL) ; BLOCK ALL TEXT + LD (BLKCOUT),A ; OUTPUT DURING TRANSFER +; + LD A,1 ; THE FIRST PACKET IS NUMBER 1 + LD (pktNo),A + LD A,255-1 ; ALSO STORE THE 1-COMPLEMENT OF IT + LD (pktNo1c),A +; + LD DE,sector4k ; POINT TO START OF SECTOR TO WRITE +; +GetNewPacket: + LD HL,retrycnt ; WE RETRY 20 TIMES BEFORE GIVING UP + LD (HL),20 +; +NPloop: LD B,6 ; 6 SECONDS OF TIMEOUT BEFORE EACH NEW BLOCK + CALL GetCharTmo + JP NC,NotPacketTimeout +; + DEC (HL) ; REACHED MAX NUMBER OF RETRIES? + JP Z,FAILRT ; YES, PRINT MESSAGE AND EXIT +; + LD C,NAK ; SEND A NAK TO THE UPLOADER + CALL SEROUT + JR NPloop +; +NotPacketTimeout: + CP EOT ; DID UPLOADER SAY WE'RE FINISHED? + JP Z,Done ; YES, THEN WE'RE DONE + CP CAN ; UPLOADER WANTS TO FAIL TRANSFER? + JP Z,FAILCN ; YES, THEN WE'RE ALSO DONE + CP SOH ; DID WE GET A START-OF-NEW-PACKET? + JR NZ,NPloop ; NO, GO BACK AND TRY AGAIN +; +#IF (XFUDBG) + LD HL,packet ; SAVE THE RECEIVED CHAR INTO THE... + LD (HL),A ; ...PACKET BUFFER AND... + INC HL ; ...POINT TO THE NEXT LOCATION +#ELSE + LD HL,packet+1 ; SKIP SAVING +#ENDIF +; + CALL GetCharTmo1 ; GET CHARACTER + LD (HL),A ; SHOULD BE PACKET NUMBER + INC HL + JR C,FAILTO +; + CALL GetCharTmo1 ; GET CHARACTER + LD (HL),A ; SHOULD BE PACKET NUMBER + INC HL ; COMPLEMENT + JR C,FAILTO +; + LD C,0 ; GET 128 MORE CHARACTERS FOR A FULL PACKET +GetRestOfPacket: ; C=0=256 TO ALLOW FOR DOUBLE DECREMENT + CALL GetCharTmo1 ; GET CHARACTER + JR C,FAILTO +; + LD (HL),A ; SAVE THE RECEIVED CHAR INTO THE + LDI ; PACKET BUFFER AND FLASH SECTOR BUFFER +; + DEC C ; C GETS DECREMENTED TWICE EACH LOOP. +; + JP NZ,GetRestOfPacket +; + CALL GetCharTmo1 ; GET CHARACTER + LD (HL),A ; SHOULD BE CHECKSUM + JR C,FAILTO +; + LD HL,packet+3 ; CALCULATE CHECKSUM FROM 128 BYTES OF DATA + LD B,128 + XOR A +csloop: ADD A,(HL) ; JUST ADD UP THE BYTES + INC HL + DJNZ csloop +; + XOR (HL) ; HL POINTS TO THE RECEIVED CHECKSUM SO + JR NZ,FAILCS ; BY XORING IT TO OUR SUM WE CHECK FOR EQUALITY +; + LD HL,(pktNo) ; CHECK + LD BC,(packet+1) ; AGREEMENT +; XOR A ; PACKET + SBC HL,BC ; NUMBERS + JR NZ,FAILPN +; + LD A,C ; HAVE WE RECEIVED A BLOCK OF 32 + DEC A ; XMODEM PACKETS? + AND %00011111 ; IF YES THEN WERE WE + CP %00011111 ; HAVE ENOUGH TO + LD A,H ; WRITE A FLASH SECTOR + CALL Z,WSEC ; ASSUME FLASH SUCCESSFUL + OR A ; EXIT IF WE GOT A + JR NZ,FAILWF ; WRITE VERIFICATION ERROR +; + LD HL,pktNo ; UPDATE THE PACKET COUNTERS + INC (HL) + INC HL + DEC (HL) +; + LD C,ACK ; TELL UPLOADER THAT WE'RE HAPPY WITH WITH + CALL SEROUT ; PACKET AND GO BACK AND FETCH SOME MORE +; + JP GetNewPacket +; +FAILTO: LD HL,msgTimout ; TIMEOUT WAITING + JR ERRRX ; FOR CHARACTER +; +COUTON: LD A,$FF ; TURN ON + LD (BLKCOUT),A ; OUTPUT + RET +; +Done: LD C,ACK ; TELL UPLOADER + CALL SEROUT ; WE'RE DONE +Done1: LD HL,msgSuccess ; BACK TO + JR MSGRS ; MENU +; +FAILWF: LD HL,msgFailWrt ; FLASH + JR MSGRS ; VERIFY FAIL +; +FAILRT: LD HL,msgRetry ; RETRY + JR ERRRX ; TIMEOUT FAIL +; +FAILCS: LD HL,msgChkSum ; CHECKSUM + JR ERRRX ; ERROR +; +FAILPN: LD HL,msgPacErr ; PACKET + JR ERRRX ; NUMBER ERROR +; +FAILCN: LD HL,msgCancel ; TRANSMISSION + JR ERRRX ; FAILURE +; +FAILUX: LD HL,msgUserEx ; USER + JR Die ; EXIT +; +FAILBC: LD HL,msgUnsupC ; UNSUPPORTED + JR Die ; FLASH CHIP +; +ERRRX: CALL COUTON ; TURN ON OUTPUT + CALL PRTSTR0 ; DISPLAY TRANSMISSION + LD HL,msgFailure ; RECEIPT ERROR + CALL PRTSTR0 + JP RESTART +; +MSGRS: CALL COUTON ; TURN ON OUTPUT + CALL PRTSTR0 ; DISPLAY + JP RESTART ; MESSAGE +; +REBOOT: LD HL,msgReboot ; REBOOT MESSAGE + CALL PRTSTR0 + LD C,BF_SYSRES_COLD ; COLD RESTART + JR Die1 +; +Die: CALL COUTON ; TURN ON OUTPUT + CALL PRTSTR0 ; Prints message and exits from program + LD C,BF_SYSRES_WARM ; WARM START +Die1: LD B,BF_SYSRESET ; SYSTEM RESTART + LD SP,(oldSP) + CALL $FFF0 ; CALL HBIOS + RET + +WSEC: CALL DISPROG ; DISPLAY PROGRESS +; +WSEC1: LD A,(ERATYP) ; SECTOR + OR A ; ERASE? + JP Z,WSEC4 +; + JP M,WSEC3 ; SKIP ERASE? +; + LD HL,MD_FERAC ; SETUP CHIP ERASE + SET 7,A ; SET FLAG SO + LD (ERATYP),A ; WE DONT ERASE AGAIN + JR WSEC2 +; +WSEC4: LD HL,MD_FERAS ; SET ERASE SECTOR +WSEC2: CALL MD_FNCALL ; ERASE CHIP OR SECTOR +; +WSEC3: LD IX,sector4k ; WRITE THIS + LD HL,MD_FWRIT ; BANK / SECTOR + CALL MD_FNCALL +; + LD A,(WRTVER) ; VERIFY + OR A ; WRITE IF + JR Z,NOVER ; OPTION SET +; + LD IX,sector4k ; VERIFY + LD HL,MD_FVERI ; WRITE + CALL MD_FNCALL + LD (VERRES),A ; SAVE STATUS +; +NOVER: LD DE,sector4k ; POINT BACK TO START OF 4K BUFFER +; + LD HL,MD_FBAS + LD A,(HL) ; DID WE JUST + SUB $70 ; DO LAST + JR NZ,NXTS2 ; SECTOR +; + LD (HL),A ; RESET SECTOR TO 0 + INC HL + INC (HL) ; NEXT BANK +; + CP $10 ; IF WE ARE AT THE + JR NZ,NXTS3 ; START OF A NEW + LD HL,ERATYP ; CHIP THEN ALLOW + RES 7,(HL) ; CHIP ERASE BY + JR NXTS3 ; RESETTING FLAG +; +NXTS2: LD A,$10 ; NEXT SECTOR + ADD A,(HL) ; EACH SECTOR IS $1000 + LD (HL),A ; SO WE JUST INCREASE HIGH BYTE +; +NXTS3: LD A,(VERRES) ; EXIT WITH STATUS + RET +; +DISPROG:LD A,(BLKCOUT) ; SKIP OUTPUT + OR A ; IF OUTPUT + RET Z ; BLOCKED +; + LD A,(MD_SECT) ; IF SECTOR IS 0 + OR A ; THEN DISPLAY + JR NZ,DISP1 ; BANK # PREFIX + LD HL,msgBank + CALL PRTSTR0 + LD A,(MD_BANK) + CALL PRTHEXB +; +DISP1: LD C,' ' ; DISPLAY + CALL CONOUT ; CURRENT + LD C,'S' ; SECTOR + CALL CONOUT + LD A,(MD_SECT) + RRCA + RRCA + RRCA + RRCA + CALL PRTHEXB + RET +; +; WAITS FOR UP TO B SECONDS FOR A CHARACTER TO BECOME AVAILABLE AND +; RETURNS IT IN A WITHOUT ECHO AND CARRY CLEAR. IF TIMEOUT THEN CARRY +; IT SET. +; +; 4MHZ 20 SECONDS TmoFct = 16 +; 10MHZ 20 SECONDS TmoFct = 39 +; +GetCharTmo1: + LD B,1 ; WAIT 1 SECOND FOR SERIAL INPUT +GetCharTmo: + CALL SERST ; IF THERE IS A + OR A ; CHARACTER AVAILABLE + JR NZ,GotChrX ; EXIT NOW OTHERWISE POLL +GCtmoa: PUSH BC + LD BC,255 ; C=CONSTANT (255) FOR INNER TIMING LOOP +TmoFct: .EQU $-1 ; B=SPEED FACTOR WHICH GETS UPDATED AT START +GCtmob: PUSH BC + LD B,C +GCtmoc: PUSH BC + CALL SERST + OR A ; A CHAR AVAILABLE? + JR NZ,GotChar ; YES, GET OUT OF LOOP + POP BC + DJNZ GCtmoc + POP BC + DJNZ GCtmob + POP BC + DJNZ GetCharTmo + SCF ; SET CARRY SIGNALS TIMEOUT + RET +; +GotChar:POP BC + POP BC + POP BC +GotChrX:CALL SERIN + OR A ; CLEAR CARRY SIGNALS SUCCESS + RET +; +GETINP: CALL CONIN ; GET A CHARACTER + LD C,A ; RETURN SEQUENCE + CALL CONOUT ; CONVERT TO UPPERCASE + LD C,BSPC ; RETURN CHARACTER IN A + CALL CONOUT + LD B,A + CP BSPC + JR Z,GETINP +GETINP2:CALL CONIN + CP BSPC + JR Z,GETINP + CP CR + JR NZ,GETINP2 + LD A,B + LD C,A + CALL CONOUT + CP 'a' ; BELOW 'A'? + JR C,GETINP3 ; IF SO, NOTHING TO DO + CP 'z'+1 ; ABOVE 'Z'? + JR NC,GETINP3 ; IF SO, NOTHING TO DO + AND ~$20 ; CONVERT CHARACTER TO LOWER +GETINP3:RET +; +MENU: CALL COUTON + LD HL,msgConsole ; DISPLAY + CALL PRTSTR0 ; CONSOLE + LD A,(CONDEV) ; DEVICE + PUSH AF + ADD A,'0' + LD C,A + CALL CONOUT + LD C,' ' + CALL CONOUT + POP AF + CALL DISPBAUD +; + LD HL,msgIODevice ; DISPLAY + CALL PRTSTR0 ; SERIAL + LD A,(SERDEV) ; DEVICE + PUSH AF + ADD A,'0' + LD C,A + CALL CONOUT + LD C,' ' + CALL CONOUT + POP AF + CALL DISPBAUD +; + LD HL,msgSetBaud ; DISPLAY + CALL PRTSTR0 ; RECOMMENDED + LD A,(RECSPD) ; BAUD RATE + CALL DECBAUD +; + LD HL,msgRevertBaud ; DISPLAY + CALL PRTSTR0 ; ORIGINAL + LD A,(ORISPD) ; BAUD RATE + CALL DECBAUD +; + LD HL,msgWriteV ; DISPLAY + CALL PRTSTR0 ; VERIFY + LD A,(WRTVER) ; OPTION + OR A + LD HL,msgYES + JR NZ,MENU1 + LD HL,msgNO +MENU1: CALL PRTSTR0 +; + LD HL,msgBegin ; DISPLAY OTHER + CALL PRTSTR0 ; MENU OPTIONS + RET +; +;====================================================================== +; DISPLAY THE BAUD RATE FOR THE DEVICE SPECIFIED IN A +;====================================================================== +; +DISPBAUD: + CALL GETDINFO ; GET DEVICE INFO + RET NZ ; EXIT IF NOT SERIAL +DECBAUD:;CALL PRTHEXB + BIT 4,A ; CONVERT ; IF X > 15 X=(X-15)*2 + JR Z,UNDER15 ; DEVICE ; ELSE X=(X*2)-1 + AND %00001111 ; BAUD + INC A ; CODE TO + ADD A,A ; TABLE + JR WASOVER ; INDEX +UNDER15:AND %00001111 + ADD A,A + DEC A +WASOVER:;CALL PRTHEXB + LD DE,BAUDTBL ; DISPLAY + CALL PRTIDXDEA ; BAUD RATE + RET +; +; GET DEVICE INFO FOR DEVICE SPECIFIED IN A +; RETURN NZ FLAG IF NON SERIAL. +; RETURN Z FLAG IF SERIAL DEVICE AND A CONTAINING ENCODED BAUD BYTE +; +GETDINFO: + PUSH AF + LD C,A + LD B,$06 ; GET + RST 08 ; DEVICE + LD A,C ; TYPE + POP BC + OR A ; EXIT IF + RET NZ ; NOT SERIAL +; + LD C,B ; GET + LD B,$05 ; DEVICE + RST 08 ; INFO + XOR A + LD A,D + RET +; +OPTIOND:CALL COUTON ; TURN ON OUTPUT +; + LD HL,msgConfirm ; CONFIRM + CALL PRTSTR0 ; OK + CALL GETINP ; TO + CP 'Y' ; PROCEED + JP NZ,MENULP +DUPL: LD HL,msgCopying + CALL PRTSTR0 +; + LD A,(ERATYP) ; CHECK IF WE + OR A ; NEED TO DO + JR Z,NOERA1 ; A CHIP ERASE +; + LD HL,$1000 + LD (MD_FBAS),HL + LD HL,MD_FERAC ; ERASE + CALL MD_FNCALL ; CHIP #2 + OR A + JP FAILWF +; +NOERA1: LD B,16 ; LOOP THROUGH 16 BANKS +; + XOR A ; START AT + LD (MD_BANK),A ; BANK 0 +; +NXTB: PUSH BC +; + XOR A ; START AT + LD (MD_SECT),A ; SECTOR 0 +; + LD B,8 ; LOOP THROUGH 8 SECTORS +NXTS: PUSH BC +; + CALL DISPROG ; DISPLAY PROGRESS +; + LD IX,sector4k ; READ SECTOR + LD HL,MD_FREAD ; FROM ROM #1 + CALL MD_FNCALL +; + LD HL,MD_BANK ; SET CHIP #2 + SET 4,(HL) +; + LD A,(ERATYP) ; SKIP ERASE + OR A ; IF SECTOR ERASE + JR NZ,NOERA2 ; IS NOT SUPPORTED +; + LD HL,MD_FERAS ; ERASE SECTOR + CALL MD_FNCALL ; ON ROM #2 + OR A + JR NZ,VERF +; +NOERA2: LD IX,sector4k ; WRITE SECTOR + LD HL,MD_FWRIT ; ON ROM #2 + CALL MD_FNCALL +; + LD A,(WRTVER) ; VERIFY + OR A ; WRITE IF + JR Z,NOVER1 ; OPTION +; + LD IX,sector4k ; VERIFY + LD HL,MD_FVERI ; WRITE + CALL MD_FNCALL + OR A ; EXIT IF + JR NZ,VERF ; VERIFY FAILED +; +NOVER1: LD HL,MD_BANK ; RESET TO CHIP #1 + RES 4,(HL) +; + LD A,(MD_SECT) ; POINT TO + ADD A,$10 ; NEXT + LD (MD_SECT),A ; SECTOR +; + POP BC ; LOOP + DJNZ NXTS ; NEXT SECTOR +; + LD HL,MD_BANK ; POINT TO ; 00-15 = CHIP 1 + INC (HL) ; NEXT BANK ; 16-21 = CHIP 2 +; + POP BC ; LOOP + DJNZ NXTB ; NEXT BANK +; + JP Done1 ; SUCCESS. RETURN TO MENU +; +VERF: POP BC ; EXIT WITH FAIL + POP BC ; FAIL MESSAGE AND + JP FAILWF ; RETURN TO MENU +; +OPTIONG:LD HL,msgChangeNow ; CHANGE + CALL PRTSTR0 ; SERIAL + LD A,(RECSPD) ; DEVICE + PUSH AF ; BAUD RATE + CALL DECBAUD ; TO RECOMMENDED + LD HL,msgPressKey + CALL PRTSTR0 + POP AF + CALL CHGSPD + CALL GETINP + JP MENULP +; +OPTIONL:LD HL,msgChangeNow ; CHANGE + CALL PRTSTR0 ; SERIAL + LD A,(ORISPD) ; DEVICE + PUSH AF ; BAUD RATE + CALL DECBAUD ; TO ORIGINAL + LD HL,msgPressKey + CALL PRTSTR0 + POP AF + CALL CHGSPD + CALL GETINP + JP MENULP +; +CHGSPD: PUSH AF + LD B,$05 ; GET SERIAL DEVICE + LD A,(SERDEV) ; CHARACTERISTICS + LD C,A + RST 08 + LD A,D ; MASK OUT EXISTING + AND %11100000 ; REPLACE WITH RATE + LD D,A + POP AF + OR D + LD D,A +; + LD B,$04 ; SET NEW + LD A,(SERDEV) ; SPEED + LD C,A + RST 08 + RET +; +OPTIONV:LD A,(WRTVER) ; TOGGLE + CPL ; VERIFY + LD (WRTVER),A ; FLAG + JP MENULP ; BACK TO MENU +; +OPTIONC:LD HL,msgEnterUnit ; GET + CALL PRTSTR0 ; CONSOLE + CALL GETINP ; UNIT NUMBER + CP '0' + JR C,CONCLR + CP '9' + 1 + JR NC,CONCLR + SUB '0' + LD (CONDEV),A +CLRCON: CALL CONST ; EMPTY CONSOLE BUFFER + OR A ; SO WE DON'T HAVE ANY + JR Z,CONCLR ; FALSE ENTRIES + CALL CONIN + JR CLRCON + +CONCLR: JP MENULP ; BACK TO MENU +; +OPTIONS:LD HL,msgEnterUnit ; GET + CALL PRTSTR0 ; CONSOLE + CALL GETINP ; UNIT + CP '0' + JR C,CONCLR + CP '9' + 1 + JR NC,CONCLR + SUB '0' ; NUMBER + LD (SERDEV),A +; + JP MENULP ; BACK TO MENU +; +#IF (XFUDBG) +OPTIONT:LD HL,msgCRLF ; TEST DELAY 32S, 16S, 8S, 4S, 2S, 1S + CALL PRTSTR0 + LD B,32 ; START DELAY IS 32 SECONDS +TSTDLY: PUSH BC + LD C,'>' ; DISPLAY START + CALL CONOUT ; INDICATOR + LD A,B + CALL PRTHEXB + CALL GetCharTmo ; DELAY B SECONDS + LD C,'<' ; DISPLAY STOP + CALL CONOUT ; INDICATOR + POP BC + SRL B ; NEXT DELAY IS HALF PREVIOUS + JR NZ,TSTDLY ; RETURN TO MENU + JP MENULP ; WHEN DELAY GETS TO 1 SECOND +; +OPTIONH: + LD BC,$F8F3 ; GET CURRENT + RST 08 ; SPEED SETTING + LD A,L ; EXIT IF ALREADY + OR A ; HALF SPEED + JP Z,MENULP +; + LD BC,$F9F3 ; TRY TO SWITCH + LD L,0 ; TO HALF SPEED + LD DE,0 + RST 08 + OR A ; EXIT IF + JP Z,MENULP ; CHANGE FAILS +; + LD HL,TmoFct ; OTHERWISE ADJUST + SRL (HL) ; DELAY FACTOR (/2) + JP MENULP ; BACK TO MENU +; +OPTIONF:LD HL,msgCRLF ; DISPLAY + CALL PRTSTR0 ; BANK + LD C,'b' ; SECTOR + CALL CONOUT ; TIMEOUT + LD A,(MD_BANK) ; CHIP + CALL PRTHEXB + LD C,'s' + CALL CONOUT + LD A,(MD_SECT) + CALL PRTHEXB + LD C,'t' + CALL CONOUT + LD A,(TmoFct) + CALL PRTHEXB + LD C,'c' + CALL CONOUT + LD A,(ERATYP) + CALL PRTHEXB +; + LD HL,msgCRLF ; DISPLAY + CALL PRTSTR0 ; ACK/NAK BYTE + LD HL,packet ; DISPLAY + LD B,3 ; LAST +DMPBUF2:LD A,(HL) ; NUMBERS + CALL PRTHEXB + LD C,' ' + CALL CONOUT + INC HL + DJNZ DMPBUF2 + LD HL,msgCRLF + CALL PRTSTR0 + LD B,128 ; DISPLAY + LD HL,packet+3 ; LAST +DMPBUF: LD A,(HL) ; PACKET + CALL PRTHEXB ; CONTENTS + LD C,' ' + CALL CONOUT + LD A,B + SUB 2 + AND %00001111 + CP %00001111 + JR NZ,DMPBUF1 + PUSH HL + LD HL,msgCRLF + CALL PRTSTR0 + POP HL +DMPBUF1:INC HL + DJNZ DMPBUF + JP MENULP +; +OPTIONR:LD HL,msgErase ; DISPLAY + CALL PRTSTR0 ; ERASE CHIP + LD HL,$1000 ; SET CHIP + LD (MD_FBAS),HL ; ADDRESS + LD HL,MD_FERAC ; ERASE + CALL MD_FNCALL ; AND WRITE + OR A + JP NZ,FAILWF + JP Done1 +; +OPTIONE:LD HL,msgErase ; DISPLAY + CALL PRTSTR0 ; ERASE CHIP + LD HL,MD_FERAC ; ERASE + CALL MD_FNCALL ; AND WRITE + OR A + JP NZ,FAILWF + JP Done1 +#ENDIF +; +;====================================================================== +; CONSOLE AND SERIAL I/O ROUTINES +;====================================================================== +; +SEROUT: PUSH HL ; SERIAL OUTPUT CHARACTER IN C + PUSH DE + PUSH BC + LD E,C + LD B,$01 + LD HL,SERDEV + LD C,(HL) + RST 08 + POP BC + POP DE + POP HL + RET +; +SERST: PUSH HL ; SERIAL STATUS. RETURN CHARACTERS AVAILABLE IN A + PUSH DE + PUSH BC + LD B,$02 + LD HL,SERDEV + LD C,(HL) + RST 08 + POP BC + POP DE + POP HL + RET +; +SERIN: PUSH HL ; SERIAL INPUT. WAIT FOR A CHARACTER AND RETURN IT IN A + PUSH DE + PUSH BC + LD B,$00 + LD HL,SERDEV + LD C,(HL) + RST 08 + LD A,E + POP BC + POP DE + POP HL + RET +; +CONOUT: PUSH AF ; OUTPUT IS BLOCKED DURING THE + LD A,(BLKCOUT) ; FILE TRANSFER WHEN THE + OR A ; CONSOLE AND SERIAL LINE + JR Z,CONOUT1 ; ARE THE SAME + PUSH HL ; CONSOLE OUTPUT CHARACTER IN C + PUSH DE + PUSH BC + LD E,C + LD B,$01 + LD HL,CONDEV + LD C,(HL) + RST 08 + POP BC + POP DE + POP HL +CONOUT1:POP AF + RET +; +CONST: PUSH HL ; CONSOLE STATUS. RETURN CHARACTERS AVAILABLE IN A + PUSH DE + PUSH BC + LD B,$02 + LD HL,CONDEV + LD C,(HL) + RST 08 + POP BC + POP DE + POP HL + RET +; +CONIN: PUSH HL ; CONSOLE INPUT. WAIT FOR A CHARACTER ADD RETURN IT IN A + PUSH DE + PUSH BC + LD B,$00 + LD HL,CONDEV + LD C,(HL) + RST 08 + LD A,E + POP BC + POP DE + POP HL + RET +; +;====================================================================== +; TEXT OUTPUT ROUTINES +;====================================================================== +; +PRTHEXB:PUSH AF ; PRINT HEX BYTE IN A TO CONSOLE + PUSH BC + PUSH DE + CALL HEXASC + LD C,D + CALL CONOUT + LD C,E + CALL CONOUT + POP DE + POP BC + POP AF + RET + +HEXASC: LD D,A + CALL HEXCONV + LD E,A + LD A,D + RLCA + RLCA + RLCA + RLCA + CALL HEXCONV + LD D,A + RET +; +HEXCONV:AND 0FH ; CONVERT LOW NIBBLE OF A TO ASCII HEX + ADD A,90H + DAA + ADC A,40H + DAA + RET +; +; PRINT 0 TERMINATED STRING POINTED TO BY HL +; +PRTSTR0:LD A,(HL) ; PRINT MESSAGE POINTED TOP HL UNTIL 0 + OR A ; CHECK IF GOT ZERO? + RET Z ; IF ZERO RETURN TO CALLER + LD C,A + CALL CONOUT ; ELSE PRINT THE CHARACTER + INC HL + JP PRTSTR0 +; +; PRINT $ TERMINATED STRING POINTED TO BY HL +; +PRTSTRD:LD A,(HL) ; PRINT MESSAGE POINTED TOP HL UNTIL $ + CP '$' ; CHECK IF GOT IT? + RET Z ; IF MATCH RETURN TO CALLER + LD C,A + CALL CONOUT ; ELSE PRINT THE CHARACTER + INC HL + JP PRTSTRD +; +; PRINT THE nTH STRING IN A LIST OF STRINGS WHERE EACH IS TERMINATED BY $ +; A REGISTER DEFINES THE nTH STRING IN THE LIST TO PRINT AND DE POINTS +; TO THE START OF THE STRING LIST. +; +PRTIDXDEA: + PUSH BC + LD C,A ; INDEX COUNT + OR A + LD A,0 +PRTIDXDEA1: + JR Z,PRTIDXDEA3 +PRTIDXDEA2: + LD A,(DE) ; LOOP UNIT + INC DE ; WE REACH + CP '$' ; END OF STRING + JR NZ,PRTIDXDEA2 + DEC C ; AT STRING END. SO GO + JR PRTIDXDEA1 ; CHECK FOR INDEX MATCH +PRTIDXDEA3: + POP BC + EX DE,HL + CALL PRTSTRD ; FALL THROUGH TO WRITESTR + RET +; +;====================================================================== +; CRC OPTIONS AND CALCULATIONS +;====================================================================== +; +OPTION1:LD HL,$0000 ; CRC32 STARTING + LD (MD_FBAS),HL ; BANK $00 SECTOR $00 + LD B,16 ; 16 BANKS (512K) + JR CALCCRC +; +OPTION2:LD HL,$1000 ; CRC32 STARTING + LD (MD_FBAS),HL ; BANK $10 SECTOR $00 + LD B,16 ; 16 BANKS (512K) + JR CALCCRC +; +OPTION3:LD HL,$0000 ; CRC32 STARTING + LD (MD_FBAS),HL ; BANK $00 SECTOR $00 + LD B,32 ; 32 BANKS (1024K) +; +CALCCRC:CALL COUTON ; TURN ON OUTPUT +; + LD HL,msgCalc + CALL PRTSTR0 +; + LD HL,$FFFF ; SET THE + LD (CRC),HL ; START CRC + LD (CRC+2),HL ; CONDITION +; +CRCLP1: PUSH BC ; LOOP THROUGH ALL BANKS + LD B,8 ; LOOP THROUGH +CRCLP2: PUSH BC ; 8 SECTORS +; + PUSH BC + CALL DISPROG ; DISPLAY PROGRESS +; + LD IX,sector4k ; READ + LD HL,MD_FREAD ; A SECTOR + CALL MD_FNCALL + CALL CRC32 ; CALCULATE CRC + POP BC +; + LD A,(MD_SECT) ; POINT + ADD A,$10 ; TO NEXT + LD (MD_SECT),A ; SECTOR +; + POP BC ; NEXT + DJNZ CRCLP2 ; SECTOR +; + XOR A ; RESET SECTOR + LD (MD_SECT),A ; START +; + LD HL,MD_BANK ; POINT TO + INC (HL) ; NEXT BANK +; + POP BC ; NEXT + DJNZ CRCLP1 ; BANK +; + LD HL,msgCRC32 ; DISPLAY + CALL PRTSTR0 ; RESULT + LD HL,CRC+3 + LD B,4 +DISPCRC:LD A,$FF + XOR (HL) + CALL PRTHEXB + DEC HL + DJNZ DISPCRC +; + JP MENULP +; +CRC32: LD IX,sector4k ; CALCULATE + LD BC,4096 ; CRC32 OF + LD DE,(CRC) ; EACH SECTOR + LD HL,(CRC+2) +BYTELP: PUSH BC + LD A,(IX) + XOR E + LD B,8 +ROTLP: SRL H + RR L + RR D + RRA + JP NC,CLEAR + LD E,A + LD A,H + XOR $ED + LD H,A + LD A,L + XOR $B8 + LD L,A + LD A,D + XOR $83 + LD D,A + LD A,E + XOR $20 +CLEAR: DEC B + JP NZ,ROTLP + LD E,A + INC IX + POP BC + DEC BC + LD A,B + OR C + JP NZ,BYTELP + LD (CRC),DE + LD (CRC+2),HL + RET +; +; multiply DE:HL by 10, exit with C set if overflow +; +multb10:call multb2 ; x2 + ret c + push de + push hl + call multb2 ; x4 + ret c + call multb2 ; x8 + ret c +; + pop bc ; x8 + 2 + add hl,bc + pop bc + jr nc,multbc + inc de + ret c +multbc: ex de,hl + add hl,bc + ex de,hl + ret + +multb2: ex de,hl ; multiply by 2 + add hl,hl + ret c + ex de,hl + add hl,hl + jr nc,multbnc + inc de +multbnc:ret +; +;====================================================================== +; CALCULATE BANK AND ADDRESS DATA FROM MEMORY ADDRESS +; +; ON ENTRY DE:HL CONTAINS 32 BIT MEMORY ADDRESS. +; ON EXIT B CONTAINS BANK SELECT BYTE +; C CONTAINS HIGH BYTE OF SECTOR ADDRESS +;====================================================================== +; +;MD_CALBAS: +; +; PUSH HL +; LD A,E ; BOTTOM PORTION OF SECTOR +; AND $0F ; ADDRESS THAT GETS WRITTEN +; RLC H ; WITH ERASE COMMAND BYTE +; RLA ; A15 GETS DROPPED OFF AND +; LD B,A ; ADDED TO BANK SELECT +; +; LD A,H ; TOP SECTION OF SECTOR +; RRA ; ADDRESS THAT GETS WRITTEN +; AND $70 ; TO BANK SELECT PORT +; LD C,A +; POP HL +; +; LD (MD_FBAS),BC ; SAVE BANK AND SECTOR FOR USE IN FLASH ROUTINES +; RET +; +MD_FSTART: .EQU $ ; FLASH ROUTINES WHICH GET RELOCATED TO HIGH MEMORY +; +;====================================================================== +; COMMON FUNCTION CALL FOR: +; +; MD_FIDEN_R - IDENTIFY FLASH CHIP +; ON ENTRY MD_FBAS HAS BEEN SET WITH BANK AND SECTOR BEING ACCESSED +; HL POINTS TO THE ROUTINE TO BE RELOCATED AND CALLED +; ON EXIT BC CONTAINS THE CHIP ID BYTES. +; A NO STATUS IS RETURNED +; +; MD_FERAS_R - ERASE FLASH SECTOR +; ON ENTRY MD_FBAS HAS BEEN SET WITH BANK AND SECTOR BEING ACCESSED +; HL POINTS TO THE ROUTINE TO BE RELOCATED AND CALLED +; ON EXIT A RETURNS STATUS 0=SUCCESS NZ=FAIL +; +; MD_FREAD_R - READ FLASH SECTOR +; ON ENTRY MD_FBAS HAS BEEN SET WITH BANK AND SECTOR BEING ACCESSED +; HL POINTS TO THE ROUTINE TO BE RELOCATED AND CALLED +; IX POINTS TO WHERE TO SAVE DATA +; ON EXIT A NO STATUS IS RETURNED +; +; MD_VERI_R - VERIFY FLASH SECTOR +; ON ENTRY MD_FBAS HAS BEEN SET WITH BANK AND SECTOR BEING ACCESSED +; HL POINTS TO THE ROUTINE TO BE RELOCATED AND CALLED +; IX POINTS TO DATA TO COMPARE. +; ON EXIT A RETURNS STATUS 0=SUCCESS NZ=FAIL +; +; MD_FWRIT_R - WRITE FLASH SECTOR +; ON ENTRY MD_FBAS HAS BEEN SET WITH BANK AND SECTOR BEING ACCESSED +; HL POINTS TO THE ROUTINE TO BE RELOCATED AND CALLED +; IX POINTS TO DATA TO BE WRITTEN +; ON EXIT A NO STATUS IS RETURNED +; +; MD_FERAC_R - ERASE FLASH CHIP +; ON ENTRY MD_FBAS HAS BEEN SET WITH BANK AND SECTOR BEING ACCESSED +; HL POINTS TO THE ROUTINE TO BE RELOCATED AND CALLED +; ON EXIT A RETURNS STATUS 0=SUCCESS FF=FAIL +; +; GENERAL OPERATION: +; FLASH LIBRARY CODE NEEDS TO BE RELOCATED TO UPPER MEMORY +; STACK NEEDS TO BE SETUP IN UPPER MEMORY +; DEPENDING ON ROUTINE, RETURNS WITH STATUS CODE IN A. +;====================================================================== +; +MD_FNCALL: + LD DE,$0000 ; PRESET DE TO SAVE SPACE + LD BC,(MD_FBAS) ; PUT BANK AND SECTOR DATA IN BC +; + LD A,(HB_CURBNK) ; WE ARE STARTING IN HB_CURBNK +; + HB_DI + CALL MD_FJPHL + HB_EI +; + LD A,C ; RETURN WITH STATUS IN A + RET +; +MD_FJPHL: + JP (HL) +; +#INCLUDE "flashlib.inc" +; +MD_FEND .EQU $ +MD_CSIZ .EQU MD_FEND-MD_FSTART ; HOW MUCH SPACE WE NEED FOR RELOCATABLE CODE +; +MD_FIDEN .EQU HBX_LOC-MD_CSIZ+MD_FIDEN_R-MD_FSTART ; CALL ADDRESS FOR IDENTIFY FLASH CHIP +MD_FERAS .EQU HBX_LOC-MD_CSIZ+MD_FERAS_R-MD_FSTART ; CALL ADDRESS FOR ERASE FLASH SECTOR +MD_FREAD .EQU HBX_LOC-MD_CSIZ+MD_FREAD_R-MD_FSTART ; CALL ADDRESS FOR READ FLASH SECTOR +MD_FVERI .EQU HBX_LOC-MD_CSIZ+MD_FVERI_R-MD_FSTART ; CALL ADDRESS FOR VERIFY FLASH SECTOR +MD_FWRIT .EQU HBX_LOC-MD_CSIZ+MD_FWRIT_R-MD_FSTART ; CALL ADDRESS FOR WRITE FLASH SECTOR +MD_FERAC .EQU HBX_LOC-MD_CSIZ+MD_FERAC_R-MD_FSTART ; CALL ADDRESS FOR ERASE FLASH CHIP +; +; Message strings +; +msgHeader: .DB CR,LF,CR,LF,"ROMWBW XMODEM FLASH UPDATER",CR,LF,0 +msgPlatform .DB CR,LF,"PLATFORM NOT SUPPORTED",CR,LF,0 +msgConfirm: .DB CR,LF,CR,LF,"ENTER Y TO CONFIRM OVERWRITE : ",0 +msgInstr: .DB CR,LF,CR,LF,"START TRANSFER OF YOUR UPDATE IMAGE OR ROM",CR,LF,0 +msgUserEx: .DB CR,LF,"UPDATER EXITED BY USER",CR,LF,0 +msgBank: .DB CR,LF,"BANK ",0 +msgUnsupC: .DB CR,LF,"FLASH CHIP NOT SUPPORTED",CR,LF,0 +msgReboot: .DB CR,LF,"REBOOTING ...",CR,LF,0 +msgCopying: .DB CR,LF,"COPYING ...",CR,LF,0 +msgCalc: .DB CR,LF,"CALCULATING ...",CR,LF,0 +msgErase: .DB CR,LF,"ERASING ...",CR,LF,0 +msgCRC32: .DB CR,LF,CR,LF,"CRC32 : ",0 +msgFailWrt: .DB CR,LF,"FLASH WRITE FAILED",CR,LF,0 +msgFailure: .DB CR,LF,"TRANSMISSION FAILED",CR,LF,0 +msgCancel: .DB CR,LF,"TRANSMISSION CANCELLED",CR,LF,0 +msgChangeNow: .DB CR,LF,"Change speed now to ",0 +msgPressKey: .DB CR,LF,"Press a key to Resume.",CR,LF,0 +msgConsole: .DB CR,LF,CR,LF,"(C) Set Console Device : ",0 +msgIODevice: .DB CR,LF,"(S) Set Serial Device : ",0 +msgSetBaud: .DB CR,LF,"(>) Set Recommended Baud Rate : ",0 +msgRevertBaud: .DB CR,LF,"(<) Revert to Original Baud Rate : ",0 +msgWriteV: .DB CR,LF,"(V) Toggle Write Verify : ",0 +msgBegin: .DB CR,LF,"(R) Reboot" + .DB CR,LF,"(U) Begin Update" + .DB CR,LF,"(Q) Quit to Rom Loader" + .DB CR,LF,"(D) Duplicate Flash #1 to #2" + .DB CR,LF,"(1) CRC 512K Flash #1" + .DB CR,LF,"(2) CRC 512K Flash #2" + .DB CR,LF,"(3) CRC 1024K Flash" +#IF (XFUDBG) + .DB CR,LF,"(H) Select half speed" + .DB CR,LF,"(T) Test timeout" + .DB CR,LF,"(F) Dump Debug Data" + .DB CR,LF,"(E) Erase Flash chip #1" + .DB CR,LF,"(Z) Erase Flash chip #2" +#ENDIF + .DB CR,LF,CR,LF,"Select : ",0 +msgSuccess: .DB CR,LF,CR,LF,"COMPLETED WITHOUT ERRORS ",CR,LF,0 +msgEnterUnit: .DB CR,LF,"ENTER UNIT NUMBER : ",0 +msgCRLF: .DB CR,LF,0 +msgYES: .DB "YES",0 +msgNO: .DB "NO",0 +msgPacErr: .DB CR,LF,"PACKET COUNT MISMATCH ERROR",CR,LF,0 +msgChkSum .DB CR,LF,"CHECKSUM ERROR",CR,LF,0 +msgRetry .DB CR,LF,"ERROR, RETRY COUNT EXCEEDED",CR,LF,0 +msgTimout .DB CR,LF,"ERROR, RECEIVE TIMEOUT",CR,LF,0 +; +; Variables +; +CONDEV: .DB $00 ; HBIOS CONSOLE DEVICE NUMBER +SERDEV: .DB $00 ; HBIOS SERIAL DEVICE NUMBER USED FOR XMODEM TRANSFER +WRTVER: .DB $FF ; WRITE VERIFY OPTION FLAG +VERRES: .DB $00 ; WRITE VERIFY RESULT +BLKCOUT: .DB $FF ; BLOCK TEXT OUTPUT DURING TRANSFER IF ZERO +ERATYP .DB $00 ; HOLDS THE ERASE TYPE FLAG FOR VARIOUS CHIPS +;CPUSPD: .DB 0 ; HOLDS CURRENT PROCESSOR SPEED +ORISPD: .DB 0 ; HOLDS ORIGINAL BAUD RATE SPEED +RECSPD: .DB 0 ; HOLDS RECOMMENDED BAUD RATE SPEED +oldSP: .DW 0 ; The orginal SP to be restored before exiting +retrycnt: .DB 0 ; Counter for retries before giving up +chksum: .DB 0 ; For calculating the checksum of the packet +pktNo: .DB 0 ; Current packet Number +pktNo1c: .DB 0 ; Current packet Number 1-complemented +MD_FBAS .DW $FFFF ; CURRENT BANK AND SECTOR +MD_SECT .EQU MD_FBAS ; BANK BYTE +MD_BANK .EQU MD_FBAS+1 ; SECTOR BYTE +CRC .DW $FFFF ; CRC32 + .DW $FFFF +; +packet: .DB 0 ; SOH + .DB 0 ; PacketN + .DB 0 ; -PacketNo, + .FILL 128,0 ; data*128, + .DB 0 ; chksum +; +;====================================================================== +; SUPPORTED DEVICES AND ID CODES +;====================================================================== +; +DEVICES: + .DW $BFB7 ; 39SF040 0 + .DW $01A4 ; 29F040 1 + .DW $1F13 ; AT49F040 2 + .DW $1FA4 ; AT29C040 3 + .DW $20E2 ; M29F040 4 + .DW $C2A4 ; MX29F040 5 + .DW $37A4 ; A29010B 6 + .DW $3786 ; A29040B 7 +LSTDEV: .EQU $ +; +;====================================================================== +; BAUD RATE TABLE +;====================================================================== +; +BAUDTBL:.DB "75$" ; 0 0 + .DB "150$" ; 1 1 + .DB "225$" ; 2 16 + .DB "300$" ; 3 2 + .DB "450$" ; 4 17 + .DB "600$" ; 5 3 + .DB "900$" ; 6 18 + .DB "1200$" ; 7 4 + .DB "1800$" ; 8 19 + .DB "2400$" ; 9 5 + .DB "3600$" ; 10 20 + .DB "4800$" ; 11 6 + .DB "7200$" ; 12 21 + .DB "9600$" ; 13 7 + .DB "14400$" ; 14 22 + .DB "19200$" ; 15 8 + .DB "28800$" ; 16 23 + .DB "38400$" ; 17 9 + .DB "57600$" ; 18 24 + .DB "76800$" ; 19 10 + .DB "115200$" ; 20 25 + .DB "153600$" ; 21 11 + .DB "230400$" ; 22 26 + .DB "307200$" ; 23 12 + .DB "460800$" ; 24 27 + .DB "614400$" ; 25 13 + .DB "921600$" ; 26 28 + .DB "1228800$" ; 27 14 + .DB "1843200$" ; 28 29 + .DB "2457600$" ; 29 15 + .DB "3686400$" ; 30 30 + .DB "7372800$" ; 31 16 +; +;====================================================================== +; CLOCK SETTING TABLE +;====================================================================== +; +CLKTBL: .DB 6 ; 1 4800 + .DB 6 ; 2 4800 + .DB 7 ; 3 9600 + .DB 8 ; 4 19200 + .DB 8 ; 5 19200 + .DB 8 ; 6 19200 + .DB 8 ; 7 19200 + .DB 9 ; 8 38400 + .DB 9 ; 9 38400 + .DB 9 ; 10 38400 + .DB 9 ; 11 38400 + .DB 9 ; 12 38400 + .DB 9 ; 13 38400 + .DB 9 ; 14 38400 + .DB 9 ; 15 38400 + .DB 9 ; 16 38400 + .DB 9 ; 17 38400 + .DB 9 ; 18 38400 + .DB 9 ; 19 38400 + .DB 9 ; 20 38400 +; +sector4k: .EQU $ ; 32 PACKETS GET ACCUMULATED HERE BEFORE FLASHING +; +SLACK .EQU (UPD_END - $) + .FILL SLACK,$FF + .ECHO "ROM Updater space remaining: " + .ECHO SLACK + .ECHO " bytes.\n" + .END diff --git a/Source/HBIOS/usrrom.asm b/Source/HBIOS/usrrom.asm index 5d4ff8e7..be9d80f4 100644 --- a/Source/HBIOS/usrrom.asm +++ b/Source/HBIOS/usrrom.asm @@ -7,15 +7,17 @@ CR .EQU 0DH LF .EQU 0AH ; .ORG USR_LOC -; - LD HL,BOOTMSG ; INTRODUCTION +; + LD SP,USR_END +; + LD HL,BOOTMSG ; INTRODUCTION CALL PRTSTR - - CALL CIN ; DO STUFF ; - LD A,00H ; RETURN TO ROM LOADER - LD HL,0000H - JP 0FFF9H + CALL CIN ; DO STUFF +; + LD B,BF_SYSRESET ; SYSTEM RESTART + LD C,BF_SYSRES_WARM ; WARM START + CALL $FFF0 ; CALL HBIOS ; RET ; ; @@ -40,36 +42,38 @@ PRTSTR: LD A,(HL) COUT: PUSH AF PUSH BC PUSH DE + PUSH HL LD B,01H - LD C,0 + LD C,80H LD E,A RST 08 + POP HL POP DE POP BC POP AF RET ; -; OUTPUT CHARACTER IN A TO CONSOLE DEVICE -; -COUTE: PUSH AF - LD A,E - CALL COUT - POP AF - RET -; ; WAIT FOR A CHARACTER FROM THE CONSOLE DEVICE AND RETURN IT IN A ; CIN: PUSH BC + PUSH DE + PUSH HL LD B,00H - LD C,00H + LD C,80H RST 08 LD A,E + POP HL + POP DE POP BC RET ; -BOOTMSG:.DB "No User ROM Installed." - .DB CR,LF +BOOTMSG:.DB CR,LF,CR,LF + .DB "No User ROM Installed." + .DB CR,LF,CR,LF .DB "Press a key to return to Boot Loader.$" +; +; IT IS CRITICAL THAT THE FINAL BINARY BE EXACTLY USR_SIZ BYTES. +; THIS GENERATES FILLER AS NEEDED. ; SLACK .EQU (USR_END - $) .FILL SLACK,00 diff --git a/Source/HBIOS/util.asm b/Source/HBIOS/util.asm index 253ec8fb..29e6c532 100644 --- a/Source/HBIOS/util.asm +++ b/Source/HBIOS/util.asm @@ -125,7 +125,7 @@ PRTSTR: ; PRINT A STRING DIRECT: REFERENCED BY POINTER AT TOP OF STACK ; STRING MUST BE TERMINATED BY '$' ; USAGE: -; CALL PRTSTR +; CALL PRTSTRD ; .DB "HELLO$" ; ... ; @@ -140,8 +140,9 @@ PRTSTRD: ; PRINT A STRING INDIRECT: REFERENCED BY INDIRECT POINTER AT TOP OF STACK ; STRING MUST BE TERMINATED BY '$' ; USAGE: -; CALL PRTSTRI(MYSTRING) ; MYSTRING .DB "HELLO$" +; CALL PRTSTRI(MYSTRING) +; .DW MYSTRING ; PRTSTRI: EX (SP),HL @@ -183,6 +184,17 @@ PRTHEXWORD: POP AF RET ; +; PRINT THE HEX WORD VALUE IN HL +; +PRTHEXWORDHL: + PUSH AF + LD A,H + CALL PRTHEXBYTE + LD A,L + CALL PRTHEXBYTE + POP AF + RET +; ; PRINT THE HEX DWORD VALUE IN DE:HL ; PRTHEX32: @@ -295,7 +307,7 @@ DB_CONTD: JP DB_BLKRD ; DB_END: - RET + RET ; ; PRINT THE nTH STRING IN A LIST OF STRINGS WHERE EACH IS TERMINATED BY $ ; C REGISTER CONTAINS THE INDEX TO THE STRING TO BE DISPLAYED. @@ -322,7 +334,7 @@ PRTIDXMSK1: POP BC ; ; PRINT THE nTH STRING IN A LIST OF STRINGS WHERE EACH IS TERMINATED BY $ -; A REGISTER DEFINES THE nTH STRING IN THE LIST TO PRINT AND DE POINTS +; A REGISTER DEFINES THE nTH STRING IN THE LIST TO PRINT AND DE POINTS ; TO THE START OF THE STRING LIST. ; ; SLOW BUT IMPROVES CODE SIZE, READABILITY AND ELIMINATES THE NEED HAVE @@ -332,6 +344,8 @@ PRTIDXDEA: PUSH BC LD C,A ; INDEX COUNT OR A + LD A,0 + LD (PRTIDXCNT),A ; RESET CHARACTER COUNT PRTIDXDEA1: JR Z,PRTIDXDEA3 PRTIDXDEA2: @@ -353,14 +367,20 @@ WRITESTR: WRITESTR1: LD A,(DE) CP '$' ; TEST FOR STRING TERMINATOR - JP Z,WRITESTR2 + JR Z,WRITESTR2 CALL COUT + LD A,(PRTIDXCNT) + INC A + LD (PRTIDXCNT),A INC DE - JP WRITESTR1 + JR WRITESTR1 WRITESTR2: POP AF RET ; +PRTIDXCNT: + .DB 0 ; CHARACTER COUNT +; ; ; TSTPT: @@ -370,17 +390,6 @@ TSTPT: POP DE JR REGDMP ; DUMP REGISTERS AND RETURN ; -; PANIC: TRY TO DUMP MACHINE STATE -; -PANIC: - PUSH DE - LD DE,STR_PANIC - CALL WRITESTR - POP DE - CALL XREGDMP ; DUMP REGISTERS - CALL CONTINUE ; CHECK W/ USER - RET -; ; ; REGDMP: @@ -410,7 +419,7 @@ XREGDMP: LD A,'@' CALL COUT POP AF - + PUSH BC LD BC,(REGDMP_PC) CALL PRTHEXWORD ; PC @@ -434,7 +443,7 @@ XREGDMP: CALL PC_COLON LD BC,(REGDMP_SP) CALL PRTHEXWORD ; SP - + CALL PC_COLON PUSH IX POP BC @@ -454,7 +463,7 @@ XREGDMP: POP AF ;LD SP,(RD_STKSAV) ; BACK TO ORIGINAL STACK FRAME - + JP $FFFF ; RETURN, $FFFF IS DYNAMICALLY UPDATED REGDMP_RET .EQU $-2 ; RETURN ADDRESS GOES HERE ; @@ -467,34 +476,10 @@ REGDMP_SP .DW 0 ; ; ; -CONTINUE: - PUSH AF - PUSH DE - LD DE,STR_CONTINUE - CALL WRITESTR - POP DE -CONTINUE1: - CALL CIN - CP 'Y' - JR Z,CONTINUE3 - CP 'y' - JR Z,CONTINUE3 - CP 'N' - JR Z,CONTINUE2 - CP 'n' - JR Z,CONTINUE2 - JR CONTINUE1 -CONTINUE2: - HALT -CONTINUE3: - POP AF - RET -; ; ; -STR_PANIC .DB "\r\n\r\n>>> PANIC: $" +STR_HALT .TEXT "\r\n\r\n*** System Halted ***$" STR_TSTPT .TEXT "\r\n+++ TSTPT: $" -STR_CONTINUE .TEXT " Continue? (Y/N): $" ;STR_AF .DB " AF=$" ;STR_BC .DB " BC=$" ;STR_DE .DB " DE=$" @@ -502,13 +487,15 @@ STR_CONTINUE .TEXT " Continue? (Y/N): $" ;STR_PC .DB " PC=$" ;STR_SP .DB " SP=$" ; -; INDIRECT JUMP TO ADDRESS IN HL +; INDIRECT JUMP TO ADDRESS IN HL,IX, OR IY ; ; MOSTLY USEFUL TO PERFORM AN INDIRECT CALL LIKE: ; LD HL,xxxx ; CALL JPHL ; JPHL: JP (HL) +JPIX: JP (IX) +JPIY: JP (IY) ; ; ADD HL,A ; @@ -566,8 +553,6 @@ BYTE2BCD1: POP BC RET -#IF (BIOS == BIOS_WBW) - #IFDEF USEDELAY ; @@ -592,9 +577,11 @@ DELAY: ; 17TS (FROM INVOKING CALL) | DELAY1: ; | ; --- LOOP = ((CPUSCL * 16) - 5) TS ------------+ | DEC A ; 4TS | | -#IF (CPUFAM == CPU_Z180) ; | | + #IF (BIOS == BIOS_WBW) ; | | + #IF (CPUFAM == CPU_Z180) ; | | OR A ; +4TS FOR Z180 | | -#ENDIF ; | | + #ENDIF ; | | + #ENDIF ; | | JR NZ,DELAY1 ; 12TS (NZ) / 7TS (Z) | | ; ----------------------------------------------+ | ; | @@ -623,17 +610,21 @@ VDELAY: ; 17TS (FROM INVOKING CALL) | ; | | VDELAY1: ; | | ; --- INNER LOOP = ((CPUSCL * 16) - 5) TS ------+ | | -#IF (CPUFAM == CPU_Z180) ; | | | + #IF (BIOS == BIOS_WBW) ; | | | + #IF (CPUFAM == CPU_Z180) ; | | | OR A ; +4TS FOR Z180 | | | -#ENDIF ; | | | + #ENDIF ; | | | + #ENDIF ; | | | DEC A ; 4TS | | | JR NZ,VDELAY1 ; 12TS (NZ) / 7TS (Z) | | | ; ----------------------------------------------+ | | ; | | DEC DE ; 6TS | | -#IF (CPUFAM == CPU_Z180) ; | | + #IF (BIOS == BIOS_WBW) ; | | | + #IF (CPUFAM == CPU_Z180) ; | | OR A ; +4TS FOR Z180 | | -#ENDIF ; | | + #ENDIF ; | | + #ENDIF ; | | LD A,D ; 4TS | | OR E ; 4TS | | JP NZ,VDELAY ; 10TS | | @@ -655,26 +646,9 @@ LDELAY: RET ; ; INITIALIZE DELAY SCALER BASED ON OPERATING CPU SPEED -; HBIOS *MUST* BE INSTALLED AND AVAILABLE VIA RST 8!!! -; CPU SCALER := MAX(1, (PHIMHZ - 2)) +; ENTER WITH A = CPU SPEED IN MHZ ; DELAY_INIT: -#IF (BIOS == BIOS_UNA) - LD C,$F8 ; UNA BIOS GET PHI FUNCTION - RST 08 ; RETURNS SPEED IN HZ IN DE:HL - LD B,4 ; DIVIDE MHZ IN DE:HL BY 100000H -DELAY_INIT0: - SRL D ; ... TO GET APPROX CPU SPEED IN - RR E ; ...MHZ. THROW AWAY HL, AND - DJNZ DELAY_INIT0 ; ...RIGHT SHIFT DE BY 4. - INC E ; FIX UP FOR VALUE TRUNCATION - LD A,E ; PUT IN A -#ELSE - LD B,BF_SYSGET ; HBIOS FUNC=GET SYS INFO - LD C,BF_SYSGET_CPUINFO ; HBIOS SUBFUNC=GET CPU INFO - RST 08 ; CALL HBIOS, RST 08 NOT YET INSTALLED - LD A,L ; PUT SPEED IN MHZ IN ACCUM -#ENDIF CP 3 ; TEST FOR <= 2 (SPECIAL HANDLING) JR C,DELAY_INIT1 ; IF <= 2, SPECIAL PROCESSING SUB 2 ; ADJUST AS REQUIRED BY DELAY FUNCTIONS @@ -685,13 +659,11 @@ DELAY_INIT2: LD (CPUSCL),A ; UPDATE CPU SCALER VALUE RET -#IF (CPUMHZ < 3) + #IF (CPUMHZ < 3) CPUSCL .DB 1 ; CPU SCALER MUST BE > 0 -#ELSE + #ELSE CPUSCL .DB CPUMHZ - 2 ; OTHERWISE 2 LESS THAN PHI MHZ -#ENDIF -; -#ENDIF + #ENDIF ; #ENDIF ; @@ -700,13 +672,15 @@ CPUSCL .DB CPUMHZ - 2 ; OTHERWISE 2 LESS THAN PHI MHZ ; NUMBER OF CALL/RET INVOCATIONS. A SINGLE CALL/RET IS ; 27 T-STATES ON A Z80, 25 T-STATES ON A Z180 ; -DLY64: CALL DLY32 -DLY32: CALL DLY16 -DLY16: CALL DLY8 -DLY8: CALL DLY4 -DLY4: CALL DLY2 -DLY2: CALL DLY1 -DLY1: RET +; ; Z80 Z180 +; ; ---- ---- +DLY64: CALL DLY32 ; 1728 1600 +DLY32: CALL DLY16 ; 864 800 +DLY16: CALL DLY8 ; 432 400 +DLY8: CALL DLY4 ; 216 200 +DLY4: CALL DLY2 ; 108 100 +DLY2: CALL DLY1 ; 54 50 +DLY1: RET ; 27 25 ; ; MULTIPLY 8-BIT VALUES ; IN: MULTIPLY H BY E @@ -768,13 +742,13 @@ DIV16: DIV16A: SCF RL C - RLA - ADC HL,HL - SBC HL,DE - JR NC,DIV16B - ADD HL,DE - DEC C -DIV16B: + RLA + ADC HL,HL + SBC HL,DE + JR NC,DIV16B + ADD HL,DE + DEC C +DIV16B: DJNZ DIV16A ; LOOP AS NEEDED LD B,A ; AC -> BC LD A,H ; SET ZF @@ -858,54 +832,155 @@ BITLOC1: DJNZ BITLOC1 ; LOOP AS NEEDED RET ; DONE ; -; PRINT VALUE OF A IN DECIMAL WITH LEADING ZERO SUPPRESSION +; DECIMAL NUMBER PRINTING ROUTINES ; -PRTDECB: - PUSH HL - PUSH AF - LD L,A - LD H,0 - CALL PRTDEC - POP AF - POP HL +PRTDEC8: ; PRINT VALUE OF A REGISTER IN DECIMAL + PUSH IY + LD IY,B2D8 + CALL PRTDECSTR + POP IY RET ; -; PRINT VALUE OF HL IN DECIMAL WITH LEADING ZERO SUPPRESSION +PRTDEC16: ; PRINT VALUE OF HL REGISTER IN DECIMAL + PUSH IY + LD IY,B2D16 + CALL PRTDECSTR + POP IY + RET ; -PRTDEC: +PRTDEC32: ; PRINT VALUE OF DE:HL REGISTERS IN DECIMAL + PUSH IY + LD IY,B2D32 + CALL PRTDECSTR + POP IY + RET +; +PRTDECSTR: + PUSH AF PUSH BC PUSH DE PUSH HL - LD E,'0' - LD BC,-10000 - CALL PRTDEC1 - LD BC,-1000 - CALL PRTDEC1 - LD BC,-100 - CALL PRTDEC1 - LD C,-10 - CALL PRTDEC1 - LD E,0 - LD C,-1 - CALL PRTDEC1 + PUSH IX + CALL JPIY ; CALL (IY) + EX DE,HL + LD A,'$' + LD (B2DEND),A + CALL WRITESTR + POP IX POP HL POP DE POP BC + POP AF RET -PRTDEC1: - LD A,'0' - 1 -PRTDEC2: - INC A - ADD HL,BC - JR C,PRTDEC2 +; +; Combined routine for conversion of different sized binary numbers into +; directly printable ASCII(Z)-string +; Input value in registers, number size and -related to that- registers to fill +; is selected by calling the correct entry: +; +; entry inputregister(s) decimal value 0 to: +; B2D8 A 255 (3 digits) +; B2D16 HL 65535 5 " +; B2D24 E:HL 16777215 8 " +; B2D32 DE:HL 4294967295 10 " +; B2D48 BC:DE:HL 281474976710655 15 " +; B2D64 IX:BC:DE:HL 18446744073709551615 20 " +; +; The resulting string is placed into a small buffer attached to this routine, +; this buffer needs no initialization and can be modified as desired. +; The number is aligned to the right, and leading 0's are replaced with spaces. +; On exit HL points to the first digit, (B)C = number of decimals +; This way any re-alignment / postprocessing is made easy. +; Changes: AF,BC,DE,HL,IX +; P.S. some examples below +; +; by Alwin Henseler +; +B2D8: LD H,0 + LD L,A +B2D16: LD E,0 +B2D24: LD D,0 +B2D32: LD BC,0 +B2D48: LD IX,0 ; zero all non-used bits +B2D64: LD (B2DINV),HL + LD (B2DINV+2),DE + LD (B2DINV+4),BC + LD (B2DINV+6),IX ; place full 64-bit input value in buffer + LD HL,B2DBUF + LD DE,B2DBUF+1 + LD (HL),' ' +B2DFILC .EQU $-1 ; address of fill-character + LD BC,18 + LDIR ; fill 1st 19 bytes of buffer with spaces + LD (B2DEND-1),BC ;set BCD value to "0" & place terminating 0 + LD E,1 ; no. of bytes in BCD value + LD HL,B2DINV+8 ; (address MSB input)+1 + LD BC,$0909 + XOR A +B2DSKP0:DEC B + JR Z,B2DSIZ ; all 0: continue with postprocessing + DEC HL + OR (HL) ; find first byte <>0 + JR Z,B2DSKP0 +B2DFND1:DEC C + RLA + JR NC,B2DFND1 ; determine no. of most significant 1-bit + RRA + LD D,A ; byte from binary input value +B2DLUS2:PUSH HL + PUSH BC +B2DLUS1:LD HL,B2DEND-1 ; address LSB of BCD value + LD B,E ; current length of BCD value in bytes + RL D ; highest bit from input value -> carry +B2DLUS0:LD A,(HL) + ADC A,A + DAA + LD (HL),A ; double 1 BCD byte from intermediate result + DEC HL + DJNZ B2DLUS0 ; and go on to double entire BCD value (+carry!) + JR NC,B2DNXT + INC E ; carry at MSB -> BCD value grew 1 byte larger + LD (HL),1 ; initialize new MSB of BCD value +B2DNXT: DEC C + JR NZ,B2DLUS1 ; repeat for remaining bits from 1 input byte + POP BC ; no. of remaining bytes in input value + LD C,8 ; reset bit-counter + POP HL ; pointer to byte from input value + DEC HL + LD D,(HL) ; get next group of 8 bits + DJNZ B2DLUS2 ; and repeat until last byte from input value +B2DSIZ: LD HL,B2DEND ; address of terminating 0 + LD C,E ; size of BCD value in bytes + OR A + SBC HL,BC ; calculate address of MSB BCD + LD D,H + LD E,L SBC HL,BC - CP E - JR Z,PRTDEC3 - LD E,0 - CALL COUT -PRTDEC3: + EX DE,HL ; HL=address BCD value, DE=start of decimal value + LD B,C ; no. of bytes BCD + SLA C ; no. of bytes decimal (possibly 1 too high) + LD A,'0' + RLD ; shift bits 4-7 of (HL) into bit 0-3 of A + CP '0' ; (HL) was > 9h? + JR NZ,B2DEXPH ; if yes, start with recording high digit + DEC C ; correct number of decimals + INC DE ; correct start address + JR B2DEXPL ; continue with converting low digit +B2DEXP: RLD ; shift high digit (HL) into low digit of A +B2DEXPH:LD (DE),A ; record resulting ASCII-code + INC DE +B2DEXPL:RLD + LD (DE),A + INC DE + INC HL ; next BCD-byte + DJNZ B2DEXP ; and go on to convert each BCD-byte into 2 ASCII + SBC HL,BC ; return with HL pointing to 1st decimal RET ; +B2DINV .FILL 8 ; space for 64-bit input value (LSB first) +B2DBUF .FILL 20 ; space for 20 decimal digits +B2DEND .DB 1 ; space for terminating 0 +; ; SHIFT HL:DE BY B BITS ; SRL32: @@ -926,6 +1001,57 @@ SLA32: DJNZ SLA32 RET ; +; PRINT VALUE OF A IN DECIMAL WITH LEADING ZERO SUPPRESSION +; BELOW ARE NOW OBSOLETE AND MAPPED TO NEW ROUTINES +; +PRTDECB .EQU PRTDEC8 +;;;PRTDECB: +;;; PUSH HL +;;; PUSH AF +;;; LD L,A +;;; LD H,0 +;;; CALL PRTDEC +;;; POP AF +;;; POP HL +;;; RET +; +; PRINT VALUE OF HL IN DECIMAL WITH LEADING ZERO SUPPRESSION +; +PRTDEC .EQU PRTDEC16 +;;;PRTDEC: +;;; PUSH BC +;;; PUSH DE +;;; PUSH HL +;;; LD E,'0' +;;; LD BC,-10000 +;;; CALL PRTDEC1 +;;; LD BC,-1000 +;;; CALL PRTDEC1 +;;; LD BC,-100 +;;; CALL PRTDEC1 +;;; LD C,-10 +;;; CALL PRTDEC1 +;;; LD E,0 +;;; LD C,-1 +;;; CALL PRTDEC1 +;;; POP HL +;;; POP DE +;;; POP BC +;;; RET +;;;PRTDEC1: +;;; LD A,'0' - 1 +;;;PRTDEC2: +;;; INC A +;;; ADD HL,BC +;;; JR C,PRTDEC2 +;;; SBC HL,BC +;;; CP E +;;; JR Z,PRTDEC3 +;;; LD E,0 +;;; CALL COUT +;;;PRTDEC3: +;;; RET +; ; LOAD OR STORE DE:HL ; LD32: @@ -981,7 +1107,7 @@ SUB32: RET ; ; INC32 (HL) -; INCREMENT 32 BIT BINARY AT ADDRESS +; INCREMENT 32 BIT BINARY AT ADDRESS ; INC32HL: INC (HL) diff --git a/Source/HBIOS/vdu.asm b/Source/HBIOS/vdu.asm index bc888aa5..0d035bf4 100644 --- a/Source/HBIOS/vdu.asm +++ b/Source/HBIOS/vdu.asm @@ -47,40 +47,40 @@ VDU_BLNK .EQU VDU_NOBL ; DEFAULT BLINK RATE TERMENABLE .SET TRUE ; INCLUDE TERMINAL PSEUDODEVICE DRIVER ; #IF (VDUSIZ=V80X24) -DLINES .EQU 24 +DLINES .EQU 24 DROWS .EQU 80 DSCANL .EQU 10 #ENDIF #IF (VDUSIZ=V80X25) -DLINES .EQU 25 +DLINES .EQU 25 DROWS .EQU 80 DSCANL .EQU 10 #ENDIF #IF (VDUSIZ=V80X30) -DLINES .EQU 30 +DLINES .EQU 30 DROWS .EQU 80 DSCANL .EQU 8 #ENDIF #IF (VDUSIZ=V80X25B) -DLINES .EQU 25 +DLINES .EQU 25 DROWS .EQU 80 DSCANL .EQU 12 #ENDIF #IF (VDUSIZ=V80X24B) -DLINES .EQU 24 +DLINES .EQU 24 DROWS .EQU 80 DSCANL .EQU 12 #ENDIF ; #IF VDU_CSTY=VDU_BLOK -VDU_R10 .EQU (VDU_BLNK + $00) +VDU_R10 .EQU (VDU_BLNK + $00) VDU_R11 .EQU DSCANL-1 #ENDIF ; #IF VDU_CSTY=VDU_ULIN -VDU_R10 .EQU (VDU_BLNK + DSCANL-1) +VDU_R10 .EQU (VDU_BLNK + DSCANL-1) VDU_R11 .EQU DSCANL-1 -#ENDIF +#ENDIF ; ;====================================================================== ; VDU DRIVER - INITIALIZATION @@ -127,7 +127,7 @@ VDU_INIT1: XOR A ; SIGNAL SUCCESS RET -; +; ;====================================================================== ; VDU DRIVER - VIDEO DISPLAY ADAPTER (VDA) FUNCTIONS ;====================================================================== @@ -148,10 +148,12 @@ VDU_FNTBL: .DW PPK_STAT .DW PPK_FLUSH .DW PPK_READ + .DW VDU_VDARDC #IF (($ - VDU_FNTBL) != (VDA_FNCNT * 2)) .ECHO "*** INVALID VDU FUNCTION TABLE ***\n" + !!!!! #ENDIF - +; VDU_VDAINI: ; RESET VDA ; CURRENTLY IGNORES VIDEO MODE AND BITMAP DATA @@ -165,7 +167,7 @@ VDU_VDAQRY: LD HL,0 ; EXTRACTION OF CURRENT BITMAP DATA NOT SUPPORTED XOR A ; SIGNAL SUCCESS RET - + VDU_VDARES: LD DE,0 LD (VDU_OFFSET),DE @@ -180,6 +182,8 @@ VDU_VDARES: VDU_VDADEV: LD D,VDADEV_VDU ; D := DEVICE TYPE LD E,0 ; E := PHYSICAL UNIT IS ALWAYS ZERO + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,VDU_BASE ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET @@ -202,26 +206,26 @@ VDU_VDASCS: XOR A RET - + VDU_VDASCP: CALL VDU_XY XOR A RET - + VDU_VDASAT: XOR A RET - + VDU_VDASCO: XOR A RET - + VDU_VDAWRC: LD A,E CALL VDU_PUTCHAR XOR A RET - + VDU_VDAFIL: LD A,E ; FILL CHARACTER GOES IN A EX DE,HL ; FILL LENGTH GOES IN DE @@ -236,9 +240,9 @@ VDU_VDACPY: POP BC ; RECOVER LENGTH IN BC LD DE,(VDU_POS) ; PUT DEST IN DE JP VDU_BLKCPY ; DO A BLOCK COPY - + RET - + VDU_VDASCR: LD A,E ; LOAD E INTO A OR A ; SET FLAGS @@ -255,6 +259,32 @@ VDU_VDASCR1: INC E ; INCREMENT IT JR VDU_VDASCR ; LOOP ; +;---------------------------------------------------------------------- +; READ VALUE AT CURRENT VDU BUFFER POSITION +; RETURN E = CHARACTER, B = COLOUR, C = ATTRIBUTES +;---------------------------------------------------------------------- +; +VDU_VDARDC: + LD HL,(VDU_OFFSET) ; SET BUFFER READ POSITION + LD DE,(VDU_POS) + ADD HL,DE + + LD C,18 ; SET SOURCE ADDRESS IN VDU (HL) + CALL VDU_WRREGX ; DO IT + + LD A,31 ; PREP VDU FOR DATA R/W + OUT (VDU_REG),A ; DO IT + + CALL VDU_WAITRDY ; WAIT FOR VDU TO BE READY + + LD C,VDU_RAMRD ; LOAD C WITH VDU READ REGISTER + IN E,(C) + + LD B,$F0 ; WHITE FG. BLACK BG + LD C,$00 ; NO ATTRIBUTES + XOR A + RET +; ;====================================================================== ; VDU DRIVER - PRIVATE DRIVER FUNCTIONS ;====================================================================== @@ -293,7 +323,7 @@ VDU_WRREGX: ;---------------------------------------------------------------------- ; READ SY6845 REGISTERS ; VDU_RDREG READS VDU REGISTER SPECIFIED IN C AND RETURNS VALUE IN A -; VDU_RDREGX READS VDU REGISTER PAIR SPECIFIED BY C, C+1 +; VDU_RDREGX READS VDU REGISTER PAIR SPECIFIED BY C, C+1 ; AND RETURNS VALUE IN HL ;---------------------------------------------------------------------- ; @@ -398,13 +428,13 @@ VDU_PUTCHAR: INC HL ; NEW CURSOR POSITION LD C,14 ; CURSOR POSITION REGISTER PAIR CALL VDU_WRREGX ; DO IT - + LD A,31 ; PREP VDU FOR DATA R/W OUT (VDU_REG),A CALL VDU_WAITRDY ; WAIT FOR VDU TO BE READY LD A,B OUT (VDU_RAMWR),A ; OUTPUT CHAR TO VDU - + RET ; ;---------------------------------------------------------------------- @@ -431,7 +461,7 @@ VDU_FILL: OUT (VDU_REG),A VDU_FILL1: LD A,D ; CHECK NUMBER OF FILL CHARS LEFT - OR E + OR E RET Z ; ALL DONE, RETURN CALL VDU_WAITRDY ; WAIT FOR VDU TO BE READY LD A,B @@ -481,7 +511,7 @@ VDU_BLKCPY1: ; VIDEO RAM -> BUFFER COPY LOOP OUT (VDU_REG),A ; DO IT LD HL,VDU_BUF ; HL POINTS TO WORK BUFFER LD C,VDU_RAMWR ; LOAD C WITH VDU WRITE REGISTER - + VDU_BLKCPY2: ; BUFFER -> VIDEO RAM COPY LOOP CALL VDU_WAITRDY ; WAIT FOR VDU OUTI ; WRITE BYTE, DEC B, INC HL @@ -501,7 +531,7 @@ VDU_SCROLL: LD (VDU_OFFSET),HL LD C,12 CALL VDU_WRREGX - + ; FILL EXPOSED LINE LD HL,(VDU_POS) PUSH HL @@ -512,7 +542,7 @@ VDU_SCROLL: CALL VDU_FILL POP HL LD (VDU_POS),HL - + ; ADJUST CURSOR POSITION AND RETURN LD HL,(VDU_OFFSET) LD DE,(VDU_POS) @@ -543,7 +573,7 @@ VDU_RSCROLL: CALL VDU_FILL POP HL LD (VDU_POS),HL - + ; ADJUST CURSOR POSITION AND RETURN LD HL,(VDU_OFFSET) LD DE,(VDU_POS) @@ -566,7 +596,7 @@ VDU_BUF .FILL 256,0 ; COPY BUFFER ; CCIR 625/50 VERSION (USED IN MOST OF THE WORLD) ; JUMPER K1 2-3, K2 1-2 FOR 2MHz CHAR CLOCK ; -; THE CCIR 625/50 TELEVISION STANDARD HAS 625 LINES INTERLACED AT 50 FIELDS PER SECOND. THIS WORKS +; THE CCIR 625/50 TELEVISION STANDARD HAS 625 LINES INTERLACED AT 50 FIELDS PER SECOND. THIS WORKS ; OUT AS 50 FIELDS OF 312.5 LINES PER SECOND NON-INTERLACED AS USED HERE. ; HORIZONTAL LINE WIDTH IS 64uS. FOR A 2 MHz CHARACTER CLOCK (R0+1)/2000000 = 64uS ; NEAREST NUMBER OF LINES IS 312 = (R4+1) * (R9+1) + R5. @@ -658,7 +688,7 @@ VDU_INIT6845: .DB 00CH ; R3 SYNC WIDTHS .DB 19H ; R4 VERTICAL TOTAL (TOTAL CHARS IN A FRAME -1) (312/DLINES)-1 .DB 00H ; R5 VERTICAL TOTAL ADJUST (312-(R4+1)*DSCANL) - .DB DLINES ; R6 VERTICAL DISPLAY + .DB DLINES ; R6 VERTICAL DISPLAY .DB 019H ; R7 VERTICAL SYNC (DLINES .. R4) .DB 078H ; R8 MODE .DB DSCANL-1 ; R9 SCAN LINE (LINES PER CHAR AND SPACING -1) @@ -680,7 +710,7 @@ VDU_INIT6845: .DB 00CH ; R3 SYNC WIDTHS .DB 19H ; R4 VERTICAL TOTAL (TOTAL CHARS IN A FRAME -1) (312/DLINES)-1 .DB 00H ; R5 VERTICAL TOTAL ADJUST (312-(R4+1)*DSCANL) - .DB DLINES ; R6 VERTICAL DISPLAY + .DB DLINES ; R6 VERTICAL DISPLAY .DB 018H ; R7 VERTICAL SYNC (DLINES .. R4) .DB 078H ; R8 MODE .DB DSCANL-1 ; R9 SCAN LINE (LINES PER CHAR AND SPACING -1) diff --git a/Source/HBIOS/vga.asm b/Source/HBIOS/vga.asm index 5a285376..d072711b 100644 --- a/Source/HBIOS/vga.asm +++ b/Source/HBIOS/vga.asm @@ -70,12 +70,12 @@ VGA_89BIT .EQU VGA_8BIT #ENDIF ; #IF VGA_CSTY=VGA_BLOK -VGA_R10 .EQU (VGA_BLNK + $00) +VGA_R10 .EQU (VGA_BLNK + $00) VGA_R11 .EQU VGA_SCANL-1 #ENDIF ; #IF VGA_CSTY=VGA_ULIN -VGA_R10 .EQU (VGA_BLNK + VGA_SCANL-1) +VGA_R10 .EQU (VGA_BLNK + VGA_SCANL-1) VGA_R11 .EQU VGA_SCANL-1 #ENDIF ; @@ -85,7 +85,7 @@ 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) @@ -161,8 +161,10 @@ VGA_FNTBL: .DW KBD_STAT .DW KBD_FLUSH .DW KBD_READ + .DW VGA_VDARDC #IF (($ - VGA_FNTBL) != (VDA_FNCNT * 2)) .ECHO "*** INVALID VGA FUNCTION TABLE ***\n" + !!!!! #ENDIF VGA_VDAINI: @@ -179,13 +181,13 @@ VGA_VDAQRY: 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 (REVERSE, 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 @@ -193,27 +195,30 @@ VGA_VDARES: CALL VGA_FILL ; DO IT LD DE,0 ; ROW = 0, COL = 0 CALL VGA_XY ; SEND CURSOR TO TOP LEFT - + LD HL,$0404 | VGA_89BIT; 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 + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,VGA_BASE ; L := BASE I/O ADDRESS XOR A ; SIGNAL SUCCESS RET - + VGA_VDASCS: - CALL PANIC ; NOT IMPLEMENTED (YET) - + SYSCHKERR(ERR_NOTIMPL) ; NOT IMPLEMENTED (YET) + RET + VGA_VDASCP: CALL VGA_XY ; SET CURSOR POSITION XOR A ; SIGNAL SUCCESS RET - + VGA_VDASAT: ; INCOMING IS: -----RUB (R=REVERSE, U=UNDERLINE, B=BLINK) ; @@ -222,7 +227,7 @@ VGA_VDASAT: 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) @@ -269,13 +274,13 @@ VGA_VDASCO2: 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 @@ -291,7 +296,7 @@ VGA_VDACPY: 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 @@ -307,6 +312,15 @@ VGA_VDASCR1: POP DE ; RECOVER E INC E ; INCREMENT IT JR VGA_VDASCR ; LOOP + +;---------------------------------------------------------------------- +; READ VALUE AT CURRENT VDU BUFFER POSITION +; RETURN E = CHARACTER, B = COLOUR, C = ATTRIBUTES +;---------------------------------------------------------------------- + +VGA_VDARDC: + OR $FF ; UNSUPPORTED FUNCTION + RET ; ;====================================================================== ; VGA DRIVER - PRIVATE DRIVER FUNCTIONS @@ -522,7 +536,7 @@ VGA_LOADFONT: LD (VGA_STACK),SP ; SAVE STACK LD HL,(VGA_STACK) ; AND SHIFT IT LD DE,$2000 ; DOWN 4KB TO - CCF ; CREATE A + OR A ; CREATE A SBC HL,DE ; DECOMPRESSION BUFFER LD SP,HL ; HL POINTS TO BUFFER EX DE,HL ; START OF STACK BUFFER @@ -543,7 +557,7 @@ VGA_LOADFONT2: INC HL ; NEXT FONT BYTE INC DE ; NEXT MEM BYTE DJNZ VGA_LOADFONT2 - + LD BC,16-VGA_SCANL ; MOVE TO NEXT EX DE,HL ; 16 BYTE ADD HL,BC ; CHARACTER @@ -586,7 +600,7 @@ VGA_XY2IDX: 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 ; @@ -651,7 +665,7 @@ VGA_FILL: 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 @@ -669,7 +683,7 @@ VGA_FILL1: #ENDIF LD A,(VGA_ATTR) ; GET CUR ATTR OUT (C),A ; OUTPUT ATTR - + ; CHECK COUNT DEC DE ; DECREMENT COUNT LD A,D ; TEST FOR @@ -755,7 +769,7 @@ VGA_SCROLL6: LD (VGA_POS),HL ; SAVE IT LD C,14 ; CURSOR 1 POS REG CALL VGA_REGWRX ; COMMIT - + RET ; ;---------------------------------------------------------------------- @@ -822,13 +836,13 @@ VGA_BLKCPY: 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: #IF (VGA_NICE) CALL VGA_WAITSB ; WAIT FOR RETRACE @@ -842,7 +856,7 @@ VGA_BLKCPY1: INC C ; C := VGA_DATA IN A,(C) ; A := (HL) - ; COPY TO DESTINATION + ; COPY TO DESTINATION LD C,VGA_HI ; C := VGA_HI OUT (C),D ; VGA_HI := SOURCE HI (H) INC C ; C := VGA_LO @@ -945,7 +959,7 @@ REGS_VGA: .DB 18,-1 ; S2 ROW - 1 .DB 27,12 ; VERT SYNC POS ADJ .DB 30,$01 | $08 ; CTL 1, 2 WINDOWS & ENABLE R27 VSYNC FINE ADJ - + .DB $FF ; END MARKER #ENDIF #IF (VGASIZ=V80X30) @@ -966,7 +980,7 @@ REGS_VGA: .DB 10,VGA_R10 ; CURSOR START & CURSOR BLINK .DB 11,VGA_R11 ; CURSOR END .DB 12,0 ; SCRN 1 START (HI) - .DB 13,0 ; SCRN 1 START (LO) + .DB 13,0 ; SCRN 1 START (LO) .DB 18,-1 ; S2 ROW - 1 .DB 27,0 ; VERT SYNC POS ADJ .DB 30,$01 | $08 ; CTL 1, 2 WINDOWS & ENABLE R27 VSYNC FINE ADJ @@ -990,7 +1004,7 @@ REGS_VGA: .DB 10,VGA_R10 ; CURSOR START & CURSOR BLINK .DB 11,VGA_R11 ; CURSOR END .DB 12,0 ; SCRN 1 START (HI) - .DB 13,0 ; SCRN 1 START (LO) + .DB 13,0 ; SCRN 1 START (LO) .DB 18,-1 ; S2 ROW - 1 .DB 27,0 ; VERT SYNC POS ADJ .DB 30,$01 | $08 ; CTL 1, 2 WINDOWS & ENABLE R27 VSYNC FINE ADJ @@ -998,7 +1012,7 @@ REGS_VGA: #ENDIF #IF (VGASIZ=V80X60) ;=============================================================================== -; 80x60X8 60hz REGISTER VALUES +; 80x60X8 60hz REGISTER VALUES ;=============================================================================== ; REGS_VGA: @@ -1014,7 +1028,7 @@ REGS_VGA: .DB 10,VGA_R10 ; CURSOR START & CURSOR BLINK .DB 11,VGA_R11 ; CURSOR END .DB 12,0 ; SCRN 1 START (HI) - .DB 13,0 ; SCRN 1 START (LO) + .DB 13,0 ; SCRN 1 START (LO) .DB 18,-1 ; S2 ROW - 1 .DB 27,0 ; VERT SYNC POS ADJ .DB 30,$01 | $08 ; CTL 1, 2 WINDOWS & ENABLE R27 VSYNC FINE ADJ diff --git a/Source/HBIOS/ym2612.asm b/Source/HBIOS/ym2612.asm new file mode 100644 index 00000000..afa4bd48 --- /dev/null +++ b/Source/HBIOS/ym2612.asm @@ -0,0 +1,880 @@ +;------------------------------------------------------------------------------ +; YM2612 sound driver +; Written by: Phil Summers (b1ackmailer) difficultylevelhigh@gmail.com +; +;------------------------------------------------------------------------------ +; References: +; https://hiddenpalace.org/News/Sega_of_Japan_Sound_Documents_and_Source_Code +; https://www.smspower.org/maxim/Documents/YM2612 +; https://plutiedev.com/blog/20200103 +; https://www.plutiedev.com/ym2612-registers +; https://www.plutiedev.com/ym2612-operations +; https://en.wikipedia.org/wiki/Scientific_pitch_notation +; https://gendev.spritesmind.net/forum/viewtopic.php?t=2915 (1) +; http://nemesis.hacking-cult.org/MegaDrive/Documentation/YM2608J.PDF +; +;------------------------------------------------------------------------------ +; Octave range is A#0-B7+3/4 HBIOS note 0..343 +;------------------------------------------------------------------------------ +; +YMSEL .EQU VGMBASE+00H ; Primary YM2162 11000000 a1=0 a0=0 +YMDAT .EQU VGMBASE+01H ; Primary YM2162 11000001 a1=0 a0=1 +YM2SEL .EQU VGMBASE+02H ; Secondary YM2162 11000010 a1=1 a0=0 +YM2DAT .EQU VGMBASE+03H ; Secondary YM2162 11000011 a1=1 a0=1 + +;------------------------------------------------------------------------------ +; Device capabilities and configuration +;------------------------------------------------------------------------------ +; +YM_TONECNT .EQU 6 ; Count number of tone channels +YM_NOISECNT .EQU 0 ; Count number of noise channels +; +YM_PENDING_PERIOD .DW 0 ; PENDING PERIOD (12 BITS) +YM_PENDING_VOLUME .DB 0 ; PENDING VOL (8 BITS) +YM_PENDING_DURATION .DW 0 ; PENDING DURATION (16 BITS) +YM_READY .DB 0 ; BIT 0 -> NZ DRIVER IS READY TO RECEIVE PLAY COMMAND + ; BIT 1 -> NZ EXECUTING WITHIN TIMER HANDLER = DO NOT DIS/ENABLE INT +YM_RDY_RST .DB 0 ; FLAG INDICATES IF DEVICE IS IN READY (NZ) OR RESET STATE (Z) +YM_DEBUG .EQU 0 ; CHANGE TO 1 TO ENABLE DEBUGGING +YM_RSTCFG .EQU 0 ; SET TO 1 FOR FULL REGISTER CLEAR +YM_FAST3438 .EQU 0 ; FAST CPU'S WITH A YM3438 MAY REQUIRE A DELAY +; +;------------------------------------------------------------------------------ +; Driver function table and instance data +;------------------------------------------------------------------------------ +; +YM_FNTBL: .DW YM_RESET + .DW ym_volume + .DW YM_PERIOD + .DW YM_NOTE + .DW YM_PLAY + .DW YM_QUERY + .DW YM_DURATION + .DW YM_DEVICE +; +#IF (($ - YM_FNTBL) != (SND_FNCNT * 2)) + .ECHO "*** INVALID SND FUNCTION TABLE ***\n" + !!!!! +#ENDIF +; +YM_IDAT .EQU 0 ; NO INSTANCE DATA FOR THIS DEVICE +; +;------------------------------------------------------------------------------ +; YM2162 Initialization +; Announce device on console. +; Setup function tables. Setup the device. +; Set volume off. +; Return initialization status +;------------------------------------------------------------------------------ +; +YM2612_INIT: CALL NEWLINE ; ANNOUNCE + PRTS("YM:$") +; + PRTS(" IO=0x$") + LD A,YMSEL + CALL PRTHEXBYTE +; + LD IY, YM_IDAT ; SETUP FUNCTION TABLE + LD BC, YM_FNTBL ; POINTER TO INSTANCE DATA + LD DE, YM_IDAT ; BC := FUNCTION TABLE ADDRESS + CALL SND_ADDENT ; DE := INSTANCE DATA PTR +; +YM_INIT: ld hl,ym_cfg +; call ym_prog +; ret +; +;------------------------------------------------------------------------------ +; Program ym2612 with a list of register entries +;------------------------------------------------------------------------------ +; +ym_prog: ld c,(hl) ; get port address + inc hl + ld d,(hl) ; count of pairs + inc hl +; +#IF (YM_DEBUG) + push af + ld a,c ; port + call PRTHEXBYTE + pop af +#ENDIF +; +t_loop: ld a,(hl) ; get register to write + out (c),a ; write reg to RSEL port +; +#IF (YM_DEBUG) + call PRTHEXBYTE ; register +#ENDIF +; + inc hl + inc c ; point to RDAT port + ld a,(hl) ; get value to write + out (c),a ; write value to RDAT port +; +#IF (YM_DEBUG) + call PRTHEXBYTE + call PC_SPACE +#ENDIF +; + dec c ; point back to RSEL port + ld b,0 ; +nready1: +#IF YM_FAST3438==1) \ cp (ix) \ #ENDIF \ ; ym3438 delay (1) + in a,(c) ; check device + rlca ; ready with timeout + jr nc,ready1 ; bits 7 = busy + djnz nready1 +; +; timed out +; +ready1: inc hl ; + dec d ; decrease # left to do + jr nz,t_loop +; +#IF (YM_DEBUG) + call NEWLINE +#ENDIF +; + ld a,(hl) ; end flag? + or a + jr nz,ym_prog ; no? restart + ret +; +;------------------------------------------------------------------------------ +; Sound driver function - QUERY and subfunctions +;------------------------------------------------------------------------------ +; +YM_QUERY: LD A, E + CP BF_SNDQ_CHCNT ; SUB FUNCTION 01 + JR Z, YM_QUERY_CHCNT +; + CP BF_SNDQ_VOLUME ; SUB FUNCTION 02 + JR Z, YM_QUERY_VOLUME +; + CP BF_SNDQ_PERIOD ; SUB FUNCTION 03 + JR Z, YM_QUERY_PERIOD +; + CP BF_SNDQ_DEV ; SUB FUNCTION 04 + JR Z, YM_QUERY_DEV +; + OR $FF ; SIGNAL FAILURE + RET +; +YM_QUERY_CHCNT: LD BC,(YM_TONECNT*256)+YM_NOISECNT + XOR A ; RETURN NUMBER OF TONE AND NOISE + RET ; NOISE CHANNELS IN BC +; +YM_QUERY_PERIOD:LD HL, (YM_PENDING_PERIOD) ; RETURN 16-BIT PERIOD + XOR A ; IN HL REGISTER + RET +; +YM_QUERY_VOLUME:LD A, (YM_PENDING_VOLUME) ; RETURN 8-BIT VOLUME + LD L, A ; IN L REGISTER + XOR A +; LD H, A + RET +; +YM_QUERY_DEV: LD B, SNDDEV_YM2612 ; RETURN DEVICE IDENTIFIER + LD DE, +(YMSEL*256)+YMDAT ; AND ADDRESS AND DATA PORT + LD HL, +(YM2SEL*256)+YM2DAT + XOR A + RET +; +;------------------------------------------------------------------------------ +; Sound driver function - DEVICE +;------------------------------------------------------------------------------ +; +YM_DEVICE: LD D,SNDDEV_YM2612 ; D := DEVICE TYPE + LD E,0 ; E := PHYSICAL UNIT + LD C,$00 ; C := DEVICE TYPE + LD H,0 ; H := MODE + LD L,YMSEL ; L := BASE I/O ADDRESS + XOR A + RET +; +;------------------------------------------------------------------------------ +; Sound driver function - RESET +; Initialize device. Set volume off. Reset volume and tone variables. +;------------------------------------------------------------------------------ +; +YM_RESET: ;CALL AY_CHKREDY ; RETURNS TO OUR CALLER IF NOT READY +; + PUSH DE + PUSH HL + CALL YM_INIT ; SET DEFAULT CHIP CONFIGURATION +; + XOR A ; SIGNAL SUCCESS + LD (YM_RDY_RST),A ; IN RESET STATE + LD (YM_PENDING_VOLUME),A ; SET VOLUME TO ZERO + LD H,A + LD L,A + LD (YM_PENDING_PERIOD),HL ; SET TONE PERIOD TO ZERO +; + POP HL + POP DE + RET +; +;------------------------------------------------------------------------------ +; Sound driver function - VOLUME +;------------------------------------------------------------------------------ +; +ym_volume: LD A,L ; SAVE VOLUME + LD (YM_PENDING_VOLUME),A + XOR A ; SIGNAL SUCCESS + RET +; +;------------------------------------------------------------------------------ +; Sound driver function - NOTE +;------------------------------------------------------------------------------ +; +YM_NOTE: ;CALL PRTHEXWORDHL + ;CALL PC_COLON + + LD DE,40 ; Calculate the ym2612 block (octave) + ADD HL,DE ; This will go into b13-b11 + LD DE,48 ; HL / DE + CALL DIV16 ; BC = block (octave) HL = quarter semitone note +; + ADD HL,HL + LD DE,ym_notetable ; point HL to frequency entry + ADD HL,DE ; for the quarter semitone note + + ;CALL PRTHEXWORDHL + ;CALL PC_COLON + ;CALL PRTHEXWORD + ;CALL PC_COLON +; + LD A,C ; SHIFT OCTAVE INTO RIGHT POSITION + ADD A,A ; X2 + ADD A,A ; X4 + ADD A,A ; X8 -NEEDS TO BE OR'ED WITH HIGH BYTE +; + LD E,(HL) ; COMBINE FREQUENCY ENTRY + INC HL ; AND BLOCK (OCTAVE) IN HL + OR (HL) + LD H,A + LD L,E + + ;CALL PRTHEXWORDHL +; +;------------------------------------------------------------------------------ +; Sound driver function - PERIOD +; The format for setting frequency on the ym2612 is 00xxxyyy-yyyyyyyy +; Where xxx us the octave and yyy-yyyyyyyy is the frequency +;------------------------------------------------------------------------------ +; +YM_PERIOD: LD A, H ; IF ZERO - ERROR + OR L + JR Z, YM_PERIOD1 +; + LD A, H ; MAXIMUM TONE PERIOD IS 11-BITS + AND 11000000B ; ALLOWED RANGE IS 0001-07FF (2047) + JR NZ,YM_PERIOD1 ; AND 3 BITS FOR OCTAVE (7) + LD (YM_PENDING_PERIOD),HL ; RETURN NZ IF NUMBER TOO LARGE + RET ; SAVE AND RETURN SUCCESSFUL +; +YM_PERIOD1: LD A, $FF ; REQUESTED PERIOD IS LARGER + LD (YM_PENDING_PERIOD),A ; THAN THE DEVICE CAN SUPPORT + LD (YM_PENDING_PERIOD+1),A ; SO SET PERIOD TO FFFF + RET ; AND RETURN FAILURE +; +;------------------------------------------------------------------------------ +; Sound driver function - DURATION +;------------------------------------------------------------------------------ +; +YM_DURATION: LD (YM_PENDING_DURATION),HL ; SET TONE DURATION + XOR A + RET +; +;------------------------------------------------------------------------------ +; Sound driver function - PLAY +; D = CHANNEL +;------------------------------------------------------------------------------ +; +YM_PLAY: ld a,d + cp YM_TONECNT ; error if bad channel + ret nc + + cp 3 ; 000 > 000, 011 > 100 + ld e,part1 ; 001 > 001, 100 > 101 + jr c,ch012 ; 010 > 010, 101 > 110 + sub 3 + ld d,a ; d = 0..2 + add a,4 ; a = 4..6 + jr ch345 +ch012: ld e,part0 +ch345: +; +#IF (YM_DEBUG) + call PC_COLON + call PRTHEXBYTE ; a = 0..2 4..6 + push af + ld a,d + call PRTHEXBYTE ; d = 00..05 + ld a,e + call PRTHEXBYTE ; e = part0/part1 (c0/c2) + pop af + call NEWLINE +#ENDIF +; + ld hl,ym_playcmd01 + ld (hl),e ; set the part +; + ld hl,ym_playcmd00 ; setup keyoff channel + ld (hl),a + ld hl,ym_playcmd09 ; setup keyon channel + or %10000000 ; operator 4 only + ld (hl),a + + ld a,$a4 ; setup frequency register msb + add a,d ; $a4-$a6 + ld hl,ym_playcmd02 + ld (hl),a + + ld a,$a0 ; setup frequency register lsb + add a,d ; $a0-$a2 + ld hl,ym_playcmd04 + ld (hl),a + + ld a,$4c ; setup volume register + add a,d ; $4c-$4e + ld hl,ym_playcmd06 + ld (hl),a + + LD A,(YM_RDY_RST) ; IF STILL IN RESET + OR A ; STATE GO SETUP FOR + CALL Z,YM_MAKE_RDY ; PLAYING +; + ld hl,(YM_PENDING_PERIOD) ; GET THE PREVIOUSLY SETUP + ld de,ym_playcmd03 ; TONE DATA AND + ld a,h + ld (de),a ; PATCH IT INTO THE + ld de,ym_playcmd05 ; YM2612 PLAY COMMAND + ld a,l + ld (de),a +; + ld de,ym_playcmd07 + ld A,(YM_PENDING_VOLUME) ; GET VOLUME + srl a + cpl + and %01111111 ; PATCH IT INTO THE + ld (de),a ; YM2612 PLAY COMMAND +#IF (YM_DEBUG) + ld b,16 ; debug + call NEWLINE ; dump + ld de,ym_playnote ; the +ym_dbgcmd: ld a,(de) ; command + call PRTHEXBYTE ; stream + call PC_SPACE + inc de + djnz ym_dbgcmd + call NEWLINE +#ENDIF + ld hl,ym_playnote ; NOW PLAY IT + jp ym_prog +; +;------------------------------------------------------------------------------ +; Make ready for hbios play +;------------------------------------------------------------------------------ +; +YM_MAKE_RDY: CPL + LD (YM_RDY_RST),A ; Invert the ready flag + ld hl,ym_cfg_ready ; Program ym2612 for playing + jp ym_prog +; +;------------------------------------------------------------------------------ +; Command sequence to play a note +;------------------------------------------------------------------------------ +; +ym_playnote: .db part0, 2/2 + .db $28 +ym_playcmd00: .db $00 ; [0] KEY OFF +; +ym_playcmd01: .db part0,6/2 +ym_playcmd02: .db $A4 +ym_playcmd03: .db $3F ; [X] Frequency MSB +ym_playcmd04: .db $A0 +ym_playcmd05: .db $FF ; [X] Frequency LSB +ym_playcmd06: .db $4C +ym_playcmd07: .db $00 ; [X] Volume +; + .db part0, 2/2 +ym_playcmd08: .db $28 +ym_playcmd09: .db $F0 ; [0] KEY ON + + .db $00 ; End flag +; +;------------------------------------------------------------------------------ +; Quarter semitone F-Number values for frequency +;------------------------------------------------------------------------------ +; +ym_notetable: .dw 644 ; C ; 152 + .dw 653 ; approx + .dw 663 ; approx + .dw 672 ; approx + .dw 681 ; C# ; 156 + .dw 691 ; approx + .dw 702 ; approx + .dw 712 ; approx + .dw 722 ; D ; 160 + .dw 733 ; approx + .dw 744 ; approx + .dw 754 ; approx + .dw 765 ; D# ; 164 + .dw 776 ; approx + .dw 788 ; approx + .dw 799 ; approx + .dw 810 ; E ; 168 + .dw 822 ; approx + .dw 834 ; approx + .dw 846 ; approx + .dw 858 ; F ; 172 + .dw 871 ; approx + .dw 884 ; approx + .dw 897 ; approx + .dw 910 ; F# ; 176 + .dw 924 ; approx + .dw 937 ; approx + .dw 951 ; approx + .dw 964 ; G ; 180 + .dw 978 ; approx + .dw 993 ; approx + .dw 1007 ; approx + .dw 1021 ; G# ; 184 + .dw 1036 ; approx + .dw 1051 ; approx + .dw 1066 ; approx + .dw 1081 ; A ; 188 + .dw 1097 ; approx + .dw 1114 ; approx + .dw 1130 ; approx + .dw 1146 ; A# ; 192 + .dw 1163 ; approx + .dw 1180 ; approx + .dw 1197 ; approx + .dw 1214 ; B ; 196 + .dw 1232 ; approx + .dw 1250 ; approx + .dw 1268 ; approx +; +;------------------------------------------------------------------------------ +; Register configuration data for play +;------------------------------------------------------------------------------ +; +ym_cfg_ready: .db part0, 2/2 + .db $22, $00 ; Global: LFO disable +; + .db part0, 6/2 + .db $B0,$30 ; Channel 1-3 + .db $b1,$30 ; Algorithm 0 S1>S2>S3>S4 + .db $b2,$30 ; Feedback pure sine wave +; + .db part1, 6/2 + .db $B0,$30 ; Channel 4-6 + .db $b1,$30 ; Algorithm 0 S1>S2>S3>S4 + .db $b2,$30 ; Feedback pure sine wave +; + .db part0, 6/2 + .db $3c, $01 ; Channel 1-3 + .db $3d, $01 ; Operator 4.MUL = 1 + .db $3e, $01 +; + .db part1, 6/2 + .db $3c, $01 ; Channel 4-6 + .db $3d, $01 ; Operator 4.MUL = 1 + .db $3e, $01 +; + .db part0, 6/2 + .db $b4,%01000000 ; Channel 1-3 + .db $b5,%01000000 ; Left Channel + .db $b6,%01000000 +; + .db part1, 6/2 + .db $b4,%10000000 ; Channel 4-6 + .db $b5,%10000000 ; Right Channel + .db $b6,%10000000 +; + .db part0, 6/2 + .db $44, $7F ; Channel 1-3 + .db $45, $7F ; Mute operator 3 <- pure sine wave + .db $46, $7F +; + .db part1, 6/2 + .db $44, $7F ; Channel 4-6 + .db $45, $7F ; Mute operator 3 <- pure sine wave + .db $46, $7F +; + .db part0, 6/2 + .db $4C, $00 ; Channel 1-3 + .db $4d, $00 ; Max volume for operator 4 + .db $4e, $00 +; + .db part1, 6/2 + .db $4C, $00 ; Channel 4-6 + .db $4d, $00 ; Max volume for operator 4 + .db $4e, $00 +; + .db part0, 6/2 + .db $5C, $1F ; Channel 1-3 + .db $5d, $1F ; Operator 4.AR = shortest + .db $5e, $1F +; + .db part1, 6/2 + .db $5C, $1F ; Channel 4-6 + .db $5d, $1F ; Operator 4.AR = shortest + .db $5e, $1F +; + .db part0, 6/2 + .db $6C, $06 ; Channel 1-3 + .db $6d, $06 ; Operator 4.D1R= 6 + .db $6e, $06 +; + .db part1, 6/2 + .db $6C, $06 ; Channel 4-6 + .db $6d, $06 ; Operator 4.D1R= 6 + .db $6e, $06 +; + .db part0, 6/2 + .db $7C, $1F ; Channel 1-3 + .db $7d, $1F ; Operator 4.D2R= 31 + .db $7e, $1F +; + .db part1, 6/2 + .db $7C, $1F ; Channel 4-6 + .db $7d, $1F ; Operator 4.D2R= 31 + .db $7e, $1F +; + .db part0, 6/2 + .db $8C, $FF ; Channel 1-3 + .db $8d, $FF ; Operator 4.SL = 15 / Operator4. RR=15 + .db $8e, $FF +; + .db part1, 6/2 + .db $8C, $FF ; Channel 4-6 + .db $8d, $FF ; Operator 4.SL = 15 / Operator4. RR=15 + .db $8e, $FF +; + .db $00 ; End flag +; +; +;------------------------------------------------------------------------------ +; Register configuration data for soft reset state +;------------------------------------------------------------------------------ +; +part0: .equ YMSEL +part1: .equ YM2SEL +; +#IF (YM_RSTCFG==0) +ym_cfg: .db part0, 24/2 + .db $22,$00 ; [0] lfo off + .db $27,$00 ; [0] Disable independant Channel 3 + .db $28,$00 ; [0] note off ch 1 + .db $28,$01 ; [0] note off ch 2 + .db $28,$02 ; [0] note off ch 3 + .db $28,$04 ; [0] note off ch 4 + .db $28,$05 ; [0] note off ch 5 + .db $28,$06 ; [0] note off ch 6 + .db $2b,$00 ; [0] dac off + .db $b4,$00 ; [0] sound off ch 1-3 + .db $b5,$00 + .db $b6,$00 +; + .db part1, 6/2 + .db $b4,$00 ; [1] sound off ch 4-6 + .db $b5,$00 ; [1] + .db $b6,$00 ; [1] +; + .db part0, 24/2 + .db $40,$7f ; [0] ch 1-3 total level minimum + .db $41,$7f ; [0] + .db $42,$7f ; [0] + .db $44,$7f ; [0] + .db $45,$7f ; [0] + .db $46,$7f ; [0] + .db $48,$7f ; [0] + .db $49,$7f ; [0] + .db $4a,$7f ; [0] + .db $4c,$7f ; [0] + .db $4d,$7f ; [0] + .db $4e,$7f ; [0] +; + .db part1, 24/2 + .db $40,$7f ; [1] ch 4-6 total level minimum + .db $41,$7f ; [1] + .db $42,$7f ; [1] + .db $44,$7f ; [1] + .db $45,$7f ; [1] + .db $46,$7f ; [1] + .db $48,$7f ; [1] + .db $49,$7f ; [1] + .db $4a,$7f ; [1] + .db $4c,$7f ; [1] + .db $4d,$7f ; [1] + .db $4e,$7f ; [1] +; + .db $00 ; End flag +; +;------------------------------------------------------------------------------ +; Register configuration data for hard reset state +;------------------------------------------------------------------------------ +; +#ELSE +ym_cfg: .db part0, 24/2 + .db $22,$00 ; [0] lfo off + .db $27,$00 ; [0] Disable independant Channel 3 + .db $28,$00 ; [0] note off ch 1 + .db $28,$01 ; [0] note off ch 2 + .db $28,$02 ; [0] note off ch 3 + .db $28,$04 ; [0] note off ch 4 + .db $28,$05 ; [0] note off ch 5 + .db $28,$06 ; [0] note off ch 6 + .db $2b,$00 ; [0] dac off + .db $b4,$00 ; [0] sound off ch 1-3 + .db $b5,$00 ; [0] + .db $b6,$00 ; [0] + + .db part1, 6/2 + .db $b4,$00 ; [1] sound off ch 4-6 + .db $b5,$00 ; [1] + .db $b6,$00 ; [1] + + .db part0, 24/2 + .db $40,$7f ; [0] ch 1-3 total level minimum + .db $41,$7f ; [0] + .db $42,$7f ; [0] + .db $44,$7f ; [0] + .db $45,$7f ; [0] + .db $46,$7f ; [0] + .db $48,$7f ; [0] + .db $49,$7f ; [0] + .db $4a,$7f ; [0] + .db $4c,$7f ; [0] + .db $4d,$7f ; [0] + .db $4e,$7f ; [0] + + .db part1, 24/2 + .db $40,$7f ; [1] ch 4-6 total level minimum + .db $41,$7f ; [1] + .db $42,$7f ; [1] + .db $44,$7f ; [1] + .db $45,$7f ; [1] + .db $46,$7f ; [1] + .db $48,$7f ; [1] + .db $49,$7f ; [1] + .db $4a,$7f ; [1] + .db $4c,$7f ; [1] + .db $4d,$7f ; [1] + .db $4e,$7f ; [1] + + .db part0, 32/2 + .db $2a,$00 ; [0] ; dac value + .db $24,$00 ; [0] ; timer A frequency + .db $25,$00 ; [0] ; timer A frequency + .db $26,$00 ; [0] ; time B frequency + .db $30,$00 ; [0] ; ch 1-3 multiply & detune + .db $31,$00 ; [0] + .db $32,$00 ; [0] + .db $34,$00 ; [0] + .db $35,$00 ; [0] + .db $36,$00 ; [0] + .db $38,$00 ; [0] + .db $39,$00 ; [0] + .db $3a,$00 ; [0] + .db $3c,$00 ; [0] + .db $3d,$00 ; [0] + .db $3e,$00 ; [0] + + .db part1, 24/2 + .db $30,$00 ; [1] ch 4-6 multiply & detune + .db $31,$00 ; [1] + .db $32,$00 ; [1] + .db $34,$00 ; [1] + .db $35,$00 ; [1] + .db $36,$00 ; [1] + .db $38,$00 ; [1] + .db $39,$00 ; [1] + .db $3a,$00 ; [1] + .db $3c,$00 ; [1] + .db $3d,$00 ; [1] + .db $3e,$00 ; [1] + + .db part0, 24/2 + .db $50,$00 ; [0] ch 1-3 attack rate and scaling + .db $51,$00 ; [0] + .db $52,$00 ; [0] + .db $54,$00 ; [0] + .db $55,$00 ; [0] + .db $56,$00 ; [0] + .db $58,$00 ; [0] + .db $59,$00 ; [0] + .db $5a,$00 ; [0] + .db $5c,$00 ; [0] + .db $5d,$00 ; [0] + .db $5e,$00 ; [0] + + .db part1, 24/2 + .db $50,$00 ; [1] ch 4-6 attack rate and scaling + .db $51,$00 ; [1] + .db $52,$00 ; [1] + .db $54,$00 ; [1] + .db $55,$00 ; [1] + .db $56,$00 ; [1] + .db $58,$00 ; [1] + .db $59,$00 ; [1] + .db $5a,$00 ; [1] + .db $5c,$00 ; [1] + .db $5d,$00 ; [1] + .db $5e,$00 ; [1] + + .db part0, 24/2 + .db $60,$00 ; [0] ch 1-3 decay rate and am enable + .db $61,$00 ; [0] + .db $62,$00 ; [0] + .db $64,$00 ; [0] + .db $65,$00 ; [0] + .db $66,$00 ; [0] + .db $68,$00 ; [0] + .db $69,$00 ; [0] + .db $6a,$00 ; [0] + .db $6c,$00 ; [0] + .db $6d,$00 ; [0] + .db $6e,$00 ; [0] + + .db part1, 24/2 + .db $60,$00 ; [1] ch 4-6 decay rate and am enable + .db $61,$00 ; [1] + .db $62,$00 ; [1] + .db $64,$00 ; [1] + .db $65,$00 ; [1] + .db $66,$00 ; [1] + .db $68,$00 ; [1] + .db $69,$00 ; [1] + .db $6a,$00 ; [1] + .db $6c,$00 ; [1] + .db $6d,$00 ; [1] + .db $6e,$00 ; [1] + + .db part0, 24/2 + .db $70,$00 ; [0] ch 1-3 sustain rate + .db $71,$00 ; [0] + .db $72,$00 ; [0] + .db $74,$00 ; [0] + .db $75,$00 ; [0] + .db $76,$00 ; [0] + .db $78,$00 ; [0] + .db $79,$00 ; [0] + .db $7a,$00 ; [0] + .db $7c,$00 ; [0] + .db $7d,$00 ; [0] + .db $7e,$00 ; [0] + + .db part1, 24/2 + .db $70,$00 ; [1] ch 4-6 sustain rate + .db $71,$00 ; [1] + .db $72,$00 ; [1] + .db $74,$00 ; [1] + .db $75,$00 ; [1] + .db $76,$00 ; [1] + .db $78,$00 ; [1] + .db $79,$00 ; [1] + .db $7a,$00 ; [1] + .db $7c,$00 ; [1] + .db $7d,$00 ; [1] + .db $7e,$00 ; [1] + + .db part0, 24/2 + .db $80,$00 ; [0] ch 1-3 release rate and sustain level + .db $81,$00 ; [0] + .db $82,$00 ; [0] + .db $84,$00 ; [0] + .db $85,$00 ; [0] + .db $86,$00 ; [0] + .db $88,$00 ; [0] + .db $89,$00 ; [0] + .db $8a,$00 ; [0] + .db $8c,$00 ; [0] + .db $8d,$00 ; [0] + .db $8e,$00 ; [0] + + .db part1, 24/2 + .db $80,$00 ; [1] ch 4-6 release rate and sustain level + .db $81,$00 ; [1] + .db $82,$00 ; [1] + .db $84,$00 ; [1] + .db $85,$00 ; [1] + .db $86,$00 ; [1] + .db $88,$00 ; [1] + .db $89,$00 ; [1] + .db $8a,$00 ; [1] + .db $8c,$00 ; [1] + .db $8d,$00 ; [1] + .db $8e,$00 ; [1] + + .db part0, 24/2 + .db $90,$00 ; [0] ch 1-3 ssg-eg + .db $91,$00 ; [0] + .db $92,$00 ; [0] + .db $94,$00 ; [0] + .db $95,$00 ; [0] + .db $96,$00 ; [0] + .db $98,$00 ; [0] + .db $99,$00 ; [0] + .db $9a,$00 ; [0] + .db $9c,$00 ; [0] + .db $9d,$00 ; [0] + .db $9e,$00 ; [0] + + .db part1, 24/2 + .db $90,$00 ; [1] ch 4-6 ssg-eg + .db $91,$00 ; [1] + .db $92,$00 ; [1] + .db $94,$00 ; [1] + .db $95,$00 ; [1] + .db $96,$00 ; [1] + .db $98,$00 ; [1] + .db $99,$00 ; [1] + .db $9a,$00 ; [1] + .db $9c,$00 ; [1] + .db $9d,$00 ; [1] + .db $9e,$00 ; [1] + + .db part0, 12/2 + .db $a0,$00 ; [0] ch 1-3 frequency + .db $a1,$00 ; [0] + .db $a2,$00 ; [0] + .db $a4,$00 ; [0] + .db $a5,$00 ; [0] + .db $a6,$00 ; [0] +; .db $a8,$00 ; [0] ch 3 special mode +; .db $a9,$00 ; [0] +; .db $aa,$00 ; [0] +; .db $ac,$00 ; [0] +; .db $ad,$00 ; [0] +; .db $ae,$00 ; [0] + + .db part1, 12/2 + .db $a0,$00 ; [1] ch 4-6 frequency + .db $a1,$00 ; [1] + .db $a2,$00 ; [1] + .db $a4,$00 ; [1] + .db $a5,$00 ; [1] + .db $a6,$00 ; [1] +; .db $a8,$00 ; [1] ch 3 special mode +; .db $a9,$00 ; [1] +; .db $aa,$00 ; [1] +; .db $ac,$00 ; [1] +; .db $ad,$00 ; [1] +; .db $ae,$00 ; [1] + + .db part0, 6/2 + .db $b0,$00 ; [0] ch 1-3 algorith + feedback + .db $b1,$00 ; [0] + .db $b2,$00 ; [0] + + .db part1, 6/2 + .db $b0,$00 ; [1] ch 4-6 algorith + feedback + .db $b1,$00 ; [1] + .db $b2,$00 ; [1] +; + .db $00 ; End flag +#ENDIF diff --git a/Source/HBIOS/z180.inc b/Source/HBIOS/z180.inc index 5ceb0bae..196019ff 100644 --- a/Source/HBIOS/z180.inc +++ b/Source/HBIOS/z180.inc @@ -64,4 +64,4 @@ Z180_BBR .EQU Z180_BASE + $39 ; MMU BANK BASE REGISTER Z180_CBAR .EQU Z180_BASE + $3A ; MMU COMMON/BANK AREA REGISTER ; Z180_OMCR .EQU Z180_BASE + $3E ; OPERATION MODE CONTROL -Z180_ICR .EQU $3F ; I/O CONTROL REGISTER (NOT RELOCATED!!!) +Z180_ICR .EQU Z180_BASE + $3F ; I/O CONTROL REGISTER diff --git a/Source/HBIOS/z280.inc b/Source/HBIOS/z280.inc new file mode 100644 index 00000000..3c4e23b4 --- /dev/null +++ b/Source/HBIOS/z280.inc @@ -0,0 +1,74 @@ +; +; Z280 CPU CONTROL REGISTERS (VIA LDCTL) +; +Z280_MSR .EQU $00 ; MASTER STATUS REG +Z280_ISR .EQU $16 ; INTERRUPT STATUS REG +Z280_VPR .EQU $06 ; INT/TRAP VECT PTR REG +Z280_IOPR .EQU $08 ; I/O PAGE REG +Z280_BTIR .EQU $FF ; BUS TIMING & INIT REG +Z280_BTCR .EQU $02 ; BUS TIMING & CONTROL REG +Z280_SLR .EQU $04 ; STACK LIMIT REG +Z280_TCR .EQU $10 ; TRAP CONTROL REG +Z280_CCR .EQU $12 ; CACHE CONTROL REG +Z280_LAR .EQU $14 ; LOCAL ADDRESS REG +; +; Z280 PAGE $FF REGSISTER ADDRESSES +; +Z280_RRR .EQU $E8 ; Z280 REFRESH RATE REG +; +Z280_MMUMCR .EQU $F0 ; Z280 MMU MASTER CONTROL REG +Z280_MMUPDRPTR .EQU $F1 ; Z280 MMU PDR POINTER REG +Z280_MMUINV .EQU $F2 ; Z280 MMU INVALIDATION PORT +Z280_MMUBLKMOV .EQU $F4 ; Z280 MMU BLOCK MOVE PORT +Z280_MMUPDR .EQU $F5 ; Z280 MMU PDR PORT +; +Z280_DMA0_DSTL .EQU $00 ; DMA0 DESTINATION ADDRESS LOW +Z280_DMA0_DSTH .EQU $01 ; DMA0 DESTINATION ADDRESS HIGH +Z280_DMA0_SRCL .EQU $02 ; DMA0 SOURCE ADDRESS LOW +Z280_DMA0_SRCH .EQU $03 ; DMA0 SOURCE ADDRESS HIGH +Z280_DMA0_CNT .EQU $04 ; DMA0 COUNT +Z280_DMA0_TDR .EQU $05 ; DMA0 TRANSACTION DESCRIPTION REG +; +Z280_DMA1_DSTL .EQU $08 ; DMA1 DESTINATION ADDRESS LOW +Z280_DMA1_DSTH .EQU $09 ; DMA1 DESTINATION ADDRESS HIGH +Z280_DMA1_SRCL .EQU $0A ; DMA1 SOURCE ADDRESS LOW +Z280_DMA1_SRCH .EQU $0B ; DMA1 SOURCE ADDRESS HIGH +Z280_DMA1_CNT .EQU $0C ; DMA1 COUNT +Z280_DMA1_TDR .EQU $0D ; DMA1 TRANSACTION DESCRIPTION REG +; +Z280_DMA2_DSTL .EQU $10 ; DMA2 DESTINATION ADDRESS LOW +Z280_DMA2_DSTH .EQU $11 ; DMA2 DESTINATION ADDRESS HIGH +Z280_DMA2_SRCL .EQU $12 ; DMA2 SOURCE ADDRESS LOW +Z280_DMA2_SRCH .EQU $13 ; DMA2 SOURCE ADDRESS HIGH +Z280_DMA2_CNT .EQU $14 ; DMA2 COUNT +Z280_DMA2_TDR .EQU $15 ; DMA2 TRANSACTION DESCRIPTION REG +; +Z280_DMA3_DSTL .EQU $18 ; DMA3 DESTINATION ADDRESS LOW +Z280_DMA3_DSTH .EQU $19 ; DMA3 DESTINATION ADDRESS HIGH +Z280_DMA3_SRCL .EQU $1A ; DMA3 SOURCE ADDRESS LOW +Z280_DMA3_SRCH .EQU $1B ; DMA3 SOURCE ADDRESS HIGH +Z280_DMA3_CNT .EQU $1C ; DMA3 COUNT +Z280_DMA3_TDR .EQU $1D ; DMA3 TRANSACTION DESCRIPTION REG +; +; Z280 PAGE $FE REGISTER ADDRESSES +; +Z280_UARTCFG .EQU $10 ; UART CONFIG REG +Z280_UARTXCTL .EQU $12 ; UART TRANSMIT CONTROL/STATUS REG +Z280_UARTRCTL .EQU $14 ; UART RECEIVE CONTROL/STATUS REG +Z280_UARTRECV .EQU $16 ; UART RECEIVE DATA REG +Z280_UARTXMIT .EQU $18 ; UART TRANSMIT DATA REG +; +Z280_CT0_CFG .EQU $E0 ; COUNTER/TIMER 0 CONFIG REG +Z280_CT0_CMDST .EQU $E1 ; COUNTER/TIMER 0 COMMAND/STATUS REG +Z280_CT0_TC .EQU $E2 ; COUNTER/TIMER 0 TIME CONSTANT +Z280_CT0_CT .EQU $E3 ; COUNTER/TIMER 0 COUNT TIME +; +Z280_CT1_CFG .EQU $E8 ; COUNTER/TIMER 1 CONFIG REG +Z280_CT1_CMDST .EQU $E9 ; COUNTER/TIMER 1 COMMAND/STATUS REG +Z280_CT1_TC .EQU $EA ; COUNTER/TIMER 1 TIME CONSTANT +Z280_CT1_CT .EQU $EB ; COUNTER/TIMER 1 COUNT TIME +; +Z280_CT2_CFG .EQU $F8 ; COUNTER/TIMER 2 CONFIG REG +Z280_CT2_CMDST .EQU $F9 ; COUNTER/TIMER 2 COMMAND/STATUS REG +Z280_CT2_TC .EQU $FA ; COUNTER/TIMER 2 TIME CONSTANT +Z280_CT2_CT .EQU $FB ; COUNTER/TIMER 2 COUNT TIME diff --git a/Source/HBIOS/z2u.asm b/Source/HBIOS/z2u.asm new file mode 100644 index 00000000..d4ac9ac3 --- /dev/null +++ b/Source/HBIOS/z2u.asm @@ -0,0 +1,720 @@ +; +;================================================================================================== +; Z280 UART DRIVER (Z280 BUILT-IN UART) +;================================================================================================== +; +; SETUP PARAMETER WORD: +; +-------+---+-------------------+ +---+---+-----------+---+-------+ +; | |RTS| ENCODED BAUD RATE | |DTR|XON| PARITY |STP| 8/7/6 | +; +-------+---+---+---------------+ ----+---+-----------+---+-------+ +; F E D C B A 9 8 7 6 5 4 3 2 1 0 +; -- MSB (D REGISTER) -- -- LSB (E REGISTER) -- +; +; CONFIG ($FE__10): +; 7 6 5 4 3 2 1 0 +; 1 1 0 0 0 0 1 0 DEFAULT VALUES +; | | | | | | | | +; | | | | | | | | +; | | | | | | | +-- LB: LOOP BACK ENABLE +; | | | | | + +---- CR: CLOCK RATE +; | | | | +-------- CS: CLOCK SELECT +; | | | +---------- E/O: EVEN/ODD +; | | +------------ P: PARITY +; + +-------------- B/C: BITS PER CHARACTER +; +; TRANSMITTER CONTROL/STATUS REGISTER ($FE__12) +; 7 6 5 4 3 2 1 0 +; 1 0 0 0 0 0 0 0 DEFAULT VALUES +; | | | | | | | | +; | | | | | | | +-- BE: BUFFER EMPTY +; | | | | | | +---- VAL: VALUE +; | | | | | +------ FRC: FORCE CHARACTER +; | | | | +-------- BRK: SEND BREAK +; | | | +---------- SB: STOP BITS +; | | +------------ 0: RESERVED (SET TO 0) +; | +-------------- IE: XMIT INT ENBABLE +; +---------------- EN: TRANSMITTER ENABLE +; +; RECEIVER CONTROL/STATUS REGISTER ($FE__14) +; 7 6 5 4 3 2 1 0 +; 1 0 0 0 0 0 0 0 DEFAULT VALUES +; | | | | | | | | +; | | | | | | | +-- ERR: LOGICAL OR OF (OVE, PE, FE) +; | | | | | | +---- OVE: OVERRUN ERROR +; | | | | | +------ PE: PARITY ERROR +; | | | | +-------- FE: FRAMING ERROR +; | | | +---------- CA: RECEIVE CHAR AVAILABLE +; | | +------------ 0: RESERVED (SET TO 0) +; | +-------------- IE: RECEIVER INT ENBABLE +; +---------------- EN: RECEIVER ENABLE +; +; INTERRUPT DRIVEN PROCESSING IS ONLY USED WHEN THE SYSTEM IS IN +; INTERRUPT MODE 3. THIS IS BECAUSE THE BUILT-IN UART *ALWAYS* USES +; MODE 3 PROCESSING. SINCE MODE 3 PROCESSING REQUIRES THE MODE 3 +; INTERRUPT VECTOR TABLE WHICH IS LARGE AND WON'T FIT WELL IN HIGH +; RAM, IT IS IMPRACTICAL TO IMPLEMENT ANY INTERRUPT DRIVEN PROCESSING +; UNLESS FULL BLOWN INTERRUPT MODE 3 W/ NATIVE MEMORY MANAGEMENT +; IS BEING USED. +; +; +; +#IF (Z2U0HFC) +Z2U_BUFSZ .EQU 32 ; RECEIVE RING BUFFER SIZE +#ELSE +Z2U_BUFSZ .EQU 144 ; RECEIVE RING BUFFER SIZE +#ENDIF +; +Z2U_NONE .EQU 0 ; NOT PRESENT +Z2U_PRESENT .EQU 1 ; PRESENT +; +; +; +Z2U_PREINIT: +; +; SETUP THE DISPATCH TABLE ENTRIES +; NOTE: INTS WILL BE DISABLED WHEN PREINIT IS CALLED AND THEY MUST REMAIN +; DISABLED. +; + LD B,Z2U_CFGCNT ; LOOP CONTROL + XOR A ; ZERO TO ACCUM + LD (Z2U_DEV),A ; CURRENT DEVICE NUMBER + LD IY,Z2U_CFG ; POINT TO START OF CFG TABLE +Z2U_PREINIT0: + PUSH BC ; SAVE LOOP CONTROL + CALL Z2U_INITUNIT ; HAND OFF TO GENERIC INIT CODE + POP BC ; RESTORE LOOP CONTROL +; + LD A,(IY+1) ; GET THE Z280 UART TYPE DETECTED + OR A ; SET FLAGS + JR Z,Z2U_PREINIT2 ; SKIP IT IF NOTHING FOUND +; + PUSH BC ; SAVE LOOP CONTROL + PUSH IY ; CFG ENTRY ADDRESS + POP DE ; ... TO DE + LD BC,Z2U_FNTBL ; BC := FUNCTION TABLE ADDRESS + CALL NZ,CIO_ADDENT ; ADD ENTRY IF Z2U FOUND, BC:DE + POP BC ; RESTORE LOOP CONTROL +; +Z2U_PREINIT2: + LD DE,Z2U_CFGSIZ ; SIZE OF CFG ENTRY + ADD IY,DE ; BUMP IY TO NEXT ENTRY + DJNZ Z2U_PREINIT0 ; LOOP UNTIL DONE +; +#IF (INTMODE == 3) + ; SETUP INT VECTORS AS APPROPRIATE + LD A,(Z2U_DEV) ; GET DEVICE COUNT + OR A ; SET FLAGS + JR Z,Z2U_PREINIT3 ; IF ZERO, NO Z2U DEVICES, ABORT +; + LD HL,Z2U_INT ; GET INT VECTOR + LD (Z280_IVT+$36),HL ; SET IT +#ENDIF +; +Z2U_PREINIT3: + XOR A ; SIGNAL SUCCESS + RET ; AND RETURN +; +; Z280 UART INITIALIZATION ROUTINE +; +Z2U_INITUNIT: + CALL Z2U_DETECT ; DETERMINE Z280 UART TYPE + LD (IY+1),A ; SAVE IN CONFIG TABLE + OR A ; SET FLAGS + RET Z ; ABORT IF NOTHING THERE + + ; UPDATE WORKING Z280 UART DEVICE NUM + LD HL,Z2U_DEV ; POINT TO CURRENT UART DEVICE NUM + LD A,(HL) ; PUT IN ACCUM + INC (HL) ; INCREMENT IT (FOR NEXT LOOP) + LD (IY),A ; UPDATE UNIT NUM +; + ; IT IS EASY TO SPECIFY A SERIAL CONFIG THAT CANNOT BE IMPLEMENTED + ; DUE TO THE CONSTRAINTS OF THE Z280 UART. HERE WE FORCE A GENERIC + ; FAILSAFE CONFIG ONTO THE CHANNEL. IF THE SUBSEQUENT "REAL" + ; CONFIG FAILS, AT LEAST THE CHIP WILL BE ABLE TO SPIT DATA OUT + ; AT A RATIONAL BAUD/DATA/PARITY/STOP CONFIG. + CALL Z2U_INITSAFE +; + ; SET DEFAULT CONFIG + LD DE,-1 ; LEAVE CONFIG ALONE + ; CALL INITDEV TO IMPLEMENT CONFIG, BUT NOTE THAT WE CALL + ; THE INITDEVX ENTRY POINT THAT DOES NOT ENABLE/DISABLE INTS! + JP Z2U_INITDEVX ; IMPLEMENT IT AND RETURN +; +; +; +Z2U_INIT: + LD B,Z2U_CFGCNT ; COUNT OF POSSIBLE Z2U UNITS + LD IY,Z2U_CFG ; POINT TO START OF CFG TABLE +Z2U_INIT1: + PUSH BC ; SAVE LOOP CONTROL + LD A,(IY+1) ; GET Z2U TYPE + OR A ; SET FLAGS + CALL NZ,Z2U_PRTCFG ; PRINT IF NOT ZERO + POP BC ; RESTORE LOOP CONTROL + LD DE,Z2U_CFGSIZ ; SIZE OF CFG ENTRY + ADD IY,DE ; BUMP IY TO NEXT ENTRY + DJNZ Z2U_INIT1 ; LOOP TILL DONE +; + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; RECEIVE INTERRUPT HANDLER +; +#IF (INTMODE == 3) +; +; INT ENTRY POINT +; +Z2U_INT: + ; DISCARD REASON CODE + INC SP + INC SP +; + ; SAVE REGISTERS + PUSH AF + PUSH BC + PUSH DE + PUSH HL +; + ; START BY SELECTING I/O PAGE $FE (SAVING PREVIOUS VALUE) + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL HL,(C) ; GET CURRENT I/O PAGE + PUSH HL ; SAVE IT + LD L,$FE ; NEW COUNTER/TIMER I/O PAGE + LDCTL (C),HL +; + ; CHECK TO SEE IF SOMETHING IS ACTUALLY THERE + IN A,(Z280_UARTRCTL) ; GET STATUS + AND $10 ; ISOLATE CHAR AVAILABLE BIT + JR Z,Z2U_INTRCV4 ; IF NOT, BAIL OUT +; +Z2U_INTRCV1: + ; RECEIVE CHARACTER INTO BUFFER + IN A,(Z280_UARTRECV) ; GET A BYTE + LD B,A ; SAVE BYTE READ + LD HL,Z2U0_RCVBUF ; SET HL TO START OF BUFFER STRUCT + LD A,(HL) ; GET COUNT + CP Z2U_BUFSZ ; COMPARE TO BUFFER SIZE + JR Z,Z2U_INTRCV4 ; BAIL OUT IF BUFFER FULL, RCV BYTE DISCARDED + INC A ; INCREMENT THE COUNT + LD (HL),A ; AND SAVE IT +#IF (Z2U0HFC) + CP Z2U_BUFSZ / 2 ; BUFFER GETTING FULL? + JR NZ,Z2U_INTRCV2 ; IF NOT, BYPASS CLEARING RTS + PUSH HL ; SAVE HL + LD HL,0 ; TC VALUE 0 CAUSES HIGH OUTPUT (RTS DEASSERTED) + LD C,Z280_CT2_TC ; SET C/T 2 + OUTW (C),HL + POP HL ; RESTORE HL +#ENDIF +Z2U_INTRCV2: + INC HL ; HL NOW HAS ADR OF HEAD PTR + PUSH HL ; SAVE ADR OF HEAD PTR + LD HL,(HL) ; DEREFERENCE HL, HL IS NOW ACTUAL HEAD PTR + LD (HL),B ; SAVE CHARACTER RECEIVED IN BUFFER AT HEAD + INC HL ; BUMP HEAD POINTER + POP DE ; RECOVER ADR OF HEAD PTR + LD A,L ; GET LOW BYTE OF HEAD PTR + SUB Z2U_BUFSZ+4 ; SUBTRACT SIZE OF BUFFER AND POINTER + CP E ; IF EQUAL TO START, HEAD PTR IS PAST BUF END + JR NZ,Z2U_INTRCV3 ; IF NOT, BYPASS + LD H,D ; SET HL TO + LD L,E ; ... HEAD PTR ADR + INC HL ; BUMP PAST HEAD PTR + INC HL + INC HL + INC HL ; ... SO HL NOW HAS ADR OF ACTUAL BUFFER START +Z2U_INTRCV3: + EX DE,HL ; DE := HEAD PTR VAL, HL := ADR OF HEAD PTR + LD (HL),DE ; SAVE UPDATED HEAD PTR + + ; CHECK FOR MORE PENDING... + IN A,(Z280_UARTRCTL) ; GET STATUS + AND $10 ; ISOLATE CHAR AVAILABLE BIT + JR NZ,Z2U_INTRCV1 +; +Z2U_INTRCV4: + ; RESTORE I/O PAGE + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + POP HL ; RECOVER ORIGINAL I/O PAGE + LDCTL (C),HL +; + ; RESTORE REGISTERS + POP HL + POP DE + POP BC + POP AF +; + RETIL +#ENDIF +; +; DRIVER FUNCTION TABLE +; +Z2U_FNTBL: + .DW Z2U_IN + .DW Z2U_OUT + .DW Z2U_IST + .DW Z2U_OST + .DW Z2U_INITDEV + .DW Z2U_QUERY + .DW Z2U_DEVICE +#IF (($ - Z2U_FNTBL) != (CIO_FNCNT * 2)) + .ECHO "*** INVALID Z2U FUNCTION TABLE ***\n" +#ENDIF +; +#IF (INTMODE < 3) +; +Z2U_IN: + CALL Z2U_IST ; CHECK FOR CHAR READY + JR Z,Z2U_IN ; IF NOT, LOOP +; + ; START BY SELECTING I/O PAGE $FE + LD L,$FE ; Z280 UART REGISTERS AT I/O PAGE $FE + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; + ; GET CHAR + IN A,(Z280_UARTRECV) ; GET A BYTE + LD E,A ; PUT IN E FOR RETURN +; + ; RESTORE I/O PAGE TO $00 + LD L,$00 ; NORMAL I/O REG IS $00 + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +#ELSE +; +Z2U_IN: + CALL Z2U_IST ; SEE IF CHAR AVAILABLE + JR Z,Z2U_IN ; LOOP UNTIL SO + HB_DI ; AVOID COLLISION WITH INT HANDLER + LD L,(IY+6) ; SET HL TO + LD H,(IY+7) ; ... START OF BUFFER STRUCT + LD A,(HL) ; GET COUNT + DEC A ; DECREMENT COUNT + LD (HL),A ; SAVE UPDATED COUNT +; +#IF (Z2U0HFC) + CP Z2U_BUFSZ / 4 ; BUFFER LOW THRESHOLD + JR NZ,Z2U_IN1 ; IF NOT, BYPASS SETTING RTS +; + ; ASSERT RTS + PUSH HL + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL HL,(C) ; GET CURRENT I/O PAGE + PUSH HL ; SAVE IT + LD L,$FE ; NEW COUNTER/TIMER I/O PAGE + LDCTL (C),HL + LD HL,1 ; TC VALUE ~0 CAUSES LOW OUTPUT (RTS ASSERTED) + LD C,Z280_CT2_TC ; SET C/T 2 + OUTW (C),HL + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + POP HL ; RECOVER ORIGINAL I/O PAGE + LDCTL (C),HL + POP HL +#ENDIF +; +Z2U_IN1: + INC HL ; HL := ADR OF TAIL PTR + INC HL ; " + INC HL ; " + PUSH HL ; SAVE ADR OF TAIL PTR + LD A,(HL) ; DEREFERENCE HL + INC HL + LD H,(HL) + LD L,A ; HL IS NOW ACTUAL TAIL PTR + LD C,(HL) ; C := CHAR TO BE RETURNED + INC HL ; BUMP TAIL PTR + POP DE ; RECOVER ADR OF TAIL PTR + LD A,L ; GET LOW BYTE OF TAIL PTR + SUB Z2U_BUFSZ+2 ; SUBTRACT SIZE OF BUFFER AND POINTER + CP E ; IF EQUAL TO START, TAIL PTR IS PAST BUF END + JR NZ,Z2U_IN2 ; IF NOT, BYPASS + LD H,D ; SET HL TO + LD L,E ; ... TAIL PTR ADR + INC HL ; BUMP PAST TAIL PTR + INC HL ; ... SO HL NOW HAS ADR OF ACTUAL BUFFER START +Z2U_IN2: + EX DE,HL ; DE := TAIL PTR VAL, HL := ADR OF TAIL PTR + LD (HL),E ; SAVE UPDATED TAIL PTR + INC HL ; " + LD (HL),D ; " + LD E,C ; MOVE CHAR TO RETURN TO E + HB_EI ; INTERRUPTS OK AGAIN + XOR A ; SIGNAL SUCCESS + RET ; AND DONE +; +#ENDIF +; +; +; +Z2U_OUT: + CALL Z2U_OST ; CHECK IF OUTPUT REGISTER READY + JR Z,Z2U_OUT ; LOOP UNTIL SO +; + ; START BY SELECTING I/O PAGE $FE + LD L,$FE ; Z280 UART REGISTERS AT I/O PAGE $FE + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; + ; WRITE CHAR + LD A,E ; BYTE TO A + OUT (Z280_UARTXMIT),A ; SEND IT +; + ; RESTORE I/O PAGE TO $00 + LD L,$00 ; NORMAL I/O REG IS $00 + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; +; +#IF (INTMODE < 3) +; +Z2U_IST: + ; START BY SELECTING I/O PAGE $FE + LD L,$FE ; Z280 UART REGISTERS AT I/O PAGE $FE + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; + ; GET RECEIVE STATUS + IN A,(Z280_UARTRCTL) ; GET STATUS + AND $10 ; ISOLATE CHAR AVAILABLE BIT +; + ; RESTORE I/O PAGE TO $00 + LD L,$00 ; NORMAL I/O REG IS $00 + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; + OR A ; SET FLAGS + JP Z,CIO_IDLE ; NOT READY, RETURN VIA IDLE PROCESSING +; + RET +; +#ELSE +; +Z2U_IST: + LD L,(IY+6) ; GET ADDRESS + LD H,(IY+7) ; ... OF RECEIVE BUFFER + LD A,(HL) ; BUFFER UTILIZATION COUNT + OR A ; SET FLAGS + JP Z,CIO_IDLE ; NOT READY, RETURN VIA IDLE PROCESSING + RET ; DONE +; +#ENDIF +; +; +; +Z2U_OST: +; + ; START BY SELECTING I/O PAGE $FE + LD L,$FE ; Z280 UART REGISTERS AT I/O PAGE $FE + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; + ; GET TRANSMIT STATUS + IN A,(Z280_UARTXCTL) ; GET STATUS +; + ; RESTORE I/O PAGE TO $00 + LD L,$00 ; NORMAL I/O REG IS $00 + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; + ; CHECK FOR CHAR AVAILABLE + AND $01 ; ISOLATE CHAR AVAILABLE BIT + JP Z,CIO_IDLE ; NOT READY, RETURN VIA IDLE PROCESSING + RET ; DONE +; +; AT INITIALIZATION THE SETUP PARAMETER WORD IS TRANSLATED TO THE FORMAT +; REQUIRED BY THE Z2U AND STORED IN A PORT/REGISTER INITIALIZATION TABLE, +; WHICH IS THEN LOADED INTO THE Z2U. +; +; NOTE THAT THERE ARE TWO ENTRY POINTS. INITDEV WILL DISABLE/ENABLE INTS +; AND INITDEVX WILL NOT. THIS IS DONE SO THAT THE PREINIT ROUTINE ABOVE +; CAN AVOID ENABLING/DISABLING INTS. +; +Z2U_INITDEV: + HB_DI ; DISABLE INTS + CALL Z2U_INITDEVX ; DO THE WORK + HB_EI ; INTS BACK ON + RET ; DONE +; +Z2U_INITSAFE: + LD A,%11000010 ; 8N0, DIV 16, NO C/T + LD (Z2U_CFGREG),A ; SAVE IT + LD HL,1 ; C/T DIV 1 + JR Z2U_INITDEV8 ; DO IT +; +Z2U_INITDEVX: + ; TEST FOR -1 WHICH MEANS USE CURRENT CONFIG (JUST REINIT) + LD A,D ; TEST DE FOR + AND E ; ... VALUE OF -1 + INC A ; ... SO Z SET IF -1 + JR NZ,Z2U_INITDEV1 ; IF DE == -1, REINIT CURRENT CONFIG +; + ; LOAD EXISTING CONFIG TO REINIT + LD E,(IY+4) ; LOW BYTE + LD D,(IY+5) ; HIGH BYTE +; +Z2U_INITDEV1: + LD (Z2U_NEWCFG),DE ; SAVE NEW CONFIG +; +; HACK FOR TESTING!!! +; +#IF FALSE + ;LD A,%11000000 ; 8N0, DIV 1, NO C/T + LD A,%11000010 ; 8N0, DIV 16, NO C/T + ;LD A,%11000100 ; 8N0, DIV 32, NO C/T + ;LD A,%11000110 ; 8N0, DIV 64, NO C/T + LD (Z2U_CFGREG),A ; SAVE UART CONFIG VALUE + ;LD HL,1 ; 24MHZ / 8 / 1 + LD HL,2 ; 24MHZ / 8 / 2 + ;LD HL,3 ; 24MHZ / 8 / 5 + ;LD HL,15 ; 24MHZ / 8 / 15 + ;LD HL,26 ; 24MHZ / 8 / 26 = 115384 BAUD (~115200) + ;LD HL,52 ; 24MHZ / 8 / 52 = 57692 BAUD (~57600) + JP Z2U_INITDEV8 ; SKIP AHEAD TO IMPLMENT IT +#ENDIF +; + LD A,D ; HIWORD OF CONFIG + AND $1F ; ISOLATE BAUD RATE + PUSH AF +; + LD DE,Z2UOSC >> 16 ; BAUD OSC HI WORD + LD HL,Z2UOSC & $FFFF ; BAUD OSC LO WORD + LD C,75 ; BAUD RATE ENCODE CONSTANT + CALL ENCODE ; C = ENCODED OSC + POP DE ; D = UART OSC + JP NZ,Z2U_INITFAIL ; HANDLE ENCODE FAILURE + LD A,C ; TO A + SUB D ; DIV W/ SUB OF SQUARES + ; REG A NOW HAS ENCODED BAUD RATE DIVISOR +; + PUSH AF ; SAVE IT + AND $0F ; ISOLATE 2'S POWER +; + ; Z280 UART CAN USE 16, 32, OR 64 AS BAUD RATE DIVISOR + ; SET E TO IMPLEMENT WHAT WE CAN + LD E,%11000000 ; 8N0, DIV 1, NO C/T + CP 4 ; DIV 16 POSSIBLE? + JR C,Z2U_INITDEV2 ; IF NOT, SKIP AHEAD + LD E,%11000010 ; 8N0, DIV 16, NO C/T + SUB 4 ; REFLECT IN TGT DIVISOR + CP 1 ; DIV 32 POSSIBLE? + JR C,Z2U_INITDEV2 ; IF NOT, SKIP AHEAD + LD E,%11000100 ; 8N0, DIV 32, NO C/T + DEC A ; REFLECT IN TGT DIVISOR + CP 1 ; DIV 64 POSSIBLE? + JR C,Z2U_INITDEV2 ; IF NOT, SKIP AHEAD + LD E,%11000110 ; 8N0, DIV 64, NO C/T + DEC A +; +Z2U_INITDEV2: + LD D,A ; 2'S POWER TO D + POP AF ; RECOVER ORIGINAL VALUE + AND $F0 ; MASK OFF ORIG 2'S POWER + OR D ; COMBINE + ;CALL PRTHEXBYTE ; *DEBUG* + PUSH AF ; RESAVE IT + LD A,E ; GET Z280 UART CONFIG REG VAL + LD (Z2U_CFGREG),A ; SAVE CONFIG REG VALUE FOR LATER + POP AF ; RECOVER REMAINING ENCODED DIVISOR + LD L,A ; INTO L + LD H,0 ; H MUST BE ZERO + LD DE,1 ; RATIO, SO NO CONSTANT + CALL DECODE ; DECODE INTO DE:HL + JP NZ,Z2U_INITFAIL ; HANDLE FAILURE +; + ; SAVE CONFIG PERMANENTLY NOW + LD DE,(Z2U_NEWCFG) ; GET NEW CONFIG BACK + LD (IY+4),E ; SAVE LOW WORD + LD (IY+5),D ; SAVE HI WORD +; +Z2U_INITDEV8: + ; START BY SELECTING I/O PAGE $FE + PUSH HL ; SAVE HL + LD L,$FE ; Z280 UART REGISTERS AT I/O PAGE $FE + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL + POP HL ; RESTORE HL +; + DEC HL ; ADJUST FOR T/C + LD A,H ; TEST FOR + OR L ; ... ZERO + JR Z,Z2U_INITDEV9 ; IF ZERO, SKIP C/T +; + ; PROGRAM C/T 1 +#IF Z2UOSCEXT + LD A,%10001100 ; CONFIG: C, RE, COUNTER +#ELSE + LD A,%10001000 ; CONFIG: C, RE, COUNTER +#ENDIF + OUT (Z280_CT1_CFG),A ; SET C/T 1 + LD C,Z280_CT1_TC ; SET C/T 1 FROM HL + OUTW (C),HL + LD C,Z280_CT1_CT ; SET C/T 1 FROM HL + OUTW (C),HL + LD A,%11100000 ; CMD: EN, GT, TG + OUT (Z280_CT1_CMDST),A ; SET C/T 1 +; + ; MODIFY CFG REG VALUE TO USE C/T + LD A,(Z2U_CFGREG) ; CONFIG VALUE + SET 3,A ; SET C/T USAGE BIT + LD (Z2U_CFGREG),A ; SAVE IT +; +Z2U_INITDEV9: + ; PROGRAM THE UART + LD A,(Z2U_CFGREG) ; CONFIG VALUE + OUT (Z280_UARTCFG),A ; SET CONFIG REGISTER + LD A,%10000000 ; ENABLE, NO INTS, 1 STOP BITS + OUT (Z280_UARTXCTL),A ; SET XMIT CTL REGISTER +#IF (INTMODE == 3) + LD A,%11000000 ; ENABLE W/ RCV INTS +#ELSE + LD A,%10000000 ; ENABLE, NO RCV INTS +#ENDIF + OUT (Z280_UARTRCTL),A ; SET RCV CTL REGISTER +; +#IF (Z2U0HFC) + ; SETUP C/T 2 FOR FLOW CONTROL + LD A,%00001000 ; CONFIG: TIMER + OUT (Z280_CT2_CFG),A ; SET C/T 2 CONFIG + LD HL,1 ; TC VALUE ~0 CAUSES LOW OUTPUT (RTS ASSERTED) + LD C,Z280_CT2_TC ; SET C/T 2 + OUTW (C),HL + LD A,%00000000 ; CMD: EN, GT + OUT (Z280_CT2_CMDST),A ; SET C/T 2 +#ENDIF +; + LD L,$00 ; NORMAL I/O REG IS $00 + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; +#IF (INTMODE == 3) +; + ; RESET THE RECEIVE BUFFER + LD E,(IY+6) + LD D,(IY+7) ; DE := _CNT + XOR A ; A := 0 + LD (DE),A ; _CNT = 0 + INC DE ; DE := ADR OF _HD + PUSH DE ; SAVE IT + INC DE + INC DE + INC DE + INC DE ; DE := ADR OF _BUF + POP HL ; HL := ADR OF _HD + LD (HL),E + INC HL + LD (HL),D ; _HD := _BUF + INC HL + LD (HL),E + INC HL + LD (HL),D ; _TL := _BUF +; +#ENDIF +; + ; RETURN SUCCESS + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +Z2U_INITFAIL: + OR $FF ; SIGNAL ERROR + RET ; AND DONE +; +; +; +Z2U_QUERY: + LD E,(IY+4) ; FIRST CONFIG BYTE TO E + LD D,(IY+5) ; SECOND CONFIG BYTE TO D + XOR A ; SIGNAL SUCCESS + RET ; DONE +; +; +; +Z2U_DEVICE: + LD D,CIODEV_Z2U ; D := DEVICE TYPE + LD E,(IY) ; E := PHYSICAL UNIT + LD C,$00 ; C := DEVICE TYPE, 0x00 IS RS-232 + LD H,0 ; H := 0, DRIVER HAS NO MODES + LD L,(IY+3) ; L := BASE I/O ADDRESS + XOR A ; SIGNAL SUCCESS + RET +; +; Z280 UART DETECTION ROUTINE +; ALWAYS PRESENT, JUST SAY SO. +; +Z2U_DETECT: + LD A,Z2U_PRESENT ; PRESENT + RET +; +; +; +Z2U_PRTCFG: + ; ANNOUNCE PORT + CALL NEWLINE ; FORMATTING + PRTS("Z2U$") ; FORMATTING + LD A,(IY) ; DEVICE NUM + CALL PRTDECB ; PRINT DEVICE NUM + PRTS(": IO=0x$") ; FORMATTING + LD A,(IY+3) ; GET BASE PORT + CALL PRTHEXBYTE ; PRINT BASE PORT +; + ; ALL DONE IF NO Z2U WAS DETECTED + LD A,(IY+1) ; GET Z2U TYPE BYTE + OR A ; SET FLAGS + RET Z ; IF ZERO, NOT PRESENT +; + PRTS(" MODE=$") ; FORMATTING + LD E,(IY+4) ; LOAD CONFIG + LD D,(IY+5) ; ... WORD TO DE + CALL PS_PRTSC0 ; PRINT CONFIG +; + XOR A + RET +; +; WORKING VARIABLES +; +Z2U_DEV .DB 0 ; DEVICE NUM USED DURING INIT +Z2U_CFGREG .DB 0 ; VALUE TO PROGRAM CFG REG +Z2U_NEWCFG .DW 0 ; TEMP STORE FOR NEW CFG +; +#IF (INTMODE < 3) +; +Z2U0_RCVBUF .EQU 0 +; +#ELSE +; +; RECEIVE BUFFERS +; +Z2U0_RCVBUF: +Z2U0_BUFCNT .DB 0 ; CHARACTERS IN RING BUFFER +Z2U0_HD .DW Z2U0_BUF ; BUFFER HEAD POINTER +Z2U0_TL .DW Z2U0_BUF ; BUFFER TAIL POINTER +Z2U0_BUF .FILL Z2U_BUFSZ,0 ; RECEIVE RING BUFFER +Z2U0_BUFEND .EQU $ ; END OF BUFFER +Z2U0_BUFSZ .EQU $ - Z2U0_BUF ; SIZE OF RING BUFFER +; +#ENDIF +; +; Z2U PORT TABLE +; +Z2U_CFG: +; +Z2U0_CFG: + ; Z2U CONFIG + .DB 0 ; DEVICE NUMBER (SET DURING INIT) + .DB 0 ; Z280 UART TYPE (SET DURING INIT) + .DB 0 ; MODULE ID + .DB Z2U0BASE ; BASE PORT + .DW Z2U0CFG ; LINE CONFIGURATION + .DW Z2U0_RCVBUF ; POINTER TO RCV BUFFER STRUCT +; +Z2U_CFGSIZ .EQU $ - Z2U_CFG ; SIZE OF ONE CFG TABLE ENTRY +; +Z2U_CFGCNT .EQU ($ - Z2U_CFG) / Z2U_CFGSIZ diff --git a/Source/HDIAG/Build.cmd b/Source/HDIAG/Build.cmd new file mode 100644 index 00000000..62ffe922 --- /dev/null +++ b/Source/HDIAG/Build.cmd @@ -0,0 +1,15 @@ +@echo off +setlocal + +set TOOLS=../../Tools +set BIN=..\..\Binary + +set PATH=%TOOLS%\tasm32;%PATH% + +set TASMTABS=%TOOLS%\tasm32 + +tasm -t180 -g3 -fFF -DAPPBOOT hdiag.asm hdiag.com hdiag_com.lst || exit /b +tasm -t180 -g3 -fFF -DROMBOOT hdiag.asm hdiag.rom hdiag_rom.lst || exit /b + +copy hdiag.rom %BIN% || exit /b +copy hdiag.com %BIN% || exit /b diff --git a/Source/HDIAG/Clean.cmd b/Source/HDIAG/Clean.cmd new file mode 100644 index 00000000..258d66cc --- /dev/null +++ b/Source/HDIAG/Clean.cmd @@ -0,0 +1,7 @@ +@echo off +setlocal + +if exist *.com del *.com +if exist *.rom del *.rom +if exist *.lst del *.lst +if exist *.hex del *.hex \ No newline at end of file diff --git a/Source/HDIAG/Makefile b/Source/HDIAG/Makefile new file mode 100644 index 00000000..707f6bb8 --- /dev/null +++ b/Source/HDIAG/Makefile @@ -0,0 +1,13 @@ +OBJECTS = hdiag.com hdiag.rom +DEST = ../../Binary +TOOLS = ../../Tools +include $(TOOLS)/Makefile.inc + +TASMFLAGS=-t hd64180 + +hdiag.com: hdiag.asm + $(TASM) $(TASMFLAGS) -dAPPBOOT $< $@ hdiag.com.lst + + +hdiag.rom: hdiag.asm + $(TASM) $(TASMFLAGS) -dROMBOOT $< $@ hdiag.rom.lst diff --git a/Source/HDIAG/acia.asm b/Source/HDIAG/acia.asm new file mode 100644 index 00000000..c69c5f6d --- /dev/null +++ b/Source/HDIAG/acia.asm @@ -0,0 +1,70 @@ +; +;======================================================================= +; HDIAG ACIA Driver +;======================================================================= +; +acia_cmd .equ $80 +acia_dat .equ $81 +; +; +; +acia_jptbl: + jp acia_cinit ; Initialize serial port + jp acia_cin ; Read byte + jp acia_cout ; Write byte + jp acia_cist ; Input status + jp acia_cost ; Output Status +; +; +; +acia_cinit: + ; Detect ACIA + ld a,$03 ; master reset + out (acia_cmd),a ; apply it + in a,(acia_cmd) ; get status + or a ; check for zero (expected) + ret nz ; abort if not + ld a,$02 ; clear master reset + out (acia_cmd),a ; apply it + in a,(acia_cmd) ; get status again + and %00001110 ; isolate reliable bits + cp %00000010 ; check for expected value + ret nz ; abort if not + ; Initialize ACIA + ld a,%00010110 ; default config + out (acia_cmd),a ; apply it + xor a ; signal success + ret +; +; +; +acia_cin: + call acia_cist ; check for char ready + jr z,acia_cin ; if not, loop + in a,(acia_dat) ; read byte + ret ; done +; +; +; +acia_cout: + push af ; save incoming +acia_cout1: + call acia_cost ; ready for char? + jr z,acia_cout1 ; loop if not + pop af ; restore incoming + out (acia_dat),a ; write byte + ret ; and done +; +; +; +acia_cist: + in a,(acia_cmd) ; get status + and $01 ; isolate rx ready + ret ; done +; +; +; +acia_cost: + in a,(acia_cmd) ; get status + and $02 ; isolate tx empty + ret ; done diff --git a/Source/HDIAG/asci.asm b/Source/HDIAG/asci.asm new file mode 100644 index 00000000..1d3d2fc6 --- /dev/null +++ b/Source/HDIAG/asci.asm @@ -0,0 +1,89 @@ +; +;======================================================================= +; HDIAG ASCI Driver +;======================================================================= +; +; ASCI0 is programmed with a fixed divisor of 480, resulting in a +; baud rate of 38400 at the standard cpu frequency of 18.432 MHz +; +; The Z180 may relocate it's internal I/O to begin at different +; starting port addresses. This driver relies upon an HDIAG global +; variable to dynamically adjust to the right port address. +; +; +asci_jptbl: + jp asci_cinit ; Initialize serial port + jp asci_cin ; Read byte + jp asci_cout ; Write byte + jp asci_cist ; Input status + jp asci_cost ; Output Status +; +; +; +asci_cinit: + ; Detect ASCI + ld a,(hd_cpu) ; get cpu type + cp hd_cpu_z180 + jr c, asci_cinit1 ; less than Z180, abort + cp hd_cpu_z280 + jr nc, asci_cinit1 ; greater than Z180, abort +; + ; Initialize ASCI + ld a,%01100100 ; rcv enable, xmit enable, no parity + out0 (z180_cntla0),a ; set cntla + ld a,%00100000 ; div 30, div 16, div 1 (38400 baud for 18.432mhz cpu) + out0 (z180_cntlb0),a ; set cntlb + ld a,%01100110 ; no cts, no dcd, no break detect + out0 (z180_asext0),a ; set asext + xor a ; no interrupts + out0 (z180_stat0),a ; set stat0 + xor a ; signal success + ret ; done +; +asci_cinit1: + or $FF ; signal error + ret ; done +; +; +; +asci_cin: + call asci_cist ; check for char ready + jr z,asci_cin ; if not, loop + in0 a,(z180_rdr0) ; get char + ret ; done +; +; +; +asci_cout: + push af ; save incoming +asci_cout1: + call asci_cost ; ready for char? + jr z,asci_cout1 ; loop if not + pop af ; restore incoming + out0 (z180_tdr0),a ; write byte + ret ; and done +; +; +; +asci_cist: + in0 a,(z180_stat0) ; get status + push af ; save status + and $70 ; line error? + jr z,asci_cist1 ; continue if no errors +; + ; clear line error(s) or nothing further can be received!!! + in0 a,(z180_cntla0) ; read cntla + res 3,a ; clear efr (error flag reset) + out0 (z180_cntla0),a ; update cntla +; +asci_cist1: + pop af ; recover original status + and $80 ; data ready? + ret +; +; +; +asci_cost: + in0 a,(z180_stat0) ; get status + and $02 ; isolate bit 5 + ret ; a != 0 if char ready, else 0 diff --git a/Source/HDIAG/hdiag.asm b/Source/HDIAG/hdiag.asm new file mode 100644 index 00000000..7d3ad1ef --- /dev/null +++ b/Source/HDIAG/hdiag.asm @@ -0,0 +1,533 @@ +; +;======================================================================= +; HDIAG Diagmostic ROM +;======================================================================= +; +; HDIAG is a framework for a diagnotic environment intended to be +; suitable for all systems supported by RomWBW. RomWBW expects hardware +; to be fully functional making it difficult to use it to initially +; check out a system. HDIAG is explicitly constructed to be as simple +; as possible. +; +; There is only a single variant of HDIAG that is built. HDIAG is +; designed to detect the environment it is operating under at startup +; and dynamically adapt to it. +; +; HDIAG can be assembled to boot in one of 2 modes (rom or application) +; as described below. When compiled, you must define exactly one of the +; following macros: +; +; - ROMBOOT: Boot from a rom bank +; +; When ROMBOOT is defined, the file is assembled to be imbedded at the +; start of a rom assuming that the cpu will start execution at address +; 0. +; +; - APPBOOT: Boot as a CP/M style application file +; +; When APPBOOT is defined, the file is assembled as a CP/M application +; assuming that it will be loaded at 100h by the CP/M (or compatible) +; OS. +; + .module MAIN +; +#include "hdiag.inc" +#include "z180.inc" +; +;======================================================================= +; Page Zero Definition +;======================================================================= +; +; Generic page zero setup. Only applies to ROMBOOT startup mode. +; +#ifdef ROMBOOT +; + .org $0000 +; + jp _start ; rst $00: jump to boot code + .fill ($08-$) + ret ; rst $08 + .fill ($10-$) + ret ; rst $10 + .fill ($18-$) + ret ; rst $18 + .fill ($20-$) + ret ; rst $20 + .fill ($28-$) + ret ; rst $28 + .fill ($30-$) + ret ; rst $30 + .fill ($38-$) + reti ; h/w int return + .fill ($66-$) + retn ; h/w nmi return + .fill ($100-$) ; pad remainder of page zero +; +#else + .org $0100 +; +#endif +; +;======================================================================= +; Startup +;======================================================================= +; +; Before transitioning to RAM, we need to determine the memory +; manager to use because some platforms will not have any RAM mapped +; to the upper 32K of CPU address space until the memory manager +; is initialized. +; +_start: +; +; Discover CPU Type and Memory Manager +; +; Some of this code is derived from UNA by John Coffman +; +; CPU and memory manager constants are defined in hdiag.inc. +; + di ; no interrupts allowed +; + ld a,$80 + out ($0D),a +; + ; Use D for memory manager, and E for CPU Type + ld de,0 ; assume unknown for both +; +; Start with CPU type detection +; + ; Check for Z80 + inc e ; not sure how to do it, just assume it +; + ; Test for Z180 using mlt + ex de,hl ; save DE to HL for test + ld de,$0506 ; 5 x 6 + mlt de ; de = 30 if Z180 + ld a,e ; check if multiply happened + ex de,hl ; restore DE now + cp 30 + jr nz,_tryZ280 ; if != 30, not a Z180, try Z280 + inc e ; Z80180 or better +; +#ifdef APPBOOT +; + ; Reset Z180 internal register base to zero no matter where + ; it might have previously been mapped. + xor a + out0 ($7F),a + out0 ($BF),a + out0 ($FF),a +; +#endif +; + ; Test for older S-class (rev K) + in0 a,(z180_ccr) ; supposedly only on s-class + inc a ; FF -> 0 + jr z,_z180res ; if zero, pre-S, HD61480 or equiv + inc e ; Z8S180 rev K (SL1960) or better +; + ; Test for newer S-class (rev N) + ; On older S-class, asci time constant reg does not exist + ; and will always read back as $FF + out0 (z180_astc1l),d ; d = 0 at this point + in0 a,(z180_astc1l) ; asci time constant reg + inc a ; FF -> 0 + jr z,_z180res ; if zero, rev-K + inc e ; otherwise Z8S180 rev N w/ asci brg + jr _z180res ; go to Z180 reset +; +_tryZ280: + ; Test for Z280 per Zilog doc + ld a,$40 ; initialize the operand + .db $cb,$37 ; this instruction will set the s flag + ; on the Z80 cpu and clear the s flag + ; on the Z280 mpu. + jp m,_z80res ; if not Z280, we are Z80 + ld l,hd_cpu_z280 ; we are Z280 + jr _z280res ; handle Z280 initialization +; +_z80res: + ld a,$01 + out (0),a + ; Reset Z80 here (is there anything?) + jr _cpu1 +; +_z180res: +; + ; Reset z180 registers here + ; Set CPU speed to oscillator x 1 + xor a + out0 (z180_cmr),a + ld a,$80 + out0 (z180_ccr),a + ; Set default wait states + ld a,$%00000100 ; mem wait=0, i/o wait=+1 + out0 (z180_dcntl),a +; +#ifdef ROMBOOT + ; Setup Z180 MMU + ; Keep ROM page zero in lower 32K!!! + ld a,$80 ; Common Base @ 32K, Bank Base @ 0K + out0 (z180_cbar),a + xor a ; Physical address zero + out0 (z180_cbr),a ; ... for Common Base + out0 (z180_bbr),a ; ... and Bank Base +#else + xor a ; Physical address zero + out0 (z180_cbr),a ; ... for Common Base +#endif +; + jr _cpu1 +; +_z280res: + ; Reset Z280 registers here + ; Make sure memmgr is reset to defaults! + jr _cpu1 +; +; At this point, we should have the cpu type in the L register. +; Now determine the memory manager. In general, we just attempt to +; enable the different memory managers and keep testing to see if +; a RAM bank has appeared in the common area. +; +_cpu1: + ld a,$02 + out ($0D),a +; + ; Reset Zeta 2 memory manager (in case it exists) +#ifdef ROMBOOT + xor a ; disable value + out ($7C),a ; write it + xor a ; 16K ROM page 0 + out ($78),a + inc a ; 16K ROM page 1 + out ($79),a +#endif + ld a,2 ; 16K ROM page 2 + out ($7A),a + inc a ; 16K ROM page 3 + out ($7B),a +; + ; Reset N8 supplemental memory manager + ; *** Need to implement this *** +; + ld a,$03 + out ($0D),a +; + ; There is no way to disable the common (himem) RAM bank + ; under the SBC memory manager. Here, we just see if there + ; is RAM in himem and, if so, assume the SBC memory manager. + ; If not, we continue on to test the other possible memory + ; managers. + inc d ; assume SBC memory manager + ld ix,$FFFF ; point to himem + ld a,$A5 ; an unlikely bit pattern + ld (ix),a ; write the value + cp (ix+0) ; check value written + jr z,_cpu2 ; SBC memory manager, we are done! +; + ld a,$04 + out ($0D),a +; + ; Now test for Zeta 2 memory manager + ; Start by initializing and enabling the page registers + inc d ; assume Zeta 2 memory manager +#ifdef ROMBOOT + xor a ; ROM page 0 + out ($78),a + inc a ; ROM page 1 + out ($79),a +#endif + ld a,$20 ; first RAM page + out ($7A),a + inc a ; second RAM page + out ($7B),a + ld a,1 ; enable paging + out ($7C),a +; + ld a,$05 + out ($0D),a +; + ; Test himem RAM again + ld ix,$FFFF ; point to himem + ld a,$A5 ; an unlikely bit pattern + ld (ix),a ; write the value + cp (ix+0) ; check value written + jr z,_cpu2 ; Zeta 2 memory manager, we are done! +; + ld a,$06 + out ($0D),a +; + ; If neither SBC nor Zeta 2, then we assume the memory + ; manager is the native memory manager onboard the CPU + ld a,e ; get cpu type + cp hd_cpu_z280 ; Z280? + jr z,_z280init ; handle it + or a ; Z80? + jr nz,_z180init ; if no, go handle Z180 +; + ; If we get here, we are stuck. We believe we are a Z80 + ; but both of the Z80 memory manager tests failed. +_halt: + ld a,$07 + out ($0D),a +; + ld hl,_str_halt + call prtstr + halt ; give up +; +_z180init: + ; Initialize Z180 memory manager + ; Put first RAM page into himem (commmon) + ld a,$80 + out0 (z180_cbr),a +; + ld d,hd_mm_z180 + jr _cpu2 + +_N8init: + ; Initialize N8 memory manager + ld d,hd_mm_n8 + jr _cpu2 + +_z280init: + ; Initialize Z280 memory manager + ld d,hd_mm_z280 + jr _cpu2 +; +_cpu2: + ld a,$08 + out ($0D),a +; + ex de,hl ; cpu/memmgr values to HL + ld sp,hl ; and stash SP reg +; +; Transition to upper memory (omit page zero) +; + ld hl,$0000+$100 + ld de,$8000+$100 + ld bc,$8000-$100 + ldir + jp _start2 +; + .org $ + $8000 +; +; +;======================================================================= +; Post-relocation Startup +;======================================================================= +; +_start2: +; + ld a,$09 + out ($0D),a +; +; Copy FF page image to real location. Use a decrementing copy +; just in case page image is within $100 bytes of $FF00. Very +; unlikely, but just to be safe. +; + ld hl,_ffimg+$FF ; Start at end of image + ld de,$FFFF ; To top of RAM + ld bc,$100 ; Copy 1 page + lddr ; Execute +; +; Recover cpu/memmgr codes stashed in SP and +; save them in FF page +; + ld (_cpu),sp +; +; Now we establish a real stack (finally!) +; + ld sp,$FF00 ; Stack just below FF page +; +; Probe and initialize serial port console driver. We just go +; through the options stopping at the first one that works. The +; order of polling below is intended to find the most reasonable +; console port. +; +; + ld a,$0A + out ($0D),a +; +; +; This should be table driven!!! +; + ; Z280 UART + ld ix,ser_z2u + call jpix + jr z,_start3 + ; ASCI + ld ix,ser_asci + call jpix + jr z,_start3 + ; UART + ld ix,ser_uart + call jpix + jr z,_start3 + ; ACIA + ld ix,ser_acia + call jpix + jr z,_start3 + ; SIO + ld ix,ser_sio + call jpix + jr z,_start3 +; + ; Ugh, nothing worked + ld a,$0C + out ($0D),a + halt +; +; +; +_start3: +; + ld a,$0D + out ($0D),a +; +; Copy selected console serial driver vector table into place +; + push ix + pop hl + ld de,_jptbl + ld bc,5*3 + ldir +; +; +; + ; Setup memory manager +; + ; Map RAM page 0 to lower 32K +; + ; Setup zero page in lower 32K +; +; +; +_restart: +; + ld hl,_str_banner + call prtstr +; + ; Print CPU model + ld de,_str_cputag + ld hl,_str_cpu + ld a,(hd_cpu) + call prtstrtbl +; + ; Print memory manager + ld de,_str_mmtag + ld hl,_str_mm + ld a,(hd_mmgr) + call prtstrtbl +; + call cin + jp _restart +; +; +; + jp _halt +; +;======================================================================= +; Helper functions +;======================================================================= +; +#include "util.asm" +; +;======================================================================= +; Console I/O modules +;======================================================================= +; +; Include all serial drivers +; + .module UART +ser_uart .equ $ +#include "uart.asm" +; + .module ASCI +ser_asci .equ $ +#include "asci.asm" +; + .module ACIA +ser_acia .equ $ +#include "acia.asm" +; + .module SIO +ser_sio .equ $ +#include "sio.asm" +; + .module Z2U +ser_z2u .equ $ +#include "z2u.asm" +; + .module MAIN +; +;======================================================================= +; Internal variables and literals +;======================================================================= +; +_str_banner .db "\r\n\r\nHDIAG v0.90",0 +_str_cputag .db "\r\nCPU Model: ",0 +_str_mmtag .db "\r\nMemory Manager: ",0 +_str_halt .db "\r\n\r\n*** System HALTed ***",0 +; +_str_cpu: + .dw _str_unknown + .dw _str_cpuz80 + .dw _str_cpuz180 + .dw _str_cpuz180K + .dw _str_cpuz180N + .dw _str_cpuz280 +; +_str_unknown .db "Unknown",0 +_str_cpuz80 .db "Z80",0 +_str_cpuz180 .db "Z80180",0 +_str_cpuz180K .db "Z8S180-K",0 +_str_cpuz180N .db "Z8S180-N",0 +_str_cpuz280 .db "Z80280",0 +; +_str_mm: + .dw _str_unknown + .dw _str_mmsbc + .dw _str_mmz2 + .dw _str_mmz180 + .dw _str_mmn8 + .dw _str_mmz280 +; +_str_mmsbc .db "SBC/MBC",0 +_str_mmz2 .db "Zeta2/RCBUS",0 +_str_mmz180 .db "Z180 Native",0 +_str_mmn8 .db "Z180 Native (N8)",0 +_str_mmz280 .db "Z280 Native",0 +; +;======================================================================= +; Top page of CPU RAM, global variables and function jump table +;======================================================================= +; +; This area is defined here, but copied to the top page of RAM at +; initialization! +; +; The top page (256 bytes) of CPU address space is used to maintain +; a jump table of functions available to all diagnostic modules. +; It also contains some global variables at fixed locations for use +; by diagnostic modules. +; +; The console function addresses are set dynamically based on the +; console driver that is installed at boot. +; +_ffimg .equ $ +; + .org $FF00 ; Set code org +; +_jptbl: +cinit jp 0 ; Console port initialization +cin jp 0 ; Console read byte +cout jp 0 ; Console write byte +cist jp 0 ; Console input status +cost jp 0 ; Console output status +; + .fill $FF80-$ +_cpu .db 0 ; CPU type +_mmgr .db 0 ; Memory manager type +; + .fill $10000-$ + .end + + diff --git a/Source/HDIAG/hdiag.inc b/Source/HDIAG/hdiag.inc new file mode 100644 index 00000000..072c20ce --- /dev/null +++ b/Source/HDIAG/hdiag.inc @@ -0,0 +1,44 @@ +; +;======================================================================= +; HDIAG Diagnostic ROM Global Definitions +;======================================================================= +; +; Include this file in modules written to run under HDIAG to +; have access to the HDIAG global variables and jump table +; definitions. +; +; It is important to use the definitions in this file because +; the internal structure of HDIAG is very likely to change +; over time. +; +; Global Variable Addresses +; +hd_cpu .equ $FF80 +hd_mmgr .equ $FF81 +; +; HDIAG Function Jump Table Vectors +; +hd_jptbl .equ $FF00 +hd_cinit .equ hd_jptbl + 0 ; init console +hd_cin .equ hd_jptbl + 3 ; read console byte +hd_cout .equ hd_jptbl + 6 ; write console byte +hd_cist .equ hd_jptbl + 9 ; console input status +hd_cost .equ hd_jptbl + 12 ; console output status +; +; CPU Identified Constants (value of hd_cpu) +; +hd_cpu_none .equ 0 ; unknown cpu +hd_cpu_z80 .equ 1 ; plain Z80 +hd_cpu_z180 .equ 2 ; original Z180 (HD64180) +hd_cpu_z180k .equ 3 ; Zilog Z180 Rev. K +hd_cpu_z180n .equ 4 ; Zilog Z180 Rev. N +hd_cpu_z280 .equ 5 ; Zilog Z280 +; +; Memory Manager Identified Constants (value of hd_mmgr) +; +hd_mm_none .equ 0 ; unknown memory manager +hd_mm_sbc .equ 1 ; SBC/MBC/Zeta 1 +hd_mm_z2 .equ 2 ; Zeta 2/RCBUS +hd_mm_z180 .equ 3 ; Z180 native +hd_mm_n8 .equ 4 ; Z180 on N8 +hd_mm_z280 .equ 5 ; Z280 native \ No newline at end of file diff --git a/Source/HDIAG/hdiag_old.asm b/Source/HDIAG/hdiag_old.asm new file mode 100644 index 00000000..0c55d210 --- /dev/null +++ b/Source/HDIAG/hdiag_old.asm @@ -0,0 +1,2543 @@ +; +;================================================================================================== +; HDIAG +;================================================================================================== +; +; THIS FILE CONTAINS A FRAMEWORK FOR A DIAGNOTIC ENVIRONMENT. IT IS ESSENTIALLY A STRIPPED DOWN +; VERSION OF HBIOS. IT DOES NO BANK SWITCHING, BUT THE INTERRUPT MANAGEMENT FRAMEWORK IS +; RETAINED. UPON STARTUP, IT RELOCATES TO UPPER (COMMON) RAM AS QUICKLY AS POSSIBLE. +; +; THERE IS NO HBIOS API. MINIMAL SERIAL PORT ACCESS IS PROVIDED BY INCLUDING THE PLATFORM +; APPROPRIATE MIN_XXX.ASM SERIAL DRIVER. SERIAL PORT SPEEDS ARE FIXED AND THERE IS NO +; FLOW CONTROL. NONE OF THE TYPICAL DRIVER MODULES (CHARACTER, DISK, VIDEO, ETC.) ARE INCLUDED +; AND THERE IS NO DISPATCHING MECHANISM. +; +; IN ORDER TO BUILD PLATFORM APPROPRIATE VERSIONS, THE FULL HBIOS INCLUDE FILE STRUCTURE +; IS USED SO THAT ALL OF THE HBIOS CONFIG SETTINGS CAN BE USED. +; +; THIS FILE CAN BE COMPILED TO BOOT IN ONE OF 2 MODES (ROM OR APPLICATION) AS DESCRIBED +; BELOW. WHEN COMPILED, YOU MUST DEFINE EXACTLY ONE OF THE FOLLOWING MACROS: +; +; - ROMBOOT: BOOT FROM A ROM BANK +; +; WHEN ROMBOOT IS DEFINED, THE FILE IS ASSEMBLED TO BE IMBEDDED AT THE START OF A ROM +; ASSUMING THAT THE CPU WILL START EXECUTION AT ADDRESS 0. +; +; - APPBOOT: BOOT FROM A CP/M STYLE APPLICATION FILE +; +; WHEN APPBOOT IS DEFINED, THE FILE IS ASSEMBLED AS A CP/M APPLICATION ASSUMING +; THAT IT WILL BE LOADED AT 100H BY THE CP/M (OR COMPATIBLE) OS. +; +; INCLUDE FILE NESTING: +; +; hdiag.asm +; - std.asm +; - ver.inc +; - hbios.inc +; - build.inc +; - config/_.asm +; - cfg_.asm +; - util.asm +; - min_[uart|asci|sio|acia].asm +; - dsky.asm ??? +; - diagnostic modules... +; +; INCLUDE GENERIC STUFF +; +#INCLUDE "std.asm" +; +#DEFINE HDIAG +; +; MAKE SURE EXACTLY ONE OF ROMBOOT, APPBOOT IS DEFINED. +; +MODCNT .EQU 0 +#IFDEF ROMBOOT +MODCNT .SET MODCNT + 1 +#ENDIF +#IFDEF APPBOOT +MODCNT .SET MODCNT + 1 +#ENDIF +#IF (MODCNT != 1) + .ECHO "*** ERROR: PLEASE DEFINE ONE AND ONLY ONE OF ROMBOOT, APPBOOT!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR +#ENDIF +; +; +; +#IF (DIAGENABLE) +#DEFINE DIAG(N) PUSH AF + #DEFCONT \ LD A,N + #DEFCONT \ OUT (DIAGPORT),A + #DEFCONT \ POP AF +#ELSE +#DEFINE DIAG(N) \; +#ENDIF +; +#IF (LEDENABLE) + #IF (LEDMODE == LEDMODE_STD) +#DEFINE LED(N) PUSH AF + #DEFCONT \ LD A,~N + #DEFCONT \ OUT (LEDPORT),A + #DEFCONT \ POP AF + #ENDIF + #IF (LEDMODE == LEDMODE_RTC) +#DEFINE LED(N) PUSH AF + #DEFCONT \ LD A,(HB_RTCVAL) + #DEFCONT \ AND %11111100 + #DEFCONT \ OR (N & %00000011) + #DEFCONT \ LD (HB_RTCVAL),A + #DEFCONT \ OUT (LEDPORT),A + #DEFCONT \ POP AF + #ENDIF +#ELSE +#DEFINE LED(N) \; +#ENDIF +; +; +; +#IF (INTMODE == 0) +; NO INTERRUPT HANDLING +#DEFINE HB_DI ; +#DEFINE HB_EI ; +#ELSE + #IF (CPUFAM == CPU_Z280) + #IF (INTMODE == 3) +; Z280 MODE 3 INTERRUPT HANDLING (INTA, C/T 0, & UART RCVR ENABLED) +#DEFINE HB_DI DI +#DEFINE HB_EI .DB $ED,$7F,$0B + #ELSE +; Z280 MODE 1/2 INTERRUPT HANDLING +#DEFINE HB_DI DI +#DEFINE HB_EI EI + #ENDIF + #ELSE +#DEFINE HB_DI DI +#DEFINE HB_EI EI + #ENDIF +#ENDIF +; +#IF (INTMODE > 3) + .ECHO "*** ERROR: INVALID INTMODE SETTING!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR +#ENDIF +; +#IF (INTMODE == 3) + #IF (CPUFAM != CPU_Z280) + .ECHO "*** ERROR: INTMODE 3 REQUIRES Z280 FAMILY CPU!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR + #ENDIF + #IF (MEMMGR != MM_Z280) + .ECHO "*** ERROR: INTMODE 3 REQUIRES Z280 MEMORY MANAGER!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR + #ENDIF +#ENDIF +; +#IF (MEMMGR == MM_Z280) + #IF (INTMODE != 3) + .ECHO "*** ERROR: Z280 MEMORY MANAGER REQUIRES INTMODE 3!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR + #ENDIF + #IF (CPUFAM != CPU_Z280) + .ECHO "*** ERROR: Z280 MEMORY MANAGER REQUIRES Z280 FAMILY CPU!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR + #ENDIF +#ENDIF +; +; +; +#IF (CTCENABLE) +CTCA .EQU CTCBASE + 0 ; CTC: CHANNEL A REGISTER ADR +CTCB .EQU CTCBASE + 1 ; CTC: CHANNEL B REGISTER ADR +CTCC .EQU CTCBASE + 2 ; CTC: CHANNEL C REGISTER ADR +CTCD .EQU CTCBASE + 3 ; CTC: CHANNEL D REGISTER ADR +#ENDIF +; +; THIS EQUATE IS UPDATED BY DRIVER INCLUDES THAT SHARE THE RTC LATCH. +; AS DRIVER IS INCLUDED, IT WILL USE .SET TO SET ANY BITS THEY OWN +; AND WANT TO SET AS DEFAULT. +; +RTCDEF .EQU 0 ; ALLOWS DRIVERS TO SET BITS +; +#IF (PLATFORM == PLT_SCZ180) +RTCDEF .SET RTCDEF | %00000001 ; SC128 I2C SCL BIT +#ENDIF +; +; +; +#IFNDEF APPBOOT +; + .ORG 0 +; +;================================================================================================== +; NORMAL PAGE ZERO SETUP, RET/RETI/RETN AS APPROPRIATE, LEAVE INTERRUPTS DISABLED +;================================================================================================== +; + .FILL (000H - $),0FFH ; RST 0 + JP HB_START + .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 ; RST 38 / IM1 INT + #IF (INTMODE == 1) + JP INT_IM1 ; JP TO INTERRUPT HANDLER IN HI MEM + #ELSE + RET ; RETURN W/ INTS DISABLED + #ENDIF + .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 (C) 2020, Wayne Warthen, GNU GPL v3", 0 +; + .FILL ($100 - $),$FF ; PAD REMAINDER OF PAGE ZERO +; +#ENDIF +; +; +; + .ORG $100 + JP HB_START +; +;================================================================================================== +; HBIOS UPPER MEMORY PROXY (RELOCATED TO RUN IN TOP 2 PAGES OF CPU RAM) +;================================================================================================== +; +; THE FOLLOWING CODE IS RELOCATED TO THE TOP OF MEMORY TO HANDLE INVOCATION DISPATCHING +; + ;.FILL (HBX_IMG - $) ; FILL TO START OF PROXY IMAGE START +HBX_IMG .SET $ + .ORG HBX_LOC ; ADJUST FOR RELOCATION +; +; MEMORY LAYOUT: +; +; HBIOS PROXY CODE $FE00 (256 BYTES) +; INTERRUPT VECTORS $FF00 (32 BYTES, 16 ENTRIES) +; INTERRUPT HANDLER STUBS $FF20 (128 BYTES) +; HBIOS PROXY COPY BUFFER $FF80 (64 BYTES) +; HBIOS PROXY MGMT BLOCK $FFE0 (32 BYTES) +; +; DEFINITIONS +; +HBX_BUFSIZ .EQU $40 ; INTERBANK COPY BOUNCE BUFFER SIZE +; +; HBIOS IDENTIFICATION DATA BLOCK +; +HBX_IDENT: + .DB 'W',~'W' ; MARKER + .DB RMJ << 4 | RMN ; FIRST BYTE OF VERSION INFO + .DB RUP << 4 | RTP ; SECOND BYTE OF VERSION INFO +;;;; +;;;;================================================================================================== +;;;; HBIOS ENTRY FOR RST 08 PROCESSING +;;;;================================================================================================== +;;;; +;;;; NOTE: THE SIZE OF HBX_TMPSTK (TYPICALLY 20 BYTES) IS INSUFFICIENT FOR +;;;; FREERTOS IF AN INTERRUPT STRIKES WHILE THE TEMPORARY STACK IS ACTIVE. +;;;; BELOW, HBX_BUF HAS BEEN USURPED TO PROVIDE A LARGER TEMP STACK TO +;;;; ACCOMMODATE FREERTOS. HBX_BUF IS ONLY USED AS A BOUNCE BUFFER, SO IT'S +;;;; USE WILL NEVER OVERLAP WITH BELOW. +;;;; +;;;; WARNING: HBX_INVOKE IS *NOT* REENTRANT! +;;;; +;;;HBX_INVOKE: +;;;; +;;;#IF (HBIOS_MUTEX == TRUE) +;;; PUSH HL ; SAVE HL +;;; LD HL,HB_LOCK ; POINT TO LOCK +;;; SRA (HL) ; TEST/ACQUIRE MUTEX LOCK +;;; JR C,$-2 ; KEEP TRYING ON FAILURE +;;; POP HL ; RESTORE HL +;;;#ENDIF +;;;; +;;;#IF (MEMMGR == MM_Z280) +;;;; +;;; LD A,(HB_CURBNK) ; GET CURRENT BANK +;;; LD (HB_INVBNK),A ; SAVE INVOCATION BANK +;;;; +;;; LD A,BID_BIOS ; HBIOS BANK +;;; LD (HB_CURBNK),A ; SET AS CURRENT BANK +;;;; +;;; .DB $ED,$71 ; SC +;;; .DW HB_DISPATCH ; SC PARAMETER +;;;; +;;; PUSH AF +;;; LD A,(HB_INVBNK) +;;; LD (HB_CURBNK),A +;;; POP AF +;;;; +;;;#ELSE +;;;; +;;; LD (HBX_INVSP),SP ; SAVE ORIGINAL STACK FRAME +;;; LD SP,HBX_BUF_END ; BORROW HBX_BUF FOR TEMP STACK +;;;; +;;; LD A,(HB_CURBNK) ; GET CURRENT BANK +;;; LD (HB_INVBNK),A ; SAVE INVOCATION BANK +;;;; +;;; LD A,BID_BIOS ; HBIOS BANK +;;; CALL HBX_BNKSEL ; SELECT IT +;;; LD SP,HB_STACK ; NOW USE FULL HBIOS STACK IN HBIOS BANK +;;;; +;;; ;CALL HB_DISPATCH ; CALL HBIOS FUNCTION DISPATCHER +;;;; +;;; LD SP,HBX_BUF_END ; BORROW HBX_BUF FOR TEMP STACK +;;; PUSH AF ; SAVE AF (FUNCTION RETURN) +;;;; +;;; LD A,(HB_INVBNK) ; LOAD ORIGINAL BANK +;;; CALL HBX_BNKSEL ; SELECT IT +;;; POP AF ; RESTORE AF +;;; LD SP,0 ; RESTORE ORIGINAL STACK FRAME +;;;HBX_INVSP .EQU $ - 2 +;;;; +;;;#ENDIF +;;;; +;;;#IF (HBIOS_MUTEX == TRUE) +;;; PUSH HL ; SAVE HL +;;; LD HL,HB_LOCK ; POINT TO LOCK +;;; LD (HL),$FE ; RELEASE MUTEX LOCK +;;; POP HL ; RESTORE HL +;;;#ENDIF +;;;; +;;; RET ; RETURN TO CALLER +; +;;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +;; BNKSEL - Switch Memory Bank to Bank in A. +;; Preserve all Registers including Flags. +;;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; +HBX_BNKSEL: + ; IF AN INTERRUPT OCCURS DURING THE BANK SWITCH CODE, + ; THE BANK WILL BE SET TO (CURBNK) AS THE INTERRUPT + ; RETURNS. SO, IT IS IMPORTANT THAT (HB_CURBNK) BE + ; SET AS THE FIRST STEP TO AVOID ISSUES IF AN INTERRUPT + ; OCCURS DURING PROCESSING. + LD (HB_CURBNK),A ; RECORD NEW CURRENT BANK +; +HBX_BNKSEL_INT: +; +#IF (MEMMGR == MM_SBC) + #IF (INTMODE == 1) + ; THIS BIT OF ABSURDITY HANDLES A RARE (BUT FATAL) SITUATION + ; WHERE AN IM1 INTERRUPT OCCURS BETWEEN SETTING THE RAM AND + ; ROM SELECTORS. BRACKETING THE INSTRUCTIONS WITH DI/EI + ; IS CONTRAINDICATED BECAUSE THIS ROUTINE IS CALLED BY + ; OTHER ROUTINES THAT MUST CONTROL INT ENABLE AT A HIGHER + ; LEVEL. THE FOLLOWING TECHNIQUE ENSURES THAT YOU ALWAYS + ; SWITCH DIRECTLY FROM THE PREVIOUS BANK TO THE TARGET BANK + ; WITHOUT AN "ERRANT" BANK BEING ACTIVE BETWEEN THE TWO + ; BANK SELECTION I/O INSTRUCTIONS. THE TECHNIQUE IS ONLY + ; NEEDED WHEN USING INT MODE 1 BECAUSE THAT MODE REQUIRES + ; PAGE ONE TO HAVE A VALID INT HANDLER WHENEVER INTS ARE + ; ENABLED. + ;BIT 7,A ; [8] TEST RAM BIT + ;JR Z,HBX_ROM ; [12/7] IF NOT SET, JUST DO ROM + OR A ; [4] SET FLAGS + JP P,HBX_ROM ; [10] BIT 7 INDICATES RAM + #ENDIF + OUT (MPCL_RAM),A ; SET RAM PAGE SELECTOR +HBX_ROM: + OUT (MPCL_ROM),A ; SET ROM PAGE SELECTOR + RET ; DONE +#ENDIF +; +#IF (MEMMGR == MM_Z2) + BIT 7,A ; BIT 7 SET REQUESTS RAM PAGE + JR Z,HBX_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 +; +HBX_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 + #IF (CPUFAM == CPU_Z280) + PCACHE + #ENDIF + RET ; DONE +#ENDIF +; +#IF (MEMMGR == MM_N8) + BIT 7,A ; TEST BIT 7 FOR RAM VS. ROM + JR Z,HBX_ROM ; IF NOT SET, SELECT ROM PAGE +; +HBX_RAM: + 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 +; +HBX_ROM: + 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 (MEMMGR == MM_Z180) + RLCA ; RAM FLAG TO CARRY FLAG AND BIT 0 + JR NC,HBX_BNKSEL1 ; IF NC, WANT ROM PAGE, SKIP AHEAD + XOR %00100001 ; SET BIT FOR HI 512K, CLR BIT 0 +HBX_BNKSEL1: + 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 +; +#IF (MEMMGR == MM_Z280) + PUSH BC ; SAVE BC + PUSH HL ; SAVE HL + LD B,$00 ; FIRST USER PDR + .DB $ED,$71 ; SC + .DW Z280_BNKSEL ; SC PARAMETER + POP HL ; RESTORE HL + POP BC ; RESTORE BC + RET ; DONE +#ENDIF +; +#IF (MEMMGR == MM_ZRC) + BIT 7,A ; BIT 7 SET REQUESTS RAM PAGE + JR Z,HBX_ROM ; NOT SET, SELECT ROM PAGE + RES 7,A ; RAM PAGE REQUESTED: CLEAR ROM BIT + ADD A,$10 ; ADD 16 x 32K - RAM STARTS FROM 512K +; +HBX_ROM: + OUT ($1F),A ; HCS WRITE TO THE BANK CONTROL REGISTER + RET ; DONE +#ENDIF +; +#IF (MEMMGR == MM_MBC) +; + #IF (INTMODE == 1) + LD (HBX_MMA),A ; SAVE ACCUM + LD A,I ; GET INT CTL REG + HB_DI ; DISABLE INTS + PUSH AF ; SAVE INT CTL REG + LD A,(HBX_MMA) ; RESTORE ACCUM + #ENDIF +; + OR A ; SET FLAGS + JP P,HBX_ROM ; BIT 7 INDICATES RAM + OUT (MPCL_ROM),A ; ENSURE ROM PAGE OUT OF MEMORY BEFORE SWITCH + +#IF (RAMSIZE == 256) + XOR %00000100 ; TOP 32K IS ALWAYS IN FIRST CHIP +#ENDIF + +#IF (RAMSIZE == 1024) + XOR %00010000 ; TOP 32K IS ALWAYS IN FIRST CHIP +#ENDIF + + OUT (MPCL_RAM),A ; SET RAM PAGE SELECTOR + JR HBX_RAMX +HBX_ROM: + OUT (MPCL_RAM),A ; ENSURE RAM PAGE OUT OF MEMORY BEFORE SWITCH + OUT (MPCL_ROM),A ; SET ROM PAGE SELECTOR + +HBX_RAMX: +; + #IF (INTMODE == 1) + POP AF ; RESTORE INT CTL REG + JP PO,$+4 ; WERE INTS DISABLED AT ENTRY? + EI ; *** DO NOT USE HB_EI HERE *** + LD A,(HBX_MMA) ; RESTORE INCOMING ACCUM + #ENDIF +; + RET +; +HBX_MMA .DB 0 ; TEMPORARY STORAGE FOR REG A +#ENDIF +; +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; Copy Data - Possibly between banks. This resembles CP/M 3, but +; usage of the HL and DE registers is reversed. +; Caller MUST preset HBX_SRCBNK and HBX_DSTBNK. +; IM1/IM2 interrupts are disabled during HBX_BNKCPY. +; Enter: +; HL = Source Address +; DE = Destination Address +; BC = Number of bytes to copy +; Exit : None +; Uses : AF,BC,DE,HL +; +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +; +HBX_BNKCPY: +#IF (MEMMGR == MM_Z280) + .DB $ED,$71 ; SC + .DW Z280_BNKCPY ; SC PARAMETER + RET +#ELSE + #IF (CPUFAM == CPU_Z280) + PUSH HL + PUSH BC + LD C,Z280_MSR + LDCTL HL,(C) + POP BC + EX (SP),HL + HB_DI + #ELSE + LD A,I + HB_DI + PUSH AF + #ENDIF + LD (HBX_BC_SP),SP ; PUT STACK + LD SP,HBX_TMPSTK ; ... IN HI MEM + + LD A,(HB_CURBNK) ; GET CURRENT BANK + PUSH AF ; AND SAVE TO RESTORE LATER + PUSH BC ; CUR LEN -> (SP) +; +HBX_BC_LOOP: + EX (SP),HL ; HL := CUR LEN, (SP) := CUR SRC + LD BC,HBX_BUFSIZ ; SET BC TO BOUNCE BUFFER SIZE + OR A ; CLEAR CARRY FLAG + SBC HL,BC ; CUR LEN := CUR LEN - BBUF SIZE + JR C,HBX_BC_LAST ; END GAME, LESS THAN BBUF BYTES LEFT + EX (SP),HL ; HL := CUR SRC, (SP) := REM LEN + CALL HBX_BC_ITER ; DO A FULL BBUF SIZE CHUNK + JR HBX_BC_LOOP ; AND REPEAT TILL DONE +; +HBX_BC_LAST: + ; HL IS BETWEEN -(BBUF SIZE) AND -1, BC = BBUF SIZE + OR A ; CLEAR CARRY + ADC HL,BC ; HL := REM LEN (0 - 127) + EX (SP),HL ; HL := CUR SRC, (SP) := REM LEN + POP BC ; BC := REM LEN + CALL NZ,HBX_BC_ITER ; DO FINAL CHUNK, IFF > 0 BYTES + POP AF ; RECOVER ORIGINAL BANK + CALL HBX_BNKSEL ; SWITCH + + LD SP,$FFFF ; RESTORE STACK +HBX_BC_SP .EQU $ - 2 ; ... TO ORIGINAL VALUE + #IF (CPUFAM == CPU_Z280) + EX (SP),HL ; SAVE HL, RECOVER MSR + PUSH BC ; SAVE BC + LD C,Z280_MSR + LDCTL (C),HL + POP BC ; RECOVER BC + POP HL ; RECOVER HL + #ELSE + POP AF + JP PO,$+4 + EI ; *** DO NOT USE HB_EI HERE *** + #ENDIF + RET +; +HBX_BC_ITER: + ; HL = SRC ADR, DE = DEST ADR, BC = LEN + PUSH BC ; SAVE COPY LEN + PUSH DE ; FINAL DEST ON STACK + LD DE,HBX_BUF ; SET DEST TO BUF + LD A,(HB_SRCBNK) ; GET SOURCE BANK + CALL HBX_BNKSEL ; SWITCH TO SOURCE BANK + LDIR ; HL -> BUF (DE), BC BYTES, HL UPDATED SRC ADR + POP DE ; DE := FINAL DEST + POP BC ; GET LEN BACK IN BC + PUSH HL ; SAVE UPDATED SRC ADR + LD HL,HBX_BUF ; SET SRC ADR TO BUF + LD A,(HB_DSTBNK) ; GET DEST BANK + CALL HBX_BNKSEL ; SWITCH TO DEST BANK + LDIR ; BUF (HL) -> DE, BC BYTES, DE UPDATED DEST ADR + POP HL ; RECOVER UPDATED SRC ADR + ; HL = UPDATED SRC, DE = UPDATED DEST, BC = 0 + RET +#ENDIF +; +; CALL A ROUTINE IN ANOTHER BANK. +; CALLER MUST ENSURE STACK IS ALREADY IN HIGH MEMORY AND HAS ADEQUATE SPACE. +; IF IM1 INTERRUPTS ARE POSSIBLE, CALLER MUST EITHER DISABLE THEM PRIOR TO +; BNKCALL OR MAKE SURE THAT PAGE ZERO IN TARGET BANK IS PREPARED FOR THEM. +; ON INPUT A=TARGET BANK, IX=TARGET ADDRESS +; +HBX_BNKCALL: +; +#IF (MEMMGR == MM_Z280) + CP BID_BIOS ; CALLING HBIOS? + JR NZ,HBX_BNKCALL3 ; NOPE, DO NORMAL PROCESSING + .DB $ED,$71 ; SC + .DW HBX_BNKCALL2 ; CALL HERE IN SYSTEM MODE + RET ; THEN RETURN +; +HBX_BNKCALL2: + HB_EI ; INTS ARE OK + LD (HBX_BNKCALL_GO+1),IX ; SETUP DEST ADR + PCACHE ; CRITICAL!!! +HBX_BNKCALL_GO: + JP $FFFF ; DO THE REAL WORK AND RETURN +#ENDIF +; +HBX_BNKCALL3: + LD (HBX_BNKCALL_BNK+1),A ; STUFF TARGET BANK TO CALL INTO CODE BELOW + LD (HBX_BNKCALL_ADR+1),IX ; STUFF ADDRESS TO CALL INTO CODE BELOW + LD A,(HB_CURBNK) ; GET CURRENT BANK + PUSH AF ; SAVE FOR RETURN +HBX_BNKCALL_BNK: + LD A,$FF ; LOAD BANK TO CALL ($FF OVERLAID AT ENTRY) + CALL HBX_BNKSEL ; ACTIVATE THE NEW BANK +HBX_BNKCALL_ADR: + CALL $FFFF ; CALL ROUTINE ($FFFF IS OVERLAID ABOVE) + EX (SP),HL ; SAVE HL AND GET BANK TO RESTORE IN HL + PUSH AF ; SAVE AF + LD A,H ; BANK TO RESTORE TO A + CALL HBX_BNKSEL ; RESTORE IT + POP AF ; RECOVER AF + POP HL ; RECOVER HL + RET +; +; PEEK & POKE ROUTINES +; ADDRESS IN HL, BANK IN D, VALUE IN/OUT IN E, A IS TRASHED +; +; THESE ROUTINES ARE NOT INTENDED TO BE CALLED DIRECTLY -- THEY ARE +; HELPERS FOR THE HBIOS API AND ARE CALLED BY HBIOS BANK CODE. THE +; HBIOS BANK CODE BRACKETS THE USE OF THESE ROUTINES WITH DI/EI IF +; NECESSARY FOR THE CURRENT INTERRUPT MODE. +; +; NOTE: THE SIZE OF HBX_TMPSTK (TYPICALLY 20 BYTES) IS INSUFFICIENT FOR +; FREERTOS IF AN INTERRUPT STRIKES WHILE THE TEMPORARY STACK IS ACTIVE. +; BELOW, HBX_BUF HAS BEEN USURPED TO PROVIDE A LARGER TEMP STACK TO +; ACCOMMODATE FREERTOS. HBX_BUF IS ONLY USED AS A BOUNCE BUFFER, SO IT'S +; USE WILL NEVER OVERLAP WITH BELOW. +; +HBX_PEEK: + LD (HBX_PPSP),SP ; SAVE ORIGINAL STACK FRAME + LD SP,HBX_BUF_END ; BORROW HBX_BUF FOR TEMP STACK + LD A,(HB_CURBNK) + PUSH AF + LD A,D + CALL HBX_BNKSEL + LD E,(HL) + JR HBX_PPRET +; +HBX_POKE: + LD (HBX_PPSP),SP ; SAVE ORIGINAL STACK FRAME + LD SP,HBX_BUF_END ; BORROW HBX_BUF FOR TEMP STACK + LD A,(HB_CURBNK) + PUSH AF + LD A,D + CALL HBX_BNKSEL + LD (HL),E +; +HBX_PPRET: + POP AF +#IF (MEMMGR == MM_Z280) + LD A,(HB_INVBNK) ; SPECIAL CASE FOR Z280 MEM MGR +#ENDIF + CALL HBX_BNKSEL + LD SP,0 ; RESTORE ORIGINAL STACK FRAME +HBX_PPSP .EQU $ - 2 + RET +; +; SPECIAL ROUTINE IN HIGH MEMORY TO PERFORM A COLD START ON Z280 +; THIS REQUIRES US TO REMAP LOW MEMORY, THEN JUMP TO ZERO +; +#IF (MEMMGR == MM_Z280) +; +Z280_RESTART: + DI ; KILL INTERRUPTS + LD SP,HBX_LOC ; STACK IN HIGH MEMORY +; + ; COPY Z280 BANK SELECT ROUTINE TO HIGH MEMORY + LD HL,Z280_BNKSEL + LD DE,$8000 + LD BC,Z280_BNKSEL_LEN + LDIR +; + ; MAKE ROM BOOT BANK ACTIVE IN LOW SYS MEM + LD A,BID_BOOT + LD B,$10 ; FIRST SYS PDR + CALL $8000 ; DO IT +; + ; NOW JUST JUMP TO START OF ROM BOOT CODE + JP 0 +#ENDIF +; +; PRIVATE STACK AT END OF HBIOS CODE +; OCCUPIES SPACE BEFORE IVT +; +HBX_INTSTKSIZ .EQU $FF00 - $ + .ECHO "HBIOS INT STACK space: " + .ECHO HBX_INTSTKSIZ + .ECHO " bytes.\n" + .FILL HBX_INTSTKSIZ,$FF +HBX_INTSTK .EQU $ +; +;#IF (HBX_INTSTKSIZ < 24) +#IF (HBX_INTSTKSIZ < 22) + .ECHO "*** ERROR: INTERRUPT STACK IS TOO SMALL!!!\n" + !!! ; FORCE AN ASSEMBLY ERROR +#ENDIF +; +#IF ((INTMODE == 2) | (INTMODE == 3)) +; +; HBIOS INTERRUPT SLOT ASSIGNMENTS +; +; # Z80 Z180 +; --- -------------- -------------- +; 0 CTC0A INT1 -+ +; 1 CTC0B INT2 | +; 2 CTC0C TIM0 | +; 3 CTC0D TIM1 | +; 4 UART0 DMA0 +- Z180 INTERNAL +; 5 UART1 DMA1 | +; 6 CSIO | +; 7 SIO0 SER0 | +; 8 SIO1 SER1 -+ +; 9 PIO0A PIO0A +; 10 PIO0B PIO0B +; 11 PIO1A PIO1A +; 12 PIO1B PIO1B +; 13 SIO0 +; 14 SIO1 +; 15 +; +HBX_IVT: + .DW HBX_IV00 + .DW HBX_IV01 + .DW HBX_IV02 + .DW HBX_IV03 + .DW HBX_IV04 + .DW HBX_IV05 + .DW HBX_IV06 + .DW HBX_IV07 + .DW HBX_IV08 + .DW HBX_IV09 + .DW HBX_IV0A + .DW HBX_IV0B + .DW HBX_IV0C + .DW HBX_IV0D + .DW HBX_IV0E + .DW HBX_IV0F +; +HBX_IVTCNT .EQU ($ - HBX_IVT) / 2 +; +HBX_IV00: CALL HBX_INT \ .DB $00 << 2 +HBX_IV01: CALL HBX_INT \ .DB $01 << 2 +HBX_IV02: CALL HBX_INT \ .DB $02 << 2 +HBX_IV03: CALL HBX_INT \ .DB $03 << 2 +HBX_IV04: CALL HBX_INT \ .DB $04 << 2 +HBX_IV05: CALL HBX_INT \ .DB $05 << 2 +HBX_IV06: CALL HBX_INT \ .DB $06 << 2 +HBX_IV07: CALL HBX_INT \ .DB $07 << 2 +HBX_IV08: CALL HBX_INT \ .DB $08 << 2 +HBX_IV09: CALL HBX_INT \ .DB $09 << 2 +HBX_IV0A: CALL HBX_INT \ .DB $0A << 2 +HBX_IV0B: CALL HBX_INT \ .DB $0B << 2 +HBX_IV0C: CALL HBX_INT \ .DB $0C << 2 +HBX_IV0D: CALL HBX_INT \ .DB $0D << 2 +HBX_IV0E: CALL HBX_INT \ .DB $0E << 2 +HBX_IV0F: CALL HBX_INT \ .DB $0F << 2 +; +#ENDIF +; +INT_IM1: +#IF (INTMODE == 1) + CALL HBX_INT + .DB $00 +#ELSE + RETI ; UNEXPECTED INT, RET W/ INTS LEFT DISABLED +#ENDIF +; +#IF (INTMODE > 0) +; +HBX_INT: ; COMMON INTERRUPT ROUTING CODE +; + #IF (MEMMGR == MM_Z280) +; +; THIS CODE ASSUMES Z280 IM 3. IM 1 AND IM 2 ON Z280 +; DO NOT SAVE MSR AT INTERRUPT MAKING IT VIRTUALLY IMPOSSIBLE +; TO RETURN FROM THE INTERRUPT TO THE CORRECT MODE (SYSTEM +; OR USER). THIS IS BECAUSE THERE IS NO WAY TO KNOW WHETHER +; SYSTEM OR USER MODE WAS ACTIVE AT THE TIME OF THE INTERRUPT. +; + EX (SP),HL ; SAVE HL AND GET INT JP TABLE OFFSET + + ; SAVE STATE (HL SAVED PREVIOUSLY ON ORIGINAL STACK FRAME) + PUSH AF ; SAVE AF + PUSH BC ; SAVE BC + PUSH DE ; SAVE DE + PUSH IY ; SAVE IY +; + ; HANDLE INT VIA JP TABLE IN HBIOS + LD L,(HL) ; OFFSET INTO JP TABLE FOR THIS INT + LD H,HB_IVT >> 8 ; MSB OF HBIOS INT JP TABLE + CALL JPHL ; CALL HANDLER VIA INT JP TABLE +; + ; RESTORE STATE + POP IY ; RESTORE IY + POP DE ; RESTORE DE + POP BC ; RESTORE BC + POP AF ; RESTORE AF + POP HL ; RESTORE HL +; + ; BURN THE REASON CODE + EX (SP),HL ; HL TO STK, RC TO HL + POP HL ; RESTORE HL +; + CALL HBX_RETI ; RETI FOR Z80 PERIPHERALS + RETIL +; +HBX_RETI: + RETI +; + #ELSE +; +; COMMON INTERRUPT DISPATCHING CODE +; SETUP AND CALL HANDLER IN BIOS BANK +; + EX (SP),HL ; SAVE HL AND GET INT JP TABLE OFFSET +; + LD (HBX_INT_SP),SP ; SAVE ORIGINAL STACK FRAME + LD SP,HBX_INTSTK ; USE DEDICATED INT STACK FRAME IN HI MEM +; + ; SAVE STATE (HL SAVED PREVIOUSLY ON ORIGINAL STACK FRAME) + PUSH AF ; SAVE AF + PUSH BC ; SAVE BC + PUSH DE ; SAVE DE + PUSH IY ; SAVE IY +; + ;LD A,BID_BIOS ; HBIOS BANK + ;CALL HBX_BNKSEL_INT ; SELECT IT +; + LD L,(HL) ; OFFSET INTO JP TABLE FOR THIS INT + LD H,HB_IVT >> 8 ; MSB OF HBIOS INT JP TABLE +; + CALL JPHL ; CALL HANDLER VIA INT JP TABLE +; + ;LD A,(HB_CURBNK) ; GET PRE-INT BANK + ;CALL HBX_BNKSEL ; SELECT IT +; + ; RESTORE STATE + POP IY ; RESTORE IY + POP DE ; RESTORE DE + POP BC ; RESTORE BC + POP AF ; RESTORE AF +; + LD SP,$FFFF ; RESTORE ORIGINAL STACK FRAME +HBX_INT_SP .EQU $ - 2 +; + POP HL ; RESTORE HL +; + HB_EI ; ENABLE INTERRUPTS + RETI ; AND RETURN +; + #ENDIF + +#ENDIF +; +; SMALL TEMPORARY STACK FOR USE BY HBX_BNKCPY +; +HBX_TMPSTKSIZ .EQU (HBX_XFC - HBX_BUFSIZ - $) + .ECHO "HBIOS TEMP STACK space: " + .ECHO HBX_TMPSTKSIZ + .ECHO " bytes.\n" + .FILL HBX_TMPSTKSIZ,$CC +HBX_TMPSTK .EQU $ +; +; INTERBANK COPY BOUNCE BUFFER (64 BYTES) +; +; N.B., THIS BUFFER IS ALSO USED AS A TEMPORARY STACK BY INVOKE, PEEK, AND POKE. +; THEREFORE, THIS BUFFER *CANNOT* BE USED TO PASS DATA OUTSIDE OF +; HBIOS FUNCTION CALLS. +; +HBX_BUF .FILL HBX_BUFSIZ,0 +HBX_BUF_END .EQU $ +; +; HBIOS PROXY MGMT BLOCK (TOP 32 BYTES) +; +#IFDEF ROMBOOT + .DB BID_BOOT ; HB_CURBNK: CURRENTLY ACTIVE LOW MEMORY BANK ID +#ELSE + .DB BID_USR ; HB_CURBNK: CURRENTLY ACTIVE LOW MEMORY BANK ID +#ENDIF + .DB $FF ; HB_INVBNK: BANK ACTIVE AT TIME OF HBIOS CALL INVOCATION + .DW 0 ; HB_SRCADR: BNKCPY SOURCE ADDRESS + .DB BID_USR ; HB_SRCBNK: BNKCPY SOURCE BANK ID + .DW 0 ; HB_DSTADR: BNKCPY DESTINATION ADDRESS + .DB BID_USR ; HB_DSTBNK: BNKCPY DESTINATION BANK ID + .DW 0 ; HB_CPYLEN: BNKCPY LENGTH + .FILL 4,0 ; FILLER, RESERVED FOR FUTURE HBIOS USE + .DB RTCDEF ; SHADOW VALUE FOR RTC LATCH PORT + .DB $FE ; HB_LOCK: HBIOS MUTEX LOCK + JP 0 ; HB_INVOKE: FIXED ADR ENTRY FOR HBX_INVOKE (ALT FOR RST 08) + JP HBX_BNKSEL ; HB_BNKSEL: FIXED ADR ENTRY FOR HBX_BNKSEL + JP HBX_BNKCPY ; HB_BNKCPY: FIXED ADR ENTRY FOR HBX_BNKCPY + JP HBX_BNKCALL ; HB_BNKCALL: FIXED ADR ENTRY FOR HBX_BNKCALL + .DW HBX_IDENT ; ADDRESS OF HBIOS PROXY START (DEPRECATED) + .DW HBX_IDENT ; HB_IDENT: ADDRESS OF HBIOS IDENT INFO DATA BLOCK +; + .FILL MEMTOP - $ ; FILL TO END OF MEMORY (AS NEEDED) + .ORG HBX_IMG + HBX_SIZ ; RESET ORG +; +;================================================================================================== +; HDIAG CORE +;================================================================================================== +; +;================================================================================================== +; SYSTEM INITIALIZATION +;================================================================================================== +; +HB_START: +#IFDEF APPBOOT + #IF (MEMMGR == MM_Z280) + LD A,%00000001 + OUT (DIAGPORT),A + LD DE,Z280_BOOTERR + LD C,9 + LD A,%00000010 + OUT (DIAGPORT),A + CALL $0005 + LD A,%00001000 + OUT (DIAGPORT),A + RET +; +Z280_BOOTERR .TEXT "\r\n\r\n*** Application mode boot not supported under Z280 native memory management!!!\r\n\r\n$" + #ENDIF +#ENDIF + + DI ; NO INTERRUPTS + IM 1 ; INTERRUPT MODE 1 +; +#IF (DIAGENABLE) + LD A,%00000001 + OUT (DIAGPORT),A +#ENDIF +#IF (LEDENABLE) + #IF (LEDMODE == LEDMODE_STD) + XOR A ; LED IS INVERTED, TURN IT ON + #ENDIF + #IF (LEDMODE == LEDMODE_RTC) + LD A,%00000001 ; LED 0 + LD (HB_RTCVAL),A ; SAVE TO SHADOW REGISTER + #ENDIF + OUT (LEDPORT),A +#ENDIF +; + LD SP,HBX_LOC ; SETUP INITIAL STACK JUST BELOW HBIOS PROXY +; +#IF (CPUFAM == CPU_Z280) + ; SET MAXIMUM I/O WAIT STATES FOR NOW + LD C,Z280_BTCR ; BUS TIMING AND CONTROL REGISTER + LD HL,$0033 ; 3 I/O WAIT STATES ADDED + LDCTL (C),HL +; + ; START BY SELECTING I/O PAGE $FF + LD L,$FF ; MMU AND DMA PAGE I/O REG IS $FF + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; + #IF (MEMMGR == MM_Z280) +; + ; INITIALIZE ALL OF THE SYSTEM PAGE DESCRIPTORS WITH BLOCK MOVE + XOR A ; FIRST USER PDR + OUT (Z280_MMUPDRPTR),A ; SET THE PDR POINTER + LD HL,Z280_BOOTPDRTBL ; START OF PDR VALUES TABLE + LD C,Z280_MMUBLKMOV ; PDR BLOCK MOVE PORT + LD B,16 ; PROGRAM 16 PDRS + .DB $ED,$93 ; OTIRW +; + ; INITIALIZE ALL OF THE USER PAGE DESCRIPTORS WITH BLOCK MOVE + LD A,$10 ; FIRST SYSTEM PDR + OUT (Z280_MMUPDRPTR),A ; SET THE PDR POINTER + LD HL,Z280_BOOTPDRTBL ; START OF PDR VALUES TABLE + LD C,Z280_MMUBLKMOV ; PDR BLOCK MOVE PORT + LD B,16 ; PROGRAM 16 PDRS + .DB $ED,$93 ; OTIRW +; + ; ENABLE MMU (SYSTEM AND USER TRANSLATION) + LD C,Z280_MMUMCR ; MMU MASTER CONTROL REGISTER + LD HL,$BBFF ; ENABLE USER & SYSTEM TRANSLATE + OUTW (C),HL +; + ; DISABLE MEMORY REFRESH CYCLES + LD A,$08 ; DISABLED + OUT (Z280_RRR),A ; SET REFRESH RATE REGISTER +; + ; CONFIGURE Z280 INT/TRAP VECTOR TABLE POINTER REGISTER + ; WILL POINT TO ROM COPY FOR NOW, UPDATED TO RAM LATER ON + LD C,Z280_VPR + LD HL,Z280_IVT >> 8 ; TOP 16 BITS OF PHYSICAL ADR OF IVT + LDCTL (C),HL +; + JR Z280_INITZ ; JUMP TO CODE CONTINUATION +; + #IF (($ % 2) == 1) + ; WORD ALIGN THE TABLE + .DB 0 + #ENDIF +; +Z280_BOOTPDRTBL: + ; LOWER 32 K (BANKED) + .DW ($000 << 4) | $A + .DW ($001 << 4) | $A + .DW ($002 << 4) | $A + .DW ($003 << 4) | $A + .DW ($004 << 4) | $A + .DW ($005 << 4) | $A + .DW ($006 << 4) | $A + .DW ($007 << 4) | $A + ; UPPER 32 K (COMMON) + .DW (((((BID_COM & $7F) * 8) + 0) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 1) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 2) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 3) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 4) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 5) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 6) + (1 << (RAMLOC - 12))) << 4) | $A + .DW (((((BID_COM & $7F) * 8) + 7) + (1 << (RAMLOC - 12))) << 4) | $A +; +Z280_INITZ: +; + #ENDIF +; + ; RESTORE I/O PAGE TO $00 + LD L,$00 ; NORMAL I/O REG IS $00 + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL (C),HL +; +#ENDIF +; +#IF (CPUFAM == CPU_Z180) + ; SET BASE FOR CPU IO REGISTERS + ; DO NOT USE Z180_ICR FROM Z180.INC BECAUSE THE ICR + ; IS NOT YET AT THE RUNNING LOCATION. AT RESET, THE Z180 + ; REGISTER BASE I/O ADDRESS IS ZERO, SO INITIALLY, ICR IS + ; AT $3F. + LD A,Z180_BASE + OUT0 ($3F),A ; AT RESET, ICR IS AT $3F + + DIAG(%00000010) + + ; DISABLE REFRESH + XOR A + OUT0 (Z180_RCR),A + + ; MASK OFF TIMER INTERRUPTS + XOR A + OUT0 (Z180_TCR),A + OUT0 (Z180_ITC),A + + ; SET DEFAULT CPU CLOCK MULTIPLIERS (XTAL / 2) + ; + ; IT HAS BEEN REPORTED THAT CMR NEEDS TO BE SET PRIOR TO CCR + ; WHEN USING AN INPUT FREQUENCY THAT IS XTAL / 2. + ; I NEVER EXPERIENCED A PROBLEM RELATED TO ORDER, BUT JUST + ; FOR GOOD MEASURE, CMR IS SET PRIOR TO CCR BELOW. + ; https://www.retrobrewcomputers.org/forum/index.php?t=msg&th=316&#msg_5045 + XOR A + OUT0 (Z180_CMR),A + OUT0 (Z180_CCR),A + + ; SET DEFAULT WAIT STATES + LD A,$F0 + OUT0 (Z180_DCNTL),A + + #IF ((MEMMGR == MM_Z180) | (MEMMGR == MM_N8)) + ; Z180 MMU SETUP + LD A,$80 + OUT0 (Z180_CBAR),A ; SETUP FOR 32K/32K BANK CONFIG +;#IFDEF ROMBOOT +; 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 +; + ; SET DEFAULT CSIO SPEED (INTERNAL CLOCK, SLOW AS POSSIBLE) + LD A,Z180_CNTR_DEF ; DIV 1280, 14KHZ @ 18MHZ CLK + OUT0 (Z180_CNTR),A + #ENDIF +; +#ENDIF +; +#IF (EIPCENABLE) + LD A,(EIPC_WDT_CONST | EIPC_HALT_RUN | EIPC_WDT_P2_22) + OUT (EIPC_WDTMR),A ; CLEAR WDTE BIT (DISABLE WATCHDOG) + LD A,EIPC_DIS_WDT ; DISABLE WDT - SECOND KEY + OUT (EIPC_WDTCR),A + LD A,EIPC_WCR ; SET SYSTEM CONTROL REGISTER POINTER + ; (SCRP) TO POINT TO WAIT STATE + OUT (EIPC_SCRP),A ; CONTROL REGISTER (WCR) + LD A,(EIPC_IO_0WS | EIPC_MEM_OWS | EIPC_OCF_0WS | EIPC_INT_0WS | EIPC_CHAIN_0WS) + OUT (EIPC_SCDP),A ; NO WAIT STATES + LD A,EIPC_MCR ; SET SCRP TO POINT TO MISCELLANEOUS + OUT (EIPC_SCRP),A ; CONTROL REGISTER (MCR) + LD A,EIPC_CLKDIV1 ; DIVIDE CLOCK BY 1, /CS0 DISABLE + OUT (EIPC_SCDP),A ; SET SYSTEM CONTROL DATA PORT (SCDP) +#ENDIF +; +#IF ((MEMMGR == MM_SBC) | (MEMMGR == MM_MBC)) + ; SET PAGING REGISTERS + #IFDEF ROMBOOT + XOR A + OUT (MPCL_RAM),A ; REMOVE RAM FIRST! + OUT (MPCL_ROM),A ; SELECT ROM PAGE 0 + #ENDIF +#ENDIF +; +#IF (MEMMGR == MM_Z2) + ; SET PAGING REGISTERS + #IFDEF ROMBOOT + 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 +; + DIAG(%00000011) +; +; CHECK BATTERY BACKUP STATUS BEFORE WE COPY PROXY TO UPPER MEMORY +; +; IF A DS1210 POWER CONTROLLER IS INSTALLED AND BATTERY BACKUP IS NOT INSTALLED +; OR IS LESS THAN 2V THEN THE DS1210 WILL BLOCK THE SECOND RAM ACCESS. +; FAILURE TO COMPLETE TWO RAM ACCESSES BEFORE INSTALLING PROXY WILL RESULT +; IN THE ROM ID BYTES NOT BEING COPIED CORRECTLY AND CP/M APPLICATIONS +; WILL NOT START CORRECTLY WHEN THEY CHECK THE ROM ID VERSION BYTES. +; THE BATTERY CONDITION VALUE IS TEMPORARILY STORED AT HBX_LOC - 1. +; IF THERE IS NO DS1210 IN THE SYSTEM, THE CODE BELOW DOES NO HARM. +; + DEC SP ; RESERVE A STACK BYTE + XOR A ; ZERO MEANS LOW BAT + LD (HBX_LOC - 1),A ; WRITE IT (SHOULD ALWAYS WORK) + INC A ; 1 MEANS BAT OK + LD (HBX_LOC - 1),A ; OVERWRITE IF NVC ALLOWS IT +; +; IF APPBOOT, SAVE CURRENT BANKID +; +; THIS IS NOT GOING TO WORK IF THE APP BOOT IMAGE IS LOADED +; USING THE UNA FAT32 LOADER. SHOULD PROBABLY CHECK THAT THERE +; IS A VALID ROMWBW PROXY IN MEMORY BEFORE DOING THIS. HOWEVER, +; THIS USE CASE IS PROBABLY NON-EXISTENT. THE IMG BOOT IMAGE +; SHOULD WORK FINE WITH THE UNA FAT32 LOADER. +; +#IFDEF APPBOOT + LD A,(HB_CURBNK) + DEC SP ; RESERVE A STACK BYTE + LD (HBX_LOC - 2),A ; SAVE BANK + PUSH AF ; ALSO ON STACK +#ENDIF +; +; INSTALL PROXY IN UPPER MEMORY +; + LD DE,HBX_LOC ; AS PER ABOVE + LD HL,HBX_IMG + LD BC,HBX_SIZ + LDIR +; +; IF APPBOOT, RESTORE CURRENT BANK ID +; +#IFDEF APPBOOT + POP AF + LD (HB_CURBNK),A +#ENDIF +; +; TRANSITION TO UPPER (COMMON) RAM +; + LD HL,0 ; FROM START OF CURRENT BANK + LD DE,$8000 ; TO START OF COMMON RAM + LD BC,$8000-$200-1 ; EVERYTHING BUT THE PROXY AND BATCOND + LDIR + JP HB_START1 +; +; EXECUTION RESUMES HERE AFTER SWITCH TO RAM BANK +; + .ORG $8000 + $ +; +HB_START1: ; BNKCALL ARRIVES HERE, BUT NOW RUNNING IN RAM BANK +; + DIAG(%00000111) + LED(%00000010) +; + LD A,(HBX_LOC - 1) ; RECALL BATTERY STATE AND SAVE + LD (HB_BATCOND),A ; FOR FUTURE REFERENCE +; + LD SP,HBX_LOC ; RESET STACK SINCE WE DO NOT RETURN +; +#IF (MEMMGR == MM_Z280) + ; NOW POINT TO RAM COPY OF Z280 INT/TRAP TABLE + ; HL IS TOP 16 BITS OF PHYSICAL ADDRESS OF IVT + ; IVT *MUST* BE ON A 4K BOUNDARY + LD C,Z280_VPR + LD HL,0 + ((((BID_BIOS & $7F) * 8) + (1 << (RAMLOC - 12))) << 4) + (Z280_IVT >> 8) + LDCTL (C),HL +#ENDIF +; +; IF APPBOOT, WE NEED TO FIX UP A FEW THINGS IN PAGE ZERO +; +#IFDEF APPBOOT +; + ; GET AND SAVE APP BOOT BANK ID + LD A,(HBX_LOC - 2) + LD (HB_APPBNK),A +;;;; +;;; ; MAKE SURE RST 08 VECTOR IS RIGHT +;;; LD A,$C3 +;;; LD ($0008),A +;;; LD HL,HB_INVOKE +;;; LD ($0009),HL +; + ; MAKE SURE IM1 INT VECTOR IS RIGHT + #IF (INTMODE == 1) + ; JP INT_IM1 IF INTERRUPT MODE ACTIVE + LD A,$C3 + LD ($0038),A + LD HL,INT_IM1 + LD ($0039),HL + #ELSE + ; RETI ($ED, $4D) IF NON-INTERRUPT MODE + LD HL,$0038 + LD (HL),$ED + INC HL + LD (HL),$4D + #ENDIF +; +#ENDIF +; + DIAG(%00001111) +; +#IF FALSE +; +; TEST DEBUG *************************************************************************************** +; + PRTS("DEBUG-IVT$") + LD DE,HB_IVT + CALL DUMP_BUFFER + CALL NEWLINE +; +; TEST DEBUG *************************************************************************************** +; +#ENDIF +; +; DISCOVER CPU TYPE +; +; SOME OF THIS CODE IS DERIVED FROM UNA BY JOHN COFFMAN +; +; 0: Z80 +; 1: Z80180 - ORIGINAL Z180 (EQUIVALENT TO HD64180) +; 2: Z8S180 - ORIGINAL S-CLASS, REV. K, AKA SL1960, NO ASCI BRG +; 3: Z8S180 - REVISED S-CLASS, REV. N, W/ ASCI BRG +; 4: Z8280 +; + LD HL,0 ; L = 0 MEANS Z80 +; +#IF (CPUFAM == CPU_Z180) +; + ; TEST FOR ORIGINAL Z180 USING MLT + LD DE,$0506 ; 5 X 6 + MLT DE ; DE = 30 IF Z180 + LD A,E ; CHECK IF MULTIPLY HAPPENED + CP 30 + JR NZ,HB_CPU1 ; IT IS A Z80 IF != 30 + INC L ; FLAG Z80180 OR BETTER +; + ; TEST FOR OLDER S-CLASS (REV K) + IN0 A,(Z180_CCR) ; SUPPOSEDLY ONLY ON S-CLASS + INC A ; FF -> 0 + JR Z,HB_CPU1 + INC L ; FLAG Z8S180 REV K (SL1960) OR BETTER +; + ; TEST FOR NEWER S-CLASS (REV N) + ; ON OLDER S-CLASS, ASCI TIME CONSTANT REG DOES NOT EXIST + ; AND WILL ALWYAS READ BACK AS $FF + OUT0 (Z180_ASTC1L),D ; D = 0 AT THIS POINT + IN0 A,(Z180_ASTC1L) ; ASCI TIME CONSTANT REG + INC A ; FF -> 0 + JR Z,HB_CPU1 + INC L ; FLAG Z8S180 REV N W/ ASCI BRG +; +#ENDIF +; +#IF (CPUFAM == CPU_Z280) +; + ; TEST FOR Z280 PER ZILOG DOC + LD A,$40 ; INITIALIZE THE OPERAND + .DB $CB,$37 ; THIS INSTRUCTION WILL SET THE S FLAG + ; ON THE Z80 CPU AND CLEAR THE S FLAG + ; ON THE Z280 MPU. + JP M,HB_CPU1 ; IF Z80, SKIP AHEAD + LD L,4 ; WE ARE Z280 +; +#ENDIF +; +HB_CPU1: + LD A,L + LD (HB_CPUTYPE),A +; +#IF (SKZENABLE) +; + ; SET THE SK Z80-512K UART CLK2 DIVIDER AS + ; CONFIGURED. NOTE THAT THIS IMPLICITLY + ; CLEARS THE WATCHDOG BIT. THE WATCHDOG + ; WILL BE ENABLED LATER IF CONFIGURED. + LD A,SKZDIV ; GET DIVIDER CODE + OUT ($6D),A ; IMPLEMENT IT +; +#ENDIF +; +#IF (CPUFAM == CPU_Z180) +; + ; AT BOOT, Z180 PHI IS OSC / 2 + LD C,(CPUOSC / 2) / 1000000 + LD DE,(CPUOSC / 2) / 1000 +; + #IF (Z180_CLKDIV >= 1) + LD A,(HB_CPUTYPE) ; GET CPU TYPE + CP 2 ; Z8S180 REV K OR BETTER? + JR C,HB_CPU2 ; IF NOT, NOT POSSIBLE! + ; SET CLOCK DIVIDE TO 1 RESULTING IN FULL XTAL SPEED + LD A,$80 + OUT0 (Z180_CCR),A + ; REFLECT SPEED CHANGE + LD C,CPUOSC / 1000000 + LD DE,CPUOSC / 1000 + #ENDIF + + #IF (Z180_CLKDIV >= 2) + LD A,(HB_CPUTYPE) ; GET CPU TYPE + CP 3 ; Z8S180 REV N OR BETTER? + JR C,HB_CPU2 ; IF NOT, NOT POSSIBLE! + ; SET CPU MULTIPLIER TO 1 RESULTING IN XTAL * 2 SPEED + ; ALSO SET CCR AGAIN BECAUSE OF REPORTS THAT CCR + ; *MUST* BE SET AFTER CMR. + LD A,$80 + OUT0 (Z180_CMR),A ; CPU MULTIPLIER + OUT0 (Z180_CCR),A ; CLOCK DIVIDE + ; REFLECT SPEED CHANGE + LD C,(CPUOSC * 2) / 1000000 + LD DE,(CPUOSC * 2) / 1000 + #ENDIF +; +HB_CPU2: + ; SAVE CPU SPEED + LD A,C + LD (CB_CPUMHZ),A + LD (CB_CPUKHZ),DE +; +#ENDIF +; + DIAG(%00011111) +; + LD A,(CPUMHZ) ; CPU SPEED TO ACCUM AND INIT + CALL DELAY_INIT ; .. SPEED COMPENSATED DELAY +; +#IF (CPUFAM == CPU_Z180) +; + ; SET FINAL DESIRED WAIT STATES + LD A,0 + (Z180_MEMWAIT << 6) | (Z180_IOWAIT << 4) + OUT0 (Z180_DCNTL),A +; +#ENDIF +; +#IF (CPUFAM == CPU_Z280) +; + LD C,Z280_BTCR ; BUS TIMING AND CONTROL REG + LDCTL HL,(C) + LD A,L ; PUT IN A + AND %00111100 ; CLEAR DC,HM, AND IO FIELDS + OR Z280_INTWAIT << 6 ; SET INT ACK WAIT STATE BITS (DC) + OR Z280_MEMHIWAIT << 2 ; SET HIGH 8MB WAIT STATE BITS (HM) + OR Z280_IOWAIT ; SET I/O WAIT STATE BITS + LD L,A ; BACK TO L + LDCTL (C),HL +; + LD C,Z280_BTIR ; BUS TIMING AND INIT REG + LDCTL HL,(C) + LD A,L ; PUT IN A + AND %11110011 ; CLEAR LM FIELD + OR Z280_MEMLOWAIT << 2 ; SET LOW 8MB WAIT STATE BITS + LD L,A ; BACK TO L + LDCTL (C),HL +; +#ENDIF +; +#IF (INTMODE == 2) + ; SETUP Z80 IVT AND INT MODE 2 + LD A,HBX_IVT >> 8 ; SETUP HI BYTE OF IVT ADDRESS + LD I,A ; ... AND PLACE IT IN I REGISTER + + #IF (CPUFAM == CPU_Z180) + ; SETUP Z180 IVT + XOR A ; SETUP LO BYTE OF IVT ADDRESS + OUT0 (Z180_IL),A ; ... AND PLACE IN Z180 IL REGISTER + #ENDIF + + IM 2 ; SWITCH TO INT MODE 2 +#ENDIF +; +#IF (INTMODE == 3) +; + ; SETUP Z280 INT A FOR VECTORED INTERRUPTS + LD HL,%0010000000000000 + LD C,Z280_ISR + LDCTL (C),HL +; + IM 3 +; +#ENDIF +; +#IF (CPUFAM == CPU_Z180) +; + #IF (INTMODE == 2) +; + ; MASK ALL EXTERNAL INTERRUPTS FOR NOW + LD A,$01 ; INT0 ENABLED, INT1-2 DISABLED + OUT0 (Z180_ITC),A ; WRITE TO INT/TRAP CONTROL REGISTER +; + #ENDIF +; +#ENDIF +; + DIAG(%00111111) +#IF FALSE +; +; TEST DEBUG *************************************************************************************** +; + CALL NEWLINE + CALL REGDMP +; +; TEST DEBUG *************************************************************************************** +; +#ENDIF +; +#IF (DSKYENABLE) + CALL DSKY_PREINIT +; + LD HL,MSG_HBVER + 5 + LD A,(DSKY_HEXMAP + RMJ) + OR $80 + LD (HL),A + INC HL + LD A,(DSKY_HEXMAP + RMN) + OR $80 + LD (HL),A + INC HL + LD A,(DSKY_HEXMAP + RUP) + LD (HL),A + LD HL,MSG_HBVER + CALL DSKY_SHOW +#ENDIF +; + ; INITIALIZE SERIAL PORT + CALL CINIT +; +#IF FALSE +; +; TEST DEBUG *************************************************************************************** +; + CALL NEWLINE + CALL REGDMP +; +; TEST DEBUG *************************************************************************************** +; +#ENDIF +; + DIAG(%01111111) + LED(%00000011) +; +#IF FALSE +; +; TEST DEBUG *************************************************************************************** +; + CALL NEWLINE2 + PRTS("DEBUG+IVT$") + LD DE,HB_IVT + CALL DUMP_BUFFER +; +; TEST DEBUG *************************************************************************************** +; +#ENDIF +; +; ANNOUNCE HBIOS +; + CALL NEWLINE2 + PRTX(STR_BANNER) +; + DIAG(%11111111) +; +; IO PORT SCAN +; +#IF FALSE +PSCN: + LD C,0 ; IO PORT NUMBER + LD B,0 ; LOOP COUNTER + CALL NEWLINE +PSCN1: + CALL NEWLINE + LD A,C + CALL PRTHEXBYTE + CALL PC_COLON + CALL PC_SPACE + CALL DELAY + LD A,C + LD (PSCNX),A +PSCNX .EQU $ + 1 + IN A,(0) + CALL PRTHEXBYTE + CALL PC_COMMA + PUSH BC + LD B,0 + IN A,(C) + POP BC + CALL PRTHEXBYTE + INC C + DJNZ PSCN1 +#ENDIF +; + HB_EI ; INTERRUPTS SHOULD BE OK NOW +; +; DISPLAY PLATFORM INFORMATION +; + CALL NEWLINE2 + PRTX(STR_PLATFORM) +; + LD A,(HB_CPUTYPE) ; GET CPU TYPE + LD DE,HB_CPU_STR ; DISPLAY IT + CALL PRTIDXDEA +; + PRTS(" @ $") + LD HL,(CB_CPUKHZ) + CALL PRTD3M ; PRINT AS DECIMAL WITH 3 DIGIT MANTISSA + PRTS("MHz$") +; +#IF (CPUFAM == CPU_Z180) + PRTS(" IO=0x$") + LD A,Z180_BASE + CALL PRTHEXBYTE +#ENDIF +; +#IF (CPUFAM == CPU_Z280) + CALL PRTSTRD + .TEXT ", BUS @ $" + LD C,Z280_BTIR ; BUS TIMING AND CTL REG + LDCTL HL,(C) + LD A,L ; MOVE TO A + AND %00000011 ; ISOLATE CS FIELD + LD HL,(CB_CPUKHZ) ; GET CPU SPEED + CP %00000001 ; BUS @ 1/1 + JR Z,HB_Z280BUS ; GOT IT, SHOW IT + SRL H ; DIVIDE + RR L ; ... BY 2 + CP %00000000 ; BUS @ 1/2 + JR Z,HB_Z280BUS ; GOT IT, SHOW IT + SRL H ; DIVIDE + RR L ; ... BY 2 + CP %00000010 ; BUS @ 1/4 + JR Z,HB_Z280BUS ; GOT IT, SHOW IT + PRTS("???$") ; INVALID VALUE + JR HB_Z280BUS1 ; CONTINUE +HB_Z280BUS: + CALL PRTD3M ; PRINT AS DECIMAL WITH 3 DIGIT MANTISSA +HB_Z280BUS1: + PRTS("MHz$") ; SUFFIX +#ENDIF +; +; DISPLAY CPU CONFIG +; + CALL NEWLINE + +#IF (CPUFAM == CPU_Z280) + LD A,Z280_MEMLOWAIT + CALL PRTDECB + LD A,'/' + CALL COUT + LD A,Z280_MEMHIWAIT + CALL PRTDECB + CALL PRTSTRD + .TEXT " MEM W/S, $" +#ELSE + XOR A + #IF (CPUFAM == CPU_Z180) + LD A,Z180_MEMWAIT + #ENDIF + CALL PRTDECB + CALL PRTSTRD + .TEXT " MEM W/S, $" +#ENDIF + LD A,1 +#IF (CPUFAM == CPU_Z180) + LD A,Z180_IOWAIT + 1 +#ENDIF +#IF (CPUFAM == CPU_Z280) + LD A,Z280_IOWAIT + 1 +#ENDIF + CALL PRTDECB + CALL PRTSTRD + .TEXT " I/O W/S$" +#IF (CPUFAM == CPU_Z280) + CALL PRTSTRD + .TEXT ", $" + LD A,Z280_INTWAIT + CALL PRTDECB + CALL PRTSTRD + .TEXT " INT W/S$" +#ENDIF +#IF (INTMODE > 0) + CALL PRTSTRD + .TEXT ", INT MODE $" + LD A,INTMODE + CALL PRTDECB +#ENDIF +; + CALL PRTSTRD + .TEXT ", $" + CALL PRTSTRD +#IF (MEMMGR == MM_NONE) + .TEXT "NONE$" +#ENDIF +#IF (MEMMGR == MM_SBC) + .TEXT "SBC$" +#ENDIF +#IF (MEMMGR == MM_Z2) + .TEXT "Z2$" +#ENDIF +#IF (MEMMGR == MM_N8) + .TEXT "N8$" +#ENDIF +#IF (MEMMGR == MM_Z180) + .TEXT "Z180$" +#ENDIF +#IF (MEMMGR == MM_Z280) + .TEXT "Z280$" +#ENDIF +#IF (MEMMGR == MM_ZRC) + .TEXT "ZRC$" +#ENDIF +#IF (MEMMGR == MM_MBC) + .TEXT "MBC$" +#ENDIF + CALL PRTSTRD + .TEXT " MMU$" +; +; DISPLAY MEMORY CONFIG +; + CALL NEWLINE + LD HL,ROMSIZE + CALL PRTDEC + CALL PRTSTRD + .TEXT "KB ROM, $" + LD HL,RAMSIZE + CALL PRTDEC + CALL PRTSTRD + .TEXT "KB RAM$" +; +#IF (CPUFAM == CPU_Z280) + CALL NEWLINE + PRTS("Z280: $") + PRTS("MSR=$") + LD C,Z280_MSR ; MASTER STATUS REGISTER + LDCTL HL,(C) + CALL PRTHEXWORDHL + CALL PC_SPACE + PRTS("BTCR=$") + LD C,Z280_BTCR ; BUS TIMING AND CONTROL REGISTER + LDCTL HL,(C) + CALL PRTHEXWORDHL + CALL PC_SPACE + PRTS("BTIR=$") + LD C,Z280_BTIR ; BUS TIMING AND CONTROL REGISTER + LDCTL HL,(C) + CALL PRTHEXWORDHL + CALL PC_SPACE + PRTS("CCR=$") + LD C,Z280_CCR ; CACHE CONTROL REGISTER + LDCTL HL,(C) + CALL PRTHEXWORDHL +#ENDIF +; +#IFDEF ROMBOOT +; +; ROM CHECKSUM VERIFICATION +; THE FIRST ROM BANK HAS A CHECKSUM INJECTED SUCH THAT +; A COMPUTED CHECKSUM ACROSS THE ENTIRE BANK SHOLD ALWAYS BE ZERO +; +HB_ROMCK: + CALL NEWLINE + PRTS("ROM VERIFY:$") +; + ; TEST FIRST 4 BANKS OF ROM + LD B,1 ; 1 BANK + LD C,0 ; STARTING AT BANK 0 +HB_ROMCK1: + PUSH BC ; SAVE LOOP CONTROL + CALL HB_CKBNK ; TEST THE BANK + CALL PC_SPACE ; FORMATTING + CALL PRTHEXBYTE ; PRINT RESULT + POP BC ; RESTORE LOOP CONTROL + OR A ; SET FLAGS + JR NZ,HB_ROMCK2 ; HANDLE FAILURE + INC C ; NEXT BANK + DJNZ HB_ROMCK1 ; LOOP FOR BANKS + PRTS(" PASS$") ; DISPLAY SUCCESS + JR HB_ROMCKZ ; CONTINUE BOOT +HB_ROMCK2: + PRTS(" FAIL$") ; DISPLAY ERROR + JR HB_ROMCKZ ; CONTINUE BOOT +; +; VERIFY ROM CHECKSUM BANK SPECIFIED IN REG C +; THIS MUST BE COPIED TO UPPER RAM TO RUN +; INTERRUPTS ARE DISABLED SINCE PAGE ZERO VECTOR WILL BE +; SWAPPED OUT. ASSUMES THAT INTERRUPTS ARE ENABLED AT ENTRY. +; +HB_CKBNK: + HB_DI ; SUPPRESS INTERRUPTS + LD HL,$7FFF ; START AT BANK END + LD BC,1 ; DECREMENT VALUE + XOR A ; ZERO ACCUM +HB_CKBNK1: + ADD A,(HL) ; ADD NEXT BYTE + OR A ; CLEAR CARRY + SBC HL,BC ; DECREMENT + JR NC,HB_CKBNK1 ; LOOP TILL DONE + HB_EI ; ALLOW INTERRUPTS AGAIN + RET ; AND DONE +; +HB_CKBNKSIZ .EQU $-HB_CKBNK ; SIZE OF ROUTINE +; +HB_ROMCKZ: +; +#ENDIF +; +; LOW BATTERY DIAGNOSTIC MESSAGE +; +#IF (BATCOND) + LD A,(HB_BATCOND) + OR A + LD DE,STR_LOWBAT + CALL Z,WRITESTR +#ENDIF +; + LD DE,STR_SYSHALT + CALL WRITESTR + JR $ + DI + HALT +; +;================================================================================================== +; INTERRUPT VECTOR TABLE (MUST START AT PAGE BOUNDARY!!!) +;================================================================================================== +; + .FILL $100 - ($ & $FF) +; +; +; IM1 INTERRUPTS ARRIVE HERE AFTER BANK SWITCH TO HBIOS BANK +; LIST OF IM1 INT CALLS IS BUILT DYNAMICALLY BELOW +; SEE HB_ADDIM1 ROUTINE +; EACH ENTRY WILL LOOK LIKE: +; CALL XXXX ; CALL INT HANDLER +; RET NZ ; RETURN IF HANDLED +; +; NOTE THAT THE LIST IS INITIALLY FILLED WITH CALLS TO HB_BADINT. +; AS THE TABLE IS POPULATED, THE ADDRESS OF HB_BADINT IS OVERLAID +; WITH THE ADDRESS OF A REAL INTERRUPT HANDLER. +; +; THERE IS ROOM FOR 8 ENTRIES PLUS A FINAL CALL TO HB_BADINT. +; +#IF (INTMODE < 2) +; +HB_IVT: + CALL HB_BADINT \ RET NZ + CALL HB_BADINT \ RET NZ + CALL HB_BADINT \ RET NZ + CALL HB_BADINT \ RET NZ + CALL HB_BADINT \ RET NZ + CALL HB_BADINT \ RET NZ + CALL HB_BADINT \ RET NZ + CALL HB_BADINT \ RET NZ + CALL HB_BADINT \ RET NZ +; +#ENDIF +; +; IM2 INTERRUPTS ARRIVE HERE AFTER BANK SWITCH TO HBIOS BANK +; THE LIST OF JP TABLE ENTRIES MATCHES THE IM2 VECTORS ONE FOR +; ONE. ANY CALL TO THE PRIMARY IVT (HBX_IVT) WILL BE MAPPED TO +; THE CORRESPONDING JP TABLE ENTRY BELOW AFTER THE BANK SWITCH. +; +; NOTE THAT THE LIST IS INITIALLY FILLED WITH CALLS TO HB_BADINT. +; IT IS INTENDED THAT HARDWARE DRIVERS WILL DYNAMICALLY OVERLAY +; THE ADDRESS PORTION OF THE APPROPRIATE JP TO POINT TO THE +; DESIRED INTERRUPT HANDLER DURING THE DRIVERS INITIALIZATION. +; +; NOTE THAT EACH ENTRY HAS A FILLER BYTE OF VALUE ZERO. THIS BYTE +; HAS NO FUNCTION. IT IS JUST USED TO MAKE ENTRIES AN EVEN 4 BYTES. +; +#IF ((INTMODE == 2) | (INTMODE == 3)) +; +HB_IVT: +HB_IVT00: JP HB_BADINT \ .DB 0 +HB_IVT01: JP HB_BADINT \ .DB 0 +HB_IVT02: JP HB_BADINT \ .DB 0 +HB_IVT03: JP HB_BADINT \ .DB 0 +HB_IVT04: JP HB_BADINT \ .DB 0 +HB_IVT05: JP HB_BADINT \ .DB 0 +HB_IVT06: JP HB_BADINT \ .DB 0 +HB_IVT07: JP HB_BADINT \ .DB 0 +HB_IVT08: JP HB_BADINT \ .DB 0 +HB_IVT09: JP HB_BADINT \ .DB 0 +HB_IVT0A: JP HB_BADINT \ .DB 0 +HB_IVT0B: JP HB_BADINT \ .DB 0 +HB_IVT0C: JP HB_BADINT \ .DB 0 +HB_IVT0D: JP HB_BADINT \ .DB 0 +HB_IVT0E: JP HB_BADINT \ .DB 0 +HB_IVT0F: JP HB_BADINT \ .DB 0 +; +#ENDIF +; +#IF (INTMODE == 1) +; +; ROUTINE BELOW IS USED TO ADD A NEW VECTOR TO THE IM1 +; CALL LIST ABOVE. ENTER WITH HL=VECTOR ADDRESS IN HBIOS +; +HB_ADDIM1: + EX DE,HL ; VECTOR ADDRESS TO DE + LD HL,(HB_IM1PTR) ; GET PTR FOR NEXT ENTRY + INC HL ; BUMP PTR TO ADDRESS FIELD OF CALL OPCODE + LD (HL),E ; ADD VECTOR ADDRESS + INC HL ; ... + LD (HL),D ; ... + INC HL ; BUMP PTR + INC HL ; BUMP PTR + LD (HB_IM1PTR),HL ; SAVE UPDATED POINTER + LD HL,HB_IM1CNT ; POINT TO ENTRY COUNT + INC (HL) ; INCREMENT + RET ; DONE +; +HB_IM1CNT .DB 0 ; NUMBER OF ENTRIES IN CALL LIST +HB_IM1MAX .DB 8 ; MAX ENTRIES IN CALL LIST +HB_IM1PTR .DW HB_IVT ; POINTER FOR NEXT IM1 ENTRY +; +#ENDIF +; +; BAD INTERRUPT HANDLER +; +HB_BADINT: + +#IF FALSE ; *DEBUG* + LD HL,HB_BADINTCNT + INC (HL) + LD A,(HL) + OUT (DIAGPORT),A + OR $FF + RET +HB_BADINTCNT .DB 0 +#ENDIF ; *DEBUG* + + CALL NEWLINE2 + PRTS("+++ BAD INT $") + LD A,L + RRCA + RRCA + CALL PRTHEXBYTE + PRTS("H: $") + + CALL XREGDMP + ;CALL CONTINUE + OR $FF ; SIGNAL INTERRUPT HANDLED + RET +; +; Z280 BAD INT HANDLER +; +#IF (MEMMGR == MM_Z280) +; +Z280_BADINT: + ; SAVE REASON CODE FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_RCSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK + ; SAVE MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_BADINTSTR + CALL NEWLINE2 + PRTS("+++ $") + CALL WRITESTR + POP DE + CALL XREGDMP +; + ; RECOVER MSR, THEN RETURN VIA RETIL + PUSH HL ; SAVE HL + LD HL,(HB_RCSAV) ; GET SAVED REASON CODE + PRTS(" RC=$") + CALL PRTHEXWORDHL ; DUMP MSR + LD HL,(HB_MSRSAV) ; GET SAVED MSR + PRTS(" MSR=$") + CALL PRTHEXWORDHL ; DUMP MSR + EX (SP),HL ; MSR TO STK, RECOVER HL +; + .DB $ED,$55 ; RETIL +; +Z280_SSTEP: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_SSTEPSTR + JP Z280_DIAG +; +Z280_BRKHLT: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_BRKHLTSTR + JP Z280_DIAG +; +Z280_DIVEXC: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_DIVEXCSTR + JP Z280_DIAG +; +Z280_STKOVR: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_STKOVRSTR + JP Z280_DIAG +; +Z280_ACCVIO: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK +; + PUSH DE + LD DE,Z280_ACCVIOSTR + JP Z280_DIAG +; +Z280_DIAG: + CALL NEWLINE2 + PRTS("+++ $") + CALL WRITESTR + POP DE + CALL XREGDMP +; + ; RECOVER MSR, THEN RETURN VIA RETIL + PUSH HL ; SAVE HL + LD HL,(HB_MSRSAV) ; GET SAVED MSR + PRTS(" MSR=$") + CALL PRTHEXWORDHL ; DUMP MSR + EX (SP),HL ; MSR TO STK, RECOVER HL +; + ;RETIL + DI + HALT +; +Z280_BADINTSTR .TEXT "BAD INT $" +Z280_SSTEPSTR .TEXT "SINGLE STEP $" +Z280_BRKHLTSTR .TEXT "BREAK HALT $" +Z280_DIVEXCSTR .TEXT "DIVISION EXCEPTION $" +Z280_STKOVRSTR .TEXT "STACK OVERFLOW $" +Z280_ACCVIOSTR .TEXT "ACCESS VIOLATION $" +; +#ENDIF +; +; Z280 PRIVILEGED INSTRUCTION HANDLER +; +#IF (MEMMGR == MM_Z280) +; +Z280_PRIVINST: + ; SAVE HL AND MSR FOR POSSIBLE RETURN VIA RETIL + EX (SP),HL ; GET MSR, SAVE HL + LD (HB_MSRSAV),HL ; SAVE IT + POP HL ; RECOVER HL, POP STACK + EX (SP),HL ; GET ADR, SAVE HL +; + PUSH AF + PUSH BC + PUSH DE +; + .DB $ED,$96 ; LDUP A,(HL) +; + ; HANDLE DI + CP $F3 ; DI? + JR NZ,Z280_PRIVINST2 + HB_DI ; DO THE DI + INC HL ; BUMP PAST IT + JR Z280_PRIVINSTX +; +Z280_PRIVINST2: + ; HANDLE EI + CP $FB ; EI? + JR NZ,Z280_PRIVINST3 + HB_EI ; DO THE EI + INC HL ; BUMP PAST IT + JR Z280_PRIVINSTX +; +Z280_PRIVINST3: + ; SOMETHING ELSE, DIAGNOSE & HALT SYSTEM + LD DE,Z280_PRIVSTR + CALL WRITESTR + CALL PRTHEXWORDHL +; + ; DUMP 16 BYTES OF USER ADDRESS SPACE + CALL PC_SPACE + CALL PC_LBKT + LD B,$10 +Z280_PRIVINST4: + .DB $ED,$96 ; LDUP A,(HL) + CALL PRTHEXBYTE + INC HL + DJNZ Z280_PRIVINST4 + CALL PC_RBKT +; + ; GO NO FURTHER + DI + HALT +; +Z280_PRIVINSTX: + ; RESTORE REGISTERS + POP DE + POP BC + POP AF +; + ; RECOVER HL AND MSR, THEN RETURN VIA RETIL + EX (SP),HL ; RECOVER HL, ADR TO STK + PUSH HL ; SAVE HL + LD HL,(HB_MSRSAV) ; GET SAVED MSR + EX (SP),HL ; MSR TO STK, RECOVER HL + .DB $ED,$55 ; RETIL +; +HB_MSRSAV .DW 0 ; SAVED MSR +HB_RCSAV .DW 0 ; SAVED REASON CODE +; +Z280_PRIVSTR .TEXT "\r\n\r\n*** Privileged Instruction @$" +; +#ENDIF +; +;================================================================================================== +; Z280 INTERRUPT VECTOR TABLE +;================================================================================================== +; +#IF (MEMMGR == MM_Z280) +; + ; THE Z280 IVT MUST BE ON A 4K BOUNDARY. IT HAS BEEN LOCATED + ; HERE IN AN EFFORT TO MINIMIZE WASTED SPACE. THERE SHOULD BE + ; A LITTLE LESS THAN 4K OF CODE ABOVE. +; + .FILL $1000 - ($ & $FFF) ; MUST BE 4K ALIGNED! +; +Z280_IVT: + .DW 0, 0 ; RESERVED + .DW 0 ; NMI MSR + .DW 0 ; NMI VECTOR + .DW $0000 ; INT A MSR + .DW Z280_BADINT ; INT A VECTOR + .DW $0000 ; INT B MSR + .DW Z280_BADINT ; INT B VECTOR + .DW $0000 ; INT C MSR + .DW Z280_BADINT ; INT C VECTOR + .DW $0000 ; COUNTER/TIMER 0 MSR + .DW Z280_BADINT ; COUNTER/TIMER 0 VECTOR + .DW $0000 ; COUNTER/TIMER 1 MSR + .DW Z280_BADINT ; COUNTER/TIMER 1 VECTOR + .DW 0, 0 ; RESERVED + .DW $0000 ; COUNTER/TIMER 2 MSR + .DW Z280_BADINT ; COUNTER/TIMER 2 VECTOR + .DW $0000 ; DMA CHANNEL 0 MSR + .DW Z280_BADINT ; DMA CHANNEL 0 VECTOR + .DW $0000 ; DMA CHANNEL 1 MSR + .DW Z280_BADINT ; DMA CHANNEL 1 VECTOR + .DW $0000 ; DMA CHANNEL 2 MSR + .DW Z280_BADINT ; DMA CHANNEL 2 VECTOR + .DW $0000 ; DMA CHANNEL 3 MSR + .DW Z280_BADINT ; DMA CHANNEL 3 VECTOR + .DW $0000 ; UART RECEIVER MSR + .DW Z280_BADINT ; UART RECEIVER VECTOR + .DW $0000 ; UART TRANSMITTER MSR + .DW Z280_BADINT ; UART TRANSMITTER VECTOR + .DW $0000 ; SINGLE STEP TRAP MSR + .DW Z280_SSTEP ; SINGLE STEP TRAP VECTOR + .DW $0000 ; BREAK ON HALT TRAP MSR + .DW Z280_BRKHLT ; BREAK ON HALT TRAP VECTOR + .DW $0000 ; DIVISION EXCEPTION TRAP MSR + .DW Z280_DIVEXC ; DIVISION EXCEPTION TRAP VECTOR + .DW $0000 ; STACK OVERFLOW WARNING TRAP MSR + .DW Z280_STKOVR ; STACK OVERFLOW WARNING TRAP VECTOR + .DW $0000 ; ACCESS VIOLATION TRAP MSR + .DW Z280_ACCVIO ; ACCESS VIOLATION TRAP VECTOR + .DW $0000 ; SYSTEM CALL TRAP MSR + .DW Z280_SYSCALL ; SYSTEM CALL TRAP VECTOR + .DW $0000 ; PRIVILEGED INSTRUCTION TRAP MSR + .DW Z280_PRIVINST ; PRIVILEGED INSTRUCTION TRAP VECTOR + .DW $0000 ; EPU <- MEMORY EXTENDED INSTRUCTION TRAP MSR + .DW $0000 ; EPU <- MEMORY EXTENDED INSTRUCTION TRAP VECTOR + .DW $0000 ; MEMORY <- EPU EXTENDED INSTRUCTION TRAP MSR + .DW $0000 ; MEMORY <- EPU EXTENDED INSTRUCTION TRAP VECTOR + .DW $0000 ; A <- EPU EXTENDED INSTRUCTION TRAP MSR + .DW $0000 ; A <- EPU EXTENDED INSTRUCTION TRAP VECTOR + .DW $0000 ; EPU INTERNAL OPERATION EXTENDED INSTRUCTION TRAP MSR + .DW $0000 ; EPU INTERNAL OPERATION EXTENDED INSTRUCTION TRAP VECTOR + .DW 0, 0 ; RESERVED + .DW 0, 0 ; RESERVED + ; PROGRAM COUNTER VALUES FOR NMI/INTA (16) + .DW HBX_IV00 + .DW HBX_IV01 + .DW HBX_IV02 + .DW HBX_IV03 + .DW HBX_IV04 + .DW HBX_IV05 + .DW HBX_IV06 + .DW HBX_IV07 + .DW HBX_IV08 + .DW HBX_IV09 + .DW HBX_IV0A + .DW HBX_IV0B + .DW HBX_IV0C + .DW HBX_IV0D + .DW HBX_IV0E + .DW HBX_IV0F + ; THE REMAINDER OF THE Z280 IVT IS TRUNCATED HERE BECAUSE IT + ; TAKES A BUNCH OF SPACE AND IS NOT USED. WE SUPPORT ONLY + ; 16 VECTORED INTERRUPTS AND THEY MUST BE CONNECTED TO INTA. +; +#ENDIF +; +; Z280 BANK SELECTION (CALLED FROM PROXY) +; +#IF (MEMMGR == MM_Z280) +; +; REG A HAS BANK ID, REG B HAS INITIAL PDR TO PROGRAM +; REGISTERS AF, BC, HL DESTROYED +; +; THIS ROUTINE MAY BE RELOCATED TO RUN IN HIGH MEMORY IN CERTAIN CASES +; LIKE A SYSTEM RESTART. IT MUST BE KEPT ENTIRELY RELOCATABLE. +; +Z280_BNKSEL: + ;; *DEBUG* + ;CALL PC_LBKT + ;CALL PRTHEXBYTE + ;CALL PC_RBKT + + ; SELECT I/O PAGE $FE (SAVING PREVIOUS VALUE) + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + LDCTL HL,(C) ; GET CURRENT I/O PAGE + PUSH HL ; SAVE IT + LD L,$FF ; NEW I/O PAGE + LDCTL (C),HL +; + ; CONVERT BANK ID TO TOP 12 BITS OF PHYSICAL ADDRESS + ; WITH $0A IN THE LOW ORDER NIBBLE: + ; BANK ID: R000 BBBB + ; PDR: R000 0BBB B000 1010 (RCBUS) + ; PDR: 0000 RBBB B000 1010 (ZZ80MB) +; + MULTU A,$80 ; HL=0R00 0BBB B000 0000 + BIT 6,H ; RAM BIT SET? + JR Z,Z280_BNKSEL2 ; IF NOT, ALL DONE + RES 6,H ; OTHERWISE, MOVE RAM BIT + SET RAMLOC-16,H ; HL=0000 RBBB B000 0000 +; +Z280_BNKSEL2: +; + ; SET LOW NIBBLE + LD A,$0A ; VALUE FOR LOW NIBBLE + .DB $ED,$6D ; ADD HL,A ; HL=0000 RBBB B000 1010 +; + ; POINT TO FIRST PDR TO PROGRAM + LD A,B ; INITIAL PDR TO PROG + OUT (Z280_MMUPDRPTR),A ; SET THE PDR POINTER +; + ; PROGRAM 8 PDRS + LD C,Z280_MMUBLKMOV ; PDR BLOCK MOVE PORT + ;LD B,8 ; PROGRAM 8 PDRS + LD A,$10 ; PDR VALUE INCREMENT +Z280_BNKSEL3: + ; PROGRAM 8 PDR VALUES + ; LOOP UNROLLED FOR SPEED + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + OUTW (C),HL ; WRITE VALUE + ADD HL,A ; BUMP VALUE + ;DJNZ Z280_BNKSEL3 ; DO ALL PDRS +; + ; RESTORE I/O PAGE + LD C,Z280_IOPR ; REG C POINTS TO I/O PAGE REGISTER + POP HL ; RECOVER ORIGINAL I/O PAGE + LDCTL (C),HL +; + RET +; +Z280_BNKSEL_LEN .EQU $ - Z280_BNKSEL +; +#ENDIF +; +; Z280 BANK COPY (CALLED FROM PROXY) +; +#IF (MEMMGR == MM_Z280) +; +Z280_BNKCPY: + ; Z280 MEMORY TO MEMORY DMA + ; USE FLOW THROUGH MODE + ; SINGLE BYTE TRANSFER + ; TRANSACTION DESCRIPTION REGISTER (TDR) + ; %0000 0000 0000 0000 + ; - AUTO INCREMENT MEMORY + ; - FLOWTHROUGH OPERATION + ; - SINGLE TRANSACTION (CAN WE USE CONTINUOUS???) + ; - 1 BYTE XFER SIZE +; + ; SAVE INCOMING REGISTERS + PUSH HL + PUSH DE + PUSH BC +; + PUSH BC ; SAVE COUNT + PUSH HL ; SAVE SOURCE ADDRESS +; + ; SELECT I/O PAGE $FF + LD C,Z280_IOPR ; I/O PAGE REGISTER + LDCTL HL,(C) ; GET CURRENT I/O PAGE + LD (IOPRVAL),HL ; SAVE IT + LD L,$FF ; I/O PAGE $FF + LDCTL (C),HL +; + LD C,Z280_DMA0_DSTL ; START WITH DEST REG LO +; + LD A,(HB_DSTBNK) ; DEST BANK TO ACCUM + CALL Z2DMAADR ; SETUP DEST ADR REGS +; + POP DE ; SRC ADR TO DE + LD A,(HB_SRCBNK) ; DEST BANK TO ACCUM + CALL Z2DMAADR ; SETUP SOURCE ADR REGS +; + POP HL ; COUNT TO HL + OUTW (C),HL + INC C ; BUMP TO TDR +; + LD HL,$8000 ; ENABLE DMA0 TO RUN! + OUTW (C),HL +; + ; WAIT FOR XFER TO COMPLETE +Z2DMALOOP: + .DB $ED,$B7 ; INW HL,(C) + BIT 7,H ; CHECK EN BIT OF TDR + JR NZ,Z2DMALOOP ; LOOP WHILE ACTIVE +; + ; RESTORE I/O PAGE + LD C,Z280_IOPR ; I/O PAGE REGISTER + LD HL,(IOPRVAL) ; RESTORE I/O PAGE + LDCTL (C),HL +; + ; SETUP RETURN VALUES + POP BC ; RECOVER ORIGINAL BC + POP DE ; RECOVER ORIGINAL DE + POP HL ; RECOVER ORIGINAL HL + ADD HL,BC ; INCREMENT SRC ADR BY COUNT + EX DE,HL ; SWAP + ADD HL,BC ; INCREMENT DST ADR BY COUNT + EX DE,HL ; SWAP BACK + LD BC,0 ; COUNT IS NOW ZERO +; + RET +; +Z2DMAADR: + ; SET ADDRESS REGISTERS, BANK IN A, ADDRESS IN DE + ; C POINTS TO FIRST DMA ADR PORT TO SET + ; A=R000 BBBB, DE=0AAA AAAA AAAA AAAA + ; RC: DMA HI=0000 RBBB BAAA 1111 LO=1111 AAAA AAAA AAAA + ; ZZ: DMA HI=R000 0BBB BAAA 1111 LO=1111 AAAA AAAA AAAA + BIT 7,D ; HIGH RAM? + JR Z,Z2DMAADR1 ; NO, SKIP + LD A,$8F ; SUBSTITUTE COMMON RAM BANK ID +; +Z2DMAADR1: + ; ADR HI FROM A:DE + LD L,D ; L=?AAA AAAA + LD H,A ; H=R000 BBBB + SLA L ; L=AAAA AAA0 ? + SRL H ; H=0R00 0BBB B + RR L ; L=BAAA AAAA 0 + LD A,$0F ; A=0000 1111 + OR L ; A=BAAA 1111 + LD L,A ; L=BAAA 1111 +; + ; MOVE THE RAM/ROM BIT. + ; RCBUS DMA HI=0000 RBBB BAAA 1111 LO=1111 AAAA AAAA AAAA + ; ZZ80MB DMA HI=R000 0BBB BAAA 1111 LO=1111 AAAA AAAA AAAA + BIT 6,H + JR Z,Z2DMAADR2 + RES 6,H + SET RAMLOC-16,H +; +Z2DMAADR2: + PUSH HL ; SAVE IT FOR NOW + + ; ADR LO FROM DE: + LD L,E ; L=AAAA AAAA + LD A,$F0 ; A=1111 0000 + OR D ; A=1111 AAAA + LD H,A ; HL=1111 AAAA AAAA AAAA +; + ; SET ADR LO REG + OUTW (C),HL + INC C ; BUMP TO ADR HI REG +; + ; SET ADR HI REG + POP HL ; RECOVER THE HI VAL + OUTW (C),HL + INC C ; BUMP TO NEXT REG +; + RET +#ENDIF +; +; Z280 SYSCALL VECTOR ENTRY POINT. TAKES STACK PARAMETER AS A BRANCH +; ADDRESS AND CALLS IT. ALLOWS ANY USER MODE CODE TO CALL INTO AN +; ARBITRARY LOCATION OF SYSTEM MODE CODE. +; +#IF (MEMMGR == MM_Z280) +Z280_SYSCALL: + EX (SP),HL + LD (Z280_SYSCALL_GO+1),HL + POP HL +Z280_SYSCALL_GO: + CALL $FFFF ; PARM SET ABOVE + .DB $ED,$55 ; RETIL +#ENDIF +; +#DEFINE USEDELAY +#INCLUDE "util.asm" +; +#IF (DSKYENABLE) +#DEFINE DSKY_KBD + #IF (DSKYMODE == DSKYMODE_V1) +#INCLUDE "dsky.asm" + #ENDIF + #IF (DSKYMODE == DSKYMODE_NG) +#INCLUDE "dskyng.asm" + #ENDIF +#ENDIF +; +; PANIC: DUMP MACHINE STATE AND HALT +; +PANIC: + PUSH DE + LD DE,STR_PANIC + CALL WRITESTR + POP DE + CALL XREGDMP ; DUMP REGISTERS + JR SYSHALT ; FULL STOP +; +; +; +CONTINUE: + PUSH AF +CONTINUE1: + PUSH DE + LD DE,STR_CONTINUE + CALL WRITESTR + POP DE + CALL CIN + RES 5,A ; FORCE UPPERCASE (IMPERFECTLY) + CALL COUT ; ECHO + CP 'Y' + JR Z,CONTINUE3 + CP 'N' + JR Z,SYSHALT + JR CONTINUE1 +CONTINUE3: + CALL NEWLINE + POP AF + RET +; +; +; +SYSHALT: + LD DE,STR_HALT + CALL WRITESTR + DI + HALT +; +; PRINT VALUE OF HL AS THOUSANDTHS, IE. 0.000 +; +PRTD3M: + PUSH BC + PUSH DE + PUSH HL + LD E,'0' + LD BC,-10000 + CALL PRTD3M1 + LD E,0 + LD BC,-1000 + CALL PRTD3M1 + CALL PC_PERIOD + LD BC,-100 + CALL PRTD3M1 + LD C,-10 + CALL PRTD3M1 + LD C,-1 + CALL PRTD3M1 + POP HL + POP DE + POP BC + RET +PRTD3M1: + LD A,'0' - 1 +PRTD3M2: + INC A + ADD HL,BC + JR C,PRTD3M2 + SBC HL,BC + CP E + JR Z,PRTD3M3 + LD E,0 + CALL COUT +PRTD3M3: + RET +; +HB_CPU_STR: .TEXT " Z80$" + .TEXT " Z80180$" + .TEXT " Z8S180-K$" + .TEXT " Z8S180-N$" + .TEXT " Z80280$" +; +;================================================================================================== +; CONSOLE CHARACTER I/O HELPER ROUTINES (REGISTERS PRESERVED) +;================================================================================================== +; +#IF (MINIO == MINIO_UART) + #INCLUDE "min_uart.asm" +#ENDIF +; +#IF (MINIO == MINIO_ASCI) + #INCLUDE "min_asci.asm" +#ENDIF +; +#IF (MINIO == MINIO_ACIA) + #INCLUDE "min_acia.asm" +#ENDIF +; +#IF (MINIO == MINIO_SIO) + #INCLUDE "min_sio.asm" +#ENDIF +; +#IF (MINIO == MINIO_Z2U) + #INCLUDE "min_z2u.asm" +#ENDIF +; +;================================================================================================== +; MISCELLANEOUS UTILITY FUNCTIONS +;================================================================================================== +; +; SET HL TO IY+A, A IS TRASHED +; +LDHLIYA: + PUSH IY ; COPY INSTANCE DATA PTR + POP HL ; ... TO HL + ;JP ADDHLA ; APPLY OFFSET TO HL AND RETURN + ADD A,L ; ADD OFFSET TO LSB + LD L,A ; ... PUT BACK IN L + RET NC ; DONE IF CF NOT SET + INC H ; IF CF SET, BUMP MSB + RET ; ... AND RETURN +; +;================================================================================================== +; HBIOS GLOBAL DATA +;================================================================================================== +; +HB_CPUTYPE .DB 0 ; 0=Z80, 1=80180, 2=SL1960, 3=ASCI BRG +; +CB_CPUMHZ .DB CPUMHZ +CB_CPUKHZ .DW CPUKHZ +; +IOPRVAL .DW 0 ; TEMP STORAGE FOR IOPR +; +HB_BATCOND .DB 0 ; BATTERY CONDITION (0=LOW, 1=OK) +; +STR_BANNER .DB "RomWBW HDIAG v", BIOSVER, ", ", TIMESTAMP, "$" +STR_PLATFORM .DB PLATFORM_NAME, "$" +STR_SWITCH .DB "*** Activating CRT Console ***$" +STR_BADINT .DB "\r\n*** BAD INT ***\r\n$" +STR_LOWBAT .DB "\r\n\r\n+++ LOW BATTERY +++$" +; +STR_PANIC .TEXT "\r\n>>> PANIC: $" +STR_SYSCHK .TEXT "\r\n>>> SYSCHK: $" +STR_CONTINUE .TEXT "\r\nContinue (Y/N)? $" +STR_SYSHALT .TEXT "\r\n\r\n*** SYSTEM HALTED ***$" +; +#IF (DSKYENABLE) ; 'H','B','I','O',' ',' ',' ',' ' + #IF (DSKYMODE == DSKYMODE_V1) +MSG_HBVER .DB $3E,$7F,$0A,$7B,$00,$00,$00,$00 ; "HBIO " + #ENDIF + #IF (DSKYMODE == DSKYMODE_NG) +MSG_HBVER .DB $76,$7F,$30,$3F,$00,$00,$00,$00 ; "HBIO " + #ENDIF +#ENDIF +; +HB_APPBNK .DB 0 ; START BANK WHEN RUN IN APP MODE +; +HB_BCDTMP .FILL 5,0 ; BCD NUMBER STORAGE (TEMP) +; +HB_END .EQU $ +; +SLACK .EQU HBX_LOC - $ + .ECHO "HDIAG space remaining: " + .ECHO SLACK + .ECHO " bytes.\n" +; +#IFDEF ROMBOOT + .FILL SLACK +#ENDIF +; + .END diff --git a/Source/HDIAG/sio.asm b/Source/HDIAG/sio.asm new file mode 100644 index 00000000..48f527e3 --- /dev/null +++ b/Source/HDIAG/sio.asm @@ -0,0 +1,108 @@ +; +;======================================================================= +; HDIAG SIO Driver +;======================================================================= +; +; Assumes the UART port conventions for RCBus. Command/status port +; at $80 and read/write data port at $81. +; Assuming a UART clock frequency of 1.8432 MHz, the baud rate +; will be 38400. +; +sio_cmd .equ $80 ; SIO command/status port +sio_dat .equ $81 ; SIO read/write port +; +sio_jptbl: + jp sio_cinit ; Initialize serial port + jp sio_cin ; Read byte + jp sio_cout ; Write byte + jp sio_cist ; Input status + jp sio_cost ; Output Status +; +; +; +sio_cinit: + ; Detect SIO here... + ; Zero the int vector register + ld a,2 ; select WR2 (int vector) + out (sio_cmd+2),a ; do it + xor a ; zero accum + out (sio_cmd+2),a ; write to WR2 + ; Read the int vector register and check for zero + ld a,2 ; select WR2 (int vector) + out (sio_cmd+2),a ; do it + in a,(sio_cmd+2) ; get int vector value + and $F0 ; only top nibble + ret nz ; abort if not zero + ; Set test value in int vector register + ld a,2 ; select WR2 (int vector) + out (sio_cmd+2),a ; do it + ld a,$FF ; test value + out (sio_cmd+2),a ; write to WR2 + ; Read the int vector register to confirm value written + ld a,2 ; select WR2 (int vector) + out (sio_cmd+2),a ; do it + in a,(sio_cmd+2) ; get int vector value + and $F0 ; only top nibble + cp $F0 ; compare + ret nz ; abort if miscompare +; + ; Program the SIO, just channel A + ld c,sio_cmd ; command port + ld hl,sio_initregs ; point to init values + ld b,sio_initlen ; count of bytes to write + otir ; write all values +; + xor a ; signal success + ret ; done +; +; +; +sio_cin: + call sio_cist ; check for char ready + jr z,sio_cin ; if not, loop + in a,(sio_dat) ; read byte + ret ; done +; +; +; +sio_cout: + push af ; save incoming +sio_cout1: + call sio_cost ; ready for char? + jr z,sio_cout1 ; loop if not + pop af ; restore incoming + out (sio_dat),a ; write byte + ret ; and done +; +; +; +sio_cist: + xor a ; select WR0 + out (sio_cmd),a ; do it + in a,(sio_cmd) ; get status + and $01 ; isolate rx ready + ret ; a != 0 if rx ready, else 0 +; +; +; +sio_cost: + xor a ; select WR0 + out (sio_cmd),a ; do it + in a,(sio_cmd) ; get status + and $04 ; isolate tx ready (empty) + ret ; a != 0 if tx ready, else 0 +; +; Table for chip register initialization. Simple setup for clock +; divided by 64. Assuming a system clock of 7.3728 MHz, this will +; result in a baud rate of 115200 which is standard for RCBus. +; +sio_initregs: + .db $00, $18 ; wr0: channel reset cmd + .db $04, $C4 ; wr4: clk baud parity stop bit + .db $01, $00 ; wr1: no interrupts + .db $02, $00 ; wr2: im2 vec offset + .db $03, $E1 ; wr3: 8 bit rcv, cts/dcd auto, rx enable + .db $05, $EA ; wr5: dtr, 8 bits send, tx enable, rts 1 11 0 1 0 1 0 (1=dtr,11=8bits,0=sendbreak,1=txenable,0=sdlc,1=rts,0=txcrc) +; +sio_initlen .equ $-sio_initregs + diff --git a/Source/HDIAG/uart.asm b/Source/HDIAG/uart.asm new file mode 100644 index 00000000..c21a0ad9 --- /dev/null +++ b/Source/HDIAG/uart.asm @@ -0,0 +1,106 @@ +; +;======================================================================= +; HDIAG UART Driver +;======================================================================= +; +; Assumes the UART conventions for SBC/MBC/Zeta, base port at $68. +; Assuming a UART clock frequency of 1.8432 MHz, the baud rate +; will be 38400. +; +uart_iob .equ $68 +uart_osc .equ 1843200 +uart_baudrate .equ 38400 +uart_divisor .equ uart_osc / uart_baudrate / 16 +; +uart_rbr .equ uart_iob + 0 ; dlab=0: rcvr buffer reg (read only) +uart_thr .equ uart_iob + 0 ; dlab=0: xmit holding reg (write only) +uart_ier .equ uart_iob + 1 ; dlab=0: int enable reg +uart_iir .equ uart_iob + 2 ; int ident register (read only) +uart_fcr .equ uart_iob + 2 ; fifo control reg (write only) +uart_lcr .equ uart_iob + 3 ; line control reg +uart_mcr .equ uart_iob + 4 ; modem control reg +uart_lsr .equ uart_iob + 5 ; line status reg +uart_msr .equ uart_iob + 6 ; modem status reg +uart_scr .equ uart_iob + 7 ; scratch register +uart_dll .equ uart_iob + 0 ; dlab=1: divisor latch (ls) +uart_dlm .equ uart_iob + 1 ; dlab=1: divisor latch (ms) +; +; +; +uart_jptbl: + jp uart_cinit ; Initialize serial port + jp uart_cin ; Read byte + jp uart_cout ; Write byte + jp uart_cist ; Input status + jp uart_cost ; Output Status +; +; +; +uart_cinit: + ; Test for existence + ;;;xor a ; zero accum + ;;;out (uart_ier),a ; ier := 0 + ;;;ld a,$80 ; dlab bit on + ;;;out (uart_lcr),a ; output to lcr (dlab regs now active) + ;;;ld a,$5A ; load test value + ;;;out (uart_dlm),a ; output to dlm + ;;;in a,(uart_dlm) ; read it back + ;;;cp $5A ; check for test value + ;;;ret nz ; nope, unknown uart or not present + ;;;xor a ; dlab bit off + ;;;out (uart_lcr),a ; output to lcr (dlab regs now inactive) + ;;;in a,(uart_ier) ; read ier + ;;;cp $5A ; check for test value + ;;;jr nz,uart_cinit1 ; if *not* $5A, good to go + ;;;or $FF ; signal error + ;;;ret ; done +; +uart_cinit1: + ld a,$80 ; lcr := dlab on + out (uart_lcr),a ; set lcr + ld a,uart_divisor & $ff ; low byte of divisor + out (uart_dll),a ; set divisor (lsb) + ld a,uart_divisor / $100 ; high byte of divisor + out (uart_dlm),a ; set divisor (msb) + xor a ; zero accum + out (uart_ier),a ; init ier (no ints) + ld a,$03 ; value for lcr and mcr + out (uart_lcr),a ; lcr := 3, dlab off, 8 data, 1 stop, no parity + out (uart_mcr),a ; mcr := 3, dtr on, rts on + ld a,$07 ; enable & reset fifo's + out (uart_fcr),a ; do it + xor a ; signal success + ret +; +; +; +uart_cin: + call uart_cist ; received char ready? + jr z,uart_cin ; loop if not + in a,(uart_rbr) ; read byte + ret ; and done +; +; +; +uart_cout: + push af ; save incoming +uart_cout1: + call uart_cost ; ready for char? + jr z,uart_cout1 ; loop if not + pop af ; restore incoming + out (uart_thr),a ; write byte + ret ; and done +; +; +; +uart_cist: + in a,(uart_lsr) ; get status + and $01 ; isolate bit 0 (receive data ready) + ret ; a != 0 if char ready, else 0 +; +; +; +uart_cost: + in a,(uart_lsr) ; get status + and $20 ; isolate bit 5 + ret ; a != 0 if char ready, else 0 diff --git a/Source/HDIAG/util.asm b/Source/HDIAG/util.asm new file mode 100644 index 00000000..b78525d2 --- /dev/null +++ b/Source/HDIAG/util.asm @@ -0,0 +1,124 @@ +; +;======================================================================= +; HDIAG Utility Functions +;======================================================================= +; +; Print string at HL on console, null terminated. +; HL and AF are trashed. +; +prtstr: + ld a,(hl) ; get next character + or a ; set flags + inc hl ; bump pointer regardless + ret z ; done if null + call cout ; display character + jr prtstr ; loop till done +; +; Print a string from a lookup table pointed to by HL, index A +; with a prefix string at DE. HL, DE, and A are trashed. +; +prtstrtbl: + push af + ex de,hl + call prtstr + ex de,hl + pop af + rlca + call addhla + ld a,(hl) + inc hl + ld h,(hl) + ld l,a + call prtstr + ret +; +; Print the hex byte value in A +; +prthex8: + push af + push de + call hexascii + ld a,d + call cout + ld a,e + call cout + pop de + pop af + ret +; +; Print the hex word value in BC +; +prthex16: + push af + ld a,b + call prthex8 + ld a,c + call prthex8 + pop af + ret +; +; Print the hex dword value in DE:HL +; +prthex32: + push bc + push de + pop bc + call prthex16 + push hl + pop bc + call prthex16 + pop bc + ret +; +; Convert binary value in A to ASCII hex characters in DE +; +hexascii: + ld d,a + call hexconv + ld e,a + ld a,d + rlca + rlca + rlca + rlca + call hexconv + ld d,a + ret +; +; Convert low nibble of A to ASCII hex +; +hexconv: + and $0F ; low nibble only + add a,$90 + daa + adc a,$40 + daa + ret + +; +; Jump to address in HL/IX/IY +; +; No registers affected +; Typically used as "call jphl" to call a routine +; at address in HL register. +; +jphl: + jp (hl) +; +jpix: + jp (ix) +; +jpiy: + jp (iy) +; +; Add hl,a +; +; A register is destroyed! +; +addhla: + add a,l + ld l,a + ret nc + inc h + ret + diff --git a/Source/HDIAG/z180.inc b/Source/HDIAG/z180.inc new file mode 100644 index 00000000..3e0ff0f8 --- /dev/null +++ b/Source/HDIAG/z180.inc @@ -0,0 +1,71 @@ +; +;======================================================================= +; Z180 Internal I/O Ports +;======================================================================= +; +; These are offsets from the Z180 I/O base address. +; +z180_cntla0 .equ $00 ; asci0 control a +z180_cntla1 .equ $01 ; asci1 control a +z180_cntlb0 .equ $02 ; asci0 control b +z180_cntlb1 .equ $03 ; asci1 control b +z180_stat0 .equ $04 ; asci0 status +z180_stat1 .equ $05 ; asci1 status +z180_tdr0 .equ $06 ; asci0 transmit +z180_tdr1 .equ $07 ; asci1 transmit +z180_rdr0 .equ $08 ; asci0 receive +z180_rdr1 .equ $09 ; asci1 receive +z180_cntr .equ $0a ; csi/o control +z180_trdr .equ $0b ; csi/o transmit/receive +z180_tmdr0l .equ $0c ; timer 0 data lo +z180_tmdr0h .equ $0d ; timer 0 data hi +z180_rldr0l .equ $0e ; timer 0 reload lo +z180_rldr0h .equ $0f ; timer 0 reload hi +z180_tcr .equ $10 ; timer control +; +z180_asext0 .equ $12 ; asci0 extension control (z8s180) +z180_asext1 .equ $13 ; asci1 extension control (z8s180) +; +z180_tmdr1l .equ $14 ; timer 1 data lo +z180_tmdr1h .equ $15 ; timer 1 data hi +z180_rldr1l .equ $16 ; timer 1 reload lo +z180_rldr1h .equ $17 ; timer 1 reload hi +z180_frc .equ $18 ; free running counter +; +z180_astc0l .equ $1a ; asci0 time constant lo (z8s180) +z180_astc0h .equ $1b ; asci0 time constant hi (z8s180) +z180_astc1l .equ $1c ; asci1 time constant lo (z8s180) +z180_astc1h .equ $1d ; asci1 time constant hi (z8s180) +z180_cmr .equ $1e ; clock multiplier (latest z8s180) +z180_ccr .equ $1f ; cpu control (z8s180) +; +z180_sar0l .equ $20 ; dma0 source addr lo +z180_sar0h .equ $21 ; dma0 source addr hi +z180_sar0b .equ $22 ; dma0 source addr bank +z180_dar0l .equ $23 ; dma0 dest addr lo +z180_dar0h .equ $24 ; dma0 dest addr hi +z180_dar0b .equ $25 ; dma0 dest addr bank +z180_bcr0l .equ $26 ; dma0 byte count lo +z180_bcr0h .equ $27 ; dma0 byte count hi +z180_mar1l .equ $28 ; dma1 memory addr lo +z180_mar1h .equ $29 ; dma1 memory addr hi +z180_mar1b .equ $2a ; dma1 memory addr bank +z180_iar1l .equ $2b ; dma1 i/o addr lo +z180_iar1h .equ $2c ; dma1 i/o addr hi +z180_iar1b .equ $2d ; dma1 i/o addr bank (z8s180) +z180_bcr1l .equ $2e ; dma1 byte count lo +z180_bcr1h .equ $2f ; dma1 byte count hi +z180_dstat .equ $30 ; dma status +z180_dmode .equ $31 ; dma mode +z180_dcntl .equ $32 ; dma/wait control +z180_il .equ $33 ; interrupt vector load +z180_itc .equ $34 ; int/trap control +; +z180_rcr .equ $36 ; refresh control +; +z180_cbr .equ $38 ; mmu common base register +z180_bbr .equ $39 ; mmu bank base register +z180_cbar .equ $3a ; mmu common/bank area register +; +z180_omcr .equ $3e ; operation mode control +z180_icr .equ $3f ; i/o control register diff --git a/Source/HDIAG/z2u.asm b/Source/HDIAG/z2u.asm new file mode 100644 index 00000000..5e3dc109 --- /dev/null +++ b/Source/HDIAG/z2u.asm @@ -0,0 +1,49 @@ +; +;======================================================================= +; HDIAG Z180 UART Driver +;======================================================================= +; +z2u_jptbl: + jp z2u_cinit ; Initialize serial port + jp z2u_cin ; Read byte + jp z2u_cout ; Write byte + jp z2u_cist ; Input status + jp z2u_cost ; Output Status +; +; +; +z2u_cinit: + ; initialize port here + or $FF ; signal failure for now + ret +; +; +; +z2u_cin: + call z2u_cist ; check for char ready + jr z,z2u_cin ; if not, loop + ; read byte here + ret ; done +; +; +; +z2u_cout: + push af ; save incoming +z2u_cout1: + call z2u_cost ; ready for char? + jr z,z2u_cout1 ; loop if not + pop af ; restore incoming + ; write byte here + ret ; and done +; +; +; +z2u_cist: + ; check input status here + ret +; +; +; +z2u_cost: + ; check output status here + ret ; a != 0 if char ready, else 0 diff --git a/Source/Images/Build.cmd b/Source/Images/Build.cmd index 2305cc74..f3c39e87 100644 --- a/Source/Images/Build.cmd +++ b/Source/Images/Build.cmd @@ -1,28 +1,53 @@ @echo off setlocal +::call BuildDisk.cmd bp hd wbw_hd512 || exit /b +::goto :eof + echo. echo Building Floppy Disk Images... echo. -call BuildFD.cmd cpm22 ..\cpm22\cpm_wbw.sys -call BuildFD.cmd zsdos ..\zsdos\zsys_wbw.sys -call BuildFD.cmd nzcom ..\zsdos\zsys_wbw.sys -call BuildFD.cmd cpm3 ..\cpm3\cpmldr.sys -call BuildFD.cmd zpm3 ..\cpm3\cpmldr.sys -call BuildFD.cmd ws4 +call BuildDisk.cmd cpm22 fd wbw_fd144 ..\cpm22\cpm_wbw.sys || exit /b +call BuildDisk.cmd zsdos fd wbw_fd144 ..\zsdos\zsys_wbw.sys || exit /b +call BuildDisk.cmd nzcom fd wbw_fd144 ..\zsdos\zsys_wbw.sys || exit /b +call BuildDisk.cmd cpm3 fd wbw_fd144 ..\cpm3\cpmldr.sys || exit /b +call BuildDisk.cmd zpm3 fd wbw_fd144 ..\zpm3\zpmldr.sys || exit /b +call BuildDisk.cmd ws4 fd wbw_fd144 || exit /b +call BuildDisk.cmd qpm fd wbw_fd144 d_qpm\u0\qpm.sys || exit /b + +echo. +echo Building Hard Disk Images (512 directory entry format)... +echo. +call BuildDisk.cmd cpm22 hd wbw_hd512 ..\cpm22\cpm_wbw.sys || exit /b +call BuildDisk.cmd zsdos hd wbw_hd512 ..\zsdos\zsys_wbw.sys || exit /b +call BuildDisk.cmd nzcom hd wbw_hd512 ..\zsdos\zsys_wbw.sys || exit /b +call BuildDisk.cmd cpm3 hd wbw_hd512 ..\cpm3\cpmldr.sys || exit /b +call BuildDisk.cmd zpm3 hd wbw_hd512 ..\zpm3\zpmldr.sys || exit /b +call BuildDisk.cmd ws4 hd wbw_hd512 || exit /b +call BuildDisk.cmd dos65 hd wbw_hd512 ..\zsdos\zsys_wbw.sys || exit /b +call BuildDisk.cmd qpm hd wbw_hd512 d_qpm\u0\qpm.sys || exit /b + +if exist ..\BPBIOS\bpbio-ww.rel call BuildDisk.cmd bp hd wbw_hd512 || exit /b + +echo. +echo Building Combo Disk (512 directory entry format) Image... +copy /b ..\..\Binary\hd512_cpm22.img + ..\..\Binary\hd512_zsdos.img + ..\..\Binary\hd512_nzcom.img + ..\..\Binary\hd512_cpm3.img + ..\..\Binary\hd512_zpm3.img + ..\..\Binary\hd512_ws4.img ..\..\Binary\hd512_combo.img || exit /b echo. -echo Building Hard Disk Images... +echo Building Hard Disk Images (1024 directory entry format)... echo. -call BuildHD.cmd cpm22 ..\cpm22\cpm_wbw.sys -call BuildHD.cmd zsdos ..\zsdos\zsys_wbw.sys -call BuildHD.cmd nzcom ..\zsdos\zsys_wbw.sys -call BuildHD.cmd cpm3 ..\cpm3\cpmldr.sys -call BuildHD.cmd zpm3 ..\cpm3\cpmldr.sys -call BuildHD.cmd ws4 +call BuildDisk.cmd cpm22 hd wbw_hd1k ..\cpm22\cpm_wbw.sys || exit /b +call BuildDisk.cmd zsdos hd wbw_hd1k ..\zsdos\zsys_wbw.sys || exit /b +call BuildDisk.cmd nzcom hd wbw_hd1k ..\zsdos\zsys_wbw.sys || exit /b +call BuildDisk.cmd cpm3 hd wbw_hd1k ..\cpm3\cpmldr.sys || exit /b +call BuildDisk.cmd zpm3 hd wbw_hd1k ..\zpm3\zpmldr.sys || exit /b +call BuildDisk.cmd ws4 hd wbw_hd1k || exit /b +call BuildDisk.cmd qpm hd wbw_hd1k d_qpm\u0\qpm.sys || exit /b + +if exist ..\BPBIOS\bpbio-ww.rel call BuildDisk.cmd bp hd wbw_hd1k || exit /b -if exist ..\BPBIOS\bpbio-ww.rel call BuildHD.cmd bp +copy hd1k_prefix.dat ..\..\Binary\ || exit /b echo. -echo Building Combo Disk Image... -copy /b ..\..\Binary\hd_cpm22.img + ..\..\Binary\hd_zsdos.img + ..\..\Binary\hd_nzcom.img + ..\..\Binary\hd_cpm3.img + ..\..\Binary\hd_zpm3.img + ..\..\Binary\hd_ws4.img ..\..\Binary\hd_combo.img +echo Building Combo Disk (1024 directory entry format) Image... +copy /b hd1k_prefix.dat + ..\..\Binary\hd1k_cpm22.img + ..\..\Binary\hd1k_zsdos.img + ..\..\Binary\hd1k_nzcom.img + ..\..\Binary\hd1k_cpm3.img + ..\..\Binary\hd1k_zpm3.img + ..\..\Binary\hd1k_ws4.img ..\..\Binary\hd1k_combo.img || exit /b diff --git a/Source/Images/BuildDisk.cmd b/Source/Images/BuildDisk.cmd new file mode 100644 index 00000000..4f865ae8 --- /dev/null +++ b/Source/Images/BuildDisk.cmd @@ -0,0 +1,4 @@ +@echo off +setlocal + +PowerShell -ExecutionPolicy Unrestricted .\BuildDisk.ps1 %* || exit /b \ No newline at end of file diff --git a/Source/Images/BuildDisk.ps1 b/Source/Images/BuildDisk.ps1 new file mode 100644 index 00000000..fd8745e3 --- /dev/null +++ b/Source/Images/BuildDisk.ps1 @@ -0,0 +1,103 @@ +Param($Disk, $Type="", $Format="", $SysFile="") + +$ErrorAction = 'Stop' + +$CpmToolsPath = '../../Tools/cpmtools' + +$env:PATH = $CpmToolsPath + ';' + $env:PATH + +if ($Type.Length -eq 0) +{ + Write-Error "No disk type specified!" -ErrorAction Stop + return +} + +if ($Format.Length -eq 0) +{ + Write-Error "No disk format specified!" -ErrorAction Stop + return +} + +switch ($Format) +{ + "wbw_fd144" + { + # 1.44MB Floppy Disk + $Desc = "1.44MB Floppy Disk" + $ImgFile = "fd144_${Disk}.img" + $MediaID = 6 + $Size = 1440KB + } + + "wbw_hd512" + { + # 512 Directory Entry Hard Disk Format + $Desc = "Hard Disk (512 directory entry format)" + $ImgFile = "hd512_${Disk}.img" + $MediaID = 4 + $Size = 8MB + 128KB + } + + "wbw_hd1k" + { + # 1024 Directory Entry Hard Disk Format + $Desc = "Hard Disk (1024 directory entry format)" + $ImgFile = "hd1k_${Disk}.img" + $MediaID = 10 + $Size = 8MB + } +} + +if (-not (Test-Path("d_${Disk}/"))) +{ + Write-Error "Source directory d_${Disk} for disk ${Disk} not found!" -ErrorAction Stop + return +} + +"Generating $Disk $Desc..." + +if ($SysFile.Length -gt 0) + { [byte[]]$SysImg = [System.IO.File]::ReadAllBytes($SysFile) } +else + { [byte[]]$SysImg = @() } + +$Image = ($SysImg + ([byte[]](0xE5) * ($Size - $SysImg.length))) + +# $Image[1410] = 0x4D +# $Image[1411] = 0x49 +# $Image[1412] = 0x44 +# $Image[1413] = $MediaID + +[System.IO.File]::WriteAllBytes($ImgFile, $Image) + +for ($Usr=0; $Usr -lt 16; $Usr++) +{ + if (Test-Path ("d_${Disk}/u${Usr}/*")) + { + $Cmd = "cpmcp -f $Format $ImgFile d_${Disk}/u${Usr}/*.* ${Usr}:" + $Cmd + Invoke-Expression $Cmd + if ($LASTEXITCODE -gt 0) {throw "Command returned exit code $LASTEXITCODE"} + } +} + +if (Test-Path("${Type}_${Disk}.txt")) +{ + foreach($Line in Get-Content "${Type}_${Disk}.txt") + { + $Spec = $Line.Trim() + if (($Spec.Length -gt 0) -and ($Spec.Substring(0,1) -ne "#")) + { + $Cmd = "cpmcp -f $Format $ImgFile ${Spec}" + $Cmd + Invoke-Expression $Cmd + if ($LASTEXITCODE -gt 0) {throw "Command returned exit code $LASTEXITCODE"} + } + } +} + +"Moving image $ImgFile into output directory..." + +Move-Item $ImgFile -Destination "..\..\Binary\" -Force + +return \ No newline at end of file diff --git a/Source/Images/BuildFD.cmd b/Source/Images/BuildFD.cmd deleted file mode 100644 index b251f23e..00000000 --- a/Source/Images/BuildFD.cmd +++ /dev/null @@ -1 +0,0 @@ -@PowerShell -ExecutionPolicy Unrestricted .\BuildFD.ps1 %* \ No newline at end of file diff --git a/Source/Images/BuildFD.ps1 b/Source/Images/BuildFD.ps1 deleted file mode 100644 index f482bc10..00000000 --- a/Source/Images/BuildFD.ps1 +++ /dev/null @@ -1,69 +0,0 @@ -#Param([Parameter(Mandatory)]$Disk, $SysFile="") -Param($Disk, $SysFile="") - -$ErrorAction = 'Stop' - -$ImgFile = "fd_${Disk}.img" -$Fmt = "wbw_fd144" -$Size = 1440KB - -$CpmToolsPath = '../../Tools/cpmtools' - -$env:PATH = $CpmToolsPath + ';' + $env:PATH - -if (-not (Test-Path("d_${Disk}/"))) -{ - "Source directory d_${Disk} for disk ${Disk} not found!" - return -} - -"Generating Floppy Disk ${Disk}..." - -#$Blank = ([string]([char]0xE5)) * $Size -#Set-Content -Value $Blank -NoNewLine -Path $ImgFile -$Blank = ([byte[]](0xE5) * $Size) -[System.IO.File]::WriteAllBytes($ImgFile, $Blank) - -if ($SysFile.Length -gt 0) -{ - "Adding System Image $SysFile..." - #$Sys = Get-Content -Path "$SysFile.sys" -Raw - #$Img = Get-Content -Path $ImgFile -Raw - #$NewImg = $Sys + $Img.SubString($Sys.Length, $Img.Length - $Sys.Length) - #Set-Content -NoNewLine -Path $ImgFile $NewImg - - $Cmd = "mkfs.cpm -f $Fmt -b $SysFile $ImgFile" - $Cmd - Invoke-Expression $Cmd -} - -for ($Usr=0; $Usr -lt 16; $Usr++) -{ - if (Test-Path ("d_${Disk}/u${Usr}/*")) - { - $Cmd = "cpmcp -f $Fmt $ImgFile d_${Disk}/u${Usr}/*.* ${Usr}:" - $Cmd - Invoke-Expression $Cmd - } -} - -if (Test-Path("d_${Disk}.txt")) -{ - foreach($Line in Get-Content "d_${Disk}.txt") - { - $Spec = $Line.Trim() - if (($Spec.Length -gt 0) -and ($Spec.Substring(0,1) -ne "#")) - { - $Cmd = "cpmcp -f $Fmt $ImgFile ${Spec}" - $Cmd - Invoke-Expression $Cmd - } - } -} - -"Moving image $ImgFile into output directory..." - -#&$env:COMSPEC /c move $ImgFile ..\..\Binary\ -Move-Item $ImgFile -Destination "..\..\Binary\" -Force - -return \ No newline at end of file diff --git a/Source/Images/BuildHD.cmd b/Source/Images/BuildHD.cmd deleted file mode 100644 index c7db537e..00000000 --- a/Source/Images/BuildHD.cmd +++ /dev/null @@ -1 +0,0 @@ -@PowerShell -ExecutionPolicy Unrestricted .\BuildHD.ps1 %* \ No newline at end of file diff --git a/Source/Images/BuildHD.ps1 b/Source/Images/BuildHD.ps1 deleted file mode 100644 index eedfa4aa..00000000 --- a/Source/Images/BuildHD.ps1 +++ /dev/null @@ -1,69 +0,0 @@ -#Param([Parameter(Mandatory)]$Disk, $SysFile="") -Param($Disk, $SysFile="") - -$ErrorAction = 'Stop' - -$ImgFile = "hd_${Disk}.img" -$Fmt = "wbw_hd0" -$Size = (128KB * 65) - -$CpmToolsPath = '../../Tools/cpmtools' - -$env:PATH = $CpmToolsPath + ';' + $env:PATH - -if (-not (Test-Path("d_${Disk}/"))) -{ - "Source directory d_${Disk} for disk ${Disk} not found!" - return -} - -"Generating Hard Disk ${Disk}..." - -#$Blank = ([string]([char]0xE5)) * $Size -#Set-Content -Value $Blank -NoNewLine -Path $ImgFile -$Blank = ([byte[]](0xE5) * $Size) -[System.IO.File]::WriteAllBytes($ImgFile, $Blank) - -if ($SysFile.Length -gt 0) -{ - "Adding System Image $SysFile..." - #$Sys = Get-Content -Path "$SysFile.sys" -Raw - #$Img = Get-Content -Path $ImgFile -Raw - #$NewImg = $Sys + $Img.SubString($Sys.Length, $Img.Length - $Sys.Length) - #Set-Content -NoNewLine -Path $ImgFile $NewImg - - $Cmd = "mkfs.cpm -f $Fmt -b $SysFile $ImgFile" - $Cmd - Invoke-Expression $Cmd -} - -for ($Usr=0; $Usr -lt 16; $Usr++) -{ - if (Test-Path ("d_${Disk}/u${Usr}/*")) - { - $Cmd = "cpmcp -f $Fmt $ImgFile d_${Disk}/u${Usr}/*.* ${Usr}:" - $Cmd - Invoke-Expression $Cmd - } -} - -if (Test-Path("d_${Disk}.txt")) -{ - foreach($Line in Get-Content "d_${Disk}.txt") - { - $Spec = $Line.Trim() - if (($Spec.Length -gt 0) -and ($Spec.Substring(0,1) -ne "#")) - { - $Cmd = "cpmcp -f $Fmt $ImgFile ${Spec}" - $Cmd - Invoke-Expression $Cmd - } - } -} - -"Moving image $ImgFile into output directory..." - -#&$env:COMSPEC /c move $ImgFile ..\..\Binary\ -Move-Item $ImgFile -Destination "..\..\Binary\" -Force - -return \ No newline at end of file diff --git a/Source/Images/Common/All/CLRDIR.COM b/Source/Images/Common/All/CLRDIR.COM new file mode 100644 index 00000000..ca65cbed Binary files /dev/null and b/Source/Images/Common/All/CLRDIR.COM differ diff --git a/Source/Images/Common/All/COMPARE.COM b/Source/Images/Common/All/COMPARE.COM new file mode 100644 index 00000000..24f46e33 Binary files /dev/null and b/Source/Images/Common/All/COMPARE.COM differ diff --git a/Source/Images/d_bp/u0/CR.COM b/Source/Images/Common/All/CRUNCH.COM similarity index 100% rename from Source/Images/d_bp/u0/CR.COM rename to Source/Images/Common/All/CRUNCH.COM diff --git a/Source/Images/Common/All/CRUNCH28.CFG b/Source/Images/Common/All/CRUNCH28.CFG new file mode 100644 index 00000000..f81c7acf Binary files /dev/null and b/Source/Images/Common/All/CRUNCH28.CFG differ diff --git a/Source/Images/Common/DDTZ.COM b/Source/Images/Common/All/DDTZ.COM similarity index 100% rename from Source/Images/Common/DDTZ.COM rename to Source/Images/Common/All/DDTZ.COM diff --git a/Source/Images/d_bp/u0/DDTZ.DOC b/Source/Images/Common/All/DDTZ.DOC similarity index 100% rename from Source/Images/d_bp/u0/DDTZ.DOC rename to Source/Images/Common/All/DDTZ.DOC diff --git a/Source/Images/Common/All/EX.COM b/Source/Images/Common/All/EX.COM new file mode 100644 index 00000000..49cb0b81 Binary files /dev/null and b/Source/Images/Common/All/EX.COM differ diff --git a/Source/Images/Common/All/FDISK80.COM b/Source/Images/Common/All/FDISK80.COM new file mode 100644 index 00000000..7e862d67 Binary files /dev/null and b/Source/Images/Common/All/FDISK80.COM differ diff --git a/Source/Images/Common/All/FIND.COM b/Source/Images/Common/All/FIND.COM new file mode 100644 index 00000000..163dcc91 Binary files /dev/null and b/Source/Images/Common/All/FIND.COM differ diff --git a/Source/Images/Common/All/FLASH.COM b/Source/Images/Common/All/FLASH.COM new file mode 100644 index 00000000..d1833a1b Binary files /dev/null and b/Source/Images/Common/All/FLASH.COM differ diff --git a/Source/Images/Common/All/FLASH.DOC b/Source/Images/Common/All/FLASH.DOC new file mode 100644 index 00000000..5c2b5412 --- /dev/null +++ b/Source/Images/Common/All/FLASH.DOC @@ -0,0 +1,201 @@ + + FLASH4 (c) 2014-2020 William R Sowerbutts + http://sowerbutts.com/8bit/ + += Supported machines = + +FLASH4 has been tested and confirmed working on: + * N8VEM SBCv2 + * N8VEM SBCv2 MegaFlash + * N8VEM N8-2312 + * N8VEM Mark IV SBC + * DX-Designs P112 + * ZETA SBC v1 + * ZETA SBC v2 + * RC2014 with 512KB ROM 512KB RAM module + +It should work on many other machines that run RomWBW or UNA BIOS. If you test +it on another machine please let me know the outcome. + + += Introduction = + +FLASH4 is a CP/M program which can read, write and verify Flash ROM contents to +or from an image file stored on a CP/M filesystem. It is intended for in-system +programming of Flash ROM chips on Z80 and Z180 systems. + +FLASH4 aims to support a range of Flash ROM chips and machines. Ideally I would +like to support all Z80/Z180 machines. If FLASH4 does not support your machine +please let me know and I will try to add support. + +When writing to the Flash ROM, FLASH4 will only reprogram the sectors whose +contents have changed. This helps to reduce wear on the flash memory, makes the +reprogram operation faster, and reduces the risk of leaving the system +unbootable if power fails during a reprogramming operation. FLASH4 always +performs a full verify operation after writing to the chip to confirm that the +correct data has been loaded. + +FLASH4 is reasonably fast. Reprogramming and verifying every sector on a 512KB +SST 39F040 chip takes 21 seconds on my Mark IV SBC, versus 45 seconds to +perform the same task using a USB MiniPro TL866 EEPROM programmer under Linux +on my PC. If only a subset of sectors require reprogramming FLASH4 will be +even faster. + +FLASH4 works with binary ROM image files, it does not support Intel Hex format +files. Hex files can be easily converted to or from binaries using "hex2bin" or +the "srec_cat" program from SRecord: + + $ srec_cat image.hex -intel -fill 0xFF 0 0x80000 -output image.bin -binary + $ srec_cat image.bin -binary -output image.hex -intel + +FLASH4 version 1.3 introduces support for programming multiple flash chips. +Some machines use multiple flash chips for larger ROM capacity, for example the +"Megaflash" version of the Retrobrew Computers SBC-V2 contains two 512KB flash +ROMs for a total of 1MB ROM. All flash chips in the system must be of the same +type. + +FLASH4 can use several different methods to access the Flash ROM chips. The +best available method is determined automatically at run time. Alternatively +you may provide a command-line option to force the use of a specific method. + +FLASH4 will detect the presence of RomWBW, UNA BIOS or P112 B/P BIOS and use +the bank switching methods they provide to map in the flash memory. + +If no bank switching method can be auto-detected, and the system has a Z180 +CPU, FLASH4 will use the Z180 DMA engine to access the Flash ROM chip. This +does not require any bank switching but it is slower and will not work on all +platforms. + +Z180 DMA access requires the flash ROM to be linearly mapped into the lower +region of physical memory, as it is on the Mark IV SBC (for example). The +N8-2312 has additional memory mapping hardware, consequently Z180 DMA access on +the N8-2312 is NOT SUPPORTED and if forced will corrupt the contents of RAM; +use one of the supported bank switching methods instead. + +Z180 DMA access requires the Z180 CPU I/O base control register configured to +locate the internal I/O addresses at 0x40 (ie ICR bits IOA7, IOA6 = 0, 1). + + += Usage = + +The three basic operations are: + + FLASH4 WRITE filename [options] + + FLASH4 VERIFY filename [options] + + FLASH4 READ filename [options] + +The WRITE command will rewrite the flash ROM contents from the named file. The +file size must exactly match the size of the ROM chip. After the WRITE +operation, a VERIFY operation will be performed automatically. + +The VERIFY command will read out the flash ROM contents and report if it +matches the contents of the named file. The file size must exactly match the +size of the ROM chip. + +The READ command will read out the entire flash ROM contents and write it to +the named file. + +FLASH4 will auto-detect most parameters so additional options should not +normally be required. + +The "/V" (verbose) option makes FLASH4 print one line per sector, giving a +detailed log of what it did. + +The "/P" or "/PARTIAL" option can be used if your ROM chip is larger than the +image you wish to write and you only want to reprogram part of it. To avoid +accidentally flashing the wrong file, the image file must be an exact multiple +of 32KB in length. The portion of the ROM not occupied by the image file is +left either unmodified or erased. + +The "/ROM" option can be used when you are using an ROM/EPROM/EEPROM chip which +cannot be programmed in-system and FLASH4 cannot recognise it. Only the "READ" +and "VERIFY" commands are supported with this option. This mode assumes a 512K +ROM is fitted, smaller ROMs will be treated as a 512KB ROM with the data +repeated multiple times. + +One of the following optional command line arguments may be specified at the +end of the command line to force FLASH4 to use a particular method to access +the flash ROM chip: + +BIOS interfaces: + /ROMWBW For ROMWBW BIOS version 2.6 and later + /ROMWBWOLD For ROMWBW BIOS version 2.5 and earlier + /UNABIOS For UNA BIOS + +Direct hardware interfaces: + /Z180DMA For Z180 DMA + /P112 For DX-Designs P112 + /N8VEMSBC For N8VEM SBC (v1, v2), Zeta (v1) SBC + +If no option is specified FLASH4 attempts to determine the best available +method automatically. + +If RomWBW 2.6+ is in use, and correctly configured, then multiple flash chips +can be detected automatically. Multiple chip operation can also be manually +enabled using the command line options "/1", "/2", "/3" etc up to "/9" to +specify the number of flash chips to program. All flash chips in the system +must be of the same type. + + += Supported flash memory chips = + +FLASH4 will interrogate your flash ROM chip to identify it automatically. + +FLASH4 does not support setting or resetting the protection bits on individual +sectors within Flash ROM devices. If your Flash ROM chip has protected sectors +you will need to unprotect them by other means before FLASH4 can erase and +reprogram them. + +AT29C series chips employ an optional "software data protection" feature. This +is supported by FLASH4 and is left activated after programming the chip to +prevent accidental reprogramming of sectors. + +The following chips are fully supported and will be programmed sector by +sector: + + AMIC A29010B + AMIC A29040B + Atmel AT29C010 + Atmel AT29C020 + Atmel AT29C040 + Atmel AT29C512 + Atmel AT29F010 + Atmel AT29F040 + Macronix MX29F040 + SST 39F010 + SST 39F020 + SST 39F040 + SST M29F010 + SST M29F040 + +The following chips are supported, but have unequal sector sizes, so FLASH4 +will only erase and reprogram the entire chip at once: + + Atmel AT49F001N + Atmel AT49F001NT + Atmel AT49F002N + Atmel AT49F002NT + Atmel AT49F040 + + += Compiling = + +The software is written in a mix of C and assembler. It builds using the SDCC +toolchain and the SRecord tools. SDCC 3.6 and 3.8 have been tested. A Makefile +is provided to build the executable in Linux and I imagine it can be easily +modified to build in Windows. + +You may need to adjust the path to the SDCC libraries in the Makefile if your +installation is not in /usr/local or /usr + + += License = + +FLASH4 is licensed under the The GNU General Public License version 3 (see +included "LICENSE.txt" file). + +FLASH4 is provided with NO WARRANTY. In no event will the author be liable for +any damages. Use of this program is at your own risk. May cause rifts in space +and time. diff --git a/Source/Images/d_bp/u0/MBASIC.COM b/Source/Images/Common/All/MBASIC.COM similarity index 100% rename from Source/Images/d_bp/u0/MBASIC.COM rename to Source/Images/Common/All/MBASIC.COM diff --git a/Source/Images/Common/NULU.COM b/Source/Images/Common/All/NULU.COM similarity index 100% rename from Source/Images/Common/NULU.COM rename to Source/Images/Common/All/NULU.COM diff --git a/Source/Images/d_cpm22/u0/PMARC.COM b/Source/Images/Common/All/PMARC.COM similarity index 100% rename from Source/Images/d_cpm22/u0/PMARC.COM rename to Source/Images/Common/All/PMARC.COM diff --git a/Source/Images/d_cpm22/u0/PMEXT.COM b/Source/Images/Common/All/PMEXT.COM similarity index 100% rename from Source/Images/d_cpm22/u0/PMEXT.COM rename to Source/Images/Common/All/PMEXT.COM diff --git a/Source/Images/Common/All/RMXSUB1.COM b/Source/Images/Common/All/RMXSUB1.COM new file mode 100644 index 00000000..34078336 Binary files /dev/null and b/Source/Images/Common/All/RMXSUB1.COM differ diff --git a/Source/Images/Common/All/SUPERSUB.COM b/Source/Images/Common/All/SUPERSUB.COM new file mode 100644 index 00000000..80336b52 Binary files /dev/null and b/Source/Images/Common/All/SUPERSUB.COM differ diff --git a/Source/Images/Common/All/SUPERSUB.DOC b/Source/Images/Common/All/SUPERSUB.DOC new file mode 100644 index 00000000..7f554bb3 --- /dev/null +++ b/Source/Images/Common/All/SUPERSUB.DOC @@ -0,0 +1,141 @@ + SUPERSUB DOCUMENTATION (revised 09/13/81) + ---------------------- + + 09/05/81 + by Ron Fowler + Westland, Mich + +SUPERSUB is intended as a replacement program for SUBMIT.COM provided +with CP/M by Digital Research Corporation. This document assumes you +are familiar with that utility and its use. + + ------------------ + +Version 1.1 update: + +Control-character translation has been added. This facility works +similarly to CP/M's SUBMIT, where a desired control character is gen- +erated in the text file by preceeding the character with a circumflex +character. For example, control-V is generated from "^V". Thanks to +Keith Petersen for pointing out this omission. + +A bug in line number reporting when errors are encountered has been +repaired. Line numbers reported should now correspond to the actual +line number in the file. + + ------------------ + + SUPERSUB provides the following new capabilities: + + 1) Null input lines are properly interpreted; they cause + the creation of a zero-length line in $$$.SUB. + + 2) SUBMIT jobs may be nested. + + 3) For small SUBMIT jobs, the command lines may be specified + on the SUPERSUB command line, seperated by semicolons. + + 4) An interactive mode allows command lines to be entered + directly into SUPERSUB without need of a text editor. + + 5) A built-in help function is provided. + + 6) The output drive and number of allowable parameters may + by specified at assembly time. + +NESTING +------- + +SUBMIT jobs may be nested under SUPERSUB. For example, suppose you +have a submit file to compile a program: + +BASCOM =$1 +L80 $1,$1/N/E +PIP B:=$1.COM +ERA $1.REL +ERA $1.COM + +named COMPILE.SUB. You may then submit a job to compile several +programs using COMPILE.SUB. For example, you can create a file +called COMPALL.SUB consisting of: + +SUPERSUB COMPILE MYPROG +SUPERSUB COMPILE RBBS.ASC +SUPERSUB COMPILE PRIMES.BAS. + +This is especially useful when using INTERACTIVE or SUMMARY modes. +In combination with Ward Christensen's FMAP program (CPMUG), some +very powerful command structures may be built. + +SUMMARY MODE +------------ + +Summary mode allows the entire SUBMIT job to be specified in the +CP/M command line. This mode is enabled by using the slash ("/") +character as the first character of the command line. The indiv- +idual submit lines must be seperated with a semicolon. For example, + + A>SUPERSUB / CRCK *.* F;CRCK B:*.* F;COMPARE CRCKFILE.CRC B: ^ + | + ----> (this space is optional) + +will create a file of CRC's of all files on A:, then create a similar +file on B:, then compare the two. (CRCK, by Keith Petersen, and +COMPARE, by Ward Christensen, are available from the CP/M Users Group). + +INTERACTIVE MODE +---------------- + +You may enter the interactive entry mode by typing "SUPERSUB /" +(ie, "SUPERSUB /" with no arguments). Supersub will prompt for input +with an asterisk, and you may then enter SUBMIT lines from the keyboard. +You may enter more than one logical line on a physical line using +semicolon seperation. An empty line terminates the input. Example: + +A>SUPERSUB / +*CRCK *.* F +*CRCK B:*.* F +*COMPARE CRCKFILE.CRC B: +* +A>CRCK *.* F + +has the same effect as the above SUMMARY mode example. + +HELP FUNCTION +------------- + +Typing SUPERSUB with no arguments will print the built-in help file. + + + + + +NOTES +----- + +1) Nested SUBMIT runs are only usable up to a maximum of 128 nested + commands at any one time. This is a limitation of the CP/M Console + Command Processor. + +2) If you change the drive specification for the output file, you + may want to do the same thing with XSUB (Digital Research's function + nine extender). Within XSUB, find the submit File Control Block + (search for "$$$ SUB" within XSUB.COM) and change the first FCB + byte (ie, the byte before the first "$") to: + 0 - use default drive + 1 - use drive A: + 2 - use drive B: + etc. + +3) In SUMMARY and INTERACTIVE modes, passed parameters have no meaning. + When these modes are used, the parameter flag, "$", will be passed + through literally to the output file. + +4) Zero-length output lines may be created in SUMMARY and INTERACTIVE + modes by using two consecutive semicolons. This is, in effect, a + blank logical line. + +5) Interactive mode may be aborted by typing control-C as the first + character of a line. Also, all normal CP/M editing characters are + available. + \ No newline at end of file diff --git a/Source/Images/Common/All/TDLBASIC.COM b/Source/Images/Common/All/TDLBASIC.COM new file mode 100644 index 00000000..ebaec526 Binary files /dev/null and b/Source/Images/Common/All/TDLBASIC.COM differ diff --git a/Source/Images/Common/UNARC.COM b/Source/Images/Common/All/UNARC.COM similarity index 100% rename from Source/Images/Common/UNARC.COM rename to Source/Images/Common/All/UNARC.COM diff --git a/Source/Images/Common/All/UNARC.DOC b/Source/Images/Common/All/UNARC.DOC new file mode 100644 index 00000000..6c1263e7 --- /dev/null +++ b/Source/Images/Common/All/UNARC.DOC @@ -0,0 +1,623 @@ +File: UNARC.DOC +Subject: User Documentation for UNARC Program +Version: 1.6 +Date: March 27, 1987 +------------------------------------------------------------------------------ + + + UNARC + + CP/M Archive File Extraction Utility + + + Copyright (C) 1986, 1987 by Robert A. Freed + All Rights Reserved + + + +This file provides user-level documentation and operating instructions for +UNARC version 1.6, released March 27, 1987. Refer to the notice at the end of +this file regarding rights of use and distribution of this program. + +The release message file, UNARC.MSG, provides a list of all additional files +distributed with the current UNARC release and describes the program changes +from the previous version 1.4 and 1.5 releases. + + + +ABSTRACT +-------- + +UNARC is a utility program for CP/M systems which allows the listing, typeout, +printing, checking, and extraction of subfiles contained in "archive" library +(*.ARC or *.ARK) files. These are commonly used for compressed file storage +on remote access bulletin board systems. UNARC provides the CP/M user the +ability to process such files after downloading them via modem from these +remote systems. + + + +REQUIREMENTS +------------ + +UNARC requires CP/M version 2 or higher. The program is offered in two +versions. The standard version, UNARC.COM, requires a Z80 processor (or +compatible equivalent, e.g. HD64180 or NSC800). An alternate version, +UNARCA.COM, is provided for systems with 8080 or 8085 processors (or 16-bit +systems using the NEC V20 for CP/M emulation). Identical capabilities are +provided by the two program versions. + + NOTE + + Although UNARCA.COM can execute on ANY system capable of + supporting CP/M, it is larger and significantly slower than + UNARC.COM and should be avoided by users of Z80-based systems. + +UNARC is written in Z80 assembly language and requires only 5K bytes of disk +storage (6K for UNARCA). As distributed, the program requires at least 30K +bytes of available memory space (TPA) for full support of all archive file +formats (31K TPA size for UNARCA). (Smaller systems may be able to use some +of the program's capabilities.) + + + +ABOUT ARC/ARK FILES +------------------- + +The files which UNARC processes utilize a format that was introduced by the +ARC shareware utility program, which executes on 16-bit computers running the +MS-DOS (or PC-DOS) operating system. This format has achieved widespread +popularity since the ARC program first appeared in March 1985, and it has +become the de facto standard for file storage on remote access systems +catering to 16-bit computer users. More recently this file format has +achieved increased popularity on RCP/M (Remote CP/M) systems. + + NOTE + + Most RCP/M system operators have adopted the convention of naming + CP/M archive files with the filetype ARK. This differentiates + these from MS-DOS archive files, which use the filetype ARC. This + is a naming convention only: There is no difference in format, + and UNARC will accept files of either type interchangeably. + +An archive is a group of files collected together into a single file in such a +way that the individual files may be recovered intact. In this respect, +archives are similar in function to libraries (*.LBR files), which have been +commonplace on CP/M systems since 1982, when the original LU library utility +program was introduced by Gary P. Novosielski. (However, the two file formats +are not compatible.) + +The distinguishing characteristic of an ARC archive is that its component +files are automatically compressed when they are added to the archive, so that +the resulting file occupies a minimum amount of disk space. Of course, file +compression techniques have also been commonplace in the CP/M world since +1981, when the public domain SQ and USQ "squeeze and unsqueeze" programs were +introduced by Richard Greenlaw. + +The SQ/USQ programs and their numerous popular descendants utilize a well- +known general-purpose form of data compression (Huffman coding). This +technique, which is also utilized in ARC files, performs well for many text +files but often produces poor compression of binary files (e.g. object program +.COM files). The ARC program also provides an advanced data compression +method, which it terms "crunching." This method (which is based on the +Lempel-Ziv-Welch or "LZW" algorithm) performs better than squeezing in most +cases, often achieving 50% or better compression of ASCII text files, 15-40% +compression of binary object files, and as much as 95% compression of bit- +mapped graphics image files. + +Five different methods are actually employed for storing files in an archive. +The method chosen for a particular file is the one which results in the best +compression for that file: + +(1) No compression ("unpacked"). The file is stored in its original form. + +(2) Run-length encoding ("packed"). Repeated sequences of 3-255 identical + bytes are compressed into a three-byte sequence. + +(3) Huffman coding ("squeezed"). Each 8-bit byte (after run-length encoding) + is encoded by a variable number of bits, with bit length (approximately) + inversely proportional to the frequency of occurence of the corresponding + byte. + +(4) LZW compression ("crunched"). Variable-length strings of bytes (in + theory, up to nearly 4000 bytes in length) are represented by a single + (maximum) 12-bit code (after run-length encoding). + +(5) LZW compression ("squashed"). This is a variation of crunching which + uses (maximum) 13-bit codes (and no run-length encoding). + +Note that since one of the five methods involves no compression at all, the +resulting archive entry will never be larger than the original file. + + NOTE + + The most recent release of the MS-DOS ARC program (version 5.20) + has eliminated squeezing as a compression technique. However, + UNARC continues to process squeezed files for compatibility with + archives created by earlier versions of ARC and by other MS-DOS + archiving programs (notably PKARC). + + The squashed compression method was recently introduced by the + MS-DOS programs PKARC and PKXARC. UNARC can process files which + use this method, although it is not universally accepted by other + MS-DOS archive extraction programs (including ARC). + +During its lifetime, the ARC program has undergone numerous revisions which +have employed different variations on some of the above methods, particularly +LZW compression. In order to retain compatibility with archives created by +earlier program revisions, ARC stores a "version" indicator with each file in +an archive. Based on this indicator, the latest release of the ARC program +can always extract files created by older releases (although it will only use +the latest data compression versions when adding new files to an archive). + + NOTE + + The current release of UNARC supports archive file versions + generated by all releases of the following MS-DOS programs through + (at least) the indicated program versions: + + ARC 5.20 (24 Oct 86), by System Enhancement Associates, Inc. + ARCA 1.22 (13 Sep 86), by Wayne Chin and Vernon Buerg + ARCH 5.38 (26 Jun 86), by Les Satenstein + PKARC 2.0 (15 Dec 86), by Phil Katz (PKWARE, Inc.) + + (UNARC does not recognize, but is unaffected by, the non-standard + archive and file commenting feature of PKARC.) + +Although the above discussion has emphasized the origin of archive files for +the MS-DOS operating system, their use has recently spread to many other +systems. Programs compatible with MS-DOS ARC have appeared for UNIX, Atari +68000, VAX/VMS, and TOPS-20 systems. A CP/M utility for building archive +files will also be available in the near future. + +For additional information about archive files and the MS-DOS ARC utility, +refer to the documentation file, ARC.DOC, which is available from most remote +access systems which utilize archive files. For additional information about +the LZW algorithm (and data compression methods in general), refer to the +article "A Technique for High-Performance Data Compression", by Terry A. +Welch, in IEEE Computer magazine, Vol. 17, No. 6, June 1984. + + + +USING UNARC +----------- + +The UNARC program provides an on-line help message, which is generated by +running the program with an empty command line: + + + A>UNARC + + UNARC 1.6 27 Mar 87 + CP/M Archive File Extractor + + Usage: UNARC [d:]arcfile[.typ] [d:][afn] [N|P|C] + + Examples: + B>UNARC A:SAVE.ARK *.* ; List all files in CP/M archive SAVE on drive A + B>UNARC A:SAVE.ARC *.* ; List all files in MS-DOS archive SAVE on drive A + A>UNARC SAVE ; Same as either of above + A>UNARC SAVE *.* N ; Same as above (no screen pauses) + A>UNARC SAVE *.DOC ; List just .DOC files + A>UNARC SAVE READ.ME ; Typeout the file READ.ME + A>UNARC SAVE READ.ME N ; Typeout the file READ.ME (no screen pauses) + A>UNARC SAVE A: ; Extract all files to drive A + A>UNARC SAVE B:*.DOC ; Extract .DOC files to drive B + A>UNARC SAVE C:READ.ME ; Extract file READ.ME to drive C + A>UNARC SAVE PRN.DAT P ; Print the file PRN.DAT (no formatting) + A>UNARC SAVE *.* C ; Check validity of all files in archive + + +As shown by this help display, the UNARC utility provides the following +capabilities: + +(1) Listing the directory of an archive +(2) Extracting component files from an archive +(3) Typing the contents of a component file at the console +(4) Printing a component file directly on the CP/M list device +(5) Checking the validity of an archive and its component files + +The particular operation to be performed is determined by the form of the file +parameter(s) in the command line, as described separately in the sections +which follow. The following characteristics apply to all operations: + +The first command line parameter must specify the name of an archive file. A +drive name and filetype are optional. The filetype, if omitted, defaults to +"ARK" or, if no such file exists, the alternate (MS-DOS) default "ARC" is +assumed. + +The standard CP/M terminal control characters, CTRL-S (to suspend console +output) and CTRL-C (to abort the program), may be used at any time. CTRL-K +may also be used as an alternate for CTRL-C. Printer output to the CP/M list +device may be obtained by typing CTRL-P at CCP command level before executing +UNARC. + +In addition, by default UNARC will pause after every 23 lines of console +output. At this time, the message "[more]" will appear at the bottom of the +console screen. The listing may be resumed by typing any key (other than +CTRL-S, CTRL-C, or CTRL-K, which will function as described above). If the +space bar is used, one more line of console output will be displayed (over- +writing the "[more]" message) and the program will again pause. If any other +key is typed (e.g. RETURN), another 23 lines of output will be allowed to +scroll onto the screen before the next pause. (LINE FEED may be used to +prevent overprinting of the "[more]" line, e.g. for hard-copy terminals.) + +If continuous display is desired, this automatic pause feature may be disabled +by specifying "N" at the end of the command line. The "N" must be the last +command line character, and it must be preceded by a space. Also, there must +be two preceding file parameters on the command line. E.g., note the +difference between the following commands: + + A>UNARC SAVE N ; Typeout the file N. in archive SAVE + A>UNARC SAVE *.* N ; List all files in archive SAVE with no pauses + +The N option may not be used in conjunction with the P (Print) or C (Check) +options. + + + +LISTING AN ARCHIVE DIRECTORY +---------------------------- + +By default, UNARC produces a detailed console listing of the component files +in an archive. (In fact, there is no way to suppress this listing; it is +generated during all UNARC operations.) If only the archive file name appears +on the command line, UNARC will generate a complete directory of all component +files in the specified archive file. Otherwise, the second command line +parameter may be used to select a particular file to be listed (or group of +files, if it contains the ambiguous file specification characters "*" or "?"). +If no disk drive name is provided for the second parameter, and this parameter +specifies a group of files, the directory listing is the only output generated +by the program. + +A sample directory listing is illustrated here: + + +A>UNARC CODES + +Archive File = CODES.ARK + +Name Length Disk Method Ver Stored Saved Date Time CRC +============ ======= ==== ======== === ======= ===== ========= ====== ==== +ABLE .DOC 24320 24k Crunched 8 11777 52% 30 Apr 86 10:50a 42C0 +BRAVO .COM 17152 17k Squeezed 4 14750 14% 2 May 86 4:11p 8CBD +CHARLIE .TXT 234 1k Packed 3 99 58% 2 May 86 4:11p 8927 + ==== ======= ==== ======= === ==== +Total 3 41706 42k 26626 36% 58A4 + + +This listing is equivalent to the "verbose" listing of the MS-DOS ARC program +(with the addition of the "Disk" and "Ver" fields, which are unique to UNARC). +The listing requires a 78-column terminal width; there is currently no "short" +listing format. + +"Name" is the file name which will be generated if the file is extracted by +UNARC on a CP/M system. (This is not necessarily the same as the name +recorded in the archive file. Although CP/M and MS-DOS file naming +conventions are identical, two conversions are made to guarantee file name +validity under CP/M: Lower-case letters are converted to upper-case, and +non-printing characters are converted to dollar signs, "$".) Archive entries +are usually maintained (and hence listed) in alphabetic name order. + +"Length" is the uncompressed file length, i.e. the number of bytes the file +will occupy if extracted to disk, exclusive of any additional length imposed +by the CP/M file system. Note that MS-DOS permits files of arbitrary lengths +(unlike CP/M which restricts all files to a multiple of 128 bytes). + +"Disk" is the actual amount of disk space required to extract the file to a +CP/M disk, expressed as a multiple of 1K (1024) bytes. Note that this number +is dependent on the disk data allocation block size. (CP/M permits various +block sizes, ranging from 1K to 16K bytes. Typical sizes are 1K for single- +density floppy disks, 2K for double-density floppies, and 4K for hard disks, +although these values are quite system-dependent.) In the absence of an +explicit output drive name, UNARC uses the block size of the default +(currently "logged") disk drive (i.e. the drive which appears in the CCP +prompt). + +"Method" is the compression method used, specified as "Unpacked", "Packed", +"Squeezed", "Crunched", "Squashed", or "Unknown!". If the method "Unknown!" +appears, it most likely indicates (if not a faulty archive file) a newer +release of the MS-DOS ARC program that supports a new compression method (or a +new variation of an existing method). In this case, a corresponding new +release of UNARC will be required to extract the file. + +"Ver" further identifies the version of compression used. Currently, UNARC +supports versions 1-9: unpacked files can have versions 1 or 2; packed files, +version 3; squeezed files, version 4; crunched files, versions 5-8; and +squashed files, version 9. The highest version number associated with each +compression method is the one generated by the most recent release of the +MS-DOS ARC program. + +"Stored" is the compressed file length, i.e. the number of bytes occupied by +the file in the archive. (This does not include the overhead associated with +the directory information itself, which adds an additional 29 bytes to the +size of each component file.) + +"Saved" is the percentage of the original file length which was saved by +compression; i.e., higher values indicate better compression. (The MS-DOS ARC +documentation refers to this as the "stowage factor.") The value shown on the +totals line applies to the archive as a whole, not including the directory +overhead. + +"Date" and "Time" refer to the last file modification, as of the time it was +added to the archive. (Date and time stamping is, of course, one of the nice +features of MS-DOS which is lacking in standard CP/M 2.2.) + +"CRC" is an internal 16-bit cyclic redundancy check value which is computed +when a file is added to an archive (expressed in hexadecimal). As a test of +file validity, UNARC re-computes this value when it extracts a file (see +below). Note that this value is calculated by a different method than that +used by either of the two popular public domain programs, CRCK and CHEK. (It +is however quite valid as a reliable error-detection mechanism.) This value +is shown in the listing for completeness only. The value shown on the totals +line is the 16-bit sum of all displayed CRC values. This is useful as a +single "checksum" value for comparing entire archives. (Since the CRC values +are computed before compression takes place, the total should be the same for +all archives created from the same set of input files, independent of any +particular variations in file order or compression methods.) + +The "Total" line is displayed only if multiple files appear in the listing, +and it includes a count of the number of files listed. + + + +EXTRACTING FILES FROM AN ARCHIVE +-------------------------------- + +If the second command line parameter contains a disk drive name, UNARC will +extract the selected file(s) from the archive to CP/M file(s) on the indicated +disk drive. If only a drive name appears, all component files of the archive +will be extracted. The following illustrates a sample archive directory +listing as generated during a file extraction operation: + + +A>UNARC CODES B: + +Archive File = CODES.ARK +Output Drive = B: + +Name Length Disk Method Ver Stored Saved Date Time CRC +============ ======= ==== ======== === ======= ===== ========= ====== ==== +ABLE .DOC 24320 24k Crunched 8 11777 52% 30 Apr 86 10:50a 42C0 +Replace existing output file (y/n)? Y +BRAVO .COM 17152 18k Squeezed 4 14740 14% 2 May 86 4:11p 8CBD +Warning: Extracted file has incorrect CRC +Warning: Extracted file has incorrect length +Warning: Bad archive file header, bytes skipped = 10 +CHARLIE .TXT 234 2k Packed 3 99 58% 2 May 86 4:11p 8927 + ==== ======= ==== ======= === ==== +Total 3 41706 44k 26616 36% 58A4 + + +The above listing also illustrates several warning messages which may occur +when extracting files from an archive. + +The message "Replace existing output file (y/n)?" appears if a file of the +same name already exists on the output drive. The user must answer "Y" (or +"y") to allow the extraction to proceed (in which case, the existing file is +unceremoniously deleted). Any other response will cause UNARC to preserve the +existing file, bypass the extraction operation for the current file, and +(except for a CTRL-C response) skip to the next file to be extracted (if any). + +The first two warning messages illustrated above are provided as a check on +the validity of the extracted file. These indicate that either the cyclic +redundancy check (CRC) value computed by UNARC, or the resulting extracted +file length, does not match the corresponding value recorded in the archive +when the original file was added to it. The final warning message occurs if +UNARC fails to detect the proper format for the start of a new subfile, but +can recover by skipping a certain number of bytes in the archive file. (If +the recovery attempt fails, UNARC aborts with the message "Invalid archive +file format.") The appearance of any of these messages most likely indicates +that the file data has been corrupted in some way (e.g. during modem +transmission from a remote system). + +Note that if the original (i.e. MS-DOS) file length was not an exact multiple +of 128 bytes (as required by CP/M), UNARC will pad the final record of the +extracted file with hex "1A" (ASCII CTRL-Z) bytes. This provides the correct +end-of-file termination for text files, according to CP/M conventions. + +Also, the disk space shown in the archive directory listing will be correct +for the specified disk drive. (In the above examples, drive A: has a 1K data +allocation block size while drive B: has a 2K block size, which accounts for +the differences in the two listings.) In order to determine the exact disk +space requirements in advance of a file extraction operation, the user may +first "log into" the desired output drive (i.e. select it as the default +drive), and run UNARC to obtain a directory listing only. (This is a +consideration only on systems with mixed disk drive types.) + +A file extraction operation may be aborted at any time by entering CTRL-C from +the console. In this case, any partial output file will remain on disk and +should be deleted manually following the program abort. (Any existing file of +the same name will have already been deleted, however.) + + + +TYPING OUT A FILE IN AN ARCHIVE +------------------------------- + +A console typeout of the contents of a single component file in an archive may +be requested by specifying a non-ambiguous file name (and no disk drive name) +in the second command line parameter. For example: + + +A>UNARC CODES ABLE.DOC + +Archive File = CODES.ARK + +Name Length Disk Method Ver Stored Saved Date Time CRC +============ ======= ==== ======== === ======= ===== ========= ====== ==== +ABLE .DOC 24320 24k Crunched 8 11777 52% 30 Apr 86 10:50a 42C0 +------------------------------------------------------------------------------- + This is file ABLE.DOC, contained within the archive CODES.ARK. Typeout will + proceed until the end of this file or may be aborted by CTRL-C..... + + +The specified file is assumed to contain valid ASCII text data. In +particular, all bytes are masked to seven bits, and all ASCII control +characters are ignored except for HT (horizontal tab, which is expanded to +blanks with assumed tab stops at every eighth column), LF, VT or FF (line +feed, vertical tab or form feed, which generate a new typeout line), and SUB +(CTRL-Z, which by CP/M convention indicates end-of-file and terminates the +typeout). Note that BS (backspace) and CR (carriage return) are ignored, so +that text will not be obscured within files which utilize these for over- +printing (i.e. when directed to a printer). + +The following filetypes, which are usually associated with binary (non-text) +data, are specifically excluded from typeout operations: COM, EXE, OBJ, OV?, +REL, ?RL, INT, SYS, BAD, LBR, ARC, ARK, ?Q?, and ?Z?. If one of these types +is specified, only the directory information for the requested file is listed. + +Note that CRC and file length checking are not performed during a typeout +operation, as they are during extraction to a disk file. + + + +PRINTING A FILE IN AN ARCHIVE +----------------------------- + +A single component file in an archive may be output directly to the printer +(CP/M list device) by specifying a trailing "P" on the command line. The "P" +must be the last command line character, and it must be separated from the +second file parameter by a space. (The file parameter must specify a non- +ambiguous file name and no disk drive name.) For example: + + A>UNARC CODES CHARLIE.TXT P + +The specified file is assumed to contain data suitable for printer output and +is passed directly to the printer without alteration or additional formatting. +This operation is particularly well-suited for output of binary graphics +images on dot-matrix printers, since these can be extemely large but tend to +compress quite well (e.g. to less than 5% of their original size). Note that +the binary data filetypes which are excluded from typeout operations are also +excluded from printing operations. Printing may be paused or aborted by use +of the console CTRL-S and CTRL-C characters. + + + +CHECKING FILES IN AN ARCHIVE +---------------------------- + +UNARC may be directed to extract one or more component files from an archive, +without actually storing these as disk files, by specifying a trailing "C" on +the command line. This operation performs file CRC and length checking, and +it is useful for verifying correct modem data transmission of an archive. The +"C" must be the last command line character, and it must be separated from the +second file parameter by a space. (The file parameter must not specify a disk +drive name, which indicates extraction to disk.) To check an entire archive, +specify "*.*" for the second file parameter, for example: + + A>UNARC CODES *.* C + + + +PROGRAM OPTIONS +--------------- + +UNARC provides several options which may be used to tailor the program for +specific non-universal requirements. Many of these are intended for RCP/M +(Remote CP/M) system operators, to allow generation of a secure version of +UNARC which can be used by remote callers for purposes of archive directory +listing and/or file typeout only (but not file extraction). Others are +provided for specialized non-standard CP/M systems and need not concern the +majority of users running CP/M 2.2, CP/M 3.0 (CP/M Plus), or ZCPR3/ZRDOS +systems. Additional options provide user preference features (such as the +number of screen lines between console output pauses, or the list of filetypes +excluded from typeout operations). + +All of these options are described in UNARCOVL.ASM, an assembly language +source file that can be edited and assembled to generate a HEX-format overlay +for easy patching of the UNARC.COM or UNARCA.COM program files. Complete +details are provided for technically-oriented users in UNARCOVL.ASM. However, +the default options in the distributed program files are suitable for the +majority of users with standard CP/M operating systems. + + + +PROGRAM DISTRIBUTION +-------------------- + +The UNARC program, its documentation, and all related files are distributed in +archive file format (of course!). The distribution file is named UNARCxx.ARK, +where "xx" is derived from the current version number (e.g. UNARC16.ARK for +version 1.6). (This does not include the program source code, which is +distributed separately.) This archive has the special characteristic that it +is "self-unpacking." I.e., a separate copy of the UNARC.COM program file is +NOT required to extract the component files from this archive. + +The procedure for extracting the distribution files is quite simple: First, +copy or rename UNARCxx.ARK to a program file, UNARCxx.COM, on the current disk +drive. (Note that the filename, UNARCxx, must NOT be changed.) Then, run +this program with a single optional command line parameter specifying the disk +drive to which all distribution files will be extracted (defaults to current +drive). + +For example, assuming UNARC16.ARK is on drive B: and the files are to be +extracted to drive C:, the following CP/M commands may be used: + + A>B: ; Set current drive for UNARC16.ARK + B>REN UNARC16.COM=UNARC16.ARK ; Rename it to UNARC16.COM + B>UNARC16 C: ; Run it to extract all files to drive C: + +Note that this self-unpacking capability is provided only by the distributed +archive file, and it will not work if that file is altered or reconstructed. + + + +AUTHOR'S NOTE +------------- + +I undertook writing the UNARC program to satisfy my curiosity about software +developments in the MS-DOS/PC-DOS world. At the time I began work on UNARC, +the MS-DOS ARC program had been in existence for over a year and had achieved +widespread popularity and acceptance in the 16-bit community. Unfortunately, +the lack of a compatible equivalent for CP/M systems rendered a large amount +of public domain software inaccessible to 8-bit users such as myself. (Note +that 16-bit software can indeed be of interest to users of 8-bit systems, e.g. +Pascal and C language programs.) + +Also, an increasing number of RCP/M systems now cater to both 8-bit and 16-bit +users. Since the release of UNARC 1.0 (May 3, 1986), I have been encouraged +to see that the program has found a welcome home on many such systems. +Special thanks are due to Irv Hoff and Norman Beeler for providing archive +file support in the KMD20 and LUX52 series of programs, respectively. With +the increasing popularity of .ARC files on many different computer systems, I +believe that continued such support of this compression format is both +desirable and inevitable for CP/M systems. At the time of this writing I am +about to release NOAH, a companion program to UNARC which will allow CP/M +users to generate ARC-compatible files. + + Bob Freed + March 27, 1987 + + + + NOTICE + + The UNARC program and its associated documentation is the copy- + righted property of its author -- it is NOT in the public domain. + HOWEVER... Free use, distribution, and modification of these + files is permitted (and encouraged), subject to the following + conditions: + + (1) Such use or distribution must be for non-profit purposes only. + (2) The author's copyright notice may not be altered or removed. + (3) Modifications to this program or its documentation files may + not be distributed without notification of and approval by + the author. + (4) The source program code may not be used, in whole or in part, + in any other publicly-distributed or derivative work without + similar notification and approval. + + No fee is requested or expected for the use and distribution of + this program subject to the above conditions. The author reserves + the right to modify these conditions for any future revisions of + this program. Questions, comments, suggestions, commercial + inquiries, and bug reports or fixes are welcomed by the author: + + Robert A. Freed + 62 Miller Road + Newton Centre, MA 02159 + Telephone (617) 332-3533 + +------------------------------------------------------------------------------ + \ No newline at end of file diff --git a/Source/Images/d_bp/u0/UNCR.COM b/Source/Images/Common/All/UNCR.COM similarity index 100% rename from Source/Images/d_bp/u0/UNCR.COM rename to Source/Images/Common/All/UNCR.COM diff --git a/Source/Images/Common/All/UNZIP.COM b/Source/Images/Common/All/UNZIP.COM new file mode 100644 index 00000000..9da369ff Binary files /dev/null and b/Source/Images/Common/All/UNZIP.COM differ diff --git a/Source/Images/Common/All/UNZIP.DOC b/Source/Images/Common/All/UNZIP.DOC new file mode 100644 index 00000000..734d8dab --- /dev/null +++ b/Source/Images/Common/All/UNZIP.DOC @@ -0,0 +1,74 @@ + UNZIPZ vers 0.3 + Z-System UNZIPPER + +UNZIZ can extract all files from any zip file created by PKZIP on MSDOS. +As such it should prove useful on CP/M systems for extracting CP/M relevant +files from zip archives found on BBSs or the Web since UNZIPZ preserves date +stamps on CP/M systems with Date Stamping. + +To use UNZIPZ use the following Syntax: + + UNZIP [dir:]ufn[.ZIP][dir:][afn ][/o] + +On ZCPR3x systems {dir} can be either in named directory or DU (Drive +Letter followed by User number) form otherwise, the DU form must be used. +If {afn} is not given, *.* is assumed. If no option is specified, UNZIPZ +checks the CRCs of the files matching {dir:afn}. The only option is E which +causes the extraction of files matching {dir:afn} unless the file already +exists. In that case, the user is informed that it exists and the file is not +extracted. To extract such files, they must be erased and then extraction +reattempted. + +For each file processed, the following information is displayed: Name, +Uncompressed Length, Stored Length, Compression Method, PKZIP Version, +File Date and Time, 32 bit CRC and Status. Status consists of CRC OK, CRC +ERR or EXISTS. Example ouput: + +UNZIPZ Version 0.4-1 - SC + +ZIP archive = H4:SOURCE.ZIP +Output Drive = H4: +Name Length Stored Method Ver File Date & Time CRC STATUS +============ ======= ======= ======== === ========= ===== ======== ======= +UDATZI .Z80 3201 1320 Deflated 20 19 Oct 20 07:22 CC7E8454 CRC OK +UNZIP .Z80 18464 5419 Deflated 20 19 Oct 20 21:16 45E711B1 CRC OK +UNZIP12 .Z80 17649 5042 Deflated 20 08 Jun 20 07:46 4C05E1AB EXISTS + +The current version is a significant revision of ver 0.2. Main improvement +is the addition of the undeflate algorithm (thanks Martin). In addition the +CRCs are only checked for extracted files which speeds things up +considerably. Speedups to the undeflate algorithm by Russell Marks have +also been incorporated. The ouput display has been improved substantialy +and is similar to UNARCZ10. + +Version 0.2 Notes by Simon Cran. + +The files in this archive are my Z-modified version of UNZIP 1.2. They +consist of three files in order to make sure that the unitialised data ends +up at the end of all files linked. Also, because the unitialised data file +(UDATZI.Z80) needed to share some equates with the main program, all +equates have been put in a separate .LIB file. + +The original program is fast and dirty. This Z-modified version gets rid of +some of the dirty without sacrificing too much else. Note however, it is +only in embryonic stages... It has not developed to the point of UNARCZ10 +for example. + +That said though, it does work, and well enough to find a niche out there. +Its main advantage is speed when you wish to extract all the files in the +archive. You can now specify particular files to extract, but it isn't much +quicker in that mode, as it still decodes each file in the archive and checks +its CRC. That will change in a future version. + +The display is now better, but it is very much in development mode! The +idea is to have it approximately mimic UNARCZ10. It kind of does that now, +but leaves out a lot of information... I'm working on it! + +Source code is included, but without comments. If you'd like to know more, +contact me. + +Simeon! +Z-Node 62 +Perth +Western Australia. + \ No newline at end of file diff --git a/Source/Images/Common/All/XSUB1.COM b/Source/Images/Common/All/XSUB1.COM new file mode 100644 index 00000000..c30996a4 Binary files /dev/null and b/Source/Images/Common/All/XSUB1.COM differ diff --git a/Source/Images/Common/ZAP.COM b/Source/Images/Common/All/ZAP.COM similarity index 100% rename from Source/Images/Common/ZAP.COM rename to Source/Images/Common/All/ZAP.COM diff --git a/Source/Images/Common/All/ZDE.COM b/Source/Images/Common/All/ZDE.COM new file mode 100644 index 00000000..b80559be Binary files /dev/null and b/Source/Images/Common/All/ZDE.COM differ diff --git a/Source/Images/Common/All/ZDE.DOC b/Source/Images/Common/All/ZDE.DOC new file mode 100644 index 00000000..6bf63117 --- /dev/null +++ b/Source/Images/Common/All/ZDE.DOC @@ -0,0 +1,1043 @@ +ZDE 1.0 Manual + ZDE + + Z-System Display Editor + + Version 1.0 10 Mar 89 + + ZDE and its documentation are copyright 1989 by Carson Wilson, + all rights reserved. They may not be circulated in any + incomplete or modified form without written permission of the + author. Any commercial use of ZDE, defined as any situation + where the duplicator receives revenue by duplicating or + distributing ZDE by itself or in conjunction with any hardware + or software product, is expressly prohibited unless authorized + in writing by Carson Wilson. + + +1. Introduction. + + ZDE, the Z-System Display Editor, is a small, fast, powerful +text editor based Eric Meyer's famous Video Display Editor (VDE). +ZDE retains all features of VDE, but removes defects and supports +special ZCPR and ZSDOS features such as named directories, +register variables, automatic disk relog, and file datestamp +support. The install program has also been improved (see +ZDE10.NEW for a complete rundown of improvements). At the same +time, I have tried to be conscientious about the balance between +features and memory usage. If I added every new feature or +convenience that came to mind, we would soon have a luxurious +in-memory editor for 2 kilobyte files! Much of the following is +adapted with permission from Eric Meyer's VDE.DOC. + + ZDE's native ASCII mode and definable macros make it an ideal +programmer's editor; its full formatting and printing features +also make it an efficient word processor. Written entirely in Z80 +assembler, ZDE is F-A-S-T. There are no disk overlays, and all +editing is done in memory. As a result, finding a string near the +end of a 50K file takes WordStar 3.3 about 14 seconds (8MHz Z80); +ZDE does it in under a second. This is like moving through air +instead of molasses: you will find that you can do more of your +work on screen, and less on paper. + +Among ZDE's features are: + +Full-screen editing User area and named directory support +Block operations Wordwrap and reformat +File datestamp support Macro programs +Disk file operations Margins, tabs, spacing +Find and replace WordStar compatibility +Many print features Undeletion +Configurable options Support for all CP/M terminals + + +2. Installing ZDE. + + ZDE works with Z80 CP/M 2.2 and 3.0 and compatible systems. +It is ideal for portable computers with limited disk space. There +are many user configurable options, and ZDE can be installed for +all CP/M terminals. If you are running ZCPR, ZSDOS or Z3PLUS, ZDE +offers features not available with less advanced system software, +but these system enhancements are not required. + + To install ZDE, use the ZDENSTAL configuration program; see +the accompanying file ZDENSTAL.DOC. You should install ZDE for +your computer's terminal at the earliest convenience, since this +greatly enhances performance. There are many other installable +options; you will discover how you want everything set in the +course of using ZDE, so don't worry about going through all of it +at first. For ease of reference, portions of this manual +referring to installable options and settings are enclosed in +square brackets ("[" and "]"). + + +3. Invoking ZDE. + + ZDE is invoked from your system's command prompt using the +following syntax ("ufn" means "unambiguous file name"): + + ZDE Begin working on a new file. + + ZDE ufn Edit a new or already existing file. + + ZDE dir:ufn Edit a new or existing file from another + directory. + + ZDE ufn m Edit a file using mode "m." + ZDE ufn[m + +"m" above can be either W, A, or N (see File Modes, below), and +"dir" can be either a drive, a user area, a drive followed by a +user area, or a ZCPR named directory. For example: + + ZDE A4:MYFILE.TXT N Begin working on MYFILE.TXT at user + area 4, drive A, in non-document + mode. + + The size of the file to be edited is limited by available +memory. This will vary for different systems, but normally the +maximum size will be between 45 and 55k. If a file is too large +to edit, you must break it up and edit the pieces separately. +Numerous CP/M utilities are available which will break up and +rejoin ASCII files. + + +4. ZDE's Command Set. + + ZDE's commands consist of simple one- or two-key +combinations, easily found by the touch typist without +distraction. Most commands are the same as WordStar's. If you +have questions that this file can't answer, a WordStar manual may +be a useful reference. But ZDE is not a WordStar "clone"; there +are significant differences, including an extended set of +ESC-commands for functions such as macros (see below). + Virtually complete compatibility with the WordStar command +(sub)set can be achieved UNLESS the keys ^J, ^K, and ^L are used +as arrow keys (as on many CP/M computers). In this event ZDE +synonyms must be used: ESC- for the ^K- prefix; ESC-H for ^J; and +^\ for ^L (see ZDENSTAL.DOC for terminal installation). + +4.1. Command Summary. + + Below, the "^" character indicates use of the Ctrl key: ^K = +Ctrl+K. The ESC (^K), ^O, and ^Q prefixes require pressing two +keys in sequence: ^O C, for instance means press ^O, then C (or +^C). Any prefix may be canceled by typing ESC or Space. + +4.1.1. Control Keys: Single Keystroke Commands. + + ^J (ESC H) = display Help menus. + + CR = Carriage return (^M). Marks a paragraph end. + BS = Backspace (^H). + TAB = Hard Tab mode: insert tab (^I). Variable Tab mode: move + to next stop. + + Arrow keys: WordStar: ^E up, ^X down, ^S left, ^D right. + Alternate: configurable, default ^K, ^J, ^H, ^L. + + ^F = move to start of next word right. + ^A = move to start of next word left. + ^R = scroll back one screen. + ^C = scroll forward one screen. + ^W = scroll back one line. + ^Z = scroll forward one line. + + ^G = delete character to the right of the cursor. + DEL = delete character to the left (configurable). + ^U = undelete a character. + ^T = delete word to right of cursor. + ^Y = delete current line. + + ^N = insert a carriage return (break line) at present + position. + ^V = toggle INSERT mode on and off. + ^^ = toggle case (upper/lower) of character at cursor. + ^P = insert following control code in text. + ^B = reformat current paragraph. + ^L (^\) = repeat find/replace (repeats last ^QF or ^QA + command). + +4.1.2. File and Block Commands: first hit ^K (or ESC), then the + key shown. + + ^K I = display file/memory Information message. + + ^K F = List files in disk directory. + ^K E = Erase a disk file. + + ^K L = Load a brand new file to begin editing. + ^K N = change the current file Name (affects Save, eXit). + ^K S = Save the current file to disk, and continue editing. + ^K D = Done. Save the file, then load a new one. + ^K X = eXit: Save the file, then Quit to CP/M. + ^K Q = Quit to CP/M, abandoning current file. + + ^K R = Read a disk file into text at cursor position. + ^K P = Print the text (whole file or block). + + ^K B = mark the start of a Block. + ^K K = mark the end of a block. + ^K U = Unmark the block. + ^K Y = Delete the marked block. + ^K C = Copy the block text at present cursor position. + ^K V = moVe the block text to the present cursor position. + ^K W = Write the marked block to a disk file. + +4.1.3. Escape and Macro Commands: first hit ESC, then the key + shown. + + ESC arrows: Left/Right (including ^S/D) = shift screen + horizontally + by 32 columns. + Up/Down (including ^E/X) = shift screen + vertically + by 1/4 screen. + ESC TAB = move back to last tab stop. + + ESC M = execute a Macro string of commands. + ESC # = store macro on numeric key for later recall. + ESC 0..9 = use stored key. (In macro mode: jump label.) + ESC !,=,~,+ = used in Macro programming (see below). + ESC ; = brief pause, during Macro execution only. + +4.1.4. Quick Commands: first hit ^Q, then the key shown. + + ^Q Arrows: Left/Right (including ^S/D) = go to start or end + of line. + Up/Down (including ^E/X) = go to top or bottom + of screen. + ^Q R = move to top of file. + ^Q C = move to end of file. + ^Q I = move to specified page or line number. + ^Q B = move to marked block. + ^Q Q = move to next line in queue (ZCPR only). + ^Q Z = move to next place marker. + + ^Q F = find next occurrence of a string. + ^Q A = find and replace a string. + + ^Q Y = delete from cursor to end of current line. + ^Q DEL = delete from cursor to beginning of current line. + ^Q T = delete until specified character (caution--powerful!). + ^Q U = undelete a line. + +4.1.5. Onscreen Commands: first hit ^O, then the key shown. + + ^O Arrow: Up (including ^E) = make current line top of + screen. + + ^O R = set right margin (column 1 turns off + wordwrap/formatting). + ^O L = set left margin. + ^O X = toggle Margin Release on/off. + ^O C = center current line. + ^O F = align current line flush with the right margin. + + ^O Q = toggle header on/off. + ^O T = toggle ruler line on/off. + ^O D = toggle display of hard CRs on/off. + + ^O A = toggle Auto Indent on/off. + ^O S = toggle Double Spacing on/off. + ^O H = toggle hyphenation on/off. + ^O V = toggle tab mode Hard/Variable. + ^O I = set variable tab stop. + ^O N = clear variable tab stop. + + ^O P = set page length (0 turns off pagination). + ^O W = toggle windowing on/off (see below). + ^O Z = temporarily blank the entire screen. + + +5. Command Descriptions. + +5.1. Auto-Indent Mode (^O-A). + + Auto-Indent is useful for typing outlines, structured program +source code, and other text where the "left margin" varies. +Auto-Indent causes the RETURN key to act differently: If you are +entering new text, it will be indented to match the previous line. +If you are just moving through the file, the cursor advances past +any existing indentation. + +5.2. Block Commands (^K-B, -K, -U, -R, -Y, -W, -C, -V, -P-B, + ^Q-B). + + A "block" of text is normally delimited by two markers +[default: ^@] which remain in memory until reset or deleted. + ^K-B marks the beginning of the block; ^K-K marks its end. +Markers are inserted in the text. The two markers are identical; +the first one present is the start. + ^K-U unmarks the block, removing any marker(s) set (block +markers can also be deleted individually as ordinary characters). +Markers are automatically removed as appropriate when ^K-B/-K are +used again. + ^K-R reads in the contents of a disk file, inserting it as a +block after the current cursor position. You will be asked for +the name (and, optionally, mode) of the file. Other block +operation commands all require a Block to be marked: + ^K-Y deletes the block (including markers). + ^K-W writes the block text to a disk file; you will be asked +for the filename (and optional mode). + ^K-V moves the Block text to the present cursor location, +deleting the original; ^K-C copies it and leaves the original. +Sometimes ZDE will run out of memory when moving blocks within a +large file. If this occurs, just write the block to a file, +delete it, and read it back in as: "^K-W, ^K-Y, ^K-R". + ^K-P-B (^K-P with B option) prints the block text only. + The ^Q-B command, from wherever you are in the file, moves +the cursor to the Block start. + +5.3. Cursor Movement (Arrow keys; ^F; ^A; ^Q-R, -C, -I). + + ZDE supports three sets of Arrow keys, which function +interchangeably. The two built-in sets support the WordStar +"arrow key diamond" ^E, ^X, ^D, ^S, and the ANSI standard 3-byte +sequences (ESC-[-A, etc.). The third set is user-configurable, +and must be installed with ZDENSTAL. These keys move the cursor +up, down, right, and left respectively. Note: if you install ^J, +^K, and ^L as arrow keys, you must use ESC- commands for help, +file operations, and repeat find/replace, respectively. + Preceded by ^Q-, any arrow key (except ANSI) moves more +quickly: to the top or bottom of the screen, to the left or right +end of the line. + There are also two word movement commands: ^F moves right, to +the start of the next word; ^A moves left, to the start of the +previous (or current) word. Both have maximum ranges of 255 +characters. + For quickly covering large distances, the commands ^Q-R and +^Q-C go all the way to the beginning and end of the file, +respectively, and ^Q-I goes to any specified page (or line, in +non-documents). + +5.4. Deleting (^G, DEL, ^T, ^Y, ^Q-Y, -DEL, -T). + + You can delete text one CHARACTER at a time: ^G deletes to +the right of the cursor, and DEL to the left. [If you have no DEL +key, you can install another equivalent.] Note that the ordinary +BS (^H) does not normally delete. + ^T deletes an entire WORD to the right (up to 255 characters) + ^Y deletes the entire current LINE. ^Q-Y deletes only the +part of the line to the right of the cursor; ^Q-DEL deletes the +part to the left. + ^Q-T deletes UP TO a specified character. Example: "^Q-T." +deletes to the end of the sentence. Special case: "^Q-T-CR" +deletes to the next HARD CR, the end of the paragraph. This is a +powerful command, so use it with caution. + Accidentally deleted text can usually be recovered (see +Undelete, below). + +5.5. Disk Operations (^K-F, -E). + + ^K-F gives an unsorted list of disk FILES: hit CR to list the +directory specified by the current file, or specify a drive, user, +or named directory (colon optional). If there is not enough room +to fit all the files on the screen, you will see "..." at the end +to indicate that there were still more. Press ESC or Space to +continue. + ^K-E will ERASE a single disk file to provide more room on +the disk (no wildcards allowed). + +5.6. File Commands (^K-N, -S, -X, -Q, -D, -L). + + ^K-N NAMES your work or changes the current file mode. You +can change the filename in the header before saving, and/or change +its mode to WordStar, ASCII, or Nondocument. To set the file +mode, introduce the mode character with the left square bracket, +e.g., "Name: MYFILE.WS [W". + ^K-S SAVES your work: what's in memory is written to disk +under the file name in the header (you must have a file name; one +will be requested if necessary). If that file already existed, a +backup (.BAK) file may be preserved [configurable; see +installation guide]. If you haven't changed the file, ZDE prompts +you to confirm that you want to resave it anyway. + There are several different commands for finishing up: + ^K-X saves your work and then EXITS to CP/M. + ^K-Q just QUITS. If the file has been modified, ZDE asks if +you want to abandon the changes. + ^K-D (DONE) saves your work, then loads a new file to edit. + ^K-L quits the current file and LOADS a new one to begin +editing. + +5.7. Find, Replace (^Q-F, -A, ^L, ^\). + + ^Q-F is the command to FIND a string. The search normally +proceeds from the cursor position forward, and is case +(upper/lower) insensitive. There are two options: "B" = search +backwards; "C" = case sensitive search. If used, the options +must be enclosed in slashes (eg, "/bc/") before the search string. +(If you want to search for a string beginning with a slash, use an +empty (//) option first.) In addition, a ^P-Z [this can be +reconfigured] functions as a wildcard matching any single +character. Other control codes, like ^M for newline, can be +included (with the ^P prefix where needed). Examples: + + Find: /c/^MLABEL matches "LABEL" at start of line only; + Find: 4^Z^Z01 matches "42201", "47401", etc; + Find: wordstar matches "WORDSTAR", "WordStar" etc; + Find: ///88 matches "/88"; + Find: /b/esc looks backwards for "Esc", "esc", etc. + + ^Q-A is the FIND/REPLACE command. It asks for a string to +find, and what to change it to (all options above apply to the +search string only). The cursor will be placed on each occurrence +of the string successively, starting at the cursor location. You +will see the prompt "Chg?" in the header. To replace the old +string with the new one, press "Y"; anything else skips to the +next. To change all further occurrences without being asked, +press "*". ESC cancels at any time. (Note: if ^Q-A is used in a +Macro, it will automatically assume "*" with no further input +required.) + ^L (or ^\, if ^L is an arrow key) repeats the last ^Q-F or +^Q-A command. For ^Q-A, you will be asked whether you want to +replace the found string. For both, direction and case options +remain unchanged. + +5.8. Header (^O-Q). + + ZDE normally gives you a header, or status line, at the top +of the screen. However, if you like you can toggle the header +display on and off with the ^O-Q (QUIET) command. [The header may +also be suppressed by default.] This lets you see more file text. +It can also speed up operation on some slower terminals, as the +position doesn't have to be continually updated. + + A typical header line looks something like: +------------------------------------------------------------------ +B0/WORK:ZDE.DOC [A Pg 8 Ln 31 Cl 53 INS vt hy AI DS MR ^Q_ +------------------------------------------------------------------ + "B0/WORK:ZDE.DOC [A" = Current directory, filename, and mode. + "Pg 8, etc" = Current position in file by page, line, column. +For "N"ondocuments, there is no page number display. If +pagination (^O-P) is off, you will see "Pg 0" (document) or "OP" +(nondocument) here. + "INS" = Insert mode on (^V). + "vt" = Variable tabs on (^O-V). + "hy" = Hyphenation enabled. (^O-H) Doesn't display in "N" + mode. + "AI" = Auto indent mode on (^O-A). + "DS" = Double spacing (^O-S). + "MR" = Margins released (^O-X). Doesn't display in "N" mode. + "^Q_": Prefix keys (and some prompts) display here. + +5.9. Information (^K-I). + + ^KI displays an Information message with: + + - the ZDE version and date; + - whether (Y/N) the file has been changed since last saved; + - the current size of the file in bytes; + - the number of bytes of text memory used and free (1024 + bytes = 1K). + + You will note that the file uses about 20-25% less memory +than its actual length; this is due to ZDE's compression of text. +(Note: ZDE is limited to 16-bit arithmetic. In the unlikely event +that file size should exceed 64K it will be shown mod 64K; just +add 65536.) + Block moves and copying are limited by the amount of free +memory. Further, when there is less than 1K free, response time +can get very slow. + +5.10. Insert Mode (^V). + + ^V toggles insertion on and off. If insert is OFF, any text +to the right of the cursor is overwritten as you type. If insert +is ON, what you type is inserted, and existing text moves to the +right. + +5.11. Line Spacing (^O-S). + + The ^O-S command toggles between single and double line +spacing. In double space mode, the following functions generate +double carriage returns: CR (^M), Insert CR (^N), Reform (^B), +Wordwrap. You can easily mix single and double spacing; the ^B +command can convert between the two. Note: if you prefer to keep +your actual file single spaced, you can still get a double-spaced +printout by using the "D" option of the ^K-P command (see +Printing). + +5.12. Margins (^O-R, -L, -X, -C, -F). + + ^O-R sets the RIGHT margin, enabling wordwrap, reformatting, +and centering. A right margin of 1 disables all formatting +functions (same as in "N"ondocument mode). At the prompt +"Column:" enter the column number (1-255), or just hit CR for the +current cursor column. If the value entered conflicts with the +current left margin, ZDE sets the left margin to 1. + ^O-L sets the LEFT margin in an identical fashion; of course, +the value must always be less than the current right margin, +meaning it's best to set the right margin first. + ^O-X temporarily RELEASES the margins (resets them to 1), +allowing you to type outside them. Use ^O-X again to restore the +margins. + ^O-C CENTERS the current line with respect to the margins, if +set. ^O-F sets the current line FLUSH right, if the right margin +is set. + +5.13. Pagination (^O-P). + + The ^O-P command sets the page length. Enter a value from 0 +to 255, or just hit CR to restore the default value [normally 54]. + When the value is nonzero, it determines the page and line +shown in the document header ("Pg xx Ln xx"), and page-oriented +Print functions (formfeeds, headers, start/stop print) are enabled. + When the value is zero, pagination is off. The header will +say "Pg 0 Ln xxxx", showing you the absolute line number in the +file. Also, printing occurs with no page breaks or formfeeds. +This can be useful for printing small things right after each +other on the same sheet; or, in conjunction with the "*" print +option, can be used to print out multiple copies of index cards, +labels, etc. + ZDE never sends a formfeed before printing; begin your file +with a ^P-L character if you need one. Otherwise, use of ^P-L is +not recommended in document files as it renders ZDE's page count +inaccurate. + +5.14. Place Markers and Line Queue (^P-Z, ^Q-Z, ^Q-Q). + + You can set any number of temporary PLACE MARKERS in the text +with ^P-Z (they will appear as ^Z). The ^Q-Z command moves the +cursor to the next place marker in the file, cycling back to the +top of the file if needed. Place markers are NOT saved to disk. + ZCPR users may also store a QUEUE of up to eight line numbers +in their user-defined messages (a set of sixteen bytes of +protected memory "available for user definition"). The ^Q-Q +command will then cycle through the queue of line numbers, +returning to the first location when it reaches a value of zero. +A value greater than the number of lines in the file takes the +cursor to the end of the file. The numbers are stored as two-byte +inverted hexadecimal words. This facility is intended as an +interface between other programs and ZDE for such purposes as +storing the locations of compiler errors, however ZCPR users may +also find it useful to POKE these locations directly before +invoking ZDE. + +5.15. Printer Codes (^P). + + Control codes for special effects in printing can be entered +in the text with the ^P prefix. Thus pressing ^P-^H (or ^P-H) +embeds a ^H, etc. Several standard codes are: + + ^H - backspace - overstrike previous character + ^I - hard (ASCII) tab - printers respond variously to this + ^L - formfeed (Not recommended unless pagination (^O-P) + disabled) + + The Block marker, normally ^@, cannot be embedded, and ^Z is +reserved for use as a place marker. Control codes display on +screen as capital letters, highlighted if possible. ZDE assumes +they are not characters, so they are not counted when reformatting +text. + For greater convenience, you can also arrange to have a +single ^P-code produce an entire string of bytes for commonly used +printing effects. ZDE supports a subset of WordStar's printer +installation, seven definable codes: four toggles, four switches. +The Printer Installation in ZDENSTAL allows you to choose what +codes you want to use, and install the actual control sequences +your printer needs. The defaults are: + + toggles: ^B, ^D, ^S, ^Y + switches: ^Q, ^W, ^E, ^R + + In WordStar these toggles are Boldface, Doublestrike, +Underline, and Ribbon/Italic respectively, but you can make them +anything you like. "Toggles" are good for features like underline +and bold that are turned on and off. "Switches" are better for +multivalued parameters like character pitch. + Example: your printer uses ESC-U-01 (and 00) to turn +underlining on (and off). If you install these codes with +ZDENSTAL: + ^S toggle on: (03)1B5501 + ...and off: (03)1B5500 + +then all you have to type in ZDE to get underlined text is: +^PSunderlined text^PS. + +5.16. Printing (^K-P). + + The ^K-P command PRINTS all or part of the file in memory. +You will be asked for a set of "Options:", at which point you may +enter zero or more of the following, in any order: + + B prints only the currently marked BLOCK. + P PAUSES for your keystroke before each page (sheet + feed). + D DOUBLE SPACES all text to be printed. + Lnn sets the printer LEFT MARGIN to nn columns [the + default value can be set with ZDENSTAL]. + ^ FILTERS control characters ^X to text "^X". + *nn prints the job out nn TIMES (nn=1..255). + @nn begins printing AT the nn'th page. + =nn renumbers the pages beginning with nn. + #nn prints only (up to) a TOTAL of nn pages. + "..." uses the quoted string as a HEADER. The string, + followed immediately by the page number, will print + at the top right of each page near the margin (maxi- + mum length is 50 characters; an empty string, "", + gives numbered pages with no header text.) + +The last four options (@,=,#,"") are NOT allowed if pagination is +disabled (^O-P), or if "B"lock print was chosen. Examples: + +Options: L12P + - Print the file with a left margin of 12 columns, pausing + before each page for you to press a key (other than Esc). + +Options: @6#2=14"Instructions, page " + - Print the sixth and seventh pages of the file, but numbered + 14 and 15, with the header shown. + +Options: BD^*2 + - Print out the current marked Block twice, double spaced, + with control filtering. + + In "W" mode, lines beginning with a "." will be regarded as +WordStar dot commands, and will neither print out nor affect the +page count (they have no other effect either). + You can abort printing at any time with ESC (this may take a +moment, or a few keystrokes, depending on your BIOS). + +5.17. Ruler Line (^O-T). + + To help you align text properly, ^O-T toggles display of a +"ruler line" above the text on and off. + In each column you will see one of several symbols: "[]" +designate the current margins (if set); "-" indicates areas within +the current margins, "." outside them. Also, tab stops are marked +by either "T" (Variable) or "I" (Hard). Examples: + +("A" mode) [-----T-----T-----------T--------------]........ +("N" mode) I.......I.......I.......I.......I.......I....... + +5.18. Tabs (^I, ESC-TAB, ^O-V, ^O-I, ^O-N). + + There are two Tab modes: Variable and Hard, and the ^O-V +command toggles between them. In Hard Tab mode the Tab key +produces an actual ^I (ASCII 09); whether this overwrites any +existing text depends on the Insert toggle. Hard Tabs display by +default at fixed intervals of 8 screen columns [this is +configurable to any multiple of 2]. + In Variable Tab mode, the Tab key moves the cursor to the +next variable tab stop (you can always get a Hard Tab by typing +^P-I). If Insert is on, spaces are inserted up to the next tab +stop. Otherwise, existing text is skipped over, but spaces are +still added at the end of a line as needed. Up to eight tab stops +may be set with ^O-I and cleared with ^O-N; the defaults are in +columns 6, 11, 16, and 21 [these are configurable]. At the +prompt, enter the column number desired, or hit RETURN for the +cursor column. + The ^O-I command also accepts two multiple-set inputs: "@nn" +sets tab stops every "nn" columns, while "#n1,n2,..." sets tabs at +columns "n1,n2, ...". Both remove any pre-existing tabs, and +typing "@" or "#" alone simply clears all tabs. + The ESC-TAB command moves backward (left) to the previous +variable or hard tab stop. + +5.19. Undelete (^U, ^Q-U). + + The undelete functions may be used (repeatedly if necessary) +to recover a reasonable amount of text deleted either by +overtyping, or with any of ZDE's delete commands, IF the cursor +has not yet been moved away. ^U undeletes one character; ^Q-U +does a whole line. + Restrictions: undelete may not recover all of a Block delete +unless the cursor was in or near the block deleted, and it may +work imperfectly if DEL has been used several times in sequence. + Further use after all deleted text is recovered will produce +junk (usually duplicates of text above the cursor, which is +sometimes useful). + +5.20. Upper/Lower Case (^^). + + The ^^ (ctl-caret) command changes the case of the character +at the cursor, if it was a letter, and moves the cursor one +character to the right. Useful for capitalizing a string of +lowercase text, or vice versa. + +5.21. Window and Screen (^W, ^Z, ESC-Arrows, ^O-Up, -W, -Z). + + ZDE supports several functions to move and alter the display +screen. + The ^W and ^Z commands scroll the screen up and down a line +at a time, without moving the cursor (unless necessary). + Preceded by ESC, any arrow (except ANSI) moves the screen +rather than the cursor: the text as a whole shifts up/down 1/4 +screen, or right/left 32 columns, while the cursor stays put (the +cursor must be past column 32 for horizontal shifts to work). + Preceded by ^O-, any UP arrow key (except ANSI) makes the +current text line the top of the screen. + The ^O-W command creates a WINDOW in the bottom half of the +screen, which retains a copy of the file text starting at the +current line, plus the current status and/or ruler line(s), if +any. Editing continues normally in the top half of the screen. +This is useful for comparing different sections of text within a +file, or even between different files. Typing ^O-W again removes +the Window. Note: Windowing is only supported for screens of 15 +or more lines. + The ^O-Z command temporarily zaps (blanks) the entire screen; +good for avoiding CRT burn-in, or just protecting work from prying +eyes or fingers. Restore the screen by pressing ESC or SPACE. +Note: if Windowing was in effect, any text in the window will be +lost. + +5.22. Wordwrap, Reformat (^B, ^O-D). + + WORDWRAP is automatic in Document ("W" or "A") modes whenever +the right margin is set. Any text entered will be formatted to +the current margin settings as you type. The end of a paragraph +is marked by a "HARD CR", which occurs when you press the RETURN +key (this is a CR immediately following a character of text). In +contrast, when wordwrap occurs you get a "SOFT CR" (which is +actually a CR with a space before it). You can change a hard CR +into a soft one, or vice versa, by deleting or adding a space at +the end of the line. Hitting RETURN also hardens a soft CR. The +distinction between hard and soft CRs is only important when +reformatting. + ^B REFORMATS from the line the cursor is on, to the end of +the paragraph, according to the current margin settings and line +spacing. ^B may be used not only to reshape a paragraph after +editing, but also to change its margins and line spacing. +Indentation can be tricky if you have a left margin set. If the +current line is indented relative to the next one, ZDE assumes +that amount as your paragraph indentation. + ^O-D toggles DISPLAY OF HARD CRs. Hard CRs, otherwise +invisible, can be caused to display as a "<" character. This can +be useful; some may find it distracting, so it turns off. + + +6. Macros. + +6.1. Macro (ESC-M). + + A MACRO is a string of ZDE commands and text that, once +defined, can be repeated automatically. When you type ESC-M you +will be asked for the string, then a "Repeat count". Usually you +will simply type a number for the repeat count (0-9, or "*" for +"indefinitely"). You will see the results as the macro executes, +and you can abort it at any time by pressing ESC. If you are sure +you know what you're doing, you can speed up Macro execution by +specifying "Quiet" mode: press "Q" before the repeat count. Only +the header, if present, will be updated as the Macro runs. + Macros also stop any time an error occurs; the error message +will be visible, and can be cleared by pressing ESC. Many +commands (like Find or Reformat) are designed to generate errors +at the end of the file so that indefinite ("*") Macros containing +them halt there. You may need to abort other indefinite Macros +manually. + ZDE turns INSERT OFF before running a macro, so that the same +key sequence will always have the same effect. INSERT status is +restored when the macro terminates. + In order to include any input line editing characters (BS, +CR, etc.) in a macro, you must prefix them with ^P. (NOTE: To +make them easier to read and understand, Macro listings are given +here as they function, not as they are typed in. ^P prefixes as +needed are NOT shown. Keystrokes are separated by dashes or +commas for clarity, and "_" means a space or blank.) Here are some +sample Macros: + + 1. View a file by scrolling slowly through it: + + ESC-;, ^C + + This will pause, then scroll down. (Use a repeat count + of "*".) + + 2. Can you figure out what this one does? + + ^QR, ^QF, (, CR, ^G, ^KB, ^QF, ), CR, ^G, ^KK, ^QC, CR, ^KV + + (Answer: .elif eht fo dne eht ta meht fo tsil a gnikam + elif a fo tuo sesehtnerap ni stnemmoc ekat lliw tI) + + ZDE Macros are very powerful tools, particularly given their +programmability and storage on function keys. + +6.2. Macro Key (ESC-#, ESC-0..9). + + Up to 10 MACRO KEYS can be stored (0..9), by entering them +with the ESC-M command, then using ESC-# to save them. They can +then be recalled and used simply by typing ESC-number. Example: +typing ESC-#-0 will store the last Macro used in the ESC-0 command +so that it can be recalled and reused at any future time simply by +typing ESC-0. + Ordinarily, Macro Keys operate just like the original Macro, +asking for a "Repeat count" when executed. If you want to +suppress this prompt (resulting in a "function key" that executes +just once) you can type "N" (for No repeat) before storing the key +number. Example: ESC-#-N-0 makes ESC-0 a no-repeat macro key. +If you also don't need to see the Macro work, and want to make it +faster, you can make it QUIET as well by typing "Q" instead (for +Quiet) before the key number. Example: ESC-#-Q-0 stores ESC-0 as +a quiet no-repeat key sequence. + If the Macro (ESC-M) string is empty, using ESC-# will delete +a Macro Key. Using a defined Key makes it the last macro used, so +it can be stored again in another key if desired. Trying to use +an undefined Macro Key results in an error. + There are 500 bytes total available for all 10 keys, and a +128 byte limit for any one Key (ZDE's own input line will only +accept 65 bytes, but ZDENSTAL can handle up to the full 128.) + USAGE HINT: If you want to re-use a macro without having to +type it in again, use ESC-# to assign it to a key, then call it up +by number. + Besides simply storing Macros, here are some useful Macro +Keys: + + 1. Storing different sets of margins (e.g., for quotes). + For example, + ^OL, 12, CR, ^OR, 66, CR + + 2. Typing any frequently repeated phrase; "ESC-6" is much + more convenient than "^PSWorld Wide Widgets Ltd. (N.A.)^PS". + + 3. Swap the two characters preceding the cursor: + ^S, ^S, ^G, ^D, ^U, ^U, ^D, ^G + +[ZDENSTAL allows you to install defaults for all ten Macro Keys. +Thus a copy of ZDE can be customized for any task, such as the +formatting requirements of specialized writing or programming +languages.] + +6.3. Macro Programming (ESC-0..9, ESC-!,=,~,+,;). + + ZDE has several commands which function only in a Macro +string, and give you control over the execution of a macro, +allowing true programming. + ESC-0..9 function as LABELS 0..9 when entered as part of a +Macro. They have no effect, but can be "jumped" to by other +commands. + ESC-! followed by 0..9 is a JUMP instruction, and causes +macro execution to resume with the command following the label +ESC-0..9. Example: ESC!2 jumps to label 2. As two special cases, +ESC-![ jumps to the beginning of the Macro, and ESC-!] jumps to +the end (aborts). + ESC-= and ESC-~, followed by a character and then a label +0..9 (or "[","]"), are CONDITIONAL JUMPS: they jump to the label +or the start or end of the macro IF the character at the cursor +position matches (ESC-=) or doesn't match (ESC-~) the character +specified. Example: ESC~^M2 jumps to ESC-2 if the current +character is NOT a CR. + ESC-= and ESC-~, followed by a character and then ">" or "<", +are SEARCH LOOPS. They will continue to move the cursor right +(">") or left ("<") AS LONG AS the character at the cursor matches +(ESC-=) or doesn't match (ESC-~) the specified character. Both +search loops terminate automatically at the beginning or end of +the file. Example: ESC=_> moves right as long as the current +character is a space. + ESC-+, followed by 0..9, CHAINS to another macro key, +allowing you to build macros strings longer than the storage limit +of any one key. It does not "call" the key; there is no +returning. Example: ESC+9 chains to Key 9. + ESC-; (semicolon) gives a brief pause, presumably so the user +can see what's happening on screen. + Macro programs are stored just like any other macro string +(usually with "N"o repeat count). If you program in an endless +loop, you will at some point have to abort with ESC. Don't make +macro programs "Q"uiet until you're sure they work. + Example: here is a good macro program (best stored as a Quiet +Key) to move the cursor to the start of the current sentence: + + ESC~.1, ^S, ESC1, ESC~.<, ESC2, ^D, ESC=_2, ESC=^M2 + +You could write this out in programmer's pseudo-code as: + + If not "." goto label1 + Move left ;move left if already on period +label1: While not "." move Left ;move left to previous period +label2: Move right ;now move back right + If " " goto label2 ; as long as you see a space + If "^M" goto label2 ; or a Return + (all done) + + +7. General Information. + +7.1. Disk Space. + + ZDE isn't disk-bound; if you run out of disk space, just +insert another disk (always keep a blank FORMATTED disk around). +Alternatively, you can use the ESC-F and ESC-E commands to purge +unneeded files. [If you have small disks, you can also install +ZDE not to preserve BAK files.] + Let ZDE's filesize limits encourage you to break work up into +files of 50K or less; larger files make inefficient use of floppy +disks. + +7.2. Error Messages. + + Press ESC or Space to continue. "Error" alone means the +command used just won't work in this situation. (Example: a block +command was used with no block marked.) More specific errors are: + + "Out of Memory" - the file, block, or key string won't fit in + RAM. + "Invalid Key" - an illegal command key sequence was pressed. + "I/O Error" - file not found, disk full, empty/invalid + drive, etc. +"Cannot Reformat" - word too long, or margins invalid. + "Not Found" - the object of a search was not found. + "Syntax Error" - a macro programming command was misused. + +7.3. File Modes. + + ZDE has three FILE MODES: "W"ordStar document, "A"SCII +document, and "N"on-document. The basic difference concerns the +format of disk files. + In "W" mode, ZDE reads and writes WordStar-compatible files. +ZDE can edit a WordStar document, except that any right +justification will be lost. WordStar can edit any ZDE "W" file in +Document mode. + In "A" or "N" mode, ZDE reads and writes text as standard +ASCII 7-bit characters, a universal format accepted by virtually +all software. The only difference between "A" and "N" modes lies +in the default settings on loading a new file. Typically "A" mode +is used for word processing, and "N" mode for programming and +other technical applications. + +DEFAULTS FOR: Margins Tabs Hard CR disp. +------------ ------- ---- ------------ +"A"SCII or "W"ordStar mode ACTIVE VARIABLE [ON] +"N"on-document DISABLED HARD OFF + + The file mode option can be specified along with the filename +at any ZDE file function prompt, allowing you to mix WordStar and +ASCII disk files as needed (see Invoking ZDE, above). You can +also change the current mode with the ^K-N function by entering a +new mode (e.g., "[W") with or without a filename. + [ZDENSTAL allows you to select a default file mode, to be +used when no mode is specified (originally this is "A"). Further, +you can specify two filetype masks for automatic mode selection +(e.g., all "ASM" files as "N" mode) to override that default.] + NOTE ON ASCII FILES - The "A"SCII-document file format used +since VDE 2.50, to allow accurate formatting and WordStar +compatibility, distinguishes between HARD and SOFT CRs (see +Wordwrap, above). Consequently, if you edit an ASCII file created +by other software (including earlier versions of VDE), it may +appear to be full of hard CRs, making text impossible to reformat. +There are two easy ways to solve this problem: first, you can use +^Q-A to find "^M"s and selectively replace them with " ^M". +Alternatively, the following Macro (best stored as a Quiet macro +Key) does a good job of "softening up" paragraphs for reformatting: + + ^QS,^X,ESC=_],ESC=CR],^S,^V_^V,^D,ESC![ + +7.4. Hyphenation (^O-H). + + ZDE can't introduce hyphens, but it does recognize them in +the text, treating them as a legitimate place to break a line, so +if you have a long word close to the margin, you can insert a +hyphen where you'd like the word to be broken. + Similarly, ZDE can't unhyphenate. If it is trying to +reformat and finds a hyphen at the end of a line, it will pause to +ask you what to do with it. You will see the prompt "Chg?" in the +header, and can: + Press "Y" to remove the hyphen and space, joining the word; + "N" to leave the hyphen, but still join the word; + "ESC" to leave both the hyphen and the space alone. +Typically you would choose "Y" for "soft" hyphens that you +introduced to break up a word ("intro-duction"); "N" for hard +hyphens that are part of a word ("vis-a-vis"); and "ESC" for +punctuation (dashes "--", etc.). After your choice, reformatting +will proceed automatically. + You can toggle hyphenation on and off with ^O-H. If off, +hyphens are not treated differently from any other text character. +[The ^O-H default can be changed with ZDENSTAL.] + +7.5. Interruption. + + If ZDE is interrupted by messages from other software (BIOS +error, resident utilities, etc.), it may lose control of the +screen. The best way to return it to normal is by blanking and +restoring the screen (^O-Z, ESC). + +7.6. Prompts. + + First, ZDE has several simple prompts requiring you to +confirm an action by typing "Y" or "N": + + "Abandon changes?" - warns the file you want to Quit has + been changed. +"Unchanged; save anyway?" - reminds the file you want saved isn't + changed. + "Delete original?" - do you want to delete block copied + from 2nd file? + "Chg?" - do you want to change this instance of + a string? + +Then, there are a few special purpose prompts: + + "Repeat count:" - enter (optional "Q" and) repeat count + for Macro. + "Key number:" - enter (optional "N/Q" and) key number + for Key. + "Rdy" - press any key to print next page (ESC + quits). + +Finally, there are a variety of prompts for either numeric or +string input, like "Column:" or "Find string:". You are expected +to type in a string (up to 65 characters). The following control +keys operate: + + Correct mistake: BS (^H), ^S, or Del + Erase entire entry: ^X + Abort operation: ^U + +Note that to get any of these codes, or a CR, into the string +itself, you must precede it with ^P (this includes ^P). Examples: +to find a line beginning with a "*" (find "^M,*") type + + ^Q-F, ^P-CR, *, CR. + +Now to get this into a Macro with ESC-M, you would have to type + + ESC-M, ^Q-F, ^P-P, ^P-CR, *, ^P-CR, CR. + +7.7. WordStar Compatibility. + + In most respects ZDE operates much like WordStar; one big +difference is the absence of a "No-File" menu. You are always in +edit mode; use ^K-L to select a new file to edit. + If the keys ^J, ^K, ^L are in use as CP/M arrow keys, you +must use ZDE's original command set to substitute for them as +follows: + + Block prefix (^K-)... ESC- + Help menu (^J)....... ESC-H + Repeat find (^L)..... ^\ + + If these keys are NOT installed as arrow keys, they retain +their WordStar functions. Then, of course, ZDE lacks some +WordStar commands, and has some of its own. Aside from these, +there are the following differences in common commands: + +COMMON USE WORDSTAR 4 ZDE ZDE NOTES +Hide block ^K-H ^K-U Actually unmarks block. +Erase disk file ^K-J ^K-E +Set Place Mark ^K-0..9 ^P-Z Not individually numbered. +Go to Place Mark ^Q-0..9 ^Q-P Cyclic. + +COMMON COMMAND WORDSTAR 4 USE ZDE USE + ^^ Soften hard CR Transpose upper/lowercase + ^K-N Column block mode Rename current work + ^O-D Display ^P codes Display hard CRs + ^O-F Ruler from text Flush right + ^O-P Preview mode Page length + ^Q-U Repeat align Repeat undelete + +Note that ZDE does not implement WordStar "dot commands" in text, +though in "W" mode it avoids printing them. + + +8. Disclaimer. + + You use ZDE at your own risk. The author accepts no +liability for any damages resulting from its use or misuse. +Direct problem reports and suggestions to the author; include a +stamped return envelope for a reply if desired. Thanks to the +many users of ZDE whose feedback has led to improvements and bug +fixes in the past. + + Carson Wilson Sysop: Antelope Freeway RAS + 1359 W. Greenleaf 312-764-5162, Chicago + Chicago, IL 60626 24 hours, 3-12-2400 baud diff --git a/Source/Images/Common/ZDENST.COM b/Source/Images/Common/All/ZDENST.COM similarity index 100% rename from Source/Images/Common/ZDENST.COM rename to Source/Images/Common/All/ZDENST.COM diff --git a/Source/Images/Common/All/ZMRX.COM b/Source/Images/Common/All/ZMRX.COM new file mode 100644 index 00000000..19f317b1 Binary files /dev/null and b/Source/Images/Common/All/ZMRX.COM differ diff --git a/Source/Images/Common/All/ZMTX.COM b/Source/Images/Common/All/ZMTX.COM new file mode 100644 index 00000000..d512481a Binary files /dev/null and b/Source/Images/Common/All/ZMTX.COM differ diff --git a/Source/Images/Common/CLRDIR.COM b/Source/Images/Common/CLRDIR.COM deleted file mode 100644 index c6b05cc9..00000000 Binary files a/Source/Images/Common/CLRDIR.COM and /dev/null differ diff --git a/Source/Images/Common/COMPARE.COM b/Source/Images/Common/COMPARE.COM deleted file mode 100644 index 29fa41e6..00000000 Binary files a/Source/Images/Common/COMPARE.COM and /dev/null differ diff --git a/Source/Images/Common/CPM22/KERCPM22.COM b/Source/Images/Common/CPM22/KERCPM22.COM new file mode 100644 index 00000000..e4d91f7c Binary files /dev/null and b/Source/Images/Common/CPM22/KERCPM22.COM differ diff --git a/Source/Images/Common/CPM3/KERCPM3.COM b/Source/Images/Common/CPM3/KERCPM3.COM new file mode 100644 index 00000000..26d1b3fa Binary files /dev/null and b/Source/Images/Common/CPM3/KERCPM3.COM differ diff --git a/Source/Images/Common/CPM3/RZ.COM b/Source/Images/Common/CPM3/RZ.COM new file mode 100644 index 00000000..b0767674 Binary files /dev/null and b/Source/Images/Common/CPM3/RZ.COM differ diff --git a/Source/Images/Common/CPM3/RZSZ.FOR b/Source/Images/Common/CPM3/RZSZ.FOR new file mode 100644 index 00000000..a4f35f68 --- /dev/null +++ b/Source/Images/Common/CPM3/RZSZ.FOR @@ -0,0 +1,23 @@ +19 Jun 92 5:21p + +CP/M 3 only +sz / rz are a pair of programs send or receive files in X/Y/ZModem +protocol. The function is like the wellknown UNIX tools. +The only condition: a modem (nullmodem) is connected to the AUX device. + +get help with sz -? or rz -? + +Abort of transfer by pressing esc key or by the partner at the other +side corresponding the protocol used. It may take a few seconds until +sz/rz terminates. +Z3PLUS named directory is suported. +The actual versions in this library are sz v1.11, rz v1.04 +CRC made with crcz11.com + +Have fun, Wilfried + +Wilfried Schmitten wshbg@mcshh.hanse.de +Heidebloeck 16 +2000 Hamburg 74 +Germany +  \ No newline at end of file diff --git a/Source/Images/Common/CPM3/SZ.COM b/Source/Images/Common/CPM3/SZ.COM new file mode 100644 index 00000000..e905002b Binary files /dev/null and b/Source/Images/Common/CPM3/SZ.COM differ diff --git a/Source/Images/Common/FDISK80.COM b/Source/Images/Common/FDISK80.COM deleted file mode 100644 index 00ac10f7..00000000 Binary files a/Source/Images/Common/FDISK80.COM and /dev/null differ diff --git a/Source/Images/Common/FLASH.COM b/Source/Images/Common/FLASH.COM deleted file mode 100644 index 1b7fa64c..00000000 Binary files a/Source/Images/Common/FLASH.COM and /dev/null differ diff --git a/Source/RomDsk/SIMH/HDIR.COM b/Source/Images/Common/SIMH/HDIR.COM similarity index 100% rename from Source/RomDsk/SIMH/HDIR.COM rename to Source/Images/Common/SIMH/HDIR.COM diff --git a/Source/RomDsk/SIMH/R.COM b/Source/Images/Common/SIMH/R.COM similarity index 100% rename from Source/RomDsk/SIMH/R.COM rename to Source/Images/Common/SIMH/R.COM diff --git a/Source/RomDsk/SIMH/RSETSIMH.COM b/Source/Images/Common/SIMH/RSETSIMH.COM similarity index 100% rename from Source/RomDsk/SIMH/RSETSIMH.COM rename to Source/Images/Common/SIMH/RSETSIMH.COM diff --git a/Source/RomDsk/SIMH/TIMER.COM b/Source/Images/Common/SIMH/TIMER.COM similarity index 100% rename from Source/RomDsk/SIMH/TIMER.COM rename to Source/Images/Common/SIMH/TIMER.COM diff --git a/Source/Images/d_bp/u0/URL.COM b/Source/Images/Common/SIMH/URL.COM similarity index 100% rename from Source/Images/d_bp/u0/URL.COM rename to Source/Images/Common/SIMH/URL.COM diff --git a/Source/RomDsk/SIMH/W.COM b/Source/Images/Common/SIMH/W.COM similarity index 100% rename from Source/RomDsk/SIMH/W.COM rename to Source/Images/Common/SIMH/W.COM diff --git a/Source/Images/Common/Z/u14/LBREXT36.CFG b/Source/Images/Common/Z/u14/LBREXT36.CFG new file mode 100644 index 00000000..0f6c430d Binary files /dev/null and b/Source/Images/Common/Z/u14/LBREXT36.CFG differ diff --git a/Source/Images/d_bp/u14/ZXD.CFG b/Source/Images/Common/Z/u14/ZXD.CFG similarity index 100% rename from Source/Images/d_bp/u14/ZXD.CFG rename to Source/Images/Common/Z/u14/ZXD.CFG diff --git a/Source/Images/d_bp/u0/LBREXT.COM b/Source/Images/Common/Z/u15/LBREXT.COM similarity index 100% rename from Source/Images/d_bp/u0/LBREXT.COM rename to Source/Images/Common/Z/u15/LBREXT.COM diff --git a/Source/Images/d_bp/u0/ZXD.COM b/Source/Images/Common/Z/u15/ZXD.COM similarity index 100% rename from Source/Images/d_bp/u0/ZXD.COM rename to Source/Images/Common/Z/u15/ZXD.COM diff --git a/Source/Images/Common/Z3/u10/SCOPY.HLP b/Source/Images/Common/Z3/u10/SCOPY.HLP new file mode 100644 index 00000000..2d430bbd --- /dev/null +++ b/Source/Images/Common/Z3/u10/SCOPY.HLP @@ -0,0 +1,53 @@ +; + SCOPY.COM  + + Size (recs) CRC Version Author/Latest Issue Disk + 18k (141) 62B8 1.0f Lars Nelson 7/21 + 15k (120) D6DB 0.8 Rob Friefeld 10/91 Z3COM19 + + 1- Syntax 2- SCOPY Commands 3- Notes  + + Screen Copy is a screen-oriented file copy utility for ZCPR3 and Z3PLUS. +It displays both the source and destination directories in vertical windows +and uses copy commands much like ZFILER's. It also has extensive support for +file datestamping with commands to select and copy files by date. It is not +intended to be a comprehensive file-management tool like ZFILER or DATSWEEP. + + SCOPY requires an extended TCAP and will not work without Insert/Delete +Line and Clear to End of Screen. It also makes optional use of cursor on/off, +line graphics, and character attributes (to underline a file name character +with its attribute set.) +:1 + Syntax  SCOPY [mask] [dest dir:] + + If only one DIR is given, it is the target directory, and the currently +logged DIR is the source directory. If two directories are given, the source +is the first one. The optional MASK is automatically wildcarded. + + Example: These three are equivalent -- + + ( source: work: B0:WORK>scopy backup:x.c or, +destination: backup: B0:WORK>scopy x.c backup: or, + mask: x*.c?? ) B0:WORK>scopy work:x.c backup: + + B0:SCOPY X --> Error: Scr=Dest + + File operations are bi-directional, so it doesn't matter which is the +master and which is the target directory. + + When re-logging from within SCOPY, the syntax has the same meaning, but +remember that you will not necessarily be currently logged into the same +directory as at startup. +:2 :SCOPY10F +:3 + SCOPY Notes  + + a. Z3PLUS Users: This version of SCOPY does copy file datestamps. + Also copies datestamps under ZSDOS/ZDDOS and DateStamper. + + b. HINT: Set up SCOPY's query options to allow you to safely play with the + new date selection methods. You will be able to see on screen what + SCOPY intends to do, but can bail out at the prompt before anything + happens. The easiest way to do this is to Ask For Verification. A ^C + at the Y/N prompt will cancel the command. + \ No newline at end of file diff --git a/Source/Images/Common/Z3/u10/SCOPY10F.HLP b/Source/Images/Common/Z3/u10/SCOPY10F.HLP new file mode 100644 index 00000000..49d09ca6 --- /dev/null +++ b/Source/Images/Common/Z3/u10/SCOPY10F.HLP @@ -0,0 +1,369 @@ +; +======= S C O P Y H E L P ======= + + 1 Copy Move Delete Rename Kompare Quick Set + + 2 Jump ReJump Jump Tag Jump Untag Jump One Jump Two + + 3 Tag Untag Retag Wild Tag + + 4 View + + 5 GROUP Arc Copy Del Move View Kompare Quick Set + + 6 GROUP Equate New + + 7 Cursor + + 8 Options + + 9 Miscellaneous Log Relog New Switch Execute Command +:1 + +C Copy - Send file at pointer to other directory. An arrow at + the top of the screen shows the copy direction. Copying is + controlled by verification flags described below. If there is + inadequate space on the destination disk, the copy is not + attempted, and (for Group operations) the file remains tagged. + +D Delete - Delete file at pointer. + +M Move - Copy, then delete source file. + +R Rename + Rename does not integrate too well with SCOPY's method of file + display. In fact, the display may become useless. Therefore + SCOPY requires a Relog before any copy operations are allowed + following a Rename. + + If an Archived file is renamed, the archive attribute is reset. + (Ditto the Public attribute.) + + ...more + + +Q Quick Copy - Copy current file to alternate directory. Saves + you the trouble of logging in the alternate directory. Quick + Copy bypasses any checks against the destination date stamp + or disk capacity. It is fast, but you don't get the full + benefit of Login. + + +K Kompare - Do a byte for byte comparison of source and + destination files, report the result on the screen divider as + "=" or "~". For Group Kompare, you may then retag files which + tested either equal or unequal. + + +S Set Attributes - Set or clear F1, F3, F4, W/P, R/O, SYS, and + ARC attributes in any combination: + Set: 1,3,4,W,R,S,A Clear: -1,-3,-4,-W,-R,-S,-A +:2 + +JUMP COMMANDS: + +J Jump - Find the next match to the mask entered. The mask is + automatically wildcarded. + +^J, H ReJump - Use the same mask. (^J will not work if your TCAP + defines it as an arrow key. Use H (Hop) instead.) + +1 Jump One - Go to next file which exists only in current + directory. + +2 Jump Two - Go to next file which exists in both directories. + +` Jump Tagged - Go to next tagged file. + +~ Jump Untagged - Go to next untagged file. +:3 + +T Tag - Mark a file for a Group operation. Group Tag tags all files + from the pointer to the end of the list. + +U Untag - Cancels a tag. Group Untag untags all files from the + pointer to the end of the list. + +Y Retag - When a Group operation runs through the tagged file + list, the files are "soft" tagged. This command retags them. + +GR Group Reverse - Reverses the tags on all files. + + + ...more + +WILD COMMAND + + (W)ild Tag/ Untag/ New/ 1/ 2 MASK DATESPEC + + Select a fileset for a Group operation by comparing the + directory to a Mask and/or Datespec, and: + + 1. (T)ag all matches + 2. (U)ntag all matches + 3. (N)ew - Tag match only if the source version is Newer. + 4. (1) -Tag match if it exists in 1 directory only. + 5. (2) -Tag match if it exists in 2 directories. + + "Newness" is determined by comparing the two + Modify dates if possible. If there is no Modify + date for one of the files, its Create date is + used. If neither is valid, the file is not + tagged. The command has no effect on unstamped + disks or systems. Note that one file's Modify + date could be compared to the other file's Create + date (if it has no Modify date.) + + + Wild commands ask for an optional Mask (automatically + wildcarded) and an optional Datespec. The datespec is + compared to the Modify date or, if there is none, to the + Create date. Access date is not used. + + The datespec format is: + + [/C]<, >, or =date[ time] + + Where: + /C Forces comparison to Create date ONLY + < > = Mandatory date signifier (how to use date) + date dd.mm.yy (any part omitted = the current date) + date mm/dd/yy (alternate format) + time hh:mm (any part omitted is ignored) + + Wildcard characters "?" or "*" are allowed in date, time. + + Examples: + <1.9 Selects all modified before 1 Sept this year + = All modified today + >.. 13:00 All modified after 1pm today + /c=* All created any day this month + + European style date format is the default if the date parser + is unable to determine which one you are using. "xx" will be + taken to mean "dd". "xx/" means "mm". + + Some mask and/or date spec must be given, or the Wild command + cancels. You can use a single "." or "*" to test everything. + + WILD Examples: + + WN. + Tag everything in the source dir newer than an existing + file in the destination. + + W2= + Tag all files modified today in the source directory which + also exist in the destination directory. + + WTs /c>.. 10 + Tag all S*.* created after 10AM today. +:4 +V - View + + The main viewer commands are shown highlighted on the bottom + screen line. All viewer functions are controlled with the + left hand. These are: + + F - Next screen + A - Previous screen + T - Top screen + B - Bottom screen + R - Read more file if too big for available buffer + G - GoTo string up to 20 characters. "?" is wild char. + H - Repeat GoTo on same string. Same as G + X - Done with this file. Group View goes on to next file. + S - Scroll continuously forward until a keypress + D - Reverse scroll. + + ...more + + +V - View + + Commands NOT shown while viewing are: + + Next line + - Previous line + Next screen (synonym for Forward) + Hop forward 10 lines + ^C Abort loop (Group View) +:5 +GROUP COMMANDS: + +Group commands operate on tagged files, proceeding from file to +file. To cancel a group operation, press ^C. + + +GA Archive - Copy only tagged files which do NOT have the archive + attribute set, then set the source archive attribute. + +GC Copy Automates single file command. +GD Delete +GM Move +GV View +GK Kompare May retag all equal or unequal files after comparison. +GQ Quick +GS Set Attributes +:6 + +GE - Group Equate + +Copy all tagged files which do not exist in the destination +directory, OR whose datestamp (including the time) is different +from the target file datestamp. Group Equate is equivalent to +copying every tagged file from the source to the destination, but +it does not waste time copying files which are presumably the +same. (The files may not actually BE the same in the case of a +copy error, bad disk sector, faulty clock, etc. If you +suspect you can't trust the datestamps, use GC - Group Copy.) + +Group Equate insists that both Create and Modify fields of the +datestamp be identical. The dates are not checked for validity, +however. (A file does not _have_ to have a valid Modify date.) +If both files have null datestamps, GE will untag. + + ...more + + +GN - Group New + +Copy all tagged files which do not exist in the destination, OR +whose datestamp is newer than the target file datestamp. This +command UPDATES the destination. + +If any dates aren't valid, then a file flunks this test and is +untagged. + + Summary: + + GROUP EQUATE is intended for restoring a directory from + older backup files. GROUP NEW is for updating a directory + with newer files. WILD selects a file set by name and + date criteria for the Group commands to act on. +:7 +FILE POINTER MOVEMENTS: + + + SCREEN Arrow Keys and WS Diamond + ^R - Top Line Up ^E, Up + ^C - Bottom ^ + +,^F - Next ^S Prev File < + > Next File ^D + -,^A - Prev v + FILE Line Down ^X + ^T - Top + ^B - Bottom + CR,SP - Next + BS - Prev + +Note that cursor commands are available to jump to the next FILE +in the current window () or to the next LINE of the display +(^X). The directory displays are interleaved, so there could be +many blank lines in one directory between files entries. + +See also Jump commands. +:8 +O - Options Menu + +Datestamp Oriented Options: + + A. replace by date If Yes, D-F are ignored, else B-C ignored + B. older replace query + C. newer/equal replace query If No query, copy is NOT made. + + Use these options if A. is NO, or the file datestamp is invalid. + D. single replace query + E. group replace query + F. archive replace query + +A. Replace by Date - If Yes, the next two options are operative. + If No, they are ignored. Quick Copy ignores Replace by Date. + +B. Older Replace - Ask before replacing an older file. + +C. Newer/ Equal Replace - Ask before replacing a newer file. You + usually won't want to. Therefore, if this option is set to + NO, the copy does NOT occur. + + + + +If the dates compared aren't valid, then date replace queries +are skipped and fall back on options D-F. SCOPY would then +work like ZFILER for systems/disks without datestamps. + +******** + HINT: Set up SCOPY's query options to allow you to safely + play with the new date selection methods. You will be able to + see on screen what SCOPY intends to do, but can bail out at + the prompt before anything happens. The easiest way to do + this is to Ask For Verification. A ^C at the Y/N prompt will + cancel the command. Files will remain tagged. +******** + + ...more + +G. Verify Query - Ask whether or not to do CRC verification. + +H. Verify Default - If not queried, do CRC verification? + +I. Supress SYS Files - Only takes effect when logging in. + +J. Set Copied File Attributes - Destination file attributes are + cleared unless this option is Yes. + +K. Use Destination Attributes - IF previous option is Yes, use + existing destination attributes on copy, else use source. + +L. Archive Destination - Used when copying files to a work area, + such as a RAM disk. The Group Archive command can then + conveniently move any files you altered back to permanent + storage when you are done. + +M. Show File Attributes - SCOPY uses the extended TCAP SETATR + function to underline filename characters to represent a file + attribute set. This is unobtrusive, but doesn't give good + results on all terminals. SCOPY can be configured to show set + attributes in upper case, or you can just turn the display off. +:9 +L Login - Relog SCOPY with new command line, using the same + syntax as on initial callup. As a convenience, the ":" is + optional following a DIR reference. Note that if you name + only one directory, the current directory is assumed to be + the source, and it is the other directory which changes. + Login does not preserve the old file mask. + +N New DIR - Change the current directory only, same mask. + + Relog - Logs the same directories with the same file mask + You may want to Relog after renaming files, after file + deletions have left big holes in the file list, or when + changing floppy disks during a backup operation. + +TAB - Switch copy direction. + +Z - Command line. Run a Z-System command, and reinvoke SCOPY when + done. The command is run from the original DU: in which SCOPY + was invoked. (This function requires an XFCB and User Reg 21.) + + +IMPORTANT NOTE: SCOPY requires an extended TCAP 4D which includes + Insert/Delete line, and Clear to End of Screen. If available, + it uses cursor on/off, line graphics, and character attributes. + + + + + SCOPY, Version 1.0F + + Copyright 1992 by Rob Friefeld. All rights reserved. + +May not be sold, either alone or as part of a commercial product, +without the prior written consent of the author. May be +distributed among users at nominal cost of media. + +Rob Friefeld +4607 Colorado Street +Long Beach, CA 90814 +(310) 434-7338 voice + \ No newline at end of file diff --git a/Source/Images/Common/Z3/u14/SCOPY10F.CFG b/Source/Images/Common/Z3/u14/SCOPY10F.CFG new file mode 100644 index 00000000..f6ade5ef Binary files /dev/null and b/Source/Images/Common/Z3/u14/SCOPY10F.CFG differ diff --git a/Source/Images/Common/Z3/u15/SCOPY.COM b/Source/Images/Common/Z3/u15/SCOPY.COM new file mode 100644 index 00000000..8bcf1632 Binary files /dev/null and b/Source/Images/Common/Z3/u15/SCOPY.COM differ diff --git a/Source/Images/d_bp/u0/NZDEC23D.Z3T b/Source/Images/Common/Z3/u15/TCAP.Z3T similarity index 100% rename from Source/Images/d_bp/u0/NZDEC23D.Z3T rename to Source/Images/Common/Z3/u15/TCAP.Z3T diff --git a/Source/Images/d_bp/u15/TCSEL32.COM b/Source/Images/Common/Z3/u15/TCSELECT.COM similarity index 100% rename from Source/Images/d_bp/u15/TCSEL32.COM rename to Source/Images/Common/Z3/u15/TCSELECT.COM diff --git a/Source/Images/d_bp/u15/TCVIEW.COM b/Source/Images/Common/Z3/u15/TCVIEW.COM similarity index 100% rename from Source/Images/d_bp/u15/TCVIEW.COM rename to Source/Images/Common/Z3/u15/TCVIEW.COM diff --git a/Source/Images/d_nzcom/u0/Z3LOC.COM b/Source/Images/Common/Z3/u15/Z3LOC.COM similarity index 100% rename from Source/Images/d_nzcom/u0/Z3LOC.COM rename to Source/Images/Common/Z3/u15/Z3LOC.COM diff --git a/Source/Images/Common/Z3/u15/Z3TCAP.LBR b/Source/Images/Common/Z3/u15/Z3TCAP.LBR new file mode 100644 index 00000000..ae7afa22 Binary files /dev/null and b/Source/Images/Common/Z3/u15/Z3TCAP.LBR differ diff --git a/Source/Images/Common/ZDE.COM b/Source/Images/Common/ZDE.COM deleted file mode 100644 index f58310ba..00000000 Binary files a/Source/Images/Common/ZDE.COM and /dev/null differ diff --git a/Source/Images/Makefile b/Source/Images/Makefile index 4832dc37..fc442282 100644 --- a/Source/Images/Makefile +++ b/Source/Images/Makefile @@ -1,56 +1,89 @@ # -# this makefile subsumes all the work done in Build.cmd, Build{Hd,Fd}.* +# this makefile subsumes all the work done in Build.cmd, BuildDisk.cmd, BuildDisk.ps1 # -SYSTEMS = ../CPM22/cpm_wbw.sys ../ZSDOS/zsys_wbw.sys ../CPM3/cpmldr.sys +SYSTEMS = ../CPM22/cpm_wbw.sys ../ZSDOS/zsys_wbw.sys ../CPM3/cpmldr.sys ../ZPM3/zpmldr.sys -FDIMGS = fd_cpm22.img fd_zsdos.img fd_nzcom.img \ - fd_cpm3.img fd_zpm3.img fd_ws4.img -HDIMGS = hd_cpm22.img hd_zsdos.img hd_nzcom.img \ - hd_cpm3.img hd_zpm3.img hd_ws4.img -# HDIMGS += hd_bp.img +FDIMGS = fd144_cpm22.img fd144_zsdos.img fd144_nzcom.img \ + fd144_cpm3.img fd144_zpm3.img fd144_ws4.img fd144_qpm.img +HD512IMGS = hd512_cpm22.img hd512_zsdos.img hd512_nzcom.img \ + hd512_cpm3.img hd512_zpm3.img hd512_ws4.img +# HDIMGS += hd512_bp.img +HD1KIMGS = hd1k_cpm22.img hd1k_zsdos.img hd1k_nzcom.img \ + hd1k_cpm3.img hd1k_zpm3.img hd1k_ws4.img +# HD1KIMGS += hd1k_bp.img -OBJECTS = $(FDIMGS) $(HDIMGS) hd_combo.img -OTHERS = blank144 blankhd +HD512PREFIX = +HD1KPREFIX = hd1k_prefix.dat + +OBJECTS = $(FDIMGS) +OBJECTS += $(HD512IMGS) hd512_combo.img hd512_dos65.img hd512_qpm.img$(HD512PREFIX) +OBJECTS += $(HD1KIMGS) hd1k_combo.img hd1k_qpm.img $(HD1KPREFIX) + +OTHERS = blank144 blankhd512 blankhd1k + +NODELETE = $(HD512PREFIX) $(HD1KPREFIX) DEST=../../Binary TOOLS = ../../Tools include $(TOOLS)/Makefile.inc +.SHELLFLAGS = -ce + DIFFPATH = $(DIFFTO)/Binary -hd_combo.img: $(HDIMGS) - cat $(HDIMGS) > $@ +hd512_combo.img: $(HD512PREFIX) $(HD512IMGS) + cat $^ > $@ + +hd1k_combo.img: $(HD1KPREFIX) $(HD1KIMGS) + cat $^ > $@ # # this somewhat impenetrable and fragile code is used to build each of the images # at build time, a few variables are set (sys, fmt, type, size, d) based on the # target to build. first, we build an empty image using the a tr, dd pipeline. # we then scan the d_{d}/u* directories, copying in files to user numbers -# then process the d_{d}.txt file, copying in those files, and finally maybe put +# then process the ?d_{d}.txt file, copying in those files, and finally maybe put # an OS at the start of each image # + +FDSIZE := 1440 + blank144: - @echo Making Blank Floppy of size 1440k - @LANG=en_US.US-ASCII tr '\000' '\345' /dev/null + @echo Making Blank Floppy of size $(FDSIZE)k + @LC_ALL=en_US.US-ASCII tr '\000' '\345' /dev/null +blankhd512: + @echo Making Blank HD512 of size $(HD512SIZE)k + @LC_ALL=en_US.US-ASCII tr '\000' '\345' $$i.ls ; \ - $(BINDIR)/cpmls -i -f $$fmt $(DIFFPATH)/$$i > $$i.diff.ls ; \ - done \ + +clean:: + @rm -f *.ls + +imgdiff: + @for i in $(FDIMGS) $(HD512IMGS) $(HD1KIMGS) ; do \ + echo $$i ; \ + if echo $$i | grep -q ^fd144_ ; then \ + fmt=wbw_fd144 ; \ + fi ; \ + if echo $$i | grep -q ^hd512_ ; then \ + fmt=wbw_hd512 ; \ + fi ; \ + if echo $$i | grep -q ^hd1k_ ; then \ + fmt=wbw_hd1k ; \ + fi ; \ + $(BINDIR)/cpmls -i -f $$fmt $$i > $$i.ls ; \ + $(BINDIR)/cpmls -i -f $$fmt $(DIFFPATH)/$$i > $$i.diff.ls ; \ + done \ diff --git a/Source/Images/ReadMe.txt b/Source/Images/ReadMe.txt index fb4338e2..cdbe2927 100644 --- a/Source/Images/ReadMe.txt +++ b/Source/Images/ReadMe.txt @@ -7,7 +7,7 @@ *********************************************************************** This directory contains a toolset for RomWBW that builds floppy and -hard disk media images that can be used on RomWBW by writing the +hard disk media images that can be used with RomWBW by writing the image to a floppy or hard disk (including CF and SD cards). In summary, CP/M files are placed inside of a pre-defined Windows @@ -47,29 +47,38 @@ structure. The structure is: | . +--> u15 -A given disk is reprsented by a directory named d_xxx where xxx can +A given disk is represented by a directory named d_xxx where xxx can be anything you want. Within the d_xxx directory, the CP/M user -areas are represented by subdirectories names u0 thru u15. The files +areas are represented by subdirectories named u0 thru u15. The files to be placed in the disk image are placed inside of the u0 thru u15 directories depending on which user area you want the file(s) to appear. You do not need to create all of the u## subdirectories, only the ones corresponding to the user areas you want to put files in. -To build the disk images, you run the Build.cmd batch file from a -command prompt. Build.cmd in turn invokes separate scripts to create -the floppy and hard disk images. +To build all the disk images, you run the Build.cmd batch file from a +command prompt. Build.cmd in turn invokes a separate script to create +each floppy and hard disk image. As distributed, you will see that there are several d_ directories -populated with files. If you look at the Build.cmd -script, you will find that the names of each of these directories is -listed. If you want to add a new d_ directory to be converted into a -disk image, you will need to add the name of your new directory to -this list. Note that each d_ directory may be turned into a floppy -image or a hard disk image or both. - +populated with files. If you look at the Build.cmd script, you will +find that the names of each of these directories is listed. If you +want to add a new d_ directory to be converted into a disk image, you +will need to add the name of your new directory to this list. Note +that each d_ directory may be turned into a floppy image or a hard +disk image or both. + At present, the scripts assume that the floppy media is 1.44MB. You will need to modify the scripts if you want to create different media. +The resultant disk images (.img files) can be written to the start of +a disk using your Windows/Linux/Mac computer and will then be usable +in your RomWBW computer. On Windows, you can use Win32DiskImager to +do this (see Tools\Win32DiskImager). On Linux/Mac, you can usee dd. + +WARNING: The hd1k disk images must be prefixed by the +hd1k_prefix.dat file before being written to your target media. +See the Hard Disk Formats section below for more information. + Building the Images ------------------- @@ -81,23 +90,45 @@ included in the distribution under the Tools directory. Many of the disk images depend upon files that are produced by building the shared components of RomWBW. Prior to running the Build command in the Images directory, you should first -run the BuildShared command in the Source directory. +run the BuildShared command in the Source directory. This produces +several files that are prerequisites for creating the disk images. The scripts are intended to be run from a command prompt. Open a command prompt and navigate to the Images directory. Use the command "Build" to build both the floppy and hard disk images in one run. -You can build a single disk image by running either BuildFD.cmd or -BuildHD.cmd with a single parameter specifying the disk name. +You can build a single disk image by running BuildDisk.cmd: + + BuildDisk [] + +where: + + specifies the disk contents (e.g., "cpm22") + specifies disk type ("fd" for floppy, or "hd" for hard disk) + specifies the disk format which must be one of: + - "fd144": 1.44M floppy disk + - "hd512": hard disk with 512 directory entries + - "hd1k": hard disk with 1024 directory entries + optionally specifies a boot system image to place in the + system tracks of the disk (e.g., "..\cpm22\cpm_wbw.sys" + +For example: + + | BuildDisk.cmd cpm22 hd wbw_hd512 ..\cpm22\cpm_wbw.sys + +will create a hard disk image (512 directory entry format) with the +CP/M 2.2 files from the d_cpm22 directory tree and will place the +CP/M 2.2 system image in the boot system tracks. After completion of the script, the resultant image files are placed -in the Binary directory with names such as fd_xxx.img and hd_xxx.img. +in the Binary directory with names such as fd144_xxx.img, hd512_xxx.img, +and hd1k_xxx.img. Sample output from running Build.cmd is provided at the end of this file. -Be aware that the script always builds the image file from scratch. +Be aware that the script always builds the image files from scratch. It will not update the previous contents. Any contents of a -pre-existing image file will be permanently destroyed. +pre-existing image file will be overwritten. Slices ------ @@ -114,19 +145,73 @@ independent CP/M drives. The disk image creation scripts in this directory will only create a single CP/M file system (i.e., a single slice). However, you can easily create a multi-slice disk image by merely concatenating -multiple images together. For example, if you wanted to create a 2 -slice disk image that has ZSDOS in the first slice and Wordstar in +multiple images together (the 1024 directory entry format requires a +prefix file, see below). For example, if you wanted to create a 2 +slice disk image that has ZSDOS in the first slice and WordStar in the second slice, you could use the following command from a Windows command prompt: - | C:\RomWBW\Binary>copy /b hd_zsdos.img + hd_ws.img hd_multi.img + | C:\RomWBW\Binary>copy /b hd512_zsdos.img + hd512_ws4.img hd_multi.img You can now write hd_multi.img onto your SD or CF Card and you will have ZSDOS in the first slice and Wordstar in the second slice. -The concept of slices applies ONLY to hard disks. Floppy disks are +The concept of slices applies only to hard disks. Floppy disks are not large enough to support multiple slices. +Hard Disk Formats +----------------- + +RomWBW supports two hard disk formats: the original format used by +RomWBW with 512 directory entries per slice and a new format with +1024 directory entries per slice. These formats are referred to as +hd512 and hd1k respectively. You will note that filenames start +with either hd512_ or hd1k_ to indicate the hard disk format. + +WARNING: You **can not** mix the two hard disk formats on one hard +disk device. You can use different formats on different hard disk +devices in a single system though. + +RomWBW determines which of the hard disk formats to use for a given +hard disk device based on whether there is a RomWBW hard disk +partition on the disk containing the slices. If there is no RomWBW +partition, then RomWBW will assume the 512 directory entry format for +all slices and will assume the slices start at the first sector of +the hard disk. If there is a RomWBW partition on the hard disk +device, then RomWBW will assume the 1024 directory entry format for +all slices and will assume the slices are located in the defined +partition. You cannot mix the hard disk formats on a single disk +device. + +WARNNG: The hd1k_xxx.img files (not hd1k_combo.img) **must** be +prefixed by a partition table before being written to your disk media. +The hd1k_prefix.dat file is provided for this. The hd1k_prefix.dat +defines the required partition table. Any number of hd1k slice images +can be concatenated after the prefix. For example, to make the +hd1k_cpm22.img file ready to write to your media, you would need to do +something like this: + + | C:\RomWBW\Binary>copy /b hd1k_prefix.dat + hd1k_cpm22.img hd_cpm22.img + +and then use the resulting hd_cpm22.img to write to the target media. + +For example, if you wanted to create a 2 slice disk image using the +hd1k entry format that has ZSDOS in the first slice and Wordstar in +the second slice, you could use the following command from a Windows +command prompt: + + | C:\RomWBW\Binary>copy /b hd1k_prefix.dat + hd1k_zsdos.img + hd1k_ws4.img hd_multi.img + +Since the hd512 format does not utilize a partition, you do not +prefix the hd512_xxx.img files with anything. You can simply +concatenate the desired hd512_xxx.img files together and write the +resulting file to the start of your hard disk media. + +In general, the hd1k format is considered the preferred format to use. +It provides double the directory space and places all slices inside +of a hard disk partition that DOS/Windows should respect as "used" +space. + Disk Images ----------- @@ -134,328 +219,297 @@ The standard RomWBW build process builds the disk images defined in this directory. The resultant images are placed in the Binary directory and are ready to copy to your media. +Additionally, a "combo" disk image is created in both the hd512 and +hd1k formats that contains a multi-slice image that is handy to +use for initial testing. The combo disk image contains the following +slices: + + | Slice 0: CP/M 2.2 (bootable) + | Slice 1: ZSDOS 1.1 (bootable) + | Slice 2: NZCOM (bootable), requires configuration + | Slice 3: CP/M 3 (bootable) + | Slice 4: ZPM3 (bootable) + | Slice 5: WordStar 4 + A description of the specific image files is found in the file called DiskList.txt in the Binary directory of the distribution. +NOTE: The hd1k_combo.img file is already prefixed with +hd1k_prefix.dat, so you do not need to add the prefix file. It is +ready to write to your media. + Sample Run ---------- Below is sample output from building the hard disk images: C:\Users\Wayne\Projects\RBC\Build\RomWBW\Source\Images>Build.cmd - | : - | : Cleaning... - | : - | : - | : Creating System Images - | : - | ..\bl\bl.bin - | ..\cpm22\os2ccp.bin - | ..\cpm22\os3bdos.bin - | ..\cbios\cbios_wbw.bin - | 1 file(s) copied. - | ..\bl\bl.bin - | ..\cpm22\os2ccp.bin - | ..\cpm22\os3bdos.bin - | ..\cbios\cbios_una.bin + + | Building Floppy Disk Images... + | + | Generating cpm22 1.44MB Floppy Disk... + | cpmcp -f wbw_fd144 fd144_cpm22.img d_cpm22/u0/*.* 0: + | cpmcp -f wbw_fd144 fd144_cpm22.img d_cpm22/u1/*.* 1: + | cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_fd144 fd144_cpm22.img ../CPM22/cpm_wbw.sys 0:cpm.sys + | cpmcp -f wbw_fd144 fd144_cpm22.img Common/*.* 0: + | Moving image fd144_cpm22.img into output directory... + | Generating zsdos 1.44MB Floppy Disk... + | cpmcp -f wbw_fd144 fd144_zsdos.img d_zsdos/u0/*.* 0: + | cpmcp -f wbw_fd144 fd144_zsdos.img d_zsdos/u1/*.* 1: + | cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_fd144 fd144_zsdos.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys + | cpmcp -f wbw_fd144 fd144_zsdos.img Common/*.* 0: + | Moving image fd144_zsdos.img into output directory... + | Generating nzcom 1.44MB Floppy Disk... + | cpmcp -f wbw_fd144 fd144_nzcom.img d_nzcom/u0/*.* 0: + | cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_fd144 fd144_nzcom.img ../CPM22/cpm_wbw.sys 0:cpm.sys + | cpmcp -f wbw_fd144 fd144_nzcom.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys + | cpmcp -f wbw_fd144 fd144_nzcom.img Common/*.* 0: + | Moving image fd144_nzcom.img into output directory... + | Generating cpm3 1.44MB Floppy Disk... + | cpmcp -f wbw_fd144 fd144_cpm3.img d_cpm3/u0/*.* 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpmldr.com 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpmldr.sys 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/ccp.com 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/gencpm.com 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/genres.dat 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/genbnk.dat 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/bios3.spr 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/bnkbios3.spr 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/bdos3.spr 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/bnkbdos3.spr 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/resbdos3.spr 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpm3res.sys 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpm3bnk.sys 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/gencpm.dat 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpm3.sys 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/readme.1st 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpm3fix.pat 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_fd144 fd144_cpm3.img Common/*.* 0: + | Moving image fd144_cpm3.img into output directory... + | Generating zpm3 1.44MB Floppy Disk... + | cpmcp -f wbw_fd144 fd144_zpm3.img d_zpm3/u0/*.* 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img d_zpm3/u10/*.* 10: + | cpmcp -f wbw_fd144 fd144_zpm3.img d_zpm3/u14/*.* 14: + | cpmcp -f wbw_fd144 fd144_zpm3.img d_zpm3/u15/*.* 15: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/zpmldr.com 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/zpmldr.sys 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../CPM3/cpmldr.com 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../CPM3/cpmldr.sys 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/autotog.com 15: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/clrhist.com 15: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/setz3.com 15: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/cpm3.sys 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/zccp.com 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/zinstal.zpm 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/startzpm.com 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/makedos.com 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/gencpm.dat 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/bnkbios3.spr 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/bnkbdos3.spr 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/resbdos3.spr 0: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/*.com 15: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_fd144 fd144_zpm3.img Common/*.* 15: + | Moving image fd144_zpm3.img into output directory... + | Generating ws4 1.44MB Floppy Disk... + | cpmcp -f wbw_fd144 fd144_ws4.img d_ws4/u0/*.* 0: + | Moving image fd144_ws4.img into output directory... + | + | Building Hard Disk Images (512 directory entry format)... + | + | Generating cpm22 Hard Disk (512 directory entry format)... + | cpmcp -f wbw_hd512 hd512_cpm22.img d_cpm22/u0/*.* 0: + | cpmcp -f wbw_hd512 hd512_cpm22.img d_cpm22/u1/*.* 1: + | cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_hd512 hd512_cpm22.img ../CPM22/cpm_wbw.sys 0:cpm.sys + | cpmcp -f wbw_hd512 hd512_cpm22.img Common/*.* 0: + | Moving image hd512_cpm22.img into output directory... + | Generating zsdos Hard Disk (512 directory entry format)... + | cpmcp -f wbw_hd512 hd512_zsdos.img d_zsdos/u0/*.* 0: + | cpmcp -f wbw_hd512 hd512_zsdos.img d_zsdos/u1/*.* 1: + | cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_hd512 hd512_zsdos.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys + | cpmcp -f wbw_hd512 hd512_zsdos.img Common/*.* 0: + | Moving image hd512_zsdos.img into output directory... + | Generating nzcom Hard Disk (512 directory entry format)... + | cpmcp -f wbw_hd512 hd512_nzcom.img d_nzcom/u0/*.* 0: + | cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_hd512 hd512_nzcom.img ../CPM22/cpm_wbw.sys 0:cpm.sys + | cpmcp -f wbw_hd512 hd512_nzcom.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys + | cpmcp -f wbw_hd512 hd512_nzcom.img Common/*.* 0: + | Moving image hd512_nzcom.img into output directory... + | Generating cpm3 Hard Disk (512 directory entry format)... + | cpmcp -f wbw_hd512 hd512_cpm3.img d_cpm3/u0/*.* 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpmldr.com 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpmldr.sys 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/ccp.com 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/gencpm.com 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/genres.dat 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/genbnk.dat 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/bios3.spr 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/bnkbios3.spr 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/bdos3.spr 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/bnkbdos3.spr 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/resbdos3.spr 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpm3res.sys 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpm3bnk.sys 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/gencpm.dat 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpm3.sys 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/readme.1st 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpm3fix.pat 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_hd512 hd512_cpm3.img Common/*.* 0: + | Moving image hd512_cpm3.img into output directory... + | Generating zpm3 Hard Disk (512 directory entry format)... + | cpmcp -f wbw_hd512 hd512_zpm3.img d_zpm3/u0/*.* 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img d_zpm3/u10/*.* 10: + | cpmcp -f wbw_hd512 hd512_zpm3.img d_zpm3/u14/*.* 14: + | cpmcp -f wbw_hd512 hd512_zpm3.img d_zpm3/u15/*.* 15: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/zpmldr.com 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/zpmldr.sys 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../CPM3/cpmldr.com 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../CPM3/cpmldr.sys 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/autotog.com 15: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/clrhist.com 15: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/setz3.com 15: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/cpm3.sys 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/zccp.com 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/zinstal.zpm 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/startzpm.com 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/makedos.com 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/gencpm.dat 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/bnkbios3.spr 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/bnkbdos3.spr 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/resbdos3.spr 0: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/*.com 15: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_hd512 hd512_zpm3.img Common/*.* 15: + | Moving image hd512_zpm3.img into output directory... + | Generating ws4 Hard Disk (512 directory entry format)... + | cpmcp -f wbw_hd512 hd512_ws4.img d_ws4/u0/*.* 0: + | Moving image hd512_ws4.img into output directory... + | + | Building Combo Disk (512 directory entry format) Image... + | ..\..\Binary\hd512_cpm22.img + | ..\..\Binary\hd512_zsdos.img + | ..\..\Binary\hd512_nzcom.img + | ..\..\Binary\hd512_cpm3.img + | ..\..\Binary\hd512_zpm3.img + | ..\..\Binary\hd512_ws4.img | 1 file(s) copied. - | ..\bl\bl.bin - | ..\zcpr-dj\zcpr.bin - | ..\zsdos\zsdos.bin - | ..\cbios\cbios_wbw.bin + | + | Building Hard Disk Images (1024 directory entry format)... + | + | Generating cpm22 Hard Disk (1024 directory entry format)... + | cpmcp -f wbw_hd1k hd1k_cpm22.img d_cpm22/u0/*.* 0: + | cpmcp -f wbw_hd1k hd1k_cpm22.img d_cpm22/u1/*.* 1: + | cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_hd1k hd1k_cpm22.img ../CPM22/cpm_wbw.sys 0:cpm.sys + | cpmcp -f wbw_hd1k hd1k_cpm22.img Common/*.* 0: + | Moving image hd1k_cpm22.img into output directory... + | Generating zsdos Hard Disk (1024 directory entry format)... + | cpmcp -f wbw_hd1k hd1k_zsdos.img d_zsdos/u0/*.* 0: + | cpmcp -f wbw_hd1k hd1k_zsdos.img d_zsdos/u1/*.* 1: + | cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_hd1k hd1k_zsdos.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys + | cpmcp -f wbw_hd1k hd1k_zsdos.img Common/*.* 0: + | Moving image hd1k_zsdos.img into output directory... + | Generating nzcom Hard Disk (1024 directory entry format)... + | cpmcp -f wbw_hd1k hd1k_nzcom.img d_nzcom/u0/*.* 0: + | cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_hd1k hd1k_nzcom.img ../CPM22/cpm_wbw.sys 0:cpm.sys + | cpmcp -f wbw_hd1k hd1k_nzcom.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys + | cpmcp -f wbw_hd1k hd1k_nzcom.img Common/*.* 0: + | Moving image hd1k_nzcom.img into output directory... + | Generating cpm3 Hard Disk (1024 directory entry format)... + | cpmcp -f wbw_hd1k hd1k_cpm3.img d_cpm3/u0/*.* 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpmldr.com 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpmldr.sys 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/ccp.com 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/gencpm.com 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/genres.dat 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/genbnk.dat 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/bios3.spr 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/bnkbios3.spr 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/bdos3.spr 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/bnkbdos3.spr 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/resbdos3.spr 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpm3res.sys 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpm3bnk.sys 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/gencpm.dat 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpm3.sys 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/readme.1st 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpm3fix.pat 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/*.com 0: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_hd1k hd1k_cpm3.img Common/*.* 0: + | Moving image hd1k_cpm3.img into output directory... + | Generating zpm3 Hard Disk (1024 directory entry format)... + | cpmcp -f wbw_hd1k hd1k_zpm3.img d_zpm3/u0/*.* 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img d_zpm3/u10/*.* 10: + | cpmcp -f wbw_hd1k hd1k_zpm3.img d_zpm3/u14/*.* 14: + | cpmcp -f wbw_hd1k hd1k_zpm3.img d_zpm3/u15/*.* 15: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/zpmldr.com 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/zpmldr.sys 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../CPM3/cpmldr.com 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../CPM3/cpmldr.sys 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/autotog.com 15: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/clrhist.com 15: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/setz3.com 15: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/cpm3.sys 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/zccp.com 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/zinstal.zpm 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/startzpm.com 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/makedos.com 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/gencpm.dat 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/bnkbios3.spr 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/bnkbdos3.spr 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/resbdos3.spr 0: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/*.com 15: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/Tunes/*.pt? 3: + | cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/Tunes/*.mym 3: + | cpmcp -f wbw_hd1k hd1k_zpm3.img Common/*.* 15: + | Moving image hd1k_zpm3.img into output directory... + | Generating ws4 Hard Disk (1024 directory entry format)... + | cpmcp -f wbw_hd1k hd1k_ws4.img d_ws4/u0/*.* 0: + | Moving image hd1k_ws4.img into output directory... | 1 file(s) copied. - | ..\bl\bl.bin - | ..\zcpr-dj\zcpr.bin - | ..\zsdos\zsdos.bin - | ..\cbios\cbios_una.bin + | + | Building Combo Disk (1024 directory entry format) Image... + | hd1k_prefix.dat + | ..\..\Binary\hd1k_cpm22.img + | ..\..\Binary\hd1k_zsdos.img + | ..\..\Binary\hd1k_nzcom.img + | ..\..\Binary\hd1k_cpm3.img + | ..\..\Binary\hd1k_zpm3.img + | ..\..\Binary\hd1k_ws4.img | 1 file(s) copied. - | : - | : Building Floppy Disk Images... - | : - | Generating Floppy Disk cpm22... - | cpmcp -f wbw_fd144 fd_cpm22.img d_cpm22/u0/*.* 0: - | cpmcp -f wbw_fd144 fd_cpm22.img d_cpm22/u1/*.* 1: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/assign.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/fat.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/fdu.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/format.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/mode.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/osldr.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/rtc.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/survey.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/syscopy.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/sysgen.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/talk.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/timer.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/xm.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/inttest.com 0: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/tune.com 3: - | cpmcp -f wbw_fd144 fd_cpm22.img ../../Binary/Apps/Tunes/*.* 3: - | Adding System Image cpm_wbw... - | Moving image fd_cpm22.img into output directory... - | 1 file(s) moved. - | Generating Floppy Disk zsdos... - | cpmcp -f wbw_fd144 fd_zsdos.img d_zsdos/u0/*.* 0: - | cpmcp -f wbw_fd144 fd_zsdos.img d_zsdos/u1/*.* 1: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/assign.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/fat.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/fdu.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/format.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/mode.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/osldr.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/rtc.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/survey.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/syscopy.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/sysgen.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/talk.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/timer.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/xm.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/inttest.com 0: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/tune.com 3: - | cpmcp -f wbw_fd144 fd_zsdos.img ../../Binary/Apps/Tunes/*.* 3: - | Adding System Image zsys_wbw... - | Moving image fd_zsdos.img into output directory... - | 1 file(s) moved. - | Generating Floppy Disk nzcom... - | cpmcp -f wbw_fd144 fd_nzcom.img d_nzcom/u0/*.* 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/assign.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/fat.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/fdu.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/format.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/mode.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/osldr.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/rtc.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/survey.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/syscopy.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/sysgen.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/talk.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/timer.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/xm.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/inttest.com 0: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/tune.com 3: - | cpmcp -f wbw_fd144 fd_nzcom.img ../../Binary/Apps/Tunes/*.* 3: - | Adding System Image zsys_wbw... - | Moving image fd_nzcom.img into output directory... - | 1 file(s) moved. - | Generating Floppy Disk cpm3... - | cpmcp -f wbw_fd144 fd_cpm3.img d_cpm3/u0/*.* 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/cpmldr.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/ccp.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/gencpm.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/genres.dat 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/genbnk.dat 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/bios3.spr 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/bnkbios3.spr 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/bdos3.spr 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/bnkbdos3.spr 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/resbdos3.spr 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/cpm3res.sys 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/cpm3bnk.sys 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/gencpm.dat 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/cpm3.sys 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/readme.1st 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../CPM3/cpm3fix.pat 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/assign.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/fat.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/fdu.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/format.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/mode.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/osldr.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/rtc.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/survey.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/syscopy.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/sysgen.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/talk.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/timer.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/xm.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/inttest.com 0: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/tune.com 3: - | cpmcp -f wbw_fd144 fd_cpm3.img ../../Binary/Apps/Tunes/*.* 3: - | Moving image fd_cpm3.img into output directory... - | 1 file(s) moved. - | Generating Floppy Disk zpm3... - | cpmcp -f wbw_fd144 fd_zpm3.img d_zpm3/u0/*.* 0: - | cpmcp -f wbw_fd144 fd_zpm3.img d_zpm3/u10/*.* 10: - | cpmcp -f wbw_fd144 fd_zpm3.img d_zpm3/u14/*.* 14: - | cpmcp -f wbw_fd144 fd_zpm3.img d_zpm3/u15/*.* 15: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/zpmldr.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/cpmldr.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/autotog.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/clrhist.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/setz3.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/cpm3.sys 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/zccp.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/zinstal.zpm 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/startzpm.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/makedos.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/gencpm.dat 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/bnkbios3.spr 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/bnkbdos3.spr 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../ZPM3/resbdos3.spr 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/assign.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/fat.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/fdu.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/format.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/mode.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/osldr.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/rtc.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/survey.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/syscopy.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/sysgen.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/talk.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/timer.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/xm.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/inttest.com 0: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/tune.com 3: - | cpmcp -f wbw_fd144 fd_zpm3.img ../../Binary/Apps/Tunes/*.* 3: - | Moving image fd_zpm3.img into output directory... - | 1 file(s) moved. - | Generating Floppy Disk ws4... - | cpmcp -f wbw_fd144 fd_ws4.img d_ws4/u0/*.* 0: - | Moving image fd_ws4.img into output directory... - | 1 file(s) moved. - | : - | : Building Hard Disk Images... - | : - | Generating Hard Disk cpm22... - | cpmcp -f wbw_hd0 hd_cpm22.img d_cpm22/u0/*.* 0: - | cpmcp -f wbw_hd0 hd_cpm22.img d_cpm22/u1/*.* 1: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/assign.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/fat.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/fdu.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/format.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/mode.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/osldr.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/rtc.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/survey.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/syscopy.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/sysgen.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/talk.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/timer.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/xm.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/inttest.com 0: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/tune.com 3: - | cpmcp -f wbw_hd0 hd_cpm22.img ../../Binary/Apps/Tunes/*.* 3: - | Adding System Image cpm_wbw... - | Moving image hd_cpm22.img into output directory... - | 1 file(s) moved. - | Generating Hard Disk zsdos... - | cpmcp -f wbw_hd0 hd_zsdos.img d_zsdos/u0/*.* 0: - | cpmcp -f wbw_hd0 hd_zsdos.img d_zsdos/u1/*.* 1: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/assign.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/fat.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/fdu.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/format.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/mode.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/osldr.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/rtc.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/survey.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/syscopy.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/sysgen.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/talk.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/timer.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/xm.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/inttest.com 0: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/tune.com 3: - | cpmcp -f wbw_hd0 hd_zsdos.img ../../Binary/Apps/Tunes/*.* 3: - | Adding System Image zsys_wbw... - | Moving image hd_zsdos.img into output directory... - | 1 file(s) moved. - | Generating Hard Disk nzcom... - | cpmcp -f wbw_hd0 hd_nzcom.img d_nzcom/u0/*.* 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/assign.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/fat.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/fdu.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/format.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/mode.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/osldr.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/rtc.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/survey.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/syscopy.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/sysgen.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/talk.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/timer.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/xm.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/inttest.com 0: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/tune.com 3: - | cpmcp -f wbw_hd0 hd_nzcom.img ../../Binary/Apps/Tunes/*.* 3: - | Adding System Image zsys_wbw... - | Moving image hd_nzcom.img into output directory... - | 1 file(s) moved. - | Generating Hard Disk cpm3... - | cpmcp -f wbw_hd0 hd_cpm3.img d_cpm3/u0/*.* 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/cpmldr.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/ccp.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/gencpm.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/genres.dat 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/genbnk.dat 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/bios3.spr 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/bnkbios3.spr 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/bdos3.spr 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/bnkbdos3.spr 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/resbdos3.spr 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/cpm3res.sys 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/cpm3bnk.sys 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/gencpm.dat 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/cpm3.sys 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/readme.1st 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../CPM3/cpm3fix.pat 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/assign.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/fat.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/fdu.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/format.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/mode.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/osldr.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/rtc.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/survey.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/syscopy.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/sysgen.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/talk.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/timer.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/xm.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/inttest.com 0: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/tune.com 3: - | cpmcp -f wbw_hd0 hd_cpm3.img ../../Binary/Apps/Tunes/*.* 3: - | Moving image hd_cpm3.img into output directory... - | 1 file(s) moved. - | Generating Hard Disk zpm3... - | cpmcp -f wbw_hd0 hd_zpm3.img d_zpm3/u0/*.* 0: - | cpmcp -f wbw_hd0 hd_zpm3.img d_zpm3/u10/*.* 10: - | cpmcp -f wbw_hd0 hd_zpm3.img d_zpm3/u14/*.* 14: - | cpmcp -f wbw_hd0 hd_zpm3.img d_zpm3/u15/*.* 15: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/zpmldr.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/cpmldr.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/autotog.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/clrhist.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/setz3.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/cpm3.sys 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/zccp.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/zinstal.zpm 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/startzpm.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/makedos.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/gencpm.dat 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/bnkbios3.spr 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/bnkbdos3.spr 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../ZPM3/resbdos3.spr 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/assign.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/fat.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/fdu.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/format.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/mode.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/osldr.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/rtc.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/survey.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/syscopy.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/sysgen.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/talk.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/timer.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/xm.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/inttest.com 0: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/tune.com 3: - | cpmcp -f wbw_hd0 hd_zpm3.img ../../Binary/Apps/Tunes/*.* 3: - | Moving image hd_zpm3.img into output directory... - | 1 file(s) moved. - | Generating Hard Disk ws4... - | cpmcp -f wbw_hd0 hd_ws4.img d_ws4/u0/*.* 0: - | Moving image hd_ws4.img into output directory... - | 1 file(s) moved. diff --git a/Source/Images/Test/z80ccf.com b/Source/Images/Test/z80ccf.com new file mode 100644 index 00000000..75e41575 Binary files /dev/null and b/Source/Images/Test/z80ccf.com differ diff --git a/Source/Images/Test/z80doc.com b/Source/Images/Test/z80doc.com new file mode 100644 index 00000000..b97b8257 Binary files /dev/null and b/Source/Images/Test/z80doc.com differ diff --git a/Source/Images/Test/z80docf.com b/Source/Images/Test/z80docf.com new file mode 100644 index 00000000..2209bd59 Binary files /dev/null and b/Source/Images/Test/z80docf.com differ diff --git a/Source/Images/Test/z80flags.com b/Source/Images/Test/z80flags.com new file mode 100644 index 00000000..877b2bdb Binary files /dev/null and b/Source/Images/Test/z80flags.com differ diff --git a/Source/Images/Test/z80full.com b/Source/Images/Test/z80full.com new file mode 100644 index 00000000..a2b5afe0 Binary files /dev/null and b/Source/Images/Test/z80full.com differ diff --git a/Source/Images/Test/z80mptr.com b/Source/Images/Test/z80mptr.com new file mode 100644 index 00000000..f0c6f8ed Binary files /dev/null and b/Source/Images/Test/z80mptr.com differ diff --git a/Source/Images/cpnet12/ccp.spr b/Source/Images/cpnet12/ccp.spr new file mode 100644 index 00000000..ab2e57bf Binary files /dev/null and b/Source/Images/cpnet12/ccp.spr differ diff --git a/Source/Images/cpnet12/cpm2net.hlp b/Source/Images/cpnet12/cpm2net.hlp new file mode 100644 index 00000000..b7381254 Binary files /dev/null and b/Source/Images/cpnet12/cpm2net.hlp differ diff --git a/Source/Images/cpnet12/cpnboot.com b/Source/Images/cpnet12/cpnboot.com new file mode 100644 index 00000000..7216bcc7 Binary files /dev/null and b/Source/Images/cpnet12/cpnboot.com differ diff --git a/Source/Images/cpnet12/cpnet12.hlp b/Source/Images/cpnet12/cpnet12.hlp new file mode 100644 index 00000000..6562f67a Binary files /dev/null and b/Source/Images/cpnet12/cpnet12.hlp differ diff --git a/Source/Images/cpnet12/cpnetldr.com b/Source/Images/cpnet12/cpnetldr.com new file mode 100644 index 00000000..750510ac Binary files /dev/null and b/Source/Images/cpnet12/cpnetldr.com differ diff --git a/Source/Images/cpnet12/cpnetsts.com b/Source/Images/cpnet12/cpnetsts.com new file mode 100644 index 00000000..81621fdd Binary files /dev/null and b/Source/Images/cpnet12/cpnetsts.com differ diff --git a/Source/Images/cpnet12/dskreset.com b/Source/Images/cpnet12/dskreset.com new file mode 100644 index 00000000..7ce71ce2 Binary files /dev/null and b/Source/Images/cpnet12/dskreset.com differ diff --git a/Source/Images/cpnet12/endlist.com b/Source/Images/cpnet12/endlist.com new file mode 100644 index 00000000..e52cb75a Binary files /dev/null and b/Source/Images/cpnet12/endlist.com differ diff --git a/Source/Images/cpnet12/help.com b/Source/Images/cpnet12/help.com new file mode 100644 index 00000000..34e1829c Binary files /dev/null and b/Source/Images/cpnet12/help.com differ diff --git a/Source/Images/cpnet12/local.com b/Source/Images/cpnet12/local.com new file mode 100644 index 00000000..fc059511 Binary files /dev/null and b/Source/Images/cpnet12/local.com differ diff --git a/Source/Images/cpnet12/login.com b/Source/Images/cpnet12/login.com new file mode 100644 index 00000000..3a089680 Binary files /dev/null and b/Source/Images/cpnet12/login.com differ diff --git a/Source/Images/cpnet12/logoff.com b/Source/Images/cpnet12/logoff.com new file mode 100644 index 00000000..ccd56c6e Binary files /dev/null and b/Source/Images/cpnet12/logoff.com differ diff --git a/Source/Images/cpnet12/mail.com b/Source/Images/cpnet12/mail.com new file mode 100644 index 00000000..8ebb02be Binary files /dev/null and b/Source/Images/cpnet12/mail.com differ diff --git a/Source/Images/cpnet12/ndos.spr b/Source/Images/cpnet12/ndos.spr new file mode 100644 index 00000000..fc2dcaa9 Binary files /dev/null and b/Source/Images/cpnet12/ndos.spr differ diff --git a/Source/Images/cpnet12/netdown.com b/Source/Images/cpnet12/netdown.com new file mode 100644 index 00000000..52aed9be Binary files /dev/null and b/Source/Images/cpnet12/netdown.com differ diff --git a/Source/Images/cpnet12/netstat.com b/Source/Images/cpnet12/netstat.com new file mode 100644 index 00000000..7b933533 Binary files /dev/null and b/Source/Images/cpnet12/netstat.com differ diff --git a/Source/Images/cpnet12/network.com b/Source/Images/cpnet12/network.com new file mode 100644 index 00000000..5b6322b1 Binary files /dev/null and b/Source/Images/cpnet12/network.com differ diff --git a/Source/Images/cpnet12/nvram.com b/Source/Images/cpnet12/nvram.com new file mode 100644 index 00000000..63c509a4 Binary files /dev/null and b/Source/Images/cpnet12/nvram.com differ diff --git a/Source/Images/cpnet12/pipnet.com b/Source/Images/cpnet12/pipnet.com new file mode 100644 index 00000000..ea3cb2c7 Binary files /dev/null and b/Source/Images/cpnet12/pipnet.com differ diff --git a/Source/Images/cpnet12/rdate.com b/Source/Images/cpnet12/rdate.com new file mode 100644 index 00000000..10cbfded Binary files /dev/null and b/Source/Images/cpnet12/rdate.com differ diff --git a/Source/Images/cpnet12/readme.txt b/Source/Images/cpnet12/readme.txt new file mode 100644 index 00000000..6bc89333 --- /dev/null +++ b/Source/Images/cpnet12/readme.txt @@ -0,0 +1,17 @@ +*********************************************************************** +*** *** +*** R o m W B W *** +*** *** +*** Z80/Z180 System Software *** +*** *** +*********************************************************************** + +This directory contains the CP/M 2.2 client tools for CP/NET. These +tools work only with the MT011 RCBus module. + +All of these files come from Douglas Miller. Please refer to +https://github.com/durgadas311/cpnet-z80 for more information and +the latest source code. + +In general, to use CP/NET on RomWBW, it is intended that you will +copy all of these files into your user 0 directory. \ No newline at end of file diff --git a/Source/Images/cpnet12/snios.spr b/Source/Images/cpnet12/snios.spr new file mode 100644 index 00000000..b191dcd5 Binary files /dev/null and b/Source/Images/cpnet12/snios.spr differ diff --git a/Source/Images/cpnet12/srvstat.com b/Source/Images/cpnet12/srvstat.com new file mode 100644 index 00000000..914b5b5f Binary files /dev/null and b/Source/Images/cpnet12/srvstat.com differ diff --git a/Source/Images/cpnet12/tr.com b/Source/Images/cpnet12/tr.com new file mode 100644 index 00000000..e9843305 Binary files /dev/null and b/Source/Images/cpnet12/tr.com differ diff --git a/Source/Images/cpnet12/wizcfg.com b/Source/Images/cpnet12/wizcfg.com new file mode 100644 index 00000000..491bca54 Binary files /dev/null and b/Source/Images/cpnet12/wizcfg.com differ diff --git a/Source/Images/cpnet12/wizdbg.com b/Source/Images/cpnet12/wizdbg.com new file mode 100644 index 00000000..fa889a0b Binary files /dev/null and b/Source/Images/cpnet12/wizdbg.com differ diff --git a/Source/Images/cpnet12/wiztest.com b/Source/Images/cpnet12/wiztest.com new file mode 100644 index 00000000..d808e6c5 Binary files /dev/null and b/Source/Images/cpnet12/wiztest.com differ diff --git a/Source/Images/cpnet12/xsubnet.com b/Source/Images/cpnet12/xsubnet.com new file mode 100644 index 00000000..da78ba84 Binary files /dev/null and b/Source/Images/cpnet12/xsubnet.com differ diff --git a/Source/Images/cpnet3/cpm3net.hlp b/Source/Images/cpnet3/cpm3net.hlp new file mode 100644 index 00000000..4066664b Binary files /dev/null and b/Source/Images/cpnet3/cpm3net.hlp differ diff --git a/Source/Images/cpnet3/cpnet3.hlp b/Source/Images/cpnet3/cpnet3.hlp new file mode 100644 index 00000000..116c6895 Binary files /dev/null and b/Source/Images/cpnet3/cpnet3.hlp differ diff --git a/Source/Images/cpnet3/cpnetsts.com b/Source/Images/cpnet3/cpnetsts.com new file mode 100644 index 00000000..81621fdd Binary files /dev/null and b/Source/Images/cpnet3/cpnetsts.com differ diff --git a/Source/Images/cpnet3/dskreset.com b/Source/Images/cpnet3/dskreset.com new file mode 100644 index 00000000..7ce71ce2 Binary files /dev/null and b/Source/Images/cpnet3/dskreset.com differ diff --git a/Source/Images/cpnet3/endlist.com b/Source/Images/cpnet3/endlist.com new file mode 100644 index 00000000..e52cb75a Binary files /dev/null and b/Source/Images/cpnet3/endlist.com differ diff --git a/Source/Images/cpnet3/help.com b/Source/Images/cpnet3/help.com new file mode 100644 index 00000000..34e1829c Binary files /dev/null and b/Source/Images/cpnet3/help.com differ diff --git a/Source/Images/cpnet3/local.com b/Source/Images/cpnet3/local.com new file mode 100644 index 00000000..fc059511 Binary files /dev/null and b/Source/Images/cpnet3/local.com differ diff --git a/Source/Images/cpnet3/login.com b/Source/Images/cpnet3/login.com new file mode 100644 index 00000000..3a089680 Binary files /dev/null and b/Source/Images/cpnet3/login.com differ diff --git a/Source/Images/cpnet3/logoff.com b/Source/Images/cpnet3/logoff.com new file mode 100644 index 00000000..ccd56c6e Binary files /dev/null and b/Source/Images/cpnet3/logoff.com differ diff --git a/Source/Images/cpnet3/mail.com b/Source/Images/cpnet3/mail.com new file mode 100644 index 00000000..8ebb02be Binary files /dev/null and b/Source/Images/cpnet3/mail.com differ diff --git a/Source/Images/cpnet3/ndos3.com b/Source/Images/cpnet3/ndos3.com new file mode 100644 index 00000000..c4e5aabe Binary files /dev/null and b/Source/Images/cpnet3/ndos3.com differ diff --git a/Source/Images/cpnet3/netdown.com b/Source/Images/cpnet3/netdown.com new file mode 100644 index 00000000..52aed9be Binary files /dev/null and b/Source/Images/cpnet3/netdown.com differ diff --git a/Source/Images/cpnet3/netstat.com b/Source/Images/cpnet3/netstat.com new file mode 100644 index 00000000..7b933533 Binary files /dev/null and b/Source/Images/cpnet3/netstat.com differ diff --git a/Source/Images/cpnet3/network.com b/Source/Images/cpnet3/network.com new file mode 100644 index 00000000..5b6322b1 Binary files /dev/null and b/Source/Images/cpnet3/network.com differ diff --git a/Source/Images/cpnet3/ntpdate.com b/Source/Images/cpnet3/ntpdate.com new file mode 100644 index 00000000..2716d473 Binary files /dev/null and b/Source/Images/cpnet3/ntpdate.com differ diff --git a/Source/Images/cpnet3/nvram.com b/Source/Images/cpnet3/nvram.com new file mode 100644 index 00000000..63c509a4 Binary files /dev/null and b/Source/Images/cpnet3/nvram.com differ diff --git a/Source/Images/cpnet3/rdate.com b/Source/Images/cpnet3/rdate.com new file mode 100644 index 00000000..10cbfded Binary files /dev/null and b/Source/Images/cpnet3/rdate.com differ diff --git a/Source/Images/cpnet3/readme.txt b/Source/Images/cpnet3/readme.txt new file mode 100644 index 00000000..237be98a --- /dev/null +++ b/Source/Images/cpnet3/readme.txt @@ -0,0 +1,17 @@ +*********************************************************************** +*** *** +*** R o m W B W *** +*** *** +*** Z80/Z180 System Software *** +*** *** +*********************************************************************** + +This directory contains the CP/M 3 client tools for CP/NET. These +tools work only with the MT011 RCBus module. + +All of these files come from Douglas Miller. Please refer to +https://github.com/durgadas311/cpnet-z80 for more information and +the latest source code. + +In general, to use CP/NET on RomWBW, it is intended that you will +copy all of these files into your user 0 directory. \ No newline at end of file diff --git a/Source/Images/cpnet3/rsxls.com b/Source/Images/cpnet3/rsxls.com new file mode 100644 index 00000000..dadd9cd2 Binary files /dev/null and b/Source/Images/cpnet3/rsxls.com differ diff --git a/Source/Images/cpnet3/rsxrm.com b/Source/Images/cpnet3/rsxrm.com new file mode 100644 index 00000000..7b9a1804 Binary files /dev/null and b/Source/Images/cpnet3/rsxrm.com differ diff --git a/Source/Images/cpnet3/srvstat.com b/Source/Images/cpnet3/srvstat.com new file mode 100644 index 00000000..914b5b5f Binary files /dev/null and b/Source/Images/cpnet3/srvstat.com differ diff --git a/Source/Images/cpnet3/tr.com b/Source/Images/cpnet3/tr.com new file mode 100644 index 00000000..e9843305 Binary files /dev/null and b/Source/Images/cpnet3/tr.com differ diff --git a/Source/Images/cpnet3/wizcfg.com b/Source/Images/cpnet3/wizcfg.com new file mode 100644 index 00000000..491bca54 Binary files /dev/null and b/Source/Images/cpnet3/wizcfg.com differ diff --git a/Source/Images/cpnet3/wizdbg.com b/Source/Images/cpnet3/wizdbg.com new file mode 100644 index 00000000..fa889a0b Binary files /dev/null and b/Source/Images/cpnet3/wizdbg.com differ diff --git a/Source/Images/cpnet3/wiztest.com b/Source/Images/cpnet3/wiztest.com new file mode 100644 index 00000000..d808e6c5 Binary files /dev/null and b/Source/Images/cpnet3/wiztest.com differ diff --git a/Source/Images/cpnet3/xsubnet.com b/Source/Images/cpnet3/xsubnet.com new file mode 100644 index 00000000..da78ba84 Binary files /dev/null and b/Source/Images/cpnet3/xsubnet.com differ diff --git a/Source/Images/d_bp.txt b/Source/Images/d_bp.txt deleted file mode 100644 index fa445326..00000000 --- a/Source/Images/d_bp.txt +++ /dev/null @@ -1,23 +0,0 @@ -# -# Add RomWBW utilities -# -../../Binary/Apps/*.com 15: -# -# Add Tune sample files -# -../../Binary/Apps/Tunes/*.pt? 3: -../../Binary/Apps/Tunes/*.mym 3: -# -# Add ZSystem images -# -../BPBIOS/*.img 0: -../BPBIOS/*.rel 0: -../BPBIOS/*.zrl 0: -../BPBIOS/*.zex 0: -../BPBIOS/myterm.z3t 0: -../BPBIOS/Z34RCP11/z34rcp11.rel 0:rcp.zrl -../BPBIOS/NZFCP13/nzfcp13.rel 0:fcp.zrl -# -# Add Common Applications -# -Common/*.* 0: diff --git a/Source/Images/d_bp/u0/ALIEN.DAT b/Source/Images/d_bp/u0/ALIEN.DAT deleted file mode 100644 index 7ef59044..00000000 Binary files a/Source/Images/d_bp/u0/ALIEN.DAT and /dev/null differ diff --git a/Source/Images/d_bp/u0/BPBUILD.COM b/Source/Images/d_bp/u0/BPBUILD.COM deleted file mode 100644 index 9ffe859e..00000000 Binary files a/Source/Images/d_bp/u0/BPBUILD.COM and /dev/null differ diff --git a/Source/Images/d_bp/u0/LDDS.COM b/Source/Images/d_bp/u0/LDDS.COM deleted file mode 100644 index 357f1360..00000000 Binary files a/Source/Images/d_bp/u0/LDDS.COM and /dev/null differ diff --git a/Source/Images/d_bp/u0/LDNZT.COM b/Source/Images/d_bp/u0/LDNZT.COM deleted file mode 100644 index 87cf0b47..00000000 Binary files a/Source/Images/d_bp/u0/LDNZT.COM and /dev/null differ diff --git a/Source/Images/d_bp/u0/LDP2D.COM b/Source/Images/d_bp/u0/LDP2D.COM deleted file mode 100644 index a89e03d8..00000000 Binary files a/Source/Images/d_bp/u0/LDP2D.COM and /dev/null differ diff --git a/Source/Images/d_bp/u0/START01.COM b/Source/Images/d_bp/u0/START01.COM deleted file mode 100644 index 6f0d3af4..00000000 Binary files a/Source/Images/d_bp/u0/START01.COM and /dev/null differ diff --git a/Source/Images/d_bp/u0/SUPERSUB.COM b/Source/Images/d_bp/u0/SUPERSUB.COM deleted file mode 100644 index a25d60a6..00000000 Binary files a/Source/Images/d_bp/u0/SUPERSUB.COM and /dev/null differ diff --git a/Source/Images/d_bp/u0/SYS.FCP b/Source/Images/d_bp/u0/SYS.FCP deleted file mode 100644 index 26f1cf6d..00000000 Binary files a/Source/Images/d_bp/u0/SYS.FCP and /dev/null differ diff --git a/Source/Images/d_bp/u0/SYS.NDR b/Source/Images/d_bp/u0/SYS.NDR deleted file mode 100644 index b4c382aa..00000000 Binary files a/Source/Images/d_bp/u0/SYS.NDR and /dev/null differ diff --git a/Source/Images/d_bp/u0/SYS.RCP b/Source/Images/d_bp/u0/SYS.RCP deleted file mode 100644 index 45e38856..00000000 Binary files a/Source/Images/d_bp/u0/SYS.RCP and /dev/null differ diff --git a/Source/Images/d_bp/u0/TCSELECT.COM b/Source/Images/d_bp/u0/TCSELECT.COM deleted file mode 100644 index 723f89ae..00000000 Binary files a/Source/Images/d_bp/u0/TCSELECT.COM and /dev/null differ diff --git a/Source/Images/d_bp/u0/UNZIP.COM b/Source/Images/d_bp/u0/UNZIP.COM deleted file mode 100644 index afde7204..00000000 Binary files a/Source/Images/d_bp/u0/UNZIP.COM and /dev/null differ diff --git a/Source/Images/d_bp/u0/VIDATT.Z80 b/Source/Images/d_bp/u0/VIDATT.Z80 deleted file mode 100644 index 073bb84f..00000000 --- a/Source/Images/d_bp/u0/VIDATT.Z80 +++ /dev/null @@ -1,69 +0,0 @@ - title WordStar 4.0 Video Attributes Driver - -strngout equ 0283h - -esc equ 1bh -dim equ 1 -blink equ 2 -invert equ 4 -uline equ 8 - - aseg - org 03c1h - -vidatt: - xor a - ld hl,funtbl - ld b,8 -getloop: - rr c - jr nc,getnext - or a,(hl) -getnext: - inc hl - djnz getloop -; - ld hl,string+2 ; attribute #1 on/off indicator - push hl - ld b,4 - ld de,'?!' ; ? = attribute off, ! = attribute on -setloop: - rra - jr nc,attroff - ld (hl),e ; attribute on - jr setnext -attroff: - ld (hl),d ; attribute off -setnext: - inc hl - inc hl - inc hl ; advance to next on/off indicator - djnz setloop -; - pop hl ; hl --> dim on/off - ld a,d ; attribute off - cp (hl) ; dim off? - jr nz,setdim - ld a,e ; attribute on -setdim: - ld (hl),a - ld hl,string - jp strngout ; ws string routine -; -; -funtbl: - defb dim ; strike out - defb invert or blink ; warnings & errors - defb invert ; block - defb uline ; underline - defb blink ; subscript - defb blink or uline ; superscript - defb invert ; menu, headline, bold, double - defb invert or uline ; italics, RET, backspace -; -string: - defb 12,esc,' 2',esc,' 3',esc,' 4',esc,' 5' -; -finis equ $ - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u0/VT100TCP.Z3T b/Source/Images/d_bp/u0/VT100TCP.Z3T deleted file mode 100644 index 13b150ee..00000000 Binary files a/Source/Images/d_bp/u0/VT100TCP.Z3T and /dev/null differ diff --git a/Source/Images/d_bp/u0/WW.Z3T b/Source/Images/d_bp/u0/WW.Z3T deleted file mode 100644 index 004cc957..00000000 Binary files a/Source/Images/d_bp/u0/WW.Z3T and /dev/null differ diff --git a/Source/Images/d_bp/u0/Z3TCAP.TCP b/Source/Images/d_bp/u0/Z3TCAP.TCP deleted file mode 100644 index 0862d65d..00000000 Binary files a/Source/Images/d_bp/u0/Z3TCAP.TCP and /dev/null differ diff --git a/Source/Images/d_bp/u0/Z3TCAP.Z3T b/Source/Images/d_bp/u0/Z3TCAP.Z3T deleted file mode 100644 index b5befb8c..00000000 Binary files a/Source/Images/d_bp/u0/Z3TCAP.Z3T and /dev/null differ diff --git a/Source/Images/d_bp/u0/ZSID.COM b/Source/Images/d_bp/u0/ZSID.COM deleted file mode 100644 index 686b3775..00000000 Binary files a/Source/Images/d_bp/u0/ZSID.COM and /dev/null differ diff --git a/Source/Images/d_bp/u0/bpbio.ndr b/Source/Images/d_bp/u0/bpbio.ndr new file mode 100644 index 00000000..49daf910 Binary files /dev/null and b/Source/Images/d_bp/u0/bpbio.ndr differ diff --git a/Source/Images/d_bp/u0/bpbioz33.ndr b/Source/Images/d_bp/u0/bpbioz33.ndr new file mode 100644 index 00000000..92093e14 Binary files /dev/null and b/Source/Images/d_bp/u0/bpbioz33.ndr differ diff --git a/Source/Images/d_bp/u0/cp.bin b/Source/Images/d_bp/u0/cp.bin deleted file mode 100644 index 463cc668..00000000 Binary files a/Source/Images/d_bp/u0/cp.bin and /dev/null differ diff --git a/Source/Images/d_bp/u0/ease.hlp b/Source/Images/d_bp/u0/ease.hlp new file mode 100644 index 00000000..f95ef113 Binary files /dev/null and b/Source/Images/d_bp/u0/ease.hlp differ diff --git a/Source/BPBIOS/NZFCP13/fcp-4.zrl b/Source/Images/d_bp/u0/fcp-4.zrl similarity index 100% rename from Source/BPBIOS/NZFCP13/fcp-4.zrl rename to Source/Images/d_bp/u0/fcp-4.zrl diff --git a/Source/BPBIOS/NZFCP13/fcp-4t.zrl b/Source/Images/d_bp/u0/fcp-4t.zrl similarity index 100% rename from Source/BPBIOS/NZFCP13/fcp-4t.zrl rename to Source/Images/d_bp/u0/fcp-4t.zrl diff --git a/Source/Images/d_bp/u0/LDSYS.COM b/Source/Images/d_bp/u0/ldsys.com similarity index 100% rename from Source/Images/d_bp/u0/LDSYS.COM rename to Source/Images/d_bp/u0/ldsys.com diff --git a/Source/Images/d_bp/u0/lshf.var b/Source/Images/d_bp/u0/lshf.var new file mode 100644 index 00000000..34736429 --- /dev/null +++ b/Source/Images/d_bp/u0/lshf.var @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Source/Images/d_bp/u0/nzcpr.zrl b/Source/Images/d_bp/u0/nzcpr.zrl deleted file mode 100644 index b8cc645f..00000000 Binary files a/Source/Images/d_bp/u0/nzcpr.zrl and /dev/null differ diff --git a/Source/Images/d_bp/u0/nzdec23d.z3t b/Source/Images/d_bp/u0/nzdec23d.z3t new file mode 100644 index 00000000..5f905f8a Binary files /dev/null and b/Source/Images/d_bp/u0/nzdec23d.z3t differ diff --git a/Source/Images/d_bp/u0/ramfiles.txt b/Source/Images/d_bp/u0/ramfiles.txt new file mode 100644 index 00000000..90495ad2 --- /dev/null +++ b/Source/Images/d_bp/u0/ramfiles.txt @@ -0,0 +1,9 @@ +BIN:COPY.COM +BIN:D.COM +BIN:ZXD.COM +BIN:IF.COM +BIN:QL.COM +BIN:SD.COM +BIN:CL.COM +BIN:LU.COM + \ No newline at end of file diff --git a/Source/Images/d_bp/u0/rcp-16h.zrl b/Source/Images/d_bp/u0/rcp-16h.zrl new file mode 100644 index 00000000..a5573839 Binary files /dev/null and b/Source/Images/d_bp/u0/rcp-16h.zrl differ diff --git a/Source/Images/d_bp/u0/start.com b/Source/Images/d_bp/u0/start.com deleted file mode 100644 index 81c0858f..00000000 Binary files a/Source/Images/d_bp/u0/start.com and /dev/null differ diff --git a/Source/Images/d_bp/u0/support.lbr b/Source/Images/d_bp/u0/support.lbr new file mode 100644 index 00000000..04760f13 Binary files /dev/null and b/Source/Images/d_bp/u0/support.lbr differ diff --git a/Source/Images/d_bp/u0/support.txt b/Source/Images/d_bp/u0/support.txt new file mode 100644 index 00000000..db70c39d --- /dev/null +++ b/Source/Images/d_bp/u0/support.txt @@ -0,0 +1,95 @@ +This library contains a number of support files, programs and scripts needed +to bring up a fully functioning BPBIOS Zsystem. These programs and files +are used and/or loaded by the startup scripts. + +Some of the support files are startup ZEX scripts, some are Z3+ segment files, +others are Date and Time stamp drivers, some are command line editors and +history shells others are needed to initialize the RAMDRIVE as well as help files. + +The following table shows which files are needed to support each of the ten +BPBIOS variants (BP33, BP33BNK, BP34, BP34BNK & BBP41BNK). + +Variant Name BP33 BP33BNK BP34 BP34BNK BP41BNK +================================================================ +bpbio.ndr X X X +bpbioz33.ndr X X +BPCNFG.COM X X X X X +EASE.COM X X +EASE.HLP X X +fcp-4.zrl X X +fcp-4t.zrl X X X +RELOG X X X X X +HELPLSH.COM X X X +IF.COM X X X X +jetldr.com X X X X X +LDTIMEC.COM X X X +LSH.COM X X X +LSHF.COM* X X X +LSHF.VAR* X X X +myterm.z3t X X X X X +nzdec23d.z3t X X X X X +PUTDS.COM X X X X X +RAMFILES.TXT X X X X X +RCOPY.COM X X X X X +rcp-16h.zrl X X X X +SAVE.COM X X X X +Z33.ZEX X X +ZEX.COM X X X X X +ZPATH.COM X X X X X +ZSCFG2.COM X +ZSTF.ZEX X +ZST.ZEX X X + + +Instructions: + The support files are "crunched" and stored in the library file +SUPPORT.LBR. Place SUPPORT.LBR on the RAMDRIVE using for example +XModem. Use LBREXT with the /U option to extract and uncrunch the +files. First extract ZEX.COM while logged onto the A: drive with the +following command: + B0:LBREXT SUPPORT C0:ZEX.C?M /U +Next place all the .COM files on C15: by typing: + B0:LBREXT SUPPORT C15:*.C?M /U +The remaining files should be placed on C0:. + B0:LBREXT SUPPORT C0:*.Z?X /U + B0:LBREXT SUPPORT C0:*.Z?L /U + B0:LBREXT SUPPORT C0:*.N?R /U + B0:LBREXT SUPPORT C0:*.Z?T /U + B0:LBREXT SUPPORT C0:*.T?T /U + B0:LBREXT SUPPORT C0:*.H?P /U + +Note in all BPBIOS variants that A: is the RAMDRIVE, B: is +the ROMDRIVE and C: is the system drive. Hard drive slices occupy C: +through N: and floppy drives are O: & P:. A short desciption +of each of the support files follows: + +bpbioz33.ndr - Named Directory Table for Z33 +bpbio.ndr - Named Directory Table for Z34 & Z41 +BPCNFG.COM - BPBIOS configuration program +EASE.COM - Command line editor & history shell for Z33* +EASE.HLP - Help file for EASE +fcp-4.zrl - Z33 Flow Control Processor (handles IF, ELSE etc) +fcp-4t.zrl - Z34 & Z41 Flow Control Processor (IF is transient) +RELOG.COM - Enables date stamping on RAM drive. +HELPLSH.COM - Help file for LSH +if.com - Adds tests to fcp-4t +jetldr.com - Loads Zsystem segments +LDTIMEC.COM - Date stamping & clock drivers for z33* & Z34* variants +LSH.COM - Command line editor & history shell for Z34 & Z41 +LSHF.COM - LSH with a fixed length History file (runs faster) +LSHF.VAR - History file for LSHF +myterm.z3t - Terminal Capabilities file (defines ESC sequences etc) +NZDEC23D.Z3T - VT100 Terminal Capabilities File. +PUTDS.COM - Installs date stamping for RAM drive. +RAMFILES.TXT - List of frequently used command (edit to suit) +RCOPY.COM - Copies files listed in RAMFILES.TXT to RAMDRIVE +rcp-16h.zrl - Zsystem Resident Command Processor +SAVE.COM - Transient save command loads at 8000h +Z33.ZEX - Automatically executed Startup script for Z33 variants +ZEX.COM - Memory resident SUBMIT - executes startup scripts +ZPATH.COM - Loads the Zsystem & ZSDOS search paths +ZSCFG2.COM - Configures ZSDOS 2 +ZSTF.ZEX - Automatically executed Startup script for BP41BNK +ZST.ZEX - Automatically executed Startup script for BP34* + +Note that clock & datestamping drivers are builtin to Z41. \ No newline at end of file diff --git a/Source/Images/d_bp/u0/zex.com b/Source/Images/d_bp/u0/zex.com new file mode 100644 index 00000000..cd46405d Binary files /dev/null and b/Source/Images/d_bp/u0/zex.com differ diff --git a/Source/Images/d_bp/u10/Z40.HLP b/Source/Images/d_bp/u10/z40.hlp similarity index 100% rename from Source/Images/d_bp/u10/Z40.HLP rename to Source/Images/d_bp/u10/z40.hlp diff --git a/Source/Images/d_bp/u10/Z40A.HLP b/Source/Images/d_bp/u10/z40a.hlp similarity index 100% rename from Source/Images/d_bp/u10/Z40A.HLP rename to Source/Images/d_bp/u10/z40a.hlp diff --git a/Source/Images/d_bp/u10/Z40B.HLP b/Source/Images/d_bp/u10/z40b.hlp similarity index 100% rename from Source/Images/d_bp/u10/Z40B.HLP rename to Source/Images/d_bp/u10/z40b.hlp diff --git a/Source/Images/d_bp/u10/Z40C.HLP b/Source/Images/d_bp/u10/z40c.hlp similarity index 100% rename from Source/Images/d_bp/u10/Z40C.HLP rename to Source/Images/d_bp/u10/z40c.hlp diff --git a/Source/Images/d_bp/u10/Z40D.HLP b/Source/Images/d_bp/u10/z40d.hlp similarity index 100% rename from Source/Images/d_bp/u10/Z40D.HLP rename to Source/Images/d_bp/u10/z40d.hlp diff --git a/Source/Images/d_bp/u10/Z40E.HLP b/Source/Images/d_bp/u10/z40e.hlp similarity index 100% rename from Source/Images/d_bp/u10/Z40E.HLP rename to Source/Images/d_bp/u10/z40e.hlp diff --git a/Source/Images/d_bp/u10/Z40F.HLP b/Source/Images/d_bp/u10/z40f.hlp similarity index 100% rename from Source/Images/d_bp/u10/Z40F.HLP rename to Source/Images/d_bp/u10/z40f.hlp diff --git a/Source/Images/d_bp/u10/Z40G.HLP b/Source/Images/d_bp/u10/z40g.hlp similarity index 100% rename from Source/Images/d_bp/u10/Z40G.HLP rename to Source/Images/d_bp/u10/z40g.hlp diff --git a/Source/Images/d_bp/u14/BPCNFG.CFG b/Source/Images/d_bp/u14/bpcnfg.cfg similarity index 100% rename from Source/Images/d_bp/u14/BPCNFG.CFG rename to Source/Images/d_bp/u14/bpcnfg.cfg diff --git a/Source/Images/d_bp/u14/BPFORMAT.CFG b/Source/Images/d_bp/u14/bpformat.cfg similarity index 100% rename from Source/Images/d_bp/u14/BPFORMAT.CFG rename to Source/Images/d_bp/u14/bpformat.cfg diff --git a/Source/Images/d_bp/u14/COPY.CFG b/Source/Images/d_bp/u14/copy.cfg similarity index 100% rename from Source/Images/d_bp/u14/COPY.CFG rename to Source/Images/d_bp/u14/copy.cfg diff --git a/Source/Images/d_bp/u14/EMULATE.CFG b/Source/Images/d_bp/u14/emulate.cfg similarity index 100% rename from Source/Images/d_bp/u14/EMULATE.CFG rename to Source/Images/d_bp/u14/emulate.cfg diff --git a/Source/Images/d_bp/u14/HDIAG.CFG b/Source/Images/d_bp/u14/hdiag.cfg similarity index 100% rename from Source/Images/d_bp/u14/HDIAG.CFG rename to Source/Images/d_bp/u14/hdiag.cfg diff --git a/Source/Images/d_bp/u14/INIRAMD.CFG b/Source/Images/d_bp/u14/iniramd.cfg similarity index 100% rename from Source/Images/d_bp/u14/INIRAMD.CFG rename to Source/Images/d_bp/u14/iniramd.cfg diff --git a/Source/Images/d_bp/u14/INITDIR.CFG b/Source/Images/d_bp/u14/initdir.cfg similarity index 100% rename from Source/Images/d_bp/u14/INITDIR.CFG rename to Source/Images/d_bp/u14/initdir.cfg diff --git a/Source/Images/d_bp/u14/LDSYS.CFG b/Source/Images/d_bp/u14/ldsys.cfg similarity index 100% rename from Source/Images/d_bp/u14/LDSYS.CFG rename to Source/Images/d_bp/u14/ldsys.cfg diff --git a/Source/Images/d_bp/u14/SETCLOK.CFG b/Source/Images/d_bp/u14/setclok.cfg similarity index 100% rename from Source/Images/d_bp/u14/SETCLOK.CFG rename to Source/Images/d_bp/u14/setclok.cfg diff --git a/Source/Images/d_bp/u14/TDD.CFG b/Source/Images/d_bp/u14/tdd.cfg similarity index 100% rename from Source/Images/d_bp/u14/TDD.CFG rename to Source/Images/d_bp/u14/tdd.cfg diff --git a/Source/Images/d_bp/u15/00-INDEX.TXT b/Source/Images/d_bp/u15/00-INDEX.TXT deleted file mode 100644 index bebff788..00000000 --- a/Source/Images/d_bp/u15/00-INDEX.TXT +++ /dev/null @@ -1,358 +0,0 @@ -ALIAS-1.LBR 74752 07-27-86 -ALIAS-2.LBR 21504 10-30-86 -ALIAS.COM 3840 02-09-85 -ALIAS.HLP 4480 07-13-94 -ALIAS.HQP 3328 06-14-85 -ALIAS.ZEX 1152 07-13-94 -ALIAS.ZQX 1024 06-14-85 -ALIAS0.MAC 8064 07-13-94 -ALIAS0.MQC 5504 06-14-85 -ALIAS1.MAC 9600 07-13-94 -ALIAS1.MQC 6400 06-14-85 -CD.COM 896 02-09-85 -CD.MAC 2816 07-13-94 -CD.MQC 2176 06-14-85 -CLEAND15.LBR 16896 02-26-87 -CLEANDIR.COM 1920 02-09-85 -CLEANDIR.MAC 15232 07-13-94 -CLEANDIR.MQC 10752 06-14-85 -CLNDR13B.LBR 21376 04-18-86 -CMD.COM 896 02-09-85 -CMD.MAC 4864 07-13-94 -CMD.MQC 3584 06-14-85 -CMDFILES.HLP 24576 07-13-94 -CMDFILES.HQP 16384 06-14-85 -CMDRUN.COM 256 02-09-85 -CMDRUN.MAC 896 07-13-94 -CMDRUN.MQC 896 06-14-85 -COMMENT.COM 640 02-09-85 -COMMENT.MAC 3584 07-13-94 -COMMENT.MQC 2688 06-14-85 -COMPARE.HLP 4224 07-13-94 -COMPARE.HQP 2944 06-14-85 -CPSEL.COM 1024 02-09-85 -CPSEL.MAC 6656 07-13-94 -CPSEL.MQC 4608 06-14-85 -CRC.COM 5248 02-09-85 -CRC.MAC 18048 07-13-94 -CRC.MQC 12032 06-14-85 -DBRCPREL.LBR 18688 03-22-87 -DEBUGRCP.AQM 19584 11-28-86 -DEBUGRCP.ASM 27904 07-13-94 -DEV.COM 1792 02-09-85 -DEV.MAC 9088 07-13-94 -DEV.MQC 6272 06-14-85 -DEV10.LBR 6528 02-27-87 -DEVICE.COM 2176 02-09-85 -DEVICE.MAC 10752 07-13-94 -DEVICE.MQC 7168 06-14-85 -DEVICE10.LBR 7552 02-27-87 -DIFF.COM 3200 02-09-85 -DIFF.MAC 14720 07-13-94 -DIFF.MQC 9856 06-14-85 -DIFF21.LBR 10624 02-27-87 -DIR.COM 2688 02-09-85 -DIR.MAC 33152 07-13-94 -DIR.MQC 22912 06-14-85 -DIR14.LBR 19840 02-27-87 -DIRS.HLP 21248 07-13-94 -DIRS.HQP 13312 06-14-85 -DPGFILE.LBR 23168 02-27-87 -DPROG.COM 2944 02-09-85 -DPROG.HLP 7552 07-13-94 -DPROG.HQP 5376 06-14-85 -DPROG.MAC 18944 07-13-94 -DPROG.MQC 12416 06-14-85 -DPROG12.LBR 13440 02-27-87 -DU3.COM 11520 03-03-85 -DU3.HLP 38400 07-13-94 -DU3.HQP 25472 06-14-85 -DU3.MAC 83584 07-13-94 -DU3.MQC 56960 06-14-85 -DU312.LBR 64896 09-01-86 -ECHO.COM 512 02-09-85 -ECHO.MAC 3584 07-13-94 -ECHO.MQC 2816 06-14-85 -ERASE.COM 2560 02-09-85 -ERASE.MAC 10112 07-13-94 -ERASE.MQC 6912 06-14-85 -ERROR1.COM 1536 02-09-85 -ERROR1.MAC 7296 07-13-94 -ERROR1.MQC 4992 06-14-85 -ERROR2.COM 2304 02-09-85 -ERROR2.MAC 8448 07-13-94 -ERROR2.MQC 5632 06-14-85 -ERROR3.COM 640 02-09-85 -ERROR3.MAC 3456 07-13-94 -ERROR3.MQC 2560 06-14-85 -ERROR4.COM 640 02-09-85 -ERROR4.MAC 3968 07-13-94 -ERROR4.MQC 2816 06-14-85 -ERRORX.COM 384 02-09-85 -ERRORX.MAC 1152 07-13-94 -ERRORX.MQC 1024 06-14-85 -FINDF.COM 1792 02-09-85 -FINDF.MAC 21888 07-13-94 -FINDF.MQC 14336 06-14-85 -FINDF26.LBR 22400 09-29-86 -FINDF26A.LBR 18176 11-28-86 -GOTO.COM 768 02-09-85 -GOTO.MAC 3456 07-13-94 -GOTO.MQC 2560 06-14-85 -GRDEMO.LBR 52352 02-24-86 -HELP.COM 3072 02-09-85 -HELP.HLP 896 07-13-94 -HELP.HQP 896 06-14-85 -HELP.MAC 24960 07-13-94 -HELP.MQC 15872 06-14-85 -HELPCK.COM 2048 02-09-85 -HELPCK.MAC 9856 07-13-94 -HELPCK.MQC 6784 06-14-85 -HELPPR.COM 4480 02-09-85 -HELPPR.MAC 28032 07-13-94 -HELPPR.MQC 19328 06-14-85 -HELPSYS.HLP 29440 07-13-94 -HELPSYS.HQP 19072 06-14-85 -IF.COM 2304 03-03-85 -IF.HLP 12672 07-13-94 -IF.HQP 7680 06-14-85 -IF.MAC 10496 07-13-94 -IF.MQC 7168 06-14-85 -IFSTAT.COM 384 02-09-85 -IFSTAT.MAC 1408 07-13-94 -IFSTAT.MQC 1280 06-14-85 -IO.HLP 11776 07-13-94 -IO.HQP 8064 06-14-85 -LDR-UPD.COM 2560 02-09-85 -LDR-UPD.MSG 516 08-09-84 -LDR.COM 2688 02-09-85 -LDR.MAC 13184 07-13-94 -LDR.MQC 8960 06-14-85 -LDR15.LBR 13824 06-14-86 -LGET11.LBR 9088 11-21-86 -LLF11.LBR 9728 11-30-86 -LUZ3.LBR 20608 12-31-85 -LX12.LBR 14976 09-24-86 -LX14.LBR 12416 04-26-87 -MCOPY.COM 4224 02-09-85 -MCOPY.MAC 22016 07-13-94 -MCOPY.MQC 14464 06-14-85 -MCOPY44.LBR 24064 09-24-86 -MCOPY45B.LBR 26112 11-06-86 -MENU.COM 3456 02-09-85 -MENU.HLP 32384 07-13-94 -MENU.HQP 20608 06-14-85 -MENU.MAC 30848 07-13-94 -MENU.MQC 20480 06-14-85 -MENUCK.COM 2560 02-09-85 -MENUCK.MAC 11136 07-13-94 -MENUCK.MQC 7680 06-14-85 -MKDIR.COM 5376 11-24-84 -MKDIR.MAC 19328 07-13-94 -MKDIR.MQC 12544 06-14-85 -MU3.COM 2944 02-09-85 -MU3.HLP 6400 07-13-94 -MU3.HQP 4608 06-14-85 -MU3.MAC 15360 07-13-94 -MU3.MQC 10624 06-14-85 -NDIRS.HLP 15616 07-13-94 -NDIRS.HQP 10112 06-14-85 -NEWTCAP.Z80 6912 07-13-94 -NEWTCAP.ZZ0 3712 02-08-87 -NOTE.COM 128 02-09-85 -NOTE.MAC 896 07-13-94 -NOTE.MQC 768 06-14-85 -PAGE.COM 4608 02-09-85 -PAGE.MAC 23936 07-13-94 -PAGE.MQC 16640 06-14-85 -PATH.COM 1280 02-09-85 -PATH.MAC 8832 07-13-94 -PATH.MQC 5888 06-14-85 -PATH31.LBR 7936 06-04-85 -PPAL.DOC 12553 09-07-86 -PRINT.COM 5376 02-09-85 -PRINT.MAC 28032 07-13-94 -PRINT.MQC 19456 06-14-85 -PRINTHLP.LBR 17280 10-30-86 -PROTECT.COM 3584 02-09-85 -PROTECT.MAC 12416 07-13-94 -PROTECT.MQC 8448 06-14-85 -PWD.COM 1024 02-09-85 -PWD.MAC 4736 07-13-94 -PWD.MQC 3456 06-14-85 -QUIET.COM 512 02-09-85 -QUIET.MAC 2176 07-13-94 -QUIET.MQC 1792 06-14-85 -READ.ME 18437 07-14-94 -READ.MQ 10624 06-14-85 -RECORD.COM 1024 02-09-85 -RECORD.MAC 3840 07-13-94 -RECORD.MQC 2944 06-14-85 -REG.COM 1024 02-09-85 -REG.MAC 4736 07-13-94 -REG.MQC 3328 06-14-85 -RENAME.COM 3456 02-09-85 -RENAME.MAC 13184 07-13-94 -RENAME.MQC 8960 06-14-85 -RENAME31.LBR 15616 04-26-87 -SAK.COM 896 02-09-85 -SAK.MAC 4864 07-13-94 -SAK.MQC 3456 06-14-85 -SETFILE.COM 512 02-09-85 -SETFILE.MAC 2048 07-13-94 -SETFILE.MQC 1664 06-14-85 -SF.COM 9216 03-07-86 -SF.Z80 1274 02-07-86 -SH.COM 3584 02-09-85 -SH.HLP 12928 07-13-94 -SH.HQP 8448 06-14-85 -SH.MAC 16000 07-13-94 -SH.MQC 10496 06-14-85 -SH11.LBR 22272 03-16-87 -SHCTRL.COM 896 02-09-85 -SHCTRL.MAC 2688 07-13-94 -SHCTRL.MQC 2048 06-14-85 -SHDEFINE.COM 2944 02-09-85 -SHDEFINE.MAC 11136 07-13-94 -SHDEFINE.MQC 7552 06-14-85 -SHFILE.COM 512 02-09-85 -SHFILE.MAC 1920 07-13-94 -SHFILE.MQC 1536 06-14-85 -SHOW.COM 7936 02-09-85 -SHOW.MAC 31616 07-13-94 -SHOW.MQC 20480 06-14-85 -SHSET.COM 896 02-09-85 -SHSET.MAC 3712 07-13-94 -SHSET.MQC 2816 06-14-85 -SHUTILS2.LBR 21504 01-27-87 -SHVAR.COM 2944 02-09-85 -SHVAR.MAC 11264 07-13-94 -SHVAR.MQC 7552 06-14-85 -SHVAR11.LBR 13312 03-16-87 -SUB.COM 2560 02-09-85 -SUB.MAC 23424 07-13-94 -SUB.MQC 15360 06-14-85 -SYSENV.AQM 640 06-14-85 -SYSENV.ASM 640 07-13-94 -SYSENV.LIB 3328 07-13-94 -SYSENV.LQB 2560 06-14-85 -SYSFCP.AQM 12032 06-14-85 -SYSFCP.ASM 17536 07-13-94 -SYSFCP1.LIB 5504 07-13-94 -SYSFCP1.LQB 3840 06-14-85 -SYSFCP11.LBR 16256 06-04-85 -SYSFCP2.LIB 5504 07-13-94 -SYSFCP2.LQB 3840 06-14-85 -SYSIOP.AQM 19328 06-14-85 -SYSIOP.ASM 32512 07-13-94 -SYSNDR.AQM 512 06-14-85 -SYSNDR.ASM 384 07-13-94 -SYSNDR.LIB 1280 07-13-94 -SYSNDR.LQB 1152 06-14-85 -SYSRCP.AQM 30080 06-14-85 -SYSRCP.ASM 45056 07-13-94 -SYSRCP.HLP 6144 07-13-94 -SYSRCP.HQP 4608 06-14-85 -SYSRCP1.LIB 10368 07-13-94 -SYSRCP1.LQB 7168 06-14-85 -SYSRCP11.LBR 33408 06-04-85 -SYSRCP2.LIB 10368 07-13-94 -SYSRCP2.LQB 7168 06-14-85 -SYSRCP3.LIB 10368 07-13-94 -SYSRCP3.LQB 7168 06-14-85 -SYSRCP4.LIB 10368 07-13-94 -SYSRCP4.LQB 7168 06-14-85 -T3M-HI2.Z80 9600 07-13-94 -T3M-HI2.ZZ0 5120 04-26-87 -T3T-24-1.Z80 11234 07-31-86 -T3T-24-1.ZQ0 8448 05-31-86 -TCCHECK.COM 1792 02-09-85 -TCCHECK.MAC 5120 07-13-94 -TCCHECK.MQC 3584 06-14-85 -TCMAKE.COM 6016 02-09-85 -TCMAKE.MAC 18944 07-13-94 -TCMAKE.MQC 12416 06-14-85 -TCSELECT.COM 2816 03-03-85 -TCSELECT.MAC 11776 07-13-94 -TCSELECT.MQC 7936 06-14-85 -UNERASE.COM 1664 02-09-85 -UNERASE.MAC 14080 07-13-94 -UNERASE.MQC 9472 06-14-85 -VF-BOX11.LBR 33536 01-27-87 -VF41.IQF 11008 09-01-86 -VF41H.LBR 27776 09-01-86 -VF42A.LBR 31744 11-30-86 -VFILER.COM 11776 03-03-85 -VFILER.HLP 21120 07-13-94 -VFILER.HQP 13696 06-14-85 -VFILER.MAC 98688 07-13-94 -VFILER.MQC 69120 06-14-85 -VFILR4-1.LBR 26240 07-28-86 -VFILR4-2.LBR 160512 12-08-86 -VMENU.COM 5888 02-09-85 -VMENU.HLP 32384 07-13-94 -VMENU.HQP 20480 06-14-85 -VMENU.MAC 53632 07-13-94 -VMENU.MQC 36608 06-14-85 -VMENU24.LBR 77184 11-06-86 -VMENUCK.COM 2688 02-09-85 -VMENUCK.MAC 11264 07-13-94 -VMENUCK.MQC 7680 06-14-85 -VMENUFUN.LBR 9728 02-14-87 -WHEEL.COM 1408 02-09-85 -WHEEL.MAC 4096 07-13-94 -WHEEL.MQC 3072 06-14-85 -WYSE.DPG 2131 07-31-86 -XD.COM 3584 02-09-85 -XD.MAC 18432 07-13-94 -XD.MQC 12032 06-14-85 -XDIR.COM 7936 02-09-85 -XDIR.MAC 38912 07-13-94 -XDIR.MQC 24960 06-14-85 -Z3BASE1.LIB 8448 07-13-94 -Z3BASE1.LQB 6016 06-14-85 -Z3BASE2.LIB 8192 07-13-94 -Z3BASE2.LQB 5888 06-14-85 -Z3FILES.PH1 22171 11-04-84 -Z3FILES.PH2 18560 07-13-94 -Z3FILES.PQ2 9984 06-14-85 -Z3FILES2.PH2 18560 07-13-94 -Z3FILES2.PQ2 9984 06-14-85 -Z3HDR1.LIB 19200 07-13-94 -Z3HDR1.LQB 13056 06-14-85 -Z3HDR2.LIB 19200 07-13-94 -Z3HDR2.LQB 13056 06-14-85 -Z3LDRBUG.LBR 5632 02-09-85 -Z3LOC.COM 896 02-09-85 -Z3LOC.MAC 3840 07-13-94 -Z3LOC.MQC 2816 06-14-85 -Z3LOC11.LBR 4096 02-27-87 -Z3RES.HLP 8192 07-13-94 -Z3RES.HQP 5760 06-14-85 -Z3TCAP.AQM 19200 06-14-85 -Z3TCAP.ASM 28288 07-13-94 -Z3TCAP.HLP 40192 07-13-94 -Z3TCAP.HQP 23424 06-14-85 -Z3TCAP.TCP 7680 07-13-94 -Z3TCAP.TQP 2688 06-14-85 -Z3TCAP22.LBR 12672 02-14-87 -Z3UTIL1.HLP 29952 07-13-94 -Z3UTIL1.HQP 19968 06-14-85 -Z3UTIL2.HLP 21248 07-13-94 -Z3UTIL2.HQP 14080 06-14-85 -Z3UTIL3.HLP 6656 07-13-94 -Z3UTIL3.HQP 4992 06-14-85 -ZCPR3.AQM 44544 06-14-85 -ZCPR3.ASM 66816 07-13-94 -ZCPR3.HLP 3840 07-13-94 -ZCPR3.HQP 2944 06-14-85 -ZCPR3.INS 3968 07-13-94 -ZCPR3.IQS 2816 06-14-85 -ZCPR3DIR.BQG 2944 02-09-85 -ZCPR3DIR.BUG 3840 07-13-94 -ZEX.AQM 30976 06-14-85 -ZEX.ASM 47104 07-13-94 -ZEX.COM 4992 02-09-85 -ZEX.ZEX 4096 07-13-94 -ZEX.ZQX 3072 06-14-85 -ZSYSTEM.INS 2061 07-31-86 diff --git a/Source/Images/d_bp/u15/ALIAS-1.LBR b/Source/Images/d_bp/u15/ALIAS-1.LBR deleted file mode 100644 index 8bb3bc1c..00000000 Binary files a/Source/Images/d_bp/u15/ALIAS-1.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/ALIAS-2.LBR b/Source/Images/d_bp/u15/ALIAS-2.LBR deleted file mode 100644 index 0bf294fc..00000000 Binary files a/Source/Images/d_bp/u15/ALIAS-2.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/ALIAS.COM b/Source/Images/d_bp/u15/ALIAS.COM deleted file mode 100644 index f03006d0..00000000 Binary files a/Source/Images/d_bp/u15/ALIAS.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ALIAS.HLP b/Source/Images/d_bp/u15/ALIAS.HLP deleted file mode 100644 index b41d8e90..00000000 --- a/Source/Images/d_bp/u15/ALIAS.HLP +++ /dev/null @@ -1,167 +0,0 @@ -; - - The ZCPR3 ALIAS Facility - - A - The ALIAS Command - - E - ALIAS Examples - - S - Summary of ALIAS Variables - -:A - -Command: ALIAS 1.1 - -Syntax: - - ALIAS <-- Define New Command -or - ALIAS dir:ufn <-- Redefine Old Command - -Function: - - Thå  ALIAÓ facilitù ió thå scripô expansioî utilitù  oæ -ZCPR3®  Aî Aliaó ió á COÍ filå createä bù thå ALIAÓ prograí -whicè   containó   onå  oò  morå  commandó   (separateä   bù -semicolons© tï bå placeä iî thå Commanä Linå  Buffer®  Wheî -thå  Aliaó ió invoked¬  parameteró froí thå commanä linå arå -implanteä  intï thå scripô containeä withiî thå  Alias¬  anä -thå  resultinç ne÷ commanä linå ió placeä intï  thå  Commanä -Linå Buffeò anä executed. - - -Options: - None - -Comments: - - ZCPR³ MUSÔ bå implementeä witè aî Externaì Commanä Linå -Buffer in order for ALIAS to work. - - Thå  scripô  oæ  thå  internaì  commanä  linå  supportó -parameteò  passinç iî á manneò similaò tï ZEØ anä SUB®  Thå -variableó  $n¬  wherå ° <½ î <½ 9¬  maù bå placeä  intï  thå -script¬ anä thå correspondinç parameteró wilì bå substituteä -foò thå indicateä variables® Thå variablå $° ió thå namå oæ -thå Aliaó itself® Thå variablå $ª ió thå entirå taiì oæ thå -command line. - - - Twï  additionaì variables¬  $Ä anä $U¬  arå  available® -$Ä  expandó intï thå letteò oæ thå disë whicè waó loggeä  iî -aô  thå timå thå Aliaó waó expandeä (thå homå disk)¬  anä $Õ -expandó intï á numbeò (iî ASCIÉ chars© representinç thå useò -areá whicè waó loggeä iî aô thå timå thå Aliaó waó  expandeä -(the home user). - - Thå  ZCPR³ Systeí filå nameó arå availablå tï thå Aliaó -aó thå variableó $Fî anä $Nn¬ wherå ± <½ î <½ 4® $F± referó -tï FILENAME.TYÐ oæ Systeí Filå 1¬  $N± referó tï FILENAMÅ oæ -Systeí Filå 2¬  etc®  Notå thaô thå SETFILÅ commanä ió useä -to define the contents of the System file names. - - '$$' expands into a single '$'. - - - Summary of Alias Variables - - $0 - Name of Alias - $n - Parameter from Command Line (1 <= n <= 9) - - $* - Tail of Command Line (everything after the verb) - - $D - Home Disk - $U - Home User - - $Fn - FILENAME.TYP of System File n (1 <= n <= 4) - $Nn - FILENAME of System File n - - $$ - The character '$' - - -Selected Error Messages: - - "Ovfl¢ meanó thaô thå expandeä commanä  line¬  combineä -witè  thå  remaindeò  oæ thå contentó oæ  thå  commanä  linå -buffer, is too long to fit in the command line buffer. - -Examples of Use: - - ALIAS - -- define Alias - - ALIAS alias - -- display script of "alias.COM" and edit - -:S - - Summary of Alias Variables - - $0 - Name of Alias - $n - Parameter from Command Line (1 <= n <= 9) - - $* - Tail of Command Line (everything after the verb) - - $D - Home Disk - $U - Home User - - $Fn - FILENAME.TYP of System File n (1 <= n <= 4) - $Nn - FILENAME of System File n - - $$ - The character '$' - -:E - - Examples of Aliases - -Case 1: - - Thå  useò ió constantlù issuinç thå followinç  commandó -in the order indicated: - - ASM myfile.BBZ - LOAD myfile - - He can generalize it with the following Alias script: - - ASM $1.BBZ;LOAD $1 - - If this Alias is named MYASM.COM, then typing - -"MYASM test" will be equivalent to "ASM test.BBZ;LOAD test" - - -Case 2: - - Thå  useò haó twï printeró oî hió system®  Hå ió usinç -redirectablå I/Ï aó implementeä undeò ZCPR3¬  anä hå haó twï -versionó oæ Worä Staò (trademark¬  Micropro© - onå foò  eacè -printer®  Hå  caî creatå aî Aliaó containinç thå  followinç -script: - - Script Meaning - - IÆ NEC=$² Checë tï seå iæ 2nä parí ió NEC - DEV L NEC If so, assign LST to NEC - WSN $1 and run NEC version of WS - ELSE If not ... - DEV L TTY assign LST to TTY - WST $1 and run TTY version of WS - FI - - If the Alias was named WSTAR, then: - - "WSTAR myfile.txt" - -would be equivalent to - - DEV L TTY;WST myfile.txt - -and - - "WSTAR myfile.txt NEC" - -would be equivalent to - - DEV L NEC;WSN myfile.txt - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ALIAS.ZEX b/Source/Images/d_bp/u15/ALIAS.ZEX deleted file mode 100644 index c94e8866..00000000 --- a/Source/Images/d_bp/u15/ALIAS.ZEX +++ /dev/null @@ -1,64 +0,0 @@ -; -; Command File to Assemble the ALIAS Program by Richard Conn -; - -; -; 1. Check for Needed Files -; These files are listed below in the IF EXIST tests -; The availability of PIP.COM, M80.COM, and L80.COM is assumed -; -if exist alias0.mac -if exist alias1.mac -if exist a:z3lib.rel -if exist a:syslib.rel -if exist z3base.lib -if exist sysenv.lib - -; -; 2. Perform Assemblies of ALIAS0.MAC and ALIAS1.MAC -; -m80 =alias0 -m80 =alias1 - -; -; 3. Allow User to Abort if Errors Occurred -; -if input - -; -; 4. Cleanup Files -; -era alias0.bak -era alias1.bak -era alias.com - -; -; 5. Link -; -l80 /p:100,alias0,a:z3lib/s,a:syslib/s,alias0/n,/u,/e -l80 /p:100,alias1,a:z3lib/s,a:syslib/s,alias1/n,/u,/e - -; -; 6. Combine ALIAS0.COM and ALIAS1.COM to Form ALIAS.COM -; -pip alias.com=alias0.com,alias1.com - -; -; 7. Clean Up Some Files -; -era alias0.com -era alias1.com - -; -; 8. Exit IF INPUT (1 Level) and Remove REL Files -; -fi -era alias0.rel -era alias1.rel - -; -; 9. Exit IFs (6 Levels) -; -fi;fi;fi;fi;fi;fi - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ALIAS0.MAC b/Source/Images/d_bp/u15/ALIAS0.MAC deleted file mode 100644 index fd0e76fe..00000000 --- a/Source/Images/d_bp/u15/ALIAS0.MAC +++ /dev/null @@ -1,432 +0,0 @@ -; -; Program: ALIAS0 -; Author: Richard Conn -; Version: 1.1 -; Date: 10 Jun 84 -; Previous Versions: 1.0 (5 Mar 84) -; -version equ 11 - -; -; The purpose of ALIAS0 is to create aliases using the ALIAS1 -; program. -; - -; -; Environment Definition -; - MACLIB Z3BASE.LIB - -; -; Basic Equates -; -buffer equ 4000h ;1K (approx) buffer -tbuff equ 80h -fcb equ 5ch -cr equ 0dh -lf equ 0ah - -; -; External References -; - ext $memry - ext z3init,qprint,getwhl - ext print,sksp,bbline,capine,crlf,pfn1,retud,logud,padc - ext hmovb,sfa,cout,ccout,pstr,zfname - ext f$open,f$read,f$close,f$make,f$delete,f$write,f$exist,initfcb - -; -; Key Equates for Address Definition of Environment -; -envdefn equ 103H ;Beginning of Environment Definition -envclas equ 108H ;Address of Environment Descriptor Class - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env -; -; Print Banner -; - call qprint - db 'ALIAS, Version ' - db (version/10)+'0','.',(version mod 10)+'0',0 -; -; Check for File -; - xra a - sta flflag ;clear file loaded flag - lxi h,fcb+1 ;pt to file name - mov a,m ;get first char - cpi ' ' ;no name if space - jz create ;create an alias if no name - cpi '/' ;help? - jnz start0 -; -; Help Message -; - call print - db cr,lf,'ALIAS -- Create Alias Commands' - db cr,lf,'Syntax:' - db cr,lf,' ALIAS <-- Define New Command' - db cr,lf,'or' - db cr,lf,' ALIAS dir:cmndname <-- Redefine Old Command' - db 0 - ret - -; -; Load ALIAS File -; -start0: - call setcom ;set file type of file in FCB to COM if not already - call retud ;get current DU in BC - dcx h ;pt to disk - mov a,m ;get disk - ora a ;no current disk? - jz start1 ;use current disk - dcr a ;set disk (A=0) - mov b,a -start1: - mvi m,0 ;set current disk - lxi d,13 ;pt to user number - push h ;save ptr to FCB - dad d ;pt to user - mov c,m ;get user - pop d ;pt to FCB - call logud ;log into dir in BC - lxi h,buffer ;pt to file storage buffer - call f$open ;open alias file for input - jz load ;load file - call print - db cr,lf,' Alias File ',0 - inx d ;pt to file name - call pfn1 ;print it - call print - db ' Not Found',0 - ret -; -; Load Alias File -; -load: - lxi h,buffer ;pt to load buffer - mvi c,9 ;set block count -load1: - lxi d,fcb ;pt to FCB - call f$read ;read next block - jnz load2 - lxi d,tbuff ;pt to buffer - xchg - mvi b,128 ;128 bytes - call hmovb - xchg ;DE pts to next block - dcr c ;count down - jnz load1 -; -; Error - Not an Alias File -; -noalias: - call print - db cr,lf,' File ',0 - lxi d,fcb+1 - call pfn1 - call print - db ' is Not an Alias',0 - ret -; -; Load Complete - Check for Alias File Structure -; -load2: - call f$close ;close input file - lhld buffer+1 ;get address of START - lxi d,buffer-100H - dad d ;pt to actual address - lxi d,9 ;skip to ALIAS ID - dad d - lxi d,aliasid ;compare - mvi b,8 ;8 chars -acheck: - ldax d ;get char - cmp m ;compare - jnz noalias - inx h ;pt to next - inx d - dcr b ;count down - jnz acheck - shld oldaline ;save ptr to old alias command line - mvi a,0ffh ;set file loaded flag - sta flflag -; -; Create New Alias -; -create: - lda flflag ;check for file loaded - ora a ;0 if not - jz cr1 -; -; Display Data on Old Alias -; - call print - db cr,lf,' Alias Name: ',0 - lxi h,fcb+1 ;pt to name - mvi b,8 ;8 chars -cr0: - mov a,m ;print name - call cout - inx h ;pt to next char - dcr b ;count down - jnz cr0 - call print - db cr,lf,' Old Alias Command Line:',0 - lhld oldaline - mvi b,1 ;set line count -cr0a: - mov a,m ;check for done - ora a - jz cr1 - call crlf ;new line - mov a,b ;print line number - call padc - inr b ;increment count - call print ;print prompt - db ' --> ',0 -cr0b: - mov a,m ;get char - ora a - jz cr1 - call ccout ;print char with control char processing - inx h ;pt to next - cpi ';' ;next logical line? - jz cr0a - jmp cr0b - -; -; Input Alias Command from User -; -cr1: - call getwhl ;get wheel byte - jnz cr1a - call print - db cr,lf,' Modification of Alias Not Permitted',0 - ret -; -; Input Alias from User -; -cr1a: - call print - db cr,lf - db cr,lf,' Input Alias (RETURN to Abort)',cr,lf,' --> ',0 - mvi a,0ffh ;input line from user - call bbline - call sksp ;skip to non-blank - mov a,m ;get char - ora a ;any input? - rz - push h ;save ptr -; -; Set Buffers in New Alias to Reflect the ALIAS0 Buffers -; - call codend ;pt to new alias - inx h ;pt to start of buffers - inx h - inx h - lxi d,envdefn ;pt to environment definition - mvi b,8 ;prepare to copy 8 bytes for class 1 - ; bytes are: DB 'Z3ENV',1 - ; DW envaddr - lda envclas ;get code for class of alias - cpi 1 ;class 1 is address of Env Desc only - jz cr1b - mvi b,100H-3 ;prepare to copy an entire env desc -; -; Copy the Buffers Over -; -cr1b: - ldax d ;copy environment definition into new alias - mov m,a - inx h ;advance - inx d - dcr b ;count down - jnz cr1b -; -; Prep to Copy New Command Into Alias -; - call codend ;pt to new alias command buffer - inx h - mov e,m ;get address of START - inx h - mov d,m - lxi h,17 ;pt to buffer at START+17 - dad d - lxi d,-100H ;compute offset - dad d ;HL contains offset - xchg - call codend - dad d ;HL pts to absolute address - mvi b,255 ;check for overflow (max number of chars) - pop d ;pt to new command -; -; Copy New Command into ALIAS File -; -cr2: - ldax d ;get char - mov m,a ;put char - ora a ;done? - jz cr3 - inx h ;pt to next - inx d - dcr b ;count down - jnz cr2 - call print - db cr,lf,' Command Too Long for Buffer - Reenter',0 - jmp create -; -; ALIAS Command Line Copied -; -cr3: - lda flflag ;file loaded? - ora a ;0=no - jnz write - call print - db cr,lf,' Name of ALIAS Command (RETURN to Abort)? ',0 - mvi a,0ffh ;capitalize - call bbline - call sksp ;skip to non-blank - mov a,m - ora a - jz create - lxi d,fcb ;pt to FCB - call zfname ;convert and place in FCB - call setcom ;set file type to COM if not already - call retud ;get current DU - lda fcb ;get disk - ora a ;default? - jz cr4 - dcr a ;disk A = 0 - mov b,a -cr4: - lda fcb+13 ;get user - mov c,a - call logud -; -; Write File whose Name is in FCB -; -write: - lxi d,fcb ;check for file - call initfcb ;clear FCB - call f$exist ;check for existence - jz write1 - call print - db cr,lf,' File ',0 - lxi d,fcb+1 - call pfn1 - call print - db ' Exists - Overwrite (Y/N)? ',0 - call capine - call crlf - cpi 'Y' - rnz ;abort if not Y - lxi d,fcb ;clear file attributes - xra a - call sfa ;set file attributes to R/W DIR - call f$delete ;delete file -; -; Create New File -; -write1: - lxi d,fcb ;pt to FCB - call initfcb ;init it - call f$make ;create file - mvi c,8 ;8 sectors - call codend ;pt to file -write2: - lxi d,tbuff ;copy sector into buffer - mvi b,128 ;128 bytes - call hmovb - lxi d,fcb ;write block - call f$write - jnz werr - dcr c ;count down - jnz write2 - call f$close ;close file - call print - db cr,lf,' Alias Created',0 - ret -werr: - call print - db cr,lf,' Error in Creating File',0 - ret - -; -; Determine End of Code to Nearest 128 bytes -; -codend: - push d - lhld $memry ;get next available byte - mov a,l ;get low - ani 80h ;set MSB - mov l,a - lxi d,128 ;next 128 bytes - dad d - pop d - ret - -; -; Set File Type of File in FCB to COM if Not Already Set -; -setcom: - lda fcb+9 ;get first char of file type - cpi ' ' - rnz - push h - push d - push b - lxi h,comtyp ;set COM type - lxi d,fcb+9 ;copy into file type - mvi b,3 ;3 bytes - call hmovb - pop b - pop d - pop h - ret - -; -; Buffers -; -comtyp: - db 'COM' ;COM File Type -aliasid: - db 'Z3 ALIAS' ;ALIAS File ID -flflag: - ds 1 ;file loaded flag -oldaline: - ds 2 ;ptr to old alias line - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ALIAS1.MAC b/Source/Images/d_bp/u15/ALIAS1.MAC deleted file mode 100644 index 3b9f8be2..00000000 --- a/Source/Images/d_bp/u15/ALIAS1.MAC +++ /dev/null @@ -1,514 +0,0 @@ -; -; Program: ALIAS1 -; Author: Richard Conn -; Version: 1.1 -; Date: 10 June 84 -; Previous Versions: 1.0 (5 Mar 84) -; -version equ 11 - -; -; The purpose of ALIAS1 is to load the Command Line Buffer with -; a command line stored within ALIAS1, extracting parameters using the -; SUBMIT file convention ($n) as they are referenced in the new command -; line. Upon successful build, ALIAS1 runs the new command line by simply -; returning to ZCPR3. -; - -; -; Macros -; - MACLIB Z3BASE.LIB - -; -; Basic Equates -; -tbuff equ 80h - -; -; External References -; - ext z3init,getefcb,getcl1,getenv,getfn2 - ext eprint,codend,sksp,retud,caps - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - jmp start1 ;skip command line buffer -; -; ALIAS ID at START+9 -; - db 'Z3 ALIAS' -; -; Internal Command Line Buffer -; This buffer address can be determined from START+17, where the -; value of START is obtained from the 2nd and 3rd bytes of ALIAS1. -; -clbuf: - db 0 ;set to empty - ds 255 ;allow 256 bytes -; -; Resume ALIAS1 -; -start1: - call codend ;pt to free space in which to build new line - lxi d,clbuf ;pt to buffer - xchg ;HL pts to target line, DE pts to buffer -; -; Process Next Char from Target Command Line -; -nxtchar: - mov a,m ;get next char - ora a ;end of line? - jz done - cpi '$' ;possible passed parameter? - jz param - stax d ;store next char - inx h ;pt to next - inx d - jmp nxtchar -; -; Process Possible Parameter -; -param: - lxi b,nxtchar ;establish return address - push b ;... on stack - inx h ;get parameter char - mov a,m - call caps ;capitalize - cpi '*' ;entire tail? - jz paraml - cpi 'D' ;current disk? - jz paramd - cpi 'U' ;current user? - jz paramu - cpi 'F' ;System Filename.Typ? - jz paramf - cpi 'N' ;System Filename? - jz paramn -; cpi 'T' ;System Typ? -; jz paramt - sui '0' ;convert - jc noparam - cpi 10 ;range? - jnc noparam - ora a ;parameter 0 = original name - jz oname - mov b,a ;count in B (1 or more) - inx h ;pt to next char - push h ;save ptr - lxi h,tbuff+1 ;pt to input line -; -; Advance to Desired Parameter -; -param1: - call sksp ;skip to non-blank - mov a,m ;check for done - ora a - jz paramx - dcr b ;count down - jz param3 ;got it -; -; Skip Over This Parameter -; -param2: - mov a,m ;skip to space or EOL - inx h ;pt to next - cpi ' ' ;space - jz param1 - ora a ;EOL - jz paramx - jmp param2 ;continue -; -; Extract Parameter Into Target Buffer -; -param3: - mov a,m ;get char - cpi ' '+1 ;done? - jc paramx - stax d ;store char - inx h ;advance - inx d - jmp param3 -; -; Resume Processing of Target Command -; -paramx: - pop h ;restore ptr to next char - ret ;resume at next char -; -; Parameter is for System Filename.typ -; -paramf: - call getfnum ;get file number - rz ;resume if error - push h ;save ptr to next char - call ptfn ;set ptr to file name - call putn ;put file name - mvi a,'.' ;dot - stax d - inx d - call putt ;put file type - pop h ;restore ptr - ret -; -; Parameter is for System Filename -; -paramn: - call getfnum ;get file number - rz ;resume if error - push h ;save ptr to next char - call ptfn ;set ptr to file name - call putn ;put file name - pop h ;restore ptr - ret -; -; Parameter is for System Typ -; -;paramt: -; call getfnum ;get file number -; jz nxtchar ;resume if error -; push h ;save ptr to next char -; call ptfn ;set ptr to file name -; mvi a,8 ;add 8 to get to file type -; add l -; mov l,a -; mov a,h -; aci 0 -; mov h,a -; call putt ;put file type -; pop h ;restore ptr -; jmp nxtchar - -; -; Get File Number (1 to 4) -; If valid number, return with value in A and HL pting to next char -; If not valid, return with Z and HL pting to next char (the number) -; -getfnum: - inx h ;pt to number - mov a,m ;get char - sui '1' ;convert - jc getfne ;error if less - cpi 4 ;range? - jnc getfne ;error if more - inx h ;pt to next char - ret ;NZ from CPI 4 -getfne: - xra a ;return Z - ret -; -; Pt to File Name whose Number (1-4) is in A -; -ptfn: - mov b,a ;number in B - call getfn2 ;pt to file name 2 - push d ;save DE - mov a,b ;file 0? - ora a - jz ptfnx - lxi d,11 ;size of file name and type -ptfn1: - dad d ;pt to next - dcr b ;count down - jnz ptfn1 -ptfnx: - pop d ;restore DE - ret -; -; Put File Name pted to by HL -; -putn: - mvi b,8 ;8 chars - jmp putc -; -; Put File Type pted to by HL -; -putt: - mvi b,3 ;3 chars -; -; Copy chars from HL to DE for up to 8 bytes - flush if space -; -putc: - mov a,m ;get next char - cpi ' ' ;skip spaces - jz putc1 - stax d ;put next char - inx d ;pt to next -putc1: - inx h ;pt to next - dcr b ;count down - jnz putc - ret -; -; Parameter is for Disk Letter -; -paramd: - call retud ;get DU in BC - mov a,b ;get disk letter - adi 'A' ;convert to ASCII - stax d ;store char - inx d ;pt to next - inx h ;pt to next char - ret -; -; Parameter is for User Number -; -paramu: - call retud ;get DU in BC - mov a,c ;get user number - mvi b,10 ;compute 10's - mvi c,'0' -pmu1: - sub b ;subtract 10's - jc pmu2 - inr c ;increment 10's - jmp pmu1 -pmu2: - add b ;add B back in - adi '0' ;convert to ASCII - mov b,a ;10's in C, 1's in B - mov a,c - cpi '0' ;no leading 0's - jz pmu3 - stax d ;store char - inx d ;pt to next -pmu3: - mov a,b ;get 1's - stax d ;store char - inx d ;pt to next - inx h ;pt to next char - ret -; -; Parameter is command line tail -; -paraml: - inx h ;pt to char after parameter letter - push h ;save ptr to parameter - lxi h,tbuff+1 ;pt to tail -paramt1: - mov a,m ;copy tail into line - ora a ;end of tail? - jz paramt2 - stax d ;store char - inx h ;pt to next - inx d - jmp paramt1 -paramt2: - pop h ;pt to next char in script - ret ;continue processing -; -; Form assumed to be $$ -; -noparam: - mvi a,'$' ;store '$' - stax d - inx d ;pt to next chars - inx h - ret -; -; $0 - ALIAS Command Name -; -oname: - inx h ;pt to next char - push h ;save ptr - call getefcb ;pt to FCB - jz paramx ;skip if no external FCB - inx h ;pt to first char - mvi b,8 ;at most 8 chars -on1: - mov a,m ;copy into output line - cpi ' ' ;done if space - jz paramx - stax d ;store char - inx h ;pt to next - inx d - dcr b ;count down - jnz on1 - jmp paramx - -; -; Done -- Buffer is Loaded -; -done: - xra a ;store ending 0 - stax d - call codend ;pt to buffer - mov a,m ;skip if empty line - ora a - rz -; -; Determine if ZCPR3 Environment Support is Available for Command Line -; - push h ;save ptr to line - call getenv ;get environment - mov a,h - ora l - jz done0 -; -; Get environment from descriptor -; - call getcl1 ;get command line data - mov b,a ;save char count - mov a,h ;check for no command line - ora l - jz done0 - mov a,b ;restore char count - ora a ;check for no chars - jnz done1 -; -; Get environment from MACRO File -; -done0: - lxi h,z3cl ;pt to command line from macro expansion - mvi a,z3cls ;get size of command line -; -; Store Command Line -; -done1: - pop d ;DE pts to line - call putcl ;store in command line - rnz ;return to ZCPR3 for processing if OK - call eprint - db 'Ovfl',0 - ret -; -; PUTCL stores a command line in the ZCPR3 command line buffer. -; This command line is pted to by DE. CL Buffer is pted to by HL. -; Size in A. On return, A=0 and Zero -; Flag Set if command line overflow is possible (no change to command line). -; -putcl: - shld clbfr ;save ptr to command line buffer - ora a ;any command line? - jz nocl - mov b,a ;char count in B - xchg ;HL pts to new line - push h ;save ptr to new line -pcl2: - mov a,m ;go to end of line - ora a ;at end? - jz pcl3 - inx h ;pt to next - dcr b ;count down - jnz pcl2 - pop h ;clear stack -; -; Command Line Buffer Overflow -; -nocl: - xra a ;error return - ret -; -; At End of New Command Line (ptr on stack) -; Ptr to first char of new command line on stack -; HL pts to ending 0 of new command line -; B = number of chars remaining before overflow of Z3 command line -; -pcl3: - push h ;save ptr to last byte in case of error - lhld clbfr ;pt to tail of command line - mov e,m - inx h - mov d,m - xchg ;HL pts to command line tail - pop d ;restore ptr to last byte of command line - push d - mov a,m ;get first char of tail - cpi ';' ;continuation? - jz pcl4 - ora a ;done? - jz pcl4 - mvi a,';' ;set continuation char - stax d - inx d - dcr b ;count down - jz pcl5 ;overflow -; -; Copy tail onto end of new command line -; -pcl4: - mov a,m ;get next char - stax d ;store it - inx h ;pt to next - inx d - ora a ;done? - jz pcl6 - dcr b ;count down - jnz pcl4 -; -; Command Line too Long -; -pcl5: - pop h ;get ptr to end of old line - mvi m,0 ;store ending 0 - pop psw ;clear stack - jmp nocl -; -; New Command Line OK -; -pcl6: - pop psw ;clear stack - lhld clbfr ;pt to command line buffer - lxi d,4 ;pt to first char in buffer - xchg - dad d - xchg - mov m,e ;store address - inx h - mov m,d ;DE pts to first char of buffer - pop h ;HL pts to first char of new line -; -; Copy New Command Line into Buffer -; -pcl7: - mov a,m ;copy - stax d - inx h - inx d - ora a ;EOL? - jnz pcl7 -; -; Exit with OK Code -; - xra a ;set NZ - dcr a - ret - -; -; Buffers -; -clbfr: - ds 2 ;ptr to command line - - end - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/CD.COM b/Source/Images/d_bp/u15/CD.COM deleted file mode 100644 index adc74b39..00000000 Binary files a/Source/Images/d_bp/u15/CD.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/CD.MAC b/Source/Images/d_bp/u15/CD.MAC deleted file mode 100644 index 14eeaf8d..00000000 --- a/Source/Images/d_bp/u15/CD.MAC +++ /dev/null @@ -1,152 +0,0 @@ -; -; Program: CD -; Version: 3.0 -; Author: Richard Conn -; Date: 12 Apr 84 -; Previous Versions: None -; Derivation: In Concept from CD 2.4 for ZCPR2 -; -version equ 30 -z3env set 0f400h - -; -; CD is used to log into a new directory by name or DU (DIR or DU forms) -; and to automatically run ST once there if it is available. -; -; Syntax: -; CD or CD // <-- Print Help -; CD dir: <-- Log In and Run ST.COM -; - -; -; OS Equates et al -; -cpm equ 0 -udbyte equ 4 -bdos equ 5 -fcb equ 5ch -tbuff equ 80h -tpa equ 100h -cr equ 0dh -lf equ 0ah - -; -; SYSLIB and Z3LIB Functions -; - ext z3init,z3log - ext retud,moveb,initfcb,putcl,eprint,pafdc,cout,dutdir - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - lda fcb+1 ;check for help - cpi '/' ;help? - jnz cd - call eprint - db 'CD, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db cr,lf,'Syntax:' - db cr,lf,' CD dir: or CD du: <-- Change Directory' - db 0 - ret -; -; Log into DU converted by ZCPR3 -; -cd: - lxi d,fcb ;pt to FCB - call z3log ;login to DU - call retud ;set DU in the UD byte - mov a,c ;set user - rlc ;rotate right 4 bits - rlc - rlc - rlc - ani 0f0h ;mask - mov c,a ;save for now - mov a,b ;get disk - ani 0fh ;mask - ora c ;mask in user - sta udbyte ;save value in UD byte -; -; Print New Directory -; - call eprint - db ' Logging Into ',0 - call retud ;get DU in BC - mov a,b ;get disk - adi 'A' - call cout - mov a,c ;get user - call pafdc ;print number - mvi a,':' ;print colon - call cout - call dutdir ;convert to name - jz runfile ;run file if no name - mvi b,8 ;8 chars max to name (pted to by HL) -prtname: - mov a,m ;get name char - cpi ' ' ;done? - jz runfile - inx h ;pt to next - call cout - dcr b ;count down - jnz prtname -; -; Look for File -; -runfile: - lxi h,stfile ;pt to FCB - lxi d,fcb ;copy into FCB - mvi b,12 ;12 bytes - call moveb - call initfcb ;init FCB - mvi c,15 ;try to open file - call bdos ;use BDOS - cpi 0ffh ;not found? - jz cpm ;done - no ST.COM - lxi h,stcl ;pt to default command line - call putcl ;store it in ZCPR3 CL Buffer - jnz cpm ;abort to OS if done - call eprint ;print error message - db ' Command Line Overflow',0 - jmp cpm - -; -; Buffers -; -stfile: - db 0,'ST COM' ;default command -stcl: - db 'ST',0 ;default command line - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/CLEAND15.LBR b/Source/Images/d_bp/u15/CLEAND15.LBR deleted file mode 100644 index 1efb96bd..00000000 Binary files a/Source/Images/d_bp/u15/CLEAND15.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/CLEANDIR.COM b/Source/Images/d_bp/u15/CLEANDIR.COM deleted file mode 100644 index 3199d20c..00000000 Binary files a/Source/Images/d_bp/u15/CLEANDIR.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/CLEANDIR.MAC b/Source/Images/d_bp/u15/CLEANDIR.MAC deleted file mode 100644 index 4d5d71e2..00000000 --- a/Source/Images/d_bp/u15/CLEANDIR.MAC +++ /dev/null @@ -1,857 +0,0 @@ -; -; Program: CLEANDIR -; Derivation: SAP 3.8 (see following history for authors) -; Derivation By: Richard Conn -; Version: 1.1 -; Date: 28 November 1984 -; Previous Versions: 1.0 (20 June 84) -; -; bug fix ;841201 Peter T Lyman -; Version 1.1P -; -; Search for ';841201' to locate the code -; -; CLEANDIR can and does wipe out the operating system -; (also known as a crash) whenever the maximum size of -; the directory (DRM) exceeds the available memory.... -; -; Maybe that is a good feature, since you at least don't -; hurt the disk... -; -; However on my hard disk I have two platters with -; DRM equal to 2048.... In this case CLEANDIR crashes... -; -; The fix that I have added (I did this with an early version -; of SAP) gives you a choice.... If DRM is greater than -; the space available betwwen BUF and BDOS, you are given -; a choice with proceeding if the actual number of directory -; entries is less than or equal to the space available.... -; If not you ABORT..... -; -; The down side risk of this modification is that if you -; proceed ("Y") when the actual number of files exceeds -; the space available, you lose all the directories entries -; which don't fit in the available space.... -; -; With out the fix the system crashes and you cannot clean the -; directory... With the fix you can clean the directory, but -; you can lose files if you don't pay attention.... -; - -vers equ 11 -z3env equ 0f400h - -; -; SYSLIB and Z3LIB References -; - ext z3init,z3log - ext eprint,cout - ext codend - ext phlfdc ;841201 - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Environment - -; v3.8 SORT AND PACK CP/M DISK DIRECTORY - 10/16/83 -; -; THIS PROGRAM READS THE DISK DIRECTORY TRACKS, SORTS THEM ALPHABETICALLY -; THEN REPLACES THEM ON THE DISK. ALL UNUSED OR ERASED AREAS ON THE DIR- -; ECTORY TRACK ARE REFORMATTED WITH CONTINUOUS 'E5' CHARACTERS. (THIS -; ERASES PREVIOUS FILE NAMES WHICH HAVE BEEN DEACTIVATED.) SORTING THE -; DIRECTORY IN THIS MANNER OFFERS MANY ADVANTAGES. SOME OF THEM ARE: -; -; 1) ALLOWS 'DIR' TO SHOW AN ALPHABETIZED LISTING -; 2) ELIMINATES POTENTIAL PROBLEMS WITH "UNERASE" PROGRAMS -; 3) SPEEDS UP ACCESS VIA 'SD' AND OTHER SPECIAL PROGRAMS -; 4) ASSISTS ON WORKING DIRECTLY ON THE DISK WITH 'DUU', ETC. -; 5) REMOVES FILES FROM THE DISK SOMEBODY ELSE COULD RECOVER -; -; - Notes by Irv Hoff W6FFC -; -; 1977 Written by L. E. Hughes. Modified extensively since by Bruce -; Ratoff, Keith Petersen, James Prest, Ron Fowler, Frank Gaude, -; Irv Hoff and likely others. -; -; 10/16/83 Now using a Shell-Metzner sort which speeds the sorting time -; considerably, especially on large directories. (SFK) -; -; 07/27/83 Shows an error flag for MP/M and CP/M+ both. Rewrites dir- -; tory even if previously sorted, to insure erased programs at -; v3.7 end of directory are properly cleared. -; - Irv Hoff -; -TRUE EQU 0FFH -FALSE EQU 0 -; -BDOS EQU 5 -CR EQU 0DH -DPBLEN EQU 15 ;SIZE OF CP/M2 DISK PARAMETER BLOCK -FCB EQU 5CH -FCB2 EQU 6CH -GETDSK EQU 25 ;BDOS "GET DISK #" FUNCTION -LF EQU 0AH -SELDRV EQU 14 ;SELECT DRIVE -;..... -; -; -; OBTAIN BIOS VECTORS -; -VECTRS: - JMP GETVEC -; - DS 53 ;ROOM FOR JUMP VECTORS -; -WBOOT EQU VECTRS+3 ;DO NOT CHANGE THESE EQUATES -CSTS EQU VECTRS+6 -CI EQU VECTRS+9 -CO EQU VECTRS+12 -LO EQU VECTRS+15 -PO EQU VECTRS+18 -RI EQU VECTRS+21 -HOME EQU VECTRS+24 -SELDSK EQU VECTRS+27 -SETTRK EQU VECTRS+30 -SETSEC EQU VECTRS+33 -SETDMA EQU VECTRS+36 -READ EQU VECTRS+39 -WRITE EQU VECTRS+42 -LSTS EQU VECTRS+45 ;ONLY IN CP/M2 -SECTRN EQU VECTRS+48 ;ONLY IN CP/M2 -; -; GET BIOS VECTORS -; -GETVEC: - LXI D,WBOOT - LHLD 1 - MVI B,53 - CALL MOVE -; -; PROGRAM STARTS HERE -; - LXI H,0 - DAD SP ;GET ADDRESS OF CP/M STACK - SHLD STACK ;STORE IT SO WE CAN GO BACK TO IT - CALL CODEND ;DETERMINE FREE SPACE - LXI D,80H ;ALLOW 80H BYTES FOR STACK - SHLD BUF ;SET BUFFER ADDRESS - SPHL ;SET TOP OF STACK - lda bdos+2 ;fetch bdos page ;841201 - dcr a ; less one ; - lhld buf ;fetch buf pntr ; - sub h ;available space for dir ; - mvi h,0 ; ; - mov l,a ;number of pages available ; - dad h ;x2->number of sectors ; - dad h ;x2 ; - dad h ;x2->number of directory ; - ; entries which will fit ; - shld maxdir ;save for later ; - XRA A ;SET NO REVERSE OF USER AREAS - STA REVERSE - CALL EPRINT ;PRINT MSG: - DB 'CLEANDIR, Version ' - DB (vers/10)+'0','.',(vers mod 10)+'0','P' ;841201 - DB 0 - LDA FCB+1 ;CHECK FOR HELP REQUEST - CPI '/' ;ANY OPTION MEANS HELP - JZ HELP - CPI 'D' ;SELECT DESCENDING ORDER? - JZ DESC - LDA FCB2+1 ;CHECK FOR OPTION CHAR - CPI 'D' ;DESCENDING ORDER OF USER AREAS? - JNZ SAP -DESC: - MVI A,0FFH ;ENABLE REVERSE - STA REVERSE - JMP SAP -; -; PRINT HELP MESSAGE -; -HELP: - CALL EPRINT - DB CR,LF,'Syntax:' - DB CR,LF,' CLEANDIR dir: o' - DB CR,LF,'Options:' - DB CR,LF,' D - sort in Descending Order (users and files)' - DB CR,LF,'Note:' - DB CR,LF,' Only disk ref is used in dir: form' - DB 0 - JMP EXIT1 -; -; MAIN PROGRAM ROUTINE -; -SAP: - CALL SETUP - call ckdrsz ;check available memory space ;841201 - CALL RDDIR - CALL CLEAN - CALL SORT - CALL PACK - CALL WRDIR - CALL EPRINT - DB 'Done',0 - JMP EXIT - -ckdrsz: lhld drm ;fetch max dir size ;841201 - xchg ; ; - lhld maxdir ;fetch memory available for dir ; - call hlmde ;subtract ; - rnc ;return if room ; - call eprint ;else... ; - db lf,lf,lf,lf,lf,lf ; - db cr,lf,'Your maximum directory size is ',0 ; - lhld drm ;print max dir size ; - inx h ; ; - call phlfdc ; ; - call eprint ; ; - db ' directory entries.',0 ; - call eprint ; ; - db cr,lf,'your memory can only handle ',0 ; - lhld maxdir ;print space available ; - call phlfdc ; ; - call eprint ; ; - db ' directory entries.' ; - db cr,lf,lf,'IF.....your directory DOES NOT exceed ',0; - lhld maxdir ; ; - call phlfdc ; ; - call eprint ; ; - db ' directory entries,' ; - db cr,lf,' (Directory entries NOT Files)'; - db cr,lf,' you may enter "Y" to proceed,' ; - db cr,lf,lf,'ELSE...any other key ABORTS.' ; - db cr,lf,lf,lf,lf,lf,lf,lf,lf,'..............> ',7,0; -ck1: mvi c,6 ;get input ; - mvi e,-1 ; ; - call bdos ; ; - cpi 0 ; ; - jz ck1 ; ; - ani 5fh ; ; - cpi 'Y' ; ; - jnz exit1 ; ; - lhld maxdir ; ; - shld drm ; ; - ret ; ; - ; ; -hlmde: mov a,h ; ; - cmp d ; ; - rnz ; ; - mov a,l ; ; - cmp e ; ; - ret ; ; -; -; SUBROUTINES -; -; -CLEAN: - LXI H,0 ;I = 0 -; -CLNLOP: - SHLD I - CALL INDEX ;HL = BUF + 16 * I - MOV A,M ;JUMP IF THIS IS A DELETED FILE - CPI 0E5H - JZ FILLE5 - LXI D,12 - DAD D ;HL = HL + 12 - MOV A,M ;CHECK EXTENT FIELD - ORA A - JNZ CLBUMP ;SKIP IF NOT EXTENT ZERO - INX H ;POINT TO RECORD COUNT FIELD - INX H - MOV A,M ;GET S2 BYTE (EXTENDED RC) - ANI 0FH ; FOR CPM2, 0 FOR CPM1 - MOV E,A - INX H - MOV A,M ;CHECK RECORD COUNT FIELD - ORA E - JNZ CLBUMP ;JUMP IF NON-ZERO - LHLD I ;CLEAR ALL 32 BYTES OF - CALL INDEX ; DIRECTORY ENTRY TO E5 - INX H - MOV A,M ;GET FIRST CHAR OF FILENAME - DCX H ; WARD CHRISTENSONS CAT PGMS - CPI '-' ; HAVE DISKNAME OF ZERO LENGTH - JZ CLBUMP ; THAT START WITH '-', DON'T DELETE - CPI ' ' ; DISCAT USES DISKNAME OF ZERO LENGTH - JZ CLBUMP ; THAT STARTS WITH ' ', DON'T DELETE -; -FILLE5: - MVI C,32 ;NUMBER OF BYTES TO CLEAR -; -FILLOP: - MVI M,0E5H ;MAKE IT ALL E5'S - INX H - DCR C - JNZ FILLOP -; -CLBUMP: - LHLD DRM ;GET COUNT OF FILENAMES - INX H - XCHG - LHLD I ;OUR CURRENT COUNT - INX H - PUSH H - CALL SUBDE ;SUBTRACT - POP H - JC CLNLOP ;LOOP TILL ALL CLEANED - RET -; -DODIR: - STA WRFLAG - LHLD SYSTRK - CALL DOTRAK ;SET THE TRACK - LXI H,0 - SHLD SECTOR - LHLD DRM ;NUMBER OF DIR ENTRIES - INX H ;RELATIVE TO 1 - CALL ROTRHL ;DIVIDE BY 4 - CALL ROTRHL ; TO GET SECTOR COUNT - SHLD DIRCNT - LHLD BUF - SHLD ADDR ;FOR DMA ADDRESS -; -DIRLOP: - LHLD SECTOR ;GET SECTORS PER TRACK - INX H - XCHG - LHLD SPT ;CURRENT SECTOR - CALL SUBDE ; SECTOR - SPT - XCHG - JNC NOTROV -; -; TRACK OVERFLOW, BUMP TO NEXT -; - LHLD TRACK - INX H - CALL DOTRAK - LXI H,1 ;REWIND SECTOR NUMBER -; -NOTROV: - CALL DOSEC ;SET CURRENT SECTOR - LHLD ADDR - MOV B,H ;SET UP DMA ADDRESS - MOV C,L - CALL SETDMA - LDA WRFLAG ;TIME TO FIGURE OUT - ORA A ; IF WE ARE READING - JNZ DWRT ; OR WRITING -; -; -; READ -; - CALL READ - ORA A ;TEST FLAGS ON READ - JNZ RERROR ;NZ=ERROR - JMP MORE ;GOOD READ, GO DO MORE -; -; TRACK AND SECTOR UPDATE ROUTINES -; -DOTRAK: - SHLD TRACK - MOV B,H - MOV C,L - CALL SETTRK - RET -DOSEC: - SHLD SECTOR - MOV B,H - MOV C,L - LHLD SECTBL - XCHG - DCX B - CALL SECTRN - MOV B,H - MOV C,L - CALL SETSEC - RET -; -; WRITE -; -DWRT: - MVI C,1 ;FOR CPM/2 DEBLOCKING BIOS'S - CALL WRITE - ORA A ;TEST FLAGS ON WRITE - JNZ WERROR ;NZ=BAD DIRECTORY WRITE - JMP MORE -; -; Exit Program -; -EXIT: - LDA NOBOOT ;SEE IF BOOT IS NEEDED - ORA A - JNZ EXIT1 ;FLAG IS SET IF ALREADY ALPHABETIZED - JMP 0000H ;A REWRITTEN DIRECTORY NEEDS A WARM BOOT -; -EXIT1: - LHLD STACK ;GET ADDRESS OF ORIGINAL CP/M STACK - SPHL ;RESET STACK ADDRESS - RET -; -INDEX: - DAD H - DAD H - DAD H - DAD H - DAD H - XCHG - LHLD BUF ;GET ADDRESS OF BUF - XCHG - DAD D - RET -; -; GOOD READ OR WRITE -; -MORE: - LHLD ADDR ;BUMP DMA ADRS FOR NEXT PASS - LXI D,80H - DAD D - SHLD ADDR - LHLD DIRCNT ;COUNTDOWN ENTRIES - DCX H - SHLD DIRCNT - MOV A,H ;TEST FOR ZERO LEFT - ORA L - JNZ DIRLOP ;LOOP TILL ZERO -; -; -; DIRECTORY I/O DONE, RESET DMA ADDRESS -; - LXI B,80H - CALL SETDMA - RET -; -; MOVE UTILITY SUBROUTINE -; -MOVE: - MOV A,M - STAX D - INX H - INX D - DCR B - JNZ MOVE - RET -; -; PACK DIRECTORY -; -PACK: - LXI H,0 ;I = 0 -; -PACK1: - SHLD I - CALL INDEX ;HL = BUF + 16 * I - LXI D,9 - DAD D ;HL = HL + 9 - MOV A,M ;JUMP IF FILETYPE NOT 'X$$' - SUI '0' ; WHERE 0.LE.X.LE.9 - JC PACK2 - CPI 10 - JNC PACK2 - STA J - INX H - MOV A,M - CPI '$' - JNZ PACK2 - INX H - MOV A,M - CPI '$' - JNZ PACK2 - INX H ;SET EXTENT NUMBER TO X - LDA J - MOV M,A - DCX H ;SET FILETYPE TO '$$$' - MVI M,'$' - DCX H - MVI M,'$' - DCX H - MVI M,'$' -; -PACK2: - LHLD I ;I = I + 1 - INX H - XCHG - LHLD DRM - INX H - XCHG - PUSH H - CALL SUBDE - POP H ;LOOP UNTIL I > DRM - JC PACK1 - RET -; -; READ AND WRITE DIRECTORY ROUTINES -; -RDDIR: - CALL EPRINT - DB ' --> Reading, ',0 - XRA A - STA NOBOOT ;ZERO THE FLAG - JMP DODIR ;ZERO THE WRITE FLAG FOR NOW -; -; COME HERE IF WE GET A READ ERROR -; -RERROR: - CALL EPRINT ;PRINT: - DB ' READ ERROR - No Change Made',0 - JMP EXIT -; -; DIVIDE HL BY 2 -; -ROTRHL: - ORA A ;CLEAR CARRY - MOV A,H - RAR - MOV H,A - MOV A,L - RAR - MOV L,A - RET -; -; SETUP FOR SELECTING DRIVE AND LOADING DISK PARM BLOCK -; -SETUP: - LXI D,FCB - CALL Z3LOG ;LOG INTO DISK SPECIFIED BY USER - MVI C,GETDSK ;OTHERWISE GET CURRENT DEFAULT DRIVE - CALL BDOS ;SO QUERY 'BDOS' FOR DRIVE - MOV C,A ;PREP FOR OBTAINING DPB - CALL EPRINT - DB CR,LF,' Disk ',0 - MOV A,C ;GET DISK NUMBER - ADI 'A' ;CONVERT TO ASCII - CALL COUT - CALL SELDSK -; -; GET CP/M 2.2 DPB DATA -; - MOV E,M - INX H - MOV D,M - INX H - XCHG - SHLD SECTBL - XCHG - LXI D,8 ;OFFSET TO DPB WITHIN HEADER - DAD D ;RETURNED BY SELDSK IN CPM2 - MOV A,M ;GET ADRS OF DPB - INX H - MOV H,M - MOV L,A - LXI D,DPB ;POINT TO DEST: OUR DPB - MVI B,DPBLEN - CALL MOVE - RET -; -; SORT THE DIRECTORY -; -SORT: - CALL EPRINT - DB 'Sorting (',0 - LDA REVERSE ;INDICATE ASC OR DSC - ORA A ;0=ASC - JZ SORTASC - CALL EPRINT - DB 'Descending',0 - JMP SORTDO -SORTASC: - CALL EPRINT - DB 'Ascending',0 -; -; SHELL-METZNER SORT -; -SORTDO: - CALL EPRINT - DB ' Order), ',0 - LHLD I - SHLD SNUMRECW - LHLD BUF - SHLD SSTADR - PUSH H ; AND SAVE IT - LXI H,32 - SHLD SRECLEN - PUSH H ; AND SAVE IT -; -; NOW DIVIDE # OF FIELDS BY 2 -; -DIVIDE: - LHLD SNUMRECW ;GET VALUE - CALL ROTRHL - SHLD SNUMRECW ;SAVE RESULT - MOV A,L ;IF SNUMRECW<>0 - ORA H ; THEN - JNZ NOTDONE ; NOT DONE -; -; ALL FIELDS SORTED -; - POP B ;CLEAN UP STACK - POP D - RET -; -NOTDONE: - XCHG - LHLD I - MOV A,L - SUB E - MOV L,A - MOV A,H - SBB D - MOV H,A - SHLD SRECLEN - LXI H,1 - SHLD SSORTV1 - SHLD SSTADR - DCR L - POP B - PUSH B -NDONE1: - DAD D - DCX B - MOV A,B - ORA C - JNZ NDONE1 - SHLD SSORTV2 - XCHG - POP B - POP H - PUSH H - PUSH B -NDONE2: - SHLD SSORTV4 - SHLD SSORTV3 - XCHG - DAD D - XCHG -COMPARE: - POP B - PUSH B -COMPAR1: - LDAX D - ANI 7FH - PUSH B - MOV C,A - MOV A,M - ANI 7FH - MOV B,A - MOV A,C - SUB B - POP B - JNZ NOTEQU - INX H - INX D - DCX B - MOV A,B - ORA C - JNZ COMPAR1 - JMP NOSWITCH -; -; THE CONDITION AT NOTEQU: HAS TO -; BE CHANGED FOR DESCENDING SORT -- IF REVERSE=0, JNC TO NOSWITCH, ELSE -; JC TO NOSWITCH -; -NOTEQU: - PUSH PSW ;SAVE CONDITION - LDAX D ;GET (DE) - CPI 0E5H ;IF ERASED, SELECT ASCENDING - JZ ASCENDING - MOV A,M ;GET (HL) - CPI 0E5H ;IF ERASED, SELECT ASCENDING - JZ ASCENDING - LDA REVERSE ;DESCENDING SORT? - ORA A ;0=NO - JZ ASCENDING - POP PSW ;GET CONDITION FOR DESCENDING SORT - JC NOSWITCH - JMP SWITCH -ASCENDING: - POP PSW ;GET CONDITION FOR ASCENDING SORT - JNC NOSWITCH -SWITCH: - PUSH B - MOV B,M - LDAX D - MOV M,A - MOV A,B - STAX D - INX H - INX D - POP B - DCX B - MOV A,B - ORA C - JNZ SWITCH - LHLD SNUMRECW - MOV A,H - CMA - MOV D,A - MOV A,L - CMA - MOV E,A - LHLD SSORTV1 - DAD D - JNC NOSWITCH - INX H - SHLD SSORTV1 - LHLD SSORTV3 - XCHG - LHLD SSORTV2 - MOV A,E - SUB L - MOV L,A - MOV A,D - SBB H - MOV H,A - SHLD SSORTV3 - JMP COMPARE -; -NOSWITCH: - LHLD SSTADR - INX H - SHLD SSTADR - SHLD SSORTV1 - XCHG - LHLD SRECLEN - MOV A,L - SUB E - MOV A,H - SBB D - JC DIVIDE - LHLD SSORTV4 - POP D - PUSH D - DAD D - XCHG - LHLD SSORTV2 - XCHG - JMP NDONE2 -; -; UTILITY SUBTRACTION SUBROUTINE... -; HL=HL-DE -; -SUBDE: - MOV A,L - SUB E - MOV L,A - MOV A,H - SBB D - MOV H,A - RET -;..... -; -; -WRDIR: - CALL EPRINT - DB 'Writing, ',0 - MVI A,1 - JMP DODIR -; -; COME HERE IF WE GET A WRITE ERROR -; -WERROR: - CALL EPRINT ;PRINT: - DB ' WRITE ERROR - Directory Left in UNKNOWN Condition',0 - JMP EXIT -; -; DATA AREA -; -ADDR: - DS 2 -BUF: - DS 2 -DIRCNT: - DS 2 -I: - DS 2 -J: - DS 2 -MAPPTR: - DS 2 -maxdir: - ds 2 ;841201 -NOBOOT: - DS 1 -NOSWAP: - DS 1 -REVERSE: - DS 1 -SECTBL: - DS 2 -SECTOR: - DS 2 -TRACK: - DS 2 -WRFLAG: - DS 1 -SRECLEN: - DS 2 -SSTADR: - DS 2 -SSORTV1: - DS 2 -SSORTV2: - DS 2 -SSORTV3: - DS 2 -SSORTV4: - DS 2 -SNUMRECW: - DS 2 -; -; DISK PARAMETER BLOCK: -; -DPB: -SPT: - DS 2 -BSH: - DS 1 -BLM: - DS 1 -EXM: - DS 1 -DSM: - DS 2 -DRM: - DS 2 -AL0: - DS 1 -AL1: - DS 1 -CKS: - DS 2 -SYSTRK: - DS 2 -; -STACK: - DS 2 ;SPACE FOR OLD STACK ADDRESS -; - END -; - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/CLNDR13B.LBR b/Source/Images/d_bp/u15/CLNDR13B.LBR deleted file mode 100644 index b74e2545..00000000 Binary files a/Source/Images/d_bp/u15/CLNDR13B.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/CMD.COM b/Source/Images/d_bp/u15/CMD.COM deleted file mode 100644 index 7afcba9d..00000000 Binary files a/Source/Images/d_bp/u15/CMD.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/CMD.MAC b/Source/Images/d_bp/u15/CMD.MAC deleted file mode 100644 index 9a5cbf68..00000000 --- a/Source/Images/d_bp/u15/CMD.MAC +++ /dev/null @@ -1,267 +0,0 @@ -; PROGRAM: CMD -; VERSION: 1.0 -; DATE: 19 July 84 -; AUTHOR: Richard Conn -; PREVIOUS VERSIONS: None -; -z3env equ 0f400h -VERS EQU 10 ;version number - -; CMD is copyright (c) 1984 by Richard Conn -; All Rights Reserved -; CMD may be used freely by the ZCPR3 Community - -; -; CMD is used to define and run a command line. It either accepts -; the command line (including semicolons) which follow the verb CMD onto -; the command line buffer or, if no input is provided, it prompts the -; user for input and then places this into the command line buffer. -; -; Syntax: -; CMD cmd1;cmd2;... -; or CMD -; -; The sequence of commands "cmd1;cmd2;..." becomes the command line. -; - -; -; SYSLIB, Z3LIB, and VLIB References -; - ext z3init - ext getcl1,getcl2,puter2,putzex,dutdir - ext eprint,pafdc,cout,bline - ext retud - ext codend - -; -; Basic Definitions -; -TRUE EQU 0FFH ;define true and.. -FALSE EQU 0 ;..false. - -; -; System Addresses -; -OS$BASE EQU 000H ;system base.. -BDOS EQU OS$BASE+05H -FCB EQU OS$BASE+5CH -FCB2 EQU OS$BASE+6CH -TBUFF EQU OS$BASE+80H -TPA EQU OS$BASE+100H - -; -; ASCII Chars -; -LF EQU 0AH ;..linefeed.. -CR EQU 0DH ;..carriage return.. - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Mainline -; - call z3init ;initialize the ZCPR3 Env - -; -; Check for Help or Prompt -; - lda fcb+1 ;check for help request - cpi ' ' ;prompted input? - jz prompt - cpi '/' ;help? - jnz cinit -; -; Print Help Message -; -help: - call eprint - db 'CMD, Version ' - db (VERS/10)+'0','.',(VERS MOD 10)+'0' - db cr,lf,' Syntax: CMD cmd1;cmd2;... or CMD (prompted input)' - db cr,lf,' CMD defines the command line in the CL buffer' - db 0 - ret -; -; Initialize Command Line -; -cinit: - call getcl1 ;check for command line buffer - jz nocl -; -; HL now points to the command line buffer -; - call codend ;pt to free area - inx h ;skip 2 bytes - inx h - xchg ;... in DE - lxi h,tbuff+2 ;pt to option input - call copystr ;copy string - mvi c,1 ;set not empty -; -; Entry point to build rest of command line, where DE=next address -; and C=empty line flag (C=0 means line was empty) -; -checkcl: - mov a,c ;get empty flag - call puter2 ;set error flag - call getcl2 ;get address of command line - jz setsh ;set shell command - call copystr ;copy string -setsh: - call getcl1 ;pt to command line buffer - xchg ;... in DE - lxi h,4 ;pt to first char position - dad d - shld lstart ;save start address in case of abort - xchg - mov m,e ;store pointer - inx h - mov m,d - inx h ;pt to buffer size - mov b,m ;get it in B - call codend ;pt to string - inx h ;skip 2 bytes - inx h -clcopy: - mov a,m ;get char - stax d ;put char - inx h ;pt to next - inx d - ora a ;done? - rz - dcr b ;count down - jnz clcopy -; -; Command Line Too Long -; - lhld lstart ;zero command line - mvi m,0 - call eprint - db ' Command Line too Long for Buffer',0 - ret - -; -; Print no command line buffer message and exit -; -nocl: - call eprint - db ' No Command Line Buffer',0 - ret - -; -; Copy string from HL to DE -; Store ending 0 and leave pointer in DE to it -; -copystr: - mov a,m ;get char - stax d ;store it - ora a ;done? - rz - inx h ;pt to next - inx d - jmp copystr - -; -; Prompt User for Input -; -prompt: - call eprint - db 'CMD ',0 - call retud ;get DU -; -; Print DU -; - mov a,b ;output disk - adi 'A' - call cout - mov a,c ;output user - call pafdc - mvi a,':' ;separator - call cout -; -; Print DIR -; - call dutdir ;convert to name - jz prompt2 ;no name input -; -; DIR is defined -; - mvi b,8 ;8 chars max -prompt1: - mov a,m ;get char - cpi ' ' ;done if space - jz promptx - call cout ;echo it - inx h ;pt to next - dcr b ;count down - jnz prompt1 - jmp promptx -; -; DIR is not defined -; -prompt2: - call eprint ;name not found - db 'Noname',0 -; -; Complete prompt and get user input -; -promptx: - call eprint - db '> ',0 - mvi a,1 ;tell ZEX that it is prompted - call putzex - call codend ;use buffer area - mvi m,254 ;set large line size - mvi a,0 ;no caps - call bline ;get input line - xra a ;no more prompt - call putzex - call codend ;skip to EOL - inx h - inx h - xchg ;ptr in DE - ldax d ;get first char - mov c,a ;save flag -; -; Skip to end of input line -; -findeol: - ldax d ;get char - ora a ;done? - jz checkcl - inx d ;pt to next - jmp findeol -; -; Buffers -; -lstart: - ds 2 ;start of command line - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/CMDFILES.HLP b/Source/Images/d_bp/u15/CMDFILES.HLP deleted file mode 100644 index 822026f2..00000000 --- a/Source/Images/d_bp/u15/CMDFILES.HLP +++ /dev/null @@ -1,729 +0,0 @@ -; - - - - Command File Processing - - -- Basics -- - 0 - Overview - 1 - Restrictions - 2 - Extended Cmd Procs - --- Disk-Based Command Files -- -- Memory-Based Command Files -- - S - The SUB Utility Z - The ZEX Utility - E - SUB Error Messages D - ZEX Directives - G - GOTO Command - - -:0 - - Overview of Command Files - - Á  Commanä  Filå ió á filå  containinç  commands¬  witè -optionaì  parameteò substitution¬  whicè caî bå executeä  bù -ZCPR3®  Theså  commandó  arå  exactlù  thå  samå  kindó  oæ -commandó aó yoõ woulä issuå aô thå console¬  anä anù commanä -whicè caî bå issueä froí thå consolå caî alsï bå issueä froí -withiî á Commanä Filå (witè jusô á couplå oæ restrictions). - - Thå   Commanä  Filå  Facilitieó  oæ  SU  anä  ZEØ  arå -availablå  undeò ZCPR3®  Similaò iî concepô tï  thå  SUBMIÔ -facilitù oæ CP/M¬  botè SU anä ZEØ arå upward-compatablå tï -SUBMIÔ   (anù   SU  filå  caî  ruî  undeò  theí  witè   fe÷ -restrictions). - - - Botè  SU anä ZEØ begiî processinç bù  translatinç  thå -commanä  fileó theù arå giveî intï slightlù differenô forms® -Botè dï parameteò substitution¬  extractinç parameteró  froí -thå  commanä  lineó  anä placinç theí intï thå texô  oæ  thå -commanä  streaí theù arå building®  SU buildó thå  commanä -streaí tï bå executeä oî disë drivå Á undeò thå currenô useò -number¬ anä ZEØ buildó thå commanä streaí iî memory. - - ZEØ  ió generallù preferreä tï  SUB®  Undeò  ZEX¬  thå -commanä  streaí ió executeä mucè morå quicklù thaî undeò SU -sincå ZEØ accesseó memorù foò thå nexô characteò whilå ZCPR³ -haó tï gï tï disk® ZEX¬ however¬ takeó uð memorù space¬ anä -thaô ió itó maiî drawback® Thå TPÁ (Transienô Prograí Area© -undeò ZEØ ió smalleò thaî whaô ió availablå tï commanä fileó -runninç undeò SUB®  Thió ió thå basiã trade-ofæ betweeî thå -twï Commanä Filå Processors. - - - Anotheò  differencå  betweeî SU anä ZEØ  ió  thaô  SU -commanä  streamó  arå  line-orienteä anä extracteä  onlù  bù -ZCPR3®  Thaô  is¬  SU buildó á commanä filå nameä  $$$.SU -likå SUBMIÔ does¬ anä ZCPR³ extractó á linå froí thå $$$.SU -filå  eacè  timå iô ió entered®  Wheî ZCPR³ ió  entereä  bù -eitheò  á  Colä Boot¬  Warí Boot¬  oò simplå RETurî  froí  á -loadeä program¬  iô checkó thå Multiplå Commanä Linå  Buffeò -foò  á pendinç command®  Iæ ZCPR³ findó á pendinç  command¬ -thå commanä ió executed®  Iæ not¬ ZCPR³ checkó thå Aº drivå -(currenô  user©  foò á $$$.SU file®  Iæ á $$$.SU filå  ió -found¬  ZCPR³ extractó thå nexô linå froí thå $$$.SU  file¬ -processeó  it¬  anä beginó executioî oæ iô froí thå Multiplå -Commanä Linå Buffer®  Finally¬  iæ thå $$$.SU filå ió  noô -found¬ ZCPR³ promptó thå useò foò input. - - Thaô  ió  ho÷  commanä streaí processinç undeò  SU  ió -performed®  ZEX¬  however¬ actó aó á combinatioî oæ SU anä -XSUB®  Oncå commanä streaí processinç beginó undeò ZEX¬ thå -ZEØ monitor¬ locateä undeò ZCPR³ witè thå associateä commanä -stream¬  supplieó  á  characteò eacè timå thå  BIOÓ  Consolå -Inpuô  Routinå ió called®  ZEØ extractó thå nexô  characteò -froí thå commanä stream¬  examineó iô tï seå iæ iô ió á  ZEØ -commanä anä executeó iô iæ so¬ anä returnó iô tï thå callinç -prograí iæ iô ió noô á ZEØ command. - - Iî á sense¬  ZCPR³ itselæ doeó noô realizå thaô ZEØ  ió -running® Neitheò dï thå transienô programó iî general® ZEØ -simplù  interceptó alì calló tï thå BIOÓ Consolå Inpuô  (anä -Inpuô Status© routinå anä provideó aî inpuô characteò iî itó -place®  Therå arå exceptionó tï thió case¬ buô theù wilì bå -discusseä later. - - Botè SU anä ZEØ fiô intï thå ZCPR³ Systeí nicely¬  anä -theù  caî  bå useä tï acô aó Extendeä Commanä Processoró  iæ -desired® Thió ió discusseä later. -:G -Command: GOTO 1.0 - -Syntax: - GOTO label - -;=label any_text - -Function: - - GOTÏ ió á ZCPR³ utility¬ designeä tï bå ruî froí withiî -á  ZEØ commanä file¬  whicè permitó branching®  Iô  acceptó -onlù onå argument¬  á label¬ whicè ió defineä withiî thå ZEØ -filå aó á speciaì commenô oæ thå form: - - ;=label - -Anù  texô whicè followó thå "label¢ phraså ió considereä  tï -be comment and is not processed. - - -Options: - None - -Comments: - - GOTÏ wilì ONLÙ worë correctlù iæ executeä withiî á  ZEØ -command file. GOTO will issue an error message otherwise. - - Withouô thå ZCPR³ Flo÷ Controì facility¬  GOTÏ woulä bå -oæ littlå value® Witè IF¬ however¬ GOTÏ ió extremelù usefuì -in setting up loops and other flow-control constructs. - - Selected Error Messages: - - "ZEØ  Noô  Running¢ meanó thaô GOTÏ waó  executeä  froí -outside a ZEX command file. - - "Labeì  xxø  Noô Founä -- Abortinç ZEX¢ meanó thaô  thå -referenceä labeì waó noô founä withiî thå commanä  file¬  sï -ZEX execution is terminated. - -Examples of Use: - - ZEX Command File 1: - - REG S1 0;note Register 1 = 0 - ;=start - XIF;note Exit all pending IFs - ECHO Hello, World - IF ~1 3;note IF Register 1 <> 3 - GOTO START - FI - - ZEX Command File 2: - - M80 =$1;note Assemble File - ; Strike ^C if Errors Exist - ^? - if ~nul $3;note IF there are 2 libs ... - L80 $1/N,$1,$2/S,$3/S,SYSLIB/S,/U/E;note link all - goto done - fi - if ~nul $2;note IF there is a 2nd arg ... - L8° $1/N,$1,$2/S,SYSLIB/S,/U/E;notå linë liâ $2 - else;note IF there is no 2nd arg ... - L80 $1/N,$1,SYSLIB/S,/U/E;note link - ;=done - fi - - - ZEX Command File 3: - - if NEC=$2 - echo Terminal is NEC - goto done - fi - if TTY=$2 - echo Terminal is TTY - goto done - fi - if DIABLO=$2 - echo Terminal is Diablo - else - echo Terminal is Undefined - fi - ;=done - xif;note Exit all pending IFs - ws $1;note Edit file - -:S -Command: SUB 3.0 - -Syntax: - - SUB or SUB // <-- Print Help Message - SUB /A Text <-- Abort $$$.SUB File - Processing at User's - Discretion - SUB /AB Text <-- Same as /A but Ring Bell - to Alert User - SUB /I <-- Enter Interactive Input - Mode - SUB filename params <-- As in Standard SUBMIT - - -Function: - - SU buildó á commanä filå oî disë (nameä $$$.SUB© whicè -ZCPR³  lookó  foò eacè timå iô ió readù foò á commanä  line® -Iæ  ZCPR³ findó sucè á file¬  iô extractó thå  nexô  commanä -from this file. - - SUB can also be used to sound alarms to the user. - -Options: - - As indicated above: - A - Permit abort - AB - Permit Abort and Ring Bell - I - Interactive Input - - -Comments: - - Thå  "SU  /A¢ anä "SU /AB¢ formó allo÷  thå  useò  tï -gracefullù  aborô á $$$.SU file®  ^à aô thå consolå caî bå -useä tï aborô sucè processinç aó undeò CP/M¬ buô thå /Á forí -allowó thå luxurù oæ startinç á commanä streaí anä  stoppinç -aô  á  criticaì  poinô tï allo÷ thå useò tï takå  hió  time¬ -inspecô  whaô  haó  happened¬  anä theî  decidå  whetheò  tï -proceeä oò not. - - Thå  "SU /I¢ forí eliminateó thå neeä foò thå useò  tï -uså  aî  editoò tï creatå á .SU file®  Iæ thå useò  haó  á -commanä  streaí hå wantó tï executå immediatelù anä  doesn'ô -carå tï dï iô again¬  hå caî uså thió option®  Iî response¬ -SU  allowó  hií  tï enteò hió  commanä  streaí  (sorry¬  nï -parameteò passing© á linå aô á time® Wheî iô ió alì entereä -(useò enteró aî emptù line)¬  thå $$$.SU filå ió builô  anä -executed. - - - Thå finaì form¬  "SU filenamå params"¬ ió identicaì iî -forí  tï  thå  SUBMIÔ  commanä  supplieä  witè  CP/M®   Thå -"filename¢  specifieó  thå  namå  oæ thå  .SU  filå  tï  bå -executed¬   anä  thå  parameteró  arå  associateä  witè  thå -substitutioî variableó oæ $1¬  $2¬ etc® Uð tï 2° parameteró -maù bå specified®  Thå sequencå "$$¢ placeó á "$¢ intï  thå -commanä  line¬  anä  thå characteò sequencå "^c¢ placeó  thå -indicateä controì characteò intï thå commanä linå (uparro÷ à -placeó Control-C). - - Thå SU commanä maù bå nesteä intï á $$$.SU file®  Iæ -á "SU filenamå params¢ commanä ió encountereä iî á  $$$.SU -file¬ SU runs¬ realizeó thaô thió haó happened¬ anä insertó -thå  indicateä  commanä file¬  witè parameteò  substitution¬ -intï  thå runninç commanä streaí aô thå  appropriatå  place® -Thió maù bå nesteä aó manù leveló deeð aó desired. - - - Undeò  ZCPR3¬  iæ  SU  ió executeä witè  thå  Multiplå -Commanä  Linå Facilitù invokeä anä morå commandó follo÷  thå -SU command¬  theî thå resô oæ thå Multiplå Commanä Linå  ió -inserteä aô thå enä oæ thå generateä $$$.SU file. - - Finally¬  SU followó thå ZCPR³ patè wheî searchinç foò -thå indicateä commanä file® Iô ió fullù integrateä intï thå -ZCPR³  Systeí  anä ió ablå tï emploù thå Externaì  Patè  anä -Multiplå Commanä Linå Buffeò featureó oæ ZCPR3. - - - -Selected Error Messages: - - "Param¢ erroò meanó thaô á parameteò waó referenceä anä -nonå waó giveî oî thå commanä line. - - "Linå Toï Long¢ meanó thaô thå inpuô line¬  afteò beinç -expandeä  witè  thå  inpuô parameters¬  waó  morå  thaî  12¶ -characters long. - - Á  morå completå lisô oæ erroò messageó ió giveî  undeò -the indicated section of the main menu. - - -Examples of Use: - - SUB cmdfile p1 p2 p3 - -- thå    filå   'cmdfile.SUB§    ió    processed¬ -substituting 'p1' for $1, 'p2' for $2, and 'p3' for $3 - - SUB /AB - -- durinç  thå executioî oæ á commanä  file¬  thió -commanä  causeó thå belì tï rinç aô thå consolå anä thå useò -is given a chance to abort execution - -:E - - SU provideó á numbeò oæ informativå diagnosticó tï thå -user®  Iî particular¬  wheî processinç á Commanä File¬ wheî -aî  erroò ió encountered¬  thå useò ió informeä oæ thå  linå -numbeò thå erroò occuró at. - - Thå  followinç summarizeó thå erroò messageó  presenteä -bù SUB: - - Disk Full - There is no room to write the $$$.SUB file - - Directory Full - There is no directory space for the $$$.SUB file - - Memory Full - There is not enough memory in which to build the - command stream to be placed into the $$$.SUB file - - SUB Error Messages, Con't - - SUBMIT File Not Found - The .SUB file specified in the command line could - not be found along the ZCPR3 path - - Parameter - Invalid Parameter Specified - - Too Many Parameters - More than 20 parameters were on the command line - - Line too Long - The current line in the command stream exceeds - 128 bytes - - SUBMIT File Empty - The .SUB file specified in the command line was - found to be empty - - SUB Error Messages, Con't - - Control Character - The ^c form was not followed by a letter A-Z - - -:Z - -Command: ZEX 3.0 - -Syntax: - - ZEX // <-- Print Help - - ZEX <-- Enter Interactive Mode - - ZEX filename params <-- Process .ZEX or .SUB - file as with SUBMIT - -Function: - - ZEØ  ió  á  memory-baseä commanä  filå  processor®  Iô -performó functionó likå SU anä XSU combined¬ anä itó inpuô -sourcå ió locateä iî memory¬  sï thaô itó executioî speeä ió -significantly greater. - - -Options: - - Aó indicateä above¬ therå arå nï optionó tï ZEX. - -Comments: - - Thå   Interactivå   Modå  oæ  ZEØ  executeó  likå   thå -Interactivå  Modå  oæ SUB®  Thå useò enteró  commanä  lineó -untiì  hå  ió satisfieä anä theî terminateó thå  procesó  bù -enterinç  aî emptù linå (simplù hittinç RETURN)®  ZEØ  theî -executeó thå commandó iî thå sequencå entered® Nï parameteò -passinç ió permitteä iî thió modå oæ operation. - - Thå   "ZEØ   filenamå   params¢  forí   ió   likå   thå -correspondinç  SU form®  ZEØ wilì searcè alonç  thå  ZCPR³ -Externaì Patè foò á commanä filå oæ thå forí filename.ZEØ oò -filename.SUB® Iæ á directorù ió entereä whicè containó botè -sucè files¬ thå filå oæ typå ZEØ wilì bå executed. - - - Oncå  ZEØ haó beguî execution¬  iô placeó á ZEØ Monitoò -jusô  undeò  ZCPR³ anä buildó thå commanä streaí  undeò  thå -monitor® Oncå complete¬ thå addresó oæ thå BDOÓ ió adjusteä -sï  thaô thå ZEØ monitoò anä itó commanä streaí wilì noô  bå -overwritteî  bù transienô programs¬  anä  executioî  begins® -Eacè  timå  thå BIOÓ Consolå Inpuô routinå  ió  called¬  ZEØ -supplieó thå inpuô character. - - Aó witè SUB¬ á ^à froí thå consolå wilì aborô executioî -oæ á ZEØ commanä stream®  Also¬  aó witè SUB¬  iæ á commanä -followó  ZEØ  iî á Multiplå Commanä Line¬  ZEØ appendó  thió -commanä tï thå commanä stream. - - - Unlikå  SUB¬  ZEØ  doeó noô permiô nestinç  oæ  commanä -files®   ZEØ  wilì  simplù  aborô  iæ  á  ZEØ  commanä   ió -encountereä iî thå commanä streaí iô ió processing. - - Unlikå  SUB¬  ZEØ supportó manù morå embeddeä commands® -Combininç thå facilitieó oæ SU anä XSU iî thió  case¬  thå -embeddeä  commandó oæ ZEØ reflecô thå XSUB-likå capabilitieó -oæ ZEØ aó welì aó somå ne÷ ideas. - - Theså   extendeä  controì  commandó  arå  discusseä  iî -anotheò informatioî section. - - -Selected Error Messages: - - None discussed - - -Examples of Use: - - ZEX - -- the user now enters a group of commands - - ZEX mycmds p1 p2 - -- processinç oæ thå filå 'mycmds.ZEX'¬ or¬ iæ noô -found¬ 'mycmds.SUB§ ió performed» 'p1§ ió substituteä foò $± -and 'p2' for $2 - -:D - - ZEX Directives - Control Commands - - The following summarizes the ZEX Control Commands: - - Cmd Meaning Cmd Meaning - | insert ^| insert - ^º reruî commanä streaí ^® togglå prinô suppress - ^# toggle ZEX messages ^$ define default params - ^? wait for user input ^/ ring bell and ^? - ^* ring bell ^" accept user input - ^< display chars only ^> stop display - ;; ZEX comment $n 1<=n<=9 for param - $$ $ $^ ^ - $| | ^c control char - - - Thió  summarù  ió alsï displayeä viá thå  built-iî  ZEØ -help. - - Thå  followinç commandó simplù inserô  characteró  intï -thå  ZEØ  commanä  streaí anä wilì noô bå discusseä  iî  anù -greateò detail. - - | inserts a ^| inserts a pair - $$ inserts a single $ $^ inserts a single ^ - $| inserts a single | ^c inserts a control character - - Thå ^ª commanä simplù causeó ZEØ tï rinç thå bell®  Iô -doeó noô inserô á BELÌ characteò intï thå commanä filå  likå -á ^Ç sequencå would® Iô simplù ringó thå belì anä continueó -processing. - - Thå ;» commanä ió á ZEØ comment® Iô anä alì characteró -followinç  iô uð tï anä includinç thå followinç ¢ characteò witè thå mosô significanô -biô  set®  Thió ió uniquå anä appearó onlù wheî thå  prompô -comeó uð oî mù system. - - Thå   followinç   exampleó   illustratå    applicationó -employinç them®  Commentó appeaò ouô tï thå side¬  prefixeä -bù <--. - - -B1>zex -ZEX, Version 1.3 -1: ^$ this is fun <-- Define 3 params -2: echo $1 $2 $3 -3: ^$ hello from happy acres <-- Define 4 params -4: echo $1 $2 $3 $4 -5: -(ZEX Active) <-- ZEX is running now -B1>echo this is fun - -THIS IS FUN -B1>echo hello from happy acres - -HELLO FROM HAPPY ACRES -B1> -(ZEX Completed) -By Your Command > - - -B1>ed demo.zex <-- Demo Command File - -NEW FILE - : *i - 1: ed demo.txt <-- Edit DEMO.TXT - 2: i <-- Insert text while in ED - 3: This is a test - 4: This is only a test - 5: This is a demo of ZEX Control - 6: ^Z <-- ^Z is 2 chars, xlated into - 7: b0lt <-- Ctrl-Z by ZEX - 8: 1l - 9: 0lt - 10: i <-- Input More Text - 11: ^" <-- Allow user to input text - 12: type demo.txt <-- When ZEX continues, this - 13: era demo.txt <-- is what it does next - 14: - : *e - -B1>zex demo <-- Run the command file -ZEX, Version 1.3 -(ZEX Active) -B1>ed demo.txt - -NEW FILE - : *i <-- ZEX is typing this in - 1: This is a test - 2: This is only a test - 3: This is a demo of ZEX Control - 4: - : *b0lt - 1: This is a test - 1: *1l - 2: *0lt - 2: This is only a test - 2: *i <-- Now user input begins - 2º É aí no÷ typinç thió linå oæ mù owî volitioî <-- User - 3: ZEX will allow me to continue doing this until - 4: it sees the ZCPR3 prompt - 5: <-- User types Ctrl-Z - 5: *e <-- User types "e" - -(ZEX Active) -B1>type demo.txt <-- ZEX resumes -This is a test -I am now typing this line of my own volition -ZEX will allow me to continue doing this until -it sees the ZCPR3 prompt -This is only a test -This is a demo of ZEX Control - -B1>era demo.txt -DEMO .TXT -B1> -(ZEX Completed) -By Your Command > - -B1>ed demo.mac <-- Now to use ZEX for - <-- program assembly -NEW FILE - : *i <-- User types program - 1: ext print - 2: - 3: call print - 4: db 'Hello, World ... It''s Another Day',0 - 5: ret - 6: - 7: end - 8: - : *e - - -B1>type a:m80.zex <-- M80.ZEX command file -; M80.SUB -- MACRO-80 Assembler and Linker -M80 =$1 -; Please Type $^C if Error(s) Exist - ^? -ERA $1.BAK -ERA $1.COM -L80 /P:100,$1,A:SYSLIB/S,$1/N,/U,/E -ERA $1.REL -; Assembly Complete - -B1>zex m80 demo <-- Run command file on pgm -ZEX, Version 1.3 -(ZEX Active) -B1>; M80.SUB -- MACRO-80 Assembler and Linker -B1>M80 =DEMO - -No Fatal errr(s) - -(ZEX Active) - -B1>; Please Type ^C if Error(s) Exist - <-- User can abort now - <-- if he wishes -B1>ERA DEMO.BAK -DEMO .BAK -B1>ERA DEMO.COM -No File -B1>L80 /P:100,DEMO,A:SYSLIB/S,DEMO/N,/U,/E - -Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft -Data 0100 01C5 < 197> - -35936 Bytes Free - -Data 0100 01C5 < 197> - -35936 Bytes Free -[0000 01C5 1] - -(ZEX Active) - -B1>ERA DEMO.REL -DEMO .REL -B1>; Assembly Complete -B1> -(ZEX Completed) -By Your Command>demo <-- Run pgm now -Hello, World ... It's Another Day -B1> - -:1 - - Thå followinç restrictionó arå applieä tï commanä fileó -processeä bù SU anä ZEX. - - SUB Restrictions - - 1®  Yoõ maù noô loç intï useò areaó otheò thaî thå onå -yoõ begaî processinç thå commanä filå in®  Iæ yoõ do¬ ZCPR³ -looseó  tracë oæ thå $$$.SU filå anä executioî  ió  aborteä -untiì  yoõ  reenteò thå originaì useò area¬  aô  whicè  timå -executioî resumes. - - 2®  Uð  tï  2°  parameteró arå permitteä  oî  thå  SU -commanä line. - - 3® Yoõ maù nesô SU commanä fileó tï anù depth. - - - - ZEX Restrictions - - 1®  Yoõ maù movå intï anù directorù yoõ desirå whilå á -ZEØ commanä streaí ió beinç executed. - - 2® Uð tï ¹ parameteró arå permitteä oî thå ZEØ commanä -line. - - 3® Yoõ maù NOÔ nesô ZEØ commanä files. - - -:2 - - Botè  SU anä ZEØ makå nicå Extendeä Commanä Processoró -undeò  ZCPR3®  Botè  uså  thå Externaì  Patè  anä  Multiplå -Commanä Linå Buffeò Facilitieó oæ ZCPR3¬  anä ZEØ ió furtheò -prompteä foò inpuô bù thå ZCPR³ prompô iæ desired. - - Tï refresè thå reader¬  anä Extendeä Commanä  Processoò -ió  á  prograí  invokeä bù ZCPR³ wheî iô failó tï  finä  thå -commanä alonç itó path® ZCPR3¬ upoî failinç tï finä thå COÍ -filå whicè correspondó tï thå commanä namå giveî tï it¬  caî -bå  seô uð tï eitheò searcè thå patè oò gï directlù  tï  thå -rooô oæ thå patè anä looë foò aî Extendeä Commanä Processor® -Iæ found¬ ZCPR³ simulateó á commanä tï thaô Extendeä Commanä -Processor¬  substitutinç  thå  user'ó  commanä linå  aó  thå -argumentó tï it. - - To illustrate, consider the following example: - - - MASM.ZEØ performó thå samå seô oæ commandó thaô M80.ZEØ -filå diä above¬ namely: - -; MASM.ZEX -- MACRO-80 Assembler and Linker -M80 =$1 -; Please Type $^C if Error(s) Exist - ^? -ERA $1.BAK -ERA $1.COM -L80 /P:100,$1,A:SYSLIB/S,$1/N,/U,/E -ERA $1.REL -; Assembly Complete - - Thå  commanä  "MASÍ DEMO¢ ió issued®  Witè ZEØ aó  thå -Extendeä Commanä Processor¬  ZCPR³ lookó alonç thå patè  foò -thå commanä MASM¬  failó tï finä it¬  anä theî simulateó thå -commanä  "ZEØ  MASÍ DEMO"®  Thå abovå commanä filå ió  theî -executeä witè DEMÏ aó itó passeä parameter. - - - ZEX¬  oò  anù  otheò program¬  caî bå installeä  aó  aî -Extendeä Commanä Processoò bù renaminç iô tï CMDRUN.COM. - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/CMDRUN.COM b/Source/Images/d_bp/u15/CMDRUN.COM deleted file mode 100644 index d882afb1..00000000 Binary files a/Source/Images/d_bp/u15/CMDRUN.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/CMDRUN.MAC b/Source/Images/d_bp/u15/CMDRUN.MAC deleted file mode 100644 index ae4eb21b..00000000 --- a/Source/Images/d_bp/u15/CMDRUN.MAC +++ /dev/null @@ -1,51 +0,0 @@ -; -; Program: CMDRUN -; Author: Richard Conn -; Version: N/A -; Date: 11 June 84 -; -TBUFF EQU 80H -z3env equ 0f400h - - ext z3init - ext print,pstr - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - CALL PRINT - DB 'Command Line: ',0 - LXI H,TBUFF+1 ;PT TO COMMAND LINE - JMP PSTR - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/COMMENT.COM b/Source/Images/d_bp/u15/COMMENT.COM deleted file mode 100644 index dfd54701..00000000 Binary files a/Source/Images/d_bp/u15/COMMENT.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/COMMENT.MAC b/Source/Images/d_bp/u15/COMMENT.MAC deleted file mode 100644 index 59f8edb7..00000000 --- a/Source/Images/d_bp/u15/COMMENT.MAC +++ /dev/null @@ -1,196 +0,0 @@ -; PROGRAM: COMMENT -; AUTHOR: Richard Conn -; VERSION: 2.0 -; DATE: 18 MAY 84 -; PREVIOUS VERSIONS: 1.0 (18 APR 83) - -vers equ 20 -z3env set 0f400h - -; -; COMMENT echoes lines, with simple character editing, to the user's -; console. This program is designed to facilitate communication between -; two users who see the same console via redirectable I/O. They can chat -; freely to each other by using this program. -; - -llen equ 65 ;number of chars allowed before auto newline - -fcb equ 5ch ;FCB - -ctrlc equ 'C'-'@' ;Abort Character -esc equ 1bh ;Escape (Abort Character) -cr equ 0dh ;New Line -lf equ 0ah ;Line Feed -bs equ 8 ;Back Space -del equ 7fh ;Delete Char -ctrlp equ 'P'-'@' ;^P -ctrlu equ 'U'-'@' ;^U -ctrlx equ 'X'-'@' ;^X - -; -; Externals -; - ext z3init - ext cin,cout,crlf,eprint,lout,lcrlf - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - call eprint - db 'COMMENT, Version ' - db (vers/10)+'0','.',(vers mod 10)+'0',0 - lda fcb+1 ;check for help request - cpi '/' ;help? - jnz cmt -; -; Help for COMMENT -; - call eprint - db cr,lf,' COMMENT' - db cr,lf,'Internal Commands:' - db cr,lf,' ^C or ESC - Abort' - db cr,lf,' ^P - Toggle Print' - db cr,lf,' BS or DEL - Delete Prev Char' - db cr,lf,' ^U or ^X - Delete Line' - db 0 - ret -; -; Beginning of Comment Routine -; -cmt: - call eprint - db cr,lf,'Strike ^C or ESC to Abort, ^P to Toggle Print' - db cr,lf,0 - xra a ;clear print flag - sta prflag - call comment ;print first prompt and set char count -; -; Main Character Input Loop -; -loop: - call cin ;input char - ani 7fh ;mask MSB - cpi ctrlc - rz - cpi esc - rz - cpi ctrlp ;toggle print flag - jz prtog - cpi cr ;new line? - jz newline - cpi bs ;back up? - jz back - cpi del ;back up? - jz back - cpi ctrlu ;erase line? - jz eraln - cpi ctrlx ;erase line? - jz eraln - call cout - cpi ' ' ;printable char? - jc loop - mov b,a ;save char in B - lda prflag ;print? - ora a ;0=no - mov a,b ;get char to print - cnz lout ;print char if PRFLAG is NZ - inr c ;increment char count - mvi a,llen ;check for nearing end of line - cmp c - cz comment - jmp loop -; -; Toggle print flag -; -prtog: - lda prflag ;flip flag - cma - sta prflag - ora a ;new line to printer if print flag now off - cz lcrlf - jmp loop -; -; Routine to begin a new line -; -newline: - call comment ;new line, print prompt, set char count to zero - jmp loop -; -; Back up one character -; -back: - mov a,c ;check for no chars - ora a - jz loop - call back1 ;backup routine - jmp loop ;continue -; -; General Routine for backing up -; -back1: - dcr c ;count down - mvi a,bs ;backspace - call cout - mvi a,' ' ;space - call cout - mvi a,bs ;backspace - jmp cout -; -; Erase Current Line -; -eraln: - mov a,c ;done? - ora a - jz loop - call back1 ;backup - jmp eraln -; -; Print User Prompt -; -comment: - call eprint - db cr,lf,'Comment> ',0 - lda prflag ;new line to printer if print flag on - ora a - cnz lcrlf - mvi c,0 ;set char count - ret - -; -; Buffers -; -prflag: - ds 1 ;print flag (0=off, 0FFH=on) - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/COMPARE.HLP b/Source/Images/d_bp/u15/COMPARE.HLP deleted file mode 100644 index dbc61716..00000000 --- a/Source/Images/d_bp/u15/COMPARE.HLP +++ /dev/null @@ -1,149 +0,0 @@ -; - - - - ZCPR3 File Comparison Utilities - - C - CRC - - D - DIFF - -:D - -Command: DIFF 2.0 - -Syntax: - - DIFF dir:ufn o... -or - DIFF dir:ufn1,dir:ufn2 o... - -Function: - - DIFÆ  ió useä tï comparå twï files®  Iô caî bå madå tï -simplù  statå  iæ  thå twï  fileó  arå  differenô  (stoppinç -immediatelù afteò thå firsô differencå ió located© oò iô caî -lisô alì oæ thå differenceó betweeî twï fileó oî á byte-for- -bytå basis. - - - The form: DIFF dir:ufn o... - -compareó  thå filå iî thå indicateä directorù witè thå  filå -bù thå samå namå iî thå currenô directory. - - The form: DIFF dir:ufn1,dir:ufn2 o... - -compares the two files indicated. - -Options: - - C - Compare Files Only and Stop at First Difference - M - Multiple Runs - When a comparison is complete, prompt the user - for new disks, allow him to change disks, and then - run the comparison again until the user says to stop - - -Comments: - - Iæ  useä  tï prinô ouô differences¬  DIFÆ presentó  thå -following information to the user: - - o Relative Offset from the beginning of the file - - o Byte values in the two files: - - - in Decimal - - in Hexadecimal - - in ASCII - -Selected Error Messages: - - "AFΠ Noô  Allowed¢ meanó thaô thå  useò  specifieä  aî -ambiguouó filå namå (onå containinç wilä cards)®  Botè filå -names must be unambiguous. - - -Examples of Use: - - DIFF text:myfile.txt - - prints differences between MYFILE.TXT in TEXT: - and MYFILE.TXT in current directory - - DIFF myfile.txt - - compares MYFILE.TXT against itself - - DIFF backup:myfile.txt mc - - compares MYFILE.TXT in BACKUP: with MYFILE.TXT - in the current directory; stops as soon as - a difference is found; when done, prompts - the user to change disks (BACKUP could be a - floppy, and this command is checking to see - thaô alì copieó oæ MYFILE.TXÔ oî several - disks are the same - -:C -Command: CRC 2.0 - -Syntax: - - CRC dir:afn1,dir:afn2,... o... - -Function: - - Thå  CRà Checë Utilitù distributeä witè ZCPR³  computeó -CRà valueó  foò  á lisô oæ files®  Iô useó  thå  samå  CRà -computatioî algorithí employeä bù Keitè Peterseî iî hió CRCË -program¬ anä thå valueó comå ouô thå same. - - Thå  CRà Checë  Utilitù computeó thå CRà valueó  oæ  á -selecteä seô oæ fileó anä printó ouô thå filå  names¬  theiò -sizeó (iî termó oæ Ë byteó anä numbeò oæ records)¬ anä theiò -CRà valueó iî hexadecimal®  Á counô oæ thå numbeò oæ lineó -oæ codå (assuminç texô files© anä á commenô associateä  witè -eacè  filå caî bå optionallù included®  Á lisô oæ ambiguouó -fileó nameó maù bå provideä tï CRC. - -Options: - - C - Comment Output; add comments to output listing - on disk or printer - D - Disk Output; send output to the disk file CRC.CRC - I - Inspect Files and Approve Each File to be reported - on before output is produced - L - Count Lines of Text and include in output (assume - all files are text files) - P - Printer Output; send output to the printer - - -Comments: - - CRà ió usefuì iî transferrinç fileó froí onå  sitå  tï -another®  Thå  CRà valueó oæ thå fileó caî bå computeä  anä -listeä aô onå site¬  transferred¬  anä compareä aô thå otheò -site. - - Thå  Ì optioî addó thå utilitù oæ trackinç codå sizå iî -terms of lines of code. - -Selected Error Messages: - - Self-Explanatory - - -Examples of Use: - - CRC *.MAC L - -- Compute CRCs of all *.MAC files in the current - directory; include lines-of-code count in - display - - - CRC *.* DLC - -- Compute CRCs of all files, include count of - lines of text and comments on each file, - and write output to disk in file named - CRC.CRC - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/CPSEL.COM b/Source/Images/d_bp/u15/CPSEL.COM deleted file mode 100644 index 1fbdeb46..00000000 Binary files a/Source/Images/d_bp/u15/CPSEL.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/CPSEL.MAC b/Source/Images/d_bp/u15/CPSEL.MAC deleted file mode 100644 index 322ecd4f..00000000 --- a/Source/Images/d_bp/u15/CPSEL.MAC +++ /dev/null @@ -1,365 +0,0 @@ -; -; PROGRAM: CPSEL -; VERSION: 1.0 -; DATE: 18 May 84 -; AUTHOR: Richard Conn -; PREVIOUS VERSIONS: None -; -version equ 10 -z3env SET 0f400h - -; -; CPSEL (CRT/Printer Select) is a utility which permits the user -; to dynamically select the CRT (of CRT 0 and CRT 1) and Printer (of -; Printers 0, 1, 2, and 3) from the current ZCPR3 Environment Descriptor. -; This dynamically changes the characteristics of the printer which is -; used by PRINT and the other utilities which read these buffers for their -; configuration data. -; - -; -; Operating System Buffers -; -fcb equ 5ch -tbuff equ 80h -cr equ 0dh -lf equ 0ah -tab equ 'I'-'@' - -; -; Special Equates -; -csel equ 2FH ;offset to CRT select byte -psel equ csel+1 ;offset to Printer select byte -cdata equ psel+1 ;offset to first CRT data record -cdsize equ 3 ;size of CRT data record -pdata equ cdata+2*cdsize ;offset to Printer data record -pdsize equ 4 ;size of Printer data record - -; -; SYSLIB and Z3LIB References -; - ext z3init,envptr - ext epstr,eprint,cout - ext padc - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - - call eprint - db 'CPSEL Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db 0 - - lxi h,tbuff+1 ;pt to buffer - lda fcb+1 ;check for help - cpi ' ' - jz help - cpi '/' - jnz start1 - -; -; Print help message -; -help: - call eprint - db cr,lf,' CPSEL cmd1 cmd2 cmd3,...' - db cr,lf,'Commands:' - db cr,lf,' Cc, c=0 or 1 -- Select CRT 0 or 1' - db cr,lf,' Pp, p=0,1,2,3 -- Select Printer 0, 1, 2, or 3' - db cr,lf,' Dd, d=A (All), C (CRT), P (Printer)' - db cr,lf,' -- Display Selection Values' - db 0 - - ret - -; -; Process Options -; -start1: - mov a,m ;get next char - ora a ;done? - rz - inx h ;pt to option - cpi ',' ;delimiter? - jz start1 - cpi ' ' ;delimiter? - jz start1 - cpi tab ;delimiter? - jz start1 - cpi '/' ;delimiter? - jz start1 - call cmdchk ;check for commands and run them - jmp start1 - -; -; Test and Run Commands -; -cmdchk: - mov b,a ;save command in B - lxi d,ctab ;pt to command table -cmd1: - ldax d ;get char - ora a ;end of table? - jz cmde ;print error message - cmp b ;match? - jz cmd2 ;process - inx d ;skip to next - inx d - inx d - jmp cmd1 -cmd2: - xchg ;get address - inx h - mov c,m ;get low - inx h - mov b,m ;get high - xchg ;restore hl - push b ;place address on stack - ret ;"run" command -; -; Command Not Found -; -cmde: - call eprint - db cr,lf,' Command Not Found: ',0 - mov a,b ;get char - jmp cout -; -; Command Table -; -ctab: - db 'C' ;select CRT - dw cselc - db 'D' ;display - dw disp - db 'P' ;select Printer - dw pselc - db 0 ;end of table -; -; Select CRT -; -cselc: - lxi d,csmsg ;CRT selection - mov a,m ;get digit - ora a ;error if null - jz error - inx h ;pt to next - sui '0' ;convert to binary - jc error - cpi 2 ;range check - jnc error - lxi d,csel ;offset for CRT select -; -; Select Device whose value is in A and Offset in DE -; -select: - push h ;save HL - lhld envptr ;pt to environment - dad d ;pt to buffer - mov m,a ;store value - pop h ;restore HL - ret -; -; Print Error Message -; -error: - call eprint - db cr,lf,' Range Error on ',0 - xchg ;HL pts to message - call epstr ;print message - xchg - ret - -; -; Select Printer -; -pselc: - lxi d,psmsg ;Printer selection - mov a,m ;get digit - ora a ;error if null - jz error - inx h ;pt to next - sui '0' ;convert to binary - jc error - cpi 4 ;range check - jnc error - lxi d,psel ;offset for Printer select - jmp select ;select device -; -; Display -; -disp: - mov a,m ;get option - ora a ;end of command? - jz dispall ;display all - inx h ;pt to next - cpi 'A' ;all? - jz dispall - cpi 'C' ;CRT? - jz dispcrt - cpi 'P' ;Printer? - jz dispprt - lxi d,dsmsg ;display select message - jmp error -; -; Display All -; -dispall: - call dispcrt ;display CRT and fall thru to display Printer -; -; Display Printer -; -dispprt: - call eprint - db cr,lf,' Current Printer Selection: ',0 - push h ;save HL - lhld envptr - lxi d,psel ;offset - dad d - mov a,m ;get selection - mov c,a ;selection in C - adi '0' ;convert to ASCII - call cout - mvi b,0 ;set up loop - lxi d,pdata ;offset to printer data - lhld envptr ;pt to environment - dad d ;pt to printer data -dploop: - call eprint - db cr,lf,' ',0 - mvi e,' ' ;leading space for not current printer - mov a,c ;see if at current printer - cmp b - jnz dpl1 - mvi e,'*' ;mark current printer -dpl1: - mov a,e - call cout - call eprint - db ' Prt ',0 - call comprt ;print common data elements - call eprint - db ' Form Feed? ',0 - mov a,m ;print form feed message - ora a - jz prno - call eprint - db 'Yes',0 - jmp pryes -prno: - call eprint - db 'No',0 -pryes: - inx h ;pt to next - inr b ;increment - mov a,b ;done? - cpi 4 ;limit - jnz dploop - pop h ;restore ptr - ret - -; -; Common Data Elements to Both Printer and CRT -; -comprt: - mov a,b ;get printer number - adi '0' ;to ASCII - call cout - call eprint - db ': Width = ',0 - mov a,m ;print line width - call padc - inx h - call eprint - db ' Actual/Text Lines = ',0 - mov a,m ;print number of actual lines - call padc - inx h - mvi a,'/' - call cout - mov a,m ;print number of text lines - inx h ;pt to next - jmp padc - -; -; Display CRT -; -dispcrt: - call eprint - db cr,lf,' Current CRT Selection: ',0 - push h ;save HL - lhld envptr - lxi d,csel ;offset - dad d - mov a,m ;get selection - mov c,a ;save in C - adi '0' ;convert to ASCII - call cout - mvi b,0 ;set up loop - lxi d,cdata ;offset to CRT data - lhld envptr ;pt to environment - dad d ;pt to printer data -dcloop: - call eprint - db cr,lf,' ',0 - mvi e,' ' ;leading space for not current printer - mov a,c ;see if at current printer - cmp b - jnz dpc1 - mvi e,'*' ;mark current printer -dpc1: - mov a,e - call cout - call eprint - db ' CRT ',0 - call comprt ;print common data elements - inr b ;increment - mov a,b ;done? - cpi 2 ;limit - jnz dcloop - pop h ;restore ptr to next command line element - ret - -; -; Error Messages -; -csmsg: - db 'CRT Selection',0 -dsmsg: - db 'Display Option',0 -psmsg: - db 'Prt Selection',0 - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/CRC.COM b/Source/Images/d_bp/u15/CRC.COM deleted file mode 100644 index 0b4c0f41..00000000 Binary files a/Source/Images/d_bp/u15/CRC.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/CRC.MAC b/Source/Images/d_bp/u15/CRC.MAC deleted file mode 100644 index 05c74649..00000000 --- a/Source/Images/d_bp/u15/CRC.MAC +++ /dev/null @@ -1,915 +0,0 @@ -; -; PROGRAM: CRC -; VERSION: 2.0 -; DATE: 16 Jan 83 -; AUTHOR: RICHARD CONN -; PREVIOUS VERSIONS: 1.2 (6 Jan 83), 1.1 (1 Jan 83), 1.0 (12 Dec 82) -; -VERS equ 20 -z3env SET 0f400h - -; -; CRC Command -- -; CRC is used to compute the CRC of one or more files. CRC -; permits ambiguous file names and supports an Inspect mode that -; allows the user to confirm each file before the computation is done. -; Additionally, there is a Disk Output Mode which allows the user to send -; the output from the operation to disk as well as to his screen with optional -; comments. -; -; The CRC command may be of the following forms: -; CRC dir:afn,dir:afn1,... o -; CRCs are computed for the indicated sets of files in the indicated -; directories. -; -; The option characters (o) are none or more of the following: -; C -- Comment Output; add comments if output is to disk -; D -- Disk Output; send output to disk file CRC.CRC -; I -- Inspect and approve each rename -; P -- Printer Output -; -; Examples: -; CRC A1:MYFILE.*,B2:HELLO.TXT <-- Compute CRCs of files -; CRC *.* DC <-- CRCs of all files in -; current user/disk with -; disk output and comments -; CRC *.* DCI <-- As above, but inspect and -; approve files first -; - -FALSE EQU 0 -TRUE EQU NOT FALSE - -ESIZE EQU 16 ; SIZE OF DIR ENTRY (FROM SYSLIB DIRF ROUTINE) - - EXT DIRQS ; DIRECTORY PROCESSOR - EXT DPARAMS ; DISK PARAMETERS - EXT DIRPACK ; DIR PACK ROUTINE - EXT FSIZE ; COMPUTE FILE SIZE - - EXT Z3INIT ; INIT BUFFERS - EXT ZFNAME ; FILE NAME PROCESSOR - EXT Z3LOG ; LOG INTO Z3 DU - - EXT FO0$OPEN ; OPEN FILE FOR BYTE-ORIENTED OUTPUT - EXT FO0$CLOSE ; CLOSE FILE - EXT F0$PUT ; WRITE BYTE TO FILE - - EXT F$MAKE ; CREATE FILE - EXT F$OPEN ; OPEN FILE - EXT F$READ ; READ BLOCK FROM FILE - EXT F$CLOSE ; CLOSE FILE - EXT F$DELETE ; DELETE FILE - - EXT CONDIN ; CONDITIONAL INPUT - - EXT MA2HC ; MEMORY STORE OF A AS 2 HEX CHARS - EXT MHLDC ; MEMORY STORE OF HL AS UP TO 5 DEC CHARS W/LEADING SP - - EXT BBLINE ; INPUT LINE EDITOR - EXT INITFCB ; INIT FCB - EXT BDOS ; BDOS ENTRY - EXT RETUD ; RETURN CURRENT USER/DISK - EXT PUTUD ; SAVE CURRENT USER/DISK - EXT GETUD ; RESTORE CURRENT USER/DISK - EXT LOGUD ; LOG INTO USER/DISK - EXT MOVEB ; COPY ROUTINE - EXT EPRINT ; PRINT STRING PTED TO BY RET ADR - EXT LOUT ; LST: OUTPUT ROUTINE - EXT COUT ; CONSOLE OUTPUT ROUTINE - EXT CIN ; CONSOLE INPUT ROUTINE - EXT CAPS ; CAPITALIZE ROUTINE - EXT CRLF ; NEW LINE ROUTINE - EXT CODEND ; CODE END COMPUTATION ROUTINE - -; -; CP/M EQUATES -; -CPM EQU 0 ; WARM BOOT -FCB EQU 5CH ; FCB -FCB2 EQU 6CH ; FCB 2 -TBUFF EQU 80H ; INPUT LINE BUFFER -CR EQU 13 ; -LF EQU 10 ; -CTRLC EQU 3 ; ^C - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -; -; DISK OUTPUT FCB -; -DSKFCB: - DB 0 - DB 'CRC ' ; FILE NAME - DB 'CRC' ; FILE TYPE - DS 4 - DS 16 - DS 4 ; 36 BYTES - -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -; -; DISK OUTPUT FCB -; -DSKFCB: - DB 0 - DB 'CRC ' ; FILE NAME - DB 'CRC' ; FILE TYPE - DS 4 - DS 16 - DS 4 ; 36 BYTES - -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env -; - LXI H,0 ; GET STACK PTR - DAD SP - SHLD STACK ; SAVE IT -; -; Compute Buffer Locations -; - CALL CODEND ; DETERMINE FREE SPACE - SHLD CMDLNE ; SET PTR TO COMMAND LINE - LXI D,100H ; BUFFER SIZE - DAD D ; COMMAND LINE - SHLD CRCFCB ; FCB FOR CRCS - DAD D - SHLD CMTLNE ; BUFFER FOR COMMENT LINE - DAD D - SHLD DIRBUF ; SET PTR TO DIRECTORY BUFFER - SPHL ; SET STACK PTR -; -; Save Location -; - CALL PUTUD ; SAVE CURRENT USER/DISK AWAY -; -; Print Banner -; - CALL EPRINT - DB 'CRC Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0',0 - LDA FCB+1 ; GET FIRST CHAR OF FILE NAME - CPI ' ' ; NO FILE SPEC? - JZ HELP - CPI '/' ; OPTION CAUGHT? - JNZ ECONT - -; PRINT HELP INFORMATION -HELP: - CALL EPRINT - DB CR,LF,' CRC dir:afn1,dir:afn2,... o...' - DB CR,LF,'Options:' - DB CR,LF,' C -- Comment Mode (Allow user to comment each entry ' - DB 'on disk)' - DB CR,LF,' D -- Disk Output (Send Output to Disk in file CRC.CRC)' - DB CR,LF,' I -- Inspect Mode (Give user approval option)' - DB CR,LF,' L -- Count Lines of Code' - DB CR,LF,' P -- Printer Output' - DB 0 - -; RETURN TO OS -RETURN: - CALL GETUD ; RESET DIR - LHLD STACK ; GET OLD STACK - SPHL ; SET IT - RET - -; -; SKIP UNTIL NON-BLANK -; -SBLANK: - MOV A,M ; LOOK FOR BLANK - INX H ; PT TO NEXT - CPI ' ' ; BLANK? - JZ SBLANK - DCX H ; BACK UP - RET - -; -; SKIP UNTIL BLANK OR EOL -; -SNBLANK: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - CPI ' ' ; BLANK? - JZ SNB1 - ORA A ; EOL? - JNZ SNBLANK -SNB1: - DCX H ; BACK UP - RET - -; -; COPY BUFFER INTO TEMP BUFFER -; -ECONT: - LHLD CMDLNE ; PT TO COMMAND LINE - XCHG ; ... IN DE - LXI H,TBUFF+1 ; PT TO BUFFER - MVI B,80H ; BUFFER SIZE (MAX) - CALL MOVEB ; COPY INTO COMMAND LINE BUFFER - -; EXTRACT FLAGS IF PRESENT - XRA A ; A=0 - STA LOC ; SET NO LINES OF CODE COUNT - STA INSPECT ; SET NO INSPECT - STA COMMENT ; SET NO COMMENT MODE - STA PRTOUT ; SET NO PRINTER OUTPUT - STA DSKOUT ; SET NO DISK OUTPUT - LXI H,0 ; SET FILE COUNT - SHLD FILECNT - LHLD CMDLNE ; PT TO BUFFER -; -; SKIP TO FILE NAME STRING -; - CALL SBLANK ; SKIP OVER BLANKS -; -; SKIP TO END OF FILE NAME STRING -; - CALL SNBLANK ; SKIP OVER NON-BLANKS -; -; SKIP TO FIRST OPTION CHAR -; - CALL SBLANK ; SKIP OVER BLANKS - -; -; CHECK FOR LEADING SLASH ON OPTION AND SKIP IT IF SO -; -OPT: - CPI '/' ; OPTION CHAR? - JNZ OPTION - INX H ; SKIP SLASH -; PROCESS LIST OF OPTIONS -OPTION: - MOV A,M ; GET BYTE - ORA A ; DONE? - JZ DSPEC - INX H ; PT TO NEXT CHAR - CPI ' ' ; SKIP OVER SPACES - JZ OPTION - CPI '/' ; IF OPTION LETTER, OBVIOUS ERROR, SO HELP - JZ HELP - CPI 'P' ; PRINTER OUTPUT? - JZ OPTPRT - CPI 'L' ; LINES OF CODE? - JZ OPTLOC - CPI 'C' ; COMMENT? - JZ OPTCMT - CPI 'I' ; INSPECT? - JZ OPTINS - CPI 'D' ; DISK OUTPUT? - JNZ HELP - -; SET DISK OUTPUT OPTION - MVI A,0FFH ; DISK OUTPUT - STA DSKOUT - JMP OPTION - -; SET PRINTER OUTPUT OPTION -OPTPRT: - MVI A,0FFH ; PRINTER OUTPUT - STA PRTOUT - JMP OPTION - -; SET LINES OF CODE OPTION -OPTLOC: - MVI A,0FFH ; LINES OF CODE COUNTER - STA LOC - JMP OPTION - -; SET COMMENT OPTION -OPTCMT: - MVI A,0FFH ; COMMENT MODE - STA COMMENT - JMP OPTION - -; SET INSPECT OPTION -OPTINS: - MVI A,0FFH ; INSPECT - STA INSPECT - JMP OPTION - -; -; EXTRACT DISK, USER, AND FILE NAME INFORMATION -; -DSPEC: - LDA DSKOUT ; DISK OUTPUT? - ORA A ; Z=NO - JZ DSPEC0 - LXI D,DSKFCB ; OUTPUT FCB - CALL INITFCB ; CLEAR FCB - CALL F$DELETE ; DELETE FILE - CALL INITFCB ; CLEAR FCB - CALL F$MAKE ; CREATE FILE - CALL FO0$OPEN ; OPEN FILE -DSPEC0: - LHLD CMDLNE ; PT TO FIRST BYTE - CALL SBLANK ; SKIP TO NON-BLANK -; -; MAJOR REENTRY POINT WHEN FILE SPECS ARE SEPARATED BY COMMAS -; HL PTS TO FIRST BYTE OF NEXT FILE SPEC -; -DSPEC1: - CALL GETUD ; RETURN TO HOME DIRECTORY - LXI D,FCB ; PT TO FCB IN DE, PT TO FIRST CHAR OF FILE NAME IN HL - MVI A,0 ; SCAN FOR DIR FORM BEFORE DU - CALL ZFNAME ; EXTRACT FILE NAME INTO FCB, AND GET DISK AND USER - SHLD NEXTCH ; SAVE PTR TO DELIMITER WHICH ENDED SCAN - -; -; LOAD DIRECTORY AND PERFORM FUNCTION -; -FCT: - LXI D,FCB ; PT TO FCB - CALL Z3LOG ; LOG INTO DIR - CALL RETUD ; SAVE DIRECTORY WE ARE IN - MOV A,B ; SAVE DISK - STA CDISK - MOV A,C ; SAVE USER - STA CUSER - LHLD DIRBUF ; PT TO DIRECTORY BUFFER - MVI A,11000000B ; SELECT SYS AND NON-SYS FILES - LXI D,FCB ; PT TO FCB - CALL INITFCB ; INIT THE FCB - CALL DIRQS ; LOAD DIR, SELECT FILES, PACK, AND ALPHABETIZE - CALL DPARAMS ; GET DISK PARAMETERS FOR FILE SIZE COMPUTATION - CALL ICHECK ; CHECK FOR INSPECT OPTION AND INSPECT IF SET - CALL HEADER ; PRINT COLUMN HEADER - CALL GETUD ; RETURN TO BASE USER/DISK - -; -; PERFORM FUNCTION; HL PTS TO FILE AND BC CONTAINS NUMBER OF FILES -; -FCTL: - MOV A,B ; CHECK FOR COMPLETION (COUNT = 0) - ORA C - JZ FCTL1 - DCX B ; COUNT DOWN - PUSH H ; SAVE PTR AND COUNT - PUSH B - CALL FUNCTION ; PERFORM FUNCTION - POP B ; GET COUNT AND PTR - POP H - LXI D,ESIZE ; PT TO NEXT ENTRY - DAD D - JMP FCTL - -; -; CHECK FOR NEXT FILE SPEC -; -FCTL1: - LHLD NEXTCH ; GET PTR - MOV A,M ; GET DELIM - CPI ',' ; ANOTHER FILE? - JNZ DRETURN - INX H ; PT TO CHAR AFTER COMMA - JMP DSPEC1 ; CONTINUE PROCESSING - -; -; FUNCTION COMPLETE -- EXIT -; -DRETURN: - CALL DCRLF ; NEW LINE - LDA DSKOUT ; DISK OUTPUT USED? - ORA A ; NZ=YES - CNZ FO0$CLOSE ; CLOSE FILE - JMP RETURN - -; -; EMERGENCY ABORT -; -ABORT: - CALL EPRINT - DB CR,LF,'** CRC Abort **',CR,LF,0 - CALL GETUD ; RETURN HOME - JMP DRETURN - -; -; PRINT COLUMN HEADER -; -HEADER: - CALL DPRINT - DB CR,LF,' Filename.Typ Size Recs CRC',0 - LDA LOC ; LINES OF CODE? - ORA A - JZ HDR1 - CALL DPRINT - DB ' Lines',0 -HDR1: - LDA COMMENT ; COMMENT FIELD ALSO? - ORA A ; 0=NO - RZ - CALL DPRINT - DB ' Comment',0 - RET -; -; FUNCTION -- COMPUTE CRCS OF SELECTED FILES -; -FUNCTION: - -; -; PRINT FILE NAME -; -CRCLP: - CALL DCRLF ;NEW LINE - PUSH H ;SAVE PTR - LHLD FILECNT ; INCREMENT FILE COUNT - INX H - SHLD FILECNT - CALL DVAL ;OUTPUT DECIMAL VALUE - POP H ;GET PTR - MVI A,' ' ;LEADING SPACE - CALL DOUT - CALL PRFN ; PRINT FILE NAME - MVI A,' ' ; SPACE SEPARATOR - CALL DOUT - CALL FSIZE ; COMPUTE SIZE IN DE - XCHG ; HL=SIZE - CALL DVAL ; OUTPUT VALUE - MVI A,'K' ; OUTPUT K - CALL DOUT - LHLD CRCFCB ; PT TO FCB - XCHG ; HL = PTR TO FIRST BYTE OF FILE FCB PART - MVI B,12 ; 12 BYTES - CALL MOVEB - XRA A ; ZERO FIRST BYTE - STAX D ; SELECT CURRENT DISK OF CRCFCB - JMP DOIT ; PERFORM FUNCTION - -; -; TEST FOR COMMENT AND DISK OUTPUT, AND ACCEPT COMMENT IF SET -; -CTEST: - LDA COMMENT ; GET FLAG - ORA A ; ZERO IF NONE - RZ - CALL EPRINT - DB ' ?',0 - XRA A ; DON'T CAPITALIZE - CALL BBLINE ; GET LINE FROM USER - XCHG ; SAVE HL - LHLD CMTLNE ; COPY INTO COMMENT LINE BUFFER FOR NOW - XCHG ; RESTORE HL AND NEW DE -CTEST1: - MOV A,M ; GET CHAR - STAX D ; PUT CHAR - ORA A ; END? - RZ - INX H ; PT TO NEXT - INX D - JMP CTEST1 - -; -; PRINT FILE NAME PTED TO BY HL -; OUTPUT TO CON: AND OPTIONALLY DISK -; -PRFN: - PUSH H ; SAVE PTR - INX H ; PT TO FILE NAME - MVI B,8 ; PRINT NAME - CALL PRNT - MVI A,'.' ; DECIMAL - CALL DOUT - MVI B,3 ; PRINT TYPE - CALL PRNT - POP H ; GET PTR - RET - -; -; PRINT CHARS PTED TO BY HL FOR B BYTES -; OUTPUT TO CON: AND OPTIONALLY DISK -; -PRNT: - MOV A,M ; GET CHAR - CALL DOUT - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ PRNT - RET - -; -; PRINT FILE NAME PTED TO BY HL -; OUTPUT TO CON: -; -PRFNC: - PUSH H ; SAVE PTR - INX H ; PT TO FILE NAME - MVI B,8 ; PRINT NAME - CALL PRNTC - MVI A,'.' ; DECIMAL - CALL COUT - MVI B,3 ; PRINT TYPE - CALL PRNTC - POP H ; GET PTR - RET - -; -; PRINT CHARS PTED TO BY HL FOR B BYTES -; OUTPUT TO CON: -; -PRNTC: - MOV A,M ; GET CHAR - CALL COUT - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ PRNTC - RET - -; -; CHECK FOR INSPECT OPTION AND INSPECT FILES IF SET -; FIRST FILE PTED TO BY HL, COUNT IN BC -; -ICHECK: - LDA INSPECT ; INSPECT? - ORA A ; 0=NO - RZ - CALL EPRINT - DB CR,LF,CR,LF,'** File Inspection **' - DB CR,LF,'Y(def)=Select N=Don''t Select' - DB CR,LF,'S=Skip Rest Q=Quit (Abort)' - DB CR,LF,0 - PUSH H ; SAVE POINTER TO FIRST FILE - PUSH B ; SAVE FILE COUNT -ICKL: - PUSH B ; SAVE COUNT - CALL CRLF ; NEW LINE - CALL PRFNC ; PRINT FILE NAME TO CONSOLE ONLY - CALL CRCQ ; CRC QUESTION - POP B ; GET COUNT - CPI 'S' ; SKIP REST? - JZ ISKIP - CPI 'Q' ; QUIT? - JZ QUIT - CPI 'N' ; NO? - JZ NODO - CALL EPRINT - DB ' Selected',0 - MOV A,M ; GET BYTE - ORI 80H ; SET MSB - MOV M,A ; PUT BYTE - JMP ICKNXT - -; DON'T CRC FILE -NODO: - CALL EPRINT - DB ' NOT Selected',0 - -; CONTINUE SCAN OF FILES -ICKNXT: - LXI D,ESIZE ; SIZE OF FILE ENTRY - DAD D ; PT TO NEXT ENTRY - DCX B ; COUNT DOWN - MOV A,B ; DONE? - ORA C - JNZ ICKL -ISKIP: - POP B ; RESTORE ORIGINAL COUNT - POP H ; RESTORE PTR TO FIRST FILE - CALL DIRPACK ; PACK DIRECTORY BASED ON SELECTION - CALL EPRINT - DB CR,LF,'** Inspection Complete **',CR,LF,0 - RET - -; -; PROMPT USER FOR INSPECT -; -CRCQ: - CALL EPRINT ; PRINT PROMPT - DB ' -- Select (Y/N/S/Q)? ',0 - CALL CIN ; GET RESPONSE - CALL CAPS ; CAPITALIZE - CALL COUT ; ECHO - RET - -; -; QUIT CRC PROGRAM -; -QUIT: - CALL EPRINT - DB ' Quit to Z3',0 - JMP DRETURN - -; -; COMPUTE CRC; NAME IN CRCFCB -; -DOIT: - LDA CDISK ; GOTO DIRECTORY OF FILE - MOV B,A - LDA CUSER - MOV C,A - CALL LOGUD ; LOG INTO FILE'S DIRECTORY - CALL CRCCLR ; CLEAR CRC ACCUMULATOR - LXI H,0 ; HL=0 - SHLD RECNT ; RESET RECORD COUNT - SHLD LOCNT ; RESET LINES OF CODE COUNT - LHLD CRCFCB ; PT TO FCB - XCHG ; ... IN DE - CALL INITFCB ; INIT IT - CALL F$OPEN ; OPEN IT FOR INPUT -DOITL: - CALL F$READ ; READ BLOCK INTO TBUFF - ORA A ; ERROR? - JNZ DOITD ; DONE IF SO - PUSH H ; SAVE HL - LHLD RECNT ; INCREMENT RECORD COUNT - INX H - SHLD RECNT - POP H - CALL CONDIN ; CHECK FOR ABORT - JZ DOITL0 - CPI CTRLC ; ABORT? - JZ ABORT ; QUICK ABORT -DOITL0: - LXI H,TBUFF ; PT TO FIRST BYTE - MVI B,128 ; 128 BYTES -DOITL1: - MOV A,M ; GET BYTE - CALL CRCUPD ; UPDATE CRC - LDA LOC ; COUNT LINES OF CODE? - ORA A ; 0=NO - JZ DOITL2 - MOV A,M ; GET BYTE - ANI 7FH ; MASK - CPI LF ; LINE FEED IS KEY - JNZ DOITL2 - PUSH H ; INCREMENT LOC COUNTER - LHLD LOCNT - INX H - SHLD LOCNT - POP H -DOITL2: - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ DOITL1 - JMP DOITL ; CONTINUE THRU FILE -DOITD: - CALL GETUD ; RETURN TO HOME DIRECTORY - CALL DPRINT ; SEPARATOR - DB ' ',0 - LHLD RECNT ; PRINT RECORD COUNT - CALL DVAL ; PRINT IN DECIMAL - CALL DPRINT - DB ' ',0 - CALL CRCDONE ; RETURN CRC IN HL - CALL HVAL ; PRINT VALUE AS HEX - LDA LOC ; LINES OF CODE? - ORA A - JZ DOITD1 - CALL DPRINT ; LEADING SPACES - DB ' ',0 - LHLD LOCNT ; GET COUNT - CALL DVAL ; PRINT AS DECIMAL -DOITD1: - CALL CTEST ; GET FOR AND INPUT COMMENT - LDA COMMENT ; CHECK FOR COMMENT AND OUTPUT IF SO - ORA A ; ZERO IF ONE NOT SELECTED - RZ - CALL DPRINT ; SEPARATOR - DB ' ',0 - LHLD CMTLNE ; OUTPUT COMMENT LINE -CMTLP: - MOV A,M ; GET CHAR - ORA A ; EOL? - RZ ; EXIT WHEN DONE - CALL DPOUT ; OUTPUT CHAR - INX H ; PT TO NEXT - JMP CMTLP - -; -; OUTPUT CHAR TO CONSOLE AND OPTIONALLY PRINTER OR DISK -; -DOUT: - PUSH PSW ; SAVE CHAR - PUSH B ; SAVE BC - MOV B,A ; CHAR IN B - CALL COUT ; OUTPUT TO CONSOLE -DOUT0: - LDA PRTOUT ; PRINTER OUTPUT? - ORA A ; Z=NO - JZ DOUT1 - MOV A,B ; GET CHAR - CALL LOUT ; OUTPUT TO PRINTER -DOUT1: - LDA DSKOUT ; DISK OUTPUT? - ORA A ; Z=NO - JZ DOUT2 - MOV A,B ; GET CHAR - CALL F0$PUT ; OUTPUT TO DISK -DOUT2: - POP B ; RESTORE REGS - POP PSW - RET - -; -; OUTPUT CHAR TO OPTIONALLY PRINTER OR DISK -; -DPOUT: - PUSH PSW ; SAVE CHAR - PUSH B ; SAVE BC - MOV B,A ; CHAR IN B - JMP DOUT0 ; USE DOUT ROUTINES - -; -; OUTPUT CHARS PTED TO BY RET ADR TO CONSOLE AND DISK OR PRINTER -; -DPRINT: - XTHL ; GET PTR AND SAVE HL AT SAME TIME -DPRL: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - ORA A ; END? - JZ DPRL1 - CALL DOUT ; OUTPUT IT - JMP DPRL -DPRL1: - XTHL ; SET RET ADR AND RESTORE HL - RET - -; -; NEW LINE TO ALL -; -DCRLF: - PUSH PSW ; SAVE PSW - MVI A,CR ; NEW LINE - CALL DOUT - MVI A,LF - CALL DOUT - POP PSW ; RESTORE PSW - RET - -; -; OUTPUT VALUE IN HL TO ALL IN HEX -; -HVAL: - PUSH H ; SAVE HL - PUSH D ; SAVE DE - LXI D,NUMBUF ; PT TO NUMBER BUFFER - MOV A,H - CALL MA2HC ; OUTPUT IN HEX - MOV A,L - CALL MA2HC - MVI A,' ' ; TRAILING SPACE - STAX D - JMP DVAL0 - -; -; OUTPUT HL AS UP TO 5 DECIMAL DIGITS TO ALL -; -DVAL: - PUSH H ; SAVE REGS - PUSH D - LXI D,NUMBUF ; PT TO BUFFER - CALL MHLDC ; OUTPUT IN DECIMAL -DVAL0: - LXI H,NUMBUF ; PT TO BUFFER - MVI D,5 ; 5 CHARS -DVAL1: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - CALL DOUT ; OUTPUT IT - DCR D ; COUNT DOWN - JNZ DVAL1 - POP D ; RESTORE REGS - POP H - RET - -; -; **** START OF CRC ROUTINES **** -; - -; -; CRCCLR -- Clear CRC Accumulator -; -; No Registers are Affected -; -CRCCLR: - PUSH H ;SAVE HL - LXI H,0 ;INIT TO ZERO - SHLD CRCACC - POP H - RET - -; -; CRCDONE -- Return the CRC Value in HL -; -CRCDONE: - LHLD CRCACC ;GET VALUE - RET - -; -; CRCUPD -- Update CRC Accumulator -; -;An 8080 routine for generating a CYCLIC-REDUNDANCY-CHECK. -;Adapted from Keith Petersen's CRCK 4.2 program. -;By Fred Gutman. -;From 'EDN' magazine, June 5, 1979 issue, page 84. -; -; Byte to be updated is passed in A -; No Registers are Affected -; -CRCUPD: - PUSH H ;SAVE HL - PUSH B ;SAVE BC - PUSH PSW ;SAVE BYTE TO UPDATE - MOV B,A ;BYTE IN B - LHLD CRCACC ;GET REMAINDER - MOV A,H - ANI 128 ;Q-BIT MASK - PUSH PSW ;SAVE STATUS - DAD H ;2 X R(X) - MOV A,B ;GET BYTE - ADD L - MOV L,A - POP PSW - JZ CRCU1 ;IF Q-BIT IS ZERO -; - MOV A,H - XRI 0A0H ;MS HALF OF GEN. POLY - MOV H,A - MOV A,L - XRI 97H ;LS HALF OF GEN. POLY - MOV L,A -; -CRCU1: - SHLD CRCACC ;SAVE RESULT - POP PSW ;RESTORE REGS - POP B - POP H - RET - -; -; CRC Accumulator -; -CRCACC: - DS 2 ;2 BYTES - -; -; **** END OF CRC ROUTINES **** -; - -; -; BUFFERS -; -CDISK: - DS 1 ; DISK WHERE FILES ARE -CUSER: - DS 1 ; USER WHERE FILES ARE -LOC: - DS 1 ; LINES OF CODE FLAG (0=NO, 0FFH=YES) -INSPECT: - DS 1 ; INSPECT FLAG (0=NO, 0FFH=YES) -COMMENT: - DS 1 ; CONTROL FLAG (0=NO, 0FFH=YES) -DSKOUT: - DS 1 ; DISK OUTPUT (0=NO, 0FFH=YES) -PRTOUT: - DS 1 ; PRINTER OUTPUT (0=NO, 0FFH=YES) -LOCNT: - DS 2 ; LINES OF CODE COUNT -RECNT: - DS 2 ; RECORD COUNT -NEXTCH: - DS 2 ; PTR TO NEXT CHAR IN MULTIFILE COMMAND LINE -FILECNT: - DS 2 ; COUNT OF NUMBER OF FILES RENAMED -NUMBUF: - DS 5 ; NUMBER STORAGE BUFFER -DIRBUF: - DS 2 ; PTR TO DIRECTORY BUFFER -CRCFCB: - DS 2 ; PTR TO FCB FOR CRC -CMTLNE: - DS 2 ; PTR TO COMMENT LINE BUFFER -CMDLNE: - DS 2 ; PTR TO COMMAND LINE -STACK: - DS 2 ; OLD STACK PTR - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/DBRCPREL.LBR b/Source/Images/d_bp/u15/DBRCPREL.LBR deleted file mode 100644 index e280a712..00000000 Binary files a/Source/Images/d_bp/u15/DBRCPREL.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/DEBUGRCP.AQM b/Source/Images/d_bp/u15/DEBUGRCP.AQM deleted file mode 100644 index 7340947b..00000000 Binary files a/Source/Images/d_bp/u15/DEBUGRCP.AQM and /dev/null differ diff --git a/Source/Images/d_bp/u15/DEBUGRCP.ASM b/Source/Images/d_bp/u15/DEBUGRCP.ASM deleted file mode 100644 index 3c9e1793..00000000 --- a/Source/Images/d_bp/u15/DEBUGRCP.ASM +++ /dev/null @@ -1,1587 +0,0 @@ -; SYSTEM SEGMENT: DEBUG.RCP -; SYSTEM: ARIES-1 -; CUSTOMIZED BY: RICHARD CONN - -; -; PROGRAM: DEBUGRCP.ASM -; AUTHOR: RICHARD CONN -; VERSION: 1.0 -; DATE: 30 JUNE 84 -; PREVIOUS VERSIONS: NONE -; -VERS EQU 10 -RCPID EQU 'A' - -; -; DEBUGRCP is a resident debug command package for ZCPR3. As with -; all resident command processors, DEBUGRCP performs the following functions: -; -; 1. Assuming that the EXTFCB contains the name of the -; command, DEBUGRCP looks to see if the first character -; of the file name field in the EXTFCB is a question -; mark; if so, it returns with the Zero Flag Set and -; HL pointing to the internal routine which prints -; its list of commands -; 2. The resident command list in DEBUGRCP is scanned for -; the entry contained in the file name field of -; EXTFCB; if found, DEBUGRCP returns with the Zero Flag -; Set and HL pointing to the internal routine which -; implements the function; if not found, DEBUGRCP returns -; with the Zero Flag Reset (NZ) -; - -; -; Global Library which Defines Addresses for DEBUGRCP -; - MACLIB Z3BASE - -; -CTRLC EQU 'C'-'@' -BS EQU 08H -TAB EQU 09H -LF EQU 0AH -FF EQU 0CH -CR EQU 0DH -CTRLX EQU 'X'-'@' -; -WBOOT EQU BASE+0000H ;CP/M WARM BOOT ADDRESS -UDFLAG EQU BASE+0004H ;USER NUM IN HIGH NYBBLE, DISK IN LOW -BDOS EQU BASE+0005H ;BDOS FUNCTION CALL ENTRY PT -TFCB EQU BASE+005CH ;DEFAULT FCB BUFFER -FCB1 EQU TFCB ;1st and 2nd FCBs -FCB2 EQU TFCB+16 -TBUFF EQU BASE+0080H ;DEFAULT DISK I/O BUFFER -TPA EQU BASE+0100H ;BASE OF TPA -; -; SYSTEM Entry Point -; - org rcp ; passed for Z3BASE - - db 'Z3RCP' ; Flag for Package Loader -; -; **** Command Table for RCP **** -; This table is RCP-dependent! -; -; The command name table is structured as follows: -; -; ctable: -; DB 'CMNDNAME' ; Table Record Structure is -; DW cmndaddress ; 8 Chars for Name and 2 Bytes for Adr -; ... -; DB 0 ; End of Table -; -cnsize equ 4 ; NUMBER OF CHARS IN COMMAND NAME - db cnsize ; size of text entries -ctab: - db 'H ' ; Help for RCP - dw clist -ctab1: - db 'MU ' ; Memory Utility - dw mu -; - db 0 -; -; BANNER NAME OF RCP -; -rcp$name: - db 'DEBUG ' - db (vers/10)+'0','.',(vers mod 10)+'0' - db RCPID - db 0 - -; -; Command List Routine -; -clist: - lxi h,rcp$name ; print RCP Name - call print1 - lxi h,ctab1 ; print table entries - mvi c,1 ; set count for new line -clist1: - mov a,m ; done? - ora a - rz - dcr c ; count down - jnz clist1a - call crlf ; new line - mvi c,4 ; set count -clist1a: - lxi d,entryname ; copy command name into message buffer - mvi b,cnsize ; number of chars -clist2: - mov a,m ; copy - stax d - inx h ; pt to next - inx d - dcr b - jnz clist2 - inx h ; skip to next entry - inx h - push h ; save ptr - lxi h,entrymsg ; print message - call print1 - pop h ; get ptr - jmp clist1 -; -; Print String (terminated in 0 or MSB Set) at Return Address -; -vprint: -eprint: - xthl ; get address - call print1 - xthl ; put address - ret -; -; Print String (terminated in 0 or MSB Set) pted to by HL -; -print1: - mov a,m ; done? - inx h ; pt to next - ora a ; 0 terminator - rz - cpi dim ; standout? - jz print1d - cpi bright ; standend? - jz print1b - call cout ; print char - ora a ; set MSB - rm ; MSB terminator - jmp print1 -print1d: - call stndout ; dim - jmp print1 -print1b: - call stndend ; bright - jmp print1 -; -; New Line -; -crlf: - mvi a,cr - call cout - mvi a,lf ;fall thru -; -; Character Output -; -cout: - push psw - push b - push d - push h - mov e,a - mvi c,2 ; use BDOS - call bdos - pop h - pop d - pop b - pop psw - ret -; -; Get char in A -; -cin: - push h - push d - push b - mvi c,1 - call bdos - ani 7fh - push psw - mvi a,bs ;overwrite - call cout - pop psw - pop b - pop d - pop h - ret -; -; CLIST Messages -; -entrymsg: - db ' ' ; command name prefix -entryname: - ds cnsize ; command name - db 0 ; terminator - -; -; General Equates -; -bel equ 07h -bs equ 08h -cr equ 0dh -lf equ 0ah -fcb equ 5ch - -DIM EQU 1 -BRIGHT EQU 2 - -EOLCH EQU 0 ;END OF LINE CHAR -SEPCH EQU ',' ;SEPARATOR CHAR -EROW EQU 6 ;FIRST ROW OF EDITOR DISPLAY -ECOL EQU 4 ;FIRST COL OF EDITOR DISPLAY -ECOLC EQU ECOL+16*3+8 ;FIRST COL OF EDITOR CHAR DISPLAY -ECURS EQU '>' ;EDITOR CURSOR -PRROW EQU 22 ;PROMPT ROW -PRCOL EQU 10 ;PROMPT COLUMN -PRCOLI EQU PRCOL+15 ;PROMPT INPUT COL -ERROW EQU 23 ;ERROR MESSAGE ROW -ERCOL EQU 15 ;ERROR MESSAGE COLUMN - -; -; DEFINE FREE SPACE -; -MU: - LXI H,TBUFF ;DETERMINE ADDRESS - MVI M,126 ;126 CHARS INPUT ALLOWED - SHLD BUFFER ;SET PTR -; -; SET UP ARROW KEYS -; - LXI H,Z3ENV ;PT TO ENVIRONMENT DESCRIPTOR - LXI D,80H+10H ;PT TO ARROW KEY INFO - DAD D - LXI D,EDCURT ;PT TO CURSOR TABLE - MVI B,4 ;4 ARROW KEYS -ARROW: - MOV A,M ;GET CHAR - STAX D ;STORE CHAR - INX H ;PT TO NEXT - INX D ;PT TO NEXT ENTRY - INX D - INX D - DCR B ;COUNT DOWN - JNZ ARROW -; -; Initialize Terminal -; - call tinit -; -; Check for Command Line Parameter -; - lxi h,fcb+1 ;pt to first char - mov a,m ;get char - cpi ' ' ;no param? - jnz pcheck - lxi h,tpa ;pt to TPA - jmp mu3 -; -; We have a parameter -; -pcheck: - call hexin ;convert to binary - xchg ;HL=value - jmp mu3 -; -; Erase to EOL -; If fct not supported, send out B spaces and B backspaces -; -vereol: - call ereol ;try erase - rnz - push b ;save B - mvi a,' ' ;send spaces - call vereol1 - pop b ;get B - mvi a,bs ;send backspaces -vereol1: - call cout ;send char in A - dcr b - jnz vereol1 - ret -; -; Clear Screen -; If fct not supported, write 24 CRLFs -; -vcls: - call cls ;try clear - rnz - push b ;save B - mvi b,24 ;count -vcls1: - call crlf - dcr b - jnz vcls1 - pop b - ret -; -; Run MU3 -; HL contains starting address -; -mu3: - SHLD BLOCK ;SAVE PTR TO BLOCK -; -; REFRESH EDIT SCREEN -; -EDIT0: - CALL VCLS ;NEW SCREEN - CALL AT - DB 2,35 ;ROW 2, COL 35 - CALL VPRINT ;BANNER - DB 'MU RCP ' - DB (VERS/10)+'0','.',(VERS MOD 10)+'0',RCPID - DB 0 -; -; REENTER MU3 WITH PTRS RESET -; -MU3R: - XRA A ;A=0 - STA EINDEX ;SET INDEX TO 0 (FIRST ELEMENT) - CALL EDPLOT ;PLOT BUFFER DATA -; -; INPUT EDITOR COMMAND -; -EDITCMD: - CALL PRMSG ;POSITION AT PROMPT MESSAGE - DB 'MU Command?',0 - CALL PRINP ;POSITION AT PROMPT INPUT - DB 0 - CALL CIN ;GET CHAR - CALL CAPS ;CAPITALIZE - MOV B,A ;COMMAND IN B - LXI H,EDCURT ;PROCESS CURSOR COMMANDS FIRST - CALL CMD ;PROCESS COMMAND - LXI H,ECMDTBL ;EDITOR COMMAND TABLE - CALL CMD ;PROCESS COMMAND - CALL VPRINT ;ERROR MESSAGE - DB BEL,0 - JMP EDITCMD -; -; Position at Prompt Message and Print it -; -PRMSG: - CALL AT ;POSITION - DB PRROW,PRCOL - JMP VPRINT ;PRINT IT -; -; Position at Prompt Input and Print Prompt -; -PRINP: - CALL AT ;POSITION - DB PRROW,PRCOLI - JMP VPRINT ;PRINT IT -; -;INPUT ERROR -; -WHAT: - CALL VPRINT - DB BEL,0 - JMP EDITCMD -; -;Command Table Search and Execute -; -CMD: - MOV A,M ;CHECK FOR END OF TABLE - ORA A - RZ ;COMMAND NOT FOUND - CMP B ;MATCH? - JZ CMDRUN - INX H ;SKIP TO NEXT ENTRY IN TABLE - INX H - INX H - JMP CMD -; -;RUN COMMAND -; -CMDRUN: - INX H ;PT TO LOW ADDRESS - MOV E,M - INX H ;PT TO HIGH ADDRESS - MOV D,M - XCHG - POP PSW ;CLEAR STACK - PCHL ;RUN ROUTINE -; -;PLOT BUFFER DATA -; -EDPLOT: - MVI H,EROW-1 ;SET ROW - MVI L,ECOL ;SET COLUMN - CALL GOTOXY ;POSITION CURSOR - CALL VPRINT - DB DIM - DB ' 0 1 2 3 4 5 6 7 8 9 A B C D E F' - DB BRIGHT,0 - INR H ;NEXT ROW - CALL GOTOXY ;POSITION CURSOR - XCHG ;POSITION IN DE - LHLD BLOCK ;PT TO DATA - MVI B,8 ;8 LINES -; -;Print Next Line on Screen -; -EDIT00: - CALL STNDOUT ;GO DIM - MOV A,H ;OUTPUT ADDRESS - CALL PA2HC - MOV A,L - CALL PA2HC - CALL VPRINT - DB ':',BRIGHT,' ',0 - MVI C,16 ;16 ELEMENTS -EDIT01: - MOV A,M ;GET BYTE - CALL PA2HC ;PRINT AS HEX - CALL SPACE ;PRINT 1 SPACE - INX H ;PT TO NEXT - DCR C ;COUNT DOWN - JNZ EDIT01 - XCHG ;POSITION AGAIN - INR H ;NEXT ROW - CALL GOTOXY - XCHG - DCR B ;COUNT DOWN - JNZ EDIT00 - MVI H,EROW ;RESET ROW - MVI L,ECOLC ;RESET COL - CALL GOTOXY ;POSITION CURSOR - XCHG ;POSITION IN DE - LHLD BLOCK ;PT TO DATA - MVI B,8 ;8 LINES -EDIT02: - CALL BAR ;PRINT BAR - MVI C,16 ;16 ELEMENTS -EDIT03: - MOV A,M ;GET BYTE - ANI 7FH ;MASK MSB - CPI 7FH ;DON'T PRINT 7FH - JZ EDIT7F - CPI ' ' ;SPACE OR MORE? - JNC EDIT04 -EDIT7F: - MVI A,'.' ;PRINT DOT -EDIT04: - CALL COUT ;PRINT BYTE - INX H ;PT TO NEXT - DCR C ;COUNT DOWN - JNZ EDIT03 - CALL BAR ;PRINT ENDING BAR - XCHG ;POSITION AGAIN - INR H ;NEXT ROW - CALL GOTOXY - XCHG - DCR B ;COUNT DOWN - JNZ EDIT02 - CALL EDCUR ;POSITION CURSOR - RET -; -;EDITOR COMMAND TABLE -; -ECMDTBL: - DB CR ;NOP - DW EDITCMD - DB 'C'-'@' ;^C = EXIT MU3 - DW EDCC - DB 'R'-'@' ;^R = REFRESH - DW EDIT0 - DB 'E'-'@' ;^E=UP - DW EDUP - DB 'X'-'@' ;^X=DOWN - DW EDDOWN - DB 'D'-'@' ;^D=RIGHT - DW EDRIGHT - DB 'S'-'@' ;^S=LEFT - DW EDLEFT - DB ' ' ;NOP - DW EDITCMD - DB '+' ;ADVANCE - DW EDITPLUS - DB '-' ;BACKUP - DW EDITMINUS - DB 'A' ;ADDRESS - DW EDITADR - DB 'C' ;COMMAND LINE - DW EDITCL - DB 'N' ;CHANGE NUMBERS - DW EDITHEX - DB 'T' ;CHANGE TEXT - DW EDITALP - DB 0 ;END OF TABLE -; -; ARROW KEY DEFINITONS FROM TCAP -; -EDCURT: - DB 0 ;0 INDICATES NO ARROW KEYS - DW EDUP - DB 0 - DW EDDOWN - DB 0 - DW EDRIGHT - DB 0 - DW EDLEFT - DB 0 ;END OF TABLE -; -;Enter Command Line -; -EDITCL: - CALL VPRINT ;PROMPT INPUT - DB CR,LF,'Command Line? ',0 - CALL RDBUF ;INPUT TEXT - CALL PUTCL ;STORE COMMAND LINE - JMP CRLF ;NEW LINE -; -; STORE COMMAND LINE -; -PUTCL: - XCHG ;PTR TO NEW LINE IN DE - CALL GETCL1 ;GET COMMAND LINE DATA - MOV B,A ;CHAR COUNT IN B - XCHG ;HL PTS TO NEW LINE - PUSH H ;SAVE PTR TO NEXT LINE -PCL1: - MOV A,M ;GO TO END OF LINE - ORA A ;AT END? - JZ PCL2 - INX H ;PT TO NEXT - DCR B ;COUNT DOWN - JNZ PCL1 - POP H ;CLEAR STACK - RET ;COMMAND LINE TOO LONG - ABORT -; -; AT END OF NEW COMMAND LINE -; PTR TO FIRST CHAR OF NEW COMMAND LINE ON STACK -; HL PTS TO ENDING 0 OF NEW COMMAND LINE -; B = NUMBER OF CHARS REMAINING BEFORE COMMAND LINE OVERFLOW -; -PCL2: - XCHG ;DE PTS TO LAST BYTE - PUSH D ;SAVE PTR IN CASE OF ERROR - CALL GETCL2 ;PT TO TAIL OF COMMAND LINE BUFFER - MOV A,M ;GET FIRST CHAR OF TAIL - CPI ';' ;CONTINUATION? - JZ PCL3 - ORA A ;DONE? - JZ PCL3 - MVI A,';' ;SET CONTINUATION CHAR - STAX D - INX D - DCR B ;COUNT DOWN - JZ PCL4 ;OVERFLOW -; -; COPY TAIL ONTO END OF NEW COMMAND LINE -; -PCL3: - MOV A,M ;GET NEXT CHAR - STAX D ;STORE IT - INX H ;PT TO NEXT - INX D - ORA A ;DONE? - JZ PCL5 - DCR B ;COUNT DOWN - JNZ PCL3 -; -; COMMAND LINE TOO LONG -; -PCL4: - POP H ;GET PTR TO END OF OLD LINE - MVI M,0 ;STORE ENDING 0 - POP PSW ;CLEAR STACK - RET -; -; NEW COMMAND LINE OK -; -PCL5: - POP PSW ;CLEAR STACK - CALL GETCL1 ;GET PTR TO BUFFER - LXI D,4 ;PT TO FIRST CHAR IN BUFFER - XCHG - DAD D - XCHG - MOV M,E ;STORE ADDRESS - INX H - MOV M,D - POP H ;HL PTS TO FIRST CHAR OF NEW LINE -; -; COPY COMMAND LINE INTO BUFFER -; -PCL6: - MOV A,M ;COPY - STAX D - INX H - INX D - ORA A ;DONE? - JNZ PCL6 - RET -; -; GETCL1 -; -GETCL1: - LHLD Z3ENV+18H ;GET ADDRESS OF COMMAND LINE BUFFER - PUSH H ;SAVE IT - INX H ;GET SIZE IN A - INX H - MOV A,M - POP H - RET -; -; GETCL2 -; -GETCL2: - LHLD Z3ENV+18H ;GET ADDRESS OF COMMAND LINE BUFFER - MOV A,M ;GET ADDRESS OF NEXT CHAR - INX H - MOV H,M - MOV L,A ;HL PTS TO NEXT CHAR - MOV A,M ;GET IT - RET - -; -;Enter ASCII Chars -; -EDITALP: - CALL PRINP ;PROMPT INPUT - DB DIM,'Enter Text',BRIGHT - DB CR,LF,' --> ',0 - CALL RDBUF ;INPUT TEXT WITHOUT PROMPT - CALL EDPRCL ;CLEAR PROMPT LINE - LDA EINDEX ;PT TO POSITION - XCHG - LHLD BLOCK ;COMPUTE OFFSET - XCHG - ADD E - MOV E,A - MOV A,D - ACI 0 - MOV D,A ;DE PTS TO BYTE, HL PTS TO TEXT -EDITA1: - MOV A,M ;GET CHAR - CPI EOLCH ;EOL? - JZ EDITA2 ;REFRESH SCREEN - CALL GETAHV ;GET ASCII OR VALUE - STAX D ;UPDATE BYTE - INX H ;PT TO NEXT INPUT CHAR - INR E ;PT TO NEXT BUFFER BYTE - JNZ EDITA1 -EDITA2: - CALL EDPLOT ;REPLOT - JMP EDITCMD ;DONE-REFRESH SCREEN -; -;Enter Numbers -; -EDITHEX: - CALL PRINP ;PROMPT INPUT - DB DIM,'Enter Hex Numbers' - DB BRIGHT - DB CR,LF,' --> ',0 - CALL RDBUF ;INPUT TEXT WITHOUT PROMPT - CALL EDPRCL ;CLEAR PROMPT LINE - LDA EINDEX ;PT TO POSITION - XCHG - LHLD BLOCK ;COMPUTE OFFSET - XCHG - ADD E - MOV E,A - MOV A,D - ACI 0 - MOV D,A ;DE PTS TO BYTE, HL PTS TO TEXT -EDITH1: - MOV A,M ;GET HEX DIGIT - CPI EOLCH ;EOL? - JZ EDITA2 ;REFRESH SCREEN - CPI ' ' ;SKIP SPACES - JNZ EDITH2 - INX H ;SKIP SPACE - JMP EDITH1 -EDITH2: - PUSH D ;SAVE PTR - CALL HEXIN ;GET VALUE AND POSITION HL - MOV A,E ;... IN A - POP D ;GET PTR - STAX D ;PUT BYTE - INR E ;ADVANCE TO NEXT BYTE - JNZ EDITH1 - JMP EDITA2 ;DONE-REFRESH -; -;CLEAR PROMPT LINE -; -EDPRCL: - CALL PRINP ;PROMPT LINE - DB 0 - MVI B,40 ;40 POSITIONS - CALL VEREOL ;CLEAR TO EOL OR 40 CHARS - CALL AT ;USER INPUT - DB ERROW,1 - MVI B,79 ;79 POSITIONS - JMP VEREOL -; -;Input Address -; -EDITADR: - CALL VPRINT - DB 'Address? ',0 - CALL RDBUF ;GET USER INPUT - CALL SKSP ;SKIP LEADING SPACES - MOV A,M ;EMPTY LINE? - ORA A - JZ EDIT0 - CALL HEXIN ;CONVERT FROM HEX - XCHG ;HL = ADDRESS - SHLD BLOCK - JMP EDIT0 ;REENTER -; -;Advance to Next Block -; -EDITPLUS: - LHLD BLOCK ;ADVANCE TO NEXT BLOCK - LXI D,128 ;128 BYTES - DAD D - SHLD BLOCK - JMP MU3R -; -;Backup to Last Block -; -EDITMINUS: - LHLD BLOCK ;BACKUP TO LAST BLOCK - LXI D,-128 ;128 BYTES - DAD D - SHLD BLOCK - JMP MU3R -; -;Exit MU3 -; -EDCC: - CALL DINIT ;DEINIT TERM - JMP CRLF ;NEW LINE -; -;EDIT MOVE: UP -; -EDUP: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;BACKUP INDEX BY 16 - SUI 16 -; -;Common EDIT MOVE Routine - on input, A=new index -; -EDMOVE: - ANI 7FH ;MOD 128 - STA EINDEX - CALL EDCUR ;SET CURSOR - JMP EDITCMD -; -;EDIT MOVE: DOWN -; -EDDOWN: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;INCREMENT INDEX BY 16 - ADI 16 - JMP EDMOVE ;COMMON ROUTINE -; -;EDIT MOVE: RIGHT -; -EDRIGHT: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;INCREMENT INDEX BY 1 - INR A - JMP EDMOVE ;COMMON ROUTINE -; -;EDIT MOVE: LEFT -; -EDLEFT: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;DECREMENT INDEX BY 1 - DCR A - JMP EDMOVE ;COMMON ROUTINE -; -;EDIT SUBROUTINE: EDCUR -; Position Editor Cursor at EINDEX -;EDIT SUBROUTINE: EDCCUR -; Clear Editor Cursor at EINDEX -; -EDCUR: - PUSH H ;SAVE HL - MVI C,ECURS ;CURSOR CHAR - CALL EDSETCUR - CALL AT ;UPDATE DATA - DB 3,74 - LDA EINDEX ;PT TO BYTE AT CURSOR - LHLD BLOCK - ADD L - MOV L,A - MOV A,H - ACI 0 - MOV H,A ;HL PTS TO BYTE AT CURSOR - MOV A,M ;GET BYTE - CALL PA2HC ;PRINT AS HEX - CALL SPACE - MOV A,M ;GET BYTE - POP H ;RESTORE HL - ANI 7FH ;MASK - CPI 7FH ;7FH AS DOT - JZ EDC7F - CPI ' ' ;OUTPUT CHAR OR DOT - JNC COUT -EDC7F: - MVI A,'.' ;DOT - JMP COUT -EDCCUR: - MVI C,' ' ;CLEAR CURSOR -EDSETCUR: - CALL EDROW ;COMPUTE ROW - ANI 0FH ;COMPUTE COL MOD 16 - MOV B,A ;RESULT IN B - ADD A ;*2 - ADD B ;*3 - ADI ECOL+6 ;ADD IN COL - DCR A ;SUBTRACT 1 - MOV L,A ;COL POSITION SET - CALL GOTOXY ;POSITION CURSOR - MOV A,C ;OUTPUT CHAR - JMP COUT -; -;Compute Row from EINDEX -; -EDROW: - LDA EINDEX ;GET INDEX - MOV B,A ;SAVE IN B - RRC ;DIVIDE BY 16 - RRC - RRC - RRC - ANI 0FH ;MASK FOR LSB ONLY - ADI EROW ;COMPUTE ROW - MOV H,A ;ROW SET - MOV A,B ;GET INDEX - RET - -; -;PRINT A SPACE -; -SPACE: - MVI A,' ' - JMP COUT -; -;PRINT AN BARISK IN REV VIDEO -; -BAR: - CALL VPRINT - DB DIM,'|',BRIGHT,0 - RET -; -;Get value from input buffer -; -GETAHV: - MOV A,M ;GET NEXT CHAR - CPI '<' ;HEX ESCAPE? - RNZ ;NO, RETURN -;"<<" means one "<" - INX H - MOV A,M - CPI '<' - RZ -;Got hex - PUSH D - CALL HEXIN ;GET VALUE - CPI '>' ;PROPER DELIM? - MOV A,E ;GET VALUE - POP D - RZ -; -;ERROR CONDITION IN SUBROUTINE - CLEAR STACK AND FLAG ERROR -; -SERR: - POP PSW ;CLEAR STACK - JMP WHAT ;ERROR -; -;Input Number from Command Line -- Assume it to be Hex -; Number returned in DE -; -HEXIN: - LXI D,0 ;INIT VALUE - MOV A,M - CPI '#' ;DECIMAL? - JZ HDIN ;MAKE DECIMAL -; -HINLP: - MOV A,M ;GET CHAR - CALL CAPS ;CAPITALIZE - CPI CR ;EOL? - RZ - CPI EOLCH ;EOL? - RZ - CPI SEPCH - RZ - CPI ' ' ;SPACE? - RZ - CPI '-' ;'THRU'? - RZ - CPI '>' - RZ - INX H ;PT TO NEXT CHAR - CPI '0' ;RANGE? - JC SERR - CPI '9'+1 ;RANGE? - JC HINNUM - CPI 'A' ;RANGE? - JC SERR - CPI 'F'+1 ;RANGE? - JNC SERR - SUI 7 ;ADJUST FROM A-F TO 10-15 -; -HINNUM: - SUI '0' ;CONVERT FROM ASCII TO BINARY - XCHG - DAD H ;MULT PREVIOUS VALUE BY 16 - DAD H - DAD H - DAD H - ADD L ;ADD IN NEW DIGIT - MOV L,A - XCHG - JMP HINLP -; -HDIN: - INX H ;SKIP '#' -; -;Input Number in Command Line as Decimal -; Number is returned in DE -; -DECIN: - LXI D,0 - MOV A,M ; GET 1ST CHAR - CPI '#' ; HEX? - JNZ DINLP - INX H ; PT TO DIGIT - JMP HINLP ; DO HEX PROCESSING -; -DINLP: - MOV A,M ;GET DIGIT - CALL CAPS ;CAPITALIZE - CPI '0' ;RANGE? - RC - CPI '9'+1 ;RANGE? - RNC - SUI '0' ;CONVERT TO BINARY - INX H ;PT TO NEXT - PUSH H - MOV H,D - MOV L,E - DAD H ;X2 - DAD H ;X4 - DAD D ;X5 - DAD H ;X10 - ADD L ;ADD IN DIGIT - MOV L,A - MOV A,H - ACI 0 - MOV H,A - XCHG ;RESULT IN DE - POP H - JMP DINLP -; -; READ LINE FROM USER INTO INPUT LINE BUFFER -; -RDBUF: - LHLD BUFFER ;PT TO BUFFER - XCHG ;SET DE AS PTR TO BUFFER - MVI C,10 ;BDOS READLN - PUSH D ;SAVE PTR - CALL BDOS - POP H ;PT TO CHAR COUNT - INX H - MOV E,M ;GET CHAR COUNT - MVI D,0 - INX H ;PT TO FIRST CHAR - PUSH H ;SAVE PTR - DAD D ;PT TO AFTER LAST CHAR - MVI M,0 ;STORE ENDING 0 - POP H ;PT TO FIRST CHAR - RET - -; -; Capitalize char in A -; -caps: - ani 7fh - cpi 'a' ;range? - rc - cpi 'z'+1 - rnc - ani 5fh ;mask to caps - ret -; -; CLEAR SCREEN ON TERMINAL -; -cls: - push h ;save regs - push d - lxi h,z3env+80H ;pt to environment - mov a,m ;no terminal? - cpi ' '+1 - jc clserr - lxi d,14h ;pt to cls delay - dad d - mov d,m ;get it - inx h ;pt to cls string - inx h - inx h - mov a,m ;get first char of string - ora a ;if no string, error - jz clserr - call vidout ;output string with delay - pop d ;done - pop h - xra a ;return NZ - dcr a - ret -clserr: - pop d ;done - pop h - xra a ;return Z - ret - -; -; Erase to End of Line -; Return with A=0 and Zero Flag Set if not done -; -ereol: - push b ;save regs - push d - push h - lxi h,z3env+80h ;pt to environment - mov a,m ;no terminal? - cpi ' '+1 - jc err - lxi d,16h ;pt to ereol delay - dad d - mov d,m ;get it - inx h ;pt to cls string - call vidskp ;skip over it - call vidskp ;skip over CM string - mov a,m ;get first char of ereol string - ora a ;if no string, error - jz err - call vidout ;output string with delay - jmp noerr - -; -; GOTO XY -; HL = Row/Col, with Home=1/1 -; Return with A=0 and Zero Flag Set if not done -; -gotoxy: - push b ;save regs - push d - push h - lxi h,z3env+80h ;pt to environment - mov a,m ;no terminal? - cpi ' '+1 - jc err - lxi d,15h ;pt to CM delay - dad d - mov a,m ;get it - sta cmdelay ;save it - inx h ;pt to CL string - inx h - call vidskp ;skip CL string - mov a,m ;get first char of CM string - ora a ;if no string, error - jz err - xchg ;DE=address of CM string - pop h ;get coordinates in HL - push h - call gxy ;output xy string with delay - lda cmdelay ;pause - call videlay -noerr: - pop h ;done - pop d - pop b - xra a ;return NZ - dcr a - ret -err: - pop h ;done - pop d - pop b - xra a ;return Z - ret - -; -; Position Cursor at Location Specified by Return Address -; Usage: -; call at -; db row,col ;location -; -at: - xthl ;pt to address - push d ;save DE - mov d,m ;get row - inx h - mov e,m - inx h ;HL pts to return byte - xchg ;DE pts to return byte, HL contains screen loc - call gotoxy ;position cursor - xchg ;HL pts to return byte - pop d ;restore registers - xthl ;restore stack ptr - ret - -; -; GOTOXY -; On input, H=Row and L=Column to Position To (1,1 is Home) -; On input, DE=address of CM string -; -gxy: - dcr h ;adjust to 0,0 for home - dcr l - xra a ;set row/column - sta rcorder ;row before column - sta rcbase ;add 0 to base -; -; Cycle thru string -; -gxyloop: - ldax d ;get next char - inx d ;pt to next - ora a ;done? - rz - cpi '%' ;command? - jz gxycmd - cpi '\' ;escape? - jz gxyesc - call cout ;send char - jmp gxyloop - -; -; Escape - output following byte literally -; -gxyesc: - ldax d ;get next char - call cout ;output literally - inx d ;pt to next - jmp gxyloop -; -; Interpret next character as a command character -; -gxycmd: - ldax d ;get command char - inx d ;pt to next - cpi 'd' ;%d - jz gxyout1 - cpi '2' ;%2 - jz gxyout2 - cpi '3' ;%3 - jz gxyout3 - cpi '.' ;%. - jz gxyout4 - cpi '+' ;%+v - jz gxyout5 - cpi '>' ;%>xy - jz gxygt - cpi 'r' ;%r - jz gxyrev - cpi 'i' ;%i - jz gxyinc - call cout ;output char if nothing else - jmp gxyloop -; -; Set row/col home to 1,1 rather than 0,0 -; -gxyinc: - mvi a,1 ;set rcbase to 1 - sta rcbase - jmp gxyloop -; -; Reverse order of output to column then row (default is row then column) -; -gxyrev: - mvi a,1 ;set column and row order - sta rcorder - jmp gxyloop -; -; Command: >xy -; If value of row/col is greater than x, add y to it -; -gxygt: - call getval ;get value - mov c,a ;save value - ldax d ;get value to test - inx d ;pt to next - cmp c ;if carry, value>x - jnc gxygt1 - ldax d ;get value to add - add c - call putval ;put value back -gxygt1: - inx d ;pt to next - jmp gxyloop ;resume -; -; Command: +n -; Add n to next value and output -; -gxyout5: - ldax d ;get value to add - inx d ;pt to next - mov b,a ;save in B - call getval ;get value - add b ;add in B - call cout ;output value -rcmark: - lda rcorder ;mark output - ori 80h - sta rcorder - jmp gxyloop -; -; Command: . -; Output next value -; -gxyout4: - call getval ;get value - call cout ;output value - jmp rcmark -; -; Command: 3 -; Output next value as 3 decimal digits -; -gxyout3: - call getval ;get value - mvi b,100 ;output 100's - mvi c,1 ;leading zeroes - call digout -gxyot3: - mvi b,10 ;output 10's - mvi c,1 ;leading zeroes -gxyot2: - call digout - adi '0' ;output 1's - call cout - jmp rcmark -; -; Command: 2 -; Output next value as 2 decimal digits -; -gxyout2: - call getval ;get value - jmp gxyot3 -; -; Command: d -; Output next value as n decimal digits with no leading zeroes -; -gxyout1: - call getval ;get value - mvi b,100 ;output 100's - mvi c,0 ;no leading zeroes - call digout - mvi b,10 ;output 10's - mvi c,0 ;no leading zeroes - jmp gxyot2 -; -; Return next value in A -; -getval: - lda rcorder ;get order flag - ora a ;already output the first value? - jm getval2 - ani 1 ;look at lsb - jz getvalr ;if 0, row first -getvalc: - lda rcbase ;get base offset - add l ;get column - ret -getvalr: - lda rcbase ;get base offset - add h ;get row - ret -getval2: - ani 1 ;look at lsb - jz getvalc - jmp getvalr -; -; Store A as next value -; -putval: - mov c,a ;save value - lda rcorder ;get order flag - ora a ;already output the first value? - jm putval2 - ani 1 ;look at lsb - jz putvalr ;if 0, row first -putvalc: - mov l,c ;set column - ret -putvalr: - mov h,c ;set row - ret -putval2: - ani 1 ;look at lsb - jz putvalc - jmp putvalr -; -; Output A as decimal digit char -; B=Quantity to Subtract from A, C=0 if no leading zero -; -digout: - push d ;save DE - mvi d,'0' ;char -decot1: - sub b ;subtract - jc decot2 - inr d ;increment char - jmp decot1 -decot2: - add b ;add back in - push psw ;save result - mov a,d ;get digit - cpi '0' ;zero? - jnz decot3 - mov a,c ;get zero flag - ora a ;0=no zero - jz decot4 -decot3: - mov a,d ;get digit - call cout ;print it -decot4: - pop psw ;get A - pop d ;restore DE - ret -; -; GXY Buffers -; -rcorder: - ds 1 ;0=row/col, else col/row -rcbase: - ds 1 ;0=org is 0,0, else org is 1,1 -cmdelay: - ds 1 ;number of milliseconds to delay for CM - -; -; Begin Standout Mode -; Return with A=0 and Zero Flag Set if not done -; -stndout: - push b - push d - push h ;save regs - lxi h,z3env+80h ;pt to environment - mov a,m ;no terminal? - cpi ' '+1 - jc err - lxi d,17h ;pt to cls string - dad d - mvi d,0 ;no delay - call vidskp ;skip over CL string - call vidskp ;skip over CM string - call vidskp ;skip over CE string - mov a,m ;get first char of SO string - ora a ;if no string, error - jz err - call vidout ;output string with delay - jmp noerr - -; -; Terminate Standout Mode -; Return with A=0 and Zero Flag Set if not done -; -stndend: - push b - push d - push h ;save regs - lxi h,z3env+80h ;pt to environment - mov a,m ;no terminal? - cpi ' '+1 - jc err - lxi d,17h ;pt to cls string - dad d - mvi d,0 ;no delay - call vidskp ;skip over CL string - call vidskp ;skip over CM string - call vidskp ;skip over CE string - call vidskp ;skip over SO string - mov a,m ;get first char of SE string - ora a ;if no string, error - jz err - call vidout ;output string with delay - jmp noerr - -; -; Initialize Terminal -; Affect No Registers -; -tinit: - push h ;save regs - push d - push psw - lxi h,z3env+80h ;pt to environment - mov a,m ;no terminal? - cpi ' '+1 - jc tid - lxi d,17h ;pt to cls string - dad d - mvi d,0 ;no delay - call vidskp ;skip over CL string - call vidskp ;skip over CM string - call vidskp ;skip over CE string - call vidskp ;skip over SO string - call vidskp ;skip over SE string - mov a,m ;get first char of TI string - ora a ;if no string, error - jz tid - call vidout ;output string with delay -tid: - pop psw ;done - pop d - pop h - ret - -; -; De-Initialize Terminal -; Affect No Registers -; -dinit: - push h ;save regs - push d - push psw - lxi h,z3env+80h ;pt to environment - mov a,m ;no terminal? - cpi ' '+1 - jc tid - lxi d,17h ;pt to cls string - dad d - mvi d,0 ;no delay - call vidskp ;skip over CL string - call vidskp ;skip over CM string - call vidskp ;skip over CE string - call vidskp ;skip over SO string - call vidskp ;skip over SE string - call vidskp ;skip over TI string - mov a,m ;get first char of TE string - ora a ;if no string, error - jz tid - call vidout ;output string with delay - jmp tid - -; -; VIDOUT - Output video string pted to by HL -; Output also a delay contained in the D register -; -vidout: - mov a,m ;get next char - ora a ;done if zero - jz vid2 - inx h ;pt to next - cpi '\' ;literal value? - jnz vid1 - mov a,m ;get literal char - inx h ;pt to after it -vid1: - call cout ;output char - jmp vidout -vid2: - mov a,d ;output delay and fall thru to VIDELAY - -; -; VIDELAY pauses for the number of milliseconds indicated by the A -; register. VIDELAY assumes a ZCPR3 environment and uses it to determine -; processor speed. -; -videlay: - push psw ;save regs - push b - push d - push h - mov c,a ;save count in C - ora a ;no delay? - jz done - lxi h,z3env ;pt to environment - lxi d,2Bh ;offset to processor speed - dad d - mov a,m ;get processor speed - ora a ;zero? - jnz vidl1 - mvi a,4 ;assume 4 MHz -vidl1: - mov b,a ;processor speed in B -vidl2: - push b ;delay 1 ms - call delay - pop b - dcr c ;count down - jnz vidl2 -done: - pop h ;restore regs - pop d - pop b - pop psw - ret -; -; Delay 1 ms at Clock speed -; -delay: - call del1 ;delay 1 ms at 1MHz - dcr b ;count down clock speed - jnz delay - ret -; -; Delay 1 ms at 1MHz -; -del1: - mvi c,20 ;20 loops of 51 cycles each ~ 1000 cycles -del1a: - xthl ;18 cycles - xthl ;+18 = 36 cycles - dcr c ;+ 5 = 41 cycles - jnz del1a ;+10 = 51 cycles - ret - -; -; VIDSKP - Skip over video string pted to by HL; pt to byte after string -; -vidskp: - mov a,m ;get next char - inx h ;pt to next - ora a ;done if zero - rz - cpi '\' ;literal value? - jnz vidskp ;continue if not - inx h ;pt to after literal value - jmp vidskp - -; -; Print A as 2 Hex Chars -; -pa2hc: - push psw - push b - mov b,a ;value in B - rlc - rlc - rlc - rlc - call pa2hc1 - mov a,b ;get value - call pa2hc1 - pop b - pop psw - ret -pa2hc1: - ani 0fh - adi '0' ;to ASCII - cpi '9'+1 - jc pa2hc2 - adi 7 ;to letter -pa2hc2: - jmp cout - -; -; Skip Spaces -; -sksp: - mov a,m ;skip to non-space - cpi ' ' - rnz - inx h - jmp sksp - -; -;EDITOR BUFFERS -; -BLOCK: - DS 2 ;ADDRESS OF CURRENT BLOCK -BUFFER: - DS 2 ;PTR TO FREE SPACE -EINDEX: - DS 1 ;INDEX ENTRY -EDRUN: - DS 1 ;FLAG SAYING THAT EDITOR IS RUNNING - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/DEV.COM b/Source/Images/d_bp/u15/DEV.COM deleted file mode 100644 index e45fab2a..00000000 Binary files a/Source/Images/d_bp/u15/DEV.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/DEV.MAC b/Source/Images/d_bp/u15/DEV.MAC deleted file mode 100644 index 0b44fef8..00000000 --- a/Source/Images/d_bp/u15/DEV.MAC +++ /dev/null @@ -1,493 +0,0 @@ -; -; PROGRAM: DEV3 -; AUTHOR: RICHARD CONN -; VERSION: 1.0 -; DATE: 4 Apr 84 -; PREVIOUS VERSION: None -; DERIVATION: DEVICE2 of ZCPR2 -; -VERS EQU 10 -z3env SET 0f400h - -; -; DEV is a program which enables the user to manipulate the -; extended ZCPR3 redirectable device drivers. It allows the user to -; perform the following functions: -; -; o Display the Names of the Current Devices -; o Set One or More of the Current Devices -; o Ask for Help -; -; The format of the DEV command is: -; -; DEV or DEV // <-- Ask for Help -; DEV command,command,command ... <-- Issue Commands -; -; where "command" may take the following forms: -; -; DISPLAY ALL <-- Display Names of All Devices -; DISPLAY CON <-- Display Names of Consoles -; DISPLAY LST <-- Display Names of Printers -; DISPLAY RDR <-- Display Names of Readers -; DISPLAY PUN <-- Display Names of Punches -; -; CON:=name <-- Select Console -; LST:=name <-- Select Printer -; RDR:=name <-- Select Reader -; PUN:=name <-- Select Punch -; - -; -; Constants -; -tbuff equ 80h -cr equ 0dh -lf equ 0ah - -; -; SYSLIB Routines -; - ext z3init,getiop - ext cin,cout,epstr,eprint,cline,crlf - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - -; -; Start of Program -; - - call getiop ;check for initialization - mov a,h - ora l ;must NOT be zero - jnz start0 - call banner - call eprint - db cr,lf,'DEV NOT Initialized with I/O Base',0 -abort: - call eprint - db ' -- Aborting',0 - ret - -start0: - call status ;check for drivers - jnz start1 - call banner - call eprint - db cr,lf,'Redirection Not Supported',0 - jmp abort - -start1: - lxi h,tbuff ;pt to input buffer - call cline ;extract and save command line - call sblank ;skip to non-blank - ora a ;EOL? - jz help ;select help - cpi '/' ;help? - jnz docmd ;run command subroutine - -; -; Print Help Message -; -help: - call banner - call eprint - db cr,lf,'DEV - Quick Redirectable I/O Device Selector' - db cr,lf,'Syntax:' - db cr,lf,' DEV or DEV // ' - db '<-- Ask for Help' - db cr,lf,' DEV Command,Command, ... ' - db '<-- Issue Commands' - db cr,lf,'where "command" may take the following forms:' - db cr,lf,' DISPLAY=ALL ' - db '<-- Display All Devices' - db cr,lf,' DISPLAY=CON ' - db '<-- Display Consoles' - db cr,lf,' DISPLAY=LST ' - db '<-- Display Printers' - db cr,lf,' DISPLAY=RDR ' - db '<-- Display Readers' - db cr,lf,' DISPLAY=PUN ' - db '<-- Display Punches' - db cr,lf - db cr,lf,' CON:=name <-- Select Console' - db cr,lf,' LST:=name <-- Select Printer' - db cr,lf,' RDR:=name <-- Select Reader' - db cr,lf,' PUN:=name <-- Select Punch' - db 0 - ret -; -; Print Banner -; -banner: - call eprint - db 'DEV, Version ' - db (vers/10)+'0','.',(vers mod 10)+'0',0 - ret -; -; Skip to Non-Blank Routine -; -sblank: - mov a,m ;get char - inx h ;pt to next - cpi ' ' ;blank? - jz sblank ;continue if so - dcx h ;pt to non-blank - ret - -; -; Skip until a delimiter encountered -; -sdelm: - mov a,m ;get char - inx h ;pt to next - cpi ' '+1 ; or less? - rc - cpi '=' - rz - cpi ',' - rz - jmp sdelm - -; -; DOCMD -- This subroutine processes the command line pted to by HL. -; It is the Main Line if a DEVICE command line is given, it is just -; a subroutine if the user is in interactive mode. -; -docmd: - call docmd1 ;do first command - call sdelm ;skip to delim - cpi ',' ;another command? - jz docmd - ret -docmd1: - mov a,m ;get command letter - cpi 'C' ;console assignment? - jz docon - cpi 'D' ;display? - jz dodisp - cpi 'L' ;LST:? - jz dolst - cpi 'P' ;PUN:? - jz dopun - cpi 'R' ;RDR:? - jz dordr -cerr: - call eprint - db cr,lf,'Error at -- ',0 - call epstr ;print rest - ret - -; -; Do LST: Assignment -; -dolst: - call eprint - db ' LST:',0 - mvi a,3 ;select LST: - jmp assign - -; -; Do PUN: Assignment -; -dopun: - call eprint - db ' PUN:',0 - mvi a,2 ;select PUN: - jmp assign - -; -; Do RDR: Assignment -; -dordr: - call eprint - db ' RDR:',0 - mvi a,1 ;select RDR: - jmp assign - -; -; Do CON: Assignment -; -docon: - call eprint - db ' CON:',0 - mvi a,0 ;select console -; -; Do Assignment in General -; -assign: - mov b,a ;save A in B - push b ;save BC - call sdelm ;skip to delimiter - pop b ;get BC - cpi ' ' - jz asgn0 - cpi '=' - jnz cerr -asgn0: - mov a,b ;get A back - sta logical ;save logical device number - shld name ;save ptr to mnemonic - mov b,a ;number in B - inr b ;add 1 for offset - call status ;get device status - dcx h ;pt to previous - dcx h -asgn1: - inx h ;pt to next - inx h - dcr b ;count down - jnz asgn1 - mov c,m ;get number of devices in C - mov a,c ;check for value of zero - ora a - jnz asgn2 - lhld name ;pt to error name - jmp cerr -asgn2: - lda logical ;get logical device number - mov b,a ;... in B - push b ;save device count - dcr c ;pt to previous - call namer ;get name - xchg ;name pted to by DE - lhld name ;user's name pted to by HL -asgn3: - ldax d ;get name of device - cpi ' '+1 ;done? - jc asgn3a - cmp m ;compare to user - jnz asgn4 - inx h ;pt to next - inx d - jmp asgn3 -asgn3a: - mov a,m ;get user - cpi ' '+1 ;done? - jc asgn3b - cpi ',' ;done? - jnz asgn4 -asgn3b: - pop b ;match -- C-1 is selected device - dcr c ;decrement - call select ;select device - lda logical ;get logical device in A - call current ;print name of device selected - lhld name ;pt to name for scan continuation - ret -asgn4: - pop b ;count down - dcr c ;count down - jnz asgn2 ;continue - lhld name ;pt to invalid name - call eprint - db cr,lf,' Invalid Name at -- ',0 - call epstr - lhld name ;pt to name for scan continuation - ret - -; -; Display Devices and Assignments -; -dodisp: - call sdelm ;skip to delimiter - ora a ;none=all - jz dispall - mov a,m ;get char after delimiter - cpi 'A' ;all? - jz dispall - cpi 'C' ;CON: - jz dispcon - cpi 'L' ;LST: - jz displst - cpi 'P' ;PUN: - jz disppun - cpi 'R' ;RDR: - jz disprdr - jmp cerr -dispall: - call dispcon ;successive displays - call disprdr - call eprint - db cr,lf,'Strike Any Key -- ',0 - call cin - call disppun - jmp displst -dispcon: - call eprint - db cr,lf,'CON:',0 - mvi a,0 ;select CON: - call disp - jmp curr -displst: - call eprint - db cr,lf,'LST:',0 - mvi a,3 ;select LST: - call disp - jmp curr -disprdr: - call eprint - db cr,lf,'RDR:',0 - mvi a,1 ;select RDR: - call disp - jmp curr -disppun: - call eprint - db cr,lf,'PUN:',0 - mvi a,2 ;select PUN: - call disp -; -; Print Name of Current Device -; -curr: - call crlf ;new line -current: - push h ;save ptr - mov b,a ;save number in B - push b ;save B - call eprint - db ' Assignment is ',0 - push b ;save B - call status ;get status - pop b ;get B - inr b ;add 1 for offset - dcx h ;back up -curr1: - inx h ;pt to next - inx h - dcr b ;count down - jnz curr1 - pop b ;get logical number in B - mov c,m ;get physical number in C - call pname0 ;print first part of name only - pop h ;get ptr - ret -; -; Print Names of All Physical Devices for a Logical Device -; -disp: - push h ;save char ptr - push psw ;save device number - call eprint - db ' Devices --',0 - mov b,a ;logical device in B - push b ;save for later - push b ;save it - call status ;get status report - pop b ;get logical device number - inr b ;add 1 for offset - dcx h ;back up - dcx h -disp1: - inx h ;pt to next - inx h - dcr b ;count down - jnz disp1 - pop b ;get B back - mov c,m ;get count of devices - mov a,c ;check for none - ora a - jz disp3 -disp2: - push b ;save values - dcr c ;pt to next name - call eprint - db cr,lf,' ',0 - call pnamer ;print name (B=logical, C=physical) - pop b ;get count - dcr c ;count down - jnz disp2 -disp3: - pop psw - pop h - ret -; -; Routine to Print Name of Selected Device -; B=logical number, C=physical number -; -pnamer: - push b ;save BC - call pname0 ;print first part of name - call eprint ;print separator - db ' - ',0 - call epstr ;print rest as string - pop b ;restore BC - ret -; -; Print first part of selected device name -; -pname0: - call namer ;get ptr to string - mvi b,8 ;at most 8 chars -pname1: - mov a,m ;get char - inx h ;pt to next char - cpi ' ' ;end of name? - jz pname2 - call cout ;print char - dcr b ;count down - jnz pname1 - ret -pname2: - mvi a,' ' ;print spaces - call cout - dcr b ;count down - jnz pname2 - ret - -; -; Basic Interface Routines -; -status: - lxi d,0 ;Offset 0 -runit: - call getiop ;device driver base - dad d - pchl -select: - lxi d,3 ;Offset 3 - jmp runit -namer: - lxi d,6 ;Offset 6 - jmp runit - -; -; Buffers -; -logical: - ds 1 ;Logical Device Number -name: - ds 2 ;Pointer to User-Supplied Name - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/DEV10.LBR b/Source/Images/d_bp/u15/DEV10.LBR deleted file mode 100644 index 21787d22..00000000 Binary files a/Source/Images/d_bp/u15/DEV10.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/DEVICE.COM b/Source/Images/d_bp/u15/DEVICE.COM deleted file mode 100644 index 01cd2c6f..00000000 Binary files a/Source/Images/d_bp/u15/DEVICE.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/DEVICE.MAC b/Source/Images/d_bp/u15/DEVICE.MAC deleted file mode 100644 index a3809ed7..00000000 --- a/Source/Images/d_bp/u15/DEVICE.MAC +++ /dev/null @@ -1,577 +0,0 @@ -; -; PROGRAM: DEVICE3 -; AUTHOR: RICHARD CONN -; VERSION: 1.0 -; DATE: 4 Apr 84 -; PREVIOUS VERSION: None -; DERIVATION: DEVICE2 from ZCPR2 -; -VERS EQU 10 -z3env SET 0f400h - -; -; DEVICE is a program which enables the user to manipulate the -; extended ZCPR3 redirectable device drivers. It allows the user to -; perform the following functions: -; -; o Display the Names of the Current Devices -; o Set One or More of the Current Devices -; o Ask for Help -; -; The format of the DEVICE command is: -; -; DEVICE <-- Enter Interactive Mode -; DEVICE // <-- Ask for Help -; -; In Interactive Mode, DEVICE commands are: -; -; DISPLAY ALL <-- Display Names of All Devices -; DISPLAY CON <-- Display Names of Consoles -; DISPLAY LST <-- Display Names of Printers -; DISPLAY RDR <-- Display Names of Readers -; DISPLAY PUN <-- Display Names of Punches -; -; CON: name <-- Select Console -; LST: name <-- Select Printer -; RDR: name <-- Select Reader -; PUN: name <-- Select Punch -; - -; -; Constants -; -fcb equ 5ch -cr equ 0dh -lf equ 0ah - -; -; SYSLIB Routines -; - ext z3init,getiop - ext cin,cout,epstr,eprint,cline,bline,codend,caps - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - -; -; Start of Program -; - - call getiop ;check for initialization - mov a,h - ora l ;must NOT be zero - jnz start0 - call banner - call eprint - db cr,lf,'DEVICE NOT Initialized with I/O Base',0 -abort: - call eprint - db ' -- Aborting',0 - ret - -start0: - call status ;check for drivers - jnz start1 - call banner - call eprint - db cr,lf,'Redirection Not Supported',0 - jmp abort - -start1: - lda fcb+1 ;get first char of argument - cpi '/' ;help? - jnz command ;run command subroutine - -; -; Print Help Message -; -help: - call banner - call eprint - db cr,lf,'DEVICE - Interactive Redirectable I/O Driver Selection' - db cr,lf,'Syntax:' - db cr,lf,' DEVICE <-- Enter Interactive Mode' - db cr,lf,' DEVICE // <-- Print Help Message' - db 0 - ret -; -; Print General Help Message -; -genhelp: - call eprint - db 'Enter Command Character:' - db cr,lf,' D - Display all or selected devices' - db cr,lf,' C - Select Console Device' - db cr,lf,' L - Select List Device' - db cr,lf,' P - Select Punch Device' - db cr,lf,' R - Select Reader Device' - db cr,lf,' X - Exit Program' - db 0 - ret -; -; Print Display Help Message -; -disphelp: - call eprint - db cr,lf,'Enter Devices to Display:' - db cr,lf,' A - All' - db cr,lf,' C - Consoles' - db cr,lf,' L - Lists' - db cr,lf,' P - Punches' - db cr,lf,' R - Readers' - db 0 - ret -; -; Print Banner -; -banner: - call eprint - db 'DEVICE3, Version ' - db (vers/10)+'0','.',(vers mod 10)+'0',0 - ret -; -; Skip to Non-Blank Routine -; -sblank: - mov a,m ;get char - inx h ;pt to next - cpi ' ' ;blank? - jz sblank ;continue if so - dcx h ;pt to non-blank - ret - -; -; COMMAND -- This is an interactive mainline which allows user input, -; runs command lines via DOCMD, and permits Help and Comments -; -command: - call banner - call eprint - db ' - Interactive I/O Device Selection Utility' - db cr,lf,'Strike ? for Help' - db 0 -cloop: - call eprint - db cr,lf,'DEVICE3 Command? ',0 - lxi h,majcmd ;process major command - call ccheck ;look for and run command - mov a,b ;get char - call cout ;echo it - call eprint - db ' - Invalid Command',0 - jmp cloop -; -; Command Table for Major Commands -; -majcmd: - db '?' ;help - dw genhelp - db ' ' ;skip command - dw exit1 - db cr ;skip command - dw exit1 - db 'D' ;display devices - dw display - db 'C' ;Select Console - dw console - db 'L' ;Select List - dw list - db 'P' ;Select Punch - dw punch - db 'R' ;Select Reader - dw reader - db 'X' ;Exit - dw exit - db 0 ;end of table -; -; Display major command -; -display: - pop psw ;clear return address - call eprint - db 'Display Devices for ',0 - lxi h,discmd ;table of display commands - call ccheck - mov a,b - call cout ;print error command - call eprint - db ' - Invalid Command',cr,lf,0 - jmp display -; -; Display Command Table -; -discmd: - db '?' ;help - dw disphelp - db cr ;exit - dw exit1 - db ' ' ;exit - dw exit1 - db 'A' ;all - dw dispall - db 'C' ;console - dw dispcon - db 'L' ;list - dw displst - db 'P' ;punch - dw disppun - db 'R' ;reader - dw disprdr - db 0 ;end of table - -; -; Console major command -; -console: - call eprint - db 'Select Console ',0 - call getname - mvi a,0 ;select CON: - jmp assign -; -; List major command -; -list: - call eprint - db 'Select List ',0 - call getname - mvi a,3 ;select LST: - jmp assign -; -; Punch major command -; -punch: - call eprint - db 'Select Punch ',0 - call getname - mvi a,2 ;select PUN: - jmp assign -; -; Reader major command -; -reader: - call eprint - db 'Select Reader ',0 - call getname - mvi a,1 ;select RDR: - jmp assign -; -; Exit major command -; -exit: - call eprint - db 'Exit',0 - pop psw ;clear stack -exit1: - ret ;exit to OS or DEVICE (if entry at EXIT1) -; -; Check for Command in A in Table Pted to by HL -; -ccheck: - call cin ;get user input - call caps ;capitalize it - mov b,a ;save command in B -cc1: - mov a,m ;get command letter - ora a ;end of table? - rz - cmp b ;match? - jz cc2 - inx h ;skip to next - inx h - inx h - jmp cc1 -cc2: - inx h ;pt to address - mov e,m ;get low - inx h - mov d,m ;get high - lxi h,cloop ;set return address - xthl ;return address on stack - xchg ;address of routine in HL - pchl ;"call" routine -; -; Get Device Name from User -; Return with NZ if name input, else reissue command -; -getname: - call eprint - db ' [Enter a Device Name] ',0 - call codend ;pt to end of available code - mvi m,20 ;set length of line - mvi a,0ffh ;capitalize - call bline - call sblank ;skip to non-blank - mov a,m ;empty line? - ora a ;0=yes - jz gnabort ;abort input if so - shld name ;set ptr to name - ret ;NZ means name present -gnabort: - pop psw ;clear stack - ret ;return to main command processor - -; -; Do Assignment in General -; -assign: - mov b,a ;save A in B - sta logical ;save logical device number - inr b ;add 1 for offset - call status ;get device status - dcx h ;pt to previous - dcx h -asgn1: - inx h ;pt to next - inx h - dcr b ;count down - jnz asgn1 - mov c,m ;get number of devices in C - mov a,c ;check for value of zero - ora a - jnz asgn2 - call eprint - db cr,lf,' Invalid Device Name: ',0 - lhld name ;pt to error name - call epstr ;print name - ret -asgn2: - lda logical ;get logical device number - mov b,a ;... in B - push b ;save device count - dcr c ;pt to previous - call namer ;get name - xchg ;name pted to by DE - lhld name ;user's name pted to by HL -asgn3: - ldax d ;get name of device - cpi ' '+1 ;done? - jc asgn3a - cmp m ;compare to user - jnz asgn4 - inx h ;pt to next - inx d - jmp asgn3 -asgn3a: - mov a,m ;get user - cpi ' '+1 ;done? - jc asgn3b - cpi ',' ;done? - jnz asgn4 -asgn3b: - pop b ;match -- C-1 is selected device - dcr c ;decrement - call select ;select device - lda logical ;get logical device in A - call curr ;print name of device selected - lhld name ;pt to name for scan continuation - ret -asgn4: - pop b ;count down - dcr c ;count down - jnz asgn2 ;continue - lhld name ;pt to invalid name - call eprint - db cr,lf,'Invalid Name at -- ',0 - call epstr - lhld name ;pt to name for scan continuation - ret - -; -; Display Devices -; -dispall: - call eprint - db 'All Devices',cr,lf - db ' CON: Devices --',0 - call dc1 ;successive displays - call eprint - db cr,lf,' RDR: Devices --',0 - call dr1 - call eprint - db cr,lf,'Strike Any Key -- ',0 - call cin - call eprint - db cr,lf,' PUN: Devices --',0 - call dp1 - call eprint - db cr,lf,' LST: Devices --',0 - jmp dl1 -dispcon: - call eprint - db 'CON: Devices',0 -dc1: - mvi a,0 ;select CON: - call disp - jmp curr -displst: - call eprint - db 'LST: Devices',0 -dl1: - mvi a,3 ;select LST: - call disp - jmp curr -disprdr: - call eprint - db 'RDR: Devices',0 -dr1: - mvi a,1 ;select RDR: - call disp - jmp curr -disppun: - call eprint - db 'PUN: Devices',0 -dp1: - mvi a,2 ;select PUN: - call disp -; -; Print Name of Current Device -; -curr: - push h ;save ptr - mov b,a ;save number in B - push b ;save B - call eprint - db cr,lf,' Current Assignment: ',0 - push b ;save B - call status ;get status - pop b ;get B - inr b ;add 1 for offset - dcx h ;back up -curr1: - inx h ;pt to next - inx h - dcr b ;count down - jnz curr1 - pop b ;get logical number in B - mov c,m ;get physical number in C - call pname0 ;print first part of name only - pop h ;get ptr - ret -; -; Print Names of All Physical Devices for a Logical Device -; -disp: - push h ;save char ptr - push psw ;save device number - mov b,a ;logical device in B - push b ;save for later - push b ;save it - call status ;get status report - pop b ;get logical device number - inr b ;add 1 for offset - dcx h ;back up - dcx h -disp1: - inx h ;pt to next - inx h - dcr b ;count down - jnz disp1 - pop b ;get B back - mov c,m ;get count of devices - mov a,c ;check for none - ora a - jz disp3 -disp2: - push b ;save values - dcr c ;pt to next name - call eprint - db cr,lf,' ',0 - call pnamer ;print name (B=logical, C=physical) - pop b ;get count - dcr c ;count down - jnz disp2 -disp3: - pop psw - pop h - ret -; -; Routine to Print Name of Selected Device -; B=logical number, C=physical number -; -pnamer: - push b ;save BC - call pname0 ;print first part of name - call eprint ;print separator - db ' - ',0 - call epstr ;print rest as string - pop b ;restore BC - ret -; -; Print first part of selected device name -; -pname0: - call namer ;get ptr to string - mvi b,8 ;at most 8 chars -pname1: - mov a,m ;get char - inx h ;pt to next char - cpi ' ' ;end of name? - jz pname2 - call cout ;print char - dcr b ;count down - jnz pname1 - ret -pname2: - mvi a,' ' ;print spaces - call cout - dcr b ;count down - jnz pname2 - ret - -; -; Basic Interface Routines -; -status: - lxi d,0 ;Offset 0 -runit: - call getiop ;device driver base - dad d - pchl -select: - lxi d,3 ;Offset 3 - jmp runit -namer: - lxi d,6 ;Offset 6 - jmp runit - -; -; Buffers -; -logical: - ds 1 ;Logical Device Number -name: - ds 2 ;Pointer to User-Supplied Name - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/DEVICE10.LBR b/Source/Images/d_bp/u15/DEVICE10.LBR deleted file mode 100644 index 0d2eb318..00000000 Binary files a/Source/Images/d_bp/u15/DEVICE10.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/DIFF.COM b/Source/Images/d_bp/u15/DIFF.COM deleted file mode 100644 index 49eb4a89..00000000 Binary files a/Source/Images/d_bp/u15/DIFF.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/DIFF.MAC b/Source/Images/d_bp/u15/DIFF.MAC deleted file mode 100644 index 7b14b767..00000000 --- a/Source/Images/d_bp/u15/DIFF.MAC +++ /dev/null @@ -1,725 +0,0 @@ -; -; PROGRAM: DIFF -; AUTHOR: Richard Conn -; VERSION: 2.0 -; DATE: 18 MAY 84 -; PREVIOUS VERSIONS: 1.6 (16 JAN 83) -; PREVIOUS VERSIONS: 1.5 (9 JAN 83), 1.4 (6 JAN 83), 1.3 (4 JAN 83) -; PREVIOUS VERSIONS: 1.2 (19 DEC 82), 1.1 (8 DEC 82), 1.0 (24 JULY 82) -; DERIVATION: COMPARE, VERSION 1.1 -; -VERS EQU 20 -z3env SET 0f400h - -; -; DIFF is designed to provide the user with a convenient method -; to compare the contents of two files. It is invoked by one of two basic -; forms: -; -; DIFF filename.typ -; or -; DIFF file1.typ file2.typ -; -; The first form compares the file named "filename.typ" on drive A: -; to the file of the same name on drive B:; the second form compares the -; file named "file1.typ" on drive A: to the file named "file2.typ" on drive -; B:. Wild cards may NOT be used. The listing generated by the program gives -; relative offsets (in hex and decimal) as well as the different byte values -; in hex, decimal, and ASCII. -; - -; SIZE OF BUFFER -BLIMIT EQU 32 ; NUMBER OF 128-BYTE BLOCKS -BSIZE EQU BLIMIT*128 ; 4K - -; CP/M Constants -CPM equ 0 ; CP/M Warm Boot -BUFF equ CPM+80H ; Temporary Buffer -CR equ 0DH ; -LF equ 0AH ; -CTRLC EQU 'C'-'@' -CTRLX EQU 'X'-'@' - -; SYSLIB and Z3LIB ROUTINES - EXT Z3INIT,ZFNAME,GETCRT - EXT PHL4HC,PHLDC,PA2HC,PADC - EXT BDOS,INITFCB - EXT LOGUD,RETUD - EXT F$OPEN,F$CLOSE,F$READ - EXT CAPS,CIN,COUT,CRLF,MOVEB,PRINT - EXT CODEND - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env -; -; SET BUFFER LOCATIONS -; - CALL CODEND ; ALLOCATE BUFFER SPACE - SHLD INLINE ; SET PTR TO INPUT LINE - LXI D,100H ; BUFFER SIZE - DAD D - SHLD BUFF1 ; SOURCE 1 BUFFER - LXI D,BSIZE ; SIZE OF BUFFER - INR D ; ADD 1 - DAD D - SHLD BUFF2 ; SOURCE 2 BUFFER -; -; SET OPERATIONS FLAGS -; - XRA A ; A=0 - STA MULT ; SET NO MULTIPLE RUN - STA COMP ; SET NO COMPARE ONLY - CALL GETCRT ; GET CRT CHARACTERISTICS - INX H ; PT TO TEXT LINE COUNT - INX H - MOV A,M ; GET COUNT - STA LSET ; SET COUNTER -; -; EXTRACT COMMAND LINE INFORMATION -; - LHLD INLINE ; PT TO INPUT LINE BUFFER - XCHG ; ... IN DE - LXI H,BUFF+1 ; PROCESS OPTIONS IN BUFFER - MVI B,80H ; ARBITRARY 80H BYTES - CALL MOVEB - XCHG ; PT TO FIRST CHAR WITH HL - CALL SBLANK ; SKIP SPACES - ORA A ; EOL? - JZ PRHELP ; PRINT HELP IF SO - CPI '/' ; ASKING FOR HELP? - JZ PRHELP - LXI D,FCBS ; PT TO SOURCE FCB - MVI A,0 ; DIR BEFORE DU - CALL ZFNAME ; EXTRACT NAME AND DIRECTORY DATA - MOV A,M ; GET NEXT CHAR - CPI ',' - JZ START2 - PUSH H ; SAVE PTR - LXI H,FCBS+1 ; NO 2ND NAME, SO SET IT TO SAME AS FIRST - LXI D,FCBD+1 - MVI B,11 ; 11 BYTES - CALL MOVEB - CALL RETUD ; GET CURRENT USER/DISK - MOV A,B ; GET DISK - INR A ; A=1 - STA FCBD ; SET DISK - MOV A,C ; GET USER - STA FCBD+13 ; PT TO S1 FOR USER - POP H ; GET PTR - JMP START3 -START2: - INX H ; PT TO NEXT CHAR AFTER COMMA - LXI D,FCBD ; SET DEST FCB - MVI A,0 ; DIR BEFORE DU - CALL ZFNAME ; PROCESS NAME - LDA FCBD+1 ; CHECK FOR NO NAME - CPI ' ' ; SPACE MEANS NO NAME - JNZ START3 - PUSH H ; SAVE PTR - PUSH B ; SAVE USER/DISK - LXI H,FCBS+1 ; SET NAMES THE SAME - LXI D,FCBD+1 ; COPY SOURCE TO DEST - MVI B,11 ; 11 BYTES - CALL MOVEB - POP B ; RESTORE BC - POP H ; RESTORE PTR -START3: - CALL SBLANK ; SKIP SPACES - CALL OPTS ; PROCESS OPTIONS -START4: - LXI H,FCBS ; SET UP SOURCE FCB - CALL QCHECK ; NO AMBIGUOUS ENTRIES PERMITTED - LXI H,FCBD ; SET UP DESTINATION FCB - CALL QCHECK ; NO AMBIGUOUS ENTRIES PERMITTED - CALL RETUD ; GET CURRENT DU IN BC - LXI H,FCBS ; PT TO SOURCE DISK - MOV A,M ; GET SOURCE DISK - ORA A ; CURRENT? - JNZ START5 - MOV A,B ; SET CURRENT DISK - INR A ; ADJUST FOR A=1 -START5: - STA SDISK - MVI M,0 ; CLEAR SOURCE DISK - LDA FCBS+13 ; GET USER - STA SUSER - LXI H,FCBD ; GET DESTINATION DISK - MOV A,M ; GET DEST DISK - ORA A ; CURRENT? - JNZ START6 - MOV A,B ; SET CURRENT DISK - INR A ; ADJUST FOR A=1 -START6: - STA DDISK - MVI M,0 ; CLEAR DEST DISK - LDA FCBD+13 ; GET USER - STA DUSER -MLOOP: - CALL BANNER ; PRINT BANNER - CALL PRS1 ; PRINT SOURCE FILE NAMES - CALL PRS2 - LDA MULT ; MULTIPLE RUNS - ORA A - JZ MLOOP1 - CALL PRINT - DB CR,LF,' Type ^C to Abort or RETURN to Proceed - ',0 - CALL CIN ; GET RESPONSE - CALL CAPS ; CAPITALIZE - CPI CTRLC ; ABORT? - RZ - MVI C,13 ; RESET DISKS - CALL BDOS -MLOOP1: - CALL LOGS ; LOG IN SOURCE - LXI D,FCBS ; TRY TO OPEN SOURCE 1 - CALL INITFCB ; INIT FCB - CALL F$OPEN ; Z IF NO ERROR - JNZ FERR - CALL LOGD ; LOG IN DEST DISK/USER - LXI D,FCBD ; TRY TO OPEN SOURCE 2 - CALL INITFCB ; INIT FCB - CALL F$OPEN - JNZ FERR - XRA A ; A=0 - STA FIRST ; SET FLAG FOR FIRST ERROR - LXI H,0 ; INIT OFFSET - SHLD OFFSET - CALL VERIFY ; PERFORM VERIFICATION - LDA FIRST ; ANY ERRORS? - ORA A ; 0=NO ERRORS - JNZ MLOOP2 - CALL PRINT - DB CR,LF,' Files are Identical',0 -MLOOP2: - LDA MULT ; CHECK FOR MULTIPLE RUNS - ORA A ; 0=NO - RZ - CALL CRLF ; NEW LINES - CALL CRLF - JMP MLOOP -FERR: - CALL PRINT - DB CR,LF,' File Not Found -- ',0 - CALL PRFN - JMP MLOOP2 - -; -; PROCESS OPTIONS -; -OPTS: - MOV A,M ; GET NEXT OPTION CHAR - INX H ; PT TO NEXT - ORA A ; END OF LINE? - RZ - CPI ' ' ; SKIP SPACES - JZ OPTS - LXI D,OTAB ; PT TO OPTION TABLE - MOV B,A ; OPTION CHAR IN B -OPTS1: - LDAX D ; GET TABLE CHAR - ORA A ; OPTION NOT FOUND? - JZ OPTSE ; PROCESS ERROR - CMP B ; MATCH? - JZ OPTS2 - INX D ; SKIP TO NEXT - INX D - INX D - JMP OPTS1 -OPTS2: - XCHG ; USE HL - INX H ; GET ADDRESS - MOV A,M ; GET LOW - INX H - MOV H,M ; GET HIGH - MOV L,A ; PUT LOW - XCHG ; DE PTS TO OPTION ADDRESS, HL TO NEXT BYTE - LXI B,OPTS ; SET UP RETURN ADDRESS - PUSH B - PUSH D ; SET UP OPTION ADDRESS - RET ; "RUN" OPTION -OPTSE: - CALL PRHELP ; PRINT HELP MESSAGE - POP PSW ; CLEAR RETURN ADDRESS - RET ; RETURN TO OPSYS -; -; OPTION TABLE -; -OTAB: - DB 'C' ; COMPARE ONLY - DW SCOMPF - DB 'M' ; MULTIPLE RUN - DW SMULTF - DB 0 ; END OF TABLE -; -; SET COMPARE FLAG -; -SCOMPF: - MVI A,0FFH ; SET FLAG - STA COMP - RET -; -; SET MULTIPLE RUN FLAG -; -SMULTF: - MVI A,0FFH ; SET FLAG - STA MULT - RET -; -; SKIP TO NON-BLANK CHAR -; -SBLANK: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - CPI ' ' ; BLANK? - JZ SBLANK - DCX H ; PT TO NON-BLANK - RET - -; -; PRINT HELP MESSAGE -; -PRHELP: - CALL BANNER ; PRINT BANNER - CALL PRINT - DB CR,LF,'Syntax:' - DB CR,LF,' DIFF ufn1,ufn2 o... -or- DIFF ufn o...' - db cr,lf,'Options:' - db cr,lf,' C Compare Files Only (Stop at First Difference)' - db cr,lf,' M Multiple Runs (Keep on prompting for disks)' - DB CR,LF,'Examples:' - DB CR,LF,' Command Files Compared' - DB CR,LF,' DIFF T.COM,A1: $$:T.COM, A1:T.COM' - DB CR,LF,' DIFF A:T.COM A$:T.COM, $$:T.COM' - DB CR,LF,' DIFF A:T.COM,ROOT: A$:T.COM, ROOT:T.COM' - DB CR,LF,' DIFF A:T.COM,B:S.COM A$:T.COM, B$:S.COM' - DB 0 - RET - -; -; CHECK FOR ANY QUESTION MARKS FROM HL+1 TO HL+11 -; AFFECT ONLY AF REGISTERS IF OK -; -QCHECK: - PUSH H ; SAVE HL - PUSH B ; SAVE BC - INX H ; PT TO FIRST CHAR - MVI B,11 ; 11 BYTES - MVI C,'?' ; SCAN FOR '?' -QC: - MOV A,M ; GET BYTE - CMP C ; '?'? - JZ QC1 - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ QC - POP B ; RESTORE - POP H - RET -QC1: - POP B ; RESTORE AND ABORT - POP H - POP D ; CLEAR RETURN ADDRESS - XCHG ; FCB PTR IN DE - CALL CRLF - CALL PRFN ; PRINT FILE NAME - CALL PRINT - DB ' AFN not Allowed',CR,LF,0 - RET - -; -; PRINT BANNER -; -BANNER: - CALL PRINT - DB 'DIFF Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0' - DB 0 - RET - -; -; PRINT NAMES OF SOURCE FILES -; PRS1 -- SOURCE FILE 1 -; PRS2 -- SOURCE FILE 2 -; -PRS1: - CALL PRINT - DB CR,LF,'Source 1 -- ',0 - LXI H,SDISK ; PT TO FIRST BYTE - CALL PRUD - LXI D,FCBS ; SOURCE FCB - JMP PRFN ; PRINT FILE NAME -PRS2: - CALL PRINT - DB CR,LF,'Source 2 -- ',0 - LXI H,DDISK ; PT TO FIRST BYTE - CALL PRUD - LXI D,FCBD ; DESTINATION FCB - JMP PRFN ; PRINT FILE NAME - -; -; MAIN VERIFY ROUTINE -; -VERIFY: - LHLD BUFF1 ; PT TO BUFFER 1 - PUSH H ; SAVE PTR - CALL LOGS ; LOG IN SOURCE 1 - LXI D,FCBS ; SOURCE 1 FCB - CALL LOAD ; READ IN BLOCK - LDA BCNT ; GET OLD BLOCK COUNT - STA BCNT1 ; SAVE IT - LHLD BUFF2 ; PT TO BUFFER 2 - PUSH H ; SAVE PTR - CALL LOGD ; LOG IN SOURCE 2 - LXI D,FCBD ; SOURCE 2 FCB - CALL LOAD ; READ IN BLOCK - POP D ; DE PTS TO BUFF 2 - POP H ; HL PTS TO BUFF 1 - LDA BCNT ; CHECK FOR NO BLOCK READ - MOV B,A - LDA BCNT1 - ORA B - RZ ; DONE IF NONE READ -; -; VERIFY LOADED BUFFERS BY COMPARING THEM AND PRINTING DIFFERENCES -; -VERBLOCK: - MVI B,128 ; SCAN ONE BLOCK -VERBL: - LDAX D ; GET BYTE - CMP M ; COMPARE - CNZ NOMATCH ; PRINT DIFFERENCE - PUSH H ; INC OFFSET - LHLD OFFSET - INX H - SHLD OFFSET - POP H - INX H ; PT TO NEXT - INX D - DCR B ; COUNT DOWN - JNZ VERBL - LDA BCNT ; COUNT DOWN - DCR A - STA BCNT - LDA BCNT1 - DCR A - STA BCNT1 - JZ VEREQ - LDA BCNT ; CHECK FIRST BUFFER COUNT - ORA A - JNZ VERBLOCK ; CONTINUE COMPARE IF NOT EMPTY -VEREQ: - LDA BCNT ; CHECK FOR BOTH DONE - MOV B,A - LDA BCNT1 - ORA B ; IF ZERO, BOTH DONE AT SAME TIME AND CONTINUE - JZ VERIFY - LDA BCNT1 ; CHECK FOR ONE DONE BEFORE THE OTHER - ORA A ; 2ND DONE? - MVI C,'2' ; GET LETTER - JZ DONE1 - MVI C,'1' ; GET LETTER -; ONE FILE IS SHORTER THAN THE OTHER -- SAY SO -DONE1: - CALL PRINT - DB CR,LF,' Source ',0 - MOV A,C - CALL COUT ; PRINT LETTER - CALL PRINT - DB ' has terminated prematurely',0 - JMP DABORT -; MATCH ERROR -NOMATCH: - LDA COMP ; GET COMPARE FLAG - ORA A ; NZ=SIMPLE COMPARE - JNZ CABORT - PUSH H ; SAVE REGS - PUSH D - PUSH B - LDA FIRST ; FIRST TIME THRU? - ORA A ; 0=YES - JZ NMAT0 - LDA LCNT ; CHECK FOR NEW SCREEN - ORA A ; ZERO IF DONE - JNZ NMAT1 - CALL PRINT - DB CR,LF,' DIFF Pause -- Strike RETURN to Continue, ' - DB '^C to Abort, or ^X to Advance - ',0 - CALL CIN ; GET RESPONSE - CALL CAPS - CPI CTRLC ; ABORT? - JZ NMAT00 - CPI CTRLX ; ADVANCE? - JNZ NMAT0 - POP B ; CLEAR REGS - POP D - POP H - POP D ; CLEAR STACK - CALL PRINT - DB CR,LF,' DIFF Advancing',0 - RET ; RETURN TO VERIFY CALLER -NMAT00: - POP B ; CLEAR REGS - POP D - POP H - POP D ; CLEAR STACK - POP D -DABORT: - CALL PRINT - DB CR,LF,' DIFF Aborting',0 - RET ; RETURN TO OPSYS -CABORT: - POP D ; CLEAR STACK - MVI A,1 ; SET ERROR FLAG - STA FIRST - CALL PRINT - DB CR,LF,' Files are Different',0 - RET ; RETURN TO VERIFY CALLER -NMAT0: - MVI A,0FFH ; CLEAR FIRST TIME FLAG - STA FIRST - CALL HEADER ; PRINT HEADING AND RETURN NEW LINE COUNT -NMAT1: - DCR A ; COUNT DOWN 1 LINE - STA LCNT ; NEW LINE COUNT - CALL CRLF - PUSH H ; SAVE HL - LHLD OFFSET ; PRINT OFFSET VALUE - CALL PHL4HC ; PRINT AS HEX - CALL SPACER ; PRINT SPACES - CALL PHLDC ; PRINT AS DEC - POP H ; RESTORE HL - CALL SPACER - CALL SPACER - MVI A,' ' - CALL COUT - MOV A,M ; GET SOURCE 1 VALUE - CALL PRVAL ; PRINT AS HEX, DEC, ASCII - CALL SPACER ; 10 SPACES - CALL SPACER - CALL SPACER - CALL SPACER - CALL SPACER - LDAX D ; GET SOURCE 2 VALUE - CALL PRVAL ; PRINT AS HEX, DEC, ASCII - POP B ; RESTORE REGS - POP D - POP H - RET - -; PRINT HEADER AND RETURN NEW LINE COUNT IN A -HEADER: - PUSH D ; SAVE REGS - PUSH H - CALL PRINT - DB CR,LF,' Rel Offset ',0 - LXI H,SDISK ; PRINT DISK/USER - CALL PRUD - LXI D,FCBS - CALL PRFN ; PRINT FILE NAME - CALL SPACER ; 5 SPACES - CALL SPACER - CALL SPACE1 - LXI H,DDISK ; PRINT DISK/USER - CALL PRUD - LXI D,FCBD - CALL PRFN ; PRINT FILE NAME - CALL PRINT - DB CR,LF,' Hex Dec Hex Dec Asc Hex Dec Asc',0 - LDA LSET ; SET LINE COUNT - SUI 1 ; ADJUST FOR HEADING AND FOOTER - STA LCNT - POP H - POP D ; RESTORE REGS - RET - -; PRINT A AS HEX, DEC, AND ASCII -PRVAL: - CALL SPACER ; 3 SPACES - CALL SPACE1 - CALL PA2HC ; PRINT AS HEX - CALL SPACER - CALL PADC ; PRINT AS DEC - CALL SPACER - ANI 7FH ; MASK OUT MSB - CPI 7FH ; DOT FOR - JZ PRDOT - CPI ' ' ; PRINT DOT IF LESS THAN - JNC COUT -PRDOT: - MVI A,'.' ; PRINT DOT - JMP COUT -; PRINT 2 SPACES -SPACER: - PUSH PSW ; SAVE A - MVI A,' ' ; - CALL COUT - POP PSW -SPACE1: - PUSH PSW - MVI A,' ' - CALL COUT - POP PSW - RET - -; -; LOAD BUFFER FROM FILE WHOSE FCB IS PTED TO BY DE -; ON OUTPUT, BCNT=NUMBER OF BLOCKS LOADED (UP TO BLIMIT) -; -LOAD: - XRA A ; A=0 - STA BCNT ; SET BLOCK COUNT - -; MAIN LOAD LOOP -LOAD1: - CALL F$READ ; READ A BLOCK - ORA A ; END OF FILE? - RNZ ; RETURN IF DONE - PUSH D ; SAVE FCB PTR - LXI D,BUFF ; PT TO BUFFER - MVI B,128 ; COPY 128 BYTES -LOAD2: - LDAX D ; GET BYTE READ - MOV M,A ; PUT BYTE - INX H ; PT TO NEXT - INX D - DCR B ; COUNT DOWN - JNZ LOAD2 - POP D ; GET FCB PTR - LDA BCNT ; GET BLOCK COUNT - INR A ; INCREMENT IT - STA BCNT ; SET IT - CPI BLIMIT ; LAST BLOCK READ? - JNZ LOAD1 - RET - -; -; LOG IN SOURCE (LOGS) AND DESTINATION (LOGD) DRIVES/USERS -; -LOGS: - LDA SDISK ; GET DISK - DCR A ; A=0 - MOV B,A - LDA SUSER ; GET USER - MOV C,A - CALL LOGUD ; LOG IN - RET -LOGD: - LDA DDISK ; GET DISK - DCR A ; A=0 - MOV B,A - LDA DUSER ; GET USER - MOV C,A - CALL LOGUD ; LOG IN - RET - -; -; PRINT DISK/USER PTED TO BY HL (2 BYTES) -; -PRUD: - MOV A,M ; GET DISK - ADI 'A'-1 ; CONVERT TO LETTER - CALL COUT - INX H ; PT TO USER - MOV A,M ; GET USER - CALL PADC ; PRINT AS DEC - CALL PRINT - DB ': ',0 - RET - -; -; PRINT FILE NAME WHOSE FCB IS PTED TO BY DE -; -PRFN: - PUSH H ; SAVE REGS - PUSH D - PUSH B - XCHG ; FN PTED TO BY HL - INX H ; PT TO FIRST CHAR - MVI B,8 ; 8 CHARS - CALL PRFN1 - MVI A,'.' - CALL COUT - MVI B,3 ; 3 CHARS FOR FILE TYPE - CALL PRFN1 - POP B ; RESTORE REGS - POP D - POP H - RET -PRFN1: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - CALL COUT ; PRINT - DCR B ; COUNT DOWN - JNZ PRFN1 - RET - -; -; BUFFERS -; -BUFF1: - DS 2 ; PTR TO BUFFER 1 -BUFF2: - DS 2 ; PTR TO BUFFER 2 -OFFSET: - DS 2 ; RELATIVE OFFSET -FIRST: - DS 1 ; ERROR INDIC -LSET: - DS 1 ; NUMBER OF TEXT LINES ON SCREEN -LCNT: - DS 1 ; LINE COUNT -COMP: - DS 1 ; COMPARE FLAG (0=NO SIMPLE COMPARE) -MULT: - DS 1 ; MULTIPLE RUN FLAG (0=NO MULT RUNS) -SDISK: - DS 1 ; SOURCE DISK (MUST BE FOLLOWED BY SUSER) -SUSER: - DS 1 ; SOURCE USER -FCBS: - DS 36 ; SOURCE FCB -DDISK: - DS 1 ; DEST DISK (MUST BE FOLLOWED BY DUSER) -DUSER: - DS 1 ; DEST USER -FCBD: - DS 36 ; DESTINATION FCB -BCNT: - DS 1 ; BUFFER COUNT -BCNT1: - DS 1 ; SECOND BUFFER COUNT -INLINE: - DS 2 ; PTR TO INPUT LINE BUFFER - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/DIFF21.LBR b/Source/Images/d_bp/u15/DIFF21.LBR deleted file mode 100644 index 63a2aab0..00000000 Binary files a/Source/Images/d_bp/u15/DIFF21.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/DIR.COM b/Source/Images/d_bp/u15/DIR.COM deleted file mode 100644 index 82c0dc61..00000000 Binary files a/Source/Images/d_bp/u15/DIR.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/DIR.MAC b/Source/Images/d_bp/u15/DIR.MAC deleted file mode 100644 index 266690ef..00000000 --- a/Source/Images/d_bp/u15/DIR.MAC +++ /dev/null @@ -1,1465 +0,0 @@ -; -; Program: DIR -; Author: Richard Conn -; Version: 1.0 -; Date: 23 Mar 84 -; -VERS EQU 11 ; Changed manner of calculating disk size - ; Using all0 and all1 instead of drm - ; Added modified dirqs and fsize jww - ; Trial to list files vertically jww -; -;VERS EQU 10 ; Release -; -MONTH EQU 1 -DAY EQU 2 -YEAR EQU 85 -; -Z3ENV SET 0F400H ; Set zcpr3 environment descriptor address -; -; Equates -; -YES EQU 0FFH -NO EQU 0 -; -VIDEO EQU YES ; Enhanced video? -VOPT EQU YES ; Print signon and vers no -VERT EQU YES ; List files vertically (default) -; -FCB EQU 5CH -FCB2 EQU 6CH -CTRLC EQU 03H -CR EQU 0DH -LF EQU 0AH -; -; VLIB, Z3LIB and SYSLIB References -; - EXT Z3VINIT,TINIT,STNDOUT,STNDEND,BDOS - EXT CODEND,RETUD,PFN1,DFREE,DUTDIR,DPARAMS - EXT CRLF,COUT,PAFDC,PHLDC,PHLFDC,Z3LOG,FILLB,GETCRT,CIN -; -; Environment Definition -; - IF Z3ENV NE 0 -; -; External ZCPR3 Environment Descriptor -; - JMP START - DB 'Z3ENV' ; This is a zcpr3 utility - DB 1 ; External environment descriptor -Z3EADR: - DW Z3ENV -START: - LHLD Z3EADR ; Pt to zcpr3 environment -; - ELSE -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -Z3EADR: - JMP START - SYSENV -START: - LXI H,Z3EADR ; Pt to zcpr3 environment - ENDIF -; -; Start of Program -- Initialize ZCPR3 Environment -; - CALL Z3VINIT ; Initialize the zcpr3 env - CALL TINIT ; Initialize the terminal -; -; Make FCB Wild if No Entry -; - LXI H,FCB+1 ; Pt to first char - MOV A,M ; Get it - CPI ' ' ; Check for space - MVI B,11 ; Prepare to set 11 bytes - MVI A,'?' ; To "?" - CZ FILLB ; Do it if space -; -; Check for Help -; - LXI D,FCB+1 ; Pt to first char of fcb - LDAX D ; Get first char of fcb - CPI '/' - JNZ DOIT - CALL PRINT - DB 'DIR Vers ' - DB (VERS/10)+'0','.',(VERS MOD 10)+'0',CR,LF - DB ' Syntax: DIR dir:afn o',CR,LF - DB ' Options: A=All, S=Sys, H=Horiz, V=Vert, ' - DB 'T=File Type/Name Sor','t'+80H - RET -; -; Perform Directory Function -; -DOIT: - DCX D ; Pt to fcb - CALL Z3LOG ; Log into dir - XRA A ; Clear disk selection byte - STAX D -; -; Process Options in FCB2 -; - LXI H,FCB2+1 ; Pt to options - MVI B,8 ; Allow for up to 8 options - MVI C,10000000B ; Assume just normal files -OPTLOOP: - MOV A,M ; Get next char - INX H ; Advance - DCR B ; Count down - JZ SETDATA ; Done - set data - CPI ' ' - JZ OPTLOOP - CPI 'H' ; Select horizontal listing - JZ SETHORIZ - CPI 'V' ; Select vertical listing - JZ SETVERT - CPI 'T' ; File type? - JZ SETTYPE - CPI 'S' ; System? - JZ SETSYS - CPI 'A' ; System and normal? - JNZ OPTLOOP -; -; Select Both System and Normal Files -; - MVI A,11000000B ; Normal and system files - JMP SETSYS1 -; -; Select Horizontal listing -; -SETHORIZ: - MVI A,YES - STA HORIZ - JMP OPTLOOP -; -; Select Vertical listing -; -SETVERT: - MVI A,NO - STA HORIZ - JMP OPTLOOP -; -HORIZ: DB NOT VERT ; Horizontal listing flag -; -; Select File Type/Name Alphabetization -; -SETTYPE: - MOV A,C ; Get flag - ORI 00100000B - MOV C,A - JMP OPTLOOP -; -; Select Just System Files -; -SETSYS: - MVI A,01000000B ; System -SETSYS1: - PUSH PSW - MOV A,C - ANI 00111111B ; Mask out - MOV C,A - POP PSW - ORA C - MOV C,A - JMP OPTLOOP -; -; Set Selection Byte in A -; -SETDATA: - CALL DPARAMS ; Init parameters - CALL CODEND ; Pt to free area - MOV A,C ; Selection in a -; -; Load and Sort Directory -; - CALL DIRQS ; Quick load - SHLD DIRBEG ; Beginning of directory area - JNZ DISPLAY - CALL PRINT - DB ' Ovf','l'+80H - RET -; -; Display Directory -; -DISPLAY: - PUSH H ; Save ptr to first entry -; -; Init: -; Total of All File Sizes -; Number of Files Displayed -; Line Counter -; Entry Counter -; - IF VOPT ; Signon and version - PUSH B - IF VIDEO - CALL STNDOUT - ENDIF - MVI C,22 ; Print 22 spaces -DIS0: MVI A,' ' - CALL COUT - DCR C - JNZ DIS0 - CALL PRINT - DB 'DIRectory Version ' - DB VERS/10+'0','.',VERS MOD 10+'0' - DB ' ',MONTH/10+'0',MONTH MOD 10+'0','/' - DB DAY/10+'0',DAY MOD 10+'0','/' - DB YEAR/10+'0',YEAR MOD 10+'0' - DB CR,LF+80H - IF VIDEO - CALL STNDEND - ENDIF - POP B - ENDIF ; Vopt -; - LXI H,0 ; Set total size count - SHLD TOTCOUNT - LXI H,FCOUNT ; Save file count - MOV M,C - INX H - MOV M,B ; File count saved from bc - PUSH B ; Save file count - MOV H,B - MOV L,C ; Move it to hl - LXI D,4 - CALL DIVIDE ; Divide by four columns - JZ DIS1 - INX B ; Round up if remainder from division -DIS1: MOV H,B - MOV L,C ; Quotient to hl - CALL X16 - SHLD LINES - POP H ; Get file count - PUSH H ; And put it back - DCX H ; File count -1 points to last file - CALL X16 ; Multiply by 16 chars/line - XCHG ; Directory size to de - LHLD DIRBEG - DAD D - SHLD DIREND - POP B ; Get file count - POP H ; Pt to first entry - XRA A - STA LCOUNT ; Init line count - STA COUNT ; Init entry count - MOV A,B ; Check for done - ORA C - JZ PRREMAIN ; Print remaining space on disk and exit - CALL PRINT - DB ' '+80H ; Print first leading space -; -; Loop to Display File Entries -; -DISPLOOP: -; -; Print Separator if Within a Line -; - LDA COUNT ; See if new entry on line - ANI 3 - JZ DISPL1 -; -; Print Separator if Entry is Within a List -; - IF VIDEO - CALL STNDOUT - ENDIF - CALL PRINT ; Print separator - DB '|',' '+80H - IF VIDEO - CALL STNDEND - ENDIF -; -; Print Next Entry -; -DISPL1: - PUSH H ; Save key regs - PUSH B ; Hl pts to next entry, bc = count -; -; Print File Name -; - INX H ; Pt to file name - XCHG - CALL PFN1 ; Print file name - XCHG - DCX H ; Pt to first byte of file entry -; -; Print File Size and Increment Total of All File Sizes -; - PUSH H ; Save ptr to first byte of file entry - CALL FSIZE ; Compute file size (to de) - LHLD TOTCOUNT ; Increment total count - DAD D - SHLD TOTCOUNT - XCHG - CALL PHLDC ; Print file size - POP H ; Get ptr to first byte of file entry -; -; Check R/O Byte -; - MVI B,' ' ; Assume r/w - LXI D,9 ; Pt to r/o - DAD D - MOV A,M ; Get r/o byte - ANI 80H ; Look at it - JZ ROOUT - MVI B,'r' ; Set r/o -ROOUT: - MOV A,B ; Get char - CALL COUT -; -; Increment Entry Count and Issue New Line if Limit Reached -; - LDA COUNT ; Increment entry count - INR A - STA COUNT - LDA HORIZ ; Check horiz/vert listing - ORA A - JZ DISPL2 ; Vertical listing - LDA COUNT - ANI 3 ; New line? - CZ NEWLIN - JMP DISPL2 -; -; New Line - Increment Line Count and Issue Page Break if Limit Reached -; -NEWLIN: CALL PRNL - LDA LCOUNT ; Count down lines - INR A - STA LCOUNT - CALL GETCRT ; Get crt data - INX H ; Pt to text line count - INX H - DCR A ; Back up again - CMP M ; Compare - RNZ - XRA A ; Reset line count - STA LCOUNT - IF VIDEO - CALL STNDOUT - ENDIF - CALL PRINT - DB ' Pause -',' '+80H - IF VIDEO - CALL STNDEND - ENDIF - CALL CIN - CALL PRNL ; Print new line with leading space - CPI CTRLC ; Abort? - RNZ - POP PSW ; Clear the rest of the stack - POP PSW - POP PSW - RET ; To zcpr3 -; -; Advance to Next Entry -; -DISPL2: - POP B ; Restore count and ptr to current entry - POP H - LDA HORIZ ; Check horiz/vert listing - ORA A - JNZ DISP2 ; Horizontal - XCHG ; Pointer to de - LHLD LINES - DAD D ; Point to next entry - XCHG ; New pointer to de - LHLD DIREND - CALL SUBDE ; Check if new ptr is within the directory - XCHG ; New pointer to hl - JNC DISP3 ; New pointer is ok - LHLD DIRBEG ; Otherwise start new line - LXI D,16 ; Next line - DAD D - SHLD DIRBEG ; Save it - XRA A - STA COUNT ; Clear column count - PUSH H - PUSH B - CALL NEWLIN - POP B - POP H - JMP DISP3 -DISP2: LXI D,16 ; Skip to next entry - DAD D -DISP3: DCX B ; Count down - MOV A,B ; Done? - ORA C - JNZ DISPLOOP - LDA COUNT ; See if new line required - ANI 3 - CNZ CRLF ; New line if any entries on line -; -; Print Remaining Space on Disk and Exit -; -PRREMAIN: -; -; Print DU -; - IF VIDEO - CALL STNDOUT - ENDIF - MVI B,8 ; Space over 8 spaces - MVI A,' ' -SPACER: - CALL COUT - DCR B - JNZ SPACER - CALL RETUD ; Get du in bc - MOV A,B ; Print disk letter - ADI 'A' ; Convert to ascii - CALL COUT - MOV A,C ; Print user number - CALL PAFDC ; Print floating - CALL PRINT ; Print separator - DB ':'+80H - CALL DUTDIR ; See if matching dir - JZ PRREM1 -; -; Print DIR if any -; - MVI B,8 ; 8 chars max -PRREM0: - MOV A,M ; Get char - INX H ; Pt to next - CPI ' ' ; Space? - CNZ COUT ; Echo char - DCR B ; Count down - JNZ PRREM0 -; -; Print File Count -; -PRREM1: - LHLD FCOUNT ; Print number of files - CALL PRINT - DB ' --',' '+80H - CALL PHLFDC -; -; Print Total of All File Sizes -; - LHLD TOTCOUNT ; Print total count - CALL PRINT - DB ' files using',' '+80H - CALL PHLFDC ; Print as floating -; -; Print Amount of Free Space Remaining -; - CALL DFREE ; Compute amount of free space - XCHG ; In hl - CALL PRINT - DB 'k ','('+80H - CALL PHLFDC - CALL PRINT - DB 'k remain of',' '+80H - CALL DSIZE - CALL PHLFDC - CALL PRINT - DB 'k total',')'+80H - IF VIDEO - CALL STNDEND - ENDIF - RET -; -; Print New Line with Leading Space -; -PRNL: - CALL PRINT - DB CR,LF,' '+80H ; New line with leading space - RET -; -; Print Routine (String at Return Address) which is terminated by MSB -; -PRINT: - XTHL ; Pt to string and save hl - PUSH PSW -PRINT1: - MOV A,M ; Get next char - ANI 7FH ; Mask msb - CALL COUT - MOV A,M ; Get next char - INX H ; Pt to next - ANI 80H ; Check msb - JZ PRINT1 - POP PSW ; Get a - XTHL ; Restore return address and hl - RET -; -; DSIZE returns the size of the current disk in HL (k) -; -DSIZE: PUSH D - PUSH B -; - MVI C,31 ; Return dpb address in hl - CALL BDOS - INX H - INX H ; Point to bls - MOV A,M ; Bls in a - STA BLS - INX H - INX H - INX H ; Point to dsm - MOV E,M - INX H - MOV D,M ; Dsm in de - INX D ; Rel 1 - PUSH D ; Save dsm on stack - INX H ; Point to drm - INX H - INX H ; Point to all0 - MOV D,M - INX H ; Point to all1 - MOV E,M - XCHG ; Allocation vector in hl - LXI D,-1 ; Clear a counter -DS0: INX D - CALL SHLHL - JC DS0 - CALL SUBDE ; Get complement of count - POP D ; Get dsm from stack - DAD D ; Hl = groups available - LDA BLS ; Block shift factor - SUI 3 ; From bls in a - JZ DSX -DSIZ0: DAD H - DCR A - JNZ DSIZ0 -DSX: - POP B - POP D - RET -; -; DIVIDE divides HL by DE returning quotient in BC and remainder in HL -; Zero flag is set if no remainder -; -DIVIDE: LXI B,0 ; Clear quotient -DIV0: CALL SUBDE ; Subtract de from hl - JC DIV1 ; Overflow - INX B ; Increment quotient - JMP DIV0 ; Again.. -DIV1: DAD D ; Restore remainder in hl - MOV A,H ; Check for remainder - ORA L ; Equal zero - RET -; -; SUBDE subtracts DE from HL returning carry set if de > hl -; -SUBDE: MOV A,L - SUB E - MOV L,A - MOV A,H - SBB D - MOV H,A - RET -; -; X16 simply shifts HL left four times -; -X16: DAD H - DAD H - DAD H - DAD H - RET -; -; SHLHL shifts HL left into carry -; -SHLHL: ORA A ; Reset carry - MOV A,L - RAL - MOV L,A - MOV A,H - RAL - MOV H,A - RET -; -; SYSLIB Module Name: SDIRQS -; Author: Richard Conn -; Part of SYSLIB3 SDIR Series -; SYSLIB Version Number: 3.0 -; Module Version Number: 1.4 -; Module Entry Points: -; DIRQS -; Module External References: -; None -; - -;* -;* EQUATES -;* -CPM EQU 0 -BUFF EQU 80H ; Dma buffer -ESIZE EQU 16 ; 16 bytes/entry - -;* -;* GENERAL-PURPOSE DIRECTORY SELECT ROUTINE WITHOUT SIZING INFORMATION -;* THIS ROUTINE SCANS FOR THE FCB PTED TO BY DE AND LOADS ALL ENTRIES -;* WHICH MATCH IT INTO THE MEMORY BUFFER PTED TO BY HL. ON EXIT, -;* BC=NUMBER OF FILES IN BUFFER, AND HL PTS TO FIRST FILE IN BUFFER. -;* THE DIRECTORY BUFFER GENERATED BY DIRQ CONTAINS ENTRIES WHICH MAY NOT -;* BE USED TO COMPUTE THE SIZE OF THE FILES USING THE FSIZE ROUTINE. THE -;* DIRQS ROUTINE IS DESIGNED FOR THIS PURPOSE. THE BASIC TRADEOFF BETWEEN -;* THE TWO ROUTINES IS THE DIRQ RUNS FASTER THAN DIRQS, AND THIS IS NOTICABLE -;* IF THERE IS A SIGNIFICANT NUMBER OF FILES TO BE PROCESSED. -;* -;* THE DIRQ/DIRQS ROUTINES ARE INTENDED TO BE USED IN APPLICATIONS WHERE -;* THE ONLY THING DESIRED IS A DIRECTORY LOAD OF THE CURRENT DIRECTORY -;* (DISK AND USER). DIRF/DIRFS PROVIDE MORE FLEXIBILITY AT A GREATER COST -;* IN TERMS OF SIZE. -;* -;* INPUT PARAMETERS: -;* HL PTS TO BUFFER, DE PTS TO FCB, A IS SELECT FLAG: -;* Bit 7 - Select Non-Sys, Bit 6 - Select Sys -;* Bit 5 - Sort by File Name and Type (0) or other (1) -;* Bits 4-0 - Unused -;* OUTPUT PARAMETERS: -;* HL PTS TO FIRST FILE IN BUFFER -;* BC = NUMBER OF FILES -;* A=0 and Z Flag Set if TPA Overflow -;* DE UNCHANGED -;* -DIRQS: - PUSH D ; Save ptr to fcb - - STA SELFLG ; Save select flag for selection and alphabetization - SHLD HOLD ; Set ptr to hold buffer - LXI B,36 ; Allow 36 bytes - DAD B ; Hl now points to temp fcb - SHLD TFCB ; Set ptr to temp fcb - DAD D ; Hl now pts to scratch area - - PUSH D ; Save ptr to fcb - CALL DBUFFER ; Get ptrs - POP D ; Get ptr to fcb - PUSH H ; Save ptr to buffer - CALL DIRLOAD ; Load directory (fast load) - POP H ; Get ptr to buffer - - POP D ; Get ptr to fcb - - RZ ; Abort if tpa overflow - - PUSH PSW ; Save flag to indicate no tpa overflow - CALL DIRALPHA ; Alphabetize - POP PSW ; Get psw (tpa overflow flag) - RET - -;* -;* THIS ROUTINE ACCEPTS A BASE ADDRESS FOR THE DYNAMIC BUFFERS -;* REQUIRED, DETERMINES HOW MUCH SPACE IS REQUIRED FOR THE BUFFERS, -;* AND SETS THE ORDER PTR TO PT TO THE FIRST AND DIRBUF TO PT TO -;* THE SECOND (ORDER SPACE = DIRMAX*2 AND DIRBUF = DIRMAX * ESIZE) -;* ON INPUT, HL PTS TO AVAILABLE BASE -;* ON OUTPUT, HL PTS TO DIRBUF -;* A=0 AND ZERO FLAG SET IF CCP OVERRUN -;* -DBUFFER: - SHLD ORDER ; Pt to order table - CALL DPARAMS0 ; Get parameters - LHLD DIRMAX ; Number of entries in dir - XCHG ; In de - LHLD ORDER ; Add to order base - DAD D ; *1 - CALL MEMCHK ; Check for within range - DAD D ; Hl pts to dirbuf - CALL MEMCHK ; Check for within range - SHLD DIRBUF ; Set ptr and hl pts to directory buffer - XRA A ; Ok - DCR A ; Set flags (nz) - RET - -MEMCHK: - PUSH H ; Save regs - PUSH D - XCHG ; Next address in de - LHLD BDOS+1 ; Get address of bdos - MOV A,D ; Check for page overrun - CMP H - JNC MEMORUN ; Overrun if d>=h - POP D - POP H - RET -MEMORUN: - POP D ; Restore - POP H - POP PSW ; Clear stack - XRA A ; Return 0 - RET - -;* -;* THIS ROUTINE EXTRACTS DISK PARAMETER INFORMATON FROM THE DPB AND -;* STORES THIS INFORMATION IN: -;* BLKSHF <-- BLOCK SHIFT FACTOR (1 BYTE) -;* BLKMSK <-- BLOCK MASK (1 BYTE) -;* EXTENT <-- EXTENT MASK (1 BYTE) [NOT ANY MORE] -;* BLKMAX <-- MAX NUMBER OF BLOCKS ON DISK (2 BYTES) -;* DIRMAX <-- MAX NUMBER OF DIRECTORY ENTRIES (2 BYTES) -;* -DPARAMS0: -;* -;* VERSION 2.x OR MP/M -;* - MVI C,31 ; 2.x or mp/m...request dpb - CALL BDOS - INX H - INX H - MOV A,M ; Get block shift - STA BLKSHF ; Block shift factor - INX H ; Get block mask - MOV A,M - STA BLKMSK ; Block mask - INX H - INX H - MOV E,M ; Get max block number - INX H - MOV D,M - XCHG - INX H ; Add 1 for max number of blocks - SHLD BLKMAX ; Maximum number of blocks - XCHG - INX H - MOV E,M ; Get directory size - INX H - MOV D,M - XCHG - INX H ; Add 1 for number of entries - SHLD DIRMAX ; Maximum number of directory entries - RET - -;* -;* BUILD DIRECTORY TABLE AT DIRBUF -;* THIS IS THE OPTIMAL DIRECTORY LOAD ROUTINE; IT ONLY LOADS UNIQUE -;* FILE NAMES FROM DISK, BUT THE INFORMATION IS NOT SUFFICIENT -;* TO COMPUTE THE FILE SIZES -;* ON INPUT, HL PTS TO DIRECTORY BUFFER (16 x N MAX) -;* DE PTS TO FCB (ONLY 12 BYTES NEEDED) -;* ON OUTPUT, BC IS NUM OF FILES -;* A=0 AND ZERO FLAG SET IF TPA OVERFLOW -;* -DIRLOAD: - SHLD DSTART ; Set start of buffer area - INX D ; Pt to file name - LHLD TFCB ; Pt to tfcb - MVI M,0 ; Select current disk - INX H ; Pt to file name in tfcb - MVI B,11 ; 11 chars -DLLOOP: - LDAX D ; Copy - MOV M,A - INX H ; Pt to next - INX D - DCR B ; Count down - JNZ DLLOOP - MVI M,'?' ; Select all extents - INX H ; Pt to next char - MVI M,0 - INX H - MVI M,'?' ; And all modules - INX H - MVI B,21 ; 23 chars - XRA A ; Zero rest of tfcb -DLLOOP1: - MOV M,A ; Store zero - INX H ; Pt to next - DCR B ; Count down - JNZ DLLOOP1 - -;* -;* THIS SECTION OF CODE INITIALIZES THE COUNTERS USED -;* - LXI H,0 ; Hl=0 - SHLD FCOUNT0 ; Total files on disk = 0 -;* -;* NOW WE BEGIN SCANNING FOR FILES TO PLACE INTO THE MEMORY BUFFER -;* - MVI C,17 ; Search for file - JMP DIRLP1 -DIRLP: - CALL PENTRY ; Place entry in dir - JZ DIROVFL ; Memory overflow error - MVI C,18 ; Search for next match -DIRLP1: - LHLD TFCB ; Pt to fcb - XCHG - CALL BDOS - CPI 255 ; Done? - JNZ DIRLP -;* -;* NOW WE ARE DONE WITH THE LOAD -- SET UP RETURN VALUES -;* -DIRDN: - XRA A ; Load ok - DCR A ; Set flags (nz) -DIRDNX: - LHLD FCOUNT0 ; Get total number of files - MOV B,H ; In bc - MOV C,L - RET -;* -;* MEMORY OVERFLOW ERROR -;* -DIROVFL: - XRA A ; Load error - JMP DIRDNX - -;* -;* PENTRY -- -;* PLACE ENTRY IN DIRECTORY BUFFER IF NOT AN ERASED ENTRY -;* -;* ON INPUT, A=0-3 FOR ADR INDEX IN BUFF OF ENTRY FCB -;* FCOUNT0=NUMBER OF FILES IN DIR SO FAR -;* ON OUTPUT, FCOUNT0=NUMBER OF FILES IN DIR SO FAR -;* A=0 AND ZERO FLAG SET IF MEMORY OVERFLOW ERROR -;* -PENTRY: - RRC ; Multiply by 32 for offset computation - RRC - RRC - ANI 60H ; A=byte offset - LXI D,BUFF ; Pt to buffer entry - MOV L,A ; Let hl=offset - MVI H,0 - DAD D ; Hl=ptr to fcb -;* -;* HL=ADR OF FCB IN BUFF -;* - CALL ATTEST ; Test attributes - JZ PEDONE ; Skip if attribute not desired - -;* -;* SCAN DIRECTORY ENTRIES AS LOADED SO FAR FOR ANOTHER ENTRY BY THE SAME -;* NAME; IF FOUND, SET THAT ENTRY TO BE THE ENTRY WITH THE LARGER EX -;* AND RETURN WITH THE ZERO FLAG SET, INDICATING NO NEW FILE; IF NOT -;* FOUND, RETURN WITH ZERO FLAG RESET (NZ) -;* - CALL DUPENTRY ; Check for duplicate and select ex - JZ PEDONE ; Skip if duplicate - -;* -;* COPY FCB PTED TO BY HL INTO DIRECTORY BUFFER -;* - XCHG ; Save ptr in de - LHLD DIRBUF ; Pt to next entry location - XCHG ; Hl pts to fcb, de pts to next entry location - MVI B,ESIZE ; Number of bytes/entry - CALL SDMOVE ; Copy fcb into memory buffer - XCHG ; Hl pts to next entry - SHLD DIRBUF ; Set ptr - XCHG ; Ptr to next entry in de - LHLD BDOS+1 ; Base address of bdos in hl - MOV A,H ; Get base page of bdos - SUI 9 ; Compute 1 page in front of base page of ccp - CMP D ; Is ptr to next entry beyond this? - RZ - -;* INCREMENT TOTAL NUMBER OF FILES - LHLD FCOUNT0 ; Total files = total files + 1 - INX H - SHLD FCOUNT0 - -;* DONE WITH PENTRY AND NO ERROR -PEDONE: - XRA A ; No error - DCR A ; Set flags (nz) - RET - -;* -;* CHECK ATTRIBUTES OF FILE ENTRY PTED TO BY HL AGAINST SELFLG -;* IF SYSTEM FILE AND SYSTEM ATTRIBUTE SET, RETURN NZ -;* IF NORMAL FILE AND NORMAL ATTRIBUTE SET, RETURN NZ -;* -ATTEST: - PUSH H ; Save ptr - LXI B,10 ; Pt to system attribute - DAD B - MOV A,M ; Get system attribute - POP H ; Restore ptr - ANI 80H ; Check for sys - LDA SELFLG ; Get selection flag - JZ ATDIR - ANI 01000000B ; Check system attribute - RET -ATDIR: - ANI 10000000B ; Check normal attribute - RET - -;* -;* SCAN DIRECTORY ENTRIES AS LOADED SO FAR FOR ANOTHER ENTRY BY THE SAME -;* NAME; IF FOUND, SET THAT ENTRY TO BE THE ENTRY WITH THE LARGER EX -;* AND RETURN WITH THE ZERO FLAG SET, INDICATING NO NEW FILE; IF NOT -;* FOUND, RETURN WITH ZERO FLAG RESET (NZ) -;* ON INPUT, HL PTS TO ENTRY TO SCAN FOR, FCOUNT0 = NUMBER OF ENTRIES SO FAR, -;* AND (DSTART) = STARTING ADDRESS OF DIRECTORY LOADED -;* ON OUTPUT, A=0 AND ZERO FLAG SET IF DUPLICATE ENTRY FOUND; A=0FFH AND NZ -;* IF NO DUP ENTRY FOUND -;* ONLY HL NOT AFFECTED -;* -DUPENTRY: - PUSH H ; Save ptr to entry to scan for - XCHG ; Ptr in de - LHLD FCOUNT0 ; Check count - MOV A,H ; No entries? - ORA L - JZ NODUP ; No duplicate entry return - MOV B,H ; Bc=number of entries - MOV C,L - LHLD DSTART ; Hl pts to first entry -DUPELOOP: - PUSH B ; Save count - PUSH H ; Save ptrs - PUSH D - INX H ; Pt to fn - INX D - MVI B,11 ; Compare fn and ft - CALL COMP - JNZ NODUPL ; Continue looking for another entry -; DUPLICATE ENTRIES HAVE BEEN IDENTIFIED AT THIS POINT - MOV C,M ; Extent in low order - INX H - INX H - MOV B,M ; Module in high order - PUSH B ; Save entry size a moment - XCHG ; Point hl to target - MOV E,M ; Extent in low order - INX H - INX H - MOV D,M ; Module in high order - POP H ; Dir in hl, target in de - XCHG - CALL SUBDE ; Subtract dir size from target size - POP D ; Get ptrs - POP H - JC DUPSMALL ; Target is smaller -; NEW TARGET IS LARGER THAN STORED ENTRY - XCHG ; Hl pts to target, de pts to dir entry - MVI B,ESIZE ; Number of bytes to move - CALL SDMOVE ; Move it -; NEW TARGET IS SMALLER THAN STORED ENTRY -DUPSMALL: - POP B ; Clear count from stack - XRA A ; Indicate dup found - POP H ; Restore ptr to entry to scan for - RET -; NO DUPLICATE FOUND; ADVANCE TO NEXT ENTRY -NODUPL: - POP D ; Restore ptrs - POP H - LXI B,ESIZE ; Hl pts to current entry in buffer, so add esize to it - DAD B - POP B ; Get count - DCX B ; Count down - MOV A,B ; Check for done - ORA C - JNZ DUPELOOP -; NO DUPLICATE FOUND -NODUP: - XRA A ; Indicate dup not found - DCR A ; Set flags (nz) - POP H ; Restore ptr to entry to scan for - RET - -;* -;* DIRALPHA -- ALPHABETIZES DIRECTORY PTED TO BY HL; BC CONTAINS -;* THE NUMBER OF FILES IN THE DIRECTORY AND A = SORT FLAG -;* (0=SORT BY FILE NAME/TYPE, <>0 = SORT BY FILE TYPE/NAME) -;* -DIRALPHA: - MOV A,B ; Any files? - ORA C - RZ - PUSH H ; Save regs - PUSH D - PUSH B - SHLD DIRBUF ; Save ptr to directory - PUSH H ; Save hl - MOV H,B ; Hl=bc=file count - MOV L,C - SHLD N ; Set "N" - POP H -;* -;* SHELL SORT -- -;* THIS SORT ROUTINE IS ADAPTED FROM "SOFTWARE TOOLS" -;* BY KERNIGAN AND PLAUGHER, PAGE 106. COPYRIGHT, 1976, ADDISON-WESLEY. -;* ON ENTRY, BC=NUMBER OF ENTRIES -;* -SORT: - XCHG ; Pointer to directory in de - LHLD ORDER ; Pt to order table -;* -;* SET UP ORDER TABLE; HL PTS TO NEXT ENTRY IN ORDER TABLE, DE PTS TO NEXT -;* ENTRY IN DIRECTORY, BC = NUMBER OF ELEMENTS REMAINING -;* -SORT1: - MOV M,E ; Store low-order address - INX H ; Pt to next order byte - MOV M,D ; Store high-order address - INX H ; Pt to next order entry - PUSH H ; Save ptr - LXI H,ESIZE ; Hl=number of bytes/entry - DAD D ; Pt to next dir1 entry - XCHG ; De pts to next entry - POP H ; Get ptr to order table - DCX B ; Count down - MOV A,B ; Done? - ORA C - JNZ SORT1 -;* -;* THIS IS THE MAIN SORT LOOP FOR THE SHELL SORT IN "SOFTWARE TOOLS" BY K&P -;* - -;* -;* SHELL SORT FROM "SOFTWARE TOOLS" BY KERNINGHAN AND PLAUGER -;* - LHLD N ; Number of items to sort - SHLD GAP ; Set initial gap to n for first division by 2 - -;* FOR (GAP = N/2; GAP > 0; GAP = GAP/2) -SRTL0: - ORA A ; Clear carry - LHLD GAP ; Get previous gap - MOV A,H ; Rotate right to divide by 2 - RAR - MOV H,A - MOV A,L - RAR - MOV L,A - -;* TEST FOR ZERO - ORA H - JZ SDONE ; Done with sort if gap = 0 - - SHLD GAP ; Set value of gap - SHLD I ; Set i=gap for following loop - -;* FOR (I = GAP + 1; I <= N; I = I + 1) -SRTL1: - LHLD I ; Add 1 to i - INX H - SHLD I - -;* TEST FOR I <= N - XCHG ; I is in de - LHLD N ; Get n - MOV A,L ; Compare by subtraction - SUB E - MOV A,H - SBB D ; Carry set means i > n - JC SRTL0 ; Don't do for loop if i > n - - LHLD I ; Set j = i initially for first subtraction of gap - SHLD J - -;* FOR (J = I - GAP; J > 0; J = J - GAP) -SRTL2: - LHLD GAP ; Get gap - XCHG ; In de - LHLD J ; Get j - MOV A,L ; Compute j - gap - SUB E - MOV L,A - MOV A,H - SBB D - MOV H,A - SHLD J ; J = j - gap - JC SRTL1 ; If carry from subtractions, j < 0 and abort - MOV A,H ; J=0? - ORA L - JZ SRTL1 ; If zero, j=0 and abort - -;* SET JG = J + GAP - XCHG ; J in de - LHLD GAP ; Get gap - DAD D ; J + gap - SHLD JG ; Jg = j + gap - -;* IF (V(J) <= V(JG)) - CALL ICOMPARE ; J in de, jg in hl - -;* ... THEN BREAK - JC SRTL1 - -;* ... ELSE EXCHANGE - LHLD J ; Swap j, jg - XCHG - LHLD JG - CALL ISWAP ; J in de, jg in hl - -;* END OF INNER-MOST FOR LOOP - JMP SRTL2 - -;* -;* SORT IS DONE -- RESTRUCTURE DIR1 IN SORTED ORDER IN PLACE -;* -SDONE: - LHLD N ; Number of entries - MOV B,H ; In bc - MOV C,L - LHLD ORDER ; Ptr to ordered pointer table - SHLD PTPTR ; Set ptr ptr - LHLD DIRBUF ; Ptr to unordered directory - SHLD PTDIR ; Set ptr dir buffer - -;* FIND PTR TO NEXT DIR1 ENTRY -SRTDN: - LHLD PTPTR ; Pt to remaining pointers - XCHG ; In de - LHLD PTDIR ; Hl pts to next dir entry - PUSH B ; Save count of remaining entries - -;* FIND PTR TABLE ENTRY -SRTDN1: - LDAX D ; Get current pointer table entry value - INX D ; Pt to high-order pointer byte - CMP L ; Compare against dir1 address low - JNZ SRTDN2 ; Not found yet - LDAX D ; Low-order bytes match -- get high-order pointer byte - CMP H ; Compare against dir1 address high - JZ SRTDN3 ; Match found -SRTDN2: - INX D ; Pt to next ptr table entry - DCX B ; Count down - MOV A,C ; End of table? - ORA B - JNZ SRTDN1 ; Continue if not - -;* FATAL ERROR -- INTERNAL ERROR; POINTER TABLE NOT CONSISTENT -FERR$PTR: - MVI E,7 ; Ring bell - MVI C,2 ; Output - CALL BDOS - JMP CPM - -;* FOUND THE POINTER TABLE ENTRY WHICH POINTS TO THE NEXT UNORDERED DIR1 ENTRY -;* MAKE BOTH POINTERS (PTR TO NEXT, PTR TO CURRENT UNORDERED DIR1 ENTRY) -;* POINT TO SAME LOCATION (PTR TO NEXT DIR1 ENTRY TO BE ORDERED) -SRTDN3: - LHLD PTPTR ; Get ptr to next ordered entry - DCX D ; De pts to low-order pointer address - MOV A,M ; Make ptr to next unordered dir1 pt to buffer for - STAX D ; Dir1 entry to be moved to next unordered dir1 pos - INX H ; Pt to next ptr address - INX D - MOV A,M ; Make high point similarly - STAX D - -;* COPY NEXT UNORDERED DIR1 ENTRY TO HOLD BUFFER - MVI B,ESIZE ; B=number of bytes/entry - LHLD HOLD ; Pt to hold buffer - XCHG - LHLD PTDIR ; Pt to entry - PUSH B ; Save b=number of bytes/entry - CALL SDMOVE - POP B - -;* COPY TO-BE-ORDERED DIR1 ENTRY TO NEXT ORDERED DIR1 POSITION - LHLD PTPTR ; Point to its pointer - MOV E,M ; Get low-address pointer - INX H - MOV D,M ; Get high-address pointer - LHLD PTDIR ; Destination address for next ordered dir1 entry - XCHG ; Hl pts to entry to be moved, de pts to dest - PUSH B ; Save b=number of bytes/entry - CALL SDMOVE - POP B - XCHG ; Hl pts to next unordered dir1 entry - SHLD PTDIR ; Set pointer for next loop - -;* COPY ENTRY IN HOLD BUFFER TO LOC PREVIOUSLY HELD BY LATEST ORDERED ENTRY - LHLD PTPTR ; Get ptr to ptr to the destination - MOV E,M ; Get low-address pointer - INX H - MOV D,M ; High-address pointer - LHLD HOLD ; Hl pts to hold buffer, de pts to entry dest - CALL SDMOVE ; B=number of bytes/entry - -;* POINT TO NEXT ENTRY IN POINTER TABLE - LHLD PTPTR ; Pointer to current entry - INX H ; Skip over it - INX H - SHLD PTPTR - -;* COUNT DOWN - POP B ; Get counter - DCX B ; Count down - MOV A,C ; Done? - ORA B - JNZ SRTDN - POP B ; Restore regs - POP D - POP H - RET ; Done - -;* -;* SWAP (Exchange) the pointers in the ORDER table whose indexes are in -;* HL and DE -;* -ISWAP: - PUSH H ; Save hl - LHLD ORDER ; Address of order table - 2 - MOV B,H ; In bc - MOV C,L - POP H - DCX H ; Adjust index to 0...n-1 from 1...n - DAD H ; Hl pts to offset address indicated by index - ; Of original hl (1, 2, ...) - DAD B ; Hl now pts to pointer involved - XCHG ; De now pts to pointer indexed by hl - DCX H ; Adjust index to 0...n-1 from 1...n - DAD H ; Hl pts to offset address indicated by index - ; Of original de (1, 2, ...) - DAD B ; Hl now pts to pointer involved - MOV C,M ; Exchange pointers -- get old (de) - LDAX D ; -- get old (hl) - XCHG ; Switch - MOV M,C ; Put new (hl) - STAX D ; Put new (de) - INX H ; Pt to next byte of pointer - INX D - MOV C,M ; Get old (hl) - LDAX D ; Get old (de) - XCHG ; Switch - MOV M,C ; Put new (de) - STAX D ; Put new (hl) - RET -;* -;* ICOMPARE compares the entry pointed to by the pointer pointed to by HL -;* with that pointed to by DE (1st level indirect addressing); on entry, -;* HL and DE contain the numbers of the elements to compare (1, 2, ...); -;* on exit, Carry Set means ((DE)) < ((HL)), Zero Set means ((HL)) = ((DE)), -;* and Non-Zero and No-Carry means ((DE)) > ((HL)) -;* -ICOMPARE: - PUSH H ; Save hl - LHLD ORDER ; Address of order - 2 - MOV B,H ; In bc - MOV C,L - POP H - DCX H ; Adjust index to 0...n-1 from 1...n - DAD H ; Double the element number to point to the ptr - DAD B ; Add to this the base address of the ptr table - XCHG ; Result in de - DCX H ; Adjust index to 0...n-1 from 1...n - DAD H ; Do the same with the original de - DAD B - XCHG - -;* -;* HL NOW POINTS TO THE POINTER WHOSE INDEX WAS IN HL TO BEGIN WITH -;* DE NOW POINTS TO THE POINTER WHOSE INDEX WAS IN DE TO BEGIN WITH -;* FOR EXAMPLE, IF DE=5 AND HL=4, DE NOW POINTS TO THE 5TH PTR AND HL -;* TO THE 4TH POINTER -;* - MOV C,M ; Bc is made to point to the object indexed to - INX H ; By the original hl - MOV B,M - XCHG - MOV E,M ; De is made to point to the object indexed to - INX H ; By the original de - MOV D,M - MOV H,B ; Set hl = object pted to indirectly by bc - MOV L,C - -;* -;* COMPARE DIR ENTRY PTED TO BY HL WITH THAT PTED TO BY DE; -;* NO NET EFFECT ON HL, DE; RET W/CARRY SET MEANS DE) - -wherå  C Direct Output to Console - >L Direct Output to List (Printer) - >P Direct Output to Punch - - Data Dump: - = Dump both Word Table (Symbols) and Format - =F Dump current Format Specification - =S Dump current Word Table (Symbol Table) - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/DPROG.MAC b/Source/Images/d_bp/u15/DPROG.MAC deleted file mode 100644 index bbc20064..00000000 --- a/Source/Images/d_bp/u15/DPROG.MAC +++ /dev/null @@ -1,1125 +0,0 @@ -; -; PROGRAM: DPROG -; AUTHOR: Richard Conn -; VERSION: 1.0 -; DATE: 28 July 84 -; PREVIOUS VERSIONS: None -; -vers equ 10 -z3env equ 0f400h - -; -; DPROG is used to program the user's terminal, printer, or punch -; with data from the file specified in the command line. DPROG will -; automatically search for the file along the path starting at the -; indicated (or implied) DU. -; - -; -; Basic Equates -; -opsys equ 0 -fcb equ 5ch -tbuff equ 80h -cr equ 0dh -ff equ 0ch -lf equ 0ah -ctrlc equ 'C'-'@' -ctrls equ 'S'-'@' -ctrlz equ 'Z'-'@' -bel equ 7 -bs equ 8 -tab equ 9 - -; -; DPROG Constants -; -COMMENT equ ';' ;denotes a comment line -WORD equ '-' ;denotes a word definition -SYM equ '=' ;symbol table dump command -DEV equ '>' ;device assignment -INP equ '<' ;input forms (pause, string, delay) -wordl equ 16 ;length of word -fmt equ '(' ;begin format definition -fmtch equ '%' ;format escape char -endfmt equ ')' ;end format definition -quote equ '"' ;quote string -literal equ '\' ;literal interpretation follows -control equ '^' ;control char follows - -; -; SYSLIB Routines -; - ext condin,cin,cout,lout,pout - ext z3init,pfind,z3log - ext moveb,hmovb,logud,pfn1,caps - ext f$open,f$read,f$close - ext eval,pafdc,pa2hc - ext codend - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env -; -; Initial Routines -; - call helpck ;check for help - call bufinit ;initialize buffers -; -; Load File -; - call locfile ;locate file - call logud ;enter directory of file - call load ;load file -; -; Perform Program -; - call program ;program the user's terminal - ret - -; -; Initialize Buffers -; -bufinit: - call codend ;address of free space - shld format ;format string - xchg - lxi h,deffmt ;set default format (char) - mvi b,40 ;allow 40 chars - call moveb - xchg ;HL pts to format buffer - inr h ;next page - shld locstk ;set location stack - shld tos ;set top of stack - mvi m,0 - inx h - mvi m,0 ;zero stack - dcx h - inr h ;next page - shld free ;free area - mvi a,'C' ;assign console as output device - sta outdev - ret - -; -; Check for Help -; -helpck: - lxi h,fcb+1 ;pt to fcb name - mov a,m ;get it - cpi '/' ;help if slash - rnz - pop psw ;clear stack - call eprint - db 'DPROG, Version ' - db (vers/10)+'0','.',(vers mod 10)+'0' - db cr,lf,' Syntax:' - db cr,lf,' DPROG <-- STD.DPG' - db cr,lf,' DPROG filename <-- filename.DPG' - db cr,lf,' DPROG filename.typ <-- filename.typ' - db 0 - ret - -; -; Find File -; If found, return BC=DU and NZ -; -locfile: - lxi d,fcb ;pt to FCB - call z3log - lxi d,fcb+1 ;pt to file name - lxi h,defname ;pt to default file name - mvi b,8 ;8 chars - ldax d ;any type? - cpi ' ' ;none if space - cz moveb - lxi d,fcb+9 ;pt to file type - lxi h,deftype ;pt to default file type - mvi b,3 ;3 chars - ldax d ;any type? - cpi ' ' ;none if space - cz moveb - lxi d,fcb ;pt to FCB - mvi a,0ffh ;search current - call pfind ;search for file - rnz ;get file if found -; -; Abort Attempt to Load File -; -abort: - pop psw ;clear stack - call eprint - db cr,lf,' File ',0 - lxi d,fcb+1 ;pt to file name - call pfn1 - call eprint - db ' NOT Found',0 - ret - -; -; Load File -; -load: - lxi d,fcb ;pt to fcb - call f$open ;open file for input - jnz abort ;abort attempt - lhld free ;buffer area -load1: - lxi d,fcb ;pt to fcb - call f$read ;read next block - jnz load2 ;done, so mark and close - lxi d,tbuff ;copy into buffer - xchg ;copy into buffer at DE from TBUFF at HL - mvi b,128 ;128 bytes - call moveb - lxi h,80h ;pt to next buffer - dad d - jmp load1 -load2: - mvi m,ctrlz ;mark EOF - inr h ;next page - mvi l,0 - shld words ;mark beginning of word definition area - shld nxtword ;mark next word - mvi m,0 ;mark no words - jmp f$close ;close input file - -; -; Program the User's Terminal -; -program: - lhld free ;pt to first char -prog1: - call capa ;capitalize - cpi ctrlz ;done? - rz - cpi CR ;eol? - jz skipl - cpi WORD ;word definition? - jz defword - cpi SYM ;symbol table or format definition dump? - jz dump - cpi DEV ;assign device? - jz device - cpi INP ;input form? - jz input - push h ;save HL -prog2: - call output ;output line at HL - call locpop ;pop stack if any - jnz prog2 ;continue if any element on stack - pop h ;restore HL -; -; Skip to next line -; -skipl: - mov a,m ;get char - call capa ;capitalize - cpi CR ;new line? - jz skipl1 - cpi LF ;new line? - jz skipl1 - cpi CTRLZ ;EOF? - rz - inx h ;pt to next - jmp skipl -skipl1: - mov a,m ;get it - inx h ;pt to next - ani 7fh ;mask - cpi CR ;continue? - jz skipl1 - cpi LF ;continue? - jz skipl1 - dcx h ;pt to non-eol char - jmp prog1 ;continue with next line -; -; Input Form -; -input: - inx h ;pt to next char - call cin ;get any char - ani 7fh ;mask - cpi ctrlc ;abort? - jz opsys - jmp skipl ;continue -; -; Assign Device -; -device: - inx h ;pt to char - call capa ;capitalize - cpi 'C' ;console? - jz setdev - cpi 'L' ;list? - jz setdev - cpi 'P' ;punch? - jz setdev - push psw - call eprint - db cr,lf,bel,' Invalid Device Assignment: ',0 - pop psw - call cout ;print char - dcx h ;back up - jmp skipl ;continue -; -; Perform assignment -; -setdev: - sta outdev ;assign - jmp skipl ;continue -; -; Define Word -; -defword: - inx h ;pt to first char of word - call bufword ;store word in buffer - shld nextch ;save ptr to next char - call wscan ;scan for word - jz defnew ;new word defined - xchg ;ptr to high-order in DE - lhld nextch ;get ptr to word definition - xchg ;word defn in DE, word adr high in HL - mov m,d ;store new address - dcx h - mov m,e - xchg ;HL pts to word - jmp skipl ;skip out line -; -; New Word -; -defnew: - lhld nxtword ;pt to next word - xchg - lxi h,wordbf ;pt to buffer - mvi b,wordl ;number of chars max - call hmovb ;copy into buffer and advance HL - lhld nextch ;get address - xchg - mov m,e ;put low - inx h - mov m,d ;put high - inx h ;set ptr to next word - mvi m,0 ;store zero - shld nxtword ;set ptr - xchg ;HL pts to word definition - jmp skipl ;skip to next line - -; -; Dump Format String or Word Table -; -dump: - inx h ;pt to option - call capa ;check for format display option - cpi 'F' ;format? - jz dfmt ;dump format if so - cpi 'S' ;symbols? - jz dsym - dcx h ;pt to current - call dumpsym ;dump symbols - call dumpfmt ;dump format - jmp skipl ;continue -; -; Dump Format -; -dfmt: - call dumpfmt ;do dump - jmp skipl ;continue -; -; Dump Words -; -dsym: - call dumpsym ;do dump - jmp skipl ;continue -; -; Dump Words in Symbol Table -; -dumpsym: - push h ;save HL - call eprint - db cr,lf,' >> Word Definitions <<',0 - lhld words ;dump word table -sym1: - mov a,m ;get next - ora a - jz symexit - call eprint - db cr,lf,' ',0 - call prword ;print word - mov e,m ;get low - inx h - mov d,m ;get high - inx h ;pt to next word - push h ;save ptr - call eprint - db ' >',0 - xchg ;HL pts to word -sym2: - mov a,m ;get next char - cpi CR ;done? - jz sym3 - cpi TAB ;translate tab to space - jnz sym2out - mvi a,' ' ;space instead of tab -sym2out: - call chout - inx h - jmp sym2 -sym3: - call eprint - db '<',0 - pop h ;pt to next word - jmp sym1 -symexit: - pop h ;pt to char - ret -; -; Output Format String -; -dumpfmt: - push h ;save ptr - call eprint - db cr,lf,' Format: (',0 - lhld format ;pt to string - call epstr ;print it - call eprint - db ')',cr,lf,0 - pop h ;get ptr - ret - -; -; Print Word at HL (advance HL) -; -prword: - mvi b,wordl ;number of chars -prw1: - mov a,m ;get char - call chout - inx h - dcr b - jnz prw1 - ret -; -; Routine to Output a Line -; -output: - call sksp ;skip spaces - cpi COMMENT ;done? - rz - cpi CR ;done? - rz - cpi LF ;done? - rz - cpi CTRLZ ;done? - rz - cpi fmt ;format definition? - jz outfmt - cpi quote ;chars? - jz outch - call bufword ;store word in buffer - shld nextch ;save ptr to next char after word - call wscan ;scan for word in table - jz badword ;word not defined - call locpush ;push location onto stack - xchg ;HL pts to continuation location - jmp output ;continue -; -; Output Quoted String -; -outch: - inx h ;pt to next char -outch1: - mov a,m ;get it - ani 7fh ;mask - cpi CR ;done? - jz outcherr - cpi LF ;done? - jz outcherr - cpi CTRLZ ;done? - jz outcherr - cpi quote ;end of quote? - jz outch2 - call charout ;output char in whatever form - jmp outch1 ;continue -outcherr: - call eprint - db cr,lf,bel,' Premature End of Quote',cr,lf,0 - jmp output -outch2: - inx h ;pt to after quote - jmp output ;continue -; -; Output char in A and set HL to next char on exit -; -charout: - cpi control ;control char follows? - jz charo0 - cpi literal ;literal follows? - jz charo1 -; -; Normal Char in A -; -charnxt: - inx h ;pt to next char - jmp formatout ;output with format -; -; Output control char -; -charo0: - inx h ;pt to char - call capa ;get char - sui '@' ;convert to control - jc ctrlerr - cpi 20h - jnc ctrlerr - inx h ;pt to next - jmp formatout -ctrlerr: - call eprint - db cr,lf,bel,' Invalid Control Character',cr,lf,0 - ret -; -; Output Literal Format -; -charo1: - inx h ;pt to char - call capa ;get char - cpi 'B' ;BS? - jz c1bs - cpi 'D' ;DEL? - jz c1del - cpi 'E' ;ESCAPE? - jz c1esc - cpi 'L' ;CRLF? - jz c1nl - cpi 'N' ;LF? - jz c1lf - cpi 'R' ;CR? - jz c1cr - cpi 'T' ;TAB? - jz c1tab - cpi '0' ;digit? - jc charol ;literal if not - cpi '9'+1 ;range? - jc numout - cpi ' ' ;less than space? - jnc charol - call eprint - db cr,lf,bel,' Invalid Literal Argument',cr,lf,0 - ret - -; -; Output Char in A literally -; -charol: - mov a,m ;get char - ani 7fh ;don't cap this way - inx h ;pt to next - jmp formatout -; -; Output Number -; -numout: - call eval ;convert to binary in DE - mov a,e ;char binary value - jmp formatout ;output with format -; -; Output BS -; -c1bs: - mvi a,bs - jmp charnxt -; -; Output TAB -; -c1tab: - mvi a,tab - jmp charnxt -; -; Output CR -; -c1cr: - mvi a,cr - jmp charnxt -; -; Output DEL -; -c1del: - mvi a,7fh - jmp charnxt -; -; Output ESCAPE -; -c1esc: - mvi a,1bh - jmp charnxt -; -; Output LF -; -c1lf: - mvi a,lf - jmp charnxt -; -; Output CRLF -; -c1nl: - mvi a,cr - call formatout ;output CR - mvi a,lf - jmp charnxt - -; -; Output Char in A According to Format -; -formatout: - push h ;save ptr to next char - push b ;save BC - mov b,a ;char in B - lhld format ;pt to format string -fout1: - mov a,m ;get next char - ani 7fh ;mask - jz foutx ;exit if end of string - cpi fmtch ;expression form? - jz fout2 - cpi literal ;literal? - jz flit -; -; Output char in A and advance -; -fch: - call chout ;output char - inx h ;pt to next - jmp fout1 -; -; Output Value in B according to format -; -fout2: - inx h ;pt to format type - mov a,m ;get char - inx h ;pt to next - ani 7fh ;mask - call caps - ora a ;none? - jz fout1 ;error condition - % at end of string - cpi 'C' ;char? - jz foch - cpi 'D' ;floating decimal chars - jz fod - cpi '2' ;2 decimal chars - jz fo2 - cpi '3' ;3 decimal chars - jz fo3 - cpi 'X' ;2 hex chars - jz fox - push psw - call eprint - db cr,lf,bel,' Invalid Format Char: ',0 - pop psw - call cout - call crlf - jmp fout1 ;continue - -; -; Output value in B as char -; -foch: - mov a,b ;get value - call chout ;output it - jmp fout1 ;continue -; -; Output value in B as floating decimal -; -fod: - mov a,b ;get value - call pafdc ;output - jmp fout1 ;continue -; -; Output value in B as hex -; -fox: - mov a,b ;get value - call pa2hc ;output - jmp fout1 ;continue -; -; Output value in B as 3 decimal chars -; -fo3: - mvi c,100 ;100's - call dec ;output and fall thru to FO2 -; -; Output value in B as 2 decimal chars -; -fo2: - mvi c,10 ;10's - call dec - mov a,b ;get value - adi '0' ;convert - call chout - jmp fout1 ;continue -; -; Subtracting Output -; Output value in B as 100's or 10's digit (leading 0 allowed) -; -dec: - push d ;save DE - mov a,b ;get value - mvi d,'0' ;set digit -dec1: - sub c ;subtract - jc dec2 - inr d ;increment digit - jmp dec1 -dec2: - add c ;add back in - mov b,a - mov a,d ;output digit - call chout - pop d ;restore DE - ret -; -; Exit Format String Output -; -foutx: - pop b ;restore BC - pop h ;restore ptr to next char - ret -; -; Literal Format Output -; -flit: - inx h ;pt to char - call capa ;get char - cpi 'B' ;BS? - jz f1bs - cpi 'D' ;DEL? - jz f1del - cpi 'E' ;ESCAPE? - jz f1esc - cpi 'L' ;CRLF? - jz f1nl - cpi 'N' ;LF? - jz f1lf - cpi 'R' ;CR? - jz f1cr - cpi 'T' ;TAB? - jz f1tab - cpi '0' ;digit? - jc fchck ;literal if not - cpi '9'+1 ;range? - jnc fchck -; -; Output Number -; - call eval ;convert to binary in DE - mov a,e ;char binary value - jmp fch ;output -; -; Check for Valid Literal -; -fchck: - cpi ' ' ;not valid if less than space - jnc fch - call eprint - db cr,lf,bel,' Invalid Literal Argument',cr,lf,0 - jmp fout1 -; -; Output BS -; -f1bs: - mvi a,bs - jmp fch -; -; Output TAB -; -f1tab: - mvi a,tab - jmp fch -; -; Output CR -; -f1cr: - mvi a,cr - jmp fch -; -; Output DEL -; -f1del: - mvi a,7fh - jmp fch -; -; Output ESCAPE -; -f1esc: - mvi a,1bh - jmp fch -; -; Output LF -; -f1lf: - mvi a,lf - jmp fch -; -; Output CRLF -; -f1nl: - mvi a,cr - call chout ;output CR - mvi a,lf - jmp fch - -; -; Define New Output Format -; -outfmt: - inx h ;pt to format char - xchg - lhld format ;pt to format area - xchg -; -; Get next char for format string -; -outf1: - mov a,m ;get next char - ani 7fh ;mask - cpi endfmt ;end of format? - jz outf2 - cpi CR ;end of line? - jz outf3 - cpi LF ;end of line? - jz outf3 - cpi CTRLZ ;end of file? - jz outf3 - stax d ;store char - inx h ;pt to next - inx d - cpi literal ;literal denotation? - jnz outf1 ;continue if not -; -; Literal flag, so store next char exactly as-is without interpretation -; - mov a,m ;get next char - ani 7fh ;mask - stax d ;store it literally - inx h ;pt to next - inx d - jmp outf1 -; -; Format String Stored - Terminate it -; -outf2: - inx h ;pt to next char -outf3: - xra a ;terminate format string - stax d - jmp output - -; -; Invalid Word - So State -; -badword: - call eprint - db cr,lf,bel,' Invalid Word Reference: ',0 - lxi h,wordbf ;pt to buffer - call prword ;print word - lhld nextch ;continue - jmp output -; -; Element must be a word - resolve it -; -bufword: - lxi d,wordbf ;buffer to store word in - mvi b,wordl ;length -; -; Build Word into WORDBF -; -bword1: - call capa ;get char - cpi ' '+1 ;end? - jc bword3 - stax d ;store char - inx h ;pt to next - inx d - dcr b ;count down - jnz bword1 -; -; Word is longer than WORDL - skip trailing chars -; -bword2: - mov a,m ;skip chars to delimiter - ani 7fh ;mask - cpi ' '+1 - jc bword4 - inx h ;pt to next - jmp bword2 -; -; Word is built into WORDBF - space fill it -; -bword3: - mvi a,' ' ;space - stax d ;store char - inx d ;pt to next - dcr b ;count down - jnz bword3 -; -; Word is Stored -; HL pts to next char after the Word -; -bword4: - ret -; -; Scan for Word in Table -; Return with Zero Set if Not Resolved -; If Resolved, DE=address of word -; -wscan: - lhld words ;pt to first word in table -wscan1: - mov a,m ;abort if empty table - ora a - rz - lxi d,wordbf ;pt to buffer - mvi b,wordl ;size of buffer - push h ;save HL -wscan2: - ldax d ;get char - cmp m ;compare - jnz wscan3 - inx h ;pt to next - inx d - dcr b ;count down - jnz wscan2 - mov e,m ;get address in DE - inx h - mov d,m - pop psw ;clear stack - xra a ;return NZ - dcr a - ret -wscan3: - pop h ;get address of current word in table - lxi d,wordl+2 ;advance to next word - dad d - jmp wscan1 - -; -; Push Address in NEXTCH onto Location Stack -; -locpush: - push h ;save regs - push d - lhld nextch ;get address - xchg ;... in DE - lhld tos ;get top of stack - mov m,e ;store address - inx h - mov m,d - inx h - shld tos ;new top of stack - pop d ;restore regs - pop h - ret -; -; Pop Address from Top of Stack -; -locpop: - lhld locstk ;local stack - xchg - lhld tos ;check to see if nothing on stack - mov a,e ;if lows are same, nothing on stack - cmp l - rz - dcx h ;pt to top element - mov d,m ;get high - dcx h - mov e,m ;get low - shld tos ;new top of stack - xchg ;address in HL - xra a ;return with NZ - dcr a - ret -; -; Skip to Non-Space -; -sksp: - mov a,m ;get char - ani 7fh ;mask - call issp ;test for space - rnz ;not space, so return - inx h ;pt to next - jmp sksp -; -; Test char in A for space char -; Ret with Z if yes -; -issp: - push h ;save HL - push b ;save BC - lxi h,sptab ;pt to table - mov b,a ;char in B -issp1: - mov a,m ;get next char - ora a ;end of table? - jz issp3 - cmp b ;match? - jz issp2 - inx h ;pt to next - jmp issp1 -issp2: - mov a,b ;restore char - pop b ;restore regs - pop h - ret ;Z flag is set -issp3: - xra a ;set NZ - dcr a - jmp issp2 -; -; Output New Line -; -crlf: - push psw ;save A - mvi a,cr ;CR - call chout - mvi a,lf ;LF - call chout - pop psw ;get A - ret -; -; Output Char in A with XON/XOFF Flow Control -; -chout: - push psw ;save char - call condin ;conditional input - jz chout1 - cpi ctrls ;pause? - jnz chout1 - call cin ;wait for following char -chout1: - pop psw ;get char - push b ;save BC - mov c,a ;char in C - lda outdev ;get output device - cpi 'C' ;console? - jz chcon - cpi 'L' ;printer? - jz chlst - cpi 'P' ;punch? - jz chpun -; -; Output to Console -; -chcon: - mov a,c ;get char - call cout - pop b - ret -; -; Output to List -; -chlst: - mov a,c ;get char - call lout - pop b - ret -; -; Output to Punch -; -chpun: - mov a,c ;get char - call pout - pop b - ret -; -; Print String Pted to by HL -; -epstr: - mov a,m ;get char - inx h ;pt to next - ani 7fh ;mask MSB - rz ;done - call chout ;print char - jmp epstr -; -; Print String at Return Address -; -eprint: - xthl ;save HL and pt to string - call epstr ;print string - xthl ;restore HL and new exec adr - ret -; -; Input Char, Mask, and Capitalize -; -capa: - mov a,m ;get char - ani 7fh ;mask - jmp caps ;capitalize - -; -; Space Table -; -sptab: - db ' ',tab,bs,ff,',','.',0 ;space chars - -; -; Data Area -; -defname: - db 'STD ' ;default file name -deftype: - db 'DPG' ;default file type -deffmt: - db '%C',0 ;default format string -outdev: - ds 1 ;output device (C=console, L=list, P=punch) -outdev1: - ds 1 ;save area for output device -wordbf: - ds wordl ;current word buffer -format: - ds 2 ;address of format string -free: - ds 2 ;address of free area -words: - ds 2 ;address of scratch area -nxtword: - ds 2 ;pointer to next word -nextch: - ds 2 ;pointer to next char -locstk: - ds 2 ;pointer to location stack -tos: - ds 2 ;pointer to top of stack - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/DPROG12.LBR b/Source/Images/d_bp/u15/DPROG12.LBR deleted file mode 100644 index 0a7c4840..00000000 Binary files a/Source/Images/d_bp/u15/DPROG12.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/DU3.COM b/Source/Images/d_bp/u15/DU3.COM deleted file mode 100644 index 14641e60..00000000 Binary files a/Source/Images/d_bp/u15/DU3.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/DU3.HLP b/Source/Images/d_bp/u15/DU3.HLP deleted file mode 100644 index 4d536d3d..00000000 --- a/Source/Images/d_bp/u15/DU3.HLP +++ /dev/null @@ -1,1131 +0,0 @@ -; - -- DU3 -- - - GENERAL INFORMATION - 1 - Invoking DU3 and DU3 Installation - 2 - DU3 Command Summary - 3 - The DU3 Editor - 4 - Examples of Command Use - µ - Interpretinç thå DU³ Directorù Display - - COMMAND DETAILS - A - Logging Disks and Examining Disk Parameters - B - Positioning and Reading Data - C - Searching for Data - D - Saving and Restoring Data - E - Viewing Data - F - Altering Data - G - Manipulating Macros and the @ Command - H - Miscellanea -:1 - - DU³ ió invokeä bù á commanä linå oæ thå followinç form: - - DU3 - -wherå Get Saved Block - B Get Block from Queue - G Get Current Group - Gn Get Group N - - ---- Queue Control ---- - Q Print Queue Statistics QZ Zero (Empty) Queue - QSfile Save Queue as File - - - ---- Data Searching ---- -Ff Find File f =string Search for String -Un Set User Area for Find - - ---- Login/Disk Reset ---- -Ld Log in Disk N New Disk Reset - - ---- Printer Output ---- -P Toggle Printer - - ---- Command Manipulation ---- -@ Exec Prev Command *nn Repeat Command Line - - ---- Statistics/Help ---- -# Display Disk Stats ? Display Help Info - - ---- Halt/Sleep ---- -! Halt and Wait for User Zn Sleep n Seconds - -:A - - Thå followinç commandó arå discusseä iî thió sectioî oæ -thå HELÐ file: - - L -- Log in Disk - N -- New Disk (Reset Disk System) - M -- Map Disk Directory - U -- Select User Number - # -- Print Disk and Queue Statistics - - - - L[d] - - Thå simplå "L¢ commanä re-logó iî thå currenô disk® Thå -useò maù pulì ouô á disk¬  puô iî á new¬ anä "L¢ jusô tï loç -iô in® Thå forí "Ld"¬ wherå ä ió á valiä drivå letteò (likå -"LB")¬ ió useä tï loç iî á specifiã disë anä permiô thå useò -tï worë oî thaô particulaò disë froí thió timå foreword. - - Example (actual DU3 session): - -DU3 B1? l - -DU3 B1? la - -DU3 A1? lb - - - N - - Thió  telló DU³ thaô thå useò jusô puô iî á  ne÷  disk® -Foò   thoså  BIOÓ  implementationó  thaô  neeä  tï  bå  tolä -specificallù (Reset© thaô á disë changå haó beeî  made¬  uså -thió  commanä  everù  timå á disë ió changeä  whilå  DU³  ió -running. - - Example: - -DU3 B1? n - - Noteº  Therå waó á significanô delaù beforå thå prompô -returned® Á completå disë systeí reseô tooë place. - - - - M[n] - - Dumpó  á  mað oæ thå grouð allocationó  foò  files®  Mî -showó whicè filå ió allocateä tï grouð "n". - - Example (actual DU3 session, edited): - -DU3 B1? m -0010-0010 07 STD .MSG 00 : 0011-0011 07 TALK .SUM 00 -0012-0012 07 Z2CON .WSH 00 : 0013-0013 00 LDIR .C 00 -0014-0014 00 COMMAND .LBR 01 : 0015-0015 00 LDIR .C 00 - < Detail Left Out > -004B-004B 08 MASTER .CAT 03 : 004C-0050 00 COMMAND .LBR 05 -0051-0051 00 COMMAND .LBR 07 : 0052-0052 00 UNERA15 .COM 00 -0053-0053 08 MENU .CPR 00 : 0054-0057 00 COMMAND .LBR 07 -Type Any Character to Continue or ^C to Abort - -DU3 B1? m54 -0054-0057 00 COMMAND .LBR 07 : -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 - - The entries are divided as follows: - -0010-0010 07 STD .MSG 00 : 0011-0011 07 TALK .SUM 00 - ^ ^ ^ ^ - | | Filename Extent - | User Number - Group Range - - Uu - - Logó useò 'u§ foò nexô Æ (Finä File© command. - - Example (actual DU3 session): - -DU3 B1? u7 - -DU3 B7? u1 - - - # - - Prints the disk parameters: - -. Current Disk Drive . Number of Tracks on Disk -. Size of Group in Blocks . Number of Sectors Per Track -. Number of Groups on Disk . Number of Directory Entries -. Number of System Tracks - - Prints the queue statistics: - -. Size of Queue . Space Available - -:B - - Thå followinç commandó arå discusseä iî thió sectioî oæ -thå HELÐ file: - - G -- Position to Group - S -- Position to Sector - T -- Position to Track - R -- Read Block - W -- Write Block - + -- Advance to Next Logical Sector - - -- Backup to Last Logical Sector - - - - G[nn] - - Positioî  tï grouð nî anä reaä block®  Iæ thå forí  ió -simplù "G"¬ sho÷ thå currenô position. - - Example (actual DU3 session): - -DU3 B1? g0 -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 - -DU3 B1? g4 -Group = 0004:00, Track = 122, Sector = 129, Physical Sector = 129 - -DU3 B1? g -Group = 0004:00, Track = 122, Sector = 129, Physical Sector = 129 - -DU3 B1? g0 -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 - - - Tnn and Snn - - "Tnn¢  doeó  á  seeë tï tracë nî buô doeó  noô  reaä  á -block®  "Snn¢  positionó tï sectoò nî oî thå currenô  tracë -anä readó thå blocë there® Examplå (actuaì DU³ session): - -DU3 B1? t124 -Group = 0015:00, Track = 124, Sector = 1, Physical Sector = 1 - -DU3 B1? s24 -Group = 0015:17, Track = 124, Sector = 24, Physical Sector = 24 - - - R and W - - Ò  readó thå blocë currentlù positioneä tï intï memory® -Notå Ò (Read© ió impliciô iî thå G¬  +¬  anä - commands¬ buô -NOÔ iî thå Ó anä Ô commands. - - × writeó bacë thå currenô blocë (NOTEº  maù noô bå useä -afteò aî Æ command¬ aó CP/Í waó useä tï finä thå filå iî thå -directory). - - Examples: - -DU3 B1? r - -DU3 B1? w - - - +[nn] and -[nn] - - "+¢ advanceó ± sectoò (iæ belo÷ tracë 2¬  thió advanceó -tï nexô numericaì sectoò anä iæ ² oò more¬ advanceó baseä oî -thå system'ó sectoò skewinç algorithm¬  i.e®  sï « wilì  geô -thå  nexô  logicaì sectoò oæ thå file)®  "-¢ backupó  uð  ± -sectoò iî thå samå sense. - - Notå « anä - maù takå aî amountº foò example¬ +1µ stepó -iî  1µ  sectors®  Notå  alsï thaô "-¢ issueä  aô  thå  firsô -logicaì  sectoò  oæ thå disë wilì wrað bacë tï thå lasô  anä -"+¢ issueä aô lasô sectoò wilì wrað forwarä tï thå first. - - Examples (actual DU3 session): - -DU3 B1? g0 -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 - - DU3 B1? d -00 07535444 20202020 204D5347 00000002 |.STD MSG....| -10 10000000 00000000 00000000 00000000 |................| -20 004C4449 52202020 20432020 00000038 |.LDIR C ...8| -30 13001500 00000000 00000000 00000000 |................| -40 0843504D 55472020 20434154 01000046 |.CPMUG CAT...F| -50 1C001E00 38003D00 41004300 45000000 |....8.=.A.C.E...| -60 00434F4D 4D414E44 204C4252 01000080 |.COMMAND LBR....| -70 14001600 17001800 19001A00 1B001D00 |................| - -DU3 B1? +d -Group = 0000:01, Track = 122, Sector = 2, Physical Sector = 2 -00 0754414C 4B202020 2053554D 00000049 |.TALK SUM...I| -10 11002300 24000000 00000000 00000000 |..#.$...........| -20 00554E45 52413135 2041534D 00000060 |.UNERA15 ASM...`| -30 3E003F00 40000000 00000000 00000000 |>.?.@...........| -40 075A3249 4E532020 20575348 0000002A |.Z2INS WSH...*| -50 21002500 00000000 00000000 00000000 |!.%.............| -60 075A3243 4F4E2020 20575348 0000003F |.Z2CON WSH...?| -70 12002200 00000000 00000000 00000000 |..".............| - -DU3 B1? +d -Group = 0000:02, Track = 122, Sector = 3, Physical Sector = 3 -00 07445532 20202020 2042414B 00000057 |.DU3 BAK...W| -10 26002800 29000000 00000000 00000000 |&.(.)...........| -20 04535441 52545550 20C3CF4D 0000001E |.STARTUP COM....| -30 27000000 00000000 00000000 00000000 |'...............| -40 00434F4D 4D414E44 204C4252 03000080 |.COMMAND LBR....| -50 1F002000 30003100 32003300 34003500 |.. .0.1.2.3.4.5.| -60 00434F4D 4D414E44 204C4252 05000080 |.COMMAND LBR....| -70 36003700 39004C00 4D004E00 4F005000 |6.7.9.L.M.N.O.P.| - -DU3 B1? +2 -Group = 0000:04, Track = 122, Sector = 5, Physical Sector = 5 - - -DU3 B1? d -00 084D4153 54455220 20434154 01000080 |.MASTER CAT....| -10 2D002F00 3A003B00 3C004200 44004600 |-./.:.;.<.B.D.F.| -20 00464958 54455820 2041534D 0100001E |.FIXTEX ASM....| -30 65006600 69006B00 6C000000 00000000 |e.f.i.k.l.......| -40 00554E45 52413135 20434F4D 00000007 |.UNERA15 COM....| -50 52000000 00000000 00000000 00000000 |R...............| -60 084D454E 55202020 20C35052 00000008 |.MENU CPR....| -70 53000000 00000000 00000000 00000000 |S...............| - -DU3 B1? -3d -Group = 0000:01, Track = 122, Sector = 2, Physical Sector = 2 -00 0754414C 4B202020 2053554D 00000049 |.TALK SUM...I| -10 11002300 24000000 00000000 00000000 |..#.$...........| -20 00554E45 52413135 2041534D 00000060 |.UNERA15 ASM...`| -30 3E003F00 40000000 00000000 00000000 |>.?.@...........| -40 075A3249 4E532020 20575348 0000002A |.Z2INS WSH...|| -50 21002500 00000000 00000000 00000000 |!.%.............| -60 075A3243 4F4E2020 20575348 0000003F |.Z2CON WSH...?| -70 12002200 00000000 00000000 00000000 |..".............| -:C - - The commands for searching for data on the disk are: - - Ffilename.typ -- find all dir entries for file - - =string -- find next occurrance of string - - - - Ffilename.typ - - Prinô directorù foò filå "filename.typ"®  Thió commanä -presentó  thå  directorù  entrieó foò  alì  extentó  oæ  thå -indicateä  file®  Seå thå sectioî oî "Interpretinç thå  DU³ -Directorù   Display¢  foò  infï  oî  ho÷  tï  interpreô  thå -informatioî presented. - - Example (actual DU3 session): - -DU3 B1? fz80.mac -40 015A3830 20202020 204D4143 0000000E |.Z80 MAC....| -50 9A000000 00000000 00000000 00000000 |................| -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 - -DU3 B1? ftest.txt -++ File Not Found ++ -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 - - - =string - - Thió commanä performó á searcè foò thå indicateä  ASCIÉ -text¬  startinç aô currenô sector® ®  Biô ·  ió -ignoreä unlesó .?.@.A.B.C.D.| -20 075A3243 4F4E2020 20575320 06000077 |.Z2CON WS ...w| -30 45014601 47014801 00000000 00000000 |E.F.G.H.........| -40 E5444953 4B4F5554 20434F4E 00000020 |eDISKOUT CON... | -50 97000000 00000000 00000000 00000000 |................| -60 07445532 20202020 20484C50 01000006 |.DU3 HLP....| -70 98009900 9B009C00 9D000000 00000000 |................| - - -DU3 B1? +=DU3,d -Group = 0000:11, Track = 122, Sector = 18, Physical Sector = 18 -= at 24 -Group = 0000:11, Track = 122, Sector = 18, Physical Sector = 18 -00 E547454E 494E5320 204D4143 01000080 |eGENINS MAC....| -10 D700EF00 F000F400 F500F600 F700F800 |W.o.p.t.u.v.w.x.| -20 E5445532 20202020 2041534D 01000080 |eDU3 ASM....| -30 EC00ED00 EE00FA00 07010B01 0E011301 |l.m.n.z.........| -40 04445532 20202020 20C3CF4D 0000004E |.DU3 COM...N| -50 F100F200 F3000000 00000000 00000000 |q.r.s...........| -60 E547454E 494E5320 204D4143 02000039 |eGENINS MAC...9| -70 F9000F01 00000000 00000000 00000000 |y...............| - -:D - - Thå followinç commandó arå discusseä iî thió sectioî oæ -thå HELÐ file: - - < -- Save Current Block - > -- Restore Saved Block - B -- Load Current Block from Head of Queue - G -- Copy Group from Head of Queue and Write - Q -- Print Queue Statistics - QZ -- Zero (Clear) Queue - QS -- Save Queue as a File - - - - < and > - - "<¢  saveó  currenô blocë iî aî internaì  savå  buffer® -">¢  copieó thå internaì savå buffeò intï thå currenô  blocë -areá (buô doeó NOÔ writå iô ouô tï disk). - - B - - "B¢ extractó thå blocë aô thå heaä oæ thå  DU³ -Queuå anä placeó iô intï thå workinç buffeò area. - - G[nn] - - "G¢ copieó thå grouð aô thå heaä oæ thå  DU³ -Queuå  ontï  disk®  Iæ  nî ió specifieä (aó  iî  "Gnn")¬  theî  thå indicateä grouð ió reaä froí oò  writteî -to®  Iæ  nî  ió  noô given¬  theî thå  grouð  thå  useò  ió -currentlù positioneä tï ió affected. - - Q, QZ, and QSfile - - Ñ reportó thå statuó oæ thå DU³ Queue¬  namelù ho÷ manù -blockó  arå  storeä iî iô anä ho÷ mucè  spacå  remains®  QÚ -zeroeó  (clears© thå DU³ Queue®  "QSfilename.typ¢ saveó thå -DU³ Queuå oî disë iî thå currenô useò areá aó thå  indicateä -file. - Examples (actual DU3 session): - -DU3 B1? g0 -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 - -DU3 B1? d -00 07535444 20202020 204D5347 00000002 |.STD MSG....| -10 10000000 00000000 00000000 00000000 |................| -20 004C4449 52202020 20432020 00000038 |.LDIR C ...8| -30 13001500 00000000 00000000 00000000 |................| -40 0843504D 55472020 20434154 01000046 |.CPMUG CAT...F| -50 1C001E00 38003D00 41004300 45000000 |....8.=.A.C.E...| -60 00434F4D 4D414E44 204C4252 01000080 |.COMMAND LBR....| -70 14001600 17001800 19001A00 1B001D00 |................| - -DU3 B1? < - -DU3 B1? ch0-7f e5 - - DU3 B1? d -00 E5E5E5E5 E5E5E5E5 E5E5E5E5 E5E5E5E5 |eeeeeeeeeeeeeeee| -10 E5E5E5E5 E5E5E5E5 E5E5E5E5 E5E5E5E5 |eeeeeeeeeeeeeeee| -20 E5E5E5E5 E5E5E5E5 E5E5E5E5 E5E5E5E5 |eeeeeeeeeeeeeeee| -30 E5E5E5E5 E5E5E5E5 E5E5E5E5 E5E5E5E5 |eeeeeeeeeeeeeeee| -40 E5E5E5E5 E5E5E5E5 E5E5E5E5 E5E5E5E5 |eeeeeeeeeeeeeeee| -50 E5E5E5E5 E5E5E5E5 E5E5E5E5 E5E5E5E5 |eeeeeeeeeeeeeeee| -60 E5E5E5E5 E5E5E5E5 E5E5E5E5 E5E5E5E5 |eeeeeeeeeeeeeeee| -70 E5E5E5E5 E5E5E5E5 E5E5E5E5 E5E5E5E5 |eeeeeeeeeeeeeeee| - -DU3 B1? >,d -00 07535444 20202020 204D5347 00000002 |.STD MSG....| -10 10000000 00000000 00000000 00000000 |................| -20 004C4449 52202020 20432020 00000038 |.LDIR C ...8| -30 13001500 00000000 00000000 00000000 |................| -40 0843504D 55472020 20434154 01000046 |.CPMUG CAT...F| -50 1C001E00 38003D00 41004300 45000000 |....8.=.A.C.E...| -60 00434F4D 4D414E44 204C4252 01000080 |.COMMAND LBR....| -70 14001600 17001800 19001A00 1B001D00 |................| - - -DU3 B1? q -** Queue Status Summary ** -0 Blocks in Queue -249 Blocks Left in Queue -Address of Head of Queue: 3E00 Hex -Address of Tail of Queue: 3E00 Hex - -DU3 B1? <1a> - - Use W to write changes to disk. - - Ranges may be specified: - -CHaddr-addr byte or CAaddr-addr byte - Changes a range of bytes to the same value - - Examples (actual DU3 session): - -DU3 B7? g0 -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 - -DU3 B7? d -00 07535444 20202020 204D5347 00000002 |.STD MSG....| -10 10000000 00000000 00000000 00000000 |................| -20 004C4449 52202020 20432020 00000038 |.LDIR C ...8| -30 13001500 00000000 00000000 00000000 |................| -40 0843504D 55472020 20434154 01000046 |.CPMUG CAT...F| -50 1C001E00 38003D00 41004300 45000000 |....8.=.A.C.E...| -60 00434F4D 4D414E44 204C4252 01000080 |.COMMAND LBR....| -70 14001600 17001800 19001A00 1B001D00 |................| - - -DU3 B7? d0-#f -00 07535444 20202020 204D5347 00000002 |.STD MSG....| - -DU3 B7? h0-#f -00 07535444 20202020 204D5347 00000002 - -DU3 B7? a0-#f -00 |.STD MSG....| - -DU3 B7? fdu2.hlp -20 07445532 20202020 20484C50 01000039 |.DU3 HLP...9| -30 28009800 99009B00 9C009D00 00000000 |(...............| -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 - -DU3 B7? g28 -Group = 0028:00, Track = 125, Sector = 273, Physical Sector = 273 - - -DU3 B7? d -00 496E766F 6B696E67 20445533 20616E64 |Invoking DU3 and| -10 20445533 20496E73 74616C6C 6174696F | DU3 Installatio| -20 6E0D0A44 55332043 6F6D6D61 6E642053 |n..DU3 Command S| -30 756D6D61 72790D0A 436F6D6D 616E6473 |ummary..Commands| -40 20666F72 204C6F67 67696E67 20446973 | for Logging Dis| -50 6B732061 6E642045 78616D69 6E696E67 |ks and Examining| -60 20446973 6B205061 72616D65 74657273 | Disk Parameters| -70 0D0A436F 6D6D616E 64732066 6F722050 |..Commands for P| - -DU3 B7? v -Invoking DU3 and DU3 Installation -DU3 Command Summary -Commands for Logging Disks and Examining Disk Parameters -Commands for P -Group = 0028:00, Track = 125, Sector = 273, Physical Sector = 273 - - -DU3 B7? v3 -Invoking DU3 and DU3 Installation -DU3 Command Summary -Commands for Logging Disks and Examining Disk Parameters -Commands for Positioning and Reading Data -Commands for Searching for Data -Commands for Saving and Restoring Data -Commands for Viewing data -Commands for Altering Data -Commands for Manipulating Macros and the @ Command -Miscellanea -Examples of command use -Interpret -Group = 0028:02, Track = 125, Sector = 275, Physical Sector = 275 - - -DU3 B7? g28 -Group = 0028:00, Track = 125, Sector = 273, Physical Sector = 273 - -DU3 B7? d -00 496E766F 6B696E67 20445533 20616E64 |Invoking DU3 and| -10 20445533 20496E73 74616C6C 6174696F | DU3 Installatio| -20 6E0D0A44 55332043 6F6D6D61 6E642053 |n..DU3 Command S| -30 756D6D61 72790D0A 436F6D6D 616E6473 |ummary..Commands| -40 20666F72 204C6F67 67696E67 20446973 | for Logging Dis| -50 6B732061 6E642045 78616D69 6E696E67 |ks and Examining| -60 20446973 6B205061 72616D65 74657273 | Disk Parameters| -70 0D0A436F 6D6D616E 64732066 6F722050 |..Commands for P| - - -DU3 B7? ch0-10 0 - -DU3 B7? d -00 00000000 00000000 00000000 00000000 |................| -10 00445533 20496E73 74616C6C 6174696F |.DU3 Installatio| -20 6E0D0A44 55332043 6F6D6D61 6E642053 |n..DU3 Command S| -30 756D6D61 72790D0A 436F6D6D 616E6473 |ummary..Commands| -40 20666F72 204C6F67 67696E67 20446973 | for Logging Dis| -50 6B732061 6E642045 78616D69 6E696E67 |ks and Examining| -60 20446973 6B205061 72616D65 74657273 | Disk Parameters| -70 0D0A436F 6D6D616E 64732066 6F722050 |..Commands for P| - -DU3 B7? ca11 This is a test - -DU3 B7? d0-#1f -00 00000000 00000000 00000000 00000000 |................| -10 00546869 73206973 20612074 6573746F |.This is a testo| - -:G - - Macros - - Á Macrï ió á short-hanä thå useò caî emploù tï definå á -commanä  sequence®  Ratheò thaî havinç tï typå aî  involveä -commanä oveò anä oveò again¬  thå DU³ macrï facilitù  allowó -thå  useò tï assigî thió commanä sequencå tï á numbeò (°  tï -9© anä theî executå iô bù simplù presentinç thió numbeò aó á -command®  Thå  followinç commandó arå associateä witè  thió -facility. - - :ntext and n - - ":n¢  defineó thå texô followinç thå digiô 'n§ tï -bå á Macro®  Aó always¬ ° <½ î <½ 9® Thå macrï definitionó -maù  bå  createä  anä redefineä aô will®  Iæ  á  macrï  haó -alreadù  beeî defineä foò thå indicateä number¬  iô wilì  bå -overwritteî bù thå executioî oæ thió command®  "n"¬ wherå ° -<½ î <½ 9¬ executeó thå indicateä macro. - - - :Pn and :PA - - ":Pn"¬  wherå  ° <½ î <½ 9¬  printó thå texô  oæ  Macrï -Numbeò n® ":PA¢ printó thå texô oæ alì 1° macros. - - @ and :P@ - - "@¢  executeó  thå previouó commanä linå thaô  diä  noô -contaiî  thå  "@¢  Command®  Thió provideó aî easù  waù  tï -repeaô thå lasô commanä linå typed® Foò example: - - g0 <-- go to Group 0 - ch0-7f e5,< <-- Initialize the first block and Save - >,w,+ <-- Read in the Saved Block, Write it - out to disk, and advance to next - logical block - @ <-- Do the Previous Command Again - @ <-- And Again - - - ":P@¢  printó thå previouó commanä linå (anä  doeó  noô -changå it). - - Examples (edited DU3 session): - -DU3 B7? g0 -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 - -DU3 B7? :1+,d0-#1f - -DU3 B7? :p1 -Macro Definitions -- -1: +,d0-#1f - -DU3 B7? 1 -Group = 0000:01, Track = 122, Sector = 2, Physical Sector = 2 -00 0754414C 4B202020 2053554D 00000049 |.TALK SUM...I| -10 11002300 24000000 00000000 00000000 |..#.$...........| - - -DU3 B7? 1 -Group = 0000:02, Track = 122, Sector = 3, Physical Sector = 3 -00 07444953 4B4F5554 20434F4E 00000000 |.DISKOUT CON....| -10 00000000 00000000 00000000 00000000 |................| - -DU3 B7? 1 -Group = 0000:03, Track = 122, Sector = 4, Physical Sector = 4 -00 04584449 52202020 20C3CF4D 00000054 |.XDIR COM...T| -10 2C002E00 48000000 00000000 00000000 |,...H...........| - -DU3 B7? g0,d0-#1f -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 -00 07535444 20202020 204D5347 00000002 |.STD MSG....| -10 10000000 00000000 00000000 00000000 |................| - -DU3 B7? 1 -Group = 0000:01, Track = 122, Sector = 2, Physical Sector = 2 -00 0754414C 4B202020 2053554D 00000049 |.TALK SUM...I| -10 11002300 24000000 00000000 00000000 |..#.$...........| - - -DU3 B7? :pa -Macro Definitions -- -0: - -1: +,d0-#1f - -2: - - < Detail Left Out > - -9: - - -DU3 B7? g0,d0-#1f,1,1,1 -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 -00 07535444 20202020 204D5347 00000002 |.STD MSG....| -10 10000000 00000000 00000000 00000000 |................| -Group = 0000:01, Track = 122, Sector = 2, Physical Sector = 2 -00 0754414C 4B202020 2053554D 00000049 |.TALK SUM...I| -10 11002300 24000000 00000000 00000000 |..#.$...........| -Group = 0000:02, Track = 122, Sector = 3, Physical Sector = 3 -00 07444953 4B4F5554 20434F4E 00000000 |.DISKOUT CON....| -10 00000000 00000000 00000000 00000000 |................| -Group = 0000:03, Track = 122, Sector = 4, Physical Sector = 4 -00 04584449 52202020 20C3CF4D 00000054 |.XDIR COM...T| -10 2C002E00 48000000 00000000 00000000 |,...H...........| - - -DU3 B7? @ - -Command -- -g0,d0-#1f,+,d0-#1f,+,d0-#1f,+,d0-#1f -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 -00 07535444 20202020 204D5347 00000002 |.STD MSG....| -10 10000000 00000000 00000000 00000000 |................| -Group = 0000:01, Track = 122, Sector = 2, Physical Sector = 2 -00 0754414C 4B202020 2053554D 00000049 |.TALK SUM...I| -10 11002300 24000000 00000000 00000000 |..#.$...........| -Group = 0000:02, Track = 122, Sector = 3, Physical Sector = 3 -00 07444953 4B4F5554 20434F4E 00000000 |.DISKOUT CON....| -10 00000000 00000000 00000000 00000000 |................| -Group = 0000:03, Track = 122, Sector = 4, Physical Sector = 4 -00 04584449 52202020 20C3CF4D 00000054 |.XDIR COM...T| -10 2C002E00 48000000 00000000 00000000 |,...H...........| - -:H - - ? - - "?¢ giveó á commanä summarù anä telló thå useò whaô thå -currenô  valueó arå foò Processoò Clocë Speeä anä Lineó  peò -Pagå  oî CONº  aó welì aó thå addresó foò thå Grouð  Storagå -Buffeò (wherå thå DU³ Queuå begins). - - - *[nn] - - "*nn¢  repeató thå currenô commanä linå (aó entereä  sï -far© nî times®  Thió commanä defaultó tï "forever¢ iæ nî ió -noô specified® 'nn§ maù bå ² tï 65535. - - - ! - - "!¢   haltó   processinç  oæ   commands¬   displayó   á -continuatioî messagå tï thå user¬  anä waitó foò thå useò tï -typå anù key® Typinç á Control-à abortó commanä processing® -Thió commanä ió usefuì iî stoppinç loopó tï givå thå useò aó -mucè timå aó hå wantó tï revie÷ thå display. - - - P - - "P¢  toggleó thå printeò switcè oî anä off®  Iô allowó -thå  useò  tï turî oî anä ofæ á recordinç  oæ  youò  consolå -output. - - X - - "X¢ exiôs bacë tï ZCPR3. - - - Z[nn] - - "Znn¢ causeó thå prograí tï sleep¬ oò pause¬ anä maù bå -useä tï looë aô á dumð quicklù iî á loopinç commanä line® Ú -ió  ±  sec®  Znî  ió nî secondó oî  aî  î  MHú  8080®  Thå -processoò  speeä  ió specifieä withiî thå ZCPR³  Environmenô -Descriptor. - - - ^C - - "^C" exits to ZCPR3 and Warm Boots. - - Examples (actual DU3 session): - - -DU3 B7? g0 -Group = 0000:00, Track = 122, Sector = 1, Physical Sector = 1 - -DU3 B7? d0-#f,+,!,* -00 07535444 20202020 204D5347 00000002 |.STD MSG....| -Group = 0000:01, Track = 122, Sector = 2, Physical Sector = 2 - -Type Any Character to Continue or ^C to Abort - -00 0754414C 4B202020 2053554D 00000049 |.TALK SUM...I| -Group = 0000:02, Track = 122, Sector = 3, Physical Sector = 3 - -Type Any Character to Continue or ^C to Abort - -00 07444953 4B4F5554 20434F4E 00000000 |.DISKOUT CON....| -Group = 0000:03, Track = 122, Sector = 4, Physical Sector = 4 - -Type Any Character to Continue or ^C to Abort - -00 04584449 52202020 20C3CF4D 00000054 |.XDIR COM...T| -Group = 0000:04, Track = 122, Sector = 5, Physical Sector = 5 - -Type Any Character to Continue or ^C to Abort - - -DU3 B7? g1 -Group = 0001:00, Track = 122, Sector = 33, Physical Sector = 33 - -DU3 B7? d0-#f,+,*3 -00 E5482020 20202020 2042414B 00000004 |eH BAK....| -Group = 0001:01, Track = 122, Sector = 34, Physical Sector = 34 -00 E5535542 32202020 2042414B 0100007B |eSUB2 BAK...{| -Group = 0001:02, Track = 122, Sector = 35, Physical Sector = 35 -00 E5434420 20202020 204D4143 00000047 |eCD MAC...G| -Group = 0001:03, Track = 122, Sector = 36, Physical Sector = 36 - -DU3 B7? ^C -B7> - -:3 - - DU³ containó á built-in¬  screen-orienteä editor® Thió -editoò deriveó itó screen-orienteä functionó froí thå  ZCPR³ -TCAP¬  sï  thå  DU³ Editoò shoulä bå invokeä onlù  oî  ZCPR³ -Systemó  whicè  arå supportinç á valiä TCAÐ foò  thå  user'ó -terminal. - - - E - - Thå  commanä  "E¢  invokeó thå editor®  Iæ  anù  otheò -commandó  follo÷  Å oî thå samå  line¬  theså  commandó  arå -flushed®  Thå  DU³ Editoò ió á completå subsysteí undeò DU³ -iî  itó owî right®  Iô provideó á varietù oæ  user-friendlù -editinç  featureó  foò thå manipulatioî oæ datá  withiî  thå -currenô sectoò (block© aó welì aó allowinç thå useò tï issuå -anù  DU³ commanä linå hå desires¬  returninç tï  thå  editoò -wheî iô ió completed. - - - Thå  DU³  Editoò presentó á screeî displaù tï thå  useò -whicè  ió structureä tï includå á linå showinç thå  contentó -oæ  thå  sectoò aô thå cursor¬  severaì lineó  oæ  hex/ASCIÉ -(similaò  tï thå Ä commanä output© whicè displaù thå  entirå -sector¬ á menõ oæ commands¬ á cursoò (whicè initiallù pointó -tï thå firsô bytå iî á sector)¬ anä á commanä prompt. - - Thå  useò  maù  emploù  thå  WordStaò  cursoò  movemenô -commandó  tï  movå thå cursoò abouô iî thå  currenô  sector® -Theså commandó are: - - ^E = Cursor UP - ^ - ^S = Cursor LEFT <-+-> ^D = Cursor RIGHT - v - ^X = Cursor DOWN - - ^R refreshes the screen display. - - - Thå followinç commandó arå alsï availablå undeò thå DU³ -Editor: - - A = Enter ASCII Text into block starting at cursor - H = Enter Hex/Dec Numbers into block starting at cursor - - + = Advance to Next Logical Sector and Edit - - = Backup to Last Logical Sector and Edit - - ^W = Write the Current Sector to Disk - - C = Issue Any DU3 Command Line - - X = Exit to DU3 - ^C = Exit to ZCPR3 - - - Alì  oæ theså commandó arå self-explanatorù excepô  foò -thå Á anä È commands. - - Thå  Á  commanä ió useä tï enteò ASCIÉ  texô  intï  thå -sectoò startinç aô thå cursoò position® Iî responså tï thió -command¬  thå DU³ Editoò wilì prompô thå useò foò input® Hå -maù  theî  typå  anù  texô hå wisheó  followeä  bù  strikinç -RETURN® Thió texô ió entereä literallù intï thå sector® Iæ -iô overflowó thå enä oæ thå sector¬ iô ió truncated® Iæ thå -useò  wisheó  tï  embeä  hexadecimaì  values¬  likå  0Ä  foò -Carriagå Return¬ hå maù uså thå forí ""® Example: - - this is a test<0D><0A> - - - Thå  È commanä ió useä tï enteò á grouð oæ  hexadecimaì -anä  decimaì valueó intï thå sectoò startinç aô  thå  cursoò -position®  Numberó  separateä bù spaceó arå typeä iî bù thå -user®  Iæ thå useò wisheó tï enteò á valuå iî decimal¬  thå -forí "#nn¢ ió used® Example: - - 1 2 3 3A b7 #25 - - - Thå  Editoò  ió onå oæ thå mosô  powerfuì  capabilitieó -withiî  DU3®   Iô  ió  highlù  recommendeä  thaô  thå  useò -experimenô   witè   iô  anä  becomå  acquainteä   witè   itó -capabilities® - -:4 - Examples - - - Multiple commands may be separated by ",". - - Anù valiä commanä strinç maù bå placeä aó aî operanä oæ -thå originaì DU³ command¬ i.e.: - - A>DU3 G0,D,G2,=OK<1A>,D - - - Exampleº  thå followinç commandó wilì eraså thå   disë -directorù tï alì E5's: - - lb log in b drive - g0 position to dir. - ch0-7f e5 fill with e5 - < save the sector - >,w,+,/16 restore, write, next, - repeat 16 - - This could be shortened to: - - lb,g0,ch0-7f e5,< - >,w,+,/16 - - - Thå followinç twï macroó can bå defined: - - Macro 0 -- - :0g0,ch0-7f e5,< - Macro 1 -- - :1>,w,+,/16 - - Foò  thå  useò tï initializå thå directorù oî Drivå  Aº -anä  theî  oî  Drivå B:¬  thå followinç  commandó  coulä  bå -issued: - - la,0 <-- Log in A and Initialize first block - 1 <-- Perform write - lb,0 <-- Log in B and Initialize first block - 1 <-- Perform write - n,0 <-- Declare New Disk and Initialize first - block - 1 <-- Perform write - -:5 - Interpretation of Directory Data Presented by DU3 - - Thå  followinç explainó thå formaô oæ á CP/Í  directorù -entrù  aó  showî bù DU3¬  usinç eitheò thå  Æ  (Finä  File© -command¬  oò  jusô doinç Ä (Dump© oæ thå directorù sectors¬ -whicè  arå  locateä iî groupó ° anä ± oî  á  singlå  densitù -disk® Samplå resulô oæ "FSID.COM¢ command: - -First 40 00534944 20202020 20434F4D 0000003A |.SID COM...:| -line || ||| | || || | | - || ||^----hex file name-----^ || || ^file name^ - || || || || in ASCII - || || extent-^^ || - || || || - || || file size in sectors-^^ - || || - || ^^-00 = file active - || E5 = file erased - ^^-displacement of line in directory sector - - -Second 50 33343536 3738393A 00000000 00000000 |3456789:........| -line | | - ^---allocation group numbers-------^ - - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/DU3.MAC b/Source/Images/d_bp/u15/DU3.MAC deleted file mode 100644 index d774afcf..00000000 --- a/Source/Images/d_bp/u15/DU3.MAC +++ /dev/null @@ -1,4446 +0,0 @@ -; 03/01/85 Richard Conn: Replaced fixed in EDPLOT that was somehow lost -; (see lines suffixed by -; -; 01/18/85 Modified by Jay Sage to incorporate a set of permanent -; macros. These macros can be invoked by the command tail -; when DU is invoked. They are copied from a space of 128 -; bytes near the beginning of the code. The area is -; identified by a string of text to facilitate patching. -; The macros are listed one after another, separated by -; carriage return characters. Macros that are not to be -; defined must be present as carriage returns alone or the -; program will fail. -; -; PROGRAM: DU3 -; AUTHOR: RICHARD CONN -; DERIVATION: DUTIL is derived from DU Version 7.5 -; DU2 is derived from DUTIL Version 1.1 -; DU3 is derived from DU2 Version 1.1 -; VERSION: 1.0 -; DATE: 20 June 84 -; PREVIOUS VERSIONS: None -; NOTE: DU3 must be assembled using M80 (or equiv) -; -VERS EQU 13 -Z3ENV EQU 0F400H - -; -; DU3 is derived from -- -; DU.ASM V7.5 Revised 1/23/81 -; DISK UTILITY - By Ward Christensen -; -; Principal Authors of DU V7.5 are -- -; WLC KBP RGF BRR -; -; Key comments from DU V7.5 and DU3 follow -- -; -;This version of DU is compatible with CP/M 2.x -;and does not require alteration for various hardware -;configurations. It adjusts itself automatically to -;the correct number of sectors, tracks, directory size, -;etc. It has been tested on 5-1/4" and 8" floppy, and -;10 megabyte hard disk systems. -; -;Because of the automatic adaption feature, no conditional -;assembly options are included. -; -;************************************************* -;* * -;* This program has been heavily modified * -;* to allow it to work without modification * -;* on all versions of CP/M 2.x. * -;* One known possible problem involves the * -;* system tracks on some systems, and results * -;* from the system sectors being skewed. There * -;* is NO way for a program executing under CP/M * -;* to know about this. This program assumes the * -;* standard convention of no skew being used on * -;: the system tracks. This usually isn't a prob- * -;* lem because the SYSGEN program can be used to * -;* get the system from the disk so that it can * -;* be modified. * -;* * -;* Ron Fowler * -;* * -;************************************************* -; - -; -; SYSLIB and Z3LIB References -; - ext z3vinit,envptr,cls,at,tinit,dinit,stndout,stndend,gotoxy - ext getspeed,getcrt,getmdisk,getmuser - ext codend - -; -;System equates -; -BASE EQU 0 ;SET TO 4200H FOR HEATH OR TRS-80 ALTCPM -; -;CP/M Key Areas -; -FCB EQU BASE+5CH ;CP/M FCB -BDOS EQU BASE+5 ;CP/M BDOS ENTRY POINT -TBUFF EQU BASE+80H ;CP/M TEMPORARY DISK I/O BUFFER -TPA EQU BASE+100H ;CP/M TRANSCIENT PROGRAM AREA -; -; Some Key Variables in DU3 -; -EOLCH equ ',' ;Marks logical end of line -SEPCH equ ' ' ;Argument Separator -MULCH equ '*' ;Multiplication Command -DIM equ 1 ;Enter DIM Mode for ILPRT -BRIGHT equ 2 ;Enter BRIGHT Mode for ILPRT - -; -;CP/M BDOS Function Codes -; -PRINT EQU 9 -GVERS EQU 12 -RESETDK EQU 13 ;RESET SYSTEM -SELDK EQU 14 ;SELECT DISK -CLOSEF EQU 16 ;CLOSE FILE -SRCHF EQU 17 ;SEARCH FIRST -SRCHN EQU 18 ;SEARCH NEXT -DELF EQU 19 ;DELETE FILE -WRITEF EQU 21 ;WRITE BLOCK TO FILE -MAKEF EQU 22 ;CREATE FILE -SUSER EQU 32 ;SELECT USER -GETDSK EQU 25 -GETDPB EQU 31 -; -;CP/M 1.4 Offsets and Some Key Values -; -TRNOFF EQU 15 ;CP/M 1.4 OFFSET FROM BASE - ;OF BDOS TO SECTRAN ROUTINE -SKWOFF EQU 1AH ;CP/M 1.4 OFFSET TO SKEW TABLE -S2OFF EQU 14 ;OFFSET INTO FCB FOR S2 BYTE -DPBOFF EQU 3AH ;CP/M 1.4 OFFSET TO DPB WITHIN BDOS -S2MASK EQU 0FH ;MASK FOR EXTENDED RC BITS OF S2 -DPBLEN EQU 15 ;SIZE OF CP/M 2.x DISK PARM BLOCK -; -;Define ASCII characters -; -CR EQU 0DH ;CARRIAGE RETURN -LF EQU 0AH ;LINE FEED -TAB EQU 09H ;TAB -BS EQU 08H ;BACKSPACE - -; -; MACROS INCLUDE: -; -; DJNZ - DECREMENT B AND JUMP RELATIVE IF NO ZERO -; -DJNZ MACRO ?N ;;DECREMENT B AND JUMP ON NO ZERO - DCR B - JNZ ?N - ENDM -; -; END OF MACROS -; - - -; -;Beginning of Program -; -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env - -; -; Space Added for Initial Macro Definitions -- block added by -; - ;label to help locate when patching - - db 'INITIAL MACROS:' - -imac0: db 'G0,D',cr ;macro 0 - db '-D',cr ;macro 1 - db '+D',cr ;macro 2 - db cr ;macro 3 - db cr ;macro 4 - db cr ;macro 5 - db cr ;macro 6 - db cr ;macro 7 - db cr ;macro 8 - db cr ;macro 9 - - ;fill rest of 128 bytes with nulls - - if imac0 + 128 - $ gt 0 - rept imac0 + 128 - $ - db 0 - endm - endif - -; End of Block Added by - -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3vinit ;initialize the ZCPR3 Env and the VLIB Env - call tinit ;init terminal - LXI H,0 ;GET PTR TO CP/M STACK - DAD SP ;HL=SP - SHLD DUTSTK ;SAVE IT -; - call codend ;get free space - lxi d,100h ;open area - dad d ;large stack area - shld savbuf - dad d ;100H for SAVBUF - push h ;save ptr - mvi m,126 ;allow 126-char input line - inx h - inx h ;ptr to INBUF - shld inbuf - pop h ;pt to beginning - lxi d,400h ;large area for expansion - dad d - shld pinbuf ;ptr to PINBUF - dad d - shld ctemp ;ptr to CTEMP - dad d - shld ctempx ;ptr to CTEMPX - shld mtabl ;ptr to MACRO TABLE - lxi d,100h*10 ;10 macros - dad d - shld gbuff ;group save buffer - shld direct ;directory load buffer -; - lhld savbuf ;top of stack - sphl ; SET STACK -; - call getspeed - sta clock ;set clock speed - call getcrt ;get CRT data - inx h ;pt to screen size - mov a,m ;get it - sta pagsiz ;set page size - call getmdisk ;get max disk - sta mdisk ;and set it - call getmuser ;get max user - sta muser ;and set it -; -;Set up local jumps to BIOS -; -START1: - LHLD BASE+1 ;WARM BOOT POINTER - LXI D,3 ;READY FOR ADD - DAD D - SHLD VCONST+1 ;CON: Status - DAD D - SHLD VCONIN+1 ;CON: Input - DAD D - SHLD VCONOT+1 ;CON: Output - DAD D - SHLD VLIST+1 ;LST: Output - DAD D ;Skip PUNCH - DAD D ;Skip RDR - DAD D - SHLD VHOME+1 ;Home Disk - DAD D - SHLD VSELDK+1 ;Select Disk - DAD D - SHLD VSETRK+1 ;Set Track - DAD D - SHLD VSTSEC+1 ;Set Sector - DAD D - SHLD SETDMA+1 ;Set DMA Address - DAD D - SHLD VREAD+1 ;Read Block From Disk - DAD D - SHLD VWRITE+1 ;Write Block To Disk - DAD D ;Skip LISTST - DAD D - SHLD VSCTRN+1 ;CP/M 2.x Sector Translation Table -; JMP HELLO -; -;Initialization Complete -- Print Signon Message and Begin Command Processing -; -HELLO: - CALL GETSTP ;SET UP CP/M PARAMETERS - CALL INITP ;INITIALIZE BUFFER PARAMETERS - CALL ILPRT - DB 'DU3 - Disk Utility III, Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0' - DB CR,LF,CR,LF - DB DIM,'Type ? for Help',BRIGHT - DB CR,LF,0 -; -;Clear Editor Reference -; - XRA A - STA EDRUN ;EDITOR NOT RUNNING -; -;Save initial command line in INBUF -; - LXI H,TBUFF ;PT TO COMMAND LINE BUFFER - MOV A,M ;GET CHAR COUNTER - ora a ;check for no tail - jnz ctail ;if not, no need to increment - inr a ;allow for blank otherwise present -ctail: ; - INX H ;PT TO FIRST CHAR - ADD L ;COMPUTE LOCATION OF AFTER LAST CHAR - MOV L,A - MOV A,H - ACI 0 - MOV H,A - MVI M,CR ;SET ENDING CR - LHLD INBUF ;PT TO BUFFER - XCHG ;... IN DE - LXI H,TBUFF+2 ;PT TO INPUT LINE (1 changed to 2 ) - MVI B,128 ;COPY BUFFER - CALL MOVE -; -;Establish Initial Position -; - LXI D,0 ;GROUP 0 - CALL DEGROUP ;POSITION TO GROUP - CALL INQSUB ;PRINT POSITION -; -;Check for initial command -; - LHLD INBUF ;INPUT BUFFER - MOV A,M - CPI CR - JZ PRMPTR ;NO INITIAL COMMAND FROM COMMAND LINE - INX H ;PT TO FIRST CHAR -; -;Got initial command, set it up -; - MOV A,M ;GET FIRST CHAR - CPI '/' ;IF SLASH, PRINT INITIAL HELP (TOOLSET CONVENTION) - JZ IHELP ;PRINT INITIAL HELP INFO - XRA A - STA IHFLG ;SET NO INITIAL HELP -; line replaced -; JMP PRMPTI ;PROCESS AS THOUGH COMMAND LINE WAS TYPED - jmp prmpts ;allow processing of macros in command line -; -;Input Command Line From User at Console -; -PRMPTR: - XRA A ;A=0 - STA IHFLG ;Set No Initial Help - LDA EDRUN ;Check for Editor Running - ORA A - JNZ EDIT0 ;Reenter Editor - CALL SINBUF ;Save old INBUF into PINBUF -PRMPTE: - CALL RDBUF ;Read Input Line -PRMPTS: ;Entry when Command Line has Input - CALL EXMAC ;Expand Macros -; -;Begin Processing Command Line in INBUF -; At this point, HL points to next character to process -; -PRMPTI: - MVI A,0FFH ;SET INFINITE LOOP COUNT - STA TOGO ;LOOP COUNT FOR MULTIPLE LOOPS - STA TOGO+1 -; -;Minor Command Loop; This is the entry point for each individual command in -; a Command Line; Commands may be separated by semicolons in this manner -; -PROMPT EQU $ -SETSTK: - SHLD STKSAV ;SAVE HL FOR STACK LOAD - LHLD SAVBUF ;RESET STACK - SPHL - LHLD STKSAV ;RESTORE HL - XRA A ;ZERO 2-UP PRINT FOR DUAL-COLUMN PRINT - STA TWOUP ;..SWITCH - MVI A,1 - STA FTSW ;TELL SEARCH NOT TO INCR - PUSH H - LXI H,TBUFF ;SET NO-READ INPUT BUFFER ADDRESS - SHLD BUFAD ;FOR RDBYTE - POP H - CALL CTLCS ;ABORT? - JZ PRMPTR ;..YES, READ BUFFER -; -;Do we have to position in directory after find? -; - LDA FINDFL - ORA A - JNZ POSDIR ;POSITION IN DIRECTORY -; -;Begin Command Evaluation -- Check for EOL and Capitalize -; - MOV A,M ;GET NEXT CHAR IN COMMAND LINE - INX H ;POINT TO FOLLOWING CHAR - CPI CR ;END OF LINE PHYSICALLY? - JZ PRMPTR ;INPUT NEW COMMAND LINE IF SO - CPI EOLCH ;END OF LINE LOGICALLY? - JZ PROMPT ;PROCESS NEXT ELEMENT IF SO - CALL UPCASE ;CAPITALIZE COMMAND - STA DUMTYP ;TYPE OF DUMP (A,D,H) - LXI D,CMDTBL ;PT TO COMMAND TABLE - CALL CMD ;PROCESS - JMP WHAT ;ERROR RETURN -; -;Command dispatcher -; If command not found, abort with error message -; If command file, process command with HL pting to next command char and -; A containing command letter -; -CMD: - PUSH H ;SAVE HL - MOV B,A ;COMMAND IN B - XCHG ;HL PTS TO COMMAND TABLE -CMDLP: - MOV A,M ;GET COMMAND - ORA A ;0=END OF TABLE - JZ CMDER - CMP B ;COMPARE COMMAND - JZ CMDGO - INX H ;PT TO ADR - INX H - INX H ;PT TO NEXT CMND - JMP CMDLP -CMDGO: - INX H ;PT TO ADDRESS LOW - MOV E,M - INX H ;PT TO ADDRESS HIGH - MOV D,M - POP H ;RESTORE HL - POP PSW ;CLEAR RETURN ADDRESS - MOV A,B ;COMMAND BACK INTO A - PUSH D ;PLACE ADDRESS ON STACK - RET ;"RUN COMMAND" -CMDER: - POP H ;RESTORE HL - MOV A,B ;RESTORE COMMAND CHAR IN CASE CMD RUN - RET ;... IMMEDIATELY AGAIN ON A NEW TABLE -; -;Macro Expansion Routine -- Expand Macros -; -EXMAC: - LHLD CTEMP ;BUILD INTO TEMPORARY BUFFER - XCHG - LHLD INBUF ;PT TO INPUT LINE -EXMAC1: - MOV A,M ;GET CHAR - CPI '0' ;SKIP IF LESS THAN '0' - JC EXMAC2 - CPI '9'+1 ;CHECK FOR RANGE - JNC EXMAC2 - INX H ;PT TO NEXT CHAR - PUSH H ;SAVE PTR TO NEXT CHAR IN LINE - SUI '0' ;CONVERT TO BINARY (0-9) - MOV B,A ;RESULT IN B - MVI C,0 - LHLD MTABL ;PT TO BASE OF MACROS - DAD B ;PT TO MACRO - CALL COPYM ;COPY MACRO INTO LINE - DCX D ;BACK UP OVER - POP H ;GET PTR TO NEXT CHAR IN COMMAND LINE -EXMAC2: - MOV A,M ;GET CHAR - STAX D ;PUT CHAR - INX H ;PT TO NEXT - INX D - CALL MTEST ;TEST FOR END OF BUFFER - CPI CR ;DONE? - JZ EXMAC3 - CPI EOLCH ;LOGICAL EOL? - JNZ EXMAC2 - JMP EXMAC1 ;PROCESS NEXT COMMAND -EXMAC3: - LHLD CTEMP ;COPY COMMAND LINE BACK - XCHG - LHLD INBUF ;INTO INBUF - XCHG - CALL COPYCR ;COPY TO - LHLD INBUF ;PT TO INBUF - RET ;EXPANSION COMPLETE -; -;Copy Macro Into Command Line Buffer -; -COPYM: - MOV A,M ;GET CHAR - STAX D ;PUT CHAR - INX H ;PT TO NEXT - INX D - CALL MTEST ;CHECK FOR LIMIT - CPI CR ;END OF MACRO? - JNZ COPYM - RET -; -;Test for Buffer Full -; -MTEST: - PUSH H ;SAVE HL - PUSH PSW ;SAVE A - LHLD CTEMPX ;CHECK FOR END OF BUFFER - MOV A,H ;GET PAGE - CMP D ;CHECK PAGE - JZ MACERR - POP PSW ;GET A - POP H ;GET HL - RET -; -;Macro Command Expansion Error -; -MACERR: - CALL ILPRT - DB CR,LF,'Error -- Macro Expanded Command Line too Long',0 - JMP PRMPTR ;NEW COMMAND -; -;Save INBUF into PINBUF for later processing by '@' command -; -SINBUF: - LHLD PINBUF ;PT TO PINBUF (PREVIOUS INBUF) - XCHG - LHLD INBUF ;PT TO INBUF -; -;Copy (HL) to (DE) until Encountered -; -COPYCR: - MOV A,M ;GET CHAR - STAX D ;PUT CHAR - INX H ;PT TO NEXT - INX D - CPI CR ;DONE? - JNZ COPYCR - RET - -; -;Command Not Found Error -; -WHAT: - POP H ; RESTORE HL - CALL ILPRT - DB DIM,'Invalid Command at or after ',BRIGHT,0 - MOV A,B ;GET COMMAND LETTER - CALL TYPE ;PRINT IT - JMP PRMPTR -; -;Memory full error -; -MEMFUL: - CALL ILPRT - DB '+++ Out of memory +++' - DB CR,LF,0 - JMP PRMPTR -; -;COMMAND: E -;Edit Current Block -; -EROW EQU 6 ;FIRST ROW OF EDITOR DISPLAY -ECOL EQU 4 ;FIRST COL OF EDITOR DISPLAY -ECOLC EQU ECOL+16*3+2 ;FIRST COL OF EDITOR CHAR DISPLAY -ECURS EQU '>' ;EDITOR CURSOR -; -EDIT: - CALL SINBUF ;SAVE COMMAND LINE AS PREVIOUS - MVI A,0FFH - STA EDRUN ;EDITOR IS RUNNING -; -; SET UP ARROW KEYS -; - LHLD ENVPTR ;PT TO ENVIRONMENT DESCRIPTOR - LXI D,80H+10H ;PT TO ARROW KEY INFO - DAD D - LXI D,EDCURT ;PT TO CURSOR TABLE - MVI B,4 ;4 ARROW KEYS -EDITA: - MOV A,M ;GET CHAR - STAX D ;STORE CHAR - INX H ;PT TO NEXT - INX D ;PT TO NEXT ENTRY - INX D - INX D - DJNZ EDITA ;COUNT DOWN -; -; REENTER EDIT WITH PTRS RESET -; REFRESH EDIT SCREEN -; -EDIT0: - CALL CLS ;NEW SCREEN - CALL AT - DB 2,32 ;ROW 2, COL 32 - CALL ILPRT ;BANNER - DB 'DU3 Block Editor',0 - MVI H,EROW+9 ;POSITION FOR COMMAND DISPLAY - MVI L,1 - CALL GOTOXY ;POSITION CURSOR - CALL ILPRT ;PRINT COMMAND SUMMARY - DB ' -- Movement --' - DB ' -------------- Operation ---------------',CR,LF - DB ' ^E ' - DB DIM,'Enter: ',BRIGHT,'A',DIM,' ASCII Chars',BRIGHT - DB ' +',DIM,' Next Sector',BRIGHT,CR,LF - DB ' ^ ' - DB DIM,' ',BRIGHT,'H',DIM,' Hex Numbers',BRIGHT - DB ' -',DIM,' Last Sector',BRIGHT,CR,LF - DB ' ^S <-+-> ^D ' - DB ' ' - DB ' ^C',DIM,' Exit DU3 ',BRIGHT - DB CR,LF - DB ' v ' - DB 'C',DIM,' DU3 Command Line ',BRIGHT - DB ' ^R',DIM,' Rescreen ',BRIGHT,CR,LF - DB ' ^X ' - DB 'X',DIM,' Exit Editor to DU3',BRIGHT - DB ' ^W',DIM,' Write Block',BRIGHT - DB 0 - CALL AT - DB 2,65 - CALL ILPRT - DB DIM,'Position:',BRIGHT,0 -; JMP EDITCMD -; -; REFRESH SCREEN DISPLAY DATA ONLY -; -EDITR: - XRA A ;A=0 - STA EINDEX ;SET INDEX TO 0 (FIRST ELEMENT) - STA EDERR ;SET NO PREVIOUS ERROR - CALL AT ;POSITION CURSOR - DB EROW-2,ECOL - CALL INQSUB ;PRINT POSITION DATA - CALL EDPLOT ;PLOT BUFFER DATA -; -; INPUT EDITOR COMMAND -; -EDITCMD: - CALL EDERCL ;CLEAR EDITOR INVALID COMMAND MESSAGE -EDITCMD1: - CALL AT ;POSITION FOR COMMAND LINE - DB 22,10 - CALL ILPRT - DB DIM,'Edit Command? ',BRIGHT,BS,0 - CALL CONIN ;GET CHAR - CALL UPCASE ;CAPITALIZE - MOV B,A ;COMMAND IN B - LXI D,EDCURT ;PROCESS CURSOR COMMANDS FIRST - CALL CMD ;PROCESS COMMAND - LXI D,ECMDTBL ;EDITOR COMMAND TABLE - CALL CMD ;PROCESS COMMAND - MVI A,0FFH ;SET ERROR FLAG - STA EDERR - CALL AT ;CLEAR ERROR MESSAGE - DB 23,15 - CALL ILPRT - DB 'Invalid Command',0 - JMP EDITCMD1 -; -;Clear Editor Invalid Command Message -; -EDERCL: - LDA EDERR ;PREVIOUS ERROR? - ORA A ;0=NO - RZ - XRA A ;CLEAR FLAG - STA EDERR - CALL AT ;CLEAR ERROR MESSAGE - DB 23,15 - CALL ILPRT - DB ' ',0 - RET -; -;PLOT BUFFER DATA -; -EDPLOT: - MVI H,EROW ;SET ROW - MVI L,ECOL-1 ;SET COLUMN - CALL GOTOXY ;POSITION CURSOR - XCHG ;POSITION IN DE - LXI H,TBUFF ;PT TO DATA - MVI B,8 ;8 LINES -EDIT00: - MVI C,16 ;16 ELEMENTS - CALL SPACE ;PRINT LEADING SPACE -EDIT01: - MOV A,M ;GET BYTE - CALL HEX ;PRINT AS HEX - CALL SPACE ;PRINT 1 SPACE - INX H ;PT TO NEXT - DCR C ;COUNT DOWN - JNZ EDIT01 - XCHG ;POSITION AGAIN - INR H ;NEXT ROW - CALL GOTOXY - XCHG - DCR B ;COUNT DOWN - JNZ EDIT00 - MVI H,EROW ;RESET ROW - MVI L,ECOLC ;RESET COL - CALL GOTOXY ;POSITION CURSOR - XCHG ;POSITION IN DE - LXI H,TBUFF ;PT TO DATA - MVI B,8 ;8 LINES -EDIT02: - CALL ASTER ;PRINT BAR - MVI C,16 ;16 ELEMENTS -EDIT03: - MOV A,M ;GET BYTE - ANI 7FH ;MASK MSB - CPI 7FH ;7FH IS DOT - JZ EDIT7F - CPI ' ' ;SPACE OR MORE? - JNC EDIT04 -EDIT7F: - MVI A,'.' ;PRINT DOT -EDIT04: - CALL TYPE ;PRINT BYTE - INX H ;PT TO NEXT - DCR C ;COUNT DOWN - JNZ EDIT03 - CALL ASTER ;PRINT ENDING BAR - XCHG ;POSITION AGAIN - INR H ;NEXT ROW - CALL GOTOXY - XCHG - DCR B ;COUNT DOWN - JNZ EDIT02 - CALL EDCUR ;POSITION CURSOR - RET -; -;EDITOR COMMAND TABLE -; -ECMDTBL: - DB CR ;NOP - DW EDITCMD - DB 'C'-'@' ;^C = EXIT DU3 - DW EDCC - DB 'R'-'@' ;^R = REFRESH - DW EDIT0 - DB 'E'-'@' ;^E=UP - DW EDUP - DB 'X'-'@' ;^X=DOWN - DW EDDOWN - DB 'D'-'@' ;^D=RIGHT - DW EDRIGHT - DB 'S'-'@' ;^S=LEFT - DW EDLEFT - DB 'W'-'@' ;WRITE BLOCK - DW EDITWR - DB ' ' ;NOP - DW EDITCMD - DB '+' ;ADVANCE - DW EDITPLUS - DB '-' ;BACKUP - DW EDITMINUS - DB 'A' ;CHANGE ALPHA - DW EDITALP - DB 'C' ;COMMAND LINE - DW EDITCL - DB 'H' ;CHANGE HEX - DW EDITHEX - DB 'X' ;EXIT - DW EDITX - DB 0 ;END OF TABLE -; -; ARROW KEY DEFINITONS FROM TCAP -; -EDCURT: - DB 0 ;0 INDICATES NO ARROW KEYS - DW EDUP - DB 0 - DW EDDOWN - DB 0 - DW EDRIGHT - DB 0 - DW EDLEFT - DB 0 ;END OF TABLE -; -;EDITOR BUFFERS -; -EINDEX: - DS 1 ;INDEX ENTRY -EDERR: - DS 1 ;ERROR FLAG -EDRUN: - DS 1 ;FLAG SAYING THAT EDITOR IS RUNNING -; -;Write Block to Disk -; -EDITWR: - CALL EDERCL ;CLEAR ERROR LINE - CALL WRITE ;WRITE BLOCK - CALL AT - DB 23,15 ;MESSAGE - CALL ILPRT - DB 'Block Written',0 - MVI A,0FFH ;SET ERROR - STA EDERR - JMP EDITCMD1 -; -;Enter ASCII Chars -; -EDITALP: - CALL EDERCL ;CLEAR ERROR LINE - CALL AT - DB 22,35 - CALL ILPRT - DB DIM,'Enter Text ( for Hex)',BRIGHT - DB CR,LF,' --> ',0 - CALL RDBUF1 ;INPUT TEXT WITHOUT PROMPT - CALL EDPRCL ;CLEAR PROMPT LINE - LDA EINDEX ;PT TO POSITION - LXI D,TBUFF ;COMPUTE OFFSET - ADD E - MOV E,A - MOV A,D - ACI 0 - MOV D,A ;DE PTS TO BYTE, HL PTS TO TEXT -EDITA1: - MOV A,M ;GET CHAR - CPI CR ;EOL? - JZ EDITA2 ;REFRESH SCREEN - CALL GETVAL ;GET ASCII OR VALUE - STAX D ;UPDATE BYTE - INX H ;PT TO NEXT INPUT CHAR - INR E ;PT TO NEXT BUFFER BYTE - JNZ EDITA1 -EDITA2: - CALL EDPLOT ;REPLOT - JMP EDITCMD1 ;DONE-REFRESH SCREEN -; -;Enter Numbers -; -EDITHEX: - CALL EDERCL ;CLEAR ERROR LINE - CALL AT - DB 22,35 - CALL ILPRT - DB DIM,'Enter Hex Numbers (#nn for Dec)' - DB BRIGHT - DB CR,LF,' --> ',0 - CALL RDBUF1 ;INPUT TEXT WITHOUT PROMPT - CALL EDPRCL ;CLEAR PROMPT LINE - LDA EINDEX ;PT TO POSITION - LXI D,TBUFF ;COMPUTE OFFSET - ADD E - MOV E,A - MOV A,D - ACI 0 - MOV D,A ;DE PTS TO BYTE, HL PTS TO TEXT -EDITH1: - MOV A,M ;GET HEX DIGIT - CPI CR ;EOL? - JZ EDITA2 ;REFRESH SCREEN - CPI ' ' ;SKIP SPACES - JNZ EDITH2 - INX H ;SKIP SPACE - JMP EDITH1 -EDITH2: - PUSH D ;SAVE PTR - CALL HEXIN ;GET VALUE AND POSITION HL - MOV A,E ;... IN A - POP D ;GET PTR - STAX D ;PUT BYTE - INR E ;ADVANCE TO NEXT BYTE - JNZ EDITH1 - JMP EDITA2 ;DONE-REFRESH -; -;CLEAR PROMPT LINE -; -EDPRCL: - CALL AT ;PROMPT LINE - DB 22,35 - MVI B,40 ;40 POSITIONS - CALL EDPCL - CALL AT ;USER INPUT - DB 23,1 - MVI B,79 ;79 POSITIONS -EDPCL: - CALL SPACE ;CLEAR PROMPT LINE WITH SPACES - DCR B - JNZ EDPCL - RET -; -;Enter Command Line from Editor -; -EDITCL: - CALL EDERCL ;CLEAR ERROR LINE - CALL CRLF ;NEW LINE - JMP PRMPTE ;GET COMMAND LINE FROM USER -; -;Advance to Next Block -; -EDITPLUS: - CALL NXTSEC ;ADVANCE SECTORS -EDITP1: - PUSH H - LHLD CURSEC - XCHG - CALL SETSEC ;SET SECTOR - LHLD CURTRK - XCHG - CALL SETTRK ;SET TRACK - POP H - CALL READ ;READ IN BLOCK - CALL CLCSUB ;CALCULATE GROUP DATA - JMP EDITR ;REFRESH DATA -; -;Backup to Last Block -; -EDITMINUS: - CALL LSTSEC ;BACKUP BLOCK - JMP EDITP1 -; -;Exit EDIT Mode -; -EDITX: - XRA A - STA EDRUN ;EDITOR IS NOT RUNNING NOW - CALL EDERCL ;CLEAR ERROR LINE - JMP PRMPTR -; -;Exit DU3 -; -EDCC: - CALL EDERCL ;CLEAR ERROR LINE - JMP EXIT -; -;EDIT MOVE: UP -; -EDUP: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;BACKUP INDEX BY 16 - SUI 16 -; -;Common EDIT MOVE Routine - on input, A=new index -; -EDMOVE: - ANI 7FH ;MOD 128 - STA EINDEX - CALL EDCUR ;SET CURSOR - JMP EDITCMD -; -;EDIT MOVE: DOWN -; -EDDOWN: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;INCREMENT INDEX BY 16 - ADI 16 - JMP EDMOVE ;COMMON ROUTINE -; -;EDIT MOVE: RIGHT -; -EDRIGHT: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;INCREMENT INDEX BY 1 - INR A - JMP EDMOVE ;COMMON ROUTINE -; -;EDIT MOVE: LEFT -; -EDLEFT: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;DECREMENT INDEX BY 1 - DCR A - JMP EDMOVE ;COMMON ROUTINE -; -;EDIT SUBROUTINE: EDCUR -; Position Editor Cursor at EINDEX -;EDIT SUBROUTINE: EDCCUR -; Clear Editor Cursor at EINDEX -; -EDCUR: - PUSH H ;SAVE HL - MVI C,ECURS ;CURSOR CHAR - CALL EDSETCUR - CALL AT ;UPDATE DATA - DB 2,75 - LDA EINDEX ;PT TO BYTE AT CURSOR - LXI H,TBUFF - ADD L - MOV L,A - MOV A,H - ACI 0 - MOV H,A ;HL PTS TO BYTE AT CURSOR - MOV A,M ;GET BYTE - CALL HEX ;PRINT AS HEX - CALL SPACE - MOV A,M ;GET BYTE - POP H ;RESTORE HL - ANI 7FH ;MASK - CPI 7FH ;7FH IS DOT - JZ EDC7F - CPI ' ' ;OUTPUT CHAR OR DOT - JNC TYPE -EDC7F: - MVI A,'.' ;DOT - JMP TYPE -EDCCUR: - MVI C,' ' ;CLEAR CURSOR -EDSETCUR: - CALL EDROW ;COMPUTE ROW - ANI 0FH ;COMPUTE COL MOD 16 - MOV B,A ;RESULT IN B - ADD A ;*2 - ADD B ;*3 - ADI ECOL ;ADD IN COL - DCR A ;SUBTRACT 1 - MOV L,A ;COL POSITION SET - CALL GOTOXY ;POSITION CURSOR - MOV A,C ;OUTPUT CHAR - JMP TYPE -; -;Compute Row from EINDEX -; -EDROW: - LDA EINDEX ;GET INDEX - MOV B,A ;SAVE IN B - RRC ;DIVIDE BY 16 - RRC - RRC - RRC - ANI 0FH ;MASK FOR LSB ONLY - ADI EROW ;COMPUTE ROW - MOV H,A ;ROW SET - MOV A,B ;GET INDEX - RET -; -;COMMAND: @ -;Repeat Previous Command Line -; -PCMD: - MOV A,M ;GET NEXT CHAR - CPI CR ;SHOULD BE - JZ PCMD1 - CALL ILPRT - DB CR,LF,'Warning: Remainder of Command Line after "@" Deleted',0 -PCMD1: - CALL ILPRT - DB CR,LF,DIM,'Command --',BRIGHT,CR,LF,0 - LHLD INBUF ;COPY INTO INBUF - XCHG - LHLD PINBUF ;GET PREVIOUS COMMAND -PCMD2: - MOV A,M ;GET CHAR - STAX D ;PUT CHAR - INX H ;PT TO NEXT - INX D - CPI CR ;END OF LINE? - PUSH PSW ;SAVE FLAG - CALL TYPE ;PRINT CHAR - POP PSW ;GET FLAG - JNZ PCMD2 - MVI A,LF ; - CALL TYPE - LHLD INBUF ;RESTART COMMAND PROCESSING - JMP PRMPTI ;INCLUDE LOOP CAPABILITY -; -;COMMAND: : -;Define or Print Macro -;:n Defines Macro n, 0<=n<=9; ::n Prints Macro n, 0<=n<=9 -; -MAC: - MOV A,M ;GET NEXT CHAR - CALL UPCASE ;CAPITALIZE - CPI 'P' ;PRINT MACRO? - JNZ MACROD ;IF NOT, DEFINE MACRO - INX H ;PT TO MACRO NUMBER - MOV A,M ;GET IT - CALL UPCASE ;CAPITALIZE - CPI '@' ;PRINT PREVIOUS COMMAND? - JZ PCPR - PUSH PSW ;SAVE A - call cls - cz crlf - CALL ILPRT - DB DIM,'Macro Definitions --',BRIGHT,0 - POP PSW ;GET A - CPI 'A' ;PRINT ALL MACROS? - JZ AMACPR - CALL MNUM ;CHECK FOR VALID NUMBER AND RETURN # IN D - INX H ;PT TO CHAR AFTER MACRO NUMBER - CALL MACPR ;PRINT MACRO WHOSE NUMBER IS IN D - JMP PROMPT -; -;Print Previous Command -; -PCPR: - INX H ;PT TO CHAR AFTER '@' - LXI D,PROMPT ;SET UP RET ADR - PUSH D ;RETURN ADR ON STACK - PUSH H ;SAVE PTR - CALL ILPRT - DB DIM,'Previous Command Line Definition --',BRIGHT - DB CR,LF,'@: ',0 - LHLD PINBUF ;PT TO PREVIOUS COMMAND - JMP MPRINT ;USE MACRO PRINT FACILITY -; -;Print All Macros -; -AMACPR: - INX H ;PT TO CHAR AFTER 'A' - MVI D,0 ;SET FOR FIRST MACRO -AMPRL: - CALL MACPR ;PRINT MACRO WHOSE NUMBER IS IN D - INR D ;INCREMENT MACRO NUMBER - MOV A,D ;GET VALUE - CPI 10 ;DONE? - JNZ AMPRL - JMP PROMPT ;CONTINUE PROCESSING -; -;Print Macro Whose Number (0-9) is in D -; -MACPR: - PUSH H ;SAVE PTR - CALL ILPRT ;PRINT HEADER - DB CR,LF,DIM,0 - MOV A,D ;GET NUMBER - ADI '0' ;CONVERT TO ASCII - CALL TYPE ;PRINT - CALL ILPRT - DB ': ',BRIGHT,0 - LHLD MTABL ;PT TO TABLE OF MACROS - MVI E,0 ;PAGE OFFSET OF ZERO; MACRO NUMBER ALREADY IN D - DAD D ;PT TO MACRO -MPRINT: - MOV A,M ;GET CHAR - INX H ;PT TO NEXT - CPI CR ;END OF MACRO? - PUSH PSW ;SAVE FLAG - CALL TYPE ;PRINT CHAR - POP PSW ;GET FLAG - JNZ MPRINT - MVI A,LF ; - CALL TYPE - POP H ;GET PTR TO NEXT CHAR - RET -; -;Check char in A for valid Macro Number (0-9), print error message if -; not, return number in D if so -; -MNUM: - SUI '0' ;CONVERT TO 0-9 - JC MNERR ;ERROR IF LESS - CPI 10 ;RANGE? - JNC MNERR - MOV D,A ;RESULT IN D - RET -MNERR: - CALL ILPRT - DB CR,LF,'Invalid Macro Number Specified in Command',0 - JMP PRMPTR ;NEW COMMAND -; -;Define Macro -; -MACROD: - CALL MNUM ;CHECK NUMBER AND RETURN IN D - INX H ;PT TO CHAR AFTER MACRO NUMBER - PUSH H ;SAVE PTR - LHLD MTABL ;PT TO MACRO TABLE - MVI E,0 ;SET EVEN PAGE - DAD D ;PT TO MACRO ENTRY IN HL - XCHG ;... IN DE - POP H ;PT TO MACRO TEXT - CALL COPYCR ;COPY TO - JMP PRMPTR ;NEW COMMAND -; -;COMMAND: ! -;Delay for user input -; -UWAIT: - CALL WAIT ; USE WAIT ROUTINE - JMP PROMPT -; -;COMMAND: # -;Print disk statistics -; -STATS: - PUSH H ;SAVE POINTER TO NEXT COMMAND - call cls - cz crlf - CALL ILPRT - DB DIM - DB ' -- Queue Information --',BRIGHT,CR,LF - DB CR,LF - DB 0 - CALL QSTATS ;PRINT STATUS INFO - CALL ILPRT - DB CR,LF - DB DIM - DB ' -- Disk Information --',BRIGHT,CR,LF - DB CR,LF - DB DIM,'Disk Drive: ',BRIGHT,0 - LDA DRIVE - ADI 'A' ;CONVERT TO ASCII - CALL TYPE ;PRINT DRIVE LETTER - CALL ILPRT - DB CR,LF,DIM,'Tracks: ',BRIGHT,0 - LHLD MAXTRK ;PRINT NUMBER OF TRACKS - INX H - CALL DEC - CALL ILPRT - DB CR,LF,DIM,'Sectors/Track: ',BRIGHT,0 - LHLD SPT ;PRINT NUMBER OF SECTORS/TRACK - CALL DEC - CALL ILPRT - DB CR,LF,DIM,'Group Size: ',BRIGHT,0 - LDA BLM ;PRINT SIZE OF A GROUP - INR A - MOV L,A - MVI H,0 - CALL DEC - CALL ILPRT - DB DIM,' Blocks/Group',BRIGHT - DB CR,LF,DIM,'Total Groups: ',BRIGHT,0 - LHLD DSM ;PRINT TOTAL NUMBER OF GROUPS ON A DISK - CALL DEC - CALL ILPRT - DB CR,LF,DIM,'Directory Entries: ',BRIGHT,0 - LHLD DRM ;PRINT NUMBER OF DIRECTORY ENTRIES - INX H - CALL DEC - CALL ILPRT - DB CR,LF,DIM,'System Tracks: ',BRIGHT,0 - LHLD SYSTRK ;PRINT NUMBER OF SYSTEM TRACKS - CALL DEC - CALL SWAIT - POP H ;RESTORE POINTER TO NEXT COMMAND - JMP PROMPT -; -;COMMAND: N -;The following command resets the disk -;system thru CP/M, and may be usable for -;changing the disk density or format. -;This can only be done if your BIOS resets -;the auto-density select parameters at -;every track-zero access. -; -NEWDSK: - PUSH H ;SAVE POINTER TO NEXT LETTER - MVI C,RESETDK ;BDOS RESET DISK FUNCTION - CALL BDOS - LDA DRIVE ;RESELECT CURRENT DRIVE - MOV C,A - POP H - CALL SELECT - JMP PROMPT -; -;COMMAND: Q -;Queue Control -; -QUEUER: - MOV A,M ;GET 2ND ARGUMENT - CALL UPCASE ;CAPITALIZE - CPI EOLCH ;END OF LINE? - JZ QSTAT ;STATUS REPORT - CPI CR ;END OF LINE? - JZ QSTAT - INX H ;PT TO AFTER KEY CHAR - PUSH H ;SAVE PTR - CPI 'Z' ;ZERO QUEUE? - JZ QZERO - CPI 'S' ;SAVE QUEUE? - JZ QFSAVE - POP H ;GET PTR - CALL ILPRT - DB 'Invalid Queue Command',CR,LF,0 - JMP PRMPTR ;ABORT LINE ON ERROR -; -; Zero the Queue -; -QZERO: - LHLD DIRECT ;ZERO QUEUE - SHLD QNXT ;SET NEXT - SHLD QLST ;SET LAST - LXI H,0 ;ZERO COUNT - SHLD QCNT - POP H ;GET PTR AND FALL THRU TO QSTAT -; -; Print Status of Queue -; -QSTAT: - PUSH H ;SAVE PTR TO NEXT CHAR - call cls - cz crlf - CALL ILPRT - DB DIM - DB '** Queue Status Summary **' - DB BRIGHT - DB CR,LF,0 - CALL QSTATS ;PRINT STATUS - POP H ;RESTORE PTR - JMP PROMPT -QSTATS: - LHLD QCNT ;GET SIZE OF QUEUE - CALL PRQCNT ;PRINT DATA - CALL PRQSPAC ;PRINT SPACE AVAILABLE INFO - CALL ILPRT - DB CR,LF - DB DIM,'Group Save Buffer Address: ',BRIGHT,0 - PUSH H - LHLD GBUFF ;BC=ADDRESS - MOV B,H - MOV C,L - POP H - CALL HEXB1 ;PRINT AS HEX - CALL ILPRT - DB ' Hex',CR,LF - DB 0 - CALL ILPRT - DB DIM,'Address of Head of Queue: ',BRIGHT,0 - LHLD QNXT ;PRINT ADDRESS OF HEAD OF QUEUE - MOV B,H ;... ADDRESS IN BC - MOV C,L - CALL HEXB1 ;PRINT IN HEX - CALL ILPRT - DB ' Hex',CR,LF - DB DIM,'Address of Tail of Queue: ',BRIGHT,0 - LHLD QLST ;PRINT ADDRESS OF TAIL OF QUEUE - MOV B,H - MOV C,L - CALL HEXB1 - CALL ILPRT - DB ' Hex',CR,LF,0 - RET -; -; Print Amount of Space Left in Queue -; -PRQSPAC: - LXI B,-1 ;SET COUNT - LHLD QLST ;GET PTR TO QUEUE TAIL -QSTAT1: - INX B ;INCREMENT COUNT - LXI D,80H ;PT TO NEXT QUEUE ELEMENT - DAD D - XCHG ;WRAP AROUND - CALL QWRAP - LHLD QNXT ;GET PTR TO FIRST ELEMENT - XCHG - MOV A,H ;COMPARE - CMP D - JNZ QSTAT1 - MOV A,L - CMP E - JNZ QSTAT1 - MOV H,B ;HL=BLOCK COUNT - MOV L,C - CALL DEC ;PRINT AS DECIMAL - CALL ILPRT - DB DIM,' Blocks Left in Queue',BRIGHT,CR,LF,0 - RET -; -; Save Queue as a File -; -QFSAVE: - MOV A,M ;GET FIRST CHAR OF FILE NAME - CPI EOLCH ;EOL? - JZ WHAT - CPI CR ;EOL? - JZ WHAT - LXI D,FCB ;START TO FILL FCB - XRA A ;A=0 - STAX D ;SELECT DEFAULT DRIVE - INX D ;PT TO FILE NAME - MVI B,8 ;SAVE FILE NAME - CALL MVNAME - MVI B,3 ;SAVE FILE TYPE - CALL MVNAME - PUSH H ;SAVE PTR TO NEXT CHAR - LHLD QCNT ;ANY ELEMENTS IN QUEUE? - MOV A,H - ORA L - JZ QEMPTY - PUSH H ;SAVE QUEUE COUNT - CALL NORITE ;CAN'T WRITE NOW - LXI D,FCB ;PT TO FCB - CALL FCBINIT ;INIT FCB - MVI C,DELF ;DELETE FILE - PUSH D ;SAVE DE - CALL BDOS - POP D - CALL FCBINIT ;INIT FCB AGAIN - MVI C,MAKEF ;CREATE FILE - CALL BDOS - POP B ;GET QUEUE COUNT IN BC - LHLD QNXT ;PT TO NEXT BLOCK IN QUEUE -QFS1: - PUSH B ;SAVE COUNT - LXI D,TBUFF ;COPY INTO TBUFF - MVI B,128 ;128 BYTES - CALL MOVE - XCHG ;PT TO NEXT QUEUE BLOCK IN DE - CALL QWRAP ;WRAP AROUND - PUSH D ;SAVE PTRS - LXI D,FCB ;PT TO FCB - MVI C,WRITEF ;WRITE BLOCK TO FILE - CALL BDOS - POP H ;GET PTR TO NEXT BLOCK - POP B ;GET COUNT - DCX B ;COUNT DOWN - MOV A,B ;DONE? - ORA C - JNZ QFS1 - LXI D,FCB ;CLOSE FILE - MVI C,CLOSEF - CALL BDOS - CALL ILPRT - DB 'Queue Saved in File',CR,LF,0 - POP H ;PT TO NEXT CHAR - JMP PROMPT -FCBINIT: - PUSH D ;SAVE PTR - LXI H,12 ;SKIP TO EX FIELD - DAD D - MVI B,24 ;ZERO 36 BYTES - XRA A ;A=0 -FCBIN1: - MOV M,A ;STORE ZEROES - INX H - DJNZ FCBIN1 - POP D ;RESTORE PTR - RET -; -;COMMAND: * -;Repeat buffer contents -; -REPEAT: - CALL DECIN ;NN SPECIFIED? - MOV A,D - ORA E - JZ NNN ;NO -- SET FOR INFINITE LOOP OR SIMPLE REPEAT - LHLD TOGO ;LOAD LOOP FLAG - INX H ;TEST FOR FIRST TIME - MOV A,H - ORA L ;WAS IT 0FFFFH?; IF SO, WE HAVE NEW VALUE - JNZ NNN ;NO: COUNTING - XCHG ;GET COUNT - SHLD TOGO ;SET COUNT -; -NNN: - LHLD TOGO ;GET CURRENT COUNT - XCHG ;DE=CURRENT COUNT, HL=COUNT LIMIT - LHLD INBUF ;PT TO FIRST CHAR FOR REPEAT - INX D ;TEST FOR 0FFFFH - MOV A,D ;IF 0FFFFH, INX D MADE DE=0 - ORA E - JZ PROMPT ;CONTINOUS LOOP IF 0FFFFH - DCX D ;COUNT DOWN - DCX D ;MAKE UP FOR PREV INX D - XCHG - SHLD TOGO ;SET NEW COUNT (1 LESS THAN BEFORE) - MOV A,H ;ALL DONE? - ORA L - XCHG ;GET BACK INBUF PTR IN HL - JNZ PROMPT ;KEEP GOING IF NOT YET ZERO - JMP PRMPTR ;ALL DONE -; -;COMMAND: U -;Set CP/M 2.x user number -; -USER: - CALL DECIN ;GET REQUESTED USER NO. - LDA MUSER ;GET MAX USER - MOV B,A ;... IN B - MOV A,E - CMP B ;VALID? - JNC USRERR - MOV A,D ;HIGH-ORDER BYTE MUST BE ZERO FOR VALID NUMBER - ORA A - JNZ USRERR - MOV A,E ;SAVE USER NUMBER - STA UNUM - MVI C,SUSER ;SET USER NUMBER - PUSH H ;SAVE CHAR POINTER - CALL BDOS ;SET USER NO. - POP H - JMP PROMPT -USRERR: - CALL ILPRT - DB 'User Number Out of Range',CR,LF,0 - JMP PRMPTR -; -;COMMAND: P -;Toggle print flag -; -PRNTFF: - LDA PFLAG ;TOGGLE PRINT FLAG - XRI 1 - STA PFLAG - JMP PROMPT -; -;COMMAND: Z -;Sleep routine, in seconds -; -SLEEP: - CALL DECIN ;GET COUNT IF ANY - MOV A,E ;ANY? - ORA A - JNZ SLEPLP - MVI E,1 ; 1 SEC DEFAULT -; -SLEPLP: - LDA CLOCK ; GET CLOCK SPEED - MOV D,A -; -SLEEP1: - LXI B,41700 ; APPROX 1 SEC @ 1MHz -; -SLEEP2: - DCX B ;COUNT DOWN FOR 1 MHz [5 CYCLES] - MOV A,B ;[5 CYCLES] <-- TOTAL TIME: 24 CYCLES - ORA C ;[4 CYCLES] <-- (24 MU-SECS AT 1MHz) - JNZ SLEEP2 ;[10 CYCLES] - PUSH D - CALL CTLCS ;ABORT? - POP D - JZ PRMPTR - DCR D ;COUNT DOWN FOR CLOCK SPEED - JNZ SLEEP1 - DCR E ;COUNT DOWN NUMBER OF REQUESTED SECONDS - JNZ SLEPLP - JMP PROMPT -; -;Check for control-C or S -; -CTLCS: - CALL CONST ;CHAR AVAILABLE? - ORA A - JNZ GETC - ORI 1 ;NO CHAR, RETURN NZ - RET -; -GETC: CALL CONIN ;INPUT CHAR - ANI 1FH ;ALLOW ASCII - CPI 'S'-40H ;WAIT FOR NEXT CHAR IF ^S OR S OR s - CZ CONIN - CPI 'C'-40H ;CHECK FOR ^C OR C OR c - RET ;0 SET IF CTL-C -; -;Initialize Memory Buffers -; -INITP: - XRA A ;A=0 - STA HEXAD ;CLEAR ADDRESS - STA HEXAD+1 - STA PFLAG ;SET NO PRINT - STA SAVEFL ;SET NO SAVE DONE - STA WRFLG ;MAY NOT WRITE - STA DIRPOS ;SET NO DIRECTORY POSITION - STA FINDFL ;SET NO POSITION - INR A ;A=1 - STA FTSW ;SET SEARCH WITHOUT INCREMENT - STA NOTPOS ;NOT POSITIONED - LXI H,0 ;HL=0 - SHLD QCNT ;SET NO ELEMENTS IN QUEUE - SHLD MFPTR ;SET NO MULTI FILE PTR - SHLD CURTRK ;SET TRACK 0 - INX H ;HL=1 - SHLD CURSEC ;SET LOGICAL SECTOR 1 - SHLD PHYSEC ;SET PHYSICAL SECTOR 1 - LHLD PINBUF ;SET PREVIOUS COMMAND TO NIL - MVI M,CR ;CLEAR PREVIOUS COMMAND - LHLD DIRECT ;SET FIRST AND LAST QUEUE ELEMENT PTRS - SHLD QNXT - SHLD QLST - - ; Initialize Default Macros -- new block by - - LHLD MTABL ;CLEAR MACRO TABLE - MVI B,10 ;10 ENTRIES - lxi d,imac0 ;point to beginning of default macro table - -initp1: push h ;save pointer to start of each macro - -initp2: ldax d ;get next initial macro character - mov m,a ;store it in macro table - inx d - inx h - cpi cr ;end of macro? - jnz initp2 - - pop h ;retrieve pointer to start of this macro - dcr b ;see if we've done all macros - rz ;if so, return - inr h ;point to next macro - jmp initp1 - -;INITP1: -; MVI M,CR ;STORE -; INR H ;PT TO NEXT PAGE -; DJNZ INITP1 -; RET - -; End of Block Changed by - -; -;Set up flags, etc, at initialization -;Find our way at initialization -; -GETSTP: - PUSH H - LHLD INBUF ;PT TO INPUT BUFFER - MVI M,CR ;INITIALIZE INPUT BUFFER - POP H - MVI C,SUSER ;GET USER NUMBER - MVI E,0FFH ;GET USER - CALL BDOS - STA UNUM ;SET USER NUMBER - MVI C,GETDSK - CALL BDOS ;GET CURRENT DISK - MOV C,A ;WE HAVE TO SELECT - JMP SELECT ;TO GET THE DPH -; -;COMMAND: L -;Log in the selected disk -; -LOGIN: - CALL DOLOG - JMP PROMPT -; -DOLOG: - MOV A,M ;DISK REQUESTED? - LXI D,0 - CPI CR ;NO REQUEST OF PHYSICAL EOL - JZ LGNODK - CPI EOLCH ;NO REQUEST IF LOGICAL EOL - JZ LGNODK - CALL UPCASE ;CAPITALIZE - INX H ;POINT TO NEXT CHAR - SUI 'A' ;CONVERT TO 0-15 - MOV C,A ;DISK NUMBER IN C - LDA MDISK ;GET MAX DISK - MOV B,A ;... IN B - MOV A,C - CMP B - JC SELECT - CALL ILPRT - DB 'Disk Letter Out of Range',CR,LF,0 - JMP PRMPTR -; -;Select Disk Whose Number is in C (A=0, B=1, etc) -; -SELECT: - PUSH H ;SAVE PTR TO NEXT COMMAND LETTER - MOV A,C - STA DRIVE ;REMEMBER LATER WHERE WE ARE -; -VSELDK: CALL $-$ ;ADDR FILLED IN BY 'INIT' - MOV A,H - ORA L - JZ WHAT ;SELECT ERROR - MOV E,M ;GET THE SECTOR TABLE PNTR - INX H - MOV D,M - INX H - XCHG - SHLD SECTBL ;SET THE SECTOR TABLE PTR - LXI H,8 ;OFFSET TO DPBPTR - DAD D - MOV A,M ;PICK UP DPB POINTER - INX H ; TO USE - MOV H,M ; AS PARAMETER - MOV L,A ; TO LOGIT - CALL LOGIT - LHLD SYSTRK ;RESET TRACK AND SECTOR - XCHG ; TO DIRECTORY - CALL SETTRK ; ON EVERY - LXI D,1 ; LOGIN - CALL SETSEC ; CHANGE - LHLD PHYSEC ;THIS LOGIC WILL TELL - MOV A,H ; IF FIRST SEC - ORA L ; IS PHYSICAL 0 - STA FIRST0 - CALL CLCSUB ;CALCULATE WHAT GROUP/GRPDISP WE ARE IN - POP H ;GET PTR TO NEXT LETTER -; -LGNODK: - CALL NORITE ;SET NO DISK I/O DONE (NO POSITION) - RET -; -;Read in the disk directory -; -REDDIR: - PUSH H ;SAVE PTR TO NEXT LETTER - CALL NORITE ;POSITIONING LOST - LHLD SYSTRK ;SAVE CURRENT TRACK - SHLD CURTRK - LXI H,1 ;SET SECTOR 1 - SHLD CURSEC - LHLD DRM ;GET DIR SIZE FROM DPB - INX H ;MAKE 1-RELATIVE - CALL ROTRHL - CALL ROTRHL ;DIVIDE BY 4 (4 NAMES/SECTOR) - MOV B,H ;BC=NUMBER OF BLOCKS TO READ - MOV C,L - XCHG - LHLD DIRECT ;DMA ADDR - XCHG ;... IN DE -; -;Read Disk Directory Loop -; -RDIRLP: - PUSH B ;SAVE REGS - PUSH D - MOV B,D ;BC=DMA ADDRESS - MOV C,E - LDA BDOS+2 ;CHECK MEM AVAIL - DCR A ;ARE WE RNNING INTO BDOS? - CMP D - JC MEMFUL ;MEMORY FULL ERROR IF SO - CALL SETDMA ;SET DMA ADDRESS TO THAT IN BC - LHLD CURTRK ;SET TRACK - XCHG - CALL SETTRK - LHLD CURSEC ;SET SECTOR - XCHG - CALL SETSEC - CALL READ ;READ DIRECTORY BLOCK - CALL NXTSEC ;INCREMENT TO NEXT SECTOR - POP D - POP B - LXI H,80H ;ADVANCE TO NEXT DMA ADDRESS - DAD D - XCHG ;DE=NEXT DMA ADDRESS - DCX B ;COUNT DOWN DIRECTORY BLOCKS - MOV A,B - ORA C - JNZ RDIRLP - LXI B,TBUFF ;RESET DMA ADDRESS TO TBUFF - CALL SETDMA - POP H ;GET PTR TO NEXT CHAR - RET -; -;COMMAND: M -;Map the directory -; -MAP: - PUSH H ;SAVE PTR - LHLD QCNT ;GET COUNT - MOV A,H - ORA L - POP H - JZ MAP1 ;PROCEED IF QUEUE EMPTY - CALL ILPRT ;PRINT ABORT MESSAGE - DB CR,LF,'MAP not permitted -- Block Queue would be overlaid',0 - JMP PRMPTR -MAP1: - CALL PAGSET ;SET PAGING COUNTER - XRA A - STA ONLY1 ;SET FLAG FOR ALL GROUPS (NOT ONLY 1) - CALL REDDIR ;READ IN DIRECTORY - MVI C,0 ;INIT START GRP # - LDA AL0 ;READ DIR GRP BITS - CALL COLECT ;COLLECT COUNT OF DIR GRPS.. - LDA AL1 ;..IN REGISTER C - CALL COLECT - MVI B,0 ;BC NOW HAS A DEFAULT START GRP # - CALL HEXIN ;GET SPECIFIED GROUP IF ANY - PUSH H ;SAVE INBUF PTR - MOV A,E ;GET START - ORA D ;NOTHING? - JZ MAPDF ;..YES, DFLT - MVI A,0FFH ;SET FLAG FOR ONLY 1 GROUP - STA ONLY1 - MOV B,D ;GET VALUE IN BC - MOV C,E -; -MAPDF: - CALL HEXB ;PRINT FIRST GROUP NUMBER - MVI A,'-' ;PRINT SEPARATOR - CALL TYPE - MVI A,' ' ;SET NO DUPLICATES - STA DUPFLG - CALL GETGRP ;GET GRP(C) TO HL -; -MAPCNT: - INX B ;NEXT GRP # - PUSH H - LHLD DSM ;GET HIGHEST GRP # - INX H ;PLUS 1 FOR COMPARISON - MOV A,L ;WHEN BC REACHES DSM+1.. - CMP C ;..THEN WE HAVE EXCEEDED.. - JNZ MAPC1 ;..THE DISK CAPACITY.. - MOV A,H - CMP B -; -MAPC1: - POP H - JZ MAPEND ;..AND WE ARE DONE - PUSH H - CALL GETGRP ;GET ANOTHER - POP D ;SEE IF SAME - CALL CTLCS ;ABORT? - JZ MAPND2 - MOV A,D - CMP H - JNZ MAPDIF - MOV A,E - CMP L - JZ MAPCNT ;SAME, CONTINUE -; -;Different file encountered -; -MAPDIF: - DCX B - CALL HEXB ;PRINT ENDING GROUP NUMBER - INX B - XCHG - CALL MAPNAM ;PRINT FILE NAME - LDA ONLY1 ;ONLY 1 NAME TO BE PRINTED? - ORA A ;0=NO - JNZ MAPND1 - JMP MAPDF -; -;End of map -; -MAPEND: - DCX B ;GET LAST - CALL HEXB ;PRINT LAST GROUP NUMBER - CALL MAPNAM ;PRINT FILE NAME - CALL WAIT ;DELAY FOR USER -MAPND1: - POP H - CALL CRLF ;NEW LINE -; -;End of map - reposition to previous group -; -MAPND2: - PUSH H - LHLD GROUP ;POINT TO GROUP IN DE - XCHG - JMP POSGP2 -; -;Print file name pointed to by HL -; -MAPNAM: - CALL SPACE ;LEADING SPACE - MOV A,H - ORA L ;NONE? - JZ NONAME - MOV A,M ;SEE IF ALLOC - CPI 0E5H ;FREE? - MVI A,' ' ;MARK ALLOCATED - JNZ MPNSP1 - MVI A,'(' ;MARK NOT ALLOCATED (ERASED FILE) -; -MPNSP1: - CALL TYPE ;PRINT ALLOCATION INDICATOR (SPACE OR '(') - PUSH H ;SAVE POINTER - MOV A,M - CALL HEX ;SHOW USER NUMBER - CALL SPACE - INX H ;SKIP USER BYTE - PUSH B - MVI B,8 ;PRINT FILE NAME - CALL MAPN2 - MVI A,'.' ;PRINT DECIMAL SEPARATOR - CALL TYPE - MVI B,3 ;PRINT FILE TYPE - CALL MAPN2 - LDA DUPFLG ;DUPLICATE? - CALL TYPE ;SPACE OR STAR - POP B - MOV A,M ;GET EXT - CALL HEX ;PRINT EXTENT NUMBER - POP H - MOV A,M - CPI 0E5H ;DELETED ENTRY? - MVI A,' ' ;PRINT ENDING SPACE - JNZ MPNSP2 - MVI A,')' ;PRINT ALLOCATION FLAG -; -MPNSP2: - CALL TYPE ;")" IF ERASED FILE OR SPACE IF NOT - JMP FLIP -; -NONAME: - CALL ILPRT - DB DIM,' ++ Free ++ ',BRIGHT,0 -; -FLIP: - LDA TWOUP ;FLIP FLAG FOR TWO ENTRIES PER LINE - XRI 1 - STA TWOUP - JZ PAGER ;NEW LINE WITH PAGING IF REQUIRED -; -DELIM: - MVI A,':' ;PRINT DELIMITER BETWEEN ADJACENT ENTRIES ON LINE - CALL TYPE - JMP SPACE -; -;Print name pted to by HL, length in B -; -MAPN2: - MOV A,M - ANI 7FH ;STRIP POSSIBLE 2.x ATTRIBUTE BIT - INX H - CPI ' ' ;PRINTABLE? - JC MAPN2H ;..NO, IN HEX - CPI 7EH ;7E IS LEADIN ON SOME CRTS - JC MAPN2A -; -MAPN2H: - CALL BHEX ;PRINT A AS HEX CHARS - JMP MAPN2Z -; -MAPN2A: - CALL TYPE ;PRINT AS CHAR -; -MAPN2Z: - DJNZ MAPN2 - RET -; -;Find which file group (BC) belongs to -; -GETGRP: - LHLD DRM ;MAX DIR ENTRY # - INX H ;MAKE 1-RELATIVE - SHLD FILECT - LXI H,0 - SHLD MFPTR ;SET MULTI-FILE (MORE THAN ONE USER) PTR - LHLD DIRECT ;PT TO DIRECTORY -; -GETGLP: - PUSH H ;SAVE POINTER TO NAME - MOV A,M ;PICK UP DN BYTE - CPI 0E5H ;ERASED? - JZ GETGNF - LXI D,14 ;NOW GET RECORD COUNT - DAD D ; S2 PORTION .. - MOV A,M ; IS 0 IN CP/M 1.4 - ANI 0FH - MOV E,A - INX H - MOV A,M - ORA E - JZ GETGNF - MVI E,16 ;FIRST SET FOR 8-BIT GRPS - LDA DSM+1 - ORA A - JZ SMALGP - MVI E,8 ;NOPE, BIG GROUPS -; -SMALGP: - MOV D,A ;SAVE GRP SIZE INDICATOR -; -GETGL2: - INX H ;POINTING INTO DM FIELD - CALL GRPCMP ;COMPARE BC GP # AGAINST 1 DM FLD - JNZ NOTGOT ;JUMP IF NOT FOUND -; -;Found the file -; - PUSH H ;SAVE GROUP PTR - LHLD MFPTR - MOV A,H ;ANY ENTRIES? - ORA L - POP H ;GET PTR - XTHL ;SAVE ENTRY START AND SAVE PTR - JZ MPFRST ;IF ZERO, THEN FIRST ENTRY - MVI A,'*' ;SET MULTI FLAG - STA DUPFLG -MPFRST: - SHLD MFPTR ;SAVE POINTER - XTHL ;RESTORE ENTRY START AND GET PTR -NOTGOT: - DCR E ;COUNT DOWN - JNZ GETGL2 ;GO TEST SOME MORE -; -GETGNF: - POP H ;NOT THIS ONE - LXI D,32 ;SO GO TO NEXT - DAD D - XCHG - LHLD FILECT ;THERE IS LIMIT TO EVERYTHING - DCX H - SHLD FILECT - MOV A,H - ORA L - XCHG ;RE-ALIGN - JNZ GETGLP -; -;Set the allocation address, if any -; - LHLD MFPTR ;GET ADDRESS - RET -; -;COMMAND: < -;Save the current sector -; Special Form of -;Restore the current sector -; Special Form >S gets next block from queue -; Special Form >G gets next group from queue -; -RESTOR: - MOV A,M ;CHECK FOR SPECIAL FORM - CALL UPCASE ;CAPITALIZE - CPI 'B' ;BLOCK SAVE? - JZ QRESTOR - CPI 'G' ;GROUP SAVE? - JZ RESTRG - LDA SAVEFL ;SAVE DONE PREVIOUSLY? - ORA A - JZ NOSAVE ;NONE TO SAVE - PUSH H - LHLD SAVBUF ;COPY FROM SAVBUF - LXI D,TBUFF ;INTO TBUFF - MVI B,128 ;128 BYTES - CALL MOVE - POP H ;GET PTR TO NEXT CHAR - JMP PROMPT -; -; Restore Sector from Queue -; -QRESTOR: - INX H ;PT TO NEXT CHAR - PUSH H ;SAVE PTR ON STACK - LHLD QCNT ;GET ELEMENT COUNT - MOV A,H ;EMPTY? - ORA L - JZ QEMPTY ;ABORT IF EMPTY - DCX H ;COUNT DOWN - SHLD QCNT - CALL PRQCNT ;PRINT COUNT - LHLD QNXT ;PT TO NEXT ELEMENT IN QUEUE - LXI D,TBUFF ;COPY INTO TBUFF - MVI B,128 ;128 BYTES - CALL MOVE - XCHG ;DE=PTR TO NEXT ELEMENT IN QUEUE - CALL QWRAP ;CHECK FOR WRAP AROUND - XCHG ;HL PTS TO NEXT ELEMENT IN QUEUE - SHLD QNXT ;SAVE PTR - POP H ;RESTORE PTR - JMP PROMPT -QEMPTY: - CALL ILPRT - DB 'Error -- Queue Empty',CR,LF,0 - POP H ;RESTORE NEXT CHAR PTR - JMP PRMPTR -; -;Write Group Loaded in GBUFF to Disk -; -RESTRG: - CALL COMG ;GET GROUP NUMBER FROM COMMAND LINE AND POS - PUSH H - CALL ILPRT - DB 'Writing to Group ',0 - LHLD GROUP ;GET GROUP NUMBER - MOV B,H ;VALUE IN BC - MOV C,L - CALL HEXB ;PRINT IN HEX - CALL ILPRT - DB CR,LF,0 - LHLD QNXT ;NEXT PTR USED FOR WRITE - SHLD QPTR - POP H - MVI A,0FFH ;WRITE FUNCTION - STA CPYFCT ;COPY FUNCTION FOR GROUP COPY ROUTINE - JMP COPYG ;GROUP COPY ROUTINE -; -NOSAVE: - CALL ILPRT - DB '++ No "<" Save Command Issued ++' - DB CR,LF,0 - JMP PRMPTR -; -;Move (HL) to (DE) length in B -; -MOVE: - MOV A,M - STAX D - INX H - INX D - DJNZ MOVE - RET -; -NORITE: - XRA A ;GET 0 - STA WRFLG ;CAN'T WRITE NOW - RET -; -;No match in search, try next char -; -SRNOMT: - POP H - CALL CTLCS ;ABORT? - JNZ SEARCH ;..YES - LHLD INBUF - MVI M,CR - JMP CLCGRP ;SHOW WHERE STOPPED -; -;COMMAND: = -;Search for character string -; -SEARCH: - PUSH H ;SAVE STRING POINTER -; -SRCHL: - CALL RDBYTE ;GET A BYTE - MOV B,A ;SAVE IT - MOV A,M ;CHECK NEXT MATCH CHAR. - CPI '<' ;WILL IT BE HEX? - MOV A,B ;RESTORE DISK CHAR - JZ SRCHL1 - ANI 7FH ;NEXT CHAR IS ASCII...STRIP BIT 7 -; -SRCHL1: - PUSH PSW - CALL GETVAL ;GET SEARCH VALUE - MOV B,A - POP PSW - CMP B ;MATCH? - JNZ SRNOMT ;NO MATCH - INX H - MOV A,M ;DONE? - CPI CR ;END OF LINE? - JZ SREQU - CPI EOLCH ;LOGICAL EOL? - JNZ SRCHL -; -;Got match -; -SREQU: - CALL ILPRT - DB '= at ',0 - LDA BUFAD - ANI 7FH - CALL HEX - CALL CRLF - JMP CLCGRP -; -;Get value from input buffer -; -GETVAL: - MOV A,M ;GET NEXT CHAR - CPI '<' ;HEX ESCAPE? - RNZ ;NO, RETURN -;"<<" means one "<" - INX H - MOV A,M - CPI '<' - RZ -;Got hex - PUSH D - CALL HEXIN ;GET VALUE - CPI '>' ;PROPER DELIM? - MOV A,E ;GET VALUE - POP D - JNZ WHAT ;ERROR - RET -; -;Read a byte at a time from disk -; -RDBYTE: - PUSH H - LDA FTSW ;FIRST READ? - ORA A - JNZ READ1 - LHLD BUFAD - MOV A,L - ORA A ;IN BUFFER? - JM NORD ;YES, SKIP READ -; -;Have to read -; - CALL NXTSEC ;ADVANCE TO NEXT BLOCK -; -READ1: - XRA A - STA FTSW ;NOT FIRST READ - LHLD CURSEC - XCHG - CALL SETSEC - LHLD CURTRK - XCHG - CALL SETTRK - CALL READ - CALL CLCSUB - LXI H,TBUFF -; -NORD: - MOV A,M - INX H - SHLD BUFAD - POP H - RET -; -;COMMAND: V -;View the file in ASCII starting at -;current sector, stepping thru the disk -; -VIEW: - LDA WRFLG - ORA A - JZ BADDMP - CALL DECIN ;GET DISPL IF ANY - PUSH H - MOV A,E - ORA A - JNZ VIEWLP - INR E ;DFLT=1 -; -VIEWLP: - LXI H,TBUFF ;TO DATA -; -VEWCHR: - CALL CTLCS ;ABORT? - JZ VEWEND - MOV A,M ;GET NEXT CHAR - CPI 1AH ;EOF? - JZ VEWEOF - ANI 7FH ;MASK - CPI 7EH ;ESC CHAR FOR H1500 - JNC VIEWHX ;SHOW RUBOUT AND TILDE AS HEX - CPI ' ' - JNC VIEWPR - CPI CR ;CR PASS - JZ VIEWPR - CPI LF ;LF PASS - JZ VIEWPR - CPI TAB ;TAB PASS - JZ VIEWPR -; -VIEWHX: - MOV A,M ;NOT ASCII...PRINT AS - CALL BHEX - JMP VIEWNP -; -VIEWPR: - CALL TYPE -; -VIEWNP: - INR L - JNZ VEWCHR - DCR E - JZ VEWEND - PUSH D ;SAVE COUNT - CALL NXTSEC - LHLD CURSEC - XCHG - CALL SETSEC - LHLD CURTRK - XCHG - CALL SETTRK - CALL READ - POP D ;RESTORE COUNT - JMP VIEWLP -; -VEWEOF: - CALL ILPRT - DB CR,LF,DIM,' ++ EOF ++',BRIGHT,CR,LF,0 -; -VEWEND: - POP H - CALL CRLF - JMP CLCGRP -; -;COMMAND: A or D -;Dump in hex or ASCII -; -DUMP: - LDA WRFLG - ORA A - JNZ DUMPOK -; -BADDMP: - CALL ILPRT - DB '++ Can''t dump, no sector read ++',CR,LF,0 -; -EXPL: - CALL ILPRT - DB 'Use G command following F,',CR,LF - DB 'or R or S following T',CR,LF,0 - JMP PRMPTR -; -DUMPOK: - MOV A,M ;GET NEXT CHAR - CPI EOLCH ;LOGICAL EOL? - JZ DUMPDF ;DFLT - CPI CR ;PHYSICAL EOL? - JNZ DMPNDF -; -;Use default -; -DUMPDF: - LXI B,TBUFF - LXI D,0FFH - JMP DUMP1 -; -DMPNDF: - CALL DISP - MOV B,D - MOV C,E - CPI CR - JZ DUMP1 - CPI EOLCH - JZ DUMP1 - INX H ;SKIP SEPCH - CALL DISP -; -;BC = start, DE = end -; -DUMP1: - PUSH H ;SAVE COMMAND POINTER - MOV H,B - MOV L,C -; -DUMPLP: - CALL DUMPHL ;PERFORM DUMP OF DIR ENTRY AT HL - POP H ;RESTORE HL - JMP PROMPT -; -; PERFORM DUMP AT HL -; -DUMPHL: - CALL STNDOUT ;DIM - MOV A,L - ANI 7FH - CALL HEX ;PRINT HEX VALUE - CALL STNDEND ;BRIGHT - CALL SPACE - CALL SPACE - LDA DUMTYP - CPI 'A' - JZ DUMPAS - PUSH H ;SAVE START -; -; DUMP 16 BYTES STARTING AT HL (CHECK FOR DE TERMINATION) -; -DHEX: - MOV A,M - CALL HEX ;PRINT HEX VALUE PTED TO BY HL - MOV A,L - ANI 3 - CPI 3 ;EXTRA SPACE EVERY 4 - CZ SPACE - MOV A,L - ANI 7 - CPI 7 ;TWO EXTRA SPACES EVERY 8 - CZ SPACE - MOV A,E ;CHECK FOR END OF BYTES TO DUMP - CMP L - JZ DPOP - INX H - MOV A,L ;CHECK FOR END OF 16 BYTES - ANI 0FH - JNZ DHEX -; -DPOP: - CALL CTLCS ;ABORT? - JZ PRMPTR - LDA DUMTYP ;CHECK FOR ASCII ALSO - CPI 'H' - JZ DNOAS ;HEX ONLY - POP H ;GET START ADDR -; -; DUMP ASCII CHARS - HL PTS TO FIRST BYTE -; -DUMPAS: - CALL ASTER ;PRINT FIRST ASTERISK TO SEPARATE TEXT -; -DCHR: - MOV A,M ;GET CHAR - ANI 7FH - CPI ' ' - JC DPER - CPI 7FH ;TRAP DEL - JC DOK -; -DPER: - MVI A,'.' ;PRINT PRINTING CHAR -; -DOK: - CALL TYPE ;PRINT CHAR - MOV A,E ;CHECK FOR END OF DUMP - CMP L - JZ DEND - INX H - MOV A,L ;CHECK FOR END OF 16 BYTES - ANI 0FH - JNZ DCHR -; -; END OF ASCII DUMP -; -DEND: - CALL ASTER ;PRINT ENDING ASTERISK - CALL CRLF ;NEW LINE - PUSH D - CALL CTLCS ;ABORT? - POP D - JZ PRMPTR - MOV A,E ;DONE WITH DUMP? - CMP L - JNZ DUMPHL - RET -; -; NO ASCII DUMP -; -DNOAS: - POP B ;CLEAR STACK (START ADDRESS OF DUMP) - CALL CRLF ;NEW LINE - MOV A,E ;DONE WITH DUMP? - CMP L - JNZ DUMPHL - RET -; -;COMMAND: G -;Position -; -POS: - PUSH PSW - MOV A,M - CPI EOLCH ;LOGICAL EOL? - JZ POSINQ - CPI CR ;PHYSICAL EOL? - JNZ POSOK -; -POSINQ: - POP PSW - JMP INQ -; -POSOK: - POP PSW - CPI 'T' ;TRACK? - JZ POSTKD - CPI 'S' ;SECTOR? - JZ POSSCD - CPI 'G' ;GROUP? - JZ POSGPH - JMP WHAT ;ERROR OTHERWISE -; -;Position to Track -; -POSTKD: - CALL DECIN ;GET NUMBER IN DECIMAL -; -POSTRK: - PUSH H - LHLD MAXTRK ;CHECK FOR BEYOND END OF DISK - CALL SUBDE - POP H - JC OUTLIM - CALL SETTRK ;SET TRACK - CALL NORITE ;TRACK DOESN'T READ - MVI A,1 - STA NOTPOS ;SHOW NOT POSITIONED - JMP CLCGRP -; -;Position to Sector -; -POSSCD: - CALL DECIN ;GET NUMBER IN DECIMAL - MOV A,D - ORA E - JZ WHAT ;DON'T ALLOW SECTOR 0 -; -POSSEC: - PUSH H - LHLD SPT ;CHECK FOR WITHIN RANGE - CALL SUBDE - POP H - JC WHAT - CALL SETSEC ;SET SECTOR - CALL READ ;READ - XRA A - STA NOTPOS ;POSITIONED OK -; -;Calculate Group Number/Group Displacement and Print -; -CLCGRP: - CALL CLCSUB - JMP INQ -; -;Calculate group from track and sector -; On exit, GROUP = Group Number and GRPDIS = Displacement within Group -; -CLCSUB: - PUSH H - LHLD SYSTRK - XCHG - LHLD CURTRK - CALL SUBDE ;COMPUTE RELATIVE TRACK NUMBER (SKIP SYSTEM TRACKS) - XCHG - LHLD SPT ;MULTIPLY BY NUMBER OF SECTORS/TRACK - CALL MULT - XCHG ;DE=TOTAL NUMBER OF SECTORS IN TRACKS - LHLD CURSEC ;GET SECTOR OFFSET FROM BEGINNING OF TRACK - DCX H - DAD D ;HL=TOTAL NUMBER OF SECTORS WITH OFFSET - LDA BLM - MOV B,A - MOV A,L - ANA B - STA GRPDIS ;DISPLACEMENT WITHIN GROUP - LDA BSH - MOV B,A -; -CLCLOP: - CALL ROTRHL - DJNZ CLCLOP - SHLD GROUP ;GROUP NUMBER - POP H - RET -; -;Position in the directory after a find -;(Does not work in CP/M-2.x) -; -POSDIR: - PUSH H ;SAVE INBUF - LHLD BSH - XRA A - STA FINDFL ;CANCEL POS REQ - LDA DIRPOS ;GET POSITION - RAR - RAR - PUSH PSW - ANA H - STA GRPDIS - POP PSW -; -POSDLP: - RAR - DCR L - JNZ POSDLP - ANI 1 ;GET GROUP - MOV L,A ;SETUP FOR POSGP2 - MVI H,0 - SHLD GROUP - XCHG -; -POSGP2: - CALL GTKSEC ;CONVERT GROUP TO SECTOR/TRACK - CALL SETTRK ;SET TRACK - XCHG - CALL SETSEC ;SET SECTOR - CALL READ ;READ BLOCK - XRA A - STA NOTPOS ;NOW POSITIONED - POP H - JMP INQ -; -;Position to Group -; -POSGPH: - CALL HEXIN ;GET PARAMETER -; -;Position to Group Numbered in DE and Print Position -; -POSGRP: - CALL DEGROUP ;GOTO GROUP - JC OUTLIM - JMP INQ ;PRINT POSITION -; -;Position to Group Numbered in DE -; Return with Carry Set if Out of Limits -; -DEGROUP: - PUSH H - LHLD DSM ;CHECK FOR WITHIN BOUNDS - CALL SUBDE - POP H - RC - PUSH H ;SAVE HL - XCHG - SHLD GROUP ;SET GROUP NUMBER - XCHG - XRA A - STA GRPDIS ;SET ZERO DISPLACEMENT - CALL GTKSEC ;CONVERT GROUP TO SECTOR/TRACK - CALL SETTRK ;SET TRACK - XCHG - CALL SETSEC ;SET SECTOR - CALL READ ;READ BLOCK - XRA A ;SET NC AND FLAG - STA NOTPOS ;NOW POSITIONED - POP H - RET -; -;Convert Group Number in DE to Sector and Track; also, GRPDIS = Offset in Grp -; On exit, DE = Track Number, HL = Sector Number -; -GTKSEC: - MOV H,D ;HL=GROUP NUMBER - MOV L,E - LDA BSH ;GET NUMBER OF SECTORS IN GROUP -; -GLOOP: - DAD H - DCR A - JNZ GLOOP - LDA GRPDIS ;ADD IN DISPLACEMENT WITHIN GROUP - ADD L ;CAN'T CARRY - MOV L,A -; -;Divide by number of sectors, quotient=track, remainder=sector -; - XCHG ;DE=TOTAL NUMBER OF SECTORS - LHLD SPT ;GET NUMBER OF SECTORS/TRACK - CALL NEG ;HL = -SECTORS/TRACK - XCHG - LXI B,0 ;SET TRACK COUNTER TO ZERO -; -DIVLP: - INX B ;INCREMENT TRACK COUNT - DAD D ;SUBTRACT SECTORS/TRACK FROM SECTORS TOTAL - JC DIVLP - DCX B ;ADJUST TRACK COUNT - XCHG - LHLD SPT ;ADD SECTORS/TRACK BACK IN TO ADJUST - DAD D ;HL=NUMBER OF SECTORS ON LAST TRACK OF GROUP - PUSH H - LHLD SYSTRK ;ADD IN NUMBER OF SYSTEM TRACKS - DAD B - XCHG ;DE=TRACK NUMBER - POP H - INX H ;HL=SECTOR NUMBER - RET -; -;COMMAND: F -;Find Directory Entry for specified file -; -POSFIL: - CALL NORITE - MVI A,1 - STA FINDFL ;SO WE POSITION LATER - LXI D,FCB - XRA A ;LOGGED IN DISK - STAX D - INX D - MVI B,8 - CALL MVNAME - MVI B,3 - CALL MVNAME - MVI A,'?' - STAX D ;LOOK IN ALL EXTENTS - MVI A,'D' ;SET TYPE OF DUMP TO FULL - STA DUMTYP - PUSH H ;SAVE PTR TO NEXT CHAR - LXI D,FCB - MVI C,SRCHF - CALL BDOS - INR A - JNZ FLOK - STA DIRPOS ;GRP 0 IF NOT FOUND - CALL ILPRT - DB '++ File Not Found ++',CR,LF,0 - POP H ;RESTORE PTR TO NEXT CHAR - JMP PROMPT -; -FLOK: - DCR A - STA DIRPOS ;SAVE POS. IN DIR - ANI 3 - MOV L,A - MVI H,0 - DAD H ;X32 BYTES/ENTRY - DAD H - DAD H - DAD H - DAD H - LXI D,TBUFF - DAD D ;HL POINTS TO ENTRY - LXI D,32 - XCHG - DAD D - XCHG - CALL DUMPHL ;PRINT DIR ENTRY - LXI D,FCB ;LOOK FOR NEXT EXTENT - MVI C,SRCHN - CALL BDOS - INR A - JNZ FLOK - POP H ;RESTORE PTR TO NEXT CHAR - JMP PROMPT -; -MVNAME: - MOV A,M ;GET NEXT CHAR OF FILE NAME/TYPE - CPI '.' ;END OF FILE NAME? - JZ MVIPAD ;PAD OUT IF SO - CPI CR ;END OF ENTRY? - JZ PAD ;PAD OUT IF SO - CPI EOLCH ;END OF ENTRY? - JZ PAD ;PAD OUT IF SO - CALL UPCASE ;CAPITALIZE - STAX D ;STORE - INX H ;PT TO NEXT - INX D - DJNZ MVNAME - MOV A,M ;CHECK FOR ERROR - CPI CR ;OK IF EOL - RZ - CPI EOLCH ;OK IF LOGICAL EOL - RZ - INX H - CPI '.' ;OK IF DECIMAL - RZ - JMP WHAT -; -MVIPAD: - INX H -; -PAD: - MVI A,' ' ;PRINT PADDING SPACES - STAX D - INX D - DJNZ PAD - RET -; -;COMMAND: + -;Advance to Next Logical Sector -; -PLUS: - LXI D,1 ;DFLT TO 1 SECT - MOV A,M ;GET NEXT CHAR - CPI CR ;CR? - JZ PLUSGO ;..YES, DFLT TO 1 - CPI EOLCH - JZ PLUSGO - CALL DECIN ;GET # - MOV A,D - ORA E - JNZ PLUSGO - LXI D,1 ;SET 1 IF VALUE OF ZERO -; -PLUSGO: - CALL NXTSEC ;ADVANCE TO NEXT LOGICAL SECTOR - DCX D ;MORE TO GO? - MOV A,D - ORA E - JNZ PLUSGO ;..YES -; -;Ok, incremented to sector. Setup and read -; -PLUSMI: - PUSH H - LHLD CURSEC - XCHG - CALL SETSEC ;SET SECTOR - LHLD CURTRK - XCHG - CALL SETTRK ;SET TRACK - POP H - CALL READ ;READ IT - JMP CLCGRP ;CALCULATE GROUP AND DISPLAY -; -;COMMAND: - -;Back up to previous sector -; -MINUS: - LXI D,1 ;SET DFLT - MOV A,M ;GET CHAR - CPI CR ;CR? - JZ MINGO ;..YES, DFLT=1 - CPI EOLCH - JZ MINGO - CALL DECIN ;..NO, GET ## - MOV A,D - ORA E - JNZ MINGO - LXI D,1 ;ASSUME 1 -; -MINGO: - CALL LSTSEC ;BACK UP ONE SECTOR - DCX D ;COUNT DOWN ON NUMBER OF TIMES TO BACKUP - MOV A,D - ORA E - JNZ MINGO - JMP PLUSMI ;READ BLOCK -; -;Go to last sector -; Wrap around to last sector of previous track or last sector of -; last track, as necessary -; -LSTSEC: - PUSH H - LHLD CURSEC ;BACK UP SECTOR - DCX H - MOV A,H - ORA L - JNZ LSEC1 - LHLD CURTRK ;BEYOND SECTOR ZERO, SO BACK UP TRACK - MOV A,H - ORA L - JNZ LSEC0 - LHLD MAXTRK ;WRAP TO END OF DISK - SHLD CURTRK - LHLD MAXSEC - JMP LSEC1 -; -LSEC0: - DCX H - SHLD CURTRK - LHLD SPT ;GET NUMBER OF SECTORS/TRACK -; -LSEC1: - SHLD CURSEC ;SET NEW CURRENT SECTOR - POP H - RET -; -;Go to next sector -; On exit, CURSEC = Current Sector and CURTRK = Current Track -; -NXTSEC: - PUSH H - PUSH D - LHLD CURSEC ;INCREMENT CURRENT SECTOR - INX H - XCHG - LHLD SPT ;CHECK TO SEE IF BEYOND END OF TRACK - CALL SUBDE - XCHG - JNC NEXTOK - LHLD CURTRK ;BEYOND END OF TRACK, SO INCR CURRENT TRACK - INX H - XCHG - LHLD MAXTRK ;SEE IF BEYOND END OF DISK - CALL SUBDE - JNC TRASK - LXI D,0 ;WRAP TO START OF DISK -; -TRASK: - XCHG - SHLD CURTRK ;SET NEW CURRENT TRACK - LXI H,1 ;SET SECTOR 1 -; -NEXTOK: - SHLD CURSEC ;SET NEW CURRENT SECTOR - POP D - POP H - RET -; -;Tell what group, displacement, track, sector, physical sector -; -INQ: - CALL INQSUB - JMP PROMPT -; -;Position inquiry subroutine -;Executed via: G S or T (with no operands) -; -INQSUB: - PUSH H - LHLD SYSTRK ;CHECK IF IN SYSTEM TRACKS - XCHG - LHLD CURTRK - CALL SUBDE - JC NOGRP - CALL ILPRT ;PRINT GROUP NUMBER IF NOT IN SYSTEM TRACKS - DB DIM,'Group = ',BRIGHT,0 - LHLD GROUP - MOV B,H - MOV C,L - CALL HEXB ;PRINT GROUP NUMBER IN BC - MVI A,':' - CALL TYPE - LDA GRPDIS - CALL HEX ;PRINT GROUP DISPLACEMENT IN A - MVI A,',' - CALL TYPE -; -NOGRP: - CALL ILPRT ;PRINT TRACK NUMBER - DB DIM,' Track = ',BRIGHT,0 - LHLD CURTRK - CALL DEC ;TRACK NUMBER IN DECIMAL - CALL ILPRT ;PRINT SECTOR NUMBER - DB DIM,', Sector = ',BRIGHT,0 - LHLD CURSEC - CALL DEC ;SECTOR NUMBER IN DECIMAL - CALL ILPRT ;PRINT PHYSCIAL SECTOR NUMBER - DB DIM,', Physical Sector = ',BRIGHT,0 - LHLD PHYSEC - CALL DEC ;PHYSICAL SECTOR NUMBER IN DECIMAL - CALL CRLF - POP H - RET -; -;COMMAND: C -;Change Contents of Current Block -; -CHG: - MOV A,M ;GET TYPE (HEX, ASCII) - CALL UPCASE - PUSH PSW ;SAVE "H" OR "A" - INX H - CALL HEXIN ;GET DISP IN HEX - CALL DISP1 ;VALIDATE DISP TO DE - INX H - LXI B,0 ;SHOW NO 'THRU' ADDR - CPI '-' ;TEST DELIM FR. DISP - JNZ CHGNTH ;NO THRU - PUSH D ;SAVE FROM - CALL HEXIN - CALL DISP1 ;GET THRU - INX H ;SKIP END DELIM - MOV B,D - MOV C,E ;BC = THRU - POP D ;GET FROM - JMP CHGAH -; -CHGNTH: - CPI SEPCH - JNZ WHAT -; -CHGAH: - POP PSW - CPI 'H' ;HEX? - JZ CHGHEX - CPI 'A' ;ASCII? - JNZ WHAT -; -;Change ASCII -; -CHGALP: - MOV A,M ;GET CHAR - CPI CR - JZ PROMPT - CPI EOLCH - JZ PROMPT -; -;The following print of the deleted byte is commented out; if leading -; semicolons are removed, deleted bytes will be printed -; -; LDAX D ;GET BYTE THAT IS REPLACED -; CPI ' ' -; JC CHGAHX -; CPI 7EH ;DON'T PRINT ESC CHAR FOR H1500 -; JNC CHGAHX -; JMP CHGA2 -; -;CHGAHX: -; CALL BHEX -; JMP CHGA3 -; -;CHGA2: -; CALL TYPE -; -;End of print of delete bytes -; -CHGA3: - SHLD BACK ;IN CASE "THRU" - CALL GETVAL ;GET ASCII OR VALUE - STAX D ;UPDATE BYTE - INX H ;PT TO NEXT INPUT CHAR -; -;See if 'THRU' requested -; - MOV A,C - ORA A - JZ CHANTH - CMP E ;DONE?.. - JZ PROMPT ;..YES - LHLD BACK -; -CHANTH: - INR E - JNZ CHGALP - MOV A,M - CPI CR - JZ PROMPT - CPI EOLCH - JZ PROMPT - JMP WHAT -; -;Change hex -; -CHGHCM: - INX H -; -CHGHEX: - MOV A,M ;GET HEX DIGIT - CPI CR - JZ PROMPT - CPI EOLCH - JZ PROMPT - CPI SEPCH ;DELIM? - JZ CHGHCM - PUSH D - SHLD HEXAD ;IN CASE 'THRU' - CALL HEXIN ;POSITIONS TO DELIM - MOV A,E ;GET VALUE - POP D ;..ADDR -; -;The following comments out the echo of the deleted byte; removing the -; leading semicolons restores the echo -; -; PUSH PSW ;SAVE VALUE -; LDAX D ;GET OLD -; CALL HEX ;ECHO IN HEX -; POP PSW ;GET NEW -; -;End of echo of bytes -; - STAX D ;SAVE NEW BYTE - MOV A,C ;SEE IF 'THRU' - ORA A - JZ CHHNTH ;..NO. - CMP E ;..YES, DONE? - JZ PROMPT - LHLD HEXAD ;..NO: MORE -; -CHHNTH: - INR E - JNZ CHGHEX - MOV A,M - CPI CR - JZ PROMPT - CPI EOLCH - JZ PROMPT - JMP WHAT -; -;COMMAND: R -;Read Current Block into TBUFF -;COMMAND: RG -;Read Specified Group into GBUFF -; -DOREAD: - LDA NOTPOS ;POSITIONED? - ORA A - JNZ CANTRD - CALL READ ;READ BLOCK - JMP PROMPT -; -CANTRD: - CALL ILPRT - DB '++ Can''t read - not positioned ++',CR,LF - DB 'Position by:',CR,LF - DB ' Track then Sector, or',CR,LF - DB ' Group',CR,LF,0 - JMP PROMPT -; -;COMMAND: W -;Write Current Block to Disk -;COMMAND: WG -;Write Specified Group from GBUFF -; -DORITE: - CALL WRITE ;DO WRITE - JMP PROMPT -; -;Print Byte in A as Hex Digits -; -BHEX: - PUSH PSW - MVI A,'<' - CALL TYPE - POP PSW - CALL HEX - MVI A,'>' - CALL TYPE - RET -; -;Print Number in BC as Hex Digits -; HEXB does not print MS Byte if DSM shows small disk size -; HEXB1 prints BC regardless -; -HEXB: - LDA DSM+1 - ORA A - JZ HEXX -HEXB1: - MOV A,B - CALL HEX -; -HEXX: - MOV A,C -; -;Print Byte in A as 2 Hex Digits -; -HEX: - PUSH PSW - RAR ;GET HIGH NYBBLE - RAR - RAR - RAR - CALL NIBBL ;PRINT IT - POP PSW ;GET LOW NYBBLE -; -NIBBL: - ANI 0FH ;MASK LOW NYBBLE - CPI 10 ;0-9? - JC HEXNU - ADI 7 ;CONVERT TO A-F -; -HEXNU: - ADI '0' ;CONVERT TO ASCII - JMP TYPE ;PRINT IT -; -;Decimal output routine -; Print Number in HL as decimal digits -; -DEC: - PUSH B - PUSH D - PUSH H - XRA A ;SET NO LEADING DIGIT - STA DDIG - LXI B,10000 - CALL DPRT - DAD B - LXI B,1000 - CALL DPRT - DAD B - LXI B,100 - CALL DPRT - DAD B - LXI B,10 - CALL DPRT - DAD B - MOV A,L ;ALWAYS PRINT LSD - ADI '0' ;ASCII - CALL TYPE - POP H - POP D - POP B - RET -DPRT: - PUSH B ;SAVE BC - MVI D,0FFH ;SET -1 -DPRTL: - INR D ;ADD 1 TO OUTPUT DIGIT - MOV A,L ;L-C - SUB C - MOV L,A - MOV A,H ;H-B - SBB B - MOV H,A - JNC DPRTL - POP B ;RESTORE BC - LDA DDIG ;GET LEADING DIGIT FLAG - ORA D ;CHECK FOR ZERO STILL - STA DDIG ;SET FLAG - MOV A,D ;GET DIGIT TO PRINT - RZ ;ABORT IF BOTH ZERO - ADI '0' ;ASCII - JMP TYPE -DDIG: DS 1 ;TEMP FOR DEC USE ONLY -; -;Print -; -SPACE: - MVI A,' ' - JMP TYPE -; -;Print a dim '|' -; -ASTER: - CALL STNDOUT ;DIM - MVI A,'|' - CALL TYPE - JMP STNDEND ;BRIGHT -; -;Inline print routine -; Print Chars ending in 0 pted to by Return Address; return to byte after -; -ILPRT: - XTHL ;PT TO STRING -ILPLP: - CALL CTLCS ;ABORT? - JZ PRMPTR - MOV A,M ;GET CHAR -; CPI 1 ;PAUSE? -- ^A -; JNZ ILPOK -; CALL CONIN ;WAIT FOR ANY CHAR -; CPI 3 ;ABORT? -; JZ PRMPTR -; JMP ILPNX -; -;ILPOK: - CPI DIM ;GOTO DIM? - JZ ILPDIM - CPI BRIGHT ;GOTO BRIGHT? - JZ ILPBRI - CALL TYPE ;PRINT CHAR - JMP ILPNX -ILPDIM: - CALL STNDOUT ;ENTER STANDOUT MODE - JMP ILPNX -ILPBRI: - CALL STNDEND ;EXIT STANDOUT MODE -; -ILPNX: - INX H ;PT TO NEXT - MOV A,M ;GET IT - ORA A ;DONE? - JNZ ILPLP - INX H ;PT TO BYTE AFTER ENDING 0 - XTHL ;RESTORE HL AND RET ADR - RET -; -;DISP calls DECIN, and validates a sector -;displacement, then converts it to an address -; -DISP: - CALL DECIN -DISP1: - PUSH PSW ;SAVE DELIMITER - MOV A,D - ORA A - JNZ BADISP - MOV A,E - ORA A - JM BADISP - ADI 80H ;TO POINT TO BUFFER AT BASE+80H - MOV E,A - MVI D,BASE/256 - POP PSW ;GET DELIM - RET -; -BADISP: - CALL ILPRT - DB '++ Bad Displacement (Not 0-7FH) ++' - DB CR,LF,0 - JMP PRMPTR -; -;Input Number from Command Line -- Assume it to be Hex -; Number returned in DE -; -HEXIN: - LXI D,0 ;INIT VALUE - MOV A,M - CPI '#' ;DECIMAL? - JZ HDIN ;MAKE DECIMAL -; -HINLP: - MOV A,M ;GET CHAR - CALL UPCASE ;CAPITALIZE - CPI CR ;EOL? - RZ - CPI EOLCH ;EOL? - RZ - CPI SEPCH - RZ - CPI ' ' ;SPACE? - RZ - CPI '-' ;'THRU'? - RZ - CPI '>' - RZ - INX H ;PT TO NEXT CHAR - CPI '0' ;RANGE? - JC WHAT - CPI '9'+1 ;RANGE? - JC HINNUM - CPI 'A' ;RANGE? - JC WHAT - CPI 'F'+1 ;RANGE? - JNC WHAT - SUI 7 ;ADJUST FROM A-F TO 10-15 -; -HINNUM: - SUI '0' ;CONVERT FROM ASCII TO BINARY - XCHG - DAD H ;MULT PREVIOUS VALUE BY 16 - DAD H - DAD H - DAD H - ADD L ;ADD IN NEW DIGIT - MOV L,A - XCHG - JMP HINLP -; -HDIN: - INX H ;SKIP '#' -; -;Input Number in Command Line as Decimal -; Number is returned in DE -; -DECIN: - LXI D,0 - MOV A,M ; GET 1ST CHAR - CPI '#' ; HEX? - JNZ DINLP - INX H ; PT TO DIGIT - JMP HINLP ; DO HEX PROCESSING -; -DINLP: - MOV A,M ;GET DIGIT - CALL UPCASE ;CAPITALIZE - CPI '0' ;RANGE? - RC - CPI '9'+1 ;RANGE? - RNC - SUI '0' ;CONVERT TO BINARY - INX H ;PT TO NEXT - PUSH H - MOV H,D - MOV L,E - DAD H ;X2 - DAD H ;X4 - DAD D ;X5 - DAD H ;X10 - ADD L ;ADD IN DIGIT - MOV L,A - MOV A,H - ACI 0 - MOV H,A - XCHG ;RESULT IN DE - POP H - JMP DINLP -; -;Read in a console buffer -; -RDBUF: - CALL ILPRT ;PRINT PROMPT - DB CR,LF,'DU3 ',0 - LDA DRIVE ;GET DRIVE NUMBER - ADI 'A' ;CONVERT TO ASCII - CALL TYPE - LDA UNUM ;DISPLAY USER NUMBER - MOV L,A ;VALUE IN HL - MVI H,0 - CALL DEC ;PRINT IN DECIMAL - CALL ILPRT ;PRINT PROMPT - DB '? ',0 -; -;ENTRY POINT TO READ BUFFER WITHOUT PROMPT -; -RDBUF1: - LHLD INBUF ;USE CP/M READLN - DCX H - DCX H - XCHG - MVI C,10 - PUSH D - CALL BDOS - POP D - INX D ;PT TO CHAR COUNT - LDAX D ;GET CHAR COUNT - MOV B,A ;CHAR COUNT IN B - INX D ;PT TO INPUT LINE - XCHG ;... IN HL - ADD L ;ADD CHAR COUNT TO HL - MOV L,A - MOV A,H - ACI 0 - MOV H,A - MVI A,CR ;STORE ENDING CR - MOV M,A ;SET CR - CALL TYPE ;ECHO IT - MVI A,LF ;ECHO.. - CALL TYPE ;..LF - LHLD INBUF ;SET PTR TO FIRST CHAR IN LINE - RET -; -;Set paging flag for page routine -; -PAGSET: - LDA PAGSIZ ;GET SIZE OF PAGE - STA PAGFLG ;SET FLAG - RET -; -;Page output -; -PAGER: - LDA PAGFLG ;GET FLAG - CPI 2 ;2 LINES LEFT? - JZ WAIT ;SAME AS USER DELAY - DCR A ;COUNT DOWN - STA PAGFLG - JMP CRLF -; -;Delay Routine -; -SWAIT: - CALL AT - DB 23,5 ;POSITION CURSOR - JMP WAIT0 -WAIT: - CALL CRLF ;NEW LINE -WAIT0: - PUSH H - CALL ILPRT - DB DIM,'Type Any Character to Continue or ^C to Abort - ',BRIGHT,0 - POP H - CALL CONIN ;GET RESPONSE - CPI 'C'-40H ;^C? - JZ WAIT1 - CALL CRLF ;NEW LINE - CALL PAGSET ;RESET PAGE COUNT - RET -WAIT1: - LDA IHFLG ;INITIAL HELP? - ORA A ;0=NO - JZ PRMPTR ;ABORT TO COMMAND PROMPT - JMP EXIT1 ;ABORT TO CP/M -; -;CRLF Routine -; -CRLF: - MVI A,CR - CALL TYPE - MVI A,LF - JMP TYPE -; -;Convert to Upper Case -; -UPCASE: - ANI 7FH ;MASK OUT MSB - CPI 60H ;LESS THAN SMALL A? - RC ;RETURN IF SO - ANI 5FH ;MAKE UPPER CASE - RET -; -;CON: Status Routine -; -CONST: - PUSH B - PUSH D - PUSH H -VCONST: - CALL $-$ ;ADDR FILLED IN BY 'INIT' - POP H - POP D - POP B - RET -; -;CON: Input Routine -; -CONIN: - PUSH B - PUSH D - PUSH H -VCONIN: - CALL $-$ ;ADDR FILLED IN BY 'INIT' - POP H - POP D - POP B - RET -; -;Console out with TAB expansion -; Char in A -; -TYPE: - PUSH B ;SAVE REGS - PUSH D - PUSH H - MOV C,A ;FOR OUTPUT ROUTINE - CPI TAB - JNZ TYPE2 -;Tabulate -TYPTAB: - MVI A,' ' ;PRINT SPACE - CALL TYPE - LDA TABCOL ;GET COL COUNT - ANI 7 ;DONE? - JNZ TYPTAB - JMP TYPRET -; -;Filter out control characters to -;prevent garbage during view of file -; -TYPE2: - CPI ' ' - JNC TYPEQ - CPI CR - JZ TYPEQ - CPI LF - JNZ TYPNCR -; -TYPEQ: -; -;CON: Output Routine -; -VCONOT: CALL $-$ ;ADDR FILLED IN BY 'INIT' -; -;Update column used in tab expansion -; - MOV A,C ;GET CHAR - CPI CR - JNZ TYPNCR - MVI A,0 ;RESET TAB COLUMN IF - STA TABCOL - JMP TYPLST -; -TYPNCR: - CPI ' ' ;CTL CHAR? - JC TYPLST ;..NO CHANGE IN COL - LDA TABCOL ;INCR TAB COUNT - INR A - STA TABCOL -; -TYPLST: - LDA PFLAG ;CHECK FOR PRINTER OUTPUT - ANI 1 - CNZ LIST ;FROM C REG -; -TYPRET: - POP H ;RESTORE REGS - POP D - POP B - RET -; -;LST: Output Routine -; Char in C -; -LIST: - PUSH B ;SAVED REGS - PUSH D - PUSH H -VLIST: - CALL $-$ ;ADDR FILLED IN BY 'INIT' - POP H - POP D - POP B - RET -; -;Home Disk Routine -; -HOME: - PUSH H -VHOME: - CALL $-$ ;ADDR FILLED IN BY 'INIT' - POP H - RET -; -;Set track # in DE -; -SETTRK: - PUSH H - LHLD MAXTRK ;CHECK FOR WITHIN BOUNDS - CALL SUBDE ;IF TRACK # IN DE > MAX, THEN ERROR - POP H - JC OUTLIM - XCHG ;RESET CURRENT TRACK - SHLD CURTRK - XCHG - MOV B,D ;BC=TRACK NUMBER - MOV C,E - PUSH H -; -VSETRK: - CALL $-$ ;ADDR FILLED IN BY 'INIT' - POP H - RET -; -;Set Sector Number in DE -; -SETSEC: - PUSH H - PUSH D - LHLD SYSTRK ;GET NUMBER OF SYSTEM TRACKS - XCHG - SHLD CURSEC ;SET CURRENT SECTOR - LHLD CURTRK ;GET CURRENT TRACK - CALL SUBDE ;SEE IF WE ARE IN THE SYSTEM TRACKS - POP B ;BC=SECTOR NUMBER - MOV H,B ;HL=SECTOR NUMBER - MOV L,C - JNC NOTSYS ;IF NO CARRY FOR SUBDE, WE ARE NOT IN SYSTEM TRACKS - LDA FIRST0 ;SEE IF FIRST SEC 0 - ORA A - JNZ GSTSEC ;NO, JUMP AWAY - DCX H ;YES, SO DECREMENT - JMP GSTSEC ;REQUESTED, THEN GO -; -;Not in System Tracks, so Skew Factor is effective -; -NOTSYS: - LHLD SECTBL ;GET PTR TO SECTOR TABLE - XCHG ;... IN DE - DCX B ;DECREMENT SECTOR NUMBER BY 1 -; -VSCTRN: - CALL $-$ ;ADDR FILLED IN BY 'INIT' - LDA SPT+1 ;IF SPT<256 (HI-ORD = 0) - ORA A ; THEN FORCE 8-BIT TRANSLATION - JNZ GSTSEC ; ELSE KEEP ALL 16 BITS - MOV H,A -GSTSEC: - SHLD PHYSEC - MOV B,H - MOV C,L -; -VSTSEC: - CALL $-$ ;ADDR FILLED IN BY 'INIT' - POP H ;RESTORE PTR TO NEXT CHAR - RET -; -;Out of Disk Track Limit -; -OUTLIM: - CALL ILPRT - DB '++ Not Within Tracks 0-',0 - PUSH H - LHLD MAXTRK ;PRINT MAX TRACK NUMBER - CALL DEC - POP H - CALL ILPRT - DB ' ++',CR,LF,0 - CALL NORITE ;NOT POSITIONED - JMP PRMPTR -; -;Set DMA Address -; -SETDMA: - JMP $-$ ;ADDR FILLED IN BY 'INIT' -; -;Read Next Block into DMA Address -; -READ: - MVI A,1 ;SET FLAG - STA WRFLG - PUSH H ;SAVE PTR TO NEXT CHAR -; -VREAD: - CALL $-$ ;ADDR FILLED IN BY 'INIT' - ORA A ;ERROR? - JZ READOK - CALL ILPRT - DB '++ READ Failed, Sector may be Invalid ++' - DB CR,LF,0 -; -READOK: - POP H ;GET PTR TO NEXT CHAR - RET -; -;Write Block in DMA Address to Disk -; -WRITE: - LDA WRFLG ;READ ALREADY PERFORMED? - ORA A ;ERROR IF NOT - JNZ PWRITE -; -BADW: - CALL ILPRT - DB '++ Cannot Write Unless Read Issued ++' - DB CR,LF,0 - JMP EXPL -; -;Do Write -; -PWRITE: - PUSH H ;SAVE PTR TO NEXT CHAR - MVI C,1 ;FORCE WRITE TYPE 1 IN CASE 2.x DEBLOCK USED -; -VWRITE: - CALL $-$ ;ADDR FILLED IN BY 'INIT' - ORA A ;ERROR? - JZ WRITOK - CALL ILPRT - DB '++ WRITE Failed ++',CR,LF,0 -; -WRITOK: - POP H - RET -; -;Help; HELP is entry point for HELP (?) command, HELP1 is entry point for -; Initial Help Command, and IHELP is entry point for HELP (/) from command -; line -; -IHELP: - call cls - cz crlf - call helpban - CALL ILPRT - DB DIM,'Introductory HELP on DU3 (Disk Utility)',BRIGHT,CR,LF - DB ' The DU3 program is designed to provide the user with' - DB CR,LF - DB 'the ability to manipulate information on the disk as easily' - DB CR,LF - DB 'as the DDT and SID utilities allow the user to manipulate' - DB CR,LF - DB 'information in memory.',CR,LF - DB ' The following is a summary of the commands available to' - DB CR,LF - DB 'the DU3 user. This same list is invoked internally by the' - DB CR,LF - DB '? Command of DU3. For additional information on disk' - DB CR,LF - DB 'structures and how to use DU3 in general, refer to the' - DB CR,LF - DB 'file DU3.HLP.',CR,LF,0 - MVI A,0FFH ;A=0FFH - STA IHFLG ;SET INITIAL HELP - CALL SWAIT - JMP HELP1 ;PROCESS NORMALLY -HELP: - XRA A ;A=0 - STA IHFLG ;SET NO INITIAL HELP -HELP1: - call cls - cz crlf - call helpban ;print help banner - CALL ILPRT - DB 'Operands in brackets [...] are optional' - DB CR,LF,CR,LF - DB ' @ ',DIM,'Repeat Previous Non-@ Command Line' - DB BRIGHT,CR,LF - DB ' +[nn] ',DIM,'Step In [nn (decimal)] Sectors' - DB BRIGHT,CR,LF - DB ' -[nn] ',DIM,'Step Out [nn (decimal)] Sectors' - DB BRIGHT,CR,LF - DB DIM - DB ' Note: + or - need not be followed by a "," to ' - DB 'delimit commands.' - DB BRIGHT - DB CR,LF - DB ' # ',DIM,'Print Disk Parameters for Current Drive' - DB BRIGHT - DB CR,LF - DB ' =xxx ',DIM - DB 'Search for ASCII xxx from Current Sector' - DB BRIGHT - DB CR,LF - DB DIM - DB ' Note: upper/lower case matters. Use for hex:' - DB BRIGHT - DB CR,LF - DB DIM - DB ' To find "IN 0" use: =<0> or' - DB BRIGHT - DB CR,LF - DB DIM - DB ' "(tab)H,0(CR)(LF)" use: =<9>H,0' - DB BRIGHT - DB CR,LF - DB ' *[nn] ',DIM,'Repeat [nn (decimal) times]' - DB BRIGHT,CR,LF - DB ' ! ',DIM,'Pause for User',BRIGHT,CR,LF - DB ' :ntext ',DIM,'Define ''text'' to be Macro n' - DB BRIGHT,CR,LF - DB ' n ',DIM,'Perform Macro n, 0<=n<=9',BRIGHT,CR,LF - DB ' :Pn ',DIM,'Print Macro n, 0<=n<=9',BRIGHT - DB CR,LF - DB ' :Px ',DIM - DB 'Print All Macros if x=A or Print Prev Line if x=@' - DB BRIGHT - DB 0 - CALL SWAIT - call cls - cz crlf - call helpban - CALL ILPRT - DB ' A[ff,tt] ',DIM,'ASCII Dump',BRIGHT - DB CR,LF - DB ' C ',DIM,'Change:',BRIGHT - DB CR,LF - DB ' CHaddr byte byte... (hex)' - DB CR,LF - DB ' ',DIM,'or',BRIGHT - DB ' CAaddr data... (Ascii)' - DB CR,LF - DB DIM - DB ' Allowed for imbedded hex.' - DB BRIGHT - DB CR,LF - DB ' ',DIM,'or',BRIGHT - DB ' CHfrom-thru byte e.g. ch0-7f e5' - DB CR,LF - DB ' ',DIM,'or',BRIGHT,' CAfrom-thru byte' - DB CR,LF - DB ' D[ff,tt] ',DIM,'Dump (Hex and ASCII)',BRIGHT - DB CR,LF - DB ' E ',DIM,'DU3 Editor',BRIGHT,CR,LF - DB ' ',DIM,' Note: Rest of Command Line ' - DB 'is Flushed',BRIGHT,CR,LF - DB ' Ffn.ft ',DIM,'Find File',BRIGHT - DB CR,LF - DB ' Gnn ',DIM,'CP/M Allocation Group nn (hex)' - DB BRIGHT,CR,LF - DB ' H[ff,tt] ',DIM,'Hex Dump',BRIGHT - DB CR,LF - DB ' L[d] ',DIM,'Log in Current Drive or Drive d' - DB BRIGHT,CR,LF - DB ' M[nn] ',DIM,'Map [from group nn (hex)]' - DB BRIGHT - DB 0 - CALL SWAIT - call cls - cz crlf - call helpban - CALL ILPRT - DB ' N ',DIM,'Load New Disk',BRIGHT,CR,LF - DB ' P ',DIM,'Toggle Printer Switch',BRIGHT,CR,LF - DB ' Q ',DIM,'Queue Status;',BRIGHT,CR,LF - DB ' QZ ',DIM,'Zero (Empty) Queue',BRIGHT,CR,LF - DB ' QSfn.ft ',DIM,'Save Queue as a File on Disk',BRIGHT - DB CR,LF - DB ' < ',DIM,'Save Current Block into Temp',BRIGHT - DB CR,LF - DB ' > ',DIM,'Restore Temp Block',BRIGHT,CR,LF - DB ' B ',DIM,'Restore Queue Block',BRIGHT,CR,LF - DB ' G[n] ',DIM,'Restore Queue Group',BRIGHT,CR,LF - DB ' Snn ',DIM,'Sector nn (decimal)',BRIGHT,CR,LF - DB ' Tnn ',DIM,'Track nn (decimal)',BRIGHT,CR,LF - DB ' Unn ',DIM,'Set User nn (decimal) for Find command' - DB BRIGHT,CR,LF - DB ' V[nn] ',DIM,'View [nn (decimal)] ASCII Blocks',BRIGHT - DB CR,LF - DB ' R ',DIM,'Read Current Block',BRIGHT,CR,LF - DB ' W ',DIM,'Write Current Block',BRIGHT,CR,LF - DB ' X ',DIM,'Exit Program',BRIGHT,CR,LF - DB ' Z[nn] ',DIM,'Sleep [nn (decimal) seconds]',BRIGHT - DB 0 - CALL SWAIT - call cls - cz crlf - call helpban - CALL ILPRT - DB DIM,'Command Line is of the form: ',BRIGHT,'DU3 du?',CR,LF - DB ' ',DIM,'"d" is Logged-In Disk, "u" is Current User' - DB BRIGHT,CR,LF - DB CR,LF - DB 'Ctrl-C ',DIM,'Cancel a function',BRIGHT,CR,LF - DB 'Ctrl-S ',DIM,'Suspend output',BRIGHT,CR,LF - DB '"," ',DIM,'Separate commands',BRIGHT,CR,LF - DB CR,LF - DB DIM,'Examples:',BRIGHT,' g0 ',DIM,'and',BRIGHT - DB ' +,d,z2,*' - DB CR,LF - DB DIM,'Causes:',BRIGHT,CR,LF - DB ' 1. Position to group 0',CR,LF - DB ' 2. Loops on step in, dump, sleep 2 sec',CR,LF - DB ' until control-c is typed',CR,LF,CR,LF - DB '"nn" usage varies with command as follows:',CR,LF - DB ' +, -, *, T, S, U, V, Z ',DIM,'nn in Decimal' - DB BRIGHT,CR,LF - DB ' ',DIM,'(use #nn for Hex)' - DB BRIGHT,CR,LF - DB ' G, M ',DIM,'nn in Hexadecimal' - DB BRIGHT,CR,LF - DB ' ',DIM,'(use #nn for Decimal)' - DB BRIGHT,CR,LF - DB CR,LF - DB '"ff" and "tt" are in Hexadecimal (use #ff or #tt for Decimal)' - DB 0 - CALL SWAIT - LDA IHFLG ;INITIAL HELP? - ORA A ;0=NO - JNZ EXIT1 ;RETURN TO CP/M IF SO - JMP PRMPTR ;NEW LINE INPUT IF NOT -helpban: - call ilprt - DB ' ',DIM,'-- DU3 Command Summary --',BRIGHT - DB CR,LF,CR,LF,0 - ret -; -;COMMAND: X -;Exit to CP/M -; -EXIT: - call dinit ;deinit terminal - JMP BASE ;WARM BOOT -; -;Quick Exit to CP/M -; -EXIT1: - LHLD DUTSTK ;GET CP/M STACK PTR - SPHL ;SET SP - RET - -; -;******************************** -;* * -;* Utility Subroutines * -;* * -;******************************** -; -GRPCMP: - MOV A,C - INR D - DCR D - JZ CMP8 - CMP M - INX H - RNZ - MOV A,B -; -CMP8: - CMP M - RET -; -;2's complement HL ==> HL -; -NEG: - MOV A,L - CMA - MOV L,A - MOV A,H - CMA - MOV H,A - INX H - RET -; -;HL/2 ==> HL -; -ROTRHL: - ORA A - MOV A,H - RAR - MOV H,A - MOV A,L - RAR - MOV L,A - RET -; -;Collect the number of '1' bits -;in A as a count in C -; -COLECT: - MVI B,8 ;NUMBER OF BITS -; -COLOP: - RAL - JNC COSKIP - INR C -; -COSKIP: - DCR B - JNZ COLOP - RET -; -;HL-DE ==> HL -; Carry Flag is Significant -; -SUBDE: - MOV A,L - SUB E - MOV L,A - MOV A,H - SBB D - MOV H,A - RET -; -;Quick Kludge multiply -;HL*DE ==> HL -; -MULT: - PUSH B - PUSH D - XCHG - MOV B,D - MOV C,E - MOV A,B - ORA C - JNZ MULCON - LXI H,0 ;FILTER SPECIAL CASE - JMP MLDONE ; OF MULTIPLY BY 0 -; -MULCON: - DCX B - MOV D,H - MOV E,L -; -MULTLP: - MOV A,B - ORA C - JZ MLDONE - DAD D - DCX B - JMP MULTLP -; -MLDONE: - POP D - POP B - RET -; -;Routine to fill in disk params -;with every drive change -; -LOGIT: - LXI D,DPB ; THEN MOVE TO LOCAL - MVI B,DPBLEN ; WORKSPACE - CALL MOVE - LXI H,GRPDIS - MOV A,M - PUSH PSW - LDA BLM - MOV M,A - PUSH H - LHLD DSM - XCHG - CALL GTKSEC - SHLD MAXSEC - XCHG - SHLD MAXTRK - POP H - POP PSW - MOV M,A - RET - -;*********************************** -; -; DU3 Command Table -; -;*********************************** -CMDTBL: - DB ' ' ;null command - DW PROMPT -; - DB ':' - DW MAC -; - DB '@' - DW PCMD -; - DB '+' - DW PLUS -; - DB '-' - DW MINUS -; - DB '=' - DW SEARCH -; - DB '<' - DW SAVE -; - DB '>' - DW RESTOR -; - DB '#' - DW STATS -; - DB '?' - DW HELP -; - DB MULCH - DW REPEAT -; - DB '!' - DW UWAIT -; - DB 'A' - DW DUMP -; - DB 'C' - DW CHG -; - DB 'D' - DW DUMP -; - DB 'E' - DW EDIT -; - DB 'F' - DW POSFIL -; - DB 'G' - DW POS -; - DB 'H' - DW DUMP -; - DB 'L' - DW LOGIN -; - DB 'M' - DW MAP -; - DB 'N' - DW NEWDSK -; - DB 'P' - DW PRNTFF -; - DB 'Q' - DW QUEUER -; - DB 'R' - DW DOREAD -; - DB 'S' - DW POS -; - DB 'T' - DW POS -; - DB 'U' - DW USER -; - DB 'V' - DW VIEW -; - DB 'W' - DW DORITE -; - DB 'X' - DW EXIT -; - DB 'Z' - DW SLEEP -; - DB 0 ; End of Table -;************************************* - -; -;Temporary storage area -; -clock: - ds 1 ;clock speed -pagsiz: - ds 1 ;page size -muser: - ds 1 ;max user -mdisk: - ds 1 ;max disk -STKSAV: - DS 2 ;SAVE HL VALUE -DUTSTK: - DS 2 ;OLD CP/M STACK POINTER; TOP OF DU3 STACK -BUFAD: - DS 2 ;FORCES INITIAL READ -QCNT: - DS 2 ;NUMBER OF SECTORS IN QUEUE -QNXT: - DS 2 ;PTR TO NEXT SECTOR IN QUEUE -QLST: - DS 2 ;PTR TO LAST SECTOR IN QUEUE -QPTR: - DS 2 ;G-P QUEUE PTR -HEXAD: - DS 2 ;TO RE-FETCH A VALUE -TOGO: - DS 2 ;REPEAT COUNT (FFFF=CONT) -TWOUP: - DS 1 -UNUM: - DS 1 ;NUMBER OF CURRENT USER -ONLY1: - DS 1 ;FLAG TO PRINT ONLY 1 MAP ENTRY (0=NO) -MFPTR: - DS 2 ;MULTI FILE PTR FOR GETGRP -PAGFLG: - DS 1 ;LINE COUNTER FOR PAGING -PFLAG: - DS 1 ;1=PRINT -GROUP: - DS 2 ;GROUP NUMBER -GRPDIS: - DS 1 ;DISPLACEMENT INTO GROUP -SAVEFL: - DS 1 ;SAVE FLAG -CURTRK: - DS 2 ;CURRENT TRACK NUMBER -CURSEC: - DS 2 ;CURRENT SECTOR NUMBER -PHYSEC: - DS 2 ;CURRENT PHYSICAL SECTOR NUMBER -TABCOL: - DS 1 ;TAB COLUMN -CPYFCT: - DS 1 ;GROUP COPY FUNCTION; 0=READ, 0FFH=WRITE -FILECT: - DS 2 ;FILE COUNT -DIRPOS: - DS 1 ;POSITION IN DIRECTORY -FINDFL: - DS 1 ;1=MUST POSITION AFTER FIND -FTSW: - DS 1 ;SEARCH W/O INCREMENT -NOTPOS: - DS 1 ;INITIALLY NOT POSITIONED -WRFLG: - DS 1 ;MAY NOT WRITE UNTIL '+', '-', -; OR 'G' COMMAND -TGRP: - DS 2 ;TEMPORARY GROUP FLAG -FIRST0: - DS 1 ;SETS TO 0 IF FIRST SEC # IS 0 -DRIVE: - DS 1 ;DRIVE NUMBER -MAXTRK: - DS 2 ;MAX TRACK NUMBER -MAXSEC: - DS 2 ;MAX SECTOR NUMBER -SECTBL: - DS 2 ;POINTER TO SECTOR SKEW TABLE -; -IHFLG: - DS 1 ;0=NOT AT INITIAL HELP, 0FFH=AT INITIAL HELP -DUPFLG: - DS 1 ;SPACE OR STAR TO INDICATE MULTIPLE USERS -BACK: - DS 2 ;TO BACK UP IN "CA0-7F,X" -DUMTYP: - DS 1 -; -;The disk parameter block -;is moved here from CP/M -; -DPB EQU $ ;DISK PARAMETER BLOCK (COPY) -SPT: - DS 2 -BSH: - DS 1 -BLM: - DS 1 -EXM: - DS 1 -DSM: - DS 2 -DRM: - DS 2 -AL0: - DS 1 -AL1: - DS 1 -CKS: - DS 2 -SYSTRK: - DS 2 -; -;End of disk parameter block -; -SAVBUF: - DS 2 -INBUF: - DS 2 ;INPUT LINE BUFFER -PINBUF: - DS 2 ;PREVIOUS CONTENTS OF INPUT BUFFER -CTEMP: - DS 2 ;BUILD NEW COMMAND LINE BUFFER -CTEMPX: - DS 2 ;END OF CTEMP -MTABL: - DS 2 ;10 PAGES FOR 10 MACROS -GBUFF: - DS 2 -DIRECT: - DS 2 -; - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/DU312.LBR b/Source/Images/d_bp/u15/DU312.LBR deleted file mode 100644 index ec5d7797..00000000 Binary files a/Source/Images/d_bp/u15/DU312.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/ECHO.COM b/Source/Images/d_bp/u15/ECHO.COM deleted file mode 100644 index e2f9423f..00000000 Binary files a/Source/Images/d_bp/u15/ECHO.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ECHO.MAC b/Source/Images/d_bp/u15/ECHO.MAC deleted file mode 100644 index cbd4f7ea..00000000 --- a/Source/Images/d_bp/u15/ECHO.MAC +++ /dev/null @@ -1,181 +0,0 @@ -; -; Program: ECHO -; Author: Richard Conn -; Version: 1.0 -; Date: 22 Mar 84 -; -version equ 10 -z3env SET 0F400H ;base address of ZCPR3 Environment Descriptor - -; -; The purpose of ECHO is two-fold: -; 1) to provide a convenient way of sending messages to -; the console during the execution of a command file or multiple command -; line; for example: -; -; echo Assembling;m80 =$1;^E -; if input;echo Linking;l80 /P:100,$1,A:SYSLIB/S,$1/N,/E;fi -; -; as a single multiple command line will print the informative messages of -; "ASSEMBLING" and "LINKING" during the respective phases of the commands -; -; 2) to provide a convenient way to send escape sequences -; to the CRT and printer; ECHO does no character translation, using direct -; BIOS calls, so sequences used to program intelligent devices can be -; issued by running echo and typing in those sequences -; - -; -; Z3LIB and SYSLIB References -; - ext z3init,print - -; -; Equates -; -wboot equ 00h -tbuff equ 80h -fcb1 equ 5ch -cr equ 0dh -ff equ 0ch -lf equ 0ah - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - -; -; Check for Help -; - lda fcb1+1 ;get first char - cpi '/' ;if slash, then print help - jnz echo - call print - db 'ECHO, Version ' - db (version/10)+'0','.',(version mod 10)+'0',cr,lf - db 'Syntax:',cr,lf - db ' ECHO text <-- send text to console',cr,lf - db ' ECHO $text <-- send text to printer',cr,lf - db ' ECHO $text^L <-- send text to printer',cr,lf - db ' terminated by CR,LF,FF' - db 0 - ret -; -; Run ECHO Routine -; -ECHO: - LXI H,TBUFF+1 ;PT TO FIRST CHAR -ECHO1: - MOV A,M ;SKIP LEADING SPACES - INX H ;PT TO NEXT - CPI ' ' - JZ ECHO1 - MOV B,A ;CHAR IN B - CPI '$' ;PRINT FLAG? - JZ ECHO2 - DCX H ;PT TO CHAR -; -; LOOP TO ECHO CHARS -; -ECHO2: - MOV A,M ;GET CHAR - ORA A ;EOL? - JZ ECHO4 - CPI FF ;FORM FEED? - JZ ECHO3 -ECHO2C: - CALL ECHOUT ;SEND CHAR - INX H ;PT TO NEXT - JMP ECHO2 -; -; FORM FEED - SEND NEW LINE FOLLOWED BY FORM FEED IF PRINTER OUTPUT -; -ECHO3: - MOV A,B ;CHECK FOR PRINTER OUTPUT - CPI '$' - JNZ ECHOFF ;SEND FORM FEED NORMALLY IF NOT PRINTER - CALL ECHONL ;SEND NEW LINE - MVI A,FF ;SEND FORM FEED - JMP ECHOUT -; -; SEND FORM FEED CHAR TO CONSOLE -; -ECHOFF: - MVI A,FF ;GET CHAR - JMP ECHO2C -; -; END OF PRINT LOOP - CHECK FOR PRINTER TERMINATION -; -ECHO4: - MOV A,B ;CHECK FOR PRINTER OUTPUT - CPI '$' - RNZ ;DONE IF NO PRINTER OUTPUT -; -; OUTPUT A NEW LINE -; -ECHONL: - MVI A,CR ;OUTPUT NEW LINE ON PRINTER - CALL ECHOUT - MVI A,LF ;FALL THRU TO ECHOUT -; -; OUTPUT CHAR TO PRINTER OR CONSOLE -; -ECHOUT: - MOV C,A ;CHAR IN C - PUSH H ;SAVE HL - PUSH B ;SAVE BC - LXI D,0CH-3 ;OFFSET FOR CONSOLE OUTPUT - MOV A,B ;CHECK FOR PRINTER - CPI '$' - JNZ ECHOUT1 - INX D ;ADD 3 FOR PRINTER OFFSET - INX D - INX D -; -; OUTPUT CHAR IN C WITH BIOS OFFSET IN DE -; -ECHOUT1: - CALL BIOUT ;BIOS OUTPUT - POP B ;RESTORE BC,HL - POP H - RET - -; -; OUTPUT CHAR IN C TO BIOS WITH OFFSET IN DE -; -BIOUT: - LHLD WBOOT+1 ;GET ADDRESS OF WARM BOOT - DAD D ;PT TO ROUTINE - PCHL ;JUMP TO IT - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ERASE.COM b/Source/Images/d_bp/u15/ERASE.COM deleted file mode 100644 index 7862e266..00000000 Binary files a/Source/Images/d_bp/u15/ERASE.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ERASE.MAC b/Source/Images/d_bp/u15/ERASE.MAC deleted file mode 100644 index 6b63b062..00000000 --- a/Source/Images/d_bp/u15/ERASE.MAC +++ /dev/null @@ -1,493 +0,0 @@ -; PROGRAM: ERASE -; VERSION: 5.0 -; DATE: 18 MAY 84 -; AUTHOR: RICHARD CONN -; PREVIOUS VERSION: 4.0 (16 JAN 83) -; PREVIOUS VERSION: 3.3 (6 JAN 83), 3.2 (7 DEC 82) -; PREVIOUS VERSION: 3.1 (9 NOV 82), 3.0 (18 OCT 82), 2.0 (18 NOV 81) -; PREVIOUS VERSION: 1.2 (12 APR 81), 1.3 (25 OCT 81), 1.4 (26 OCT 81) -; PREVIOUS VERSION: 1.0 (14 JUN 80), 1.1 (19 OCT 80) -VERS equ 50 -z3env SET 0f400h - -; -; ERASE COMMAND -- -; Erase files specified in command line. Command is of the form -- -; ERASE DIR:FILENAME.TYP,... ISR -; If I option is given, Inspection of each file is performed and -; the user is given the option to erase the file or not. If S option is -; given, System files are included in erase procedure. Drive specification -; is optional. If R option is given, R/O files are erased without prompting. -; - -FALSE EQU 0 -TRUE EQU NOT FALSE - -ESIZE EQU 16 ; SIZE OF DIR ENTRY (FROM SYSLIB DIRQ ROUTINE) - - EXT DIRQ ; DIRECTORY PROCESSOR - - EXT Z3INIT ; INIT Z3 ENV - EXT ZFNAME ; FILE NAME PARSER - EXT Z3LOG ; LOG INTO Z3 FCB SPEC - - EXT PUTUD ; SAVE CURRENT DU - EXT GETUD ; GET CURRENT DU - EXT PHLDC ; PRINT HL AS DECIMAL CHARS - EXT EPRINT ; PRINT ROUTINE - EXT COUT ; CONSOLE OUTPUT ROUTINE - EXT CIN ; CONSOLE INPUT ROUTINE - EXT CAPS ; CAPITALIZE ROUTINE - EXT CRLF ; NEW LINE ROUTINE - EXT FILLB ; FILL ROUTINE - EXT CODEND ; CODE END COMPUTATION ROUTINE - -; -; CP/M EQUATES -; -CPM EQU 0 ; WARM BOOT -BDOS EQU 5 ; BDOS ENTRY -FCB EQU 5CH ; FCB -BUFF EQU 80H ; INPUT LINE BUFFER -CR EQU 13 ; -LF EQU 10 ; - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env -; - LXI H,0 ; GET STACK PTR - DAD SP - SHLD STACK ; SAVE IT -; -; Compute Buffer Locations -; - CALL CODEND ; DETERMINE FREE SPACE - SHLD CMDLNE ; SET PTR TO COMMAND LINE - LXI D,100H ; BUFFER SIZE - DAD D ; COMMAND LINE - SHLD ERAFCB ; FCB FOR ERASE - DAD D - SHLD DIRBUF ; SET PTR TO DIRECTORY BUFFER - SPHL ; SET STACK PTR -; -; Save Location -; - CALL PUTUD ; SAVE AWAY CURRENT DU - -; -; Print Banner -; - CALL EPRINT - DB 'ERASE Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0',0 - LDA FCB+1 ; GET FIRST CHAR OF FILE NAME - CPI '/' ; OPTION CAUGHT? - JNZ ECONT - -; PRINT HELP INFORMATION -HELP: - CALL EPRINT - DB CR,LF,' ERASE dir:filename.typ,dir:fn.ft,... o...' - DB CR,LF,'Options:' - DB CR,LF,' I -- Inspect Mode' - DB CR,LF,' R -- Erase R/O Files without prompting user' - DB CR,LF,' S -- Include System Files' - DB 0 - JMP RETURN - -; RETURN TO OS -RETURN: - CALL GETUD ; RESET USER IF NECESSARY -RETX: - LHLD STACK ; GET OLD STACK - SPHL ; SET IT - RET - -; COPY BUFFER INTO TEMP BUFFER -ECONT: - LHLD CMDLNE ; PT TO COMMAND LINE - XCHG ; ... IN DE - LXI H,BUFF+1 ; PT TO BUFFER - MVI B,80H ; BUFFER SIZE (MAX) - CALL MOVEB ; COPY INTO COMMAND LINE BUFFER - -; EXTRACT FLAGS IF PRESENT - XRA A ; SET NO INSPECT, NO R/O, AND NO SYSTEM FILES - STA INSPECT - STA READONLY - MVI A,80H ; SELECT NON-SYS - STA SYSTEM - LXI H,0 ; SET FILE COUNT - SHLD FILECNT - LHLD CMDLNE ; PT TO BUFFER - -; SKIP TO FILE NAME STRING -SBLANK: - MOV A,M ; SKIP TO NON-BLANK - CPI ' ' ; ? - JNZ SBL1 - INX H ; PT TO NEXT CHAR - JMP SBLANK - -; SKIP TO END OF FILE NAME STRING -SBL1: - MOV A,M ; SKIP TO OR EOL - ORA A ; DONE? - JZ OPT - CPI ' ' ; - JZ OPT - INX H ; PT TO NEXT - JMP SBL1 - -; CHECK FOR LEADING SLASH ON OPTION AND SKIP IT IF SO -OPT: - CPI '/' ; OPTION CHAR? - JNZ OPTION - INX H ; SKIP SLASH - -; PROCESS LIST OF OPTIONS -OPTION: - MOV A,M ; GET BYTE - ORA A ; DONE? - JZ DSPEC - INX H ; PT TO NEXT CHAR - CPI ' ' ; SKIP OVER SPACES - JZ OPTION - CPI '/' ; IF OPTION LETTER, OBVIOUS ERROR, SO HELP - JZ HELP - CPI 'I' ; INSPECT? - JZ OPTINS - CPI 'R' ; READ/ONLY? - JZ OPTRO - CPI 'S' ; SYSTEM FILES? - JNZ HELP - -; SET SYS SELECTION - MVI A,0C0H ; SET FOR SYS AND NON-SYS FILES - STA SYSTEM - JMP OPTION - -; SET INSPECT OPTION -OPTINS: - MVI A,0FFH ; INSPECT - STA INSPECT - JMP OPTION - -; SET R/O OPTION -OPTRO: - MVI A,0FFH ; SET R/O - STA READONLY - JMP OPTION - -; EXTRACT DISK, USER, AND FILE NAME INFORMATION -DSPEC: - LHLD CMDLNE ; PT TO BEFORE FIRST BYTE - DCX H ; PT TO BEFORE FIRST BYTE FOR FOLLOWING INX -DSPEC0: - INX H ; PT TO BYTE - MOV A,M ; GET BYTE - ORA A ; DONE? - JZ HELP - CPI ' ' ; ? - JZ DSPEC0 -; -; MAJOR REENTRY POINT WHEN FILE SPECS ARE SEPARATED BY COMMAS -; HL PTS TO FIRST BYTE OF NEXT FILE SPEC -; -DSPEC1: - CALL GETUD ; RETURN HOME - LXI D,FCB ; PT TO FCB IN DE, PT TO FIRST CHAR OF FILE NAME IN HL - MVI A,0 ; SCAN FOR DIR FORM BEFORE DU - CALL ZFNAME ; EXTRACT FILE NAME INTO FCB, AND GET DISK AND USER - SHLD NEXTCH ; SAVE PTR TO DELIMITER WHICH ENDED SCAN - LXI H,FCB+1 ; SEE IF FILE NAME IS ALL WILD - MVI B,11 ; 11 BYTES -WTEST: - MOV A,M ; GET BYTE - INX H ; PT TO NEXT - CPI '?' ; WILD? - JNZ NOWILD - DCR B ; COUNT DOWN - JNZ WTEST - LDA INSPECT ; INSPECT? - ORA A ; 0=NO - JNZ NOWILD - CALL EPRINT - DB CR,LF,'Erase All Files? ',0 - CALL CIN ; GET RESPONSE - CALL CAPS ; CAPITALIZE - CALL COUT ; ECHO - CPI 'Y' ; YES? - JZ NOWILD - CALL EPRINT - DB CR,LF,'Aborting',0 - JMP RETX -NOWILD: - LXI D,FCB ; PT TO FCB - CALL Z3LOG ; LOG INTO DIRECTORY - -; LOAD DIRECTORY AND ERASE FILES -ERASE: - LHLD DIRBUF ; PT TO DIR BUFFER - LDA SYSTEM ; GET SYS/NON-SYS FLAGS - LXI D,FCB ; PT TO FCB - CALL DIRQ ; LOAD DIR, SELECT FILES, PACK, AND ALPHABETIZE - -; ERASE DIR FILES; HL PTS TO FIRST FILE, BC=FILE COUNT - CALL ERAFILES - -; CHECK FOR NEXT FILE SPEC - LHLD NEXTCH ; GET PTR - MOV A,M ; GET DELIM - CPI ',' ; ANOTHER FILE? - JNZ ERADONE - INX H ; PT TO CHAR AFTER COMMA - JMP DSPEC1 ; CONTINUE PROCESSING - -; ERASE COMPLETE -- PRINT COUNT AND EXIT -ERADONE: - CALL PRCOUNT ; PRINT FILE COUNT - JMP RETURN - -; ERASE SELECTED FILES -ERAFILES: - MOV A,B ; CHECK FOR ANY FILES LOADED - ORA C - RZ - -; PRINT FILE NAME -ERAFLP: - PUSH B ; SAVE ENTRY COUNT - CALL CRLF ; NEW LINE - PUSH H ; SAVE PTR TO FCB - INX H ; PT TO FILE NAME - MVI B,8 ; PRINT NAME - CALL PRNT - MVI A,'.' ; DECIMAL - CALL COUT - MVI B,3 ; PRINT TYPE - CALL PRNT - POP H ; GET PTR - -; CHECK FOR INSPECTION AND INSPECT IF SET - LDA INSPECT ; GET FLAG - ORA A ; 0=NO - JZ ERAIT - -; PROMPT USER FOR ERASE - CALL ERAQ ; ERASE QUESTION - CPI 'Q' ; QUIT? - JZ QUIT - CPI 'Y' ; YES? - JZ ERAIT - -; DON'T ERASE FILE -ERANO: - CALL EPRINT - DB ' NOT Erased',0 - JMP ERATEST - -; PROMPT USER FOR ERASE -ERAQ: - CALL EPRINT ; PRINT PROMPT - DB ' -- Erase (Y/N/Q=Quit/other=N)? ',0 - CALL CIN ; GET RESPONSE - CALL CAPS ; CAPITALIZE - CALL COUT ; ECHO - RET - -; QUIT ERASE PROGRAM -QUIT: - CALL PRCOUNT ; PRINT COUNT OF FILES ERASED - JMP RETURN - -; ERASE FILE -ERAIT: - PUSH H - LXI D,9 ; PT TO R/O ATTRIBUTE - DAD D - MOV A,M ; GET R/O ATTRIBUTE - POP H ; RESTORE PTR - ANI 80H ; R/O? - JZ ERAIT1 ; R/W - PROCEED - LDA READONLY ; GET R/O ERASE FLAG - ORA A ; 0=QUERY - JNZ ERAIT0 ; ERASE WITHOUT QUESTION IF FLAG SET - CALL EPRINT ; NOTIFY USER AND PROMPT - DB CR,LF,' File is R/O',0 - CALL ERAQ ; ASK QUESTION - CPI 'Q' ; QUIT? - JZ QUIT - CPI 'Y' ; ERASE R/O - JNZ ERATEST ; DO NOT ERASE IF NOT YES - -; ERASE R/O FILE -ERAIT0: - PUSH H ; SAVE PTR TO FILE ENTRY - LXI D,9 ; PT TO R/O ATTRIBUTE - DAD D - MOV A,M ; GET ATTRIBUTE - ANI 7FH ; MAKE R/W - MOV M,A - POP H ; GET PTR TO FCB - PUSH H ; SAVE PTR AGAIN - XCHG ; DE PTS TO FCB - XRA A ; MAKE SURE CURRENT DISK IS SELECTED - STAX D - MVI C,30 ; SET FILE ATTRIBUTES - CALL BDOS - POP H - -; ERASE R/W FILE -ERAIT1: - PUSH H ; SAVE PTR TO FILE NAME TO ERASE - INX H ; PT TO FIRST BYTE OF NAME - PUSH H ; SAVE HL - LHLD ERAFCB ; SET UP FCB - XCHG ; ... IN DE - POP H ; GET HL - PUSH D ; SAVE PTR - XRA A ; A=0 - STAX D ; CURRENT DISK - INX D ; PT TO FIRST CHAR - MVI B,11 ; COPY 11 BYTES - CALL MOVEB ; COPY HL TO DE FOR 11 BYTES - XCHG ; HL PTS TO REST OF FCB - MVI B,24 ; FILL REST OF FCB WITH ZEROES - XRA A ; A=0 - CALL FILLB - POP D ; GET PTR - MVI C,19 ; DELETE FILE - CALL BDOS - CALL EPRINT - DB ' Erased',0 - LHLD FILECNT ; INCREMENT COUNT - INX H - SHLD FILECNT - POP H ; GET PTR TO DIRECTORY ENTRY - -; PT TO NEXT ENTRY -ERATEST: - LXI D,ESIZE ; PT TO NEXT ENTRY - DAD D - POP B ; GET COUNT - DCX B ; COUNT DOWN - MOV A,B ; CHECK FOR ZERO - ORA C - JNZ ERAFLP - -; RETURN TO CALLER - RET - -; -; COPY HL TO DE FOR B BYTES -; -MOVEB: - MOV A,M ; GET BYTE - STAX D ; PUT BYTE - INX H ; PT TO NEXT - INX D - DCR B ; COUNT DOWN - JNZ MOVEB - RET - -; -; PRINT CHARS PTED TO BY HL FOR B BYTES -; -PRNT: - MOV A,M ; GET CHAR - CALL COUT - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ PRNT - RET - -; -; PRINT COUNT OF NUMBER OF FILES ERASED -; -PRCOUNT: - CALL CRLF ; NEW LINE - LHLD FILECNT ; GET COUNT - MOV A,L ; CHECK FOR NONE - ORA H - JZ PRNO - CALL PHLDC ; PRINT DECIMAL COUNT - JMP PRMS -PRNO: - CALL EPRINT - DB 'No',0 -PRMS: - LHLD FILECNT ; 1 FILE ERASED? - MOV A,H ; HIGH ZERO? - ORA A - JNZ PRMULT - MOV A,L ; LOW ONE? - CPI 1 - JZ PRSING -PRMULT: - CALL EPRINT - DB ' Files Erased',0 - RET -PRSING: - CALL EPRINT - DB ' File Erased',0 - RET - -; -; BUFFERS -; -INSPECT: - DS 1 ; INSPECT FLAG (0=NO, 0FFH=YES) -SYSTEM: - DS 1 ; SYSTEM FLAG (0=NO, 80H=YES) -READONLY: - DS 1 ; READ/ONLY FLAG (0=QUERY FOR R/O, 0FFH=DON'T) -USER: - DS 1 ; NEW USER, OR 0FFH IF NO CHANGE -CURUSER: - DS 1 ; CURRENT USER NUMBER -NEXTCH: - DS 2 ; PTR TO NEXT CHAR IN MULTIFILE COMMAND LINE -FILECNT: - DS 2 ; COUNT OF NUMBER OF FILES ERASED -ERAFCB: - DS 2 ; PTR TO FCB FOR ERASE -CMDLNE: - DS 2 ; PTR TO COMMAND LINE -DIRBUF: - DS 2 ; PTR TO DIRECTORY BUFFER -STACK: - DS 2 ; OLD STACK PTR - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ERROR1.COM b/Source/Images/d_bp/u15/ERROR1.COM deleted file mode 100644 index 3c50b652..00000000 Binary files a/Source/Images/d_bp/u15/ERROR1.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ERROR1.MAC b/Source/Images/d_bp/u15/ERROR1.MAC deleted file mode 100644 index 2527df91..00000000 --- a/Source/Images/d_bp/u15/ERROR1.MAC +++ /dev/null @@ -1,309 +0,0 @@ -; -; Program: ERROR1 -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; -version equ 10 - -; -; This error handler displays the error line to the user and -; provides him with four options as to how to process this line: -; 1. Replace the command in error with a new command -; 2. Skip the command in error and resume execution -; with the next command -; 3. Replace the command line as it now stands -; 4. Throw away the command line and resume user -; control -; -; This program is transportable from one ZCPR3 system to another -; provided it is reassembled with the correct address for the ZCPR3 -; Environment Descriptor (Z3ENV) or DDT is used to patch this address -; (which is the first two bytes after the opening JMP). If an external -; ZCPR3 Environment Descriptor is not available, one will have to be -; provided by setting the Z3ENV equate to 0 and providing SYSENV.LIB in -; the current directory at assembly time. -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -cmtch equ ';' ;comment character -cr equ 0dh -lf equ 0ah - -; -; External Z3LIB and SYSLIB Routines -; - ext z3init - ext print,pstr,codend,capine,bbline,crlf,moveb - ext erradr,puter1,puterc ;Error Handler Routines - ext qprint ;Quiet Mode Prints - ext getefcb,getcl1,qerror ;Z3 Messages et al - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Environment -; -; Print Banner -; - call qprint - db 'ERROR1, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db cr,lf,0 -; -; Determine if Program Invoked as an Error Handler or By the User -; - call qerror ;error? - jz handler ;handle error -; -; Invoked by the User, so Install as an Error Handler -; - call getefcb ;pt to external FCB - jz start1 ;proceed if external FCB not available -; -; Make Name Invoked by User the Name of the Error Handler -; - inx h ;pt to first char - lxi d,ername ;pt to name of error handler message - mvi b,8 ;at most 8 bytes - call moveb ;copy into buffer -; -; Make Command Line in Buffer the Error Handler -; -start1: - lxi h,ername ;make name in buffer the error handler - call puterc ;set command - mvi a,0ffh ;set error code - call puter1 ;set message - call print - db ' Error Handler Installed',0 - ret -; -; Handle Error -; -handler: - call erradr ;get address of error line - xchg ;HL pts to free area, DE pts to error line - call codend ;get ptr to free area - shld badcmd ;save ptr to bad command -; -; Extract Bad Command and Store It in Memory Starting at BADCMD -; DE pts to bad command, HL pts to location to store it at -; -savebad: - ldax d ;get next char - mov m,a ;put it - ora a ;done? - jz sbad1 - cpi cmtch ;check for comment - jz sbad1 - inx h ;pt to next - inx d - jmp savebad -; -; Set ending 0 in bad command buffer and check for continuation -; -sbad1: - mvi m,0 ;store ending zero - inx h ;pt to next - cpi cmtch ;more? - jnz sbad2 - inx d ;pt to rest of command -sbad2: - shld restcmd ;save rest of command line -; -; Extract Rest of Command Line and Store It in Memory Starting at RESTCMD -; -saverest: - ldax d ;get next - mov m,a ;put it - inx h ;pt to next - inx d - ora a ;done? - jnz saverest - shld scratch ;save ptr to scratch area -; -; Prompt User for Action -; -prompt: - call print - db cr,lf,'Error Line is:',cr,lf,' ',0 - call erradr ;get address of error line - call pstr - call print - db cr,lf,cr,lf,'Options are: ' - db cr,lf,' 1. Replace Command in Error with a New Command' - db cr,lf,' Replace ',0 - lhld badcmd - call pstr - call print - db cr,lf,' 2. Advance to Next Command and Resume Processing' - db cr,lf,' Advance to ',0 - lhld restcmd - call pstr - call print - db cr,lf,' 3. Replace Entire Line with a New Line' - db cr,lf,' Replace ',0 - call erradr ;pt to error line - call pstr - call print - db cr,lf,' 4. Throw Away Entire Line and Continue' - db cr,lf,' Throw Away ',0 - call erradr ;pt to error line - call pstr - call print - db cr,lf,cr,lf,'Select Option - ',0 - call capine - call crlf - cpi '1' ;option 1 - jz replace ;replace command in error - cpi '2' ;option 2 - jz advance ;advance to next command - cpi '3' ;option 3 - jz newline ;enter new line - cpi '4' ;option 4 - jz flush ;throw away line - call print - db cr,lf,'Invalid Option - Retry',cr,lf,0 - jmp prompt -; -; Replace Command in Error -; -replace: - call print - db 'Replacement Command?',cr,lf,' ',0 - lhld restcmd ;pt to rest of command line in DE - xchg - mvi a,0ffh ;capitalize - call bbline ;get line from user - call build ;build and run command - jmp prompt ;continue if error -; -; Advance to Rest of Command Line -; -advance: - lhld restcmd ;pt to it - xchg - lxi h,empty ;HL pts to empty command, DE pts to tail - call build ;build and run command - jmp prompt ;continue if error -; -; Enter New Line -; -newline: - call print - db 'New Command?',cr,lf,' ',0 - mvi a,0ffh ;capitalize - call bbline ;get line from user - lxi d,empty ;HL pts to user command, DE pts to empty command - call build ;build and run command - jmp prompt ;continue if error -; -; Flush Commands -; -flush: - ret ;simply exit if no more commands -; -; Build New Command Line in SCRATCH Area and Run it by returning to ZCPR3 -; On input, HL pts to header, DE pts to tail -; -build: - lxi b,1 ;set char count (1 for ending zero) - push d ;save ptr to tail - push h ;save ptr to header - lhld scratch ;pt to scratch area - pop d ;get ptr to header - ldax d ;get first char - ora a ;any there? - cnz copy ;copy line into buffer - pop d ;get ptr to tail - ldax d ;anything there? - ora a - jz bldt ;terminate build if not - mvi m,cmtch ;begin with semicolon - inx h ;pt to next - call copy -bldt: - mvi m,0 ;store ending zero -; -; Store Command Line into MCL Buffer -; - call getcl1 ;pt to command line - cmp c ;check for char count within range - rc - mov a,b ;check for line too long - ora a ;line too long? - rnz ;error if so - lxi d,4 ;pt to first char - push h ;save ptr to current - dad d - pop d ;get ptr to current - xchg ;DE pts to first char position, HL pts to CL buffer - mov m,e ;set address to resume processing - inx h - mov m,d - lhld scratch ;pt to new line - xchg ;in DE, while HL pts to first char position - call copy ;copy it - mov m,a ;store ending zero - pop d ;clear stack - ret ;resume processing -; -; Copy string pted to by DE into buffer pted to by HL -; -copy: - ldax d ;get next char - ora a ;done? - rz - mov m,a ;store it - inx b ;increment count - inx h ;pt to next - inx d - jmp copy -; -; Buffers -; -ername: - db 'ERROR1 ',0 ;name of error handler -empty: - db 0 ;empty command line -badcmd: - ds 2 ;ptr to bad command extracted -restcmd: - ds 2 ;ptr to tail of bad command line -scratch: - ds 2 ;ptr to scratch area used to build new lines - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ERROR2.COM b/Source/Images/d_bp/u15/ERROR2.COM deleted file mode 100644 index 3becfeb2..00000000 Binary files a/Source/Images/d_bp/u15/ERROR2.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ERROR2.MAC b/Source/Images/d_bp/u15/ERROR2.MAC deleted file mode 100644 index 9b8be7b8..00000000 --- a/Source/Images/d_bp/u15/ERROR2.MAC +++ /dev/null @@ -1,368 +0,0 @@ -; -; Program: ERROR2 -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; -version equ 10 - -; -; This error handler displays the error line to the user and -; provides him with four options as to how to process this line: -; 1. Replace the command in error with a new command -; 2. Skip the command in error and resume execution -; with the next command -; 3. Replace the command line as it now stands -; 4. Throw away the command line and resume user -; control -; -; Unlike ERROR1, ERROR2 is screen-oriented, using the Z3TCAP -; for support. -; -; This program is transportable from one ZCPR3 system to another -; provided it is reassembled with the correct address for the ZCPR3 -; Environment Descriptor (Z3ENV) or DDT is used to patch this address -; (which is the first two bytes after the opening JMP). If an external -; ZCPR3 Environment Descriptor is not available, one will have to be -; provided by setting the Z3ENV equate to 0 and providing SYSENV.LIB in -; the current directory at assembly time. -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -cmtch equ ';' ;comment character -cr equ 0dh -lf equ 0ah - -; -; External Z3LIB and SYSLIB Routines -; - ext z3vinit - ext print,pstr,codend,capine,bbline,crlf,moveb - ext erradr,puter1,puterc ;Error Handler Routines - ext qprint ;Quiet Mode Prints - ext getenv,getefcb,getcl1,qerror ;Z3 Messages et al - ext at,cls,stndout,stndend,gotoxy,vprint,gxymsg ;VLIB Routines - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3vinit ;initialize the ZCPR3 Environment -; -; Print Banner -; - call qprint - db 'ERROR2, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db cr,lf,0 -; -; Determine if Program Invoked as an Error Handler or By the User -; - call qerror ;error? - jz handler ;handle error -; -; Invoked by the User, so Install as an Error Handler -; - call getenv ;must have a Z3TCAP entry - lxi d,80h ;pt to Z3TCAP - dad d - mov a,m ;must not be space or less - cpi ' '+1 - jnc start0 - call print - db cr,lf,' No Z3TCAP - Aborting',0 - ret -; -; Determine Name of Routine -; -start0: - call getefcb ;pt to external FCB - jz start1 ;proceed if external FCB not available -; -; Make Name Invoked by User the Name of the Error Handler -; - inx h ;pt to first char - lxi d,ername ;pt to name of error handler message - mvi b,8 ;at most 8 bytes - call moveb ;copy into buffer -; -; Make Command Line in Buffer the Error Handler -; -start1: - lxi h,ername ;make name in buffer the error handler - call puterc ;set command - mvi a,0ffh ;set error code - call puter1 ;set message - call print - db ' Error Handler Installed',0 - ret -; -; Handle Error -; -handler: - call erradr ;get address of error line - xchg ;HL pts to free area, DE pts to error line - call codend ;get ptr to free area - shld badcmd ;save ptr to bad command -; -; Extract Bad Command and Store It in Memory Starting at BADCMD -; DE pts to bad command, HL pts to location to store it at -; -savebad: - ldax d ;get next char - mov m,a ;put it - ora a ;done? - jz sbad1 - cpi cmtch ;check for comment - jz sbad1 - inx h ;pt to next - inx d - jmp savebad -; -; Set ending 0 in bad command buffer and check for continuation -; -sbad1: - mvi m,0 ;store ending zero - inx h ;pt to next - cpi cmtch ;more? - jnz sbad2 - inx d ;pt to rest of command -sbad2: - shld restcmd ;save rest of command line -; -; Extract Rest of Command Line and Store It in Memory Starting at RESTCMD -; -saverest: - ldax d ;get next - mov m,a ;put it - inx h ;pt to next - inx d - ora a ;done? - jnz saverest - shld scratch ;save ptr to scratch area -; -; Prompt User for Action -; -prompt: - call cls ;clear screen - call gxymsg - db 3,22 - db '>>>> ',1,'VIDEO ERROR HANDLER',2,' <<<<',0 - call gxymsg - db 5,28 - db '-- Error Line --',0 - call at - db 6,10 - call stndout ;reverse video - call erradr ;get address of error line - call pstr - call stndend ;normal video - mvi h,10 ;position cursor - mvi l,15 - shld infoxy - call gxymsg - db 8,30 - db '-- Options --',0 - call atinfo - call vprint - db '1. Replace Command in Error with a New Command',0 - call atinfo - call vprint - db ' Replace ',1,0 - lhld badcmd - call pstr - call atinfo - call atinfo - call vprint - db 2,'2. Advance to Next Command and Resume Processing',0 - call atinfo - call vprint - db ' Advance to ',1,0 - lhld restcmd - call pstr - call atinfo - call atinfo - call vprint - db 2,'3. Replace Entire Line with a New Line',0 - call atinfo - call vprint - db ' Replace ',1,0 - call erradr ;pt to error line - call pstr - call atinfo - call atinfo - call vprint - db 2,'4. Throw Away Entire Line and Continue',0 - call atinfo - call vprint - db ' Throw Away ',1,0 - call erradr ;pt to error line - call pstr - call stndend -userin: - call gxymsg - db 22,20 - db 'Select Option - ',0 - call capine - cpi '1' ;option 1 - jz replace ;replace command in error - cpi '2' ;option 2 - jz advance ;advance to next command - cpi '3' ;option 3 - jz newline ;enter new line - cpi '4' ;option 4 - jz flush ;throw away line - call print - db 8,' Invalid Option - Retry',0 ;backspace over error - jmp userin -; -; Position at INFOXY and advance ptr to next line -; -atinfo: - lhld infoxy ;pt to next position - call gotoxy ;go there - inr h ;next line - shld infoxy - ret -; -; Replace Command in Error -; -replace: - call print - db ' Replacement Command?',cr,lf,' ',0 - lhld restcmd ;pt to rest of command line in DE - xchg - mvi a,0ffh ;capitalize - call bbline ;get line from user - call build ;build and run command - jmp prompt ;continue if error -; -; Advance to Rest of Command Line -; -advance: - lhld restcmd ;pt to it - xchg - lxi h,empty ;HL pts to empty command, DE pts to tail - call build ;build and run command - jmp prompt ;continue if error -; -; Enter New Line -; -newline: - call print - db ' New Command?',cr,lf,' ',0 - mvi a,0ffh ;capitalize - call bbline ;get line from user - lxi d,empty ;HL pts to user command, DE pts to empty command - call build ;build and run command - jmp prompt ;continue if error -; -; Flush Commands -; -flush: - ret ;simply exit if no more commands -; -; Build New Command Line in SCRATCH Area and Run it by returning to ZCPR3 -; On input, HL pts to header, DE pts to tail -; -build: - lxi b,1 ;set char count (1 for ending zero) - push d ;save ptr to tail - push h ;save ptr to header - lhld scratch ;pt to scratch area - pop d ;get ptr to header - ldax d ;get first char - ora a ;any there? - cnz copy ;copy line into buffer - pop d ;get ptr to tail - ldax d ;anything there? - ora a - jz bldt ;terminate build if not - mvi m,cmtch ;begin with semicolon - inx h ;pt to next - call copy -bldt: - mvi m,0 ;store ending zero -; -; Store Command Line into MCL Buffer -; - call getcl1 ;pt to command line - cmp c ;check for char count within range - rc - mov a,b ;check for line too long - ora a ;line too long? - rnz ;error if so - lxi d,4 ;pt to first char - push h ;save ptr to current - dad d - pop d ;get ptr to current - xchg ;DE pts to first char position, HL pts to CL buffer - mov m,e ;set address to resume processing - inx h - mov m,d - lhld scratch ;pt to new line - xchg ;in DE, while HL pts to first char position - call copy ;copy it - mov m,a ;store ending zero - pop d ;clear stack - ret ;resume processing -; -; Copy string pted to by DE into buffer pted to by HL -; -copy: - ldax d ;get next char - ora a ;done? - rz - mov m,a ;store it - inx b ;increment count - inx h ;pt to next - inx d - jmp copy -; -; Buffers -; -ername: - db 'ERROR2 ',0 ;name of error handler -empty: - db 0 ;empty command line -infoxy: - ds 2 ;xy-coordinate for display -badcmd: - ds 2 ;ptr to bad command extracted -restcmd: - ds 2 ;ptr to tail of bad command line -scratch: - ds 2 ;ptr to scratch area used to build new lines - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ERROR3.COM b/Source/Images/d_bp/u15/ERROR3.COM deleted file mode 100644 index 50755b22..00000000 Binary files a/Source/Images/d_bp/u15/ERROR3.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ERROR3.MAC b/Source/Images/d_bp/u15/ERROR3.MAC deleted file mode 100644 index 49e79a21..00000000 --- a/Source/Images/d_bp/u15/ERROR3.MAC +++ /dev/null @@ -1,154 +0,0 @@ -; -; Program: ERROR3 -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; -version equ 10 - -; -; This error handler displays the name of the COM file which was -; not found and then flushes the command line, returning control to the -; user. -; -; This program is transportable from one ZCPR3 system to another -; provided it is reassembled with the correct address for the ZCPR3 -; Environment Descriptor (Z3ENV) or DDT is used to patch this address -; (which is the first two bytes after the opening JMP). If an external -; ZCPR3 Environment Descriptor is not available, one will have to be -; provided by setting the Z3ENV equate to 0 and providing SYSENV.LIB in -; the current directory at assembly time. -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -cmtch equ ';' ;comment character -cr equ 0dh -lf equ 0ah - -; -; External Z3LIB and SYSLIB Routines -; - ext z3init - ext print,pstr,codend,moveb - ext erradr,puter1,puterc ;Error Handler Routines - ext getefcb,getcl1,qerror ;Z3 Messages et al - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Environment -; -; Determine if Program Invoked as an Error Handler or By the User -; - call qerror ;error? - jz handler ;handle error -; -; Invoked by the User, so Install as an Error Handler -; - call getefcb ;pt to external FCB - jz start1 ;proceed if external FCB not available -; -; Make Name Invoked by User the Name of the Error Handler -; - inx h ;pt to first char - lxi d,ername ;pt to name of error handler message - mvi b,8 ;at most 8 bytes - call moveb ;copy into buffer -; -; Make Command Line in Buffer the Error Handler -; -start1: - lxi h,ername ;make name in buffer the error handler - call puterc ;set command - mvi a,0ffh ;set error code - call puter1 ;set message - call print - db 'ERROR3, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db cr,lf,' Error Handler Installed',0 - ret -; -; Handle Error -; -handler: - call erradr ;get address of error line - xchg ;HL pts to free area, DE pts to error line - call codend ;get ptr to free area -; -; Extract Bad Command and Store It in Memory Starting at CODEND -; DE pts to bad command, HL pts to location to store it at -; -savebad: - ldax d ;get next char - mov m,a ;put it - ora a ;done? - jz sbad1 - cpi cmtch ;check for comment - jz sbad1 - cpi ' ' ;check for space - jz sbad1 - inx h ;pt to next - inx d - jmp savebad -; -; Set ending 0 in bad command buffer and print error message and command -; -sbad1: - mvi m,0 ;store ending zero - call print - db ' File ',0 - call codend ;pt to name - call pstr - call print - db '.COM Not Found',0 - call getcl1 ;pt to command line buffer - lxi d,4 ;pt to first char position - push h ;save current ptr - dad d - mvi m,0 ;zero command line - xchg ;DE pts to command line - pop h - mov m,e ;store address - inx h - mov m,d - ret - -; -; Buffers -; -ername: - db 'ERROR3 ',0 ;name of error handler - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ERROR4.COM b/Source/Images/d_bp/u15/ERROR4.COM deleted file mode 100644 index 1aaf537d..00000000 Binary files a/Source/Images/d_bp/u15/ERROR4.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ERROR4.MAC b/Source/Images/d_bp/u15/ERROR4.MAC deleted file mode 100644 index 364ba928..00000000 --- a/Source/Images/d_bp/u15/ERROR4.MAC +++ /dev/null @@ -1,179 +0,0 @@ -; -; Program: ERROR4 -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; -version equ 10 - -; -; This error handler prints the name of the COM file which was not -; found and then advances to the next entry (assuming a multiple command -; line) and resumes with the next command in the line. -; -; This program is transportable from one ZCPR3 system to another -; provided it is reassembled with the correct address for the ZCPR3 -; Environment Descriptor (Z3ENV) or DDT is used to patch this address -; (which is the first two bytes after the opening JMP). If an external -; ZCPR3 Environment Descriptor is not available, one will have to be -; provided by setting the Z3ENV equate to 0 and providing SYSENV.LIB in -; the current directory at assembly time. -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -cmtch equ ';' ;comment character -cr equ 0dh -lf equ 0ah - -; -; External Z3LIB and SYSLIB Routines -; - ext z3init - ext print,pstr,codend,moveb - ext erradr,puter1,puterc ;Error Handler Routines - ext getefcb,getcl1,qerror ;Z3 Messages et al - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Environment -; -; Determine if Program Invoked as an Error Handler or By the User -; - call qerror ;error? - jz handler ;handle error -; -; Invoked by the User, so Install as an Error Handler -; - call getefcb ;pt to external FCB - jz start1 ;proceed if external FCB not available -; -; Make Name Invoked by User the Name of the Error Handler -; - inx h ;pt to first char - lxi d,ername ;pt to name of error handler message - mvi b,8 ;at most 8 bytes - call moveb ;copy into buffer -; -; Make Command Line in Buffer the Error Handler -; -start1: - lxi h,ername ;make name in buffer the error handler - call puterc ;set command - mvi a,0ffh ;set error code - call puter1 ;set message - call print - db 'ERROR4, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db cr,lf,' Error Handler Installed',0 - ret -; -; Handle Error -; -handler: - call erradr ;get address of error line - xchg ;HL pts to free area, DE pts to error line - call codend ;get ptr to free area -; -; Extract Bad Command and Store It in Memory Starting at CODEND -; DE pts to bad command, HL pts to location to store it at -; -savebad: - ldax d ;get next char - mov m,a ;put it - ora a ;done? - jz sbad1 - cpi cmtch ;check for comment - jz sbad1 - cpi ' ' ;check for space - jz sbad1 - inx h ;pt to next - inx d - jmp savebad -; -; Set ending 0 in bad command buffer and print error message and command -; -sbad1: - mvi m,0 ;store ending zero - call print - db ' File ',0 - call codend ;pt to name - call pstr - call print - db '.COM Not Found',0 -; -; Advance to Next Entry in Error Line -; - call erradr ;pt to error -sbad2: - mov a,m ;skip to comment or eol - ora a ;eol? - jz sbad3 - inx h ;pt to next - cpi cmtch ;comment? - jnz sbad2 -; -; Set Up Command Line Pointer -; -sbad3: - push h ;save ptr to error text - call getcl1 ;pt to command line buffer - lxi d,4 ;pt to first char position - xchg - dad d - xchg ;DE pts to command line - mov m,e ;store address - inx h - mov m,d - pop h ;HL pts to next command, DE pts to cmd line -; -; Set Up Command Line Contents -; -sbad4: - mov a,m ;copy - stax d - inx h ;pt to next - inx d - ora a ;done? - jnz sbad4 - ret - -; -; Buffers -; -ername: - db 'ERROR4 ',0 ;name of error handler - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ERRORX.COM b/Source/Images/d_bp/u15/ERRORX.COM deleted file mode 100644 index 9446a567..00000000 Binary files a/Source/Images/d_bp/u15/ERRORX.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ERRORX.MAC b/Source/Images/d_bp/u15/ERRORX.MAC deleted file mode 100644 index 14b1993c..00000000 --- a/Source/Images/d_bp/u15/ERRORX.MAC +++ /dev/null @@ -1,69 +0,0 @@ -; -; Program: ERRORX -; Author: Richard Conn -; Version: 1.0 -; Date: 29 Mar 84 -; -version equ 10 -z3env SET 0f400H - -; -; ERRORX disengages the current error handler. No error handler -; is available after ERRORX executes. -; - -; -; SYSLIB and Z3LIB References -; - ext z3init,puter1,print - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - -; -; Turn Off Message -; - mvi a,0 ;turn off error handler - call puter1 ;use SYSLIB routine - -; -; Print Message -; - call print - db 'ERRORX Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db ' -- Error Handler Disengaged',0 - ret - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/FILES.BBS b/Source/Images/d_bp/u15/FILES.BBS deleted file mode 100644 index 4ce23a7e..00000000 --- a/Source/Images/d_bp/u15/FILES.BBS +++ /dev/null @@ -1,363 +0,0 @@ - CP/M CDROM, Sep. 1994. Walnut Creek CDROM. - ------------------------------------------- - ZCPR3 software from Echelon - path: \zsys\simtel20\zcpr3 - ------------------------------------------- -ALIAS-1.LBR -ALIAS-2.LBR -ALIAS.COM -ALIAS.HLP -ALIAS.HQP -ALIAS.ZEX -ALIAS.ZQX -ALIAS0.MAC -ALIAS0.MQC -ALIAS1.MAC -ALIAS1.MQC -CD.COM -CD.MAC -CD.MQC -CLEAND15.LBR -CLEANDIR.COM -CLEANDIR.MAC -CLEANDIR.MQC -CLNDR13B.LBR -CMD.COM -CMD.MAC -CMD.MQC -CMDFILES.HLP -CMDFILES.HQP -CMDRUN.COM -CMDRUN.MAC -CMDRUN.MQC -COMMENT.COM -COMMENT.MAC -COMMENT.MQC -COMPARE.HLP -COMPARE.HQP -CPSEL.COM -CPSEL.MAC -CPSEL.MQC -CRC.COM -CRC.MAC -CRC.MQC -DBRCPREL.LBR -DEBUGRCP.AQM -DEBUGRCP.ASM -DEV.COM -DEV.MAC -DEV.MQC -DEV10.LBR -DEVICE.COM -DEVICE.MAC -DEVICE.MQC -DEVICE10.LBR -DIFF.COM -DIFF.MAC -DIFF.MQC -DIFF21.LBR -DIR.COM -DIR.MAC -DIR.MQC -DIR14.LBR -DIRS.HLP -DIRS.HQP -DPGFILE.LBR -DPROG.COM -DPROG.HLP -DPROG.HQP -DPROG.MAC -DPROG.MQC -DPROG12.LBR -DU3.COM -DU3.HLP -DU3.HQP -DU3.MAC -DU3.MQC -DU312.LBR -ECHO.COM -ECHO.MAC -ECHO.MQC -ERASE.COM -ERASE.MAC -ERASE.MQC -ERROR1.COM -ERROR1.MAC -ERROR1.MQC -ERROR2.COM -ERROR2.MAC -ERROR2.MQC -ERROR3.COM -ERROR3.MAC -ERROR3.MQC -ERROR4.COM -ERROR4.MAC -ERROR4.MQC -ERRORX.COM -ERRORX.MAC -ERRORX.MQC -FINDF.COM -FINDF.MAC -FINDF.MQC -FINDF26.LBR -FINDF26A.LBR -GOTO.COM -GOTO.MAC -GOTO.MQC -GRDEMO.LBR -HELP.COM -HELP.HLP -HELP.HQP -HELP.MAC -HELP.MQC -HELPCK.COM -HELPCK.MAC -HELPCK.MQC -HELPPR.COM -HELPPR.MAC -HELPPR.MQC -HELPSYS.HLP -HELPSYS.HQP -IF.COM -IF.HLP -IF.HQP -IF.MAC -IF.MQC -IFSTAT.COM -IFSTAT.MAC -IFSTAT.MQC -IO.HLP -IO.HQP -LDR-UPD.COM -LDR-UPD.MSG -LDR.COM -LDR.MAC -LDR.MQC -LDR15.LBR -LGET11.LBR -LLF11.LBR -LUZ3.LBR -LX12.LBR -LX14.LBR -MCOPY.COM -MCOPY.MAC -MCOPY.MQC -MCOPY44.LBR -MCOPY45B.LBR -MENU.COM -MENU.HLP -MENU.HQP -MENU.MAC -MENU.MQC -MENUCK.COM -MENUCK.MAC -MENUCK.MQC -MKDIR.COM -MKDIR.MAC -MKDIR.MQC -MU3.COM -MU3.HLP -MU3.HQP -MU3.MAC -MU3.MQC -NDIRS.HLP -NDIRS.HQP -NEWTCAP.Z80 -NEWTCAP.ZZ0 -NOTE.COM -NOTE.MAC -NOTE.MQC -PAGE.COM -PAGE.MAC -PAGE.MQC -PATH.COM -PATH.MAC -PATH.MQC -PATH31.LBR -PPAL.DOC -PRINT.COM -PRINT.MAC -PRINT.MQC -PRINTHLP.LBR -PROTECT.COM -PROTECT.MAC -PROTECT.MQC -PWD.COM -PWD.MAC -PWD.MQC -QUIET.COM -QUIET.MAC -QUIET.MQC -READ.ME -READ.MQ -RECORD.COM -RECORD.MAC -RECORD.MQC -REG.COM -REG.MAC -REG.MQC -RENAME.COM -RENAME.MAC -RENAME.MQC -RENAME31.LBR -SAK.COM -SAK.MAC -SAK.MQC -SETFILE.COM -SETFILE.MAC -SETFILE.MQC -SF.COM -SF.Z80 -SH.COM -SH.HLP -SH.HQP -SH.MAC -SH.MQC -SH11.LBR -SHCTRL.COM -SHCTRL.MAC -SHCTRL.MQC -SHDEFINE.COM -SHDEFINE.MAC -SHDEFINE.MQC -SHFILE.COM -SHFILE.MAC -SHFILE.MQC -SHOW.COM -SHOW.MAC -SHOW.MQC -SHSET.COM -SHSET.MAC -SHSET.MQC -SHUTILS2.LBR -SHVAR.COM -SHVAR.MAC -SHVAR.MQC -SHVAR11.LBR -SUB.COM -SUB.MAC -SUB.MQC -SYSENV.AQM -SYSENV.ASM -SYSENV.LIB -SYSENV.LQB -SYSFCP.AQM -SYSFCP.ASM -SYSFCP1.LIB -SYSFCP1.LQB -SYSFCP11.LBR -SYSFCP2.LIB -SYSFCP2.LQB -SYSIOP.AQM -SYSIOP.ASM -SYSNDR.AQM -SYSNDR.ASM -SYSNDR.LIB -SYSNDR.LQB -SYSRCP.AQM -SYSRCP.ASM -SYSRCP.HLP -SYSRCP.HQP -SYSRCP1.LIB -SYSRCP1.LQB -SYSRCP11.LBR -SYSRCP2.LIB -SYSRCP2.LQB -SYSRCP3.LIB -SYSRCP3.LQB -SYSRCP4.LIB -SYSRCP4.LQB -T3M-HI2.Z80 -T3M-HI2.ZZ0 -T3T-24-1.Z80 -T3T-24-1.ZQ0 -TCCHECK.COM -TCCHECK.MAC -TCCHECK.MQC -TCMAKE.COM -TCMAKE.MAC -TCMAKE.MQC -TCSELECT.COM -TCSELECT.MAC -TCSELECT.MQC -UNERASE.COM -UNERASE.MAC -UNERASE.MQC -VF-BOX11.LBR -VF41.IQF -VF41H.LBR -VF42A.LBR -VFILER.COM -VFILER.HLP -VFILER.HQP -VFILER.MAC -VFILER.MQC -VFILR4-1.LBR -VFILR4-2.LBR -VMENU.COM -VMENU.HLP -VMENU.HQP -VMENU.MAC -VMENU.MQC -VMENU24.LBR -VMENUCK.COM -VMENUCK.MAC -VMENUCK.MQC -VMENUFUN.LBR -WHEEL.COM -WHEEL.MAC -WHEEL.MQC -WYSE.DPG -XD.COM -XD.MAC -XD.MQC -XDIR.COM -XDIR.MAC -XDIR.MQC -Z3BASE1.LIB -Z3BASE1.LQB -Z3BASE2.LIB -Z3BASE2.LQB -Z3FILES.PH1 -Z3FILES.PH2 -Z3FILES.PQ2 -Z3FILES2.PH2 -Z3FILES2.PQ2 -Z3HDR1.LIB -Z3HDR1.LQB -Z3HDR2.LIB -Z3HDR2.LQB -Z3LDRBUG.LBR -Z3LOC.COM -Z3LOC.MAC -Z3LOC.MQC -Z3LOC11.LBR -Z3RES.HLP -Z3RES.HQP -Z3TCAP.AQM -Z3TCAP.ASM -Z3TCAP.HLP -Z3TCAP.HQP -Z3TCAP.TCP -Z3TCAP.TQP -Z3TCAP22.LBR -Z3UTIL1.HLP -Z3UTIL1.HQP -Z3UTIL2.HLP -Z3UTIL2.HQP -Z3UTIL3.HLP -Z3UTIL3.HQP -ZCPR3.AQM -ZCPR3.ASM -ZCPR3.HLP -ZCPR3.HQP -ZCPR3.INS -ZCPR3.IQS -ZCPR3DIR.BQG -ZCPR3DIR.BUG -ZEX.AQM -ZEX.ASM -ZEX.COM -ZEX.ZEX -ZEX.ZQX -ZSYSTEM.INS diff --git a/Source/Images/d_bp/u15/FINDF.COM b/Source/Images/d_bp/u15/FINDF.COM deleted file mode 100644 index 52362f8b..00000000 Binary files a/Source/Images/d_bp/u15/FINDF.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/FINDF.MAC b/Source/Images/d_bp/u15/FINDF.MAC deleted file mode 100644 index d606ca23..00000000 --- a/Source/Images/d_bp/u15/FINDF.MAC +++ /dev/null @@ -1,1050 +0,0 @@ -; PROGRAM: FINDF -; AUTHOR: RICHARD CONN -; VERSION: 2.0 -; DATE: 18 May 84 -; PREVIOUS VERSIONS: 1.1 (25 July 83), 1.0 (24 JULY 83) -; -VERS EQU 20 ;version number -z3env SET 0f400h - -; -; FINDF searches through all of the known disks for one or more -; files matching the passed file specification. AFNs (Ambiguous File Names) -; are permitted. FINDF is invoked by the following command line: -; FINDF afn,afn,afn,... o -; where "afn" refers to the file sought and "o" is none or more of: -; S - Include System Files -; - -; -; System equates: -; -BOOT EQU 0000H ;CP/M WARM BOOT JUMP VECTOR -BDOS EQU BOOT+05H ;CP/M BDOS CALL JUMP VECTOR -TBUFF EQU BOOT+80H ;DISK I/O BUFFER -FCB EQU BOOT+5CH ;DEFAULT FILE CONTROL BLOCK -CR EQU 'M'-'@' ;CTL-M FOR CARRIAGE RETURN -LF EQU 'J'-'@' ;CTL-J FOR LINE FEED -CTRLC EQU 'C'-'@' ;ABORT -CTRLS EQU 'S'-'@' ;PAUSE -ESIZE EQU 12 ;12 BYTES/DIR ENTRY - -; -; SYSLIB and Z3LIB Routines -; - ext z3init,codend - ext cout,crlf,print,padc - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - LXI H,0 ;SAVE STACK PTR - DAD SP - SHLD STACK - CALL CODEND ;DETERMINE FREE SPACE - SHLD FNTAB ;FILE NAME TABLE - LXI D,512 ;1/2 K SPACE - DAD D - SHLD SCRATCH ;BEGINNING OF SCRATCH AREA - SPHL ;AND TOP OF STACK - CALL GTBIOS ;GET BIOS JUMP TABLE - CALL HELLO ;SIGN ON MESSAGE - CALL HELPCHK ;CHECK FOR AND PRINT HELP MESSAGE - CALL OPTCHK ;BUILD FILE NAME TABLE AND PROCESS OPTIONS - CALL CRLF ;NEW LINE - CALL FIND ;DO THE SEARCHES - CALL BYE ;SIGN OFF MESSAGE -RETURN: - LHLD STACK ;QUIET RETURN - SPHL - RET -; -; ** Main Routines ** -; - -; -; SAY WHO WE ARE -; -HELLO: - CALL PRINT - DB 'FINDF, Version ' - DB (VERS/10)+'0','.',(VERS MOD 10)+'0' - DB 0 - RET -; -; CHECK FOR HELP REQUEST -; -HELPCHK: - LDA FCB+1 ;GET 1ST BYTE OF FILENAME - CPI '/' ;HELP? - JZ HCK1 - CPI ' ' ;MAKE SURE IT IS NON-BLANK - RNZ ;OK - KEEP GOING -; -; IF NO FILE NAME IS SPECIFIED, ABORT WITH NOTICE -; -HCK1: - CALL PRINT - db cr,lf,'Syntax:' - DB CR,LF,' FINDF afn,afn,afn,... o' - db cr,lf,'Options:' - DB CR,LF,' S - Include System Files' - DB 0 - JMP RETURN -; -; CHECKS FOR S OPTION IN COMMAND LINE AND EXTRACTS FILE NAMES INTO TABLE -; -OPTCHK: - XRA A ;TURN OFF FLAGS - STA SYSTEM ;NO SYSTEM FILES - STA FFLAG ;NO FILES FOUND - STA ECOUNT ;NO ENTRIES - STA FNCOUNT ;NO FILE NAMES - LHLD FNTAB ;PT TO TABLE - XCHG ;... IN DE - LXI H,TBUFF+1 ;SCAN THRU TBUFF, BUILDING A FILE NAME TABLE - CALL SBLANK ;SKIP BLANKS -FNLOOP: - PUSH D ;SAVE TABLE PTR - CALL GETFN ;EXTRACT FILE NAME - POP D - PUSH H - LXI H,11 ;PT TO NEXT TABLE ENTRY - DAD D - XCHG - POP H - LDA FNCOUNT ;INCREMENT COUNT - INR A - STA FNCOUNT - MOV A,M ;GET TERMINATING CHAR - INX H ;PT TO NEXT - CPI ',' ;ANOTHER FOLLOWS? - JZ FNLOOP - DCX H ;POINT BACK TO DELIM - CALL SBLANK ;SKIP TO NON-BLANK -OPTCK1: - MOV A,M ;GET OPTION - CALL DELCHK ;DONE IF DELIM - RZ - CPI 'S' ;SYSTEM? - JZ OPTCKS - CALL PRINT - DB CR,LF,'Invalid Option -- ',0 - MOV A,M - CALL COUT - JMP HCK1 -OPTCKS: - MVI A,0FFH ;SET FLAG - STA SYSTEM - INX H - JMP OPTCK1 -GETFN: - PUSH D ;FILL TARGET FCB - MVI B,11 ;11 BYTES - MVI A,' ' ;SPACE FILL -GETFN0: - STAX D ;PUT SPACE - INX D - DCR B - JNZ GETFN0 - POP D ;PT TO ENTRY AGAIN - CALL SCANCOL ;SCAN FOR COLON - MVI B,8 ;8 CHARS MAX - CALL GETFN1 ;GET AND FILL ENTRY - MOV A,M ;GET CHAR - CPI '.' ;DELIM? - RNZ ;DONE - INX H ;PT TO AFTER PERIOD - MVI B,3 ;3 CHARS MAX AND DO IT AGAIN -GETFN1: - MOV A,M ;GET CHAR - CPI '.' ;END OF FIELD? - JZ GETFN3 - CALL DELCHK ;CHECK DELIMITER - RZ - CPI '*' ;WILD? - JZ GETFNQ - STAX D ;STORE CHAR - INX H ;PT TO NEXT - INX D - DCR B ;COUNT DOWN - JNZ GETFN1 -GETFN2: - MOV A,M ;FLUSH CHARS TO DELIM - CALL DELCHK ;CHECK FOR DELIMITER - RZ - INX H ;PT TO NEXT - JMP GETFN2 -GETFN3: - INX D ;PT TO AFTER FIELD - DCR B ;COUNT DOWN - JNZ GETFN3 - RET -GETFNQ: - MVI A,'?' ;FILL WITH QUESTION MARKS - STAX D - INX D - DCR B - JNZ GETFNQ - JMP GETFN2 ;SKIP TO DELIM -DELCHK: - ORA A ;END OF LINE? - RZ - CPI '.' ;END OF FIELD? - RZ - CPI ',' ;END OF ENTRY? - RZ - CPI ' ' - RET -SBLANK: - MOV A,M ;SKIP TO NON-BLANK - CPI ' ' - RNZ - INX H - JMP SBLANK -SCANCOL: - PUSH D ;SAVE TABLE PTR - PUSH H ;SAVE PTR -SCOL1: - MOV A,M ;GET CHAR - INX H ;PT TO NEXT - CPI ':' ;COLON? - JZ SCOLX - CALL DELCHK ;CHECK FOR DELIMITER - JNZ SCOL1 -SCOL2: - POP H ;RESTORE - POP D - RET -SCOLX: - XCHG ;DE PTS TO AFTER COLON - POP H ;GET OLD PTR - XCHG ;REPLACE IT - POP D ;GET TABLE PTR - RET -; -; LOOK THROUGH DIRECTORY -; -FIND: - XRA A ;SELECT FIRST DISK - STA FCB - CALL NXTDISK ;GET INFO THE FIRST TIME -FIND1: - RZ ;ABORT IF ERROR -FIND2: - CALL NXTSEC ;GET A DIRECTORY SECTOR - JZ FIND3 ;RETURNS ZERO FLAG IF NO MORE - CALL CHKENT ;CHECK IT OUT - JMP FIND2 ;KEEP IT UP TILL DONE -FIND3: - CALL DIRALPHA ;SORT ENTRIES - CALL PRFILES ;PRINT SORTED ENTRIES - LDA FCB ;NEXT DISK - INR A - STA FCB - CALL NXTDISK ;SELECT NEXT DISK - JMP FIND1 - -; -; SIGN OFF -; -BYE: - MVI C,13 ;RESET SYSTEM - CALL BDOS - LDA FFLAG ;GET FILE FOUND FLAG - ORA A ;NO FILES FOUND? - JNZ RETURN - CALL PRINT - DB CR,LF,'NO Files Found',0 - JMP RETURN -; -; CHECKS THE CURRENT 4 DIRECTORY ENTRIES AGAINST ARGUMENT -; IF MATCH, REWRITES SECTOR WITH REACTIVATED 1ST BYTES -; -CHKENT: - MVI B,4 ;NUMBER OF ENTRIES PER SECTOR - LXI H,TBUFF ;BEGINNING OF BUFFER -CKLUP: - PUSH B - MOV A,M - CPI 0E5H ;CHECK FOR UNUSED - JZ CKINC - XRA A ;A=0 - STA CLPFLG ;SET FLAG FOR NO ENTRIES FOUND - LDA FNCOUNT ;GET NUMBER OF FILE NAMES TO LOOK THRU - MOV B,A ;... IN B - PUSH H - LHLD FNTAB ;PT TO TABLE - XCHG ;... IN DE - POP H -CKLUP1: - PUSH B ;SAVE COUNT - PUSH H ;SAVE BEGINNING ADDRESS - PUSH D - CALL COMPAR ;COMPARE WITH ARGUMENT AND SAVE IF MATCH - POP D - LXI H,11 ;PT TO NEXT ENTRY - DAD D - XCHG - POP H - POP B - DCR B ;COUNT DOWN - JNZ CKLUP1 -CKINC: - POP B - LXI D,32 ;LENGTH OF ENTRY - DAD D - DCR B - JNZ CKLUP - LHLD DIRMAX - DCX H ;REDUCE SECTORS LEFT - SHLD DIRMAX - LHLD SECTOR ;POINT TO NEXT SECTOR - INX H - SHLD SECTOR - XCHG - LHLD MAXSEC ;REACHED LIMIT? - INX H ;ONE MORE - MOV A,H ;CHECK HIGH - CMP D - RNZ - MOV A,L ;CHECK LOW - CMP E - RNZ - LHLD TRACK ;NEXT TRACK - INX H - SHLD TRACK - LXI H,1 ;FIRST SECTOR OF NEXT TRACK - SHLD SECTOR - RET -; -; COMPARE 11 BYTES OF DIRECTORY ENTRY AGAINST ARGUMENT; RNZ IF NOT MATCHED -; DE PTS TO TABLE ENTRY TO COMPARE TO -; -COMPAR: - LDA CLPFLG ;GET FOUND FLAG - ORA A ;0=NO - RNZ - SHLD TEMP ;Hold pointer in case of match - INX H - XCHG - MVI B,11 -CMPR1: - LDAX D ;GET DIRECTORY ENTRY CHARACTER - ANI 7FH ;STRIP ANY FLAGS - CMP M - JZ CMPR2 - MOV A,M - CPI '?' - RNZ -CMPR2: - INX D - INX H ;BUMP TO NEXT CHARACTER - DCR B - JNZ CMPR1 ;LOOP FOR 11 CHARACTERS - PUSH D ;SAVE ENTRY PTR - LDAX D ;GET EXTENT IN B - MOV B,A - LDA EXTENT ;GET EXTENT MASK - CMP B - POP D ;GET ENTRY PTR - JC CMPR4 ;NO MATCH - LDA SYSTEM ;INCLUDE SYSTEM FILES? - ORA A ;0=NO - JNZ CMPR3 - DCX D ;BACK UP 2 BYTES - DCX D - LDAX D ;GET T2 - ANI 80H ;CHECK FOR SYS - RNZ -CMPR3: - LHLD TEMP ;CHECK FOR USER LIMIT - MVI A,31 ;MAX USER - CMP M ;BEYOND MAX? - JC CMPR4 - LHLD FCOUNT ;INCREMENT COUNT - INX H - SHLD FCOUNT - LHLD DSTART ;GET PTR TO NEXT ENTRY - XCHG - LHLD TEMP - MVI B,ESIZE ;COPY ENTRY - CALL MOVE - XCHG - SHLD DSTART ;PTR TO NEXT ENTRY - XCHG - LHLD BDOS+1 ;CHECK FOR MEMORY OVERFLOW - MOV A,H - SUI 10 ;BELOW CCP - CMP D ;PT BEYOND LIMIT? - JC MOVFL - MVI A,0FFH ;SET FOUND FLAG - STA FFLAG - XRA A - RET ;RETURNS 'ZERO' FLAG SET FOR MATCH -CMPR4: - MVI A,0FFH ;NO MATCH - ORA A - RET -MOVFL: - CALL PRINT - DB CR,LF,'ABORT -- Not Enough Memory for Buffers',0 - JMP RETURN -; -; ADVANCE TO NEXT DISK -; -NXTDISK: - LXI B,TBUFF ;SET DMA ADDRESS - CALL SETDMA - LDA FCB - MOV C,A - MVI B,0 - CALL SELDSK ;MAKE SURE DRIVE IS - MOV A,H ; SELECTED - ORA L - RZ ;ERROR RETURN - SHLD DPH ;SAVE THE ADDRESS - LXI D,10 ;PT TO DPB - DAD D - MOV E,M ;GET DPB ADDRESS IN HL - INX H - MOV D,M - XCHG - MOV E,M ;NUMBER OF SECTORS/TRACK - INX H ;AS 2-BYTE QUANTITY IN DE - MOV D,M - INX H - XCHG - SHLD MAXSEC ;SET MAX SECTORS/TRACK - XCHG - INX H - INX H - MOV A,M ;GET EXM - STA EXTENT - INX H ;PT TO DRM - INX H - INX H - MOV E,M ;GET NUMBER OF - INX H ; DIRECTORY ENTRIES - MOV D,M - XCHG - INX H ;ACCOUNT FOR - 1 - SHLD DSTART ;SAVE NUMBER OF DIRECTORY ENTRIES - CALL SHFHL2 ;SHIFT 'HL' RIGHT 2 - SHLD DIRMAX ;SAVE NUMBER DIRECTORY SECTORS - LXI H,5 ;NOW POINT TO SYSTEM - DAD D ; TRACK OFFSET - MOV A,M ;PICK UP NUMBER OF - INX H - MOV H,M - MOV L,A - SHLD TRACK - LXI H,1 ;SET SECTOR - SHLD SECTOR - LDA ECOUNT ;LAST NEW LINE? - ANI 3 - CNZ CRLF - CALL PRINT - DB 'Disk ',0 - LDA FCB - ADI 'A' - CALL COUT - CALL PRINT - DB ' --',CR,LF,0 - LHLD SCRATCH ;PT TO SCRATCH AREA - SHLD ORDER ;ADDRESS OF ORDER TABLE - XCHG - LHLD DSTART ;GET NUMBER OF DIRECTORY ENTRIES - DAD H ;DOUBLE FOR NUMBER OF BYTES IN ORDER TABLE - DAD D ;PT TO FIRST BYTE OF DIRBUF - SHLD DIRBUF ;SET PTR - SHLD DSTART ;SET LOOP PTR - LXI H,0 ;SET FILE COUNT - SHLD FCOUNT - XRA A ;SET COUNT - STA ECOUNT - CMA ;FLIP - ORA A ;OK TO CONTINUE - RET -; -; GET BIOS JUMPS VECTORS FOR EASY REFERENCE -; -GTBIOS: - LHLD BOOT+1 ;POINTS TO BIOS JUMP TABLE+3 - LXI D,WBOOT ;WHERE WE WILL KEEP A COPY - MVI B,16*3 ;MOVE 48 BYTES AND FALL THRU TO MOVE -; -; GENERAL PURPOSE MOVE ROUTINE -; FROM 'HL' TO 'DE' FOR COUNT OF 8 -; -MOVE: - MOV A,M ;GET A BYTE - STAX D ;PUT A BYTE - INX D ;INCREMENT TO NEXT - INX H - DCR B ;COUNT DOWN - JNZ MOVE - RET -; -; READS NEXT SECTOR (GROUP OF FOUR DIRECTORY ENTRIES) -; RETURNS WITH ZERO FLAG SET IF NO MORE -; -NXTSEC: - LHLD DIRMAX ;SEE IF MORE SECTORS - MOV A,H - ORA L - RZ ;RETURNS ZERO FLAG IF NO MORE - LHLD TRACK ;SET TRACK - MOV B,H - MOV C,L - CALL SETTRK - LHLD SECTOR ;SET SECTOR - MOV B,H - MOV C,L - CALL TRNSLT - CALL SETSEC - CALL READ ;READ A SECTOR - ANI 1 ;REVERSE SENSE OF ERROR FLAG - XRI 1 ;RETURNS WITH ZERO FLAG SET - RET ;IF BAD READ -; -; PRINT FILES IN DIRBUF -; -PRFILES: - LHLD FCOUNT ;GET COUNT - MOV A,H ;ANY? - ORA L - RZ - MOV B,H ;COUNT IN BC - MOV C,L - LHLD DIRBUF ;PT TO FIRST ONE -PRFLOOP: - PUSH B ;SAVE COUNT - PUSH H ;SAVE PTR - CALL PRINTFCB ;PRINT FCB - POP H ;GET REGS BACK - POP B - LXI D,ESIZE ;PT TO NEXT - DAD D - DCX B ;COUNT DOWN - MOV A,B - ORA C - JNZ PRFLOOP - MVI A,0FFH ;SET OK - ORA A - RET -; -; FCB PRINTING ROUTINE -; -PRINTFCB: - CALL PRINT ;2 SPACES - DB ' ',0 - MOV A,M ;GET USER NUMBER - CALL PADC ;PRINT IT - MVI A,':' - CALL COUT - INX H -PR0: - MVI B,8 - CALL PR1 - MVI A,'.' - CALL COUT - MVI B,3 - CALL PR1 - LDA ECOUNT ;INCREMENT COUNT - INR A - STA ECOUNT - ANI 3 ;EVERY 4 - CZ CRLF ;NEW LINE - RET -PR1: - MOV A,M - ANI 7FH - CALL COUT - INX H - DCR B - JNZ PR1 - RET -; -; SHIFT REGS 'HL' RIGHT 2 BITS LOGICAL -; -SHFHL2: - CALL SHFHL ;ROTATE RIGHT 1 BIT AND FALL THRU -SHFHL: - XRA A ;CLEAR CARRY - MOV A,H - RAR ;SHIFTED BIT IN CARRY - MOV H,A - MOV A,L - RAR - MOV L,A - RET -; -; TRANSLATE REG 'BC' FROM LOGICAL TO PHYSICAL SECTOR NUMBER -; -TRNSLT: - LHLD DPH ;GET PTR TO DPH - MOV E,M ;GET ADDRESS OF XLT - INX H - MOV D,M - CALL SECTRAN ;USE BIOS ROUTINE - MOV C,L ;RETURN VALUE IN BC - MOV B,H - RET - -; -; DIRALPHA -- ALPHABETIZES DIRECTORY PTED TO BY HL; BC CONTAINS -; THE NUMBER OF FILES IN THE DIRECTORY -; -DIRALPHA: - LHLD FCOUNT ; GET FILE COUNT - MOV A,H ; ANY FILES? - ORA L - RZ - SHLD N ; SET "N" - MOV B,H ; BC=COUNT - MOV C,L - LHLD DIRBUF ; PT TO DIRECTORY -; -; SHELL SORT -- -; THIS SORT ROUTINE IS ADAPTED FROM "SOFTWARE TOOLS" -; BY KERNIGAN AND PLAUGHER, PAGE 106. COPYRIGHT, 1976, ADDISON-WESLEY. -; ON ENTRY, BC=NUMBER OF ENTRIES AND HL=ADDRESS OF FIRST ENTRY -; -SORT: - XCHG ; POINTER TO DIRECTORY IN DE - LHLD ORDER ; PT TO ORDER TABLE -; -; SET UP ORDER TABLE; HL PTS TO NEXT ENTRY IN ORDER TABLE, DE PTS TO NEXT -; ENTRY IN DIRECTORY, BC = NUMBER OF ELEMENTS REMAINING -; -SORT1: - MOV M,E ; STORE LOW-ORDER ADDRESS - INX H ; PT TO NEXT ORDER BYTE - MOV M,D ; STORE HIGH-ORDER ADDRESS - INX H ; PT TO NEXT ORDER ENTRY - PUSH H ; SAVE PTR - LXI H,ESIZE ; HL=NUMBER OF BYTES/ENTRY - DAD D ; PT TO NEXT DIR1 ENTRY - XCHG ; DE PTS TO NEXT ENTRY - POP H ; GET PTR TO ORDER TABLE - DCX B ; COUNT DOWN - MOV A,B ; DONE? - ORA C - JNZ SORT1 -; -; THIS IS THE MAIN SORT LOOP FOR THE SHELL SORT IN "SOFTWARE TOOLS" BY K&P -; - -; -; SHELL SORT FROM "SOFTWARE TOOLS" BY KERNINGHAN AND PLAUGER -; - LHLD N ; NUMBER OF ITEMS TO SORT - SHLD GAP ; SET INITIAL GAP TO N FOR FIRST DIVISION BY 2 - -; FOR (GAP = N/2; GAP > 0; GAP = GAP/2) -SRTL0: - ORA A ; CLEAR CARRY - LHLD GAP ; GET PREVIOUS GAP - MOV A,H ; ROTATE RIGHT TO DIVIDE BY 2 - RAR - MOV H,A - MOV A,L - RAR - MOV L,A - -; TEST FOR ZERO - ORA H - JZ SDONE ; DONE WITH SORT IF GAP = 0 - - SHLD GAP ; SET VALUE OF GAP - SHLD I ; SET I=GAP FOR FOLLOWING LOOP - -; FOR (I = GAP + 1; I <= N; I = I + 1) -SRTL1: - LHLD I ; ADD 1 TO I - INX H - SHLD I - -; TEST FOR I <= N - XCHG ; I IS IN DE - LHLD N ; GET N - MOV A,L ; COMPARE BY SUBTRACTION - SUB E - MOV A,H - SBB D ; CARRY SET MEANS I > N - JC SRTL0 ; DON'T DO FOR LOOP IF I > N - - LHLD I ; SET J = I INITIALLY FOR FIRST SUBTRACTION OF GAP - SHLD J - -; FOR (J = I - GAP; J > 0; J = J - GAP) -SRTL2: - LHLD GAP ; GET GAP - XCHG ; ... IN DE - LHLD J ; GET J - MOV A,L ; COMPUTE J - GAP - SUB E - MOV L,A - MOV A,H - SBB D - MOV H,A - SHLD J ; J = J - GAP - JC SRTL1 ; IF CARRY FROM SUBTRACTIONS, J < 0 AND ABORT - MOV A,H ; J=0? - ORA L - JZ SRTL1 ; IF ZERO, J=0 AND ABORT - -; SET JG = J + GAP - XCHG ; J IN DE - LHLD GAP ; GET GAP - DAD D ; J + GAP - SHLD JG ; JG = J + GAP - -; IF (V(J) <= V(JG)) - CALL ICOMPARE ; J IN DE, JG IN HL - -; ... THEN BREAK - JC SRTL1 - -; ... ELSE EXCHANGE - LHLD J ; SWAP J, JG - XCHG - LHLD JG - CALL ISWAP ; J IN DE, JG IN HL - -; END OF INNER-MOST FOR LOOP - JMP SRTL2 - -; -; SORT IS DONE -- RESTRUCTURE DIR1 IN SORTED ORDER IN PLACE -; -SDONE: - LHLD N ; NUMBER OF ENTRIES - MOV B,H ; ... IN BC - MOV C,L - LHLD ORDER ; PTR TO ORDERED POINTER TABLE - SHLD PTPTR ; SET PTR PTR - LHLD DIRBUF ; PTR TO UNORDERED DIRECTORY - SHLD PTDIR ; SET PTR DIR BUFFER - -; FIND PTR TO NEXT DIR1 ENTRY -SRTDN: - LHLD PTPTR ; PT TO REMAINING POINTERS - XCHG ; ... IN DE - LHLD PTDIR ; HL PTS TO NEXT DIR ENTRY - PUSH B ; SAVE COUNT OF REMAINING ENTRIES - -; FIND PTR TABLE ENTRY -SRTDN1: - LDAX D ; GET CURRENT POINTER TABLE ENTRY VALUE - INX D ; PT TO HIGH-ORDER POINTER BYTE - CMP L ; COMPARE AGAINST DIR1 ADDRESS LOW - JNZ SRTDN2 ; NOT FOUND YET - LDAX D ; LOW-ORDER BYTES MATCH -- GET HIGH-ORDER POINTER BYTE - CMP H ; COMPARE AGAINST DIR1 ADDRESS HIGH - JZ SRTDN3 ; MATCH FOUND -SRTDN2: - INX D ; PT TO NEXT PTR TABLE ENTRY - DCX B ; COUNT DOWN - MOV A,C ; END OF TABLE? - ORA B - JNZ SRTDN1 ; CONTINUE IF NOT - -; FATAL ERROR -- INTERNAL ERROR; POINTER TABLE NOT CONSISTENT -FERR$PTR: - CALL PRINT - DB 0DH,0AH,'DIRALPHA -- Pointer Error',0 - JMP RETURN - -; FOUND THE POINTER TABLE ENTRY WHICH POINTS TO THE NEXT UNORDERED DIR1 ENTRY -; MAKE BOTH POINTERS (PTR TO NEXT, PTR TO CURRENT UNORDERED DIR1 ENTRY) -; POINT TO SAME LOCATION (PTR TO NEXT DIR1 ENTRY TO BE ORDERED) -SRTDN3: - LHLD PTPTR ; GET PTR TO NEXT ORDERED ENTRY - DCX D ; DE PTS TO LOW-ORDER POINTER ADDRESS - MOV A,M ; MAKE PTR TO NEXT UNORDERED DIR1 PT TO BUFFER FOR - STAX D ; DIR1 ENTRY TO BE MOVED TO NEXT UNORDERED DIR1 POS - INX H ; PT TO NEXT PTR ADDRESS - INX D - MOV A,M ; MAKE HIGH POINT SIMILARLY - STAX D - -; COPY NEXT UNORDERED DIR1 ENTRY TO HOLD BUFFER - MVI B,ESIZE ; B=NUMBER OF BYTES/ENTRY - LHLD PTDIR ; PT TO ENTRY - LXI D,HOLD ; PT TO HOLD BUFFER - PUSH B ; SAVE B=NUMBER OF BYTES/ENTRY - CALL MOVE - POP B - -; COPY TO-BE-ORDERED DIR1 ENTRY TO NEXT ORDERED DIR1 POSITION - LHLD PTPTR ; POINT TO ITS POINTER - MOV E,M ; GET LOW-ADDRESS POINTER - INX H - MOV D,M ; GET HIGH-ADDRESS POINTER - LHLD PTDIR ; DESTINATION ADDRESS FOR NEXT ORDERED DIR1 ENTRY - XCHG ; HL PTS TO ENTRY TO BE MOVED, DE PTS TO DEST - PUSH B ; SAVE B=NUMBER OF BYTES/ENTRY - CALL MOVE - POP B - XCHG ; HL PTS TO NEXT UNORDERED DIR1 ENTRY - SHLD PTDIR ; SET POINTER FOR NEXT LOOP - -; COPY ENTRY IN HOLD BUFFER TO LOC PREVIOUSLY HELD BY LATEST ORDERED ENTRY - LHLD PTPTR ; GET PTR TO PTR TO THE DESTINATION - MOV E,M ; GET LOW-ADDRESS POINTER - INX H - MOV D,M ; HIGH-ADDRESS POINTER - LXI H,HOLD ; HL PTS TO HOLD BUFFER, DE PTS TO ENTRY DEST - CALL MOVE ; B=NUMBER OF BYTES/ENTRY - -; POINT TO NEXT ENTRY IN POINTER TABLE - LHLD PTPTR ; POINTER TO CURRENT ENTRY - INX H ; SKIP OVER IT - INX H - SHLD PTPTR - -; COUNT DOWN - POP B ; GET COUNTER - DCX B ; COUNT DOWN - MOV A,C ; DONE? - ORA B - JNZ SRTDN - RET ; DONE - -; -; SWAP (Exchange) the pointers in the ORDER table whose indexes are in -; HL and DE -; -ISWAP: - PUSH H ; SAVE HL - LHLD ORDER ; ADDRESS OF ORDER TABLE - 2 - MOV B,H ; ... IN BC - MOV C,L - POP H - DCX H ; ADJUST INDEX TO 0...N-1 FROM 1...N - DAD H ; HL PTS TO OFFSET ADDRESS INDICATED BY INDEX - ; OF ORIGINAL HL (1, 2, ...) - DAD B ; HL NOW PTS TO POINTER INVOLVED - XCHG ; DE NOW PTS TO POINTER INDEXED BY HL - DCX H ; ADJUST INDEX TO 0...N-1 FROM 1...N - DAD H ; HL PTS TO OFFSET ADDRESS INDICATED BY INDEX - ; OF ORIGINAL DE (1, 2, ...) - DAD B ; HL NOW PTS TO POINTER INVOLVED - MOV C,M ; EXCHANGE POINTERS -- GET OLD (DE) - LDAX D ; -- GET OLD (HL) - XCHG ; SWITCH - MOV M,C ; PUT NEW (HL) - STAX D ; PUT NEW (DE) - INX H ; PT TO NEXT BYTE OF POINTER - INX D - MOV C,M ; GET OLD (HL) - LDAX D ; GET OLD (DE) - XCHG ; SWITCH - MOV M,C ; PUT NEW (DE) - STAX D ; PUT NEW (HL) - RET -; -; ICOMPARE compares the entry pointed to by the pointer pointed to by HL -; with that pointed to by DE (1st level indirect addressing); on entry, -; HL and DE contain the numbers of the elements to compare (1, 2, ...); -; on exit, Carry Set means ((DE)) < ((HL)), Zero Set means ((HL)) = ((DE)), -; and Non-Zero and No-Carry means ((DE)) > ((HL)) -; -ICOMPARE: - PUSH H ; SAVE HL - LHLD ORDER ; ADDRESS OF ORDER - 2 - MOV B,H ; ... IN BC - MOV C,L - POP H - DCX H ; ADJUST INDEX TO 0...N-1 FROM 1...N - DAD H ; DOUBLE THE ELEMENT NUMBER TO POINT TO THE PTR - DAD B ; ADD TO THIS THE BASE ADDRESS OF THE PTR TABLE - XCHG ; RESULT IN DE - DCX H ; ADJUST INDEX TO 0...N-1 FROM 1...N - DAD H ; DO THE SAME WITH THE ORIGINAL DE - DAD B - XCHG - -; -; HL NOW POINTS TO THE POINTER WHOSE INDEX WAS IN HL TO BEGIN WITH -; DE NOW POINTS TO THE POINTER WHOSE INDEX WAS IN DE TO BEGIN WITH -; FOR EXAMPLE, IF DE=5 AND HL=4, DE NOW POINTS TO THE 5TH PTR AND HL -; TO THE 4TH POINTER -; - MOV C,M ; BC IS MADE TO POINT TO THE OBJECT INDEXED TO - INX H ; ... BY THE ORIGINAL HL - MOV B,M - XCHG - MOV E,M ; DE IS MADE TO POINT TO THE OBJECT INDEXED TO - INX H ; ... BY THE ORIGINAL DE - MOV D,M - MOV H,B ; SET HL = OBJECT PTED TO INDIRECTLY BY BC - MOV L,C - -; -; COMPARE DIR ENTRY PTED TO BY HL WITH THAT PTED TO BY DE; -; NO NET EFFECT ON HL, DE; RET W/CARRY SET MEANS DE -LF EQU 0AH ; -BEL EQU 'G'-'@' ; ^G -FF EQU 'L'-'@' ; ^L = FORM FEED -CTRLZ EQU 'Z'-'@' ; ^Z -CTRLC EQU 'C'-'@' ; ^C - -; -; HELP Control Characters -; -IHCHAR EQU ';' ; FLAG INDICATING INDEXED BY USER -SECTCHAR EQU ':' ; DEFINED TO BE COLON -BACKUPCHAR EQU 'L' ; BACK UP TO PREVIOUS FRAME CHAR -STRTCHAR EQU 'S' ; JUMP TO START OF INFORMATION CHAR -MENUCHAR EQU 'M' ; CHAR TO ABORT TO MENU -CPMABORTCHAR EQU CTRLC ; CHAR TO EXIT -LRCHAR EQU '^' ; RETURN TO PREVIOUS HELP LEVEL -ROOTCHAR EQU '.' ; RETURN TO ROOT OF HELP -PRCHAR EQU 'P' ; PRINT CURRENT FRAME -CPRCHAR EQU 'P'-'@' ; PRINT CURRENT INFORMATION SECTION - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3vinit ;initialize the ZCPR3 Env and the VLIB Env - jmp startx -; -; DEFAULT FILE NAME -; -HELPDIR: -DEFFN: - DB 'HELP ' ; BOTH HELP FILE AND HELP DIR SAME NAME -DEFTYP: - DB 'HLP' - -; -; Start of Program -; -STARTX: - LXI H,0 ; GET SP - DAD SP - SHLD STACK - CALL CODEND ; DETERMINE FREE MEMORY SPACE - SHLD HLPNSTK ; SET PTR TO HELP NAME STACK - LXI D,200H ; ALLOW 25+ ELEMENT HELP NAME STACK AND LARGE STACK - DAD D - SHLD HLPBUF - SPHL ; SET STACK - - LDA BDOS+2 ; BASE PAGE OF BDOS - SUI 10 ; 2K + 2 PAGES - STA TPAEND - - XRA A ; A=0 - STA HLPLVL ; SET HELP LEVEL TO 0 (NO RETURN FILE) - - LXI D,FCB ; PT TO FCB - CALL Z3LOG ; LOG INTO IT FOR DEFAULT - CALL PUTUD ; SAVE HOME - - LXI H,FCB+1 ; CHECK FOR FILE NAME - MOV A,M - CPI '/' ; OPTION CAUGHT? - JZ STRT0 - CPI ' ' ; NONE? - JNZ STRT1 -; -; INSERT 'HELP.HLP' INTO FCB OR CLEAR FCB -; -STRT0: - LXI D,DEFFN ; PT TO DEFAULT NAME - MVI B,11 ; 11 BYTES - XCHG - CALL MOVE ; MOVE (HL) TO (DE) FOR (B) BYTES - -; -; START/RESTART HELP PROGRAM (START ON INITIAL ENTRY, RESTART ON NODE LOAD) -; -STRT1: - LHLD HLPBUF ; RESET STACK - SPHL -; -; CHECK FOR WILD CARDS IN FILE NAME -- ERROR IF SO -; - LXI H,FCB+1 ; PT TO FIRST BYTE OF FILE NAME - MVI B,11 ; 11 BYTES -FCBWCK: - MOV A,M ; GET BYTE - ANI 7FH ; MASK - CPI '?' ; WILD? - JZ FCBWERR - INX H ; PT TO NEXT - DCR B - JNZ FCBWCK -; -; CHECK FOR FILE TYPE -; - LXI H,FCB+9 ; CHECK FOR FILE TYPE - - IF NOT FORCEHLP - MOV A,M ; CHECK FOR FILE TYPE SPECIFIED - CPI ' ' ; NONE? - JNZ STRT2 - ENDIF -; -; PLACE DEFAULT FILE TYPE OF '.HLP' IN FCB -; - LXI D,DEFTYP ; DEFAULT FILE TYPE - MVI B,3 - XCHG - CALL MOVE ; MOVE (HL) TO (DE) FOR (B) BYTES - -; -; FIND FILE -; -STRT2: -; -; LOOK INTO DIRECTORY PTED TO BY USER (OR CURRENT IF USER DID NOT SPEC ONE) -; - LXI D,FCB ; PT TO FCB -; CALL Z3LOG ; LOG INTO DIRECTORY - CALL INITFCB ; RESET FCB - CALL RETUD ; GET HOME LOCATION - CALL F$EXIST ; IS FILE THERE? - JNZ STRT3 -; -; LOOK ALONG PATH FROM CURRENT DIR (NOT INCLUDING CURRENT) -; - CALL GETUD ; RETURN HOME - LXI D,FCB ; PT TO FCB - MVI A,0 ; DON'T SEARCH CURRENT DIR ALSO - CALL PFIND ; SEARCH FOR FILE - JNZ STRT3 ; FILE FOUND, SO PROCESS -; -; LOOK IN HELP FILE DIRECTORY -; - LXI H,HELPDIR ; LOOK FOR HELP DIRECTORY - CALL DIRTDU ; CONVERT TO DU IN BC - JNZ LOGHLP ; LOG INTO DU IN BC IF FOUND - MVI B,HDISK ; LOG INTO HELP DIRECTORY - MVI C,HUSER -LOGHLP: - CALL LOGUD - LXI D,FCB ; PT TO FCB - CALL F$EXIST ; LOOK FOR FILE - JNZ STRT3 ; FILE FOUND -; -; FILE NOT FOUND -; - CALL EPRINT - DB CR,LF,' File Not Found',0 - JMP HLPEXIT - -; -; FILE CONTAINS WILD CARDS -; -FCBWERR: - CALL EPRINT - DB CR,LF,' AFN Not Allowed',0 - JMP HLPEXIT - -; -; LOAD HELP FILE INFORMATION -; ON INPUT, BC=DIRECTORY -; -STRT3: - CALL LOGUD ; LOG INTO DIRECTORY - LXI D,FCB ; OPEN FILE - CALL F$OPEN - LHLD HLPBUF ; PT TO BUFFER - SHLD NEXTADR ; SET PTR -; -; READ RECORDS UNTIL EOF -; -STRT4: - CALL READ ; READ INFO - JZ STRT4 ; NOT DONE IF ZERO RETURN - LXI D,FCB ; CLOSE FILE - CALL F$CLOSE - CALL GETUD ; RESTORE CURRENT DISK AND USER IF CHANGED - -; -; START OF HELP PROGRAM -; -HELP: - LHLD HLPBUF ; PT TO BUFFER - SPHL ; SET STACK - MVI A,0 ; SET NO FRAME - STA FRNUM - MOV A,M ; NO HEADER SECTION? - ANI 7FH ; MASK OUT MSB - CPI SECTCHAR - JNZ HELP1 ; HEADER SECTION EXISTS - CALL CLS ; NEW SCREEN - CALL PRINFO ; PRINT HELP INFO PTED TO BY HL - LDA HLPLVL ; CHECK TO SEE IF WE ARE NOT AT LEVEL 0 - ORA A ; 0=LEVEL 0 - JZ HLPEXIT ; ABORT IF SO - JMP LRURN ; GO TO PREVIOUS LEVEL IF NOT - -; -; EXIT POINT FOR ANY EXIT FROM THE REST OF THE HELP PROGRAM -; -HLPEXIT: - CALL GETUD ; RESET CALLING DISK/USER NUMBER - LHLD STACK ; GET CP/M SP - SPHL - RET ; DONE - -; -; PRINT HEADER INFORMATION AND SELECT AN OPTION -; -HELP1: - CALL PRHEADER ; PRINT HEADER - PUSH B ; SAVE C (NUMBER OF VALID SELECTIONS) - CALL CRLF1 ; NEW LINE - CALL STNDOUT ; GOTO DIM - CALL PRLEVEL ; PRINT LEVEL NUMBER - CALL EPRINT - DB 'Enter Selection ',0 - CALL PRP1 ; PRINT LEVEL MOVEMENT PROMPT - CALL STNDEND ; GOTO BRIGHT - POP B ; GET C - CALL CIN ; GET RESPONSE - CALL CAPS ; CAPITALIZE - PUSH PSW - CALL CLS ; CLEAR SCREEN - POP PSW - CPI CTRLC ; EXIT - JZ HLPEXIT - CPI ROOTCHAR ; GO TO ROOT - JZ GOROOT - CPI LRCHAR ; RETURN TO PREVIOUS LEVEL - JZ LRURN - MOV B,A ; USER INPUT IN B - LDA HTYPE ; TYPE OF HELP FILE - CPI IHCHAR ; INDEXED BY USER? - JZ HELP5 ; FIND INFORMATION SECTION VIA INDEX SCAN - MOV A,B ; FIND INFORMATION SECITON VIA COUNT - SUI 'A'-1 ; ADJUST FOR COUNT - MOV B,A ; SAVE COUNT - JZ BADRESPONSE - JNC HELP2 -; -; INVALID RESPONSE -; -BADRESPONSE: - CALL SAK ; RING BELL - JMP HELP1 - -; -; VALID RESPONSE -- LOOK FOR AND PRINT INFORMATION SECTION -; -HELP2: - INR C ; 1 MORE THAN NUMBER OF POSSIBLE SELECTIONS - CMP C ; GREATER THAN NUMBER OF POSSIBLE SELECTIONS? - JNC BADRESPONSE - LHLD FIRSTENTRY ; GET PTR TO FIRST ENTRY - -; -; PRINT INFORMATION WHEN COUNT IS ZERO -; -HELP3: - DCR B ; COUNT DOWN SELECTIONS - JNZ HELP4 - CALL PRINFO ; PRINT INFO PTED TO BY HL - JMP HELP1 -; -; LOCATE NEXT INFORMATION SECTION -; -HELP4: - CALL FINDI ; SKIP TO NEXT INFORMATION SECTION - CPI CTRLZ ; END OF FILE? - JNZ HELP3 ; CONTINUE LOOPING IF NOT ELSE FALL THRU TO HELPERR -; -; ERROR -- REACHED END OF HELP FILE -; -HELPERR: - CALL EPRINT - DB CR,LF,' EOF on Help File',0 - JMP HELP1 - -; -; LOCATE NEXT INFORMATION SECTION VIA INDEX SCAN -; -HELP5: - LHLD FIRSTENTRY ; PT TO FIRST ENTRY -; -; LOOK FOR USER INDEX -; -HELP6: - PUSH H ; SAVE PTR TO THIS LINE -HELP7: - INX H ; SKIP OVER SECTION CHAR - MOV A,M ; GET CHAR - ANI 7FH ; MASK OUT MSB - CALL CAPS ; CAPITALIZE - CPI ' ' ; SKIP SPACES - JZ HELP7 - CPI SECTCHAR ; NEW SECTION? - JZ HELP8 ; FIND NEXT SECTION - CPI CR ; END OF LINE? - JZ HELP8 ; FIND NEXT SECTION - CPI CTRLZ ; EOF? - JZ HELP8 - CMP B ; CHECK FOR USER INPUT - JNZ HELP7 - POP H ; FOUND IT -- PRINT IT - INX H ; SKIP OVER SECTION CHAR -HELP7A: - MOV A,M ; SKIP TO BEGINNING FOR 1ST LINE - INX H ; PT TO NEXT - ANI 7FH - CPI CTRLZ ; TRAP EOF - JZ BADRESPONSE - CPI SECTCHAR ; FILE SPECIFIED? - JZ HELP7B ; PROCESS IT - CPI LF ; BEGIN NEW LINE - JZ HELP7C - CPI CR ; AT END OF INDEX LINE? - JNZ HELP7A - MOV A,M ; GET LF - ANI 7FH - CPI LF ; SKIP FOLLOWING LF IF ANY - JNZ HELP7C - INX H ; SKIP LF - JMP HELP7C -; -; LOAD NEXT HELP LEVEL -; -HELP7B: - DCX H ; PT TO SECTION CHAR - DCX H ; PT TO BEFORE SECTION CHAR FOR PRINFO -; -; PROCESS HELP LEVEL OR LOAD AND PROCESS NEXT LEVEL PTED TO BY HL -; -HELP7C: - CALL PRINFO ; PRINT INFORMATION SECTION - JMP HELP1 ; RESUME -HELP8: - POP H ; PT TO INFO SECTION - CALL FINDI ; FIND NEXT INFO SECTION - CPI CTRLZ ; EOF? - JNZ HELP6 ; KEEP LOOKING - JMP BADRESPONSE - -; -; SKIP TO NEXT INFORMATION SECTIONS -; RETURN WITH A=SECTCHAR IF FOUND OR A=^Z IF NOT -; -FINDI: - MOV A,M ; ? - ANI 7FH ; MASK OUT MSB - INX H ; PT TO NEXT BYTE - CPI CTRLZ - RZ - CPI LF ; LINE FEED? - JZ FINDI1 - CPI CR ; ? - JNZ FINDI - MOV A,M ; MAKE SURE LF - ANI 7FH - CPI LF - JNZ FINDI1 - INX H ; SKIP OVER LF -FINDI1: - MOV A,M ; GET CHAR - ANI 7FH ; MASK OUT MSB - CPI SECTCHAR ; NEW SECTION? - JNZ FINDI ; CONTINUE LOOPING - RET - -; -; HELP SUPPORT ROUTINE SECTION -; - -; -; PRINT ERROR MSG PTED TO BY DE; ENDS IN 0 -; -PRMSG: - XCHG ; MSG PTED TO BY HL - CALL EPSTR - XCHG - RET - -; -; MOVE BYTES PTED TO BY HL TO AREA PTED TO BY DE; B BYTES TO MOVE -; -MOVE: - MOV A,M ; GET BYTE - ANI 7FH ; MASK OFF MSB -- IN CASE A WS FILE - STAX D ; PUT BYTE - INX H ; PT TO NEXT - INX D - DCR B - JNZ MOVE - RET - -; -; READ RECORD FROM DISK; NEXTADR CONTAINS ADDRESS TO READ TO -; ON RETURN, BDOS ERROR CODE IS IN A (0=NO ERROR) -; -READ: - LXI D,FCB ; PT TO FCB - CALL F$READ ; READ NEXT RECORD - PUSH PSW ; SAVE RETURN CODE - LHLD NEXTADR ; PT TO LOAD ADDRESS - LDA TPAEND ; CHECK AGAINST END PAGE OF TPA - CMP H ; IF AT SAME PAGE, YES - JZ READERROR - LXI D,BUFF ; PT TO BUFFER TO LOAD FROM - MVI B,128 ; NUMBER OF BYTES TO MOVE - XCHG - CALL MOVE - XCHG - MVI M,CTRLZ ; STORE ENDING CTRLZ IN CASE OF EOF - POP PSW ; GET RETURN CODE - ORA A ; DONE? <>0 IF SO -; -; READ DONE -- SAVE PTR TO NEXT BLOCK -; - SHLD NEXTADR ; SET NEXT ADDRESS - RET - -READERROR: - CALL EPRINT - DB CR,LF,' Mem Full',0 - JMP HLPEXIT - -; -; PRINT ONE LINE OF INFO SECTION; HL PTS TO LINE UPON ENTRY; -; HL PTS TO FIRST CHAR OF NEXT LINE UPON EXIT -; -PRLINE: - MOV A,M ; GET CHAR - ANI 7FH ; MASK OUT MSB - CPI CR ; EOL? - JZ CRLF - CPI LF ; LINE FEED? (WS FILE) - JZ CRLF0 - CPI CTRLZ ; END OF FILE? - JZ CRLFC ; DONE IF SO - INX H ; PT TO NEXT - CPI DIM ; GOTO STANDOUT MODE? - JZ PRLDIM - CPI NOTDIM ; GOTO NORMAL MODE? - JZ PRLNDIM - CALL COUT ; PRINT CHAR - JMP PRLINE -PRLDIM: - CALL STNDOUT ; ENTER STANDOUT MODE - JMP PRLINE -PRLNDIM: - CALL STNDEND ; END STANDOUT MODE - JMP PRLINE -; -; PRINT CRLF, PT TO FIRST CHAR OF NEXT LINE, AND PAGE IF NECESSARY -; -CRLF: - INX H ; PT TO LF -CRLF0: - INX H ; PT TO 1ST CHAR OF NEXT LINE -CRLFC: - CALL CRLF1 ; PRINT CRLF - LDA LCOUNT ; GET LINE COUNT - DCR A - STA LCOUNT - RNZ ; OK -- CONTINUE - MOV A,M ; SET MSB OF FIRST CHAR OF NEXT LINE - ORI 80H - MOV M,A ; MSB IS SET FOR LATER BACKUP - CALL PRPROMPT ; PRINT PROMPT AND PROCESS COMMON OPTIONS - CPI BACKUPCHAR ; BACK UP? - JZ FBACKUP - CPI STRTCHAR ; JUMP TO START OF INFO - JZ INFOSTRT -FRESUME: - SHLD STRTFRAME - JMP SETLCOUNT -; -; PRINT PROMPT AND PROCESS COMMON OPTIONS -; -PRPROMPT: - CALL STNDOUT ; GOTO DIM - CALL PRLEVEL ; PRINT LEVEL NUMBER - LDA FRNUM ; INCREMENT FRAME NUMBER - INR A - STA FRNUM - CALL PRP1 ; PRINT FUNDAMENTAL LEVEL DATA PROMPT - CALL EPRINT - DB MENUCHAR,'=Menu ' ; ABORT TO MENU CHAR - DB STRTCHAR,'=Start ' ; JUMP TO START OF INFORMATION CHAR - DB BACKUPCHAR,'=Last ' ; BACK UP TO PREVIOUS FRAME CHAR - DB PRCHAR,'=Print ' ; PRINT CURRENT FRAME - DB 0 - CALL STNDEND ; GOTO BRIGHT - CALL CIN ; GET RESPONSE - CALL CAPS - PUSH PSW - CALL CLS ; CLEAR SCREEN - POP PSW - POP D ; CLEAR STACK - CPI MENUCHAR ; ABORT? - JZ HELP ; START OVER IF SO - CPI CPMABORTCHAR ; ABORT TO OS - JZ HLPEXIT - CPI PRCHAR ; PRINT FRAME? - JZ LIST0INFO - CPI CPRCHAR ; PRINT INFORMATION SECTION? - JZ LIST1INFO - CPI ROOTCHAR ; GO TO ROOT - JZ GOROOT - CPI LRCHAR ; RETURN TO HIGHER LEVEL - JZ LRURN - PUSH D ; RESTORE STACK - RET - -; -; PRINT FUNDAMENTAL LEVEL PROMPT -; -PRP1: - LDA HLPLVL ; DON'T PRINT IF AT LEVEL 0 - ORA A - RZ - CALL EPRINT - DB LRCHAR,'=Level ' ; RETURN TO HIGHER NODE - DB ROOTCHAR,'=Root ' ; RETURN TO ROOT - DB 0 - RET - -; -; JUMP TO START OF INFORMATION -; -INFOSTRT: - LHLD STRTINFO ; PT TO START OF INFO - MVI A,1 ; RESET FRAME COUNT - STA FRNUM - JMP FRESUME ; CONTINUE PROCESSING - -; -; BACK UP TO PREVIOUS FRAME -; -FBACKUP: - CALL BOICHECK ; AT BEGINNING OF INFORMATION? - JZ INFOSTRT -FB1: - DCX H ; BACK UP UNTIL BYTE WITH MSB SET IS FOUND - MOV A,M ; GET BYTE - ANI 80H - JZ FB1 - LDA FRNUM ; DECREMENT FRAME NUMBER - DCR A ; BACK UP TO CURRENT FRAME NUMBER - DCR A ; BACK UP TO PREVIOUS FRAME NUMBER - STA FRNUM - JMP FRESUME ; CONTINUE PROCESSING -; -; PRINT CR AND LF ONLY -; -CRLF1: - MVI A,CR ; PRINT CR - CALL COUT - MVI A,LF ; PRINT LF - JMP COUT - -; -; SET LCOUNT VARIABLE TO SCREEN SIZE -; -SETLCOUNT: - PUSH H ; SAVE HL - CALL GETCRT ; GET CRT DATA - INX H ; PT TO LINE COUNT - MOV A,M ; GET LINE COUNT - POP H ; RESTORE HL - DCR A ; 1 LESS FOR PROMPT - STA LCOUNT - RET - -; -; PRINT THE HEADER SECTION AND LOAD FIRSTENTRY PTR -; ON RETURN, C=NUMBER OF POSSIBLE SELECTIONS -; -PRHEADER: - MVI A,0 ; SET NO FRAME - STA FRNUM - CALL SETLCOUNT - LDA LCOUNT - SUI 3 ; -3 lines for top and bottom - STA LCOUNT - MVI A,'A' ; INIT SELECTION CHAR - STA SELCHAR - CALL CLS ; CLEAR SCREEN - CALL EPRINT - DB 'HELP ' - db (vers/10)+'0','.',(vers mod 10)+'0' - DB ' ',0 - LXI D,FCB+1 ; PT TO FCB - CALL PFN2 ; PRINT WITH NO SPACES - CALL EPRINT - db ' Index',CR,LF,CR,LF,0 - MVI C,0 ; COUNT NUMBER OF SELECTIONS - LHLD HLPBUF ; PT TO BUFFER - MOV A,M ; GET FIRST CHAR - STA HTYPE ; SET TYPE OF HELP FILE - CPI IHCHAR ; INDEXED HELP TYPE? - JNZ PH1 - INX H ; SKIP OVER INDEX HELP TYPE FLAG -; -; PRINT LINE UNTIL FIRST INFORMATION SECTION FOUND -; -PH1: - MOV A,M ; GET CHAR - ANI 7FH ; MASK OUT MSB - CPI SECTCHAR - JZ PH2 - CPI CTRLZ ; EOF? -- ABORT - JZ HLPEXIT - INR C ; INCREMENT SELECTION COUNT - LDA HTYPE ; CHECK FOR INDEX - CPI IHCHAR - JZ PH1A ; SKIP LETTERS IF INDEXED - LDA SELCHAR ; DISPLAY SELECTION CHAR - CALL COUT - INR A ; INCR CHAR - STA SELCHAR - CALL EPRINT - DB '. ',0 -PH1A: - CALL PRLINE ; PRINT HEADER LINE - JMP PH1 -; -; SAVE PTR TO FIRST ENTRY -; -PH2: - SHLD FIRSTENTRY - LDA LCOUNT ; GET COUNT OF REMAINING LINES - MOV B,A ; ... IN B - ORA A ; ANY LEFT? - RZ -PH3: - CALL CRLF1 ; NEW LINE - DCR B - JNZ PH3 - RET - -; -; PRINT AN INFORMATION SECTION -; INFORMATION SECTION IS PTED TO BY HL -; -PRINFO: - SHLD STRTINFO ; SET START OF INFORMATION POINTER - CALL LDNOD ; LOAD NEW NODE IF DUAL SECTCHAR - SHLD STRTFRAME ; SET FRAME POINTER - MOV A,M ; SET MSB - ORI 80H - MOV M,A - CALL SETLCOUNT - MVI A,1 ; A=1 - STA FRNUM ; SET FRAME NUMBER -PI1: - CALL PRLINE ; PRINT LINE FROM INFO FILE - MOV A,M ; DONE? - ANI 7FH ; MASK OUT MSB - CPI CTRLZ ; EOF? - JZ PI2 - CPI SECTCHAR ; NEXT SECTION - JZ PI2 - CPI FF ; FORM FEED? - JNZ PI1 - INX H ; PT TO CHAR AFTER FORM FEED - CALL FORMFEED ; FEED SCREEN - JMP PI1 -; -; FORM FEED SCREEN -; -FORMFEED: - LDA LCOUNT ; GET LINE COUNT - MOV B,A ; ... IN B -FEEDLOOP: - PUSH B ; SAVE B - CALL CRLFC ; NEW LINE - POP B ; GET B - DCR B - JNZ FEEDLOOP - RET - -; -; END OF INFO -; -PI2: - MOV A,M ; SET MSB OF NEXT BYTE - ORI 80H - MOV M,A -PI2A: - CALL CRLF1 ; NEW LINE - LDA LCOUNT ; COUNT DOWN - DCR A - STA LCOUNT - JNZ PI2A -PI2MSG: - CALL EPRINT ; PRINT END OF INFORMATION INDICATOR - DB 'EOI ',0 - CALL PRPROMPT ; PRINT PROMPT AND PROCESS COMMON OPTIONS - CPI BACKUPCHAR ; BACK UP FROM EOI? - JZ PI2BACKUP - CPI STRTCHAR ; START OF INFO? - JZ PI2STRT - JMP SETLCOUNT ; RESET LINE COUNT IN CASE OF ALL - -; -; JUMP TO START OF INFO FROM EOI -; -PI2STRT: - LHLD STRTINFO ; PT TO START OF INFO - CALL FRESUME ; RESET POINTERS - MVI A,1 ; RESET FRAME COUNT - STA FRNUM - JMP PI1 ; CONTINUE PROCESSING - -; -; BACK UP TO PREVIOUS FRAME FROM EOI -; -PI2BACKUP: - CALL BOICHECK ; AT BEGINNING OF INFORMATION? - JZ PI2STRT -PI2BACK: - CALL FB1 ; BACK UP TO PREVIOUS FRAME - JMP PI1 ; CONTINUE PROCESSING - -; -; CHECK FOR POSITION AT BEGINNING OF INFORMATION SECTION -; IF SO, PRINT BACKUP ERROR MSG AND RETURN W/ZERO SET -; -BOICHECK: - LHLD STRTINFO ; START ADDRESS - XCHG ; ... IN DE - LHLD STRTFRAME ; FRAME ADDRESS - MOV A,D ; EQUAL? - CMP H - RNZ - MOV A,E - CMP L - RNZ - CALL SAK ; ERROR BELL - XRA A ; ZERO FLAG SET - STA FRNUM ; SET FRAME NUMBER - RET - -; -; THIS BODY OF CODE LISTS INFORMATION FROM HELP2 TO THE -; PRINTER -; - -; -; LIST ONE LINE OF INFO SECTION; HL PTS TO LINE UPON ENTRY; -; HL PTS TO FIRST CHAR OF NEXT LINE UPON EXIT -; -LISTLINE: - MOV A,M ; GET CHAR - ANI 7FH ; MASK OUT MSB - CPI CR ; EOL? - JZ LCRLF - CPI LF ; LINE FEED? (WS FILE) - JZ LCRLF0 - CPI CTRLZ ; END OF FILE? - JZ LCRLFC ; DONE IF SO - CALL LSTOUT ; PRINT CHAR - RZ ; ABORT - INX H ; PT TO NEXT - JMP LISTLINE - -; -; LIST CRLF, PT TO FIRST CHAR OF NEXT LINE, AND PAGE IF NECESSARY -; -LCRLF: - INX H ; PT TO LF -LCRLF0: - INX H ; PT TO 1ST CHAR OF NEXT LINE -LCRLFC: - CALL LCRLF1 ; PRINT CRLF - LDA LCOUNT ; GET LINE COUNT - DCR A - STA LCOUNT - JNZ LNOABT ; OK -- CONTINUE - CALL LFORMFEED ; ADVANCE TO NEXT PAGE -SETPLC: - PUSH H ; SAVE HL - CALL GETPRT ; GET PRINTER DATA - INX H ; PT TO TEXT LINE COUNT - INX H - MOV A,M ; GET TEXT LINE COUNT - STA LCOUNT ; SET LINE COUNT - POP H ; RESTORE HL - RET -LCRLF1: - MVI A,CR ; SEND TO PRINTER - CALL LSTOUT - RZ ; ABORT - MVI A,LF ; FALL THRU TO LSTOUT - -; -; PRINT CHARACTER IN A ON PRINTER; AFFECT NO REGISTERS -; -LSTOUT: - PUSH H ; SAVE REGS - PUSH D - PUSH B - MOV E,A ; CHAR IN E - MVI C,5 ; BDOS PRER OUTPUT ROUTINE - CALL BDOS - MVI E,0FFH ; CONDITIONAL INPUT - MVI C,6 ; DIRECT CONSOLE I/O - CALL BDOS - POP B ; RESTORE REGS - POP D - POP H - CPI CTRLC ; ABORT? - RET -LNOABT: - MVI A,0FFH ; SET NO ABORT RETURN - ORA A ; SET FLAGS - RET - -; -; LIST THE CURRENT INFORMATION SECTION -; INFORMATION SECTION IS PTED TO BY STRTINFO -; -; LIST0INFO -- LIST CURRENT FRAME ONLY -; LIST1INFO -- LIST CURRENT INFORMATION SECTION -; -LIST0INFO: - LHLD STRTFRAME ; LIST CURRENT FRAME ONLY - MVI A,0FFH ; SET FLAG - STA LFRFLAG ; LIST FRAME ONLY - JMP LIST2INFO -LIST1INFO: - LHLD STRTINFO ; PREPARE TO LIST ENTIRE INFO SECTION - XRA A ; CLEAR FRAME LIST FLAG - STA LFRFLAG -LIST2INFO: - CALL LISTINFO ; DO PRINT - CALL CLS ; CLEAR SCREEN - CALL LFORMFEED ; FORM FEED PRINTER - LHLD STRTFRAME ; RETURN TO FRAME WE WERE ON - CALL FRESUME - LDA FRNUM ; ADJUST FRAME NUMBERING - DCR A - STA FRNUM - JMP PI1 ; RESUME AT PI1 -; -; MAIN PRINT ROUTINE -; -LISTINFO: - CALL CLS ; PRINT FRAME OR INFO SECTION - CALL EPRINT - DB CR,LF,' Printing ',0 - CALL SETPLC ; SET PRINTER LINE COUNT -LI1: - CALL LISTLINE ; LIST LINE FROM INFO FILE - CPI CTRLC ; ABORT? - RZ ; FEED PRINTER AND EXIT - MOV A,M ; DONE? - ANI 7FH ; MASK OUT MSB - CPI CTRLZ ; EOF? - RZ ; RESUME IF AT END OF INFO - CPI SECTCHAR ; NEXT SECTION - RZ ; RESUME IF AT END OF INFO - CPI FF ; FORM FEED? - JNZ LI1 - LDA LFRFLAG ; LIST FRAME ONLY? - ORA A ; 0=NO - RNZ - INX H ; PT TO CHAR AFTER FORM FEED - CALL LCRLFC ; NEW LINE - MVI B,10 ; PRINT SEPARATOR -LI2: - MVI A,'-' ; DASHES - CALL LSTOUT - RZ ; ABORT? - DCR B ; COUNT DOWN - JNZ LI2 - CALL LCRLFC ; 2 NEW LINES - CALL LCRLFC - JMP LI1 - -; -; FORM FEED PRINTER -; -LFORMFEED: - CALL LCRLF1 ; NEW LINE - MVI A,FF ; OUTPUT FORM FEED - CALL LSTOUT - JMP SETPLC ; RESET LINE COUNT - -; -; END OF BODY OF CODE WHICH LISTS INFORMATION FROM HELP2 TO -; THE PRINTER -; - -; -; AT THE BEGINNING OF AN INFORMATION SECTION (HL PTS TO FIRST CHAR) -; CHECK TO SEE IF ANOTHER SECTCHAR FOLLOWS, AND, IF SO, LOAD THE -; SPECIFIED FILE AS A NEW NODE AND BEGIN PROCESSING IT -; -LDNOD: - INX H ; PT TO POSSIBLE 2ND SECTCHAR - MOV A,M ; GET IT - DCX H ; PREP FOR RETURN - ANI 7FH ; MASK MSB - CPI SECTCHAR ; ANOTHER ONE? - RNZ ; PROCESS NORMALLY IF NOT -; -; WE HAVE A NEW NODE -- CHECK TO SEE IF WE CAN NEST AGAIN -; - LDA HLPLVL ; GET CURRENT HELP LEVEL - CPI 25 ; AT MAXIMUM? - JNZ LDNOD1 - CALL CLS ; NEW SCREEN - CALL EPRINT - db cr,lf,' Node Level Limit',0 - JMP HLPEXIT - -; -; WE HAVE NOT REACHED LEVEL LIMIT, SO CONTINUE -; AT THIS TIME, A=HELP LEVEL INDEX AND HL = PTR TO CURRENT SECTION (::) -; -LDNOD1: -; -; SAVE CURRENT HELP FILE NAME FOR RETURN -; - INX H ; PT TO SECTION SECTCHAR - INX H ; NOW POINTING TO FILE NAME - PUSH H ; SAVE PTR - CALL COMPTR ; HL=POINTER TO STACK ELT INDEXED BY A - XCHG ; DE=ADDRESS OF NEXT ELEMENT -; -; COPY CURRENT NODE ELEMENT NAME INTO NEXT STACK ELEMENT -; - LXI H,FCB+1 ; PT TO FILE NAME - MVI B,11 ; 11 BYTES - CALL MOVE -; -; INCREMENT HELP LEVEL -; - LDA HLPLVL ; GET OLD LEVEL - INR A ; SET NEW LEVEL - STA HLPLVL -; -; SET UP FCB FOR NEW FILE -; - POP H ; GET PTR TO NEW FILE NAME - LXI D,FCB+1 ; PT TO FCB NAME - MVI B,8 ; 8 CHARS MAX - CALL LDFCB ; PLACE INTO FCB WITH ERROR CHECKING - MVI B,3 ; 3 CHARS MAX FOR TYPE - CPI '.' ; CONTINUE IF FILE TYPE PRESENT - CZ LDFCB ; PLACE INTO FCB WITH ERROR CHECKING -; -; PRINT LOADING HELP FILE MESSAGE -; -PLHFM: - CALL EPRINT - DB CR,LF,' Loading HELP File ',0 - LXI D,FCB+1 ; PRINT FILE NAME - CALL PFN2 - JMP STRT1 ; LOAD NEW HELP FILE - -; -; LOAD FCB PTED TO BY DE WITH "NORMAL" FILE NAME PTED TO BY HL FOR B BYTES -; -LDFCB: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - CPI '.' ; DONE IF DECIMAL - JZ LDFCB2 - CPI ' '+1 ; DONE IF <= - JC LDFCB2 - CALL CAPS ; CAPITALIZE - STAX D ; STORE CHAR - INX D ; PT TO NEXT - DCR B - JNZ LDFCB -LDFCB1: - MOV A,M ; CHECK FOR ERROR - ANI 7FH ; MASK MSB - INX H ; PT TO NEXT CHAR - CPI '.' ; OK IF '.' - RZ - CPI ' '+1 ; OK IF <= - RC - JMP LDFCB1 -LDFCB2: - MOV C,A ; SAVE CHAR THAT TERMINATED STRING -LDFCB3: - MVI A,' ' ; FILL REST OF FCB - STAX D ; STORE - INX D ; PT TO NEXT - DCR B - JNZ LDFCB3 - MOV A,C ; GET CHAR THAT TERMINATED STRING - RET - -; -; GO TO ROOT -; -GOROOT: - LDA HLPLVL ; AT ROOT? - ORA A ; 0=YES - JZ HELP ; RETURN TO HELP - MVI A,0 ; SET ROOT INDEX - JMP GORET - -; -; RETURN TO PREVIOUS HELP LEVEL -; -LRURN: - LDA HLPLVL ; ARE WE AT THE LOWEST LEVEL? - ORA A ; 0=YES - JNZ LRET - CALL SAK ; ERROR BELL - JMP HELP - -; -; SET NEW HELP LEVEL -; -LRET: - DCR A ; DOWN 1 AND FALL THRU TO GORET - -; -; GO TO HELP LEVEL INDEXED IN A -; -GORET: - STA HLPLVL ; SET NEW HELP LEVEL - CALL COMPTR ; HL=POINTER TO TARGET HELP FILE NAME - LXI D,FCB+1 ; COPY ELEMENT INTO FCB - MVI B,11 ; 11 BYTES - CALL MOVE - JMP PLHFM ; PRINT LOADING MESSAGE AND LOAD - -; -; COMPUTE POINTER TO HELP NAME ENTRY INDEXED BY HELP LEVEL IN A -; -COMPTR: - MOV L,A ; VALUE IN HL - MVI H,0 ; COMPUTE OFFSET AS INDEX*11 - MOV E,L ; DE=HL - MOV D,H - DAD H ; *2 - DAD H ; *4 - DAD H ; *8 - DAD D ; *9 - DAD D ; *10 - DAD D ; *11 - XCHG ; RESULT IN DE - LHLD HLPNSTK ; PT TO BASE OF HELP NAMES - DAD D ; ADD IN OFFSET - RET - -; -; PRINT LEVEL NUMBER -; -PRLEVEL: - LDA HLPLVL ; DON'T PRINT LEVEL 0 - ORA A ; 0? - JZ PRFRAME - CALL EPRINT - DB 'Level ',0 - LDA HLPLVL ; GET NUMBER - CALL PAFDC ; PRINT AS DECIMAL - LDA FRNUM ; GET FRAME NUMBER - ORA A ; SET FLAGS - MVI A,'/' ; PREP TO PRINT SLASH - CNZ COUT ; PRINT SLASH IF FRAME IS NON-ZERO -PRFRAME: - LDA FRNUM ; GET NUMBER - ORA A - MVI A,' ' ; PREP TO PRINT SPACE ON EXIT - JZ COUT - LDA FRNUM ; GET FRAME NUMBER AGAIN - CALL PAFDC ; PRINT AS DECIMAL - CALL EPRINT - DB ': ',0 - RET - -; -; RING ERROR BELL -; -SAK: - MVI A,BEL - JMP COUT - -; -; BUFFER SECTION -; -HTYPE: - DS 1 ; TYPE OF HELP FILE (IF = IHCHAR, IT IS INDEXED BY USR) -LFRFLAG: - DS 1 ; LIST FRAME ONLY FLAG (FOR PRINT FUNCTION) -TPAEND: - DS 1 ; END PAGE ADDRESS OF TPA -STRTINFO: - DS 2 ; PTR TO START OF CURRENT INFORMATION BLOCK -STRTFRAME: - DS 2 ; PTR TO START OF CURRENT FRAME -SELCHAR: - DS 1 ; SELECTION TABLE OPTION CHAR -FIRSTENTRY: - DS 2 ; PTR TO FIRST ENTRY OF INFORMATION SECTION -LCOUNT: - DS 1 ; LINE COUNT BUFFER -NEXTADR: - DS 2 ; NEXT LOAD ADDRESS -HLPLVL: - DS 1 ; NUMBER OF HELP LEVEL CURRENT NODE IS AT (0=BOTTOM) -FRNUM: - DS 1 ; NUMBER OF CURRENT FRAME -HLPNSTK: - DS 2 ; PTR TO STACK OF HELP FILE NAMES OF EACH LEVEL -HLPBUF: - DS 2 ; PTR TO HELP BUFFER -STACK: - DS 2 ; OPSYS STACK PTR - - END diff --git a/Source/Images/d_bp/u15/HELPCK.COM b/Source/Images/d_bp/u15/HELPCK.COM deleted file mode 100644 index 0a3c4980..00000000 Binary files a/Source/Images/d_bp/u15/HELPCK.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/HELPCK.MAC b/Source/Images/d_bp/u15/HELPCK.MAC deleted file mode 100644 index 643147f1..00000000 --- a/Source/Images/d_bp/u15/HELPCK.MAC +++ /dev/null @@ -1,520 +0,0 @@ -; -; PROGRAM NAME: HELPCK -; AUTHOR: RICHARD CONN -; DATE: 18 MAY 84 -; VERSION: 1.0 -; PREVIOUS VERSIONS: None -; DERIVATION: HELP.MAC 5.0 (18 MAY 84) -; NOTE: FOR USE WITH ZCPR3 ONLY -; -VERS EQU 10 -Z3ENV SET 0F400H - -; -; HELPCK performs a syntax check on HLP files. Refer -; to the file HELP.HLP for more details. -; - -FALSE EQU 0 -TRUE EQU NOT FALSE - -; -; USER EQUATES: -; Set this to TRUE if all files must be of type HLP -; -FORCEHLP EQU TRUE ; TRUE IF FILES MUST BE OF TYPE HLP - -; -; Address of Help File Buffer (Make Same as HELP.COM Buffer) -; Used to Test for Memory Overflow -; -HLPBUF EQU 0F00H ; I GOT THIS BY PEEKING AT MEM - ; AFTER RUNNING HELP ON A FILE - -; -; SYSLIB ROUTINES -; - EXT Z3INIT,Z3LOG,GETPRT - EXT PUTUD,GETUD - EXT SCTLFL,SPRINT,SOUT,CAPS,SADC,SHLDC,LOUT,SFN2 - EXT INITFCB,F$EXIST,F$OPEN,F$READ,F$CLOSE - -; -; CP/M Constants -; -UDFLAG EQU 4 ; ADDRESS OF USER/DISK FLAG -BDOS EQU 5 ; ADDRESS OF BDOS ENTRY POINT -FCB EQU 5CH ; ADDRESS OF FILE CONTROL BLOCK -FCB2 EQU 6CH ; 2ND FCB -BUFF EQU 80H ; ADDRESS OF DMA BUFFER - -CR EQU 0DH ; -LF EQU 0AH ; -BEL EQU 'G'-'@' ; ^G -FF EQU 'L'-'@' ; ^L = FORM FEED -CTRLZ EQU 'Z'-'@' ; ^Z -CTRLC EQU 'C'-'@' ; ^C - -; -; HELP Control Characters -; -IHCHAR EQU ';' ; FLAG INDICATING INDEXED BY USER -SECTCHAR EQU ':' ; DEFINED TO BE COLON -PRCHAR EQU 'P' ; PRINTER OUTPUT - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - - MVI A,1 ; SELECT CONSOLE ONLY - STA SCTLFL ; SET SWITCHED OUTPUT FLAG - LDA FCB2+1 ; LOOK FOR PRINT OPTION - CPI 'P' - JNZ START1 - MVI A,81H ; SELECT CONSOLE AND PRINTER - STA SCTLFL - -START1: - LDA BDOS+2 ; BASE PAGE OF BDOS - SUI 10 ; 2K + 2 PAGES - STA TPAEND - - XRA A ; A=0 - STA ITYPE ; SET NON-INDEXED FOR TYPE OF FILE - - CALL PUTUD ; SAVE HOME - - CALL SPRINT - DB 'HELPCK Version ' - db (vers/10)+'0','.',(vers mod 10)+'0',0 - - LXI H,FCB+1 ; CHECK FOR FILE NAME - MOV A,M - CPI '/' ; OPTION CAUGHT? - JZ STRT0 - CPI ' ' ; NONE? - JNZ STRT1 -; -; PRINT HELP MESSAGE -; -STRT0: - CALL SPRINT - DB CR,LF,'Syntax:' - DB CR,LF,' HELPCK dir:filename.typ o <-- Check File' - DB CR,LF,' HELPCK dir:filename o <-- Check filename.HLP' - DB CR,LF,'Options:' - DB CR,LF,' P = Output to Printer' - DB 0 - RET - -; -; BEGIN HELP CHECK PROGRAM -; -STRT1: -; -; CHECK FOR WILD CARDS IN FILE NAME -- ERROR IF SO -; - LXI H,FCB+1 ; PT TO FIRST BYTE OF FILE NAME - MVI B,11 ; 11 BYTES -FCBWCK: - MOV A,M ; GET BYTE - ANI 7FH ; MASK - CPI '?' ; WILD? - JZ FCBWERR - INX H ; PT TO NEXT - DCR B - JNZ FCBWCK -; -; CHECK FOR FILE TYPE -; - LXI H,FCB+9 ; CHECK FOR FILE TYPE - - IF NOT FORCEHLP - MOV A,M ; CHECK FOR FILE TYPE SPECIFIED - CPI ' ' ; NONE? - JNZ STRT2 - ENDIF -; -; PLACE DEFAULT FILE TYPE OF '.HLP' IN FCB -; - LXI D,DEFTYP ; DEFAULT FILE TYPE - MVI B,3 - XCHG - CALL MOVE ; MOVE (HL) TO (DE) FOR (B) BYTES - -; -; READ IN FILE -; -STRT2: - CALL SPRINT - DB ' Help File: ',0 - LXI D,FCB+1 ; PT TO NAME - CALL SFN2 - LXI D,FCB ; PT TO FCB - CALL Z3LOG ; LOG INTO DIRECTORY - CALL INITFCB ; RESET FCB - CALL F$EXIST ; IS FILE THERE? - JNZ STRT3 -; -; FILE NOT FOUND -; - CALL SPRINT - DB CR,LF,' File Not Found',0 - RET - -; -; FILE CONTAINS WILD CARDS -; -FCBWERR: - CALL SPRINT - DB CR,LF,' AFN Not Allowed',0 - RET - -; -; LOAD HELP FILE INFORMATION -; -STRT3: - LXI D,FCB ; OPEN FILE - CALL F$OPEN - LXI H,HLPBUF ; PT TO BUFFER - SHLD NEXTADR ; SET PTR -; -; READ RECORDS UNTIL EOF -; -STRT4: - CALL READ ; READ INFO - JZ STRT4 ; NOT DONE IF ZERO RETURN - LXI D,FCB ; CLOSE FILE - CALL F$CLOSE - CALL GETUD ; RESTORE CURRENT DISK AND USER IF CHANGED - -; -; START OF HELP PROGRAM -; -HELP: - MVI A,1 ; SET NUMBER OF INFO SECTION - STA INFONUM - LXI H,HLPBUF ; PT TO FIRST CHAR - MOV A,M ; NO HEADER SECTION? - ANI 7FH ; MASK OUT MSB - CPI SECTCHAR - JNZ HELP1 ; HEADER SECTION EXISTS -; -; CHECK NON-INDEXED HELP FILE -; - CALL SPRINT - DB CR,LF,' Help File is Not Indexed',0 - CALL CKINFO ; CHECK HELP INFO PTED TO BY HL - RET -; -; CHECK INDEXED HELP FILE -; -HELP1: - STA ITYPE ; SET INDEX TYPE - CPI IHCHAR ; INDEXED BY USER? - JNZ HELP1A - CALL SPRINT - DB CR,LF,' Help File is User-Indexed',0 - JMP HELP1B -HELP1A: - CALL SPRINT - DB CR,LF,' Help File is Indexed by HELP',0 -HELP1B: - CALL CKHEADER ; CHECK HEADER -; -; CHECK INFORMATION SECTIONS OF INDEXED HELP FILE -; -HELP2: - CALL CKINFO ; CHECK INFO SECTION - PUSH PSW ; SAVE FLAG - LDA INFONUM ; INCREMENT NUMBER OF INFORMATION SECTION - INR A - STA INFONUM - POP PSW - CPI CTRLZ ; DONE? - JNZ HELP2 - LDA ITYPE ; USER INDEXED? - CPI IHCHAR - JZ HELP3 - LDA INFONUM ; GET COUNT OF INFO SECTIONS - DCR A ; ADJUST TO CORRECT NUMBER - MOV B,A ; SAVE IN B - CALL SPRINT - DB CR,LF,CR,LF,' Information Section Count is ',0 - LDA IDXNUM ; GET NUMBER OF INDEX ENTRIES - CMP B - JZ HELP2A - CALL SPRINT - DB 'Incorrect',0 - JMP HELP3 -HELP2A: - CALL SPRINT - DB 'Correct',0 -HELP3: - CALL SPRINT - DB CR,LF,' HELPCK Done',CR,LF,0 - LDA SCTLFL ; CHECK FOR PRINTER SELECTED - ANI 80H - RZ ; DONE IF NO PRINTER OUTPUT - CALL GETPRT ; GET PRINTER DATA - INX H ; PT TO FF FLAG - INX H - INX H - MOV A,M ; GET FLAG - ORA A ; 0=NO FF - RZ - MVI A,FF ; OUTPUT FF - JMP LOUT - -; -; MOVE BYTES PTED TO BY HL TO AREA PTED TO BY DE; B BYTES TO MOVE -; -MOVE: - MOV A,M ; GET BYTE - ANI 7FH ; MASK OFF MSB -- IN CASE A WS FILE - STAX D ; PUT BYTE - INX H ; PT TO NEXT - INX D - DCR B - JNZ MOVE - RET - -; -; READ RECORD FROM DISK; NEXTADR CONTAINS ADDRESS TO READ TO -; ON RETURN, BDOS ERROR CODE IS IN A (0=NO ERROR) -; -READ: - LXI D,FCB ; PT TO FCB - CALL F$READ ; READ NEXT RECORD - PUSH PSW ; SAVE RETURN CODE - LHLD NEXTADR ; PT TO LOAD ADDRESS - LDA TPAEND ; CHECK AGAINST END PAGE OF TPA - CMP H ; IF AT SAME PAGE, YES - JZ READERROR - LXI D,BUFF ; PT TO BUFFER TO LOAD FROM - MVI B,128 ; NUMBER OF BYTES TO MOVE - XCHG - CALL MOVE - XCHG - MVI M,CTRLZ ; STORE ENDING CTRLZ IN CASE OF EOF - POP PSW ; GET RETURN CODE - ORA A ; DONE? <>0 IF SO -; -; READ DONE -- SAVE PTR TO NEXT BLOCK -; - SHLD NEXTADR ; SET NEXT ADDRESS - RET - -READERROR: - POP PSW ; CLEAR PSW - POP PSW ; CLEAR RET ADR - CALL SPRINT - DB CR,LF,' Memory Full',0 - RET - -; -; CHECK HEADER -; -CKHEADER: - MVI A,0 ; SET LINE COUNT - STA IDXNUM -CKH1: - MOV A,M ; CHECK FOR DONE - CPI SECTCHAR ; DONE? - JZ CKH2 - CPI CTRLZ ; EOF? - JZ CKH3 - CALL SKPLINE ; SKIP TO NEXT LINE - LDA IDXNUM ; INCREMENT LINE COUNT - INR A - STA IDXNUM - JMP CKH1 -CKH2: - CALL SPRINT - DB CR,LF,' Lines in Header: ',0 - LDA IDXNUM ; GET COUNT - CALL SADC - RET -CKH3: - CALL SPRINT - DB CR,LF,' Premature EOF at Header',0 - RET - -; -; CHECK INFORMATION SECTION PTED TO BY HL -; -CKINFO: - CALL SPRINT - DB CR,LF,CR,LF,' Information Section ',0 - LDA INFONUM ; GET NUMBER OF INFO SECTION - CALL SADC ; PRINT IT - MOV A,M ; CHECK FOR VALID SECTION CHAR - ANI 7FH - CPI SECTCHAR - JZ CKINFO1 - CALL SPRINT - DB CR,LF,' Info Section Does Not Begin with :',0 -CKINFO1: - INX H ; PT TO FIRST CHAR - LDA ITYPE ; TYPE OF INFO SECTION - CPI IHCHAR ; USER-INDEXED? - JZ CKINFO2 - MOV A,M ; CHECK FOR EXTERNAL FILE REFERENCE - CPI SECTCHAR - JNZ CKINFO1C - INX H ; PT TO FIRST CHAR OF FILE NAME -CKIHF: - CALL SPRINT - DB CR,LF,' External Help File: ',0 - PUSH H ; SAVE HL -CKINFO1A: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - ANI 7FH - CALL CAPS - CPI ' '+1 ; CHECK FOR RANGE - JC CKINFO1B - CALL SOUT ; PRINT CHAR - JMP CKINFO1A -CKINFO1B: - POP H ; RESTORE HL - CALL SKPLINE ; SKIP TO EOL - JMP CKINFO3 -CKINFO1C: - CALL SKPLINE ; SKIP TO EOL - CALL EMPCK ; CHECK FOR EMPTY - JMP CKINFO3 -CKINFO2: - CALL SPRINT - DB CR,LF,' User Indices: ',0 -CKI2A: - MOV A,M ; GET CHAR - ANI 7FH - INX H ; PT TO NEXT - CPI SECTCHAR ; EXTERNAL HELP FILE? - JZ CKIHF - CPI LF - JZ CKI2C - CPI ' ' - JZ CKI2A - CPI CR - JZ CKI2B - CALL CAPS ; CAPITALIZE - CALL SOUT ; PRINT INDEX - MVI A,' ' ; FOLLOWING SPACE - CALL SOUT - JMP CKI2A -CKI2B: - MOV A,M ; CHECK FOR LF - ANI 7FH - CPI LF - JZ CKI2C - INX H ; SKIP LF -CKI2C: - CALL EMPCK ; CHECK FOR EMPTY -CKINFO3: - PUSH H - LXI H,1 ; SET LINE COUNTER - SHLD LCOUNT - POP H -CKINFO4: - MOV A,M ; CHECK FOR NEW INFO SECTION - CPI SECTCHAR - JZ CKISUM - CPI CTRLZ ; EOF? - JZ CKISUM - CALL SKPLINE ; SKIP TO NEXT LINE - PUSH H ; INCREMENT LINE COUNT - LHLD LCOUNT - INX H - SHLD LCOUNT - POP H - JMP CKINFO4 -CKISUM: - PUSH H - CALL SPRINT - DB CR,LF,' Number of Lines: ',0 - LHLD LCOUNT - CALL SHLDC - POP H - RET - -; -; CHECK TO SEE IF AT EOF OR INFO SECTION AND PRINT EMPTY MESSAGE IF SO -; -EMPCK: - MOV A,M ; GET CHAR - ANI 7FH - CPI CTRLZ ; EOF? - JZ EMPCK1 - CPI SECTCHAR - RNZ -EMPCK1: - CALL SPRINT - DB CR,LF,' Information Section is Empty',0 - RET - -; -; SKIP TO END OF CURRENT LINE -; -SKPLINE: - MOV A,M ; GET CHAR - ANI 7FH ; MASK - CPI CTRLZ ; EOF? - RZ - INX H ; PT TO NEXT - CPI LF - RZ - JMP SKPLINE - -; -; BUFFER SECTION -; -DEFTYP: - DB 'HLP' ; DEFAULT TYPE OF HELP FILE -ITYPE: - DS 1 ; TYPE OF HELP FILE (IF = IHCHAR, IT IS INDEXED BY USR) -TPAEND: - DS 1 ; END PAGE ADDRESS OF TPA -LCOUNT: - DS 2 ; LINE COUNTER -INFONUM: - DS 1 ; INFORMATION SECTION NUMBER -IDXNUM: - DS 1 ; INDEX NUMBER -FIRSTENTRY: - DS 2 ; PTR TO FIRST ENTRY OF INFORMATION SECTION -NEXTADR: - DS 2 ; NEXT LOAD ADDRESS - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/HELPPR.COM b/Source/Images/d_bp/u15/HELPPR.COM deleted file mode 100644 index 97639218..00000000 Binary files a/Source/Images/d_bp/u15/HELPPR.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/HELPPR.MAC b/Source/Images/d_bp/u15/HELPPR.MAC deleted file mode 100644 index 95aa7106..00000000 --- a/Source/Images/d_bp/u15/HELPPR.MAC +++ /dev/null @@ -1,1381 +0,0 @@ -; -; PROGRAM: HELPPR -; AUTHOR: Richard Conn -; VERSION: 1.0 -; DATE: 18 May 84 -; PREVIOUS VERSIONS: None -; DERIVATION: PHELP 2.0 (28 Apr 83) -; -VERS equ 10 -z3env SET 0f400h - -FALSE EQU 0 -TRUE EQU NOT FALSE - -timeok equ FALSE ;TRUE if TIME enabled, FALSE if not - -; -; HELPPR is used to print out a HLP file. It breaks pages on each -; information section and ignores form feeds, so the data is presented -; in a sequential fashion. It is very convenient to provide online -; documentation in the form of HLP files, and this utility allows the user -; to readily print out this documentation. HELPPR is preferred over PRINT -; for printing HLP files because of its knowledge of their structure and -; its special way of handling them. -; -; HELPPR is invoked by a command line of the following form: -; HELPPR file1,file2,...,filen o... -; where each "filen" is an ambiguous file name and "o" is zero or more of -; the following options: -; H@head@ Heading Text -; The user may specify the text of the heading to -; appear at the top of every page -; I Inspect Files -; The user approves each file to be printed -; before the printing process begins -; L Toggle Line Numbering -; Each line may or may not begin with a line number -; Snnnn Skip to Specified Page -; Printing begins at the indicated page -; T Toggle Time Display -; Time/Date information is optionally included -; in the page header -; - -; -; BASIC SYSLIB ROUTINES NEEDED BY HELPPR -; -C$ESIZE EQU 16 ; SIZE OF DIR ENTRY (FROM SYSLIB DIRF ROUTINE) - - EXT DIRQS ; DIRECTORY PROCESSOR - - EXT Z3INIT ; INIT BUFFERS - EXT ZFNAME ; FILE NAME PROCESSOR - EXT Z3LOG ; LOG INTO DIR - - EXT INITFCB ; INIT FCB - EXT RETUD ; RETURN CURRENT USER/DISK - EXT PUTUD ; SAVE CURRENT USER/DISK - EXT GETUD ; RESTORE CURRENT USER/DISK - EXT EPRINT ; PRINT STRING PTED TO BY RET ADR - EXT PADC ; PRINT A AS DECIMAL CHARS - EXT COUT ; CONSOLE OUTPUT ROUTINE - EXT CST ; CONSOLE STATUS ROUTINE - EXT CIN ; CONSOLE INPUT ROUTINE - EXT CAPS ; CAPITALIZE ROUTINE - EXT CRLF ; NEW LINE ROUTINE - EXT CODEND ; CODE END COMPUTATION ROUTINE - - EXT F$OPEN ; FILE OPEN - EXT F$READ ; BLOCK READ - EXT F$CLOSE ; FILE CLOSE - - ext getprt - ext eval10 - ext lcrlf - ext lpstr - ext lprint - ext lout - ext lhldc - ext condin - ext moveb -; - if timeok - ext time - endif -; - -; -; Insert Function-Required Library References Here -; - -; -; CP/M EQUATES -; -CPM EQU 0 ; WARM BOOT -BDOSE EQU CPM+5 ; BDOS ENTRY -FCB EQU CPM+5CH ; FCB -TBUFF EQU CPM+80H ; INPUT LINE BUFFER -DEL EQU 7FH ; -CR EQU 13 ; -FF EQU 12 ; -LF EQU 10 ; -CTRLC EQU 'C'-'@' ; ^C -CTRLG EQU 'G'-'@' -CTRLH EQU 'H'-'@' -CTRLI EQU 'I'-'@' -CTRLS EQU 'S'-'@' -CTRLX EQU 'X'-'@' -CTRLZ EQU 'Z'-'@' -eold equ 0FFH ;End of Load Indicator - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - jmp startx -; -; **** Special Initial Value Area for User Installation -; -LWIDTH: - DB 132 ; PRINTER LINE WIDTH -LTPP: - DB 44 ; LINES OF TEXT PER PAGE -LSPP: - DB 5 ; LINES TO SKIP PER PAGE -LFF: - DB 1 ; FORM FEED FLAG -; -; NOTE: LTPP + LSPP + 2 (HEADER SIZE) = TOTAL LINES PER PAGE ON PRINTER -; -DLNUMFL: - DB 0 ; LINE NUMBER FLAG (DEFAULT TO NO) -DTIMEPFL: - DB 0FFH ; TIME PRINT FLAG (DEFAULT TO YES) -DINSPECT: - DB 0 ; INSPECT FILES (DEFAULT TO NO) -; -; WORKING BUFFERS -; -LNUMFL: - DB 0 ; LINE NUMBER FLAG -TIMEPFL: - DB 0FFH ; TIME PRINT FLAG -INSPECT: - DB 0 ; INSPECT FLAG -SKIPFL: - DB 0 ; SKIP FLAG (DEFAULT TO NO) -SKIPNUM: - DS 2 ; PAGE NUMBER TO SKIP TO -LNUM: - DS 2 ; CURRENT LINE NUMBER -PNUM: - DS 2 ; CURRENT PAGE NUMBER -HBUF: - DS 2 ; BUFFER FOR HEADING -; - if timeok -TIMEBF: - DS 100 ; BUFFER FOR TIME STAMP - endif -; -; Start of Program -; -STARTX: - LXI H,0 ; GET STACK PTR - DAD SP - SHLD V$STACK ; SAVE IT - XRA A ; A=0 - STA V$INSPECT ; TURN OFF FILE INSPECTION - CALL PUTUD ; SAVE CURRENT USER/DISK AWAY - call codend ; determine free space - shld V$CMDLNE ; set command line ptr - lxi d,100h ; arbitrary size - dad d - shld HBUF ; ptr to heading buffer - dad d - shld dirbuf ; ptr to dir buffer - sphl ; new stack - -; -; Save Command Line -; - lhld V$CMDLNE ; save command line - LXI D,TBUFF+1 ; SAVE COMMAND LINE - xchg - mvi b,80h ; 128 bytes - call moveb - -; -; Setup Printer Data -; - call getprt - mov a,m ;get width - sta lwidth - inx h - inx h - mov a,m ;get lines of text per page - sta ltpp - mov b,a ;save in B - dcx h - mov a,m ;get lines per page - sub b ;compute difference - sta lspp ;lines to skip per page - inx h - inx h - mov a,m ;get form feed flag - sta lff - -; -; Banner of Program -; - CALL BANNER ; PRINT BANNER -; -; Check for Help Request -; - LDA FCB+1 ; GET FIRST CHAR OF FILE NAME - CPI ' ' ; NO FILE SPEC? - JZ T$HELPENT - CPI '/' ; OPTION CAUGHT? - JNZ T$ECONT - -; -; Print Help Information -; -T$HELPENT: - CALL HELP ; PRINT PROGRAM'S HELP MESSAGE - -; -; RETURN TO OS -; -T$RETURN: - CALL DINIT ; DEINIT PROGRAM - LHLD V$STACK ; GET OLD STACK - SPHL ; SET IT - RET - -; -; PROGRAM'S INIT ROUTINE -; -T$ECONT: - CALL INIT ; PROG INIT ROUTINE -; -; EXTRACT FLAGS IF PRESENT -; - LXI H,0 ; SET FILE COUNT - SHLD V$FILECNT - LHLD V$CMDLNE ; PT TO BUFFER -; -; SKIP TO FILE NAME STRING -; - CALL T$SBLANK ; SKIP OVER BLANKS -; -; SKIP TO END OF FILE NAME STRING -; - CALL T$SNBLANK ; SKIP OVER NON-BLANKS -; -; CHECK FOR LEADING SLASH ON OPTION AND SKIP IT IF SO -; -T$OPT: - CPI '/' ; OPTION CHAR? - JNZ T$OPTION - INX H ; SKIP SLASH -; -; PROCESS LIST OF OPTIONS -; -T$OPTION: - MOV A,M ; GET BYTE - ORA A ; DONE? - JZ T$DSPEC - INX H ; PT TO NEXT CHAR - CPI ' ' ; SKIP OVER SPACES - JZ T$OPTION - MOV C,A ; COMMAND IN C - LXI D,OPTAB ; PT TO OPTION TABLE -T$OPTL: - LDAX D ; GET OPTION LETTER - ORA A ; END OF TABLE? - JZ T$HELPENT ; HELP IF SO - CMP C ; MATCH? - JZ T$OPTM ; PROCESS IF SO - INX D ; PT TO NEXT ENTRY - INX D - INX D - JMP T$OPTL -; -; PROCESS OPTION -; -T$OPTM: - PUSH H ; SAVE HL ON STACK - LXI H,T$OPTION ; GET RETURN ADDRESS - XTHL ; ... ON STACK AND RESTORE HL - INX D ; PT TO ADDRESS - LDAX D ; GET ADDRESS LOW - MOV B,A ; ... IN B - INX D - LDAX D ; GET ADDRESS HIGH - MOV D,A ; ... IN D - MOV E,B ; LOW IN E - PUSH D ; PUT ADDRESS ON STACK - MOV A,C ; COMMAND IN A - RET ; "CALL" OPTION ROUTINE -; -; BEGIN MOVING THROUGH FILE NAMES, SEPARATED BY COMMAS -; -T$DSPEC: - LHLD V$CMDLNE ; PT TO FIRST BYTE - CALL T$SBLANK ; SKIP TO NON-BLANK -; -; MAJOR REENTRY POINT WHEN FILE SPECS ARE SEPARATED BY COMMAS -; HL PTS TO FIRST BYTE OF NEXT FILE SPEC -; -T$DSPEC1: - shld hltemp ; save HL - lhld dirbuf ; reset stack - sphl - lhld hltemp ; restore HL - CALL GETUD ; RESET USER IF NECESSARY - LXI D,V$NTFCB ; PT TO FCB IN DE, PT TO 1ST CHAR OF FN IN HL - MVI A,0 ; DIR before DU - CALL ZFNAME ; EXTRACT FILE NAME INTO FCB, AND GET DISK AND USER - - push b ;save disk/user - push h ;save others - push d - lxi h,hlptyp ;optionally set default HLP type - lxi d,V$NTFCB+9 ;check for any specified - ldax d ;' ' means none - cpi ' ' - jnz hlpskp - mvi b,3 ;3 chars - call moveb -hlpskp: - pop d ;restore others - pop h - pop b ;restore disk/user - SHLD V$NEXTCH ; SAVE PTR TO DELIMITER WHICH ENDED SCAN - -; -; LOAD DIRECTORY AND PERFORM FUNCTION -; -T$FCT: - LXI D,V$NTFCB ; PT TO FCB - CALL Z3LOG ; LOG INTO ACCOUNT - LHLD DIRBUF ; PT TO DIR BUFFER - MVI A,11000000B ; SELECT SYS AND NON-SYS FILES - LXI D,V$NTFCB ; PT TO FCB - CALL INITFCB ; INIT THE FCB - CALL DIRQS ; LOAD DIR, SELECT FILES, PACK, AND ALPHABETIZE -; -; DETERMINE BEGINNING OF SCRATCH AREA (SCRATCH) AND SIZE IN PAGES (BCNT) -; - PUSH H ; SAVE PTR AND COUNT - PUSH B - LXI D,C$ESIZE ; SET PTR TO NEXT FREE BLOCK -T$FCTFRE: - MOV A,B ; DONE? - ORA C - JZ T$FCTFR1 - DAD D ; PT TO NEXT - DCX B ; COUNT DOWN - JMP T$FCTFRE -T$FCTFR1: - INR H ; NEXT PAGE - MVI L,0 - SHLD V$SCRATCH ; SET PTR TO SCRATCH AREA - XCHG ; PTR IN DE - LHLD BDOSE+1 ; COMPUTE BLOCK BUFFER SIZE - MOV A,H ; ADJUST FOR ZCPR3 - SUI 10 - SUB D ; A=SIZE IN BLOCKS - STA V$BCNT ; SET BLOCK COUNT - POP B ; RESTORE AND SAVE REGS - POP H -; -; ALLOW USER TO INSPECT FILES -; - PUSH H - PUSH B - CALL T$ICHECK ; CHECK FOR INSPECT OPTION AND INSPECT IF SET - POP B ; RESTORE COUNT AND PTR - POP H - -; -; PERFORM FUNCTION; HL PTS TO FILE AND BC CONTAINS NUMBER OF FILES -; -T$FCTL: - MOV A,B ; CHECK FOR COMPLETION (COUNT = 0) - ORA C - JZ T$FCTL1 - DCX B ; COUNT DOWN - SHLD HLTEMP ; SET STACK - LHLD DIRBUF - SPHL - LHLD HLTEMP - PUSH B ; SAVE COUNT AND PTR - PUSH H - MOV A,M ; SELECTED FILE? - ORA A ; 0=YES - CZ FUNCTION ; PERFORM FUNCTION -; -; ENTRY POINT TO SKIP TO NEXT FILE IN LIST -; -E$FCTLNXT: - LHLD DIRBUF ; RESTORE STACK - LXI D,-4 ; 4 DOWN - DAD D - SPHL - POP H ; RESTORE PTR - POP B ; RESTORE COUNT - LXI D,C$ESIZE ; PT TO NEXT ENTRY - DAD D - JMP T$FCTL - -; -; CHECK FOR NEXT FILE SPEC -; -T$FCTL1: - CALL GETUD ; RETURN TO BASE USER/DISK - LHLD V$NEXTCH ; GET PTR - MOV A,M ; GET DELIM - CPI ',' ; ANOTHER FILE? - JNZ T$RETURN - INX H ; PT TO CHAR AFTER COMMA - JMP T$DSPEC1 ; CONTINUE PROCESSING -; -; INSPECT FILES -- THIS ROUTINE IS TO PERFORM A FILE INSPECTION -; ON INPUT, HL PTS TO FIRST 16-BYTE ENTRY AND BC=NUMBER OF ENTRIES -; -T$ICHECK: - MOV A,B ;ANY FILES? - ORA C ;0=NO - RZ - PUSH H ;SAVE PTRS - PUSH B - LXI D,C$ESIZE ;SIZE OF ENTRY -T$ICHK1: - MVI M,0 ;CLEAR MSBYTES - DAD D ;PT TO NEXT - DCX B ;COUNT DOWN - MOV A,B ;DONE? - ORA C - JNZ T$ICHK1 - POP B ;RESTORE PTRS - POP H - LDA V$INSPECT ;INSPECT? - ORA A ;0=NO - RZ - CALL EPRINT - DB CR,LF,' File Inspect Mode' - db cr,lf,' Cmd Function Cmd Function' - DB CR,LF,' Y(def) Select File Q Select Rest of Files' - DB CR,LF,' N Don''t Select S Skip Rest of Files' - db cr,lf,0 -T$ICHK2: - CALL EPRINT - DB CR,LF,'Select ',0 - CALL E$PRFN ;PRINT FILE NAME - CALL EPRINT - DB ' -- (Y/N/Q/S)? ' - DB 0 - CALL CIN ;GET RESPONSE - CALL CAPS ;CAPITALIZE - CALL COUT ;ECHO - CPI 'Q' ;SELECT REST? - JZ T$ICHKYR - CPI 'S' ;SKIP REST - JZ T$ICHKNR - CPI 'N' ;NO TO THIS ONE? - JNZ T$ICHK3 - MVI M,0FFH ;SET NO FLAG IN FILE FCB -T$ICHK3: - DAD D ;PT TO NEXT ONE - DCX B ;COUNT DOWN - MOV A,B ;DONE? - ORA C - JNZ T$ICHK2 - RET -; CHECK REST OF FILES AS SELECTED -T$ICHKYR: - CALL EPRINT - DB CR,LF,' Rest of Files Selected',0 - RET -; CHECK REST OF FILES AS NOT SELECTED -T$ICHKNR: - MVI M,0FFH ;SET NO FLAG - DAD D ;PT TO NEXT - DCX B ;COUNT DOWN - MOV A,B ;DONE? - ORA C - JNZ T$ICHKNR - CALL EPRINT - DB CR,LF,' Rest of Files NOT Selected',0 - RET -; -; UTILITIES -; T$SBLANK -- SKIP BLANKS PTED TO BY HL UNTIL NON-BLANK ENCOUNTERED; HL -; T$SNBLANK -- SKIP NON-BLANKS PTED TO BY HL UNTIL BLANK OR EOL; HL -; E$PRFN -- PRINT FILE NAME PTED TO BY HL; AFFECT NOTHING - -; -; SKIP UNTIL NON-BLANK -; -T$SBLANK: - MOV A,M ; LOOK FOR BLANK - INX H ; PT TO NEXT - CPI ' ' ; BLANK? - JZ T$SBLANK - DCX H ; BACK UP - RET - -; -; SKIP UNTIL BLANK OR EOL -; -T$SNBLANK: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - CPI ' ' ; BLANK? - JZ T$SNB1 - ORA A ; EOL? - JNZ T$SNBLANK -T$SNB1: - DCX H ; BACK UP - RET - -; -; PRINT FILE NAME PTED TO BY HL -; OUTPUT TO CON: -; -E$PRFN: - PUSH H ; SAVE REGS - PUSH B - CALL RETUD ; GET CURRENT USER/DISK - MOV A,B ; GET DISK NUMBER - ADI 'A' ; CONVERT TO LETTER - CALL COUT ; PRINT LETTER - MOV A,C ; GET USER NUMBER - CALL PADC ; PRINT USER NUMBER - CALL EPRINT - DB ': ',0 - INX H ; PT TO FILE NAME - MVI B,8 ; PRINT NAME - CALL T$PRNT - MVI A,'.' ; DECIMAL - CALL COUT - MVI B,3 ; PRINT TYPE - CALL T$PRNT - POP B ; GET REGS - POP H - RET - -; -; PRINT CHARS PTED TO BY HL FOR B BYTES -; OUTPUT TO CON: -; -T$PRNT: - MOV A,M ; GET CHAR - CALL COUT - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ T$PRNT - RET - -;*********************************************** -;* Application-Specific Section -;*********************************************** - -;**************************************************** -;* -;* Function-Specific Routines -;* These routines need to be customized for the -;* specific function being performed. These, in -;* effect, implement the function. Other Entry Points -;* useful to the programmer are: -;* E$FCTLNXT -- Clean Abort of Current -;* Processing and Skip -;* to Next File in List; -;* This is a Clean Way to -;* Abort FUNCTION for the -;* Next File -;* E$PRFN -- Print File Name Pted to -;* by HL; No Regs Affected -;* -;**************************************************** - -; -; **** EMERGENCY ABORT -; -ABORT: - CALL EPRINT - db cr,lf,' HELPPR Abort' - DB 0 - mvi a,cr ; new line - call lout - mvi a,lf - call lout - CALL GETUD ; RETURN HOME - JMP T$RETURN -; -; **** BANNER -- PRINT BANNER FOR PROGRAM (PROGRAM NAME ET AL) -; -BANNER: - CALL EPRINT - db 'HELPPR Version ' - db (vers/10)+'0','.',(vers mod 10)+'0' - DB 0 - RET -; -; **** HELP -- PRINT PROGRAM'S HELP MESSAGE -; -HELP: - CALL EPRINT - db cr,lf,'Syntax:' - db cr,lf,' HELPPR afn1,afn2,... o...' - db cr,lf,'Options:' - db cr,lf,' H@head@ -- Use "head" as header on every page' - db cr,lf,' I -- Inspect Files for Printing' - db cr,lf,' L -- Number Each Line' - db cr,lf,' Onn -- Offset Each Line by nn Spaces' - db cr,lf,' Snn -- Skip to Page nn and Start Printing' - db cr,lf,' T -- Toggle Time Display' - DB 0 - RET -; -; **** PROGRAM INIT ROUTINE -; THIS ROUTINE IS USED BY THE PROGRAM TO PERFORM ANY NECESSARY -; INITIALIZATIONS -; -INIT: - lxi h,dlnumfl ;copy defaults into buffers - lxi d,lnumfl - mvi b,3 ;3 bytes - call moveb - xra a ;A=0 - sta skipfl ;set no skip - sta offset ;set no offset - push h - lhld hbuf ;pt to heading buffer - mov m,a ;store zero to set no heading - pop h -; - if timeok - call time ;get time string - lxi d,timebf ;store in buffer -initt: - mov a,m ;get byte - stax d - inx h ;pt to next - inx d - ora a ;done? - jnz initt - endif -; - RET -; -; **** FUNCTION COMPLETE -- CLEANUP AND EXIT -; FILL THIS IN WITH CLEANUP CODE FOR EXIT -; -DINIT: - RET -; -; **** OPTION TABLE USED TO PROCESS COMMAND LINE -; EACH OPTION IS A CAPITAL LETTER OR SPECIAL CHAR FOLLOWED BY -; AN ADDRESS; THE TABLE IS TERMINATED BY A BINARY ZERO -; -OPTAB: - DB 'I' ; FILE INSPECTION OPTION - DW OPTINSP ; REMOVE THESE TWO LINES AND THE FOLLOWING ROUTINE - ; IF YOU DO NOT WANT FILE INSPECTION OPTION IN - ; COMMAND LINE - db 'H' ;heading - dw opthead - db 'L' ;line numbers - dw optln - db 'O' ;offset - dw optoffs - db 'S' ;skip - dw optskip -; - if timeok - db 'T' ;time display - dw opttime - endif -; - DB 0 ; END OF TABLE -; -; **** OPTION ROUTINES -; EACH ROUTINE IS PROVIDED THE OPTION CHARACTER IN THE A REGISTER -; AND A POINTER TO THE NEXT CHARACTER IN THE COMMAND LINE IN THE -; HL REGISTER PAIR; ONLY HL NEED TO BE PRESERVED (WITH OPTIONAL -; ADVANCEMENT TO THE NEXT OPTION) ON EXIT -; -OPTINSP: - MVI A,0FFH ; TURN ON FILE INSPECTION OPTION - STA V$INSPECT ; THIS IS PROVIDED AS A SAMPLE ROUTINE - ; AND FOR THE INDICATED FUNCTION - RET -; -; Set Page Offset -; -optoffs: - call eval10 ;get number - mov a,e ;get low-order byte - sta offset ;set offset - ret -; -; Option: H (Set Heading) -; -opthead: - xchg - lhld hbuf ;pt to heading buffer - xchg - mov a,m ;get delim - ora a ;none? - rz - mov b,a ;delim in B - inx h ;pt to next char -opthd1: - mov a,m ;get next char - ora a ;done? - jz opthd3 - cmp b ;done? - jz opthd2 - stax d ;save char - inx h ;pt to next - inx d - jmp opthd1 -opthd2: - inx h ;skip over delim -opthd3: - xra a ;store ending 0 - stax d - ret -; -; Option: L (Set Line Numbering) -; -optln: - lda lnumfl ;flip flag - cma - sta lnumfl - ret -; -; Option: S (Skip Lines) -; -optskip: - mvi a,0ffh ;set flag - sta skipfl - call eval10 ;get number - xchg - shld skipnum ;set page number to skip to - xchg ;HL pts to next char - mov a,d ;see if page number was zero - ora e - rnz - xra a ;if zero, turn off skip flag - sta skipfl - ret -; - if timeok -; -; Set Time Flag -; -opttime: - lda timepfl ;flip flag - cma - sta timepfl - ret -; - endif -; -; **** FUNCTION -- MAIN FUNCTION OF TEMPLATE -; ON ENTRY, HL PTS TO NAME OF FILE (16 BYTES) AND USER IS LOGGED INTO -; DIRECTORY CONTAINING INDICATED FILE -; -FUNCTION: -; -; HELP FILE PRINT Routine -- Print the Help File Whose Name is Pointed to by -; HL; we are already logged into the correct directory -; - call prinit ;init print buffers - call fload ;load buffer initially - call prhead ;print heading line - lhld V$SCRATCH ;pt to first char in file - shld nxtln ;set pointer to next line - mvi a,0ffh ;first line - sta firstf - call prline ;print first line (special case) - xra a ;not first line now - sta firstf -fprloop: - call prline ;print line of file - jnz fprloop ;done if EOF - call page ;advance to top of next page - ret -; -; Init Print Buffers and Print File Name -; -prinit: - lxi d,tfcb ;set up FCB - mvi b,12 ;12 bytes - call moveb - lxi h,0 ;HL=0 - shld lnum ;set line number - inx h ;HL=1 - shld pnum ;set page number - lda ltpp ;set line count - sta lcount - call eprint - db cr,lf,' Printing Help File ',0 - lxi h,tfcb ;pt to FCB - call e$prfn ;print file name - ret -; -; FILE LOAD (FLOAD) Routine -- Initial Load of memory buffer -; -fload: - lxi d,tfcb ;pt to file fcb - call initfcb ;init file's fcb - call f$open ;open file for input - jz fload1 ;open was OK - call eprint - db cr,lf,' File ',0 - xchg ;HL pts to FCB - call e$prfn ;print file name - call eprint - db ' NOT Found',0 - pop d ;clear return address - ret ;abort printout of this file -; -; This is an entry point for further memory loads of the file -; -fload1: - lda V$BCNT ;get number of blocks to load - mov c,a ;... in C - lhld V$SCRATCH ;get address of first block to load into - shld nxtblk ;set pointer to next block to load -fload2: - call rdblk ;read a block (128 bytes) - jnz eof ;eof encountered? - call rdblk ;read another block (128 bytes) - jnz eof ;eof encountered? - dcr c ;count down - jnz fload2 - lhld nxtblk ;pt to next byte to load - mvi m,eold ;mark end of load - ret -eof: - lxi d,tfcb ;close file - call f$close - lhld nxtblk ;ensure ^Z - mvi m,ctrlz - ret -rdblk: - lxi d,tfcb ;pt to FCB - call f$read ;read next block - ora a ;error? - rnz - lhld nxtblk ;get ptr to next block - xchg ; as dest - lxi h,tbuff ;ptr to DMA address - mvi b,128 ;copy 128 bytes -rdblk1: - mov a,m ;get byte - ani 7fh ;mask out msb - stax d ;put byte - inx h ;pt to next - inx d - dcr b ;count down - jnz rdblk1 - xchg ;new nxtblock - shld nxtblk - ret - -; -; Line Print Routine -; Print Next Line with Optional Disk Load -; Input Parameter is NXTLN, which is the address of the first char -; on the next line -; Output Parameter is Zero Flag, with Z meaning done with print, NZ -; meaning more yet to print -; -prline: - lhld lnum ;increment line number - inx h - shld lnum -prl0: - lhld nxtln ;pt to first char of next line - lda firstf ;first char? - ora a ;0=no - jnz prl01 - mov a,m ;get first char of line - cpi ':' ;new information section? - cz page ;page eject with heading -prl01: - call proffs ;print offset - mvi c,0 ;init char count - mov a,m ;get first char of line - cpi ctrlz ;EOF? - cnz prlnum ;print line number (optional) -prl1: - mov a,m ;get char - cpi eold ;end of load? - jz prload - cpi ctrlz ;eof? - jz prexit - inx h ;pt to next char - cpi ctrli ;tab? - jz prtab - cpi cr ;? - jz prldn - cpi ff ;form feed? - jz prldn - cpi lf ;end of line? - jz prl1 - cpi ctrlh ;back space? - jz prbs - cpi ctrlg ;ring bell? - jz prbell - cpi del ;delete char? - jz prl1 ;skip it - cpi ' ' ;other control char? - jc prl1 ;skip if other control char - call prout ;print char - inr c ;increment char count - call eoltest ;check to see if at end of line and newline if so - jmp prl1 -; -; End of Load Reached -- Load More of File from Disk -; -prload: - push b ;save char count - call fload1 ;use load routine - pop b ;get char count - lhld V$SCRATCH ;next byte is here - jmp prl1 ;continue processing -; -; Tabulate -; -prtab: - mvi a,' ' ;space - call prout - inr c ;new char - call eoltest ;process EOL - mov a,c ;done? - ani 7 - jnz prtab ;continue tabulation - jmp prl1 ;continue processing -; -; Exit with Zero Flag Set if Done -; -prexit: - xra a ;set zero flag - ret -; -; Carriage Return -- End of Routine -; -prldn: - mov a,m ;skip to non-LF - cpi lf - jnz prldn1 - inx h ;skip to first char of next line -prldn1: - mvi a,cr ;output - call prout - mvi a,lf ;output - call prout ;echo LF to printer - shld nxtln ;set ptr to first char of next line - mvi a,0ffh ;set not done - ora a ;set flags - ret -; -; Backspace on Printer -; -prbs: - mov a,c ;check for beginning of line - ora a - jz prl1 ;continue if at BOL - mvi a,ctrlh ;backspace - call prout - dcr c ;back up char position - jmp prl1 ;continue -; -; Ring Bell on Printer -; -prbell: - call prout ;ring the bell - jmp prl1 ;continue without advancing char position -; -; Test for End of Line and Process if so -; -eoltest: - lda offset ;get offset - mov b,a ;... in B - lda lwidth ;get line width - sub b ;subtract offset - sui 4 ;4 chars less for continuation mark - mov b,a ;result in B - lda lnumfl ;line numbering (lines are 7 chars shorter if so) - ora a ;0=no - jz eolt1 - mov a,b ;reduce by 7 for line numbers - sui 7 - mov b,a -eolt1: - mov a,b ;get line width - cmp c ;there? - rnz ;continue if not - mov a,m ;get next char - cpi cr ;new line next? - rz ;continue if so - cpi ctrlh ;backspace next? - rz ;continue if so - mvi b,3 ;look ahead 3 chars - push h -eolt2: - inx h ;pt to next - mov a,m ;get char - cpi cr ;EOL? - jz eolt3 - dcr b ;count down - jnz eolt2 - jmp eolt4 -eolt3: - pop h ;restore ptr - ret -eolt4: - pop h ;restore ptr - mvi a,' ' ;print continuation chars - call prout - mvi a,'<' - call prout - mvi a,'<' - call prout - mvi a,cr ;new line - call prout - mvi a,lf - call prout - mvi c,0 ;reset char position - lda skipfl ;skipping? - ora a ;0=no - rnz - call proffs ;print offset - lda lnumfl ;printing line numbers? - ora a ;0=no - rz - call lprint - db ' : ',0 - ret -; -; Output a character to the printer -; A = Character -; -prout: - mov b,a ;char in B - call condin ;check for abort - jz prout1 - cpi ctrlc ;abort? - jz abort - cpi ctrlx ;abort this one file? - jz cxabort -prout1: - lda skipfl ;skipping? - ora a ;set flags (Z=no skip=print char) - mov a,b ;restore char - cz lout ;send character to printer - cpi lf ;special tests if it is a line feed - rnz ;done if non-LF char - lda lcount ;decrement line counter - dcr a - sta lcount - rnz -; -; Paging Required -; Skip to top of next page; reset LCOUNT (Lines Left on Page Count); -; print header -; -prout0: - lda ltpp ;get number of text lines per page - sta lcount ;set as new line count - push h ;save ptr - lhld pnum ;increment page number - inx h - shld pnum - lda lspp ;get number of lines to skip per page - call lineskp ;skip lines - pop h ;restore ptr - mov a,m ;check next character - cpi ctrlz ;EOF? - cnz prhead ;print 2-line heading if NOT EOF - ret -; -; Abort current file with final page eject -; -cxabort: - lda lcount ;get count of remaining lines - call lineskp ;skip lines - lda lff ;form feed? - ora a ;NZ=yes - jnz e$fctlnxt ;continue with next file since already FF - lda lspp ;number of lines to skip per page - call lineskp ;skip lines - jmp e$fctlnxt ;continue with next file -; -; Skip out rest of page -; Form Feed Function -; -page: - lda lff ;form feed? - ora a ;NZ=yes - jnz prout0 ;PROUT0 will FF - lda lcount ;get count of remaining lines - call lineskp ;skip lines - jmp prout0 ;process top of new page -; -; Skip out lines on page -; A = number of lines to skip -; -lineskp: - mov b,a ;line count in B - ora a ;any? - rz - lda skipfl ;skipping? - ora a - rnz - lda lff ;form feed? - ora a ;NZ=yes - jnz lines2 -lines1: - mvi a,cr ;output new line to printer - call lout - mvi a,lf - call lout - dcr b ;count down - jnz lines1 - ret -lines2: - mvi a,cr ;output new line - call lout - mvi a,ff ;output form feed - jmp lout - -; -; Print Line Number (optional) -; -prlnum: - lda skipfl ;skipping? - ora a ;0=no - rnz - lda lnumfl ;get flag - ora a ;0=don't number lines - rz - push h ;save ptr - lhld lnum ;get line number - call lhldc ;print line number - call lprint ;print separator - db ': ',0 - pop h ;restore ptr - ret -; -; Print 2-line heading and control skipping -; -prhead: - push h ;save ptr - lda skipfl ;currently skipping? - ora a ;0=no - cnz skiptst ;test for shut off - call proffs ;print offset - call prpnum ;print page heading and number - call e$prfname ;print file name -; - if timeok ;time available? - lda timepfl ;print time? - ora a ;0=no - cnz prtime ;print time - endif -; - push h ;get first char of heading - lhld hbuf - mov a,m - pop h - ora a ;0=no - cnz prhdg ;print heading - pop h ;restore ptr - lda skipfl ;skipping? - ora a - rnz - call lcrlf ;new line - jmp lcrlf -; -; Test for completion of skipping -; -skiptst: - lhld pnum ;get page number - xchg ;... in DE - lhld skipnum ;get page to skip to - mov a,h ;compare them - cmp d - rnz - mov a,l - cmp e - rnz - xra a ;A=0 to stop skipping - sta skipfl ;set flag - ret -; -; Print Page Number -; -prpnum: - lda skipfl ;skipping? - ora a - rnz - call lprint ;print header - db 'Page ',0 - lhld pnum ;print current page number - call lhldc ;print as decimal - ret -; -; Print File Name -; -e$prfname: - lda skipfl ;skipping? - ora a - rnz - call lprint ;print separator - db ' -- Help File: ',0 - lxi h,tfcb+1 ;pt to first char - mvi b,8 ;8 chars - call lfn1 - mvi a,'.' - call lout - mvi b,3 ;3 chars - call lfn1 - ret -lfn1: - mov a,m ;get char - ani 7fh ;mask - call lout ;send to printer - inx h ;pt to next - dcr b ;count down - jnz lfn1 - ret -; -; Print Separator -; -prdash: - call lprint - db ' -- ',0 - ret -; - if timeok -; -; Print Time -; -prtime: - lda skipfl ;skipping? - ora a - rnz - call prdash ;print separator - lxi h,timebf ;pt to time stamp - call lpstr ;print - ret -; - endif -; -; Print Header -; -prhdg: - lda skipfl ;skipping? - ora a - rnz - call prdash ;print separator - lhld hbuf ;pt to heading - call lpstr ;print - ret - RET -; -; Print Line Offset -; -proffs: - lda skipfl ;skipping? - ora a - rnz - push b ;save BC - lda offset ;get offset - ora a ;any? - jz proff2 - mov c,a ;offset in C -proff1: - mvi a,' ' ;space over - call prout - dcr c ;count down - jnz proff1 -proff2: - pop b - ret -; -; **** HELPPR BUFFERS -; -offset: - ds 1 ;line offset -hltemp: - ds 2 ;temporary save area for HL -dirbuf: - ds 2 ;ptr to directory -firstf: - ds 1 ;first line in file flag -tfcb: - ds 36 ;FCB for current file -nxtblk: - ds 2 ;ptr to next block to load -nxtln: - ds 2 ;ptr to next line to read -lcount: - ds 1 ;count of text lines left on page -hlptyp: - db 'HLP' ;file type of HLP file - -;*********************************************** -;* End of Application-Specific Section -;*********************************************** - -; -; BUFFERS -; -V$DISK: - DS 1 ; HOME DISK NUMBER -V$USER: - DS 1 ; HOME USER NUMBER -V$CDISK: - DS 1 ; CURRENT DISK NUMBER -V$CUSER: - DS 1 ; CURRENT USER NUMBER -V$CMDLNE: - DS 2 ; PTR TO COMMAND LINE STRING -V$NEXTCH: - DS 2 ; PTR TO NEXT CHAR IN MULTIFILE COMMAND LINE -V$FILECNT: - DS 2 ; COUNT OF NUMBER OF FILES RENAMED -V$SCRATCH: - DS 2 ; ADDRESS OF FIRST BYTE OF SCRATCH AREA -V$BCNT: - DS 1 ; NUMBER OF PAGES IN SCRATCH AREA -V$INSPECT: - DS 1 ; INSPECT FLAG -V$NTFCB: - DS 36 ; FCB FOR NEW FILE -; -; Stack -; -V$STACK: - DS 2 ; OLD STACK PTR - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/HELPSYS.HLP b/Source/Images/d_bp/u15/HELPSYS.HLP deleted file mode 100644 index a69131bc..00000000 --- a/Source/Images/d_bp/u15/HELPSYS.HLP +++ /dev/null @@ -1,793 +0,0 @@ -; - HELP - The Online Documentation System for ZCPR3 - - W - Welcome to the HELP Command - - -- HELP Subsystem -- -- Using HELP -- - 1 - HELP Command U - How to Use HELP - 2 - HELPCK Command M - Moving Around in HELP - 3 - HELPPR Command P - Help Command Prompts - E - HELP Error Messages - O - Printing Help Files - - -- Writing HELP Files -- - H - How to Write HELP Files - V - Accessing Video Attributes - T - HELP File Tree Structure - S - Sample HELP Files - -:1 - -Command: HELP 5.0 - -Syntax: - HELP <-- display HELP.HLP -or - HELP filename.typ <-- display HELP file - (iæ 'typ§ omitted¬ HLÐ ió used) - -Function: - - HELР displayó HELÐ fileó iî aî interactivå waù tï  thå -useò oî hió consolå CRT®  Iô ió alsï ablå tï prinô selecteä -screens or information sections on the printer. - -Options: - None - - -Comments: - See text - -Selected Error Messages: - See appropriate information section - -Examples of Use: - - HELP - -- display HELP.HLP - - HELP myfile - -- display myfile.HLP - - HELP myfile.txt - -- display myfile.txt - -:2 - -Command: HELPCK 1.0 - -Syntax: - - HELPCK dir:ufn o <-- default file type is HLP - -Function: - - HELPCË ió useä tï checë thå syntaø oæ á HELÐ file®  Iô -analyzeó  thå file¬  providinç á varietù oæ  statisticó  anä -reportinç  oî  structuraì errors®  Theså reportó includå  á -listinç oæ thå optionó iæ thå filå ió user-indexed¬ anä thió -listinç caî bå manuallù checkeä bù thå useò tï seå thaô  alì -optionó  arå  includeä  anä nï  additional¬  hiddeî  optionó -exist. - -Options: - P - Send report to Printer - - -Comments: - - None - -Selected Error Messages: - - Messages as self-explanatory - -Examples of Use: - - HELPCK myhelp - -- report on myhelp.HLP - -:3 - -Command: HELPPR 1.0 - -Syntax: - - HELPPR afn1,afn2,... o... - -Function: - - HELPPÒ  ió useä tï prinô ouô á HELР file®  Iô  breakó -pageó  oî  eacè informatioî sectioî anä ignoreó  forí  feedó -(useä  tï  separatå frames)¬  sï thå datá ió presenteä iî  á -sequentiaì  fashion®  Thió  tooì  ió  usefuì  iî  providinç -printouts of HELP files in a reasonable format. - - -Options: - - H@head@ Heading Text which appears at the top of - each page - I Inspect Files (select) before printing - L Number each line - Occ Offset each line by cc spaces - Snn Skip to page nn before beginning print - T (If TIMELIB installed) turn off time display - -Comments: - - HELPÒ  ió preferreä oveò PRINÔ foò printinç HELР fileó -becauså  oæ HELPPR'ó knowledgå oæ thå internaì structurå  oæ -HELP files and its special way of formatting their printout. - - -Selected Error Messages: - - Error Messages are Self-explanatory - -Examples of Use: - - HELPPR myfile1,myfile2 o5 - -- prinô  myfile1.HLÐ anä myfile2.HLÐ offseô bù  µ -spaces on each line - - HELPPR myfile s5 - -- print myfile.HLP starting at the 5th page - -:W - - Welcome to the HELP Command - - Welcomå  tï  thå HELÐ Command¡  Thå HELÐ Commanä  ió -designeä tï assisô you¬  thå ZCPR³ user¬  iî thå uså oæ -ZCPR³   iî  generaì  anä  specifiã  ZCPR³  commandó   iî -particular®  Iô ió designeä aó aî  interactive¬  on- -linå assistancå system. - - HELР pulló iî fileó nameä .HLÐ froí disë anä -displayó  theså tï thå useò iî á pageä mode®  Theså  fileó -arå oæ twï basiã typeó -- indexeä anä non-indexed. - - - Indexeä fileó arå thoså HELÐ fileó whicè starô witè  aî -index®  Thió  ió aî examplå oæ aî indexeä  file®  Wheî -HELР loadó aî indexeä file¬  iô displayó thió indeø tï -thå  useò  anä allowó hií tï selecô entrieó  froí  it®  Thå -useò  maù selecô aó manù entrieó aó hå desireó iî anù  ordeò -hå  desireó bù simplù typinç thå letteò oæ hió  selection® -Oncå thå useò haó madå hió selection¬  HELÐ wilì looë uð thå -bodù  oæ texô hå selecteä anä displaù iô tï hií iî á  pageä -mode®  Wheî thå useò haó finisheä readinç hió selection¬ -HELР theî  returnó  hií tï  thå  indeø  menu®  Typinç  á -Control-à wilì returî thå useò tï ZCPR3. - - Therå  arå  twï  typeó oæ indexeä  HELР fileó  - user- -indexeä anä HELP-indexed®  Á user-indexeä HELÐ filå ió  onå -iî  whicè  thå writeò oæ thå HELÐ filå ió alloweä tï  creatå -thå imagå oæ thå indeø oî hió screeî iî thå forí whicè  wilì -bå displayeä tï thå useò oæ thå HELÐ file®  Thió ió á user- -indexeä  HELÐ file® - - - Á  HELP-indexeä HELÐ filå ió onå whicè containó á  lisô -oæ thå optionó aô thå beginninç oæ it¬  anä HELÐ createó thå -menu¬  assigninç sequentiaì letteró (A¬  B¬ etc© tï thå menõ -options. - - Non-indexeä  fileó arå thoså HELÐ fileó whicè dï noô -starô  witè  aî  index®   Iî  sucè  cases¬   HELР wilì -immediatelù  displaù thå contentó oæ thå filå tï  thå  useò -and¬  wheî thå useò haó finisheä lookinç aô it¬  HELÐ wilì -returî tï ZCPR3. - - - HELÐ ió menu-driven¬  anä alì thå commandó availablå tï -thå useò aô anù giveî timå arå displayeä tï him® - - Thå  versioî  oæ  HELÐ describeä iî thió  HLР filå  ió -designeä tï worë witè thå ZCPR³ systeí anä takå advantagå oæ -somå oæ itó speciaì features. - - - Richard Conn -:U - - How to Use the HELP Command - - The HELP Command is executed in one of three ways: - - (1) by just typing 'HELP' - (2) by typing 'HELP FILENAME', where FILENAME - is the name of a disk file named FILENAME.HLP - (3) by typing 'HELP FILENAME.TYP', where - FILENAME.TYP is the name of a file created in - the format of a help file - - Iæ thå useò typeó jusô 'HELP'¬ hå wilì revie÷ thå filå -HELP.HLP¬ whicè shoulä contaiî á brieæ summarù oæ ho÷ tï uså -thå HELÐ command®  Foò alì otheò formó oæ thå HELÐ command¬ -thå  useò  wilì  seå thå specifieä  helð  filå  information® -Generallù  speaking¬  thå namå oæ thå helð filå  shoulä  bå -indicativå  oæ itó subject¬  likå CPM.HLÐ shoulä  contaiî -helð informatioî oî ZCPR3. - - - The HELP File Search Hierarchy - - Wheneveò  HELÐ lookó foò á specifieä HELÐ Filå (eitheò -froí  thå HELÐ Commanä oò froí aî  Informatioî  Sectioî -whicè specifieó á Nodå [seå later])¬  HELÐ wilì perforí -á  searcè  foò  thå indicateä file®  Thió searcè  goeó  aó -follows: - - 1®  Undeò  ZCPR3¬  HELÐ wilì follo÷ thå  command- -searcè  path®   Aó  such¬  HELР wilì  searcè  thå  currenô -directorù (disë anä user© first. - - 2® Iæ thå HLÐ filå ió noô founä undeò thå currenô -directory¬ HELÐ wilì searcè alonç thå ZCPR³ patè foò it. - - -(Continued Next Frame) - -HELP File Search Hierarchy, Continued - - 3®  Iæ  thå HLÐ filå ió noô founä alonç thå ZCPR³ -path¬  theî HELÐ wilì looë iî thå directorù nameä "HELP¢ foò -thå indicateä file® Thió ió á majoò differencå betweeî HELÐ -anä otheò ZCPR³ utilities. - - 4®  Iæ thå HLÐ filå ió noô found¬ HELÐ wilì prinô -aî erroò message. - - -:M - - Moving Around within the HELP Command - - Oncå  thå  useò ió runninç HELP¬  hå ió giveî á seô  oæ -commandó  bù  whicè hå caî displaù thå particulaò  itemó  oæ -informatioî hå ió interesteä in. - - Afteò issuinç thå HELÐ command¬ thå useò wilì comå uð -iî  onå  oæ  twï modeó (dependinç oî thå typå oæ  HELР filå -referenced)®  Iî  Indexeä  Mode¬  á  Menõ  oæ  topicó  ió -displayeä tï thå useò anä hå caî selecô thå desireä topiã -bù  typinç thå characteò iî fronô oæ thå topiã  title»  iî -Non-Indexeä Mode¬  nï menõ ió displayeä anä thå entirå -filå ió vieweä aó onå Informatioî Section. - - - Aî  Informatioî  Sectioî  ió  á  collectioî  oæ  screeî -displayó  (onå  screeî  fulì  oæ  text©  calleä  Frames® -Typically¬ aî Informatioî Sectioî shoulä contaiî á logicaì -groupinç oæ relateä datá oî á particulaò topic® Iî Indexeä -Mode¬  eacè Menõ topiã referó tï aî Informatioî Section®  Bù -selectinç á topic¬  thå useò ió placeä intï aî  Informatioî -Section®  Iî Non-Indexeä Mode¬  thå entirå HELÐ filå ió onå -Informatioî Section. - - - Moving From the Menu - - Aô  thå Menõ oæ á HELÐ file¬  thå useò haó twï  basiã -options®  Theså  optionó  arå tï selecô á Menõ  topiã  tï -revie÷ oò tï exiô tï ZCPR3® Iæ á Menõ topiã ió selected¬ -thå useò ió placeä intï thaô Informatioî Section. - - Á  thirä  optioî  aô  thå  Menõ oæ  á  HELР filå  ió -sometimeó  available®  Thió  optioî ió tï movå uð  tï  thå -previouó  HELР Level®  Somå Informatioî  Sectionó  arå -entirå HELÐ fileó iî theiò owî right¬ whicè caî bå accesseä -independentlù  oæ thå HELÐ filå thå useò ió  currentlù  in® -Iæ  thå useò enteró onå oæ theså Informatioî  Sections¬  thå -namå  oæ  thå currenô HELÐ filå ió saveä anä thå  ne÷  HELÐ -filå ió loaded®  Wheî thió happens¬ thå useò ió placeä aô -thå  nexô  HELР Leveì  (aî  ascendinç  number¬  wherå  thå -originaì  HELÐ filå ió aô HELÐ Leveì 0¬  á HELÐ filå calleä -froí thió leveì ió aô HELÐ Leveì 1¬  etc.)®  Wheî thå useò -ió aô á loweò HELÐ Leveì (useò ió NOÔ aô HELÐ Leveì 0)¬  hå -haó thå optioî tï movå tï thå nexô higheò HELÐ Level. - - Thå  concepô oæ movinç betweeî HELÐ Leveló  ió  deriveä -froí  thå  concepô  oæ á Treå datá structurå  froí  Computeò -Science®  Iî thió concept¬ thå useò startó aô thå rooô oæ -thå  treå anä theî climbó uð anä dowî thå treå tï  variouó -levels¬ oò nodes® Froí eacè node¬ thå useò maù onlù movå -uð oò dowî thå treå -- hå can'ô crosó oveò tï á nodå aô thå -samå leveì withouô firsô movinç dowî thå treå anä theî bacë -up® Tï illustrate¬ consideò thå following: - - - Node A Node B HELP Level - _________ ____________ 5 - \ Node C / - -------------- 4 - \ Node D Node E - ------------ ---------------- 3 - \ Node F / Node G - --------------------------- ----------- 2 - \ Node H / Node I - -------------------------- ------- 1 - \ Node J / -Root of Tree --> -------------------------- 0 - - - Iî thå abovå example¬  thå useò musô alwayó starô  aô -thå  rooô oæ thå treå (Nodå J)®  Thió ió analogouó tï  HELÐ -Leveì 0¬ whicè ió wherå thå useò ió placå wheî hå issueó thå -HELÐ Command® Tï geô tï Nodå C¬ foò example¬ thå useò haó -tï climâ thå treå froí Nodå Ê tï Nodå È tï Nodå Æ tï Nodå Ä -tï  Nodå C®  Thió woulä bå likå thå useò enterinç ´  Node- -Typå  Informatioî Sections¬  iî whicè differenô HELР fileó -arå successivelù loaded. - - No÷ thaô thå useò ió aô Nodå C¬ let'ó saù thaô hå wantó -tï gï tï Nodå E®  Undeò thå HELÐ System¬ therå arå twï wayó -tï dï this: - 1®  Jumð  ofæ oæ thå treå anä theî climâ bacë -uð tï Nodå E®  Here¬  thå useò woulä jumð froí Nodå à tï -Nodå  Ê anä theî gï tï Nodå È tï Nodå Æ tï Nodå  E®  Undeò -HELP¬  thå  useò  caî  dï thió bù exitinç tï ZCPR3  anä  theî -reissuinç  thå HELÐ Commanä oò bù issuinç thå  Rooô  Commanä -(.)»  oncå aô thå rooô oæ thå tree¬ hå theî climbó iô -agaiî bù enterinç thå appropriatå Informatioî Sections. - - 2®  Climâ dowî thå treå anä theî bacë up®  Thå -useò  woulä  movå froí Nodå à tï Nodå Ä tï Nodå Æ  anä  theî -bacë  uð  tï Nodå E®  Thå HELÐ useò caî gï tï thå  previouó -leveì bù issuinç thå Uð Leveì (^© command® Iî thió example¬ -hå woulä Uð Leveì twicå anä theî gï bacë down. - - - Moving Within An Information Section - - Oncå thå useò ió withiî á textuaì Informatioî  Section¬ -hå  haó severaì capabilitieó foò movinç withiî thió  sectioî -anä ouô oæ thió section. - - First¬ tï movå ouô oæ aî Informatioî Section¬ thå useò -caî  returî  tï  thå  menõ (iæ thå  currenô  HELР filå  ió -Indexed© oò returî tï ZCPR3® Additionally¬ iæ thå useò ió -noô  oî  thå  rooô (HELÐ Leveì 0)¬  hå  caî  returî  tï  thå -previouó  HELÐ Leveì (Uð Level)®  Iæ thå useò ió noô iî  aî -Indexeä  HELР file¬  movinç  forwarä  beyonä  thå  Enä  oæ -Informatioî  (EOI©  wilì returî hií tï ZCPR³ iæ hå  ió  aô -HELР Leveì  ° oò returî hií tï thå previouó HELР Leveì  iæ -not. - - - Tï  movå  withiî aî Informatioî Section¬  thå  datá  ió -arrangeä  sequentially®  Consequently¬  thå useò caî  movå -Forwarä tï thå nexô Frame¬  Backwarä tï thå previouó Frame¬ -oò tï thå beginninç oæ thå Informatioî Section®  Thå useò -cannoô movå backwarä beyonä thå beginninç oæ thå Informatioî -Section¬  anä á belì ió sounded®  Also¬ iæ thå useò trieó -tï movå forwarä beyonä thå Enä oæ Informatioî (EOI)¬  hå ió -eitheò returneä tï thå Menu¬  returneä tï ZCPR3¬ oò returneä -tï thå previouó HELÐ Leveì aó describeä above. - -:P - HELP Command Prompts - - Thå   followinç  arå  thå  basiã  promptó  foò  useò -commanä whicè HELÐ displayó tï thå user. - -^C=ZCPR3 ^=Level .=Root M=Menu S=Start L=Last P=Print - - \ \ \ \ \ \ \__Print Info/Frame - \ \ \ \ \ \__Goto Last (Previous) Frame - \ \ \ \ \__Goto Start of Info Section - \ \ \ \__Goto Menu of HELP File - \ \ \__Goto Root if NOT at Level 0 - \ \ (this is displayed only if NOT at Level 0) - \ \__Goto Previous Level - \ (this is displayed only if NOT at Level 0) - \__Return to ZCPR3 - - EOÉ ^C=ZCPR3 ^=Leveì .=Rooô M=Menõ S=Starô L=Lasô P=Prinô - - \ \________\_______\________\_______\_______\_______\__Same as - \ Above - \__User is at the End of Information (end of Information Section) - -Type ^C=ZCPR3 ^=Level .=Root or Enter Selection - - \ \ \ \__Enter letter of desired - \ \ \ Information Section - \ \ \__Goto Root - \ \ (this is displayed only if NOT at Level 0) - \ \__Goto Previous Level - \ (this is displayed only if NOT at Level 0) - \__Return to ZCPR3 - - Preceedinç eacè oæ thå abovå promptó ió aî indicatoò -oæ  thå HELÐ Leveì anä Framå Numbeò thå useò ió  currentlù -at® Thió indicatoò maù takå thå followinç forms: - - - \__The user is at the Menu of Level 0 - -fff: - \__Current Frame Number within Information Section - (the user is at Level 0) - -Level lll/ - \__Current Level Number (The user is at a Menu Frame) - (this is displayed only if the user is NOT at Level 0) - -Level lll/fff: - \ \__Current Frame Number within Information Section - \__Current Level Number - (this is displayed only if the user is NOT at Level 0) - - - Summary of User Commands - - Cmd Meaning - ^ Go to Previous Level - . Go to Root Level - M Go to Menu of Current HELP File - S Go to Start of Information Section - L Go to Previous Frame - CR (Carriage Return or Space) Go to Next Frame - ^C (Control-C) Return to ZCPR3 - P Print Current Screen Display (Frame) or Information Section - -:O - Printing HELP Files - - Printinç HELÐ Fileó caî bå donå iî twï basiã wayó -- bù -usinç  thå  HELPPÒ Utilitù oæ ZCPR³ oò bù  usinç  thå  Prinô -functioî containeä withiî thå HELÐ Utilitù itself. - - Thå  HELPPÒ  Utilitù  ió useä tï prinô aî  entirå  Helð -File®  Iô actó á loô likå thå PRINÔ command¬  anä iô haó  á -varietù  oæ  options¬  includinç  thå abilitù  tï  plaî  foò -printeò  outpuô anä tï supporô paginç anä otheò "appearance- -enhancing¢ features. - - Thå  Prinô  Functioî  withiî HELР ió  useä  foò  quicë -printouts® Iô doeó noô pagå oò perforí anythinç morå exotiã -thaî  simplù  printinç ouô whaô ió containeä iî á parô oæ  á -Helð File®  Wheî thå Ð optioî ió given¬  thå currenô screeî -ió printeä immedately® Thå useò maù alsï issuå á ^Ð commanä -(noô  displayeä  oî  anù menu)¬  iî whicè  caså  thå  entirå -informatioî sectioî hå ió currentlù iî ió printed. - - - Thió Prinô Functioî ió provideä aó á conveniencå tï thå -user® Iô allowó thå useò tï revie÷ thå Helð File¬ and¬ wheî -hå  seeó á particulaò screeî displaù oò informatioî  sectioî -whicè  hå  valueó enougè tï wanô tï havå arounä  foò  futurå -referencå iî hardcopù form¬ hå caî simplù telì HELÐ tï prinô -it®  Thió capabilitù ió intendeä tï supporô thå concepô  oæ -establishinç  HLÐ fileó aó á convenienô anä flexiblå waù  tï -pasó  documentatioî  oæ programó tï thå useò oî  disë  whilå -simultaneouslù  allowinç hií tï easilù prinô iô ouô iæ iô ió -oæ significanô interesô tï him. - - - Foò instance¬  á HLÐ filå whicè referó tï á ne÷ prograí -maù  contaiî  aî  Informatioî Sectioî  oò  onå  Framå  whicè -containó á commanä summary®  Thå useò caî simplù prinô thió -withouô havinç thå prinô thå entirå HLÐ file. - - Aó anotheò example¬ thå HELÐ subsysteí maù bå useä bù á -homemakeò tï keeð heò recipeó on®  Organizeä usinç thå treå -structurå   intï  reasonablå  catagorieó  (sucè  aó  roasts¬ -desserts¬ etc)¬ whilå reviewinç thå recipeó shå maù finä onå -shå wisheó tï trù foò thå evening'ó meaì oò tï pasó oî tï  á -friend® Iæ thå recipå coveró onlù onå screen¬ á Framå Prinô -ió verù convenient. - -:E - HELP Error Messages - - Thå  followinç  arå thå erroò messageó  issueä  bù -HELÐ anä theiò meanings: - -File not Found - The specified HELP File cannot be found. - -AFN Not Allowed - Thå  specifieä  HELÐ Filå ió  ambiguouó  (containó  thå -characteò "*¢ oò "?")® Thió ió noô allowed. - - - The user issued an invalid command. - -EOF on HELP File - Iî searchinç foò aî Informatioî Section¬  HELÐ raî intï -thå  enä  oæ  thå HELÐ File®  Thå Indexeä HELР Filå  ió -improperlù structureä (morå indeø entrieó thaî  Informatioî -Sections). - -Node Level Limit - Thå  limiô  oæ  thå  nestinç  oæ  thå  HELР Leveló  ió -exceeded® HELÐ limitó thå numbeò oæ HELÐ Leveló thaô caî bå -traverseä  tï 1° (default¬  whicè caî bå changed)¬  anä aî -attempô waó madå tï enteò HELÐ Leveì 1± (oò defaulô « 1). - -Mem Full - Thå  selecteä HELÐ Filå ió toï largå tï loaä  intï  thå -availablå memorù iî thå user'ó computeò system®  Thå HELÐ -Filå  shoulä  bå reduceä iî size»  usinç HELР Leveló  (Nodå -references© iî thå Informatioî Sectionó ió á gooä waù tï dï -this. - -:H - How to Write HELP Files - - Fileó useä bù thå HELÐ prograí arå eitheò simplå CP/M- -standarä   fileó  oæ  ASCIÉ  texô  oò  ASCIÉ   fileó -generateä  bù  thå Worä Staò  texô  editor/formatter® -Theså  files¬  aó mentioneä above¬  arå oæ twï basiã  typesº -indexeä  anä non-indexed¬  anä eacè typå ió relateä tï thå -otheò anä ió oæ thå samå basiã format. - - Grouping of Information - - Informatioî  displayeä  tï thå useò ió groupeä  bù  thå -indeø  iî  indexeä HELÐ fileó anä maù alsï bå  groupeä  bù -lineó beginninç witè Forí Feeä (^L©  characters®  Groupinç -ió  aî effectivå waù tï logicallù organizå informatioî  sï -thaô  meaninç  wilì bå morå cleaò tï thå useò anä  unitó  oæ -informatioî wilì noô pasó betweeî screeî displays. - - - Thå informatioî displayeä tï thå useò ió organizeä intï -logicaì   unitó  calleä  Informatioî  Sectionó  anä   screeî -displayó  (onå screeî fulì oæ text© calleä  Frames®  Usinç -texô  editors¬  thå  useò caî creatå hió owî HELÐ fileó  anä -organizå  hió informatioî aó hå desireó foò displaù  tï  thå -HELÐ user. - - - Non-Indexed HELP Files - - Non-indexeä  HELР fileó arå simplå ASCIÉ  fileó  whicè -starô  witè  á coloî (:© aó thå firsô characteò oæ thå  filå -anä  consisô oæ ASCIÉ texô (witè eacè linå terminateä  bù  á -carriagå  returî anä linå feeä characteò combination)®  Thå -informatioî  iî  sucè á helð filå consistó  oæ  alì  texô -afteò thå leadinç coloî uð tï eitheò thå terminatinç end- -of-filå marë (control-Z© oò á ne÷ linå whicè startó witè á -colon. - - - Indexed HELP Files - - Indexeä  HELР fileó arå simplå ASCIÉ fileó whicè  dï -noô starô witè á coloî (:© aó thå firsô characteò oæ  thå -file®  Aî  indexeä  HELÐ filå maù bå HELP-indexeä oò  user- -indexed. - - Thå  HELP-indexeä  HELÐ filå consistó oæ onå oò  morå -normaì  ASCIÉ  texô lineó aó thå firsô lineó  oæ  thå  filå -followeä  bù  informatioî sectionó whicè begiî witè  á  linå -whoså  firsô  characteò ió á coloî anä enä witè  eitheò -thå  firsô linå oæ thå nexô informatioî sectioî  oò  thå -enä  oæ  thå file®  Theså openinç lineó (beforå  thå  firsô -informatioî section© forí thå indeø entries¬  anä HELР wilì -labeì theså lineó witè A¬  B¬ etc¬ durinç thå displaù oæ thå -index. - - - Thå  user-indexeä HELÐ filå containó á semicoloî (;© aó -thå  firsô characteò iî thå file®  Thå texô whicè  follows¬ -startinç  oî thå nexô line¬  ió displayeä literallù  tï  thå -useò aó thå menu®  Eacè informatioî sectioî ió denoteä bù á -linå  startinç witè á coloî (:)»  thå coloî ió followeä bù á -serieó  oæ  characteró (spaceó arå noô  significanô  betweeî -them© whicè arå thå indeø letters®  Wheî thå useò runó HELÐ -oî  thió filå anä typeó á selectioî  letter¬  HELР searcheó -througè  thå file¬  lookinç foò aî informatioî sectioî whoså -linå  containó  thå characteò typeä bù  thå  user®  Iæ  thå -characteò  waó á letter¬  iô ió automaticallù capitalizeä bù -HELР (iî  botè thå useò inpuô anä thå  informatioî  sectioî -lines). - - Á  coloî (:© ió noô á valiä optioî letter¬  sincå  thió -characteò haó á speciaì meaninç tï HELÐ (seå later)®  Iæ  á -coloî ió encountereä iî aî informatioî sectioî headinç line¬ -the scan for option characters stops for that line. - - - Tree Structures within Indexed HELP Files - - Thå  Indexeä  HELР Filå ió  divideä  intï  Informatioî -Sections¬  wherå  eacè  Informatioî Sectioî startó  witè  á -coloî  (:)®  Therå  arå  twï basiã  typeó  oæ  Informatioî -Section: - - 1®   Informatioî   Sectionó  containinç  textuaì -material»  thió typå oæ Informatioî Sectioî simplù  containó -readinç  materiaì  whicè ió organizeä intï Frames¬  wherå  á -Framå ió equaì tï onå screeî display. - - 2®  Informatioî  Sectionó whicè referencå  otheò -HELÐ files. - - - Iî  HELP-indexeä HELÐ files¬  thió typå oæ  Informatioî -Sectioî  beginó  witè twï colonó (::© insteaä oæ onå aó  iî -(1© above»  thå twï colonó arå immediatelù followeä bù  thå -namå  oæ thå HELÐ filå (thå HELÐ filå typå maù bå optionallù -specified). - - Iî  user-indexeä HELÐ files¬  thió typå oæ  Informatioî -Sectioî  containó thå indeø characteró followeä á coloî  (:© -anä thå namå oæ thå HELÐ filå (thå filå typå ió optional). - - Tï illustrate¬  thå followinç outlineó thå structurå oæ thå -twï typeó oæ Informatioî Sections: - - - HELP-Indexed HELP File Example - - :Title for Type 1 Information Section - - : [next Information Section] - - Figure: A Text (Type 1) Information Section - - - ::HLPFILE <-- for HLPFILE.HLP - : [next Information Section] - - ::HLPFILE.TYP <-- for HLPFILE.TYP - : [next Information Section] - - Figure: Examples of Node (Type 2) Information Sections - - - - User-Indexed HELP File Example - - ; - - [ Menu ] - - :x - [ Information Displayed for Selection X ] - :a - [ Information Displayed for Selection A ] - :1 b - [ Information Displayed for Selections 1 or B ] - :f :HELPFILE [ HELPFILE.HLP is invoked by Selection F ] - : z - [ Information Displayed for Selection Z ] - -:V - - Accessing Video Attributes - - Thå  displayó  generateä bù HELР arå  screen-oriented® -Undeò  ZCPR³  witè  á properly-installeä TCAÐ entrù  iî  thå -Environmenô   Descriptor¬   HELР  ió  ablå   tï   highlighô -informatioî  oî thå screeî anä creatå "flashy¢  displayó  bù -using the clear screen feature of the user's terminal. - - Uså  oæ  thå cleaò screeî featurå ió  automatic®  Eacè -frame is preceeded by a clear screen. - - Thå  writeò  oæ  á  HELР filå  caî  turî  oî  anä  ofæ -highlightinç  oæ texô anywherå iî thå HELÐ filå bù  embeddeä -the following commands into the text: - - ^A (binary 1) - turn on highlighting - ^B (binary 2) - turn off highlighting - - - Iô  ió  recommendeä thaô iæ highlightinç ió  turneä  oî -then it should be turned off in the same line. Example: - - ^Athis is highlighted^B while this is not - -generates: - - this is highlighted while this is not - - - Thió  HELÐ filå ió aî examplå oæ onå whicè  extensivelù -uses highlighting. This is also a user-indexed HELP file. - - -:T - The Tree Structure of HELP - - -- Basic HELP File -- - |Info Sect 1 |Info Sect 2 |Info Sect 3 |Info Sect 4 | - | Text | HELP File | Text | HELP File | - / \ / \ - -- SubHelp File 1 -- -- SubHelp File 2 -- - |Info Sect 1 |Info Sect 2 | |Info Sect 1 |Info Sect2| - | Text | HELP File | | Text | Text | - / \ - -- SubSubHelp File 1 -- - |Info Sect 1 |Info Sect 2 |Info Sect 3 | - | Text | HELP File | HELP File | - / \ / \ - -- Sub3Help File 1 -- -- Sub3Help File 2 -- - |Info Sect | |Info Sect 1 |Info Sect 2| - | Text | | Text | HELP File | - / \ - -- Sub4Help File -- - |Info Sect 1 |Info Sect 2| - | Text | Text | - - Thå  abovå  diagraí  ió meanô tï illustratå  ho÷  treå -structureó caî bå implementeä undeò HELP®  Á ne÷ nodå  oæ -thå  treå  ió createä wheneveò á HELÐ filå ió referenceä  bù -aî Informatioî Sectioî (aó opposeä tï simplù havinç texô iî -thå Informatioî Section)® Eacè nodå becomeó thå baså oæ -á ne÷ tree¬  whicè itselæ maù contaiî referenceó tï  otheò -HELÐ files. - - Froí thå previouó diagram¬  SubHelð Leveì ³ containó -twï  HELР files®  Theså caî bå entereä froí  Informatioî -Sectioî ² anä Informatioî Sectioî ³ oæ SubHelð Leveì 2® Bù -simplù enterinç onå oæ theså twï Informatioî Sections¬ thå -appropriatå  HELÐ filå ió loadeä anä thå useò ió placeä  aô -thå nexô level® Froí theså HELÐ files¬ thå useò maù movå -withiî  thå  HELÐ filå itselæ oò movå uð  tï  thå  previouó -leveì (naturally¬  thå useò alwayó haó thå optioî tï exiô tï -ZCPR3). - -:S - - Sample HELP Files Illustrating Use of Tree Structure - - Thå  followinç Frameó sho÷ thå sourcå tï threå HELÐ -Files¬  nameä DEMO.HLP¬ DEMO2.HLP¬ anä DEMO3.HLP® DEMO.HLÐ -ió provideó thå Rooô Nodå tï á treå whicè includeó DEMO2.HLÐ -anä DEMO3.HLÐ aó subnodes®  Additionally¬  DEMO3.HLÐ haó á -subnodå whicè referenceó DEMO.HLP¬  sï wå havå á  recursivå -treå structure. - - - DEMO.HLP - TEST 1 - OK <-- Menu - TEST 2 - SIMPLE NEST - TEST 3 - INVOLVED NEST - TEST 4 - OK - :TEST 1 <-- First Info Section (Text) - THIS - IS - TEST - 1 - ::DEMO2 <-- 2nd Info Section (Node) - ::DEMO3 <-- 3rd Info Section (Node) - :TEST 4 <-- 4th Info Section (Text) - TO BE, OR NOT TO BE, THAT IS THE QUESTION! - ... - TO TAKE ARMS AGAINST A SEA OF TROUBLES AND BY OPPOSING END THEM. - TO DIE, TO SLEEP ... TO SLEEP, PERCHANCE TO DREAM. - AYE, THERE'S THE RUB! FOR IN THAT SLEEP, WHAT DREAMS MAY COME! - - DEMO2.HLP - :TEST 2 <-- No Menu -- 1 Info Section - THIS - IS - TEST - 2 - - DEMO3.HLP - TEST 3A <-- Menu - TEST 3B - TEST 3C - :TEST 3A <-- First Info Section (Text) - THIS - IS - TEST - 3A - the rain in Spain falls mainly in the plain - - :TEST 3B <-- 2nd Info Section (Text) - THIS - IS - TEST - 3B - ::demo <-- 3rd Info Section (Node) - - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/IF.COM b/Source/Images/d_bp/u15/IF.COM deleted file mode 100644 index d6fb8eaa..00000000 Binary files a/Source/Images/d_bp/u15/IF.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/IF.HLP b/Source/Images/d_bp/u15/IF.HLP deleted file mode 100644 index 46bddf6e..00000000 --- a/Source/Images/d_bp/u15/IF.HLP +++ /dev/null @@ -1,458 +0,0 @@ -; - - - -- Flow Commands -- - - - -- IF Commands -- -- IF Condition Summaries -- - 1 Transient IF T Transient IF - 2 Resident IF R Resident IF - - - -- Others -- - 3 IF Status Display - 4 ELSE - 5 FI - 6 XIF - -:1 - -Command: IF 1.1 - -Syntax: - - IF cond args -or - IF ~cond args - -Function: - - IÆ  testó thå indicateä conditioî tï seå iæ iô ió TRUE¬ -and¬  iæ  so¬  setó  thå Flo÷ Statå tï  TRUÅ  (allowinç  thå -followinç commandó tï execute)®  Iæ thå conditioî ió FALSE¬ -thå  Flo÷ Statå ió seô tï FALSÅ (allowinç onlù Flo÷ Commandó -to execute). - - -Options: - - Option Meaning - T TRUE (Flow State is Set to TRUE) - F FALSE (Flow State is Set to FALSE) - - EMPTY afn,... If all files in the indicated list - are EMPTY (size is 0K), then Flow - State is Set to TRUE - - ERROR If the ZCPR3 Error Flag is Set, then - Flow State is Set to TRUE - - EXIST afn,... If all files in the indicated list - exist, then Flow State is Set to TRUE - - INPUT User input is enabled, and if the user - strikes T, Y, , or , the - Flow State is Set to TRUE - - NULL afn If there is no 'afn' (field is blank), - then the Flow State is Set to TRUE - - TCAP If a Z3TCAP is installed, the Flow State - is Set to TRUE - - WHEEL If the Wheel Byte is Set, the Flow State - is Set to TRUE - - reg value If the indicated register (0-9) has the - indicateä valuå (0-255)¬ thå Flow - State is Set to TRUE - - afn1=afn2 If the two AFNs are identical in name - (11 char FILENAME.TYP are same), the - Flow State is Set to TRUE - -Comments: - - Iî alì cases¬  iæ thå indicateä conditioî ió TRUE¬  thå -Flo÷  Statå ió Seô tï TRUE»  iæ thå indicateä  conditioî  ió -FALSE, the Flow State is Set to FALSE. - - Thió  commanä  ió invokeä iæ thå currenô  Flo÷  Commanä -Packagå  haó  thå IF.COÍ facilitù enabled®  Iæ thió ió  thå -case¬  wheneveò aî IÆ commanä ió issued¬  thå FCÐ wilì  loaä -IF.COÍ  froí thå ROOÔ directorù intï memorù anä executå  it® -Thå  commanä taiì ió passeä tï IF.COM¬  anä IF.COÍ actó aó á -conventionaì COÍ filå froí thaô poinô forward®  Alì bufferó -arå  loadeä correctlù (FCBó aô 5CÈ anä 6CH¬  TBUFÆ  aô  80H¬ -etc). - - - Á  leadinç  tildá  (~©  characteò  beforå  á  conditioî -negateó  thå effecô oæ thå condition®  Iæ thå conditioî  ió -FALSE¬  thå  Flo÷  Statå  ió Seô tï  TRUE¬  anä  vice-versa® -Example: - - "IF ~T" is the same as "IF F" - "IF ~NULL arg" is TRUE if 'arg' is non-blank - "IF ~EXIST afn,..." is TRUE if 'afn,...' do NOT - exist (AFN and AFN ... must each not exist) - - Foò eacè conditioî given¬ onlù thå firsô twï characteró -are significant (eg, NU for NULL). - -Selected Error Messages: - - "Nï  IÆ  Conditioî  Given¢  meanó  thaô  thå  conditioî -expressed was not one of the valid conditions. - - -Examples of Use: - - IF NULL $1 - - if the indicated parameter (from within a SUBMIT - or ZEX command file) is not provided, set the - Flow State to TRUE - - IF ~EXIST ZEX.ASM,ZEX.ZEX - - if any one of these files does not exist, the - Flow State is set to TRUE - - IF EXIST ZEX.ASM,ZEX.ZEX - - if any one of these files does not exist, the - Flow State is set to FALSE (ie, all files - must exist for a TRUE Flow State) - - - IF NEC=$1 - - if the first passed parameter is the same as - the file name "NEC.", then the Flow State - is Set to TRUE - - IF 5 5 - - if Register 5 = 5, the Flow State is Set to TRUE - -:2 - -Command: IF (as implemented in SYSFCP 1.0) - -Syntax: - - IF cond arg -or - IF ~cond arg - -Function: - - IÆ  testó thå indicateä conditioî tï seå iæ iô ió TRUE¬ -and¬  iæ  so¬  setó  thå Flo÷ Statå tï  TRUÅ  (allowinç  thå -followinç commandó tï execute)®  Iæ thå conditioî ió FALSE¬ -thå  Flo÷ Statå ió seô tï FALSÅ (allowinç onlù Flo÷ Commandó -to execute). - - Thå IÆ commanä describeä herå ió residenô withiî SYSFCÐ -1.0 when the COMIF equate is set to FALSE. - - -Options: - - Option Meaning - T The Flow State is Set to TRUE - F The Flow State is Set to FALSE - - EMPTY afn If the indicated file is empty (size is - 0K), the Flow State is Set to TRUE - - ERROR If the ZCPR3 System Error Flag is SET, - the Flow State is Set to TRUE - - EXIST afn If the indicated file exists, the Flow - State is Set to TRUE - - INPUT The user is prompted for input, and if - he responds with T, Y, , or , - the Flow State is Set to TRUE - - - NULL afn If the 2nd FCB (afn) is blank, the Flow - State is Set to TRUE - - TCAP If the ZCPR3 TCAP entry is available, - the Flow State is Set to TRUE - - WHEEL If the Wheel Byte is TRUE, the Flow - State is Set to TRUE - - reg val If the indicated register (0-9) contains - the indicated value (0-255), the - Flow State is Set to TRUE - - afn1=afn2 If the two AFNs are the same, the Flow - State is Set to TRUE - - -Comments: - - Iî alì cases¬  iæ thå indicateä conditioî ió TRUE¬  thå -Flo÷  Statå ió Seô tï TRUE»  iæ thå indicateä  conditioî  ió -FALSE, the Flow State is Set to FALSE. - - Thió  commanä  ió invokeä iæ thå currenô  Flo÷  Commanä -Packagå  haó thå IF.COÍ facilitù disabled®  Iæ thió ió  thå -case¬ wheneveò aî IÆ commanä ió issued¬ thå FCÐ wilì resolvå -iô internally. - - Eacè  oæ thå optionó oæ thå Residenô IÆ maù oò maù  noô -bå enabled®  Theså optionó arå installation-dependent¬  anä -thå SHO× commanä wilì displaù thå availablå optionó foò  anù -installation. - - - Á  leadinç  tildá  (~©  characteò  beforå  á  conditioî -negateó  thå effecô oæ thå condition®  Iæ thå conditioî  ió -FALSE¬  thå  Flo÷  Statå  ió Seô tï  TRUE¬  anä  vice-versa® -Example: - - "IF ~T" is the same as "IF F" - "IF ~NULL arg" is TRUE if 'arg' is non-blank - "IF ~EXIST afn" is TRUE if 'afn' does NOT - exist - - Foò eacè conditioî given¬ onlù thå firsô twï characteró -are significant (eg, NU for NULL). - -Selected Error Messages: - - None - - -Examples of Use: - - IF NULL $1 - - if the indicated parameter (from within a SUBMIT - or ZEX command file) is not provided, set the - Flow State to TRUE - - IF ~EXIST ZEX.ASM - - if any ZEX.ASM does not exist, the - Flow State is set to TRUE - - IF NEC=$1 - - if the first passed parameter is the same as - the file name "NEC.", then the Flow State - is Set to TRUE - - IF 5 5 - - if Register 5 = 5, the Flow State is Set to TRUE - -:3 - -Command: IFSTAT 1.0 - -Syntax: - - IFSTAT - -Function: - - IFSTAÔ ió useä tï displaù thå currenô IÆ level® IFSTAÔ -wilì  reporô  witè á Leveì Numbeò froí ± tï ¸  (IFó  maù  bå -nesteä uð tï ¸ leveló deep© oò iô wilì replù witè "Nï Activå -IF". - -Options: - - None - - -Comments: - - Thå Flo÷ Statå MUSÔ bå TRUÅ foò IFSTAÔ tï run¬ sincå iô -is a COM file like any other. - -Selected Error Messages: - - None - -Examples of Use: - - IFSTAT - -- the current IF level is displayed - -:T - Summary of Transient IF Conditions - - Option Meaning - T TRUE (Flow State is Set to TRUE) - F FALSE (Flow State is Set to FALSE) - - EMPTY afn,... If all files in the indicated list - are EMPTY (size is 0K), then Flow - State is Set to TRUE - - ERROR If the ZCPR3 Error Flag is Set, then - Flow State is Set to TRUE - - EXIST afn,... If all files in the indicated list - exist, then Flow State is Set to TRUE - - INPUT User input is enabled, and if the user - strikes T, Y, , or , the - Flow State is Set to TRUE - - NULL afn If there is no 'afn' (field is blank), - then the Flow State is Set to TRUE - - TCAP If a Z3TCAP is installed, the Flow State - is Set to TRUE - - WHEEL If the Wheel Byte is Set, the Flow State - is Set to TRUE - - reg value If the indicated register (0-9) has the - indicateä valuå (0-255)¬ thå Flow - State is Set to TRUE - - afn1=afn2 If the two AFNs are identical in name - (11 char FILENAME.TYP are same), the - Flow State is Set to TRUE - -:R - Summary of Resident IF Conditions - - Option Meaning - T The Flow State is Set to TRUE - F The Flow State is Set to FALSE - - EMPTY afn If the indicated file is empty (size is - 0K), the Flow State is Set to TRUE - - ERROR If the ZCPR3 System Error Flag is SET, - the Flow State is Set to TRUE - - EXIST afn If the indicated file exists, the Flow - State is Set to TRUE - - INPUT The user is prompted for input, and if - he responds with T, Y, , or , - the Flow State is Set to TRUE - - - NULL afn If the 2nd FCB (afn) is blank, the Flow - State is Set to TRUE - - TCAP If the ZCPR3 TCAP entry is available, - the Flow State is Set to TRUE - - WHEEL If the Wheel Byte is TRUE, the Flow - State is Set to TRUE - - reg val If the indicated register (0-9) contains - the indicated value (0-255), the - Flow State is Set to TRUE - - afn1=afn2 If the two AFNs are the same, the Flow - State is Set to TRUE - -:4 - -Command: ELSE (from SYSFCP 1.0) - -Syntax: - - ELSE anytext - -Function: - - Iæ  thå currenô Flo÷ Statå ió TRUE¬  ELSÅ toggleó iô tï -FALSE. - - Iæ thå currenô Flo÷ Statå ió FALSÅ anä thå previouó  IÆ -Leveì  ió  iî á TRUÅ State¬  ELSÅ toggleó thå Flo÷ Statå  tï -TRUE®  Iæ thå previouó IÆ Leveì ió iî á FALSÅ  State¬  ELSÅ -does nothing. - -Options: - - None (any text may follow the verb ELSE) - -Comments: - - None - -Selected Error Messages: - - No error messages are generated - -Examples of Use: - - IF NEC=$1 - < statements > - ELSE - < statements > - FI - -:5 - -Command: FI (from SYSFCP 1.0) - -Syntax: - - FI anytext - -Function: - - FÉ  terminateó  thå currenô IÆ Level®  Iæ therå ió  nï -current IF level, FI does nothing. - -Options: - None (any text may follow the verb FI) - -Comments: - None - -Selected Error Messages: - None - -Examples of Use: - - IF EXIST MYFILE.ASM - < statements > - ELSE - < statements > - FI - -:6 - -Command: XIF (from SYSFCP 1.0) - -Syntax: - - XIF anytext - -Function: - - Iæ  thå  currenô  Flo÷ Statå ió  TRUE¬  XIÆ  exitó  alì -pendinç  IFs®  Iô  reduceó  thå IÆ Leveì tï  °  (nï  IÆ  iî -effect). - - If the current Flow State is FALSE, XIF does nothing. - -Options: - None - - -Comments: - None - -Selected Error Messages: - None - -Examples of Use: - - ;=LOOP - XIF - - IF 1 3 - GOTO LOOP - FI - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/IF.MAC b/Source/Images/d_bp/u15/IF.MAC deleted file mode 100644 index 65259389..00000000 --- a/Source/Images/d_bp/u15/IF.MAC +++ /dev/null @@ -1,542 +0,0 @@ -; -; Program: IF -; Author: Richard Conn -; Modified By: Charles McManis -; Version: 1.2 -; Date: 11 Feb 85 -; Previous Versions: 1.1 (22 Apr 84) -; -version equ 12 - -; -; IF is intended to be invoked from the IF routine in an FCP. -; This program implements the IF conditional tests and sets the next level -; of IF to be TRUE or FALSE. -; -; Modified on 02/11/85 to accept ambiguous file names and match them. This -; allows aliases to add file extensions if they are needed, for instance -; if there is an alias LDIR that gets a directory of an .LBR file, it -; previously had to be defined as an example : -; -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -noise equ 0 ;set to 1 for noisey (message) operation -negchar equ '~' ;negation prefix char -bdos equ 5 -fcb1 equ 5ch -fcb2 equ 6ch -tbuff equ 80h -cr equ 0dh -lf equ 0ah -bel equ 07h - -; -; External Z3LIB and SYSLIB Routines -; - ext z3init,strtzex,stopzex,geter1,getreg,ift,iff,getenv - ext eval10,print,capine,codend,sksp,sknsp,zfname,cout - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Environment - jmp ifstart -; -; Condition Table -; -condtab: - db 'T ' ;TRUE - dw ifctrue - db 'F ' ;FALSE - dw ifcfalse - db 'EM' ;file empty - dw ifcempty - db 'ER' ;error message - dw ifcerror - db 'EX' ;file exists - dw ifcex - db 'IN' ;user input - dw ifcinput - db 'NU' ;null argument - dw ifcnull - db 'TC' ;Z3TCAP Entry Loaded - dw ifctcap - db 'WH' ;Wheel Byte - dw ifcwheel - db 0 - -; -; FCP Extension Command: IF -; -ifstart: -; -; Advance to Next Line if Noisey -; - IF NOISE - mvi a,lf - call cout - ENDIF ;NOISE -; -; Test for Equal Sign in Line and Process FCB1=FCB2 form if so -; - lxi h,tbuff+1 ;pt to buffer -ifteq: - mov a,m ;look for = - inx h ;pt to next - ora a ;done if EOL - jz ifck0 - cpi '=' ;equal? - jnz ifteq - lxi h,fcb1+1 ;= found, so compare FCB1 and FCB2 - lxi d,fcb2+1 - mvi b,11 ;11 chars -ifteq1: - ldax d ;compare -; ** Such a small change really. - cpi '?' ; see if an AFN was specified - jz okchar ; always match a ? - mov c,a ; save it in C temporarily - mov a,m ; get the other character - cpi '?' ; see if it is a ? - jz okchar ; if so accept it as a match - cmp c -; ** This allows IF $1=* and IF $1=*.?q? etc -; cmp m ; this guy is no longer needed. - jnz ifcf ;FALSE if no match -okchar: - inx h ;advance - inx d - dcr b ;count down - jnz ifteq1 - jmp ifct ;TRUE if match -; -; Test Condition in FCB1 and file name in FCB2 -; Execute condition processing routine -; -ifck0: - lxi d,fcb1+1 ;pt to first char in FCB1 - ldax d ;get it - cpi '/' ;help? - jz ifhelp - cpi ' ' ;also help - jz ifhelp - sta negflag ;set negate flag - cpi negchar ;is it a negate? - jnz ifck1 - inx d ;pt to char after negchar -ifck1: - call regtest ;test for register value - jnz runreg - call condtest ;test of condition match - jnz runcond ;process condition - IF NOISE - call print - db ' No IF Condition Given',0 - ret - ELSE ;NOT NOISE - mvi a,bel - jmp cout - ENDIF ;NOISE -; -; Print Help Message -; -ifhelp: - IF NOT NOISE - mvi a,lf ;leading new line - call cout - ENDIF ;NOT NOISE - call print - db 'IF, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db ' - Conditional Test' - db cr,lf,'Syntax:' - db cr,lf,' IF condition arguments -or- IF ~condition arguments' - db cr,lf,'where a leading "~" negates the effect of the ' - db 'IF Condition' - db cr,lf,'Possible IF Conditions are:' - db cr,lf,' T Always TRUE' - db cr,lf,' F Always FALSE' - db cr,lf,' EMPTY T if Files are Empty' - db cr,lf,' ERROR T if Error Flag Set' - db cr,lf,' EXIST T if Files Exist' - db cr,lf,' INPUT T if User Hits T, Y, CR, or SP' - db cr,lf,' NULL arg T if No Arg Follows' - db cr,lf,' TCAP T if ZCPR3 TCAP Available' - db cr,lf,' WHEEL T if Wheel Byte Set' - db cr,lf,' reg value T if Register reg = value' - db cr,lf,' fcb1=fcb2 T if the Two FCB values are =' - db cr,lf,'Only first 2 letters of keywords are required' - db cr,lf,'The leading "~" is effective with all conditions except' - db ' fcb1=fcb2' - db 0 - ret -; -; Process register - register value is in A -; -runreg: - push psw ;save value - call getnum ;extract value in FCB2 as a number - pop psw ;get value - cmp b ;compare against extracted value - jz ifctrue ;TRUE if match - jmp ifcfalse ;FALSE if non-match -; -; Process conditional test - address of conditional routine is in HL -; -runcond: - pchl ;"call" routine pted to by HL - -; -; Condition: NULL (2nd file name) -; -ifcnull: - lda fcb2+1 ;get first char of 2nd file name - cpi ' ' ;space = null - jz ifctrue - jmp ifcfalse - -; -; Condition: TCAP -; -ifctcap: - call getenv ;get ptr to ZCPR3 environment descriptor - lxi d,80h ;pt to TCAP entry - dad d - mov a,m ;get first char - cpi ' '+1 ;space or less = none - jc ifcfalse - jmp ifctrue - -; -; Condition: WHEEL -; -ifcwheel: - call getenv ;get ptr to ZCPR3 environment descriptor - lxi d,29h ;pt to Wheel Byte address - dad d - mov a,m ;get low - inx h - mov h,m ;get high - mov l,a ;put low - mov a,m ;get Wheel Byte - ora a ;0=not wheel - jz ifcfalse - jmp ifctrue - -; -; Condition: TRUE -; IFCTRUE enables an active IF -; Condition: FALSE -; IFCFALSE enables an inactive IF -; -ifctrue: - call negtest ;test for negate - jz ifcf ;make IF FALSE -ifct: - IF NOISE - call print - db ' IF T',0 - ENDIF ;NOISE - call ift ;make IF TRUE - rnz - jmp ifovfl -ifcfalse: - call negtest ;test for negate - jz ifct ;make IF TRUE -ifcf: - IF NOISE - call print - db ' IF F',0 - ENDIF ;NOISE - call iff ;make IF FALSE - rnz -ifovfl: - IF NOISE - call print - db ' IF Overflow',0 - ret - ELSE ;NOT NOISE - mvi a,bel - jmp cout - ENDIF ;NOISE - -; -; Condition: INPUT (from user) -; -ifcinput: - IF NOT NOISE - mvi a,lf ;new line - call cout - ENDIF ;NOT NOISE - call stopzex ;suspend ZEX input - call print - db ' IF True? ',0 - call capine - call strtzex ;resume ZEX input - cpi 'T' ;true? - jz ifctrue - cpi 'Y' ;yes? - jz ifctrue - cpi cr ;new line? - jz ifctrue - cpi ' ' ;space? - jz ifctrue - jmp ifcfalse - -; -; Condition: EXIST filename.typ -; List of Files Permitted -; -ifcex: - call skip2 ;skip to 2nd token - jz ifctrue ;declare TRUE if none -; -; Extract Next File -; -ifcex1: - lxi d,fcb1 ;pt to FCB - call zfname ;convert text - push h ;save ptr to next char -; -; Log Into to DU and Search for File -; - call tlog ;log into DU - lxi d,fcb1 ;pt to fcb - mvi c,17 ;search for first - call bdos - inr a ;set zero if error -; -; Abort as FALSE if File Not Found -; - pop h ;get ptr to next char - jz ifcfalse -; -; Advance to Next File, if Any -; - mov a,m ;more to follow? - inx h - cpi ',' - jz ifcex1 -; -; All Files Exist if No More Files -; - jmp ifctrue ;all found, so TRUE - -; -; Condition: EMPTY filename.typ -; -ifcempty: - call skip2 ;skip to 2nd token - jz ifctrue ;TRUE if none -; -; Select Next File -; -ifcem1: - lxi d,fcb1 ;pt to FCB1 - call zfname ;convert - push h ;save ptr to next -; -; Log into DU and Try to Open File -; - call tlog ;log into FCB1's DU - lxi d,fcb1 ;pt to fcb1 - mvi c,15 ;open file - push d ;save fcb ptr - call bdos - pop d - inr a ;not found? -; -; File is Empty if Not Found -; - jz ifemt -; -; Try to Read one Record from File -; - mvi c,20 ;try to read a record - call bdos - ora a ;0=OK -; -; File is Empty if Can't Read Record -; - jnz ifemt ;NZ if no read - pop h ;file not empty -; -; File Exists and Contains Something -; - jmp ifcfalse ;so EMPTY condition is FALSE -; -; File is Empty - Advance -; -ifemt: - pop h ;pt to next char - mov a,m ;get next char - inx h - cpi ',' ;more to come? - jz ifcem1 -; -; Done and True if No More Files - All are Empty -; - jmp ifctrue ;all empty, so TRUE - -; -; Condition: ERROR -; -ifcerror: - call geter1 ;get error byte - jz ifctrue - jmp ifcfalse - -; -; **** Support Routines **** -; - -; -; Save TBUFF and skip to 2nd token -; -skip2: - lxi d,tbuff+1 ;pt to first char - call codend ;pt to free area -skip2a: - ldax d ;get next char - mov d - ora a ;done? - jnz skip2a - call codend ;skip over spaces - call sksp - call sknsp ;skip over 1st token - call sksp ;skip over spaces - mov a,m ;get 1st char of 2nd token - ora a ;return with Z if none - ret - -; -; Convert chars in FCB2 into a number in B -; -getnum: - lxi h,fcb2+1 ;pt to first char - call eval10 ;evaluate - mov b,a ;value in B - ret - -; -; Log into DU in FCB1 -; -tlog: - lda fcb1 ;get disk - ora a ;current? - jnz tlog1 - mvi c,25 ;get disk - call bdos - inr a ;increment for following decrement -tlog1: - dcr a ;A=0 - mov e,a ;disk in E - mvi c,14 - call bdos - lda fcb1+13 ;pt to user - mov e,a - mvi c,32 ;set user - jmp bdos - -; -; Test of Negate Flag = negchar -; -negtest: - lda negflag ;get flag - cpi negchar ;test for No - ret - -; -; Test FCB1 against a single digit (0-9) -; Return with register value in A and NZ if so -; -regtest: - ldax d ;get digit - sui '0' - jc zret ;Z flag for no digit - cpi 10 ;range? - jnc zret ;Z flag for no digit - mov b,a ;register number in B - call getreg ;get register value - mov b,a ;save value - xra a ;set NZ - dcr a - mov a,b ;get register value - ret -zret: - xra a ;set Z - ret - -; -; Test FCB1 against condition table (must have 2-char entries) -; Return with routine address in HL if match and NZ flag -; -condtest: - lxi h,condtab ;pt to table -condt1: - mov a,m ;end of table? - ora a - rz - ldax d ;get char - mov b,m ;get other char in B - inx h ;pt to next - inx d - cmp b ;compare entries - jnz condt2 - ldax d ;get 2nd char - cmp m ;compare - jnz condt2 - inx h ;pt to address - mov a,m ;get address in HL - inx h - mov h,m - mov l,a ;HL = address - xra a ;set NZ for OK - dcr a - ret -condt2: - lxi b,3 ;pt to next entry - dad b ; ... 1 byte for text + 2 bytes for address - dcx d ;pt to 1st char of condition - jmp condt1 - -; -; Buffers -; -negflag: - ds 1 ;negation flag - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/IFSTAT.COM b/Source/Images/d_bp/u15/IFSTAT.COM deleted file mode 100644 index a76adaed..00000000 Binary files a/Source/Images/d_bp/u15/IFSTAT.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/IFSTAT.MAC b/Source/Images/d_bp/u15/IFSTAT.MAC deleted file mode 100644 index bab8a9d1..00000000 --- a/Source/Images/d_bp/u15/IFSTAT.MAC +++ /dev/null @@ -1,86 +0,0 @@ -; -; Program: IFSTAT -; Author: Richard Conn -; Version: 1.0 -; Date: 22 Apr 84 -; Previous Versions: None -; -version equ 10 - -; -; IFSTAT is used to display the current IF level. -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -fcb equ 5ch -cr equ 0dh -lf equ 0ah - -; -; External Z3LIB and SYSLIB Routines -; - ext z3init,iftest,eprint,cout - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Environment - lda fcb+1 ;check for help - cpi '/' - jz prhelp - call iftest ;get number of current IF - jnz prnum ;print number - call eprint - db ' No Active IF',0 - ret -prnum: - call eprint - db ' Current IF Level: ',0 - adi '0' ;convert to ASCII - jmp cout - -; -; Print Help Message -; -prhelp: - call eprint - db 'IFSTAT, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db ' - Display Current IF Level' - db cr,lf,'Syntax: IFSTAT' - db 0 - ret - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/IO.HLP b/Source/Images/d_bp/u15/IO.HLP deleted file mode 100644 index a238f917..00000000 --- a/Source/Images/d_bp/u15/IO.HLP +++ /dev/null @@ -1,390 +0,0 @@ -; - - - Redirectable I/O Under ZCPR3 and SYSIO - - -- Concepts -- - 1 - ZCPR3 and SYSIO - 2 - ZCPR3 and I/O Redirection - - -- Commands -- - C - CPSEL - D - DEVICE - E - DEV - L - LDR - R - RECORD - -:1 - Redirectable I/O Under ZCPR3 - - Thå concepô oæ redirectablå I/Ï involveó thå assignmenô -oæ  physicaì  deviceó tï logicaì devices®  ZCPR³  anä  CP/Í -supporô fouò logicaì devices: - - CON: - Console - An I/O Device for User/System Commo - LST: - Printer - An Output-Only Device for Printouts - RDR: - Reader - An Input-Only Device - PUN: - Punch - An Output-Only Device - - Undeò CP/M¬  therå arå onlù fouò physicaì deviceó whicè -maù bå assigneä tï eacè oæ thå fouò logicaì devices®  Undeò -ZCPR3¬  therå  maù  bå aó manù physicaì deviceó  aó  desireä -whicè maù bå assigneä tï eacè oæ thå fouò logicaì devices. - - Á  "physicaì  device¢  iî thå traditionaì  senså  ió  á -conventionaì  I/Ï device¬  likå á CRÔ oò á Printer®  Iî thå -senså oæ ZCPR3¬  iô ió á devicå driver¬ oò bodù oæ software¬ -whicè  ió  communicateä witè viá thå  BIOS®  Thió  bodù  oæ -software¬ iî turn¬ maù communicatå witè anù devicå OÒ SEÔ OÆ -DEVICEÓ thaô iô wishes. - - SYSIÏ  ió  á  samplå seô oæ  Redirectablå  I/Ï  Driveró -designeä  tï bå useä witè ZCPR³ oî mù system®  Undeò SYSIO¬ -some of thå "physicaì devices¢ implemented are: - -CON: Devices - TTY - CRT - CRT Input and CRT/Remote Computer Output - CRT and Modem Input and CRT and Modem Output - in Parallel - CRT Input and CRT/Modem Output - -LST: Devices - TTY - CRT - Modem - Remote Computer - -RDR: and PUN: Devices - Clock - - - Aó yoõ caî see¬  thå "physicaì devices¢ undeò ZCPR³ caî -bå  combinationó  oæ  actuaì devices®  Thå  CRÔ  Inpuô  anä -CRT/Remotå Computeò Outpuô device¬  foò instance¬ ió useä tï -allo÷  á remotå computeò recorä screeî displayó whicè gï  tï -thå CRT. - - Undeò ZCPR3¬ aó manù sets¬ oò packages¬ oæ Redirectablå -I/Ï  Driveró  aó desireä caî bå created®  Eacè packagå  caî -givå  thå  useò  differenô  typeó  oæ   capabilities®   Foò -instance¬  onå  packagå caî bå likå thå abovå examplå  whilå -anotheò packagå caî providå Disë Recordinç capability¬  sucè -aó CRÔ Inpuô anä CRT/Disë Filå Output. - - - Thå  ZCPR³  Systeí oæ Programó containó fouò  utilitieó -designeä  tï  supporô thå Redirectablå  I/Ï  System®  Theså -utilitieó anä theiò functionó are: - - LDR -- Load a Redirectable I/O Package - DEVICE -- Display and Select Physical I/O Devices - DEV -- Shorthand form of DEVICE - RECORD -- Turn on and off the Recording Facility - - Thió  HELÐ Filå discusseó theså utilitieó anä ho÷  theù -arå intendeä tï bå used. - - Implementatioî  detailó foò I/Ï Packageó arå lefô tï  á -studù  oæ thå sourcå codå oæ thå samplå I/Ï Packagå anä  thå -ZCPR3 book. - -:L - Loading Redirectable I/O Drivers -- LDR - - Onå  oæ  thå manù functionó oæ LDÒ ió tï  loaä  aî  I/Ï -Packagå  intï thå propeò memorù buffer®  LDÒ performó  thió -function when given a file specification of type IOP: - - LDR myio.iop - -will load MYIO.IOP as an I/O Package. - - LDÒ  performó  á structurå checë beforå  approvinç  thå -load. - -:D - -Command: DEVICE3 1.0 (DEVICE) - -Syntax: - - DEVICE <-- Enter Interactive Command Mode - -Function: - - DEVICÅ  ió  useä  tï allo÷ thå  useò  tï  interactivelù -displaù   thå  nameó  oæ  thå  availablå  physicaì   deviceó -(actually¬  devicå  drivers©  whicè maù bå assigneä  tï  thå -logicaì  deviceó anä tï allo÷ thå useò tï assigî á  physicaì -devicå tï á logicaì devicå bù name. - - -Options: - None - -Comments: - - DEVICÅ  onlù runó iî aî interactivå mode®  Iô respondó -tï   single-characteò  commands¬   completinç  thå   commanä -sequences in response and prompting the user. - - The following commands are recognized by DEVICE: - - D - Display Device Names - - C - Select Console Device (CON:) - L - Select List Device (LST:) - P - Select Punch Device (PUN:) - R - Select Reader Device (RDR:) - - X - Exit - - - Thå Displaù Devicå Nameó commanä (D© askó thå useò  foò -the devices to display. His responses are: - - A - All - C - Consoles - L - Lists - P - Punches - R - Readers - - Thå  Exiô commanä exitó tï ZCPR³ withouô promptinç  foò -confirmation. - - Thå otheò fouò commandó (C¬ L¬ P¬ anä R© assigî deviceó -IMMEDIATELY®  Thå  useò typeó thå namå oæ thå devicå tï  bå -assigned®  Iæ hå strikeó á returî iî responså tï thå devicå -name prompt, the command is aborted. - - -Selected Error Messages: - - Self-Explanatory - -Examples of Use: - - DEVICE - -- invoke utility - -:E - -Command: DEV 1.0 - -Syntax: - - DEV command,command,... - -Function: - - DEÖ  ió á utilitù whicè enableó thå useò tï  manipulatå -thå  ZCPR³ redirectablå I/Ï devicå drivers®  Iô allowó  thå -useò  tï displaù thå nameó oæ thå currenô deviceó anä selecô -them. - - Unlikå itó counterpart¬  DEVICE¬  DEÖ acceptó alì inpuô -from the command line and is not interactive. - -Options: - None - - Comments: - - Anù DEÖ commanä maù takå thå followinç forms® Onlù thå -first letters are significant in the these commands: - - DISPLAY ALL <-- Display names of all devices - DISPLAY CON <-- Display consoles - DISPLAY LST <-- Display printers - DISPLAY PUN <-- Display punches - DISPLAY RDR <-- Display readers - - D A is the same as DISPLAY ALL. - - Thå  fulì  devicå namå musô bå giveî iî  thå  followinç -commands®   Onlù  thå  firsô  characteò  anä  thå  '=§  arå -significant in the rest of the command. - - CON:=name LST:=name PUN:=name RDR:=name - - C=name is the same as CON:=name. - -Selected Error Messages: - - "DEÖ  NOÔ  Initializeä witè I/Ï Base¢ meanó  thaô  thió -ZCPR3 System does not support Redirectable I/O. - - "Redirectioî  Noô  Supported¢  meanó  thaô  thå  loadeä -drivers in the I/O Package do not support redirection. - -Examples of Use: - - DEV C=CRT,L=TTY - -- assign CRT to CON: and TTY to LST: - - -:R - -Command: RECORD 3.0 - -Syntax: - - RECORD ON or OFF <-- Console Recording -or - RECORD ON or OFF PRINTER <-- Printer Recording - -Function: - - RECORÄ  ió useä tï controì thå Disë Outpuô Facilitù  oæ -thå Redirectablå I/Ï Drivers® Copieó oæ Consolå anä Printeò -outputó  caî  bå createä iî disë fileó bù thå  uså  oæ  thió -facility¬  anä  iô  maù bå extendeä intï á numbeò  oæ  otheò -applicationó aó well. - - -Options: - - ON - Enable Recording - OFF - Disable Recording - - P - Reference Printer - -Comments: - - Foò  RECORÄ  tï  perforí  itó  function¬   iô  musô  bå -implementeä iî thå Redirectablå I/Ï Drivers®  Thió ió  lefô -aó aî exerciså foò thå reader® Thå Redirectablå I/Ï Driveró -supplieä  witè ZCPR³ havå simplå RETurî instructionó aó  thå -subroutineó executeä bù thå RECORÄ functions. - - - Fouò  routineó  arå  accesseä iî thå  Redirectablå  I/Ï -Driveò packagå tï controì thå RECORÄ function® Theù are: - - COPEN -- Enable Recording Console Output - LOPEN -- Enable Recording List Output - CCLOSE -- Disable Recording Console Output - LCLOSE -- Disable Recording List Output - - RECORÄ ió indirectlù tieä intï DEVICE® Invokinç RECORÄ -itselæ  doeó  noô  necessarilù starô thå  recordinç  procesó -immediately®   Twï  functionó  musô  takå  placå  tï  begiî -recordinç outpuô ontï disë files: - - 1) RECORD has to turn the appropriate Driver ON - 2) DEVICE has to select the appropriate Driver - - - Bù turninç RECORÄ OFÆ durinç á recordinç  session¬  thå -outpuô  filå  ió closeä anä availablå foò  otheò  uses®  Iæ -RECORÄ  ió lateò turneä ON¬  thå outpuô filå maù bå  deleteä -(iæ thå samå filå ió selecteä tï recorä into)®  However¬ iæ -á  ne÷  devicå ió selecteä whilå RECORÄ ió OΠ (say¬  DEVICÅ -CON:=CRÔ ió issued)¬ theî recordinç ió SUSPENDEÄ (NOÔ turneä -off©  untiì thå recordinç devicå ió  selecteä  again®  Witè -thió  capability¬  iæ iô lookó likå thå recordinç sessioî ió -noô  goinç well¬  recordinç caî bå  suspended¬  thå  probleí -fixed¬ anä theî recordinç caî bå resumed. - - Thió  combineä  systeí oæ DEVICÅ anä RECORÄ provideó  á -flexiblå outpuô recordinç system®  Iî addition¬  thå outpuô -recordinç neeä noô necessarilù gï tï á disë file®  Iô coulä -bå seô uð tï senä CONº  outpuô tï thå CRÔ and¬ say¬ á Remotå -Computeò foò processing. - - -Selected Error Messages: - - "I/Ï Driveò Addresó NOÔ Defined¢ meanó thaô therå ió nï -I/O Package in this ZCPR3 System. - - "Disë  Driveò  Modulå NOÔ Loaded¢ meanó  thaô  thå  I/Ï -Package does not support the RECORD facility. - - "Nï  I/Ï  Driveò Modulå Loaded¢ meanó thaô LDÒ haó  noô -been run to load an *.IOP file. - -Examples of Use: - - RECORD ON - - turn on recording for the console - - RECORD ON P - - turn on recording for the printer - -:2 - - - Redirectable I/O and the ZCPR3 System - - Thå   ZCPR³  Systeí  caî  functioî  witè   oò   withouô -Redirectablå  I/Ï  aó  implementeä bù thå  Redirectablå  I/Ï -Driveò  Packageó  anä  thå  LDR¬  DEV¬  DEVICE¬  anä  RECORÄ -programs®  Obviously¬  thå  ZCPR³ Systeí ió madå mucè  morå -flexiblå bù employinç theså facilities. - - DEVICÅ anä RECORÄ arå tieä directlù tï thå Redirectablå -I/Ï  Packageó themselves®  Theù don'ô uså anù oæ thå  otheò -featureó  oæ  thå ZCPR³ Systeí tï speaë  of¬  anä  theù  arå -installeä bù Z3INS. - - - Thå  programó controllinç thå Redirectablå I/Ï  Driveró -arå tieä togetheò iî thió manner: - - LDR loads the drivers - DEVICE controls the drivers - DEV controls the drivers - RECORD enables and disables the recording - facilities of the drivers - -:C - -Command: CPSEL 1.0 - -Syntax: - - CPSEL cmd1,cmd2,... - -Function: - - CPSEÌ  (CRT/Printeò  SELect© ió á ZCPR³  utilitù  whicè -permitó thå useò tï dynamicallù selecô thå CRÔ (oæ CRÔ ° anä -CRÔ  1© anä Printeò (oæ Printeró 0¬  1¬  2¬  anä 3© froí thå -currenô  ZCPR³  Environmenô  Descriptor®  Thió  dynamicallù -changeó thå characteristicó oæ thå printeò anä CRÔ whicè arå -used by other ZCPR3 utilities, such as PRINT. - -Options: - None - - -Comments: - - The commands may be any of the following: - - Cc, c=0 or 1 -- Select CRT 0 or CRT 1 - - Pp, p=0-3 -- Select Printer 0-3 - - Dd, d=A (All), C (CRT), P (Printer) - -- Display Selection Values - - Thå valueó affecteä bù theså selectionó includå  numbeò -oæ  lineó  anä  columnó oî thå CRÔ anä numbeò oæ  lineó  anä -columnó oî thå printer®  Thå abilitù oæ thå printeò tï forí -feed is also included. - - -Selected Error Messages: - None - -Examples of Use: - - CPSEL DA - - display all devices - - CPSEL C1,P3,DA - - Select CRT 1 and Printer 3; display all devices - when done - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/LDR-UPD.COM b/Source/Images/d_bp/u15/LDR-UPD.COM deleted file mode 100644 index 84f7f6ed..00000000 Binary files a/Source/Images/d_bp/u15/LDR-UPD.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/LDR-UPD.MSG b/Source/Images/d_bp/u15/LDR-UPD.MSG deleted file mode 100644 index c6339fe4..00000000 --- a/Source/Images/d_bp/u15/LDR-UPD.MSG +++ /dev/null @@ -1,16 +0,0 @@ - -Date: Thursday, 9 August 1984 11:33-MDT -From: Richard Conn -To: All -Re: LDR-UPD.COM for ZCPR3 - - I have uploaded a version of LDR.COM which matches the LDR.MAC -file. I really apologize for the mixup I made between the old object -of LDR and the release (final) object of LDR. The source file -(LDR.MAC) is current. - - Rick - -PS CRCs check from the upload, but the CRC is not the same as the one -on the distribution list, which matches the bad LDR.COM. I will send -out the correct LDR.COM in the Phase 2 release. diff --git a/Source/Images/d_bp/u15/LDR.COM b/Source/Images/d_bp/u15/LDR.COM deleted file mode 100644 index d2c4cb64..00000000 Binary files a/Source/Images/d_bp/u15/LDR.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/LDR.MAC b/Source/Images/d_bp/u15/LDR.MAC deleted file mode 100644 index 36f66240..00000000 --- a/Source/Images/d_bp/u15/LDR.MAC +++ /dev/null @@ -1,606 +0,0 @@ -; -; PROGRAM: LDR -; AUTHOR: RICHARD CONN -; VERSION: 1.0 -; DATE: 27 FEB 84 -; PREVIOUS VERSIONS: 0.1 (3 Feb 84), 0.2 (22 Feb 84), 1.1 (28 Sep 84) -; -;VERSION EQU 10 - -;VERSION EQU 11 ; Version 1.1 by Joe Wright 28 Sept 84 - - ; This version modified to allow loading the .ENV - ; file the first time, when there is no environment - ; descriptor in memory. The program now takes - ; the environment address from the .ENV file so - ; that subsequent files are also loaded correctly. - ; ie. LDR SYS.ENV,SYS.RCP,etc. Note that .ENV must - ; be the first declared file until LDR is installed - ; to your environment. jww - -VERSION EQU 12 ; Version 1.2 by Dave Lucky 31 Dec 84 - - ; This version modified to correct exit regs from - ; SDLOAD subroutine. The Source and Destination - ; registers on entry were HL and DE, respectively. - ; On exit, they were DE and HL. The calling routine - ; (SETDATA) went amuck when calculating number of NDR - ; records using bogus DE. Also, corrected the SETDATA - ; routine from using the incorrect address of the NDR - ; entry size field as well as its contents acquired - ; from the GETNDR routine. - -EXTENV EQU 1 ; 1 for External Environ, 0 for Internal Environ - -; -; LDR is a general-purpose package loader for ZCPR3. It is -; invoked by the following form: -; -; LDR -; -; For example: -; LDR DEFAULT.RCP,SYSIO.IOP -; -; No default file types are assumed on the list of packages, and -; each package specified must be unambigous and have a type of RCP or IOP -; (for Resident Command Package or Input/Output Package). LDR -; checks to make sure that the files are valid packages and then loads -; them into memory at the correct locations, checking for package boundary -; overflow. -; -; - -; -; ZCPR3 Header -; - MACLIB Z3BASE.LIB - -; -; System Equates -; -bdos equ 5 -fcb equ 5ch -tbuff equ 80h -rcpflg equ 1 ; package type is RCP -iopflg equ 2 ; package type is IOP -fcpflg equ 3 ; package type is FCP -ndrflg equ 4 ; package type is NDR -envflg equ 5 ; package type is ENV -tcapflg equ 6 ; package type is Z3T -cr equ 0dh -lf equ 0ah - - ext z3init,envptr - ext retud,getud,putud,logud - ext getrcp,getfcp,getiop,getndr - ext f$open,f$close,f$read - ext print,pfn2 - ext hmovb,moveb,fillb - ext cline,sksp,zfname - -; -; Environments -; -origin: -; - if extenv ; if external environment ... -; -; External Environment Definition -; - jmp z3ldr - db 'Z3ENV' ; this is an environment - db 1 ; class 1 environment (external) -envloc: - dw z3env ; ptr to environment -z3ldr: - lhld envloc ; HL pts to environment - - else ; if internal environment ... -; -; Internal Environment Definition -; - MACLIB SYSENV.LIB -envloc: - jmp z3ldr - SYSENV ; define environment -z3ldr: - lxi h,envloc ; HL pts to environment - - endif - -; -; Beginning of LDR -; - call z3init ; initialize environment pointer - call banner ; print banner - lxi h,tbuff ; pt to command line - call cline ; save command line as string - call sksp ; skip over spaces - mov a,m ; get offending char - cpi '/' ; help? - jz help - ora a ; help? - jz help -; -; Main Loop - HL pts to next file name in list -; -z3ldr1: - lxi d,fcb ; pt to fcb - call zfname ; extract file name and data - inx d ; pt to file name - call print - db cr,lf,' Loading ',0 - call pfn2 ; print file name - push h ; save ptr - call pkload ; load file - pop h ; get ptr - mov a,m ; get char - inx h ; pt to next char - cpi ',' ; another file in list? - jz z3ldr1 - ret -; -; Print Help Message -; -help: - call print - db cr,lf,' LDR Syntax:' - db cr,lf,' LDR ' - db cr,lf,' where entries in the list may be any of these types:' - db cr,lf - db cr,lf,' FCP - Flow Cmnd Package ENV - Z3 Environ' - db cr,lf,' IOP - Input/Output Package NDR - Z3 Named Dir' - db cr,lf,' RCP - Resident Cmnd Package Z3T - Z3TCAP Entry' - db cr,lf,lf,' The ENV file must be first if LDR is not installed.' - db cr,lf,0 - ret -; -; Load package named in FCB -; -pkload: - call setdata ; load data buffers from environment in case of change - call cktype ; check for valid file type - jz typerr ; abort if error - call open ; open file, read in first block, check for valid - jz getud ; abort if error - -; Check if ENV. If so, get Z3ENV and call z3init - - push h ; save package pointer from cktype - lxi d,fcb+9 ; fcb type - lxi h,envtyp ; ENV? - call comptyp ; compare types - pop h ; get package pointer - jnz pkld ; not ENV, proceed normally -; -; File type is ENV. Get Z3ENV address from file and re-initialize -; - lxi h,tbuff ; first sector in tbuff - lxi d,1bh ; offset to Z3ENV - dad d ; point hl to it - mov e,m ; get Z3ENV - inx h - mov d,m ; got it - xchg ; in hl - call z3init ; set new environment - -pkld: call load ; load package into memory at correct location - call close ; close up process - call getud ; return home -; -; Check for IOP and return if not -; - lda pktype ; init package if IOP - cpi iopflg - rnz -; -; Init IOP -; - lhld packadr ; get address - lxi d,9 ; 4th JMP into it - dad d - push h ; address on stack - ret ; "CALL" routine and return to OS -; -; Load Data Buffers from Environment -; -setdata: - lhld envptr ; get environment descriptor address - shld envadr - lxi d,80H ; pt to Z3TCAP - dad d - shld tcapadr - call getrcp ; get RCP data - lxi d,rcpdata ; load - call sdload - call getiop ; get IOP data - lxi d,iopdata ; load - call sdload - call getfcp ; get FCP data - lxi d,fcpdata ; load - call sdload - lxi h,ndridat ; init NDR data in case no entry - lxi d,ndrdata - mvi b,9 ; 9 bytes (1-jmp, 5-ID, 2-adr, 1-size) - call moveb - call getndr ; get NDR data - mov b,a ; save entry count ;1284DL - mov a,h ; no NDR data? - ora l - rz - mov a,b ; restore entry count ;1284DL - call sdload ; with DE -> ndrdata ;1284DL - push d ; save ptr to entry count ;1284DL - mvi h,0 ; HL = value - mov l,a ; A = entry count - dad h ; *2 - mov d,h ; DE = value * 2 - mov e,l - dad h ; *4 - dad h ; *8 - dad h ; *16 - dad d ; *18 - mov a,h ; /128 - rlc - ani 0feh - mov h,a - mov a,l - rlc - ani 1 - ora h ; A = value * 18 / 128 - inr a ; +1 - pop d ; get ptr - stax d ; save value - ret -; -; Load 3 bytes pted to by HL into memory pted to by DE+6 -; -; Input Regs: ;1284DL -; HL = Source ;1284DL -; DE = Destination ;1284DL -; ;1284DL -; Output Regs: ;1284DL -; HL = Source ;1284DL -; DE = Destination+8 ;1284DL -; ;1284DL -sdload: - push h ; save ptr to data - lxi h,6 ; add 6 to DE to pt to proper buffer - dad d ; HL pts to buffer - pop d ; DE contains address - mov m,e ; store address - inx h - mov m,d - inx h - mov m,a ; store size data - xchg ; swap Source / Destination regs ;1284DL - ret -; -; Print Banner -; -banner: - call print - db cr,lf,'ZCPR3 LDR, Version ' - db (VERSION/10)+'0','.',(VERSION MOD 10)+'0',0 - ret -; -; Check for Valid Package File Type -; Return with Zero Flag Set if error -; If validated, PKTYPE contains package type and HL pts to data -; -cktype: - lxi d,fcb+9 ; pt to file type - lxi h,rcptyp ; see if RCP - mvi b,rcpflg ; RCP code - call comptyp ; compare - jz cktok ; OK if match - lxi h,ioptyp ; see if IOP - mvi b,iopflg ; IOP code - call comptyp ; compare - jz cktok ; OK if match - lxi h,fcptyp ; see if FCP - mvi b,fcpflg ; FCP code - call comptyp ; compare - jz cktok ; OK if match - lxi h,ndrtyp ; see if NDR - mvi b,ndrflg ; NDR code - call comptyp ; compare - jz cktok ; OK if match - lxi h,envtyp ; see if ENV - mvi b,envflg ; ENV code - call comptyp ; compare - jz cktok ; OK if match - lxi h,tcaptyp ; see if Z3TCAP - mvi b,tcapflg ; Z3T code - call comptyp ; compare - jz cktok - mvi b,0 ; invalid type -cktok: - mov a,b ; set package type - sta pktype - ora a ; set NZ if no error - ret -comptyp: - push d ; save regs - push b - mvi b,3 ; 3 bytes -compt1: - ldax d ; get FCB char - ani 7fh ; mask - cmp m ; compare - jnz compt2 - inx h ; pt to next - inx d - dcr b ; count down - jnz compt1 -compt2: - pop b ; restore regs - pop d - ret -typerr: - call prf ; print file name and string - db ' is not a Valid Type',0 - ret -; -; Open File and Load First Block into TBUFF -; Validate Package Structure and Return with Zero Flag Set if Error -; On input, HL pts to data buffer -; If no error, HL points to load address and B is number of 128-byte -; pages allowed in buffer -; -open: - call putud ; save location - call retud ; get UD in BC - lda fcb ; get disk - ora a ; default? - jz open0 - mov b,a ; disk in B (A=1) - dcr b ; adjust to A=0 -open0: - lda fcb+13 ; get user - mov c,a ; user in C - call logud ; log into UD - xra a ; clear disk - sta fcb - -; -; Disallow Ambiguous File Name -; - call ambchk ; check for ambiguous file name - jz amberr ; abort if any ambiguity -; -; Open File -; - lxi d,fcb ; pt to FCB - call f$open ; open file - jnz fnferr ; abort if file not found -; -; Read First 128-byte Block -; - call f$read ; read in first block - jnz fempty ; abort if file empty -; -; Validate Package -; Package Data Area is structured as follows: -; DB numjmps ; number of jumps at beginning of package -; DB 'Z3xxx' ; package ID (always 5 chars) -; DW address ; address of memory buffer -; DB size ; number of 128-byte blocks in memory buffer -; - xchg ; DE pts to package data - ldax d ; get number of jumps - inx d ; pt to package ID - mov b,a ; jump count in B -; -; Validate Package - MUST have proper number of JMPs -; - lxi h,tbuff ; check jumps -open1: - mov a,b ; at limit of jumps? - ora a - jz open2 - dcr b ; count down - mov a,m ; check for JMP - cpi 0C3H ; JMP? - jnz strerr ; structure error - inx h ; pt to next - inx h - inx h - jmp open1 -; -; Check Package ID - must match -; -open2: - mvi b,5 ; check package ID -open3: - ldax d ; get byte - cpi ' ' ; no ID if space - jz open4 - cmp m ; check - jnz strerr ; structure error -open4: - inx d ; pt to next - inx h - dcr b ; count down - jnz open3 -; -; Extract Package Address -; - ldax d ; get low-order address - mov l,a ; put in HL - inx d - ldax d ; get high-order address - mov h,a - inx d -; -; Check for Valid Package Address -; - mov a,h ; must not be zero - ora l - jz adrerr -; -; Extract 128-byte Block Count -; - ldax d ; get block count - mov b,a ; put in B - xra a ; set flags - dcr a ; NZ - ret -; -; Ambiguous File Name Check -; Returns with Z Set if Ambiguous -; -ambchk: - lxi d,fcb+1 ; check for ambiguous file name - mvi b,11 ; 11 chars -ambchk1: - ldax d ; get char - ani 7fh ; mask - cpi '?' - rz - inx d ; pt to next - dcr b ; count down - jnz ambchk1 - dcr b ; set NZ flag - ret - -; -; Error Messages -; -amberr: - call prf ; print file name and message - db ' is Ambiguous',0 -erret: - xra a ; set error code - ret -adrerr: - call prf ; print file name and message - db ' Not Known to Environ',0 - jmp erret -fnferr: - call prf ; print file name and message - db ' Not Found',0 - jmp erret -fempty: - call prf ; print file name and message - db ' Empty',0 - jmp erret -strerr: - call prf ; print file name and message - db ' Contains a Format Flaw',0 - jmp erret -prf: - call print - db cr,lf,' File ',0 - lxi d,fcb+1 - call pfn2 - jmp print - -; -; Close File -; -close: - lxi d,fcb ; pt to FCB - jmp f$close ; close file - -; -; Load File Into Buffer -; -load: - shld packadr ; save package address in case of error - xchg ; DE pts to buffer, B = Max Blocks -load1: - push b ; save count - lxi h,tbuff ; pt to buffer - mvi b,128 - call hmovb ; copy TBUFF into Buffer - push d ; save ptr to next block in buffer - lxi d,fcb ; pt to fcb - call f$read ; read next block - pop d ; get ptr - pop b ; get count - rnz ; done if NZ - dcr b ; count down - jnz load1 -; -; Buffer Full -; - call prf - db ' is too Large',0 - lhld packadr ; clear package - mvi b,128 ; NOPs - xra a - call fillb - lxi b,128 ; pt to after last NOP - dad b - mvi b,3 ; copy 3 bytes - xchg ; DE pts to empty space - lxi h,ercode ; store error code - jmp moveb -; -; Error Code to be Stored if Package Load Fails -; -ercode: - xra a ; 3 bytes - dcr a ; A=0FFH and NZ Flag Set - ret - -; -; Buffers -; -ndridat: - db 0 ; no JMPs - db ' ' ; no ID stored - dw 0 ; address - db 0 ; (z3ndirs*18)/128+1 size -rcptyp: - db 'RCP' ; file type of RCP file -rcpdata: - db 0 ; 0 JMPs - db 'Z3RCP' ; ID - dw 0 ; address - db 0 ; size -ioptyp: - db 'IOP' ; file type of IOP file -iopdata: - db 16 ; 16 JMPs - db 'Z3IOP' ; ID - dw 0 ; address - db 0 ; size -fcptyp: - db 'FCP' ; file type of FCP file -fcpdata: - db 0 ; 0 JMPs - db 'Z3FCP' ; ID - dw 0 ; address - db 0 ; size -ndrtyp: - db 'NDR' ; file type of NDR file -ndrdata: - db 0 ; no JMPs - db ' ' ; no ID stored - dw 0 ; address - db 0 ; (z3ndirs*18)/128+1 size -envtyp: - db 'ENV' ; file type of ENV file -envdata: - db 1 ; 1 JMP - db 'Z3ENV' ; ID -envadr: - dw 0 ; address - db 2 ; 2 128-byte blocks max -tcaptyp: - db 'Z3T' ; file type of Z3TCAP file -tcapdata: - db 0 ; no JMPs - db ' ' ; no ID stored -tcapadr: - dw 0 ; address - db 1 ; 1 128-byte block max -pktype: - ds 1 ; package type (0=error) -packadr: - ds 2 ; package address - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/LDR15.LBR b/Source/Images/d_bp/u15/LDR15.LBR deleted file mode 100644 index 43154924..00000000 Binary files a/Source/Images/d_bp/u15/LDR15.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/LGET11.LBR b/Source/Images/d_bp/u15/LGET11.LBR deleted file mode 100644 index 093c3e3d..00000000 Binary files a/Source/Images/d_bp/u15/LGET11.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/LLF11.LBR b/Source/Images/d_bp/u15/LLF11.LBR deleted file mode 100644 index 939aed04..00000000 Binary files a/Source/Images/d_bp/u15/LLF11.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/LUZ3.LBR b/Source/Images/d_bp/u15/LUZ3.LBR deleted file mode 100644 index 1e422607..00000000 Binary files a/Source/Images/d_bp/u15/LUZ3.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/LX12.LBR b/Source/Images/d_bp/u15/LX12.LBR deleted file mode 100644 index efb0d9fe..00000000 Binary files a/Source/Images/d_bp/u15/LX12.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/LX14.LBR b/Source/Images/d_bp/u15/LX14.LBR deleted file mode 100644 index 785e99be..00000000 Binary files a/Source/Images/d_bp/u15/LX14.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/MCOPY.COM b/Source/Images/d_bp/u15/MCOPY.COM deleted file mode 100644 index 0f88cd19..00000000 Binary files a/Source/Images/d_bp/u15/MCOPY.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/MCOPY.MAC b/Source/Images/d_bp/u15/MCOPY.MAC deleted file mode 100644 index 2dd8892c..00000000 --- a/Source/Images/d_bp/u15/MCOPY.MAC +++ /dev/null @@ -1,1072 +0,0 @@ -; PROGRAM: MCOPY -; AUTHOR: RICHARD CONN -; VERSION: 4.0 -; DATE: 18 MAY 84 -; PREVIOUS VERSIONS: 3.0 (16 JAN 83) -; PREVIOUS VERSIONS: NUMEROUS - -VERS equ 42 ; Use 16k buffer 14 Dec 84 jww - ; Fix some bugs Joe Wright 28 Aug 84 - ; 1. Add check for directory full after f$make - -z3env SET 0F400H - -; -; MCOPY is a program which repeatedly copies a file from drive -; A: onto drive B:. It prompts the user to mount a disk in drive B:, -; copies the file from drive A: to drive B:, verifies the copy (if not -; overridden), and then performs the function again. -; -; MCOPY performs its function in the following steps: -; 1. MCOPY determines the attributes -; of the destination file (if it exists) and clears them (file becomes -; R/W and DIR) -; 2. MCOPY deletes the destination file (if it exists) -; 3. MCOPY copies the source file to the destination -; 4. MCOPY determines the attributes -; of the source file and makes the attributes of the destination file -; identical to those of the source -; 5. MCOPY reads both the source and destination files and -; compares them byte-for-byte -; - -; SPECIAL Constants -PLIM EQU 4*16 ; SIZE OF BUFFER IN PAGES (4 * nK) [may be changed] -ESIZE EQU 16 ; NUMBER OF BYTES/ENTRY - -; CP/M Constants -WB EQU 0 ; CP/M WARM BOOT -BDOSE EQU WB+5 ; BDOS ENTRY POINT -FCB EQU WB+5CH ; SPECIFIED FCB -BUFF EQU WB+80H ; DEFAULT BUFFER AND INPUT LINE -SDMA EQU 26 ; SET DMA ADDRESS - -; ASCII Constants, et al -ON EQU 0FFH ; ON CODE -OFF EQU 0 ; OFF CODE -CR EQU 0DH ; -LF EQU 0AH ; -CTRLC EQU 'C'-'@' ; ^C -CTRLZ EQU 'Z'-'@' ; ^Z -OPTC EQU '/' ; OPTION DELIMITER - -; -; LOAD @DE MACRO -; -LDED MACRO ?ADR - XCHG - LHLD ?ADR - XCHG - ENDM - -; -; SYSLIB ROUTINES -; - EXT Z3INIT,ZFNAME,GETQUIET - EXT COMPHD,RETUD,LOGUD,PUTUD,GETUD - EXT DIRQ,DIRPACK,DIRTDU - EXT INITFCB,F$EXIST - EXT CRCCLR,CRCUPD,CRCDONE - EXT BDOS,CIN,COUT,CONDIN - EXT F$DELETE,F$OPEN,F$MAKE,F$CLOSE,F$READ,F$WRITE - EXT PADC,EPSTR,EPRINT - EXT MOVEB,CAPS,CRLF - EXT CODEND - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - jmp startx - -; -; USER-DEFINABLE INITIAL FLAG CONDITIONS -; THE DEFAULT CONDITIONS FOR MCOPY MAY BE READILY PATCHED BY THE USER -; VIA DDT FOR HIS DESIRED DEFAULT VALUES -; -DVERFLG: - DB ON ; SET VERIFY -DINSP: - DB OFF ; SET NO INSPECT -DNCOPY: - DB OFF ; SET NO MULTIPLE COPIES BY DEFAULT -DDDISK: - DB 'B'-'A' ; DEFAULT DESTINATION DISK IS B -DDUSER: - DB 0 ; DEFAULT DESTINATION USER IS 0 -BACKDIR: - DB 'BACKUP ' ; NAME OF BACKUP DIRECTORY - -; -; BEGINNING OF MCOPY PROGRAM -; -STARTX: -; -; PRINT BANNER -; - CALL EPRINT - DB 'MCOPY Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0',0 -; -; SET UP DYNAMIC BUFFERS -; - LXI H,0 ; GET SP - DAD SP - SHLD STACK ; SAVE IT - CALL CODEND ; DETERMINE FREE SPACE - SHLD INLINE ; PTR TO INPUT LINE - INR H - SHLD FCBT ; PTR TO FCB TEMP - INR H - SHLD FCBS ; PTR TO SOURCE FCB - INR H - SHLD FCBD ; PTR TO DEST FCB - INR H - SHLD FREEBUF ; FREE SPACE BUFFER - -; -; SET DEFAULT FLAGS -; - CALL GETQUIET ; GET QUIET FLAG - STA QUIET - LDA DVERFLG ; VERIFY - STA VERFLG - LDA DINSP ; INSPECT - STA INSP - LDA DNCOPY ; MULTIPLE COPIES - STA NCOPY - -; -; CHECK FOR BACKUP DIRECTORY AND ESTABLISH IT AS DEFAULT -; IF NO BACKUP DIRECTORY, SELECT DEFAULT STORED -; - LXI H,BACKDIR ; PT TO DIRECTORY NAME - CALL DIRTDU - JZ DEFBACK ; NAME NOT FOUND, SO SELECT DEFAULT - MOV A,B ; SET DEST DISK - STA DDISK - MOV A,C ; SET DEST USER - STA DUSER - JMP BACKSET -DEFBACK: - LDA DDDISK ; GET DEFAULT DEST DISK - STA DDISK ; SET DEST DISK - LDA DDUSER ; GET DEFAULT DEST USER - STA DUSER ; SET DEST USER -; -; OBTAIN AND SAVE CURRENT USER AND DISK -; -BACKSET: - CALL PUTUD ; SAVE POSITION - CALL RETUD ; GET USER/DISK - MOV A,B ; SAVE DISK - STA CDISK - LHLD INLINE ; INPUT LINE SAVE BUFFER - XCHG ; ... IN DE - LXI H,BUFF+1 ; PT TO COMMAND LINE CHAR COUNT - MVI B,128 ; SAVE 128 BYTES (ARBITRARY) - CALL MOVEB - XCHG ; HL PTS TO INPUT LINE -; -; SET OTHER FLAGS -; - XRA A ; A=0 - STA EXIST ; TURN OFF EXIST TEST -; -; CHECK FOR EMPTY COMMAND LINE AND PROCESS COMMAND MODE IF SO -; ON ENTRY, HL PTS TO FIRST CHAR OF STRING FROM CLINE -; -START1: - MOV A,M ; GET CHAR - ORA A ; EOL? - JZ MHELP ; PRINT HELP MESSAGE IF NO INPUT - INX H ; PT TO NEXT - CPI ' ' ; JUST SPACES? - JZ START1 -; -; COMMAND LINE WAS NOT EMPTY -- CHECK FOR HELP REQUEST -; - DCX H ; PT TO FIRST CHAR - CPI '/' ; IF OPENING OPTION, MUST BE HELP - JZ MHELP -; -; SEE IF OPTIONS ARE AVAILABLE IN THE COMMAND LINE -; - SHLD MFPTR ; SET PTR TO FIRST CHAR OF FILE NAME SPECS -; -; SKIP TO END OF FILE NAME SPECS -; -START2: - MOV A,M ; SKIP TO OR EOL - INX H ; PT TO NEXT - CPI ' '+1 ; OR LESS? - JNC START2 - ORA A ; AT EOL? - JZ MCOPY0 ; PERFORM DEFAULT MCOPY FUNCTION IF AT EOL -; -; SCAN FOR OPTION -; -OPTION: - MOV A,M ; GET OPTION CHAR - ORA A ; EOL? - JZ MCOPY0 ; DO MCOPY - INX H ; PT TO NEXT - PUSH H ; SAVE PTR - LXI H,OPTTAB ; PT TO OPTION TABLE - CALL CMDER ; PROCESS COMMAND - POP H ; GET PTR - JMP OPTION - -; -; COMMAND PROCESSOR -- COMMAND LETTER IN A, HL PTS TO TABLE -; -CMDER: - PUSH B ; SAVE BC - MOV B,A ; COMMAND IN B -CMDER1: - MOV A,M ; GET COMMAND LETTER - ORA A ; DONE? - JZ CMDER2 - CMP B ; MATCH? - JNZ CMDER3 -CMDER2: - INX H ; PT TO ADDRESS - MOV E,M ; GET IT IN DE - INX H - MOV D,M - XCHG ; HL PTS TO COMMAND ADDRESS - POP B ; RESTORE BC - PCHL ; RUN COMMAND -CMDER3: - INX H ; SKIP TO NEXT ENTRY IN TABLE - INX H - INX H - JMP CMDER1 - -; OPTION COMMAND TABLE -OPTTAB: - DB ' ' ; DONE - DW OPTS - DB OPTC ; SKIP OPTC - DW OPTS - DB 'E' ; EXIST TEST - DW OPTE - DB 'I' ; INSPECT - DW OPTI - DB 'M' ; MULTIPLE COPY - DW OPTM - DB 'Q' ; QUIET - DW OPTQ - DB 'V' ; VERIFY - DW OPTV - DB 0 ; END OF TABLE - DW OHELP - -; INVALID OPTION CHAR -- CLEAR STACK (RET ADR AND HL) AND PRINT HELP -OHELP: - POP H ; CLEAR RET ADR - POP H ; CLEAR HL - -; PRINT HELP MESSAGE -MHELP: - CALL EPRINT - DB CR,LF,'Syntax:' - DB cr,lf,' MCOPY dir:=dir:filename.typ,... o...' - db cr,lf,'Options:' - DB cr,lf,' E -- Existence Test' - DB cr,lf,' I -- Inspect Files' - DB cr,lf,' M -- Multiple Copy' - DB cr,lf,' Q -- Toggle Quiet' - DB cr,lf,' V -- No Verify' - DB 0 - RET ; RETURN TO ZCPR3 - -; VERIFY FLAG TOGGLE OPTION -OPTV: - LDA VERFLG ; GET FLAG - CMA ; FLIP IT - STA VERFLG ; PUT FLAG -; SKIP OPTION -OPTS: - RET - -; EXIST TEST TOGGLE OPTION -OPTE: - LDA EXIST ; GET FLAG - CMA ; FLIP IT - STA EXIST ; PUT FLAG - RET - -; NCOPY FLAG TOGGLE OPTION -OPTM: - LDA NCOPY ; GET FLAG - CMA ; FLIP IT - STA NCOPY ; PUT FLAG - RET - -; INSPECT FLAG TOGGLE OPTION -OPTI: - LDA INSP ; GET FLAG - CMA ; FLIP IT - STA INSP ; PUT FLAG - RET - -; QUIET FLAG TOGGLE OPTION -OPTQ: - LDA QUIET ; GET FLAG - CMA ; FLIP IT - STA QUIET ; PUT FLAG - RET - -; -; **** MCOPY of COMMAND LINE **** -; -MCOPY0: - LHLD FREEBUF ; STACK RESET - SPHL - LDA NCOPY ; MULTIPLE COPIES? - ORA A ; 0=NO - JZ NOPAUSE - CALL SAKCHK ; STRIKE ANY KEY CHECK - JZ CPM ; WARM BOOT IF ABORT -NOPAUSE: - CALL COPY ; DO THE COPY -CPM: - LHLD STACK ; RESET STACK - SPHL - RET ; RETURN TO OPSYS -CPMA: - CALL EPRINT - DB CR,LF,'Abort',0 - JMP CPM - -; -; **** Begin Multiple Copy Procedure **** -; -COPY: - LHLD MFPTR ; PT TO FIRST FILE NAME - SHLD NXTPTR ; SET PTR TO NEXT FILE NAME - XRA A ; A=0 - STA VERCNT ; ZERO ERROR COUNT - LDA EXIST ; IF EXIST, THEN MUST NOT BE QUIET - ORA A ; 0=NO EXIST - JZ MCOPY - XRA A ; SET NO QUIET - STA QUIET -; -; **** MAIN COPY LOOP **** -; -MCOPY: - LHLD NXTPTR ; GET PTR TO NEXT FILE NAME - MOV A,M ; GET FIRST CHAR - CPI ' '+1 ; DONE IF OR LESS - JNC MCOPY1 ; CONTINUE WITH PROCEDURE -; -; MCOPY OF FILE SPECS IS NOW DONE -; DONE WITH COPY PROCEDURE -- CONTINUE? -; -COPYT: - LDA VERFLG ; VERIFY? - ORA A ; 0=NO - JZ COPYT1 - CALL CRLF ; NEW LINE - LDA VERCNT ; GET ERROR COUNT - CALL PADC ; PRINT AS DECIMAL - CALL EPRINT - DB ' Errors',0 -COPYT1: - LDA NCOPY ; MULTIPLE COPIES? - ORA A ; 0=NO - RZ - CALL SAKCHK ; CHECK FOR STRIKE OF ANY KEY - RZ ; RETURN IF ABORT - JMP COPY ; COPY AGAIN FROM THE BEGINNING -; -; BEGIN COPY OF FILE GROUP -; -MCOPY1: - CPI ',' ; SKIP COMMA SEPARATOR IF THERE - JNZ MCPY0 - INX H ; PT TO CHAR AFTER COMMA -MCPY0: - MOV A,M ; GET NEXT CHAR - CPI ' '+1 ; CHECK FOR ERROR - JC FORMERR - CALL GETUD ; RETURN HOME - LDED FCBS ; PT TO SOURCE FCB - MVI A,0 ; DIR BEFORE DU - CALL ZFNAME ; EXTRACT FILE NAME DATA - CALL DUCVRT ; CONVERT DU INTO BC - MOV A,M ; GET DELIMITER - CPI '=' ; IF '=', WE HAVE A NEW DISK/USER - JNZ MCOPY2 ; FORM IS DIRS:FN.FT IF NO '=' -; -; FORM IS DIRD:=DIRS:FN.FT, SO SET DEST DISK/USER -; - MOV A,B ; GET DISK - STA DDISK ; SET NEW DEFAULT DISK - MOV A,C ; GET USER - STA DUSER ; SET NEW DEFAULT USER -; -; NOW DERIVE DIRS:FN.FT FORM AFTER THE '=' -; -MCPY2: - INX H ; PT TO CHAR BEYOND '=' - MOV A,M ; GET CHAR - CPI ' '+1 ; FORMAT ERROR? - JC FORMERR - LDED FCBS ; LOAD FCB - MVI A,0 ; DIR BEFORE DU - CALL ZFNAME ; GET SOURCE NAME - CALL DUCVRT ; CONVERT TO DU IN BC -; -; SAVE PTR TO NEXT CHAR AFTER DIRS:FN.FT, AND SET SOURCE DISK/USER -; -MCOPY2: - SHLD NXTPTR ; SAVE PTR TO NEXT CHAR - MOV A,B ; GET DISK - STA SDISK ; SET NEW DEFAULT DISK - MOV A,C ; GET USER - STA SUSER ; SET NEW DEFAULT USER -MCPY22: - LDA DDISK ; DEST DIR MUST NOT EQUAL SOURCE DIR - MOV B,A - LDA SDISK - CMP B - JNZ MCPYOK - LDA DUSER - MOV B,A - LDA SUSER - CMP B - JNZ MCPYOK - CALL EPRINT - DB CR,LF,'Src=Dest Err',0 - RET -MCPYOK: - CALL EPRINT - DB CR,LF,'Copy ',0 - LDA SDISK ; GET NUMBER - ADI 'A' ; CONVERT TO LETTER - CALL COUT ; PRINT - LDA SUSER ; PRINT USER NUMBER - CALL PADC - MVI A,':' ; SEPARATOR - CALL COUT - MVI A,' ' - CALL COUT - LHLD FCBS ; PRINT FILE SPEC - INX H ; PT TO FILE NAME - CALL PRFN - CALL EPRINT - DB ' to ',0 - LDA DDISK ; GET NUMBER - ADI 'A' ; CONVERT TO LETTER - CALL COUT ; PRINT - LDA DUSER ; PRINT USER NUMBER - CALL PADC - MVI A,':' - CALL COUT - MVI C,13 ; RESET DISK SYSTEM - CALL BDOS - CALL LOGS ; LOG IN SOURCE USER/DISK - LDED FCBS ; PT TO SOURCE FCB - CALL INITFCB ; INIT FCB - LHLD FREEBUF ; PT TO BUFFER AREA - MVI A,0C0H ; SELECT NON-SYS AND SYS FILES - CALL DIRQ ; LOAD DIR, SELECT FILES, SORT, ETC - JZ TPAOVFL ; TPA OVERFLOW ERROR? - LDA INSP ; INSPECT FILES? - ORA A ; 0=NO - CNZ INSPF ; INSPECT FILES IF OPTION SELECTED - MOV A,B ; CHECK FOR ANY FILES TO COPY - ORA C ; 0=NONE - JNZ MCPY24 -MCPY23: - CALL EPRINT - DB CR,LF,' NO Files -- ^C to Abort ',0 - CALL CIN ; GET RESPONSE - CPI 'C'-'@' ; ABORT? - JZ COPYT ; END TEST - JMP MCOPY ; CONTINUE WITH NEXT -MCPY24: - PUSH H ; SAVE PTR AND COUNT - PUSH B - LXI D,ESIZE ; SKIP TO END OF LOADED FILES AND MARK BEGINNING OF - ; WORK AREA -MCPY25: - DAD D ; PT TO NEXT - DCX B ; COUNT DOWN - MOV A,B ; DONE? - ORA C - JNZ MCPY25 - MVI A,PLIM ; SET PAGE LIMIT - STA PAGLIM - SHLD WORKBF ; SAVE PTR TO BEGINNING OF WORK BUFFER - LDA BDOSE+2 ; GET BASE PAGE OF BDOS - SUI 10 ; GET BELOW BASE PAGE OF CCP - SUB H ; COMPUTE SIZE OF BUFFER AREA - CPI PLIM ; PLIM PAGES LEFT? - JNC PAGOK - STA PAGLIM ; SET PAGE LIMIT -PAGOK: - POP B ; RESTORE PTRS - POP H -; -; MAIN COPYING LOOP -; FILE NAMES ARE PTED TO BY HL AND BC=NUMBER OF FILES -; -MCPY26: - PUSH H ; SAVE REGS - PUSH B - CALL ABORTCK ; CHECK FOR ABORT -MCPY27: - CALL MCOPYX ; COPY SOURCE (HL) TO DESTINATION USING WORK BUFFER - CALL PRDONE ; PRINT DONE MESSAGE - CALL ABORTCK ; CHECK FOR ABORT - LDA LSTCPY ; LAST FILE COPIED? - ORA A ; 0=NO - JZ MCPY28 - LDA VERFLG ; VERIFY? - ORA A ; 0=NO - CNZ MCOPYV ; DO VERIFY -MCPY28: - POP B ; GET REGS - POP H - LXI D,ESIZE ; PT TO NEXT FILE - DAD D ; HL PTS TO NEXT FILE - DCX B ; COUNT DOWN - MOV A,B - ORA C - JNZ MCPY26 - JMP MCOPY ; COPY NEXT FILE SPEC -; -; CHECK FOR ABORT -; -ABORTCK: - CALL CONDIN ; CONDITIONAL INPUT - RZ - CPI CTRLC ; ABORT? - JZ CPMA - RET -; -; PRINT DONE MESSAGE -; -PRDONE: - LDA QUIET ; CHECK FOR QUIET - ORA A ; NZ=QUIET - RNZ - CALL EPRINT - DB ' Done',0 - RET -; -; COPY SOURCE FILE PTED TO BY HL TO DESTINATION -; -MCOPYX: - XRA A ; SET NO COPY OF LAST FILE - STA LSTCPY ; SET FLAG - LDED FCBS ; SET SOURCE FCB - MVI B,12 ; 12 BYTES - CALL MOVEB - CALL INITFCB ; INIT SOURCE FCB - LDED FCBD ; SET DESTINATION FCB - MVI B,12 ; 12 BYTES - CALL MOVEB - CALL DRW ; CLEAR ATTRIBUTES IN FCB - CALL INITFCB ; INIT DESTINATION FCB - CALL LOGD ; LOG IN DESTINATION - CALL EPRINT - DB CR,LF,' File ',0 - LHLD FCBD ; PRINT FILE NAME - INX H ; PT TO FILE NAME - CALL PRFN - LDED FCBD ; PT TO FCB - CALL F$EXIST ; DOES DEST EXIST? - JZ FNF ; FILE NOT FOUND IF ZERO - LDA QUIET ; QUIET? - ORA A ; 0=NO - JNZ FFND - CALL EPRINT - DB ' Replace',0 -FFND: - CALL EATEST ; EXIST APPROVED TEST? - RZ ; NOT APPROVED, SO ABORT - CALL DESTRW ; MAKE DESTINATION R/W IF NOT ALREADY - CALL F$DELETE ; DELETE FILE - CALL INITFCB ; REINIT FCB - JMP FNF1 ; CREATE NEW FILE AND CONTINUE -FNF: - LDA QUIET ; QUIET? - ORA A ; 0=NO - JNZ FNF1 - CALL EATEST ; EXIST APPROVED? - RZ ; NO? -FNF1: - CALL EPRINT - DB ' ...',0 - MVI A,0FFH ; SET COPY OF LAST FILE - STA LSTCPY ; SET FLAG - CALL F$MAKE ; CREATE NEW FILE - inr a ; check for full directory - jz dirful ; report it -; -; OPEN SOURCE FILE IN PREP FOR COPY -; - CALL CRCCLR ; CLEAR CRC VALUE - CALL LOGS ; LOG IN SOURCE DISK - LDED FCBS ; INIT FCB - CALL INITFCB - CALL F$OPEN ; OPEN FILE -; -; THIS LOOP, WHICH STARTS AT MCPYX, COPIES THE FILE FROM SOURCE TO DEST -; -MCPYX: - CALL LOGS ; LOG IN SOURCE - LDED FCBS ; PT TO SOURCE FCB - LHLD WORKBF ; PT TO BUFFER TO COPY INTO - CALL LOAD ; LOAD FILE INTO WORKBF - LDA BCNT ; IF COUNT=0, THEN DONE - ORA A - JZ MC2DONE -; -; COPY TO DISK -; -MCPYD: - CALL LOGD ; LOG IN DESTINATION - LHLD WORKBF ; PT TO BUFFER -MCPYD1: - CALL SETDMA ; SET DMA ADDRESS PTED TO BY HL - LXI D,128 ; INCR HL BY 128 - DAD D ; HL PTS TO NEXT BLOCK - LDED FCBD ; WRITE TO DESTINATION FILE - CALL F$WRITE - ORA A ; OK? - JNZ MCPYDERR - -; COUNT DOWN TO NEXT BLOCK - LDA BCNT ; GET BLOCK COUNT - DCR A ; COUNT DOWN - STA BCNT - JNZ MCPYD1 - LDA CONT ; CONTINUE? - ORA A ; CONT IF NOT ZERO - JNZ MCPYX -; -; END OF COPY LOOP -; -MC2DONE: - CALL LOGS ; LOG IN SOURCE - LDED FCBS ; CLOSE SOURCE - CALL F$CLOSE - CALL LOGD ; LOG IN DESTINATION - LDED FCBD ; CLOSE DESTINATION - CALL F$CLOSE - CALL CRCDONE ; GET CRCK VALUE - SHLD CRCVAL ; SAVE CRC VALUE -; -; SET ATTRIBUTES OF DESTINATION TO BE THE SAME AS THOSE OF SOURCE -; - CALL LOGS ; LOG IN SOURCE DRIVE - LDED FCBS ; FIND SOURCE - MVI C,17 ; SEARCH FOR FIRST - CALL BDOS - RLC ; MULTIPLY BY 32 TO GET OFFSET - RLC - RLC - RLC - RLC - ANI 0E0H ; MASK OUT LSB - MOV L,A ; VALUE IN L - MVI H,0 - LXI D,BUFF ; ADD IN BUFFER BASE - DAD D - XCHG ; PT TO FCBT IN DE - LHLD FCBT - XCHG - MVI B,16 ; MOVE 16 BYTES - CALL MOVEB - CALL LOGD ; LOG IN DESTINATION DRIVE - CALL INITFCB ; INIT FCB PTED TO BY DE (FCBT) - MVI C,30 ; SET FILE ATTRIBUTES - CALL BDOS - RET ; MCOPYX RETURN - -; -; CONVERT Z3 FCB DU INTO DU IN BC -; -DUCVRT: - PUSH H ; SAVE REGS - PUSH D - LDAX D ; GET DISK - ORA A ; CURRENT? - JNZ DUCV1 - LDA CDISK ; GET CURRENT - INR A ; ADD 1 FOR A=1 -DUCV1: - DCR A ; A=0 - MOV B,A - LXI H,13 ; OFFSET TO USER - DAD D - MOV C,M ; GET USER - POP D ; RESTORE REGS - POP H - RET - -; FORMAT ERROR -FORMERR: - CALL EPRINT - DB CR,LF,' Error: ',0 - CALL EPSTR ; PRINT ERROR - RET - -; TPA OVERFLOW -TPAOVFL: - CALL EPRINT - DB CR,LF,'TPA Ovfl',0 - JMP CPM - -; WRITE ERROR -MCPYDERR: - CALL EPRINT - DB CR,LF,'Disk Full',0 - JMP CPM - -; Directory Full Error -dirful: - call eprint - db cr,lf,'Directory Full',0 - jmp cpm - -; TEST FOR EXISTENCE REQUIREMENT AND GET USER RESPONSE -EATEST: - LDA EXIST ; EXISTENCE TEST ON? - ORA A ; 0=NO - JZ EAT1 - CALL EPRINT - DB ' -- (Y/N)? ',0 - CALL CIN ; GET RESPONSE - CALL CAPS - CPI CR ; YES? - JZ EAT1 ; COPY IF SO - CALL COUT - CPI 'N' ; NO? - JNZ EAT1 ; COPY IF NOT NO - XRA A ; ZERO FOR NOT APPROVED - RET -EAT1: - MVI A,0FFH ; SET NZ FOR APPROVED - ORA A ; SET FLAGS - RET -; -; MAKE DESTINATION FCB ENTRY R/W AND DIR -; -DRW: - PUSH D - LHLD FCBD ; CLEAR ATTRIBUTES OF DEST - LXI D,9 - DAD D - POP D - MOV A,M ; GET IT - ANI 7FH ; CLEAR IT - MOV M,A - INX H ; SAME TO NEXT - MOV A,M ; GET IT AND CLEAR IT - ANI 7FH - MOV M,A - RET -DESTRW: - CALL DRW ; MAKE ATTRIBUTES R/W AND NON-SYS - LDED FCBD ; SET ATTRIBUTES - MVI C,30 - CALL BDOS - RET - -; -; LOAD BUFFER PTED TO BY HL FROM FILE WHOSE FCB IS PTED TO BY DE -; ON OUTPUT, BCNT=NUMBER OF BLOCKS LOADED (UP TO 128) AND -; CONT=0 IF DONE OR 128 IF NOT DONE -; -LOAD: - XRA A ; A=0 - STA BCNT ; SET BLOCK COUNT - STA CONT ; TURN OFF CONTINUATION FLAG - -; MAIN COPY LOOP -MCPY: - CALL SETDMA ; SET DMA TO BLOCK PTED TO BY HL - CALL F$READ ; READ BLOCK - ORA A ; END OF FILE? - RNZ ; RETURN - PUSH D ; SAVE PTR TO FCB - XCHG ; SAVE PTR TO DESTINATION BUFFER IN DE - LHLD BDOSE+1 ; GET TOP OF TPA - XCHG ; ... IN DE, DEST IN HL - MOV A,H ; IF SAME PAGE, WE ARE IN OVERFLOW - CMP D ; D MUST BE > H - JNC TPAOVFL ; OVERFLOW IF D<=H - MVI B,128 ; UPDATE CRC FOR 128 BYTES -MCPYCRC: - MOV A,M ; GET BYTE - CALL CRCUPD ; UPDATE CRC - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ MCPYCRC - POP D ; GET PTR TO FCB - LDA BCNT ; GET BLOCK COUNT - INR A ; INCREMENT IT - STA BCNT ; SET IT - MOV B,A ; BLOCK COUNT IN B - LDA PAGLIM ; GET PAGE LIMIT - ADD A ; DOUBLE IT FOR BLOCKS - CMP B ; BUFFER FULL? - JNZ MCPY - STA CONT ; SET CONTINUATION FLAG - RET - -; -; SET DMA ADDRESS TO THAT PTED TO BY HL -; -SETDMA: - PUSH H ; SAVE REGS - PUSH D - PUSH B - XCHG ; ADDRESS IN DE - MVI C,SDMA - CALL BDOSE - POP B ; RESTORE REGS - POP D - POP H - RET - -; -; VERIFY PHASE -; -MCOPYV: - LDA QUIET ; CHECK FOR QUIET - ORA A ; NZ=QUIET - JNZ MCPYV - CALL EPRINT - DB ' Verify ...',0 -MCPYV: - CALL CRCCLR ; CLEAR CRCK VALUE - CALL LOGD ; LOG IN DESTINATION - LDED FCBD ; CLEAR DESTINATION FCB - CALL INITFCB ; INIT FCB - CALL F$OPEN ; OPEN FILE - -; **** MAIN VERIFY LOOP **** -VERLOOP: - LHLD WORKBF ; LOAD INPUT BUFFER FROM DESTINATION - LDED FCBD - CALL LOAD ; LOAD AND COMPUTE CRC VALUE - LDA BCNT ; DONE IF NO BYTES LOADED - ORA A - JZ VERCRC - LDA CONT ; CONTINUE? - ORA A ; 0=NO - JNZ VERLOOP -; VERIFY DONE -VERCRC: - LHLD CRCVAL ; GET OLD CRC VALUE - XCHG ; ... IN DE - CALL CRCDONE ; UPDATE COMPLETE - CALL COMPHD ; COMPARE HL TO DE - JZ PRDONE ; PRINT DONE MESSAGE OR FALL THRU TO ERROR MSG - -; VERIFY ERROR -VERERR: - LXI H,VERCNT ; INCREMENT ERROR COUNT - INR M - CALL EPRINT - DB ' Error',0 - RET - -; -; **** MCOPY Utilities **** -; - -; -; CHECK TO SEE IF USER WANTS TO CONTINUE -; -SAKCHK: - CALL EPRINT - DB ' ^C to Quit - ',0 - CALL CIN ; GET RESPONSE - CALL CRLF ; NEW LINE - CALL CAPS ; CAPITALIZE - CPI 'C'-'@' ; ^C? - RET -; -; ALLOW USER TO INSPECT FILES FOR COPY -; FIRST FILE NAME PTED TO BY HL, BC = NUMBER OF FILES -; ON EXIT, BC = NUMBER OF SELECTED FILES -; -INSPF: - CALL EPRINT - DB CR,LF,' Inspect -- ' - db 'Yes, No (def), Skip Rest' - db 0 - PUSH H ; SAVE PTR TO FIRST FILE - PUSH B ; SAVE FILE COUNT - LXI D,ESIZE ; ENTRIES ARE ESIZE BYTES APART -INSPF0: - MOV A,M ; MARK FILE FOR NO COPY - ANI 7FH ; CLEAR MSB FOR NO COPY - MOV M,A - DAD D ; PT TO NEXT - DCX B ; COUNT DOWN - MOV A,B ; DONE? - ORA C - JNZ INSPF0 - POP B ; RESTORE AND SAVE AGAIN - POP H - PUSH H - PUSH B -INSPF1: - PUSH H ; SAVE PTR TO FILE - INX H ; PT TO FN - CALL CRLF ; NEW LINE - CALL PRFN ; PRINT IT - POP H ; GET PTR TO FILE - CALL EPRINT - DB ' - (Y/N/S)? ',0 - CALL CIN ; GET RESPONSE - CALL CAPS ; CAPITALIZE - CALL COUT ; ECHO - CPI 'S' ; SKIP? - JZ INSPFA - CPI 'Y' ; Yes? - JNZ INSPF2 - MOV A,M ; GET USER NUMBER - ORI 80H ; MARK FILE - MOV M,A ; SET USER NUMBER -INSPF2: - LXI D,ESIZE ; PT TO NEXT FILE - DAD D - DCX B ; COUNT DOWN - MOV A,B ; DONE? - ORA C - JNZ INSPF1 -INSPFA: - POP B ; GET COUNT - POP H ; GET PTR TO FIRST FILE - JMP DIRPACK ; REPACK DIRECTORY - -; -; LOG IN SOURCE USER/DISK -; -LOGS: - LDA SUSER ; USER - MOV C,A ; ... IN C - LDA SDISK ; DISK - MOV B,A ; ... IN B - JMP LOGUD ; LOG IN USER/DISK - -; -; LOG IN DESTINATION USER/DISK -; -LOGD: - LDA DUSER ; USER - MOV C,A ; ... IN C - LDA DDISK ; DISK - MOV B,A ; ... IN B - JMP LOGUD ; LOG IN USER/DISK - -; -; PRINT FILE NAME -; -PRFN: - PUSH H ; SAVE REGS - PUSH B - MVI B,8 ; PRINT 8 CHARS - CALL PRFN1 - MVI A,'.' ; DOT - CALL COUT - MVI B,3 ; PRINT 3 CHARS - CALL PRFN1 - POP B ; GET REGS - POP H - RET -PRFN1: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - CALL COUT ; PRINT IT - DCR B ; COUNT DOWN - JNZ PRFN1 - RET - -; -; **** BUFFERS **** -; - -; POINTERS -MFPTR: DS 2 ; PTR TO FIRST CHAR OF NEXT FN SPEC -NXTPTR: DS 2 ; PTR TO NEXT FN SPEC IN LINE -WORKBF: DS 2 ; PTR TO BEGINNING OF WORK BUFFER - -; FLAGS COPIED FROM DEFAULTS -VERFLG: DS 1 ; VERIFY -INSP: DS 1 ; INSPECT -QUIET: DS 1 ; QUIET -NCOPY: DS 1 ; MULTIPLE COPY - -; DISKS AND USERS -CDISK: DS 1 ; CURRENT DISK -SDISK: DS 1 ; SOURCE DISK -SUSER: DS 1 ; SOURCE USER -DDISK: DS 1 ; DESTINATION DISK -DUSER: DS 1 ; DESTINATION USER - -; CRC VALUE -CRCVAL: DS 2 ; CRC CHECK VALUE - -; FCBS -FCBS: DS 2 ; SOURCE FCB -FCBD: DS 2 ; DESTINATION FCB -FCBT: DS 2 ; PTR TO TEMPORARY FCB FOR ATTRIBUTE SETTINGS - -; COUNTS AND FLAGS -PAGLIM: DS 1 ; MAX NUMBER OF PAGES IN WORK BUFFER -LSTCPY: DS 1 ; LAST FILE WAS COPIED FLAG -EXIST: DS 1 ; TEST FOR EXISTENCE FLAG -VERCNT: DS 1 ; ERROR COUNT -BCNT: DS 1 ; BLOCK COUNT -CONT: DS 1 ; CONTINUE FLAG (0=NO, 0FFH=YES) - -; DYNAMIC BUFFERS -INLINE: - DS 2 ; INPUT LINE BUFFER -FREEBUF: - DS 2 ; FREE SPACE BUFFER -STACK: - DS 2 ; OPSYS STACK PTR - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/MCOPY44.LBR b/Source/Images/d_bp/u15/MCOPY44.LBR deleted file mode 100644 index 3d6cc490..00000000 Binary files a/Source/Images/d_bp/u15/MCOPY44.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/MCOPY45B.LBR b/Source/Images/d_bp/u15/MCOPY45B.LBR deleted file mode 100644 index 7bcd7619..00000000 Binary files a/Source/Images/d_bp/u15/MCOPY45B.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/MENU.COM b/Source/Images/d_bp/u15/MENU.COM deleted file mode 100644 index c1397ab3..00000000 Binary files a/Source/Images/d_bp/u15/MENU.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/MENU.HLP b/Source/Images/d_bp/u15/MENU.HLP deleted file mode 100644 index 57485deb..00000000 --- a/Source/Images/d_bp/u15/MENU.HLP +++ /dev/null @@ -1,893 +0,0 @@ -; - - - The ZCPR3 MENU Shell - - -- ZCPR3 Utilities -- - 1 - MENU - 2 - MENUCK - - -- Using MENU -- -- Programming MENU -- - U - Using MENU P - Programming *.MNU Files - S - Summary of User Cmds C - *.MNU Internal Commands - E - MENU Error Messages M - Programming Cmd Summary - Z - MENU and ZCPR3 - -:1 - -Command: MENU 3.2 - -Syntax: - MENU <-- run MENU.MNU -or - MENU ufn <-- run menu contained in file - -Function: - - MENÕ  ió thå ZCPR³ menõ front-enä processor®  Iô ió  á -ZCPR³  Shelì whicè readó á *.MNÕ filå anä processeó commandó -froí it. - -Options: - None - -Comments: - MENÕ  ió á truå ZCPR³ Shell®  Iô ió describeä iî  thió -HELP file. - Selected Error Messages: - - "Nï  Commanä Line¢ meanó thaô thå ZCPR³ Systeí doeó noô -supporô  aî externaì Commanä Linå Buffer®  MENÕ  musô  havå -thió tï run. - - "Nï  Shelì Stack¢ meanó thaô thå ZCPR³ Systeí doeó  noô -support a Shell Stack. MENU must have this to run. - - "Shelì  Stacë Full¢ meanó thaô thå Shelì Stacë ió  fulì -and MENU cannot push itself onto the stack. - - "Shelì  Stacë  Entrù Size¢ meanó thaô thå  Shelì  Stacë -elements are too short for MENU to store its parameters. - - "TPÁ  Full¢ meanó thaô therå ió noô enougè rooí iî  thå -TPA to load the *.MNU file. - -Examples of Use: - See this HELP file - - MENÕ  ió thå ZCPR³ Menu-Orienteä Commanä  Preprocessor® -Iô  actó aó á front-enä tï ZCPR3¬  providinç á menu-orienteä -useò interfacå tï ZCPR3® Itó functioî caî bå representeä bù -thå followinç diagram: - ------ ------ ------ ------ - |M | |Z | |B | |P | - User | E | | C | | D | | g | - Menu ---->| N |--->| P |--->| O |--->| m | - Command | U| | R| | S| | s| - | | | 2| | | | | - ------ ------ ------ ------ - - Thå  "Useò Menõ Command¢ ió á singlå characteò thaô thå -useò  strikeó  whicè instructó MENÕ tï perforí  á  function® -Oncå  MENÕ  beginó processinç thió  function¬  iô  buildó  á -commanä  linå  foò  ZCPR3¬  optionallù askinç thå  useò  foò -furtheò  inpuô (sucè aó á filå name)¬  anä theî  passeó  thå -commanä  linå tï ZCPR³ viá thå Commanä Linå  Buffer®  ZCPR³ -theî runó thå commanä linå returnó tï MENU. - - MENÕ  buildó  commanä lineó baseä oî simplå inpuô  froí -thå user®  Thå useò neeä neveò kno÷ whaô thå actuaì commanä -linå is® Thå commanä linå itselæ ió alwayó oæ thå form: - - - - Aó aî example¬ á commanä builô bù MENÕ tï ruî XDIÒ witè -useò  inpuô foò á filå namå specification¬  coulä looë  likå -thå following: - - XDIR - - - Wheî  MENÕ ió executed¬  iô lookó foò thå filå MENU.MNÕ -iî thå currenô directory®  Iæ iô findó one¬ iô loadó iô anä -beginó  processing®  Iæ  iô doeó noô finä  one¬  iô  simplù -exits®  Á  filå namå maù bå specifieä iî thå  MENÕ  commanä -line to select a file other than MENU.MNU. - - Thå  MENU.MNÕ  filå caî contaiî uð tï 25µ menuó  tï  bå -processeä  bù MENU®  Thå MENÕ wilì begiî processinç aô  thå -firsô menõ iî MENU.MNU. - - - MENÕ itselæ ió á COÍ file¬ likå anù otheò prograí undeò -ZCPR3®  Unlikå mosô otheò programs¬  however¬  iô generateó -commanä lineó tï bå executeä bù ZCPR³ anä storeó itó  returî -commanä iî thå Shelì Stack® Iî thió waù á looð ió seô up: - - -->--+->- MENU ->- ZCPR3 ->-+ - ^ v - | | - +-<- Command Line -<---+ - - Onlù  MENÕ  itselæ caî terminatå thió  loop®  Iæ  thå  MENÕ -programmeò  wishes¬  hå caî seô uð thå MENU.MNU filå sï thaô thió -looð  wilì neveò bå exited¬  oò hå caî seô uð thå filå  tï  allo÷ -anyonå  tï exiô aô anù timå oò jusô á speciaì persoî whï knowó  á -passworä  tï  exiô  wheî  hå  wisheó  to®  Therå  ió  á  loô  oæ -flexibilitù  designeä intï thå system¬  anä iô wilì bå  discusseä -later in the section on programming MENU.MNU files. - - Á  MENU.MNÕ  filå  caî bå seô uð tï executå  anù  ZCPR³ -commanä oò sequencå oæ commands® Thå MENU.MNÕ filå caî alsï -bå seô uð tï noô allo÷ thå useò tï leavå MENU¬  tï allo÷ hií -tï leavå MENÕ aô will¬ oò tï allo÷ hií tï leavå MENÕ onlù iæ -hå knowó á password. - - Thió  HELÐ filå ió divideä intï twï basiã  parts®  Thå -infï sectionó oî "Usinç MENU¢ anä "Summarù oæ MENÕ Commands¢ -arå designeä tï bå reaä bù á persoî wantinç tï uså MENÕ  buô -noô  wantinç  tï learî ho÷ MENÕ workó oò ho÷ tï prograí  it® -Theså  sectionó  describå  ho÷  tï movå  froí  onå  menõ  tï -another¬  ho÷ tï issuå MENÕ commands¬  anä ho÷ tï leavå MENÕ -iæ thå optioî ió presenteä tï him. - - Thå  otheò  sectionó  oæ thió HELР filå  describå  thå -programminç  aspectó oæ MENÕ anä arå intendeä tï bå useä  aó -aî  onlinå  referencå foò thå  MENÕ  programmer®  Thå  MENÕ -commanä  programminç summarù ió especiallù usefuì iî thaô iô -provideó á summarù oæ thå commandó whicè thå MENÕ programmeò -maù issuå tï MENÕ withiî á *.MNU file. -:U - - Wheî  MENÕ ió firsô invoked¬  onå oæ threå thingó  wilì -happen: - - 1©  Á  MENÕ  wilì appeaò anä bå pageä uð  tï  filì  thå - screen» á commanä prompô wilì appeaò aô thå bottoí - oæ thå menu - - 2©  Á MENÕ wilì appeaò anä noô bå pageä uð tï filì  thå - screen» á commanä prompô wilì appeaò aô thå bottoí - oæ thå menu - - 3©  Á commanä prompô wilì appeaò witè nï menõ (thió  ió - called the Expert Mode) - - Iæ  aô  anù timå á Menõ Displaù ió garbleä oò thå  useò -desireó  tï seå thå currenô Menõ (aó sometimeó happenó  wheî -yoõ arå iî Experô Mode)¬  jusô strikå thå RETURΠ key®  Thå -RETURÎ keù refresheó thå menõ aô alì times. - - - Thå  prompô  whicè appearó aô thå bottoí oæ  youò  Menõ -displaù haó thå followinç generaì form: - -Command (=Menu,^C=ZCPR3,*=1st Menu,<=Prev Menu,>=Next Menu) - - - Therå caî bå uð tï 25µ menuó iî onå MENU.MNÕ file® Thå -MENÕ commanä prompô varieó tï reflecô this®  Foò  instance¬ -iæ  onlù onå Menõ waó presenô anä thå optioî tï aborô ouô oæ -MENÕ  tï  ZCPR³ waó noô available¬  theî  thå  Menõ  Commanä -prompô woulä takå itó simplesô form¬ lookinç like: - -Command (=Menu) - - - Strikå thå RETURÎ keù aô thió timå tï refresè thå  Menõ -Displaù oò strikå thå characteò oæ á Menõ Option® Theså arå -thå onlù choices¬  anä strikinç á characteò whicè ió noô thå -RETURÎ keù oò á menõ optioî resultó iî thå belì sounding. - - - Iæ  thå thå optioî tï exiô tï ZCPR³ waó  availablå  anä -therå  ió  onlù  onå Menõ iî thå  MENU.MNÕ  file¬  theî  thå -commanä linå wilì looë likå this: - -Command (=Menu,^C=ZCPR3) - - - Thå  optioî oæ abortinç tï ZCPR³ bù strikinç  Control-à -(holä  dowî  oî thå Control¬  oò CTRL¬  keù anä  strikå  thå -letteò  C© ió no÷ available®  Thió wilì returî tï ZCPR³ anä -exiô MENU. - - Onå brieæ notå oî optioî letteró beforå goinç  on®  Iæ -onå  oæ  youò optionó ió á letteò iî thå rangå froí Á tï  Z¬ -theî caså ió noô significant¬  anä yoõ caî invokå thå optioî -A¬ say¬ bù strikinç aî upper- oò lower-caså A. - - - Iæ therå ió morå thaî onå menõ iî thå *.MNÕ  file¬  thå -commanä linå optionó becomå slightlù morå complex¬  buô theù -arå stilì quitå easù tï follow. - - Iî  thå followinç examples¬  assumå thaô thå optioî  tï -exiô  tï  ZCPR³ ió off¬  sï thå "^C=ZCPR3¢ optioî  wilì  NOÔ -appear. - - Froí thå firsô menõ iî thå file¬  thå commanä linå wilì -looë likå thå following: - -Command (=Menu,>=Next Menu) - - - Tï advancå tï thå nexô menu¬  strikå thå ">¢ oò thå ".¢ -character®  Oî mosô keyboards¬ ">¢ ió thå shifô oæ thå "."¬ -sï  MENÕ permitó easù movemenô withouô havinç tï worrù abouô -shiftinç thå keyboarä alì thå time. - - - Iæ aô thå lasô menõ iî thå file¬  thå commanä linå wilì -looë likå thå following: - -Command (=Menu,*=1st Menu,<=Prev Menu) - - - Thió  allowó  thå useò tï strikå thå "*¢  characteò  tï -jumð  bacë tï thå firsô menõ iî hió *.MNÕ file®  Iæ "<¢  oò -",¢ ió stucë ("<¢ ió usuallù thå shifô oæ thå ",")¬ theî thå -useò wilì bacë uð onå menõ tï thå previouó menõ iî thå file. - - Iæ thå useò ió somewherå iî thå middlå oæ thå  MENU.MNÕ -file¬ hió commanä linå wilì looë likå this: - -Command (=Menu,*=1st Menu,<=Prev Menu,>=Next Menu) - - - Again¬  "*¢ wilì gï directlù tï thå firsô menu¬  "<¢ oò -",¢ wilì gï tï thå previouó menu¬  anä ">¢ oò ".¢ wilì gï tï -thå  nexô  menu®  Strikinç thå RETURÎ keù wilì refresè  thå -menõ display. - - Onå lasô optioî thå useò haó undeò MENÕ involveó accesó -tï  á Systeí Menu®  Thió menõ ió speciaì iî thaô  therå  ió -onlù onå waù tï geô tï iô -- viá thå "$¢ command. - - Thå  Systeí  Menõ ió intendeä tï givå privelegeä  useró -accesó tï speciaì commandó thaô thå resô oæ thå useró  can'ô -run®  Iæ  á Systeí Menõ ió available¬  MENÕ wilì responä tï -thå "$¢ commanä witè thå prompt: - - Pass? - - Thå  useò  ió giveî onå chancå tï typå iî  thå  correcô -passworä  tï enteò thå Systeí Menu®  Iæ hå  ió  wrong¬  thå -messagå "Passworä Error¢ wilì appeaò anä hå wilì bå returneä -tï thå menõ hå camå from®  Iæ hå ió correct¬  hå wilì enteò -thå Systeí Menu®  Physically¬ thå Systeí Menõ ió alwayó thå -lasô menõ iî thå file¬ anä itó commanä prompô is: - -Command (=Menu,*=1st Menu,<=Prev Menu) - - - Iæ thå useò ió aô thå menõ jusô beforå thå Systeí Menu¬ -thå ">¢ wilì noô functioî tï allo÷ hií tï enteò it¬ eveî thï -therå  technicallù ió á "Nexô Menu"®  Thå ">¢ optioî iî thå -commanä  linå  wilì noô appear®  Thå onlù waù  tï  enteò  á -Systeí Menõ ió thrõ thå "$¢ command. - - Iî  summary¬  movinç  abouô withiî MENÕ ió quitå  easy® -"*¢  moveó thå useò tï thå firsô menu¬  "<¢ tï thå  previouó -menu¬ ">¢ tï thå nexô menu¬ anä "$¢ tï thå Systeí Menu. - -:S - - The full Menu Command Line looks like the following: - -Command (=Menu,^C=ZCPR3,*=1st Menu,<=Prev Menu,>=Last Menu) - - - The Menu Commands are: - - Command Function - - Refresh Menu Display (RETURN Key) - ^C Exit to ZCPR3 (Control-C) - * Jump to the First Menu - < or , Jump to the Previous Menu - > or . Jump to the Next Menu - $ Jump to the System Menu (Password Required) - other Menu Option or Invalid Command; letters are - automatically capitalized, so a=A - -:P - - Programming *.MNU Files - - Thå  *.MNÕ  filå  ió simplù á texô filå  whicè  maù  bå -createä   witè  anù  conventionaì  CP/Í  editor¬   includinç -WordStar®  MENÕ  ignoreó  thå Mosô Significanô Biô  oæ  alì -bytes¬ sï editoró likå WordStar¬ whicè occasionallù seô thió -bit¬ caî bå used. - - Alì *.MNÕ fileó havå thå samå generaì  structure®  Thå -firsô  linå ió eitheò á globaì optioî linå oò thå  beginninç -oæ á menõ display®  Iæ á globaì optioî line¬ iô beginó witè -thå  characteò  "-"¬   anä  thió  characteò  ió  immediatelù -followeä  bù  globaì optioî characters®  Thå globaì  optioî -line¬ theî lookó likå this: - --options - - Afteò thå globaì optioî line¬  iæ any¬  comeó thå firsô -menu® Eacè menõ ió structureä aó follows: - - #options - - # - menu commands - - The following are two sample Menu File structures: - - -options #options - #options - # - # commands - commands ## - #options - - # - commands - ## - Therå arå fouò optioî characters®  Iî usinç them¬ caså -ió noô significant® Theså optioî characteró are: - - Option Function - C Display Command Line to User - D Display Menu to User - P Page Out Menu Display - X Allow User to Exit to ZCPR3 - - Thå à optioî displayó thå commanä linå builô bù MENÕ tï -thå user®  Thió optioî ió primarilù intendeä foò  debugginç -purposes¬  tï  allo÷ thå programmeò tï seå whaô commandó arå -beinç built®  Iô ió instructivå tï thå user¬  however¬  anä -maù bå employeä foò thaô purposå aó well. - - Thå  Ä optioî displayó thå menõ tï thå  user®  Iæ  thå -displaù  functioî ió noô turneä on¬  wå arå iî Experô  Mode¬ -anä  thå  commandó  arå availablå withouô  á  menõ  display® -RETURN¬  oæ  course¬  caî  bå useä tï invokå thå displaù  iæ -necessary. - - Thå Ð optioî pageó ouô thå menõ display®  Iæ thå  pagå -functioî  ió engaged¬  theî thå MENÕ prograí outputó  ¢  oò  ".¢ tï gotï thå nexô menõ (Menõ 2) - ^à tï gotï ZCPR3 - - In the second menu, the user may strike: - - "3" to goto Menu 3 - "*" or "<" or "," to goto Menu 1 - ">" or "." to goto Menu 3 - ^C to goto ZCPR3 - - In the third menu, the user may strike: - - "2" or "<" or "," to goto Menu 2 - "*" to goto Menu 1 - - ! Opt - Thå "!¢ optioî causeó MENÕ tï pauså anä asë thå useò tï -"Strikå  Anù Key¢ beforå continuinç afteò thå  commanä  linå -haó  beeî processed®  Iî thió way¬  iæ á commanä  generateó -informatioî  tï  bå reaä bù thå useò beforå MENÕ clearó  hió -screen¬  thå "!¢ optioî maù bå useä tï givå thå useò alì thå -timå hå wantó tï reaä thió display. - - "prompt" - Embeddeä  withiî anù commanä linå maù bå á  prompô  foò -user input. This prompt takes the form of - - "prompt to user" - -Wheî  encountered¬  MENÕ  wilì advancå tï thå nexô linå  anä -prinô thå texô containeä withiî thå quotes®  MENÕ wilì theî -waiô foò thå useò tï inpuô anù texô hå desireó followeä bù á -RETURN®   Aô  thió  point¬  thå  texô  thå  useò  inpuô  ió -capitalizeä anä placeä intï thå commanä linå aô thå poinô oæ -the prompt. - - Iæ  thå  prompô  appearó aô thå enä oæ á  MENÕ  commanä -line¬  thå trailinç quotå ió noô required®  Aó manù promptó -aó desireä maù appeaò withiî á MENÕ commanä line® Examples: - - "prompt" - -dxp - # - A - Run XDIR without Pause or Input - B - Run XDIR and Pause before Returning to MENU - C - Run XDIR, Allow User Input, and Pause before - Returning to MENU - M - Run MCOPY, Allow User Input of Dest Dir, Allow - User Input of Source Dir and File, and Pause - before returning to MENU - Z - Run Any ZCPR3 Command and Pause before - Returning to MENU - # - m!mcopy "Destination Dir? "="Source DIR:AFN? " - z!"Enter Command Line -- - axdir - b!xdir - c!xdir "Enter Ambiguous File Name -- - ## - - "prompt" - Notå  thå Spacå righô beforå thå "Prompô forí iî thå  Ã -command®  Thió spacå ió significanô tï keeð thå commanä anä -useò  inpuô froí runninç together®  Thió "ruî together¢  ió -desireä  foò thå Ú command®  Alsï notå thå duaì prompô  foò -the M command. - - Witè thå Í command¬  thå followinç promptó wilì  appeaò -(and sample input): - - Destination Dir? BACKUP: - Source DIR:AFN? *.TXT - -and the following command line is built: - - MCOPY BACKUP:=*.TXT - - Variables - Thå commanä texô whicè ió specifieä iî thå MENÕ commanä -linå  caî contaiî embeddeä variableó whicè MENÕ wilì  expanä -wheî thå commanä linå ió processed®  Theså variables¬ whicè -arå  denoteä  bù á dollaò sigî ($© followeä bù  onå  oò  twï -characters, are defined as follows: - - Variable Expands as - -------- ---------- - $D Current Disk - $U Current User Area - $Fn FILENAME.TYP for ZCPR3 System File n - $Nn FILENAME for ZCPR3 System File n - $Tn TYP for ZCPR3 System File n - $$ Place a single $ in command line - - Theså  variableó  caî alsï bå useä iî thå menõ  displaù -itself¬  anä  theiò  valueó  wilì bå  substituteä  wheî  thå -display is generated. Example: - - Variables - -dpx - # - Menu to Run M80 Assembler - Current File: $F1 - Directory: $D$U - F - Define File - E - Edit $F1 P - Page $F1 - A - Assemble $F1 - # - fsetfile 1 "Filename? " - eedit $f1 - azex m80 $n1 - ppage $f1 - ## - - Variables -Notes: - - 1® Thå ZCPR³ utilitù SETFILÅ ió useä tï definå thå namå -oæ  á  ZCPR³  Systeí  File®  Therå arå  fouò  Systeí  Fileó -available¬  anä theù caî bå referenceä bù $F± tï $F4¬ $N± tï -$N4, and $T1 to $T4. - - 2® Thå Á commanä showó thå executioî oæ ZEX® MENÕ ió á -truå ZCPR³ Shell¬  and¬  aó such¬ ZEØ commandó caî bå issueä -froí iô anä wilì ruî oî toð oæ it®  Thå prompô foò thå  ZEØ -command lines will be "Menu>". - - 3®  Assuminç thaô "MYFILE.MAC¢ ió assigneä tï thå ZCPR³ -Systeí Filå ± anä thå useò ió loggeä intï disë  useò 1¬ thå -followinç  screeî  showó ho÷ thå displaù anä  thå  resultinç -commanä lineó wilì bå expandeä wheî executioî occurs: - - Variables - Display - - Menu to Run M80 Assembler - Current File: MYFILE.MAC - Directory: B1 - F - Define File - E - Edit MYFILE.MAC P - Page MYFILE.MAC - A - Assemble MYFILE.MAC - - - Command Lines - Menu Command Expansion - - fsetfile 1 "Filename? " SETFILE 1 "Filename? " - eedit $f1 EDIT MYFILE.MAC - azex m80 $n1 ZEX M80 MYFILE - ppage $f1 PAGE MYFILE.MAC - - Highlighting - Jusô  likå  thå HELÐ utilitù caî takå advantagå oæ  thå -highlightinç facilitù provideä iî thå Z3TCAP¬  sï caî  MENU® -Foò thoså ZCPR³ Systemó witè á properly-installeä TCAP¬ MENÕ -wilì  uså  thå  cleaò screeî commanä tï refresè  thå  user'ó -screeî  anä  highlightinç  caî bå enableä  anä  disableä  bù -embeddinç  ^Á (tï turî oî highlighting© anä ^ (tï turî  ofæ -highlighting© intï thå *.MNÕ file. - - Iô ió recommendeä thaô wheî highlightinç ió turneä  on¬ -iô  shoulä  bå turneä ofæ iî thå samå linå  foò  consistencù -sake and appearance. - - Example: - - Highlighting - # - ^AThis is highlighted^B and this is not - # - -wilì appeaò witè "Thió ió highlighted¢ iî á highlighteä modå -likå this: - - This is highlighted and this is not - - - Closing - Closing Notes - - Aó  manù commandó aó thå printablå ASCIÉ characteò  seô -(withouô lower-caså letteró anä thå MENÕ commanä characters© -wilì allo÷ arå permitteä bù MENU®  Thå text¬  however¬  foò -eacè  menõ musô bå ablå tï fiô oî á screeî witè thå  commanä -prompô  aô  thå  bottom®  Thió meanó thaô thå  texô  cannoô -exceeä 2² lines. - - MENÕ  fitó iî nicelù tï thå ZCPR³ Systeí  oæ  programs® -Thå informatioî sectioî oî "MENU'ó Relationshið tï thå ZCPR³ -System¢  explainó ho÷ MENÕ anä thå otheò ZCPR³ programó worë -together. - - Thå  followinç  ASCIÉ  characteró maù NOÔ  bå  useä  aó -commandó sincå theù arå useä elsewhere: - - # % , . < > * - -:M - - MENU Programming Command Summary - - Eacè  MENÕ commanä occupieó onlù onå  line¬  anä  blanë -lineó  iî thå commanä grouð arå noô permitted®  Thå commanä -linå ió structureä aó follows: - - l[o][command] - -where: - l is the single character used to invoke the command - note that it may be upper- or lower-case - o is an opening option, which is one of: - :nn -- go to Menu nn - ! -- have MENU wait when the command is finished - command is an optional ZCPR3 command; note that if - the option is ":nn", then a command here makes no - sense - - The MENU commands are: - - Command Function - - :nn Goto Menu nn, where the first menu is Menu 1 - ! Wait after command line is executed before - processing the menu - "Prompt" Prompt the user for input and accept it - -The MENU variables are: - - Variable Expands to - - $D Current Disk - $U Current User - $Fn FILENAME.TYP for System File n - $Nn FILENAME for System File n - $Tn TYP for System File n - $$ $ - -Noteº Systeí Fileó caî bå defineä bù thå SETFILÅ command. - -The Highlighting Embedded Characters are: - ^A Turn ON Highlighting - ^B Turn OFF Highlighting - -Noteº  Iô ió recommendeä thaô iæ highlightinç ió turneä  on¬ -it should be turned off in the same line. - - - -Thå  followinç ASCIÉ characteró maù NOÔ bå useä aó  commandó -sincå theù arå useä elsewhere: - - # % , . < > * - - - -:Z - - MENU's Relationship to the ZCPR3 System - - MENU¬  likå mosô oæ thå ZCPR³ utilities¬ interactó witè -thå systeí aó á wholå anä cannoô bå useä witè systemó  otheò -thaî ZCPR3® Iî particular¬ MENÕ requireó thå ZCPR³ Multiplå -Commanä  Linå  Buffeò  anä  Shelì  Stacë  facilitieó  tï  bå -availablå  tï iô anä cannoô ruî withouô them®  MENÕ invokeó -commanä  lineó  viá thå Commanä Linå Buffeò anä  returnó  tï -itselæ thrõ thå Shelì Stack®  Iô alsï useó thå ZCPR³ Systeí -Fileó foò somå oæ itó variableó anä thå Z3TCAÐ facilitù  foò -itó screeî manipulatioî (highlighting). - - MENU is installed by Z3INS. - - - Also¬ CÄ (Changå Directory© anä STARTUÐ (or¬ SÔ foò CD© -caî  comå  intï plaù witè MENU®  Wheî CÄ logó intï  tï  ne÷ -directory¬  iô  lookó foò thå filå ST.COÍ anä executeó iô iæ -therå  ió one®  SÔ ió simplù STARTUÐ renamed¬  anä  STARTUÐ -wilì  loaä thå Multiplå Commanä Linå Buffeò witè  á  commanä -linå anä theî terminate. - - Froí  thå poinô oæ vie÷ oæ MENU¬  thå commanä loadeä bù -SÔ  coulä bå MENU®  Thå effecô oæ thió ió tï  automaticallù -enteò  MENÕ  wheî  thå  useò employó CÄ  tï  enteò  á  giveî -directory. - - Hence¬  bù usinç CD¬  á useò caî enteò á directorù  anä -suddenlù  finä  himselæ  iî á menõ insteaä oæ aô  thå  ZCPR³ -commanä  level®  Thió  ió  gooä foò  applicationó  wherå  á -directorù  ió  seô  asidå foò á specifiã  purposå  anä  onlù -certaiî  operationó  arå  tï bå performeä  iî  it¬  sucè  aó -cataloginç diskó oò handlinç accounts. - - - No÷  thaô  MENÕ ió runninç foò thå  directory¬  á  MENÕ -commanä  coulä bå anotheò CÄ tï anotheò  directory®  Oò  iô -coulä simplù bå á DUº form® Example: - - #dp - A - Enter ZCPR Directory - B - Enter A0: - # - acd zcpr: - ba0: - # - - Here¬  iæ Á ió issued¬ theî CÄ wilì movå intï ZCPRº anä -executå ST.COÍ iæ therå ió onå there®  Iæ  ió issued¬  thå -useò  ió loggeä intï A0:®  MENÕ ió thå nexô commanä iî botè -caseó (commanä lineó arå "CÄ ZCPR;MENU¢ anä "A0:;MENU")¬  sï -MENÕ automaticallù reinvokeó anä lookó foò MENU.MNU®  Iæ iô -findó it¬ wå arå iî anotheò MENÕ system¬ and¬ iæ iô doesn't¬ -wå arå bacë tï ZCPR³ commanä level. - - Undeò thå Á option¬ iæ CÄ findó ST.COM¬ SÔ wilì executå -itó functioî and¬  unlesó thió functioî popó thå Shelì Stacë -(SHPOÐ command)¬ MENÕ wilì reinvokå afteò iô ió complete. - - Undeò  thå  option¬  wå wilì ruî MENÕ nexô anä  simplù -exiô iæ á MENU.MNÕ filå ió noô found. - -:E - - MENU Error Messages - - Iî ordeò tï makå MENÕ aó smalì aó possible¬  thå  erroò -messageó  havå beeî reduceä tï á minimum®  MENÕ provideó  á -minimuí indicatioî thaô somethinç ió wronç anä aborts. - - Thå  prograí  MENUCË  ió  designeä  tï  telì  yoõ  morå -specificallù  whaô  ió  wrong®  MENUCË ió  á  *.MNÕ  Syntaø -Checker¬ anä iô lookó foò alì sortó oæ erroò conditionó thaô -caî occuò iî á *.MNÕ file. - - MENÕ provideó thå followinç minimaì erroò messages: - - - Message Meaning - - No Shell Stack Shell Stack Not Available - No Command Line Command Line Buffer Not Avail - Shell Stack Full Shell Stack is Full - Shell Stack Entry - Size Shell Stack Entries are too - short for MENU cmd line - File x.typ Not - Found Menu File Not Found - TPA Full Memory is Full - User Command is in Error - Password Error Invalid Password Given - Structure Error *.MNU File Structure Error - -:2 - -Command: MENUCK 1.0 - -Syntax: - MENUCK dir:ufn <-- default file type is MNU - -Function: - - MENUCË  ió useä tï checë thå syntaø oæ á *.MNÕ filå foò -thå ZCPR³ Menõ Shell¬  MENU® MENÕ ió optimizeä foò sizå anä -speed¬  and¬  iî deepinç iô small¬ built-iî diagnosticó werå -reduceä  tï thå minimum®  MENUCË ió intendeä tï bå useä  tï -analyzå  *.MNÕ fileó anä providå informativå diagnosticó  oî -any syntactical errors with them. - -Options: - None - - -Comments: - - MENUCË  checkó tï seå iæ thå sizå oæ thå *.MNÕ filå  ió -toï largå foò thå TPÁ availablå tï thå MENÕ  command®  Thió -is an additional check beyond the normal syntax check. - - MENUCË  identifieó  thå  locatioî  oæ  erroró  bù  linå -number. The first line in the file is line number 1. - -Selected Error Messages: - - Self-Explanatory. - -Examples of Use: - - MENUCK MYMENU - -- perform check on MYMENU.MNU - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/MENU.MAC b/Source/Images/d_bp/u15/MENU.MAC deleted file mode 100644 index a53fa4a8..00000000 --- a/Source/Images/d_bp/u15/MENU.MAC +++ /dev/null @@ -1,1510 +0,0 @@ -; -; PROGRAM: MENU -; AUTHOR: RICHARD CONN -; VERSION: 3.2 -; DATE: 10 June 84 -; PREVIOUS VERSIONS: 3.1 (28 Mar 84), 3.0 (18 Mar 84) -; DERIVATION. MENU 1.4 for ZCPR2 -; -VERS EQU 32 - -; -; MENU is the ZCPR3 Menu Processor. It loads, looks for the MENU.MNU -; file, and then displays it to the user (optionally) and prompts him for -; a single-character command. The ZCPR3 Multiple Command Line Buffer must -; be installed for MENU to work, and MENU uses this buffer to chain to the -; programs selected by the user and return to itself at the proper place. -; -; MENU supports multiple menus within one MENU.MNU file. When a command -; is invoked, MENU returns to the menu the command came from. -; -; MENU will ONLY RUN on ZCPR3 systems with the Multiple Command Line -; Buffer Option enabled. -; - -; -; Menu Constants -; -sysmenu equ 0 ;System Menu Enabled? 0=no, 1=yes - -; 1 Special Menu Command Chars -RNM EQU '>' ;NEXT MENU -RNMP EQU '.' ;NEXT MENU PRIME (ALTERNATE) -RLM EQU '<' ;LAST MENU -RLMP EQU ',' ;LAST MENU PRIME (ALTERNATE) -RFM EQU '*' ;FIRST MENU -; - if sysmenu -RSM EQU '$' ;SYSTEM MENU (PASSWORD REQUIRED) - ; THIS IS SAME AS CONTROL CHAR - endif ;sysmenu - -; 2 Internal Menu Control Chars -MCMD EQU ':' ;COMMAND TO JUMP TO ANOTHER MENU -PCHAR EQU '"' ;INDICATES AUTO PROMPT FOR SPECIFIC CMD -MINDIC EQU '#' ;MENU SECTION INDICATOR -MFIRST EQU '%' ;FIRST MENU INDICATOR -GOPTION EQU '-' ;GLOBAL OPTION INDICATOR -WOPTION EQU '!' ;ACTIVATES WAIT UPON RETURN - -; 3 Menu Option Chars -COPTION EQU 'C' ;DISPLAY COMMAND LINE TO USER -DOPTION EQU 'D' ;DISPLAY MENU TO USER -POPTION EQU 'P' ;PAGE OUT MENU DISPLAY TO USER -XOPTION EQU 'X' ;DISABLE ZCPR3 RETURN - -; 4 Miscellaneous -IBUFSZ EQU 254 ;SIZE OF INPUT LINE BUFFER -VARFLAG EQU '$' ;VARIABLE FLAG - ;(FOLLOWED BY D,U,Fn,Nn,Tn) -CMDSEP EQU ';' ;ZCPR3 COMMAND SEPARATOR - -; -; Enter/Exit Standout Mode (Recommended that these values not be changed) -; -DIM EQU 'A'-'@' ; ^A TO ENTER STANDOUT -NOTDIM EQU 'B'-'@' ; ^B TO EXIT STANDOUT - -; -; MACRO Library of Definitions -; - MACLIB Z3BASE.LIB - -; -; ZCPR3 CONSTANTS -; -wboot equ 0 -bentry equ 5 -fcb equ 5ch -tbuff equ 80h -BEL equ 7 -CR equ 0dh -LF equ 0ah -CTRLC equ 'C'-'@' -TAB equ 'I'-'@' -CTRLZ equ 'Z'-'@' - -; -; MACROS TO PROVIDE Z80 EXTENSIONS -; MACROS INCLUDE: -; -; BR - JUMP RELATIVE -; BRC - JUMP RELATIVE IF CARRY -; BRNC - JUMP RELATIVE IF NO CARRY -; BRZ - JUMP RELATIVE IF ZERO -; BRNZ - JUMP RELATIVE IF NO ZERO -; BJNZ - DECREMENT B AND JUMP RELATIVE IF NO ZERO -; PUTRG - SAVE REGISTERS -; GETRG - RESTORE REGISTERS -; - -; -; -; Z80 MACRO EXTENSIONS -; -BR MACRO ?N ;;JUMP RELATIVE - IF I8080 ;;8080/8085 - JMP ?N - ELSE ;;Z80 - .Z80 - JR ?N - .8080 - ENDIF ;;I8080 - ENDM -; -BRC MACRO ?N ;;JUMP RELATIVE ON CARRY - IF I8080 ;;8080/8085 - JC ?N - ELSE ;;Z80 - .Z80 - JR C,?N - .8080 - ENDIF ;;I8080 - ENDM -; -BRNC MACRO ?N ;;JUMP RELATIVE ON NO CARRY - IF I8080 ;;8080/8085 - JNC ?N - ELSE ;;Z80 - .Z80 - JR NC,?N - .8080 - ENDIF ;;I8080 - ENDM -; -BRZ MACRO ?N ;;JUMP RELATIVE ON ZERO - IF I8080 ;;8080/8085 - JZ ?N - ELSE ;;Z80 - .Z80 - JR Z,?N - .8080 - ENDIF ;;I8080 - ENDM -; -BRNZ MACRO ?N ;;JUMP RELATIVE ON NO ZERO - IF I8080 ;;8080/8085 - JNZ ?N - ELSE ;;Z80 - .Z80 - JR NZ,?N - .8080 - ENDIF ;;I8080 - ENDM -; -BJNZ MACRO ?N ;;DECREMENT B AND JUMP RELATIVE ON NO ZERO - IF I8080 ;;8080/8085 - DCR B - JNZ ?N - ELSE ;;Z80 - .Z80 - DJNZ ?N - .8080 - ENDIF ;;I8080 - ENDM -; -PUTRG MACRO - PUSH H ;;SAVE REGISTERS IN ORDER - PUSH D - PUSH B - ENDM -; -GETRG MACRO - POP B ;;RESTORE REGISTERS IN ORDER - POP D - POP H - ENDM -; -; END OF Z80 MACRO EXTENSIONS -; - -; -; Externals from SYSLIB -; - ext z3vinit,cls,stndout,stndend - ext getcl1,putcl,getsh2,qshell,retud,getefcb,shpush,shpop - ext getshm,putshm,moveb,getfn2,pfn1,getcrt,getzrun,putzex,putcst - ext eprint,cin,cout,caps,crlf,pafdc,madc,bline,initfcb,sksp - ext f$open,f$close,f$read,codend,hmovb - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3vinit ;initialize the ZCPR3 Env and the VLIB Env - jmp strt -; -; This is the FCB which defines the default name of the MENU.MNU file -; - if sysmenu -ppass: - db 'SYSTEM ',0 ;system password - endif ;sysmenu -; -menufcb: - db 0 ;FCB for MENU.MNU - db 'MENU ' - db 'MNU' - ds 4 -scratch: ;this doubles as a scratch area - ds 16 ;buffer definition is at end of program - ds 4 ;36 bytes total - -; -; Start of Program -; -strt: -; -; Check for Shell Stack -; - call getsh2 ;get shell status - brnz strt0 ;skip over shell init - call eprint - db ' No Shell Stack',0 - ret -; -; See if Command Line Available -; -strt0: - call getcl1 ;get line - brnz strt01 - call eprint - db ' No Command Line',0 - ret -; -; See if this program was invoked as a shell -; -strt01: - call qshell ;find out from ZCPR3 environment - push psw ;save status - xra a ;A=0 - call putcst ;put command status (normal = 0) - pop psw ;restore status - jz menu ;do not push onto stack if invoked as a shell -; -; Set Name of Shell from External FCB if Possible or From Default if Not -; -setshn: - call retud ;get run address - lxi h,shdisk ;pt to shell disk - mov a,b ;get disk - adi 'A' ;convert to letter - mov m,a ;set disk letter - inx h ;pt to user 10's - mov a,c ;get user number - mvi b,10 ;subtract 10's - mvi d,'0' ;set char -setshn1: - sub b ;subtract - brc setshn2 - inr d ;increment digit - br setshn1 -setshn2: - add b ;get 1's - mov m,d ;set 10's digit for user - inx h ;pt to 1's digit - adi '0' ;compute 1's digit - mov m,a ;set 1's digit - call getefcb ;get ptr to external fcb - brz strt02 ;no external FCB, so use default name - inx h ;pt to program name - lxi d,shname ;pt to string - mvi b,8 ;8 chars - call moveb ;copy into buffer -; -; Check for File Name and Set It If Given -; -strt02: - lxi h,fcb+1 ;pt to file name - lxi d,menufcb+1 - mvi b,11 ;11 chars - mov a,m ;get first char - cpi ' ' - cnz moveb ;copy if one present -; -; Set File Name in MENUFCB into Line -; - lxi h,menufcb+1 ;set shell file name - lxi d,shfile ;pt to shell file - mvi b,8 ;8 chars -strt03: - mov a,m ;get next char - cpi ' ' ;done? - brz strt04 - stax d ;put char - inx d ;pt to next -strt04: - inx h ;pt to next - bjnz strt03 - mvi a,'.' ;put dot - stax d - inx d ;pt to next - mvi b,3 ;file type -strt05: - mov a,m ;copy - stax d - inx h ;pt to next - inx d - bjnz strt05 - xra a ;store zero - stax d - -; -; Set Menu Number -; - mvi b,1 ;shell message 1 - xra a ;menu 0 - call putshm ;set message - -; -; Push Name of Shell onto Stack -; - lxi h,shdisk ;pt to name of shell - call shpush ;push shell onto stack - brnz strt2 -; -; Shell Successfully Installed -; - call eprint - db ' Shell Installed',0 - ret -; -; Shell Stack Push Error -; -strt2: - cpi 2 ;shell stack full? - brnz strt3 -; -; Shell Stack is Full -; - call eprint - db ' Shell Stack Full',0 - ret -; -; Shell Stack Entry Size is too small for command line -; -strt3: - call eprint - db ' Shell Stack Entry Size',0 - ret -; -; Check for ZEX Execution and Pass ZEX if So -; -menu: - call getzrun ;is ZEX running? - brz runmenu ;process menu if not - br menuz1 ;skip new line -menuzex: - call crlf ;new line -menuz1: - call eprint - db 'Menu> ',0 - mvi a,1 ;tell ZEX that it is prompted - call putzex - call codend ;set up buffer - mvi m,ibufsz ;set size - mvi a,0FFH ;capitalize - call bline ;get line from ZEX - xra a ;A=0 - call putzex ;resume ZEX normally - call sksp ;skip over leading spaces - mov a,m ;check for comment - cpi ';' - brz menuzex - xchg ;DE pts to command line - xra a ;don't display command - sta cpflag - jmp runcmnd ;run command pted to by DE -; -; Begin Menu Processing -; -runmenu: - call eprint - db 'MENU Version ' - db (vers/10)+'0','.',(vers mod 10)+'0',0 -; -; Check for Wait Flag and Wait if So -; - mvi b,0 ;get shell message 0 - call getshm - ani 80h ;check for wait flag - cnz sak ;Strike Any Key -; -; Open Menu File -; - lxi h,fcb ;copy FCB into MENU FCB - lxi d,menufcb - mvi b,36 ;36 bytes - push d ;save ptr - call moveb - pop d ;pt to MENU.MNU FCB - call initfcb ;init fcb - call f$open ;open file - brz menu1 ;abort if no menu - call eprint - db CR,LF,' File ',0 - lxi d,menufcb+1 - call pfn1 - call eprint - db ' Not Found',0 - jmp shpop -; -; Load MENU.MNU from disk -; -menu1: - call codend ;get address of buffer for menu load -mload: - lxi d,menufcb ;pt to FCB - call f$read ;read in next block - ora a ;error? - brnz mloaddn ;load done if error - lxi d,tbuff ;copy from TBUFF into memory pted to by HL - xchg ;HL is source, DE is dest - mvi b,128 ;128 bytes - call hmovb - lhld bentry+1 ;get address of top of TPA - mov a,h ;set to bottom of ZCPR3 - sui 10 - cmp d ;about to overflow ZCPR3? - brnc mload1 ;continue if not - call eprint - db CR,LF,' TPA Full',0 - ret -mload1: - xchg ;HL pts to next byte to load to - br mload ;continue load - - -; -; Init Flags and Clear MSB of all bytes in Menu File -; -mloaddn: - call f$close ;close input file - mvi m,CTRLZ ;ensure EOF mark - lxi d,80H ;pt to next block - dad d - shld ibuff ;set ptr to input line buffer - mvi m,ibufsz ;set size - dad d ;allow 256 bytes - dad d - shld expline ;set ptr to expand line - xra a ;A=0 - sta cflag ;turn off command display - sta dflag ;turn off menu display - sta pflag ;disallow paging - sta cpmok ;turn off ZCPR3 return flag - call codend ;pt to beginning of file - push h ;save ptr -menul1: - mov a,m ;get byte - ani 7FH ;mask out MSB - mov m,a ;put byte - inx h ;pt to next - cpi CTRLZ ;EOF? - brnz menul1 ;continue if not -; -; Mark all Menu Sections -; - pop h ;HL pts to first byte of menu - mvi b,0FFH ;set menu counter -; -; Skip to Next Menu -; -menul2: - mov a,m ;get byte - cpi CTRLZ ;error? - jz mstrerr ;structure error if so - cpi MINDIC ;menu indicator (start of menu?) - brnz menul4 - ori 80H ;beginning of menu found -- set MSB - mov m,a ;put byte - inr b ;increment menu count - inx h ;pt to next - mov a,m ;get byte - cpi MINDIC ;menu indicator (end of menu?) - brz menul5 ;done if so - cpi CTRLZ ;error? - jz mstrerr -; - if sysmenu - cpi RSM ;system menu indicator? - brnz menul3 - mov a,b ;set system menu number - sta smeno - mvi a,0FFH ;set flag - sta smenfl ;system menu present - dcx h ;back up to beginning of menu - shld smenadr ;start address - inx h ;pt to RSM - endif ;sysmenu -; -; Skip out Menu Display -; -menul3: - call lskipt ;skip to beginning of next line - brz menul4 ;found menu indicator - cpi CTRLZ ;error? - jz mstrerr - br menul3 ;continue if not -; -; Skip to Next Menu -; -menul4: - call lskip ;skip to beginning of next menu - br menul2 -; -; Check Menu Options -; -menul5: - call codend ;pt to beginning of file - mov a,m ;check for option - cpi GOPTION ;global option char? - jnz mfile ;if no global option, scan for menu files - inx h ;pt to option char -option: - mov a,m ;get option char - call caps ;capitalize - inx h ;pt to next - cpi CR ;done? - brz optdn - cpi COPTION ;display command? - brz optc - cpi DOPTION ;display menu? - brz optd - cpi POPTION ;paging? - brz optp - cpi XOPTION ;exit OK? - jnz mstrerr ;option error if not -; -; Disable Exit to ZCPR3 -; - mvi a,0FFH ;turn flag off - sta cpmok - br option -; -; Process Paging Option -; -optp: - mvi a,0FFH ;set flag - sta pflag - br option -; -; Process Display Menu Option -; -optd: - mvi a,0FFH ;set flag - sta dflag - br option -; -; Process Display Command Option -; -optc: - mvi a,0FFH ;set flag - sta cflag - br option - -; -; Option Processing Done -; -optdn: - inx h ;skip LF - -; -; Check for Menu Display -; -mfile: - mov a,m ;get first byte - ani 7FH ;mask - cpi MINDIC ;start of menu? - jnz mstrerr - -; -; Check and Set First Menu -; - shld mstart ;save start address of first menu item - mvi m,MFIRST+80H ;set first char of first menu - -; -; Entry Point for Menu Display -; On entry, HL pts to first byte of current menu -; -dmenu: - mvi b,1 ;shell message 1 contains menu number - call getshm ;get menu number flag - cnz mchc0 ;skip to proper menu - shld cstart ;save start address of current menu - lda cflag ;copy display command flag for temp use - sta cpflag - lda dflag ;copy display menu flag for temp use - sta dpflag - lda pflag ;copy paging flag for temp use - sta ppflag - inx h ;pt to first char after menu indicator char -dispm1: - mov a,m ;get char - call caps ;capitalize - inx h ;pt to next - cpi CR ;end of options? - brz dispm2 -; - if sysmenu - cpi RSM ;system menu? - brz dispm1 ;ok if so - endif ;sysmenu -; - cpi COPTION ;command display? - brz dispmc - cpi DOPTION ;display? - brz dispmd - cpi POPTION ;paging? - brz dispmp - cpi XOPTION ;ZCPR3 return? - jnz mstrerr ;error if not -; -; Toggle ZCPR3 Return Option -; - lda cpmok ;get flag - cma ;toggle - sta cpmok - br dispm1 -; -; Toggle Paging Option -; -dispmp: - lda ppflag ;get flag - cma ;toggle - sta ppflag - br dispm1 -; -; Toggle Display Menu Option -; -dispmd: - lda dpflag ;get flag - cma ;toggle - sta dpflag - br dispm1 -; -; Toggle Display Command Option -; -dispmc: - lda cpflag ;get flag - cma ;toggle - sta cpflag - br dispm1 -; -; Done with Menu-Specific Option Processing -; -dispm2: - call lskip ;skip to LF - lda dpflag ;display menu? - ora a ;0=no - brz dispm8 ;skip over menu if not - call getnlines ;get line count in A - sta pagcnt ;set count - lda ppflag ;paging? - ora a ;0=no - push psw ;save flag - cnz cls ;clear screen if so - pop psw ;get flag - cz crlf ;else new line -; -; Print Next Line of Menu if not Starting with ESCAPE Char (MINDIC) -; -dispm3: - mov a,m ;get first char of line - ani 7FH ;mask - cpi MINDIC ;done? - brz dispm4 - call expand ;expand line pted to by HL - push h ;save ptr to next line - xchg ;HL pts to expanded line - call lprintx ;print line pted to by HL ending in - pop h ;pt to next line - br dispm3 -; -; Done with Menu Display -- Page it out -; -dispm4: - call lskip ;skip to first char of next line (option char) - shld optstrt ;set start address of options - lda pagcnt ;number of remaining lines - mov b,a ;count in B - ora a ;ok? - brz dispm6 ;don't do anything if already there - lda ppflag ;page? - ora a ;0=No - brz dispm6 -; -; Page Loop for Menu Display -; -dispm5: - call crlf ;new line - bjnz dispm5 -; -; Determine if Another Menu Follows -; -dispm6: - xra a ;A=0 - sta nmenfl ;set for no next menu - mov a,m ;ok? - ani 7FH ;mask - cpi CTRLZ ;error if EOF - jz mstrerr - cpi MINDIC ;next menu? - brnz dispm7 - inx h ;double indicator if end - mov a,m - cpi MINDIC ;end? - brz dispm9 -; - if sysmenu - cpi RSM ;system menu = no next menu - brz dispm9 - endif ;sysmenu -; - mvi a,0FFH ;set next menu - sta nmenfl - br dispm9 -dispm7: - call lskip ;skip to next line - br dispm6 - -; -; Skip over current menu so it is not displayed -; -dispm8: - call lskipt ;skip to beginning of command - brnz dispm8 - call lskip ;skip over end of display indicator - shld optstrt ;set pointer to options - br dispm6 ;determine if next menu available -dispm9: - -; -; Ready for Option Input -; The following Flags/Values are now set: -; CPFLAG -- Display Command Flag (0=No, 0FFH=Yes) -; DPFLAG -- Display Menu Flag (0=No, 0FFH=Yes) -; OPTSTRT -- Address of First Menu Option -; NMENFL -- 0 if no next menu, 0FFH if next menu -; MSTART -- Start Address of MINDIC Before Menu Display -; (MSTART)=MFIRST with MSB Set -prompt: - call stndout ;begin standout - mvi a,0ffh - sta pagcnt ;turn off paging - sta dpflag ;turn on future menu displays - call retud ;get DU - mov a,b ;print D - adi 'A' - call cout - mov a,c ;print U - call pafdc - call eprint - db '> Command (CR=Menu',0 - lda cpmok ;OK to return to ZCPR3? - ora a ;0=No - cnz prmptc - lhld cstart ;pt to first char - mov a,m ;get it - ani 7FH ;mask - cpi MFIRST - cnz prmptf ;print previous menu prompt if not first menu - lda nmenfl ;next menu available? - ora a ;0=No - cnz prmptn ;print next menu prompt - call eprint - db ') - ',0 - call stndend ;end standout -prompt1: - call cin ;get response - call caps ;capitalize - mov b,a ;result in B - -; -; Check for CR -; - cpi CR ;? - jz dispm2 ;reprint menu if so - -; -; Check for Reboot -; - lda cpmok ;ok to abort? - ora a ;0=No - brz prmpt0 - mov a,b ;get command - cpi CTRLC ;reboot? - jz shpop ;pop shell stack and return to OS if so - -; -; Check for Command to Return to First Menu -; -prmpt0: - mov a,m ;get it - ani 7FH ;mask - cpi MFIRST - brz prmpt1 - mov a,b ;get command - cpi RFM ;return to first menu? - brnz prmpt1 - lhld mstart ;pt to first menu - mvi b,1 ;shell message 1 is menu number - xra a ;A=0=menu 0 - jmp putshm ;reenter shell at first menu - -; -; Check for Command to go to Next Menu -; -prmpt1: - lda nmenfl ;next menu available? - ora a ;0=No - brz prmpt2 - mov a,b ;get command - cpi RNMP ;goto next menu? - brz rnmx - cpi RNM ;goto next menu? - brnz prmpt2 -rnmx: - mvi b,1 ;shell message 1 is menu number - call getshm ;increment menu number - inr a - jmp putshm ;reenter menu system at new menu - -; -; Check for Command to go to Last Menu -; -prmpt2: - mov a,m ;get menu char - ani 7FH ;at first menu? - cpi MFIRST - brz prmpt3 ;skip if at first menu - mov a,b ;get command - cpi RLMP ;goto last menu? - brz lstmnu - cpi RLM ;goto last menu? - brnz prmpt3 -lstmnu: - mvi b,1 ;shell message 1 is menu number - call getshm ;decrement menu number - dcr a - jmp putshm ;reenter shell at last menu - -; -; Check for Command to goto System Menu -; -prmpt3: - if sysmenu -; - lda smenfl ;system menu available? - ora a ;0=No - brz prmpt4 - mov a,b ;get command - cpi RSM ;system menu? - brnz prmpt4 - call password ;prompt for and get password - jnz prompt ;reprompt if error - lhld smenadr ;get address of system menu - lda smeno ;set system menu number - mvi b,1 ;shell message 1 is menu number - jmp putshm ;reenter shell at system menu -; - endif ;sysmenu -; -; This is where additional functions may be added -; -prmpt4: - -; -; Check for Option Letter -; - lhld optstrt ;pt to first option char -prmptx: - mov a,m ;get it - call caps ;capitalize - cpi MINDIC ;at next menu? - brz prmpter - cmp b ;match user selection? - brz prmptd - call lskip ;skip to next line - br prmptx - -; -; Invalid Option -; -prmpter: - call eprint - db BEL,0 - jmp prompt1 - -; -; Process Option -; -prmptd: - mov a,b ;output user selection - call cout - mvi b,0 ;shell message 0, bit 7 = wait flag - call getshm - ani 7FH ;set no wait - call putshm - inx h ;pt to first letter of command - mov a,m ;get it - cpi MCMD ;invoke other menu? - jz mchcmd ;menu change command - cpi WOPTION ;turn on wait? - brnz prmptg - mvi b,0 ;shell message 0, bit 7 = wait flag - call getshm - ori 80h ;set wait flag - call putshm ;set shell message - inx h ;skip option char -prmptg: - call expand ;expand line, DE pts to result -; -; Run Command Pted to by DE -; -runcmnd: - call getcl1 ;get address of command buffer - mov b,h ;... in BC also - mov c,l - mvi a,4 ;HL=HL+4 for address of first char - add l - mov l,a - mov a,h - aci 0 - mov h,a - mov a,l ;store address - stax b - inx b - mov a,h - stax b -; -; Copy Command Line in DE into Buffer in HL -; -cmdcpy: - ldax d ;get command letter - call caps ;capitalize it - ora a ;done? - brz ccpyd - cpi CR ;done? - brz ccpyd - cpi PCHAR ;prompt? - brz ccpyp - mov m,a ;store it - inx h ;pt to next - inx d - br cmdcpy -ccpyd: - mvi m,0 ;store ending 0 - jmp cmddisp ;optionally display command -; -; Prompt User for Input and Accept It -; -ccpyp: - inx d ;pt to first char of prompt - call crlf ;new line -ccpyp1: - ldax d ;get char - cpi PCHAR ;end of prompt? - brz ccpyp2 - cpi CR ;new line? - brz ccpyp3 - call cout ;echo char - inx d ;pt to next char - br ccpyp1 ;continue looping -ccpyp2: - inx d ;pt to char after closing PCHAR -ccpyp3: - push d ;save ptr to next char - xchg ;DE pts to buffer - mvi a,0FFH ;capitalize input from user - lhld ibuff ;input line buffer - call bline ;get input from user - xchg ;HL pts to buffer, DE pts to user input -cmdlp: - ldax d ;get char from user - ora a ;end of input? - brz cmdlp1 ;store rest of line - mov m,a ;store char - inx h ;pt to next - inx d - br cmdlp -cmdlp1: - pop d ;DE pts to next char, HL pts to buffer - br cmdcpy ;resume copying -; -; Check for Display of Loaded Command and Do So if Set -; -cmddisp: - lda cpflag ;display command? - ora a ;0=No - rz ;return to OS if so to run command - call crlf ;new line - call getcl1 ;pt to first char - mov e,m ;get low-order address - inx h - mov d,m ;get high-order address - xchg ;HL pts to first char -cmdd1: - mov a,m ;get char - cpi CMDSEP ;done if command separator - rz - inx h ;pt to next - call cout ;print char - br cmdd1 - -; -; Menu Change Command -- Jump to Specified Menu -; -mchcmd: - inx h ;pt to menu number - call eval ;convert to decimal number in A - sta menuno ;save menu number - call mchc0 ;skip to desired menu to check for it - lda menuno ;get menu number - mvi b,1 ;menu number is shell message 1 - jmp putshm ;set message and reenter shell - -; -; Entry Point if MENU is Reinvoked -; -mchc0: - mov b,a ;menu number in B - inr b ;add 1 for initial offset - lhld mstart ;pt to first menu -mchc1: - dcr b ;count down - rz ;done if found -mchc2: - call lskipt ;skip to next line - brnz mchc2 ;continue if not end of menu display -mchc3: - call lskipt ;skip to next line - brnz mchc3 ;continue if not at end of menu commands - inx h ;end of MENU.MNU? - mov a,m ;yes if double MINDIC - ani 7FH ;mask - cpi MINDIC - brz mchcerr ;error if so - dcx h ;pt to first char - br mchc1 ;continue -; -; Premature End of Menu File -; -mchcerr: - pop psw ;clear stack - jmp mstrerr ;menu structure error - -; -; Print Line pted to by HL Ending in -; Decrement PAGCNT -; -lprintx: - call lprint ;print without - jmp crlf ;do -; -; Print Line Pted to by HL; Decrement PAGCNT -; -lprint: - mvi b,0 ;set tab counter -lprnt0: - mov a,m ;get char - inx h ;pt to next - ani 7FH ;mask MSB - cpi DIM ;goto standout mode? - brz lprnt3 - cpi NOTDIM ;end standout mode? - brz lprnt4 - cpi TAB ;tabulate? - brz lprnt2 - cpi CR ;done? - brz lprnt1 - call cout ;print - inr b ;incr tab counter - br lprnt0 -lprnt1: - inx h ;pt to first char of next line - lda pagcnt ;count down pages - dcr a - sta pagcnt - rnz - call getnlines ;get line count in A - sta pagcnt - call eprint - db CR,LF,'Pause -',0 - br sak1 -lprnt2: - mvi a,' ' ;print - call cout - inr b ;incr tab counter - mov a,b ;done? - ani 7 ;every 8 - brnz lprnt2 - br lprnt0 -lprnt3: - call stndout ;enter standout mode - br lprnt0 -lprnt4: - call stndend ;end standout mode - br lprnt0 -; -; Strike Any Key Message -; -sak: - mvi b,0 ;clear any pending wait - call getshm - ani 7FH ;mask MSB - call putshm -sak1: - call stndout ;goto standout - call eprint - db ' Strike Any Key - ',0 - call stndend ;exit standout - call cin ;get response - call crlf ;new line - ret - -; -; Prompt for, input, and check password (only one chance) -; If accepted, return with Zero Flag Set; if not, return with NZ -; - if sysmenu -password: - call eprint - db CR,LF,'Pass? ',0 - lhld ibuff ;pt to input line buffer - xra a ;don't capitalize user input - call bline ;get line from user - lxi d,ppass ;pt to system password -pass1: - ldax d ;get sys pass char - cmp m ;ok? - brnz passerr ;error if no match - inx h ;pt to next - inx d - ora a ;end of strings? - brnz pass1 - ret ;return with zero set to show match -passerr: - call eprint - db CR,LF,' Password Error',0 - call sak1 ;strike any key - call crlf - mvi a,0FFH ;set no zero - ora a - ret - endif ;sysmenu -; -; Skip to Beginning of Next Line and Test First Char for Menu Indicator -; -lskipt: - call lskip ;skip - mov a,m ;get char - ani 7FH ;mask - cpi MINDIC ;test - ret - -; -; Skip to Beginning of Next Line -; -lskip: - mov a,m ;get char - ani 7FH ;mask out MSB - inx h ;pt to next - cpi LF - brnz lskip - ret - -; -; Print ZCPR3 Return Prompt -; -prmptc: - call eprint - db ', ^C=Z3',0 - ret -; -; Print First/Last Menu Chars -; -prmptf: - call eprint - db ', ',RFM,'=1st Menu, ',RLM,'=Prev Menu',0 - ret -; -; Print next menu message -; -prmptn: - call eprint - db ', ',RNM,'=Next Menu',0 - ret - -; -; Menu Structure Error -- FATAL -; This message is printed to indicate an error in the structure of -; the MENU.MNU file. -; -mstrerr: - call eprint - db CR,LF,' Structure Error',0 - jmp shpop - -; -; Expand Line Pted to by HL into Scratch Area -; Return with HL pting to next line, DE pting to current line -; -expand: - xchg - lhld expline ;pt to buffer - xchg -exp1: - mov a,m ;get next char - ani 7fh ;mask MSB - stax d ;store char - cpi CR ;end of line? - jz expx - inx h ;pt to next - inx d - cpi VARFLAG ;variable follows? - brnz exp1 -; -; Variable Identified - Process it -; - mov a,m ;get next char - inx h ;pt to next - cpi VARFLAG ;one variable char? - brz exp1 ;resume if double VARFLAG - dcx d ;pt to variable position - call caps ;capitalize variable - cpi 'D' ;current disk? - brz expdisk - cpi 'U' ;current user? - brz expuser - cpi 'F' ;filename.typ? - brz expfile - cpi 'N' ;filename? - brz expname - cpi 'T' ;filetype? - brz exptype - br exp1 ;resume expansion -; -; Expand Exit -; -expx: - inx h ;pt to line feed - mov a,m ;get it - cpi LF ;line feed? - brnz expx1 - inx h ;pt to char after line feed -expx1: - xchg ;DE pts to next line - lhld expline ;pt to expanded line - xchg ;HL pts to next line, DE pts to expanded line - ret - -; -; Expand Disk -; -expdisk: - call retud ;get disk in B - mov a,b ;get disk number (A=0) - adi 'A' ;convert to ASCII - stax d ;store letter - inx d ;pt to next - br exp1 ;resume expansion -; -; Expand User -; -expuser: - call retud ;get user in C - mov a,c ;get user number - mvi b,10 ;subtract 10's - mvi c,'0' ;set char -expu1: - sub b ;-10 - brc expu2 - inr c ;increment digit - br expu1 -expu2: - add b ;+10 - adi '0' ;convert 1's to ASCII - mov b,a ;B=1's - mov a,c ;get 10's - stax d ;store 10's - inx d - mov a,b ;get 1's - stax d ;store 1's - inx d ;pt to next - br exp1 ;resume -; -; Expand File -; -expfile: - call getfnum ;get file number - jz exp1 ;resume if error - push h ;save ptr to next char - call ptfn ;set ptr to file name - call putn ;put file name - mvi a,'.' - stax d ;store dot - inx d ;pt to next - call putt ;put file type - pop h ;restore ptr - jmp exp1 ;resume -; -; Expand Name -; -expname: - call getfnum ;get file number - jz exp1 ;resume if error - push h ;save ptr to next char - call ptfn ;set ptr to file name - call putn ;put file name - pop h ;restore ptr - jmp exp1 ;resume -; -; Expand Type -; -exptype: - call getfnum ;get file number - jz exp1 ;resume if error - push h ;save ptr to next char - call ptfn ;set ptr to file name - mvi a,8 ;add 8 - add l - mov l,a - mov a,h - aci 0 - mov h,a - call putt ;put file type - pop h - jmp exp1 ;resume -; -; Pt to File Name whose Number (1-4) is in A -; -ptfn: - mov b,a ;get number in B - call getfn2 ;pt to file name 2 - push d ;save DE - mov a,b ;file 0? - ora a - brz ptfnx - lxi d,11 ;size of file name and type -ptfn1: - dad d ;pt to next - bjnz ptfn1 -ptfnx: - pop d ;restore DE - ret -; -; Put File Name pted to by HL -; -putn: - mvi b,8 ;8 chars - br putc -; -; Put File Type pted to by HL -; -putt: - mvi b,3 ;3 chars -; -; Copy Chars from HL to DE for up to B bytes -- flush if space -; -putc: - mov a,m ;get next char - cpi ' ' ;skip spaces - brz putc1 - stax d ;put next char - inx d ;pt to next -putc1: - inx h ;pt to next - bjnz putc - ret - -; -; Get File Number (1 to 4) -; If valid number, return with value in A and HL pting to next char -; If not valid, return with Z and HL pting to last char (F, N, T) -; -getfnum: - mov a,m ;get char - sui '1' ;convert - brc getfne ;error - cpi 4 ;range? - brnc getfne - inx h ;pt to next char - ret ;NZ from CPI 4 -getfne: - dcx h ;error return - xra a - ret - -; -; Return Number of Lines on CRT in A -; -getnlines: - push h ;save HL - call getcrt ;get CRT info - inx h ;pt to number of lines - mov a,m ;get count - pop h ;restore HL - dcr a ;subtract 1 for footer - ret - -; -; Convert char string pted to by HL into decimal number in A -; On Entry, HL pts to first digit char -; On Exit, HL pts to after last digit char and A=number -; -eval: - push b ;save BC - mvi b,0 ;set value -eval1: - mov a,m ;get digit - sui '0' ;convert to binary - brc eval2 - cpi 10 ;range? - brnc eval2 - inx h ;pt to next digit - mov c,a ;new digit in C - mov a,b ;multiply B by 10 - add a ;*2 - add a ;*4 - add b ;*5 - add a ;*10 - add c ;add in new digit - mov b,a ;result in B - br eval1 -eval2: - mov a,b ;result in A - pop b ;restore ptr - ret - -; -; These buffers overlay the scratch area to save space -; -optstrt equ scratch ;Address of First Option in Current Menu -mstart equ optstrt+2 ;Address of First Menu -cstart equ mstart+2 ;Address of Current Menu -smenfl equ cstart+2 ;System Menu Available Flag (0=No) -smeno equ smenfl+1 ;System Menu Number -smenadr equ smeno+1 ;Address of First Byte of System Menu -nmenfl equ smenadr+2 ;Next Menu Available Flag (0=No) -menuno equ nmenfl+1 ;Number of Menu -pagcnt equ menuno+1 ;Paging Counter -cflag equ pagcnt+1 ;Display Command Line Flag -dflag equ cflag+1 ;Display Menu Flag -pflag equ dflag+1 ;Paging Flag - -; -; Buffers -; -ibuff: - ds 2 ;input line buffer -expline: - ds 2 ;scratch area to expand lines in -cpflag: - ds 1 ;Temp Display Command Line Flag -dpflag: - ds 1 ;Temp Display Menu Flag -ppflag: - ds 1 ;Temp Paging Flag -cpmok: - ds 1 ;OK to Return to ZCPR3 (0=No) -tnum: - ds 41 ;space for chars and ending 0 -shdisk: - db 'A' ;disk to return to - db '00' ;user to return to - db ':;' ;log in and next command -shname: - db 'MENU ' ;program name (filled in at installation) -shfile: - ds 13 ;file name (12) and ending 0 - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/MENUCK.COM b/Source/Images/d_bp/u15/MENUCK.COM deleted file mode 100644 index 73eda193..00000000 Binary files a/Source/Images/d_bp/u15/MENUCK.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/MENUCK.MAC b/Source/Images/d_bp/u15/MENUCK.MAC deleted file mode 100644 index 747fb53b..00000000 --- a/Source/Images/d_bp/u15/MENUCK.MAC +++ /dev/null @@ -1,546 +0,0 @@ -; -; PROGRAM: MENUCK -; AUTHOR: RICHARD CONN -; VERSION: 1.0 -; DATE: 18 May 84 -; PREVIOUS VERSIONS: None -; DERIVATION: MCHECK 1.1 (6 Jan 83) -; -VERS EQU 10 ;VERSION NUMBER -z3env SET 0f400h - -; -; MENUCK is used to check the syntax of a MENU.MNU file for the ZCPR3 -; menu processor, MENU. MENU was optimized for size and runtime speed, and -; I tried to keep the size under 2K (and succeeded, for that matter). In -; keeping MENU small, the error diagnostics it gives are quite limited, with -; a variety of errors producing the message "Str Err" for MENU.MNU -; structure error. -; -; MENUCK is intended to be used to check the syntax and other features -; of a user's MENU.MNU before allowing MENU to run with it. In this way, -; many errors may be caught before the MENU.MNU file comes into common use, -; and there is plenty of space for informative diagnostics. -; - -; -; MENU Constants -; -MCMD EQU ':' ;Menu Jump Command -RSM EQU '$' ;System Menu Indic -MINDIC EQU '#' ;Menu Indic -GOPTION EQU '-' ;Global Option Indic -COPTION EQU 'C' ;Option chars -DOPTION EQU 'D' -POPTION EQU 'P' -XOPTION EQU 'X' -VARFLAG EQU '$' ;Variable Flag - -; -; CP/M Constants -; -bentry equ 5 ;BDOS Entry -fcb equ 5ch ;FCB -tbuff equ 80h ;Temp I/O Buffer -cr equ 0dh -lf equ 0ah -EOF equ 'Z'-'@' ;^Z=EOF - -; -; Externals -; - ext z3init,zfname,z3log - - ext caps,crlf,eval10,retud - ext f$open,f$close,f$read - ext print,cout - ext moveb - ext phldc,padc,pfn2,pafdc - ext codend - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - - call print - db 'MENUCK Version ' - db (vers/10)+'0','.',(vers mod 10)+'0',0 - - lda fcb+1 ;get first char - cpi ' ' ;no file name? - jz help - cpi '/' ;option? - jnz start1 -; -; Print Help Message -; -help: - call print - db cr,lf,'Syntax:' - db cr,lf,' MENUCK dir:filename.typ <-- Check File' - db cr,lf,' MENUCK dir:filename <-- Check filename.MNU' - db 0 - ret - -; -; Begin serious processing -- locate the file pted to by HL -; -start1: - lxi d,fcb ;pt to FCB - call z3log ;log into indicated FCB - -; -; Set File Type to MNU if not specified -; -start2: - lxi h,fcb+9 ;pt to file type - mov a,m ;get first char - cpi ' ' ;set type if - jnz start3 - push b ;save BC - lxi d,mnutyp ;set type to MNU - xchg - mvi b,3 ;3 bytes - call moveb - pop b ;get BC -; -; Try to Open the File -; -start3: - lxi d,fcb ;prepare to open file - xra a ;A=0 to select current disk - stax d - call f$open ;open file - jz readfile ;read in file if OK - call print - db cr,lf,' File Not Found',0 - ret -; -; Read in File -; -readfile: - call codend ;get address of first block -readloop: - lxi d,fcb ;read block - call f$read ;do it - ora a ;check for error - jnz readdone - lxi d,tbuff ;pt to block just read in - mvi b,128 ;128 bytes -readmove: - ldax d ;get byte - ani 7fh ;mask MSB - mov m,a ;put byte - inx h ;pt to next - inx d - dcr b ;count down - jnz readmove - xchg ;DE pts to next block - lhld bentry+1 ;get address of BDOS - mov a,h ;check for possible overflow - sui 10 ;10 pages below BDOS is limit - cmp d ;within range? - xchg ;HL pts to next block - jnc readloop ;continue read if within range - call print - db cr,lf,' TPA Overflow -- MENU File is Too Big',0 - ret -; -; Read is Done -- Store Ending ^Z and Set Initial Values -; -readdone: - mvi m,EOF ;Store ^Z to ensure EOF - lxi d,fcb ;Close File - call f$close - mvi a,0ffh ;A = -1 - sta menunum ;set menu number - sta maxnum ;set max number of all menus - lxi h,0 ;HL=0 - shld errors ;Set Error Count to 0 - inx h ;HL=1 - shld linenum ;Set Line Number to 1 -; -; Count Number of Menus -; - call codend ;Pt to First Byte - mov a,m ;get first byte -; -; Skip to Beginning of Menu Display -; -mdskip: - cpi EOF ;EOF? - jz mdone - cpi MINDIC ;beginning of display? - jz mcgo ;now go skip commands - call lskip ;skip to next line - jmp mdskip -mcgo: - inx h ;pt to char after MINDIC - mov a,m ;another MINDIC? - cpi MINDIC - jz mdone ;done if 2 in a row - lda maxnum ;get menu number count - inr a ;found another one - sta maxnum -mcskip: - call lskip ;skip to next line - jz mdone ;done if premature EOF - cpi MINDIC ;end of display? - jnz mcskip - inx h ;pt to char after MINDIC - mov a,m ;get it - jmp mdskip -; -; Check for Valid First Character -; -mdone: - call print - db cr,lf,'Menu Syntax Check on ',0 - call retud ;get dir - mov a,b ;get disk - adi 'A' - call cout - mov a,c ;get user - call pafdc - mvi a,':' - call cout - lxi d,fcb+1 ;pt to FCB - call pfn2 - call print ;Print Header - db cr,lf - db cr,lf,' Line Comment/Error Message' - db cr,lf,' ---- ---------------------',0 - - xra a ;set no global option - sta gopt - call codend ;get address of first byte - mov a,m ;get first char - cpi GOPTION ;global options? - jnz newmenu ;process globals - mvi a,0ffh ;set global option - sta gopt - call lprint - db '** Global Options Detected **',0 - call optchk ;check options - xra a ;set no global option - sta gopt - call nxtline ;advance to next line -; -; This is the main entry point for processing a menu -; -newmenu: - mov a,m ;get Menu Indicator - cpi MINDIC ;must be MINDIC - jz nm1 - call newerr ;add to error count - call lprint - db ' New Menu Expected, But ',MINDIC,' NOT Found -- ' - db 'Aborting',0 - jmp errxit -; -; Print that we have a new menu -; -nm1: - call lprint - db '** Menu Number ',0 - lda menunum ;increment menu number - inr a - sta menunum - call padc - call optchk ;check options -; -; Skip Thru Display -; -nm2: - call nxtline ;skip to next line - jnz nm2a ;continue if no EOF -earlyeof: - call newerr ;add to error count - call lprint - db ' Premature EOF Encountered',0 - jmp errxit -nm2a: - cpi MINDIC ;Menu Indicator? - jnz nm2 ;Continue -; -; Move Thru Menu Commands -; -nm3: - call mcmd1 ;check Menu Command Line - jz earlyeof - call lcheck ;check line - cpi MINDIC ;check for menu indicator - jnz nm3 ;continue until menu indicator encountered - inx h ;check for 2 indicators in a row for end - mov a,m ;get 2nd char - dcx h ;back up in case it is not - cpi MINDIC ;2 in a row? - jnz newmenu ;process as new menu if not -errxit: - call lprint - db '** End of Menu Check **',cr,lf,' ',0 - lhld errors ;check error count - mov a,h ;check for Zero - ora l - jnz err1 - call print - db 'No',0 - jmp err2 -err1: - call phldc ;print as decimal -err2: - call print - db ' Errors Detected',0 - ret - -; -; Utilities -; - -; -; LPRINT -- Print "Line # "+text -; -lprint: - call crlf ;new line - push h ;save HL - lhld linenum ;get line number - call phldc ;print as decimal - pop h ;restore HL - mvi a,' ' ;print - call cout - jmp print ;print text -; -; NXTLINE -- Advance to next line, check for EOF, and increment Line Number -; LSKIP -- Advance to next line and check for EOF -; Return with HL pting to first char of next line and Z Set if EOF -; -nxtline: - push h ;increment line count - lhld linenum ;add 1 - inx h - shld linenum - pop h ;fall thru to skipping -lskip: - mov a,m ;get char - cpi EOF ;EOF? - rz - inx h ;pt to next - cpi lf ;line feed? - jnz lskip ;continue if not - mov a,m ;get first char of next line - cpi EOF ;check for EOF - ret -; -; MCMD1 -- Check Menu Line, check for EOF, and increment Line Number -; Return with HL pting to first char of next line and Z Set if EOF -; -mcmd1: - mov a,m ;get char - cpi EOF ;EOF? - jz mcmdx - inx h ;pt to next - cpi VARFLAG ;variable? - jz mcmd2 - cpi lf ;line feed? - jnz mcmd1 ;continue if not -mcmdx: - push h ;increment line count - lhld linenum ;add 1 - inx h - shld linenum - pop h ;fall thru to skipping - mov a,m ;get first char of next line - cpi EOF ;check for EOF - ret -; -; Check Variable -; -mcmd2: - mov a,m ;get char - ani 7fh ;mask - call caps ;capitalize - inx h ;pt to next - cpi VARFLAG ;OK if double VARFLAG - jz mcmd1 - cpi 'D' ;OK if D - jz mcmd1 - cpi 'U' ;OK if U - jz mcmd1 - cpi 'F' ;filename.typ? - jz mcmd3 - cpi 'N' ;filename? - jz mcmd3 - cpi 'T' ;filetype? - jz mcmd3 -; -; Invalid Variable -; - dcx h ;pt to previous (bad char) - push psw ;save char - call lprint - db ' Variable Error (Not $, D, U, F, N, or T) - ',0 - pop psw ;get char - call cout ;print it - call newerr ;increment error count - jmp mcmd1 -; -; Digit from 1 to 4 should follow -; -mcmd3: - mov a,m ;get next char - inx h ;pt to next - ani 7fh ;mask and cap - call caps - cpi '1' ;must be from 1 to 4 - jc mcmd4 - cpi '5' - jc mcmd1 -; -; Invalid Digit -; -mcmd4: - dcx h ;pt to offending char - push psw - call lprint - db ' Invalid Digit for F, N, or T Variable (not 1-4) - ',0 - pop psw - call cout - call newerr ;increment error count - jmp mcmd1 - -; -; OPTCHK -- Check Line Pted to by HL for Valid GOPTION and MINDIC options -; Do Not Affect HL -; Print Error Message and Character if Invalid Option Found -; -optchk: - push h ;save HL - push b - inx h ;skip indicator -optclp: - mov a,m ;get char - call caps ;capitalize - inx h ;pt to next - cpi cr ;EOL? - jz optcdn - mov b,a ;char in B - lda gopt ;global option? - ora a ;0=no - mov a,b ;get char - jnz optcl1 ;skip RSM test if it is global - cpi RSM ;System Menu? - jz optclp -optcl1: - cpi COPTION ;check options - jz optclp - cpi DOPTION - jz optclp - cpi POPTION - jz optclp - cpi XOPTION - jz optclp - call newerr ;increment error count - call lprint - db ' Invalid Option: ',0 - mov a,b ;get char - call cout ;print char - jmp optclp -optcdn: - pop b - pop h ;restore ptr - ret -; -; Increment Error Count -; -newerr: - push h ;save HL - lhld errors ;increment error count - inx h - shld errors - pop h ;restore HL - ret -; -; Check Line, especially looking for Menu Jump -; -lcheck: - push h ;save ptr to first char - inx h ;pt to 2nd char - mov a,m ;get it - cpi MCMD ;menu jump? - jnz lchk1 - inx h ;pt to menu number - call eval10 ;convert to binary in DE - mov a,d ;D must be 0 - ora a ;check - jz lchk0 -lchker: - call newerr ;increment error count - call lprint - db ' Menu Number Out of Range',0 - jmp lchk1 -lchk0: - lda maxnum ;get max menu number - cmp e ;check for range - jc lchker -lchk1: - pop h ;restore ptr - mov a,m ;get first char in line - ret -; -; Skip HL over Blanks -; -sblank: - mov a,m ;get char - inx h ;pt to next - cpi ' ' ;blank? - jz sblank ;continue skipping - dcx h ;pt to non-blank - ret - -; -; Buffers -; -mnutyp: - db 'MNU' -errors: - ds 2 ;error count -linenum: - ds 2 ;current line number -menunum: - ds 1 ;current menu number -maxnum: - ds 1 ;max menu number -gopt: - ds 1 ;global option flag - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/MKDIR.COM b/Source/Images/d_bp/u15/MKDIR.COM deleted file mode 100644 index de53d4a6..00000000 Binary files a/Source/Images/d_bp/u15/MKDIR.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/MKDIR.MAC b/Source/Images/d_bp/u15/MKDIR.MAC deleted file mode 100644 index 8bd33108..00000000 --- a/Source/Images/d_bp/u15/MKDIR.MAC +++ /dev/null @@ -1,1020 +0,0 @@ -; -; Program: MKDIR -; Author: Richard Conn -; Version: 3.2 -; Date: 20 Nov 84 -; Previous Versions: 3.1 (28 Aug 84), 3.0 (5 Mar 84) -; -version equ 32 - -; -; MKDIR is used to edit existing named directory files and to -; create new ones. -; - -; -; Basic Equates -; -z3env SET 0f400h ;address of ZCPR3 Environment -; -fcb equ 5ch -tbuff equ 80h -cr equ 0dh -lf equ 0ah - -; -; SYSLIB Routines -; - ext print,putud,getud,logud,retud,zfname,getenv - ext cout,crlf,compb,capine,pfn1 - ext f$open,f$read,f$close - ext f$make,f$write,initfcb,f$delete,f$exist,gfa - ext bbline,padc,codend,sksp - ext hmovb,hfilb - ext sort - ext z3init,getndr,getwhl - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env -; -; Print Banner -; - call print ;check quiet flag - db 'MKDIR, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db cr,lf,0 -; -; Check for Wheel Powers -; - call getwhl ;get wheel byte - jnz ndir0 - call print - db ' Permission to Run MKDIR Denied - Not Wheel',0 - ret -; -; Check for Availability of Named Directory -; -ndir0: - call getndr ;get location of directory - jnz ndir1 - call print - db ' Named Directory Buffer Not Available',0 - ret -ndir1: - xra a ; A=0 - sta chflag ; set no changes - sta flflag ; set no file loaded - sta ecount ; set no entries - lda fcb+1 ; check for help - cpi '/' - jnz start1 - call print ; print help message - db cr,lf,' MKDIR is used to read and edit named directory files.' - db cr,lf,'It is invoked by the following forms --' - db cr,lf - db cr,lf,' MKDIR <-- Enter System' - db cr,lf,' MKDIR dir:filename.typ <-- Define File First' - db cr,lf,' MKDIR // <-- Print this Help' - db cr,lf,0 - ret - -start1: - call putud ; save current dir for quick return - lxi h,dnfile ; set default file name - lxi d,dfcb+1 ; copy into fcb - mvi b,11 ; 11 chars - call hmovb - lxi h,fcb+1 ; pt to fcb - mov a,m ; get name - cpi ' ' ; no entry? - jz mkdir ; enter system - dcx h ; pt to name - lxi d,dfcb ; store name in DFCB - mvi b,16 ; copy 16 chars - call hmovb - jmp loadf0 ; enter load file - -; -; Main Entry Point for Loading a File -; -loadfile: - lxi d,dfcb ; set up default file name - call zfname ; extract info -loadf0: - call retud ; get UD in CB - lda dfcb ; get disk - ora a ; current? - jz loadf1 - dcr a ; A=0 - mov b,a ; disk in B -loadf1: - lda dfcb+13 ; get user - mov c,a ; in C - call logud ; log into UD to begin search -; -; Entry Point for Loading File in DFCB -; -ffile: - lxi d,dfcb ; pt to FCB - call initfcb ; init it - call f$open ; try to open file - jz ffile1 - call print - db cr,lf,'File ',0 - lxi d,dfcb+1 ; print name - call pfn1 - call print - db ' Not Found',0 - jmp mkdir -ffile1: - call getnd ; get max size of file - mov b,a ; ... in B - inr b ; add 1 for overflow - call codend ; pt to scratch buffer -readf: - lxi d,dfcb ; pt to FCB - call f$read ; read next block - jnz readd ; done if EOF - push b ; save count - mvi b,128 ; copy 128 bytes - lxi d,tbuff ; ... from TBUFF - xchg - call hmovb - xchg ; HL pts to next block to copy into - pop b ; get count - dcr b ; count down - jnz readf - call print - db cr,lf,'Named Directory File too Large for System',0 - call getud ; return home - jmp mkdir ; reset parameters -readd: - call f$close ; close file - call getud ; return home -; -; Fill in empty space at end of buffer -; -readd1: - mov a,b ; get count - cpi 1 ; done? - jz readd2 - push b ; save count - mvi b,128 ; fill 128 bytes with 0 - xra a - call hfilb - pop b ; get count - dcr b ; count down - jmp readd1 -readd2: - mvi a,0ffh - mov m,a ; set EOF mark - sta flflag ; set file loaded flag -; -; Determine Entry Count -; - call codend ; pt to first entry - mvi b,0 ; set entry count - lxi d,18 ; size of entry -readd3: - mov a,m ; get first char of next entry - ora a ; done? - jz readd4 - inr b ; increment count - dad d ; pt to next - jmp readd3 -readd4: - mov a,b ; set entry count - sta ecount - jmp mkdir1 ; enter MKDIR -; -; Enter MKDIR System and Init Environ -; Enter at MKDIR if no file loaded, enter at MKDIR1 if file loaded -; -mkdir: - call dinit0 ; init directory - xra a ; A=0 - sta ecount ; set no entries present - sta flflag ; set no file loaded - sta chflag ; set no changes -mkdir1: - call print - db cr,lf,'MKDIR Command (? for Help)? ',0 - call capine ; get command - lxi d,mkdir1 ; set ret address - push d - lxi h,ctable ; scan command table for it - mov c,a ; command in C -mkdir2: - mov a,m ; get command letter - ora a ; end of table? - jz mkdirh - cmp c ; match? - jz mkdir3 - inx h ; skip over address - inx h - inx h - jmp mkdir2 -mkdir3: - inx h ; get address in HL - mov a,m ; low - inx h - mov h,m - mov l,a ; HL is address of routine - pchl ; "call" routine -; -; Print MKDIR Command Help -; -mkdirh: - call print - db cr,lf,'MKDIR Commands are --' - db cr,lf,' C -- Change Directory (Add/Rename/Delete Entries)' - db cr,lf,' I -- Initialize Directory' - db cr,lf,' P -- Print Directory' - db cr,lf,' R -- Read Directory File' - db cr,lf,' S -- Status of MKDIR Environment' - db cr,lf,' W -- Write Directory File' - db cr,lf,' X -- Exit Program' - db cr,lf,0 - ret -; -; Command Table -; -ctable: - db 'C' ; change directory - dw change - db 'I' ; init directory - dw dinit - db 'P' ; print directory - dw pwd - db 'R' ; read file - dw read - db 'S' ; status - dw status - db 'W' ; write file - dw write - db 'X' ; exit - dw exit - db 0 ; end of table -; -; Status -; -status: - call print - db cr,lf,'** MKDIR Status **',cr,lf,cr,lf,0 - call prec ; print entry count - call print - db cr,lf,'Working File Name: ',0 - lxi d,dfcb+1 - call pfn1 - call crlf ; new line - call crlf - lda chflag ; changes made? - ora a - jnz stat1 - call print - db 'No ',0 -stat1: - call print - db 'Changes made to Directory since Startup' - db cr,lf,0 - lda flflag ; file loaded? - ora a ; 0=no - jnz stat2 - call print - db 'No ',0 -stat2: - call print - db 'File has been loaded',cr,lf,0 - ret - -; -; Init Directory -; -dinit: - call print - db cr,lf,' Are you sure you want to Initialize the Directory ' - db '(Y/N/=N)? ',0 - call capine ; get response - call crlf - cpi 'Y' ; Yes is only valid reply - rnz -dinit0: - xra a ; A=0 - sta ecount - cma - sta chflag ; set change flag - call getnd ; get directory size - mov b,a ; ... in B - call codend ; pt to directory -dinit1: - push b ; save counter - xra a ; zero fill - mvi b,128 ; 128 bytes - call hfilb - pop b ; get counter - dcr b ; count down - jnz dinit1 - mvi m,0ffh ; store ending mark - ret -; -; Read File -; -read: - pop psw ; clear stack - call getfname ; get file name - ora a ; none? - jz ffile ; just find default file and load it - jmp loadfile ; parse entry and load file -; -; Get File Name from User -; -getfname: - call print - db cr,lf,'Name of File ( = ',0 - call retud ; get current DU - mov a,b ; print disk - adi 'A' - call cout - mov a,c ; print user - call padc - call print - db ': ',0 - lxi d,dfcb+1 ; print default name - call pfn1 - call print - db ')? ',0 - mvi a,0ffh ; capitalize - call bbline ; get user input - call sksp ; skip to non-blank - mov a,m - ora a ; default? - ret -; -; Write File -; -write: - call getfname ; get file name - jz write1 - lxi d,dfcb ; parse into DFCB - call zfname ; parse file name - call retud ; get current DU - lda dfcb ; get disk - ora a ; current? - jz write0 - dcr a ; adjust for A=0 - mov b,a ; ... in B -write0: - lda dfcb+13 ; get user - mov c,a ; ... in C - call logud ; log into new dir -write1: - lxi d,dfcb ; open file for output - call initfcb - call f$exist ; does file exist? - jz wf0 - call gfa ; get file attributes - ani 1 ; R/O? - jz wf0 - call print - db cr,lf,'File is R/O',0 - jmp getud ; go home -wf0: - call f$make ; open file - inr a ; a was 0ffh if error - jz werr ; write error and abort - call print - db cr,lf,'Writing Directory to Disk ... ',0 - call getnd ; get size of file - mov b,a ; count in B - call codend ; pt to start of buffer -wf1: - push b ; save counter - lxi d,tbuff ; copy into buffer - mvi b,128 ; 128 bytes - call hmovb - lxi d,dfcb ; pt to FCB - call f$write ; write block - pop b ; get ptr - jnz werr - dcr b ; count down - jnz wf1 - lxi d,dfcb ; pt to FCB - call f$close ; close file - call getud ; go home - xra a ; A=0 - sta chflag ; set no changes flag - call print - db 'Done',0 - ret -werr: - call print - db cr,lf,'Error in Disk Write',0 - jmp getud ; go home -; -; Exit from MKDIR -; -exit: - pop psw ; clear stack - lda chflag ; check for any changes - ora a ; 0=No - rz - call print - db cr,lf - db cr,lf,'Directory has changed since last Write' - db cr,lf,'Do you want to write Directory to Disk ' - db '(Y/N)? ',0 - call capine ; get response - call crlf ; new line - cpi 'N' ; no? - cnz write ; write if not No - ret -; -; Change Directory Contents -; -change: - call setduok ; save old DUOK flag and set new one - call print - db cr,lf,'** MKDIR Change Mode **',0 -ch0: - call print - db cr,lf,'Directory Entry (? for Help)? ',0 - mvi a,0ffh ; caps - call bbline ; get user input - call sksp ; skip to non-blank - mov a,m ; get char - ora a ; no input? - jz chprint ; done, so print directory - mov a,m ; get first char - cpi 'X' ; Exit? - jz chexit ; if so, sort and then exit - cpi '/' ; help? - jz chhelp - cpi '?' ; help? - jnz ch1 -chhelp: - call print - db cr,lf - db cr,lf,'MKDIR Change Mode --' - db cr,lf,' You may issue the following commands at this point:' - db cr,lf - db cr,lf,' DU:dirname <-- Create/Rename Dir Entry' - db cr,lf,' DU: <-- Delete Dir Entry' - db cr,lf,' <-- Print Directory' - db cr,lf,' X <-- Exit' - db cr,lf,' ? <-- Print this Help' - db cr,lf,0 - jmp ch0 -chprint: - call dsort ; use dsort routine - call pwd ; use pwd routine - jmp ch0 ; continue -ch1: - lxi d,tfcb ; extract user and disk info as well as name - call zfname ; get info - call retud ; get DU - lda tfcb ; get disk - ora a ; default? - jz ch2 - dcr a - mov b,a ; A=0 -ch2: - inr b ; A=1 - lda tfcb+13 ; get user - mov c,a ; ... in C - mov a,b ; save as temp disk and user - sta tdisk - mov a,c - sta tuser -; -; Scan Directory for Temp Disk and User -; - call codend ; pt to first entry -scanud: - mov a,m ; done? - ora a - jz scanud2 - inx h ; pt to name - inx h - mov a,m ; get first char of name - dcx h - dcx h ; pt to disk - cpi ' ' ; deleted entry? - jz scanud1 - mov a,m ; get disk - cmp b - jnz scanud1 - inx h ; pt to user - mov a,m ; get user - dcx h ; pt back - cmp c ; compare it - jz udfound -scanud1: - lxi d,18 ; pt to next - dad d - jmp scanud -; -; DU not found -; -scanud2: - lda tfcb+1 ; delete? - cpi ' ' ; space if so - jnz addname - call print - db cr,lf,' DU not Found',0 - jmp ch0 -; -; Found Possible Directory Entry -; -udfound: - inx h ; found existing entry - inx h ; pt to name - lda tfcb+1 ; delete? - cpi ' ' ; space if so - jz delname -; -; Rename Function -; - call print - db cr,lf,' Renaming ',0 - mvi b,8 ; 8 chars - call prhlb ; print name - push h ; save ptr to name - call etest ; check for duplicate name - pop d ; restore ptr to name - jz ch0 ; abort since duplicate - lxi h,tfcb+1 ; pt to new name - mvi b,8 ; 8 chars - call hmovb ; copy - mvi a,0ffh ; set change - sta chflag - jmp ch0 -; -; Add Function -; -addname: - call print - db cr,lf,' Adding ',0 - lxi h,tfcb+1 ; print name of entry to add - mvi b,8 - call prhlb -; -; Test for Duplicate Name -; -putname: - call etest ; test for duplicate name - jz ch0 ; abort if duplicate -; -; Test to see if there is room for another entry -; -putn1: - mvi b,18 ; 18 bytes required for entry - push h ; save ptr -putn2: - mov a,m ; check for 0FFH - cpi 0ffh - jz putn3 - inx h ; pt to next - dcr b - jnz putn2 - pop h ; get ptr to entry - jmp putn4 ; make entry -putn3: - pop psw ; clear stack - call print - db cr,lf,'** Directory Full **',0 - jmp ch0 -; -; Make Directory Entry -; -putn4: - mvi a,0ffh ; set change flag - sta chflag - lda tdisk ; set disk and user - mov m,a - inx h - lda tuser - mov m,a - inx h - lxi d,tfcb+1 ; pt to new name - xchg - mvi b,8 ; 8 chars - call hmovb ; set new name - call password ; enter password into buffer at DE - lda ecount ; print count - inr a ; increment entry count - sta ecount - jmp precount ; print count -; -; Test for Duplicate Directory Name -; -etest: - call codend ; pt to first entry -etest0: - mov a,m ; done? - ora a - jz etest2 - inx h ; pt to name - inx h - lxi d,tfcb+1 ; pt to new name - mvi b,8 ; 8 chars - call compb ; compare - jnz etest1 - call crlf - lxi h,tfcb+1 - mvi b,8 ; 8 chars - call prhlb ; print dir name - call print - db ' is a Duplicate Name',0 - xra a ; return Z - ret -; -; Last Entry was OK - Pt to Next -; -etest1: - lxi d,16 ; pt to next entry - dad d - jmp etest0 -; -; No Duplicate Entries - Return NZ and HL pts to after last entry -; -etest2: - dcr a ; set NZ - ret -; -; Enter 8-char password into memory pted to by HL -; -password: - push d ; save ptr - call print - db ' -- Password? ',0 - mvi a,0ffh ; caps - call bbline ; get line from user - call crlf ; new line - mvi b,8 ; 8 chars max - pop d ; pt to destination -pword1: - mov a,m ; get char - ora a ; done? - jz pword2 - stax d ; put char - inx h ; pt to next - inx d - dcr b ; count down - jnz pword1 - ret -pword2: - mvi a,' ' ; rest are spaces - stax d ; store space - inx d ; pt to next - dcr b ; count down - jnz pword2 - ret - -; -; Delete Function -; -delname: - mvi a,0ffh ; change made - sta chflag - call print - db cr,lf,' Deleting ',0 - mvi b,8 ; 8 chars - call prhlb - mvi m,' ' ; space fill - call dirpack ; pack directory - call print - db ' -- ',0 - lda ecount ; decrement entry count - dcr a - sta ecount -; -; Print Number of Remaining Entries in Directory -; -precount: - call prec ; print count - jmp ch0 -prec: - lda ecount ; print remaining count - call padc - call print - db ' Entries in Directory',0 - ret -; -; Pack Memory-Based Directory -- One Entry has been Deleted -; -dirpack: - call codend ; get address of first entry - mov d,h ; DE pts to it also - mov e,l -dirp0: - mov a,m ; get first byte - ora a ; done if zero - jz dirp2 - push b ; save counts - inx h ; pt to name - inx h - mov a,m ; get char - dcx h ; pt back to disk - dcx h - cpi ' ' ; no entry if space - jz dirp1 - mvi b,18 ; copy 18 bytes - call hmovb - pop b ; get counts - jmp dirp0 -dirp1: - lxi b,18 ; pt to next entry - dad b - pop b ; get counts - jmp dirp0 -dirp2: - mvi b,18 ; fill last entry with zeroes - xra a - xchg ; HL pts to last entry - jmp hfilb -; -; Exit Change Routine -; -chexit: - call resduok ; restore DUOK flag and fall thru to DSORT -; -; Sort Directory -; -dsort: - lda ecount ; number of elements - ora a ; any? - rz ; done if none - sta ssbcnt ; set count - call codend ; pt to first element - shld ssbstrt ; set starting address - lxi d,ssb ; pt to sort specifiction block - jmp sort ; sort -; -; Sort Compare Routine -; -compare: - push h ; don't change regs - push d - ldax d ; compare disk - cmp m - jnz comp1 - inx h ; pt to user - inx d - ldax d ; compare user - cmp m -comp1: - pop d ; restore regs - pop h - ret - -; -; SETDUOK - Save Old DUOK Flag and Set Flag to TRUE -; RESDUOK - Restore Old DUOK Flag -; -setduok: - push h ;save regs - push d - call getenv ;get ptr to environment descriptor - lxi d,2EH ;offset to DUOK Flag - dad d - mov a,m ;get flag - sta duoksav ;save flag - mvi m,1 ;turn flag on - pop d ;restore regs - pop h - ret -resduok: - push h ;save regs - push d - call getenv ;get ptr to environment descriptor - lxi d,2EH ;offset to DUOK Flag - dad d - lda duoksav ;get save flag - mov m,a ;set flag - pop d ;restore regs - pop h - ret - -; -; Print Names of Directory Elements -; -pwd: - call crlf ; new line - lda ecount ;check count first - ora a ;no entries? - jnz pwd01 - call print - db ' No Entries in Directory',0 - ret -; -; Print Header for Password Entries -; -pwd01: - mvi b,2 ;2 times -pwd0a: - call print - db ' DU : DIR Name - Password ',0 - dcr b ;count down - jnz pwd0a - call crlf - mvi b,2 -pwd0b: - call print - db '---- -------- -------- ',0 - dcr b ;count down - jnz pwd0b - call crlf -; -; Begin Output Processing -; - mvi c,0 ;set entry count - mvi b,1 ;set disk 1 - call codend ;pt to buffer containing new directory -; -; Print Each Resident Command Name -; -pwd1: - mov a,m ;get table entry - ora a ;end of table? - rz ;exit - cmp b ;same disk? - jz pwd2 -; -; Advance to Next Set of Entries for New Disk -; - mov b,a ;set new disk - mov a,c ;get count - ani 3 ;see if newline already given - cnz crlf ;complete current line - call crlf ;1 additional line - mvi c,0 ;reset count -pwd2: - push b ;save counters -; -; Print DU: -; - mov a,m ;get disk - adi '@' ;convert to letter (A to P) - call cout - inx h ;pt to user - mov a,m ;get user - call padc ;print user number - call print ;print separator - db ': ',0 - inx h ;pt to name -; -; Print DIR -; - call prname ;print name of directory - call print - db ' - ',0 - call prname ;print name of password - pop b ;get counters - inr c ;another entry - push b ;save counters -; -; Print Separator -; - call print ;print separator - db ' ',0 - pop b ;get counters -; -; New Line Counter -; - inr c ;increment entry counter - mov a,c ;check for done - ani 3 ;every 4 - cz crlf ;new line - jmp pwd1 -; -; Print 8-char name (directory or password) and advance ptr -; -prname: - mvi b,8 ;print name -prn1: - mov a,m ;get char - call cout - inx h ;pt to next - dcr b ;count down - jnz prn1 - ret - -; -; Utilities -; - -; -; Print chars pted to by HL for B bytes -; -prhlb: - push h ; save HL -prhlb1: - mov a,m ; print chars - inx h ; pt to next - call cout - dcr b ; count down - jnz prhlb1 - pop h ; get HL - ret - -; -; Compute Number of 128-byte blocks in Named Dir -; Return with Number in A and HL pting to it -; -getnd: - call getndr ; get ptr to NDR and number of entries in A - push h ; save ptr - mvi h,0 ; HL = value - mov l,a - dad h ; *2 - mov d,h ; DE = value * 2 - mov e,l - dad h ; *4 - dad h ; *8 - dad h ; *16 - dad d ; *18 - mov a,h ; /128 - rlc - ani 0feh - mov h,a - mov a,l - rlc - ani 1 - ora h ; A = value * 18 / 128 - inr a ; +1 - pop h ; get ptr - ret - -; -; Default File Name -; -dnfile: - db 'NAMES ' - db 'NDR' - -; -; Sort Specification Block -; -ssb: -ssbstrt: - ds 2 ; start address of dir -ssbcnt: - dw 0 ; number of records to sort - dw 18 ; 18 bytes/record - dw compare ; compare routine - dw 0 ; no ptr table - db 0,0 ; don't use ptrs -; -; Buffers -; -duoksav: - ds 1 ; save value for DUOK flag -tdisk: - ds 1 ; temp disk -tuser: - ds 1 ; temp user -flflag: - ds 1 ; file loaded flag -chflag: - ds 1 ; dir changed flag -ecount: - ds 1 ; entry count -crcnt: - ds 1 ; new line count -tfcb: - ds 36 ; temp FCB -dfcb: - ds 36 ; Default FCB - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/MU3.COM b/Source/Images/d_bp/u15/MU3.COM deleted file mode 100644 index e686ed56..00000000 Binary files a/Source/Images/d_bp/u15/MU3.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/MU3.HLP b/Source/Images/d_bp/u15/MU3.HLP deleted file mode 100644 index 703fcd0c..00000000 --- a/Source/Images/d_bp/u15/MU3.HLP +++ /dev/null @@ -1,175 +0,0 @@ -; - - - The Memory Utility MU3 - - - M - Overview of MU3 - - C - MU3 Commands - - - ---- Command Summary ---- - 1 - Movement: + - A arrows - 2 - Value Entry: N T - 3 - Other: H ^R ^C - -:M -Command: MU3 1.0 - -Syntax: - MU3 <-- Invoke MU3 pointing to ZCPR3 Env Desc -or - MU3 address <-- Invoke MU3 pointing to address (hex) - -Function: - - MU³ provideó á screen-orienteä editoò whicè maù bå useä -tï examinå anä modifù memorù aô thå user'ó  discretion®  Iô -loadó  aó  á transienô anä runó froí thå  TPA¬  startinç  aô -100H® MU³ findó mosô oæ itó applicatioî iî thaô iô doeó noô -overlaù thå ZCPR³ CP¬  sï thå useò caî examinå thå operatinç -systeí directlù witè MU3. - -Options: None - - -Comments: - - MU³ useó thå ZCPR³ TCAÐ foò support®  Worä Staò cursoò -motioî  conventioî applieó anä thå user'ó arro÷ keyó maù  bå -activå iæ theù arå specifieä iî thå TCAÐ entry. - - Alì  numeriã  inpuô argumentó defaulô  tï  hexadecimal¬ -sucè  aó  numberó tï bå inpuô anä addresses®  Thió  caî  bå -overriddeî  bù  prefixinç thå numbeò witè á  '#§  character® -Foò instance¬ iî responså tï thå Á (selecô address© command¬ -thå  useò maù typå 7d° oò #200° tï indicatå memorù  locatioî -7D0 hex. - - Alì  commandó  arå simplå anä  self-explanatory®  Theù -include: C - Enter ZCPR3 Command Line - N - Enter Hex Numbers T - Enter Text - A - Specify Address +/- Next/Last Block - H - Hex Calculator Arrows - Movement - ^R - Refresh Screen ^C - Exit MU3 - -Selected Error Messages: None - -Examples of Use: - - MU3 F000 - - invoke MU3 and point to address 0F000H - -:C - The Commands of MU3 - - MU³  ió  quitå simplå tï uså anä recognizeó onlù á  fe÷ -commands® Theså commandó arå presenteä iî á menõ tï thå MU³ -useò aó thå prograí ió running. - - Thå MU³ displaù screeî ió formatteä aó indicateä below: - - MU3 Memory Editor - Value - - Hexadecimal Memory Dump ASCII Dump - --- Movement -- -------------- Operation --------------- - ^E A Enter Address + Next Block - ^ H Hex Calculator - Last Block - ^S <-+-> ^D N Enter Hex Numbers ^R Replot Screen - v T Enter Text ^C Exit MU3 - ^X C Enter Command Line - - Aó thå useò moveó abouô oî thå screen¬ usinç eitheò thå -Worä Staò cursoò movemenô conventioî oò hió arro÷ keys¬ thå -valuå iî thå uppeò righô corneò changes¬ indicatinç botè thå -heø  valuå  anä ASCIÉ characteò representatioî oæ  thå  bytå -beinç pointeä to®  Also¬  á cursoò moveó iî thå Hexadecimaì -Memorù  Dumð  region¬  indicatinç wherå thå useò ió  iî  thå -current 128-byte block. - - Oncå thå useò ió pointinç tï á desireä byte¬ hå maù uså -thå Î oò Ô commandó tï changå memorù startinç aô thå bytå hå -is pointing to. - -:1 - Movement Commands - - Thå  cursoò  maù bå moveä abouô oî thå screeî  viá  thå -Worä Staò cursoò movemenô convention® Iæ thå arro÷ keyó foò -thå user'ó terminaì arå installeä viá thå ZCPR³  TCAP¬  theî -they keys may also be used to move the cursor. - - Aô  anù  time¬  thå useò maù strikå thå letteò Á  (caså -makeó nï difference© tï selecô á differenô regioî oæ  memorù -tï  view®  MU³ wilì displaù 12¸ byteó oæ memorù startinç aô -the address given by the user. - - Thå  commandó  «  anä - movå thå  displaù  forwarä  anä -backward¬  resp¬ foò onå blocë (12¸ bytes)® Thå movemenô ió -instantaneous¬  anä  thå cursoò ió repositioneä tï thå firsô -byte in the new block. - -:2 - Value Entry Commands - - Thå  Î commanä ió useä tï enteò á grouð oæ  hexadecimaì -numberó  intï memorù startinç aô thå addresó  beinç  pointeä -to® Thå useò ió prompteä foò input¬ anä hå maù theî enteò á -serieó  oæ hexadecimaì values¬  separateä bù spaces®  Entrù -terminateó  wheî thå useò strikeó thå RETURÎ key®  Caså  ió -not significant. Any number prefixed with '#' is decimal. - - Foò  example¬  thå  followinç ió á samplå  sequencå  oæ -values which may be entered: - - 0 1f f3 ff 2c c3 0 2 3 4 #192 #255 - - Thå  Ô  commanä  ió  useä tï  enteò  texô  intï  memorù -startinç aô thå cursoò position®  Thå useò ió prompteä  foò -input¬  anä  hå maù theî enteò á strinç oæ characters®  Alì -characteró inpuô arå significant® Entrù terminateó wheî thå -user strikes the RETURN key. Case is significant. - - - If¬  whilå iî thå middlå oæ texô entry¬ thå useò wisheó -tï  inserô  á  numeriã value¬  thå  escapå  formaô  §  followeä  bù carriagå returî  anä  linå  feeä -characters into memory starting at the cursor: - - <<0d><#10> - -'0d§  ió  0Ä heø anä '#10§ ió 1° decimaì  oò  0Á  hex®  Thå -leading '<<' translates into one '<'. - -:3 - Other Commands - - Thå  Ã commanä allowó thå useò tï enteò á commanä  linå -foò immediatå executioî bù thå ZCPR³ Commanä Processor®  Iæ -MU³  ió  invokeä  aó á shelì viá  thå  SHSEÔ  command¬  thió -commanä  provideó  aî escapå mechanisí aó welì aó á  waù  tï -executå  á  commanä linå froí withiî MU3®  Thå  SHCTRÌ  POÐ -command will terminate the current shell on the shell stack. - - Thå  È commanä invokeó á hexadecimaì  calculator®  Thå -useò  ió askeä tï enteò twï hexadecimaì numbers¬  anä  theså -numberó  arå  addeä anä subtracted¬  witè thå resultó  beinç -printeä immediately®  Again¬ decimaì numberó maù bå entereä -by prefixing them with '#'. - - Thå ^Ò commanä refresheó thå screeî foò thå user® Thió -ió handù iæ thå screeî waó garbleä iî somå way¬  sucè aó  bù -turning off the CRT. - - The ^C command causes MU3 to exit to ZCPR3. - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/MU3.MAC b/Source/Images/d_bp/u15/MU3.MAC deleted file mode 100644 index e036db4c..00000000 --- a/Source/Images/d_bp/u15/MU3.MAC +++ /dev/null @@ -1,854 +0,0 @@ -; -; Program: MU3 -; Author: Richard Conn -; Version: 1.0 -; Date: 30 June 84 -; Previous Versions: None -; -vers equ 10 -z3env equ 0f400h - -; -; MU3 is the ZCPR3 Memory Utility. It allows the user to display -; blocks of memory, edit them, and perform general memory-oriented -; manipulation. See the file MU3.HLP for usage details. -; - -; -; General Equates -; -bs equ 08h -cr equ 0dh -lf equ 0ah -fcb equ 5ch -dim equ 1 ;goto standout mode -bright equ 2 ;exit standout mode -EOLCH EQU 0 ;END OF LINE CHAR -SEPCH EQU ',' ;SEPARATOR CHAR -EROW EQU 6 ;FIRST ROW OF EDITOR DISPLAY -ECOL EQU 4 ;FIRST COL OF EDITOR DISPLAY -ECOLC EQU ECOL+16*3+8 ;FIRST COL OF EDITOR CHAR DISPLAY -ECURS EQU '>' ;EDITOR CURSOR -PRROW EQU 22 ;PROMPT ROW -PRCOL EQU 10 ;PROMPT COLUMN -PRCOLI EQU PRCOL+15 ;PROMPT INPUT COL -ERROW EQU 23 ;ERROR MESSAGE ROW -ERCOL EQU 15 ;ERROR MESSAGE COLUMN - -; -; SYSLIB/Z3LIB/VLIB Externals -; - ext z3vinit,envptr,codend,putcl - ext cls,gotoxy,ereol,at,vprint,stndout - ext cout,crlf,cin,caps - ext bline,sksp - ext phl4hc,pa2hc,phlfdc - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3vinit ;initialize the ZCPR3 Env and the VLIB Env -; -; DEFINE FREE SPACE -; - CALL CODEND ;DETERMINE ADDRESS - MVI M,126 ;126 CHARS INPUT ALLOWED - SHLD BUFFER ;SET PTR -; -; SET UP ARROW KEYS -; - LHLD ENVPTR ;PT TO ENVIRONMENT DESCRIPTOR - LXI D,80H+10H ;PT TO ARROW KEY INFO - DAD D - LXI D,EDCURT ;PT TO CURSOR TABLE - MVI B,4 ;4 ARROW KEYS -ARROW: - MOV A,M ;GET CHAR - STAX D ;STORE CHAR - INX H ;PT TO NEXT - INX D ;PT TO NEXT ENTRY - INX D - INX D - DCR B ;COUNT DOWN - JNZ ARROW -; -; Check for Command Line Parameter -; - lxi h,fcb+1 ;pt to first char - mov a,m ;get char - cpi ' ' ;no param? - jnz pcheck - lhld envptr ;pt to environment descriptor - jmp mu3 -; -; We have a parameter -; -pcheck: - cpi '/' ;help? - jz help - call hexin ;convert to binary - xchg ;HL=value - jmp mu3 -; -; Print help message -; -help: - call vprint - db cr,lf,'Syntax:' - db cr,lf,' MU3 <-- Invoke MU3 at Env Desc' - db cr,lf,' MU3 <-- Invoke MU3 at Address' - db 0 - ret -; -; Erase to EOL -; If fct not supported, send out B spaces and B backspaces -; -vereol: - call ereol ;try erase - rnz - push b ;save B - mvi a,' ' ;send spaces - call vereol1 - pop b ;get B - mvi a,bs ;send backspaces -vereol1: - call cout ;send char in A - dcr b - jnz vereol1 - ret -; -; Clear Screen -; If fct not supported, write 24 CRLFs -; -vcls: - call cls ;try clear - rnz - push b ;save B - mvi b,24 ;count -vcls1: - call crlf - dcr b - jnz vcls1 - pop b - ret -; -; Run MU3 -; HL contains starting address -; -mu3: - SHLD BLOCK ;SAVE PTR TO BLOCK -; -; REFRESH EDIT SCREEN -; -EDIT0: - CALL VCLS ;NEW SCREEN - CALL AT - DB 2,26 ;ROW 2, COL 26 - CALL VPRINT ;BANNER - DB 'MU3 Memory Editor, Version ' - DB (VERS/10)+'0','.',(VERS MOD 10)+'0' - DB 0 - CALL AT ;POSITION FOR VALUE TEXT - DB 3,67 - CALL VPRINT - DB DIM,'Value',BRIGHT,0 - MVI H,EROW+9 ;POSITION FOR COMMAND DISPLAY - MVI L,1 - CALL GOTOXY ;POSITION CURSOR - CALL VPRINT ;PRINT COMMAND SUMMARY - DB ' -- Movement --' - DB ' -------------- Operation ---------------',CR,LF - DB ' ^E ' - DB 'A',DIM,' Enter Address ',BRIGHT - DB ' +',DIM,' Next Block',BRIGHT,CR,LF - DB ' ^ ' - DB 'H',DIM,' Hex Calculator ',BRIGHT - DB ' -',DIM,' Last Block',BRIGHT,CR,LF - DB ' ^S <-+-> ^D ' - DB 'N',DIM,' Enter Hex Numbers ',BRIGHT - DB ' ^R',DIM,' Replot Screen',BRIGHT,CR,LF - DB ' v ' - DB 'T',DIM,' Enter Text ',BRIGHT - DB ' ^C',DIM,' Exit MU3',BRIGHT,CR,LF - DB ' ^X ' - DB 'C',DIM,' Enter Command Line',BRIGHT - DB 0 -; -; REENTER MU3 WITH PTRS RESET -; -MU3R: - XRA A ;A=0 - STA EINDEX ;SET INDEX TO 0 (FIRST ELEMENT) - STA EDERR ;SET NO PREVIOUS ERROR - CALL EDPLOT ;PLOT BUFFER DATA -; -; INPUT EDITOR COMMAND -; -EDITCMD: - CALL EDERCL ;CLEAR EDITOR INVALID COMMAND MESSAGE -EDITCMD1: - CALL PRMSG ;POSITION AT PROMPT MESSAGE - DB DIM,'MU3 Command?',BRIGHT,0 - CALL PRINP ;POSITION AT PROMPT INPUT - DB 0 - CALL CIN ;GET CHAR - CALL CAPS ;CAPITALIZE - MOV B,A ;COMMAND IN B - LXI H,EDCURT ;PROCESS CURSOR COMMANDS FIRST - CALL CMD ;PROCESS COMMAND - LXI H,ECMDTBL ;EDITOR COMMAND TABLE - CALL CMD ;PROCESS COMMAND - MVI A,0FFH ;SET ERROR FLAG - STA EDERR - CALL ERMSG ;ERROR MESSAGE - DB 'Invalid Command',0 - JMP EDITCMD1 -; -; Position at Prompt Message and Print it -; -PRMSG: - CALL AT ;POSITION - DB PRROW,PRCOL - JMP VPRINT ;PRINT IT -; -; Position at Prompt Input and Print Prompt -; -PRINP: - CALL AT ;POSITION - DB PRROW,PRCOLI - JMP VPRINT ;PRINT IT -; -; Position at Error Message and Print It -; -ERMSG: - CALL AT ;POSITION - DB ERROW,ERCOL - JMP VPRINT ;PRINT IT -; -;INPUT ERROR -; -WHAT: - MVI A,0FFH ;SET ERROR FLAG - STA EDERR - CALL ERMSG - DB 'Value Error',0 - JMP EDITCMD1 -; -;Command Table Search and Execute -; -CMD: - MOV A,M ;CHECK FOR END OF TABLE - ORA A - RZ ;COMMAND NOT FOUND - CMP B ;MATCH? - JZ CMDRUN - INX H ;SKIP TO NEXT ENTRY IN TABLE - INX H - INX H - JMP CMD -; -;RUN COMMAND -; -CMDRUN: - INX H ;PT TO LOW ADDRESS - MOV E,M - INX H ;PT TO HIGH ADDRESS - MOV D,M - XCHG - POP PSW ;CLEAR STACK - PCHL ;RUN ROUTINE -; -;PLOT BUFFER DATA -; -EDPLOT: - MVI H,EROW-1 ;SET ROW - MVI L,ECOL ;SET COLUMN - CALL GOTOXY ;POSITION CURSOR - CALL VPRINT - DB DIM - DB ' 0 1 2 3 4 5 6 7 8 9 A B C D E F' - DB BRIGHT,0 - INR H ;NEXT ROW - CALL GOTOXY ;POSITION CURSOR - XCHG ;POSITION IN DE - LHLD BLOCK ;PT TO DATA - MVI B,8 ;8 LINES -; -;Print Next Line on Screen -; -EDIT00: - CALL STNDOUT ;GO DIM - MOV A,H ;OUTPUT ADDRESS - CALL PA2HC - MOV A,L - CALL PA2HC - CALL VPRINT - DB ':',BRIGHT,' ',0 - MVI C,16 ;16 ELEMENTS -EDIT01: - MOV A,M ;GET BYTE - CALL PA2HC ;PRINT AS HEX - CALL SPACE ;PRINT 1 SPACE - INX H ;PT TO NEXT - DCR C ;COUNT DOWN - JNZ EDIT01 - XCHG ;POSITION AGAIN - INR H ;NEXT ROW - CALL GOTOXY - XCHG - DCR B ;COUNT DOWN - JNZ EDIT00 - MVI H,EROW ;RESET ROW - MVI L,ECOLC ;RESET COL - CALL GOTOXY ;POSITION CURSOR - XCHG ;POSITION IN DE - LHLD BLOCK ;PT TO DATA - MVI B,8 ;8 LINES -EDIT02: - CALL BAR ;PRINT BAR - MVI C,16 ;16 ELEMENTS -EDIT03: - MOV A,M ;GET BYTE - ANI 7FH ;MASK MSB - CPI 7FH ;DON'T PRINT 7FH - JZ EDIT7F - CPI ' ' ;SPACE OR MORE? - JNC EDIT04 -EDIT7F: - MVI A,'.' ;PRINT DOT -EDIT04: - CALL COUT ;PRINT BYTE - INX H ;PT TO NEXT - DCR C ;COUNT DOWN - JNZ EDIT03 - CALL BAR ;PRINT ENDING BAR - XCHG ;POSITION AGAIN - INR H ;NEXT ROW - CALL GOTOXY - XCHG - DCR B ;COUNT DOWN - JNZ EDIT02 - CALL EDCUR ;POSITION CURSOR - RET -; -;EDITOR COMMAND TABLE -; -ECMDTBL: - DB CR ;NOP - DW EDITCMD - DB 'C'-'@' ;^C = EXIT MU3 - DW EDCC - DB 'R'-'@' ;^R = REFRESH - DW EDIT0 - DB 'E'-'@' ;^E=UP - DW EDUP - DB 'X'-'@' ;^X=DOWN - DW EDDOWN - DB 'D'-'@' ;^D=RIGHT - DW EDRIGHT - DB 'S'-'@' ;^S=LEFT - DW EDLEFT - DB ' ' ;NOP - DW EDITCMD - DB '+' ;ADVANCE - DW EDITPLUS - DB '-' ;BACKUP - DW EDITMINUS - DB 'A' ;ADDRESS - DW EDITADR - DB 'C' ;COMMAND LINE - DW EDITCL - DB 'H' ;HEX CALC - DW EDITCALC - DB 'N' ;CHANGE NUMBERS - DW EDITHEX - DB 'T' ;CHANGE TEXT - DW EDITALP - DB 0 ;END OF TABLE -; -; ARROW KEY DEFINITONS FROM TCAP -; -EDCURT: - DB 0 ;0 INDICATES NO ARROW KEYS - DW EDUP - DB 0 - DW EDDOWN - DB 0 - DW EDRIGHT - DB 0 - DW EDLEFT - DB 0 ;END OF TABLE -; -;Enter Command Line -; -EDITCL: - CALL EDERCL ;CLEAR ERROR LINE - CALL CRLF ;NEW LINE - CALL VPRINT ;PROMPT INPUT - DB DIM,'Command Line? ',BRIGHT,0 - CALL RDBUF ;INPUT TEXT - CALL PUTCL ;STORE COMMAND LINE - JMP CRLF ;NEW LINE -; -;Enter ASCII Chars -; -EDITALP: - CALL EDERCL ;CLEAR ERROR LINE - CALL PRINP ;PROMPT INPUT - DB DIM,'Enter Text ( for Hex)',BRIGHT - DB CR,LF,' --> ',0 - CALL RDBUF ;INPUT TEXT WITHOUT PROMPT - CALL EDPRCL ;CLEAR PROMPT LINE - LDA EINDEX ;PT TO POSITION - XCHG - LHLD BLOCK ;COMPUTE OFFSET - XCHG - ADD E - MOV E,A - MOV A,D - ACI 0 - MOV D,A ;DE PTS TO BYTE, HL PTS TO TEXT -EDITA1: - MOV A,M ;GET CHAR - CPI EOLCH ;EOL? - JZ EDITA2 ;REFRESH SCREEN - CALL GETVAL ;GET ASCII OR VALUE - STAX D ;UPDATE BYTE - INX H ;PT TO NEXT INPUT CHAR - INR E ;PT TO NEXT BUFFER BYTE - JNZ EDITA1 -EDITA2: - CALL EDPLOT ;REPLOT - JMP EDITCMD1 ;DONE-REFRESH SCREEN -; -;Calculate Sum and Differences -; -EDITCALC: - CALL EDERCL ;CLEAR ERROR LINE - CALL PRINP ;PROMPT INPUT - DB DIM,'Enter Two Hex Numbers - ',BRIGHT,0 - CALL RDBUF ;INPUT TEXT - CALL EDPRCL ;CLEAR PROMPT LINE - CALL SKSP ;SKIP TO NON-SPACE - MOV A,M ;ANY INPUT? - ORA A ;0=NO - JZ EDITCMD1 - CALL HEXIN ;EVALUATE FIRST NUMBER - CALL SKSP ;SKIP TO 2ND NUMBER - PUSH D ;SAVE FIRST NUMBER - CALL HEXIN ;EVALUATE 2ND NUMBER - POP H ;GET FIRST NUMBER - CALL ERMSG ;PRINT ERROR MESSAGE - DB 0 - CALL PHL4HC ;PRINT FIRST NUMBER - CALL VPRINT - DB DIM,' and ',BRIGHT,0 - XCHG - CALL PHL4HC ;PRINT 2ND NUMBER - XCHG - CALL VPRINT - DB ' ',DIM,'Sum = ',BRIGHT,0 - PUSH H - DAD D - CALL NUMOUT - POP H - CALL VPRINT - DB ' ',DIM,'Diff = ',BRIGHT,0 - MOV A,L ;HL=HL-DE - SUB E - MOV L,A - MOV A,H - SBB D - MOV H,A - CALL NUMOUT - JMP EDITCMD1 -; -;Output number in HL in Hex and Decimal -; -NUMOUT: - CALL PHL4HC ;HEX - CALL VPRINT - DB ' (',0 - CALL PHLFDC ;DECIMAL FLOATING - MVI A,')' ;CLOSE PAREN - JMP COUT -; -;Enter Numbers -; -EDITHEX: - CALL EDERCL ;CLEAR ERROR LINE - CALL PRINP ;PROMPT INPUT - DB DIM,'Enter Hex Numbers (#nn for Dec)' - DB BRIGHT - DB CR,LF,' --> ',0 - CALL RDBUF ;INPUT TEXT WITHOUT PROMPT - CALL EDPRCL ;CLEAR PROMPT LINE - LDA EINDEX ;PT TO POSITION - XCHG - LHLD BLOCK ;COMPUTE OFFSET - XCHG - ADD E - MOV E,A - MOV A,D - ACI 0 - MOV D,A ;DE PTS TO BYTE, HL PTS TO TEXT -EDITH1: - MOV A,M ;GET HEX DIGIT - CPI EOLCH ;EOL? - JZ EDITA2 ;REFRESH SCREEN - CPI ' ' ;SKIP SPACES - JNZ EDITH2 - INX H ;SKIP SPACE - JMP EDITH1 -EDITH2: - PUSH D ;SAVE PTR - CALL HEXIN ;GET VALUE AND POSITION HL - MOV A,E ;... IN A - POP D ;GET PTR - STAX D ;PUT BYTE - INR E ;ADVANCE TO NEXT BYTE - JNZ EDITH1 - JMP EDITA2 ;DONE-REFRESH -; -;Clear Editor Invalid Command Message -; -EDERCL: - LDA EDERR ;PREVIOUS ERROR? - ORA A ;0=NO - RZ - XRA A ;CLEAR FLAG - STA EDERR - CALL ERMSG ;CLEAR ERROR MESSAGE - DB 0 - MVI B,40 ;40 CHARS MAX - JMP VEREOL -; -;CLEAR PROMPT LINE -; -EDPRCL: - CALL PRINP ;PROMPT LINE - DB 0 - MVI B,40 ;40 POSITIONS - CALL VEREOL ;CLEAR TO EOL OR 40 CHARS - CALL AT ;USER INPUT - DB ERROW,1 - MVI B,79 ;79 POSITIONS - JMP VEREOL -; -;Input Address -; -EDITADR: - CALL VPRINT - DB 'Address? ',0 - CALL RDBUF ;GET USER INPUT - CALL SKSP ;SKIP LEADING SPACES - MOV A,M ;EMPTY LINE? - ORA A - JZ MU3R - CALL HEXIN ;CONVERT FROM HEX - XCHG ;HL = ADDRESS - SHLD BLOCK - JMP MU3R ;REENTER -; -;Advance to Next Block -; -EDITPLUS: - LHLD BLOCK ;ADVANCE TO NEXT BLOCK - LXI D,128 ;128 BYTES - DAD D - SHLD BLOCK - CALL EDPLOT ;REPLOT DATA - JMP EDITCMD -; -;Backup to Last Block -; -EDITMINUS: - LHLD BLOCK ;BACKUP TO LAST BLOCK - LXI D,-128 ;128 BYTES - DAD D - SHLD BLOCK - CALL EDPLOT ;REPLOT DATA - JMP EDITCMD -; -;Exit MU3 -; -EDCC: - CALL EDERCL ;CLEAR ERROR LINE - JMP CRLF ;NEW LINE -; -;EDIT MOVE: UP -; -EDUP: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;BACKUP INDEX BY 16 - SUI 16 -; -;Common EDIT MOVE Routine - on input, A=new index -; -EDMOVE: - ANI 7FH ;MOD 128 - STA EINDEX - CALL EDCUR ;SET CURSOR - JMP EDITCMD -; -;EDIT MOVE: DOWN -; -EDDOWN: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;INCREMENT INDEX BY 16 - ADI 16 - JMP EDMOVE ;COMMON ROUTINE -; -;EDIT MOVE: RIGHT -; -EDRIGHT: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;INCREMENT INDEX BY 1 - INR A - JMP EDMOVE ;COMMON ROUTINE -; -;EDIT MOVE: LEFT -; -EDLEFT: - CALL EDCCUR ;CLEAR CURSOR - LDA EINDEX ;DECREMENT INDEX BY 1 - DCR A - JMP EDMOVE ;COMMON ROUTINE -; -;EDIT SUBROUTINE: EDCUR -; Position Editor Cursor at EINDEX -;EDIT SUBROUTINE: EDCCUR -; Clear Editor Cursor at EINDEX -; -EDCUR: - PUSH H ;SAVE HL - MVI C,ECURS ;CURSOR CHAR - CALL EDSETCUR - CALL AT ;UPDATE DATA - DB 3,74 - LDA EINDEX ;PT TO BYTE AT CURSOR - LHLD BLOCK - ADD L - MOV L,A - MOV A,H - ACI 0 - MOV H,A ;HL PTS TO BYTE AT CURSOR - MOV A,M ;GET BYTE - CALL PA2HC ;PRINT AS HEX - CALL SPACE - MOV A,M ;GET BYTE - POP H ;RESTORE HL - ANI 7FH ;MASK - CPI 7FH ;7FH AS DOT - JZ EDC7F - CPI ' ' ;OUTPUT CHAR OR DOT - JNC COUT -EDC7F: - MVI A,'.' ;DOT - JMP COUT -EDCCUR: - MVI C,' ' ;CLEAR CURSOR -EDSETCUR: - CALL EDROW ;COMPUTE ROW - ANI 0FH ;COMPUTE COL MOD 16 - MOV B,A ;RESULT IN B - ADD A ;*2 - ADD B ;*3 - ADI ECOL+6 ;ADD IN COL - DCR A ;SUBTRACT 1 - MOV L,A ;COL POSITION SET - CALL GOTOXY ;POSITION CURSOR - MOV A,C ;OUTPUT CHAR - JMP COUT -; -;Compute Row from EINDEX -; -EDROW: - LDA EINDEX ;GET INDEX - MOV B,A ;SAVE IN B - RRC ;DIVIDE BY 16 - RRC - RRC - RRC - ANI 0FH ;MASK FOR LSB ONLY - ADI EROW ;COMPUTE ROW - MOV H,A ;ROW SET - MOV A,B ;GET INDEX - RET - -; -;PRINT A SPACE -; -SPACE: - MVI A,' ' - JMP COUT -; -;PRINT AN BARISK IN REV VIDEO -; -BAR: - CALL VPRINT - DB DIM,'|',BRIGHT,0 - RET -; -;Get value from input buffer -; -GETVAL: - MOV A,M ;GET NEXT CHAR - CPI '<' ;HEX ESCAPE? - RNZ ;NO, RETURN -;"<<" means one "<" - INX H - MOV A,M - CPI '<' - RZ -;Got hex - PUSH D - CALL HEXIN ;GET VALUE - CPI '>' ;PROPER DELIM? - MOV A,E ;GET VALUE - POP D - RZ -; -;ERROR CONDITION IN SUBROUTINE - CLEAR STACK AND FLAG ERROR -; -SERR: - POP PSW ;CLEAR STACK - JMP WHAT ;ERROR -; -;Input Number from Command Line -- Assume it to be Hex -; Number returned in DE -; -HEXIN: - LXI D,0 ;INIT VALUE - MOV A,M - CPI '#' ;DECIMAL? - JZ HDIN ;MAKE DECIMAL -; -HINLP: - MOV A,M ;GET CHAR - CALL CAPS ;CAPITALIZE - CPI CR ;EOL? - RZ - CPI EOLCH ;EOL? - RZ - CPI SEPCH - RZ - CPI ' ' ;SPACE? - RZ - CPI '-' ;'THRU'? - RZ - CPI '>' - RZ - INX H ;PT TO NEXT CHAR - CPI '0' ;RANGE? - JC SERR - CPI '9'+1 ;RANGE? - JC HINNUM - CPI 'A' ;RANGE? - JC SERR - CPI 'F'+1 ;RANGE? - JNC SERR - SUI 7 ;ADJUST FROM A-F TO 10-15 -; -HINNUM: - SUI '0' ;CONVERT FROM ASCII TO BINARY - XCHG - DAD H ;MULT PREVIOUS VALUE BY 16 - DAD H - DAD H - DAD H - ADD L ;ADD IN NEW DIGIT - MOV L,A - XCHG - JMP HINLP -; -HDIN: - INX H ;SKIP '#' -; -;Input Number in Command Line as Decimal -; Number is returned in DE -; -DECIN: - LXI D,0 - MOV A,M ; GET 1ST CHAR - CPI '#' ; HEX? - JNZ DINLP - INX H ; PT TO DIGIT - JMP HINLP ; DO HEX PROCESSING -; -DINLP: - MOV A,M ;GET DIGIT - CALL CAPS ;CAPITALIZE - CPI '0' ;RANGE? - RC - CPI '9'+1 ;RANGE? - RNC - SUI '0' ;CONVERT TO BINARY - INX H ;PT TO NEXT - PUSH H - MOV H,D - MOV L,E - DAD H ;X2 - DAD H ;X4 - DAD D ;X5 - DAD H ;X10 - ADD L ;ADD IN DIGIT - MOV L,A - MOV A,H - ACI 0 - MOV H,A - XCHG ;RESULT IN DE - POP H - JMP DINLP -; -; READ LINE FROM USER INTO INPUT LINE BUFFER -; -RDBUF: - LHLD BUFFER ;PT TO BUFFER - XRA A ;DON'T CAPITALIZE - JMP BLINE ;INPUT LINE ROUTINE - -; -;EDITOR BUFFERS -; -BLOCK: - DS 2 ;ADDRESS OF CURRENT BLOCK -BUFFER: - DS 2 ;PTR TO FREE SPACE -EINDEX: - DS 1 ;INDEX ENTRY -EDERR: - DS 1 ;ERROR FLAG -EDRUN: - DS 1 ;FLAG SAYING THAT EDITOR IS RUNNING - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/NDIRS.HLP b/Source/Images/d_bp/u15/NDIRS.HLP deleted file mode 100644 index 5cbbd204..00000000 --- a/Source/Images/d_bp/u15/NDIRS.HLP +++ /dev/null @@ -1,440 +0,0 @@ -; - - Named Directories Under ZCPR3 - - -- Basics -- - 1 - The Named Directory Concept - 2 - Memory-Based Named Directories - - - -- Commands -- - M - MKDIR - U - Using MKDIR - P - PWD - C - CD - -:1 - Overview of the Named Directory Concept - - Thå   Nameä   Directorù  Concepô  undeò  ZCPR³  ió   aî -associatioî  oæ  á mnemoniã namå witè á  logicaì  directory¬ -whicè ió á disë anä useò area® Witè thió facility¬ thå useò -ió  permitteä tï refeò tï anù directorù bù á mnemoniã  name¬ -anä thió greatlù improveó thå useò interfacå oveò havinç  tï -remembeò disë letteró anä numbers. - - Foò instance¬ aî environmenô caî bå seô uð iî whicè thå -followinç namå assignmentó arå made: - - A15: = ROOT A0: = BASE - B0: = BBASE B1: = JEFF - B2: = ROBERT B3: = LINDA - - Witè  thå nameä directorù facilitù enabled¬  thå  ZCPR³ -utilitieó  caî refeò tï theså directorieó bù eitheò thå  DUº -forí (disë anä useò number© oò bù thå name: - - XDIR ROOT: is the same as XDIR A15: - - Mosô oæ thå ZCPR³ utilitieó recognizå nameä directorieó -iæ  thå  facilitù ió enabled¬  and¬  sincå  theså  utilitieó -functioî tï providå interfaceó betweeî thå directories¬ theù -creatå   á   gooä  workinç  environmenô  foò  uså   oæ   thå -conventionaì  CP/Í utilitieó aó well®  Iî otheò words¬  thå -ZCPR³  utilitieó whicè caî deaì witè nameä  directorieó  arå -thå  onlù  utilitieó witè whicè onå shoulä  crosó  directorù -boundarieó  iî  á ZCPR³ systeí anä  conventionaì  utilities¬ -likå  aî editoò oò aî assembler¬  shoulä bå useä iî onlù onå -directorù  anä deaì witè fileó iî thå currenô directorù  anä -oî drivå Á iî thå samå useò numbeò (A¤ iî thå vernacular). - - Manù  ZCPR³  tooló  arå  provideä tï acô  aó  á  bridgå -betweeî directories¬ anä theù werå createä witè thió purposå -iî mind®  Commonly-useä functionó haä tï bå madå  availablå -tï  thå  ZCPR³ useò tï providå thió bridge»  sucè  functionó -include: - - - o File - Copying - Renaming - Erasing - Unerasing - Protecting - Typing to Console - Printing to Printer - Search - - o Directory Display - - - - Foò instance¬ tï ediô á filå iî thå ZCPÒ directorù witè -Worä  Master¬  copù thå filå intï á workinç directorù  whicè -haó  thå WM.HLÐ filå iî Aº  iî thå samå useò areá  anä  ediô -there® Theî copù iô bacë wheî done: - - B1>mcopy b1:=zcpr:file.txt - ... - B1>wm file.txt - ... - B1>mcopy zcpr:=file.txt - - - Manù  commerciaì programs¬  likå Worä Masteò  anä  Worä -Star¬  arå  alreadù programmeä tï looë oî Aº  iæ theù dï noô -finä thå overlaù theù neeä iî thå currenô  directory®  Worä -Master¬  foò  instance¬  haó  á WM.HLÐ filå  whicè  provideó -onlinå documentation¬ anä bù workinç oî drivå Bº iî thå samå -useò  thaô  á WM.HLÐ filå existó oî A:¬  iæ á useò askó  foò -Help¬ Worä Masteò wilì finä it. - - Nameä  Directorieó  caî providå á  morå  human-orienteä -workinç environment®  Thå useò neeä nï longeò remembeò thaô -hió commandó arå iî directorù A15º  -- hå neeä onlù remembeò -thaô  ROOÔ  containó hió commands¬  HELÐ containó  hió  helð -files¬  ROBERÔ  ió hió namå anä thaô ió wherå hå placeó  thå -fileó  hå ió workinç on¬  BDSà ió wherå hió à compileò  is¬ -etc. - - - Nameä  Directorieó arå supporteä bù thå ZCPR³ utilitieó -anä  bù  ZCPR³ itself®  Threå  utilitieó  arå  specificallù -designeä tï deaì witè Nameä Directories¬ anä thå resô oæ thå -utilitieó  caî  accesó Nameä Directorieó manipulateä bù  thå -theså threå anä uså them. - - Thå  threå  ZCPR³ utilitieó whicè  deaì  directlù  witè -Nameä Directorieó are: - - MKDIR -- create a Named Directory - - PWD -- print Working Directory and all - Named Directories - - CD -- log into a Named Directory - -:M - -Command: MKDIR 3.0 - -Syntax: - - MKDIR <-- enter utility -or - MKDIR dir:ufn <-- enter utility and load NDR file - -Function: - - MKDIÒ  ió useä tï creatå Nameä Directorù  Files¬  whicè -arå  fileó oî disë whicè contaiî thå mnemoniã nameó anä  thå -disk/useò  areaó  theù  arå associateä with®  MKDIÒ  ió  aî -editor®  Iô  provideó á scratcè areá iî whicè thå useò  caî -seô uð á nameä directory¬  revie÷ it¬  ediô it¬ anä makå anù -changeó hå wishes®  Wheî satisfied¬  thå useò caî writå  iô -ouô tï disë aó á filå oò aborô anä thro÷ iô away. - - -Options: - None - -Comments: - See Text under "Using MKDIR" - -Selected Error Messages: - Self-Explanatory - -Examples of Use: - See Text under "Using MKDIR" - -:U - Using MKDIR - Cmd Summary - Oncå thå useò ió iî MKDIR¬ hå ió prompteä with: - - MKDIR Command (? for Help)? - -anä  hå  maù issuå thå followinç  single-characteò  commandó -(strikinç RETURÎ ió noô necessary): - - C -- Change Directory (Add, Rename, or Delete Entries) - I -- Initialize Directory - P -- Print Directory - R -- Read in a Directory File - S -- Status of MKDIR Environment - W -- Write out a Directory File - X -- Exit - ? -- Print Help Message - - Nï  fileó  arå affecteä untiì thå useò telló  MKDIÒ  tï -writå thå Directorù Filå oî disk. - - Cmd: C - Thå  Ã  commanä (Changå Directory© ió useä tï ediô  thå -contentó  oæ  thå scratcè environmenô  withiî  MKDIR®  Oncå -invoked¬ thå useò ió prompteä with - - Directory Entry (? for Help)? - - Thå  useò  ió  iî aî inpuô  linå  editoò  now¬  sï  alì -commandó  musô  bå  terminateä bù strikinç  thå  RETURΠ keù -beforå  theù  takå  effect®  Thió ió thå  BDOÓ  inpuô  linå -editor¬ anä strikinç ^à wilì aborô tï ZCPR3. - - Thå useò maù typå ¿ followeä bù strikinç RETURÎ tï finä -ouô whaô hió optionó arå (built-iî help). - - Cmd: C - Undeò  thå à commanä (Changå Directory)¬  thå useò  caî -perforí thå followinç functions: - - . Add a Named Directory Entry to the Directory - . Rename a Named Directory Entry in the Directory - . Delete a Named Directory Entry from the Directory - . Print the Directory - . Print a Help Message - . Exit to MKDIR Command Level - - Iî ordeò tï adä oò renamå á Nameä Directorù Entry¬  thå -useò typeó thå "DU:dirname¢ form® Iæ eitheò thå Disë (D© oò -Useò  (U©  arå omitted¬  currenô disë anä useò arå  assumed® -Thå  "dirname¢  ió  thå mnemoniã namå  associateä  witè  thå -directory¬  uð  tï ¸ characteró long®  Iæ á namå  haó  beeî -associateä  witè thå indicateä disë anä useò already¬  MKDIÒ -wilì renamå iô tï thå ne÷ namå anä telì yoõ thaô iô ió doinç -sï  anä whaô thå olä namå was®  Iæ á namå haó  noô  alreadù -beeî associateä witè thå indicateä disë anä user¬ MKDIÒ wilì -adä thió entrù tï thå directory. - Cmd: C - Iî  ordeò tï deletå á Nameä Directorù Entry¬  thå  useò -typeó  onlù  thå  "DU:¢ form®  Iæ á namå haó  alreadù  beeî -associateä witè thió disë anä user¬ theî iô wilì bå deleted® -Iæ  nï  namå  haó  beeî associated¬  thå  useò  wilì  bå  sï -informed. - - Tï  prinô thå currenô directorù foò  review¬  thå  useò -neeä onlù strikå thå RETURÎ key®  Tï exit¬  thå useò enteró -aî  Ø (uppeò oò loweò case© followeä bù strikinç thå  RETURÎ -key. - - Passwords - Wheî á directorù ió created¬ MKDIÒ promptó thå useò foò -á  password®  Á  passworä  maù  bå  uð  tï  ¸  alphanumeriã -characteró  lonç (MKDIÒ capitalizaeó alì  alphabetics)¬  anä -differenô  passwordó maù bå associateä witè eacè  directory® -Iæ  á  passworä  ió lefô  blank¬  thå  directorù  ió  freelù -accessible. - - Anù  referencå tï á nameä directorù (DIRº  form© bù thå -useò iî á ZCPR³ commanä linå wilì causå ZCPR³ tï prompô  thå -useò  foò  á passworä iæ onå ió assigneä tï  thå  referenceä -directory®  Thå  useò  haó onå chancå tï enteò thå  correcô -password¬  and¬  iæ  incorrect¬  ZCPR³  setó  thå  directorù -referencå  tï thå user'ó currentlù logged-iî  directorù  anä -proceeds with the rest of the command line. - - Cmd: C - Example: - - Assume the following directory: - - A15:ROOT A10:SYS A0:BASE - B0:DEVBASE B1:WORK1 B2:WORK2 - - If the user wishes to delete WORK1, he types - - B1: - - If the user wishes to rename WORK2 to WORK12, he types - - B2:WORK12 - - If the user wishes to add WORK3 as B3:, he types - - B3:WORK3 - - Iî  alì cases¬  lower-caså characteró arå converteä  tï -upper-case. - Cmd: I - Thå É commanä ió useä tï initializå thå directory® Thå -useò  ió askeä iæ hå ió surå hå wantó tï dï  this¬  and¬  iæ -Yes¬  MKDIÒ clearó thå scratcè directory®  É emphasizå thaô -onlù   thå  memory-baseä  scratcè  directorù  oæ  MKDIÒ   ió -effected¬  anä  MKDIÒ  affectó  disë fileó onlù witè  thå  × -(Writå Directory© command. - Cmd: P - Ð ió useä tï Prinô thå Directory® Asidå froí thå nameó -assigneä sï far¬ thå useò ió tolä ho÷ manù entrieó havå beeî -defineä sï faò anä ho÷ manù arå yeô tï bå defined. - - Cmds: R,W - Thå Ò Commanä ió useä tï reaä iî á Directorù Filå anä × -ió useä tï writå iô out®  Wheî MKDIÒ ió firsô  invoked¬  iæ -thå  commanä ió simplù "MKDIR"¬  theî thå defaulô  directorù -filå  ió defineä tï bå NAMES.DIR®  Iæ thå commanä ió "MKDIÒ -dir:filename.typ"¬   theî  thå  defaulô  directorù  filå  ió -defineä  tï  bå  thå  indicateä  filå  anä  iô  ió  reaä  iî -immediatelù (subsequenô Ò commanä ió noô  necessary)®  Wheî -thå useò issueó thå Ò command¬ hå wilì bå prompteä with: - - Name of File ( = filename.typ)? - -Iæ hå strikeó RETURN¬  thå defaulô filå ió read® Otherwise¬ -hå  caî typå iî á filå namå oæ hió choice®  Nï defaulô filå -typå  ió assumed¬  sï thå filå maù bå anù  name®  Thå  samå -prompô appearó tï thå × (Write© command®  Iî botè cases¬ iæ -thå useò wisheó tï enteò hió owî filå name¬ iô maù bå oæ thå -forí  "dir:filename.typ¢ sï hå caî reaä iô froí oò placå  iô -anywhere. - Cmd: W - ×  wilì writå bacë tï thå currenô directorù aó  opposeä -tï  thå  directorù  thå  filå originallù camå  froí  iæ  thå -defaulô forí ió accepted. - Cmd: S - Finally¬  thå  Ó commanä (Status© telló thå  useò  somå -statuó informatioî oî MKDIR. - -:2 - Memory-Based Named Directories - - Nameä  Directorieó  arå implementeä bù loadinç á  *.NDÒ -filå createä bù MKDIÒ intï thå ZCPR³ memorù buffeò  reserveä -tï contaiî thå nameä directorù definition® Oncå loaded¬ alì -directory-to-DÕ associationó iî thå filå arå madå effective¬ -and any ZCPR3 command can make use of them. - - Onå oæ thå manù purposeó oæ LDÒ ió tï loaä á *.NDÒ filå -intï  memory®  LDÒ recognizeó thå NDÒ filå typå tï refeò tï -nameä directorù files¬  anä iô loadó thå file¬ doinç á quicë -formaô  checë tï ensurå thaô iô ió á valiä  nameä  directorù -file. - -:P - -Command: PWD 1.0 - -Syntax: - - PWD o - -Function: - - PWÄ  functionó  tï  displaù  thå  nameó  oæ  thå  nameä -directorieó  tï  thå user®  Iæ thå Ð (Password©  optioî  ió -included¬  theî  thå  passwordó tï thå directorieó  wilì  bå -included in the display IF the Wheel Byte is set. - -Options: - - P - Display Passwords - - -Comments: - - Iæ thå Wheeì Bytå ió noô implementeä foò á system¬ theî -itó addresó ió 0¬ wherå thå JMÐ instructioî tï thå Warí Booô -routinå  iî thå BIOÓ ió located®  Sincå JMÐ ió non-zerï  iî -value¬  thå  Wheeì  Bytå  ió TRUE¬  anä  passwordó  wilì  bå -displayed by PWD. - -Selected Error Messages: - - "Passworä  Requesô Denieä - Noô Wheel¢ meanó thaô thå Ð -optioî  waó  giveî  buô  thå Wheeì  Bytå  waó  noô  set¬  sï -passwords will not be displayed. - - "Nameä Directorù Buffeò Noô Available¢ meanó thaô nameä -directories are not implemented. - - -Examples of Use: - - PWD - -- display named directories - - PWD P or PWD PASSWORD (only leading P is significant) - -- display named directories and passwords - -:C - -Command: CD 3.0 - -Syntax: - - CD dir: -or - CD du: - -Function: - - CÄ   (Changå  Directory©  ió  useä  tï  movå  froí  onå -directorù tï anotheò bù usinç thå nameó oò literaì DÕ  formó -associateä  witè  thå directories®  CÄ firsô logó intï  thå -referenceä directory¬  and¬  iæ therå ió á filå nameä ST.COÍ -iî  it¬  CÄ wilì loç thå useò intï thå referenceä  directorù -anä invokå ST.COM®  Iæ therå ió nï filå nameä ST.COÍ iî thå -directory¬ CÄ wilì simplù loç thå useò in. - - -Options: - None - -Comments: - - Undeò  ZCPR3¬  therå arå twï basiã wayó tï loç  intï  á -directory®  Onå  waù ió bù usinç thå DUº  oò  DIRº  prefix¬ -like: - - B1:ASM>TEXT: -or - B1:ASM>C7: - -The other way is by using CD, like: - - B1:ASM>CD TEXT: -or - B1:ASM>CD C7: - - - Thå tradeofæ ió iî useò efficiency®  Iæ á directorù ió -alwayó  useä foò á particulaò function¬  sucè aó  cataloginç -disks¬  CÄ maù bå preferreä becauså iô wilì noô onlù loç thå -useò  iî  buô  wilì alsï ruî ST.COM¬  whicè caî seô  uð  hió -environment¬  sucè aó bù runninç MENÕ oò somå otheò  prograí -oò grouð oæ programs. - - ST.COÍ ió aî Alias®  Thå onlù purposå oæ SÔ ió tï loaä -thå Multiplå Commanä Linå Buffeò witè á commanä linå wheî iô -ió  executeä  withouô anù options®  Thió commanä  linå  maù -contaiî  á  reasonablå numbeò oæ commandó whicè perforí  anù -desireä seô oæ functions. - - - Iî thå ZCPR³ environment¬ gooä candidatå commandó tï bå -executeä bù runninç SÔ viá CÄ includå thå following: - - LDR file.NDR <-- Set up a new directory environ - PATÈ path-exð <-- Seô uð á ne÷ Commanä Searcè Path - MENU <-- Invoke the MENU Preprocessor - ECHO message <-- Print a Message to the User - - Thå user'ó environmenô caî changå drasticallù bù  usinç -CÄ  tï  loç  intï  á  ne÷  directory®   Thå  nameó  oæ  thå -directorieó  hå  caî  accesó  caî changå  (LDÒ  changeó  thå -Memory-Baseä  names)¬  thå commanä searcè patè hå  useó  caî -change¬  anä  hå caî eveî finä himselæ iî á MENÕ environmenô -oò otheò front-enä insteaä oæ á ZCPR³ commanä environment. - - -Selected Error Messages: - - "Commanä Linå Overflow¢ meanó thaô therå waó noô enougè -rooí  iî  thå commanä linå tï inserô thå commanä  tï  invokå -ST.COM. - -Examples of Use: - - CD TEXT: - -- log into directory TEXT - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/NEWTCAP.Z80 b/Source/Images/d_bp/u15/NEWTCAP.Z80 deleted file mode 100644 index 5bda1668..00000000 --- a/Source/Images/d_bp/u15/NEWTCAP.Z80 +++ /dev/null @@ -1,170 +0,0 @@ -; -; **** DRAFT--Not Final **** -; ZCPR 3.3 System TCAP -; Copyright 1985, 1986 by Richard Conn, Dennis Wright, and Echelon, Inc. -; All Rights Reserved -; -; Note on Padding: -; All entries which have an asterisk (like, *) following -; their one-line explanation have delays which may be -; variable. -; Note on Definition: -; If a function is not available for a particular terminal, -; its string should be 0 and its delay should be 0 (if it has -; a delay). -; -; -; Section 1: Basic Terminal Characteristics -; -; YU Single Character Generated by Uparrow Key on Keyboard -; YD Single Character Generated by Downarrow Key on Keyboard -; YL Single Character Generated by Leftarrow Key on Keyboard -; YR Single Character Generated by Rightarrow Key on Keyboard -; Note: If no arrow keys or arrow keys generate more than -; one character (like VT100), then use WordStar convention -; for these codes: YU=^E, YD=^X, YL=^S, YR=^D -; -; CL Clear Screen String (has a delay which may be variable); -; cursor is placed in home position (upper left corner) when -; this sequence is complete -; -; CM Cursor Motion String (see explanation of codes in the Manual) -; -; CE Clear to End of Line String; cursor is left at original -; position when this sequence is complete -; -; SO Begin Highlighting (Reverse Video or Dim); no character -; positions on the screen are used by this sequence (ie, cursor -; does not move after this sequence is complete) -; SE End Highlighting (return to Normal display intensity); no -; character positions on the screen are used by this sequence -; -; TI Initialize Terminal String; it is preferred that nothing be -; output to the screen by this sequence, but no output is not -; required -; TE Deinitialize Terminal String; it is preferred that nothing -; be output to the screen by this sequence -; -envorg2: - db 'WYSE 50 ' ; Name of Terminal (16 chars) - db 'K'-'@' ; YU (YU = Cursor UP) - db 'J'-'@' ; YD (YD = Cursor DOWN) - db 'L'-'@' ; YL (YL = Cursor LEFT) - db 'H'-'@' ; YR (YR = Cursor RIGHT) - db 0 ; CL Delay (CL = Clear Screen)* - db 0 ; CM Delay (CM = Cursor Motion) - db 0 ; CE Delay (CE = Clear to EOL) - db 1bh,'+',0 ; CL String - db 1bh,'%ia%dR%dC',0 ; CM String - db 1bh,'T',0 ; CE String - db 1bh,')',0 ; SO String (SO = Stand Out Mode) - db 1bh,'(',0 ; SE String (SE = End Stand Out Mode) - db 0 ; TI String (TI = Terminal Init) - db 0 ; TE String (TE = Terminal Deinit) -; -; Section 2: Business Graphics -; -; The following strings are used to create graphics symbols. -; If your terminal does not support business graphics, make (GO) and (GE) -; a non-zero non-printable character that has no effect on your -; terminal and use ASCII characters like '*' to replace the graphics -; characters. Recommended character values are indicated in [], like [*]. -; An alternate recommendation using '.' and ':' will be made with release -; of ZCPRB3. -; - db 0 ; GO Delay (GO = Graphics On) - db 0 ; GE Delay (GE = Graphics End) - db 27,'H',2,0 ; GO - Graphics on string - db 27,'H',3,0 ; GE - Graphics end string - db '2',0 ; GULC - Upper left corner [*] - db '3',0 ; GURC - Upper right corner [*] - db '1',0 ; GLLC - Lower left corner [*] - db '5',0 ; GLRC - Lower right corner [*] - db ':',0 ; GHL - Horizontal line [-] - db '6',0 ; GVL - Vertical line [|] - db '7',0 ; GFB - Full block [*] - db '?',0 ; GHB - Hashed block [#] -; db ';',0 ; GHB - Use this if RSP is used -; on WYSE 50 because the -; ? (01fh) will be confused -; with the ELM end line mark - db '0',0 ; GUI - Upper intersect [+] - db '=',0 ; GLI - Lower intersect [+] - db '8',0 ; GIS - Intersection [+] - db '9',0 ; GRTI - Right intersect [+] - db '4',0 ; GLTI - Left intersect [+] -; -; Section 3: Windowing -; -; The following environmental data must be present if window -; routines are to be used. GCM (Graphic Character Mask) contains -; any bits that are not used by on screen graphics characters. -; GCD (Graphics Chararacter Difference) are the bits that are -; stripped (by the terminal) from a sent graphics character to -; form the on screen graphics character. -; - db 0e0h ; GCM - Graphic character mask byte - db 20h ; GCD - Graphic char difference bit(s) -; -; The next string can be either a terminal control code or an -; address of a user supplied subroutine. If a user supplied routine -; is to be used set the U1 address accordingly. Remember if an -; address is placed here and both bytes of the address are 00h, -; then the RAT string will be used. If the RAT string is null the RSP -; string will be used. At least one of these two functions must be -; available for window routines, RAT is prefered. -; -; If a RAT user supplied routine is to be used it must return the -; characters as follows: -; -; RAT - Read character at cursor position must return the character -; at the current cursor position in the (A) register. -; -; - db 1bh,'M',0 ; RAT - Read char at current cursor - ; position -; db 0 ; Zero if using RSP -; -; Set the following address non-zero if user supplied RAT subroutine -; is to be used. -; - dw 0 ; U1 - Use user supplied RAT routine -; - db 1bh,'7',0 ; RSP - Read screen page -; -; If RSP is to be used the following two bytes must be defined; if not, -; make them zero. -; - db 1fh ; ELM - End of line mark - db 0dh ; EPM - End of screen mark -; -; These bytes are the screen codes sent by the terminal at the end of -; each line (ELM) and end of page (EPM). Some terminals like the WYSE 50 -; may have graphics character codes that are the same as the ELM or EPM -; codes. In this case an alternative graphic character must be used. -; -; Section 4: Extended Terminal Characteristics -; (More to be added in banked ZCPRB3 256-byte version) -; -; CD Clear to End of Display; the cursor is not moved by this -; action -; KL Keyboard Lock; the keys on the keyboard are made inoperative -; KU Keyboard Unlock; the keys on the keyboard are made operative -; -; CDO Cursor Display Off; Cursor is no longer displayed, no -; character positions on the screen are used by this sequence -; CDE Cursor Display Enable; Cursor is displayed, no character -; positions on the screen are used by this sequence -; - db 0 ; CD Delay (CD = Clear to End Display)* - db 1bh,'Y',0 ; CD String - db 1bh,'#',0 ; KL String (KL = Keyboard Lock) - db 1bh,'"',0 ; KU String (KU = Keyboard Unlock) - db 1bh,'`','0',0 ; CDO String (Cursor Display Off) - db 1bh,'`','1',0 ; CDE String (Cursor Display Enable) -; - ds 80H-[$-envorg2] ; Make exactly 80H bytes long -; -; End of ZCPR 3.3 TCAP -; - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/NOTE.COM b/Source/Images/d_bp/u15/NOTE.COM deleted file mode 100644 index 7a491bc1..00000000 Binary files a/Source/Images/d_bp/u15/NOTE.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/NOTE.MAC b/Source/Images/d_bp/u15/NOTE.MAC deleted file mode 100644 index b305a784..00000000 --- a/Source/Images/d_bp/u15/NOTE.MAC +++ /dev/null @@ -1,52 +0,0 @@ -; -; Program: NOTE (Note) -; Author: Richard Conn -; Version: 1.0 -; Date: 8 Mar 84 -; Previous Versions: None -; - -; -; NOTE is a comment - it does nothing except return -; - -; -; Macros and Externals -; - MACLIB Z3BASE.LIB - ext z3init - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - jmp z3init ;initialize the ZCPR3 Env and the VLIB Env - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/PAGE.COM b/Source/Images/d_bp/u15/PAGE.COM deleted file mode 100644 index 78aabb98..00000000 Binary files a/Source/Images/d_bp/u15/PAGE.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/PAGE.MAC b/Source/Images/d_bp/u15/PAGE.MAC deleted file mode 100644 index 3c592d1b..00000000 --- a/Source/Images/d_bp/u15/PAGE.MAC +++ /dev/null @@ -1,1183 +0,0 @@ -; -; PROGRAM: PAGE -; VERSION: 2.0 -; DATE: 18 May 84 -; AUTHOR: RICHARD CONN -; PREVIOUS VERSIONS: 1.2 (26 Apr 83), 1.1 (25 Apr 83), 1.0 (22 Apr 83) -; -VERS equ 20 -z3env SET 0f400h - -; -; PAGE is THE file screen print utility for ZCPR3. Installable by -; Z3INS, PAGE provides a wide range of options for the user. First, PAGE -; allows the user to employ wild cards and file name lists (lists of files -; separated by commas, like: file1,file2,file3,...). Second, PAGE provides -; the following options: -; 0-9 Set Character Print Speed Delay -; I Inspect Files -; The user approves each file to be printed -; before the printing process begins -; L Toggle Line Numbering -; Each line may or may not begin with a line -; number -; P Toggle Screen Paging -; Snnnn Skip to Specified Page -; Printing begins on the indicated page -; -; During paged output, various parameters can be changed dynamically. -; In particular, the letter P toggles screen paging and the digits 0-9 -; vary the speed WHILE the output is being presented. The effect is immediate. -; Control characters may be used to perform additional control functions: -; ^S pauses the output, ^X aborts paging of current file and advances to -; the next file, and ^C aborts to the operating system. -; - -FALSE EQU 0 -TRUE EQU NOT FALSE - -; -; BASIC SYSLIB ROUTINES NEEDED BY TEMPLATE -; -ESIZE EQU 16 ; SIZE OF DIR ENTRY (FROM SYSLIB DIRF ROUTINE) - - EXT DIRQ ; DIRECTORY PROCESSOR - - EXT Z3INIT ; INIT BUFFERS - EXT ZFNAME ; FILE NAME PROCESSOR - EXT GETCRT ; GET CRT PARAMETERS - EXT Z3LOG ; LOG INTO DIR - - EXT INITFCB ; INIT FCB - EXT RETUD ; RETURN CURRENT USER/DISK - EXT PUTUD ; SAVE CURRENT USER/DISK - EXT GETUD ; RESTORE CURRENT USER/DISK - EXT PRINT ; PRINT STRING PTED TO BY RET ADR - EXT PADC ; PRINT A IN DEC - EXT COUT ; CONSOLE OUTPUT ROUTINE - EXT CST ; CONSOLE STATUS ROUTINE - EXT CIN ; CONSOLE INPUT ROUTINE - EXT CAPS ; CAPITALIZE ROUTINE - EXT CRLF ; NEW LINE ROUTINE - EXT CLINE ; COMMAND LINE STRING SAVE ROUTINE - EXT CODEND ; CODE END COMPUTATION ROUTINE - - EXT F$OPEN ; FILE OPEN - EXT F$READ ; BLOCK READ - EXT F$CLOSE ; FILE CLOSE - - EXT EVAL10 ; STRING TO BINARY CONVERSION - EXT PHLDC ; PRINT HL IN DECIMAL ROUTINE - EXT MOVEB ; MOVEB ROUTINE - -; -; CP/M EQUATES -; -CPM EQU 0 ; WARM BOOT -BDOSE EQU CPM+5 ; BDOS ENTRY -FCB EQU CPM+5CH ; FCB -TBUFF EQU CPM+80H ; INPUT LINE BUFFER -DEL EQU 7FH ; -CR EQU 13 ; -FF EQU 12 ; -LF EQU 10 ; -CTRLC EQU 'C'-'@' ; ^C -CTRLG EQU 'G'-'@' -CTRLH EQU 'H'-'@' -CTRLI EQU 'I'-'@' -CTRLS EQU 'S'-'@' -CTRLX EQU 'X'-'@' -CTRLZ EQU 'Z'-'@' - -; -; OTHER EQUATES -; -EOLD EQU 0FFH ; END OF LOAD DELIMITER - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - jmp startx - -; -; **** Special Initial Value Area -; -CWIDTH: - DB 80 ; WIDTH OF SCREEN -CTPP: - DB 22 ; LINES OF TEXT PER SCREEN -CSPP: - DB 1 ; LINES TO SKIP PER SCREEN -; -; NOTE: CTPP + CSPP + 1 (FOOTER SIZE) = TOTAL LINES PER SCREEN ON CONSOLE -; -DLNUMFL: - DB 0 ; LINE NUMBER FLAG (DEFAULT TO NO) -DPAGEFL: - DB 0FFH ; PAGE NUMBER FLAG (DEFAULT TO YES) -DINSPECT: - DB 0 ; INSPECT FILES (DEFAULT TO NO) -DDELAY: - DB 0 ; DELAY COUNT (DEFAULT TO 0) -; -; OTHER BUFFERS -; -SKIPFL: - DB 0 ; SKIP FLAG (DEFAULT TO NO) -SKIPNUM: - DS 2 ; PAGE NUMBER TO SKIP TO -LNUM: - DS 2 ; CURRENT LINE NUMBER -PNUM: - DS 2 ; CURRENT PAGE NUMBER -LNUMFL: - DB 0 ; LINE NUMBER FLAG (DEFAULT TO NO) -PAGEFL: - DB 0FFH ; PAGE NUMBER FLAG (DEFAULT TO YES) -INSPECT: - DB 0 ; INSPECT FILES (DEFAULT TO NO) -DELAY: - DB 0 ; DELAY COUNT (DEFAULT TO 0) - -; -; Start of Program -; -STARTX: - LXI H,0 ; GET STACK PTR - DAD SP - SHLD STACK ; SAVE IT - CALL CODEND ; DETERMINE FREE SPACE - SHLD CMDLNE ; COMMAND LINE BUFFER - LXI D,100H ; BUFFER SIZE - DAD D - SHLD DIRBUF ; ADDRESS OF DIRECTORY BUFFER (TOP OF LOCAL STACK) - SPHL ; SET NEW STACK - CALL PUTUD ; SAVE CURRENT USER/DISK AWAY - - CALL GETCRT ; GET CRT PARAMETERS - MOV A,M - STA CWIDTH - INX H - INX H - MOV A,M ; GET NUMBER OF TEXT LINES - STA CTPP - MOV B,A ; ... IN B - DCX H - MOV A,M ; GET TOTAL NUMBER OF LINES - SUB B ; COMPUTE NUMBER OF LINES TO SKIP/SCREEN - SUI 1 ; 1 LINE FOR PROMPT - STA CSPP - - LXI D,TBUFF+1 ; SAVE COMMAND LINE - LHLD CMDLNE ; GET PTR TO COMMAND LINE SAVE BUFFER - XCHG - MVI B,80H ; SIZE OF LINE - CALL MOVEB ; COPY COMMAND LINE - -; -; **** Banner of Program -; - CALL PRINT - DB 'PAGE, Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0',0 - -; -; Check for Help Request -; - LDA FCB+1 ; GET FIRST CHAR OF FILE NAME - CPI ' ' ; NO FILE SPEC? - JZ HELP - CPI '/' ; OPTION CAUGHT? - JNZ ECONT - -; -; **** Print Help Information -; -HELP: - CALL PRINT - DB CR,LF,'Syntax:' - db cr,lf,' PAGE file1,file2,...,filen o...' - db cr,lf,'Options:' - db cr,lf,' 0-9 Select Delay Constant' - db cr,lf,' I Inspect and Select Files First' - db cr,lf,' L Toggle Numbering of Each Line' - db cr,lf,' P Toggle Paging' - db cr,lf,' Snnnn Skip to Specified Page before Printing' - db cr,lf - db cr,lf,'Examples:' - db cr,lf,' PAGE MYFILE.TXT,*.MAC LI' - db cr,lf,' -- Number Lines, Inspect Files' - db cr,lf,' PRINT MYFILE.* S25' - db cr,lf,' -- Skip to Page 25' - db cr,lf - db cr,lf,'Commands during printout:' - db cr,lf,' ^C - abort PAGE ^X - skip to next file' - db cr,lf,' ^S - suspend output P - toggle paging' - db cr,lf,' 0-9 - change speed' - DB 0 - -; -; RETURN TO OS -; -RETURN: - LHLD STACK ; GET OLD STACK - SPHL ; SET IT - RET - -; -; PROGRAM'S INIT ROUTINE -; -ECONT: - CALL INIT ; PROG INIT ROUTINE -; -; EXTRACT FLAGS IF PRESENT -; - LXI H,0 ; SET FILE COUNT - SHLD FILECNT - LHLD CMDLNE ; PT TO BUFFER -; -; SKIP TO FILE NAME STRING -; - CALL SBLANK ; SKIP OVER BLANKS -; -; SKIP TO END OF FILE NAME STRING -; - CALL SNBLANK ; SKIP OVER NON-BLANKS -; -; CHECK FOR LEADING SLASH ON OPTION AND SKIP IT IF SO -; -OPT: - CPI '/' ; OPTION CHAR? - JNZ OPTION - INX H ; SKIP SLASH -; -; PROCESS LIST OF OPTIONS -; -OPTION: - MOV A,M ; GET BYTE - ORA A ; DONE? - JZ DSPEC - INX H ; PT TO NEXT CHAR - CPI ' ' ; SKIP OVER SPACES - JZ OPTION - MOV C,A ; COMMAND IN C - LXI D,OPTAB ; PT TO OPTION TABLE -OPTL: - LDAX D ; GET OPTION LETTER - ORA A ; END OF TABLE? - JZ HELP ; HELP IF SO - CMP C ; MATCH? - JZ OPTM ; PROCESS IF SO - INX D ; PT TO NEXT ENTRY - INX D - INX D - JMP OPTL -; -; PROCESS OPTION -; -OPTM: - PUSH H ; SAVE HL ON STACK - LXI H,OPTION ; GET RETURN ADDRESS - XTHL ; ... ON STACK AND RESTORE HL - INX D ; PT TO ADDRESS - LDAX D ; GET ADDRESS LOW - MOV B,A ; ... IN B - INX D - LDAX D ; GET ADDRESS HIGH - MOV D,A ; ... IN D - MOV E,B ; LOW IN E - PUSH D ; PUT ADDRESS ON STACK - MOV A,C ; COMMAND IN A - RET ; "CALL" OPTION ROUTINE - -; -; **** PROGRAM INIT ROUTINE -; THIS ROUTINE IS USED BY THE PROGRAM TO PERFORM ANY INITS -; -INIT: - lxi h,dlnumfl ;copy defaults into buffers - lxi d,lnumfl - mvi b,4 ;4 bytes - call moveb ;do copy - xra a ;A=0 - sta skipfl ;set no skip - RET - -; -; **** OPTION TABLE -; EACH OPTION IS A CAPITAL LETTER OR SPECIAL CHAR FOLLOWED BY -; AN ADDRESS; THE TABLE IS TERMINATED BY A BINARY ZERO -; -OPTAB: - db '0' - dw optnum - db '1' - dw optnum - db '2' - dw optnum - db '3' - dw optnum - db '4' - dw optnum - db '5' - dw optnum - db '6' - dw optnum - db '7' - dw optnum - db '8' - dw optnum - db '9' - dw optnum - db 'I' - dw optinsp - db 'L' - dw optln - db 'P' - dw optpage - db 'S' - dw optskip - DB 0 ; END OF TABLE -; -; Set Delay Constant -; -optnum: - sui '0' ;set constant - sta delay - ret -; -; Toggle Inspect Option -; -optinsp: - lda inspect ;flip flag - cma - sta inspect - ret -; -; Set Line Number Flag -; -optln: - lda lnumfl ;flip flag - cma - sta lnumfl - ret -; -; Toggle Paging -; -optpage: - lda pagefl ;flip flag - cma - sta pagefl - ret -; -; Set Skip Flag and get number -; -optskip: - mvi a,0ffh ;set flag - sta skipfl - call eval10 ;get number - xchg - shld skipnum ;set page number to skip to - xchg ;HL pts to next char - mov a,d ;see if page number was zero - ora e - jnz option - xra a ;if zero, just turn off skip flag - sta skipfl - ret -; -; BEGIN MOVING THROUGH FILE NAMES, SEPARATED BY COMMAS -; -DSPEC: - LHLD CMDLNE ; PT TO FIRST BYTE - CALL SBLANK ; SKIP TO NON-BLANK -; -; MAJOR REENTRY POINT WHEN FILE SPECS ARE SEPARATED BY COMMAS -; HL PTS TO FIRST BYTE OF NEXT FILE SPEC -; -DSPEC1: - SHLD HLTMP ; SAVE HL - LHLD DIRBUF ; RESET STACK - SPHL - LHLD HLTMP ; RESTORE HL - CALL GETUD ; RESET USER IF NECESSARY - LXI D,FCB ; PT TO FCB IN DE, PT TO FIRST CHAR OF FILE NAME IN HL - MVI A,0 ; DIR BEFORE DU - CALL ZFNAME ; EXTRACT FILE NAME INTO FCB, AND GET DISK AND USER - SHLD NEXTCH ; SAVE PTR TO DELIMITER WHICH ENDED SCAN - LXI D,FCB ; PT TO FCB - CALL Z3LOG ; LOG INTO DU FOR FILE - -; -; LOAD DIRECTORY AND PERFORM FUNCTION -; -FCT: - LXI D,FCB ; PT TO FCB - CALL INITFCB ; INIT THE FCB - MVI A,11000000B ; SELECT SYS AND NON-SYS FILES - LHLD DIRBUF ; PT TO DIR BUFFER - CALL DIRQ ; LOAD DIR, SELECT FILES, PACK, AND ALPHABETIZE -; -; DETERMINE BEGINNING OF SCRATCH AREA (SCRATCH) AND SIZE IN PAGES (BCNT) -; - PUSH H ; SAVE PTR AND COUNT - PUSH B - LXI D,ESIZE ; SET PTR TO NEXT FREE BLOCK -FCTFRE: - MOV A,B ; DONE? - ORA C - JZ FCTFR1 - DAD D ; PT TO NEXT - DCX B ; COUNT DOWN - JMP FCTFRE -FCTFR1: - INR H ; NEXT PAGE - MVI L,0 - SHLD SCRATCH ; SET PTR TO SCRATCH AREA - XCHG ; PTR IN DE - LHLD BDOSE+1 ; COMPUTE BLOCK BUFFER SIZE - MOV A,H ; ADJUST FOR ZCPR3 - SUI 10 - SUB D ; A=SIZE IN BLOCKS - STA BCNT ; SET BLOCK COUNT - POP B ; RESTORE AND SAVE REGS - POP H -; -; ALLOW USER TO INSPECT FILES -; - PUSH H - PUSH B - CALL ICHECK ; CHECK FOR INSPECT OPTION AND INSPECT IF SET - POP B ; RESTORE COUNT AND PTR - POP H - -; -; PERFORM FUNCTION; HL PTS TO FILE AND BC CONTAINS NUMBER OF FILES -; -FCTL: - MOV A,B ; CHECK FOR COMPLETION (COUNT = 0) - ORA C - JZ FCTL1 - DCX B ; COUNT DOWN - SHLD HLTMP ; SAVE HL - LHLD DIRBUF - SPHL ; SET STACK - LHLD HLTMP ; RESTORE HL - PUSH B ; SAVE COUNT AND PTR - PUSH H - CALL FUNCTION ; PERFORM FUNCTION -FCTLNXT: - LHLD DIRBUF ; RESTORE STACK - LXI D,-4 - DAD D ; RESTORE PTR TO BC, HL - SPHL ; SET STACK - POP H ; RESTORE PTR - POP B ; RESTORE COUNT - LXI D,ESIZE ; PT TO NEXT ENTRY - DAD D - JMP FCTL - -; -; CHECK FOR NEXT FILE SPEC -; -FCTL1: - CALL GETUD ; RETURN TO BASE USER/DISK - LHLD NEXTCH ; GET PTR - MOV A,M ; GET DELIM - CPI ',' ; ANOTHER FILE? - JNZ DRETURN - INX H ; PT TO CHAR AFTER COMMA - JMP DSPEC1 ; CONTINUE PROCESSING - -; -; **** EMERGENCY ABORT -; -ABORT: - CALL PRINT - DB CR,LF,'** PAGE Abort **',CR,LF,0 - CALL GETUD ; RETURN HOME AND FALL THRU TO DRETURN -; -; **** FUNCTION COMPLETE -- CLEANUP AND EXIT -; FILL THIS IN WITH CLEANUP CODE FOR EXIT -; -DRETURN: - JMP RETURN - -; -; **** INSPECT FILES -- THIS ROUTINE IS TO PERFORM A FILE INSPECTION -; ON INPUT, HL PTS TO FIRST 16-BYTE ENTRY AND BC=NUMBER OF ENTRIES -; -ICHECK: - mov a,b ;any files? - ora c - rz - push h ;save ptrs - push b - lxi d,esize ;size of entry -ichk1: - mvi m,0 ;clear MSBytes - dad d ;pt to next - dcx b ;count down - mov a,b ;done? - ora c - jnz ichk1 - pop b ;restore ptrs - pop h - lda inspect ;inspect? - ora a ;0=no - rz - call print - db cr,lf,'PAGE File Inspect Mode' - db cr,lf,' Y (def) = Select File N = Don''t Select File' - db cr,lf,' Q = Select Rest of Files S = Skip Rest of Files' - db cr,lf,0 -ichk2: - call print - db cr,lf,'Select ',0 - call prfn ;print file name - call print - db ' -- (Y/N/Q/S)? ',0 - call cin ;get response - call caps ;capitalize - call cout ;echo - cpi 'Q' ;select rest? - jz ichkyr - cpi 'S' ;skip rest - jz ichknr - cpi 'N' ;no to this one? - jnz ichk3 - mvi m,0ffh ;set NO flag in file FCB -ichk3: - dad d ;pt to next one - dcx b ;count down - mov a,b ;done? - ora c - jnz ichk2 - RET -; Check Rest of Files as Selected -ichkyr: - call print - db cr,lf,' Rest of Files Selected',0 - ret -; Check Rest of Files as NOT Selected -ichknr: - mvi m,0ffh ;set NO flag - dad d ;pt to next - dcx b ;count down - mov a,b ;done? - ora c - jnz ichknr - call print - db cr,lf,' Rest of Files NOT Selected',0 - ret -; -; **** FUNCTION -- MAIN FUNCTION OF TEMPLATE -; ON ENTRY, HL PTS TO NAME OF FILE (16 BYTES) AND USER IS LOGGED INTO -; DIRECTORY CONTAINING INDICATED FILE -; -FUNCTION: -; -; FILE PAGE Routine -- Page the File Whose Name is Pointed to by -; HL; we are already logged into the correct directory -; - mov a,m ;file selected? - ora a ;0=yes - rnz - call prinit ;init print buffers - call fload ;load buffer initially - lhld scratch ;pt to first char in file - shld nxtln ;set pointer to next line -fprloop: - call prline ;print line of file - jnz fprloop ;done if EOF - call page ;advance to top of next page - call prfoot ;print footer - ret -; -; Init Print Buffers and Print File Name -; -prinit: - lxi d,tfcb ;set up FCB - mvi b,12 ;12 bytes - call moveb - lxi h,0 ;HL=0 - shld pnum ;set page number - shld lnum ;set line number - lda ctpp ;set line count - dcr a ;1 less for first line - sta lcount - call print - db cr,lf,'PAGE File: ',0 - lxi h,tfcb ;print file name - call prfn - call crlf - ret -; -; FILE LOAD (FLOAD) Routine -- Initial Load of memory buffer -; -fload: - lxi d,tfcb ;pt to file fcb - call initfcb ;init file's fcb - call f$open ;open file for input - jz fload1 ;open was OK - call print - db cr,lf,'File ',0 - xchg ;HL pts to FCB - call prfn ;print file name - call print - db ' NOT Found',0 - pop d ;clear return address - ret ;abort printout of this file -; -; This is an entry point for further memory loads of the file -; -fload1: - lda bcnt ;get number of blocks to load - mov c,a ;... in C - lhld scratch ;get address of first block to load into - shld nxtblk ;set pointer to next block to load -fload2: - call rdblk ;read a block (128 bytes) - jnz eof ;eof encountered? - call rdblk ;read another block (128 bytes) - jnz eof ;eof encountered? - dcr c ;count down - jnz fload2 - lhld nxtblk ;pt to next byte to load - mvi m,eold ;mark end of load - ret -eof: - lxi d,tfcb ;close file - call f$close - lhld nxtblk ;ensure ^Z - mvi m,ctrlz - ret -rdblk: - lxi d,tfcb ;pt to FCB - call f$read ;read next block - ora a ;error? - rnz - lhld nxtblk ;get ptr to next block - xchg ; as dest - lxi h,tbuff ;ptr to DMA address - mvi b,128 ;copy 128 bytes -rdblk1: - mov a,m ;get byte - ani 7fh ;mask out msb - stax d ;put byte - inx h ;pt to next - inx d - dcr b ;count down - jnz rdblk1 - xchg ;new nxtblock - shld nxtblk - ret - -; -; Line Print Routine -; Print Next Line with Optional Disk Load -; Input Parameter is NXTLN, which is the address of the first char -; on the next line -; Output Parameter is Zero Flag, with Z meaning done with print, NZ -; meaning more yet to print -; -prline: - lhld lnum ;increment line number - inx h - shld lnum - lhld nxtln ;pt to first char of next line - mvi c,0 ;init char count - mov a,m ;get first char of line - cpi ctrlz ;EOF? - cnz prlnum ;print line number (optional) -prl1: - mov a,m ;get char - cpi eold ;end of load? - jz prload - cpi ctrlz ;eof? - jz prexit - inx h ;pt to next char - cpi ctrli ;tab? - jz prtab - cpi cr ;? - jz prcr - cpi ff ;form feed? - jz prff - cpi lf ;end of line? - jz prldn - cpi ctrlh ;back space? - jz prbs - cpi ctrlg ;ring bell? - jz prbell - cpi del ;delete char? - jz prl1 ;skip it - cpi ' ' ;other control char? - jc prl1 ;skip if other control char - call prout ;print char - inr c ;increment char count - call eoltest ;check to see if at end of line and newline if so - jmp prl1 -; -; End of Load Reached -- Load More of File from Disk -; -prload: - push b ;save char count - call fload1 ;use load routine - pop b ;get char count - lhld scratch ;next byte is here - jmp prl1 ;continue processing -; -; Tabulate -; -prtab: - mvi a,' ' ;space - call prout - inr c ;new char - call eoltest ;process EOL - mov a,c ;done? - ani 7 - jnz prtab ;continue tabulation - jmp prl1 ;continue processing -; -; Exit with Zero Flag Set if Done -; -prexit: - xra a ;set zero flag - ret -; -; Carriage Return -- Reset Character Count and Continue -; -prcr: - call prout ;send CR to printer - mvi c,0 ;reset char count - jmp prl1 ;continue processing -; -; Form Feed -- Advance to Top of Next Page -; -prff: - call page ;page eject with heading - mvi c,0 ;reset char count - jmp prl1 ;continue processing -; -; Line Feed -- End of Routine -; -prldn: - call prout ;echo LF to printer - shld nxtln ;set ptr to first char of next line - mvi a,0ffh ;set not done - ora a ;set flags - ret -; -; Backspace on Printer -; -prbs: - mov a,c ;check for beginning of line - ora a - jz prl1 ;continue if at BOL - mvi a,ctrlh ;backspace - call prout - dcr c ;back up char position - jmp prl1 ;continue -; -; Ring Bell on Printer -; -prbell: - call prout ;ring the bell - jmp prl1 ;continue without advancing char position -; -; Test for End of Line and Process if so -; -eoltest: - lda cwidth ;get line width - sui 4 ;4 chars less for continuation mark - mov b,a ;result in B - lda lnumfl ;line numbering (lines are 7 chars shorter if so) - ora a ;0=no - jz eolt1 - mov a,b ;reduce by 7 for line numbers - sui 7 - mov b,a -eolt1: - mov a,b ;get line width - cmp c ;there? - rnz ;continue if not - mov a,m ;get next char - cpi cr ;new line next? - rz ;continue if so - cpi ctrlh ;backspace next? - rz ;continue if so - push h - mvi b,3 ;see if a new line in next 3 chars -eolt2: - inx h - mov a,m ;look for CR - cpi cr - jz eolt3 - dcr b - jnz eolt2 - jmp eolt4 -eolt3: - pop h ;restore ptr - ret -eolt4: - pop h ;restore ptr - mvi a,' ' ;print continuation chars - call prout - mvi a,'<' - call prout - mvi a,'<' - call prout - mvi a,cr ;new line - call prout - mvi a,lf - call prout - mvi c,0 ;reset char position - lda skipfl ;skipping? - ora a ;0=no - rnz - lda lnumfl ;printing line numbers? - ora a ;0=no - rz - call print - db ' : ',0 - ret -; -; Output a character to the console -; A = Character -; -prout: - mov b,a ;char in B - call cst ;check for abort - jnz prout1 - call ctrlin ;get control input -prout1: - lda skipfl ;skipping? - ora a ;set flags (Z=no skip=print char) - mov a,b ;restore char - cz ctrlout ;send character to printer - cpi lf ;special tests if it is a line feed - rnz ;done if non-LF char - lda lcount ;decrement line counter - dcr a - sta lcount - rnz -; -; Paging Required -; Skip to top of next page; reset LCOUNT (Lines Left on Page Count); -; increment PNUM (Screen Number); test for skip stop; print header -; -prout0: - lda ctpp ;get number of text lines per page - sta lcount ;set as new line count - push h ;save ptr - lhld pnum ;increment page number - inx h - shld pnum - lda cspp ;number of lines to skip - call lineskp ;skip lines - pop h ;restore ptr - call prfoot ;print 1-line footer - mov a,m ;check next char - cpi ctrlz ;EOF? - jz fctlnxt ;skip to next file - lda skipfl ;skipping? - ora a ;0=no - push h - cnz skiptst ;affects HL - pop h - ret -; -; Skip out rest of page -; Form Feed Function -; -page: - lda lcount ;get count of remaining lines - call lineskp ;skip lines - jmp prout0 ;process top of new page -; -; Skip out lines on page -; -lineskp: - mov b,a ;line count in B - ora a ;any? - rz - lda skipfl ;skipping? - ora a - rnz - lda pagefl ;paging? - ora a - rz -lines1: - mvi a,cr ;output new line to printer - call cout - mvi a,lf - call cout - dcr b ;count down - jnz lines1 - ret -; -; Control Input -; CTRLIN -- Main Routine Entry Point; Implements Dynamic Commands, -; including P, 0-9, ^S, ^X, and ^C -; CTRLCS -- ^S Reentry Point; Implements all Dyanamic Commands except ^S -; -ctrlcs: - call cin ;get input - jmp ctrlns -ctrlin: - call cin ;get input - cpi ctrls ;pause? - jz ctrlcs -ctrlns: - call caps ;capitalize - cpi ctrlc ;abort? - jz abort - cpi ctrlx ;skip to next - jz fctlnxt - cpi 'P' ;page now? - jz ctrlip - cpi '0' ;delay? - rc - cpi '9'+1 - rnc - sui '0' ;convert to binary - sta delay ;set delay count - ret -ctrlip: - lda pagefl ;toggle paging - cma - sta pagefl - ret -; -; Control Output -; -ctrlout: - push psw ;save char - call cout ;output char - lda delay ;pause? - ora a ;any delay? - jz ctrloz - push h ;delay - push b - mov b,a ;delay count -del1: - lxi h,500 ;delay constant -del2: - xthl ;long NOP - xthl - dcx h ;count down - mov a,h ;done? - ora l - jnz del2 - dcr b ;count down - jnz del1 - pop b ;restore regs - pop h -ctrloz: - pop psw ;restore A - ret -; -; Print Line Number (optional) -; -prlnum: - lda skipfl ;skipping? - ora a ;0=no - rnz - lda lnumfl ;get flag - ora a ;0=don't number lines - rz - push h ;save ptr - lhld lnum ;get line number - call phldc ;print line number - call print ;print separator - db ': ',0 - pop h ;restore ptr - ret -; -; Print 1-line footer -; -prfoot: - lda skipfl ;skipping? - ora a ;0=no - rnz - lda pagefl ;paging? - ora a - rz - push h ;save ptr - call prpnum ;print page heading and number - call prdash ;print dash - lxi h,tfcb ;pt to file FCB - call prfn ;print file name - pop h ;restore ptr - call print - db ' -- Strike Any Key ',0 - call ctrlin ;get control response - jmp crlf ;new line -; -; Test for completion of skipping -; -skiptst: - lhld pnum ;get page number - inx h ;increment for test - xchg ;... in DE - lhld skipnum ;get page to skip to - mov a,h ;compare them - cmp d - rnz - mov a,l - cmp e - rnz - xra a ;A=0 to stop skipping - sta skipfl ;set flag - ret -; -; Print Page Number -; -prpnum: - call print ;print header - db 'Screen ',0 - lhld pnum ;print current page number - call phldc ;print as decimal - ret -; -; Print Separator -; -prdash: - call print - db ' -- ',0 - ret -; -; UTILITIES -; SBLANK -- SKIP BLANKS PTED TO BY HL UNTIL NON-BLANK ENCOUNTERED; HL -; SNBLANK -- SKIP NON-BLANKS PTED TO BY HL UNTIL BLANK OR EOL; HL -; PRFN -- PRINT FILE NAME PTED TO BY HL; AFFECT NOTHING -; - -; -; SKIP UNTIL NON-BLANK -; -SBLANK: - MOV A,M ; LOOK FOR BLANK - INX H ; PT TO NEXT - CPI ' ' ; BLANK? - JZ SBLANK - DCX H ; BACK UP - RET - -; -; SKIP UNTIL BLANK OR EOL -; -SNBLANK: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - CPI ' ' ; BLANK? - JZ SNB1 - ORA A ; EOL? - JNZ SNBLANK -SNB1: - DCX H ; BACK UP - RET - -; -; PRINT FILE NAME PTED TO BY HL -; OUTPUT TO CON: -; -PRFN: - PUSH H ; SAVE REGS - PUSH B - CALL RETUD ; GET CURRENT USER/DISK - MOV A,B ; PRINT DISK - ADI 'A' ; LETTER - CALL COUT - MOV A,C ; PRINT USER - CALL PADC - CALL PRINT - DB ': ',0 - INX H ; PT TO FILE NAME - MVI B,8 ; PRINT NAME - CALL PRNT - MVI A,'.' ; DECIMAL - CALL COUT - MVI B,3 ; PRINT TYPE - CALL PRNT - POP B ; GET REGS - POP H - RET - -; -; PRINT CHARS PTED TO BY HL FOR B BYTES -; OUTPUT TO CON: -; -PRNT: - MOV A,M ; GET CHAR - CALL COUT - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ PRNT - RET - -; -; BUFFERS -; -CMDLNE: - DS 2 ; PTR TO COMMAND LINE STRING -DIRBUF: - DS 2 ; PTR TO DIRECTORY BUFFER -NEXTCH: - DS 2 ; PTR TO NEXT CHAR IN MULTIFILE COMMAND LINE -FILECNT: - DS 2 ; COUNT OF NUMBER OF FILES RENAMED -SCRATCH: - DS 2 ; ADDRESS OF FIRST BYTE OF SCRATCH AREA -BCNT: - DS 1 ; NUMBER OF PAGES IN SCRATCH AREA -HLTMP: - DS 2 ; TEMP BUFFER TO STORE HL -; -; PAGE Buffers -; -tfcb: - ds 36 ; FCB for current file -nxtblk: - ds 2 ; pointer to next block to load -nxtln: - ds 2 ; pointer to next line to read -lcount: - ds 1 ; count of text lines left on page -; -; Stack -; -STACK: - DS 2 ; OLD STACK PTR - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/PATH.COM b/Source/Images/d_bp/u15/PATH.COM deleted file mode 100644 index 7f93512f..00000000 Binary files a/Source/Images/d_bp/u15/PATH.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/PATH.MAC b/Source/Images/d_bp/u15/PATH.MAC deleted file mode 100644 index 40ec138a..00000000 --- a/Source/Images/d_bp/u15/PATH.MAC +++ /dev/null @@ -1,460 +0,0 @@ -; -; PROGRAM: PATH -; VERSION: 3.0 -; AUTHOR: RICHARD CONN -; DATE: 12 Apr 84 -; PREVIOUS VERSIONS: NONE -; DERIVATION: PATH, Version 1.0 (for ZCPR2) of 12 Jan 83 -; -VERS EQU 30 -z3env SET 0f400h - -; -; PATH allows the user to do two things -- display the current path -; and set a new path. Named directories may be used in the definition of -; the new path. -; -; PATH is invoked by the following forms: -; PATH <-- Display Path -; PATH path-expression <-- Set Path -; PATH // <-- Print Help -; - -; -; CP/M Constants -; -cpm equ 0 ;base -fcb equ cpm+5ch -tbuff equ cpm+80h -cr equ 0dh -lf equ 0ah - -; -; SYSLIB Routines -; - ext z3init,eprint,codend,dirtdu,dutdir - ext cout,epstr,pafdc,retud - ext getpath,getmdisk,getmuser,getwhl - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - lxi h,0 ;save stack ptr - dad sp - shld strtstack ; save ptr to original stack - lxi h,tbuff+1 ; pt to command line input - shld cmdline ; save ptr to command line - call retud ; get current disk and user -; -; Print Banner -; - call eprint - db 'PATH Version ' - db vers/10+'0','.',(vers mod 10)+'0',0 - -; -; Check for Help -; - lda fcb+1 ; get first char - cpi '/' ; help? - jnz start1 - call eprint - db cr,lf,'Syntax:' - db cr,lf,' PATH <-- Display Path' - db cr,lf,' PATH expr <-- Set Path' - db 0 - ret - -; -; Check for Error and Continue if not -; -start1: - call getpath ; external path available? - mov a,h ; HL=0 if none - ora l - jnz start2 - call eprint - db ' - Abort: No Path',0 - ret -start2: - call getwhl ; check for wheel - jnz start3 - call eprint - db ' - Abort: No Wheel',0 - ret -start3: - lhld cmdline ; check command line for text - call sblank ; skip to non-blank - shld cmdline ; set ptr to next element - ora a ; EOL=display function - jz pdisp - call codend ; set temporary path - shld pathptr ; point to it - -; -; **** Set New Path **** -; CMDLINE pts to next element -; -pbuild: - lhld cmdline ; pt to next element - call sblank ; skip to non-blank - mov a,m ; get first char of next element - ora a ; EOL? - jz pbdone ; done if so, store path and display - shld token ; save ptr to first byte - mov a,m ; get first char - cpi '$' ; is it current? - jz pbdu ; DU: form - sui 'A' ; convert to number - jc pbdir ; DIR: form - mov b,a ; save number - call getmdisk ; get max disk number - mov c,a - mov a,b - cmp c ; in range? - jnc pbdir ; DIR: form if not - inx h ; pt to next char -- may be DU or DIR - mov a,m ; get next part of element - cpi '$' ; current? - jz pbdu ; is a DU: form -digtst: - cpi ':' ; colon ends it - jz pbdu ; is a DU: form - cpi ' ' ; space ends it - jz pbdu - ora a ; EOL ends it - jz pbdu - cpi '0' ; must be a digit - jc pbdir ; DIR: form if not in range - cpi '9'+1 - jnc pbdir - inx h ; pt to next - mov a,m ; get it - jmp digtst -; -; It is a DU: form -; -pbdu: - lhld pathptr ; pt to path entry - xchg ; ... in DE - lhld token ; pt to token - mov a,m ; current? - cpi '$' - jz pbdu1 - sui 'A'-1 ; convert to number from 1 to n -pbdu1: - stax d ; save disk element - inx h ; pt to next - inx d - mov a,m ; current user? - inx h ; pt to after user in case of match to current - cpi '$' ; current? - jz pbdu2 - dcx h ; pt to first digit - push d ; save ptr to path - call eval10 ; convert to number in C - jc rangerr - call getmuser ; check for max user - inr a - mov b,a ; place max in B - mov a,c ; value in A - cmp b - jnc rangerr - pop d ; get ptr to path -pbdu2: - stax d ; store user number - inx d - mov a,m ; ending with colon? - cpi ':' - jnz pbdu3 - inx h ; skip over colon -pbdu3: - shld cmdline ; save ptr to next command line entry - xchg - shld pathptr ; save ptr to next path entry - jmp pbuild ; continue processing -; -; Build DIR: form -; -pbdir: - lhld token ; pt to name - call dirtdu ; convert to DU in BC - jnz gotud ; process new DU -; -; Entry not found -; -rangerr: - call eprint - db cr,lf,'Bad Expression at ',0 - lhld token ; print string starting at token - call epstr - lhld strtstack ; get original stack - sphl ; set stack ptr - ret -; -; Got User and Disk -- Store in Path -; -gotud: - lhld pathptr ; get ptr to path - inr b ; disk A = 1 - mov m,b ; store disk - inx h - mov m,c ; store user - inx h ; pt to next - shld pathptr - lhld token ; skip over token -gotud1: - mov a,m ; skip to space or EOL - inx h ; pt to next - ora a ; EOL? - jz gotud2 - cpi ' ' ; space? - jnz gotud1 -gotud2: - dcx h ; pt to EOL or space - shld cmdline ; set ptr to next element - jmp pbuild ; continue building -; -; Path Building is Done -- CODEND contains new path -; -pbdone: - lhld pathptr ; store ending zero in path - mvi m,0 - call getpath ; pt to path - xchg ; ... in DE - call codend ; copy temp path into external path -pcopy: - mov a,m ; get disk - stax d ; put disk - ora a ; end of path? - jz pdisp ; done if so and display - inx h ; pt to user - inx d - mov a,m ; get user - stax d ; put user - inx h ; pt to next disk - inx d - jmp pcopy - -; -; **** Display Path Function **** -; -pdisp: - call eprint - db cr,lf,' Symbolic Form: ',0 - call getpath ; pt to external path -pdisp1: - mov a,m ; get disk - ora a ; done? - jz adisp - cpi '$' ; current? - jz pdisp2 - adi '@' ; convert to letter -pdisp2: - call cout ; print disk letter - inx h ; pt to user - mov a,m ; get user number - cpi '$' ; current? - jnz pdisp3 - call cout ; print current indicator - jmp pdisp4 -pdisp3: - call pafdc ; print user number -pdisp4: - call colon - inx h ; pt to next element - mov a,m ; done? - ora a ; 0=yes - cnz arrow - jmp pdisp1 -; -; Print Absolute Path -; -adisp: - call eprint - db cr,lf,' DU Form: ',0 - call retud ; get current user/disk - call getpath ; pt to path -adisp1: - mov a,m ; get disk - ora a ; done? - jz ndisp - cpi '$' ; current? - jnz adisp2 - mov a,b ; get current disk - inr a ; adjust to 1 to n -adisp2: - adi '@' ; convert to letter - call cout ; print disk letter - inx h ; pt to user - mov a,m ; get user - cpi '$' ; current? - jnz adisp3 - mov a,c ; get current user -adisp3: - call pafdc ; print user - call colon - inx h ; pt to next - mov a,m ; done? - ora a - cnz arrow - jmp adisp1 -; -; Print Named Path -; -ndisp: - call eprint - db cr,lf,' DIR Form: ',0 - call getpath ; pt to external path -ndisp1: - call retud ; get current user and disk in C and B - mov a,m ; get disk - ora a ; done? - rz - cpi '$' ; current? - jz ndisp2 - mov b,a ; disk in B - dcr b ; adjust to 0 to n-1 -ndisp2: - inx h ; pt to user - mov a,m ; get it - cpi '$' ; current? - jz ndisp3 - mov c,a ; user in C -ndisp3: - inx h ; pt to next - push h ; save ptr - call udscan ; scan dirs for user/disk and print its name - pop h ; get ptr - call colon - mov a,m ; done? - ora a - cnz arrow - jmp ndisp1 - -; -; **** Utilities **** -; - -; -; Convert Chars pted to by HL to Number in C -; Return with Carry Set if Overflow -; If OK, Value in C and HL pts to character after last digit -; -eval10: - mvi c,0 ; set value -eval1: - mov a,m ; get first digit - sui '0' ; convert to binary - jc evalx ; done with value in C - cpi 10 ; range? - jnc evalx ; done with value in C - mov b,a ; digit in B - mov a,c ; multiply by 10 - add a ; *2 - rc ; error abort - add a ; *4 - rc - add c ; *5 - rc - add a ; *10 - rc - add b ; add value - rc - mov c,a ; value in C - inx h ; pt to next - jmp eval1 -evalx: - ora a ; clear carry flag - ret - -; -; Print Colon -; -colon: - mvi a,':' ; print colon - jmp cout - -; -; Print Arrow -; -arrow: - call eprint - db ' --> ',0 - ret - -; -; Skip to non-blank -; -sblank: - mov a,m ; get char - inx h ; pt to next - cpi ' ' ; space? - jz sblank - dcx h ; pt to non-blank - ret -; -; Scan directories for user and disk in C and B -; Print name if found or "Noname" if not -; -udscan: - call dutdir ; convert to name - jz udscan1 ; error return if no name - mvi b,8 ; 8 chars max -udsprn: - mov a,m ; get name char - cpi ' ' ; done? - rz - call cout ; print char - inx h ; pt to next - dcr b ; count down - jnz udsprn - ret -udscan1: - call eprint - db 'Noname',0 - ret - -; -; Buffers -; -cmdline: - ds 2 ; ptr to next char in command line -token: - ds 2 ; ptr to current token -pathptr: - ds 2 ; ptr to next path entry -strtstack: - ds 2 ; ptr to original stack - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/PATH31.LBR b/Source/Images/d_bp/u15/PATH31.LBR deleted file mode 100644 index 81008dd4..00000000 Binary files a/Source/Images/d_bp/u15/PATH31.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/PPAL.DOC b/Source/Images/d_bp/u15/PPAL.DOC deleted file mode 100644 index 052fe6ad..00000000 --- a/Source/Images/d_bp/u15/PPAL.DOC +++ /dev/null @@ -1,361 +0,0 @@ -;%BEGIN 0 -;%Program: PPAL -;%Author: Richard Conn -;%Version: -VERS equ 3 -;%Date: 3 Sep 1986 -;%Revision History: -;1. 1 Sep 86, Richard Conn -; Initial beta-test release -;2. 3 Sep 86, Richard Conn -; Fixed Z3INS compatability problem -; Created LSy option to control colons after labels of MACRO, SET, -; and EQU -; Placed IF/ELSE/ENDIF at same indentation level -; Change Iy option to IIy option -; Added IMy option for MACRO/ENDM indentation -; Added directives I+ and I- for manual increment and decrement of -; indentation level -; Fixed input line counting problem -;3. 5 Sep 86, Richard Conn -; Added Field3 indentation options for EQU and SET (OE and OS) -; Changed O directive to OC, OE, and OS -; Added comment in directive processor -;%Invocation: PPAL file_list [directive_list] -;%Index: Pretty Assembler -;%Index: PPAL -;%Index: Pretty Printer -;%Description: -; PPAL is a Pretty Printer for Assembly Language for the Z System. -;Its purpose is to reformat assembly language source programs in order to -;have all Z System programs conform to a standard structure. PPAL is highly -;configurable, accepting directives from both the command line and the source -;code itself, so that PPAL may be used to format programs in different ways -;for a variety of standards. -; Directives for specific configuration of the pretty printing process -;may be presented on the command line or within the body of the code in -;special comment lines, beginning with ";#". The following directives are -;recognized. In each general case (like, Au), the first letter indicates the -;directive name, and the following letters indicate types of characters which -;may be specified; specifically: -; o - option chars specific to the directive -; u - case indication, U for Upper-case, L for Lower-case, -; X for unchanged -; y - yes/no indication, Y for Yes, N for No, X for unchanged -; -; ;text - marks a comment in the directive line -; Au - controls the case of operands (arguments) -; AU makes non-quoted alphabetic argument characters upper-case -; AL makes non-quoted alphabetic argument characters lower-case -; AX leaves the case of argument characters unchanged -; By - remove blank lines -; BY (yes) turns on removal of blank lines -; BN (no) turns off removal of blank lines -; BX (unchanged) is the same as BN -; Cou, Coy - comment line formatting (a comment line is a line beginning -; with a semicolon, as opposed to an embedded comment) -; CWy controls removal of the space character after the -; semicolon -; CWY (yes) removes the space after the semicolon if a -; space is present, else no change -; CWN (no) inserts the space after the semicolon if no -; space is present, else no change -; CWX (unchanged) makes no change -; CFu controls case of the first character in the comment line -; CFU makes the first character upper-case -; CFL make the first character lower-case -; CFX leaves the case of the first character unchanged -; CAu controls case of all characters in the comment line -; except the first character if CFU or CFL is in effect -; CAU makes all characters upper-case -; CAL makes all characters lower-case -; CAX leaves the case of all characters unchanged -; Eou, Eoy - embedded comment formatting -; ECy controls placement of the embedded comment if it begins -; after field4 (column 33) -; ECY (yes) places embedded comments on the next line -; ECN, ECX (no, unchanged) leaves embedded comments -; on the same line -; EWy controls removal of the space character after the -; semicolon -; EWY (yes) removes the space after the semicolon if a -; space is present, else no change -; EWN (no) inserts the space after the semicolon if no -; space is present, else no change -; EWX (unchanged) makes no change -; EFu controls case of the first character in the comment -; EFU makes the first character upper-case -; EFL make the first character lower-case -; EFX leaves the case of the first character unchanged -; EAu controls case of all characters in the comment -; except the first character if EFU or EFL is in effect -; EAU makes all characters upper-case -; EAL makes all characters lower-case -; EAX leaves the case of all characters unchanged -; Ioy - indent lines subordinate to IFs or MACROs -; I+ increases the indentation level by 1 character -; I- decreases the indentation level by 1 character (0 min) -; IIy controls indentation for the IF/ELSE/ENDIF pseudo-ops -; IIY causes all opcodes subordinate to an IF to be -; indented one character; each successive IF -; causes another indentation; ENDIF brings the -; indentation level out; ELSE temporarily brings -; the indentation level out for the ELSE pseudo-op -; only -; IIN, IIX (no, unchanged) causes indentation under IFs -; to not take place -; IMy controls indentation for the MACRO/ENDM pseudo-ops -; IMY causes all opcodes subordinate to a MACRO to be -; indented one character; ENDM brings the -; indentation level out -; IMN, IMX (no, unchanged) causes indentation under -; MACROs to not take place -; Lou, Loy - control format of labels -; LFu controls the case of the first character of a label -; LFU makes the first character upper-case -; LFL makes the first character lower-case -; LFX leaves the case of the first character unchanged -; LAu controls the case of all characters in a label except -; the first character if LFU or LFL is in effect -; LAU makes all characters upper-case -; LAL makes all characters lower-case -; LAX leaves the case of all characters unchanged -; LCy controls the presence of a colon after a normal label -; LCY ensures that there is a colon after each label -; LCN ensures that there is no colon after each label -; LCX has no effect on a trailing colon; if one was -; present in the input, it is present in the output -; LSy controls the presence of a colon after a special label, -; where a "special" label is a label in front of a MACRO, -; SET, or EQU pseudo-op -; LSY ensures that there is a colon after a special label -; LSN ensures that there is no colon after a spec label -; LSX has no effect on a trailing colon; if one was -; present in the input, it is present in the output -; LLy controls the presence of a new line following a label -; LLY places a new line after a label -; LLN, LLX does not place a new line after a label -; L8y controls the presence of a new line following a label -; which is longer than 8 characters -; L8Y places a new line after an 8+ character label -; L8N, L8X does not place a new line after an 8+ -; character label -; Oou or Ooy - controls the appearance of opcodes -; OCu - controls the case of opcodes -; OCU makes opcodes upper-case -; OCL makes opcodes lower-case -; OCX leaves the case of opcodes unchanged -; OEy - indent EQU opcode to Field 3 (col 17)? -; OEY indents the EQU opcode to field3 (col 17) -; OEN, OEX indents the EQU opcode to field2 (col 9) -; OSy - indent SET opcode to Field 3 (col 17)? -; OSY indents the SET opcode to field3 (col 17) -; OSN, OSX indents the SET opcode to field2 (col 9) -; -; In addition to the above directives, four predefined formats -;are available via the Fn directive, where 0 <= n <= 3. The predefined -;formats are: -; F0 - reset all directives to null -; Remove blank lines (B): No -; Comment lines -; First char (CF): Unchanged -; All chars (CA): Unchanged -; Remove Space after ; (CW): Unchanged -; Embedded comments -; First char (EF): Unchanged -; All chars (EA): Unchanged -; Remove Space after ; (EW): Unchanged -; Next line if after col 33 (EC): No -; Indentation -; of IFs (II): No -; of MACROs (IM): No -; Labels -; First char (LF): Unchanged -; All chars (LA): Unchanged -; Colon after label (LC): Unchanged -; Colon after special label (LS): Unchanged -; Line after label (LL): Unchanged -; Line after 8+ char label (L8): Unchanged -; Opcodes -; Opcode case (OC): Unchanged -; EQU indentation (OE): Field2 -; SET indentation (OS): Field2 -; Operand (argument) case (A): Unchanged -; -; F1 - Z System standard format -; Remove blank lines (B): No -; Comment lines -; First char (CF): Unchanged -; All chars (CA): Unchanged -; Remove Space after ; (CW): Unchanged -; Embedded comments -; First char (EF): Unchanged -; All chars (EA): Unchanged -; Remove Space after ; (EW): Yes -; Next line if after col 33 (EC): Yes -; Indentation -; of IFs (II): Yes -; of MACROs (IM): Yes -; Labels -; First char (LF): Unchanged -; All chars (LA): Upper -; Colon after label (LC): Yes -; Colon after special label (LS): No -; Line after label (LL): Yes -; Line after 8+ char label (L8): Yes -; Opcodes -; Opcode case (OC): Unchanged -; EQU indentation (OE): Field2 -; SET indentation (OS): Field2 -; Operand (argument) case (A): Lower -; -; F2 - special format -; Remove blank lines (B): Yes -; Comment lines -; First char (CF): Unchanged -; All chars (CA): Unchanged -; Remove Space after ; (CW): Yes -; Embedded comments -; First char (EF): Upper -; All chars (EA): Lower -; Remove Space after ; (EW): Yes -; Next line if after col 33 (EC): Yes -; Indentation -; of IFs (II): Yes -; of MACROs (IM): Yes -; Labels -; First char (LF): Upper -; All chars (LA): Lower -; Colon after label (LC): Yes -; Colon after special label (LS): No -; Line after label (LL): Yes -; Line after 8+ char label (L8): Yes -; Opcodes -; Opcode case (OC): Unchanged -; EQU indentation (OE): Field2 -; SET idnentation (OS): Field2 -; Operand (argument) case (A): Lower -; -; F3 - special format -; Remove blank lines (B): Yes -; Comment lines -; First char (CF): Unchanged -; All chars (CA): Unchanged -; Remove Space after ; (CW): No -; Embedded comments -; First char (EF): Upper -; All chars (EA): Lower -; Remove Space after ; (EW): Yes -; Next line if after col 33 (EC): Yes -; Indentation -; of IFs (II): Yes -; of MACROs (IM): Yes -; Labels -; First char (LF): Unchanged -; All chars (LA): Upper -; Colon after label (LC): Yes -; Colon after special label (LS): No -; Line after label (LL): Yes -; Line after 8+ char label (L8): Yes -; Opcodes -; Opcode case (OC): Unchanged -; EQU indentation (OE): Field2 -; SET indentation (OS): Field2 -; Operand (argument) case (A): Upper -; -; If no directives are given, the format F1 is selected. F1 is always -;selected as the default format, and directives can be used to vary specific -;settings or all settings within this default. -; -; Examples of various forms a label may take on: -; Forms AbCd hello EXEC -; -------- ---- ----- ---- -; LFX, LAX AbCd hello EXEC -; LFU, LAX AbCd Hello EXEC -; LFL, LAX abCd hello eXEC -; LFX, LAU ABCD HELLO EXEC -; LFU, LAU ABCD HELLO EXEC -; LFL, LAU aBCD hELLO eXEC -; LFX, LAL abcd hello exec -; LFU, LAL Abcd Hello Exec -; LFL, LAL abcd hello exec -; -; Directives may be placed in any order with any or no delimiters: -; "LFXLAU" "LFX LAU" "LFX,LAU" -;have the same meanings. This applies to both command lines and comments: -; PPAL file1,file2 LFX LAU -; ;#LFX, LAU -; For directive in comments, the directive processing is terminated -;by either an end of line or a comment character: -; ;#LFX, LAU -; ;#LFX, LAU ; All labels are upper-case -; Note that allowing directives embedded in the files they are acting -;on allows one part of the file to take on one format and another part of the -;file to take on another format. -; -;Sample file before processing by PPAL: -; -; ; Sample file to illustrate PPAL -; ext cout,print -; -; ;#OEY ; Indent EQUs to Col 17 (Field 3) -; -; test equ 1 -; numch equ 26 -; fch equ 'A' -; -; ;#OEN ; Indent EQUs to Col 9 (Field 2) -; -; mymac macro -; call print -; if test -; db 'This is a test' -; else -; db 'This is normal' -; endif -; db ' ',0 -; endm -; -; mymac -; ld b,numch -; ld a,fch -; loop: call cout -; inc a -; djnz loop -; ret -; end -; -;Sample file after processing by PPAL: -; -; ; Sample file to illustrate PPAL -; ext cout,print -; -; ;#OEY ; Indent EQUs to Col 17 (Field 3) -; -; TEST equ 1 -; NUMCH equ 26 -; FCH equ 'A' -; -; ;#OEN ; Indent EQUs to Col 9 (Field 2) -; -; MYMAC macro -; call print -; if test -; db 'This is a test' -; else -; db 'This is normal' -; endif -; db ' ',0 -; endm -; -; mymac -; ld b,numch -; ld a,fch -; LOOP: -; call cout -; inc a -; djnz loop -; ret -; end -; -;%END diff --git a/Source/Images/d_bp/u15/PRINT.COM b/Source/Images/d_bp/u15/PRINT.COM deleted file mode 100644 index 1f31a4cf..00000000 Binary files a/Source/Images/d_bp/u15/PRINT.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/PRINT.MAC b/Source/Images/d_bp/u15/PRINT.MAC deleted file mode 100644 index f95112a9..00000000 --- a/Source/Images/d_bp/u15/PRINT.MAC +++ /dev/null @@ -1,1404 +0,0 @@ -; -; PROGRAM: PRINT III (PRINT) -; VERSION: 2.0 -; DATE: 18 May 84 -; AUTHOR: RICHARD CONN -; PREVIOUS VERSIONS: 1.3 (17 May 83) -; PREVIOUS VERSIONS: 1.2 (26 Apr 83), 1.1 (26 Apr 83), 1.0 (22 Apr 83) -; -VERS equ 20 -z3env SET 0f400h - -FALSE equ 0 -TRUE equ NOT FALSE - -timeok equ FALSE ;TRUE to enable TIME feature, FALSE to disable - -; -; PRINT is THE file print utility for ZCPR3. Installable by Z3INS, -; PRINT provides a wide range of options for the user. First, PRINT allows -; the user to employ wild cards and file name lists (lists of files separated -; by commas, like: file1,file2,file3,...). Second, PRINT provides the -; following options: -; E Exact Mode -; No heading appears, no line numbering, -; no page numbering, tab expansion, form -; feeds -; F File Name Toggle -; The Heading Line can optionally contain -; the name of the file -; H@head@ Heading Text -; The user may specify the text of the heading -; to appear at the top of every page -; I Inspect Files -; The user approves each file to be printed -; before the printing process begins -; L Toggle Line Numbering -; Each line may or may not begin with a line -; number -; M Multiple Runs Toggle -; The user may or may not be prompted to set -; the Top of Form on his printer; Multiple Runs -; ON means that he will not be prompted -; N Toggle Page Numbering -; The numbering of each page is turned on or -; off -; Onn Offset Each Line -; Move each line in the indicated number of -; characters from the left -; Snnnn Skip to Specified Page -; Printing begins on the indicated page -; T Toggle Time Display -; Time/Date information is optionally included -; in the page header -; - -; -; BASIC SYSLIB ROUTINES NEEDED BY PRINT -; -ESIZE EQU 16 ; SIZE OF DIR ENTRY (FROM SYSLIB DIRF ROUTINE) - - EXT DIRQS ; DIRECTORY PROCESSOR - EXT DIRPACK ; PACK DIRECTORY - - EXT Z3INIT ; INIT BUFFERS - EXT ZFNAME ; FILE NAME PROCESSOR - EXT Z3LOG ; LOG INTO DIR - EXT GETPRT ; GET PRINTER DATA - - EXT INITFCB ; INIT FCB - EXT RETUD ; RETURN CURRENT USER/DISK - EXT PUTUD ; SAVE CURRENT USER/DISK - EXT GETUD ; RESTORE CURRENT USER/DISK - EXT EPRINT ; PRINT STRING PTED TO BY RET ADR - EXT PADC ; PRINT A IN DEC - EXT COUT ; CONSOLE OUTPUT ROUTINE - EXT CONDIN ; CONDITIONAL INPUT ROUTINE - EXT CIN ; CONSOLE INPUT ROUTINE - EXT CAPS ; CAPITALIZE ROUTINE - EXT CRLF ; NEW LINE ROUTINE - EXT CLINE ; COMMAND LINE STRING SAVE ROUTINE - EXT CODEND ; CODE END COMPUTATION ROUTINE - - EXT F$OPEN ; FILE OPEN - EXT F$READ ; BLOCK READ - EXT F$CLOSE ; FILE CLOSE - - EXT EVAL10 ; STRING TO BINARY CONVERSION - EXT LHLDC ; LST: HL AS DEC OUTPUT - EXT LPSTR ; LST: (HL) STRING OUTPUT - EXT LPRINT ; LST: STRING OUTPUT - EXT LCRLF ; LST: NEW LINE - EXT LOUT ; LST: OUTPUT - EXT MOVEB ; MOVEB ROUTINE - - if timeok - EXT TIME ; TIME Library Module Routine - endif - -; -; CP/M EQUATES -; -CPM EQU 0 ; WARM BOOT -BDOSE EQU CPM+5 ; BDOS ENTRY -FCB EQU CPM+5CH ; FCB -TBUFF EQU CPM+80H ; INPUT LINE BUFFER -DEL EQU 7FH ; -CR EQU 13 ; -FF EQU 12 ; -LF EQU 10 ; -CTRLC EQU 'C'-'@' ; ^C -CTRLG EQU 'G'-'@' -CTRLH EQU 'H'-'@' -CTRLI EQU 'I'-'@' -CTRLX EQU 'X'-'@' -CTRLZ EQU 'Z'-'@' - -; -; OTHER EQUATES -; -EOLD EQU 0FFH ; END OF LOAD DELIMITER - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - jmp startp -; -; Special Buffer Area -; -LWIDTH: - DB 0 ; WIDTH OF LINE -LTPP: - DB 0 ; LINES OF TEXT PER PAGE -LSPP: - DB 0 ; LINES TO SKIP PER PAGE -LFF: - DB 0 ; FORM FEED FLAG (0=NO) -; -; NOTE: LTPP + LSPP + 2 (HEADER SIZE) = TOTAL LINES PER PAGE ON PRINTER -; -DLNUMFL: - DB 0 ; LINE NUMBER FLAG (DEFAULT TO NO) -DPNUMFL: - DB 0FFH ; PAGE NUMBER FLAG (DEFAULT TO YES) -DEXACT: - DB 0 ; EXACT PRINT FLAG (DEFAULT TO NO) -DFNPFL: - DB 0FFH ; FILE NAME PRINT FLAG (DEFAULT TO YES) -DTIMEPFL: - DB 0FFH ; TIME PRINT FLAG (DEFAULT TO YES) -DMULTFL: - DB 0FFH ; MULTIPLE RUN FLAG (DEFAULT TO YES) -DINSPECT: - DB 0 ; INSPECT FILES (DEFAULT TO NO) -DOFFSET: - DB 0 ; INITIAL COLUMN OFFSET (DEFAULT TO NO COLUMNS) -; -; OTHER BUFFERS -; -SKIPFL: - DB 0 ; SKIP FLAG (DEFAULT TO NO) -SKIPNUM: - DS 2 ; PAGE NUMBER TO SKIP TO -LNUM: - DS 2 ; CURRENT LINE NUMBER -PNUM: - DS 2 ; CURRENT PAGE NUMBER -HBUF: - DS 2 ; PTR TO BUFFER FOR HEADING -; - if timeok -TIMEBF: - DS 2 ; PTR TO BUFFER FOR TIME STAMP - endif -; -LNUMFL: - DB 0 ; LINE NUMBER FLAG (DEFAULT TO NO) -PNUMFL: - DB 0FFH ; PAGE NUMBER FLAG (DEFAULT TO YES) -EXACT: - DB 0 ; EXACT PRINT FLAG (DEFAULT TO NO) -FNPFL: - DB 0FFH ; FILE NAME PRINT FLAG (DEFAULT TO YES) -TIMEPFL: - DB 0FFH ; TIME PRINT FLAG (DEFAULT TO YES) -MULTFL: - DB 0FFH ; MULTIPLE RUN FLAG (DEFAULT TO YES) -INSPECT: - DB 0 ; INSPECT FILES (DEFAULT TO NO) -OFFSET: - DB 0 ; OFFSET ON PAGE - -; -; Start of Program -; -STARTP: - LXI H,0 ; GET STACK PTR - DAD SP - SHLD STACK ; SAVE IT - CALL CODEND ; DETERMINE FREE SPACE - SHLD CMDLNE ; SAVE PTR TO COMMAND LINE - LXI D,100H ; BUFFER SIZE - DAD D - SHLD HBUF ; BUFFER FOR HEADING -; - IF TIMEOK - DAD D - SHLD TIMEBF ; BUFFER FOR TIME DATA - ENDIF -; - DAD D - SHLD DIRBUF ; PTR TO DIR BUFFER - SPHL ; SET TOP OF STACK - - CALL PUTUD ; SAVE CURRENT USER/DISK AWAY - - CALL GETPRT ; GET PRINTER DATA - MOV A,M ; GET PRINTER WIDTH - STA LWIDTH - INX H - INX H - MOV A,M ; GET NUMBER OF LINES OF TEXT - STA LTPP - MOV B,A ; ... IN B - DCX H - MOV A,M ; GET NUMBER OF LINES ON PAGE - SUI 2 - SUB B ; ADJUST FOR PAGING DATA - STA LSPP ; NUMBER OF LINES TO SKIP PER PAGE - INX H - INX H - MOV A,M ; GET FORM FEED FLAG - STA LFF - - LHLD CMDLNE ; PT TO COMMAND LINE SAVE AREA - LXI D,TBUFF+1 ; SAVE COMMAND LINE - XCHG - MVI B,80H ; SIZE OF BUFFER - CALL MOVEB - -; -; **** Banner of Program -; - CALL EPRINT - DB 'PRINT III, Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0',0 - -; -; Check for Help Request -; - LDA FCB+1 ; GET FIRST CHAR OF FILE NAME - CPI ' ' ; NO FILE SPEC? - JZ HELP - CPI '/' ; OPTION CAUGHT? - JNZ ECONT - -; -; **** Print Help Information -; -HELP: - CALL EPRINT - db cr,lf,' PRINT file1,file2,...,filen o...' - DB cr,lf,'Options:' - db cr,lf,' E Exact Print (expand tabs, form feed, no line' - db cr,lf,' or page numbers, no heading)' - db cr,lf,' F Toggle File Name Display' - db cr,lf,' H@head@ Specify Page Heading (@ is any printing char)' - db cr,lf,' I Inspect and Select Files First' - db cr,lf,' L Toggle Numbering of Each Line' - db cr,lf,' M Toggle Multiple Runs (MR=No TOF Msg)' - db cr,lf,' N Toggle Numbering of Each Page' - db cr,lf,' Onn Offset Printout by nn Characters from Left' - db cr,lf,' Snnnn Skip to Specified Page before Printing' -; - if timeok - db cr,lf,' T Toggle Time Display in header' - endif -; - db cr,lf,'Examples:' - db cr,lf,' PRINT MYFILE.TXT,*.MAC LH''SAMPLE''' - db cr,lf,' -- Number Lines, SAMPLE is Heading' - db cr,lf,' PRINT MYFILE.* S25E' - db cr,lf,' -- Skip to Page 25, Exact Print' - db cr,lf,'At any time, ^C aborts PRINT and ^X skips to next ' - db 'file' - DB 0 - -; -; RETURN TO OS -; -RETURN: - LHLD STACK ; GET OLD STACK - SPHL ; SET IT - RET - -; -; PROGRAM'S INIT ROUTINE -; -ECONT: - CALL INIT ; PROG INIT ROUTINE -; -; EXTRACT FLAGS IF PRESENT -; - LHLD CMDLNE ; PT TO BUFFER -; -; SKIP TO FILE NAME STRING -; - CALL SBLANK ; SKIP OVER BLANKS -; -; SKIP TO END OF FILE NAME STRING -; - CALL SNBLANK ; SKIP OVER NON-BLANKS -; -; SKIP TO OPTION CHAR -; - CALL SBLANK -; -; CHECK FOR LEADING SLASH ON OPTION AND SKIP IT IF SO -; -OPT: - CPI '/' ; OPTION CHAR? - JNZ OPTION - INX H ; SKIP SLASH -; -; PROCESS LIST OF OPTIONS -; -OPTION: - MOV A,M ; GET BYTE - ORA A ; DONE? - JZ DSPEC - INX H ; PT TO NEXT CHAR - CPI ' ' ; SKIP OVER SPACES - JZ OPTION - MOV C,A ; COMMAND IN C - LXI D,OPTAB ; PT TO OPTION TABLE -OPTL: - LDAX D ; GET OPTION LETTER - ORA A ; END OF TABLE? - JZ HELP ; HELP IF SO - CMP C ; MATCH? - JZ OPTM ; PROCESS IF SO - INX D ; PT TO NEXT ENTRY - INX D - INX D - JMP OPTL -; -; PROCESS OPTION -; -OPTM: - PUSH H ; SAVE HL ON STACK - LXI H,OPTION ; GET RETURN ADDRESS - XTHL ; ... ON STACK AND RESTORE HL - INX D ; PT TO ADDRESS - LDAX D ; GET ADDRESS LOW - MOV B,A ; ... IN B - INX D - LDAX D ; GET ADDRESS HIGH - MOV D,A ; ... IN D - MOV E,B ; LOW IN E - PUSH D ; PUT ADDRESS ON STACK - MOV A,C ; COMMAND IN A - RET ; "CALL" OPTION ROUTINE - -; -; **** PROGRAM INIT ROUTINE -; THIS ROUTINE IS USED BY THE PROGRAM TO PERFORM ANY INITS -; -INIT: - lxi h,dlnumfl ;copy defaults into buffers - lxi d,lnumfl - mvi b,8 ;8 bytes - call moveb ;do copy - xra a ;A=0 - sta skipfl ;set no skip - push h - lhld hbuf ;pt to heading - mov m,a ;set no heading - pop h -; - if timeok - call time ;get time string - xchg - lhld timebf ;store in buffer - xchg -initt: - mov a,m ;get byte - stax d ;put byte - inx h ;pt to next - inx d - ora a ;done? - jnz initt - endif -; - RET - -; -; **** OPTION TABLE -; EACH OPTION IS A CAPITAL LETTER OR SPECIAL CHAR FOLLOWED BY -; AN ADDRESS; THE TABLE IS TERMINATED BY A BINARY ZERO -; -OPTAB: - db 'E' - dw optexact - db 'F' - dw optfn - db 'H' - dw opthd - db 'I' - dw optinsp - db 'L' - dw optln - db 'M' - dw optmult - db 'N' - dw optpn - db 'O' - dw optoffs - db 'S' - dw optskip -; - if timeok - db 'T' - dw opttime - endif -; - DB 0 ; END OF TABLE -; -; Option: E (Toggle exact mode) -; -optexact: - lda exact ;get flag - cma ;flip it - sta exact ;put flag - ret -; -; Option: F (Toggle file name display) -; -optfn: - lda fnpfl ;get flag - cma ;flip it - sta fnpfl ;put flag - ret -; -; Option: H (Set Heading) -; -opthd: - xchg - lhld hbuf ;pt to heading buffer - xchg - mov a,m ;get delim - ora a ;none? - rz - mov b,a ;delim in B - inx h ;pt to next char -opthd1: - mov a,m ;get next char - ora a ;done? - jz opthd3 - cmp b ;done by trailing delim? - jz opthd2 - stax d ;save char - inx h ;pt to next - inx d - jmp opthd1 -opthd2: - inx h ;skip over delim -opthd3: - xra a ;store ending 0 - stax d - ret -; -; Toggle Inspect Option -; -optinsp: - lda inspect ;flip flag - cma - sta inspect - ret -; -; Set Line Number Flag -; -optln: - lda lnumfl ;flip flag - cma - sta lnumfl - ret -; -; Set Multiple Run Flag -; -optmult: - lda multfl ;flip flag - cma - sta multfl - ret -; -; Set Page Numbering Flag -; -optpn: - lda pnumfl ;flip flag - cma - sta pnumfl - ret -; -; Set Page Offset -; -optoffs: - call eval10 ;get number - mov a,e ;get low-order byte - sta offset ;set offset - ret -; -; Set Skip Flag and get number -; -optskip: - mvi a,0ffh ;set flag - sta skipfl - call eval10 ;get number - xchg - shld skipnum ;set page number to skip to - xchg ;HL pts to next char - mov a,d ;see if page number was zero - ora e - rnz - xra a ;if zero, just turn off skip flag - sta skipfl - ret -; - if timeok -; -; Set Time Flag -; -opttime: - lda timepfl ;flip flag - cma - sta timepfl - ret -; - endif -; -; BEGIN MOVING THROUGH FILE NAMES, SEPARATED BY COMMAS -; -DSPEC: - LHLD CMDLNE ; PT TO FIRST BYTE - CALL SBLANK ; SKIP TO NON-BLANK -; -; MAJOR REENTRY POINT WHEN FILE SPECS ARE SEPARATED BY COMMAS -; HL PTS TO FIRST BYTE OF NEXT FILE SPEC -; -DSPEC1: - SHLD NEXTCH ; SAVE PTR TO NEXT CHAR - LHLD DIRBUF ; RESET STACK - SPHL - CALL GETUD ; RESET USER IF NECESSARY - LXI D,FCB ; PT TO FCB IN DE, PT TO FIRST CHAR OF FILE NAME IN HL - MVI A,0 ; SELECT DIR BEFORE DU - LHLD NEXTCH ; GET PTR TO NEXT CHAR - CALL ZFNAME ; EXTRACT FILE NAME INTO FCB, AND GET DISK AND USER - SHLD NEXTCH ; SAVE PTR TO DELIMITER WHICH ENDED SCAN - -; -; LOAD DIRECTORY AND PERFORM FUNCTION -; -FCT: - LXI D,FCB ; PT TO FCB - CALL Z3LOG ; LOG INTO IT - LXI D,FCB ; PT TO FCB - CALL INITFCB ; INIT THE FCB - LHLD DIRBUF ; PT TO DIR BUFFER AREA - MVI A,11000000B ; SELECT SYS AND NON-SYS FILES - CALL DIRQS ; LOAD DIR, SELECT FILES, PACK, AND ALPHABETIZE -; -; DETERMINE BEGINNING OF SCRATCH AREA (SCRATCH) AND SIZE IN PAGES (BCNT) -; - PUSH H ; SAVE PTR AND COUNT - PUSH B - LXI D,ESIZE ; SET PTR TO NEXT FREE BLOCK -FCTFRE: - MOV A,B ; DONE? - ORA C - JZ FCTFR1 - DAD D ; PT TO NEXT - DCX B ; COUNT DOWN - JMP FCTFRE -FCTFR1: - INR H ; NEXT PAGE - MVI L,0 - SHLD SCRATCH ; SET PTR TO SCRATCH AREA - XCHG ; PTR IN DE - LHLD BDOSE+1 ; COMPUTE BLOCK BUFFER SIZE - MOV A,H ; ADJUST FOR ZCPR3 - SUI 10 - SUB D ; A=SIZE IN BLOCKS - STA BCNT ; SET BLOCK COUNT - POP B ; RESTORE AND SAVE REGS - POP H -; -; ALLOW USER TO INSPECT FILES -; - PUSH H - PUSH B - CALL ICHECK ; CHECK FOR INSPECT OPTION AND INSPECT IF SET - POP B ; RESTORE COUNT AND PTR - POP H - -; -; PERFORM FUNCTION; HL PTS TO FILE AND BC CONTAINS NUMBER OF FILES -; -FCTL: - MOV A,B ; CHECK FOR COMPLETION (COUNT = 0) - ORA C - JZ FCTL1 - DCX B ; COUNT DOWN - SHLD NFPTR - MOV H,B - MOV L,C - SHLD NFCNT - LHLD NFPTR ; PT TO FILE - CALL FUNCTION ; PERFORM FUNCTION -FCTLNXT: - LHLD DIRBUF ; RESET STACK - SPHL - LHLD NFCNT ; RESET FILE COUNT - MOV B,H - MOV C,L - LHLD NFPTR ; RESET FILE PTR - LXI D,ESIZE ; PT TO NEXT ENTRY - DAD D - JMP FCTL - -; -; CHECK FOR NEXT FILE SPEC -; -FCTL1: - CALL GETUD ; RETURN TO HOME USER/DISK - LHLD NEXTCH ; GET PTR - MOV A,M ; GET DELIM - CPI ',' ; ANOTHER FILE? - JNZ DRETURN - INX H ; PT TO CHAR AFTER COMMA - JMP DSPEC1 ; CONTINUE PROCESSING - -; -; **** EMERGENCY ABORT -; -ABORT: - CALL EPRINT - DB CR,LF,'** PRINT Abort **',CR,LF,0 - CALL GETUD ; RETURN HOME AND FALL THRU TO DRETURN -; -; **** FUNCTION COMPLETE -- CLEANUP AND EXIT -; FILL THIS IN WITH CLEANUP CODE FOR EXIT -; -DRETURN: - JMP RETURN - -; -; **** INSPECT FILES -- THIS ROUTINE IS TO PERFORM A FILE INSPECTION -; ON INPUT, HL PTS TO FIRST 16-BYTE ENTRY AND BC=NUMBER OF ENTRIES -; -ICHECK: - mov a,b ;any files? - ora c - rz - push h ;save ptrs - push b - lxi d,esize ;size of entry -ichk1: - mvi m,0 ;clear MSBytes - dad d ;pt to next - dcx b ;count down - mov a,b ;done? - ora c - jnz ichk1 - pop b ;restore ptrs - pop h - lda inspect ;inspect? - ora a ;0=no - rz - call eprint - db cr,lf,'--- PRINT File Inspect Mode ---' - db cr,lf,' Option Function' - db cr,lf,' Y (def) Select File' - db cr,lf,' N Don''t Select File' - db cr,lf,' Q Select Rest of Files' - db cr,lf,' S Skip Rest of Files' - db cr,lf,0 -ichk2: - call eprint - db cr,lf,'Select ',0 - call prfn ;print file name - call eprint - db ' -- (Y/N/Q/S)? ',0 - call cin ;get response - call caps ;capitalize - call cout ;echo - cpi 'Q' ;select rest? - jz ichkyr - cpi 'S' ;skip rest - jz ichknr - cpi 'N' ;no to this one? - jnz ichk3 - mvi m,0ffh ;set NO flag in file FCB -ichk3: - dad d ;pt to next one - dcx b ;count down - mov a,b ;done? - ora c - jnz ichk2 - RET -; Check Rest of Files as Selected -ichkyr: - call eprint - db cr,lf,' Rest of Files Selected',0 - ret -; Check Rest of Files as NOT Selected -ichknr: - mvi m,0ffh ;set NO flag - dad d ;pt to next - dcx b ;count down - mov a,b ;done? - ora c - jnz ichknr - call eprint - db cr,lf,' Rest of Files NOT Selected',0 - ret -; -; **** FUNCTION -- MAIN FUNCTION OF TEMPLATE -; ON ENTRY, HL PTS TO NAME OF FILE (16 BYTES) AND USER IS LOGGED INTO -; DIRECTORY CONTAINING INDICATED FILE -; -FUNCTION: -; -; FILE PRINT Routine -- Print the File Whose Name is Pointed to by -; HL; we are already logged into the correct directory -; - mov a,m ;file selected? - ora a ;0=yes - rnz - lda multfl ;multiple runs? - ora a ;0=no - jnz fprint ;go right into function - call eprint - db cr,lf,'File: ',0 - call prfn ;print file name - call eprint - db ' -- Set Top of Form ',0 - call cin ;get response - cpi ctrlc ;abort? - jz abort - cpi ctrlx - rz -fprint: - call prinit ;init print buffers - call fload ;load buffer initially - call prhead ;print heading line - lhld scratch ;pt to first char in file - shld nxtln ;set pointer to next line -fprloop: - call prline ;print line of file - jnz fprloop ;done if EOF - lda ltpp ;check for new page - mov b,a - lda lcount ;LTPP and Line Count are Equal if New Page - cmp b ;equal? - jnz fprlp1 - call lcrlf ;advance 2 lines - call lcrlf -fprlp1: - call page ;advance to top of next page - ret -; -; Init Print Buffers and Print File Name -; -prinit: - lxi d,tfcb ;set up FCB - mvi b,12 ;12 bytes - call moveb - lxi h,0 ;HL=0 - shld lnum ;set line number - inx h ;HL=1 - shld pnum ;set page number - lda ltpp ;set line count - sta lcount - call eprint - db cr,lf,'Printing File ',0 - lxi h,tfcb ;pt to FCB - call prfn ;print file name - ret -; -; FILE LOAD (FLOAD) Routine -- Initial Load of memory buffer -; -fload: - lxi d,tfcb ;pt to file fcb - call initfcb ;init file's fcb - call f$open ;open file for input - jz fload1 ;open was OK - call eprint - db cr,lf,'File ',0 - xchg ;HL pts to FCB - call prfn ;print file name - call eprint - db ' NOT Found',0 - pop d ;clear return address - ret ;abort printout of this file -; -; This is an entry point for further memory loads of the file -; -fload1: - lda bcnt ;get number of blocks to load - mov c,a ;... in C - lhld scratch ;get address of first block to load into - shld nxtblk ;set pointer to next block to load -fload2: - call rdblk ;read a block (128 bytes) - jnz eof ;eof encountered? - call rdblk ;read another block (128 bytes) - jnz eof ;eof encountered? - dcr c ;count down - jnz fload2 - lhld nxtblk ;pt to next byte to load - mvi m,eold ;mark end of load - ret -eof: - lxi d,tfcb ;close file - call f$close - lhld nxtblk ;ensure ^Z - mvi m,ctrlz - ret -rdblk: - lxi d,tfcb ;pt to FCB - call f$read ;read next block - ora a ;error? - rnz - lhld nxtblk ;get ptr to next block - xchg ; as dest - lxi h,tbuff ;ptr to DMA address - mvi b,128 ;copy 128 bytes -rdblk1: - mov a,m ;get byte - ani 7fh ;mask out msb - stax d ;put byte - inx h ;pt to next - inx d - dcr b ;count down - jnz rdblk1 - xchg ;new nxtblock - shld nxtblk - ret - -; -; Line Print Routine -; Print Next Line with Optional Disk Load -; Input Parameter is NXTLN, which is the address of the first char -; on the next line -; Output Parameter is Zero Flag, with Z meaning done with print, NZ -; meaning more yet to print -; -prline: - call proffs ;print offset - lhld lnum ;increment line number - inx h - shld lnum - lhld nxtln ;pt to first char of next line - mvi c,0 ;init char count - mov a,m ;get first char of line - cpi ctrlz ;EOF? - cnz prlnum ;print line number (optional) -prl1: - mov a,m ;get char - cpi eold ;end of load? - jz prload - cpi ctrlz ;eof? - jz prexit - inx h ;pt to next char - cpi ctrli ;tab? - jz prtab - cpi cr ;? - jz prcr - cpi ff ;form feed? - jz prff - cpi lf ;end of line? - jz prldn - cpi ctrlh ;back space? - jz prbs - cpi ctrlg ;ring bell? - jz prbell - cpi del ;delete char? - jz prl1 ;skip it - cpi ' ' ;other control char? - jc prl1 ;skip if other control char - call prout ;print char - inr c ;increment char count - call eoltest ;check to see if at end of line and newline if so - jmp prl1 -; -; End of Load Reached -- Load More of File from Disk -; -prload: - push b ;save char count - call fload1 ;use load routine - pop b ;get char count - lhld scratch ;next byte is here - jmp prl1 ;continue processing -; -; Tabulate -; -prtab: - mvi a,' ' ;space - call prout - inr c ;new char - call eoltest ;process EOL - mov a,c ;done? - ani 7 - jnz prtab ;continue tabulation - jmp prl1 ;continue processing -; -; Exit with Zero Flag Set if Done -; -prexit: - xra a ;set zero flag - ret -; -; Carriage Return -- Reset Character Count and Continue -; -prcr: - call prout ;send CR to printer - mvi c,0 ;reset char count - jmp prl1 ;continue processing -; -; Form Feed -- Advance to Top of Next Page -; -prff: - call page ;page eject with heading - mvi c,0 ;reset char count - jmp prl1 ;continue processing -; -; Line Feed -- End of Routine -; -prldn: - call prout ;echo LF to printer - shld nxtln ;set ptr to first char of next line - mvi a,0ffh ;set not done - ora a ;set flags - ret -; -; Backspace on Printer -; -prbs: - mov a,c ;check for beginning of line - ora a - jz prl1 ;continue if at BOL - mvi a,ctrlh ;backspace - call prout - dcr c ;back up char position - jmp prl1 ;continue -; -; Ring Bell on Printer -; -prbell: - call prout ;ring the bell - jmp prl1 ;continue without advancing char position -; -; Test for End of Line and Process if so -; -eoltest: - lda offset ;get offset - mov b,a ;... in B - lda lwidth ;get line width - sub b ;compute remaining width - sui 4 ;4 chars less for continuation mark - mov b,a ;result in B - lda lnumfl ;line numbering (lines are 7 chars shorter if so) - ora a ;0=no - jz eolt1 - mov a,b ;reduce by 7 for line numbers - sui 7 - mov b,a -eolt1: - mov a,b ;get line width - cmp c ;there? - rnz ;continue if not - mov a,m ;get next char - cpi cr ;new line next? - rz ;continue if so - mvi b,3 ;see if CR is one of next 3 chars - push h -eolt2: - inx h ;pt to next - mov a,m ;get char - cpi cr - jz eolt2a ;yes, it is - dcr b ;count down - jnz eolt2 - pop h ;restore HL - jmp eolt3 -eolt2a: - pop h ;restore HL - ret ;allow to continue -eolt3: - cpi ctrlh ;backspace next? - rz ;continue if so - mvi a,' ' ;print continuation chars - call prout - mvi a,'<' - call prout - mvi a,'<' - call prout - mvi a,cr ;new line - call prout - mvi a,lf - call prout - mvi c,0 ;reset char position - lda skipfl ;skipping? - ora a ;0=no - rnz - call proffs ;print offset if any - lda lnumfl ;printing line numbers? - ora a ;0=no - rz - call lprint ;print blank for line number - db ' : ',0 - ret -; -; Output a character to the printer -; A = Character -; -prout: - mov b,a ;char in B - call condin ;check for abort - jz prout1 - cpi ctrlc ;abort? - jz abort - cpi ctrlx ;abort this one file? - jz cxabort -prout1: - lda skipfl ;skipping? - ora a ;set flags (Z=no skip=print char) - mov a,b ;restore char - cz lout ;send character to printer - cpi lf ;special tests if it is a line feed - rnz ;done if non-LF char - lda lcount ;decrement line counter - dcr a - sta lcount - rnz -; -; Paging Required -; Skip to top of next page; reset LCOUNT (Lines Left on Page Count); -; print header -; -prout0: - lda ltpp ;get number of text lines per page - sta lcount ;set as new line count - push h ;save ptr - lhld pnum ;increment page number - inx h - shld pnum - lda lspp ;get number of lines to skip per page - call lineskp ;skip lines - pop h ;restore ptr - mov a,m ;check next character - cpi ctrlz ;EOF? - jnz prhead ;print 2-line heading if NOT EOF - ret -; -; Abort current file with final page eject -; -cxabort: - lda lcount ;get count of remaining lines - call lineskp ;skip lines - lda lff ;form feed done? - ora a ;0=no - lda lspp ;number of lines to skip per page - cz lineskp ;skip lines if no previous FF - jmp fctlnxt ;continue with next file -; -; Skip out rest of page -; Form Feed Function -; -page: - lda lff ;form feed in use - ora a ;0=no - jnz prout0 ;process top of new page if form feed in use - lda lcount ;get count of remaining lines - call lineskp ;skip lines - jmp prout0 ;process top of new page -; -; Skip out lines on page -; A = number of lines to skip -; -lineskp: - mov b,a ;line count in B - ora a ;any? - rz - lda skipfl ;skipping? - ora a - rnz - lda lff ;form feed available? - ora a ;0=no - jnz lines2 -lines1: - call lcrlf ;new line - dcr b ;count down - jnz lines1 - ret -lines2: - call lcrlf ;new line - mvi a,ff ;output form feed to printer - jmp lout -; -; Print Line Number (optional) -; -prlnum: - lda skipfl ;skipping? - ora a ;0=no - rnz - lda lnumfl ;get flag - ora a ;0=don't number lines - rz - push h ;save ptr - lhld lnum ;get line number - call lhldc ;print line number - call lprint ;print separator - db ': ',0 - pop h ;restore ptr - ret -; -; Print 2-line heading and control skipping -; -prhead: - push h ;save ptr - lda skipfl ;currently skipping? - ora a ;0=no - cnz skiptst ;test for shut off - lda exact ;exact says no heading - ora a ;0FFH=yes - jnz prhead1 - call proffs ;print offset - lda pnumfl ;number pages? - ora a ;0=no - cnz prpnum ;print page heading and number - lda fnpfl ;print file name? - ora a ;0=no - cnz prfname ;print file name -; - if timeok ;time available? - lda timepfl ;print time? - ora a ;0=no - cnz prtime ;print time - endif -; - push h - lhld hbuf ;pt to heading buffer - mov a,m ;print heading? - pop h - ora a ;0=no - cnz prhdg ;print heading -prhead1: - pop h ;restore ptr -prhead2: - lda skipfl ;skipping? - ora a - rnz - call lcrlf ;new line - jmp lcrlf -; -; Test for completion of skipping -; -skiptst: - lhld pnum ;get page number - xchg ;... in DE - lhld skipnum ;get page to skip to - mov a,h ;compare them - cmp d - rnz - mov a,l - cmp e - rnz - xra a ;A=0 to stop skipping - sta skipfl ;set flag - ret -; -; Print Line Offset -; -proffs: - lda skipfl ;skipping? - ora a - rnz - push b ;save BC - lda offset ;get offset - ora a ;any? - jz proff2 - mov c,a ;offset in B -proff1: - mvi a,' ' ;space over - call prout - dcr c ;count down - jnz proff1 -proff2: - pop b - ret -; -; Print Page Number -; -prpnum: - lda skipfl ;skipping? - ora a - rnz - call lprint ;print header - db 'Page ',0 - lhld pnum ;print current page number - call lhldc ;print as decimal - ret -; -; Print File Name -; -prfname: - lda skipfl ;skipping? - ora a - rnz - call prdash ;print separator - lxi h,tfcb+1 ;pt to first char - mvi b,8 ;8 chars - call lfn1 - mvi a,'.' - call lout - mvi b,3 ;3 chars - call lfn1 - ret -lfn1: - mov a,m ;get char - ani 7fh ;mask - call lout ;send to printer - inx h ;pt to next - dcr b ;count down - jnz lfn1 - ret -; -; Print Separator -; -prdash: - call lprint - db ' -- ',0 - ret -; - if timeok -; -; Print Time -; -prtime: - lda skipfl ;skipping? - ora a - rnz - call prdash ;print separator - lhld timebf ;pt to time stamp - call lpstr ;print - ret -; - endif -; -; Print Header -; -prhdg: - lda skipfl ;skipping? - ora a - rnz - call prdash ;print separator - lhld hbuf ;pt to heading - call lpstr ;print - ret -; -; UTILITIES -; SBLANK -- SKIP BLANKS PTED TO BY HL UNTIL NON-BLANK ENCOUNTERED; HL -; SNBLANK -- SKIP NON-BLANKS PTED TO BY HL UNTIL BLANK OR EOL; HL -; PRFN -- PRINT FILE NAME PTED TO BY HL; AFFECT NOTHING -; - -; -; SKIP UNTIL NON-BLANK -; -SBLANK: - MOV A,M ; LOOK FOR BLANK - INX H ; PT TO NEXT - CPI ' ' ; BLANK? - JZ SBLANK - DCX H ; BACK UP - RET - -; -; SKIP UNTIL BLANK OR EOL -; -SNBLANK: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - CPI ' ' ; BLANK? - JZ SNB1 - ORA A ; EOL? - JNZ SNBLANK -SNB1: - DCX H ; BACK UP - RET - -; -; PRINT FILE NAME PTED TO BY HL -; OUTPUT TO CON: -; -PRFN: - PUSH H ; SAVE REGS - PUSH B - CALL RETUD ; GET CURRENT USER/DISK - MOV A,B ; PRINT DISK - ADI 'A' ; LETTER - CALL COUT - MOV A,C ; PRINT USER - CALL PADC - CALL EPRINT - DB ': ',0 - INX H ; PT TO FILE NAME - MVI B,8 ; PRINT NAME - CALL PRNT - MVI A,'.' ; DECIMAL - CALL COUT - MVI B,3 ; PRINT TYPE - CALL PRNT - POP B ; GET REGS - POP H - RET - -; -; PRINT CHARS PTED TO BY HL FOR B BYTES -; OUTPUT TO CON: -; -PRNT: - MOV A,M ; GET CHAR - CALL COUT - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ PRNT - RET - -; -; BUFFERS -; -CMDLNE: - DS 2 ; PTR TO COMMAND LINE STRING -DIRBUF: - DS 2 ; PTR TO DIRECTORY BUFFER -NFPTR: - DS 2 ; PTR TO NEXT FILE -NFCNT: - DS 2 ; NEXT FILE COUNT -NEXTCH: - DS 2 ; PTR TO NEXT CHAR IN MULTIFILE COMMAND LINE -SCRATCH: - DS 2 ; ADDRESS OF FIRST FREE BYTE -BCNT: - DS 1 ; NUMBER OF PAGES IN SCRATCH AREA -; -; PRINT3 Buffers -; -tfcb: - ds 36 ; FCB for current file -nxtblk: - ds 2 ; pointer to next block to load -nxtln: - ds 2 ; pointer to next line to read -lcount: - ds 1 ; count of text lines left on page -; -; Stack -; -STACK: - DS 2 ; OLD STACK PTR - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/PRINTHLP.LBR b/Source/Images/d_bp/u15/PRINTHLP.LBR deleted file mode 100644 index ab8c2685..00000000 Binary files a/Source/Images/d_bp/u15/PRINTHLP.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/PROTECT.COM b/Source/Images/d_bp/u15/PROTECT.COM deleted file mode 100644 index 792e0f69..00000000 Binary files a/Source/Images/d_bp/u15/PROTECT.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/PROTECT.MAC b/Source/Images/d_bp/u15/PROTECT.MAC deleted file mode 100644 index 7eba5d21..00000000 --- a/Source/Images/d_bp/u15/PROTECT.MAC +++ /dev/null @@ -1,591 +0,0 @@ -; PROGRAM: PROTECT -; VERSION: 3.0 -; DATE: 18 May 84 -; AUTHOR: RICHARD CONN -; PREVIOUS VERSIONS: 2.0 (16 Jan 83) -; PREVIOUS VERSIONS: 1.3 (6 Jan 83), 1.2 (7 Dec 82), 1.1 (10 NOV 82) -; PREVIOUS VERSION: PROTECT.ASM Version 1.0 (26 OCT 81) -VERS equ 30 -z3env SET 0f400h - -; -; PROTECT Command -- -; PROTECT is used to set the file protection and tag attribute bits -; for CP/M 2.x files in the ZCPR3 environment. It is invoked via command -; lines of the following forms: -; PROTECT dir:afn1,dir:afn2,... keys <-- Set unconditionally -; PROTECT dir:afn1,... keys I <-- Inspect Mode -; PROTECT dir:afn1,... C <-- Set each ufn -; -; In the above examples, the reference 'keys' is a string of zero or -; more characters which may be any of the following: -; -; A <-- Set AR Attribute -; R <-- Set R/O Attribute (no R sets R/W) -; S <-- Set SYS Attribute (no S sets Non-System) -; n <-- Set Tag Attribute (1 <= n <= 8) -; -; Examples: -; PROTECT *.COM RS <-- Sets all COM files to R/O SYStem -; PROTECT *.COM RSI <-- Same, with user approval -; PROTECT *.COM C <-- Allows user to specify for each -; PROTECT MYPROG.COM 1R <-- Sets Tag Bit 1 and R/O Attribute -; - -FALSE EQU 0 -TRUE EQU NOT FALSE - -ESIZE EQU 16 ; SIZE OF DIR ENTRY (FROM SYSLIB DIRF ROUTINE) - - EXT DIRQ ; DIRECTORY PROCESSOR - - EXT Z3INIT ; INIT BUFFERS - EXT ZFNAME ; FILE NAME PROCESSOR - EXT Z3LOG ; LOG INTO Z3 DU - - EXT BBLINE ; INPUT LINE EDITOR - EXT INITFCB ; INIT FCB - EXT BDOS ; BDOS ENTRY - EXT PUTUD ; SAVE CURRENT USER/DISK - EXT GETUD ; RESTORE CURRENT USER/DISK - EXT MOVEB ; COPY ROUTINE - EXT PHLDC ; PRINT HL AS DECIMAL CHARS - EXT PRINT ; PRINT ROUTINE - EXT COUT ; CONSOLE OUTPUT ROUTINE - EXT CIN ; CONSOLE INPUT ROUTINE - EXT CAPS ; CAPITALIZE ROUTINE - EXT CRLF ; NEW LINE ROUTINE - EXT FILLB ; FILL ROUTINE - EXT CODEND ; CODE END COMPUTATION ROUTINE - -; -; CP/M EQUATES -; -CPM EQU 0 ; WARM BOOT -FCB EQU 5CH ; FCB -BUFF EQU 80H ; INPUT LINE BUFFER -CR EQU 13 ; -LF EQU 10 ; - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - LXI H,0 ; GET STACK PTR - DAD SP - SHLD STACK ; SAVE IT - CALL CODEND ; DETERMINE FREE SPACE - SHLD CMDLNE ; COMMAND LINE BUFFER - LXI D,100H ; BUFFER SIZE - DAD D - SHLD DIRBUF ; DIR BUFFER - SPHL ; SET SP - CALL PUTUD ; SAVE CURRENT USER/DISK AWAY - - CALL PRINT - DB 'PROTECT Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0',0 - LDA FCB+1 ; GET FIRST CHAR OF FILE NAME - CPI ' ' ; NO FILE SPEC? - JZ HELP - CPI '/' ; OPTION CAUGHT? - JNZ ECONT - -; PRINT HELP INFORMATION -HELP: - CALL PRINT - DB CR,LF,'Syntax:' - DB CR,LF,' PROTECT dir:filename.typ,dir:fn.ft,... o...' - DB CR,LF,'Options:' - DB CR,LF,' C -- Control Mode (Allow user to set each file)' - DB CR,LF,' I -- Inspect Mode (Give user option to set att)' - DB CR,LF,' n -- 1 <= n <= 8; Set Tag Attribute' - DB CR,LF,' A -- Set AR (Archive) Attribute' - DB CR,LF,' R -- Set R/O Attribute (no R sets R/W)' - DB CR,LF,' S -- Set SYS Attribute (no S sets Non-System)' - DB CR,LF - DB 0 - -; RETURN TO OS -RETURN: - LHLD STACK ; GET OLD STACK - SPHL ; SET IT - RET - -; COPY BUFFER INTO TEMP BUFFER -ECONT: - LHLD CMDLNE ; PT TO CMDLNE BUFFER - XCHG - LXI H,BUFF+1 ; PT TO BUFFER - MVI B,80H ; ARBITRARY - CALL MOVEB ; COPY INTO COMMAND LINE BUFFER - -; EXTRACT FLAGS IF PRESENT - XRA A ; SET NO INSPECT, NO R/O, NO ARCH, AND NO SYSTEM FILES - STA INSPECT - STA READONLY - STA SYSTEM - STA ARCHIVE - STA CONTROL ; SET NO CONTROL MODE - MVI B,8 ; CLEAR TAG BITS - LXI H,TAGS - CALL FILLB - LXI H,0 ; SET FILE COUNT - SHLD FILECNT - LHLD CMDLNE ; PT TO BUFFER -; SKIP TO FILE NAME STRING -SBLANK: - MOV A,M ; SKIP TO NON-BLANK - CPI ' ' ; ? - JNZ SBL1 - INX H ; PT TO NEXT CHAR - JMP SBLANK -; SKIP TO END OF FILE NAME STRING -SBL1: - MOV A,M ; SKIP TO OR EOL - ORA A ; DONE? - JZ OPT - CPI ' ' ; - JZ OPT - INX H ; PT TO NEXT - JMP SBL1 -; CHECK FOR LEADING SLASH ON OPTION AND SKIP IT IF SO -OPT: - CPI '/' ; OPTION CHAR? - JNZ OPTION - INX H ; SKIP SLASH -; PROCESS LIST OF OPTIONS -OPTION: - MOV A,M ; GET BYTE - ORA A ; DONE? - JZ DSPEC - INX H ; PT TO NEXT CHAR - CPI ' ' ; SKIP OVER SPACES - JZ OPTION - CPI '/' ; IF OPTION LETTER, OBVIOUS ERROR, SO HELP - JZ HELP - CPI '1' ; DIGIT? - JC HELP - CPI '8'+1 ; IN RANGE? - JC OPTNUM - CPI 'C' ; CONTROL? - JZ OPTCTRL - CPI 'I' ; INSPECT? - JZ OPTINS - CPI 'A' ; ARCHIVE - JZ OPTAR - CPI 'R' ; READ/ONLY? - JZ OPTRO - CPI 'S' ; SYSTEM FILES? - JNZ HELP - MVI A,80H ; SET FOR SYS FILES - STA SYSTEM - JMP OPTION -OPTNUM: - SUI '1' ; ADJUST '1' TO '8' TO 0-7 - PUSH H ; SAVE PTR - MOV E,A ; VALUE IN DE - MVI D,0 - LXI H,TAGS ; PT TO TAG BUFFER - DAD D ; PT TO ELEMENT - MVI M,80H ; SELECT ELEMENT - POP H ; GET PTR TO NEXT CHAR - JMP OPTION -OPTCTRL: - MVI A,0FFH ; CONTROL MODE - STA CONTROL - JMP OPTION -OPTINS: - MVI A,0FFH ; INSPECT - STA INSPECT - JMP OPTION -OPTAR: - MVI A,80H ; SET ARCHIVE - STA ARCHIVE - JMP OPTION -OPTRO: - MVI A,80H ; SET R/O - STA READONLY - JMP OPTION - -; EXTRACT DISK, USER, AND FILE NAME INFORMATION -DSPEC: - LHLD CMDLNE ; PT TO BEFORE FIRST BYTE - DCX H -DSPEC0: - INX H ; PT TO BYTE - MOV A,M ; GET BYTE - ORA A ; DONE? - JZ HELP - CPI ' ' ; ? - JZ DSPEC0 -; -; MAJOR REENTRY POINT WHEN FILE SPECS ARE SEPARATED BY COMMAS -; HL PTS TO FIRST BYTE OF NEXT FILE SPEC -; -DSPEC1: - CALL GETUD ; RESET USER IF NECESSARY - LXI D,FCB ; PT TO FCB IN DE, PT TO FIRST CHAR OF FILE NAME IN HL - MVI A,0 ; DIR BEFORE DU - CALL ZFNAME ; EXTRACT FILE NAME INTO FCB, AND GET DISK AND USER - SHLD NEXTCH ; SAVE PTR TO DELIMITER WHICH ENDED SCAN - LXI D,FCB ; PT TO FCB - CALL Z3LOG ; LOG INTO DU - -; LOAD DIRECTORY AND PROTECT FILES -PROT: - LHLD DIRBUF ; PT TO END OF CODE - MVI A,0C0H ; SELECT NON-SYS AND SYS FILES - LXI D,FCB ; PT TO FCB - CALL DIRQ ; LOAD DIR, SELECT FILES, PACK, AND ALPHABETIZE - -; PROT DIR FILES; HL PTS TO FIRST FILE, BC=FILE COUNT - CALL PROTFILES - -; CHECK FOR NEXT FILE SPEC - LHLD NEXTCH ; GET PTR - MOV A,M ; GET DELIM - CPI ',' ; ANOTHER FILE? - JNZ PROTDONE - INX H ; PT TO CHAR AFTER COMMA - JMP DSPEC1 ; CONTINUE PROCESSING - -; PROT COMPLETE -- PRINT COUNT AND EXIT -PROTDONE: - CALL PRCOUNT ; PRINT FILE COUNT - JMP RETURN - -; PROT SELECTED FILES -PROTFILES: - MOV A,B ; CHECK FOR ANY FILES LOADED - ORA C - RZ - -; PRINT FILE NAME -PROTLP: - PUSH B ; SAVE ENTRY COUNT - CALL CRLF ; NEW LINE - PUSH H ; SAVE PTR TO FCB - INX H ; PT TO FILE NAME - MVI B,8 ; PRINT NAME - CALL PRNT - MVI A,'.' ; DECIMAL - CALL COUT - MVI B,3 ; PRINT TYPE - CALL PRNT - POP H ; GET PTR - -; CHECK FOR CONTROL MODE AND PERFORM CONTROL FUNCTION IF SET - LDA CONTROL ; GET FLAG - ORA A ; NZ=YES - JNZ PROTCTRL - -; CHECK FOR INSPECTION AND INSPECT IF SET - LDA INSPECT ; GET FLAG - ORA A ; 0=NO - JZ DOIT - -; PROMPT USER FOR PROTECT - CALL PROTQ ; PROT QUESTION - CPI 'Q' ; QUIT? - JZ QUIT - CPI 'Y' ; YES? - JZ DOIT - -; DON'T PROTECT FILE -NODO: - CALL PRINT - DB ' ++ NO Attribute Change ++',0 - JMP PROTTEST - -; PROMPT USER FOR PROT -PROTQ: - CALL PRINT ; PRINT PROMPT - DB ' -- Protect (Y/N/Q=Quit/other=N)? ',0 - CALL CIN ; GET RESPONSE - CALL CAPS ; CAPITALIZE - CALL COUT ; ECHO - RET - -; CONTROL FUNCTION -- ALLOW USER TO SET BITS AS HE DESIRES -PROTCTRL: - PUSH H ; SAVE PTR TO FILE - XRA A ; A=0 - STA READONLY ; CLEAR R/O, SYS, ARCHIVE, AND TAGS - STA SYSTEM - STA ARCHIVE - LXI H,TAGS - MVI B,8 - CALL FILLB - CALL PRINT - DB ' -- Attributes (? for Help)? ',0 - MVI A,0FFH ; CAPITALIZE - CALL BBLINE ; INPUT LINE FROM USER - CALL CRLF ; NEW LINE - MVI B,80H ; MSB SET -PCTRL: - MOV A,M ; GET ATTRIBUTE FLAG - ORA A ; DONE? - JZ PDOIT ; DO PROTECTION THEN - INX H ; PT TO NEXT - CPI ' ' ; SKIP - JZ PCTRL - CPI 'Q' ; QUIT? - JZ QUIT - CPI 'A' ; ARCHIVE? - JZ PCTRLA - CPI 'S' ; SYSTEM? - JZ PCTRLS - CPI 'R' ; R/O? - JZ PCTRLR - CPI '1' ; DIGIT? - JC PCTRLH ; HELP IF NOT - CPI '8'+1 ; RANGE? - JC PCTRLN ; DO NUMBER -PCTRLH: - CALL PRINT - DB CR,LF,' Attributes may be specified as follows --' - DB CR,LF,' A = Archive, R = R/O, S = SYS, 1-8 = Tags' - DB CR,LF,' The command Q exits' - DB CR,LF,0 - POP H ; GET FCB PTR - POP B ; GET ENTRY COUNT - JMP PROTLP ; PROCESS AGAIN -PCTRLA: - MOV A,B ; GET FLAG - STA ARCHIVE ; SET FLAG - JMP PCTRL -PCTRLS: - MOV A,B ; GET FLAG - STA SYSTEM ; SET FLAG - JMP PCTRL -PCTRLR: - MOV A,B ; GET AND SET FLAG - STA READONLY - JMP PCTRL -PCTRLN: - PUSH H - SUI '1' ; CONVERT TO OFFSET - MOV E,A ; OFFSET IN DE - MVI D,0 - LXI H,TAGS ; SET TAG - DAD D - MOV M,B ; SET BIT - POP H - JMP PCTRL ; CONTINUE - -; QUIT PROTECT PROGRAM -QUIT: - CALL PRCOUNT ; PRINT COUNT OF FILES PROTECTED - CALL PRINT - DB CR,LF,' QUIT',0 - JMP RETURN - -; PROT FILE, BUT GET PTR FIRST -PDOIT: - POP H ; GET PTR - -; PROT FILE -DOIT: - PUSH H - LXI D,PROTFCB ; COPY TARGET FILE INTO PROTECT'S FCB - MVI B,16 ; 16 BYTES - CALL MOVEB ; COPY - LXI H,TAGS ; SET TAG BITS NOW - INX D ; PT TO FIRST TAG BIT - MVI B,8 ; 8 TAG BITS -DOITL: - LDAX D ; GET BYTE FROM PROT FCB - ANI 7FH ; MASK OUT OLD MSB - ORA M ; OR IN TAG BIT - STAX D ; PUT BYTE BACK - INX H ; PT TO NEXT - INX D - DCR B ; COUNT DOWN - JNZ DOITL - LDA READONLY ; GET R/O BIT - MOV B,A ; SAVE IN B - LDAX D ; GET BYTE - ANI 7FH ; MASK OUT OLD MSB - ORA B ; OR IN NEW MSB - STAX D ; PUT IT BACK - INX D ; PT TO SYS BIT - LDA SYSTEM ; GET SYS BIT - MOV B,A ; SAVE IT - LDAX D ; GET BYTE - ANI 7FH ; MASK OUT OLD MSB - ORA B ; MASK IN NEW MSB - STAX D ; PUT IT BACK - INX D ; PT TO ARCHIVE BIT - LDA ARCHIVE ; GET ARCHIVE BIT - MOV B,A ; SAVE IT - LDAX D ; GET BYTE - ANI 7FH ; MASK OUT OLD MSB - ORA B ; MASK IN NEW MSB - STAX D ; PUT IT BACK - LXI D,PROTFCB ; PT TO FCB - CALL INITFCB ; INIT IT - MVI C,30 ; SET FILE ATTRIBUTES - CALL BDOS - CALL PRINT - DB ' Set to ',0 - LXI H,PROTFCB+1 - MVI B,8 ; 8 TAGS - MVI C,'1' ; SET DIGIT -PATTL1: - MOV A,M ; GET BYTE - ANI 80H ; PRINT ATT? - JZ PATTL2 - MOV A,C ; GET DIGIT - CALL COUT -PATTL2: - INR C ; INCREMENT DIGIT - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ PATTL1 - MOV A,M ; GET R/O BYTE - ANI 80H ; MASK IT - JZ PATTL3 - CALL PRINT - DB ' R/O ',0 - JMP PATTL4 -PATTL3: - CALL PRINT - DB ' R/W ',0 -PATTL4: - INX H ; PT TO SYS BYTE - MOV A,M ; GET SYS BYTE - ANI 80H ; MASK IT - JZ PATTL5 - CALL PRINT - DB 'SYS',0 - JMP PATTL6 -PATTL5: - CALL PRINT - DB 'DIR',0 -PATTL6: - INX H ; PT TO ARCHIVE BYTE - MOV A,M ; GET ARCH BYTE - ANI 80H ; MASK IT - JZ PATTL7 - CALL PRINT - DB ' AR',0 -PATTL7: - LHLD FILECNT ; INCREMENT FILE COUNT - INX H - SHLD FILECNT - POP H ; GET PTR TO DIRECTORY ENTRY - -; PT TO NEXT ENTRY -PROTTEST: - LXI D,ESIZE ; PT TO NEXT ENTRY - DAD D - POP B ; GET COUNT - DCX B ; COUNT DOWN - MOV A,B ; CHECK FOR ZERO - ORA C - JNZ PROTLP - -; RETURN TO CALLER - RET - -; -; PRINT CHARS PTED TO BY HL FOR B BYTES -; -PRNT: - MOV A,M ; GET CHAR - CALL COUT - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ PRNT - RET - -; -; PRINT COUNT OF NUMBER OF FILES PROTECTED -; -PRCOUNT: - CALL CRLF ; NEW LINE - LHLD FILECNT ; GET COUNT - MOV A,L ; CHECK FOR NONE - ORA H - JZ PRNO - CALL PHLDC ; PRINT DECIMAL COUNT - JMP PRMS -PRNO: - CALL PRINT - DB 'No ',0 -PRMS: - LHLD FILECNT ; 1 FILE PROTECTED? - MOV A,H ; HIGH ZERO? - ORA A - JNZ PRMULT - MOV A,L ; LOW ONE? - CPI 1 - JZ PRSING -PRMULT: - CALL PRINT - DB ' Files Protected',0 - RET -PRSING: - CALL PRINT - DB ' File Protected',0 - RET - -; -; BUFFERS -; -INSPECT: - DS 1 ; INSPECT FLAG (0=NO, 0FFH=YES) -CONTROL: - DS 1 ; CONTROL FLAG (0=NO, 0FFH=YES) -ARCHIVE: - DS 1 ; ARCHIVE FLAG (0=NO, 80H=YES) -SYSTEM: - DS 1 ; SYSTEM FLAG (0=NO, 80H=YES) -READONLY: - DS 1 ; READ/ONLY FLAG (0=NO, 80H=YES) -TAGS: - DS 8 ; 8 TAG BITS -NEXTCH: - DS 2 ; PTR TO NEXT CHAR IN MULTIFILE COMMAND LINE -FILECNT: - DS 2 ; COUNT OF NUMBER OF FILES PROTECTED -PROTFCB: - DS 40 ; FCB FOR PROTECT -CMDLNE: - DS 2 ; PTR TO COMMAND LINE SAVE AREA -DIRBUF: - DS 2 ; DIRECTORY BUFFER -STACK: - DS 2 ; OLD STACK PTR - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/PWD.COM b/Source/Images/d_bp/u15/PWD.COM deleted file mode 100644 index dc7fe7f9..00000000 Binary files a/Source/Images/d_bp/u15/PWD.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/PWD.MAC b/Source/Images/d_bp/u15/PWD.MAC deleted file mode 100644 index 8c3a2cdd..00000000 --- a/Source/Images/d_bp/u15/PWD.MAC +++ /dev/null @@ -1,249 +0,0 @@ -; -; Program: PWD -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; -version equ 10 - -; -; The purpose of PWD is to display the names of the named directories. -; If the option PASS (P) is given, then the passwords to the directories will -; be displayed as well IF the Wheel Byte is Available and Set. If the Wheel -; Byte is not available, the passwords will be displayed without question. -; - -; -; Basic Equates -; -z3env SET 0f400h ;address of ZCPR3 Environment -fcb equ 5ch -cr equ 0dh -lf equ 0ah - -; -; External References -; - ext z3init - ext cout,crlf,print,padc - ext qprint,qcrlf - ext getndr,getwhl - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env -; -; Print Banner -; - call qprint ;check quiet flag - db 'PWD, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db cr,lf,0 -; -; Check for options -; - lxi h,fcb+1 ;pt to option char - mov a,m ;get option char - cpi '/' ;help? - jz prhelp - cpi ' ' ;no option? - jz namedir - cpi 'P' ;passwords? - jnz invopt ;bad option if not -; -; Prepare to process passwords - check for authorization -; - call getwhl ;get wheel byte - jnz namedir ;permission granted - call print - db ' Password Request Denied - Not Wheel',cr,lf,0 - mvi m,' ' ;clear option -; -; Print Named Directory Info -; -namedir: - call getndr ;get location of directory - jnz ndir1 - call print - db ' Named Directory Buffer Not Available',0 - ret -; -; Print Names of Directory Elements -; -ndir1: - lda fcb+1 ;see if passwords included - cpi 'P' - jz ndir1p -; -; Print Header if Not Quiet for Non-Password Entries -; - mvi b,4 ;4 times -ndir1a: - call qprint ;print banner (optional) - db ' DU : DIR Name ',0 - dcr b ;count down - jnz ndir1a - call qcrlf ;new line - mvi b,4 ;4 more times -ndir1b: - call qprint - db '---- -------- ',0 - dcr b ;count down - jnz ndir1b - call qcrlf ;new line - jmp ndir1z -; -; Print Header if Not Quiet for Password Entries -; -ndir1p: - mvi b,2 ;2 times -ndir1c: - call qprint - db ' DU : DIR Name - Password ',0 - dcr b ;count down - jnz ndir1c - call qcrlf - mvi b,2 -ndir1d: - call qprint - db '---- -------- -------- ',0 - dcr b ;count down - jnz ndir1d - call qcrlf -; -; Begin Output Processing -; -ndir1z: - mvi c,0 ;set entry count - mvi b,1 ;set disk 1 -; -; Print Each Resident Command Name -; -ndir2: - mov a,m ;get table entry - ora a ;end of table? - rz ;exit - cmp b ;same disk? - jz ndir3 -; -; Advance to Next Set of Entries for New Disk -; - mov b,a ;set new disk - mov a,c ;get count - ani 3 ;see if newline already given - cnz crlf ;complete current line - call crlf ;1 additional line - mvi c,0 ;reset count -ndir3: - push b ;save counters -; -; Print DU: -; - mov a,m ;get disk - adi '@' ;convert to letter (A to P) - call cout - inx h ;pt to user - mov a,m ;get user - call padc ;print user number - call print ;print separator - db ': ',0 - inx h ;pt to name -; -; Print DIR -; - call prname ;print name of directory - lda fcb+1 ;check for password option - cpi 'P' - jnz ndir4 - call print - db ' - ',0 - call prname ;print name of password - pop b ;get counters - inr c ;another entry - push b ;save counters - jmp ndir5 -; -; Advance to Next and Print Separator -; -ndir4: - lxi b,8 ;skip over password - dad b -; -; Print Separator -; -ndir5: - call print ;print separator - db ' ',0 - pop b ;get counters -; -; New Line Counter -; - inr c ;increment entry counter - mov a,c ;check for done - ani 3 ;every 4 - cz crlf ;new line - jmp ndir2 -; -; Print 8-char name (directory or password) and advance ptr -; -prname: - mvi b,8 ;print name -prn1: - mov a,m ;get char - call cout - inx h ;pt to next - dcr b ;count down - jnz prn1 - ret -; -; Print Invalid Option and then Help Messages -; -invopt: - call print - db cr,lf,'Invalid Option',cr,lf,0 ;fall thru to PRHELP -; -; Print Help Message -; -prhelp: - call print - db cr,lf,'PWD - Print Working Directories',cr,lf - db cr,lf,'PWD Syntax:' - db cr,lf,' PWD or PWD P' - db cr,lf - db cr,lf,'where just "PWD" prints the names of the directories' - db cr,lf,'and "PWD P" (for PWD PASSWORD) prints the names and' - db cr,lf,'passwords of the directories if the user has Wheel' - db cr,lf,'Powers',0 - ret - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/QUIET.COM b/Source/Images/d_bp/u15/QUIET.COM deleted file mode 100644 index 0a373556..00000000 Binary files a/Source/Images/d_bp/u15/QUIET.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/QUIET.MAC b/Source/Images/d_bp/u15/QUIET.MAC deleted file mode 100644 index 4eaa4302..00000000 --- a/Source/Images/d_bp/u15/QUIET.MAC +++ /dev/null @@ -1,139 +0,0 @@ -; -; Program: QUIET -; Author: Richard Conn -; Version: 1.0 -; Date: 29 Mar 84 -; -version equ 10 -z3env SET 0f400h - -; -; QUIET is used to set and reset the Quiet Flag in ZCPR3. -; The forms of the command are: -; -; QUIET DISPLAY <-- Display Setting -; QUIET RESET <-- Turn Quiet Off -; QUIET SET <-- Turn Quiet On -; QUIET / <-- Print Help -; - -; -; Equates -; -fcb equ 5ch -cr equ 0dh -lf equ 0ah - -; -; SYSLIB and Z3LIB Routines -; - ext z3init,print,envptr - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - -; -; Print Banner -; - call print - db 'QUIET Version ' - db (version/10)+'0','.',(version mod 10)+'0',0 - -; -; Check for Command -; - lda fcb+1 ;get first char - cpi 'R' ;reset? - jz qreset - cpi 'S' ;set? - jz qset - cpi 'D' ;display? - jz display - -; -; Print help -; -help: - call print - db cr,lf,'QUIET - Set/Reset/Display Quiet Flag' - db cr,lf,'Syntax:' - db cr,lf,' QUIET D or QUIET DIS - Display Quiet Flag' - db cr,lf,' QUIET R or QUIET RES - Quiet Flag Off' - db cr,lf,' QUIET S or QUIET SET - Quiet Flag On' - db 0 - ret - -; -; Reset Quiet -; -qreset: - call ptquiet ;pt to Quiet Flag - mvi m,0 ;reset it - jmp display - -; -; Set Quiet -; -qset: - call ptquiet ;pt to Quiet Flag - mvi m,0ffh ;set it - -; -; Display Quiet Flag -; -display: - call print - db ' - Quiet Flag is ',0 - call ptquiet ;pt to Quiet Flag - mov a,m ;get it - ora a ;0=reset - jz disres - call print - db 'Set (On)',0 - ret -disres: - call print - db 'Reset (Off)',0 - ret - -; -; Return with HL pting to Quiet Flag -; -ptquiet: - lhld envptr ;pt to environment - lxi d,28H ;offset to flag - dad d - ret - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/READ.ME b/Source/Images/d_bp/u15/READ.ME deleted file mode 100644 index 2db5f323..00000000 --- a/Source/Images/d_bp/u15/READ.ME +++ /dev/null @@ -1,434 +0,0 @@ - ZCPR3 Distribution Files, Phase 1 - - Richard Conn - - - - The following listings show all of the ZCPR3 Distribution Files -in Phase 1 of the distribution. All files are: - - Copyright(c) 1984 Richard Conn - All Rights Reserved - United States Copyright Pending - - The ZCPR3 System is released for non-commercial distribution within -the ZCPR2 and ZCPR3 user communities. No licenses are required for non- -commercial distribution. Licenses for commercial distribution (fee requested) -within marketed products are available from Echelon, Inc. See the References -section of the Installation Manual for details on how to contact Echelon, Inc. - - - -ZCPR3 Disk 1 -- - Filename.Typ Size Recs CRC Lines - 1 SYSENV .ASM 1K 5 4C5C 30 - 2 SYSENV .LIB 4K 26 CF64 135 - 3 SYSIOP .ASM 32K 254 1DCD 1220 - 4 SYSNDR .ASM 1K 3 3872 16 - 5 SYSNDR .LIB 2K 10 DA46 82 - 6 Z3BASE1 .LIB 9K 66 2C69 275 - 7 Z3BASE2 .LIB 8K 64 17AD 272 - 8 Z3HDR1 .LIB 19K 150 6B50 608 - 9 Z3HDR2 .LIB 19K 150 2C19 608 - 10 ZCPR3 .ASM 66K 522 2857 2906 - 11 ZCPR3 .INS 4K 28 52CF 160 - -ZCPR3 Disk 2 -- - Filename.Typ Size Recs CRC Lines - 1 SYSFCP .ASM 18K 137 7012 944 - 2 SYSRCP .ASM 44K 352 6315 2305 - 3 Z3TCAP .ASM 24K 189 3701 872 - Filename.Typ Size Recs CRC Lines - 4 SYSFCP1 .LIB 6K 43 C3BB 213 - 5 SYSFCP2 .LIB 6K 43 2324 213 - 6 SYSRCP1 .LIB 11K 81 F030 366 - 7 SYSRCP2 .LIB 11K 81 790C 367 - 8 SYSRCP3 .LIB 11K 81 52FB 366 - 9 SYSRCP4 .LIB 11K 81 871D 366 - - Filename.Typ Size Recs CRC - 1 SYSLIB .REL 21K 161 2921 - 2 VLIB .REL 2K 13 01A1 - 3 Z3LIB .REL 7K 56 61B8 - Filename.Typ Size Recs CRC - 4 Z3TCAP .TCP 7K 51 FB17 - -ZCPR3 Disk 3 -- - Filename.Typ Size Recs CRC Version - 1 ALIAS .COM 4K 30 82D4 1.1 - 2 CD .COM 1K 7 DA48 3.0 - 3 CMDRUN .COM 1K 2 21B5 N/A - 4 COMMENT .COM 1K 5 3C4A 2.0 - 5 CPSEL .COM 1K 8 CCAA 1.0 - 6 CRC .COM 6K 41 A89C 2.0 - 7 DEV .COM 2K 14 F755 1.0 - 8 DEVICE .COM 3K 17 153E 1.0 - 9 DIFF .COM 4K 25 45A7 2.0 - 10 DIR .COM 2K 16 9B8A 1.0 - 11 ECHO .COM 1K 4 F2D6 1.0 - 12 ERASE .COM 3K 20 E71E 5.0 - 13 ERROR1 .COM 2K 12 5EB7 1.0 - 14 ERROR2 .COM 3K 18 2F03 1.0 - 15 ERROR3 .COM 1K 5 8542 1.0 - 16 ERROR4 .COM 1K 5 86D1 1.0 - 17 ERRORX .COM 1K 3 F941 1.0 - 18 FINDF .COM 2K 14 D2A6 2.0 - 19 GOTO .COM 1K 6 6ADA 1.0 - 20 HELP .COM 3K 24 928B 5.0 - 21 HELPCK .COM 2K 16 F3B3 1.0 - 22 HELPPR .COM 5K 35 12E7 1.0 - 23 IF .COM 3K 18 418D 1.1 - 24 IFSTAT .COM 1K 3 6586 1.0 - 25 LDR .COM 3K 20 A14E 1.0 - 26 MCOPY .COM 4K 32 8341 4.0 - 27 MENU .COM 4K 27 8CED 3.2 - 28 MENUCK .COM 3K 20 3CDC 1.0 - 29 MKDIR .COM 6K 41 014B 3.0 - 30 NOTE .COM 1K 1 CB9E 1.0 - 31 PAGE .COM 5K 36 DF9F 2.0 - 32 PATH .COM 2K 10 E421 3.0 - 33 PRINT .COM 6K 42 0492 2.0 - 34 PROTECT .COM 4K 28 A130 3.0 - 35 PWD .COM 1K 8 2B9B 1.0 - 36 QUIET .COM 1K 4 DF6B 1.0 - 37 RECORD .COM 1K 8 C2B4 3.0 - 38 REG .COM 1K 8 1CC4 1.0 - 39 RENAME .COM 4K 27 A2F2 3.0 - 40 SAK .COM 1K 7 7842 2.0 - 41 SETFILE .COM 1K 4 00B2 1.0 - 42 SH .COM 4K 28 A89E 1.0 - 43 SHCTRL .COM 1K 7 E37A 1.0 - 44 SHDEFINE.COM 3K 23 0DEA 1.0 - 45 SHFILE .COM 1K 4 634F 1.0 - 46 SHOW .COM 8K 62 808A 1.0 - 47 SHVAR .COM 3K 23 4D89 1.0 - 48 SUB .COM 3K 20 59E5 3.0 - 49 TCCHECK .COM 2K 14 7235 1.0 - 50 TCMAKE .COM 6K 47 B3A0 1.0 - 51 TCSELECT.COM 3K 22 7C29 1.0 - 52 UNERASE .COM 2K 13 5057 1.0 - 53 WHEEL .COM 2K 11 0CD0 3.0 - 54 XD .COM 4K 28 465B 1.2 - 55 XDIR .COM 8K 62 7248 2.0 - 56 Z3INS .COM 2K 16 DFB7 1.0 - 57 Z3LOC .COM 1K 7 A908 1.0 - 58 ZEX .COM 6K 48 5E36 3.0 - -ZCPR3 Disk 4 -- - Filename.Typ Size Recs CRC Lines - 1 ALIAS .HLP 5K 35 9C58 166 - 2 CMDFILES.HLP 24K 192 4475 728 - 3 COMPARE .HLP 5K 33 26B6 148 - 4 DIRS .HLP 21K 166 29F5 602 - 5 HELP .HLP 1K 7 54CD 20 - 6 HELPSYS .HLP 29K 230 99DA 792 - 7 IF .HLP 13K 99 45A4 457 - 8 IO .HLP 12K 92 21E3 389 - 9 MENU .HLP 32K 253 9059 892 - 10 NDIRS .HLP 16K 122 33D7 439 - 11 SH .HLP 13K 101 6646 419 - 12 SYSRCP .HLP 6K 48 F633 231 - -ZCPR3 Disk 5 -- - Filename.Typ Size Recs CRC Lines - 1 Z3RES .HLP 8K 64 800E 221 - 2 Z3TCAP .HLP 40K 314 381F 1105 - 3 Z3UTIL1 .HLP 30K 234 4B2D 988 - 4 Z3UTIL2 .HLP 21K 166 D3E6 763 - 5 ZCPR3 .HLP 4K 30 666E 105 - -ZCPR3 Disk 6 -- - Filename.Typ Size Recs CRC Lines - 1 ALIAS .ZEX 2K 9 6DBE 63 - 2 ALIAS0 .MAC 8K 63 5072 431 - 3 ALIAS1 .MAC 10K 75 DB42 513 - 4 CD .MAC 3K 22 4202 151 - 5 CMDRUN .MAC 1K 7 F21D 50 - 6 COMMENT .MAC 4K 28 FF64 195 - 7 CPSEL .MAC 7K 52 2669 364 - 8 CRC .MAC 18K 141 15ED 914 - 9 DEV .MAC 9K 71 D980 492 - 10 DEVICE .MAC 11K 84 6EED 576 - 11 DIFF .MAC 15K 115 B983 724 - 12 DIR .MAC 7K 54 2227 373 - 13 ECHO .MAC 4K 28 824C 180 - 14 ERASE .MAC 10K 79 765E 492 - 15 ERROR1 .MAC 8K 57 7BF1 308 - 16 ERROR2 .MAC 9K 66 DFF6 367 - 17 ERROR3 .MAC 4K 27 85FA 153 - 18 ERROR4 .MAC 4K 31 D179 178 - 19 ERRORX .MAC 2K 9 7F9C 68 - 20 FINDF .MAC 22K 171 4220 1049 - 21 GOTO .MAC 4K 27 4536 203 - 22 HELP .MAC 25K 195 FF6A 1207 - 23 HELPCK .MAC 10K 77 A576 519 - 24 HELPPR .MAC 28K 219 CFB6 1380 - 25 IF .MAC 10K 77 F529 526 - 26 IFSTAT .MAC 2K 11 234E 85 - -ZCPR3 Disk 7 -- - Filename.Typ Size Recs CRC Lines - 1 LDR .MAC 11K 88 E5E0 552 - 2 MCOPY .MAC 22K 170 B694 1059 - 3 MENU .MAC 31K 241 D3F6 1509 - 4 MENUCK .MAC 11K 87 B04C 545 - 5 MKDIR .MAC 19K 145 64CB 981 - 6 NOTE .MAC 1K 7 986F 51 - 7 PAGE .MAC 24K 187 AEFF 1182 - 8 PATH .MAC 9K 69 7D6A 459 - 9 PRINT .MAC 28K 219 A093 1403 - 10 PROTECT .MAC 13K 97 E175 590 - 11 PWD .MAC 5K 37 DF00 248 - 12 QUIET .MAC 3K 17 FA09 138 - 13 RECORD .MAC 4K 30 4EE7 193 - 14 REG .MAC 5K 37 401A 266 - 15 RENAME .MAC 13K 103 C4F5 592 - 16 SAK .MAC 5K 38 62C2 244 - 17 SETFILE .MAC 2K 16 73D5 107 - 18 SHCTRL .MAC 3K 21 CAE6 147 - 19 SHOW .MAC 31K 247 8770 1752 - -ZCPR3 Disk 8 -- - Filename.Typ Size Recs CRC Lines - 1 SH .MAC 16K 125 768D 806 - 2 SHDEFINE.MAC 11K 87 396F 658 - 3 SHFILE .MAC 2K 15 3417 104 - 4 SHVAR .MAC 11K 88 6B60 655 - 5 SUB .MAC 23K 183 4AA9 1042 - 6 TCCHECK .MAC 5K 40 7079 280 - 7 TCMAKE .MAC 19K 148 A0C7 1084 - 8 TCSELECT.MAC 11K 87 927E 571 - 9 UNERASE .MAC 14K 110 A09A 726 - 10 WHEEL .MAC 4K 32 FFCF 217 - 11 XD .MAC 18K 144 B1B2 855 - 12 XDIR .MAC 38K 304 8B4B 1887 - 13 Z3INS .MAC 10K 80 7F27 539 - 14 Z3LOC .MAC 4K 30 3583 211 - 15 ZEX .ASM 45K 360 48BD 2194 - 16 ZEX .ZEX 4K 32 782C 180 - -ZCPR3 Disk 9 -- - Filename.Typ Size Recs CRC Lines - 1 Z3INS .IDX 4K 32 6044 232 - 2 Z3INS .SI 31K 241 836B 771 - 3 Z3INS .TOC 13K 101 D54E 207 - 4 Z3INS1 .SI 11K 85 30E0 267 - 5 Z3INS2 .SI 11K 88 2800 339 - 6 Z3INS3 .SI 55K 439 FCCF 1919 - 7 Z3INS4 .SI 28K 224 16D3 998 - 8 Z3INS5 .SI 5K 39 984C 153 - 9 Z3INS6 .SI 33K 259 D8A1 1014 - 10 Z3INS7 .SI 2K 12 F0A3 32 - 11 Z3INS8 .SI 5K 34 EB11 154 - -ZCPR3 Disk 10 -- - Filename.Typ Size Recs CRC Lines - 1 Z3USER .IDX 1K 3 9F34 30 - 2 Z3USER .SI 54K 428 7D58 1886 - 3 Z3USER .TOC 1K 6 1810 24 - - -SYSLIB3 Disk 1 -- - Filename.Typ Size Recs CRC Lines - 1 S0FILEIO.MAC 2K 12 6AA7 86 - 2 S1FILEIO.MAC 2K 12 29E9 86 - 3 S2FILEIO.MAC 2K 12 EE8F 86 - 4 S3FILEIO.MAC 2K 12 B0F6 86 - 5 SALLOC .MAC 3K 22 F78F 113 - 6 SBBLINE .MAC 3K 17 1D79 88 - 7 SBDOS .MAC 1K 4 D833 26 - 8 SBIN .MAC 1K 4 AC82 27 - 9 SBIOS .MAC 3K 17 241E 79 - 10 SBIST .MAC 1K 4 3522 28 - 11 SBLINE .MAC 3K 21 1871 98 - 12 SBOUT .MAC 1K 4 4DF6 30 - 13 SCAPIN .MAC 1K 4 DF2E 28 - 14 SCAPS .MAC 1K 4 22F3 24 - 15 SCAPSTR .MAC 1K 5 FCEA 35 - 16 SCATH .MAC 1K 5 A665 33 - 17 SCCOUT .MAC 2K 9 A488 59 - 18 SCIN .MAC 1K 7 47D4 43 - 19 SCLINE .MAC 2K 11 583E 57 - 20 SCLOUT .MAC 2K 9 2A8B 59 - 21 SCODEND .MAC 1K 8 4F9C 44 - 22 SCOMP .MAC 2K 10 C619 56 - 23 SCOMPHD .MAC 1K 4 67BE 27 - 24 SCONDIN .MAC 1K 6 6666 33 - 25 SCOUT .MAC 1K 7 0A76 46 - 26 SCPOUT .MAC 2K 9 F3B0 59 - 27 SCRC .MAC 3K 24 9649 120 - 28 SCRC1 .MAC 3K 24 7A5D 120 - 29 SCRC2 .MAC 3K 23 E929 118 - 30 SCRLF .MAC 1K 6 6CD3 42 - 31 SCST .MAC 1K 7 B601 45 - 32 SDIR .MAC 2K 15 D2C8 64 - 33 SDIR00 .MAC 2K 15 D5BC 64 - 34 SDIR01 .MAC 2K 12 C259 63 - 35 SDIR02 .MAC 3K 17 5193 104 - 36 SDIR03 .MAC 3K 17 D263 85 - 37 SDIR04 .MAC 2K 11 5228 62 - 38 SDIR05 .MAC 7K 56 754A 282 - 39 SDIR06 .MAC 10K 79 D1DF 423 - 40 SDIR07 .MAC 3K 17 4FA3 111 - 41 SDIR08 .MAC 2K 12 4F2F 65 - 42 SDIR09 .MAC 2K 14 75BA 83 - 43 SDIR10 .MAC 2K 13 3DE7 72 - 44 SDIRBF .MAC 1K 5 F2DC 31 - 45 SDIRQ .MAC 17K 136 6004 708 - 46 SDIRQS .MAC 20K 155 51F3 786 - 47 SEN .MAC 1K 3 F9CF 23 - 48 SEPRINT .MAC 1K 5 2A31 26 - 49 SEPSTR .MAC 2K 15 68B3 91 - 50 SEVAL .MAC 4K 25 13D5 146 - 51 SEVAL1 .MAC 2K 9 782D 66 - 52 SEVAL2 .MAC 2K 11 1BDC 74 - 53 SEVAL3 .MAC 2K 10 BD45 66 - 54 SEVAL4 .MAC 2K 9 10A5 58 - 55 SFCLOS .MAC 1K 4 710C 33 - 56 SFDEL .MAC 1K 4 BB5B 28 - 57 SFEXIST .MAC 1K 5 2C94 31 - 58 SFILEIO .MAC 9K 72 4F9C 418 - 59 SFILL .MAC 2K 10 A547 70 - 60 SFMAKE .MAC 1K 5 5A73 31 - -SYSLIB3 Disk 2 -- - Filename.Typ Size Recs CRC Lines - 1 SFNAME .MAC 5K 39 EB46 245 - 2 SFOPEN .MAC 2K 10 6B08 64 - 3 SFREAD .MAC 1K 4 3E4E 30 - 4 SFRENAME.MAC 2K 12 6A58 80 - 5 SFSIZE .MAC 2K 12 DCDF 91 - 6 SFWRIT .MAC 1K 4 67E3 30 - 7 SFXIO .MAC 9K 65 7928 406 - 8 SGFA .MAC 3K 20 DDA9 130 - 9 SGUA .MAC 1K 5 C628 43 - 10 SINITFCB.MAC 1K 8 FFE8 47 - 11 SINLINE .MAC 6K 44 4103 285 - 12 SINSTR .MAC 2K 12 3077 71 - 13 SISALNUM.MAC 1K 6 2867 40 - 14 SISALPHA.MAC 1K 6 02B4 41 - 15 SISCTRL .MAC 1K 6 533C 40 - 16 SISDIGIT.MAC 1K 6 EDAB 38 - 17 SISGRAPH.MAC 1K 6 EEF8 38 - 18 SISHEX .MAC 1K 6 1958 43 - 19 SISPRINT.MAC 1K 6 EC30 38 - 20 SISPUN .MAC 2K 9 0F59 58 - 21 SISSP .MAC 1K 8 7B4B 59 - 22 SLA2HC .MAC 1K 6 70AD 38 - 23 SLADC .MAC 2K 11 72AE 75 - 24 SLAFDC .MAC 2K 10 843B 62 - 25 SLCRLF .MAC 1K 6 A98A 42 - 26 SLFN1 .MAC 1K 6 A6FF 40 - 27 SLFN2 .MAC 1K 6 82BC 41 - 28 SLFN3 .MAC 1K 8 658E 54 - 29 SLHL4HC .MAC 1K 4 DBC3 28 - 30 SLHL5DC .MAC 2K 14 7961 93 - 31 SLHLFDC .MAC 2K 12 2F66 82 - 32 SLOUT .MAC 1K 7 4084 46 - 33 SLPRINT .MAC 1K 4 67D0 25 - 34 SLPSTR .MAC 2K 14 65D7 90 - 35 SMA2HC .MAC 1K 8 0DC7 40 - 36 SMADC .MAC 2K 14 016F 84 - 37 SMAFDC .MAC 2K 12 BEC3 70 - 38 SMFN1 .MAC 1K 6 3A43 42 - 39 SMFN2 .MAC 1K 6 C23B 45 - 40 SMFN3 .MAC 1K 8 002A 57 - 41 SMHL4HC .MAC 1K 5 9C15 28 - 42 SMHL5DC .MAC 3K 19 F0F5 115 - 43 SMHLFDC .MAC 2K 16 1C5D 108 - 44 SMOVE .MAC 3K 19 67FF 131 - 45 SMTH01 .MAC 1K 4 FD05 33 - 46 SMTH02 .MAC 1K 5 47EC 33 - 47 SMTH03 .MAC 1K 4 8800 30 - 48 SMTH04 .MAC 1K 4 FAD3 28 - 49 SMTH05 .MAC 1K 5 41F7 34 - 50 SMTH06 .MAC 1K 5 9661 34 - 51 SMTH07 .MAC 1K 3 78BD 26 - 52 SMTH08 .MAC 1K 3 AD88 26 - 53 SMTH09 .MAC 1K 3 3EC8 26 - 54 SMTH10 .MAC 1K 4 729D 34 - 55 SMTH11 .MAC 2K 13 7150 98 - 56 SMTH12 .MAC 2K 13 E277 95 - -SYSLIB3 Disk 3 -- - Filename.Typ Size Recs CRC Lines - 1 SPA2HC .MAC 1K 6 FD07 38 - 2 SPADC .MAC 2K 11 35AA 74 - 3 SPAFDC .MAC 2K 10 8746 62 - 4 SPAUSE .MAC 3K 23 A2B8 123 - 5 SPFN1 .MAC 1K 6 5BD1 40 - 6 SPFN2 .MAC 1K 6 6756 41 - 7 SPFN3 .MAC 1K 8 B9E6 54 - 8 SPHL4HC .MAC 1K 4 3F9B 28 - 9 SPHL5DC .MAC 2K 14 D706 92 - 10 SPHLFDC .MAC 2K 12 A7C8 82 - 11 SPOUT .MAC 1K 7 915C 46 - 12 SPRINT .MAC 1K 4 A2A3 25 - 13 SPSTR .MAC 2K 14 A7FD 90 - 14 SRAND .MAC 2K 13 476E 81 - 15 SRIN .MAC 1K 7 1844 43 - 16 SRREAD .MAC 2K 9 F01A 58 - 17 SRWRITE .MAC 2K 9 35C7 58 - 18 SSA2HC .MAC 1K 6 6057 38 - 19 SSADC .MAC 2K 11 1A64 75 - 20 SSAFDC .MAC 2K 10 B9F3 62 - 21 SSCANNER.MAC 2K 12 C2D3 73 - 22 SSCFA .MAC 2K 16 E939 117 - 23 SSCOUT .MAC 1K 6 0636 39 - 24 SSCRLF .MAC 1K 5 6327 33 - 25 SSCTLFL .MAC 1K 4 D7AB 21 - 26 SSFA .MAC 2K 16 9FAC 117 - 27 SSFN1 .MAC 1K 6 A43E 41 - 28 SSFN2 .MAC 1K 6 0E8D 42 - 29 SSFN3 .MAC 1K 8 C4B7 55 - 30 SSHL4HC .MAC 1K 4 4D97 28 - 31 SSHL5DC .MAC 2K 14 6FBA 93 - 32 SSHLFDC .MAC 2K 13 C39D 82 - 33 SSKPUN .MAC 1K 8 A057 48 - 34 SSKSP .MAC 1K 8 490D 48 - 35 SSORT .MAC 14K 111 E332 564 - 36 SSOUT .MAC 1K 5 CA1A 39 - 37 SSPRINT .MAC 1K 4 42CC 26 - 38 SSPSTR .MAC 2K 14 9D1B 89 - 39 SSUA .MAC 1K 6 EA5F 47 - 40 SUD1 .MAC 1K 8 635C 74 - 41 SUD2 .MAC 1K 5 589A 50 - 42 SUD3 .MAC 1K 6 A69A 50 - 43 SVERSION.MAC 1K 5 F1A9 30 - 44 SYSLIB .REL 21K 161 2921 N/A - 45 SYSLIB27.REL 14K 107 1C54 N/A - 46 SYSTEST .MAC 4K 26 C997 129 - 47 SYSTEST0.MAC 4K 29 B39E 194 - 48 SYSTEST1.MAC 3K 21 5D8C 114 - 49 SYSTEST2.MAC 4K 30 9E05 151 - 50 SYSTEST3.MAC 4K 26 92EA 148 - 51 SYSTEST4.MAC 6K 46 02CE 244 - 52 SYSTEST5.MAC 2K 16 2DAF 98 - 53 SYSTEST6.MAC 5K 35 A9F5 211 - 54 SYSTEST7.MAC 5K 36 5138 233 - -SYSLIB3 Disk 4 -- - Filename.Typ Size Recs CRC Lines - 1 SYS2-3 .TXT 9K 71 6B3B 239 - 2 SYSLIB .HLP 2K 9 8184 38 - 3 SYSLIB0 .HLP 14K 112 86FE 355 - 4 SYSLIB1 .HLP 20K 159 8FBB 588 - 5 SYSLIB2 .HLP 5K 33 6DD5 154 - 6 SYSLIB3 .HLP 15K 119 F85C 435 - 7 SYSLIB4 .HLP 12K 90 E7A6 390 - 8 SYSLIB5 .HLP 12K 90 F417 412 - 9 SYSLIB6 .HLP 8K 60 F45A 276 - 10 SYSLIB7 .HLP 6K 45 152C 266 - 11 SYSLIB8 .HLP 5K 37 3CA8 173 - 12 SYSLIB9 .HLP 3K 23 4292 82 - 13 SYSLIBA .HLP 7K 55 6442 192 - 14 SYSLIBB .HLP 5K 39 2009 126 - 15 SYSLIBC .HLP 9K 71 F96C 302 - 16 SYSLIBD .HLP 5K 33 489A 134 - 17 SYSLIBE .HLP 8K 62 55D3 232 - 18 SYSLIBF .HLP 4K 25 2A54 104 - 19 SYSLIBG .HLP 3K 21 EE4C 88 - 20 SYSLIBH .HLP 2K 14 6F02 67 - 21 SYSLIBI .HLP 6K 44 DC1E 158 - - diff --git a/Source/Images/d_bp/u15/RECORD.COM b/Source/Images/d_bp/u15/RECORD.COM deleted file mode 100644 index 7f8cd225..00000000 Binary files a/Source/Images/d_bp/u15/RECORD.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/RECORD.MAC b/Source/Images/d_bp/u15/RECORD.MAC deleted file mode 100644 index 6d84034a..00000000 --- a/Source/Images/d_bp/u15/RECORD.MAC +++ /dev/null @@ -1,194 +0,0 @@ -; -; PROGRAM: RECORD -; AUTHOR: RICHARD CONN -; VERSION: 3.0 -; DATE: 4 Apr 84 -; PREVIOUS VERSIONS: 1.3 (5 Jan 83), 1.4 (6 Jan 83) -; PREVIOUS VERSIONS: 1.0 (30 Dec 82), 1.1 (31 Dec 82), 1.2 (1 Jan 83) -; -VERS EQU 30 -z3env SET 0f400h - -; -; RECORD enables and disables the disk output redirectable I/O -; drivers for ZCPR2. This command takes two forms: -; -; RECORD ON <-- Turn on console recording -; RECORD OFF <-- Turn off console recording -; RECORD ON P <-- Turn on printer recording -; RECORD OFF P <-- Turn off printer recording -; - ext z3init,getiop - ext eprint - -fcb equ 5dh ;FCB Input -fcb2 equ 6dh ;FCB2 Input -cr equ 0dh -lf equ 0ah - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - -; -; Start of Program -; - call getiop ;Check for I/O Driver Defn - mov a,h - ora l - jnz start0 - call banner - call eprint - db cr,lf,'Abort -- I/O Driver Address NOT Defined',0 - ret -start0: - call status ;Call Status Routine - jz nodriver ;No Driver Available? - cpi 80H ;MUST have Disk Driver Module (> 80H) Loaded - jnc start1 - call banner - call eprint - db cr,lf,'Abort -- Disk Driver Module NOT Loaded',0 - ret -nodriver: - call banner - call eprint - db cr,lf,'Abort -- No I/O Driver Module Loaded',0 - ret - -start1: - lda fcb ;Get first char - cpi 'O' ;Must be O - jnz help - lda fcb+1 ;Get 2nd char - cpi 'N' ;ON? - jnz off -on: - lda fcb2 ;Printer? - cpi 'P' - jnz on1 - call banner - call eprint - db ' ++ TTY Recording ON ++',0 - call lopen ;LST - ret -on1: - call banner - call eprint - db ' ++ CRT Recording ON ++',0 - call copen ;CRT - ret -off: - lda fcb2 ;Printer? - cpi 'P' - jnz off1 - call lclose ;Close Output - call banner - call eprint - db ' ++ TTY Recording OFF ++',cr,lf,0 - ret -off1: - call cclose ;Close Output - call banner - call eprint - db ' ++ CRT Recording OFF ++',cr,lf,0 - ret -; -; Print Help Message -; -help: - call banner - call eprint - db cr,lf - db cr,lf,'RECORD turns on and off recording of screen displays' - db cr,lf,'on disk under ZCPR3 with the SYSIO Redirectable I/O ' - db 'Drivers' - db cr,lf,'engaged.' - db cr,lf - db cr,lf,'It is invoked by two forms:' - db cr,lf - db cr,lf,' RECORD ON or RECORD ON PRINTER' - db cr,lf,' RECORD OFF or RECORD OFF PRINTER' - db cr,lf - db cr,lf,'Minimum Required Option Forms are ON, OF, and P:' - db cr,lf,' RECORD ON P = RECORD ON PRINTER' - db cr,lf,'If the P option is given, then TTY output is ' - db 'recorded,' - db cr,lf,'else CRT output is recorded.' - db cr,lf,0 - ret - -; -; I/O Driver Interface Routines -; -status: - push h ;Save HL - push d ;Save DE - lxi d,0 ;No Offset for Status -runio: - call getiop ;Get I/O Base Address - dad d ;Pt to Routine - pop d ;Restore DE - xthl ;Restore HL and Place Address on Stack - ret ;"Run" Routine -copen: - push h ;Save Regs - push d - lxi d,36 ;Offset for Console Open Routine - jmp runio ;Run Routine -cclose: - push h ;Save Regs - push d - lxi d,39 ;Offset for Console Close Routine - jmp runio -lopen: - push h ;Save Regs - push d - lxi d,42 ;Offset for Printer Open Routine - jmp runio -lclose: - push h ;Save Regs - push d - lxi d,45 ;Offset for Printer Close Routine - jmp runio - -; -; Print Banner -; -banner: - call eprint - db 'RECORD, Version ' - db (vers/10)+'0','.',(vers mod 10)+'0',0 - ret - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/REG.COM b/Source/Images/d_bp/u15/REG.COM deleted file mode 100644 index 97f426b8..00000000 Binary files a/Source/Images/d_bp/u15/REG.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/REG.MAC b/Source/Images/d_bp/u15/REG.MAC deleted file mode 100644 index b5b3f441..00000000 --- a/Source/Images/d_bp/u15/REG.MAC +++ /dev/null @@ -1,267 +0,0 @@ -; -; Program: REG -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; -version equ 10 - -; -; REG is used to access the ZCPR3 Registers. It can set a value, -; display a value or all values, increment, and decrement them. -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -fcb equ 5ch -fcb2 equ 6ch -cr equ 0dh -lf equ 0ah - -; -; External Z3LIB and SYSLIB Routines -; - ext z3init,getreg,putreg,getmsg - ext eval10,print,cout,crlf,qprint,padc - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Environment -; -; Print Banner -; - call qprint - db 'REG, Version ' - db (version/10)+'0','.',(version mod 10)+'0',cr,lf,0 -; -; Check for Availability of Registers -; - call getmsg - jz nomsg -; -; Check for Command -; - lxi h,fcb+1 ;pt to first FCB - mov a,m ;get first char - cpi ' ' ;check for help - jz help - cpi '/' ;also help - jz help - cpi '#' ;display all - jz dispall - cpi 'D' ;display - jz display - cpi 'M' ;minus (decrement) - jz minus - cpi 'P' ;plus (increment) - jz plus - cpi 'S' ;set - jz setrg - cpi '0' ;convert to binary - jc help - cpi '9'+1 ;range? - jnc help - jmp disp1 - -; -; Print Error Message -; -nomsg: - call print - db cr,lf,'No Registers Available',0 - ret - -; -; Print Help Message -; -help: - call print - db cr,lf,'REG - Set/Display/Increment/Decrement Registers' - db cr,lf,'REG Syntax:' - db cr,lf,' REG Dr or REG r <-- Display Reg r' - db cr,lf,' REG Mr <-- Minus (Decrement) Reg r' - db cr,lf,' REG Pr <-- Plus (Increment) Reg r' - db cr,lf,' REG Sr val <-- Set Reg r to val' - db cr,lf,'where "r" may be 0-9 for the regs or' - db cr,lf,'# to select all regs' - db 0 - ret -; -; Display Register -; -display: - inx h ;pt to value - mov a,m ;get it -disp1: - cpi '#' ;display all? - jz dispall -; -; Display Particular Register -; - call compreg ;compute register number in B - call getreg ;return register value in A -; -; Print Register whose Number is in B and Value in A -; -regprint: - mov c,a ;value in C - call print - db ' Reg ',0 - mov a,b - adi '0' ;convert to ASCII - call cout - call print - db ' = ',0 - mov a,c ;print value - jmp padc -; -; Display All Registers -; -dispall: - mvi b,0 ;loop 0 to 9 -dispa1: - call getreg ;get register - call regprint ;print register - call print - db ' ',0 - inr b ;increment count - mov a,b ;check for new line - ani 3 - cz crlf - mov a,b ;check for done - cpi 10 - jnz dispa1 - ret -; -; Convert ASCII Char in A to Register Number in B with error check -; -compreg: - cpi '0' ;convert to binary - jc rerr - cpi '9'+1 - jnc rerr - sui '0' ;convert to binary - mov b,a ;return value in B - ret -rerr: - mov b,a ;save char - pop psw ;clear stack - call print - db ' Invld Reg ID: ',0 - mov a,b ;get char - jmp cout -; -; Set Register Value -; -setrg: - inx h ;pt to register - mov a,m ;get char - cpi '#' ;all registers? - jz setall - call compreg ;get register number in B - lxi h,fcb2+1 ;pt to value - call eval10 ;evaluate - mov c,a ;save value in C - call putreg ;set register - jmp regprint ;print value -; -; Set All Registers -; -setall: - lxi h,fcb2+1 ;pt to value - call eval10 - mov c,a ;value in C - mvi b,0 ;set 10 registers -seta1: - mov a,c ;get value - call putreg ;set value - inr b ;increment reg number - mov a,b - cpi 10 - jnz seta1 - jmp dispall ;display all registers -; -; Reg = Reg - 1 -; -minus: - inx h ;pt to number - mov a,m ;get it - cpi '#' ;all? - jz minall - call compreg ;compute register number - call getreg ;get register - dcr a ;-1 - call putreg ;restore register - jmp regprint ;print result -; -; All Registers - 1 -; -minall: - mvi b,0 ;set loop -mina1: - call getreg ;get register - dcr a ;-1 - call putreg ;restore register - inr b ;count - mov a,b ;done? - cpi 10 - jnz mina1 - jmp dispall ;display all regs -; -; Reg = Reg + 1 -; -plus: - inx h ;pt to register - mov a,m ;get it - cpi '#' ;all? - jz plusall - call compreg ;compute value - call getreg ;get value - inr a ;+1 - call putreg ;put value - jmp regprint ;print value -plusall: - mvi b,0 ;set counter -plusa1: - call getreg ;increment value - inr a - call putreg - inr b ;count - mov a,b - cpi 10 - jnz plusa1 - jmp dispall ;print reg values - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/RENAME.COM b/Source/Images/d_bp/u15/RENAME.COM deleted file mode 100644 index 8d3a83c5..00000000 Binary files a/Source/Images/d_bp/u15/RENAME.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/RENAME.MAC b/Source/Images/d_bp/u15/RENAME.MAC deleted file mode 100644 index 9144ddb6..00000000 --- a/Source/Images/d_bp/u15/RENAME.MAC +++ /dev/null @@ -1,593 +0,0 @@ -; PROGRAM: RENAME -; VERSION: 3.0 -; DATE: 18 MAY 84 -; AUTHOR: RICHARD CONN -; PREVIOUS VERSIONS: 2.0 (16 JAN 83) -; PREVIOUS VERSIONS: 1.4 (6 JAN 83), 1.3 (7 DEC 82), 1.2 (10 NOV 82) -; PREVIOUS VERSION: RENAME.ASM Version 1.1 (26 OCT 81) -VERS equ 30 -z3env SET 0f400h - -; -; RENAME Command -- -; RENAME is used to change the name of one or more files. Unlike -; the ZCPR2-resident REN function, RENAME permits ambiguous file names -; and supports an Inspect mode that allows the user to confirm each -; rename before it is done. Additionally, there is a Control Mode which -; allows the user to manually specify the name for each file as it is -; presented to him. -; -; The RENAME command may be of the following forms: -; RENAME dir:afn1=afn2,dir:afn3=afn4,... o -; RENAME dir:afn,dir:afn1=afn2,... o -; The first form shows elements of the form -; dir:afn1=afn2 -; while the second form shows elements of the form -; dir:afn -; which is the same as -; dir:afn=afn -; and only makes sense if Control Mode is used. -; -; The option characters (o) are none or more of the following: -; C -- Control Mode; manually specify each new name -; I -- Inspect and approve each rename -; S -- Include SYStem files -; -; Examples: -; RENAME *.MAC=*.ASM <-- Rename all ASM files to MAC -; RENAME *.MAC C <-- Rename all MAC files to names -; input by the user -; RENAME *.OBJ=*.COM SI <-- Rename all COM files to OBJ -; and include SYStem files -; and Inspect and approve each -; change -; - -FALSE EQU 0 -TRUE EQU NOT FALSE - -ESIZE EQU 16 ; SIZE OF DIR ENTRY (FROM SYSLIB DIRF ROUTINE) - - EXT DIRQ ; DIRECTORY PROCESSOR - - EXT Z3INIT ; INIT BUFFERS - EXT ZFNAME ; FILE NAME PROCESSOR - EXT Z3LOG ; Z3 DU LOG - - EXT F$DELETE ; DELETE FILE - EXT F$RENAME ; RENAME FILE - EXT BBLINE ; INPUT LINE EDITOR - EXT INITFCB ; INIT FCB - EXT BDOS ; BDOS ENTRY - EXT PUTUD ; SAVE CURRENT USER/DISK - EXT GETUD ; RESTORE CURRENT USER/DISK - EXT MOVEB ; COPY ROUTINE - EXT PHLDC ; PRINT HL AS DECIMAL CHARS - EXT PRINT ; PRINT ROUTINE - EXT COUT ; CONSOLE OUTPUT ROUTINE - EXT CIN ; CONSOLE INPUT ROUTINE - EXT CAPS ; CAPITALIZE ROUTINE - EXT CRLF ; NEW LINE ROUTINE - EXT FILLB ; FILL ROUTINE - EXT CODEND ; CODE END COMPUTATION ROUTINE - -; -; CP/M EQUATES -; -CPM EQU 0 ; WARM BOOT -FCB EQU 5CH ; FCB -BUFF EQU 80H ; INPUT LINE BUFFER -CR EQU 13 ; -LF EQU 10 ; - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - LXI H,0 ; GET STACK PTR - DAD SP - SHLD STACK ; SAVE IT - CALL CODEND - SHLD CMDLNE ; SETUP COMMAND LINE BUFFER - LXI D,100H ; BUFFER SIZE - DAD D - SHLD NTFCB ; SET TEMP FCB - DAD D - SHLD DIRBUF ; PTR TO DIR BUFFER - SPHL ; NEW SP - LHLD NTFCB ; SET 2ND FCB - LXI D,40 - DAD D - SHLD OFCB - - CALL PUTUD ; SAVE CURRENT USER/DISK AWAY - - CALL PRINT - DB 'RENAME Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0',0 - LDA FCB+1 ; GET FIRST CHAR OF FILE NAME - CPI ' ' ; NO FILE SPEC? - JZ HELP - CPI '/' ; OPTION CAUGHT? - JNZ ECONT - -; PRINT HELP INFORMATION -HELP: - CALL PRINT - DB CR,LF,'Syntax:' - DB CR,LF,' RENAME dir:afn1=afn2,afn3=afn4,... o...' - DB CR,LF,'Options:' - DB CR,LF,' C -- Control Mode (Allow user to manually name each ' - DB 'file)' - DB CR,LF,' I -- Inspect Mode (Give user approval option)' - DB CR,LF,' S -- Include SYS files' - DB CR,LF - DB 0 - -; RETURN TO OS -RETURN: - LHLD STACK ; GET OLD STACK - SPHL ; SET IT - RET - -; COPY BUFFER INTO TEMP BUFFER -ECONT: - LHLD CMDLNE ; PT TO COMMAND LINE SAVE BUFFER - XCHG ; ... IN DE - LXI H,BUFF+1 ; PT TO BUFFER - MVI B,80H ; BUFFER SIZE - CALL MOVEB ; COPY INTO COMMAND LINE BUFFER - -; EXTRACT FLAGS IF PRESENT - XRA A ; SET NO INSPECT, NO R/O, AND NO SYSTEM FILES - STA INSPECT - STA CONTROL ; SET NO CONTROL MODE - MVI A,80H ; SELECT NON-SYS FILES ONLY - STA SYSTEM - LXI H,0 ; SET FILE COUNT - SHLD FILECNT - LHLD CMDLNE ; PT TO BUFFER -; SKIP TO FILE NAME STRING -SBLANK: - MOV A,M ; SKIP TO NON-BLANK - CPI ' ' ; ? - JNZ SBL1 - INX H ; PT TO NEXT CHAR - JMP SBLANK -; SKIP TO END OF FILE NAME STRING -SBL1: - MOV A,M ; SKIP TO OR EOL - ORA A ; DONE? - JZ OPT - CPI ' ' ; - JZ OPT - INX H ; PT TO NEXT - JMP SBL1 -; CHECK FOR LEADING SLASH ON OPTION AND SKIP IT IF SO -OPT: - CPI '/' ; OPTION CHAR? - JNZ OPTION - INX H ; SKIP SLASH -; PROCESS LIST OF OPTIONS -OPTION: - MOV A,M ; GET BYTE - ORA A ; DONE? - JZ DSPEC - INX H ; PT TO NEXT CHAR - CPI ' ' ; SKIP OVER SPACES - JZ OPTION - CPI '/' ; IF OPTION LETTER, OBVIOUS ERROR, SO HELP - JZ HELP - CPI 'C' ; CONTROL? - JZ OPTCTRL - CPI 'I' ; INSPECT? - JZ OPTINS - CPI 'S' ; SYSTEM FILES? - JNZ HELP - MVI A,0C0H ; SET FOR SYS FILES - STA SYSTEM - JMP OPTION -OPTCTRL: - MVI A,0FFH ; CONTROL MODE - STA CONTROL - JMP OPTION -OPTINS: - MVI A,0FFH ; INSPECT - STA INSPECT - JMP OPTION - -; EXTRACT DISK, USER, AND FILE NAME INFORMATION -DSPEC: - LHLD CMDLNE ; PT TO BEFORE FIRST BYTE - DCX H -DSPEC0: - INX H ; PT TO BYTE - MOV A,M ; GET BYTE - ORA A ; DONE? - JZ HELP - CPI ' ' ; ? - JZ DSPEC0 -; -; MAJOR REENTRY POINT WHEN FILE SPECS ARE SEPARATED BY COMMAS -; HL PTS TO FIRST BYTE OF NEXT FILE SPEC -; -DSPEC1: - CALL GETUD ; RESET USER IF NECESSARY - PUSH H - LHLD NTFCB - XCHG ; PT TO FCB IN DE - POP H - MVI A,0 ; DIR BEFORE DU - CALL ZFNAME ; EXTRACT FILE NAME INTO FCB, AND GET DISK AND USER - SHLD NEXTCH ; SAVE PTR TO DELIMITER WHICH ENDED SCAN - PUSH H - LHLD NTFCB - XCHG ; PT TO FCB IN DE - POP H - CALL Z3LOG ; LOG INTO DU - -; FIRST NAME IS NOW EXTRACTED -- EXTRACT POSSIBLE SECOND NAME -NAME2: - LHLD OFCB ; PT TO FCB FOR 2ND NAME - XCHG - LHLD NTFCB ; PT TO FIRST NAME - MVI B,16 ; COPY 16 BYTES - CALL MOVEB - LHLD NEXTCH ; PT TO CHAR WHICH ENDED PARSE - MOV A,M ; GET IT - CPI '=' ; ASSIGNMENT? - JNZ RENAME ; GO AHEAD IF NOT - INX H ; PT TO CHAR AFTER '=' - PUSH H - LHLD OFCB ; PT TO TEMP FCB - XCHG ; ... IN DE - POP H - MVI A,0 ; DIR BEFORE DU - CALL ZFNAME ; EXTRACT FILE NAME INTO FCB, AND GET DISK AND USER - SHLD NEXTCH ; SAVE PTR TO DELIMITER WHICH ENDED SCAN - -; LOAD DIRECTORY AND RENAME FILES -RENAME: - LHLD OFCB - XCHG ; PT TO FCB - LHLD DIRBUF ; PT TO END OF CODE - CALL INITFCB ; INIT THE FCB - LDA SYSTEM ; SET FLAGS - CALL DIRQ ; LOAD DIR, SELECT FILES, PACK, AND ALPHABETIZE - -; REN DIR FILES; HL PTS TO FIRST FILE, BC=FILE COUNT - CALL RENFILES - -; CHECK FOR NEXT FILE SPEC - LHLD NEXTCH ; GET PTR - MOV A,M ; GET DELIM - CPI ',' ; ANOTHER FILE? - JNZ RENDONE - INX H ; PT TO CHAR AFTER COMMA - JMP DSPEC1 ; CONTINUE PROCESSING - -; RENAME COMPLETE -- PRINT COUNT AND EXIT -RENDONE: - CALL PRCOUNT ; PRINT FILE COUNT - JMP RETURN - -; RENAME SELECTED FILES -RENFILES: - MOV A,B ; CHECK FOR ANY FILES LOADED - ORA C - RZ - -; PRINT FILE NAME -RENLP: - PUSH B ; SAVE ENTRY COUNT - CALL PRINT - DB CR,LF,'Rename ',0 - PUSH H ; SAVE PTR TO FCB - LHLD NTFCB ; COPY NEW TEMPLATE INTO RENFCB - LXI D,RENFCB - MVI B,16 - CALL MOVEB - POP H ; GET PTR - PUSH H ; SAVE PTR - INX H ; PT TO FN OF OLD NAME - INX D ; PT TO FN OF RENFCB - MVI B,11 ; 11 BYTES TO FN AND FT -RENLP1: - LDAX D ; GET CHAR OF NEW - CPI '?' ; CHANGE '?' TO OLD CHAR - JNZ RENLP2 - MOV A,M ; GET OLD CHAR - ANI 7FH ; MASK OLD CHAR - STAX D ; STORE IT AWAY AS NEW -RENLP2: - INX H ; PT TO NEXT CHAR - INX D - DCR B ; COUNT DOWN - JNZ RENLP1 - LXI H,RENFCB ; PT TO NEW NAME - CALL PRFN ; PRINT FILE NAME - CALL PRINT - DB ' from ',0 - POP H ; GET PTR TO OLD FILE NAME - PUSH H ; SAVE IT AGAIN - CALL PRFN ; PRINT FILE NAME - POP H ; GET PTR - -; CHECK FOR CONTROL MODE AND PERFORM CONTROL FUNCTION IF SET - LDA CONTROL ; GET FLAG - ORA A ; NZ=YES - JNZ RENCTRL - -; CHECK FOR INSPECTION AND INSPECT IF SET - LDA INSPECT ; GET FLAG - ORA A ; 0=NO - JZ DOIT - -; PROMPT USER FOR RENAME - CALL RENQ ; REN QUESTION - CPI 'Q' ; QUIT? - JZ QUIT - CPI 'Y' ; YES? - JZ DOIT - -; DON'T RENAME FILE -NODO: - CALL PRINT - DB CR,LF,'NO Name Change',0 - JMP RENTEST - -; PRINT FILE NAME PTED TO BY HL -PRFN: - INX H ; PT TO FILE NAME - MVI B,8 ; PRINT NAME - CALL PRNT - MVI A,'.' ; DECIMAL - CALL COUT - MVI B,3 ; PRINT TYPE - CALL PRNT - RET - -; PROMPT USER FOR RENAME -RENQ: - CALL PRINT ; PRINT PROMPT - DB ' -- Rename (Y/N/Q=Quit)? ',0 - CALL CIN ; GET RESPONSE - CALL CAPS ; CAPITALIZE - CALL COUT ; ECHO - RET - -; CONTROL FUNCTION -- ALLOW USER TO RENAME AS HE DESIRES -RENCTRL: - PUSH H ; SAVE PTR TO FILE -RCTRL: - CALL PRINT - DB CR,LF,' -- New Name (=No Change)? ',0 - MVI A,0FFH ; CAPITALIZE - CALL BBLINE ; INPUT LINE FROM USER - ORA A ; CHECK FOR JUST - JNZ RCTRL0 - POP H ; GET PTR TO FILE - JMP RENTEST ; PROCEED WITH NEXT ENTRY -RCTRL0: - LXI D,RENFCB ; PLACE INTO NEW NAME FCB - CALL ZFNAME ; JUST EXTRACT NAME - MVI B,11 ; CHECK FOR ANY WILD CHARS -RCTRL1: - INX D ; PT TO NEXT CHAR - LDAX D ; GET IT - CPI '?' ; CAN'T BE WILD - JZ WERR - CPI '*' ; CAN'T BE WILD - JZ WERR - DCR B ; COUNT DOWN - JNZ RCTRL1 - JMP RDOIT ; DONE -- PERFORM RENAME -WERR: - CALL PRINT - DB CR,LF,'Wild Card (?,*) in Name -- Try Again',0 - JMP RCTRL - -; QUIT RENAME PROGRAM -QUIT: - CALL PRCOUNT ; PRINT COUNT OF FILES RENAMED - CALL PRINT - DB ' QUIT',0 - JMP RETURN - -; REN FILE, BUT GET PTR FIRST -RDOIT: - POP H ; GET PTR - -; RENAME FILE; OLD NAME PTED TO BY HL, NEW NAME IN RENFCB -DOIT: - PUSH H -; STEP 1 -- DETERMINE IF NEW NAME ALREADY EXISTS - LXI D,RENFCB ; PT TO NEW NAME - CALL INITFCB - MVI C,17 ; SEARCH FOR FIRST - CALL BDOS - INR A ; NOT FOUND? - JZ DOIT1 - CALL PRINT - DB CR,LF,' -- File Exists -- Delete It (Y/N)? ',0 - CALL CIN ; GET RESPONSE - CALL CAPS - CALL COUT - POP H ; PREP FOR ABORT - CPI 'Y' ; YES -- CONTINUE? - JNZ RENTEST ; NOT YES, SO SKIP IT -; DELETE OLD FILE, SO SET ATTRIBUTES AND DO IT - PUSH H ; SAVE PTR AGAIN - CALL INITFCB ; CLEAR FCB - MVI C,30 ; SET FILE ATTRIBUTES TO R/W IF NOT ALREADY - CALL BDOS - CALL INITFCB - CALL F$DELETE ; DELETE FILE -DOIT1: - POP H ; HL PTS TO OLD NAME -; CLEAR THE OLD NAME'S ATTRIBUTES IN CASE IT WAS R/O - PUSH H ; SAVE PTR TO OLD NAME - PUSH H - LHLD OFCB ; COPY OLD NAME - XCHG - POP H - MVI B,16 - CALL MOVEB - PUSH D ; CLEAR ATTRIBUTES - MVI B,11 ; 11 BYTES - INX D ; PT TO FIRST -DOIT2: - LDAX D ; GET CHAR - ANI 7FH ; CLEAR ATT - STAX D ; PUT CHAR - INX D ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ DOIT2 - POP D ; NOW SET ATTRIBUTES OF OLD NAME - CALL INITFCB - MVI C,30 ; SET ATTRIBUTES - CALL BDOS - CALL INITFCB -; DO THE RENAME - LXI H,RENFCB ; PT TO NEW NAME - XCHG - CALL INITFCB ; INIT NEW FCB - XCHG ; HL PTS TO NEW NAME, DE PTS TO OLD NAME - CALL F$RENAME ; RENAME THE FILE -; RESTORE THE ORIGINAL ATTRIBUTE BITS - POP H ; GET PTR TO OLD NAME - LXI D,RENFCB+1 ; PT TO NEW NAME - PUSH H ; SAVE PTR TO OLD NAME - INX H ; PT TO FN OF OLD NAME - XCHG ; HL PTS TO NEW NAME, DE PTS TO OLD NAME - MVI B,11 ; 11 BYTES -DOIT3: - LDAX D ; GET ATTRIBUTE BIT OF OLD NAME - ANI 80H ; LOOK ONLY AT ATTRIBUTE BIT - ORA M ; MASK IN NEW NAME BYTE - MOV M,A ; STORE IT AWAY - INX H ; PT TO NEXT - INX D - DCR B ; COUNT DOWN - JNZ DOIT3 -; SET THE ORIGINAL ATTRIBUTES INTO THE NEW FILE - LXI D,RENFCB ; PT TO FCB - CALL INITFCB - MVI C,30 ; SET ATTRIBUTES - CALL BDOS - LHLD FILECNT ; INCREMENT FILE COUNT - INX H - SHLD FILECNT - POP H ; GET PTR TO DIRECTORY ENTRY - -; PT TO NEXT ENTRY -RENTEST: - LXI D,ESIZE ; PT TO NEXT ENTRY - DAD D - POP B ; GET COUNT - DCX B ; COUNT DOWN - MOV A,B ; CHECK FOR ZERO - ORA C - JNZ RENLP - -; RETURN TO CALLER - RET - -; -; PRINT CHARS PTED TO BY HL FOR B BYTES -; -PRNT: - MOV A,M ; GET CHAR - CALL COUT - INX H ; PT TO NEXT - DCR B ; COUNT DOWN - JNZ PRNT - RET - -; -; PRINT COUNT OF NUMBER OF FILES RENAMED -; -PRCOUNT: - CALL CRLF ; NEW LINE - LHLD FILECNT ; GET COUNT - MOV A,L ; CHECK FOR NONE - ORA H - JZ PRNO - CALL PHLDC ; PRINT DECIMAL COUNT - JMP PRMS -PRNO: - CALL PRINT - DB 'No ',0 -PRMS: - LHLD FILECNT ; 1 FILE PROTECTED? - MOV A,H ; HIGH ZERO? - ORA A - JNZ PRMULT - MOV A,L ; LOW ONE? - CPI 1 - JZ PRSING -PRMULT: - CALL PRINT - DB ' Files Renamed',0 - RET -PRSING: - CALL PRINT - DB ' File Renamed',0 - RET - -; -; BUFFERS -; -INSPECT: - DS 1 ; INSPECT FLAG (0=NO, 0FFH=YES) -CONTROL: - DS 1 ; CONTROL FLAG (0=NO, 0FFH=YES) -SYSTEM: - DS 1 ; SYSTEM FLAG (80H=NON-SYS, 0C0H=SYS/NON-SYS) -NEXTCH: - DS 2 ; PTR TO NEXT CHAR IN MULTIFILE COMMAND LINE -FILECNT: - DS 2 ; COUNT OF NUMBER OF FILES RENAMED -RENFCB: - DS 40 ; FCB FOR RENAME -OFCB: - DS 2 ; FCB FOR OLD FILE NAME AND OLD FILE TEMPLATE -NTFCB: - DS 2 ; FCB FOR NEW FILE TEMPLATE -CMDLNE: - DS 2 ; PTR TO COMMAND LINE BUFFER -DIRBUF: - DS 2 ; PTR TO DIRECTORY BUFFER -STACK: - DS 2 ; OLD STACK PTR - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/RENAME31.LBR b/Source/Images/d_bp/u15/RENAME31.LBR deleted file mode 100644 index 88e4345f..00000000 Binary files a/Source/Images/d_bp/u15/RENAME31.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/SAK.COM b/Source/Images/d_bp/u15/SAK.COM deleted file mode 100644 index 0c31b43c..00000000 Binary files a/Source/Images/d_bp/u15/SAK.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SAK.MAC b/Source/Images/d_bp/u15/SAK.MAC deleted file mode 100644 index df404124..00000000 --- a/Source/Images/d_bp/u15/SAK.MAC +++ /dev/null @@ -1,245 +0,0 @@ -; PROGRAM: SAK (Strike Any Key) -; AUTHOR: Richard Conn -; VERSION: 2.0 -; DATE: 18 May 84 -; PREVIOUS VERSIONS: 1.0 (18 Apr 83) -vers equ 20 -z3env SET 0f400h - -; -; SAK (Strike Any Key) is used for the following purposes: -; 1) to wait for user interaction before continuing -; and to allow the user to abort a Multiple -; Command Line -; 2) to command the user's attention by ringing the -; bell at his console -; -; The SAK command line is: -; SAK o... -; SAK is invoked with the following options: -; A -- DO NOT Allow the User to Abort MCL -; B -- Ring Bell -; Pnnnn -- Pause nnnn seconds and continue if no -; response by that time -; - ext z3init,wait1s,getcl1,qprint,qcrlf - ext strtzex,stopzex,putzex - ext pstr,print,condin,eval10,cout - -tbuff equ 80h ;command line buffer -cr equ 0dh -lf equ 0ah -ctrlc equ 'C'-'@' -ctrlg equ 'G'-'@' - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - -; Init Options and Parse and Interpret Command Line -; - xra a ;turn options off - sta mpflag ;turn off message printed flag - sta bell ;turn off bell - sta delay ;turn off delay (pause) - sta delay+1 - mvi a,0ffh ;turn options on - sta abortf ;turn on abort - lxi h,tbuff+1 ;pt to command line -spskp: - mov a,m ;skip leading spaces - inx h - cpi ' ' - jz spskp - dcx h ;pt to char - cpi '/' ;option? - jnz optdone - inx h ;skip option char -opt: - mov a,m ;get option letter - ora a ;done? - jz optdone - inx h ;pt to next - cpi ' ' ;process text - jz optdone - cpi 'A' ;abort? - jz optabort - cpi 'B' ;bell? - jz optbell - cpi 'P' ;pause? - jz optpause - call print - db 'SAK, Version ' - db (vers/10)+'0','.',(vers mod 10)+'0' - db cr,lf,'Syntax:' - db cr,lf,' SAK /o... text -or- SAK text' - db cr,lf,'Options:' - db cr,lf,' A -- DO NOT Allow the User to Abort' - db cr,lf,' B -- Ring the Bell' - db cr,lf,' Pnnnn -- Pause nnnn seconds and then resume' - db 0 - ret -; -; Process A option (Abort MCL) -; -optabort: - xra a ;turn off abort - sta abortf - jmp opt -; -; Process B option (Ring Bell) -; -optbell: - mvi a,0ffh ;turn on bell - sta bell - jmp opt -; -; Process Pnnnn option (Pause nnnn seconds) -; -optpause: - call eval10 ;convert argument to decimal value in DE - xchg ;HL contains value - shld delay - xchg ;HL pts to next char - jmp opt -; -; Continue Command Processing -; -optdone: - mov a,m ;any message? - ora a - jz optdn1 - sta mpflag ;set message printed flag - call print ;new line - db ' --> ',0 - call pstr ;print message - call print - db ' <-- ',0 -optdn1: - call stopzex ;suspend ZEX processing - lhld delay ;get delay count in HL -; -; Main Delay Loop -; -sakloop: -; -; Ring Bell if Option Selected -; - lda bell ;get flag - ora a ;set zero flag - cnz bout ;ring bell and delay -; -; Get character if one is available -; - call condin ;optionally get character - jnz gotchar ;process character -; -; Loop if No Delay -; - mov a,h ;check for no delay - ora l - jz sakloop -; -; Delay and test for input -; - call wait1s ;delay 1 sec - dcx h ;count down - mov a,h ;done? - ora l - jnz sakloop -; -; Process Input Character -; If no input and timout instead, A=0 for continuation character -; -gotchar: - cpi ctrlc ;abort? - jz abort -resume: - lda mpflag ;message printed? - ora a ;0=no - cnz qcrlf ;new line if yes - call qprint - db 'Resuming ...',0 - jmp strtzex ;resume ZEX processing -; -; Abort Multiple Command Line if there is one -; -abort: - lda abortf ;abort allowed? - ora a ;0=no - jz resume - call getcl1 ;get address of command line buffer - mov a,h ;any buffer? - ora l - jz abort1 - mov e,m ;get address of next char - inx h - mov d,m - xchg ;HL pts to next char - mvi m,0 ;set no further command -abort1: - lda mpflag ;message printed? - ora a ;0=no - cnz qcrlf ;new line if yes - call qprint - db 'Aborting ...',0 - jmp strtzex ;resume ZEX processing -; -; Ring Bell and Delay Briefly -; -bout: - mvi a,ctrlg ;ring bell - call cout - push h ;save HL - lhld delay ;do not delay if pause already invoked - mov a,h ;zero delay? - ora l - jnz bout1 ;skip delay - call wait1s ;delay -bout1: - pop h - ret - -; -; Other Buffers -; -abortf: - ds 1 ;abort flag -bell: - ds 1 ;bell flag -delay: - ds 2 ;delay constant -mpflag: - ds 1 ;message printed flag - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SETFILE.COM b/Source/Images/d_bp/u15/SETFILE.COM deleted file mode 100644 index 033c8540..00000000 Binary files a/Source/Images/d_bp/u15/SETFILE.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SETFILE.MAC b/Source/Images/d_bp/u15/SETFILE.MAC deleted file mode 100644 index be2cddc4..00000000 --- a/Source/Images/d_bp/u15/SETFILE.MAC +++ /dev/null @@ -1,108 +0,0 @@ -; -; Program: SETFILE -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; -version equ 10 - -; -; SETFILE defines the name of a ZCPR3 File Name or displays it. -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -fnum equ 5ch+1 ;file number in 1st FCB -fcb equ 6ch ;2nd FCB -cr equ 0dh -lf equ 0ah - -; -; External Z3LIB and SYSLIB Routines -; - ext z3init,getfn1,print,pfn1,moveb,qprint,cout - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment and Print Banner -; - call z3init ;initialize the ZCPR3 Environment - call qprint - db 'SETFILE, Version ' - db (version/10)+'0','.',(version mod 10)+'0',cr,lf,0 -; -; Check Number of File -; - lxi h,0 ;init count - lxi d,11 ;size of each file name - lda fnum ;get number - sui '0' ;convert to binary - jc error - jz error - cpi 5 ;range? - jc selfile -; -; Print Error Message -; -error: - call print - db ' Invalid File Name Number (not 1-4)',0 - ret -; -; Set Name of File -; -selfile: - dad d ;compute offset from file name 1 - dcr a ;count down - jnz selfile - xchg ;DE contains offset - call getfn1 ;get ptr to shell file name - dad d ;get ptr to file name selected - lxi d,fcb+1 ;pt to name in FCB - xchg ;copy from FCB - mvi b,11 ;11 bytes - mov a,m ;get first char - cpi ' ' ;don't define if no name - cnz moveb ;define name if name given -; -; Print Name of Shell Variable File -; - call print - db ' File Name ',0 - lda fnum ;get number - call cout ;print it - call print - db ' is ',0 - jmp pfn1 - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SF.COM b/Source/Images/d_bp/u15/SF.COM deleted file mode 100644 index 0404612e..00000000 Binary files a/Source/Images/d_bp/u15/SF.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SF.Z80 b/Source/Images/d_bp/u15/SF.Z80 deleted file mode 100644 index c9a984fe..00000000 --- a/Source/Images/d_bp/u15/SF.Z80 +++ /dev/null @@ -1,46 +0,0 @@ -; -; SFILER Demo - Simple VFILER by Richard Conn -; This program demonstrates the SFILEH from the new high-order -; components library SFILER. Any program can have a built-in -; VFILER-like capability as easily as it is done in this program. -; -; Assembly instructions: -; 1) assemble SF.Z80 to produce SF.REL; command: -; ZAS SF -; 2) link in the proper libraries to create SF.COM; command: -; ZLINK SF,SFILER/,VLIB/,Z3LIB/,SYSLIB/ -; Installation instructions: -; SF can be installed in the standard way; command: -; Z3INS SYS.ENV SF.COM -; -z3env equ 0f400h ; address of env desc - - ext z3vinit ; must use Z3VINIT for TCAP - ext codend ; free space - ext sfileh ; entry point -; -; Standard ZCPR 3.0 header -; - jp start - db 'Z3ENV' - db 1 -z3eadr: dw z3env -; -; Start of program -; -start: - ld hl,(z3eadr) ; get address - call z3vinit - call codend ; determine start of free space -; -; At this point, the initialization required to run SFILEH is done: -; 1) HL contains the address of the start of the free space area -; after the end of this program -; 2) the FCB at 5CH is properly initialized with file name (space -; filled if wild) and a ZCPR 3.0 - standard DU reference -; (at FCB+0 for the disk and FCB+13 for the user area) -; - call sfileh ; run SFILER module - ret - - end diff --git a/Source/Images/d_bp/u15/SH.COM b/Source/Images/d_bp/u15/SH.COM deleted file mode 100644 index a4c67fe5..00000000 Binary files a/Source/Images/d_bp/u15/SH.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SH.HLP b/Source/Images/d_bp/u15/SH.HLP deleted file mode 100644 index f2aea0aa..00000000 --- a/Source/Images/d_bp/u15/SH.HLP +++ /dev/null @@ -1,420 +0,0 @@ -; - - SH - A Named Variable Shell for ZCPR3 - - - -- The Shell SH -- -- Handling Shell Variables -- - S - The SH Command D - SHDEFINE - C - SH Concept V - SHVAR - P - Potential Probs - -- SH Variable File -- - F - SHFILE - - -:S - -Command: SH 1.0 - -Syntax: - - SH - -Function: - - SÈ ió á Nameä Variablå Shelì foò ZCPR3® Iô promptó thå -useò  foò á commanä line¬  performó aî interpretatioî oî thå -commanä line¬ anä eitheò executeó thå commanä linå itselæ oò -passes the line on to the ZCPR3 Command Processor. - -Options: - - None - - -Comments: - Variables - SÈ  permitó  thå  useò tï  uså  Nameä  Variables¬  likå -MYFILE¬  whicè arå expandeä iî á manneò similaò tï macroó iî -hió commanä lines®  Twï programs¬ SHDEFINÅ anä SHVAR¬ allo÷ -thå  useò  tï dynamicallù creatå Nameä  Variables¬  anä  thå -SHFILÅ  commanä  allowó  Nameä Variablå  definitionó  tï  bå -grouped into sets of variables. - - Á  conventionaì CP/Í commanä linå coulä looë  somethinç -likå this: - - ED MYFILE.TXT - - Using SH, a ZCPR3 command line like Variables - - ED %WORKFILE - -caî bå generated¬  and¬  aó SÈ substituteó thå definitioî oæ -thå  variablå WORKFILÅ wheî iô interpretó thå commanä  line¬ -"EÄ  %WORKFILE¢  coulä bå expandeä intï "EÄ  MYFILE.TXT¢  iæ -WORKFILE=MYFILE.TXT®  Bù changinç thå valuå oæ thå variablå -WORKFILE¬  thå  meaninç  oæ thå commanä  "EÄ  %WORKFILE¢  ió -correspondinglù changed. - - Oncå  SÈ  ió invokeä (bù typinç thå  commanä  SH)¬  anù -commanä typeä bù thå useò ió passeä thrõ SÈ first¬  expandeä -aó required¬  anä then¬ iæ thå commanä ió noô aî SH-residenô -command¬  thå  expandeä commanä linå ió passeä tï ZCPR³  foò -processing. - - SÈ  variableó maù bå nesteä tï anù  depth®  Recursion¬ -however¬  shoulä bå avoided¬ anä iô ió thå responsibilitù oæ -thå useò tï ensurå thaô recursioî doeó noô occur. - Variables - '%%§  ió  interpreteä  bù  SÈ  aó  á  singlå  '%'®  SÈ -variableó are assigneä aó follows: - - VAR1 = "ED %%VAR2" VAR2 = "MYFILE.TXT" - -VAR1 is expanded as - - "ED %VAR2" - -which is, in turn, expanded as - - "ED MYFILE.TXT" - -which is finally executed by being passed to ZCPR3. - - SH Commands - There are three SH-resident commands: - - SHCMT - switch SH to run in comment mode; in - comment mode, all lines which - do not begin with the character - ! are treated as comments and - flushed - SHECHO - with Echo enabled, all expanded command - lines are printed to the user to - show him what the line looked like - after expansion - SHEXIT - SH is popped from the Shell Stack, - enabling the next lower Shell for - execution - - The normal prompt for SH is: Comment Mode - - DU:NAME>> - -as opposed to: - - DU:NAME> - -foò  ZCPR3®  Iæ thå SHCMÔ (SÈ Comment© facilitù ió enabled¬ -this prompt becomes: - - DU:NAME; - - Anù  texô  issueä bù thå useò oò á commanä  filå  (likå -ZEX©  wilì  bå  processeä  aó á  commenô  unlesó  thå  firsô -characteò oæ thå linå ió aî exclamatioî marë (!)¬  whicè  ió -an indicator to process the command text that follows. - - Thå commanä SHCMÔ switcheó tï commenô mode¬  anä !SHCMÔ -switches back. - Built-in Cmds - Thå  SHECHÏ  commanä  ió alsï á  toggle¬  enablinç  anä -disablinç thå echï oæ commanä lineó afteò alì variableó havå -been resolved. - - Thå SHEXIÔ commanä causeó thå Shelì Stacë tï bå  poppeä -onå  level¬  whicè  iî  turî  causeó  thå  SÈ  Shelì  tï  bå -terminated since it was on the top of the stack. - - Botè  SHECHÏ anä SHEXIÔ caî bå executeä froí SÈ Commenô -mode by prefixing these commands with an exclamation mark. - - Thå ¿  commanä (á linå beginninç witè á quesitoî  mark© -invokeó  thå  built-iî  helð facilitù oæ  SH¬  whicè  simplù -reminds the user of what the built-in commands are for SH. - - Other Shells - SÈ   ió  jusô  beginninç  oæ  thå  ZCPR³  Shelì   Stacë -applications® MENÕ anä VFILEÒ arå botè shelló now¬ anä theù -executå likå SH® Alì threå shelló caî pasó commanä lineó tï -ZCPR3¬  havå  ZCPR³  executå  theså commandó iî  itó  normaì -fashion¬  completå  witè thå command-searcè  hierarchy¬  anä -theî  returî tï thå appropriatå shelló wheî done®  Á  Shelì -imposeó  á  ne÷ initiaì commanä linå interpretatioî  oî  thå -inpuô commanä line. - - -Selected Error Messages: - - "Nï Shelì Stack¢ meanó thaô á Shelì Stacë haó noô  beeî -installed in the ZCPR3 System and SH cannot run. - - "Shelì  Stacë Full¢ meanó thaô therå ió noô enougè rooí -on the Shell Stack for SH to push itself and SH cannot run. - - "Shelì  Stacë  Entrù Size¢ meanó thaô thå  shelì  stacë -entrieó  arå  toï shorô foò SÈ tï definå thå  parameteró  iô -needs to control its operation. SH cannot run. - -Examples of Use: - - SH - -- SH is invoked - -:D - -Command: SHDEFINE 1.0 - -Syntax: - - SHDEFINE ufn <-- define variables within file -or - SHDEFINE <-- define variables within SH.VAR - -Function: - - SHDEFINÅ  allowó thå useò tï interactivelù displaù  anä -ediô  thå assignmenô oæ variableó iî á Shelì Variablå  file® -Hå maù add¬  delete¬ anä redefinå Shelì Variableó aó welì aó -lisô alì currenô definitionó oî thå CRÔ oò prinô theí oî thå -printer. - -Options: - - None - -Comments: - - Uså oæ SHDEFINÅ ió explaineä withiî thå prograí itself® -Iô  ió menu-driveî anä thå erroò anä instructionaì  messageó -arå intended to be clear. - - Thå  mosô compleø commanä ió thå Å (foò Edit©  command® -Afteò  issuinç  thió command¬  thå useò ió  prompteä  foò  á -variablå  name®  Iæ hå giveó thå namå oæ á variablå noô yeô -defined¬  thå  useò ió prompteä foò á  definition¬  anä  thå -variablå ió sï defineä unlesó thå useò respondeä witè jusô á -RETURΠ aô  thió  point®  Iæ thå namå oæ thå  variablå  haó -alreadù  beeî  defined¬  thå useò ió askeä iæ hå  wisheó  tï -deletå (D© oò redefinå (R© thå variable® Appropriatå actioî -is taken in response to the user input. - - The user must be a Wheel to run the SHDEFINE command. - - -Selected Error Messages: - - Self-Explanatory - -Examples of Use: - - SHDEFINE myvars - -- define variables in MYVARS.VAR - -:F - -Command: SHFILE 1.0 - -Syntax: - - SHFILE <-- display name of Shell Variable File -or - SHFILE ufn <-- set name of Shell Variable File - -Function: - - SHFILÅ displayó oò setó thå namå oæ thå Shelì  Variablå -Filå  tï bå useä bù SH®  SHFILÅ maù bå executeä whilå SÈ ió -not running if desired. - -Options: - - None - - -Comments: - - SHDEFINÅ  anä SHVAÒ definå variableó tï bå placeä  intï -Shelì Variablå Files®  SHFILÅ defineó whicè Shelì  Variablå -File will be used by SH when it executes. - - Wheî SÈ anä SHVAÒ execute¬ thå nameä variablå filå theù -deaì witè resideó iî thå ROOÔ directory. - -Selected Error Messages: - - Self-Explanatory - -Examples of Use: - - SHFILE - -- display name of Shell Variable File - - SHFILE myvars.var - -- define name of Shell Variable File - -:V - -Command: SHVAR 1.0 - -Syntax: - - SHVAR <-- list variables -or - SHVAR var <-- delete variable -or - SHVAR var text <-- define/redefine variable - -Function: - - SHVAÒ  ió á utilitù whicè caî lisô alì Shelì  Variableó -iî  thå  currently-defineä Shelì Variablå Filå oò ediô  thió -filå tï deletå oò changå onå particulaò variablå aô á  time® -SHVAÒ  ió  sometimeó morå convenienô tï uså  thaî  SHDEFINE¬ -whicè  ió  intendeä foò editinç groupó oæ variableó  iî  onå -sitting. - - -Options: - - None - -Comments: - - SHVAÒ maù bå useä whilå runninç SÈ oò not®  Iæ á Shelì -Variablå Filå ió alreadù defineä tï thå ZCPR³ System¬  SHVAÒ -uses this file. If one is not defined, SHVAR uses SH.VAR. - - SH.VAR is always located in the ROOT directory. - - The user must be a Wheel to run SHVAR. - -Selected Error Messages: - - Self-Explanatory - - -Examples of Use: - - SHVAR - -- list shell variables - - SHVAR VAR2 - -- delete the variable VAR2 - - SHVAR VARX THIS IS A TEST - -- define VARX to "THIS IS A TEST" - -:C - - SH Concept - - Oncå  SÈ  ió invokeä (bù typinç thå  commanä  SH)¬  anù -commanä typeä bù thå useò ió passeä thrõ SÈ first¬  expandeä -aó required¬  anä then¬ iæ thå commanä ió noô aî SH-residenô -command¬  thå  expandeä commanä linå ió passeä tï ZCPR³  foò -processing. - - SÈ  variableó maù bå nesteä tï anù  depth®  Recursion¬ -however¬  shoulä bå avoided¬ anä iô ió thå responsibilitù oæ -thå  useò  tï  ensurå thaô recursioî  doeó  noô  occur®  Iæ -recursioî doeó occur¬  thå commanä linå buffeò wilì overflo÷ -and SH will abort the command line. - - - SÈ  Variableó  arå  referenceä  iî  commanä  lineó   aó -"%varname"¬  anä  '%%§ ió interpreteä bù SÈ aó á singlå '%'® -Tï  illustrate¬  assumå  thaô SÈ variableó arå  assigneä  aó -follows: - - VAR1 = "ED %%VAR2" VAR2 = "MYFILE.TXT" - -The command line "%VAR1" is expanded as - - "ED %VAR2" - -which is, in turn, is expanded as - - "ED MYFILE.TXT" - -which is finally executed by being passed to ZCPR3. - - - Shelì  Variablå Fileó arå locateä iî thå ROOÔ directorù -for the commands SH and SHVAR. - - Thå  useò  musô  bå  á Wheeì iî  ordeò  tï  ediô  Shelì -Variablå Files®  Thå commandó SHDEFINÅ anä SHVAÒ wilì  onlù -run if the user is a Wheel. - - - There are three SH-resident commands: - - SHCMT - switch SH to run in comment mode; in - comment mode, all lines which - do not begin with the character - ! are treated as comments and - flushed - SHECHO - with Echo enabled, all expanded command - lines are printed to the user to - show him what the line looked like - after expansion - SHEXIT - SH is popped from the Shell Stack, - enabling the next lower Shell for - execution - - The normal prompt for SH is: - - DU:NAME>> - -as opposed to: - - DU:NAME> - -foò  ZCPR3®  Iæ thå SHCMÔ (SÈ Comment© facilitù ió enabled¬ -this prompt becomes: - - DU:NAME; - - Anù  texô  issueä bù thå useò oò á commanä  filå  (likå -ZEX©  wilì  bå  processeä  aó á  commenô  unlesó  thå  firsô -characteò oæ thå linå ió aî exclamatioî marë (!)¬  whicè  ió -an indicator to process the command text that follows. - - Thå commanä SHCMÔ switcheó tï commenô mode¬  anä !SHCMÔ -switches back. - - Thå  SHECHÏ  commanä  ió alsï á  toggle¬  enablinç  anä -disablinç thå echï oæ commanä lineó afteò alì variableó havå -been resolved. - - Thå SHEXIÔ commanä causeó thå Shelì Stacë tï bå  poppeä -onå  level¬  whicè  iî  turî  causeó  thå  SÈ  Shelì  tï  bå -terminated since it was on the top of the stack. - - Botè  SHECHÏ anä SHEXIÔ caî bå executeä froí SÈ Commenô -mode by prefixing these commands with an exclamation mark. - - Thå ¿  commanä (á linå beginninç witè á quesitoî  mark© -invokeó  thå  built-iî  helð facilitù oæ  SH¬  whicè  simplù -reminds the user of what the built-in commands are for SH. - -:P - - Potential Problems - - Onlù onå noteä probleí existó witè SH®  Certaiî ZCPR3- -residenô  anä  SYSRCP-residenô commandó shoulä  bå  avoided® -Theså commandó include: - - GO - because the TPA has been changed since - the desired command executed - - SAVE - same reason - - SÈ   tendó  tï  bå  á  littlå  slo÷  iî  itó   loading® -Unfortunately¬  SÈ  haó  beeî madå aó smalì aó possiblå  anä -wilì  probablù  continuå  tï  takå  morå  timå  thaî  simplù -invoking the ZCPR3 command processor directly. - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SH.MAC b/Source/Images/d_bp/u15/SH.MAC deleted file mode 100644 index c85a4a65..00000000 --- a/Source/Images/d_bp/u15/SH.MAC +++ /dev/null @@ -1,807 +0,0 @@ -; -; Program: SH -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; - -; -; This program illustrates the design of a simple shell under ZCPR3 -; using Z3LIB. This program is transportable from one ZCPR3 system to another -; provided it is reassembled with the correct address for the ZCPR3 -; Environment Descriptor (Z3ENV) or DDT is used to patch this address -; (which is the first two bytes after the opening JMP). If an external -; ZCPR3 Environment Descriptor is not available, one will have to be -; provided by setting the Z3ENV equate to 0 and providing SYSENV.LIB in -; the current directory at assembly time. -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -lecnt equ 20 ;number of pointers on String Ptr Stack -ctrlz equ 'Z'-'@' ;^Z for EOF -cmdch equ '!' ;in comment mode, invoke following text as command -cmtch equ ';' ;comment character -subch equ '%' ;substitution flag -fcb equ 5ch -tbuff equ 80h -cr equ 0dh -lf equ 0ah - -; -; External Z3LIB and SYSLIB Routines -; - ext getshm,putshm - ext getud,putud,logud,initfcb,f$open,f$read,f$close - ext parser,codend,caps,fillb,hmovb,root,getfn1,pfn1 - ext retud,print,pafdc,bbline,moveb,crlf,cout,sksp,dutdir - ext z3init,getsh2,shpush,shpop,qshell,getefcb,putcl,putcst,putzex - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Environment -; -; Set Pointers -; - call codend ;find scratch area - shld intline ;set ptr to internal line buffer - lxi d,200H ;reserve 200H bytes - dad d - shld varlist ;set ptr to variable list - xra a - sta loadfl ;say variables not loaded -; -; Check for Shell Stack -; - call getsh2 ;get shell status - jnz start0 ;skip over shell init - call print - db 'No Shell Stack',0 - ret -; -; See if this program was invoked as a shell -; -start0: - call qshell ;find out from ZCPR3 environment - jz shell ;do not push onto stack if invoked as a shell -start1: -; -; Clear Shell Message for Comment Flag -; - mvi b,0 ;message 0 - xra a ;A=0 to clear - call putshm ;set message -; -; Set Name of Shell Variable File if One is Given -; - call getfn1 ;pt to buffer in env - lxi d,fcb+1 ;pt to name - xchg ;copy from name - mvi b,11 ;11 bytes - mov a,m ;check for name - cpi ' ' ;no name if space - jz defname - call moveb ;copy if name present - call setshdef ;set default file type - jmp setshn -; -; Set Name of SH.VAR File -; -defname: - call getfn1 ;get name - lxi d,shvfcb+1 ;pt to FCB - xchg - mvi b,11 ;11 chars - call moveb -; -; Set Name of Shell from External FCB if Possible or From Default if Not -; -setshn: - call root ;get root address - lxi h,shdisk ;pt to shell disk - mov a,b ;get disk - adi 'A' ;convert to letter - mov m,a ;set disk letter - inx h ;pt to user 10's - mov a,c ;get user number - mvi b,10 ;subtract 10's - mvi d,'0' ;set char -setshn1: - sub b ;subtract - jc setshn2 - inr d ;increment digit - jmp setshn1 -setshn2: - add b ;get 1's - mov m,d ;set 10's digit for user - inx h ;pt to 1's digit - adi '0' ;compute 1's digit - mov m,a ;set 1's digit - call getefcb ;get ptr to external fcb - jz start2 ;no external FCB, so use default name - inx h ;pt to program name - lxi d,shname ;pt to string - mvi b,8 ;8 chars - call moveb ;copy into buffer -; -; Push Name of Shell onto Stack -; -start2: - lxi h,shdisk ;pt to name of shell - call shpush ;push shell onto stack - jnz start3 -; -; Shell Successfully Installed -; - call print - db 'Shell Installed',0 - ret -; -; Shell Stack Push Error -; -start3: - cpi 2 ;shell stack full? - jnz start4 -; -; Shell Stack is Full -; - call print - db 'Shell Stack Full',0 - ret -; -; Shell Stack Entry Size is too small for command line -; -start4: - call print - db 'Shell Stack Entry Size',0 - ret -; -; Restart on Empty Line -; -shellr: - call crlf ;new line -; -; Print Shell Prompt -; -shell: - call retud ;get current user and disk - mov a,b ;save disk - adi 'A' - call cout ;print disk letter - mov a,c ;get user - call pafdc ;print A as floating decimal - call dutdir ;convert into DIR reference if possible - jz shell1 ;no match - mvi a,':' ;print colon - call cout - mvi b,8 ;8 chars max -shell0: - mov a,m ;get char - inx h ;pt to next - cpi ' ' ;space? - cnz cout - jnz shell0 -shell1: - mvi b,0 ;get shell message 0 - call getshm - ani 1 ;test for prompt - jz shell2 ;print normal prompt - call print ;comment format - db '; ',0 ;comment - jmp shell3 -shell2: - call print ;normal format - db '>> ',0 ;double prompt -; -; Accept User Input -; -shell3: - mvi a,1 ;tell ZEX that prompt is up - call putzex - xra a ;don't capitalize - call bbline - mvi a,0 ;say that normal processing is running now - call putcst - call putzex - call sksp ;skip over leading spaces - mvi b,0 ;get shell message 0 - call getshm - ani 1 ;test for comment - jz shell4 ;process normally -; -; Process Shell Input as Comment -; - mov a,m ;get char - cpi cmdch ;command override? - jnz shellr ;continue with next line if not - inx h ;pt to command and fall thru to process -; -; Process Shell Command -; -shell4: - mov a,m ;get first char - ora a ;no line? - jz shellr - cpi cmtch ;comment line? - jz shellr -; -; Check for and Process Shell-Resident Command -; - push h ;save HL - call shcommand ;check for shell command - pop h ;restore HL -; -; Expand Shell Command Line -; - call expand ;expand line pted to by HL - jz clovfl ;abort if overflow -; -; Load Multiple Command Line -; - call putcl ;place command line pted to by HL into CL Buffer - rnz ;resume ZCPR3 processing -; -; Input Line is Longer than Command Line Buffer -; -clovfl: - call print ;command line buffer has overflowed - db cr,lf,'CL Ovfl ',0 - jmp shellr -; -; Expand Shell Command Line (pted to by HL), performing variable -; Substitutions -; -; On exit, Z=command line overflow and Line Pted to by HL -; -expand: - push b ;save counter - mvi b,0 ;get shell register 0 - call getshm - ani 2 ;test for echo - cnz crlf ;new line if SHECHO is ON - pop b ;get counter - xchg ;DE pts to line -; -; Init String Pointer Stack -; - mvi a,lecnt ;set local element count - sta locelt - lxi h,locstk ;set local stack - shld locadr - lxi h,0 ;set done code on stack - call locpush ;push HL -; -; Set Ptrs -; - lhld intline ;pt to internal line - xchg ;DE pts to internal line, HL pt next char - mvi b,0 ;256 chars max -; -; Analyze Next Char -; -exp1: - mov a,m ;get next char - cpi subch ;substitution char? - jnz exp2 ;handle normally -; -; Process Shell Variable -; - call expvar ;resolve variable - dcr c ;error? - jz exp1 ;resume if none -; -; Store Next Char -; -exp2: - stax d ;store char -; -; Print Char if SHECHO is ON -; - push b ;save counter - mov c,a ;save char - mvi b,0 ;get shell message 0 - call getshm ;determines if display is on - ani 2 ;test for echo - jz exp3 - mov a,c ;get char - ani 7FH ;mask and don't output null - cnz cout ;echo char -; -; Advance to Next Char -; -exp3: - mov a,c ;get char - pop b ;get counter - inx h ;pt to next - inx d - dcr b ;count down - jz experr ;error if at 0 - ora a ;done? - jnz exp1 - inr b ;increment count (not counting last 0) - dcx d ;pt to 0 in case of abort -; -; Pop String Ptr Stack and Check for Analysis Complete -; - call locpop ;get ptr to previous string - mov a,h ;done? - ora l - jnz exp1 ;resume - dcr a ;set NZ -; -; Expansion Complete -; On entry, Z Flag is Set Accordingly (Z=Error) -; -experr: - lhld intline ;pt to internal line - ret - -; -; Expand Variable -; Return with HL pting to next char, A=char, C=1 if OK, C=2 if error -; -expvar: - shld varptr ;save ptr to variable - inx h ;get next char - mvi c,2 ;prep for error return - mov a,m ;get it - ora a ;EOL? - rz - cpi subch ;double sub char? - rz ;place one sub char in line if so -; -; Place Variable Into SHVAR -; - push b ;save counter - push d ;save ptr to next char - push h ;save ptr to shell variable - lxi h,shvar ;pt to shell variable buffer - mvi b,8 ;8 chars max - mvi a,' ' ;space fill - call fillb - xchg ;DE pts to shell variable buffer - pop h ;pt to shell variable - mvi b,8 ;8 chars max -; -; Place Shell Variable into Buffer -; -expv1: - mov a,m ;get char - call delck ;check for delimiter - jz expv3 ;done if delimiter - stax d ;save char - inx h ;pt to next - inx d - dcr b ;count down - jnz expv1 -; -; Flush Overflow of Shell Variable -; -expv2: - mov a,m ;get char - inx h ;pt to next - call delck ;check for delimiter - jnz expv2 - dcx h ;pt to delimiter -; -; Shell Variable in buffer SHVAR -; HL pts to delimiter after variable in user line -; -expv3: - call locpush ;stack ptr to next char in current string - jz expv4 ;error in stack - call varload ;load shell variable list - jz expv4 ;failure - call namer ;resolve named variable reference - mvi c,1 ;OK - jz expv5 ;name found - resolve -; -; Shell Variable Not Resolved - Restore Ptr to It -; -expv4: - call locpop ;restore ptr - mvi c,2 ;error - lhld varptr ;pt to variable -; -; Entry Point for OK Return -; -expv5: - mov a,m ;get char - pop d ;pt to target - pop b ;get counter - ret - -; -; Push HL onto String Ptr Stack -; Return with Z if Stack Overflow -; -locpush: - lda locelt ;get count - dcr a ;full? - rz - sta locelt ;set count - push d ;save DE - xchg ;DE pts to old string - lhld locadr ;get ptr to top of stack - mov m,e ;store low - inx h - mov m,d ;store high - inx h ;pt to next - shld locadr - xchg ;restore HL - pop d ;restore DE - xra a ;return NZ - dcr a - ret -; -; Pop HL from String Ptr Stack -; -locpop: - push d - lda locelt ;increment element count - inr a - sta locelt - lhld locadr ;get address - dcx h ;pt to high - mov d,m ;get high - dcx h ;pt to low - mov e,m ;get low - shld locadr ;set address - xchg ;restore ptr - pop d - ret - - -; -; Load Shell Variable List -; -varload: - push h ;save regs - push d - push b - lda loadfl ;already loaded? - ora a ;NZ=yes - jnz varl3 - lhld varlist ;clear varlist in case of error - mvi m,ctrlz -; -; Look for Variable File -; - call getfn1 ;pt to file name of SH.VAR - lxi d,shvfcb+1 - mvi b,11 ;11 bytes - call moveb - call putud ;save current location - call root ;determine DU of root - call logud ;goto root - lhld varlist ;pt to named variable list - lxi d,shvfcb ;try to open file - call initfcb ;init FCB - call f$open - jz varl1 -; -; Variable File Not Found -; - call getud ;return home - xra a ;set not found code - pop b ;restore regs - pop d - pop h - ret -; -; Read in Variable File -; -varl1: - lxi d,shvfcb ;read in file - call f$read - jnz varl2 - lxi d,tbuff ;pt to data - xchg ;copy into memory - mvi b,128 ;128 bytes - call hmovb - xchg - jmp varl1 -varl2: - lxi d,shvfcb ;close file - call f$close - call getud ;return home -; -; Say List is Already Loaded -; -varl3: - xra a ;return NZ for OK - dcr a - sta loadfl ;set loaded flag - pop b ;restore regs - pop d - pop h - ret - -; -; Resolve Named Variable Reference -; On input, SHVAR contains the shell variable name and -; CODEND pts to the list of shell variables, terminated by ^Z; -; if found, return with HL pting to name and Z -; -namer: - lhld varlist ;pt to variable list -namer1: - mov a,m ;get char - cpi ctrlz ;end of list? - jz namex - lxi d,shvar ;pt to shell variable name - mvi b,8 ;8 chars -namer2: - ldax d ;get name - cmp m ;match? - jnz nomatch - inx h ;pt to next - inx d - dcr b ;count down - jnz namer2 - ret ;found! -nomatch: - mov a,m ;flush to end of string - inx h ;pt to next - ora a - jnz nomatch - jmp namer1 ;resume search -; -; Search Failed -; -namex: - ora a ;return NZ (^Z in A) - ret -; -; Check to see if char in A is a delimiter -; Return with Z if so -; -delck: - push h ;pt to table - push b ;save BC - call caps ;capitalize char - mov b,a ;char in B - lxi h,dtable ;pt to delimiter table -delck1: - mov a,m ;get delimiter - ora a ;done? - jz notdel - cmp b ;compare - jz yesdel - inx h ;pt to next - jmp delck1 -notdel: - mov a,b ;get char - ora a ;set Z if null, else NZ -yesdel: - mov a,b ;restore char - pop b ;restore regs - pop h - ret - -; -; Delimiter Table -; -dtable: - db '<>;:,.=-_ ',0 - -; -; Check for Shell Command and Process if Found -; HL pts to command line -; -shcommand: - xra a ;DIR before DU - call parser ;parse command line pted to by HL - inx d ;pt to name - lxi h,ctable ;pt to command table -shcmd: - mov a,m ;get first char of next entry - ora a ;done? - rz - mvi b,8 ;commands are 8 chars long - push h ;save ptr to FCB - push d ;save ptr to table entry -shcmd1: - ldax d ;compare - cmp m - jnz shcmd2 - inx h ;pt to next - inx d - dcr b ;count down - jnz shcmd1 -; -; Command Found - Get Address -; - mov a,m - inx h - mov h,m - mov l,a ;HL is address -; -; Clear Stack and Run -; - pop psw ;clear stack - pop psw - pop psw ;clear return address - pop psw ;clear pushed HL - pchl ;"run" command -; -; Command Not Found Yet -; -shcmd2: - pop d ;restore ptrs - pop h - lxi b,10 ;advance to next command - dad b - jmp shcmd ;resume search - -; -; If File Type not Specified, Set Default -; -setshdef: - call getfn1 ;check for file type - lxi d,8 ;pt to file byte - dad d - xchg - lxi h,shvtype ;default file type - mvi b,3 ;3 chars - ldax d ;get char - cpi ' ' ;set if space - cz moveb ;copy - ret -; -; Pop Current Shell -; -shexit: - call print - db cr,lf,'Exiting Shell',0 - jmp shpop ;clear shell stack entry - -; -; Toggle Shell Comment Mode -; -shcomment: - mvi b,0 ;access shell register 0 - call getshm - mov c,a ;save in C - ani 0FEH ;all bits but comment bit - mov d,a - mov a,c ;get comment bit - cma ;flip comment bit (other bits are 1) - ani 1 ;select just comment bit - ora d ;OR in other bits - call putshm ;set new value - jmp shellr ;resume -; -; Toggle Shell Echo Mode -; -shecho: - call print - db cr,lf,' Echo of Shell Commands is O',0 - mvi b,0 ;access shell register 0 - call getshm - mov c,a ;save in C - ani 0FDH ;all bits but echo bit - mov d,a - mov a,c ;get comment bit - cma ;flip comment bit (other bits are 1) - ani 2 ;select just echo bit - ora d ;OR in other bits - call putshm ;set new value - ani 2 ;test echo bit - jz shecho1 - call print - db 'N',0 - jmp shellr -shecho1: - call print - db 'FF',0 - jmp shellr ;resume - -; -; Print Names of SH Commands -; -shhelp: - call print - db cr,lf,'SH Commands --',cr,lf,0 - lxi h,ctable ;pt to table - mvi c,0 ;set count -shh1: - mov a,m ;done? - ora a - jz shellr - call print - db ' ',0 - mvi b,8 ;8 chars -shh2: - mov a,m ;get char - call cout - inx h ;pt to next - dcr b ;count down - jnz shh2 - inr c ;increment count - mov a,c - ani 3 ;new line? - cz crlf - inx h ;skip address - inx h - jmp shh1 ;next - -; -; Command Table -; -ctable: - db '? ' ;help - dw shhelp - db 'SHCMT ' ;comment mode - dw shcomment - db 'SHECHO ' ;echo input - dw shecho - db 'SHEXIT ' ;exit shell - dw shexit - db 0 ;end of table - -; -; Buffers -; -shvfcb: - db 0 - db 'SH ' ;name of shell variable file -shvtype: - db 'VAR' - ds 24 ;36 bytes total -shdisk: - db 'A' ;disk letter - db '00' ;user number - db ':' ;separator -shname: - db 'SH ',0 ;name of shell to go onto stack -shvar: - db ' ' ;shell variable -locelt: - ds 1 ;string stack element count -locadr: - ds 2 ;ptr to next entry on stack -locstk: - ds lecnt*2 ;string ptr stack -varptr: - ds 2 ;ptr to current variable in line -varlist: - ds 2 ;ptr to named variable list -intline: - ds 2 ;ptr internal expansion line -loadfl: - ds 1 ;variables loaded flag - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SH11.LBR b/Source/Images/d_bp/u15/SH11.LBR deleted file mode 100644 index 90792ebb..00000000 Binary files a/Source/Images/d_bp/u15/SH11.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/SHCTRL.COM b/Source/Images/d_bp/u15/SHCTRL.COM deleted file mode 100644 index 2555092b..00000000 Binary files a/Source/Images/d_bp/u15/SHCTRL.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SHCTRL.MAC b/Source/Images/d_bp/u15/SHCTRL.MAC deleted file mode 100644 index bf8ff6a5..00000000 --- a/Source/Images/d_bp/u15/SHCTRL.MAC +++ /dev/null @@ -1,148 +0,0 @@ -; -; Program: SHCTRL -; Author: Richard Conn -; Version: 1.0 -; Date: 29 Mar 84 -; -version equ 10 -z3env SET 0f400h - -; -; SHCTRL is used to provide simple control of the ZCPR3 shell -; stack from the command line. This program accepts one of two parameters: -; -; SHCTRL CLR or SHCTRL C <-- Clear the Shell Stack -; SHCTRL DIS or SHCTRL D <-- Display Shell Stack -; SHCTRL POP or SHCTRL P <-- Pop the Shell Stack -; - -; -; Equates -; -fcb equ 5ch -cr equ 0dh -lf equ 0ah - -; -; SYSLIB and Z3LIB Routines -; - ext z3init,shpop,getsh2,qprint,print,pafdc,pstr - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - -; -; Print Banner -; - call qprint - db 'SHCTRL Version ' - db (version/10)+'0','.',(version mod 10)+'0',0 - -; -; Check for Command -; - lda fcb+1 ;get first char - cpi 'C' ;clear? - jz shclear - cpi 'D' ;display? - jz shdisplay - cpi 'P' ;pop? - jz shspop - -; -; Print help -; - call print - db cr,lf,'SHCTRL - Control Shell Stack' - db cr,lf,'Syntax:' - db cr,lf,' SHCTRL C or SHCTRL CLR - Clear Shell Stack' - db cr,lf,' SHCTRL D or SHCTRL DIS - Display Shell Stack' - db cr,lf,' SHCTRL P or SHCTRL POP - Pop Shell Stack' - db 0 - ret - -; -; Clear Shell Stack -; -shclear: - call getsh2 ;get address of shell stack - mvi m,0 ;clear it - call qprint - db ' - Shell Stack Clear',0 - ret - -; -; Pop Shell Stack -; -shspop: - call shpop ;pop stack - call qprint - db ' - Shell Stack Popped',0 - ret - -; -; Display Shell Stack -; -shdisplay: - call getsh2 ;get address of shell stack (HL), size of - ; shell stack entry (DE), and count (A,B) - call print ;print message - db ' - Shell Stack Data' - db cr,lf,' Size of Shell Stack: ',0 - mov a,b ;get size - call pafdc ;print - call print - db ' Elements' - db cr,lf,' Shell Stack Elements:',0 - mov a,m ;check for empty - ora a - jnz shdisp1 - call print - db cr,lf,' Shell Stack Empty',0 - ret -shdisp1: - mov a,m ;check for done - ora a - rz - call print - db cr,lf,' --> ',0 - push h ;save ptr - call pstr ;print element - pop h ;get ptr - dad d ;count down - dcr b ;count down - jnz shdisp1 - ret - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SHDEFINE.COM b/Source/Images/d_bp/u15/SHDEFINE.COM deleted file mode 100644 index 286c69c8..00000000 Binary files a/Source/Images/d_bp/u15/SHDEFINE.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SHDEFINE.MAC b/Source/Images/d_bp/u15/SHDEFINE.MAC deleted file mode 100644 index e96823ba..00000000 --- a/Source/Images/d_bp/u15/SHDEFINE.MAC +++ /dev/null @@ -1,659 +0,0 @@ -; -; Program: SHDEFINE -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; -version equ 10 - -; -; SHDEFINE is used to define shell variables for the Shell SH. -; It makes entries into the file SH.VAR in the ROOT directory. -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -backup equ 0 ;backup old file? 1 for yes, 0 for no -ctrlz equ 'Z'-'@' ;^Z for EOF -fcb equ 5ch -tbuff equ 80h -cr equ 0dh -lf equ 0ah - -; -; External Z3LIB and SYSLIB Routines -; - ext sctlfl,sout,sprint,scrlf,shldc - ext bbline,sksp,capine,fillb,cout,moveb,getfn1 - ext initfcb,f$open,f$read,f$close,f$make,f$delete,f$write,f$rename - ext z3init,qprint,codend,hmovb,root,logud,getwhl,print - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Environment - call banner ;print banner -; -; Check for Wheel -; - call getwhl ;get wheel byte - jnz start0 - call print - db cr,lf,' Not Wheel - Aborting',0 - ret -; -; Try to Load Variables -; -start0: -; -; Define File to Work With -; - lxi h,fcb+1 ;check for file name - lxi d,shvfcb+1 ;variable FCB - mvi b,11 ;11 chars - mov a,m ;any name given? - cpi ' ' ;space if none - jz setdef ;set default shell variable file name -; -; Define Passed Name as Shell Variable File -; - call moveb ;set name - lxi h,deftype ;set default type if none - lxi d,shvfcb+9 ;pt to type - mvi b,3 ;3 chars - ldax d ;any chars - cpi ' ' ;if none, copy - cz moveb - jmp bakdef -; -; Define from Shell Variable File Name -; -setdef: - call getfn1 ;get name - call moveb ;copy it -; -; Define $$$ and BAK Files -; -bakdef: - lxi h,shvfcb+1 - lxi d,shvtmp+1 ;set $$$ name - mvi b,8 ;8 chars - call moveb -; - if backup - lxi d,shvbak+1 ;set BAK name - call moveb - endif ;backup -; -; Load Variables -; - call varload - jnz start1 -; -; Initialize Shell Variables if File Not Found -; - call codend ;pt to code end - mvi m,ctrlz ;place ^Z -; -; Process User Commands -; -start1: - call menu ;use menu - rz ;abort - call varsave ;save new shell variables - ret - -; -; Input and Process User Commands -; Return with Z if Abort -; -menu: - call print - db cr,lf - db cr,lf,' ** Shell Variable Editor **' - db cr,lf - db cr,lf,'Edit: E. Edit (Add/Delete/Redefine) Shell Variables' - db cr,lf,' L. List Shell Variables on Console' - db cr,lf,' P. Print Shell Variables on Printer' - db cr,lf - db cr,lf,'Exit: X. Exit and Update SH.VAR on Disk' - db cr,lf,' Q. Quit without Updating SH.VAR' - db cr,lf - db cr,lf,'Command: ',0 - call capine ;get command - lxi h,ctable ;scan command table - call tscan - call print - db ' Invalid Command: ',0 - call cout - jmp menu -; -; Pack and Menu Exit -; Return NZ -; -pack: - call codend ;pack entries in table - mov d,h ;HL=DE - mov e,l -; -; Check Next Entry -; -pack1: - mov a,m ;get next char - stax d ;put it - cpi ctrlz ;done? - jz packx - cpi ' ' ;deleted? - jz pack3 -; -; Copy Entry -; -pack2: - mov a,m ;get char - stax d ;put it - inx h ;pt to next - inx d - ora a ;done? - jnz pack2 - jmp pack1 ;resume -; -; Skip Entry -; -pack3: - mov a,m ;get char - inx h ;pt to next - ora a ;done? - jnz pack3 - jmp pack1 ;resume -; -; Pack Complete -; -packx: - xra a ;NZ - dcr a - ret -; -; Menu Quit -; Return Z -; -mquit: - call print - db cr,lf,' Do you really want to quit (Y/N)? ',0 - call capine - cpi 'Y' - jnz menu - xra a ;Z - ret -; -; List Names in Table on Printer -; -nprint: - mvi a,80H ;select print - jmp nliste -; -; List Names in Table on Console -; -nlist: - mvi a,1 ;select console -nliste: - sta sctlfl ;set flag - call pack ;pack table -nlist0: - call sprint - db cr,lf,'List of Shell Variables',0 - lxi d,0 ;set count - call codend ;pt to list -; -; Main List Loop -; -nlist1: - mov a,m ;get next variable - cpi ctrlz ;done? - jz nlistx -; -; Print Next Element -; - xchg ;print number - inx h ;increment count - call scrlf - call shldc ;print - xchg ;DE contains count - call sprint - db ' Name: ',0 - mvi b,8 ;8 chars in name -nlist2: - mov a,m ;get char - call sout ;print - inx h ;pt to next - dcr b ;count down - jnz nlist2 - call sprint - db cr,lf,' >',0 -nlist3: - mov a,m ;get char - inx h ;pt to next - ora a ;done? - jz nlist4 ;resume - call sout - jmp nlist3 -nlist4: - call sprint - db '<',0 - jmp nlist1 -; -; Exit Listing -; -nlistx: - call scrlf ;new line - mov a,d ;check for none - ora e - jnz menu ;resume menu - call sprint - db ' -- No Shell Variables Defined --',cr,lf,0 - jmp menu - -; -; Add Names to Table -; -nadd: - call print - db cr,lf,'Enter Shell Variable Name (RETURN to Quit): ',0 - mvi a,0ffh ;capitalize - call bbline - call sksp ;skip to first non-blank - ora a ;done? - jz menu ;resume menu -; -; Copy Input Name into Shell Buffer SHVAR -; - push h ;save ptr to name - lxi h,shvar ;init name buffer - mvi a,' ' ;space fill - mvi b,8 ;8 chars - call fillb - xchg ;pt to buffer in DE - pop h ;pt to name - mvi b,8 ;8 chars max -nadd1: - mov a,m ;get name char - ora a ;done? - jz nadd2 - stax d ;store char - inx h ;pt to next - inx d - dcr b ;count down - jnz nadd1 -; -; Search for Name -; -nadd2: - call codend ;pt to first element -; -; Check for End of Entries -; -nadd3: - mov a,m ;get first char of next string - cpi ctrlz - jz addit ;add name at HL -; -; Compare Names -; - lxi d,shvar ;pt to variable - mvi b,8 ;compare - shld curname ;save ptr to current name in case of delete -nadd4: - ldax d ;check for duplicate - cmp m - jnz nadd5 - inx h ;pt to next - inx d - dcr b ;count down - jnz nadd4 - jmp nadd6 -; -; No Match, so Skip Rest of String -; -nadd5: - mov a,m ;skip to end of string - inx h ;pt to next - ora a ;done? - jnz nadd5 - jmp nadd3 ;resume -; -; Match - Determine What User Wants to Do -; -nadd6: - call print - db cr,lf,' Shell Variable Name ',0 - call prname ;print name - call print - db ' Found -' - db cr,lf,' Delete It (D)' - db cr,lf,' Redefine It (R)' - db cr,lf,' No Change (anything else)' - db cr,lf,'Option: ',0 - call capine - cpi 'D' ;delete? - jz delete - cpi 'R' ;redefine? - jnz nadd ;restart if not -; -; Redefine Name -; - lhld curname ;pt to name in buffer - mvi b,8 ;space fill it - mvi a,' ' - call fillb - jmp nadd3 ;resume in case another duplicate -; -; Delete Name -; -delete: - lhld curname ;pt to name in buffer - mvi b,8 ;space fill it - mvi a,' ' - call fillb - jmp nadd ;restart -; -; Add Name -; -addit: - shld curname ;save ptr to new name - xchg ;dest in DE - lxi h,shvar ;pt to name - mvi b,8 ;8 chars - call hmovb ;copy name into buffer - xchg ;pt to after name with HL - push h ;save ptr - mvi m,0 ;store ending 0 and ^Z in case of abort - inx h - mvi m,ctrlz ;store ^Z - call print - db cr,lf,' Definition of ',0 - call prname ;print name - call print - db ' (RETURN to Abort) -',cr,lf,'--> ',0 - mvi a,0ffh ;caps - call bbline - pop d ;get destination - mov a,m ;no input? - ora a ;noadd if not - jz noadd -; -; Copy User Input into Buffer -; -addit1: - mov a,m ;get char - stax d ;put char - inx h ;pt to next - inx d - ora a ;done? - jnz addit1 - mvi a,ctrlz ;mark end - stax d - jmp nadd - -; -; Abort Add -; -noadd: - lhld curname ;pt to first char - mvi m,ctrlz ;mark end - jmp nadd - -; -; Print Name of Shell Variable -; -prname: - push h ;save regs - push b - lxi h,shvar ;pt to name - mvi b,8 ;8 chars -prn1: - mov a,m ;get char - call cout - inx h ;pt to next - dcr b ;count down - jnz prn1 - pop b ;restore - pop h - ret - -; -; Command Table Scanner -; -tscan: - mov b,a ;save char in B -tscan1: - mov a,m ;end of table? - ora a - mov a,b ;prep for return - rz - mov a,m ;get table char - cmp b ;match? - jz tscan2 - inx h ;pt to next entry - inx h - inx h - jmp tscan1 -; -; Command Found - Run It -; -tscan2: - inx h ;get address - mov e,m - inx h - mov d,m - xchg ;address in HL - pop psw ;clear stack - pchl ;"run" command -; -; Command Table -; -ctable: - db 'E' ;enter - dw nadd - db 'L' ;list - dw nlist - db 'P' ;print - dw nprint - db 'X' ;exit - dw pack - db 'Q' ;quit - dw mquit - db 0 ;end of table - -; -; Print Banner -; -banner: - call qprint - db 'SHDEFINE, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db 0 - ret -; -; Save Shell Variable List -; Return with Z if Error -; -varsave: - call print - db cr,lf,' Writing Shell Variables to Disk',0 - lxi d,shvtmp ;open temp - call initfcb - call f$delete ;delete if any exists - call f$make ;create new file - inr a ;error? - rz - call codend ;pt to scratch area -; -; Save Loop -; -vars1: - lxi d,tbuff ;copy into buffer - mvi b,128 ;128 bytes - call hmovb - lxi d,shvtmp ;write block - call f$write - jnz werr ;write error - lxi d,tbuff ;check for done - mvi b,128 ;128 bytes -; -; Check for Done -; -vars2: - ldax d ;look for ^Z - cpi ctrlz - jz varsx - inx d ;pt to next - dcr b ;count down - jnz vars2 - jmp vars1 -; -; Done -; -varsx: - lxi d,shvtmp ;close temp file - call f$close -; -; Delete Old Backup File SH.BAK -; - if backup -; - lxi d,shvbak ;delete any old backups - call initfcb - call f$delete -; -; Create New Backup File SH.BAK=SH.VAR -; - lxi h,shvbak ;new name - lxi d,shvfcb ;old name - call f$rename ;create backup file -; - else -; -; Erase Original File -; - lxi d,shvfcb ;delete file - call initfcb - call f$delete -; - endif ;backup -; -; Create New Shell Variable File SH.VAR=SH.$$$ -; - lxi h,shvfcb ;new name - lxi d,shvtmp ;old name - call f$rename ;create new file - xra a ;return OK - dcr a ;NZ - ret -; -; File Write Error -; -werr: - call print - db cr,lf,'Error in Writing File - Aborting',0 - xra a ;error code - ret - -; -; Load Shell Variable List -; Return with Z if Error -; -varload: -; -; Look for Variable File -; - call root ;determine DU of root - call logud ;goto root - call codend ;pt to scratch area - mvi m,ctrlz ;prep for no file - lxi d,shvfcb ;try to open file - call initfcb ;init FCB - call f$open - rnz ;file not found -; -; Read in Variable File -; -varl1: - lxi d,shvfcb ;read in file - call f$read - jnz varl2 - lxi d,tbuff ;pt to data - xchg ;copy into memory - mvi b,128 ;128 bytes - call hmovb - xchg - jmp varl1 -varl2: - lxi d,shvfcb ;close file - call f$close -; -; Say List is Already Loaded -; - xra a ;return NZ for OK - dcr a - ret - -; -; Buffers -; -curname: - ds 2 ;ptr to current variable name -shvar: - ds 8 ;shell variable name -deftype: - db 'VAR' ;default file type -; - if backup -shvbak: - db 0 - db 'SH ' ;name of shell variable file - db 'BAK' - ds 24 ;36 bytes total - endif ;backup -; -shvtmp: - db 0 - db 'SH ' ;name of shell variable file - db '$$$' - ds 24 ;36 bytes total -shvfcb: - db 0 - db 'SH ' ;name of shell variable file - db 'VAR' - ds 24 ;36 bytes total - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SHFILE.COM b/Source/Images/d_bp/u15/SHFILE.COM deleted file mode 100644 index 7c458537..00000000 Binary files a/Source/Images/d_bp/u15/SHFILE.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SHFILE.MAC b/Source/Images/d_bp/u15/SHFILE.MAC deleted file mode 100644 index ec58b66e..00000000 --- a/Source/Images/d_bp/u15/SHFILE.MAC +++ /dev/null @@ -1,105 +0,0 @@ -; -; Program: SHFILE -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; -version equ 10 - -; -; SHFILE defines the name of the shell variable file or displays it. -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -fcb equ 5ch -cr equ 0dh -lf equ 0ah - -; -; External Z3LIB and SYSLIB Routines -; - ext z3init,getfn1,print,pfn1,moveb,qprint - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment and Print Banner -; - call z3init ;initialize the ZCPR3 Environment - call qprint - db 'SHFILE, Version ' - db (version/10)+'0','.',(version mod 10)+'0',cr,lf,0 -; -; Set Name of Shell Variable File -; - call getfn1 ;get ptr to file name 1 - lxi d,fcb+1 ;pt to name in FCB - xchg ;copy from FCB - mvi b,11 ;11 bytes - mov a,m ;get first char - cpi ' ' ;don't define if no name - jz prshfile - call moveb ;define name - call setshdef ;set default file type if none given -; -; Print Name of Shell Variable File -; -prshfile: - call print - db ' Shell Variable File Name is ',0 - call getfn1 ;pt to name - xchg - call pfn1 - ret -; -; Set Type of Shell Variable File if None Given -; -setshdef: - call getfn1 ;check for file type - lxi d,8 ;pt to file byte - dad d - xchg - lxi h,shvtype ;default file type - mvi b,3 ;3 chars - ldax d ;get char - cpi ' ' ;set if space - cz moveb ;copy - ret - -; -; Buffers -; -shvtype: - db 'VAR' - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SHOW.COM b/Source/Images/d_bp/u15/SHOW.COM deleted file mode 100644 index b91c0608..00000000 Binary files a/Source/Images/d_bp/u15/SHOW.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SHOW.MAC b/Source/Images/d_bp/u15/SHOW.MAC deleted file mode 100644 index 70485a86..00000000 --- a/Source/Images/d_bp/u15/SHOW.MAC +++ /dev/null @@ -1,1753 +0,0 @@ -; -; Program: SHOW -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; -version equ 10 -z3env SET 0f400h - -; -; The purpose of SHOW is to display various details about the ZCPR3 -; System to the ZCPR3 user. Details on the ZCPR3 Environment Descriptor, -; what facilities are available, and what the status of these facilities -; is are included. -; - -; -; Basic Equates -; -fcb equ 5ch -cr equ 0dh -lf equ 0ah -ctrlc equ 'C'-'@' -ctrlr equ 'R'-'@' - -; -; External References -; - ext envptr - ext tinit,dinit ;from VLIB - ext z3vinit,cls,gotoxy,gxymsg,vprint,at ;from VLIB - ext getiop - ext retud,pfn1 - ext getpath,dutdir,bbline,eval16 - ext capine,cout,crlf,print,pstr,getmsg,padc,pafdc,phl4hc,pa2hc - ext shempty,shfull,getsh - ext geter1,geterc,puter1,puterc - ext getfcp,getrcp,getefcb - ext getndr - ext strtzex,stopzex - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3vinit ;initialize the ZCPR3 Env and the VLIB Env - shld dumpstrt ;set beginning address of memory dump - lda fcb+1 ;check for E option (error handler) - cpi ' ' ;no option, so proceed - jz show - cpi 'E' ;install SHOW as error handler - jz errins - call print - db 'SHOW Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db cr,lf,'Syntax:' - db cr,lf,' SHOW <-- Invoke Normally' - db cr,lf,' SHOW E <-- Install as Error Handler' - db 0 - ret -; -; Install SHOW as an error handler -; -errins: - call getefcb ;pt to name of command - jnz errins1 - lxi h,showcmd-1 ;pt to command line -errins1: - inx h ;pt to first char - push h ;save ptr - lxi d,8 ;skip to file type field - dad d - mvi m,0 ;store ending 0 - pop h - call puterc ;store error handler command line - mvi a,0ffh ;turn on error handlers - call puter1 - call print - db 'SHOW Installed as an Error Handler',0 - ret -; -; Print Menu and Accept Command -; -show: - call tinit ;init terminal - call stopzex ;stop ZEX if running - call banner ;print banner - call gxymsg - db 3,31 - db '--> ',1,'SHOW Menu',2,' <--',0 - mvi h,7 ;begin on row 7 - mvi l,10 ;column 10 - shld infoxy - call dispxy ;position for display - call vprint - db ' ' - db ' PACKAGE DATA ',0 - call dispxy ;position for display - call vprint - db ' C -- ' - db 1,'Command Packages ',2,0 - call dispxy ;position for display - call vprint - db ' I -- ' - db 1,'Input/Output Package',2,0 - call dispxy ;position for display - call dispxy ;position for display - call vprint - db ' ' - db ' ENVIRONMENT ',0 - call dispxy ;position for display - call vprint - db ' E -- ' - db 1,'Error Handler ',2,0 - call dispxy ;position for display - call vprint - db ' M -- ' - db 1,'Memory Utility ',2,0 - call dispxy ;position for display - call vprint - db ' N -- ' - db 1,'Named Directory ',2,0 - call dispxy ;position for display - call vprint - db ' P -- ' - db 1,'Path Expression ',2,0 - call dispxy - call vprint - db ' S -- ' - db 1,'Shell Stack ',2,0 - mvi h,7 ; row 7 - mvi l,40 ; column 40 - shld infoxy - call dispxy - call vprint - db ' ' - db 'ZCPR3 SYSTEM DATA ',0 - call dispxy - call vprint - db ' 1 -- ' - db 1,'Env Descriptor ',2,0 - call dispxy - call vprint - db ' 2 -- ' - db 1,'Message Buffers ',2,0 - call dispxy - call vprint - db ' 3 -- ' - db 1,'CRT and Printer Data',2,0 - call dispxy - call vprint - db ' 4 -- ' - db 1,'System File Defns ',2,0 - call dispxy - call dispxy - call dispxy - call vprint - db ' X -- ' - db 1,'Exit',2,0 -; -; Input Command from User -; -getcmd: - call gxymsg ;print prompt - db 23,10,'SHOW Command? ',0 - call capine ;get command -getcmd1: - call ctabscan ;scan for and process command - call print ;print error message - db 7,0 ;beep - jmp getcmd -; -; Print Banner -; -banner: - call cls ;clear screen - call gxymsg ;print banner message - db 1,27 ;row/col - db '>>>> ' - db 'SHOW Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db ' <<<<',0 - ret -; -; Command Table -; -ctable: - db '1' ;Env Desc - dw envdes - db '2' ;Messages - dw msg - db '3' ;CRT and Printer - dw cpdata - db '4' ;File Names - dw fnames - db 'C' ;Command Package Status - dw command - db 'E' ;Error Handler Display - dw errorh - db 'I' ;I/O Package Display - dw iopack - db 'M' ;Memory Utility - dw memory - db 'N' ;Named Directory Data - dw namedir - db 'P' ;Path Display - dw pdisp - db 'S' ;Shell Stack Display - dw shstack - db 'X' ;Exit - dw exit - db ctrlc ;Exit - dw exit - db cr ;New Screen - dw show - db ' ' ;New Screen - dw show - db ctrlr ;New Screen - dw show - db 0 ;end of table -; -; Scan for and transfer control to command routine -; -ctabscan: - lxi h,ctable ;pt to command table - mov c,a ;command in C -ctab1: - mov a,m ;get char from table - ora a ;done? - rz - cmp c ;check for match - jz ctab2 - inx h ;skip address - inx h - inx h ;pt to next command char - jmp ctab1 -ctab2: - inx h ;pt to address - mov a,m ;get low - inx h - mov h,m ;get high - mov l,a ;HL pts to command - pop psw ;clear stack - pchl ;"goto" command -; -; **** Deinitialize Terminal and Exit to ZCPR3 **** -; -exit: - call strtzex ;resume ZEX if running - jmp dinit ;deinit terminal -; -; **** Memory Dumper **** -; -memory: - call banner - call gxymsg - db 3,25 - db '--> ',1,'Memory Display at ',0 - lhld dumpstrt ;start of dump address - call phl4hc - call vprint - db 2,' <--',cr,lf,0 - mvi b,16 -mem1: - shld cline ;set current line ptr - call crlf ;new line - call phl4hc ;print address - call vprint - db 1,' --',2,0 - mvi c,16 ;count for elements -mem2: - mov a,c ;extra space? - ani 3 - mvi a,' ' ;extra space - cz cout - mov a,m ;get next byte - call pa2hc ;print as hex - mvi a,' ' ;space - call cout - inx h ;pt to next - dcr c ;count down - jnz mem2 - call vprint - db 1,'| ',2,0 - lhld cline ;pt to current line again - mvi c,16 ;count again -mem3: - mov a,m ;get next byte - ani 7fh ;mask MSB - cpi ' ' - jnc mem4 - mvi a,'.' ;dot fill -mem4: - call cout - inx h ;pt to next - dcr c ;count down - jnz mem3 - dcr b ;count down major loop - jnz mem1 - call gxymsg ;print prompt - db 23,10 - db 1,'Command (<=last, >=next, A=adr, SHOW Cmd)? ',2,0 - call capine ;get input - cpi 'A' ;address? - jz memadr - cpi '>' ;advance? - jz memnext - cpi '.' ;advance? - jz memnext - cpi '<' ;backup? - jz memback - cpi ',' ;backup? - jz memback - jmp getcmd1 ;process otherwise -memadr: - call print - db 'ddress (Hex)? ',0 - mvi a,0ffh ;capitalize - call bbline ;get line from user -mema1: - mov a,m ;skip leading spaces - inx h ;pt to next char - cpi ' ' - jz mema1 - dcx h ;pt to first char - call eval16 ;evaluate as hex - xchg ;result in HL - shld dumpstrt ;set new start address - jmp memory ;restart -memnext: - lhld dumpstrt ;advance 1 page - inr h - shld dumpstrt - jmp memory ;restart -memback: - lhld dumpstrt ;backup 1 page - dcr h - shld dumpstrt - jmp memory ;restart -; -; **** ZCPR3 Messages **** -; -msg: - call banner - call gxymsg - db 3,25 - db '--> ',1,'ZCPR3 System Messages',2,' <--',0 - mvi h,5 ; row 5 - mvi l,5 ; column 5 - shld infoxy - mvi a,22h ; offset - call compenv ; pt to address of messages - mov a,m - inx h - mov h,m - mov l,a ; HL pts to first message - call dispxy - call vprint - db 1,'Error Handler Defined? ',2,0 - mov a,m ; get flag - call pryn - mov a,m ; get flag again - ora a ; defined? - jz msg1 - push h - lxi d,10h ; pt to error command line - dad d - call dispxy - call vprint - db 1,' Error Handler: ',2,0 - call pstr - pop h -msg1: - inx h - call dispxy - call dispxy - call vprint - db 1,'Current IF Level: ',2,0 - mvi b,8 ; set IF count - mov c,m ; get IF flag -iftst: - mov a,c ; get flag - rlc - mov c,a ; save flag - jc iftst1 - dcr b ; count down - jnz iftst -iftst1: - mov a,b ; get char - call padc - inx h ; pt to IF active flag - inx h ; pt to command status - shld cstat ; save address - inx h ; pt to error address - inx h - inx h ; pt to program error code - call dispxy - call dispxy - call vprint - db 1,'Program Error Code: ',2,0 - mov a,m - call padc - inx h ; pt to ZEX message byte - inx h ; pt to ZEX running flag - call dispxy - call dispxy - call vprint - db 1,'ZEX Running? ',2,0 - mov a,m - call pryn - mov a,m ; make sure we have char - inx h ; skip ZEX data - inx h - inx h - ora a ; ZEX running? - jz nozex - mov e,m ; get low-order - inx h - mov d,m ; get high-order - call dispxy - call vprint - db 1,'Address of ZEX Buffer: ',2,0 - xchg - call phl4hc ; print address - xchg - jmp scb ; process shell control byte now -nozex: - inx h -scb: - inx h ; pt to shell control byte - push h - mvi h,5 ; row 5 - mvi l,40 ; column 40 - shld infoxy - pop h - call dispxy - call vprint - db 1,'Shell Control --',2,0 - call dispxy - call vprint - db 1,' Enable Shell Comment? ',2,0 - mov a,m - ani 1 - call pryn - call dispxy - call vprint - db 1,' Enable Shell Echo? ',2,0 - mov a,m - ani 10b - call pryn - call dispxy - call vprint - db 1,' Enable Shell Wait? ',2,0 - mov a,m - ani 80h - call pryn - push h ; save ptr to next message byte - lhld cstat ; get ptr to command status - call dispxy - call dispxy - call vprint - db 1,'Command Status: ',2,0 - mov a,m ; get it - ani 3 ; 2 LSBs - jz csnorm - cpi 1 - jz csshell - call print - db 'Error',0 - inx h ; pt to error address - mov a,m ; get low - inx h - mov h,m ; get high - mov l,a - call dispxy - call vprint - db 1,' Error Command ',2,0 - call dispxy - call print - db ' ',0 -erprt: - mov a,m ; get char - cpi ' '+1 ; end of command with space or less? - jc csdone - cpi ';' ; end of command with new command? - jz csdone - call cout ; print char - inx h - jmp erprt -csnorm: - call print - db 'Normal',0 - jmp csdone -csshell: - call print - db 'Shell',0 -csdone: - pop h ; restore ptr - lxi d,35 ; jump to registers - dad d - push h - mvi h,17 ; row 17 - mvi l,5 ; column 5 - shld infoxy - pop h - call dispxy - call vprint - db 1,'Registers --',2,0 - call dispxy ; new line - mvi b,10 ; 10 times - mvi c,0 -regl: - call vprint - db 1,' ',0 - mvi a,10+'0' ; compute reg char - sub b ; get value - call cout - call vprint - db '=',2,0 - mov a,m ; get value - inx h ; pt to next - call padc ; print - inr c ; every 4 - mov a,c ; get count - ani 3 - cz dispxy ; new line - dcr b ; count down - jnz regl - lxi d,6 ; skip to user-defined values - dad d - push h - mvi h,17 ; row 17 - mvi l,40 ; column 40 - shld infoxy - pop h - call dispxy - call vprint - db 1,'User-Defined Area --',2,0 - call dispxy ; new line - mvi b,16 ; 16 times - mvi c,0 -regl1: - call vprint - db ' ',0 - mov a,m ; get value - inx h ; pt to next - call padc ; print - inr c ; every 4 - mov a,c ; get count - ani 3 - cz dispxy ; new line - dcr b ; count down - jnz regl1 - jmp getcmd -; -; **** System File Definitions **** -; -fnames: - call banner - call gxymsg - db 3,27 - db '--> ',1,'System File Names',2,' <--',0 - mvi h,5 ; row 5 - mvi l,24 ; column 24 - shld infoxy - call dispxy - call vprint - db 1,'Shell Variable File: ',2,0 - mvi a,47h ; offset - call compenv - xchg ; DE pts to file name - call pfn ; print file name - call dispxy - mvi b,'1' ; set counter -fnames1: - lxi h,11 ; offset to next file - dad d ; pt to next file name - xchg - call dispxy - call vprint - db 1,'File Name ',0 - mov a,b - call cout ; print number - call vprint - db ': ',2,0 - call pfn ; print file name - inr b ; next name - mov a,b ; get next - cpi '4'+1 ; done? - jnz fnames1 - jmp getcmd -; -; Print File Name for FNAMES -; -pfn: - ldax d ; get first char - cpi ' ' ; none? - jnz pfn1 ; print name - lxi h,8 ; check type - dad d - mov a,m ; get first char of type - cpi ' ' ; none? - jnz pfn1 ; print name - call print - db 'Undefined',0 - ret -; -; **** CRT and Printer Data **** -; -cpdata: - call banner - call gxymsg - db 3,26 - db '--> ',1,'CRT and Printer Data',2,' <--',0 - mvi h,5 ; row 5 - mvi l,5 ; column 5 - shld infoxy - call dispxy - call vprint - db 1,'CRT -- Selection: ',2,0 - mvi a,2fh ; offset - call prbyte ; print byte value there - call dispxy - call vprint - db 1,' CRT 0',2,0 - mvi a,31h ; print data at 31H - call cprt - call dispxy - call dispxy - call vprint - db 1,'LST -- Selection: ',2,0 - mvi a,30h ; offset - call prbyte ; print byte value there - call dispxy - call vprint - db 1,' LST 0',2,0 - mvi a,37h ; offset - call lprt - call dispxy - call dispxy - call vprint - db 1,' LST 2',2,0 - mvi a,3fh ; offset - call lprt - mvi h,6 ; row 6 - mvi l,40 ; column 40 - shld infoxy - call dispxy - call vprint - db 1,' CRT 1',2,0 - mvi a,34h ; print data at 34H - call cprt - call dispxy - call dispxy - call dispxy - call vprint - db 1,' LST 1',2,0 - mvi a,3bh ; offset - call lprt - call dispxy - call dispxy - call vprint - db 1,' LST 3',2,0 - mvi a,43h ; offset - call lprt - jmp getcmd -; -; Print CRT Data -; -cprt: - call compenv ; compute offset - call dispxy - call vprint - db 1,' Width: ',2,0 - mov a,m - call padc - call vprint - db ' Cols',0 - call dispxy - call vprint - db 1,' Lines/Text: ',2,0 - inx h - mov a,m - call padc - call vprint - db ' / ',0 - inx h - mov a,m - call padc - ret -; -; Print LST Data -; -lprt: - call compenv ; compute offset - call dispxy - call vprint - db 1,' Width: ',2,0 - mov a,m - call padc - call vprint - db ' Cols',0 - call dispxy - call vprint - db 1,' Lines/Text: ',2,0 - inx h - mov a,m - call padc - call vprint - db ' / ',0 - inx h - mov a,m - call padc - inx h - call dispxy - call vprint - db 1,' Form Feed? ',2,0 - mov a,m - call pryn - ret - -; -; **** Print Environment Descriptor Data **** -; -envdes: - call banner - call gxymsg - db 3,25 - db '--> ',1,'Environment Descriptor',2,' <--',0 - mvi h,5 ; row 5 - mvi l,5 ; column 5 - shld infoxy - call dispxy - call vprint - db 1,'>> Addresses <<',2,0 - call dispxy - call vprint - db 1,' Command Line Buffer: ',2,0 - mvi a,18h ; offset - call pradr ; print address - call dispxy - call vprint - db 1,' Command-Search Path: ',2,0 - mvi a,9 ; offset - call pradr ; print address - call dispxy - call vprint - db 1,' Environment Descriptor: ',2,0 - lhld envptr ; get ptr - call phl4hc - call dispxy - call vprint - db 1,' Externals --',2,0 - call dispxy - call vprint - db 1,' File Control Block: ',2,0 - mvi a,24h - call pradr - call dispxy - call vprint - db 1,' System Stack: ',2,0 - mvi a,26h - call pradr - call dispxy - call vprint - db 1,' Message Buffer: ',2,0 - mvi a,22h - call pradr - call dispxy - call vprint - db 1,' Named Directory Buffer: ',2,0 - mvi a,15h - call pradr - call dispxy - call vprint - db 1,' Packages --',2,0 - call dispxy - call vprint - db 1,' Flow Command: ',2,0 - mvi a,12h - call pradr - call dispxy - call vprint - db 1,' Input/Output: ',2,0 - mvi a,0fh - call pradr - call dispxy - call vprint - db 1,' Resident Command: ',2,0 - mvi a,0ch - call pradr - call dispxy - call vprint - db 1,' Shell Stack Buffer: ',2,0 - mvi a,1eh - call pradr - call dispxy - call vprint - db 1,' Wheel Byte: ',2,0 - mvi a,29h - call pradr - mvi h,5 ; row 5 - mvi l,40 ; column 40 - shld infoxy - call dispxy - call vprint - db 1,'>> Data Elements <<',2,0 - call dispxy - call vprint - db 1,' Sizes --',2,0 - call dispxy - call vprint - db 1,' Command Line: ',2,0 - mvi a,1ah - call prbyte - call vprint - db ' Chars',0 - call dispxy - call vprint - db 1,' External Path: ',2,0 - mvi a,0bh - call prbyte - call vprint - db ' Elts',0 - call dispxy - call vprint - db 1,' Named Dir Entries: ',2,0 - mvi a,17h - call prbyte - call dispxy - call vprint - db 1,' Package, FCP: ',2,0 - mvi a,14h - call prbyte - call pr128 - call dispxy - call vprint - db 1,' Package, IOP: ',2,0 - mvi a,11h - call prbyte - call pr128 - call dispxy - call vprint - db 1,' Package, RCP: ',2,0 - mvi a,0eh - call prbyte - call pr128 - call dispxy - call vprint - db 1,' Shell Stack Elts: ',2,0 - mvi a,20h - call prbyte - call dispxy - call dispxy - call vprint - db 1,' DU Form Allowed? ',2,0 - mvi a,2eh - call compenv - mov a,m ; get byte - call pryn - call dispxy - call vprint - db 1,' Max Disk and User: ',2,0 - mvi a,2ch - call compenv - mov a,m - adi '@' - call cout - inx h - mov a,m - call pafdc - call dispxy - call vprint - db 1,' Processor Speed: ',2,0 - mvi a,2bh - call prbyte - call vprint - db ' MHz',0 - call dispxy - call vprint - db 1,' Quiet Operation? ',2,0 - mvi a,28h - call compenv - mov a,m ; get byte - call pryn - jmp getcmd -; -; Print 128-Byte Block Message -; -pr128: - call vprint - db ' Blocks',0 - ret -; -; Print address pted to by A offset as 4 hex chars -; -pradr: - call compenv ; pt to address - mov e,m ; get address - inx h - mov d,m - xchg - jmp phl4hc -; -; Print byte pted to by A offset as dec chars -; -prbyte: - call compenv ; compute offset (in HL) - mov a,m ; get byte - jmp padc -; -; Add A to Base Address in ENVPTR -; Return Result in HL -; -compenv: - lhld envptr ; get base address - add l ; add offset - mov l,a - mov a,h - aci 0 - mov h,a - ret -; -; **** Display Input/Output Package Function **** -; -iopack: - call banner - call gxymsg - db 3,26 - db '--> ',1,'Input/Output Package',2,' <--',0 - call getiop ;check for initialization - mov a,h - ora l ;must NOT be zero - jnz iopack0 - call gxymsg - db 5,23,'Input/Output Packages Not Available',0 - jmp getcmd -iopack0: - call status ;check for drivers - jnz iopack1 - call gxymsg - db 5,22,'Input/Output Redirection Not Available',0 - jmp getcmd -iopack1: - call dispcon ;successive displays - call disprdr - call gxymsg - db 23,10,'Strike Any Key For Next Screen - ',0 - call capine - call banner - call gxymsg - db 3,26 - db '--> ',1,'Input/Output Package',2,' <--',0 - call disppun - call displst - jmp getcmd -dispcon: - call vprint - db cr,lf,cr,lf,1,'Console',0 - mvi a,0 ;select CON: - call disp - jmp curr -displst: - call vprint - db cr,lf,cr,lf,1,'Printer',0 - mvi a,3 ;select LST: - call disp - jmp curr -disprdr: - call vprint - db cr,lf,cr,lf,1,'Reader ',0 - mvi a,1 ;select RDR: - call disp - jmp curr -disppun: - call vprint - db cr,lf,cr,lf,1,'Punch ',0 - mvi a,2 ;select PUN: - call disp -; -; Print Name of Current Device -; -curr: - push h ;save ptr - mov b,a ;save number in B - push b ;save B - call vprint - db cr,lf,1,' Assignment is ',2,0 - push b ;save B - call status ;get status - pop b ;get B - inr b ;add 1 for offset - dcx h ;back up -curr1: - inx h ;pt to next - inx h - dcr b ;count down - jnz curr1 - pop b ;get logical number in B - mov c,m ;get physical number in C - call pname0 ;print first part of name only - pop h ;get ptr - ret -; -; Print Names of All Physical Devices for a Logical Device -; -disp: - push h ;save char ptr - push psw ;save device number - call vprint - db ' Devices --',2,0 - mov b,a ;logical device in B - push b ;save for later - push b ;save it - call status ;get status report - pop b ;get logical device number - inr b ;add 1 for offset - dcx h ;back up - dcx h -disp1: - inx h ;pt to next - inx h - dcr b ;count down - jnz disp1 - pop b ;get B back - mov c,m ;get count of devices - mov a,c ;check for none - ora a - jz disp3 -disp2: - push b ;save values - dcr c ;pt to next name - call print - db cr,lf,' ',0 - call pnamer ;print name (B=logical, C=physical) - pop b ;get count - dcr c ;count down - jnz disp2 -disp3: - pop psw - pop h - ret -; -; Routine to Print Name of Selected Device -; B=logical number, C=physical number -; -pnamer: - push b ;save BC - call pname0 ;print first part of name - call vprint ;print separator - db 1,' - ',2,0 - call pstr ;print rest as string - pop b ;restore BC - ret -; -; Print first part of selected device name -; -pname0: - call namer ;get ptr to string - mvi b,8 ;at most 8 chars -pname1: - mov a,m ;get char - inx h ;pt to next char - cpi ' ' ;end of name? - jz pname2 - call cout ;print char - dcr b ;count down - jnz pname1 - ret -pname2: - mvi a,' ' ;print spaces - call cout - dcr b ;count down - jnz pname2 - ret - -; -; Basic Interface Routines -; -status: - lxi d,0 ;Offset 0 -runit: - call getiop ;device driver base - dad d - pchl -select: - lxi d,3 ;Offset 3 - jmp runit -namer: - lxi d,6 ;Offset 6 - jmp runit - -; -; **** Display Path Function **** -; -pdisp: - call banner - call gxymsg - db 3,28 - db '--> ',1,'Path Expressions',2,' <--',0 - mvi h,6 ; row 6 - mvi l,10 ; column 10 - shld infoxy - call dispxy - call vprint - db 1,'Symbolic Form',2,0 - call dispxy - call vprint - db ' ',0 - call getpath ; pt to external path -pdisp1: - mov a,m ; get disk - ora a ; done? - jz adisp - cpi '$' ; current? - jz pdisp2 - adi '@' ; convert to letter -pdisp2: - call cout ; print disk letter - inx h ; pt to user - mov a,m ; get user number - cpi '$' ; current? - jnz pdisp3 - call cout ; print current indicator - jmp pdisp4 -pdisp3: - call pafdc ; print user number -pdisp4: - call colon - inx h ; pt to next element - mov a,m ; done? - ora a ; 0=yes - cnz arrow - jmp pdisp1 -; -; Print Absolute Path -; -adisp: - call dispxy - call dispxy - call vprint - db 1,'DU Form ',2,0 - call dispxy - call vprint - db ' ',0 - call retud ; get current user/disk - call getpath ; pt to external path -adisp1: - mov a,m ; get disk - ora a ; done? - jz ndisp - cpi '$' ; current? - jnz adisp2 - mov a,b ; get current disk - inr a ; adjust to 1 to n -adisp2: - adi '@' ; convert to letter - call cout ; print disk letter - inx h ; pt to user - mov a,m ; get user - cpi '$' ; current? - jnz adisp3 - mov a,c ; get current user -adisp3: - call pafdc ; print user - call colon - inx h ; pt to next - mov a,m ; done? - ora a - cnz arrow - jmp adisp1 -; -; Print Named Path -; -ndisp: - call dispxy - call dispxy - call vprint - db 1,'DIR Form ',2,0 - call dispxy - call vprint - db ' ',0 - call getpath ; pt to external path -ndisp1: - call retud ; get current user and disk in C and B - mov a,m ; get disk - ora a ; done? - jz getcmd - cpi '$' ; current? - jz ndisp2 - mov b,a ; disk in B - dcr b ; adjust to 0 to n-1 -ndisp2: - inx h ; pt to user - mov a,m ; get it - cpi '$' ; current? - jz ndisp3 - mov c,a ; user in C -ndisp3: - inx h ; pt to next - push h ; save ptr - call udscan ; scan dirs for user/disk and print its name - pop h ; get ptr - call colon - mov a,m ; done? - ora a - cnz arrow - jmp ndisp1 - -; -; Print Colon -; -colon: - mvi a,':' ; print colon - jmp cout - -; -; Print Arrow -; -arrow: - call vprint - db 1,' --> ',2,0 - ret - -; -; Scan directories for user and disk in C and B -; Print name if found or "Noname" if not -; -udscan: - call dutdir ; convert to name - jz udscan1 ; error return if no name - mvi b,8 ; 8 chars max -udsprn: - mov a,m ; get name char - cpi ' ' ; done? - rz - call cout ; print char - inx h ; pt to next - dcr b ; count down - jnz udsprn - ret -udscan1: - call vprint - db 'Noname',0 - ret - -; -; **** Print Named Directory Info **** -; -namedir: - call banner - call gxymsg - db 3,26 - db '--> ',1,'Named Directory Data',2,' <--',0 - call getndr ;get location of directory - jnz ndir1 - call gxymsg - db 5,22 - db 'Named Directory Buffer Not Available',0 - jmp getcmd -; -; Print Names of Directory Elements -; -ndir1: - call gxymsg - db 5,25 - db '-- Named Directory Entries --',0 - mvi d,7 ;set row - mvi e,7 ;set column - xchg - call gotoxy ;position cursor - xchg - mvi c,0 ;set entry count - mvi b,1 ;set disk 1 -; -; Print Each Resident Command Name -; -ndir2: - mov a,m ;get table entry - ora a ;end of table? - jz getcmd -; -; DE is carried over all of this as starting row/column -; - cmp b ;same disk? - jz ndir3 -; -; Advance to Next Set of Entries for New Disk -; - mvi c,0 ;reset counter - mov b,a ;set new disk - xchg ;position for new disk - inr h ;blank line - inr h - call gotoxy ;position on screen - xchg -ndir3: - push b ;save counters -; -; Print DU: -; - mov a,m ;get disk - adi '@' ;convert to letter (A to P) - call cout - inx h ;pt to user - mov a,m ;get user - call padc ;print user number - call print ;print separator - db ': ',0 - inx h ;pt to name -; -; Print DIR -; - mvi b,8 ;print name -ndir4: - mov a,m ;get char - call cout - inx h ;pt to next - dcr b ;count down - jnz ndir4 -; -; Advance to Next and Print Separator -; - lxi b,8 ;skip over password - dad b - call print ;print separator - db ' ',0 - pop b ;get counters -; -; New Line Counter -; - inr c ;increment entry counter - mov a,c ;check for done - ani 3 ;every 4 - jnz ndir2 -; -; Position in Next Line -; - xchg ;position cursor - inr h ;next row - call gotoxy - xchg - jmp ndir2 - -; -; **** Print Command Status **** -; -command: - call banner - call gxymsg - db 3,25 - db '--> ',1,'Command Package Status',2,' <--',0 - call gxymsg - db 5,25 - db '---- ',1,'FLOW COMMAND PACKAGE',2,' ----',0 - call getfcp ;get FCP data - jnz flow0 - call gxymsg - db 7,20 - db 'Flow Command Facility Not Available',0 - jmp rcp -; -; Check for Flow Command Package Loaded -; -flow0: - mov a,m ;get first byte - ora a ;0=none loaded - jnz flow1 - call gxymsg - db 7,25 - db 'No Flow Command Package Loaded',0 - jmp rcp -; -; Print Flow Command Package Info -; -flow1: - call gxymsg - db 7,20 - db 1,'Flow Commands:',2,0 - lxi d,5 ;skip to command size byte - dad d - mov b,m ;get command size - inx h ;pt to first command - call at - db 8,22 -; -; Print Flow Command Names -; -flow2: - mov a,m ;get first char - ora a ;end of table? - jz flow4 - push b ;save counter -flow3: - mov a,m ;get char - inx h ;pt to next - call cout ;print char - dcr b ;count down - jnz flow3 - call print - db ' ',0 - inx h ;skip over address - inx h - pop b ;get counter - jmp flow2 -; -; Print Flow Command Arguments -; -flow4: - call gxymsg - db 9,20 - db 1,'IF Options:',2,0 - call at - db 10,22 - inx h ;pt to first option -; -; Print Each Option -; -flow5: - mov a,m ;get next char - ora a ;done? - jz flow6 - call cout ;print char - inx h ;pt to 2nd char - mov a,m ;get it and print - call cout - call print - db ' ',0 ;space over - inx h ;skip address - inx h - inx h - jmp flow5 -; -; Print Current IF Level -; -flow6: - call gxymsg - db 11,20 - db 1,'Current IF Level: ',2,0 - call getmsg ;pt to ZCPR3 messages - inx h ;pt to IF byte - mov a,m ;get IF byte - mvi c,'0' ;assume level 0 - ora a ;see if at last IF level - jz flow8 -flow7: - inr c ;advance to next level - rrc ;rotate bits - ani 7fh ;mask out MSB - jnz flow7 ;continue looping until no 1 bits -flow8: - mov a,c ;get digit - call cout ;print it -; -; Print RCP Data -; -rcp: - call gxymsg - db 14,23 - db '---- ',1,'RESIDENT COMMAND PACKAGE',2,' ----',0 - call getrcp ;get RCP data - jnz rcp0 - call gxymsg - db 16,20 - db 'Resident Command Facility Not Available',0 - jmp getcmd -; -; Check for Resident Command Package Loaded -; -rcp0: - mov a,m ;get first byte - ora a ;0=none loaded - jnz rcp1 - call gxymsg - db 16,23 - db 'No Resident Command Package Loaded',0 - jmp getcmd -; -; Print Resident Command Package Info -; -rcp1: - call gxymsg - db 16,20 - db 1,'Resident Commands:',2,0 - lxi d,5 ;skip to command size byte - dad d - mov b,m ;get command size - mvi c,0 ;set count - inx h ;pt to first command - mvi d,17 ;set row - mvi e,22 ;set column - xchg - call gotoxy ;position cursor - xchg -; -; Print Each Resident Command Name -; -rcp2: - mov a,m ;get table entry - ora a ;end of table? - jz getcmd - push b ;save counters -rcp3: - mov a,m ;get char - inx h ;pt to next - call cout - dcr b ;count down - jnz rcp3 - call print - db ' ',0 - inx h ;pt to next command - inx h - pop b ;get counters - inr c ;increment entry counter - mov a,c ;check for done - ani 7 ;every 8 - jnz rcp2 - xchg ;position cursor - inr h ;next row - call gotoxy - xchg - jmp rcp2 - -; -; **** Print Error Handler Data **** -; -errorh: - call banner - call gxymsg - db 3,27 - db '--> ',1,'Error Handler Data',2,' <--',0 - call getmsg ;get message address - jnz errh1 - call gxymsg - db 5,20 - db 'ZCPR3 Messages Not Available on this System',0 - jmp getcmd -errh1: - call gxymsg - db 5,27 - db 1,'Error Handler Engaged? ',2,0 - call geter1 ;error handler engaged? - push psw - call pryn ;print yes/no - pop psw - jz getcmd ;exit display - call gxymsg - db 6,27 - db 1,'Error Handler Command: ',2,0 - call geterc ;get command line - call pstr - call gxymsg - db 7,30 - db 1,'Command Status: ',2,0 - mvi a,22h ; offset to message ptr - call compenv ; pt to message ptr - mov a,m - inx h - mov h,m - mov l,a ; HL pts to messages - inx h ; pt to command status message - inx h - inx h - mov a,m ; get it - ani 3 ; 2 LSBs - jz errh3 - cpi 1 - jz errh4 - call print - db 'Error',0 - inx h ; pt to error address - mov a,m ; get low - inx h - mov h,m ; get high - mov l,a - call gxymsg - db 9,5 - db 1,'Error Command --',2,0 - call vprint - db cr,lf,1,' --> ',2,0 -errh2: - mov a,m ; get char - inx h ; pt to next - ora a ; end of line? - jz errh5 - cpi ';' ; end of command with new command? - jnz errh2a - call vprint - db 1,';',2,cr,lf,1,' --> ',2,0 - jmp errh2 -errh2a: - call cout ; print char - jmp errh2 -errh3: - call print - db 'Normal',0 - jmp errh5 -errh4: - call print - db 'Shell',0 -errh5: - jmp getcmd - -; -; **** Print Shell Stack Data **** -; -shstack: - call banner - call gxymsg - db 3,28 - db '--> ',1,'Shell Stack Data',2,' <--',0 - call getsh ;get shell data - jnz shs0 - call gxymsg - db 5,20 - db 'Shell Stack NOT Available on this System',0 - jmp getcmd -; -; Print Empty/Full Messages -; -shs0: - call gxymsg - db 5,30 - db 'Shell Stack Empty? ',0 - call shempty - jz shsem - mvi a,0 ; set not empty - jmp shsnem -shsem: - mvi a,1 ; set empty -shsnem: - call pryn - call gxymsg - db 6,30 - db 'Shell Stack Full? ',0 - call shfull - jz shsfu - mvi a,0 ; set not full - jmp shsnfu -shsfu: - mvi a,1 ; set full -shsnfu: - call pryn -; -; Print Shell Stack Content Data -; - call gxymsg - db 8,27 - db '--- Shell Stack Content ---',0 - mvi h,10 ;row 10 - mvi l,20 ;col 20 - shld infoxy ;save position - call getsh ;get shell stack data - mov e,b ;get element size in DE - mvi d,0 - mov b,a ;get element count in B - mvi c,'1' ;get digit in C -shs1: - mov a,m ;check for element in stack - ora a ;0=empty - jz shs2 - call dispxy ;position for display - call vprint - db 1,'Elt ',0 - mov a,c ;get digit - call cout ;print as decimal - inr c ;next digit - call vprint - db ' -- ',2,0 - push h - call pstr ;print entry - pop h - dad d ;pt to next - dcr b ;count down - jnz shs1 -shs2: - mov a,c ;see if anything printed - cpi '1' - jnz getcmd - lhld infoxy ;position on screen - call gotoxy - call print - db ' Empty',0 - jmp getcmd - -; -; Position Display at INFOXY address and advance -; -dispxy: - push h ;save HL - lhld infoxy ;get screen position - call gotoxy ;go there - inr h ;advance to next line - shld infoxy ;set screen position - pop h ;restore HL - ret -; -; If A=0, print Yes, else print No -; -pryn: - ora a - jnz pryes - call print - db 'NO',0 - ret -pryes: - call print - db 'YES',0 - ret - -; -; Buffers -; -showcmd: - db 'SHOW ',0 -infoxy: - ds 2 ;address on screen of next line to print -cstat: - ds 2 ;command status ptr -dumpstrt: - ds 2 ;address of next byte to start memory dump -cline: - ds 2 ;address of current line - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SHSET.COM b/Source/Images/d_bp/u15/SHSET.COM deleted file mode 100644 index cd0c0c53..00000000 Binary files a/Source/Images/d_bp/u15/SHSET.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SHSET.MAC b/Source/Images/d_bp/u15/SHSET.MAC deleted file mode 100644 index bcb36983..00000000 --- a/Source/Images/d_bp/u15/SHSET.MAC +++ /dev/null @@ -1,207 +0,0 @@ -; PROGRAM: SHSET -; VERSION: 1.0 -; DATE: 19 July 84 -; AUTHOR: Richard Conn -; PREVIOUS VERSIONS: None -; -z3env equ 0f400h -VERS EQU 10 ;version number - -; SHSET is copyright (c) 1984 by Richard Conn -; All Rights Reserved -; SHSET may be used freely by the ZCPR3 Community - -; -; SHSET is used to establish a command line as a shell. It pushes -; the command line (including semicolons) which follow the verb SHSET onto -; the shell stack if it fits. -; -; Syntax: -; SHSET cmd1;cmd2;... -; -; The sequence of commands "cmd1;cmd2;..." becomes the shell. -; - -; -; SYSLIB, Z3LIB, and VLIB References -; - ext z3init - ext shpush,getcl1,getcl2,putshm,getsh,getsh2 - ext eprint,phlfdc - ext codend - -; -; Basic Definitions -; -TRUE EQU 0FFH ;define true and.. -FALSE EQU 0 ;..false. - -; -; System Addresses -; -OS$BASE EQU 000H ;system base.. -BDOS EQU OS$BASE+05H -FCB EQU OS$BASE+5CH -FCB2 EQU OS$BASE+6CH -TBUFF EQU OS$BASE+80H -TPA EQU OS$BASE+100H - -; -; ASCII Chars -; -LF EQU 0AH ;..linefeed.. -CR EQU 0DH ;..carriage return.. - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Mainline -; - call z3init ;initialize the ZCPR3 Env - -; -; Print Prompt -; - call eprint - db 'SHSET, Version ' - db (VERS/10)+'0','.',(VERS MOD 10)+'0' - db 0 - lda fcb+1 ;check for help request - cpi '/' ;help? - jz help - cpi ' ' - jnz shinit -; -; Print Help Message -; -help: - call eprint - db cr,lf,' Syntax: SHSET cmd1;cmd2;...' - db cr,lf,' SHSET defines the command sequence to be a shell' - db 0 - ret -; -; Initialize Shell -; -shinit: - call shtest1 ;there must be a shell stack - call shtest2 ;there must be a command line buffer -; -; HL now points to the command line buffer -; - call codend ;pt to free area - xchg ;... in DE - lxi h,tbuff+1 ;pt to option input - mov a,m ;check for no input - ora a ;none if zero - jz checkcl - inx h ;pt to first good char - call copystr ;copy string -checkcl: - call getcl2 ;get address of command line - jz setsh ;set shell command - call copystr ;copy string -setsh: - call codend ;pt to string - call shpush ;push onto shell stack - jnz sherr ;error? -; -; Set Shell Messages -; - mvi a,0 ;Zero Message 0 - mvi b,0 - call putshm -; - mvi a,0 ;Zero Message 1 - mvi b,1 - call putshm -; - call eprint - db ' Shell Installed',0 -; -exit: - call getcl2 ;terminate following command - mvi m,0 ;set ending 0 - ret -; -; Error in Shell Stack Installation -; -sherr: - cpi 2 ;shell stack full - jnz sherr1 - call eprint - db ' Shell Stack Full',0 - jmp exit -sherr1: - call eprint - db ' Shell Entry too Large -- Limit is ',0 - call getsh2 ;get limit in DE - xchg - call phlfdc ;print as floating decimal - call eprint - db ' Characters',0 - jmp exit - -; -; Check for Presence of Shell Stack -; -shtest1: - call getsh ;get shell stack data - rnz - pop psw ;clear stack - call eprint - db ' No Shell Stack',0 - ret - -; -; Check for Command Line -; -shtest2: - call getcl1 ;get command line data - rnz - pop psw ;clear stack - call eprint - db ' No Command Line',0 - ret - -; -; Copy string from HL to DE -; Store ending 0 and leave pointer in DE to it -; -copystr: - mov a,m ;get char - stax d ;store it - ora a ;done? - rz - inx h ;pt to next - inx d - jmp copystr - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SHUTILS2.LBR b/Source/Images/d_bp/u15/SHUTILS2.LBR deleted file mode 100644 index 7f73512f..00000000 Binary files a/Source/Images/d_bp/u15/SHUTILS2.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/SHVAR.COM b/Source/Images/d_bp/u15/SHVAR.COM deleted file mode 100644 index 508d2448..00000000 Binary files a/Source/Images/d_bp/u15/SHVAR.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SHVAR.MAC b/Source/Images/d_bp/u15/SHVAR.MAC deleted file mode 100644 index 2a996a24..00000000 --- a/Source/Images/d_bp/u15/SHVAR.MAC +++ /dev/null @@ -1,656 +0,0 @@ -; -; Program: SHVAR -; Author: Richard Conn -; Version: 1.0 -; Date: 5 Mar 84 -; -version equ 10 - -; -; SHVAR is used to define a shell variable for the Shell SH. -; It makes entries into the file SH.VAR in the ROOT directory. The -; syntax of its use is: -; SHVAR variable text <-- define/redefine variable -; SHVAR variable <-- delete variable -; SHVAR <-- list variables -; - -; -; Equates for Key Values -; -z3env SET 0f400h ;address of ZCPR3 environment -backup equ 0 ;backup old file? 1 for yes, 0 for no -ctrlz equ 'Z'-'@' ;^Z for EOF -fcb equ 5ch -tbuff equ 80h -cr equ 0dh -lf equ 0ah - -; -; External Z3LIB and SYSLIB Routines -; - ext cout,qcout,getquiet,sort,crlf - ext sksp,fillb,moveb - ext initfcb,f$open,f$read,f$close,f$make,f$delete,f$write,f$rename - ext z3init,qprint,codend,hmovb,root,logud,getwhl,print - ext getfn1,pfn1,cline - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Environment - call banner ;print banner -; -; Check for Wheel -; - call getwhl ;get wheel byte - jnz start0 - call print - db cr,lf,' Not Wheel - Aborting',0 - ret -; -; Try to Load Variables -; -start0: -; -; Check for Help -; - lda fcb+1 ;get first char of FCB - cpi '/' ;also help? - jnz start0x -; -; Print Help Message -; - call print - db cr,lf,'SHVAR - Define/Redefine/Delete a Shell Variable' - db cr,lf,'Syntax:' - db cr,lf,' SHVAR variable text <-- to Define/Redefine' - db cr,lf,' SHVAR variable <-- to Delete' - db cr,lf,' SHVAR <-- to List Variable Names' - db 0 - ret -; -; Define File to Work With -; -start0x: - call getfn1 ;get name of shell - lxi d,shvfcb+1 ;variable FCB - mvi b,11 ;11 chars - mov a,m ;any name given? - cpi ' ' ;space if none - cnz moveb ;set name -; -; Define $$$ and BAK Files -; - lxi h,shvfcb+1 - lxi d,shvtmp+1 ;set $$$ name - mvi b,8 ;8 chars - call moveb -; - if backup - lxi d,shvbak+1 ;set BAK name - call moveb - endif -; -; -; Save Command Line -; - lxi h,tbuff ;save line - call cline - shld lineptr ;set ptr to line -; -; Load Variables -; - call varload - jnz start1 -; -; Initialize Shell Variables if File Not Found -; - call print - db cr,lf,' Shell Variable File ',0 - lxi d,shvfcb+1 - call pfn1 - call print - db ' Not Found',0 - ret -; -; Process User Command -; -start1: - lda fcb+1 ;check for list option - cpi ' ' ;no args = list - jz list - call doit ;process command - call varsave ;save new shell variables - ret -; -; Print Names of Variables -; -list: - call lpack ;pack just names - xchg ;set ptr to ptr table - inx h - shld ptrbuf ;ptr buffer for sort - lhld vcount ;run sort? - mov a,h - ora l - cnz lsort ;sort names - call print - db cr,lf,' Shell Variables --',cr,lf,0 - mvi c,0 ;set counter - call codend ;pt to first variable - mov a,m ;empty? - cpi ctrlz - jnz list1 - call print - db ' -- No Variables Defined --',0 - ret -; -; Print Next Variable -; -list1: - mov a,m ;end of list? - cpi ctrlz - jz list3 - call print - db ' ',0 - mvi b,8 ;print 8 chars -list2: - mov a,m ;get char - inx h ;pt to next - call cout ;print it - dcr b ;count down - jnz list2 - inr c ;increment count - mov a,c ;new line? - ani 3 - cz crlf - jmp list1 -list3: - mov a,c ;new line to end? - ani 3 - cnz crlf - ret -; -; Sort Variables -; -lsort: - call codend ;pt to first variable - shld ssb ;set ptr - lxi d,ssb ;pt to SSB - jmp sort ;perform sort -; -; Compare Routine -; -compare: - push h ;save regs - push d - push b - mvi b,8 ;8 chars -comp1: - ldax d ;get char - cmp m ;compare - jnz comp2 - inx h ;pt to next - inx d - dcr b ;count down - jnz comp1 -comp2: - pop b ;restore regs - pop d - pop h - ret - -; -; Pack Variables Down to a Minimum (Just 8-char Names) -; -lpack: - lxi h,0 ;set count - shld vcount - call codend ;pt to first variable - mov d,h ;DE=HL - mov e,l -lpack1: - mov a,m ;get next char - stax d ;set possible EOF - cpi ctrlz ;done? - rz - push h ;increment variable count - lhld vcount - inx h - shld vcount - pop h - mvi b,8 ;save 8 chars -lpack2: - mov a,m ;get next char - stax d ;store it - inx h ;pt to next - inx d - dcr b ;count down - jnz lpack2 -lpack3: - mov a,m ;skip to next variable - inx h - ora a ;done? - jnz lpack3 - jmp lpack1 ;resume -; -; Input and Process User Commands -; -doit: - call nadd ;add/delete/redefine variable -; -; Pack Names -; -pack: - call codend ;pack entries in table - mov d,h ;HL=DE - mov e,l -; -; Check Next Entry -; -pack1: - mov a,m ;get next char - stax d ;put it - cpi ctrlz ;done? - rz - cpi ' ' ;deleted? - jz pack3 -; -; Copy Entry -; -pack2: - mov a,m ;get char - stax d ;put it - inx h ;pt to next - inx d - ora a ;done? - jnz pack2 - jmp pack1 ;resume -; -; Skip Entry -; -pack3: - mov a,m ;get char - inx h ;pt to next - ora a ;done? - jnz pack3 - jmp pack1 ;resume - -; -; Add Names to Table -; -nadd: - lhld lineptr ;pt to user line - call sksp ;skip to first non-blank - ora a ;done? - rz ;exit if no change - call qprint - db cr,lf,' Shell Variable ',0 -; -; Copy Input Name into Shell Buffer SHVAR -; - push h ;save ptr to name - lxi h,shvar ;init name buffer - mvi a,' ' ;space fill - mvi b,8 ;8 chars - call fillb - xchg ;pt to buffer in DE - pop h ;pt to name - mvi b,8 ;8 chars max -nadd1: - mov a,m ;get name char - call delck ;check for delimiter - jz nadd3 - stax d ;store char - call qcout ;print chars of variable name - inx h ;pt to next - inx d - dcr b ;count down - jnz nadd1 -nadd2: - mov a,m ;flush to delimiter - inx h - call delck ;check for delimiter - jnz nadd2 - dcx h ;pt to delimiter -; -; Search for Name -; -nadd3: - shld lineptr ;set ptr to rest of line - call codend ;pt to first element -; -; Check for End of Entries -; -nadd4: - mov a,m ;get first char of next string - cpi ctrlz - jz addit ;add name at HL -; -; Compare Names -; - lxi d,shvar ;pt to variable - mvi b,8 ;compare - shld curname ;save ptr to current name in case of delete -nadd5: - ldax d ;check for duplicate - cmp m - jnz nadd6 - inx h ;pt to next - inx d - dcr b ;count down - jnz nadd5 - jmp nadd7 -; -; No Match, so Skip Rest of String -; -nadd6: - mov a,m ;skip to end of string - inx h ;pt to next - ora a ;done? - jnz nadd6 - jmp nadd4 ;resume -; -; Match - Determine What User Wants to Do -; -nadd7: - lhld lineptr ;see if any text follows name - call sksp ;skip to text - ora a ;EOL? - jz delete ;delete name -; -; Redefine Name -; - lhld curname ;pt to name in buffer - mvi b,8 ;space fill it - mvi a,' ' - call fillb - jmp nadd6 ;resume in case another duplicate -; -; Delete Name -; -delete: - call qprint - db ' Deleted',0 - lhld curname ;pt to name in buffer - mvi b,8 ;space fill it - mvi a,' ' - call fillb - ret -; -; Add Name -; -addit: - call qprint - db ' = ',0 - shld curname ;save ptr to new name - xchg ;dest in DE - lxi h,shvar ;pt to name - mvi b,8 ;8 chars - call hmovb ;copy name into buffer - xchg ;pt to after name with HL - push h ;save ptr - mvi m,0 ;store ending 0 and ^Z in case of abort - inx h - mvi m,ctrlz ;store ^Z - lhld lineptr ;point to user text - call sksp ;skip to non-space - pop d ;pt to destination -; -; Copy User Input into Buffer -; -addit1: - mov a,m ;get char - stax d ;put char - ani 7FH ;done? - cnz qcout ;print chars of definition - inx h ;pt to next - inx d - ora a ;done? - jnz addit1 - mvi a,ctrlz ;mark end - stax d - ret - -; -; Print Banner -; -banner: - call qprint - db 'SHVAR, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db 0 - ret -; -; Check to see if char in A is a delimiter -; Return with Z if so -; -delck: - push h ;pt to table - push b ;save BC - mov b,a ;char in B - lxi h,dtable ;pt to delimiter table -delck1: - mov a,m ;get delimiter - ora a ;done? - jz notdel - cmp b ;compare - jz yesdel - inx h ;pt to next - jmp delck1 -notdel: - mov a,b ;get char - ora a ;set Z if null, else NZ -yesdel: - mov a,b ;restore char - pop b ;restore regs - pop h - ret - -; -; Delimiter Table -; -dtable: - db '<>;:,.=-_ ',0 - -; -; Save Shell Variable List -; Return with Z if Error -; -varsave: - call getquiet ;get quiet flag - jnz vars0 - call print - db cr,lf,' Writing Shell Variable File ',0 - lxi d,shvfcb+1 - call pfn1 ;print file name -vars0: - lxi d,shvtmp ;open temp - call initfcb - call f$delete ;delete if any exists - call f$make ;create new file - inr a ;error? - rz - call codend ;pt to scratch area -; -; Save Loop -; -vars1: - lxi d,tbuff ;copy into buffer - mvi b,128 ;128 bytes - call hmovb - lxi d,shvtmp ;write block - call f$write - jnz werr ;write error - lxi d,tbuff ;check for done - mvi b,128 ;128 bytes -; -; Check for Done -; -vars2: - ldax d ;look for ^Z - cpi ctrlz - jz varsx - inx d ;pt to next - dcr b ;count down - jnz vars2 - jmp vars1 -; -; Done -; -varsx: - lxi d,shvtmp ;close temp file - call f$close -; -; Delete Old Backup File SH.BAK -; - if backup -; - lxi d,shvbak ;delete any old backups - call initfcb - call f$delete -; -; Create New Backup File SH.BAK=SH.VAR -; - lxi h,shvbak ;new name - lxi d,shvfcb ;old name - call f$rename ;create backup file -; - else -; -; Delete Original File -; - lxi d,shvfcb ;pt to FCB - call initfcb - call f$delete -; - endif ;backup -; -; Create New Shell Variable File SH.VAR=SH.$$$ -; - lxi h,shvfcb ;new name - lxi d,shvtmp ;old name - call f$rename ;create new file - xra a ;return OK - dcr a ;NZ - ret -; -; File Write Error -; -werr: - call print - db cr,lf,'Error in Writing File - Aborting',0 - xra a ;error code - ret - -; -; Load Shell Variable List -; Return with Z if Error -; -varload: -; -; Look for Variable File -; - call root ;determine DU of root - call logud ;goto root - call codend ;pt to scratch area - mvi m,ctrlz ;prep for no file - lxi d,shvfcb ;try to open file - call initfcb ;init FCB - call f$open - rnz ;file not found -; -; Read in Variable File -; -varl1: - lxi d,shvfcb ;read in file - call f$read - jnz varl2 - lxi d,tbuff ;pt to data - xchg ;copy into memory - mvi b,128 ;128 bytes - call hmovb - xchg - jmp varl1 -varl2: - lxi d,shvfcb ;close file - call f$close -; -; Say List is Already Loaded -; - xra a ;return NZ for OK - dcr a - ret - -; -; Buffers -; -lineptr: - ds 2 ;ptr to next char in line -curname: - ds 2 ;ptr to current variable name -shvar: - ds 8 ;shell variable name -; - if backup -shvbak: - db 0 - db 'SH ' ;name of shell variable file - db 'BAK' - ds 24 ;36 bytes total - endif ;backup -; -shvtmp: - db 0 - db 'SH ' ;name of shell variable file - db '$$$' - ds 24 ;36 bytes total -shvfcb: - db 0 - db 'SH ' ;name of shell variable file - db 'VAR' - ds 24 ;36 bytes total -; -; Sort Specification Block -; -ssb: - ds 2 ;address of first record -vcount: - ds 2 ;number of records to sort - dw 8 ;size of each record in bytes - dw compare ;compare routine -ptrbuf: - ds 2 ;address of pointer buffer - dw 0ffh ;use pointers - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SHVAR11.LBR b/Source/Images/d_bp/u15/SHVAR11.LBR deleted file mode 100644 index 433e2372..00000000 Binary files a/Source/Images/d_bp/u15/SHVAR11.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/SUB.COM b/Source/Images/d_bp/u15/SUB.COM deleted file mode 100644 index a57d3572..00000000 Binary files a/Source/Images/d_bp/u15/SUB.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SUB.MAC b/Source/Images/d_bp/u15/SUB.MAC deleted file mode 100644 index 3c85e0a9..00000000 --- a/Source/Images/d_bp/u15/SUB.MAC +++ /dev/null @@ -1,1043 +0,0 @@ -; -; PROGRAM NAME: SUB -; AUTHOR: RICHARD CONN (From SuperSUB Ver 1.1 by Ron Fowler) -; VERSION: 3.0 -; DATE: 18 May 84 -; PREVIOUS VERSIONS: 2.3 (6 Jan 83) - Called SUB2.ASM -; PREVIOUS VERSIONS: 2.2 (7 DEC 82), 2.1 (14 NOV 82), 2.0 (11 OCT 82) -; PREVIOUS VERSIONS: 1.4 (10 OCT 81), 1.3 (7 OCT 81) -; PREVIOUS VERSIONS: 1.2 (5 OCT 81), 1.1 (3 OCT 81), 1.0 (1 OCT 81) -; NOTE: FOR USE WITH ZCPR3 -; -VERS EQU 30 -z3env SET 0f400h - -; -; SUB is derived from Ron's SuperSUB program; it provides a different -; format for the command line, a command-search hierarchy like ZCPR3, a -; resetting of the DMA address, several additional functions, and there are -; several other additions/changes. Additionally, ZCPR3-specific enhancements, -; such as appending the rest of the multiple command line to the command file -; and allowing multiple commands on a single line, are permitted. -; -; SuperSUB, VERSION 1.1 (09/13/81) by Ron Fowler -; 2/18/81 (first written) WESTLAND, MICH. -; -; -; This program is intended as a replacement for the -; SUBMIT program provided with CP/M. It provides sev- -; eral new facilities: -; 1) Nestable SUBMIT runs -; 2) Interactive entry of SUBMIT job (no need -; to use an editor for simple SUBMIT runs) -; 3) Command line entry of small SUBMIT jobs -; 4) Ability to enter blank lines in an edited -; SUBMIT file -; 5) User customization of number of parameters -; and drive to send $$$.SUB to -; - -; -; DEFINE BOOLEANS -; -FALSE EQU 0 -TRUE EQU NOT FALSE - -; -; -- User customizable options -- -; - -FORCE$SUB EQU FALSE ;TRUE IF SUBMITTED FILE MUST BE OF TYPE .SUB -TIME$CONST EQU 0C000H ;DELAY FOR RINGING BELL -NPAR EQU 10 ;NUMBER OF ALLOWABLE PARAMETERS -CPBASE EQU 0 ;SET TO 4200H FOR HEATH CP/M -OPT EQU '/' ;OPTION DELIMITER CHAR -PDELIM EQU '$' ;PARAMETER DELIMITER - -; -; SYSLIB AND Z3LIB ROUTINES -; - EXT Z3INIT,PFIND,GETCL1 - EXT LOGUD,GETUD,PUTUD - EXT INITFCB - EXT PSTR,PRINT,QPRINT,COUT,CRLF,CAPS,PHLDC - EXT CODEND - -; -; CP/M DEFINITIONS -; -FGCHAR EQU 1 ;GET CHAR FUNCTION -DIRIOF EQU 6 ;DIRECT CONSOLE I/O -RDBUF EQU 10 ;READ CONSOLE BUFFER -LOGIN EQU 14 ;LOG IN DISK -OPENF EQU 15 ;OPEN FILE FUNCTION -CLOSEF EQU 16 ;CLOSE FILE FUNCTION -DELETF EQU 19 ;DELETE FILE FUNCTION -READF EQU 20 ;READ RECORD FUNCTION -WRITEF EQU 21 ;WRITE RECORD FUNCTION -MAKEF EQU 22 ;MAKE (CREATE) FILE FUNCTION -GETDSK EQU 25 ;RETURN CURRENT DISK -SETDMA EQU 26 ;SET DMA ADDRESS -UCODE EQU 32 ;GET/SET USER CODE -; -UDFLAG EQU CPBASE+4 -BDOS EQU CPBASE+5 -; -CURIND EQU '$' ;CURRENT USER/DISK INDICATOR -FCB EQU 5CH ;DEFAULT FILE CONTROL BLOCK -FCBEX EQU 12 ;FCB OFFSET TO EXTENT FIELD -FCBRC EQU 15 ;FCB OFFSET TO RECORD COUNT -FCBNR EQU 32 ;FCB OFFSET TO NEXT RECORD -FN EQU 1 ;FCB OFFSET TO FILE NAME -FT EQU 9 ;FCB OFFSET TO FILE TYPE -TBUF EQU CPBASE+80H ;DEFAULT BUFFER -TPA EQU CPBASE+100H ;TRANSIENT PROGRAM AREA -; -PUTCNT EQU TBUF ;COUNTER FOR OUTPUT CHARS -; -; DEFINE SOME TEXT CHARACTERS -; -CTRLC EQU 'C'-'@' -CTRLZ EQU 'Z'-'@' -BEL EQU 7 ;RING BELL -CR EQU 13 ;CARRIAGE RETURN -LF EQU 10 ;LINE FEED -TAB EQU 9 - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - LXI H,0 ;SAVE STACK IN CASE - DAD SP ; ONLY HELP REQUESTED - SHLD SPSAVE ;(NOT OTHERWISE USED) - CALL PUTUD ;SAVE HOME DIR - CALL QPRINT - DB 'SUB Version ',VERS/10+'0','.',(VERS MOD 10)+'0',0 - - CALL CODEND ;SET UP EXTERNAL BUFFERS - SHLD CLBUF ;SET PTR - MVI M,128 ;ALLOW 128 CHARS - LXI D,100H ;FREE SPACE - DAD D ;PT TO FREE AREA - SHLD FREMEM ;SET PTR TO FREE MEMORY AREA - SPHL ;SET STACK PTR - - LDA FCB+1 ;ANYTHING ON CMD LINE? - CPI ' ' - JZ HELP ;NO, GO PRINT HELP - CALL INITVAR ;INITIALIZE THE VARIABLE AREA - CALL GETPAR ;GET COMMAND LINE PARAMETERS AND EXTRACT OPTION - CALL ABORT ;PERFORM ABORT IF FLAG SET - CALL SETUP ;SET UP READ OF SUBMIT FILE - CALL RDFILE ;READ THE SUBMIT FILE - CALL WRSET ;SET UP WRITE OF "$$$.SUB" - CALL WRSUB ;WRITE "$$$.SUB" - JMP CPBASE ;GO START THE SUBMIT -; -; SETUP SETS UP THE FILE CONTROL BLOCK -; FOR READING IN THE .SUB TEXT FILE -; -SETUP: - LXI H,FCB+FT ;LOOK AT FIRST CHAR OF - MOV A,M ;FILE TYPE. IF IT IS - CPI ' ' ;BLANK, THEN GO MOVE - JZ PUTSUB ;"SUB" INTO FT FIELD - - IF FORCE$SUB ;FILE TYPE MUST BE OF .SUB - LXI D,SUBTYP ;FILE TYPE MUST BE .SUB - MVI B,3 ;3 BYTES - CALL COMPAR - JNZ NOTFND ;FILE NOT FOUND IF NO TYPE MATCH - ENDIF - - RET ; IF NOT BLANK, THEN ACCEPT ANY FILE TYPE -; -; MOVE "SUB" INTO THE FILE TYPE -; -PUTSUB: - XCHG ;BY CONVENTION, MOVE FROM - LXI H,SUBTYP ; @HL TO @DE - MVI B,3 - CALL MOVE - RET -; -; MOVE # BYTES IN B REGISTER FROM @HL TO @DE -; -MOVE: - MOV A,M ;PICK UP - STAX D ;PUT DOWN - INX H ;I'M SURE - INX D ; YOU'VE SEEN THIS - DCR B ; BEFORE... - JNZ MOVE ;100 TIMES AT LEAST - RET ;I KNOW I HAVE! -; -; GETPAR MOVES THE SUBSTITUTION PARAMETERS SPECIFIED -; IN THE COMMAND LINE INTO MEMORY, AND STORES THEIR -; ADDRESSES IN THE PARAMETER TABLE. THIS ALLOWS -; SUBSTITUTION OF $1, $2, ETC., IN THE SUBMIT COMMANDS -; WITH THEIR ACTUAL VALUES SPECIFED IN THE COMMAND -; LINE. -; -GETPAR: - XRA A ;A=0 - STA AFLAG ;TURN OFF ABORT COMMAND - LXI H,TBUF+1 ;WHERE WE FIND THE COMMAND TAIL - CALL SCANTO ;SKIP SUBMIT FILE NAME - STA OPTION ;FIRST CHAR OF CMD LINE IS OPTION - RC ;LINE ENDED? - CPI OPT ;NO, CHECK OPTION - JNZ GLP0 ;NOT KEYBOARD INP, READ FILE - INX H ;POINT PAST '/' - MOV A,M ;GET OPTION CHAR - CPI 'A' ;ABORT COMMAND - JZ GPARABT - CPI 'I' ;INTERACTIVE MODE - RZ ;RETURN IF SO - JMP HELP ;HELP OTHERWISE -GPARABT: - MVI A,0FFH ;TURN ON ABORT FLAG - STA AFLAG - INX H ;GET POSSIBLE BELL OPTION - MOV A,M - CPI 'B' ;BELL OPTION - RNZ - MVI A,0FFH ; SET BELL FLAG - STA BELL$FLAG - RET -GLP0: - MOV A,M ;INPUT IS FROM A .SUB FILE..THIS - INX H ; CODE SKIPS OVER THE NAME OF - ORA A ; THE SUB FILE TO GET TO THE - RZ ; COMMAND LINE PARAMETERS - CPI ' ' - JZ GLP - CPI TAB - JNZ GLP0 -GLP: - CALL SCANTO ;PASS UP THE BLANKS - RC ;CY RETURNED IF END OF CMD LINE - CALL PUTPAR ;NOW PUT THE PARAMETER INTO MEM - RC ;CY RETURNED IF END OF CMD LINE - JMP GLP ;GET THEM ALL -; -; SCANTO SCANS PAST BLANKS TO THE FIRST NON-BLANK. IF -; END OF COMMAND LINE FOUND, RETURNS CARRY SET. -; -SCANTO: - MOV A,M - INX H - ORA A ;SET FLAGS ON ZERO - STC ;IN CASE ZERO FOUND (END OF CMD LIN) - RZ - CPI ' ' - JZ SCANTO ;SCAN PAST BLANKS - CPI TAB ;DO TABS TOO, JUST FOR - JZ SCANTO ; GOOD MEASURE - DCX H ;FOUND CHAR, POINT BACK TO IT - ORA A ;INSURE CARRY CLEAR - RET -; -; PUTPAR PUTS THE PARAMETER POINTED TO BY HL INTO -; MEMORY POINTED TO BY "TXTPTR". ALSO STORES THE -; ADDRESS OF THE PARAMETER INTO THE PARAMETER TABLE -; FOR EASY ACCESS LATER, WHEN WE WRITE $$$.SUB -; -PUTPAR: - PUSH H ;SAVE POINTER TO PARM - LHLD TXTPTR ;NEXT FREE MEMORY - XCHG ; INTO DE - LHLD TBLPTR ;NEXT FREE AREA OF TABLE - MOV A,M ;NON-ZERO IN TABLE - ORA A ; INDICATES TABLE - JNZ PAROVF ; TABLE OVERFLOW (TOO MANY PARMS) - MOV M,E ;STORE THE PARM ADRS - INX H - MOV M,D - INX H - SHLD TBLPTR ;SAVE TABLE PNTR FOR NEXT TIME - POP H ;GET BACK PARM POINTER - PUSH D ;SAVE FREE MEM POINTER BECAUSE - ; WE WILL HAVE TO HAVE IT BACK - ; LATER TO STORE THE LENGTH - INX D ;POINT PAST LENGTH STORAGE - MVI B,0 ;INITIALIZE LENGTH OF PARM -PPLP: - MOV A,M ;GET NEXT BYTE OF PARM - INX H - ORA A ;TEST FOR END OF CMD LINE - JZ PP2 ;JUMP IF END - CPI ' ' ;TEST FOR END OF COMMAND - JZ PP2 - CPI TAB ;TAB ALSO ENDS COMMAND - JZ PP2 - STAX D ;PUT PARAMETER BYTE-BY-BYTE - INX D ;INTO FREE MEMORY - INR B ;BUMP LENGTH - JMP PPLP -PP2: - XCHG - SHLD TXTPTR ;NEW FREE MEMORY POINTER - POP H ;REMEMBER OUR LENGTH POINTER? - MOV M,B ;STORE THE LENGTH - XCHG ;HAVE TO RETN HL > CMD LINE - ORA A ;NOW RETURN END OF LINE FLAG - STC - RZ ;RETURN CY IF ZERO (EOL MARK) - CMC - RET -; -; -; ABORT CHECKS TO SEE IF THE ABORT FLAG IS SET AND -; EXECUTES THE ABORT FUNCTION IF SO -; -; -ABORT: - LDA AFLAG ;GET THE FLAG - ORA A ;0=NO - RZ - CALL PRINT - DB CR,LF,' Strike ^C to Abort Command File - ',0 - CALL CHARINB ;GET RESPONSE - CPI CTRLC ;ABORT? - JNZ ABORT1 ;RETURN TO OPSYS -ABORT0: - LXI D,SUBFCB ;DELETE SUBMIT FILE - MVI C,DELETF - CALL BDOS - CALL PRINT - DB ' ... Aborted',0 - JMP CPBASE ;RETURN TO CP/M -ABORT1: - CALL PRINT - DB ' ... Continuing',0 - JMP CPBASE ; RETURN TO CP/M -; -; INPUT CHAR FROM CON:; RING BELL EVERY SO OFTEN IF FLAG SET -; -CHARINB: - LDA BELL$FLAG ; GET FLAG - ORA A ; 0=NO - JZ CHARIN - PUSH H ; SAVE HL -CHARINB$LOOP: - LXI H,TIME$CONST ; GET TIME CONSTANT -CHARINB$LOOP1: - XTHL ; LONG DELAY - XTHL - DCX H ; COUNT DOWN - MOV A,H - ORA L - JNZ CHARINB$LOOP1 - MVI E,0FFH ; REQUEST STATUS - MVI C,DIRIOF ; DIRECT I/O - CALL BDOS - ORA A ; ANY INPUT? - JNZ CHARINB$DONE - MVI E,BEL ; RING BELL - MVI C,DIRIOF - CALL BDOS - JMP CHARINB$LOOP -CHARINB$DONE: - POP H ; RESTORE HL - JMP CAPS ; CAPITALIZE CHAR - -; -; INPUT CHAR FROM CON:; CAPITALIZE IT AND ECHO -; -CHARIN: - MVI C,FGCHAR ;GET CHAR - CALL BDOS - JMP CAPS ;CAPITALIZE -; -; RDFILE READS THE .SUB FILE SPECIFIED -; IN THE SUBMIT COMMAND INTO MEMORY -; -RDFILE: - LXI H,0 ;INIT LINE NUMBER - SHLD LINNUM - LDA OPTION ;USING A FILE? - CPI OPT ;OPT OPTION TELLS - JNZ RDFILE1 ;JUMP IF NOT - CALL PRINT - DB CR,LF,' Input Command Lines',0 - CALL CLFILL ;GET FIRST LINE - JMP LINE -RDFILE1: - CALL PRINT - DB CR,LF,' Processing SUB File',0 - -; CHECK FOR .SUB FILE IN CURRENT USER/CURRENT DISK - LXI D,FCB ;WE ARE, OPEN IT - CALL INITFCB ;INIT FCB - MVI A,0FFH ;SEARCH CURRENT ALSO - CALL PFIND ;LOOK FOR FILE - JZ NOTFND ;FILE NOT FOUND - CALL LOGUD ;LOG INTO DIRECTORY - LXI D,FCB ;PT TO FCB - MVI C,OPENF ;OPEN FILE - CALL BDOS - CALL FILL ;READ FIRST BLOCK - JNZ NOTEXT ;EMPTY FILE -LINE: - LHLD LINNUM ;BUMP LINE NUMBER - INX H - SHLD LINNUM - LHLD PREV ;GET PREV PREVIOUS LINE POINTER - XCHG - LHLD TXTPTR ;GET CURRENT FREE MEM POINTER - SHLD PREV ;MAKE IT THE PREV LINE (FOR NXT PASS) - MOV M,E ;STORE AT BEGIN OF CURRENT LINE, - INX H ; A POINTER TO THE PREVIOUS - MOV M,D - INX H - PUSH H ;LATER WE WILL PUT LENGTH HERE - INX H ;SKIP PAST LENGTH - MVI C,0 ;INITIALIZE LENGTH TO ZERO -LLP: - CALL GNB ;GET NEXT BYTE FROM INPUT SOURCE - CPI CTRLZ ;END OF FILE? - JZ EOF ;CY SET IF END OF FILE FOUND - ANI 7FH ;MASK OUT MSB - CALL CAPS ;CONVERT TO UPPER CASE - CPI LF ;IGNORE LINEFEEDS - JZ LLP - CPI CR ;IF IT'S A CARRIAGE RETURN, - JZ EOL ; THEN DO END OF LINE - MOV M,A ;STORE ALL OTHERS INTO MEMORY - INX H - CALL SIZE ;MAKE SURE NO MEMORY OVERFLOW - INR C ;BUMP CHAR COUNT - JM LENERR ;MAX OF 128 CHARS PER LINE - JMP LLP ;GO DO NEXT CHAR -; -; DO END OF LINE SEQUENCE -; -EOL: - SHLD TXTPTR ;SAVE FREE MEMORY POINTER - POP H ;CURRENT LINE'S LENGTH POINTER - MOV M,C ;STORE LENGTH AWAY - JMP LINE ;GO DO NEXT LINE -; -; END OF TEXT FILE -; -EOF: - SHLD TXTPTR ;SAVE FREE MEMORY POINTER - PUSH B ;SAVE LINE LENGTH - CALL ZMCL ;LOAD REST OF COMMAND LINE - POP B ;RESTORE LINE LENGTH - POP H ;CURRENT LINE'S LENGTH POINTER - MOV M,C ;STORE LENGTH AWAY - RET ;ALL DONE READING SUB FILE -; -; COPY COMMAND LINE INTO MEMORY BUFFER -; -ZMCL: - CALL GETCL1 ;GET ADDRESS OF COMMAND LINE BUFFER - MOV A,H ;CHECK FOR ANY - ORA L - RZ - LHLD LINNUM ;BUMP LINE NUMBER - INX H - SHLD LINNUM - LHLD PREV ;GET PREV PREVIOUS LINE POINTER - XCHG - LHLD TXTPTR ;GET CURRENT FREE MEM POINTER - SHLD PREV ;MAKE IT THE PREV LINE (FOR NXT PASS) - MOV M,E ;STORE AT BEGIN OF CURRENT LINE, - INX H ; A POINTER TO THE PREVIOUS - MOV M,D - INX H - PUSH H ;LATER WE WILL PUT LENGTH HERE - INX H ;SKIP PAST LENGTH - MVI C,0 ;INITIALIZE LENGTH TO ZERO - XCHG ;DE PTS TO NEXT PLACE TO STORE A BYTE - CALL GETCL1 ;GET ADDRESS OF COMMAND LINE BUFFER - MOV A,M ;GET LOW - INX H - MOV H,M ;GET HIGH - MOV L,A ;HL PTS TO FIRST BYTE OF MULTIPLE COMMAND LINE - MOV B,M ;GET FIRST CHAR IN LINE - MVI M,0 ;CLEAR LINE - MOV A,B ;CHECK TO SEE IF FIRST CHAR IS A SEMICOLON (CMD SEP) - CPI ';' - JNZ ZMCL0 - INX H ;PT TO 2ND CHAR - MOV A,M ;FIRST WAS A SEMICOLON, SO GET SECOND -ZMCL0: - XCHG ;HL PTS TO NEXT BUFFER SPACE, DE PTS TO MC LINE - JMP ZMCL1A ;A=FIRST CHAR IN MC LINE -; -; MAJOR LOOP TO STORE MULTIPLE COMMAND LINE -; -ZMCL1: - LDAX D ;GET NEXT BYTE FROM MULTIPLE COMMAND LINE -ZMCL1A: - ORA A ;0=EOL - JZ ZMCL2 - ANI 7FH ;MASK OUT MSB - CALL CAPS ;CONVERT TO UPPER CASE - MOV M,A ;STORE CHAR INTO MEMORY - INX H ;PT TO NEXT CHAR - INX D - CALL SIZE ;MAKE SURE NO MEMORY OVFL - INR C ;INCR CHAR COUNT - JM LENERR ;MAX OF 128 CHARS IN LINE - JMP ZMCL1 -; -; DONE WITH INPUT OF MULTIPLE COMMAND LINE -- SAVE CHAR CNT AND SET PTR -; -ZMCL2: - SHLD TXTPTR ;SAVE PTR - POP H ;PT TO CHAR COUNT POSITION - MOV M,C ;STORE CHAR COUNT - RET - -; -; GET NEXT BYTE FROM INPUT FILE OR USER -; -GNB: - PUSH H ;DON'T ALTER ANYBODY - PUSH D - PUSH B - LDA OPTION ;INPUT FROM .SUB FILE? - CPI OPT ;TOLD BY ORIG CMD LINE OPTION - JNZ GNBDISK ;GET NEXT CHAR FROM DISK BUFFER IF NOT FROM USER - CALL GNBKBD ;GET A BYTE FROM KBD INPUT - JMP GNBXIT ;THEN LEAVE -; -; GET NEXT BYTE FROM DISK FILE -; -GNBDISK: - LDA IBP ;GET BUFFER POINTER - CPI 128 ;NEED ANOTHER BLOCK FROM DISK? - JC GNBD1 ;CONTINUE - CALL FILL ;GET NEXT BLOCK - JZ GNBD1 ;CONTINUE IF NOT EMPTY - CALL GETUD ;RETURN HOME - MVI A,1AH ;FAKE EOF - JMP GNBXIT -GNBD1: - MOV E,A ;PUT OFFSET IN DE - MVI D,0 - INR A ;POINT TO NEXT BYTE - STA IBP ;SAVE FOR NEXT - LXI H,TBUF ;NOW OFFSET INTO BUFFER - DAD D - MOV A,M ;GET CHAR -GNBXIT: - POP B ;RESTORE EVERYBODY - POP D - POP H - ORA A ;TURN ON CARRY - RET -; -; FILL INPUT BUFFER FROM DISK -; -FILL: - XRA A ;CLEAR INPUT BUFFER PTR - STA IBP - LXI D,FCB ;PT TO FCB - MVI C,READF ;BDOS READ BLOCK FUNCTION - CALL BDOS - ORA A ;RETURN Z IF EOF - MVI A,0 ;SET PTR TO FIRST CHAR - RET -; -; GET NEXT BYTE FROM USER (KEYBOARD INPUT) -; -GNBKBD: - LHLD CLPTR ;PT TO NEXT CHAR - MOV A,M ;GET IT - INX H ;PT TO FOLLOWING - SHLD CLPTR ;RESET PTR - CPI CR ;END OF LINE? - RNZ - CALL CLFILL ;GET NEW LINE - JZ GKEND ;EMPTY LINE INPUT - RETURN EOF - MVI A,CR ;RETURN CR TO INDICATE END OF LINE - RET -GKEND: - MVI A,1AH ;RETURN EOF - RET -; -; FILL THE COMMAND LINE FROM THE USER -; -CLFILL: - CALL PRINT - DB CR,LF,' Command Line? ',0 - LHLD CLBUF ;NOW FILL THE BUFFER - XCHG ;...DE PTS TO IT - MVI C,RDBUF - CALL BDOS - LHLD CLBUF ;PT TO COMMAND LINE BUFFER - INX H - MOV A,M ;GET CHAR COUNT - INX H - SHLD CLPTR ;RESET THE COMMAND LINE PTR - ORA A ;SET ZERO FLAG - PUSH PSW ;SAVE A - ADD L ;PT TO AFTER LAST CHAR - MOV L,A - MOV A,H - ACI 0 - MOV H,A - MVI M,CR ;SET EOL CHAR - POP PSW ;GET CHAR COUNT - RET -; -; MAKE SURE NO MEMORY OVERFLOW -; -SIZE: - LDA BDOS+2 ;HIGHEST PAGE POINTER - SUI 9 ;MAKE IT BE UNDER CCP - CMP H ;CHECK IT AGAINST CURRENT PAGE - RNC ;NC=ALL OKAY - JMP MEMERR ;OTHERWISE ABORT -; -; SET UP THE $$$.SUB FILE -; FOR WRITING -; -WRSET: - CALL PRINT - DB CR,LF,' Writing Command File to Disk',0 - LXI D,SUBFCB - MVI C,OPENF - CALL BDOS ;OPEN THE FILE - INR A ;CHECK CPM RETURN - JZ NONE1 ;NONE EXISTS ALREADY -; -; $$$.SUB EXISTS, SO SET -; FCB TO APPEND TO IT -; - LDA SUBFCB+FCBRC ;GET RECORD COUNT - STA SUBFCB+FCBNR ;MAKE NEXT RECORD - RET -; -; COME HERE WHEN NO $$$.SUB EXISTS -; -NONE1: - LXI D,SUBFCB - MVI C,MAKEF - CALL BDOS - INR A - JZ NOMAKE ;0FFH=CAN'T CREATE FILE - RET -; -; WRITE THE "$$$.SUB" FILE -; -WRSUB: - LHLD PREV ;THIS CODE SCANS BACKWARD - MOV A,H ; THRU THE FILE STORED IN - ORA L ; MEMORY TO THE FIRST NON- - JZ NOTEXT ; NULL LINE. IF NONE IS - MOV E,M ; FOUND, ABORTS - INX H - MOV D,M ;HERE, WE PICK UP PNTR TO PREV LINE - INX H ;NOW WE POINT TO LENGTH - XCHG ;WE NEED TO STORE AWAY - SHLD PREV ; POINTER TO PREV LINE - XCHG - MOV A,M ;NOW PICK UP THE LENGTH - ORA A ;SET Z FLAG ON LENGTH - JNZ WRNTRY ;GOT LINE W/LENGTH: GO DO IT - LHLD LINNUM ;NOTHING HERE, FIX LINE NUMBER - DCX H ;(WORKING BACKWARD NOW) - SHLD LINNUM - JMP WRSUB -WRLOP: - LHLD PREV ;GET PREV LINE POINTER - MOV A,H - ORA L ;IF THERE IS NO PREV LINE - JZ CLOSE ; THEN WE ARE DONE - MOV E,M ;ELSE SET UP PREV FOR NEXT - INX H ; PASS THRU HERE - MOV D,M - INX H - XCHG ;NOW STORE IT AWAY - SHLD PREV - XCHG -WRNTRY: - CALL PUTLIN ;WRITE THE LINE TO THE FILE - LHLD LINNUM ;BUMP THE LINE NUMBER - DCX H ;DOWN (WORKING BACK NOW) - SHLD LINNUM - JMP WRLOP -; -; $$$.SUB IS WRITTEN, CLOSE THE FILE -; -CLOSE: - LXI D,SUBFCB - MVI C,CLOSEF - JMP BDOS -; -; THIS SUBROUTINE WRITES A LINE -; TO THE $$$.SUB FILE BUFFER, -; AND FLUSHES THE BUFFER AFTER -; THE LINE IS WRITTEN. -; -PUTLIN: - MOV A,M ;PICK UP LENGTH BYTE - INX H ;POINT PAST IT - STA GETCNT ;MAKE A COUNT FOR "GET" - SHLD GETPTR ;MAKE A POINTER FOR "GET" - LXI H,TBUF+1 ;TEXT GOES AFTER LENGTH - SHLD PUTPTR ;MAKE POINTER FOR "PUT" - XRA A ;INITIALIZE PUT COUNT - STA PUTCNT - MOV B,L ;COUNT FOR CLEAR LOOP -CLR: - MOV M,A ;ZERO OUT BUFFER LOC - INX H - INR B ;COUNT - JNZ CLR -; -; THIS LOOP COLLECTS CHARACTERS -; FROM THE LINE STORED IN MEMORY -; AND WRITES THEM TO THE FILE. -; IF THE "$" PARAMETER SPECIFIER -; IS ENCOUNTERED, PARAMETER SUB- -; STITUTION IS DONE -; -PUTLP: - CALL GETCHR ;PICK UP A CHARACTER - JC FLUSH ;CY = NO MORE CHAR IN LINE - CPI '^' ;CONTROL-CHAR TRANSLATE PREFIX? - JNZ NOTCX - CALL GETCHR ;YES, GET THE NEXT - JC CCERR ;ERROR: EARLY END OF INPUT - SUI '@' ;MAKE IT A CONTROL-CHAR - JC CCERR ;ERROR: TOO SMALL - CPI ' ' - JNC CCERR ;ERROR: TOO LARGE -NOTCX: - CPI PDELIM ;PARAMETER SPECIFIER? - JNZ STOBYT ;IF NOT, JUST WRITE CHAR - LDA OPTION ;CHECK OPTION: '$' DOESN'T - CPI OPT ; COUNT IN OPT MODE - MVI A,PDELIM ;(RESTORE THE '$') - JZ STOBYT - CALL LKAHED ;PEEK AT NEXT CHAR - JC PARERR ;LINE ENDING MEANS PARAM ERR - CPI PDELIM ;ANOTHER "$"? - JNZ SUBS ;IF NOT THEN GO DO SUBSTITUTION - CALL GETCHR ;GET THE 2ND "$" (WE ONLY LOOKED - ; AHEAD BEFORE) -STOBYT: - CALL PUTCHR ;WRITE CHAR TO FILE - JMP PUTLP -; -; PARAMETER SUBSTITUTION...LOOKS UP THE -; PARAMETER # AFTER THE "$" AND PLUGS IT -; IN IF IT EXISTS. -; -SUBS: - CALL NUMTST ;IT BETTER BE A NUMBER - JC PARERR ; OTHERWISE PARAM ERROR - MVI B,0 ;INITIALIZE PARM # - JMP LPNTRY ;WE JOIN LOOP IN PROGRESS... -SUBLP: - CALL LKAHED ;LOOK AT NEXT CHAR - JC DOSUBS ;IF LINE EMPTY, THEN PLUG IN PARM - CALL NUMTST ;CHECK FOR NUMERIC - JC DOSUBS ;DONE IF NOT -LPNTRY: - CALL GETCHR ;NOW REMOVE THE CHAR FROM INPUT STREAM - SUI '0' ;REMOVE ASCII BIAS - MOV C,A ;SAVE IT - MOV A,B ;OUR ACCUMULATED COUNT - ADD A ;MULTIPLY BY TEN - ADD A - ADD B - ADD A - ADD C ;THEN ADD IN NEW DIGIT - MOV B,A ;RESTORE COUNT - JMP SUBLP -; -; PERFORM THE SUBSTITUTION -; -DOSUBS: - MOV A,B ;GET PARM # - DCR A ;MAKE ZERO RELATIVE - JM PARERR ;OOPS - CALL LOOKUP ;LOOK IT UP IN PARM TABLE - JC PARERR ;IT'S NOT THERE - MOV B,A ;LENGTH IN B -SUBLP1: - INR B ;TEST B FOR ZERO - DCR B - JZ PUTLP ;DONE - MOV A,M ;GET CHAR OF REAL PARAMETER - INX H ;POINT PAST FOR NEXT TIME - PUSH H ;SAVE REAL PARM POINTER - CALL PUTCHR ;PUT IT IN THE FILE - POP H ;GET BACK REAL PARM POINTER - DCR B ;COUNTDOWN - JMP SUBLP1 -; -; COME HERE WHEN A LINE IS FINISHED, -; AND WE NEED TO WRITE THE BUFFER TO DISK -; -FLUSH: - LXI D,SUBFCB - MVI C,WRITEF - CALL BDOS - ORA A - JNZ WRERR ;CPM RETURNED A WRITE ERROR - RET -; -; GETCHR GETS ONE CHAR FROM -; LINE STORED IN MEMORY -; -GETCHR: - LXI H,GETCNT - MOV A,M ;PICK UP COUNT - DCR A ;REMOVE THIS CHAR - STC ;PRESET ERROR - RM ;RETURN CY IF OUT OF CHARS - MOV M,A ;UPDATE COUNT - LHLD GETPTR ;CURRENT CHAR POINTER - MOV A,M ;PICK UP CHAR - INX H ;BUMP POINTER - SHLD GETPTR ;PUT IT BACK - CMC ;TURN CARRY OFF - RET -; -; PUTCHR PUTS ONE CHAR TO -; THE OUTPUT BUFFER -; -PUTCHR: - LXI H,PUTCNT - INR M ;INCREMENT COUNT - JM LENERR ;LINE WENT TO > 128 CHARS - LHLD PUTPTR ;GET BUFFER POINTER - ANI 7FH ;MASK OUT MSB - MOV M,A ;PUT CHAR THERE - INX H ;BUMP POINTER - SHLD PUTPTR ;PUT IT BACK - RET ;ALL DONE -; -; LOOK AHEAD ONE CHAR IN -; THE INPUT STREAM. SET -; CARRY IF NONE LEFT. -; -LKAHED: - LDA GETCNT - ORA A ;SEE IF COUNT IS DOWN TO ZERO - STC ;PRE SET INDICATOR - RZ - MOV A,M ;PICK UP CHAR - CMC ;TURN OFF CARRY FLAG - RET -; -; LOOK UP PARAMETER WITH NUMBER IN -; A REG. RETURN A=LENGTH OF PARM, -; AND HL => PARAMETER -; -LOOKUP: - CPI NPAR - JNC PAROVF ;PARM # TOO HIGH - MOV L,A - MVI H,0 ;NOW HAVE 16 BIT NUMBER - DAD H ;DOUBLE FOR WORD OFFSET - LXI D,TABLE - DAD D ;DO THE OFFSET - MOV E,M ;GET ADDRESS OF PARM - INX H - MOV D,M - MOV A,D ;ANYTHING THERE? - ORA E - JNZ LKUPOK - XRA A ;NO, ZERO LENGTH - RET -LKUPOK: - XCHG ;NOW IN DE - MOV A,M ;PICK UP LENGTH - INX H ;POINT PAST LENGTH - RET -; -; UTILITY COMPARE SUBROUTINE -; -COMPAR: - LDAX D - CMP M - RNZ - INX H - INX D - DCR B - JNZ COMPAR - RET -; -; NUMERIC TEST UTILITY SUBROUTINE -; -NUMTST: - CPI '0' - RC - CPI '9'+1 - CMC - RET -; -; ERROR HANDLERS -; -WRERR: - CALL ERRXIT - DB 'Disk Full',0 -NOMAKE: - CALL ERRXIT - DB 'Dir Full',0 -MEMERR: - CALL ERRXIT - DB 'Mem Full',0 -NOTFND: - CALL ERRXIT - DB 'SUB File Not Found',0 -PARERR: - CALL ERRXIT - DB 'Param',0 -PAROVF: - CALL ERRXIT - DB 'Too Many Params',0 -LENERR: - CALL ERRXIT - DB 'Line too Long',0 -NOTEXT: - CALL ERRXIT - DB 'SUB File Empty',0 -CCERR: - CALL ERRXIT - DB 'Ctrl Char',0 -ERRXIT: - CALL CRLF ;NEW LINE - POP H - CALL PSTR ;PRINT MESSAGE - CALL PRINT - DB ' Error on Line ',0 - LHLD LINNUM ;TELL LINE NUMBER - CALL PHLDC - CALL CRLF - LXI D,SUBFCB ;DELETE THE $$$.SUB FILE - MVI C,DELETF - CALL BDOS - JMP CPBASE -; -; INITIALIZE ALL VARIABLES -; -INITVAR: - LXI H,VAR - LXI B,ENDVAR-VAR -INITLP: - MVI M,0 ;ZERO ENTIRE VAR AREA - INX H - DCX B - MOV A,B - ORA C - JNZ INITLP - LXI H,TABLE ;INIT PARM TABLE POINTER - SHLD TBLPTR - LXI H,0FFFFH ;MARK END OF TABLE - SHLD ENDTBL - LHLD FREMEM ;FREE MEMORY STARTS TXT AREA - SHLD TXTPTR - RET -; -; PRINT HELP WITH PROGRAM OPTIONS -; -HELP: - CALL PRINT - DB CR,LF,'Syntax:' - DB CR,LF,' SUB - Print this HELP Message' - DB CR,LF,' SUB /A - Abort of SUBMIT File' - DB CR,LF,' SUB /AB - Abort and Ring Bell' - DB CR,LF,' SUB /I - Go into Interactive mode' - DB CR,LF,' SUB - Standard SUB File' - DB 0 - LHLD SPSAVE ;RETURN TO OPSYS - SPHL - RET -; -; VARIABLE STORAGE -; -VAR EQU $ -; -AFLAG: - DB 0 ;ABORT FLAG (0=NO) -TXTPTR: - DW 0 ;FREE MEMORY POINTER -TBLPTR: - DW 0 ;POINTER TO PARM TABLE -DUSER: - DB 0 ;DEFAULT USER NUMBER -LINNUM: - DW 0 ;CURRENT LINE NUMBER -PREV: - DW 0 ;POINTER TO PREV LINE -GETCNT: - DB 0 ;COUNTER FOR 'GET' -GETPTR: - DW 0 ;POINTER FOR 'GET' -PUTPTR: - DW 0 ;POINTER FOR 'PUT' -IBP: - DB 0 ;INPUT BUFFER POINTER -CLPTR: - DW 0 ;COMMAND LINE POINTER -BELL$FLAG: - DB 0 ;RING BELL ON ABORT FLAG -OPTION: - DB 0 ;OPT OPTION FLAG STORE -TABLE: - DS NPAR*3 ;PARAMETER TABLE -ENDTBL: - DW 0FFFFH ;END OF PARAMETER TABLE -; -ENDVAR EQU $ -SPSAVE: - DW 0 ;STACK POINTER SAVE -; -; -; FCB FOR $$$.SUB -; -SUBFCB: - DB 1 ;DRIVE SPECIFIER (A SELECTED) - DB '$$$ ' -SUBTYP: - DB 'SUB' - DW 0,0,0,0 ;INITIALIZE REST OF FCB - DW 0,0,0,0 - DW 0,0,0,0 -; -CLBUF: DS 2 ;PTR TO COMMAND LINE BUFFER -FREMEM: DS 2 ;PTR TO FREE MEMORY AREA -; - END - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSENV.AQM b/Source/Images/d_bp/u15/SYSENV.AQM deleted file mode 100644 index 6c7f6b16..00000000 Binary files a/Source/Images/d_bp/u15/SYSENV.AQM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SYSENV.ASM b/Source/Images/d_bp/u15/SYSENV.ASM deleted file mode 100644 index 3ffe2e7d..00000000 --- a/Source/Images/d_bp/u15/SYSENV.ASM +++ /dev/null @@ -1,31 +0,0 @@ -* SYSTEM SEGMENT: SYSTEM.ENV -* AUTHOR: RICHARD CONN - -; PROGRAM: SYSENV.ASM -; AUTHOR: Richard Conn -; Version: 1.0 -; Date: 22 Feb 84 -; Previous Versions: None - -; -; SYSENV is the definition for my ZCPR3 environment, and it is loaded -; as my ZCPR3 Environment Descriptor by Z3LDR. SYSENV is named to SYS.ENV -; after assembly to permit this. -; - -; -; Environment Definitions -; - MACLIB Z3BASE - MACLIB SYSENV - -; -; Include Environment Descriptor -; - org 100H ; origin - jmp 0 ; leading JMP - - SYSENV - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSENV.LIB b/Source/Images/d_bp/u15/SYSENV.LIB deleted file mode 100644 index 501f6bdb..00000000 --- a/Source/Images/d_bp/u15/SYSENV.LIB +++ /dev/null @@ -1,136 +0,0 @@ -; LIBRARY: SYSENV.LIB -; AUTHOR: Richard Conn -; Version: 1.0 -; Date: 18 May 84 -; Previous Versions: None - -; -; SYSENV is the definition for my ZCPR3 environment. -; - -sysenv macro -; -; Environment Descriptor -; If inline, there is a leading JMP just before this -; -envorg1: - db 'Z3ENV' ; Environment ID - db 2 ; class 2 environment (internal) - - dw expath ; external path address - db expaths ; number of 2-byte elements in path - - dw rcp ; RCP address - db rcps ; number of 128-byte blocks in RCP - - dw iop ; IOP address - db iops ; number of 128-byte blocks in IOP - - dw fcp ; FCP address - db fcps ; number of 128-byte blocks in FCP - - dw z3ndir ; NDR address - db z3ndirs ; number of 18-byte entries in NDR - - dw z3cl ; ZCPR3 Command Line - db z3cls ; number of bytes in Command Line - - dw z3env ; ZCPR3 Environment Descriptor - db z3envs ; number of 128-byte blocks in Descriptor - - dw shstk ; Shell Stack address - db shstks ; number of shsize-byte entires in Shell Stack - db shsize ; size of a Shell Stack entry - - dw z3msg ; ZCPR3 Message buffer - - dw extfcb ; ZCPR3 External FCB - - dw extstk ; ZCPR3 External Stack - - db 0 ; quiet flag (1=quiet, 0=not quiet) - - dw z3whl ; address of Wheel Byte - - db 4 ; Processor Speed in MHz - - db 'D'-'@' ; maximum disk - db 31 ; maximum user - - db 1 ; 1=OK to accept DU, 0=not OK - - db 0 ; CRT selection (0=CRT 0, 1=CRT 1) - db 0 ; Printer selection (n=Printer n) - - db 80 ; width of CRT 0 - db 24 ; number of lines on CRT 0 - db 22 ; number of lines of text on CRT 0 - - db 132 ; width of CRT 1 - db 24 ; number of lines on CRT 1 - db 22 ; number of lines of text on CRT 1 - - db 80 ; width of Printer 0 - db 66 ; number of lines on Printer 0 - db 58 ; number of lines of text on Printer 0 - db 1 ; form feed flag (0=can't formfeed, 1=can) - - db 102 ; width of Printer 1 - db 66 ; number of lines on Printer 1 - db 58 ; number of lines of text on Printer 1 - db 1 ; form feed flag (0=can't formfeed, 1=can) - - db 80 ; width of Printer 2 - db 66 ; number of lines on Printer 2 - db 58 ; number of lines of text on Printer 2 - db 0 ; form feed flag (0=can't formfeed, 1=can) - - db 102 ; width of Printer 3 - db 66 ; number of lines on Printer 3 - db 58 ; number of lines of text on Printer 3 - db 0 ; form feed flag (0=can't formfeed, 1=can) - - db 'SH ' ; shell variable filename - db 'VAR' ; shell variable filetype - - db ' ' ; filename 1 - db ' ' ; filetype 1 - - db ' ' ; filename 2 - db ' ' ; filetype 2 - - db ' ' ; filename 3 - db ' ' ; filetype 3 - - db ' ' ; filename 4 - db ' ' ; filetype 4 - - ds 80H-($-envorg1+3) ; make exactly 80H bytes long - ; (+3 compensates for leading JMP) -; -; Terminal Capabilities Data -; -envorg2: - DB 'TVI 950 ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'V'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 1bh,'*',0 ;CL String - DB 1bh,'=%+ %+ ',0 ;CM String - DB 1bh,'t',0 ;CE String - DB 1bh,')',0 ;SO String - DB 1bh,'(',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String - - ds 80H-($-envorg2) ; make exactly 80H bytes long - -; -; End of Environment Descriptor -; - endm - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSFCP.AQM b/Source/Images/d_bp/u15/SYSFCP.AQM deleted file mode 100644 index dcf0eeaf..00000000 Binary files a/Source/Images/d_bp/u15/SYSFCP.AQM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SYSFCP.ASM b/Source/Images/d_bp/u15/SYSFCP.ASM deleted file mode 100644 index d559fab3..00000000 --- a/Source/Images/d_bp/u15/SYSFCP.ASM +++ /dev/null @@ -1,945 +0,0 @@ -* SYSTEM SEGMENT: SYS.FCP -* SYSTEM: ZCPR3 -* CUSTOMIZED BY: RICHARD CONN - -* -* PROGRAM: SYSFCP.ASM -* AUTHOR: RICHARD CONN -* VERSION: 1.0 -* DATE: 22 FEB 84 -* PREVIOUS VERSIONS: NONE -* -VERSION EQU 10 - -* -* Global Library which Defines Addresses for SYSTEM -* - MACLIB Z3BASE ; USE BASE ADDRESSES - MACLIB SYSFCP ; USE EQUATES FROM HEADER FILE - -; -LF EQU 0AH -CR EQU 0DH -BELL EQU 07H -; -BASE EQU 0 -WBOOT EQU BASE+0000H ;CP/M WARM BOOT ADDRESS -UDFLAG EQU BASE+0004H ;USER NUM IN HIGH NYBBLE, DISK IN LOW -BDOS EQU BASE+0005H ;BDOS FUNCTION CALL ENTRY PT -TFCB EQU BASE+005CH ;DEFAULT FCB BUFFER -FCB1 EQU TFCB ;1st and 2nd FCBs -FCB2 EQU TFCB+16 -TBUFF EQU BASE+0080H ;DEFAULT DISK I/O BUFFER -TPA EQU BASE+0100H ;BASE OF TPA -; -$-MACRO ;FIRST TURN OFF THE EXPANSIONS -; -; MACROS TO PROVIDE Z80 EXTENSIONS -; MACROS INCLUDE: -; -; JR - JUMP RELATIVE -; JRC - JUMP RELATIVE IF CARRY -; JRNC - JUMP RELATIVE IF NO CARRY -; JRZ - JUMP RELATIVE IF ZERO -; JRNZ - JUMP RELATIVE IF NO ZERO -; DJNZ - DECREMENT B AND JUMP RELATIVE IF NO ZERO -; -; @GENDD MACRO USED FOR CHECKING AND GENERATING -; 8-BIT JUMP RELATIVE DISPLACEMENTS -; -@GENDD MACRO ?DD ;;USED FOR CHECKING RANGE OF 8-BIT DISPLACEMENTS - IF (?DD GT 7FH) AND (?DD LT 0FF80H) - DB 100H,?DD ;Displacement Range Error - ELSE - DB ?DD - ENDIF ;;RANGE ERROR - ENDM -; -; -; Z80 MACRO EXTENSIONS -; -JR MACRO ?N ;;JUMP RELATIVE - IF I8080 ;;8080/8085 - JMP ?N - ELSE ;;Z80 - DB 18H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRC MACRO ?N ;;JUMP RELATIVE ON CARRY - IF I8080 ;;8080/8085 - JC ?N - ELSE ;;Z80 - DB 38H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRNC MACRO ?N ;;JUMP RELATIVE ON NO CARRY - IF I8080 ;;8080/8085 - JNC ?N - ELSE ;;Z80 - DB 30H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRZ MACRO ?N ;;JUMP RELATIVE ON ZERO - IF I8080 ;;8080/8085 - JZ ?N - ELSE ;;Z80 - DB 28H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRNZ MACRO ?N ;;JUMP RELATIVE ON NO ZERO - IF I8080 ;;8080/8085 - JNZ ?N - ELSE ;;Z80 - DB 20H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -DJNZ MACRO ?N ;;DECREMENT B AND JUMP RELATIVE ON NO ZERO - IF I8080 ;;8080/8085 - DCR B - JNZ ?N - ELSE ;;Z80 - DB 10H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -* -* SYSTEM Entry Point -* - org fcp ; passed for Z3BASE - - db 'Z3FCP' ; Flag for Package Loader -* -* **** Command Table for FCP **** -* This table is FCP-dependent! -* -* The command name table is structured as follows: -* -* ctable: -* DB 'CMNDNAME' ; Table Record Structure is -* DW cmndaddress ; 8 Chars for Name and 2 Bytes for Adr -* ... -* DB 0 ; End of Table -* -cnsize equ 4 ; NUMBER OF CHARS IN COMMAND NAME - db cnsize ; size of text entries -ctab: - db 'IF ' - dw ifstart - db 'ELSE' - dw ifelse - db 'FI ' - dw ifend - db 'XIF ' - dw ifexit - db 0 -; -; Condition Table -; -condtab: -; - IF IFOTRUE - db 'T ' ;TRUE - dw ifctrue - db 'F ' ;FALSE - dw ifcfalse - ENDIF -; - IF IFOEMPTY - db 'EM' ;file empty - dw ifcempty - ENDIF -; - IF IFOERROR - db 'ER' ;error message - dw ifcerror - ENDIF -; - IF IFOEXIST - db 'EX' ;file exists - dw ifcex - ENDIF -; - IF IFOINPUT - db 'IN' ;user input - dw ifcinput - ENDIF -; - IF IFONULL - db 'NU' - dw ifcnull - ENDIF -; - IF IFOTCAP ;Z3 TCAP available - db 'TC' - dw ifctcap - ENDIF -; - IF IFOWHEEL ;Wheel Byte - db 'WH' - dw ifcwheel - ENDIF -; - db 0 - -* -* Print " IF" -* -prif: - call print - db 'IF',' '+80H - ret -* -* Print String (terminated in 0 or MSB Set) at Return Address -* -print: - IF NOISE - mvi a,' ' ;print leading space - call conout - ENDIF ;NOISE - xthl ; get address - call print1 - xthl ; put address - ret -* -* Print String (terminated by MSB Set) pted to by HL -* -print1: - mov a,m ; done? - inx h ; pt to next - call conout ; print char - ora a ; set MSB flag (M) - rm ; MSB terminator - jr print1 - -* -* **** FCP Routines **** -* All code from here on is FCP-dependent! -* - -; -; FCP Command: XIF -; XIF terminates all IFs, restoring a basic TRUE state -; -ifexit: - IF NOISE - call nl ;print new line - ENDIF ;NOISE - call iftest ;see if current IF is running and FALSE - jrz ifstat ;abort with status message if so - lxi h,z3msg+1 ;pt to IF flag - xra a ;A=0 - mov m,a ;zero IF flag - jr ifendmsg ;print message - -; -; FCP Command: FI -; FI decrements to the previous IF -; -; Algorithm: -; Rotate Current IF Bit (1st IF Message) Right 1 Bit Position -; -ifend: - IF NOISE - call nl ;print new line - ENDIF ;NOISE - lxi h,z3msg+1 ;pt to IF flag - mov a,m ;get it - ora a ;no IF active? - jrz ifnderr -ifendmsg: - IF NOISE - push psw ;save A - call print - db 'T','o'+80H ;prefix to status display - pop psw ;get A - ENDIF ;NOISE - rrc ;move right 1 bit - ani 7fh ;mask msb 0 - mov m,a ;store active bit - jrnz ifstat ;print status if IF still active -ifnderr: - IF NOISE - call print ;print message - db 'N','o'+80H - jmp prif - ELSE ;NOT NOISE - ret - ENDIF ;NOISE - -; -; FCP Command: ELSE -; ELSE complements the Active Bit for the Current IF -; -; Algorithm: -; If Current IF is 0 (no IF) or 1 (one IF), then toggle -; Active IF Bit associated with Current IF -; Else -; If Previous IF was Active then toggle -; Active IF Bit associated with Current IF -; Else do nothing -; -ifelse: - IF NOISE - call nl ;print new line - ENDIF ;NOISE - lxi h,z3msg+1 ;pt to IF msgs - mov a,m ;get current IF - mov b,a ;save current IF in B - inx h ;pt to active IF message - rrc ;back up to previous IF level - ani 7fh ;mask out possible carry - jrz iftog ;toggle if IF level is 0 or 1 - ana m ;determine previous IF status - jrz ifstat ;don't toggle, and just print status -iftog: - mov a,m ;get active IF message - cma ;flip bits - ana b ;look at only interested bit - mov c,a ;result in C - mov a,b ;complement IF byte - cma - mov b,a - mov a,m ;get active byte - ana b ;mask in only uninterested bits - ora c ;mask in complement of interested bit - mov m,a ;save result and fall thru to print status -; -; Indicate if current IF is True or False -; -ifstat: - IF NOISE - call prif - mvi b,'F' ;assume False - call iftest ;see if IF is FALSE (Z if so) - jrz ifst1 ;Zero means IF F or No IF - mvi b,'T' ;set True -ifst1: - mov a,b ;get T/F flag and fall thru to print it - ELSE ;NOT NOISE - ret - ENDIF ;NOISE - -; -; Console Output Routine -; -conout: - push h ; save regs - push d - push b - push psw - ani 7fh ; mask MSB - mov e,a ; char in E - mvi c,2 ; output - call bdos - pop psw ; get regs - pop b - pop d - pop h - ret - -; -; Output LF (to go with CR from ZCPR3) -; -nl: - mvi a,lf ;output LF - jr conout - -; -; FCP Command: IF -; -ifstart: - IF NOISE - call nl ;print new line - ENDIF ;NOISE - call iftest ;see if current IF is running and FALSE -; - IF NOT COMIF - jrz ifcfalse ;raise next IF level to FALSE if so - ELSE - jz ifcf - ENDIF ;NOT COMIF -; - -;**************************************************************** -;* * -;* IF.COM Processing * -;* * -;**************************************************************** - -; -; If IF.COM to be processed, goto ROOT (base of path) and load it -; - IF COMIF -; -; Get Current Disk and User in BC -; - lda udflag ;get UD - push psw ;save UD flag - ani 0fh ;get disk - sta cdisk ;set current disk - mov b,a ;B=disk (A=0) - pop psw ;get UD flag - rlc ;get user in low 4 bits - rlc - rlc - rlc - ani 0fh ;get user - sta cuser ;set current user - mov c,a ;... in C -; -; Pt to Start of Path -; - lxi h,expath ;pt to path -; -; Check for End of Path -; -fndroot: - mov a,m ;check for done - ora a ;end of path? - jrz froot2 -; -; Process Next Path Element -; - cpi '$' ;current disk? - jrnz froot0 - lda cdisk ;get current disk - inr a ;+1 for following -1 -froot0: - dcr a ;set A=0 - mov b,a ;set disk - inx h ;pt to user - mov a,m ;get user - cpi '$' ;current user? - jrnz froot1 - lda cuser ;get current user -froot1: - mov c,a ;set user - inx h ;pt to next - jr fndroot -; -; Done with Search - BC Contains ROOT DU -; -froot2: -; -; Log Into ROOT -; - call logbc ;log into root DU -; -; Set Address of Next Load and Set DMA for OPEN -; - lxi h,100h ;pt to TPA - shld nxtload ;set address for next load - xchg ;DE=100H so don't wipe out buffers - mvi c,26 ;set DMA - call bdos -; -; Try to Open File IF.COM -; - lxi d,extfcb ;pt to FCB - mvi c,15 ;open file - call bdos - inr a ;check for found - jz ifnotfnd -; -; Load File IF.COM -; -ifload: -; -; Set Load Address -; - lhld nxtload ;get address of next load - push h ;save it - lxi d,80h ;pt to following - dad d - shld nxtload - pop d ;get load address - mvi c,26 ;set DMA - call bdos -; -; Read in Block (Sector) and Loop Back if Not Done -; - lxi d,extfcb ;read file - mvi c,20 - push d ;save ptr in case of failure (done) - call bdos - pop d - ora a ;OK? - jz ifload -; -; Done - Close File -; - mvi c,16 ;close file - call bdos -; -; Reset Environment (DMA and DU) and Run IF.COM -; - call reset ;reset DMA and directory - jmp tpa ;run IF.COM -; -; Reset DMA Address and Current Disk (in CDISK) and User (in CUSER) -; -reset: - lxi d,80h ;reset DMA address - mvi c,26 - call bdos - lda cdisk ;return home - mov b,a - lda cuser - mov c,a -; -; Log Into DU in BC -; -logbc: - mov e,b ;set disk - push b - mvi c,14 ;select disk - call bdos - pop b - mov e,c ;set user - mvi c,32 ;select user - jmp bdos -; -; IF.COM not found - Process as IF F -; -ifnotfnd: - call reset ;return home - jr ifcf -; -; Buffers for COMIF -; -nxtload: - ds 2 ;address of next block (sector) to load -cuser: - ds 1 ;current user -cdisk: - ds 1 ;current disk (A=0) -; - ENDIF ;COMIF -; - - IF NOT COMIF -;**************************************************************** -;* * -;* Non-IF.COM Processing * -;* * -;**************************************************************** - -; -; Test for Equality if Enabled -; - IF IFOEQ - lxi h,tbuff+1 ;look for '=' in line -tsteq: - mov a,m ;get char - inx h ;pt to next - ora a ;EOL? - jrz ifck0 ;continue if so - cpi '=' ;'=' found? - jrnz tsteq - lxi h,fcb1+1 ;compare FCBs - lxi d,fcb2+1 - mvi b,11 ;11 bytes -eqtest: - ldax d ;compare - cmp m - jrnz ifcf - inx h ;pt to next - inx d - djnz eqtest - jr ifct - ENDIF ;IFOEQ -; -; Test Condition in FCB1 and file name in FCB2 -; Execute condition processing routine -; -ifck0: - lxi d,fcb1+1 ;pt to first char in FCB1 -; - IF IFONEG - ldax d ;get it - sta negflag ;set negate flag - cpi negchar ;is it a negate? - jrnz ifck1 - inx d ;pt to char after negchar -ifck1: - ENDIF ;IFONEG -; - IF IFOREG ;REGISTERS - call regtest ;test for register value - jrnz runreg - ENDIF ;IFOREG -; - call condtest ;test of condition match - jrnz runcond ;process condition - call print ;beep to indicate error - db bell+80H - jmp ifstat ;no condition, display current condition -; -; Process register - register value is in A -; - IF IFOREG -runreg: - push psw ;save value - call getnum ;extract value in FCB2 as a number - pop psw ;get value - cmp b ;compare against extracted value - jrz ifctrue ;TRUE if match - jr ifcfalse ;FALSE if non-match - ENDIF ;IFOREG -; -; Process conditional test - address of conditional routine is in HL -; -runcond: - pchl ;"call" routine pted to by HL -; - ENDIF ;NOT COMIF -; - -; -; Condition: NULL (2nd file name) -; - IF IFONULL -ifcnull: - lda fcb2+1 ;get first char of 2nd file name - cpi ' ' ;space = null - jrz ifctrue - jr ifcfalse - ENDIF ;IFONULL - -; -; Condition: TCAP -; - IF IFOTCAP -ifctcap: - lda z3env+80H ;get first char of Z3 TCAP Entry - cpi ' '+1 ;space or less = none - jrc ifcfalse - jr ifctrue - ENDIF ;IFOTCAP - -; -; Condition: WHEEL -; - IF IFOWHEEL -ifcwheel: - lhld z3env+29h ;get address of wheel byte - mov a,m ;get byte - ora a ;test for true - jrz ifcfalse ;FALSE if 0 - jr ifctrue - ENDIF ;IFOWHEEL -; -; Condition: TRUE -; IFCTRUE enables an active IF -; Condition: FALSE -; IFCFALSE enables an inactive IF -; -ifctrue: -; - IF IFONEG - call negtest ;test for negate - jrz ifcf - ENDIF ;IFONEG -; -ifct: - mvi b,0ffh ;active - jmp ifset -ifcfalse: -; - IF IFONEG - call negtest ;test for negate - jrz ifct - ENDIF ;IFONEG -; -ifcf: - mvi b,0 ;inactive - jmp ifset - -; -; Condition: INPUT (from user) -; - IF IFOINPUT -ifcinput: - lxi h,z3msg+7 ;pt to ZEX message byte - mvi m,10b ;suspend ZEX input - push h ;save ptr to ZEX message byte - IF NOT NOISE - call nl - ENDIF ;NOT NOISE - call prif - call print - db 'True?',' '+80H - mvi c,1 ;input from console - call bdos - pop h ;get ptr to ZEX message byte - mvi m,0 ;return ZEX to normal processing - cpi ' ' ;yes? - jrz ifctrue - ani 5fh ;mask and capitalize user input - cpi 'T' ;true? - jrz ifctrue - cpi 'Y' ;yes? - jrz ifctrue - cpi CR ;yes? - jrz ifctrue - jr ifcfalse - ENDIF ;IFOINPUT - -; -; Condition: EXIST filename.typ -; - IF IFOEXIST -ifcex: - call tlog ;log into DU - lxi d,fcb2 ;pt to fcb - mvi c,17 ;search for first - call bdos - inr a ;set zero if error - jrz ifcfalse ;return FALSE - jr ifctrue ;return TRUE - ENDIF ;IFOEXIST - -; -; Condition: EMPTY filename.typ -; - IF IFOEMPTY -ifcempty: - call tlog ;log into FCB2's DU - lxi d,fcb2 ;pt to fcb2 - mvi c,15 ;open file - push d ;save fcb ptr - call bdos - pop d - inr a ;not found? - jrz ifctrue - mvi c,20 ;try to read a record - call bdos - ora a ;0=OK - jrnz ifctrue ;NZ if no read - jr ifcfalse - ENDIF ;IFOEMPTY - -; -; Condition: ERROR -; - IF IFOERROR -ifcerror: - lda z3msg+6 ;get error byte - ora a ;0=TRUE - jrz ifctrue - jr ifcfalse - ENDIF ;IFOERROR - -; -; **** Support Routines **** -; - -; -; Convert chars in FCB2 into a number in B -; - IF IFOREG -getnum: - mvi b,0 ;set number - lxi h,fcb2+1 ;pt to first char -getn1: - mov a,m ;get char - inx h ;pt to next - sui '0' ;convert to binary - rc ;done if error - cpi 10 ;range? - rnc ;done if out of range - mov c,a ;value in C - mov a,b ;A=old value - add a ;*2 - add a ;*4 - add b ;*5 - add a ;*10 - add c ;add in new digit value - mov b,a ;result in B - jr getn1 ;continue processing - ENDIF ;IFOREG - -; -; Log into DU in FCB2 -; - IF NOT COMIF -tlog: - lda fcb2 ;get disk - ora a ;current? - jrnz tlog1 - mvi c,25 ;get disk - call bdos - inr a ;increment for following decrement -tlog1: - dcr a ;A=0 - mov e,a ;disk in E - mvi c,14 - call bdos - lda fcb2+13 ;pt to user - mov e,a - mvi c,32 ;set user - jmp bdos -; - ENDIF ;NOT COMIF - -; -; Test of Negate Flag = negchar -; - IF IFONEG -negtest: -negflag equ $+1 ;pointer for in-the-code modification - mvi a,0 ;2nd byte is filled in - cpi negchar ;test for No - ret - ENDIF ;IFONEG - -; -; Test FCB1 against a single digit (0-9) -; Return with register value in A and NZ if so -; - IF IFOREG -regtest: - ldax d ;get digit - sui '0' - jrc zret ;Z flag for no digit - cpi 10 ;range? - jrnc zret ;Z flag for no digit - lxi h,z3msg+30H ;pt to registers - add l ;pt to register - mov l,a - mov a,h ;add in H - aci 0 - mov h,a - xra a ;set NZ - dcr a - mov a,m ;get register value - ret -zret: - xra a ;set Z - ret - ENDIF ;IFOREG - -; -; Test to see if a current IF is running and if it is FALSE -; If so, return with Zero Flag Set (Z) -; If not, return with Zero Flag Clear (NZ) -; Affect only HL and PSW -; -iftest: - lxi h,z3msg+1 ;get IF flag - mov a,m ;test for active IF - ora a - jrz ifok ;no active IF - inx h ;pt to active flag - ana m ;check active flag - rz ;return Z since IF running and FALSE -ifok: - xra a ;return NZ for OK - dcr a - ret - -; -; Test FCB1 against condition table (must have 2-char entries) -; Return with routine address in HL if match and NZ flag -; - IF NOT COMIF -condtest: - lxi h,condtab ;pt to table -condt1: - mov a,m ;end of table? - ora a - rz - ldax d ;get char - mov b,m ;get other char in B - inx h ;pt to next - inx d - cmp b ;compare entries - jrnz condt2 - ldax d ;get 2nd char - cmp m ;compare - jrnz condt2 - inx h ;pt to address - mov a,m ;get address in HL - inx h - mov h,m - mov l,a ;HL = address - xra a ;set NZ for OK - dcr a - ret -condt2: - lxi b,3 ;pt to next entry - dad b ; ... 1 byte for text + 2 bytes for address - dcx d ;pt to 1st char of condition - jr condt1 -; - ENDIF ;NOT COMIF -; -; Turn on next IF level -; B register is 0 if level is inactive, 0FFH is level is active -; Return with Z flag set if OK -; -ifset: - lxi h,z3msg+1 ;get IF flag - mov a,m - ora a ;if no if at all, start 1st one - jrz ifset1 - cpi 80h ;check for overflow (8 IFs max) - jrz iferr - inx h ;pt to active IF byte - ana m ;check to see if current IF is TRUE - jrnz ifset0 ;if TRUE, proceed - mvi b,0 ;set False IF -ifset0: - dcx h ;pt to IF level - mov a,m ;get it - rlc ;advance to next level - ani 0feh ;only 1 bit on - mov m,a ;set IF byte - jr ifset2 -ifset1: - inr a ;A=1 - mov m,a ;set 1st IF - inx h ;clear active IF byte - mvi m,0 - dcx h -ifset2: - mov d,a ;get IF byte - ana b ;set interested bit - mov b,a - inx h ;pt to active flag - mov a,d ;complement IF byte - cma - mov d,a - mov a,m ;get active byte - ana d ;mask in only uninterested bits - ora b ;mask in complement of interested bit - mov m,a ;save result - call ifstat ;print status - xra a ;return with Z - ret -iferr: - call print ;beep to indicate overflow - db bell+80H - xra a ;set NZ - dcr a - ret - -; -; Test for Size Error -; - if ($ GT (FCP + FCPS*128)) -sizerr equ novalue ;FCP is too large for buffer - endif - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSFCP1.LIB b/Source/Images/d_bp/u15/SYSFCP1.LIB deleted file mode 100644 index 44404f27..00000000 --- a/Source/Images/d_bp/u15/SYSFCP1.LIB +++ /dev/null @@ -1,214 +0,0 @@ -; SYSTEM SEGMENT: SYS1.FCP -; SYSTEM: ZCPR3 -; CUSTOMIZED BY: RICHARD CONN - -; -; PROGRAM HEADER: SYSFCP.LIB -; AUTHOR: RICHARD CONN -; - -; -; This program header defines the IF Conditions to be placed -; into the target SYS.FCP file (generated by assembling SYSFCP.ASM). -; - -; -; 1. IF NEGATION -; -; The following equate determines if leading negation is to be -; allowed. If this equate is TRUE, then forms like the following are -; permitted: -; IF ~EXIST filename.typ -; -; meaning to complement the meaning of the test (the above returns TRUE -; if filename.typ does NOT exist). -; -IFONEG EQU TRUE - -; -; Assuming IFONEG to be TRUE, the following equate defines the -; character to be placed in front of the IF option to indicate that -; negation is to be performed. In the above example, this character -; was tilde (~). -; -NEGCHAR EQU '~' - - -; -; 2. IF: T (TRUE) or F (FALSE) -; -; Setting the following equate to TRUE enables the simple T and F -; options to IF. The format of this option is: -; -; IF T or IF F -; -; and it always returns TRUE or FALSE, resp. -; -IFOTRUE EQU FALSE - - -; -; 3. IF: EM (EMPTY) -; -; Setting the following equate to TRUE enables IF to test to see if -; the indicated file is empty or not. The format of this option is: -; -; IF EM dir:filename.typ -; -; and it returns TRUE if the indicated file does not exist or is empty. -; -IFOEMPTY EQU FALSE - - -; -; 4. IF: ER (ERROR) -; -; Setting the following equate to TRUE enables IF to test the error -; code byte (program error code byte). If this byte is 0 (no error), it -; returns TRUE, else it returns FALSE. The format of this option is: -; -; IF ER -; -IFOERROR EQU TRUE - - -; -; 5. IF: EX (EXIST) -; -; Setting the following equate to TRUE enables IF to test for the -; existence of a file. The format of this option is: -; -; IF EX dir:filename.typ -; -; and it returns TRUE if the indicated file exists. -; -IFOEXIST EQU TRUE - - -; -; 6. IF: IN (INPUT) -; -; Setting the following equate to TRUE enables user input of the -; character T (or any other character for FALSE). ZEX processing is -; suspended for this single-character input. The format of this option is: -; -; IF IN -; -; and the IF FCP command responds with: -; -; IF True? -; -; to which the user types T, Y, SPACE, or CR to set the IF to TRUE and -; anything else to set the IF to FALSE. -; -IFOINPUT EQU TRUE - - -; -; 7. IF: NU (NULL) -; -; Setting the following equate to TRUE enables IF to test to see if -; the second argument which follows is NULL (not specified) or not. This -; test is particularly useful in command file processing to see if, for -; example, argument $2 exists and to include it if it does. The format of -; this option is: -; -; IF NU -; or: -; IF NU arg -; -; If the first format is encountered, IF NU returns TRUE; IF NU returns -; FALSE with the second format. -; -IFONULL EQU TRUE - - -; -; 8. IF: n (Register Value) -; -; Setting the following equate to TRUE enables IF to test to see if -; the indicated register contains the indicated value. If this is preceeded -; by the NEGCHAR and IFONEG is TRUE, then this tests to see if the indicated -; register does not contain the indicated value. Registers are one-byte -; memory buffers, and are identified by the digits 0 to 9. The format of -; this option is: -; -; IF n val -; -; Example: -; IF 0 -- if Reg 0 = 0 -; IF 0 5 -- if Reg 0 = 5 -; IF 5 2 -- if Reg 5 = 2 -; IF ~0 -- if Reg 0 <> 0 -; IF ~9 2 -- if Reg 9 <> 2 -; -IFOREG EQU TRUE - - -; -; 9. IF: WH (WHEEL) -; -; Setting the following equate to TRUE enables IF to test to see if -; the Wheel Byte is set or not. If so, IF WHEEL is TRUE. -; -IFOWHEEL EQU FALSE - - -; -; 10. IF: TC (TCAP) -; -; Setting the following equate to TRUE enables IF to test to see if -; the ZCPR3 TCAP contains a terminal definition or not. This test is -; particularly useful in command file or alias processing to see if, for -; example, a Z3TCAP entry is defined and to invoke screen-oriented routines -; if it is. The format of this option is: -; -; IF TC -; -IFOTCAP EQU FALSE - - -; -; 11. IF: fcb1=fcb2 -; -; Setting this equate to TRUE will enable IF to evaluate the -; equality condition, checking to see if the two FCBs contain the same -; values. If so, the IF is TRUE; if not, the IF is FALSE. -; -; Enabling this equate eliminates the need for the NULL test, since -; a NULL test can be performed by using the syntax: -; IF fcb1= -; -IFOEQ EQU TRUE - - -; -; 12. COMIF - Run IF.COM Instead of FCP-Internal Processing -; -; Setting this equate to TRUE will cause an IF executed during an -; IF TRUE or NO IF state to look in the ROOT directory (base of path -; starting in current directory) for the file IF.COM, and, if found, -; load IF.COM and transfer control to it. If IF.COM is not found, then -; IF F is raised. Using IF.COM provides much more power and flexibility -; but also requires IF.COM to be present and takes up disk space. -; -COMIF EQU FALSE - - -; -; 13. NOISE - Have FCP Print IF Status Messages -; -; Setting this equate to TRUE will cause any change in the IF -; status to be printed to the user. This is useful for debugging purposes, -; but in normal runs, particularly where ALIASes are concerned, it is -; usually desirable to reduce the "noise" as much as possible and have -; this equate set to FALSE. -; -NOISE EQU FALSE - - -; -; END of SYSFCP CUSTOMIZATION -; - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSFCP11.LBR b/Source/Images/d_bp/u15/SYSFCP11.LBR deleted file mode 100644 index 1ad01d8d..00000000 Binary files a/Source/Images/d_bp/u15/SYSFCP11.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/SYSFCP2.LIB b/Source/Images/d_bp/u15/SYSFCP2.LIB deleted file mode 100644 index 5222424b..00000000 --- a/Source/Images/d_bp/u15/SYSFCP2.LIB +++ /dev/null @@ -1,214 +0,0 @@ -; SYSTEM SEGMENT: SYS2.FCP -; SYSTEM: ZCPR3 -; CUSTOMIZED BY: RICHARD CONN - -; -; PROGRAM HEADER: SYSFCP.LIB -; AUTHOR: RICHARD CONN -; - -; -; This program header defines the IF Conditions to be placed -; into the target SYS.FCP file (generated by assembling SYSFCP.ASM). -; - -; -; 1. IF NEGATION -; -; The following equate determines if leading negation is to be -; allowed. If this equate is TRUE, then forms like the following are -; permitted: -; IF ~EXIST filename.typ -; -; meaning to complement the meaning of the test (the above returns TRUE -; if filename.typ does NOT exist). -; -IFONEG EQU FALSE - -; -; Assuming IFONEG to be TRUE, the following equate defines the -; character to be placed in front of the IF option to indicate that -; negation is to be performed. In the above example, this character -; was tilde (~). -; -NEGCHAR EQU '~' - - -; -; 2. IF: T (TRUE) or F (FALSE) -; -; Setting the following equate to TRUE enables the simple T and F -; options to IF. The format of this option is: -; -; IF T or IF F -; -; and it always returns TRUE or FALSE, resp. -; -IFOTRUE EQU FALSE - - -; -; 3. IF: EM (EMPTY) -; -; Setting the following equate to TRUE enables IF to test to see if -; the indicated file is empty or not. The format of this option is: -; -; IF EM dir:filename.typ -; -; and it returns TRUE if the indicated file does not exist or is empty. -; -IFOEMPTY EQU FALSE - - -; -; 4. IF: ER (ERROR) -; -; Setting the following equate to TRUE enables IF to test the error -; code byte (program error code byte). If this byte is 0 (no error), it -; returns TRUE, else it returns FALSE. The format of this option is: -; -; IF ER -; -IFOERROR EQU FALSE - - -; -; 5. IF: EX (EXIST) -; -; Setting the following equate to TRUE enables IF to test for the -; existence of a file. The format of this option is: -; -; IF EX dir:filename.typ -; -; and it returns TRUE if the indicated file exists. -; -IFOEXIST EQU FALSE - - -; -; 6. IF: IN (INPUT) -; -; Setting the following equate to TRUE enables user input of the -; character T (or any other character for FALSE). ZEX processing is -; suspended for this single-character input. The format of this option is: -; -; IF IN -; -; and the IF FCP command responds with: -; -; IF True? -; -; to which the user types T, Y, SPACE, or CR to set the IF to TRUE and -; anything else to set the IF to FALSE. -; -IFOINPUT EQU FALSE - - -; -; 7. IF: NU (NULL) -; -; Setting the following equate to TRUE enables IF to test to see if -; the second argument which follows is NULL (not specified) or not. This -; test is particularly useful in command file processing to see if, for -; example, argument $2 exists and to include it if it does. The format of -; this option is: -; -; IF NU -; or: -; IF NU arg -; -; If the first format is encountered, IF NU returns TRUE; IF NU returns -; FALSE with the second format. -; -IFONULL EQU FALSE - - -; -; 8. IF: n (Register Value) -; -; Setting the following equate to TRUE enables IF to test to see if -; the indicated register contains the indicated value. If this is preceeded -; by the NEGCHAR and IFONEG is TRUE, then this tests to see if the indicated -; register does not contain the indicated value. Registers are one-byte -; memory buffers, and are identified by the digits 0 to 9. The format of -; this option is: -; -; IF n val -; -; Example: -; IF 0 -- if Reg 0 = 0 -; IF 0 5 -- if Reg 0 = 5 -; IF 5 2 -- if Reg 5 = 2 -; IF ~0 -- if Reg 0 <> 0 -; IF ~9 2 -- if Reg 9 <> 2 -; -IFOREG EQU FALSE - - -; -; 9. IF: WH (WHEEL) -; -; Setting the following equate to TRUE enables IF to test to see if -; the Wheel Byte is set or not. If so, IF WHEEL is TRUE. -; -IFOWHEEL EQU FALSE - - -; -; 10. IF: TC (TCAP) -; -; Setting the following equate to TRUE enables IF to test to see if -; the ZCPR3 TCAP contains a terminal definition or not. This test is -; particularly useful in command file or alias processing to see if, for -; example, a Z3TCAP entry is defined and to invoke screen-oriented routines -; if it is. The format of this option is: -; -; IF TC -; -IFOTCAP EQU FALSE - - -; -; 11. IF: fcb1=fcb2 -; -; Setting this equate to TRUE will enable IF to evaluate the -; equality condition, checking to see if the two FCBs contain the same -; values. If so, the IF is TRUE; if not, the IF is FALSE. -; -; Enabling this equate eliminates the need for the NULL test, since -; a NULL test can be performed by using the syntax: -; IF fcb1= -; -IFOEQ EQU FALSE - - -; -; 12. COMIF - Run IF.COM Instead of FCP-Internal Processing -; -; Setting this equate to TRUE will cause an IF executed during an -; IF TRUE or NO IF state to look in the ROOT directory (base of path -; starting in current directory) for the file IF.COM, and, if found, -; load IF.COM and transfer control to it. If IF.COM is not found, then -; IF F is raised. Using IF.COM provides much more power and flexibility -; but also requires IF.COM to be present and takes up disk space. -; -COMIF EQU TRUE - - -; -; 13. NOISE - Have FCP Print IF Status Messages -; -; Setting this equate to TRUE will cause any change in the IF -; status to be printed to the user. This is useful for debugging purposes, -; but in normal runs, particularly where ALIASes are concerned, it is -; usually desirable to reduce the "noise" as much as possible and have -; this equate set to FALSE. -; -NOISE EQU FALSE - - -; -; END of SYSFCP CUSTOMIZATION -; - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSIOP.AQM b/Source/Images/d_bp/u15/SYSIOP.AQM deleted file mode 100644 index 6a173a0b..00000000 Binary files a/Source/Images/d_bp/u15/SYSIOP.AQM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SYSIOP.ASM b/Source/Images/d_bp/u15/SYSIOP.ASM deleted file mode 100644 index 9b75a587..00000000 --- a/Source/Images/d_bp/u15/SYSIOP.ASM +++ /dev/null @@ -1,1221 +0,0 @@ -* SYSTEM SEGMENT: SYSTEM.IOP -* SYSTEM: ARIES-1 -* CUSTOMIZED BY: RICHARD CONN - -* PROGRAM: SYSIOP.ASM -* AUTHOR: RICHARD CONN -* VERSION: 1.0 -* DATE: 22 FEB 84 -* PREVIOUS VERSIONS: NONE - -*---- Customize Section ----* -* Customization Performed Throughout Code -*---- End of Customize Section ----* - -***************************************************************** -* * -* SYSIO -- Standard Set of Redirectable I/O Drivers * -* for ZCPR2 configured for Richard Conn's ARIES-1 System * -* * -* Feb 2, 1984 * -* * -* Note on Assembly: * -* This device driver package is to be assembled by MAC * -* (because of the macros) and configured into a file of type * -* IO by loading it at 100H via DDT or SID/ZSID and saving the * -* result as a COM file. Care should be taken to ensure that * -* the package is not larger than the device driver area which * -* is reserved for it in memory. * -* * -***************************************************************** - - MACLIB Z3BASE ; Get Addresses - -IOBYTE equ 3 ;I/O BYTE -INTIOBY equ 100$1$1$000B ;Initial I/O Byte Value - ; LST:=TTY - ; RDR:, PUN:=Clock - ; CON:=CRT - -***************************************************************** -* * -* Disk Serial, MPU Serial, Quad I/O, and Modem Equates * -* * -***************************************************************** - -; Disk Serial -- Serial Channel on Disk Controller Board (DCE) -; Baud Rate is set at 19,200 Baud in Hardware (DIP Switches) -ustat equ djeprom+3F9H ;USART Status Address -ostat equ 8 ;Output Status Bit (TBE) -istat equ 4 ;Input Status Bit (RDA) - -; MPU Serial -- Serial Channel on CCS Z80 MPU Board (DCE) -mpubase equ 20H ;Base address of 8250 on CCS Z80 MPU Board -mpudata equ mpubase ;Data I/O Registers -mpudll equ mpubase ;Divisor Latch Low -mpudlh equ mpubase+1 ;Divisor Latch High -mpuier equ mpubase+1 ;Interrupt Enable Register -mpulcr equ mpubase+3 ;Line Control Register -mpupcr equ mpubase+4 ;Peripheral Control Register -mpustat equ mpubase+5 ;Line Status Register -mpupsr equ mpubase+6 ;Peripheral Status Register - -; MPU Serial RDA and TBE -mpurda equ 1 ; Data Available Bit (RDA) -mputbe equ 20h ; Transmit Buffer Empty Bit (TBE) - -; MPU Serial Baud Rate Values -bm00050 equ 2304 ; 50 Baud -bm00075 equ 1536 ; 75 Baud -bm00110 equ 1047 ; 110 Baud -bm00134 equ 857 ; 134.5 Baud -bm00150 equ 768 ; 150 Baud -bm00300 equ 384 ; 300 Baud -bm00600 equ 192 ; 600 Baud -bm01200 equ 96 ; 1200 Baud -bm01800 equ 64 ; 1800 Baud -bm02000 equ 58 ; 2000 Baud -bm02400 equ 48 ; 2400 Baud -bm03600 equ 32 ; 3600 Baud -bm04800 equ 24 ; 4800 Baud -bm07200 equ 16 ; 7200 Baud -bm09600 equ 12 ; 9600 Baud -bm19200 equ 6 ; 19200 Baud -bm38400 equ 3 ; 38400 Baud -bm56000 equ 2 ; 56000 Baud - -; MPU Serial Channel Baud Rate -mpbrate equ bm09600 ; 9600 Baud for TTY - -; Quad I/O Ports -qbase equ 80h ; Base address of Quad RS-232 I/O Board -q0data equ qbase ; USART 0 Data Port (DTE) -q0stat equ qbase+1 ; USART 0 Status Port -q1data equ qbase+2 ; USART 1 Data Port (DTE) -q1stat equ qbase+3 ; USART 1 Status Port -q2data equ qbase+4 ; USART 2 Data Port (DTE) -q2stat equ qbase+5 ; USART 2 Status Port -q3data equ qbase+6 ; USART 3 Data Port (DCE) -q3stat equ qbase+7 ; USART 3 Status Port -q0baud equ qbase+8 ; USART 0 Baud Rate Port -q1baud equ qbase+9 ; USART 1 Baud Rate Port -q2baud equ qbase+10 ; USART 2 Baud Rate Port -q3baud equ qbase+11 ; USART 3 Baud Rate Port - -; Quad I/O RDA and TBE -qrda equ 2 ; Read Data Available Bit (RDA) -qtbe equ 1 ; Transmit Buffer Empty Bit (TBE) - -************************************* -* Equate Values for PMMI as Modem * -************************************* -* Modem Ports (Special -- 300 or 600 Baud for PMMI) -*mods equ 0E0H ; Modem Status Byte -*modd equ 0E1H ; Modem Data Byte -* -* Modem RDA and TBE -*mrda equ 2 ; Read Data Available Bit (RDA) -*mtbe equ 1 ; Transmit Buffer Empty Bit (TBE) -************************************* - -; Modem Ports set to QUAD I/O Port 2 -mods equ q2stat ; Modem Status Port -modd equ q2data ; Modem Data Port - -; Modem RDA and TBE -mrda equ qrda -mtbe equ qtbe - -; Baud Rate Values -b00050 equ 0 ; 50 Baud -b00075 equ 1 ; 75 Baud -b00110 equ 2 ; 110 Baud -b00134 equ 3 ; 134.5 Baud -b00150 equ 4 ; 150 Baud -b00300 equ 5 ; 300 Baud -b00600 equ 6 ; 600 Baud -b01200 equ 7 ; 1200 Baud -b01800 equ 8 ; 1800 Baud -b02000 equ 9 ; 2000 Baud -b02400 equ 10 ; 2400 Baud -b03600 equ 11 ; 3600 Baud -b04800 equ 12 ; 4800 Baud -b07200 equ 13 ; 7200 Baud -b09600 equ 14 ; 9600 Baud -b19200 equ 15 ; 19200 Baud - - -***************************************************************** -* * -* Baud Rates for Quad I/O Devices * -* * -***************************************************************** - -q0brate equ b09600 ; 9600 Baud for Intersystem -q1brate equ b01200 ; 1200 Baud for Clock -q2brate equ b01200 ; 1200 Baud for Transmodem -q3brate equ b09600 ; 9600 Baud for NEC Printer - - -***************************************************************** -* * -* Miscellaneous Constants * -* * -***************************************************************** -XON equ 11h ;X-ON -XOFF equ 13h ;X-OFF -CTRLZ equ 'Z'-'@' ;^Z -djram equ djeprom+400h ;Base of DJ RAM -djcin equ djram+3 ;DJ Console Input -djcout equ djram+6 ;DJ Console Output - -***************************************************************** -* * -* The following are the Z80 Macro Definitions which are used to * -* define the Z80 Mnemonics used to implement the Z80 instruction* -* set extensions employed in CBIOSZ. * -* * -***************************************************************** -; -; MACROS TO PROVIDE Z80 EXTENSIONS -; MACROS INCLUDE: -; -$-MACRO ;FIRST TURN OFF THE EXPANSIONS -; -; JR - JUMP RELATIVE -; JRC - JUMP RELATIVE IF CARRY -; JRNC - JUMP RELATIVE IF NO CARRY -; JRZ - JUMP RELATIVE IF ZERO -; JRNZ - JUMP RELATIVE IF NO ZERO -; DJNZ - DECREMENT B AND JUMP RELATIVE IF NO ZERO -; LDIR - MOV @HL TO @DE FOR COUNT IN BC -; LXXD - LOAD DOUBLE REG DIRECT -; SXXD - STORE DOUBLE REG DIRECT -; -; -; -; @GENDD MACRO USED FOR CHECKING AND GENERATING -; 8-BIT JUMP RELATIVE DISPLACEMENTS -; -@GENDD MACRO ?DD ;;USED FOR CHECKING RANGE OF 8-BIT DISPLACEMENTS - IF (?DD GT 7FH) AND (?DD LT 0FF80H) - DB 100H ;Displacement Range Error on Jump Relative - ELSE - DB ?DD - ENDIF - ENDM -; -; Z80 MACRO EXTENSIONS -; -JR MACRO ?N - DB 18H - @GENDD ?N-$-1 - ENDM -; -JRC MACRO ?N - DB 38H - @GENDD ?N-$-1 - ENDM -; -JRNC MACRO ?N - DB 30H - @GENDD ?N-$-1 - ENDM -; -JRZ MACRO ?N - DB 28H - @GENDD ?N-$-1 - ENDM -; -JRNZ MACRO ?N - DB 20H - @GENDD ?N-$-1 - ENDM -; -DJNZ MACRO ?N - DB 10H - @GENDD ?N-$-1 - ENDM -; -LDIR MACRO - DB 0EDH,0B0H - ENDM -; -LDED MACRO ?N - DB 0EDH,05BH - DW ?N - ENDM -; -LBCD MACRO ?N - DB 0EDH,4BH - DW ?N - ENDM -; -SDED MACRO ?N - DB 0EDH,53H - DW ?N - ENDM -; -SBCD MACRO ?N - DB 0EDH,43H - DW ?N - ENDM -; -; END OF Z80 MACRO EXTENSIONS -; - - -***************************************************************** -* * -* Terminal driver routines. Iobyte is initialized by the cold * -* boot routine, to modify, change the "intioby" equate. The * -* I/O routines that follow all work exactly the same way. Using * -* iobyte, they obtain the address to jump to in order to execute* -* the desired function. There is a table with four entries for * -* each of the possible assignments for each device. To modify * -* the I/O routines for a different I/O configuration, just * -* change the entries in the tables. * -* * -***************************************************************** - - org iop ;Base Address of I/O Drivers -offset equ 100h-iop ;Offset for load via DDT or ZSID - - jmp status ;Internal Status Routine - jmp select ;Device Select Routine - jmp namer ;Device Name Routine - - jmp tinit ;Initialize Terminal - - jmp const ;Console Input Status - jmp conin ;Console Input Char - jmp conout ;Console Output Char - - jmp list ;List Output Char - - jmp punch ;Punch Output Char - - jmp reader ;Reader Input Char - - jmp listst ;List Output Status - - jmp newio ;New I/O Driver Installation Routine - - jmp copen ;Open CON: Disk File - jmp cclose ;Close CON: Disk File - - jmp lopen ;Open LST: Disk File - jmp lclose ;Close LST: Disk File - -* -* I/O Package Identification -* - db 'Z3IOP' ;Read by Z3LOADER - -***************************************************************** -* * -* status: return information on devices supported by this * -* I/O Package. On exit, HL points to a logical device * -* table which is structured as follows: * -* Device Count Byte Current Assignment Byte * -* ------ ---------- ----------------------- * -* CON: 0 1 * -* RDR: 2 3 * -* PUN: 4 5 * -* LST: 6 7 * -* * -* If error or no I/O support, return with Zero Flag Set. * -* Also, if no error, A=Driver Module Number * -* * -***************************************************************** -status: - lxi h,cnttbl ;point to table - mvi a,81H ;Module 1 (SYSIO) with Disk Output - ora a ;Set Flags - ret - - -***************************************************************** -* * -* select: select devices indicated by B and C. B is the number * -* of the logical device, where CON:=0, RDR:=1, PUN:=2, * -* LST:=3, and C is the desired device (range 0 to dev-1). * -* Return with Zero Flag Set if Error. * -* * -***************************************************************** -ranger: - lxi h,cnttbl-2 ;check for error - inr b ;range of 1 to 4 - mov a,b ;Value in A - cpi 5 ;B out of range? - jnc rangerr - push b ;save params -rang: - inx h ;pt to next - inx h - djnz rang - mov b,m ;get count in b - mov a,c ;get selected device number - cmp b ;compare (C must be less than B) - pop b ;get params - jrnc rangerr ;range error if C >= B -rangok: - xra a ;OK - dcr a ;set flags (0FFH and NZ) - ret -rangerr: - xra a ;not OK (Z) - ret -select: - call ranger ;check for range error - rz ;abort if error - inx h ;pt to current entry number - mov m,c ;save selected number there - lxi h,cfgtbl-2 ;pt to configuration table -sel2: - inx h ;Pt to Entry in Configuration Table - inx h - djnz sel2 - mov b,m ;Get Rotate Count - inx h ;Pt to Select Mask - mov d,m ;Get Select Mask - mov a,b ;Any Rotation to do? - ora a - jz sel4 - mov a,c ;Get Selected Number -sel3: - rlc ;Rotate Left 1 Bit - djnz sel3 - mov c,a ;Place Bit Pattern Back in C -sel4: - lda iobyte ;get I/O byte - ana d ;mask out old selection - ora c ;mask in new selection - sta iobyte ;put I/O byte - jr rangok ;range OK - -***************************************************************** -* * -* namer: return text string of physical device. Logical device * -* number is in B and physical selection is in C. * -* HL is returned pointing to the first character of the * -* string. The strings are structured to begin with a * -* device name followed by a space and then a description * -* string which is terminated by a binary 0. * -* * -* Return with Zero Flag Set if error. * -* * -***************************************************************** -namer: - call ranger ;check for range error - rz ;return if so - lxi h,namptbl-2 ;pt to name ptr table - call namsel ;select ptr table entry - mov b,c ;physical selection number in B now - inr b ;Add 1 for Initial Increment - call namsel ;point to string - jr rangok ;return with HL pointing and range OK -; -; Select entry B in table pted to by HL; this entry is itself a pointer, -; and return with it in HL -; -namsel: - inx h ;pt to next entry - inx h - djnz namsel - mov a,m ;get low - inx h - mov h,m ;get high - mov l,a ;HL now points to entry - ret - -***************************************************************** -* * -* const: get the status for the currently assigned console. * -* The I/O Byte is used to select the device. * -* * -***************************************************************** -const: - lxi h,cstble ;Beginning of jump table -conmask: - lxi d,cfgtbl ;Pt to First Entry in Config Table - jr seldev ;Select correct jump - -***************************************************************** -* * -* conin: input a character from the currently assigned console. * -* The I/O Byte is used to select the device. * -* * -***************************************************************** -conin: - lxi h,citble ;Beginning of character input table - jr conmask ;Get Console Mask - -***************************************************************** -* * -* conout: output the character in C to the currently assigned * -* console. The I/O Byte is used to select the device. * -* * -***************************************************************** -conout: - lxi h,cotble ;Beginning of the character out table - call crout ;output to console recorder if set - jr conmask ;Get Console Mask - -***************************************************************** -* * -* csreader: get the status of the currently assigned reader. * -* The I/O Byte is used to select the device. * -* * -***************************************************************** -csreadr: - lxi h,csrtble ;Beginning of reader status table -rdrmask: - lxi d,cfgtbl+2 ;Pt to 2nd Entry in Config Table - jr seldev - -***************************************************************** -* * -* reader: input a character from the currently assigned reader. * -* The I/O Byte is used to select the device. * -* * -***************************************************************** -reader: - lxi h,rtble ;Beginning of reader input table - jr rdrmask ;Get the Mask and Go - -***************************************************************** -* * -* Entry at seldev will form an offset into the table pointed * -* to by H&L and then pick up the address and jump there. * -* The configuration of the physical device assignments is * -* pointed to by D&E (cfgtbl entry). * -* * -***************************************************************** -seldev: - push b ;Save Possible Char in C - ldax d ;Get Rotate Count - mov b,a ;... in B - inx d ;Pt to Mask - ldax d ;Get Mask - cma ;Flip Bits - mov c,a ;... in C - lda iobyte ;Get I/O Byte - ana c ;Mask Out Selection - inr b ;Increment Rotate Count -seld1: - dcr b ;Count down - jrz seld2 - rrc ;Rotate Right one Bit - jr seld1 -seld2: - rlc ;Double Number for Table Offset - mvi d,0 ;Form offset - mov e,a - dad d ;Add offset - mov a,m ;Pick up low byte - inx h - mov h,m ;Pick up high byte - mov l,a ;Form address - pop b ;Get Possible Char in C - pchl ;Go there ! - -***************************************************************** -* * -* punch: output char in C to the currently assigned punch * -* device. The I/O Byte is used to select the device. * -* * -***************************************************************** -punch: - lxi h,ptble ;Beginning of punch table - lxi d,cfgtbl+4 ;Get Mask - jr seldev ;Select Device and Go - -***************************************************************** -* * -* list: output char in C to the currently assigned list device. * -* The I/O Byte is used to select the device. * -* * -***************************************************************** -list: - lxi h,ltble ;Beginning of the list device routines - call lrout ;output to list recorder if set -lstmask: - lxi d,cfgtbl+6 ;Get Mask - jr seldev ;Select Device and Go - -***************************************************************** -* * -* Listst: get the output status of the currently assigned list * -* device. The I/O Byte is used to select the device. * -* * -***************************************************************** -listst: - lxi h,lstble ;Beginning of the list device status - jr lstmask ;Mask and Go - -***************************************************************** -* * -* If customizing I/O routines is being performed, the tables * -* below should be modified to reflect the changes. All I/O * -* devices are decoded out of iobyte and the jump is taken from * -* the following tables. * -* * -***************************************************************** - -***************************************************************** -* * -* I/O Driver Support Specification Tables * -* * -***************************************************************** - -* -* Device Counts -* First Byte is Number of Devices, 2nd Byte is Selected Device -* -cnttbl: - db 6,(intioby AND 7) ;CON: - db 2,(intioby AND 08h) SHR 3 ;RDR: - db 2,(intioby AND 10h) SHR 4 ;PUN: - db 6,(intioby AND 0E0h) SHR 5 ;LST: - -* -* Configuration Table -* First Byte is Rotate Count, 2nd Byte is Mask -* -cfgtbl: - db 0,111$1$1$000b ;No Rotate, Mask Out 3 LSB - db 3,111$1$0$111b ;3 Rotates, Mask Out Bit 3 - db 4,111$0$1$111b ;4 Rotates, Mask Out Bit 4 - db 5,000$1$1$111b ;5 Rotates, Mask Out 3 MSB - -* -* name text tables -* -namptbl: - dw conname-2 ;CON: - dw rdrname-2 ;RDR: - dw punname-2 ;PUN: - dw lstname-2 ;LST: - -conname: - dw namcrt ;CRT - dw namusr ;CRT and Modem in Parallel - dw namusr1 ;CRT Input and CRT/Remote Computer Output - dw namusr2 ;CRT Input and CRT/Modem Output - dw namcrtt ;CRT Input and CRT/TTY Printer Output - dw namcrtn ;CRT Input and CRT/NEC Printer Output - -lstname: - dw namtty ;TTY - dw namcrt ;CRT - dw namrem ;Remote Computer - dw nammod ;Modem - dw nammpu ;MPU - dw nammpu8 ;MPU with 8 Bits - -rdrname: - dw nammod ;Modem - dw namclk ;Clock - -punname: - dw nammod ;Modem - dw namclk ;Clock - -nammpu: - db 'TTY Toshiba P1350 Printer',0 -nammpu8: - db 'TTY8 TTY with 8th Sig Bit',0 -namtty: - db 'NEC NEC 3510 LQ Printer',0 -namcrt: - db 'CRT TVI 950 CRT',0 -namcrtn: - db 'CRTNEC CRT Input and CRT/NEC Printer Output',0 -namcrtt: - db 'CRTTY CRT Input and CRT/TTY Printer Output',0 -namusr: - db 'CRTMOD CRT and Modem in Parallel',0 -namusr1: - db 'CRTREM CRT Input and CRT/Remote Output',0 -namusr2: - db 'CRTMOD2 CRT Input and CRT/Modem Output',0 -namrem: - db 'REMOTE Remote Computer',0 -nammod: - db 'MODEM Transmodem 1200',0 -namclk: - db 'CLOCK DC Hayes Chronograph',0 - -* -* console input table -* -citble: - dw cicrt ;Input from crt (000) - dw ciusr ;Input from crt and modem (001) - dw cicrt ;Input from crt (010) - dw cicrt ;Input from crt (011) - dw cicrt ;Input from crt (100) - dw cicrt ;Input from crt (101) - -* -* console output table -* -cotble: - dw cocrt ;Output to crt (000) - dw cousr ;Output to crt and modem (001) - dw cousr1 ;Output to crt and remote system (010) - dw cousr ;Output to crt and modem (011) - dw cocrtt ;Output to crt and TTY printer (100) - dw cocrtn ;Output to crt and NEC printer (101) - -* -* list device table -* -ltble: - dw cotty ;Output to tty (000) - dw cocrt ;Output to crt (001) - dw corem ;Output to remote system (010) - dw comod ;Output to modem (011) - dw compu ;Output to mpu (100) - dw compu8 ;Output to mpu (101) - -* -* punch device table -* - -ptble: - dw comod ;Output to modem (0) - dw coclk ;Output to clock (1) - -* -* reader device table -* -rtble: - dw cimod ;Input from modem (0) - dw ciclk ;Input from clock (1) - -* -* console status table -* -cstble: - dw cscrt ;Status from crt (000) - dw csusr ;Status from crt and modem (001) - dw cscrt ;Status from crt (010) - dw cscrt ;Status from crt (011) - dw cscrt ;Status from crt (100) - dw cscrt ;Status from crt (101) - -* -* status from reader device -* -csrtble: - dw csmod ;Status from modem (0) - dw csclk ;Status from clock (1) - -* -* Status from list device -* -lstble: - dw costty ;Status from tty (000) - dw coscrt ;Status from crt (001) - dw cosrem ;Status from remote system (010) - dw cosmod ;Status from modem (011) - dw cosmpu ;Status from mpu (100) - dw cosmpu ;Status from mpu (101) - - -***************************************************************** -* * -* Tinit can be modified for different I/O setups. * -* * -***************************************************************** -tinit: ;Initialize the terminal routine - -; Initialize I/O Byte - mvi a,intioby ;Initialize IOBYTE - sta iobyte - -; Initialize MPU Serial I/O Channel Characteristics and Baud Rate - mvi a,10$00$00$11b ;Access Divisor: - ; 10 -- Set divisor latch, clear break - ; 00 -- 0 parity bit, odd parity (N/A) - ; 00 -- disable parity, 1 stop bit - ; 11 -- 8 Data Bits - out mpulcr ;To Line Control Register - lxi h,mpbrate ;HL = MPU Channel Baud Rate - mov a,l ;Set Low-Byte of Baud Rate - out mpudll ;To Divisor Latch Low - mov a,h ;Set High-Byte of Baud Rate - out mpudlh ;To Divisor Latch High - mvi a,00$00$00$11b ;Reset Divisor Access and Set Characteristics: - ; 00 -- Clear divisor latch, clear break - ; 00 -- 0 parity bit, odd parity (N/A) - ; 00 -- disable parity, 1 stop bit - ; 11 -- 8 Data Bits - out mpulcr ;To Line Control Register - xra a ;A=0 - out mpuier ;Disable All Interrupts in Interrupt Register - out mpustat ;Clear All Error Flags in Line Status Register - mvi a,0000$1111b ;3 Zeroes, No Loop, 1, Set RLSD, CTS, DSR - out mpupcr ;To Peripheral Control Register - -; Initialize Quad I/O Channel Characteristics - mvi a,10$11$01$11b ;General-Purpose Reset: - ; 10 -- 1 1/2 Stop Bits - ; 11 -- Even Parity, Enable Parity - ; 01 -- 6 Bits/Char - ; 11 -- 64x Baud Rate - call setquad ;Set All 4 Quad I/O Ports - mvi a,01$11$01$11b ;General-Purpose Reset: - ; 01 -- Disable Hunt, Internal Reset - ; 11 -- RTS High, Error Reset - ; 01 -- No Break, Enable RxRDY - ; 11 -- NOT DTR High, Enable TxEN - call setquad ;Set All 4 Quad I/O Ports - mvi a,11$00$11$10b ;Characteristics Set for All: - ; 11 -- 2 Stop Bits - ; 00 -- No Parity - ; 11 -- 8 Bits/Char - ; 10 -- 16x Baud Rate - call setquad ;Set All 4 Quad I/O Ports - mvi a,00$11$01$11b ;Characteristics Set for All: - ; 00 -- Disable Hunt, No Internal Reset - ; 11 -- RTS High, Error Reset - ; 01 -- No Break, Enable RxRDY - ; 11 -- NOT DTR High, Enable TxEN - call setquad ;Set All 4 Quad I/O Ports - -; Initialize Quad I/O Baud Rates - mvi a,q0brate ;Set USART 0 Baud Rate - out q0baud - mvi a,q1brate ;Set USART 1 Baud Rate - out q1baud - mvi a,q2brate ;Set USART 2 Baud Rate - out q2baud - mvi a,q3brate ;Set USART 3 Baud Rate - out q3baud - -; Set All Recording OFF - xra a ;A=0 - sta crecord ;console - sta lrecord ;list device - -; Clear Garbage Char from CRT - call cscrt ;Gobble up unwanted char - ora a ;A=0 if none - cnz cicrt ;Grab character - ret - -; Set All Quad I/O Control Ports -setquad: - out q0stat ;USART 0 - out q1stat ;USART 1 - out q2stat ;USART 2 - out q3stat ;USART 3 - xthl ;Long Delay - xthl - ret - - -***************************************************************** -* * -* NEWIO -- Set UC1: Device to the Device Drivers whose Jump * -* Table is Pointed to by HL * -* * -* This Jump Table is structured as follows: * -* JMP ISTAT <-- Input Status (0=No Char, 0FFH=Char) * -* JMP INPUT <-- Input Character * -* JMP OUTPUT <-- Output Character in C * -* * -* The Base Address of this Jump Table (JBASE) is passed to * -* NEWIO in the HL Register Pair. * -* * -***************************************************************** -newio: - shld cstble+6 ;Set UC1: Input Status - lxi d,3 ;Prepare for offset to next jump - dad d ;HL points to next jump - shld citble+6 ;Set UC1: Input Character - dad d ;HL points to next jump - shld cotble+6 ;Set UC1: Output Character - ret - - -***************************************************************** -* * -* Input Status, Input Character, and Output Character * -* Subroutines for CP/M * -* * -***************************************************************** -* * -* Input Status -- * -* These routines return 0 in the A Register if no input * -* data is available, 0FFH if input data is available. * -* * -* Input Character -- * -* These routines return the character (byte) in the A * -* Register. MSB is masked off. * -* * -* Output Character -- * -* These routines output the character (byte) in the C * -* Register. * -* * -***************************************************************** - -***************************************************************** -* * -* CRT Input Status, Input Character, and Output Character * -* * -***************************************************************** - -cscrt equ $ ;CRT Input Status - lda ustat ;Get Status - cma ;Inverted Logic - ani istat ;Mask for input status and fall thru to 'STAT' - jr stat ;Set Flags - -coscrt equ $ ;CRT Output Status - lda ustat ;Get USART status - cma ;Inverted Logic - ani ostat ;Mask for output status - jr stat ;Return - -cicrt equ $ ;CRT Input - jmp djcin ;Get char - -cocrt equ $ ;CRT Output - jmp djcout ;Put char - -cocrtt equ $ ;CRT and TTY Printer Output - push b ;Save char - call djcout ;CRT Output - pop b ;Get char - jmp compu ;Printer Output - -cocrtn equ $ ;CRT and NEC Printer Output - push b ;Save char - call djcout ;CRT Output - pop b ;Get char - jmp cotty ;Printer Output - -***************************************************************** -* * -* Modem Input Status, Input Character, and Output Character * -* * -***************************************************************** - -csmod equ $ ;Modem Input Status - in mods - ani mrda ;Data available? - jr stat - -cosmod equ $ ;Modem Output Status - in mods ;Get status - ani mtbe ;TBE? - jr stat - -cimod equ $ ;Modem Input Character - call csmod ;RDA? - jrz cimod - in modd ;Get data - ani 7fh ;Mask - ret - -comod equ $ ;Modem Output - call cosmod ;TBE? - jrz comod - mov a,c ;Get char - out modd ;Put data - ret - -***************************************************************** -* * -* Clock Input Status, Input Character, and Output Character * -* * -***************************************************************** - -csclk equ $ ;TTY Input Status - in q1stat ;Get Status - ani qrda ;Data available? - jr stat - -cosclk equ $ ;TTY Output Status - in q1stat ;Get Status - ani qtbe ;TBE? - jr stat - -ciclk equ $ ;TTY Input Character - call csclk ;RDA? - jrz ciclk - in q1data ;Get data - ani 7fh ;Mask - ret - -coclk equ $ ;TTY Output Character - call cosclk ;TBE? - jrz coclk - mov a,c ;Get data - out q1data ;Put data - ret - -***************************************************************** -* * -* This is a common return point to correctly set the return * -* status flags; it is centrally located for the jump * -* relative instructions * -* * -***************************************************************** -stat: - rz ;Nothing found -ready: - mvi a,0ffh ;Set A for negative status - ret - -***************************************************************** -* * -* NEC Input Status, Input Character, and Output Character * -* X-OFF Processing Added * -* * -***************************************************************** - -cstty equ $ ;TTY Input Status - in q3stat ;Get Status - ani qrda ;Data available? - jr stat - -costty equ $ ;TTY Output Status - in q3stat ;Get Status - ani qtbe ;TBE? - jr stat - -citty equ $ ;TTY Input Character - call cstty ;RDA? - jrz citty - in q3data ;Get data - ani 7fh ;Mask - ret - -cotty equ $ ;TTY Output Character - call cstty ;Any character? - jrnz cotty2 ;Process if so -cotty1: - call costty ;TBE? - jrz cotty1 - mov a,c ;Get data - out q3data ;Put data - ret -cotty2: - call citty ;X-OFF? - cpi XOFF ;Do nothing if not X-OFF - jrnz cotty1 - call citty ;Wait for next char - jr cotty1 - -***************************************************************** -* * -* Remote System Input Status, Input Character, and Output * -* Character * -* * -***************************************************************** - -csrem equ $ ;TTY Input Status - in q0stat ;Get Status - ani qrda ;Data available? - jr stat - -cosrem equ $ ;TTY Output Status - in q0stat ;Get Status - ani qtbe ;TBE? - jr stat - -cirem equ $ ;TTY Input Character - call csrem ;RDA? - jrz cirem - in q0data ;Get data - ani 7fh ;Mask - ret - -corem equ $ ;TTY Output Character - call coxoff ;Check for XOFF and process - call cosrem ;TBE? - jrz corem - mov a,c ;Get data - out q0data ;Put data - ret - -coxoff equ $ ;Remote XOFF Check and Processing - call csrem ;Input Char from LST: Device? - rz ;Zero if none - call cirem ;Get Char - cpi XOFF ;XOFF? - rnz ;Return if not - call cirem ;Wait for Any Other Char - ret - -***************************************************************** -* * -* TTY Input Status, Input Character, and Output Character * -* X-OFF Processing Added * -* * -***************************************************************** - -csmpu equ $ ;TTY Input Status - in mpustat ;Get Status - ani mpurda ;Data available? - jr stat - -cosmpu equ $ ;TTY Output Status - in mpustat ;Get Status - ani mputbe ;TBE? - jr stat - -cimpu equ $ ;TTY Input Character - call csmpu ;RDA? - jrz cimpu - in mpudata ;Get data - ani 7fh ;Mask - ret - -compu8 equ $ ;TTY Output Character (8 Sig Bits) - mvi a,0ffh ;8th Bit Allowed - jr compu0 -compu equ $ ;TTY Output Character - mvi a,07fh ;No 8th Bit -compu0: - sta mpumask - call csmpu ;Any character? - jrnz compu2 ;Process if so -compu1: - call cosmpu ;TBE? - jrz compu1 - mov a,c ;Get data - ani 0ffh ;Mask -mpumask equ $-1 ;Address of Mask - out mpudata ;Put data - ret -compu2: - call cimpu ;X-OFF? - cpi XOFF ;Do nothing if not X-OFF - jrnz compu1 - call cimpu ;Wait for next char - jr compu1 - -***************************************************************** -* * -* User-Defined (CRT and Modem) Input Status, Input Character, * -* and Output Character * -* * -***************************************************************** - -csusr equ $ ;User (CRT and Modem) Input Status - call cscrt ;Input from CRT? - rnz ;Char found - call csmod ;Input from Modem? - ret - -cosusr equ cosmod ;Output status same as modem since modem is slower - -ciusr equ $ ;Modem/CRT Input Combination - call cscrt ;Input from CRT? - jnz cicrt ;Get char from CRT - call csmod ;Input from Modem? - jnz cimod ;Get char from Modem - jr ciusr ;Continue - -cousr equ $ ;Modem/CRT Output Combination - call comod ;Output to Modem - jmp cocrt ;Output to CRT - -ciusr1 equ $ ;Modem/CRT Input w/CRT Output Combination - call ciusr ;Get char - push psw ;Save char in A - mov c,a ;Char in C - call cocrt ;Output to CRT - pop psw ;Restore char in A - ret - -cousr1 equ $ ;Remote System/CRT Output Combination - call corem ;Output to Remote System - jmp cocrt ;Output to CRT - -***************************************************************** -* * -* Record Output Routines * -* CROUT - Console Recorder * -* LROUT - List Recorder * -* * -***************************************************************** - -crout equ $ - lda crecord ;get flag - ora a ;test flag for 0 (no recording) - rz - mov a,c ;check char - ani 7fh - cpi ctrlz ;don't allow ^Z - rz - jmp corem ;remote output if flag set - -lrout equ $ - lda lrecord ;get flag - ora a ;test flag for 0 (no recording) - rz - mov a,c ;check char - ani 7fh - cpi ctrlz ;don't allow ^Z - rz - jmp corem ;remote output if flag set - -; -; COPEN -- Open Console File for Output -; LOPEN -- Open Printer File for Output -; -; Turn Appropriate Flag ON -; -copen: - mvi a,0ffh ;set flag - jr ccrset -lopen: - mvi a,0ffh ;set flag - jr lcrset - -; -; Close Disk Files -; CCLOSE -- CON file (DSK1) -; LCLOSE -- LST file (DSK2) -; -; Send ^Z to Terminate File Recording and Zero Appropriate Flag -; -cclose: - mvi c,ctrlz ;send ctrlz - call corem - xra a -ccrset: - sta crecord ;set flag off - ret -lclose: - mvi c,ctrlz ;send ctrlz - call corem - xra a -lcrset: - sta lrecord ;set flag off - ret - -; -; Recording Buffers -; -crecord: - ds 1 ;console device -lrecord: - ds 1 ;list device - -; -; Test for Size Error -; - if ($ GT (IOP + IOPS*128)) -sizerr equ novalue ;IOP is too large for buffer - endif - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSNDR.AQM b/Source/Images/d_bp/u15/SYSNDR.AQM deleted file mode 100644 index b7a400eb..00000000 Binary files a/Source/Images/d_bp/u15/SYSNDR.AQM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SYSNDR.ASM b/Source/Images/d_bp/u15/SYSNDR.ASM deleted file mode 100644 index b39ef361..00000000 --- a/Source/Images/d_bp/u15/SYSNDR.ASM +++ /dev/null @@ -1,17 +0,0 @@ -; PROGRAM: SYSNDR.ASM -; AUTHOR: RICHARD CONN -; VERSION: 1.0 -; DATE: 24 FEB 84 - -; -; SYSNDR.ASM sets up a memory-based named directory file suitable -; for loading by Z3LDR. It does this by including SYSNDR.LIB. -; - MACLIB SYSNDR - - org 100h - - SYSNDR ; Invoke macro - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSNDR.LIB b/Source/Images/d_bp/u15/SYSNDR.LIB deleted file mode 100644 index d43d923a..00000000 --- a/Source/Images/d_bp/u15/SYSNDR.LIB +++ /dev/null @@ -1,83 +0,0 @@ -; DATA FILE: SYSNDR.LIB -; AUTHOR: Richard Conn -; VERSION: 1.0 -; DATE: 24 Feb 84 - -; -; SYSNDR.LIB defines the structure of the memory-based named directory. -; It also defines a few elements for it and is suitable for enclosure in -; an NDR file. -; -; The general structure is: -; -; DB Disk,User ; A=1 -; DB 'NDIRNAME' ; 8 chars -; DB 'PASSWORD' ; 8 chars -; ... ; other entries -; DB 0 ; End of NDR -; -defdu macro ?disk,?user - db ?disk-'@' ; Convert Disk - db ?user ; User is OK - endm - -sysndr macro - defdu 'A',0 - db 'BASE ' - db ' ' - - defdu 'A',15 - db 'ROOT ' - db ' ' - - defdu 'A',16 - db 'HELP ' - db ' ' - - defdu 'B',0 - db 'SCRATCH ' - db ' ' - - defdu 'B',1 - db 'ASM ' - db ' ' - - defdu 'B',2 - db 'C ' - db ' ' - - defdu 'B',3 - db 'PASCAL ' - db ' ' - - defdu 'B',4 - db 'SCR ' - db ' ' - - defdu 'B',5 - db 'BASIC ' - db ' ' - - defdu 'B',7 - db 'TEXT ' - db ' ' - - defdu 'B',8 - db 'CAT ' - db ' ' - - defdu 'B',9 - db 'DATA ' - db ' ' - - defdu 'C',0 - db 'BACKUP ' - db ' ' - - db 0 ;End of List - endm - -; -; End of SYSNDR.LIB -; - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSRCP.AQM b/Source/Images/d_bp/u15/SYSRCP.AQM deleted file mode 100644 index f9fdf538..00000000 Binary files a/Source/Images/d_bp/u15/SYSRCP.AQM and /dev/null differ diff --git a/Source/Images/d_bp/u15/SYSRCP.ASM b/Source/Images/d_bp/u15/SYSRCP.ASM deleted file mode 100644 index 51ff718e..00000000 --- a/Source/Images/d_bp/u15/SYSRCP.ASM +++ /dev/null @@ -1,2306 +0,0 @@ -* SYSTEM SEGMENT: SYS.RCP -* SYSTEM: ARIES-1 -* CUSTOMIZED BY: RICHARD CONN - -* -* PROGRAM: SYSRCP.ASM -* AUTHOR: RICHARD CONN -* VERSION: 1.0 -* DATE: 3 FEB 84 -* PREVIOUS VERSIONS: NONE -* -VERSION EQU 10 - -* -* SYSRCP is a resident command processor for ZCPR3. As with -* all resident command processors, SYSRCP performs the following functions: -* -* 1. Assuming that the EXTFCB contains the name of the -* command, SYSRCP looks to see if the first character -* of the file name field in the EXTFCB is a question -* mark; if so, it returns with the Zero Flag Set and -* HL pointing to the internal routine which prints -* its list of commands -* 2. The resident command list in SYSRCP is scanned for -* the entry contained in the file name field of -* EXTFCB; if found, SYSRCP returns with the Zero Flag -* Set and HL pointing to the internal routine which -* implements the function; if not found, SYSRCP returns -* with the Zero Flag Reset (NZ) -* - -* -* Global Library which Defines Addresses for SYSRCP -* - MACLIB Z3BASE ; USE BASE ADDRESSES - MACLIB SYSRCP ; USE SYSRCP HEADER - -; -CTRLC EQU 'C'-'@' -TAB EQU 09H -LF EQU 0AH -FF EQU 0CH -CR EQU 0DH -CTRLX EQU 'X'-'@' -; -WBOOT EQU BASE+0000H ;CP/M WARM BOOT ADDRESS -UDFLAG EQU BASE+0004H ;USER NUM IN HIGH NYBBLE, DISK IN LOW -BDOS EQU BASE+0005H ;BDOS FUNCTION CALL ENTRY PT -TFCB EQU BASE+005CH ;DEFAULT FCB BUFFER -FCB1 EQU TFCB ;1st and 2nd FCBs -FCB2 EQU TFCB+16 -TBUFF EQU BASE+0080H ;DEFAULT DISK I/O BUFFER -TPA EQU BASE+0100H ;BASE OF TPA -DIRBUF EQU BASE+4000H ;DIR BUFFER (MANY ENTRIES PERMITTED) -PAGCNT EQU DIRBUF-100H ;PAGE COUNT BUFFER -OLDFCB EQU PAGCNT+1 ;OLD FCB BUFFER -CPBLOCKS EQU 32 ;USE 4K FOR BUFFERING OF COPY -; -$-MACRO ;FIRST TURN OFF THE EXPANSIONS -; -; MACROS TO PROVIDE Z80 EXTENSIONS -; MACROS INCLUDE: -; -; JR - JUMP RELATIVE -; JRC - JUMP RELATIVE IF CARRY -; JRNC - JUMP RELATIVE IF NO CARRY -; JRZ - JUMP RELATIVE IF ZERO -; JRNZ - JUMP RELATIVE IF NO ZERO -; DJNZ - DECREMENT B AND JUMP RELATIVE IF NO ZERO -; -; @GENDD MACRO USED FOR CHECKING AND GENERATING -; 8-BIT JUMP RELATIVE DISPLACEMENTS -; -@GENDD MACRO ?DD ;;USED FOR CHECKING RANGE OF 8-BIT DISPLACEMENTS - IF (?DD GT 7FH) AND (?DD LT 0FF80H) - DB 100H,?DD ;Displacement Range Error on Jump Relative - ELSE - DB ?DD - ENDIF ;;RANGE ERROR - ENDM -; -; -; Z80 MACRO EXTENSIONS -; -JR MACRO ?N ;;JUMP RELATIVE - IF I8080 ;;8080/8085 - JMP ?N - ELSE ;;Z80 - DB 18H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRC MACRO ?N ;;JUMP RELATIVE ON CARRY - IF I8080 ;;8080/8085 - JC ?N - ELSE ;;Z80 - DB 38H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRNC MACRO ?N ;;JUMP RELATIVE ON NO CARRY - IF I8080 ;;8080/8085 - JNC ?N - ELSE ;;Z80 - DB 30H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRZ MACRO ?N ;;JUMP RELATIVE ON ZERO - IF I8080 ;;8080/8085 - JZ ?N - ELSE ;;Z80 - DB 28H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRNZ MACRO ?N ;;JUMP RELATIVE ON NO ZERO - IF I8080 ;;8080/8085 - JNZ ?N - ELSE ;;Z80 - DB 20H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -DJNZ MACRO ?N ;;DECREMENT B AND JUMP RELATIVE ON NO ZERO - IF I8080 ;;8080/8085 - DCR B - JNZ ?N - ELSE ;;Z80 - DB 10H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -* -* SYSTEM Entry Point -* - org rcp ; passed for Z3BASE - - db 'Z3RCP' ; Flag for Package Loader -* -* **** Command Table for RCP **** -* This table is RCP-dependent! -* -* The command name table is structured as follows: -* -* ctable: -* DB 'CMNDNAME' ; Table Record Structure is -* DW cmndaddress ; 8 Chars for Name and 2 Bytes for Adr -* ... -* DB 0 ; End of Table -* -cnsize equ 4 ; NUMBER OF CHARS IN COMMAND NAME - db cnsize ; size of text entries -ctab: - db 'H ' ; Help for RCP - dw clist -ctab1: -; - IF CPON - db 'CP ' ; Copy - dw copy - ENDIF ;CPON -; - IF DIRON - db 'DIR ' ; Directory - dw dir - ENDIF ;DIRON -; - IF ECHOON - db 'ECHO' ; Echo - dw echo - ENDIF -; - IF ERAON - db 'ERA ' ; Erase - dw era - ENDIF ;ERAON -; - IF LTON AND LISTON - db 'LIST' ; List - dw list - ENDIF ;LTON AND LISTON -; - IF NOTEON - db 'NOTE' ; Note-Comment-NOP Command - dw note - ENDIF -; - IF PEEKON - db 'P ' ; Peek into Memory - dw peek - ENDIF ;PEEKON -; - IF POKEON - db 'POKE' ; Poke Values into Memory - dw poke - ENDIF ;POKEON -; - IF PROTON - db 'PROT' ; Protection Codes - dw att - ENDIF ;PROTON -; - IF REGON - db 'REG ' ; Register Command - dw regcmd - ENDIF ;RSETON -; - IF RENON - db 'REN ' ; Rename - dw ren - ENDIF ;RENON -; - IF LTON - db 'TYPE' ; Type - dw type - ENDIF ;LTON -; - IF WHLON - db 'WHL ' ; Wheel - dw whl - db 'WHLQ' ; Wheel Query - dw whlmsg - ENDIF ;WHLON -; - db 0 -* -* BANNER NAME OF RCP -* -rcp$name: - db 'SYS ' - db (version/10)+'0','.',(version mod 10)+'0' - db RCPID - db 0 - -* -* Command List Routine -* -clist: - lxi h,rcp$name ; print RCP Name - call print1 - lxi h,ctab1 ; print table entries - mvi c,1 ; set count for new line -clist1: - mov a,m ; done? - ora a - rz - dcr c ; count down - jrnz clist1a - call crlf ; new line - mvi c,4 ; set count -clist1a: - lxi d,entryname ; copy command name into message buffer - mvi b,cnsize ; number of chars -clist2: - mov a,m ; copy - stax d - inx h ; pt to next - inx d - dcr b - jnz clist2 - inx h ; skip to next entry - inx h - push h ; save ptr - lxi h,entrymsg ; print message - call print1 - pop h ; get ptr - jmp clist1 -* -* Console Output Routine -* -conout: - push h ; save regs - push d - push b - push psw - ani 7fh ; mask MSB - mov e,a ; char in E - mvi c,2 ; output - call bdos - pop psw ; get regs - pop b - pop d - pop h -; -; This simple return doubles for the NOTE Command (NOP) and CONOUT Exit -; NOTE Command: NOTE any text -; -NOTE: - ret -* -* Print String (terminated in 0 or MSB Set) at Return Address -* -print: - xthl ; get address - call print1 - xthl ; put address - ret -* -* Print String (terminated in 0 or MSB Set) pted to by HL -* -print1: - mov a,m ; done? - inx h ; pt to next - ora a ; 0 terminator - rz - call conout ; print char - rm ; MSB terminator - jmp print1 -* -* CLIST Messages -* -entrymsg: - db ' ' ; command name prefix -entryname: - ds cnsize ; command name - db 0 ; terminator - -* -* **** RCP Routines **** -* All code from here on is RCP-dependent! -* - -; -;Section 5A -;Command: DIR -;Function: To display a directory of the files on disk -;Forms: -; DIR Displays the DIR files -; DIR S Displays the SYS files -; DIR A Display both DIR and SYS files -;Notes: -; The flag SYSFLG defines the letter used to display both DIR and -; SYS files (A in the above Forms section) -; The flag SOFLG defines the letter used to display only the SYS -; files (S in the above Forms section) -; The flag WIDE determines if the file names are spaced further -; apart (WIDE=TRUE) for 80-col screens -; The flag FENCE defines the character used to separate the file -; names -; - IF DIRON -DIR: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; - IF WDIR - CALL WHLTST - ENDIF ;WHEEL APPROVAL -; - CALL RETSAVE ;SAVE RET ADDRESS AND SET STACK - LXI H,FCB1+1 ;MAKE FCB WILD (ALL '?') IF NO FILENAME.TYP - MOV A,M ;GET FIRST CHAR OF FILENAME.TYP - CPI ' ' ;IF , ALL WILD - CZ FILLQ - LDA FCB2+1 ;GET FIRST CHAR OF 2ND FILE NAME - MVI B,80H ;PREPARE FOR DIR-ONLY SELECTION - CPI ' ' ;ANY FLAG? - JRZ DIRPR ;THERE IS NO FLAG, SO DIR ONLY - MVI B,1 ;SET FOR BOTH DIR AND SYS FILES - CPI SYSFLG ;SYSTEM AND DIR FLAG SPECIFIER? - JRZ DIRPR ;GOT SYSTEM SPECIFIER - CPI SOFLG ;SYS ONLY? - JRNZ DIRPR - DCR B ;B=0 FOR SYS FILES ONLY -; - ENDIF ;DIRON -; -; DIRECTORY PRINT ROUTINE; ON ENTRY, B REG IS SET AS FOLLOWS: -; 0 FOR ONLY SYSTEM FILES, 80H FOR ONLY DIR FILES, 1 FOR BOTH -; - IF DIRON OR ERAON OR LTON OR PROTON OR CPON OR RENON -DIRPR: - MOV A,B ;GET SYSTST FLAG - CALL GETDIR ;LOAD AND SORT DIRECTORY - JZ PRFNF ;PRINT NO FILE MESSAGE - MVI E,4 ;COUNT DOWN TO 0 -; -; ENTRY PRINT LOOP; ON ENTRY, HL PTS TO FILES SELECTED (TERMINATED BY 0) -; AND E IS ENTRY COUNTER -; -DIR3: - MOV A,M ;CHECK FOR DONE - ORA A - JZ EXIT ;EXIT IF DONE - MOV A,E ;GET ENTRY COUNTER - ORA A ;OUTPUT IF 4 ENTRIES PRINTED IN LINE - CZ DIRCRLF ;NEW LINE - MOV A,E ;GET ENTRY COUNT - CPI 4 ;FIRST ENTRY? - JRZ DIR4 - CALL PRINT -; - IF WIDE -; - DB ' ' ;2 SPACES - DB FENCE ;THEN FENCE CHAR - DB ' '+80H ;THEN 1 MORE SPACE -; - ELSE -; - DB ' ' ;SPACE - DB FENCE+80H ;THEN FENCE CHAR -; - ENDIF ;WIDE -; -DIR4: - CALL PRFN ;PRINT FILE NAME - CALL BREAK ;CHECK FOR ABORT - DCR E ;DECREMENT ENTRY COUNTER - JR DIR3 -; -; CRLF FOR DIR ROUTINE -; -DIRCRLF: - PUSH PSW ;DON'T AFFECT PSW - CALL CRLF ;NEW LINE - POP PSW - MVI E,4 ;RESET ENTRY COUNTER - RET -; -; AFTER A SEARCH, RETURN NZ SET IF DESIRED TYPE OF FILE FOUND, Z IF NOT -; THIS ALGORITHM LOOKS AT THE SYSTEM BIT OF THE LOCATED FILE; THIS -; BIT IS SET TO 1 IF THE FILE IS A SYSTEM FILE AND 0 IF NOT A SYSTEM -; FILE. THE FOLLOWING EXCLUSIVE OR MASKS ARE APPLIED TO RETURN Z OR NZ -; AS REQUIRED BY THE CALLING PROGRAM: -; -; SYSTEM BYTE: X 0 0 0 0 0 0 0 (AFTER 80H MASK, X=1 IF SYS, 0 IF DIR) -; -; SYS-ONLY : 0 0 0 0 0 0 0 0 (XOR 0 = 0 if X=0, = 80H if X=1) -; DIR-ONLY : 1 0 0 0 0 0 0 0 (XOR 80H = 80h if X=0, = 0 if X=1) -; BOTH : 0 0 0 0 0 0 0 1 (XOR 1 = 81H or 1H, NZ in both cases) -; -GETSBIT: - DCR A ;ADJUST TO RETURNED VALUE - RRC ;CONVERT NUMBER TO OFFSET INTO TBUFF - RRC - RRC - ANI 60H - MOV C,A ;OFFSET INTO TBUFF IN C (C=OFFSET TO ENTRY) - LXI D,TBUFF ;PT TO BUFFER - MOV A,E ;BASE ADDRESS IN A - ADD C ;ADD IN ENTRY OFFSET - MOV E,A ;RESULT IN E - PUSH D ;SAVE PTR IN DE - ADI 10 ;ADD OFFSET OF 10 TO PT TO SYSTEM BYTE - MOV E,A ;SET ADDRESS - LDAX D ;GET BYTE - POP D ;GET PTR IN DE - ANI 80H ;LOOK AT ONLY SYSTEM BIT -SYSTST EQU $+1 ;IN-THE-CODE VARIABLE - XRI 0 ; IF SYSTST=0, SYS ONLY; IF SYSTST=80H, DIR - ; ONLY; IF SYSTST=1, BOTH SYS AND DIR - RET ;NZ IF OK, Z IF NOT OK -; -; FILL FCB @HL WITH '?' -; -FILLQ: - MVI B,11 ;NUMBER OF CHARS IN FN & FT - MVI A,'?' ;STORE '?' -FILLP: - MOV M,A ;STORE BYTE - INX H ;PT TO NEXT - DJNZ FILLP ;COUNT DOWN - RET -; -; LOAD DIRECTORY AND SORT IT -; ON INPUT, A=SYSTST FLAG (0=SYS, 1=DIR, 80H=BOTH) -; DIRECTORY IS LOADED INTO DIRBUF -; RETURN WITH ZERO SET IF NO MATCH AND HL PTS TO 1ST ENTRY IF MATCH -; -GETDIR: - STA SYSTST ; SET SYSTEM TEST FLAG - CALL LOGUSR ; LOG INTO USER AREA OF FCB1 - LXI H,DIRBUF ; PT TO DIR BUFFER - MVI M,0 ; SET EMPTY - LXI B,0 ; SET COUNTER - CALL SEARF ; LOOK FOR MATCH - RZ ; RETURN IF NOT FOUND -; -; STEP 1: LOAD DIRECTORY -; -GD1: - PUSH B ; SAVE COUNTER - CALL GETSBIT ; CHECK FOR SYSTEM OK - POP B - JRZ GD2 ; NOT OK, SO SKIP - PUSH B ; SAVE COUNTER - INX D ; PT TO FILE NAME - XCHG ; HL PTS TO FILE NAME, DE PTS TO BUFFER - MVI B,11 ; COPY 11 BYTES - CALL LDIR ; DO COPY - XCHG ; HL PTS TO NEXT BUFFER LOCATION - POP B ; GET COUNTER - INX B ; INCREMENT COUNTER -GD2: - CALL SEARN ; LOOK FOR NEXT - JRNZ GD1 - MVI M,0 ; STORE ENDING 0 - LXI H,DIRBUF ; PT TO DIR BUFFER - MOV A,M ; CHECK FOR EMPTY - ORA A - RZ -; -; STEP 2: SORT DIRECTORY -; - PUSH H ; SAVE PTR TO DIRBUF FOR RETURN - CALL DIRALPHA ; SORT - POP H - XRA A ; SET NZ FLAG FOR OK - DCR A - RET - -;* -;* DIRALPHA -- ALPHABETIZES DIRECTORY IN DIRBUF; BC CONTAINS -;* THE NUMBER OF FILES IN THE DIRECTORY -;* -DIRALPHA: - MOV A,B ; ANY FILES? - ORA C - RZ - MOV H,B ; HL=BC=FILE COUNT - MOV L,C - SHLD N ; SET "N" -;* -;* SHELL SORT -- -;* THIS SORT ROUTINE IS ADAPTED FROM "SOFTWARE TOOLS" -;* BY KERNIGAN AND PLAUGHER, PAGE 106. COPYRIGHT, 1976, ADDISON-WESLEY. -;* ON ENTRY, BC=NUMBER OF ENTRIES -;* -N EQU $+1 ; POINTER FOR IN-THE-CODE MODIFICATION - LXI H,0 ; NUMBER OF ITEMS TO SORT - SHLD GAP ; SET INITIAL GAP TO N FOR FIRST DIVISION BY 2 - -;* FOR (GAP = N/2; GAP > 0; GAP = GAP/2) -SRTL0: - ORA A ; CLEAR CARRY -GAP EQU $+1 ; POINTER FOR IN-THE-CODE MODIFICATION - LXI H,0 ; GET PREVIOUS GAP - MOV A,H ; ROTATE RIGHT TO DIVIDE BY 2 - RAR - MOV H,A - MOV A,L - RAR - MOV L,A - -;* TEST FOR ZERO - ORA H - RZ ; DONE WITH SORT IF GAP = 0 - - SHLD GAP ; SET VALUE OF GAP - SHLD I ; SET I=GAP FOR FOLLOWING LOOP - -;* FOR (I = GAP + 1; I <= N; I = I + 1) -SRTL1: -I EQU $+1 ; POINTER FOR IN-THE-CODE MODIFICATION - LXI H,0 ; ADD 1 TO I - INX H - SHLD I - -;* TEST FOR I <= N - XCHG ; I IS IN DE - LHLD N ; GET N - MOV A,L ; COMPARE BY SUBTRACTION - SUB E - MOV A,H - SBB D ; CARRY SET MEANS I > N - JRC SRTL0 ; DON'T DO FOR LOOP IF I > N - - LHLD I ; SET J = I INITIALLY FOR FIRST SUBTRACTION OF GAP - SHLD J - -;* FOR (J = I - GAP; J > 0; J = J - GAP) -SRTL2: - LHLD GAP ; GET GAP - XCHG ; ... IN DE -J EQU $+1 ; POINTER FOR IN-THE-CODE MODIFICATION - LXI H,0 ; GET J - MOV A,L ; COMPUTE J - GAP - SUB E - MOV L,A - MOV A,H - SBB D - MOV H,A - SHLD J ; J = J - GAP - JRC SRTL1 ; IF CARRY FROM SUBTRACTIONS, J < 0 AND ABORT - MOV A,H ; J=0? - ORA L - JRZ SRTL1 ; IF ZERO, J=0 AND ABORT - -;* SET JG = J + GAP - XCHG ; J IN DE - LHLD GAP ; GET GAP - DAD D ; J + GAP - SHLD JG ; JG = J + GAP - -;* IF (V(J) <= V(JG)) - CALL ICOMPARE ; J IN DE, JG IN HL - -;* ... THEN BREAK - JRC SRTL1 - -;* ... ELSE EXCHANGE - LHLD J ; SWAP J, JG - XCHG -JG EQU $+1 ; POINTER FOR IN-THE-CODE MODIFICATION - LXI H,0 - CALL ISWAP ; J IN DE, JG IN HL - -;* END OF INNER-MOST FOR LOOP - JR SRTL2 - -;* -;* SWAP (Exchange) the elements whose indexes are in HL and DE -;* -ISWAP: - CALL IPOS ; COMPUTE POSITION FROM INDEX - XCHG - CALL IPOS ; COMPUTE 2ND ELEMENT POSITION FROM INDEX - MVI B,11 ; 11 BYTES TO FLIP -ISWAP1: - LDAX D ; GET BYTES - MOV C,M - MOV M,A ; PUT BYTES - MOV A,C - STAX D - INX H ; PT TO NEXT - INX D - DJNZ ISWAP1 - RET -;* -;* ICOMPARE compares the entry pointed to by the pointer pointed to by HL -;* with that pointed to by DE (1st level indirect addressing); on entry, -;* HL and DE contain the numbers of the elements to compare (1, 2, ...); -;* on exit, Carry Set means ((DE)) < ((HL)), Zero Set means ((HL)) = ((DE)), -;* and Non-Zero and No-Carry means ((DE)) > ((HL)) -;* -ICOMPARE: - CALL IPOS ; GET POSITION OF FIRST ELEMENT - XCHG - CALL IPOS ; GET POSITION OF 2ND ELEMENT - XCHG -;* -;* COMPARE DIR ENTRY PTED TO BY HL WITH THAT PTED TO BY DE; -;* NO NET EFFECT ON HL, DE; RET W/CARRY SET MEANS DE Erase Specified files and print their names -; ERA I Erase Specified files and print their names, but ask -; for verification before Erase is done -; - IF ERAON -ERA: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; - IF WERA - CALL WHLTST - ENDIF ;WHEEL APPROVAL -; - CALL RETSAVE - LDA FCB2+1 ;GET ERAFLG IF IT'S THERE - STA ERAFLG ;SAVE IT AS A FLAG - MVI A,1 ;DIR FILES ONLY - CALL GETDIR ;LOAD DIRECTORY OF FILES - JZ PRFNF ;ABORT IF NO FILES -; -; MAIN ERASE LOOP -; -ERA1: - PUSH H ;SAVE PTR TO FILE - CALL PRFN ;PRINT ITS NAME - SHLD NXTFILE ;SAVE PTR TO NEXT FILE - POP H ;GET PTR TO THIS FILE - CALL ROTEST ;TEST FILE PTED TO BY HL FOR R/O - JRNZ ERA3 -ERAFLG EQU $+1 ;ADDRESS OF FLAG - MVI A,0 ;2ND BYTE IS FLAG - CPI 'I' ;IS IT AN INSPECT OPTION? - JRNZ ERA2 ;SKIP PROMPT IF IT IS NOT - CALL ERAQ ;ERASE? - JRNZ ERA3 ;SKIP IF NOT -ERA2: - LXI D,FCB1+1 ;COPY INTO FCB1 - MVI B,11 ;11 BYTES - CALL LDIR - CALL INITFCB1 ;INIT FCB - MVI C,19 ;DELETE FILE - CALL BDOS -ERA3: - LHLD NXTFILE ;HL PTS TO NEXT FILE - MOV A,M ;GET CHAR - ORA A ;DONE? - JZ EXIT - CALL CRLF ;NEW LINE - JR ERA1 -; - ENDIF ;ERAON -; -;Section 5C -;Command: LIST -;Function: Print out specified file on the LST: Device -;Forms: -; LIST Print file (NO Paging) -;Notes: -; The flags which apply to TYPE do not take effect with LIST -; - IF LTON -LIST: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; - IF WLIST - CALL WHLTST - ENDIF ;WHEEL APPROVAL -; - CALL RETSAVE - MVI A,0FFH ;TURN ON PRINTER FLAG - JR TYPE0 -; -;Section 5D -;Command: TYPE -;Function: Print out specified file on the CON: Device -;Forms: -; TYPE Print file -; TYPE P Print file with paging flag -;Notes: -; The flag PGDFLG defines the letter which toggles the paging -; facility (P in the forms section above) -; The flag PGDFLT determines if TYPE is to page by default -; (PGDFLT=TRUE if TYPE pages by default); combined with -; PGDFLG, the following events occur -- -; If PGDFLT = TRUE, PGDFLG turns OFF paging -; If PGDFLT = FALSE, PGDFLG turns ON paging -; -TYPE: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; - IF WTYPE - CALL WHLTST - ENDIF ;WHEEL APPROVAL -; - CALL RETSAVE - XRA A ;TURN OFF PRINTER FLAG -; -; ENTRY POINT FOR CPR LIST FUNCTION (LIST) -; -TYPE0: - STA PRFLG ;SET FLAG - LDA FCB2+1 ;GET PAGE FLAG - STA PGFLG ;SAVE IT AS A FLAG - MVI A,1 ;SELECT DIR FILES - CALL GETDIR ;ALLOW AMBIGUOUS FILES - JZ PRFNF ;NO FILES - SHLD NXTFILE ;SET PTR TO NEXT FILE - JR TYPEX2 -TYPEX: - LHLD NXTFILE ;GET PTR TO NEXT FILE - MOV A,M ;ANY FILES? - ORA A - JZ EXIT - LDA PRFLG ;CHECK FOR LIST OUTPUT - ORA A ;0=TYPE - JRZ TYPEX1 - MVI A,CR ;BOL ON PRINTER - CALL LCOUT - MVI A,FF ;FORM FEED THE PRINTER - CALL LCOUT - JR TYPEX2 -TYPEX1: - CALL PAGEBREAK ;PAGE BREAK MESSAGE -TYPEX2: - LXI D,FCB1+1 ;COPY INTO FCB1 - MVI B,11 ;11 BYTES - CALL LDIR - SHLD NXTFILE ;SET PTR TO NEXT FILE - CALL INITFCB1 ;INIT FCB1 - MVI C,15 ;OPEN FILE - CALL BDOS - INR A ;SET ERROR FLAG - JZ PRFNF ;ABORT IF ERROR - MVI A,NLINES-2 ;SET LINE COUNT - STA PAGCNT - MVI A,CR ;NEW LINE - CALL LCOUT - MVI A,LF - CALL LCOUT - LXI B,080H ;SET CHAR POSITION AND TAB COUNT - ; (B=0=TAB, C=080H=CHAR POSITION) -; -; MAIN LOOP FOR LOADING NEXT BLOCK -; -TYPE2: - MOV A,C ;GET CHAR COUNT - CPI 80H - JRC TYPE3 - PUSH H ;READ NEXT BLOCK - PUSH B - LXI D,FCB1 ;PT TO FCB - MVI C,20 ;READ RECORD - CALL BDOS - ORA A ;SET FLAGS - POP B - POP H - JRNZ TYPE7 ;END OF FILE? - MVI C,0 ;SET CHAR COUNT - LXI H,TBUFF ;PT TO FIRST CHAR -; -; MAIN LOOP FOR PRINTING CHARS IN TBUFF -; -TYPE3: - MOV A,M ;GET NEXT CHAR - ANI 7FH ;MASK OUT MSB - CPI 1AH ;END OF FILE (^Z)? - JRZ TYPE7 ;NEXT FILE IF SO -; -; OUTPUT CHAR TO CON: OR LST: DEVICE WITH TABULATION -; - CPI CR ;RESET TAB COUNT? - JRZ TYPE4 - CPI LF ;RESET TAB COUNT? - JRZ TYPE4 - CPI TAB ;TAB? - JRZ TYPE5 -; -; OUTPUT CHAR AND INCREMENT CHAR COUNT -; - CALL LCOUT ;OUTPUT CHAR - JZ TYPEX ;SKIP - INR B ;INCREMENT TAB COUNT - JR TYPE6 -; -; OUTPUT OR AND RESET TAB COUNT -; -TYPE4: - CALL LCOUT ;OUTPUT OR - JZ TYPEX ;SKIP - MVI B,0 ;RESET TAB COUNTER - JR TYPE6 -; -; TABULATE -; -TYPE5: - MVI A,' ' ; - CALL LCOUT - JZ TYPEX ;SKIP - INR B ;INCR POS COUNT - MOV A,B - ANI 7 - JRNZ TYPE5 -; -; CONTINUE PROCESSING -; -TYPE6: - INR C ;INCREMENT CHAR COUNT - INX H ;PT TO NEXT CHAR - CALL BREAK ;CHECK FOR ABORT - JZ TYPEX ;SKIP - JR TYPE2 -TYPE7: - LXI D,FCB1 ;CLOSE FILE - MVI C,16 ;BDOS FUNCTION - CALL BDOS - JMP TYPEX -; -; SEND OUTPUT TO LST: OR CON:, AS PER THE FLAG -; RETURN WITH Z IF ABORT -; -LCOUT: - PUSH H ;SAVE REGS - PUSH D - PUSH B - MOV E,A ;CHAR IN E - MVI C,2 ;OUTPUT TO CON: -PRFLG EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;2ND BYTE IS THE PRINT FLAG - ORA A ;0=TYPE - JRZ LC1 - MVI C,5 ;OUTPUT TO LST: -LC1: - PUSH D ;SAVE CHAR - CALL BDOS ;OUTPUT CHAR IN E - POP D ;GET CHAR - MOV A,E - CPI LF - JRNZ LC2 - LDA PRFLG ;OUTPUT TO LST:? - ORA A ;NZ = YES - JRNZ LC2 -; -; CHECK FOR PAGING -; - LXI H,PAGCNT ;COUNT DOWN - DCR M - JRNZ LC2 ;JUMP IF NOT END OF PAUSE - MVI M,NLINES-2 ;REFILL COUNTER -PGFLG EQU $+1 ;POINTER TO IN-THE-CODE BUFFER - MVI A,0 ;2ND BYTE IS THE PAGING FLAG - CPI PGDFLG ;PAGE DEFAULT OVERRIDE OPTION WANTED? -; - IF PGDFLT ;IF PAGING IS DEFAULT -; - JRZ LC2 ;PGDFLG MEANS NO PAGING -; - ELSE -; - JRNZ LC2 ;PGDFLG MEANS PAGE -; - ENDIF ;PGDFLT -; - CALL PAGEBREAK ;PRINT PAGE BREAK MESSAGE - JR LC3 ;Z TO SKIP -LC2: - XRA A ;SET OK - DCR A ;NZ=OK -LC3: - POP B ;RESTORE REGS - POP D - POP H - RET -; -; PRINT PAGE BREAK MESSAGE AND GET USER INPUT -; ABORT IF ^C, RZ IF ^X -; -PAGEBREAK: - PUSH H ;SAVE HL - CALL PRINT - DB cr,lf,' Typing',' '+80H - LXI H,FCB1+1 ;PRINT FILE NAME - CALL PRFN - CALL DASH ;PRINT DASH - CALL CONIN ;GET INPUT - POP H ;RESTORE HL - PUSH PSW - CALL CRLF ;NEW LINE - POP PSW - CPI CTRLC ;^C - JZ EXIT - CPI CTRLX ;SKIP? - RET -; - ENDIF ;LTON -; -;Section 5E -;Command: REN -;Function: To change the name of an existing file -;Forms: -; REN = Perform function -; - IF RENON -REN: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; - IF WREN - CALL WHLTST - ENDIF ;WHEEL APPROVAL -; - CALL RETSAVE -; -; -; STEP 1: CHECK FOR FILE 2 BEING AMBIGUOUS -; - LXI H,FCB2+1 ;CAN'T BE AMBIGUOUS - CALL AMBCHK1 -; -; STEP 2: LOG INTO USER AREA -; - CALL LOGUSR ;LOG INTO USER AREA OF FCB1 -; -; STEP 3: SEE IF NEW FILE ALREADY EXISTS -; EXTEST PERFORMS A NUMBER OF CHECKS: -; 1) AMBIGUITY -; 2) R/O -; 3) IF FILE EXISTS AND NOT R/O, PERMISSION TO DELETE -; - CALL EXTEST - JZ EXIT ;R/O OR NO PERMISSION -; -; STEP 4: EXCHANGE FILE NAME FIELDS FOR RENAME -; - LXI H,FCB1 ;EXCHANGE NAMES ONLY - PUSH H ;SAVE PTR - INX H - LXI D,FCB2+1 - MVI B,11 ;11 BYTES -REN1: - LDAX D ;GET OLD - MOV C,A - MOV A,M - STAX D ;PUT NEW - MOV M,C - INX H ;PT TO NEXT - INX D - DJNZ REN1 -; -; STEP 5: SEE IF OLD FILE IS R/O -; - CALL SEARF ;LOOK FOR FILE - JZ PRFNF - CALL GETSBIT ;GET PTR TO ENTRY IN TBUFF - XCHG ;HL PTS TO ENTRY - INX H ;PT TO FN - CALL ROTEST ;SEE IF FILE IS R/O - JNZ EXIT -; -; STEP 6: RENAME THE FILE -; - POP D ;GET PTR TO FCB - MVI C,23 ;RENAME - CALL BDOS - INR A ;SET ZERO FLAG IF ERROR - JZ PRFNF ;PRINT NO SOURCE FILE MESSAGE - JMP EXIT -; - ENDIF ;RENON -; -;Section 5F -;Command: PROT -;Function: To set the attributes of a file (R/O and SYS) -; -;Form: -; PROT afn RSI -;If either R or S are omitted, the file is made R/W or DIR, resp; -;R and S may be in any order. If I is present, Inspection is enabled. -; - IF PROTON -ATT: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; - IF WPROT - CALL WHLTST - ENDIF ;WHEEL APPROVAL -; - CALL RETSAVE - XRA A ;SET NO INSPECT - STA INSPECT - LXI H,0 ;SET R/O AND SYS ATTRIBUTES OFF - LXI D,FCB2+1 ;PT TO ATTRIBUTES - MVI B,3 ;3 CHARS MAX -ATT1: - LDAX D ;GET CHAR - INX D ;PT TO NEXT - CPI 'I' ;INSPECT? - JRZ ATTI - CPI 'R' ;SET R/O? - JRZ ATTR - CPI 'S' ;SET SYS? - JRZ ATTS -ATT2: - DJNZ ATT1 - JR ATT3 -ATTI: - STA INSPECT ;SET FLAG - JR ATT2 -ATTR: - MVI H,80H ;SET R/O BIT - JR ATT2 -ATTS: - MVI L,80H ;SET SYS BIT - JR ATT2 -ATT3: - SHLD FATT ;SAVE FILE ATTRIBUTES - MVI A,1 ;SELECT DIR AND SYS FILES - CALL GETDIR ;LOAD DIRECTORY - JZ PRFNF ;NO FILE ERROR - SHLD NXTFILE ;PT TO NEXT FILE - JR ATT5 -ATT4: - LHLD NXTFILE ;PT TO NEXT FILE - MOV A,M ;END OF LIST? - ORA A - JZ EXIT - CALL CRLF ;NEW LINE -ATT5: - PUSH H ;SAVE PTR TO CURRENT FILE - CALL PRFN ;PRINT ITS NAME - SHLD NXTFILE ;SAVE PTR TO NEXT FILE - CALL PRINT - DB ' Set to R','/'+80H - LHLD FATT ;GET ATTRIBUTES - MVI C,'W' ;ASSUME R/W - MOV A,H ;GET R/O BIT - ORA A - JRZ ATT6 - MVI C,'O' ;SET R/O -ATT6: - MOV A,C ;GET CHAR - CALL CONOUT - MOV A,L ;GET SYS FLAG - ORA A ;SET FLAG - JRZ ATT7 - CALL PRINT - DB ' and SY','S'+80H -ATT7: -INSPECT EQU $+1 ;PTR FOR IN-THE-CODE MODIFICATION - MVI A,0 ;GET INSPECT FLAG - ORA A ;Z=NO - POP H ;GET PTR TO CURRENT FILE - JRZ ATT8 - CALL ERAQ1 ;ASK FOR Y/N - JRNZ ATT4 ;ADVANCE TO NEXT FILE IF NOT Y -ATT8: - LXI D,FCB1+1 ;COPY INTO FCB1 - MVI B,11 ;11 BYTES - CALL LDIR -FATT EQU $+1 ;PTR FOR IN-THE-CODE MODIFICATION - LXI H,0 ;GET ATTRIBUTES - DCX D ;PT TO SYS BYTE - DCX D - MOV A,L ;GET SYS FLAG - CALL ATTSET ;SET ATTRIBUTE CORRECTLY - DCX D ;PT TO R/O BYTE - MOV A,H ;GET R/O FLAG - CALL ATTSET - LXI D,FCB1 ;PT TO FCB - MVI C,30 ;SET ATTRIBUTES - CALL BDOS - JR ATT4 -ATTSET: - ORA A ;0=CLEAR ATTRIBUTE - JRZ ATTST1 - LDAX D ;GET BYTE - ORI 80H ;SET ATTRIBUTE - STAX D - RET -ATTST1: - LDAX D ;GET BYTE - ANI 7FH ;CLEAR ATTRIBUTE - STAX D - RET -; - ENDIF ;PROTON -; -;Section 5G -;Command: CP -;Function: To copy a file from one place to another -; -;Form: -; CP new=old -; - IF CPON -COPY: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; - IF WCP - CALL WHLTST - ENDIF ;WHEEL APPROVAL -; - CALL RETSAVE -; -; STEP 0: IF NEW IS BLANK, MAKE IT THE SAME NAME AND TYPE AS OLD -; - LXI D,FCB1+1 ;PT TO NEW FILE NAME - LDAX D ;GET FIRST CHAR - CPI ' ' ;NO NAME? - JRNZ COPY0 - LXI H,FCB2+1 ;MAKE SAME AS OLD - MVI B,11 ;11 BYTES - CALL LDIR -; -; STEP 1: SEE IF NEW=OLD AND ABORT IF SO -; -COPY0: - LXI H,FCB1 ;PT TO NEXT - LXI D,FCB2 ;PT TO OLD - PUSH H ;SAVE PTRS - PUSH D - INX H ;PT TO FILE NAME - INX D - MVI B,13 ;COMPARE 13 BYTES -COPY1: - LDAX D ;GET OLD - CMP M ;COMPARE TO NEW - JRNZ COPY2 - INX H ;PT TO NEXT - INX D - DJNZ COPY1 - MVI C,25 ;GET CURRENT DISK - CALL BDOS - INR A ;MAKE 1..P - MOV B,A ;CURRENT DISK IN B - POP D ;GET PTR TO DN - POP H - LDAX D ;GET DISK - MOV C,A ;... IN C - ORA A ;CURRENT? - JRNZ COPY1A - MOV C,B ;MAKE C CURRENT -COPY1A: - MOV A,M ;GET DISK - ORA A ;CURRENT? - JRNZ COPY1B - MOV A,B ;MAKE A CURRENT -COPY1B: - CMP C ;SAME DISK ALSO? - JRNZ COPY3 ;CONTINUE WITH OPERATION - JR CPERR -COPY2: - POP D ;GET PTRS - POP H -; -; STEP 2: SET USER NUMBERS -; -COPY3: - LDA FCB1+13 ;GET NEW USER - STA USRNEW - LDA FCB2+13 ;GET OLD USER - STA USROLD -; -; STEP 3: SEE IF OLD FILE EXISTS -; - LXI H,OLDFCB ;COPY OLD INTO 2ND FCB - PUSH H ;SAVE PTR TO 2ND FCB - XCHG - MVI B,14 ;14 BYTES - CALL LDIR - CALL LOGOLD ;LOG IN USER NUMBER OF OLD FCB - POP H ;GET PTR TO 2ND FCB - CALL INITFCB2 ;INIT FCB - MVI C,17 ;LOOK FOR FILE - CALL BDOS - INR A ;CHECK FOR ERROR - JZ PRFNF ;FILE NOT FOUND -; -; STEP 4: SEE IF NEW EXISTS -; - CALL LOGNEW ;LOG INTO NEW'S USER AREA - CALL EXTEST ;TEST - JZ EXIT ;ERROR EXIT -; -; STEP 5: CREATE NEW -; - LXI D,FCB1 ;PT TO FCB - MVI C,22 ;MAKE FILE - CALL BDOS - INR A ;ERROR? - JRNZ COPY4 -; -; COPY ERROR -; -CPERR: - CALL PRINT - DB ' Copy','?'+80H - JMP EXIT -; -; STEP 6: OPEN OLD -; -COPY4: - CALL LOGOLD ;GET USER - LXI H,OLDFCB ;PT TO FCB - CALL INITFCB2 ;INIT FCB - MVI C,15 ;OPEN FILE - CALL BDOS -; -; STEP 7: COPY OLD TO NEW WITH BUFFERING -; -COPY5: - CALL LOGOLD ;GET USER - MVI B,0 ;SET COUNTER - LXI H,TPA ;SET NEXT ADDRESS TO COPY INTO -COPY5A: - PUSH H ;SAVE ADDRESS AND COUNTER - PUSH B - LXI D,OLDFCB ;READ BLOCK FROM FILE - MVI C,20 - CALL BDOS - POP B ;GET COUNTER AND ADDRESS - POP D - ORA A ;OK? - JRNZ COPY5B - PUSH B ;SAVE COUNTER - LXI H,TBUFF ;COPY FROM BUFFER - MVI B,128 ;128 BYTES - CALL LDIR - XCHG ;HL PTS TO NEXT - POP B ;GET COUNTER - INR B ;INCREMENT IT - MOV A,B ;DONE? - CPI CPBLOCKS ;DONE IF CPBLOCKS LOADED - JRNZ COPY5A -COPY5B: - MOV A,B ;GET COUNT - ORA A - JRZ COPY6 ;DONE IF NOTHING LOADED - PUSH B ;SAVE COUNT - CALL LOGNEW ;GET USER - LXI H,TPA ;PT TO TPA -COPY5C: - LXI D,TBUFF ;COPY INTO TBUFF - MVI B,128 ;128 BYTES - CALL LDIR - PUSH H ;SAVE PTR TO NEXT - LXI D,FCB1 ;PT TO FCB - MVI C,21 ;WRITE BLOCK - CALL BDOS - ORA A - JRNZ CPERR ;COPY ERROR - POP H ;GET PTR TO NEXT BLOCK - POP B ;GET COUNT - DCR B ;COUNT DOWN - JRZ COPY5 ;GET NEXT - PUSH B ;SAVE COUNT - JR COPY5C -; -; STEP 8: CLOSE FILES -; -COPY6: - CALL LOGOLD ;GET USER - LXI D,OLDFCB ;PT TO FCB - MVI C,16 ;CLOSE FILE - CALL BDOS - CALL LOGNEW ;GET USER - LXI D,FCB1 ;PT TO FCB - MVI C,16 ;CLOSE FILE - CALL BDOS - CALL PRINT - DB ' Don','e'+80H - JMP EXIT -; -; LOG INTO USER NUMBER OF OLD FILE -; -LOGOLD: -USROLD EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;GET NUMBER - JMP SETUSR -; -; LOG INTO USER NUMBER OF NEW FILE -; -LOGNEW: -USRNEW EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;GET NUMBER - JMP SETUSR -; - ENDIF ;CPON -; -;Section 5H -;Command: PEEK -;Function: Display memory -; -;Form: -; PEEK startadr - 256 bytes displayed -; PEEK startadr endadr - range of bytes displayed -; - IF PEEKON -PEEK: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; - IF WPEEK - CALL WHLTST - ENDIF ;WHEEL APPROVAL -; - CALL RETSAVE - LXI H,TBUFF+1 ;FIND FIRST NUMBER -NXTPEEK EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - LXI D,0 ;DEFAULT PEEK ADDRESS IF NONE - CALL SKSP ;SKIP TO NON-BLANK - CNZ HEXNUM ;GET START ADDRESS IF ANY (ELSE DEFAULT) - CALL PRINT - DB ' Pee','k'+80H - CALL ADRAT ;PRINT ADDRESS MESSAGE - PUSH D ;SAVE IT - LXI B,256 ;COMPUTE END ADDRESS - XCHG - DAD B - XCHG ;END ADDRESS IN DE - CALL SKSP ;SKIP TO NON-BLANK - JRZ PEEK1 ;PROCESS - CALL HEXNUM ;GET 2ND NUMBER IN DE -PEEK1: - POP H ;HL IS START ADDRESS, DE IS END ADDRESS - CALL PEEK2 ;DO PEEK - SHLD NXTPEEK ;SET CONTINUED PEEK ADDRESS - JMP EXIT -; -; DISPLAY LOOP -; -PEEK2: - MOV A,D ;SEE IF DE<=HL - CMP H - RC ;OUT OF BOUNDS - JRNZ PEEK2A ;HL > DE - MOV A,E - CMP L - RZ - RC -PEEK2A: - CALL CRLF ;NEW LINE - MOV A,H ;PRINT ADDRESS - CALL PASHC - MOV A,L - CALL PAHC - CALL DASH ;PRINT LEADER - MVI B,16 ;16 BYTES TO DISPLAY - PUSH H ;SAVE START ADDRESS -PEEK3: - MOV A,M ;GET NEXT BYTE - CALL PASHC ;PRINT WITH LEADING SPACE - INX H ;PT TO NEXT - DJNZ PEEK3 - POP H ;PT TO FIRST - MVI B,16 ;16 BYTES - MVI A,' ' ;SPACE AND FENCE - CALL CONOUT - CALL PRINT - DB FENCE+80H -PEEK4: - MOV A,M ;GET NEXT BYTE - MVI C,'.' ;ASSUME DOT - ANI 7FH ;MASK IT - CPI ' ' ;DOT IF LESS THAN SPACE - JRC PEEK5 - CPI 7FH ;DON'T PRINT DEL - JRZ PEEK5 - MOV C,A ;CHAR IN C -PEEK5: - MOV A,C ;GET CHAR - CALL CONOUT ;SEND IT - INX H ;PT TO NEXT - DJNZ PEEK4 - CALL PRINT ;CLOSING FENCE - DB FENCE+80H - CALL BREAK ;ALLOW ABORT - JR PEEK2 -; - ENDIF ;PEEKON -; -; PRINT A AS 2 HEX CHARS -; PASHC - LEADING SPACE -; - IF PEEKON OR POKEON -PASHC: - PUSH PSW ;SAVE A - CALL PRINT - DB ' '+80H - POP PSW -PAHC: - PUSH B ;SAVE BC - MOV C,A ;BYTE IN C - RRC ;EXCHANGE NYBBLES - RRC - RRC - RRC - CALL PAH ;PRINT HEX CHAR - MOV A,C ;GET LOW - POP B ;RESTORE BC AND FALL THRU TO PAH -PAH: - ANI 0FH ;MASK - ADI '0' ;CONVERT TO ASCII - CPI '9'+1 ;LETTER? - JRC PAH1 - ADI 7 ;ADJUST TO LETTER -PAH1: - JMP CONOUT -; - ENDIF ;PEEKON OR POKEON -; -;Section 5I -;Command: POKE -;Function: Place Values into Memory -; -;Form: -; POKE startadr val1 val2 ... -; - IF POKEON -POKE: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; - IF WPOKE - CALL WHLTST - ENDIF ;WHEEL APPROVAL -; - CALL RETSAVE - LXI H,TBUFF+1 ;PT TO FIRST CHAR - CALL SKSP ;SKIP TO NON-BLANK - JRZ NOARGS ;ARG ERROR - CALL HEXNUM ;CONVERT TO NUMBER - CALL PRINT - DB ' Pok','e'+80H - CALL ADRAT ;PRINT AT MESSAGE -; -; LOOP FOR STORING HEX VALUES SEQUENTIALLY VIA POKE -; -POKE1: - PUSH D ;SAVE ADDRESS - CALL SKSP ;SKIP TO NON-BLANK - JZ EXIT ;DONE - CPI '"' ;QUOTED TEXT? - JRZ POKE2 - CALL HEXNUM ;GET NUMBER - MOV A,E ;GET LOW - POP D ;GET ADDRESS - STAX D ;STORE NUMBER - INX D ;PT TO NEXT - JR POKE1 -; -; STORE ASCII CHARS -; -POKE2: - POP D ;GET NEXT ADDRESS - INX H ;PT TO NEXT CHAR -POKE3: - MOV A,M ;GET NEXT CHAR - ORA A ;DONE? - JZ EXIT - STAX D ;PUT CHAR - INX H ;PT TO NEXT - INX D - JR POKE3 -; -; No Argument Error -; -NOARGS: - CALL PRINT - DB ' Arg','?'+80H - JMP EXIT -; - ENDIF ;POKEON -; -;Section 5J -;Command: REG -;Function: Manipulate Memory Registers -; -;Forms: -; REG D or REG <-- Display Register Value -; REG Mreg <-- Decrement Register Value -; REG Preg <-- Increment Register Value -; REG Sreg value <-- Set Register Value -; - IF REGON -REGCMD: - LXI H,FCB1+1 ;PT TO FIRST ARG - MOV A,M ;GET FIRST CHAR - PUSH PSW ;SAVE CHAR - CPI 'A' ;ASSUME DIGIT IF LESS THAN 'A' - JRC REGC1 - INX H ;PT TO DIGIT -REGC1: - MOV A,M ;GET DIGIT - CALL REGPTR ;PT TO REGISTER - POP PSW ;GET CHAR - CPI 'S' ;SET? - JRZ RSET - CPI 'P' ;PLUS? - JRZ RINC - CPI 'M' ;MINUS? - JRZ RDEC -; -; SHOW REGISTER VALUES -; -RSHOW: - XRA A ;SELECT REGISTER 0 - MOV B,A ;COUNTER SET TO 0 IN B - CALL REGP2 ;HL PTS TO REGISTER 0 -RSHOW1: - MOV A,B ;GET COUNTER VALUE - CPI 10 - JZ CRLF ;NEW LINE AND EXIT IF DONE - CALL PRINT - DB ' Reg',' '+80H - MOV A,B ;PRINT REGISTER NUMBER - ADI '0' - CALL CONOUT - CALL PRINT - DB ' ','='+80H - PUSH B ;SAVE COUNTER - CALL REGOUT ;PRINT REGISTER VALUE - POP B ;GET COUNTER - INR B ;INCREMENT COUNTER - MOV A,B ;CHECK FOR NEW LINE - ANI 3 - CZ CRLF - INX H ;PT TO NEXT REGISTER - JR RSHOW1 -; -; INCREMENT REGISTER VALUE -; HL PTS TO MEMORY REGISTER ON INPUT -; -RINC: - INR M ;INCREMENT IT - JR REGOUT ;PRINT RESULT -; -; DECREMENT REGISTER VALUE -; HL PTS TO MEMORY REGISTER ON INPUT -; -RDEC: - DCR M ;DECREMENT VALUE - JR REGOUT ;PRINT RESULT -; -; SET REGISTER VALUE -; HL PTS TO REGISTER ON INPUT -; -RSET: - LXI D,FCB2+1 ;PT TO VALUE - MVI B,0 ;INIT VALUE TO ZERO -RSET1: - LDAX D ;GET NEXT DIGIT - INX D ;PT TO NEXT - SUI '0' ;CONVERT TO BINARY - JRC RSET2 - CPI 10 ;RANGE? - JRNC RSET2 - MOV C,A ;DIGIT IN C - MOV A,B ;MULTIPLY OLD BY 10 - ADD A ;*2 - ADD A ;*4 - ADD B ;*5 - ADD A ;*10 - ADD C ;ADD IN NEW DIGIT - MOV B,A ;RESULT IN B - JR RSET1 -RSET2: - MOV M,B ;SET VALUE -REGOUT: - CALL PRINT ;PRINT LEADING SPACE - DB ' '+80H - MOV A,M ;GET REGISTER VALUE - MVI B,100 ;PRINT 100'S - MVI C,0 ;SET LEADING SPACE FLAG - CALL DECB ;PRINT 100'S - MVI B,10 ;PRINT 10'S - CALL DECB ;PRINT 10'S - ADI '0' ;PRINT 1'S - JMP CONOUT -; -; SUBTRACT B FROM A UNTIL CARRY, THEN PRINT DIGIT COUNT -; -DECB: - MVI D,'0' ;SET DIGIT -DECB1: - SUB B ;SUBTRACT - JRC DECB2 - INR D ;ADD 1 TO DIGIT CHAR - JR DECB1 -DECB2: - ADD B ;ADD BACK IN - MOV E,A ;SAVE A IN E - MOV A,D ;GET DIGIT CHAR - CPI '0' ;LEADING ZERO CHECK - JRNZ DECB3 - MOV A,C ;ANY LEADING DIGIT YET? - ORA A - JRZ DECB4 -DECB3: - MOV A,D ;GET DIGIT CHAR - CALL CONOUT ;PRINT IT - INR C ;SET C<>0 FOR LEADING DIGIT CHECK -DECB4: - MOV A,E ;RESTORE A FOR NEXT ROUND - RET - -; -; SET HL TO POINT TO MEMORY REGISTER WHOSE INDEX IS PTED TO BY HL -; ON INPUT, A CONTAINS REGISTER CHAR -; ON OUTPUT, HL = ADDRESS OF MEMORY REGISTER (REG 0 ASSUMED IF ERROR) -; -REGPTR: - MVI B,0 ;INIT TO ZERO - SUI '0' ;CONVERT - JRC REGP1 - CPI 10 ;RANGE - JRNC REGP1 - MOV B,A ;VALUE IN B -REGP1: - MOV A,B ;VALUE IN A -REGP2: - LXI H,Z3MSG+30H ;PT TO MEMORY REGISTERS - ADD L ;PT TO PROPER REGISTER - MOV L,A - MOV A,H - ACI 0 - MOV H,A ;HL PTS TO REGISTER - RET -; - ENDIF ;REGON - -; -;Section 5K -;Command: WHL/WHLQ -;Function: Set the Wheel Byte on or off -; -;Form: -; WHL -- turn Wheel Byte OFF -; WHL password -- turn Wheel Byte ON if password is correct -; WHLQ -- find out status of Wheel Byte -; - IF WHLON -WHL: - LXI H,FCB1+1 ;PT TO FIRST CHAR - MOV A,M ;GET IT - CPI ' ' ;TURN BYTE OFF IF NO PASSWORD - JRZ WHLOFF - LXI D,WHLPASS - MVI B,8 ;CHECK 8 CHARS -WHL1: - LDAX D ;GET CHAR - CMP M ;COMPARE - JRNZ WHLMSG - INX H ;PT TO NEXT - INX D - DJNZ WHL1 -; -; TURN ON WHEEL BYTE -; - MVI A,0FFH ;TURN ON WHEEL BYTE - JR WHLSET -; -; TURN OFF WHEEL BYTE -; -WHLOFF: - XRA A ;TURN OFF WHEEL BYTE -WHLSET: - STA Z3WHL ;SET WHEEL BYTE AND PRINT MESSAGE -; -; PRINT WHEEL BYTE MESSAGE -; -WHLMSG: - CALL PRINT - DB ' Wheel Byte',' '+80H - LDA Z3WHL ;GET WHEEL BYTE - ORA A ;ZERO IS OFF - JRZ OFFM - CALL PRINT - DB 'O','N'+80H - RET -OFFM: - CALL PRINT - DB 'OF','F'+80H - RET -; -; WHEEL PASSWORD DEFINED FROM SYSRCP.LIB FILE -; - DB 'Z'-'@' ;LEADING ^Z IN CASE OF TYPE -WHLPASS: - WPASS ;USE MACRO -; - ENDIF ;WHLON - -; -;Section 5L -;Command: ECHO -;Function: Echo Text without Interpretation to Console or Printer -; -;Form: -; ECHO text <-- echo text to console -; ECHO $text <-- echo text to printer -; -; Additionally, if a form feed character is encountered in the -; output string, no further output will be done, a new line will be -; issued, and this will be followed by a form feed character. That is: -; -; ECHO $text^L -; -; will cause "text" to be printed on the printer followed by CR, LF, FF. -; -ECHO: - LXI H,TBUFF+1 ;PT TO FIRST CHAR -ECHO1: - MOV A,M ;SKIP LEADING SPACES - INX H ;PT TO NEXT - CPI ' ' - JRZ ECHO1 -; - IF ECHOLST - MOV B,A ;CHAR IN B - CPI '$' ;PRINT FLAG? - JRZ ECHO2 - ENDIF ;ECHOLST -; - DCX H ;PT TO CHAR -; -; LOOP TO ECHO CHARS -; -ECHO2: - MOV A,M ;GET CHAR - ORA A ;EOL? - JRZ ECHO4 -; - IF ECHOLST - CPI FF ;FORM FEED? - JRZ ECHO3 - ENDIF ;ECHOLST -; -ECHO2C: - CALL ECHOUT ;SEND CHAR - INX H ;PT TO NEXT - JR ECHO2 -; -; FORM FEED - SEND NEW LINE FOLLOWED BY FORM FEED IF PRINTER OUTPUT -; - IF ECHOLST -ECHO3: - MOV A,B ;CHECK FOR PRINTER OUTPUT - CPI '$' - JRNZ ECHOFF ;SEND FORM FEED NORMALLY IF NOT PRINTER - CALL ECHONL ;SEND NEW LINE - MVI A,FF ;SEND FORM FEED - JR ECHOUT -; -; SEND FORM FEED CHAR TO CONSOLE -; -ECHOFF: - MVI A,FF ;GET CHAR - JR ECHO2C - ENDIF ;ECHOLST -; -; END OF PRINT LOOP - CHECK FOR PRINTER TERMINATION -; -ECHO4: - IF NOT ECHOLST -; - RET -; - ELSE -; - MOV A,B ;CHECK FOR PRINTER OUTPUT - CPI '$' - RNZ ;DONE IF NO PRINTER OUTPUT -; -; OUTPUT A NEW LINE -; -ECHONL: - MVI A,CR ;OUTPUT NEW LINE ON PRINTER - CALL ECHOUT - MVI A,LF ;FALL THRU TO ECHOUT -; - ENDIF ;NOT ECHOLST -; -; OUTPUT CHAR TO PRINTER OR CONSOLE -; -ECHOUT: - MOV C,A ;CHAR IN C - PUSH H ;SAVE HL - PUSH B ;SAVE BC - LXI D,0CH-3 ;OFFSET FOR CONSOLE OUTPUT -; - IF ECHOLST - MOV A,B ;CHECK FOR PRINTER - CPI '$' - JRNZ ECHOUT1 - INX D ;ADD 3 FOR PRINTER OFFSET - INX D - INX D -; - ENDIF ;ECHOLST -; -; OUTPUT CHAR IN C WITH BIOS OFFSET IN DE -; -ECHOUT1: - CALL BIOUT ;BIOS OUTPUT - POP B ;RESTORE BC,HL - POP H - RET - -; -; OUTPUT CHAR IN C TO BIOS WITH OFFSET IN DE -; -BIOUT: - LHLD WBOOT+1 ;GET ADDRESS OF WARM BOOT - DAD D ;PT TO ROUTINE - PCHL ;JUMP TO IT - -; -; ** SUPPORT UTILITIES ** -; - -; -; CHECK FOR USER INPUT; IF ^C, RETURN WITH Z -; -BREAK: - PUSH H ;SAVE REGS - PUSH D - PUSH B - MVI E,0FFH ;GET CHAR IF ANY - MVI C,6 ;CONSOLE STATUS CHECK - CALL BDOS - POP B ;RESTORE REGS - POP D - POP H - CPI CTRLC ;CHECK FOR ABORT - JZ EXIT ;EXIT - CPI CTRLX ;SKIP? - RET - -; -; COPY HL TO DE FOR B BYTES -; -LDIR: - MOV A,M ;GET - STAX D ;PUT - INX H ;PT TO NEXT - INX D - DJNZ LDIR ;LOOP - RET - -; -; PRINT FILE NOT FOUND MESSAGE -; -PRFNF: - CALL PRINT - DB ' No File','s'+80H - JMP EXIT - -; -; OUTPUT NEW LINE TO CON: -; -CRLF: - MVI A,CR - CALL CONOUT - MVI A,LF - JMP CONOUT - -; -; SEARCH FOR FIRST AND NEXT -; -SEARF: - PUSH B ; SAVE COUNTER - PUSH H ; SAVE HL - MVI C,17 ; SEARCH FOR FIRST FUNCTION -SEARF1: - LXI D,FCB1 ; PT TO FCB - CALL BDOS - INR A ; SET ZERO FLAG FOR ERROR RETURN - POP H ; GET HL - POP B ; GET COUNTER - RET -SEARN: - PUSH B ; SAVE COUNTER - PUSH H ; SAVE HL - MVI C,18 ; SEARCH FOR NEXT FUNCTION - JR SEARF1 - -; -; CONSOLE INPUT -; -CONIN: - PUSH H ; SAVE REGS - PUSH D - PUSH B - MVI C,1 ; INPUT - CALL BDOS - POP B ; GET REGS - POP D - POP H - ANI 7FH ; MASK MSB - CPI 61H - RC - ANI 5FH ; TO UPPER CASE - RET - -; -; LOG INTO USER AREA CONTAINED IN FCB1 -; -LOGUSR: - LDA FCB1+13 ;GET USER NUMBER -SETUSR: - MOV E,A - MVI C,32 ;USE BDOS FCT - JMP BDOS - -; -; PRINT FILE NAME PTED TO BY HL -; -PRFN: - CALL PRINT ;LEADING SPACE - DB ' '+80H - MVI B,8 ;8 CHARS - CALL PRFN1 - MVI A,'.' ;DOT - CALL CONOUT - MVI B,3 ;3 CHARS -PRFN1: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - CALL CONOUT ; PRINT CHAR - DJNZ PRFN1 ; COUNT DOWN - RET - -; -; SAVE RETURN ADDRESS -; -RETSAVE: - POP D ; GET RETURN ADDRESS - POP H ; GET RETURN ADDRESS TO ZCPR3 - SHLD Z3RET ; SAVE IT - PUSH H ; PUT RETURN ADDRESS TO ZCPR3 BACK - PUSH D ; PUT RETURN ADDRESS BACK - RET - -; -; EXIT TO ZCPR3 -; -EXIT: -Z3RET EQU $+1 ; POINTER TO IN-THE-CODE MODIFICATION - LXI H,0 ; RETURN ADDRESS - PCHL ; GOTO ZCPR3 - -; -; TEST WHEEL BYTE FOR APPROVAL -; IF WHEEL BYTE IS 0 (OFF), ABORT WITH A MESSAGE (FLUSH RET ADR AND EXIT) -; - IF WHEEL ;IF ANY WHEEL OPTION IS RUNNING -WHLTST: - LDA Z3WHL ;GET WHEEL BYTE - ORA A ;ZERO? - RNZ - POP PSW ;CLEAR STACK - CALL PRINT - DB ' No Whee','l'+80H - RET - ENDIF ;WHEEL - -; -; PRINT A DASH -; - IF LTON OR PEEKON -DASH: - CALL PRINT - DB ' -',' '+80H - RET -; - ENDIF ;LTON OR PEEKON -; -; PRINT ADDRESS MESSAGE -; PRINT ADDRESS IN DE -; - IF PEEKON OR POKEON -ADRAT: - CALL PRINT - DB ' at',' '+80H - MOV A,D ;PRINT HIGH - CALL PAHC - MOV A,E ;PRINT LOW - JMP PAHC -; -; EXTRACT HEXADECIMAL NUMBER FROM LINE PTED TO BY HL -; RETURN WITH VALUE IN DE AND HL PTING TO OFFENDING CHAR -; -HEXNUM: - LXI D,0 ;DE=ACCUMULATED VALUE - MVI B,5 ;B=CHAR COUNT -HNUM1: - MOV A,M ;GET CHAR - CPI ' '+1 ;DONE? - RC ;RETURN IF SPACE OR LESS - INX H ;PT TO NEXT - SUI '0' ;CONVERT TO BINARY - JRC NUMERR ;RETURN AND DONE IF ERROR - CPI 10 ;0-9? - JRC HNUM2 - SUI 7 ;A-F? - CPI 10H ;ERROR? - JRNC NUMERR -HNUM2: - MOV C,A ;DIGIT IN C - MOV A,D ;GET ACCUMULATED VALUE - RLC ;EXCHANGE NYBBLES - RLC - RLC - RLC - ANI 0F0H ;MASK OUT LOW NYBBLE - MOV D,A - MOV A,E ;SWITCH LOW-ORDER NYBBLES - RLC - RLC - RLC - RLC - MOV E,A ;HIGH NYBBLE OF E=NEW HIGH OF E, - ; LOW NYBBLE OF E=NEW LOW OF D - ANI 0FH ;GET NEW LOW OF D - ORA D ;MASK IN HIGH OF D - MOV D,A ;NEW HIGH BYTE IN D - MOV A,E - ANI 0F0H ;MASK OUT LOW OF E - ORA C ;MASK IN NEW LOW - MOV E,A ;NEW LOW BYTE IN E - DJNZ HNUM1 ;COUNT DOWN - RET -; -; NUMBER ERROR -; -NUMERR: - CALL PRINT - DB ' Num','?'+80H - JMP EXIT -; -; SKIP TO NEXT NON-BLANK -; -SKSP: - MOV A,M ;GET CHAR - INX H ;PT TO NEXT - CPI ' ' ;SKIP SPACES - JRZ SKSP - DCX H ;PT TO GOOD CHAR - ORA A ;SET EOL FLAG - RET -; - ENDIF ;PEEKON OR POKEON -; -; Test File in FCB for unambiguity and existence, ask user to delete if so -; Return with Z flag set if R/O or no permission to delete -; - IF RENON OR CPON -EXTEST: - CALL AMBCHK ;AMBIGUOUS FILE NAMES NOT ALLOWED - CALL SEARF ;LOOK FOR SPECIFIED FILE - JRZ EXOK ;OK IF NOT FOUND - CALL GETSBIT ;POSITION INTO DIR - INX D ;PT TO FILE NAME - XCHG ;HL PTS TO FILE NAME - PUSH H ;SAVE PTR TO FILE NAME - CALL PRFN ;PRINT FILE NAME - POP H - CALL ROTEST ;CHECK FOR R/O - JRNZ EXER - CALL ERAQ ;ERASE? - JRNZ EXER ;RESTART AS ERROR IF NO - LXI D,FCB1 ;PT TO FCB1 - MVI C,19 ;DELETE FILE - CALL BDOS -EXOK: - XRA A - DCR A ;NZ = OK - RET -EXER: - XRA A ;ERROR FLAG - FILE IS R/O OR NO PERMISSION - RET - -; -; CHECK FOR AMBIGUOUS FILE NAME IN FCB1 -; RETURN Z IF SO -; -AMBCHK: - LXI H,FCB1+1 ;PT TO FCB -; -; CHECK FOR AMBIGUOUS FILE NAME PTED TO BY HL -; -AMBCHK1: - PUSH H - MVI B,11 ;11 BYTES -AMB1: - MOV A,M ;GET CHAR - ANI 7FH ;MASK - CPI '?' - JRZ AMB2 - INX H ;PT TO NEXT - DJNZ AMB1 - DCR B ;SET NZ FLAG - POP D - RET -AMB2: - POP H ;PT TO FILE NAME - CALL PRFN - CALL PRINT - DB ' is AF','N'+80H - JMP EXIT -; - ENDIF ;RENON OR CPON -; -; CHECK USER TO SEE IF HE APPROVES ERASE OF FILE -; RETURN WITH Z IF YES -; - IF RENON OR CPON OR ERAON OR PROTON -ERAQ: - CALL PRINT - DB ' - Eras','e'+80H -ERAQ1: - CALL PRINT - DB ' (Y/N)?',' '+80H - CALL CONIN ;GET RESPONSE - CPI 'Y' ;KEY ON YES - RET -; - ENDIF ;RENON OR CPON OR ERAON OR PROTON -; -; TEST FILE PTED TO BY HL FOR R/O -; NZ IF R/O -; - IF RENON OR ERAON OR CPON -ROTEST: - PUSH H ;ADVANCE TO R/O BYTE - LXI B,8 ;PT TO 9TH BYTE - DAD B - MOV A,M ;GET IT - ANI 80H ;MASK BIT - PUSH PSW - LXI H,ROMSG - CNZ PRINT1 ;PRINT IF NZ - POP PSW ;GET FLAG - POP H ;GET PTR - RET -ROMSG: - DB ' is R/','O'+80H -; - ENDIF ;RENON OR ERAON OR CPON -; -; INIT FCB1, RETURN WITH DE PTING TO FCB1 -; - IF ERAON OR LTON OR CPON -INITFCB1: - LXI H,FCB1 ;PT TO FCB -INITFCB2: - PUSH H ;SAVE PTR - LXI B,12 ;PT TO FIRST BYTE - DAD B - MVI B,24 ;ZERO 24 BYTES - XRA A ;ZERO FILL - CALL FILLP ;FILL MEMORY - POP D ;PT TO FCB - RET -; - ENDIF ;ERAON OR LTON OR CPON -; -; BUFFERS -; -NXTFILE: - DS 2 ;PTR TO NEXT FILE IN LIST - -; -; SIZE ERROR TEST -; - IF ($ GT (RCP + RCPS*128)) -SIZERR EQU NOVALUE ;RCP IS TOO LARGE FOR BUFFER - ENDIF - -; -; END OF SYS.RCP -; - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSRCP.HLP b/Source/Images/d_bp/u15/SYSRCP.HLP deleted file mode 100644 index 21fd7a79..00000000 --- a/Source/Images/d_bp/u15/SYSRCP.HLP +++ /dev/null @@ -1,229 +0,0 @@ -The Commands in SYSRCP -CP Copy a File -DIR Display Directory -ECHO Echo Command Tail -ERA Erase Files -LIST/TYPE Display a File on Printer/CRT -NOTE Comment -PEEK/POKE Display/Alter Memory -PROT Protect Files -REG ZCPR3 Register Display/Alter -REN Rename a File -WHL Set/Reset Wheel Byte -:The Commands in SYSRCP - - Thå  standarä  ZCPR³  Systeí Residenô  Commanä  Packagå -(RCP© distributeä witè thå ZCPR³ systeí containó á numbeò oæ -commandó  whicè  maù  bå enableä aô thå  discretioî  oæ  thå -installer. These commands are described in the HELP file. - - Alì  commandó anä optionó  arå  installation-dependent® -Thå  SHO×  commanä maù bå useä tï displaù thå nameó  oæ  thå -available commands in the currently-loaded RCP. - -:CP Command - Transient Counterpart: MCOPY - - Thå  CР commanä  copieó onå filå  froí  onå  DÕ  tï -anotheò  oò  intï thå samå DÕ undeò á differenô  name®  Thå -syntaø is: - - CP dir:ufn=dir:ufn - - Examples: - CP f1.txt=f2.txt - CP a15:=f1.txt - CP a15:f2.txt=c5:f1.txt - -:DIR Command - Transient Counterpart: DIR, XD, XDIR - - Thå  DIÒ commanä displayó thå directorù oæ fileó  iî -alphabeticaì ordeò acrosó thå lineó tï thå user® Thå syntaø -is: - - DIR dir:afn o - - Options are: - S - Display System Files Only - A - Display Both Non-System and System Files - - Examples: - DIR b7: - DIR root:*.com - -:ECHO Command Š Transient Counterpart: ECHO - - ECHÏ  ió  usefuì iî issuinç botè  messageó  (tï  thå -user¬ saù withiî á commanä filå durinç execution© anä escapå -sequences®  ECHÏ  caî  senä itó outpuô tï thå  consolå  (bù -default© oò tï thå printeò (iæ thå firsô non-blanë characteò -ió  á  dollaò sign)®  Iô useó BIOÓ calls¬  sï  alì  controì -characteró   arå  passeä  exactly®   Hence¬   console-leveì -programminç oæ sucè deviceó (CRTó anä Printers© ió possible. - - Examples: - - ECHO $this is a test - -- THIS IS A TEST is printed on printer - - ECHO this is a test - -- THIS IS A TEST is printed on console - -:ERA Command - Transient Counterpart: ERASE - - Thå ERÁ commanä eraseó files® Thå syntaø is: - - ERA dir:afn -or: - ERA dir:afn I -- Inspect files first - - Examples: - ERA b7:*.bak - ERA text:*.tmp i - -:LIST and TYPE Commands - Transient Counterpart: PRINT and PAGE - - Thå  TYPÅ  commanä displayó á grouð oæ fileó oî  thå -CRÔ  whilå thå LISÔ commanä printó á grouð oæ fileó  oî  thå -Printer® Thå syntaø is: - - TYPE dir:afn o -or- LIST dir:afn - - Option to TYPE: - P - Do NOT Page Output to CRT - - Examples: - TYPE b7:*.asm - LIST text:*.txt - -:NOTE Command - Transient Counterpart: NOTE - - NOTÅ ió simplù á NOÐ (dï nothing© commanä whicè  caî -bå useä tï placå commentó intï multiplå commanä lines®  Foò -instance¬ iî thå followinç line: - - dir *.comnote this is a dir displayera *.bak Š -thå  DIÒ anä ERÁ commandó perforí normally¬  anä NOTÅ simplù -doeó nothinç verù efficiently. - -:PEEK and POKE Commands - Transient Counterpart: None (Subset of DDT) - - Thå  PEEË commanä allowó thå useò tï examinå á chunë -oæ  memory®  Iæ thå useò simplù typeó "P¢ witè nï  address¬ -thå  nexô 25¶ byteó oæ memorù arå displayed®  Iæ  thå  useò -typeó  "Р address"¬  25¶  byteó oæ memorù startinç  aô  thå -indicateä addresó arå displayed® Iæ thå useò typeó "Ð addr± -addr2"¬  memorù  iî thió addresó rangå  ió  displayed®  Thå -syntax: - - P -or: - P address -or: - P addr1 addr2 - - - Thå  POKÅ  commanä  allowó thå useò  tï  changå  thå -contenô  oæ  memory®  Thå useò musô specifù aî  addresó  tï -POKE¬ anä twï basiã formó arå allowed: - - POKE address val1 val2 ... valn -and: - POKE address "character string - -Thå  twï  formó maù bå intermixeä witè leadinç valueó anä  á -trailinç characteò string: - - POKE address val1 val2 ... valn "character string - - - Examples: - P - P f400 - P f400 f425 - POKE f400 0 1 2 - POKE f400 "this is a test - POKE f400 1 2 3 "hello, world - -:PROT Command - Transient Counterpart: PROTECT - - Thå PROÔ commanä setó thå filå protectioî attributeó -foò á grouð oæ files®  Thå R/Ï anä Systeí attributeó maù bå -seô witè thå Ò anä Ó options¬  resp¬  giveî iî anù ordeò  aó -"RS¢ oò "SR"®  Omissioî oæ onå oæ theså optionó toggleó thå -oppositå  (ie¬  omissioî  oæ Ò makeó thå  fileó  R/W)®  Thå -syntax: - - PROT dir:afn -or: - PROT dir:afn R -or: - PROT dir:afn S -or: - PROT dir:afn RS -or- PROT dir:afn SR - - Examples: - PROT b7:*.com rs - PROT text:*.txt -:REG Command - Transient Counterpart: REG - - The REG command forms are: - REG D or REG = display values of all registers - REG Mreg = subtract 1 from register (Minus) - REG Preg = add 1 to register (Plus) - REG Sreg value = set value of indicated register - - Á registeò ió á ZCPR³ registeò buffer¬  indicateä bù -á digiô froí ° tï 9. - - Examples: - REG S0 4 -- reg 0 = 4 - REG S5 -- reg 5 = 0 - REG P -- reg 0 = reg 0 + 1 - REG P5 -- reg 5 = reg 5 + 1 - REG M9 -- reg 9 = reg 9 - 1 - REG D -- show values - REG -- show values -:REN Command - Transient Counterpart: RENAME - - Thå  REΠ commanä  changeó thå namå oæ onå  filå  tï -another® Thå syntax: Š - REN dir:ufn1=ufn2 - - Examples: - REN newfile.txt=oldfile.txt - REN root:sys.rcp=sys1.rcp - -:WHL Command - Transient Counterpart: WHEEL - - Thå  WHÌ commanä ió useä tï turî ofæ thå Wheeì  Bytå -(makå thå useò non-priveleged© oò tï turî oî thå Wheeì  Bytå -(makå thå useò priveleged)® Thå syntaø is: - - WHL -- make user non-priveleged -or: - WHL password -- make user priveleged - - Also¬  thió  equatå enableó thå WHLÑ command¬  whicè -displayó thå statå oæ thå Wheeì Byte® Thå syntaø is: - - WHLQ - - The Wheel password is built into the RCP. - - - Examples: - WHL - WHL mypass - WHLQ - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSRCP1.LIB b/Source/Images/d_bp/u15/SYSRCP1.LIB deleted file mode 100644 index dce5873b..00000000 --- a/Source/Images/d_bp/u15/SYSRCP1.LIB +++ /dev/null @@ -1,367 +0,0 @@ -; SYSTEM SEGMENT: SYS1.RCP -; SYSTEM: ZCPR3 -; WRITTEN BY: RICHARD CONN - -; -; PROGRAM HEADER: SYSRCP.LIB -; AUTHOR: RICHARD CONN -; - -; -; This program header selects the commands to be incorporated into -; SYS.RCP. It also allows selection of some options for these commands. -; - -; -; 0. ID -; -; The following ID is a single character, displayed as a part of -; the RCP ID, which distinguishes this RCP from others made from the same -; base file (SYSRCP.ASM). -; -RCPID EQU 'A' - -; -; 1. CP COMMAND -; TRANSIENT COUNTERPART: MCOPY -; -; The following equate determines if the CP command is made available. -; Setting this equate to TRUE enables the CP command. -; -; The CP command copies one file from one DU to another or into the -; same DU under a different name. The syntax is: -; -; CP dir:ufn=dir:ufn -; -; Examples: -; CP f1.txt=f2.txt -; CP a15:=f1.txt -; CP a15:f2.txt=c5:f1.txt -; -CPON EQU TRUE - -; -; 2. DIR COMMAND -; TRANSIENT COUNTERPART: DIR, XD, XDIR -; -; The following equate determines if the DIR command is made available. -; Setting this equate to TRUE enables the DIR command. -; -; The DIR command displays the directory of files in alphabetical order -; across the lines to the user. The syntax is: -; -; DIR dir:afn -; -; Examples: -; DIR b7: -; DIR root:*.com -; -DIRON EQU FALSE - -; -; The DIR command allows two options. One is a flag to tell it -; to look at both System and Non-System files, and the other is a flag -; to tell it to look only at System files. By default, DIR looks at -; Non-System files. -; -; SYSFLG defines the character used to instruct DIR to look at -; both System and Non-System files. The recommended value is 'A' for All. -; -; SOFLG defines the character used to instruct DIR to look at -; only System files. The recommended value is 'S' for System. -; -SYSFLG EQU 'A' -SOFLG EQU 'S' - -; -; The following equate determines if the directory displays are -; sorted by filename and filetype or by filetype and filename. Set SORTNT -; to TRUE to sort by name and type, FALSE to sort by type and name. -; -SORTNT EQU TRUE - -; -; The following equates define some features of the directory display. -; If WIDE is TRUE, the file names are spaced farther abort; if WIDE is FALSE, -; they are closer together (for a 64-column display). FENCE defines the -; character used to separate the file name entries in the display. -; -WIDE EQU TRUE -FENCE EQU '|' - -; -; 3. ERA COMMAND -; TRANSIENT COUNTERPART: ERASE -; -; The following equate determines if the ERA command is made available. -; Setting this equate to TRUE enables the ERA command. -; -; The ERA command erases files. The syntax is: -; -; ERA dir:afn -; or: -; ERA dir:afn I -- Inspect -; -; Examples: -; ERA b7:*.bak -; ERA text:*.tmp i -; -ERAON EQU TRUE - -; -; 4. LIST and TYPE COMMANDS -; TRANSIENT COUNTERPART: PRINT and PAGE -; -; The following equate determines if the LIST and TYPE commands are -; made available. Setting this equate to TRUE enables these commands. -; -; The LISTON equate can disable the LIST command without affecting the -; TYPE command. -; -; The TYPE command displays a group of files on the CRT while the -; LIST command prints a group of files on the Printer. The syntax is: -; -; TYPE dir:afn -or- LIST dir:afn -; -; Examples: -; TYPE b7:*.asm -; LIST text:*.txt -; -LTON EQU TRUE -LISTON EQU TRUE - -; -; TYPE can be made to page or not page by default. If PGDFLT is -; TRUE, TYPE pages by default and does not page if the PGFLG character -; (recommended to be 'P') is used. If PGDFLT is FALSE, TYPE pages only -; when the PGDFLG character is seen in the command line. -; -PGDFLT EQU TRUE -PGDFLG EQU 'P' - -; -; NLINES defines the number of lines on the user's CRT screen. -; This is usually 24. -; -NLINES EQU 24 - - -; -; 5. PEEK and POKE COMMANDS -; TRANSIENT COUNTERPART: None (Subset of DDT) -; -; The following equates determine if the PEEK and POKE commands are -; made available. Setting these equates to TRUE enables these commands. -; -; The PEEK command allows the user to examine a chunk of memory. -; If the user simply types "P" with no address, the next 256 bytes of -; memory are displayed. If the user types "P address", 256 bytes of memory -; starting at the indicated address are displayed. If the user types -; "P addr1 addr2", memory in this address range is displayed. The syntax: -; -; P -; or: -; P address -; or: -; P addr1 addr2 -; -; The POKE command allows the user to change the content of memory. -; The user must specify an address to POKE, and two basic forms are allowed: -; -; POKE address val1 val2 ... valn -; and: -; POKE address "character string -; The two forms may be intermixed with leading values and a trailing character -; string: -; POKE address val1 val2 ... valn "character string -; -; Examples: -; P -; P f400 -; P f400 f425 -; POKE f400 0 1 2 -; POKE f400 "this is a test -; POKE f400 1 2 3 "hello, world -; -PEEKON EQU TRUE -POKEON EQU TRUE - -; -; 6. PROT COMMAND -; TRANSIENT COUNTERPART: PROTECT -; -; The following equate determines if the PROT command is made available. -; Setting this equate to TRUE enables the PROT command. -; -; The PROT command sets the file protection attributes for a group of -; files. The R/O and System attributes may be set with the R and S options, -; resp, given in any order as "RS" or "SR". Omission of one of these options -; toggles the opposite (ie, omission of R makes the files R/W). The syntax: -; -; PROT dir:afn -; or: -; PROT dir:afn R -; or: -; PROT dir:afn S -; or: -; PROT dir:afn RS -or- PROT dir:afn SR -; -; Examples: -; PROT b7:*.com rs -; PROT text:*.txt -; -PROTON EQU TRUE - -; -; 7. REN COMMAND -; TRANSIENT COUNTERPART: RENAME -; -; The following equate determines if the REN command is made available. -; Setting this equate to TRUE enables the REN command. -; -; The REN command changes the name of one file to another. The syntax: -; -; REN dir:ufn1=ufn2 -; -; Examples: -; REN newfile.txt=oldfile.txt -; REN root:sys.rcp=sys1.rcp -; -RENON EQU TRUE - -; -; 8. The REG COMMAND -; TRANSIENT COUNTERPART: REG -; -; The following equate determines if the REG command is made -; available. Setting this equate to TRUE enables the REG command. -; -; The REG command forms are: -; REG D or REG = display values of all registers -; REG Mreg = subtract 1 from register (Minus) -; REG Preg = add 1 to register (Plus) -; REG Sreg value = set value of indicated register -; -; A register is a ZCPR3 register buffer, indicated by a digit from -; 0 to 9. -; -; Examples: -; REG S0 4 -- reg 0 = 4 -; REG S5 -- reg 5 = 0 -; REG P -- reg 0 = reg 0 + 1 -; REG P5 -- reg 5 = reg 5 + 1 -; REG M9 -- reg 9 = reg 9 - 1 -; REG D -- show values -; REG -- show values -; -REGON EQU FALSE - - -; -; 9. WHL COMMAND -; TRANSIENT COUNTERPART: WHEEL -; -; The following equate determines if the WHL command is made available. -; Setting this equate to TRUE enables the WHL command. -; -; The WHL command is used to turn off the Wheel Byte (make the user -; non-priveleged) or to turn on the Wheel Byte (make the user priveleged). -; The syntax is: -; -; WHL -- make user non-priveleged -; or: -; WHL password -- make user priveleged -; -; Also, this equate enables the WHLQ command, which displays the -; state of the Wheel Byte. The syntax is: -; -; WHLQ -; -; Examples: -; WHL -; WHL mypass -; WHLQ -; -WHLON EQU FALSE - -; -; The following equate defines the password to be used by the WHL -; command. It must always be 8 bytes long (trailing spaces allowed) and -; must be upper-case. -; -WPASS MACRO - DB 'SYSTEM ' ;8 characters - ENDM - -; -; The Wheel equate table enables the WHEEL facility of ZCPR3. With this -; facility, a WHEEL BYTE, which exists somewhere in memory, is examined -; before a set of installer-selected commands are executed. -; If this byte is not zero, then the command proceeds. If it is zero, -; then the command is not allowed to proceed and is exited with an error -; message. -; -; The following set of equates make each of the indicated commands -; selectable to respond to the Wheel Byte or not. For instance, if -; WERA=TRUE, then it responds to the Wheel Byte; if WERA=FALSE, it does not. -; -; These options will only be effective if a Wheel Byte is Defined -; (Z3WHL NE 0) -; -WCP equ FALSE ;Make CP a Wheel-Oriented Command -WDIR equ FALSE ; " DIR " " " " -WERA equ FALSE ; " ERA " " " " -WLIST equ FALSE ; " LIST " " " " -WPEEK equ FALSE ; " PEEK " " " " -WPOKE equ FALSE ; " POKE " " " " -WPROT equ FALSE ; " PROT " " " " -WREG equ FALSE ; " REG " " " " -WREN equ FALSE ; " REN " " " " -WTYPE equ FALSE ; " TYPE " " " " - -WHEEL set WCP OR WDIR OR WERA OR WLIST OR WPEEK OR WPOKE -WHEEL set WHEEL OR WPROT OR WREG OR WREN OR WTYPE - - -; -; 10. NOTE COMMAND -; TRANSIENT COUNTERPART: NOTE -; -; NOTE is simply a NOP (do nothing) command which can be used -; to place comments into multiple command lines. For instance, in the -; following line: -; -; dir *.com;note this is a dir display;era *.bak -; -; the DIR and ERA commands perform normally, and NOTE simply does -; nothing very efficiently. -; -; Setting the following equate to TRUE enables the NOTE Command. -; -NOTEON EQU TRUE - - -; -; 11. ECHO COMMAND -; TRANSIENT COUNTERPART: ECHO -; -; The following equate enables the ECHO command. -; -; ECHO is useful in issuing both messages (to the user, say within -; a command file during execution) and escape sequences. ECHO can send its -; output to the console (by default) or to the printer (if the first non- -; blank character is a dollar sign). It uses BIOS calls, so all control -; characters are passed exactly. Hence, console-level programming of such -; devices (CRTs and Printers) is possible. -; -; The ECHOLST equate determines if ECHO is allowed to direct its output -; to the printer. If ECHOLST is TRUE, ECHO may direct its output to the -; printer via the $ prefix character in the text. -; -ECHOON EQU TRUE -ECHOLST EQU TRUE - -; -; END of SYS.RCP CUSTOMIZATION -; - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSRCP11.LBR b/Source/Images/d_bp/u15/SYSRCP11.LBR deleted file mode 100644 index b4c48dd6..00000000 Binary files a/Source/Images/d_bp/u15/SYSRCP11.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/SYSRCP2.LIB b/Source/Images/d_bp/u15/SYSRCP2.LIB deleted file mode 100644 index 2930d34c..00000000 --- a/Source/Images/d_bp/u15/SYSRCP2.LIB +++ /dev/null @@ -1,368 +0,0 @@ -; SYSTEM SEGMENT: SYS2.RCP -; SYSTEM: ZCPR3 -; WRITTEN BY: RICHARD CONN - -; -; PROGRAM HEADER: SYSRCP.LIB -; AUTHOR: RICHARD CONN -; - -; -; This program header selects the commands to be incorporated into -; SYS.RCP. It also allows selection of some options for these commands. -; - -; -; 0. ID -; -; The following ID is a single character, displayed as a part of -; the RCP ID, which distinguishes this RCP from others made from the same -; base file (SYSRCP.ASM). -; -RCPID EQU 'B' - -; -; 1. CP COMMAND -; TRANSIENT COUNTERPART: MCOPY -; -; The following equate determines if the CP command is made available. -; Setting this equate to TRUE enables the CP command. -; -; The CP command copies one file from one DU to another or into the -; same DU under a different name. The syntax is: -; -; CP dir:ufn=dir:ufn -; -; Examples: -; CP f1.txt=f2.txt -; CP a15:=f1.txt -; CP a15:f2.txt=c5:f1.txt -; -CPON EQU TRUE - -; -; 2. DIR COMMAND -; TRANSIENT COUNTERPART: DIR, XD, XDIR -; -; The following equate determines if the DIR command is made available. -; Setting this equate to TRUE enables the DIR command. -; -; The DIR command displays the directory of files in alphabetical order -; across the lines to the user. The syntax is: -; -; DIR dir:afn -; -; Examples: -; DIR b7: -; DIR root:*.com -; -DIRON EQU TRUE - -; -; The DIR command allows two options. One is a flag to tell it -; to look at both System and Non-System files, and the other is a flag -; to tell it to look only at System files. By default, DIR looks at -; Non-System files. -; -; SYSFLG defines the character used to instruct DIR to look at -; both System and Non-System files. The recommended value is 'A' for All. -; -; SOFLG defines the character used to instruct DIR to look at -; only System files. The recommended value is 'S' for System. -; -SYSFLG EQU 'A' -SOFLG EQU 'S' - -; -; The following equate determines if the directory displays are -; sorted by filename and filetype or by filetype and filename. Set SORTNT -; to TRUE to sort by name and type, FALSE to sort by type and name. -; -SORTNT EQU TRUE - -; -; The following equates define some features of the directory display. -; If WIDE is TRUE, the file names are spaced farther abort; if WIDE is FALSE, -; they are closer together (for a 64-column display). FENCE defines the -; character used to separate the file name entries in the display. -; -WIDE EQU TRUE -FENCE EQU '|' - -; -; 3. ERA COMMAND -; TRANSIENT COUNTERPART: ERASE -; -; The following equate determines if the ERA command is made available. -; Setting this equate to TRUE enables the ERA command. -; -; The ERA command erases files. The syntax is: -; -; ERA dir:afn -; or: -; ERA dir:afn I -- Inspect -; -; Examples: -; ERA b7:*.bak -; ERA text:*.tmp i -; -ERAON EQU TRUE - -; -; 4. LIST and TYPE COMMANDS -; TRANSIENT COUNTERPART: PRINT and PAGE -; -; The following equate determines if the LIST and TYPE commands are -; made available. Setting this equate to TRUE enables these commands. -; -; The LISTON equate can disable the LIST command without affecting the -; TYPE command. -; -; The TYPE command displays a group of files on the CRT while the -; LIST command prints a group of files on the Printer. The syntax is: -; -; TYPE dir:afn -or- LIST dir:afn -; -; Examples: -; TYPE b7:*.asm -; LIST text:*.txt -; -LTON EQU TRUE -LISTON EQU TRUE - -; -; TYPE can be made to page or not page by default. If PGDFLT is -; TRUE, TYPE pages by default and does not page if the PGFLG character -; (recommended to be 'P') is used. If PGDFLT is FALSE, TYPE pages only -; when the PGDFLG character is seen in the command line. -; -PGDFLT EQU TRUE -PGDFLG EQU 'P' - -; -; NLINES defines the number of lines on the user's CRT screen. -; This is usually 24. -; -NLINES EQU 24 - - -; -; 5. PEEK and POKE COMMANDS -; TRANSIENT COUNTERPART: None (Subset of DDT) -; -; The following equates determine if the PEEK and POKE commands are -; made available. Setting these equates to TRUE enables these commands. -; -; The PEEK command allows the user to examine a chunk of memory. -; If the user simply types "P" with no address, the next 256 bytes of -; memory are displayed. If the user types "P address", 256 bytes of memory -; starting at the indicated address are displayed. If the user types -; "P addr1 addr2", memory in this address range is displayed. The syntax: -; -; P -; or: -; P address -; or: -; P addr1 addr2 -; -; The POKE command allows the user to change the content of memory. -; The user must specify an address to POKE, and two basic forms are allowed: -; -; POKE address val1 val2 ... valn -; and: -; POKE address "character string -; The two forms may be intermixed with leading values and a trailing character -; string: -; POKE address val1 val2 ... valn "character string -; -; Examples: -; P -; P f400 -; P f400 f425 -; POKE f400 0 1 2 -; POKE f400 "this is a test -; POKE f400 1 2 3 "hello, world -; -PEEKON EQU TRUE -POKEON EQU TRUE - -; -; 6. PROT COMMAND -; TRANSIENT COUNTERPART: PROTECT -; -; The following equate determines if the PROT command is made available. -; Setting this equate to TRUE enables the PROT command. -; -; The PROT command sets the file protection attributes for a group of -; files. The R/O and System attributes may be set with the R and S options, -; resp, given in any order as "RS" or "SR". Omission of one of these options -; toggles the opposite (ie, omission of R makes the files R/W). The syntax: -; -; PROT dir:afn -; or: -; PROT dir:afn R -; or: -; PROT dir:afn S -; or: -; PROT dir:afn RS -or- PROT dir:afn SR -; -; Examples: -; PROT b7:*.com rs -; PROT text:*.txt -; -PROTON EQU FALSE - -; -; 7. REN COMMAND -; TRANSIENT COUNTERPART: RENAME -; -; The following equate determines if the REN command is made available. -; Setting this equate to TRUE enables the REN command. -; -; The REN command changes the name of one file to another. The syntax: -; -; REN dir:ufn1=ufn2 -; -; Examples: -; REN newfile.txt=oldfile.txt -; REN root:sys.rcp=sys1.rcp -; -RENON EQU TRUE - -; -; 8. The REG COMMAND -; TRANSIENT COUNTERPART: REG -; -; The following equate determines if the REG command is made -; available. Setting this equate to TRUE enables the REG command. -; -; The REG command forms are: -; REG D or REG = display values of all registers -; REG Mreg = subtract 1 from register (Minus) -; REG Preg = add 1 to register (Plus) -; REG Sreg value = set value of indicated register -; -; A register is a ZCPR3 register buffer, indicated by a digit from -; 0 to 9. -; -; Examples: -; REG S0 4 -- reg 0 = 4 -; REG S5 -- reg 5 = 0 -; REG P -- reg 0 = reg 0 + 1 -; REG P5 -- reg 5 = reg 5 + 1 -; REG M9 -- reg 9 = reg 9 - 1 -; REG D -- show values -; REG -- show values -; -REGON EQU FALSE - - -; -; 9. WHL COMMAND -; TRANSIENT COUNTERPART: WHEEL -; -; The following equate determines if the WHL command is made available. -; Setting this equate to TRUE enables the WHL command. -; -; The WHL command is used to turn off the Wheel Byte (make the user -; non-priveleged) or to turn on the Wheel Byte (make the user priveleged). -; The syntax is: -; -; WHL -- make user non-priveleged -; or: -; WHL password -- make user priveleged -; -; Also, this equate enables the WHLQ command, which displays the -; state of the Wheel Byte. The syntax is: -; -; WHLQ -; -; Examples: -; WHL -; WHL mypass -; WHLQ -; -WHLON EQU FALSE - -; -; The following equate defines the password to be used by the WHL -; command. It must always be 8 bytes long (trailing spaces allowed) and -; must be upper-case. -; -WPASS MACRO - DB 'SYSTEM ' ;8 characters - ENDM - -; -; The Wheel equate table enables the WHEEL facility of ZCPR3. With this -; facility, a WHEEL BYTE, which exists somewhere in memory, is examined -; before a set of installer-selected commands are executed. -; If this byte is not zero, then the command proceeds. If it is zero, -; then the command is not allowed to proceed and is exited with an error -; message. -; -; The following set of equates make each of the indicated commands -; selectable to respond to the Wheel Byte or not. For instance, if -; WERA=TRUE, then it responds to the Wheel Byte; if WERA=FALSE, it does not. -; -; These options will only be effective if a Wheel Byte is Defined -; (Z3WHL NE 0) -; -WCP equ FALSE ;Make CP a Wheel-Oriented Command -WDIR equ FALSE ; " DIR " " " " -WERA equ FALSE ; " ERA " " " " -WLIST equ FALSE ; " LIST " " " " -WPEEK equ FALSE ; " PEEK " " " " -WPOKE equ FALSE ; " POKE " " " " -WPROT equ FALSE ; " PROT " " " " -WREG equ FALSE ; " REG " " " " -WREN equ FALSE ; " REN " " " " -WTYPE equ FALSE ; " TYPE " " " " - -WHEEL set WCP OR WDIR OR WERA OR WLIST OR WPEEK OR WPOKE -WHEEL set WHEEL OR WPROT OR WREG OR WREN OR WTYPE - - -; -; 10. NOTE COMMAND -; TRANSIENT COUNTERPART: NOTE -; -; NOTE is simply a NOP (do nothing) command which can be used -; to place comments into multiple command lines. For instance, in the -; following line: -; -; dir *.com;note this is a dir display;era *.bak -; -; the DIR and ERA commands perform normally, and NOTE simply does -; nothing very efficiently. -; -; Setting the following equate to TRUE enables the NOTE Command. -; -NOTEON EQU TRUE - - -; -; 11. ECHO COMMAND -; TRANSIENT COUNTERPART: ECHO -; -; The following equate enables the ECHO command. -; -; ECHO is useful in issuing both messages (to the user, say within -; a command file during execution) and escape sequences. ECHO can send its -; output to the console (by default) or to the printer (if the first non- -; blank character is a dollar sign). It uses BIOS calls, so all control -; characters are passed exactly. Hence, console-level programming of such -; devices (CRTs and Printers) is possible. -; -; The ECHOLST equate determines if ECHO is allowed to direct its output -; to the printer. If ECHOLST is TRUE, ECHO may direct its output to the -; printer via the $ prefix character in the text. -; -ECHOON EQU TRUE -ECHOLST EQU TRUE - - -; -; END of SYS.RCP CUSTOMIZATION -; - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSRCP3.LIB b/Source/Images/d_bp/u15/SYSRCP3.LIB deleted file mode 100644 index d6c4df1c..00000000 --- a/Source/Images/d_bp/u15/SYSRCP3.LIB +++ /dev/null @@ -1,367 +0,0 @@ -; SYSTEM SEGMENT: SYS3.RCP -; SYSTEM: ZCPR3 -; WRITTEN BY: RICHARD CONN - -; -; PROGRAM HEADER: SYSRCP.LIB -; AUTHOR: RICHARD CONN -; - -; -; This program header selects the commands to be incorporated into -; SYS.RCP. It also allows selection of some options for these commands. -; - -; -; 0. ID -; -; The following ID is a single character, displayed as a part of -; the RCP ID, which distinguishes this RCP from others made from the same -; base file (SYSRCP.ASM). -; -RCPID EQU 'C' - -; -; 1. CP COMMAND -; TRANSIENT COUNTERPART: MCOPY -; -; The following equate determines if the CP command is made available. -; Setting this equate to TRUE enables the CP command. -; -; The CP command copies one file from one DU to another or into the -; same DU under a different name. The syntax is: -; -; CP dir:ufn=dir:ufn -; -; Examples: -; CP f1.txt=f2.txt -; CP a15:=f1.txt -; CP a15:f2.txt=c5:f1.txt -; -CPON EQU TRUE - -; -; 2. DIR COMMAND -; TRANSIENT COUNTERPART: DIR, XD, XDIR -; -; The following equate determines if the DIR command is made available. -; Setting this equate to TRUE enables the DIR command. -; -; The DIR command displays the directory of files in alphabetical order -; across the lines to the user. The syntax is: -; -; DIR dir:afn -; -; Examples: -; DIR b7: -; DIR root:*.com -; -DIRON EQU FALSE - -; -; The DIR command allows two options. One is a flag to tell it -; to look at both System and Non-System files, and the other is a flag -; to tell it to look only at System files. By default, DIR looks at -; Non-System files. -; -; SYSFLG defines the character used to instruct DIR to look at -; both System and Non-System files. The recommended value is 'A' for All. -; -; SOFLG defines the character used to instruct DIR to look at -; only System files. The recommended value is 'S' for System. -; -SYSFLG EQU 'A' -SOFLG EQU 'S' - -; -; The following equate determines if the directory displays are -; sorted by filename and filetype or by filetype and filename. Set SORTNT -; to TRUE to sort by name and type, FALSE to sort by type and name. -; -SORTNT EQU TRUE - -; -; The following equates define some features of the directory display. -; If WIDE is TRUE, the file names are spaced farther abort; if WIDE is FALSE, -; they are closer together (for a 64-column display). FENCE defines the -; character used to separate the file name entries in the display. -; -WIDE EQU TRUE -FENCE EQU '|' - -; -; 3. ERA COMMAND -; TRANSIENT COUNTERPART: ERASE -; -; The following equate determines if the ERA command is made available. -; Setting this equate to TRUE enables the ERA command. -; -; The ERA command erases files. The syntax is: -; -; ERA dir:afn -; or: -; ERA dir:afn I -- Inspect -; -; Examples: -; ERA b7:*.bak -; ERA text:*.tmp i -; -ERAON EQU TRUE - -; -; 4. LIST and TYPE COMMANDS -; TRANSIENT COUNTERPART: PRINT and PAGE -; -; The following equate determines if the LIST and TYPE commands are -; made available. Setting this equate to TRUE enables these commands. -; -; The LISTON equate can disable the LIST command without affecting the -; TYPE command. -; -; The TYPE command displays a group of files on the CRT while the -; LIST command prints a group of files on the Printer. The syntax is: -; -; TYPE dir:afn -or- LIST dir:afn -; -; Examples: -; TYPE b7:*.asm -; LIST text:*.txt -; -LTON EQU TRUE -LISTON EQU FALSE - -; -; TYPE can be made to page or not page by default. If PGDFLT is -; TRUE, TYPE pages by default and does not page if the PGFLG character -; (recommended to be 'P') is used. If PGDFLT is FALSE, TYPE pages only -; when the PGDFLG character is seen in the command line. -; -PGDFLT EQU TRUE -PGDFLG EQU 'P' - -; -; NLINES defines the number of lines on the user's CRT screen. -; This is usually 24. -; -NLINES EQU 24 - - -; -; 5. PEEK and POKE COMMANDS -; TRANSIENT COUNTERPART: None (Subset of DDT) -; -; The following equates determine if the PEEK and POKE commands are -; made available. Setting these equates to TRUE enables these commands. -; -; The PEEK command allows the user to examine a chunk of memory. -; If the user simply types "P" with no address, the next 256 bytes of -; memory are displayed. If the user types "P address", 256 bytes of memory -; starting at the indicated address are displayed. If the user types -; "P addr1 addr2", memory in this address range is displayed. The syntax: -; -; P -; or: -; P address -; or: -; P addr1 addr2 -; -; The POKE command allows the user to change the content of memory. -; The user must specify an address to POKE, and two basic forms are allowed: -; -; POKE address val1 val2 ... valn -; and: -; POKE address "character string -; The two forms may be intermixed with leading values and a trailing character -; string: -; POKE address val1 val2 ... valn "character string -; -; Examples: -; P -; P f400 -; P f400 f425 -; POKE f400 0 1 2 -; POKE f400 "this is a test -; POKE f400 1 2 3 "hello, world -; -PEEKON EQU TRUE -POKEON EQU TRUE - -; -; 6. PROT COMMAND -; TRANSIENT COUNTERPART: PROTECT -; -; The following equate determines if the PROT command is made available. -; Setting this equate to TRUE enables the PROT command. -; -; The PROT command sets the file protection attributes for a group of -; files. The R/O and System attributes may be set with the R and S options, -; resp, given in any order as "RS" or "SR". Omission of one of these options -; toggles the opposite (ie, omission of R makes the files R/W). The syntax: -; -; PROT dir:afn -; or: -; PROT dir:afn R -; or: -; PROT dir:afn S -; or: -; PROT dir:afn RS -or- PROT dir:afn SR -; -; Examples: -; PROT b7:*.com rs -; PROT text:*.txt -; -PROTON EQU FALSE - -; -; 7. REN COMMAND -; TRANSIENT COUNTERPART: RENAME -; -; The following equate determines if the REN command is made available. -; Setting this equate to TRUE enables the REN command. -; -; The REN command changes the name of one file to another. The syntax: -; -; REN dir:ufn1=ufn2 -; -; Examples: -; REN newfile.txt=oldfile.txt -; REN root:sys.rcp=sys1.rcp -; -RENON EQU TRUE - -; -; 8. The REG COMMAND -; TRANSIENT COUNTERPART: REG -; -; The following equate determines if the REG command is made -; available. Setting this equate to TRUE enables the REG command. -; -; The REG command forms are: -; REG D or REG = display values of all registers -; REG Mreg = subtract 1 from register (Minus) -; REG Preg = add 1 to register (Plus) -; REG Sreg value = set value of indicated register -; -; A register is a ZCPR3 register buffer, indicated by a digit from -; 0 to 9. -; -; Examples: -; REG S0 4 -- reg 0 = 4 -; REG S5 -- reg 5 = 0 -; REG P -- reg 0 = reg 0 + 1 -; REG P5 -- reg 5 = reg 5 + 1 -; REG M9 -- reg 9 = reg 9 - 1 -; REG D -- show values -; REG -- show values -; -REGON EQU FALSE - - -; -; 9. WHL COMMAND -; TRANSIENT COUNTERPART: WHEEL -; -; The following equate determines if the WHL command is made available. -; Setting this equate to TRUE enables the WHL command. -; -; The WHL command is used to turn off the Wheel Byte (make the user -; non-priveleged) or to turn on the Wheel Byte (make the user priveleged). -; The syntax is: -; -; WHL -- make user non-priveleged -; or: -; WHL password -- make user priveleged -; -; Also, this equate enables the WHLQ command, which displays the -; state of the Wheel Byte. The syntax is: -; -; WHLQ -; -; Examples: -; WHL -; WHL mypass -; WHLQ -; -WHLON EQU TRUE - -; -; The following equate defines the password to be used by the WHL -; command. It must always be 8 bytes long (trailing spaces allowed) and -; must be upper-case. -; -WPASS MACRO - DB 'SYSTEM ' ;8 characters - ENDM - -; -; The Wheel equate table enables the WHEEL facility of ZCPR3. With this -; facility, a WHEEL BYTE, which exists somewhere in memory, is examined -; before a set of installer-selected commands are executed. -; If this byte is not zero, then the command proceeds. If it is zero, -; then the command is not allowed to proceed and is exited with an error -; message. -; -; The following set of equates make each of the indicated commands -; selectable to respond to the Wheel Byte or not. For instance, if -; WERA=TRUE, then it responds to the Wheel Byte; if WERA=FALSE, it does not. -; -; These options will only be effective if a Wheel Byte is Defined -; (Z3WHL NE 0) -; -WCP equ TRUE ;Make CP a Wheel-Oriented Command -WDIR equ FALSE ; " DIR " " " " -WERA equ TRUE ; " ERA " " " " -WLIST equ FALSE ; " LIST " " " " -WPEEK equ TRUE ; " PEEK " " " " -WPOKE equ TRUE ; " POKE " " " " -WPROT equ TRUE ; " PROT " " " " -WREG equ FALSE ; " REG " " " " -WREN equ TRUE ; " REN " " " " -WTYPE equ FALSE ; " TYPE " " " " - -WHEEL set WCP OR WDIR OR WERA OR WLIST OR WPEEK OR WPOKE -WHEEL set WHEEL OR WPROT OR WREG OR WREN OR WTYPE - - -; -; 10. NOTE COMMAND -; TRANSIENT COUNTERPART: NOTE -; -; NOTE is simply a NOP (do nothing) command which can be used -; to place comments into multiple command lines. For instance, in the -; following line: -; -; dir *.com;note this is a dir display;era *.bak -; -; the DIR and ERA commands perform normally, and NOTE simply does -; nothing very efficiently. -; -; Setting the following equate to TRUE enables the NOTE Command. -; -NOTEON EQU TRUE - - -; -; 11. ECHO COMMAND -; TRANSIENT COUNTERPART: ECHO -; -; The following equate enables the ECHO command. -; -; ECHO is useful in issuing both messages (to the user, say within -; a command file during execution) and escape sequences. ECHO can send its -; output to the console (by default) or to the printer (if the first non- -; blank character is a dollar sign). It uses BIOS calls, so all control -; characters are passed exactly. Hence, console-level programming of such -; devices (CRTs and Printers) is possible. -; -; The ECHOLST equate determines if ECHO is allowed to direct its output -; to the printer. If ECHOLST is TRUE, ECHO may direct its output to the -; printer via the $ prefix character in the text. -; -ECHOON EQU TRUE -ECHOLST EQU FALSE - -; -; END of SYS.RCP CUSTOMIZATION -; - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/SYSRCP4.LIB b/Source/Images/d_bp/u15/SYSRCP4.LIB deleted file mode 100644 index e88c3d98..00000000 --- a/Source/Images/d_bp/u15/SYSRCP4.LIB +++ /dev/null @@ -1,367 +0,0 @@ -; SYSTEM SEGMENT: SYS4.RCP (for RCP/M Application) -; SYSTEM: ZCPR3 -; WRITTEN BY: RICHARD CONN - -; -; PROGRAM HEADER: SYSRCP.LIB -; AUTHOR: RICHARD CONN -; - -; -; This program header selects the commands to be incorporated into -; SYS.RCP. It also allows selection of some options for these commands. -; - -; -; 0. ID -; -; The following ID is a single character, displayed as a part of -; the RCP ID, which distinguishes this RCP from others made from the same -; base file (SYSRCP.ASM). -; -RCPID EQU 'R' - -; -; 1. CP COMMAND -; TRANSIENT COUNTERPART: MCOPY -; -; The following equate determines if the CP command is made available. -; Setting this equate to TRUE enables the CP command. -; -; The CP command copies one file from one DU to another or into the -; same DU under a different name. The syntax is: -; -; CP dir:ufn=dir:ufn -; -; Examples: -; CP f1.txt=f2.txt -; CP a15:=f1.txt -; CP a15:f2.txt=c5:f1.txt -; -CPON EQU TRUE - -; -; 2. DIR COMMAND -; TRANSIENT COUNTERPART: DIR, XD, XDIR -; -; The following equate determines if the DIR command is made available. -; Setting this equate to TRUE enables the DIR command. -; -; The DIR command displays the directory of files in alphabetical order -; across the lines to the user. The syntax is: -; -; DIR dir:afn -; -; Examples: -; DIR b7: -; DIR root:*.com -; -DIRON EQU FALSE - -; -; The DIR command allows two options. One is a flag to tell it -; to look at both System and Non-System files, and the other is a flag -; to tell it to look only at System files. By default, DIR looks at -; Non-System files. -; -; SYSFLG defines the character used to instruct DIR to look at -; both System and Non-System files. The recommended value is 'A' for All. -; -; SOFLG defines the character used to instruct DIR to look at -; only System files. The recommended value is 'S' for System. -; -SYSFLG EQU 'A' -SOFLG EQU 'S' - -; -; The following equate determines if the directory displays are -; sorted by filename and filetype or by filetype and filename. Set SORTNT -; to TRUE to sort by name and type, FALSE to sort by type and name. -; -SORTNT EQU TRUE - -; -; The following equates define some features of the directory display. -; If WIDE is TRUE, the file names are spaced farther abort; if WIDE is FALSE, -; they are closer together (for a 64-column display). FENCE defines the -; character used to separate the file name entries in the display. -; -WIDE EQU TRUE -FENCE EQU '|' - -; -; 3. ERA COMMAND -; TRANSIENT COUNTERPART: ERASE -; -; The following equate determines if the ERA command is made available. -; Setting this equate to TRUE enables the ERA command. -; -; The ERA command erases files. The syntax is: -; -; ERA dir:afn -; or: -; ERA dir:afn I -- Inspect -; -; Examples: -; ERA b7:*.bak -; ERA text:*.tmp i -; -ERAON EQU TRUE - -; -; 4. LIST and TYPE COMMANDS -; TRANSIENT COUNTERPART: PRINT and PAGE -; -; The following equate determines if the LIST and TYPE commands are -; made available. Setting this equate to TRUE enables these commands. -; -; The LISTON equate can disable the LIST command without affecting the -; TYPE command. -; -; The TYPE command displays a group of files on the CRT while the -; LIST command prints a group of files on the Printer. The syntax is: -; -; TYPE dir:afn -or- LIST dir:afn -; -; Examples: -; TYPE b7:*.asm -; LIST text:*.txt -; -LTON EQU TRUE -LISTON EQU TRUE - -; -; TYPE can be made to page or not page by default. If PGDFLT is -; TRUE, TYPE pages by default and does not page if the PGFLG character -; (recommended to be 'P') is used. If PGDFLT is FALSE, TYPE pages only -; when the PGDFLG character is seen in the command line. -; -PGDFLT EQU TRUE -PGDFLG EQU 'P' - -; -; NLINES defines the number of lines on the user's CRT screen. -; This is usually 24. -; -NLINES EQU 24 - - -; -; 5. PEEK and POKE COMMANDS -; TRANSIENT COUNTERPART: None (Subset of DDT) -; -; The following equates determine if the PEEK and POKE commands are -; made available. Setting these equates to TRUE enables these commands. -; -; The PEEK command allows the user to examine a chunk of memory. -; If the user simply types "P" with no address, the next 256 bytes of -; memory are displayed. If the user types "P address", 256 bytes of memory -; starting at the indicated address are displayed. If the user types -; "P addr1 addr2", memory in this address range is displayed. The syntax: -; -; P -; or: -; P address -; or: -; P addr1 addr2 -; -; The POKE command allows the user to change the content of memory. -; The user must specify an address to POKE, and two basic forms are allowed: -; -; POKE address val1 val2 ... valn -; and: -; POKE address "character string -; The two forms may be intermixed with leading values and a trailing character -; string: -; POKE address val1 val2 ... valn "character string -; -; Examples: -; P -; P f400 -; P f400 f425 -; POKE f400 0 1 2 -; POKE f400 "this is a test -; POKE f400 1 2 3 "hello, world -; -PEEKON EQU TRUE -POKEON EQU TRUE - -; -; 6. PROT COMMAND -; TRANSIENT COUNTERPART: PROTECT -; -; The following equate determines if the PROT command is made available. -; Setting this equate to TRUE enables the PROT command. -; -; The PROT command sets the file protection attributes for a group of -; files. The R/O and System attributes may be set with the R and S options, -; resp, given in any order as "RS" or "SR". Omission of one of these options -; toggles the opposite (ie, omission of R makes the files R/W). The syntax: -; -; PROT dir:afn -; or: -; PROT dir:afn R -; or: -; PROT dir:afn S -; or: -; PROT dir:afn RS -or- PROT dir:afn SR -; -; Examples: -; PROT b7:*.com rs -; PROT text:*.txt -; -PROTON EQU FALSE - -; -; 7. REN COMMAND -; TRANSIENT COUNTERPART: RENAME -; -; The following equate determines if the REN command is made available. -; Setting this equate to TRUE enables the REN command. -; -; The REN command changes the name of one file to another. The syntax: -; -; REN dir:ufn1=ufn2 -; -; Examples: -; REN newfile.txt=oldfile.txt -; REN root:sys.rcp=sys1.rcp -; -RENON EQU TRUE - -; -; 8. The REG COMMAND -; TRANSIENT COUNTERPART: REG -; -; The following equate determines if the REG command is made -; available. Setting this equate to TRUE enables the REG command. -; -; The REG command forms are: -; REG D or REG = display values of all registers -; REG Mreg = subtract 1 from register (Minus) -; REG Preg = add 1 to register (Plus) -; REG Sreg value = set value of indicated register -; -; A register is a ZCPR3 register buffer, indicated by a digit from -; 0 to 9. -; -; Examples: -; REG S0 4 -- reg 0 = 4 -; REG S5 -- reg 5 = 0 -; REG P -- reg 0 = reg 0 + 1 -; REG P5 -- reg 5 = reg 5 + 1 -; REG M9 -- reg 9 = reg 9 - 1 -; REG D -- show values -; REG -- show values -; -REGON EQU FALSE - - -; -; 9. WHL COMMAND -; TRANSIENT COUNTERPART: WHEEL -; -; The following equate determines if the WHL command is made available. -; Setting this equate to TRUE enables the WHL command. -; -; The WHL command is used to turn off the Wheel Byte (make the user -; non-priveleged) or to turn on the Wheel Byte (make the user priveleged). -; The syntax is: -; -; WHL -- make user non-priveleged -; or: -; WHL password -- make user priveleged -; -; Also, this equate enables the WHLQ command, which displays the -; state of the Wheel Byte. The syntax is: -; -; WHLQ -; -; Examples: -; WHL -; WHL mypass -; WHLQ -; -WHLON EQU FALSE - -; -; The following equate defines the password to be used by the WHL -; command. It must always be 8 bytes long (trailing spaces allowed) and -; must be upper-case. -; -WPASS MACRO - DB 'SYSTEM ' ;8 characters - ENDM - -; -; The Wheel equate table enables the WHEEL facility of ZCPR3. With this -; facility, a WHEEL BYTE, which exists somewhere in memory, is examined -; before a set of installer-selected commands are executed. -; If this byte is not zero, then the command proceeds. If it is zero, -; then the command is not allowed to proceed and is exited with an error -; message. -; -; The following set of equates make each of the indicated commands -; selectable to respond to the Wheel Byte or not. For instance, if -; WERA=TRUE, then it responds to the Wheel Byte; if WERA=FALSE, it does not. -; -; These options will only be effective if a Wheel Byte is Defined -; (Z3WHL NE 0) -; -WCP equ TRUE ;Make CP a Wheel-Oriented Command -WDIR equ FALSE ; " DIR " " " " -WERA equ TRUE ; " ERA " " " " -WLIST equ TRUE ; " LIST " " " " -WPEEK equ TRUE ; " PEEK " " " " -WPOKE equ TRUE ; " POKE " " " " -WPROT equ TRUE ; " PROT " " " " -WREG equ FALSE ; " REG " " " " -WREN equ TRUE ; " REN " " " " -WTYPE equ FALSE ; " TYPE " " " " - -WHEEL set WCP OR WDIR OR WERA OR WLIST OR WPEEK OR WPOKE -WHEEL set WHEEL OR WPROT OR WREG OR WREN OR WTYPE - - -; -; 10. NOTE COMMAND -; TRANSIENT COUNTERPART: NOTE -; -; NOTE is simply a NOP (do nothing) command which can be used -; to place comments into multiple command lines. For instance, in the -; following line: -; -; dir *.com;note this is a dir display;era *.bak -; -; the DIR and ERA commands perform normally, and NOTE simply does -; nothing very efficiently. -; -; Setting the following equate to TRUE enables the NOTE Command. -; -NOTEON EQU FALSE - - -; -; 11. ECHO COMMAND -; TRANSIENT COUNTERPART: ECHO -; -; The following equate enables the ECHO command. -; -; ECHO is useful in issuing both messages (to the user, say within -; a command file during execution) and escape sequences. ECHO can send its -; output to the console (by default) or to the printer (if the first non- -; blank character is a dollar sign). It uses BIOS calls, so all control -; characters are passed exactly. Hence, console-level programming of such -; devices (CRTs and Printers) is possible. -; -; The ECHOLST equate determines if ECHO is allowed to direct its output -; to the printer. If ECHOLST is TRUE, ECHO may direct its output to the -; printer via the $ prefix character in the text. -; -ECHOON EQU TRUE -ECHOLST EQU FALSE - -; -; END of SYS.RCP CUSTOMIZATION -; - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/T3M-HI2.Z80 b/Source/Images/d_bp/u15/T3M-HI2.Z80 deleted file mode 100644 index 4b4c3f2a..00000000 --- a/Source/Images/d_bp/u15/T3M-HI2.Z80 +++ /dev/null @@ -1,319 +0,0 @@ -; Program: T3M-HI2.Z80 -; Use: Term3 Modem Overlay -; Written by: David McCord -; Last revised: 04/02/87 -; -; Latest Revisions: -; dmm 4/02/87 v2.0 -; Reworked baud rate setting, adding support for 9.216MHz and 12.288MHz -; clock rates. Also added equate for selection of which serial port will -; be used, ASCI0 or ASCI1. You must set the clock rate equates and ASCI -; equates appropriately (below) before assembly! -; -; dmm 4/21/86 v1.0 -; Originally MODEMH80.Z80; renamed to conform to new naming standards -; for TERM III interface files (T3M-xx#.Z80 for "modem interfaces"; -; T3T-xx#.Z80 for "telephone interfaces"; and T3C-xx#.Z80 for combined -; modem AND telephone interfaces (as with the MOSART)). -; Fixed a minor bug in the mi$init routine. -; -; Term3 Modem Interface for SB180/HD64180 -; Uses HD64180 ASCI 0 (modem port on SB180) -; -; Modified from original MSB180.LIB file 03-21-86 by D. McCord -; Supports baud rates up to 38.4Kbps (max 19.2Kbps for 9.216MHz clock) -; -; This program, both source code and object code, is -; copyright 1986 Echelon, Inc. Duplication for non-commercial personal -; use is permitted; all other duplication is prohibited unless authorized -; in writing by copyright holder. -; -; To use: -; ZAS T3M-HI2 H <- make .HEX file output -; MLOAD MODEM.BIN=T3M-HI2 <- create binary file -; T3INS INSTALL <- install into TERM3 modules -; -; Cabling: -; Because of the HD64180's internal logic (which will not -; allow sending characters when the carrier detect input is -; false), a special cable must be used. Also, a different cable -; is used for a T3SERVER/T3MASTER application. -; -; TERM3 Modem Application Cable -; -; SB180 Modem -; 1 --------------------- 1 -; 2 --------------------- 2 -; 3 --------------------- 3 -; 4 --------------------- 4 -; 5 --------------------- 8 <- note -; 6 --------------------- 6 -; 7 --------------------- 7 -; 8 --------------------- 5 <- note -; 20 --------------------- 20 -; -; TERM3 T3MASTER/T3SERVER Application Cable (Tested with -; AMPRO Little Board and Magnum Digital PRO-180 as "Other Computer") -; -; SB180(Master) Other Computer(Server) -; 1 --------------------- 1 -; 2 --------------------- 2 -; 3 --------------------- 3 -; 4 --+ -; 5 --| <- Note: 4, 5, & 8 tied together -; 8 --+ -; 7 --------------------- 7 -; -; define "yes" and "no" -; -no equ 0 -yes equ not no -; -; User-select equates - select "yes" to only one clock rate -; -c6144kHz equ no ; 6.144MHz -c9216kHz equ yes ; 9.216MHz -c12288kHz equ no ; 12.288MHz -; -; select ASCI 0 (modem port on SB180) or ASCI 1 -; -asci0 equ yes -asci1 equ no -; -; Non-changeable equates -; -base equ 600h ; base of Modem Interface in T3 tools - if asci0 -cntla EQU 0 ; ASCI Control Register A Channel 0 -cntlb EQU 2 ; ASCI Control Register B Channel 0 -stat EQU 4 ; ASCI Status Register Channel 0 -tdr EQU 6 ; ASCI Transmit Data Register Channel 0 -rdr EQU 8 ; ASCI Receive Data Register Channel 0 - endif - if asci1 -cntla EQU 1 ; ASCI Control Register A Channel 1 -cntlb EQU 3 ; ASCI Control Register B Channel 1 -stat EQU 5 ; ASCI Status Register Channel 1 -tdr EQU 7 ; ASCI Transmit Data Register Channel 1 -rdr EQU 9 ; ASCI Receive Data Register Channel 1 - endif -CTS EQU 00100000B ; Clear-to-send input (pin 5) -DCD EQU 00000100B ; Data Carrier detect bit (pin 8) -RDRF EQU 10000000B ; RECEIVE DATA REGISTER FULL -TDRE EQU 00000010B ; TRANSMIT DATA REGISTER EMPTY -; -; Term3 Baud Rate definitions -; -; chart of baud rates vs. clock speed for 64180 -; -; 6.144MHz clock 9.216MHZ clock 12.288MHz clock -; PS DR SS PS DR SS PS DR SS -; 38400 0 0 0 -- na -- 0 0 1 -; 19200 0 0 1 1 0 0 0 0 2 -; 9600 0 0 2 1 0 1 0 0 3 -; 4800 0 0 3 1 0 2 0 0 4 -; 2400 0 0 4 1 0 3 0 0 5 -; 1200 0 0 5 1 0 4 0 0 6 -; 300 0 1 5 1 0 6 0 1 6 -; - if c6144kHz -bauds equ 01111111b ; this modem interface supports 300, 1200, - ; 2400, 4800, 9600, 19200, 38400 - endif -; - if c9216kHz -bauds equ 00111111b ; this modem interface supports 300, 1200, - ; 2400, 4800, 9600, 19200 - endif -; - if c12288kHz -bauds equ 01111111b ; this modem interface supports 300, 1200, - ; 2400, 4800, 9600, 19200, 38400 - endif -; - .HD64 ; enable Hitachi Mnemonics - org base -; -; Jump Table -; - JP INIT ; m1$init - JP ISTAT ; M1$istat - JP OSTAT ; m1$ostat - JP INP ; m1$in - JP OUTP ; m1$out - JP BREAK ; m1$break - JP CST ; m1$cst -AVAILBD: - DB bauds ; set via EQUate above -; -; initialization. Set baud rate, but leave DTR (really RTS) high -; -INIT: - if c9216kHz - cp 7 ; we can't do 38.4K @ 9.216MHz - jr z,noset - endif - OR A ; is entry parameter 0? - JR NZ,SETB ; if yes, fall thru to no set -NOSET: POP AF - XOR A ; return "not supported" - RET -SETB: PUSH HL ; save regs - PUSH DE - LD HL,[b300-1] ; get base of baud table - LD D,0 ; prep for subsequent add - LD E,A ; index into baud rate table - ADD HL,DE ; add index to base - LD D,(HL) ; get desired byte - OUT0 (cntlb),D ; send it - POP DE - POP HL - OR A ; return proper indication to calling routine - RET -; -; Input status. Returns Z and A=0 if nothing waiting. -; -ISTAT: CALL IISTAT - AND RDRF - RET Z - LD A,0FFH - RET -; -; Read stat twice, as per Hitachi manual -; -IISTAT: IN0 A,(stat) - IN0 A,(stat) - OR A - RET -; -; Check state of CTS* and return A=0 and Z if CTS is true. -; -CKCTS: IN0 A,(cntlb) - AND CTS - RET Z - LD A,0FFh - RET -; -; Output status. Returns Z and A=0 if not ready to send. -; -OSTAT: CALL IISTAT ; GET STATUS REG - AND TDRE - JR Z,DOCTS -OST1: LD A,0FFH - OR A - RET -; -; TDRE is false. Is it because CTS is false? -; -DOCTS: CALL CKCTS ; look at CTS (really modem carrier) - JR NZ,OST1 ; CTS is false; goto faking "OK to send" - XOR A ; return "not ready" indication - RET -; -; Recieve a character -; -INP: CALL ISTAT - JR Z,INP - IN0 A,(rdr) - RET -; -; Send a character -; -OUTP: PUSH AF - CALL CKCTS ; check CTS - JR NZ,DELAY ; if CTS is false, delay before sending -OUTP1: CALL OSTAT - JR Z,OUTP1 -OUTP2: POP AF ; return point from "CTS false" delay - OUT0 (tdr),A - RET -; -; This delay routine is used when CTS (pin 5 on SB180) is false. Hitachi -; designed the ASCI 0 to lock the TDRE status bit false when CTS is false, -; yet the ASCI 0 can still send characters under this circumstance. However, -; because TDRE is always false, we must manually delay after each character -; to prevent over-running the serial port. Worst case for this delay is -; 300 bps, where each character (10 bits) is 33.3 milliseconds. This -; delay subroutine delays about 36 milliseconds in an HD64180 system at -; the selected clock rate. -; - if c6144kHz -wait equ 12 - endif - if c9216kHz -wait equ 18 - endif - if c12288kHz -wait equ 24 - endif -DELAY: LD A,wait ; 6 T-states -D1: PUSH AF ; 11 T-states | - LD A,0FFh ; 6 T-states | -D2: EX (SP),HL ; 16 T-states | 72 if | - EX (SP),HL ; 16 | true, | 18398 if - EX (SP),HL ; 16 | 70 if | true, - EX (SP),HL ; 16 | false | 18396 if - DEC A ; 4 | | false - JR NZ,D2 ; 8 if true, 6 if false | | - POP AF ; 9 | - DEC A ; 4 | - JR NZ,D1 ; 8 if true, 6 if false | - JR OUTP2 ; return and force send of character -; -; process BREAK request -; -BREAK: XOR A - RET ;NO BREAK AVAILABLE -; -; check carrier status -; -CST: CALL CKCTS ; check CTS (really modem carrier, via - JR Z,CST1 ; the special cable discussed above - XOR A ; NO CARRIER - RET -CST1: LD A,0FFH - OR A - RET -; -; Baud Rate Tables -; - if c6144kHz -; -; HD64180 commands to set baud rates @ 6.144 MHz clock -; -b300: db 00001101b ; no PS, sampling rate 64, divide ratio 32 -b1200: db 00000101b ; no PS, sampling rate 16, divide ratio 32 -b2400: db 00000100b ; no PS, sampling rate 16, divide ratio 16 -b4800: db 00000011b ; no PS, sampling rate 16, divide ratio 8 -b9600: db 00000010b ; no PS, sampling rate 16, divide ratio 4 -b19200: db 00000001b ; no PS, sampling rate 16, divide ratio 2 -b38400: db 00000000b ; no PS, sampling rate 16, divide ratio 1 - endif - if c9216kHz -; -; HD64180 commands to set baud rates @ 9.216 MHz clock -; -b300: db 00100110b ; PS, sampling rate 16, divide ratio 64 -b1200: db 00100100b ; PS, sampling rate 16, divide ratio 16 -b2400: db 00100011b ; PS, sampling rate 16, divide ratio 8 -b4800: db 00100010b ; PS, sampling rate 16, divide ratio 4 -b9600: db 00100001b ; PS, sampling rate 16, divide ratio 2 -b19200: db 00100000b ; PS, sampling rate 16, divide ratio 1 - endif - if c12288kHz -; -; HD64180 commands to set baud rates @ 12.288 MHz clock -; -b300: db 00001110b ; no PS, sampling rate 64, divide ratio 64 -b1200: db 00000110b ; no PS, sampling rate 16, divide ratio 64 -b2400: db 00000101b ; no PS, sampling rate 16, divide ratio 32 -b4800: db 00000100b ; no PS, sampling rate 16, divide ratio 16 -b9600: db 00000011b ; no PS, sampling rate 16, divide ratio 8 -b19200: db 00000010b ; no PS, sampling rate 16, divide ratio 4 -b38400: db 00000001b ; no PS, sampling rate 16, divide ratio 2 - endif -; -; End of this modem interface -; - db 'copyright 1987 Echelon, Inc.' - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/T3T-24-1.Z80 b/Source/Images/d_bp/u15/T3T-24-1.Z80 deleted file mode 100644 index 5d199dd4..00000000 --- a/Source/Images/d_bp/u15/T3T-24-1.Z80 +++ /dev/null @@ -1,507 +0,0 @@ -; -; MODULE: T3T-24-1 (Telephone Interface) for Hayes-compatible 2400bps modems -; Author: David McCord/Richard Conn -; Version: 1.0 -; Date: 23 May 86 -; Previous Versions: Richard Conn wrote T3TI-SM v1.2, which this is based on. -; Comments: This TI supports 300/1200/2400bps Hayes-compatible modems. A key -; compatibility point is that the modem return the terse result code -; "10" on CONNECT 2400. Modems that should work with this TI include -; the Hayes 2400, USR Courier 2400, and Racal-Vadic 2400V. Developed -; and tested on a Courier 2400. Baud rate is automatically set upon -; connection in answer or originate modes. The answer routines have -; been rewritten from the original to NOT use modem auto-answer -; functions, as this can lead to the modem answering the phone when -; it shouldn't. -; - ORG 700H ; BASE ADDRESS (700H - 9FFH) -; -; ACCESS TO FILER$SERVER WITHIN T3ANSWER, T3DIAL, T3HANGUP, T3INIT -; -FILER$SERVER EQU 11AH ; ADDRESS OF ADDRESS -FS$GETSPEED EQU 0 ; GET PROCESSOR SPEED -FS$WAIT1S EQU 1 ; WAIT 1 SEC -FS$WAITP1S EQU 2 ; WAIT 0.1 SEC -FS$WAIT1MS EQU 3 ; WAIT 0.001 SEC -FS$CST EQU 4 ; CONSOLE STATUS (Z=RDA) -FS$CIN EQU 5 ; CONSOLE INPUT -FS$COUT EQU 6 ; CONSOLE OUTPUT (CHAR IN C) -; -; ACCESS TO MODEM OVERLAY ROUTINES -; -M1$INIT EQU 600H ; INITIALIZE MODEM -M1$ISTAT EQU M1$INIT+3 ; INPUT STATUS -M1$OSTAT EQU M1$ISTAT+3 ; OUTPUT STATUS -M1$IN EQU M1$OSTAT+3 ; INPUT BYTE -M1$OUT EQU M1$IN+3 ; OUTPUT BYTE -M1$BREAK EQU M1$OUT+3 ; SEND BREAK -M1$CST EQU M1$BREAK+3 ; CARRIER STATUS DETECT -M1$SPTAB EQU M1$CST+3 ; SPEED BYTE -; -; ASCII CONSTANTS -; -CR EQU 0DH -CTRLC EQU 'C'-'@' -; -; Telephone System Interface Routines -; -TI$INIT: - JP STI$INIT ; INITIALIZATION -TI$ANS: - JP STI$ANS ; SET ANSWER MODE -TI$HANG: - JP STI$HANG ; HANG UP PHONE -TI$RST: - JP STI$RST ; RING STATUS DETECT -TI$DSTRT: - JP STI$DSTRT ; START DIALING -TI$DSTOP: - JP STI$DSTOP ; STOP DIALING -TI$DIGIT: - JP STI$DIGIT ; DIAL DIGIT -TI$PREPANS: - JP STI$PREPANS ; PREPARE FOR ANSWERING PHONE -TI$GETBAUD: - JP STI$GETBAUD ; RETURN CURRENT BAUD RATE VALUE -; -; FILER$SERVER INTERFACE FOR TELEPHONE INTERFACE OVERLAY -; FILER$SERVER CODE IS IN A -; -TI$FS: - PUSH HL ; SAVE HL - LD HL,TI$FSRET ; SET RETURN ADDRESS - PUSH HL ; ... ON STACK - LD HL,(FILER$SERVER) ; GET ADDRESS OF FILER$SERVER - JP (HL) ; "CALL" ROUTINE -TI$FSRET: - POP HL ; RESTORE HL - RET -; -; SEND 'ATx' COMMAND TO SMARTMODEM -; -CMD$SEND: - PUSH AF ; SAVE CMD - LD A,FS$WAIT1S ; CODE TO WAIT 1 SECOND - CALL TI$FS ; FILER$SERVER - LD A,'A' ; SEND 'AT' - CALL CMD$SEND1 - LD A,'T' - CALL CMD$SEND1 - POP AF ; GET CMD -; -; SEND FURTHER COMMAND CHARS TO SMARTMODEM -; -CMD$SEND1: - PUSH AF ; SAVE CHAR - CALL M1$OUT ; SEND CHAR IN A - push bc - ld b,10 ; do this 10 times... -cmd$send2: - ld a,fs$wait1ms - call ti$fs ; wait a millisecond - djnz cmd$send2 - pop bc ; when we get here, we waited 10ms for echo - CALL FLUSH ; flush the echo - POP AF - RET -; -; END SMARTMODEM COMMAND SEQUENCE -; -CMD$END: - PUSH AF ; SAVE A - LD A,0DH ; SEND AND WAIT FOR - CALL CMD$SEND1 ; SEND CHAR WITH ECHO - POP AF ; RESTORE A - RET -; -; WAIT FOR RESPONSE FROM SMARTMODEM COMMAND -; RETURN DIGIT UNLESS ERROR: -; A=0FFH if TIMEOUT -; A=0FEH if USER ABORT -; -ssresponse: - push hl - ld hl,500 ; super short delay for response (.5 sec) - jr respe -SRESPONSE: - PUSH HL - LD HL,2000 ; SHORT DELAY FOR RESPONSE (2 secs) - JR RESPE -RESPONSE: - PUSH HL ; SAVE HL - LD HL,30000 ; LARGE DELAY FOR RESPONSE (30 secs) -RESPE: - LD (RESP$DELAY),HL -RESP1: - LD HL,(RESP$DELAY) ; DELAY FOR RESPONSE -RESP2: - CALL M1$ISTAT ; INPUT CHAR FROM MODEM? - JR NZ,RESPM - LD A,FS$CST ; CONSOLE STATUS - CALL TI$FS ; USER ABORT? - JR Z,RESP3 - ld a,fs$wait1ms - call ti$fs ; wait 0.001 sec - DEC HL ; COUNT DOWN - LD A,H ; DONE? - OR L - JR NZ,RESP2 - POP HL - OR 0FFH ; TIMEOUT CODE - RET -RESP$DELAY: - DS 2 ; RESPONSE DELAY -; -; PROCESS USER CHAR -; -RESP3: - LD A,FS$CIN ; GET USER INPUT - CALL TI$FS ; USE FILER$SERVER - AND 7FH ; MASK - CP CTRLC ; ABORT? - JR NZ,RESP2 - POP HL ; RESTORE HL - LD A,0FEH ; USER ABORT - OR A - RET -; -; PROCESS MODEM CHAR -; -RESPM: - CALL M1$IN ; GET CHAR - AND 7FH ; MASK - JR Z,RESP1 ; FLUSH NULL - POP HL ; RESTORE HL - RET -; -; ATTRACT ATTENTION OF SMARTMODEM -; -ATTENTION: - CALL M1$CST ; DO NOTHING IF NO CARRIER - RET Z - CALL FLUSH ; FLUSH ANY CHAR - LD A,0 ; SEND AT LEAST ONE CHAR FIRST - CALL M1$OUT - LD A,FS$WAIT1S ; WAIT 1 SEC - CALL TI$FS ; USE FILER$SERVER - LD A,'+' ; ATTRACT MODEM'S ATTENTION - CALL M1$OUT - CALL M1$OUT - CALL M1$OUT - CALL sresponse ; WAIT FOR RESPONSE OR TIMEOUT - RET -; -; FLUSH ANY GARBAGE CHARS FROM COMMAND LINE -; -FLUSH: - CALL M1$ISTAT ; ANY CHARS? - RET Z ; RETURN IF NONE - CALL M1$IN ; GET CHAR - RET -; -; Telephone Interface Initialization -; Function: Initialize the Modem/UART Interface -; Input Parameters: None -; Output Parameters: None -; -STI$INIT: - PUSH AF ; SAVE A - CALL ATTENTION ; GET MODEM'S ATTENTION - LD A,'Z' ; RESET MODEM - CALL CMD$SEND ; SEND COMMAND - CALL CMD$END ; SEND - CALL OK ; GET OK/USER ABORT - CP 0FEH ; USER ABORT? - JR Z,STI$INI1 - LD A,'V' ; SET NON-VERBOSE MODE - CALL CMD$SEND ; SEND COMMAND - LD A,'0' ; V0 COMMAND - CALL CMD$SEND1 - LD A,'X' ; SET EXTENDED COMMAND SET - CALL CMD$SEND1 ; SEND COMMAND - LD A,'4' ; Enable result codes 0 thru 10 - CALL CMD$SEND1 - ld a,'S' ; disable auto-answer if turned on somehow - call cmd$send1 - ld a,'0' - call cmd$send1 - ld a,'=' - call cmd$send1 - ld a,'0' - call cmd$send1 - CALL CMD$END ; SEND - CALL OK1 ; GET OK/USER ABORT -STI$INI1: - CALL FLUSH ; FLUSH RESPONSES - POP AF ; RESTORE A - RET -; -; GET RESPONSE CODE OF 'OK' OR '0' -; -OK: - CALL sresponse ; GET FIRST CHAR - CP 0FEH ; USER ABORT? - RET Z - CP '0' ; DIGIT '0'? - JR Z,OK1A - CP 'O' ; LETTER 'O'? - JR NZ,OK - CALL sresponse ; GET 'K' - CP 0FEH ; USER ABORT? - RET Z - CALL sresponse ; GET - CP 0FEH ; USER ABORT? - RET Z - CALL sresponse ; GET - RET -; -; GET RESPONSE CODE OF '0' -; -OK1: - CALL sresponse ; GET FIRST CHAR - CP 0FEH ; USER ABORT? - RET Z - CP '0' ; OK? - JR NZ,OK1 -OK1A: - CALL sresponse ; GET - RET -; -; Prepare Modem to Answer Phone -; Function: To condition modem for answering phone -; Input Parameters: None -; Output Parameters: None -; -STI$PREPANS: - PUSH AF - LD A,3 ; SELECT 2400 BAUD - LD (STI$BRATE),A ; SET FLAG - CALL M1$INIT - POP AF - RET -; -; Set Modem to Answer -; Function: Set Modem to Answer Mode -; Input Parameters: None -; Output Parameters: A=0 IF NOT SUCCESSFUL, A=0FFH IF SUCCESSFUL -; -STI$ANS: - XOR A ; SET NO BAUD RATE - LD (STI$BRATE),A - ld a,'A' ; prepare to send ATA command - call cmd$send ; send it - call cmd$end -STI$ANS1: - call response - CP CR ; ? - JR Z,STI$ANS1 - cp '1' ; is it "1" or "10" (300 or 2400)? - jr z,sti$ans324 ; If Z, process further - CP '5' ; CONNECT 1200? - JR Z,STI$ans12 - xor a ; make A 0 (we didn't get a connect) - ret -sti$ans324: - call ssresponse ; we should have at least a CR or a 0 pending - cp cr ; is it CR? - jr z,sti$ans3 ; must be 300 if Z -sti$ans24: - ld a,3 ; select 2400 bps - jr sti$ansset -STI$ans3: - LD A,1 ; SELECT 300 BAUD - JR STI$ansSET -STI$ans12: - LD A,2 ; SELECT 1200 BAUD -STI$ansSET: - LD (STI$BRATE),A ; SET BAUD RATE - CALL M1$INIT ; INIT USART BAUD RATE - OR A,0ffh ; RETURN CONNECT CODE - RET -; -; Hang up telephone -; Function: Place the telephone on hook -; Input Parameters: None -; Output Parameters: None -; -STI$HANG: - PUSH AF - CALL M1$CST ; DO NOT HANG UP IF NO CARRIER - JR Z,STI$HANG1 - CALL STI$HANG3 ; HANG UP PHONE - CP 0FEH ; USER ABORT? - JR Z,STI$HANG1 - CALL M1$CST ; STILL CARRIER? - JR Z,STI$HANG1 - CALL STI$HANG3 ; TRY A SECOND TIME TO HANG UP -STI$HANG1: - POP AF ; DO NOTHING SINCE WE ARE ALREADY OFFLINE - RET -STI$HANG3: - CALL ATTENTION ; GET SMARTMODEM'S ATTENTION - LD A,'H' ; HANG UP PHONE - CALL CMD$SEND - CALL CMD$END ; END OF COMMAND - CALL sresponse ; FLUSH RESPONSE DIGIT - CP 0FEH ; USER ABORT - RET Z - CALL sresponse ; FLUSH RESPONSE - RET -; -; YES and NO Return Codes -; -STI$YES: - OR 0FFH ; SET FLAGS - RET -STI$NO: - XOR A ; NO ANSWER - RET -; -; Ring Status Detect -; Function: Determines if phone is ringing or not. -; Input Parameters: None -; Output Parameters: A=0FFH no ring, A=0 ring, A=0FEH user abort -; -STI$RST: - CALL ssresponse ; GET RETURN CODE - cp 0dh ; cr? - jr z,sti$rst - CP '2' ; RING? - JR Z,STI$RST3 - CP 0FEH ; USER ABORT? - JR Z,STI$RST2 -STI$RST1: - LD A,0FFH ; RETURN NO RING -STI$RST2: - OR A ; SET FLAGS - RET -sti$rst3: - call ssresponse ; get trailing CR - cp 0feh ; user abort? - jr z,sti$rst2 - xor a - ret -; -; Start Dialing -; Function: Initiate the dialing process -; Input Parameters: None -; Output Parameters: A=0 if no dial tone, A=0FFH if dial tone -; -STI$DSTRT: - CALL FLUSH ; FLUSH CHAR IF PRESENT - LD A,3 ; SELECT 2400 BAUD - LD (STI$BRATE),A ; SET BAUD RATE - CALL M1$INIT - LD A,'D' ; START DIALING - CALL CMD$SEND ; SEND COMMAND - LD A,'T' ; TOUCH TONE DIALING - CALL CMD$SEND1 - JP STI$YES ; fake dial tone OK, even though we aren't - ; off-hook yet -; -; Stop Dialing -; Function: Terminate the dialing process with answer or user abort, -; and set baud rate based on result code if answer. -; Input Parameters: None -; Output Parameters: A=0 and Z if answer, NZ and error code if no ans -; Error Code: 0FFH=Timeout, 0FEH=User Abort -; Other=TI Return Code -; -STI$DSTOP: - ld a,cr ; end dial string - call cmd$send1 -STI$DS1: - LD A,FS$CST ; CHECK CONSOLE STATUS - CALL TI$FS ; USE FILER$SERVER - JR Z,STI$DS2 ; NO CONNECTION IF USER ABORT -STI$DSLOOP: - CALL RESPONSE ; ANSWER? - CP 0FFH ; TIMEOUT? - JR Z,STI$DS1 - CP 0FEH ; USER ABORT - JR Z,STI$DS2E - CP '2' ; RING? - JR Z,STI$DSLOOP - CP CR ; - JR Z,STI$DSLOOP - CP '9'+1 ; CHECK RANGE - JR NC,STI$DS1 - CP '0' ; CHECK RANGE - JR C,STI$DS1 - CP '1' ; is it a "1" or "10"? - JR Z,STI$DS324 ; process more if so - CP '5' ; CONNECTED AT 1200 BAUD? - ret nz - LD A,2 ; SELECT 1200 BAUD -STI$DSB: - LD (STI$BRATE),A ; SET BAUD RATE FLAG - CALL M1$INIT ; SET BAUD RATE - XOR A ; RETURN CONNECT CODE - RET -STI$DS2: - LD A,FS$CIN ; GET CHAR - CALL TI$FS ; USE FILER$SERVER - AND 7FH - CP CTRLC ; ABORT? - JR NZ,STI$DS1 -STI$DS2E: - LD A,0FEH ; SET USER ABORT - OR A - RET -sti$ds324: - call ssresponse ; there is at least a CR or 0 pending - cp cr ; was it cr, not 0? - jr z,sti$ds3 ; if yes, go set 300 baud -sti$ds24: - ld a,3 ; select 2400 bps - jr sti$dsb -STI$DS3: - LD A,1 ; SELECT 300 BAUD - JR STI$DSB -; -; Dial Digit -; Function: Dial an individual digit -; Input Parameters: A=ASCII for digit to dial -; Output Parameters: None -; -STI$DIGIT: - PUSH AF - CP ' ' ; DON'T SEND SPACES - jr z,sti$digit1 - cp '-' ; don't send dashes - jr z,sti$digit1 - cp '(' ; don't send parenthesis - jr z,sti$digit1 - cp ')' ; other kind - jr z,sti$digit1 - CALL CMD$SEND1 ; SEND DIGIT WITH ECHO -sti$digit1: - POP AF - RET -; -; Get Baud -; Function: Return current baud rate value (from answer or dial) -; Input Parameters: None -; Output Parameters: A = Baud Rate and Z flag set -; A = 0 means undefined -; A = 1 means 300 baud -; A = 2 means 1200 baud -; -STI$GETBAUD: - LD A,(STI$BRATE) ; GET VALUE - OR A ; SET FLAGS - RET -; -; BAUD RATE FLAG -; A = 0 IF NONE -; A = 1 IF 300 BAUD -; A = 2 IF 1200 BAUD -; -STI$BRATE: - DB 0 ; FLAG BUFFER -; -; END of Telephone Interface Routines -; - DB 'End of TI-2400' - - END diff --git a/Source/Images/d_bp/u15/TCCHECK.COM b/Source/Images/d_bp/u15/TCCHECK.COM deleted file mode 100644 index 2b8321ff..00000000 Binary files a/Source/Images/d_bp/u15/TCCHECK.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/TCCHECK.MAC b/Source/Images/d_bp/u15/TCCHECK.MAC deleted file mode 100644 index 5563c8fd..00000000 --- a/Source/Images/d_bp/u15/TCCHECK.MAC +++ /dev/null @@ -1,281 +0,0 @@ -; ZCPR3 TCAP Facility (Z3TCAP) -; Program Name: TCCHECK -; Author: Richard Conn -; Version: 1.0 -; Date: 10 Mar 84 -version equ 10 - -; -; TCCHECK checks the indicated (or implied) Z3TCAP.TCP file -; and displays statistics about it. -; - -; -; Basic Equates -; -z3env SET 0f400h ;ZCPR3 Environment Descriptor -fcb equ 5ch -tbuff equ 80h -ctrlc equ 'C'-'@' -cr equ 0dh -lf equ 0ah - -; -; ZCPR3 and SYSLIB References -; - ext z3init,qprint,z3log - ext codend,moveb - ext print,pfn1,cout,phldc - ext initfcb,pfind,f$open,f$read,f$close - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - -; -; Print Banner -; - call qprint - db 'TCCHECK, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db 0 - -; -; Check for Entry in FCB -; - lda fcb+1 ;get first char - cpi '/' ;none if slash - jnz start1 -; -; Print Help Info -; -help: - call print - db 'TCCHECK - Select Entry from Z3TCAP.TCP' - db cr,lf,'Syntax:' - db cr,lf,' TCCHECK infile -or- TCCHECK infile.typ' - db cr,lf - db cr,lf,'where "infile" is the file to be checked by' - db cr,lf,'the execution of TCCHECK. If no file type is' - db cr,lf,'given, a file type of TCP is the default.' - db cr,lf - db cr,lf,'Syntax:' - db cr,lf,' TCCHECK' - db cr,lf - db cr,lf,'where this alternate form may be used to check' - db cr,lf,'the Z3TCAP.TCP file.' - db 0 - ret -; -; Resume Processing -; -start1: -; -; Set Default File if None -; - lxi d,fcb+1 ;pt to file name - lxi h,deffile ;pt to default file - mvi b,11 ;11 bytes - ldax d ;get first char - cpi ' ' ;none if space - cz moveb ;set default file -; -; Set Default File Type if None -; - lxi d,fcb+9 ;pt to file type - lxi h,deftyp ;pt to default file type - mvi b,3 ;3 bytes - ldax d ;get first char - cpi ' ' ;none if space - cz moveb ;set default file type -; -; Begin Reading Z3TCAP.TCP -; - lxi d,fcb ;try to open Z3TCAP.TCP - call initfcb ;init FCB - mvi a,0ffh ;search current also - call pfind ;look for file - jnz start2 ;file found -; -; File Z3TCAP.TCP Not Found -; -fnferr: - call print - db ' File ',0 - lxi d,fcb+1 ;print file name - call pfn1 - call print - db ' Not Found - Aborting',0 - ret -; -; Extract Z3TCAP Index -; -start2: - lxi d,fcb ;pt to FCB - call f$open ;open file - jnz fnferr - call codend ;read file into buffer -; -; Load Z3TCAP Index -; -loadi: - lxi d,fcb ;pt to FCB - call f$read ;read next block - jnz rerr1 ;read error - lxi d,tbuff ;copy from TBUFF - push h ;save ptr to this block - xchg - mvi b,128 ;128 bytes - call moveb - pop h ;pt to this block - lxi d,16 ;every 16 - mvi b,8 ;8 entries possible -; -; Check for End of Index -; -loadi1: - mov a,m ;end of index if space - cpi ' ' - jz loadi2 - dad d ;pt to next - dcr b ;count down - jnz loadi1 - jmp loadi ;HL pts to next block to load -; -; Error in Reading File -; -rerr1: - call print - db cr,lf,'File Read Error During Read of Index',0 - ret -; -; Reached End of Index -; -loadi2: - shld z3tcver ;save ptr to version number -; -; Read Each Block of File -; - lxi h,0 ;set count - shld tcount - call codend ;pt to first element -check: - mov a,m ;see if done - cpi ' ' ;space if so - jz done - lxi d,fcb ;pt to FCB - call f$read ;read next record - jnz rerr - push h ;save ptr - lhld tcount ;increment count - inx h - shld tcount - pop h ;get ptr - lxi d,tbuff ;pt to name in buffer - mvi b,16 ;check 16 chars -check1: - ldax d ;compare - cmp m - jnz tnerror - inx h ;pt to next - inx d - dcr b ;count down - jnz check1 - jmp check -; -; Read Error -; -rerr: - call print - db cr,lf,'Premature End of File after ',0 - lhld tcount ;get count - call phldc - call print - db ' Terminals Checked',0 - ret -; -; Terminal Name Error -; -tnerror: - call print - db cr,lf,'Terminal Names are Inconsistent at Terminal ',0 - push h ;save ptr - lhld tcount ;get count - call phldc - pop h ;get ptr -tne1: - inx h ;advance to next - dcr b - jnz tne1 - jmp check - -; -; Check Complete -; -done: - lxi d,fcb ;close file - call f$close - call print - db cr,lf,'Z3TCAP File Check of ',0 - lxi d,fcb+1 - call pfn1 - call print - db ' Version ',0 - lhld z3tcver - inx h ;pt to version number -done1: - mov a,m ;print it - call cout - inx h - cpi ' ' - jnz done1 - call print - db cr,lf,' File Checks with ',0 - lhld tcount ;print entry count - call phldc - call print - db ' Terminals Defined',0 - ret -; -; Buffers -; -deffile: - db 'Z3TCAP ' ;default file name -deftyp: - db 'TCP' ;default file type -tcount: - ds 2 ;terminal count -z3tcver: - ds 2 ;ptr to ZCPR3 TCAP Version Number - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/TCMAKE.COM b/Source/Images/d_bp/u15/TCMAKE.COM deleted file mode 100644 index d2cc451a..00000000 Binary files a/Source/Images/d_bp/u15/TCMAKE.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/TCMAKE.MAC b/Source/Images/d_bp/u15/TCMAKE.MAC deleted file mode 100644 index 00bc5ce5..00000000 --- a/Source/Images/d_bp/u15/TCMAKE.MAC +++ /dev/null @@ -1,1085 +0,0 @@ -; ZCPR3 TCAP Facility (Z3TCAP) -; Program Name: TCMAKE -; Author: Richard Conn -; Version: 1.0 -; Date: 10 Mar 84 -version equ 10 - -; -; TCMAKE allows the user to create a Z3T file for his particular -; terminal. -; - -; -; Basic Equates -; -z3env SET 0f400h ;ZCPR3 Environment Descriptor -qch equ '\' ;quote char -fcb equ 5ch -tbuff equ 80h -ctrlc equ 'C'-'@' -cr equ 0dh -lf equ 0ah - -; -; ZCPR3 and SYSLIB References -; - ext z3init,qprint,z3log - ext bbline,sksp,eval - ext codend,moveb,fillb,hmovb - ext print,pfn1,pstr,capine,cin,caps,crlf,cout,pafdc,pa2hc - ext initfcb,f$make,f$write,f$close - ext f$exist,gfa,f$delete - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - -; -; Print Banner -; - call qprint - db 'TCMAKE, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db cr,lf,0 - -; -; Check for Entry in FCB -; - lda fcb+1 ;get first char - cpi ' ' ;none if space - jz help - cpi '/' ;none if slash - jnz start1 -; -; Print Help Info -; -help: - call print - db 'TCMAKE - Create a Z3T File' - db cr,lf,'Syntax:' - db cr,lf,' TCMAKE outfile -or- TCMAKE outfile.typ' - db cr,lf - db cr,lf,'where "outfile" is the file to be generated by' - db cr,lf,'the execution of TCMAKE. If no file type is' - db cr,lf,'given, a file type of Z3T is the default.' - db 0 - ret -; -; Resume Processing -; -start1: -; -; Set Default File Type if None -; - lxi d,fcb+9 ;pt to file type - lxi h,deftyp ;pt to default file type - mvi b,3 ;3 bytes - ldax d ;get first char - cpi ' ' ;none if space - cz moveb ;set default file type -; -; Init the Buffers and Pointers -; - call codend ;pt to scratch area - shld scratch ;set ptr - lxi d,100h ;give space (overkill) - xra a ;init strings to empty - sta rcfirst ;clear flag - dad d - shld cladr ;CL - mov m,a ;clear - dad d - shld cmadr ;CM - mov m,a ;clear - dad d - shld ceadr ;CE - mov m,a ;clear - dad d - shld soadr ;SO - mov m,a ;clear - dad d - shld seadr ;SE - mov m,a ;clear - dad d - shld tiadr ;TI - mov m,a ;clear - dad d - shld teadr ;TE - mov m,a ;clear - dad d - shld cmbadr ;CM Beginning - mov m,a ;clear - dad d - shld cmmadr ;CM Middle - mov m,a ;clear - dad d - shld cmeadr ;CM Ending - mov m,a ;clear - dad d - shld reqn ;Row Equation - mov m,a - dad d - shld ceqn ;Column Equation - mov m,a - lxi h,ku ;clear 1-byte buffers - mvi b,7 ;7 of them - xra a ;0 fill - call fillb -; -; Create the Data Base -; -menu1: - call create ;create entry - call assemble ;assemble the entry - jz menu1 ;continue if buffer overflow -; -; Confirm Selection -; - call print - db cr,lf,' Selected Terminal is: ',0 - lhld scratch ;pt to buffer - call prent ;print name - call print - db ' -- Confirm (Y/N)? ',0 - call capine ;get input - call crlf - cpi 'Y' - jnz menu1 ;continue - call wrfile ;write file - ret -; -; Assemble Data into Z3T Format -; Return with Z if Buffer Overflow (more than 128 bytes) -; Return with NZ if OK -; -assemble: - mvi c,128-23 ;128 bytes max with 23 bytes for header - mvi b,23 ;copy 23 byte header - lhld scratch ;into scratch area - lxi d,tname ;from TNAME - xchg - call hmovb - lhld cladr ;copy CL string - call asmcopy - lxi h,crcmd ;reverse row/col to col/row? - lda rcfirst ;get flag - cpi 'C' ;reverse if C - jnz asmc0 - call asmcopy - dcx d ;don't let zero in -asmc0: - lhld cmbadr ;CM Beginning - call asmcopy - dcx d - lhld ceqn ;prepare for col first - lda rcfirst ;get row/col flag - cpi 'C' ;col/row? - jz asmc1 - lhld reqn ;row first, so store row -asmc1: - call asmcopy - dcx d ;skip 0 - lhld cmmadr ;CM Middle - call asmcopy - dcx d ;skip 0 - lhld reqn ;prepare for row first - lda rcfirst ;get row/col flag - cpi 'C' ;col/row? - jz asmc2 - lhld ceqn ;col first, so store col -asmc2: - call asmcopy - dcx d ;skip 0 - lhld cmeadr ;CM Ending - call asmcopy - lhld ceadr ;CE - call asmcopy - lhld soadr ;SO - call asmcopy - lhld seadr ;SE - call asmcopy - lhld tiadr ;TI - call asmcopy - lhld teadr ;TE - call asmcopy - xra a ;zero rest -asmzero: - stax d ;store 0 - inx d - dcr c ;count down - jnz asmzero - dcr c ;return NZ for OK - ret -; -; Copy TCAP String from HL to DE -; Check for SCRATCH Area Overflow by Counting C Down -; Allow For Quotes -; -asmcopy: - mov a,m ;get char - stax d ;store it - inx h ;pt to next - inx d - ora a ;done? - rz - dcr c ;check for overflow - jz asmovfl - cpi qch ;quote? - jnz asmcopy - mov a,m ;get quoted byte - stax d ;store it - inx h ;pt to next - inx d - dcr c ;check for overflow - jnz asmcopy -asmovfl: - pop psw ;clear stack - call print - db cr,lf,'** Buffer Overflow **',0 - xra a ;error code - ret - -; -; Create Entries -; -create: - call print - db cr,lf - db cr,lf,' ** Z3TCAP Main Menu',0 - call prfdata ;print file data - call print - db cr,lf - db cr,lf,'Define: 1. Clear Screen Sequence' - db cr,lf,' 2. Cursor Motion Sequence' - db cr,lf,' 3. Clear to End of Line Sequence' - db cr,lf,' 4. Standout Mode Sequences' - db cr,lf,' 5. Terminal Init/Deinit Sequences' - db cr,lf,' 6. Arrow Keys' - db cr,lf,' 7. Terminal Name' - db cr,lf - db cr,lf,'Status: S. Print Status (Definitions so far)' - db cr,lf - db cr,lf,'Exit: X. Exit and Write File' - db cr,lf,' Q. Quit and Abort Program without Writing File' - db cr,lf - db cr,lf,'Command? ',0 - call capine ;get response - call crlf - lxi h,ctable ;pt to command table - call tscan ;scan table - call print - db ' Invalid Command: ',0 - call cout ;print char - jmp create ;resume -; -; Print File Data -; -prfdata: - call print - db ' for File ',0 - lxi d,fcb+1 - call pfn1 - call print - db ' **',0 - ret -; -; Define Name of Terminal -; -namedef: - lxi h,tname ;space fill terminal name buffer - mvi a,' ' - mvi b,16 - call fillb - call print - db cr,lf,' Input Name of Terminal: ',0 - xra a ;no caps - call bbline ;get line from user - call sksp ;skip over leading spaces - lxi d,tname ;save name in buffer - mvi b,16 ;16 bytes max -putname: - mov a,m ;get next char - ora a ;done? - jz pn1 - stax d ;put next char - inx h ;pt to next - inx d - dcr b ;count down - jnz putname -pn1: - jmp create -; -; Define Arrow Keys -; -arrowdef: - call print - db 'Arrow Key Definition' - db cr,lf,' Your Terminal''s Arrow Keys may be defined ONLY' - db cr,lf,' if they generate only one character each. If they' - db cr,lf,' do, type Y to continue. If not, type anything else.' - db cr,lf,' Define Arrow Keys (Y/N)? ',0 - call capine - cpi 'Y' - jnz create - call print - db cr,lf,' Strike the Appropriate Arrow Key' - db cr,lf,' 1. Arrow UP? ',0 - lxi h,ku ;pt to first entry - call cin - mov m,a ;store it - inx h ;pt to next - call ccout - call print - db cr,lf,' 2. Arrow DOWN? ',0 - call cin - mov m,a - inx h - call ccout - call print - db cr,lf,' 3. Arrow RIGHT? ',0 - call cin - mov m,a - inx h - call ccout - call print - db cr,lf,' 4. Arrow LEFT? ',0 - call cin - mov m,a - call ccout - jmp create -; -; Review Arrow Keys -; -arrowrev: - call print - db cr,lf,'Review of Arrow Key Definitions' - db cr,lf,' 1. Arrow UP = ',0 - lxi h,ku ;pt to first - mov a,m - call ccout - inx h - call print - db cr,lf,' 2. Arrow DOWN = ',0 - mov a,m - call ccout - inx h - call print - db cr,lf,' 3. Arrow RIGHT = ',0 - mov a,m - call ccout - inx h - call print - db cr,lf,' 4. Arrow LEFT = ',0 - mov a,m - call ccout - ret - -; -; Quit Create Mode and Program -; -crquit: - call print - db 'Do you really want to quit (Y/N)? ',0 - call capine ;get input from user - cpi 'Y' ;see if he typed a Y - jnz create ;resume if not - pop psw ;clear stack -; -; Exit Create Mode -; -crexit: - ret -; -; CL Definition -; -cldef: - call print - db 'Clear Screen Definition',cr,lf - db ' 1. Timing Delay',0 - call getdelay ;get delay constant - sta cld ;save delay constant - call print - db cr,lf,' 2. Clear Screen Byte Sequence',0 - lhld cladr ;pt to buffer - call getstr - jmp create - -; -; CL Review -; -clreview: - call print - db cr,lf,'Review of Clear Screen Definition' - db cr,lf,' 1. Timing Delay = ',0 - lda cld - call pafdc - call print - db ' Milliseconds' - db cr,lf,' 2. Clear Screen Sequence:',0 - lhld cladr - call prtstr - ret -; -; CE Definition -; -cedef: - call print - db 'Clear to End of Line Definition',cr,lf - db ' 1. Timing Delay',0 - call getdelay ;get delay constant - sta ced ;save delay constant - call print - db cr,lf,' 2. Clear to End of Line Byte Sequence',0 - lhld ceadr ;pt to buffer - call getstr - jmp create -; -; CE Review -; -cereview: - call print - db cr,lf,'Review of Clear to End of Line Definition' - db cr,lf,' 1. Timing Delay = ',0 - lda ced - call pafdc - call print - db ' Milliseconds' - db cr,lf,' 2. Clear to End of Line Sequence:',0 - lhld ceadr - call prtstr - ret -; -; SO Definition -; -sodef: - call print - db 'Standout Mode Definition',cr,lf - db ' 1. Begin Standout Mode Byte Sequence',0 - lhld soadr ;pt to buffer - call getstr - call print - db cr,lf,' 2. End Standout Mode Byte Sequence',0 - lhld seadr ;pt to buffer - call getstr - jmp create -; -; SO Review -; -soreview: - call print - db cr,lf,'Review of Standout Mode Definition' - db cr,lf,' 1. Begin Standout Mode Sequence:',0 - lhld soadr - call prtstr - call print - db cr,lf,' 2. End Standout Mode Sequence:',0 - lhld seadr - call prtstr - ret -; -; TI Definition -; -tidef: - call print - db 'Terminal Init/Deinit Definition',cr,lf - db ' 1. Terminal Initialization Byte Sequence',0 - lhld tiadr ;pt to buffer - call getstr - call print - db cr,lf,' 2. Terminal Deinitialization Byte Sequence',0 - lhld teadr ;pt to buffer - call getstr - jmp create -; -; TI Review -; -tireview: - call print - db cr,lf,'Review of Terminal Init/Deinit Definition' - db cr,lf,' 1. Terminal Initialization Sequence: ',0 - lhld tiadr - call prtstr - call print - db cr,lf,' 2. Terminal Deinitialization Sequence: ',0 - lhld teadr - call prtstr - ret -; -; CM Definition -; -cmdef: - call print - db 'Cursor Motion Definition',cr,lf - db ' 1. Timing Delay',0 - call getdelay ;get delay - sta cmd -cmcrdef: - call print - db cr,lf,' 2. Enter R if Row/Column or C for Column/Row: ',0 - call capine - cpi 'C' ;col/row - jz cmdef1 - cpi 'R' - jz cmdef1 - call print - db ' - Invalid',0 - jmp cmcrdef -cmdef1: - sta rcfirst ;set flag - call print - db cr,lf,' 3. Enter Equation for Row: ',0 - xra a ;no caps - call bbline ;get input - call sksp ;skip spaces - xchg - lhld reqn - xchg - call copy0 - call print - db cr,lf,' 4. Enter Equation for Column: ',0 - xra a ;no caps - call bbline ;get input - call sksp ;skip spaces - xchg - lhld ceqn - xchg - call copy0 - call print - db cr,lf,' 5. Enter Prefix Byte Sequence',0 - lhld cmbadr ;beginning - call getstr - call print - db cr,lf,' 6. Enter Middle Byte Sequence',0 - lhld cmmadr ;middle - call getstr - call print - db cr,lf,' 7. Enter Suffix Byte Sequence',0 - lhld cmeadr ;ending - call getstr - jmp create -; -; Copy HL to DE until 0 -; -copy0: - mov a,m ;copy - stax d - cpi qch ;quote? - jz copyq - ora a ;done if 0 - rz - inx h ;pt to next - inx d - jmp copy0 -copyq: - inx h ;copy quoted char - inx d - mov a,m ;copy - stax d - inx h ;advance - inx d - jmp copy0 -; -; Review CM Data -; -cmreview: - call print - db cr,lf,'Review of Cursor Motion Data' - db cr,lf,' 1. Timing Delay = ',0 - lda cmd - call pafdc - call print - db ' Milliseconds' - db cr,lf,' 2. Row or Column First: ',0 - lda rcfirst - call cout - call print - db cr,lf,' 3. Row Equation: -->',0 - lhld reqn - call pstr - call print - db '<--' - db cr,lf,' 4. Column Equation: -->',0 - lhld ceqn - call pstr - call print - db '<--' - db cr,lf,' 5. Prefix Byte Sequence: ',0 - lhld cmbadr - call prtstr - call print - db cr,lf,' 6. Middle Byte Sequence: ',0 - lhld cmmadr - call prtstr - call print - db cr,lf,' 7. Suffix Byte Sequence: ',0 - lhld cmeadr - call prtstr - ret - -; -; Status Display -; -rstatus: - call print - db cr,lf,' Strike Any Key to Continue - ',0 - call cin -status: - call print - db cr,lf,' ** Z3TCAP Status',0 - call prfdata ;file data - call print - db cr,lf - db cr,lf,'Review: 1. Clear Screen Definition' - db cr,lf,' 2. Cursor Motion Definition' - db cr,lf,' 3. Clear to End of Line Definition' - db cr,lf,' 4. Standout Mode Definition' - db cr,lf,' 5. Terminal Init/Deinit Definition' - db cr,lf,' 6. Arrow Key Definition' - db cr,lf,' 7. Terminal Name Definition' - db cr,lf - db cr,lf,'Exit: X. Exit to Main Menu' - db cr,lf - db cr,lf,'Command? ',0 - call capine - lxi h,rtable - call tscan - call print - db cr,lf,' Invalid Command: ',0 - call cout - jmp status -; -; Review Name -; -rname: - call print - db cr,lf,'Terminal Name: ',0 - lxi h,tname - mvi b,16 -rname1: - mov a,m ;get char - call cout - inx h ;pt to next - dcr b ;count down - jnz rname1 - jmp rstatus -; -; Review CL -; -rcl: - call clreview - jmp rstatus -; -; Review CE -; -rce: - call cereview - jmp rstatus -; -; Review CM -; -rcm: - call cmreview - jmp rstatus -; -; Review SO -; -rso: - call soreview - jmp rstatus -; -; Review TI -; -rti: - call tireview - jmp rstatus -; -; Review Arrow Keys -; -rarrow: - call arrowrev - jmp rstatus -; -; Status Review Commands -; -rtable: - db '1' - dw rcl - db '2' - dw rcm - db '3' - dw rce - db '4' - dw rso - db '5' - dw rti - db '6' - dw rarrow - db '7' - dw rname - db 'X' - dw create - db 0 - -; -; Scan Command Table -; -tscan: - mov b,a ;save char in B -tscan1: - mov a,m ;get char - ora a ;end of table? - jz tscanx ;exit - cmp b ;compare - jz tscanf ;found - inx h ;skip to next - inx h - inx h - jmp tscan1 -tscanx: - mov a,b ;restore char and exit - not found - ret -tscanf: - inx h ;get address - mov a,m - inx h - mov h,m - mov l,a - pop psw ;clear stack - pchl ;branch to routine -; -; Command Table -; -ctable: - db '1' ;CL - dw cldef - db '2' ;CM - dw cmdef - db '3' ;CE - dw cedef - db '4' ;SO - dw sodef - db '5' ;TI - dw tidef - db '6' ;arrows - dw arrowdef - db '7' ;name - dw namedef - db 'S' ;status - dw status - db 'Q' ;quit - dw crquit - db 'X' ;exit - dw crexit - db 0 -; -; Routine to Input Delay Constant -; -getdelay: - call print - db cr,lf,' Enter Delay Time in Milliseconds: ',0 - mvi a,0ffh ;caps - call bbline - call sksp - call eval ;convert to binary - ret -; -; Routine to Define Text String -; -getstr: - shld firstch ;set ptr to first char -getfirst: - mvi b,1 ;set count - lhld firstch ;set next char to first - shld nxtchar -getnext: - call print - db cr,lf,' Char #',0 - mov a,b ;get char number - call pafdc ;print it - inr b ;increment count - push b ;save it -; -; Prompt for Type of Input -; - call print - db ' - Type Char, .=Number, or =Done: ',0 - call cin ;get response - cpi cr ;exit - jz getx - cpi '.' ;number? - jz getnum -; -; Input Character -; - call print - db 'Char ',0 - call ccout ;echo character - jmp putch -; -; Input Number -; -getnum: - call print - db 'Enter Number: ',0 - mvi a,0ffh ;caps - call bbline ;get input - call sksp ;skip spaces - call eval ;convert -; -; Save Character with Quoting -; -putch: - lhld nxtchar ;pt to next char - ora a ;quote if null - jz quote - cpi qch ;quote if quote - jz quote -putch1: - mov m,a ;store it - inx h ;pt to next - shld nxtchar ;set ptr - pop b ;get count - jmp getnext ;get next char -; -; Quote the Character -; -quote: - mvi m,qch ;save quote char - inx h - jmp putch1 -; -; Exit -; -getx: - pop psw ;clear stack - lhld nxtchar ;store ending 0 - mvi m,0 - ret -; -; Print String Pted to by HL -; -prtstr: - mvi b,0 ;set count - call crlf ;new line - mov a,m ;empty? - ora a - jnz prts0 - call print - db ' -- Empty --',0 - ret -prts0: - mov a,m ;get next char - ora a ;done? - rz - call print - db ' (',0 - mov a,b ;print count - inr a - call pafdc - call print - db ') ',0 - mov a,m ;get next char - inx h ;pt to next - cpi qch ;check for quote - jnz prts1 - mov a,m ;get char that is quoted - inx h ;pt to next -prts1: - call ccout - call print - db ' ',0 - call pa2hc ;print as 2 hex chars - call print - db 'H ',0 - inr b ;increment count - mov a,b ;get count - ani 3 - cz crlf ;new line - jmp prts0 - -; -; Create Target File -; -wrfile: - lxi d,fcb ;pt to FCB - call z3log ;log into proper directory - call f$exist ;test of presence of file - jz make2 ;create file - call gfa ;get file attributes - ani 1 ;R/O? - jz make1 - call print - db cr,lf,'File ',0 - lxi d,fcb+1 - call pfn1 - call print - db ' is Read/Only - Saving as $$$.Z3T',0 - lxi h,tempfcb ;set $$$.Z3T - lxi d,fcb+1 - mvi b,11 ;11 chars - call moveb - lxi d,fcb ;reinit - call initfcb ;resume -make1: - call f$delete ;delete file -make2: - call f$make ;create file - cpi 0ffh ;error - jnz writef - call print - db cr,lf,'File Create Error',0 - ret -; -; Write Block to File -; -writef: - lhld scratch ;pt to entry - lxi d,tbuff ;copy into buffer - mvi b,128 ;128 bytes - call moveb - lxi d,fcb ;pt to FCB - call f$write ;write block - jnz werr - call f$close ;close file - call print - db cr,lf,'File ',0 - lxi d,fcb+1 - call pfn1 - call print - db ' Created',0 - ret -; -; Can't Write File -; -werr: - call print - db cr,lf,'File Write Error',0 - ret -; -; Print Entry Name Pted to by HL -; -prent: - mvi b,16 ;16 chars -prtname: - mov a,m ;get char - call cout - inx h ;advance - dcr b ;count down - jnz prtname - ret -; -; Print Char in A with Control Char Processing -; -ccout: - push psw ;save char - ani 7fh ;mask MSB - cpi 7fh ;DEL? - jz ccout2 - cpi ' ' - jnc ccout1 - push psw ;save char - mvi a,'^' - call cout - pop psw - adi '@' ;convert to char -ccout1: - call cout - pop psw - ret -ccout2: - call print - db '',0 - pop psw - ret - -; -; Buffers -; -crcmd: - db '%r',0 -tempfcb: - db '$$$ ' - db 'Z3T' -tname: - db '** Empty Name **' ;16 chars -ku: - ds 1 ;cursor up -kd: - ds 1 ;cursor down -kr: - ds 1 ;cursor right -kl: - ds 1 ;cursor left -cld: - ds 1 ;CL delay -cmd: - ds 1 ;CM delay -ced: - ds 1 ;CE delay -cladr: - ds 2 ;CL address -cmadr: - ds 2 ;CM address -ceadr: - ds 2 ;CE address -soadr: - ds 2 ;SO address -seadr: - ds 2 ;SE address -tiadr: - ds 2 ;TI address -teadr: - ds 2 ;TE address -cmbadr: - ds 2 ;CM Beginning -cmmadr: - ds 2 ;CM Middle -cmeadr: - ds 2 ;CM Ending -reqn: - ds 2 ;Row Equation -ceqn: - ds 2 ;Column Equation -rcfirst: - ds 1 ;R if Row First, C if Col First -deftyp: - db 'Z3T' ;default file type -firstch: - ds 2 ;ptr to first char in string -nxtchar: - ds 2 ;ptr to next char in string -scratch: - ds 2 ;ptr to scratch area - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/TCSELECT.COM b/Source/Images/d_bp/u15/TCSELECT.COM deleted file mode 100644 index 808ea484..00000000 Binary files a/Source/Images/d_bp/u15/TCSELECT.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/TCSELECT.MAC b/Source/Images/d_bp/u15/TCSELECT.MAC deleted file mode 100644 index 316a09d9..00000000 --- a/Source/Images/d_bp/u15/TCSELECT.MAC +++ /dev/null @@ -1,607 +0,0 @@ -; ZCPR3 TCAP Facility (Z3TCAP) -; Program Name: TCSELECT -; Author: Richard Conn -; Version: 1.1 -; Date: 1 Mar 85 -; Previous Versions: 1.0 (10 Mar 84) -version equ 11 - -; Version 1.1 by Richard Conn: Added FILENABLE equate to allow writing -; files to disk. If FILENABLE is FALSE, TCSELECT may only store in memory. - -; -; TCSELECT allows the user to select an entry from a Z3TCAP.TCP -; file and store it into memory or a Z3T file. TCSELECT is menu-driven. -; TCSELECT may be assembled to disable the ability to create a disk file -; (specifically for Z-NODE operation). -; - -; -; Basic Equates -; -false equ 0 -true equ not false -filenable equ true -entcnt equ 20 ;number of entries per screen -z3env SET 0f400h ;ZCPR3 Environment Descriptor -fcb equ 5ch -tbuff equ 80h -ctrlc equ 'C'-'@' -cr equ 0dh -lf equ 0ah - -; -; ZCPR3 and SYSLIB References -; - ext z3init,qprint,z3log,getenv - ext codend,moveb - ext print,pfn1,pstr,capine,crlf,cout,pafdc,comphd - ext initfcb,pfind,f$open,f$read,r$read,f$close - ext f$exist,gfa - ext putud,getud,logud -; - if filenable - ext f$make,f$write,f$delete - endif - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - -; -; Print Banner -; - call qprint - db 'TCSELECT, Version ' - db (version/10)+'0','.',(version mod 10)+'0' - db cr,lf,0 - -; -; Check for Entry in FCB -; - lda fcb+1 ;get first char - cpi '/' ;none if slash - jnz start1 -; -; Print Help Info -; -help: - call print - db 'TCSELECT - Select Entry from Z3TCAP.TCP' -; - if filenable -; - db cr,lf,'Syntax:' - db cr,lf,' TCSELECT outfile -or- TCSELECT outfile.typ' - db cr,lf - db cr,lf,'where "outfile" is the file to be generated by' - db cr,lf,'the execution of TCSELECT. If no file type is' - db cr,lf,'given, a file type of Z3T is the default.' - db cr,lf -; - endif -; - db cr,lf,'Syntax:' - db cr,lf,' TCSELECT' - db cr,lf - db cr,lf,'where this alternate form may be used to store' - db cr,lf,'the Z3TCAP entry for the selected terminal directly' - db cr,lf,'into the Z3 Environment Descriptor.' - db 0 - ret -; -; Resume Processing -; -start1: -; - if filenable -; -; Set Default File Type if None -; - lxi d,fcb+9 ;pt to file type - lxi h,deftyp ;pt to default file type - mvi b,3 ;3 bytes - ldax d ;get first char - cpi ' ' ;none if space - cz moveb ;set default file type -; - endif -; -; Begin Reading Z3TCAP.TCP -; - call putud ;save current location - lxi d,z3tfcb ;try to open Z3TCAP.TCP - call initfcb ;init FCB - mvi a,0ffh ;search current also - call pfind ;look for file - jnz start2 ;file found -; -; File Z3TCAP.TCP Not Found -; -fnferr: - call print - db 'File ',0 - lxi d,z3tfcb+1 ;print file name - call pfn1 - call print - db ' Not Found - Aborting',0 - ret -; -; Extract Z3TCAP Index -; -start2: - call logud ;log into DU in BC - lxi d,z3tfcb ;pt to FCB - call f$open ;open file - jnz fnferr - call codend ;read file into buffer - mvi c,0 ;set block counter - -; -; Load Z3TCAP Index -; -loadi: - inr c ;increment block counter - push b - lxi d,z3tfcb ;pt to FCB - call f$read ;read next block - jnz rerr ;read error - lxi d,tbuff ;copy from TBUFF - push h ;save ptr to this block - xchg - mvi b,128 ;128 bytes - call moveb - pop h ;pt to this block - lxi d,16 ;every 16 - mvi b,8 ;8 entries possible -; -; Check for End of Index -; -loadi1: - mov a,m ;end of index if space - cpi ' ' - jz loadi2 - dad d ;pt to next - dcr b ;count down - jnz loadi1 - pop b ;get count and load next - jmp loadi ;HL pts to next block to load -; -; Error in Reading File -; -rerr: - pop psw ;clear stack - call print - db cr,lf,'File Read Error',0 - ret -; -; Reached End of Index -; -loadi2: - shld z3tcver ;save ptr to version number -loadi3: - dad d ;compute address of next block after last - dcr b - jnz loadi3 - shld scratch ;scratch area - pop b ;get record number of next block - mov a,c - sta rec1 ;save count - lxi d,z3tfcb ;close file - call f$close -; -; Print menu of terminals -; -menu: - mvi a,1 ;set menu number - sta menunum - call codend ;pt to first terminal - shld curtable ;save ptr -menu1: - call prmenu ;print menu pted to by HL - call print - db cr,lf,'Enter Selection',0 - call chk1st ;first menu? - lxi h,lstmsg ;pt to last message - cz pstr - call chknth ;last menu? - lxi h,nxtmsg ;pt to next message - cz pstr - call print - db ', or ^C to Exit - ',0 - call capine ;get response - call crlf ;new line - cpi ctrlc ;abort? - rz - cpi '+' ;next? - jz nxtmenu - cpi '-' ;last? - jz lstmenu - sui 'A' ;convert to digit - jc menuerr ;print error message - mov c,a ;result in C - mvi a,entcnt-1 ;selection limit? - cmp c ;range error? - jc menuerr -; -; Set ptr to menu entry -; On input, C = offset in 20-terminal menu and MENUNUM is menu (1..) -; - lda menunum ;get menu number - dcr a ;adjust to 0 offset - mvi d,0 ;HL = number - mov e,a - lxi h,0 ;init sum - mvi b,entcnt ;multiply by number of entries -mult: - dad d ;+menunumber - dcr b ;count down - jnz mult ;B=0 on exit - dad b ;compute offset from record 1 for entry - jmp lterm ;load terminal now with offset in HL -; -; HL Now Contains Terminal Number (Zero Relative) -; -lterm: - lda rec1 ;get location of terminal data record 1 - mov c,a - dad b ;HL contains random record number of terminal -; -; HL Now Contains Random Record Number for Terminal in File (Zero Relative) -; Reopen Z3TCAP.TCP -; - lxi d,z3tfcb ;pt to FCB of file - call initfcb ;reinit it - call f$open -; -; Position to Correct Record and Read it in -; - call r$read ;read random record in HL - call f$close ;close file -; -; Copy Into Scratch Area -; - lhld scratch ;pt to scratch area - lxi d,tbuff ;pt to TBUFF - xchg - mvi b,128 ;128 bytes - call moveb - xchg ;HL pts to scratch -; -; Confirm Selection -; - call print - db cr,lf,' Selected Terminal is: ',0 - call prent ;print name - call print - db ' -- Confirm (Y/N)? ',0 - call capine ;get input - call crlf - cpi 'Y' - jnz menu1 ;continue -; -; Check for FCB and do a memory fill if no file given -; - if filenable -; - lda fcb+1 ;anything in FCB? - cpi ' ' - jz memory ;place SCRATCH into Z3 Env Descriptor -; -; Create Target File -; - call getud ;return home - lxi d,fcb ;pt to FCB - call z3log ;log into proper directory - call f$exist ;test of presence of file - jz make2 ;create file - call gfa ;get file attributes - ani 1 ;R/O? - jz make1 - call print - db cr,lf,'File ',0 - lxi d,fcb+1 - call pfn1 - call print - db ' is Read/Only',0 - ret -make1: - call f$delete ;delete file -make2: - call f$make ;create file - cpi 0ffh ;error - jnz writef - call print - db cr,lf,'File Create Error',0 - ret -; -; Write Block to File -; -writef: - lhld scratch ;pt to entry - lxi d,tbuff ;copy into buffer - mvi b,128 ;128 bytes - call moveb - lxi d,fcb ;pt to FCB - call f$write ;write block - jnz werr - call f$close ;close file - call print - db cr,lf,'File ',0 - lxi d,fcb+1 - call pfn1 - call print - db ' Created',0 - ret -; -; Can't Write File -; -werr: - call print - db cr,lf,'File Write Error',0 - ret -; - endif ;filenable -- MEMORY follows - -; -; Place Z3TCAP Entry into Z3 Environment Descriptor -; -memory: - call getenv ;pt to env desc - lxi d,80h ;pt to TCAP entry - dad d - xchg ;DE pts to entry - lhld scratch ;pt to scratch area - mvi b,128 ;copy 128 bytes - call moveb - call print - db cr,lf,' ZCPR3 Environment Descriptor Loaded',0 - ret -; -; Invalid Selection -; -menuerr: - call print - db ' -- Error: Invalid Selection',0 - jmp menu1 -; -; Advance to next menu -; -nxtmenu: - call chknth ;at end? - jz nmenu - call print - db ' -- Error: Already at Last Menu',0 - jmp menu1 -nmenu: - lhld curtable ;pt to current table - lxi d,16*entcnt ;advance to next - dad d - shld curtable - lda menunum ;increment menu number - inr a - sta menunum - jmp menu1 -; -; Backup to last menu -; -lstmenu: - call chk1st ;at beginning? - jz lmenu - call print - db ' -- Error: Already at First Menu',0 - jmp menu1 -lmenu: - lhld curtable ;pt to current table - lxi d,-16*entcnt ;backup - dad d - shld curtable - lda menunum ;decrement menu number - dcr a - sta menunum - jmp menu1 -; -; PRMENU -; PRMENU performs the following functions: -; 1. Sets flag if at 1st menu -; 2. Sets flag if at last menu -; 3. Prints menu in 2 columns -; -prmenu: - call print - db cr,lf,'** Terminal Menu ',0 - lda menunum ;print menu number - call pafdc ;print as floating - call print - db ' for Z3TCAP Version ',0 - lhld z3tcver ;get ptr to version - inx h ;pt to version number -prmenu0: - mov a,m ;get char - inx h ;pt to next - call cout ;print char - cpi ' ' ;done if space - jnz prmenu0 - call print - db ' **',cr,lf,cr,lf,0 - xra a - sta m1flag ;set not at 1st menu - sta mnflag ;set not at nth menu -; -; Determine if at 1st menu -; - call codend ;pt to terminal table - xchg ;... in DE - lhld curtable ;set 1st menu flag - call comphd ;compare - jnz prm1 - mvi a,0ffh ;set flag - sta m1flag -; -; Determine if at nth menu -; -prm1: - push h ;save ptr to current table - lxi d,16 ;size of table entry - mvi b,entcnt ;entcnt entries per screen -prm2: - mov a,m ;end? - cpi ' ' ;no entry? - jz prm3 - dad d ;advance - dcr b ;count down - jnz prm2 - jmp prm4 -prm3: - mvi a,0ffh ;at nth menu - sta mnflag ;set flag -; -; Determine menu bounds -; -prm4: - lxi h,0 ;clear ptr to col2 - shld col2 - pop h ;get ptr to current table - mvi b,entcnt/2 ;try to advance entcnt/2 entries -prm5: - mov a,m ;no next entry? - cpi ' ' - jz prm6 - dad d ;advance to next - dcr b ;count down - jnz prm5 - shld col2 ;save ptr to column 2 -; -; Print menu -; -prm6: - lhld col2 ;get ptr to column 2 - xchg ;... in DE - lhld curtable ;get ptr to column 1 - mvi b,entcnt/2 ;entcnt/2 lines max - mvi c,'A' ;current letter -prm7: - mov a,m ;get first char? - cpi ' ' ;done? - rz - mov a,c ;output letter - call prentry ;print entry - xchg ;HL pts to col 2 - mov a,h ;done? - ora l - jz prm8 - mov a,m ;empty? - cpi ' ' - jz prm8 - mov a,c ;get char - adi 10 ;add offset - call prentry -prm8: - inr c ;increment menu letter - xchg ;restore HL/DE - call crlf - dcr b ;count down - jnz prm7 - ret -; -; Print entry whose letter is in A and whose text is pted to by HL -; Advance HL -; -prentry: - call cout ;output char - call print - db '. ',0 -prent: - push b ;save regs - mvi b,16 ;16 chars -prent1: - mov a,m ;get char - inx h ;pt to next - call cout ;print char - dcr b - jnz prent1 - call print - db ' ',0 ;separator - pop b - ret -; -; Check to see if this is the first menu -; -chk1st: - lda m1flag ;get flag - ora a - ret -; -; Check to see if this is the last menu -; -chknth: - lda mnflag ;get flag - ora a - ret -; -; Buffers -; -z3tfcb: - db 0 - db 'Z3TCAP TCP' - ds 24 ;36 bytes total -; - if filenable -; -deftyp: - db 'Z3T' ;default file type -; - endif -; -nxtmsg: - db ', + for Next',0 -lstmsg: - db ', - for Last',0 -m1flag: - ds 1 ;1st menu flag -mnflag: - ds 1 ;nth menu flag -col2: - ds 2 ;pointer to column 2 entries -rec1: - ds 1 ;number of 1st data record -menunum: - ds 1 ;number of current menu -z3tcver: - ds 2 ;ptr to ZCPR3 TCAP Version Number -scratch: - ds 2 ;ptr to scratch area -curtable: - ds 2 ;current table ptr - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/TCSRC14.COM b/Source/Images/d_bp/u15/TCSRC14.COM deleted file mode 100644 index 246db635..00000000 Binary files a/Source/Images/d_bp/u15/TCSRC14.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/TCVIEW20.COM b/Source/Images/d_bp/u15/TCVIEW20.COM deleted file mode 100644 index f5cdd9ba..00000000 Binary files a/Source/Images/d_bp/u15/TCVIEW20.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/UNERASE.COM b/Source/Images/d_bp/u15/UNERASE.COM deleted file mode 100644 index 748557a7..00000000 Binary files a/Source/Images/d_bp/u15/UNERASE.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/UNERASE.MAC b/Source/Images/d_bp/u15/UNERASE.MAC deleted file mode 100644 index 3f9dd2c0..00000000 --- a/Source/Images/d_bp/u15/UNERASE.MAC +++ /dev/null @@ -1,727 +0,0 @@ -; PROGRAM: UNERASE for ZCPR3 -; AUTHOR: RICHARD CONN -; VERSION: 1.0 -; DATE: 18 May 84 -; DERIVATION: UNERA 2.2 (25 July 83) for ZCPR2 -; DERIVATION: UNERA BY GENE COTTON -; -VERS EQU 10 ;version number -z3env SET 0f400h - -; -; PROGRAM TO RECOVER ERASED FILES, BY GENE COTTON -; -; From Interface Age December 1981 pg 146 -; -; v2.0 - 07/23/83 Modified to be consistent in the ZCPR2 tool set. -; - Rick Conn -; v1.0 - 05/18/84 Modified to be consistent in the ZCPR3 tool set. -; - Rick Conn -; -; Contributors: -; v1.6 - Dave Rand -; v1.5 - Irv Hoff -; v1.4 - Paul Traina -; v1.3 - Irv Hoff -; v1.2 - Charlie Strom -; v1.1 - Bruce Blakeslee -; v1.0 - Retyped from Interface Age (Dec 81). - Henry Rothberg -; - -; -; SYSLIB AND Z3LIB ROUTINES -; - EXT Z3INIT,CODEND - EXT PRINT,COUT,CRLF - -; -; System equates: -; -BOOT EQU 0000H ;CP/M WARM BOOT JUMP VECTOR -BDOS EQU BOOT+05H ;CP/M BDOS CALL JUMP VECTOR -TBUFF EQU BOOT+80H ;DISK I/O BUFFER -FCB EQU BOOT+5CH ;DEFAULT FILE CONTROL BLOCK -FCB2 EQU BOOT+6CH ;SECONDARY FILE CONTROL AREA -CR EQU 'M'-'@' ;CTL-M FOR CARRIAGE RETURN -LF EQU 'J'-'@' ;CTL-J FOR LINE FEED -CTRLC EQU 'C'-'@' ;ABORT - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - LXI H,0 ;SAVE STACK PTR - DAD SP - SHLD STACK - CALL CODEND ;DETERMINE FREE SPACE - SHLD FNTAB ;SET PTR TO FILE NAME TABLE - LXI D,512 ;1/2 K - DAD D - SPHL ;NEW STACK - CALL HELLO ;SIGN ON MESSAGE - CALL HELPCHK ;CHECK FOR AND PRINT HELP MESSAGE - CALL PCHECK ;CHECK PARAMETERS - LDA FNCOUNT ;NUMBER OF FILES SPECIFIED - ORA A ;0=NONE - CNZ TRYFIX ;DO THE RECOVERY - CALL BYE ;SIGN OFF MESSAGE - JMP BOOT ;RETURN TO CP/M -; -; ** Main Routines ** -; - -; -; SAY WHO WE ARE -; -HELLO: - CALL PRINT - DB 'UNERASE Version ' - DB (VERS/10)+'0','.',(VERS MOD 10)+'0',0 - RET -; -; CHECK FOR VALID PARAMETERS AND SAY WHICH CP?M VERSION -; -PCHECK: - CALL OPTCHK ;CHECK FOR OPTIONS AND SET FLAGS - CALL FCBCHK ;MAKE SURE FILE SPECIFIED - CALL CPMCHK ;ESTABLISH CP/M PARAMETERS - CALL PUSCHK ;CHECK IF USER WANTS TO CHANGE DISK - RET -; -; LOOK THROUGH DIRECTORY -; -TRYFIX: - CALL NXTSEC ;GET A DIRECTORY SECTOR - RZ ;RETURNS ZERO FLAG IF NO MORE - CALL CHKENT ;CHECK IT OUT AND MAYBE FIX - JMP TRYFIX ;KEEP IT UP TILL DONE -; -; SIGN OFF AND RESET SYSTEM -; -BYE: - MVI C,13 ;SYSTEM RESET - CALL BDOS - LDA LISTFL ;LIST ONLY? - ORA A ;0=NO - JNZ PRNF - LDA FIXCNT ;CHECK FOR ACTIVITY - ORA A - JZ PRNF ;SAY NONE FOUND - CALL PRINT - DB CR,LF,'File(s) Recovered - DOUBLE CHECK Before Using',0 - RET -PRNF: - CALL PRINT - DB CR,LF,'NO Files Recovered',0 - RET -; -; CHECKS FOR P AND 0 OPTIONS IN COMMAND LINE -; -OPTCHK: - XRA A ;TURN OFF FLAGS - STA CURUSR - STA PAUSE - STA FIXCNT - STA LISTFL - STA FNCOUNT ;NO FILE NAMES - LXI H,1 ;SET SECTOR 1 - SHLD SECTOR - LXI H,TBUFF ;SCAN THRU TBUFF, BUILDING A FILE NAME TABLE - MOV A,M ;GET CHAR COUNT - INX H ;PT TO FIRST CHAR - PUSH H ;SAVE PTR - ADD L ;PT TO AFTER LAST CHAR - MOV L,A - MVI M,0 ;STORE ENDING ZERO - LHLD FNTAB ;PT TO TABLE - XCHG ;... IN DE - POP H ;GET PTR TO FIRST CHAR - CALL SBLANK ;SKIP BLANKS -FNLOOP: - PUSH D ;SAVE TABLE PTR - CALL GETFN ;EXTRACT FILE NAME - POP D - PUSH H - LXI H,11 ;PT TO NEXT TABLE ENTRY - DAD D - XCHG - POP H - LDA FNCOUNT ;INCREMENT COUNT - INR A - STA FNCOUNT - MOV A,M ;GET TERMINATING CHAR - INX H ;PT TO NEXT - CPI ',' ;ANOTHER FOLLOWS? - JZ FNLOOP - DCX H ;POINT BACK TO DELIM - CALL SBLANK ;SKIP TO NON-BLANK -OPTCK1: - MOV A,M ;GET OPTION - CALL DELCHK ;DONE IF DELIM - RZ - CPI 'L' ;LIST ONLY? - JZ OPTCKL - CPI 'P' ;PAUSE? - JZ OPTCKP - CPI 'Z' ;USER 0? - JZ OPTCKZ - CALL PRINT - DB CR,LF,'Invalid Option -- ',0 - MOV A,M - CALL COUT - JMP HCK1 -OPTCKL: - MVI A,0FFH ;SET FLAG - STA LISTFL - INX H ;PT TO NEXT - JMP OPTCK1 -OPTCKP: - MVI A,0FFH ;SET FLAG - STA PAUSE - INX H ;PT TO NEXT - JMP OPTCK1 -OPTCKZ: - MVI A,0FFH ;SET FLAG - STA CURUSR - INX H - JMP OPTCK1 -GETFN: - PUSH D ;FILL TARGET FCB - MVI B,11 ;11 BYTES - MVI A,' ' ;SPACE FILL -GETFN0: - STAX D ;PUT SPACE - INX D - DCR B - JNZ GETFN0 - POP D ;PT TO ENTRY AGAIN - CALL SCANCOL ;SCAN FOR COLON - MVI B,8 ;8 CHARS MAX - CALL GETFN1 ;GET AND FILL ENTRY - MOV A,M ;GET CHAR - CPI '.' ;DELIM? - RNZ ;DONE - INX H ;PT TO AFTER PERIOD - MVI B,3 ;3 CHARS MAX AND DO IT AGAIN -GETFN1: - MOV A,M ;GET CHAR - CPI '.' ;END OF FIELD? - JZ GETFN3 - CALL DELCHK ;CHECK DELIMITER - RZ - CPI '*' ;WILD? - JZ GETFNQ - STAX D ;STORE CHAR - INX H ;PT TO NEXT - INX D - DCR B ;COUNT DOWN - JNZ GETFN1 -GETFN2: - MOV A,M ;FLUSH CHARS TO DELIM - CALL DELCHK ;CHECK FOR DELIMITER - RZ - INX H ;PT TO NEXT - JMP GETFN2 -GETFN3: - INX D ;PT TO AFTER FIELD - DCR B ;COUNT DOWN - JNZ GETFN3 - RET -GETFNQ: - MVI A,'?' ;FILL WITH QUESTION MARKS - STAX D - INX D - DCR B - JNZ GETFNQ - JMP GETFN2 ;SKIP TO DELIM -DELCHK: - ORA A ;END OF LINE? - RZ - CPI '.' ;END OF FIELD? - RZ - CPI ',' ;END OF ENTRY? - RZ - CPI ' ' - RET -SBLANK: - MOV A,M ;SKIP TO NON-BLANK - CPI ' ' - RNZ - INX H - JMP SBLANK -SCANCOL: - PUSH D ;SAVE TABLE PTR - PUSH H ;SAVE PTR -SCOL1: - MOV A,M ;GET CHAR - INX H ;PT TO NEXT - CPI ':' ;COLON? - JZ SCOLX - CALL DELCHK ;CHECK FOR DELIMITER - JNZ SCOL1 -SCOL2: - POP H ;RESTORE - POP D - RET -SCOLX: - XCHG ;DE PTS TO AFTER COLON - POP H ;GET OLD PTR - XCHG ;REPLACE IT - POP D ;GET TABLE PTR - RET -; -; CHECKS THE CURRENT 4 DIRECTORY ENTRIES AGAINST ARGUMENT -; IF MATCH, REWRITES SECTOR WITH REACTIVATED 1ST BYTES -; -CHKENT: - XRA A ;ASSUME NO REWRITE - STA REWRT - MVI B,4 ;NUMBER OF ENTRIES PER SECTOR - LXI H,TBUFF ;BEGINNING OF BUFFER -CKLUP: - PUSH B - MOV A,M - CPI 0E5H ;CHECK FOR UNUSED - JNZ CKINC - PUSH H - LHLD FNTAB ;PT TO POTENTIAL FILES - XCHG - POP H - LDA FNCOUNT ;NUMBER OF ENTRIES TO COUNT - MOV B,A ;... IN B -CKLUP0: - PUSH H ;SAVE BEGINNING ADDRESS - PUSH D ;SAVE PTR - PUSH B ;SET NAME COUNT - CALL COMPAR ;COMPARE WITH ARGUMENT - POP B ;GET NAME COUNT - POP D ;GET PTR - POP H - JZ CKLUP1 ;MATCH! - PUSH H ;SAVE PTR - LXI H,11 ;PT TO NEXT ENTRY - DAD D - XCHG - POP H - DCR B ;COUNT DOWN - JNZ CKLUP0 - JMP CKINC -CKLUP1: - LDA LISTFL ;LIST ONLY? - ORA A ;0=NO - JNZ CKINC - MVI M,0 ;SET USER 0 - LDA CURUSR ;CHECK FOR CURRENT USER - CPI 0FFH - JZ CKLUP2 - PUSH H ;SAVE HL - MVI E,0FFH ;GET USER VALUE - MVI C,32 ;GET USER AREA FUNCTION - CALL BDOS ;BDOS RETURNS CURRENT AREA IN 'A' REG. - POP H ;RESTORE HL - MOV M,A ;POKE IN CURRENT USER AREA -CKLUP2: - MVI A,0FH ;SAY NEED REWRITE - STA REWRT - MVI A,0FFH ;SET COUNT FLAG - STA FIXCNT -CKINC: - POP B - LXI D,32 ;LENGTH OF ENTRY - DAD D - DCR B - JNZ CKLUP - LDA REWRT ;SEE IF NEED REWRITE - ORA A - JZ CKDONE ;NO - DONE -; -; WRITE THE DIRECTORY SECTOR BACK TO THE DISK -; - LHLD TRACK ;SET TRACK - MOV C,L - MOV B,H - CALL SETTRK - LHLD SECTOR ;SET SECTOR - MOV B,H - MOV C,L - CALL TRNSLT - CALL SETSEC - CALL WRITE ;WRITE THE SECTOR BACK - ORA A - JNZ ERRWRT ;ABORT IF ERROR -CKDONE: - LHLD DIRMAX - DCX H ;REDUCE SECTORS LEFT - SHLD DIRMAX - LHLD SECTOR ;POINT TO NEXT SECTOR - INX H - SHLD SECTOR - XCHG - LHLD MAXSEC ;REACHED LIMIT? - INX H ;ONE MORE - MOV A,H ;CHECK HIGH - CMP D - RNZ - MOV A,L ;CHECK LOW - CMP E - RNZ - LHLD TRACK ;NEXT TRACK - INX H - SHLD TRACK - LXI H,1 ;FIRST SECTOR OF NEXT TRACK - SHLD SECTOR - RET -; -; COMPARE 11 BYTES OF DIRECTORY ENTRY AGAINST ARGUMENT -; -COMPAR: - SHLD TEMP ;Hold pointer in case of match - INX H - XCHG - MVI C,11 -CMPR1: - LDAX D ;GET DIRECTORY ENTRY CHARACTER - ANI 7FH ;STRIP ANY FLAGS - CMP M - JNZ CMPCKAM -CMPR2: - INX D - INX H ;BUMP TO NEXT CHARACTER - DCR C - JNZ CMPR1 ;LOOP FOR 11 CHARACTERS - LDA FIXCNT ;CHECK FLAG - ORA A ;0=FIRST TIME - CZ PRFIX - LHLD TEMP - CALL PRINTFCB - XRA A - RET ;RETURNS 'ZERO' FLAG SET FOR MATCH -PRFIX: - LDA LISTFL ;LIST ONLY? - ORA A ;0=NO - JNZ PRFIX1 - CALL PRINT - DB CR,LF,'File(s) Recovered --',0 - RET -PRFIX1: - MVI A,0FFH ;DON'T PRINT THIS AGAIN - STA FIXCNT - CALL PRINT - DB CR,LF,'Erased File(s) --',0 - RET -CMPCKAM: - LDAX D - CPI 0E5H ;NON-ALLOCATED ENTRY? - JZ SKIP - MOV A,M - CPI '?' - RNZ - JMP CMPR2 -SKIP: - ORA A - RET ;SET NZ FLAG -; -; CHECK FOR CP/M VERSION AND SET THINGS -; -CPMCHK: - LXI D,80H ;SET DMA TO TBUFF - MVI C,26 - CALL BDOS - CALL CPM22 ;IF 2.2 GO SET THINGS - CALL GTBIOS ;ESTABLISH BIOS JUMP VECTOR -; -; SELECT DISK AND SETUP DISK PARAMETER HEADER -; - LDA FCB ;GET THE DISK - MOV E,A - MVI C,14 - CALL BDOS - LDA FCB - MOV C,A - MVI B,0 - CALL SELDSK ;MAKE SURE DRIVE IS - MOV A,H ; SELECTED - ORA L - JZ ILDISK - MOV E,M ;GET THE ADDRESS - INX H ; OF THE XLTO - MOV D,M - XCHG - SHLD DPH ;SAVE THE ADDRESS - RET -; -; DETERMINE NUMBER OF DIRECTORY ENTRIES -; -CPM22: - MVI C,31 ;GET DISK PARAMETERS ADDRESS - CALL BDOS ;DPB ADDRESS IN 'HL' ON RETURN - MOV E,M ;NUMBER OF SECTORS/TRACK - INX H ;AS 2-BYTE QUANTITY IN DE - MOV D,M - INX H - XCHG - SHLD MAXSEC ;SET MAX SECTORS/TRACK - XCHG - INX H - INX H - MOV A,M ;GET EXM - STA EXTENT - INX H ;PT TO DRM - INX H - INX H - MOV E,M ;GET NUMBER OF - INX H ; DIRECTORY ENTRIES - MOV D,M - XCHG - INX H ;ACCOUNT FOR - 1 - CALL SHFHL2 ;SHIFT 'HL' RIGHT 2 - SHLD DIRMAX ;SAVE NUMBER DIRECTORY SECTORS - LXI H,5 ;NOW POINT TO SYSTEM - DAD D ; TRACK OFFSET - MOV A,M ;PICK UP NUMBER OF - INX H - MOV H,M - MOV L,A - SHLD TRACK - RET -; -; ERROR OCCURED DURING DISK WRITE - ABORT -; -ERRWRT: - CALL PRINT - DB CR,LF,'ABORT - Error During Disk Write',0 - JMP BOOT ;ABORT -; -; MAKE SURE A LEGAL DISK IS SPECIFIED AND CHECK FOR HELP -; -FCBCHK: - LDA FCB ;GET DRIVE SPECIFICATION - ORA A ;SEE IF DEFAULT - JNZ FCBCK1 ;NO, GO CHECK FILENAME - MVI C,25 ;ASK FOR CURRENT DRIVE - CALL BDOS - INR A ;OFFSET FOR NEXT INSTRUCTION -FCBCK1: - DCR A ;CURRENT DRIVE NUMBER - STA FCB ;SAVE IT - RET -; -; CHECK FOR HELP REQUEST -; -HELPCHK: - LDA FCB+1 ;GET 1ST BYTE OF FILENAME - CPI '/' ;HELP? - JZ HCK1 - CPI ' ' ;MAKE SURE IT IS NON-BLANK - RNZ ;OK - KEEP GOING -; -; IF NO FILE NAME IS SPECIFIED, ABORT WITH NOTICE -; -HCK1: - CALL PRINT - db cr,lf,'Syntax:' - DB CR,LF,' UNERASE afn,afn,afn,... o' - db cr,lf,'Options:' - DB CR,LF,' L - List Erased Files Only' - DB CR,LF,' P - Pause for disk change' - DB CR,LF,' Z - Place file in User 0 ' - DB '(default is current)' - DB 0 -CLEANRET: - LHLD STACK ;QUIET RETURN - SPHL - RET -; -; GET BIOS JUMPS VECTORS FOR EASY REFERENCE -; -GTBIOS: - LHLD BOOT+1 ;POINTS TO BIOS JUMP TABLE+3 - LXI D,WBOOT ;WHERE WE WILL KEEP A COPY - MVI B,16*3 ;MOVE 48 BYTES AND FALL THRU TO MOVE -; -; GENERAL PURPOSE MOVE ROUTINE -; FROM 'HL' TO 'DE' FOR COUNT OF 8 -; -MOVE: - MOV A,M ;GET A BYTE - STAX D ;PUT A BYTE - INX D ;INCREMENT TO NEXT - INX H - DCR B ;COUNT DOWN - JNZ MOVE - RET -; -;SPECIFIED AN ILLEGAL DISK DRIVE - ABORT -; -ILDISK: - CALL PRINT - DB CR,LF,'ABORT - Illegal Disk Requested',0 - JMP BOOT ;ABORT -; -; READS NEXT SECTOR (GROUP OF FOUR DIRECTORY ENTRIES) -; RETURNS WITH ZERO FLAG SET IF NO MORE -; -NXTSEC: - LHLD DIRMAX ;SEE IF MORE SECTORS - MOV A,H - ORA L - RZ ;RETURNS ZERO FLAG IF NO MORE - LHLD TRACK ;SET TRACK - MOV C,L - MOV B,H - CALL SETTRK - LHLD SECTOR ;SET SECTOR - MOV B,H - MOV C,L - CALL TRNSLT - CALL SETSEC - CALL READ ;READ A SECTOR - ANI 1 ;REVERSE SENSE OF ERROR FLAG - XRI 1 ;RETURNS WITH ZERO FLAG SET - RET ;IF BAD READ -; -; FCB PRINTING ROUTINE -; -PRINTFCB: - PUSH H - LXI D,1+8+3 - DAD D - LDA EXTENT ;GET EXTENT MASK - CMP M ;COMPARE TO TARGET - POP H - RC ;PRINT ONLY FIRST EXTENT - CALL PRINT ;NEW LINE WITH 2 LEADING SPACES - DB CR,LF,' ',0 - INX H - MVI B,8 - CALL PR1 - MVI A,'.' - CALL COUT - MVI B,3 -PR1: - MOV A,M - ANI 7FH - CPI ' ' ;Check for blanks - CNZ COUT - INX H - DCR B - JNZ PR1 - RET -; -; DOES USER WANT TO PAUSE TO CHANGE DISKS OR SELECT USER 0? -; -PUSCHK: - LDA PAUSE ;GET OPTION - ORA A - RZ ;NOPE, SO RETURN - CALL PRINT ;PRINT PAUSE MESSAGE - DB CR,LF,'Change Disk - Hit ^C to Abort, Anything Else to Cont - ' - DB 0 - MVI C,01 - CALL BDOS ;INPUT A CHAR - CPI CTRLC ;ABORT? - JZ CLEANRET - CALL CRLF - MVI C,0DH - JMP BDOS ;RESET THE DISK -; -; SHIFT REGS 'HL' RIGHT 2 BITS LOGICAL -; -SHFHL2: - CALL SHFHL ;ROTATE RIGHT 1 BIT AND FALL THRU -SHFHL: - XRA A ;CLEAR CARRY - MOV A,H - RAR ;SHIFTED BIT IN CARRY - MOV H,A - MOV A,L - RAR - MOV L,A - RET -; -; TRANSLATE REG 'BC' FROM LOGICAL TO PHYSICAL SECTOR NUMBER -; -TRNSLT: - LHLD DPH ;GET ADDRESS OF XLTO - XCHG - CALL SECTRAN ;USE BIOS ROUTINE - MOV C,L ;RETURN VALUE IN BC - MOV B,H - RET -; -; THIS IS THE WORKING COPY OF THE BIOS JUMP TABLE -; -WBOOT: DS 3 -CONST: DS 3 -CONIN: DS 3 -CONOUT: DS 3 -LIST: DS 3 -PUNCH: DS 3 -READER: DS 3 -HOME: DS 3 -SELDSK: DS 3 -SETTRK: DS 3 -SETSEC: DS 3 -SETDMA: DS 3 -READ: DS 3 -WRITE: DS 3 -LISTST: DS 3 -SECTRAN: DS 3 -; -STACK: - DS 2 ;LOCATION OF STACK -; -; DATA AREAS -; -FNCOUNT: - DS 1 ;NUMBER OF FILE NAMES IN COMMAND LINE -CURUSR: DS 1 ;0 IF NOT IN CURRENT USER -PAUSE: DS 1 ;0 IF NO PAUSE FOR DISK CHANGE -LISTFL: DS 1 ;0 IF NOT LIST ONLY -DIRMAX: DS 2 ;NUMBER OF SECTORS IN DIRECTORY = -; ; MAXIMUM NUMBER OF DIRECTORY ENTRIES -; ; DIVIDED BY 4 (ENTRIES PER SECTOR) -TEMP: DS 2 ;TEMP STORAGE FOR FCB PRINT -EXTENT: DS 1 ;EXTENT MASK -MAXSEC: DS 2 ;MAXIMUM NUMBER OF SECTORS/TRACK -FIXCNT: DS 1 ;CHANGE FLAG -REWRT: DS 1 ;REWRITE FLAG 0=NO, F=YES -SECTOR: DS 2 ;CURRENT SECTOR NUMBER -TRACK: DS 2 ;TRACK NUMBER OF DIRECTORY -; -; ADDRESS OF THE TRANSLATE TABLE -; -DPH: DS 16 - -FNTAB: DS 2 ;FILE NAME BUFFER - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/VF-BOX11.LBR b/Source/Images/d_bp/u15/VF-BOX11.LBR deleted file mode 100644 index 55c5cfe6..00000000 Binary files a/Source/Images/d_bp/u15/VF-BOX11.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/VF41.IQF b/Source/Images/d_bp/u15/VF41.IQF deleted file mode 100644 index 1940f8b6..00000000 Binary files a/Source/Images/d_bp/u15/VF41.IQF and /dev/null differ diff --git a/Source/Images/d_bp/u15/VF41H.LBR b/Source/Images/d_bp/u15/VF41H.LBR deleted file mode 100644 index c2022e13..00000000 Binary files a/Source/Images/d_bp/u15/VF41H.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/VF42A.LBR b/Source/Images/d_bp/u15/VF42A.LBR deleted file mode 100644 index 718954fc..00000000 Binary files a/Source/Images/d_bp/u15/VF42A.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/VFILER.COM b/Source/Images/d_bp/u15/VFILER.COM deleted file mode 100644 index bfb28b3b..00000000 Binary files a/Source/Images/d_bp/u15/VFILER.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/VFILER.HLP b/Source/Images/d_bp/u15/VFILER.HLP deleted file mode 100644 index 5dc3a0c3..00000000 --- a/Source/Images/d_bp/u15/VFILER.HLP +++ /dev/null @@ -1,477 +0,0 @@ -VFILER VFILER Overview, Revision 3 -Install Installing VFILER -Commands VFILER Command Summary -DIR The DIR Form -User User Functions: 0-9 # -Tagging Tagging Commands: T U GT GU -Display File Display Commands: P V -Ops File Operations Commands: C D F GC GD GF R -Movement Movement Commands: Arrows + - J Q -Misc Miscellaneous Commands: A H N S Z ^C ? -:VFILER 3.x Overview - VFILEÒ  (foò Videï FILER)¬  deriveä froí FILER¬  waó Overview -createä   tï  givå  thå  ZCPR³  useò  á   specializeä   filå -manipulatioî  utilitù  whicè  coulä takå  advantagå  oæ  thå -speciaì  featureó  oæ  ZCPR3®  Iô performó thå  samå  basiã -functionó aó DISK7¬  CLEANUP¬  WASH¬ anä SWEEP¬ buô iô takeó -thå  ZCPR³  environmenô intï accounô anä addó  commandó  anä -featureó  whicè makå VFILEÒ morå comfortablå foò  thå  ZCPR³ -user®  VFILEÒ containó essentiallù thå samå featureó aó thå -otheò  tooló  buô addó morå ZCPR3-specifiã featureó  anä  ió -totallù   screen-oriented¬   beinç  designeä  tï  ruî  oî  á -conventionaì  CRÔ  whicè  supportó  cursoò  address¬   cleaò -screen¬ anä (optionally© eraså tï enä oæ line. - - VFILEÒ  significantlù  simplifieó thå  useò  interface® -Undeò VFILER¬  aî alphabetizeä listinç oæ fileó ió presenteä -tï thå useò alonç witè á pointer®  Thå useò employó pointeò -movemenô commandó tï movå thå pointeò up¬  down¬  right¬ anä -lefô  aó desireä untiì iô ió pointinç tï á filå oæ interest® -Oncå  pointinç tï sucè á file¬  thå useò maù theî perforí  á -numbeò oæ operationó oî thå file. - Overview - VFILEÒ ió invokeä bù á commanä linå oæ thå followinç -form: - VFILER dir:filename.typ - -wherå alì parameteró arå optional®  "DIR¢ ió thå  directorù -tï  initiallù  loç thå useò into¬  anä iô maù bå  anù  ZCPR³ -directorù reference¬  sucè aó á mnemoniã (likå "ROOT:"© oò á -DÕ  forí  (likå  "B7:¢  oò  "12:")®  "filename.typ¢  ió  aî -ambiguouó  filå  namå  whicè ió useä tï perforí  aî  initiaì -selectioî oæ thå fileó tï bå displayeä bù VFILER. - - Thå referencå foò thå ambiguouó filå namå ió storeä  iî -Systeí Filå 4¬  and¬  aó such¬ caî bå dynamicallù changeä bù -usinç  thå  SETFILÅ commanä durinç thå executioî oæ  VFILER® -Iæ  á ZCPR³ commanä likå "SETFILÅ ´ afn¢ ió  executeä  whilå -VFILEÒ  ió  running¬  theî thå definitioî oæ thió  ambiguouó -filå referencå ió changed¬ anä thå nexô timå VFILEÒ restartó -executioî thå ne÷ ambiguouó filå referencå ió iî effect¬ anä -thå fileó arå selecteä accordingly. - Overview - Thió HLÐ Filå applieó tï VFILEÒ 3.0®  VFILEÒ 3.°  wilì -onlù  ruî  undeò ZCPR³ unlesó thå Environmenô Descriptoò  ió -madå internaì tï VFILER¬  iî whicè caså VFILEÒ wilì bå  1/4Ë -larger. - - Therå  arå  somå customizatioî equateó aô thå fronô  oæ -thå  VFILER.MAà sourcå file®  Thå useò wilì  generallù  noô -carå  abouô touchinç these¬  buô theù arå availablå iæ hå sï -desires®  Feeì  freå  tï examinå  them®  Onå  sucè  equatå -enableó   oò  disableó  thå  built-iî  documentatioî  (help© -feature®  Iæ thió featurå ió disabled¬  anù helð  referencå -wilì chaiî tï thió HLÐ filå (VFILER.HLP© anä VFILER.COÍ wilì -bå abouô 1Ë shorter®  Iæ enabled¬ thå conveniencå oæ onlinå -helð whicè ió accesóed quicklù ió available. - - Enjoy using VFILER! - - Rick Conn - -:Installing VFILER - Install - Installatioî   oæ  VFILEÒ  ió  quitå  simple¬   aó   ió -installatioî  oæ  thå variouó utilitieó  undeò  ZCPR3®  Alì -VFILEÒ requireó iî thå waù oæ installatioî ió thaô á pointeò -tï  thå  ZCPR³  Environmenô Descriptoò  bå  provideä  tï  iô -(unlesó  VFILEÒ haó beeî assembleä tï contaiî aî Environmenô -Descriptor¬  iî whicè caså thå entirå Environmenô Descriptoò -is necessary). - - Z3INÓ  caî  bå useä tï instalì  VFILER®  Tï  dï  this¬ -creatå  aî INÓ filå (calì iô VF.INS© containinç thå namå  oæ -thå VFILER.COÍ filå oî onå line®  Assuminç thaô youò systeí -Environmenô  Descriptoò  filå ió nameä  SYS.ENV¬  issuå  thå -command: - - Z3INS SYS.ENV VF.INS - - VFILER is now installed. - -:VFILER Command Summary - Summary - - --- Tagging Commands -- --------- File Operations ----------- - Ô - Taç Filå à - Copù Filå Ä - Deletå File - U - Untag File F - File Size R - Rename File - G - Group Copy/Delete/FSize/Tag/Untag - - -- File Print & View -- --- User Functions --- - -- Cursor -- P - Print V - View 0-9 - Execute # - Help - ^E - ^ -- Movement Commands -- ---- Miscellaneous ---- - ^S <-+-> ^D - File Forward A - Toggle Alpha Sort - v - File Backward H - Help File Š ^X + - Screen Forward N - New DIR - - - Screen Backward S - Disk Status - -- Screen -- J - Jump tï á Filå Z - ZCPR3 Command - ^A Left Q - Refresh Screen ^C - Exit - ^F Right - - Summary - Movement Commands -- - ^E - Move Up (Wrap to Bottom) - ^X - Move Down (Wrap to Top) - ^D - Move Right (Wrap to First File of Next Line) - ^S - Move Left (Wrap to Last File of Previous Line) - ^F - Move Screen Right (Wrap to First Screen) - ^A - Move Screen Left (Wrap to Last Screen) - - Thå  user'ó Z3TCAÐ entrù maù definå fouò otheò  single- -characteò  commandó  tï  conforí tï thå arro÷  keyó  oî  hió -specifiã  terminal®  Theså commandó wilì overridå  thå  seô -describeä  abovå  iæ anù conflictó exisô (thaô is¬  iæ  youò -down-arro÷ keù generateó á ^E¬ ^Å wilì no÷ meaî Movå Dowî iî -alì cases). - - Screeî  Lefô  anä Righô makå senså wheî therå  arå  toï -manù fileó tï fiô oî onå screen®  Iî thió case¬  thå  fileó -arå  brokeî  intï screeî directories¬  anä Screeî  Lefô  anä -Righô arå useä tï movå betweeî them. -:The DIR Form - DIR Form - Thå Copy¬ Masó Copy¬ anä Logiî commandó prompô thå useò -foò thå directorù tï copù oò loç into® Thå useò maù specifù -anù accepteä ZCPR³ DIÒ forí iî responså tï this. - - Thå  ZCPR³  DIÒ  forí maù bå eitheò  á  DÕ  (Disk/User© -specificatioî  oò á directorù namå (mnemonic)®  Exampleó oæ -DIÒ formó include: - - B <-- Disk B, Current User - 7 <-- Current Disk, User 7 - B7 <-- Disk B, User 7 - wordstar <-- DU associated with the name WORDSTAR - - Iî VFILER¬  theså entrieó maù bå optionallù suffixeä bù -á  coloî (:© aó thå useò desiresº  "B7:¢ anä "B7¢ meaî  thå -samå  thing®  Iæ  á DIÒ forí ió referenceä  iî  thå  VFILEÒ -command line, it MUST be followed by a colon. - -:User Functions - User Fcts - Thå  VFILEÒ  useò  ió giveî addeä  flexibilitù  iî  hió -commanä  invocatioî capabilitù bù thå uså oæ á seô oæ  user- -definablå functions¬  whicè arå executeä bù strikinç á digiô -froí ° tï 9® Thå basiã ideá ió this: - - 1© thå useò createó á filå calleä VFILER.CMD» thió -filå containó hió extendeä commanä set - - 2©  VFILER.CMÄ ió placeä alonç thå user'ó  commanä -searcè path - - 3©  wheî  thå useò ió iî VFILEÒ anä hå  strikeó  á -digiô  oò á pounä sigî (#© foò help¬  VFILEÒ searcheó  alonç Šthå patè foò thå firsô VFILER.CMÄ filå iô findó anä extractó -thå informatioî froí it - - User Fcts - Sincå  VFILEÒ  searcheó foò VFILER.CMÄ alonç thå  path¬ -severaì VFILER.CMÄ fileó maù bå availablå foò thå user® Foò -instance¬  iæ thå patè ió $¤ -¾ A¤ -¾ A15¬  theî VFILEÒ wilì -looë iî thå currenô directory¬ disë A/currenô user¬ anä disë -A/useò 1µ foò VFILER.CMD® Á general-purposå VFILER.CMÄ filå -maù bå placeä iî A15¬  anä special-purposå VFILER.CMÄ  fileó -(sucè aó foò assembleò languagå development¬  à development¬ -worä  processing¬  etc© maù bå placeä iî selecteä useò areaó -oî A®  Foò instance¬ A· coulä contaiî Worä Staò anä ió useä -foò worä processinç anä thaô B· ió thå scratcè areá foò texô -files® Witè thió path¬ á useò editinç fileó iî B· wilì finä -WÓ iî A7¬  VFILER.CMÄ (foò worä processing© iî A7¬  anä  hió -systeí commandó iî A15. - - Anù optionó requireä foò thå commandó arå prompteä for¬ -anä  wheî  thå useò inputó valueó foò  alì  options¬  VFILEÒ -chainó  tï thå ne÷ commanä viá thå ZCPR³ Commanä Linå Buffeò -feature¬  executeó thå commanä linå generated¬  anä returns® -VFILER is a true shell under ZCPR3. - User Fcts - Thå structurå oæ VFILER.CMÄ ió quitå simple® Iô caî bå -createä  bù  anù CP/Í texô editor¬  anä iô consistó  oæ  thå -followinç typeó oæ lines: - - 1© á commanä line¬ whicè beginó witè á digiô (0-9© -anä  containó thå texô oæ thå commanä tï bå executeä  shoulä -thaô digiô bå typeä bù thå user - - 2©  á  helð block¬  whicè ió printeä wheneveò  thå -useò typeó á pounä sigî (#)» thió blocë ió denoteä bù á linå -whicè beginó witè á pounä sign¬ anä iô extendó tï thå enä oæ -thå file - - 3©  á  commenô  line¬   whicè  ió  useä  tï  embeä -explanatorù comments¬  whicè arå foò referencå purposeó onlù -anä noô seeî bù thå VFILEÒ user - - COMMAND LINE User Fcts - - Thå  commanä  linå consistó oæ á digit¬  zerï  oò  morå -spaceó (whicè arå ignored)¬ anä thå texô oæ thå commanä witè -embeddeä promptó foò useò input®  Theså promptó arå denoteä -bù  beinç  encloseä iî single- oò double-quoteó  (§  oò  ")® -Wheî  VFILEÒ  executeó theså commanä lines¬  iô  printó  thå -prompô  containeä withiî thå quoteó aó theù arå  encountereä -anä  waitó foò thå useò tï inpuô á linå oæ texô  (terminateä -bù á RETURN)¬  aô whicè poinô thå texô ió substituteä iî thå -commanä  linå wherå thå prompô is®  Iæ á prompô extendó  tï -thå  enä  oæ  á commanä line¬  iô neeä  noô  bå  terminated® -Example: - 1 copy 'Source File? ' 'Destination Dir? ' - -wilì  definå  useò functioî 1®  Thå useò ió  prompteä  witè -"Sourcå File¿  "¬  hå enteró hió text¬  iô ió substituteä iî -thå commanä line¬ hå ió prompteä foò "Destinatioî Dir¿ "¬ hå -agaiî  enteró  á  response¬   iô  ió  substituted¬  anä  thå -resultinç commanä linå ió chaineä to. - User Fcts - 1 copy 'Source File? ' 'Destination Dir? ' - -Iæ  thå useò respondó witè "myfile.txt¢ anä "C0:"¬  theî thå -commanä line - - copy myfile.txt C0: - -ió built® Notå thaô spaceó anä otheò characteró betweeî thå -promptó arå significant. - - 1 mcopy 'Dest Dir? '='Source File? ' - -will generate (to the same inputs) - - mcopy C0:=myfile.txt - - PASSED PARAMETERS User Fcts - - Threå  parameteró  maù bå passeä froí VFILEÒ  intï  thå -commanä  linå beinç generated®  Theså parameteró anä  theiò -symboló are: - - Symbol Parameter - %D Current Disk Letter - %U Current User Number (1 or 2 digits) - %F Current File Name (pted to by arrow) - %$ DU:FILENAME for Current File - - Iæ  thå  useò  musô inserô á  '%§  characteò  intï  thå -commanä  linå hå ió building¬  '%%§ placeó onå '%§ intï  thå -line® Example: - - echo Disk is %d, User is %u, File is %f - -printó (iæ thå useò ió iî A1µ anä ptinç tï MYFILE.TXT): - - Disk is A, User is 15, File is MYFILE.TXT - HELP BLOCK User Fcts - - Thå Helð Blocë iî thå VFILER.CMÄ filå ió simplù á blocë -oæ texô whicè extendó froí thå pounä sigî (#© iî thå filå tï -thå enä oæ thå file®  Thió helð informatioî ió displayeä tï -thå useò aó onå screen¬  anä iô ió thå responsibilitù oæ thå -persoî whï writeó thå VFILER.CMÄ filå tï seå thaô thió  bodù -oæ  texô  (includinç thå linå thå asterisë ió on©  doeó  noô -exceeä 2² lines® Example: - -# Help for Word Processing - - 1 - Run WordStar - 2 - Run WordMaster - 3 - Run ROFF4 - - COMMENT LINE User Fcts - - Á  commenô linå ió anù linå whicè doeó noô begiî witè á -digiô  oò  á  pounä sign®  Thå texô oæ  thaô  linå  ió  thå -comment® Iô ió noô displayeä tï thå VFILEÒ useò anä ió useä -onlù  foò  referencå tï thå persoî whï wrotå thå  VFILER.CMÄ -file® Example: - -! This is a comment -This is also a comment - - RUNNING ZEX User Fcts - - Likå  alì  standarä ZCPR³ Shells¬  VFILEÒ  ió  ablå  tï -supporô  thå executioî oæ thå thå ZEØ commanä filå processoò -oî  toð oæ itself®  Iæ ZEØ ió running¬  VFILEÒ wilì  simplù -prompô ZEØ foò inpuô ratheò thaî enterinç itó normaì screen- -orienteä displaù mode® Iî thió way¬ á commanä executeä froí -thå  VFILER.CMÄ  filå maù invokå ZEX¬  anä alì  oæ  thå  ZEØ -commanä  filå processinç wilì bå performeä beforå VFILEÒ  ió -reentered. - - SAMPLE VFILER.CMD User Fcts - -! VFILER Command File for Richard Conn -1 xdir 'XDIR Options? ' -2 protect %D%U:%F 'PROTECT Attributes? ' -3 wm %$ -4 t2a -5 echo Disk=%d User=%u File=%f DU:FILENAME = %$ -#VFILER Command File for Richard Conn - -The following VFILER Macros are provided -- - - 1 - XDIR with Options - 2 - PROTECT Current File - 3 - Edit Current File - 4 - TERM III - 5 - Echo Current File and Text - -:Tagging Commands - Tagging - Ô - Taç filå foò inclusioî foò masó copù tï anotheò  DÕ -(disk/user© area®  Filå remainó taggeä untiì eitheò á disë -log-iî  oò 'U§ ió useä tï untaç it®  Á 't§ markeò ió placeä -bù thå taggeä filenamå aó á remindeò thå filå ió taggeä  foò -masó copù oò masó delete. - - Õ  - Untaç filå previouslù taggeä foò masó  copy®  'U§ -caî  bå useä tï movå cursoò 'forward§ foò quicë untagginç oæ -files®  Logging-iî  drivå  agaiî witè 'N§ alsï  untagó  alì -files. - - Ç Ô oò Õ - Grouð (Mass© Taç oò Untag® Useò ió prompteä -foò thå operation¬  anä twï oæ hió optionó arå Ô anä U®  Iæ -eitheò  operatioî ió selected¬  tagginç oò untagginç  occuró -automaticallù  froí  thå cursoò positioî tï thå enä  oæ  thå -screeî  oî  alì fileó iî thió area®  Iæ thå useò wisheó  tï -theî seå thå accumulateä sizeó oæ thå taggeä files¬  thå Ç Æ -(Grouð Filå Size© commanä maù bå issued. - -:File Display Commands - Display - Ð - Prinô texô filå tï CP/Í lisô devicå (printer)® Anù -keypresó cancels. - - Ö  - Vie÷  texô filå oî console¬  witè  paginatioî  anä -single-linå turn-up®  ^D - v - ^X - -:Miscellaneous Commands - Misc - Á - Togglå Alphá Sort® Thió commanä reverseó thå senså -oæ thå sorô oæ thå currenô directory¬ reloadó thå directory¬ -anä refresheó thå screen¬ havinç sorteä iô iî thå ne÷ sense® -Sortinç  ió donå bù filå namå anä typå oò bù filå  typå  anä -name. - - È  - Invokeó  externaì HELÐ Information®  VFILEÒ  wilì -chaiî  tï  HELÐ anä displaù thå informatioî  iî  VFILER.HLP® -VFILEÒ  checkó  tï  seå  iæ HELÐ caî  bå  founä  alonç  patè -(externaì  iæ available¬  internaì iæ externaì patè  ió  noô -available©  anä doeó noô attempô tï chaiî iæ HELP.COÍ cannoô -bå found. - - Î - Logiî ne÷ DÕ areá foò displaù anä reseô systeí  foò -disë changes® Formaô oæ DÕ forí ió samå aó 'C§ foò copy. - - Misc - Ó  - Statuó oæ requesteä drive¬  showó  remaininç  disë -storagå   iî  kilobyteó  anä  numbeò  oæ  fileó  iî  currenô -directory. - - Ú - Ruî anù ZCPR³ Commanä Line®  Useò wilì bå prompteä -foò  commanä line¬  anä VFILEÒ wilì bå reentereä iî samå  DÕ -areá aó wheî commanä waó executed®  Commanä wilì executå iî -thå originaì DÕ area as indicated by the prompt. - - ^C - Exit to Operating System. - - ¯  oò  ¿  - Prinô Commanä Summarù  (Shorô  Helð  Info)® -VFILEÒ  maù bå assembleä tï omiô built-iî help¬  creatinç  á -VFILEÒ  whicè  ió  abouô 1Ë shorteò thaî á VFILEÒ  witè  thå -built-iî  help®  Iæ  thå built-iî helð  ió  omitted¬  theså -commandó chaiî tï thå VFILER.HLÐ filå instead. - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/VFILER.MAC b/Source/Images/d_bp/u15/VFILER.MAC deleted file mode 100644 index d0512e80..00000000 --- a/Source/Images/d_bp/u15/VFILER.MAC +++ /dev/null @@ -1,4466 +0,0 @@ - -; TITLE 'VFILER' - -; VERSION: 3.0 -; DATE: 26 June 84 -; AUTHOR: Richard Conn - -; Changes to make Version 3.4 by Richard Conn: -; Symbol CCP changed to CCPLEN (when Z3BASE.LIB was added, the -; symbol CCP in Z3BASE.LIB conflicted with this symbol in VFILER; -; how did version 3.3 ever assemble in the first place, unless someone -; has modified Z3BASE.LIB from the original format?) -; Comments on version 3.3 changes added, prefixed by - -; THE FOLLOWING MAJOR CHANGES WERE MADE BY JAY SAGE AND BOB DEMROW TO -; MAKE VERSION 3.3. The changes were built from version 3.1. - -; The following changes were contributed by Jay P. Sage and marked by -; on the lines or at the blocks changed or added: -; 1. Code modified to eliminate double loading of program, once to -; establish shell and once to run shell. Program now checks after -; shell is established to see if any commands are pending in the -; command line. If there are none, the code is run immediately -; without reloading from disk. Otherwise, pending commands are run -; first as in previous versions. -; Good idea -; 2. The disk logging command was extended to include setting of the -; file selection mask in system file name 4. This command was also -; renamed from 'N' to 'L' to be consistent with common usage in -; previous versions of VFILER and other programs. An equate is -; provided early in the code for those who want to change this. -; The response to the 'L' command is now a general ambiguous file -; specification. If it includes a directory specification, then -; that directory is logged into. Otherwise, one remains in the -; current directory. If it includes a file name specification, -; then that name is copied to system file name 4 and is used as a -; mask for file selection. Otherwise '*.*' is used automatically. -; Note that the colon must now be included to specify only a new -; directory. Since a carriage return alone cancels the command, -; '*.*' would have to be entered to stay in the currect directory -; but include all files. As a shortcut one can enter just a colon -; or semicolon. -; Fine; note that the change of the command name to 'N' was -; done in the first place to be consistent with FRIENDLY, -; the "commercial VFILER" sold by Ampro Computers; but, then -; again, if you use FRIENDLY, you probably don't use VFILER, -; so the problem of consistency may not come up -; 3. Several changes were made in the command table to allow for -; synonyms. The 'X' abort operation was deleted from the 'L' -; command but was made equivalent to control-c in the main command -; table. The functions control-a and control-f, though included in -; the help screen, had not previously been implemented. They are -; here made synonyms for '-' and '+', respectively. (The built-in -; help screen was modified to make this clear.) For ease in -; entering commands, '<' and ',' were made the same as control-s, -; and '>' and '.' were made the same as control-d. -; Fine; I debated for some time about adding synonyms, and -; had originally decided against it; let's try this change -; as-is and see how it works; however, re the addition of -; ^A and ^F as synonyms for - and +, I'm sorry I forgot to -; delete these from the Help screen -- they were intentionally -; omitted because of potential conflict with arrow keys from -; Z3TCAP -- if an arrow key generated ^A or ^F, then the ^A/^F -; movement functions were overriddent by ^A/^F arrows, so I -; decided to drop them completely and have only - and +; again, -; let's try this change for a while and see how it works out -; 4. When files are deleted with the 'D' command, notice to that -; effect is displayed on the command line at the bottom of the -; screen. -; 5. Highlighting on the 'Z80 Code' and '8080 Code' messages was -; deleted. -; Cosmetic -; 6. Rename function made to completely update file ring and display. -; This solves the problem of renamed files being out of place. -; Good idea - -; The following changes were contributed by R.I.Demrow and are marked by -; on all lines that were changed. -; 1. Replaced Z3ENV equate by MACLIB reference to Z3BASE.LIB. This -; library includes definitions for true and false, the value of -; Z3ENV, and the value of I8080 (indicates whether to use Z80 -; opcodes) -; Good idea; it is nice to have these equates carried in thru -; Z3BASE.LIB, but don't expect to find matching CRCs from one -; assembly to the next -- the COM files will differ depending -; on values in Z3BASE; I feel, tho, that the convenience of -; including Z3BASE outweighs the inconvenience of matching CRCs -; 2. Added highlighting to current file and current disk on top line -; of display. -; See comment under next change -; 3. Tagged files are now highlighted on the screen. -; There was a lot of debate during the design of FRIENDLY as -; to whether to point to a file via a pointer or via highlighting; -; the highlighting option was ruled against for the simple reason -; that pointing is very important and fundamental to the VFILER -; concept, and, on some terminals in certain kinds of lighting, -; it is nearly impossible to distinguish a highlighted file from -; one which is not highlighted; however, in this case, the file -; is highlighted AND followed by a tag character, so the best of -; both worlds is retained -; 4. Two new group functions were added: mass print and mass view. -; Not a bad idea, but I prefer using the PRINT and PAGE -; commands for these operations; note that a VFILER.CMD file -; could provide PRINT and PAGE easily without any cost inside -; of VFILER -; 5. The simulated clear-to-end-of-line function was corrected. It -; only cleared part of line before, and it had the wrong divisor in -; a modulus calculation. -; Good -; 6. Changed code to make use of TCAP information about length of -; printer page. That information was obtained in the previous code -; but was not utilized. -; Good - - -; PREVIOUS VERSIONS: 2.0 (18 Sep 83), 1.8 (17 Sep 83) -; PREVIOUS VERSIONS: 1.7 (9 Sep 83), 1.6 (18 Aug 83), 1.5 (20 July 83) -; PREVIOUS VERSIONS: 1.4 (19 July 83), 1.3 (18 July 83) -; PREVIOUS VERSIONS: 1.2 (18 July 83), 1.1 (17 July 83), 1.0 (16 July 83) -; DERIVATION: From FILER (Version 1.6) by Richard Conn -; FILER from DISK7, Version 7.6C, by Frank Gaude' - - -VERS EQU 34 ; Version Number - ; version number - - MACLIB Z3BASE.LIB ; USE LIB TO GET Z3ENV, I8080, FALSE, - ; and TRUE - -; VFILER is copyright (c) 1983, 1984, 1985 by Richard Conn -; All Rights Reserved -; VFILER may be used freely by the ZCPR3 Community - -; VFILER is a screen-oriented, ZCPR3-specific file utility. It can not be -; installed to run under conventional CP/M. VFILER -; extensively employs cursor addressing to position a pointer on the -; screen, allow the user to manipulate the pointer (up, down, right, left, -; next screen, previous screen, GOTO file). The pointer points to files -; in the current user directory and displays the user's position dynamically -; on the screen. Once pointing to a file, user commands can be used to -; manipulate the file (delete, copy, view on console, print on printer, tag -; for later copy or delete, and untag). In the way of being ZCPR3-specific, -; VFILER can chain to external programs via the MCL and then return (ala -; MENU), and it recognizes Named Directories (so the user can log into B:, B4:, -; and MYDIR:, for example). - -; VFILER is installed by Z3INS. - -; VFILER works with ZCPR3 only, with 32k or more of RAM. File copy -; functions are faster with large amounts of RAM. - -; VFILER can be assembled for use with a Z80 or 8080 microprocessor. - - -; SYSLIB, Z3LIB, and VLIB References -; - ext z3vinit,cls,gotoxy,ereol,envptr,getcrt,getprt,vprint - ext z3log,retud - ext fi0$open,f0$get,dutdir,fi0$close - ext sksp,putcl,getmdisk - ext cin,cout,caps,lout,crlf,lcrlf,pafdc,phlfdc - ext pfind,dnscan - ext getsh,getcl1,qshell,shpush,getzrun,putzex,putcst - ext getefcb,shpop,getsh2,getfn2,getshm,putshm - ext codend - ext stndout,stndend,getcl2,zprsfn ; -; -; Basic Definitions -; - -DIM EQU 1 ;GOTO DIM -BRIGHT EQU 2 ;GOTO BRIGHT - -; -; User-Customized Definition -; -VFNAME MACRO ;;Name of VFILER - DB 'VFILER' - ENDM -VFNFILL MACRO ;;Spaces to fill out name to 8 chars - DB ' ' - ENDM -; -Z80 EQU NOT I8080 ; from Z3BASE.LIB -BIHELP EQU TRUE ;TRUE to provide built-in help info -WARMBOOT EQU FALSE ;set TRUE to warmboot on exit -DEFALPHA EQU TRUE ;set TRUE to alpha by name and type, FALSE for - ; ... type and name by default -EPS EQU 18*4 ;N lines x 4 cols per screen - ; EPS = Entries Per Screen -TAGCH EQU '#' ;character used to mark tagged files -DIRCMD EQU 'L' ;command used to log new dir -- be sure it - ;does not conflict with other commands -- used - ;to be 'N' for new (I prefer 'L' for log) - -; -; Command Line Builder Constants -; -FPESC EQU '%' ;escape char -FPDISK EQU 'D' ;disk only (D) -FPUSER EQU 'U' ;user only (U) -FPFILE EQU 'F' ;file name only -MNOTE EQU '#' ;denotes comment area in macro file -UIN1 EQU 27H ;single quote for user input -UIN2 EQU 22H ;double quote for user input - -; -; Cursor Positioning Addresses -; -EPSLINE EQU (EPS/4)+4 ;position of last line of EPS -BANADR EQU 1*256+24 ;banner address -CURHOME EQU 3*256+1 ;home address of cursor -BOTADR EQU 24*256+1 ;bottom of screen -CPMADR EQU EPSLINE*256+1 ;command prompt message -CPADR EQU EPSLINE*256+22 ;command prompt -ERADR EQU (EPSLINE+1)*256+15 ;error message -FSADR EQU ERADR ;file size message -FNADR EQU 1*256+62 ;address of current file name -DUADR EQU 1*256+4 ;address of current DU - -; -; System Functions -; -RDCON EQU 1 -WRCON EQU 2 -PUNCH EQU 4 -LIST EQU 5 -DIRCON EQU 6 -RDBUF EQU 10 -CONST EQU 11 -RESETDK EQU 13 -LOGIN EQU 14 -OPEN EQU 15 -CLOSE EQU 16 -SRCHF EQU 17 -SRCHN EQU 18 -ERASE EQU 19 -READ EQU 20 -WRITE EQU 21 -MAKE EQU 22 -REN EQU 23 -INQDISK EQU 25 -SETDMA EQU 26 -INQALC EQU 27 -ATTR EQU 30 -GETPARM EQU 31 -SGUSER EQU 32 -COMPSZ EQU 35 - -; -; System Addresses -; -OS$BASE EQU 000H ;system base.. -CCPLEN EQU 800H ;..and 'ccp' length in bytes. - ; Changed name from CCP to CCPLEN -GET EQU 0FFH ;get user area e-reg value -BDOS EQU OS$BASE+05H -FCB EQU OS$BASE+5CH -FCBEXT EQU FCB+12 -FCBRNO EQU FCB+32 -FCB2 EQU OS$BASE+6CH -TBUF EQU OS$BASE+80H -TPA EQU OS$BASE+100H - -; -; ASCII Definitions -; -CTRLA EQU 'A'-'@' ; -CTRLC EQU 'C'-'@' ;..control-C.. -CTRLD EQU 'D'-'@' -CTRLE EQU 'E'-'@' -CTRLF EQU 'F'-'@' ; -CTRLR EQU 'R'-'@' -CTRLS EQU 'S'-'@' ;..XOFF.. -CTRLX EQU 'X'-'@' -BS EQU 08H ;..backspace.. -TAB EQU 09H ;..tab.. -LF EQU 0AH ;..linefeed.. -FF EQU 0CH ;..formfeed.. -CR EQU 0DH ;..carriage return.. -CAN EQU 18H ;..cancel.. -EOFCHAR EQU 1AH ;..end-of-file.. -CTRLZ EQU 1AH ;..clear screen.. -ESC EQU 1BH ;..and escape character. - -; -; MACROS TO PROVIDE Z80 EXTENSIONS -; MACROS INCLUDE: -; -; BR - JUMP RELATIVE -; BRC - JUMP RELATIVE IF CARRY -; BRNC - JUMP RELATIVE IF NO CARRY -; BRZ - JUMP RELATIVE IF ZERO -; BRNZ - JUMP RELATIVE IF NO ZERO -; BJNZ - DECREMENT B AND JUMP RELATIVE IF NO ZERO -; -BR MACRO ?N ;;JUMP RELATIVE - IF Z80 - .z80 - jr ?N - .8080 - ELSE - jmp ?N - ENDIF - ENDM -; -BRC MACRO ?N ;;JUMP RELATIVE ON CARRY - IF Z80 - .z80 - jr c,?N - .8080 - ELSE - jc ?N - ENDIF - ENDM -; -BRNC MACRO ?N ;;JUMP RELATIVE ON NO CARRY - IF Z80 - .z80 - jr nc,?N - .8080 - ELSE - jnc ?N - ENDIF - ENDM -; -BRZ MACRO ?N ;;JUMP RELATIVE ON ZERO - IF Z80 - .z80 - jr z,?N - .8080 - ELSE - jz ?N - ENDIF - ENDM -; -BRNZ MACRO ?N ;;JUMP RELATIVE ON NO ZERO - IF Z80 - .z80 - jr nz,?N - .8080 - ELSE - jnz ?N - ENDIF - ENDM -; -BJNZ MACRO ?N ;;DECREMENT B AND JUMP RELATIVE ON NO ZERO - IF Z80 - .z80 - djnz ?N - .8080 - ELSE - dcr b - jnz ?N - ENDIF - ENDM -; -; END OF Z80 MACRO EXTENSIONS -; - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; -; MACLIB Z3BASE ; already included above - MACLIB SYSENV -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; Once Environment is Initialized, One of Three Major Functions -; will be Performed: -; 1. VFILER will be installed as a Shell if invoked explicitly -; by user command -; 2. The VFILER Function will be performed if VFILER is invoked -; by ZCPR3 as a Shell and ZEX is not Running -; 3. A Command Line will be Input by VFILER from ZEX and Passed -; on to ZCPR3 without Processing -; - call z3vinit ;initialize the ZCPR3 Env and the VLIB Env -; -; Set Opsys Stack Pointer -; - if not WARMBOOT - lxi h,0 ;clear hl-pair then.. - dad sp ;..add stack address. - shld stack - endif ;not warmboot - -; -; Check to see if VFILER was executed as a shell -; - call qshell ;get and test message from ZCPR3 - jz runsh ;execute shell procedures -; -; Initialize VFILER as a Shell -; - call shtest1 ;there must be a shell stack - call shtest2 ;there must be a command line buffer -; -; FUNCTION 1: Set Up VFILER as a Shell -; Run Shell Via Exit to Opsys -; - call getefcb ;determine name of program - brz shgo1 ;name not given, so use default - inx h ;pt to name - lxi d,filercmd ;define name of program - mvi b,8 - call moveb ;copy name -shgo1: - call idu ;set initial disk/user - lxi h,filercmd ;establish shell - call shpush ;push onto shell stack - brnz shgo2 ;error? - - call filsel ;select file mask -; -; Print Done Message -; - call vprint - db ' Shell Installed',cr,lf,0 - mvi b,0 ;shell message 0 - mvi a,0 ;no wait - call putshm ;set shell message - - ;changes made by -; jmp chain2 ;set IDU into command line and go - call chain2 ;set IDU into command line - call getcl2 ;see if any more commands on line - ora a - brz runsh ;if none, run shell immediately - jmp os$ccp1 ;else return to opsys - -; -; Establish File Selection (made into subroutine ) -; -filsel: - call getfn2 ;setup file name - lxi d,11*3 ;use 4th system file - dad d - lxi d,fcb+1 ;pt to FCB - xchg - mvi b,11 ;copy 11 chars - call moveb - lxi h,joker ;make wild if FCB is empty - mvi b,11 ;11 chars - ldax d ;check first char - cpi ' ' - cz moveb - ret -; -; Error in Shell Stack Installation -; -shgo2: - cpi 2 ;shell stack full - brnz shgo3 - call vprint - db ' Shell Stack Full',0 - ret -shgo3: - call vprint - db ' Shell Entry Size',0 - ret - -; -; VFILER was invoked as a Shell -; Check for ZEX Input in Progress -; -runsh: - call getzrun ;check ZEX message byte - jnz zexrun ;process ZEX command line if ZEX running -; -; FUNCTION 2: Run VFILER and Perform Main Function -; - mvi a,0 ;set no shell message - call putcst - call setup ;init buffers and pointers - call stackset ;setup stack -; -; Process Initial Help if Available and Requested -; - if BIHELP ;built-in help available? - lda fcb+1 ;check for initial help - cpi '/' - brnz runsh1 - call helpmsg ;print help message - call sak ;strike any key to continue - br runsh2 -runsh1: - endif ;BIHELP -; -; Check for Delay Before Resuming VFILER and Delay if Set -; - mvi b,0 - call getshm ;get shell message 0 - ani 80h ;check MSB - cnz sak ;pause for input -; -; Begin VFILER Processing -; -runsh2: - call stackset ;reset stack - call fload ;load files - push psw - call setscr ;set up screen display variables - pop psw - brnz runsh4 ;continue if OK -; -; Entry Point to Log Into New Dir and Resume -; -runsh3: - call logdir ;error - log into another dir - br runsh2 -; -; Entry Point for Command Processing -; Display Screen and Input/Process Command -; -runsh4: - call stackset ;reset stack - call refresh ;refresh screen display -; -; Display Current File and Input/Process Command -; -loopfn: - call loopfn1 ;print current file name -; -; Input/Process Command -; -loop: - call stackset ;reset stack - call loopfn2 ;get command from user - call loopfn3 ;process command in A - br loop ;continue -; -; Set Stack Pointer -; -stackset: - pop d ;get return address - lhld crctbl ;top of stack - sphl ;start local stack - push d ;return address on new stack - ret -; -; Check for Presence of Shell Stack -; -shtest1: - call getsh ;get shell stack data - rnz - pop psw ;clear stack - call vprint - db 'No Shell Stack',0 - ret - -; -; Check for Command Line -; -shtest2: - call getcl1 ;get command line data - rnz - pop psw ;clear stack - call vprint - db 'No Cmd Line',0 - ret - -; -; FUNCTION 3: Run ZEX on Top of VFILER -; Accept Command Line and Pass it to ZCPR3 -; -zexrun: - call vprint ;print prompt - db 'VFILER> ',0 - mvi a,1 ;tell ZEX that it is prompted - call putzex - call getcl1 ;pt to command line buffer - mov a,l ;set ptr to first char - adi 4 - mov c,a - mov a,h - aci 0 - mov b,a ;BC pts to first char - mov m,c ;store low - inx h - mov m,b ;store high - inx h ;pt to char count - xchg ;... in DE - mvi c,rdbuf ;input line via BDOS - push d ;save ptr - call bdos - pop h ;pt to char count - inx h - mov e,m ;get char count - inx h ;pt to first char - push h ;save ptr - mvi d,0 ;DE=char count - dad d - xra a ;A=0 - mov m,a ;store ending 0 - pop h ;pt to first char - call putzex ;resume ZEX (A=0) - call putcst ;set command status to normal (A=0) - ret ;return to opsys - -; -;************************************************** -; -; CRT Routine for VFILER -; -VCLS: - CALL CLS ;try to clear the screen - RNZ ;OK if done - PUSH H ;save regs - PUSH B - CALL GETCRT ;get CRT Data - INX H ;get number of lines on screen - MOV B,M ;B=number of lines -VCLS1: - CALL CRLF ;new line - BJNZ VCLS1 - POP B ;restore regs - POP H - RET -; -; EREOL Routine for VFILER -; -VEREOL: - CALL EREOL ;try to erase to EOL - RNZ ;OK if done - PUSH B ;save count - MVI A,' ' ;space out - CALL VEREOL1 ;send B spaces - POP B ;get count - MVI A,BS ;backspace in -VEREOL1: - CALL COUT ;send char - BJNZ VEREOL1 ;count down - RET -; -; Setup Screen Display Variables -; -SETSCR: - LXI H,CURHOME ;set cursor home - SHLD CURAT - LHLD RING ;set ring position -; -; Entry to Reset Ring Position at HL -; -SETSCR1: - SHLD RINGPOS -; -; Entry to Reset Local Ring Position at HL -; -SETSCR2: - SHLD LOCBEG ;front of ring - LXI D,EPS*13 ;new end? - DAD D - XCHG - LHLD RINGEND ;end of ring - XCHG - CALL CMPDEHL - BRC SETSCR3 - XCHG -SETSCR3: - XCHG - SHLD LOCEND - RET - -; -; Display file name of current file -; -LOOPFN1: - LXI H,FNADR ;position cursor for file name print - CALL GOTOXY - LHLD RINGPOS ;pt to current file name - INX H ;pt to first char -; JMP PRFN ;print file name - CALL STNDOUT ; turn on highlighting - CALL PRFN ; print file name - CALL STNDEND ; turnoff highlighting; - RET ; -; Get command from user and clear error line if any -; -LOOPFN2: - CALL ATCMD ;position at command prompt - CALL DKEYIN ;wait for character from keyboard - PUSH PSW ;save command - LDA ERMFLG ;error message? - ORA A ;0=no - CNZ ERCLR ;erase old error message - POP PSW ;get command - RET -; -; Process Command -; -LOOPFN3: - CPI MNOTE ;command summary - BRZ CPROCM - CPI '0' ;macro? - BRC CPROC0 - CPI '9'+1 ;macro? - BRNC CPROC0 -CPROCM: - CALL CMACRO ;process macro command - MOV B,A ;save command - CALL ERMSG - DB 'No U Fct ',0 - MOV A,B ;get macro digit - JMP COUT ;return for loop processing -CPROC0: - CALL CTPROC ;process command or return if not found - CALL ERMSG - DB 'Invld Cmd: ',0 - MOV A,B ;get char - CPI ' ' ;expand if less than space - BRNC CPROC1 - MVI A,'^' ;control - CALL COUT - MOV A,B ;get byte - ADI '@' ;convert to letter -CPROC1: - JMP COUT ;return for loop processing - -; -; SET UP BUFFERS -; -SETUP: - CALL RETUD ;get home DU - MOV A,B - STA H$DR ;home drive - MOV A,C - STA H$U$A ;home user area - CALL CODEND ;start of free space - LXI D,100H ;256 bytes/unit - DAD D - SHLD CRCTBL ;table for CRC list et al - DAD D - DAD D ;allow 512 bytes - SHLD CMDBUF ;command line buffer - MVI M,64 ;64 bytes in line - LXI D,70 ;arbitrary beyond EOL - DAD D - SHLD DUM$FCB ;dummy FCB - INR H - MVI L,0 ;next page - SHLD BUFENTRY ;free space to end of TPA - -; -; Set CRT/Printer Data -; - CALL GETCRT ;CRT DATA - MOV A,M - STA CWIDTH ;WIDTH - INX H - MOV B,M - INX H - MOV A,M - STA CTPP ;TEXT - MOV C,A - MOV A,B ;TOTAL NUMBER OF LINES - SUB C - DCR A ;1 LESS - STA CSPP ;LINES TO SKIP - CALL GETPRT ;PRINTER DATA - MOV A,M - STA LWIDTH ;WIDTH - INX H - MOV B,M - INX H - MOV A,M - STA LTPP ;TEXT - MOV C,A - MOV A,B ;TOTAL NUMBER OF LINES - SUB C - STA LSPP ;LINES TO SKIP - INX H - MOV A,M - STA LFFEED ;CAN FORM FEED? - -; -; Begin Further Inits -; - XRA A - STA HELPDISP ;no help display yet -; - MVI A,DEFALPHA ;alpha by name and type - STA ALPHA -; - LHLD ENVPTR ;pt to ZCPR3 Env Desc - LXI D,80H+10H ;pt to cursor commands - DAD D - LXI D,CTABLE ;pt to area - MVI B,4 ;4 commands -CURINIT: - MOV A,M ;get command - STAX D ;put it - INX H ;pt to next - INX D - INX D - INX D - BJNZ CURINIT -; - CALL IDU ;set initial disk/user - CALL LOGRDU ;log into it -; - LHLD BUFENTRY ;base address - SHLD RING ;beginning of ring -; - LXI H,CURHOME ;home address for cursor - SHLD CURAT -; - CALL GETMDISK ;get max disk number (1-N) - ADI '@' ;convert to ASCII (A-P) - STA MAXDR ;set letter -; - RET - -; set initial disk/user -IDU: - LXI D,FCB ;log into DU specification - CALL Z3LOG ;perform login -IDU1: - CALL RETUD ;get current DU in BC - MOV A,C ;get current user - CALL IDU$USET ;set it - MOV A,B ;get current disk - CALL IDU$DSET ;set it - RET -IDU$USET: - STA C$U$A ;..store as current and.. - STA O$USR ;..as original for exit. - STA R$U$A ;..requested user area - RET -IDU$DSET: - STA C$DR - STA R$DR ;requested disk - RET - -; check for existance of file whose first 12 FCB bytes are pted to by DE -; return with A=0 if not found, A=0FFH if found - -FILECHK: - LXI H,S$FCB ;copy into FCB - XCHG - MVI B,12 ;12 bytes - CALL MOVE ;copied into S$FCB - XCHG ;HL pts to FCB - CALL INITFCB ;init FCB - LXI D,S$FCB ;pt to FCB - JMP FFIND - -; -; Select drive and user area (system reset for disk change on-the-fly) -; -; -LOGDIR: - CALL CPRMPT ;prompt to get drive/user selection - DB 'Login DIR (and file mask): ',0 - CALL DEFSPEC ;define full file specification -LOG1: - CALL LOGRDU ;set current and log in - JMP CRLF ;new line and exit - -; -; Actually log into DU requested -; -LOGRDU: - LDA R$DR ;make requested disk current - STA C$DR - CALL RESET ;reset disk system - LDA R$U$A ;establish requested area.. - STA C$U$A ;..as current area. - CALL SET$USR - LXI H,0 ;initialize tagged.. - SHLD TAG$TOT ;..file size accumulator. - RET - -; -; Define file specification -; (comes before DEF$D$U and includes preparing to change system file 4 for new -; mask) -; -DEFSPEC: - CALL RDSPEC ;get user input - CALL TOKEN1 ;position HL to first token and test for end - JZ LOOP ;if no entry, loop back for another command - LXI D,FCB ;use default FCB - CALL ZPRSFN ;parse the filespec into FCB - CALL FILSEL ;copy filespec into system file 4 - CALL TOKEN1 ;back to first token - XRA A ;scan for DIR before DU - CALL DNSCAN ;scan again to get drive and user values - BRNZ DEFDU2 ;if found, enter new values - RET ;otherwise, just return - -; -; Define current drive and user area -; many modifications -; -DEF$D$U: - CALL RDSPEC ;read DU and filespec - CALL TOKEN1 ;position HL to first token - JZ LOOP - - ;delete this redundant test -; -; MOV A,M ;check for exit -; CALL CAPS -; CPI 'X' -; BRNZ DEFDU1 -; INX H ;check for space or EOL -; MOV A,M -; DCX H -; ANI 7FH ;mask MSB -; CPI ' '+1 -; JC OS$CCP ;abort -;DEFDU1: - - XRA A ;A=0 to scan for DIR before DU - CALL DNSCAN ;look for DU or DIR form and return DU - BRZ ERRET ;error -DEFDU2: - MOV A,B ;return disk and user - STA R$DR - INR A ;set FCB - STA FCB - MOV A,C - STA R$U$A - RET -; -; position to first token and set flag to show end of buffer -; -TOKEN1: - LHLD CMDBUF ;pt to possible drive - INX H - INX H - CALL SKSP ;skip over leading spaces and return - MOV A,M ;check for no input - ORA A - RET -; -; reads line of input from user -- pulled out as subroutine -; -RDSPEC: - LHLD CMDBUF ;pt to command line buffer - INX H - INX H - MVI B,20 ; # of blanks to.. - CALL FILL ;..clear 'cmdbuf'. - LHLD CMDBUF ;get DU selection from.. - XCHG - MVI C,RDBUF ;..console buffer read. - CALL BDOS - JMP CONVERT ;make sure alpha is upper case and return -; -; Error return and recovery from command cancellation -; -ERRET: - CALL ERMSG - DB 'DIR Entry Error',0 - JMP LOOP -COMCAN: - LDA CANFLG ;check for nature of abort - ORA A ;..from.. - JZ RUNSH2 ;no file found, so run the shell again - JMP RUNSH4 ;..error/command abort. -; -; find file along path (file FCB pted to by DE) -; on return, A=0FFH if found, A=0 if not found, and flags set -; -FFIND: - MVI A,0FFH ;look in current dir also - JMP PFIND ;path search from Z3LIB -; log in default directory -DLOGIN: - LDA C$DR ;disk in B - MOV B,A - LDA C$U$A ;user in C - MOV C,A ;fall thru to SLOGIN -; log in DU in BC -SLOGIN: - PUSH H ;save regs - PUSH D - PUSH B - MOV A,C ;set user - CALL SET$USR - POP B - MOV A,B ;set disk - CALL SET$DR - POP D ;restore regs - POP H - RET - -; e x i t - -; return to ccp - -; -; Entry point for VFILER exit -; -OS$CCP: - CALL SHPOP ;clear shell stack -; -; Entry point for command line exec -; -OS$CCP1: - LDA O$USR ;get and set original.. - CALL SET$USR ;..user area and.. - LXI D,TBUF ;..tidy up.. - MVI C,SETDMA ;..before going home. - CALL BDOS - - IF WARMBOOT - JMP OS$BASE - ENDIF ;warmboot - - IF NOT WARMBOOT - LHLD STACK ;put pointer.. - SPHL ;..back to 'sp'. - RET ;return to ccp - NOP ; to try jump to start - NOP - - ENDIF ;not warmboot - -; -; FLOAD loads the files into the buffer, setting up the ring -; Return with NZ if load OK, Z if no files loaded -; -FLOAD: - CALL FRESTOR ;get bytes remaining on drive (decode default) -; -; Set up file name from System File 4 -; Select all files if no entry in System File 4 -; - CALL GETFN2 ;pt to first system file name - LXI D,11*3 ;pt to 4th file name - DAD D - LXI D,FCB+1 ;pt to FCB - MVI B,11 ;11 bytes - CALL MOVEB - LXI H,JOKER ;..treat as '*.*' with 'joker'.. - MVI B,11 ; # of characters to move - LDAX D ;get first char of file name - CPI ' ' ;if space, fill with *.* - CZ MOVEB ;set field to *.* - LDAX D ;get first char of file name - CPI '/' ;if opt, fill with *.* - CZ MOVEB -; -; Build ring with filename positioned in default FCB area -; - MVI C,SETDMA ;initialize dma address.. - LXI D,TBUF ;..to default buffer. - CALL BDOS - XRA A ;clear search 'fcb'.. - STA FCBEXT ;extent byte.. - STA FCBRNO ;..and record number. - LXI D,FCB ;default FCB for search - CMA - STA CANFLG ;make cancel flag true - MVI C,SRCHF ;..of first occurrence. - CALL BDOS - INR A ; 0ffh --> 00h if no file found - BRNZ SETRING ;if found, branch and build ring. - STA CANFLG ;make log-cancel toggle false (0) - CALL ERMSG ;else say none found, fall thru to log. - DB 'No File Found',0 - XRA A ;Set Error Code - RET - -; establish ring (circular list) of filenames - -SETRING: - LHLD RING ;initialize ring pointer - SHLD RINGPOS ;start --> current position of ring - -; put each found name in ring. a-reg --> offset into 'tbuf' name storage - -TO$RING: - DCR A ;un-do 'inr' from above and below - ADD A ;times 32 --> position index - ADD A - ADD A - ADD A - ADD A - ADI TBUF ;add page offset and.. - MOV L,A ;..put address into.. - MVI H,0 ;..hl-pair. - LDA FCB ;get drive/user designator and.. - MOV M,A ;..put into 'fcb' buffer. - XCHG - LHLD RINGPOS ;pointer to current load point in ring - XCHG - MVI B,12 ;move drive designator and name to ring - CALL MOVE - XCHG ;de-pair contains next load point address - MVI M,' ' ;space for potential.. - INX H ;..tagging of files for mass copy. - SHLD RINGPOS ;store and search.. - MVI C,SRCHN ;..for next occurrence. - LXI D,FCB ;filename address field - CALL BDOS - INR A ;if all done, 0ffh --> 00h. - BRNZ TO$RING ;if not, put next name into ring. -; -; All filenames in ring -- setup ring size and copy-buffer start point -; - LHLD RINGPOS ;next load point of ring is start of buffer - SHLD RINGEND ;set ring end.. - SHLD BUFSTART ;..and copy-buffer start. - PUSH H - LHLD RING - LXI D,13 ;compare 'ringend' (tab base+13) - DAD D - XCHG - POP H - CALL CMPDEHL - BRNZ SORT ;sort if more than one file in ring - XRA A ;set NZ for Return - DCR A - RET -; -; Sort ring of filenames -; -SORT: - LHLD RING ;initialize 'i' sort variable and.. - SHLD RINGI - LXI D,13 ;..also 'j' variable. - DAD D - SHLD RINGJ -SORTLP: - LHLD RINGJ ;compare names 'i & j' - XCHG - LHLD RINGI - PUSH H ;save position pointers.. - PUSH D ;..for potential swap. - LDA ALPHA ;check for type of alphabetization - ORA A ;if Zero, alpha by type and name - JZ SORTTN - -; sort by file name and type - MVI B,12 ; # of characters to compare - CALL CMPSTR ;do comparison - BR NOCMP ;final test - -; sort by file type and name -SORTTN: - PUSH H ;save ptrs - PUSH D - LXI B,9 ;pt to type - DAD B - XCHG - DAD B - XCHG - MVI B,3 ;3 chars in file type - CALL CMPSTR ;compare type - POP D ;get ptrs - POP H - BRNZ NOCMP ;final test - PUSH H - PUSH D - MVI B,8 ;8 chars in file name - INX H ;pt to first - INX D - CALL CMPSTR ;compare name - POP D ;get ptrs - POP H - BRNZ NOCMP ;final test - LDAX D ;final compare and fall thru - CMP M - -; final test for swapping purposes -NOCMP: - POP D - POP H - MVI B,13 - BRNC NOSWAP -; -; Swap if 'j' string larger than 'i' -; -SWAP: - MOV C,M ;get character from one string.. - LDAX D ;..and one from other string. - MOV M,A ;second into first - MOV A,C ;first into second - STAX D - INX H ;bump swap pointers - INX D - BJNZ SWAP -NOSWAP: - LHLD RINGJ ;increment 'j' pointer - LXI D,13 - DAD D - SHLD RINGJ - XCHG ;see if end of 'j' loop - LHLD RINGEND - CALL CMPDEHL - JNZ SORTLP ;no, so more 'j' looping. - LHLD RINGI ;bump 'i' pointer - LXI D,13 - DAD D - SHLD RINGI - DAD D ;set start over 'j' pointer - SHLD RINGJ - XCHG ;see if end of 'i' loop - LHLD RINGEND - CALL CMPDEHL - JNZ SORTLP ;must be more 'i' loop to do -; -; Sort done -- initialize tables for fast crc calculations -; - CALL INITCRC -; -; Calculate buffer maximum available record capacity -; -B$SIZE: - LXI B,0 ;count records - LHLD BDOS+1 ;get 'bdos' entry (fbase) - - IF NOT WARMBOOT - LXI D,-(CCPLEN) - DAD D - ENDIF ;not warmboot - - DCX H - XCHG ;de-pair --> highest address of buffer - LHLD BUFSTART ;start address of buffer (end of ring list) -B$SIZE2: - INX B ;increase record count by one - PUSH D - LXI D,128 ; 128-byte record - DAD D ;buffer address + record size - POP D - CALL CMPDEHL ;compare for all done - BRNC B$SIZE2 ;more will fit? - DCX B ;set maximum record count less one - MOV A,B ;memory available for copy? - ORA C - BRNZ B$SIZE3 ;yes, buffer memory space available. - CALL ERMSG - DB 'No Room',0 - XRA A ;Error code - RET -B$SIZE3: - MOV L,C ;store.. - MOV H,B ;..maximum.. - SHLD REC$MAX ;..record count. - XRA A ;return NZ for OK - DCR A - RET -; -; left to right compare of two strings (de-pair points to 'a' string; -; hl-pair, to 'b'; b-reg contains string length.) -; -CMPSTR: - LDAX D ;get an 'a' string character and.. - CMP M ;..check against 'b' string character. - RNZ ;if not equal, set flag. - INX H ;bump compare.. - INX D ;..pointers and.. - DCR B ; (if compare, set as equal.) - BRNZ CMPSTR ;..do next character. - RET -; -; COMMAND: MACRO (0-9) -; Process macro command -; -CMACRO: - PUSH PSW ;save digit - LXI H,MACFCB ;set up name of macro file - LXI D,S$FCB - PUSH D - MVI B,12 ;12 chars - CALL MOVE - XCHG - CALL INITFCB ;init FCB - POP D ;pt to FCB - CALL FFIND ;search along path for file - BRNZ CMFOUND ;file found - POP PSW ;clear stack - POP D ;clear ret address - CALL ERMSG - DB 'File ',0 - LXI H,MACFCB+1 - CALL PRFN ;print file name - CALL VPRINT - DB ' NOT Found',0 - JMP LOOP -; found macro file -CMFOUND: - CALL SLOGIN ;log in - CALL FI0$CLOSE ; CLOSE FILE IF ALREADY OPEN - LXI D,S$FCB ;pt to FCB - CALL FI0$OPEN ;open for byte-oriented input - POP PSW ;get command - MOV C,A ;... in C -; new line -CMFL1: - CALL F0$GET ;get first char of line - JNZ CMFLERR ;EOF encountered - CMP C ;match? - BRZ CMFL3 -; skip out line -CMFL2: - CALL F0$GET ;skip out line - JNZ CMFLERR - CPI LF ;EOL? - BRNZ CMFL2 - BR CMFL1 -; found command -CMFL3: - MVI A,MNOTE ;macro note? - CMP C - JZ CMFLNOTE - PUSH D - LHLD CRCTBL ;buffer for command line - LXI D,256 ;+256 - DAD D - POP D -; skip leading blanks in command line -CMFL4: - CALL F0$GET ;get next char - BRNZ CMFL6 ;mark end of buffer and go - CPI ' ' ;skip leading blanks - BRZ CMFL4 -; load command line into buffer -CMFL5: - ANI 7FH ;mask char - CPI CR ;EOL? - BRZ CMFL6 - CPI CTRLZ ;EOF? - BRZ CMFL6 - CPI FPESC ;file pted to? - JZ CMFLIF - CPI UIN1 ;user input? - BRZ CMFL5A - CPI UIN2 - BRZ CMFL5A -CMFL50: - MOV M,A ;store char - INX H ;pt to next -CMFL51: - CALL F0$GET ;get next char - BRZ CMFL5 - BR CMFL6 - -; print prompt to user and get input -CMFL5A: - PUSH H ;save buffer ptr - CALL CPRMPT ;at command prompt line - DB 0 -CMFL5B: - CALL F0$GET ;get next char - BRNZ CMFL5B1 - ANI 7FH ;mask - CPI UIN1 ;end of prompt? - BRZ CMFL5C - CPI UIN2 - BRZ CMFL5C - CPI CR ;end of prompt? - BRZ CMFL5C - CPI CTRLZ ;eof? - BRZ CMFL5C - CALL COUT ;send char - BR CMFL5B -CMFL5B1: - MVI A,CTRLZ ;eof -CMFL5C: - PUSH PSW ;save offending char - LHLD BUFSTART ;pt to buffer - MVI M,128 ;128 char in line - INX H ;set no chars - MVI M,0 - DCX H ;pt to count - XCHG - MVI C,RDBUF ;get line from user - CALL BDOS - LHLD BUFSTART - INX H ;pt to count - MOV A,M ;get count - INX H ;pt to first char - PUSH H ;save ptr - ADD L - MOV L,A - MOV A,H - ACI 0 - MOV H,A ;HL pts to after last char - MVI M,0 ;store ending zero - POP H ;HL pts to first char of line - POP PSW ;get char - POP D ;DE pts to next char in buffer - MOV B,A ;char in B -CMFL5D: - MOV A,M ;copy chars - ORA A ;zero=done - BRZ CMFL5E - STAX D ;put char - INX H ;pt to next - INX D - BR CMFL5D -CMFL5E: - XCHG ;HL pts to next char in buffer - MOV A,B ;check offending char - CPI UIN1 ;user input? - BRZ CMFL51 - CPI UIN2 - BRNZ CMFL5 - BR CMFL51 -; complete buffer and test for content -CMFL6: - MVI M,0 ;store ending 0 - PUSH D - LHLD CRCTBL ;pt to first char in line - LXI D,256 - DAD D - POP D - MOV A,M ;get first char - ORA A ;empty? - BRNZ CMFL7 -; error return -CMFLERR: - PUSH B - CALL DLOGIN ;return home - POP B - MOV A,C ;invalid command - RET -; try to chain -CMFL7: - PUSH H ;save ptr - CALL DLOGIN ;return home - POP H - CALL CHAIN ;chain to command line pted to by HL - JMP LOOP - -; print documentation built into the macro file -CMFLNOTE: - CALL VCLS ;new screen - MVI C,0 ;set tab counter -CMFLN1: - CALL F0$GET ;get next char - BRNZ CMFLN4 ;done - ANI 7FH ;mask - CPI CTRLZ ;eof=done - BRZ CMFLN4 - CPI TAB ;tab process - BRZ CMFLN2 - CALL COUT ;print char - CPI CR ;new line? - BRZ CMFLN3 - INR C ;new pos - CPI LF - BRNZ CMFLN1 - DCR C ;back up position count - BR CMFLN1 -CMFLN2: - MVI A,' ' ;space over for tab - CALL COUT - INR C ;incr position - MOV A,C ;done? - ANI 7 ;every 8 - BRNZ CMFLN2 - BR CMFLN1 -CMFLN3: - MVI C,0 ;bol for CR - BR CMFLN1 -CMFLN4: - CALL DLOGIN ; RETURN HOME - LHLD RINGPOS ;print current file - INX H - CALL PRFN - CALL VPRINT - DB ' Enter Digit or RETURN - ',0 - CALL DKEYIN - POP D ;get ret address - CPI '0' ;in range? - JC RUNSH4 - CPI '9'+1 ;in range? - JNC RUNSH4 - PUSH D ;replace ret address - JMP CMACRO - -; insert file pted to (% prefix command) -CMFLIF: - CALL F0$GET ;get next char - JNZ CMFL6 - CPI FPESC ;doubled? - JZ CMFL50 - LXI D,CMFL51 ;return address - PUSH D ;... on stack - ANI 5FH ;capitalize - CPI FPFILE ;file only? - BRZ CMFLIF1 - CPI FPDISK ;disk only? - BRZ CMFLIF2 - CPI FPUSER ;user only? - BRZ CMFLIF3 - CALL CMFLIF2 ;Disk - CALL CMFLIF3 ;User - MVI M,':' ;separator - INX H ;fall thru to file name -CMFLIF1: - XCHG ;save ptr to next - LHLD RINGPOS ;pt to current file - INX H - MVI B,8 ;8 chars in filename - CALL CMFL5X - MVI A,'.' ;put dot - STAX D - INX D - MVI B,3 ;3 chars max - CALL CMFL5X - XCHG ;HL pts to next - RET -CMFLIF2: - LDA C$DR ;store disk - ADI 'A' - MOV M,A - INX H ;pt to next - RET -CMFLIF3: - LDA C$U$A ;user - CPI 10 ;less than 10? - BRC CMFLIF32 - MVI B,'0' ;compute 10's -CMFLIF30: - SUI 10 ;subtract 10's - BRC CMFLIF31 - INR B - BR CMFLIF30 -CMFLIF31: - ADI 10 - MOV M,B ;store 10's - INX H -CMFLIF32: - ADI '0' ;store 1's - MOV M,A - INX H - RET -CMFL5X: - MOV A,M ;get char - CPI ' ' - BRZ CMFL5X1 - STAX D ;put char - INX H ;pt to next - INX D - BJNZ CMFL5X - RET -CMFL5X1: - INX H ;advance - BJNZ CMFL5X1 - RET -; -; Process command from table -; -CTPROC: - MOV B,A ;command in B - LXI H,CTABLE ;pt to table - MOV A,M ;any cursor commands? - ORA A - JNZ CTPR1 - LXI H,CTAB1 -; -; Command table scanner -; HL = Table -; B = Command Letter -; -CTPR1: - MOV A,M ;get table command char - ORA A ;end of table? - RZ ;done if so - CMP B ;match? - BRZ CTPR2 - INX H ;skip to next entry - INX H - INX H - BR CTPR1 -CTPR2: - INX H ;pt to address - MOV A,M ;get low - INX H - MOV H,M ;get high - MOV L,A - XTHL ;address on stack - RET ;"jump" to routine - -; Command Table -CTABLE: - DB 0 ;user cursor positioning - DW UP - DB 0 - DW DOWN - DB 0 - DW FORWARD - DB 0 - DW REVERSE -CTAB1: - DB CTRLC ;if exit, then to opsys - DW OS$CCP - DB 'X' ;alternate exit - DW OS$CCP - DB CTRLR ;screen refresh? - DW RUNSH4 - DB CTRLE ;system cursor positioning - DW UP - DB CTRLX - DW DOWN - DB CTRLD - DW FORWARD - DB CTRLS - DW REVERSE - - DB '.' ;alternate commands - DW FORWARD - DB '>' - DW FORWARD - DB ',' - DW REVERSE - DB '<' - DW REVERSE - - DB CR ;nop - DW LOOP - DB '+' ;jump forward - DW JUMPF - DB CTRLF ;jump forward - DW JUMPF - DB '-' ;jump backward - DW JUMPB - DB CTRLA ;jump backward - DW JUMPB - DB ' ' ;go forward - DW FORWARD - DB BS ;back up? - DW REVERSE - DB 'A' ;alphabetize? - DW ALPHASW - DB 'C' ;copy a file? - DW FCOPY - DB 'D' ;delete a file? - DW FDEL - DB 'F' ;show file size? - DW FSIZE - DB 'G' ;group operation? - DW GROUP$OP - DB 'H' ;external help? - DW EXTHELP - DB 'J' ;jump to a file? - DW GOTO - DB DIRCMD ;log-in another drive? - DW RUNSH3 - DB 'P' ;output file to 'list' device? -; DW LSTFILE ; - DW SPRINT ; - DB 'Q' ;screen refresh? - DW RUNSH4 - DB 'R' ;rename? - DW RENAME - DB 'S' ;free bytes on.. - DW DSTAT ;..requested drive? - DB 'T' ;if tag, put TAGCH in.. - DW TAG ;..front of cursor. - DB 'U' ;remove TAGCH from.. - DW UNTAG ;..in front of cursor? - DB 'V' ; 'view' file at console? - DW VIEW - DB 'Z' ;run ZCPR3 command - DW RUNZCPR3 -; - IF BIHELP ;built-in help? - DB '?' ;help - DW HELP - DB '/' ;help also - DW HELP - ELSE - DB '?' ;help - DW EXTHELP - DB '/' ;help also - DW EXTHELP - ENDIF ;BIHELP -; - DB 0 ;end of table - -; h e l p (menu) - - IF BIHELP ;built-in Help? -HELPMSG: - CALL VPRINT - DB CR,LF,CR,LF - DB ' ' - DB '-- Tagging Commands -- --------- File Operat' - DB 'ions ----------',CR,LF - DB ' ' - DB ' T - ',DIM,'Tag File',BRIGHT - DB ' C - ',DIM,'Copy File',BRIGHT,' ' - DB 'D - ',DIM,'Delete File',BRIGHT,CR,LF - DB ' ' - DB ' U - ',DIM,'Untag File',BRIGHT - DB ' F - ',DIM,'File Size',BRIGHT,' ' - DB 'R - ',DIM,'Rename File',BRIGHT,CR,LF - DB ' ' - DB ' G - ',DIM,'Group ' - DB 'Copy/Delete/FSize/Tag/Untag',BRIGHT,CR,LF ; - DB ' ' - DB ' ',DIM,'Group ' ; - DB 'Print/View',BRIGHT,CR,LF,CR,LF ; - DB ' ' - DB '-- File Print & View -- --- User Functions ---',CR,LF - DB ' -- Cursor -- ' - DB 'P - ',DIM,'Print',BRIGHT - DB ' V - ',DIM,'View',BRIGHT - DB ' 0-9 - ',DIM,'Execute',BRIGHT,' ',MNOTE,' - ',DIM,'Help' - DB BRIGHT,CR,LF - DB ' ^E ' - DB CR,LF - DB ' ^ ' - DB '-- Movement Commands -- ---- Miscellaneous ----',CR,LF - DB ' ^S <-+-> ^D ' - DB ' - ',DIM,'File Forward' - DB BRIGHT,' A - ',DIM,'Toggle Alpha Sort',BRIGHT,CR,LF - DB ' v ' - DB ' - ',DIM,'File Backward' - DB BRIGHT,' H - ',DIM,'Help File',BRIGHT,CR,LF - DB ' ^X ' - DB ' + - ',DIM,'Screen Forward',BRIGHT - DB ' ' - - DB DIRCMD ;changes to reflect command choice - - DB ' - ',DIM,'Log DIR and/or Mask',BRIGHT,CR,LF - DB ' ' - DB ' - - ',DIM,'Screen Backward',BRIGHT - DB ' S - ',DIM,'Disk Status',BRIGHT,CR,LF - DB ' -- Screen -- ' - DB ' J - ',DIM,'Jump to a File',BRIGHT - DB ' Z - ',DIM,'ZCPR3 Command',BRIGHT,CR,LF - DB ' ^A ',DIM,'Backward',BRIGHT,' ' ; - DB ' Q - ',DIM,'Refresh Screen',BRIGHT - DB ' ^C - ',DIM,'Exit',BRIGHT,CR,LF - DB ' ^F ',DIM,'Forward',BRIGHT,' ' ; - - IF BIHELP ; - DB ' ' ; - DB '? or / - ',DIM,'Toggle Help Screen',BRIGHT ; - ENDIF ; - - DB 0 - RET -HELP: - LDA HELPDISP ;toggle flag - CMA - STA HELPDISP - JMP RUNSH4 ;refresh screen and restart - ENDIF ;BIHELP -; -; COMMAND: H -; -EXTHELP: - CALL CPRMPT - DB 'Read Help File (Y/N)? ',0 - CALL CIN - CALL CAPS - CPI 'Y' - JNZ LOOPFN - CALL ERMSG - DB DIM,'Chaining to Help File ...',BRIGHT,0 - LXI H,MOREHELP ;run HELP Command - CALL CHAIN ;chain to it - JMP LOOPFN - -; -; COMMAND: A -; -; Toggle alphabetize switch and reload files -; -ALPHASW: - LDA ALPHA ;toggle flag - CMA - STA ALPHA - CALL CPRMPT ;tell user what is happening - DB 'Sorting by File ',0 - LDA ALPHA ;get flag - ORA A ;check it - BRZ ASWTN - CALL VPRINT - DB 'Name and Type',0 - JMP RUNSH2 -ASWTN: - CALL VPRINT - DB 'Type and Name',0 - JMP RUNSH2 ;reload files - -; -; COMMAND: Z -; -; Execute ZCPR3 command line -; -RUNZCPR3: - CALL ERMSG ;position at error message line - DB 0 - LXI H,H$DR ;pt to Home Drive (followed by Home User) - CALL PRDU ;print DU - CALL VPRINT ;print prompt - DB '> ',0 - PUSH D - LHLD CRCTBL ;use last half of CRC Table - LXI D,256 - DAD D - POP D - MVI M,126 ;store length of line - INX H - MVI M,0 ;store count - DCX H ;pt to beginning - XCHG ;DE pts to buffer - PUSH D - MVI C,RDBUF ;Read Line from User - CALL BDOS - POP H - INX H ;pt to char count - MOV E,M - INX H ;pt to first char - MVI D,0 ;set no high-order offset - PUSH H ;save current ptr for later - DAD D - MVI M,0 ;store ending zero - POP H ;pt to first char of command line - MOV A,M ;abort if no first char - ORA A - JZ LOOP - CALL CHAIN ;chain to it - JMP LOOPFN ;continue - -; chain to command pted to by HL ending in zero - -CHAIN: - CALL PUTCL ;store command line - BRNZ CHAIN1 - CALL ERMSG - DB 'CL Err',0 - RET -CHAIN1: - MVI B,0 ;set shell message 0 - MVI A,80H ;enable wait - CALL PUTSHM - CALL CHAIN2 ; - JMP OS$CCP1 ;run command line - moved - - - ;made a subroutine -CHAIN2: - LDA C$DR ;get current disk - ADI 'A' ;convert to ASCII - STA FILE$D ;store in proper place - LDA C$U$A ;get current user - LXI H,FILE$U ;store user number - MVI C,'0' ;set char -CHAIN3: - SUI 10 ;convert to ASCII - BRC CHAIN4 - INR C ;increment 10's char - BR CHAIN3 -CHAIN4: - MOV M,C ;store 10's digit char - INX H ;pt to 1's digit - ADI 10+'0' ;add back for 1's digit - MOV M,A ;store 1's digit char - CALL GETSH2 ;pt to shell buffer - LXI D,8 ;skip 8 chars (VFILER Name) - DAD D - LXI D,FILE$D ;place DU - XCHG - MVI B,5 ;store 5 chars (duu:0) - CALL MOVEB - RET ; - -; -; COMMAND: G -; -; Group operation -; -GROUP$OP: - CALL CPRMPT - DB 'Group Cmd (Copy/View/Print/Delete/File Sizes/' ; - DB 'Tag/Untag)? ',0 ; - CALL KEYIN ;get response - MOV B,A ;command in B - LXI H,GTABLE ;pt to table - CALL CTPR1 ;process command - JMP LOOP ;resume if not found -; -; Group Command Table -; -GTABLE: - DB 'C' - DW MASS$COPY - DB 'D' - DW MASS$DEL - DB 'P' ; - DW MASS$PRINT ; - DB 'V' ; - DW MASS$VIEW ; - DB 'F' - DW MASS$FSIZE - DB 'T' - DW MASS$TAG - DB 'U' - DW MASS$UNTAG - DB 0 ;end of table - -; -; COMMAND: GU -; -MASS$UNTAG: - MVI B,' ' ;untag char -; -; Common Entry Point for Mass Untag/Tag - B = Untag/Tag Char -; -MUTLOOP: - LHLD RINGPOS ;move to tag - LXI D,12 - DAD D - MOV M,B ;set tag byte - INX H ;pt to next - SHLD RINGPOS - XCHG ;done? - LHLD LOCEND - CALL CMPDEHL - BRNZ MUTLOOP - LXI H,CURHOME ;reset cursor - SHLD CURAT - LHLD LOCBEG ;set ring position - JMP JFW0 ;reset screen from LOCBEG - -; -; COMMAND: GT -; -MASS$TAG: - MVI B,TAGCH ;tag char - BR MUTLOOP ;do work - -; -; COMMAND: U -; -UNTAG: - MVI B,' ' ;set tag byte -; -; Common Entry Point for Untag/Tag - B = Untag/Tag Char -; -UT: - LHLD RINGPOS ;move back one.. - LXI D,12 ;..character position.. - DAD D ;..and check tagging status. - MOV M,B ;if file previously tagged, remove.. - CALL REFFN ;refresh file name - JMP FORWARD - -; -; COMMAND: T -; -TAG: - MVI B,TAGCH ;tag char - BR UT ;do tag - -; -; Refresh file name with new tag -; -REFFN: - CALL CLRCUR ;clear cursor - MVI A,' ' ;one more space - CALL COUT - LHLD RINGPOS ;reprint file name -; INX H -; CALL PRFN -; MOV A,M ;print tag -; JMP COUT - CALL HILITFN ; brighten - RET ; - -; -; COMMAND: GF -; -MASS$FSIZE: - CALL WORKMSG ;print 'Working' msg - LXI H,0 ;zero total - SHLD TAG$TOT - LHLD RINGPOS ;save ring position - SHLD SRINGPOS - LHLD RING ;set new ring position - SHLD RINGPOS -; -; Main Loop to Compute File Sizes -; -MASS$FS: - LHLD RINGEND ;at end of ring? - XCHG - LHLD RINGPOS - CALL CMPDEHL ;same if so - BRZ MASS$FS2 - LXI D,12 ;pt to tag - DAD D - MOV A,M ;get tag - INX H ;pt to next file - CPI TAGCH ;tagged? - BRNZ MASS$FS1 ;skip if not tagged -; -; Compute Size of Tagged File -; - PUSH H ;save ptr to next file - CALL SIZER ;compute file size - XCHG ;size in DE - LHLD TAG$TOT ;get total - DAD D - SHLD TAG$TOT ;new total - POP H ;get ptr to next file -MASS$FS1: - SHLD RINGPOS ;set ptr to next file - BR MASS$FS -; -; File Size Accumulation Done - Print Result -; -MASS$FS2: - LHLD SRINGPOS ;restore ring position - SHLD RINGPOS - CALL FSNOTE ;print file size message - CALL VPRINT ;print specific - DB 'Tagged Files is ',0 - LHLD TAG$TOT ;get total - BR FSIZE1 ;print size in HL and return - -; -; COMMAND: F -; -; determine and display file size in kilobytes -- round up to next disk -; allocation block -- accumulate tagged file summation -; -FSIZE: - CALL SIZER ;compute file size of current file - PUSH H ;save value - CALL FSNOTE ;print file size message - LHLD RINGPOS ;print file name - INX H - CALL PRFN - CALL VPRINT ;print trailer - DB ' is ',0 - POP H ;get size -; -; Print file size in HL and exit to screen -; -FSIZE1: - CALL PHLFDC ;print value in HL as floating - MVI A,'K' ;print suffix - CALL COUT - JMP LOOPFN ;resume - -; -; Compute File Size at RINGPOS -; Return Size in HL -; -SIZER: - CALL RINGFCB ;move name to 's$fcb' -; -; Determine file record count and save in RCNT -; - MVI C,COMPSZ - LXI D,S$FCB - CALL BDOS - LHLD S$FCB+33 - SHLD RCNT ;save record count and.. - LXI H,0 - SHLD S$FCB+33 ;..reset opsys -; -; Round up to next disk allocation block -; - LDA B$MASK ;sectors/block - 1 - PUSH PSW ;save 'blm' - MOV L,A - XCHG - LHLD RCNT ;..use here. - DAD D ;round up to next block - MVI B,3+1 ;convert from.. - CALL SHIFTLP ;..records to kilobytes. - POP PSW ;retrieve 'blm' - RRC ;convert.. - RRC ;..to.. - RRC ;..kilobytes/block. - ANI 1FH - CMA ;finish rounding - ANA L - MOV L,A ;hl-pair contains # of kilobytes - RET - -; -; COMMAND: - (Previous Screen) -; -JUMPB: - LXI H,CURHOME ;set cursor home - SHLD CURAT - LHLD RING ;at front? - XCHG - LHLD LOCBEG - CALL CMPDEHL - BRZ JUMPBW ;back up and wrap around - SHLD LOCEND ;set new end - LXI D,-EPS*13 ;back up - DAD D - SHLD LOCBEG ;new beginning - SHLD RINGPOS ;new position - JMP RUNSH4 -JUMPBW: - LHLD LOCBEG ;at first screen? - XCHG - LHLD RING ;pt to first element of ring - CALL CMPDEHL - BRZ JBW0 ;advance to end - LXI H,-EPS*13 ;back up - DAD D ;first element of new local ring - BR JFW0 -JBW0: - LXI D,EPS*13 ;pt to next screen - DAD D - XCHG - LHLD RINGEND - CALL CMPDEHL - XCHG - BRZ JBW1 - BRC JBW0 -JBW1: - LXI D,-EPS*13 - DAD D ;pt to first element of new local ring - BR JFW0 -; -; COMMAND: + (Next Screen) -; -JUMPF: - LXI H,CURHOME ;set cursor to home - SHLD CURAT - LHLD LOCEND ;see if Local End <= Ring End - XCHG - LHLD RINGEND - CALL CMPDEHL - BRZ CMDLOOP - LHLD LOCEND ;new screen starting at LOCEND - BR JFW0 - -; -; Reset to Beginning of RING and Resume Command Looping -; -CMDLOOP: - CALL SETSCR ;reset all screen pointers -CMDLRET: - JMP RUNSH4 -; -; Reset RING Position to HL -; -JFW0: - CALL SETSCR1 ;reset RINGPOS on ... - BR CMDLRET -; -; Reset Local Ring to HL -; -JFW0A: - CALL SETSCR2 ;reset LOCBEG on ... - BR CMDLRET - -; -; COMMAND: ' ', Left-Arrow -; -FORWARD: - CALL CLRCUR ;clear cursor - CALL FOR0 ;position on screen and in ring - CALL SETCUR ;set cursor - JMP LOOPFN -; advance routine -FOR0: - LHLD RINGPOS ;at end of loop yet? - LXI D,13 ;i.e., will we be at end of loop? - DAD D - XCHG - LHLD LOCEND - CALL CMPDEHL ;compare 'present' to 'end' - BRNZ FORW ;to next print position - CALL CUR$FIRST ;position cursor - LHLD LOCBEG ;set position pointer to beginning and.. - SHLD RINGPOS - RET -FORW: - LHLD RINGPOS ;advance in ring - LXI D,13 - DAD D - SHLD RINGPOS ;new position - CALL CUR$NEXT ;position cursor - RET - -; -; COMMAND: BS, Right-Arrow -; -REVERSE: - CALL CLRCUR ;clear cursor - CALL REV0 ;position on screen and in ring - CALL SETCUR ;set cursor - JMP LOOPFN -; Back Up Routine -REV0: - LHLD LOCBEG - XCHG - LHLD RINGPOS ;see if at beginning of ring - CALL CMPDEHL - BRNZ REV1 ;skip position pointer reset if not.. - CALL CUR$LAST ;end of local ring - LHLD LOCEND ;set to end +1 to backup to end - LXI D,-13 - DAD D - SHLD RINGPOS - RET -REV1: - CALL CUR$BACK ;back up 1 -REV2: - LHLD RINGPOS - LXI D,-13 ;one ring position.. - DAD D ;..backwards. - SHLD RINGPOS - RET - -; -; COMMAND: Up-Arrow -; -UP: - CALL CLRCUR ;clear cursor - LHLD RINGPOS ;see if wrap around - LXI D,-13*4 ;4 entries - DAD D - XCHG - LHLD LOCBEG ;beginning of local screen - CALL CMPDEHL - BRC UP2 ;wrap around - MVI B,4 ;back up 4 entries -UP1: - PUSH B ;save count - CALL REV0 ;back up in ring and on screen (no print) - POP B ;get count - BJNZ UP1 - BR DOWN1A -UP2: - LHLD RINGPOS ;advance to beyond end - LXI D,13*4 - DAD D - XCHG - LHLD LOCEND ;compare to local end - XCHG - CALL CMPDEHL - BRZ DOWN1A ;at end, so too far - BRC DOWN1A ;beyond end, so back up - SHLD RINGPOS ;new ring position - LHLD CURAT ;advance cursor - INR H ;next line - SHLD CURAT - BR UP2 - -; -; COMMAND: Down-Arrow -; -DOWN: - CALL CLRCUR ;clear cursor - LHLD RINGPOS ;see if wrap around - LXI D,13*4 ;4 entries - DAD D - XCHG - LHLD LOCEND ;end of local screen - XCHG - CALL CMPDEHL - BRZ DOWN2 ;wrap around - BRC DOWN2 ;wrap around - MVI B,4 ;forward 4 entries -DOWN1: - PUSH B ;save count - CALL FOR0 ;advance in ring and on screen (no print) - POP B ;get count - BJNZ DOWN1 -DOWN1A: - CALL SETCUR ;set cursor - JMP LOOPFN -DOWN2: - LHLD CURAT ;preserve column - MOV B,L ;column number in B - LXI H,CURHOME ;home position - SHLD CURAT ;set new position - LHLD LOCBEG ;beginning of local ring - SHLD RINGPOS ;new ring position -DOWN3: - LHLD CURAT ;check for at top of column - MOV A,L ;get col - CMP B ;there? - BRZ DOWN1A - LHLD RINGPOS ;advance in ring - LXI D,13 ;13 bytes/entry - DAD D - SHLD RINGPOS - LHLD CURAT ;get cursor position - LXI D,19 ;advance 19 bytes/screen entry - DAD D - SHLD CURAT - BR DOWN3 - -; -; COMMAND: S -; -; Determine remaining storage on requested disk -; -DSTAT: - CALL CPRMPT - DB 'Status of Disk (Letter): ',0 - CALL KEYIN ;get char - PUSH PSW - CALL CRLF - POP PSW - SUI 'A' ;convert to number - JC LOOP - MOV B,A ;... in B - LDA MAXDR ;compare to max - SUI 'A' - CMP B - JC LOOPFN - MOV A,B ;get disk - STA R$DR ;requested drive - CALL RESET ;..login as current. - CALL FRESTOR ;determine free space remaining - CALL PRINT$FRE ;print value - LDA C$DR ;login original as.. - CALL SET$DR ;..current drive. - JMP LOOPFN - -; -; COMMAND: GD -; -MASS$DEL: - MOV A,B ; recover the opcode - STA MASSOP ; need it later - CALL CPRMPT - DB 'Mass Delete (Y/N/V=Verify)? ',0 - CALL KEYIN ;get response - CPI 'Y' - BRZ MD1 - CPI 'V' - JNZ LOOP ;return to position -MD1: - STA MDFLG ;set flag -; STA MASSOP - JMP MASS$RUN - -; -; COMMAND: D -; -FDEL: - XRA A ;set no mass operation - STA MFLAG - CALL DELETE ;delete file -; -; Was Deletion Done? Abort if Not -; - LDA DELCODE ;0=not done - ORA A - JZ LOOPFN ;abort if not -; -; Reset Local Display -; - LHLD LOCEND ;move in end - LXI D,-13 - DAD D - SHLD LOCEND - XCHG - LHLD RINGPOS ;position beyond end of ring? - CALL CMPDEHL - BRNZ FDEL1 -; -; Cursor Beyond End of Display -; - CALL CUR$BACK ;back up cursor - LHLD LOCEND ;reset position - LXI D,-13 - DAD D - SHLD RINGPOS -FDEL1: - LHLD LOCEND ;get local end - XCHG ;... in DE - LHLD LOCBEG ;erased all local files? - CALL CMPDEHL - JZ CMDLOOP ;reset - JMP JFW0A ;rescreen from LOCBEG - -; -; Delete filename at RINGPOS -; -DELETE: - XRA A - STA DELCODE ;set deletion not done - CALL RINGFCB ;get file name - LDA MFLAG ;mass operation? - ORA A ;0=no - BRZ DEL1A ;do delete with message -; -; Test for Verify on Mass Delete -; - LDA MDFLG ;verify? - CPI 'V' - BRNZ DEL1 ;delete without verify -; -; Verify and Delete only if Approved -; - CALL CPRMPT - DB 'Delete ',0 - CALL PRFNS ;print file name in S$FCB - CALL VPRINT - DB ' (Y/N)? ',0 - CALL KEYIN - CPI 'Y' - RNZ ;abort if not approved -; -; Delete File (Mass Operation) -; -DEL1: - LDA MDFLG ;mass operation - verify on? - CPI 'V' - BRZ DEL2 -DEL1A: CALL ERMSG ;print information for mass del w/o verify - DB 'Deleting File ',0 - CALL PRFNS -; -; Delete File in S$FCB -; -DEL2: - LXI H,S$FCB ;set file to R/W - CALL ATTRIB - RZ ;abort - LXI D,S$FCB ;point at delete 'fcb' - MVI C,ERASE ;erase function - CALL BDOS - INR A - BRNZ DELCL ;close up erased position -FNF$MSG: - CALL FNF1 ;show error message - JMP LOOPFN - -; -; Close up erased position -; -DELCL: - MVI A,0FFH - STA DELCODE ;set deletion done - LHLD RINGPOS ;prepare move up pointers - PUSH H - LXI D,13 ;13 bytes/entry - DAD D ;de-pair = 'to' location - POP D ;hl-pair = 'from' location -; -; Move 13-byte ring entries from HL to DE -; -MOVUP: - XCHG ;HL=dest - PUSH H ;check if at end - LHLD RINGEND ;get old end pointer - CALL CMPDEHL ;check against current end location - POP H - XCHG ;DE=dest - BRZ MOVDONE ;must be at end of ring - MVI B,13 ;one name size - CALL MOVE ;move one name up - BR MOVUP ;go check end parameters -; -; Move Complete -; -MOVDONE: - LHLD RING ;see if ring is empty - XCHG - SHLD RINGEND ;set new ring end if all moved - CALL CMPDEHL ;..(listend --> listpos --> ring) - RNZ - CALL ERMSG - DB 'List Empty',0 - JMP RUNSH3 ;go to drive/user area with files - -; -; COMMAND: R -; -; Set-up to rename file at cursor position -- scan keyboard buffer and -; move filename to destination FCB (DFCB) -; -RENAME: - LHLD RINGPOS ;move name from ring to rename 'fcb' - LXI D,D$FCB ;place to move name - MVI B,12 ;amount to move - CALL MOVE - CALL CPRMPT ;new name prompt - DB 'Rename File to: ',0 - LXI D,D$FCB+16 ;pt to FCB to fill - CALL FILENAME ;get file name - LXI H,D$FCB+1 ;check for any wild cards -- none permitted - MVI B,11 ;11 bytes -WILDCHK: - MOV A,M ;get char - INX H ;pt to next - CPI '?' ;wild? - BRZ WILDFND - BJNZ WILDCHK - -; copy old file status bit ($r/o or $sys) to new filename - -CPYBITS: - LXI D,D$FCB+1 ;first character of old name.. - LXI H,D$FCB+17 ;..and of new name. - MVI B,11 ; # of bytes with tag bits -CBITS1: - LDAX D ;fetch bit of old name character - ANI 80H ;strip upper bit and.. - MOV C,A ;..save in c-reg. - MVI A,7FH ;mask for character only - ANA M ;put masked character into a-reg - ORA C ;add old bit - MOV M,A ;copy new byte back - INX H ;bump copy pointers - INX D - BJNZ CBITS1 ;DJNZ - -; check if new filename already exists. if so, say so. then go -; to command loop without moving ring position - - LDA D$FCB ;copy new name to source 'fcb' - STA S$FCB - MVI B,11 - LXI H,D$FCB+17 ;copy new name to.. - LXI D,S$FCB+1 ;..source 'fcb' for existence check. - CALL MOVE - LXI H,S$FCB+12 ;clear 'fcb' system.. - CALL INITFCB ;..fields. - LXI D,S$FCB ;search to see if this file exists - MVI C,SRCHF ;search first function - CALL BDOS - INR A ; 0ffh --> 00h if file not found - BRZ RENFILE ;to rename, if duplicate doesn't exists. - CALL ERMSG ;announce the situation - DB 'File Already Exists',0 - JMP COMCAN ;try again? - -; wild char found in file name -- error - -WILDFND: - CALL ERMSG - DB 'AFN NOT Allowed',0 - JMP COMCAN - -; copy new name into ring position - -RENFILE: - ;following not needed with full screen refresh -; LHLD RINGPOS ;get ring position pointer -; INX H ;pt to name -; PUSH H ;save ptr -; XCHG -; LXI H,D$FCB+17 ;point at new name and.. -; MVI B,11 -; CALL MOVE ;..move. -; LHLD CURAT ;get current position on screen -; LXI D,4 ;advance 4 chars -; DAD D -; CALL GOTOXY -; POP H ;get ptr -; CALL PRFN ;print file name -; MOV A,M ;print tag -; CALL COUT - LXI D,D$FCB ;rename 'fcb' location - MVI C,REN ;rename function - CALL BDOS - INR A ; 0ffh --> 00h if rename error -; JNZ LOOP ;if okay, proceed, else.. -; JMP FNF$MSG ;..show no-file msg. - JZ FNF$MSG ;if error, report it - JMP RUNSH2 ;start over - -; get file name from user and process into FCB pted to by DE -FILENAME: - PUSH D ;save ptr - LHLD CMDBUF ;command line location - XCHG - MVI C,RDBUF ;console read-buffer function - CALL BDOS - CALL CONVERT ;capitalize alpha - POP H ;set to null drive - MVI M,0 ;..required by 'bdos'. - INX H - -; initialize new filename field with spaces - - PUSH H ;save start pointer - MVI B,11 ; # of spaces to 'blank' - CALL FILL - POP H - XCHG - LHLD CMDBUF ;put length.. - INX H - MOV C,M ;..in c-reg. - INX H - XCHG ;de-pair --> buffer pointer and hl-pair.. - CALL UNSPACE ;..--> 'fcb' pointer. remove leading spaces. - -; extend buffer to spaces beyond command length - -EXTEND: - PUSH H - MOV L,C ;double-byte remaining length - MVI H,0 - DAD D ;to buffer end +1 - MVI M,' ' ;force illegal character end - POP H - -; start filename scan - -SCAN: - MVI B,8 ; 8 characters in filename -SCAN1: - CALL CKLEGAL ;get and see if legal character - JC COMCAN ;all of command line? - CPI ' ' ;see if end of parameter field - RZ ;rename file - CPI '.' ;at end of filename - BRZ SCAN2 ;process filetype field - CPI '*' ;rest wild? - BRZ SCAN1B - MOV M,A ;put character into destination 'fcb' - INX H - BJNZ SCAN1 - -; entry if eight characters without a 'period' - -SCAN1A: - CALL CKLEGAL ;scan buffer up to period or end - RC ;no extent if not legal - CPI ' ' ;end of parameter field? - RZ - CPI '.' - BRNZ SCAN1A ;do till end or period - BR SCAN2A ;continue at correct place - -; make rest of entry wild - -SCAN1B: - MVI M,'?' ;fill with ?'s - INX H - BJNZ SCAN1B - LDAX D ;get next char - INX D ;pt to after dot - CPI '.' ;must be dot - JNZ COMCAN ;cancel if not - BR SCAN2A - -; build filetype field - -SCAN2: - INX H ;advance ptr to file type field - BJNZ SCAN2 -SCAN2A: - MVI B,3 ;length of filetype field -SCAN3: - CALL CKLEGAL ;get and check character - BRC SCAN4 ;name done if illegal - CPI ' ' ;end of parameter field? - BRZ SCAN4 - CPI '.' ;check if another period - BRZ SCAN4 - CPI '*' ;rest wild? - BRZ SCAN4B - MOV M,A - INX H - BJNZ SCAN3 ;get next character - BR SCAN4A -SCAN4: - INX H ;advance to end of type field - BJNZ SCAN4 -SCAN4A: - CALL INITFCB ;..and zero counter fields. - RET -SCAN4B: - MVI M,'?' ;make wild - INX H - BJNZ SCAN4B - BR SCAN4A ;complete rest - -; -; COMMAND: J -; -GOTO: - CALL CPRMPT - DB 'Jump to Filename: ',0 - LXI D,D$FCB ;pt to FCB - CALL FILENAME ;get file name - LHLD RING ;pt to first element of ring - SHLD RINGPOS ;set position - SHLD LOCBEG ;set local beginning - PUSH H - LHLD CRCTBL ;pt to CRC Table - MVI M,0 ;set local counter - POP H -GOTOL: - CALL GOTOCOMP ;compare - BRZ GOTOF ;we are there - PUSH H - LHLD CRCTBL ;pt to table - INR M - MOV A,M - POP H - CPI EPS - BRNZ GOTOL1 - LHLD CRCTBL ;zero first entry - MVI M,0 - LHLD LOCBEG ;reset local beginning - LXI D,EPS*13 - DAD D - SHLD LOCBEG -GOTOL1: - LHLD RINGPOS ;advance to next entry - LXI D,13 - DAD D - SHLD RINGPOS ;new position - XCHG ;position in DE - LHLD RINGEND ;check for completion - CALL CMPDEHL ;compare current position with end of ring - BRNZ GOTOL - LHLD RING ;pt to first element - SHLD RINGPOS ;set position - CALL FNF1 ;print message - JMP CMDLOOP -GOTOF: - LHLD LOCBEG ;we have local beginning - PUSH H - XCHG ;ring location in DE - LXI H,CURHOME ;set cursor ptr - SHLD CURAT -GOTOF0: - LHLD RINGPOS ;at position? - CALL CMPDEHL - BRZ GOTOF1 - LXI H,13 ;advance location - DAD D - PUSH H - CALL CUR$NEXT ;advance cursor - POP D ;pt to next ring position - BR GOTOF0 -GOTOF1: - POP H ;pt to local ring - JMP JFW0A ;process -GOTOCOMP: - LHLD RINGPOS ;pt to current entry - INX H ;pt to first char of file name - LXI D,D$FCB+1 ;pt to first char of new file - MVI B,11 ;11 bytes -GOTOC1: - LDAX D ;get char - CPI '?' ;match? - BRZ GOTOC2 - CMP M ;match? - RNZ ;no match -GOTOC2: - INX D ;pt to next - INX H - BJNZ GOTOC1 - RET - -; -; COMMAND: V -; -; Type file to console with pagination set to 'lps' -- single-line scroll -; using bar , to cancel, any other key to page screen. -; -VIEW: - CALL VIEWFL ; - JMP RUNSH4 ; - -VIEWFL: ; - CALL VCLS - CALL VPRINT - DB CR,LF,DIM,' Cancels, Turns Up One Line, ' - DB 'Other Keys Page Screen',BRIGHT,CR,LF,LF,0 - MVI A,1 ;initialize.. - STA LPSCNT ;..lines-per-screen counter. - STA VIEWFLG ; 'view' paginate if not zero - MVI A,WRCON ;write console out function - BR CURRENT ;to common i/o processing -; -; COMMAND: P -; -; Send file to logical list device -- any keypress cancels -; -SPRINT: ; -; -; Set Flags for First Time Thru and No Mass Print -; - XRA A ; A=0 - STA FIRST$M ; set for prompt for destination -; -; Do Print -; - CALL LSTFILE ; print file at RINGPOS -; -; Advance to Next File -; - JMP RUNSH4 ; refresh screen and reset stack -; -; -LSTFILE: - LDA FIRST$M ; by-pass prompt. - ORA A ; - BRNZ SKPPRMT ;..1st time thru in mass-print mode. - DCR A ; A=0FFH - STA FIRST$M ; set not first time any more - CALL CPRMPT - DB 'Print on LST Device (Y/N)? ',0 - CALL KEYIN ;get response - CPI 'Y' - JNZ LOOP -SKPPRMT: ; - CALL ERMSG - DB 'Printing ',0 - LHLD RINGPOS ;pt to file name - INX H - CALL PRFN ;print it - MVI A,1 ;one for.. - STA VIEWFLG ;..output to printer. - DCR A ;zero for.. - STA LPSCNT ;..lines-per-page counter - STA EOFLAG ; used to provide formfeed at end of file - MVI A,LIST ;out to 'list' device function and fall thru - -; output character for console/list/punch processing - -CURRENT: - STA CON$LST ;save bdos function - -; output file to console/printer/punch - - CALL RINGFCB ;position name to 'fcb' - XCHG ;HL pts to S$FCB - CALL INITFCB ;set 'fcb' for use - LXI D,TBUF ;set to use default dma buffer - MVI C,SETDMA ;address set function - CALL BDOS - LXI D,S$FCB ;open file for reading - MVI C,OPEN ;file open function code - CALL BDOS - INR A ; 0ffh --> 00h if open not okay - BRNZ ZEROCR ;if not okay, show error message. -; -; File Not Found Error -; -FNF: - CALL FNF1 ;print file not found message - JMP LOOP -; -; Print File Not Found Message -; -FNF1: - CALL ERMSG - DB 'File NOT Found',0 - RET -; -; Continue -; -ZEROCR: - XRA A - STA S$FCB+32 ;zero file 'current record' field - STA CHARCNT ;zero char count for tabbing - CALL PHEAD ;print heading if output to LST device -READMR: - LXI D,S$FCB ;point at file 'fcb' for reading - MVI C,READ ;record read function - CALL BDOS - ORA A ;check if read okay - BRNZ CURDONE ;eof? - LXI H,TBUF ;point at record just read - MVI B,128 ;set record character counter to output -READLP: - MOV A,M ;get a character - ANI 7FH ;force to 'ascii' - CPI EOFCHAR ;see if end-of-file - BRZ CURDONE ;back to ring loop if 'eof' - MOV E,A ;put character for 'bdos' call - PUSH B - PUSH H - PUSH D ; (character in e-reg) - LDA CON$LST ;get function for punch/list/console output - MOV C,A - MOV A,E ;check char - CPI TAB ;tabulate? - BRNZ NOTAB - MVI E,' ' ;space over -TABL: - PUSH B ;save key regs - PUSH D - CALL BDOS - POP D ;get key regs - POP B - CALL INCCCNT ;increment char count - ANI 7 ;check for done at every 8 - BRNZ TABL - BR TABDN -NOTAB: - CALL BDOS ;send character - CALL INCCCNT ;increment char count -TABDN: - LDA VIEWFLG ;if 'view'.. - ORA A - POP D ;get char in E in case PAGER is called - CNZ PAGER ;..check for 'lf'. - MVI E,GET ;get status or char - MVI C,DIRCON ;console status function - CALL BDOS ;status? - POP H - POP B - ANI 7FH ;if character there, then abort.. - CNZ CANVIEW ;already got char - INX H ;if not, bump buffer pointer. - BJNZ READLP ;no, more in present record. - BR READMR ;yes, get next record. -CURDONE: - MVI A,TRUE ; set eoflag for formfeed at end of file - STA EOFLAG ; - LDA CON$LST ;console? - CPI WRCON - JZ BOTTOM ; prompt for user - JMP FORMFD ; -; JMP RUNSH4 ;refresh screen and continue user input - -PAGER: - MOV A,E ; (character in e-reg) - CPI LF - RNZ - XRA A ;zero char count - STA CHARCNT - LDA CON$LST ;printer or console? - CPI LIST ;check for printer - BRZ PAGEP - LDA CTPP ;get number of lines of text per screen - MOV B,A ;... in B - LDA LPSCNT ;is counter.. - INR A ;..at.. - STA LPSCNT ;..limit.. - CMP B ;..of lines-per-screen? - RC ;no, return. - XRA A ;yes, initialize.. - STA LPSCNT ;..for next screen full. - CALL VPRINT - DB ' ',DIM,'[View More...]',BRIGHT,CR,0 ;show msg line - CALL DKEYIN ;wait for keyboard input - CPI ' ' ;see if bar.. - PUSH PSW - CALL VPRINT - DB ' ',CR,0 ;clear above msg line - POP PSW - BRNZ CANVIEW ;..if not, see if cancel. - LDA CTPP ;set for single line - DCR A - STA LPSCNT ;..scroll and.. - RET ;..return for one more line. - -PAGEP: - LDA LTPP ;get number of lines of text per page - MOV B,A ;... in B - LDA LPSCNT ;is counter.. - INR A ;..at.. - STA LPSCNT ;..limit.. - CMP B ;..of lines-per-screen? - RC ;no, return. -FORMFD: XRA A ; zero for.. - STA LPSCNT ;..lines-per-page counter - LDA LFFEED ;form feed available? - ORA A ;0=no - JZ PRFEED - CALL LCRLF ;new line - MVI A,FF ;send form feed char - CALL LOUT - LDA EOFLAG ; if true then output final formfeed - ORA A ; - RNZ ; don't do heading if final formfeed - JMP PHEAD ;print header and done -PRFEED: - LDA LSPP ;number of lines to skip - MOV B,A ;number of lines to skip - MVI C,LIST ;LST output -PAGELST: - CALL LCRLF ;new line on LST - BJNZ PAGELST - JMP PHEAD ;print heading and done - -CANVIEW: - CPI CTRLC ;^C? - JZ COMCAN - RET ;return for another page - -INCCCNT: - LDA CHARCNT ;increment char count - INR A - STA CHARCNT - RET - -PHEAD: - LDA CON$LST ;printing to printer? - CPI LIST - RNZ - LXI H,HEADMSG ;print heading -PHEAD1: - MOV A,M ;get char - ORA A ;done? - BRZ PHEAD2 - CALL LOUT ;send to printer - INX H ;pt to next - BR PHEAD1 -PHEAD2: - LXI H,S$FCB+1 ;pt to file name - MVI B,8 ;8 chars - CALL PHEAD3 - MVI A,'.' ;dot - CALL LOUT - MVI B,3 ;3 more chars - CALL PHEAD3 - CALL LCRLF ;new line - CALL LCRLF ;blank line - RET -PHEAD3: - MOV A,M ;get char - CALL LOUT ;LST it - INX H ;pt to next - BJNZ PHEAD3 - RET - -; -; COMMAND: GC -; -; Copy files tagged using the 't' command. auto-erase if file exists -; on requested destination drive or in user area. -; -MASS$COPY: - MOV A,B ; recover opcode - STA MASSOP ; - CALL ERMSG - DB 'Mass Copy',0 -; XRA A ;A=0 -; STA MASSOP ;set operation to mass copy -; -; Main Entry Point for Mass Operation of Copy or Delete -; On entry, MASSOP = 0 if copy, 0FFH if delete -; -MASS$RUN: - LHLD RINGPOS ;save position - SHLD SRINGPOS - LHLD RING - LXI D,-13 ;back up to before first ring element - DAD D - SHLD RINGPOS ;set position -; -; Set Flags for First Time Thru and Mass Operation -; - XRA A ;A=0 - STA FIRST$M ;set for prompt for dest with first file - DCR A ;A=0FFH - STA MFLAG ;this is a mass operation -; -; Main Mass Operation Loop -; -MASS$OLP: - LHLD RINGPOS ;re-entry point for next file - LXI D,13 ;advance to next - DAD D - SHLD RINGPOS - XCHG ;at ring.. -; -; Check for Loop Completion -- DE = Current RINGPOS -; -MASS$OLP1: - LHLD RINGEND ;..end yet? - CALL CMPDEHL ;compare present position with end -; BRZ MASS$OLX ;done - JZ MASS$OLX ; -; -; Check for Tagged File at RINGPOS -; - LHLD RINGPOS ;get position - LXI D,12 ;get 1st possible tag location - DAD D - MOV A,M ;get tag - CPI TAGCH - BRNZ MASS$OLP ;not tagged, so skip -; -; Select Mass Operation -; - LDA MASSOP ;get type of mass operation -; ORA A ;0=COPY -; BRZ MASS$OC ;do copy - CPI 'C' ; check if copy - BRZ MASS$OC ; yes its copy - CPI 'P' ; check if print - BRZ MASS$LST ; yes its print - CPI 'D' ; check if delete - BRZ MDELETE ; its delete - CPI 'V' ; check if view - BRZ MASS$FVIEW ; its view - CALL ERMSG ; should be one of above - DB 'Illegal character',0 ; - JMP LOOP ; get new comand - -; COMMAND: GP -; -; Print tagged files using the 't' command -; - -MASS$PRINT: ; - MOV A,B ; recover opcode - STA MASSOP ; - CALL ERMSG ; - DB 'Mass Print',0 ; - BR MASS$RUN ; - -MASS$LST: ; - CALL LSTFILE ; - BR MASS$OLP ; skip to next - -; COMMAND: GV -; -; View tagged files using the 't' command -; - -MASS$VIEW: ; - MOV A,B ; recover opcode - STA MASSOP ; - CALL ERMSG ; - DB 'Mass View',0 ; -; BR MASS$RUN ; - JMP MASS$RUN ; - -MASS$FVIEW: - CALL VIEWFL ; - BR MASS$OLP ; - - -; Do Mass Delete - Current File Delete -; -MDELETE: ; - CALL DELETE ;delete filename at RINGPOS -; -; Advance to Next File if Delete Aborted -; - LDA DELCODE ;deletion done? - ORA A ;0=no -; BRZ MASS$OLP ;skip to next if not - JZ MASS$OLP ; -; -; Stay at Current File if Delete Done - Ring was Compressed by Delete -; - LHLD RINGPOS ;get current ring position - XCHG ;... in DE (don't advance) -; BR MASS$OLP1 ;loop until thru ring list - JMP MASS$OLP1 ; -; -; Do Mass Copy - Current File Copy -; -MASS$OC: - CALL COPY ;do copy -; BR MASS$OLP ;loop until thru ring list - JMP MASS$OLP ; -; -; Exit Mass Operation Loop -; -MASS$OLX: - LHLD SRINGPOS ;reset ring position - SHLD RINGPOS - LDA MASSOP ; (if delete, restart) -; ORA A ;NZ=delete -; JNZ RUNSH2 - CPI 'D' ; check if delete - JZ RUNSH2 ; else either print or copy - LHLD LOCBEG ;copy, so reset local ring - JMP JFW0A ;rescreen - -; -; COMMAND: C -; -; Copy source file at current 'ring' position to another drive. set-up -; fcb's and buffer area and check for correct keyboard inputs. contains -; auto-crc file copy verification. -; -FCOPY: -; -; Set Flags for First Time Thru and No Mass Copy -; - XRA A ;A=0 - STA FIRST$M ;set for prompt for destination - STA MFLAG ;not a mass copy -; -; Do Copy -; - CALL COPY ;do copy of file at RINGPOS -; -; Advance to Next File -; - JMP FORWARD ;advance to next file -; -; Copy File at RINGPOS -; -COPY: - LXI H,0 ;initialize storage for.. - SHLD CRCVAL ;..'crc' working value. - CALL RINGFCB ;move from 'ring' to 'sfcb' - LXI H,S$FCB+12 ;set pointer to source extent field - CALL INITFCB - MVI B,32 ;copy source 'fcb' to destination 'fcb' - LXI H,S$FCB+1 ;from point.. - LXI D,D$FCB+1 ;..to point.. - CALL MOVE ;..move across. - LXI D,S$FCB ;open file for reading - MVI C,OPEN ;open function - CALL BDOS - INR A ; 0ffh --> 00h if bad open - JZ FNF ;file not found -; -; Source File is Open -- If first time thru, get dest dir -; -COPY2: - LDA FIRST$M ;by-pass prompt, drive/user compatibility.. - ORA A ;..test, and disk reset after.. - BRNZ COPY3M ;..1st time thru in mass-copy mode. - DCR A ;A=0FFH - STA FIRST$M ;set not first time any more - CALL CPRMPT ;prompt for drive selection - DB 'Copy to DIR: ',0 - CALL DEF$D$U -; -; Check to ensure that either drives or user areas are different -; - LDA FCB ;get requested drive from 'fcb' and.. - MOV B,A ;..put into b-reg for.. - LDA S$FCB ;..comparison - CMP B - BRNZ COPY3 ;branch if different - LDA R$U$A ;requested user area --> rua - MOV B,A - LDA C$U$A ;current user area --> cua - CMP B - BRNZ COPY3 - CALL ERMSG ;if not, show error condition: - DB 'Src DIR = Dest DIR',0 - JMP LOOP ;try again? -; -; First File Copy - Reset System -; -COPY3: - CALL RESET ;make sure disk is read/write - CALL DLOGIN ;return home -; -; Nth File Copy - Copy without Resetting System -; -COPY3M: - LDA FCB ;put requested drive into.. - STA D$FCB ;..place in destination fcb (used to log in) - LDA R$U$A ;toggle to.. - CALL SET$USR ;..requested user area. - LXI D,D$FCB ;search for duplicate - MVI C,SRCHF ; 'search first' function - CALL BDOS - INR A ;if not found, 0ffh --> 00h. then.. - BRZ COPY5 ;go to 'make' function for new file. - LDA MFLAG ;auto-erase.. - ORA A ;..if.. - BRZ COPY4M ;..in mass-copy mode. - CALL ERMSG ;If found, ask to replace: - DB 0 - LXI H,D$FCB+1 - CALL PRFN - CALL VPRINT - DB ' Exists on Dest -- Erase (Y/N)? ',0 - CALL KEYIN ;get answer - CPI 'Y' ;if yes, then delete and copy ... - BRZ COPY4M ;... else fall thru to CUA$LOG and exit -; -; Log into Current User Area -; -CUA$LOG: - LDA C$U$A ;reset to current user area - JMP SET$USR ;set user and return to caller - -; -; Erase destination file and proceed -; -COPY4M: -; -; Set File Attributes -; - LXI H,D$FCB ;pt to FCB - CALL ATTRIB ;clear bytes in FCB and set attr of file - BRZ CUA$LOG ;return to caller if R/W not permitted -; -; Delete old file at dest -; - LXI D,D$FCB ;delete file already existing - MVI C,ERASE ;erase function - CALL BDOS -; -; Create new file at dest -; -COPY5: - LXI D,D$FCB ;create new file and open for writing - MVI C,MAKE ;make function - CALL BDOS - INR A ;if directory full, 0ffh --> 00h. - BRNZ COPY6 ;if not, branch. - CALL ERMSG - DB 'Dest Dir Full',0 - JMP LOOPFN ;if error, back to ring processor. -; -; Perform Copy -; -COPY6: - CALL CPRMPT - DB 'Copying File ',0 - LXI H,D$FCB+1 ;print file name - CALL PRFNSX - CALL VPRINT - DB ' to ',0 - LDA D$FCB ;print dest DU - ADI '@' - CALL COUT ;print disk - LDA R$U$A ;get user - CALL PAFDC ;print user - MVI A,':' - CALL COUT - XRA A ;clear 'eof'.. - STA EOFLAG ;..flag. -COPY6A: - CALL CUA$LOG ;current user area - LXI H,0 ;clear current-record.. - SHLD REC$CNT ;..counter. - LHLD BUFSTART ;set buffer start pointer.. - SHLD BUF$PT ;..to begin pointer. -; -; read source file -- fill buffer memory or stop on 'eof' -- update 'crc' -; on-the-fly -; -COPY7: - LHLD BUF$PT ;set dma address to buffer pointer - XCHG ; de-pair --> dma address - MVI C,SETDMA - CALL BDOS - LXI D,S$FCB ;source 'fcb' for reading - MVI C,READ ;record read function - CALL BDOS - ORA A ; 00h --> read okay - BRZ S$RD$OK - DCR A ;eof? - BRZ COPY8 ;yes, end-of-file, set 'eof' flag. - CALL ERMSG - DB 'Read Error',0 - JMP LOOPFN -; -; Read OK - Update CRC -; -S$RD$OK: - LHLD BUF$PT - MVI B,128 -COPY7A: - MOV A,M ;get character and.. - CALL UPDCRC ;..add to 'crc' value. - INX H - DCR B - BRNZ COPY7A ;loop 'till record read finished -; -; Update Buffer Ptr and Record Count -; - LHLD BUF$PT ;bump buffer pointer.. - LXI D,128 ;..by.. - DAD D ;..one.. - SHLD BUF$PT ;..record. - LHLD REC$CNT ;bump buffer.. - INX H ;..record count and.. - SHLD REC$CNT ;..store. - XCHG ;ready to compare to.. -; -; Check for Full Buffer -; - LHLD REC$MAX ;..maximum record count (full-buffer). - CALL CMPDEHL ;compare - BRNZ COPY7 ;if not full, get next record. - BR COPY9 ;full, start first write session. -; -; Indicate end-of-file read -; -COPY8: - MVI A,TRUE ;set 'eof' flag - STA EOFLAG -; -; Write source file from memory buffer to destination -; -COPY9: - LDA R$U$A ;set user to requested.. - CALL SET$USR ;..area. - LHLD BUFSTART ;adjust buffer pointer.. - SHLD BUF$PT ;..to start address. -COPY10: - LHLD REC$CNT ;buffer empty? - MOV A,H - ORA L - BRZ COPY11 ;buffer empty, check 'eof' flag. - DCX H ;dec buffer record count for each write - SHLD REC$CNT - LHLD BUF$PT ;set up dma address - PUSH H ;save for size bump - XCHG ;pointer in de-pair - MVI C,SETDMA - CALL BDOS - POP H - LXI D,128 ;bump pointer one record length - DAD D - SHLD BUF$PT - LXI D,D$FCB ;destination file 'fcb' - MVI C,WRITE ;write record function - CALL BDOS - ORA A ; 00h --> write okay - BRZ COPY10 ;okay, do next record. else.. - CALL ERMSG ;..say disk write error. - DB 'Copy Disk Full',0 -; -; Error in Write -- Delete Destination File and Abort -; -C$ERA: - LXI D,D$FCB ;delete.. - MVI C,ERASE ;..partial.. - CALL BDOS ;..from directory. - JMP LOOPFN ;back to ring -; -; Destination Buffer Written - Check for End -; -COPY11: - LDA EOFLAG ;buffer all written, check for 'eof'. - ORA A - JZ COPY6A ;branch to read next buffer full - LXI D,D$FCB ;point at 'fcb' for file closure - MVI C,CLOSE - CALL BDOS - INR A ;if no-close-error then.. - BRNZ CRC$CMP ;..compare file crc's. - CALL ERMSG - DB 'Copy Close Error',0 - JMP C$ERA -; -; Read Destination File and Compare CRCs -; -CRC$CMP: - LHLD CRCVAL ;transfer 'crc' value to.. - SHLD CRCVAL2 ;..new storage area. - LXI H,0 ;clear working storage.. - SHLD CRCVAL ;..to continue. - LXI D,TBUF - MVI C,SETDMA - CALL BDOS - LXI H,D$FCB+12 - CALL INITFCB - LXI D,D$FCB - MVI C,OPEN - CALL BDOS - INR A ; 0ffh --> 00h if bad open - JZ BADCRC ;if bad open, just say 'bad-crc'. - XRA A ;zero 'fcb'.. - STA D$FCB+32 ;..'cr' field. -CRCWF1: - LXI D,D$FCB - MVI C,READ - CALL BDOS - ORA A ;read okay? - BRZ D$RD$OK ;yes, read more. - DCR A ;eof? - BRZ FINCRC ;yes, finish up and make 'crc' comparison. - CALL ERMSG - DB 'Copy Read Error',0 - JMP LOOP -; -; Block Read OK - Update CRC -; -D$RD$OK: - LXI H,TBUF - MVI B,128 -CRCWF2: - MOV A,M ;get character to.. - CALL UPDCRC ;..add to 'crc' value. - INX H - BJNZ CRCWF2 - BR CRCWF1 -; -; Read Complete - Check CRCs -; -FINCRC: - LHLD CRCVAL ;put written-file 'crc' into.. - XCHG ;..de-pair. - LHLD CRCVAL2 ;put read-file 'crc' and.. - CALL CMPDEHL ;..compare 'de/hl' for equality. - BRNZ BADCRC ;if not zero, show copy-error message. - CALL VPRINT ;if zero, show 'verified' message. - DB ' -- Verified',0 - JMP CUA$LOG ;return to current user and return to caller -; -; Error on Copy -; -BADCRC: - CALL CUA$LOG ;return to current user - CALL ERMSG - DB ' -- CRC Error',0 - JMP LOOP ;abort - -; -; clear attributes of file (HL) and set attributes on disk -; return code of 0FFH (NZ) indicates OK to proceed, 0 (Z) indicates abort -; -ATTRIB: - PUSH H ;save regs - PUSH H - PUSH D - LHLD DUM$FCB ;init FCB - LXI D,12 ;12 bytes in - DAD D - POP D - CALL INITFCB - LHLD DUM$FCB ;pt to dummy FCB - XCHG ;... in DE - POP H - MVI B,12 ;copy - PUSH D - CALL MOVE - POP D ;pt to FCB - MVI C,SRCHF ;look for file - CALL BDOS - INR A ;file not found = 0 - POP H - RZ ;abort if no file - PUSH H ;save ptr - DCR A ;adjust - RRC ;right 3 bits to indicate offset into BUFF - RRC - RRC - LXI H,TBUF ;pt to buffer - ADD L ;pt to FCB of file - ADI 9 ;pt to R/O Byte - MOV L,A - MOV A,M ;get byte - ANI 80H ;extract R/O Bit - BRZ ATTRIB0 - CALL ERMSG - DB 0 - POP H - PUSH H - INX H ;pt to file name - CALL PRFN ;print file name - CALL VPRINT - DB ' is R/O -- Erase (Y/N)? ',0 - CALL KEYIN - CPI 'Y' - JZ ATTRIB0 - POP H - XRA A ;error return - RET -ATTRIB0: - POP H ;get ptr - PUSH H ;save ptr - INX H ;pt to first char - MVI B,11 ;11 Bytes -ATTRIB1: - MOV A,M ;get byte - ANI 7FH ;mask it - MOV M,A ;put byte - INX H ;pt to next - DCR B ;count down - JNZ ATTRIB1 - POP D ;pt to FCB - MVI C,ATTR - CALL BDOS - XRA A - DCR A ;no error return - RET - -; -;************************************************** -; -; CRC subroutines -; -; initialize tables for fast crc calculations - -INITCRC: - LHLD CRCTBL - MVI C,0 ;table index -GLOOP: - XCHG - LXI H,0 ;initialize crc register pair - MOV A,C - PUSH B ;save index in c-reg - MVI B,8 - XRA H - MOV H,A -LLOOP: - DAD H - BRNC LSKIP - MVI A,10H ;generator is x^16 + x^12 + x^5 + x^0 as.. - XRA H ;..recommended by ccitt for asynchronous.. - MOV H,A ;..communications. produces the same.. - MVI A,21H ;..results as public domain programs.. - XRA L ;..chek, comm7, mdm7, and modem7. - MOV L,A -LSKIP: - BJNZ LLOOP - POP B - XCHG ;de-pair now has crc, hl pointing into table. - MOV M,D ;store high byte of crc.. - INR H - MOV M,E ;..and store low byte. - DCR H - INX H ;move to next table entry - INR C ;next index - BRNZ GLOOP - RET - -UPDCRC: - PUSH B ;update 'crc'.. - PUSH H ;..accumulator.. - LHLD CRCVAL ;pick up partial remainder - XCHG ;de-pair now has partial - MVI B,0 - XRA D - MOV C,A - LHLD CRCTBL - DAD B - MOV A,M - XRA E - MOV D,A - INR H - MOV E,M - XCHG - SHLD CRCVAL - POP H - POP B - RET - -; -;************************************************** -; -; WORKHORSE Routines -; -; conin routine (waits for response) -; -KEYIN: - CALL CIN ;get input - CALL CAPS ;capitalize - JMP COUT ;echo - -; direct console input w/o echo (waits for input) - -DKEYIN: - CALL CIN ;get char from BIOS - JMP CAPS ;capitalize - -; convert keyboard input to upper case - -CONVERT: - LHLD CMDBUF ; 'current keyboard buffer length'.. - INX H - MOV B,M ;..to b-reg. - MOV A,B - ORA A ;if zero length, skip conversion. - JZ COMCAN -CONVLP: - INX H ;point at character to capitalize - MOV A,M - CALL CAPS - MOV M,A ;put back into buffer - BJNZ CONVLP - RET -; -; Fill buffer with 'spaces' with count in b-reg -; -FILL: - MVI M,' ' ;put in space character - INX H - BJNZ FILL ;no, branch. - RET -; -; Ignore leading spaces (ls) in buffer, length in c-reg. -; -UNSPACE: - LDAX D ;get character - CPI ' ' - RNZ ;not blank, a file is entered. - INX D ;to next character - DCR C - JZ COMCAN ;all spaces --> command recovery error - BR UNSPACE -; -; Check for legal filename character -- return with carry set if illegal -; -CKLEGAL: - LDAX D ;get character from de-pair - INX D ;point at next character - CPI ' ' ;less than space? - RC ;return carry if unpermitted character - PUSH H - PUSH B - CPI '[' ;if greater than 'z', exit with.. - BRNC CKERR ;..carry set. - MVI B,CHR$TEND-CHR$TBL - LXI H,CHR$TBL -CHR$LP: - CMP M - BRZ CKERR - INX H - BJNZ CHR$LP - ORA A ;clear carry for good character - POP B - POP H - RET - -CKERR: - POP B - POP H - STC ;error exit with carry set - RET - -CHR$TBL: - DB ',',':',';','<','=','>' ;invalid character table -CHR$TEND: - DS 0 -; -; Print file name in S$FCB -; -PRFNSX: - PUSH H ;save regs - PUSH B - BR PRFNS0 -PRFNS: - PUSH H ;affect only PSW - PUSH B - LXI H,S$FCB+1 -PRFNS0: - CALL PRFN ;print file name - POP B ;restore - POP H - RET -; -; Print file name pted to by HL -; -PRFN: - MVI B,8 ;8 chars - CALL PRFNS1 - MVI A,'.' - CALL COUT - MVI B,3 ;file type and fall thru -PRFNS1: - MOV A,M ;get char - CALL COUT - INX H ;pt to next - BJNZ PRFNS1 - RET -; -; Copy filename from RINGPOS to SFCB -; -RINGFCB: - LHLD RINGPOS ;move name from ring to source 'fcb' - LXI D,S$FCB ;place to move filename and.. - MVI B,12 ;..amount to move (fall thru to MOVE) -; -; move subroutine -- move b-reg # of bytes from hl-pair to de-pair -; -MOVE: - MOV A,M ;get hl-pair referenced source byte - ANI 7FH ;strip attributes - STAX D ;put to de-pair referenced destination - INX H ;fix pointers for next search - INX D - BJNZ MOVE - RET - -MOVEB: - PUSH H ;SAVE HL, DE - PUSH D - CALL MOVE - POP D ;RESTORE DE, HL - POP H - RET -; -; Initialize FCB system fields (entry with hl-pair pointing to FCB) -; -INITFCB: - MVI B,21 ;fill ex, s1, s2, rc, cr counters with zeros. -INITLP: - MVI M,0 ;put zero (null) in memory - INX H - BJNZ INITLP - RET -; -; Disk system reset -- login requested drive -; -RESET: - MVI C,RESETDK ;reset system - CALL BDOS - LDA R$DR ;make requested drive.. -SET$DR: - MOV E,A ;..current - MVI C,LOGIN - JMP BDOS ;return to caller -; -; Set/reset (or get) user area (call with binary user area in a-reg) -; -SET$USR: - MOV E,A ;user number in E -GET$USR: - MVI C,SGUSER - JMP BDOS ;return to caller -; -; Compare de-pair to hl-pair and set flags accordingly -; -CMPDEHL: - MOV A,D ;see if high bytes set flags - CMP H - RNZ ;return if not equal - MOV A,E - CMP L ;low bytes set flags instead - RET -; -; Shift hl-pair b-reg bits (-1) to right (divider routine) -; -SHIFTLP: - DCR B - RZ - MOV A,H - ORA A - RAR - MOV H,A - MOV A,L - RAR - MOV L,A - BR SHIFTLP - -; -; Determine free storage remaining on selected drive -; -FRESTOR: - MVI C,INQDISK ;determine current drive - CALL BDOS ;returns 0 as a:, 1 as b:, etc. - INR A ;make 1 --> a:, 2 --> b:, etc. - STA FCB - MVI C,GETPARM ;current disk parameter block - CALL BDOS - INX H ;bump to.. - INX H - MOV A,M ;..block shift factor. - STA BSHIFTF ; 'bsh' - INX H ;bump to.. - MOV A,M ;..block mask. - STA B$MASK ; 'blm' - INX H ;bump to.. - INX H ;..get.. - MOV E,M ;..maximum block number.. - INX H ;..double.. - MOV D,M ;..byte. - XCHG - SHLD B$MAX ; 'dsm' - MVI C,INQALC ;address of allocation vector - CALL BDOS - XCHG ;get its length - LHLD B$MAX - INX H - LXI B,0 ;initialize block count to zero -GSPBYT: - PUSH D ;save allocation address - LDAX D - MVI E,8 ;set to process 8 bits (blocks) -GSPLUP: - RAL ;test bit - BRC NOT$FRE - INX B -NOT$FRE: - MOV D,A ;save bits - DCX H - MOV A,L - ORA H - BRZ END$ALC ;quit if out of blocks - MOV A,D ;restore bits - DCR E ;count down 8 bits - BRNZ GSPLUP ;branch to do another bit - POP D ;bump to next count.. - INX D ;..of allocation vector. - BR GSPBYT ;process it - -END$ALC: - POP D ;clear alloc vector pointer from stack - MOV L,C ;copy # blocks to hl-pair - MOV H,B - LDA BSHIFTF ;get block shift factor - SUI 3 ;convert from sectors to thousands (k) - BRZ PRT$FRE ;skip shifts if 1k blocks -FREK$LP: - DAD H ;multiply blocks by k-bytes per block - DCR A ;multiply by 2, 4, 8, or 16. - BRNZ FREK$LP -PRT$FRE: - SHLD DISKSP ;save disk space - RET -; -; Print free space on disk -; -PRINT$FRE: - CALL ERMSG ;position and set flags - DB 0 - LHLD DISKSP - CALL PHLFDC ; # of free k-bytes in hl-pair - CALL VPRINT - DB 'K Bytes on Disk',0 - RET - -; -;************************************************** -; -; MESSAGE Routines -; -; Print VFILER Banner -; -BANNER: - CALL VCLS ;clear screen - LXI H,BANADR - CALL GOTOXY - CALL VPRINT ;print banner - DB 'VFILER, Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0' - IF Z80 - DB ' ' -; DB DIM ; - DB '[Z80 Code]' -; DB BRIGHT ; - ELSE - DB ' ' -; DB DIM ; - DB '[8080 Code]' -; DB BRIGHT ; - ENDIF - DB 0 - RET -; -; Home the Cursor -; -CUR$FIRST: - LXI H,CURHOME ; HOME ADDRESS - SHLD CURAT ; SET CURSOR POSITION - JMP GOTOXY -; -; Last File Position -; -CUR$LAST: - LHLD RINGPOS ; ADVANCE - SHLD LOCPOS ; SET LOCAL POSITION -CL0: - LXI D,13 - DAD D - XCHG - LHLD LOCEND ; END OF LOCAL RING? - CALL CMPDEHL - RZ - XCHG ; NEW POSITION - SHLD LOCPOS - PUSH H ; SAVE POSITION - CALL CUR$NEXT ; ADVANCE CURSOR - POP H ; GET POSITION - BR CL0 -; -; Advance the Cursor -; -CUR$NEXT: - LHLD CURAT ; COMPUTE NEW POSITION - MOV A,L ; CHECK FOR NEW LINE - ADI 19 ; SIZE OF EACH ENTRY - CPI 70 - BRNC CN1 ; ADVANCE TO NEXT LINE - MOV L,A ; NEW POSITION - SHLD CURAT - JMP GOTOXY -CN1: - MOV A,H ; GET LINE - LXI H,CURHOME ; GET COL - MOV H,A ; SET LINE AND FALL GO TO CUR$DOWN - SHLD CURAT - BR CUR$DOWN -; -; Back Up the Cursor -; -CUR$BACK: - LXI H,CURHOME ; GET HOME - XCHG ; ... IN DE - LHLD CURAT - CALL CMPDEHL ; COMPARE - BRZ CUR$LAST ; GOTO END IF LAST - MOV A,L ; CHECK FOR FIRST COL - CMP E - BRZ CB1 - SUI 19 ; BACK UP ONE COL - MOV L,A - SHLD CURAT ; NEW POS - JMP GOTOXY -CB1: - MOV A,E ; GET HOME COL - ADI 19*3 ; GET LAST COL - MOV L,A - DCR H ; PREV LINE - SHLD CURAT - JMP GOTOXY -; -; Move Cursor Down One Line -; -CUR$DOWN: - LXI H,CURHOME ; GET HOME ADDRESS - MOV B,H ; LINE IN B - LHLD CURAT ; GET CURRENT ADDRESS - INR H ; MOVE DOWN - MOV A,H ; CHECK FOR TOO FAR - SUB B - CPI EPS/4 - BRNC CD1 - SHLD CURAT ; OK, SO SET POSITION - JMP GOTOXY -CD1: - MOV A,L ; GET COL - LXI H,CURHOME - MOV L,A - SHLD CURAT - JMP GOTOXY -; -; Refresh Screen -; -REFRESH: - LHLD CURAT ; SAVE CURSOR AND RING POSITIONS - SHLD SCURAT - LHLD RINGPOS - SHLD SRINGPOS - CALL BANNER ; PRINT BANNER -; - IF BIHELP ;built-in help? - LDA HELPDISP ;DISPLAY HELP? - ORA A ;0=NO - BRZ REF1 - CALL HELPMSG ;PRINT HELP MESSAGE - BR REF2 -REF1: - ENDIF ;BIHELP -; - CALL DISPFILES ; DISPLAY FILES -REF2: - LXI H,DUADR ; DU ADDRESS - CALL GOTOXY - LXI H,C$DR ; PT TO CURRENT DRIVE (FOLLOWED BY CUR USER) - CALL STNDOUT ; TURNON HIGHLIGHTING - CALL PRDU ; PRINT DU:DIR> - CALL STNDEND ; TURN OFF HIGHLIGHTING - LXI H,CPMADR ; COMMAND PROMPT MESSAGE - CALL GOTOXY - CALL VPRINT ; PROMPT WITH DRIVE PREFIX - DB DIM - DB 'Command (? = ',0 - LDA HELPDISP ; IN HELP NOW? - ORA A ; 0=NO - BRZ REF3 - CALL VPRINT - DB 'Files',0 - BR REF4 -REF3: - CALL VPRINT - DB 'Help',0 -REF4: - CALL VPRINT - DB ')?',BRIGHT,0 - LHLD SCURAT ; RESTORE CURSOR AND RING POSITIONS - SHLD CURAT - LHLD SRINGPOS - SHLD RINGPOS - CALL SETCUR ; RESTORE CURSOR ON SCREEN - RET -; -; Print DU pted to by HL -; -PRDU: - PUSH H ; SAVE REGS - PUSH B - MOV A,M ; GET DRIVE - MOV B,A - ADI 'A' ; CONVERT TO LETTER - CALL COUT - INX H ; PT TO USER - MOV A,M ; GET USER - MOV C,A - CALL PAFDC ; PRINT USER AS FLOATING - MVI A,':' ; PRINT COLON - CALL COUT - CALL DUTDIR ; SCAN NAMED DIRECTORY TABLE - BRZ PRDU2 ; NO NAME? - MVI B,8 ; PRINT NAME -PRDU1: - MOV A,M ; GET CHAR - CPI ' ' ; DONE IF SPACE ENCOUNTERED - BRZ PRDU3 - CALL COUT - INX H - BJNZ PRDU1 - BR PRDU3 -PRDU2: - CALL VPRINT - DB 'Noname',0 -PRDU3: - POP B ; RESTORE REGS - POP H - RET - -; -; Refresh File Display -; -DISPFILES: - CALL CUR$FIRST ; POSITION CURSOR AT FIRST POSITION - LHLD LOCBEG ; PT TO FIRST FILE NAME - SHLD LOCPOS ; SAVE LOCAL POSITION -DSPF1: - LHLD LOCEND ; AT END? - XCHG - LHLD LOCPOS - CALL CMPDEHL - JZ CUR$FIRST ; POSITION AT FIRST ENTRY AND RETURN - MVI B,4 ; 4 SPACES - MVI A,' ' -DSPF2: - CALL COUT - BJNZ DSPF2 - PUSH H ; SAVE CURRENT LOCAL POSITION IN RING -; INX H ; PT TO FILE NAME -; CALL PRFN ; PRINT FILE NAME -; MOV A,M ; PRINT TAG -; CALL COUT - CALL HILITFN ; brigten filename - POP H ; GET CURRENT LOCAL POSITION - LXI D,13 - DAD D - SHLD LOCPOS - CALL CUR$NEXT ; ADVANCE CURSOR - BR DSPF1 - -HILITFN: ; - PUSH H ; save for later - LXI D,12 ; locate the tag byte - DAD D ; - MOV A,M ; put tag byte in a for store - STA TAGFLG ; - POP H ; back to beginning of filename - INX H ; point to filename - LDA TAGFLG ; - CPI ' ' ; if space don't highlight - CNZ STNDOUT ; set highlight on - CALL PRFN ; put out filename - MOV A,M ; get tag byte - CALL COUT ; and output it - LDA TAGFLG ; - CPI ' ' ; - CNZ STNDEND ; turn off highlighting - RET ; -; Position Cursor at CURAT -; -SETCUR: - LDA HELPDISP ; NOGO IF IN HELP DISPLAY - ORA A - RNZ - LHLD CURAT - CALL GOTOXY - CALL VPRINT - DB DIM,'-->',BRIGHT,0 - RET -; -; Clear Cursor -; -CLRCUR: - LDA HELPDISP ; NOGO IF IN HELP DISPLAY - ORA A - RNZ - LHLD CURAT - CALL GOTOXY - CALL VPRINT - DB ' ',0 - RET -; -; Command Prompt -; -CPRMPT: - LXI H,CPADR ; GET ADDRESS -MPRINT: - PUSH H ; SAVE ADDRESS - CALL GOTOXY - PUSH B -; MVI B,76-(CPADR MOD 255) - LDA CWIDTH ; find screen length in chars - SUI (CPADR MOD 256)-1 ; determine number of char. to blank - MOV B,A ; put number in b - CALL VEREOL ; ERASE TO EOL - POP B - POP H ; GET ADDRESS - CALL GOTOXY ; POSITION CURSOR - JMP VPRINT ; PRINT MESSAGE AND RETURN -; -; Working Message -; -WORKMSG: - CALL ERMSG - DB DIM,'Working ...',BRIGHT,0 - RET -; -; Error Message -; -ERMSG: - MVI A,0FFH ; SET ERROR MESSAGE FLAG - STA ERMFLG - LXI H,ERADR ; GET ADDRESS - BR MPRINT -; -; Print File Size Info -; -FSNOTE: - CALL ERMSG ; USE THIS ROUTINE - DB 'Size of ',0 - RET -; -; Position for File Size Print -; -ATFS: - LXI H,FSADR+13 ; POSITION FOR PRINT OF FILE SIZE - JMP GOTOXY -; -; Clear Error Message -; -ERCLR: - XRA A ; CLEAR FLAG - STA ERMFLG - LXI H,ERADR ; POSITION - CALL GOTOXY - PUSH B -; MVI B,76-(ERADR MOD 255) - LDA CWIDTH ; find screen length in chars - SUI (ERADR MOD 256)-1 ; determine number of char. to blank - MOV B,A ; put number in b - CALL VEREOL ; ERASE TO EOL - POP B - RET -; -; Position at Command Prompt and Clear It -; -ATCMD: - LXI H,CPADR ; POSITION - CALL GOTOXY - PUSH B -; MVI B,76-(CPADR MOD 255) - LDA CWIDTH ; find screen length in chars - SUI (CPADR MOD 256)-1 ; determine number of char. to blank - MOV B,A ; put number in b - CALL VEREOL ; CLEAR MESSAGE - POP B - LXI H,CPADR ; REPOSITION - JMP GOTOXY -; -; Position at Bottom of Screen and Prompt for Continuation -; -BOTTOM: - LXI H,BOTADR ; POSITION - CALL GOTOXY -; -; Prompt for Continuation -; -SAK: - CALL VPRINT - DB DIM,'Strike Any Key -- ',BRIGHT,0 - JMP KEYIN - - -; -; S T O R A G E -; -; Initialized -; -HEADMSG: - DB 'File: ',0 -MOREHELP: - DB 'HELP ' ;HELP Command for further info - VFNAME ;VFILER Name - DB 0 -MACFCB: - DB 0 - VFNAME ;VFILER Name - VFNFILL ;Filler - DB 'CMD' -FILERCMD: - VFNAME ;VFILER Name - VFNFILL ;Filler - DB ' ' ;one space -FILE$D: - DB 'x' -FILE$U: - DB 'xx' - DB ':' ;colon - DB 0 -JOKER: - DB '???????????' ;*.* equivalent -FIRST$M: - DB FALSE ;1st time thru in mass-copy mode -MFLAG: - DB TRUE ;multiple file copy flag-->0 for mass copy -TAG$TOT: - DW 0 ;summation of tagged file sizes -CMDBUF: - DS 2 ;command buffer maximum length, usage, and.. -; -; Uninitialized -; -STACK: - DS 2 -LWIDTH: - DS 1 ;WIDTH OF LINE -LTPP: - DS 1 ;LINES OF TEXT PER PAGE -LSPP: - DS 1 ;LINES TO SKIP PER PAGE -LFFEED: - DS 1 ;PRINTER CAN FORMFEED? (0=NO) -CWIDTH: - DS 1 ;WIDTH OF SCREEN -CTPP: - DS 1 ;LINES OF TEXT PER SCREEN -CSPP: - DS 1 ;LINES TO SKIP PER SCREEN -ALPHA: - DS 1 ;alphabetization flag (0=type and name, 0FFH= - ;...name and type) -B$MAX: - DS 2 ;highest block number on drive -B$MASK: - DS 1 ;sec/blk-1 -BSHIFTF: - DS 1 ;# of shifts to multiply by sec/blk -BUFENTRY: - DS 2 ;buffer start -BUF$PT: - DS 2 ;copy buffer current pointer.. -BUFSTART: - DS 2 ;..and begin pointer. -CANFLG: - DS 1 ;no-file-found cancel flag -C$DR: - DS 1 ;'current drive' -C$U$A: - DS 1 ;'current user area' (must follow C$DR) -CHARCNT: - DS 1 ;character count for tab expansion -CON$LST: - DS 1 ;bdos function storage -CRCTBL: - DS 2 ;tables for 'crc' calculations -CRCVAL: - DS 2 ;2-byte 'crc' value of working file and.. -CRCVAL2: - DS 2 ;..of finished source read-file. -CURAT: - DS 2 ;current cursor position -DELCODE: - DS 1 ;deletion code (0=delete not done) -D$FCB: - DS 33 ;fcb for destination file/new name if rename -DISKSP: - DS 2 ;space remaining on disk -DUM$FCB: - DS 2 ;dummy FCB for file attributes -DRLET: - DS 1 ;scratch for drive letter -EOFLAG: - DS 1 ;file copy loop 'eof' flag -ERMFLG: - DS 1 ;error message present flag -H$DR: - DS 1 ;home drive -H$U$A: - DS 1 ;home user area (must follow H$DR) -HELPDISP: - DS 1 ;display help screen (0=no) -LPSCNT: - DS 1 ;lines-per-screen for 'view' -LOCBEG: - DS 2 ;local beginning of ring -LOCEND: - DS 2 ;local end of ring -LOCPOS: - DS 2 ;local ring position (temp) -MASSOP: - DS 1 ;mass file operation code (0=no) -MAXDR: - DS 1 ;max driver letter -MDFLG: - DS 1 ;mass delete verify flag -O$USR: - DS 1 ;store initial user area for exit -R$DR: - DS 1 ;'requested drive' -RCNT: - DS 2 ;# of records in file and.. -REC$CNT: - DS 2 ;..currently in ram buffer. -REC$MAX: - DS 2 ;maximum 128-byte record capacity of buffer -RING: - DS 2 ;ptr to beginning of ring -RINGI: - DS 2 ;ring sort pointer -RINGJ: - DS 2 ;another ring sort pointer -RINGEND: - DS 2 ;current ring end pointer -RINGPOS: - DS 2 ;current ring position in scan -R$U$A: - DS 1 ;'requested user area' -SCURAT: - DS 2 ;save cursor position -S$FCB: - DS 36 ;fcb for source (random record) file -SRINGPOS: - DS 2 ;save ring position -TAGFLG: ; temp for tag - DS 1 ; -T$DR: - DS 1 ;temp disk -TEST$RT: - DS 1 ;intermediate right-justify data -T$U$A: - DS 1 ;temp user -T$UN$FG: - DS 1 ;tag/untag file summation switch -USER: - DS 1 ;temp user buffer -VIEWFLG: - DS 1 ; (00h) 1-->to list/punch else to crt 'view' - - END - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/VFILR4-1.LBR b/Source/Images/d_bp/u15/VFILR4-1.LBR deleted file mode 100644 index dfb7af8a..00000000 Binary files a/Source/Images/d_bp/u15/VFILR4-1.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/VFILR4-2.LBR b/Source/Images/d_bp/u15/VFILR4-2.LBR deleted file mode 100644 index f5682fa1..00000000 Binary files a/Source/Images/d_bp/u15/VFILR4-2.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/VMENU.COM b/Source/Images/d_bp/u15/VMENU.COM deleted file mode 100644 index af4eee94..00000000 Binary files a/Source/Images/d_bp/u15/VMENU.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/VMENU.HLP b/Source/Images/d_bp/u15/VMENU.HLP deleted file mode 100644 index 2db7bd92..00000000 --- a/Source/Images/d_bp/u15/VMENU.HLP +++ /dev/null @@ -1,903 +0,0 @@ -; - - - The ZCPR3 VMENU Shell - - -- ZCPR3 Utilities -- - 1 - VMENU - 2 - VMENUCK - - -- Using VMENU -- -- Programming VMENU -- - U - Using VMENU P - Programming *.VMN Files - S - Summary of User Cmds C - *.VMN Internal Commands - E - VMENU Error Messages M - Programming Cmd Summary - Z - VMENU and ZCPR3 - -:1 -Command: VMENU 1.0 - -Syntax: - VMENU <-- run MENU.VMN on all files in dir -or - VMENU afn <-- run MENU.VMN on files selected by afn -or - VMENÕ afî ufî <-- ruî menõ (ufn© on selecteä files - -Function: - - VMENÕ  ió thå ZCPR³ menõ front-enä processor®  Iô ió á -ZCPR³ Shelì whicè readó á *.VMÎ filå anä processeó  commandó -froí it. - -Options: None - -Comments: - VMENÕ  ió á truå ZCPR³ Shell®  Iô ió describeä iî thió -HELÐ file. - Selected Error Messages: - - "Nï Commanä Line¢ meanó thaô thå ZCPR³ Systeí doeó  noô -supporô  aî externaì Commanä Linå Buffer®  VMENÕ musô  havå -thió tï run. - - "Nï  Shelì Stack¢ meanó thaô thå ZCPR³ Systeí doeó  noô -supporô á Shelì Stack® VMENÕ musô havå thió tï run. - - "Shelì  Stacë Full¢ meanó thaô thå Shelì Stacë ió  fulì -anä VMENÕ cannoô pusè itselæ ontï thå stack. - - "Shelì  Stacë Size¢ meanó thaô thå Shelì Stacë elementó -arå toï shorô foò VMENÕ tï storå itó parameters. - - "TPÁ  Full¢ meanó thaô therå ió noô enougè rooí iî  thå -TPÁ tï loaä thå *.VMÎ file. - -Examples of Use: - See this HELP file - - VMENÕ ió thå ZCPR³ Menu-Orienteä Commanä  Preprocessor® -Iô  actó aó á front-enä tï ZCPR3¬  providinç á menu-orienteä -useò interfacå tï ZCPR3® Itó functioî caî bå representeä bù -thå followinç diagram: - ------- ------- ------- ------- - |V | |Z | |B | |P | - User | M | | C | | D | | g | - Menu ---->| E |--->| P |--->| O |--->| m | - Command | N | | R | | S | | s | - | U| | 3| | | | | - ------- ------- ------- ------- - - Thå "Useò Menõ Command¢ ió á singlå characteò thaô  thå -useò  strikeó  whicè instructó VMENÕ tï perforí á  function® -Oncå  VMENÕ  beginó processinç thió function¬  iô  buildó  á -commanä  linå  foò ZCPR3¬  optionallù askinç  thå  useò  foò -furtheò  inpuô  (sucè aó á filå name)¬  anä theî passeó  thå -commanä  linå tï ZCPR³ viá thå Commanä Linå  Buffer®  ZCPR³ -theî runó thå commanä linå returnó tï VMENU. - - VMENÕ  buildó commanä lineó baseä oî simplå inpuô  froí -thå user®  Thå useò neeä neveò kno÷ whaô thå actuaì commanä -linå is® Thå commanä linå itselæ ió alwayó oæ thå form: - - - - Aó  aî example¬  á commanä builô bù VMENÕ tï  ruî  XDIÒ -witè  useò inpuô foò á filå namå specification¬  coulä  looë -likå thå following: - - XDIR - - - Wheî VMENÕ ió executed¬  iô lookó foò thå filå MENU.VMÎ -iî thå currenô directory®  Iæ iô findó one¬ iô loadó iô anä -beginó  processing®  Iæ  iô doeó noô finä  one¬  iô  simplù -exits®  Á  filå namå maù bå specifieä iî thå VMENÕ  commanä -linå tï selecô á filå otheò thaî MENU.VMN. - - Thå  MENU.VMΠ filå caî contaiî uð tï 25µ menuó  tï  bå -processeä bù VMENU®  Thå VMENÕ wilì begiî processinç aô thå -firsô menõ iî MENU.VMN. - - - VMENÕ  itselæ  ió á COÍ file¬  likå anù  otheò  prograí -undeò  ZCPR3®  Unlikå  mosô  otheò  programs¬  however¬  iô -generateó  commanä lineó tï bå executeä bù ZCPR³ anä  storeó -itó  returî commanä iî thå Shelì Stack®  Iî thió waù á looð -ió seô up: - - -->--+->- VMENU ->- ZCPR3 ->-+ - ^ v - | | - +-<- Command Line -<----+ - - Onlù  VMENÕ  itselæ  oò á ZCPR³ tooì  likå  SHCTRÌ  caî -terminatå thió loop® Iæ thå VMENÕ programmeò wishes¬ hå caî -seô  uð  thå MENU.VMÎ filå sï thaô thió looð wilì  neveò  bå -exited¬ oò hå caî seô uð thå filå tï allo÷ anyonå tï exiô aô -anù  timå oò jusô á speciaì persoî whï knowó á  passworä  tï -exiô  wheî  hå  wisheó to®  Therå ió á loô  oæ  flexibilitù -designeä intï thå system¬  anä iô wilì bå discusseä lateò iî -thå sectioî oî programminç MENU.VMÎ files. - Á  MENU.VMΠ filå caî bå seô uð tï  executå  anù  ZCPR³ -commanä oò sequencå oæ commands® Thå MENU.VMÎ filå caî alsï -bå seô uð tï noô allo÷ thå useò tï leavå VMENU¬ tï allo÷ hií -tï leavå VMENÕ aô will¬  oò tï allo÷ hií tï leavå VMENÕ onlù -iæ hå knowó á password. - - Thió  HELÐ filå ió divideä intï twï basiã  parts®  Thå -infï  sectionó  oî  "Usinç  VMENU¢  anä  "Summarù  oæ  VMENÕ -Commands¢ arå designeä tï bå reaä bù á persoî wantinç tï uså -VMENÕ  buô  noô wantinç tï learî ho÷ VMENÕ workó oò  ho÷  tï -prograí  it®  Theså sectionó describå ho÷ tï movå froí  onå -menõ  tï another¬  ho÷ tï issuå VMENÕ commands¬  anä ho÷  tï -leavå VMENÕ iæ thå optioî ió presenteä tï him. - - Thå  otheò  sectionó  oæ thió HELР filå  describå  thå -programminç  aspectó oæ VMENÕ anä arå intendeä tï bå useä aó -aî  onlinå referencå foò thå VMENÕ  programmer®  Thå  VMENÕ -commanä  programminç summarù ió especiallù usefuì iî thaô iô -provideó   á  summarù  oæ  thå  commandó  whicè  thå   VMENÕ -programmeò maù issuå tï VMENÕ withiî á *.VMÎ file. -:U - - Wheî VMENÕ ió firsô invoked¬  iô wilì bå installeä aó á -Shell¬   anä  controì  wilì  returî  tï  thå  ZCPR³  commanä -processoò  foò  thå  nexô commanä iî  thå  line®  Wheî  thå -commanä  linå ió exhausted¬  ZCPR³ wilì realizå thaô á shelì -has been installed and invoke VMENU as a shell. - - VMENÕ wilì theî comå up¬ loaä thå nameó oæ thå fileó iî -thå currenô disë directory¬  loaä thå menõ file¬ anä displaù -uð  tï sixteeî fileó anä thå firsô menõ iî thå menõ filå  tï -the user. The user will then be prompted for a command. - - Iæ  aô anù timå á Menõ Displaù ió garbled¬  jusô strikå -thå ^Ò key® ^Ò refresheó thå menõ aô alì times. - - - Thå  prompô  whicè appearó aô thå bottoí  oæ  thå  Menõ -displaù haó thå followinç generaì form: - -Command (=Menu,^C=Z3,*=1st Menu,<=Prev Menu,>=Next Menu) - - - Therå  caî  bå uð tï 25µ menuó iî onå  VMENU.VMΠ file® -Thå  VMENÕ  commanä  prompô varieó  tï  reflecô  this®  Foò -instance¬  iæ  onlù  onå Menõ waó presenô anä thå optioî  tï -aborô ouô oæ VMENÕ tï ZCPR³ waó noô available¬ theî thå Menõ -Commanä prompô woulä takå itó simplesô form¬ lookinç like: - -Command (=Menu) - - - Strikå  ^Ò aô thió timå tï refresè thå Menõ Displaù  oò -strikå thå characteò oæ á Menõ Option®  Theså arå thå  onlù -choices¬  anä  strikinç á characteò whicè ió noô thå  RETURÎ -keù oò á menõ optioî resultó iî thå belì sounding. - - - Iæ  thå  thå optioî tï exiô tï ZCPR³ waó availablå  anä -therå  ió  onlù  onå Menõ iî thå  MENU.VMΠ file¬  theî  thå -commanä linå wilì looë likå this: - -Command (=Menu,^C=Z3) - - - Thå  optioî oæ abortinç tï ZCPR³ bù strikinç  Control-à -(holä  dowî  oî thå Control¬  oò CTRL¬  keù anä  strikå  thå -letteò C© ió no÷ available®  Thió wilì returî tï ZCPR³  anä -exiô VMENU. - - Onå  brieæ notå oî optioî letteró beforå goinç on®  Iæ -onå  oæ youò optionó ió á letteò iî thå rangå froí Á  tï  Z¬ -theî caså ió noô significant¬  anä yoõ caî invokå thå optioî -A¬ say¬ bù strikinç aî upper- oò lower-caså A. - - - Iæ  therå ió morå thaî onå menõ iî thå *.VMÎ file¬  thå -commanä linå optionó becomå slightlù morå complex¬  buô theù -arå stilì quitå easù tï follow. - - Iî  thå followinç examples¬  assumå thaô thå optioî  tï -exiô tï ZCPR³ ió off¬ sï thå "^C=Z3¢ optioî wilì NOÔ appear. - - Froí thå firsô menõ iî thå file¬  thå commanä linå wilì -looë likå thå following: - -Command (=Menu,>=Next Menu) - - - Tï advancå tï thå nexô menu¬  strikå thå ">¢ oò thå ".¢ -character®  Oî mosô keyboards¬ ">¢ ió thå shifô oæ thå "."¬ -sï VMENÕ permitó easù movemenô withouô havinç tï worrù abouô -shiftinç thå keyboarä alì thå time. - - - Iæ aô thå lasô menõ iî thå file¬  thå commanä linå wilì -looë likå thå following: - -Command (=Menu,*=1st Menu,<=Prev Menu) - - - Thió  allowó  thå useò tï strikå thå "*¢  characteò  tï -jumð  bacë tï thå firsô menõ iî hió *.VMÎ file®  Iæ "<¢  oò -",¢  ió strucë ("<¢ ió usuallù thå shifô oæ thå  ",")¬  theî -thå  useò wilì bacë uð onå menõ tï thå previouó menõ iî  thå -file. - - Iæ thå useò ió somewherå iî thå middlå oæ thå  MENU.VMÎ -file¬ hió commanä linå wilì looë likå this: - -Command (=Menu,*=1st Menu,<=Prev Menu,>=Next Menu) - - - Again¬  "*¢ wilì gï directlù tï thå firsô menu¬  "<¢ oò -",¢ wilì gï tï thå previouó menu¬  anä ">¢ oò ".¢ wilì gï tï -thå  nexô  menu®  Strikinç thå RETURÎ keù wilì refresè  thå -menõ display. - - Iî  summary¬  movinç abouô withiî VMENÕ ió quitå  easy® -"*¢  moveó thå useò tï thå firsô menu¬  "<¢ tï thå  previouó -menu¬ ">¢ tï thå nexô menu. - -:S - - The full Menu Command Line looks like the following: - -Command (=Menu,^C=Z3,*=1st Menu,<=Prev Menu,>=Last Menu) - - - The Menu Commands are: - - Command Function - - ^R Refresh Menu Display (RETURN Key) - ^C Exit to ZCPR3 (Control-C) - * Jump to the First Menu - < or , Jump to the Previous Menu - > or . Jump to the Next Menu - other Menu Option or Invalid Command; letters are - automatically capitalized, so a=A - -:P - - Programming *.VMN Files - - Thå  *.VMΠ filå  ió simplù á texô filå  whicè  maù  bå -createä  witè  anù  conventionaì  CP/Í   editor¬   includinç -WordStar®  VMENÕ  ignoreó  thå Mosô Significanô Biô oæ  alì -bytes¬ sï editoró likå WordStar¬ whicè occasionallù seô thió -bit¬ caî bå used. - - Alì *.VMÎ fileó havå thå samå generaì  structure®  Thå -firsô  linå ió eitheò á globaì optioî linå oò thå  beginninç -oæ á menõ display®  Iæ á globaì optioî line¬ iô beginó witè -thå  characteò  "-"¬   anä  thió  characteò  ió  immediatelù -followeä  bù  globaì optioî characters®  Thå globaì  optioî -line¬ theî lookó likå this: - --option - - Afteò thå globaì optioî line¬  iæ any¬  comeó thå firsô -menu® Eacè menõ ió structureä aó follows: - - #option - - # - menu commands - - The following are two sample Menu File structures: - - -option #option - #option - # - # commands - commands ## - #option - - # - commands - ## - Therå ió onå optioî character®  Iî usinç it¬  caså  ió -noô significant®  Thió optioî characteò ió "X"¬ whicè telló -VMENÕ tï allo÷ thå useò tï exiô tï ZCPR3. - - Thå  Ø  optioî enableó thå facilitù whicè  permitó  thå -useò tï typå ^à anä returî tï ZCPR3. - - Wheî VMENÕ firsô comeó up¬  thå Ø optioî ió turneä off® -Thå useò cannoô exiô tï ZCPR3. - - Thå  globaì optionó line¬  which¬  iæ present¬  ió  thå -firsô linå oæ thå file¬  turnó oî thió optioî foò thå courså -oæ  thå sessioî iî general®  Thaô is¬  iæ á globaì  optionó -linå like - - -x - -ió useä (caså ió insignificant)¬ theî thå abilitù tï exiô tï -ZCPR3 is enabled for all menus. - - - Thå  globaì optionó linå turnó oî thå Ø optioî foò  alì -menuó iî general® However¬ thå Ø optioî maù bå presenteä oî -thå  firsô  linå  oæ eacè menõ  immediatelù  afteò  thå  "#¢ -characteò  tï  temporarilù complemenô thå settinç foò thå  Ø -optioî foò onlù thaô menu. - - Iæ  thå Ø optioî ió NOÔ includeä iî thå globaì  optionó -line¬  iô  ió  turneä OFÆ foò alì  menuó  iî  general®  Thå -defaulô  selecteä  bù  usinç  thå  globaì  optionó  linå  ió -overriddeî oî á per-menõ basió bù thå locaì menõ options. - - Example: - - - -x - #x - No exit to ZCPR3 is permitted - # - commands - #x - No exit to ZCPR3. - # - commands - # - Thå useò maù exit to ZCPR3. - # - commands - ## - -:C - - *.VMN Commands - - Thió   sectioî  describeó  thå  techniquå  anä  optionó -availablå  foò creatinç commanä lineó iî *.VMΠ files®  Thå -informatioî  hereiî ió organizeä intï thå followinç  subjecô -areas: - - o Syntax of the command line - - o :nn Option - - o ! Option - - o "text" prompts and input - - o Variables ($D, $U, $Fn, $Nn, $Tn, $Pp, $$) - - o Highlighting (^A, ^B) - - Syntax - Thå commandó iî á *.VMÎ filå follo÷ á simplå structure® -Eacè commanä occupieó onlù onå line¬  anä blanë lineó iî thå -commanä  grouð  arå  noô permitted®  Thå  commanä  linå  ió -structureä aó follows: - - l[o][command] - -where: - l is the single character used to invoke the command - note that it may be upper- or lower-case - o is an opening option, which is one of: - :nn -- go to Menu nn - ! -- have VMENU wait when the command is finished - command is an optional ZCPR3 command; note that if - the option is ":nn", then a command here makes no - sense - - :nn Opt - Thå  ":nn¢  optioî telló VMENÕ tï movå tï  á  differenô -menõ  iî  thå  *.VMÎ file®  Thå firsô  menõ  ió  numbeò  1® -Example: - - -x - # - 1st Menu: A - Goto Menu 2 3 - Goto Menu 3 - # - a:2 - 3:3 - # - 2nd Menu Command: 3 - Goto Menu 3 - # - 3:3 - #x - 3rd Menu Command: 2 - Goto Menu 2 - # - 2:2 - ## - :nn Opt - Iî thå firsô menu¬ thå useò maù strike: - - "a¢ oò "A¢ tï gotï Menõ 2 - "3¢ tï gotï Menõ 3 - ">¢  oò  ".¢ tï gotï thå nexô menõ (Menõ 2) - ^à tï gotï ZCPR3 - - In the second menu, the user may strike: - - "3" to goto Menu 3 - "*" or "<" or "," to goto Menu 1 - ">" or "." to goto Menu 3 - ^C to goto ZCPR3 - - In the third menu, the user may strike: - - "2" or "<" or "," to goto Menu 2 - "*" to goto Menu 1 - - ! Opt - Thå  "!¢ optioî causeó VMENÕ tï pauså anä asë thå  useò -tï "Strikå Anù Key¢ beforå continuinç afteò thå commanä linå -haó  beeî processed®  Iî thió way¬  iæ á commanä  generateó -informatioî  tï bå reaä bù thå useò beforå VMENÕ clearó  hió -screen¬  thå "!¢ optioî maù bå useä tï givå thå useò alì thå -timå hå wantó tï reaä thió display. - - "prompt" - Embeddeä  withiî  anù commanä linå maù bå á prompô  foò -useò input® Thió prompô takeó thå forí of - - "prompt to user" - -Wheî  encountered¬  VMENÕ wilì advancå tï thå nexô linå  anä -prinô thå texô containeä withiî thå quotes® VMENÕ wilì theî -waiô foò thå useò tï inpuô anù texô hå desireó followeä bù á -RETURN®   Aô  thió  point¬  thå  texô  thå  useò  inpuô  ió -capitalizeä anä placeä intï thå commanä linå aô thå poinô oæ -thå prompt. - - Iæ  thå  prompô appearó aô thå enä oæ á  VMENÕ  commanä -line¬  thå trailinç quotå ió noô required®  Aó manù promptó -aó   desireä  maù  appeaò  withiî  á  VMENÕ  commanä   line® -Examples: - - "prompt" - -x - # - A - Run XDIR without Pause or Input - B - Run XDIR and Pause before Returning to VMENU - C - Run XDIR, Allow User Input, and Pause before - Returning to VMENU - M - Run MCOPY, Allow User Input of Dest Dir, Allow - User Input of Source Dir and File, and Pause - before returning to VMENU - Z - Run Any ZCPR3 Command and Pause before - Returning to VMENU - # - m!mcopy "Destination Dir? "="Source DIR:AFN? " - z!"Enter Command Line -- - axdir - b!xdir - c!xdir "Enter Ambiguous File Name -- - ## - - "prompt" - Notå  thå Spacå righô beforå thå "Prompô forí iî thå  Ã -command®  Thió spacå ió significanô tï keeð thå commanä anä -useò  inpuô froí runninç together®  Thió "ruî together¢  ió -desireä  foò thå Ú command®  Alsï notå thå duaì prompô  foò -thå Í command. - - Witè thå Í command¬  thå followinç promptó wilì  appeaò -(anä samplå input): - - Destination Dir? BACKUP: - Source DIR:AFN? *.TXT - -anä thå followinç commanä linå ió built: - - MCOPY BACKUP:=*.TXT - - Variables - Thå  commanä  texô  whicè  ió specifieä  iî  thå  VMENÕ -commanä linå caî contaiî embeddeä variableó whicè VMENÕ wilì -expanä wheî thå commanä linå ió processed® Theså variables¬ -whicè  arå denoteä bù á dollaò sigî ($© followeä bù  onå  oò -twï characters¬ arå defineä aó follows: - - Variable Expands as - -------- ---------- - $D Current Disk - $U Current User Area - $Fn FILENAME.TYP for ZCPR3 System File n - $Nn FILENAME for ZCPR3 System File n - $Tn TYP for ZCPR3 System File n - $Pp Name of File being Pointed to - $$ Place a single $ in command line - - Theså  variableó  caî alsï bå useä iî thå menõ  displaù -itself¬  anä  theiò  valueó  wilì bå  substituteä  wheî  thå -displaù ió generated® Example: - Variables - -x - # - Menu to Run M80 Assembler - Current File: $F1 - Directory: $D$U - F - Define File - E - Edit $F1 P - Page $F1 - A - Assemble $F1 - # - fsetfile 1 "Filename? " - eedit $f1 - azex m80 $n1 - ppage $f1 - ## - - Variables -Notes: - - 1® Thå ZCPR³ utilitù SETFILÅ ió useä tï definå thå namå -oæ  á  ZCPR³  Systeí File®  Therå  arå  fouò  Systeí  Fileó -available¬  anä theù caî bå referenceä bù $F± tï $F4¬ $N± tï -$N4¬ anä $T± tï $T4. - - 2®  Thå Á commanä showó thå executioî oæ ZEX® VMENÕ ió -á truå ZCPR³ Shell¬ and¬ aó such¬ ZEØ commandó caî bå issueä -froí  iô anä wilì ruî oî toð oæ it®  Thå prompô foò thå ZEØ -commanä lineó wilì bå "Menu>". - - 3®  Assuminç thaô "MYFILE.MAC¢ ió assigneä tï thå ZCPR³ -Systeí Filå ± anä thå useò ió loggeä intï disë  useò 1¬ thå -followinç  screeî  showó ho÷ thå displaù anä  thå  resultinç -commanä lineó wilì bå expandeä wheî executioî occurs: - - Variables - Display - - Menu to Run M80 Assembler - Current File: MYFILE.MAC - Directory: B1 - F - Define File - E - Edit MYFILE.MAC P - Page MYFILE.MAC - A - Assemble MYFILE.MAC - - - Command Lines - Menu Command Expansion - - fsetfile 1 "Filename? " SETFILE 1 "Filename? " - eedit $f1 EDIT MYFILE.MAC - azex m80 $n1 ZEX M80 MYFILE - ppage $f1 PAGE MYFILE.MAC - - Highlighting - Jusô  likå thå HELÐ utilitù caî takå advantagå  oæ  thå -highlightinç facilitù provideä iî thå Z3TCAP¬  sï caî VMENU® -Foò  thoså  ZCPR³  Systemó witè á  properly-installeä  TCAP¬ -VMENÕ  wilì  uså  thå cleaò screeî commanä  tï  refresè  thå -user'ó  screeî anä highlightinç caî bå enableä anä  disableä -bù  embeddinç ^Á (tï turî oî highlighting© anä ^  (tï  turî -ofæ highlighting© intï thå *.VMÎ file. - - Iô  ió recommendeä thaô wheî highlightinç ió turneä on¬ -iô  shoulä  bå turneä ofæ iî thå samå linå  foò  consistencù -sakå anä appearance. - - Example: - - Highlighting - # - ^AThis is highlighted^B and this is not - # - -wilì appeaò witè "Thió ió highlighted¢ iî á highlighteä modå -likå this: - - This is highlighted and this is not - - - Variables - - Thå  $Pð  variablå ió alsï availablå tï thå useò  undeò -VMENU®  $Pð returnó informatioî oî thå filå currentlù beinç -pointeä tï bù thå useò oî thå screen® Thió variablå haó thå -following forms: - - Form Expands Into - $PF FILENAME.TYP of the pointed-to file - $PN FILENAME of the pointed-to file - $PT TYP of the pointed-to file - - Foò instance¬ iæ thå filå currentlù beinç pointeä tï ió -named MYFILE.TXT, then the command line: - - ECHO FILENAME.TYP=$PF FILENAME=$PN TYP=$PT - -will output: - - FILENAME.TYP=MYFILE.TXT FILENAME=MYFILE TYP=TXT - Variables - Example: - - -x - # - Menu to Run M80 Assembler - Directory: $D$U - Å - Ediô Pointed-tï Filå - Ð - Pagå Pointed-tï File - A - Assemble Pointed-to File - # - eedit $pf - azex m80 $pn - ppage $pf - ## - - Variables -Notes: - - 1® Thå Å anä Ð commandó builä commanä lineó containinç -the full file name and type of the file being pointed to. - - 2®  Thå Á commanä showó thå executioî oæ ZEX® VMENÕ ió -á truå ZCPR³ Shell¬ and¬ aó such¬ ZEØ commandó caî bå issueä -froí  iô anä wilì ruî oî toð oæ it®  Thå prompô foò thå ZEØ -commanä lineó wilì bå "VMenu>". - - 3® Assuminç thaô MYFILE.MAà ió beinç pointeä tï bù thå -user¬ thå followinç showó thå expansioî oæ thå commanä lineó -for this example: - - Menu Command Expansion - eedit $pf EDIT MYFILE.MAC - azex m80 $pn ZEX M80 MYFILE - ppage $pf PAGE MYFILE.MAC - - Variables - - Thå  firsô entrù iî anù VMENÕ filå displaù ió nameä "Nï -File"¬  anä  thió  entry¬  wheî pointeä tï bù thå  useò  anä -expandeä intï thå commanä line¬  ió translateä intï á prompô -foò thå useò tï inpuô thå namå oæ á file®  Thió featurå  ió -provideä  aó á conveniencå tï thå useò sï thaô hå wilì  havå -thå  abilitù  tï easilù specifù ne÷ fileó whicè dï  noô  yeô -exisô  tï thå VMENÕ commandó (sucè aó foò aî editoò  commanä -in which the user wants to create a new file). - - Iæ  thå  pointeò ió aô "Nï File¢ anä thå  commanä  linå -useó  severaì  referenceó  tï thå pointeò (aó  iî  thå  ECHÏ -commanä examplå above)¬  theî thå useò ió prompteä onlù oncå -foò  thå  namå oæ thå file¬  anä eacè referencå deriveó  itó -information from this name. - - Closing - Closing Notes - - Aó  manù commandó aó thå printablå ASCIÉ characteò  seô -(withouô   lower-caså   letteró   anä  thå   VMENÕ   commanä -characters©  wilì allo÷ arå permitteä bù VMENU®  Thå  text¬ -however¬  foò eacè menõ musô bå ablå tï fiô oî á screeî witè -thå filå directorù displaù aô thå toð anä thå commanä prompô -aô  thå bottom®  Thió meanó thaô thå texô cannoô exceeä  1¶ -lines. - - VMENÕ  fitó iî nicelù tï thå ZCPR³ Systeí oæ  programs® -Thå  informatioî  sectioî oî "VMENU'ó  Relationshið  tï  thå -ZCPR³  System¢  explainó  ho÷  VMENÕ  anä  thå  otheò  ZCPR³ -programó worë together. - - Thå  followinç  ASCIÉ  characteró maù NOÔ  bå  useä  aó -commandó sincå theù arå useä elsewhere: - - # % , . < > * - -:M - - VMENU Programming Command Summary - - Eacè  VMENÕ commanä occupieó onlù onå line¬  anä  blanë -lineó  iî thå commanä grouð arå noô permitted®  Thå commanä -linå ió structureä aó follows: - - l[o][command] - -where: - l is the single character used to invoke the command - note that it may be upper- or lower-case - o is an opening option, which is one of: - :nn -- go to Menu nn - ! -- have VMENU wait when the command is finished - command is an optional ZCPR3 command; note that if - the option is ":nn", then a command here makes no - sense - - -The VMENU commands are: - - Command Function - - :nn Goto Menu nn, where the first menu is Menu 1 - ! Wait after command line is executed before - processing the menu - "Prompt" Prompt the user for input and accept it - - -The VMENU variables are: - - Variable Expands to - - $D Current Disk - $U Current User - $Fn FILENAME.TYP for System File n - $Nn FILENAME for System File n - $Tn TYP for System File n - $PF FILENAME.TYP for Pointed-to File - $PN FILENAME for Pointed-to File - $PT TYP for Pointed-to File - $$ $ - -Noteº Systeí Fileó caî bå defineä bù thå SETFILÅ command. - -The Highlighting Embedded Characters are: - - ^A Turn ON Highlighting - ^B Turn OFF Highlighting - -Noteº  Iô ió recommendeä thaô iæ highlightinç ió turneä  on¬ -it should be turned off in the same line. - - - -Thå  followinç ASCIÉ characteró maù NOÔ bå useä aó  commandó -sincå theù arå useä elsewhere: - - # % , . < > * - - - -:Z - - VMENU's Relationship to the ZCPR3 System - - VMENU¬ likå mosô oæ thå ZCPR³ utilities¬ interactó witè -thå systeí aó á wholå anä cannoô bå useä witè systemó  otheò -thaî  ZCPR3®   Iî  particular¬  VMENÕ  requireó  thå  ZCPR³ -Multiplå  Commanä Linå Buffeò anä Shelì Stacë facilitieó  tï -bå  availablå  tï  iô anä cannoô ruî  withouô  them®  VMENÕ -invokeó  commanä  lineó  viá thå  Commanä  Linå  Buffeò  anä -returnó  tï itselæ thrõ thå Shelì Stack®  Iô alsï useó  thå -ZCPR³  Systeí Fileó foò somå oæ itó variableó anä thå Z3TCAÐ -facilitù foò itó screeî manipulatioî (highlighting). - - VMENU is installed by Z3INS. - - - Also¬ CÄ (Changå Directory© anä STARTUÐ (or¬ SÔ foò CD© -caî  comå intï plaù witè VMENU®  Wheî CÄ logó intï  tï  ne÷ -directory¬  iô  lookó foò thå filå ST.COÍ anä executeó iô iæ -therå  ió one®  SÔ ió simplù STARTUÐ renamed¬  anä  STARTUÐ -wilì  loaä thå Multiplå Commanä Linå Buffeò witè  á  commanä -linå anä theî terminate. - - Froí thå poinô oæ vie÷ oæ VMENU¬  thå commanä loadeä bù -SÔ  coulä bå VMENU®  Thå effecô oæ thió ió tï automaticallù -enteò  VMENÕ  wheî  thå useò employó CÄ  tï  enteò  á  giveî -directory. - - Hence¬  bù  usinç CD¬  á useò caî enteò á directorù anä -suddenlù  finä  himselæ iî á menõ insteaä oæ  aô  thå  ZCPR³ -commanä  level®  Thió  ió  gooä foò  applicationó  wherå  á -directorù  ió  seô  asidå foò á specifiã  purposå  anä  onlù -certaiî  operationó  arå  tï bå performeä  iî  it¬  sucè  aó -cataloginç diskó oò handlinç accounts. - - - No÷  thaô VMENÕ ió runninç foò thå directory¬  á  VMENÕ -commanä  coulä  bå anotheò CÄ tï anotheò directory®  Oò  iô -coulä simplù bå á DUº form® Example: - - # - A - Enter ZCPR Directory - B - Enter A0: - # - acd zcpr: - ba0: - # - - Here¬  iæ Á ió issued¬ theî CÄ wilì movå intï ZCPRº anä -executå ST.COÍ iæ therå ió onå there®  Iæ  ió issued¬  thå -useò ió loggeä intï A0:®  VMENÕ ió thå nexô commanä iî botè -caseó (invokeä aó á Shell)¬ sï VMENÕ automaticallù reinvokeó -anä lookó foò MENU.VMN®  Iæ iô findó it¬  wå arå iî anotheò -VMENÕ  system¬  and¬  iæ iô doesn't¬  wå arå bacë  tï  ZCPR³ -commanä level. - - Undeò thå Á option¬ iæ CÄ findó ST.COM¬ SÔ wilì executå -itó functioî and¬  unlesó thió functioî popó thå Shelì Stacë -(SHCTRÌ  POР command)¬  VMENÕ  wilì reinvokå  afteò  iô  ió -complete. - - Undeò  thå  option¬  wå wilì ruî VMENÕ nexô anä simplù -exiô iæ á MENU.VMÎ filå ió noô found. - - - VMENÕ  interactó  heavilù witè thå ZCPR³  Systeí  Fileó -whicè  arå  defineä  aó  á parô  oæ  thå  ZCPR³  Environmenô -Descriptor®  Therå arå fouò Systeí Files¬ anä threå oæ theí -are used by VMENU for various purposes: - - File Purpose - 2 Name of Current File - 3 Name of Menu File - 4 Name (containing wild cards) used to - Select Files for VMENU File Display - - Systeí  Filå  ² containó thå namå oæ thå currenô  VMENÕ -file®  Bù  changinç thió name¬  á transienô caî  causå  thå -pointeò  oæ VMENÕ tï poinô tï somå otheò filå wheî VMENÕ  ió -reinvoked. - - - Systeí  Filå ³ containó thå namå oæ thå menõ filå whicè -VMENÕ ió usinç tï derivå menõ displayó anä commanä from® Bù -changinç thió entry¬  á transienô caî selecô differenô  menõ -files dynamically. - - Systeí  Filå ´ ió useä tï indicatå whicè fileó (sucè aó -*.TXÔ  oò *.*© arå selecteä foò displaù bù VMENÕ wheî iô  ió -invoked®  Bù  changinç thió entry¬  thå naturå oæ thå  filå -display can be changed dynamically. - -:E - - VMENU Error Messages - - Iî ordeò tï makå VMENÕ aó smalì aó possible¬  thå erroò -messageó havå beeî reduceä tï á minimum®  VMENÕ provideó  á -minimuí indicatioî thaô somethinç ió wronç anä aborts. - - Thå  prograí  VMENUCË  ió  designeä tï  telì  yoõ  morå -specificallù  whaô  ió wrong®  VMENUCË ió  á  *.VMΠ Syntaø -Checker¬ anä iô lookó foò alì sortó oæ erroò conditionó thaô -caî occuò iî á *.VMÎ file. - - VMENÕ provideó thå followinç minimaì erroò messages: - - - Message Meaning - - No Shell Stack Shell Stack Not Available - No Command Line Command Line Buffer Not Avail - Shell Stack Full Shell Stack is Full - Shell Stack Size Shell Stack Entries are too - short for VMENU cmd line - File x.typ Not - Found Menu File Not Found - TPA Full Memory is Full - User Command is in Error - Structure Error *.VMN File Structure Error - -:2 - -Command: VMENUCK 1.0 - -Syntax: - VMENUCK dir:ufn <-- default file type is VMN - -Function: - - VMENUCË ió useä tï checë thå syntaø oæ á *.VMÎ filå foò -thå  ZCPR³ Menõ Shell¬  VMENU®  VMENÕ ió optimizeä foò sizå -anä speed¬  and¬  iî deepinç iô small¬  built-iî diagnosticó -werå reduceä tï thå minimum® VMENUCË ió intendeä tï bå useä -tï  analyzå *.VMÎ fileó anä providå informativå  diagnosticó -oî anù syntacticaì erroró witè them. - -Options: - None - - -Comments: - - VMENUCË checkó tï seå iæ thå sizå oæ thå *.VMÎ filå  ió -toï largå foò thå TPÁ availablå tï thå VMENÕ command®  Thió -ió aî additionaì checë beyonä thå normaì syntaø check. - - VMENUCË  identifieó  thå  locatioî oæ  erroró  bù  linå -number® Thå firsô linå iî thå filå ió linå numbeò 1. - -Selected Error Messages: - - Self-Explanatory. - -Examples of Use: - - VMENUCK MYMENU - -- perform check on MYMENU.VMN - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/VMENU.MAC b/Source/Images/d_bp/u15/VMENU.MAC deleted file mode 100644 index fb91e70f..00000000 --- a/Source/Images/d_bp/u15/VMENU.MAC +++ /dev/null @@ -1,2655 +0,0 @@ -; PROGRAM: VMENU -; VERSION: 1.0 -; DATE: 26 June 84 -; AUTHOR: Richard Conn -; PREVIOUS VERSIONS: None -; -z3env equ 0f400h -VERS EQU 10 ;version number - -; VMENU is copyright (c) 1984 by Richard Conn -; All Rights Reserved -; VMENU may be used freely by the ZCPR3 Community - -; VMENU is a screen-oriented, ZCPR3-specific file utility. It can not be -; installed to run under conventional CP/M. VMENU -; extensively employs cursor addressing to position a pointer on the -; screen, allow the user to manipulate the pointer (up, down, right, left, -; next screen, previous screen, GOTO file). The pointer points to files -; in the current user directory and displays the user's position dynamically -; on the screen. Once pointing to a file, user commands can be used to -; manipulate the file according to options presented in the menu displayed to -; the user. MENU and VMENU are compatible. In the way of being ZCPR3- -; specific, VMENU can chain to external programs via the Command Line Buffer -; and then return, and it recognizes Named Directories (so the user can log -; into B:, B4:, and MYDIR:, for example). - -; VMENU is installed by Z3INS. - -; VMENU works with ZCPR3 only, with 32k or more of RAM. - -; VMENU can be assembled for use with a Z80 or 8080 microprocessor. - -; -; SYSLIB, Z3LIB, and VLIB References -; - ext z3vinit,cls,gotoxy,ereol,vprint,envptr,stndout,stndend - ext pafdc,dutdir - ext qshell,getefcb,shpush,shpop,getcrt,getfn2,zprsfn - ext putshm,getshm,getsh,getzrun,getcl1,putzex,putcst - ext cin,cout,caps,crlf,bline,sksp - ext f$open,f$read,f$close,initfcb - ext retud - ext codend - -; -; Basic Definitions -; -TRUE EQU 0FFH ;define true and.. -FALSE EQU 0 ;..false. -; -DIM EQU 1 ;GOTO DIM -BRIGHT EQU 2 ;GOTO BRIGHT -ELTSIZ EQU 11 ;size of file name and type element - -; -; User-Customized Definition -; -VMNAME MACRO ;;Name of VMENU - DB 'VMENU' - ENDM -VMNFILL MACRO ;;Spaces to fill out name to 8 chars - DB ' ' - ENDM -; -Z80 EQU TRUE ;TRUE to use Z80 Instructions -WARMBOOT EQU FALSE ;set TRUE to warmboot on exit -EPS EQU 4*4 ;N lines x 4 cols per screen - ; EPS = Entries Per Screen - -; -; Command Line Builder Constants -; -FPESC EQU '%' ;escape char -FPDISK EQU 'D' ;disk only (D) -FPUSER EQU 'U' ;user only (U) -FPFILE EQU 'F' ;filename.typ -FPNAME EQU 'N' ;file name only -FPTYPE EQU 'T' ;file type only -FPPTR EQU 'P' ;file entry being pointed to -MNOTE EQU '#' ;denotes comment area in macro file -UIN1 EQU 27H ;single quote for user input -UIN2 EQU 22H ;double quote for user input - -; -; Menu Constants -; - -; 1 Special Menu Command Chars -RNM EQU '>' ;NEXT MENU -RNMP EQU '.' ;NEXT MENU PRIME (ALTERNATE) -RLM EQU '<' ;LAST MENU -RLMP EQU ',' ;LAST MENU PRIME (ALTERNATE) -RFM EQU '*' ;FIRST MENU - -; 2 Internal Menu Control Chars -MCMD EQU ':' ;COMMAND TO JUMP TO ANOTHER MENU -PCHAR EQU '"' ;INDICATES AUTO PROMPT FOR SPECIFIC CMD -MINDIC EQU '#' ;MENU SECTION INDICATOR -MFIRST EQU '%' ;FIRST MENU INDICATOR -GOPTION EQU '-' ;GLOBAL OPTION INDICATOR -WOPTION EQU '!' ;ACTIVATES WAIT UPON RETURN - -; 3 Menu Option Chars -XOPTION EQU 'X' ;DISABLE ZCPR3 RETURN - -; 4 Miscellaneous -IBUFSZ EQU 254 ;SIZE OF INPUT LINE BUFFER -VARFLAG EQU '$' ;VARIABLE FLAG - ;(FOLLOWED BY D,U,Fn,Nn,Tn) -CMDSEP EQU ';' ;ZCPR3 COMMAND SEPARATOR - -; -; Cursor Positioning Addresses -; -EPSLINE EQU (EPS/4)+3 ;position of last line of EPS + 1 -BANADR EQU 1*256+24 ;banner address -CURHOME EQU 3*256+1 ;home address of cursor -BOTADR EQU 23*256+1 ;bottom of screen -CPMADR EQU 22*256+1 ;command prompt message -CPADR EQU CPMADR+27 ;command prompt address (cursor position) -ERADR EQU CPMADR+256+15 ;error message -FNADR EQU 1*256+62 ;address of current file name -MOREADR EQU FNADR+1*256 ;address of more files message -DUADR EQU 1*256+4 ;address of current DU - -; -; System Functions -; -RDCON EQU 1 -WRCON EQU 2 -PUNCH EQU 4 -LIST EQU 5 -DIRCON EQU 6 -RDBUF EQU 10 -CONST EQU 11 -LOGIN EQU 14 -OPEN EQU 15 -CLOSE EQU 16 -SRCHF EQU 17 -SRCHN EQU 18 -ERASE EQU 19 -READ EQU 20 -WRITE EQU 21 -MAKE EQU 22 -REN EQU 23 -INQDISK EQU 25 -SETDMA EQU 26 -INQALC EQU 27 -ATTR EQU 30 -GETPARM EQU 31 -SGUSER EQU 32 -COMPSZ EQU 35 - -; -; System Addresses -; -OS$BASE EQU 000H ;system base.. -CCP EQU 800H ;..and 'ccp' length in bytes. -GET EQU 0FFH ;get user area e-reg value -BDOS EQU OS$BASE+05H -FCB EQU OS$BASE+5CH -FCBEXT EQU FCB+12 -FCBRNO EQU FCB+32 -FCB2 EQU OS$BASE+6CH -TBUFF EQU OS$BASE+80H -TPA EQU OS$BASE+100H - -; -; ASCII Definitions -; -CTRLC EQU 'C'-'@' ;..control-C.. -CTRLD EQU 'D'-'@' -CTRLE EQU 'E'-'@' -CTRLR EQU 'R'-'@' -CTRLS EQU 'S'-'@' ;..XOFF.. -CTRLX EQU 'X'-'@' -BEL EQU 07H ;..bell.. -BS EQU 08H ;..backspace.. -TAB EQU 09H ;..tab.. -LF EQU 0AH ;..linefeed.. -FF EQU 0CH ;..formfeed.. -CR EQU 0DH ;..carriage return.. -CAN EQU 18H ;..cancel.. -EOFCHAR EQU 1AH ;..end-of-file.. -CTRLZ EQU 1AH ;..clear screen.. -ESC EQU 1BH ;..and escape character. - -; -; MACROS TO PROVIDE Z80 EXTENSIONS -; MACROS INCLUDE: -; -; BR - JUMP RELATIVE -; BRC - JUMP RELATIVE IF CARRY -; BRNC - JUMP RELATIVE IF NO CARRY -; BRZ - JUMP RELATIVE IF ZERO -; BRNZ - JUMP RELATIVE IF NO ZERO -; BJNZ - DECREMENT B AND JUMP RELATIVE IF NO ZERO -; -BR MACRO ?N ;;JUMP RELATIVE - IF Z80 - .z80 - jr ?N - .8080 - ELSE - jmp ?N - ENDIF - ENDM -; -BRC MACRO ?N ;;JUMP RELATIVE ON CARRY - IF Z80 - .z80 - jr c,?N - .8080 - ELSE - jc ?N - ENDIF - ENDM -; -BRNC MACRO ?N ;;JUMP RELATIVE ON NO CARRY - IF Z80 - .z80 - jr nc,?N - .8080 - ELSE - jnc ?N - ENDIF - ENDM -; -BRZ MACRO ?N ;;JUMP RELATIVE ON ZERO - IF Z80 - .z80 - jr z,?N - .8080 - ELSE - jz ?N - ENDIF - ENDM -; -BRNZ MACRO ?N ;;JUMP RELATIVE ON NO ZERO - IF Z80 - .z80 - jr nz,?N - .8080 - ELSE - jnz ?N - ENDIF - ENDM -; -BJNZ MACRO ?N ;;DECREMENT B AND JUMP RELATIVE ON NO ZERO - IF Z80 - .z80 - djnz ?N - .8080 - ELSE - dcr b - jnz ?N - ENDIF - ENDM -; -; END OF Z80 MACRO EXTENSIONS -; - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; Once Environment is Initialized, One of Three Major Functions -; will be Performed: -; 1. VMENU will be installed as a Shell if invoked explicitly -; by user command -; 2. The VMENU Function will be performed if VMENU is invoked -; by ZCPR3 as a Shell and ZEX is not Running -; 3. A Command Line will be Input by VMENU from ZEX and Passed -; on to ZCPR3 without Processing -; - call z3vinit ;initialize the ZCPR3 Env and the VLIB Env -; -; Set Opsys Stack Pointer -; - if not WARMBOOT - lxi h,0 ;clear hl-pair then.. - dad sp ;..add stack address. - shld stack - endif ;not warmboot - -; -; Check to see if VMENU was executed as a shell -; - call qshell ;get and test message from ZCPR3 - jz runsh ;execute shell procedures -; -; Initialize VMENU as a Shell -; - call shtest1 ;there must be a shell stack - call shtest2 ;there must be a command line buffer -; -; FUNCTION 1: Set Up VMENU as a Shell -; Run Shell Via Exit to Opsys -; - call getefcb ;determine name of program - brz shgo1 ;name not given, so use default - inx h ;pt to name - lxi d,filercmd ;define name of program - mvi b,8 - call moveb ;copy name -shgo1: - lxi h,filercmd ;establish shell - call shpush ;push onto shell stack - brnz shgo2 ;error? -; -; Establish File Selection -; 3rd System File = Name of Menu File (2nd token) -; 4th System File = Name of AFN to Select Files (1st token) -; - call getfn2 ;setup file name - lxi d,11 ;use 2nd system file - dad d - xchg ;destination in DE - lxi h,joker ;pt to joker - mvi b,11 ;copy joker into 2nd system file - call move ;... so selection is on joker - xchg ;HL now pts to 3rd system file - push h ;save ptr to name of Menu File - lxi d,fcb2+1 ;pt to FCB - xchg - mvi b,11 ;copy 11 chars - call move - push d ;save ptr to file spec - lxi h,fcb+1 ;pt to FCB (use 4th system file name) - mvi b,11 ;copy 11 chars - call move - pop d ;get ptr to file spec - lxi h,joker ;make wild if none - mvi b,11 ;11 chars - ldax d ;get first char - cpi ' ' ;wild if space - cz moveb ;copy - ldax d - cpi '/' ;wild if option - cz moveb - pop d ;get ptr to name of menu file - lxi h,menufile ;pt to menu file name (default) - ldax d ;check for no file name given - mvi b,11 ;11 chars - cpi ' ' ;if none, set default - cz moveb - lxi b,8 ;check file type - dad b - xchg - dad b - xchg - ldax d ;check for file type - mvi b,3 ;3 chars - cpi ' ' ;if none, set default - cz move -; -; Print Done Message -; -simsg: - mvi a,0 ;default to menu 0 - mvi b,1 ;shell message 1 contains menu number - call putshm -; - mvi b,0 ;shell message 0 - mvi a,0 ;no wait - call putshm ;set shell message -; - call vprint - db ' Shell Installed',0 -; - jmp os$ccp1 ;return to opsys -; -; Error in Shell Stack Installation -; -shgo2: - cpi 2 ;shell stack full - brnz shgo3 - call vprint - db ' Shell Stack Full',0 - ret -shgo3: - call vprint - db ' Shell Entry Size',0 - ret - -; -; VMENU was invoked as a Shell -; Check for ZEX Input in Progress -; -runsh: - call getzrun ;check ZEX message byte - jnz zexrun ;process ZEX command line if ZEX running -; -; Check for Delay Before Resuming VMENU and Delay if Set -; - mvi b,0 - call getshm ;get shell message 0 - ani 80h ;check MSB - cnz sak ;pause for input - mvi a,0 ;set normal command status - call putcst -; -; FUNCTION 2: Run VMENU and Perform Main Function -; - call setup ;init buffers and pointers - call stackset ;setup stack -; -; Begin VMENU Processing -; -runsh2: - call stackset ;reset stack - call fileload ;load files - call setscr ;set up screen display variables - call findcfile ;locate current file - call menuload ;load menu file -; -; Entry Point for Command Processing -; Display Screen and Input/Process Command -; -runsh3: - call stackset ;reset stack - call refresh ;refresh screen display -; -; Display Current File and Input/Process Command -; -loopfn: - call prcfn1 ;print current file name -; -; Input/Process Command -; -loop: - call stackset ;reset stack - call prompt ;get command from user - call cmdproc ;process command in A - call icmsg ;print invalid command msg - br loop ;continue -; -; Set Stack Pointer -; -stackset: - pop d ;get return address - lhld ibuf ;top of stack - sphl ;start local stack - push d ;return address on new stack - ret -; -; Check for Presence of Shell Stack -; -shtest1: - call getsh ;get shell stack data - rnz - pop psw ;clear stack - call vprint - db 'No Shell Stack',0 - ret - -; -; Check for Command Line -; -shtest2: - call getcl1 ;get command line data - rnz - pop psw ;clear stack - call vprint - db 'No Cmd Line',0 - ret - -; -; FUNCTION 3: Run ZEX on Top of VMENU -; Accept Command Line and Pass it to ZCPR3 -; -zexrun: - call vprint ;print prompt - db 'VMENU> ',0 - mvi a,1 ;tell ZEX that it is prompted - call putzex - call getcl1 ;pt to command line buffer - mov a,l ;set ptr to first char - adi 4 - mov c,a - mov a,h - aci 0 - mov b,a ;BC pts to first char - mov m,c ;store low - inx h - mov m,b ;store high - inx h ;pt to char count - xchg ;... in DE - mvi c,rdbuf ;input line via BDOS - push d ;save ptr - call bdos - pop h ;pt to char count - inx h - mov e,m ;get char count - inx h ;pt to first char - push h ;save ptr - mvi d,0 ;DE=char count - dad d - xra a ;A=0 - mov m,a ;store ending 0 - pop h ;pt to first char - call sksp ;skip to first non-blank character - mov a,m ;get it - cpi ';' ;comment line? - jz zexrun1 ;process comment line - call putzex ;resume ZEX (A=0) - call putcst ;set command status to normal (A=0) - ret ;return to opsys -zexrun1: - call crlf ;new line - jmp zexrun - -; -;************************************************** -; -; CRT Routine for VMENU -; -VCLS: - CALL CLS ;try to clear the screen - RNZ ;OK if done - PUSH H ;save regs - PUSH B - CALL GETCRT ;get CRT Data - INX H ;get number of lines on screen - MOV B,M ;B=number of lines -VCLS1: - CALL CRLF ;new line - BJNZ VCLS1 - POP B ;restore regs - POP H - RET -; -; EREOL Routine for VMENU -; -VEREOL: - CALL EREOL ;try to erase to EOL - RNZ ;OK if done - PUSH B ;save count - MVI A,' ' ;space out - CALL VEREOL1 ;send B spaces - POP B ;get count - MVI A,BS ;backspace in -VEREOL1: - CALL COUT ;send char - BJNZ VEREOL1 ;count down - RET -; -; Setup Screen Display Variables -; -SETSCR: - LXI H,CURHOME ;set cursor home - SHLD CURAT - LHLD RING ;set ring position - CALL SETMORE ;set more flag if more files on screen -; -; Entry to Reset Ring Position at HL -; -SETSCR1: - SHLD RINGPOS ;set current file to first file in ring -; -; Entry to Reset Local Ring Position at HL -; -SETSCR2: - SHLD LOCBEG ;front of ring - LXI D,EPS*ELTSIZ ;new end? - DAD D - XCHG - LHLD RINGEND ;end of ring - XCHG - CALL CMPDEHL - BRC SETSCR3 - XCHG -SETSCR3: - XCHG - SHLD LOCEND - RET - -; -; Set More Flag - Count Files on Screen and See if Display Exceeded -; -SETMORE: - PUSH H ;SAVE REGS - PUSH D - PUSH B - XRA A ;CLEAR FLAG - STA MORE - MVI B,EPS ;COUNT DOWN - LXI D,ELTSIZ ;SIZE OF ELEMENT -SETMORE1: - MOV A,M ;GET CHAR - ORA A ;DONE IF ZERO - JZ SETMDONE - DAD D ;PT TO NEXT - DCR B ;COUNT DOWN - JNZ SETMORE1 - MOV A,M ;GET CHAR - ORA A ;DONE IF ZERO - JZ SETMDONE - MVI A,0FFH ;SET FLAG - STA MORE -SETMDONE: - POP B ;RESTORE REGS - POP D - POP H - RET - -; -; Search for Current File starting at position in HL -; -FINDCFILE: - CALL GETFN2 ;get ptr to current file - LXI D,11 - DAD D ;... which is 2nd System File - XCHG ;... ptr in DE -; -; Next group of EPS files for file display -; -FINDCF1: - LXI H,CURHOME ;set cursor - SHLD CURAT - LHLD LOCBEG ;pt to first file in list - MVI B,EPS ;number of files in display -; -; Check current file -; -FINDCF2: - SHLD RINGPOS ;set position of current ring element -; -; Check for end of file ring -; - MOV A,M ;end of list? - ORA A ;done if so - BRZ FINDCF4 -; -; Compare candidate file against file in ring -; - PUSH H ;save ptr to file - PUSH D ;save ptr to System File - PUSH B ;save count - MVI B,ELTSIZ ;compare - CALL CMPSTR - POP B ;get count - POP D ;get ptr to System File - POP H ;get ptr to file - BRZ FINDCF5 ;we found it - BRC FINDCF5 ;we found following file -; -; Advance to next file in ring -; - PUSH B ;save count - LXI B,ELTSIZ ;pt to next element - DAD B -; -; Advance to next file on screen -; - PUSH H - LHLD CURAT ;get cursor position - MOV A,L - ADI 19 ;advance cursor - MOV L,A - CPI 70 - BRC FINDCF3 - MOV A,H ;get current line - LXI H,CURHOME ;get home row - MOV H,A ;set current line - INR H ;next line -FINDCF3: - SHLD CURAT ;set cursor - POP H - POP B ;get count -; -; Count down files in current display -; - BJNZ FINDCF2 ;count down - MOV A,M ;any following elements in ring? - ORA A ;0=no - BRZ FINDCF4 -; -; End of current display - set new display -; - SHLD LOCBEG ;new local beginning - BR FINDCF1 ;continue search -; -; File beyond end of file display - set pointers to first file -; -FINDCF4: - LXI H,CURHOME ;set cursor to first file - SHLD CURAT - LHLD RING ;pt to first file - SHLD RINGPOS - SHLD LOCBEG ;set local beginning -; -; Done - Set Local Ring -; -FINDCF5: - LHLD LOCBEG ;pt to local ring - JMP SETSCR2 - -; -; Display file name of current file -; Side Effect: Change Name of 2nd System File to Current File -; -PRCFN1: - LXI H,FNADR ;position cursor for file name print - CALL GOTOXY - CALL GETFN2 ;pt to system file name - LXI D,11 ;pt to 2nd System File Name - DAD D - XCHG ;... in DE - LHLD RINGPOS ;pt to current file name - MVI B,11 ;copy into 2nd System File Name - CALL MOVEB - JMP PRFN ;print file name -; -; Process Command -; -ICMSG: - CALL ERMSG - DB 'Invld Cmd: ',0 - MOV A,B ;get char - CPI ' ' ;expand if less than space - JNC COUT - MVI A,'^' ;control - CALL COUT - MOV A,B ;get byte - ADI '@' ;convert to letter - JMP COUT ;return for loop processing - -; -; SET UP BUFFERS -; -SETUP: - CALL RETUD ;get home DU - MOV A,B - STA H$DR ;home drive - MOV A,C - STA H$U$A ;home user area - CALL CODEND ;start of free space - LXI D,256 ;256 bytes/unit - DAD D - SHLD IBUF ;input line buffer and top of stack - MVI M,IBUFSZ ;number of bytes in line - DAD D - SHLD EXPLINE ;expansion line - DAD D - SHLD MENUFCB ;dummy FCB - DAD D ;next page - SHLD BUFFER ;free space to end of TPA - -; -; Begin Further Inits -; - LHLD ENVPTR ;pt to ZCPR3 Env Desc - LXI D,80H+10H ;pt to cursor commands - DAD D - LXI D,CTABLE ;pt to area - MVI B,4 ;4 commands -CURINIT: - MOV A,M ;get command - STAX D ;put it - INX H ;pt to next - INX D - INX D - INX D - BJNZ CURINIT -; - LHLD BUFFER ;base address - SHLD RING ;beginning of ring -; - XRA A ;clear error message flag - STA ERMFLG -; - RET - -; e x i t - -; return to ccp - -; -; Entry point for VMENU exit -; -OS$CCP: - CALL SHPOP ;clear shell stack -; -; Entry point for command line exec -; -OS$CCP1: - LXI D,TBUFF ;..tidy up.. - MVI C,SETDMA ;..before going home. - CALL BDOS - - IF WARMBOOT - JMP OS$BASE - ENDIF ;warmboot - - IF NOT WARMBOOT - LHLD STACK ;put pointer.. - SPHL ;..back to 'sp'. - RET ;return to ccp - ENDIF ;not warmboot - -; -; FLOAD loads the files into the buffer, setting up the ring -; Return with NZ if load OK, Z if no files loaded -; -FILELOAD: -; -; Set up file name from System File 4 -; Select all files if no entry in System File 4 -; - CALL GETFN2 ;pt to first system file name - LXI D,11*3 ;pt to 4th file name - DAD D - LXI D,JOKER ;setup Joker if none - XCHG - LDAX D ;any chars? - MVI B,11 ;11 bytes - CPI ' ' - CZ MOVEB - XCHG ;HL pts to system file name - LXI D,FCB+1 ;pt to FCB - MVI B,11 ;11 bytes - CALL MOVEB -; -; Build ring with filename positioned in default FCB area -; - LHLD RING ;pt to ring - MVI B,ELTSIZ ;set first element to 'noname' -FILEL1: - MVI M,1 ;store ^A's - INX H ;pt to next - BJNZ FILEL1 - SHLD RINGPOS ;set ring position - SHLD RINGEND ;set ring end in case this is the only one - MVI M,0 ;store ending 0 - MVI C,SETDMA ;initialize dma address.. - LXI D,TBUFF ;..to default buffer. - CALL BDOS - XRA A ;clear search 'fcb'.. - STA FCBEXT ;extent byte.. - STA FCBRNO ;..and record number. - LXI D,FCB ;default FCB for search - CMA - MVI C,SRCHF ;..of first occurrence. - CALL BDOS - INR A ; 0ffh --> 00h if no file found - RZ - -; put each found name in ring. a-reg --> offset into 'tbuf' name storage - -SETRING: - DCR A ;un-do 'inr' from above and below - ADD A ;times 32 --> position index - ADD A - ADD A - ADD A - ADD A - ADI TBUFF+1 ;add page offset and.. - MOV L,A ;..put address into.. - MVI H,0 ;..hl-pair. - XCHG - LHLD RINGPOS ;pointer to current load point in ring - XCHG - MVI B,ELTSIZ ;move name to ring - CALL MOVE - XCHG ;de-pair contains next load point address - SHLD RINGPOS ;store and search.. - MVI C,SRCHN ;..for next occurrence. - LXI D,FCB ;filename address field - CALL BDOS - INR A ;if all done, 0ffh --> 00h. - BRNZ SETRING ;if not, put next name into ring. -; -; All filenames in ring -- setup ring size and copy-buffer start point -; - LHLD RINGPOS ;next load point of ring is start of buffer - SHLD RINGEND ;set ring end.. - MVI M,0 ;store ending 0 -; -; Sort ring of filenames -; -SORT: - LHLD RING ;initialize 'i' sort variable and.. - SHLD RINGI - LXI D,ELTSIZ ;..also 'j' variable. - DAD D - SHLD RINGJ -; -; Main Sort Loop -; -SORTLP: - LHLD RINGJ ;compare names 'i & j' - XCHG - LHLD RINGI - PUSH H ;save position pointers.. - PUSH D ;..for potential swap. - -; sort by file name and type - MVI B,ELTSIZ ; # of characters to compare - CALL CMPSTR ;do comparison - -; final test for swapping purposes -NOCMP: - POP D - POP H - MVI B,ELTSIZ - BRNC NOSWAP -; -; Swap if 'j' string larger than 'i' -; -SWAP: - MOV C,M ;get character from one string.. - LDAX D ;..and one from other string. - MOV M,A ;second into first - MOV A,C ;first into second - STAX D - INX H ;bump swap pointers - INX D - BJNZ SWAP -NOSWAP: - LHLD RINGJ ;increment 'j' pointer - LXI D,ELTSIZ - DAD D - SHLD RINGJ - XCHG ;see if end of 'j' loop - LHLD RINGEND - CALL CMPDEHL - BRNZ SORTLP ;no, so more 'j' looping. - LHLD RINGI ;bump 'i' pointer - LXI D,ELTSIZ - DAD D - SHLD RINGI - DAD D ;set start over 'j' pointer - SHLD RINGJ - XCHG ;see if end of 'i' loop - LHLD RINGEND - CALL CMPDEHL - BRNZ SORTLP ;must be more 'i' loop to do - RET -; -; left to right compare of two strings (de-pair points to 'a' string; -; hl-pair, to 'b'; b-reg contains string length.) -; -CMPSTR: - LDAX D ;get an 'a' string character and.. - CMP M ;..check against 'b' string character. - RNZ ;if not equal, set flag. - INX H ;bump compare.. - INX D ;..pointers and.. - BJNZ CMPSTR ;..do next character. - RET - -; -; Process command from table -; -CTPROC: - MOV B,A ;command in B - LXI H,CTABLE ;pt to table - MOV A,M ;any cursor commands? - ORA A - JNZ CTPR1 - LXI H,CTAB1 -; -; Command table scanner -; HL = Table -; B = Command Letter -; -CTPR1: - MOV A,M ;get table command char - ORA A ;end of table? - RZ ;done if so - CMP B ;match? - BRZ CTPR2 - INX H ;skip to next entry - INX H - INX H - BR CTPR1 -CTPR2: - INX H ;pt to address - MOV A,M ;get low - INX H - MOV H,M ;get high - MOV L,A - XTHL ;address on stack - RET ;"jump" to routine - -; Command Table -CTABLE: - DB 0 ;user cursor positioning - DW UP - DB 0 - DW DOWN - DB 0 - DW FORWARD - DB 0 - DW REVERSE -CTAB1: - DB CTRLC ;if exit, then to opsys - DW OS$CCP - DB CTRLR ;screen refresh? - DW RUNSH3 - DB CTRLE ;system cursor positioning - DW UP - DB CTRLX - DW DOWN - DB CTRLD - DW FORWARD - DB CTRLS - DW REVERSE - DB CR ;nop - DW LOOP - DB '+' ;jump forward - DW JUMPF - DB '-' ;jump backward - DW JUMPB - DB ' ' ;go forward - DW FORWARD - DB BS ;back up? - DW REVERSE -; - DB 0 ;end of table - -; -; COMMAND: - (Previous Screen) -; -JUMPB: - LXI H,CURHOME ;set cursor home - SHLD CURAT - LHLD RING ;at front? - XCHG - LHLD LOCBEG - CALL CMPDEHL - BRZ JUMPBW ;back up and wrap around - SHLD LOCEND ;set new end - LXI D,-EPS*ELTSIZ ;back up - DAD D - SHLD LOCBEG ;new beginning - SHLD RINGPOS ;new position - JMP RUNSH3 -JUMPBW: - LHLD LOCBEG ;at first screen? - XCHG - LHLD RING ;pt to first element of ring - CALL CMPDEHL - BRZ JBW0 ;advance to end - LXI H,-EPS*ELTSIZ ;back up - DAD D ;first element of new local ring - BR JFW0 -JBW0: - LXI D,EPS*ELTSIZ ;pt to next screen - DAD D - XCHG - LHLD RINGEND - CALL CMPDEHL - XCHG - BRZ JBW1 - BRC JBW0 -JBW1: - LXI D,-EPS*ELTSIZ - DAD D ;pt to first element of new local ring - BR JFW0 -; -; COMMAND: + (Next Screen) -; -JUMPF: - LXI H,CURHOME ;set cursor to home - SHLD CURAT - LHLD LOCEND ;see if Local End <= Ring End - XCHG - LHLD RINGEND - CALL CMPDEHL - BRZ CMDLOOP - LHLD LOCEND ;new screen starting at LOCEND - BR JFW0 - -; -; Reset to Beginning of RING and Resume Command Looping -; -CMDLOOP: - CALL SETSCR ;reset all screen pointers -CMDLRET: - JMP RUNSH3 -; -; Reset RING Position to HL -; -JFW0: - CALL SETSCR1 ;reset RINGPOS on ... - BR CMDLRET -; -; Reset Local Ring to HL -; -JFW0A: - CALL SETSCR2 ;reset LOCBEG on ... - BR CMDLRET - -; -; COMMAND: ' ', Left-Arrow -; -FORWARD: - CALL CLRCUR ;clear cursor - CALL FOR0 ;position on screen and in ring - CALL SETCUR ;set cursor - JMP LOOPFN -; advance routine -FOR0: - LHLD RINGPOS ;at end of loop yet? - LXI D,ELTSIZ ;i.e., will we be at end of loop? - DAD D - XCHG - LHLD LOCEND - CALL CMPDEHL ;compare 'present' to 'end' - BRNZ FORW ;to next print position - CALL CUR$FIRST ;position cursor - LHLD LOCBEG ;set position pointer to beginning and.. - SHLD RINGPOS - RET -FORW: - LHLD RINGPOS ;advance in ring - LXI D,ELTSIZ - DAD D - SHLD RINGPOS ;new position - CALL CUR$NEXT ;position cursor - RET - -; -; COMMAND: BS, Right-Arrow -; -REVERSE: - CALL CLRCUR ;clear cursor - CALL REV0 ;position on screen and in ring - CALL SETCUR ;set cursor - JMP LOOPFN -; Back Up Routine -REV0: - LHLD LOCBEG - XCHG - LHLD RINGPOS ;see if at beginning of ring - CALL CMPDEHL - BRNZ REV1 ;skip position pointer reset if not.. - CALL CUR$LAST ;end of local ring - LHLD LOCEND ;set to end +1 to backup to end - LXI D,-ELTSIZ - DAD D - SHLD RINGPOS - RET -REV1: - CALL CUR$BACK ;back up 1 -REV2: - LHLD RINGPOS - LXI D,-ELTSIZ ;one ring position.. - DAD D ;..backwards. - SHLD RINGPOS - RET - -; -; COMMAND: Up-Arrow -; -UP: - CALL CLRCUR ;clear cursor - LHLD RINGPOS ;see if wrap around - LXI D,-ELTSIZ*4 ;4 entries - DAD D - XCHG - LHLD LOCBEG ;beginning of local screen - CALL CMPDEHL - BRC UP2 ;wrap around - MVI B,4 ;back up 4 entries -UP1: - PUSH B ;save count - CALL REV0 ;back up in ring and on screen (no print) - POP B ;get count - BJNZ UP1 - BR DOWN1A -UP2: - LHLD RINGPOS ;advance to beyond end - LXI D,ELTSIZ*4 - DAD D - XCHG - LHLD LOCEND ;compare to local end - XCHG - CALL CMPDEHL - BRZ DOWN1A ;at end, so too far - BRC DOWN1A ;beyond end, so back up - SHLD RINGPOS ;new ring position - LHLD CURAT ;advance cursor - INR H ;next line - SHLD CURAT - BR UP2 - -; -; COMMAND: Down-Arrow -; -DOWN: - CALL CLRCUR ;clear cursor - LHLD RINGPOS ;see if wrap around - LXI D,ELTSIZ*4 ;4 entries - DAD D - XCHG - LHLD LOCEND ;end of local screen - XCHG - CALL CMPDEHL - BRZ DOWN2 ;wrap around - BRC DOWN2 ;wrap around - MVI B,4 ;forward 4 entries -DOWN1: - PUSH B ;save count - CALL FOR0 ;advance in ring and on screen (no print) - POP B ;get count - BJNZ DOWN1 -DOWN1A: - CALL SETCUR ;set cursor - JMP LOOPFN -DOWN2: - LHLD CURAT ;preserve column - MOV B,L ;column number in B - LXI H,CURHOME ;home position - SHLD CURAT ;set new position - LHLD LOCBEG ;beginning of local ring - SHLD RINGPOS ;new ring position -DOWN3: - LHLD CURAT ;check for at top of column - MOV A,L ;get col - CMP B ;there? - BRZ DOWN1A - LHLD RINGPOS ;advance in ring - LXI D,ELTSIZ ;ELTSIZ bytes/entry - DAD D - SHLD RINGPOS - LHLD CURAT ;get cursor position - LXI D,19 ;advance 19 bytes/screen entry - DAD D - SHLD CURAT - BR DOWN3 - -; -;************************************************** -; -; WORKHORSE Routines -; -; conin routine (waits for response) -; -KEYIN: - CALL CIN ;get input - JMP CAPS ;capitalize - -; -; Fill buffer with 'spaces' with count in b-reg -; -FILL: - MVI M,' ' ;put in space character - INX H - BJNZ FILL ;no, branch. - RET -; -; Check for legal filename character -- return with carry set if illegal -; -CKLEGAL: - LDAX D ;get character from de-pair - INX D ;point at next character - CPI ' ' ;less than space? - RC ;return carry if unpermitted character - PUSH H - PUSH B - CPI '[' ;if greater than 'z', exit with.. - BRNC CKERR ;..carry set. - MVI B,CHR$TEND-CHR$TBL - LXI H,CHR$TBL -CHR$LP: - CMP M - BRZ CKERR - INX H - BJNZ CHR$LP - ORA A ;clear carry for good character - POP B - POP H - RET - -CKERR: - POP B - POP H - STC ;error exit with carry set - RET - -CHR$TBL: - DB ',',':',';','<','=','>' ;invalid character table -CHR$TEND: - DS 0 -; -; Print file name pted to by HL -; Advance HL 11 bytes -; -PRFN: - MOV A,M ;check for 'noname' - CPI 1 ;no name? - BRZ PRFN1 - MVI B,8 ;8 chars - CALL PRFNS1 - MVI A,'.' - CALL COUT - MVI B,3 ;file type and fall thru -PRFNS1: - MOV A,M ;get char - CALL COUT - INX H ;pt to next - BJNZ PRFNS1 - RET -PRFN1: - CALL VPRINT - DB ' No File' - DB ' ' - DB ' ',0 - MVI B,11 ;advance 11 chars -PRFN2: - INX H ;pt to next - BJNZ PRFN2 - RET - -; -; move subroutine -- move b-reg # of bytes from hl-pair to de-pair -; -MOVE: - MOV A,M ;get hl-pair referenced source byte - ANI 7FH ;strip attributes - STAX D ;put to de-pair referenced destination - INX H ;fix pointers for next search - INX D - BJNZ MOVE - RET - -MOVEB: - PUSH H ;SAVE HL, DE - PUSH D - CALL MOVE - POP D ;RESTORE DE, HL - POP H - RET -; -; Compare de-pair to hl-pair and set flags accordingly -; -CMPDEHL: - MOV A,D ;see if high bytes set flags - CMP H - RNZ ;return if not equal - MOV A,E - CMP L ;low bytes set flags instead - RET -; -; Shift hl-pair b-reg bits (-1) to right (divider routine) -; -SHIFTLP: - DCR B - RZ - MOV A,H - ORA A - RAR - MOV H,A - MOV A,L - RAR - MOV L,A - BR SHIFTLP - -; -;************************************************** -; -; MESSAGE Routines -; -; Print VMENU Banner -; -BANNER: - CALL VCLS ;clear screen - LXI H,BANADR - CALL GOTOXY - CALL VPRINT ;print banner - DB 'VMENU, Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0' - IF Z80 - DB ' ',DIM,'[Z80 Code]',BRIGHT - ELSE - DB ' ',DIM,'[8080 Code]',BRIGHT - ENDIF - DB 0 - RET -; -; Print DU:DIR and MORE Message -; -DIRMORE: - LXI H,DUADR ; POSITION CURSOR - CALL GOTOXY - CALL RETUD ; GET CURRENT DISK AND USER - MOV A,B ; PRINT DISK - ADI 'A' - CALL COUT - MOV A,C ; PRINT USER - CALL PAFDC ; FLOADING DECIMAL - MVI A,':' - CALL COUT - CALL DUTDIR ; GET DIR NAME - BRZ NODIR - MVI B,8 ; 8 CHARS IN NAME -PRNAME: - MOV A,M ; GET CHAR - CPI ' '+1 ; CHECK FOR DONE - BRC PRMORE - CALL COUT ; PRINT CHAR - INX H - BJNZ PRNAME - BR PRMORE -NODIR: - CALL VPRINT - DB 'Noname',0 -PRMORE: - LDA MORE ; CHECK FLAG - ORA A ; 0=NO MORE - RZ - LXI H,MOREADR - CALL GOTOXY ; POSITION CURSOR - CALL VPRINT - DB DIM,'[More Files]',BRIGHT,0 - RET - -; -; Home the Cursor -; -CUR$FIRST: - LXI H,CURHOME ; HOME ADDRESS - SHLD CURAT ; SET CURSOR POSITION - JMP GOTOXY -; -; Last File Position -; -CUR$LAST: - LHLD RINGPOS ; ADVANCE - SHLD LOCPOS ; SET LOCAL POSITION -CL0: - LXI D,ELTSIZ - DAD D - XCHG - LHLD LOCEND ; END OF LOCAL RING? - CALL CMPDEHL - RZ - XCHG ; NEW POSITION - SHLD LOCPOS - PUSH H ; SAVE POSITION - CALL CUR$NEXT ; ADVANCE CURSOR - POP H ; GET POSITION - BR CL0 -; -; Advance the Cursor -; -CUR$NEXT: - LHLD CURAT ; COMPUTE NEW POSITION - MOV A,L ; CHECK FOR NEW LINE - ADI 19 ; SIZE OF EACH ENTRY - CPI 70 - BRNC CN1 ; ADVANCE TO NEXT LINE - MOV L,A ; NEW POSITION - SHLD CURAT - JMP GOTOXY -CN1: - MOV A,H ; GET LINE - LXI H,CURHOME ; GET COL - MOV H,A ; SET LINE AND FALL GO TO CUR$DOWN - SHLD CURAT - BR CUR$DOWN -; -; Back Up the Cursor -; -CUR$BACK: - LXI H,CURHOME ; GET HOME - XCHG ; ... IN DE - LHLD CURAT - CALL CMPDEHL ; COMPARE - BRZ CUR$LAST ; GOTO END IF LAST - MOV A,L ; CHECK FOR FIRST COL - CMP E - BRZ CB1 - SUI 19 ; BACK UP ONE COL - MOV L,A - SHLD CURAT ; NEW POS - JMP GOTOXY -CB1: - MOV A,E ; GET HOME COL - ADI 19*3 ; GET LAST COL - MOV L,A - DCR H ; PREV LINE - SHLD CURAT - JMP GOTOXY -; -; Move Cursor Down One Line -; -CUR$DOWN: - LXI H,CURHOME ; GET HOME ADDRESS - MOV B,H ; LINE IN B - LHLD CURAT ; GET CURRENT ADDRESS - INR H ; MOVE DOWN - MOV A,H ; CHECK FOR TOO FAR - SUB B - CPI EPS/4 - BRNC CD1 - SHLD CURAT ; OK, SO SET POSITION - JMP GOTOXY -CD1: - MOV A,L ; GET COL - LXI H,CURHOME - MOV L,A - SHLD CURAT - JMP GOTOXY -; -; Refresh Screen -; -REFRESH: - LHLD CURAT ; SAVE CURSOR AND RING POSITIONS - SHLD SCURAT - LHLD RINGPOS - SHLD SRINGPOS - CALL BANNER ; PRINT BANNER - CALL DIRMORE ; PRINT CURRENT DIRECTORY AND MORE MESSAGE - CALL DISPFILES ; DISPLAY FILES - CALL DISPMENU ; DISPLAY MENU - LHLD SCURAT ; RESTORE CURSOR AND RING POSITIONS - SHLD CURAT - LHLD SRINGPOS - SHLD RINGPOS - CALL SETCUR ; RESTORE CURSOR ON SCREEN - call atcmd - call vprint - db DIM,'Command (CR=Menu',0 - lda cpmok ;OK to return to ZCPR3? - ora a ;0=No - cnz prmptc - lhld cstart ;pt to first char - mov a,m ;get it - ani 7FH ;mask - cpi MFIRST - cnz prmptf ;print previous menu prompt if not first menu - lda nmenfl ;next menu available? - ora a ;0=No - cnz prmptn ;print next menu prompt - call vprint - db ') - ',BRIGHT,0 - RET - -; -; Print ZCPR3 Return Prompt -; -prmptc: - call vprint - db ', ^C=Z3',0 - ret -; -; Print First/Last Menu Chars -; -prmptf: - call vprint - db ', ',RFM,'=1st Menu, ',RLM,'=Prev Menu',0 - ret -; -; Print next menu message -; -prmptn: - call vprint - db ', ',RNM,'=Next Menu',0 - ret - -; -; Refresh File Display -; -DISPFILES: - CALL CUR$FIRST ; POSITION CURSOR AT FIRST POSITION - LHLD LOCBEG ; PT TO FIRST FILE NAME - SHLD LOCPOS ; SAVE LOCAL POSITION -DSPF1: - LHLD LOCEND ; AT END? - XCHG - LHLD LOCPOS - CALL CMPDEHL - JZ CUR$FIRST ; POSITION AT FIRST ENTRY AND RETURN - MVI B,4 ; 4 SPACES - MVI A,' ' -DSPF2: - CALL COUT - BJNZ DSPF2 - CALL PRFN ; PRINT FILE NAME (HL IS ADVANCED) - SHLD LOCPOS - CALL CUR$NEXT ; ADVANCE CURSOR - BR DSPF1 -; -; Position Cursor at CURAT -; -SETCUR: - LHLD CURAT - CALL GOTOXY - CALL VPRINT - DB '-->',0 - RET -; -; Clear Cursor -; -CLRCUR: - LHLD CURAT - CALL GOTOXY - CALL VPRINT - DB ' ',0 - RET -; -; Working Message -; -WORKMSG: - CALL ERMSG - DB DIM,'Working ...',BRIGHT,0 - RET -; -; Error Message -; -ERMSG: - MVI A,0FFH ; SET ERROR MESSAGE FLAG - STA ERMFLG - LXI H,ERADR ; GET ADDRESS - CALL GOTOXY - JMP VPRINT -; -; Clear Error Message -; -ERCLR: - XRA A ; CLEAR FLAG - STA ERMFLG - LXI H,ERADR ; POSITION - CALL GOTOXY - PUSH B - MVI B,76-(ERADR MOD 255) - CALL VEREOL ; ERASE TO EOL - POP B - RET -; -; Position at Command Prompt and Clear It -; -ATCMD: - LXI H,CPMADR ; POSITION - CALL GOTOXY - PUSH B - MVI B,76-(CPMADR MOD 255) - CALL VEREOL ; CLEAR MESSAGE - POP B - LXI H,CPMADR ; REPOSITION - JMP GOTOXY -; -; Position at Bottom of Screen and Prompt for Continuation -; -BOTTOM: - LXI H,BOTADR ; POSITION - CALL GOTOXY -; -; Prompt for Continuation -; -SAK: - CALL VPRINT - DB DIM,'Strike Any Key -- ',BRIGHT,0 - JMP KEYIN - -; -; Open Menu File -; -menuload: - lhld menufcb ;pt to menu fcb - inx h - push h - call getfn2 ;copy FCB into MENU FCB - lxi d,11*2 ;pt to 3rd system file name - dad d - pop d ;DE pts to first char of MENU FCB file name - mvi b,11 ;11 bytes - call moveb - dcx d ;pt to fcb - call initfcb ;init fcb - call f$open ;open file - brz menu1 ;abort if no menu - call vprint - db CR,LF,' File ',0 - lhld menufcb ;pt to file name - inx h - call prfn - call vprint - db ' Not Found',0 - jmp os$ccp ;abort -; -; Load Menu File from disk -; -menu1: - call menustrt ;get address of buffer for menu load - xchg ;... in DE -; -; Load next block from Menu File -- DE pts to Load Address -; -mload: - lhld menufcb ;pt to FCB - xchg ;... in DE, HL = load address - call f$read ;read in next block - ora a ;error? - brnz mloaddn ;load done if error - lxi d,tbuff ;copy from TBUFF into memory pted to by HL - xchg ;HL is source, DE is dest - mvi b,128 ;128 bytes - call move - lhld bdos+1 ;get address of top of TPA - mov a,h ;set to bottom of ZCPR3 - sui 10 - cmp d ;about to overflow ZCPR3? - brnc mload ;continue if not - call vprint - db CR,LF,' TPA Full',0 - jmp os$ccp - -; -; Init Flags and Clear MSB of all bytes in Menu File -; -mloaddn: - call f$close ;close input file - mvi m,CTRLZ ;ensure EOF mark - xra a ;A=0 - sta cpmok ;turn off ZCPR3 return flag - call menustrt ;pt to first menu char - push h ;save ptr -menul1: - mov a,m ;get byte - ani 7FH ;mask out MSB - mov m,a ;put byte - inx h ;pt to next - cpi CTRLZ ;EOF? - brnz menul1 ;continue if not -; -; Mark all Menu Sections -; - pop h ;HL pts to first byte of menu - mvi b,0FFH ;set menu counter -; -; Skip to Next Menu -; -menul2: - mov a,m ;get byte - cpi CTRLZ ;error? - jz mstrerr ;structure error if so - cpi MINDIC ;menu indicator (start of menu?) - brnz menul4 - ori 80H ;beginning of menu found -- set MSB - mov m,a ;put byte - inr b ;increment menu count - inx h ;pt to next - mov a,m ;get byte - cpi MINDIC ;menu indicator (end of menu?) - brz menul5 ;done if so - cpi CTRLZ ;error? - jz mstrerr -; -; Skip out Menu Display -; -menul3: - call lskipt ;skip to beginning of next line - brz menul4 ;found menu indicator - cpi CTRLZ ;error? - jz mstrerr - br menul3 ;continue if not -; -; Skip to Next Menu -; -menul4: - call lskipt ;skip to beginning of next menu - brz menul2 ;resume if at beginning of next menu - cpi CTRLZ ;error? - jz mstrerr - br menul4 -; -; Check Menu Options -; -menul5: - call menustrt ;pt to first menu char - mov a,m ;check for option - cpi GOPTION ;global option char? - jnz mfile ;if no global option, scan for menu files - inx h ;pt to option char -option: - mov a,m ;get option char - call caps ;capitalize - inx h ;pt to next - cpi CR ;done? - brz optdn - cpi XOPTION ;exit OK? - jnz mstrerr ;option error if not -; -; Disable Exit to ZCPR3 -; - mvi a,0FFH ;turn flag off - sta cpmok - br option -; -; Option Processing Done -; -optdn: - inx h ;skip LF - -; -; Check for Menu Display -; -mfile: - mov a,m ;get first byte - ani 7FH ;mask - cpi MINDIC ;start of menu? - jnz mstrerr - -; -; Check and Set First Menu -; - shld mstart ;save start address of first menu item - mvi m,MFIRST+80H ;set first char of first menu - ret - -; -; Entry Point for Menu Display -; -dispmenu: - mvi h,epsline ;pt to first line of menu - mvi l,1 ;col 1 - call gotoxy ;position there - lhld mstart ;pt to first byte of current menu - mvi b,1 ;shell message 1 contains menu number - call getshm ;get menu number flag - cnz mchc0 ;skip to proper menu - shld cstart ;save start address of current menu - inx h ;pt to first char after menu indicator char -dispm1: - mov a,m ;get char - call caps ;capitalize - inx h ;pt to next - cpi CR ;end of options? - brz dispm2 - cpi XOPTION ;ZCPR3 return? - jnz mstrerr ;error if not -; -; Toggle ZCPR3 Return Option -; - lda cpmok ;get flag - cma ;toggle - sta cpmok - br dispm1 -; -; Done with Menu-Specific Option Processing -; -dispm2: - call lskip ;skip to LF - call getnlines ;get line count in A - sta pagcnt ;set count -; -; Print Next Line of Menu if not Starting with ESCAPE Char (MINDIC) -; -dispm3: - mov a,m ;get first char of line - ani 7FH ;mask - cpi MINDIC ;done? - brz dispm4 - call expand ;expand line pted to by HL - push h ;save ptr to next line - xchg ;HL pts to expanded line - call lprintx ;print line pted to by HL ending in - pop h ;pt to next line - br dispm3 -; -; Done with Menu Display -; -dispm4: - call lskip ;skip to first char of next line (option char) - shld optstrt ;set start address of options -; -; Determine if Another Menu Follows -; - xra a ;A=0 - sta nmenfl ;set for no next menu -dispm5: - mov a,m ;ok? - ani 7FH ;mask - cpi CTRLZ ;error if EOF - jz mstrerr - cpi MINDIC ;next menu? - brnz dispm6 - inx h ;double indicator if end - mov a,m - cpi MINDIC ;end? - rz - mvi a,0FFH ;set next menu - sta nmenfl - ret -dispm6: - call lskip ;skip to next line - br dispm5 - -; -; Ready for Option Input -; The following Flags/Values are now set: -; OPTSTRT -- Address of First Menu Option -; NMENFL -- 0 if no next menu, 0FFH if next menu -; CSTART -- Address of First Char of Current Menu -; MSTART -- Start Address of MINDIC Before Menu Display -; (MSTART)=MFIRST with MSB Set -prompt: - lxi h,cpadr ;position for input - call gotoxy - mvi a,0ffh - sta pagcnt ;turn off paging - call keyin ;get user input - PUSH PSW ;save command - LDA ERMFLG ;error message? - ORA A ;0=no - CNZ ERCLR ;erase old error message - POP PSW ;get command - ret - -; -; Process Command -; -cmdproc: - call ctproc ;process movement or exit command - -; -; Check for Command to Return to First Menu -; - lhld cstart ;pt to first char of menu - mov a,m ;get it - ani 7FH ;mask - cpi MFIRST - brz prmpt1 - mov a,b ;get command - cpi RFM ;return to first menu? - brnz prmpt1 - lhld mstart ;pt to first menu - mvi b,1 ;shell message 1 is menu number - xra a ;A=0=menu 0 - jmp putshm ;reenter shell at first menu - -; -; Check for Command to go to Next Menu -; -prmpt1: - lda nmenfl ;next menu available? - ora a ;0=No - brz prmpt2 - mov a,b ;get command - cpi RNMP ;goto next menu? - brz rnmx - cpi RNM ;goto next menu? - brnz prmpt2 -rnmx: - mvi b,1 ;shell message 1 is menu number - call getshm ;increment menu number - inr a - call putshm ;reenter menu system at new menu - jmp os$ccp1 -; -; Check for Command to go to Last Menu -; -prmpt2: - mov a,m ;get menu char - ani 7FH ;at first menu? - cpi MFIRST - brz prmpt3 ;skip if at first menu - mov a,b ;get command - cpi RLMP ;goto last menu? - brz lstmnu - cpi RLM ;goto last menu? - brnz prmpt3 -lstmnu: - mvi b,1 ;shell message 1 is menu number - call getshm ;decrement menu number - dcr a - call putshm ;reenter shell at last menu - jmp os$ccp1 -; -; This is where additional functions may be added -; -prmpt3: - -; -; Check for Option Letter -; - lhld optstrt ;pt to first option char -prmptx: - mov a,m ;get it - ani 7FH ;mask MSB - call caps ;capitalize - cpi MINDIC ;at next menu? - rz - cmp b ;match user selection? - brz prmptd - call lskip ;skip to next line - br prmptx - -; -; Process Option -; -prmptd: - mvi b,0 ;shell message 0, bit 7 = wait flag - call getshm - ani 7FH ;set no wait - call putshm - inx h ;pt to first letter of command - mov a,m ;get it - cpi MCMD ;invoke other menu? - jz mchcmd ;menu change command - cpi WOPTION ;turn on wait? - brnz prmptg - mvi b,0 ;shell message 0, bit 7 = wait flag - call getshm - ori 80h ;set wait flag - call putshm ;set shell message - inx h ;skip option char -prmptg: - call expand ;expand line, DE pts to result -; -; Run Command Pted to by DE -; -runcmnd: - call getcl1 ;get address of command buffer - mov b,h ;... in BC also - mov c,l - mvi a,4 ;HL=HL+4 for address of first char - add l - mov l,a - mov a,h - aci 0 - mov h,a - mov a,l ;store address - stax b - inx b - mov a,h - stax b -; -; Copy Command Line in DE into Buffer in HL -; -cmdcpy: - ldax d ;get command letter - call caps ;capitalize it - ora a ;done? - brz ccpyd - cpi CR ;done? - brz ccpyd - cpi PCHAR ;prompt? - brz ccpyp - mov m,a ;store it - inx h ;pt to next - inx d - br cmdcpy -ccpyd: - mvi m,0 ;store ending 0 - jmp os$ccp1 ;optionally display command -; -; Prompt User for Input and Accept It -; -ccpyp: - inx d ;pt to first char of prompt - call crlf ;new line -ccpyp1: - ldax d ;get char - cpi PCHAR ;end of prompt? - brz ccpyp2 - cpi CR ;new line? - brz ccpyp3 - call cout ;echo char - inx d ;pt to next char - br ccpyp1 ;continue looping -ccpyp2: - inx d ;pt to char after closing PCHAR -ccpyp3: - push d ;save ptr to next char - xchg ;DE pts to buffer - mvi a,0FFH ;capitalize input from user - lhld ibuf ;input line buffer - call bline ;get input from user - xchg ;HL pts to buffer, DE pts to user input -cmdlp: - ldax d ;get char from user - ora a ;end of input? - brz cmdlp1 ;store rest of line - mov m,a ;store char - inx h ;pt to next - inx d - br cmdlp -cmdlp1: - pop d ;DE pts to next char, HL pts to buffer - br cmdcpy ;resume copying - -; -; Menu Change Command -- Jump to Specified Menu -; -mchcmd: - inx h ;pt to menu number - call eval ;convert to decimal number in A - sta menuno ;save menu number - call mchc0 ;skip to desired menu to check for it - lda menuno ;get menu number - mvi b,1 ;menu number is shell message 1 - jmp putshm ;set message and reenter shell - -; -; Entry Point if MENU is Reinvoked -; -mchc0: - mov b,a ;menu number in B - inr b ;increment for following decrement - lhld mstart ;pt to start of menu -mchc1: - dcr b ;count down - rz ;done if found -mchc2: - call lskipt ;skip to next line - brnz mchc2 ;continue if not end of menu display - cpi CTRLZ ;EOF? - jz mstrerr -mchc3: - call lskipt ;skip to next line - brnz mchc3 ;continue if not at end of menu commands - cpi CTRLZ ;EOF? - jz mstrerr - inx h ;end of MENU.MNU? - mov a,m ;yes if double MINDIC - ani 7FH ;mask - cpi MINDIC - jz mstrerr ;error if so - dcx h ;pt to first char - br mchc1 ;continue - -; -; Print Line pted to by HL Ending in -; Decrement PAGCNT -; -lprintx: - call lprint ;print without - jmp crlf ;do -; -; Print Line Pted to by HL; Decrement PAGCNT -; -lprint: - lda pagcnt ;check for page overflow - ora a ;do nothing - brz lskip ;... except skip out line - mvi b,0 ;set tab counter -lprnt0: - mov a,m ;get char - inx h ;pt to next - ani 7FH ;mask MSB - cpi DIM ;goto standout mode? - brz lprnt3 - cpi BRIGHT ;end standout mode? - brz lprnt4 - cpi TAB ;tabulate? - brz lprnt2 - cpi CR ;done? - brz lprnt1 - call cout ;print - inr b ;incr tab counter - br lprnt0 -lprnt1: - inx h ;pt to first char of next line - lda pagcnt ;count down pages - dcr a - sta pagcnt - ret -lprnt2: - mvi a,' ' ;print - call cout - inr b ;incr tab counter - mov a,b ;done? - ani 7 ;every 8 - brnz lprnt2 - br lprnt0 -lprnt3: - call stndout ;enter standout mode - br lprnt0 -lprnt4: - call stndend ;end standout mode - br lprnt0 - -; -; Skip to Beginning of Next Line and Test First Char for Menu Indicator -; -lskipt: - call lskip ;skip - mov a,m ;get char - ani 7FH ;mask - cpi MINDIC ;test - ret - -; -; Skip to Beginning of Next Line -; -lskip: - mov a,m ;get char - ani 7FH ;mask out MSB - cpi CTRLZ ;EOF? - rz - inx h ;pt to next - cpi LF ;EOL? - brnz lskip - ret - -; -; Menu Structure Error -- FATAL -; This message is printed to indicate an error in the structure of -; the MENU.MNU file. -; -mstrerr: - call vprint - db CR,LF,' Structure Error',0 - jmp os$ccp - -; -; Expand Line Pted to by HL into Scratch Area -; Return with HL pting to next line, DE pting to current line -; -expand: - xchg - lxi h,noname ;init no name file - mvi m,1 ;set no entry - lhld expline ;pt to buffer - xchg -exp1: - mov a,m ;get next char - ani 7fh ;mask MSB - stax d ;store char - cpi CR ;end of line? - jz expx - inx h ;pt to next - inx d - cpi VARFLAG ;variable follows? - brnz exp1 -; -; Variable Identified - Process it -; - mov a,m ;get next char - inx h ;pt to next - cpi VARFLAG ;one variable char? - brz exp1 ;resume if double VARFLAG - dcx d ;pt to variable position - ani 7FH ;mask - call caps ;capitalize variable - cpi FPDISK ;current disk? - brz expdisk - cpi FPUSER ;current user? - brz expuser - cpi FPFILE ;filename.typ? - brz expfile - cpi FPNAME ;filename? - brz expname - cpi FPPTR ;file being pointed to? - brz exppfile - cpi FPTYPE ;filetype? - brz exptype - br exp1 ;resume expansion -; -; Expand Exit -; -expx: - inx h ;pt to line feed - mov a,m ;get it - cpi LF ;line feed? - brnz expx1 - inx h ;pt to char after line feed -expx1: - xchg ;DE pts to next line - lhld expline ;pt to expanded line - xchg ;HL pts to next line, DE pts to expanded line - ret - -; -; Expand Disk -; -expdisk: - call retud ;get disk in B - mov a,b ;get disk number (A=0) - adi 'A' ;convert to ASCII - stax d ;store letter - inx d ;pt to next - br exp1 ;resume expansion -; -; Expand User -; -expuser: - call retud ;get user in C - mov a,c ;get user number - mvi b,10 ;subtract 10's - mvi c,'0' ;set char -expu1: - sub b ;-10 - brc expu2 - inr c ;increment digit - br expu1 -expu2: - add b ;+10 - adi '0' ;convert 1's to ASCII - mov b,a ;B=1's - mov a,c ;get 10's - stax d ;store 10's - inx d - mov a,b ;get 1's - stax d ;store 1's - inx d ;pt to next - br exp1 ;resume -; -; Expand File -; -expfile: - call getfnum ;get file number - jz exp1 ;resume if error - push h ;save ptr to next char - call ptfn ;set ptr to file name - call putn ;put file name - mvi a,'.' - stax d ;store dot - inx d ;pt to next - call putt ;put file type - pop h ;restore ptr - jmp exp1 ;resume -; -; Expand Name -; -expname: - call getfnum ;get file number - jz exp1 ;resume if error - push h ;save ptr to next char - call ptfn ;set ptr to file name - call putn ;put file name - pop h ;restore ptr - jmp exp1 ;resume -; -; Expand Type -; -exptype: - call getfnum ;get file number - jz exp1 ;resume if error - push h ;save ptr to next char - call ptfn ;set ptr to file name - mvi a,8 ;add 8 - add l - mov l,a - mov a,h - aci 0 - mov h,a - call putt ;put file type - pop h - jmp exp1 ;resume -; -; Expand File at Pointer -; -exppfile: - mov a,m ;get option char - ani 7FH ;mask - call caps ;capitalize - cpi FPFILE ;filename.typ? - brz exppf - cpi FPNAME ;filename only? - brz exppn - cpi FPTYPE ;filetype only? - brz exppt - jmp exp1 ;abort if error -; -; Extract full filename.typ of file being pointed to -; -exppf: - inx h ;pt to next char - push h ;save ptr to next char - lhld ringpos ;set ring position - call cknoname ;check and substitute no file - call putn ;put name pted to by HL - mvi a,'.' ;store dot - stax d - inx d - call putt ;put type pted to by HL - pop h - jmp exp1 ;continue -; -; Expand file name of file being pointed to -; -exppn: - inx h ;pt to next char - push h ;save ptr to next char - lhld ringpos ;set ring position - call cknoname ;check and substitute no file - call putn ;put name - pop h - jmp exp1 -; -; Expand file type of file being pointed to -; -exppt: - inx h ;pt to next char - push h ;save ptr to next char - push d ;save DE - lhld ringpos ;pt to ring entry - call cknoname ;check and substitute no file - lxi d,8 ;pt to file type - dad d - pop d ;get DE - call putt ;put type - pop h - jmp exp1 -; -; Check to see if HL pts to 'noname' and, if so, substitute name -; -cknoname: - push d ;save DE - push b ;save BC - call ckno ;do check - pop b ;get BC - pop d ;restore DE - ret -ckno: - mov a,m ;get char - cpi 1 ;no name? - rnz - lxi h,noname ;pt to no name - mov a,m ;check for definition - cpi 1 ;no name? - rnz - xchg ;HL pts to file name - call ermsg - db 'File Name? ',0 - lhld ibuf ;pt to input buffer - mvi a,0ffh ;capitalize input - call bline ;get line from user - call sksp ;skip spaces - xchg - lhld menufcb ;pt to dummy FCB - xchg - call zprsfn ;parse file name into FCB - inx d ;pt to first char - lxi h,noname ;pt to name buffer - xchg - mvi b,11 ;copy into buffer - call moveb - ret ;HL pts to name -; -; Pt to File Name whose Number (1-4) is in A -; -ptfn: - mov b,a ;get number in B - call getfn2 ;pt to file name 2 - push d ;save DE - mov a,b ;file 0? - ora a - brz ptfnx - lxi d,11 ;size of file name and type -ptfn1: - dad d ;pt to next - bjnz ptfn1 -ptfnx: - pop d ;restore DE - ret -; -; Put File Name pted to by HL -; -putn: - mvi b,8 ;8 chars - br putc -; -; Put File Type pted to by HL -; -putt: - mvi b,3 ;3 chars -; -; Copy Chars from HL to DE for up to B bytes -- flush if space -; -putc: - mov a,m ;get next char - cpi ' ' ;skip spaces - brz putc1 - stax d ;put next char - inx d ;pt to next -putc1: - inx h ;pt to next - bjnz putc - ret - -; -; Get File Number (1 to 4) -; If valid number, return with value in A and HL pting to next char -; If not valid, return with Z and HL pting to last char (F, N, T) -; -getfnum: - mov a,m ;get char - sui '1' ;convert - brc getfne ;error - cpi 4 ;range? - brnc getfne - inx h ;pt to next char - ret ;NZ from CPI 4 -getfne: - dcx h ;error return - xra a - ret - -; -; Return Number of Lines on CRT in A -; -getnlines: - push h ;save HL - call getcrt ;get CRT info - inx h ;pt to number of lines - mov a,m ;get count - pop h ;restore HL - sui EPSLINE+1 ;subtract number of lines in file display - ; ... + 1 for footer - ret - -; -; Convert char string pted to by HL into decimal number in A -; On Entry, HL pts to first digit char -; On Exit, HL pts to after last digit char and A=number -; -eval: - push b ;save BC - mvi b,0 ;set value -eval1: - mov a,m ;get digit - sui '0' ;convert to binary - brc eval2 - cpi 10 ;range? - brnc eval2 - inx h ;pt to next digit - mov c,a ;new digit in C - mov a,b ;multiply B by 10 - add a ;*2 - add a ;*4 - add b ;*5 - add a ;*10 - add c ;add in new digit - mov b,a ;result in B - br eval1 -eval2: - mov a,b ;result in A - pop b ;restore ptr - ret - -; -; Compute Address of Buffer for Menu Load -; -menustrt: - lhld ringend ;get address of buffer for menu load - inr h ;next page - mvi l,0 - ret - -; -; S T O R A G E -; -; Initialized -; -FILERCMD: - VMNAME ;VMENU Name - VMNFILL ;Filler - DB ' ' ;one space - DB 0 ;end of shell command -JOKER: - DB '???????????' ;*.* equivalent -MENUFILE: - db 'MENU ' - db 'VMN' - -; -; Uninitialized -; -STACK: - DS 2 -BUFFER: - DS 2 ;buffer start -CURAT: - DS 2 ;current cursor position -ERMFLG: - DS 1 ;error message flag -EXPLINE: - DS 2 ;buffer to expand line in -H$DR: - DS 1 ;home drive -H$U$A: - DS 1 ;home user area (must follow H$DR) -IBUF: - DS 2 ;input line buffer -LOCBEG: - DS 2 ;local beginning of ring -LOCEND: - DS 2 ;local end of ring -LOCPOS: - DS 2 ;local ring position (temp) -MENUFCB: - DS 2 ;FCB for Menu File -NONAME: - DS 11 ;dummy user-defined file name -RING: - DS 2 ;ptr to beginning of ring -RINGI: - DS 2 ;ring sort pointer -RINGJ: - DS 2 ;another ring sort pointer -RINGEND: - DS 2 ;current ring end pointer -RINGPOS: - DS 2 ;current ring position in scan -SCURAT: - DS 2 ;save cursor position -SRINGPOS: - DS 2 ;save ring position -; -; Menu Buffers -; -more: - ds 1 ;More Files Flag -optstrt: - ds 2 ;Address of First Option in Current Menu -mstart: - ds 2 ;Address of First Menu -cstart: - ds 2 ;Address of Current Menu -nmenfl: - ds 1 ;Next Menu Available Flag (0=No) -menuno: - ds 1 ;Number of Menu -pagcnt: - ds 1 ;Paging Counter -cpmok: - ds 1 ;OK to Return to ZCPR3 (0=No) - - END - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/VMENU24.LBR b/Source/Images/d_bp/u15/VMENU24.LBR deleted file mode 100644 index fdab2f95..00000000 Binary files a/Source/Images/d_bp/u15/VMENU24.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/VMENUCK.COM b/Source/Images/d_bp/u15/VMENUCK.COM deleted file mode 100644 index 920b68e4..00000000 Binary files a/Source/Images/d_bp/u15/VMENUCK.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/VMENUCK.MAC b/Source/Images/d_bp/u15/VMENUCK.MAC deleted file mode 100644 index f16f591f..00000000 --- a/Source/Images/d_bp/u15/VMENUCK.MAC +++ /dev/null @@ -1,551 +0,0 @@ -; -; PROGRAM: VMENUCK -; AUTHOR: RICHARD CONN -; VERSION: 1.0 -; DATE: 22 July 84 -; PREVIOUS VERSIONS: None -; DERIVATION: MENUCK 1.0 (18 May 84) -; -VERS EQU 10 ;VERSION NUMBER -z3env SET 0f400h - -; -; VMENUCK is used to check the syntax of a MENU.VMN file for the ZCPR3 -; menu processor, VMENU. VMENU was optimized for size and runtime speed, and -; I tried to keep the size under 2K (and succeeded, for that matter). In -; keeping VMENU small, the error diagnostics it gives are quite limited, with -; a variety of errors producing the message "Str Err" for MENU.VMN -; structure error. -; -; VMENUCK is intended to be used to check the syntax and other features -; of a user's MENU.VMN before allowing VMENU to run with it. In this way, -; many errors may be caught before the MENU.VMN file comes into common use, -; and there is plenty of space for informative diagnostics. -; - -; -; MENU Constants -; -MCMD EQU ':' ;Menu Jump Command -MINDIC EQU '#' ;Menu Indic -GOPTION EQU '-' ;Global Option Indic -XOPTION EQU 'X' -VARFLAG EQU '$' ;Variable Flag - -; -; CP/M Constants -; -bentry equ 5 ;BDOS Entry -fcb equ 5ch ;FCB -tbuff equ 80h ;Temp I/O Buffer -cr equ 0dh -lf equ 0ah -EOF equ 'Z'-'@' ;^Z=EOF - -; -; Externals -; - ext z3init,zfname,z3log - - ext caps,crlf,eval10,retud - ext f$open,f$close,f$read - ext print,cout - ext moveb - ext phldc,padc,pfn2,pafdc - ext codend - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - - call print - db 'VMENUCK Version ' - db (vers/10)+'0','.',(vers mod 10)+'0',0 - - lda fcb+1 ;get first char - cpi ' ' ;no file name? - jz help - cpi '/' ;option? - jnz start1 -; -; Print Help Message -; -help: - call print - db cr,lf,'Syntax:' - db cr,lf,' VMENUCK dir:filename.typ <-- Check File' - db cr,lf,' VMENUCK dir:filename <-- Check filename.VMN' - db 0 - ret - -; -; Begin serious processing -- locate the file pted to by HL -; -start1: - lxi d,fcb ;pt to FCB - call z3log ;log into indicated FCB - -; -; Set File Type to MNU if not specified -; -start2: - lxi h,fcb+9 ;pt to file type - mov a,m ;get first char - cpi ' ' ;set type if - jnz start3 - push b ;save BC - lxi d,mnutyp ;set type to MNU - xchg - mvi b,3 ;3 bytes - call moveb - pop b ;get BC -; -; Try to Open the File -; -start3: - lxi d,fcb ;prepare to open file - xra a ;A=0 to select current disk - stax d - call f$open ;open file - jz readfile ;read in file if OK - call print - db cr,lf,' File Not Found',0 - ret -; -; Read in File -; -readfile: - call codend ;get address of first block -readloop: - lxi d,fcb ;read block - call f$read ;do it - ora a ;check for error - jnz readdone - lxi d,tbuff ;pt to block just read in - mvi b,128 ;128 bytes -readmove: - ldax d ;get byte - ani 7fh ;mask MSB - mov m,a ;put byte - inx h ;pt to next - inx d - dcr b ;count down - jnz readmove - xchg ;DE pts to next block - lhld bentry+1 ;get address of BDOS - mov a,h ;check for possible overflow - sui 10 ;10 pages below BDOS is limit - cmp d ;within range? - xchg ;HL pts to next block - jnc readloop ;continue read if within range - call print - db cr,lf,' TPA Overflow -- VMENU File is Too Big',0 - ret -; -; Read is Done -- Store Ending ^Z and Set Initial Values -; -readdone: - mvi m,EOF ;Store ^Z to ensure EOF - lxi d,fcb ;Close File - call f$close - mvi a,0ffh ;A = -1 - sta menunum ;set menu number - sta maxnum ;set max number of all menus - lxi h,0 ;HL=0 - shld errors ;Set Error Count to 0 - inx h ;HL=1 - shld linenum ;Set Line Number to 1 -; -; Count Number of Menus -; - call codend ;Pt to First Byte - mov a,m ;get first byte -; -; Skip to Beginning of Menu Display -; -mdskip: - cpi EOF ;EOF? - jz mdone - cpi MINDIC ;beginning of display? - jz mcgo ;now go skip commands - call lskip ;skip to next line - jmp mdskip -mcgo: - inx h ;pt to char after MINDIC - mov a,m ;another MINDIC? - cpi MINDIC - jz mdone ;done if 2 in a row - lda maxnum ;get menu number count - inr a ;found another one - sta maxnum -mcskip: - call lskip ;skip to next line - jz mdone ;done if premature EOF - cpi MINDIC ;end of display? - jnz mcskip - inx h ;pt to char after MINDIC - mov a,m ;get it - jmp mdskip -; -; Check for Valid First Character -; -mdone: - call print - db cr,lf,'VMenu Syntax Check on ',0 - call retud ;get dir - mov a,b ;get disk - adi 'A' - call cout - mov a,c ;get user - call pafdc - mvi a,':' - call cout - lxi d,fcb+1 ;pt to FCB - call pfn2 - call print ;Print Header - db cr,lf - db cr,lf,' Line Comment/Error Message' - db cr,lf,' ---- ---------------------',0 - - xra a ;set no global option - sta gopt - call codend ;get address of first byte - mov a,m ;get first char - cpi GOPTION ;global options? - jnz newmenu ;process globals - mvi a,0ffh ;set global option - sta gopt - call lprint - db '** Global Options Detected **',0 - call optchk ;check options - xra a ;set no global option - sta gopt - call nxtline ;advance to next line -; -; This is the main entry point for processing a menu -; -newmenu: - mov a,m ;get Menu Indicator - cpi MINDIC ;must be MINDIC - jz nm1 - call newerr ;add to error count - call lprint - db ' New Menu Expected, But ',MINDIC,' NOT Found -- ' - db 'Aborting',0 - jmp errxit -; -; Print that we have a new menu -; -nm1: - call lprint - db '** Menu Number ',0 - lda menunum ;increment menu number - inr a - sta menunum - call padc - call optchk ;check options -; -; Skip Thru Display -; -nm2: - call nxtline ;skip to next line - jnz nm2a ;continue if no EOF -earlyeof: - call newerr ;add to error count - call lprint - db ' Premature EOF Encountered',0 - jmp errxit -nm2a: - cpi MINDIC ;Menu Indicator? - jnz nm2 ;Continue -; -; Move Thru Menu Commands -; -nm3: - call mcmd1 ;check Menu Command Line - jz earlyeof - call lcheck ;check line - cpi MINDIC ;check for menu indicator - jnz nm3 ;continue until menu indicator encountered - inx h ;check for 2 indicators in a row for end - mov a,m ;get 2nd char - dcx h ;back up in case it is not - cpi MINDIC ;2 in a row? - jnz newmenu ;process as new menu if not -errxit: - call lprint - db '** End of Menu Check **',cr,lf,' ',0 - lhld errors ;check error count - mov a,h ;check for Zero - ora l - jnz err1 - call print - db 'No',0 - jmp err2 -err1: - call phldc ;print as decimal -err2: - call print - db ' Errors Detected',0 - ret - -; -; Utilities -; - -; -; LPRINT -- Print "Line # "+text -; -lprint: - call crlf ;new line - push h ;save HL - lhld linenum ;get line number - call phldc ;print as decimal - pop h ;restore HL - mvi a,' ' ;print - call cout - jmp print ;print text -; -; NXTLINE -- Advance to next line, check for EOF, and increment Line Number -; LSKIP -- Advance to next line and check for EOF -; Return with HL pting to first char of next line and Z Set if EOF -; -nxtline: - push h ;increment line count - lhld linenum ;add 1 - inx h - shld linenum - pop h ;fall thru to skipping -lskip: - mov a,m ;get char - cpi EOF ;EOF? - rz - inx h ;pt to next - cpi lf ;line feed? - jnz lskip ;continue if not - mov a,m ;get first char of next line - cpi EOF ;check for EOF - ret -; -; MCMD1 -- Check Menu Line, check for EOF, and increment Line Number -; Return with HL pting to first char of next line and Z Set if EOF -; -mcmd1: - mov a,m ;get char - cpi EOF ;EOF? - jz mcmdx - inx h ;pt to next - cpi VARFLAG ;variable? - jz mcmd2 - cpi lf ;line feed? - jnz mcmd1 ;continue if not -mcmdx: - push h ;increment line count - lhld linenum ;add 1 - inx h - shld linenum - pop h ;fall thru to skipping - mov a,m ;get first char of next line - cpi EOF ;check for EOF - ret -; -; Check Variable -; -mcmd2: - mov a,m ;get char - ani 7fh ;mask - call caps ;capitalize - inx h ;pt to next - cpi VARFLAG ;OK if double VARFLAG - jz mcmd1 - cpi 'D' ;OK if D - jz mcmd1 - cpi 'U' ;OK if U - jz mcmd1 - cpi 'F' ;filename.typ? - jz mcmd3 - cpi 'N' ;filename? - jz mcmd3 - cpi 'T' ;filetype? - jz mcmd3 - cpi 'P' ;pointed-to file? - jz mcmd6 -; -; Invalid Variable -; - dcx h ;pt to previous (bad char) - push psw ;save char - call lprint - db ' Variable Error (Not $, D, U, F, N, or T) - ',0 - pop psw ;get char - call cout ;print it - call newerr ;increment error count - jmp mcmd1 -; -; Digit from 1 to 4 should follow -; -mcmd3: - mov a,m ;get next char - inx h ;pt to next - ani 7fh ;mask and cap - call caps - cpi '1' ;must be from 1 to 4 - jc mcmd4 - cpi '5' - jc mcmd1 -; -; Invalid Digit -; -mcmd4: - push psw - call lprint - db ' Invalid Digit for F, N, or T Variable (not 1-4) - ',0 -mcmd5: - pop psw - dcx h ;pt to invalid char - call cout - call newerr ;increment error count - jmp mcmd1 - -; -; Check for Pointed to File -; -mcmd6: - mov a,m ;get next char - inx h ;pt to next - ani 7fh ;mask - call caps - cpi 'F' - jz mcmd1 - cpi 'N' - jz mcmd1 - cpi 'T' - jz mcmd1 - push psw ;save char - call lprint - db ' Invalid Pointed-to File Option (not F, N, or T) - ',0 - jmp mcmd5 ;process error and back up ptr - -; -; OPTCHK -- Check Line Pted to by HL for Valid GOPTION and MINDIC options -; Do Not Affect HL -; Print Error Message and Character if Invalid Option Found -; -optchk: - push h ;save HL - push b - inx h ;skip indicator -optclp: - mov a,m ;get char - call caps ;capitalize - inx h ;pt to next - cpi cr ;EOL? - jz optcdn - mov b,a ;char in B - cpi XOPTION ;only exit option allowed - jz optclp - call newerr ;increment error count - call lprint - db ' Invalid Option: ',0 - mov a,b ;get char - call cout ;print char - jmp optclp -optcdn: - pop b - pop h ;restore ptr - ret -; -; Increment Error Count -; -newerr: - push h ;save HL - lhld errors ;increment error count - inx h - shld errors - pop h ;restore HL - ret -; -; Check Line, especially looking for Menu Jump -; -lcheck: - push h ;save ptr to first char - inx h ;pt to 2nd char - mov a,m ;get it - cpi MCMD ;menu jump? - jnz lchk1 - inx h ;pt to menu number - call eval10 ;convert to binary in DE - mov a,d ;D must be 0 - ora a ;check - jz lchk0 -lchker: - call newerr ;increment error count - call lprint - db ' Menu Number Out of Range',0 - jmp lchk1 -lchk0: - lda maxnum ;get max menu number - cmp e ;check for range - jc lchker -lchk1: - pop h ;restore ptr - mov a,m ;get first char in line - ret -; -; Skip HL over Blanks -; -sblank: - mov a,m ;get char - inx h ;pt to next - cpi ' ' ;blank? - jz sblank ;continue skipping - dcx h ;pt to non-blank - ret - -; -; Buffers -; -mnutyp: - db 'VMN' -errors: - ds 2 ;error count -linenum: - ds 2 ;current line number -menunum: - ds 1 ;current menu number -maxnum: - ds 1 ;max menu number -gopt: - ds 1 ;global option flag - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/VMENUFUN.LBR b/Source/Images/d_bp/u15/VMENUFUN.LBR deleted file mode 100644 index 6e9bc62a..00000000 Binary files a/Source/Images/d_bp/u15/VMENUFUN.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/WHEEL.COM b/Source/Images/d_bp/u15/WHEEL.COM deleted file mode 100644 index 15a5c85c..00000000 Binary files a/Source/Images/d_bp/u15/WHEEL.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/WHEEL.MAC b/Source/Images/d_bp/u15/WHEEL.MAC deleted file mode 100644 index 63937ed8..00000000 --- a/Source/Images/d_bp/u15/WHEEL.MAC +++ /dev/null @@ -1,218 +0,0 @@ -; -; PROGRAM: WHEEL -; VERSION: 3.0 -; AUTHOR: RICHARD CONN -; DATE: 8 MAR 84 -; PREVIOUS VERSIONS: 1.1 (24 JAN 83), 1.0 (14 Jan 83) -; -vers equ 30 - -; -; WHEEL is used to set and clear the WHEEL byte. It is invoked by -; one of the following forms: -; -; WHEEL // <-- Print Help -; WHEEL <-- Print Wheel Status -; WHEEL password SET <-- Set Wheel Byte -; WHEEL password <-- Set Wheel Byte -; WHEEL password RESET <-- Reset (Clear) Wheel Byte -; WHEEL /S or WHEEL /R <-- Set or Reset Wheel Byte -; (Type Password Later Sans Echo) -; - -; -; CP/M Constants -; -cpm equ 0 -z3env SET 0f400h ; Environment Descriptor -bdose equ cpm+5 -pass equ cpm+5dh ; 1st FCB is password -cmnd equ cpm+6dh ; 2nd FCB is command -tbuff equ cpm+80h -ctrlz equ 'Z'-'@' -cr equ 0dh -lf equ 0ah - -; -; SYSLIB Routines -; - ext print,caps,codend,inline,z3init,getwhl,putwhl,qprint - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - jmp start0 -; -; ** Wheel Password ** -; - db ctrlz ;prevents reading via TYPE -ppass: - db 'SYSTEM ' ;Wheel Password (8 Chars) -; -; Print Banner -; -start0: - call qprint - db 'WHEEL, Version ' - db vers/10+'0','.',(vers mod 10)+'0',cr,lf,0 - -; -; Begin Processing -; - lda pass ; get password - cpi ' ' ; help? - jz pwhlstat - cpi '/' - jnz start1 - lda pass+1 ; get option - sta cmnd ; store command - cpi 'R' ; reset? - jz inpass - cpi 'S' ; Set? - jz inpass -; -; Print Help Message -; -help: - call print - db cr,lf,' WHEEL is used to Set and Reset (Clear) the Wheel' - db cr,lf,'Byte in order to enable (Wheel Byte is Set) or disable' - db cr,lf,'(Wheel Byte is Reset) certain commands within ZCPR2.' - db cr,lf - db cr,lf,'The forms of the WHEEL command are:' - db cr,lf,' WHEEL // <-- Print Help' - db cr,lf,' WHEEL <-- Print Wheel Byte Setting' - db cr,lf,' WHEEL password SET <-- Set Wheel Byte' - db cr,lf,' WHEEL password <-- Set Wheel Byte' - db cr,lf,' WHEEL password RESET <-- Reset (Clear) Wheel Byte' - db cr,lf,' WHEEL /S or WHEEL /R <-- Set or Reset Wheel Byte' - db cr,lf,' but allow user to type' - db ' in password' - db cr,lf,' without echo' - db cr,lf,0 - ret - -; -; Print Wheel Byte Setting -; -pwhlstat: - call print - db ' Wheel Byte is ',0 - call getwhl ;get wheel byte -pronoff: - ora a ;0=off - jz proff - call print - db 'ON',0 - ret -proff: - call print - db 'OFF',0 - ret - -; -; Input Password without echo and then process it -; -inpass: - call print - db ' Wheel Password? ',0 - call codend ; pt to scratch area - xra a ; no echo - call inline ; get line from user - push h ; save ptr to first char - mvi b,8 ; 8 chars -inp1: - mov a,m ; capitalize input - call caps - mov m,a - inx h ; pt to next - ora a ; done? - jz inp2 - dcr b ;count down - jnz inp1 - jmp inp4 -inp2: - dcx h ;pt to null - mvi a,' ' ;space fill -inp3: - mov m,a ;store space - inx h - dcr b - jnz inp3 -inp4: - pop h ; get ptr to first char - jmp start2 -; -; Process Password -; -start1: - lxi h,pass ; pt to user password -start2: - lxi d,ppass ; pt to WHEEL password - mvi b,8 ; 8 chars max -passlp: - ldax d ; get WHEEL password - cmp m ; match? - jnz nopass - inx h ; pt to next - inx d - dcr b ; count down - jnz passlp -; -; Password Approved -; - lda cmnd ; check command - cpi 'R' ; reset? - jz reset -; -; Set Wheel Byte -; - mvi a,0ffh ;set wheel byte - call putwhl - jmp pwhlstat ;print status -; -; Reset Wheel Byte -; -reset: - xra a ;reset wheel byte - call putwhl - jmp pwhlstat ;print status -; -; Password Not Approved -; -nopass: - call print - db cr,lf,' Invalid Password',0 - ret - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/WILDCAT.TXT b/Source/Images/d_bp/u15/WILDCAT.TXT deleted file mode 100644 index 2da9d87a..00000000 --- a/Source/Images/d_bp/u15/WILDCAT.TXT +++ /dev/null @@ -1,358 +0,0 @@ -ALIAS-1.LBR -ALIAS-2.LBR -ALIAS.COM -ALIAS.HLP -ALIAS.HQP -ALIAS.ZEX -ALIAS.ZQX -ALIAS0.MAC -ALIAS0.MQC -ALIAS1.MAC -ALIAS1.MQC -CD.COM -CD.MAC -CD.MQC -CLEAND15.LBR -CLEANDIR.COM -CLEANDIR.MAC -CLEANDIR.MQC -CLNDR13B.LBR -CMD.COM -CMD.MAC -CMD.MQC -CMDFILES.HLP -CMDFILES.HQP -CMDRUN.COM -CMDRUN.MAC -CMDRUN.MQC -COMMENT.COM -COMMENT.MAC -COMMENT.MQC -COMPARE.HLP -COMPARE.HQP -CPSEL.COM -CPSEL.MAC -CPSEL.MQC -CRC.COM -CRC.MAC -CRC.MQC -DBRCPREL.LBR -DEBUGRCP.AQM -DEBUGRCP.ASM -DEV.COM -DEV.MAC -DEV.MQC -DEV10.LBR -DEVICE.COM -DEVICE.MAC -DEVICE.MQC -DEVICE10.LBR -DIFF.COM -DIFF.MAC -DIFF.MQC -DIFF21.LBR -DIR.COM -DIR.MAC -DIR.MQC -DIR14.LBR -DIRS.HLP -DIRS.HQP -DPGFILE.LBR -DPROG.COM -DPROG.HLP -DPROG.HQP -DPROG.MAC -DPROG.MQC -DPROG12.LBR -DU3.COM -DU3.HLP -DU3.HQP -DU3.MAC -DU3.MQC -DU312.LBR -ECHO.COM -ECHO.MAC -ECHO.MQC -ERASE.COM -ERASE.MAC -ERASE.MQC -ERROR1.COM -ERROR1.MAC -ERROR1.MQC -ERROR2.COM -ERROR2.MAC -ERROR2.MQC -ERROR3.COM -ERROR3.MAC -ERROR3.MQC -ERROR4.COM -ERROR4.MAC -ERROR4.MQC -ERRORX.COM -ERRORX.MAC -ERRORX.MQC -FINDF.COM -FINDF.MAC -FINDF.MQC -FINDF26.LBR -FINDF26A.LBR -GOTO.COM -GOTO.MAC -GOTO.MQC -GRDEMO.LBR -HELP.COM -HELP.HLP -HELP.HQP -HELP.MAC -HELP.MQC -HELPCK.COM -HELPCK.MAC -HELPCK.MQC -HELPPR.COM -HELPPR.MAC -HELPPR.MQC -HELPSYS.HLP -HELPSYS.HQP -IF.COM -IF.HLP -IF.HQP -IF.MAC -IF.MQC -IFSTAT.COM -IFSTAT.MAC -IFSTAT.MQC -IO.HLP -IO.HQP -LDR-UPD.COM -LDR-UPD.MSG -LDR.COM -LDR.MAC -LDR.MQC -LDR15.LBR -LGET11.LBR -LLF11.LBR -LUZ3.LBR -LX12.LBR -LX14.LBR -MCOPY.COM -MCOPY.MAC -MCOPY.MQC -MCOPY44.LBR -MCOPY45B.LBR -MENU.COM -MENU.HLP -MENU.HQP -MENU.MAC -MENU.MQC -MENUCK.COM -MENUCK.MAC -MENUCK.MQC -MKDIR.COM -MKDIR.MAC -MKDIR.MQC -MU3.COM -MU3.HLP -MU3.HQP -MU3.MAC -MU3.MQC -NDIRS.HLP -NDIRS.HQP -NEWTCAP.Z80 -NEWTCAP.ZZ0 -NOTE.COM -NOTE.MAC -NOTE.MQC -PAGE.COM -PAGE.MAC -PAGE.MQC -PATH.COM -PATH.MAC -PATH.MQC -PATH31.LBR -PPAL.DOC -PRINT.COM -PRINT.MAC -PRINT.MQC -PRINTHLP.LBR -PROTECT.COM -PROTECT.MAC -PROTECT.MQC -PWD.COM -PWD.MAC -PWD.MQC -QUIET.COM -QUIET.MAC -QUIET.MQC -READ.ME -READ.MQ -RECORD.COM -RECORD.MAC -RECORD.MQC -REG.COM -REG.MAC -REG.MQC -RENAME.COM -RENAME.MAC -RENAME.MQC -RENAME31.LBR -SAK.COM -SAK.MAC -SAK.MQC -SETFILE.COM -SETFILE.MAC -SETFILE.MQC -SF.COM -SF.Z80 -SH.COM -SH.HLP -SH.HQP -SH.MAC -SH.MQC -SH11.LBR -SHCTRL.COM -SHCTRL.MAC -SHCTRL.MQC -SHDEFINE.COM -SHDEFINE.MAC -SHDEFINE.MQC -SHFILE.COM -SHFILE.MAC -SHFILE.MQC -SHOW.COM -SHOW.MAC -SHOW.MQC -SHSET.COM -SHSET.MAC -SHSET.MQC -SHUTILS2.LBR -SHVAR.COM -SHVAR.MAC -SHVAR.MQC -SHVAR11.LBR -SUB.COM -SUB.MAC -SUB.MQC -SYSENV.AQM -SYSENV.ASM -SYSENV.LIB -SYSENV.LQB -SYSFCP.AQM -SYSFCP.ASM -SYSFCP1.LIB -SYSFCP1.LQB -SYSFCP11.LBR -SYSFCP2.LIB -SYSFCP2.LQB -SYSIOP.AQM -SYSIOP.ASM -SYSNDR.AQM -SYSNDR.ASM -SYSNDR.LIB -SYSNDR.LQB -SYSRCP.AQM -SYSRCP.ASM -SYSRCP.HLP -SYSRCP.HQP -SYSRCP1.LIB -SYSRCP1.LQB -SYSRCP11.LBR -SYSRCP2.LIB -SYSRCP2.LQB -SYSRCP3.LIB -SYSRCP3.LQB -SYSRCP4.LIB -SYSRCP4.LQB -T3M-HI2.Z80 -T3M-HI2.ZZ0 -T3T-24-1.Z80 -T3T-24-1.ZQ0 -TCCHECK.COM -TCCHECK.MAC -TCCHECK.MQC -TCMAKE.COM -TCMAKE.MAC -TCMAKE.MQC -TCSELECT.COM -TCSELECT.MAC -TCSELECT.MQC -UNERASE.COM -UNERASE.MAC -UNERASE.MQC -VF-BOX11.LBR -VF41.IQF -VF41H.LBR -VF42A.LBR -VFILER.COM -VFILER.HLP -VFILER.HQP -VFILER.MAC -VFILER.MQC -VFILR4-1.LBR -VFILR4-2.LBR -VMENU.COM -VMENU.HLP -VMENU.HQP -VMENU.MAC -VMENU.MQC -VMENU24.LBR -VMENUCK.COM -VMENUCK.MAC -VMENUCK.MQC -VMENUFUN.LBR -WHEEL.COM -WHEEL.MAC -WHEEL.MQC -WYSE.DPG -XD.COM -XD.MAC -XD.MQC -XDIR.COM -XDIR.MAC -XDIR.MQC -Z3BASE1.LIB -Z3BASE1.LQB -Z3BASE2.LIB -Z3BASE2.LQB -Z3FILES.PH1 -Z3FILES.PH2 -Z3FILES.PQ2 -Z3FILES2.PH2 -Z3FILES2.PQ2 -Z3HDR1.LIB -Z3HDR1.LQB -Z3HDR2.LIB -Z3HDR2.LQB -Z3LDRBUG.LBR -Z3LOC.COM -Z3LOC.MAC -Z3LOC.MQC -Z3LOC11.LBR -Z3RES.HLP -Z3RES.HQP -Z3TCAP.AQM -Z3TCAP.ASM -Z3TCAP.HLP -Z3TCAP.HQP -Z3TCAP.TCP -Z3TCAP.TQP -Z3TCAP22.LBR -Z3UTIL1.HLP -Z3UTIL1.HQP -Z3UTIL2.HLP -Z3UTIL2.HQP -Z3UTIL3.HLP -Z3UTIL3.HQP -ZCPR3.AQM -ZCPR3.ASM -ZCPR3.HLP -ZCPR3.HQP -ZCPR3.INS -ZCPR3.IQS -ZCPR3DIR.BQG -ZCPR3DIR.BUG -ZEX.AQM -ZEX.ASM -ZEX.COM -ZEX.ZEX -ZEX.ZQX -ZSYSTEM.INS diff --git a/Source/Images/d_bp/u15/WYSE.DPG b/Source/Images/d_bp/u15/WYSE.DPG deleted file mode 100644 index 9db75516..00000000 --- a/Source/Images/d_bp/u15/WYSE.DPG +++ /dev/null @@ -1,133 +0,0 @@ -; -; Programming Definitions for Wyse WY-50 Terminal -; Revision 1.0 by John Lin, September 1, 1985 -; -; Character Definitions: -; --esc (%c) "\1bh" ; The ESCAPE Character --cr "\r" ; --del (%c) "\7fh" ; --ctrlp "^P" ; ^P -; -; -; Define Functions: -; -; A. Function Key: -; -; SEQUENCE: FKEY Fn|FnS SEQ DEL -; fkey - Prefix -; fn or fns - Function Key Number or Number Shifted -; seq - Contents of Function Key (8 Chars) -; del - Terminator -; --fkey esc "z" --f1 "@" --f1s "`" --f2 "A" --f2s "a" --f3 "B" --f3s "b" --f4 "C" --f4s "c" --f5 "D" --f5s "d" --f6 "E" --f6s "e" --f7 "F" --f7s "f" --f8 "G" --f8s "g" --f9 "H" --f9s "h" --f10 "I" --f10s "i" --f11 "J" --f11s "j" --f12 "K" --f12s "k" --f13 "L" --f13s "l" --f14 "M" --f14s "m" --f15 "N" --f15s "n" --f16 "O" --f16s "o" -; -; -; B. Cursor: -; -; 1. C_OFF No Cursor -; 2. C_ON Cursor On -; 3. C_BB Blinking Block -; 4. C_SB Steady Block -; 5. C_BU Blinking Underline -; 6. C_SU Steady Underline -; --c_off esc "`0" --c_on esc "`1" --c_bb esc "`5" --c_sb esc "`2" --c_bu esc "`3" --c_su esc "`4" -; -; -; C. Display User Line: -; -; 1. DISP_USER Display User Line -; 2. UNDSP_USER Turn Off User Line -; --disp_user esc "A14" --undsp_user esc "A10" -; -; -; D. Screen: -; -; 1. SCREEN_OFF Turn Screen Off -; 2. SCREEN_ON Turn Screen On -; --screen_off esc "`8" --screen_on esc "`9" -; -; -; E. Clear Screen: -; -; 1. CLS Clear the Screen -; --cls "^Z" -; -; F. Send Message to Host Msg Field: -; -; 1. HMF Send Msg to Host Message Field -; --hmf esc "F" -; -; -; -; Commands: -; -undsp_user -c_bb -fkey f1 "Dir A:\r" del -fkey f2 "Dir B:\r" del -fkey f3 "Dir E:\r" del -fkey f4 "Dir " del -; -fkey f5 "Type " del -fkey f6 "Era " del -fkey f7 "Ren " del -fkey f8 "Swp\r" del -; -fkey f9 "Multidsk\r" del -fkey f10 "Amprodsk\r" del -fkey f11 "Eset\r" del -fkey f12 "Du\r" del -; -fkey f13 "DDT " del -fkey f14 "Mac " del -fkey f15 "Zex " del -fkey f16 "Safety\r" del -; -cls -hmf "System Key Configuration Activated" cr -; diff --git a/Source/Images/d_bp/u15/XD.COM b/Source/Images/d_bp/u15/XD.COM deleted file mode 100644 index b0009ae5..00000000 Binary files a/Source/Images/d_bp/u15/XD.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/XD.MAC b/Source/Images/d_bp/u15/XD.MAC deleted file mode 100644 index 4ac66e24..00000000 --- a/Source/Images/d_bp/u15/XD.MAC +++ /dev/null @@ -1,856 +0,0 @@ -; -; PROGRAM: XD III -; AUTHOR: RICHARD CONN -; VERSION: 1.2 -; DATE: 8 Apr 84 -; PREVIOUS VERSIONS: 1.1 (14 Jan 84), 1.0 (19 Nov 83) -; DERIVATION: XDIR III, Version 1.6 (19 Nov 83) -; -vers equ 12 -z3env SET 0f400h - -; -; XD III -- Simple Extended Disk Directory Program -; ZCPR3 Only -; -; XD III produces a formatted, alphabetized listing of the contents -; of the disk directory of the implied (current logged-in) or specified disk. -; -; XD III is invoked by a command line of the following form -- -; -; XD dir:filename.typ ooo... -; or -; -; XD /oooo... -; -; where: -; dir is an optional directory name or a disk/user specification (du) -; if dir is omitted, XD III defaults to the current disk/user -; filename.typ is an ambiguous file name and type (* and ? may be used) -; o are option letters as follows: -; Aa - Set the attributes of the files to be displayed; -; a=S for System Files, a=N for Non-System Files -; a=A for All Files (System and Non-System) -; Oo - Set Output Parameters; -; o=A to Toggle File Attributes, o=F to Form Feed at end -; o=G to Toggle Grouping, o=H to Toggle Hor/Vert -; P - Print display as well as show it on the screen -; PF - Same as POF -; Options may be combined as desired; note that AA is the same as AS and AN, -; but AS by itself negates AN and vice-versa, with AN taking precident -; - - -; -; CP/M Equates -; -base equ 0 -wboot equ base -bdose equ base+5 -fcb equ base+5ch -buff equ base+80h -cr equ 0dh -ff equ 0ch -lf equ 0ah -esize equ 16 ; size of directory entries -optch equ '/' ; option char -maxent equ 60 ; maximum number of entries/screen - -; -; External Routines -; - ext bdos ; BDOS - ext z3init ; init ZCPR3 environment descriptor ptr - ext z3log ; log into ZCPR3 DU/DIR - ext dirqs ; quick directory load with sizes - ext dfree ; free space computer - ext dparam ; disk parameter extractor - ext fsize ; compute file size - ext retud ; get current user and disk - ext print ; print routines - ext pstr - ext lcrlf ; CRLF to printer - ext caps ; capitalize char - ext cin ; console in char - ext lout ; print char - ext cout ; console out char - ext crlf ; new line - ext fillb ; memory fill - ext moveb ; memory move - ext codend ; beginning of buffer area - ext sctlfl,sout,scrlf,sprint,spstr,shldc,sadc ; S-output - ext dutdir ; DU to DIR form - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env -; -; Branch to Start of Program -; - jmp start0 - -; -; Other Buffers (Set by GENINS) -; -igrp: db 0ffh ; Group by file type and name -ifmt: db 0 ; vertical format -iatt: db 10000000b ; Non-System files only -irs: db 0ffh ; enable attribute display (0=no) -iff: db 0 ; enable form feed at end (0=no) - -; -; Command Line Option Table -; -optab: - db 'A' ; Attribute Selection - dw opta - db 'O' ; Output Control - dw opto - db 'P' ; Print Control - dw optp - db 0 - -; -; **** Start of XD III **** -; -start0: - -; Save stack ptr for return later - lxi h,0 ; get stack - dad sp - shld stack ; save stack ptr for return - call codend ; determine free space (CODEND also pts to Command - ; Line Save Area) - lxi d,100h ; block size to save - dad d - dad d ; allow for 256-byte stack - shld buffer ; start of free buffer area - sphl ; set stack ptr - -; Save command line in CMDLNE buffer - call codend ; pt to command line buffer - xchg ; ... in DE - lxi h,buff+1 ; copy input line into command line buffer -start1: - mov a,m ; get byte - stax d ; put byte - inx h ; pt to next - inx d - ora a ; end of line? - jnz start1 - -; log into DU or DIR - lxi d,fcb ; extract file name into fcb, and get user and disk - call z3log ; ZCPR3 command line interpretation - -; Get and save current user number -noext: - call retud ; get current user and disk - mov a,c ; get user into A - sta aflg ; current user number - -; Set flag values - lda irs ; get RS display option - sta rsflg ; set RS display option - lda iff ; get form feed option - sta ffflg ; set form feed option - lda igrp ; set grouping (file name/type or type/name) - sta gflg - lda ifmt ; set listing format (vertical or horizontal, 0=vert) - sta hflg - lda iatt ; set file attributes - mov c,a ; save in c - lda aflg ; get current user number - ora c ; mask in file attributes - sta aflg ; save flag - xra a ; A=0 - sta pflg ; set no printer output - inr a ; A=1 for console only - sta sctlfl ; set switched output flag - -; Assume wild file name - lxi h,fcb+1 ; store '?' chars - mvi b,11 ; 11 chars - mov a,m ; check for entry specified - cpi ' ' ; test for space (means no entry) - mvi a,'?' ; prep for '?' fill - cz fillb - mov a,m ; check for option caught - cpi optch ; test for option flag - mvi a,'?' ; prep for '?' fill - cz fillb - -; Scan command line for options - call codend ; pt to first char - call sblank ; skip over blanks - ora a ; end of line? - jz xdir ; begin main processing - inx h ; prep for invalid option - cpi optch ; option? - jz opt ; process options - dcx h ; ok to process for dir:filename.typ form -; -; Skip over characters of file name -; -skipo1: - mov a,m ; get char - inx h ; pt to next - cpi ' ' - jz skipo2 - ora a - jnz skipo1 - jmp xdir ; run XDIR if no options follow -; -; Scan complete -- look for possible following option char -; -skipo2: - call sblank ; skip over blanks - mov a,m ; option char follows? - cpi optch - jnz opt - inx h ; skip over option char -; -; Look for options -- main loop; HL pts to next char -; -opt: - mov a,m ; get option char - inx h ; pt to next - ora a ; end of line? - jz xdir ; begin main processing - cpi ' ' ; skip over spaces - jz opt - cpi optch ; option char? - jz opterr ; loop back if so - lxi d,optab ; pt to option table - mov b,a ; option char in b -; -; Scan option table -; -opt1: - ldax d ; get option table char - ora a ; end of table? - jz opterr ; invalid option error - cmp b ; compare to passed option - jz opt2 ; process if match - inx d ; skip address - inx d - inx d ; pt to next opt char - jmp opt1 -; -; Process option found -; -opt2: - inx d ; pt to low-order address - ldax d ; get it - mov c,a ; low in C - inx d ; pt to high-order address - ldax d ; get it - mov b,a ; high in B - push b ; BC on stack - ret ; Process option routine -; -; Option A -- File Attributes -; -opta: - mov a,m ; get next option letter - cpi 'N' ; Non-System files? - jz optan - cpi 'S' ; System files? - jz optas - cpi 'A' ; All files? - jnz opterr ; error if not -; -; Option AA -- All Files -; -optaa: - mvi c,11000000b ; System and Non-system -optaret: - lda aflg ; get flag - ani 3fh ; leave in user selection - ora c ; mask in sys/non-sys - sta aflg ; restore flag - inx h ; pt to next - jmp opt -; -; Option AS -- System Files -; -optas: - mvi c,01000000b ; System Only - jmp optaret -; -; Option AN -- Non-System Files -; -optan: - mvi c,10000000b ; Non-system Only - jmp optaret -; -; Option P -- enable it; Printer output -; -optp: - mvi a,0ffh ; ON - sta pflg - sta sctlfl ; set S-output control - mov a,m ; get possible 2nd letter - cpi 'F' ; set form feed if F - jnz opt ; process as next option letter if not F - inx h ; pt to next - jmp optof -; -; Option O -- control Output parameters -; -opto: - mov a,m ; get 2nd letter - inx h ; pt to next - cpi 'A' ; attributes? - jz optoa - cpi 'F' ; form feed? - jz optof - cpi 'G' ; grouping? - jz optog - cpi 'H' ; horizontal/vertical? - jz optoh - dcx h ; adjust back - jmp opterr -; -; Toggle File Attributes Flag -; -optoa: - lda rsflg ; flip flag - cma - sta rsflg - jmp opt -; -; Toggle Form Feed Flag -; -optof: - lda ffflg ; flip flag - cma - sta ffflg - jmp opt -; -; Toggle Grouping -; -optog: - lda gflg ; flip flag - cma - sta gflg ; 0=file name and type - jmp opt -; -; Toggle Horizontal/Vertical Listing -; -optoh: - lda hflg ; flip flag - cma - sta hflg ; 0=vertical - jmp opt -; -; Option error message -; -opterr: - mvi a,1 ; set console only - sta sctlfl ; set output control flag - call banner ; print banner - call print - db cr,lf,'Syntax:' - db cr,lf,' XD dir:filename.typ ooo...' - db cr,lf,'or XD /oooo...' - db cr,lf,'Option letters are:' - db cr,lf,' Aa - Set and Display of file attributes' - db cr,lf,' a=S for System, a=N for Non-System' - db cr,lf,' a=A for All Files (System and Non-System)' - db cr,lf,' Oo - Toggle Output Control Options' - db cr,lf,' o=A for File Attributes, o=F for Form Feed' - db cr,lf,' o=G for Grouping, o=H for Horiz/Vert Format' - db cr,lf,' P - Send display to printer' - db cr,lf,' PF - Same as POF' - db 0 - -; Return to CP/M -return: - lhld stack ; get old stack ptr - sphl - ret ; return to CP/M - -; Memory Overflow Error -memerr: - call sprint - db 'TPA Error',0 - jmp return - -; Print banner of XD III -banner: - call sprint - db 'XD III Version ' - db vers/10+'0','.',(vers mod 10)+'0',0 - ret - -; -; Begin XD III processing -; -xdir: - lxi d,fcb ; pt to FCB - xra a - stax d ; select current disk - -; Check for Print Option and Print New Line if so -xdirst: - lda pflg ; printer output? - ora a ; 0ffH=yes - cnz lcrlf ; new line - -; Get Files from Disk - push d ; save ptr to FCB - call dparam ; get disk parameters for DFREE - call dfree ; compute amount of free space on disk - xchg ; amount in hl - shld freesiz ; save free space count - pop d ; get regs - lhld buffer ; pt to free space - lda gflg ; get grouping flag - ani 20h ; mask for sort bit (0=name/type) - mov c,a - lda aflg ; get attributes flag - ora c ; mask in grouping bit - call dirqs ; quick directory load with file sizes - jz memerr ; memory overflow error? - shld firstf ; save ptr to first file - mov h,b ; HL=file count - mov l,c - shld fcount ; save file count - shld countf ; save file down count - lxi h,0 ; set file size counter - shld totsiz ; save counter - lda pflg ; set temp flag - sta pflgt - -; -; Main Directory Print Routine -- This routine displays the directory to -; the console, printer, or disk as desired -; -; Print header lines and one screen of entries -xdir2: - lda pflg ; save printer output flag - sta pflgs - lda pflgt ; use temp flag - sta pflg - xra a ; A=0 - sta pflgt ; clear temp flag - -; Print: Main Banner - call banner ; print banner - -; Check for any files - lhld countf ; get file down count - mov a,h ; any files? - ora l - jnz xdir6 - call sprint ; print everywhere - db cr,lf,'No files selected',0 - jmp xdir10 - -; -; This is the main looping entry point for each screen display -; -xdir6: -; -; This is the header which is printed if the files in only one user area are -; displayed -; - call scrlf ; specific user selected - call hdr2 - lda rsflg - ora a ; Z=no - cnz sp0 - call sp2 - call hdr2 - lda rsflg - ora a ; Z=no - cnz sp0 - call sp2 - call hdr2 - lda rsflg - ora a - cnz sp0 - call scrlf - call hdr1 - lda rsflg - ora a - cnz sp1 - call sp2 - call hdr1 - lda rsflg - ora a - cnz sp1 - call sp2 - call hdr1 - lda rsflg - ora a - cnz sp1 - jmp xdir6b -sp0: - call sprint - db ' RS',0 - ret -sp1: - call sprint - db ' --',0 - ret -sp2: - call sprint - db ' ',0 - ret -hdr1: - call sprint - db '-------- --- ------',0 - ret -hdr2: - call sprint - db 'Filename.Typ Size K',0 - ret - -; -; Prepare Columnar Output -; -xdir6b: - lda pflgs ; restore print flag - sta pflg - lhld countf ; get file count down - lxi d,maxent ; assume maxent entries to print - mov a,h ; within range? - ora a ; outside of range if not - jnz xdir7 ; subtract entries to print from total entries - mov a,l ; within range? - cpi maxent ; less than maxent entries left? - jnc xdir7 ; subtract entries to print from total entries - mov d,h ; DE=HL=number of entries to print - mov e,l -xdir7: - mov a,l ; subtract entries to print (DE) from total (HL) - sub e - mov l,a - mov a,h - sbb d - mov h,a ; HL=result - shld countf ; save new down count - mov b,h ; BC=count - mov c,l - lhld firstf ; pt to first file -; -; At this point, BC=number of remaining entries, DE=number of entries to -; print, and HL pts to first entry to print -; - shld ptr1 ; save ptr to 1st entry - lda hflg ; horizontal listing? - ora a ; 0ffh = yes - jnz xdir7c ; don't worry about columns if horizontal - push d ; save count - call divde3 ; divide DE by 3, result*esize in BC, remainder in A - lxi d,esize ; DE=ESIZE (size of entry) - dad b ; add BC as a minimum - ora a ; any remainder? - jz xdir7a ; skip if none - dad d ; add in ESIZE for additional length of 1st col -xdir7a: - shld ptr2 ; save ptr to col 2 - dad b ; add BC as a minimum - cpi 2 ; if remainder 2, add ESIZE for additional - jc xdir7b - dad d ; add in ESIZE -xdir7b: - shld ptr3 ; save ptr to col 3 - pop d ; get count in de -; -; Main entry print routine -; -xdir7c: - mvi d,1 ; set 3's counter -xdir8: - lhld ptr1 ; pt to first entry - call prentry ; print entry - shld ptr1 ; put ptr - lda hflg ; horizontal? - ora a ; 0ffh = yes - jnz xdir9 - dcr e ; count down - jz xdir10 - lhld ptr2 ; get ptr - call prentsp ; print entry with 2 leading spaces - shld ptr2 ; put ptr - dcr e ; count down - jz xdir10 - lhld ptr3 ; get ptr - call prentsp ; print entry with 2 leading spaces - shld ptr3 ; put ptr -xdir9: - dcr e ; count down - jnz xdir8 ; continue if not zero - shld firstf ; save ptr to first of next set of entries to print - lhld countf ; get count of remaining entries -; -; At this point, HL=number of entries left -; - mov a,h ; anything left? - ora l - jz xdir10 - lda pflg ; printer output? - ora a ; 0=no - jnz xdir6 - call print ; screen break - db cr,lf,' --> Screen Break -- Strike any char <-- ',0 - call cin ; get response - cpi 3 ; abort? - jz return - jmp xdir6 ; new screen display -; -; Print end statistics and exit -; -xdir10: -; -; Print DU -; - call sprint ; print everywhere - db cr,lf,' ',0 - call retud ; get current disk - mov a,b ; ... in A - adi 'A' ; convert to ASCII - call sout ; print everywhere - mov a,c ; user in A - call sadc ; get number - call sprint - db ': ',0 - call dutdir ; convert to DIR form - jz xdir11 -; -; Print DIR Name -; - mvi b,8 ; output name -dirout: - mov a,m ; get char - cpi ' ' ; don't print spaces - cnz sout - inx h ; pt to next - dcr b ; count down - jnz dirout - -; -; Print Selected File Statistics -; -xdir11: - call sprint - db ' --',0 - lhld fcount ; print file count - call shldc ; print it everywhere - call sprint - db ' Files Using ',0 - lhld totsiz ; get total of file sizes - call shldc ; print it everywhere - call sprint - db 'K',0 - -; -; Print Space Remaining on Disk -; Entry Point if No Files Found -; - call sprint - db ' (',0 - lhld freesiz ; get amount of free space - call shldc ; print it everywhere - call sprint - db 'K Left)',0 - lda pflg ; new line if printer output - ora a - jz return - call scrlf ; new line for printer - lda pflg ; print output - mov b,a - lda ffflg ; form feed - ana b ; if print and form feed ... NZ is set - mvi a,ff ; form feed char - cnz lout ; form feed to printer - jmp return - -; -; General Utility Routines -; - -; -; Print disk entry for normal directory display functions -; -prentsp: - call sp2 ; print entry with 2 leading spaces -prentry: - dcr d ; count counter - jnz prent1 - mvi d,3 ; reset count - call scrlf -prent1: - shld entptr ; save entry ptr - inx h ; pt to first char of file name - mvi b,8 ; print 8 chars - call prch - mvi a,'.' ; print dot - call sout - push h ; save RS ptr - mvi b,3 ; print 3 chars - call prch - push d ; save de - lhld entptr ; pt to entry - call sp2 ; skip 2 spaces - call fsize ; compute file size - lhld totsiz ; get total file size counter - dad d ; add in new file - shld totsiz ; save new total file size counter - xchg ; get file size into HL - call shldc ; print HL value - pop d ; get de - pop h ; pt to RS - lda rsflg ; print RS fields? - ora a ; Z=no - jz pren2a - mvi a,' ' ; print 1 space - call sout - mvi b,'R' ; letter - call prletx ; print R if bit set - inx h - mvi b,'S' ; letter - call prletx ; print S if bit set - dcx h ; ... for following inx h -pren2a: - inx h ; point correctly -prent3: - lxi b,6 ; pt to next entry - dad b - ret -; -; Print B chars pted to by HL -; -prch: - mov a,m ; get char - inx h ; pt to next - ani 7fh ; mask out msb - cpi ' ' ; within range? - jnc prch1 ; print special char if not valid char - mvi a,'?' ; print ? if not valid char -prch1: - call sout ; print it - dcr b ; count down - jnz prch - ret -; -; Extended Print Routines -; -prletx: - mov a,m ; get byte - ani 80h ; look at msb - jz prlets - mov a,b ; get letter - jmp sout -prlets: - mvi a,' ' ; print - jmp sout -; -; Divide DE by 3; return with BC=result*esize, a=remainder -; -divde3: - push d ; save de, hl - push h - mvi d,0 ; make sure D=0 - mov a,e ; value in A -divd31: - sui 3 ; subtract 3 - jc divd32 - jz divd33 - inr d ; add 1 to result - jmp divd31 -divd32: - adi 3 ; add back in - jmp divd34 -divd33: - inr d ; add 1 for even division -divd34: - sta rem ; save remainder - lxi b,esize - lxi h,0 -divd35: - mov a,d ; done? - ora a ; 0=yes - jz divd36 - dcr d - dad b ; add in another ESIZE - jmp divd35 -divd36: - mov b,h ; BC is result - mov c,l - lda rem ; A is remainder - pop h ; restore regs - pop d - ret -; -; Skip blanks -; -sblank: - mov a,m ; pt to char - cpi ' ' ; blank? - rnz - inx h ; pt to next - jmp sblank - -; -; Buffers -; -aflg: ds 1 ; attibute flag -gflg: ds 1 ; 0=group by name/type -hflg: ds 1 ; 0=vertical list -pflg: ds 1 ; printer output on flag -crcnt: ds 1 ; entry counter -fmark: ds 1 ; first file marker -pflgt: ds 1 -pflgs: ds 1 -rsflg: ds 1 ; RS Display Flag -ffflg: ds 1 ; form feed flag -rem: ds 1 ; remainder buffer -firstf: ds 2 ; ptr to first file of group to print -fcount: ds 2 ; count of files -countf: ds 2 ; down count of files -freesiz: - ds 2 ; amount of free space on disk -totsiz: - ds 2 ; total size of all files -ptr1: ds 2 ; col output ptrs -ptr2: ds 2 -ptr3: ds 2 -entptr: ds 2 ; current entry ptr -buffer: ds 2 ; pointer to free area -stack: ds 2 ; stack ptr - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/XDIR.COM b/Source/Images/d_bp/u15/XDIR.COM deleted file mode 100644 index 71feb005..00000000 Binary files a/Source/Images/d_bp/u15/XDIR.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/XDIR.MAC b/Source/Images/d_bp/u15/XDIR.MAC deleted file mode 100644 index 3ea67b5c..00000000 --- a/Source/Images/d_bp/u15/XDIR.MAC +++ /dev/null @@ -1,1888 +0,0 @@ -; -; PROGRAM: XDIR III -; AUTHOR: RICHARD CONN -; VERSION: 2.0 -; DATE: 9 APR 84 -; PREVIOUS VERSIONS: 1.6 (19 NOV 83) -; PREVIOUS VERSIONS: 1.5 (9 JAN 83), 1.4 (6 JAN 83), 1.3 (7 DEC 82) -; PREVIOUS VERSIONS: 1.2 (2 NOV 82), 1.1 (30 OCT 82), 1.0 (20 OCT 82) -; -vers equ 20 -z3env SET 0f400h - -; -; XDIR III -- Extended Disk Directory Program -; ZCPR3 Version -; -; XDIR III produces a formatted, alphabetized listing of the contents -; of the disk directory of the implied (current logged-in) or specified disk. -; -; XDIR III is invoked by a command line of the following form -- -; -; XDIR dir:filename.typ ooo... -; or -; -; XDIR /oooo... -; -; where: -; dir is an optional directory name or a disk/user specification (du) -; if dir is omitted, XDIR III defaults to the current disk/user -; filename.typ is an ambiguous file name and type (* and ? may be used) -; o are option letters as follows: -; Aa - Set the attributes of the files to be displayed; -; a=S for System Files, a=N for Non-System Files -; a=A for All Files (System and Non-System) -; D - Send Output to Disk as well as screen -; Ff - Engage File Name Buffer Facility -; f=L to Log File Names to Disk -; f=P to Print Names Logged to Disk -; f=S to Scan Disk for File Names and Compare to Logged -; I - Inspect files selected by FL option for inclusion -; N - Negate selection; select those files which do NOT -; match the ambiguous file name -; Oo - Set Output Parameters; -; o=A to Toggle File Attributes, o=F to Form Feed at end -; o=G to Toggle Grouping, o=H to Toggle Hor/Vert -; P - Print display as well as show it on the screen -; PF - Same as POF -; U - Select All User Areas -; -; Options may be combined as desired; note that AA is the same as AS and AN, -; but AS by itself negates AN and vice-versa, with AN taking precident -; - - -; -; CP/M Equates -; -base equ 0 -wboot equ base -bdose equ base+5 -fcb equ base+5ch -buff equ base+80h -ctrlc equ 'C'-'@' -cr equ 0dh -ff equ 0ch -lf equ 0ah -esize equ 16 ; size of directory entries -optch equ '/' ; option char -maxent equ 54 ; maximum number of entries/screen - -; -; External Routines -; - ext bdos ; BDOS - ext dutdir ; convert DU to DIR form - ext z3log ; log into DU or DIR - ext z3init ; init buffers - ext dbuffer ; disk routines - ext dfree - ext diralpha - ext dirsload - ext dirpack - ext dirnpack - ext dirsel - ext dparam - ext fsize - ext fo0$open ; byte-oriented file output - ext fo0$close - ext f0$put - ext fo1$open - ext fo1$close - ext f1$put - ext fi1$open - ext fi1$close - ext f1$get - ext bbline ; input line editor - ext retud ; get current user and disk - ext print ; print routines - ext pstr - ext lpstr - ext lcrlf - ext caps ; capitalize char - ext cin ; console in char - ext lout ; print char - ext cout ; console out char - ext crlf ; new line - ext madc ; a as dec chars in memory - ext mhldc ; hl as dec chars in memory - ext fillb ; memory fill - ext moveb ; memory move - ext codend ; beginning of buffer area - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - jmp start0 -; -; Other Buffers (Set by GENINS) -; -igrp: db 0ffh ; Group by file type and name -ifmt: db 0 ; vertical format -iatt: db 10000000b ; Non-System files only -iscn: db 0 ; 0=dir display, 0ffh=scan for files by default -fenab: db 0ffh ; enable F options (0=no) -lenab: db 0ffh ; enable FL option (0=no) -asenab: db 0ffh ; enable AS option (0=no) -irs: db 0ffh ; enable attribute display (0=no) -iff: db 0 ; enable form feed at end (0=no) - -; -; Command Line Option Table -; -optab: - db 'A' - dw opta - db 'D' - dw optd - db 'F' - dw optf - db 'I' - dw opti - db 'N' - dw optn - db 'O' - dw opto - db 'P' - dw optp - db 'U' - dw optu - db 0 - -; -; **** Start of XDIR III **** -; -start0: - -; -; Save stack ptr for return later -; - lxi h,0 ; get stack - dad sp - shld stack ; save stack ptr for return - call codend ; determine free space (CODEND also pts to Command - ; Line Save Area) - lxi d,100h ; block size to save - dad d - dad d ; allow for 256-byte stack - shld buffer ; start of free buffer area - sphl ; set stack ptr - -; -; Save command line in CMDLNE buffer -; - call codend ; pt to command line buffer - xchg ; ... in DE - lxi h,buff+1 ; copy input line into command line buffer -start1: - mov a,m ; get byte - stax d ; put byte - inx h ; pt to next - inx d - ora a ; end of line? - jnz start1 - -; -; Get and save current user number -; -noext: - call retud ; get current user and disk - mov a,b ; get disk into A - sta curdisk ; current disk number - mov a,c ; set current user - sta curuser - -; -; Log into DU or DIR -; - lxi d,fcb ; use data determined by ZCPR3 - call z3log ; ZCPR3 command line interpretation - call retud ; get current user and disk - mov a,c ; set current user - sta aflg - mov a,b ; set disk - sta disk - -; -; Set flag values -; - lda irs ; get RS display option - sta rsflg ; set RS display option - lda iff ; get form feed option - sta ffflg ; set form feed option - lda igrp ; set grouping (file name/type or type/name) - sta gflg - lda ifmt ; set listing format (vertical or horizontal, 0=vert) - sta hflg - lda iatt ; set file attributes - mov c,a ; save in c - lda aflg ; get current user number - ora c ; mask in file attributes - sta aflg ; save flag - lda iscn ; set initial function (Scan or Dir) - sta fflg - xra a ; A=0 - sta nflg ; set no negation - sta dflg ; set no disk output - sta pflg ; set no printer output - sta iflg ; set no file name inspection (for /FP) - -; -; Assume wild file name -; - lxi h,fcb+1 ; store '?' chars - mvi b,11 ; 11 chars - mov a,m ; check for entry specified - cpi ' ' ; test for space (means no entry) - mvi a,'?' ; prepare for '?' fill - cz fillb - mov a,m ; check for option caught - cpi optch ; test for option flag - mvi a,'?' ; prepare for '?' fill - cz fillb - -; -; Scan command line for options -; - call codend ; pt to first char - call sblank ; skip over blanks - ora a ; end of line? - jz xdir ; begin main processing - inx h ; prep for invalid option - cpi optch ; option? - jz opt ; process options - dcx h ; ok to process for dir:filename.typ form -; -; skip over character of file name -; -skipo1: - mov a,m ; get char - inx h ; pt to next - cpi ' ' - jz skipo2 - ora a - jnz skipo1 - jmp xdir ; run XDIR if no options follow -; -; Scan complete -- look for possible following option char -; -skipo2: - call sblank ; skip over blanks - mov a,m ; option char follows? - cpi optch - jnz opt - inx h ; skip over option char -; -; Look for options -- main loop; HL pts to next char -; -opt: - mov a,m ; get option char - inx h ; pt to next - ora a ; end of line? - jz xdir ; begin main processing - cpi ' ' ; skip over spaces - jz opt - cpi optch ; option char? - jz opterr ; loop back if so - lxi d,optab ; pt to option table - mov b,a ; option char in b -; -; Scan option table -; -opt1: - ldax d ; get option table char - ora a ; end of table? - jz opterr ; invalid option error - cmp b ; compare to passed option - jz opt2 ; process if match - inx d ; skip address - inx d - inx d ; pt to next opt char - jmp opt1 -; -; Process option found -; -opt2: - inx d ; pt to low-order address - ldax d ; get it - mov c,a ; low in C - inx d ; pt to high-order address - ldax d ; get it - mov b,a ; high in B - push b ; BC on stack - ret ; Process option routine -; -; Option A -- File Attributes -; -opta: - mov a,m ; get next option letter - cpi 'N' ; Non-System files? - jz optan - cpi 'S' ; System files? - jz optas - cpi 'A' ; All files? - jnz opterr ; error if not -; -; Option AA -- All Files -; -optaa: - lda asenab ; enable system files? - ora a ; 0=no - jz optan - mvi c,11000000b ; System and Non-system -optaret: - lda aflg ; get flag - ani 3fh ; leave in user selection - ora c ; mask in sys/non-sys - sta aflg ; restore flag - inx h ; pt to next - jmp opt -; -; Option AS -- System Files -; -optas: - lda asenab ; enable system files? - ora a ; 0=no - jz optan - mvi c,01000000b ; System Only - jmp optaret -; -; Option AN -- Non-System Files -; -optan: - mvi c,10000000b ; Non-system Only - jmp optaret - -; -; Option F - select file name buffer functions -; -optf: - mvi a,0ffh ; set flag - sta fflg - mov a,m ; get option char - sta fopt - cpi 'L' ; log file names to disk - jz optfok - cpi 'P' ; print names of files - jz optfok - cpi 'S' ; scan disk for files - jz optfok - jmp opterr ; error otherwise -optfok: - inx h ; pt to next option letter - jmp opt - -; -; Option I -- enable it; inspect for FL option only -; -opti: - mvi a,0ffh ; ON - sta iflg - jmp opt - -; -; Option D -- enable it; Disk output -; -optd: - mvi a,0ffh ; ON - sta dflg - jmp opt - -; -; Option P -- enable it; Printer output -; -optp: - mvi a,0ffh ; ON - sta pflg - mov a,m ; get possible 2nd letter - cpi 'F' ; set form feed if F - jnz opt ; process as next option letter if not F - inx h ; pt to next - jmp optof - -; -; Option O -- control Output parameters -; -opto: - mov a,m ; get 2nd letter - inx h ; pt to next - cpi 'A' ; attributes? - jz optoa - cpi 'F' ; form feed? - jz optof - cpi 'G' ; grouping? - jz optog - cpi 'H' ; horizontal/vertical? - jz optoh - dcx h ; adjust back - jmp opterr -; -; Toggle File Attributes Flag -; -optoa: - lda rsflg ; flip flag - cma - sta rsflg - jmp opt -; -; Toggle Form Feed Flag -; -optof: - lda ffflg ; flip flag - cma - sta ffflg - jmp opt -; -; Toggle Grouping -; -optog: - lda gflg ; flip flag - cma - sta gflg ; 0=file name and type - jmp opt -; -; Toggle Horizontal/Vertical Listing -; -optoh: - lda hflg ; flip flag - cma - sta hflg ; 0=vertical - jmp opt - -; -; Option N -- enable it; Negate Selection -; -optn: - mvi a,0ffh ; ON - sta nflg - jmp opt - -; -; Option U - enable it; Select All User Areas -; -optu: - lda aflg ; get current attributes flag - ori 20h ; select all user areas - sta aflg ; put flag back - jmp opt - -; -; Option error message -; -opterr: - xra a ; set no disk or printer output - sta dflg - sta pflg - call banner ; print banner - call print - db cr,lf,'Syntax:' - db cr,lf,' XDIR dir:filename.typ ooo...' - db cr,lf,'or XDIR /oooo...' - db cr,lf,'Options:' - db cr,lf,' Aa - File Attributes' - db cr,lf,' a=S for System, a=N for Non-System' - db cr,lf,' a=A for All Files (System and Non-System)' - db cr,lf,' D - Send Output to Disk File XDIR.DIR' - db cr,lf,' Ff - Enable a File Buffer Function' - db cr,lf,' f=L for Log Names to FNAMES.DIR' - db cr,lf,' f=P to Print Names stored in FNAMES.DIR' - db cr,lf,' f=S to Scan Disk and Compare to FNAMES.DIR' - db cr,lf,' I - Inspect Logged Files (FL Option Only)' - db cr,lf,' N - Negate Selection' - db cr,lf,' Oo - Toggle Output Features' - db cr,lf,' o=A for File Attributes, o=F for Form Feed' - db cr,lf,' o=G for Grouping, o=H for Horiz/Vert Format' - db cr,lf,' P - Send Display to Printer' - db cr,lf,' PF - Same as POF' - db cr,lf,' U - Select All User Areas' - db 0 - -; -; Return to CP/M -; -return: - lda dflg ; disk output? - ora a ; 0=no - cnz fo0$close ; close file if so - lhld stack ; get old stack ptr - sphl - ret ; return to CP/M - -; -; Memory Overflow Error -; -memerr: - call printx - db cr,lf,'TPA Error',0 - jmp return - -; -; Print banner of XDIR III -; -banner: - call printx - db 'XDIR III, Version ' - db vers/10+'0','.',(vers mod 10)+'0',0 - ret - -; -; Begin XDIR III processing -; -xdir: - -; -; This section disables the /Ff option and /FL option if default set -; - lda fenab ; enable FFLG? (/Ff option) - ora a ; 0=no - jnz xdst1 - xra a ; turn off FFLG - sta fflg -xdst1: - lda lenab ; enable FL option? - ora a ; 0=no - jnz xdst2 - lda fflg ; FFLG on? - ora a ; 0=no - jz xdst2 - lda fopt ; check for L - cpi 'L' - jnz xdst2 - mvi a,'P' ; switch L to P - sta fopt -xdst2: - lda fflg ; file name buffer option? - ora a ; 0=no - jz xdirst - xra a ; A=0 - sta gflg ; group by file name and type - lda fopt ; print immediately if P option - cpi 'P' ; print? - jnz xdirst - call banner ; print banner - jmp xdirfp ; print file names - -; Check for Print Option and Ask for and Print Header if so -xdirst: - lda pflg ; printer output? - ora a ; 0=no - jz xdirgo - call print ; message to user - db cr,lf,'Please Input Header: ',0 - xra a ; no caps - call bbline ; input line from user - ora a ; no chars? - jz xdirgo - call lcrlf ; new line - call lpstr ; print header line - call lcrlf ; new line - -; Get Files from Disk -xdirgo: - lhld buffer ; end of code - call dbuffer ; set buffers - jz memerr ; memory overflow error? - push h ; save regs - push d - call dfree ; compute amount of free space on disk - xchg ; amount in hl - shld freesiz ; save free space count - pop d ; get regs - pop h - call dirsload ; load with sizing information - jz memerr ; memory overflow error? - push h ; save hl - mov h,b ; HL=number of files loaded - mov l,c - shld totfil ; save total count - push b ; save bc - lda curdisk ; prepare to relog in disk - mov e,a - mvi c,14 ; select disk - call bdos - lda curuser ; prepare to relog in user - mov e,a - mvi c,32 ; select user - call bdos - -; Open disk file if necessary for disk output - lda dflg ; disk output? - ora a ; 0=no - jz xdir0 - lxi d,dskfcb ; open disk file for char output - call fo0$open ; open file for output -xdir0: - pop b ; get count - pop h ; get ptr - -; Continue processing; select desired files - lda aflg ; get file attributes - lxi d,fcb ; get ptr to fcb - call dirsel ; select files - -; Now, pack and alphabetize directory - lda nflg ; negate selection? - ora a ; 0=no - cz dirpack ; select marked entries - cnz dirnpack ; select unmarked entries - lda gflg ; get grouping flag - call diralpha ; alphabetize directory - shld firstf ; save ptr to first file - mov h,b ; HL=file count - mov l,c - shld fcount ; save file count - shld countf ; save file down count - lxi h,0 ; set file size counter - shld totsiz ; save counter - lda dflg ; set temp flags - sta dflgt - lda pflg - sta pflgt - -; -; Major feature selection -- -; Two major features of XDIR are selected at this time: -; 1. Directory Display Functions -; 2. File Name Buffer Functions -; At this point, the following key values are know: -; FIRSTF - Pointer to First File -; FCOUNT, COUNTF - Number of Files -; - lda fflg ; get flag - ora a ; Z=Directory Display, NZ=File Name Buffer Fcts - jnz xdirf ; Do File Name Buffer Fcts - -; -; Main Directory Print Routine -- This routine displays the directory to -; the console, printer, or disk as desired -; -; Print header lines and one screen of entries -xdir2: - lda dflg ; save disk and print output flags - sta dflgs - lda pflg - sta pflgs - lda dflgt ; use temp flags - sta dflg - lda pflgt - sta pflg - xra a ; A=0 - sta dflgt ; clear temp flags so no banner 2nd time around - sta pflgt - -; Print: Main Banner - call banner ; print banner - -; Print: Horizontal/Vertical Listing Message - call printx - db ' ',0 - lda hflg ; get horizontal/vertical flag - ora a ; 0=vertical - jnz xdir2a - call printx - db 'Vertical',0 - jmp xdir3 -xdir2a: - call printx - db 'Horizontal',0 - -; Print: Listing by File Name and Type or Type and Name Message -xdir3: - call printx - db ' Listing by File ',0 - lda gflg ; grouping flag - ora a ; 0=name and type - jnz xdir3a - call printx - db 'Name/Type',0 - jmp xdir4 -xdir3a: - call printx - db 'Type/Name',0 - -; -; Print: Disk and User -; -xdir4: - call printx ; print everywhere - db cr,lf,' Disk: ',0 - lda disk ; get current disk - adi 'A' ; convert to ASCII - call coutx ; print everywhere - call printx ; print everywhere - db ' User: ',0 - lda aflg ; get user number - ani 20h ; all? - jz xdir4b - call printx - db 'All',0 - jmp xdir5 -xdir4b: - lda aflg ; get selected user - ani 1fh ; select user number - lxi d,numbuf ; store number in buffer - call madc ; get number - mvi b,3 ; 3 digits - call prnumx ; print number everywhere - -; -; Print: Directory Name -; -xdir5: - lda aflg ; check for all users - mov c,a ; save in C - ani 20h - jnz xdir5fa - mov a,c ; get user - ani 1fh ; mask for just user - mov c,a - lda disk ; select disk - mov b,a - call dutdir ; determine if name available - jz xdir5fa - call printx - db ' Name: ',0 - mvi b,8 ; 8 chars to name -xdir5n: - mov a,m ; get char - inx h ; pt to next - cpi ' ' ; don't print spaces - cnz coutx - dcr b ; count down - jnz xdir5n -; -; Print: Selected File Attributes -; -xdir5fa: - call printx - db ', File Attributes: ',0 - lda aflg ; get flag - push psw ; save A - ani 80h ; Non-system? - jz xdir5a - call printx - db ' Non-System',0 -xdir5a: - pop psw ; get A - ani 40h ; System? - jz xdir5b - call printx - db ' System',0 - -; See if any files selected -xdir5b: - lhld countf ; get file down count - mov a,h ; any files? - ora l - jnz xdir6 - call printx ; print everywhere - db cr,lf,'No files selected -- ',0 - jmp xdir11 - -; -; This is the main looping entry point for each screen display -; -xdir6: - lda aflg ; all users selected? - ani 20h - jnz xdir6a -; -; This is the header which is printed if the files in only one user area are -; displayed -; - call crlfx ; new line - call hdr2 ; pt to header - lda rsflg - ora a ; Z=no - cnz sp0 ; print RS - call sp2 ; print leading spaces - call hdr2 ; print header - lda rsflg - ora a ; Z=no - cnz sp0 ; print RS - call sp2 ; print leading spaces - call hdr2 ; print header - lda rsflg - ora a - cnz sp0 - call crlfx ; new line - call hdr1 ; print underlines - lda rsflg - ora a - cnz sp1 - call sp2 ; leading spaces - call hdr1 ; underlines - lda rsflg - ora a - cnz sp1 - call sp2 ; leading spaces - call hdr1 ; underlines - lda rsflg - ora a - cnz sp1 - jmp xdir6b -; -; General-Purpose Header Print Routines -; -sp0: - call printx - db ' RS',0 - ret -sp1: - call printx - db ' --',0 - ret -sp2: - call printx - db ' ',0 - ret -spu: - call printx - db ' U ',0 - ret -spu1: - call printx - db ' ',0 - ret -spu2: - call printx - db ' - ',0 - ret -hdr1: - call printx - db '-------- --- ------',0 - ret -hdr2: - call printx - db 'Filename.Typ Size K',0 - ret -; -; This is the header which is printed if the files in all user areas are -; displayed -; -xdir6a: - call crlfx - call spu ; print U - call hdr2 ; print header - lda rsflg - ora a - cnz sp0 ; RS - call spu1 - call spu ; print U - call hdr2 ; print header - lda rsflg - ora a - cnz sp0 ; RS - call spu1 - call spu ; print U - call hdr2 ; print header - lda rsflg - ora a - cnz sp0 ; RS - call crlfx - call spu2 ; 1 underscore - call hdr1 ; underscores - lda rsflg - ora a - cnz sp1 - call spu1 - call spu2 ; 1 underscore - call hdr1 ; underscores - lda rsflg - ora a - cnz sp1 - call spu1 - call spu2 ; 1 underscore - call hdr1 ; underscores - lda rsflg - ora a - cnz sp1 - -; -; Prepare Columnar Output -; -xdir6b: - lda dflgs ; restore disk and print flags - sta dflg - lda pflgs - sta pflg - lhld countf ; get file count down - lxi d,maxent ; assume maxent entries to print - mov a,h ; within range? - ora a ; outside of range if not - jnz xdir7 ; subtract entries to print from total entries - mov a,l ; within range? - cpi maxent ; less than maxent entries left? - jnc xdir7 ; subtract entries to print from total entries - mov d,h ; DE=HL=number of entries to print - mov e,l -xdir7: - mov a,l ; subtract entries to print (DE) from total (HL) - sub e - mov l,a - mov a,h - sbb d - mov h,a ; HL=result - shld countf ; save new down count - mov b,h ; BC=count - mov c,l - lhld firstf ; pt to first file -; -; At this point, BC=number of remaining entries, DE=number of entries to -; print, and HL pts to first entry to print -; - shld ptr1 ; save ptr to 1st entry - lda hflg ; horizontal listing? - ora a ; 0ffh = yes - jnz xdir7c ; don't worry about columns if horizontal - push d ; save count - call divde3 ; divide DE by 3, result*esize in BC, remainder in A - lxi d,esize ; DE=ESIZE (size of entry) - dad b ; add BC as a minimum - ora a ; any remainder? - jz xdir7a ; skip if none - dad d ; add in ESIZE for additional length of 1st col -xdir7a: - shld ptr2 ; save ptr to col 2 - dad b ; add BC as a minimum - cpi 2 ; if remainder 2, add ESIZE for additional - jc xdir7b - dad d ; add in ESIZE -xdir7b: - shld ptr3 ; save ptr to col 3 - pop d ; get count in de -; -; Main entry print routine -; -xdir7c: - mvi d,1 ; set 3's counter -xdir8: - lhld ptr1 ; pt to first entry - call prentry ; print entry - shld ptr1 ; put ptr - lda hflg ; horizontal? - ora a ; 0ffh = yes - jnz xdir9 - dcr e ; count down - jz xdir10 - lhld ptr2 ; get ptr - call prentry ; print entry - shld ptr2 ; put ptr - dcr e ; count down - jz xdir10 - lhld ptr3 ; get ptr - call prentry ; print entry - shld ptr3 ; put ptr -xdir9: - dcr e ; count down - jnz xdir8 ; continue if not zero - shld firstf ; save ptr to first of next set of entries to print - lhld countf ; get count of remaining entries -; -; At this point, HL=number of entries left -; - mov a,h ; anything left? - ora l - jz xdir10 - lda dflg ; no message if disk or printer output - mov b,a - lda pflg - ora b - jnz xdir6 - call print ; screen break - db cr,lf,' --> Screen Break -- Strike any char <-- ',0 - call cin ; get response - cpi ctrlc ; abort? - jz return - jmp xdir6 ; new screen display -; -; Print end statistics and exit -; -xdir10: - call crlfx ; new line - lhld fcount ; print file count - call prhlx ; print it everywhere - call printx - db ' Files Using ',0 - lhld totsiz ; get total of file sizes - call prhlx ; print it everywhere - call printx - db 'K, ',0 - lhld totfil ; print total file count - call prhlx ; print it everywhere - call printx - db ' Files on Disk and ',0 - -; -; Print Amount of Free Space Left on Disk -; Entry Point if No Files Found -; -xdir11: - lhld freesiz ; get amount of free space - call prhlx ; print it everywhere - call printx - db 'K Left',0 - lda dflg ; if disk or printer output, new line - mov b,a - lda pflg - ora b - jz return - call crlfx ; new line for disk and/or printer - lda pflg ; print output - mov b,a - lda ffflg ; form feed - ana b ; if print and form feed ... NZ is set - mvi a,ff ; form feed char - cnz lout ; form feed to printer - jmp return - -; -; File Name Buffer Functions -; -xdirf: - call banner ; print banner - lda iscn ; just scan? - ora a ; 0=no - jnz xdirfs - lda fopt ; get option of F command - cpi 'L' ; log names to disk? - jz xdirfl - cpi 'S' ; scan names on disk? - jz xdirfs -; -; File Name Print Option; /FP option -; -xdirfp: - call openin ; open FNAMES.DIR for input -xdfp0: - call printx - db cr,lf,cr,lf - db 'Printout of Recorded File Names --',cr,lf,' ',0 -; -; Extract File Name Count -; - call f1$get ; get low count - jnz geterr - mov l,a ; save in L - call f1$get ; get high count - jnz geterr - mov h,a ; save in H - push h ; save HL - call prhlx ; print HL everywhere - call printx - db ' File Names',cr,lf,0 - call prfhdr ; print file name header - pop h ; get HL - mvi c,0 ; set entry counter - -; -; Loop for extracting names from FNAMES.DIR and printing them -; -xdfp1: - mov a,h ; no more entries? - ora l - jz xdfp2 - dcx h ; count down - call getdfn ; get next disk file name from FNAMES.DIR - call prfnfx ; print file name entry - inr c ; increment count - mov a,c ; new line time? - ani 3 - cz crlfx - jmp xdfp1 -xdfp2: - call fi1$close - call crlfx ; new line - jmp return - -; -; Log File Names to Disk; /FL option -; Structure of FNAMES.DIR file is: -; File Name Count, Low-Order Byte -; File Name Count, High-Order Byte -; File Names, stored as 12 bytes -- User Number, FN, and FT -; -xdirfl: - lxi d,fnfcb ; open file for output - call fo1$open - jz xdfl1 - call printx - db cr,lf,'Cannot Create FNAMES.DIR',0 - jmp return - -; Log Files to Disk with possible initial inspect and select by user -xdfl1: - lda iflg ; inspect? - ora a ; 0=no - cnz flinsp ; inspect if selected - -; Print file count - call printx - db cr,lf,cr,lf - db 'Logging File Names to Disk --',cr,lf,' ',0 - lhld fcount ; get count - call prhlx ; print it - call printx - db ' File Names',cr,lf,0 - -; Check file count and print appropriate header - lhld fcount ; get number of files - mov a,h ; any files? - ora l - jz xdfl1a - call prfhdr ; print file name header - jmp xdfl1b -xdfl1a: - call printx ; no files - db ' No Files to be Logged',0 - -; Store file count to disk -xdfl1b: - mov a,l ; store low count - call f1$put - jnz puterr - mov a,h ; store high count - call f1$put - jnz puterr - xchg ; ... in DE - lhld firstf ; pt to first file - mvi c,0 ; set display counter - -; Loop to store files names -xdfl2: - mov a,d ; done? - ora e - jz xdfl3 - dcx d ; count down - -; Write entry to disk - push d ; save count - push h ; save ptr to file - mov a,m ; get user number - call f1$put ; save it - jnz puterr - lxi d,numbuf ; print user number - push d ; save ptr - call madc - pop d ; get ptr - inx d ; pt to 1st digit - ldax d ; get it - call coutx - inx d ; pt to last digit - ldax d ; get it - call coutx - mvi a,' ' ; - call coutx - inx h ; pt to FN - mvi b,8 ; 8 chars - call xdput - mvi a,'.' - call coutx - mvi b,3 ; 3 chars - call xdput - mvi a,' ' ; print - call coutx - call coutx - inr c ; increment count - mov a,c ; get count - ani 3 - cz crlfx - pop h ; get ptr to first file - pop d ; get count - push b - lxi b,esize ; pt to next file - dad b - pop b - jmp xdfl2 - -; Done with creation of FNAMES.DIR -xdfl3: - call fo1$close ; close file - call crlfx - jmp return - -; Write B chars pted to by HL to FNAMES.DIR and user -xdput: - mov a,m ; get char - call coutx ; print it everywhere - call f1$put ; put it on disk - jnz puterr - inx h ; pt to next - dcr b ; count down - jnz xdput - ret - -; -; Inspect Files for Logging to Disk -; -flinsp: - lhld fcount ; get count of files - xchg ; ... in DE - mov a,d ; any files selected? - ora e - rz ; abort if none - -; Inspection banner - call printx - db cr,lf,'Inspection of Files to be Logged',0 - lhld firstf ; pt to first file - -; Main inspection loop -flil1: - mov a,d ; any files selected? - ora e - jz flil3 ; done if not - dcx d ; count down - push d ; save count - lxi d,dfnbuf ; copy file name to buffer - mvi b,12 ; 12 bytes - call moveb - call printx - db cr,lf,'Log ',0 - call prfnfx ; print file name for prompt - call printx - db ' to Disk (Y/N)? ',0 - call cin ; get response - call caps ; capitalize - call coutx - cpi 'N' ; No? - jz flil2 - mov a,m ; mark user number - ori 80h - mov m,a -flil2: - lxi d,esize ; skip to next entry - dad d - pop d ; get count - jmp flil1 -flil3: - lhld fcount ; get number of files - mov b,h ; count in BC - mov c,l - lhld firstf ; pt to first file - call dirpack ; pack directory - mov h,b ; new count in HL - mov l,c - shld fcount ; set counts - shld countf - ret - -; -; Error Message for Output -; -puterr: - call printx - db cr,lf,'Disk Write Error',0 - jmp return - -; -; Scan Disk for File Names; /FS option -; -xdirfs: - call printx - db cr,lf,'File Name Scanner',0 - call openin ; open FNAMES.DIR for input -xdfs1: - call printx - db cr,lf,'Files Named in FNAMES.DIR missing from Disk --',cr,lf,0 - -; Get file name count - call f1$get ; get file name count from disk - jnz geterr - mov c,a ; store low - call f1$get - jnz geterr - mov b,a ; store high - lhld fcount ; get count of number of files - xchg ; ... in DE - lhld firstf ; pt to first file - xra a ; A=0 - sta crcnt ; set counter for CRLF - sta fmark ; mark no first file yet - -; -; At this point, HL pts to first file in buffer, DE is number of files in -; buffer, and BC is number of files in FNAMES.DIR -; - mov a,b ; any names in FNAMES.DIR? - ora c - jz xdfs5 ; mark all names in buffer if not - call getdfn ; get first disk name -xdfs2: - mov a,b ; see if any more files in FNAMES.DIR - ora c - jz xdfs5 ; mark rest of files in buffer and continue - mov a,d ; see if any more files in buffer - ora e - jz xdfs6 ; name rest of files in FNAMES.DIR as missing and cont - call compfn ; compare to file name pted to by HL - jz xdfs3a ; advance to next file if they match - jc xdfs3 ; mark file name pted to by HL as additional - lda fmark ; first file? - ora a ; 0=yes - jnz xdfs2a - mvi a,0ffh ; set mark - sta fmark - call prfhdr ; print header -xdfs2a: - call prfnfx ; print file name in FNAMES.DIR - dcx b ; count down - mov a,b ; done? - ora c - jz xdfs2 - call getdfn ; get next name - lda crcnt ; get entry counter - inr a ; increment - sta crcnt - ani 3 ; mask - cz crlfx ; new line every 4 - jmp xdfs2 -xdfs3: - mov a,m ; get user number - ori 80h ; mark it - mov m,a ; put it back - jmp xdfs4 -xdfs3a: - call getdfn ; get next name - dcx b ; count down on names -xdfs4: - push d ; save count - lxi d,esize ; pt to next entry - dad d - pop d ; get count - dcx d ; count down - jmp xdfs2 ; continue - -; Mark rest of files in buffer -xdfs5: - mov a,d ; check count - ora e - jz xdfs7 - dcx d ; count down - mov a,m ; get user number - ori 80h ; mark it - mov m,a ; put user number - lxi b,esize ; skip to next file - dad b - jmp xdfs5 ; continue - -; Name rest of files in FNAMES.DIR as missing -xdfs6: - call prfnfx ; print file name in FNAMES.DIR - dcx b ; count down - mov a,b ; done? - ora c - jz xdfs7 ; next phase - lda crcnt ; get entry counter - inr a ; increment - sta crcnt - ani 3 ; mask - cz crlfx ; new line every 4 - call getdfn ; get next name - jmp xdfs6 - -; Part 2 of Scan - Name Additional Files -xdfs7: - lda fmark ; no files printed? - ora a ; 0=none - jnz xdfs7a - call printx - db ' No Files Missing',0 -xdfs7a: - xra a ; A=0 - sta fmark ; set mark for 2nd part - call printx - db cr,lf,'Additional Files on Disk NOT in FNAMES.DIR --',cr,lf,0 - lhld fcount ; get count of files - xchg ; ... in DE - lhld firstf ; pt to first file - xra a ; A=0 - sta crcnt ; set counter -xdfs8: - mov a,d ; check count - ora e - jz xdfs9 ; done if zero - dcx d ; count down - mov a,m ; get user number - ani 80h ; marked? - jz xdfs8b ; skip if not - mov a,m ; get user number - ani 7fh ; mask - mov m,a ; replace - lda fmark ; first time? - ora a ; 0=yes - jnz xdfs8a - mvi a,0ffh ; set mark - sta fmark - call prfhdr ; print header -xdfs8a: - push d ; save count - lxi d,dfnbuf ; copy to buffer for print - mvi b,12 ; 12 bytes - call moveb ; copy - pop d - call prfnfx ; print file name - lda crcnt ; count down - inr a - sta crcnt - ani 3 ; new line? - cz crlfx -xdfs8b: - lxi b,esize ; pt to next entry - dad b - jmp xdfs8 ; continue - -; Done with Scan -xdfs9: - lda fmark ; no files printed? - ora a ; 0=none - jnz xdfs9a - call printx - db ' No Additional Files',0 -xdfs9a: - jmp return - -; -; Compare file name pted to by HL with that in DFNBUF; return with Z if same, -; C if (HL)<(DFNBUF) -; -compfn: - push h ; save regs - push d - push b - lxi d,dfnbuf ; pt to buffer - xchg ; DE pts to file name, HL pts to DFNBUF - push h ; save ptrs - push d - mvi b,11 ; compare FN and FT -cfn1: - inx h ; pt to next - inx d - mov a,m ; get char from DFNBUF - ani 7fh ; mask MSB - mov c,a ; save in C - ldax d ; get name in memory buffer - ani 7fh ; mask MSB - cmp c ; compare to name in DFNBUF - jnz cfn2 ; not same, so exit with flag set - dcr b ; count down - jnz cfn1 - pop d ; same so far, so compare user numbers - pop h - mov a,m ; get user number - ani 7fh ; mask MSB - mov c,a ; save in C - ldax d ; get user number - ani 7fh ; mask MSB - cmp c ; compare - push h ; fill stack for ext - push h -cfn2: - pop h ; clear stack - pop h - pop b ; get regs and exit - pop d - pop h - ret - -; -; General Utility Routines -; - -; -; Print user and file name stored in DFNBUF for /Ff functions -; -prfnfx: - push h ; save regs - push d - push b - lxi h,dfnbuf ; pt to first byte of buffer - mov a,m ; get first byte (user number) - lxi d,numbuf ; convert to chars in memory - call madc - lxi d,numbuf+1 ; pt to first char - ldax d ; get it - call coutx - inx d ; pt to 2nd char - ldax d ; get it - call coutx - mvi a,' ' ; - call coutx - inx h ; pt to FN - mvi b,8 ; 8 chars for FN - call prch - mvi a,'.' - call coutx - mvi b,3 ; 3 chars for FT - call prch - call prfhs ; 2 - pop b ; get regs - pop d - pop h - ret -; -; Get next User Number, FN, and FT from disk and save it in buffer -; -getdfn: - push h ; save regs - push d - push b - lxi h,dfnbuf ; pt to buffer - mvi b,12 ; 12 bytes -getdf1: - call f1$get ; get user - jnz geterr - mov m,a ; store user - inx h ; pt to next - dcr b ; count down - jnz getdf1 - pop b ; restore regs - pop d - pop h - ret -; -; Print File Buffer Names Header Everywhere -; -prfhdr: - mvi b,3 ; 3 times -prfhd1: - call prfh1 ; print header - call prfhs ; print 2 spaces - dcr b - jnz prfhd1 - call prfh1 - call crlfx - mvi b,3 ; 3 times -prfhd2: - call prfh2 ; print header - call prfhs ; print 2 spaces - dcr b - jnz prfhd2 - call prfh2 - call crlfx - ret -prfhs: - call printx - db ' ',0 - ret -prfh1: - call printx - db ' U Filename.Typ',0 - ret -prfh2: - call printx - db ' - -------- ---',0 - ret -; -; Get Error Message and Abort -; -geterr: - call printx - db cr,lf,'Premature EOF',0 - jmp return -; -; Open FNAMES.DIR for byte-oriented input -; -openin: - lxi d,fnfcb ; open file - call fi1$open ; open for input - rz - call printx - db cr,lf,'FNAMES.DIR Not Found',0 - jmp return -; -; Print disk entry for normal directory display functions -; -prentry: - dcr d ; count counter - jnz prent1 - mvi d,3 ; reset count - call crlfx -prent1: - shld entptr ; save entry ptr - lda aflg ; all users selected? - ani 20h - jz prent2 -; -; The following prints the user number if all user numbers are selected -; - push h ; save regs - push d - push b - mov a,m ; get user number - ani 1fh ; mask it - lxi d,numbuf - call madc ; convert to chars in memory - lxi h,numbuf+1 ; pt to first char - mov a,m ; get it - call coutx - inx h ; get 2nd char - mov a,m - call coutx - mvi a,' ' ; print - call coutx - pop b ; get regs - pop d - pop h -prent2: - inx h ; pt to first char of file name - mvi b,8 ; print 8 chars - call prch - mvi a,'.' ; print dot - call coutx - push h ; save RS ptr - mvi b,3 ; print 3 chars - call prch - push d ; save de - lhld entptr ; pt to entry - mvi a,' ' ; skip 2 spaces - call coutx - call coutx - call fsize ; compute file size - lhld totsiz ; get total file size counter - dad d ; add in new file - shld totsiz ; save new total file size counter - xchg ; get file size into HL - call prhlx ; print HL value - pop d ; get de - pop h ; pt to RS - lda rsflg ; print RS fields? - ora a ; Z=no - jz pren2a - mvi a,' ' ; print 1 space - call coutx - mvi b,'R' ; letter - call prletx ; print R if bit set - inx h - mvi b,'S' ; letter - call prletx ; print S if bit set - dcx h ; ... for following inx h -pren2a: - inx h ; point correctly - mvi a,' ' ; 1 space - call coutx - lda aflg ; all users? - ani 20h - jnz prent3 -; -; The following prints 2 additional spaces if only one user area is selected -; - mvi a,' ' ; 2 more spaces for not all users - call coutx - call coutx -prent3: - lxi b,6 ; pt to next entry - dad b - ret -; -; Print B chars pted to by HL -; -prch: - mov a,m ; get char - inx h ; pt to next - ani 7fh ; mask out msb - cpi ' ' ; within range? - jnc prch1 ; print special char if not valid char - mvi a,'?' ; print ? if not valid char -prch1: - call coutx ; print it - dcr b ; count down - jnz prch - ret -; -; Extended Print Routines -; -prletx: - mov a,m ; get byte - ani 80h ; look at msb - jz prlets - mov a,b ; get letter - call coutx - ret -prlets: - mvi a,' ' ; print - call coutx - ret -prhlx: - lxi d,numbuf ; store in number buffer - call mhldc ; hl into memory as decimal - mvi b,5 ; 5 digits -prnumx: - lxi h,numbuf ; pt to buffer -prnum: - mov a,m ; get digit - inx h ; pt to next - call coutx ; print everywhere - dcr b ; count down - jnz prnum - ret -printx: - xthl ; pt to string - call prxl ; print string at HL - xthl - ret -prxl: - mov a,m ; get byte - inx h ; pt to next - ora a ; done? - rz - call coutx ; print everywhere - jmp prxl -coutx: - push b ; save bc - push psw ; save char - ani 7fh ; mask out msb - mov b,a ; char in B - call cout ; print to screen - lda pflg ; printer on? - ora a ; 0=no - mov a,b ; get char - cnz lout ; printer output if on - lda dflg ; disk on? - ora a ; 0=no - mov a,b ; get char - cnz f0$put ; output to file - pop psw ; get char - pop b ; get bc - ret -crlfx: - push psw ; save A - call printx - db cr,lf,0 - pop psw ; get A - ret -; -; Divide DE by 3; return with BC=result*esize, a=remainder -; -divde3: - push d ; save de, hl - push h - mvi d,0 ; make sure D=0 - mov a,e ; value in A -divd31: - sui 3 ; subtract 3 - jc divd32 - jz divd33 - inr d ; add 1 to result - jmp divd31 -divd32: - adi 3 ; add back in - jmp divd34 -divd33: - inr d ; add 1 for even division -divd34: - sta rem ; save remainder - lxi b,esize - lxi h,0 -divd35: - mov a,d ; done? - ora a ; 0=yes - jz divd36 - dcr d - dad b ; add in another ESIZE - jmp divd35 -divd36: - mov b,h ; BC is result - mov c,l - lda rem ; A is remainder - pop h ; restore regs - pop d - ret -; -; Skip blanks -; -sblank: - mov a,m ; pt to char - cpi ' ' ; blank? - rnz - inx h ; pt to next - jmp sblank - -; -; Buffers -; -aflg: ds 1 ; attibute flag -dflg: ds 1 ; disk output on flag -fflg: ds 1 ; 0=no file name buffer function -gflg: ds 1 ; 0=group by name/type -hflg: ds 1 ; 0=vertical list -iflg: ds 1 ; 0=no inspect -nflg: ds 1 ; 0=no negate -pflg: ds 1 ; printer output on flag -fopt: ds 1 ; file name buffer option -crcnt: ds 1 ; entry counter -fmark: ds 1 ; first file marker -dflgt: ds 1 ; temp flags -pflgt: ds 1 -dflgs: ds 1 -pflgs: ds 1 -rsflg: ds 1 ; RS Display Flag -ffflg: ds 1 ; form feed flag -disk: ds 1 ; selected disk -curdisk: - ds 1 ; current disk -curuser: - ds 1 ; current user -rem: ds 1 ; remainder buffer -firstf: ds 2 ; ptr to first file of group to print -totfil: ds 2 ; total number of files on disk -fcount: ds 2 ; count of files -countf: ds 2 ; down count of files -freesiz: - ds 2 ; amount of free space on disk -totsiz: - ds 2 ; total size of all files -ptr1: ds 2 ; col output ptrs -ptr2: ds 2 -ptr3: ds 2 -entptr: ds 2 ; current entry ptr -numbuf: ds 6 ; number buffer -dfnbuf: - ds 12 ; disk file name buffer -dskfcb: - db 0 - db 'XDIR DIR' - db 0,0,0,0 - ds 16 - ds 4 -fnfcb: - db 0 - db 'FNAMES DIR' - db 0,0,0,0 - ds 16 - ds 4 -cmdlne: ds 2 ; pointer to command line -buffer: ds 2 ; pointer to free space buffer -stack: ds 2 ; stack ptr - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3BASE1.LIB b/Source/Images/d_bp/u15/Z3BASE1.LIB deleted file mode 100644 index 6cf429da..00000000 --- a/Source/Images/d_bp/u15/Z3BASE1.LIB +++ /dev/null @@ -1,276 +0,0 @@ -; Z3BASE - Maximum Configuration -; Offset: 5100H - -;**************************************************************** -;* * -;* Z3BASE.LIB -- Base Addresses for ZCPR3 System * -;* by Richard Conn * -;* * -;* These addresses are used by the following System * -;* Segments: * -;* * -;* Segment Function * -;* ------- -------- * -;* ABOOTFD Boot System from Floppy Disk * -;* ABOOTHD Boot System from Hard Disk * -;* BDOSZ Customized BDOS * -;* CBIOSZ Customized BIOS * -;* ZCPR3 ZCPR3 Command Processor * -;* *.ENV All Environment Descriptors * -;* *.FCP All Flow Command Packages * -;* *.IOP All Input/Output Packages * -;* *.NDR All Named Directory Definition Files * -;* *.RCP All Resident Command Packages * -;* * -;* * -;* Memory Map of System: * -;* * -;* Address Range Size Function * -;* ------------- ------- -------- * -;* 0 - FF 256 b Standard CP/M Buffers except * -;* 40 - 4A 11 b for ZCPR3 External Path * -;* 4B 1 b Wheel Byte * -;* 100 - BFFF ~48 K TPA * -;* C000 - C7FF 2 K ZCPR3 Command Processor * -;* C800 - D5FF 3.5K BDOSZ * -;* D600 - E3FF 3.5K CBIOSZ with Buffers * -;* E400 - EBFF 2 K Resident Command Package * -;* EC00 - F1FF 1.5K Redirectable I/O Driver Package * -;* F200 - F3FF 0.5K Flow Command Package * -;* F400 - F4FF 256 b Environment Descriptors * -;* Bytes 00H-7FH: Z3 Parameters * -;* Bytes 80H-FFH: Z3 Terminal Cap * -;* F500 - F57F 128 b ZCPR3 Shell Stack * -;* F580 - F5CF 80 b ZCPR3 Message Buffers * -;* Byte 0: Error Flag (Z/NZ) * -;* Byte 1: IF (8 Levels) * -;* Byte 2: IF Active (8 Levels) * -;* Byte 3: Z3 Cmd Status * -;* 00B - Normal * -;* 01B - Shell * -;* 10B - Error * -;* Bytes 4&5: Error Address if 10B * -;* Byte 6: Program Error Code * -;* Byte 7: ZEX Message Byte * -;* 00B - Normal * -;* 01B - Z3 Prompt * -;* 10B - Suspend Intercept * -;* Byte 8: ZEX Running Flag (0=No) * -;* Bytes 9-10: Address of Next * -;* Char for ZEX to Return * -;* Bytes 11-12: Address of First * -;* Char in ZEX Memory- * -;* Based File Buffer * -;* Byte 13: SH Control Byte * -;* Bit 0: Enable SHCMT * -;* Bit 1: Enable SHECHO * -;* Bit 7: Enable Shell * -;* Entry Wait * -;* Bytes 14-15: Shell Scratch * -;* Bytes 10H-2FH: Error Cmd * -;* Bytes 30H-39H: Registers * -;* Bytes 3AH-3FH: Reserved * -;* Bytes 40H-4FH: User-Defined * -;* F5D0 - F5FF 48 b ZCPR3 External FCB * -;* F600 - F6FF 256 b Memory-Based Named Directory * -;* F700 - F7CF 208 b Multiple Command Line Buffer * -;* F7D0 - F7FF 48 b ZCPR3 External Stack * -;* F800 - FBFF 1 K Disk Controller EPROM * -;* FC00 - FFFF 1 K Disk Controller RAM * -;* * -;**************************************************************** - -; -; True and False -; -FALSE equ 0 -TRUE equ NOT FALSE - - -;* -;* ZCPR3 BASE EQUATES -;* - -; -; 1. VERSION NUMBERS, MEMORY SIZE, and CP/M BASE ADDRESS -; -; The following equates define the version numbers of the ZCPR3 -; Command Processor and the CBIOSZ. They also explicitly state the size -; of the TPA for inclusion in the CBIOSZ header printed at Cold Boot. -; -Z3REV EQU 30 ; ZCPR3 REV NUMBER -CBREV EQU 41 ; CBIOSZ REV NUMBER -MSIZE EQU 48 ; SIZE OF TPA -; -; BASE - Base Address of user's CP/M system (normally 0 for DR version) -; This equate allows easy modification by non-standard CP/M (eg,H89) -; -BASE EQU 0 - -; -; 2. PROCESSOR SELECTION -; -; The following equate selects the use of the 8080/8085 micro or -; the Z80 micro for the target for ZCPR3. Note that selecting the -; 8080/8085 should be done ONLY if you have an 8080 or 8085. If you have -; a Z80, by all means select this one since the code is much smaller and -; you can cram more features into the system as a result. -; If the processor is an 8080 or 8085, set this equate to TRUE. -; If the processor is a Z80, set it to FALSE. -; -I8080 EQU FALSE - -; -; 3. EXTERNAL PATH -; -; The following equates define the address of the ZCPR3 External -; Path and the number of two-byte elements contained in this path (maximum). -; If there is no ZCPR3 External Path, both of these values should be set to 0. -; -EXPATH EQU 40H ; EXTERNAL PATH -EXPATHS EQU 5 ; 5 2-byte Path Elements - ; (PATH SIZE = EXPATHS*2 + 1) - -; -; 4. WHEEL BYTE -; -; The following equate defines the address of the ZCPR3 Wheel Byte. -; If there is no ZCPR3 Wheel Byte, this value should be set to 0. -; -Z3WHL EQU 4BH ; WHEEL BYTE ADDRESS - - -; -; 5. CCP LOCATION -; -; The following equate defines the address of the ZCPR3 Command -; Processor. This address MUST be supplied. -; -CCP EQU 0C000H ; ZCPR3 COMMAND PROCESSOR - - -; -; 6. RCP LOCATION -; -; The following equates define the address of the ZCPR3 Resident -; Command Package and its size in 128-byte blocks. If there is no -; ZCPR3 Resident Command Package, both of these values should be 0. -; -RCP EQU 0E400H ; RESIDENT COMMAND PACKAGE -RCPS EQU 16 ; 16 128-byte Blocks (2K bytes) - - -; -; 7. IOP LOCATION -; -; The following equates define the address of the ZCPR3 Input/Output -; Package and its size in 128-byte blocks. If there is no ZCPR3 Input/Output -; Package, both of these values should be 0. -; -IOP EQU 0EC00H ; REDIRECTABLE I/O PACKAGE -IOPS EQU 12 ; 12 128-byte Blocks (1.5K bytes) - - -; -; 8. FCP LOCATION -; -; The following equates define the address of the ZCPR3 Flow Command -; Package and its size in 128-byte blocks. If there is no ZCPR3 Flow Command -; Package, both of these values should be 0. -; -FCP EQU 0F200H ; FLOW COMMAND PACKAGE -FCPS EQU 4 ; 4 128-byte Blocks (0.5K bytes) - - -; -; 9. ENV LOCATION -; -; The following equates define the address of the ZCPR3 Environment -; Descriptor and its size in 128-byte blocks. If there is no ZCPR3 Environment -; Descriptor, both of these values should be 0. -; -Z3ENV EQU 0F400H ; ENVIRONMENT DESCRIPTORS -Z3ENVS EQU 2 ; SIZE OF ENVIRONMENT DESCRIPTOR IN 128-BYTE BLOCKS - - -; -; 10. SHELL STACK -; -; The following equates define the address of the ZCPR3 Shell Stack, -; the number of entries permitted in the ZCPR3 Shell Stack, and the size -; of each entry in the Shell Stack in terms of bytes. If there is no ZCPR3 -; Shell Stack, all three values should be 0. -; -SHSTK EQU 0F500H ; ZCPR3 SHELL STACK -SHSTKS EQU 4 ; NUMBER OF SHSIZE-BYTE SHELL STACK ENTRIES -SHSIZE EQU 32 ; SIZE OF A SHELL STACK ENTRY - ; (STACK SIZE = SHSTKS * SHSIZE) - - -; -; 11. ZCPR3 MESSAGES -; -; The following equate defines the address of the ZCPR3 Message Buffer. -; This buffer is always 80 bytes long. If there is no ZCPR3 Message Buffer, -; this address should be 0. -; -Z3MSG EQU 0F580H ; ZCPR3 MESSAGE BUFFER - - -; -; 12. EXTERNAL FCB -; -; The following equate defines the address of the ZCPR3 External FCB. -; This buffer is always 36 bytes long. If there is no ZCPR3 External FCB, -; this address should be 0. -; -EXTFCB EQU 0F5D0H ; ZCPR3 EXTERNAL FCB - - -; -; 13. NAMED DIRECTORY BUFFER -; -; The following equates define the address and size (in terms of 18-byte -; entries) of the ZCPR3 Named Directory Buffer. If there is no such buffer, -; both of these values should be 0. -; -Z3NDIR EQU 0F600H ; ZCPR3 NAMED DIRECTORY AREA -Z3NDIRS EQU 14 ; 14 18-byte Named Directory Elements permitted - ; (NDIR SIZE = Z3NDIRS*18 + 1 for trailing 0) - - -; -; 14. COMMAND LINE -; -; The following equates define the address and size (in terms of bytes) -; of the ZCPR3 Command Line Buffer (formerly called the Multiple Command Line -; Buffer under ZCPR2). If there is no such buffer, both of these values should -; be 0. -; -Z3CL EQU 0F700H ; ZCPR3 COMMAND LINE BUFFER -Z3CLS EQU 200 ; SIZE OF COMMAND LINE BUFFER - - -; -; 15. EXTERNAL STACK -; -; The following equate defines the address of the ZCPR3 External Stack. -; This stack is always 48 bytes in size. If there is no such stack, this -; value should be 0. -; -EXTSTK EQU 0F7D0H ; ZCPR3 EXTERNAL STACK - - -; -; 16. USER EQUATES -; -; The following equates are available for the implementer's target -; system. These are implementation-defined. -; -DJEPROM EQU 0F800H ; EPROM BASE ADDRESS - - -;* -;* END of ZCPR3 BASE EQUATES -;* - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3BASE2.LIB b/Source/Images/d_bp/u15/Z3BASE2.LIB deleted file mode 100644 index 059b0bbc..00000000 --- a/Source/Images/d_bp/u15/Z3BASE2.LIB +++ /dev/null @@ -1,273 +0,0 @@ -; Z3BASE - Minimum Configuration -; Offset: 4100H - -;**************************************************************** -;* * -;* Z3BASE.LIB -- Base Addresses for ZCPR3 System * -;* by Richard Conn * -;* * -;* These addresses are used by the following System * -;* Segments: * -;* * -;* Segment Function * -;* ------- -------- * -;* ABOOTFD Boot System from Floppy Disk * -;* ABOOTHD Boot System from Hard Disk * -;* BDOSZ Customized BDOS * -;* CBIOSZ Customized BIOS * -;* ZCPR3 ZCPR3 Command Processor * -;* *.ENV All Environment Descriptors * -;* *.FCP All Flow Command Packages * -;* *.IOP All Input/Output Packages * -;* *.NDR All Named Directory Definition Files * -;* *.RCP All Resident Command Packages * -;* * -;* * -;* Memory Map of System: * -;* * -;* Address Range Size Function * -;* ------------- ------- -------- * -;* 0 - FF 256 b Standard CP/M Buffers except * -;* 40 - 4A 11 b for ZCPR3 External Path * -;* 4B 1 b Wheel Byte * -;* 100 - CFFF ~52 K TPA * -;* D000 - D7FF 2 K ZCPR3 Command Processor * -;* D800 - E5FF 3.5K BDOSZ * -;* E600 - F3FF 3.5K CBIOSZ with Buffers * -;* F400 - F4FF 256 b Environment Descriptors * -;* Bytes 00H-7FH: Z3 Parameters * -;* Bytes 80H-FFH: Z3 Terminal Cap * -;* F500 - F57F 128 b ZCPR3 Shell Stack * -;* F580 - F5CF 80 b ZCPR3 Message Buffers * -;* Byte 0: Error Flag (Z/NZ) * -;* Byte 1: IF (8 Levels) * -;* Byte 2: IF Active (8 Levels) * -;* Byte 3: Z3 Cmd Status * -;* 00B - Normal * -;* 01B - Shell * -;* 10B - Error * -;* Bytes 4&5: Error Address if 10B * -;* Byte 6: Program Error Code * -;* Byte 7: ZEX Message Byte * -;* 00B - Normal * -;* 01B - Z3 Prompt * -;* 10B - Suspend Intercept * -;* Byte 8: ZEX Running Flag (0=No) * -;* Bytes 9-10: Address of Next * -;* Char for ZEX to Return * -;* Bytes 11-12: Address of First * -;* Char in ZEX Memory- * -;* Based File Buffer * -;* Byte 13: SH Control Byte * -;* Bit 0: Enable SHCMT * -;* Bit 1: Enable SHECHO * -;* Bit 7: Enable Shell * -;* Entry Wait * -;* Bytes 14-15: Shell Scratch * -;* Bytes 10H-2FH: Error Cmd * -;* Bytes 30H-39H: Registers * -;* Bytes 3AH-3FH: Reserved * -;* Bytes 40H-4FH: User-Defined * -;* F5D0 - F5FF 48 b ZCPR3 External FCB * -;* F600 - F6FF 256 b Memory-Based Named Directory * -;* F700 - F7CF 208 b Multiple Command Line Buffer * -;* F7D0 - F7FF 48 b ZCPR3 External Stack * -;* F800 - FBFF 1 K Disk Controller EPROM * -;* FC00 - FFFF 1 K Disk Controller RAM * -;* * -;**************************************************************** - -; -; True and False -; -FALSE equ 0 -TRUE equ NOT FALSE - - -;* -;* ZCPR3 BASE EQUATES -;* - -; -; 1. VERSION NUMBERS, MEMORY SIZE, and CP/M BASE ADDRESS -; -; The following equates define the version numbers of the ZCPR3 -; Command Processor and the CBIOSZ. They also explicitly state the size -; of the TPA for inclusion in the CBIOSZ header printed at Cold Boot. -; -Z3REV EQU 30 ; ZCPR3 REV NUMBER -CBREV EQU 41 ; CBIOSZ REV NUMBER -MSIZE EQU 52 ; SIZE OF TPA -; -; BASE - Base Address of user's CP/M system (normally 0 for DR version) -; This equate allows easy modification by non-standard CP/M (eg,H89) -; -BASE EQU 0 - -; -; 2. PROCESSOR SELECTION -; -; The following equate selects the use of the 8080/8085 micro or -; the Z80 micro for the target for ZCPR3. Note that selecting the -; 8080/8085 should be done ONLY if you have an 8080 or 8085. If you have -; a Z80, by all means select this one since the code is much smaller and -; you can cram more features into the system as a result. -; If the processor is an 8080 or 8085, set this equate to TRUE. -; If the processor is a Z80, set it to FALSE. -; -I8080 EQU FALSE - -; -; 3. EXTERNAL PATH -; -; The following equates define the address of the ZCPR3 External -; Path and the number of two-byte elements contained in this path (maximum). -; If there is no ZCPR3 External Path, both of these values should be set to 0. -; -EXPATH EQU 40H ; EXTERNAL PATH -EXPATHS EQU 5 ; 5 2-byte Path Elements - ; (PATH SIZE = EXPATHS*2 + 1) - -; -; 4. WHEEL BYTE -; -; The following equate defines the address of the ZCPR3 Wheel Byte. -; If there is no ZCPR3 Wheel Byte, this value should be set to 0. -; -Z3WHL EQU 4BH ; WHEEL BYTE ADDRESS - - -; -; 5. CCP LOCATION -; -; The following equate defines the address of the ZCPR3 Command -; Processor. This address MUST be supplied. -; -CCP EQU 0D000H ; ZCPR3 COMMAND PROCESSOR - - -; -; 6. RCP LOCATION -; -; The following equates define the address of the ZCPR3 Resident -; Command Package and its size in 128-byte blocks. If there is no -; ZCPR3 Resident Command Package, both of these values should be 0. -; -RCP EQU 00000H ; RESIDENT COMMAND PACKAGE -RCPS EQU 00 ; 00 128-byte Blocks (0K bytes) - - -; -; 7. IOP LOCATION -; -; The following equates define the address of the ZCPR3 Input/Output -; Package and its size in 128-byte blocks. If there is no ZCPR3 Input/Output -; Package, both of these values should be 0. -; -IOP EQU 00000H ; REDIRECTABLE I/O PACKAGE -IOPS EQU 00 ; 00 128-byte Blocks (0K bytes) - - -; -; 8. FCP LOCATION -; -; The following equates define the address of the ZCPR3 Flow Command -; Package and its size in 128-byte blocks. If there is no ZCPR3 Flow Command -; Package, both of these values should be 0. -; -FCP EQU 00000H ; FLOW COMMAND PACKAGE -FCPS EQU 0 ; 0 128-byte Blocks (0K bytes) - - -; -; 9. ENV LOCATION -; -; The following equates define the address of the ZCPR3 Environment -; Descriptor and its size in 128-byte blocks. If there is no ZCPR3 Environment -; Descriptor, both of these values should be 0. -; -Z3ENV EQU 0F400H ; ENVIRONMENT DESCRIPTORS -Z3ENVS EQU 2 ; SIZE OF ENVIRONMENT DESCRIPTOR IN 128-BYTE BLOCKS - - -; -; 10. SHELL STACK -; -; The following equates define the address of the ZCPR3 Shell Stack, -; the number of entries permitted in the ZCPR3 Shell Stack, and the size -; of each entry in the Shell Stack in terms of bytes. If there is no ZCPR3 -; Shell Stack, all three values should be 0. -; -SHSTK EQU 0F500H ; ZCPR3 SHELL STACK -SHSTKS EQU 4 ; NUMBER OF SHSIZE-BYTE SHELL STACK ENTRIES -SHSIZE EQU 32 ; SIZE OF A SHELL STACK ENTRY - ; (STACK SIZE = SHSTKS * SHSIZE) - - -; -; 11. ZCPR3 MESSAGES -; -; The following equate defines the address of the ZCPR3 Message Buffer. -; This buffer is always 80 bytes long. If there is no ZCPR3 Message Buffer, -; this address should be 0. -; -Z3MSG EQU 0F580H ; ZCPR3 MESSAGE BUFFER - - -; -; 12. EXTERNAL FCB -; -; The following equate defines the address of the ZCPR3 External FCB. -; This buffer is always 36 bytes long. If there is no ZCPR3 External FCB, -; this address should be 0. -; -EXTFCB EQU 0F5D0H ; ZCPR3 EXTERNAL FCB - - -; -; 13. NAMED DIRECTORY BUFFER -; -; The following equates define the address and size (in terms of 18-byte -; entries) of the ZCPR3 Named Directory Buffer. If there is no such buffer, -; both of these values should be 0. -; -Z3NDIR EQU 0F600H ; ZCPR3 NAMED DIRECTORY AREA -Z3NDIRS EQU 14 ; 14 18-byte Named Directory Elements permitted - ; (NDIR SIZE = Z3NDIRS*18 + 1 for trailing 0) - - -; -; 14. COMMAND LINE -; -; The following equates define the address and size (in terms of bytes) -; of the ZCPR3 Command Line Buffer (formerly called the Multiple Command Line -; Buffer under ZCPR2). If there is no such buffer, both of these values should -; be 0. -; -Z3CL EQU 0F700H ; ZCPR3 COMMAND LINE BUFFER -Z3CLS EQU 200 ; SIZE OF COMMAND LINE BUFFER - - -; -; 15. EXTERNAL STACK -; -; The following equate defines the address of the ZCPR3 External Stack. -; This stack is always 48 bytes in size. If there is no such stack, this -; value should be 0. -; -EXTSTK EQU 0F7D0H ; ZCPR3 EXTERNAL STACK - - -; -; 16. USER EQUATES -; -; The following equates are available for the implementer's target -; system. These are implementation-defined. -; -DJEPROM EQU 0F800H ; EPROM BASE ADDRESS - - -;* -;* END of ZCPR3 BASE EQUATES -;* - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3FILES.PH1 b/Source/Images/d_bp/u15/Z3FILES.PH1 deleted file mode 100644 index 952b4976..00000000 --- a/Source/Images/d_bp/u15/Z3FILES.PH1 +++ /dev/null @@ -1,454 +0,0 @@ - - - Echelon, Inc. ZCPR3 Distribution Files, Phase 1 - (Copyright 1984 Richard Conn) - - ZCPR3 Core Disk 1 -- - Filename.Typ Size Recs CRC Lines - 1 ALIAS .COM 4K 30 669A N/A - 2 CD .COM 1K 7 49C8 N/A - 3 COMMENT .COM 1K 5 9629 N/A - 4 DIR .COM 2K 16 BE35 N/A - 5 ECHO .COM 1K 4 DB5A N/A - 6 ERROR1 .COM 2K 12 E682 N/A - 7 ERROR2 .COM 3K 18 A088 N/A - 8 HELP .COM 3K 24 5708 N/A - 9 LDR .COM 3K 20 517E N/A - 10 MENU .COM 4K 27 1591 N/A - 11 MENUCK .COM 3K 20 4F74 N/A - 12 MKDIR .COM 6K 41 148B N/A - 13 PATH .COM 2K 10 653A N/A - 14 PWD .COM 1K 8 5DA2 N/A - 15 SYSENV .ASM 1K 5 4C5C 30 - 16 SYSENV .LIB 4K 26 CF64 135 - 17 SYSIOP .ASM 32K 254 1DCD 1220 - 18 SYSNDR .ASM 1K 3 3872 16 - 19 SYSNDR .LIB 2K 10 DA46 82 - 20 Z3BASE1 .LIB 9K 66 2C69 275 - 21 Z3BASE2 .LIB 8K 64 17AD 272 - 22 Z3HDR1 .LIB 19K 150 6B50 608 - 23 Z3HDR2 .LIB 19K 150 2C19 608 - 24 ZCPR3 .ASM 66K 522 2857 2906 - 25 ZCPR3 .INS 4K 28 52CF 160 - - ZCPR3 Core Disk 2 -- - Filename.Typ Size Recs CRC Lines - 1 DISK7 .COM 4K 32 547C N/A - 2 DISK77B .COM 4K 32 1A90 N/A - 3 DISK77B .DOC 6K 45 88BE 95 - 4 PATH .COM 2K 10 653A N/A - 5 PRINT .COM 6K 42 1214 N/A - 6 SAK .COM 1K 7 8616 N/A - 7 SETFILE .COM 1K 4 28D4 N/A - 8 SHOW .COM 8K 62 A876 N/A - 9 SYSFCP .ASM 18K 137 7012 944 - 10 SYSRCP .ASM 44K 352 6315 2305 - 12 Z3TCAP .ASM 24K 189 3701 872 - 13 SYSFCP1 .LIB 6K 43 C3BB 213 - 14 SYSFCP2 .LIB 6K 43 2324 213 - 15 SYSRCP1 .LIB 11K 81 F030 366 - 16 SYSRCP2 .LIB 11K 81 790C 367 - 17 SYSRCP3 .LIB 11K 81 52FB 366 - 18 SYSRCP4 .LIB 11K 81 871D 366 - 19 SYSLIB .REL 21K 161 2921 N/A - 20 VLIB .REL 2K 13 01A1 N/A - 21 Z3LIB .REL 7K 56 61B8 N/A - 22 Z3TCAP .TCP 7K 51 FB17 N/A - - - ZCPR3 Utilities COM Disk 1 -- - Filename.Typ Size Recs CRC Version - 1 ALIAS .COM 4K 30 82D4 1.1 - 2 CD .COM 1K 7 DA48 3.0 - 3 CMDRUN .COM 1K 2 21B5 N/A - 4 COMMENT .COM 1K 5 3C4A 2.0 - 5 CPSEL .COM 1K 8 CCAA 1.0 - 6 CRC .COM 6K 41 A89C 2.0 - 7 DEV .COM 2K 14 F755 1.0 - 8 DEVICE .COM 3K 17 153E 1.0 - 9 DIFF .COM 4K 25 45A7 2.0 - 10 DIR .COM 2K 16 9B8A 1.0 - 11 ECHO .COM 1K 4 F2D6 1.0 - 12 ERASE .COM 3K 20 E71E 5.0 - 13 ERROR1 .COM 2K 12 5EB7 1.0 - 14 ERROR2 .COM 3K 18 2F03 1.0 - 15 ERROR3 .COM 1K 5 8542 1.0 - 16 ERROR4 .COM 1K 5 86D1 1.0 - 17 ERRORX .COM 1K 3 F941 1.0 - 18 FINDF .COM 2K 14 D2A6 2.0 - 19 GOTO .COM 1K 6 6ADA 1.0 - 20 HELP .COM 3K 24 928B 5.0 - 21 HELPCK .COM 2K 16 F3B3 1.0 - 22 HELPPR .COM 5K 35 12E7 1.0 - 23 IF .COM 3K 18 418D 1.1 - 24 IFSTAT .COM 1K 3 6586 1.0 - 25 LDR .COM 3K 20 517E 1.0 - 26 MCOPY .COM 4K 32 8341 4.0 - 27 MENU .COM 4K 27 8CED 3.2 - 28 MENUCK .COM 3K 20 3CDC 1.0 - 29 MKDIR .COM 6K 41 014B 3.0 - 30 NOTE .COM 1K 1 CB9E 1.0 - 31 PAGE .COM 5K 36 DF9F 2.0 - 32 PATH .COM 2K 10 E421 3.0 - 33 PRINT .COM 6K 42 0492 2.0 - 34 PROTECT .COM 4K 28 A130 3.0 - 35 PWD .COM 1K 8 2B9B 1.0 - 36 QUIET .COM 1K 4 DF6B 1.0 - 37 RECORD .COM 1K 8 C2B4 3.0 - 38 REG .COM 1K 8 1CC4 1.0 - 39 RENAME .COM 4K 27 A2F2 3.0 - 40 SAK .COM 1K 7 7842 2.0 - 41 SETFILE .COM 1K 4 00B2 1.0 - 42 SH .COM 4K 28 A89E 1.0 - 43 SHCTRL .COM 1K 7 E37A 1.0 - 44 SHDEFINE.COM 3K 23 0DEA 1.0 - 45 SHFILE .COM 1K 4 634F 1.0 - 46 SHOW .COM 8K 62 808A 1.0 - 47 SHVAR .COM 3K 23 4D89 1.0 - 48 SUB .COM 3K 20 59E5 3.0 - 49 TCCHECK .COM 2K 14 7235 1.0 - 50 TCMAKE .COM 6K 47 B3A0 1.0 - 51 TCSELECT.COM 3K 22 7C29 1.0 - 52 UNERASE .COM 2K 13 5057 1.0 - 53 WHEEL .COM 2K 11 0CD0 3.0 - 54 XD .COM 4K 28 465B 1.2 - 55 XDIR .COM 8K 62 7248 2.0 - 56 Z3INS .COM 2K 16 DFB7 1.0 - 57 Z3LOC .COM 1K 7 A908 1.0 - 58 ZEX .COM 6K 48 5E36 3.0 - - ZCPR3 Utilities HELP Disk 2 -- - Filename.Typ Size Recs CRC Lines - 1 ALIAS .HLP 5K 35 9C58 166 - 2 CMDFILES.HLP 24K 192 4475 728 - 3 COMPARE .HLP 5K 33 26B6 148 - 4 DIRS .HLP 21K 166 29F5 602 - 5 HELP .HLP 1K 7 54CD 20 - 6 HELPSYS .HLP 29K 230 99DA 792 - 7 IF .HLP 13K 99 45A4 457 - 8 IO .HLP 12K 92 21E3 389 - 9 MENU .HLP 32K 253 9059 892 - 10 NDIRS .HLP 16K 122 33D7 439 - 11 SH .HLP 13K 101 6646 419 - 12 SYSRCP .HLP 6K 48 F633 231 - - ZCPR3 Utilities HELP Disk 3 -- - Filename.Typ Size Recs CRC Lines - 1 Z3RES .HLP 8K 64 800E 221 - 2 Z3TCAP .HLP 40K 314 381F 1105 - 3 Z3UTIL1 .HLP 30K 234 4B2D 988 - 4 Z3UTIL2 .HLP 21K 166 D3E6 763 - 5 ZCPR3 .HLP 4K 30 666E 105 - - ZCPR3 Utilities Source Disk 4 -- - Filename.Typ Size Recs CRC Lines - 1 ALIAS .ZEX 2K 9 6DBE 63 - 2 ALIAS0 .MAC 8K 63 5072 431 - 3 ALIAS1 .MAC 10K 75 DB42 513 - 4 CD .MAC 3K 22 4202 151 - 5 CMDRUN .MAC 1K 7 F21D 50 - 6 COMMENT .MAC 4K 28 FF64 195 - 7 CPSEL .MAC 7K 52 2669 364 - 8 CRC .MAC 18K 141 15ED 914 - 9 DEV .MAC 9K 71 D980 492 - 10 DEVICE .MAC 11K 84 6EED 576 - 11 DIFF .MAC 15K 115 B983 724 - 12 DIR .MAC 7K 54 2227 373 - 13 ECHO .MAC 4K 28 824C 180 - 14 ERASE .MAC 10K 79 765E 492 - 15 ERROR1 .MAC 8K 57 7BF1 308 - 16 ERROR2 .MAC 9K 66 DFF6 367 - 17 ERROR3 .MAC 4K 27 85FA 153 - 18 ERROR4 .MAC 4K 31 D179 178 - 19 ERRORX .MAC 2K 9 7F9C 68 - 20 FINDF .MAC 22K 171 4220 1049 - 21 GOTO .MAC 4K 27 4536 203 - 22 HELP .MAC 25K 195 FF6A 1207 - 23 HELPCK .MAC 10K 77 A576 519 - 24 HELPPR .MAC 28K 219 CFB6 1380 - 25 IF .MAC 10K 77 F529 526 - 26 IFSTAT .MAC 2K 11 234E 85 - - ZCPR3 Utilities Source Disk 5 -- - Filename.Typ Size Recs CRC Lines - 1 LDR .MAC 11K 88 E5E0 552 - 2 MCOPY .MAC 22K 170 B694 1059 - 3 MENU .MAC 31K 241 D3F6 1509 - 4 MENUCK .MAC 11K 87 B04C 545 - 5 MKDIR .MAC 19K 145 64CB 981 - 6 NOTE .MAC 1K 7 986F 51 - 7 PAGE .MAC 24K 187 AEFF 1182 - 8 PATH .MAC 9K 69 7D6A 459 - 9 PRINT .MAC 28K 219 A093 1403 - 10 PROTECT .MAC 13K 97 E175 590 - 11 PWD .MAC 5K 37 DF00 248 - 12 QUIET .MAC 3K 17 FA09 138 - 13 RECORD .MAC 4K 30 4EE7 193 - 14 REG .MAC 5K 37 401A 266 - 15 RENAME .MAC 13K 103 C4F5 592 - 16 SAK .MAC 5K 38 62C2 244 - 17 SETFILE .MAC 2K 16 73D5 107 - 18 SHCTRL .MAC 3K 21 CAE6 147 - 19 SHOW .MAC 31K 247 8770 1752 - - ZCPR3 Utilities Source Disk 6 -- - Filename.Typ Size Recs CRC Lines - 1 SH .MAC 16K 125 768D 806 - 2 SHDEFINE.MAC 11K 87 396F 658 - 3 SHFILE .MAC 2K 15 3417 104 - 4 SHVAR .MAC 11K 88 6B60 655 - 5 SUB .MAC 23K 183 4AA9 1042 - 6 TCCHECK .MAC 5K 40 7079 280 - 7 TCMAKE .MAC 19K 148 A0C7 1084 - 8 TCSELECT.MAC 11K 87 927E 571 - 9 UNERASE .MAC 14K 110 A09A 726 - 10 WHEEL .MAC 4K 32 FFCF 217 - 11 XD .MAC 18K 144 B1B2 855 - 12 XDIR .MAC 38K 304 8B4B 1887 - 13 Z3INS .MAC 10K 80 7F27 539 - 14 Z3LOC .MAC 4K 30 3583 211 - 15 ZEX .ASM 45K 360 48BD 2194 - 16 ZEX .ZEX 4K 32 782C 180 - - ZCPR3 Utilities Documentation Disk 7 -- - Filename.Typ Size Recs CRC Lines - 1 Z3INS .IDX 4K 32 6044 232 - 2 Z3INS .SI 31K 241 836B 771 - 3 Z3INS .TOC 13K 101 D54E 207 - 4 Z3INS1 .SI 11K 85 30E0 267 - 5 Z3INS2 .SI 11K 88 2800 339 - 6 Z3INS3 .SI 55K 439 FCCF 1919 - 7 Z3INS4 .SI 28K 224 16D3 998 - 8 Z3INS5 .SI 5K 39 984C 153 - 9 Z3INS6 .SI 33K 259 D8A1 1014 - 10 Z3INS7 .SI 2K 12 F0A3 32 - 11 Z3INS8 .SI 5K 34 EB11 154 - - ZCPR3 Utilities Documentation Disk 8 -- - Filename.Typ Size Recs CRC Lines - 1 Z3USER .IDX 1K 3 9F34 30 - 2 Z3USER .SI 54K 428 7D58 1886 - 3 Z3USER .TOC 1K 6 1810 24 - - SYSLIB3 Source Disk 1 -- - Filename.Typ Size Recs CRC Lines - 1 S0FILEIO.MAC 2K 12 6AA7 86 - 2 S1FILEIO.MAC 2K 12 29E9 86 - 3 S2FILEIO.MAC 2K 12 EE8F 86 - 4 S3FILEIO.MAC 2K 12 B0F6 86 - 5 SALLOC .MAC 3K 22 F78F 113 - 6 SBBLINE .MAC 3K 17 1D79 88 - 7 SBDOS .MAC 1K 4 D833 26 - 8 SBIN .MAC 1K 4 AC82 27 - 9 SBIOS .MAC 3K 17 241E 79 - 10 SBIST .MAC 1K 4 3522 28 - 11 SBLINE .MAC 3K 21 1871 98 - 12 SBOUT .MAC 1K 4 4DF6 30 - 13 SCAPIN .MAC 1K 4 DF2E 28 - 14 SCAPS .MAC 1K 4 22F3 24 - 15 SCAPSTR .MAC 1K 5 FCEA 35 - 16 SCATH .MAC 1K 5 A665 33 - 17 SCCOUT .MAC 2K 9 A488 59 - 18 SCIN .MAC 1K 7 47D4 43 - 19 SCLINE .MAC 2K 11 583E 57 - 20 SCLOUT .MAC 2K 9 2A8B 59 - 21 SCODEND .MAC 1K 8 4F9C 44 - 22 SCOMP .MAC 2K 10 C619 56 - 23 SCOMPHD .MAC 1K 4 67BE 27 - 24 SCONDIN .MAC 1K 6 6666 33 - 25 SCOUT .MAC 1K 7 0A76 46 - 26 SCPOUT .MAC 2K 9 F3B0 59 - 27 SCRC .MAC 3K 24 9649 120 - 28 SCRC1 .MAC 3K 24 7A5D 120 - 29 SCRC2 .MAC 3K 23 E929 118 - 30 SCRLF .MAC 1K 6 6CD3 42 - 31 SCST .MAC 1K 7 B601 45 - 32 SDIR .MAC 2K 15 D2C8 64 - 33 SDIR00 .MAC 2K 15 D5BC 64 - 34 SDIR01 .MAC 2K 12 C259 63 - 35 SDIR02 .MAC 3K 17 5193 104 - 36 SDIR03 .MAC 3K 17 D263 85 - 37 SDIR04 .MAC 2K 11 5228 62 - 38 SDIR05 .MAC 7K 56 754A 282 - 39 SDIR06 .MAC 10K 79 D1DF 423 - 40 SDIR07 .MAC 3K 17 4FA3 111 - 41 SDIR08 .MAC 2K 12 4F2F 65 - 42 SDIR09 .MAC 2K 14 75BA 83 - 43 SDIR10 .MAC 2K 13 3DE7 72 - 44 SDIRBF .MAC 1K 5 F2DC 31 - 45 SDIRQ .MAC 17K 136 6004 708 - 46 SDIRQS .MAC 20K 155 51F3 786 - 47 SEN .MAC 1K 3 F9CF 23 - 48 SEPRINT .MAC 1K 5 2A31 26 - 49 SEPSTR .MAC 2K 15 68B3 91 - 50 SEVAL .MAC 4K 25 13D5 146 - 51 SEVAL1 .MAC 2K 9 782D 66 - 52 SEVAL2 .MAC 2K 11 1BDC 74 - 53 SEVAL3 .MAC 2K 10 BD45 66 - 54 SEVAL4 .MAC 2K 9 10A5 58 - 55 SFCLOS .MAC 1K 4 710C 33 - 56 SFDEL .MAC 1K 4 BB5B 28 - 57 SFEXIST .MAC 1K 5 2C94 31 - 58 SFILEIO .MAC 9K 72 4F9C 418 - 59 SFILL .MAC 2K 10 A547 70 - 60 SFMAKE .MAC 1K 5 5A73 31 - - SYSLIB3 Source Disk 2 -- - Filename.Typ Size Recs CRC Lines - 1 SFNAME .MAC 5K 39 EB46 245 - 2 SFOPEN .MAC 2K 10 6B08 64 - 3 SFREAD .MAC 1K 4 3E4E 30 - 4 SFRENAME.MAC 2K 12 6A58 80 - 5 SFSIZE .MAC 2K 12 DCDF 91 - 6 SFWRIT .MAC 1K 4 67E3 30 - 7 SFXIO .MAC 9K 65 7928 406 - 8 SGFA .MAC 3K 20 DDA9 130 - 9 SGUA .MAC 1K 5 C628 43 - 10 SINITFCB.MAC 1K 8 FFE8 47 - 11 SINLINE .MAC 6K 44 4103 285 - 12 SINSTR .MAC 2K 12 3077 71 - 13 SISALNUM.MAC 1K 6 2867 40 - 14 SISALPHA.MAC 1K 6 02B4 41 - 15 SISCTRL .MAC 1K 6 533C 40 - 16 SISDIGIT.MAC 1K 6 EDAB 38 - 17 SISGRAPH.MAC 1K 6 EEF8 38 - 18 SISHEX .MAC 1K 6 1958 43 - 19 SISPRINT.MAC 1K 6 EC30 38 - 20 SISPUN .MAC 2K 9 0F59 58 - 21 SISSP .MAC 1K 8 7B4B 59 - 22 SLA2HC .MAC 1K 6 70AD 38 - 23 SLADC .MAC 2K 11 72AE 75 - 24 SLAFDC .MAC 2K 10 843B 62 - 25 SLCRLF .MAC 1K 6 A98A 42 - 26 SLFN1 .MAC 1K 6 A6FF 40 - 27 SLFN2 .MAC 1K 6 82BC 41 - 28 SLFN3 .MAC 1K 8 658E 54 - 29 SLHL4HC .MAC 1K 4 DBC3 28 - 30 SLHL5DC .MAC 2K 14 7961 93 - 31 SLHLFDC .MAC 2K 12 2F66 82 - 32 SLOUT .MAC 1K 7 4084 46 - 33 SLPRINT .MAC 1K 4 67D0 25 - 34 SLPSTR .MAC 2K 14 65D7 90 - 35 SMA2HC .MAC 1K 8 0DC7 40 - 36 SMADC .MAC 2K 14 016F 84 - 37 SMAFDC .MAC 2K 12 BEC3 70 - 38 SMFN1 .MAC 1K 6 3A43 42 - 39 SMFN2 .MAC 1K 6 C23B 45 - 40 SMFN3 .MAC 1K 8 002A 57 - 41 SMHL4HC .MAC 1K 5 9C15 28 - 42 SMHL5DC .MAC 3K 19 F0F5 115 - 43 SMHLFDC .MAC 2K 16 1C5D 108 - 44 SMOVE .MAC 3K 19 67FF 131 - 45 SMTH01 .MAC 1K 4 FD05 33 - 46 SMTH02 .MAC 1K 5 47EC 33 - 47 SMTH03 .MAC 1K 4 8800 30 - 48 SMTH04 .MAC 1K 4 FAD3 28 - 49 SMTH05 .MAC 1K 5 41F7 34 - 50 SMTH06 .MAC 1K 5 9661 34 - 51 SMTH07 .MAC 1K 3 78BD 26 - 52 SMTH08 .MAC 1K 3 AD88 26 - 53 SMTH09 .MAC 1K 3 3EC8 26 - 54 SMTH10 .MAC 1K 4 729D 34 - 55 SMTH11 .MAC 2K 13 7150 98 - 56 SMTH12 .MAC 2K 13 E277 95 - -.cp 5 - SYSLIB3 REL and Source Disk 3 -- - Filename.Typ Size Recs CRC Lines - 1 SPA2HC .MAC 1K 6 FD07 38 - 2 SPADC .MAC 2K 11 35AA 74 - 3 SPAFDC .MAC 2K 10 8746 62 - 4 SPAUSE .MAC 3K 23 A2B8 123 - 5 SPFN1 .MAC 1K 6 5BD1 40 - 6 SPFN2 .MAC 1K 6 6756 41 - 7 SPFN3 .MAC 1K 8 B9E6 54 - 8 SPHL4HC .MAC 1K 4 3F9B 28 - 9 SPHL5DC .MAC 2K 14 D706 92 - 10 SPHLFDC .MAC 2K 12 A7C8 82 - 11 SPOUT .MAC 1K 7 915C 46 - 12 SPRINT .MAC 1K 4 A2A3 25 - 13 SPSTR .MAC 2K 14 A7FD 90 - 14 SRAND .MAC 2K 13 476E 81 - 15 SRIN .MAC 1K 7 1844 43 - 16 SRREAD .MAC 2K 9 F01A 58 - 17 SRWRITE .MAC 2K 9 35C7 58 - 18 SSA2HC .MAC 1K 6 6057 38 - 19 SSADC .MAC 2K 11 1A64 75 - 20 SSAFDC .MAC 2K 10 B9F3 62 - 21 SSCANNER.MAC 2K 12 C2D3 73 - 22 SSCFA .MAC 2K 16 E939 117 - 23 SSCOUT .MAC 1K 6 0636 39 - 24 SSCRLF .MAC 1K 5 6327 33 - 25 SSCTLFL .MAC 1K 4 D7AB 21 - 26 SSFA .MAC 2K 16 9FAC 117 - 27 SSFN1 .MAC 1K 6 A43E 41 - 28 SSFN2 .MAC 1K 6 0E8D 42 - 29 SSFN3 .MAC 1K 8 C4B7 55 - 30 SSHL4HC .MAC 1K 4 4D97 28 - 31 SSHL5DC .MAC 2K 14 6FBA 93 - 32 SSHLFDC .MAC 2K 13 C39D 82 - 33 SSKPUN .MAC 1K 8 A057 48 - 34 SSKSP .MAC 1K 8 490D 48 - 35 SSORT .MAC 14K 111 E332 564 - 36 SSOUT .MAC 1K 5 CA1A 39 - 37 SSPRINT .MAC 1K 4 42CC 26 - 38 SSPSTR .MAC 2K 14 9D1B 89 - 39 SSUA .MAC 1K 6 EA5F 47 - 40 SUD1 .MAC 1K 8 635C 74 - 41 SUD2 .MAC 1K 5 589A 50 - 42 SUD3 .MAC 1K 6 A69A 50 - 43 SVERSION.MAC 1K 5 F1A9 30 - 44 SYSLIB .REL 21K 161 2921 N/A - 45 SYSLIB27.REL 14K 107 1C54 N/A - 46 SYSTEST .MAC 4K 26 C997 129 - 47 SYSTEST0.MAC 4K 29 B39E 194 - 48 SYSTEST1.MAC 3K 21 5D8C 114 - 49 SYSTEST2.MAC 4K 30 9E05 151 - 50 SYSTEST3.MAC 4K 26 92EA 148 - 51 SYSTEST4.MAC 6K 46 02CE 244 - 52 SYSTEST5.MAC 2K 16 2DAF 98 - 53 SYSTEST6.MAC 5K 35 A9F5 211 - 54 SYSTEST7.MAC 5K 36 5138 233 - - SYSLIB3 HELP Disk 4 -- - Filename.Typ Size Recs CRC Lines - 1 SYS2-3 .TXT 9K 71 6B3B 239 - 2 SYSLIB .HLP 2K 9 8184 38 - 3 SYSLIB0 .HLP 14K 112 86FE 355 - 4 SYSLIB1 .HLP 20K 159 8FBB 588 - 5 SYSLIB2 .HLP 5K 33 6DD5 154 - 6 SYSLIB3 .HLP 15K 119 F85C 435 - 7 SYSLIB4 .HLP 12K 90 E7A6 390 - 8 SYSLIB5 .HLP 12K 90 F417 412 - 9 SYSLIB6 .HLP 8K 60 F45A 276 - 10 SYSLIB7 .HLP 6K 45 152C 266 - 11 SYSLIB8 .HLP 5K 37 3CA8 173 - 12 SYSLIB9 .HLP 3K 23 4292 82 - 13 SYSLIBA .HLP 7K 55 6442 192 - 14 SYSLIBB .HLP 5K 39 2009 126 - 15 SYSLIBC .HLP 9K 71 F96C 302 - 16 SYSLIBD .HLP 5K 33 489A 134 - 17 SYSLIBE .HLP 8K 62 55D3 232 - 18 SYSLIBF .HLP 4K 25 2A54 104 - 19 SYSLIBG .HLP 3K 21 EE4C 88 - 20 SYSLIBH .HLP 2K 14 6F02 67 - 21 SYSLIBI .HLP 6K 44 DC1E 158 - - - Z3-DOT-COM Disk 1 -- - (Copyright 1984 Alpha Systems Corporation) - Filename.Typ Size Recs CRC - 1 CPY .COM 2K 15 B43A - 2 ENV .SPR 2K 10 BA1F - 3 SYSFCP .SPR 1K 7 DBE6 - 4 SYSRCP .SPR 3K 20 BDBD - 5 VID .COM 2K 12 AF2F - 6 Z3 .INS 1K 1 E205 - 7 Z3BIO .SPR 1K 7 9FE6 - 8 Z3COM .SUB 1K 1 2899 - 9 Z3CPR .SPR 3K 20 2A87 - 10 Z3L .COM 2K 15 D40E - 11 Z3MOV .BIN 1K 1 D93B - - - diff --git a/Source/Images/d_bp/u15/Z3FILES.PH2 b/Source/Images/d_bp/u15/Z3FILES.PH2 deleted file mode 100644 index b43cc0ce..00000000 --- a/Source/Images/d_bp/u15/Z3FILES.PH2 +++ /dev/null @@ -1,266 +0,0 @@ -.po 7 -.cw 10 -.foZCPR3 File Distribution Page # - - - ZCPR3 Files Distributed by Echelon, Inc. - - -ZCPR3 Core Disk 1 -- - Filename.Typ Size Recs CRC - 1 ALIAS .COM 4K 30 669A 12 SYSRCP .ASM 44K 352 6315 - 2 CD .COM 1K 7 49C8 13 SYSRCP1 .LIB 11K 81 F030 - 3 CLEANDIR.COM 2K 12 ADAF 14 SYSRCP2 .LIB 11K 81 790C - 4 CMD .COM 1K 7 ED3B 15 SYSRCP3 .LIB 11K 81 52FB - 5 COMMENT .COM 1K 5 9629 16 SYSRCP4 .LIB 11K 81 871D - 6 DIR .COM 2K 16 BE35 17 TCCHECK .COM 2K 14 0578 - 7 ECHO .COM 1K 4 DB5A 18 TCMAKE .COM 6K 47 817E - 8 ERROR1 .COM 2K 12 E682 19 TCSELECT.COM 3K 22 694E - 9 ERROR2 .COM 3K 18 A088 20 VLIB .REL 2K 13 01A1 - 10 EX .COM 3K 20 8344 21 WHEEL .COM 2K 11 1B9A - 11 HELP .COM 3K 24 1847 22 XD .COM 4K 28 B251 - 12 LDR .COM 3K 21 FFC4 23 Z3INS .COM 2K 16 611D - 13 MENU .COM 4K 29 E81F 24 Z3LIB .REL 8K 61 8F30 - 14 MENUCK .COM 3K 20 4F74 25 Z3LOC .COM 1K 7 0001 - 15 MKDIR .COM 6K 41 49D9 26 Z3TCAP .ASM 27K 213 1B36 - 16 MLOAD .COM 2K 15 5BF0 27 Z3TCAP .TCP 8K 58 D2C1 - 17 MU3 .COM 3K 23 55BD 28 ZCPR3 .INS 2K 10 7557 - 18 PATH .COM 2K 10 653A - 19 PWD .COM 1K 8 5DA2 ZCPR3 Utilities COM Disk 1 -- - 20 RELS .UTL 2K 16 6BF8 Filename.Typ Size Recs CRC - 21 SHSET .COM 1K 7 4F00 1 ALIAS .COM 4K 30 82D4 - 22 SYSENV .ASM 1K 5 4C5C 2 CD .COM 1K 7 DA48 - 23 SYSENV .LIB 4K 26 CF64 3 CMDRUN .COM 1K 2 21B5 - 24 SYSIOP .ASM 32K 254 1DCD 4 COMMENT .COM 1K 5 3C4A - 25 SYSNDR .ASM 1K 3 3872 5 CPSEL .COM 1K 8 CCAA - 26 SYSNDR .LIB 2K 10 DA46 6 CRC .COM 6K 41 A89C - 27 VFILER .COM 11K 84 8923 7 DEV .COM 2K 14 F755 - 28 VMENU .COM 6K 46 A582 8 DEVICE .COM 3K 17 153E - 29 VMENUCK .COM 3K 21 9E17 9 DIFF .COM 4K 25 45A7 - 30 Z3BASE1 .LIB 9K 66 2C69 10 DIR .COM 2K 16 9B8A - 31 Z3BASE2 .LIB 8K 64 17AD 11 DISK7OCC.COM 4K 32 1A90 - 32 Z3HDR1 .LIB 19K 150 6B50 12 DU3 .COM 12K 89 D1BF -.he ZCPR3 File List - 33 Z3HDR2 .LIB 19K 150 2C19 13 ECHO .COM 1K 4 F2D6 - 34 ZCPR3 .ASM 66K 522 2857 14 ERASE .COM 3K 20 E71E - 35 ZCPR3 .INS 2K 10 7557 15 ERROR1 .COM 2K 12 5EB7 - 16 ERROR2 .COM 3K 18 2F03 -ZCPR3 Core Disk 2 -- 17 ERROR3 .COM 1K 5 8542 - Filename.Typ Size Recs CRC 18 ERROR4 .COM 1K 5 86D1 - 1 DISK7 .COM 4K 32 1A90 19 ERRORX .COM 1K 3 F941 - 2 DISK77B .DOC 6K 45 88BE 20 FINDF .COM 2K 14 48F6 - 3 PATH .COM 2K 10 653A 21 GOTO .COM 1K 6 6ADA - 4 PRINT .COM 6K 42 1214 22 HELP .COM 3K 24 928B - 5 SAK .COM 1K 7 8616 23 HELPCK .COM 2K 16 F3B3 - 6 SETFILE .COM 1K 4 28D4 24 HELPPR .COM 5K 35 12E7 - 7 SHOW .COM 8K 62 A876 25 IF .COM 3K 18 418D - 8 SYSFCP .ASM 18K 137 7012 26 IFSTAT .COM 1K 3 6586 - 9 SYSFCP1 .LIB 6K 43 C3BB 27 LDR .COM 3K 21 FFC4 - 10 SYSFCP2 .LIB 6K 43 2324 28 MCOPY .COM 5K 33 A9F4 - 11 SYSLIB .REL 21K 161 2921 29 MENU .COM 4K 29 E81F - - 30 MENUCK .COM 3K 20 3CDC ZCPR3 Utilities HELP Disk 3 -- - 31 MKDIR .COM 6K 41 49D9 Filename.Typ Size Recs CRC - 32 MU3 .COM 3K 23 55BD 1 CLEANDIR.COM 2K 12 ADAF - 33 NOTE .COM 1K 1 CB9E 2 CMD .COM 1K 7 ED3B - 34 PAGE .COM 5K 36 DF9F 3 DU3 .HLP 38K 300 B790 - 35 PATH .COM 2K 10 E421 4 MU3 .HLP 7K 50 20CF - 36 PRINT .COM 6K 42 0492 5 SHSET .COM 1K 7 4F00 - 37 PROTECT .COM 4K 28 A130 6 VFILER .HLP 21K 165 40BB - 38 PWD .COM 1K 8 2B9B 7 VMENU .COM 6K 46 A582 - 39 QUIET .COM 1K 4 DF6B 8 VMENU .HLP 32K 253 7DE7 - 40 RECORD .COM 1K 8 C2B4 9 VMENUCK .COM 3K 21 9E17 - 41 REG .COM 1K 8 1CC4 10 Z3RES .HLP 8K 64 800E - 42 RENAME .COM 4K 27 A2F2 11 Z3TCAP .HLP 40K 314 381F - 43 SAK .COM 1K 7 7842 12 Z3UTIL1 .HLP 30K 234 4B2D - 44 SETFILE .COM 1K 4 00B2 13 Z3UTIL2 .HLP 21K 166 D3E6 - 45 SH .COM 4K 28 A89E 14 Z3UTIL3 .HLP 7K 52 0A0F - 46 SHCTRL .COM 1K 7 E37A 15 ZCPR3 .HLP 4K 30 666E - 47 SHDEFINE.COM 3K 23 0DEA - 48 SHFILE .COM 1K 4 634F  ZCPR3 Utilities Source Disk 4 -- - 49 SHOW .COM 8K 62 808A Filename.Typ Size Recs CRC - 50 SHVAR .COM 3K 23 4D89 1 ALIAS .ZEX 2K 9 6DBE - 51 SUB .COM 3K 20 59E5 2 ALIAS0 .MAC 8K 63 5072 - 52 TCCHECK .COM 2K 14 7235 3 ALIAS1 .MAC 10K 75 DB42 - 53 TCMAKE .COM 6K 47 B3A0 4 CD .MAC 3K 22 4202 - 54 TCSELECT.COM 3K 22 F8DA 5 CMDRUN .MAC 1K 7 F21D - 55 UNERASE .COM 2K 13 030A 6 COMMENT .MAC 4K 28 FF64 - 56 VFILER .COM 11K 84 8923 7 CPSEL .MAC 7K 52 2669 - 57 WHEEL .COM 2K 11 0CD0 8 CRC .MAC 18K 141 15ED - 58 XD .COM 4K 28 465B 9 DEV .MAC 9K 71 D980 - 59 XDIR .COM 8K 62 7248 10 DEVICE .MAC 11K 84 6EED - 60 Z3INS .COM 2K 16 DFB7 11 DIFF .MAC 15K 115 B983 - 61 Z3LOC .COM 1K 7 E319 12 DIR .MAC 7K 54 2227 - 62 ZCPR3 .INS 2K 10 7557 13 ECHO .MAC 4K 28 824C - 63 ZEX .COM 6K 48 5E36 14 ERASE .MAC 10K 79 765E - 15 ERROR1 .MAC 8K 57 7BF1 -ZCPR3 Utilities HELP Disk 2 -- 16 ERROR2 .MAC 9K 66 DFF6 - Filename.Typ Size Recs CRC 17 ERROR3 .MAC 4K 27 85FA - 1 ALIAS .HLP 5K 35 9C58 18 ERROR4 .MAC 4K 31 D179 - 2 CMDFILES.HLP 24K 192 4475 19 ERRORX .MAC 2K 9 7F9C - 3 COMPARE .HLP 5K 33 26B6 20 FINDF .COM 2K 14 48F6 - 4 DEBUGRCP.ASM 28K 218 454D 21 GOTO .MAC 4K 27 4536 - 5 DIRS .HLP 21K 166 29F5 22 HELP51 .MAC 25K 196 73A1 - 6 DPROG .MAC 19K 148 F153 23 HELPCK .MAC 10K 77 A576 - 7 HELP .HLP 1K 7 54CD 24 HELPPR .MAC 28K 219 CFB6 - 8 HELPSYS .HLP 29K 230 99DA 25 IF .MAC 10K 77 F529 - 9 IF .HLP 13K 99 45A4 26 IFSTAT .MAC 2K 11 234E - 10 IO .HLP 12K 92 21E3 - 11 MENU .HLP 32K 253 9059  ZCPR3 Utilities Source Disk 5 -- - 12 NDIRS .HLP 16K 122 33D7 Filename.Typ Size Recs CRC - 13 READ .ME 1K 3 9089 1 LDR11 .MAC 13K 97 F1DA - 14 SH .HLP 13K 101 6646 2 MCOPY41 .MAC 22K 172 D935 - 15 SYSRCP .HLP 6K 48 F633 3 MENU34 .MAC 32K 253 56E5 - 16 ZCPR3 .HLP 4K 30 666E 4 MENUCK .MAC 11K 87 B04C - - - - 5 MKDIR31 .MAC 19K 145 AB4B  SYSLIB3 Source Disk 1 -- - 6 NOTE .MAC 1K 7 986F Filename.Typ Size Recs CRC - 7 PAGE .MAC 24K 187 AEFF 1 S0FILEIO.MAC 2K 12 6AA7 - 8 PATH .MAC 9K 69 7D6A 2 S1FILEIO.MAC 2K 12 29E9 - 9 PRINT .MAC 28K 219 A093 3 S2FILEIO.MAC 2K 12 EE8F - 10 PROTECT .MAC 13K 97 E175 4 S3FILEIO.MAC 2K 12 B0F6 - 11 PWD .MAC 5K 37 DF00 5 SALLOC .MAC 3K 22 F78F - 12 QUIET .MAC 3K 17 FA09 6 SBBLINE .MAC 3K 17 1D79 - 13 RECORD .MAC 4K 30 4EE7 7 SBDOS .MAC 1K 4 D833 - 14 REG .MAC 5K 37 401A 8 SBIN .MAC 1K 4 AC82 - 15 RENAME .MAC 13K 103 C4F5 9 SBIOS .MAC 3K 17 241E - 16 SAK .MAC 5K 38 62C2 10 SBIST .MAC 1K 4 3522 - 17 SHOW .MAC 31K 247 8770 11 SBLINE .MAC 3K 21 1871 - 12 SBOUT .MAC 1K 4 4DF6 -ZCPR3 Utilities Source Disk 6 -- 13 SCAPIN .MAC 1K 4 DF2E - Filename.Typ Size Recs CRC 14 SCAPS .MAC 1K 4 22F3 - 1 SETFILE .MAC 2K 16 73D5 15 SCAPSTR .MAC 1K 5 FCEA - 2 SH .MAC 16K 125 768D 16 SCATH .MAC 1K 5 A665 - 3 SHCTRL .MAC 3K 21 CAE6 17 SCCOUT .MAC 2K 9 A488 - 4 SHDEFINE.MAC 11K 87 396F 18 SCIN .MAC 1K 7 47D4 - 5 SHFILE .MAC 2K 15 3417 19 SCLINE .MAC 2K 11 583E - 6 SHVAR .MAC 11K 88 6B60 20 SCLOUT .MAC 2K 9 2A8B - 7 SUB31 .MAC 24K 187 945E 21 SCODEND .MAC 1K 8 4F9C - 8 TCCHECK .MAC 5K 40 7079 22 SCOMP .MAC 2K 10 C619 - 9 TCMAKE .MAC 19K 148 A0C7 23 SCOMPHD .MAC 1K 4 67BE - 10 TCSELECT.MAC 11K 87 927E 24 SCONDIN .MAC 1K 6 6666 - 11 UNERASE .MAC 14K 111 41BF 25 SCOUT .MAC 1K 7 0A76 - 12 WHEEL .MAC 4K 32 FFCF 26 SCPOUT .MAC 2K 9 F3B0 - 13 XD .MAC 18K 144 B1B2 27 SCRC .MAC 3K 24 9649 - 14 XDIR .MAC 38K 304 8B4B 28 SCRC1 .MAC 3K 24 7A5D - 15 Z3INS .MAC 10K 80 7F27 29 SCRC2 .MAC 3K 23 E929 - 16 Z3LOC11 .MAC 4K 32 7C65 30 SCRLF .MAC 1K 6 6CD3 - 17 ZEX .ASM 45K 360 48BD 31 SCST .MAC 1K 7 B601 - 18 ZEX .ZEX 4K 32 782C 32 SDIR .MAC 2K 15 D2C8 - 33 SDIR00 .MAC 2K 15 D5BC -ZCPR3 Utilities Doc Disk 7 -- 34 SDIR01 .MAC 2K 12 C259 - Filename.Typ Size Recs CRC 35 SDIR02 .MAC 3K 17 5193 - 1 Z3INS .IDX 4K 32 6044 36 SDIR03 .MAC 3K 17 D263 - 2 Z3INS .SI 31K 241 836B 37 SDIR04 .MAC 2K 11 5228 - 3 Z3INS .TOC 13K 101 D54E 38 SDIR05 .MAC 7K 56 754A - 4 Z3INS1 .SI 11K 85 30E0 39 SDIR06 .MAC 10K 79 D1DF - 5 Z3INS2 .SI 11K 88 2800 40 SDIR07 .MAC 3K 17 4FA3 - 6 Z3INS3 .SI 55K 439 FCCF 41 SDIR08 .MAC 2K 12 4F2F - 7 Z3INS4 .SI 28K 224 16D3 42 SDIR09 .MAC 2K 14 75BA - 8 Z3INS5 .SI 5K 39 984C 43 SDIR10 .MAC 2K 13 3DE7 - 9 Z3INS6 .SI 33K 259 D8A1 44 SDIRBF .MAC 1K 5 F2DC - 10 Z3INS7 .SI 2K 12 F0A3 45 SDIRQ .MAC 17K 136 6004 - 11 Z3INS8 .SI 5K 34 EB11 46 SDIRQS .MAC 20K 155 51F3 - 47 SEN .MAC 1K 3 F9CF -ZCPR3 Utilities Doc Disk 8 -- 48 SEPRINT .MAC 1K 5 2A31 - Filename.Typ Size Recs CRC 49 SEPSTR .MAC 2K 15 68B3 - 1 Z3USER .IDX 1K 3 9F34 50 SEVAL .MAC 4K 25 13D5 - 2 Z3USER .SI 54K 428 7D58 51 SEVAL1 .MAC 2K 9 782D - 3 Z3USER .TOC 1K 6 1810 52 SEVAL2 .MAC 2K 11 1BDC - 53 SEVAL3 .MAC 2K 10 BD45 - 54 SEVAL4 .MAC 2K 9 10A5 46 SMTH02 .MAC 1K 5 47EC - 55 SFCLOS .MAC 1K 4 710C 47 SMTH03 .MAC 1K 4 8800 - 56 SFDEL .MAC 1K 4 BB5B 48 SMTH04 .MAC 1K 4 FAD3 - 57 SFEXIST .MAC 1K 5 2C94 49 SMTH05 .MAC 1K 5 41F7 - 58 SFILEIO .MAC 9K 72 4F9C 50 SMTH06 .MAC 1K 5 9661 - 59 SFILL .MAC 2K 10 A547 51 SMTH07 .MAC 1K 3 78BD - 60 SFMAKE .MAC 1K 5 5A73 52 SMTH08 .MAC 1K 3 AD88 - 53 SMTH09 .MAC 1K 3 3EC8 -SYSLIB3 Source Disk 2 -- 54 SMTH10 .MAC 1K 4 729D - Filename.Typ Size Recs CRC 55 SMTH11 .MAC 2K 13 7150 - 1 SFNAME .MAC 5K 39 EB46 56 SMTH12 .MAC 2K 13 E277 - 2 SFOPEN .MAC 2K 10 6B08 - 3 SFREAD .MAC 1K 4 3E4E  SYSLIB3 REL and Source Disk 3 -- - 4 SFRENAME.MAC 2K 12 6A58 Filename.Typ Size Recs CRC - 5 SFSIZE .MAC 2K 12 DCDF 1 SPA2HC .MAC 1K 6 FD07 - 6 SFWRIT .MAC 1K 4 67E3 2 SPADC .MAC 2K 11 35AA - 7 SFXIO .MAC 9K 65 7928 3 SPAFDC .MAC 2K 10 8746 - 8 SGFA .MAC 3K 20 DDA9 4 SPAUSE .MAC 3K 23 A2B8 - 9 SGUA .MAC 1K 5 C628 5 SPFN1 .MAC 1K 6 5BD1 - 10 SINITFCB.MAC 1K 8 FFE8 6 SPFN2 .MAC 1K 6 6756 - 11 SINLINE .MAC 6K 44 4103 7 SPFN3 .MAC 1K 8 B9E6 - 12 SINSTR .MAC 2K 12 3077 8 SPHL4HC .MAC 1K 4 3F9B - 13 SISALNUM.MAC 1K 6 2867 9 SPHL5DC .MAC 2K 14 D706 - 14 SISALPHA.MAC 1K 6 02B4 10 SPHLFDC .MAC 2K 12 A7C8 - 15 SISCTRL .MAC 1K 6 533C 11 SPOUT .MAC 1K 7 915C - 16 SISDIGIT.MAC 1K 6 EDAB 12 SPRINT .MAC 1K 4 A2A3 - 17 SISGRAPH.MAC 1K 6 EEF8 13 SPSTR .MAC 2K 14 A7FD - 18 SISHEX .MAC 1K 6 1958 14 SRAND .MAC 2K 13 476E - 19 SISPRINT.MAC 1K 6 EC30 15 SRIN .MAC 1K 7 1844 - 20 SISPUN .MAC 2K 9 0F59 16 SRREAD .MAC 2K 9 F01A - 21 SISSP .MAC 1K 8 7B4B 17 SRWRITE .MAC 2K 9 35C7 - 22 SLA2HC .MAC 1K 6 70AD 18 SSA2HC .MAC 1K 6 6057 - 23 SLADC .MAC 2K 11 72AE 19 SSADC .MAC 2K 11 1A64 - 24 SLAFDC .MAC 2K 10 843B 20 SSAFDC .MAC 2K 10 B9F3 - 25 SLCRLF .MAC 1K 6 A98A 21 SSCANNER.MAC 2K 12 C2D3 - 26 SLFN1 .MAC 1K 6 A6FF 22 SSCFA .MAC 2K 16 E939 - 27 SLFN2 .MAC 1K 6 82BC 23 SSCOUT .MAC 1K 6 0636 - 28 SLFN3 .MAC 1K 8 658E 24 SSCRLF .MAC 1K 5 6327 - 29 SLHL4HC .MAC 1K 4 DBC3 25 SSCTLFL .MAC 1K 4 D7AB - 30 SLHL5DC .MAC 2K 14 7961 26 SSFA .MAC 2K 16 9FAC - 31 SLHLFDC .MAC 2K 12 2F66 27 SSFN1 .MAC 1K 6 A43E - 32 SLOUT .MAC 1K 7 4084 28 SSFN2 .MAC 1K 6 0E8D - 33 SLPRINT .MAC 1K 4 67D0 29 SSFN3 .MAC 1K 8 C4B7 - 34 SLPSTR .MAC 2K 14 65D7 30 SSHL4HC .MAC 1K 4 4D97 - 35 SMA2HC .MAC 1K 8 0DC7 31 SSHL5DC .MAC 2K 14 6FBA - 36 SMADC .MAC 2K 14 016F 32 SSHLFDC .MAC 2K 13 C39D - 37 SMAFDC .MAC 2K 12 BEC3 33 SSKPUN .MAC 1K 8 A057 - 38 SMFN1 .MAC 1K 6 3A43 34 SSKSP .MAC 1K 8 490D - 39 SMFN2 .MAC 1K 6 C23B 35 SSORT .MAC 14K 111 E332 - 40 SMFN3 .MAC 1K 8 002A 36 SSOUT .MAC 1K 5 CA1A - 41 SMHL4HC .MAC 1K 5 9C15 37 SSPRINT .MAC 1K 4 42CC - 42 SMHL5DC .MAC 3K 19 F0F5 38 SSPSTR .MAC 2K 14 9D1B - 43 SMHLFDC .MAC 2K 16 1C5D 39 SSUA .MAC 1K 6 EA5F - 44 SMOVE .MAC 3K 19 67FF 40 SUD1 .MAC 1K 8 635C - 45 SMTH01 .MAC 1K 4 FD05 41 SUD2 .MAC 1K 5 589A - - 42 SUD3 .MAC 1K 6 A69A - 43 SVERSION.MAC 1K 5 F1A9 - 44 SYSLIB .REL 21K 161 2921 - 45 SYSLIB27.REL 14K 107 1C54 - 46 SYSTEST .MAC 4K 26 C997 - 47 SYSTEST0.MAC 4K 29 B39E - 48 SYSTEST1.MAC 3K 21 5D8C - 49 SYSTEST2.MAC 4K 30 9E05 - 50 SYSTEST3.MAC 4K 26 92EA - 51 SYSTEST4.MAC 6K 46 02CE - 52 SYSTEST5.MAC 2K 16 2DAF - 53 SYSTEST6.MAC 5K 35 A9F5 - 54 SYSTEST7.MAC 5K 36 5138 - -SYSLIB3 HELP Disk 4 -- - Filename.Typ Size Recs CRC - 1 SYS2-3 .TXT 9K 71 6B3B - 2 SYSLIB .HLP 2K 9 8184 - 3 SYSLIB0 .HLP 14K 112 86FE - 4 SYSLIB1 .HLP 20K 159 8FBB - 5 SYSLIB2 .HLP 5K 33 6DD5 - 6 SYSLIB3 .HLP 15K 119 F85C - 7 SYSLIB4 .HLP 12K 90 E7A6 - 8 SYSLIB5 .HLP 12K 90 F417 - 9 SYSLIB6 .HLP 8K 60 F45A - 10 SYSLIB7 .HLP 6K 45 152C - 11 SYSLIB8 .HLP 5K 37 3CA8 - 12 SYSLIB9 .HLP 3K 23 4292 - 13 SYSLIBA .HLP 7K 55 6442 - 14 SYSLIBB .HLP 5K 39 2009 - 15 SYSLIBC .HLP 9K 71 F96C - 16 SYSLIBD .HLP 5K 33 489A - 17 SYSLIBE .HLP 8K 62 55D3 - 18 SYSLIBF .HLP 4K 25 2A54 - 19 SYSLIBG .HLP 3K 21 EE4C - 20 SYSLIBH .HLP 2K 14 6F02 - 21 SYSLIBI .HLP 6K 44 DC1E - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3FILES.PQ2 b/Source/Images/d_bp/u15/Z3FILES.PQ2 deleted file mode 100644 index 185f9777..00000000 Binary files a/Source/Images/d_bp/u15/Z3FILES.PQ2 and /dev/null differ diff --git a/Source/Images/d_bp/u15/Z3FILES2.PH2 b/Source/Images/d_bp/u15/Z3FILES2.PH2 deleted file mode 100644 index f4c4b69f..00000000 --- a/Source/Images/d_bp/u15/Z3FILES2.PH2 +++ /dev/null @@ -1,266 +0,0 @@ -.po 7 -.cw 10 -.foZCPR3 File Distribution Page # - - - ZCPR3 Files Distributed by Echelon, Inc. - (Phase2 Plus) - -ZCPR3 Core Disk 1 -- - Filename.Typ Size Recs CRC - 1 ALIAS .COM 4K 30 669A 12 SYSRCP .ASM 44K 352 6315 - 2 CD .COM 1K 7 49C8 13 SYSRCP1 .LIB 11K 81 F030 - 3 CLEANDIR.COM 2K 12 ADAF 14 SYSRCP2 .LIB 11K 81 790C - 4 CMD .COM 1K 7 ED3B 15 SYSRCP3 .LIB 11K 81 52FB - 5 COMMENT .COM 1K 5 9629 16 SYSRCP4 .LIB 11K 81 871D - 6 DIR .COM 2K 16 BE35 17 TCCHECK .COM 2K 14 0578 - 7 ECHO .COM 1K 4 DB5A 18 TCMAKE .COM 6K 47 817E - 8 ERROR1 .COM 2K 12 E682 19 TCSELECT.COM 3K 22 F8DA - 9 ERROR2 .COM 3K 18 A088 20 VLIB .REL 2K 13 01A1 - 10 EX .COM 3K 20 8344 21 WHEEL .COM 2K 11 1B9A - 11 HELP .COM 3K 24 4F74 22 XD .COM 4K 28 B251 - 12 LDR .COM 3K 21 FFC4 23 Z3INS .COM 2K 16 611D - 13 MENU .COM 4K 29 E81F 24 Z3LIB .REL 8K 61 8F30 - 14 MENUCK .COM 3K 20 4F74 25 Z3LOC .COM 1K 7 0001 - 15 MKDIR .COM 6K 41 49D9 26 Z3TCAP .ASM 29K 225 DCED - 16 MLOAD .COM 2K 15 5BF0 27 Z3TCAP .TCP 8K 61 4E9F - 17 MU3 .COM 3K 23 55BD 28 ZCPR3 .INS 2K 10 7557 - 18 PATH .COM 2K 10 653A - 19 PWD .COM 1K 8 5DA2 ZCPR3 Utilities COM Disk 1 -- - 20 RELS .UTL 2K 16 6BF8 Filename.Typ Size Recs CRC - 21 SHSET .COM 1K 7 4F00 1 ALIAS .COM 4K 30 82D4 - 22 SYSENV .ASM 1K 5 4C5C 2 CD .COM 1K 7 DA48 - 23 SYSENV .LIB 4K 26 CF64 3 CMDRUN .COM 1K 2 21B5 - 24 SYSIOP .ASM 32K 254 1DCD 4 COMMENT .COM 1K 5 3C4A - 25 SYSNDR .ASM 1K 3 3872 5 CPSEL .COM 1K 8 CCAA - 26 SYSNDR .LIB 2K 10 DA46 6 CRC .COM 6K 41 A89C - 27 VFILER .COM 11K 84 8923 7 DEV .COM 2K 14 F755 - 28 VMENU .COM 6K 46 A582 8 DEVICE .COM 3K 17 153E - 29 VMENUCK .COM 3K 21 9E17 9 DIFF .COM 4K 25 45A7 - 30 Z3BASE1 .LIB 9K 66 2C69 10 DIR .COM 2K 16 9B8A - 31 Z3BASE2 .LIB 8K 64 17AD 11 DISK7OCC.COM 4K 32 1A90 - 32 Z3HDR1 .LIB 19K 150 6B50 12 DU3 .COM 11K 87 A0CE -.he ZCPR3 File List - 33 Z3HDR2 .LIB 19K 150 2C19 13 ECHO .COM 1K 4 F2D6 - 34 ZCPR3 .ASM 66K 522 2857 14 ERASE .COM 3K 20 E71E - 35 ZCPR3 .INS 2K 10 7557 15 ERROR1 .COM 2K 12 5EB7 - 16 ERROR2 .COM 3K 18 2F03 -ZCPR3 Core Disk 2 -- 17 ERROR3 .COM 1K 5 8542 - Filename.Typ Size Recs CRC 18 ERROR4 .COM 1K 5 86D1 - 1 DISK7 .COM 4K 32 1A90 19 ERRORX .COM 1K 3 F941 - 2 DISK77B .DOC 6K 45 88BE 20 FINDF .COM 2K 14 48F6 - 3 PATH .COM 2K 10 653A 21 GOTO .COM 1K 6 6ADA - 4 PRINT .COM 6K 42 1214 22 HELP .COM 3K 24 4F76 - 5 SAK .COM 1K 7 8616 23 HELPCK .COM 2K 16 F3B3 - 6 SETFILE .COM 1K 4 28D4 24 HELPPR .COM 5K 35 12E7 - 7 SHOW .COM 8K 62 A876 25 IF .COM 3K 18 418D - 8 SYSFCP .ASM 18K 137 7012 26 IFSTAT .COM 1K 3 6586 - 9 SYSFCP1 .LIB 6K 43 C3BB 27 LDR .COM 3K 21 FFC4 - 10 SYSFCP2 .LIB 6K 43 2324 28 MCOPY .COM 5K 33 A9F4 - 11 SYSLIB .REL 21K 161 2921 29 MENU .COM 4K 29 E81F - - 30 MENUCK .COM 3K 20 3CDC ZCPR3 Utilities HELP Disk 3 -- - 31 MKDIR .COM 6K 41 49D9 Filename.Typ Size Recs CRC - 32 MU3 .COM 3K 23 55BD 1 CLEANDIR.COM 2K 12 ADAF - 33 NOTE .COM 1K 1 CB9E 2 CMD .COM 1K 7 ED3B - 34 PAGE .COM 5K 36 DF9F 3 DU3 .HLP 38K 300 B790 - 35 PATH .COM 2K 10 E421 4 MU3 .HLP 7K 50 20CF - 36 PRINT .COM 6K 42 0492 5 SHSET .COM 1K 7 4F00 - 37 PROTECT .COM 4K 28 A130 6 VFILER .HLP 21K 165 40BB - 38 PWD .COM 1K 8 2B9B 7 VMENU .COM 6K 46 A582 - 39 QUIET .COM 1K 4 DF6B 8 VMENU .HLP 32K 253 7DE7 - 40 RECORD .COM 1K 8 C2B4 9 VMENUCK .COM 3K 21 9E17 - 41 REG .COM 1K 8 1CC4 10 Z3RES .HLP 8K 64 800E - 42 RENAME .COM 4K 27 A2F2 11 Z3TCAP .HLP 40K 314 381F - 43 SAK .COM 1K 7 7842 12 Z3UTIL1 .HLP 30K 234 4B2D - 44 SETFILE .COM 1K 4 00B2 13 Z3UTIL2 .HLP 21K 166 D3E6 - 45 SH .COM 4K 28 A89E 14 Z3UTIL3 .HLP 7K 52 0A0F - 46 SHCTRL .COM 1K 7 E37A 15 ZCPR3 .HLP 4K 30 666E - 47 SHDEFINE.COM 3K 23 0DEA - 48 SHFILE .COM 1K 4 634F  ZCPR3 Utilities Source Disk 4 -- - 49 SHOW .COM 8K 62 808A Filename.Typ Size Recs CRC - 50 SHVAR .COM 3K 23 4D89 1 ALIAS .ZEX 2K 9 6DBE - 51 SUB .COM 3K 20 59E5 2 ALIAS0 .MAC 8K 63 5072 - 52 TCCHECK .COM 2K 14 7235 3 ALIAS1 .MAC 10K 75 DB42 - 53 TCMAKE .COM 6K 47 B3A0 4 CD .MAC 3K 22 4202 - 54 TCSELECT.COM 3K 22 F8DA 5 CMDRUN .MAC 1K 7 F21D - 55 UNERASE .COM 2K 13 030A 6 COMMENT .MAC 4K 28 FF64 - 56 VFILER .COM 11K 84 8923 7 CPSEL .MAC 7K 52 2669 - 57 WHEEL .COM 2K 11 0CD0 8 CRC .MAC 18K 141 15ED - 58 XD .COM 4K 28 465B 9 DEV .MAC 9K 71 D980 - 59 XDIR .COM 8K 62 7248 10 DEVICE .MAC 11K 84 6EED - 60 Z3INS .COM 2K 16 DFB7 11 DIFF .MAC 15K 115 B983 - 61 Z3LOC .COM 1K 7 E319 12 DIR .MAC 7K 54 2227 - 62 ZCPR3 .INS 2K 10 7557 13 ECHO .MAC 4K 28 824C - 63 ZEX .COM 5K 39 0F87 14 ERASE .MAC 10K 79 765E - 15 ERROR1 .MAC 8K 57 7BF1 -ZCPR3 Utilities HELP Disk 2 -- 16 ERROR2 .MAC 9K 66 DFF6 - Filename.Typ Size Recs CRC 17 ERROR3 .MAC 4K 27 85FA - 1 ALIAS .HLP 5K 35 9C58 18 ERROR4 .MAC 4K 31 D179 - 2 CMDFILES.HLP 24K 192 4475 19 ERRORX .MAC 2K 9 7F9C - 3 COMPARE .HLP 5K 33 26B6 20 FINDF .COM 2K 14 48F6 - 4 DEBUGRCP.ASM 28K 218 454D 21 GOTO .MAC 4K 27 4536 - 5 DIRS .HLP 21K 166 29F5 22 HELP52 .MAC 26K 202 B87D - 6 DPROG11 .MAC 20K 155 6E2F 23 HELPCK .MAC 10K 77 A576 - 7 HELP .HLP 1K 7 54CD 24 HELPPR .MAC 28K 219 CFB6 - 8 HELPSYS .HLP 29K 230 99DA 25 IF .MAC 10K 77 F529 - 9 IF .HLP 13K 99 45A4 26 IFSTAT .MAC 2K 11 234E - 10 IO .HLP 12K 92 21E3 - 11 MENU .HLP 32K 253 9059  ZCPR3 Utilities Source Disk 5 -- - 12 NDIRS .HLP 16K 122 33D7 Filename.Typ Size Recs CRC - 13 READ .ME 1K 3 9089 1 LDR11 .MAC 13K 97 F1DA - 14 SH .HLP 13K 101 6646 2 MCOPY41 .MAC 22K 172 D935 - 15 SYSRCP .HLP 6K 48 F633 3 MENU34 .MAC 32K 253 56E5 - 16 ZCPR3 .HLP 4K 30 666E 4 MENUCK .MAC 11K 87 B04C - 5A DPROG .HLP 9K 69 D5AE - - - 5 MKDIR31 .MAC 19K 145 AB4B  SYSLIB3 Source Disk 1 -- - 6 NOTE .MAC 1K 7 986F Filename.Typ Size Recs CRC - 7 PAGE .MAC 24K 187 AEFF 1 S0FILEIO.MAC 2K 12 6AA7 - 8 PATH .MAC 9K 69 7D6A 2 S1FILEIO.MAC 2K 12 29E9 - 9 PRINT .MAC 28K 219 A093 3 S2FILEIO.MAC 2K 12 EE8F - 10 PROTECT .MAC 13K 97 E175 4 S3FILEIO.MAC 2K 12 B0F6 - 11 PWD .MAC 5K 37 DF00 5 SALLOC .MAC 3K 22 F78F - 12 QUIET .MAC 3K 17 FA09 6 SBBLINE .MAC 3K 17 1D79 - 13 RECORD .MAC 4K 30 4EE7 7 SBDOS .MAC 1K 4 D833 - 14 REG .MAC 5K 37 401A 8 SBIN .MAC 1K 4 AC82 - 15 RENAME .MAC 13K 103 C4F5 9 SBIOS .MAC 3K 17 241E - 16 SAK .MAC 5K 38 62C2 10 SBIST .MAC 1K 4 3522 - 17 SHOW .MAC 31K 247 8770 11 SBLINE .MAC 3K 21 1871 - 12 SBOUT .MAC 1K 4 4DF6 -ZCPR3 Utilities Source Disk 6 -- 13 SCAPIN .MAC 1K 4 DF2E - Filename.Typ Size Recs CRC 14 SCAPS .MAC 1K 4 22F3 - 1 SETFILE .MAC 2K 16 73D5 15 SCAPSTR .MAC 1K 5 FCEA - 2 SH .MAC 16K 125 768D 16 SCATH .MAC 1K 5 A665 - 3 SHCTRL .MAC 3K 21 CAE6 17 SCCOUT .MAC 2K 9 A488 - 4 SHDEFINE.MAC 11K 87 396F 18 SCIN .MAC 1K 7 47D4 - 5 SHFILE .MAC 2K 15 3417 19 SCLINE .MAC 2K 11 583E - 6 SHVAR .MAC 11K 88 6B60 20 SCLOUT .MAC 2K 9 2A8B - 7 SUB31 .MAC 24K 187 945E 21 SCODEND .MAC 1K 8 4F9C - 8 TCCHECK .MAC 5K 40 7079 22 SCOMP .MAC 2K 10 C619 - 9 TCMAKE .MAC 19K 148 A0C7 23 SCOMPHD .MAC 1K 4 67BE - 10 TCSELECT.MAC 11K 87 927E 24 SCONDIN .MAC 1K 6 6666 - 11 UNERASE .MAC 14K 111 41BF 25 SCOUT .MAC 1K 7 0A76 - 12 WHEEL .MAC 4K 32 FFCF 26 SCPOUT .MAC 2K 9 F3B0 - 13 XD .MAC 18K 144 B1B2 27 SCRC .MAC 3K 24 9649 - 14 XDIR .MAC 38K 304 8B4B 28 SCRC1 .MAC 3K 24 7A5D - 15 Z3INS .MAC 10K 80 7F27 29 SCRC2 .MAC 3K 23 E929 - 16 Z3LOC11 .MAC 4K 32 7C65 30 SCRLF .MAC 1K 6 6CD3 - 17 ZEX31 .ASM 46K 368 4E2C 31 SCST .MAC 1K 7 B601 - 32 SDIR .MAC 2K 15 D2C8 - 33 SDIR00 .MAC 2K 15 D5BC -ZCPR3 Utilities Doc Disk 7 -- 34 SDIR01 .MAC 2K 12 C259 - Filename.Typ Size Recs CRC 35 SDIR02 .MAC 3K 17 5193 - 1 Z3INS .IDX 4K 32 6044 36 SDIR03 .MAC 3K 17 D263 - 2 Z3INS .SI 31K 241 836B 37 SDIR04 .MAC 2K 11 5228 - 3 Z3INS .TOC 13K 101 D54E 38 SDIR05 .MAC 7K 56 754A - 4 Z3INS1 .SI 11K 85 30E0 39 SDIR06 .MAC 10K 79 D1DF - 5 Z3INS2 .SI 11K 88 2800 40 SDIR07 .MAC 3K 17 4FA3 - 6 Z3INS3 .SI 55K 439 FCCF 41 SDIR08 .MAC 2K 12 4F2F - 7 Z3INS4 .SI 28K 224 16D3 42 SDIR09 .MAC 2K 14 75BA - 8 Z3INS5 .SI 5K 39 984C 43 SDIR10 .MAC 2K 13 3DE7 - 9 Z3INS6 .SI 33K 259 D8A1 44 SDIRBF .MAC 1K 5 F2DC - 10 Z3INS7 .SI 2K 12 F0A3 45 SDIRQ .MAC 17K 136 6004 - 11 Z3INS8 .SI 5K 34 EB11 46 SDIRQS .MAC 20K 155 51F3 - 47 SEN .MAC 1K 3 F9CF -ZCPR3 Utilities Doc Disk 8 -- 48 SEPRINT .MAC 1K 5 2A31 - Filename.Typ Size Recs CRC 49 SEPSTR .MAC 2K 15 68B3 - 1 Z3USER .IDX 1K 3 9F34 50 SEVAL .MAC 4K 25 13D5 - 2 Z3USER .SI 54K 428 7D58 51 SEVAL1 .MAC 2K 9 782D - 3 Z3USER .TOC 1K 6 1810 52 SEVAL2 .MAC 2K 11 1BDC - 4 ZEX .ZEX 4K 32 782C 53 SEVAL3 .MAC 2K 10 BD45 - 54 SEVAL4 .MAC 2K 9 10A5 46 SMTH02 .MAC 1K 5 47EC - 55 SFCLOS .MAC 1K 4 710C 47 SMTH03 .MAC 1K 4 8800 - 56 SFDEL .MAC 1K 4 BB5B 48 SMTH04 .MAC 1K 4 FAD3 - 57 SFEXIST .MAC 1K 5 2C94 49 SMTH05 .MAC 1K 5 41F7 - 58 SFILEIO .MAC 9K 72 4F9C 50 SMTH06 .MAC 1K 5 9661 - 59 SFILL .MAC 2K 10 A547 51 SMTH07 .MAC 1K 3 78BD - 60 SFMAKE .MAC 1K 5 5A73 52 SMTH08 .MAC 1K 3 AD88 - 53 SMTH09 .MAC 1K 3 3EC8 -SYSLIB3 Source Disk 2 -- 54 SMTH10 .MAC 1K 4 729D - Filename.Typ Size Recs CRC 55 SMTH11 .MAC 2K 13 7150 - 1 SFNAME .MAC 5K 39 EB46 56 SMTH12 .MAC 2K 13 E277 - 2 SFOPEN .MAC 2K 10 6B08 - 3 SFREAD .MAC 1K 4 3E4E  SYSLIB3 REL and Source Disk 3 -- - 4 SFRENAME.MAC 2K 12 6A58 Filename.Typ Size Recs CRC - 5 SFSIZE .MAC 2K 12 DCDF 1 SPA2HC .MAC 1K 6 FD07 - 6 SFWRIT .MAC 1K 4 67E3 2 SPADC .MAC 2K 11 35AA - 7 SFXIO .MAC 9K 65 7928 3 SPAFDC .MAC 2K 10 8746 - 8 SGFA .MAC 3K 20 DDA9 4 SPAUSE .MAC 3K 23 A2B8 - 9 SGUA .MAC 1K 5 C628 5 SPFN1 .MAC 1K 6 5BD1 - 10 SINITFCB.MAC 1K 8 FFE8 6 SPFN2 .MAC 1K 6 6756 - 11 SINLINE .MAC 6K 44 4103 7 SPFN3 .MAC 1K 8 B9E6 - 12 SINSTR .MAC 2K 12 3077 8 SPHL4HC .MAC 1K 4 3F9B - 13 SISALNUM.MAC 1K 6 2867 9 SPHL5DC .MAC 2K 14 D706 - 14 SISALPHA.MAC 1K 6 02B4 10 SPHLFDC .MAC 2K 12 A7C8 - 15 SISCTRL .MAC 1K 6 533C 11 SPOUT .MAC 1K 7 915C - 16 SISDIGIT.MAC 1K 6 EDAB 12 SPRINT .MAC 1K 4 A2A3 - 17 SISGRAPH.MAC 1K 6 EEF8 13 SPSTR .MAC 2K 14 A7FD - 18 SISHEX .MAC 1K 6 1958 14 SRAND .MAC 2K 13 476E - 19 SISPRINT.MAC 1K 6 EC30 15 SRIN .MAC 1K 7 1844 - 20 SISPUN .MAC 2K 9 0F59 16 SRREAD .MAC 2K 9 F01A - 21 SISSP .MAC 1K 8 7B4B 17 SRWRITE .MAC 2K 9 35C7 - 22 SLA2HC .MAC 1K 6 70AD 18 SSA2HC .MAC 1K 6 6057 - 23 SLADC .MAC 2K 11 72AE 19 SSADC .MAC 2K 11 1A64 - 24 SLAFDC .MAC 2K 10 843B 20 SSAFDC .MAC 2K 10 B9F3 - 25 SLCRLF .MAC 1K 6 A98A 21 SSCANNER.MAC 2K 12 C2D3 - 26 SLFN1 .MAC 1K 6 A6FF 22 SSCFA .MAC 2K 16 E939 - 27 SLFN2 .MAC 1K 6 82BC 23 SSCOUT .MAC 1K 6 0636 - 28 SLFN3 .MAC 1K 8 658E 24 SSCRLF .MAC 1K 5 6327 - 29 SLHL4HC .MAC 1K 4 DBC3 25 SSCTLFL .MAC 1K 4 D7AB - 30 SLHL5DC .MAC 2K 14 7961 26 SSFA .MAC 2K 16 9FAC - 31 SLHLFDC .MAC 2K 12 2F66 27 SSFN1 .MAC 1K 6 A43E - 32 SLOUT .MAC 1K 7 4084 28 SSFN2 .MAC 1K 6 0E8D - 33 SLPRINT .MAC 1K 4 67D0 29 SSFN3 .MAC 1K 8 C4B7 - 34 SLPSTR .MAC 2K 14 65D7 30 SSHL4HC .MAC 1K 4 4D97 - 35 SMA2HC .MAC 1K 8 0DC7 31 SSHL5DC .MAC 2K 14 6FBA - 36 SMADC .MAC 2K 14 016F 32 SSHLFDC .MAC 2K 13 C39D - 37 SMAFDC .MAC 2K 12 BEC3 33 SSKPUN .MAC 1K 8 A057 - 38 SMFN1 .MAC 1K 6 3A43 34 SSKSP .MAC 1K 8 490D - 39 SMFN2 .MAC 1K 6 C23B 35 SSORT .MAC 14K 111 E332 - 40 SMFN3 .MAC 1K 8 002A 36 SSOUT .MAC 1K 5 CA1A - 41 SMHL4HC .MAC 1K 5 9C15 37 SSPRINT .MAC 1K 4 42CC - 42 SMHL5DC .MAC 3K 19 F0F5 38 SSPSTR .MAC 2K 14 9D1B - 43 SMHLFDC .MAC 2K 16 1C5D 39 SSUA .MAC 1K 6 EA5F - 44 SMOVE .MAC 3K 19 67FF 40 SUD1 .MAC 1K 8 635C - 45 SMTH01 .MAC 1K 4 FD05 41 SUD2 .MAC 1K 5 589A - - 42 SUD3 .MAC 1K 6 A69A - 43 SVERSION.MAC 1K 5 F1A9 - 44 SYSLIB .REL 21K 161 2921 - 45 SYSLIB27.REL 14K 107 1C54 - 46 SYSTEST .MAC 4K 26 C997 - 47 SYSTEST0.MAC 4K 29 B39E - 48 SYSTEST1.MAC 3K 21 5D8C - 49 SYSTEST2.MAC 4K 30 9E05 - 50 SYSTEST3.MAC 4K 26 92EA - 51 SYSTEST4.MAC 6K 46 02CE - 52 SYSTEST5.MAC 2K 16 2DAF - 53 SYSTEST6.MAC 5K 35 A9F5 - 54 SYSTEST7.MAC 5K 36 5138 - -SYSLIB3 HELP Disk 4 -- - Filename.Typ Size Recs CRC - 1 SYS2-3 .TXT 9K 71 6B3B - 2 SYSLIB .HLP 2K 9 8184 - 3 SYSLIB0 .HLP 14K 112 86FE - 4 SYSLIB1 .HLP 20K 159 8FBB - 5 SYSLIB2 .HLP 5K 33 6DD5 - 6 SYSLIB3 .HLP 15K 119 F85C - 7 SYSLIB4 .HLP 12K 90 E7A6 - 8 SYSLIB5 .HLP 12K 90 F417 - 9 SYSLIB6 .HLP 8K 60 F45A - 10 SYSLIB7 .HLP 6K 45 152C - 11 SYSLIB8 .HLP 5K 37 3CA8 - 12 SYSLIB9 .HLP 3K 23 4292 - 13 SYSLIBA .HLP 7K 55 6442 - 14 SYSLIBB .HLP 5K 39 2009 - 15 SYSLIBC .HLP 9K 71 F96C - 16 SYSLIBD .HLP 5K 33 489A - 17 SYSLIBE .HLP 8K 62 55D3 - 18 SYSLIBF .HLP 4K 25 2A54 - 19 SYSLIBG .HLP 3K 21 EE4C - 20 SYSLIBH .HLP 2K 14 6F02 - 21 SYSLIBI .HLP 6K 44 DC1E - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3FILES2.PQ2 b/Source/Images/d_bp/u15/Z3FILES2.PQ2 deleted file mode 100644 index 136f2538..00000000 Binary files a/Source/Images/d_bp/u15/Z3FILES2.PQ2 and /dev/null differ diff --git a/Source/Images/d_bp/u15/Z3HDR1.LIB b/Source/Images/d_bp/u15/Z3HDR1.LIB deleted file mode 100644 index 826021a7..00000000 --- a/Source/Images/d_bp/u15/Z3HDR1.LIB +++ /dev/null @@ -1,609 +0,0 @@ -; Z3HDR - Maximum Configuration -; Offset: 5100H - -************************************************************************* -* * -* Z C P R 3 -- Z80-Based Command Processor Replacement, Version 3.0 * -* * -* Copyright (c) 1984 by Richard Conn * -* Copyright Pending, US Government * -* All Rights Reserved * -* * -* ZCPR3 was written by Richard Conn, who assumes no responsibility * -* or liability for its use. ZCPR3 is released to the CP/M user * -* community for non-commercial use only. * -* * -* All registered users of CP/M are encouraged to freely copy and use * -* ZCPR3 and its associated utilities on their registered systems for * -* non-commercial purposes. * -* * -* Any commercial use of ZCPR3 is prohibited unless approved by the * -* author, Richard Conn, or his authorized agent, Echelon, Inc, in * -* writing. * -* * -* This is the RELEASE VERSION of ZCPR3. * -* * -************************************************************************* - -; -; Module: Z3HDR -; Author: Richard Conn -; Module Used By: ZCPR3 Version 3.x -; Note: Z3HDR contains the key customization equates for ZCPR3. These -; equates allow the user to select various ZCPR3 options and do an -; extensive amount of tailoring of ZCPR3 to the user's desires. -; - -; -; 1. BASIC SYSTEM DEFINITIONS -; -; The following equates may be used to customize this CPR for the user's -; system and integration technique. The following equate are provided: -; -; REL - TRUE if integration is to be done via MOVCPM -; - FALSE if integration is to be done via DDT and SYSGEN -; -; CPRLOC - Base Page Address of CPR; this value can be obtained by running -; the CCPLOC program on your system, and if REL is FALSE, this -; value is supplied through the Z3BASE.LIB CCP equate -; -REL EQU FALSE -; - IF REL -CPRLOC EQU 0 - ELSE -CPRLOC EQU CCP ;VALUE PROVIDED IN Z3BASE.LIB - ENDIF - -; -; 2. DEFAULT FILE TYPES -; -; The following macros define the file types of the command object files -; (COM files under CP/M 2.2) to be loaded when a non-resident ZCPR3 command -; is given and of the indirect command files (SUB files under CP/M 2.2) to -; be used to extract commands from when the indirect command facility is -; invoked. -; -COMTYP MACRO - DB 'COM' - ENDM - -SUBTYP MACRO - DB 'SUB' - ENDM - -; -; 3. SUBMIT FILE PROCESSING -; -; The following flag enables the ability of ZCPR3 to process -; SUBMIT files (command files of the form $$$.SUB). If SUBON is TRUE, then -; ZCPR3 will process such files like CP/M's CCP normally does; if SUBON is -; FALSE, ZCPR3 will not process such files (ignore them). In such a case, -; only indirect command file facilities like ZEX will work. Much code is -; saved inside of the ZCPR3 Command Processor if SUBON is set to FALSE, -; but this rather useful facility is lost. -; -SUBON EQU TRUE - - -; -; 4. COMMAND PREFIX -; -; The following flag allows ZCPR3 to accept commands of the form -; "du:command params" or "dir:command params". If DRVPREFIX is TRUE, -; this form is accepted; if FALSE, this form is not accepted. -; -DRVPREFIX equ TRUE - - -; -; 5. COMMAND ATTRIBUTES -; -; The following equate allows the user to select the attributes of the -; COM files which are selected for execution. The ZCPR3 Command Processor -; can be made to execute only COM files with the System attribute set, with -; the Directory (non-System) attribute set, or with either attribute set. -; The following values are defined for this equate: -; -; COMATT Files Selected -; 0 System -; 80H Directory -; 1 Both System and Directory -; -COMATT equ 01H - - -; -; 6. ZCPR3 RESIDENT COMMAND ACTIVATION AND WHEEL FACILITY -; -; The following equates enable various ZCPR3-resident commands. -; The user may invoke these as desired, but should keep in mind the size -; of the resulting ZCPR3 and make sure it does not exceed the required -; limits. -; -DIRON equ FALSE ;DIR COMMAND -LTON equ FALSE ;LIST, TYPE COMMANDS -GOON equ TRUE ;GO COMMAND -ERAON equ FALSE ;ERA COMMAND -SAVEON equ TRUE ;SAVE COMMAND -RENON equ FALSE ;REN COMMAND -GETON equ TRUE ;GET COMMAND -JUMPON equ FALSE ;JUMP COMMAND -NOTEON equ FALSE ;NOTE COMMAND - -; -; The Wheel equate table enables the WHEEL facility of ZCPR3. With this -; facility, a WHEEL BYTE, which exists somewhere in memory, is examined -; before a set of installer-selected commands are executed. -; If this byte is not zero, then the command proceeds. If it is zero, -; then the command is not allowed to proceed and is exited with an error -; message. -; -; The following set of equates make each of the indicated commands -; selectable to respond to the Wheel Byte or not. For instance, if -; WERA=TRUE, then it responds to the Wheel Byte; if WERA=FALSE, it does not. -; - IF Z3WHL NE 0 ;IF A WHEEL BYTE ADDRESS IS DEFINED -WERA equ FALSE ;Make ERA a Wheel-Oriented Command -WREN equ FALSE ; " REN " " " " -WLT equ FALSE ; " L/T " " " " (LIST/TYPE) -WGO equ FALSE ; " GO " " " " -WSAVE equ FALSE ; " SAVE " " " " -WGET equ FALSE ; " GET " " " " -WJUMP equ FALSE ; " JUMP " " " " -WDU equ FALSE ; " DU: " " " " (DU/DIR Change) -WHEEL equ WERA OR WREN OR WLT OR WGO OR WSAVE OR WGET OR WJUMP OR WDU - ENDIF ;Z3WHL - -; -; 7. ZCPR3 RESIDENT COMMAND TABLE -; -; This table consists of the names of the various ZCPR3-resident -; commands and their addresses. The NCHARS equate defines how many -; characters long each name may be, and all table entries must be exactly -; the indicated number of characters (trailing spaces are used to fill -; out shorter names). -; -; Each table entry is structured as follows: -; -; DB 'CMND' ;Name of Command (NCHARS long) -; DB CMNDADR ;Address of Command within ZCPR3 -; -; The installer should only change the names of the commands as -; desired and should not, as a rule, touch the address definition since -; this is fixed within the body of ZCPR3. -; -NCHARS EQU 4 ;NUMBER OF CHARS/COMMAND - -CTABLE MACRO -; - IF DIRON - DB 'DIR ' - DW DIR ;DIRECTORY DISPLAY COMMAND - ENDIF -; - IF LTON - DB 'LIST' - DW LIST ;LIST FILE ON PRINTER COMMAND - DB 'TYPE' - DW TYPE ;TYPE FILE ON CONSOLE COMMAND - ENDIF -; - IF GOON - DB 'GO ' - DW GO ;EXECUTE CURRENT TPA COMMAND - ENDIF -; - IF ERAON - DB 'ERA ' - DW ERA ;ERASE FILES COMMAND - ENDIF -; - IF SAVEON - DB 'SAVE' - DW SAVE ;SAVE TPA COMMAND - ENDIF -; - IF RENON - DB 'REN ' - DW REN ;RENAME FILES COMMAND - ENDIF -; - IF GETON - DB 'GET ' - DW GET ;LOAD FILE INTO TPA COMMAND - ENDIF -; - IF JUMPON - DB 'JUMP' - DW JUMP ;JUMP TO ANY MEMORY LOCATION COMMAND - ENDIF -; - IF NOTEON - DB 'NOTE' - DW NOTE ;NOTE - NULL COMMAND (NOP) - ENDIF -; - ENDM - - -; -; 8. CONTROLS ON ZCPR3 RESIDENT COMMANDS -; -; The following sets of equates provide special controls and -; parameters on various ZCPR3-resident commands. -; - -; -; The following equates set the width of the spacing between the -; file names for the DIR command and the character used to separate file -; names from one another on the same line. -; -; Assuming that FENCE is set to the character '|', If WIDE is TRUE, -; then the output will look like: -; -; filename.typ__|__filename.typ ... -; -; while if WIDE is FALSE, the output will look like: -; -; filename.typ_|_filename.typ ... -; -; (underscore represents a space) -; -WIDE EQU TRUE -FENCE EQU '|' - -; -; The following equates define two flags which are used in -; conjunction with the DIR command on the command line. SYSFLG is -; the character used to indicate to DIR that all files, both System -; and Non-System, are to be displayed. SOFLG is the character used -; to indicate to DIR that only the System files are to be displayed. -; By default, DIR displays non-System files. -; -; For example, if SYSFLG is set to 'A' and SOFLG is set to -; 'S', then: -; DIR *.COM A -; -; displays all COM files with both System and non-System attributes -; while: -; DIR *.COM S -; -; displays only COM files with the System attribute. Naturally: -; -; DIR *.COM -; -; displays only COM files with the non-System attribute. -; -SYSFLG EQU 'A' -SOFLG EQU 'S' - -; -; The following equate causes ERA to confirm the files to be erased -; before it goes ahead and erases them. If ERAOK is TRUE, then the user -; will be prompted each time; if it is FALSE, then the user will not be -; prompted. -; -ERAOK equ FALSE - -; -; If ERAOK is TRUE, the following equate adds a Verify option to the -; ERA command which causes the user to be prompted only if the Verify -; option letter, defined by ERDFLG, is given after the file name. If -; ERAV is TRUE, then the user will be asked to verify only when ERDFLG -; is contained in the command line; if ERAV is FALSE, the user will always -; be asked to verify. -; -; For example, if ERAOK is TRUE, ERAV is TRUE, and ERDFLG is 'V', -; then the command: -; ERA *.* V -; will result in the file names being displayed and the user being asked -; for verification. If the V option were not given, the user would not -; be asked for verification. -; -ERAV equ FALSE -ERDFLG equ 'V' - -; -; The following equates set the paging parameters for the TYPE -; command. -; -; PGDFLT determines if TYPE pages by default. If PGDFLT is TRUE, -; then: -; TYPE FILE.TXT -; -; will be paged. If PGDFLT is FALSE, the above command will not be paged. -; -; PGDFLG defines the option character in the TYPE command line which -; is used to toggle the default set by PGDFLT. Assuming that PGDFLG is set -; to 'P', then: -; TYPE FILE.TXT P -; -; will page the file listing if PGDFLT is FALSE and not page it if PGDFLT is -; TRUE. -; -PGDFLT EQU TRUE -PGDFLG EQU 'P' - -; -; The following equate defines the number of lines on the user's CRT -; screen for use by the TYPE command when it is paging. This value is usually -; 24. -; -NLINES EQU 24 - -; -; The following equate defines the option letter used with the -; SAVE command to indicate that the associated number is 128-byte sectors -; as opposed to 256-byte pages. For example, if SECTFLG is set to 'S', then: -; -; SAVE 25 FILE.BIN S -; -; save 25 128-byte sectors starting at location 100H into the file named -; FILE.BIN. IF the S option was not present, SAVE would have saved 25 -; 256-byte blocks starting at location 100H into the file named FILE.BIN. -; -SECTFLG EQU 'S' - -; -; 9. PATH DEFINITION -; -; The following equate specifies the address of the PATH to be followed -; for the PATH command-search if the PATH is to be initialized by the BIOS -; and set by the user via a PATH.COM program. The value of PATH should -; be the address of the PATH data area in memory. If the internal PATH -; provided by ZCPR3 is to be used, then PATHBASE should be equated to 0, -; which selects the PATH located just after the MEMLOAD routine. If the -; external PATH is to be used, then PATHBASE should be set to the address -; of the external path. -; -; A PATH is a series of byte-pairs, terminated by a binary 0. The first -; byte of each pair is the disk number (1-16 for disks A-P), and the second -; byte of each pair is the user number (0-31). The special character '$' -; indicates the current user or current disk. For example, the path -; from current disk/current user to current disk/user 0 to disk A/user 0 -; is selected by the following sequence: -; -; DB '$$' ;current disk/user -; DB '$',0 ;current disk/user 0 -; DB 1,0 ;disk A/user 0 -; DB 0 ;end of path -; - IF EXPATH NE 0 ;External Path Selected -; -; This equate defines the base address of the external path -; -PATH equ EXPATH ;External ZCPR3 PATH at CBIOS Buffer Area - - ELSE ;Internal Path Selected -; -; The following macro defines the n-element internal path -; -IPATH MACRO - db 'A'-'@','$' ;Disk A, Current User - db 'A'-'@',0 ;Disk A, User 0 - db 0 ;End of Path -- MUST be here - ENDM -; - ENDIF - -; -; The following flag enables ZCPR3 to perform an optimized path -; search when it is searching along a path for a file. If this equate -; is TRUE, ZCPR3 will build a path in memory of absolute entries (A1, B7, etc) -; from the symbolic path (one containing '$') which is the path it would -; otherwise use. This new path would contain no duplicate path elements, -; where a symbolic path analysis may. For example, if the path is: -; -; db 'A'-'@','$' ;disk A, current user -; db 'A'-'@',15 ;disk A, user 15 -; db 0 -; -; then if the user is logged into A15, setting the below equate to TRUE -; would allow ZCPR3 to build the path: -; -; db 'A'-'@',15 ;only one entry -; db 0 -; -; in the analysis of this symbolic path, while with this equate FALSE, -; ZCPR3 may log into A15 as many as three times (once for the default -; and twice more for the symbolic path) in looking for a file which is -; not found before it gives up. Using this minimum path facility costs -; some code in ZCPR3, but it speeds up processing noticably in some cases. -; -; Enable this equate if MINIMUM PATH SEARCH is to be employed. -; -MINPATH EQU TRUE - -; -; In searching for a file along a path, ZCPR3 can be commanded -; to always look in the current logged-in directory before beginning -; the path search. This equate controls this feature. If SCANCUR -; is set to TRUE, the current directory need never be referenced in -; a symbolic path expression (DB '$','$') since SCANCUR insures that -; the current directory is scanned. -; -; Enable this equate if the current DU is always to be scanned. -; -SCANCUR EQU TRUE - - -; -; 10. DU AND DIR CONTROLS -; - -; -; The following equate enables the appearance of the current disk/user -; in the ZCPR3 prompt. If set to FALSE, the prompt appears as '>' (assuming -; > is the current value of CPRMPT). If set to TRUE, the prompt appears -; as 'd>' or 'dn>'. (see INCLNDR below) -; -INCLDU equ TRUE - -; -; The following equate allows ZCPR3 to accept the DU: prefix or -; login form for input. Set this to TRUE if DU: prefix is to be allowed. -; -; Setting this equate to TRUE allows the following forms: -; -; A>B1: -; A>TYPE B4:FILE.TXT -; A>B: -; A>1: -; -ACCPTDU EQU TRUE - -; -; This equate enables ZCPR3 to process DIR: forms internally -; through the memory-based named directory buffer. This equate and -; the NDBASE address should be TRUE (non-zero) in order to enable -; ZCPR3 to process named directories. -; -; If NDINCP is TRUE, the following forms are allowed: -; -; A>ROOT: -; A>TYPE TEXT:FILE.TXT -; -; if the other associated equates (below) are set correctly. -; -NDINCP EQU TRUE - -; -; The following equate will cause the name of the current directory -; to be displayed as part of the prompt along with the DU form if enabled. -; (see INCLDU above) -; -; For example, if INCLNDR is TRUE, the prompt would look like: -; -; B7:TEXT> -- if INCLDU is also TRUE -; TEXT> -- if INCLDU is FALSE -; -INCLNDR EQU TRUE - -; -; The following equate allows ZCPR3 to accept the DIR: prefix or -; login form for input. Set this to TRUE if DIR: prefix is to be allowed. -; -; Setting this equate to TRUE allows the following forms: -; -; A>ROOT: -; A>TYPE TEXT:FILE.TXT -; -ACCPTND EQU TRUE - -; -; The following equate determines the hierarchy of DU:/DIR: evaluation. -; Set this to TRUE if DU: is to be tested for before DIR: or set this to -; FALSE if DIR: is to be tested for before DU:. If this is FALSE, named -; directories like C: (standing for C work area - NOT disk C) are permitted. -; -; Assuming that a directory for C programs, named 'C', and a root -; directory, named 'ROOT', exist, then if DUFIRST is set to FALSE: -; -; A>C: -- logs the user into the directory named 'C' -; A>ROOT: -- logs the user into the directory named 'ROOT' -; -; while if DUFIRST is set to TRUE: -; -; A>C: -- logs the user into disk C: (dir C can't be accessed) -; A>ROOT: -- logs the user into the directory named 'ROOT' -; -DUFIRST EQU FALSE - -; -; Enable password check on named directory references. If a named -; directory is referenced and has a password associated with it, ZCPR3 -; will ask the user for this password and approve the reference only -; if he gives a valid response. One and only one try is permitted. -; Setting this equate to TRUE will enable the password check facility. -; -PWCHECK EQU TRUE - - -; -; 11. COMMAND LINE BUFFER CONTROL -; -; The MULTCMD equate enables the feature of having more than -; one command on the same line, separated by a separation char -; which is defined by the CMDSEP equate. If this feature is -; enabled, the command line buffer and buffer pointers are -; moved outside of ZCPR3 at the indicated address of Z3CL. -; -; MULTCMD indicates if the ability to have more than one command -; on a line is to be enabled, and CMDSEP is the character used to separate -; these commands. For example, if CMDSEP is ';' and MULTCMD is TRUE, then -; commands like this are possible: -; -; ERA *.BAK;DIR -; - IF Z3CL NE 0 -MULTCMD equ TRUE - ELSE -MULTCMD equ FALSE - ENDIF -CMDSEP equ ';' - - -; -; 12. CMDRUN -- ZCPR3 EXTENDED COMMAND PROCESSING FACILITY -; -; This equate enables the ZCPR3 CMDRUN facility. If CMDRUN is TRUE, then -; another stage of command processing is invoked should ZCPR3 fail to find -; a COM file when the user gives a command. This stage involves invoking -; the COM file specified by CMDFCB and giving it the current command line -; as an argument. In this way, if, say, M80 PROG2 fails as a command, -; a new command like LRUNZ M80 PROG2, SUB M80 PROG2, or ZEX M80 PROG2 may -; be processed. If the new command fails, an appropriate error message is -; given. -; -; The ROOTONLY option causes ZCPR3 to only look at the Root (bottom of -; path) for the Extended Command Processor if it is set to TRUE. If it -; is set to FALSE, the path is searched for the Extended Command Processor. -; The tradeoff here is that ROOTONLY = TRUE is less flexible but somewhat -; faster than ROOTONLY = FALSE. -; -CMDRUN equ FALSE ; Enable the Facility - - if CMDRUN -ROOTONLY equ TRUE ; TRUE if look at Root Only for Extended - ; Command Processor, FALSE if look along - ; path -CMDFCB MACRO - db 0 - db 'CMDRUN ' ;Name of Program - db 'COM' ;File Type - ENDM - endif ;CMDRUN - - -; -; 13. FLOW COMMAND FACILITY -; -; This equate enables ZCPR3 to respond to IF processing. -; ZCPR3 simply flushes commands if a FALSE IF is currently engaged. -; FCPs must be enabled for IFON to work correctly. -; -IFON EQU TRUE - - -; -; 14. MISCELLANEOUS EQUATES -; -MAXUSR EQU 31 ;MAXIMUM USER NUMBER ACCESSABLE -MAXDISK EQU 4 ;MAXIMUM NUMBER OF DISKS ACCESSABLE - -SUPRES EQU TRUE ;SUPRESSES USER # REPORT FOR USER 0 - -SPRMPT EQU '$' ;CPR PROMPT INDICATING SUBMIT COMMAND -CPRMPT EQU '>' ;CPR PROMPT INDICATING USER COMMAND - -NUMBASE EQU 'H' ;CHAR USED TO SWITCH FROM DEFAULT NUMBER BASE - -CURIND EQU '$' ;SYMBOL FOR CURRENT DISK OR USER - -COMMENT EQU ';' ;LINES BEGINNING WITH THIS CHAR ARE COMMENTS - -; -; END OF ZCPR3 CUSTOMIZATION SECTION -; - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3HDR2.LIB b/Source/Images/d_bp/u15/Z3HDR2.LIB deleted file mode 100644 index 400f0838..00000000 --- a/Source/Images/d_bp/u15/Z3HDR2.LIB +++ /dev/null @@ -1,609 +0,0 @@ -; Z3HDR - Minimum Configuration -; Offset: 4100H - -************************************************************************* -* * -* Z C P R 3 -- Z80-Based Command Processor Replacement, Version 3.0 * -* * -* Copyright (c) 1984 by Richard Conn * -* Copyright Pending, US Government * -* All Rights Reserved * -* * -* ZCPR3 was written by Richard Conn, who assumes no responsibility * -* or liability for its use. ZCPR3 is released to the CP/M user * -* community for non-commercial use only. * -* * -* All registered users of CP/M are encouraged to freely copy and use * -* ZCPR3 and its associated utilities on their registered systems for * -* non-commercial purposes. * -* * -* Any commercial use of ZCPR3 is prohibited unless approved by the * -* author, Richard Conn, or his authorized agent, Echelon, Inc, in * -* writing. * -* * -* This is the RELEASE VERSION of ZCPR3. * -* * -************************************************************************* - -; -; Module: Z3HDR -; Author: Richard Conn -; Module Used By: ZCPR3 Version 3.x -; Note: Z3HDR contains the key customization equates for ZCPR3. These -; equates allow the user to select various ZCPR3 options and do an -; extensive amount of tailoring of ZCPR3 to the user's desires. -; - -; -; 1. BASIC SYSTEM DEFINITIONS -; -; The following equates may be used to customize this CPR for the user's -; system and integration technique. The following equate are provided: -; -; REL - TRUE if integration is to be done via MOVCPM -; - FALSE if integration is to be done via DDT and SYSGEN -; -; CPRLOC - Base Page Address of CPR; this value can be obtained by running -; the CCPLOC program on your system, and if REL is FALSE, this -; value is supplied through the Z3BASE.LIB CCP equate -; -REL EQU FALSE -; - IF REL -CPRLOC EQU 0 - ELSE -CPRLOC EQU CCP ;VALUE PROVIDED IN Z3BASE.LIB - ENDIF - -; -; 2. DEFAULT FILE TYPES -; -; The following macros define the file types of the command object files -; (COM files under CP/M 2.2) to be loaded when a non-resident ZCPR3 command -; is given and of the indirect command files (SUB files under CP/M 2.2) to -; be used to extract commands from when the indirect command facility is -; invoked. -; -COMTYP MACRO - DB 'COM' - ENDM - -SUBTYP MACRO - DB 'SUB' - ENDM - -; -; 3. SUBMIT FILE PROCESSING -; -; The following flag enables the ability of ZCPR3 to process -; SUBMIT files (command files of the form $$$.SUB). If SUBON is TRUE, then -; ZCPR3 will process such files like CP/M's CCP normally does; if SUBON is -; FALSE, ZCPR3 will not process such files (ignore them). In such a case, -; only indirect command file facilities like ZEX will work. Much code is -; saved inside of the ZCPR3 Command Processor if SUBON is set to FALSE, -; but this rather useful facility is lost. -; -SUBON EQU TRUE - - -; -; 4. COMMAND PREFIX -; -; The following flag allows ZCPR3 to accept commands of the form -; "du:command params" or "dir:command params". If DRVPREFIX is TRUE, -; this form is accepted; if FALSE, this form is not accepted. -; -DRVPREFIX equ TRUE - - -; -; 5. COMMAND ATTRIBUTES -; -; The following equate allows the user to select the attributes of the -; COM files which are selected for execution. The ZCPR3 Command Processor -; can be made to execute only COM files with the System attribute set, with -; the Directory (non-System) attribute set, or with either attribute set. -; The following values are defined for this equate: -; -; COMATT Files Selected -; 0 System -; 80H Directory -; 1 Both System and Directory -; -COMATT equ 01H - - -; -; 6. ZCPR3 RESIDENT COMMAND ACTIVATION AND WHEEL FACILITY -; -; The following equates enable various ZCPR3-resident commands. -; The user may invoke these as desired, but should keep in mind the size -; of the resulting ZCPR3 and make sure it does not exceed the required -; limits. -; -DIRON equ FALSE ;DIR COMMAND -LTON equ TRUE ;LIST, TYPE COMMANDS -GOON equ TRUE ;GO COMMAND -ERAON equ TRUE ;ERA COMMAND -SAVEON equ FALSE ;SAVE COMMAND -RENON equ FALSE ;REN COMMAND -GETON equ FALSE ;GET COMMAND -JUMPON equ FALSE ;JUMP COMMAND -NOTEON equ TRUE ;NOTE COMMAND - -; -; The Wheel equate table enables the WHEEL facility of ZCPR3. With this -; facility, a WHEEL BYTE, which exists somewhere in memory, is examined -; before a set of installer-selected commands are executed. -; If this byte is not zero, then the command proceeds. If it is zero, -; then the command is not allowed to proceed and is exited with an error -; message. -; -; The following set of equates make each of the indicated commands -; selectable to respond to the Wheel Byte or not. For instance, if -; WERA=TRUE, then it responds to the Wheel Byte; if WERA=FALSE, it does not. -; - IF Z3WHL NE 0 ;IF A WHEEL BYTE ADDRESS IS DEFINED -WERA equ FALSE ;Make ERA a Wheel-Oriented Command -WREN equ FALSE ; " REN " " " " -WLT equ FALSE ; " L/T " " " " (LIST/TYPE) -WGO equ FALSE ; " GO " " " " -WSAVE equ FALSE ; " SAVE " " " " -WGET equ FALSE ; " GET " " " " -WJUMP equ FALSE ; " JUMP " " " " -WDU equ FALSE ; " DU: " " " " (DU/DIR Change) -WHEEL equ WERA OR WREN OR WLT OR WGO OR WSAVE OR WGET OR WJUMP OR WDU - ENDIF ;Z3WHL - -; -; 7. ZCPR3 RESIDENT COMMAND TABLE -; -; This table consists of the names of the various ZCPR3-resident -; commands and their addresses. The NCHARS equate defines how many -; characters long each name may be, and all table entries must be exactly -; the indicated number of characters (trailing spaces are used to fill -; out shorter names). -; -; Each table entry is structured as follows: -; -; DB 'CMND' ;Name of Command (NCHARS long) -; DB CMNDADR ;Address of Command within ZCPR3 -; -; The installer should only change the names of the commands as -; desired and should not, as a rule, touch the address definition since -; this is fixed within the body of ZCPR3. -; -NCHARS EQU 4 ;NUMBER OF CHARS/COMMAND - -CTABLE MACRO -; - IF DIRON - DB 'DIR ' - DW DIR ;DIRECTORY DISPLAY COMMAND - ENDIF -; - IF LTON - DB 'LIST' - DW LIST ;LIST FILE ON PRINTER COMMAND - DB 'TYPE' - DW TYPE ;TYPE FILE ON CONSOLE COMMAND - ENDIF -; - IF GOON - DB 'GO ' - DW GO ;EXECUTE CURRENT TPA COMMAND - ENDIF -; - IF ERAON - DB 'ERA ' - DW ERA ;ERASE FILES COMMAND - ENDIF -; - IF SAVEON - DB 'SAVE' - DW SAVE ;SAVE TPA COMMAND - ENDIF -; - IF RENON - DB 'REN ' - DW REN ;RENAME FILES COMMAND - ENDIF -; - IF GETON - DB 'GET ' - DW GET ;LOAD FILE INTO TPA COMMAND - ENDIF -; - IF JUMPON - DB 'JUMP' - DW JUMP ;JUMP TO ANY MEMORY LOCATION COMMAND - ENDIF -; - IF NOTEON - DB 'NOTE' - DW NOTE ;NOTE - NULL COMMAND (NOP) - ENDIF -; - ENDM - - -; -; 8. CONTROLS ON ZCPR3 RESIDENT COMMANDS -; -; The following sets of equates provide special controls and -; parameters on various ZCPR3-resident commands. -; - -; -; The following equates set the width of the spacing between the -; file names for the DIR command and the character used to separate file -; names from one another on the same line. -; -; Assuming that FENCE is set to the character '|', If WIDE is TRUE, -; then the output will look like: -; -; filename.typ__|__filename.typ ... -; -; while if WIDE is FALSE, the output will look like: -; -; filename.typ_|_filename.typ ... -; -; (underscore represents a space) -; -WIDE EQU TRUE -FENCE EQU '|' - -; -; The following equates define two flags which are used in -; conjunction with the DIR command on the command line. SYSFLG is -; the character used to indicate to DIR that all files, both System -; and Non-System, are to be displayed. SOFLG is the character used -; to indicate to DIR that only the System files are to be displayed. -; By default, DIR displays non-System files. -; -; For example, if SYSFLG is set to 'A' and SOFLG is set to -; 'S', then: -; DIR *.COM A -; -; displays all COM files with both System and non-System attributes -; while: -; DIR *.COM S -; -; displays only COM files with the System attribute. Naturally: -; -; DIR *.COM -; -; displays only COM files with the non-System attribute. -; -SYSFLG EQU 'A' -SOFLG EQU 'S' - -; -; The following equate causes ERA to confirm the files to be erased -; before it goes ahead and erases them. If ERAOK is TRUE, then the user -; will be prompted each time; if it is FALSE, then the user will not be -; prompted. -; -ERAOK equ FALSE - -; -; If ERAOK is TRUE, the following equate adds a Verify option to the -; ERA command which causes the user to be prompted only if the Verify -; option letter, defined by ERDFLG, is given after the file name. If -; ERAV is TRUE, then the user will be asked to verify only when ERDFLG -; is contained in the command line; if ERAV is FALSE, the user will always -; be asked to verify. -; -; For example, if ERAOK is TRUE, ERAV is TRUE, and ERDFLG is 'V', -; then the command: -; ERA *.* V -; will result in the file names being displayed and the user being asked -; for verification. If the V option were not given, the user would not -; be asked for verification. -; -ERAV equ FALSE -ERDFLG equ 'V' - -; -; The following equates set the paging parameters for the TYPE -; command. -; -; PGDFLT determines if TYPE pages by default. If PGDFLT is TRUE, -; then: -; TYPE FILE.TXT -; -; will be paged. If PGDFLT is FALSE, the above command will not be paged. -; -; PGDFLG defines the option character in the TYPE command line which -; is used to toggle the default set by PGDFLT. Assuming that PGDFLG is set -; to 'P', then: -; TYPE FILE.TXT P -; -; will page the file listing if PGDFLT is FALSE and not page it if PGDFLT is -; TRUE. -; -PGDFLT EQU TRUE -PGDFLG EQU 'P' - -; -; The following equate defines the number of lines on the user's CRT -; screen for use by the TYPE command when it is paging. This value is usually -; 24. -; -NLINES EQU 24 - -; -; The following equate defines the option letter used with the -; SAVE command to indicate that the associated number is 128-byte sectors -; as opposed to 256-byte pages. For example, if SECTFLG is set to 'S', then: -; -; SAVE 25 FILE.BIN S -; -; save 25 128-byte sectors starting at location 100H into the file named -; FILE.BIN. IF the S option was not present, SAVE would have saved 25 -; 256-byte blocks starting at location 100H into the file named FILE.BIN. -; -SECTFLG EQU 'S' - -; -; 9. PATH DEFINITION -; -; The following equate specifies the address of the PATH to be followed -; for the PATH command-search if the PATH is to be initialized by the BIOS -; and set by the user via a PATH.COM program. The value of PATH should -; be the address of the PATH data area in memory. If the internal PATH -; provided by ZCPR3 is to be used, then PATHBASE should be equated to 0, -; which selects the PATH located just after the MEMLOAD routine. If the -; external PATH is to be used, then PATHBASE should be set to the address -; of the external path. -; -; A PATH is a series of byte-pairs, terminated by a binary 0. The first -; byte of each pair is the disk number (1-16 for disks A-P), and the second -; byte of each pair is the user number (0-31). The special character '$' -; indicates the current user or current disk. For example, the path -; from current disk/current user to current disk/user 0 to disk A/user 0 -; is selected by the following sequence: -; -; DB '$$' ;current disk/user -; DB '$',0 ;current disk/user 0 -; DB 1,0 ;disk A/user 0 -; DB 0 ;end of path -; - IF EXPATH NE 0 ;External Path Selected -; -; This equate defines the base address of the external path -; -PATH equ EXPATH ;External ZCPR3 PATH at CBIOS Buffer Area - - ELSE ;Internal Path Selected -; -; The following macro defines the n-element internal path -; -IPATH MACRO - db 'A'-'@','$' ;Disk A, Current User - db 'A'-'@',0 ;Disk A, User 0 - db 0 ;End of Path -- MUST be here - ENDM -; - ENDIF - -; -; The following flag enables ZCPR3 to perform an optimized path -; search when it is searching along a path for a file. If this equate -; is TRUE, ZCPR3 will build a path in memory of absolute entries (A1, B7, etc) -; from the symbolic path (one containing '$') which is the path it would -; otherwise use. This new path would contain no duplicate path elements, -; where a symbolic path analysis may. For example, if the path is: -; -; db 'A'-'@','$' ;disk A, current user -; db 'A'-'@',15 ;disk A, user 15 -; db 0 -; -; then if the user is logged into A15, setting the below equate to TRUE -; would allow ZCPR3 to build the path: -; -; db 'A'-'@',15 ;only one entry -; db 0 -; -; in the analysis of this symbolic path, while with this equate FALSE, -; ZCPR3 may log into A15 as many as three times (once for the default -; and twice more for the symbolic path) in looking for a file which is -; not found before it gives up. Using this minimum path facility costs -; some code in ZCPR3, but it speeds up processing noticably in some cases. -; -; Enable this equate if MINIMUM PATH SEARCH is to be employed. -; -MINPATH EQU TRUE - -; -; In searching for a file along a path, ZCPR3 can be commanded -; to always look in the current logged-in directory before beginning -; the path search. This equate controls this feature. If SCANCUR -; is set to TRUE, the current directory need never be referenced in -; a symbolic path expression (DB '$','$') since SCANCUR insures that -; the current directory is scanned. -; -; Enable this equate if the current DU is always to be scanned. -; -SCANCUR EQU TRUE - - -; -; 10. DU AND DIR CONTROLS -; - -; -; The following equate enables the appearance of the current disk/user -; in the ZCPR3 prompt. If set to FALSE, the prompt appears as '>' (assuming -; > is the current value of CPRMPT). If set to TRUE, the prompt appears -; as 'd>' or 'dn>'. (see INCLNDR below) -; -INCLDU equ TRUE - -; -; The following equate allows ZCPR3 to accept the DU: prefix or -; login form for input. Set this to TRUE if DU: prefix is to be allowed. -; -; Setting this equate to TRUE allows the following forms: -; -; A>B1: -; A>TYPE B4:FILE.TXT -; A>B: -; A>1: -; -ACCPTDU EQU TRUE - -; -; This equate enables ZCPR3 to process DIR: forms internally -; through the memory-based named directory buffer. This equate and -; the NDBASE address should be TRUE (non-zero) in order to enable -; ZCPR3 to process named directories. -; -; If NDINCP is TRUE, the following forms are allowed: -; -; A>ROOT: -; A>TYPE TEXT:FILE.TXT -; -; if the other associated equates (below) are set correctly. -; -NDINCP EQU TRUE - -; -; The following equate will cause the name of the current directory -; to be displayed as part of the prompt along with the DU form if enabled. -; (see INCLDU above) -; -; For example, if INCLNDR is TRUE, the prompt would look like: -; -; B7:TEXT> -- if INCLDU is also TRUE -; TEXT> -- if INCLDU is FALSE -; -INCLNDR EQU TRUE - -; -; The following equate allows ZCPR3 to accept the DIR: prefix or -; login form for input. Set this to TRUE if DIR: prefix is to be allowed. -; -; Setting this equate to TRUE allows the following forms: -; -; A>ROOT: -; A>TYPE TEXT:FILE.TXT -; -ACCPTND EQU TRUE - -; -; The following equate determines the hierarchy of DU:/DIR: evaluation. -; Set this to TRUE if DU: is to be tested for before DIR: or set this to -; FALSE if DIR: is to be tested for before DU:. If this is FALSE, named -; directories like C: (standing for C work area - NOT disk C) are permitted. -; -; Assuming that a directory for C programs, named 'C', and a root -; directory, named 'ROOT', exist, then if DUFIRST is set to FALSE: -; -; A>C: -- logs the user into the directory named 'C' -; A>ROOT: -- logs the user into the directory named 'ROOT' -; -; while if DUFIRST is set to TRUE: -; -; A>C: -- logs the user into disk C: (dir C can't be accessed) -; A>ROOT: -- logs the user into the directory named 'ROOT' -; -DUFIRST EQU FALSE - -; -; Enable password check on named directory references. If a named -; directory is referenced and has a password associated with it, ZCPR3 -; will ask the user for this password and approve the reference only -; if he gives a valid response. One and only one try is permitted. -; Setting this equate to TRUE will enable the password check facility. -; -PWCHECK EQU FALSE - - -; -; 11. COMMAND LINE BUFFER CONTROL -; -; The MULTCMD equate enables the feature of having more than -; one command on the same line, separated by a separation char -; which is defined by the CMDSEP equate. If this feature is -; enabled, the command line buffer and buffer pointers are -; moved outside of ZCPR3 at the indicated address of Z3CL. -; -; MULTCMD indicates if the ability to have more than one command -; on a line is to be enabled, and CMDSEP is the character used to separate -; these commands. For example, if CMDSEP is ';' and MULTCMD is TRUE, then -; commands like this are possible: -; -; ERA *.BAK;DIR -; - IF Z3CL NE 0 -MULTCMD equ TRUE - ELSE -MULTCMD equ FALSE - ENDIF -CMDSEP equ ';' - - -; -; 12. CMDRUN -- ZCPR3 EXTENDED COMMAND PROCESSING FACILITY -; -; This equate enables the ZCPR3 CMDRUN facility. If CMDRUN is TRUE, then -; another stage of command processing is invoked should ZCPR3 fail to find -; a COM file when the user gives a command. This stage involves invoking -; the COM file specified by CMDFCB and giving it the current command line -; as an argument. In this way, if, say, M80 PROG2 fails as a command, -; a new command like LRUNZ M80 PROG2, SUB M80 PROG2, or ZEX M80 PROG2 may -; be processed. If the new command fails, an appropriate error message is -; given. -; -; The ROOTONLY option causes ZCPR3 to only look at the Root (bottom of -; path) for the Extended Command Processor if it is set to TRUE. If it -; is set to FALSE, the path is searched for the Extended Command Processor. -; The tradeoff here is that ROOTONLY = TRUE is less flexible but somewhat -; faster than ROOTONLY = FALSE. -; -CMDRUN equ FALSE ; Enable the Facility - - if CMDRUN -ROOTONLY equ TRUE ; TRUE if look at Root Only for Extended - ; Command Processor, FALSE if look along - ; path -CMDFCB MACRO - db 0 - db 'CMDRUN ' ;Name of Program - db 'COM' ;File Type - ENDM - endif ;CMDRUN - - -; -; 13. FLOW COMMAND FACILITY -; -; This equate enables ZCPR3 to respond to IF processing. -; ZCPR3 simply flushes commands if a FALSE IF is currently engaged. -; FCPs must be enabled for IFON to work correctly. -; -IFON EQU FALSE - - -; -; 14. MISCELLANEOUS EQUATES -; -MAXUSR EQU 31 ;MAXIMUM USER NUMBER ACCESSABLE -MAXDISK EQU 4 ;MAXIMUM NUMBER OF DISKS ACCESSABLE - -SUPRES EQU TRUE ;SUPRESSES USER # REPORT FOR USER 0 - -SPRMPT EQU '$' ;CPR PROMPT INDICATING SUBMIT COMMAND -CPRMPT EQU '>' ;CPR PROMPT INDICATING USER COMMAND - -NUMBASE EQU 'H' ;CHAR USED TO SWITCH FROM DEFAULT NUMBER BASE - -CURIND EQU '$' ;SYMBOL FOR CURRENT DISK OR USER - -COMMENT EQU ';' ;LINES BEGINNING WITH THIS CHAR ARE COMMENTS - -; -; END OF ZCPR3 CUSTOMIZATION SECTION -; - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3LDRBUG.LBR b/Source/Images/d_bp/u15/Z3LDRBUG.LBR deleted file mode 100644 index 8a70b2e9..00000000 Binary files a/Source/Images/d_bp/u15/Z3LDRBUG.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/Z3LOC.COM b/Source/Images/d_bp/u15/Z3LOC.COM deleted file mode 100644 index e7f7844d..00000000 Binary files a/Source/Images/d_bp/u15/Z3LOC.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/Z3LOC.MAC b/Source/Images/d_bp/u15/Z3LOC.MAC deleted file mode 100644 index 9090661a..00000000 --- a/Source/Images/d_bp/u15/Z3LOC.MAC +++ /dev/null @@ -1,212 +0,0 @@ -; -; PROGRAM: Z3LOC -; AUTHOR: RICHARD CONN -; VERSION: 1.0 -; DATE: 18 MAY 84 -; PREVIOUS VERSIONS: None -; DERIVATION: CCPLOC 1.1 (6 Jan 83) -; -VERS EQU 10 -z3env SET 0f400h - -; -; Z3LOC -- ZCPR3 Environment Element Locator -; -; The purpose of Z3LOC is to locate the addresses of the running -; ZCPR3 CCP, BDOS, and BIOS, and to display these values to the user. -; If the Z option is given, the addresses of the following system elements -; are also presented: -; -; External Path -; RCP -; IOP -; FCP -; Named Directory -; Command Line Buffer -; Shell Stack -; Environment Descriptor -; External FCB -; ZCPR3 Message Buffer -; External Stack -; Wheel Byte -; - -; -; CP/M Constants -; -bdos equ 5 ; BDOS Entry -fcb equ 5dh ; 1st char in FCB -cr equ 0dh -lf equ 0ah - -; -; Externals -; - ext z3init,envptr - ext print,phl4hc,cout,crlf - -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB Z3BASE.LIB - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env and the VLIB Env - call print - db 'Z3LOC Version ' - db (vers/10)+'0','.',(vers mod 10)+'0',0 - lda fcb ;check for help - cpi 'Z' ;Z is only option - jz start1 - cpi ' ' ;no option? - jz start1 - call print - db cr,lf,' Z3LOC or Z3LOC Z' - db cr,lf,'Z3LOC gives the addresses of the CCP, BDOS, and BIOS.' - db cr,lf,'Z3LOC Z gives all key ZCPR3 addresses.',0 - ret -start1: - call print - db cr,lf,'ZCPR3 Element Base Address' - db cr,lf,'------------- ------------',0 - - lhld bdos+1 ;get base address of BDOS - mvi l,0 ;set to even boundary - lxi d,-800H ;back up to start of CCP (size of CCP) - dad d ;HL pts to CCP - call print - db cr,lf,' CCP ',0 - call prdata - - lhld bdos+1 ;just get base address of BDOS again - call print - db cr,lf,' BDOS ',0 - call prdata - - mvi l,0 ;set even page - lxi d,0e00h ;size of BDOS - dad d ;HL pts to BIOS - call print - db cr,lf,' BIOS ',0 - call prdata - - call crlf ;new line - lda fcb ;check for Z option - cpi 'Z' - rnz ;done if not Z - - call print - db cr,lf,'Env Descriptor ',0 - lxi d,18 ;offset to env descriptor element - call z3data - call crlf - - call print - db cr,lf,'Pack: FCP ',0 - lxi d,9 - call z3data - - call print - db cr,lf,' IOP ',0 - lxi d,6 - call z3data - - call print - db cr,lf,' RCP ',0 - lxi d,3 - call z3data - call crlf - - call print - db cr,lf,'Buf: Cmd Line ',0 - lxi d,15 - call z3data - - call print - db cr,lf,' Ext FCB ',0 - lxi d,27 - call z3data - - call print - db cr,lf,' Ext Path ',0 - lxi d,0 - call z3data - - call print - db cr,lf,' Ext Stk ',0 - lxi d,29 - call z3data - - call print - db cr,lf,' Messages ',0 - lxi d,25 - call z3data - - call print - db cr,lf,' Named Dir ',0 - lxi d,12 - call z3data - - call print - db cr,lf,' Shell Stk ',0 - lxi d,21 - call z3data - - call print - db cr,lf,' Wheel Byte ',0 - lxi d,32 - call z3data - - jmp crlf ;new line and exit - -; -; Z3DATA -- Print Data Fields for a ZCPR3 Element -; -z3data: - lhld envptr ;pt to environment - dad d ;HL pts to element - lxi d,9 ;add 9 for initial offset - dad d ;fall thru to PRDATA - mov e,m ;get address - inx h - mov d,m - xchg - -; -; PRDATA -- Print Data Field (Base Address) -; -prdata: - call print - db ' ',0 - call phl4hc ;print full address - call print - db ' H',0 - ret - - end - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3LOC11.LBR b/Source/Images/d_bp/u15/Z3LOC11.LBR deleted file mode 100644 index b5f59537..00000000 Binary files a/Source/Images/d_bp/u15/Z3LOC11.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/Z3RES.HLP b/Source/Images/d_bp/u15/Z3RES.HLP deleted file mode 100644 index c65cf3b6..00000000 --- a/Source/Images/d_bp/u15/Z3RES.HLP +++ /dev/null @@ -1,220 +0,0 @@ -ZCPR3 Resident Commands -DIR Directory Display -ERA Erase Files -GET Load File into Memory -GO Re-execute Last Transient -JUMP Branch to Memory Address -NOTE Comment -REN Rename File -SAVE Write Memory Image to Disk -TYPE and LIST Commands -The DU and DIR Forms for Changing Disk and User -:ZCPR3 Resident Commands - - Likå  thå CP/Í 2.² CCP¬  ZCPR³ containó  somå  commandó -withiî itself®  Iô containó alì oæ thå CCÐ commandó (excepô -USER¬ whicè isn'ô needeä anymore© anä á fe÷ more¬ buô alì oæ -thå  ZCPR³  residenô  commandó arå  differenô  witè  logicaì -extensionó tï thå CCÐ commands. - - Thå  followinç  discussioî  applieó tï thå alì  oæ  thå -commandó  iî thå ZCPR³ Commanä Processoò  Replacement®  Thå -particulaò  selectioî oæ commandó availablå aô anù onå  timå -ió  installation-dependent®  Thå recommendeä  configuratioî -wherå  alì oæ thå residenô commandó arå enableä witè alì  oæ -theiò optionó turneä oî ió covereä here. - - Iî thå followinç discussion¬  "afn¢ referó tï thå  CP/Í -ambiguouó   filå  namå  forí  (containinç  "?¢  and/oò   "*¢ -characters©  anä  "ufn¢ referó tï thå CP/Í unambiguouó  filå -namå forí (doeó noô contaiî thå ambiguouó characters). - - - Thå DUº  oò DIRº  prefixeó maù bå useä wheneveò á  filå -namå  ió  used®  Bù  attachinç thió  prefix¬  thå  filå  ió -identifieä  tï  residå iî thå indicateä directorù (disë  anä -useò  area)®  Tï  revie÷ thå DUº  form¬  iô  ió  á  logicaì -extensioî  tï thå Dº  prefiø undeò conventionaì  CP/M®  Thå -useò numbeò ió added¬ however® Thå DIRº forí ió á mnemonic¬ -likå PASCAL¬  whicè ió relateä tï á disë anä useò areá bù aî -associatioî iî thå Nameä Directory. - - Iæ  á prefiø oæ Dº  ió used¬  iô referó tï thå  currenô -useò areá oî thå indicateä disk® Iæ á prefiø oæ Uº ió used¬ -iô  referó  tï thå indicateä useò areá oî thå currenô  disk® -DU:¬  oæ  course¬  referó tï thå indicateä useò areá oî  thå -indicateä disk. - - - Foò example¬ iæ thå useò ió loggeä intï Disë B¬ Useò 1¬ -theî thå followinç ió true: - - A:MYFILE.TXÔ -- referó tï MYFILE.TXÔ oî Disë A¬ Useò 1 - 4:MYFILE.TXT -- refers to MYFILE.TXT on Disk B, User 4 - A4:MYFILE.TXT -- refers to MYFILE.TXT on Disk A, User 4 - MYFILE.TXT -- refers to MYFILE.TXT on Disk B, User 1 - -:The DIR Command - - Thå  DIÒ  commanä ió useä tï displaù thå nameó  oæ  thå -fileó iî thå currenô directory® Iô haó threå basiã formó -- - - Display $DIR File Names DIR DU:afn - Display $SYS File Names DIR DU:afn S - Display All File Names DIR DU:afn A - - Assumå  thå  useò  ió  loggeä  intï  Disë  B¬  Useò  1® -Examples: - - DIR 4: <-- Gives all non-System files - on B4 - DIR 4: A <-- Gives all files on B4 - DIR A4:*.HLP A <-- Gives all files of type - HLP on A4 - DIR *.* S <-- Gives all System files on B1 - -:The ERA Command - - Thå ERÁ commanä ió useä tï eraså files® Iô ió noô ablå -tï eraså Read/Onlù files¬ buô iô caî eraså Systeí files® Iô -haó twï basiã formó -- - - Erase Specified Files ERA DU:afn - Erase with Verify ERA DU:afn V - - ERÁ  printó thå nameó oæ thå fileó iô erases®  Iæ  yoõ -havå selecteä thå Verifù option¬  iô alsï promptó yoõ beforå -iô eraseó theí (oò aborts¬ iæ yoõ desire). - -:The GET Command - - GEÔ  ió useä tï loaä á filå anywherå intï  memory®  Iô -requireó   twï   argumentsº   á  numbeò  (assumeä   tï   bå -hexadecimal©  oæ  thå 256-bytå pagå iî memorù  aô  whicè  tï -starô thå loaä anä thå namå oæ thå file. - - Load File Into Memory GET adr DU:ufn - - Notå thaô thió "adr¢ ió á pagå number¬  sï adr=± referó -tï 100H¬ adr=2ä referó tï 2D00H¬ etc. - -:The GO Command - Š Thå  GÏ  commanä ió useä tï reexecutå thå lasô  prograí -loadeä intï thå TPÁ withouô havinç tï reloaä it. - - Reexecute Last Transient GO params - Without Reloading It - - Thå  parameteró  arå  parseä  aó  witè  anù   transienô -command¬  anä  thå appropriatå bufferó arå loadeä bù  ZCPR3® -Aó usual¬  ZCPR³ "calls¢ thå prograí loadeä aô 100È afteò iô -haó finisheä witè thå parsinç anä buffeò loading. - -:The JUMP Command - - JUMÐ ió useä tï brancè tï anywherå iî memory® Iô takeó -onlù  onå argument¬  whicè ió thå addresó aô whicè tï  jump® -Thió  addresó caî bå tï anù bytå iî memorù (iô ió á fulì 16- -biô address)¬ anä iô ió assumeä tï bå á hexadecimaì number. - - Call Subroutine Anywhere in JUMP adr - Memory - -:The NOTE Command - - NOTÅ  ió useä tï expresó comments®  Á  linå  beginninç -witè á semicoloî (;© ió á comment¬  anä á commanä whoså verâ -ió  NOTÅ (therå maù bå manù commandó oî onå line¬  separateä -by semicolons) is a comment. - - Comment NOTE anytext - -:The REN Command - - Thå REÎ commanä ió useä tï changå thå namå oæ onå  filå -tï  another®  Again¬  iô  caî  noô  changå thå  namå  oæ  á -Read/Onlù file® Iô haó onlù onå basiã forí -- - - Renamå Filå REÎ DU:ufn1=ufn² - - Likå  ERA¬  REÎ caî "see¢ Systeí fileó aó welì  aó  DIÒ -files. - - Iæ  ufn±  alreadù exists¬  REÎ wilì asë thå useò iæ  hå -wantó tï Eraså iô (witè thå prompô "Eraså ufn1?"). - -:The SAVE Command - - Thå  SAVÅ commanä ió useä tï savå thå contentó  oæ  thå -TPÁ  ontï  disë aó á file®  Iô acceptó  twï  argumentsº  á -numbeò  anä  á filå name®  Thå filå namå maù bå  optionallù -followeä  bù thå letteò "S¢ tï indicatå thaô thå  numbeò  ió -thå numbeò oæ 128-bytå Sectoró (Blocks© tï bå saved¬ and¬ iæ -thió  optioî letteò ió omitted¬  thå numbeò ió assumeä tï bå -thå numbeò oæ 256-bytå Pageó tï bå saved®  Thå SAVÅ commanä -haó twï basiã formó -- - Š Save Memory into File SAVE n DU:ufn - Save Memory into File SAVE n DU:ufn S - and Specify Number of - Blocks - - Iæ thå number¬  n¬ ió followeä bù thå suffiø "H"¬ aó iî -"FH¢  oò "2DH"¬  theî î ió takeî tï bå á hexadecimaì  value® -Iæ  nï suffiø ió given¬  î ió assumeä tï bå  decimal®  Thió -hexadecimaì  optioî eliminateó thå neeä foò conversioî  froí -thå valueó supplieä bù debuggers¬ likå DDT. - - Iæ thå indicateä filå alreadù exists¬ SAVÅ wilì asë thå -useò iæ hå wisheó tï eraså iô witè thå prompô "Eraså ufn?". - -:The TYPE and LIST Commands - - TYPÅ anä LISÔ arå useä tï displaù fileó oî thå  consolå -anä printer¬  resp®  TYPÅ pageó bù default¬  stoppinç afteò -thå  screeî ió filled®  Theså twï commandó havå threå basiã -formó -- - - Print File on Console TYPE DU:ufn P - Without Paging - Print File on Console TYPE DU:ufn - With Paging - Print File on Printer LIST DU:ufn - - The file may be either System or DIR. - -:The DU and DIR Forms for Changing Disk and User - - Thå  DÕ  forí  standinç alonå ió useä  tï  loç  intï  á -differenô  directory®  Therå arå threå basiã formó oæ  thió -commanä -- - - Change Disk D: - Change User U: - Change Disk and User at DU: - Same Time - - - Thå  DIÒ  forí standinç alonå maù alsï bå useä  tï  loç -into a different directory. The format is: - - DIR: -like - TEXT: - - Nameä  directorieó havå passwordó associateä witè them¬ -sï iæ anù DIRº directorù referencå haó á non-blanë password¬ -thå useò wilì bå prompteä foò thå password®  Thå  directorù -referencå  wilì  bå  reseô tï hió currenô directorù  iæ  thå -password is invalid. - - - Thå  DUº  forí maù bå disableä undeò  ZCPR3¬  anä  thió -leaveó onlù thå DIRº  form®  Usinç thå DIRº form¬ directorù -access can be controlled: - - 1. only disk/user areas named can be referenced - - 2. password protection is provided - - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3TCAP.AQM b/Source/Images/d_bp/u15/Z3TCAP.AQM deleted file mode 100644 index 8262a6f7..00000000 Binary files a/Source/Images/d_bp/u15/Z3TCAP.AQM and /dev/null differ diff --git a/Source/Images/d_bp/u15/Z3TCAP.ASM b/Source/Images/d_bp/u15/Z3TCAP.ASM deleted file mode 100644 index a698a4a9..00000000 --- a/Source/Images/d_bp/u15/Z3TCAP.ASM +++ /dev/null @@ -1,1024 +0,0 @@ -; ZCPR3 System Segment: Z3TCAP (Terminal Capabilities File) -; Author: Richard Conn -; Version: 1.3 - -; Modified slightly and added some more terminals. 13 Sep 84 jww -; More terminals. 25 Sept 84 jww -; More terminals. 12 Oct 84 jww -; More terminals. 28 Oct 84 jww (Version 1.3) - -esc equ 1bh ; Escape character jww - -; -; Z3TCAP is divided into to main parts -- the index, which contains -; a set of 16-byte entries describing the names of the terminals to follow -; and the main body, which contains the details on the terminals themselves. -; Origin does not make any difference since everything is relative anyway. -; The index is always an integral number of 128-byte blocks in size, and -; each terminal entry in the main body is 128 bytes in size. -; - - ORG 100H ; just for consistency - -; -; Z3TCAP INDEX -; Structure is: -; DS 16 ; Name of Terminal -; ... -; DB ' ' ; Blank Entry Marks End -; DS 16*n ; Required to fill out last 128-byte block -; - DB 'AA Ambassador ' ;Name of Terminal - DB 'ADDS Consul 980 ' ;Name of Terminal - DB 'ADDS Regent 20 ' ;Name of Terminal - DB 'ADDS Viewpoint ' ;Name of Terminal - DB 'ADM 2 ' ;Name of Terminal - DB 'ADM 31 ' ;Name of Terminal - DB 'ADM 3A ' ;Name of Terminal - DB 'ADM 42 ' ;Name of Terminal - DB 'Bantam 550 ' ;Name of Terminal - DB 'CDC 456 ' ;Name of Terminal - DB 'Concept 100 ' ;Name of Terminal - DB 'Concept 108 ' ;Name of Terminal - DB 'CT82 ' ;Name of Terminal - DB 'DEC VT52 ' ;Name of Terminal - DB 'DEC VT100 ' ;Name of Terminal - DB 'Dialogue 80 ' ;Name of Terminal - DB 'Direct 800/A ' ;Name of Terminal - DB 'Epson GENEVA ' ;Name of Terminal - DB 'Epson QX-10 ' ;Name of Terminal - DB 'General Trm 100A' ;Name of Terminal - DB 'Hazeltine 1420 ' ;Name of Terminal - DB 'Hazeltine 1500 ' ;Name of Terminal - DB 'Hazeltine 1510 ' ;Name of Terminal - DB 'Hazeltine 1520 ' ;Name of Terminal - DB 'H19 (ANSI Mode) ' ;Name of Terminal - DB 'H19 (Heath Mode)' ;Name of Terminal - DB 'HP 2621 ' ;Name of Terminal - DB 'IBM 3101 ' ;Name of Terminal - DB 'Kaypro II ' ;Name of Terminal - DB 'Kaypro 10 ' ;Name of Terminal - DB 'Micro Bee ' ;Name of Terminal - DB 'Microterm ACT IV' ;Name of Terminal - DB 'Microterm ACT V ' ;Name of Terminal - DB 'NorthStar Advant' ;Name of Terminal - DB 'Osborne I ' ;Name of Terminal - DB 'P Elmer 1100 ' ;Name of Terminal - DB 'P Elmer 1200 ' ;Name of Terminal - DB 'Qume QVT 102 ' ;Name of Terminal - DB 'SOROC 120 ' ;Name of Terminal - DB 'Super Bee ' ;Name of Terminal - DB 'TAB 132 ' ;Name of Terminal - DB 'Teleray 1061 ' ;Name of Terminal - DB 'Teleray 3800 ' ;Name of Terminal - DB 'TTY 4424 ' ;Name of Terminal - DB 'TVI 912 ' ;Name of Terminal - DB 'TVI 920 ' ;Name of Terminal - DB 'TVI 950 ' ;Name of Terminal - DB 'TVI 970 ' ;Name of Terminal - DB 'VC 404 ' ;Name of Terminal - DB 'VC 415 ' ;Name of Terminal - DB 'Visual 200 ' ;Name of Terminal - DB 'WYSE 50 ' ;Name of Terminal - - DB ' 1.3 ' ; Last Entry -; -; Compute Space Remaining to Fill 128-byte Block -; -endsp equ 128-($-$/128*128) - if (endsp eq 128) - DS 0 - else - DS endsp - endif - -; -; TERMS - Terminal Data -; Structure is: -; DS 16 ; Name of Terminal -; DS 1 ; Char for Cursor UP -; DS 1 ; Char for Cursor DOWN -; DS 1 ; Char for Cursor RIGHT -; DS 1 ; Char for Cursor LEFT -; DS 1 ; Delay After CL -; DS 1 ; Delay After CM -; DS 1 ; Delay After CE -; DS N ; CL string, ending in 0 -; DS N ; CM string, ending in 0 -; DS N ; CE string, ending in 0 -; DS N ; SO string, ending in 0 -; DS N ; SE string, ending in 0 -; DS N ; TI string, ending in 0 -; DS N ; TE string, ending in 0 -; - -; Terminal xxxx -TTABLE: - DB 'AA Ambassador ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 156 ;CL Delay - DB 00 ;CM Delay - DB 05 ;CE Delay - DB esc,'[H',esc,'[J',0 ;CL String - DB esc,'[%i%d;%dH',0 ;CM String - DB esc,'[K',0 ;CE String - DB esc,'[7m',0 ;SO String - DB esc,'[m',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'ADDS Consul 980 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'L'-'@',80h,'K'-'@','@',0 ;CL String - DB 'K'-'@','%+@',esc,'E'-'@','%2',0 ;CM String - DB 0 ;CE String - DB 'Y'-'@',1eh,'N'-'@',0 ;SO String - DB 'O'-'@',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'ADDS Regent 20 ' ;Name of Terminal - DB 'Z'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'F'-'@' ;Cursor RIGHT - DB 'U'-'@' ;Cursor LEFT - DB 0 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'L'-'@',0 ;CL String - DB esc,'Y%+ %+ ',0 ;CM String - DB esc,'K',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'ADDS Viewpoint ' ;Name of Terminal - DB 'Z'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'F'-'@' ;Cursor RIGHT - DB 'U'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'L'-'@',0 ;CL String - DB esc,'Y%+ %+ ',0 ;CM String - DB esc,'K',0 ;CE String - DB 'N'-'@',0 ;SO String - DB 'O'-'@',0 ;SE String - DB esc,'0A',0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'ADM 2 ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 0 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,';',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'T',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'ADM 31 ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 0 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'*',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'T',0 ;CE String - DB esc,'G1',0 ;SO String - DB esc,'G0',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'ADM 3A ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 01 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'Z'-'@',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB 0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'ADM 42 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,';',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'T',0 ;CE String - DB esc,'G4',0 ;SO String - DB esc,'G0',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Bantam 550 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 20 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'K',0 ;CL String - DB esc,'X%+ ',esc,'Y%+ ',0 ;CM String - DB esc,'I',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'CDC 456 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'Y'-'@','X'-'@',0 ;CL String - DB esc,'1%+ %+ ',0 ;CM String - DB 'V'-'@',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Concept 100 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 16 ;CE Delay - DB 'L'-'@','L'-'@',0 ;CL String - DB esc,'a','%+ %+ ',0 ;CM String - DB esc,'U'-'@',0 ;CE String - DB esc,'E',esc,'D',0 ;SO String - DB esc,'d',esc,'e',0 ;SE String - DB esc,'U',esc,'v 8p',esc,'p',0dh,0 ;TI String - DB esc,'v ',80h,80h,80h,80h,80h,80h - DB esc,'p',0dh,0ah,0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Concept 108 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 16 ;CE Delay - DB esc,'?',esc,'E'-'@',0 ;CL String - DB esc,'a','%+ %+ ',0 ;CM String - DB esc,'S'-'@',0 ;CE String - DB esc,'D',0 ;SO String - DB esc,'d',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'CT82 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'L'-'@',0 ;CL String - DB '%r','K'-'@','%.%.',0 ;CM String - DB 'F'-'@',0 ;CE String - DB 1eh,'V'-'@',0 ;SO String - DB 1eh,'F'-'@',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'DEC VT52 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'H',esc,'J',0 ;CL String - DB esc,'Y%+ %+ ',0 ;CM String - DB esc,'K',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'DEC VT100 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 50 ;CL Delay - DB 05 ;CM Delay - DB 03 ;CE Delay - DB esc,'[;H',esc,'[2J',0 ;CL String - DB esc,'[%i%d;%dH',0 ;CM String - DB esc,'[K',0 ;CE String - DB esc,'[7m',0 ;SO String - DB esc,'[m',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Dialogue 80 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 75 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'*',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'t',0 ;CE String - DB esc,'j',0 ;SO String - DB esc,'k',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Direct 800/A ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'[1;1H',esc,'[2J',0 ;CL String - DB esc,'[%i%d;%dH',0 ;CM String - DB esc,'[K',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Epson GENEVA ' ;Name of Terminal - DB 00 ;Cursor UP - DB 00 ;Cursor DOWN - DB 00 ;Cursor RIGHT - DB 00 ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'*',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'T',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Epson QX-10 ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'Z'-'@',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'T',0 ;CE String - DB esc,')',0 ;SO String - DB esc,'(',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'General Trm 100A' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'L'-'@',0 ;CL String - DB esc,'f%r%+ %+ ',0 ;CM String - DB esc,'K',0 ;CE String - DB esc,'b',0 ;SO String - DB esc,'a',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Hazeltine 1420 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,1ch,0 ;CL String - DB esc,'Q'-'@','%r%.%+ ',0 ;CM String - DB esc,'O'-'@',0 ;CE String - DB esc,1fh,0 ;SO String - DB esc,'Y'-'@',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Hazeltine 1500 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB '~',1ch,0 ;CL String - DB '~','Q'-'@','%r%.%+ ',0 ;CM String (correct - not same - DB '~','O'-'@',0 ;CE String as UNIX TERMCAP entry) - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Hazeltine 1510 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,1ch,0 ;CL String - DB esc,'Q'-'@','%r%.%+ ',0 ;CM String (correct?) - DB esc,'O'-'@',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Hazeltine 1520 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB '~',1ch,0 ;CL String - DB '~','Q'-'@','%r%.%+ ',80h,0 ;CM String (correct?) - DB '~','O'-'@',0 ;CE String - DB '~',1fh,0 ;SO String - DB '~','Y'-'@',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'H19 (ANSI Mode) ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'[2J',0 ;CL String - DB esc,'[%d;%dH',0 ;CM String - DB esc,'[K',0 ;CE String - DB esc,'[7m',0 ;SO String - DB esc,'[m',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'H19 (Heath Mode)' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'E',0 ;CL String - DB esc,'Y%+ %+ ',0 ;CM String - DB esc,'K',0 ;CE String - DB esc,'p',0 ;SO String - DB esc,'q',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'HP 2621 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'H',esc,'J',0 ;CL String - DB esc,'&a%r%dc%dY',0 ;CM String - DB 0 ;CE String - DB esc,'&dD',0 ;SO String - DB esc,'&d@',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'IBM 3101 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'K',0 ;CL String - DB esc,'Y%+ %+ ',0 ;CM String - DB esc,'I',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Kaypro II ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'Z'-'@',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB 0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Kaypro 10 ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'Z'-'@',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB 'X'-'@',0 ;CE String - DB esc,'B1',0 ;SO String - DB esc,'C1',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Micro Bee ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'E',0 ;CL String - DB esc,'F%+ %+ ',0 ;CM String - DB esc,'K',0 ;CE String - DB esc,'dP',0 ;SO String - DB esc,'d@',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Microterm ACT IV' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'L'-'@',0 ;CL String - DB 'T'-'@','%.%.',0 ;CM String - DB 1eh,0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Microterm ACT V ' ;Name of Terminal - DB 'Z'-'@' ;Cursor UP - DB 'K'-'@' ;Cursor DOWN - DB 'X'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'L'-'@',0 ;CL String - DB 'T'-'@','%.%.',0 ;CM String - DB 1eh,0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'NorthStar Advant' ;Name of Terminal - DB 'B'-'@'+80h ;Cursor UP - DB 'J'-'@'+80h ;Cursor DOWN - DB 'F'-'@'+80h ;Cursor RIGHT - DB 'H'-'@'+80h ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 1EH,0FH,0 ;CL String - DB ESC,'=%+ %+ ',0 ;CM String - DB 0EH,0 ;CE String - DB 1,0 ;SO String - DB 2,0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Osborne I ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'Z'-'@',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'T',0 ;CE String - DB esc,')',0 ;SO String - DB esc,'(',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'P Elmer 1100 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 132 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'H',esc,'J',0 ;CL String - DB esc,'X%+ ',esc,'Y%+ ',0 ;CM String - DB esc,'I',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'P Elmer 1200 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 132 ;CL Delay - DB 00 ;CM Delay - DB 06 ;CE Delay - DB esc,'H',esc,'J',0 ;CL String - DB esc,'X%+ ',esc,'Y%+ ',0 ;CM String - DB esc,'I',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Qume QVT 102 ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'Z'-'@',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'T',0 ;CE String - DB esc,'(',0 ;SO String - DB esc,')',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'SOROC 120 ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 02 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'*',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'T',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Super Bee ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 03 ;CL Delay - DB 00 ;CM Delay - DB 03 ;CE Delay - DB esc,'H',esc,'J',0 ;CL String - DB esc,'F%r%3%3',0 ;CM String - DB esc,'K',0 ;CE String - DB esc,'_1',0 ;SO String - DB esc,'_0',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'TAB 132 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 50 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'[;H',esc,'[2J',0 ;CL String - DB esc,'[%i%d;%dH',0 ;CM String - DB 0 ;CE String - DB esc,'[7m',0 ;SO String - DB esc,'[m',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Teleray 1061 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 01 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'L'-'@',0 ;CL String - DB esc,'Y%+ %+ ',0 ;CM String - DB esc,'K',0 ;CE String - DB esc,'RD',0 ;SO String - DB esc,'R@',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Teleray 3800 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'L'-'@',0 ;CL String - DB esc,'Y%+ %+ ',0 ;CM String - DB esc,'K',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'TTY 4424 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'[2;H',esc,'[J',0 ;CL String - DB esc,'[%i%2;%2H',esc,'[B',0 ;CM String - DB esc,'[K',0 ;CE String - DB esc,'[7m',0 ;SO String - DB esc,'[m',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'TVI 912 ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'Z'-'@',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'T',0 ;CE String - DB esc,')',0 ;SO String - DB esc,'(',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'TVI 920 ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'Z'-'@',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'T',0 ;CE String - DB esc,')',0 ;SO String - DB esc,'(',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'TVI 950 ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'V'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'*',0 ;CL String - DB esc,'=%+ %+ ',0 ;CM String - DB esc,'t',0 ;CE String - DB esc,')',0 ;SO String - DB esc,'(',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'TVI 970 ' ;Name of Terminal - DB 0 ;Cursor UP - DB 0 ;Cursor DOWN - DB 0 ;Cursor RIGHT - DB 0 ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'[2J',0 ;CL String - DB esc,'[%2;%2H',0 ;CM String - DB esc,'[0K',0 ;CE String - DB esc,'[2;7m',0 ;SO String - DB esc,'[7;0m',0 ;SE String - DB esc,'[0;0z',0 ;TI String - DB esc,'[0;1z',0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'VC 404 ' ;Name of Terminal - DB 'Z'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'U'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 40 ;CL Delay - DB 00 ;CM Delay - DB 20 ;CE Delay - DB 'X'-'@',0 ;CL String - DB 'P'-'@','%+ %+ ',0 ;CM String - DB 'V'-'@',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'VC 415 ' ;Name of Terminal - DB 'Z'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'U'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 'L'-'@',0 ;CL String - DB 'P'-'@','%.%.',0 ;CM String - DB 'V'-'@',0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'Visual 200 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'v',0 ;CL String - DB esc,'Y%+ %+ ',0 ;CM String - DB esc,'x' ;CE String (4 times) - DB esc,'x' - DB esc,'x' - DB esc,'x' - DB 0 ;End of CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB 'WYSE 50 ' ;Name of Terminal - DB 'K'-'@' ;Cursor UP - DB 'J'-'@' ;Cursor DOWN - DB 'L'-'@' ;Cursor RIGHT - DB 'H'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB esc,'+',0 ;CL String - DB esc,'%ia%dR%dC',0 ;CM String - DB esc,'T',0 ;CE String - DB esc,')',0 ;SO String - DB esc,'(',0 ;SE String - DB 0 ;TI String - DB 0 ;TE String - -; Terminal xxxx - ORG $/80H*80H+80H ;Next Record - DB ' 1.3 ' ;Name of Terminal - DB 'E'-'@' ;Cursor UP (Wordstar Defaults) - DB 'X'-'@' ;Cursor DOWN - DB 'D'-'@' ;Cursor RIGHT - DB 'S'-'@' ;Cursor LEFT - DB 00 ;CL Delay - DB 00 ;CM Delay - DB 00 ;CE Delay - DB 0 ;CL String - DB 0 ;CM String - DB 0 ;CE String - DB 0 ;SO String - DB 0 ;SE String - DB 0 ;TI String - DB 0 ;TE String - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3TCAP.HLP b/Source/Images/d_bp/u15/Z3TCAP.HLP deleted file mode 100644 index d9424054..00000000 --- a/Source/Images/d_bp/u15/Z3TCAP.HLP +++ /dev/null @@ -1,1106 +0,0 @@ -; - - - ZCPR3 Terminal Capabilities (TCAP) - - -- Utilities -- -- Documentation -- - 1 - TCCHECK I - Introduction - 2 - TCMAKE S - Z3T Structure - 3 - TCSELECT G - General Control Seqs - C - Cursor Control Seqs - 4 - Z3TCAP V - VLIB Overview - - -:I - ZCPR3 Terminal Capabilities (TCAP) - Introduction - Thå  ZCPR³ Terminaì Capabilitieó (TCAP© Facilitù ió  aî -integraì  parô oæ thå ZCPR³ System®  Bù meanó oæ  thå  TCAÐ -Facility¬  thå user'ó terminaì ió defineä tï ZCPR³ iî sucè á -waù  thaô programó iî thå ZCPR³ Systeí caî perforí á varietù -oæ screen-orienteä functionó witè thå user'ó terminal®  Thå -TCAÐ Facilitù ió fundamentaì tï ZCPR3¬  anä iô ió á parô  oæ -thå ZCPR³ Environmenô Descriptor. - - Thå  TCAÐ entrieó contaiî thå followinç informatioî  oî -their respective terminals: - - o initialization/deinitialization sequences - o characters generated by the arrow keys - o sequence for clearing the screen - o sequence for positioning the cursor - o sequence for erasing to end of line - o highlight/non-highlight sequences - - Introduction - Witè thió information¬  programó sucè aó VFILER¬ VMENU¬ -anä  HELР caî  perforí theiò functionó witè á  mucè  higheò -degreå  oæ  "flash¢ anä user-friendlinesó  thaî  theù  woulä -otherwise®  Bù  simplù  loadinç thå TCAÐ entrù foò  anotheò -terminaì intï thå environmenô descriptor¬ alì ZCPR³ programó -arå automaticallù reconfigureä foò thå ne÷ terminaì anä  caî -continue to function without modification. - - Twï  utilitieó  arå provideä tï assisô thå useò iî  thå -creatioî  oæ Z3T fileó foò hió terminals®  TCSELECÔ  allowó -thå  useò  tï selecô á predefineä terminaì froí  thå  Z3TCAÐ -file¬  anä TCMAKÅ allowó thå useò tï definå á terminaì whicè -is not covered by the Z3TCAP file. - - Mosô  oæ  thå  informatioî iî thió  HLР filå  provideó -detailó  oî  thå structurå oæ thå Z3T fileó  anä  giveó  thå -TCMAKÅ useò enougè detaiì tï definå hió terminal® Providinç -this information is the main purpose of this HLP file. - - Introduction - Thå   filå  Z3TCAР containó  informatioî  oî  oveò  4° -terminals®  Thå  TCSELECÔ prograí printó á numbeò oæ  menuó -containinç  thå  nameó  oæ thå terminaló iî  thió  filå  anä -allowó  thå  useò tï selecô  one¬  storinç  itó  informatioî -eitheò   directlù   intï  thå  memory-residenô   Environmenô -Descriptoò  oò  intï á filå oæ typå Z3T whicè maù  lateò  bå -loadeä bù thå LDÒ utility. - - Iæ  thå user'ó terminaì ió noô alreadù defineä  iî  thå -Z3TCAР file¬  thå  TCMAKÅ  prograí ió useä  tï  definå  hió -terminal®  TCMAKÅ  allowó thå useò tï interactivelù  definå -eacè oæ thå keù attributeó oæ hió terminaì anä creatå á filå -oæ typå Z3T wheî done® Thió filå maù lateò bå loadeä bù thå -LDÒ utility. - - -:S - Internal Structure of a Z3T File - Structure - Á  Z3T Filå defineó thå characteristicó oæ á particulaò Introduction -terminal® Eacè Z3T filå containó thå followinç information: - - o the name of the terminal - o the codes generated by the arrow keys - o the byte sequences required: - to clear the screen - to position the cursor - to clear to end of line - to highlight chars - to initialize and deinitialize the terminal - - Iî  detail¬  thå followinç ió thå exacô structurå oæ  á -Z3T file: - - Structure - Z3T File Structure, Overview Introduction - -Z3T_FILE: -name: - DS 16 ; Name of Terminal -arrows: - DS 4 ; Bytes generated by arrow keys -delays: - DS 3 ; Delays for Screen Clear, Cursor Motion, and - ; Clear to End-of-Line - -cl: DS N1+1 ; Sequence used for Screen Clear -cm: DS N2+1 ; Sequence used for Cursor Motion (gotoxy) -ce: DS N3+1 ; Sequence used for Clear to End-of-Line -so: DS N4+1 ; Sequence used to begin highlighting -se: DS N5+1 ; Sequence used to end highlighting -ti: DS N6+1 ; Sequence used to initialize terminal -to: DS N7+1 ; Sequence used to deinitialize terminal - - Structure - Thå  followinç frameó definå thå TCAР records®  Theså Introduction -records are: - - 1. the name of the terminal - 2. the definition of the arrow keys - 3. the delay constants for screen clear, cursor - motion, and clear to end-of-line - 4. the definition of the screen clear char sequence - 5. the defn of the cursor motion char seq - 6. the defn of the clear to EOL char seq - 7. the defn of the highlight/end-highlight char seq - 8. the defn of the init/deinit terminal char seq - - Eacè  oæ  theså recorä  definitionó  ió  similarº  thå -structurå  oæ thå recorä (iî assemblù languagå terminology)¬ -commentó  oî ho÷ thå recorä ió defineä anä whaô  valueó  arå -valiä  foò it¬  anä exampleó oæ valiä recorä structureó  arå -provideä foò eacè recorä definition. - - Structure -1. Terminal Name 1 Term Name - -Structure: - DS 16 ; Name of Terminal (Space Fill on Right) - -Comment: - Thå  namå oæ thå terminaì ió alwayó 1¶ byteó long®  Iæ -thå namå takeó lesó thaî 1¶ bytes¬  spacå filì occuró  righô -of the last character. - -Examples: - DB 'ADDS Consul 980 ' - DB 'ADM 2 ' - - - Structure -2. Arrow Keys 2 Arrow Keys - -Structure: - DS 1 ; Byte Generated by Cursor UP - DS 1 ; Byte Generated by Cursor DOWN - DS 1 ; Byte Generated by Cursor RIGHT - DS 1 ; Byte Generated by Cursor LEFT - -Comment: - Iæ  youò  terminaì haó arro÷ keyó oî iô WHICÈ  GENERATÅ -ONLÙ ONÅ BYTÅ WHEÎ DEPRESSED¬ theî theså keyó maù bå defineä -iî thå Z3T file®  Wheî á prograí calló foò thå uså oæ arro÷ -keys, it will use the values stored here. - - Structure - Iæ youò terminaì doeó noô havå arro÷ keyó oò haó  arro÷ 2 Arrow Keys -keyó whicè generatå morå thaî onå bytå wheî depressed¬ theså -keyó maù noô bå defineä iî thå Z3T file® Zerï (0© ió storeä -iî alì fouò byteó oæ thå "arro÷ key¢ record®  Iî thió case¬ -thå  prograí  wilì  responä  tï thå  Worä  Staò  (trademark¬ -Micropro© arro÷ keù conventioî (^Å ió UP¬  ^Ø ió DOWN¬ ^Ä ió -RIGHT, and ^S is LEFT): - - ^E - ^ - | - ^S <--+--> ^D - | - v - ^X - - Structure -Examples: 2 Arrow Keys - DB 'K'-'@' ; ADM 31 ^K for Cursor UP - DB 'J'-'@' ; ^J for Cursor DOWN - DB 'L'-'@' ; ^L for Cursor RIGHT - DB 'H'-'@' ; ^H for Cursor LEFT - - DB 0,0,0,0 ; None for H19 because of 2-char seqs - ; Word Star Convention will be used - - - Structure -3. Function Delays 3 Delays - -Structure: - DS 1 ; Delay (in mS) after sending clear screen - DS 1 ; Delay (in mS) after sending gotoxy - DS 1 ; Delay (in mS) after sending clear to EOL - -Comment: - Eacè oæ theså byteó defineó thå numbeò oæ  millisecondó -á  prograí wilì delaù afteò sendinç á particulaò sequencå tï -thå  user'ó terminal®  Somå terminaló requirå thió typå  oæ -delay®  Iæ á sequencå requireó nï delay¬  thå valuå oæ zerï -(0) should be placed in the corresponding byte. - -Examples: - DB 20,0,0 ; BANTAM 550 - 20mS for Clear Screen, 0 - ; for Cursor Motion and Clear to EOL - - DB 0,0,0 ; TVI 950 - No Delays - Structure -4. Clear Screen Sequence 4 Clear Screen - -Structure: - DS N1 ; Bytes in clear screen sequence - DB 0 - -Comment: - Thió  sequencå oæ bytes¬  uð tï buô noô  includinç  thå -terminatinç  0¬  ió senô tï thå user'ó terminaì iî ordeò  tï -cleaò  hió screen®  Iæ iô ió necessarù tï includå á  binarù -zero in this sequence, the two bytes - - DB '\',0 - -wilì  transmiô aô onå binarù 0 and - - DB '\\' - -wilì transmiô aó onå backslash® - Structure - Iî general¬ á backslasè (\© ió thå quotå character¬ anä 4 Clear Screen -anù  bytå  whicè followó iô ió transmitteä literallù tï  thå -user'ó terminal. - - Iæ  á terminaì requireó thaô trailinç nulló follo÷  thå -lasô  characteò  oæ thå sequencå foò thå purposå  oæ  screeî -settlinç  (ratheò thaî usinç thå delaù byte)¬  nulló caî  bå -appended into the sequence by using the quote character. - - -Examples: - DB 1BH,';',0 ; Clear Screen for ADM2 - DB 'L'-'@',0 ; Clear Screen for ADDS Viewpoint - DB 1BH,'?',1BH,'E'-'@',0 - ; Clear Screen for Concept 108 - - Structure -5. Cursor Motion (GOTOXY) Sequence 5 Cursor Motion - -Structure: - DS N2 ; Bytes in gotoxy sequence - DB 0 - -Comments: - Thió  sequencå oæ byteó ió senô tï thå user'ó  terminaì -iî  ordeò tï positioî thå cursoò oî hió screen®  Thå  quotå -characteò  (\©  caî  bå used¬  likå  iî  thå  Cursoò  Motioî -sequence¬ tï allo÷ quotå characteró anä nulló tï bå sent. - - Unlikå  thå  otheò sequenceó iî thå TCAР records¬  thå -Cursoò Motioî sequenceó varù dependinç upoî thå positioî  oî -thå  screen® - - Structure - Foò  instance¬  tï placå thå cursoò aô ro÷ 4¬  columî ´ 5 Cursor Motion -(homå ió ro÷ 0¬ coì 0© oî á TVÉ 950¬ thå sequence - - DB 1BH,'=$$',0 - -is used, but to position at row 6, column 6, the sequence - - DB 1BH,'=&&',0 - -is used. - Iî ordeò tï expresó sucè variable-valuå sequences¬  thå -ZCPR³  TCAР provideó  foò  equationó whicè  definå  ho÷  tï -compute the byte to be output. The TCAP sequence: - - DB 1BH,'=%+ %+ ',0 - -defineó  ho÷ tï computå thå valueó tï bå outpuô iî ordeò  tï -move the cursor for the TVI 950. - Structure - The TCAP Cursor Motion sequence 5 Cursor Motion - - DB 1BH,'=%+ %+ ',0 - -is broken down as follows: - - Element Meaning - ------- ------- - 1BH Output 1B hex (the ESCAPE char) - '=' Output the character '=' - '%« ' Adä § § (20H© tï thå ro÷ valuå anä output - '%+ ' Add ' ' (20H) to the column value and output - - Thå  percenô characteò (%© instructó thå cursoò  motioî -sequencå interpreteò tï looë foò á command¬ anä iô processeó -thå  followinç  characteró aó such®  Iæ iô  ió  desireä  tï -outpuô '%§ itself¬ thå sequencå '\%§ ió used. - - Structure - Thå  commandó recognizeä bù thå cursoò  motioî  commanä 5 Cursor Motion -interpreteò wilì no÷ bå discusseä iî detail® Theså commandó -are the following (case is not significant): - - %R - Reverse order from row/col to col/row - %I - Home position is (1,1) rather than (0,0) - %. - Print current value (row or col) in binary - %2 - Print current value as 2 ASCII decimal digits - %3 - Print current value as 3 ASCII decimal digits - %d - Print current value as N ASCII decimal digits - (no leading zeroes) - %+n - Add n to current value and output in binary - %>xù - Adä ù tï currenô valuå iæ iô ió greater - than x - - Structure - Thå cursoò motioî sequencå interpreteò assumeó thaô thå 5 Cursor Motion -valuå  oæ  thå  ro÷ wilì bå outpuô beforå thå valuå  oæ  thå -column. If the column is to be first, the command - - '%r' or '%R' - -instructó  thå cursoò motioî sequencå interpreteò tï  outpuô -thå  columî  anä theî thå row®  Thå '%R§  commanä  musô  bå -presenô  iî  thå sequencå beforå thå firsô valuå ió  output¬ -anä  '%R§ actó solelù tï commanä thå interpreteò  (nï  byteó -are output by '%R'). - - Structure - Thå  cursoò  motioî sequencå interpreteò  alsï  assumeó 5 Cursor Motion -thaô thå valuå oæ thå homå positioî ió ro÷ 0¬  columî 0® Iæ -iô  ió convenienô tï seô thió positioî tï ro÷ 1¬  columî  1¬ -the command - - '%i' or '%I' - -ió  used®  Likå '%R'¬  '%I§ musô bå useä beforå  thå  firsô -valuå ió output. - - The TVI 950 can be defined in two ways: - - DB 1BH,'=%+ %+ ',0 -or - DB 1BH,'%i=%+',1FH,'%+',1FH,0 - - Structure - Thå  resô  oæ thå cursoò  motioî  sequencå  interpreteò 5 Cursor Motion -commandó deaì witè thå formaô oæ thå output® Theù allo÷ thå -following types of outputs: - -%. binary value (^A is output as 1) -%2 2 ASCII Decimal Digits (^A is output as '01') -%3 3 ASCII Decimal Digits (^A is output as '001') -%d As many ASCII Decimal Digits as needed (^A as '1') -%+n Add offset ('%+ ' outputs ^A as 1+' ' or '!') -%>xy Add offset if limit reached ('%> '1 outputs ^A as 1 - and '!' as '"') - - Tï summarize: - - Structure - Cursor Motion Interpreter Commands 5 Cursor Motion - - Command Output Format - ------- ------------- - %. Binary Value - %2 2 ASCII Decimal Digit Chars ('23') - %3 3 ASCII Decimal Digit Chars ('123') - %ä Aó manù ASCIÉ Decimaì Digiô Charó aó needed - %+n Add the value of the byte following the '+' - and output in binary - %>xy If value > x, output value+y in binary; else - output value in binary - - Command Cursor Motion Interpreter Action - ------- -------------------------------- - %i Set Home to 1,1 (default is 0,0) - %r Output Col, then Row (default is Row, then Col) - - Structure -Examples: 5 Cursor Motion - DB 1BH,'Y%+ %+ ',0 ; ADDS Viewpoint - - 1BH = output 1BH (ESCAPE char) - 'Y' = output char 'Y' - '%+ ' = output row + ' ' (20H) in binary - '%+ ' = output col + ' ' (20H) in binary - - DB 1BH,'[%d;%dH',0 ; H19 (ANSI Mode) - - 1BH = output 1BH (ESCAPE char) - '[' = output char '[' - '%d' = output row as ASCII decimal digits - ';' = output char ';' - '%d' = output col as ASCII decimal digits - 'H' = output char 'H' - - Structure -6. Clear to End of Line 6 Clear to EOL - -Structure: - DS N3 ; Bytes in clear to end of line sequence - DB 0 - -Comments: - Thå  Cleaò tï Enä oæ Linå sequencå ió useä tï cleaò thå -linå  startinç  aô  thå cursoò positioî tï thå  enä  oæ  thå -screen. Only this part of the current line is cleared. - - Thå ruleó foò specifyinç thió sequencå arå thå samå  aó -those for Screen Clear. - -Example: - DB 1BH,'T',0 ; ADM 2 - - - Structure -7. Begin Highlighting (Standout Mode) and End Highlighting 7 Highlighting - -Sequences: - DS N4 ; Bytes in sequence to begin highlighting - DB 0 - - DS N5 ; Bytes in sequence to end highlighting - DB 0 - -Comments: - Thå  "begiî  highlighting¢  sequencå ió useä  tï  begiî -highlighô modå oî thå user'ó terminal®  Thió maù bå reverså -video¬ dim¬ oò somå otheò non-standarä methoä foò displayinç -characteró  oî  thå  screen®  Iî ordeò foò  á  terminaì  tï -supporô thió feature¬ thå followinç musô bå true: - - Structure - 1® Issuinç thió sequencå musô NOÔ changå thå positioî 7 Highlighting -oæ thå cursoò oî thå screen. - - 2®  Characteró highlighteä musô bå outpuô iî exactlù -thå samå waù non-highlighteä characteró arå (eg¬ settinç thå -MSB of the highlighted chars is not allowed). - - These sequences are always used as follows: - - 1. the BEGIN HIGHLIGHT sequence is output - 2. a set of characters to highlight is output - 3. the END HIGHLIGHT sequence is output - - Thå  ruleó foò specifyinç theså sequenceó arå thå  samå -aó thoså foò Screeî Clear. - - Structure -Example: 7 Highlighting - DB 'N'-'@',0 ;ADDS Viewpoint - - Structure -8. Terminal Initialization and Deinitialization 8 Term Init - -Sequences: - DS N6 ; Bytes in sequence to init terminal - DB 0 - - DS N7 ; Bytes in sequence to deinit terminal - DB 0 - -Comments: - Beforå  anù videï routineó arå executed¬  thå  terminaì -initializatioî sequencå ió senô tï thå terminal®  Afteò thå -uså  oæ  thå  terminaì  ió  completeä  bù  á  program¬   thå -deinitialization sequence is sent. - - Thå ruleó foò specifyinç thió sequencå arå thå samå  aó -those for Screen Clear. - - -:G - General Terminal Control Sequences - Control 1 - The structure of most TCAP control sequences is: - - DS N ; Bytes in sequence - DB 0 - - Thió  sequencå  oæ bytes¬  uð tï buô noô includinç  thå -terminatinç  0¬  ió senô tï thå user'ó terminaì iî ordeò  tï -perforí  somå  function®  Iæ iô ió necessarù tï  includå  á -binarù zerï iî thió sequence¬ thå twï bytes - - DB '\',0 - -wilì transmiô as onå binarù ° and - - DB '\\' - -wilì transmiô aó onå backslash® - - Control 1 - Á  backslasè (\© ió thå quotå character¬  anä anù  bytå -whicè  followó  iô ió transmitteä literallù  tï  thå  user'ó -terminal. - - Iæ  á terminaì requireó thaô trailinç nulló follo÷  thå -lasô  characteò  oæ thå sequencå foò thå purposå  oæ  screeî -settlinç  (ratheò thaî usinç thå delaù byte)¬  nulló caî  bå -appended into the sequence by using the quote character. - - Cursoò  Motioî  sequenceó follo÷ theså ruleó  witè  thå -additioî  thaô  thå characteò "%¢ prefixeó á  cursoò  motioî -interpreteò command® Iæ iô ió desireä tï simplù outpuô thió -characteò iî á cursoò motioî sequence¬  thå quotå  characteò -can be used: - - DB '\%' - -:C - Cursor Motion Control Sequences - Control 2 - Cursoò  Motioî  sequenceó arå differenô froí thå  otheò -sequenceó  defineä  iî  thå  TCAР iî  thaô  cursoò   motioî -sequenceó  contaiî  embeddeä commandó foò thå cursoò  motioî -interpreter®   Alì  Cursoò  Motioî  sequenceó  arå  oæ  thå -following general format: - - - - Foò example¬  thå DEà VT10° terminaì useó thå followinç -sequence for cursor motion: - - DB 1BH,'[%i%d;%dH',0 -where: - 1BH,'[' = prefix chars 1BH (ESCAPE) and '[' - %i = command: home is 1,1 - %d = command: output row as ASCII dec chars - ';' = infix char ';' - %d = command: output col as ASCII dec chars - 'H' = suffix char 'H' - Control 2 - Thå prefix¬  infix¬ anä postfiø sequenceó arå optional¬ -anä onlù thå commandó tï outpuô thå ro÷ anä coì arå requireä -in any cursor motion sequence definition. - - Cursoò Motioî ió thå onlù requireä entrù iî á TCAР foò -á  terminal®  Alì otheò sequenceó maù bå emptù (null)¬  anä -thå  lacë oæ theså otheò sequenceó wilì bå compensateä  for® -Cursoò motion¬  however¬  cannoô bå simulateä easilù anä  ió -required. - - Thå followinç tablå summarizeó alì oæ thå Cursoò Motioî -interpreter commands. - - Control 2 - Cursor Motion Interpreter Commands - - Command Output Format - ------- ------------- - %. Binary Value - %2 2 ASCII Decimal Digit Chars ('23') - %3 3 ASCII Decimal Digit Chars ('123') - %ä Aó manù ASCIÉ Decimaì Digiô Charó aó needed - %+n Add the value of the byte following the '+' - and output in binary - %>xy If value > x, output value+y in binary; else - output value in binary - - Command Cursor Motion Interpreter Action - ------- -------------------------------- - %i Set Home to 1,1 (default is 0,0) - %r Output Col, then Row (default is Row, then Col) - - Control 2 -Examples: - DB 1BH,'Y%+ %+ ',0 ; ADDS Viewpoint - - 1BH = output 1BH (ESCAPE char) - 'Y' = output char 'Y' - '%+ ' = output row + ' ' (20H) in binary - '%+ ' = output col + ' ' (20H) in binary - - DB 1BH,'[%d;%dH',0 ; H19 (ANSI Mode) - - 1BH = output 1BH (ESCAPE char) - '[' = output char '[' - '%d' = output row as ASCII decimal digits - ';' = output char ';' - '%d' = output col as ASCII decimal digits - 'H' = output char 'H' - -:V - Overview of VLIB - VLIB - VLI (Videï LIBrary© ió thå ZCPR³ librarù whicè ió useä -tï  providå á serieó oæ low-leveì routineó foò Z3TCAÐ accesó -tï thå ZCPR³ systeí programmer®  VLI ió describeä iî  mucè -morå  detaiì  iî thå VLIB.HLÐ file¬  anä thió overvie÷  onlù -serves to summarize its capabilities. - - Thå VLI routinå Z3VINIÔ ió useä tï initializå VLI foò -uså  witè  á  ZCPR³  system®   Thå  addresó  oæ  thå  ZCPR³ -environmenô  descriptoò ió passeä tï thå Z3VINIÔ routinå  iî -HL¬  anä  alì VLI routineó kno÷ thå addresó oæ  thå  Z3TCAÐ -entry from that point forward. - - The low-level functions provided by VLIB are: - - VLIB - Routine Function - ------- -------- - TINIT Initialize terminal - DINIT Deinitialize terminal - - CLS Clear screen - - EREOL Erase to End of Line - - GOTOXY Position Cursor - - STNDOUT Begin highlighting - STNDEND End highlighting - - AT Position Cursor - - GXYMSG Print message, with highlighting, at XY - VPRINT Print message with highlighting - -:4 - Standard ZCPR3 TCAP File - Z3TCAP - Thå  filå  Z3TCAР containó  informatioî  oî  oveò   4° -terminals®  Iô  ió provideä aó á parô oæ thå ZCPR³  System¬ -anä iô ió useä bù TCSELECT®  TCSELECÔ caî displaù thå nameó -oæ  thå terminaló containeä iî Z3TCAÐ anä allo÷ thå useò  tï -selecô one¬ generatinç á *.Z3T filå oò storinç thå selectioî -directlù  intï memorù foò immediatå uså bù thå ZCPR³  Systeí -utilities. - -:1 - -Command: TCCHECK 1.0 - -Syntax: - TCCHECK ufn <-- default file type is TCP -or - TCCHECK <-- check Z3TCAP.TCP - -Function: - TCCHECË  checkó á Z3TCAP.TCÐ filå foò valiä formaô  anä -reports any errors and statistical information on it. - -Options: - None - - -Comments: - TCCHECË   ió   intendeä  tï  ruî  iî  á   non-installeä -environmenô (sucè aó wheî thå useò firsô receiveó ZCPR3)¬ sï -thå  Z3TCAP.TCР filå beinç checkeä musô bå iî  thå  currenô -directory. - -Selected Error Messages: - Self-Explanatory - -Examples of Use: - - TCCHECK - -- check Z3TCAP.TCP - - TCCHECK - TCAP Check Program - TCCHECK - TCCHECË   ió   useä  tï  checë  thå  Z3TCAР filå   foò -consistency® Itó solå functioî ió tï ensurå thå validitù oæ -the Z3TCAP file and provide some statistics on it. - - Sample run of TCCHECK: - -B4:SCR2>tccheck -TCCHECK, Version 1.0 File Z3TCAP .TCP Not Found - Aborting - -- Note: Z3TCAP.TCP MUST be in the same directory - -B4:SCR2>root: -A15:ROOT>tccheck -TCCHECK, Version 1.0 -Z3TCAP File Check of Z3TCAP .TCP Version 1.1 - File Checks with 44 Terminals Defined - - - -:2 - -Command: TCMAKE 1.0 - -Syntax: - TCMAKE ufn <-- default file type is Z3T - -Function: - TCMAKÅ  allowó  thå useò tï  interactivelù  definå  thå -characteristicó  oæ hió terminaì anä storå thió  informatioî -iî thå filå referenced® Thió filå maù theî bå loadeä bù thå -LDR utility. - -Options: - None - - -Comments: - A sample TCMAKE session is located in this HELP file. - -Selected Error Messages: - Self-Explanatory - -Examples of Use: - See following frames - - - - TCMAKE - TCAP Entry Definition Program - TCMAKE - TCMAKÅ ió useä tï creatå á *.Z3T file®  Oncå  created¬ -thå  ZCPR³ utilitù LDÒ caî loaä iô intï memorù aô thå propeò -location (command is "LDR filename.Z3T"). - - Sample run of TCMAKE: - -B4:SCR2>tcmake // -TCMAKE, Version 1.0 -TCMAKE - Create a Z3T File -Syntax: - TCMAKE outfile -or- TCMAKE outfile.typ - -where "outfile" is the file to be generated by -the execution of TCMAKE. If no file type is -given, a file type of Z3T is the default. - - TCMAKE -B4:SCR2>tcmake myterm2 -TCMAKE, Version 1.0 - - ** Z3TCAP Main Menu for File MYTERM2 .Z3T ** - -Define: 1. Clear Screen Sequence - 2. Cursor Motion Sequence - 3. Clear to End of Line Sequence - 4. Standout Mode Sequences - 5. Terminal Init/Deinit Sequences - 6. Arrow Keys - 7. Terminal Name - -Status: S. Print Status (Definitions so far) - -Exit: X. Exit and Write File - Q. Quit and Abort Program without Writing File - -Command? 2 - TCMAKE -Cursor Motion Definition - 1. Timing Delay - Enter Delay Time in Milliseconds: 5 - 2. Enter R if Row/Column or C for Column/Row: R - 3. Enter Equation for Row: %+ - 4. Enter Equation for Column: %+ - 5. Enter Prefix Byte Sequence - Char #1 - Type Char, .=Number, or =Done: Enter Number: 1bh - Char #2 - Type Char, .=Number, or =Done: Char = - Char #3 - Type Char, .=Number, or =Done: - 6. Enter Middle Byte Sequence - Char #1 - Type Char, .=Number, or =Done: - 7. Enter Suffix Byte Sequence - Char #1 - Type Char, .=Number, or =Done: - - TCMAKE - ** Z3TCAP Main Menu for File MYTERM2 .Z3T ** - -Define: 1. Clear Screen Sequence - 2. Cursor Motion Sequence - 3. Clear to End of Line Sequence - 4. Standout Mode Sequences - 5. Terminal Init/Deinit Sequences - 6. Arrow Keys - 7. Terminal Name - -Status: S. Print Status (Definitions so far) - -Exit: X. Exit and Write File - Q. Quit and Abort Program without Writing File - -Command? 6 - - TCMAKE -Arrow Key Definition - Your Terminal's Arrow Keys may be defined ONLY - if they generate only one character each. If they - do, type Y to continue. If not, type anything else. - Define Arrow Keys (Y/N)? Y - Strike the Appropriate Arrow Key - 1. Arrow UP? ^K - 2. Arrow DOWN? ^V - 3. Arrow RIGHT? ^L - 4. Arrow LEFT? ^H - - TCMAKE - ** Z3TCAP Main Menu for File MYTERM2 .Z3T ** - -Define: 1. Clear Screen Sequence - 2. Cursor Motion Sequence - 3. Clear to End of Line Sequence - 4. Standout Mode Sequences - 5. Terminal Init/Deinit Sequences - 6. Arrow Keys - 7. Terminal Name - -Status: S. Print Status (Definitions so far) - -Exit: X. Exit and Write File - Q. Quit and Abort Program without Writing File - -Command? S - - TCMAKE - ** Z3TCAP Status for File MYTERM2 .Z3T ** - -Review: 1. Clear Screen Definition - 2. Cursor Motion Definition - 3. Clear to End of Line Definition - 4. Standout Mode Definition - 5. Terminal Init/Deinit Definition - 6. Arrow Key Definition - 7. Terminal Name Definition - -Exit: X. Exit to Main Menu - -Command? 1 -Review of Clear Screen Definition - 1. Timing Delay = 0 Milliseconds - 2. Clear Screen Sequence: - (1) ^[ 1BH (2) * 2AH - Strike Any Key to Continue - - - TCMAKE - ** Z3TCAP Status for File MYTERM2 .Z3T ** - -Review: 1. Clear Screen Definition - 2. Cursor Motion Definition - 3. Clear to End of Line Definition - 4. Standout Mode Definition - 5. Terminal Init/Deinit Definition - 6. Arrow Key Definition - 7. Terminal Name Definition - -Exit: X. Exit to Main Menu - -Command? 2 - - TCMAKE -Review of Cursor Motion Data - 1. Timing Delay = 5 Milliseconds - 2. Row or Column First: R - 3. Row Equation: -->%+ <-- - 4. Column Equation: -->%+ <-- - 5. Prefix Byte Sequence: - (1) ^[ 1BH (2) = 3DH - 6. Middle Byte Sequence: - -- Empty -- - 7. Suffix Byte Sequence: - -- Empty -- - Strike Any Key to Continue - - - TCMAKE - ** Z3TCAP Status for File MYTERM2 .Z3T ** - -Review: 1. Clear Screen Definition - 2. Cursor Motion Definition - 3. Clear to End of Line Definition - 4. Standout Mode Definition - 5. Terminal Init/Deinit Definition - 6. Arrow Key Definition - 7. Terminal Name Definition - -Exit: X. Exit to Main Menu - -Command? 6 - - TCMAKE -Review of Arrow Key Definitions - 1. Arrow UP = ^K - 2. Arrow DOWN = ^V - 3. Arrow RIGHT = ^L - 4. Arrow LEFT = ^H - Strike Any Key to Continue - - - TCMAKE - ** Z3TCAP Status for File MYTERM2 .Z3T ** - -Review: 1. Clear Screen Definition - 2. Cursor Motion Definition - 3. Clear to End of Line Definition - 4. Standout Mode Definition - 5. Terminal Init/Deinit Definition - 6. Arrow Key Definition - 7. Terminal Name Definition - -Exit: X. Exit to Main Menu - -Command? X - - TCMAKE - ** Z3TCAP Main Menu for File MYTERM2 .Z3T ** - -Define: 1. Clear Screen Sequence - 2. Cursor Motion Sequence - 3. Clear to End of Line Sequence - 4. Standout Mode Sequences - 5. Terminal Init/Deinit Sequences - 6. Arrow Keys - 7. Terminal Name - -Status: S. Print Status (Definitions so far) - -Exit: X. Exit and Write File - Q. Quit and Abort Program without Writing File - -Command? X - Selected Terminal is: Rick's Terminal -- Confirm (Y/N)? Y -File MYTERM2 .Z3T Created -:3 - -Command: TCSELECT 1.0 - -Syntax: - TCSELECT ufn <-- default file type is Z3T -or - TCSELECT <-- selection stored in Env Desc - -Function: - - TCSELECÔ  allowó  thå useò tï interactivelù revie÷  thå -contentó oæ á Z3TCAP.TCÐ filå anä selecô á terminaì froí it® -Iæ aî unambigouó filå namå ió specifieä iî thå commanä line¬ -TCSELECÔ storeó thå selectioî intï thå indicateä  file®  Iæ -nï  filå  namå  ió  given¬  TCSELECÔ  storeó  thå  selectioî -directlù   intï   thå  TCAР sectioî  oæ  thå   memory-baseä -Environmenô Descriptor. - -Options: - None - -Comments: - None - -Selected Error Messages: - Self-Explanatory - -Examples of Use: - See following frames - - - TCSELECT - TCAP Entry Selection Program - TCSELECT - TCSELECÔ ió useä tï selecô á terminaì froí thå standarä -Z3TCAÐ file®  Thå selecteä terminaì maù bå loadeä  directlù -intï memorù oò á *.Z3T filå maù bå created® Iæ á *.Z3T filå -ió created¬ thå ZCPR³ utilitù LDÒ caî loaä iô intï memorù aô -the proper location (command is "LDR filename.Z3T"). - - Sample run of TCSELECT: - - TCSELECT -B4:SCR2>tcselect // -TCSELECT, Version 1.0 -TCSELECT - Select Entry from Z3TCAP.TCP -Syntax: - TCSELECT outfile -or- TCSELECT outfile.typ - -where "outfile" is the file to be generated by -the execution of TCSELECT. If no file type is -given, a file type of Z3T is the default. - -Syntax: - TCSELECT - -where this alternate form may be used to store -the Z3TCAP entry for the selected terminal directly -into the Z3 Environment Descriptor. - - TCSELECT -Example 1: Create MYTERM.TCP Example 1 - -B4:SCR2>tcselect myterm -TCSELECT, Version 1.0 - -** Terminal Menu 1 for Z3TCAP Version 1.1 ** - -A. AA Ambassador K. Concept 100 -B. ADDS Consul 980 L. Concept 108 -C. ADDS Regent 20 M. CT82 -D. ADDS Viewpoint N. DEC VT52 -E. ADM 2 O. DEC VT100 -F. ADM 31 P. Dialogue 80 -G. ADM 3A Q. Direct 800/A -H. ADM 42 R. General Trm 100A -I. Bantam 550 S. Hazeltine 1420 -J. CDC 456 T. Hazeltine 1500 - -Enter Selection, + for Next, or ^C to Exit - + - TCSELECT -** Terminal Menu 2 for Z3TCAP Version 1.1 ** Example 1 - -A. Hazeltine 1510 K. P Elmer 1200 -B. Hazeltine 1520 L. SOROC 120 -C. H19 (ANSI Mode) M. Super Bee -D. H19 (Heath Mode) N. TAB 132 -E. HP 2621 O. Teleray 1061 -F. IBM 3101 P. Teleray 3800 -G. Micro Bee Q. TTY 4424 -H. Microterm ACT IV R. TVI 912 -I. Microterm ACT V S. TVI 920 -J. P Elmer 1100 T. TVI 950 - -Enter Selection, - for Last, + for Next, or ^C to Exit - + - - TCSELECT -** Terminal Menu 3 for Z3TCAP Version 1.1 ** Example 1 - -A. VC 404 -B. VC 415 -C. Visual 200 -D. WYSE 50 - -Enter Selection, - for Last, or ^C to Exit - - - - TCSELECT -** Terminal Menu 2 for Z3TCAP Version 1.1 ** Example 1 - -A. Hazeltine 1510 K. P Elmer 1200 -B. Hazeltine 1520 L. SOROC 120 -C. H19 (ANSI Mode) M. Super Bee -D. H19 (Heath Mode) N. TAB 132 -E. HP 2621 O. Teleray 1061 -F. IBM 3101 P. Teleray 3800 -G. Micro Bee Q. TTY 4424 -H. Microterm ACT IV R. TVI 912 -I. Microterm ACT V S. TVI 920 -J. P Elmer 1100 T. TVI 950 - -Enter Selection, - for Last, + for Next, or ^C to Exit - T - - Selected Terminal is: TVI 950 -- Confirm (Y/N)? N - - TCSELECT -** Terminal Menu 2 for Z3TCAP Version 1.1 ** Example 1 - -A. Hazeltine 1510 K. P Elmer 1200 -B. Hazeltine 1520 L. SOROC 120 -C. H19 (ANSI Mode) M. Super Bee -D. H19 (Heath Mode) N. TAB 132 -E. HP 2621 O. Teleray 1061 -F. IBM 3101 P. Teleray 3800 -G. Micro Bee Q. TTY 4424 -H. Microterm ACT IV R. TVI 912 -I. Microterm ACT V S. TVI 920 -J. P Elmer 1100 T. TVI 950 - -Enter Selection, - for Last, + for Next, or ^C to Exit - S - - Selected Terminal is: TVI 920 -- Confirm (Y/N)? Y - -File MYTERM .Z3T Created - - -- Example 2: Select terminal and store it in memory TCSELECT -B4:SCR2>tcselect Example 2 -TCSELECT, Version 1.0 - -** Terminal Menu 1 for Z3TCAP Version 1.1 ** - -A. AA Ambassador K. Concept 100 -B. ADDS Consul 980 L. Concept 108 -C. ADDS Regent 20 M. CT82 -D. ADDS Viewpoint N. DEC VT52 -E. ADM 2 O. DEC VT100 -F. ADM 31 P. Dialogue 80 -G. ADM 3A Q. Direct 800/A -H. ADM 42 R. General Trm 100A -I. Bantam 550 S. Hazeltine 1420 -J. CDC 456 T. Hazeltine 1500 - -Enter Selection, + for Next, or ^C to Exit - + - - TCSELECT -** Terminal Menu 2 for Z3TCAP Version 1.1 ** Example 2 - -A. Hazeltine 1510 K. P Elmer 1200 -B. Hazeltine 1520 L. SOROC 120 -C. H19 (ANSI Mode) M. Super Bee -D. H19 (Heath Mode) N. TAB 132 -E. HP 2621 O. Teleray 1061 -F. IBM 3101 P. Teleray 3800 -G. Micro Bee Q. TTY 4424 -H. Microterm ACT IV R. TVI 912 -I. Microterm ACT V S. TVI 920 -J. P Elmer 1100 T. TVI 950 - -Enter Selection, - for Last, + for Next, or ^C to Exit - T - - Selected Terminal is: TVI 950 -- Confirm (Y/N)? Y - - ZCPR3 Environment Descriptor Loaded - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3TCAP.TCP b/Source/Images/d_bp/u15/Z3TCAP.TCP deleted file mode 100644 index 1b4c203a..00000000 Binary files a/Source/Images/d_bp/u15/Z3TCAP.TCP and /dev/null differ diff --git a/Source/Images/d_bp/u15/Z3TCAP.TQP b/Source/Images/d_bp/u15/Z3TCAP.TQP deleted file mode 100644 index 6866bc5c..00000000 Binary files a/Source/Images/d_bp/u15/Z3TCAP.TQP and /dev/null differ diff --git a/Source/Images/d_bp/u15/Z3TCAP22.LBR b/Source/Images/d_bp/u15/Z3TCAP22.LBR deleted file mode 100644 index bcc4cda7..00000000 Binary files a/Source/Images/d_bp/u15/Z3TCAP22.LBR and /dev/null differ diff --git a/Source/Images/d_bp/u15/Z3UTIL1.HLP b/Source/Images/d_bp/u15/Z3UTIL1.HLP deleted file mode 100644 index ac0ab794..00000000 --- a/Source/Images/d_bp/u15/Z3UTIL1.HLP +++ /dev/null @@ -1,989 +0,0 @@ -General-Purpose ZCPR3 Utilities -COMMENT "Block Comment" Utility -ECHO Echo Command Line -ERASE Erase Files -FINDF Search Disks for Files -MCOPY Copy Files -NOTE Comment Line -PAGE Page Files to Console -PRINT Print Files on Printer -PROTECT Set File Protection -RENAME Rename Files -SAK Alarm and Command Line Abort -UNERASE Unerase Files -WHEEL Set/Reset Wheel Byte -:General-Purpose ZCPR3 Utilities - - Thió   seô  oæ  utilitieó  consistó  oæ  thå  followinç -general-purpose programs: - - Command Function - COMMENT Type comment lines - ECHO Echo command line tail to CON: or LST: - ERASE Erase files - FINDF Find files - MCOPY Copy files - NOTE Comment line - PAGE Enhanced TYPE of a file to CON: - PRINT Print a file to LST: - PROTECT Set protection attributes on files - RENAME Rename files - SAK Interrupt command processing - TINIT Program TVI 950 CRT - UNERASE Unerase files - WHEEL Set user priveleges - - Somå  oæ  theså commandó providå functionó  similaò  tï -thoså  provideä iî thå ZCPR³ Commanä Processoò anä  Residenô -Commanä  Packages®  Thå  followinç tablå  summarizeó  theså -relateä commandsº  Thå residenô commandó SAVE¬  JUMP¬  GET¬ -anä  GÏ  havå  nï  counterpartó  bù  thå  naturå  oæ   theiò -functions. - - - -Resident Transient Additional Functions - DIR XDIR Sorts Display, Prints File Sizes, Negative - XD Selection, Disk Output, Printer Output, - DIR File Scan Function - - ERA ERASE File List, Inspect Mode, Can Erase R/O - Files, File Protection - - REN RENAME File List, Inspect Mode, Wild Cards - Permitted, Control Mode, File Protection - - TYPE PAGE File List, Screen Wrap, Speed Change - - LIST PRINT File List, Headings, Page Numbering, - Time Stamp, Paging, Skip to Specified Page - - CP MCOPY File List, AFNs, Verify, Inspect - - - Alì  oæ thå transientó discusseä herå whicè accepô botè -filå  nameó anä optionó aó argumentó wilì noô accepô á  filå -namå  beginninç witè á slash®  Thió ió á trade-ofæ  ..®  iô -shoulä  bå  easù tï omiô thå filå namå (assuminç  alì  fileó -selected© anä jumð righô tï thå options®  Tï bå consistent¬ -thå  slasè waó selecteä tï bå thå optioî delimiteò  wheî  nï -filå nameó werå tï bå specified. - - Aó  á generaì rulå foò alì ZCPR³ transients¬  iæ á filå -namå ió omitted¬ theî thå ¯ characteò musô proceeä thå firsô -option®  Aî invaliä optioî invokeó á built-iî Helð facilitù -withiî  alì  oæ thå transients¬  anä ¯ ió  neveò  aî  optioî -character: - - command filename.typ o... <-- form with file spec - command /o... <-- form without file spec - command // <-- always gives help - - - Manù  transientó supporô filå listó wherå á singlå filå -namå waó giveî before® Iî theså cases¬ thå useò caî specifù -á  lisô oæ filå specó separateä bù commaó iî thå  filå  namå -position: - - command dir:f1.typ,dir:f2.typ,... o... - - Iî general¬  anù timå thaô thå dº  prefiø coulä bå useä -undeò  CP/M¬  thå  DUº  oò  DIRº  prefixeó caî  bå  useä  iî -conjunctioî   witè  ZCPR³  utilities®   Onlù  onå  oò   twï -exceptionó  exisô  foò thió rule¬  anä  theù  arå  logicallù -noted. - -:The COMMENT Command - -Command: COMMENT 2.0 - -Syntax: - - COMMENT - -Function: - - COMMENÔ ió allowó thå useò tï typå aó manù lineó aó  hå -wisheó  withouô  theí beinç processeä bù ZCPR3®  Iô haó  nï -arguments. - - Iæ thå useò strikeó á ^P¬ alì subsequenô lineó hå typeó -will be printed on the printer. - -Options: - - None - - -Comments: - - COMMENÔ   haó  twï  maiî  applicationó  iî  thå   ZCPR³ -environment: - - 1®  Wheî  thå consolå displayó arå  beinç  recorded¬ -COMMENÔ  allowó thå useò tï easilù typå noteó tï thå  futurå -readeò  withouô havinç tï begiî lineó witè á semicoloî  (;)» -alì  oæ  theså lineó arå clearlù showî tï bå commentó  sincå -theù begiî witè thå prompô "Comment>". - - 2®  Wheî consolå I/Ï ió redirecteä tï twï  differenô -users¬  sucè aó CRÔ anä MODEÍ I/Ï iî parallel¬  theî COMMENÔ -maù  bå  useä  tï  providå á simplå mechanisí  foò  theí  tï -communicate»  botè  useró  caî typå tï  eacè  otheò  withouô -havinç   anù   effecô  oî  thå  systeí  (sucè   aó   commanä -processing). - - - COMMENÔ  ió  aborteä  bù  strikinç á ^à aó  thå  firsô -characteò  oæ á line®  Backspacå anä Deletå botè  servå  tï -echï  aó Backspace¬  space¬  backspace¬  anä ^Ø anä ^Õ  botè -eraså thå currenô line® ^Ð toggleó printing. - - Iæ COMMENÔ ió tï bå useä tï chaô betweeî twï users¬  iô -ió  recommendeä  thaô aî over/ouô protocoì bå  employeä  (aó -recommendeä  witè  thå UNIØ  [trademark¬  Belì  LabsÝ  WRITÅ -program)®   Thå  firsô  useò  types¬  and¬  wheî  finished¬ -terminateó  witè thå letteò "o¢ foò over®  Thå seconä  useò -typeó  anä signaló completioî thå samå way®  Completioî  oæ -thå conversatioî maù bå signalleä bù "o+o¢ foò oveò anä out. - - -Selected Error Messages: - - COMMENT generates no error messages. - - -Examples of Use: - -Comment> Hi, Charlie, how's it going? o -Comment> Hi, Rick, fine ... and you? o -Comment> Fine, Charlie -Comment> Here is how I use XDIR -- let me do the typing -Comment¾ froí no÷ on» jusô watch¬ anä I'lì reenteò COMMENT -Comment> when done ... here goes o+o - - -:The ECHO Command - -Command: ECHO 1.0 - -Syntax: - - ECHO text - -Function: - - ECHÏ  echoeó thå texô whicè followó iô tï thå  CONº  oò -LSTº devices® Iæ thå firsô non-blanë characteò oæ thió texô -is a '$', then ECHO sends its output to the LST: device. - -Options: - - None - - -Comments: - - The purpose of ECHO is two-fold: - - 1® tï providå á convenienô waù tï senä messageó tï -thå  consolå  durinç  thå  executioî oæ á  commanä  filå  oò -command line; for example: - - ECHO Assembling;ASM myfile.BBZ;ECHO Loading;LOAD myfile - -aó á singlå multiplå commanä linå wilì prinô thå informativå -messageó  "ASSEMBLING¢ anä "LINKING¢ durinç  thå  respectivå -commands - - - 2®  tï  providå  á convenienô waù tï senä  escapå -sequenceó  tï  thå CRÔ oò printer»  ECHÏ doeó  nï  characteò -translation¬  usinç direcô BIOÓ calls¬  sï sequenceó useä tï -prograí  intelligenô deviceó caî bå issueä bù  runninç  echï -and typing in those sequences; for example: - - ECHO ^Z - -coulä  cleaò thå CRÔ screeî iæ ^Z cleareä thå screeî oî  thå -user's terminal and - ECHO $^L - -wilì forí feeä thå printeò (assuminç thå printeò respondó tï -the form feed character) - - NOTEº   sincå   thå  commanä  inpuô  linå   editoò -capitalizeó   thå   commanä  lines¬   anù   characteró   arå -automaticallù capitalizeä wheî echoed - - -Selected Error Messages: - - ECHO generates no error messages - -Examples of Use: - - ECHO hello, world - -- send text "HELLO, WORLD" to console - - -:The ERASE Command - -Command: ERASE 5.0 - -Syntax: - - ERASE dir:afn1,dir:afn2,... o... - -Function: - - ERASÅ eraseó fileó iî thå filå list®  Onlù  non-systeí -fileó arå selecteä bù default¬ buô thå Ó optioî allowó ERASÅ -to select System files as well. - - -Options: - - S -- Include System Files; if S is not present, then - ERASE does not "see" System Files - - R -- Erase Read/Only Files without asking the user for - permission; if ERASE encounters a Read/Only file - whilå iô ió performinç itó functioî without the R - optioî enabled¬ iô wilì asë thå useò iæ hå wants - to erase the file before it does so; with the R - option, ERASE goes ahead and erases the file - - I -- Inspect; ERASE can be instructed to display each - filå tï thå useò anä asë permissioî beforå the - file is erased; if the user gives permission - and ERASE discovers that the file is R/O with - the R option off, it will ask a second time - before going ahead - - -Comments: - - None - -Selected Error Messages: - - Self-Explanatory - -Examples of Use: - - ERASE text:*.txt,asm:*.tmp - -- erase the *.TXT files in TEXT: directory and - *.TMP files in ASM: directory - - ERASE *.* I - -- erase *.* in the current directory with - inspection - -:The FINDF Command - -Command: FINDF 2.0 - -Syntax: - - FINDF afn1,afn2,... o - -Function: - - FINDÆ  searcheó througè alì oæ thå knowî diskó anä useò -areaó  foò  anä  fileó matchinç anù oæ  thå  indicateä  filå -specifications. - -Options: - - S - Include System Files - - -Comments: - - FINDÆ  wilì onlù searcè foò Non-Systeí fileó unlesó thå -Ó  optioî  ió includeä iî thå commanä line¬  aô  whicè  timå -FINDÆ wilì searcè foò botè Systeí anä Non-Systeí files. - - Thå  searcè  beginó aô disë Á anä extendó  untiì  FINDÆ -encounteró  thå  lasô possiblå disë oò á disë whicè  ió  noô -loaded. - - All user areas (0 to 31) are examined. - - FINDÆ displayó thå nameó oæ thå fileó found¬ groupeä bù -disk and user area. - - -Selected Error Messages: - - Self-Explanatory - -Examples of Use: - - FINDF xdir.com s - -- search all files (both System and Non-System) - for XDIR.COM - - FINDF xd.com,help.hlp,myfile.txt - -- searcè alì Non-Systeí fileó foò XD.COM, - HELP.HLP, and MYFILE.TXT - -:The MCOPY Command - -Command: MCOPY 4.0 - -Syntax: - - MCOPY dir:=dir:afn1,afn2,dir:=dir:afn3,... o... - -Function: - - MCOPÙ  ió  á filå copù prograí designeä foò  uså  undeò -ZCPR3®  Iô  supportó manù featureó relateä specificallù  tï -thå ZCPR³ Systeí anä ió verù intimatelù tieä intï thå  ZCPR³ -System. - - Thå  basiã  purposå oæ MCOPÙ ió tï copù fileó froí  onå -directorù (disk/useò area© tï anotheò undeò ZCPR3. - - - MCOPÙ onlù copieó files»  MCOPÙ DOEÓ NOÔ RENAMÅ  FILES® -Thió  ió  á majoò differencå foò thoså useä tï  PIP®  MCOPÙ -text:f1.txt=f2.txô jusô copieó F2.TXÔ intï TEXTº  directory¬ -buô iô ió stilì nameä F2.TXÔ (F1.TXÔ ió ignored). - -Options: - - E -- Test for Existence of File on Destination and - User Approves Copy before Copy is Done - - I -- User Approves Each File before Copy Begins - - M -- Multiple Copy (Repeat) Facility - This allows the user to backup several files to - several disks by copying all the specified files, - prompting the user for a new disk, and then - copying the files again, continuing until the user - tells MCOPY to stop - - - Q -- Quiet Operation (No Activity Displays) - - V -- Verify Copies - - Thå Å optioî (Existencå Test© lookó oî thå  destinatioî -directorù  tï seå iæ thå filå iô ió abouô tï copù ió alreadù -there®  Iô theî telló thå useò oæ itó findingó anä askó hií -iæ hå wantó tï gï aheaä witè thå copy®  Thå useò maù  elecô -tï copù oò noô copù aó hå desires. - - Thå  É optioî (Inspect© displayó alì fileó whicè  matcè -thå  indicateä  sourcå fileó tï thå user¬  allowinç  hií  tï -selecô  whicè  fileó hå wantó tï copy®  Iô theî copieó  thå -selecteä files®  MCOPÙ performó thió operatioî foò eacè seô -oæ fileó iî thå commanä linå (separateä bù commas). - - - Thå Í optioî (Multiplå Copy© pauseó beforå startinç thå -copy¬  allowinç thå useò tï aborô thå procedurå oò inserô  á -disë intï thå source¬  thå destination¬ oò botè anä instrucô -MCOPÙ tï proceed® Afteò copyinç alì oæ thå indicateä files¬ -MCOPÙ  theî pauseó again¬  allowinç thå useò tï agaiî changå -disks® Thió continueó untiì thå useò abortó thå procedure. - - Thå  Ñ  optioî  (Quiet© turnó ofæ  thå  MCOPÙ  activitù -display®  Iî normaì operation¬  MCOPÙ ió constantlù tellinç -thå useò whaô iô ió doing®  É feeì thaô thió ió betteò thaî -quietlù  havinç  problemó withouô thå useò knowinç  whaô  ió -goinç on®  MCOPÙ payó attentioî tï thå QUIEÔ flaç oæ ZCPR3¬ -and the initial mode of MCOPY is set by this flag. - - - Thå Ö optioî (Verify© ió useä tï checë thå copieä  filå -tï insurå thaô thå copù ió good®  Witè thió optioî engaged¬ -MCOPÙ  computeó  á CRà valuå oæ thå sourcå filå aó iô  readó -it®  Wheî  MCOPÙ  haó  completeä thå  copy¬  iô  readó  thå -destinatioî filå back¬  computinç itó CRà value¬  and¬  wheî -complete¬  iô compareó thå twï CRà values¬  tellinç thå useò -iæ aî erroò iî thå copù occurreä (i.e.¬ differenô CRà valueó -resulted). - - -Comments: - - MCOPÙ  ió alsï intendeä tï bå useä foò backuð purposes® -Iô  haó thå abilitù tï repeatedlù copù á seô oæ  fileó  froí -onå  directorù tï another¬  pausinç betweeî successivå  copù -passeó tï allo÷ thå useò tï changå disks®  Á keù tï thå uså -oæ MCOPÙ iî generaì ió thaô oncå MCOPÙ haó beguî operations¬ -thå  useò  neeä neveò concerî himselæ witè Warí Bootinç  thå -systeí afteò changinç disks» MCOPÙ ió doinç thaô foò him. - - Iæ  á  destinatioî directorù ió  noô  specified¬  MCOPÙ -lookó  foò  á directorù nameä BACKUPº  anä  copieó  tï  thió -directorù iæ found® Iæ therå ió nï directorù nameä BACKUP:¬ -MCOPÙ  wilì  copù  tï B0º  (thió caî bå changeä  bù  DDÔ  oò -reassembly). - - - Iî copyinç á filå froí onå directorù tï another¬  MCOPÙ -performó thå followinç steps: - - 1®  Iô  logó intï thå sourcå directorù anä  scanó -foò thå fileó specifieä bù thå user - - 2®   Iô  logó  intï  thå  destinatioî  directory¬ -determineó  iæ á copù oæ thå filå existó oî thå  destinatioî -anä deleteó iô iæ iô does - - 3®  MCOPÙ copieó thå filå iî thå sourcå directorù -intï thå destinatioî directory - - 4®  MCOPÙ setó thå attributeó oæ thå filå iî  thå -destinatioî  directorù tï bå thå samå aó thoså iî thå sourcå -directory - - 5®  MCOPÙ optionallù verifieó botè fileó bù meanó -oæ á CRà Check - -Selected Error Messages: - - "NÏ Fileó -- ^à tï Abort¢ meanó thaô nï fileó  matchinç -the indicated file spec were found. - - "TPÁ  Ovfl¢ meanó thaô therå waó noô enougè rooí iî thå -Transient Program Area to support MCOPY. - - "Disë  Full¢  meanó thaô therå ió nï morå rooí  oî  thå -destination disk for the files. - - -Examples of Use: - - MCOPY FILE1.*,HELP:FILE2.HLP,TEMP:=TEST.TXT,HI.* - - Fileó  matchinç  FILE1.ª iî thå currenô  directorù  arå -copieä tï BACKUP:¬  thå filå FILE2.HLÐ iî directorù HELР ió -copieä  tï  BACKUP:¬   thå  filå  TEST.TXÔ  iî  thå  currenô -directorù ió copieä tï TEMP:¬ anä thå fileó matchinç HI.ª iî -thå currenô directorù arå copieä tï TEMP:. - - Oncå á DIR:½ ió encountered¬ thå defaulô destinatioî ió -redefined®  Encounterinç á differencå source¬ however¬ doeó -noô changå whaô thå defaulô sourcå directorù is. - -:The NOTE Command - -Command: NOTE 1.0 - -Syntax: - - NOTE text - -Function: - - NOTÅ ió á do-nothinç commanä - iô implementó á comment® -No operation is performed at all. - -Options: - - None - - -Comments: - - Anù  linå  beginninç witè á semicoloî (;© ió á  commenô -line®  Witè  multiplå commanä lines¬  however¬  iô  ió  noô -possiblå  tï  embeä  á  commenô  phraså  iî  thå  middlå  oò -beginninç  oæ  á  commanä linå withouô á nulì  routinå  likå -NOTE. NOTE was created to: - - allow comments to be embedded in command lines - - provide a comment that stands out from the simple - semicolon line - -Selected Error Messages: - None - -Examples of Use: - NOTE this is a comment - -:The PAGE Command - -Command: PAGE 2.0 - -Syntax: - - PAGE dir:afn1,dir:afn2,... o... - -Function: - - Thå  PAGÅ commanä ió useä tï lisô fileó oî thå console® -Iô offeró advantageó oveò TYPÅ iî thaô PAGÅ knowó thå  widtè -oæ  thå  screeî  anä  handleó wraparounä  (whicè  ió  á  biç -complainô  witè  TYPÅ  wheî tryinç tï  pagå  througè  "wide¢ -listingó  likå thaô produceä bù thå assemblers)®  PAGÅ alsï -acceptó á filå list. - - -Options: - - 0-9 - Set Character Print Speed Delay - I - Inspect files - L - Number lines - P - Disable pause at end of screen - Sn - Skip to page n and then begin - -Comments: - - Whilå á filå ió beinç pageä tï thå user¬  thå useò  caî -strikå  onå  oæ thå digitó tï varù thå speeä oæ  thå  outpuô -dynamically®  ° ió thå fastest¬  ¹ ió thå slowest® Iî thió -way¬  thå  useò caî easilù scaî á filå bù runninç PAGÅ  witè -thå Ð optioî (sï iô doeó noô stoð wheî thå screeî ió filled© -anä  strikinç  á  digiô froí timå tï timå tï speeä  uð  oveò -sectionó  hå isn'ô interesteä iî anä slo÷ dowî foò  sectionó -hå is. - - - Whilå thå outpuô ió beinç directeä tï thå screen¬  PAGÅ -supportó  thå followinç single-characteò commandó tï  changå -thå outpuô displaù iî onå waù oò another: - - 0 to 9 - change speed (0=slowest, 9=fastest) - - P or p - toggle pause when screen fills - (the user can dynamically turn on and off - the ability to delay when a screen fills) - - ^X - skip to next file - - ^C - abort to operating system - - ^S - pause output; any key will resume, and all - of these commands (except ^S) will work - - - PAGÅ  ió  constantlù acceptinç useò  input¬  anä  theså -commandó arå iî effecô alì oæ thå time®  Thió includeó  thå -timå  wheî  PAGÅ  haó pauseä afteò fillinç thå  screeî  (itó -default)¬  sï thå useò caî turî ofæ paginç oò varù thå speeä -aô thió time¬  iæ sï desired®  Anù otheò characteò wilì  bå -ignored. - -Selected Error Messages: - - Self-Explanatory - - -Examples of Use: - - PAGE *.txt p8 - -- page all *.TXT files, and begin with paging - off (don't pause at the end of the screen) - and speed set to 8 - - PAGE myfile.txt s5 - -- page MYFILE.TXT, starting at page 5 - -:The PRINT Command - -Command: PRINT 2.0 - -Syntax: - - PRINT dir:afn1,dir:afn2,... o... - -Function: - - Thå  PRINÔ commanä ió useä tï prinô á filå oî thå  LSTº -device¬  likå LISÔ does¬  buô offeró manù morå options®  Iô -wilì  prinô  á heading¬  pagå thå file¬  numbeò  thå  pages¬ -numbeò thå lines¬ placå á date/timå stamð oî thå output¬ puô -thå filå namå oî thå output¬ anä others. - - -Options: - - E - Exact Print (Expand Tabs, Form Feed, No Line or - Page Numbers, No Heading) - - F - Toggle default of file name display on page header - (defaulô ió ON¬ so Æ turnó ofæ name display) - - Htext - Define Heading text to appear - at the top of each page - - I - Inspect Files (allow user to select files before - printing begins) - - L - Enable numbering of each line - - - M - Disable Multiple Run Flag - (if multiple run is ON, then no "Set Top of Form" - message appears for each file and PRINT moves - from one file to another unattended); default is - with Multiple Run ON - - N - Disable numbering of each page - - On - Offset each line - Move each line in the indicated number of chars - from the left of the page - - Sn - Start printing on page n - - T - Toggle date/time stamp in the header of each page - (a TIME subroutine must be assembled into PRINT - to enable the date/time stamp feature) - - -Comments: - - Thå  specifiã  featureó oæ thå printeò arå seô  bù  thå -ZCPR³  Environmenô  Descriptor®  Sucè featureó includå  thå -numbeò oæ physicaì lineó oî á page¬  thå numbeò oæ lineó  oæ -texô  oî  á page¬  thå widtè oæ á linå  iî  characters¬  anä -whetheò  thå printeò caî forí feeä oò not®  Thå Environmenô -Descriptoò containó optionó foò fouò printers¬ anä thå CPSEÌ -utilitù caî bå useä tï selecô thå desireä seô oæ attributes. - - Thå date/timå stamð featurå ió verù  machine-dependent¬ -anä PRINÔ haó tï bå reassembleä tï supporô it. - - While PRINT is running, the following commands work: - - ^C Abort and return to operating system - - ^X Skip to top of next page and skip to next file - - -Selected Error Messages: - - Self-Explanatory - -Examples of Use: - - PRINT text:*.txt,*.txt o10n - -- print all *.TXT files in the TEXT: directory - and in the current directory; offset all - lines by 10 columns, and do not number pages - - PRINT myfile.txt s25 - -- print MYFILE.TXT starting at page 25 - -:The PROTECT Command - -Command: PROTECT 3.0 - -Syntax: - - PROTECT dir:afn1,dir:afn2,... keys o... - -Function: - - Thå   PROTECÔ   commanä  replaceó  thå  attributå   seô -capabilitieó   oæ   thå  STAÔ  transienô   anä   addó   morå -flexibility®  PROTECÔ  ió  designeä  tï allo÷ thå  useò  tï -specifù thå attributeó (Read/Only¬  System¬ anä Archive© anä -taç bitó (thå Mosô Significanô Bitó oæ thå eighô  characteró -iî á filå name© oæ á filå oò seô oæ files. - - PROTECT always "sees" both System and Non-System files. - - -Options: - - Thå  KEYÓ arå thå attributeó selected®  Thå  followinç -keys are allowed: - - R¬ S¬ Á -- Enablå Read/Only¬ System¬ anä Archive - - n, 1 <= n <= 8 -- Set Tag Bits - - The following options are also available: - - I -- Inspect C -- Control - - Inspecô  Modå  allowó  thå useò tï looë  aô  eacè  filå -beforå iô ió "protected¢ anä permiô oò disallo÷ thå functioî -tï bå performeä oî á case-by-caså basis. - - - Controì  Modå  allowó thå useò tï seå thå namå oæ  eacè -filå selecteä anä manuallù seô itó attributeó anä taç  bits® -Iî responså tï thå Controì Modå prompt¬ thå useò caî typå iî -anù combinatioî oæ thå letteró A¬  R¬  S¬ anä thå digitó 1-¸ -(the KEYS). - -Comments: - - None - -Selected Error Messages: - - Self-Explanatory - - -Examples of Use: - - PROTECT A4:*.COM,ROOT:*.COM RSI - Set the Attributes of all COM files in directories A4 - and ROOT to Read/Only and System. Turn off the Archive - attribute and all tag bits. Allow the user to inspect - each file before the operation is performed. - - PROTECT ROOT:*.TXT - Clear all attributes and all tag bits of all files of - type TXT in the directory named ROOT - - PROTECT A: C - Allow the user to manually set all attributes and tag - bits of all files on Disk A in the current user - -:The RENAME Command - -Command: RENAME 3.0 - -Syntax: - - RENAME dir:afn1=afno1,dir:afn2=afno2,... o... - -Function: - - RENAMÅ ió useä tï changå thå namå oæ onå oò morå files® -Ambiguous file names and inspection are permitted. - -Options: - - C - Control Mode; manually specify each file name - I - Inspect and approve each rename - S - Include System files - - -Comments: - - Thå  RENAMÅ  commanä ió á brotheò tï thå  REΠ residenô -command® Therå arå manù majoò differences¬ however: - - . RENAMÅ allowó  ambiguouó filå nameó tï thå used - . RENAMÅ supports an Inspect Mode, where the user is - presented with each name change and allowed to - approve of it before it is done - . RENAME supports a Control Mode, where the user is - presented with each file to be RENAMEd and allowed - to manually enter the new name or not rename the - file - . RENAME accepts a list of files - . RENAME does not "see" System files unless told to - . RENAME can rename Read/Only files - . RENAME sets the attibutes (R/O and SYS) of the - new file names to be the same as those on the - old file names - -Selected Error Messages: - - Self-Explanatory - -Examples of Use: - - RENAME *.txt C - -- rename all *.TXT files to something else; - display the file name to the user and allow - him to manually enter the new name - - RENAME asm:*.mac=*.asm - -- rename all *.ASM files to *.MAC - -:The SAK Command - -Command: SAK 2.0 - -Syntax: - - SAK o... - - -Function: - - SAË  (Strikå  Anù  Key© waó designeä  tï  providå  somå -simplå  utilitù functions¬  onå oæ whicè ió associateä  witè -thå Multiplå Commanä Linå featurå oæ ZCPR3® Iô waó designeä -foò thå followinç purposes: - - 1. to allow the user to program a wait in a multiple - command line until he instructs the system to - continue - - 2. to allow the user to abort a multiple command line - - 3. to allow the user to program an interruptable delay - in the execution of a multiple command line - - 4. to provide a simple alarm for the user - - -Options: - - A - DO NOT allow the user to abort the command line - - B - Ring the bell at the user's terminal occasionally - - Pn - Pause n seconds and continue if no response by - that time - -Comments: - - Witè NÏ options¬  SAË waitó foò useò input¬  anä iæ thå -useò strikeó á ^C¬ theî thå multiplå commanä linå ió aborteä -anä controì ió returneä tï thå user. - - - SAË  ió  particularlù  usefuì iæ  thå  useò  wisheó  tï -interjecô  á delaù iî á multiplå commanä linå generateä bù á -Menu®  Onå sucè applicatioî waó tï displaù thå timå tï  thå -user¬  calì hió attentioî tï iô (viá ECHO)¬ givå hií á delaù -(viá  SAK)¬  anä  theî invokå dBASÅ IÉ witè aî  initializinç -commanä file. - -Selected Error Messages: - - Self-Explanatory - -Examples of Use: - - SAK BP10 - -- ring the bell occasionally and pause for 10 - seconds; if the user does not strike a - a command by that time (^C to abort), then - resume command line execution with the next - command -:The UNERASE Command - -Command: UNERASE 1.0 - -Syntax: - - UNERASE afn1,afn2,... o... - -Function: - - UNERASÅ  recoveró  fileó  whicè  havå  beeî  previouslù -eraseä iæ iô ió possiblå tï dï so® Aó á rule¬ UNERASÅ haó á -mucè  greateò  chancå oæ succesó iæ iô ió  useä  immediatelù -after the files were erased. - -Options: - - L - List Erased Files Only (do not attempt recovery) - P - Pause for Disk Change and then try - Z - Place Recovered Files in User Area 0 (default is - current user area) - -Comments: - - Wheî  ZCPR³ (anä CP/M© eraseó á file¬  thå  informatioî -containeä  iî thå filå anä thå directorù referencå  tï  thaô -informatioî  ió  noô  deleteä  immediately®   Instead¬  thå -directorù  entrù  ió simplù markeä aó beinç deleted®  Aó  á -result¬  bù  changinç  thió deletå marë  bacë  tï  somethinç -normal (which is a user number), the file is recovered. - - Afteò  á filå haó beeî deleted¬  twï eventó caî  happeî -whicè caî risë thå successfuì recoverù oæ thå file®  Onå ió -thaô  ne÷ directorù entrieó caî bå madå intï thå  directory¬ -anä  onå oò morå oæ theså maù overwritå thå entrù whicè  waó -madå  foò thå filå tï bå recovered®  Thå otheò ió thaô  thå -spacå  takeî  oî  disë  bù thå filå maù  bå  overwritteî  bù -another file. - - - Eacè  oæ  theså eventó ió possiblå wheî ne÷  fileó  arå -created®  Foò  thió reason¬  UNERASÅ caî bå useä witè  somå -degreå  oæ succesó onlù iæ nï fileó werå createä  afteò  thå -files to be recovered were erased. - - UNERASÅ  ió noô alwayó successful¬  however®  If¬  foò -instance, the following events took place: - - 1. the files MYFILE.TXT, HISFILE.TXT, and T.TXT - were created and then erased - 2. a new file T.TXT was created and then erased - 3. UNERASE T.TXT was issued - it is possible that - both previous T.TXT files would be recovered, - and a "weird" dual file named T.TXT would be - in your directory - - - UNERASÅ printó thå nameó oæ thå fileó iô ió recovering¬ -and¬ iæ á namå appearó twï oò morå times¬ theî theså earlieò -fileó  oæ  thå  samå  namå  arå  beinç   recovered®   Thoså -experienceä  witè DU2/DU³ caî probablù correcô thå situatioî -anä  recoveò thå correcô file®  Otheró wilì simplù  havå  á -corrupteä  directorù  whicè caî onlù bå restoreä bù  erasinç -T.TXT, thereby loosing both files again. - -Selected Error Messages: - - Self-Explanatory - - -Examples of Use: - - UNERASE myfile.txt,hisfile.txt - -- try to recover MYFILE.TXT and HISFILE.TXT - - UNERASE myfile.txt Z - -- trù tï recoveò MYFILE.TXÔ anä placå iô iî Useò 0 - - UNERASE myfile.txt L - -- see if MYFILE.TXT can be recovered (duplicates - may also appear in this way) - -:The WHEEL Command - -Command: WHEEL 3.0 - -Syntax: - - WHEEL password S or WHEEL password <-- Set Wheel Byte -or - WHEEL password R <-- Reset Wheel Byte -or - WHEEL /S or WHEEL /R <-- Enter Password - without echo - -Function: - - Thå WHEEÌ commanä ió useä tï enablå anä disablå certaiî -privelegeä commandó anä commanä features®  Iô doeó thió  bù -setting and resetting the Wheel Byte. - - -Options: - - Shown above - -Comments: - - Thå  Wheeì  Passworä ió hard-codeä intï  thå  WHEEL.COÍ -file. It may be changed by DDT or reassembly. - - WHEEÌ haó aî RCÐ counterpart¬ WHL¬ whicè maù alsï bå iî -effect. WHEEL and WHL can respond to different passwords. - -Selected Error Messages: - - "Invaliä  Password¢  meanó thaô thå giveî passworä  waó -not correct. - - -Examples of Use: - - WHEEL mypass - -- seô Wheeì Bytå iæ MYPASÓ ió thå correcô password - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3UTIL2.HLP b/Source/Images/d_bp/u15/Z3UTIL2.HLP deleted file mode 100644 index 39a7cc87..00000000 --- a/Source/Images/d_bp/u15/Z3UTIL2.HLP +++ /dev/null @@ -1,764 +0,0 @@ -The ZCPR3 System-Oriented Utilities -CMDRUN Extended Command Processor (ECP) -ERRORn Error Handlers -LDR ZCPR3 System Segment Loader -PATH Path Display and Set -QUIET Display and Set the Quiet Flag -REG Register Display and Manipulation -SETFILE System File Assignment -SHCTRL Shell Stack Display and Manipulation -SHOW System Configuration Display and Error Handler -Z3INS ZCPR3 System Installation Program -Z3LOC ZCPR3 System Segment Locator -:The ZCPR3 System-Oriented Utilities - - Thió  HELР filå  containó informatioî oî  thoså  ZCPR³ -utilitieó   whicè  accesó  featureó  oæ  thå  ZCPR³   Systeí -specifically. These features include: - - o Extended Command Processors - o Error Handlers - o the ZCPR3 System Segments - o the ZCPR3 Command Search Path - o the System Registers - o the System Files - o the ZCPR3 System Addresses - o the ZCPR3 System Status - -:CMDRUN Extended Command Processor (ECP) - -Command: CMDRUN - -Syntax: - - CMDRUN text (this command is usually executed by - ZCPR3 itself and not the user) -Function: - - CMDRUΠ ió á samplå Extendeä Commanä Processor®  Iô ió -invokeä automaticallù bù ZCPR³ wheî thå useò commanä ió  noô -founä  viá  thå commanä searcè patè anä nï erroò handleò  ió -engaged. - - Thå  texô  whicè followó thå verâ ió thå  texô  oæ  thå -original command line. - - -Options: - - None - -Comments: - - CMDRUΠ ió  onlù á simplå sample®  Iô showó  thaô  thå -originaì  commanä linå ió no÷ availablå iî thå commanä  taiì -buffeò (aô 80H)®  Thå formaì CMDRUÎ whicè thå useò programó -foò  hió ZCPR³ Systeí caî extracô thå originaì commanä  linå -from this buffer and manipulate it as desired. - -Selected Error Messages: - - None - -Examples of Use: - - None - -:ERRORn Error Handlers - ERROR1 -Command: ERROR1 1.0 - -Syntax: - - ERROR1 - -Function: - - ERROR±  ió  aî Erroò Handler®  Iæ thå useò  runó  thió -program¬ iô installó itselæ aó thå systeí erroò handler® Iæ -ZCPR³ cannoô finä thå COÍ filå referenceä bù á commanä verb¬ -iô  invokeó  thå  installeä Erroò  Handleò  anä  passeó  thå -commanä linå tï it. - -Options: - None - - ERROR1 -Comments: - - ERROR± displayó thå erroò linå tï thå useò anä provideó -hií witè fouò optionó aó tï ho÷ tï procesó thió line: - - 1. Replace the command in error with a new command - 2. Skip the command in error and resume execution - with the next command - 3. Replace the entire command line - 4® Thro÷ awaù thå commanä linå anä resumå user - control - -Selected Error Messages: - Self-Explanatory - -Examples of Use: - - ERROR1 - -- install Error Handler - ERROR2 -Command: ERROR2 1.0 - -Syntax: - - ERROR2 - -Function: - - ERROR2  ió  aî Erroò Handler®  Iæ thå useò  runó  thió -program¬ iô installó itselæ aó thå systeí erroò handler® Iæ -ZCPR³ cannoô finä thå COÍ filå referenceä bù á commanä verb¬ -iô  invokeó  thå  installeä Erroò  Handleò  anä  passeó  thå -commanä linå tï it. - -Options: - None - - ERROR2 -Comments: - - ERROR2 displayó thå erroò linå tï thå useò anä provideó -hií witè fouò optionó aó tï ho÷ tï procesó thió line: - - 1. Replace the command in error with a new command - 2. Skip the command in error and resume execution - with the next command - 3. Replace the entire command line - 4® Thro÷ awaù thå commanä linå anä resumå user - control - - Unlikå ERROR1¬ ERROR² ió screen-oriented¬ havinç á mucè -"flashier" display. It uses the Z3TCAP for support. - -Selected Error Messages: - Self-Explanatory - - ERROR2 -Examples of Use: - - ERROR2 - -- install Error Handler - - ERROR3 -Command: ERROR3 1.0 - -Syntax: - - ERROR3 - -Function: - - ERROR3  ió  aî Erroò Handler®  Iæ thå useò  runó  thió -program¬ iô installó itselæ aó thå systeí erroò handler® Iæ -ZCPR³ cannoô finä thå COÍ filå referenceä bù á commanä verb¬ -iô  invokeó  thå  installeä Erroò  Handleò  anä  passeó  thå -commanä linå tï it. - -Options: - None - - ERROR3 -Comments: - - ERROR³  displayó thå namå oæ thå COÍ filå whicè waó noô -founä anä theî flusheó thå commanä line¬  returninç  controì -to the user. - -Selected Error Messages: - None - -Examples of Use: - - ERROR3 - -- install ERROR3 - - ERROR4 -Command: ERROR4 1.0 - -Syntax: - - ERROR4 - -Function: - - ERROR4  ió  aî Erroò Handler®  Iæ thå useò  runó  thió -program¬ iô installó itselæ aó thå systeí erroò handler® Iæ -ZCPR³ cannoô finä thå COÍ filå referenceä bù á commanä verb¬ -iô  invokeó  thå  installeä Erroò  Handleò  anä  passeó  thå -commanä linå tï it. - -Options: - None - - ERROR4 -Comments: - - ERROR´  printó  thå namå oæ thå COÍ filå whicè waó  noô -founä  anä theî advanceó tï thå nexô commanä iî thå  commanä -linå buffer®  Iæ therå ió nï nexô command¬  useò controì ió -resumed®  Iæ  therå ió á nexô  command¬  commanä  executioî -resumes there. - -Selected Error Messages: - None - -Examples of Use: - - ERROR4 - -- install Error Handler - - ERRORX -Command: ERRORX 1.0 - -Syntax: - - ERRORX - -Function: - - ERRORØ disengageó thå currenô erroò handler¬ leavinç nï -erroò  handleò enabled®  Thå defaulô erroò controì facilitù -oæ ZCPR³ ió no÷ iî effect¬  wherå iæ aî erroò occuró iî  thå -commanä  line¬  thå commanä linå froí thaô poinô forwarä  ió -printed (followed by a '?'). - -Options: - None - - ERRORX -Comments: - - None - -Selected Error Messages: - - No error messages are generated by ERRORX. - -Examples of Use: - - ERRORX - -- disengage any Error Handler currently enabled - -:LDR ZCPR3 System Segment Loader - -Command: LDR 1.0 - -Syntax: - - LDR ufn1,ufn2,... - -Function: - - LDÒ  ió  á  general-purposå Systeí Segmenô  loadeò  foò -ZCPR3® Iô loadó alì oæ thå ZCPR³ Systeí Segmentó intï theiò -appropriatå  buffers¬  checkinç oî theiò formaô anä  contenô -beforå  approvinç  anä completinç eacè  load®  Eacè  Systeí -Segment is specified unambiguously. - -Options: - - None - - Comments: - - Thå  followinç Systeí Segmentó arå loadeä  intï  memorù -buffers by LDR: - - *.ENV files - Environment Descriptors - *.FCP files - Flow Command Packages - *.IOP files - Input/Output Packages - *.NDR files - Named Directory Files - *.RCP files - Resident Command Packages - *.Z3T files - Z3TCAP Entries - - Foò  eacè  filå loaded¬  thå contentó oæ thå  filå  arå -loadeä intï á memorù buffeò anä examined® Baseä oî thå filå -type¬  segment-uniquå  structuraì checkó arå performed®  Iæ -thå  checkó  arå  passed¬  thå segmenô ió  copieä  intï  thå -correcô  memorù  buffeò baseä oî thå datá containeä  iî  thå -Environmenô Descriptor®  Iæ thå checkó arå noô  passed¬  aî -erroò  messagå  ió issueä anä thå nexô filå iî thå  lisô  ió -processed. - - Sincå  thå  Environmenô Descriptoò (whicè ió  currentlù -residinç  iî  itó  memorù buffer© ió  useä  tï  providå  thå -addresó  tï whicè tï copù thå loadeä Systeí Segment¬  iô  ió -importanô  thaô  thå  Environmenô Descriptoò  bå  thå  firsô -segmenô  loadeä bù LDR®  Aî alternativå tï thió ió thaô thå -BIOÓ maù initializå thå Environmenô Descriptoò oî Colä Boot¬ -buô  thió  woulä requirå á relativelù  largå  BIOÓ  overheaä -(over 128 bytes for the initial Environment Descriptor). - - Wheî LDÒ loadó aî Environmenô Descriptor¬  iô placeó iô -aô  thå  addresó  oæ thå Environmenô  Descriptoò  whicè  waó -installeä iî LDÒ durinç thå ZCPR³ Systeí installation®  Anù -otheò  Systeí Segmenô ió loadeä baseä oî thå contentó oæ thå -current Environment Descriptor in memory. - - -Selected Error Messages: - - "filename.tyð ió noô á Valiä Type¢ meanó thaô thå  filå -typå oæ thå indicateä filå ió noô onå oæ ENV¬ FCP¬ IOP¬ NDR¬ -RCP, or Z3T. - - "filename.tyð  Containó  á Formaô Flaw¢ meanó thaô  thå -structure of the indicated file was not correct. - -Examples of Use: - - LDR SYS.ENV,MYIO.IOP,MYCMDS.RCP,MYIFS.FCP - -- loaä SYS.ENV¬ and¬ baseä oî thå datá iî thió - Environment Descriptor, load the I/O Package - MYIO.IOP, the Resident Command Package - MYCMDS.RCP, and the Flow Command Package MYIFS.FCP - - LDR TERM1.Z3T - -- replace the current Z3TCAP entry with TERM1.Z3T -:PATH Path Display and Set - -Command: PATH 3.0 - -Syntax: - - PATH -or - PATH path-expression - -Function: - - PATÈ  allowó thå useò tï dï twï thingó  -- displaù  thå -currenô patè oò seô á ne÷ path®  Thå displaù showó thå patè -iî  threå  formatsº  Symbolic¬  Absolutå  (DU)¬  anä  Nameä -Directorù  (DIR)®  Thå patè expressioî maù intermiø anù  oæ -theså formató aó desireä tï expresó thå ne÷ path. - -Options: - - None - -Comments: - - Thå  PATÈ  Commanä  ió useä  tï  dynamicallù  changå  á -memory-baseä  filå  searcè patè oò thå ZCPR³ commanä  searcè -path®  Witè  PATH¬  thå  useò caî definå á ne÷ patè  tï  bå -followeä oò hå caî vie÷ whaô thå currenô patè is. - - PATÈ determineó thå addresó oæ thå patè iô ió goinç  tï -work with from the ZCPR3 Environment Descriptor. - - Thå  PATÈ commanä dealó witè patè expressions®  Á patè -expressioî  ió  á sequencå oæ directorù nameó whicè  caî  bå -expresseä  aó "ambiguous¢ DÕ forms¬  absolutå DÕ  forms¬  oò -Nameä Directorù forms. - - - Aî  absolutå  DÕ  forí indicateó  jusô  á  disë  letteò -(currenô useò ió assumed)¬  jusô á useò numbeò (currenô disë -ió  assumed)¬  oò botè á disë letteò anä á useò number®  Aî -"ambiguous¢ DÕ forí ió onå iî whicè thå disë letteò oò  useò -numbeò  oò  botè ió replaceä witè á "$¢  character¬  meaninç -"currenô disk¢ oò "currenô user"®  Á Nameä Directorù  form¬ -oæ course¬ ió simplù thå namå oæ á directory. - - Tï illustrate¬  let'ó saù thaô thå useò ió loggeä  intï -B1® Thå path - - $0 A$ A0 ROOT - -represents the sequence - - B0 to A1 to A0 to ROOT - - -Selected Error Messages: - - "Baä Expressioî aô ¢ indicateó therå waó aî erroò -in the path expression at the indicated point. - -Examples of Use: - - PATH $0 A$ A15 - - seô  patè froí currenô disk/useò ° tï disë A/currenô -useò tï disë A/useò 15 - - PATH A$ ROOT - - set path from disk A/current user to ROOT: - -:QUIET Display and Set the Quiet Flag - -Command: QUIET 1.0 - -Syntax: - - QUIET o - -Function: - - QUIEÔ ió useä tï set¬ reset¬ anä displaù thå Quieô Flaç -in the ZCPR3 Environment Descriptor. - -Options: - - D - Display the Quiet Flag - R - Reset (turn OFF) the Quiet Flag - S - Set (turn ON) the Quiet Flag - - -Comments: - - Manù  ZCPR³ utilitieó reaä thå Quieô Flaç iî thå  ZCPR³ -Environmenô  Descriptoò  anä responä  accordingly®  Iæ  thå -Quieô  Flaç ió Seô (ON)¬  theî certaiî informativå  messageó -arå  suppresseä iî ordeò tï cuô dowî oî thå "noise¢  createä -bù thå command®  Iæ thå Quieô Flaç ió Reseô (OFF)¬ theî alì -messages are displayed. - -Selected Error Messages: - - Nï  Erroò Messageó arå generated®  Aî invaliä  commanä -results in the Help screen being displayed. - - -Examples of Use: - - QUIET R - - turn OFF (Reset) the Quiet Flag - - QUIET DISPLAY - - Display the Quiet Flag - -:REG Register Display and Manipulation - -Command: REG 1.0 - -Syntax: - - REG Dr or REG r <-- Display Register r - REG Mr <-- Minus (r=r-1) Register r - REG Pr <-- Plus (r=r+1) Register r - REG Sr value <-- Set (r=value) Register r - -Function: - - REÇ displays¬  addó ± to¬  subtractó ± from¬ anä setó á -valuå tï thå indicateä register® Á ZCPR³ Registeò ió á one- -byte buffer (values are ranged from 0 to 255 decimal). - - Thå  valuå  useä tï indicatå á registeò ió á  characteò -froí '0§ tï '9'®  Thå characteò '#§ indicateó alì registeró -("REG S# 0" stores 0 to all ten registers). - - -Options: - - Shown Above - -Comments: - - Registers are used for two purposes: - - 1. to support looping in ZEX command files - (do something N times) - - 2. to pass parameter values from one program to - another program which is executed later - - REÇ  haó á counterparô commanä iî thå  Systeí  Residenô -Command Package provided in the ZCPR3 distribution. - - -Selected Error Messages: - - "Invlä Reç IDº c¢ meanó thaô thå registeò indicateä waó -not symbolized by '0' to '9' or '#'. - -Examples of Use: - - REG S5 25 - -- Register 5 = 25 - - REG M# - -- 1 is subtracted from all registers - -:SETFILE System File Assignment - -Command: SETFILE 1.0 - -Syntax: - - SETFILE n afn -or - SETFILE n - -Function: - - SETFILÅ seô thå namå oæ ZCPR³ Systeí Filå î (wherå î ió -± tï 4© tï thå indicateä ambiguouó filå name®  Iæ nï AFÎ ió -given¬  thå currenô contentó oæ thå indicateä Systeí Filå ió -displayed. A file number is required. - -Options: - - None - - Comments: - - ZCPR³  Systeí Fileó arå referenceä bù somå oæ thå ZCPR³ -utilities¬  MENÕ  anä ALIAÓ iî particular®  SETFILÅ ió  thå -meanó  bù whicè thå contentó oæ theså filå namå  bufferó  ió -defined. - -Selected Error Messages: - - "Invaliä Filå Namå Numbeò (noô 1-4)¢ meanó thaô á valiä -filå  numbeò waó noô giveî afteò thå SETFILÅ verâ (SETFILÅ î -afn). - -Examples of Use: - - SETFILE 1 myfile.txt - - System File 1 is set to MYFILE.TXT - - SETFILE 4 - - the name of System File 4 is displayed -:SHCTRL Shell Stack Display and Manipulation - -Command: SHCTRL 1.0 - -Syntax: - - SHCTRL o - -Function: - - SHCTRÌ  ió  useä tï providå somå controì oæ  thå  ZCPR³ -Shelì  Stacë  froí thå commanä line®  Thå contentó  oæ  thå -Shelì Stacë caî bå displayeä anä poppeä onå leveì oò cleareä -completely. - - -Options: - - C - Clear the Shell Stack (no Shell is in effect) - D - Display Shell Stack - P - Pop the Shell Stack (the current Shell is stopped - and the next Shell on the stack is invoked) - -Comments: - - Onlù  onå  optioî maù bå useä iî conjunctioî  witè  thå -SHCTRÌ  command®  Anù characteró followinç thió optioî  arå -ignored. - - SHCTRÌ  ió  intendeä tï bå useä iî situationó  wherå  á -directorù changå ió desireä anä á Shell¬ sucè aó MENU¬ ió iî -execution®  Thå  Shelì Stacë caî bå popped¬  thå  directorù -changå   performed¬   anä  thå  originaì  Shelì   explicitlù -reinvoked. - - -Selected Error Messages: - - None - Help is printed if invalid option - -Examples of Use: - - SHCTRL P - - pop the Shell Stack one level - - SHCTRL D - - display the contents of the Shell Stack - - -:SHOW System Configuration Display and Error Handler - -Command: SHOW 1.0 - -Syntax: - - SHOW o - -Function: - - SHO× ió thå ZCPR³ Environmenô Displaù utility® Detailó -oæ thå ZCPR³ Environmenô Descriptor¬  whaô systeí facilitieó -arå  available¬  anä whaô thå statuó oæ theså facilitieó  ió -arå  somå  oæ thå itemó includeä iî  thå  numerouó  displayó -which are generated by SHOW. - - SHO× caî bå invokeä aó aî Erroò Handler¬  iî whicè caså -itó  Erroò Handleò displaù caî givå thå commanä linå  statuó -anä  itó otheò displays¬  sucè aó memorù examine¬  maù provå -useful to analyze the state of the ZCPR3 System. - - Options: - - E - Install SHOW as an Error Handler - (no SHOW displays are invoked) - -Comments: - SHOW provides the following displays to the user: - - 1. Package Data 3. ZCPR3 System - - Flow Command Package - Environment Descriptor - - Input/Output Package - Message Buffers - - Resident Command Package - CRT and Printer Data - - System File Definitions - 2. Environment Data - - Error Handler - - Memory Display Utility - - Named Directory Display - - Path Expression - - Shell Stack - - - SHO× ió screen-orienteä anä wilì noô functioî correctlù -withouô propeò Z3TCAÐ support®  Thå Environmenô  Descriptoò -MUST be installed with a valid Z3TCAP entry. - -Selected Error Messages: - - Self-Explanatory - -Examples of Use: - - Trù  iô  - you'lì likå it¡  SHO×  ió  totallù  screen- -orienteä  anä  wilì noô begiî tï functioî correctlù  withouô -propeò  Z3TCAР support®  Iæ thå useò enteró  SHO×  withouô -proper support, the X command exits SHOW. - -:Z3INS ZCPR3 System Installation Program - -Command: Z3INS 1.0 - -Syntax: - - Z3INS ufn1 ufn2 - - UFN1 must be an Environment Descriptor - UFN2 must be a Z3INS Installation File - -Function: - - Z3INÓ  installó thå fileó nameä iî á Z3INÓ Installatioî -Filå  witè datá froí thå Environmenô  Descriptoò  specified® -All files must be ZCPR3 Utilities. - - Thå   defaulô   filå  typeó  arå  ENÖ  foò  UFN±   (thå -Environment Descriptor) and INS (the Installation File). - - -Options: - - None - -Comments: - - Z3INÓ ió thå installatioî prograí foò thå ZCPR³ System® -Alì utilitieó provideä iî thå ZCPR³ distributioî excepô  foò -ZEX may be installed for a target system by using Z3INS. - - Á  ZCPR³  Installatioî  Filå  ió  simplù  á  texô  filå -containinç twï typeó oæ linesº á commenô line¬ whicè beginó -witè  á semicoloî (;)¬  anä á linå containinç aî unambiguouó -file name, which is a file to be installed. Example: - - - ; This is an installation file for my new utilities - util1.com - util2.com - ; UTIL3 is really neat - util3.com - - -- Sample Z3INS Installation File -- - - - Caså ió noô significant®  Leadinç spaceó oî eacè  linå -are ignored. Any file name MUST be unambiguous. - - Thå  Environmenô  Descriptoò referenceä iî thå  commanä -linå ió á standarä ZCPR³ Systeî Environmenô descriptoò whicè -is created by assembling a file like SYSENV.ASM. - - -Selected Error Messages: - - Alì   erroò  messageó  arå  verù  completå  anä   self- -explanatory. - -Examples of Use: - - Z3INS SYS.ENV NEWFILES.INS - -- Install the files listed in NEWFILES.INS with - the data contained in SYS.ENV - - Z3INS NEWENV DIST - -- Install the files listed in DIST.INS with - the data contained in NEWENV.ENV - -:Z3LOC ZCPR3 System Segment Locator - -Command: Z3LOC 1.0 - -Syntax: - - Z3LOC o - -Function: - - Z3LOà ió useä tï locatå anä displaù thå  addresseó  oæ -thå runninç ZCPR³ Commanä Processoò Replacement¬  BDOS¬  anä -BIOS®  Iô maù alsï bå ruî undeò conventionaì CP/Í tï locatå -anä  displaù  thå addresseó oæ thå runninç CP/Í 2.²  Consolå -Command Processor, BDOS, and BIOS. - - Z3LOà ió alsï ablå tï displaù thå addresseó oæ á numbeò -oæ  ZCPR³ Systeí Segmentó anä datá areaó iæ thå Ú optioî  ió -given®  Thå  Ú optioî shoulä noô bå giveî iæ runninç  Z3LOà -under CP/M 2.2. - - -Options: - - Z - Display addresses and data on ZCPR3 System Segments - and data areas - -Comments: - - Iæ  thå  Ú optioî ió giveî (Ú shoulä onlù bå  giveî  iæ -runninç  Z3LOà undeò  ZCPR3)¬   thå  followinç   additionaì -address information is provided: - - ï Externaì Patè ï Residenô Commanä Package - o Input/Output Package o Flow Command Package - o Named Directory Buffer o Command Line Buffer - o Shell Stack o Environment Descriptor - o External FCB o ZCPR3 Message Buffer - o External Stack o Wheel Byte - - -Selected Error Messages: - - Z3LOà generateó nï erroò messages®  Aî invaliä optioî -invokes a help screen. - -Examples of Use: - - Z3LOC - -- run Z3LOC for CPR/CCP, BDOS, and BIOS display - (may be used this way under CP/M 2.2) - - Z3LOC Z - -- display ZCPR3 data as well - (may be used this way under ZCPR3 only) - - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/Z3UTIL3.HLP b/Source/Images/d_bp/u15/Z3UTIL3.HLP deleted file mode 100644 index 83d79d32..00000000 --- a/Source/Images/d_bp/u15/Z3UTIL3.HLP +++ /dev/null @@ -1,237 +0,0 @@ -Note ZCPR3 Utilities -CLEANDIR Physical Directory Cleanup -CMD Input Command Line -MU Memory Utility RCP -SHSET Define Shell Sequence -:Note ZCPR3 Utilities - - Thió  seô  oæ  ZCPR³ utilitieó arå  general-purposå  iî -naturå  anä  havå  beeî  provideä witè  thå  ZCPR³  Phaså  ² -release® Alì utilitieó excepô thå RCÐ caî bå installeä oî á -targeô ZCPR³ Systeí bù runninç Z3INS. - -:CLEANDIR Physical Directory Cleanup -Command: CLEANDIR 1.0 - -Syntax: - CLEANDIR dir: o -or - CLEANDIR o - -Function: - CLEANDIÒ "cleans¢ á physicaì disë directory®  Iô loadó -thå  directorù  oæ thå targeô disë  intï  memory¬  sortó  iô -alphabeticallù  withiî  eacè useò areá (ascendinç  ordeò  bù -default)¬  anä  writeó iô ouô tï disë witè Eµ filì oæ unuseä -directorù entries. - - Á DIRº  prefiø ió allowed¬  buô onlù thå disë referencå -ió meaningful¬  sï iæ "CLEANDIÒ ROOT:¢ ió issueä wherå ROOTº -is A15:, then disk A is cleaned. - -Options: - D - sort user areas and files in Descending Order - -Comments: - - CLEANDIR'ó  sorô  oî thå disë directorù buyó  thå  useò -several advantages: - - 1®  Utilitieó whicè sorô thå disë directorù  afteò -loadinç  it¬  likå XDIR¬  ruî fasteò sincå thå directorù  ió -already sorted. - - 2®  Thå  possibilitù oæ recoverinç fileó  bù  thå -UNERASÅ commanä ió increaseä iæ CLEANDIÒ haó beeî ruî oî thå -directorù recentlù beforå thå fileó werå erased®  Notå thaô -anù  eraseä fileó absolutelù cannoô bå recovereä bù  UNERASÅ -iæ  CLEANDIÒ  waó ruî betweeî thå timå theù werå eraseä  anä -UNERASE was executed. - - 3®  Uså  oæ DU2/DU³ tï looë aô thå  directorù  ió -facilitated if the directory is already sorted by CLEANDIR. - - -Selected Error Messages: - - Self-Explanatory - -Examples of Use: - - CLEANDIR - -- clean current disk in ascending order - - CLEANDIR A: D - -- clean disk A in descending order - - CLEANDIR TEXT: - -- clean the disk which the directory named TEXT - is defined for in ascending order - - CLEANDIR D - -- clean current disk in descending order - -:CMD Input Command Line -Command: CMD 1.0 - -Syntax: - - CMD cmd1;cmd2;... -or - CMD or CMD;cmd2;... - -Function: - - Iæ  CMÄ haó aî argument¬  iô buildó á ne÷ commanä  linå -whicè  beginó witè thió argumenô anä proceedó witè thå  resô -oæ thå commanä line® Foò example¬ thå firsô form: - - CMD cmd1;cmd2;... - -is translated into: - - cmd1;cmd2;... - - - Thió  ió  gooä  becauså sourceó sucè  aó  MENU¬  VMENU¬ -anä  VFILEÒ  caî  enteò thå "cmd1¢ variablå  froí  thå  useò -selection manually. - - Iæ CMÄ haó nï argument¬ thå useò ió prompteä foò input¬ -anä  thió inpuô ió inserteä intï thå commanä streaí  aô  thå -poinô oæ thå CMÄ command® Thió ió mucè morå useful¬ sucè aó -wheî  SHSEÔ  ió useä tï definå á shelì  sequence¬  anä  thió -sequencå  ió tï bå exiteä aô somå time®  Foò  example¬  thå -second form: - - CMD;cmd2;... - -is translated into: - - mycmd;cmd2;... - -if the user typed in "mycmd" in response to the prompt. - - CMÄ setó thå erroò messagå wheneveò iô runs®  ERROÒ ió -turned on if no line was input to CMD. - -Options: None - -Comments: - - CMÄ  waó  builô  foò uså specificallù  witè  thå  SHSEÔ -command¬  althï iô maù finä otheò applications® Thå probleí -thaô CMÄ addresseó ió thå caså wherå thå maiî prograí iî thå -shelì sequencå knowó nothinç abouô shells¬ anä iô ió desireä -to leave the sequence sometime. CMD provides this out. - - Foò  instance¬  iæ MU³ ió tï bå useä aó thå maiî shell¬ -then: - SHSET MU3;CMD - -wilì ruî MU3¬  allo÷ thå useò tï dï whaô hå wants¬  anä theî -reenter MU3. If the user entered the command - - - SHCTRL POP - -thå shelì stacë woulä bå poppeä anä thå "MU3;CMD¢ looð woulä -be broken. - - Additionally¬  CMÄ setó thå ERROÒ messagå oæ ZCPR3¬  sï -thaô  programó  oî dowî thå linå caî determinå iæ inpuô  waó -madå wheî CMÄ waó run®  Iæ thå useò simplù strikeó á RETURÎ -iî responså tï thå CMÄ prompt¬ aî erroò ió indicated® Testó -caî lateò bå made¬ likå IÆ ERROR¬ tï checë thió anä makå thå -command flow change depending on the outcome. - -Selected Error Messages: - - None - self-explanatory - -Examples of Use: - - See above -:MU Memory Utility RCP -Command: MU RCP 1.0A - -Syntax: - - MU <-- invoke MU at 100H -or MU address <-- invoke MU at indicated address - -Function: - - MÕ ió identicaì tï MU³ iî function¬  witè thå exceptioî -thaô   thå  È  commanä  (Hexadecimaì  Calculator©   ió   noô -supported®  Thå  differencå  betweeî MÕ anä MU³ ió thaô  MÕ -executeó aó aî RCÐ anä MU³ executeó aó á transient®  Aó  aî -RCP¬  MÕ  allowó thå useò tï examinå thå TPÁ withouô concerî -foò sidå effects¬  sï debugginç transientó ió simplifieä  bù -thió command®  Iô ió thå onlù maiî commanä iî thå DEBUG.RCÐ -provided in the ZCPR3 release. - - -Options: None - -Comments: - - MÕ maù bå invokeä aó á Shelì bù thå SHSEÔ command® Thå -à commanä caî bå useä froí withiî MÕ tï executå anù desireä -commanä line¬  includinç thå "SHCTRÌ POP¢ commanä whicè popó -MÕ  froí  thå Shelì Stack¬  terminatinç itó operatioî  aó  á -Shell. - -Selected Error Messages: None - -Examples of Use: - - MU <-- run MU - MU 0F400 <-- run MU but position at 0F400H - -:SHSET Define Shell Sequence -Command: SHSET 1.0 - -Syntax: - - SHSET cmd1;cmd2;... - -Function: - - SHSEÔ  defineó  thå  commandó whicè follo÷  iô  aó  thå -commanä sequencå tï bå placeä oî thå toð oæ thå shelì stack® -Iô placeó thió sequencå there®  Consequently¬ oncå SHSEÔ ió -executeä  oî á sequencå oæ commands¬  theså commandó wilì bå -cycleä  thrõ  timå anä timå agaiî untiì thå shelì  stacë  ió -cleared or popped. - -Options: - - None - - -Comments: - - SHSEÔ  provideó aî easù mechanisí tï makå  anù  commanä -sequencå  intï á shell®  Consequently¬  non-ZCPR³ programs¬ -likå  MBASIC¬  DBASÅ II¬  WORÄ STAR¬  anä otheró caî  becomå -shells under ZCPR3. - - Carå  shoulä bå takeî witè SHSEÔ iî allowinç thå  shelì -tï  bå  exiteä  iæ iô ió sï desired®  Thå  utilitù  CMÄ  ió -sometimes useful for this. - -Selected Error Messages: - - None - self-explanatory - - -Examples of Use: - - SHSET MBASIC;CMD - -- define the sequence MBASIC;CMD to be a shell - - SHSET WS - -- define Word Star to be a shell - - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ZCPR3.AQM b/Source/Images/d_bp/u15/ZCPR3.AQM deleted file mode 100644 index 64198f09..00000000 Binary files a/Source/Images/d_bp/u15/ZCPR3.AQM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ZCPR3.ASM b/Source/Images/d_bp/u15/ZCPR3.ASM deleted file mode 100644 index 33f2a15f..00000000 --- a/Source/Images/d_bp/u15/ZCPR3.ASM +++ /dev/null @@ -1,2907 +0,0 @@ - -************************************************************************* -* * -* Z C P R 3 -- Z80-Based Command Processor Replacement, Version 3.0 * -* * -* Copyright (c) 1984 by Richard Conn * -* Copyright US Government * -* All Rights Reserved * -* * -* ZCPR3 was written by Richard Conn, who assumes no responsibility * -* or liability for its use. ZCPR3 is released to the CP/M user * -* community for non-commercial use only. * -* * -* All registered users of CP/M are encouraged to freely copy and use * -* ZCPR3 and its associated utilities on their registered systems for * -* non-commercial purposes. * -* * -* Any commercial use of ZCPR3 is prohibited unless approved by the * -* author, Richard Conn, or his authorized agent, Echelon, Inc, in * -* writing. * -* * -* This is the RELEASE VERSION of ZCPR3. Dated: 21 Apr 84 * -* * -************************************************************************* - -; -; ZCPR3 -- CP/M Z80 Command Processor Replacement (ZCPR) Version 3.0 -; -; ZCPR3 is based upon ZCPR2 -; -;******** Structure Notes ******** -; -; ZCPR3 is divided into a number of major sections. The following -; is an outline of these sections and the names of the major routines -; located therein. -; -; Section Function/Routines -; ------- ----------------- -; -; -- Opening Comments, Equates, and Macro Definitions -; -; 0 JMP Table into ZCPR3 -; ENTRY -; -; 1 Buffers -; 1. Input Command Line and Default Command -; 2. File Type of COM File -; 3. SUBMIT File Control Block -; 4. Command File Control Block -; 5. Line Count Buffer -; 6. Resident Command Table -; -; 2 CPR Starting Modules -; CPR1 CPR RESTRT RS0 RS1 -; RS2 PARSER SCANNER DUSCAN DIRSCAN -; PASSCK SKSP TSTEOL INITFCB IFCB -; FILL PRNNF -; -; 3 Utilities -; CONIN CRLF CONOUT LCOUT LSTOUT -; PAGER READF READ BDOSB NOTE -; PRINTC PRINT PRIN1 GETDRV DEFDMA -; DMASET RESET BDOSJP LOGIN OPENF -; OPEN GRBDOS CLOSE SEARF SEAR1 -; SEARN SUBKIL DELETE GETUSR SETUSR -; -; 4 CPR Utilities -; SETUD UCASE PROMPT READBUF BREAK -; SDELM ADDAH LDIR NUMBER NUMERR -; HEXNUM FCBLOG SLOGIN WHLCHK CMDSER -; -; 5 CPR-Resident Commands and Functions -; 5A DIR DIRPR PRFN DIRPTR GETSBIT -; 5B ERA -; 5C LIST -; 5D TYPE -; 5E SAVE AMBCHK EXTEST -; 5F REN -; 5G JUMP -; 5H GO -; 5I COMDIR COM CALLPROG -; 5J GET MLOAD DLOGIN PRNLE PATH -; MPATH STACK PWLIN -; - -; -; The following MACLIB statements load all the user-selected equates -; which are used to customize ZCPR3 for the user's working environment. -; - MACLIB Z3BASE - MACLIB Z3HDR -; -CTRLC EQU 03H -TAB EQU 09H -LF EQU 0AH -CR EQU 0DH -; -WBOOT EQU BASE+0000H ;CP/M WARM BOOT ADDRESS -UDFLAG EQU BASE+0004H ;USER NUM IN HIGH NYBBLE, DISK IN LOW -BDOS EQU BASE+0005H ;BDOS FUNCTION CALL ENTRY PT -TFCB EQU BASE+005CH ;DEFAULT FCB BUFFER -TFCB2 EQU TFCB+16 ;2ND FCB -TBUFF EQU BASE+0080H ;DEFAULT DISK I/O BUFFER -TPA EQU BASE+0100H ;BASE OF TPA -BIOS EQU CCP+0800H+0E00H ;BIOS Location -; -$-MACRO ;FIRST TURN OFF THE EXPANSIONS -; -; MACROS TO PROVIDE Z80 EXTENSIONS -; MACROS INCLUDE: -; -; JR - JUMP RELATIVE -; JRC - JUMP RELATIVE IF CARRY -; JRNC - JUMP RELATIVE IF NO CARRY -; JRZ - JUMP RELATIVE IF ZERO -; JRNZ - JUMP RELATIVE IF NO ZERO -; DJNZ - DECREMENT B AND JUMP RELATIVE IF NO ZERO -; PUTRG - SAVE REGISTERS -; GETRG - RESTORE REGISTERS -; -; @GENDD MACRO USED FOR CHECKING AND GENERATING -; 8-BIT JUMP RELATIVE DISPLACEMENTS -; -@GENDD MACRO ?DD ;;USED FOR CHECKING RANGE OF 8-BIT DISPLACEMENTS - IF (?DD GT 7FH) AND (?DD LT 0FF80H) - DB 100H,?DD ;Displacement Range Error - ELSE - DB ?DD - ENDIF ;;RANGE ERROR - ENDM -; -; -; Z80 MACRO EXTENSIONS -; -JR MACRO ?N ;;JUMP RELATIVE - IF I8080 ;;8080/8085 - JMP ?N - ELSE ;;Z80 - DB 18H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRC MACRO ?N ;;JUMP RELATIVE ON CARRY - IF I8080 ;;8080/8085 - JC ?N - ELSE ;;Z80 - DB 38H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRNC MACRO ?N ;;JUMP RELATIVE ON NO CARRY - IF I8080 ;;8080/8085 - JNC ?N - ELSE ;;Z80 - DB 30H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRZ MACRO ?N ;;JUMP RELATIVE ON ZERO - IF I8080 ;;8080/8085 - JZ ?N - ELSE ;;Z80 - DB 28H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -JRNZ MACRO ?N ;;JUMP RELATIVE ON NO ZERO - IF I8080 ;;8080/8085 - JNZ ?N - ELSE ;;Z80 - DB 20H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -DJNZ MACRO ?N ;;DECREMENT B AND JUMP RELATIVE ON NO ZERO - IF I8080 ;;8080/8085 - DCR B - JNZ ?N - ELSE ;;Z80 - DB 10H - @GENDD ?N-$-1 - ENDIF ;;I8080 - ENDM -; -PUTRG MACRO - PUSH H ;;SAVE REGISTERS IN ORDER - PUSH D - PUSH B - ENDM -; -GETRG MACRO - POP B ;;RESTORE REGISTERS IN ORDER - POP D - POP H - ENDM -; -; END OF Z80 MACRO EXTENSIONS -; -; -;**** Section 0 **** -; - ORG CPRLOC -; -; ENTRY POINTS INTO ZCPR3 -; -; IF MULTCMD (MULTIPLE COMMANDS ON ONE LINE) is FALSE: -; If ZCPR3 is entered at location CPRLOC (at the JMP to CPR), then -; the default command in CMDLIN will be processed. If ZCPR3 is entered -; at location CPRLOC+3 (at the JMP to CPR1), then the default command in -; CMDLIN will NOT be processed. -; NOTE: Entry into ZCPR3 at CPRLOC is permitted, but in order for this -; to work, CMDLIN MUST be initialized to contain the command line (ending in 0) -; and the C register MUST contain a valid User/Disk Flag -; (the most significant nybble contains the User Number and the least -; significant nybble contains the Disk Number). -; -; IF MULTCMD is TRUE: -; Entry at CPR or CPR1 has the same effect. Multiple command processing -; will still continue. -; -; If MULTCMD is FALSE, a user program need only load the buffer -; CMDLIN with the desired command line, terminated by a zero, in order to -; have this command line executed. If MULTCMD is TRUE, a user program must -; load this buffer as before, but he must also set the NXTCHR pointer to -; point to the first character of the command line. -; -; NOTE: ***** (BIG STAR) ***** Programs such as SYNONYM3 will fail if -; multiple commands are enabled, but this feature is so very useful that I -; feel it is worth the sacrifice. Some ZCPR3 utilities, like ALIAS and MENU, -; require multiple commands, and this feature also permits simple chaining -; of programs to be possible under the ZCPR3 environment. -; -; Enjoy using ZCPR3! -; Richard Conn -; -ENTRY: - JMP CPR ; Process potential default command - JMP CPR1 ; Do NOT process potential default command -; -;**** Section 1 **** -; BUFFERS ET AL -; -; **** 1. INPUT COMMAND LINE AND DEFAULT COMMAND -; - IF MULTCMD ;MULTIPLE COMMANDS ALLOWED? -; -; For Multiple Commands, the command line buffer (CMDLIN) is located external -; to ZCPR3 so that it is not overlayed during Warm Boots; the same is true -; for NXTCHR, the 2nd key buffer. BUFSIZ and CHRCNT are not important and -; are provided so the BDOS READLN function can load CMDLIN directly and -; a user program can see how much space is available in CMDLIN for its text. -; -NXTCHR EQU Z3CL ;NXTCHR STORED EXTERNALLY (2 bytes) -BUFSIZ EQU NXTCHR+2 ;BUFSIZ STORED EXTERNALLY (1 byte) -CHRCNT EQU BUFSIZ+1 ;CHRCNT STORED EXTERNALLY (1 byte) -CMDLIN EQU CHRCNT+1 ;CMDLIN STORED EXTERNALLY (long) -BUFLEN EQU Z3CLS ;LENGTH OF BUFFER -; - ELSE -; -; If no multiple commands are permitted, these buffers are left internal -; to ZCPR3 so that the original CCP command line facility (as used by -; programs like SYNONYM3) can be left intact. -; -BUFLEN EQU 80 ;MAXIMUM BUFFER LENGTH -BUFSIZ: - DB BUFLEN ;MAXIMUM BUFFER LENGTH -CHRCNT: - DB 0 ;NUMBER OF VALID CHARS IN COMMAND LINE -CMDLIN: - DB ' ' ;DEFAULT (COLD BOOT) COMMAND - DB 0 ;COMMAND STRING TERMINATOR - DS BUFLEN-($-CMDLIN)+1 ;TOTAL IS 'BUFLEN' BYTES -; -NXTCHR: - DW CMDLIN ;POINTER TO COMMAND INPUT BUFFER -; - ENDIF ;MULTCMD -; - -; -; **** 2. FILE TYPE FOR COMMAND -; -COMMSG: - COMTYP ;USE MACRO FROM Z3HDR.LIB -; - IF SUBON ;IF SUBMIT FACILITY ENABLED ... -; -; **** 3. SUBMIT FILE CONTROL BLOCK -; -SUBFCB: - DB 1 ;DISK NAME SET TO DEFAULT TO DRIVE A: - DB '$$$' ;FILE NAME - DB ' ' - SUBTYP ;USE MACRO FROM Z3HDR.LIB - DB 0 ;EXTENT NUMBER - DB 0 ;S1 -SUBFS2: - DS 1 ;S2 -SUBFRC: - DS 1 ;RECORD COUNT - DS 16 ;DISK GROUP MAP -SUBFCR: - DS 1 ;CURRENT RECORD NUMBER -; - ENDIF ;SUBON -; -; **** 4. COMMAND FILE CONTROL BLOCK -; - IF EXTFCB NE 0 ;MAY BE PLACED EXTERNAL TO ZCPR3 -; -FCBDN EQU EXTFCB ;DISK NAME -FCBFN EQU FCBDN+1 ;FILE NAME -FCBFT EQU FCBFN+8 ;FILE TYPE -FCBDM EQU FCBFT+7 ;DISK GROUP MAP -FCBCR EQU FCBDM+16 ;CURRENT RECORD NUMBER -; - ELSE ;OR INTERNAL TO ZCPR3 -; -FCBDN: - DS 1 ;DISK NAME -FCBFN: - DS 8 ;FILE NAME -FCBFT: - DS 3 ;FILE TYPE - DS 1 ;EXTENT NUMBER - DS 2 ;S1 AND S2 - DS 1 ;RECORD COUNT -FCBDM: - DS 16 ;DISK GROUP MAP -FCBCR: - DS 1 ;CURRENT RECORD NUMBER -; - ENDIF ;EXTFCB -; - -; -; **** 5. LINE COUNT BUFFER -; - IF LTON -PAGCNT: - DB NLINES-2 ;LINES LEFT ON PAGE - ENDIF ;LTON -; -; **** 6. RESIDENT COMMAND TABLE -; EACH TABLE ENTRY IS STRUCTURED AS FOLLOWS: -; DB 'NAME' ;NCHARS LONG -; DW ADDRESS ;ADDRESS OF COMMAND -; -CMDTBL: - DB NCHARS ;SIZE OF TEXT IN COMMAND TABLE - CTABLE ;DEFINE COMMAND TABLE VIA MACRO IN Z3HDR FILE - DB 0 ;END OF TABLE -; - -; -;**** Section 2 **** -; ZCPR3 STARTING POINTS -; -; START ZCPR3 AND DON'T PROCESS DEFAULT COMMAND STORED IF MULTIPLE COMMANDS -; ARE NOT ALLOWED -; -CPR1: -; - IF NOT MULTCMD ;IF MULTIPLE COMMANDS NOT ALLOWED -; - XRA A ;SET END OF COMMAND LINE SO NO DEFAULT COMMAND - STA CMDLIN ;FIRST CHAR OF BUFFER -; - ENDIF ;NOT MULTCMD -; -; START ZCPR3 AND POSSIBLY PROCESS DEFAULT COMMAND -; -; NOTE ON MODIFICATION BY Ron Fowler: BDOS RETURNS 0FFH IN -; ACCUMULATOR WHENEVER IT LOGS IN A DIRECTORY, IF ANY -; FILE NAME CONTAINS A '$' IN IT. THIS IS NOW USED AS -; A CLUE TO DETERMINE WHETHER OR NOT TO DO A SEARCH -; FOR SUBMIT FILE, IN ORDER TO ELIMINATE WASTEFUL SEARCHES. -; -CPR: - LXI SP,STACK ;RESET STACK -; - IF NOT MULTCMD ;ONLY ONE COMMAND PERMITTED - LXI H,CMDLIN ;SET PTR TO BEGINNING OF COMMAND LINE - SHLD NXTCHR - ENDIF ;NOT MULTCMD -; - PUSH B - MOV A,C ;C=USER/DISK NUMBER (SEE LOC 4) - RAR ;EXTRACT USER NUMBER - RAR - RAR - RAR - ANI 0FH - STA CURUSR ;SET USER - CALL SETUSR ;SET USER NUMBER - CALL RESET ;RESET DISK SYSTEM -; - IF SUBON ;IF SUBMIT FACILITY ENABLED -; - STA RNGSUB ;SAVE SUBMIT CLUE FROM DRIVE A: -; - ENDIF ;SUBON -; - POP B - MOV A,C ;C=USER/DISK NUMBER (SEE LOC 4) - ANI 0FH ;EXTRACT CURRENT DISK DRIVE - STA CURDR ;SET IT - CNZ LOGIN ;LOG IN DEFAULT DISK IF NOT ALREADY LOGGED IN - CALL SETUD ;SET USER/DISK FLAG - CALL DEFDMA ;SET DEFAULT DMA ADDRESS -; - IF SUBON ;CHECK FOR $$$.SUB IF SUBMIT FACILITY IS ON -; - LXI D,SUBFCB ;CHECK FOR $$$.SUB ON CURRENT DISK -RNGSUB EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;2ND BYTE (IMMEDIATE ARG) IS THE RNGSUB FLAG - ORA A ;SET FLAGS ON CLUE - CNZ SEAR1 - STA RNGSUB ;SET FLAG (0=NO $$$.SUB) -; - ENDIF ;SUBON -; - JR RS1 ;CHECK COMMAND LINE FOR CONTENT -; -; PROMPT USER AND INPUT COMMAND LINE FROM HIM -; -RESTRT: - LXI SP,STACK ;RESET STACK -; -; READ INPUT LINE FROM USER OR $$$.SUB -; -RS0: -; - IF Z3MSG NE 0 - XRA A ;SET NO OUTPUT MESSAGE - STA Z3MSG+3 ;ZCPR3 COMMAND STATUS - INR A ;SET ZCPR3 INPUT PROMPT - STA Z3MSG+7 ;ZEX MESSAGE BYTE - ENDIF ;Z3MSG NE 0 -; - LXI H,CMDLIN ;SET POINTER TO FIRST CHAR IN COMMAND LINE - SHLD NXTCHR ;POINTER TO NEXT CHARACTER TO PROCESS - MVI M,0 ;ZERO OUT COMMAND LINE IN CASE OF WARM BOOT - PUSH H ;SAVE PTR - CALL READBUF ;INPUT COMMAND LINE FROM USER (OR $$$.SUB) -; - IF Z3MSG NE 0 - XRA A ;NORMAL PROCESSING RESUMED - STA Z3MSG+7 ;ZEX MESSAGE BYTE - ENDIF -; - POP H ;GET PTR - MOV A,M ;CHECK FOR COMMENT LINE - CPI COMMENT ;BEGINS WITH COMMENT CHAR? - JRZ RS0 ;INPUT ANOTHER LINE IF SO -; -; PROCESS INPUT LINE; NXTCHR PTS TO FIRST LETTER OF COMMAND -; -RS1: - LXI SP,STACK ;RESET STACK -; -; RETURN TO CURRENT DIRECTORY AND POINT TO NEXT CHAR IN COMMAND LINE -; - CALL DLOGIN ;RETURN TO CURRENT DIRECTORY - LHLD NXTCHR ;PT TO FIRST CHAR OF NEXT COMMAND - PUSH H ;SAVE PTR -; -; CAPITALIZE COMMAND LINE -; -CAPBUF: - MOV A,M ;CAPITALIZE COMMAND CHAR - CALL UCASE - MOV M,A - INX H ;PT TO NEXT CHAR - ORA A ;EOL? - JRNZ CAPBUF - POP H ;GET PTR TO FIRST CHAR IN LINE -; -; SET POINTER FOR MULTIPLE COMMAND LINE PROCESSING TO FIRST CHAR OF NEW CMND -; -RS2: - CALL SKSP ;SKIP OVER SPACES - ORA A ;END OF LINE? - JRZ RESTRT - CPI CTRLC ;ABORT CHAR? - JRZ RESTRT -; - IF MULTCMD ;MULTIPLE COMMANDS ALLOWED? - MOV A,M ;GET FIRST CHAR OF COMMAND - CPI CMDSEP ;IS IT A COMMAND SEPARATOR? - JRNZ RS3 - INX H ;SKIP IT IF IT IS - JR RS2 - ENDIF ;MULTCMD -; -RS3: - SHLD NXTCHR ;SET PTR TO FIRST CHAR OF NEW COMMAND LINE - SHLD CURCMD ;SAVE PTR TO COMMAND LINE FOR ERROR RETURN -; -; PARSE COMMAND LINE PTED TO BY HL -; - CALL PARSER ;PARSE ENTIRE COMMAND LINE -; -; CHECK FOR SHELL INVOCATION AND RUN IT IF SO -; - IF Z3MSG NE 0 - LDA Z3MSG+3 ;GET COMMAND STATUS - CPI 1 ;SHELL? - JZ RS4 - ENDIF ;Z3MSG NE 0 -; -; IF IFON AND FCP AVAILABLE, TRY TO RUN FROM FCP -; - IF IFON AND (FCP NE 0) - LXI H,FCP+5 ;PT TO COMMAND TABLE - CALL CMDSCAN ;SCAN TABLE - JZ CALLP ;RUN IF FOUND (NO LEADING CRLF) - ENDIF ;IFON AND (FCP NE 0) -; -; IF IFON, THEN CHECK FOR RUNNING IF AND FLUSH COMMAND LINE IF ENABLED -; - IF IFON - LXI H,Z3MSG+1 ;PT TO IF BYTE - MOV A,M ;GET IT - ORA A ;SEE IF ANY IF - JRZ RS4 ;CONTINUE IF NOT - INX H ;PT TO IF ACTIVE BYTE - ANA M ;SEE IF CURRENT IF IS ACTIVE - JRZ RS1 ;SKIP IF NOT - ENDIF ;IFON -RS4: -; -; IF DIR: PREFIX, HANDLE AS COM FILE -; -COLON EQU $+1 ;FLAG FOR IN-THE-CODE MODIFICATION - MVI A,0 ;COMMAND OF THE FORM 'DIR:COMMAND'? - ORA A ;0=NO - JNZ COMDIR ;PROCESS AS COM FILE IF DIR: FORM -; -; CHECK FOR RESIDENT COMMAND -; - CALL CMDSER ;SCAN FOR CPR-RESIDENT COMMAND - JZ CALLP ;RUN CPR-RESIDENT COMMAND WITH NO LEADING CRLF -; -; CHECK FOR RESIDENT COMMAND PACKAGE -; - IF RCP NE 0 - LXI H,RCP+5 ;PT TO RCP COMMAND TABLE - CALL CMDSCAN ;CHECK FOR RCP - JZ CALLPROG - ENDIF -; -; PROCESS AS COM FILE -; - JMP COM ;PROCESS COM FILE - -; -; ERROR PROCESSOR -; -ERROR: -; - IF SUBON ;IF SUBMIT FACILITY IS ON -; - CALL SUBKIL ;TERMINATE ACTIVE $$$.SUB IF ANY -; - ENDIF ;SUBON -; - CALL CRLF ;NEW LINE -; - IF Z3MSG NE 0 ;MESSAGES ENABLED? -; - LDA Z3MSG+3 ;WAS ERROR CAUSED BY NO SHELL? - ANI 1 ;BIT 0 SAYS ZCPR3 TRIED TO RUN A SHELL - JRNZ ERRSH ;ABORT SHELL - LDA Z3MSG ;GET ERROR HANDLER MESSAGE - MOV B,A ;... IN B - ORA A ;FLUSH AND RESUME? - JRZ ERR0 - MVI A,2 ;SET ERROR FLAG - STA Z3MSG+3 ;IN SHELL STATUS BUFFER - LHLD CURCMD ;PT TO BEGINNING OF ERROR - SHLD Z3MSG+4 ;SAVE IN MESSAGE - LXI H,Z3MSG+10H ;PT TO COMMAND LINE - SHLD NXTCHR ;NEXT CHARACTER TO EXECUTE - JMP RS1 ;RUN CONTENTS OF BUFFER -; -; CLEAR SHELL STACK AND RESTART COMMAND PROCESSING -; -ERRSH: -; - IF SHSTK NE 0 ;IF SHELL STACK AVAILABLE - XRA A ;CLEAR SHELL STACK - STA SHSTK - ENDIF -; - JMP RESTRT ;RESTART PROCESSING -ERR0: -; - ENDIF ;Z3MSG NE 0 -; -CURCMD EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - LXI H,0 ;PT TO BEGINNING OF COMMAND LINE -ERR1: - MOV A,M ;GET CHAR - ORA A ;END OF LINE? - JRZ ERR2 - CALL CONOUT ;PRINT COMMAND CHAR - INX H ;PT TO NEXT CHAR - JR ERR1 ;CONTINUE -ERR2: - CALL PRINT ;PRINT '?' - DB '?'+80H -ERR3: - JMP RESTRT ;RESTART CPR - -; -; PARSE COMMAND LINE PTED TO BY HL -; RETURN WITH NZ IF ERROR IN COMMAND NAME -; -PARSER: -; -; INITIALIZE THE COMMAND AND TOKEN FCBS -; - LXI D,FCBDN ;PT TO COMMAND FCB - CALL INITFCB ;INIT IT - LXI D,TFCB ;PT TO TOKEN FCB - CALL INITFCB ;INIT IT -; -; EXTRACT COMMAND NAME -; - LXI D,FCBDN ;PLACE COMMAND NAME INTO COMMAND FCB - CALL SCANNER ;EXTRACT COMMAND NAME - JRNZ ERROR ;ERROR RETURN -; -; CHECK FOR ERROR IN COMMAND NAME (FILE TYPE GIVEN) -; - LXI D,FCBFT ;PT TO FILE TYPE - LDAX D ;GET FIRST CHAR OF FILE TYPE - CPI ' ' ;MUST BE BLANK, OR ERROR - JRNZ ERROR ;ERROR RETURN -; -; SET TYPE OF COMMAND -; - PUSH H ;SAVE PTR TO NEXT BYTE - LXI H,COMMSG ;PLACE DEFAULT FILE TYPE (COM) INTO FCB - MVI B,3 ;3 BYTES - CALL LDIR - POP H ;GET PTR TO NEXT BYTE -; -; SET DIR: PREFIX FLAG -; -MYCOLON EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;PREVIOUS TOKEN CONTAINED A COLON? - STA COLON -; -; SAVE POINTER TO COMMAND TAIL FOR LATER COPY INTO TBUFF AND FIND END OF -; COMMAND LINE; THIS IS ALSO THE ENTRY POINT FOR CMDRUN FACILITY TO -; PARSE THE ENTIRE COMMAND LINE AS A TAIL -; -PARSET: - SHLD TAILSV ;SAVE PTR TO COMMAND TAIL - PUSH H ;SAVE PTR -CTAIL: - MOV A,M ;GET CHAR - CALL TSTEOL ;AT EOL? - JRZ CTAIL1 - INX H ;PT TO NEXT - JR CTAIL -CTAIL1: - SHLD NXTCHR ;SAVE PTR TO NEXT LINE - POP H ;GET PTR TO COMMAND TAIL -; -; EXTRACT FIRST TOKEN -; - CALL SKSP ;SKIP OVER SPACES - RZ ;DONE IF EOL OR END OF COMMAND - LXI D,TFCB ;STORE FIRST TOKEN IN TFCB - CALL SCANNER ;EXTRACT TOKEN -; -; EXTRACT SECOND TOKEN -; - CALL SKSP ;SKIP OVER SPACES - RZ ;DONE IF EOL OR END OF COMMAND - LXI D,TFCB+16 ;PT TO 2ND FCB AND FALL THRU TO SCANNER -; -; EXTRACT TOKEN FROM COMMAND LINE AND PLACE IT INTO FCB PTED TO BY DE -; FORMAT FCBDN FCB IF TOKEN RESEMBLES FILE NAME AND TYPE (FILENAME.TYP) -; ON INPUT, HL PTS TO NEXT CHAR AND DE PTS TO FCB -; ON OUTPUT, HL PTS TO DELIMITER AFTER TOKEN AND ZERO FLAG IS RESET -; IF '?' IS IN TOKEN -; -; ENTRY POINTS: -; SCANNER - LOAD TOKEN INTO FCB PTED TO BY DE -; -SCANNER: - XRA A ;A=0 - STAX D ;SET DEFAULT DRIVE - STA MYCOLON ;SET NO COLON - STA TEMPDR ;SET TEMPORARY DRIVE NUMBER TO DEFAULT - STA QMCNT ;ZERO QUESTION MARK COUNTER - LDA CURUSR ;GET CURRENT USER - STA TEMPUSR ;SET TEMPUSR - PUSH D ;SAVE PTR TO FIRST BYTE OF FCB - MVI B,8 ;8 CHARS MAX - CALL SCANF ;PLACE FIRST TOKEN INTO FILE NAME FIELD - POP D ;GET PTR TO FIRST BYTE OF FCB - MOV A,M ;GET TERMINATING CHAR - STA ENDCHAR ;SET ENDING CHAR - CPI ':' ;COLON? - JRNZ SCAN1 ;NO, WE HAVE A FILE NAME - STA MYCOLON ;SET COLON - INX H ;PT TO CHAR AFTER COLON -; -; SCAN TOKEN FOR DIR: FORM, WHICH MEANS WE HAVE A USER/DISK SPECIFICATION -; HL PTS TO CHAR AFTER COLON -; - IF (Z3NDIR NE 0) AND NDINCP ;NAMED DIRS AVAILABLE -; - IF DUFIRST ;DU: BEFORE DIR: -; -; CHECK FOR DU: FORM -; - IF ACCPTDU ;PERMIT DU: FORM - PUSH D ;SAVE PTR TO FCB DN - PUSH H ;SAVE PTR TO NEXT CHAR IN LINE - CALL DUSCAN ;CHECK FOR DU: FORM - POP H ;GET PTR TO NEXT CHAR - POP D ;GET PTR TO FCB - JRZ SUD1 ;GOT IT - ENDIF ;ACCPTDU -; -; CHECK FOR DIR: FORM -; - IF ACCPTND ;PERMIT DIR: FORM - PUSH D ;SAVE PTR TO FCB - PUSH H ;SAVE PTR TO NEXT CHAR - CALL DIRSCAN ;CHECK FOR DIR: FORM - POP H ;GET PTR TO NEXT CHAR - POP D ;GET PTR TO FCB - JRNZ SCAN1 ;ERROR IN PREFIX - ENDIF ;ACCPTND -SUD1: -; - ELSE ;DIR: BEFORE DU: -; -; CHECK FOR DIR: FORM -; - IF ACCPTND ;PERMIT DIR: FORM - PUSH D ;SAVE PTR TO FCB - PUSH H ;SAVE PTR TO NEXT CHAR - CALL DIRSCAN ;CHECK FOR DIR: FORM - POP H ;GET PTR TO NEXT CHAR - POP D ;GET PTR TO FCB - JRZ SUD1 ;GOT IT - ENDIF ;ACCPTND -; -; CHECK FOR DU: FORM -; - IF ACCPTDU ;PERMIT DU: FORM - PUSH D ;SAVE PTR TO FCB DN - PUSH H ;SAVE PTR TO NEXT CHAR IN LINE - CALL DUSCAN ;CHECK FOR DU: FORM - POP H ;GET PTR TO NEXT CHAR - POP D ;GET PTR TO FCB - JRNZ SCAN1 ;ERROR IN PREFIX - ENDIF ;ACCPTDU -SUD1: -; - ENDIF ;DUFIRST -; - ELSE ;DU ONLY -; -; CHECK FOR DU: FORM -; - IF ACCPTDU ;ALLOW DU: FORM - PUSH D ;SAVE PTR TO FCB DN - PUSH H ;SAVE PTR TO NEXT CHAR IN LINE - CALL DUSCAN ;CHECK FOR DU: FORM - POP H ;GET PTR TO NEXT CHAR - POP D ;GET PTR TO FCB - JRNZ SCAN1 ;ERROR IN PREFIX - ENDIF ;ACCPTDU -; - ENDIF ;(Z3NDIR NE 0) AND NDINCP -; -; SET DRIVE REFERENCED -; - LDA TEMPDR ;SET DRIVE - STAX D ;... IN FCB -; -; REINIT FCB PTED TO BY DE -; - PUSH D ;SAVE PTR - INX D ;PT TO FN FIELD - CALL IFCB ;ONLY PARTIAL INIT (17 BYTES TOTAL) - POP D -; -; EXTRACT FILENAME FIELD -; - XRA A - STA QMCNT ;ZERO QUESTION MARK COUNTER - PUSH D ;SAVE PTR TO FIRST BYTE OF FCB - MVI B,8 ;8 CHARS MAX - CALL SCANF ;STORE FILE NAME - POP D ;GET PTR TO FIRST BYTE OF FCB - MOV A,M ;GET OFFENDING CHAR - STA ENDCHAR ;SET ENDING CHAR -; -; SKIP TO FILE TYPE FIELD -; HL PTS TO NEXT CHAR, DE PTS TO DN FIELD OF FCB -; -SCAN1: -ENDCHAR EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;GET ENDING CHAR - XCHG - LXI B,8 ;PT TO BEFORE FILE TYPE FIELD OF FCB - DAD B - XCHG -; -; EXTRACT FILETYPE FIELD -; - MVI B,3 ;PREPARE TO EXTRACT FILE TYPE - CPI '.' ;IF '.', WE HAVE A TYPE - JRNZ SCAN2 - INX H ;PT TO CHAR AFTER '.' - PUSH D - CALL SCANF ;GET FCB FILE TYPE - POP D -SCAN2: -; -; SET USER NUMBER REFERENCED -; HL PTS TO NEXT CHAR, DE PTS TO BEFORE FCB FT -; - XCHG - LXI B,5 ;PT TO S1 FIELD - DAD B - XCHG - LDA TEMPUSR ;STORE USER NUMBER HERE - STAX D -; -; SKIP TO SPACE, CHAR AFTER =, OR EOL -; HL PTS TO NEXT CHAR IN LINE -; -SCAN3: - MOV A,M ;GET NEXT CHAR - CPI ' '+1 ;DONE IF LESS THAN SPACE - JRC SCAN4 - CALL TSTEOL ;EOL? - JRZ SCAN4 - INX H ;PT TO NEXT - CPI '=' ;EQUATE? - JRNZ SCAN3 -SCAN4: -; -; SET ZERO FLAG TO INDICATE PRESENCE OF '?' IN DIR:FILENAME.TYP -; -QMCNT EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;NUMBER OF QUESTION MARKS - ORA A ;SET ZERO FLAG - RET -; -; SCANF -- SCAN TOKEN PTED TO BY HL FOR A MAX OF B BYTES; PLACE IT INTO -; FILE NAME FIELD PTED TO BY DE; EXPAND AND INTERPRET WILD CARDS OF -; '*' AND '?'; ON EXIT, DE PTS TO TERMINATING DELIMITER -; -SCANF: - CALL SDELM ;DONE IF DELIMITER ENCOUNTERED - RZ - INX D ;PT TO NEXT BYTE IN FCB - CPI '*' ;IS (DE) A WILD CARD? - JRNZ SCANF1 ;CONTINUE IF NOT - MVI A,'?' ;PLACE '?' IN FCB AND DON'T ADVANCE HL IF SO - STAX D - CALL SCQ ;SCANNER COUNT QUESTION MARKS - JR SCANF2 -SCANF1: - STAX D ;STORE FILENAME CHAR IN FCB - INX H ;PT TO NEXT CHAR IN COMMAND LINE - CPI '?' ;CHECK FOR QUESTION MARK (WILD) - CZ SCQ ;SCANNER COUNT QUESTION MARKS -SCANF2: - DJNZ SCANF ;DECREMENT CHAR COUNT UNTIL 8 ELAPSED -SCANF3: - CALL SDELM ;8 CHARS OR MORE - SKIP UNTIL DELIMITER - RZ ;ZERO FLAG SET IF DELIMITER FOUND - INX H ;PT TO NEXT CHAR IN COMMAND LINE - JR SCANF3 -; -; INCREMENT QUESTION MARK COUNT FOR SCANNER -; THIS ROUTINE INCREMENTS THE COUNT OF THE NUMBER OF QUESTION MARKS IN -; THE CURRENT FCB ENTRY -; -SCQ: - PUSH H ;SAVE HL - LXI H,QMCNT ;GET COUNT - INR M ;INCREMENT - POP H ;GET HL - RET -; -; SCAN FOR AND EXTRACT DISK/USER INFO ASSUMING DU: FORM -; ON ENTRY, DE PTS TO FIRST BYTE OF FCB CONTAINING POSSIBLE DU FORM -; ON EXIT, ZERO FLAG SET MEAN OK AND TEMPDR AND TEMPUSR SET -; - IF ACCPTDU ;ALLOW DU: FORM -DUSCAN: - XCHG ;PTR IN HL - INX H ;PT TO FIRST BYTE OF FN - MOV A,M ;GET FIRST CHAR - CPI 'A' ;CONVERT POSSIBLE DRIVE SPEC TO NUMBER - JRC DUS1 ;IF LESS THAN 'A', MUST BE DIGIT -; -; SET DISK NUMBER (A=1) -; - SUI 'A'-1 ;CONVERT DRIVE NUMBER TO 1-16 - CPI MAXDISK+1 ;WITHIN RANGE? - JRNC DUSE1 ;INVALID DISK NUMBER - STA TEMPDR ;SET TEMPORARY DRIVE NUMBER - INX H ;PT TO NEXT CHAR - MOV A,M ;SEE IF IT IS A SPACE - CPI ' ' - RZ - CALL DIGCK ;CHECK FOR DIGIT - RC -; -; SET USER NUMBER -; -DUS1: - PUSH H ;SAVE PTR TO DIGITS - MVI B,2 ;UP TO 2 DIGITS -DUS1A: - MOV A,M ;CHECK FOR DIGIT OR SPACE - CPI ' ' ;IF SPACE, THEN NO DIGIT - JRZ DUS2 - CALL DIGCK ;CHECK FOR DIGIT - JRC DUSE - INX H - DJNZ DUS1A ;COUNT DOWN - MOV A,M ;3RD CHAR - CPI ' ' ;MUST BE SPACE - JRNZ DUSE -DUS2: - POP H - CALL NUM0A ;GET NUMBER - CPI MAXUSR+1 ;WITHIN LIMIT? - JRNC DUSE1 - STA TEMPUSR ;SAVE USER NUMBER - XRA A ;SET OK - RET -DUSE: - POP H ;CLEAR STACK -DUSE1: - XRA A - DCR A - RET -; - ENDIF ;ACCPTDU -; - IF (Z3NDIR NE 0) AND NDINCP AND ACCPTND -; -; SCAN FOR DIR FORM -; ON ENTRY, DE PTS TO FCB CONTAINING NAME TO CHECK FOR -; ON EXIT, IF FOUND, Z AND TEMPUSR AND TEMPDR SET -; -DIRSCAN: - XCHG ;PTR IN HL - INX H ;PT TO FN - LXI D,Z3NDIR ;PT TO FIRST ENTRY IN MEMORY-BASED DIR -DIRS1: - LDAX D ;GET NEXT CHAR - ORA A ;ZERO IF END OF DIR - JRZ DIRSERR - INX D ;PT TO DIR NAME - INX D - PUSH H ;SAVE PTR TO FILE NAME - PUSH D ;SAVE PTR TO DIR ENTRY - MVI B,8 ;MATCH? -DIRS2: - LDAX D ;GET BYTE - CMP M ;COMPARE - JRNZ DIRS3 - INX H ;PT TO NEXT - INX D - DJNZ DIRS2 ;COUNT DOWN -DIRS3: - POP D ;RESTORE REGS - POP H - JRZ DIRS4 - XCHG ;ADVANCE TO NEXT ENTRY - LXI B,16 ;8 BYTES FOR NAME + 8 BYTES FOR PASSWORD - DAD B - XCHG - JR DIRS1 -; -; NO DIR match -; -DIRSERR: - XRA A ;RETURN NZ - DCR A - RET -; -; DIR match -; -DIRS4: -; - IF PWCHECK - PUSH D ;SAVE PTR TO DE - LXI B,8 ;PT TO PW - XCHG ;HL PTS TO ENTRY - DAD B - CALL PASSCK ;CHECK FOR PW - POP D ;GET PTR - JNZ DIRSERR - ENDIF ;PWCHECK -; - DCX D ;PT TO USER - LDAX D ;GET USER - STA TEMPUSR - DCX D ;PT TO DISK - LDAX D ;GET IT - STA TEMPDR ;A=1 - XRA A ;SET Z - RET -; - ENDIF ;(Z3NDIR NE 0) AND NDINCP AND ACCPTND -; - IF PWCHECK -; -; CHECK FOR PASSWORD PTED TO BY HL -; RETURN WITH ZERO FLAG SET IF MATCH -; -PASSCK: - MOV A,M ;CHECK FOR NO PW - CPI ' ' - RZ - PUSH H ;SAVE PTR - CALL PRINT - DB CR,LF,'PW?',' '+80H - LXI D,PWLIN - MVI A,9 ;SET CHAR COUNT - STAX D - MVI C,10 ;BDOS READLN - PUSH D - CALL BDOS - POP H ;GET PTR TO BUFFER - INX H ;PT TO CHAR COUNT - MOV A,M ;GET CHAR COUNT - INX H ;PT TO FIRST CHAR - PUSH H ;SAVE PTR - CALL ADDAH ;HL PTS TO AFTER LAST CHAR - MVI M,' ' ;PLACE SPACE - POP D ;PT TO USER INPUT - POP H ;PT TO PASSWORD - MVI B,8 ;8 CHARS MAX -PWCK: - LDAX D ;GET NEXT CHAR - CALL UCASE ;CAPITALIZE USER INPUT - CMP M ;COMPARE FOR MATCH - RNZ ;NO MATCH - CPI ' ' ;DONE? - RZ - INX H ;PT TO NEXT - INX D - DJNZ PWCK - XRA A ;SET ZERO FLAG - RET -; - ENDIF ;PWCHECK - -; -; SKIP OVER SPACES PTED TO BY HL -; ON RETURN, ZERO FLAG SET MEANS WE HIT EOL OR CMDSEP -; -SKSP: - MOV A,M ;GET NEXT CHAR - INX H ;PT TO NEXT - CPI ' ' ;SPACE? - JRZ SKSP - DCX H ;PT TO NON-SPACE -; -; CHECK TO SEE IF CHAR IN A IS EOL OR CMDSEP -; -TSTEOL: - ORA A ;EOL? -; - IF MULTCMD ;MULTIPLE COMMANDS SUPPORTED? - RZ ;RETURN WITH FLAG - CPI CMDSEP ;COMMAND SEPARATOR? - ENDIF ;MULTCMD -; - RET - -; -; INIT FCB PTED TO BY DE -; -INITFCB: - XRA A - STAX D ;SET DEFAULT DISK (DN BYTE IS 0) - INX D ;PT TO FILE NAME FIELD - CALL IFCB ;FILL 1ST PART OF FCB; FALL THRU TO IFCB TO RUN AGAIN -; -; FILL FN, FT, EX, S1, S2, RC, AND FOLLOWING CR (OR DN) FIELDS -; -IFCB: - MVI B,11 ;STORE 11 SPACES - MVI A,' ' - CALL FILL - XRA A - STAX D ;SET EX TO ZERO - INX D - LDA CURUSR - STAX D ;SET S1 TO CURRENT USER - INX D - MVI B,3 ;STORE 3 ZEROES - XRA A ;FALL THRU TO FILL -; -; FILL MEMORY POINTED TO BY DE WITH CHAR IN A FOR B BYTES -; -FILL: - STAX D ;FILL WITH BYTE IN A - INX D ;PT TO NEXT - DJNZ FILL - RET -; -; No File Error Message -; -PRNNF: - CALL PRINTC ;NO FILE MESSAGE - DB 'No Fil','e'+80H - RET -; -;**** Section 3 **** -; I/O UTILITIES -; -; OUTPUT CHAR IN REG A TO CONSOLE AND DON'T CHANGE BC -; -CONIN: - MVI C,1 ;INPUT CHAR - CALL BDOS ;GET INPUT CHAR WITH ^S PROCESSING AND ECHO - JMP UCASE ;CAPITALIZE -; -; OUTPUT -; -CRLF: - MVI A,CR - CALL CONOUT - MVI A,LF ;FALL THRU TO CONOUT -; -CONOUT: - PUTRG ;SAVE REGS - MVI C,2 -OUTPUT: - MOV E,A - CALL BDOS - GETRG ;GET REGS - RET -; -LCOUT: - PUSH PSW ;OUTPUT CHAR TO CON: OR LST: DEP ON PRFLG -PRFLG EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;2ND BYTE (IMMEDIATE ARG) IS THE PRINT FLAG - ORA A ;0=TYPE - JRZ LC1 - POP PSW ;GET CHAR -; -; OUTPUT CHAR IN REG A TO LIST DEVICE -; -LSTOUT: - PUTRG ;SAVE REGISTERS - MVI C,5 - JR OUTPUT -LC1: - POP PSW ;GET CHAR - PUSH PSW - CALL CONOUT ;OUTPUT TO CON: - POP PSW -; - IF LTON - CPI LF ;CHECK FOR PAGING - RNZ -; -; PAGING ROUTINES -; PAGER COUNTS DOWN LINES AND PAUSES FOR INPUT (DIRECT) IF COUNT EXPIRES -; PAGSET SETS LINES/PAGE COUNT -; -PAGER: - PUSH H - LXI H,PAGCNT ;COUNT DOWN - DCR M - JRNZ PAGER1 ;JUMP IF NOT END OF PAGE - MVI M,NLINES-2 ;REFILL COUNTER -; -PGFLG EQU $+1 ;POINTER TO IN-THE-CODE BUFFER PGFLG - MVI A,0 ;0 MAY BE CHANGED BY PGFLG EQUATE - CPI PGDFLG ;PAGE DEFAULT OVERRIDE OPTION WANTED? -; - IF PGDFLT ;IF PAGING IS DEFAULT - JRZ PAGER1 ; PGDFLG MEANS NO PAGING - ELSE ;IF PAGING NOT DEFAULT - JRNZ PAGER1 ; PGDFLG MEANS PLEASE PAGINATE -; - ENDIF ;PGDFLG -; - PUSH B ;SAVE REG - CALL BIOS+9 ;BIOS CONSOLE INPUT ROUTINE - POP B ;GET REG - CPI 'C'-'@' ;^C - JZ RS1 ;RESTART CPR -PAGER1: - POP H ;RESTORE HL - - ENDIF ;LTON -; - RET ;RETURN FOR LC1 IF NOT LTON -; -; READ FILE BLOCK FUNCTION -; -READF: - LXI D,TFCB ;FALL THRU TO READ -READ: - MVI C,14H ;FALL THRU TO BDOSB -; -; CALL BDOS AND SAVE BC -; -BDOSB: - PUSH B - CALL BDOS - POP B - ORA A -; -; THIS RETURN IS FOR BDOSB AND FOR THE NULL FUNCTION CALLED NOTE -; -NOTE: - RET -; -; PRINT STRING (ENDING IN CHAR WITH MSB SET) PTED TO BY RET ADR -; START WITH -; -PRINTC: - CALL CRLF ;NEW LINE -; -PRINT: - XTHL ;GET PTR TO STRING - CALL PRIN1 ;PRINT STRING - XTHL ;RESTORE HL AND RET ADR - RET -; -; PRINT STRING (ENDING IN 0 OR BYTE WITH MSB SET) PTED TO BY HL -; -PRIN1: - MOV A,M ;GET NEXT BYTE - INX H ;PT TO NEXT BYTE - ORA A ;END OF STRING? - RZ ;STRING TERMINATED BY BINARY 0 - PUSH PSW ;SAVE FLAGS - ANI 7FH ;MASK OUT MSB - CALL CONOUT ;PRINT CHAR - POP PSW ;GET FLAGS - RM ;STRING TERMINATED BY MSB SET - JR PRIN1 -; -; BDOS FUNCTION ROUTINES -; -; -; RETURN NUMBER OF CURRENT DISK IN A -; -GETDRV: - MVI C,19H - JR BDOSJP -; -; SET 80H AS DMA ADDRESS -; -DEFDMA: - LXI D,TBUFF ;80H=TBUFF -DMASET: - MVI C,1AH - JR BDOSJP -; -RESET: - MVI C,0DH -BDOSJP: - JMP BDOS -; -LOGIN: - MOV E,A - MVI C,0EH - JR BDOSJP ;SAVE SOME CODE SPACE -; -OPENF: - XRA A - STA FCBCR - LXI D,FCBDN ;FALL THRU TO OPEN -; -OPEN: - MVI C,0FH ;FALL THRU TO GRBDOS -; -GRBDOS: - CALL BDOS - INR A ;SET ZERO FLAG FOR ERROR RETURN - RET -; -CLOSE: - MVI C,10H - JR GRBDOS -; -SEARF: - LXI D,TFCB ;SPECIFY FCB -SEAR1: - MVI C,11H - JR GRBDOS -; -SEARN: - MVI C,12H - JR GRBDOS -; -; CHECK FOR SUBMIT FILE IN EXECUTION AND ABORT IT IF SO -; - IF SUBON ;ENABLE ONLY IF SUBMIT FACILITY IS ENABLED -; -SUBKIL: - LXI H,RNGSUB ;CHECK FOR SUBMIT FILE IN EXECUTION - MOV A,M - ORA A ;0=NO - RZ - MVI M,0 ;ABORT SUBMIT FILE - LXI D,SUBFCB ;DELETE $$$.SUB -; - ENDIF ;SUBON -; -DELETE: - MVI C,13H - JR BDOSJP ;SAVE MORE SPACE -; -; GET/SET USER NUMBER -; -GETUSR: - MVI A,0FFH ;GET CURRENT USER NUMBER -SETUSR: - MOV E,A ;USER NUMBER IN E - MVI C,20H ;SET USER NUMBER TO VALUE IN E (GET IF E=FFH) - JR BDOSJP ;MORE SPACE SAVING -; -; END OF BDOS FUNCTIONS -; -; -;**** Section 4 **** -; ZCPR3 UTILITIES -; -; SET USER/DISK FLAG TO CURRENT USER AND DEFAULT DISK -; -SETUD: - CALL GETUSR ;GET NUMBER OF CURRENT USER - ANI 0FH ;MASK SURE 4 BITS - ADD A ;PLACE IT IN HIGH NYBBLE - ADD A - ADD A - ADD A - LXI H,CURDR ;MASK IN CURRENT DRIVE NUMBER (LOW NYBBLE) - ORA M ;MASK IN - STA UDFLAG ;SET USER/DISK NUMBER - RET -; -; CONVERT CHAR IN A TO UPPER CASE -; -UCASE: - ANI 7FH ;MASK OUT MSB - CPI 61H ;LOWER-CASE A - RC - CPI 7BH ;GREATER THAN LOWER-CASE Z? - RNC - ANI 5FH ;CAPITALIZE - RET -; -; PRINT DU (DIR) PROMPT -; -PROMPT: -; -; PRINT PROMPT (DU>) -; - CALL CRLF ;PRINT PROMPT -; - IF INCLDU ;IF DRIVE IN PROMPT - LDA CURDR ;CURRENT DRIVE IS PART OF PROMPT - ADI 'A' ;CONVERT TO ASCII A-P - CALL CONOUT - LDA CURUSR ;GET USER NUMBER -; - IF SUPRES ;IF SUPPRESSING USR # REPORT FOR USR 0 - ORA A - JRZ PRMPT2 - ENDIF ;SUPRES -; - CPI 10 ;USER < 10? - JRC PRMPT1 - SUI 10 ;SUBTRACT 10 FROM IT - PUSH PSW ;SAVE IT - MVI A,'1' ;OUTPUT 10'S DIGIT - CALL CONOUT - POP PSW -PRMPT1: - ADI '0' ;OUTPUT 1'S DIGIT (CONVERT TO ASCII) - CALL CONOUT -PRMPT2: - ENDIF ;INCLDU -; -; PRINT NDIR ENTRY IF ANY -; - IF INCLNDR AND (Z3NDIR NE 0) -; - LDA CURDR ;GET CURRENT DU IN BC - INR A - MOV B,A - LDA CURUSR - MOV C,A - LXI H,Z3NDIR ;SCAN DIRECTORY FOR MATCH -; -; MAIN LOOP FOR SCANNING NDR FOR DU IN BC -; -PRMPT3: - MOV A,M ;END OF NDR? - ORA A - RZ - INX H ;PT TO USER - CMP B ;COMPARE DISK - JRNZ PRMPT5 - MOV A,M ;COMPARE USER - CMP C - JRNZ PRMPT5 -; -; MATCH OF DU -; - IF INCLDU ;SEPARATE DU AND NDR WITH COLON - MVI A,':' ;PRINT SEPARATOR - CALL CONOUT - ENDIF ;INCLDU -; - MVI B,8 ;8 CHARS MAX -PRMPT4: - INX H ;PT TO NEXT CHAR - MOV A,M ;GET NEXT CHAR - CPI ' ' ;DONE IF SPACE - RZ - CALL CONOUT ;PRINT CHAR - DJNZ PRMPT4 ;COUNT DOWN - RET -; -; ADVANCE TO NEXT DU -; -PRMPT5: - LXI D,16+1 ;SKIP USER (1 BYTE) AND NAME/PW (16 BYTES) - DAD D - JR PRMPT3 ;CONTINUE SCAN -; - ENDIF ;INCLNDR AND (Z3NDIR NE 0) -; - RET -; -; INPUT NEXT COMMAND TO CPR -; This routine determines if a SUBMIT file is being processed -; and extracts the command line from it if so or from the user's console -; -READBUF: -; - IF SUBON ;IF SUBMIT FACILITY IS ENABLED, CHECK FOR IT -; - LDA RNGSUB ;SUBMIT FILE CURRENTLY IN EXECUTION? - ORA A ;0=NO - JRZ RB1 ;GET LINE FROM CONSOLE IF NOT - LXI D,SUBFCB ;OPEN $$$.SUB - PUSH D ;SAVE DE - CALL OPEN - POP D ;RESTORE DE - JRZ RB1 ;ERASE $$$.SUB IF END OF FILE AND GET CMND - LDA SUBFRC ;GET VALUE OF LAST RECORD IN FILE - DCR A ;PT TO NEXT TO LAST RECORD - STA SUBFCR ;SAVE NEW VALUE OF LAST RECORD IN $$$.SUB - CALL READ ;DE=SUBFCB - JRNZ RB1 ;ABORT $$$.SUB IF ERROR IN READING LAST REC - LXI D,CHRCNT ;COPY LAST RECORD (NEXT SUBMIT CMND) TO CHRCNT - LXI H,TBUFF ; FROM TBUFF - MVI B,BUFLEN ;NUMBER OF BYTES - CALL LDIR - LXI H,SUBFS2 ;PT TO S2 OF $$$.SUB FCB - MVI M,0 ;SET S2 TO ZERO - INX H ;PT TO RECORD COUNT - DCR M ;DECREMENT RECORD COUNT OF $$$.SUB - LXI D,SUBFCB ;CLOSE $$$.SUB - CALL CLOSE - JRZ RB1 ;ABORT $$$.SUB IF ERROR - CALL PROMPT ;PRINT PROMPT - MVI A,SPRMPT ;PRINT SUBMIT PROMPT TRAILER - CALL CONOUT - LXI H,CMDLIN ;PRINT COMMAND LINE FROM $$$.SUB - CALL PRIN1 - CALL BREAK ;CHECK FOR ABORT (ANY CHAR) - RNZ ;IF NO ^C, RETURN TO CALLER AND RUN - CALL SUBKIL ;KILL $$$.SUB IF ABORT - JMP RESTRT ;RESTART CPR -; -; INPUT COMMAND LINE FROM USER CONSOLE -; -RB1: - CALL SUBKIL ;ERASE $$$.SUB IF PRESENT -; - ENDIF ;SUBON -; -; IF SHELL STACKS ARE IMPLEMENTED, CHECK FOR CONTENT AT THIS TIME -; - IF SHSTK NE 0 -; - LXI H,SHSTK ;PT TO STACK - MOV A,M ;CHECK FIRST BYTE - CPI ' '+1 ;SEE IF ANY ENTRY - JRC RB2 ;GET USER INPUT IF NONE -; - ENDIF ;SHSTK NE 0 -; - IF (SHSTK NE 0) OR (Z3MSG NE 0) -; -RUNBUF: - LXI D,CMDLIN ;PT TO FIRST CHAR OF COMMAND LINE - MVI B,SHSIZE ;COPY SHELL LINE INTO COMMAND LINE BUFFER - CALL LDIR ;DO COPY - XCHG ;HL PTS TO END OF LINE - MVI A,1 ;SAY SHELL WAS INVOKED - STA Z3MSG+3 ;Z3 OUTPUT MESSAGE - JR RB3 ;STORE ENDING ZERO AND EXIT -RB2: -; - ENDIF ;(SHSTK NE 0) OR (Z3MSG NE 0) -; - CALL PROMPT ;PRINT PROMPT - MVI A,CPRMPT ;PRINT PROMPT TRAILER - CALL CONOUT - MVI C,0AH ;READ COMMAND LINE FROM USER - LXI D,BUFSIZ ;PT TO BUFFER SIZE BYTE OF COMMAND LINE - CALL BDOS -; -; STORE ZERO AT END OF COMMAND LINE -; - LXI H,CHRCNT ;PT TO CHAR COUNT - MOV A,M ;GET CHAR COUNT - INX H ;PT TO FIRST CHAR OF COMMAND LINE - CALL ADDAH ;PT TO AFTER LAST CHAR OF COMMAND LINE -RB3: - MVI M,0 ;STORE ENDING ZERO - RET -; -; CHECK FOR ANY CHAR FROM USER CONSOLE; RET W/ZERO SET IF NONE -; -BREAK: - PUTRG ;SAVE REGISTERS - CALL BIOS+6 ;CONSOLE STATUS CHECK - ORA A ;SET FLAGS - CNZ BIOS+9 ;GET INPUT CHAR WITH ^S PROCESSING - CPI 'S'-'@' ;PAUSE IF ^S - CZ BIOS+9 ;GET NEXT CHAR - GETRG ;RESTORE REGISTERS - CPI 'C'-'@' ;CHECK FOR ABORT - RET - -; -; CHECK TO SEE IF HL PTS TO DELIMITER; IF SO, RET W/ZERO FLAG SET -; -SDELM: - MOV A,M ;GET NEXT CHAR FROM LINE - CPI ' '+1 ;DELIM IF <= - JRC ZERO - CPI '=' ;'='=DELIMITER - RZ - CPI 5FH ;UNDERSCORE=DELIMITER - RZ - CPI '.' ;'.'=DELIMITER - RZ - CPI ':' ;':'=DELIMITER - RZ - CPI ',' ;','=DELIMITER - RZ -; - IF CMDSEP NE ';' - CPI ';' ;';'=DELIMITER - RZ - ENDIF -; - CPI '<' ;'<'=DELIMITER - RZ - CPI '>' ;'>'=DELIMITER - RZ - JMP TSTEOL ;CHECK FOR EOL -ZERO: - XRA A ;SET ZERO FLAG - RET -; -; ADD A TO HL (HL=HL+A) -; -ADDAH: - ADD L - MOV L,A - RNC - INR H - RET -; -; COPY FROM HL TO DE FOR B BYTES -; -LDIR: - MOV A,M ;GET BYTE - STAX D ;PUT BYTE - INX H ;PT TO NEXT - INX D - DJNZ LDIR - RET -; -; EXTRACT DECIMAL NUMBER FROM COMMAND LINE -; RETURN WITH VALUE IN REG A; ALL REGISTERS MAY BE AFFECTED -; -NUMBER: - LXI H,TFCB+8 ;PT TO END OF TOKEN FOR CONVERSION - MVI B,8 ;8 CHARS MAX -; -; CHECK FOR SUFFIX FOR HEXADECIMAL NUMBER -; -NUMS: - MOV A,M ;GET CHARS FROM END, SEARCHING FOR SUFFIX - DCX H ;BACK UP - CPI ' ' ;SPACE? - JRNZ NUMS1 ;CHECK FOR SUFFIX - DJNZ NUMS ;COUNT DOWN - JR NUM0 ;BY DEFAULT, PROCESS -NUMS1: - CPI NUMBASE ;CHECK AGAINST BASE SWITCH FLAG - JRZ HEXNUM -; -; PROCESS DECIMAL NUMBER -; -NUM0: - LXI H,TFCB+1 ;PT TO BEGINNING OF TOKEN -NUM0A: - LXI B,1100H ;C=ACCUMULATED VALUE, B=CHAR COUNT - ; (C=0, B=11) -NUM1: - MOV A,M ;GET CHAR - CALL SDELM ;DONE IF DELIMITER - JRZ NUM2 - INX H ;PT TO NEXT CHAR - CALL DIGCK ;CHECK FOR DIGIT IN A - JRC NUMERR - MOV D,A ;DIGIT IN D - MOV A,C ;NEW VALUE = OLD VALUE * 10 - RLC ;*2 - JRC NUMERR - RLC ;*4 - JRC NUMERR - ADD C ;*5 - JRC NUMERR - RLC ;*10 - JRC NUMERR - ADD D ;NEW VALUE = OLD VALUE * 10 + DIGIT - JRC NUMERR ;CHECK FOR RANGE ERROR - MOV C,A ;SET NEW VALUE - DJNZ NUM1 ;COUNT DOWN -; -; RETURN FROM NUMBER -; -NUM2: - MOV A,C ;GET ACCUMULATED VALUE - RET -; -; NUMBER ERROR ROUTINE FOR SPACE CONSERVATION -; -NUMERR: - JMP ERROR ;USE ERROR ROUTINE - THIS IS RELATIVE PT -; -; CHECK TO SEE IF A IS A DIGIT -; IF SO, RETURN ITS VALUE -; IF NOT, RETURN WITH CARRY SET -; -DIGCK: - SUI '0' ;DIGIT? - RC ;ERROR - CPI 10 ;RANGE? - JRNC DIGCK1 - CMC ;FLIP CARRY - RET -DIGCK1: - STC ;SET CARRY - RET -; -; EXTRACT HEXADECIMAL NUMBER FROM COMMAND LINE -; RETURN WITH VALUE IN REG A; ALL REGISTERS MAY BE AFFECTED -; -HEXNUM: - LXI H,TFCB+1 ;PT TO TOKEN FOR CONVERSION - LXI D,0 ;DE=ACCUMULATED VALUE - MVI B,11 ;B=CHAR COUNT -HNUM1: - MOV A,M ;GET CHAR - CPI ' ' ;DONE? - JRZ HNUM3 ;RETURN IF SO - CPI NUMBASE ;DONE IF NUMBASE SUFFIX - JRZ HNUM3 - SUI '0' ;CONVERT TO BINARY - JRC NUMERR ;RETURN AND DONE IF ERROR - CPI 10 ;0-9? - JRC HNUM2 - SUI 7 ;A-F? - CPI 10H ;ERROR? - JRNC NUMERR -HNUM2: - INX H ;PT TO NEXT CHAR - MOV C,A ;DIGIT IN C - MOV A,D ;GET ACCUMULATED VALUE - RLC ;EXCHANGE NYBBLES - RLC - RLC - RLC - ANI 0F0H ;MASK OUT LOW NYBBLE - MOV D,A - MOV A,E ;SWITCH LOW-ORDER NYBBLES - RLC - RLC - RLC - RLC - MOV E,A ;HIGH NYBBLE OF E=NEW HIGH OF E, - ; LOW NYBBLE OF E=NEW LOW OF D - ANI 0FH ;GET NEW LOW OF D - ORA D ;MASK IN HIGH OF D - MOV D,A ;NEW HIGH BYTE IN D - MOV A,E - ANI 0F0H ;MASK OUT LOW OF E - ORA C ;MASK IN NEW LOW - MOV E,A ;NEW LOW BYTE IN E - DJNZ HNUM1 ;COUNT DOWN -; -; RETURN FROM HEXNUM -; -HNUM3: - XCHG ;RETURNED VALUE IN HL - MOV A,L ;LOW-ORDER BYTE IN A - RET -; -; LOG INTO DU CONTAINED IN FCB PTED TO BY DE -; -FCBLOG: - PUSH D ;SAVE PTR TO FCB - XCHG - MOV A,M ;GET DRIVE - STA TEMPDR ;SET TEMP DRIVE - LXI B,13 ;PT TO S1 FIELD - DAD B - MOV A,M ;GET USER - STA TEMPUSR ;SET TEMP USER - CALL SLOGIN ;LOG IN - POP D ;GET PTR TO FCB - RET -; -; CHECK FOR SPECIFIED DRIVE AND LOG IT IN -; -SLOGIN: -TEMPDR EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;2ND BYTE (IMMEDIATE ARG) IS TEMPDR - ORA A ;0=CURRENT DRIVE - JRNZ SLOG1 - LDA CURDR ;LOG IN CURRENT DRIVE - INR A ;ADD 1 FOR NEXT DCR -SLOG1: - DCR A ;ADJUST FOR PROPER DISK NUMBER (A=0) - CALL LOGIN ;LOG IN NEW DRIVE -TEMPUSR EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;2ND BYTE IS USER TO BE SELECTED - JMP SETUSR ;LOG IN NEW USER -; -; ROUTINE TO CHECK FOR A WHEEL BYTE AS NON-ZERO -; IF WHEEL BYTE IS ZERO, THEN ABORT (POP STACK AND RETURN) -; -; - IF WHEEL ;WHEEL FACILITY? -WHLCHK: - LDA Z3WHL ;GET WHEEL BYTE - ORA A ;ZERO? - RNZ ;OK IF NOT - JMP ERROR ;PROCESS AS ERROR - ENDIF ;WHEEL -; - -; -; CMDTBL (COMMAND TABLE) SCANNER -; ON RETURN, HL CONTAINS ADDRESS OF COMMAND IF CPR-RESIDENT -; ON RETURN, ZERO FLAG SET MEANS CPR-RESIDENT COMMAND -; -CMDSER: - LXI H,CMDTBL ;PT TO COMMAND TABLE -; -; ENTRY POINT TO PERMIT RCP TABLE TO BE SCANNED -; -CMDSCAN: - MOV B,M ;GET SIZE OF COMMAND TEXT - INX H ;PT TO FIRST COMMAND -CMS1: - MOV A,M ;CHECK FOR END OF TABLE - ORA A - JRZ CMS5 - LXI D,FCBFN ;PT TO STORED COMMAND NAME - PUSH B ;SAVE SIZE OF COMMAND TEXT -CMS2: - LDAX D ;COMPARE AGAINST TABLE ENTRY - CMP M - JRNZ CMS3 ;NO MATCH - INX D ;PT TO NEXT CHAR - INX H - DJNZ CMS2 ;COUNT DOWN - LDAX D ;NEXT CHAR IN INPUT COMMAND MUST BE - CPI ' ' - JRNZ CMS4 - POP B ;CLEAR STACK - MOV A,M ;GET ADDRESS FROM TABLE INTO HL - INX H - MOV H,M - MOV L,A ;HL CONTAINS ADDRESS - XRA A ;ZERO FLAG SET FOR COMMAND FOUND - RET ;COMMAND IS RESIDENT (ZERO FLAG SET) -CMS3: - INX H ;SKIP TO NEXT COMMAND TABLE ENTRY - DJNZ CMS3 -CMS4: - POP B ;GET SIZE OF COMMAND TEXT - INX H ;SKIP ADDRESS - INX H - JR CMS1 -CMS5: - XRA A ;SET NZ - DCR A ;COMMAND NOT FOUND IF NZ - RET - -; -;**** Section 5 **** -; CPR-Resident Commands -; -; -;Section 5A -;Command: DIR -;Function: To display a directory of the files on disk -;Forms: -; DIR Displays the DIR files -; DIR S Displays the SYS files -; DIR A Display both DIR and SYS files -;Notes: -; The flag SYSFLG defines the letter used to display both DIR and -; SYS files (A in the above Forms section) -; The flag SOFLG defines the letter used to display only the SYS -; files (S in the above Forms section) -; The flag WIDE determines if the file names are spaced further -; apart (WIDE=TRUE) for 80-col screens -; The flag FENCE defines the character used to separate the file -; names -; - IF DIRON ;DIR ENABLED -; -DIR: - LXI D,TFCB ;PT TO TARGET FCB - PUSH D ;SAVE PTR - INX D ;PT TO FILE NAME - LDAX D ;GET FIRST CHAR - CPI ' ' ;IF , MAKE ALL WILD - JRNZ DIR1 - MVI B,11 ;11 BYTES - MVI A,'?' ;WILD - CALL FILL -DIR1: - POP D ;GET PTR TO FCB - LXI D,TFCB ;PT TO TARGET FCB - CALL FCBLOG ;LOG IN TEMP DISK/USER - LDA TFCB2+1 ;LOOK AT NEXT INPUT CHAR - MVI B,80H ;PREPARE FOR DIR-ONLY SELECTION - CPI ' ' - JRZ DIRPR ;THERE IS NO FLAG, SO DIR ONLY - MVI B,1 ;SET FOR BOTH DIR AND SYS FILES - CPI SYSFLG ;SYSTEM AND DIR FLAG SPECIFIER? - JRZ DIRPR ;GOT SYSTEM SPECIFIER - CPI SOFLG ;SYS ONLY? - JRNZ DIRPR - DCR B ;B=0 FOR SYS FILES ONLY - ;DROP INTO DIRPR TO PRINT DIRECTORY - ; THEN RESTART CPR -; - ENDIF ;DIRON -; -; DIRECTORY PRINT ROUTINE; ON ENTRY, B REG IS SET AS FOLLOWS: -; 0 FOR ONLY SYSTEM FILES, 80H FOR ONLY DIR FILES, 1 FOR BOTH -; - IF DIRON OR ERAON -; -DIRPR: - MOV A,B ;GET FLAG - STA SYSTST ;SET SYSTEM TEST FLAG - MVI E,0 ;SET COLUMN COUNTER TO ZERO - PUSH D ;SAVE COLUMN COUNTER (E) - CALL SEARF ;SEARCH FOR SPECIFIED FILE (FIRST OCCURRENCE) - JRNZ DIR3 - CALL PRNNF ;PRINT NO FILE MSG; REG A NOT CHANGED - XRA A ;SET ZERO FLAG IN CASE CALLED BY ERA - POP D ;RESTORE DE - RET -; -; ENTRY SELECTION LOOP; ON ENTRY, A=OFFSET FROM SEARF OR SEARN -; -DIR3: - CALL GETSBIT ;GET AND TEST FOR TYPE OF FILES - JRZ DIR6 - POP D ;GET ENTRY COUNT (= COUNTER) - MOV A,E ;GET ENTRY COUNTER - INR E ;INCREMENT ENTRY COUNTER - PUSH D ;SAVE IT - ANI 03H ;OUTPUT IF 4 ENTRIES PRINTED IN LINE - JRNZ DIR4 - CALL CRLF ;NEW LINE - JR DIR5 -DIR4: - CALL PRINT -; - IF WIDE -; - DB ' ' ;2 SPACES - DB FENCE ;THEN FENCE CHAR - DB ' ',' '+80H ;THEN 2 MORE SPACES -; - ELSE -; - DB ' ' ;SPACE - DB FENCE ;THEN FENCE CHAR - DB ' '+80H ;THEN SPACE -; - ENDIF ;WIDE -; -DIR5: -; MVI B,01H ;PT TO 1ST BYTE OF FILE NAME -; MOV A,B ;A=OFFSET - MVI A,1 ;PT TO 1ST BYTE OF FILE NAME - CALL DIRPTR ;HL NOW PTS TO 1ST BYTE OF FILE NAME - CALL PRFN ;PRINT FILE NAME -DIR6: - CALL BREAK ;CHECK FOR ABORT - JRZ DIR7 - CALL SEARN ;SEARCH FOR NEXT FILE - JRNZ DIR3 ;CONTINUE IF FILE FOUND -DIR7: - POP D ;RESTORE STACK - MVI A,0FFH ;SET NZ FLAG - ORA A - RET -; - ENDIF ;DIRON OR ERAON -; -; PRINT FILE NAME PTED TO BY HL -; -PRFN: - MVI B,8 ;8 CHARS - CALL PRFN1 - MVI A,'.' ;DOT - CALL CONOUT - MVI B,3 ;3 CHARS -PRFN1: - MOV A,M ; GET CHAR - INX H ; PT TO NEXT - CALL CONOUT ; PRINT CHAR - DCR B ; COUNT DOWN - JRNZ PRFN1 - RET -; -; PT TO DIRECTORY ENTRY IN TBUFF WHOSE OFFSET IS SPECIFIED BY A AND C -; -DIRPTR: - LXI H,TBUFF ;PT TO TEMP BUFFER - ADD C ;PT TO 1ST BYTE OF DIR ENTRY - CALL ADDAH ;PT TO DESIRED BYTE IN DIR ENTRY - MOV A,M ;GET DESIRED BYTE - RET -; -; AFTER A SEARCH, RETURN NZ SET IF DESIRED TYPE OF FILE FOUND, Z IF NOT -; THIS ALGORITHM LOOKS AT THE SYSTEM BIT OF THE LOCATED FILE; THIS -; BIT IS SET TO 1 IF THE FILE IS A SYSTEM FILE AND 0 IF NOT A SYSTEM -; FILE. THE FOLLOWING EXCLUSIVE OR MASKS ARE APPLIED TO RETURN Z OR NZ -; AS REQUIRED BY THE CALLING PROGRAM: -; -; SYSTEM BYTE: X 0 0 0 0 0 0 0 (AFTER 80H MASK, X=1 IF SYS, 0 IF DIR) -; -; SYS-ONLY : 0 0 0 0 0 0 0 0 (XOR 0 = 0 if X=0, = 80H if X=1) -; DIR-ONLY : 1 0 0 0 0 0 0 0 (XOR 80H = 80h if X=0, = 0 if X=1) -; BOTH : 0 0 0 0 0 0 0 1 (XOR 1 = 81H or 1H, NZ in both cases) -; -GETSBIT: - DCR A ;ADJUST TO RETURNED VALUE - RRC ;CONVERT NUMBER TO OFFSET INTO TBUFF - RRC - RRC - ANI 60H - MOV C,A ;OFFSET INTO TBUFF IN C (C=OFFSET TO ENTRY) - MVI A,10 ;ADD 10 TO PT TO SYSTEM FILE ATTRIBUTE BIT - CALL DIRPTR ;A=SYSTEM BYTE - ANI 80H ;LOOK AT ONLY SYSTEM BIT -SYSTST EQU $+1 ;IN-THE-CODE VARIABLE - XRI 0 ; IF SYSTST=0, SYS ONLY; IF SYSTST=80H, DIR - ; ONLY; IF SYSTST=1, BOTH SYS AND DIR - RET ;NZ IF OK, Z IF NOT OK -; -;Section 5B -;Command: ERA -;Function: Erase files -;Forms: -; ERA Erase Specified files and print their names -; ERA V Erase Specified files and print their names, but ask -; for verification before Erase is done -;Notes: -; Several Key Flags affect this command: -; ERAV - If TRUE, the V option is enabled, and the character -; which turns it on (the V) is defined by ERDFLG -; ERAOK - If TRUE, the OK? prompt is enabled -; If ERAOK is FALSE, the verification feature is disabled regardless -; of what value ERAV has -; If ERAOK is TRUE, then: -; If ERAV is TRUE, verification is requested only if the V -; flag (actual letter defined by ERDFLG) is in the -; command line -; If ERAV is FALSE, verification is always requested, and a -; V flag in the command line will cause an error -; message to be printed (V?) after the ERA is completed -; - IF ERAON ;ERA ENABLED? -; -ERA: -; - IF WERA ;WHEEL FACILITY ENABLED? - CALL WHLCHK ;CHECK FOR IT - ENDIF ;WERA -; - IF ERAV AND ERAOK ;V FLAG AND OK? ENABLED? - LDA TFCB2+1 ;GET ERAFLG IF IT'S THERE - STA ERAFLG ;SAVE IT AS A FLAG - ENDIF ;ERAV -; - LXI D,TFCB ;PT TO TARGET FCB - CALL FCBLOG ;LOG INTO DU IN FCB - MVI B,1 ;DISPLAY ALL MATCHING FILES - CALL DIRPR ;PRINT DIRECTORY OF ERASED FILES - RZ ;ABORT IF NO FILES -; - IF ERAOK ;PRINT PROMPT -; - IF ERAV ;TEST VERIFY FLAG -; -ERAFLG EQU $+1 ;ADDRESS OF FLAG - MVI A,0 ;2ND BYTE IS FLAG - CPI ERDFLG ;IS IT A VERIFY OPTION? - JRNZ ERA2 ;SKIP PROMPT IF IT IS NOT -; - ENDIF ;ERAV -; - CALL PRINTC - DB 'OK to Erase','?'+80H - CALL CONIN ;GET REPLY - CPI 'Y' ;YES? - RNZ ;ABORT IF NOT -; - ENDIF ;ERAOK -; -ERA2: - LXI D,TFCB ;DELETE FILE SPECIFIED - JMP DELETE ;DELETE FILE AND REENTER CCP -; - ENDIF ;ERAON -; -;Section 5C -;Command: LIST -;Function: Print out specified file on the LST: Device -;Forms: -; LIST Print file (NO Paging) -;Notes: -; The flags which apply to TYPE do not take effect with LIST -; - IF LTON ;LIST AND TYPE ENABLED? -; -LIST: - MVI A,0FFH ;TURN ON PRINTER FLAG - JR TYPE0 -; -;Section 5D -;Command: TYPE -;Function: Print out specified file on the CON: Device -;Forms: -; TYPE Print file -; TYPE P Print file with paging flag -;Notes: -; The flag PGDFLG defines the letter which toggles the paging -; facility (P in the forms section above) -; The flag PGDFLT determines if TYPE is to page by default -; (PGDFLT=TRUE if TYPE pages by default); combined with -; PGDFLG, the following events occur -- -; If PGDFLT = TRUE, PGDFLG turns OFF paging -; If PGDFLT = FALSE, PGDFLG turns ON paging -; -TYPE: - XRA A ;TURN OFF PRINTER FLAG -; -; ENTRY POINT FOR CPR LIST FUNCTION (LIST) -; -TYPE0: - STA PRFLG ;SET FLAG -; - IF WLT ;WHEEL ON? - CALL WHLCHK ;CHECK WHEEL BYTE - ENDIF ;WLT -; - LDA TFCB2+1 ;GET PGDFLG IF IT'S THERE - STA PGFLG ;SAVE IT AS A FLAG - LXI D,TFCB ;PT TO TARGET FILE FCB - CALL AMBCHK ;CHECK FOR QUESTION MARKS IN TFCB - RZ ;ERROR IF ANY QUESTION MARKS - CALL FCBLOG ;LOG INTO DU IN FCB - LXI D,TFCB ;PT TO SELECT FILE - CALL OPEN ;OPEN SELECTED FILE - JZ PRNNF ;ABORT IF ERROR - CALL CRLF ;NEW LINE - MVI A,NLINES-1 ;SET LINE COUNT - STA PAGCNT - LXI B,080H ;SET CHAR POSITION AND TAB COUNT - ; (B=0=TAB, C=080H=CHAR POSITION) -; -; MAIN LOOP FOR LOADING NEXT BLOCK -; -TYPE2: - MOV A,C ;GET CHAR COUNT - CPI 80H - JRC TYPE3 - PUSH H ;READ NEXT BLOCK - PUSH B - CALL READF - POP B - POP H - RNZ ;ERROR? - MVI C,0 ;SET CHAR COUNT - LXI H,TBUFF ;PT TO FIRST CHAR -; -; MAIN LOOP FOR PRINTING CHARS IN TBUFF -; -TYPE3: - MOV A,M ;GET NEXT CHAR - ANI 7FH ;MASK OUT MSB - CPI 1AH ;END OF FILE (^Z)? - RZ ;RESTART CPR IF SO -; -; OUTPUT CHAR TO CON: OR LST: DEVICE WITH TABULATION -; - CPI CR ;RESET TAB COUNT? - JRZ TYPE4 - CPI LF ;RESET TAB COUNT? - JRZ TYPE4 - CPI TAB ;TAB? - JRZ TYPE5 -; -; OUTPUT CHAR AND INCREMENT CHAR COUNT -; - CALL LCOUT ;OUTPUT CHAR - INR B ;INCREMENT TAB COUNT - JR TYPE6 -; -; OUTPUT OR AND RESET TAB COUNT -; -TYPE4: - CALL LCOUT ;OUTPUT OR - MVI B,0 ;RESET TAB COUNTER - JR TYPE6 -; -; TABULATE -; -TYPE5: - MVI A,' ' ; - CALL LCOUT - INR B ;INCR POS COUNT - MOV A,B - ANI 7 - JRNZ TYPE5 -; -; CONTINUE PROCESSING -; -TYPE6: - INR C ;INCREMENT CHAR COUNT - INX H ;PT TO NEXT CHAR - CALL BREAK ;CHECK FOR ABORT - RZ ;RESTART IF SO - JR TYPE2 -; - ENDIF ;LTON -; -;Section 5E -;Command: SAVE -;Function: To save the contents of the TPA onto disk as a file -;Forms: -; SAVE -; Save specified number of pages (start at 100H) -; from TPA into specified file; is in DEC -; SAVE S -; Like SAVE above, but numeric argument specifies -; number of sectors rather than pages -;Notes: -; The MULTCMD flag (Multiple Commands Allowed) expands the code slightly, -; but is required to support multiple commands with SAVE -; The SECTFLG defines the letter which indicates a sector count -; (S in the Forms section above) -; - IF SAVEON ;SAVE ENABLED? -; -SAVE: -; - IF WSAVE ;WHEEL FACILITY? - CALL WHLCHK ;CHECK FOR WHEEL BYTE - ENDIF ;WSAVE -; - CALL NUMBER ;EXTRACT NUMBER FROM COMMAND LINE - MOV L,A ;HL=PAGE COUNT - MVI H,0 - PUSH H ;SAVE PAGE COUNT - LXI H,TFCB2 ;COPY 2ND FCB INTO POSITION OF FIRST - LXI D,TFCB - PUSH D ;SAVE PTR TO FCB - MVI B,14 ;14 BYTES - CALL LDIR - POP D ;GET PTR TO FCB - CALL AMBCHK ;CHECK FOR AMBIGUOUS - POP H - RZ ;ABORT IF SO - PUSH H - CALL EXTEST ;TEST FOR EXISTENCE OF FILE AND ABORT IF SO - MVI C,16H ;BDOS MAKE FILE - CALL GRBDOS - POP H ;GET PAGE COUNT - JRZ SAVE3 ;ERROR? - LXI D,TPA-128 ;PT TO START OF SAVE AREA (TPA) - DAD H ;DOUBLE 256-BYTE BLOCK COUNT FOR SECTOR COUNT - XCHG ;DE IS COUNT, HL IS NEXT BLOCK - 128 BYTES -SAVE1: - MOV A,D ;DONE WITH SAVE? - ORA E ;DE=0 IF SO - JRZ SAVE2 - DCX D ;COUNT DOWN ON SECTORS - PUSH D ;SAVE PTR TO BLOCK TO SAVE - LXI D,128 ;128 BYTES PER SECTOR - DAD D ;PT TO NEXT SECTOR - PUSH H ;SAVE ON STACK - XCHG ;DE IS ADDRESS - CALL DMASET ;SET DMA ADDRESS FOR WRITE (ADDRESS IN DE) - LXI D,TFCB ;WRITE SECTOR - MVI C,15H ;BDOS WRITE SECTOR - CALL BDOSB ;SAVE BC - POP H ;GET PTR TO NEXT SECTOR IN HL - POP D ;GET SECTOR COUNT IN DE - JRNZ SAVE3 ;WRITE ERROR? - JR SAVE1 ;CONTINUE -SAVE2: - LXI D,TFCB ;CLOSE SAVED FILE - CALL CLOSE - INR A ;ERROR? - JRNZ SAVE4 -SAVE3: - CALL PRNLE ;PRINT 'NO SPACE' ERROR -SAVE4: - JMP DEFDMA ;SET DMA TO 0080 AND RESTART CPR -; - ENDIF ;SAVEON -; - IF LTON OR SAVEON OR RENON ;FOR LIST/TYPE, SAVE, AND REN FCTS -; -; TEST FCB PTED TO BY DE TO SEE IF ANY ? CHARS IN IT -; RETURN WITH Z IF SO, NZ IF NOT; DON'T AFFECT DE -; -AMBCHK: - PUSH D - INX D ;PT TO FIRST CHAR - MVI B,11 ;11 CHARS -AMB1: - LDAX D ;GET CHAR - CPI '?' ;ERROR? - JRZ AMB2 - INX D ;PT TO NEXT - DJNZ AMB1 - DCR B ;SET NZ - POP D ;RESTORE PTR - RET -AMB2: - CALL PRINT - DB CR,LF,'AFN Erro','r'+80H - XRA A ;SET ZERO FLAG - POP D ;RESTORE PTR - RET -; - ENDIF ;LTON OR SAVEON -; -; Test File in FCB for existence, ask user to delete if so, and abort if he -; choses not to -; - IF SAVEON OR RENON ;FOR SAVE AND REN FUNCTIONS -; -EXTEST: - LXI D,TFCB ;PT TO FCB - PUSH D ;SAVE PTR - CALL FCBLOG ;LOG INTO DU - CALL SEARF ;LOOK FOR SPECIFIED FILE - POP D ;GET PTR TO FCB - RZ ;OK IF NOT FOUND - PUSH D ;SAVE PTR TO FCB - CALL PRINTC - DB 'Erase',' '+80H - LXI H,TFCB+1 ;PT TO FILE NAME FIELD - CALL PRFN ;PRINT IT - MVI A,'?' ;PRINT QUESTION - CALL CONOUT - CALL CONIN ;GET RESPONSE - POP D ;GET PTR TO FCB - CPI 'Y' ;KEY ON YES - JNZ ERR3 ;RESTART AS ERROR IF NO - PUSH D ;SAVE PTR TO FCB - CALL DELETE ;DELETE FILE - POP D ;GET PTR TO FCB - RET -; - ENDIF ;SAVEON OR RENON -; -;Section 5F -;Command: REN -;Function: To change the name of an existing file -;Forms: -; REN = Perform function -; - IF RENON ;REN ENABLED? -; -REN: -; - IF WREN ;WHEEL FACILITY? - CALL WHLCHK ;CHECK FOR WHEEL BYTE - ENDIF ;WREN -; - LXI D,TFCB ;CHECK FOR AMBIGUITY IN FIRST FILE NAME - CALL AMBCHK - RZ - LXI D,TFCB2 ;CHECK FOR AMBIGUITY IN SECOND FILE NAME - CALL AMBCHK - RZ - CALL EXTEST ;TEST FOR FILE EXISTENCE AND RETURN - ; IF FILE DOESN'T EXIST; ABORT IF IT DOES - MVI B,16 ;EXCHANGE NEW AND OLD FILE NAMES - LXI H,TFCB ;PT TO NEW - LXI D,TFCB2 ;PT TO OLD -REN0: - LDAX D ;GET OLD - MOV C,A - MOV A,M ;GET NEW - STAX D ;PUT NEW - MOV M,C ;PUT OLD - INX H ;ADVANCE - INX D - DJNZ REN0 -; -; PERFORM RENAME FUNCTION -; - LXI D,TFCB ;RENAME FILE - XRA A - STAX D ;SET CURRENT DISK - MVI C,17H ;BDOS RENAME FCT - CALL GRBDOS - RNZ - JMP PRNNF ;PRINT NO FILE MSG -; - ENDIF ;RENON -; -;Section 5G -;Command: JUMP -;Function: To Call the program (subroutine) at the specified address -; without loading from disk -;Forms: -; JUMP Call at ; is in HEX -; - IF JUMPON ;JUMP ENABLED? -; -JUMP: - -; - IF WJUMP ;WHEEL FACILITY? - CALL WHLCHK ;CHECK FOR WHEEL BYTE - ENDIF ;WJUMP -; - CALL HEXNUM ;GET LOAD ADDRESS IN HL - JR CALLPROG ;PERFORM CALL -; - ENDIF ;JUMPON -; -;Section 5H -;Command: GO -;Function: To Call the program in the TPA without loading -; loading from disk. Same as JUMP 100H, but much -; more convenient, especially when used with -; parameters for programs like STAT. Also can be -; allowed on remote-access systems with no problems. -; -;Form: -; GO -; - IF GOON ;GO ENABLED? -; -GO: - -; - IF WGO ;WHEEL FACILITY? - CALL WHLCHK ;CHECK FOR WHEEL BYTE - ENDIF ;WGO -; - LXI H,TPA ;Always to TPA - JR CALLPROG ;Perform call -; - ENDIF ;GOON -; -;Section 5I -;Command: COM file processing -;Function: To load the specified COM file from disk and execute it -;Forms: -;Notes: -; COM files are processed as follows -- -; 1. File name buffers are initialized and a preliminary -; error check is done -; 2. MLOAD is used to search for the file along the Path -; and load it into the TPA -; 3. CALLPROG is used to set up the buffers to be used by -; the transient (FCB at 5CH, FCB at 6CH, BUFF at 80H) -; and run the program -; The flag MULTCMD comes into play frequently here; it mainly serves -; to save space if MULTCMD is FALSE and enables Multiple -; Commands on the same line if MULTCMD is TRUE -; -COMDIR: - IF DRVPREFIX -; - LDA FCBFN ;ANY COMMAND? - CPI ' ' ;' ' MEANS COMMAND WAS 'DIR:' TO SWITCH - JRNZ COM ;NOT , SO MUST BE TRANSIENT OR ERROR -; -; ENTRY POINT TO SELECT USER/DISK VIA DIR: PREFIX -; - IF WDU ;WHEEL FACILITY? - CALL WHLCHK ;CHECK FOR WHEEL BYTE - ENDIF ;WDU -; - LDA FCBDN+13 ;GET SELECTED USER - CPI 16 ;OUT OF RANGE? - JNC ERROR - LXI D,FCBDN ;PT TO FCB - CALL FCBLOG ;LOG INTO DU - LDA TEMPUSR ;GET TEMPORARY USER - STA CURUSR ;SET CURRENT USER (MAKE PERMANENT) - LDA TEMPDR ;GET SELECTED DISK - ORA A ;IF 0 (DEFAULT), NO CHANGE - JRZ COMDR - DCR A ;ADJUST FOR LOGIN - STA CURDR ;SET CURRENT DRIVE -COMDR: - CALL SETUD ;SET UD BYTE - JMP RS1 ;RESUME COMMAND LINE PROCESSING -; - ENDIF ;DRVPREFIX -; -; PROCESS COMMAND -; -COM: -; - IF CMDRUN ;COMMAND RUN FACILITY AVAILABLE? - MVI A,0FFH ;USE IT IF AVAILABLE (MLOAD INPUT) - ENDIF ;CMDRUN -; - -; -; SET EXECUTION AND LOAD ADDRESS -; - LXI H,TPA ;TRANSIENT PROGRAM AREA - PUSH H ;SAVE TPA ADDRESS FOR EXECUTION - CALL MLOAD ;LOAD MEMORY WITH FILE SPECIFIED IN CMD LINE - POP H ;GET EXECUTION ADDRESS; FALL THRU TO CALLPROG -; -; CALLPROG IS THE ENTRY POINT FOR THE EXECUTION OF THE LOADED -; PROGRAM; ON ENTRY TO THIS ROUTINE, HL MUST CONTAIN THE EXECUTION -; ADDRESS OF THE PROGRAM (SUBROUTINE) TO EXECUTE -; -CALLPROG: - CALL CRLF ;LEADING NEW LINE -CALLP: - SHLD EXECADR ;PERFORM IN-LINE CODE MODIFICATION -; -; COPY COMMAND TAIL INTO TBUFF -; -TAILSV EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - LXI H,0 ;ADDRESS OF FIRST CHAR OF COMMAND TAIL - LXI D,TBUFF ;PT TO TBUFF - PUSH D ;SAVE PTR - MVI B,0 ;SET COUNTER - INX D ;PT TO FIRST CHAR -TAIL: - MOV A,M ;GET CHAR - CALL TSTEOL ;CHECK FOR EOL - JRZ TAIL1 - STAX D ;PUT CHAR - INX H ;PT TO NEXT - INX D - INR B ;INCREMENT COUNT - JR TAIL -TAIL1: - XRA A ;STORE ENDING ZERO - STAX D - POP H ;GET PTR - MOV M,B ;SAVE COUNT -; -; RUN LOADED TRANSIENT PROGRAM -; - CALL DEFDMA ;SET DMA TO 0080 -; -; EXECUTION (CALL) OF PROGRAM (SUBROUTINE) OCCURS HERE -; -EXECADR EQU $+1 ;CHANGE ADDRESS FOR IN-LINE CODE MODIFICATION - CALL TPA ;CALL TRANSIENT -; -; RETURN FROM EXECUTION -; - CALL DEFDMA ;SET DMA TO 0080, IN CASE PROG CHANGED IT - JMP RS1 ;RESTART CPR AND CONTINUE COMMAND PROCESSING -; -;Section 5J -;Command: GET -;Function: To load the specified file from disk to the specified address -;Forms: -; GET Load the specified file at the specified page; -; is in HEX -; - IF GETON ;GET ENABLED? -; -GET: -; - IF WGET ;WHEEL ON? - CALL WHLCHK ;CHECK WHEEL BYTE - ENDIF ;WGET -; - LXI H,TFCB2 ;COPY TFCB2 TO FCBDN FOR LOAD - LXI D,FCBDN - MVI B,14 ;14 BYTES (INCLUDES DU) - CALL LDIR - CALL HEXNUM ;GET LOAD ADDRESS IN HL -; -; FALL THRU TO MLOAD -; - IF CMDRUN ;COMMAND RUN FACILITY AVAILABLE? - XRA A ;NO CMDRUN IF FACILITY IS THERE (MLOAD INPUT) - ENDIF ;CMDRUN -; - ENDIF ;GETON - -; -; MEMORY LOAD SUBROUTINE -; -; LOAD MEMORY WITH THE FILE WHOSE NAME IS SPECIFIED IN THE COMMAND LINE -; ON INPUT, HL CONTAINS STARTING ADDRESS TO LOAD -; -; EXIT POINTS ARE A RETURN AND LOG IN CURRENT USER/DISK IF NO ERROR, -; A JMP TO ERROR IF COM FILE NOT FOUND OR A MESSAGE AND ABORT IF MEMORY FULL -; -MLOAD: -; - IF CMDRUN ;CMDRUN FACILITY? - STA CRFLAG ;SAVE FLAG - ENDIF ;CMDRUN -; - SHLD LOADADR ;SET LOAD ADDRESS - XCHG ;LOAD ADDRESS IN DE - CALL DMASET ;SET DMA ADDRESS -; -; MLA is a reentry point for a non-standard CP/M Modification -; The PATH command-search is implemented by this routine -; -MLA: -; -; Set attributes of COM files which match search -; - MVI A,COMATT ;CUSTOMIZER-SPECIFIED ATTRIBUTES - STA SYSTST ;SET FLAG - -; -; Analyze current path, generating a minimal, optimal absolute -; path equivalent in the buffer MPATH -; - IF MINPATH ;IF MINIMUM PATH SEARCH EMPLOYED - XRA A - STA MPATH ;SET EMPTY PATH -; - IF DRVPREFIX ;PAY ATTENTION TO DU:COM PREFIX? -; -; Convert DU in FCBDN into absolute expression in MPATH -; - LXI D,MPATH ;BUILD MPATH BUFFER - LXI H,FCBDN ;HL PTS TO FCB, DE PTS TO MPATH - MOV A,M ;GET DRIVE - ORA A ;SELECT CURRENT - JRNZ MLAMPD - LDA CURDR ;SET CURRENT DRIVE - INR A ;ADJUST FOR PATH -MLAMPD: - STAX D ;SET DRIVE - INX D ;PT TO USER - LXI B,13 ;PT TO USER - DAD B - MOV A,M ;GET USER - STAX D ;SAVE USER - INX D ;PT TO NEXT - XRA A ;A=0 - STAX D ;STORE ENDING 0 IN MPATH - ENDIF ;DRVPREFIX -; - IF SCANCUR ;SCAN CURRENT DU AT ALL TIMES? - LDA CURDR ;GET CURRENT DRIVE - INR A ;ADD 1 FOR A=1 - MOV B,A - LDA CURUSR ;GET CURRENT USER - MOV C,A ;BC=DU - LXI H,PATH ;PT TO FIRST PATH ELEMENT - JR MPATHBC ;PLACE ENTRY INTO MPATH - ENDIF ;SCANCUR -; -; Convert symbolic path at PATH into absolute path at MPATH -; - LXI H,PATH ;PT TO SYMBOLIC PATH -MPATH1: - MOV A,M ;CHECK FOR END OF SYMBOLIC PATH - ORA A ;0=END OF PATH - JRZ MPATH7 -; -; Place absolute form for current path element in BC -; - ANI 7FH ;MASK OUT SYSTEM BIT - CPI CURIND ;CHECK FOR CURRENT DRIVE - JRNZ MPATH2 - LDA CURDR ;GET CURRENT DRIVE - INR A ;ADJUST FOR A=1 -MPATH2: - MOV B,A ;DRIVE IN B (1=A) - INX H ;PT TO USER - MOV A,M ;GET USER - INX H ;PT TO NEXT ELEMENT - ANI 7FH ;MASK OUT SYSTEM BIT - CPI CURIND ;CHECK FOR CURRENT USER - JRNZ MPATH3 - LDA CURUSR ;GET CURRENT USER -MPATH3: - MOV C,A ;SET USER IN C -; -; Scan MPATH for DU element in BC -; -MPATHBC: - PUSH H ;SAVE PTR TO NEXT PATH ELEMENT - LXI H,MPATH ;PT TO MINIMUM PATH -MPATH4: - MOV A,M ;CHECK FOR END OF PATH - ORA A - JRZ MPATH6 - INX H ;PT TO USER - CMP B ;CHECK FOR DISK MATCH - JRNZ MPATH5 - MOV A,M ;GET USER - CMP C ;CHECK FOR USER MATCH - JRNZ MPATH5 - POP H ;MATCH, SO BC IS DUPLICATE - JR MPATH1 ;CONTINUE -MPATH5: - INX H ;PT TO NEXT ELEMENT - JR MPATH4 -; -; No match, so BC is a unique DU and store it in path -; -MPATH6: - MOV M,B ;STORE DRIVE - INX H - MOV M,C ;STORE USER - INX H - MVI M,0 ;STORE ENDING 0 - POP H ;PT TO NEXT ENTRY - JR MPATH1 ;CONTINUE -; -; MPATH now contains the minimal path -; -MPATH7: -; - ENDIF ;MINPATH -; -; Non-MINPATH Processing: -; If DRVPREFIX or SCANCUR are TRUE, look in DU in FCBDN -; - IF (NOT MINPATH) AND (DRVPREFIX OR SCANCUR) - LXI D,FCBDN ;LOOK FOR FILE - CALL FCBLOG ;LOG INTO FCB - CALL SEAR1 - JNZ MLA4 - ENDIF ;(NOT MINPATH) AND (DRVPREFIX OR SCANCUR) -; -; Select current disk at all times -; - XRA A - STA FCBDN ;SET CURRENT DISK -MLARUN: -; -; The following selects the path to be followed; if the Minimal Path is -; available, it is followed; else, the Symbolic Path is followed -; - IF MINPATH ;IF MINIMAL PATH USED - LXI H,MPATH ;PT TO MINIMAL PATH - - ELSE ;NOT MINPATH - LXI H,PATH ;PT TO SYMBOLIC PATH - - ENDIF ;MINPATH -; -; This is the main path search loop; HL pts to the next path element -; -MLA0: - MOV A,M ;GET DRIVE - ORA A ;0=DONE=COMMAND NOT FOUND -; - IF NOT CMDRUN ;ERROR ABORT IF NO COMMAND RUN FACILITY - JZ ERROR ;PATH EXHAUSTED -; - ELSE ;CONTINUE PROCESSING FOR COMMAND RUN -; -; CMDRUN Facility -; - JRNZ NOCRUN ;NOT READY FOR CMD RUN YET -CRFLAG EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;CHECK CRFLAG - ORA A ;0=NO - JZ ERROR ;PROCESS AS ERROR IF CMD RUN EXHAUSTED -; - IF ROOTONLY ;ONLY LOOK FOR EXT COMMAND PROCESSOR AT ROOT - PUSH H ;SAVE PTR TO PATH END - ENDIF ;ROOTONLY -; - XRA A ;DO NOT REENTER THIS CODE - STA CRFLAG ;SET ZERO FOR NO ENTRY - LXI H,CFCB ;SET CFCB AS COMMAND - LXI D,FCBDN ;... BY COPYING IT INTO FCBDN - MVI B,12 ;ONLY 12 BYTES REQUIRED - CALL LDIR - LHLD CURCMD ;GET PTR TO CURRENT COMMAND LINE - CALL PARSET ;PARSE AS COMMAND TAIL -; - IF ROOTONLY ;LOOK FOR EXT COMMAND PROCESSOR AT ROOT ONLY? - JR MLA3RT ;PROCESS FROM PATH END - ELSE ;FOLLOW PATH LOOKING FOR EXT COMMAND PROCESSOR -; - JR MLARUN ;NOW TRY THE RUN FROM THE PATH -; - ENDIF ;ROOTONLY -; -CFCB: - CMDFCB ;FCB DEFINING INITIAL COMMAND -NOCRUN: - ENDIF ;CMDRUN -; -; LOOK FOR COMMAND IN DIRECTORY PTED TO BY HL; DRIVE IN A -; - IF NOT MINPATH - CPI CURIND ;CURRENT DRIVE SPECIFIED? - JRNZ MLA1 ;SKIP DEFAULT DRIVE SELECTION IF SO - LDA CURDR ;GET CURRENT DRIVE - INR A ;SET A=1 - ENDIF ;NOT MINPATH -; -MLA1: - STA TEMPDR ;SELECT DIFFERENT DRIVE IF NOT CURRENT - INX H ;PT TO USER NUMBER - MOV A,M ;GET USER NUMBER - INX H ;PT TO NEXT ENTRY IN PATH - PUSH H ;SAVE PTR -; - IF NOT MINPATH - ANI 7FH ;MASK OUT SYSTEM BIT - CPI CURIND ;CURRENT USER SPECIFIED? - JRNZ MLA2 ;DO NOT SELECT CURRENT USER IF SO - LDA CURUSR ;GET CURRENT USER NUMBER -MLA2: - ENDIF ;NOT MINPATH -; - STA TEMPUSR ;SET TEMPORARY USER NUMBER - CMA ;FLIP BITS SO SYSTEM BIT IS 0 IF SYS-ONLY - ANI 80H ;MASK FOR ONLY NOT OF SYSTEM BIT TO SHOW - JRNZ MLA3 ;DON'T SET FLAG IF ORIGINALLY SYSTEM BIT=0 - STA SYSTST ;TEST FLAG IS 0 FOR SYS-ONLY, 1 FOR BOTH -MLA3: - CALL SLOGIN ;LOG IN PATH-SPECIFIED USER/DISK -MLA3RT: - LXI D,FCBDN ;PT TO FCB - CALL SEAR1 ;LOOK FOR FILE - POP H ;GET PTR TO NEXT PATH ENTRY - JRZ MLA0 ;CONTINUE PATH SEARCH IF SEARCH FAILED - ;LOAD IF SEARCH SUCCEEDED -; -; FILE FOUND -- PERFORM SYSTEM TEST AND PROCEED IF APPROVED -; -MLA4: - PUSH H ;SAVE PTR - CALL GETSBIT ;CHECK SYSTEM BIT - POP H ;GET PTR - JRZ MLA0 ;CONTINUE IF NO MATCH - CALL OPENF ;OPEN FILE FOR INPUT -LOADADR EQU $+1 ;MEMORY LOAD ADDRESS (IN-LINE CODE MOD) - LXI H,TPA ;SET START ADDRESS OF MEMORY LOAD -MLA5: - MVI A,ENTRY/256-1 ;GET HIGH-ORDER ADR OF JUST BELOW CPR - CMP H ;ARE WE GOING TO OVERWRITE THE CPR? - JRC PRNLE ;ERROR IF SO - PUSH H ;SAVE ADDRESS OF NEXT SECTOR - XCHG ;... IN DE - CALL DMASET ;SET DMA ADDRESS FOR LOAD - LXI D,FCBDN ;READ NEXT SECTOR - CALL READ - POP H ;GET ADDRESS OF NEXT SECTOR - JRNZ MLA6 ;READ ERROR OR EOF? - LXI D,128 ;MOVE 128 BYTES PER SECTOR - DAD D ;PT TO NEXT SECTOR IN HL - JR MLA5 -; -MLA6: - DCR A ;LOAD COMPLETE - JRNZ PRNLE ;MEMORY FULL IF NZ -; -; RETURN TO CURRENT DIRECTORY -; -DLOGIN: -CURDR EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;PREP TO LOG IN CURRENT DRIVE - CALL LOGIN ;LOGIN CURRENT DRIVE -CURUSR EQU $+1 ;POINTER FOR IN-THE-CODE MODIFICATION - MVI A,0 ;PREP TO LOG IN CURRENT USER NUMBER - JMP SETUSR ;LOG IN NEW USER - -; -; LOAD ERROR -; -PRNLE: - CALL PRINTC - DB 'Ful','l'+80H - JMP RESTRT ;RESTART ZCPR - -;***** - -; -; DEFAULT PATH USED FOR PATH COMMAND-SEARCH -; - IF EXPATH EQ 0 ;USE THIS PATH? -; -PATH: - IPATH ;PATH DEFINED IN Z3HDR.LIB -; - ENDIF ;INTPATH -; - -;***** - -; -; INTERNAL MINIMUM PATH -; - IF MINPATH -MPATH: - DS EXPATHS+3 ;SIZE OF PATH, MAX - ; (+2 FOR DU:COM PREFIX, +1 FOR ENDING 0) - ENDIF ;MINPATH - -;***** - IF EXTSTK NE 0 ;EXTERNAL STACK - -STACK EQU EXTSTK+48 ;SET TOP-OF-STACK ADDRESS - - ELSE -; -; STACK AREA -; - DS 48 ;STACK AREA -STACK EQU $ ;TOP OF STACK -; - ENDIF ;INTSTACK -; - IF PWCHECK -PWLIN EQU STACK-48 ;PLACE LINE AT BOTTOM OF STACK - ENDIF ;PWCHECK -; -; The following will cause an error message to appear if -; the size of ZCPR3 is over 2K bytes. -; - IF ($ GT CPRLOC+800H) -ZCPR3ER EQU NOVALUE ;ZCPR3 IS LARGER THAN 2K BYTES - ENDIF - - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ZCPR3.HLP b/Source/Images/d_bp/u15/ZCPR3.HLP deleted file mode 100644 index 67d3bf49..00000000 --- a/Source/Images/d_bp/u15/ZCPR3.HLP +++ /dev/null @@ -1,106 +0,0 @@ -Overview of ZCPR3 Help Files and Other ZCPR3 Details -ALIAS Alias Scripts -CMDFILES SUB and ZEX Command File Processors -COMPARE Comparison Utilities -DIRS Directory Display Utilities -DU3 Disk Maniupulation Utility -HELPSYS Online Documentation System -IF Flow Commands -IO Redirectable Input/Output System -MENU MENU Shell -NDIRS Named Directory Manipulation Utilities -SH Named-Variable Shell -SYSRCP System Resident Command Package -TINIT Terminal Initialization -VFILER Screen-Oriented File Manipulation Utility -Z3RES ZCPR3 CPR-Resident Commands -Z3TCAP ZCPR3 TCAP and Utilities -Z3UTIL1 General-Purpose Utilities -Z3UTIL2 System-Oriented Utilities -:Overview of the ZCPR3 Help Files - - Alì  oæ  thå ZCPR³ utilitieó arå documenteä  onlinå  bù -meanó  oæ thå ZCPR³ Helð System®  Thió ió thå  Masteò  Helð -Filå  whicè  allowó  yoõ tï directlù accesó  alì  thå  otheò -ZCPR3-Specifiã Helð Fileó supplieä witè thå ZCPR³ System. - - - - << Zoetrope and Echelon >> - - - A Note on File References - - Filå  Referenceó  undeò ZCPR³ arå largelù oæ  thå  samå -forí  aó  undeò CP/Í excepô thaô á ¯ (slash© maù noô bå  thå -firsô  characteò  oæ  á  filå  name®  Filå  Referenceó  arå -processeä slightlù differentlù undeò ZCPR3¬ anä thå FCBó arå -slightlù differenô betweeî ZCPR³ anä CP/Í wheî thå  special¬ -disalloweä characteró arå includeä iî á filå reference. - - The following are these disallowed characters: - - < > , ; : = ? * [ ] - - This¬   oæ   course¬   applieó   tï  unambiguouó   filå -references® Ambiguouó filå referenceó maù contaiî ¿ oò *. - - Line Editing and Output Control - - The following are the line editing functions -- - - rubout Delete and echo the last character typed at the - console. - Ctrl-È   Deletå  thå  lasô  characteò  typed»   Backspacå  onå - character; CRT-oriented - Ctrl-U Delete the entire line typed at the console. - Ctrl-Ø Deletå thå entirå linå typeä aô thå console»  Backspacå - tï thå beginninç oæ thå currenô line; CRT-oriented. - Ctrl-R Retype current command line: types a "clean line" - following character deletion with rubouts. - Ctrl-E Physical end of line: carriage is returned, but - line is not sent until the carriage return key is - depressed. - Ctrl-M Terminates input (carriage return). - Ctrl-J Terminates current input (line feed); CRT-oriented - Ctrl-C CP/M system reboot (warm start). - Ctrl-Z End input from the console (used in PIP and ED). - - Other control functions affect console output -- - - Ctrl-P Copy all subsequent console output to the currently- - assigned list device (LST:). Output is sent to both - the list device and the console device until the next - Ctrl-P is typed. - Ctrl-S Stop the console output temporarily. Program execution - and output continue when the next character is typed - at the console. Typing Ctrl-C returns control to CP/M. - - Inpuô  lineó caî bå quitå long¬  thå sizå specifieä  aô -ZCPR³ installatioî time®  Theù arå noô acteä upoî untiì thå -carriagå returî keù ió typed. - - Alì  oæ theså linå editinç functionó arå  supporteä  bù -thå CP/Í BDOÓ and¬ consequently¬ useä bù ZCPR³ itself® Manù -ZCPR³  utilities¬  althï noô all¬  uså thå BDOÓ linå  editoò -also. - -::ALIAS -::CMDFILES -::COMPARE -::DIRS -::DU3 -::HELPSYS -::IF -::IO -::MENU -::NDIRS -::SH -::SYSRCP -::TINIT -::VFILER -::Z3RES -::Z3TCAP -::Z3UTIL1 -::Z3UTIL2 - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ZCPR3.INS b/Source/Images/d_bp/u15/ZCPR3.INS deleted file mode 100644 index 238ac659..00000000 --- a/Source/Images/d_bp/u15/ZCPR3.INS +++ /dev/null @@ -1,163 +0,0 @@ -; -; Installation File for ZCPR3 Distribution, Phase 1 -; -; Filename.Typ Size Recs CRC Version -; 1 ALIAS .COM 4K 30 82D4 1.1 -; 2 CD .COM 1K 7 DA48 3.0 -; 3 CMDRUN .COM 1K 2 21B5 N/A -; 4 COMMENT .COM 1K 5 3C4A 2.0 -; 5 CPSEL .COM 1K 8 CCAA 1.0 -; 6 CRC .COM 6K 41 A89C 2.0 -; 7 DEV .COM 2K 14 F755 1.0 -; 8 DEVICE .COM 3K 17 153E 1.0 -; 9 DIFF .COM 4K 25 45A7 2.0 -; 10 DIR .COM 2K 16 9B8A 1.0 -; 11 ECHO .COM 1K 4 F2D6 1.0 -; 12 ERASE .COM 3K 20 E71E 5.0 -; 13 ERROR1 .COM 2K 12 5EB7 1.0 -; 14 ERROR2 .COM 3K 18 2F03 1.0 -; 15 ERROR3 .COM 1K 5 8542 1.0 -; 16 ERROR4 .COM 1K 5 86D1 1.0 -; 17 ERRORX .COM 1K 3 F941 1.0 -; 18 FINDF .COM 2K 14 D2A6 2.0 -; 19 GOTO .COM 1K 6 6ADA 1.0 -; 20 HELP .COM 3K 24 928B 5.0 -; 21 HELPCK .COM 2K 16 F3B3 1.0 -; 22 HELPPR .COM 5K 35 12E7 1.0 -; 23 IF .COM 3K 18 418D 1.1 -; 24 IFSTAT .COM 1K 3 6586 1.0 -; 25 LDR .COM 3K 20 A14E 1.0 -; 26 MCOPY .COM 4K 32 8341 4.0 -; 27 MENU .COM 4K 27 8CED 3.2 -; 28 MENUCK .COM 3K 20 3CDC 1.0 -; 29 MKDIR .COM 6K 41 014B 3.0 -; 30 NOTE .COM 1K 1 CB9E 1.0 -; 31 PAGE .COM 5K 36 DF9F 2.0 -; 32 PATH .COM 2K 10 E421 3.0 -; 33 PRINT .COM 6K 42 0492 2.0 -; 34 PROTECT .COM 4K 28 A130 3.0 -; 35 PWD .COM 1K 8 2B9B 1.0 -; 36 QUIET .COM 1K 4 DF6B 1.0 -; 37 RECORD .COM 1K 8 C2B4 3.0 -; 38 REG .COM 1K 8 1CC4 1.0 -; 39 RENAME .COM 4K 27 A2F2 3.0 -; 40 SAK .COM 1K 7 7842 2.0 -; 41 SETFILE .COM 1K 4 00B2 1.0 -; 42 SH .COM 4K 28 A89E 1.0 -; 43 SHCTRL .COM 1K 7 E37A 1.0 -; 44 SHDEFINE.COM 3K 23 0DEA 1.0 -; 45 SHFILE .COM 1K 4 634F 1.0 -; 46 SHOW .COM 8K 62 808A 1.0 -; 47 SHVAR .COM 3K 23 4D89 1.0 -; 48 SUB .COM 3K 20 59E5 3.0 -; 49 TCCHECK .COM 2K 14 7235 1.0 -; 50 TCMAKE .COM 6K 47 B3A0 1.0 -; 51 TCSELECT.COM 3K 22 7C29 1.0 -; 52 UNERASE .COM 2K 13 5057 1.0 -; 53 WHEEL .COM 2K 11 0CD0 3.0 -; 54 XD .COM 4K 28 465B 1.2 -; 55 XDIR .COM 8K 62 7248 2.0 -; 56 Z3INS .COM 2K 16 DFB7 1.0 -; 57 Z3LOC .COM 1K 7 A908 1.0 -; 58 ZEX .COM 6K 48 5E36 3.0 -; -; Installation Begins -- -; -; 1. General-Purpose Utilities -; -comment.com -crc.com -diff.com -dir.com -echo.com -erase.com -findf.com -mcopy.com -page.com -print.com -protect.com -rename.com -unerase.com -xd.com -xdir.com -; -; 2. System-Specific Utilities -; -cmdrun.com -cpsel.com -dev.com -device.com -ldr.com -path.com -quiet.com -record.com -reg.com -sak.com -setfile.com -shctrl.com -wheel.com -z3loc.com -; -; 3. Script-Oriented Utilities -; -alias.com -menu.com -menuck.com -; -; 4. Error Handlers -; -error1.com -error2.com -error3.com -error4.com -errorx.com -show.com -; -; 5. Command File Utilities -; -goto.com -sub.com -zex.com -; -; 6. Named Directory Utilities -; -cd.com -mkdir.com -pwd.com -; -; 7. HELP System -; -help.com -helpck.com -helppr.com -; -; 8. SH -; -sh.com -shdefine.com -shfile.com -shvar.com -; -; 9. TCAP -; -tccheck.com -tcmake.com -tcselect.com -; -; 10. IF -; -if.com -ifstat.com -; -; 11. NOTE is not installable due to its size, but that's OK -; since it does not use any ZCPR3-specific features -; -;note.com -; -; 12. Z3INS -; -z3ins.com -; -; End of Installation -; - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ZCPR3.IQS b/Source/Images/d_bp/u15/ZCPR3.IQS deleted file mode 100644 index 2a103010..00000000 Binary files a/Source/Images/d_bp/u15/ZCPR3.IQS and /dev/null differ diff --git a/Source/Images/d_bp/u15/ZCPR3DIR.BQG b/Source/Images/d_bp/u15/ZCPR3DIR.BQG deleted file mode 100644 index a4f5aa07..00000000 Binary files a/Source/Images/d_bp/u15/ZCPR3DIR.BQG and /dev/null differ diff --git a/Source/Images/d_bp/u15/ZCPR3DIR.BUG b/Source/Images/d_bp/u15/ZCPR3DIR.BUG deleted file mode 100644 index b5499f0a..00000000 --- a/Source/Images/d_bp/u15/ZCPR3DIR.BUG +++ /dev/null @@ -1,99 +0,0 @@ -December 18, 1984 - -Resident command 'DIR' fix in ZCPR3 and SYSRCP.ASM - -Greetings all -- I have stumbled (truly!) upon a distasteful, though not -essentially serious bug in both ZCPR3.ASM and the SYSRCP.ASM segment. -Fortunately (more for me than for you) a fix is easy and works 100%. In my -immodesty I used my name as a label for the fix. I hope that some soul, -hopefully Richard Conn in the next update to ZCPR3 will correct the bug in his -imminently elegant way and get rid of my fix in the process. - -I am probably one of the few folks who likes the resident DIR command, but I -surely wanted to limit the use of the DIR flags to those who know which -characters I use to invoke the DIR only, DIR and SYS files both, and the SYS -files only. In the RELEASE version of ZCPR3 and SYSRCP.ASM, the (SYS and DIR) -flag is tested for absolutely, but the (SYS only) flag is inappropriately -tested for, and if not found, then the (SYS and DIR) flag is assumed to have -been used, and the whole directory, SYS and DIR, is displayed. Try it; if you -type 'DIR *.* $' or any other character in place of the '$', the entire -directory, including SYS files will be displayed. I merely made the SYS only -flag testing an absolute, and when it failed, then automatically reverted to -the DIR only mode. Section 5A from the SYSRCP.ASM file follows (the ZCPR3 -section 5A is almost the same, and the area for modification is identical, as -is the fix....) - -Bucky Carr, SYSOP, World Peace RCP/M, Denver, 303-320-4822, 300/1200, 24 hrs - -By the way, my highest compliments to Richard Conn (and the rest of the public -domain programming community) for their immeasurable contributions to society -via computing. - - -;Section 5A -;Command: DIR -;Function: To display a directory of the files on disk -;Forms: -; DIR Displays the DIR files -; DIR S Displays the SYS files -; DIR A Display both DIR and SYS files -;Notes: -; The flag SYSFLG defines the letter used to display both DIR and -; SYS files (A in the above Forms section) -; The flag SOFLG defines the letter used to display only the SYS -; files (S in the above Forms section) -; The flag WIDE determines if the file names are spaced further -; apart (WIDE=TRUE) for 80-col screens -; The flag FENCE defines the character used to separate the file -; names -; - IF DIRON -DIR: -; -; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED -; - IF WDIR - CALL WHLTST - ENDIF ;WHEEL APPROVAL -; - CALL RETSAVE ;SAVE RET ADDRESS AND SET STACK - LXI H,FCB1+1 ;MAKE FCB WILD (ALL '?') IF NO FILENAME.TYP - MOV A,M ;GET FIRST CHAR OF FILENAME.TYP - CPI ' ' ;IF , ALL WILD - CZ FILLQ - LDA FCB2+1 ;GET FIRST CHAR OF 2ND FILE NAME - MVI B,80H ;PREPARE FOR DIR-ONLY SELECTION - CPI ' ' ;ANY FLAG? - JRZ DIRPR ;THERE IS NO FLAG, SO DIR ONLY - MVI B,1 ;SET FOR BOTH DIR AND SYS FILES - CPI SYSFLG ;SYSTEM AND DIR FLAG SPECIFIER? - JRZ DIRPR ;GOT SYSTEM SPECIFIER - CPI SOFLG ;SYS ONLY? -; -; ---> the fix begins here <--- -; - JRZ BUCKY ;it was the SYS only flag, exactly! - MVI B,80H ;NOT the SYS flag either, so default to DIR only - JR DIRPR ;and do the directory as requested. -; -; ---> commented out the next two lines of original code <--- -; -; JRNZ DIRPR -; DCR B ;B=0 FOR SYS FILES ONLY -; -; ---> added the 'SYS flag ok' routine here <--- -; -BUCKY: MVI B,0 ;as described below, if SYS only=true then reg B=0 - JR DIRPR ;now go on with the dirpr routine. -; -; ---> that ends the fix <--- - - ENDIF ;DIRON -; -; DIRECTORY PRINT ROUTINE; ON ENTRY, B REG IS SET AS FOLLOWS: -; 0 FOR ONLY SYSTEM FILES, 80H FOR ONLY DIR FILES, 1 FOR BOTH -; - IF DIRON OR ERAON OR LTON OR PROTON OR CPON OR RENON -DIRPR: - MOV A,B ;GET SYSTST FLAG - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ZEX.AQM b/Source/Images/d_bp/u15/ZEX.AQM deleted file mode 100644 index 799e0201..00000000 Binary files a/Source/Images/d_bp/u15/ZEX.AQM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ZEX.ASM b/Source/Images/d_bp/u15/ZEX.ASM deleted file mode 100644 index 9ce02a2e..00000000 --- a/Source/Images/d_bp/u15/ZEX.ASM +++ /dev/null @@ -1,2286 +0,0 @@ -; -; PROGRAM: ZEX -; AUTHOR: RICHARD CONN (DERIVED FROM EX, WHICH WAS WRITTEN BY SOMEONE ELSE) -; VERSION: 3.1 -; DATE: 24 Oct 84 -; PREVIOUS VERSIONS: 3.0 (8 Mar 84) -; -VERS EQU 31 -Z3ENV EQU 0F400H - -; -; ZEX 3.1 -- Richard Conn -; Does not require to be reassembled for a target system; Z3INS -; installation is sufficient -; ZEX 3.0 -- Derived from ZEX 1.3 for ZCPR3 by Richard Conn -; Extensions to ZEX 1.3 are: -; ZCPR3 Message Passing Employed -; ZCPR3 Structure -; Omitted Parameters Allowed -; Print Suppression During FALSE IFs (^&) -; -; ZEX 1.0 -- EX 1.2.1 implemented for ZCPR2 by Richard Conn -; DATE: 12 NOV 82 -; Extensions to EX are: -; Multiple command buffer is preserved, and any commands -; following the ZEX command are executed after -; the ZEX command file is completed (ZEX T;DIR -; will execute commands in T.SUB and then run DIR) -; ZCPR3 Search Path is following when looking for the -; file specified to ZEX -; Command File Type may be SUB or ZEX -; Added ^* form to simply ring the bell -; Added ^/ form to act like ^? but ring bell periodically -; Added ^" form to allow user input in the middle of a -; command file operation -; Major rewrite of EX to improve readability and to impose -; a structured organization on the code for maintenance -; purposes -; Major change in the abort system so that the multiple command -; line buffer of ZCPR3 will be properly cleared on -; abort; without this change, ZEX would crash the system -; in attempting to abort out of the ^/ and ^? forms; -; EX will probably always crash a ZCPR3 system with -; multiple commands enabled if an abort from ^? is -; attempted -; -; EX12.ASM - An enhanced version of EXEC and EX. -; -; START 05-09-82 -; -; DATE 08-11-82 *LAST MAJOR CHANGE -; -; HISTORY: -; -; ZEX 1.0 11-12-82 modify for use under ZCPR2; main change is to place -; rest of multiple command line at end of SUB file -; -; 1.2.1 09-16-82 fix for MBASIC execution under EX 1.2 . -; -; 1.2 08-11-82 added '^:' EX runtime re-execute logic function, -; '^?' EX runtime wait for carriage return, -; logic to prevent input/EX buffer overlap, -; logic to insure (Xsub Already Present), -; logic to prevent EX runtime recursion loop, -; and prompt character logic [Larry Steeger] -; -; 1.1 08-06-82 added ';;' EX comment's support, -; '^.' print suppression function, -; '^<...^>' immediate display support, -; '^#' EX message suppression function, -; '^$' default parameter support, -; and '^|' cr,lf generation function [Larry Steeger] -; -; 1.0 08-03-82 corrected $^ error and ^ error [Larry Steeger] -; -; ? 06-19-82 added missing TRUE and FALSE equates [Ron Fowler] -; -; ? 05-17-82 corrected last cold boot no active message -; - -; -; EX12.COM IS AN ENHANCEMENT OF EXEC.COM AND EX.COM -; -; OPTIONS: -; -; EX cr -; -; EX cr -; -; ^ WILL GIVE CONTROL CHARACTER -; -; | WILL BE CR -; -; ^| WILL BE CR,LF -; -; ^: WILL CAUSE ZEX TO RE-EXECUTE THE .SUB FILE FROM THE BEGINNING -; -; ^? WILL CAUSE ZEX TO WAIT FOR A CARRIAGE RETURN -; (^C WILL ABORT ZEX AT THIS POINT ALSO) -; -; ^/ WILL CAUSE ZEX TO RING THE BELL AND WAIT FOR A CARRIAGE RETURN -; (^C WILL ABORT ZEX AT THIS POINT ALSO) -; -; ^* WILL CAUSE ZEX TO RING THE BELL -; -; ^" WILL CAUSE ZEX TO STOP PROVIDING INPUT UNTIL THE ZCPR3 MESSAGE -; CONTROLLING ZEX IS CHANGED TO PERMIT CONTINUATION -; -; ^$ WILL CAUSE THE REST OF THE LINE TO BE TREATED AS A -; SET OF DEFAULT PARAMETERS SEPARATED BY BLANKS TO BE -; USED IF THE USER HAS NOT PROVIDED ONE ON ZEX'S COMMAND LINE. -; -; ^# WILL TOGGLE PRINT SUPPRESSION OF ZEX MESSAGES -; -; ^. WILL START PRINT SUPPRESSION OF ALL CHARACTERS -; FROM .SUB FILE UNTIL A SUBSEQUENT ^. IS ENCOUNTERED -; -; ^& WILL INSTRUCT ZEX TO SUPPRESS PRINT IF WITHIN A FALSE IF -; -; ;; WILL INDICATE THAT THE ;; AND ALL CHARACTERS FOLLOWING IT -; UNTIL A LF IS ENCOUNTERED ARE NOT INCLUDED IN ZEX'S -; TEXT BUFFER -; (I.E. A ZEX ONLY COMMENT) -; -; ^< WILL START IMMEDIATE DISPLAY OF CHARACTERS FROM -; THE .SUB FILE UNTIL ^> IS ENCOUNTERED -; (I.E. DISPLAY ONLY .SUB INPUT) -; -; $<1-9> WILL REPLACE PARAMETER<1-9> IN TEXT FROM THE COMMAND LINE -; -; $$ WILL GIVE $ -; -; $^ WILL GIVE ^ -; -; $| WILL GIVE | -; -; |,cr,lf,1ah will eat last from | to end of buffer -; -; ^C FROM CONSOLE WILL ABORT ZEX -; - -FALSE EQU 0 -TRUE EQU NOT FALSE - -; -; OFFSETS TO ZCPR3 ENVIRONMENT DESCRIPTOR ELEMENTS -; -EPOFF EQU 9 ;EXTERNAL PATH DATA -MCOFF EQU 24 ;COMMAND LINE DATA -Z3MOFF EQU 34 ;MESSAGE BUFFER - -; -; GENERAL EQUATES -; -BELL EQU 7 -CTRLZ EQU 1AH ;^Z -DELAY EQU 6000H ;DELAY CONSTANT FOR TIMER LOOP -BS EQU 'H'-'@' ;BACKSPACE -CR EQU 0DH -LF EQU 0AH - -; -; ZEX MONITOR COMMAND BYTES -; -PSUP EQU 80H ;^. PRINT SUPPRESS FLAG -IMON EQU 81H ;^< IMMEDIATE MODE START -IMOFF EQU 82H ;^> IMMEDIATE MODE STOP -MSUP EQU 83H ;^# ZEX MESSAGE SUPPRESS FLAG -CRWAIT EQU 84H ;^? ZEX RUNTIME WAIT FOR CR FLAG -REXEC EQU 85H ;^: ZEX RUNTIME RE-EXECUTE FLAG -CRBWAIT EQU 86H ;^/ ZEX RUNTIME RING BELL AND WAIT FOR CR FLAG -RNG EQU 87H ;^* ZEX RUNTIME RING BELL -UICH EQU 88H ;^" USER INPUT COMMAND CHAR SEQUENCE -IPS EQU 89H ;^& FALSE IF PRINT SUPPRESS -; -; CP/M CONSTANTS -; -WARM EQU 0 -BDISK EQU 4 -BDOS EQU 5 -DFCB EQU 5CH -BUFF EQU 80H -; -; NOTE: ZEX30.LIB IS CREATED BY THE ZEX30.ZEX GENERATION PROCESS -; - MACLIB ZEX30 -; -$-PRINT - IF ZEXBASE -$+PRINT -; -; START OF ZEX INITIATOR CODE SEGMENT -; - ORG 100H -; -; Environment Definition -; - if z3env ne 0 -; -; External ZCPR3 Environment Descriptor -; - jmp start - db 'Z3ENV' ;This is a ZCPR3 Utility - db 1 ;External Environment Descriptor -z3eadr: - dw z3env -start: - lhld z3eadr ;pt to ZCPR3 environment -; - else -; -; Internal ZCPR3 Environment Descriptor -; - MACLIB SYSENV.LIB -z3eadr: - jmp start - SYSENV -start: - lxi h,z3eadr ;pt to ZCPR3 environment - endif - -; -; Start of Program -- Initialize ZCPR3 Environment -; - call z3init ;initialize the ZCPR3 Env - JMP START0 -; -; INITIAL COMMAND LINE AREA -; - DB 0FFH ;SIZE OF COMMAND LINE -DBUFF EQU $ - DB 0FFH ;SIZE OF BUFFER - DS 100H ;SPACE FOR COMMAND LINE -; -; START OF ZEX -; -START0: - NOP ;REPLACED WITH RET TO PREVENT REENTRY - LDA DFCB+1 ;CHECK FOR HELP REQUEST - CPI '/' ;HELP? - JZ HELP - LXI H,0 - DAD SP - SHLD CCPSTK ;CCP STACK PTR - LXI SP,CCPSTK ;USER STACK AREA - MVI A,0C9H ; (8080 RET) - STA START ;PREVENT RE-ENTRANCE BY ZCPR - LXI H,BUFF ;COPY INPUT LINE INTO DBUFF - LXI D,DBUFF - MVI B,128 ;SIZE OF BUFFER - CALL MOVE - LXI D,SIGNON ;LOGO - CALL PRINT - CALL ZEXACTV ;CHECK FOR RECURSION - CALL ZRELOC ;RELOCATE ZEX MODULE - CALL ZPARMS ;EXTRACT PARAMETERS FROM COMMAND LINE - LDA DFCB+1 ;CHECK TO SEE IF SUB FILE PRESENT - CPI ' ' ;=NO - PUSH PSW ;SAVE FLAG - CNZ OPENSB ;OPEN AND LOAD ZEX FILE IF PRESENT OR ABORT - POP PSW ;GET FLAG - CZ INPUTSB ;INPUT COMMANDS FROM USER -; -; HL NOW POINTS TO BYTE AFTER LOADED TEXT -; - CALL ZMCL ;STORE REST OF MULTIPLE COMMAND LINE - CALL ZLINES ;COPY AND PROCESS COMMAND LINES -; -; SET UP FOR ZEX EXECUTION AND RUN; HL PTS TO BOTTOM OF DATA AREA -; - PUSH H ;SAVE PTR TO END OF DATA - LHLD RELSTRT ;GET PTR TO START OF ZEX - SHLD GOADR ;SET ADDRESS TO RUN TO - DCX H ;PT TO START OF DATA AREA - MVI B,09H ;MESSAGE OFFSET - CALL MSHLD ;STORE HL THERE (NEXT CHAR FOR ZEX) - MVI B,0BH ;MESSAGE OFFSET - CALL MSHLD ;STORE HL THERE (FIRST CHAR FOR ZEX) - MVI A,0FFH ;SET ZEX RUNNING FLAG - MVI B,08H ;MESSAGE OFFSET - CALL MSTA ;STORE A THERE (ZEX IS RUNNING) - POP H ;HL IS PTR TO END OF DATA - MOV M,A ;SET UP END OF DATA - DCX H - LDA BDOS+2 ;SET UP BDOS JUMP TO PROTECT DATA - MOV M,A - DCX H - LDA BDOS+1 - MOV M,A - DCX H - MVI M,JMP - SHLD BDOS+1 ;SET NEW BDOS ADDRESS - LXI H,0 ;ASSUME NO MULTIPLE COMMANDS - LDA MCAVAIL ;GET FLAG - ORA A ;0=NONE - JZ GOTOZEX ;NO MULTIPLE COMMANDS, SO BC=0 - LHLD MCADR ;GET ADDRESS OF MULTIPLE COMMAND BUFFER -; -; ZEX MONITOR ENTRY PARAMETERS -- -; HL ADDRESS OF MULTIPLE COMMAND BUFFER OR 0 IF NONE -; -GOTOZEX: - XCHG ;SAVE HL - LHLD Z3MSGA ;GET ADDRESS OF MESSAGES ... - XCHG ; ... IN DE - -GOADR EQU $+1 - JMP $ - -; -; INIT ZCPR3 ENVIRONMENT -; -Z3INIT: - PUSH H ;SAVE PTR TO ENVIRONMENT - PUSH H - LXI D,Z3MOFF ;OFFSET TO MESSAGE BUFFER - DAD D - MOV A,M ;GET LOW - INX H - MOV H,M ;GET HIGH - MOV L,A ;HL IS ADDRESS OF MESSAGES - SHLD Z3MSGA ;SAVE ADDRESS - POP H - LXI D,MCOFF ;OFFSET TO CL DATA - DAD D - MOV E,M ;GET CL ADDRESS - INX H - MOV D,M - INX H ;GET CL SIZE - MOV A,M - ORA D ;IF ALL THREE VALUES ARE 0, THEN NO COMMAND LINE - ORA E - STA MCAVAIL ;SET AVAILABLE FLAG - XCHG ;HL PTS TO CL - SHLD MCADR - POP H ;GET PTR TO ENVIRONMENT - LXI D,EPOFF ;OFFSET TO EXTERNAL PATH DATA - DAD D - MOV E,M ;GET EXTERNAL PATH ADDRESS - INX H - MOV D,M - MOV A,D ;CHECK FOR ANY - ORA E - STA EPAVAIL ;SET AVAILABLE FLAG - XCHG - SHLD EPADR ;SET ADDRESS - RET -; -; Z3INIT BUFFERS -; -INTPATH: ;INTERNAL PATH - DB 1,0 ;DISK A, USER 0 - DB 0,0 ;END OF PATH -Z3MSGA: ;ADDRESS OF MESSAGES - DW 0 -MCAVAIL: ;MULTIPLE COMMAND LINE DATA - DB 0 -MCADR: - DW 0 -EPAVAIL: ;EXTERNAL PATH DATA - DB 0 -EPADR: - DW 0 - -; -; PRINT HELP MESSAGE FOR ZEX -; -HELP: - LXI D,SIGNON ;PRINT BANNER - CALL PRINT - LXI H,HMSG ;PRINT MESSAGE - CALL HPRINT - MVI C,1 ;GET CHAR - CALL BDOS - CPI 'C'-'@' ;^C? - RZ - LXI D,CRLFS - CALL PRINT - LXI D,SIGNON - CALL PRINT - LXI H,HMSG1 -HPRINT: - MOV A,M ;GET CHAR - ORA A ;DONE? - RZ - INX H ;PT TO NEXT - PUSH H ;SAVE PTR - MOV E,A ;CHAR IN E - MVI C,2 ;CONSOLE OUTPUT - CALL BDOS - POP H ;GET PTR - JMP HPRINT - -HMSG: - DB CR,LF,'ZEX Syntax:' - DB CR,LF,' ZEX ' - DB CR,LF,'or' - DB CR,LF,' ZEX' - DB CR,LF - DB CR,LF,'The first form executes the indicated command file' - DB CR,LF,'( may be of type ZEX or SUB, and if a ZEX and' - DB CR,LF,'SUB both exist, the ZEX file is used), passing to it' - DB CR,LF,'the parameters, similar to the way SUBMIT is used.' - DB CR,LF - DB CR,LF,'The second form allows the user to enter commands.' - DB CR,LF,'ZEX presents the user with a prompt like "n:", where' - DB CR,LF,'n is a line number, and the user may type in a command' - DB CR,LF,'line. Input is terminated by simply striking the' - DB CR,LF,'RETURN key (empty input line).' - DB CR,LF - DB CR,LF,'ZEX can be aborted by ^C from console.' - DB CR,LF - DB CR,LF,' Strike Any Key to Continue, ^C to Abort - ',0 - -HMSG1: - DB CR,LF - DB CR,LF,'ZEX supports an enhanced command processing facility' - DB CR,LF,'which recognizes the following commands. These may be' - DB CR,LF,'embedded in the text of the command file or user' - DB CR,LF,'input and will be executed after processing begins.' - DB CR,LF - DB CR,LF,' Cmd Meaning Cmd Meaning' - DB CR,LF,' | insert ^| insert ' - DB CR,LF,' ^: rerun command file ^. suppress print of chars' - DB CR,LF,' ^# toggle ZEX msgs ^$ define default params' - DB CR,LF,' ^? wait for user ^/ ring and wait for ' - DB CR,LF,' ^* ring bell ^" allow user input' - DB CR,LF,' ^< display chars only ^> stop display' - DB CR,LF,' ;; ZEX comment $n 1<=n<=9 for param' - DB CR,LF,' $$ =$ $^ =^' - DB CR,LF,' $| =| ^c insert ctrl char c' - DB CR,LF,CR,LF,0 - - -; -; RELOCATE ZEX MODULE INTO HIGH MEMORY JUST BELOW ZCPR3 -; -ZRELOC: - LHLD RELOCL ;GET RELOC PROGRAM LENGTH - MOV B,H ;BC=HL=RELOC PROGRAM LENGTH - MOV C,L - PUSH B ;SAVE LENGTH FOR FUTURE USE - LHLD BDOS+1 ;GET BASE - LXI D,-806H ;GET BEFORE CCP - DAD D - MOV A,L ;SUBTRACT RELOC LENGTH - SUB C - MOV E,A - MOV A,H - SBB B - MOV D,A - PUSH D ;SAVE NEW TOP/START TO MOVE TO - LXI H,BEGREL ;START OF MOVE -OMOVE: - MOV A,B - ORA C - JZ MOVEND - DCX B - MOV A,M - STAX D - INX D - INX H - JMP OMOVE -; -MOVEND: - POP D ;GET START OF MOVED PROGRAM - POP B ;LENGTH OF MOVE PROGRAM - PUSH D ;SAVE PTR TO START OF PROGRAM - PUSH H ;START OF BIT MAP - MOV H,D ;MSB OFFSET - MOV L,E ;LSB OFFSET -OFFLUP: - MOV A,B ;TEST LENGTH - ORA C ;IF 0 - JZ GOTO ;JUMP TO RELOCATED PROGRAM - DCX B ;DECREMENT COUNT - LDA COUNT - INR A - STA COUNT - ANI 07H - JNZ OFFBIT ;NO - XTHL ;YES, GET BIT MAP - MOV A,M ;GET NEXT BYTE - INX H ;INCREMENT BIT MAP POINTER - XTHL ;SAVE FOR LATER - STA BITMAP ;KEEP BIT OFFSET -OFFBIT: - LDA BITMAP - RAL ;TEST FOR OFFSET - STA BITMAP ;SAVE NEW BYTE - JNC NOFSET ;NO - DCX D ;GET BACK TO LSB - LDAX D - ADD L - STAX D - INX D ;MSB - LDAX D ;YES - ADC H ;ADD IN OFFSET - STAX D ;PUT IN MOVED PLACE -NOFSET: - INX D ;INCREMENT MOVED POINTER - JMP OFFLUP ;CONTINUE WITH RELOCATE -; -GOTO: - POP D ;RESTORE STACK - POP H ;PT TO FIRST BYTE OF PROGRAM - SHLD RELSTRT ;SAVE PTR - DCX H ;RELOCATE PROGRAM-1 - SHLD OUTBUF ;SAVE PTR TO BYTE IN FRONT OF RELOCATED PROGRAM - RET -; -; GET PARAMETERS FROM COMMAND LINE -; TERMINATE EACH PARAMETER WITH A BINARY ZERO, AND SET POINTERS -; TO EACH PARAMETER -; -ZPARMS: - LXI D,DBUFF ;TERMINATE COMMAND LINE WITH CR - LDAX D ;GET CHAR COUNT - INX D ;PT TO FIRST CHAR - PUSH D - MOV L,A ;HL = NUMBER OF CHARS IN LINE - MVI H,0 - DAD D ;PT TO AFTER LAST CHAR - MVI M,CR ;STORE - LXI H,PRMDMY ;START AT DUMMY PARAMETER FOR .SUB FILE SPEC - PUSH H - LXI B,PRMPNL+2 - XRA A - CALL FILL ;CLEAR PTR AREA - POP H ;GET PTR TO POINTER FOR PARAMETER 0 - POP D ;GET PTR TO FIRST CHAR IN LINE - MVI A,(PRMPNL/2)+1 ;NUMBER OF PARAMETERS POSSIBLE, MAX - STA PRMMAX ;HIGHEST PARAMETER # + 1 for .SUB SPEC -; -; PARAMETER EXTRACTION ROUTINE; HL PTS TO FIRST PARAM PTR, DE PTS TO LINE -; -PARMS: - MVI B,0 ;CLEAR PARAMETER COUNTER - XCHG - SHLD ERRLNE ;SAVE IN CASE OF ERROR - XCHG -; -PARMSL: - LDAX D ;IGNORE LEADING SPACES - INX D - CPI CR - JZ ENDLNE - CPI ' ' - JZ PARMSL - DCX D ;BACK UP TO 1ST CHAR - MOV M,E ;SAVE ADDRESS IN TABLE - INX H - MOV M,D - INX H - INR B ;COUNT+1 - LDA PRMMAX - CMP B - JC PRMTOO ;TOO MANY ARGUMENTS -; -ENDPRM: - LDAX D ;GO TO END OF PARAMETER - INX D - CPI CR - JZ ENDLNE - CPI ' ' ;SKIP UNTIL - JNZ ENDPRM - XRA A ;A=0 TO TERMINATE PARAM - DCX D ;PT TO FOLLOWING PARAM - STAX D ;TERMINATE PARAMETER - INX D ;PT TO CHAR AFTER - JMP PARMSL ;IGNORE SPACES BETWEEN PARAMETERS -ENDLNE: - XRA A ;STORE ZERO AFTER LAST PARAMETER - DCX D ;PT TO CR - STAX D ;TERMINATE LAST PARAMETER - INX D ;PT TO AFTER LAST PARAM - MVI A,CR ;STORE ENDING CR - STAX D - RET -; -; INPUT COMMAND LINES FROM USER -; -INPUTSB: - LXI H,0 - SHLD LINES ;START LINE COUNTER - MVI A,0FFH ;SET BUFFER LENGTH - STA DBUFF-1 - LXI H,BEGREL ;SET UP OUTPUT BUFFER - SHLD INBUF -GETLIN: - CALL CRLF - LHLD LINES - INX H - SHLD LINES - CALL DECOUT ;PRINT LINE # - MVI E,':' ;GET PROMPT - CALL OUTCHR - MVI E,' ' - CALL OUTCHR - LXI D,DBUFF-1 - MVI C,10 ;READ CONSOLE BUFFER - CALL BDOS - LXI D,DBUFF - LDAX D ;GET LENGTH - MOV B,A - INX D - LHLD INBUF ;GET INPUT POINTER - ORA A ;SEE IF END - RZ ;DONE WITH INPUT - XCHG - CALL MOVE ;MOVE TO INPUT BUFFER - XCHG - MVI M,CR - INX H - MVI M,LF - INX H - SHLD INBUF - JMP GETLIN -; -; OPEN AND LOAD SUB FILE -; -OPENSB: - CALL PUTUD ;SAVE USER/DISK -; -; SET UP TO READ ZEX FILE -; - LXI D,DFCB+9 - LXI H,ZEXNAM ;MOVE 'SUB' TO DFCB FILE TYPE - MVI B,3 - CALL MOVE - XRA A ;ZERO CR FIELD - STA DFCB+32 - LXI D,BUFF ;SET DMA ADDRESS - MVI C,26 ;SET DMA - CALL BDOS - LXI D,DFCB - LXI H,INTPATH ;PT TO INTERNAL PATH - LDA EPAVAIL ;EXTERNAL PATHS AVAILABLE? - ORA A ;0=NO - JZ OSB1 ;USE INTERNAL PATH - LHLD EPADR ;PT TO EXTERNAL PATH -OSB1: - PUSH H ;SAVE PATH PTR - CALL FNDFILE ;LOOK FOR FILE ALONG PATH AND SAY IF IT IS FOUND - POP H ;GET PATH PTR - JNZ READSB -; -; ZEX FILE NOT FOUND -- SET UP TO READ SUB FILE -; - PUSH H ;SAVE PATH PTR - CALL GETUD ;RESTORE USER/DISK - LXI D,DFCB+9 ;SET TYPE TO SUB - LXI H,SUBNAM - MVI B,3 - CALL MOVE - XRA A ;ZERO CR FIELD - STA DFCB+32 - POP H ;PT TO PATH - LXI D,DFCB ;PT TO FCB - CALL FNDFILE ;LOOK FOR FILE - JNZ READSB -RSBERR: - CALL GETUD ;RESTORE USER/DISK - LXI H,NOSBF2 - LXI D,DFCB+1 - MVI B,8 ;NAME LENGTH - CALL MOVEFN ;MOVE FILE NAME - MVI B,3 ;TYPE LENGTH - MVI M,'.' - INX H - LXI D,DFCB+9;FILE TYPE POINTER - CALL MOVEFN ;MOVE FILE TYPE - MVI M,'$' ;END TERMINATER - JMP NOSUB -* -* FNDFILE -- LOOK FOR FILE ALONG ZCPR3 PATH -* INPUT PARAMETERS: HL = BASE ADDRESS OF PATH, DE = PTR TO FCB OF FILE -* OUTPUT PARAMETERS: A=0 AND ZERO FLAG SET IF NOT FOUND, NZ IF FOUND -* -FNDFILE: - SHLD PATH ;SAVE PATH BASE ADDRESS - MVI C,17 ;SEARCH FOR FIRST - CALL BENTRY ;LOOK FOR FILE - INR A ;SET FLAG - JNZ FF5 ;FOUND IT -- RETURN FOUND FLAG - XCHG ;HL=FCB PTR - SHLD FCBPTR ;SAVE IT - LHLD PATH ;PT TO PATH FOR FAILURE POSSIBILITY - MVI C,32 ;GET CURRENT USER - MVI E,0FFH - CALL BENTRY - STA TMPUSR ;SAVE IT FOR LATER -; -; MAIN SEARCH LOOP -; -FF1: - MOV A,M ;GET DRIVE - ANI 7FH ;MASK MSB - ORA A ;0=DONE=COMMAND NOT FOUND - JNZ FF2 ;NO ERROR ABORT? -; -; FILE NOT FOUND ERROR -; - XRA A ;ZERO FLAG MEANS NOT FOUND - RET -; -; LOOK FOR COMMAND IN DIRECTORY PTED TO BY HL; DRIVE IN A -; -FF2: - MOV E,A ;DISK IN E - CPI '$' ;CURRENT DISK? - JNZ FF3 ;SKIP DEFAULT DRIVE SELECTION IF SO - LDA BDISK ;GET DEFAULT USER/DISK - ANI 0FH ;MASK FOR DEFAULT DISK - INR A ;PREP FOR FOLLOWING DCR A - MOV E,A ;DISK NUMBER IN E -FF3: - DCR E ;ADJUST PATH 1 TO 0 FOR A, ETC - MVI C,14 ;SELECT DISK FCT - CALL BENTRY ;SELECT DRIVE - INX H ;PT TO USER NUMBER - MOV A,M ;GET USER NUMBER - ANI 7FH ;MASK OUT MSB - INX H ;PT TO NEXT ENTRY IN PATH - PUSH H ;SAVE PTR - MOV E,A ;SAVE IN E - CPI '$' ;MATCH? - JNZ FF4 ;DO NOT SELECT CURRENT USER IF SO - LDA TMPUSR ;GET ORIGINAL USER NUMBER - MOV E,A ;SELECT USER -FF4: - MVI C,32 - CALL BENTRY - LHLD FCBPTR ;GET PTR TO FCB - XCHG ;... IN DE - MVI C,17 ;SEARCH FOR FIRST - CALL BENTRY ;LOOK FOR FILE - POP H ;GET PTR TO NEXT PATH ENTRY - INR A ;SET FLAG - JZ FF1 ;CONTINUE PATH SEARCH IF SEARCH FAILED -; -; FILE FOUND -- PERFORM SYSTEM TEST AND PROCEED IF APPROVED -; -FF5: - MVI A,0FFH ;SET OK RETURN - ORA A - RET - -; -; BDOS ROUTINE -; -BENTRY: - PUSH H ;SAVE REGS - PUSH D - PUSH B - CALL BDOS - POP B ;GET REGS - POP D - POP H - RET - -* BUFFERS -FCBPTR: - DS 2 ;POINTER TO FCB FOR FILE SEARCH -TMPUSR: - DS 1 ;CURRENT USER NUMBER -PATH: - DS 2 ;BASE ADDRESS OF PATH -; -; PUTUD -- SAVE AWAY CURRENT USER/DISK -; GETUD -- RESTORE CURRENT USER/DISK -; -PUTUD: - MVI E,0FFH ;GET CURRENT USER - MVI C,32 ;BDOS - CALL BDOS - STA CUSER ;SAVE CURRENT USER AWAY - MVI C,25 ;GET CURRENT DISK - CALL BDOS - STA CDISK - RET -GETUD: - LDA CDISK ;GET CURRENT DISK - MOV E,A ;... IN E - MVI C,14 ;SELECT DISK - CALL BDOS - LDA CUSER ;GET CURRENT USER - MOV E,A ;... IN E - MVI C,32 ;SELECT USER - CALL BDOS - RET -CDISK: - DS 1 ;CURRENT DISK NUMBER -CUSER: - DS 1 ;CURRENT USER NUMBER -; -; OPEN AND READ SUB FILE -; -READSB: - MVI C,15 ;OPEN FILE - CALL BDOS ;BDOS - INR A ;ERROR? - JZ RSBERR -; -; READ IN AND STORE SUB FILE -; -READTX: - LHLD INBUF ;GET PTR TO NEXT BYTE - XCHG ;SET PTR IN DE - LXI H,80H ;GET SECTOR OFFSET - DAD D ;HL PTS TO FOLLOWING BLOCK TO BE READ, DE PTS TO - SHLD INBUF ; BLOCK TO READ; SAVE PTR TO FOLLOWING BLOCK - MVI C,26 ;SET DMA ADDRESS - CALL BDOS - LXI D,DFCB - MVI C,20 ;READ SEQUENTIAL - CALL BDOS - ORA A - JZ READTX ;READ COMPLETE .SUB FILE - CALL GETUD ;RESTORE CURRENT USER/DISK - LHLD INBUF ;MAKE SURE BUFFER'S TERMINATED - LXI D,-100H ;PT TO FIRST BYTE OF LAST BLOCK READ - DAD D - MVI B,80H ;LOOK AT AT MOST 80H BYTES -SKIP1A: - MOV A,M ;GET BYTE - CPI CTRLZ ;EOF? - JZ SKIP1B - INX H ;PT TO NEXT - DCR B ;COUNT DOWN - JNZ SKIP1A -; HL NOW POINTS TO AFTER LAST VALID CHAR IN FILE -SKIP1B: - SHLD INBUF ;SET PTR - RET ;DONE WITH NO ERROR - -; -; THIS PART OF THE CODE STORES THE REST OF THE COMMAND LINE AS PART OF THE -; COMMAND FILE FOR ZCPR3; ON ENTRY, HL PTS TO NEXT AVAILABLE BYTE -; -ZMCL: - XCHG ;BUFFER PTED TO BY DE - LHLD MCADR ;GET BASE ADDRESS OF MULTIPLE COMMAND LINE - MOV A,M ;GET LOW - INX H - MOV H,M ;GET HIGH - MOV L,A ;HL PTS TO NEXT CHAR IN MULTIPLE COMMAND LINE - XCHG ;DE PTS TO NEXT CHAR IN COMMAND LINE, HL PTS TO BUF END - LDA MCAVAIL ;MULTIPLE COMMANDS ENABLED? - ORA A ;0=NO - JZ ENDSTR ;TERMINATE FILE; HL PTS TO NEXT BYTE - LDAX D ;GET FIRST BYTE - MOV B,A ;SAVE FIRST BYTE IN B - XRA A ;A=0 - STAX D ;CLEAR COMMAND LINE - INX D ;PT TO NEXT BYTE - MOV A,B ;GET FIRST BYTE - CPI ';' ;SEPARATION CHAR? - JNZ CMCMD1 ;PROCESS IF NOT -; -; LOOP TO STORE REST OF MULTIPLE COMMAND LINE INTO LOADED FILE -; -CMCMD: - LDAX D ;GET BYTE FROM LINE -CMCMD1: - ORA A ;EOL IF ZERO - JZ CMEND ;READ IN FILE; HL PTS TO NEXT AVAILABLE BYTE - MOV M,A ;STORE BYTE - INX H ;PT TO NEXT - INX D - JMP CMCMD -CMEND: - MVI M,CR ;STORE - INX H - MVI M,LF - INX H ;PT TO NEXT AVAILABLE BYTE -; -; MARK END OF BUFFER AND CONTINUE -; -ENDSTR: - MVI M,1AH ;EOF CHARACTER - SHLD ENDBUF ;EOB ADDRESS - MOV A,L - SUI LOW BEGREL+1 ;SEE IF BUFFER'S EMPTY - MOV A,H - SBI HIGH BEGREL - JC BUFLOW - RET -; -; COPY AND PROCESS COMMAND LINES, PLACING FINAL COMMAND LINE FORM UNDER ZEX -; RETURN WITH HL PTING TO NEXT AVAILABLE BYTE IN MEMORY BUFFER UNDER ZEX -; -ZLINES: - XRA A - STA IMFLG1 - STA IMFLG2 - STA PRTFLG - STA OUTCNT - LXI H,1 - SHLD LINES ;SET LINE COUNT - LHLD OUTBUF ;PT TO BYTE JUST BELOW LOADED ZEX - SHLD OUTLNE - SHLD BUFSTR - LXI D,BEGREL ;PT TO FIRST BYTE OF COMMAND BUFFER -; -; MAIN COPY LOOP TO COPY BUFFER AT BEGREL TO JUST UNDER ZEX WITH PROCESSING -; -MOVSTR: - LDAX D ;GET NEXT COMMAND BYTE - INX D ;PT TO FOLLOWING - ANI 7FH ;MAKE SURE NO PARITY - CPI LF ;NEW LINE? - JNZ MOVST0 -; -; NEW LINE -- DON'T STORE AND INCREMENT LINE COUNT -; -MOVSTX: - CALL INCR ;INCREMENT LINE COUNT - JMP MOVSTR ;CONTINUE -; -; BEGIN CHARACTER PROCESSING -; A CONTAINS CHAR, DE PTS TO BYTE AFTER CHAR, HL PTS TO NEXT BUFFER POS -; -MOVST0: - CPI 1AH ;END OF INPUT? - RZ ;DONE IF SO - CPI '|' ;CARRIAGE RETURN? - JNZ MOVST1 ;NOPE -; -; PROCESS CARRIAGE RETURN FORM (|) -; - PUSH D ;SAVE OLD POINTER - INX D ;LOOK FOR EOF AFTER | (PT TO LF) - INX D ;PT TO POSSIBLE EOF - LDAX D ;GET PRESENT LOCATION+2 - POP D ;GET OLD POINTER - CPI 1AH ;END OF BUFFER - RZ ;END, SO NO FOLLOWING - MVI A,CR ;MAKE CHAR A - CALL INCR ;INCREMENT LINES FOR ERRORS - JMP MOVST4 ;STORE IN A -; -; CHECK FOR NON-CR FORMS -; AT THIS POINT, DE PTS TO NEXT CHAR IN LINE AND HL PTS TO NEXT -; BYTE IN BUFFER (MOVING DOWN) -; -MOVST1: - MOV C,A ;SAVE CHAR IN C - LDA IMFLG1 - CPI IMON ;IMMEDIATE MODE ON ? - MOV A,C ;GET CHAR BACK - JZ MOVST2 ;YES..SKIP ZEX COMMENT PROCESSING - CPI ';' ;FIRST ';'? - JZ EXCOMM ;PROCESS POSSIBLE ZEX COMMENT -MOVST2: - CPI '^' ;CONTROL CHAR? - JZ MOVST5 ;CONVERT CONTROL CHARACTERS - CPI '$' ;PARAMETER OR CONTROL CHAR? - CZ GTPARM ;SUBSTITUTE COMMAND PARAMETER OR CONTROL CHAR. -MOVST3: - STA LCHR ;SAVE LAST CHAR ENTERED - CPI CR ;=CR? - JNZ MOVST4 - MOV C,A ;SAVE CHAR TEMPORARILY - LDA OUTCNT ;GET CHAR OUTPUT FLAG - ORA A ;ANY CHAR? - MOV A,C - JZ MOVSTR ;NO..USE INPUT CR ONLY IF OTHER NON-CONTROL -; CHARACTERS IN CURRENT LINE -; PLACE CHAR IN BUFFER -; CHAR IN A, HL PTS TO BUFFER LOC -; -MOVST4: - CALL CHRSTR ;ADD TO BUFFER - CALL CNTINC ;INCREMENT COUNT - JMP MOVSTR -; -; PREFIX WAS AN UPARROW (^), SO PROCESS CONTROL CHARS -; -MOVST5: - CALL GETCMD ;VALIDATE CONTROL CHARACTERS - CPI ':' - JZ REXC ;RE-EXECUTE - CPI '?' - JZ GCRW ;CR WAIT - CPI '/' - JZ GCRBW ;RING BELL AND WAIT FOR - CPI '"' - JZ UISET ;USER INPUT - CPI '*' - JZ GRNG ;CONTINUALLY RING BELL WHILE WAITING FOR - CPI '|' - JZ GCRLF ;CR,LF GENERATION - CPI '$' - JZ PRMDEF ;DEFAULT PARAMETERS' LINE - CPI '.' - JZ PRTSUP ;PRINT SUPPRESS TOGGLE - CPI '#' - JZ MSGSUP ;MESSAGE SUPPRESS TOGGLE - CPI '<' - JZ IMPRTY ;IMMEDIATE MODE START - CPI '>' - JZ IMPRTN ;IMMEDIATE MODE STOP - CPI '&' - JZ IFPSUP ;PRINT SUPPRESS DURING FALSE IF - JMP MOVST3 ;OTHER CONTROL CODES -; -IFPSUP: - MVI A,IPS ;CONVERT '^&' TO IF PRINT SUPPRESS FLAG - JMP MOVST3 -; -REXC: - MVI A,REXEC ;CONVERT '^:' TO RE-EXECUTE FLAG - JMP MOVST3 -; -GCRW: - MVI A,CRWAIT ;CONVERT '^?' TO CRWAIT FLAG - JMP MOVST3 -; -GCRBW: - MVI A,CRBWAIT ;CONVERT '^/' TO CRBWAIT FLAG - JMP MOVST3 -; -; ALLOW USER INPUT FROM NOW ON, BUT FIRST SKIP OUT REST OF LINE -; -UISET: - LDAX D ;GET NEXT CHAR - ANI 7FH ;MASK IT - CPI LF ;DONE? - JZ UISET1 - CPI 1AH ;EOF? - JZ UISET1 - INX D ;PT TO NEXT CHAR - JMP UISET ;CONTINUE SKIPPING -UISET1: - MVI A,UICH ;CONTROL CHAR - JMP MOVST3 -; -GRNG: - MVI A,RNG ;CONVERT '^*' TO RNG FLAG - JMP MOVST3 -; -GCRLF: - MVI A,CR ;GENERATE CR & LF - CALL CHRSTR - MVI A,LF - CALL CHRSTR - STA LCHR - JMP MOVSTR -; -PRMDEF: - PUSH H - LXI H,PRMDFP - PUSH H - LXI B,PRMDFL - XRA A - CALL FILL ;CLEAR PTR TABLE - POP H - MVI A,PRMDFL/2 - STA PRMMAX ;HIGHEST PARAMETER # - CALL PARMS ;BUILD DEFAULT PARAMETERS PTRS - POP H - INX D ;SKIP CR - MVI A,LF - JMP MOVSTX ;CONTINUE AT EOL -; -; CHECK TO SEE IF PREVIOUS CHAR WAS ALSO A ; AND FLUSH AS ZEX COMMENT IF SO -; -EXCOMM: - PUSH H - LXI H,LCHR ;PT TO PREVIOUS CHAR - CMP M ; DOUBLE ;? - MOV M,A ;STORE CURRENT CHAR AS PREVIOUS CHAR - POP H - JNZ MOVST3 ;NO...CONTINUE - MOV C,A ;SAVE CHAR - LDA PRTFLG - CPI PSUP - MOV A,C - JZ MOVST3 ;PRINT SUPPRESS - LDA IMFLG1 - CPI IMON - MOV A,C - JZ MOVST3 ;IMMEDIATE MODE - INX H ;YES..IGNORE PREVIOUS ; - PUSH H - LXI H,LCHR - LDA OUTCNT - DCR A ;DROP 1 CHAR. - STA OUTCNT -EXCOML: - LDAX D ;IGNORE CHARACTERS UNTIL EOF OR LF - INX D - CPI 1AH ;EOF - JZ EXCOMX - CPI LF ;LINE FEED - JNZ EXCOML - MOV M,A - LDA OUTCNT - ORA A ;ANY CHAR. ON THIS LINE? - JZ EXCOM2 ;NO...SKIP CR -EXCOM1: - POP H ;YES..FORCE CR - MVI A,CR - CALL CHRSTR - MVI A,LF - JMP MOVSTX ;CONTINUE -; -EXCOM2: - POP H - MVI A,LF - JMP MOVSTX ;CONTINUE -; -EXCOMX: - POP H - RET ;RETURN TO MAIN FLOW, WITH HL PTING TO NEXT BYTE -; -MSGSUP: - MVI A,MSUP ;CONVERT '^#' TO MESSAGE SUPPRESS FLAG - JMP MOVST3 -; -PRTSUP: - MVI A,PSUP ;CONVERT '^.' TO PRINT SUPPRESS FLAG - PUSH H - LXI H,PRTFLG - CMP M ;ALREADY ON? - JNZ PRTSST ;NO...SET FLAG - XRA A ;YES..CLEAR FLAG -PRTSST: - MOV M,A ;SET/RESET FLAG - POP H - MVI A,PSUP - JMP MOVST3 -; -IMPRTY: - MVI A,IMON ;CONVERT '^<' TO IMMEDIATE MODE START - STA LCHR - PUSH H - LXI H,IMFLG1 - CMP M ;ALREADY ON? - POP H - JZ MOVSTR ;YES.. - STA IMFLG1 - STA IMFLG2 - JMP MOVST3 ;NO... -; -IMPRTN: - MVI A,IMOFF ;CONVERT '^>' TO IMMEDIATE MODE STOP - STA LCHR - PUSH H - LXI H,IMFLG2 - CMP M ;ALREADY OFF? - POP H - JZ MOVSTR ;YES.. - STA IMFLG2 - STA IMFLG1 - JMP MOVST3 ;NO... -; -; PLACE CHAR IN BUFFER; A=CHAR, HL PTS TO BUFFER LOC -; -CHRSTR: - PUSH PSW ;CHECK FOR INPUT/ZEX BUFFER OVERLAP - PUSH D - PUSH H - LHLD ENDBUF - XCHG - POP H - MOV A,L - CMP E - JNZ CHRSTX ;LSB<> - MOV A,H - CMP D - JZ OVERL ;MSB=, OVERLAP WILL OCCUR/ABORT ZEX -; -; ADD CHAR TO ZEX'S BUFFER -; -CHRSTX: - POP D ;ADD CHAR. TO ZEX'S BUFFER - POP PSW - MOV M,A ;STORE CHAR - DCX H ;PT TO NEXT LOCATION (MOVING DOWN) - RET -; -; CHECK TO SEE IF ZEX IS ALREADY ACTIVE, AND ABORT IF SO -; -ZEXACTV: - MVI B,08H ;MESSAGE OFFSET - CALL MLDA ;GET VALUE IN A - ORA A ;0 IF NO - RZ - LXI D,ZEXACT - CALL PRINT ;ZEX ALREADY PRESENT -; -; ABORT AND RETURN TO ZCPR3 -; -CCPRET: - LHLD CCPSTK ;RESTORE STACK - SPHL - RET ;RETURN TO CCP - -; -; ZCPR3 MESSAGE BUFFER ACCESS ROUTINES -; - -; -; GETZ3MSG RETURNS HL POINTING TO DESIRED MESSAGE (OFFSET IN B) -; -GETZ3MSG: - PUSH D ;SAVE DE - LHLD Z3MSGA ;GET ADDRESS OF MESSAGES - MOV E,B ;GET OFFSET - MVI D,0 - DAD D ;HL PTS TO MESSAGE OF INTEREST - POP D - RET - -MSHLD: - PUSH D ;SAVE DE - XCHG - CALL GETZ3MSG ;MAKE HL PT TO MESSAGE - MOV M,E ;STORE LOW - INX H - MOV M,D ;STORE HIGH - XCHG ;RESTORE HL - POP D ;RESTORE DE - RET - -MSTA: - PUSH H ;SAVE HL - CALL GETZ3MSG ;PT TO MESSAGE WITH HL - MOV M,A ;STORE MESSAGE - POP H - RET - -MLDA: - PUSH H ;SAVE HL - CALL GETZ3MSG ;PT TO MESSAGE WITH HL - MOV A,M ;GET MESSAGE - POP H - RET - -; -; END OF Z3MSG ACCESS ROUTINES -; - -; -; ERROR EXITS -; -GETERR: - LXI D,CMDER ;CONTROL CHARACTER INVALID - CALL PRINT - JMP LINE ;PRINT LINE # AND LINE AND EXIT -; -NUMERR: - LXI D,NONUM ;EXCESSIVE NUMBER - CALL PRINT - JMP LINE ;PRINT LINE # AND LINE AND EXIT -; -PRMERR: - LXI D,PMERR - CALL PRINT - JMP LINE ;PRINT LINE # AND LINE AND EXIT -; -PRMTOO: - LXI D,TOOARG;TOO MANY PARAMETER ARGUMENTS - CALL PRINT - LHLD ERRLNE - CALL EPRT ;PRINT PARAMETER LINE - JMP CCPRET -; -BUFLOW: - LXI D,BUFMTY;TEXT BUFFER EMPTY - CALL PRINT - JMP CCPRET -; -NOSUB: - LXI D,NOSBF1;.SUB FILE NOT FOUND - CALL PRINT - LXI D,NOTHER - CALL PRINT - JMP CCPRET -; -OVERL: - LXI D,OVERLP;INPUT/ZEX BUFFER OVERLAP - CALL PRINT - JMP LINE -; -; SUBROUTINES -; -; CONTROL CODES 0-1FH -; WITH SUPPORT FOR $ . # < > -; -GETCMD: - LDAX D ;GET NEXT CHARACTER - INX D ;INCREMENT POINTER - CPI '|' - RZ ;CR,LF GENERATION - CPI 'a'-1 ;LOWERCASE? - JC GETUPR ;NOPE - CPI 'z'+1 ;a-z? - JNC GETERR ;NOPE - sui 'a'-'A' ;GET TO UPPERCASE -GETUPR: - CPI '@' ;0-1FH CONTROL CODE? - JNC GETCC - CPI ':' - RZ ;RE-EXECUTE - CPI '?' - RZ ;CR WAIT - CPI '/' - RZ ;CR WAIT AND RING BELL - CPI '*' - RZ ;RING BELL - CPI '"' - RZ ;USER INPUT - CPI '$' - RZ ;DEFAULT PARAMETERS' LINE - CPI '.' - RZ ;PRINT SUPPRESS TOGGLE - CPI '#' - RZ ;MESSAGE SUPPRESS TOGGLE - CPI '<' - RZ ;IMMEDIATE MODE START - CPI '>' - RZ ;IMMEDIATE MODE STOP - CPI '&' - RZ ;FALSE IF PRINT SUPPRESS - JMP GETERR -GETCC: - SUI '@' ;GET CONTROL CODE - RNC - JMP GETERR -; -; EXTRACT PARAMETER ELEMENT WHOSE $N SPECIFICATION IS POINTED TO BY DE -; DE PTS TO CHAR AFTER THE $ -; BUFFER TO PLACE RESULTING PARAMETER IS PTED TO BY HL -; -GTPARM: - LDAX D ;GET CHAR AFTER THE $ - INX D ;PT TO NEXT CHAR - CPI '$' ;IF DOUBLE $, THEN STORE AS $ - RZ - CPI '^' ;UP ARROW - RZ - CPI '|' ;CARRIAGE RETURN - RZ - CPI '1' ;CHECK FOR VALID DIGIT (1-9) - JC PRMERR - CPI '9'+1 ;RANGE ERROR? - JNC PRMERR - SUI '1' ;GET ACTUAL # (ZERO RELATIVE) - ADD A ;DOUBLE FOR OFFSET - STA PRMNUM - PUSH D ;SAVE PTRS - PUSH H - LXI H,PRMPNT ;PT TO PARAMETER PTR TABLE - CPI PRMPNL-1 ;PARAMETER NUMBER WITHIN RANGE? - JNC NOPARM ;> HIGHEST # - MOV E,A - MVI D,0 - DAD D - MOV E,M ;GET PARAMETER POINTER - INX H - MOV D,M - POP H ;RESTORE PTR TO NEXT BYTE IN OUTPUT BUFFER BELOW ZEX - MOV A,E ;ANY PARAM? - ORA D - JZ NOPARM ;NO PARAMETER PRESENT, TRY DEFAULTS -; -; MOVE PARAMETER PTED TO BY DE INTO BUFFER BELOW ZEX, 1ST BYTE PTED TO BY HL -; -MOVPRM: - LDAX D ;GET PARAMETER CHAR - INX D ;PT TO NEXT - ORA A ;DONE? - JZ ENDPAR - CALL CHRSTR ;STORE CHARS - JMP MOVPRM -; -; PARAMETER PLACED IN MEMORY -- CONTINUE -; -ENDPAR: - POP D ;GET PTR TO NEXT CHAR IN LINE - POP PSW ;CLEAR STACK - JMP MOVSTR ;RESUME PROCESSING -; -; NO PARAMETER PTED TO -; -NOPARM: - PUSH H ;SAVE PTR TO NEXT BYTE IN BUFFER BELOW ZEX - LXI H,PRMDFP ;TRY DEFAULT PARAMETERS - LDA PRMNUM - CPI PRMDFL-1 - JNC NUMERR ;> HIGHEST # - MOV E,A - MVI D,0 - DAD D - MOV E,M ;GET PARAMETER POINTER - INX H - MOV D,M - POP H - MOV A,E - ORA D - JNZ MOVPRM ;MOVE PARAMETER INTO BUFFER - JMP ENDPAR ;RESUME WITH NO PARAMETER -; -MOVEFN: - LDAX D - CPI ' ' ;SEE IF SPACE - RZ - MOV M,A - INX D ;INCREMENT POINTERS - INX H - DCR B - JNZ MOVEFN - RET -; -; INCREMENT LINE COUNT, AND AFFECT ONLY HL (MUST NOT AFFECT A) -; -INCR: - PUSH H ;SAVE OUTPUT POINTER - LHLD LINES - INX H ;INCREMENT LINE COUNTER - SHLD LINES - LXI H,LCHR ;CLEAR LAST CHARACTER - MVI M,0 - LXI H,OUTCNT;CLEAR CHARACTER COUNT - MVI M,0 - MOV L,E ;DE=HL - MOV H,D - SHLD BEGLIN - POP H - SHLD OUTLNE ;SAVE NEW OUTPUT LINE - RET -; -CNTINC: - CPI ' ' ;CONTROL CHARACTER? - RC ;YES.. - CPI UICH ;USER INPUT CHAR? - JZ CNTIN1 - ANI 80H ;SPECIAL CONTROL? - RNZ ;YES.. - LDA PRTFLG - CPI PSUP ;PRINT SUPPRESS FLAG? - RZ ;YES.. - LDA IMFLG1 - CPI IMON ;IMMEDIATE MODE? - RZ ;YES.. -CNTIN1: - LDA OUTCNT - INR A - STA OUTCNT - RET -; -PRINT: - MVI C,9 ;PRINT STRING AT (DE) - JMP BDOS -; -EPRT: - MOV A,M ;PRINT PARAMETER LINE AT (HL) - CPI CR - RZ - CPI 0 - JNZ EPRT1 - MVI A,' ' -EPRT1: - INX H - PUSH H - MOV E,A - MVI C,2 - CALL BDOS - POP H - JMP EPRT -; -CRLF: - LXI D,CRLFS ;PRINT CR/LF - JMP PRINT -; -LINE: - LXI D,LINEM ;PRINT LINE # AND LINE IN ERROR AND EXIT - CALL PRINT - LHLD LINES - CALL DECOUT ;PRINT LINE # - CALL CRLF - LHLD BEGLIN - PUSH H ;SAVE BEGGING POINTER -FINDCR: - MOV A,M - INX H - CPI 1AH ;END OF BUFFER - JZ FOUND - CPI CR - JNZ FINDCR -FOUND: - MVI M,0 ;END OF STRING - POP H ;START OF STRING - CALL PRNTHL ;PRINT BAD LINE - JMP CCPRET ;THATS ALL FOLKS -; -PRNTHL: - MOV A,M ;PRINT LINE AT (HL) - INX H - ORA A - RZ - MOV E,A - PUSH H ;SAVE POINTER - CALL OUTCHR - POP H ;GET POINTER BACK - JMP PRNTHL -; -OUTCHR: - MVI C,2 ;PRINT CHARACTER IN E - JMP BDOS -; -DECOUT: - PUSH H ;PRINT DECIMAL LINE NUMBER - PUSH D - PUSH B - LXI B,-10 ;RADIX FOR CONVERSION - LXI D,-1 ;THIS BECOMES NO DIVIDED BY RADIX -DX: - DAD B ;SUBTRACT 10 - INX D - JC DX - LXI B,10 - DAD B ;ADD RADIX BACK IN ONCE - XCHG - MOV A,H - ORA L ;TEST FOR ZERO - CNZ DECOUT ;RECURSIVE CALL - MOV A,E - ADI '0' ;CONVERT FROM BCD TO HEX - MOV E,A ;TO E FOR OUTPUT - MVI C,2 - CALL BDOS - POP B ;RESTORE REGISTERS - POP D - POP H - RET -; -MOVE: - MOV A,M ;MOVE STRING AT (HL) TO (DE) FOR LENGTH IN B - INX H - STAX D - INX D - DCR B - JNZ MOVE - RET -; -FILL: - PUSH D ; FILL STORAGE AT (HL) WITH CHARACTER IN A - MOV E,A ; FOR LENGTH IN BC - MOV A,B - ORA C - MOV A,E - POP D - RZ - DCX B - MOV M,A - INX H - JMP FILL -; -; WORKING STORAGE AREA -; -SUBNAM: - DB 'SUB' -ZEXNAM: - DB 'ZEX' -LINEM: - DB ' Error Line # $' -ZEXACT: - DB CR,LF,' ZEX Already Present$' -BUFMTY: - DB CR,LF,'Text Buffer Empty$' -OVERLP: - DB CR,LF,'Input/ZEX Buffer Overlap$' -NONUM: - DB CR,LF,'Parameter Number out of range$' -NOPRM: - DB CR,LF,'No Parameter or Default Parameter$' -PMERR: - DB CR,LF,'Parameter$' -NOSBF1: - DB CR,LF,'File ' -NOSBF2: - DB 'filename.typ$' -NOTHER: - DB ' not there$' -CMDER: - DB CR,LF,'Control character$' -TOOARG: - DB CR,LF,'Too many arguments - $' -SIGNON: - DB 'ZEX, Version ' - DB VERS/10+'0','.',(VERS MOD 10)+'0','$' -CRLFS: - DB CR,LF,'$' -; - DS 80 ;STACK SPACE -CCPSTK: - DW 0 ;CCP STACK PTR -IMFLG1: - DB 0 ;=IMON ENCOUNTERED -IMFLG2: - DB 0 ;=IMOFF ENCOUNTERED -PRTFLG: - DB 0 ;=PSUP ON -LCHR: - DB 0 ;LAST CHARACTER READ -PRMMAX: - DB 0 ;HIGHEST PARAMETER # -PRMNUM: - DB 0 ;CURRENT $<1-9> NUMBER * 2 (ZERO RELATIVE) -ERRLNE: - DW 0 -BITMAP: - DB 0 ;PRESENT OFFSET BIT'S -COUNT: - DB 0FFH ;PRESENT OFFSET BIT COUNT -BEGLIN: - DW BEGREL ;BEGINNING OF OLD LINE POINTER -LINES: - DW 1 -INBUF: - DW BEGREL -ENDBUF: - DW 0 ;END OF INPUT BUFFER -OUTCNT: - DB 0 -OUTLNE: - DW 0 -RELSTRT: - DW 0 -OUTBUF: - DW 0 -BUFSTR: - DW 0 -RELOCL: - DW 0 ;LENGTH OF RELOC PROGRAM (FILLED IN BY SID) -PRMDFP: ;DEFAULT PARAMETER PTRS - REPT 9 - DW 0 - ENDM -PRMDFL EQU $-PRMDFP -PRMDMY: - DW 0 ;DUMMY PARAMETER FOR .SUB FILE SPEC. -PRMPNT: ;COMMAND LINE PARAMETER PTRS - REPT 9 - DW 0 - ENDM -PRMPNL EQU $-PRMPNT -PATCH: ;PATCH AREA - REPT 32 - DB 'p' - ENDM - REPT 30 - DW 0 - ENDM -; -; INSURE 8 BYTE BOUNDARY FOR REL.UTL(RELS.UTL) -; -?PLOC SET $ - IF (?PLOC MOD 8) GT 0 -?PLOC SET (?PLOC AND 0FFF8H)+8 ;GET NEXT 8 BYTE BOUNDARY - ORG ?PLOC - ENDIF -; -BEGREL: - DS 0 ;RELOC PROGRAM STARTS HERE (ALSO USED AS BUFFER) -; - ENDIF -; -; END OF ZEX INITIATOR CODE SEGMENT -; -$-PRINT - IF NOT ZEXBASE -$+PRINT -; -; START OF ZEX RELOCATED CODE SEGMENT -; HL PTS TO MULTIPLE COMMAND BUFFER -; OR HL=0 IF NO MULTIPLE COMMANDS -; - ORG ZEXREL -; -ZEX: - SHLD EXMBASE ;SAVE ADDRESS OF MCL BUFFER - XCHG ;HL=ADDRESS OF ZCPR3 MESSAGES - SHLD Z3MSGA ;SAVE ADDRESS - MVI B,09H ;MESSAGE OFFSET - CALL MLHLD ;GET ADDRESS OF NEXT CHAR - MOV A,M ;GET 1ST CHAR - CPI MSUP ;1ST CHAR=MESSAGE SUPPRESS? - JNZ ZEX1 ;NO... - DCX H ;YES..SKIP CHARACTER - MVI B,09H ;MESSAGE OFFSET - CALL MSHLD ;SET PTR TO NEXT CHAR - STA MSUPFL ;SET INITIAL FLAG -ZEX1: - LXI SP,MEMTOP - LHLD BDOS+1 ;GET WARM JUMP FOR STANDARD CCP - SHLD MEMTOP ;SET PTR TO TOP OF MEMORY - INX H - MOV E,M ;DE = ADDRESS OF ACTUAL BDOS - INX H - MOV D,M - XCHG ;HL PTS TO ACTUAL BDOS - MOV A,H ;SUBTRACT 8 FOR CCP ENTRY POINT - SUI 8 - MOV H,A - MVI L,3 ;SET UP FOR WARM CCP JUMP - SHLD CCPJMP - LHLD WARM+1 ;SAVE WARM BOOT ADDRESS - SHLD WARMPT - LXI D,BSWARM ;SAVE OLD BIOS JUMPS - MVI B,12 - CALL MOVE ;MOVE BIOS JUMPS - LHLD WARMPT - XCHG - LXI H,LOCJMP ;STORE NEW BIOS JUMPS - MVI B,12 - CALL MOVE ;MOVE NEW BIOS JUMPS TO BIOS AREA -; -; ZEX RUNTIME BIOS INTERCEPT ROUTINES -; -NWARM: - LXI SP,MEMTOP - MVI B,09H ;MESSAGE OFFSET - CALL MLHLD ;GET ADDRESS OF NEXT CHAR - MOV A,M - CPI 0FFH ;TEST IT - JZ WARMX ;WARM RETURN - LHLD WARMPT ;SET WARM BOOT ADDRESS - SHLD WARM+1 - LHLD MEMTOP ;SET BDOS ENTRY ADDRESS - SHLD BDOS+1 - LXI D,BUFF ;DMA ADDRESS - MVI C,26 ;SET DMA - CALL BDOS - LDA BDISK - MOV C,A - LHLD CCPJMP - PCHL ;GOTO CONSOLE PROCESSOR -; -; JMP TABLE TO OVERLAY BIOS WITH NEW ZEX-BASED JUMPS -; -LOCJMP: - JMP NWARM ;WARM - JMP BCONST ;CONST - JMP NCONIN ;CONIN - JMP NCONOT ;CONOT -; -; ZCPR3 MESSAGE BUFFER ACCESS ROUTINES -; - -; -; GETZ3MSG RETURNS HL POINTING TO DESIRED MESSAGE (OFFSET IN B) -; -Z3MSGA: - DW 0 ;MESSAGES ADDRESS -GETZ3MSG: - PUSH D ;SAVE DE - LHLD Z3MSGA ;GET ADDRESS OF MESSAGES - MOV E,B ;GET OFFSET - MVI D,0 - DAD D ;HL PTS TO MESSAGE OF INTEREST - POP D - RET - -MSHLD: - PUSH D ;SAVE DE - XCHG - CALL GETZ3MSG ;MAKE HL PT TO MESSAGE - MOV M,E ;STORE LOW - INX H - MOV M,D ;STORE HIGH - XCHG ;RESTORE HL - POP D ;RESTORE DE - RET - -MLHLD: - PUSH PSW ;SAVE A - CALL GETZ3MSG ;MAKE HL PT TO MESSAGE - MOV A,M ;GET LOW - INX H - MOV H,M ;GET HIGH - MOV L,A ;PUT LOW - POP PSW ;RESTORE A - RET - -MSTA: - PUSH H ;SAVE HL - CALL GETZ3MSG ;PT TO MESSAGE WITH HL - MOV M,A ;STORE MESSAGE - POP H - RET - -MLDA: - PUSH H ;SAVE HL - CALL GETZ3MSG ;PT TO MESSAGE WITH HL - MOV A,M ;GET MESSAGE - POP H - RET - -; -; END OF Z3MSG ACCESS ROUTINES -; - -; -; CONSOLE INPUT INTERCEPT ROUTINE -; -NCONIN: - MVI B,07H ;MESSAGE OFFSET - CALL GETZ3MSG ;PT TO ZEX MESSAGE BYTE - MOV A,M ;GET ZEX MESSAGE - CPI 2 ;SUSPEND INTERCEPT? - JZ BCONIN ;GET INPUT VIA BIOS IF USER INPUT ACTIVE - CPI 1 ;PROMPT JUST PRINTED? - JNZ NCONNP - MVI M,0 ;CLEAR ZEX MESSAGE - LXI H,STARTM ;PRINT MESSAGE - CALL PMSG -; LDA PMCHR ;PRINT PROMPT CHAR -; MOV C,A -; CALL BCONOT -NCONNP: - MVI B,08H ;MESSAGE OFFSET - CALL MLDA ;GET ZEX RUNNING MESSAGE - ORA A ;0=NO - JZ WARMX ;ABORT ZEX IF NOT - LXI H,0 - DAD SP ;SAVE RETURN STACK LEVEL - SHLD CONSTK - LXI SP,MEMTOP ;SET USER STACK -NCONNL: - CALL BCONST ;GET CONSOLE STATUS - ORA A - JZ GETBUF ;GET CHARACTER FROM BUFFER - CALL BCONIN ;GET CHARACTER - CPI 'C'-'@' ;SEE IF TERMINATE CHARACTER - JZ ZEXABRT - CPI 'S'-'@' ;13H - JNZ NCONEX - CALL BCONIN ;WAIT FOR NEXT CHARACTER - ANI 7FH - MVI B,09H ;MESSAGE OFFSET - CALL MLHLD ;PT TO NEXT CHAR - INX H - MOV M,A - MVI B,09H ;MESSAGE OFFSET - CALL MSHLD ;RESET PTR TO NEXT CHAR - MVI A,'S'-'@' ;13H -NCONEX: - LHLD CONSTK ;RESTORE CALLER'S STACK - SPHL - RET -; -; RETURN NEXT CHAR FROM INPUT BUFFER -; -GETBUF: - LDA IPSUPFL ;COMBINE PSUPFL AND IPSUPFL TO SET PRINT FLAG - ORA A ;0=NO SUPPRESS - JZ GBUF0 - MVI B,01H ;OFFSET TO IF FLAG - CALL GETZ3MSG ;PT TO IF FLAG - MOV A,M ;GET IF FLAG - ORA A ;NO IF? - JZ GBUF0 - INX H - ANA M ;SET IF STATE - JNZ GBUF0 ;CURRENT IF IS TRUE - MVI A,0FFH ;SUPPRESS PRINT - STA OUTFLG - JMP GBUF1 -GBUF0: - LDA PSUPFL ;SET PRINT SUPPRESS FLAG FOR NCONOT - STA OUTFLG -GBUF1: - CALL GETCHR ;GET NEXT CHARACTER - CPI UICH ;USER INPUT? - JZ UISTRT ;YES..SET USER INPUT PENDING FLAG - CPI REXEC ;RE-EXECUTE? - JZ REXECR ;YES..RESET BUFFER PTR - CPI CRWAIT ;CR WAIT? - JZ CRWRTN ;YES..WAIT FOR CR - CPI CRBWAIT ;CR WAIT WITH RING BELL? - JZ CRBWRTN ;YES..WAIT FOR CR AND RING BELL - CPI RNG ;RING BELL? - JZ RNGBELL ;YES..JUST RING THE BELL - CPI MSUP ;MESSAGE SUPPRESS FLAG? - JZ MSUPCK ;YES..TOGGLE FLAG - CPI PSUP ;PRINT SUPPRESS ? - JZ PSUPCK ;YES..TOGGLE FLAG - CPI IPS ;FALSE IF PRINT SUPPRESS? - JZ IPSUPCK - CPI IMON ;IMMEDIATE MODE START ? - JZ IMFLGS ;YES..SET FLAG - CPI IMOFF ;IMMEDIATE MODE STOP? - JZ IMFLGS ;YES..RESET FLAG - CPI CR ;CR? - JNZ GETEXT ;NO...EXIT -; -; CR, SO RESET PRINT SUPPRESSION BASED ONLY ON IPSUPFL -; - LDA IPSUPFL ;COMBINE PSUPFL AND IPSUPFL TO SET PRINT FLAG - ORA A ;0=NO SUPPRESS - JZ GBUF2 - MVI B,01H ;MESSAGE OFFSET TO IF FLAG - CALL GETZ3MSG ;PT TO IF FLAG - MOV A,M ;GET IF FLAG - ORA A ;NO IF? - JZ GBUF2 - INX H - ANA M ;SET IF STATE - JNZ GBUF2 ;CURRENT IF IS TRUE - MVI A,0FFH ;SUPPRESS PRINT - STA OUTFLG - MVI A,CR - JMP GETEXT -GBUF2: - XRA A - STA OUTFLG ;YES..RESET PRINT SUPPRESSION - MVI A,CR -GETEXT: - MOV C,A - LDA IMFLG - CPI IMON ;IMMEDIATE MODE ? - MOV A,C - JNZ NCONEX ;NO...RETURN TO CALLER WITH CHAR - CALL BCONOT ;YES..IMMEDIATE ECHO TO CONSOLE - JMP NCONNL ;...LOOP UNTIL IMOFF -; -; ^" COMMAND -; -UISTRT: - MVI A,2 ;SET MESSAGE TO SUSPEND INTERCEPT - MVI B,07H ;MESSAGE OFFSET - CALL MSTA ;SET MESSAGE - LHLD CONSTK ;RESTORE CALLER'S STACK - SPHL - JMP NCONIN ;GET CHAR FROM USER FOR NOW -; -; ^: COMMAND -; -REXECR: - MVI B,0BH ;MESSAGE OFFSET - CALL MLHLD ;PT TO FIRST CHAR IN BUFFER - MVI B,09H ;MESSAGE OFFSET - CALL MSHLD ;SET PTR TO NEXT CHAR - XRA A - STA IMFLG ;RESET ALL FLAGS - STA PSUPFL - STA IPSUPFL - STA MSUPFL - JMP NCONNL ;...LOOP UNTIL ^C -; -; ^? COMMAND -; -CRWRTN: - CALL BCONIN ;GET INPUT CHAR - CPI 'C'-'@' - JZ ZEXABRT ;=^C - CPI CR - JZ CRWRTX ;= - CPI ' ' - JZ CRWRTX ;= - MVI C,BELL - CALL BCONOT ;<>CR - JMP CRWRTN -; -; ^/ COMMAND -; -CRBWRTN: - LXI H,DELAY ;SET COUNTER -CRBWR1: - PUSH H ;SAVE COUNTER - CALL BCONST ;CHECK STATUS - POP H ;GET COUNTER - ORA A ;SET FLAGS - JNZ CRBWR2 - DCX H ;COUNT DOWN - MOV A,H ;DONE? - ORA L - JNZ CRBWR1 - MVI C,BELL ;RING BELL - CALL BCONOT - JMP CRBWRTN -CRBWR2: - CALL BCONIN ;GET CHAR - CPI 'C'-'@' ;ABORT? - JZ ZEXABRT - CPI CR ;CONT IF - JNZ CRBWRTN -; -; ^| COMMAND -; -CRWRTX: - MOV C,A ;ECHO CR/LF - CALL NCONOT - MVI C,LF - CALL NCONOT - JMP GETBUF -; -; ^* COMMAND -; -RNGBELL: - MVI C,BELL ;RING BELL - CALL NCONOT - JMP GETBUF -; -; ^. COMMAND -; -PSUPCK: - LXI H,PSUPFL - CMP M - JNZ PSUPST ;SET FLAGS IF NOT EQUAL - XRA A ;ELSE RESET FLAGS -PSUPST: - MOV M,A ;SET/RESET SAVED FLAG - JMP GETBUF ;AND GET NEXT CHARACTER (SETS EXEC FLAG) -; -; ^& COMMAND -; -IPSUPCK: - LXI H,IPSUPFL - CMP M - JNZ PSUPST ;SET FLAGS IF NOT EQUAL - XRA A ;ELSE RESET FLAGS - JMP PSUPST ;SET/RESET FLAG IN A -; -; ^# COMMAND -; -MSUPCK: - LXI H,MSUPFL - CMP M - JNZ MSUPST ;SET FLAGS IF NOT EQUAL - XRA A ;ELSE RESET FLAG -MSUPST: - MOV M,A ;SET/RESET FLAG - JMP GETBUF ;AND GET NEXT CHARACTER -; -; ^< AND ^> COMMANDS -; -IMFLGS: - STA IMFLG ;SET/RESET IMMEDIATE MODE FLAG - JMP GETBUF ;GET NEXT CHARACTER -; -; CONSOLE OUTPUT INTERCEPT ROUTINE -; -NCONOT: - LDA OUTFLG ;PRINT SUPPRESSION? - ORA A - RNZ ;YES...IGNORE ECHO - MOV A,C - STA PMCHR ;SET LAST CHAR OUTPUT - JMP BCONOT -; -; GET NEXT CHAR FROM BUFFER AND TERMINATE ZEX IF END OF BUFFER -; -GETCHR: - MVI B,09H ;MESSAGE OFFSET - CALL MLHLD ;PT TO NEXT CHAR - MOV A,M ;GET IT - DCX H ;PT TO FOLLOWING - MVI B,09H ;MESSAGE OFFSET - CALL MSHLD ;SET PTR TO NEXT CHAR - CPI 0FFH ;EOB? - RNZ ;NO...RETURN -; LHLD Z3MSG+09H ;PT TO EOB - INX H ;POINT TO EOB - MVI B,09H ;MESSAGE OFFSET - CALL MSHLD ;SET PTR TO NEXT CHAR (LAST CHAR) - CALL MOVBAK ;MOVE JUMPS BACK - CALL BDOSRST ;RESTORE BDOS ADDRESS - CALL PRDONEM - XRA A ;TURN OFF ZEX - MVI B,08H ;MESSAGE OFFSET - CALL MSTA ;TURN OFF ZEX - LHLD CONSTK ;GET OLD STACK - SPHL - MVI A,CR ;RETURN CARRIAGE RETURN - RET - -; -; PRINT DONE MESSAGE WITH FOLLOWING PROMPT CHAR -; -PRDONEM: - LXI H,DONEM ;PRINT MESSAGE - CALL PMSG - LDA PMCHR ;PRINT PROMPT CHAR - MOV C,A ;IN C FOR BIOS - JMP BCONOT - -; -; RESTORE BDOS JMP IF NECESSARY -; -BDOSRST: - LHLD MEMTOP ;SEE IF BDOS+1=MEMTOP - XCHG - LHLD BDOS+1 - MOV A,E - SUB L - MOV A,D - SBB H - RNZ ;DON'T REPLACE BDOS JUMP - INX D ;PT TO BDOS JUMP - LDAX D ;GET LOW ADDRESS - MOV L,A ;... IN L - INX D - LDAX D ;GET HIGH ADDRESS - MOV H,A ;... IN H - SHLD BDOS+1 ;RESET BDOS JUMP - RET -; -; ^C ABORT EXIT -; -ZEXABRT: - LXI SP,MEMTOP ;^C ABORTS ZEX - LXI H,ABORTD ;ABORT - CALL PMSG - JMP WARMX1 ;DON'T PRINT DONE MESSAGE -; -; ABORT ZEX AND RETURN TO ZCPR3 -; -WARMX: - CALL PRDONEM ;PRINT DONE MESSAGE -; -; ENTRY POINT TO ABORT ZEX WITHOUT MESSAGE -; -WARMX1: - XRA A ;SAY THAT ZEX IS NOT RUNNING - MVI B,08H ;MESSAGE OFFSET - CALL MSTA ;SET NOT RUNNING - CALL MOVBAK ;MOVE JUMPS BACK - CALL BDOSRST ;RESTORE BDOS JUMPS - LHLD EXMBASE ;MULTIPLE COMMAND LINES ENABLED? - MOV A,H ;ANY ON? - ORA L - JZ WARM ;NONE ON IF ADDRESS IS ZERO, SO JUST WARM BOOT -; -; THIS SECTION OF CODE CLEARS THE MULTIPLE COMMAND LINE BUFFER -; - MOV D,H ;DE PTS TO MULTIPLE COMMAND BUFFER ALSO - MOV E,L - PUSH H ;SAVE PTR - LXI H,4 ;PT TO FIRST CHAR OF LINE - DAD D - MVI M,0 ;SET FIRST CHAR OF LINE TO ZERO FOR EOL - XCHG ;DE PTS TO FIRST CHAR OF LINE - POP H ;GET PTR - MOV M,E ;STORE ADDRESS OF EMPTY COMMAND (EOL) - INX H - MOV M,D - JMP WARM -; -; SUBROUTINES -; -MOVBAK: - LHLD WARMPT ;MOVE OLD JUMP TABLE BACK TO BIOS - XCHG - LXI H,BSWARM - MVI B,12 - CALL MOVE - JMP F121 ;CALL 1.2.1 FIX FOR MBASIC 1.1.2 -; -MOVE: - MOV A,M ;MOVE STRING FROM (HL) TO (DE) FOR LENGTH IN B - INX H - STAX D - INX D - DCR B - JNZ MOVE - RET -; -PMSG: - PUSH H - LDA IPSUPFL ;COMBINE PSUPFL AND IPSUPFL TO SET PRINT FLAG - ORA A ;0=NO SUPPRESS - JZ PMSG0 - MVI B,01H ;MESSAGE OFFSET TO IF FLAG - CALL GETZ3MSG ;PT TO IF FLAG - MOV A,M ;GET IF FLAG - ORA A ;NO IF? - JZ PMSG0 - INX H - ANA M ;SET IF STATE - POP H ;IN CASE OF RETURN - RZ ;SKIP MESSAGE IF SUPPRESSED - PUSH H -PMSG0: - POP H - LDA MSUPFL ;PRINT MESSAGE AT (HL) - CPI MSUP ;MESSAGES SUPPRESSED? - RZ ;YES..EXIT -PMSGL: - MOV A,M ;GET NEXT CHAR - ORA A ;END OF MESSAGE? - RZ ;YES..EXIT - INX H ;PT TO NEXT CHAR - PUSH H ;SAVE PTR - MOV C,A ;OUTPUT CHAR - CALL BCONOT - POP H ;RESTORE PTR - JMP PMSGL -; -; REPLACE ZEX ROUTINE JUMPS WITH BIOS JUMPS -; -F121: - LXI H,BSWARM ; INSURE ONLY BIOS 1.1.2 - LXI D,NWARM ; CALLS FROM NOW ON 1.1.2 - MVI B,3 ; FOR PROGRAMS 1.1.2 - CALL MOVE ; THAT MAY HAVE 1.1.2 - LXI H,BCONIN ; COPIED OUR 1.1.2 - LXI D,NCONIN ; ADDRESSES AS 1.1.2 - MVI B,3 ; IF THEY WERE 1.1.2 - CALL MOVE ; IN THE BIOS. 1.1.2 - LXI H,BCONOT ; (MBASIC DOES THIS) 1.1.2 - LXI D,NCONOT ; 1.1.2 - MVI B,3 ; 1.1.2 - JMP MOVE ; 1.1.2 -; -; WORKING STORAGE AREA -; -ABORTD: - DB CR,LF,'[ZEX Aborted]',CR,LF,0 -STARTM: - DB ' ZEX: ',0 -DONEM: - DB 'Done',0 - -; - REPT 12 ;12 ELT STACK - DW 0 - ENDM -MEMTOP: - DW 0 -EXMBASE: - DW 0 -CCPJMP: - DW 0 -WARMPT: - DW 0 -; -; ORIGINAL BIOS JMP TABLE -; -BSWARM: - JMP $ -BCONST: - JMP $ -BCONIN: - JMP $ -BCONOT: - JMP $ -; -PMCHR: - DB 0 -PSUPFL: - DB 0 -IPSUPFL: - DB 0 -OUTFLG: - DB 0 -NUICH: - DB 0 -IMFLG: - DB 0 -MSUPFL: - DB 0 -CONSTK: - DW 0 -; -?PLEN SET $ - IF (?PLEN MOD 8) GT 0 -?PLEN SET (?PLEN AND 0FFF8H)+8;GET NEXT BOUNDARY - ENDIF -; -DRVERL EQU ?PLEN -; -DRVL8 EQU DRVERL/8 ;LENGTH OF RELOCATION BIT MAP - ORG DRVERL -; - ENDIF -; -; END OF ZEX RELOCATED CODE SEGMENT -; - END - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ZEX.COM b/Source/Images/d_bp/u15/ZEX.COM deleted file mode 100644 index c1df478e..00000000 Binary files a/Source/Images/d_bp/u15/ZEX.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ZEX.ZEX b/Source/Images/d_bp/u15/ZEX.ZEX deleted file mode 100644 index 83370e7e..00000000 --- a/Source/Images/d_bp/u15/ZEX.ZEX +++ /dev/null @@ -1,181 +0,0 @@ -; -; Command File to Assemble ZEX by Richard Conn -; -; The following files are assumed: -; ED.COM, MAC.COM, ZSID.COM -; The following resident commands are assumed: -; ERA, REN, IF, FI -; - -; -; 1. Test for Needed Files -; -if exist zex.asm -if exist a:rels.utl - -; -; 2. Erase Any Files from Previous Executions -; -ERA ZEX*.BAK -ERA ZEX*.HEX -ERA ZEX*.SYM - -; -; 3. Create ZEX30.LIB for Assembly of -; ORG 0 Relocated Code Segment -; -ED ZEX30.LIB -#A -#K -I -ZEXBASE EQU FALSE ;SUPPRESS ZEX INITIATOR CODE -ZEXREL EQU 0 ;SET RELOCATED CODE SEGMENT TO ORG 0 -^Z -E - -; -; 4. Assemble only ORG 0 Relocated Code Segment -; -MAC ZEX $$PZ - -; -; 5. Rename Files from Step 4 -; -REN ZEX300.HEX=ZEX.HEX -REN ZEX300.SYM=ZEX.SYM - -; -; 6. New ZEX30.LIB for Assembly of -; ORG 100H Relocated Code Segment -; -ED ZEX30.LIB -#A -#K -I -ZEXBASE EQU FALSE ;SUPPRESS ZEX INITIATOR CODE -ZEXREL EQU 0100H ;SET RELOCATED CODE SEGMENT TO ORG 100H -^Z -E - -; -; 7. Assemble only ORG 100H Relocated Code Segment -; -MAC ZEX $$PZ SZ - -; -; 8. Rename File from Step 7 -; -REN ZEX301.HEX=ZEX.HEX - -; -; 9. New ZEX30.LIB for Assembly of -; ZEX Initiator Code Only -; -ED ZEX30.LIB -#A -#K -I -ZEXBASE EQU TRUE ;ENABLE ZEX INITIATOR CODE -ZEXREL EQU 0 ;RESET RELOCATED CODE SEGMENT TO ORG 0 -^Z -E - -; -; 10. Assemble ZEX Initiator Code Only -; -MAC ZEX $$PZ - -; -; 11. Use ZSID and RELS.UTL to Create ZEX.COM -; -; [note: If only REL.UTL is available, comment out the lines -; starting with IZEX.COM below and change the line -; SID RELS.UTL to SID REL.UTL and a SAVE 10 ZEX.COM -; must be added at the end of this file.] -; -; ZEX.HEX contains ZEX Initiator Code -; ZEX.SYM contains symbols for SID for ZEX Initiator Code -; -; ZEX300.HEX contains ZEX ORG 0 Relocated Code Segment -; ZEX300.SYM contains symbols for SID for ZEX ORG 0 Rel Code -; -; ZEX301.HEX contains ZEX ORG 100H Rel Code Segment -; -; BEGREL is the symbol for the start of the Rel Code -; Segment in ZEX.COM -; -; DRVERL is the symbol for the length of the Rel Code -; Segment -; -; DRVL8 is the symbol for the length of the storage -; needed for the relo table bit map to be created -; by RELS.UTL -; -; RELOCL is the symbol for the DW in ZEX.COM that will -; contain the length of the Relocated Code Segment -; -; -; 11A. SID is invoked and the .SYM files for the ORG 0 Rel Code -; Segment and the Initiator Code Segment are loaded. -; -; 11B. The DW at symbol RELOCL is updated with the value of -; DRVERL from the ORG 0 Rel Code Segment. -; -; 11C. Memory for the two copies of the Relocated Code Segment -; (ORG 0 and ORG 100H) and the rel table bit map is zeroed. -; -; 11D. The ORG 0 Relocated Code Segment is loaded starting at -; location BEGREL. -; -; 11E. The ORG 100H Relocated Code Segment is loaded after the -; segment loaded in step C plus the length of the rel -; table bit map. -; -; 11F. RELS.UTL routine SETADRS sets the starting addresses of -; the two Relocated Code Segments for creation of the rel -; table bit map. -; -; 11G. RELS.UTL routine SETLEN sets the length of the Relocated -; Code Segment and builds the relocation table bit map. -; -; 11H* RELS.UTL routine SAVE saves the EX Initiator Code Segment, -; the ORG 0 Relocated Code Segment, and the rel table -; bit map created by RELS.UTL. -; -; * [note: not used if only REL.UTL is available] -; -; 11I. CP/M is returned to by G0. -; -; 11J** SAVE 10 ZEX.COM saves the ZEX Initiator Code Segment, -; the ORG 0 Relocated Code Segment, and the rel table -; bit map created by REL.UTL. -; -; ** [note: used ONLY if REL.UTL is used] -; -ZSID A:RELS.UTL -IZEX.HEX ZEX300.SYM -R -I* ZEX.SYM -R -SW.RELOCL -.DRVERL -. -F.BEGREL .BEGREL+.DRVERL+.DRVL8+.DRVERL 0 -IZEX300.HEX -R.BEGREL -IZEX301.HEX -R.BEGREL+.DRVERL+.DRVL8-100 -C.SETADRS .BEGREL .BEGREL+.DRVERL+.DRVL8 -C.SETLEN .DRVERL .BEGREL+.DRVERL -IZEX.COM -C.SAVE 100 .BEGREL+.DRVERL+.DRVL8 -G0 -; -; 12. Clean Up Files on Disk and Terminate IFs -; -ERA ZEX*.BAK -ERA ZEX*.HEX -ERA ZEX*.SYM -ERA ZEX30.LIB -fi;fi - \ No newline at end of file diff --git a/Source/Images/d_bp/u15/ZEX2.COM b/Source/Images/d_bp/u15/ZEX2.COM deleted file mode 100644 index 456ae7ed..00000000 Binary files a/Source/Images/d_bp/u15/ZEX2.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ZEX31A.COM b/Source/Images/d_bp/u15/ZEX31A.COM deleted file mode 100644 index 83452996..00000000 Binary files a/Source/Images/d_bp/u15/ZEX31A.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ZGOLF.COM b/Source/Images/d_bp/u15/ZGOLF.COM deleted file mode 100644 index b948fd5b..00000000 Binary files a/Source/Images/d_bp/u15/ZGOLF.COM and /dev/null differ diff --git a/Source/Images/d_bp/u15/ZSYSTEM.INS b/Source/Images/d_bp/u15/ZSYSTEM.INS deleted file mode 100644 index f7b5b164..00000000 --- a/Source/Images/d_bp/u15/ZSYSTEM.INS +++ /dev/null @@ -1,115 +0,0 @@ -; -; Complete listing of Z-System Utilities as of July 20, 1986. -; Includes "pending" (unofficial) submissions where applicable. -; In this list filenames contain the latest version number. In some -; cases, filenames have been truncated to allow use of the version -; number, e.g., "COMMEN10" refers to COMMENT v1.0, etc. Use this -; list as a checklist to see if you possess the current versions of -; these tools. -; -D. McCord, sysop, Z-Node Central -; -; (This list may be used by Z3INS to actually install files.) -; -AC39.COM -ALIAS11.COM -ARUNZ09.COM -BALIAS13.COM -CD31.COM -CLEAN11P.COM -CMD10.COM -COMMEN20.COM -COMP28.COM -CPSEL10.COM -; CPY10.COM (not a Z3 tool, included with Z-Com and Z3-Dot-Com) -CRC20.COM -; DEBUGRCP.AQM (assemble to make DEBUG.RCP, MU3-like RCP) -DEV10.COM -DEVICE10.COM -DFA12.COM -DIFF21.COM -DIR14.COM -DOSERR10.COM -DOSVER10.COM -DPROG12.COM -DU312.COM -DUMP12.COM -ECHO10.COM -ERASE50.COM -ERROR110.COM -ERROR210.COM -ERROR310.COM -ERROR410.COM -ERRORX10.COM -FINDF24.COM -GETVAR10.COM -GOTO12.COM -HELP53.COM -HELPCK10.COM -HELPPR10.COM -HSH15.COM -IF14.COM -IFSTAT10.COM -LDR15.COM -LDSK20.COM -LGET10.COM -LHELP10.COM -LLF10.COM -LX11.COM -MCOPY43.COM -MENU40.COM -MENUCK13.COM -MKDIR32.COM -; MLOAD24.COM (not a Z3 tool, distributed by Echelon w/permission) -MOVE20.COM -MU311.COM -; NOTE10.COM (a Z3 tool, but requires no installation) -; NULU151.COM (not a Z3 tool, distributed by Echelon w/permission) -PAGE20.COM -PATH31.COM -PMOVE12.COM -PRINT20.COM -PROTEC30.COM -PRTDFL10.COM -PRTSET10.COM -PUBLIC10.COM -PWD10.COM -QUIET11.COM -RECORD30.COM -REG10.COM -RENAME30.COM -RESOLV10.COM -SAK21.COM -SETFIL10.COM -SFA25.COM -SH10.COM -SHCTRL10.COM -SHDEFI10.COM -SHFILE10.COM -SHOW10.COM -SHSET10.COM -SHVAR10.COM -SUB31.COM -; SYSFCP14.LBR (assemble to make SYS.FCP) -; SYSRCP14.LBR (assemble to make SYS.RCP) -TALIAS15.COM -TCCHEC10.COM -TCMAKE10.COM -TCSELE11.COM -UNERAS12.COM -VALIAS11.COM -VCED16.COM -VERROR16.COM -VFILER40.COM -VID01.COM -VIEW11.COM -VMENU16.COM -VMENUC13.COM -VTYPE20.COM -W20.COM -WHEEL31.COM -XD12.COM -XDIR20.COM -Z3INS13.COM -Z3LOC11.COM -; Z3TCAP20.TCP (TCAP database, not a program) -ZEX31A.COM diff --git a/Source/Images/d_bp/u0/BPCNFG.COM b/Source/Images/d_bp/u15/bpcnfg.com similarity index 100% rename from Source/Images/d_bp/u0/BPCNFG.COM rename to Source/Images/d_bp/u15/bpcnfg.com diff --git a/Source/Images/d_bp/u0/BPDBUG.COM b/Source/Images/d_bp/u15/bpdbug.com similarity index 100% rename from Source/Images/d_bp/u0/BPDBUG.COM rename to Source/Images/d_bp/u15/bpdbug.com diff --git a/Source/Images/d_bp/u0/BPFORMAT.COM b/Source/Images/d_bp/u15/bpformat.com similarity index 100% rename from Source/Images/d_bp/u0/BPFORMAT.COM rename to Source/Images/d_bp/u15/bpformat.com diff --git a/Source/Images/d_bp/u0/BPSWAP.COM b/Source/Images/d_bp/u15/bpswap.com similarity index 100% rename from Source/Images/d_bp/u0/BPSWAP.COM rename to Source/Images/d_bp/u15/bpswap.com diff --git a/Source/Images/d_bp/u0/BPSYSGEN.COM b/Source/Images/d_bp/u15/bpsysgen.com similarity index 100% rename from Source/Images/d_bp/u0/BPSYSGEN.COM rename to Source/Images/d_bp/u15/bpsysgen.com diff --git a/Source/Images/d_bp/u15/cl.com b/Source/Images/d_bp/u15/cl.com new file mode 100644 index 00000000..ac0640eb Binary files /dev/null and b/Source/Images/d_bp/u15/cl.com differ diff --git a/Source/Images/d_bp/u0/CONFZ4.COM b/Source/Images/d_bp/u15/confz4.com similarity index 100% rename from Source/Images/d_bp/u0/CONFZ4.COM rename to Source/Images/d_bp/u15/confz4.com diff --git a/Source/Images/d_bp/u15/copy.com b/Source/Images/d_bp/u15/copy.com new file mode 100644 index 00000000..606c81a5 Binary files /dev/null and b/Source/Images/d_bp/u15/copy.com differ diff --git a/Source/Images/d_bp/u15/d.com b/Source/Images/d_bp/u15/d.com new file mode 100644 index 00000000..73b22bd4 Binary files /dev/null and b/Source/Images/d_bp/u15/d.com differ diff --git a/Source/Images/d_bp/u15/du.com b/Source/Images/d_bp/u15/du.com new file mode 100644 index 00000000..c0506ffb Binary files /dev/null and b/Source/Images/d_bp/u15/du.com differ diff --git a/Source/Images/d_bp/u15/ease.com b/Source/Images/d_bp/u15/ease.com new file mode 100644 index 00000000..4ec11761 Binary files /dev/null and b/Source/Images/d_bp/u15/ease.com differ diff --git a/Source/Images/d_bp/u0/EMULATE.COM b/Source/Images/d_bp/u15/emulate.com similarity index 100% rename from Source/Images/d_bp/u0/EMULATE.COM rename to Source/Images/d_bp/u15/emulate.com diff --git a/Source/Images/d_bp/u0/FA.COM b/Source/Images/d_bp/u15/fa.com similarity index 100% rename from Source/Images/d_bp/u0/FA.COM rename to Source/Images/d_bp/u15/fa.com diff --git a/Source/Images/d_bp/u15/fileattr.com b/Source/Images/d_bp/u15/fileattr.com new file mode 100644 index 00000000..4527d090 Binary files /dev/null and b/Source/Images/d_bp/u15/fileattr.com differ diff --git a/Source/Images/d_bp/u0/HASHINI.COM b/Source/Images/d_bp/u15/hashini.com similarity index 100% rename from Source/Images/d_bp/u0/HASHINI.COM rename to Source/Images/d_bp/u15/hashini.com diff --git a/Source/Images/d_bp/u0/HDIAG.COM b/Source/Images/d_bp/u15/hdiag.com similarity index 100% rename from Source/Images/d_bp/u0/HDIAG.COM rename to Source/Images/d_bp/u15/hdiag.com diff --git a/Source/Images/d_bp/u0/HELP.COM b/Source/Images/d_bp/u15/help.com similarity index 100% rename from Source/Images/d_bp/u0/HELP.COM rename to Source/Images/d_bp/u15/help.com diff --git a/Source/Images/d_bp/u15/helplsh.com b/Source/Images/d_bp/u15/helplsh.com new file mode 100644 index 00000000..faa0ee0a Binary files /dev/null and b/Source/Images/d_bp/u15/helplsh.com differ diff --git a/Source/Images/d_bp/u15/if.com b/Source/Images/d_bp/u15/if.com new file mode 100644 index 00000000..df949312 Binary files /dev/null and b/Source/Images/d_bp/u15/if.com differ diff --git a/Source/Images/d_bp/u0/INIRAMD.COM b/Source/Images/d_bp/u15/iniramd.com similarity index 100% rename from Source/Images/d_bp/u0/INIRAMD.COM rename to Source/Images/d_bp/u15/iniramd.com diff --git a/Source/Images/d_bp/u0/INITDIR.COM b/Source/Images/d_bp/u15/initdir.com similarity index 100% rename from Source/Images/d_bp/u0/INITDIR.COM rename to Source/Images/d_bp/u15/initdir.com diff --git a/Source/Images/d_bp/u0/INSTAL12.COM b/Source/Images/d_bp/u15/instal12.com similarity index 100% rename from Source/Images/d_bp/u0/INSTAL12.COM rename to Source/Images/d_bp/u15/instal12.com diff --git a/Source/Images/d_bp/u0/IOPINIT.COM b/Source/Images/d_bp/u15/iopinit.com similarity index 100% rename from Source/Images/d_bp/u0/IOPINIT.COM rename to Source/Images/d_bp/u15/iopinit.com diff --git a/Source/Images/d_bp/u0/JETLDR.COM b/Source/Images/d_bp/u15/jetldr.com similarity index 100% rename from Source/Images/d_bp/u0/JETLDR.COM rename to Source/Images/d_bp/u15/jetldr.com diff --git a/Source/Images/d_bp/u0/LDR.COM b/Source/Images/d_bp/u15/ldr.com similarity index 100% rename from Source/Images/d_bp/u0/LDR.COM rename to Source/Images/d_bp/u15/ldr.com diff --git a/Source/Images/d_bp/u15/ldsys.com b/Source/Images/d_bp/u15/ldsys.com new file mode 100644 index 00000000..806330f7 Binary files /dev/null and b/Source/Images/d_bp/u15/ldsys.com differ diff --git a/Source/Images/d_bp/u15/ldtimec.com b/Source/Images/d_bp/u15/ldtimec.com new file mode 100644 index 00000000..fec7f9a2 Binary files /dev/null and b/Source/Images/d_bp/u15/ldtimec.com differ diff --git a/Source/Images/d_bp/u15/lsh.com b/Source/Images/d_bp/u15/lsh.com new file mode 100644 index 00000000..aa2c70a3 Binary files /dev/null and b/Source/Images/d_bp/u15/lsh.com differ diff --git a/Source/Images/d_bp/u15/lshf.com b/Source/Images/d_bp/u15/lshf.com new file mode 100644 index 00000000..85af88a1 Binary files /dev/null and b/Source/Images/d_bp/u15/lshf.com differ diff --git a/Source/Images/d_bp/u15/lu.com b/Source/Images/d_bp/u15/lu.com new file mode 100644 index 00000000..80be2171 Binary files /dev/null and b/Source/Images/d_bp/u15/lu.com differ diff --git a/Source/Images/d_bp/u0/park.com b/Source/Images/d_bp/u15/park.com similarity index 100% rename from Source/Images/d_bp/u0/park.com rename to Source/Images/d_bp/u15/park.com diff --git a/Source/Images/d_bp/u0/PATH.COM b/Source/Images/d_bp/u15/path.com similarity index 100% rename from Source/Images/d_bp/u0/PATH.COM rename to Source/Images/d_bp/u15/path.com diff --git a/Source/Images/d_bp/u15/poke.com b/Source/Images/d_bp/u15/poke.com new file mode 100644 index 00000000..7861f558 Binary files /dev/null and b/Source/Images/d_bp/u15/poke.com differ diff --git a/Source/Images/d_bp/u0/PUTDS.COM b/Source/Images/d_bp/u15/putds.com similarity index 100% rename from Source/Images/d_bp/u0/PUTDS.COM rename to Source/Images/d_bp/u15/putds.com diff --git a/Source/Images/d_bp/u15/ql.com b/Source/Images/d_bp/u15/ql.com new file mode 100644 index 00000000..f5a9c68c Binary files /dev/null and b/Source/Images/d_bp/u15/ql.com differ diff --git a/Source/Images/d_bp/u15/rcopy.com b/Source/Images/d_bp/u15/rcopy.com new file mode 100644 index 00000000..0a7ec09d Binary files /dev/null and b/Source/Images/d_bp/u15/rcopy.com differ diff --git a/Source/Images/d_bp/u15/save.com b/Source/Images/d_bp/u15/save.com new file mode 100644 index 00000000..0f6d8352 Binary files /dev/null and b/Source/Images/d_bp/u15/save.com differ diff --git a/Source/Images/d_bp/u15/sd.com b/Source/Images/d_bp/u15/sd.com new file mode 100644 index 00000000..49fc2f64 Binary files /dev/null and b/Source/Images/d_bp/u15/sd.com differ diff --git a/Source/Images/d_bp/u0/SETCLOK.COM b/Source/Images/d_bp/u15/setclok.com similarity index 100% rename from Source/Images/d_bp/u0/SETCLOK.COM rename to Source/Images/d_bp/u15/setclok.com diff --git a/Source/Images/d_bp/u0/SHOWHD.COM b/Source/Images/d_bp/u15/showhd.com similarity index 100% rename from Source/Images/d_bp/u0/SHOWHD.COM rename to Source/Images/d_bp/u15/showhd.com diff --git a/Source/Images/d_bp/u0/SIZERAM.COM b/Source/Images/d_bp/u15/sizeram.com similarity index 100% rename from Source/Images/d_bp/u0/SIZERAM.COM rename to Source/Images/d_bp/u15/sizeram.com diff --git a/Source/Images/d_bp/u0/SLOWDOWN.COM b/Source/Images/d_bp/u15/slowdown.com similarity index 100% rename from Source/Images/d_bp/u0/SLOWDOWN.COM rename to Source/Images/d_bp/u15/slowdown.com diff --git a/Source/Images/d_bp/u0/SPEEDUP.COM b/Source/Images/d_bp/u15/speedup.com similarity index 100% rename from Source/Images/d_bp/u0/SPEEDUP.COM rename to Source/Images/d_bp/u15/speedup.com diff --git a/Source/Images/d_bp/u0/spinup.com b/Source/Images/d_bp/u15/spinup.com similarity index 100% rename from Source/Images/d_bp/u0/spinup.com rename to Source/Images/d_bp/u15/spinup.com diff --git a/Source/Images/d_bp/u0/TDD.COM b/Source/Images/d_bp/u15/tdd.com similarity index 100% rename from Source/Images/d_bp/u0/TDD.COM rename to Source/Images/d_bp/u15/tdd.com diff --git a/Source/Images/d_bp/u0/TURBO.COM b/Source/Images/d_bp/u15/turbo.com similarity index 100% rename from Source/Images/d_bp/u0/TURBO.COM rename to Source/Images/d_bp/u15/turbo.com diff --git a/Source/Images/d_bp/u0/VALIAS.COM b/Source/Images/d_bp/u15/valias.com similarity index 100% rename from Source/Images/d_bp/u0/VALIAS.COM rename to Source/Images/d_bp/u15/valias.com diff --git a/Source/Images/d_bp/u15/xzrl.com b/Source/Images/d_bp/u15/xzrl.com deleted file mode 100644 index 2d1e4e2b..00000000 Binary files a/Source/Images/d_bp/u15/xzrl.com and /dev/null differ diff --git a/Source/Images/d_bp/u15/xzrl.doc b/Source/Images/d_bp/u15/xzrl.doc deleted file mode 100644 index ae370d02..00000000 --- a/Source/Images/d_bp/u15/xzrl.doc +++ /dev/null @@ -1,51 +0,0 @@ - - >>> XZRL.DOC <<< - -Overview --------- - -XZRL (eXamine ZRL files) is a REL file reading utility for use with ZCPR. - - -Installation ------------- - -ZCPR 3.0 users must install this utility first with their favorite -installation method, whereas no installation is required for operation -in ZCPR 3.3 and 3.4 environments. - - -Syntax ------- - -The help screen for XZRL is fairly self-explanatory and is invoked -by the command : - - XZRL // - -The help screen has the following format : - -============================================================================== - XZRL 1.0 Copyright 1989 by S.Fascher - - Function : eXamine ZRL (or any REL files) generated by M80 or SLR - - Syntax : - - XZRL / - shows this help message - XZRL [du:]fname1[.ext] - examines file fname1 - XZRL [du:]fname1.LBR - shows fname1 library directory only - XZRL [du:]fname1[.LBR] fname2[.ext] - examines library member fname2 - - Note : If [.ext] is not specified, the current default file extensions - REL and ZRL will be automatically searched for. -============================================================================== - -The default extensions can be changed if desired ( see xzrl.pat ) , with -the new extensions automatically appearing in the help menu. - - - enjoy !!! - - - \ No newline at end of file diff --git a/Source/Images/d_bp/u0/ZCNFG.COM b/Source/Images/d_bp/u15/zcnfg.com similarity index 100% rename from Source/Images/d_bp/u0/ZCNFG.COM rename to Source/Images/d_bp/u15/zcnfg.com diff --git a/Source/Images/d_bp/u15/zex.com b/Source/Images/d_bp/u15/zex.com new file mode 100644 index 00000000..cd46405d Binary files /dev/null and b/Source/Images/d_bp/u15/zex.com differ diff --git a/Source/Images/d_bp/u15/zpath.com b/Source/Images/d_bp/u15/zpath.com new file mode 100644 index 00000000..5c0aa503 Binary files /dev/null and b/Source/Images/d_bp/u15/zpath.com differ diff --git a/Source/Images/d_bp/u0/ZSCFG2.COM b/Source/Images/d_bp/u15/zscfg2.com similarity index 100% rename from Source/Images/d_bp/u0/ZSCFG2.COM rename to Source/Images/d_bp/u15/zscfg2.com diff --git a/Source/Images/d_bp/u0/ZSCONFIG.COM b/Source/Images/d_bp/u15/zsconfig.com similarity index 100% rename from Source/Images/d_bp/u0/ZSCONFIG.COM rename to Source/Images/d_bp/u15/zsconfig.com diff --git a/Source/Images/d_bp/u15/zshow.com b/Source/Images/d_bp/u15/zshow.com new file mode 100644 index 00000000..0bd0b1de Binary files /dev/null and b/Source/Images/d_bp/u15/zshow.com differ diff --git a/Source/Images/d_cpm22.txt b/Source/Images/d_cpm22.txt deleted file mode 100644 index 49f112c3..00000000 --- a/Source/Images/d_cpm22.txt +++ /dev/null @@ -1,17 +0,0 @@ -# -# Add RomWBW utilities -# -../../Binary/Apps/*.com 0: -# -# Add Tune sample files -# -../../Binary/Apps/Tunes/*.pt? 3: -../../Binary/Apps/Tunes/*.mym 3: -# -# Add OS image -# -../CPM22/cpm_wbw.sys 0:cpm.sys -# -# Add Common Applications -# -Common/*.* 0: diff --git a/Source/Images/d_cpm22/ReadMe.txt b/Source/Images/d_cpm22/ReadMe.txt new file mode 100644 index 00000000..ccb523e4 --- /dev/null +++ b/Source/Images/d_cpm22/ReadMe.txt @@ -0,0 +1,162 @@ +===== CP/M-80 2.2 Disk for RomWBW ===== + +This disk is one of several ready-to-run disks provided with RomWBW. +It contains a vanilla distribution of DRI's CP/M-80 2.2 adapted for +RomWBW. The disk is bootable as is (the operating system image is +already embedded in the system tracks) and can be launched from the +RomWBW Loader prompt. + +The remainder of this document describes the usage and contents of +this disk. It is highly recommended that you review the "RomWBW +User Guide.pdf" document found in the Doc directory of the +RomWBW Distribution. + +== Usage == + + - All installation steps needed to run CP/M 2.2 have already been + performed. It is not necessary to perform the steps in the + Alteration section of the CPM Manual. + - The MOVCPM application referred to in the manual is not needed + with RomWBW and is not included. + - The manual refers to the use of SYSGEN to install a copy of CP/M 2.2 + on the boot tracks of a disk to make it bootable. Under RomWBW, it + is recommended that you use SYSCOPY instead. SYSGEN is included, + but SYSCOPY is more flexible. The use of SYSCOPY is documented in + the RomWBW Applications document. + +== Notes == + + - SUBMIT.COM has been patched per the official DRI patch list such + that the submit file will always be placed on the A: drive which + ensures it will be run properly even if your default drive is not + currently A:. + - DDT, DDTZ, and ZSID have been patched to use RST 6 instead of the + original RST 7 vector for single step debugging. This is mandatory + for a Z80 CPU which uses RST 7 for hardware interrupts. + - CP/M 2.2 was not distributed with a help system. Douglas Miller + has adapted the CP/M 3 help system for CP/M 2.2 and is included. + The HELP.HLP data file must be found on the current default drive + and user area when HELP.COM is run. + +== CP/M 2.2 Files == + +The following CP/M 2.2 files were distributed by DRI with the operating +system or as supplemental add-on programs. They are documented in the +"CP/M Manual.pdf" document in the Doc directory of the Rom WBW +distribution. MAC, RMAC, ZSID are supplemental programs from DRI +with separate standalone documentation which is not included in the +RomWBW package (but easily found on the Internet via Google search). + +ASM.COM - DRI 8080 assembler producing Intel hex files +DDT.COM - DRI 8080 debugger +DUMP.COM - Tool to dump a file in hex +ED.COM - DRI line editor +HELP.COM - HELP display program (derived from CP/M 3 HELP.COM) +HELP.HLP - HELP data file +LIB.COM - DRI relocatable object file librarian +LINK.COM - DRI relocatable object file linker +LOAD.COM - DRI loader for Intel hex files +MAC.COM - DRI 8080 macro assembler producing Intel hex files +PIP.COM - DRI file transfer (Peripheral Interchange Program) +RMAC.COM - DRI 8080 macro assembler producing relocatable object files +STAT.COM - DRI multi-purpose file/disk/device info & configuration tool +SUBMIT.COM - DRI batch file submission tool +XSUB.COM - DRI batch file enhancer resident system extension +ZSID.COM - DRI enhanced debugger for Z80 CPU + +== RomWBW Supplemental Applications == + +The following files provide specific functionality enabled by +RomWBW enhancements. These applications are documented in the +"RomWBW Applications.pdf" document in the Doc directory of the +RomWBW Distribution. + +ASSIGN.COM - Assign,remove,swap drive letters of RomWBW disk slices +FAT.COM - MS-DOS FAT filesystem tool (list, copy, delete, format, etc.) +FDU.COM - Test floppy hardware and format floppy disks +FORMAT.COM - Placeholder application with formatting instructions +INTTEST.COM - Test RomWBW interrupt processing on your hardware +MODE.COM - Change serial line characteristics (baud rate, etc.) +RTC.COM - Test real time clock hardware on your system +SURVEY.COM - Display system resources summary +SYSCOPY.COM - Copy system tracks to disks (make bootable) +SYSGEN.COM - Copy system tracks to disks (DRI version) +TALK.COM - Route console I/O to & from specified serial port +TIMER.COM - Test and display system timer ticks +TUNE.COM - Play .PT2, .PT3, and .MYM audio files on supported hardware +XM.COM - XModem file transfer application +ZMP.COM - ZModem communications program (requires dedicated comm port) +ZMP.DOC - Documentation for ZMP +ZMP.HLP - Help file for ZMP +ZMXFER.OVR - Overlay file for ZMP +ZMTERM.OVR - Overlay file for ZMP +ZMINIT.OVR - Overlay file for ZMP +ZMCONFIG.OVR - Overlay file for ZMP + +== General Purpose Applications == + +The following files are commonly used CP/M applications that +are generally useful in any CP/M-like system. In general, there is +no documentation for these applications included with the RomWBW +distribution. Some provide command line help themselves. Some +are fairly obvious. + +CLRDIR.COM - Initializes the directory area of a disk +COMPARE.COM - Compare content of two files (binary) +CRUNCH.COM - Compress file(s) using Crunch algorithm +CRUNCH28.CFG - ZCNFG configuration file for CRUNCH & UNCR +DDTZ.COM - Z80 debug tool (modified to use RST 6) +DDTZ.DOC - Documentation for DDTZ +EX.COM - Batch file processor (alternative to DRI SUBMIT) +FDISK80.COM - Hard disk partitioning tool (from John Coffman) +FIND.COM - Search all drives for a file (from Jay Cotton) +FLASH.COM - Program FLASH chips in-situ (from Will Sowerbutts) +FLASH.DOC - Documentation for FLASH +MBASIC.COM - Microsoft BASIC language interpreter +NULU.COM - Library (.LBR) management tool +PMARC.COM - Create or add file(s) to .PMA archive +PMEXT.COM - Extract file(s) from .PMA/.LZH/.LHA archive +RMXSUB1.COM - Remove XSUB1 RSX from memory (from Lars Nelson) +SUPERSUB.COM - Enhanced replacement for DRI SUBMIT +SUPERSUB.DOC - Documentation for SUPERSUB +TDLBASIC.COM - TDL Zapple 12K BASIC language interpreter +UNARC.COM - Extract file(s) from .ARC or .ARK archive +UNARC.DOC - Documentation for UNARC +UNCR.COM - Decompress Crunched file(s) +UNZIP.COM - UNZIPZ extracts from all MS-DOS ZIP files (from Lars Nelson) +UNZIP.DOC - Documentation for UNZIPZ +XSUB1.COM - Replacement for DRI SUB (from Lars Nelson) +ZAP.COM - Interactive disk & file utility +ZDE.COM - Compact WordStar-like editor +ZDENST.COM - Installation/configuration tool for ZDE +KERCPM22.COM - Kermit file transfer application +LBREXT.COM - Extract file from .LBR libraries +LBREXT36.CFG - ZCNFG configuration file for LBREXT +ZXD.COM - Enhanced directory lister w/ date/time stamp support +ZXD.CFG - ZCNFG configuration file for ZXD + +== Testing Applications (User Area 2) == + +User area 2 contains a variety of hardware testing applications. +These are generally user contributed and have no documentation. + +N.B., these applications are frequently not compatible with all RomWBW +hardware. They are included here as a convenience. If applicable, +your hardware documentation should refer to them and provide usage +instructions. + +== Sample Tune Files (User Area 3) == + +User area 3 contains sample audio files that can be played using +the TUNE application. + +== CP/NET 1.2 (User Area 4) == + +User area 4 contains a full implementation of the CP/NET 1.2 +client provided by Doug Miller. Please read the README.TXT file +in this user area for more information. + +N.B., at a minimum, some of the files in this user area must be copied +to user area 0 for CP/NET to work properly. + +-- WBW 3:20 PM 8/27/2021 \ No newline at end of file diff --git a/Source/Images/d_cpm22/u0/CR.COM b/Source/Images/d_cpm22/u0/CR.COM deleted file mode 100644 index 8a824bcc..00000000 Binary files a/Source/Images/d_cpm22/u0/CR.COM and /dev/null differ diff --git a/Source/Images/d_cpm22/u0/DDTZ.DOC b/Source/Images/d_cpm22/u0/DDTZ.DOC deleted file mode 100644 index e4470528..00000000 --- a/Source/Images/d_cpm22/u0/DDTZ.DOC +++ /dev/null @@ -1,564 +0,0 @@ - - DDTZ v2.7 - by C.B. Falconer - edited by George A. Havach - -Introduction: -============ -DDTZ v2.7 is a complete replacement for DDT, Digital Research's -famous Dynamic Debugging Tool, with improved functionality, bug -extermination, and full Z80 support. In general, DDTZ is fully -compatible with the original utility, but it has extra and -extended commands and many fewer quirks. All Z80-specific -instructions can be (dis)assembled, though in Intel rather then -Zilog format. Furthermore, DDTZ will correctly trace ('T' and 'U' -commands) both 8080 and Z80 instructions, depending on which CPU -is operating. On startup, the program announces which CPU it is -running on. - -DDTZ v2.7 now handles the 64180 added opcodes. It does NOT test -for a 64180 CPU, since this cannot be done without executing -illegal Z80 instructions, which in turn will crash some -simulators. However v2.7 does not execute any 64180 instructions -internally, only in the subject program. - -This issue supplies the "M" version assembled, to avoid errors -when switching between MSDOS and CPM systems. The command table -is updated accordingly. Most CPM users are also MSDOS users, but -not vice-versa. - -The program is invoked by typing - - ddtz -or - ddtz [d:]filespec - -In the second form, DDTZ will load the specified file into -memory starting at 0100H, unless it's a .HEX file that sets its -own load address. Besides reporting the NEXT free address and -the PC (program counter) after a successful load, DDTZ also shows -the number of memory pages needed for a SAVE. Instead of having -to write all this down, just use the 'X' command at any time to -redisplay these three values for the current application. - -NOTE: loading more code above the NEXT pointer revises these - values. - -As in DDT, when a program is loaded above the area holding the -'A' and 'U' (and now 'W') command code, these commands are -disabled, and the extra memory is released to the user. Thus, -DDTZ can occupy as little as 3K total memory space. Unlike DDT, -however, DDTZ will not overwrite itself or the system on program -loads (except .HEX files). - -At initialization, the stack pointer (SP) points to a return to -DDTZ, just like for the CCP. Thus, programs that normally return -to the CCP will be returned to DDTZ. The 'B' command -reinitializes this condition. - - -The intercept vector copies the BDOS version number, etc., so -an object program does not know that DDTZ is running (except -for BIOS-BDOS vector size). Thus, programs that check the version -number should execute correctly under DDTZ. - -All input parameters can now be entered in any of three formats: - - (1) hexadecimal (as in DDT), - (2) decimal, by adding a leading '#' character, - (3) ASCII, by enclosing between either single or double - quotes; either one or two characters are allowed. - -Leading blanks in command lines and parameters are absorbed. -Either a comma or a (single) space is a valid delimiter. -Either uppercase or lowercase input is accepted. - -The default command (for anything not otherwise recognizable) -is 'H'. This allows convenient calculation, along with the other -features described below. So, to convert a number, just enter -it! - -As in DDT, the prompt character is '-', and the only error -message is the query ('?'), which generally kicks you back to -command mode. - -New Commands (Over DDT): -======================= - -NOTE: letters in parenthesis, e.g. "(U)", show the equivalent - command for DDTZM version (compatible with MSDOS debug). - - @ Sets or shows (with no parameter) the internally stored - "base" value. Also used with the 'S' and 'D' commands as - an optional parameter (though without the '@') to display - memory from an arbitrary base marker (offset). When set to - zero (the default), it does not affect any screen displays. - - B B)egin: resets the USER stack pointer to its initial value, - such that any program that exits by an RET will return to - DDTZ. DDTZ provides a default stack space of - approximately 24 bytes for user programs. - - C C)ompare first_address,last_address,against_address: shows - all the byte differences between two memory areas, in the - format - - XXXX aa YYYY bb - - where XXXX and YYYY are the comparative memory addresses, - and aa and bb are the corresponding byte values. Can be - used to verify the identity of two files by first - loading them into different memory areas with the 'R' - command (see below). - - - W Write: stores the modified memory area to disk under the - (K) filename specified by the 'I' command, overwriting the - original file from which it was loaded (the user is queried - before doing so). By default, the image of memory from - 0100H through the "NEXT" value -1 is saved. "K first_addr, - last_address" overrides this and allows writing ANY memory - area to a file. Almost a necessity for CPM 3.0 (no SAVE!). - K)eep on DDTZ - - X eXamine: redisplays the "NEXT PC SAVE" report at any time. - (Q) Q)uery size on DDTZ. - - S S)earch first_address, last_addr, value: searches the - (W) specified memory area for the value (a 16-bit word, not a - byte) and shows the locations of all such. Very useful for - finding CALL's or JMP's to a particular address, etc. - W)here on DDTZ - - Y Y)our_option parm1,parm2,address: executes an arbitrary - routine at the specified address, with the BC and DE - registers set to parm1 and parm2, respectively. - - Z Displays (but does not alter) the Z80's alternate register - set, including the index registers (disabled if running on - an 8080). On Z80's, automatically included as the last - part of the display by the 'X' command. - - -Based (Offset) Displays: -======================= - -The 'D' and 'E' commands can use a stored base value (offset), -as set by the '@' command. The current @ value may be -overridden for a single execution of these commands by adding the -base as an extra parameter in the command line. The effect is -to add this value to the first/last address and display -accordingly. The address listing on the left becomes XXXX:YYYY, -where XXXX is the offset address and YYYY is the actual memory -address being displayed. For example, if you have a data area -located at 42B7H and wish to preserve easy access, just enter -"@42b7". Now, "d0,3f" will dump memory starting at 4237H. - - -Further Changes from DDT: -======================== - - A A)ssemble now accepts the full Z80 as well as 8080 - instruction set, although it expects them in Intel rather - than Zilog format (see notes below under the 'L' - command). When in doubt, see the mnemnonic list below. - - D D)isplay or D)ump will accept an optional third parameter - to set the base value for a single execution only. Format - has been cleaned up. - - H H)ex_arithmetic on two values also shows their - difference in decimal. With only one value, converts to - hexadecimal, decimal, and ASCII (low-order byte only). - - - N N)ame now allows drive specification (d:...) and sets up - (I) the complete command line, including both FCB's (at - addresses 005CH and 006CH). The tail (stored at 0081H up) - is NOT upshifted. - I)nput on DDTZ - - U U)nassemble now displays the raw hexcode, especially handy - (L) when examining non-code areas. Intel (8080 style) mnemonics - are used, so some disassembled instructions may look - strange. E.g., the Z80's 'IN B,(C)' and 'OUT (C),B' become - 'INP B' and 'OUTP B', respectively; 'LD (nnnn),BC' becomes - 'SBCD nnnn', 'ADD IX, BC' becomes 'DADX B', and 'JP (IX)' - becomes 'PCIX'. - L)ist on DDTZ - - L L)oad now permits loading a file into memory with an - (R) offset, which is added to the default load address of - 0100H. When reading in a .HEX file with a preset bias, - the 'R' command will not transfer control to an invalid - execution point. Another execution of the 'R' command will - reread the input file, e.g.: - - n blah - l - ...modify the code and generally mess about... - l - - The original file is reloaded, and the modifications are - removed. - R)ead on DDTZ - - E E)nter, like D)isplay, now accepts an optional second - (S) parameter to set the base value for a single execution - only. - S)ubstitute or S)et on DDTZ - - T T)rap/trace on termination now shows the complete CPU - state. Traps and traces no longer lock up when a user RST - 7 instruction is executed. Tracing of BDOS/BIOS calls is - heavily trun cated, avoiding clutter and preventing system - crashes. - -NOTE: Most of the UNDOCUMENTED Z80 op-codes are handled. Others - can crash the system. - - R R)egisters also shows what two-byte values the HL and SP - (X) registers are actually pointing to. On Z80's, displays the - alternate register set. - eX)amine on DDTZ - -NOTE: Any use of the 'W' or 'L' command resets the system DMA - transfer address to the standard default value of 0080H. - - -; This is the output of DDTZ when disassembling OPTYPE.TRY -NOP LDA 06A4 MOV M,H -LXI B,06A4 DCX SP MOV M,L -STAX B INR A HLT -INX B DCR A MOV M,A -INR B MVI A,20 MOV A,B -DCR B CMC MOV A,C -MVI B,20 MOV B,B MOV A,D -RLC MOV B,C MOV A,E -EXAF MOV B,D MOV A,H -DAD B MOV B,E MOV A,L -LDAX B MOV B,H MOV A,M -DCX B MOV B,L MOV A,A -INR C MOV B,M ADD B -DCR C MOV B,A ADD C -MVI C,20 MOV C,B ADD D -RRC MOV C,C ADD E -DJNZ 0134 MOV C,D ADD H -LXI D,06A4 MOV C,E ADD L -STAX D MOV C,H ADD M -INX D MOV C,L ADD A -INR D MOV C,M ADC B -DCR D MOV C,A ADC C -MVI D,20 MOV D,B ADC D -RAL MOV D,C ADC E -JR 0134 MOV D,D ADC H -DAD D MOV D,E ADC L -LDAX D MOV D,H ADC M -DCX D MOV D,L ADC A -INR E MOV D,M SUB B -DCR E MOV D,A SUB C -MVI E,20 MOV E,B SUB D -RAR MOV E,C SUB E -JRNZ 0134 MOV E,D SUB H -LXI H,06A4 MOV E,E SUB L -SHLD 06A4 MOV E,H SUB M -INX H MOV E,L SUB A -INR H MOV E,M SBB B -DCR H MOV E,A SBB C -MVI H,20 MOV H,B SBB D -DAA MOV H,C SBB E -JRZ 0134 MOV H,D SBB H -DAD H MOV H,E SBB L -LHLD 06A4 MOV H,H SBB M -DCX H MOV H,L SBB A -INR L MOV H,M ANA B -DCR L MOV H,A ANA C -MVI L,20 MOV L,B ANA D -CMA MOV L,C ANA E -JRNC 0134 MOV L,D ANA H -LXI SP,06A4 MOV L,E ANA L -STA 06A4 MOV L,H ANA M -INX SP MOV L,L ANA A -INR M MOV L,M XRA B -DCR M MOV L,A XRA C -MVI M,20 MOV M,B XRA D -STC MOV M,C XRA E -JRC 0134 MOV M,D XRA H -DAD SP MOV M,E XRA L - - -XRA M JPE 06A4 SLAR M -XRA A XCHG SLAR A -ORA B CPE 06A4 SRAR B -ORA C XRI 20 SRAR C -ORA D RST 5 SRAR D -ORA E RP SRAR E -ORA H POP PSW SRAR H -ORA L JP 06A4 SRAR L -ORA M DI SRAR M -ORA A CP 06A4 SRAR A -CMP B PUSH PSW SLLR B -CMP C ORI 20 SLLR C -CMP D RST 6 SLLR D -CMP E RM SLLR E -CMP H SPHL SLLR H -CMP L JM 06A4 SLLR L -CMP M EI SLLR M -CMP A CM 06A4 SLLR A -RNZ CPI 20 SRLR B -POP B RST 7 SRLR C -JNZ 06A4 RLCR B SRLR D -JMP 06A4 RLCR C SRLR E -CNZ 06A4 RLCR D SRLR H -PUSH B RLCR E SRLR L -ADI 20 RLCR H SRLR M -RST 0 RLCR L SRLR A -RZ RLCR M BIT 0,B -RET RLCR A BIT 0,C -JZ 06A4 RRCR B BIT 0,D -CZ 06A4 RRCR C BIT 0,E -CALL 06A4 RRCR D BIT 0,H -ACI 20 RRCR E BIT 0,L -RST 1 RRCR H BIT 0,M -RNC RRCR L BIT 0,A -POP D RRCR M BIT 1,B -JNC 06A4 RRCR A BIT 1,C -OUT 20 RALR B BIT 1,D -CNC 06A4 RALR C BIT 1,E -PUSH D RALR D BIT 1,H -SUI 20 RALR E BIT 1,L -RST 2 RALR H BIT 1,M -RC RALR L BIT 1,A -EXX RALR M BIT 2,B -JC 06A4 RALR A BIT 2,C -IN 20 RARR B BIT 2,D -CC 06A4 RARR C BIT 2,E -SBI 20 RARR D BIT 2,H -RST 3 RARR E BIT 2,L -RPO RARR H BIT 2,M -POP H RARR L BIT 2,A -JPO 06A4 RARR M BIT 3,B -XTHL RARR A BIT 3,C -CPO 06A4 SLAR B BIT 3,D -PUSH H SLAR C BIT 3,E -ANI 20 SLAR D BIT 3,H -RST 4 SLAR E BIT 3,L -RPE SLAR H BIT 3,M -PCHL SLAR L BIT 3,A - - -BIT 4,B RES 3,D SET 2,H -BIT 4,C RES 3,E SET 2,L -BIT 4,D RES 3,H SET 2,M -BIT 4,E RES 3,L SET 2,A -BIT 4,H RES 3,M SET 3,B -BIT 4,L RES 3,A SET 3,C -BIT 4,M RES 4,B SET 3,D -BIT 4,A RES 4,C SET 3,E -BIT 5,B RES 4,D SET 3,H -BIT 5,C RES 4,E SET 3,L -BIT 5,D RES 4,H SET 3,M -BIT 5,E RES 4,L SET 3,A -BIT 5,H RES 4,M SET 4,B -BIT 5,L RES 4,A SET 4,C -BIT 5,M RES 5,B SET 4,D -BIT 5,A RES 5,C SET 4,E -BIT 6,B RES 5,D SET 4,H -BIT 6,C RES 5,E SET 4,L -BIT 6,D RES 5,H SET 4,M -BIT 6,E RES 5,L SET 4,A -BIT 6,H RES 5,M SET 5,B -BIT 6,L RES 5,A SET 5,C -BIT 6,M RES 6,B SET 5,D -BIT 6,A RES 6,C SET 5,E -BIT 7,B RES 6,D SET 5,H -BIT 7,C RES 6,E SET 5,L -BIT 7,D RES 6,H SET 5,M -BIT 7,E RES 6,L SET 5,A -BIT 7,H RES 6,M SET 6,B -BIT 7,L RES 6,A SET 6,C -BIT 7,M RES 7,B SET 6,D -BIT 7,A RES 7,C SET 6,E -RES 0,B RES 7,D SET 6,H -RES 0,C RES 7,E SET 6,L -RES 0,D RES 7,H SET 6,M -RES 0,E RES 7,L SET 6,A -RES 0,H RES 7,M SET 7,B -RES 0,L RES 7,A SET 7,C -RES 0,M SET 0,B SET 7,D -RES 0,A SET 0,C SET 7,E -RES 1,B SET 0,D SET 7,H -RES 1,C SET 0,E SET 7,L -RES 1,D SET 0,H SET 7,M -RES 1,E SET 0,L SET 7,A -RES 1,H SET 0,M DADX B -RES 1,L SET 0,A DADX D -RES 1,M SET 1,B LXI X,06A4 -RES 1,A SET 1,C SIXD 06A4 -RES 2,B SET 1,D INX X -RES 2,C SET 1,E DADX X -RES 2,D SET 1,H LIXD 06A4 -RES 2,E SET 1,L DCX X -RES 2,H SET 1,M INR [X+05] -RES 2,L SET 1,A DCR [X+05] -RES 2,M SET 2,B MVI [X+05],20 -RES 2,A SET 2,C DADX SP -RES 3,B SET 2,D MOV B,[X+05] -RES 3,C SET 2,E MOV C,[X+05] - - -MOV D,[X+05] DSBC B DADY B -MOV E,[X+05] SBCD 06A4 DADY D -MOV H,[X+05] NEG LXI Y,06A4 -MOV L,[X+05] RETN SIYD 06A4 -MOV [X+05],B IM0 INX Y -MOV [X+05],C LDIA DADY Y -MOV [X+05],D INP C LIYD 06A4 -MOV [X+05],E OUTP C DCX Y -MOV [X+05],H DADC B INR [Y+05] -MOV [X+05],L LBCD 06A4 DCR [Y+05] -MOV [X+05],A RETI MVI [Y+05],2 -MOV A,[X+05] LDRA DADY SP -ADD [X+05] INP D MOV B,[Y+05] -ADC [X+05] OUTP D MOV C,[Y+05] -SUB [X+05] DSBC D MOV D,[Y+05] -SBB [X+05] SDED 06A4 MOV E,[Y+05] -ANA [X+05] IM1 MOV H,[Y+05] -XRA [X+05] LDAI MOV L,[Y+05] -ORA [X+05] INP E MOV [Y+05],B -CMP [X+05] OUTP E MOV [Y+05],C -POP X DADC D MOV [Y+05],D -XTIX LDED 06A4 MOV [Y+05],E -PUSH X IM2 MOV [Y+05],H -PCIX LDAR MOV [Y+05],L -SPIX INP H MOV [Y+05],A -RLCR [X+05] OUTP H MOV A,[Y+05] -RRCR [X+05] DSBC H ADD [Y+05] -RALR [X+05] shld 06A4 ADC [Y+05] -RARR [X+05] RRD SUB [Y+05] -SLAR [X+05] INP L SBB [Y+05] -SRAR [X+05] OUTP L ANA [Y+05] -SRLR [X+05] DADC H XRA [Y+05] -BIT 0,[X+05] lhld 06A4 ORA [Y+05] -BIT 1,[X+05] RLD CMP [Y+05] -BIT 2,[X+05] INP M POP Y -BIT 3,[X+05] OUTP M XTIY -BIT 4,[X+05] DSBC SP PUSH Y -BIT 5,[X+05] SSPD 06A4 PCIY -BIT 6,[X+05] INP A SPIY -BIT 7,[X+05] OUTP A RLCR [Y+05] -RES 0,[X+05] DADC SP RRCR [Y+05] -RES 1,[X+05] LSPD 06A4 RALR [Y+05] -RES 2,[X+05] LDI RARR [Y+05] -RES 3,[X+05] CCI SLAR [Y+05] -RES 4,[X+05] INI SRAR [Y+05] -RES 5,[X+05] OTI SRLR [Y+05] -RES 6,[X+05] LDD BIT 0,[Y+05] -RES 7,[X+05] CCD BIT 1,[Y+05] -SET 0,[X+05] IND BIT 2,[Y+05] -SET 1,[X+05] OTD BIT 3,[Y+05] -SET 2,[X+05] LDIR BIT 4,[Y+05] -SET 3,[X+05] CCIR BIT 5,[Y+05] -SET 4,[X+05] INIR BIT 6,[Y+05] -SET 5,[X+05] OTIR BIT 7,[Y+05] -SET 6,[X+05] LDDR RES 0,[Y+05] -SET 7,[X+05] CCDR RES 1,[Y+05] -INP B INDR RES 2,[Y+05] -OUTP B OTDR RES 3,[Y+05] - - -RES 4,[Y+05] SET 0,[Y+05] SET 4,[Y+05] -RES 5,[Y+05] SET 1,[Y+05] SET 5,[Y+05] -RES 6,[Y+05] SET 2,[Y+05] SET 6,[Y+05] -RES 7,[Y+05] SET 3,[Y+05] SET 7,[Y+05] - -; These are the result of disassembling 64180OPS.TRY -; These opcodes are available ONLY on the 64180 CPU -; DDTZ will both assemble and disassemble these. -IN0 B,20 TST E MLT B -OUT0 20,B IN0 H,20 MLT D -TST B OUT0 20,H TSTI 20 -IN0 C,20 TST H MLT H -OUT0 20,C IN0 L,20 TSIO 20 -TST C OUT0 20,L SLP -IN0 D,20 TST L MLT SP -OUT0 20,D TST M OTIM -TST D IN0 A,20 OTDM -IN0 E,20 OUT0 20,A OIMR -OUT0 20,E TST A ODMR - -; The following are UNDOCUMENTED z80 opcodes from XTDOPS.TRY. -; DDTZ will disassemble these, but will not assemble them. -; They use xh/xl (or yh/yl) as separate byte registers. -; Use these at your own risk. -INRX H ACXR H MOVY H,B -DCRX H ACXR L MOVY H,C -MVIX H,20 SUXR H MOVY H,D -INRX L SUXR L MOVY H,E -DCRX L SBXR H MOVY H,A -MVIX L,20 SBXR L MOVY L,B -MOVX B,H NDXR H MOVY L,C -MOVX B,L NDXR L MOVY L,D -MOVX C,H XRXR H MOVY L,E -MOVX C,L XRXR L MOVY L,A -MOVX D,H ORXR H MOVY A,H -MOVX D,L ORXR L MOVY A,L -MOVX E,H CPXR H ADYR H -MOVX E,L CPXR L ADYR L -MOVX H,B INRY H ACYR H -MOVX H,C DCRY H ACYR L -MOVX H,D MVIY H,20 SUYR H -MOVX H,E INRY L SUYR L -MOVX H,A DCRY L SBYR H -MOVX L,B MVIY L,20 SBYR L -MOVX L,C MOVY B,H NDYR H -MOVX L,D MOVY B,L NDYR L -MOVX L,E MOVY C,H XRYR H -MOVX L,A MOVY C,L XRYR L -MOVX A,H MOVY D,H ORYR H -MOVX A,L MOVY D,L ORYR L -ADXR H MOVY E,H CPYR H -ADXR L MOVY E,L CPYR L - - -Command Summary: -=============== - -DDTZM command DDTZ command -============= ============ -@ (base) -A)ssemble first_address A -B)egin {i.e., initialize stack and return} B -C)ompare first_address,last_address,against_address C -D)ump first_address[,last_address[,base]] D -E)nter_in_memory first_address[,base] S)ubstitute -F)ill first_address,last_address,value F -G)o_to [address][,trap1[,trap2]] G -H)ex_arithmetic value1(,value2) H -L)oad_file (offset) R)ead -M)ove first_address,last_address,destination M -N)nput FCBs_command_line I)nput -Q)uit (not avail) -R)egister examine/change [register|flag] X)amine -S)earch first_address,last_address,word W)hereis -T)race_execution [count] T - Untrace_execution [count] (i.e. do count instr) U)ntrace -U)nassemble_code first_address[,last_address] L)ist code -W)rite [first_address,last_address] K)eep -X)amine {i.e. display memory parameters for application} Q)uery -Y)our_option BC:=parm1,DE:=parm2,call_address Y -Z)80_register_display Z - - -If you find this program useful, contributions will be gratefully -accepted and will encourage further development and release of -useful CPM programs. My practice is to include source. - -C.B. Falconer -680 Hartford Turnpike, -Hamden, Conn. 06517 (203) 281-1438 - -DDTZ and its associated documentation and other files are -copyright (c) 1980-1988 by C.B. Falconer. They may be freely -copied and used for non-commercial purposes ONLY. - diff --git a/Source/Images/d_cpm22/u0/DIRX.COM b/Source/Images/d_cpm22/u0/DIRX.COM deleted file mode 100644 index 413bceca..00000000 Binary files a/Source/Images/d_cpm22/u0/DIRX.COM and /dev/null differ diff --git a/Source/Images/d_cpm22/u0/HELP.COM b/Source/Images/d_cpm22/u0/HELP.COM new file mode 100644 index 00000000..3a4d4394 Binary files /dev/null and b/Source/Images/d_cpm22/u0/HELP.COM differ diff --git a/Source/Images/d_cpm22/u0/HELP.HLP b/Source/Images/d_cpm22/u0/HELP.HLP new file mode 100644 index 00000000..2dae4bcf Binary files /dev/null and b/Source/Images/d_cpm22/u0/HELP.HLP differ diff --git a/Source/Images/d_cpm22/u0/MBASIC.COM b/Source/Images/d_cpm22/u0/MBASIC.COM deleted file mode 100644 index c9ec3cd3..00000000 Binary files a/Source/Images/d_cpm22/u0/MBASIC.COM and /dev/null differ diff --git a/Source/Images/d_cpm22/u0/SUBMIT.COM b/Source/Images/d_cpm22/u0/SUBMIT.COM index 2e788827..f651bfee 100644 Binary files a/Source/Images/d_cpm22/u0/SUBMIT.COM and b/Source/Images/d_cpm22/u0/SUBMIT.COM differ diff --git a/Source/Images/d_cpm22/u0/UNCR.COM b/Source/Images/d_cpm22/u0/UNCR.COM deleted file mode 100644 index 42385ddd..00000000 Binary files a/Source/Images/d_cpm22/u0/UNCR.COM and /dev/null differ diff --git a/Source/Images/d_cpm22/u0/UNZIP.COM b/Source/Images/d_cpm22/u0/UNZIP.COM deleted file mode 100644 index afde7204..00000000 Binary files a/Source/Images/d_cpm22/u0/UNZIP.COM and /dev/null differ diff --git a/Source/Images/d_cpm3.txt b/Source/Images/d_cpm3.txt deleted file mode 100644 index 3ac5e227..00000000 --- a/Source/Images/d_cpm3.txt +++ /dev/null @@ -1,33 +0,0 @@ -# -# Add files from CPM3 build -# -../CPM3/cpmldr.com 0: -../CPM3/cpmldr.sys 0: -../CPM3/ccp.com 0: -../CPM3/gencpm.com 0: -../CPM3/genres.dat 0: -../CPM3/genbnk.dat 0: -../CPM3/bios3.spr 0: -../CPM3/bnkbios3.spr 0: -../CPM3/bdos3.spr 0: -../CPM3/bnkbdos3.spr 0: -../CPM3/resbdos3.spr 0: -../CPM3/cpm3res.sys 0: -../CPM3/cpm3bnk.sys 0: -../CPM3/gencpm.dat 0: -../CPM3/cpm3.sys 0: -../CPM3/readme.1st 0: -../CPM3/cpm3fix.pat 0: -# -# Add RomWBW utilities -# -../../Binary/Apps/*.com 0: -# -# Add Tune sample files -# -../../Binary/Apps/Tunes/*.pt? 3: -../../Binary/Apps/Tunes/*.mym 3: -# -# Add Common Applications -# -Common/*.* 0: diff --git a/Source/Images/d_dos65/ReadMe.txt b/Source/Images/d_dos65/ReadMe.txt new file mode 100644 index 00000000..5933796e --- /dev/null +++ b/Source/Images/d_dos65/ReadMe.txt @@ -0,0 +1,30 @@ +===== DOS/65 Disk for RomWBW ===== + +This disk is one of several ready-to-run disks provided with RomWBW. +It contains the files to start and run DOS/65 on an MBC system that +contains Dan Werner's 6502 processor. + +The remainder of this document describes the usage and contents of +this disk. It is highly recommended that you review the "RomWBW +User Guide.pdf" document found in the Doc directory of the +RomWBW Distribution. + +== Usage == + + - The disk is configured to boot under ZSDOS 1.1 (via primary Z80 + CPU). Once booted, you can launch DOS/65 on a secondary 6502 + CPU using the "DOS65" command. + +== Notes == + + - DOS/65 is generally compatible with the CP/M 2.2 filesystem. Once + launched, you will have access to the fielsystem of the boot disk. + + - DOS/65 does not utilize any of the RomWBW framework or drivers, so + it will only support devices built into DOS/65 itself. Once + launched DOS/65 takes over the hardware completely. + + - The contents of this disk are purely a redistribution of the work + of Dan Werner. + +-- WBW 2:47 PM 3/16/2023 \ No newline at end of file diff --git a/Source/Images/d_dos65/u0/alloc.co6 b/Source/Images/d_dos65/u0/alloc.co6 new file mode 100644 index 00000000..bf0fda84 Binary files /dev/null and b/Source/Images/d_dos65/u0/alloc.co6 differ diff --git a/Source/Images/d_dos65/u0/asm.co6 b/Source/Images/d_dos65/u0/asm.co6 new file mode 100644 index 00000000..95766085 Binary files /dev/null and b/Source/Images/d_dos65/u0/asm.co6 differ diff --git a/Source/Images/d_dos65/u0/assign.co6 b/Source/Images/d_dos65/u0/assign.co6 new file mode 100644 index 00000000..2e381e64 Binary files /dev/null and b/Source/Images/d_dos65/u0/assign.co6 differ diff --git a/Source/Images/d_dos65/u0/bcompile.co6 b/Source/Images/d_dos65/u0/bcompile.co6 new file mode 100644 index 00000000..bed7b51c Binary files /dev/null and b/Source/Images/d_dos65/u0/bcompile.co6 differ diff --git a/Source/Images/d_dos65/u0/compare.co6 b/Source/Images/d_dos65/u0/compare.co6 new file mode 100644 index 00000000..486a48f3 Binary files /dev/null and b/Source/Images/d_dos65/u0/compare.co6 differ diff --git a/Source/Images/d_dos65/u0/copy.co6 b/Source/Images/d_dos65/u0/copy.co6 new file mode 100644 index 00000000..4bcaaab2 Binary files /dev/null and b/Source/Images/d_dos65/u0/copy.co6 differ diff --git a/Source/Images/d_dos65/u0/cpm.co6 b/Source/Images/d_dos65/u0/cpm.co6 new file mode 100644 index 00000000..d74ddf4a Binary files /dev/null and b/Source/Images/d_dos65/u0/cpm.co6 differ diff --git a/Source/Images/d_dos65/u0/dbasic.co6 b/Source/Images/d_dos65/u0/dbasic.co6 new file mode 100644 index 00000000..c6fcd40a Binary files /dev/null and b/Source/Images/d_dos65/u0/dbasic.co6 differ diff --git a/Source/Images/d_dos65/u0/debug.co6 b/Source/Images/d_dos65/u0/debug.co6 new file mode 100644 index 00000000..612ffeda Binary files /dev/null and b/Source/Images/d_dos65/u0/debug.co6 differ diff --git a/Source/Images/d_dos65/u0/dos65.com b/Source/Images/d_dos65/u0/dos65.com new file mode 100644 index 00000000..b8633948 Binary files /dev/null and b/Source/Images/d_dos65/u0/dos65.com differ diff --git a/Source/Images/d_dos65/u0/dos65.hex b/Source/Images/d_dos65/u0/dos65.hex new file mode 100644 index 00000000..6d0b03cf --- /dev/null +++ b/Source/Images/d_dos65/u0/dos65.hex @@ -0,0 +1,129 @@ +:205000004CA8E5D84820FCD3682000D4AD8CE44A4A4A4A8DF6D7AD43D7D03CA2FF9AD8A91E +:205020001120F0D32069D4A93E20F0D3AD8BD6AC8CD620F4D3A000AE43D7F0DFB944D7C97E +:20504000619009C97BB005295F9944D7C8CAD0EC8A9944D78DE7D720A4D5202BD48DE8D746 +:2050600020A5D4D064ADE9D7F004A915D02EA900AA8DECD7A001BD1DD7F01AD9C3D7D00400 +:20508000E8C8D0F2E8BD1DD7D0FAE8EEECD7ADECD7C907D0DFADECD70A6DECD7AAE8BD9624 +:2050A000D6BC97D68DEAD78CEBD7AD8FD648AD8ED6486CEAD72034D420A5D4ADC4D738E94B +:2050C000200DE9D7D0034C1BD020E1D3ACEDD7B944D7F00AC920F0062072D4C8D0F1A93F11 +:2050E00020F0D34C1BD020A5D420ABD5A920CDC4D7D00FCDCCD7D00AA93FA00B99C3D788B5 +:20510000D0FA205FD43058ADF6D78DF5D720E1D3206CD4A93A20F0D3ADEED70A0A0A0A0A79 +:205120002960A8C8A201B92801297F2072D4C8E8E00CF00CE009D0EEA92E2072D44C26D124 +:2051400020F8D3D0192097D42010D48DEED7300ECEF5D7F0B220EED320EED34C10D160A031 +:20516000344CC0D520A5D4D057209ED420ABD5205FD4304F20E0D5ACE7D7B944D7C920D08A +:205180003C20A5D4D037ADE9D7F012CDF2D7F00D38E901CDE8D7D025ADF2D7D020ADF2D7B2 +:2051A0008DE9D7A9008DD3D720ABD5205FD4100920E0D52097D44C27D4A03ED0082034D431 +:2051C0004CC9D0A0344CC0D5A900A0088DFCD78CFDD72005D6D07A8DF1D70DF1D7F0722033 +:2051E000A5D4D06D20E0D5209ED42005D6AEC4D7E020F00A8DFCD78CFDD7C002905320F3DC +:20520000D520ABD52014D42097D42023D43045204AD4304418ADFDD76DF1D78DF1D7ADFC7C +:20522000D7ACFDD78DF3D78CF4D720C4E22097D4201FD4D02718ADF3D7ACF4D7698090038C +:20524000C8F005CCF1D7D0DC2097D42008D43010604CC9D0A001D00AA055D006A062D0022B +:20526000A00A4CC0D520A5D4C90BD013A01820C0D520EAD34820E1D368295FC959D0D1201A +:20528000ABD54C14D420A5D4D0302047D4303220E1D32059D4F00410203022A200BD280105 +:2052A000C91AF0152072D420F8D3D008AEEFD7E810EB30DEA206200301604CC9D0A029D0CE +:2052C00002A0344CC0D520D5D520A5D4D0EC20E0D5209ED42005D6AEC4D7E020F00320D961 +:2052E000D520F3D52047D430D8ADF3D7ACF4D7202FD42059D4D00620B1E24CEFD230BE4C80 +:20530000A4D52005D6AEC4D7E020F0034C76D34C72D3ADC4D7C920D011ADE9D7F00938E91E +:20532000018DE8D72000D44CB8D0ADCCD7C920F0034CD9D3A202BDE4D79DCCD7CA10F720E7 +:2053400047D410034CD6D320D5D5202FD42059D4D01E20B1E2CD91D69007CC92D690EBB025 +:2053600007CC92D690E4F0E220A4D52059D4F06C306AA900A0088DCBD38CCCD32034D420E1 +:20538000A5D4ADE9D78DC3D7A21020A7D4ADE9D78DD3D7A0008CE3D7A220BDC3D79D07016B +:2053A000CA10F7E8B944D7F007C920F003C8D0F4A9008D2801B944D79D2901F007E8C8EE72 +:2053C0002801D0F120E1D320A4D5200008ADE8D72000D44C1BD02034D44CC9D0A04A4CC0B4 +:2053E000D5A90D20F0D3A90AD006A201D043A920A202D03DA20AD039A20BD035A20DD0316F +:20540000A20ED02DA20FD029A210D025A211D021A212D01D2097D4A213D016A214D012A2E9 +:2054200015D00EA216D00AA217D006A219D002A21A4C0301ADE9D7F01F38E901CDE8D7F0A5 +:2054400017ADE8D74C00D420ABD5A9008DE3D72097D42004D48DEED7602097D44C1BD420FE +:2054600097D4200CD48DEED76020E1D3202BD41869418EEFD78CF0D720BBE0B01048AD8AB9 +:20548000E420F0D368094020F0D3AD89E420F0D3ACF0D7AEEFD760AD94D6AC95D660ADE949 +:2054A000D78DF2D760A2008A48A9008DE9D7ACE7D72072D58CEDD7F00D290F48C8B944D7BB +:2054C000C93AF00A6888ADE8D79DC3D71008688DE9D79DC3D7C8A9088DECD7207FD5F01DEE +:2054E000E8C92AD007A93F9DC3D7D0049DC3D7C8CEECD7D0E6207FD5F011C8D0F8E8A9200B +:205500009DC3D7CEECD7D0F5B944D748A9038DECD768C92ED023C8207FD5F01DE8C92AD0A0 +:2055200007A93F9DC3D7D0049DC3D7C8CEECD7D0E6207FD5F00EC8D0F8E8A9209DC3D7CE73 +:20554000ECD7D0F5A9038DECD7E8A9009DC3D7CEECD7D0F58CE7D7A9008DECD768A8A20BA9 +:20556000C8B9C3D7C93FD003EEECD7CAD0F2ADECD760B944D7F007C920D003C8D0F460B9FC +:2055800044D7F01CC9209019F016C93DF012C92EF00EC93AF00AC93BF006C93CF002C93E5A +:2055A000604CC9D0A928A0014C2FD4A9008DC3D7ADE9D7F01F38E901CDE8D7F0174C00D4C4 +:2055C0008CF0D720E1D3ACF0D7B9AFD6F0062072D4C8D0F560A900A0088DF3D78CF4D7604B +:2055E000A20FBDC3D7BCD3D79DD3D7989DC3D7CA10F060A20FBDD3D79DC3D7CA10F7ADF23E +:20560000D78DE9D760A9098DF7D720A5D4ADE9D7D0678DF8D78DF9D7A8B9C4D7C924D00644 +:20562000A90F8DF7D7C8C8B9C3D7C920F04E209BE2900E20A5E2B041E906A20FECF7D7D050 +:2056400038290F48ADF8D78DFAD7ADF9D78DFBD7AEF7D718ADF8D76DFAD78DF8D7ADF9D7B5 +:205660006DFBD78DF9D7B011CAD0E9686DF8D78DF8D790B2EEF9D7D0AD4CC9D0ADCCD7C9CF +:2056800020D0F6ADF8D7ACF9D7604C42D74CB4D04C03D04CC3D74CE6D04CC8D14C65D24CDC +:2056A00085D24C64D14C02D34CC6D24C12D3FF004E4F2053504143450043414E204E4F54D1 +:2056C00020434C4F534500414C4C2046494C45532028592F4E293F0052454144204552521D +:2056E0004F52004E4F5420464F554E440046494C4520455849535453004C4F414420455285 +:20570000524F520043414E204E4F54204F50454E005752495445204552524F52004449524D +:205720002000534156452000455241200054595045200052454E2000474F20004C4F4144C5 +:2057400020007F0000000000000000000000000000000000000000000000000000000000AA +:20576000000000000000000000000000000000000000000000000000000000000000000029 +:20578000000000000000000000000000000000000000000000000000000000000000000009 +:2057A0000000000000000000000000000000000000000000000000000000000000000000E9 +:2057C0000000000000000000000000000000000000000000000000000000000000000000C9 +:2057E00000000000434F360000000000000000000000000008000009000000000008D88D63 +:2058000092E38DD6E38C93E38CD7E38E94E3E024B050BD4EE3F008A9FF8D91E320E9DAA961 +:20582000008D99E3AD94E30A6D94E3AAE8BD76D8BC77D88D9AE38C9BE3ADDEE248ADDDE270 +:2058400048AD92E3AC93E36C9AE38D95E38C96E3AD99E3F00DA0009102ADA3E38D92E3201B +:2058600004DB2C91E3100820E9DAA9008D91E3AC96E3AD95E3604CEAD84CDBDA4C13E14CBF +:2058800065E44C62E44C5FE44C85E04C1FD94C2AD94CCAE04C7FE14C95E04C7DE44C32DBF1 +:2058A0004C04DB4CAFDD4CEADD4C0EDE4C3AD94CA2D94C42D94CC7D94CB1DE4C80D94C3223 +:2058C000D94C2ED94CF9DA4C23D94C6DDD4C36D94CE2D84CE6D84CFAD84C0ED94C18D94C5A +:2058E00083E48D8FE360AD8FE3602C91E3100820E9DAA9008D91E34C53E42080E48DBFE3E8 +:205900008CC0E38EC1E38A2980A8ADBFE360ADC1E3297FA8ADC0E360AD6CDBAC6DDB60AD56 +:20592000060160ADCEE3ACCFE3608D060160ADA4E360ADA5E360ADA6E3602012DBA90D4C22 +:205940001BDE2012DB208FDDADAFE3CDB0E39013C980F003A90160A20120EDDEC900D0F412 +:205960008DAFE3207EDFADAAE30DABE3D003A902602060DE20ACDC2037E0209EDDA90060F7 +:205980002012DB2014E0A90C2013DE3014A900A0109102A90CA2102080DEA90C201BDE102D +:2059A000EC602012DB2014E0A90C2013DE3017A20020E4DFACA9E3AD4DE39104203DE0A958 +:2059C0000C201BDE10E9602012DB2014E0208FDDADAFE3C9809003A90160207EDFA9008DC4 +:2059E000D3E3ADAAE30DABE3F0034CAADAA9028DD3E3AD8BE348C910F01AA8882CBAE3101C +:205A00000188B1028DAAE3C8A9002CBAE31002B1028DABE3ADAAE38D9FE38DA1E3ADABE381 +:205A20008DA0E38DA2E3ADA1E3CDC5E3D008ACA2E3CCC6E3F012EEA1E3D003EEA2E3AD9F1A +:205A4000E30DA0E3F018D00BAD9FE30DA0E3D003A8F030AD9FE3D003CEA0E3CE9FE3AD9FA7 +:205A6000E3ACA0E32051DDD009AD9FE3ACA0E34C83DAADA1E3ACA2E32051DDD0A9ADA1E38C +:205A8000ACA2E38DAAE38CABE30DABE3D00468A90260ADAAE32065DD68A8ADAAE39102AD99 +:205AA000ABE3C82CBAE3100291022060DE20ACDC2043E0AEAFE3ECB0E39005E88EB0E3CAB2 +:205AC000E07FD011209EDDA20020EDDEC900D00AA9FF8DAFE3209EDDA900602085E020BBF0 +:205AE000E09005482013E16860A207B502BCD6E39DD6E39402CA10F360A502A403850484C4 +:205B0000054C74E4AD92E3CDA4E3F0EC8DA4E34C45DBA000B102F01938E90129078D92E35A +:205B2000ADA4E38DA3E3B1028D99E39891022004DB60A9028DA4E38DA5E3A928A00185020B +:205B4000840320F9DAADA4E3C908900F2066E0ADE0E2ACE1E220CAE04CEAD8206BE48D6CA3 +:205B6000DB8C6DDB0D6DDBF0E3A00DB9FFFF99C5E38810F7ADCBE3A81869038DBEE3B98527 +:205B8000E38DBDE3ADCCE38DBBE3ADCDE34A6EBBE34A6EBBE38DBCE3A9008DBAE3ADC6E310 +:205BA000F00588386EBAE3B982E38DD4E338A91FF982E38DD5E3AEA4E3BD7AE32DA5E3D04C +:205BC0000CBD7AE30DA5E38DA5E34CCEDB602028E0ADC5E38DC2E3ADC6E3A2034A6EC2E399 +:205BE000CAD0F98DC3E3EEC2E3D003EEC3E3ADCEE3ACCFE385068407A000A9009106E60647 +:205C0000D002E607ADC2E3D003CEC3E3CEC2E3ADC2E30DC3E3D0E3ADBBE38DC2E3ADBCE338 +:205C2000AEBEE34A6EC2E3CAD0F98DC3E3EEC2E3D003EEC3E38EAAE38EABE3ADAAE3ACAB30 +:205C4000E32065DDEEAAE3D003EEABE3ADC2E3D003CEC3E3CEC2E3ADC2E30DC3E3D0DC2058 +:205C60007EDC20D8DFA2012020DF3011ACA9E3B104C9E5F0F0A20120E4DF4C65DC6020687A +:205C8000E4ADC9E3ACCAE34C6EE4ADA8E38DABE3ADA7E34EABE36A4EABE36A8DB1E38DAA62 +:205CA000E3ADABE38DB2E3A9008DACE3A2008EC4E38E9CE38E9DE38E9EE3ADAAE3CD9CE358 +:205CC000ADABE3ED9DE3ADACE3ED9EE3902118AD9CE36DC7E38D9CE3AD9DE36DC8E38D9DEB +:205CE000E39003EE9EE3E8D0D1EEC4E34CBADCCAE0FFD003CEC4E38A186DC9E3AAADC4E315 +:205D00006DCAE3A88A206EE438AD9CE3EDC7E38D9CE3AD9DE3EDC8E38D9DE338ADAAE3ED8D +:205D20009CE3AAADABE3ED9DE3A88A2083E44C71E4488407A00346076A88D0FA186DCEE383 +:205D40008506A5076DCFE38507682907AABD72E3602031DD310660E001F00A2031DD49FF97 +:205D600031069106602031DD1106910660AEA4E3BD7AE30DA6E38DA6E360A900A07F18710D +:205D8000048810FA60AEA4E3BD7AE32DA6E360A020B1028DAFE3A00FB1028DB0E360AEAFD7 +:205DA000E3E88AA0209102ADB0E3A00F9102602012DB2011DE3032A90C0DA9E3A8B104AA86 +:205DC00098291FA88A9102980DA9E3A8C898291FD0EBA00CAD8CE3D102F00B9102A9809000 +:205DE000010AA00F9102ADB3E3602012DB2011DE301B2085DDD013A00CB10248980DA9E30F +:205E0000A868D1046E8AE3207CDEADB3E3602012DBA90D4820D8DF207EDC688DADE3A20022 +:205E20008EAEE32020DF3037AEADE3ACAEE3EEAEE3B102C00CD0138D8CE348980DA9E3A844 +:205E40006851042DD5E3F011D0D4C93FF00B48980DA9E3A868D104D0C5CAD0CFADB3E360F9 +:205E6000AEBEE30EAAE32EABE32EACE3CAD0F4ADBDE32DAFE30DAAE38DAAE360A920A200A6 +:205E80008DADE3CEADE3188A6DADE3A8C00CF004C00FD0052C8AE3100DB10248ADADE30DE1 +:205EA000A9E3A8689104CEADE310DB208ADC4C3DE02012DB2014E0A50248A50348ADE3E207 +:205EC000ACE4E285028403A9012013DE688503688502ADB3E33015A00DA9009102C8C0218E +:205EE000D0F9386E8AE3207CDEADB3E3608E98E320EDDD302AA00CB102186901291FF0172C +:205F000091022011DE100BAD98E3D01320B4DE4C15DF20B2DD1003A90160208FDDA9006066 +:205F20008A48EEA7E3D003EEA8E3ADCCE3CDA7E3ADCDE3EDA8E3B00568AA4CD8DFADA7E342 +:205F400029038DB3E30A0A0A0A0A8DA9E3F00568AA4C5CDF208ADC2037E068AAADB3E360A7 +:205F60002CD0E330FACAD009207ADD20C2DF910860207ADD20C2DFD108F0E44C6DDDAEBE5D +:205F8000E3ADAFE34ACAD0FC8DAAE338A908EDBEE3AAA00CB1022DD4E34A2ACAD0FC186DF2 +:205FA000AAE32CBAE310010A1869108D8BE3A8B1028DAAE3C8A9002CBAE31002B1028DAB38 +:205FC000E3604818ADB1E36DD1E38508ADB2E36DD2E38509A0006860A9FF8DA7E38DA8E3FE +:205FE0008DB3E36018ADA9E36910A88CB8E38A48B1048DB9E3C82078E00DB9E3F00A20785A +:00000001FF diff --git a/Source/Images/d_dos65/u0/dos65.s19 b/Source/Images/d_dos65/u0/dos65.s19 new file mode 100644 index 00000000..91129ae2 --- /dev/null +++ b/Source/Images/d_dos65/u0/dos65.s19 @@ -0,0 +1,275 @@ +S123CFF3000000000000000000000000004CA8E5D84820FCD3682000D4AD8CE44A4A4A4A91 +S123D0138DF6D7AD43D7D03CA2FF9AD8A91120F0D32069D4A93E20F0D3AD8BD6AC8CD620B9 +S123D033F4D3A000AE43D7F0DFB944D7C9619009C97BB005295F9944D7C8CAD0EC8A99445A +S123D053D78DE7D720A4D5202BD48DE8D720A5D4D064ADE9D7F004A915D02EA900AA8DECDD +S123D073D7A001BD1DD7F01AD9C3D7D004E8C8D0F2E8BD1DD7D0FAE8EEECD7ADECD7C90771 +S123D093D0DFADECD70A6DECD7AAE8BD96D6BC97D68DEAD78CEBD7AD8FD648AD8ED6486C81 +S123D0B3EAD72034D420A5D4ADC4D738E9200DE9D7D0034C1BD020E1D3ACEDD7B944D7F06F +S123D0D30AC920F0062072D4C8D0F1A93F20F0D34C1BD020A5D420ABD5A920CDC4D7D00F16 +S123D0F3CDCCD7D00AA93FA00B99C3D788D0FA205FD43058ADF6D78DF5D720E1D3206CD4D5 +S123D113A93A20F0D3ADEED70A0A0A0A0A2960A8C8A201B92801297F2072D4C8E8E00CF076 +S123D1330CE009D0EEA92E2072D44C26D120F8D3D0192097D42010D48DEED7300ECEF5D718 +S123D153F0B220EED320EED34C10D160A0344CC0D520A5D4D057209ED420ABD5205FD4309D +S123D1734F20E0D5ACE7D7B944D7C920D03C20A5D4D037ADE9D7F012CDF2D7F00D38E9017D +S123D193CDE8D7D025ADF2D7D020ADF2D78DE9D7A9008DD3D720ABD5205FD4100920E0D50D +S123D1B32097D44C27D4A03ED0082034D44CC9D0A0344CC0D5A900A0088DFCD78CFDD720DD +S123D1D305D6D07A8DF1D70DF1D7F07220A5D4D06D20E0D5209ED42005D6AEC4D7E020F016 +S110D1F30A8DFCD78CFDD7C002905320F3A9 +S123D200D520ABD52014D42097D42023D43045204AD4304418ADFDD76DF1D78DF1D7ADFCF8 +S123D220D7ACFDD78DF3D78CF4D720C4E22097D4201FD4D02718ADF3D7ACF4D76980900308 +S123D240C8F005CCF1D7D0DC2097D42008D43010604CC9D0A001D00AA055D006A062D002A7 +S123D260A00A4CC0D520A5D4C90BD013A01820C0D520EAD34820E1D368295FC959D0D12096 +S123D280ABD54C14D420A5D4D0302047D4303220E1D32059D4F00410203022A200BD280181 +S123D2A0C91AF0152072D420F8D3D008AEEFD7E810EB30DEA206200301604CC9D0A029D04A +S123D2C002A0344CC0D520D5D520A5D4D0EC20E0D5209ED42005D6AEC4D7E020F00320D9DD +S123D2E0D520F3D52047D430D8ADF3D7ACF4D7202FD42059D4D00620B1E24CEFD230BE4CFC +S123D300A4D52005D6AEC4D7E020F0034C76D34C72D3ADC4D7C920D011ADE9D7F00938E99A +S123D320018DE8D72000D44CB8D0ADCCD7C920F0034CD9D3A202BDE4D79DCCD7CA10F72063 +S123D34047D410034CD6D320D5D5202FD42059D4D01E20B1E2CD91D69007CC92D690EBB0A1 +S123D36007CC92D690E4F0E220A4D52059D4F06C306AA900A0088DCBD38CCCD32034D4205D +S123D380A5D4ADE9D78DC3D7A21020A7D4ADE9D78DD3D7A0008CE3D7A220BDC3D79D0701E7 +S123D3A0CA10F7E8B944D7F007C920F003C8D0F4A9008D2801B944D79D2901F007E8C8EEEE +S123D3C02801D0F120E1D320A4D5200008ADE8D72000D44C1BD02034D44CC9D0A04A4CC030 +S123D3E0D5A90D20F0D3A90AD006A201D043A920A202D03DA20AD039A20BD035A20DD031EB +S123D400A20ED02DA20FD029A210D025A211D021A212D01D2097D4A213D016A214D012A265 +S123D42015D00EA216D00AA217D006A219D002A21A4C0301ADE9D7F01F38E901CDE8D7F021 +S123D44017ADE8D74C00D420ABD5A9008DE3D72097D42004D48DEED7602097D44C1BD4207A +S123D46097D4200CD48DEED76020E1D3202BD41869418EEFD78CF0D720BBE0B01048AD8A35 +S123D480E420F0D368094020F0D3AD89E420F0D3ACF0D7AEEFD760AD94D6AC95D660ADE9C5 +S123D4A0D78DF2D760A2008A48A9008DE9D7ACE7D72072D58CEDD7F00D290F48C8B944D737 +S123D4C0C93AF00A6888ADE8D79DC3D71008688DE9D79DC3D7C8A9088DECD7207FD5F01D6A +S123D4E0E8C92AD007A93F9DC3D7D0049DC3D7C8CEECD7D0E6207FD5F011C8D0F8E8A92087 +S123D5009DC3D7CEECD7D0F5B944D748A9038DECD768C92ED023C8207FD5F01DE8C92AD01C +S123D52007A93F9DC3D7D0049DC3D7C8CEECD7D0E6207FD5F00EC8D0F8E8A9209DC3D7CEEF +S123D540ECD7D0F5A9038DECD7E8A9009DC3D7CEECD7D0F58CE7D7A9008DECD768A8A20B25 +S123D560C8B9C3D7C93FD003EEECD7CAD0F2ADECD760B944D7F007C920D003C8D0F460B978 +S123D58044D7F01CC9209019F016C93DF012C92EF00EC93AF00AC93BF006C93CF002C93ED6 +S123D5A0604CC9D0A928A0014C2FD4A9008DC3D7ADE9D7F01F38E901CDE8D7F0174C00D440 +S123D5C08CF0D720E1D3ACF0D7B9AFD6F0062072D4C8D0F560A900A0088DF3D78CF4D760C7 +S123D5E0A20FBDC3D7BCD3D79DD3D7989DC3D7CA10F060A20FBDD3D79DC3D7CA10F7ADF2BA +S123D600D78DE9D760A9098DF7D720A5D4ADE9D7D0678DF8D78DF9D7A8B9C4D7C924D006C0 +S123D620A90F8DF7D7C8C8B9C3D7C920F04E209BE2900E20A5E2B041E906A20FECF7D7D0CC +S123D64038290F48ADF8D78DFAD7ADF9D78DFBD7AEF7D718ADF8D76DFAD78DF8D7ADF9D731 +S123D6606DFBD78DF9D7B011CAD0E9686DF8D78DF8D790B2EEF9D7D0AD4CC9D0ADCCD7C94B +S123D68020D0F6ADF8D7ACF9D7604C42D74CB4D04C03D04CC3D74CE6D04CC8D14C65D24C58 +S123D6A085D24C64D14C02D34CC6D24C12D3FF004E4F2053504143450043414E204E4F544D +S123D6C020434C4F534500414C4C2046494C45532028592F4E293F00524541442045525299 +S123D6E04F52004E4F5420464F554E440046494C4520455849535453004C4F414420455201 +S123D700524F520043414E204E4F54204F50454E005752495445204552524F5200444952C9 +S123D7202000534156452000455241200054595045200052454E2000474F20004C4F414441 +S123D74020007F000000000000000000000000000000000000000000000000000000000026 +S123D7600000000000000000000000000000000000000000000000000000000000000000A5 +S123D780000000000000000000000000000000000000000000000000000000000000000085 +S123D7A0000000000000000000000000000000000000000000000000000000000000000065 +S123D7C0000000000000000000000000000000000000000000000000000000000000000045 +S123D7E000000000434F360000000000000000000000000008000009000000000008D88DDF +S123D80092E38DD6E38C93E38CD7E38E94E3E024B050BD4EE3F008A9FF8D91E320E9DAA9DD +S123D820008D99E3AD94E30A6D94E3AAE8BD76D8BC77D88D9AE38C9BE3ADDEE248ADDDE2EC +S123D84048AD92E3AC93E36C9AE38D95E38C96E3AD99E3F00DA0009102ADA3E38D92E32097 +S123D86004DB2C91E3100820E9DAA9008D91E3AC96E3AD95E3604CEAD84CDBDA4C13E14C3B +S123D88065E44C62E44C5FE44C85E04C1FD94C2AD94CCAE04C7FE14C95E04C7DE44C32DB6D +S123D8A04C04DB4CAFDD4CEADD4C0EDE4C3AD94CA2D94C42D94CC7D94CB1DE4C80D94C329F +S123D8C0D94C2ED94CF9DA4C23D94C6DDD4C36D94CE2D84CE6D84CFAD84C0ED94C18D94CD6 +S123D8E083E48D8FE360AD8FE3602C91E3100820E9DAA9008D91E34C53E42080E48DBFE364 +S123D9008CC0E38EC1E38A2980A8ADBFE360ADC1E3297FA8ADC0E360AD6CDBAC6DDB60ADD2 +S123D920060160ADCEE3ACCFE3608D060160ADA4E360ADA5E360ADA6E3602012DBA90D4C9E +S123D9401BDE2012DB208FDDADAFE3CDB0E39013C980F003A90160A20120EDDEC900D0F48E +S123D9608DAFE3207EDFADAAE30DABE3D003A902602060DE20ACDC2037E0209EDDA9006073 +S123D9802012DB2014E0A90C2013DE3014A900A0109102A90CA2102080DEA90C201BDE10A9 +S123D9A0EC602012DB2014E0A90C2013DE3017A20020E4DFACA9E3AD4DE39104203DE0A9D4 +S123D9C00C201BDE10E9602012DB2014E0208FDDADAFE3C9809003A90160207EDFA9008D40 +S123D9E0D3E3ADAAE30DABE3F0034CAADAA9028DD3E3AD8BE348C910F01AA8882CBAE31098 +S123DA000188B1028DAAE3C8A9002CBAE31002B1028DABE3ADAAE38D9FE38DA1E3ADABE3FD +S123DA208DA0E38DA2E3ADA1E3CDC5E3D008ACA2E3CCC6E3F012EEA1E3D003EEA2E3AD9F96 +S123DA40E30DA0E3F018D00BAD9FE30DA0E3D003A8F030AD9FE3D003CEA0E3CE9FE3AD9F23 +S123DA60E3ACA0E32051DDD009AD9FE3ACA0E34C83DAADA1E3ACA2E32051DDD0A9ADA1E308 +S123DA80ACA2E38DAAE38CABE30DABE3D00468A90260ADAAE32065DD68A8ADAAE39102AD15 +S123DAA0ABE3C82CBAE3100291022060DE20ACDC2043E0AEAFE3ECB0E39005E88EB0E3CA2E +S123DAC0E07FD011209EDDA20020EDDEC900D00AA9FF8DAFE3209EDDA900602085E020BB6C +S123DAE0E09005482013E16860A207B502BCD6E39DD6E39402CA10F360A502A40385048440 +S123DB00054C74E4AD92E3CDA4E3F0EC8DA4E34C45DBA000B102F01938E90129078D92E3D6 +S123DB20ADA4E38DA3E3B1028D99E39891022004DB60A9028DA4E38DA5E3A928A001850287 +S123DB40840320F9DAADA4E3C908900F2066E0ADE0E2ACE1E220CAE04CEAD8206BE48D6C1F +S123DB60DB8C6DDB0D6DDBF0E3A00DB9FFFF99C5E38810F7ADCBE3A81869038DBEE3B985A3 +S123DB80E38DBDE3ADCCE38DBBE3ADCDE34A6EBBE34A6EBBE38DBCE3A9008DBAE3ADC6E38C +S123DBA0F00588386EBAE3B982E38DD4E338A91FF982E38DD5E3AEA4E3BD7AE32DA5E3D0C8 +S123DBC00CBD7AE30DA5E38DA5E34CCEDB602028E0ADC5E38DC2E3ADC6E3A2034A6EC2E315 +S123DBE0CAD0F98DC3E3EEC2E3D003EEC3E3ADCEE3ACCFE385068407A000A9009106E606C3 +S123DC00D002E607ADC2E3D003CEC3E3CEC2E3ADC2E30DC3E3D0E3ADBBE38DC2E3ADBCE3B4 +S123DC20AEBEE34A6EC2E3CAD0F98DC3E3EEC2E3D003EEC3E38EAAE38EABE3ADAAE3ACABAC +S123DC40E32065DDEEAAE3D003EEABE3ADC2E3D003CEC3E3CEC2E3ADC2E30DC3E3D0DC20D4 +S123DC607EDC20D8DFA2012020DF3011ACA9E3B104C9E5F0F0A20120E4DF4C65DC602068F6 +S123DC80E4ADC9E3ACCAE34C6EE4ADA8E38DABE3ADA7E34EABE36A4EABE36A8DB1E38DAADE +S123DCA0E3ADABE38DB2E3A9008DACE3A2008EC4E38E9CE38E9DE38E9EE3ADAAE3CD9CE3D4 +S123DCC0ADABE3ED9DE3ADACE3ED9EE3902118AD9CE36DC7E38D9CE3AD9DE36DC8E38D9D67 +S123DCE0E39003EE9EE3E8D0D1EEC4E34CBADCCAE0FFD003CEC4E38A186DC9E3AAADC4E391 +S123DD006DCAE3A88A206EE438AD9CE3EDC7E38D9CE3AD9DE3EDC8E38D9DE338ADAAE3ED09 +S123DD209CE3AAADABE3ED9DE3A88A2083E44C71E4488407A00346076A88D0FA186DCEE3FF +S123DD408506A5076DCFE38507682907AABD72E3602031DD310660E001F00A2031DD49FF13 +S123DD6031069106602031DD1106910660AEA4E3BD7AE30DA6E38DA6E360A900A07F187189 +S123DD80048810FA60AEA4E3BD7AE32DA6E360A020B1028DAFE3A00FB1028DB0E360AEAF53 +S123DDA0E3E88AA0209102ADB0E3A00F9102602012DB2011DE3032A90C0DA9E3A8B104AA02 +S123DDC098291FA88A9102980DA9E3A8C898291FD0EBA00CAD8CE3D102F00B9102A980907C +S123DDE0010AA00F9102ADB3E3602012DB2011DE301B2085DDD013A00CB10248980DA9E38B +S123DE00A868D1046E8AE3207CDEADB3E3602012DBA90D4820D8DF207EDC688DADE3A2009E +S123DE208EAEE32020DF3037AEADE3ACAEE3EEAEE3B102C00CD0138D8CE348980DA9E3A8C0 +S123DE406851042DD5E3F011D0D4C93FF00B48980DA9E3A868D104D0C5CAD0CFADB3E36075 +S123DE60AEBEE30EAAE32EABE32EACE3CAD0F4ADBDE32DAFE30DAAE38DAAE360A920A20022 +S123DE808DADE3CEADE3188A6DADE3A8C00CF004C00FD0052C8AE3100DB10248ADADE30D5D +S123DEA0A9E3A8689104CEADE310DB208ADC4C3DE02012DB2014E0A50248A50348ADE3E283 +S123DEC0ACE4E285028403A9012013DE688503688502ADB3E33015A00DA9009102C8C0210A +S123DEE0D0F9386E8AE3207CDEADB3E3608E98E320EDDD302AA00CB102186901291FF017A8 +S123DF0091022011DE100BAD98E3D01320B4DE4C15DF20B2DD1003A90160208FDDA90060E2 +S123DF208A48EEA7E3D003EEA8E3ADCCE3CDA7E3ADCDE3EDA8E3B00568AA4CD8DFADA7E3BE +S123DF4029038DB3E30A0A0A0A0A8DA9E3F00568AA4C5CDF208ADC2037E068AAADB3E36023 +S123DF602CD0E330FACAD009207ADD20C2DF910860207ADD20C2DFD108F0E44C6DDDAEBED9 +S123DF80E3ADAFE34ACAD0FC8DAAE338A908EDBEE3AAA00CB1022DD4E34A2ACAD0FC186D6E +S123DFA0AAE32CBAE310010A1869108D8BE3A8B1028DAAE3C8A9002CBAE31002B1028DABB4 +S123DFC0E3604818ADB1E36DD1E38508ADB2E36DD2E38509A0006860A9FF8DA7E38DA8E37A +S123DFE08DB3E36018ADA9E36910A88CB8E38A48B1048DB9E3C82078E00DB9E3F00A2078D6 +S123E000E0A8ADB9E32057DD68AAACB8E3C898290FD0D8602085DDF01D2066E0ADE6E2ACC8 +S123E020E7E220CAE04CEAD8AEA4E3BD7AE349FF2DA6E38DA6E3602077E44C49E0A201A93C +S123E04001D003ADD3E3207AE4C900F0E92066E0ADE9E2ACEAE220CAE02085E0C90DF003F7 +S123E0604CEAD84C61E2ADECE2ACEDE220CAE0ADA4E31869414C13E1A9002CBAE31005B1D1 +S123E080048CB8E360AD8EE348A9008D8EE368D0032059E460AD8EE3D0202056E4C900F0CB +S123E0A0192059E4C913D00D2059E4C903D0034CEAD8A900608D8EE3A9FF60C90DF00AC97B +S123E0C00AF006C909F002C920608DD3E08CD4E0A000B9FFFFC924F00CC88CB4E32013E170 +S123E0E0ACB4E3D0ED602C8FE3100A2CB6E3300548205FE4686020BBE0B01848AD8AE42091 +S123E1002CE1A95E20E6E06809402024E1AD89E44C2CE1C909D00DA9202024E1AD90E329D2 +S123E12007D0F460482095E06820E6E0482CB6E33003205CE468EE90E3C920B026CD88E424 +S123E140F021CE90E3CD86E4D006CE90E3300F60C90DF00ACD8DE4F005CD8EE4D005A900BC +S123E1608D90E360A90D2024E1A90A20E6E0AD8DE3CD90E3F0EDAD88E4202CE14C6EE1A903 +S123E18000A00191028C97E3AD90E38D8DE32085E0AC97E3C90DD0034C5EE2C908D05EC085 +S123E1A001F0EBB10248A00138B102E901910268CE97E3C920B040C909D030386EB6E3AD34 +S123E1C090E38DB7E32064E1206BE2AD90E34838ADB7E3ED90E38DB7E30EB6E3208BE2CE5F +S123E1E0B7E3D0F8688D90E34C8EE1AD89E42087E2AD8AE42087E2208BE24C8EE1C910D05E +S123E2000BAD8FE349FF8D8FE34C8EE1C918D00C2064E1AD87E4202CE14C7FE1C912D00907 +S123E2202064E1206BE24C8EE1C89102488C97E3A0019818710291026820F6E0AC97E3B118 +S123E24002C903D00BA001B102C901D0034CEAD8A001B10288D102B0034C8EE1A90D4C24CF +S123E260E1A90D2024E1A90A4C24E1AD97E38DB5E3A9014868CEB5E3D00160A8C89848B19C +S123E2800220F6E04C74E2C9209019AD86E448202CE1A920202CE1684C2CE1C9309004C9B5 +S123E2A03A90013860209BE290FAC94190F5C94760ADF3D7ACF4D71869808DF3D79004C82F +S123E2C08CF4D760ADF3D7ACF4D78DD3E28CD4E2A200BDFFFF9D2801E810F7604C49D84CE6 +S123E2E03CE34C4DE34CF2E24CF9E24C2CE34CC5E3FF202D20522F4F24202D204241442035 +S123E300534543544F520D0A3C5245543E20544F2049474E4F5245202D2D203C4F54484500 +S123E320523E20544F2041424F5254240D0A50454D204552524F52204F4E2024202D204970 +S123E3404E56414C494420445249564524E500000000000000000000010000010101010152 +S123E360010101010101000001000000000000000000804020100804020101020408102054 +S123E3804080000103070F1F3F7F00000000000000000000000000000000000000000000C2 +S123E3A0000000000000000000000000000000000000000000000000000000000000000059 +S123E3C000000000000000000000000000000000000000000000000000000000000048DA17 +S123E3E05AAA4A4A4A4A1820F2E38A20F2E37AFA6860290F0930C93A30031869074CF7E6CD +S123E40048DA5AA90D20F7E6A90A20F7E67AFA68605ADA48A000A2FF38E8E964B0FB69643B +S123E420203AE4A2FF38E8E90AB0FB690A203AE4AAA001203AE468FA7A6048C000D0098A5A +S123E440A8C000D0034C4EE48A093020F7E668604CA8E54C49E64CE9E64CF0E64CF7E64C71 +S123E46000E74C01E74C02E74C72E64C51E64C76E64C7EE64CE4E64C85E64CB8E6A9016008 +S123E4804C03E74C04E708010C005E18500C1E020D0A6438383838622E20202E6438386275 +S123E4A02E20202E64383838382E20202020644420202020206F6F6F6F6F0D0A3838202090 +S123E4C0603844202E3850202059382E2038382020205950202020643820202020203850CA +S123E4E07E7E7E7E0D0A38382020203838203838202020203838206038626F2E2020202012 +S123E5006438202020202064500D0A38382020203838203838202020203838202020605917 +S123E52038622E206438383838622E205638383838622E0D0A00383820202E38442060380C +S123E5406220206438272064622020203844203838202060384420202020206038440D0A51 +S123E560593838383844202020605938385020202060383838385920206038383838502058 +S123E5802038386F6F62590D0A11444F532F3635204F4E20544845204E48594F44594E455A +S123E5A020332E30300D0A0078A2FF9AD8205DE8A990A0E42005E7A936A0E52005E7200016 +S123E5C0E4A200BD11F29D1405E8E010D0F5A9002051E6A9168532206A02A9048532206AAE +S123E5E002A9088532206A02A200BD24E99D0005E8E008D0F5A9128532206A02A90D853213 +S123E600206A02A9448530A9D78531A914852EA905852F2026E7205DE8A2008E9FE98EA048 +S123E620E9BD43E69D0001E8E006D0F5A928A00120E4E6AD1305A9022051E62072E6A90290 +S123E6404C03D04C53E44CFED778A2FF9AD84C16E629078D1305AD13050AAABD62E6BC63AE +S123E660E6602CE93AE948E956E964E972E980E98EE9A900A000188D0C058C0D05608D0E88 +S123E680058C0F05602019E729F0C900D00AA9148532206A024CE9E8C920D00BA91785323D +S123E6A0206A024CE9E860C930D00AA9058532206A024CE9E8A9FF602019E720FFE829F024 +S123E6C0C900D007A91585324C6A02C920D007A91885324C6A02C930D007A90685324C6A8D +S123E6E002A9FF6085F484F560A90385324C6A02A90285324C6A0248A9008532684C6A02BD +S123E700606060606085F084F1A000B1F0C900F00720F7E6C84C0BE760DAAD130529070AEE +S123E720AABD1405FA602000E448DA5AA200BD42E7E8C924F00620F7E64C2EE77AFA684CA2 +S123E74056E74469736B20436F6E66696775726174696F6E3A242000E4A20048DA5AA20053 +S123E760BD74E7E8C924F00620F7E64C60E77AFA684C79E720202020248A4A18694120F749 +S123E780E6A93A20F7E6A93D20F7E620A3E7A93A20F7E6E8BD14052011E4E82000E4E01093 +S123E7A0D0B960BD14054829F0C900D01F48DA5AA200BDC6E7E8C924F00620F7E64CB2E748 +S123E7C07AFA684CC9E74D44244C56E8C910D02048DA5AA200BDE9E7E8C924F00620F7E6E2 +S123E7E04CD5E77AFA684CEDE7554E4B244C56E8C920D01F48DA5AA200BD0DE8E8C924F008 +S123E8000620F7E64CF9E77AFA684C10E84644244C56E8C930D02248DA5AA200BD30E8E8A7 +S123E820C924F00620F7E64C1CE87AFA684C36E85050494445244C56E848DA5AA200BD5211 +S123E840E8E8C924F00620F7E64C3EE87AFA684C56E8554E4B2468290F2011E460A200BDA6 +S123E8606BE89D0002E8E000D0F5604884158A2980A884148A2920C900D03D8A2940C900FC +S123E880D00DA9808D7C036809808D7803800BA9008D780368297F8D7C03A200A000B1140A +S123E8A09D0004E8C8E080D0F5A9808D7C03EAEAA98C8D7803EAEA606809808D7803A200C9 +S123E8C0A000BD00049114E8C8E080D0F5A98C8D7803EAEA6048A98C8D7803EAEA68200007 +S123E8E08848A98E8D7803686048A90085EEA90485EFA5F485ECA5F585ED2015E968604874 +S123E900A90085ECA90485EDA5F485EEA5F585EF2015E968605AA000B1EE91ECC898C980FB +S123E920D0F67A60546E5C5E6E5479407F004000000001FF00A1E90091F1BF004000000072 +S123E940019B009FEA0091F1FF074000100002FF019DEB0091F1FF074000100002FF019BB7 +S123E960EC0091F1FF074000100002FF0199ED0091F1FF074000100002FF0197EE0091F166 +S123E980FF074000100002FF0195EF0091F1FF074000100002FF0193F00091F100000000B8 +S123E9A0000000000000000000000000000000000000000000000000000000000000000053 +S123E9C0000000000000000000000000000000000000000000000000000000000000000033 +S123E9E0000000000000000000000000000000000000000000000000000000000000000013 +S123EA000000000000000000000000000000000000000000000000000000000000000000F2 +S123EA200000000000000000000000000000000000000000000000000000000000000000D2 +S123EA400000000000000000000000000000000000000000000000000000000000000000B2 +S123EA60000000000000000000000000000000000000000000000000000000000000000092 +S123EA80000000000000000000000000000000000000000000000000000000000000000072 +S123EAA0000000000000000000000000000000000000000000000000000000000000000052 +S123EAC0000000000000000000000000000000000000000000000000000000000000000032 +S123EAE0000000000000000000000000000000000000000000000000000000000000000012 +S123EB000000000000000000000000000000000000000000000000000000000000000000F1 +S123EB200000000000000000000000000000000000000000000000000000000000000000D1 +S123EB400000000000000000000000000000000000000000000000000000000000000000B1 +S123EB60000000000000000000000000000000000000000000000000000000000000000091 +S123EB80000000000000000000000000000000000000000000000000000000000000000071 +S123EBA0000000000000000000000000000000000000000000000000000000000000000051 +S123EBC0000000000000000000000000000000000000000000000000000000000000000031 +S123EBE0000000000000000000000000000000000000000000000000000000000000000011 +S123EC000000000000000000000000000000000000000000000000000000000000000000F0 +S123EC200000000000000000000000000000000000000000000000000000000000000000D0 +S123EC400000000000000000000000000000000000000000000000000000000000000000B0 +S123EC60000000000000000000000000000000000000000000000000000000000000000090 +S123EC80000000000000000000000000000000000000000000000000000000000000000070 +S123ECA0000000000000000000000000000000000000000000000000000000000000000050 +S123ECC0000000000000000000000000000000000000000000000000000000000000000030 +S123ECE0000000000000000000000000000000000000000000000000000000000000000010 +S123ED000000000000000000000000000000000000000000000000000000000000000000EF +S123ED200000000000000000000000000000000000000000000000000000000000000000CF +S123ED400000000000000000000000000000000000000000000000000000000000000000AF +S123ED6000000000000000000000000000000000000000000000000000000000000000008F +S123ED8000000000000000000000000000000000000000000000000000000000000000006F +S123EDA000000000000000000000000000000000000000000000000000000000000000004F +S123EDC000000000000000000000000000000000000000000000000000000000000000002F +S123EDE000000000000000000000000000000000000000000000000000000000000000000F +S123EE000000000000000000000000000000000000000000000000000000000000000000EE +S123EE200000000000000000000000000000000000000000000000000000000000000000CE +S123EE400000000000000000000000000000000000000000000000000000000000000000AE +S123EE6000000000000000000000000000000000000000000000000000000000000000008E +S123EE8000000000000000000000000000000000000000000000000000000000000000006E +S123EEA000000000000000000000000000000000000000000000000000000000000000004E +S123EEC000000000000000000000000000000000000000000000000000000000000000002E +S123EEE000000000000000000000000000000000000000000000000000000000000000000E +S123EF000000000000000000000000000000000000000000000000000000000000000000ED +S123EF200000000000000000000000000000000000000000000000000000000000000000CD +S123EF400000000000000000000000000000000000000000000000000000000000000000AD +S123EF6000000000000000000000000000000000000000000000000000000000000000008D +S123EF8000000000000000000000000000000000000000000000000000000000000000006D +S123EFA000000000000000000000000000000000000000000000000000000000000000004D +S123EFC000000000000000000000000000000000000000000000000000000000000000002D +S123EFE000000000000000000000000000000000000000000000000000000000000000000D +S123F0000000000000000000000000000000000000000000000000000000000000000000EC +S123F0200000000000000000000000000000000000000000000000000000000000000000CC +S123F0400000000000000000000000000000000000000000000000000000000000000000AC +S123F06000000000000000000000000000000000000000000000000000000000000000008C +S123F08000000000000000000000000000000000000000000000000000000000000000006C +S123F0A000000000000000000000000000000000000000000000000000000000000000004C +S123F0C000000000000000000000000000000000000000000000000000000000000000002C +S123F0E000000000000000000000000000000000000000000000000000000000000000000C +S123F1000000000000000000000000000000000000000000000000000000000000000000EB +S123F1200000000000000000000000000000000000000000000000000000000000000000CB +S123F1400000000000000000000000000000000000000000000000000000000000000000AB +S123F16000000000000000000000000000000000000000000000000000000000000000008B +S123F18000000000000000000000000000000000000000000000000000000000000000006B +S123F1A000000000000000000000000000000000000000000000000000000000000000004B +S123F1C000000000000000000000000000000000000000000000000000000000000000002B +S123F1E000000000000000000000000000000000000000000000000000000000000000000B +S123F2000000000000000000000000000000000000000020002100300130023003300430AF +S104F22006E3 diff --git a/Source/Images/d_dos65/u0/dos65drv.sys b/Source/Images/d_dos65/u0/dos65drv.sys new file mode 100644 index 00000000..c9c1db43 Binary files /dev/null and b/Source/Images/d_dos65/u0/dos65drv.sys differ diff --git a/Source/Images/d_dos65/u0/edit.co6 b/Source/Images/d_dos65/u0/edit.co6 new file mode 100644 index 00000000..e685410c Binary files /dev/null and b/Source/Images/d_dos65/u0/edit.co6 differ diff --git a/Source/Images/d_dos65/u0/hi.com b/Source/Images/d_dos65/u0/hi.com new file mode 100644 index 00000000..0a5953af Binary files /dev/null and b/Source/Images/d_dos65/u0/hi.com differ diff --git a/Source/Images/d_dos65/u0/monitor.com b/Source/Images/d_dos65/u0/monitor.com new file mode 100644 index 00000000..450bd388 Binary files /dev/null and b/Source/Images/d_dos65/u0/monitor.com differ diff --git a/Source/Images/d_dos65/u0/run.co6 b/Source/Images/d_dos65/u0/run.co6 new file mode 100644 index 00000000..cd6edb24 Binary files /dev/null and b/Source/Images/d_dos65/u0/run.co6 differ diff --git a/Source/Images/d_dos65/u0/scream.com b/Source/Images/d_dos65/u0/scream.com new file mode 100644 index 00000000..03c5250f Binary files /dev/null and b/Source/Images/d_dos65/u0/scream.com differ diff --git a/Source/Images/d_dos65/u0/sedit.co6 b/Source/Images/d_dos65/u0/sedit.co6 new file mode 100644 index 00000000..9a786ecd Binary files /dev/null and b/Source/Images/d_dos65/u0/sedit.co6 differ diff --git a/Source/Images/d_nzcom.txt b/Source/Images/d_nzcom.txt deleted file mode 100644 index cb131317..00000000 --- a/Source/Images/d_nzcom.txt +++ /dev/null @@ -1,18 +0,0 @@ -# -# Add RomWBW utilities -# -../../Binary/Apps/*.com 0: -# -# Add Tune sample files -# -../../Binary/Apps/Tunes/*.pt? 3: -../../Binary/Apps/Tunes/*.mym 3: -# -# Add OS images -# -../CPM22/cpm_wbw.sys 0:cpm.sys -../ZSDOS/zsys_wbw.sys 0:zsys.sys -# -# Add Common Applications -# -Common/*.* 0: diff --git a/Source/Images/d_nzcom/ReadMe.txt b/Source/Images/d_nzcom/ReadMe.txt new file mode 100644 index 00000000..66bb4400 --- /dev/null +++ b/Source/Images/d_nzcom/ReadMe.txt @@ -0,0 +1,316 @@ +===== NZCOM Disk for RomWBW ===== + +This disk is one of several ready-to-run disks provided with +RomWBW. It contains NZ-COM, which is an implementation of the +Z-System. You may also see NZ-COM referred to as ZCPR 3.4. This is +a powerful replacement for CP/M 2.2 w/ full backward compatibility. + +The disk is bootable as is (the operating system image is already +embedded in the system tracks) and can be launched from the RomWBW +Loader prompt. See the Usage and Notes sections below for more +information on how NZ-COM is loaded. + +The remainder of this document describes the usage and contents of +this disk. It is highly recommended that you review the "RomWBW +User Guide.pdf" document found in the Doc directory of the +RomWBW Distribution. + +The primary documentation for NZ-COM is the "NZCOM Users Manual.pdf" +document contained in the Doc directory of the RomWBW distribution. +This document is a supplement to the primary documentation. Additionally, +please review the file called RELEASE.NOT on this disk which contains +a variety of updates regarding the NZ-COM distribuition. + +The starting point for the disk content was the final official release of +NZ-COM which is generally available on the Internet. A minimal +system generation was done just sufficient to get NZ-COM to run under +RomWBW. NZ-COM is extremely configurable and far more powerful than +DRI CP/M. It is almost mandatory that you read the NZ-COM manual to +use the system effectively. + +== Usage == + +NZCOM is not designed to load directly from the boot tracks of a +disk. Instead, it expects to be loaded from an already running +OS. This disk has been configured to boot using ZSDOS with a +PROFILE.SUB command file that automatically loads NZCOM. So, NZCOM +will load completely without any intervention, but you may notice +that ZSDOS loads first, then ZSDOS loads NZCOM. This is normal. + +There is no DIR command. Use SDZ or ZXD instead. + +*** TODO: Date stamping *** + +== Notes == + +NZCOM is distributed in an unconfigured state. The following was +done to create a minimal ready-to-run setup for RomWBW: + + - Ran MKZCM and saved default configuration to NZCOM.ZCM and + NZCOM.ENV. + - Extract VT100 TCAP from Z3TCAP.LBR and saved it as TCAP.Z3T. + - Created PROFILE.SUB to launch NZCOM at startup. + - Created empty STARTZCM.COM. + - TCSELECT.COM was removed because a later version is provided + from the Z3 files. + - Z3LOC.COM and LBREXT.COM were removed because more recent + versions are provided from Common files. + - Replaced ZRDOS with ZSDOS in NZCOM.LBR. The standalone + ZRDOS.ZRL and ZSDOS.ZRL files were saved. + +The following additional customizations were also performed: + + - The following files from the original distribution were removed + because newer versions are included: + + - COPY.COM + - CRUNCH.COM + - LBREXT.COM + - TCSELECT.COM + - UNCRUNCH.COM + - Z3LOC.COM + - ZCNFG.COM + +== NZCOM Files == + +The following files came from the official NZCOM distribution. These +are generally documented in the "NZCOM Users Manual.pdf" document in +the Doc directory of the RomWBW distribution. Note that some of the +files included in the NZ-COM distribution are not listed below because +they have been superseded by more recent versions listed in other +sections below. For example, TCSELECT is not listed here, but a more +recent version is included and documented in the General Purpose +Applications section below. + +!(C)1988 - Original copyright (since placed in public domain) +!NZ-COM - Software marker directory entry (empty file) +!VERS--1.2H - Version marker directory entry (empty file) +ALIAS.CMD - Sample alias definitions for use with ARUNZ +ARUNZ.COM - Alias-RUN-forZ-System command alias execution +BGZRDS19.LBR - ??? +CLEDINST.COM - Configure RCP-resident command line editor +CLEDSAVE.COM - Save RCP-resident command line editor history +CONFIG.LBR - Various configuration files for use with ZCNFG +CPSET.COM - Displays/defines CRT/PRT characteristics +DOCFILES.LBR - Documentation and help files collected into an LBR file +EDITNDR.COM - Edit named directory register in memory +FCP.LBR - Library of alternative FCP modules +FF.COM - File finder utility +HELP.COM - (HELPC14) is an improved version of the help utility +HLPFILES.LBR - Various app help files for use with LBRHELP +IF.COM - Extended flow control tester +JETLDR.COM - Z-System package loader +LBRHELP.COM - Help file viewer for use with help file libraries (.LBR) +LDIR.COM - Directory lister for libraries (.LBR) +LPUT.COM - Puts file(s) into a library (.LBR) +LSH-HELP.COM - Display LSH help when LSH is running +LSH.COM - Command history shell and command line editor +LSH.WZ - User manual for LSH +LSHINST.COM - LSH configuration editor +LX.COM - Execute programs directly from a library (.LBR) +MKZCM.COM - Create/update NZ-COM load environment +NAME.COM - Quickly add or remove a name for a single directory +NZ-DBASE.INF - dBase II application note regarding SUBMIT files +NZBLITZ.COM - Rapid coldboot of complete NZ-COM system image +NZBLTZ14.CFG - ZCNFG configuration file for NZBLITZ +NZBLTZ14.HZP - Help file for NZBLITZ +NZCOM.COM - Loads and launches NZ-COM system +NZCOM.ENV - Z-System environment descriptor +NZCOM.LBR - Library containing NZ-COM system modules +NZCOM.ZCM - NZ-COM environment descriptor (alternate format) +NZCPR.LBR - Library of alternative ZCPR modules +PATH.COM - Set/display command search path +PROFILE.SUB - Command file to auto-start NZ-COM at system boot +PUBLIC.COM - Specify ZRDOS public directories/user areas +PWD.COM - Displays DU and Directory Names with paging +RCP.LBR - Library of alternative RCP modules +RELEASE.NOT - Update information on NZ-COM +SAINST.COM - Install/configure SALIAS +SALIAS.COM - Screen oriented alias editor +SAVENDR.COM - Writes the named directory register to disk +SDZ.COM - Enhanced directory lister +SHOW.COM - Display Z-System configuration information +STARTZCM.COM - Commands to execute after NZ-COM is launched +SUB.COM - Enhanced version of SUBMIT +TCJ.INF - Description of included articles from The Computer Journal +TCJ*.WZ - Selected articles from The Computer Journal +TY3ERA.COM - Type 3 erase command +TY3REN.COM - Type 3 rename command +TY4ERA.COM - Type 4 erase command +TY4REN.COM - Type 4 rename command +TY4SAVE.COM - Type 4 save command +TY4SP.COM - Type 4 disk space command +VIEW.COM - Quad directional file viewer +XTCAP.COM - Interactive Extended TCAP Installer +Z3TCAP.TCP - Database of terminal descriptors +ZERR.COM - Z34 Error Handler +ZEX.COM - Powerful command line processor +ZF-DIM.COM - Point-and-shoot user interface for dim-video terminals +ZF-REV.COM - Point-and-shoot user interface for reverse-video terminals +ZFILEB38.LZT - Brief listing of Z-System support programs +ZFILER.CMD - Macro script file for ZFILER +ZHELPERS.LZT - List of volunteers who will help installing Z-System +ZLT.COM - File lister with support for compressed files +ZNODES66.LZT - List of Z-Node remote access systems +ZRDOS.ZRL - Relocatable version of ZRDOS BDOS module +ZSDOS.ZRL - Relocatable version of ZSDOS 1.1 BDOS module +ZSYSTEM.IZF - Information on Z-System and related products + +== CP/M 2.2 Files == + +The following files have been included from CP/M 2.2. These files +provide various functionality that is not really available from the +ZSDOS applications themselves. For example, the CP/M 2.2 application +called STAT is useful for modifying the IOBYTE. Most of these +applications are documented in the "CPM Manual.pdf" document in the Doc +directory of the RomWBW distribution. + +ASM.COM - DRI 8080 assembler producing Intel hex files +LIB.COM - DRI relocatable object file librarian +LINK.COM - DRI relocatable object file linker +LOAD.COM - DRI loader for Intel hex files +MAC.COM - DRI 8080 macro assembler producing Intel hex files +RMAC.COM - DRI 8080 macro assembler producing relocatable object files +STAT.COM - DRI multi-purpose file/disk/device info & configuration tool +SUBMIT.COM - DRI batch file submission tool +XSUB.COM - DRI batch file enhancer resident system extension + +== ZSDOS Files == + +The following files came from the official ZSDOS distribution. These +are generally documented in the "ZSDOS Manual.pdf" document in the Doc +directory of the RomWBW distribution. These files are relevant under +NZ-COM because ZSDOS is a part of the NZ-COM system. + +BGPATCH.HEX - Patches BackGrounder II for ZSDOS 1.1 compatibility +CLOCKS.DAT - Library of clock drivers +COPY.CFG - ZCNFG configuration file for COPY +COPY.COM - Enhanced file copy tool +COPY.UPD - Document describing updates to COPY program +DATSWEEP.COM - File management utility w/ date/time stamp awareness +DSCONFIG.COM - Program to configure DATSWEEP +FA16.CFG - ZCNFG configuration file for FILEATTR +FA16.DOC - Documentation for FILEATTR +FA16A.FOR - Summary of FILEATTR program version 16a +FA16CFG.TXT - Document describes FILEATTR configuration options +FILEATTR.COM - Set and/or display file attributes +FILEDATE.CFG - ZCNFG configuration fie for FILEDATE +FILEDATE.COM - Date/time stamping aware disk directory utility +INITDIR.CFG - ZCNFG configuration file for INITDIR +INITDIR.COM - Prepare disk for P2DOS date/time stamping +LDDS.COM - Load DateStamper date/time stamping resident extension +LDNZT.COM - Load NZT date/time stamping resident extension +LDP2D.COM - Load P2DOS date/time stamping resident extension +PUTBG.COM - Updated replacement for BackGrounder II PUTBG program +PUTDS.COM - Prepare disk for DateStamper date/time stamping +RELOG.COM - Clear fixed disk login vector in ZSDOS (see manual) +SETTERM.COM - Terminal configuration utility for DATSWEEP & DSCONFIG +SETUPZST.COM - Creates customized date/time stamping resident extensions +STAMPS.DAT - Library of available date/time stamping modules for SETUPZST +TD.CFG - ZCNFG configuration file for TD +TD.COM - Read and set system real-time clock +TERMBASE.DAT - Library of terminals used by SETTERM +TESTCLOK.COM - Test a selected clock driver +ZCAL.COM - Display a small one-month calendar to the screen +ZCNFG.COM - Configuration tool for programs with .CFG files +ZCNFG24.CFG - ZCNFG configuration file for ZCNFG +ZPATH.COM - Set or display ZSDOS and ZCPR search paths +ZSCONFIG.COM - Dynamically configure features of ZSDOS operating system +ZSVSTAMP.COM - Preserves file date/time stamp across modifications +ZSVSTAMP.DOC - Document describes the use and operation of ZSVSTAMP + +== RomWBW Supplemental Applications == + +The following files provide specific functionality enabled by +RomWBW enhancements. These applications are documented in the +"RomWBW Applications.pdf" document in the Doc directory of the +RomWBW Distribution. + +ASSIGN.COM - Assign,remove,swap drive letters of RomWBW disk slices +FAT.COM - MS-DOS FAT filesystem tool (list, copy, delete, format, etc.) +FDU.COM - Test floppy hardware and format floppy disks +FORMAT.COM - Placeholder application with formatting instructions +INTTEST.COM - Test RomWBW interrupt processing on your hardware +MODE.COM - Change serial line characteristics (baud rate, etc.) +RTC.COM - Test real time clock hardware on your system +SURVEY.COM - Display system resources summary +SYSCOPY.COM - Copy system tracks to disks (make bootable) +SYSGEN.COM - Copy system tracks to disks (DRI version) +TALK.COM - Route console I/O to & from specified serial port +TIMER.COM - Test and display system timer ticks +TUNE.COM - Play .PT2, .PT3, and .MYM audio files on supported hardware +XM.COM - XModem file transfer application +ZMP.COM - ZModem communications program (requires dedicated comm port) +ZMP.DOC - Documentation for ZMP +ZMP.HLP - Help file for ZMP +ZMXFER.OVR - Overlay file for ZMP +ZMTERM.OVR - Overlay file for ZMP +ZMINIT.OVR - Overlay file for ZMP +ZMCONFIG.OVR - Overlay file for ZMP + +== General Purpose Applications == + +The following files are commonly used CP/M applications that +are generally useful in any CP/M-like system. In general, there is +no documentation for these applications included with the RomWBW +distribution. Some provide command line help themselves. Some +are fairly obvious. + +CLRDIR.COM - Initializes the directory area of a disk +COMPARE.COM - Compare content of two files (binary) +CRUNCH.COM - Compress file(s) using Crunch algorithm +CRUNCH28.CFG - ZCNFG configuration file for CRUNCH & UNCR +DDTZ.COM - Z80 debug tool (modified to use RST 6) +DDTZ.DOC - Documentation for DDTZ +EX.COM - Batch file processor (alternative to DRI SUBMIT) +FDISK80.COM - Hard disk partitioning tool (from John Coffman) +FIND.COM - Search all drives for a file (from Jay Cotton) +FLASH.COM - Program FLASH chips in-situ (from Will Sowerbutts) +FLASH.DOC - Documentation for FLASH +MBASIC.COM - Microsoft BASIC language interpreter +NULU.COM - Library (.LBR) management tool +PMARC.COM - Create or add file(s) to .PMA archive +PMEXT.COM - Extract file(s) from .PMA/.LZH/.LHA archive +RMXSUB1.COM - Remove XSUB1 RSX from memory (from Lars Nelson) +SUPERSUB.COM - Enhanced replacement for DRI SUBMIT +SUPERSUB.DOC - Documentation for SUPERSUB +TDLBASIC.COM - TDL Zapple 12K BASIC language interpreter +UNARC.COM - Extract file(s) from .ARC or .ARK archive +UNARC.DOC - Documentation for UNARC +UNCR.COM - Decompress Crunched file(s) +UNZIP.COM - UNZIPZ extracts from all MS-DOS ZIP files (from Lars Nelson) +UNZIP.DOC - Documentation for UNZIPZ +XSUB1.COM - Replacement for DRI SUB (from Lars Nelson) +ZAP.COM - Interactive disk & file utility +ZDE.COM - Compact WordStar-like editor +ZDENST.COM - Installation/configuration tool for ZDE +KERCPM22.COM - Kermit file transfer application +LBREXT.COM - Extract file from .LBR libraries +LBREXT36.CFG - ZCNFG configuration file for LBREXT +ZXD.COM - Enhanced directory lister w/ date/time stamp support +ZXD.CFG - ZCNFG configuration file for ZXD + +== Testing Applications (User Area 2) == + +User area 2 contains a variety of hardware testing applications. +These are generally user contributed and have no documentation. +Additionally, they are frequently not compatible with all RomWBW +hardware. They are included here as a convenience. If applicable, +your hardware documentation should refer to them and provide usage +instructions. + +== Sample Tune Files (User Area 3) == + +User area 3 contains sample audio files that can be played using +the TUNE application. + +== CP/NET 1.2 (User Area 4) == + +User area 4 contains a full implementation of the CP/NET 1.2 +client provided by Doug Miller. Please read the README.TXT file +in this user area for more information. + +N.B., at a minimum, some of the files in this user area must be copied +to user area 0 for CP/NET to work properly. + +-- WBW 3:20 PM 8/27/2021 \ No newline at end of file diff --git a/Source/Images/d_nzcom/u0/COPY.COM b/Source/Images/d_nzcom/u0/COPY.COM deleted file mode 100644 index 734953d9..00000000 Binary files a/Source/Images/d_nzcom/u0/COPY.COM and /dev/null differ diff --git a/Source/Images/d_nzcom/u0/CRUNCH.COM b/Source/Images/d_nzcom/u0/CRUNCH.COM deleted file mode 100644 index ac17854a..00000000 Binary files a/Source/Images/d_nzcom/u0/CRUNCH.COM and /dev/null differ diff --git a/Source/Images/d_nzcom/u0/LBREXT.COM b/Source/Images/d_nzcom/u0/LBREXT.COM deleted file mode 100644 index 591922b7..00000000 Binary files a/Source/Images/d_nzcom/u0/LBREXT.COM and /dev/null differ diff --git a/Source/Images/d_nzcom/u0/NZCOM.ENV b/Source/Images/d_nzcom/u0/NZCOM.ENV new file mode 100644 index 00000000..06d95b25 Binary files /dev/null and b/Source/Images/d_nzcom/u0/NZCOM.ENV differ diff --git a/Source/Images/d_nzcom/u0/NZCOM.LBR b/Source/Images/d_nzcom/u0/NZCOM.LBR index bf432b41..ba93bc11 100644 Binary files a/Source/Images/d_nzcom/u0/NZCOM.LBR and b/Source/Images/d_nzcom/u0/NZCOM.LBR differ diff --git a/Source/Images/d_nzcom/u0/NZCOM.ZCM b/Source/Images/d_nzcom/u0/NZCOM.ZCM new file mode 100644 index 00000000..62f251b4 Binary files /dev/null and b/Source/Images/d_nzcom/u0/NZCOM.ZCM differ diff --git a/Source/Images/d_nzcom/u0/PROFILE.SUB b/Source/Images/d_nzcom/u0/PROFILE.SUB new file mode 100644 index 00000000..e7c32d08 --- /dev/null +++ b/Source/Images/d_nzcom/u0/PROFILE.SUB @@ -0,0 +1,2 @@ +NZCOM NZCOM.ZCM TCAP.Z3T + \ No newline at end of file diff --git a/Source/Images/d_nzcom/u0/STARTZCM.COM b/Source/Images/d_nzcom/u0/STARTZCM.COM new file mode 100644 index 00000000..2deda943 Binary files /dev/null and b/Source/Images/d_nzcom/u0/STARTZCM.COM differ diff --git a/Source/Images/d_nzcom/u0/SUBMIT.COM b/Source/Images/d_nzcom/u0/SUBMIT.COM deleted file mode 100644 index 2e788827..00000000 Binary files a/Source/Images/d_nzcom/u0/SUBMIT.COM and /dev/null differ diff --git a/Source/Images/d_nzcom/u0/TCSELECT.COM b/Source/Images/d_nzcom/u0/TCSELECT.COM deleted file mode 100644 index 4b29b83e..00000000 Binary files a/Source/Images/d_nzcom/u0/TCSELECT.COM and /dev/null differ diff --git a/Source/Images/d_nzcom/u0/UNCRUNCH.COM b/Source/Images/d_nzcom/u0/UNCRUNCH.COM deleted file mode 100644 index 5ffb68ef..00000000 Binary files a/Source/Images/d_nzcom/u0/UNCRUNCH.COM and /dev/null differ diff --git a/Source/Images/d_nzcom/u0/ZCNFG.COM b/Source/Images/d_nzcom/u0/ZCNFG.COM deleted file mode 100644 index b88a2d0c..00000000 Binary files a/Source/Images/d_nzcom/u0/ZCNFG.COM and /dev/null differ diff --git a/Source/Images/d_nzcom/u0/ZRDOS.ZRL b/Source/Images/d_nzcom/u0/ZRDOS.ZRL new file mode 100644 index 00000000..a0c4fc5a Binary files /dev/null and b/Source/Images/d_nzcom/u0/ZRDOS.ZRL differ diff --git a/Source/Images/d_qpm/ReadMe.txt b/Source/Images/d_qpm/ReadMe.txt new file mode 100644 index 00000000..08898aaf --- /dev/null +++ b/Source/Images/d_qpm/ReadMe.txt @@ -0,0 +1,195 @@ +===== QP/M Disk for RomWBW ===== + +This disk contains the distribution files for the QP/M Operating +System. The disk is bootable with QP/M already installed on the +system tracks. The qpm.sys file and the QP/M image on the system +tracks was created using QINSTALL with default settings EXCEPT +for the two settings described under Notes (current drive/user +storage address and TIMDAT vector). + +QINSTALL can be run again as desired to further customize your +installation. However, note that QINSTALL does NOT remember prior +settings, so you must reapply all settings you made previously +especially the two setting changes described below. + +This disk includes the standard DRI CP/M 2.2 files in addition to the +QP/M files. QP/M generally assumes you already had DRI CP/M 2.2 +prior to adding QP/M features. Since QP/M does not replace all +features of CP/M 2.2, the CP/M 2.2 files are also included. + +== Notes == + +By default, QP/M saves the current drive/user (2 byte value) at address 0x0008. +This is also the address of the Z80 RST 08 restart vector and conflicts with +RomWBW. When running QINSTALL, you must change the QP/M address for this value +to something else. I have been using 0x000E without issue. + +RomWBW CBIOS has been modified to put the QP/M TIMDAT vector at 0x0010. The +vector points into CBIOS where the actual TIMDAT routine is located. The +TIMDAT routine reads the current date/time from HBIOS, changes the values from +BCD to binary, and rearranges some bytes for QP/M compatibilty. When +running QINSTALL, you should set the TIMDAT vector to 0x0010 to +enabled QP/M to use your RomWBW real time clock. + +By default, DEBUGZ utilizes the RST 38 restart vector for setting +code brakpoints. This conflicts the use of that vector for any +system that is using interrupt mode 1. DEBUGZ can be configured +(using DBGINST) to use a different vector. + +The QSTAMP program, which is used to initialize a disk for date/time +stamping, misbehavews when run on the (new) RomWBW 1024 directory +format disks. It creates an invalid directory entry for the +date/time stamp data file. This is definitely a QP/M issue. The +directory entry can be manually corrected. + +== QPM 2.7 Files == + +The following files came from the official QP/M distribution. Actually, +they came from 3 Microcode Consulting files (qpm27.zip, debugz.zip, +and linkz.zip). The original distribution files can be found on the +Microcode Consulting website at https://www.microcodeconsulting.com/. +Documentation (pdf) files are incuded in these original distribution +.zip files. These documentation files have not been included in the +RomWBW distribution. Please retrieve them yourself from the website +if desired. + +D.COM - Directory lister +DBGINST.COM - Configures DEBUGZ debugger +DEBUGZ.COM - QP/M debugger +DEBUGZ.HLP - QP/M debugger help file +DHORIZ.COM - Version of directory lister for horizontal file sorting +HELLO.QPM - Text file with QP/M version information +LZ.COM - QP/M linker +QBACKUP.COM - Data backup application +QINSTALL.COM - QP/M installer / configurator +QPATCH.COM - Patches (customizes) a few QP/M applications +QPIP.COM - QP/M enhanced version of CP/M 2.2 PIP application +QPM.SYS - RomWBW configured QP/M system image (for use with SYSCOPY) +QPMCLK.MAC - Example of QP/M clock assembler routine +QPMCMDS.TXT - Brief summary of QP/M commands +QPMUTILS.TXT - Brief summary of QP/M utilities +QSTAMP.COM - Initializes disk for date/time stamping +QSTAMPV.COM - Initializes disk for date/time stamping (vertical sort) +QSTAMPX.COM - Initializes disk for date/time stamping (horizontal sort) +QSTAT.COM - QP/M enhanced version of CP/M 2.2 STAT application +QSUB.COM - QP/M batch file submission program +QSWEEP.COM - QP/M directory sweep utility +QTERM.DAT - Terminal control codes used by DEBUGZ +QTERMS.LIB - Library of available terminal definitions +SETQTERM.COM - Configures QTERM.DAT +TDCNFG.COM - Configures date/time directory display preferences + +== CP/M 2.2 Files == + +The following files have been included from CP/M 2.2. These files +provide various functionality that is not really available from the +ZSDOS applications themselves. For example, the CP/M 2.2 application +called STAT is useful for modifying the IOBYTE. Most of these +applications are documented in the "CPM Manual.pdf" document in the Doc +directory of the RomWBW distribution. + +ASM.COM - DRI 8080 assembler producing Intel hex files +LIB.COM - DRI relocatable object file librarian +LINK.COM - DRI relocatable object file linker +LOAD.COM - DRI loader for Intel hex files +MAC.COM - DRI 8080 macro assembler producing Intel hex files +RMAC.COM - DRI 8080 macro assembler producing relocatable object files +STAT.COM - DRI multi-purpose file/disk/device info & configuration tool +SUBMIT.COM - DRI batch file submission tool +XSUB.COM - DRI batch file enhancer resident system extension + +== RomWBW Supplemental Applications == + +The following files provide specific functionality enabled by +RomWBW enhancements. These applications are documented in the +"RomWBW Applications.pdf" document in the Doc directory of the +RomWBW Distribution. + +ASSIGN.COM - Assign,remove,swap drive letters of RomWBW disk slices +FAT.COM - MS-DOS FAT filesystem tool (list, copy, delete, format, etc.) +FDU.COM - Test floppy hardware and format floppy disks +FORMAT.COM - Placeholder application with formatting instructions +INTTEST.COM - Test RomWBW interrupt processing on your hardware +MODE.COM - Change serial line characteristics (baud rate, etc.) +RTC.COM - Test real time clock hardware on your system +SURVEY.COM - Display system resources summary +SYSCOPY.COM - Copy system tracks to disks (make bootable) +SYSGEN.COM - Copy system tracks to disks (DRI version) +TALK.COM - Route console I/O to & from specified serial port +TIMER.COM - Test and display system timer ticks +TUNE.COM - Play .PT2, .PT3, and .MYM audio files on supported hardware +XM.COM - XModem file transfer application +ZMP.COM - ZModem communications program (requires dedicated comm port) +ZMP.DOC - Documentation for ZMP +ZMP.HLP - Help file for ZMP +ZMXFER.OVR - Overlay file for ZMP +ZMTERM.OVR - Overlay file for ZMP +ZMINIT.OVR - Overlay file for ZMP +ZMCONFIG.OVR - Overlay file for ZMP + +== General Purpose Applications == + +The following files are commonly used CP/M applications that +are generally useful in any CP/M-like system. In general, there is +no documentation for these applications included with the RomWBW +distribution. Some provide command line help themselves. Some +are fairly obvious. + +CLRDIR.COM - Initializes the directory area of a disk +COMPARE.COM - Compare content of two files (binary) +CRUNCH.COM - Compress file(s) using Crunch algorithm +CRUNCH28.CFG - ZCNFG configuration file for CRUNCH & UNCR +DDTZ.COM - Z80 debug tool (modified to use RST 6) +DDTZ.DOC - Documentation for DDTZ +EX.COM - Batch file processor (alternative to DRI SUBMIT) +FDISK80.COM - Hard disk partitioning tool (from John Coffman) +FIND.COM - Search all drives for a file (from Jay Cotton) +FLASH.COM - Program FLASH chips in-situ (from Will Sowerbutts) +FLASH.DOC - Documentation for FLASH +MBASIC.COM - Microsoft BASIC language interpreter +NULU.COM - Library (.LBR) management tool +PMARC.COM - Create or add file(s) to .PMA archive +PMEXT.COM - Extract file(s) from .PMA/.LZH/.LHA archive +RMXSUB1.COM - Remove XSUB1 RSX from memory (from Lars Nelson) +SUPERSUB.COM - Enhanced replacement for DRI SUBMIT +SUPERSUB.DOC - Documentation for SUPERSUB +TDLBASIC.COM - TDL Zapple 12K BASIC language interpreter +UNARC.COM - Extract file(s) from .ARC or .ARK archive +UNARC.DOC - Documentation for UNARC +UNCR.COM - Decompress Crunched file(s) +UNZIP.COM - UNZIPZ extracts from all MS-DOS ZIP files (from Lars Nelson) +UNZIP.DOC - Documentation for UNZIPZ +XSUB1.COM - Replacement for DRI SUB (from Lars Nelson) +ZAP.COM - Interactive disk & file utility +ZDE.COM - Compact WordStar-like editor +ZDENST.COM - Installation/configuration tool for ZDE +KERCPM22.COM - Kermit file transfer application +LBREXT.COM - Extract file from .LBR libraries +LBREXT36.CFG - ZCNFG configuration file for LBREXT +ZXD.COM - Enhanced directory lister w/ date/time stamp support +ZXD.CFG - ZCNFG configuration file for ZXD + +== Testing Applications (User Area 2) == + +User area 2 contains a variety of hardware testing applications. +These are generally user contributed and have no documentation. +Additionally, they are frequently not compatible with all RomWBW +hardware. They are included here as a convenience. If applicable, +your hardware documentation should refer to them and provide usage +instructions. + +== Sample Tune Files (User Area 3) == + +User area 3 contains sample audio files that can be played using +the TUNE application. + +== CP/NET 1.2 (User Area 4) == + +User area 4 contains a full implementation of the CP/NET 1.2 +client provided by Doug Miller. Please read the README.TXT file +in this user area for more information. + +N.B., at a minimum, some of the files in this user area must be copied +to user area 0 for CP/NET to work properly. + +--WBW 4:41 PM 6/10/2022 diff --git a/Source/Images/d_qpm/u0/d.com b/Source/Images/d_qpm/u0/d.com new file mode 100644 index 00000000..4ce4c987 Binary files /dev/null and b/Source/Images/d_qpm/u0/d.com differ diff --git a/Source/Images/d_qpm/u0/dbginst.com b/Source/Images/d_qpm/u0/dbginst.com new file mode 100644 index 00000000..b88c7c28 Binary files /dev/null and b/Source/Images/d_qpm/u0/dbginst.com differ diff --git a/Source/Images/d_qpm/u0/debugz.com b/Source/Images/d_qpm/u0/debugz.com new file mode 100644 index 00000000..09e36230 Binary files /dev/null and b/Source/Images/d_qpm/u0/debugz.com differ diff --git a/Source/Images/d_qpm/u0/debugz.hlp b/Source/Images/d_qpm/u0/debugz.hlp new file mode 100644 index 00000000..77715650 --- /dev/null +++ b/Source/Images/d_qpm/u0/debugz.hlp @@ -0,0 +1 @@ + Summary of Primary Commands A Assemble M Move memory C Call routine N Next addresses  D Display memory P Pass points  E Extended commands Q Query port  F Fill memory R Read file(s)  G Go S Set memory  H Hex arithmetic T Trace execution  I Input line U Untrace execution J Full-screen trace V Verify memory  K memory view blocK X eXamine registers L List code Y Search  Press SPACE bar for more general help, command letter for help on specific command, or ESCape key to exit help. Running DebugZDebugZ can be executed with or without command line parameters.All values in "[]" are optional, with an asterick "*" being theplace holder when only symbols are loaded (no program). DEBUGZ [program [symbol]] [=addr]"program" is an optional program file (usually filename.COM);"symbol" is an optional symbol file (usually filename.SYM)."addr" is an optional base address to load DebugZ. It must bepreceded by an equal sign ("="); default is to put DebugZ at thehighest location possible (just below DOS). Press SPACE bar for more general help, command letter for help on specific command, or ESCape key to return to main help menu. Summary of NumbersLiteral Numbers: Default are hexadecimal values; any numbers from 0-9 and letters A-F are accepted. (Ex: 0F0D 7A)Hexadecimal Numbers: Same as literal numbers; also, any number preceded by "\" and "H" ("\H") (Ex: \HE77)Decimal Numbers: Decimal numbers are preceded by either a "#" sign or "\" and "D" ("\D"); digits from 0-9 are accepted. (Ex: #9178 #31419 \D3712)Binary Numbers: Binary numbers are preceded by a "\" and "B" ("\B"); digits from 0-1 are accepted. (Ex: \B11100110) Press SPACE bar for more general help, command letter for help on specific command, or ESCape key to return to main help menu. Other ValuesCharacters: Any set of ASCII characters is accepted within paired quotes, either ' or " (must be matching pair). The rightmost char becomes the least significant; a one character string has a zero high-order byte. Case is not translated within quotes. (Ex: "cd" 'y' 'T"' "'7'")Stack values: Stack values are obtained with the dollar sign ("$") symbol. A sequence of n "$" obtains the n-th stacked value in the current program. (Ex: $ = top of stack $$$ = 3rd value on stack) Press SPACE bar for more general help, command letter for help on specific command, or ESCape key to return to main help menu. Symbol ReferencesA symbol is a sequence of ASCII characters ("sym") as read inby DebugZ. Symbols are located in a .SYM symbol file.Valid symbol references are: .sym 16-bit value of "sym" (Ex: .MYSYM) @sym 16-bit value POINTED TO by "sym" (Ex: @MYSYM) =sym 8-bit value POINTED TO by "sym" (Ex: =MYSYM) Press SPACE bar for more general help, command letter for help on specific command, or ESCape key to return to main help menu. ExpressionsAn expression is any collection of numbers, characters, valuesor symbol references separated by binary operators or the threeunary operators. Note that overflow is NOT detected.Examples: .MYSYM+#145*3 @(.MYSYM+14)/#71-^B0110 !+#4124Note that indirect references ("@" and "=") are valid using anyexpression in parenthesis. The last example surfaces a thirdreference, "!", which uses the result from the *last* expression.Also, a leading "+" is implicitly preceded by a "!". Press SPACE bar for more general help, command letter for help on specific command, or ESCape key to return to main help menu. OperatorsDebugZ supports a wide range of unary and binary operators.The list of operators by precedence order and name are:Group A: ~ (bitwise not) () (pair of parenthesis)Group B: @ (16-bit value) = (8-bit value)Group C: * (multiply) / (divide) % (modulo)Group D: + (addition) - (subtract)Group E: & (bit AND) | (bit OR) ^ (bit XOR)Group A and B are unary operators. "@" and "=" must befollowed by either a symbol name or expression inside parenthesis. Groups C, D and E are binary operators. Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific command, or AssembleAllows one to enter Z-80 assembly code; the assembly locationis shown on the left before each instruction. As Assemble at location "s" A Assemble starting at last assembly, listed, or traced address. (Ex: A100)Enter lines of code followed by RETURN. Entering a blankline or "." terminates assembly. Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific command, or CallCall the subroutine without altering the CPU state of theprogram under test. Cs Call subroutine at location "s". Cs,b Call subroutine at location "s" with register BC set to value "b". Cs,b,d Same as above, except also set register pair DE to value "d".(Ex: C.SUB1 CEA03,#500,\B1010111010001101) Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific co Display memory Db Display 12 lines starting at address "b". Db,e Display starting at "b", ending at "e". Pauses for for page breaks every 16 lines. D Display starting at address after last display. D,e Same, except ending at address "e". DWb Display words starting at address "b". DWb,e Display words starting at "b" and ending at "e". DW Display wors starting at address after last display. DW,e Same, except ending at address "e". -D... Disables pauses at end of each page (pagination)(Ex: D100,!+20 DW#4096) Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter fo Extended CommandsExtended commands direct the operation of DebugZ: ERINTEL Display (Intel) 8080 registers only ER8080 Display (Intel) 8080 registers only ERZ80 Display Z80 registers EPRE Pre-execution view of registers EPOST Post-execution view of registers ETRACE Trace all code (including DOS) -ETRACE Do not code that is < 0100H (no DOS trace) E Show current DebugZ status(NOTE: Only the first two characters of each E command is examined.) Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific command, or Fill memoryFill memory with specific 8-bit data: Fb,e,d Fill memory from location "b" through location "e" with data "d".(Ex: F155,.FOO+#50,'x') Press command letter for help on specific command, or ESCape key to return to main help menu. Press comm GoGO executes a program with up to two breakpoints: G Execute from the current PC G,b Same as above with breakpoint at "b" G,b,c Same as above with additional breakpoint at "c" Ga Execute at address "a" Ga,b Same as above with breakpoint at "b" Ga,b,c Same as above with additional breakpoint at "c" -G... Disable the normal display of pass points G,$ Break at value on bottom of stack (return address)(Ex: G100 G.START,3417,.ERR -G.ENTER,.EXIT+20) Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on speci Hex ValuesThe Hex command allows arithmetic operations in differentbases as well as listing of the symbol table: Ha,b Displays sum (a+b) and difference (a-b) in hexadecimal Ha Displays result in up to four forms: hex #decimal 'char' .sym "char" is only displayed if it exists "sym" is the symbolic value, if any H Displays a list of all symbols; paginated -H Same, except no pauses at page break(NOTE: "a" and "b" are any complex expressions.) Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter Input LineInitializes default buffer at 0080H, default FCB at 005CH, anddefault secondary FCB at 006CH to the string entered: Istring(Ex: I FOO.COM FOO.SYM ITEST.COM I* TEST.SYM)The primary filename is used by Read as the program to debug;the secondary filename is used by Read as the symbol table. Press command letter for help on specific command, or ESCape key to return to main help menu. Press Full Screen TraceFull trace mode is a powerful method to step through a program.There are four parts to the screen: memory display (4 lines),register display (2 lines), instruction display (16 lines), andcommand line area (2 lines). The memory area may be empty if thememory block (K) is not enabled. Other symbols include: > Instruction at which registers are displayed. = Current program counter ?: Full screen command promptDebugZ retains up to 12 instructions of registers with a 4instruction look-ahead; the memory window is updated automatically. Press SPACE bar for more Full Screen Trace help, command letter for help on specific command, or ESCape key to return to main help menu. Full Screen Trace (cont.)Non-execution control commands include: < or , Move register pointer backwards > or . Move register pointer forwards = Set program counter K Set memory block view address (enable display) + Scroll memory view window forward by 32 bytes - Scroll memory view window backwards by 32 bytes H Expression evaluation (display at bottom) ? Help Q or X Quit full-screen trace mode (return to '#' prompt) Press SPACE bar for more Full Screen Trace help, command letter for help on specific command, or ESCape key to return to main help menu. Full Screen Trace (cont.)Program execution instructions are: space Execute one instruction; no trace of CALLs return Execute one instruction; follow CALLs 1 to 5 Execute at 1 to 5 instructions/second; no trace of CALLs; any key halts 6 to 0 Execute at 1 (6) to 5 (0) instructions/second; follow CALLs; any key halts Ga Continue execution until address "a"; no display of intermediate registers/instructions. Ga,b Same, with an additional breakpoint at "b". Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on spec Memory View BlocKSets initial bounds of memory block to view, if any, duringfull-screen trace (J) of a program. Ka Sets the memory block to view from address "a" for up to 64 locations. KWa Same, except view words rather than bytes. -K Disables memory block view.Only the starting address is entered. DebugZ will round tonearest 16-byte boundary and display 64 bytes of memory. Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for List CodeList assembly code including labels and symbols: Lb List disassembled code starting at "b" for 12 lines. Lb,e List disassembled code starting at "b" and ending at "e"; pauses for page breaks. L List disassembled code starting after last disassembled or traced address. L,e Same, except ending at "e". -L... Same as above commands, except that pagination is disabled. Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific command, or ESCape key t Move MemoryMove block of memory to another location: Ms,e,d Move data from locations "s" through "e" to location "d" (through "d+e-s").A head-to-tail or tail-to-head move is performed as necessaryto avoid memory overlap collision. Note that the source memorylocations from "s" through "e" are not altered PROVIDED thedestination block does not overwrite the source block duringthe copy operation. Press command letter for help on specific command, or ESCape key to return to main help menu. Press command Next AddressesDebugZ displays the memory usage when the command Nis entered. Address ranges utilized are displayed for: Prog Range occupied by program under test, if loaded Free Free memory range Symbols Symbol storage, if any DebugZ DebugZ debugger program Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific command, or ESCape key to return t Pass PointsA "pass point" is a program address to monitor during execution.Each pass point has a counter with a value from 1 to 255indicating the number of times this address has been reached.When the counter reaches 1, it stays there; any counters with avalue of 1 are treated as "breakpoints". Program executionstops at any breakpoint. Up to 8 passpoints are allowed. Pp Enter passpoint address "p"; pass count defaults to 1. Pp,c Same, except sets pass count to "c". Press SPACE bar for more Pass Point help, or command letter for help on specific command, or ESCape key to return to main help menu. Pass Points (cont.)When hitting an active pass point during execution, the registersare displayed and the pass count, address, and symbol value (ifany) are shown: count PASS address .sym 8080 registers; instruction Z80 registers (if enabled)Display of pass points can be disabled during trace (T), untrace(U), and execution (G). Again, execution stops when the pass pointis or becomes a value of one. Press SPACE bar for more Pass Point help, or command letter for help on specific command, or ESCape key to return to main help menu. Pass Points (cont.)The current list of pass points can be displayed by entering: PA list of the pass points is given in the follwing form: pass-value pass-address (symbol location, if any)Pass points can be deleted by entering: -Pa where "a" is the pass address to remove -P which deletes ALL pass points Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific c Query PortThe Query command allows one to read and/or modify the value at agiven port. A full 16-bit port value is accepted and used forboth input and output. The format is: QIp Display the value input from port "p". QI Display the value input from port; the last port number "p" referenced is automatically used. QOp,v Output 8-bit value "v" to port "p". Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific com Read File(s)The Read command loads a file into memory for debugging and/orreads a symbol table into DebugZ. The files are specifiedusing the Input command. The format for the Read command is: R Read executable file (if specified by Input) into memory starting at 0100H. Read symbol file, if specified. Ra Same, except Read executable file into memory at location "a" PLUS 0100H. For example, "R200" reads the file in at location 0300H. The offset is ignored when reading the symbol file, if any. Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific command, or ESCape key to return to main hel Set MemorySet memory alters the memory contents. Commands are: Sa Substitute bytes starting from location "a". SWa Substitute words starting from location "a".In both cases, DebugZ prompts with the address and either 8-bitor 16-bit value at that location. One can either enter a new8-bit (16-bit) value, press RETURN on a blank line to skip to thenext location, or enter "." following by RETURN to quit.Set can also be used to assign ASCII strings by beginning the linewith double-quotes ("). DebugZ strips the leading quote beforesetting memory to the string. Press command letter for help on specific command, or ESCape key to return to main help menu. Trace ExecutionTrace execution starting from current PC for the specified numberof instructions. The flags and registers are displayed after eachinstruction. Subroutines (CALLs) are optionally traced. T Trace execution for one instruction including CALL statements. Tn Same, except trace for "n" instructions. TW Trace one instruction, do NOT trace CALLs. TWn Same, except trace for "n" instructions.Note that tracing to addresses < 0100H may be disabled if the-ETRACE command has been specified (or is the default). Press command letter for help on specific command, or ESCape key to return to main help menu. Untrace ExecutionTrace execution starting from current PC for the specified numberof instructions. The flags and registers are NOT displayedafter each instruction. Subroutines (CALLs) are optionally traced. U Trace execution for one instruction including CALL statements. Display Pass points. Un Same, but trace for "n" instructions. UW Trace one instruction, do NOT trace CALLs. UWn Same, but trace for "n" instructions. -U.. Same, except do NOT display pass points.Note that tracing to addresses < 0100H may be disabled if the-ETRACE command has been specified (or is the default). Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific command, Verify MemoryVerify (compare) block of memory at one location to another: Vs,e,d Verify data at locations "s" through "e" against location "d" (through "d+e-s"); paginates output. -Vs,e,d Same except no pagination.Any differences between the blocks are printed as: src-addr src-value dst-addr dst-value Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific command, or eXamine Register ContentsThe eXamine command can list the contents of all registers (andthe current instruction) or alter any of them. Valid commands are: X Displays the current register contents, flags, and instruction. Xr Change register contents where "r" can be: "A", "B" for BC, "D" for DE, "H" for HL, "P" for PC, "S" for SP, "X" for IX, and "Y" for IY. Xr' Adding the "'" instructs DebugZ to alter the "backside" Z80 registers. Valid "r" include "A", "B", "D", and "H". Press SPACE bar for more help on eXamine Register Contents, command letter for help on specific command, or ESCape key to return to main help menu. eXamine Register Contents (cont.)Changing the register value involves entering the new 16-bitvalue (8-bit for A register). An empty line leaves the valueunaltered. Altering the flags is done by entering: Xf Change flags: (C)arry, (Z)ero, (M)inus, (E)ven parity, (S)ubtract, and BCD hal(F) carry. Xf' Same, except alter the "backside" Z80 flags.Entering a value of "1" sets the flag, "0" resets it.Note that although any register or flag can be changed, display of the "backside" Z80 registers may optionally be suppressed (E). Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific command, or Search MemorySearch allows searching for any sequence of bytes or characters,including wild cards; up to 63-byte match strings may be searched. YBs,f Sets bound of search between address "s" and address "f", inclusive. Yq Search for sequence "q" starting from address "s". YWq Same, except search using 16-bit word values. Y Continue search for last sequence "q" starting from current address."q" is of the form: value1,value2,....,value-n where "value" is a byte, word, or string in quotes (""). Aquestion mark ("?") used anywhere is a wildcard that matches ANY byte. Press command letter for help on specific command, or ESCape key to return to main help menu. Press command letter for help on specific command, or \ No newline at end of file diff --git a/Source/Images/d_qpm/u0/dhoriz.com b/Source/Images/d_qpm/u0/dhoriz.com new file mode 100644 index 00000000..f97a499b Binary files /dev/null and b/Source/Images/d_qpm/u0/dhoriz.com differ diff --git a/Source/Images/d_qpm/u0/hello.qpm b/Source/Images/d_qpm/u0/hello.qpm new file mode 100644 index 00000000..30aba4e1 --- /dev/null +++ b/Source/Images/d_qpm/u0/hello.qpm @@ -0,0 +1,3 @@ + + G2Welcome to QP/M 2.71G0 + \ No newline at end of file diff --git a/Source/Images/d_qpm/u0/lz.com b/Source/Images/d_qpm/u0/lz.com new file mode 100644 index 00000000..9a6eef86 Binary files /dev/null and b/Source/Images/d_qpm/u0/lz.com differ diff --git a/Source/Images/d_qpm/u0/qbackup.com b/Source/Images/d_qpm/u0/qbackup.com new file mode 100644 index 00000000..5e5f218f Binary files /dev/null and b/Source/Images/d_qpm/u0/qbackup.com differ diff --git a/Source/Images/d_qpm/u0/qinstall.com b/Source/Images/d_qpm/u0/qinstall.com new file mode 100644 index 00000000..20fcaaf6 Binary files /dev/null and b/Source/Images/d_qpm/u0/qinstall.com differ diff --git a/Source/Images/d_qpm/u0/qpatch.com b/Source/Images/d_qpm/u0/qpatch.com new file mode 100644 index 00000000..ea57b743 Binary files /dev/null and b/Source/Images/d_qpm/u0/qpatch.com differ diff --git a/Source/Images/d_qpm/u0/qpip.com b/Source/Images/d_qpm/u0/qpip.com new file mode 100644 index 00000000..c926b8af Binary files /dev/null and b/Source/Images/d_qpm/u0/qpip.com differ diff --git a/Source/Images/d_qpm/u0/qpm.sys b/Source/Images/d_qpm/u0/qpm.sys new file mode 100644 index 00000000..78ce325f Binary files /dev/null and b/Source/Images/d_qpm/u0/qpm.sys differ diff --git a/Source/Images/d_qpm/u0/qpmclk.mac b/Source/Images/d_qpm/u0/qpmclk.mac new file mode 100644 index 00000000..39839836 --- /dev/null +++ b/Source/Images/d_qpm/u0/qpmclk.mac @@ -0,0 +1,107 @@ + .z80 +; +; Clock for supplementing normal MYZ80 bios +; +; +;========================================================================== +; +; +false equ 0 +true equ not false + +size equ 6275 ;size in 0.01 k (e.g. 60k = 6000, + ; 59.5k = 5950, 48.25k = 4825) + +ioval equ 80H ;IOBYTE value on cold boot (see documentation) +; +; Lower memory stuff +; +IOBYTE EQU 3 ;IOBYTE location +DSKUSR EQU 4 ;Disk/user location +ENTRY EQU 5 +WARMB EQU 0 +; +; QP/M locations +; +QPMBIOS EQU size/25*256 +QDOS EQU QPMBIOS-(0EA00H-0DC06H) +QCP EQU QDOS-806H +; +; MYZ80 API locations used +; +CONST EQU 0FFE1H ;Console status +CONIN EQU 0FFE2H ;Console input +CRTOUT EQU 0FFE3H ;Send char to console +LIST EQU 0FFE4H ;List character +PUNCH EQU 0FFE5H ;Punch character (auxout) +READER EQU 0FFE6H ;Reader character (auxin) +HOME EQU 0FFE7H ;Home disk +SELDSK EQU 0FFE8H ;Select disk in C-reg. +SETTRK EQU 0FFE9H ;Seek track in C-reg. +SETSEC EQU 0FFEAH ;Seek sector +SETDMA EQU 0FFEBH ;Set disk i/o address +READ EQU 0FFECH ;Read sector +WRITE EQU 0FFEDH ;Write sector +PRSTAT EQU 0FFEEH ;List status +SECTRAN EQU 0FFEFH ;Sector xlation +CONOUTS EQU 0FFF0H ;Console output status +XBIOS EQU 0FFFDH ;Extended MYZ80 functions +; +; High (MONITOR) area data locations +; +; Printer locations in high memory +; +HISTACK EQU 0FF14H ;temp +; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; + ASEG + ORG 100H + .phase 0fec0h +; +qpmclk:: + LD A,42 + LD HL,CLKBUF + PUSH HL + CALL XBIOS ; BCD hr/min/sec/century/yr/mon/day + ; convert from BCD to normal -- and fix things up + POP HL + LD B,7 + DEC HL +Q0: INC HL + XOR A + RRD ; rotate low nibble of A through nibbles of (HL) + LD D,A ; save low nibble + LD A,(HL) ; get high nibble + ADD A,A ; * 2 + LD C,A ; save + ADD A,A ; * 4 + ADD A,A ; * 8 + ADD A,C ; * 10 + ADD A,D ; + low digit + LD (HL),A ; set non-BCD version + DJNZ Q0 + ; now realign values from system call + LD C,A ; day + DEC HL + LD B,(HL) ; mon + DEC HL + LD E,(HL) ; yr + DEC HL + DEC HL ; skip century + PUSH BC + LD B,(HL) ; sec + DEC HL + LD C,(HL) ; min + DEC HL + LD D,(HL) ; hr + LD (CLKBUF+2),DE ; yrE/hrD + LD (CLKBUF+4),BC ; minC/secB + POP BC + LD (CLKBUF),BC ; dayC/monB + ; did the adjustments -- return ptr to day/mon/yr/hr/min/sec + ret +CLKBUF: DB 0,0,0,0,0,0,0 + .dephase + end + \ No newline at end of file diff --git a/Source/Images/d_qpm/u0/qpmcmds.txt b/Source/Images/d_qpm/u0/qpmcmds.txt new file mode 100644 index 00000000..f63d04f7 --- /dev/null +++ b/Source/Images/d_qpm/u0/qpmcmds.txt @@ -0,0 +1,22 @@ + + G2QPM CommandsG0 + G2============G0 +The QCP command processor has the following built-in commands; +afn=wildcard filename(s); ufn=filename; []=optional + +G2DFD [drive[:]]G0 - Sets the default drive (A: at startup) +G2DFLTG0 - Shows the default drive and user (@=disabled) +G2DFUG0 - Sets the default user (0 at startup) +G2DIR [afn]G0 - Simple directory listing (D.COM is recommended) +G2ERA afnG0 - Erase specified file(s) +G2GET addr ufnG0 - Load file at address +G2GO [params]G0 - Reruns the program in TPA (with params) +G2JUMP addr [params]G0 - Run the program at address (with params) +G2LIST ufnG0 - Print the specified file on the LST: device +G2REN ufnnew=ufnoldG0 - Rename ufnold to ufnnew +G2SAVE n ufnG0 - Save n pages from the TPA into file +G2TIMEG0 - Display the current date and time +G2TOFG0 - Sends top-of-form character to LST: device +G2TYPE ufn [option]G0 - Display file on console, with page pauses +G2USER [n]G0 - Set user # to n (0 if no value given) + \ No newline at end of file diff --git a/Source/Images/d_qpm/u0/qpmutils.txt b/Source/Images/d_qpm/u0/qpmutils.txt new file mode 100644 index 00000000..e5bf0b7b --- /dev/null +++ b/Source/Images/d_qpm/u0/qpmutils.txt @@ -0,0 +1,19 @@ + + G2QPM Utility ProgramsG0 + G2====================G0 +QP/M comes loaded with all utility programs for emulator use: +afn=wildcard filename(s); ufn=filename; []=optional + +G2D [afn] [options]G0 - Directory listing with numerous options +G2DHORIZ [afn] [...]G0 - Same with horizontal directory listing +G2QBACKUPG0 - Backup entire disk or selected files +G2QPATCHG0 - Modify settings of D.COM +G2QPIPG0 - Copy files, peripheral interchange, etc. +G2QSTAMP(V|X)G0 - Time/date stamp disk (QSTAMPV recommended) +G2QSTATG0 - Display/change file status +G2QSUBG0 - Powerful batch processing, nesting supported +G2QSWEEPG0 - Powerful interactive file manipulation +G2TDCNFGG0 - Configure real-time clock (NOT NEEDED) + +We recommend G2LinkZG0 and G2DebugZG0; get from G2http://www.microcodeconsulting.comG0. + \ No newline at end of file diff --git a/Source/Images/d_qpm/u0/qstamp.com b/Source/Images/d_qpm/u0/qstamp.com new file mode 100644 index 00000000..e1c00caf Binary files /dev/null and b/Source/Images/d_qpm/u0/qstamp.com differ diff --git a/Source/Images/d_qpm/u0/qstampv.com b/Source/Images/d_qpm/u0/qstampv.com new file mode 100644 index 00000000..3cb38e1d Binary files /dev/null and b/Source/Images/d_qpm/u0/qstampv.com differ diff --git a/Source/Images/d_qpm/u0/qstampx.com b/Source/Images/d_qpm/u0/qstampx.com new file mode 100644 index 00000000..6b79604e Binary files /dev/null and b/Source/Images/d_qpm/u0/qstampx.com differ diff --git a/Source/Images/d_qpm/u0/qstat.com b/Source/Images/d_qpm/u0/qstat.com new file mode 100644 index 00000000..957d860f Binary files /dev/null and b/Source/Images/d_qpm/u0/qstat.com differ diff --git a/Source/Images/d_qpm/u0/qsub.com b/Source/Images/d_qpm/u0/qsub.com new file mode 100644 index 00000000..a15de060 Binary files /dev/null and b/Source/Images/d_qpm/u0/qsub.com differ diff --git a/Source/Images/d_qpm/u0/qsweep.com b/Source/Images/d_qpm/u0/qsweep.com new file mode 100644 index 00000000..8fdd4c08 Binary files /dev/null and b/Source/Images/d_qpm/u0/qsweep.com differ diff --git a/Source/Images/d_qpm/u0/qterm.dat b/Source/Images/d_qpm/u0/qterm.dat new file mode 100644 index 00000000..446fbaa0 Binary files /dev/null and b/Source/Images/d_qpm/u0/qterm.dat differ diff --git a/Source/Images/d_qpm/u0/qterms.lib b/Source/Images/d_qpm/u0/qterms.lib new file mode 100644 index 00000000..d29019c7 Binary files /dev/null and b/Source/Images/d_qpm/u0/qterms.lib differ diff --git a/Source/Images/d_qpm/u0/setqterm.com b/Source/Images/d_qpm/u0/setqterm.com new file mode 100644 index 00000000..c49bdd71 Binary files /dev/null and b/Source/Images/d_qpm/u0/setqterm.com differ diff --git a/Source/Images/d_qpm/u0/tdcnfg.com b/Source/Images/d_qpm/u0/tdcnfg.com new file mode 100644 index 00000000..825c73bd Binary files /dev/null and b/Source/Images/d_qpm/u0/tdcnfg.com differ diff --git a/Source/Images/d_ws4/u1/README.MD b/Source/Images/d_ws4/u1/README.MD new file mode 100644 index 00000000..2fc3496b --- /dev/null +++ b/Source/Images/d_ws4/u1/README.MD @@ -0,0 +1,31 @@ +# ZDE 1.6 (Z-System Display Editor) reconstituted source - MECPARTS +11/19/2020 + +Using the source code of [VDE 2.67] +(http://www.classiccmp.org/cpmarchives/cpm/Software/WalnutCD/enterprs/cpm/utils/s/vde267sc.lbr) +as a guide, I've reconstituted the source code for [ZDE 1.6](http://www.classiccmp.org/cpmarchives/cpm/Software/WalnutCD/cpm/editor/zde16.lbr). + +The source has been assembled with: + +* Al Hawley's ZMAC: assemble as is. +* MicroSoft's M80: rename to ZDE16.MAC, un-comment the first two lines + and assemble. Use RELHEX to create ZDE16.HEX. +* ZASM (Cromemco's ASMB): Rename to ZDE16.Z80 and assemble. Use RELHEX +to create ZDE16.HEX. + +Use MLOAD to create ZDE16.COM. + +There are still a couple of routines new to ZDE that I haven't figured +out (yet). But most of them have been sussed out. + +## ZDE 1.7 - MECPARTS 11/24/2020 + +I've fixed the "doesn't preserve timestamps for files larger than a +single extent under ZSDOS" bug that was present in v1.6. The existing +ZDENST16.COM program will work with the 1.7 to set the program up for +your terminal and printer. + +## ZDE 1.8 - Lars Nelson 12/3/2022 + +Added routine to save create time stamp under CP/M Plus since +CP/M Plus, unlike ZSDOS, has no native ability to set time stamps. \ No newline at end of file diff --git a/Source/Images/d_cpm22/u1/SAMPKEY.DOC b/Source/Images/d_ws4/u1/SAMPKEY.DOC similarity index 100% rename from Source/Images/d_cpm22/u1/SAMPKEY.DOC rename to Source/Images/d_ws4/u1/SAMPKEY.DOC diff --git a/Source/Images/d_cpm22/u1/SAMPKEY.ZDK b/Source/Images/d_ws4/u1/SAMPKEY.ZDK similarity index 100% rename from Source/Images/d_cpm22/u1/SAMPKEY.ZDK rename to Source/Images/d_ws4/u1/SAMPKEY.ZDK diff --git a/Source/Images/d_cpm22/u1/SAMPKEY.ZDT b/Source/Images/d_ws4/u1/SAMPKEY.ZDT similarity index 100% rename from Source/Images/d_cpm22/u1/SAMPKEY.ZDT rename to Source/Images/d_ws4/u1/SAMPKEY.ZDT diff --git a/Source/Images/d_cpm22/u1/ZDE10.DOC b/Source/Images/d_ws4/u1/ZDE10.DOC similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE10.DOC rename to Source/Images/d_ws4/u1/ZDE10.DOC diff --git a/Source/Images/d_cpm22/u1/ZDE10.FOR b/Source/Images/d_ws4/u1/ZDE10.FOR similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE10.FOR rename to Source/Images/d_ws4/u1/ZDE10.FOR diff --git a/Source/Images/d_cpm22/u1/ZDE10.NEW b/Source/Images/d_ws4/u1/ZDE10.NEW similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE10.NEW rename to Source/Images/d_ws4/u1/ZDE10.NEW diff --git a/Source/Images/d_cpm22/u1/ZDE10.QRF b/Source/Images/d_ws4/u1/ZDE10.QRF similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE10.QRF rename to Source/Images/d_ws4/u1/ZDE10.QRF diff --git a/Source/Images/d_cpm22/u1/ZDE10.TOC b/Source/Images/d_ws4/u1/ZDE10.TOC similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE10.TOC rename to Source/Images/d_ws4/u1/ZDE10.TOC diff --git a/Source/Images/d_cpm22/u1/ZDE13.FOR b/Source/Images/d_ws4/u1/ZDE13.FOR similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE13.FOR rename to Source/Images/d_ws4/u1/ZDE13.FOR diff --git a/Source/Images/d_cpm22/u1/ZDE13.NEW b/Source/Images/d_ws4/u1/ZDE13.NEW similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE13.NEW rename to Source/Images/d_ws4/u1/ZDE13.NEW diff --git a/Source/Images/d_cpm22/u1/ZDE16.COM b/Source/Images/d_ws4/u1/ZDE16.COM similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE16.COM rename to Source/Images/d_ws4/u1/ZDE16.COM diff --git a/Source/Images/d_cpm22/u1/ZDE16.DIR b/Source/Images/d_ws4/u1/ZDE16.DIR similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE16.DIR rename to Source/Images/d_ws4/u1/ZDE16.DIR diff --git a/Source/Images/d_cpm22/u1/ZDE16.FIX b/Source/Images/d_ws4/u1/ZDE16.FIX similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE16.FIX rename to Source/Images/d_ws4/u1/ZDE16.FIX diff --git a/Source/Images/d_cpm22/u1/ZDE16.FOR b/Source/Images/d_ws4/u1/ZDE16.FOR similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE16.FOR rename to Source/Images/d_ws4/u1/ZDE16.FOR diff --git a/Source/Images/d_cpm22/u1/ZDE16.NEW b/Source/Images/d_ws4/u1/ZDE16.NEW similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE16.NEW rename to Source/Images/d_ws4/u1/ZDE16.NEW diff --git a/Source/Images/d_cpm22/u1/ZDE16A.COM b/Source/Images/d_ws4/u1/ZDE16A.COM similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE16A.COM rename to Source/Images/d_ws4/u1/ZDE16A.COM diff --git a/Source/Images/d_cpm22/u1/ZDE16A.PAT b/Source/Images/d_ws4/u1/ZDE16A.PAT similarity index 100% rename from Source/Images/d_cpm22/u1/ZDE16A.PAT rename to Source/Images/d_ws4/u1/ZDE16A.PAT diff --git a/Source/Images/d_ws4/u1/ZDE18.COM b/Source/Images/d_ws4/u1/ZDE18.COM new file mode 100644 index 00000000..f5b37040 Binary files /dev/null and b/Source/Images/d_ws4/u1/ZDE18.COM differ diff --git a/Source/Images/d_cpm22/u1/ZDENST16.COM b/Source/Images/d_ws4/u1/ZDENST16.COM similarity index 100% rename from Source/Images/d_cpm22/u1/ZDENST16.COM rename to Source/Images/d_ws4/u1/ZDENST16.COM diff --git a/Source/Images/d_cpm22/u1/ZDEPROP.DOC b/Source/Images/d_ws4/u1/ZDEPROP.DOC similarity index 100% rename from Source/Images/d_cpm22/u1/ZDEPROP.DOC rename to Source/Images/d_ws4/u1/ZDEPROP.DOC diff --git a/Source/Images/d_cpm22/u1/ZDEPROP.Z80 b/Source/Images/d_ws4/u1/ZDEPROP.Z80 similarity index 100% rename from Source/Images/d_cpm22/u1/ZDEPROP.Z80 rename to Source/Images/d_ws4/u1/ZDEPROP.Z80 diff --git a/Source/Images/d_cpm22/u1/ZDKCOM13.COM b/Source/Images/d_ws4/u1/ZDKCOM13.COM similarity index 100% rename from Source/Images/d_cpm22/u1/ZDKCOM13.COM rename to Source/Images/d_ws4/u1/ZDKCOM13.COM diff --git a/Source/Images/d_cpm22/u1/ZDKCOM13.DOC b/Source/Images/d_ws4/u1/ZDKCOM13.DOC similarity index 100% rename from Source/Images/d_cpm22/u1/ZDKCOM13.DOC rename to Source/Images/d_ws4/u1/ZDKCOM13.DOC diff --git a/Source/Images/d_zpm3.txt b/Source/Images/d_zpm3.txt deleted file mode 100644 index c330d32c..00000000 --- a/Source/Images/d_zpm3.txt +++ /dev/null @@ -1,32 +0,0 @@ -# -# Add files from ZPM3 build -# -../ZPM3/zpmldr.com 0: -../ZPM3/zpmldr.sys 0: -../CPM3/cpmldr.com 0: -../CPM3/cpmldr.sys 0: -../ZPM3/autotog.com 15: -../ZPM3/clrhist.com 15: -../ZPM3/setz3.com 15: -../ZPM3/cpm3.sys 0: -../ZPM3/zccp.com 0: -../ZPM3/zinstal.zpm 0: -../ZPM3/startzpm.com 0: -../ZPM3/makedos.com 0: -../ZPM3/gencpm.dat 0: -../ZPM3/bnkbios3.spr 0: -../ZPM3/bnkbdos3.spr 0: -../ZPM3/resbdos3.spr 0: -# -# Add RomWBW utilities -# -../../Binary/Apps/*.com 15: -# -# Add Tune sample files -# -../../Binary/Apps/Tunes/*.pt? 3: -../../Binary/Apps/Tunes/*.mym 3: -# -# Add Common Applications -# -Common/*.* 15: diff --git a/Source/Images/d_zpm3/u0/ROMWBW.TXT b/Source/Images/d_zpm3/u0/ROMWBW.TXT index 45528bd5..f55c62a4 100644 --- a/Source/Images/d_zpm3/u0/ROMWBW.TXT +++ b/Source/Images/d_zpm3/u0/ROMWBW.TXT @@ -6,9 +6,10 @@ boot directly into ZPM3 by choosing the ZPM3 disk from the RomWBW loader prompt. The ZPM3 disk must be bootable in this case. You may notice that there is a ZPMLDR application on the hard disk -image. This application is equivalent to CPMLDR, but it has some -issues with the number of drives that RomWBW supports. So, as -indicated above, use CPMLDR to launch ZPM3. +image. This application is equivalent to CPMLDR. It originally +had some issues that prevented it from booting RomWBW properly, +but those issues are now resolved (I think). Either ZPMLDR or CPMLDR +can be used to launch ZPM3. I have not found a way to make ZPM3 start up with any drive other than A: as the system drive. So, during the load process, the boot @@ -20,7 +21,7 @@ Per ZPM3 standard, files are distributed across different user areas depending on their usage. Normal applications are in user 15. Help files in user 10. Configuration files in user 14. -In addition to the applications provided in the ZPM3 distributio, the +In addition to the applications provided in the ZPM3 distribution, the normal CP/M 3 files are included in user area 15. A few typical ZCPR utility programs are also included in user area 15: @@ -40,8 +41,23 @@ utility programs are also included in user area 15: - ZP - SHOW (named ZSHOW) - ZXD + - EDITNDR + - SAVENDR + - SDZ It is a bit confusing, but the ZPM3 system file is called CPM3.SYS. This is the ZPM3 default configuration and I guess it is done this way to maximize compatibility with CP/M 3. You will notice that the -startup banner will indicate ZPM3. \ No newline at end of file +startup banner will indicate ZPM3. + +In 2015, Jon Saxton released a patched version of ZPM3. The changes +are documented in ZPM3FIX.TXT in the RomWBW distribution in the +Source/ZPM3 directory. RomWBW uses the patched version of +ZPM3. However, Jose Luis discovered that named directories do not +work properly with these patches (see RomWBW GitHub Issue #324). I have +subsequenty added a small patch to correct this. The original +unpatched copies of RESBDOS.SPR and BNKBDOS.SPR are included in the +RomWBW build directory for ZPM3 as RESBDOS.SPR.bak and +BNKBDOS.SPR.bak. If you want to revert to the unpatched release of +ZPM3, just overlay RESBDOS.SPR and BNKBDOS.SPR with the .bak variants +and regenerate RomWBW. \ No newline at end of file diff --git a/Source/Images/d_zpm3/u10/MENU.HLP b/Source/Images/d_zpm3/u10/MENU.HLP index d4d59aa5..0e683502 100644 --- a/Source/Images/d_zpm3/u10/MENU.HLP +++ b/Source/Images/d_zpm3/u10/MENU.HLP @@ -6,6 +6,7 @@ V - VLU (Visual Library Utility) F - ZFiler (Point and Shoot Shell) Z - ZPatch (File/Disk/Memory Record Patcher) + S - SCopy (Screen Oriented File Copy Utility) ZHELP can also be used to access help files directly by entering ZHELP followed by the name of the help file. @@ -20,4 +21,5 @@ command HELP. :I:IF.HLP :V:VLU.HLP :F:ZFILER.HLP -:Z:ZP.HLP \ No newline at end of file +:Z:ZP.HLP +:S:SCOPY.HLP \ No newline at end of file diff --git a/Source/Images/d_zpm3/u15/editndr.com b/Source/Images/d_zpm3/u15/editndr.com new file mode 100644 index 00000000..149cb98c Binary files /dev/null and b/Source/Images/d_zpm3/u15/editndr.com differ diff --git a/Source/Images/d_zpm3/u15/help.com b/Source/Images/d_zpm3/u15/help.com index 378cf03b..3a4d4394 100644 Binary files a/Source/Images/d_zpm3/u15/help.com and b/Source/Images/d_zpm3/u15/help.com differ diff --git a/Source/Images/d_zpm3/u15/lbrext.com b/Source/Images/d_zpm3/u15/lbrext.com deleted file mode 100644 index c0c950e3..00000000 Binary files a/Source/Images/d_zpm3/u15/lbrext.com and /dev/null differ diff --git a/Source/Images/d_zpm3/u15/lib.com b/Source/Images/d_zpm3/u15/lib.com deleted file mode 100644 index de16a896..00000000 Binary files a/Source/Images/d_zpm3/u15/lib.com and /dev/null differ diff --git a/Source/Images/d_zpm3/u15/link.com b/Source/Images/d_zpm3/u15/link.com deleted file mode 100644 index fc66084b..00000000 Binary files a/Source/Images/d_zpm3/u15/link.com and /dev/null differ diff --git a/Source/Images/d_zpm3/u15/mac.com b/Source/Images/d_zpm3/u15/mac.com deleted file mode 100644 index f1fdba57..00000000 Binary files a/Source/Images/d_zpm3/u15/mac.com and /dev/null differ diff --git a/Source/Images/d_zpm3/u15/mbasic.com b/Source/Images/d_zpm3/u15/mbasic.com deleted file mode 100644 index c9ec3cd3..00000000 Binary files a/Source/Images/d_zpm3/u15/mbasic.com and /dev/null differ diff --git a/Source/Images/d_zpm3/u15/rmac.com b/Source/Images/d_zpm3/u15/rmac.com deleted file mode 100644 index f608dc11..00000000 Binary files a/Source/Images/d_zpm3/u15/rmac.com and /dev/null differ diff --git a/Source/Images/d_zpm3/u15/savendr.com b/Source/Images/d_zpm3/u15/savendr.com new file mode 100644 index 00000000..bf8d1125 Binary files /dev/null and b/Source/Images/d_zpm3/u15/savendr.com differ diff --git a/Source/Images/d_zpm3/u15/sdz.com b/Source/Images/d_zpm3/u15/sdz.com new file mode 100644 index 00000000..46f81fdc Binary files /dev/null and b/Source/Images/d_zpm3/u15/sdz.com differ diff --git a/Source/Images/d_zpm3/u15/tcap.z3t b/Source/Images/d_zpm3/u15/tcap.z3t deleted file mode 100644 index 1a43a949..00000000 Binary files a/Source/Images/d_zpm3/u15/tcap.z3t and /dev/null differ diff --git a/Source/Images/d_zpm3/u15/zxd.com b/Source/Images/d_zpm3/u15/zxd.com deleted file mode 100644 index 16469ed0..00000000 Binary files a/Source/Images/d_zpm3/u15/zxd.com and /dev/null differ diff --git a/Source/Images/d_zsdos.txt b/Source/Images/d_zsdos.txt deleted file mode 100644 index c9e552a1..00000000 --- a/Source/Images/d_zsdos.txt +++ /dev/null @@ -1,17 +0,0 @@ -# -# Add RomWBW utilities -# -../../Binary/Apps/*.com 0: -# -# Add Tune sample files -# -../../Binary/Apps/Tunes/*.pt? 3: -../../Binary/Apps/Tunes/*.mym 3: -# -# Add OS image -# -../ZSDOS/zsys_wbw.sys 0:zsys.sys -# -# Add Common Applications -# -Common/*.* 0: diff --git a/Source/Images/d_zsdos/ReadMe.txt b/Source/Images/d_zsdos/ReadMe.txt new file mode 100644 index 00000000..f14d7c3b --- /dev/null +++ b/Source/Images/d_zsdos/ReadMe.txt @@ -0,0 +1,302 @@ +===== ZSDOS Disk for RomWBW ===== + +This disk is one of several ready-to-run disks provided with +RomWBW. It contains a customized version of ZSDOS 1.1 for RomWBW. +The disk is bootable as is (the operating system image is already +embedded in the system tracks) and can be launched from the RomWBW +Loader prompt. + +The remainder of this document describes the usage and contents of +this disk. It is highly recommended that you review the "RomWBW +User Guide.pdf" document found in the Doc directory of the +RomWBW Distribution. + +ZSDOS is a replacement for the BDOS portion of the CP/M 2.2 operating +system. Since it does not include it's own command processor, the +the ZCPR D&J Command Processor has been included. + +The primary documentation for ZSDOS and ZCPR 1 are contained in the Doc +directory of the RomWBW distribution. The specific files are "ZSDOS +Manual.pdf", "ZCPR Manual.pdf", and "ZCPR-DJ.doc". This document is a +supplement to the primary documentation. + +The starting point for the disk content was the final public release of +ZSDOS which is generally available on the Internet. Overall, the +following steps were performed: + +1. System installation and integration with RomWBW. +2. Update files to newer versions, as available. +3. Configure applications for RomWBW (clock drivers, terminal emulation, + etc.) +4. Add selected CP/M 2 applications (listed below). +5. Add selected RomWBW supplemental applications (listed below). +6. Add some useful general purpose applications (listed below). + +Note that ZSDOS can be built as either ZSDOS or ZDDOS. It is the same +source file, but an equate determines which variation you want to +build. Basically, ZSDOS has more features. ZDDOS has less features, but +includes the date stamping code built-in. The ZSDOS Manual provides +more information. I have chosen to use ZSDOS to pick up the maximum +number of features. Date stamping is still available, but must be +loaded as an RSX. + +The source allows you to compile the OS code as either v1.1 or v1.2 via +an equate. Version 1.2 was never distributed and contains only a few +minor fixes. Unfortunately, the use of v1.2 would make it incompatible +with many support modules and overlays due to their reliance on +hard-coded address assumptions. This is probably why it was never +distributed. I encountered this myself with the date stamping code –- +it won't work with v1.2 because it does a version check. For now, I have +chosen to use v1.1 to maximize compatibility (seems to be what everyone +is doing). Ultimately, I may go back and try to rebuild everything in +the distribution to bring it all up to v1.2. That is for the future +though. + +== Usage == + + - All installation steps needed to run ZSDOS have already been + performed. It is not necessary to perform any of the steps in + the "Installing ZSDOS" section of the ZSDOS Manual unless you + want to modify the installation. + - ZSDOS has a concept of fast relog of drives. This means that after + a warm start, it avoids the overhead of relogging all the disk + drives. There are times when this causes issues. After using tools + like CLRDIR or MAP, you may need to run "RELOG" to get the drive + properly recognized by ZSDOS. + - ZSVSTAMP from the original distribution is included, but requires a + ZCPR 3.X command processor. The RomWBW ZSDOS disk image uses ZCPR 1.0 + (intentionally, to reduce space usage) and ZSVSTAMP will just abort + in this case. It will work fine if you implement NZCOM. ZSVSTAMP is + included solely to facilitate usage if/when you install NZCOM. + - FILEDATE only works with DateStamper style date stamping. If you + run it on a drive that is not initialized for DateStamper, it will + complain "FILEDATE, !!!TIME&.DAT missing". This is normal and just + means that you have not initialized that drive for DateStamper (using + PUTDS). + - ZXD will handle either DateStamper or P2DOS type date stamping. + However, it MUST be configured appropriately. As distributed, it will + look for DateStamper date stamps. Use ZCNFG to reconfigure it for + P2DOS date stamps if that is what you are using. + - Many of the tools can be configured (using either ZCNFG or + DSCONFIG). The configuration process modifies the actual application + file itself. This will fail if you try to modify one that is on the + ROM disk because it will not be able to update the image. + - DATSWEEP can be configured using DSCONFIG. However, DSCONFIG itself + needs to be configured first for proper terminal emulation by using + SETTERM. So, run SETTERM on DSCONFIG before using DSCONFIG to + configure DATSWEEP! + - After using PUTDS to initialize a directory for ZDS date stamping, + I am finding that it is necessary to run RELOG before the stamping + routines will actually start working. + - Generic CP/M PIP and ZSDOS path searching do not mix well if you + use PIP to copy to or from a directory in the ZSDOS search path. Best + to use COPY from the ZSDOS distribution. + - PUTBG.COM and BGPATCH.HEX are included, but note that they are for + use with BackGrounder II software which is not included. Refer to + the ZSDOS Manual for information on implementing BackGrounder II if + desired. + +== Date Stamping Quick Start == + +== Notes == + +As I worked through the files in the distribution, it became clear that +there were problems with the distribution. For example, the .CFG files +for some apps (like FILEDATE.COM) are not acceptable to ZCNFG. +Additionally, the STAMPS.DAT file contains code that simply does not +work. In all of these cases, I found updated or fixed versions of the +files. However, the point is that I concluded I would need to go +through the distribution file-by-file and validate everything, +replacing anything that was not working as it should. See the notes below +for what I did. + +The following list 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. + + - CLOCKS.DAT has been updated to include the RomWBW clock driver, + WBWCLK. I have also added the SIMHCLOK clock driver. + - 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 causes RSX (resident system + extension) mode to fail to load properly. + - The original LDTIMD.COM and LDTIMP.COM have been replaced with + LDDS.COM (DateStamper) and LDP2D.COM (P2DOS) respectively. They are + equivalent but configured to use the RomWBW clock driver. They were + built exactly the same as the originals: Relative Clock driver w/ RSX + mode loading. + - A driver for NZT format time stamping has been added. It is called + LDNZT.COM. + - Updated FILEDATE.COM and FILEDATE.CFG from original v1.7 to v2.1. + The FILEDATE.CFG originally supplied was invalid. + - Updated FILEATTR to v1.6A. Original FILEATTR.CFG was invalid. + FILEATTR.CFG was replaced with FA16.CFG. Added associated files + FA16.DOC, FA16A.FOR, FA16CFG.TXT. + - Updated COPY.COM to v1.73. Also updated COPY.CFG to the one + distributed with COPY.COM v1.73. The original COPY.CFG was invalid + and appeared to be for a much older version of COPY. + - Configured DATSWEEP.COM and DSCONFIG to use ANSI Standard terminal + definition using SETTERM. + +== ZSDOS 1.1 Files == + +The following files came from the official ZSDOS distribution. These +are generally documented in the "ZSDOS Manual.pdf" document in the Doc +directory of the RomWBW distribution. Note that some of the files +included in the ZSDOS distribution are not listed below because they +have been superseded by more recent versions listed in other sections +below. For example, ZXD is not listed here, but a more recent version is +included and documented in the General Purpose Applications section +below. + +BGPATCH.HEX - Patches BackGrounder II for ZSDOS 1.1 compatibility +CLOCKS.DAT - Library of clock drivers +COPY.CFG - ZCNFG configuration file for COPY +COPY.COM - Enhanced file copy tool +COPY.UPD - Document describing updates to COPY program +DATSWEEP.COM - File management utility w/ date/time stamp awareness +DSCONFIG.COM - Program to configure DATSWEEP +FA16.CFG - ZCNFG configuration file for FILEATTR +FA16.DOC - Documentation for FILEATTR +FA16A.FOR - Summary of FILEATTR program version 16a +FA16CFG.TXT - Document describes FILEATTR configuration options +FILEATTR.COM - Set and/or display file attributes +FILEDATE.CFG - ZCNFG configuration fie for FILEDATE +FILEDATE.COM - Date/time stamping aware disk directory utility +INITDIR.CFG - ZCNFG configuration file for INITDIR +INITDIR.COM - Prepare disk for P2DOS date/time stamping +LDDS.COM - Load DateStamper date/time stamping resident extension +LDNZT.COM - Load NZT date/time stamping resident extension +LDP2D.COM - Load P2DOS date/time stamping resident extension +PUTBG.COM - Updated replacement for BackGrounder II PUTBG program +PUTDS.COM - Prepare disk for DateStamper date/time stamping +RELOG.COM - Clear fixed disk login vector in ZSDOS (see manual) +SETTERM.COM - Terminal configuration utility for DATSWEEP & DSCONFIG +SETUPZST.COM - Creates customized date/time stamping resident extensions +STAMPS.DAT - Library of available date/time stamping modules for SETUPZST +TD.CFG - ZCNFG configuration file for TD +TD.COM - Read and set system real-time clock +TERMBASE.DAT - Library of terminals used by SETTERM +TESTCLOK.COM - Test a selected clock driver +ZCAL.COM - Display a small one-month calendar to the screen +ZCNFG.COM - Configuration tool for programs with .CFG files +ZCNFG24.CFG - ZCNFG configuration file for ZCNFG +ZPATH.COM - Set or display ZSDOS and ZCPR search paths +ZSCONFIG.COM - Dynamically configure features of ZSDOS operating system +ZSVSTAMP.COM - Preserves file date/time stamp across modifications +ZSVSTAMP.DOC - Document describes the use and operation of ZSVSTAMP + +== CP/M 2.2 Files == + +The following files have been included from CP/M 2.2. These files +provide various functionality that is not really available from the +ZSDOS applications themselves. For example, the CP/M 2.2 application +called STAT is useful for modifying the IOBYTE. Most of these +applications are documented in the "CPM Manual.pdf" document in the Doc +directory of the RomWBW distribution. + +ASM.COM - DRI 8080 assembler producing Intel hex files +LIB.COM - DRI relocatable object file librarian +LINK.COM - DRI relocatable object file linker +LOAD.COM - DRI loader for Intel hex files +MAC.COM - DRI 8080 macro assembler producing Intel hex files +RMAC.COM - DRI 8080 macro assembler producing relocatable object files +STAT.COM - DRI multi-purpose file/disk/device info & configuration tool +SUBMIT.COM - DRI batch file submission tool +XSUB.COM - DRI batch file enhancer resident system extension + +== RomWBW Supplemental Applications == + +The following files provide specific functionality enabled by +RomWBW enhancements. These applications are documented in the +"RomWBW Applications.pdf" document in the Doc directory of the +RomWBW Distribution. + +ASSIGN.COM - Assign,remove,swap drive letters of RomWBW disk slices +FAT.COM - MS-DOS FAT filesystem tool (list, copy, delete, format, etc.) +FDU.COM - Test floppy hardware and format floppy disks +FORMAT.COM - Placeholder application with formatting instructions +INTTEST.COM - Test RomWBW interrupt processing on your hardware +MODE.COM - Change serial line characteristics (baud rate, etc.) +RTC.COM - Test real time clock hardware on your system +SURVEY.COM - Display system resources summary +SYSCOPY.COM - Copy system tracks to disks (make bootable) +SYSGEN.COM - Copy system tracks to disks (DRI version) +TALK.COM - Route console I/O to & from specified serial port +TIMER.COM - Test and display system timer ticks +TUNE.COM - Play .PT2, .PT3, and .MYM audio files on supported hardware +XM.COM - XModem file transfer application +ZMP.COM - ZModem communications program (requires dedicated comm port) +ZMP.DOC - Documentation for ZMP +ZMP.HLP - Help file for ZMP +ZMXFER.OVR - Overlay file for ZMP +ZMTERM.OVR - Overlay file for ZMP +ZMINIT.OVR - Overlay file for ZMP +ZMCONFIG.OVR - Overlay file for ZMP + +== General Purpose Applications == + +The following files are commonly used CP/M applications that +are generally useful in any CP/M-like system. In general, there is +no documentation for these applications included with the RomWBW +distribution. Some provide command line help themselves. Some +are fairly obvious. + +CLRDIR.COM - Initializes the directory area of a disk +COMPARE.COM - Compare content of two files (binary) +CRUNCH.COM - Compress file(s) using Crunch algorithm +CRUNCH28.CFG - ZCNFG configuration file for CRUNCH & UNCR +DDTZ.COM - Z80 debug tool (modified to use RST 6) +DDTZ.DOC - Documentation for DDTZ +EX.COM - Batch file processor (alternative to DRI SUBMIT) +FDISK80.COM - Hard disk partitioning tool (from John Coffman) +FIND.COM - Search all drives for a file (from Jay Cotton) +FLASH.COM - Program FLASH chips in-situ (from Will Sowerbutts) +FLASH.DOC - Documentation for FLASH +MBASIC.COM - Microsoft BASIC language interpreter +NULU.COM - Library (.LBR) management tool +PMARC.COM - Create or add file(s) to .PMA archive +PMEXT.COM - Extract file(s) from .PMA/.LZH/.LHA archive +RMXSUB1.COM - Remove XSUB1 RSX from memory (from Lars Nelson) +SUPERSUB.COM - Enhanced replacement for DRI SUBMIT +SUPERSUB.DOC - Documentation for SUPERSUB +TDLBASIC.COM - TDL Zapple 12K BASIC language interpreter +UNARC.COM - Extract file(s) from .ARC or .ARK archive +UNARC.DOC - Documentation for UNARC +UNCR.COM - Decompress Crunched file(s) +UNZIP.COM - UNZIPZ extracts from all MS-DOS ZIP files (from Lars Nelson) +UNZIP.DOC - Documentation for UNZIPZ +XSUB1.COM - Replacement for DRI SUB (from Lars Nelson) +ZAP.COM - Interactive disk & file utility +ZDE.COM - Compact WordStar-like editor +ZDENST.COM - Installation/configuration tool for ZDE +KERCPM22.COM - Kermit file transfer application +LBREXT.COM - Extract file from .LBR libraries +LBREXT36.CFG - ZCNFG configuration file for LBREXT +ZXD.COM - Enhanced directory lister w/ date/time stamp support +ZXD.CFG - ZCNFG configuration file for ZXD + +== Testing Applications (User Area 2) == + +User area 2 contains a variety of hardware testing applications. +These are generally user contributed and have no documentation. +Additionally, they are frequently not compatible with all RomWBW +hardware. They are included here as a convenience. If applicable, +your hardware documentation should refer to them and provide usage +instructions. + +== Sample Tune Files (User Area 3) == + +User area 3 contains sample audio files that can be played using +the TUNE application. + +== CP/NET 1.2 (User Area 4) == + +User area 4 contains a full implementation of the CP/NET 1.2 +client provided by Doug Miller. Please read the README.TXT file +in this user area for more information. + +N.B., at a minimum, some of the files in this user area must be copied +to user area 0 for CP/NET to work properly. + +-- WBW 3:20 PM 8/27/2021 \ No newline at end of file diff --git a/Source/Images/d_zsdos/u0/BGPATCH.HEX b/Source/Images/d_zsdos/u0/BGPATCH.HEX new file mode 100644 index 00000000..2966accc Binary files /dev/null and b/Source/Images/d_zsdos/u0/BGPATCH.HEX differ diff --git a/Source/Images/d_zsdos/u0/COPY.CFG b/Source/Images/d_zsdos/u0/COPY.CFG index 3d5310ac..e55fcebf 100644 Binary files a/Source/Images/d_zsdos/u0/COPY.CFG and b/Source/Images/d_zsdos/u0/COPY.CFG differ diff --git a/Source/Images/d_zsdos/u0/COPY.COM b/Source/Images/d_zsdos/u0/COPY.COM index 87c0c2fb..606c81a5 100644 Binary files a/Source/Images/d_zsdos/u0/COPY.COM and b/Source/Images/d_zsdos/u0/COPY.COM differ diff --git a/Source/Images/d_zsdos/u0/CR.COM b/Source/Images/d_zsdos/u0/CR.COM deleted file mode 100644 index 8a824bcc..00000000 Binary files a/Source/Images/d_zsdos/u0/CR.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/DATSWEEP.COM b/Source/Images/d_zsdos/u0/DATSWEEP.COM index 5d298c0b..3b56e0ce 100644 Binary files a/Source/Images/d_zsdos/u0/DATSWEEP.COM and b/Source/Images/d_zsdos/u0/DATSWEEP.COM differ diff --git a/Source/Images/d_zsdos/u0/DDT.COM b/Source/Images/d_zsdos/u0/DDT.COM deleted file mode 100644 index 70e4ebfe..00000000 Binary files a/Source/Images/d_zsdos/u0/DDT.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/DDTZ.DOC b/Source/Images/d_zsdos/u0/DDTZ.DOC deleted file mode 100644 index e4470528..00000000 --- a/Source/Images/d_zsdos/u0/DDTZ.DOC +++ /dev/null @@ -1,564 +0,0 @@ - - DDTZ v2.7 - by C.B. Falconer - edited by George A. Havach - -Introduction: -============ -DDTZ v2.7 is a complete replacement for DDT, Digital Research's -famous Dynamic Debugging Tool, with improved functionality, bug -extermination, and full Z80 support. In general, DDTZ is fully -compatible with the original utility, but it has extra and -extended commands and many fewer quirks. All Z80-specific -instructions can be (dis)assembled, though in Intel rather then -Zilog format. Furthermore, DDTZ will correctly trace ('T' and 'U' -commands) both 8080 and Z80 instructions, depending on which CPU -is operating. On startup, the program announces which CPU it is -running on. - -DDTZ v2.7 now handles the 64180 added opcodes. It does NOT test -for a 64180 CPU, since this cannot be done without executing -illegal Z80 instructions, which in turn will crash some -simulators. However v2.7 does not execute any 64180 instructions -internally, only in the subject program. - -This issue supplies the "M" version assembled, to avoid errors -when switching between MSDOS and CPM systems. The command table -is updated accordingly. Most CPM users are also MSDOS users, but -not vice-versa. - -The program is invoked by typing - - ddtz -or - ddtz [d:]filespec - -In the second form, DDTZ will load the specified file into -memory starting at 0100H, unless it's a .HEX file that sets its -own load address. Besides reporting the NEXT free address and -the PC (program counter) after a successful load, DDTZ also shows -the number of memory pages needed for a SAVE. Instead of having -to write all this down, just use the 'X' command at any time to -redisplay these three values for the current application. - -NOTE: loading more code above the NEXT pointer revises these - values. - -As in DDT, when a program is loaded above the area holding the -'A' and 'U' (and now 'W') command code, these commands are -disabled, and the extra memory is released to the user. Thus, -DDTZ can occupy as little as 3K total memory space. Unlike DDT, -however, DDTZ will not overwrite itself or the system on program -loads (except .HEX files). - -At initialization, the stack pointer (SP) points to a return to -DDTZ, just like for the CCP. Thus, programs that normally return -to the CCP will be returned to DDTZ. The 'B' command -reinitializes this condition. - - -The intercept vector copies the BDOS version number, etc., so -an object program does not know that DDTZ is running (except -for BIOS-BDOS vector size). Thus, programs that check the version -number should execute correctly under DDTZ. - -All input parameters can now be entered in any of three formats: - - (1) hexadecimal (as in DDT), - (2) decimal, by adding a leading '#' character, - (3) ASCII, by enclosing between either single or double - quotes; either one or two characters are allowed. - -Leading blanks in command lines and parameters are absorbed. -Either a comma or a (single) space is a valid delimiter. -Either uppercase or lowercase input is accepted. - -The default command (for anything not otherwise recognizable) -is 'H'. This allows convenient calculation, along with the other -features described below. So, to convert a number, just enter -it! - -As in DDT, the prompt character is '-', and the only error -message is the query ('?'), which generally kicks you back to -command mode. - -New Commands (Over DDT): -======================= - -NOTE: letters in parenthesis, e.g. "(U)", show the equivalent - command for DDTZM version (compatible with MSDOS debug). - - @ Sets or shows (with no parameter) the internally stored - "base" value. Also used with the 'S' and 'D' commands as - an optional parameter (though without the '@') to display - memory from an arbitrary base marker (offset). When set to - zero (the default), it does not affect any screen displays. - - B B)egin: resets the USER stack pointer to its initial value, - such that any program that exits by an RET will return to - DDTZ. DDTZ provides a default stack space of - approximately 24 bytes for user programs. - - C C)ompare first_address,last_address,against_address: shows - all the byte differences between two memory areas, in the - format - - XXXX aa YYYY bb - - where XXXX and YYYY are the comparative memory addresses, - and aa and bb are the corresponding byte values. Can be - used to verify the identity of two files by first - loading them into different memory areas with the 'R' - command (see below). - - - W Write: stores the modified memory area to disk under the - (K) filename specified by the 'I' command, overwriting the - original file from which it was loaded (the user is queried - before doing so). By default, the image of memory from - 0100H through the "NEXT" value -1 is saved. "K first_addr, - last_address" overrides this and allows writing ANY memory - area to a file. Almost a necessity for CPM 3.0 (no SAVE!). - K)eep on DDTZ - - X eXamine: redisplays the "NEXT PC SAVE" report at any time. - (Q) Q)uery size on DDTZ. - - S S)earch first_address, last_addr, value: searches the - (W) specified memory area for the value (a 16-bit word, not a - byte) and shows the locations of all such. Very useful for - finding CALL's or JMP's to a particular address, etc. - W)here on DDTZ - - Y Y)our_option parm1,parm2,address: executes an arbitrary - routine at the specified address, with the BC and DE - registers set to parm1 and parm2, respectively. - - Z Displays (but does not alter) the Z80's alternate register - set, including the index registers (disabled if running on - an 8080). On Z80's, automatically included as the last - part of the display by the 'X' command. - - -Based (Offset) Displays: -======================= - -The 'D' and 'E' commands can use a stored base value (offset), -as set by the '@' command. The current @ value may be -overridden for a single execution of these commands by adding the -base as an extra parameter in the command line. The effect is -to add this value to the first/last address and display -accordingly. The address listing on the left becomes XXXX:YYYY, -where XXXX is the offset address and YYYY is the actual memory -address being displayed. For example, if you have a data area -located at 42B7H and wish to preserve easy access, just enter -"@42b7". Now, "d0,3f" will dump memory starting at 4237H. - - -Further Changes from DDT: -======================== - - A A)ssemble now accepts the full Z80 as well as 8080 - instruction set, although it expects them in Intel rather - than Zilog format (see notes below under the 'L' - command). When in doubt, see the mnemnonic list below. - - D D)isplay or D)ump will accept an optional third parameter - to set the base value for a single execution only. Format - has been cleaned up. - - H H)ex_arithmetic on two values also shows their - difference in decimal. With only one value, converts to - hexadecimal, decimal, and ASCII (low-order byte only). - - - N N)ame now allows drive specification (d:...) and sets up - (I) the complete command line, including both FCB's (at - addresses 005CH and 006CH). The tail (stored at 0081H up) - is NOT upshifted. - I)nput on DDTZ - - U U)nassemble now displays the raw hexcode, especially handy - (L) when examining non-code areas. Intel (8080 style) mnemonics - are used, so some disassembled instructions may look - strange. E.g., the Z80's 'IN B,(C)' and 'OUT (C),B' become - 'INP B' and 'OUTP B', respectively; 'LD (nnnn),BC' becomes - 'SBCD nnnn', 'ADD IX, BC' becomes 'DADX B', and 'JP (IX)' - becomes 'PCIX'. - L)ist on DDTZ - - L L)oad now permits loading a file into memory with an - (R) offset, which is added to the default load address of - 0100H. When reading in a .HEX file with a preset bias, - the 'R' command will not transfer control to an invalid - execution point. Another execution of the 'R' command will - reread the input file, e.g.: - - n blah - l - ...modify the code and generally mess about... - l - - The original file is reloaded, and the modifications are - removed. - R)ead on DDTZ - - E E)nter, like D)isplay, now accepts an optional second - (S) parameter to set the base value for a single execution - only. - S)ubstitute or S)et on DDTZ - - T T)rap/trace on termination now shows the complete CPU - state. Traps and traces no longer lock up when a user RST - 7 instruction is executed. Tracing of BDOS/BIOS calls is - heavily trun cated, avoiding clutter and preventing system - crashes. - -NOTE: Most of the UNDOCUMENTED Z80 op-codes are handled. Others - can crash the system. - - R R)egisters also shows what two-byte values the HL and SP - (X) registers are actually pointing to. On Z80's, displays the - alternate register set. - eX)amine on DDTZ - -NOTE: Any use of the 'W' or 'L' command resets the system DMA - transfer address to the standard default value of 0080H. - - -; This is the output of DDTZ when disassembling OPTYPE.TRY -NOP LDA 06A4 MOV M,H -LXI B,06A4 DCX SP MOV M,L -STAX B INR A HLT -INX B DCR A MOV M,A -INR B MVI A,20 MOV A,B -DCR B CMC MOV A,C -MVI B,20 MOV B,B MOV A,D -RLC MOV B,C MOV A,E -EXAF MOV B,D MOV A,H -DAD B MOV B,E MOV A,L -LDAX B MOV B,H MOV A,M -DCX B MOV B,L MOV A,A -INR C MOV B,M ADD B -DCR C MOV B,A ADD C -MVI C,20 MOV C,B ADD D -RRC MOV C,C ADD E -DJNZ 0134 MOV C,D ADD H -LXI D,06A4 MOV C,E ADD L -STAX D MOV C,H ADD M -INX D MOV C,L ADD A -INR D MOV C,M ADC B -DCR D MOV C,A ADC C -MVI D,20 MOV D,B ADC D -RAL MOV D,C ADC E -JR 0134 MOV D,D ADC H -DAD D MOV D,E ADC L -LDAX D MOV D,H ADC M -DCX D MOV D,L ADC A -INR E MOV D,M SUB B -DCR E MOV D,A SUB C -MVI E,20 MOV E,B SUB D -RAR MOV E,C SUB E -JRNZ 0134 MOV E,D SUB H -LXI H,06A4 MOV E,E SUB L -SHLD 06A4 MOV E,H SUB M -INX H MOV E,L SUB A -INR H MOV E,M SBB B -DCR H MOV E,A SBB C -MVI H,20 MOV H,B SBB D -DAA MOV H,C SBB E -JRZ 0134 MOV H,D SBB H -DAD H MOV H,E SBB L -LHLD 06A4 MOV H,H SBB M -DCX H MOV H,L SBB A -INR L MOV H,M ANA B -DCR L MOV H,A ANA C -MVI L,20 MOV L,B ANA D -CMA MOV L,C ANA E -JRNC 0134 MOV L,D ANA H -LXI SP,06A4 MOV L,E ANA L -STA 06A4 MOV L,H ANA M -INX SP MOV L,L ANA A -INR M MOV L,M XRA B -DCR M MOV L,A XRA C -MVI M,20 MOV M,B XRA D -STC MOV M,C XRA E -JRC 0134 MOV M,D XRA H -DAD SP MOV M,E XRA L - - -XRA M JPE 06A4 SLAR M -XRA A XCHG SLAR A -ORA B CPE 06A4 SRAR B -ORA C XRI 20 SRAR C -ORA D RST 5 SRAR D -ORA E RP SRAR E -ORA H POP PSW SRAR H -ORA L JP 06A4 SRAR L -ORA M DI SRAR M -ORA A CP 06A4 SRAR A -CMP B PUSH PSW SLLR B -CMP C ORI 20 SLLR C -CMP D RST 6 SLLR D -CMP E RM SLLR E -CMP H SPHL SLLR H -CMP L JM 06A4 SLLR L -CMP M EI SLLR M -CMP A CM 06A4 SLLR A -RNZ CPI 20 SRLR B -POP B RST 7 SRLR C -JNZ 06A4 RLCR B SRLR D -JMP 06A4 RLCR C SRLR E -CNZ 06A4 RLCR D SRLR H -PUSH B RLCR E SRLR L -ADI 20 RLCR H SRLR M -RST 0 RLCR L SRLR A -RZ RLCR M BIT 0,B -RET RLCR A BIT 0,C -JZ 06A4 RRCR B BIT 0,D -CZ 06A4 RRCR C BIT 0,E -CALL 06A4 RRCR D BIT 0,H -ACI 20 RRCR E BIT 0,L -RST 1 RRCR H BIT 0,M -RNC RRCR L BIT 0,A -POP D RRCR M BIT 1,B -JNC 06A4 RRCR A BIT 1,C -OUT 20 RALR B BIT 1,D -CNC 06A4 RALR C BIT 1,E -PUSH D RALR D BIT 1,H -SUI 20 RALR E BIT 1,L -RST 2 RALR H BIT 1,M -RC RALR L BIT 1,A -EXX RALR M BIT 2,B -JC 06A4 RALR A BIT 2,C -IN 20 RARR B BIT 2,D -CC 06A4 RARR C BIT 2,E -SBI 20 RARR D BIT 2,H -RST 3 RARR E BIT 2,L -RPO RARR H BIT 2,M -POP H RARR L BIT 2,A -JPO 06A4 RARR M BIT 3,B -XTHL RARR A BIT 3,C -CPO 06A4 SLAR B BIT 3,D -PUSH H SLAR C BIT 3,E -ANI 20 SLAR D BIT 3,H -RST 4 SLAR E BIT 3,L -RPE SLAR H BIT 3,M -PCHL SLAR L BIT 3,A - - -BIT 4,B RES 3,D SET 2,H -BIT 4,C RES 3,E SET 2,L -BIT 4,D RES 3,H SET 2,M -BIT 4,E RES 3,L SET 2,A -BIT 4,H RES 3,M SET 3,B -BIT 4,L RES 3,A SET 3,C -BIT 4,M RES 4,B SET 3,D -BIT 4,A RES 4,C SET 3,E -BIT 5,B RES 4,D SET 3,H -BIT 5,C RES 4,E SET 3,L -BIT 5,D RES 4,H SET 3,M -BIT 5,E RES 4,L SET 3,A -BIT 5,H RES 4,M SET 4,B -BIT 5,L RES 4,A SET 4,C -BIT 5,M RES 5,B SET 4,D -BIT 5,A RES 5,C SET 4,E -BIT 6,B RES 5,D SET 4,H -BIT 6,C RES 5,E SET 4,L -BIT 6,D RES 5,H SET 4,M -BIT 6,E RES 5,L SET 4,A -BIT 6,H RES 5,M SET 5,B -BIT 6,L RES 5,A SET 5,C -BIT 6,M RES 6,B SET 5,D -BIT 6,A RES 6,C SET 5,E -BIT 7,B RES 6,D SET 5,H -BIT 7,C RES 6,E SET 5,L -BIT 7,D RES 6,H SET 5,M -BIT 7,E RES 6,L SET 5,A -BIT 7,H RES 6,M SET 6,B -BIT 7,L RES 6,A SET 6,C -BIT 7,M RES 7,B SET 6,D -BIT 7,A RES 7,C SET 6,E -RES 0,B RES 7,D SET 6,H -RES 0,C RES 7,E SET 6,L -RES 0,D RES 7,H SET 6,M -RES 0,E RES 7,L SET 6,A -RES 0,H RES 7,M SET 7,B -RES 0,L RES 7,A SET 7,C -RES 0,M SET 0,B SET 7,D -RES 0,A SET 0,C SET 7,E -RES 1,B SET 0,D SET 7,H -RES 1,C SET 0,E SET 7,L -RES 1,D SET 0,H SET 7,M -RES 1,E SET 0,L SET 7,A -RES 1,H SET 0,M DADX B -RES 1,L SET 0,A DADX D -RES 1,M SET 1,B LXI X,06A4 -RES 1,A SET 1,C SIXD 06A4 -RES 2,B SET 1,D INX X -RES 2,C SET 1,E DADX X -RES 2,D SET 1,H LIXD 06A4 -RES 2,E SET 1,L DCX X -RES 2,H SET 1,M INR [X+05] -RES 2,L SET 1,A DCR [X+05] -RES 2,M SET 2,B MVI [X+05],20 -RES 2,A SET 2,C DADX SP -RES 3,B SET 2,D MOV B,[X+05] -RES 3,C SET 2,E MOV C,[X+05] - - -MOV D,[X+05] DSBC B DADY B -MOV E,[X+05] SBCD 06A4 DADY D -MOV H,[X+05] NEG LXI Y,06A4 -MOV L,[X+05] RETN SIYD 06A4 -MOV [X+05],B IM0 INX Y -MOV [X+05],C LDIA DADY Y -MOV [X+05],D INP C LIYD 06A4 -MOV [X+05],E OUTP C DCX Y -MOV [X+05],H DADC B INR [Y+05] -MOV [X+05],L LBCD 06A4 DCR [Y+05] -MOV [X+05],A RETI MVI [Y+05],2 -MOV A,[X+05] LDRA DADY SP -ADD [X+05] INP D MOV B,[Y+05] -ADC [X+05] OUTP D MOV C,[Y+05] -SUB [X+05] DSBC D MOV D,[Y+05] -SBB [X+05] SDED 06A4 MOV E,[Y+05] -ANA [X+05] IM1 MOV H,[Y+05] -XRA [X+05] LDAI MOV L,[Y+05] -ORA [X+05] INP E MOV [Y+05],B -CMP [X+05] OUTP E MOV [Y+05],C -POP X DADC D MOV [Y+05],D -XTIX LDED 06A4 MOV [Y+05],E -PUSH X IM2 MOV [Y+05],H -PCIX LDAR MOV [Y+05],L -SPIX INP H MOV [Y+05],A -RLCR [X+05] OUTP H MOV A,[Y+05] -RRCR [X+05] DSBC H ADD [Y+05] -RALR [X+05] shld 06A4 ADC [Y+05] -RARR [X+05] RRD SUB [Y+05] -SLAR [X+05] INP L SBB [Y+05] -SRAR [X+05] OUTP L ANA [Y+05] -SRLR [X+05] DADC H XRA [Y+05] -BIT 0,[X+05] lhld 06A4 ORA [Y+05] -BIT 1,[X+05] RLD CMP [Y+05] -BIT 2,[X+05] INP M POP Y -BIT 3,[X+05] OUTP M XTIY -BIT 4,[X+05] DSBC SP PUSH Y -BIT 5,[X+05] SSPD 06A4 PCIY -BIT 6,[X+05] INP A SPIY -BIT 7,[X+05] OUTP A RLCR [Y+05] -RES 0,[X+05] DADC SP RRCR [Y+05] -RES 1,[X+05] LSPD 06A4 RALR [Y+05] -RES 2,[X+05] LDI RARR [Y+05] -RES 3,[X+05] CCI SLAR [Y+05] -RES 4,[X+05] INI SRAR [Y+05] -RES 5,[X+05] OTI SRLR [Y+05] -RES 6,[X+05] LDD BIT 0,[Y+05] -RES 7,[X+05] CCD BIT 1,[Y+05] -SET 0,[X+05] IND BIT 2,[Y+05] -SET 1,[X+05] OTD BIT 3,[Y+05] -SET 2,[X+05] LDIR BIT 4,[Y+05] -SET 3,[X+05] CCIR BIT 5,[Y+05] -SET 4,[X+05] INIR BIT 6,[Y+05] -SET 5,[X+05] OTIR BIT 7,[Y+05] -SET 6,[X+05] LDDR RES 0,[Y+05] -SET 7,[X+05] CCDR RES 1,[Y+05] -INP B INDR RES 2,[Y+05] -OUTP B OTDR RES 3,[Y+05] - - -RES 4,[Y+05] SET 0,[Y+05] SET 4,[Y+05] -RES 5,[Y+05] SET 1,[Y+05] SET 5,[Y+05] -RES 6,[Y+05] SET 2,[Y+05] SET 6,[Y+05] -RES 7,[Y+05] SET 3,[Y+05] SET 7,[Y+05] - -; These are the result of disassembling 64180OPS.TRY -; These opcodes are available ONLY on the 64180 CPU -; DDTZ will both assemble and disassemble these. -IN0 B,20 TST E MLT B -OUT0 20,B IN0 H,20 MLT D -TST B OUT0 20,H TSTI 20 -IN0 C,20 TST H MLT H -OUT0 20,C IN0 L,20 TSIO 20 -TST C OUT0 20,L SLP -IN0 D,20 TST L MLT SP -OUT0 20,D TST M OTIM -TST D IN0 A,20 OTDM -IN0 E,20 OUT0 20,A OIMR -OUT0 20,E TST A ODMR - -; The following are UNDOCUMENTED z80 opcodes from XTDOPS.TRY. -; DDTZ will disassemble these, but will not assemble them. -; They use xh/xl (or yh/yl) as separate byte registers. -; Use these at your own risk. -INRX H ACXR H MOVY H,B -DCRX H ACXR L MOVY H,C -MVIX H,20 SUXR H MOVY H,D -INRX L SUXR L MOVY H,E -DCRX L SBXR H MOVY H,A -MVIX L,20 SBXR L MOVY L,B -MOVX B,H NDXR H MOVY L,C -MOVX B,L NDXR L MOVY L,D -MOVX C,H XRXR H MOVY L,E -MOVX C,L XRXR L MOVY L,A -MOVX D,H ORXR H MOVY A,H -MOVX D,L ORXR L MOVY A,L -MOVX E,H CPXR H ADYR H -MOVX E,L CPXR L ADYR L -MOVX H,B INRY H ACYR H -MOVX H,C DCRY H ACYR L -MOVX H,D MVIY H,20 SUYR H -MOVX H,E INRY L SUYR L -MOVX H,A DCRY L SBYR H -MOVX L,B MVIY L,20 SBYR L -MOVX L,C MOVY B,H NDYR H -MOVX L,D MOVY B,L NDYR L -MOVX L,E MOVY C,H XRYR H -MOVX L,A MOVY C,L XRYR L -MOVX A,H MOVY D,H ORYR H -MOVX A,L MOVY D,L ORYR L -ADXR H MOVY E,H CPYR H -ADXR L MOVY E,L CPYR L - - -Command Summary: -=============== - -DDTZM command DDTZ command -============= ============ -@ (base) -A)ssemble first_address A -B)egin {i.e., initialize stack and return} B -C)ompare first_address,last_address,against_address C -D)ump first_address[,last_address[,base]] D -E)nter_in_memory first_address[,base] S)ubstitute -F)ill first_address,last_address,value F -G)o_to [address][,trap1[,trap2]] G -H)ex_arithmetic value1(,value2) H -L)oad_file (offset) R)ead -M)ove first_address,last_address,destination M -N)nput FCBs_command_line I)nput -Q)uit (not avail) -R)egister examine/change [register|flag] X)amine -S)earch first_address,last_address,word W)hereis -T)race_execution [count] T - Untrace_execution [count] (i.e. do count instr) U)ntrace -U)nassemble_code first_address[,last_address] L)ist code -W)rite [first_address,last_address] K)eep -X)amine {i.e. display memory parameters for application} Q)uery -Y)our_option BC:=parm1,DE:=parm2,call_address Y -Z)80_register_display Z - - -If you find this program useful, contributions will be gratefully -accepted and will encourage further development and release of -useful CPM programs. My practice is to include source. - -C.B. Falconer -680 Hartford Turnpike, -Hamden, Conn. 06517 (203) 281-1438 - -DDTZ and its associated documentation and other files are -copyright (c) 1980-1988 by C.B. Falconer. They may be freely -copied and used for non-commercial purposes ONLY. - diff --git a/Source/Images/d_zsdos/u0/DIRX.COM b/Source/Images/d_zsdos/u0/DIRX.COM deleted file mode 100644 index 413bceca..00000000 Binary files a/Source/Images/d_zsdos/u0/DIRX.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/DSCONFIG.COM b/Source/Images/d_zsdos/u0/DSCONFIG.COM index b77dd008..d95229c4 100644 Binary files a/Source/Images/d_zsdos/u0/DSCONFIG.COM and b/Source/Images/d_zsdos/u0/DSCONFIG.COM differ diff --git a/Source/Images/d_zsdos/u0/DUMP.COM b/Source/Images/d_zsdos/u0/DUMP.COM deleted file mode 100644 index 03a77c3c..00000000 Binary files a/Source/Images/d_zsdos/u0/DUMP.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/ED.COM b/Source/Images/d_zsdos/u0/ED.COM deleted file mode 100644 index a0f0f541..00000000 Binary files a/Source/Images/d_zsdos/u0/ED.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/LBREXT.COM b/Source/Images/d_zsdos/u0/LBREXT.COM deleted file mode 100644 index c0c950e3..00000000 Binary files a/Source/Images/d_zsdos/u0/LBREXT.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/LIB.COM b/Source/Images/d_zsdos/u0/LIB.COM deleted file mode 100644 index 45d7fb21..00000000 Binary files a/Source/Images/d_zsdos/u0/LIB.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/LINK.COM b/Source/Images/d_zsdos/u0/LINK.COM deleted file mode 100644 index e188fb92..00000000 Binary files a/Source/Images/d_zsdos/u0/LINK.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/LOAD.COM b/Source/Images/d_zsdos/u0/LOAD.COM deleted file mode 100644 index b9601e00..00000000 Binary files a/Source/Images/d_zsdos/u0/LOAD.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/MAC.COM b/Source/Images/d_zsdos/u0/MAC.COM deleted file mode 100644 index f49e835a..00000000 Binary files a/Source/Images/d_zsdos/u0/MAC.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/MBASIC.COM b/Source/Images/d_zsdos/u0/MBASIC.COM deleted file mode 100644 index c9ec3cd3..00000000 Binary files a/Source/Images/d_zsdos/u0/MBASIC.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/PIP.COM b/Source/Images/d_zsdos/u0/PIP.COM deleted file mode 100644 index 4b2ce4b6..00000000 Binary files a/Source/Images/d_zsdos/u0/PIP.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/PMARC.COM b/Source/Images/d_zsdos/u0/PMARC.COM deleted file mode 100644 index 59bd3ef3..00000000 Binary files a/Source/Images/d_zsdos/u0/PMARC.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/PMEXT.COM b/Source/Images/d_zsdos/u0/PMEXT.COM deleted file mode 100644 index d3a51ca3..00000000 Binary files a/Source/Images/d_zsdos/u0/PMEXT.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/RMAC.COM b/Source/Images/d_zsdos/u0/RMAC.COM deleted file mode 100644 index 9ab7206b..00000000 Binary files a/Source/Images/d_zsdos/u0/RMAC.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/STAT.COM b/Source/Images/d_zsdos/u0/STAT.COM deleted file mode 100644 index 1de359f2..00000000 Binary files a/Source/Images/d_zsdos/u0/STAT.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/SUBMIT.COM b/Source/Images/d_zsdos/u0/SUBMIT.COM deleted file mode 100644 index f651bfee..00000000 Binary files a/Source/Images/d_zsdos/u0/SUBMIT.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/SUPERSUB.COM b/Source/Images/d_zsdos/u0/SUPERSUB.COM deleted file mode 100644 index a25d60a6..00000000 Binary files a/Source/Images/d_zsdos/u0/SUPERSUB.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/UNCR.COM b/Source/Images/d_zsdos/u0/UNCR.COM deleted file mode 100644 index 42385ddd..00000000 Binary files a/Source/Images/d_zsdos/u0/UNCR.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/UNZIP.COM b/Source/Images/d_zsdos/u0/UNZIP.COM deleted file mode 100644 index afde7204..00000000 Binary files a/Source/Images/d_zsdos/u0/UNZIP.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/XSUB.COM b/Source/Images/d_zsdos/u0/XSUB.COM deleted file mode 100644 index 15e86abf..00000000 Binary files a/Source/Images/d_zsdos/u0/XSUB.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/ZSID.COM b/Source/Images/d_zsdos/u0/ZSID.COM deleted file mode 100644 index 686b3775..00000000 Binary files a/Source/Images/d_zsdos/u0/ZSID.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/ZXD.CFG b/Source/Images/d_zsdos/u0/ZXD.CFG deleted file mode 100644 index f202ae59..00000000 Binary files a/Source/Images/d_zsdos/u0/ZXD.CFG and /dev/null differ diff --git a/Source/Images/d_zsdos/u0/ZXD.COM b/Source/Images/d_zsdos/u0/ZXD.COM deleted file mode 100644 index 20395673..00000000 Binary files a/Source/Images/d_zsdos/u0/ZXD.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u1/SAMPKEY.DOC b/Source/Images/d_zsdos/u1/SAMPKEY.DOC deleted file mode 100644 index 911c4a11..00000000 --- a/Source/Images/d_zsdos/u1/SAMPKEY.DOC +++ /dev/null @@ -1,134 +0,0 @@ -SAMPKEY.DOC: -Sample Macros for ZDE, 01 June 90 by Carson Wilson. - -This file describes the sample macros contained in SAMPKEY.ZDK -and SAMPKEY.ZDT. As distributed, ZDE contains no Macro Key -definitions. I have included the SAMPKEY.* files both to give -you an idea of the versatility available through ZDE's macro -capability and to provide you with some useful choresaving -routines. Many of the sample Macros come directly from the ZDE -Manual, and illustrate the use of conditional testing, jumps, and -control key entry from within Macros. In addition to being -educational, most of these "sample" Macros do useful work. While -you may (and should) define ZDE's Macros to do anything you wish -(or nothing, if you wish), I think you may find one or more of -these samples useful just as they are. - -To install the macros in SAMPKEY.ZDK (or any .ZDK file) into your -copy of ZDE, just type "ZDENSTAL ZDE SAMPKEY.ZDK." Then exit -ZDENSTAL with the ave option. This produces a working copy of -ZDE.COM with Macro Keys 0 to 9 as defined in the .ZDK file. - -To alter or replace the Macros in SAMPKEY.ZDK, first edit the -text file SAMPKEY.ZDT with ZDE. Then translate SAMPKEY.ZDT into -a new macro file with the command "ZDKCOM SAMPKEY.ZDT." You can -also translate .ZDK files back into .ZDT files if you wish; see -ZDKCOM.DOC for more information. - -The following briefly describes each of the Macros in the SAMPKEY -files: - - -MACRO 0 - SWAP CHARACTERS. - - Macro Text: - q^S^S^G^D^U^U^D^G - - Purpose: - Swaps the character behind the cursor with the previous - character. Useful for catching typos. - - -MACRO 1 - SOFTEN PARAGRAPH. - - Macro Text: - q^QS^X^[=^M]^S^V ^V^D^[![ - - Purpose: - "Softens" Hard Carriage Returns from the line the cursor - is on to the end of the paragraph. This allows - reformatting with ^B of files from other word - processors. - - -MACRO 2 - MOVE TO START OF SENTENCE. - - Macro Text: - q^[~.1^S^[1^[~.<^[2^D^[= 2^[=^M2 - - Purpose: - Moves the cursor to the beginning of the sentance the - cursor is currently on. - - -MACRO 3 - MOVE TO START OF PARAGRAPH. - - Macro Text: - q^QS^S^S^[= [^D^D - - Purpose: - Moves the cursor to the beginning of the paragraph the - cursor is currently on. - - -MACRO 4 - REFORM AND RETURN. - - Macro Text: - q^B^QP - - Purpose: - Reformat beginning with the line the cursor is on and - return cursor to current location. Useful when - revising text in the middle of a paragraph. - - -MACRO 5 - BROWSE FILE. - - Macro Text: - n^[;^C^[![ - - Purpose: - Move through file a screen at a time. Press ESC to - stop. - - -MACRO 6 - DELETE WORD LEFT. - - Macro Text: - n^A^T - - Purpose: - Erases the word to the left of the cursor. - - -MACRO 7 - UNDERLINE WORD RIGHT. - - Macro Text: - n^V^PS^F^PS - - Purpose: - Brackets the word to the right of the cursor with the - control code ^S, causing the word to be underlined when - printed (NOTE: printer must be installed). - - -MACRO 8 - SWAP LINES. - - Macro Text: - q^QS^KB^S^X^KK^S^E^E^KV - - Purpose: - Swaps the current line with the previous line, moving - the cursor with it. Can be used to move a single line - up any distance within your file. - - -MACRO 9 - HELP MESSAGE. - - Macro Text: n^QE^QS^N^N0=SwCh 1=Soft 2=SentBg 3=ParaBg - 4=Reform 5=Browse 6=DelLft 7=Undl 8=SwLn 9=Hlp - ^[;^[;^[;^Y^Y^QP - - Purpose: - Briefly displays help message at top of screen. - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/SAMPKEY.ZDK b/Source/Images/d_zsdos/u1/SAMPKEY.ZDK deleted file mode 100644 index 9bb5971f..00000000 Binary files a/Source/Images/d_zsdos/u1/SAMPKEY.ZDK and /dev/null differ diff --git a/Source/Images/d_zsdos/u1/SAMPKEY.ZDT b/Source/Images/d_zsdos/u1/SAMPKEY.ZDT deleted file mode 100644 index d41b3db3..00000000 --- a/Source/Images/d_zsdos/u1/SAMPKEY.ZDT +++ /dev/null @@ -1,11 +0,0 @@ -q^S^S^G^D^U^U^D^G -q^QS^X^[=^M]^S^V ^V^D^[![ -q^[~.1^S^[1^[~.<^[2^D^[= 2^[=^M2 -q^QS^S^S^[= [^D^D -q^B^QP -n^[;^C^[![ -n^A^T -n^V^PS^F^PS -q^QS^KB^S^X^KK^S^E^E^KV -n^QE^QS^N^N0=SwCh 1=Soft 2=SentBg 3=ParaBg 4=Reform 5=Browse 6=DelLft 7=Undl 8=SwLn 9=Hlp ^[;^[;^[;^Y^Y^QP - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDE10.DOC b/Source/Images/d_zsdos/u1/ZDE10.DOC deleted file mode 100644 index 83ce8cc9..00000000 --- a/Source/Images/d_zsdos/u1/ZDE10.DOC +++ /dev/null @@ -1,1049 +0,0 @@ -..You must print this file in "W" mode with page length set to 54 -..(the default) so that page numbers correspond with the Table of -..Contents and the Index. Use the "L" option for a left margin -..("L8" centers standard pitch on 8.5" wide paper), and the "" -..option to number pages. - - ZDE - - Z-System Display Editor - - Version 1.0 10 Mar 89 - - ZDE and its documentation are copyright 1989 by Carson Wilson, - all rights reserved. They may not be circulated in any - incomplete or modified form without written permission of the - author. Any commercial use of ZDE, defined as any situation - where the duplicator receives revenue by duplicating or - distributing ZDE by itself or in conjunction with any hardware - or software product, is expressly prohibited unless authorized - in writing by Carson Wilson. - - -1. Introduction. - - ZDE, the Z-System Display Editor, is a small, fast, powerful -text editor based Eric Meyer's famous Video Display Editor (VDE). -ZDE retains all features of VDE, but removes defects and supports -special ZCPR and ZSDOS features such as named directories, -register variables, automatic disk relog, and file datestamp -support. The install program has also been improved (see -ZDE10.NEW for a complete rundown of improvements). At the same -time, I have tried to be conscientious about the balance between -features and memory usage. If I added every new feature or -convenience that came to mind, we would soon have a luxurious -in-memory editor for 2 kilobyte files! Much of the following is -adapted with permission from Eric Meyer's VDE.DOC. - - ZDE's native ASCII mode and definable macros make it an ideal -programmer's editor; its full formatting and printing features -also make it an efficient word processor. Written entirely in Z80 -assembler, ZDE is F-A-S-T. There are no disk overlays, and all -editing is done in memory. As a result, finding a string near the -end of a 50K file takes WordStar 3.3 about 14 seconds (8MHz Z80); -ZDE does it in under a second. This is like moving through air -instead of molasses: you will find that you can do more of your -work on screen, and less on paper. - -Among ZDE's features are: - -Full-screen editing User area and named directory support -Block operations Wordwrap and reformat -File datestamp support Macro programs -Disk file operations Margins, tabs, spacing -Find and replace WordStar compatibility -Many print features Undeletion -Configurable options Support for all CP/M terminals - - -2. Installing ZDE. - - ZDE works with Z80 CP/M 2.2 and 3.0 and compatible systems. -It is ideal for portable computers with limited disk space. There -are many user configurable options, and ZDE can be installed for -all CP/M terminals. If you are running ZCPR, ZSDOS or Z3PLUS, ZDE -offers features not available with less advanced system software, -but these system enhancements are not required. - - To install ZDE, use the ZDENSTAL configuration program; see -the accompanying file ZDENSTAL.DOC. You should install ZDE for -your computer's terminal at the earliest convenience, since this -greatly enhances performance. There are many other installable -options; you will discover how you want everything set in the -course of using ZDE, so don't worry about going through all of it -at first. For ease of reference, portions of this manual -referring to installable options and settings are enclosed in -square brackets ("[" and "]"). - - -3. Invoking ZDE. - - ZDE is invoked from your system's command prompt using the -following syntax ("ufn" means "unambiguous file name"): - - ZDE Begin working on a new file. - - ZDE ufn Edit a new or already existing file. - - ZDE dir:ufn Edit a new or existing file from another - directory. - - ZDE ufn m Edit a file using mode "m." - ZDE ufn[m - -"m" above can be either W, A, or N (see File Modes, below), and -"dir" can be either a drive, a user area, a drive followed by a -user area, or a ZCPR named directory. For example: - - ZDE A4:MYFILE.TXT N Begin working on MYFILE.TXT at user - area 4, drive A, in non-document - mode. - - The size of the file to be edited is limited by available -memory. This will vary for different systems, but normally the -maximum size will be between 45 and 55k. If a file is too large -to edit, you must break it up and edit the pieces separately. -Numerous CP/M utilities are available which will break up and -rejoin ASCII files. - - -4. ZDE's Command Set. - - ZDE's commands consist of simple one- or two-key -combinations, easily found by the touch typist without -distraction. Most commands are the same as WordStar's. If you -have questions that this file can't answer, a WordStar manual may -be a useful reference. But ZDE is not a WordStar "clone"; there -are significant differences, including an extended set of -ESC-commands for functions such as macros (see below). - Virtually complete compatibility with the WordStar command -(sub)set can be achieved UNLESS the keys ^J, ^K, and ^L are used -as arrow keys (as on many CP/M computers). In this event ZDE -synonyms must be used: ESC- for the ^K- prefix; ESC-H for ^J; and -^\ for ^L (see ZDENSTAL.DOC for terminal installation). - -4.1. Command Summary. - - Below, the "^" character indicates use of the Ctrl key: ^K = -Ctrl+K. The ESC (^K), ^O, and ^Q prefixes require pressing two -keys in sequence: ^O C, for instance means press ^O, then C (or -^C). Any prefix may be canceled by typing ESC or Space. - -4.1.1. Control Keys: Single Keystroke Commands. - - ^J (ESC H) = display Help menus. - - CR = Carriage return (^M). Marks a paragraph end. - BS = Backspace (^H). - TAB = Hard Tab mode: insert tab (^I). Variable Tab mode: move - to next stop. - - Arrow keys: WordStar: ^E up, ^X down, ^S left, ^D right. - Alternate: configurable, default ^K, ^J, ^H, ^L. - - ^F = move to start of next word right. - ^A = move to start of next word left. - ^R = scroll back one screen. - ^C = scroll forward one screen. - ^W = scroll back one line. - ^Z = scroll forward one line. - - ^G = delete character to the right of the cursor. - DEL = delete character to the left (configurable). - ^U = undelete a character. - ^T = delete word to right of cursor. - ^Y = delete current line. - - ^N = insert a carriage return (break line) at present - position. - ^V = toggle INSERT mode on and off. - ^^ = toggle case (upper/lower) of character at cursor. - ^P = insert following control code in text. - ^B = reformat current paragraph. - ^L (^\) = repeat find/replace (repeats last ^QF or ^QA - command). - -4.1.2. File and Block Commands: first hit ^K (or ESC), then the - key shown. - - ^K I = display file/memory Information message. - - ^K F = List files in disk directory. - ^K E = Erase a disk file. - - ^K L = Load a brand new file to begin editing. - ^K N = change the current file Name (affects Save, eXit). - ^K S = Save the current file to disk, and continue editing. - ^K D = Done. Save the file, then load a new one. - ^K X = eXit: Save the file, then Quit to CP/M. - ^K Q = Quit to CP/M, abandoning current file. - - ^K R = Read a disk file into text at cursor position. - ^K P = Print the text (whole file or block). - - ^K B = mark the start of a Block. - ^K K = mark the end of a block. - ^K U = Unmark the block. - ^K Y = Delete the marked block. - ^K C = Copy the block text at present cursor position. - ^K V = moVe the block text to the present cursor position. - ^K W = Write the marked block to a disk file. - -4.1.3. Escape and Macro Commands: first hit ESC, then the key - shown. - - ESC arrows: Left/Right (including ^S/D) = shift screen - horizontally - by 32 columns. - Up/Down (including ^E/X) = shift screen - vertically - by 1/4 screen. - ESC TAB = move back to last tab stop. - - ESC M = execute a Macro string of commands. - ESC # = store macro on numeric key for later recall. - ESC 0..9 = use stored key. (In macro mode: jump label.) - ESC !,=,~,+ = used in Macro programming (see below). - ESC ; = brief pause, during Macro execution only. - -4.1.4. Quick Commands: first hit ^Q, then the key shown. - - ^Q Arrows: Left/Right (including ^S/D) = go to start or end - of line. - Up/Down (including ^E/X) = go to top or bottom - of screen. - ^Q R = move to top of file. - ^Q C = move to end of file. - ^Q I = move to specified page or line number. - ^Q B = move to marked block. - ^Q Q = move to next line in queue (ZCPR only). - ^Q Z = move to next place marker. - - ^Q F = find next occurrence of a string. - ^Q A = find and replace a string. - - ^Q Y = delete from cursor to end of current line. - ^Q DEL = delete from cursor to beginning of current line. - ^Q T = delete until specified character (caution--powerful!). - ^Q U = undelete a line. - -4.1.5. Onscreen Commands: first hit ^O, then the key shown. - - ^O Arrow: Up (including ^E) = make current line top of - screen. - - ^O R = set right margin (column 1 turns off - wordwrap/formatting). - ^O L = set left margin. - ^O X = toggle Margin Release on/off. - ^O C = center current line. - ^O F = align current line flush with the right margin. - - ^O Q = toggle header on/off. - ^O T = toggle ruler line on/off. - ^O D = toggle display of hard CRs on/off. - - ^O A = toggle Auto Indent on/off. - ^O S = toggle Double Spacing on/off. - ^O H = toggle hyphenation on/off. - ^O V = toggle tab mode Hard/Variable. - ^O I = set variable tab stop. - ^O N = clear variable tab stop. - - ^O P = set page length (0 turns off pagination). - ^O W = toggle windowing on/off (see below). - ^O Z = temporarily blank the entire screen. - - -5. Command Descriptions. - -5.1. Auto-Indent Mode (^O-A). - - Auto-Indent is useful for typing outlines, structured program -source code, and other text where the "left margin" varies. -Auto-Indent causes the RETURN key to act differently: If you are -entering new text, it will be indented to match the previous line. -If you are just moving through the file, the cursor advances past -any existing indentation. - -5.2. Block Commands (^K-B, -K, -U, -R, -Y, -W, -C, -V, -P-B, - ^Q-B). - - A "block" of text is normally delimited by two markers -[default: ^@] which remain in memory until reset or deleted. - ^K-B marks the beginning of the block; ^K-K marks its end. -Markers are inserted in the text. The two markers are identical; -the first one present is the start. - ^K-U unmarks the block, removing any marker(s) set (block -markers can also be deleted individually as ordinary characters). -Markers are automatically removed as appropriate when ^K-B/-K are -used again. - ^K-R reads in the contents of a disk file, inserting it as a -block after the current cursor position. You will be asked for -the name (and, optionally, mode) of the file. Other block -operation commands all require a Block to be marked: - ^K-Y deletes the block (including markers). - ^K-W writes the block text to a disk file; you will be asked -for the filename (and optional mode). - ^K-V moves the Block text to the present cursor location, -deleting the original; ^K-C copies it and leaves the original. -Sometimes ZDE will run out of memory when moving blocks within a -large file. If this occurs, just write the block to a file, -delete it, and read it back in as: "^K-W, ^K-Y, ^K-R". - ^K-P-B (^K-P with B option) prints the block text only. - The ^Q-B command, from wherever you are in the file, moves -the cursor to the Block start. - -5.3. Cursor Movement (Arrow keys; ^F; ^A; ^Q-R, -C, -I). - - ZDE supports three sets of Arrow keys, which function -interchangeably. The two built-in sets support the WordStar -"arrow key diamond" ^E, ^X, ^D, ^S, and the ANSI standard 3-byte -sequences (ESC-[-A, etc.). The third set is user-configurable, -and must be installed with ZDENSTAL. These keys move the cursor -up, down, right, and left respectively. Note: if you install ^J, -^K, and ^L as arrow keys, you must use ESC- commands for help, -file operations, and repeat find/replace, respectively. - Preceded by ^Q-, any arrow key (except ANSI) moves more -quickly: to the top or bottom of the screen, to the left or right -end of the line. - There are also two word movement commands: ^F moves right, to -the start of the next word; ^A moves left, to the start of the -previous (or current) word. Both have maximum ranges of 255 -characters. - For quickly covering large distances, the commands ^Q-R and -^Q-C go all the way to the beginning and end of the file, -respectively, and ^Q-I goes to any specified page (or line, in -non-documents). - -5.4. Deleting (^G, DEL, ^T, ^Y, ^Q-Y, -DEL, -T). - - You can delete text one CHARACTER at a time: ^G deletes to -the right of the cursor, and DEL to the left. [If you have no DEL -key, you can install another equivalent.] Note that the ordinary -BS (^H) does not normally delete. - ^T deletes an entire WORD to the right (up to 255 characters) - ^Y deletes the entire current LINE. ^Q-Y deletes only the -part of the line to the right of the cursor; ^Q-DEL deletes the -part to the left. - ^Q-T deletes UP TO a specified character. Example: "^Q-T." -deletes to the end of the sentence. Special case: "^Q-T-CR" -deletes to the next HARD CR, the end of the paragraph. This is a -powerful command, so use it with caution. - Accidentally deleted text can usually be recovered (see -Undelete, below). - -5.5. Disk Operations (^K-F, -E). - - ^K-F gives an unsorted list of disk FILES: hit CR to list the -directory specified by the current file, or specify a drive, user, -or named directory (colon optional). If there is not enough room -to fit all the files on the screen, you will see "..." at the end -to indicate that there were still more. Press ESC or Space to -continue. - ^K-E will ERASE a single disk file to provide more room on -the disk (no wildcards allowed). - -5.6. File Commands (^K-N, -S, -X, -Q, -D, -L). - - ^K-N NAMES your work or changes the current file mode. You -can change the filename in the header before saving, and/or change -its mode to WordStar, ASCII, or Nondocument. To set the file -mode, introduce the mode character with the left square bracket, -e.g., "Name: MYFILE.WS [W". - ^K-S SAVES your work: what's in memory is written to disk -under the file name in the header (you must have a file name; one -will be requested if necessary). If that file already existed, a -backup (.BAK) file may be preserved [configurable; see -installation guide]. If you haven't changed the file, ZDE prompts -you to confirm that you want to resave it anyway. - There are several different commands for finishing up: - ^K-X saves your work and then EXITS to CP/M. - ^K-Q just QUITS. If the file has been modified, ZDE asks if -you want to abandon the changes. - ^K-D (DONE) saves your work, then loads a new file to edit. - ^K-L quits the current file and LOADS a new one to begin -editing. - -5.7. Find, Replace (^Q-F, -A, ^L, ^\). - - ^Q-F is the command to FIND a string. The search normally -proceeds from the cursor position forward, and is case -(upper/lower) insensitive. There are two options: "B" = search -backwards; "C" = case sensitive search. If used, the options -must be enclosed in slashes (eg, "/bc/") before the search string. -(If you want to search for a string beginning with a slash, use an -empty (//) option first.) In addition, a ^P-Z [this can be -reconfigured] functions as a wildcard matching any single -character. Other control codes, like ^M for newline, can be -included (with the ^P prefix where needed). Examples: - - Find: /c/^MLABEL matches "LABEL" at start of line only; - Find: 4^Z^Z01 matches "42201", "47401", etc; - Find: wordstar matches "WORDSTAR", "WordStar" etc; - Find: ///88 matches "/88"; - Find: /b/esc looks backwards for "Esc", "esc", etc. - - ^Q-A is the FIND/REPLACE command. It asks for a string to -find, and what to change it to (all options above apply to the -search string only). The cursor will be placed on each occurrence -of the string successively, starting at the cursor location. You -will see the prompt "Chg?" in the header. To replace the old -string with the new one, press "Y"; anything else skips to the -next. To change all further occurrences without being asked, -press "*". ESC cancels at any time. (Note: if ^Q-A is used in a -Macro, it will automatically assume "*" with no further input -required.) - ^L (or ^\, if ^L is an arrow key) repeats the last ^Q-F or -^Q-A command. For ^Q-A, you will be asked whether you want to -replace the found string. For both, direction and case options -remain unchanged. - -5.8. Header (^O-Q). - - ZDE normally gives you a header, or status line, at the top -of the screen. However, if you like you can toggle the header -display on and off with the ^O-Q (QUIET) command. [The header may -also be suppressed by default.] This lets you see more file text. -It can also speed up operation on some slower terminals, as the -position doesn't have to be continually updated. - - A typical header line looks something like: ------------------------------------------------------------------- -B0/WORK:ZDE.DOC [A Pg 8 Ln 31 Cl 53 INS vt hy AI DS MR ^Q_ ------------------------------------------------------------------- - "B0/WORK:ZDE.DOC [A" = Current directory, filename, and mode. - "Pg 8, etc" = Current position in file by page, line, column. -For "N"ondocuments, there is no page number display. If -pagination (^O-P) is off, you will see "Pg 0" (document) or "OP" -(nondocument) here. - "INS" = Insert mode on (^V). - "vt" = Variable tabs on (^O-V). - "hy" = Hyphenation enabled. (^O-H) Doesn't display in "N" - mode. - "AI" = Auto indent mode on (^O-A). - "DS" = Double spacing (^O-S). - "MR" = Margins released (^O-X). Doesn't display in "N" mode. - "^Q_": Prefix keys (and some prompts) display here. - -5.9. Information (^K-I). - - ^KI displays an Information message with: - - - the ZDE version and date; - - whether (Y/N) the file has been changed since last saved; - - the current size of the file in bytes; - - the number of bytes of text memory used and free (1024 - bytes = 1K). - - You will note that the file uses about 20-25% less memory -than its actual length; this is due to ZDE's compression of text. -(Note: ZDE is limited to 16-bit arithmetic. In the unlikely event -that file size should exceed 64K it will be shown mod 64K; just -add 65536.) - Block moves and copying are limited by the amount of free -memory. Further, when there is less than 1K free, response time -can get very slow. - -5.10. Insert Mode (^V). - - ^V toggles insertion on and off. If insert is OFF, any text -to the right of the cursor is overwritten as you type. If insert -is ON, what you type is inserted, and existing text moves to the -right. - -5.11. Line Spacing (^O-S). - - The ^O-S command toggles between single and double line -spacing. In double space mode, the following functions generate -double carriage returns: CR (^M), Insert CR (^N), Reform (^B), -Wordwrap. You can easily mix single and double spacing; the ^B -command can convert between the two. Note: if you prefer to keep -your actual file single spaced, you can still get a double-spaced -printout by using the "D" option of the ^K-P command (see -Printing). - -5.12. Margins (^O-R, -L, -X, -C, -F). - - ^O-R sets the RIGHT margin, enabling wordwrap, reformatting, -and centering. A right margin of 1 disables all formatting -functions (same as in "N"ondocument mode). At the prompt -"Column:" enter the column number (1-255), or just hit CR for the -current cursor column. If the value entered conflicts with the -current left margin, ZDE sets the left margin to 1. - ^O-L sets the LEFT margin in an identical fashion; of course, -the value must always be less than the current right margin, -meaning it's best to set the right margin first. - ^O-X temporarily RELEASES the margins (resets them to 1), -allowing you to type outside them. Use ^O-X again to restore the -margins. - ^O-C CENTERS the current line with respect to the margins, if -set. ^O-F sets the current line FLUSH right, if the right margin -is set. - -5.13. Pagination (^O-P). - - The ^O-P command sets the page length. Enter a value from 0 -to 255, or just hit CR to restore the default value [normally 54]. - When the value is nonzero, it determines the page and line -shown in the document header ("Pg xx Ln xx"), and page-oriented -Print functions (formfeeds, headers, start/stop print) are enabled. - When the value is zero, pagination is off. The header will -say "Pg 0 Ln xxxx", showing you the absolute line number in the -file. Also, printing occurs with no page breaks or formfeeds. -This can be useful for printing small things right after each -other on the same sheet; or, in conjunction with the "*" print -option, can be used to print out multiple copies of index cards, -labels, etc. - ZDE never sends a formfeed before printing; begin your file -with a ^P-L character if you need one. Otherwise, use of ^P-L is -not recommended in document files as it renders ZDE's page count -inaccurate. - -5.14. Place Markers and Line Queue (^P-Z, ^Q-Z, ^Q-Q). - - You can set any number of temporary PLACE MARKERS in the text -with ^P-Z (they will appear as ^Z). The ^Q-Z command moves the -cursor to the next place marker in the file, cycling back to the -top of the file if needed. Place markers are NOT saved to disk. - ZCPR users may also store a QUEUE of up to eight line numbers -in their user-defined messages (a set of sixteen bytes of -protected memory "available for user definition"). The ^Q-Q -command will then cycle through the queue of line numbers, -returning to the first location when it reaches a value of zero. -A value greater than the number of lines in the file takes the -cursor to the end of the file. The numbers are stored as two-byte -inverted hexadecimal words. This facility is intended as an -interface between other programs and ZDE for such purposes as -storing the locations of compiler errors, however ZCPR users may -also find it useful to POKE these locations directly before -invoking ZDE. - -5.15. Printer Codes (^P). - - Control codes for special effects in printing can be entered -in the text with the ^P prefix. Thus pressing ^P-^H (or ^P-H) -embeds a ^H, etc. Several standard codes are: - - ^H - backspace - overstrike previous character - ^I - hard (ASCII) tab - printers respond variously to this - ^L - formfeed (Not recommended unless pagination (^O-P) - disabled) - - The Block marker, normally ^@, cannot be embedded, and ^Z is -reserved for use as a place marker. Control codes display on -screen as capital letters, highlighted if possible. ZDE assumes -they are not characters, so they are not counted when reformatting -text. - For greater convenience, you can also arrange to have a -single ^P-code produce an entire string of bytes for commonly used -printing effects. ZDE supports a subset of WordStar's printer -installation, seven definable codes: four toggles, four switches. -The Printer Installation in ZDENSTAL allows you to choose what -codes you want to use, and install the actual control sequences -your printer needs. The defaults are: - - toggles: ^B, ^D, ^S, ^Y - switches: ^Q, ^W, ^E, ^R - - In WordStar these toggles are Boldface, Doublestrike, -Underline, and Ribbon/Italic respectively, but you can make them -anything you like. "Toggles" are good for features like underline -and bold that are turned on and off. "Switches" are better for -multivalued parameters like character pitch. - Example: your printer uses ESC-U-01 (and 00) to turn -underlining on (and off). If you install these codes with -ZDENSTAL: - ^S toggle on: (03)1B5501 - ...and off: (03)1B5500 - -then all you have to type in ZDE to get underlined text is: -^PSunderlined text^PS. - -5.16. Printing (^K-P). - - The ^K-P command PRINTS all or part of the file in memory. -You will be asked for a set of "Options:", at which point you may -enter zero or more of the following, in any order: - - B prints only the currently marked BLOCK. - P PAUSES for your keystroke before each page (sheet - feed). - D DOUBLE SPACES all text to be printed. - Lnn sets the printer LEFT MARGIN to nn columns [the - default value can be set with ZDENSTAL]. - ^ FILTERS control characters ^X to text "^X". - *nn prints the job out nn TIMES (nn=1..255). - @nn begins printing AT the nn'th page. - =nn renumbers the pages beginning with nn. - #nn prints only (up to) a TOTAL of nn pages. - "..." uses the quoted string as a HEADER. The string, - followed immediately by the page number, will print - at the top right of each page near the margin (maxi- - mum length is 50 characters; an empty string, "", - gives numbered pages with no header text.) - -The last four options (@,=,#,"") are NOT allowed if pagination is -disabled (^O-P), or if "B"lock print was chosen. Examples: - -Options: L12P - - Print the file with a left margin of 12 columns, pausing - before each page for you to press a key (other than Esc). - -Options: @6#2=14"Instructions, page " - - Print the sixth and seventh pages of the file, but numbered - 14 and 15, with the header shown. - -Options: BD^*2 - - Print out the current marked Block twice, double spaced, - with control filtering. - - In "W" mode, lines beginning with a "." will be regarded as -WordStar dot commands, and will neither print out nor affect the -page count (they have no other effect either). - You can abort printing at any time with ESC (this may take a -moment, or a few keystrokes, depending on your BIOS). - -5.17. Ruler Line (^O-T). - - To help you align text properly, ^O-T toggles display of a -"ruler line" above the text on and off. - In each column you will see one of several symbols: "[]" -designate the current margins (if set); "-" indicates areas within -the current margins, "." outside them. Also, tab stops are marked -by either "T" (Variable) or "I" (Hard). Examples: - -("A" mode) [-----T-----T-----------T--------------]........ -("N" mode) I.......I.......I.......I.......I.......I....... - -5.18. Tabs (^I, ESC-TAB, ^O-V, ^O-I, ^O-N). - - There are two Tab modes: Variable and Hard, and the ^O-V -command toggles between them. In Hard Tab mode the Tab key -produces an actual ^I (ASCII 09); whether this overwrites any -existing text depends on the Insert toggle. Hard Tabs display by -default at fixed intervals of 8 screen columns [this is -configurable to any multiple of 2]. - In Variable Tab mode, the Tab key moves the cursor to the -next variable tab stop (you can always get a Hard Tab by typing -^P-I). If Insert is on, spaces are inserted up to the next tab -stop. Otherwise, existing text is skipped over, but spaces are -still added at the end of a line as needed. Up to eight tab stops -may be set with ^O-I and cleared with ^O-N; the defaults are in -columns 6, 11, 16, and 21 [these are configurable]. At the -prompt, enter the column number desired, or hit RETURN for the -cursor column. - The ^O-I command also accepts two multiple-set inputs: "@nn" -sets tab stops every "nn" columns, while "#n1,n2,..." sets tabs at -columns "n1,n2, ...". Both remove any pre-existing tabs, and -typing "@" or "#" alone simply clears all tabs. - The ESC-TAB command moves backward (left) to the previous -variable or hard tab stop. - -5.19. Undelete (^U, ^Q-U). - - The undelete functions may be used (repeatedly if necessary) -to recover a reasonable amount of text deleted either by -overtyping, or with any of ZDE's delete commands, IF the cursor -has not yet been moved away. ^U undeletes one character; ^Q-U -does a whole line. - Restrictions: undelete may not recover all of a Block delete -unless the cursor was in or near the block deleted, and it may -work imperfectly if DEL has been used several times in sequence. - Further use after all deleted text is recovered will produce -junk (usually duplicates of text above the cursor, which is -sometimes useful). - -5.20. Upper/Lower Case (^^). - - The ^^ (ctl-caret) command changes the case of the character -at the cursor, if it was a letter, and moves the cursor one -character to the right. Useful for capitalizing a string of -lowercase text, or vice versa. - -5.21. Window and Screen (^W, ^Z, ESC-Arrows, ^O-Up, -W, -Z). - - ZDE supports several functions to move and alter the display -screen. - The ^W and ^Z commands scroll the screen up and down a line -at a time, without moving the cursor (unless necessary). - Preceded by ESC, any arrow (except ANSI) moves the screen -rather than the cursor: the text as a whole shifts up/down 1/4 -screen, or right/left 32 columns, while the cursor stays put (the -cursor must be past column 32 for horizontal shifts to work). - Preceded by ^O-, any UP arrow key (except ANSI) makes the -current text line the top of the screen. - The ^O-W command creates a WINDOW in the bottom half of the -screen, which retains a copy of the file text starting at the -current line, plus the current status and/or ruler line(s), if -any. Editing continues normally in the top half of the screen. -This is useful for comparing different sections of text within a -file, or even between different files. Typing ^O-W again removes -the Window. Note: Windowing is only supported for screens of 15 -or more lines. - The ^O-Z command temporarily zaps (blanks) the entire screen; -good for avoiding CRT burn-in, or just protecting work from prying -eyes or fingers. Restore the screen by pressing ESC or SPACE. -Note: if Windowing was in effect, any text in the window will be -lost. - -5.22. Wordwrap, Reformat (^B, ^O-D). - - WORDWRAP is automatic in Document ("W" or "A") modes whenever -the right margin is set. Any text entered will be formatted to -the current margin settings as you type. The end of a paragraph -is marked by a "HARD CR", which occurs when you press the RETURN -key (this is a CR immediately following a character of text). In -contrast, when wordwrap occurs you get a "SOFT CR" (which is -actually a CR with a space before it). You can change a hard CR -into a soft one, or vice versa, by deleting or adding a space at -the end of the line. Hitting RETURN also hardens a soft CR. The -distinction between hard and soft CRs is only important when -reformatting. - ^B REFORMATS from the line the cursor is on, to the end of -the paragraph, according to the current margin settings and line -spacing. ^B may be used not only to reshape a paragraph after -editing, but also to change its margins and line spacing. -Indentation can be tricky if you have a left margin set. If the -current line is indented relative to the next one, ZDE assumes -that amount as your paragraph indentation. - ^O-D toggles DISPLAY OF HARD CRs. Hard CRs, otherwise -invisible, can be caused to display as a "<" character. This can -be useful; some may find it distracting, so it turns off. - - -6. Macros. - -6.1. Macro (ESC-M). - - A MACRO is a string of ZDE commands and text that, once -defined, can be repeated automatically. When you type ESC-M you -will be asked for the string, then a "Repeat count". Usually you -will simply type a number for the repeat count (0-9, or "*" for -"indefinitely"). You will see the results as the macro executes, -and you can abort it at any time by pressing ESC. If you are sure -you know what you're doing, you can speed up Macro execution by -specifying "Quiet" mode: press "Q" before the repeat count. Only -the header, if present, will be updated as the Macro runs. - Macros also stop any time an error occurs; the error message -will be visible, and can be cleared by pressing ESC. Many -commands (like Find or Reformat) are designed to generate errors -at the end of the file so that indefinite ("*") Macros containing -them halt there. You may need to abort other indefinite Macros -manually. - ZDE turns INSERT OFF before running a macro, so that the same -key sequence will always have the same effect. INSERT status is -restored when the macro terminates. - In order to include any input line editing characters (BS, -CR, etc.) in a macro, you must prefix them with ^P. (NOTE: To -make them easier to read and understand, Macro listings are given -here as they function, not as they are typed in. ^P prefixes as -needed are NOT shown. Keystrokes are separated by dashes or -commas for clarity, and "_" means a space or blank.) Here are some -sample Macros: - - 1. View a file by scrolling slowly through it: - - ESC-;, ^C - - This will pause, then scroll down. (Use a repeat count - of "*".) - - 2. Can you figure out what this one does? - - ^QR, ^QF, (, CR, ^G, ^KB, ^QF, ), CR, ^G, ^KK, ^QC, CR, ^KV - - (Answer: .elif eht fo dne eht ta meht fo tsil a gnikam - elif a fo tuo sesehtnerap ni stnemmoc ekat lliw tI) - - ZDE Macros are very powerful tools, particularly given their -programmability and storage on function keys. - -6.2. Macro Key (ESC-#, ESC-0..9). - - Up to 10 MACRO KEYS can be stored (0..9), by entering them -with the ESC-M command, then using ESC-# to save them. They can -then be recalled and used simply by typing ESC-number. Example: -typing ESC-#-0 will store the last Macro used in the ESC-0 command -so that it can be recalled and reused at any future time simply by -typing ESC-0. - Ordinarily, Macro Keys operate just like the original Macro, -asking for a "Repeat count" when executed. If you want to -suppress this prompt (resulting in a "function key" that executes -just once) you can type "N" (for No repeat) before storing the key -number. Example: ESC-#-N-0 makes ESC-0 a no-repeat macro key. -If you also don't need to see the Macro work, and want to make it -faster, you can make it QUIET as well by typing "Q" instead (for -Quiet) before the key number. Example: ESC-#-Q-0 stores ESC-0 as -a quiet no-repeat key sequence. - If the Macro (ESC-M) string is empty, using ESC-# will delete -a Macro Key. Using a defined Key makes it the last macro used, so -it can be stored again in another key if desired. Trying to use -an undefined Macro Key results in an error. - There are 500 bytes total available for all 10 keys, and a -128 byte limit for any one Key (ZDE's own input line will only -accept 65 bytes, but ZDENSTAL can handle up to the full 128.) - USAGE HINT: If you want to re-use a macro without having to -type it in again, use ESC-# to assign it to a key, then call it up -by number. - Besides simply storing Macros, here are some useful Macro -Keys: - - 1. Storing different sets of margins (e.g., for quotes). - For example, - ^OL, 12, CR, ^OR, 66, CR - - 2. Typing any frequently repeated phrase; "ESC-6" is much - more convenient than "^PSWorld Wide Widgets Ltd. (N.A.)^PS". - - 3. Swap the two characters preceding the cursor: - ^S, ^S, ^G, ^D, ^U, ^U, ^D, ^G - -[ZDENSTAL allows you to install defaults for all ten Macro Keys. -Thus a copy of ZDE can be customized for any task, such as the -formatting requirements of specialized writing or programming -languages.] - -6.3. Macro Programming (ESC-0..9, ESC-!,=,~,+,;). - - ZDE has several commands which function only in a Macro -string, and give you control over the execution of a macro, -allowing true programming. - ESC-0..9 function as LABELS 0..9 when entered as part of a -Macro. They have no effect, but can be "jumped" to by other -commands. - ESC-! followed by 0..9 is a JUMP instruction, and causes -macro execution to resume with the command following the label -ESC-0..9. Example: ESC!2 jumps to label 2. As two special cases, -ESC-![ jumps to the beginning of the Macro, and ESC-!] jumps to -the end (aborts). - ESC-= and ESC-~, followed by a character and then a label -0..9 (or "[","]"), are CONDITIONAL JUMPS: they jump to the label -or the start or end of the macro IF the character at the cursor -position matches (ESC-=) or doesn't match (ESC-~) the character -specified. Example: ESC~^M2 jumps to ESC-2 if the current -character is NOT a CR. - ESC-= and ESC-~, followed by a character and then ">" or "<", -are SEARCH LOOPS. They will continue to move the cursor right -(">") or left ("<") AS LONG AS the character at the cursor matches -(ESC-=) or doesn't match (ESC-~) the specified character. Both -search loops terminate automatically at the beginning or end of -the file. Example: ESC=_> moves right as long as the current -character is a space. - ESC-+, followed by 0..9, CHAINS to another macro key, -allowing you to build macros strings longer than the storage limit -of any one key. It does not "call" the key; there is no -returning. Example: ESC+9 chains to Key 9. - ESC-; (semicolon) gives a brief pause, presumably so the user -can see what's happening on screen. - Macro programs are stored just like any other macro string -(usually with "N"o repeat count). If you program in an endless -loop, you will at some point have to abort with ESC. Don't make -macro programs "Q"uiet until you're sure they work. - Example: here is a good macro program (best stored as a Quiet -Key) to move the cursor to the start of the current sentence: - - ESC~.1, ^S, ESC1, ESC~.<, ESC2, ^D, ESC=_2, ESC=^M2 - -You could write this out in programmer's pseudo-code as: - - If not "." goto label1 - Move left ;move left if already on period -label1: While not "." move Left ;move left to previous period -label2: Move right ;now move back right - If " " goto label2 ; as long as you see a space - If "^M" goto label2 ; or a Return - (all done) - - -7. General Information. - -7.1. Disk Space. - - ZDE isn't disk-bound; if you run out of disk space, just -insert another disk (always keep a blank FORMATTED disk around). -Alternatively, you can use the ESC-F and ESC-E commands to purge -unneeded files. [If you have small disks, you can also install -ZDE not to preserve BAK files.] - Let ZDE's filesize limits encourage you to break work up into -files of 50K or less; larger files make inefficient use of floppy -disks. - -7.2. Error Messages. - - Press ESC or Space to continue. "Error" alone means the -command used just won't work in this situation. (Example: a block -command was used with no block marked.) More specific errors are: - - "Out of Memory" - the file, block, or key string won't fit in - RAM. - "Invalid Key" - an illegal command key sequence was pressed. - "I/O Error" - file not found, disk full, empty/invalid - drive, etc. -"Cannot Reformat" - word too long, or margins invalid. - "Not Found" - the object of a search was not found. - "Syntax Error" - a macro programming command was misused. - -7.3. File Modes. - - ZDE has three FILE MODES: "W"ordStar document, "A"SCII -document, and "N"on-document. The basic difference concerns the -format of disk files. - In "W" mode, ZDE reads and writes WordStar-compatible files. -ZDE can edit a WordStar document, except that any right -justification will be lost. WordStar can edit any ZDE "W" file in -Document mode. - In "A" or "N" mode, ZDE reads and writes text as standard -ASCII 7-bit characters, a universal format accepted by virtually -all software. The only difference between "A" and "N" modes lies -in the default settings on loading a new file. Typically "A" mode -is used for word processing, and "N" mode for programming and -other technical applications. - -DEFAULTS FOR: Margins Tabs Hard CR disp. ------------- ------- ---- ------------ -"A"SCII or "W"ordStar mode ACTIVE VARIABLE [ON] -"N"on-document DISABLED HARD OFF - - The file mode option can be specified along with the filename -at any ZDE file function prompt, allowing you to mix WordStar and -ASCII disk files as needed (see Invoking ZDE, above). You can -also change the current mode with the ^K-N function by entering a -new mode (e.g., "[W") with or without a filename. - [ZDENSTAL allows you to select a default file mode, to be -used when no mode is specified (originally this is "A"). Further, -you can specify two filetype masks for automatic mode selection -(e.g., all "ASM" files as "N" mode) to override that default.] - NOTE ON ASCII FILES - The "A"SCII-document file format used -since VDE 2.50, to allow accurate formatting and WordStar -compatibility, distinguishes between HARD and SOFT CRs (see -Wordwrap, above). Consequently, if you edit an ASCII file created -by other software (including earlier versions of VDE), it may -appear to be full of hard CRs, making text impossible to reformat. -There are two easy ways to solve this problem: first, you can use -^Q-A to find "^M"s and selectively replace them with " ^M". -Alternatively, the following Macro (best stored as a Quiet macro -Key) does a good job of "softening up" paragraphs for reformatting: - - ^QS,^X,ESC=_],ESC=CR],^S,^V_^V,^D,ESC![ - -7.4. Hyphenation (^O-H). - - ZDE can't introduce hyphens, but it does recognize them in -the text, treating them as a legitimate place to break a line, so -if you have a long word close to the margin, you can insert a -hyphen where you'd like the word to be broken. - Similarly, ZDE can't unhyphenate. If it is trying to -reformat and finds a hyphen at the end of a line, it will pause to -ask you what to do with it. You will see the prompt "Chg?" in the -header, and can: - Press "Y" to remove the hyphen and space, joining the word; - "N" to leave the hyphen, but still join the word; - "ESC" to leave both the hyphen and the space alone. -Typically you would choose "Y" for "soft" hyphens that you -introduced to break up a word ("intro-duction"); "N" for hard -hyphens that are part of a word ("vis-a-vis"); and "ESC" for -punctuation (dashes "--", etc.). After your choice, reformatting -will proceed automatically. - You can toggle hyphenation on and off with ^O-H. If off, -hyphens are not treated differently from any other text character. -[The ^O-H default can be changed with ZDENSTAL.] - -7.5. Interruption. - - If ZDE is interrupted by messages from other software (BIOS -error, resident utilities, etc.), it may lose control of the -screen. The best way to return it to normal is by blanking and -restoring the screen (^O-Z, ESC). - -7.6. Prompts. - - First, ZDE has several simple prompts requiring you to -confirm an action by typing "Y" or "N": - - "Abandon changes?" - warns the file you want to Quit has - been changed. -"Unchanged; save anyway?" - reminds the file you want saved isn't - changed. - "Delete original?" - do you want to delete block copied - from 2nd file? - "Chg?" - do you want to change this instance of - a string? - -Then, there are a few special purpose prompts: - - "Repeat count:" - enter (optional "Q" and) repeat count - for Macro. - "Key number:" - enter (optional "N/Q" and) key number - for Key. - "Rdy" - press any key to print next page (ESC - quits). - -Finally, there are a variety of prompts for either numeric or -string input, like "Column:" or "Find string:". You are expected -to type in a string (up to 65 characters). The following control -keys operate: - - Correct mistake: BS (^H), ^S, or Del - Erase entire entry: ^X - Abort operation: ^U - -Note that to get any of these codes, or a CR, into the string -itself, you must precede it with ^P (this includes ^P). Examples: -to find a line beginning with a "*" (find "^M,*") type - - ^Q-F, ^P-CR, *, CR. - -Now to get this into a Macro with ESC-M, you would have to type - - ESC-M, ^Q-F, ^P-P, ^P-CR, *, ^P-CR, CR. - -7.7. WordStar Compatibility. - - In most respects ZDE operates much like WordStar; one big -difference is the absence of a "No-File" menu. You are always in -edit mode; use ^K-L to select a new file to edit. - If the keys ^J, ^K, ^L are in use as CP/M arrow keys, you -must use ZDE's original command set to substitute for them as -follows: - - Block prefix (^K-)... ESC- - Help menu (^J)....... ESC-H - Repeat find (^L)..... ^\ - - If these keys are NOT installed as arrow keys, they retain -their WordStar functions. Then, of course, ZDE lacks some -WordStar commands, and has some of its own. Aside from these, -there are the following differences in common commands: - -COMMON USE WORDSTAR 4 ZDE ZDE NOTES -Hide block ^K-H ^K-U Actually unmarks block. -Erase disk file ^K-J ^K-E -Set Place Mark ^K-0..9 ^P-Z Not individually numbered. -Go to Place Mark ^Q-0..9 ^Q-P Cyclic. - -COMMON COMMAND WORDSTAR 4 USE ZDE USE - ^^ Soften hard CR Transpose upper/lowercase - ^K-N Column block mode Rename current work - ^O-D Display ^P codes Display hard CRs - ^O-F Ruler from text Flush right - ^O-P Preview mode Page length - ^Q-U Repeat align Repeat undelete - -Note that ZDE does not implement WordStar "dot commands" in text, -though in "W" mode it avoids printing them. - - -8. Disclaimer. - - You use ZDE at your own risk. The author accepts no -liability for any damages resulting from its use or misuse. -Direct problem reports and suggestions to the author; include a -stamped return envelope for a reply if desired. Thanks to the -many users of ZDE whose feedback has led to improvements and bug -fixes in the past. - - Carson Wilson Sysop: Antelope Freeway RAS - 1359 W. Greenleaf 312-764-5162, Chicago - Chicago, IL 60626 24 hours, 3-12-2400 baud - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDE10.FOR b/Source/Images/d_zsdos/u1/ZDE10.FOR deleted file mode 100644 index 79b4dd02..00000000 --- a/Source/Images/d_zsdos/u1/ZDE10.FOR +++ /dev/null @@ -1,7 +0,0 @@ -Z-System Display Editor is Eric Meyer's famous VDE improved and -enhanced for Z-System. ZCPR named directory and line queue -capabilities, preserves file datestamps and runs faster under ZSDOS, -improved install program and documentation, and key compiler -included. Over twenty flaws in VDE 2.66 corrected. Also runs under -vanilla CP/M 2.2 and CP/M Plus. - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDE10.NEW b/Source/Images/d_zsdos/u1/ZDE10.NEW deleted file mode 100644 index 4c568f0d..00000000 --- a/Source/Images/d_zsdos/u1/ZDE10.NEW +++ /dev/null @@ -1,304 +0,0 @@ - New in ZDE - - Z-System Display Editor - - Version 1.0 10 Mar 89 - - ZDE and its documentation are copyright 1989 by Carson Wilson, - all rights reserved. They may not be circulated in any - incomplete or modified form without written permission of the - author. Any commercial use of ZDE, defined as any situation - where the duplicator receives revenue by duplicating or - distributing ZDE by itself or in conjunction with any hardware - or software product, is expressly prohibited unless authorized - in writing by Carson Wilson. - - - CONTENTS - - 1. Functional Enhancments. - 1.1. File Datestamp Capability. - 1.2. Named Directory Capability. - 1.3. Line Queue Capability. - 1.4. Other Enhancements. - 2. Bugs Fixed. - 3. ZDENSTAL. - 4. Notes to DosDisk Users. - 5. Planned Enhancements. - 6. Development History. - - -1. Functional Enhancments. - -1.1. File Datestamp Capability. - - Under ZSDOS, the Create date and time of files edited with -ZDE are maintained across editions. If .BAK files are being -created, the create dates of new files will be the same as their -.BAK files. Note that if a file with the name of a block being -saved with ^KW or ESC-W already exists, the saved block will have -the same Create stamp as the (previously) existing file. I hope -to address this side-effect in future versions by prompting before -erasing existing files during ^KW commands. - -1.2. Named Directory Capability. - - ZDE will now accept ZCPR named directories when loading, -renaming, and erasing files, and when requesting a directory -listing with the ^KF command. The named directory (if available) -is also displayed as part of the current file name in the status -line. - Since ZCPR directory names can occupy up to eight columns on -the status line, it was necessary to move the rest of the status -line over by eight columns. I was able to gain an extra column by -putting only one space between the filetype and the "[x" -specifier, but the result is that if your terminal displays less -than 55 columns the current column number will not be visible in -your status line. - This is unfortunate, but the status line is already about as -compressed as possible. To include all of the information I would -have to add a second status line for narrow terminals, which would -add a good deal of code and complexity to what is already a -complicated program. Since most CP/M terminals (including my own) -have 80 columns, I have decided in favor of the majority in this -instance. - You may also notice that the ^QA prompt "Chg? (Y/N/*)" has -been shortened to "Chg?" and the "Wait..." message is now "Wait". -These changes were also necessary because of the decrease in -available space on the status line. - -1.3. Line Queue Capability. - - A third functional enhancment is the new ^QQ command, which -causes ZDE to skip to line numbers stored in ZCPR's user-defined -message bytes. Under ZCPR3, up to eight line or page numbers may -be passed to ZDE. The original idea was to use the interface to -produce a Turbo Pascal-like integrated environment for program -development, but the interface is certainly not limited to -programmers. - The numbers are stored in ZCPR's 16 user-defined message -bytes, and ZDE treats these bytes as a packed array of up to eight -elements. ^QQ causes ZDE to cycle through the array, going to the -stored locations sequentially until the end of the array or a zero -element is reached, at which point ZDE returns to the first stored -location. - The numbers are stored as inverted 2-byte hex words (LSB -first), so for example to store the lines 12, 44, and 108 a -program would set the 16 user-defined bytes as follows: - - 0C 00 2C 00 6C 00 00 00 00 00 00 00 00 00 00 00 - -In this example, when ZDE reaches the fourth word (00 00) it -returns to the start of the array and goes to line 12 (0C 00). - Any ZCPR program, or even an alias (using Jay Sage's powerful -ARUNZ parameters) can now give ZDE the locations of up to eight -line numbers of interest. With a little imagination we could -probably create an integrated text search/edit environment which -searches multiple files for a string and points ZDE to the exact -location of each match for editing. Thanks to Cameron Cotrill and -Al Grabauskas for suggesting this feature. - -1.4. Other Enhancements. - - In response to a suggestion by Phil Newman, ZDE now properly -accepts and displays user areas between 16 and 31. While I do not -normally suggest storing files in these areas because many CP/M -programs do not handle them properly, they are useful occasionally -on very large disks or for security purposes, and are supported by -ZCPR and ZSDOS, so I have included them in ZDE. - For NewWord compatibility, I have changed the "To Mark" -command from ^QP to ^QZ. This is also better mnemonically, since -the "place mark" command is ^PZ. - The search and replace functions now match upper or lower -case by default. To search for an exact match by case, you must -enter "/c/" or "/C/" (for Case) before the search string. The -"/i/" option is no longer active. I have changed default -find/replace wildcard character to ^Z so that ZDE can find strings -with literal '_' characters. Use the ^QZ command to find a -literal ^Z. - ^KB, ^KK, ^KU and ^QY no longer cause unnecessary redisplays. - For faster operation, ZDE no longer resets drives under ZSDOS -(same as CP/M Plus). - Under ZSDOS and CP/M Plus, ZDE sets the error mode to 0FEh. -All BDOS errors are displayed on the screen, but ZDE retains -control. - For your protection, ZSDOS Path and Public files are Read -Only under ZDE. That is, you can access files via Path or Public -but you cannot erase Path or Public files. If you get a ZSDOS -"File W/P" error when saving data with the ^KS, ^KD, ^KX, or ^KW -commands or when erasing a file with ^KE, you may have given the -name of a ZSDOS Path or Public file. Try again with a new name. - - -2. Bugs Fixed. - - If just a drive letter in given during the ^KF (display -files) command, files in the current user area are displayed -rather than files in user area 0 (thanks to Ben Cohen). - ZDE no longer crashes if no name is given in response to the -^KW prompt (thanks to Eric Meyer for finding this one). - ^KB and ^KK now behave properly when entered at the rightmost -column of the screen. - The "Chg?" prompt is now properly erased in all circumstances. - Full disk errors caused CP/M Plus and ZSDOS systems to report -the wrong amount of free space. This has been corrected by -closing the output file after full disk errors (thanks to Howard -Goldstein for this idea). - File read-only errors no longer set the drive byte to "^@" -under CP/M 2.2 (thanks again to Phil Newman for finding this one). - Backwards replace now finds the first occurrence of the -string before the cursor even if the cursor is only one character -to the right of the string. If the string is replaced, the cursor -now returns to the START of the new string instead of one after it -as before (this may change the effects of some ZDE key macros). - Ben Cohen noticed that VDE's left margin (Lnn) print option -sometimes failed to indent the first line. This has been fixed. -ZDE also prints the header text at the same location no matter -what left margin is used, rather than indenting the header and -causing it to wrap to the next line. Print option verification is -also much more rigorous now than in previous versions. - ^KS, ^KD, and ^KX file name requests now abort with a -carriage return as well as ^U, and ^U now returns you to ZDE in -response to the ^KX filename request. - The bug fix published in VDE266.FIX has been incorporated. - Several ZDE bugs affecting use with DosDisk have been -eliminated (see below for bugs IN DosDisk 1.00, however). - Tabs displayed in the last column of the last row no longer -cause the screen to scroll. - Virtual screen displays no longer show garbage at the end of -the line if the cursor is at the left side of the screen, and -moving to the left edge of the screen with ^A no longer causes -redisplay. - ^A now moves to the first character on line 2 before jumping -to line 1 when line 1 is empty. - ^PZ now causes a horizontal scroll if it moves the cursor -beyond the right edge of the screen. - Block and place markers no longer set file status to -"Changed." - The cursor no longer jumps around when moving left from -columns after 254. The cursor now stops at column 254 instead of -255, and the status line says "Col 255" for any column past 254. -Text past column 254 CAN actually be edited, but it will not be -displayed by ZDE. - Strings can now be found with ^QA even if they are the very -last item in the file (credit goes to Cameron W. Cotrill for -finding this one). - "^OI@" now removes all soft tab stops "as advertised" in -VDE266.DOC instead of setting them all to 1, making it possible to -set new tabs after entering "^OI@". "^OI#" has the same effect. - ^^ now sets file status to "Changed" when converting from -lower-to-upper case as well as upper-to-lower. - "Wait..." message now disappears after disk operations with -ruler on and status line off. VDE266 forgot to erase the message -in this situation. - Backwards find and replace operations now work properly -instead of repeating the prompt indefinitely when the replace -string is shorter than the find string (thanks to Ben Cohen for -pointing this out). - VDE restored INSert to its entry status just BEFORE the final -byte of the macro, resulting in irregular behavior and sometimes -causing macro elements to appear after the "INS" indicator in the -status line. ZDE waits until the entire macro has executed before -restoring entry status. Due to ZDE's code structure, the INS -status line indicator does not change during macro execution. - ZDE restores INSert to entry status when macros abort due to -errors (e.g., "[[[ Not Found ]]]"). - - -3. ZDENSTAL. - - Included in this library is ZDENSTAL.COM, the new install -program for ZDE. ZDENSTAL it is very similar to VINST in -operation, but adds the feature of displaying the actual print -toggles and switches at all prompts, rather than the default ones. -So if you change the first default print toggle character to ^K -for example, all other prompts referring to that toggle now -reflect the change. - Files for use with ZDENSTAL must have the type ".ZDE" (option -installation), ".ZDP" (printer installation), or ".ZDK" (macro -keys), but are otherwise compatible with files used to install VDE -2.66. With Fred Haines' permission, I have adapted his wonderful -VDKCOM.COM utility for use with ZDE, and renamed it (what else?) -ZDKCOM.COM (see ZDKCOM.DOC). - ZDENSTAL also corrects the bug which prevented VINST from -loading installation files whose archive bits were set. - - -4. Notes to DosDisk Users. - -DosDisk users are advised of a bug in DosDisk 1.00 which appeared -during the development of ZDE. Calling Reset 13 while DosDisk is -active can cause DosDisk to think other active drives are all -drive A:. Bridger Mitchell, author of DosDisk, is aware of this -bug and is working on a fix. In the meantime, users of CP/M 2.2 -and ZRDOS who wish to edit files on MS-DOS disks should NOT log -into the MS-DOS drive while editing with ZDE, as this causes ZDE -to do a Reset 13 when writing to the MS-DOS drive. To edit files -on the MS-DOS drive, run ZDE from drive A: or another non-MS-DOS -drive. - -Users of ZSDOS and CP/M Plus need not worry about this problem -with ZDE, as ZDE never resets disks under ZSDOS or CP/M Plus. By -the same token, however, ZSDOS and CP/M Plus users must not change -disks in the MS-DOS drive from within ZDE, because DosDisk (like -CP/M 2.2) requires a disk reset or warm boot when disks are -changed (see DosDisk manual, p. 7). - - -5. Planned Enhancements. - - If time permits, future versions of ZDE may contain the -following enhancements: - An improved ZDENSTAL which directly accepts ASCII files for -key definitions, along the lines of ZDKCOM. - Bridger Mitchell has suggested command "bindings" which would -allow any control key or meta key sequence to be linked to any ZDE -command. This idea will be familiar to users of Perfect Writer. -Key bindings would allow ZDE to simulate EMACS, for example. - Bruce Morgen and others have suggested automatic terminal -installation under ZCPR, allowing the same copy of ZDE to be used -with any terminal. - Allow more than two default filetypes available and fixed -disks. - It may be possible to preserve file create datestamps under -CP/M Plus and Z3PLUS. - - -6. Development History. - -1984: VDE began as Eric Meyer's set of improvements on the tiny - (4k) "VDO" memory- mapped editor by Fritz Schneider (1982), - as adapted by George Peace (1984) for the Osborne Executive. - -1985: The first terminal adaptation, VDE-PX for the Epson PX-8. - Ongoing improvements also in parallel Osborne versions - VDE-OS. - -1986: The unified VDE(M) version 2.00, with generic terminal - installation. Versions 2.1-2.3 added new features - including macros; global replace; tighter compression; many - Print options; file directory; undelete. - -1987: 2.4 (1/87): Improved scrolling and screen functions; more - screen sizes supported; WordStar file mode; - place markers; ^OZ; block print; larger macro - keys; VINSTALL terminal menu. - - 2.5 (3/87): User area support; variable tabs; double - spacing; search wildcards; more standard block - functions; improved format- ting; many - additions to VINSTALL. - - 2.6 (7/87): Greater WordStar compatibility; many new - functions; more free RAM; faster scrolling; - search options; keyboard buffer. - -1988: Development through v2.64, with new functions; top margin; - doublespaced printing; auto mode filetypes. - - 2.65 (4/88): Auto indent; tab set enhancements; small fixes. - - 2.66 (6/88): Printer left margin; small fixes. - -1989: First version of ZDE. - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDE10.QRF b/Source/Images/d_zsdos/u1/ZDE10.QRF deleted file mode 100644 index 3256a079..00000000 --- a/Source/Images/d_zsdos/u1/ZDE10.QRF +++ /dev/null @@ -1,55 +0,0 @@ - QUICK REFERENCE FOR ZDE 1.0 -------- [Note: the ^K- and ESC- prefixes are nearly interchangeable.] -------- - - - CURSOR AND SCREEN: - - = ^E = ^D ^Q, start, end of line - = ^X = ^S or ^H ^Q, top, end of screen - [Note: An alternate arrow key set can also be installed.] - - ^F word right ^QR to top of file ^QB to block start - ^A word left ^QC to end of file ^QZ to place marker - ^R page back ^QI to page/line no. ^QQ to queue line - ^C page forward - ^W scroll back line ESC, shift up, down 1/4 screen - ^Z scroll down line ESC, shift right, left 32 cols - ^O make current line top - - DELETING: MISCELLANY: FIND and REPLACE: - - ^G delete char right ^V INSERT on/off ^QF find string - DEL delete char left ^N insert a CR ^QA find and replace - ^T delete word right TAB Tab or move to stop /B/ackwards - ^Y delete line ^^ upper/lower case /C/ase-specific - ^QY del to end of ln ^KI information message /// quote "/" -^Q-DEL " to beg of ln ^PZ set place marker ^Z = wildcard -^QT_ del to character ^OD HCR display on/off ^L [^\] repeat last - ^U UNdelete char ^OQ header on/off find/repl - ^QU UNdelete line ^OW make window - ^OZ blank screen - - DISK FILES: BLOCKS: PRINTING: - - ^KN change filename ^KB block start ^KP print text - ^KL load new file ^KK block end (Options: P,B,T,L, - ^KR read in disk file ^KU unmark block ^,"",*nn,@nn,#nn) - ^KF show disk files ^KC copy block ^OP set page length - ^KE erase disk file ^KV move block ^P- insert ^-code: - ^KS save work, continue ^KY delete block B,D,S,Y toggles - ^KD save, load new file ^KW write block to disk Q,W,E,R switches - ^KX save and exit - ^KQ quit without save - - FORMATTING: - - ^OR,L set rt, lf margins ^OI,N tab set, clear ^B reform text - ^OX margin release ^OV tabs variable/fixed ^OT ruler line - ^OC center line ^OA auto indent mode - ^OF flush line right ^OS double spacing - - MACROS: - - ESC-M define macro ESC-# store macro key ESC-!,=,~,+ - ESC-; wait (pause) ESC-0..9 use key macro programming - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDE10.TOC b/Source/Images/d_zsdos/u1/ZDE10.TOC deleted file mode 100644 index 3b54a99c..00000000 --- a/Source/Images/d_zsdos/u1/ZDE10.TOC +++ /dev/null @@ -1,67 +0,0 @@ -..Print in Wordstar mode, using the "L8" option for normal pitch -..printers and 8.5" paper. - - ZZZZZZZZ DDDDDDD EEEEEEEE - ZZ DD DD EE - ZZ DD DD EE - ZZ DD DD EEEEEE - ZZ DD DD EE - ZZ DD DD EE - ZZZZZZZZ DDDDDDD EEEEEEEE - - Z-System Display Editor - - - Table of Contents - -1. Introduction. . . . . . . . . . . . . . . . . . . . . . 1 -2. Installing ZDE. . . . . . . . . . . . . . . . . . . . . 2 -3. Invoking ZDE. . . . . . . . . . . . . . . . . . . . . . 2 -4. ZDE's Command Set. . . . . . . . . . . . . . . . . . . 2 -4.1. Command Summary. . . . . . . . . . . . . . . . . . . 3 -4.1.1. Control Keys: . . . . . . . . . . . . . . . . . . . 3 -4.1.2. File and Block Commands: . . . . . . . . . . . . . 3 -4.1.3. Escape and Macro Commands . . . . . . . . . . . . . 4 -4.1.4. Quick Commands . . . . . . . . . . . . . . . . . . 4 -5. Command Descriptions. . . . . . . . . . . . . . . . . . 5 -5.1. Auto-Indent Mode (^O-A). . . . . . . . . . . . . . . 5 -5.2. Block Commands . . . . . . . . . . . . . . . . . . . 5 -5.3. Cursor Movement . . . . . . . . . . . . . . . . . . . 6 -5.4. Deleting . . . . . . . . . . . . . . . . . . . . . . 6 -5.5. Disk Operations . . . . . . . . . . . . . . . . . . . 7 -5.6. File Commands . . . . . . . . . . . . . . . . . . . . 7 -5.7. Find, Replace . . . . . . . . . . . . . . . . . . . . 7 -5.8. Header . . . . . . . . . . . . . . . . . . . . . . . 8 -5.9. Information . . . . . . . . . . . . . . . . . . . . . 8 -5.10. Insert Mode . . . . . . . . . . . . . . . . . . . . 9 -5.11. Line Spacing . . . . . . . . . . . . . . . . . . . . 9 -5.12. Margins . . . . . . . . . . . . . . . . . . . . . . 9 -5.13. Pagination . . . . . . . . . . . . . . . . . . . . . 9 -5.14. Place Markers and Line Queue . . . . . . . . . . . . 10 -5.15. Printer Codes . . . . . . . . . . . . . . . . . . . 10 -5.16. Printing . . . . . . . . . . . . . . . . . . . . . . 11 -5.17. Ruler Line . . . . . . . . . . . . . . . . . . . . . 12 -5.18. Tabs . . . . . . . . . . . . . . . . . . . . . . . . 12 -5.19. Undelete . . . . . . . . . . . . . . . . . . . . . . 12 -5.20. Upper/Lower Case . . . . . . . . . . . . . . . . . . 13 -5.21. Window and Screen . . . . . . . . . . . . . . . . . 13 -5.22. Wordwrap, Reformat . . . . . . . . . . . . . . . . . 13 -6. Macros. . . . . . . . . . . . . . . . . . . . . . . . . 14 -6.1. Macro . . . . . . . . . . . . . . . . . . . . . . . . 14 -6.2. Macro Key . . . . . . . . . . . . . . . . . . . . . . 15 -6.3. Macro Programming . . . . . . . . . . . . . . . . . . 15 - - - - - -7. General Information. . . . . . . . . . . . . . . . . . 16 -7.1. Disk Space. . . . . . . . . . . . . . . . . . . . . . 16 -7.2. Error Messages. . . . . . . . . . . . . . . . . . . . 17 -7.3. File Modes. . . . . . . . . . . . . . . . . . . . . . 17 -7.4. Hyphenation . . . . . . . . . . . . . . . . . . . . . 18 -7.5. Interruption. . . . . . . . . . . . . . . . . . . . . 18 -7.6. Prompts. . . . . . . . . . . . . . . . . . . . . . . 18 -7.7. WordStar Compatibility. . . . . . . . . . . . . . . . 19 -8. Disclaimer. . . . . . . . . . . . . . . . . . . . . . . 20 - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDE13.FOR b/Source/Images/d_zsdos/u1/ZDE13.FOR deleted file mode 100644 index 7b0f2694..00000000 --- a/Source/Images/d_zsdos/u1/ZDE13.FOR +++ /dev/null @@ -1,8 +0,0 @@ -Update to Z System Display Editor, a small, fast editor for assembly -language and light word processing. Z System required for optimal -performance; also works with CP/M 2.2 and CP/M Plus. This version -adds hardware video handling, auto-return to file position under -ZCPR, WordStar-like ruler line, cursor on/off, and generally -F-A-S-T-E-R performance. Ten little bugs also fixed. See ZDE10.LBR -for full documentation. 26 Aug 89 by Carson Wilson. - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDE13.NEW b/Source/Images/d_zsdos/u1/ZDE13.NEW deleted file mode 100644 index 1e8517a1..00000000 --- a/Source/Images/d_zsdos/u1/ZDE13.NEW +++ /dev/null @@ -1,241 +0,0 @@ - - New in ZDE - - Z-System Display Editor - - Version 1.3 26 Aug 89 - - - ZDE and its documentation adapted with permission from Eric - Meyer's VDE version 2.66, and are now copyright 1989 by Carson - Wilson, all rights reserved. They may not be circulated in any - incomplete or modified form without the written permission of - Carson Wilson. Any commercial use of ZDE, defined as any - situation where the duplicator receives revenue by duplicating - or distributing ZDE by itself or in conjunction with any - hardware or software product, is expressly prohibited unless - authorized in writing by Carson Wilson. - - - This file describes changes to ZDE since version 1.0. I have - decided not to release a revision of the documents while ZDE is - still in active development. For now, please obtain ZDE10.DOC - and ZDENSTAL.DOC from ZDE10.LBR, available on Antelope Freeway - and many other remote CP/M systems. Except for the changes - detailed below, these files provide a thorough explanation of - how to use and install ZDE. Alternatively, send a contribution - of $6 or more to support further work on ZDE, and I will mail - you a high quality printed manual. See section 4 of this file - for details. - - - - CONTENTS - - - 1. FUNCTIONAL ENHANCMENTS. - 1.1. Hardware Codes for Faster Scrolling. - 1.2. ZCPR Auto-Return to Previous Position. - 1.3. WordStar-like Ruler line. - 1.4. ZCPR-like Option Lead-in Character. - 1.5. Cursor Dance Eliminated. - 1.6. Other Minor Enhancments. - 2. BUGS FIXED. - 3. INSTALLATION. - 4. FOR MORE INFORMATION. - - -1. FUNCTIONAL ENHANCEMENTS. - - 1.1. Hardware Codes for Faster Scrolling. - -ZDE now uses "hardware" video scrolling in its delete line (^Y) -command, if your terminal has a delete line capability (see -ZDENSTAL's Terminal Installation). If hardware insert line is -available, hardware scrolling is also implemented in the insert -line (^N) command when used at the beginning of a line. For most -terminals these are considerably faster than repainting all or -part of the screen, especially if more than one line is being -inserted or deleted. - -On many ASCII terminals a pause is needed after giving a hardware -scroll string so that the screen can catch up with the keyboard. -As distributed the same value of 38 hex is used for both -horizontal and vertical scrolls. To determine the optimal setting -for your terminal, load a large text file and execute "scroll up" -or "scroll down" (^W or ^Z) continuously. If your terminal beeps -at you or if garbage characters appear you probably need to -install a larger "Horizontal & vertical scroll delay" value with -ZDENSTAL. - - 1.2. ZCPR Auto-Return to Previous Position. - -ZDE now loads ZCPR's user-defined message bytes 0 and 1 (if -available) with the absolute line number of your position in a -file on exit. This allows you to exit to ZCPR, perform some other -commands, then return to the same line in your file using the ^QQ -command. You can also use this feature to jump to the equivalent -line in another file. Since the line number is absolute, it does -not vary with page length or file mode settings. - - 1.3. WordStar-like Ruler line. - -New in this version is the appearance of ZDE's ASCII/WordStar mode -ruler line. As with WordStar and NewWord, the left margin is now -marked with "L", the right margin with "R", and soft tabs with -"!". The appearance of ZDE's Non-Document mode ruler line remains -unchanged. - - 1.4. ZCPR-like Option Lead-in Character. - -ZDE now accepts ZCPR's familiar "/" slash character instead of -CP/M Plus's "[" character as an option signifier. For example, to -change to non-document mode the command is now "^KN/N" instead of -"^KN[N". To load a file in ASCII mode (for example) the command -is now "ZDE filename /A". This is more consistent with Z-System -programs as well as the MS-DOS version of VDE. It's also a lot -easier to find the slash character (at least on my keyboard)! - -ZDE allows you to "quote" the slash character in filenames in the -same way you quote it in ZDE find/replace strings, by doubling the -slash to give a literal slash. So for example the command "^KN -12//12//89.FIL" will change the current filename to -"12/12/89.FIL," and "ZDE ////MYFILE" loads //MYFILE for editing. - - 1.5. Cursor Dance Eliminated. - -Several users mentioned that ZDE's cursor often seemed to "dance" -for no apparent reason. Actually, this was due to the fact that -ZDE repaints the screen somewhat more often than larger word -processing programs, but in looking through NewWord's User Area -Listing for version 2.17, I found something I had never noticed -before. It is possible to install NewWord to turn your cursor off -and on by putting short routines in the MORPAT area and installing -jumps to your routines at 77D and 77A hex, respectively. This -reduces eyestrain by telling NW to turn off your cursor while it -repaints your screen. - -It turns out that it was fairly simple to add a similar routine to -ZDE, so this version has cursor on/off routines similar to -NewWord's. To make use of these routines, you must install ZDE -with the cursor on/off codes for your terminal. ZDENSTAL 1.3 -allows up to six bytes each for cursor on and cursor off. I have -only been able to find codes for a few of the terminals in -ZDENSTAL's library. If the codes for your terminal are not -included in ZDENSTAL, perhaps you could leave a short message to -me describing them (see below for address), and I will include -them in the next release. - - 1.6. Other Minor Enhancments. - -The cursor now turns off with the ^OZ command, giving a completely -blank screen if cursor on/off is installed (see 1.5, above). - -Version 1.0 repainted the whole screen after copying a block. Now -ZDE repaints only from the block to the bottom of the screen for -faster operation in most circumstances. I have also optimized -ZDE's general screen output routines somewhat for speed, though -this isn't noticable on terminals operating at less than 38.4 -kbaud. - -File input/output code has also been optimized for slightly -greater speed. - -And, last but not least, "quiet" operations now work up to 300 -percent faster! Both "quiet" macros and the "*" option of -find/replace boast greatly increased speed due to improved program -logic. - - -2. BUGS FIXED. - -If you did a backwards find/replace with ZDE 1.0 and responded to -the "Y/N" prompt with "*", the screen stayed off until you gave an -illegal command. The screen now comes back when replacement is -complete. - -ZCPR's GO restart now works after exitting when ZDE's window (^OW) -is active. Previously restarting with GO caused ZDE to limited -the number of lines of display available by 1/2. - -I fixed a bug with block markers failing to scroll the entire -display if entered in the last screen column. This was apparently -introduced when I made block marker displays more efficient in ZDE -1.0. - -If the cursor is to the left of the left margin, block markers now -move the cursor to the left margin instead of marking the blank -space between cursor and left margin as part of the block. - -For greater safety, ZDE now checks for free memory space before -adding a block marker with ^KK or ^KB. - -Place markers no longer cause words to "wrap" to the next line -when wordwrap is active. - -I fixed a minor bug ZDE 1.0 introduced to the ^OR command. Typing -^OR in non-document mode no longer produces the strange result of -setting the right margin to column seven. - -A display bug which occurred when the cursor was in column one of -a virtual screen with a tab to its left has been fixed. - -Previously, if only a drive letter was given in response to the -^KF command's "Dir:" prompt, ZDE searched user zero of the -specified drive, no matter what the current user number was. ZDE -now searches for files at the current user number of the specified -drive in these circumstances. - -The installed "output filter limit" was allowing one character -higher than the limit to be sent to the screen. Now only -characters equal to or less than the limit are sent. - - -3. INSTALLATION. - -You MUST use ZDENSTAL 1.3 to install this version of ZDE. Older -.ZDK and .ZDP files will still work; due to extra installation -codes, older .ZDE files will not work with this version. - -Version 1.0 of ZDENSTAL skipped the last few bytes of .ZDK key -overlay files, preventing a full 512-byte .ZDK key file overlay -from being installed. ZDENSTAL now installs the full 512 bytes. - -ZDENSTAL now allows four instead of just two default file types. - -Several new terminal definitions have been added to ZDENSTAL, as -well as some additional terminal codes (see 1.5, above). - - -4. FOR MORE INFORMATION. - -Finally, let me take this opportunity to thank the community of -users without whose efforts this version of ZDE would be far less -than what it is. Most of the above improvements and many of the -bugs fixed in this version result from comments and insights by -ZDE enthusiasts from around the country. Please let me know your -thoughts on this most recent version. - -Besides writing computer programs and working on a degree in -political science, I operate the Antelope Freeway Remote Access -Systems for CFOG, Chicago's First Osborne Group. These dual -remote systems are available at the same number, 312/764-5162, -Chicago. Antelope 1 covers CP/M and Z System, while Antelope 2 is -dedicated to MS-DOS support. The best way to contact me is -through this board. Registration is free. If you are not a -registered member, you can leave me a note as part of your -application. - -Alternatively, my mailing address is: - - 1359 W. Greenleaf, #1D - Chicago, IL 60626 - USA - -As I mentioned above, I don't plan to reissue the ZDE manuals with -the library while ZDE is still in development. For those who wish -an updated manual and/or wish to support ZDE, I offer instead a -pre-printed User's Manual and Installation Guide with Table of -Contents and Index for a contribution of $6 or more, postpaid. -The manual is printed in handsome proportional type on both sides -of 8.5 x 11 inch sheets and punched for a three-hole ring binder. -My costs for printing and mailing are about $3. - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDE16.COM b/Source/Images/d_zsdos/u1/ZDE16.COM deleted file mode 100644 index 55c492a5..00000000 Binary files a/Source/Images/d_zsdos/u1/ZDE16.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u1/ZDE16.DIR b/Source/Images/d_zsdos/u1/ZDE16.DIR deleted file mode 100644 index a6e85025..00000000 --- a/Source/Images/d_zsdos/u1/ZDE16.DIR +++ /dev/null @@ -1,25 +0,0 @@ -ZDE16.DIR: -Files in ZDE16.LBR, 01 June 90 by Carson Wilson: - -Filename Purpose ------------- --------------------------------------- -SAMPKEY.DZC Sample key file for use with ZDENSTAL. -SAMPKEY.ZDK -SAMPKEY.ZDT - -ZDE16.CZM ZDE itself. - -ZDE16.DZR This file. - -ZDE16.FOR Short RCP/M description of ZDE. - -ZDE16.NZW New in ZDE version 1.6. - -ZDENST16.CZM Installer for ZDE version 1.6. - -ZDEPROP.DZC Proportional formatting support files. -ZDEPROP.ZZ0 - -ZDKCOM13.DZC Key compiler for ZDENSTAL. -ZDKCOM13.CZM - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDE16.FIX b/Source/Images/d_zsdos/u1/ZDE16.FIX deleted file mode 100644 index 9b48f026..00000000 Binary files a/Source/Images/d_zsdos/u1/ZDE16.FIX and /dev/null differ diff --git a/Source/Images/d_zsdos/u1/ZDE16.FOR b/Source/Images/d_zsdos/u1/ZDE16.FOR deleted file mode 100644 index 024183a7..00000000 --- a/Source/Images/d_zsdos/u1/ZDE16.FOR +++ /dev/null @@ -1,8 +0,0 @@ -Z System Display Editor, version 1.6. A small, fast, powerful -WordStar-type text editor for all CP/M and compatible systems with -the Z80 processor. In some ways superior to its big brother VDE, -this version of ZDE adds fully functional Auto-Indent capabilities, -Proportional Formatting, Auto-Recall of last response to prompts, -Global Find/Replace, Return to Previous Position (^QP) and more to -what many felt was already the best editor available for CP/M. - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDE16.NEW b/Source/Images/d_zsdos/u1/ZDE16.NEW deleted file mode 100644 index a6d3de24..00000000 --- a/Source/Images/d_zsdos/u1/ZDE16.NEW +++ /dev/null @@ -1,498 +0,0 @@ - - New in ZDE - - Z-System Display Editor - - Version 1.6 02 Jun 90 - - ZDE is copyright 1990 by Carson Wilson, all rights reserved. - You use ZDE at your own risk. The author accepts no liability - for any damages resulting from its use or misuse. The files in - this library may not be circulated in any incomplete or - modified form without the written permission of Carson Wilson. - Any commercial use of ZDE, defined as any situation where the - duplicator receives revenue by duplicating or distributing ZDE - by itself or in conjunction with any hardware or software - product, is expressly prohibited unless authorized in writing - by Carson Wilson. - - This file describes changes to ZDE since version 1.3. I have - decided not to release document revisions while ZDE is still in - active development. For now, please obtain ZDE10.DOC and - ZDENSTAL.DOC from ZDE10.LBR, and ZDE13.NEW from ZDE13.LBR, - available on Antelope Freeway and many other remote CP/M - systems. Except for the changes detailed below, these text - files provide a thorough explanation of how to use and install - ZDE. Alternatively, send a contribution to support further - work on ZDE, and I will mail you a high quality, up-to-date - printed manual for ZDE version 1.6. See section 6.3 of this - file for details. - - - - CONTENTS - - - 1. FUNCTIONAL ENHANCEMENTS. - 1.1. Proportional Formatting. - 1.2. Last Entry Recall. - 1.3. Enhanced Operation Under CP/M Plus and ZSDOS. - 1.4. Control-U now Aborts "Delete To" Function. - 1.5. Fully Operational Auto-Indent (^OA). - 1.6. Chain to ZCPR Error Handler. - 1.7. Return to Previous Position Command (^QP). - 1.8. Global Find/Replace Option. - 1.9. Semicolons are now Characters in Nondocuments. - - 2. BUGS FIXED. - 2.1. More Robust Space Calculation. - 2.2. ZCPR Line Queue Bug Fixed. - 2.3. Other Minor Nuisances Corrected. - - 3. INSTALLATION. - 3.1. New in ZDENSTAL Version 1.6. - - 4. USAGE HINTS. - 4.1. Saving Macros. - 4.2. Creating a Smaller ZDE. - 4.3. Using GET and GO with ZDE. - - 5. DEVELOPMENT HISTORY. - - 6. FURTHER INFORMATION. - 6.1. About Z System. - 6.2. About the Author. - 6.3. Pre-Printed Manuals. - - -1. FUNCTIONAL ENHANCEMENTS. - - 1.1. Proportional Formatting. - -ZDE can now format your text for use with proportional printer -fonts! See the files ZDEPROP.DOC and ZDEPROP.Z80 (included in -ZDE16.LBR) for full details. - - 1.2. Last Entry Recall. - -The following commands (among others) cause ZDE to prompt -you for information: - - COMMAND PROMPT - ^KD "Load:" - ^KE "Erase:" - ^KN "Name:" - ^KL "Load:" - ^KR "Read:" - ^QF "Find:" - ^QA "Find:" and "Change to:" - ESC-M "Macro:" - -You can often save typing time and prevent errors by using -control-R or your right arrow key [as installed] to Recall your -last response to any of the above prompts. For example, to read -in a file and then erase it, you could enter "^KR, , -RETURN" followed by "^KE, ^R, RETURN". The ^R command will -automatically recalls the filename you entered in response to the -"Read:" prompt. The Find, Replace, and Macro prompts work in a -similar manner. ^R Recalls your entire response; right arrow -recalls your last response one character at a time to allow -further editing. - -The Recall keys can also be used to recall the last used macro, -even if it wasn't entered manually. - - 1.3. Enhanced Operation Under CP/M Plus and Z3PLUS. - -ZDE takes advantage of advanced BDOS error handling to provide -slightly faster file output under CP/M Plus and Z3PLUS. In -addition, file Create stamps are now preserved under CP/M Plus -based systems as well as ZSDOS and ZDDOS systems. - - 1.4. Control-U now Aborts "Delete To" Function. - -Control-U can now be used to abort a "Delete To" (^QT) operation. -Previously, ZDE would attempt to delete up to the next literal ^U -character in the file, often causing frustration. - - 1.5. Fully Operational Auto-Indent (^OA). - -Auto-Indent is useful for typing outlines, structured program -source code, and other text where the "left margin" varies. When -the Insert (^V) toggle is on, Auto-Indent aligns the left margin -with that of the previous line. When Insert is off, it causes -the RETURN key to act differently: RETURN advances the cursor -past any indentation when moving through a file. - -When a new line is begun either by wordwrap or reformat (see -below) or by hitting RETURN with Insert on, Auto-Indent indents -the following line or lines to equal the previous one. It does -this by counting the number of spaces or Hard TABs (whichever -came first) before the text of the previous line, and indenting, -wrapping, or reformatting using this number of spaces or Hard -TABs. This entails certain possible conflicts, most of which ZDE -itself automatically prevents: - -First, if you mix Hard TABs and spaces when indenting a line, AI -may give strange results, as it will count and use the first -character only. For example, if your line is indented as -, AI will indent the next line with -only. - -To avoid conflicts, enabling AI sets the left margin to 1, and -setting the left margin greater than 1 disables AI. Also, Double -Spacing (^O S) is disabled by Auto-Indent, and Auto-Indent -disables Double Spacing. - -Auto-indent status also now defaults to ON in Nondocument mode, -and OFF otherwise. - - 1.6. Chain to ZCPR Error Handler. - -ZDE 1.6 will chain to the installed Error Handler under ZCPR 3.4 -with error #12 (TPA overflow) if there was not enough memory for -ZDE to edit the file you specified on the command line. ZDE does -this because the flow of logic in a multiple command line -sometimes dictates that the editor complete its task before -succeeding commands are carried out. For example, I use the -a multiple command alias similar to the following - - ZDE file;echo erase;if in;era file;else;mv file newdir:;fi - -to process modem capture files. After processing each file with -ZDE I generally want either to erase it (if it contained nothing -worth saving) or move it to another directory. But on occasion -the capture file is too large to process with ZDE. If the script -were allowed to proceed, it would force me either to erase the -capture file or move it elsewhere, neither of which would be -appropriate if I hadn't even looked at its contents yet. - -This is where Z System's error handler comes it handy: it -provides a means of dealing with an offending command line before -unwanted commands cause harm. When ZDE chains to the error -handler, I can _edit_ commands beginning with ZDE's invocation, -either removing unwanted commands or inserting further commands -as the situation may dictate (it is also possible to abort the -command or multiple command script altogether). In the above -case, I would revise my command line to the following: - - NW file;echo erase;if in;era file;else;mv file newdir:;fi - -By substituting the ZDE command with NW I have invoked NewWord -for this instance only of the command, which in turn will edit -the larger file. - -Without question the finest ZCPR error handler now available is -Rob Friefeld's ZERR. There are even provisions within ZERR for -automatically editing LSH scripts and for automatically chaining -to transient versions when resident (RCP, CCP) commands fail; all -of this is described in ZERR13.LBR. - - 1.7. Return to Previous Position Command (^QP). - -This function is basically the same as the WordStar command: -hitting ^Q-P takes you to the position the cursor was at before -the previous command (including the ^QP command itself - try -it!). For instance, the sequence "^B, ^Q-P" reformats beginning -with the current line then restores the cursor to its original -position within the paragraph. ^Q-P is also useful for moving -long distances within a file without losing one's place: for -example you can move to the top of the file with ^Q-R, then come -back with ^Q-P. - -Within Macros, the previous cursor location is preserved: ^Q-P -will always return you to your place in the text BEFORE you -invoked the Macro. This not only allows you to resume editing at -the same location after using Macros; you can also build one or -more ^Q-P commands into the Macro itself. See SAMPKEY.* files -for one example; I'm sure there are lots of other ways to use -^Q-P within a Macro. Thanks to Howard Schwartz for keeping on my -case about this feature until I finally discovered an easy way to -implement it. - - - 1.8. Global Find/Replace Option. - -Besides "B" (backwards search) and "C" (case-sensitive search), -ZDE now sports a THIRD find/replace option: "G" for Global -search. ZDE normally begins your (backward or forward) search at -the current cursor location. Specifying "G" causes ZDE to start -at the BEGINNING of the file when searching forward for strings, -or at the END when searching backwards. Otherwise, the search or -replace command proceeds exactly as it does normally. The "G" -option is used in the same way as the other options, by enclosing -it in slashes as a prefix to the string being searched for (e.g., -to find "Carson" globally, enter "/gc/Carson" in response to -^Q-F's "Find: " prompt). - - 1.9. Semicolons are now Characters in Nondocuments. - -ZDE now counts the ";" (semicolon) character as a normal -character in "N" mode, whereas it counts the semicolon as a -punctuation mark in the "W" and "A" modes. This is mainly of -interest to assembly language programmers, as the semicolon is -often used alone to mark the beginnings of comments in source -code. Treating the semicolon as a normal character in "N" files -simply makes it easier to manipulate assembly language comments. -Thanks to Rob Friefeld for his thoughts on this. - - -2. BUGS FIXED. - - 2.1. More Robust Space Calculation. - -ZDE's calculation of memory space remaining is now more robust. -In past versions of ZDE (and VDE), certain editing commands could -cause a crash when only a few bytes of free memory were -available (thanks to Rob Friefeld). - - 2.2. ZCPR Line Queue Bug Fixed. - -The ^QQ (go to next line in ZCPR queue) command of previous -versions of ZDE failed if ZCPR's 16-byte user-defined buffer was -filled. Version 1.6 fixes this problem, properly returning to -the first line in the queue after the last value in has been -reached. This allows Turbo Pascal-like interactive programming -of Z80 assembly language when used under Z System with Al -Hawley's ZMAC Z80 Macro Compiler ($50 including ZML and ZMLIB; -contact Al Hawley at Ladera Z-Node, 213/670-9465 (modem), Ladera -Heights, CA). - - 2.3. Other Minor Nuisances Corrected. - -ZDE now turns alternate video off when placing the cursor at the -string to change during ^QA prompts. - -A bug which allowed an extra character or hyphen on the last line -of a paragraph if the line's length was one character beyond the -right margin has been fixed (thanks to Larry Schnitger for -spotting these). - -A bug which occurred if you set the block end marker to the last -byte in the file then did a block delete has been fixed (thanks -to Ben Cohen for finding this). - -One or more bug(s) which occurred while printing have been -cleared up. ZDE should now always give a correct left margin -with or without a page header or top margin. The printout is -also slightly faster when left and top margins are used together. - -ZDE now always finds strings located exactly at the end of a -file. - -When searching with the /c/ option, erroneous results occurred if -a non-matching string of the same length as the search string -beginning with the same first character as the search string was -located at the very end of a file. This has been fixed. - -Fixed minor bug in proportional formatting that caused repeated -^B commands to give inconsistent results under some -circumstances. - -Fixed bug which set margins spuriously if an illegal number was -entered. ZDE also now disallows setting margins to zero, which -caused formatting problems. - -^B (reformat) no longer absorbs following commands, allowing ^B -to be embedded in key redefinitions with SmartKey, etc. - - -3. INSTALLATION. - -You MUST use ZDENSTAL 1.6 to install this version of ZDE. Older -ZDK and .ZDP files will still work. Due to extra installation -codes, .ZDE files created with version 1.0 of ZDE will not work -with this version of ZDENSTAL. - - 3.1. New in ZDENSTAL Version 1.6. - -The proportional formatting (^OJ) toggle can be disabled with -ZDENSTAL to allow use of ZDE's proportional spacing table as a -patch area. When proportional spacing is disabled, an additional -96 bytes of space is released for custom user patching. ZDENSTAL -also allows you to set the proportional formatting toggle to ON -or OFF at startup [this can also be toggled while operating ZDE]. - -ZDENSTAL's "R" option now restores ZDE's proportional spacing -table to its default (as distributed) values. - -ZDENSTAL's "F" option now gives the locations of all FIVE key -definition tables (former versions left out the ESC- table). The -"F" option also gives the location of ZDE's proportional spacing -table for use when patching ZDE. - -The Osborne 1 and Vixen terminal definitions are now separate due -to different screen width requirements (thanks to Ben Cohen for -sorting this out). - -ZDENSTAL previously would overwrite .ZDK and .ZDP files with the -wrong information if the .ZDK or .ZDP file had been archived (bit -7 of filetype character 3 set). This problem has been corrected -in version 1.6. - -Some ZDENSTAL messages have been improved. - - -4. USAGE HINTS. - -The following are just some miscellania that I have picked up -from using and working on ZDE. - - 4.1. Saving Macros to Disk. - -Under Z System version 3.4, it is possible to "save your work" -after creating a working Macro. First, be sure to save your new -Macros as Macro Keys using ZDE's ESC-# command (see ZDE Manual). -Then exit ZDE and type - - POKE 310 02 50;ZSAVE 310-490 filename.ZDK - -You have just used Z System's type-4 SAVE program to create a new -.ZDK file, which can now be examined and installed permanently -into ZDE with ZDENSTAL, or further revised using ZDKCOM. [NOTE: -the addresses and values given above will work for ZDE version -1.6, but may change with future versions of ZDE.] - - 4.2. Creating a Smaller ZDE. - -If you are SURE you will never want to enable the Help Menus, you -can create a slightly smaller copy of ZDE. First use ZDENSTAL to -disable ZDE's Help Menus. Then issue the Z System command, - - GET 100 ZDE.COM;ZSAVE 100-3E7F filename.COM - -This creates a copy of ZDE that is about 1 kilobyte smaller than -the distributed package, and loads somewhat faster on slower -systems. This procedure is specific to ZDE 1.6; do NOT assume -that it will work on future versions. - - 4.3. Using GET and GO with ZDE. - -Some users have discovered that the Z System GET and GO commands -can be used to extend ZDE's versatility or save disk space. -Since the .ZDE, .ZDP, and .ZDK files used by ZDENSTAL are simply -binary images of various portions of ZDE, you can achieve the -versatility of having several copies of ZDE without the added -disk overhead by using Z System commands that "install" one or -more of ZDENSTAL's files on the fly. - -For example, if you used ZDE with a particular terminal most of -the time, but occasionally switched to another terminal that was -incompatible with the first one, you might want to create a Z -System Alias which would overlay the default copy of ZDE with -your second terminal's characteristics at startup. You could -achieve this by first using ZDENSTAL to configure ZDE for your -second terminal, saving the terminal's characteristics into a -.ZDE file (see the ZDE Manual for details on this). You would -then ZDE for your normal terminal, and write an Alias to -auto-install this copy of ZDE for your occasional terminal on the -fly: - - GET 100 ZDE.COM;GET 180 term2.ZDE;GO $* - -This command loads the file term2.ZDE over ZDE before proceeding, -providing a temporary copy of ZDE that works with your second -terminal. - -This approach can also be used to generate "virtual" copies of -ZDE with different printer codes and Macro Key definitions. The -addresses of the various overlays for ZDE version 1.6 are: - - 180 hex - Terminal codes (.ZDE files) - 1F0 hex - Printer codes (.ZDP files) - 310 hex - Macro Keys (.ZDK files) - -[These addresses may well change in future versions of ZDE.] - -Obviously, this involves some "homework:" if you get the -addresses wrong or use an incompatible .ZDx file (from a previous -version of ZDE, for example), you will likely cause yourself -grief. For these reasons I generally recommend simply creating -multiple copies of ZDE. But under some circumstances (e.g., -laptop computer with limited disk or ROM space) this approach may -be quite rewarding. - - -5. DEVELOPMENT HISTORY. - -ZDE is a descendant of Eric Meyer's famous VDE (Video Display -Editor) program for CP/M. In 1988, Eric produced his final -version of VDE for CP/M (2.66). Eric now maintains VDE for -MS-DOS only; ZDE continues VDE's evolution on Z80 systems. ZDE -removes many of the CP/M VDE's defects and adds such features as -support for ZCPR, ZSDOS, and CP/M Plus, improved terminal and -disk I/O performance, proportional formatting, file datestamp -support, and improved installation. Meanwhile, the MS-DOS -version of VDE has continued to evolve, now boasting multiple -file buffers, auto-save, auto-number, and much more. VDE for -MS-DOS is available on computer bulletin boards (including -Antelope Freeway; see below) as VDE152.ZIP. - - -6. FURTHER INFORMATION. - - 6.1. About Z System. - -If you are using CP/M equipment, you have probably heard of Z -System. Basically this is a downward compatible replacement for -the system software distributed with Z80 CP/M equipment. By -utilizing Z80 opcodes and advanced design techniques, the authors -of Z System have expanded the versatility of the CP/M operating -system far beyond its original limitations. To learn more about -Z System, log into the bulletin board listed below, or contact -one of the following: - - Plu*Perfect Systems Sage Microsystems East - 410 23rd St. 1435 Centre St. - Santa Monica, CA 90402 Newton Centre, MA 02159-2469 - (213)-393-6105 (eves.) (617)-965-3552 (9am-11pm) - - 6.2. About the Author - -First, let me take this opportunity to thank the community of -users without whose support this version of ZDE would not have -been possible. You have made ZDE what it is through your -generous contributions of time and/or money. Without those who -appreciate (and criticize) my work I doubt I could justify the -time and energy I've spent on ZDE. In addition, many of the -improvements and bug fixes in version 1.6 result directly from -specific comments and insights by users. Please continue to -share your thoughts and experiences with ZDE; I'm listening. - -I am a doctoral student trying to keep from starving while -working on my dissertation in Political Science at Loyola -University of Chicago. I am a coauthor of ZSDOS, a commercial -replacement for the BDOS portion of CP/M, and have authored -numerous CP/M and Z System programs. My interests include -computer programming, telecommunications, the Soviet Union, -Political Theory, and bicycling (not necessarily in that order). -I am also looking for part- or full-time work. To this end I am -skilled in political analysis, know the Russian language and the -Z80, C, BASIC, and Pascal computer languages, and have -comprehensive knowledge of CP/M and Z System and working -knowledge of Unix and MS-DOS. If you know of a gainful opening -in the computer field, I would like to hear from you. - -Among other things I operate the Antelope Freeway Remote Access -Systems for CFOG, Chicago's First Osborne Group. These dual -remote systems are available at the same number, 312/764-5162, -Chicago. Antelope 1 covers CP/M and Z System while Antelope 2 is -dedicated to MS-DOS support. The best way to contact me is -through this board. Registration is free. If you are not a -registered member, you can leave me a note as part of your -application. - -Alternatively, my mailing address is: - - 1359 W. Greenleaf, #1D - Chicago, IL 60626 - USA - - 6.3. Pre-Printed Manuals. - -As I mentioned above, I don't plan to reissue the ZDE manuals -with the library while ZDE is still in development. For those -who wish an updated manual and/or wish to support ZDE, I offer -instead a pre-printed 40-page User's Manual and Installation -Guide with Table of Contents and Index, postpaid, for those who -make contributions of $6 or more to support further development -of ZDE. - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDE16A.COM b/Source/Images/d_zsdos/u1/ZDE16A.COM deleted file mode 100644 index 3e9fdcc0..00000000 Binary files a/Source/Images/d_zsdos/u1/ZDE16A.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u1/ZDE16A.PAT b/Source/Images/d_zsdos/u1/ZDE16A.PAT deleted file mode 100644 index e4520856..00000000 --- a/Source/Images/d_zsdos/u1/ZDE16A.PAT +++ /dev/null @@ -1,102 +0,0 @@ -; This patch file modifies the officially-distributed .COM file -; for ZDE Ver 1.6 (copyright by Carson Wilson) to: -; - Correct a bug which did not preserve create times when -; editing files > 1 extent. -; - Use an apparently 'dead' byte in the configuration area as -; a configuration flag to allow disabling the 'Auto-Indent' -; feature which was always 'on' in ZDE1.6. -; -; With the second change, you may configure the 'Auto-Indent' -; feature to be active (as distributed) or disabled (as this patch -; is configured) by altering the DB at label 'AIDflt' in the -; second part of this patch file below. -; -; Assemble this file to a .HEX file (example uses ZMAC) as: -; -; ZMAC ZDE16A.PAT /H -; -; then overlay the resulting ZDE16.HEX onto ZDE16.COM with MYLOAD -; (or equivalent) as: -; -; MYLOAD ZDE.COM=ZDE.COM,ZDE16.HEX -; -; The resulting ZDE.COM will be identified as 'ZDE 1.6a' in the -; text identification string near the beginning of the .COM file. -; -; Harold F. Bower, 18 July 2001. -; -; CP/M Standard Equates -; -BDOS EQU 0005H -FCB EQU 005CH -DMA EQU 0080H -TPA EQU 0100H -; -SDMA EQU 26 ; CP/M Function to set DMA Address -; -; Needed locations within ZDE 1.6 -; -Fill EQU TPA+0F8BH ; For Date Patch -TimBuf EQU TPA+3B3FH ; " " " -; -VTFlg EQU TPA+3ADAH ; For Auto-Ins Patch -HCRFlg EQU TPA+3AE3H ; " " " " -LfMarg EQU TPA+3AFDH ; " " " " -; -; ----------- Begin Patch File ----------- -; -; --- Fix Create Time Stamp Preservation Error --- - - ORG TPA+0029H - ; was: - DB 'a, (C)' ; DB ', Copr.' - ORG TPA+2461H - ; was: - LD (FCB+13),A ; CALL ClUsrF -; - ORG TPA+2F10H - ; was: - LD B,4 ; CALL ClUsrF - CALL ClUsrF ; LD DE,TimBuf - LD DE,TimBuf ; LD C,SDMA - CALL SetDMA ; CALL BDOS -; - ORG TPA+30AAH - ; was: - LD DE,DMA ; LD C,SDMA -SetDMA: LD C,SDMA ; LD DE,DMA -; - ORG TPA+30B4H - ; was: -ClUsrF: XOR A ; XOR A - EX DE,HL ; LD (FCB+13),A - JP Fill ; RET -; -; --- Usurp Config Flag for Auto-Insert use, sense on startup --- -; - ORG TPA+0057H - ; was: 0FFH -AIDflt: DB 00H ; Set Desired default (0=Off, FF=On) -; - ORG TPA+262AH - ; was: - LD (LfMarg),HL ; LD HL,0101H - XOR A ; LD (LfMarg),HL - LD (VTFlg),A ; XOR A - LD (HCRFlg),A ; LD (VTFlg),A - NOP ; LD (HCRFlg),A - LD A,(AIDflt) ; DEC A -; - ORG TPA+2711H - ; was: - NOP ; LD A,(0157H) {Unknown Use} - NOP ; OR A - NOP ; JP Z,Error2 - NOP - NOP - NOP - NOP -; -;------------ End of Patch File ------------ - END - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDENST16.COM b/Source/Images/d_zsdos/u1/ZDENST16.COM deleted file mode 100644 index 8ccc9767..00000000 Binary files a/Source/Images/d_zsdos/u1/ZDENST16.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u1/ZDEPROP.DOC b/Source/Images/d_zsdos/u1/ZDEPROP.DOC deleted file mode 100644 index 5d3cd676..00000000 --- a/Source/Images/d_zsdos/u1/ZDEPROP.DOC +++ /dev/null @@ -1,139 +0,0 @@ -ZDEPROP.DOC -Proportional Spacing with ZDE -June 2, 1990 -Carson Wilson - - 1. INTRODUCTION. - 2. USING ZDE'S PROPORTIONAL FORMATTING FEATURE - 3. INSTALLATION AND CUSTOMIZATION. - - -1. INTRODUCTION. - -ZDE version 1.6 incorporates an elemental proportional formatting -feature. This option is useful only to those whose printers have -proportional spacing capabilities. Proportional formatting allows -you to format ragged right text properly for proportional output. -Centering and right justification of proportional text are not -available. - - -2. USING ZDE'S PROPORTIONAL FORMATTING FEATURE - -Proportionally spaced printing gives a more professional look, -allowing more characters to be printed on a line without -crowding. This is because less space is allocated to narrow -characters like "i" and more to wide characters like "M." Most -computer printers do NOT allow proportional spacing; only laser -printers, some daisy-wheel equipment, and newer dot-matrix -printers have this ability. Typically, there is a special set of -instructions which when sent to the printer, cause it to use -proportional spacing rather than monospacing. On some models -(the Silver Reed SR550 for example), DIP switches also control -this feature. - -ZDE does not itself perform proportional spaced printing; it -simply allows you to format your text for use with a printer that -has this capability. You must instruct your printer to space -proportionally before sending text to it. If you have tried using -the proportional capability of your printer, you probably have -noticed that LINES WITH LOTS OF WIDE CHARACTERS IN THEM -print out much wider than lines comprised of narrow characters. -ZDE 1.6 allows you to compensate for this by counting the width -of each character when it formats a paragraph (^B command), and -wrapping each line when its width count reaches the equivalent -of the current right margin setting. - -The ^OJ command toggles this feature on and off [the default may -also be installed with ZDENSTAL]. When proportional spacing is -active, the legend "PS" appears in ZDE's status line (this is -overwritten by "MR" when the margins are released). -Proportional spacing occurs only during the ^B reformat command, -not during wordwrap, so to format a document proportionally, you -must use ^B at the beginning of each paragraph after you key it -in. Still, the results are well worth the extra trouble, especially -for material that will be reproduced. - - -3. INSTALLATION AND CUSTOMIZATION. - -ZDE comes preconfigured to format text for proportional spacing -with Epson's new LQ510 dot matrix printer. Since most printers -allocate roughly the same ratios of space to the various -characters, there is a good chance you won't need to install ZDE -for your printer. This file has been formatted for proportional -output by ZDE; try printing it proportionally to see the results. - -If you should decide to change ZDE's proportional spacing to -match your printer, you can patch ZDE's offset values for -individual characters. The offsets are stored in a sequential -ASCII table whose location is given by ZDENSTAL's "F" option. -The table consists of positive and negative (2's compliment) byte -values, one for each character beginning with " " and going -through "~". As distributed, all of the values are either -12, -6, -0, +6, or +12. The negative numbers are expressed as (256+n), -where n is the negative number. So for example, -6 is expressed -as (256+(-6)) or 250 (FA hex). - -ZDE uses its ASCII table as follows. When reformatting a line, -ZDE counts each character as (30+table value)/30 of a column -wide. So if the offset is zero, the character is one column wide -(30/30 = 1) and ZDE increments the current column by one. If -the character's offset is -6, it counts as only (30+(-6)/30) or -24/30 columns wide, and ZDE increments the current column by -only 24/30. If the character's offset is +12, it counts as 42/30 -columns wide, and so on. When a full column is "lost" due to -characters with negative offsets, ZDE adds the next character to -the line without incrementing the column count. Similarly, when -enough "extra" columns are counted to equal a full character, ZDE -increments its column count without actually adding another -character to the line. - -To see the effects of this, try reformatting a paragraph or two, -first with PS on, then with it off. Lines of wide characters are -shortened on screen, while lines of narrow characters are allowed -to extend beyond the right margin. When the text is printed -proportionally, your printer reverses the process. Lines of wide -characters are lengthened and lines of narrow characters are -shortened, the net result being proportionally spaced text with an -even right margin. - -If your printer's proportional output is not properly compensated -for by ZDE, it is possible to install another offset table within -ZDE to suit your needs. The current table's address is given by -ZDENSTAL's "F" option. To find the location of a character's -offset, add its ASCII value to ZDE's table address and subtract -32. For example, the ASCII value for "A" is 65, so the location of -"A"'s offset is (table address+65-32) or (table address+33). - -You may adjust a character's offset to any value between -34 and -+35 decimal, but keep in mind that offsets if less than -29 may -result in lines that _never_ reformat since characters with -offsets of -30 or less take up no virtual space or less! To -calculate the proportional ratios used by your printer, it is best -to print out a line of thirty of each character in proportional -mode and compare the length of each line to the others. Most -characters should result in lines of roughly the same length; this -is your "base" length, and you should set the offsets of these -characters in ZDE to 00. Other lines will probably fall into four -or so other lengths; hopefully these lengths will correspond to an -even xx/30ths of the "base" length. To get the proper offset -value, just subtract the number of characters equal in length to -a line of "base" characters from 30. For example, if only 18 -capital "M"'s take up the same length as 30 base characters, the -offset for "M" is 30-18 or +12. If it takes 42 "i"'s to equal the -length of 30 base characters, the offset for "i" is 30-42 or -12. - -Once you have determined the offsets in 30ths of each -character's width from the base length, just plug these values -into ZDE's proportional table. You can use a patcher to alter a -few characters. For extensive modification, I have provided the -assembly language file ZDEPROP.Z80 which can be assembled to a -.HEX file overlay file for ZDE. Before assembling ZDEPROP.HEX, -you must edit the file and set the equate TABLE to the current -address of ZDE's proportional spacing table as given by -ZDENSTAL. Then overlay ZDE with ZDEPROP.HEX using MLOAD, -SID, or DDT. - -- End of ZDEPROP.DOC - - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDEPROP.Z80 b/Source/Images/d_zsdos/u1/ZDEPROP.Z80 deleted file mode 100644 index 715adcb0..00000000 --- a/Source/Images/d_zsdos/u1/ZDEPROP.Z80 +++ /dev/null @@ -1,119 +0,0 @@ -; -; File: ZDEPROP.Z80 - Default proportional width table for ZDE. -; Author: Carson Wilson -; Date: 02 Jun 90 -; Notes: Assembles to a .HEX file which overlays ZDE's native table. - -; EQUATES - -TABLE equ ????h ; Change "????" to the value given by ZDENSTAL - ; ..for "proportional table." -; - ORG TABLE - -; Offset Corresponding character - - db 0 ; space - db -12 ; ! - db 0 ; " - db 0 ; # - db 0 ; $ - db 6 ; % - db 6 ; & - db -12 ; ' - db -6 ; ( - db -6 ; ) - db 0 ; * - db 0 ; + - db -12 ; , - db 0 ; - - db -12 ; . - db 0 ; / -; - db 0 ; 0 - db 0 ; 1 - db 0 ; 2 - db 0 ; 3 - db 0 ; 4 - db 0 ; 5 - db 0 ; 6 - db 0 ; 7 - db 0 ; 8 - db 0 ; 9 -; - db -12 ; : - db -12 ; ; - db 0 ; < - db 0 ; = - db 0 ; > - db 0 ; ? -; - db 6 ; @ - db 6 ; A - db 6 ; B - db 6 ; C - db 6 ; D - db 6 ; E - db 6 ; F - db 6 ; G - db 6 ; H - db -6 ; I - db 0 ; J - db 6 ; K - db 6 ; L - db 12 ; M - db 6 ; N - db 6 ; O - db 6 ; P - db 6 ; Q - db 6 ; R - db 6 ; S - db 6 ; T - db 12 ; U - db 6 ; V - db 12 ; W - db 6 ; X - db 6 ; Y - db 0 ; Z - db -6 ; [ - db 0 ; \ - db -6 ; ] - db 0 ; ^ - db 0 ; _ - db -12 ; ` -; - db 0 ; a - db 6 ; b - db 0 ; c - db 6 ; d - db 0 ; e - db -6 ; f - db 6 ; g - db 6 ; h - db -12 ; i - db -6 ; j - db 6 ; k - db -12 ; l - db 12 ; m - db 6 ; n - db 0 ; o - db 6 ; p - db 6 ; q - db 0 ; r - db 0 ; s - db -6 ; t - db 6 ; u - db 6 ; v - db 12 ; w - db 0 ; x - db 6 ; y - db 0 ; z - db -6 ; { - db -12 ; | - db -6 ; } - db 0 ; ~ - - end - -; End ZDEPROP.Z80 - \ No newline at end of file diff --git a/Source/Images/d_zsdos/u1/ZDKCOM13.COM b/Source/Images/d_zsdos/u1/ZDKCOM13.COM deleted file mode 100644 index 040fd1c4..00000000 Binary files a/Source/Images/d_zsdos/u1/ZDKCOM13.COM and /dev/null differ diff --git a/Source/Images/d_zsdos/u1/ZDKCOM13.DOC b/Source/Images/d_zsdos/u1/ZDKCOM13.DOC deleted file mode 100644 index 75b83079..00000000 --- a/Source/Images/d_zsdos/u1/ZDKCOM13.DOC +++ /dev/null @@ -1,209 +0,0 @@ - - ZDKCOM - - Key File Compiler for ZDE - - Version 1.3 01 Jun 90 - - ZDKCOM and its documentation are adapted with permission from - VDKCOM12.LBR, by Fred Haines, Glendale Littera RCPM/QBBS, 818 - 956-6164. VDKCOM version 1.2 is copyright 1988 by Fred Haines, - and is released by the author to the CP/M community for all - reasonable noncommercial purposes. For the Z80 source code to - ZDKCOM, see ZDKCOM13.LBR. - - - CONTENTS - - 1. How to Use ZDKCOM. - 2. Programmer's Note. - - -1. How to Use ZDKCOM. - - ZDKCOM compiles an ASCII text file into a *.ZDK file of key -macros which ZDENSTAL will install in ZDE. It alsos convert an -existing ZDK file into a text file with the extension ZDT. It -allows you to create, edit, and re-edit complicated key macros -with a full-featured word processor - ZDE itself - instead of the -backspace-only line editor in ZDENSTAL. The syntax is: - - ZDKCOM .ZDT - converts text file to ZDK overlay - - ZDKCOM .ZDK - converts overlay to ZDT text file - - Use ZDE in NONDOCUMENT mode to type a file that looks like -what you see when you use the K option of ZDENSTAL, substituting -lower case "n" or "q" for the No Repeat and Quiet option -indicators and : - - qThis line would be for key 0 in Quiet mode.^M - nThis line would be for key 1 in No Repeat mode.^M - - This line would be key 3, with key 2 unassigned. - n^M^M^M - The line above, key 4, prints with two blank lines following it. - q"This is in quotes, but no carriage return at the end." - "This line is ^P^BMacro Key 7^P^B with embedded boldface codes."^M - q^VThis line turns insert on before printing the line.^A^A^A^A_^F^D_^M - n ^A^A^A^A - -...and so on. Lines correspond to the number keys in 0 to 9 -order, with blank lines for unassigned keys. Do NOT embed control -codes. Type everything in ASCII. For instance, to underline, -type out '^P^Swords underlined^P^S'. It's a good idea to make -hard carriage returns visible by toggling them on with the ^OD -command. ZDKCOM accepts trailing spaces as part of the macro, -even though you can't see them, so, if you don't want them, make -sure each line is terminated by a hard carriage return. - Individual key macro strings may not exceed 127 bytes in the -ZDK file, though they may in the ZDT text file, since ASCII -representations of single-byte control codes require two bytes, -and option flags and slashes don't contribute to the length of the -string. - The total of all strings may not exceed 498 output bytes. -This is two bytes less than allowed by ZDE and ZDENSTAL, but, -under the program's present logic, it would require an inordinate -amount of code to make those last two bytes available. If you -really need them, add them to the ZDK file with ZPATCH or any -other patcher, locate the last string-length byte, and add 2 (in -hex) to it. - For a quick demo, remove the leading spaces from the lines -below, mark them as a block, and write them out to .ZDT. Run -ZDKCOM .ZDT. Then load the resulting ZDK file into ZDE with -the command ZDENSTAL ZDE .ZDK. - - q^C^C^C^E^E^E^E^E^[^E - q^[b^[0^Qs^X^[=^M1^[= 1^S^V ^D^[!0^[1^Qb^B^Ku - ^[=^M0^V^I^V^B^G^[![^[0^X - ^[=^M0^T^B^N^[0^X - q^P^[^P^I^P^K^P^[9 - q^V^KrA0:LH.FMT^M - q^G^G^G^G^X - q^A^A^S - q^A^A^S - q^KrHEADER^M - -Key macro 0 measures off one full page if the top margin is 0 and -the page length is 58 lines. Adjust for different page lengths by -adding or subtracting ^E's. I use this macro to move from line 1 -of a page to line 1 of the next page. I then use key macro 9 to -read in a page header from a separate file that contains nothing -but the properly spaced header text with a # in place of the page -number. I search for # with a ^Qf and replace it with the -appropriate page numbers. - This happens so quickly on a 9 mhz SB180 with hard disk that -it is virtually unnoticeable, but there is a faster way to do it. -Just make up a header at the top of the first page, or, if you -want to start page headers only on page two, at the foot of the -file, and mark it as a block. Use key macro 0 to move from the -top line of a page to the top line of the next, and copy the -header into place with the ^KC command. Don't forget to erase the -original of the header at the foot of the file when you get there. - Key macro 1 softens and reforms a paragraph by removing the -hard carriage returns from the ends of each line. - Key macro 2 changes a document in flush left block format -(like this one) to indented paragraph form, and key macro 3 -changes it back again. - Key macro 4 embeds my DIABLO 1610-compatible printer's code -for setting a left margin in column 11 (^K=0Bh) in the document. -If I want another margin I add or subtract from 0Bh and overwrite -the ^K with the appropriate control character. You may well be -able to substitute your own printer's set left margin code for -this one. - Key macro 5 reads in a previously prepared letterhead stored -as LH.FMT on drive/user A0. - Key macro 6 removes four spaces or characters from the -beginning of each line, used to remove line numbers from the -beginnings of messages in modem capture files. - - -2. Programmer's Note. - - A ZDK file is a data structure four records long. The first -two bytes are an ID number which ZDENSTAL checks to ensure that it -is working with the correct version. The current number, 0250h, -is valid for several recent versions of ZDE. - These two bytes are followed by up to ten strings, each -preceded by a string-length byte which ZDE uses to index the -string's location. Each string is limited by the size of a buffer -in ZDE to 127 bytes. - An empty string is indicated by a string-length byte of 00h. -After the last byte of the last string, the remainder of the 512 -bytes are filled with 00h. - It is a peculiarity of ZDKCOM that it needs to write two null -bytes at the end of the file, which means that it will accept only -498 bytes for the total length of all strings (512, less two ID -bytes, less 10 string-length bytes, less these two more) rather -than the 500 that ZDE and ZDENSTAL allow. - When you look at the key macro buffer of ZDE using the K -option of ZDENSTAL, you see something that looks like this: - - <0>This line would be for key 0 in Quiet mode.^M - <1>This line would be for key 1 in No Repeat mode.^M - <2><> - <3>This line would be key 3, with key 2 unassigned. - <4>^M^M^M - <5>The line above, key 4, prints with two blank lines following it. - <6>"This is in quotes, but no carriage return at the end." - <7>"This line is ^P^BMacro Key 7^P^B with embedded boldface codes."^M - <8><> - <9><> - -The numbers down the side and the option indicators , , and -<> (no option) are supplied by ZDENSTAL. The ZDT text file -version of the same macro keys would omit the string numbers and -no option indicators, and convert the and to simple lower -case 'n' and 'q'. If you need lower case 'n' or 'q' as the first -character of a key macro, just precede it with a slash, which will -be ignored. - ZDKCOM recognizes blank lines as unassigned keys. These -produce an "error" message when invoked by ZDE. - ZDE recognizes a No Repeat option if the the high bit is set -on the first byte of the macro string after the length byte, and a -Quiet option if the high bit is set on both of the first two bytes -of the string. - The translation procedure from text to overlay requires: - - Enter two-byte ID string 02h 50h in output file. - - Enter 00h to save a place for a string length byte. - - Check for "n" or "q" as first three bytes of new string and add - 80h to the next byte or next two bytes input as required. - - Read in the rest of the string byte by byte and output each byte - to the output file. If "^" appears in the string, drop it and - subtract 40h from next byte to make it into a real control - character. If "/" appears, ignore it and print the next - character literally. "/^" prints "^" rather than turn the - character following the carat into a control code, and "//" - prints a single slash. A single input slash is ignored. - - When the CRLF pair is encountered in the input text file, - convert it to a 00h place marker for the length of the next - string. Get the number of bytes output in the last string and - write it to the position of the string-length byte at the head - of the preceding string. - - When the text file's ^Z EOF is encountered, fill the remainder - of the total 512 bytes with 00h and close the files. - -When converting ZDK overlays to ZDT text files, the procedure is -more or less reversed. ZDKCOM converts the string length bytes to -CRLF pairs, the control code bytes to two-byte ASCII strings '^c', -and finishes off the file when all strings are accounted for by -inserting an EOF ^Z. - In addition, ZDKCOM has error checking for file opening and -closing and for individual and overall string length, and it -reports activity to keep the user from thinking the program has -hung, though the counters on the screen are otherwise meaningless. - The structure of the four-sector ZDK file in CP/M is so -similar to the eight-sector MS/DOS version that you can use -ZDKCOM, along with a patcher, to create a VDK file for -installation in VDE12, the MS/DOS version of ZDE. Make up the ZDT -file as you would for CP/M, then patch the second ID byte from 50h -to 60h and add four records of nulls. - \ No newline at end of file diff --git a/Source/Images/diskdefs b/Source/Images/diskdefs index 937bfcf2..81d962cc 100644 --- a/Source/Images/diskdefs +++ b/Source/Images/diskdefs @@ -271,6 +271,19 @@ diskdef interak os 2.2 end +# RomWBW 256KB ROM (128KB reserved, 128KB ROM Disk) + +diskdef wbw_rom256 + seclen 512 + tracks 4 + sectrk 64 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 0 + os 2.2 +end + # RomWBW 512KB ROM (128KB reserved, 384KB ROM Disk) diskdef wbw_rom512 @@ -297,121 +310,430 @@ diskdef wbw_rom1024 os 2.2 end -# UNA 512KB ROM (128KB reserved, 384KB ROM Disk) +# RomWBW 720K floppy media -diskdef una_rom512 +diskdef wbw_fd720 seclen 512 - tracks 12 - sectrk 64 + tracks 160 + sectrk 9 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 4 + os 2.2 +end + +# RomWBW 1.44M floppy media + +diskdef wbw_fd144 + seclen 512 + tracks 160 + sectrk 18 blocksize 2048 maxdir 256 skew 0 - boottrk 0 + boottrk 2 os 2.2 end -# UNA 512KB ROM (128KB reserved, 896KB ROM Disk) +# RomWBW 360K floppy media -diskdef una_rom1024 +diskdef wbw_fd360 seclen 512 - tracks 28 - sectrk 64 + tracks 80 + sectrk 9 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 4 + os 2.2 +end + +# RomWBW 1.20M floppy media + +diskdef wbw_fd120 + seclen 512 + tracks 160 + sectrk 15 blocksize 2048 maxdir 256 skew 0 - boottrk 0 + boottrk 2 os 2.2 end -# RomWBW 8MB Hard Disk, LU 0-3 -diskdef wbw_hd0 +# RomWBW 8320KB Hard Disk Slice (512 directory entry format) +# Legacy format: 512 dir entries, 16,630 sectors / slice + +diskdef wbw_hd512 seclen 512 - tracks 65 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 1 + boottrk 16 os 2.2 end -diskdef wbw_hd1 +# First 4 slices of wbw_hd512 +# Assumes first slice (slice 0) starts at sector 0 +# Offset of any slice (in tracks) = (1040 * ) + +diskdef wbw_hd512_0 seclen 512 - tracks 130 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 66 + boottrk 16 + offset 0T os 2.2 end -diskdef wbw_hd2 +diskdef wbw_hd512_1 seclen 512 - tracks 195 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 131 + boottrk 16 + offset 1040T os 2.2 end -diskdef wbw_hd3 +diskdef wbw_hd512_2 seclen 512 - tracks 260 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 196 + boottrk 16 + offset 2080T os 2.2 end -# RomWBW 720K floppy media -diskdef wbw_fd720 +diskdef wbw_hd512_3 seclen 512 - tracks 160 - sectrk 9 - blocksize 2048 - maxdir 128 + tracks 1040 + sectrk 16 + blocksize 4096 + maxdir 512 skew 0 - boottrk 4 + boottrk 16 + offset 3120T os 2.2 end -# RomWBW 1.44M floppy media -diskdef wbw_fd144 +# RomWBW 8MB Hard Disk (1024 directory entry format) +# New format: 1024 dir entries, 16,384 sectors / slice +# Pure filesystem image, no MBR prefix + +diskdef wbw_hd1k seclen 512 - tracks 160 - sectrk 18 - blocksize 2048 - maxdir 256 + tracks 1024 + sectrk 16 + blocksize 4096 + maxdir 1024 skew 0 boottrk 2 os 2.2 end -# RomWBW 360K floppy media -diskdef wbw_fd360 +# First 4 slices of wbw_hd1k +# Assumes standard 1MB prefix +# Offset of any slice (in tracks) = 128 + (1024 * ) + +diskdef rc2014a + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 1 + offset 0T + os 2.2 +end + +diskdef rc2014b + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 512T + os 2.2 +end + +diskdef rc2014c + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 1024T + os 2.2 +end + +diskdef rc2014d + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 1536T + os 2.2 +end + +diskdef rc2014e + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 2048T + os 2.2 +end + +diskdef rc2014f + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 2560T + os 2.2 +end + +diskdef rc2014g + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 3072T + os 2.2 +end + +diskdef rc2014h + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 3584T + os 2.2 +end + +diskdef rc2014i + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 4096T + os 2.2 +end + +diskdef rc2014j + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 4608T + os 2.2 +end + +diskdef rc2014k + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 5120T + os 2.2 +end + +diskdef rc2014l + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 5632T + os 2.2 +end + +diskdef rc2014m + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 6144T + os 2.2 +end + +diskdef rc2014n + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 6656T + os 2.2 +end + +diskdef rc2014o + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 7168T + os 2.2 +end + +diskdef rc2014p + seclen 512 + tracks 128 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 7680T os 2.2 end diff --git a/Source/Images/fd_bp.txt b/Source/Images/fd_bp.txt new file mode 100644 index 00000000..6b251b2a --- /dev/null +++ b/Source/Images/fd_bp.txt @@ -0,0 +1,54 @@ +# +# Add ZSystem images +# +../BPBIOS/*.img 0: +../BPBIOS/*.rel 0: +../BPBIOS/*.zrl 0: +../BPBIOS/*.zex 0: +../BPBIOS/bpbuild.com 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 15: +../../Binary/Apps/assign.com 15: +../../Binary/Apps/cpuspd.com 15: +../../Binary/Apps/fat.com 15: +../../Binary/Apps/fdu.com 15: +../../Binary/Apps/fdu.doc 15: +../../Binary/Apps/format.com 15: +../../Binary/Apps/mode.com 15: +../../Binary/Apps/rtc.com 15: +../../Binary/Apps/survey.com 15: +../../Binary/Apps/syscopy.com 15: +../../Binary/Apps/sysgen.com 15: +../../Binary/Apps/talk.com 15: +../../Binary/Apps/tbasic.com 15: +../../Binary/Apps/timer.com 15: +../../Binary/Apps/tune.com 15: +../../Binary/Apps/xm.com 15: +../../Binary/Apps/zmp.com 15: +../../Binary/Apps/zmp.hlp 15: +../../Binary/Apps/zmp.doc 15: +../../Binary/Apps/zmxfer.ovr 15: +../../Binary/Apps/zmterm.ovr 15: +../../Binary/Apps/zminit.ovr 15: +../../Binary/Apps/zmconfig.ovr 15: +../../Binary/Apps/zmd.com 15: +../../Binary/Apps/vgmplay.com 15: + +# Add Tune sample files +# +../../Binary/Apps/Tunes/*.pt? 3: +../../Binary/Apps/Tunes/*.mym 3: +../../Binary/Apps/Tunes/*.vgm 3: +# +# Add Common Applications +# +Common/All/*.* 15: +Common/CPM22/*.* 15: +#Common/Z/u10/*.* 10: +Common/Z/u14/*.* 14: +Common/Z/u15/*.* 15: +Common/Z3/u10/*.* 10: +Common/Z3/u14/*.* 14: +Common/Z3/u15/*.* 15: diff --git a/Source/Images/fd_cpm22.txt b/Source/Images/fd_cpm22.txt new file mode 100644 index 00000000..859b7e30 --- /dev/null +++ b/Source/Images/fd_cpm22.txt @@ -0,0 +1,48 @@ +# +# Add the ReadMe document +# +d_cpm22/ReadMe.txt 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 0: +../../Binary/Apps/assign.com 0: +../../Binary/Apps/cpuspd.com 0: +../../Binary/Apps/fat.com 0: +../../Binary/Apps/fdu.com 0: +../../Binary/Apps/fdu.doc 0: +../../Binary/Apps/format.com 0: +../../Binary/Apps/mode.com 0: +../../Binary/Apps/rtc.com 0: +../../Binary/Apps/survey.com 0: +../../Binary/Apps/syscopy.com 0: +../../Binary/Apps/sysgen.com 0: +../../Binary/Apps/talk.com 0: +../../Binary/Apps/tbasic.com 0: +../../Binary/Apps/timer.com 0: +../../Binary/Apps/tune.com 0: +../../Binary/Apps/xm.com 0: +../../Binary/Apps/zmp.com 0: +../../Binary/Apps/zmp.hlp 0: +../../Binary/Apps/zmp.doc 0: +../../Binary/Apps/zmxfer.ovr 0: +../../Binary/Apps/zmterm.ovr 0: +../../Binary/Apps/zminit.ovr 0: +../../Binary/Apps/zmconfig.ovr 0: +../../Binary/Apps/zmd.com 0: +../../Binary/Apps/vgmplay.com 0: +# +# Add Tune sample files +# +../../Binary/Apps/Tunes/*.pt? 3: +../../Binary/Apps/Tunes/*.mym 3: +../../Binary/Apps/Tunes/*.vgm 3: +# +# Add OS image +# +../CPM22/cpm_wbw.sys 0:cpm.sys +# +# Add Common Applications +# +Common/All/*.* 0: +Common/CPM22/*.* 0: diff --git a/Source/Images/fd_cpm3.txt b/Source/Images/fd_cpm3.txt new file mode 100644 index 00000000..43c3e8ba --- /dev/null +++ b/Source/Images/fd_cpm3.txt @@ -0,0 +1,54 @@ +# +# Add files from CPM3 build +# +../CPM3/cpmldr.com 0: +../CPM3/cpmldr.sys 0: +../CPM3/ccp.com 0: +../CPM3/gencpm.com 0: +../CPM3/genres.dat 0: +../CPM3/genbnk.dat 0: +../CPM3/bios3.spr 0: +../CPM3/bnkbios3.spr 0: +../CPM3/bdos3.spr 0: +../CPM3/bnkbdos3.spr 0: +../CPM3/resbdos3.spr 0: +../CPM3/cpm3res.sys 0: +../CPM3/cpm3bnk.sys 0: +../CPM3/gencpm.dat 0: +../CPM3/cpm3.sys 0: +../CPM3/readme.1st 0: +../CPM3/cpm3fix.pat 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 0: +../../Binary/Apps/assign.com 0: +../../Binary/Apps/cpuspd.com 0: +../../Binary/Apps/fat.com 0: +../../Binary/Apps/fdu.com 0: +../../Binary/Apps/fdu.doc 0: +../../Binary/Apps/format.com 0: +../../Binary/Apps/mode.com 0: +../../Binary/Apps/rtc.com 0: +../../Binary/Apps/survey.com 0: +../../Binary/Apps/syscopy.com 0: +#../../Binary/Apps/sysgen.com 0: +#../../Binary/Apps/talk.com 0: +../../Binary/Apps/tbasic.com 0: +../../Binary/Apps/timer.com 0: +../../Binary/Apps/tune.com 0: +../../Binary/Apps/xm.com 0: +../../Binary/Apps/zmp.com 0: +../../Binary/Apps/zmp.hlp 0: +../../Binary/Apps/zmp.doc 0: +../../Binary/Apps/zmxfer.ovr 0: +../../Binary/Apps/zmterm.ovr 0: +../../Binary/Apps/zminit.ovr 0: +../../Binary/Apps/zmconfig.ovr 0: +../../Binary/Apps/zmd.com 0: +../../Binary/Apps/vgmplay.com 0: +# +# Add Common Applications +# +Common/All/*.* 0: +Common/CPM3/*.* 0: diff --git a/Source/Images/fd_nzcom.txt b/Source/Images/fd_nzcom.txt new file mode 100644 index 00000000..a569b365 --- /dev/null +++ b/Source/Images/fd_nzcom.txt @@ -0,0 +1,32 @@ +# +# Add the ReadMe document +# +d_nzcom/ReadMe.txt 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 0: +../../Binary/Apps/assign.com 0: +../../Binary/Apps/cpuspd.com 0: +../../Binary/Apps/fat.com 0: +../../Binary/Apps/fdu.com 0: +../../Binary/Apps/rtc.com 0: +../../Binary/Apps/syscopy.com 0: +../../Binary/Apps/talk.com 0: +../../Binary/Apps/timer.com 0: +../../Binary/Apps/xm.com 0: +# +# Add OS images +# +../ZSDOS/zsys_wbw.sys 0:zsys.sys +# +# Add Common Applications +# +Common/All/*.* 0: +Common/CPM22/*.* 0: +#Common/Z/u10/*.* 0: +Common/Z/u14/*.* 0: +Common/Z/u15/*.* 0: +Common/Z3/u10/*.* 0: +Common/Z3/u14/*.* 0: +Common/Z3/u15/*.* 0: diff --git a/Source/Images/fd_qpm.txt b/Source/Images/fd_qpm.txt new file mode 100644 index 00000000..0d66ff3a --- /dev/null +++ b/Source/Images/fd_qpm.txt @@ -0,0 +1,52 @@ +# +# Add the ReadMe document +# +d_qpm/ReadMe.txt 0: +# +# Include CP/M 2.2 files +# +d_cpm22/u0/*.* 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 0: +../../Binary/Apps/assign.com 0: +../../Binary/Apps/cpuspd.com 0: +../../Binary/Apps/fat.com 0: +../../Binary/Apps/fdu.com 0: +../../Binary/Apps/fdu.doc 0: +../../Binary/Apps/format.com 0: +../../Binary/Apps/mode.com 0: +../../Binary/Apps/rtc.com 0: +../../Binary/Apps/survey.com 0: +../../Binary/Apps/syscopy.com 0: +../../Binary/Apps/sysgen.com 0: +../../Binary/Apps/talk.com 0: +../../Binary/Apps/tbasic.com 0: +../../Binary/Apps/timer.com 0: +../../Binary/Apps/tune.com 0: +../../Binary/Apps/xm.com 0: +../../Binary/Apps/zmp.com 0: +../../Binary/Apps/zmp.hlp 0: +../../Binary/Apps/zmp.doc 0: +../../Binary/Apps/zmxfer.ovr 0: +../../Binary/Apps/zmterm.ovr 0: +../../Binary/Apps/zminit.ovr 0: +../../Binary/Apps/zmconfig.ovr 0: +../../Binary/Apps/zmd.com 0: +../../Binary/Apps/vgmplay.com 0: +# +# Add Tune sample files +# +../../Binary/Apps/Tunes/*.pt? 3: +../../Binary/Apps/Tunes/*.mym 3: +../../Binary/Apps/Tunes/*.vgm 3: +# +# Add OS image +# +../CPM22/cpm_wbw.sys 0:cpm.sys +# +# Add Common Applications +# +Common/All/*.* 0: +Common/CPM22/*.* 0: diff --git a/Source/Images/fd_zpm3.txt b/Source/Images/fd_zpm3.txt new file mode 100644 index 00000000..53716342 --- /dev/null +++ b/Source/Images/fd_zpm3.txt @@ -0,0 +1,49 @@ +# +# Add files from ZPM3 build +# +../ZPM3/zpmldr.com 0: +../ZPM3/zpmldr.sys 0: +../CPM3/cpmldr.com 0: +../CPM3/cpmldr.sys 0: +../ZPM3/autotog.com 15: +../ZPM3/clrhist.com 15: +../ZPM3/setz3.com 15: +../ZPM3/cpm3.sys 0: +../ZPM3/zccp.com 0: +../ZPM3/zinstal.zpm 0: +../ZPM3/startzpm.com 0: +../ZPM3/makedos.com 0: +../ZPM3/gencpm.dat 0: +../ZPM3/bnkbios3.spr 0: +../ZPM3/bnkbdos3.spr 0: +../ZPM3/resbdos3.spr 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 15: +../../Binary/Apps/assign.com 15: +../../Binary/Apps/cpuspd.com 15: +../../Binary/Apps/fat.com 15: +../../Binary/Apps/fdu.com 15: +#../../Binary/Apps/fdu.doc 15: +../../Binary/Apps/mode.com 15: +../../Binary/Apps/rtc.com 15: +../../Binary/Apps/survey.com 15: +../../Binary/Apps/syscopy.com 15: +../../Binary/Apps/sysgen.com 15: +../../Binary/Apps/talk.com 15: +#../../Binary/Apps/tbasic.com 15: +../../Binary/Apps/timer.com 15: +#../../Binary/Apps/tune.com 15: +../../Binary/Apps/xm.com 15: +# +# Add Common Applications +# +Common/All/*.* 15: +Common/CPM3/*.* 15: +#Common/Z/u10/*.* 10: +Common/Z/u14/*.* 14: +Common/Z/u15/*.* 15: +Common/Z3/u10/*.* 10: +Common/Z3/u14/*.* 14: +Common/Z3/u15/*.* 15: diff --git a/Source/Images/fd_zsdos.txt b/Source/Images/fd_zsdos.txt new file mode 100644 index 00000000..1b7acc71 --- /dev/null +++ b/Source/Images/fd_zsdos.txt @@ -0,0 +1,64 @@ +# +# Add the ReadMe document +# +d_zsdos/ReadMe.txt 0: +# +# Include selected CP/M 2.2 files +# +d_cpm22/u0/ASM.COM 0: +d_cpm22/u0/LIB.COM 0: +d_cpm22/u0/LINK.COM 0: +d_cpm22/u0/LOAD.COM 0: +d_cpm22/u0/MAC.COM 0: +#d_cpm22/u0/PIP.COM 0: ??? +d_cpm22/u0/RMAC.COM 0: +d_cpm22/u0/STAT.COM 0: +d_cpm22/u0/SUBMIT.COM 0: +d_cpm22/u0/XSUB.COM 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 0: +../../Binary/Apps/assign.com 0: +../../Binary/Apps/cpuspd.com 0: +../../Binary/Apps/fat.com 0: +../../Binary/Apps/fdu.com 0: +../../Binary/Apps/fdu.doc 0: +../../Binary/Apps/format.com 0: +../../Binary/Apps/mode.com 0: +../../Binary/Apps/rtc.com 0: +../../Binary/Apps/survey.com 0: +../../Binary/Apps/syscopy.com 0: +../../Binary/Apps/sysgen.com 0: +../../Binary/Apps/talk.com 0: +../../Binary/Apps/tbasic.com 0: +../../Binary/Apps/timer.com 0: +../../Binary/Apps/tune.com 0: +../../Binary/Apps/xm.com 0: +../../Binary/Apps/zmp.com 0: +../../Binary/Apps/zmp.hlp 0: +../../Binary/Apps/zmp.doc 0: +../../Binary/Apps/zmxfer.ovr 0: +../../Binary/Apps/zmterm.ovr 0: +../../Binary/Apps/zminit.ovr 0: +../../Binary/Apps/zmconfig.ovr 0: +../../Binary/Apps/zmd.com 0: +../../Binary/Apps/vgmplay.com 0: +# +# Add Tune sample files +# +../../Binary/Apps/Tunes/*.pt? 3: +#../../Binary/Apps/Tunes/*.mym 3: +../../Binary/Apps/Tunes/*.vgm 3: +# +# Add OS image +# +../ZSDOS/zsys_wbw.sys 0:zsys.sys +# +# Add Common Applications +# +Common/All/*.* 0: +Common/CPM22/*.* 0: +#Common/Z/u10/*.* 0: +Common/Z/u14/*.* 0: +Common/Z/u15/*.* 0: diff --git a/Source/Images/hd1k_prefix.dat b/Source/Images/hd1k_prefix.dat new file mode 100644 index 00000000..8b9b89f2 Binary files /dev/null and b/Source/Images/hd1k_prefix.dat differ diff --git a/Source/Images/hd_bp.txt b/Source/Images/hd_bp.txt new file mode 100644 index 00000000..491c683f --- /dev/null +++ b/Source/Images/hd_bp.txt @@ -0,0 +1,62 @@ +# +# Add ZSystem images +# +../BPBIOS/*.img 0: +../BPBIOS/*.rel 0: +../BPBIOS/*.zrl 0: +../BPBIOS/*.zex 0: +../BPBIOS/bpbuild.com 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 15: +../../Binary/Apps/assign.com 15: +../../Binary/Apps/cpuspd.com 15: +../../Binary/Apps/fat.com 15: +../../Binary/Apps/fdu.com 15: +../../Binary/Apps/fdu.doc 15: +../../Binary/Apps/format.com 15: +../../Binary/Apps/mode.com 15: +../../Binary/Apps/rtc.com 15: +../../Binary/Apps/survey.com 15: +../../Binary/Apps/syscopy.com 15: +../../Binary/Apps/sysgen.com 15: +../../Binary/Apps/talk.com 15: +../../Binary/Apps/tbasic.com 15: +../../Binary/Apps/timer.com 15: +../../Binary/Apps/tune.com 15: +../../Binary/Apps/xm.com 15: +../../Binary/Apps/zmp.com 15: +../../Binary/Apps/zmp.hlp 15: +../../Binary/Apps/zmp.doc 15: +../../Binary/Apps/zmxfer.ovr 15: +../../Binary/Apps/zmterm.ovr 15: +../../Binary/Apps/zminit.ovr 15: +../../Binary/Apps/zmconfig.ovr 15: +../../Binary/Apps/zmd.com 15: +../../Binary/Apps/vgmplay.com 15: +# +../../Binary/Apps/Test/*.com 2: +Test/*.* 2: +# +# Add Tune sample files +# +../../Binary/Apps/Tunes/*.pt? 3: +../../Binary/Apps/Tunes/*.mym 3: +../../Binary/Apps/Tunes/*.vgm 3: +# +# Add CPNET client files +# +cpnet12/*.* 4: +# +# Add Common Applications +# +Common/All/*.* 15: +Common/CPM22/*.* 15: +#Common/Z/u10/*.* 10: +Common/Z/u14/*.* 14: +Common/Z/u15/*.* 15: +Common/Z3/u10/*.* 10: +Common/Z3/u14/*.* 14: +Common/Z3/u15/*.* 15: +Common/SIMH/*.* 13: diff --git a/Source/Images/hd_cpm22.txt b/Source/Images/hd_cpm22.txt new file mode 100644 index 00000000..1643bff5 --- /dev/null +++ b/Source/Images/hd_cpm22.txt @@ -0,0 +1,56 @@ +# +# Add the ReadMe document +# +d_cpm22/ReadMe.txt 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 0: +../../Binary/Apps/assign.com 0: +../../Binary/Apps/cpuspd.com 0: +../../Binary/Apps/fat.com 0: +../../Binary/Apps/fdu.com 0: +../../Binary/Apps/fdu.doc 0: +../../Binary/Apps/format.com 0: +../../Binary/Apps/mode.com 0: +../../Binary/Apps/rtc.com 0: +../../Binary/Apps/survey.com 0: +../../Binary/Apps/syscopy.com 0: +../../Binary/Apps/sysgen.com 0: +../../Binary/Apps/talk.com 0: +../../Binary/Apps/tbasic.com 0: +../../Binary/Apps/timer.com 0: +../../Binary/Apps/tune.com 0: +../../Binary/Apps/xm.com 0: +../../Binary/Apps/zmp.com 0: +../../Binary/Apps/zmp.hlp 0: +../../Binary/Apps/zmp.doc 0: +../../Binary/Apps/zmxfer.ovr 0: +../../Binary/Apps/zmterm.ovr 0: +../../Binary/Apps/zminit.ovr 0: +../../Binary/Apps/zmconfig.ovr 0: +../../Binary/Apps/zmd.com 0: +../../Binary/Apps/vgmplay.com 0: +# +../../Binary/Apps/Test/*.com 2: +Test/*.* 2: +# +# Add Tune sample files +# +../../Binary/Apps/Tunes/*.pt? 3: +../../Binary/Apps/Tunes/*.mym 3: +../../Binary/Apps/Tunes/*.vgm 3: +# +# Add CPNET client files +# +cpnet12/*.* 4: +# +# Add OS image +# +../CPM22/cpm_wbw.sys 0:cpm.sys +# +# Add Common Applications +# +Common/All/*.* 0: +Common/CPM22/*.* 0: +Common/SIMH/*.* 13: diff --git a/Source/Images/hd_cpm3.txt b/Source/Images/hd_cpm3.txt new file mode 100644 index 00000000..366224f5 --- /dev/null +++ b/Source/Images/hd_cpm3.txt @@ -0,0 +1,68 @@ +# +# Add files from CPM3 build +# +../CPM3/cpmldr.com 0: +../CPM3/cpmldr.sys 0: +../CPM3/ccp.com 0: +../CPM3/gencpm.com 0: +../CPM3/genres.dat 0: +../CPM3/genbnk.dat 0: +../CPM3/bios3.spr 0: +../CPM3/bnkbios3.spr 0: +../CPM3/bdos3.spr 0: +../CPM3/bnkbdos3.spr 0: +../CPM3/resbdos3.spr 0: +../CPM3/cpm3res.sys 0: +../CPM3/cpm3bnk.sys 0: +../CPM3/gencpm.dat 0: +../CPM3/cpm3.sys 0: +../CPM3/readme.1st 0: +../CPM3/cpm3fix.pat 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 0: +../../Binary/Apps/assign.com 0: +../../Binary/Apps/cpuspd.com 0: +../../Binary/Apps/fat.com 0: +../../Binary/Apps/fdu.com 0: +../../Binary/Apps/fdu.doc 0: +../../Binary/Apps/format.com 0: +../../Binary/Apps/mode.com 0: +../../Binary/Apps/rtc.com 0: +../../Binary/Apps/survey.com 0: +../../Binary/Apps/syscopy.com 0: +#../../Binary/Apps/sysgen.com 0: +#../../Binary/Apps/talk.com 0: +../../Binary/Apps/tbasic.com 0: +../../Binary/Apps/timer.com 0: +../../Binary/Apps/tune.com 0: +../../Binary/Apps/xm.com 0: +../../Binary/Apps/zmp.com 0: +../../Binary/Apps/zmp.hlp 0: +../../Binary/Apps/zmp.doc 0: +../../Binary/Apps/zmxfer.ovr 0: +../../Binary/Apps/zmterm.ovr 0: +../../Binary/Apps/zminit.ovr 0: +../../Binary/Apps/zmconfig.ovr 0: +../../Binary/Apps/zmd.com 0: +../../Binary/Apps/vgmplay.com 0: +# +../../Binary/Apps/Test/*.com 2: +Test/*.* 2: +# +# Add Tune sample files +# +../../Binary/Apps/Tunes/*.pt? 3: +../../Binary/Apps/Tunes/*.mym 3: +../../Binary/Apps/Tunes/*.vgm 3: +# +# Add CPNET client files +# +cpnet3/*.* 4: +# +# Add Common Applications +# +Common/All/*.* 0: +Common/CPM3/*.* 0: +Common/SIMH/*.* 13: diff --git a/Source/Images/hd_dos65.txt b/Source/Images/hd_dos65.txt new file mode 100644 index 00000000..7d6b7d12 --- /dev/null +++ b/Source/Images/hd_dos65.txt @@ -0,0 +1,3 @@ +# +# Nothing to add for now +# diff --git a/Source/Images/hd_nzcom.txt b/Source/Images/hd_nzcom.txt new file mode 100644 index 00000000..04914198 --- /dev/null +++ b/Source/Images/hd_nzcom.txt @@ -0,0 +1,79 @@ +# +# Add the ReadMe document +# +d_nzcom/ReadMe.txt 0: +# +# Include selected CP/M 2.2 files +# +d_cpm22/u0/ASM.COM 0: +d_cpm22/u0/LIB.COM 0: +d_cpm22/u0/LINK.COM 0: +d_cpm22/u0/LOAD.COM 0: +d_cpm22/u0/MAC.COM 0: +#d_cpm22/u0/PIP.COM 0: ??? +d_cpm22/u0/RMAC.COM 0: +d_cpm22/u0/STAT.COM 0: +d_cpm22/u0/SUBMIT.COM 0: +d_cpm22/u0/XSUB.COM 0: +# +# Include ZSDOS files +# +d_zsdos/u0/*.* 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 0: +../../Binary/Apps/assign.com 0: +../../Binary/Apps/cpuspd.com 0: +../../Binary/Apps/fat.com 0: +../../Binary/Apps/fdu.com 0: +../../Binary/Apps/fdu.doc 0: +../../Binary/Apps/format.com 0: +../../Binary/Apps/mode.com 0: +../../Binary/Apps/rtc.com 0: +../../Binary/Apps/survey.com 0: +../../Binary/Apps/syscopy.com 0: +../../Binary/Apps/sysgen.com 0: +../../Binary/Apps/talk.com 0: +../../Binary/Apps/tbasic.com 0: +../../Binary/Apps/timer.com 0: +../../Binary/Apps/tune.com 0: +../../Binary/Apps/xm.com 0: +../../Binary/Apps/zmp.com 0: +../../Binary/Apps/zmp.hlp 0: +../../Binary/Apps/zmp.doc 0: +../../Binary/Apps/zmxfer.ovr 0: +../../Binary/Apps/zmterm.ovr 0: +../../Binary/Apps/zminit.ovr 0: +../../Binary/Apps/zmconfig.ovr 0: +../../Binary/Apps/zmd.com 0: +../../Binary/Apps/vgmplay.com 0: +# +../../Binary/Apps/Test/*.com 2: +Test/*.* 2: +# +# Add Tune sample files +# +../../Binary/Apps/Tunes/*.pt? 3: +../../Binary/Apps/Tunes/*.mym 3: +../../Binary/Apps/Tunes/*.vgm 3: +# +# Add CPNET client files +# +cpnet12/*.* 4: +# +# Add OS images +# +../ZSDOS/zsys_wbw.sys 0:zsys.sys +# +# Add Common Applications +# +Common/All/*.* 0: +Common/CPM22/*.* 0: +#Common/Z/u10/*.* 0: +Common/Z/u14/*.* 0: +Common/Z/u15/*.* 0: +Common/Z3/u10/*.* 0: +Common/Z3/u14/*.* 0: +Common/Z3/u15/*.* 0: +Common/SIMH/*.* 13: diff --git a/Source/Images/hd_qpm.txt b/Source/Images/hd_qpm.txt new file mode 100644 index 00000000..5b470527 --- /dev/null +++ b/Source/Images/hd_qpm.txt @@ -0,0 +1,60 @@ +# +# Add the ReadMe document +# +d_qpm/ReadMe.txt 0: +# +# Include CP/M 2.2 files +# +d_cpm22/u0/*.* 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 0: +../../Binary/Apps/assign.com 0: +../../Binary/Apps/cpuspd.com 0: +../../Binary/Apps/fat.com 0: +../../Binary/Apps/fdu.com 0: +../../Binary/Apps/fdu.doc 0: +../../Binary/Apps/format.com 0: +../../Binary/Apps/mode.com 0: +../../Binary/Apps/rtc.com 0: +../../Binary/Apps/survey.com 0: +../../Binary/Apps/syscopy.com 0: +../../Binary/Apps/sysgen.com 0: +../../Binary/Apps/talk.com 0: +../../Binary/Apps/tbasic.com 0: +../../Binary/Apps/timer.com 0: +../../Binary/Apps/tune.com 0: +../../Binary/Apps/xm.com 0: +../../Binary/Apps/zmp.com 0: +../../Binary/Apps/zmp.hlp 0: +../../Binary/Apps/zmp.doc 0: +../../Binary/Apps/zmxfer.ovr 0: +../../Binary/Apps/zmterm.ovr 0: +../../Binary/Apps/zminit.ovr 0: +../../Binary/Apps/zmconfig.ovr 0: +../../Binary/Apps/zmd.com 0: +../../Binary/Apps/vgmplay.com 0: +# +../../Binary/Apps/Test/*.com 2: +Test/*.* 2: +# +# Add Tune sample files +# +../../Binary/Apps/Tunes/*.pt? 3: +../../Binary/Apps/Tunes/*.mym 3: +../../Binary/Apps/Tunes/*.vgm 3: +# +# Add CPNET client files +# +cpnet12/*.* 4: +# +# Add OS image +# +../CPM22/cpm_wbw.sys 0:cpm.sys +# +# Add Common Applications +# +Common/All/*.* 0: +Common/CPM22/*.* 0: +Common/SIMH/*.* 13: diff --git a/Source/Images/hd_zpm3.txt b/Source/Images/hd_zpm3.txt new file mode 100644 index 00000000..9452391b --- /dev/null +++ b/Source/Images/hd_zpm3.txt @@ -0,0 +1,73 @@ +# +# Add files from ZPM3 build +# +../ZPM3/zpmldr.com 0: +../ZPM3/zpmldr.sys 0: +../CPM3/cpmldr.com 0: +../CPM3/cpmldr.sys 0: +../ZPM3/autotog.com 15: +../ZPM3/clrhist.com 15: +../ZPM3/setz3.com 15: +../ZPM3/cpm3.sys 0: +../ZPM3/zccp.com 0: +../ZPM3/zinstal.zpm 0: +../ZPM3/startzpm.com 0: +../ZPM3/makedos.com 0: +../ZPM3/gencpm.dat 0: +../ZPM3/bnkbios3.spr 0: +../ZPM3/bnkbdos3.spr 0: +../ZPM3/resbdos3.spr 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 15: +../../Binary/Apps/assign.com 15: +../../Binary/Apps/cpuspd.com 15: +../../Binary/Apps/fat.com 15: +../../Binary/Apps/fdu.com 15: +../../Binary/Apps/fdu.doc 15: +../../Binary/Apps/format.com 15: +../../Binary/Apps/mode.com 15: +../../Binary/Apps/rtc.com 15: +../../Binary/Apps/survey.com 15: +../../Binary/Apps/syscopy.com 15: +../../Binary/Apps/sysgen.com 15: +../../Binary/Apps/talk.com 15: +../../Binary/Apps/tbasic.com 15: +../../Binary/Apps/timer.com 15: +../../Binary/Apps/tune.com 15: +../../Binary/Apps/xm.com 15: +../../Binary/Apps/zmp.com 15: +../../Binary/Apps/zmp.hlp 15: +../../Binary/Apps/zmp.doc 15: +../../Binary/Apps/zmxfer.ovr 15: +../../Binary/Apps/zmterm.ovr 15: +../../Binary/Apps/zminit.ovr 15: +../../Binary/Apps/zmconfig.ovr 15: +../../Binary/Apps/zmd.com 15: +../../Binary/Apps/vgmplay.com 15: +# +../../Binary/Apps/Test/*.com 2: +Test/*.* 2: +# +# Add Tune sample files +# +../../Binary/Apps/Tunes/*.pt? 3: +../../Binary/Apps/Tunes/*.mym 3: +../../Binary/Apps/Tunes/*.vgm 3: +# +# Add CPNET client files +# +cpnet3/*.* 4: +# +# Add Common Applications +# +Common/All/*.* 15: +Common/CPM3/*.* 15: +#Common/Z/u10/*.* 10: +Common/Z/u14/*.* 14: +Common/Z/u15/*.* 15: +Common/Z3/u10/*.* 10: +Common/Z3/u14/*.* 14: +Common/Z3/u15/*.* 15: +Common/SIMH/*.* 13: diff --git a/Source/Images/hd_zsdos.txt b/Source/Images/hd_zsdos.txt new file mode 100644 index 00000000..9f6d0537 --- /dev/null +++ b/Source/Images/hd_zsdos.txt @@ -0,0 +1,72 @@ +# +# Add the ReadMe document +# +d_zsdos/ReadMe.txt 0: +# +# Include selected CP/M 2.2 files +# +d_cpm22/u0/ASM.COM 0: +d_cpm22/u0/LIB.COM 0: +d_cpm22/u0/LINK.COM 0: +d_cpm22/u0/LOAD.COM 0: +d_cpm22/u0/MAC.COM 0: +#d_cpm22/u0/PIP.COM 0: ??? +d_cpm22/u0/RMAC.COM 0: +d_cpm22/u0/STAT.COM 0: +d_cpm22/u0/SUBMIT.COM 0: +d_cpm22/u0/XSUB.COM 0: +# +# Add RomWBW utilities +# +#../../Binary/Apps/*.com 0: +../../Binary/Apps/assign.com 0: +../../Binary/Apps/cpuspd.com 0: +../../Binary/Apps/fat.com 0: +../../Binary/Apps/fdu.com 0: +../../Binary/Apps/fdu.doc 0: +../../Binary/Apps/format.com 0: +../../Binary/Apps/mode.com 0: +../../Binary/Apps/rtc.com 0: +../../Binary/Apps/survey.com 0: +../../Binary/Apps/syscopy.com 0: +../../Binary/Apps/sysgen.com 0: +../../Binary/Apps/talk.com 0: +../../Binary/Apps/tbasic.com 0: +../../Binary/Apps/timer.com 0: +../../Binary/Apps/tune.com 0: +../../Binary/Apps/xm.com 0: +../../Binary/Apps/zmp.com 0: +../../Binary/Apps/zmp.hlp 0: +../../Binary/Apps/zmp.doc 0: +../../Binary/Apps/zmxfer.ovr 0: +../../Binary/Apps/zmterm.ovr 0: +../../Binary/Apps/zminit.ovr 0: +../../Binary/Apps/zmconfig.ovr 0: +../../Binary/Apps/zmd.com 0: +../../Binary/Apps/vgmplay.com 0: +# +../../Binary/Apps/Test/*.com 2: +Test/*.* 2: +# +# Add Tune sample files +# +../../Binary/Apps/Tunes/*.pt? 3: +../../Binary/Apps/Tunes/*.mym 3: +../../Binary/Apps/Tunes/*.vgm 3: +# +# Add CPNET client files +# +cpnet12/*.* 4: +# +# Add OS image +# +../ZSDOS/zsys_wbw.sys 0:zsys.sys +# +# Add Common Applications +# +Common/All/*.* 0: +Common/CPM22/*.* 0: +#Common/Z/u10/*.* 0: +Common/Z/u14/*.* 0: +Common/Z/u15/*.* 0: +Common/SIMH/*.* 13: diff --git a/Source/Makefile b/Source/Makefile index 166bb4c1..74e1fa94 100644 --- a/Source/Makefile +++ b/Source/Makefile @@ -1,15 +1,21 @@ # # order is actually important, because of build dependencies # -SUBDIRS = Prop -SUBDIRS += Apps +SUBDIRS = HDIAG +SUBDIRS += Prop +SUBDIRS += Apps SUBDIRS += CBIOS SUBDIRS += Forth +SUBDIRS += TastyBasic SUBDIRS += Fonts -SUBDIRS += CPM22 ZCPR ZCPR-DJ ZSDOS -SUBDIRS += HBIOS CPM3 -SUBDIRS += ZPM3 -SUBDIRS += BPBIOS +SUBDIRS += CPM22 ZCPR ZCPR-DJ ZSDOS CPM3 ZPM3 +#SUBDIRS += BPBIOS +SUBDIRS += pSys +SUBDIRS += RomDsk +SUBDIRS += HBIOS SUBDIRS += Images +SUBDIRS += ZRC +SUBDIRS += ZZRC +#SUBDIRS += Doc TOOLS = ../Tools include $(TOOLS)/Makefile.inc diff --git a/Source/Prop/Build.cmd b/Source/Prop/Build.cmd index d46a4655..5cad6196 100644 --- a/Source/Prop/Build.cmd +++ b/Source/Prop/Build.cmd @@ -14,7 +14,6 @@ goto :eof :bstc echo. echo Building %1... -bstc Spin\%1 -e -l -if errorlevel 1 goto :eof -move /Y %1.eeprom "..\..\Binary" +bstc Spin\%1 -e -l || exit /b +move /Y %1.eeprom "..\..\Binary" || exit /b goto :eof diff --git a/Source/Prop/Spin/ParPortProp.spin b/Source/Prop/Spin/ParPortProp.spin index 6ecf049f..b5238e79 100644 --- a/Source/Prop/Spin/ParPortProp.spin +++ b/Source/Prop/Spin/ParPortProp.spin @@ -3,8 +3,8 @@ ************************************ * ParPortProp for RomWBW * * Interface to RBC ParPortProp * - * Version 0.96 * - * March 11, 2018 * + * Version 0.97 * + * May 9, 2020 * ************************************ Wayne Warthen @@ -29,11 +29,12 @@ Updates: 2018-03-11 WBW: Implement character attributes + 2020-05-09 WBW: Switch monitor refresh to 60Hz }} CON - VERSION = (((0 << 8) + 96) << 16) + 0 + VERSION = (((0 << 8) + 97) << 16) + 0 _CLKMODE = XTAL1 + PLL16X _XINFREQ = 5_000_000 @@ -440,6 +441,7 @@ PRI KeyboardStatus dbg.Hex(ByteVal, 2) dbg.Str(string(" ")) + dbg.NewLine ExecFunction(FUNC_PUTBYTE) @@ -608,7 +610,7 @@ PRI Activity DAT -strVer byte "F/W v0.96",0 +strVer byte "F/W v0.97",0 strHW byte "ParPortProp",0 strROM byte "RomWBW",0 diff --git a/Source/Prop/Spin/Parallax Serial Terminal.spin b/Source/Prop/Spin/Parallax Serial Terminal.spin index cc9e4be0..46c6eaaf 100644 --- a/Source/Prop/Spin/Parallax Serial Terminal.spin +++ b/Source/Prop/Spin/Parallax Serial Terminal.spin @@ -273,6 +273,7 @@ PUB NewLine {{Send cursor to new line (carriage return plus line feed).}} Char(NL) + Char(LF) PUB LineFeed {{Send cursor down to next line.}} diff --git a/Source/Prop/Spin/PropIO.spin b/Source/Prop/Spin/PropIO.spin index 3d677264..9e074fe0 100644 --- a/Source/Prop/Spin/PropIO.spin +++ b/Source/Prop/Spin/PropIO.spin @@ -3,8 +3,8 @@ ******************************* * PropIO for RomWBW * * Interface to RBC PropIO * - * Version 0.96 * - * March 11, 2018 * + * Version 0.97 * + * May 9, 2020 * ******************************* Wayne Warthen @@ -34,11 +34,12 @@ 2014-02-09 WBW: Clean up 2015-11-15 WBW: Added SD card capacity reporting 2018-03-11 WBW: Implement character attributes + 2020-05-09 WBW: Switch monitor refresh to 60Hz }} CON - VERSION = (((0 << 8) + 96) << 16) + 0 + VERSION = (((0 << 8) + 97) << 16) + 0 _CLKMODE = XTAL1 + PLL16X _XINFREQ = 5_000_000 @@ -337,7 +338,7 @@ PRI DumpBuffer(Buffer) | i, j DAT -strVer byte "F/W v0.96",0 +strVer byte "F/W v0.97",0 strHW byte "PropIO",0 strROM byte "RomWBW",0 diff --git a/Source/Prop/Spin/PropIO2.spin b/Source/Prop/Spin/PropIO2.spin index 9e01d3cb..ad1592f7 100644 --- a/Source/Prop/Spin/PropIO2.spin +++ b/Source/Prop/Spin/PropIO2.spin @@ -3,8 +3,8 @@ ********************************* * PropIO 2 for RomWBW * * Interface to RBC PropIO 2 * - * Version 0.96 * - * March 11, 2018 * + * Version 0.97 * + * May 9, 2020 * ********************************* Wayne Warthen @@ -34,11 +34,12 @@ 2014-02-08 WBW: Adaptation for PropIO 2 2015-11-15 WBW: Added SD card capacity reporting 2018-03-11 WBW: Implement character attributes + 2020-05-09 WBW: Switch monitor refresh to 60Hz }} CON - VERSION = (((0 << 8) + 96) << 16) + 0 + VERSION = (((0 << 8) + 97) << 16) + 0 _CLKMODE = XTAL1 + PLL16X _XINFREQ = 5_000_000 @@ -337,7 +338,7 @@ PRI DumpBuffer(Buffer) | i, j DAT -strVer byte "F/W v0.96",0 +strVer byte "F/W v0.97",0 strHW byte "PropIO v2",0 strROM byte "RomWBW",0 diff --git a/Source/Prop/Spin/vgacolour.spin b/Source/Prop/Spin/vgacolour.spin index c5cc2f80..0981fe55 100644 --- a/Source/Prop/Spin/vgacolour.spin +++ b/Source/Prop/Spin/vgacolour.spin @@ -20,6 +20,7 @@ CON +{ ' 640 x 480 @ 69Hz settings: 80 x 30 characters hp = 640 ' horizontal pixels @@ -33,6 +34,24 @@ CON hn = 1 ' horizontal normal sync state (0|1) vn = 1 ' vertical normal sync state (0|1) pr = 30 ' pixel rate in MHz at 80MHz system clock (5MHz granularity) +} + +'{ +' 640 x 480 @ 60Hz settings: 80 x 40 characters + + hp = 640 'horizontal pixels + vp = 480 'vertical pixels + hf = 16 'horizontal front porch pixels + hs = 96 'horizontal sync pixels + hb = 48 'horizontal back porch pixels + vf = 10 'vertical front porch lines + vs = 2 'vertical sync lines + vb = 33 'vertical back porch lines + hn = 1 'horizontal normal sync state (0|1) + vn = 1 'vertical normal sync state (0|1) + pr = 25 'pixel rate in MHz at 80MHz system clock (5MHz granularity) +'} + ' columns and rows diff --git a/Source/ReadMe.txt b/Source/ReadMe.txt index fd6b5ae0..02a601e0 100644 --- a/Source/ReadMe.txt +++ b/Source/ReadMe.txt @@ -6,7 +6,7 @@ *** *** *********************************************************************** -This directory is the root directory for the source tree for RomWBW. +This directory is the root directory of 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 @@ -20,23 +20,21 @@ customize your firmware to: 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. + - Add or remove programs or files contained on the disk images. -Thought not necessary, advanced users can easily modify any of -the software including the operating systems. +Virtually all source code is provided including the operating +systems themselves, so advanced users can easily modify any of +the software. A cross-platform approach is used to build the RomWBW firmware. The software is built using a modern Windows, Linux, or Mac computer, then the resulting firmware image is programmed into the ROM of your RetroBrew Computer CPU board. -Build System Requirements -------------------------- +Windows Build System Requirements +--------------------------------- -For Linux/Mac computers, refer to the ReadMe.unix file in the -top directory of the distribution. - -For Microsoft Windows computers, All that is required to build the +For Microsoft Windows computers, all that is required to build the firmware is the RomWBW distribution zip archive file. The zip archive package includes all of the required source code (including the operating systems) and the programs required to run @@ -44,30 +42,71 @@ 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. +Windows PowerShell. Windows 7 or greater is recommended. If you want +to use Windows Vista or XP, you will need to first install PowerShell +which available for free from Microsoft. Either 32 or 64 bit versions +of Microsoft Windows are fine.No additional programs need to be +installed to run the build. + +Linux Build System Requirements +------------------------------- + +You must have some standard system tools and libraries +installed, specifically: gcc, gnu make, libncurses, and srecord. +Typically, something like this will take care of adding all +required packages in Linux: + + sudo apt install build-essential libncurses-dev srecord + +Since there are many variants and releases of Linux, it is difficult +to ensure the build will work in all cases. The current stable +release of Ubuntu is used to verify the build runs. + +MacOS Build System Requirements +------------------------------- + +You will need to install the srecord package to complete the +build process: + + brew install srecord + +You may encounter a failure reading or writing files. This is caused by +protection features in MacOS (at least, in Catalina) that prevent +programs built on your local system (unsigned) from running. To +disable this feature: + +1) Make sure you exit System Preferences. +2) Open a terminal session and type the following. You will need to + authenticate with an admin account: sudo spctl --master-disable +3) Exit terminal +4) Go into System Preferences and choose Security and Privacy +5) Select the General tab if it isn't already selected +6) You should now see a third selection under + "Allow apps downloaded from:" of Anywhere - select this. +7) Now you can run the build successfully. + +DISCLAIMER: You do this at your own risk. I highly recommend that you +return the settings back to normal immediately after doing a build. Process Overview ---------------- The basic steps to create a custom ROM are: - 1) Create/update configuration file + 1) Create/update configuration file (optional). - 2) Update/Add/Delete any files you want incorporated in the - ROM Disk + 2) Update/Add/Delete any files as desired to customize the disk + images (optional). 3) Run the build scripts and confirm there are no errors. - 4) Program the resultant ROM image and try it. + 4) Program the resultant ROM image and/or write thedisk images. Note that steps 1 and 2 are performed to customize your ROM as desired. If you want to simply build a standard configuration, it is *not* necessary to perform steps 1 or 2 before running a build. In fact, I strongly recommend that you skip steps 1 and 2 initially and -just perform perform steps 3 and 4 using the standard configuraion to +just perform perform steps 3 and 4 using the standard configuration to make sure that you have no issues building and programming a ROM that works the same as a pre-built ROM. @@ -76,140 +115,181 @@ 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 +The options for a build are primarily controlled 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 generaly 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. +RomWBW uses the concept of a "platform" and "configuration" to +define the settings for a build. Platform refers to one of the core +systems supported. Configuration refers to the settings that +customize the build. The configuration is modifies the platform +defaults as desired. The platform names are predefined. Refer to the following table to determine the component of the configuration filename: - SBC V1/V2 SBC_std.rom - SBC SimH SBC_simh.rom - Zeta V1 ZETA_std.rom - Zeta V2 ZETA2_std.rom - N8 N8_std.rom - Mark IV MK4_std.rom - RC2014 w/ Z80 RCZ80_std.rom - RC2014 w/ Z180 RCZ180_nat.rom (native Z180 memory addressing) - RC2014 w/ Z180 RCZ180_ext.rom (external 512K RAM/ROM module) - SCZ180 SC126, SC130, SC131 - Easy Z80 EZZ180_std.rom - Dyno DYNO_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 + SBC Retrocomputing ECB Z80 SBC V1/V2 + N8 RetroComputing N8 SBC + MK4 RetroComputing Mark IV Z180 + ZETA Sergey Kiselev's Zeta Z80 + ZETA2 Sergey Kiselev's Zeta V2 Z80 + RCZ80 RCBus Z80 + RCZ180 RCBus Z180 + SCZ180 Stephen Cousins' Z180 Systems + RCZ280 RCBus Z280 + EZZ80 Sergey Kiselev's Easy/Tiny Z80 + DYNO Dyno Z180 Single Board Computer + MBC Andrew Lynch's Nhyodyne Z80 MBC + RPH Andrew Lynch's Rhyophyre Z180 SBC + UNA John Coffman's UNA System + +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. By convention, all +configuration files start with the platform identifier followed +by an underscore. You will see later that the build process does +require this naming convention and it allows you to easily see which +configuration files apply to each of the platforms supported. + +Each of the possible platforms has at least one configuration file. In +many cases, there will be a standard ("std") configuration for the +platform. For example, there is a file called MK4_std.asm. This is +the standard ("std") configuration for a Mark IV CPU board. + +The portion of the filename can be anything desired. To create +your own custom configuration, you can modify an existing configuration +file or (preferably), you could copy an existing configuration file +to a new name of your choosing and make your changes there. For +example, you could copy "MK4_std.asm" to something like "MK4_cust.asm". +Now, you can make changes to your private copy of the configuration +and easily revert back to the original if you have problems. + +It is important to understand how configuration files are processed. +They start by inheriting all of the default settings for the +platform. This is accomplished via the "#include" directive near +the top of the file. For the "MK4_std.asm" configuration file, +this line reads: + +#include "cfg_mk4.asm" + +When the configuration file (MK4_std.asm) is processed, it will first +read in all the default platform settings from "cfg_mk4.asm". All of +the platform default configuration files are found in the parent +directory (the HBIOS directory). You will see a "cfg_.asm" for +each platform in the parent directory. + +If you look at the platform configuration file, you will see that it +has many more settings than you found in the build configuration file. +The platform configuration file contains *all* possible settings for +the platform and defines their default value. The settings in the +build configuration file just override the platform default settings. + +Note that the settings in the platform configuration file are all +defined using ".EQU" whereas the build configuration file uses ".SET". +This is because ".EQU" defines the initial value for a variable and +".SET" modifies a pre-existing value. You *must* use ".EQU" and ".SET" +correctly or the assembler will complain very loudly. + +In our example, let's say you have added a DiskIO V3 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 +FDENABLE .SET TRUE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +FDMODE .SET FDMODE_DIDE ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] -To enable floppy support, you would just change FDENABLE to TRUE: +FDENABLE is already set to TRUE, so that is fine. However, FDMODE +is not correct because it specifies a different board. To fix this, +just modify the line to read: -FDENABLE .SET TRUE ; TRUE FOR FLOPPY DEVICE SUPPORT +FDMODE .SET FDMODE_DIO3 ; FD: DRIVER MODE: FDMODE_[DIO|ZETA|ZETA2|DIDE|N8|DIO3|RCSMC|RCWDC|DYNO|EPWDC] -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: +You are now probably wondering where to find detailed instructions for +each of the configuration settings. Sadly, this is an area where +RomWBW is very deficient. The changes to hardware support happen so +fast that is have been virtually impossible to create such a document. +If it is not obvious what you need to do when looking at the build +configuration file, I recommend that you look at the platform +configuration file in the parent directory. It will contain all of the +possible settings and their default values as well as a brief comment. +In many cases this is enough information to figure out what to do. If +not, you will need to either look at the HBIOS source code or request +help in any of the RomWBW support communities (people are typically +very helpful). You can also post questions or issues on the GitHub +repository. -FDMODE .SET FDMODE_DIO3 ; FDMODE_DIO, FDMODE_DIDE, FDMODE_DIO3 +2. Update/Add/Delete Disk Files +------------------------------- -2. Update/Add/Delete ROM Disk Files ------------------------------------ +A major part of the RomWBW build process is the creation of the +ROM disk contents and the floppy/hard disk image 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 +The ROM disk process starts in the Source/RomDsk directory. Within +that directory, there are subdirectories for each of the different +possible ROM sizes that can be created. The vast majority of all +ROMs are 512KB, so you will probably be interested primarily in the +ROM_512KB subdirectory. + +These subdirectories 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. +included on your ROM Disk. -In summary, the ROM Disk imbedded in the ROM firmware you build, +In summary, the ROM Disk embedded 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. +ROM_1024KB directory if building a 1024KB firmware, etc.). There is a ReadMe.txt document in the \Source\RomDsk directory with a more detailed description of this process. -Note that the standard 512K ROM disk is absolutely full. So, if +Note that the standard 512K ROM disk is almost full. So, if you want to add files to it, you will need to delete other files to free up some space. +Creation of the floppy/hard disk images is similar, but these +images are much larger and have many more files. Additionally, the +process pulls in files from multiple places and creates multiple +formats. The Source/Images directory of the distribution handles +the creations of these disk images. There is a ReadMe.txt file there +that describes the process and how to customize your disk images. + 3. Run the Build Process ------------------------ -This section describes the build process for Microsoft Windows -computers. The build process for Linux/Mac computers is described -in the ReadMe.unix file in the top level directory of the -distribution. - -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: +Regardless of whether you are using Windows, Linux, or MacOS to perform +the build, you will initiate the build at a command prompt. So, you +start by starting a command window/terminal. Make sure your +command prompt has the root "RomWBW" directory as the default. - C:\RomWBW\Source> BuildShared +For a Windows computer, the build is initiated by simply running the +command "Build". To delete all files created during a build process, +use the "Clean" command. I recommend doing this before each build. It +will operate recursively on all directories. -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. +For Linux or MacOS, you will use the command "make". To delete all +files created during a prior build run, use the command "make clean". +I strongly recommend doing this before each build. - ++ 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: +This will launch the build process for a complete RomWBW build including +ROM and disk images. Some of the output may be confusing, so a sample +normal build run is included at the end of this document. - Platform [SBC|ZETA|ZETA2|RCZ80|EZZ80|UNA|N8|MK4|RCZ180|SCZ180|DYNO]: +At a point in the middle of the build, you will be prompted to choose +the specific platform and configuration for your ROM. For platform, be +sure to enter the platform identifier that corresponds to the ROM you +are creating. The prompt will look something like this: -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. + Platform [SBC|MBC|ZETA|ZETA2|RCZ80|EZZ80|UNA|N8|MK4|RCZ180|SCZ180|DYNO|RCZ280]: -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: +You will subsequently be prompted for the specific configuration that +you want to build. It will display the available possibilities based +on the platform you previously chose. Notice that you are choosing +the portion of the configuration filename that follows the platform +id: Configurations available: > std @@ -219,15 +299,12 @@ would see a prompt like this: 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 +At this point, the build should continue 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 @@ -245,140 +322,161 @@ used: SD occupies 2191 bytes. HBIOS space remaining: 21434 bytes. -Optionally, you can run one more command that will create the -RomWBW disk images that can be subsequently written to actual -disk media. - - C:\RomWBW\Source> BuildImages +At the completion of the build process, you will find the resultant +ROM and disk image files in the Binary directory. -After running this command, you will find the resultant -disk image file in the Binary directory with names in the -format fd_xxx.img for floppy media or hd_xxx.img for -hard disk media. Refer to the DiskList.txt file in the -Binary directory for more information on using the disk -image files. +There will be many disk image (".img") files created. These are +described in the RomWBW User Guide document. Since RomWBW +encapsulates all hardware interface code in the ROM itself, the +disk image files are generic for all ROMs. The only reason they +are built is to accommodate any disk content changes you may have +made. 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 with 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. - -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 +resulting firmware in the Binary directory. The ROM file +will be called _.rom matching the platform identifier +and configuration you chose. + +Three output files will be created for a single build: + + _.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 + _.upd - partial ROM image containing just the + first 128KB which can be used to update + only the "code" portion of your ROM + and not modify the ROM disk + +The actual ROM image is the file ending in .rom. It will normally be +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). +You can alternatively reprogram your ROM in-situ (most hardware +supports this) using the FLASH application included with RomWBW. This +is described in the "Upgrading" section of the RomWBW User Guide. + 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: +If you are repeatedly running the build process, you may prefer to +specify the platform and configuration on the command line to avoid +being prompted each time. - C:\RomWBW\Source> BuildROM MK4 cust 1024 - -You must ensure that your system actually supports a 1024K ROM. - -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: - -BuildProp: Some RetroBrew Computer peripheral boards are based - on the Parallax Propeller. The Propeller requires - custom onboard EEPROM firmware to operate. This - command file builds the firmware images for each - of the Propeller-based boards. +Under Windows, you can specify the platform and configuration +like this: -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. - N.B., BuildShared must be run prior to BuildImages. + Build MK4 cust -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. +Under Linux or MacOS, you can do the same thing like this: -Example BuildShared Run ------------------------ + make ROM_PLATFORM=MK4 ROM_CONFIG=cust -C:\RomWBW\Source> BuildShared +In this case, you will not be prompted. This is useful if you wish +to automate your build process. -Building SysCopy... -TASM Z80 Assembler. Version 3.2 September, 2001. +In the past, the size of the ROM could be specified as the third +parameter of the command. This parameter is now deprecated and +the size of the ROM is specified in your configuration file +using the ROMSIZE variable. + + + + +Example Build Run (Windows) +--------------------------- + +C:\Users\Wayne\Projects\RomWBW>build + +Building PropIO... +Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved +Compiled for i386 Win32 at 08:17:48 on 2009/07/20 +Loading Object PropIO +Loading Object AnsiTerm +Loading Object vgacolour +Loading Object E555_SPKEngine +Loading Object Keyboard +Loading Object safe_spi +Loading Object Parallax Serial Terminal Null +Program size is 13416 longs +Compiled 2227 Lines of Code in 0.054 Seconds + 1 file(s) moved. + +Building PropIO2... +Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved +Compiled for i386 Win32 at 08:17:48 on 2009/07/20 +Loading Object PropIO2 +Loading Object AnsiTerm +Loading Object vgacolour +Loading Object E555_SPKEngine +Loading Object Keyboard +Loading Object safe_spi +Loading Object Parallax Serial Terminal Null +Program size is 13420 longs +Compiled 2227 Lines of Code in 0.053 Seconds + 1 file(s) moved. + +Building ParPortProp... +Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved +Compiled for i386 Win32 at 08:17:48 on 2009/07/20 +Loading Object ParPortProp +Loading Object AnsiTerm +Loading Object vgacolour +Loading Object E555_SPKEngine +Loading Object Keyboard +Loading Object safe_spi +Loading Object Parallax Serial Terminal Null +Loading Object FullDuplexSerial +Program size is 15484 longs +Compiled 2631 Lines of Code in 0.065 Seconds + 1 file(s) moved. +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 - -Building Assign... -TASM Z80 Assembler. Version 3.2 September, 2001. +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 + 1 file(s) copied. + 1 file(s) copied. -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 CBIOS for RomWBW... -Building Talk... 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 525 bytes. +INIT code slack space: 2184 bytes. +HEAP space: 4034 bytes. +CBIOS total space used: 6144 bytes. tasm: pass 2 complete. tasm: Number of errors = 0 -Building OSLdr... +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 525 bytes. +INIT code slack space: 2025 bytes. +HEAP space: 3887 bytes. +CBIOS total space used: 6400 bytes. 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 @@ -445,6 +543,7 @@ 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 @@ -470,6 +569,25 @@ Saved image size: 3584 bytes (0E00H, - 28 records) ++ Warning: program origin NOT at 100H ++ +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 +os2ccp.bin +os3bdos.bin +..\cbios\cbios_wbw.bin + 1 file(s) copied. +os2ccp.bin +os3bdos.bin +..\cbios\cbios_una.bin + 1 file(s) copied. +loader.bin +cpm_wbw.bin + 1 file(s) copied. +loader.bin +cpm_una.bin + 1 file(s) copied. CP/M MACRO ASSEM 2.0 D7EF 00EH USE FACTOR @@ -500,10 +618,21 @@ No Fatal error(s) Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft -Data 0100 08F7 < 2039> +Data 0100 08FF < 2047> + +51771 Bytes Free +[0000 08FF 8] + + +No Fatal error(s) + + +Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft + +Data 0100 091A < 2074> -51779 Bytes Free -[0000 08F7 8] +51744 Bytes Free +[0000 091A 9] @@ -539,109 +668,3114 @@ 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 +..\zcpr-dj\zcpr.bin +zsdos.bin +..\cbios\cbios_wbw.bin + 1 file(s) copied. +..\zcpr-dj\zcpr.bin +zsdos.bin +..\cbios\cbios_una.bin + 1 file(s) copied. +loader.bin +zsys_wbw.bin + 1 file(s) copied. +loader.bin +zsys_una.bin + 1 file(s) copied. + + +*** CPM Loader *** + +CP/M RMAC ASSEM 1.1 +0A00 +015H USE FACTOR +END OF ASSEMBLY -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 +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 -Example BuildROM Run ------------------------ + UTIL/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 136 Program Bytes. + 12 Symbols Detected. -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... + 1 file(s) copied. -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. +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + BIOSLDR/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 1127 Program Bytes. + 142 Symbols Detected. + + + 1 file(s) moved. + 1 file(s) moved. +LINK 1.31 + +COUT 0FAB ADDHLA 0F67 BCD2BIN 0FC9 BIN2BCD 0FDC +CIN 0F9F CRLF 0FBC CRLF2 0FB9 PHEX16 0F6C +PHEX8 0F77 + +ABSOLUTE 0000 +CODE SIZE 0EEF (0100-0FEE) +DATA SIZE 0000 +COMMON SIZE 0000 +USE FACTOR 1E + + 1 file(s) moved. + 1 file(s) copied. + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + BIOSLDR/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 1203 Program Bytes. + 145 Symbols Detected. + + + 1 file(s) moved. + 1 file(s) moved. +LINK 1.31 + +CIN 0FEB COUT 0FF7 ADDHLA 0FB3 BCD2BIN 1015 +BIN2BCD 1028 CRLF 1008 CRLF2 1005 PHEX16 0FB8 +PHEX8 0FC3 + +ABSOLUTE 0000 +CODE SIZE 0F3B (0100-103A) +DATA SIZE 0000 +COMMON SIZE 0000 +USE FACTOR 1F + + 1 file(s) moved. + + +*** Resident CPM3 BIOS *** + + 1 file(s) copied. + 1 file(s) copied. +CP/M RMAC ASSEM 1.1 +023E +00AH USE FACTOR +END OF ASSEMBLY + +CP/M RMAC ASSEM 1.1 +0000 +002H USE FACTOR +END OF ASSEMBLY + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + BOOT/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 655 Program Bytes. 324 Data Bytes. + 125 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + CHARIO/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 128 Program Bytes. + 28 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + MOVE/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 84 Program Bytes. + 14 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + DRVTBL/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 32 Program Bytes. + 22 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + DISKIO/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 188 Program Bytes. 1835 Data Bytes. + 114 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + UTIL/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 136 Program Bytes. + 12 Symbols Detected. + + +LINK 1.31 + +@ADRV 07F7 @RDRV 07F8 @TRK 07F9 @SECT 07FB +@DMA 07FD @DBNK 0800 @CNT 07FF @CBNK 023D +@COVEC FE24 @CIVEC FE22 @AOVEC FE28 @AIVEC FE26 +@LOVEC FE2A @MXTPA FE62 @BNKBF FE35 @CTBL 04EC +@DTBL 05A1 @CRDMA FE3C @CRDSK FE3E @VINFO FE3F +@RESEL FE41 @FX FE43 @USRCD FE44 @MLTIO FE4A +@ERMDE FE4B @ERDSK FE51 @MEDIA FE54 @BFLGS FE57 +@DATE FE58 @HOUR FE5A @MIN FE5B @SEC FE5C +@CCPDR FE13 @SRCH1 FE4C @SRCH2 FE4D @SRCH3 FE4E +@SRCH4 FE4F @BOOTDU 04A3 @BOOTSL 04A4 @HBBIO 0599 +ADDHLA 067D BCD2BIN 06DF BIN2BCD 06F2 DPH0 094F +@HBUSR 059C DPH1 0976 DPH10 0AD5 DPH11 0AFC +DPH12 0B23 DPH13 0B4A DPH14 0B71 DPH15 0B98 +DPH2 099D DPH3 09C4 DPH4 09EB DPH5 0A12 +DPH6 0A39 DPH7 0A60 DPH8 0A87 DPH9 0AAE +@SYSDR 067C CIN 06B5 COUT 06C1 CRLF 06D2 +CRLF2 06CF PHEX16 0682 PHEX8 068D + +ABSOLUTE 0000 +CODE SIZE 0705 (0000-0704) +DATA SIZE 096B (0705-106F) +COMMON SIZE 0000 +USE FACTOR 21 + + + +CP/M 3.0 System Generation +Copyright (C) 1982, Digital Research + +Default entries are shown in (parens). +Default base is Hex, precede entry with # for decimal + +Use GENCPM.DAT for defaults (Y) ? + +Create a new GENCPM.DAT file (N) ? + +Display Load Map at Cold Boot (Y) ? + +Number of console columns (#80) ? +Number of lines in console page (#24) ? +Backspace echoes erased character (N) ? +Rubout echoes erased character (N) ? + +Initial default drive (A:) ? + +Top page of memory (FD) ? +Bank switched memory (N) ? + +Double allocation vectors (N) ? + +Accept new system definition (Y) ? + +Setting up Allocation vector for drive A: +Setting up Checksum vector for drive A: +Setting up Allocation vector for drive B: +Setting up Checksum vector for drive B: +Setting up Allocation vector for drive C: +Setting up Checksum vector for drive C: +Setting up Allocation vector for drive D: +Setting up Checksum vector for drive D: +Setting up Allocation vector for drive E: +Setting up Checksum vector for drive E: +Setting up Allocation vector for drive F: +Setting up Checksum vector for drive F: +Setting up Allocation vector for drive G: +Setting up Checksum vector for drive G: +Setting up Allocation vector for drive H: +Setting up Checksum vector for drive H: +Setting up Allocation vector for drive I: +Setting up Checksum vector for drive I: +Setting up Allocation vector for drive J: +Setting up Checksum vector for drive J: +Setting up Allocation vector for drive K: +Setting up Checksum vector for drive K: +Setting up Allocation vector for drive L: +Setting up Checksum vector for drive L: +Setting up Allocation vector for drive M: +Setting up Checksum vector for drive M: +Setting up Allocation vector for drive N: +Setting up Checksum vector for drive N: +Setting up Allocation vector for drive O: +Setting up Checksum vector for drive O: +Setting up Allocation vector for drive P: +Setting up Checksum vector for drive P: + +Setting up directory hash tables: + Enable hashing for drive A: (N) ? + Enable hashing for drive B: (N) ? + Enable hashing for drive C: (N) ? + Enable hashing for drive D: (N) ? + Enable hashing for drive E: (N) ? + Enable hashing for drive F: (N) ? + Enable hashing for drive G: (N) ? + Enable hashing for drive H: (N) ? + Enable hashing for drive I: (N) ? + Enable hashing for drive J: (N) ? + Enable hashing for drive K: (N) ? + Enable hashing for drive L: (N) ? + Enable hashing for drive M: (N) ? + Enable hashing for drive N: (N) ? + Enable hashing for drive O: (N) ? + Enable hashing for drive P: (N) ? + +Setting up Blocking/Deblocking buffers: + +The physical record size is 0200H: + + Available space in 256 byte pages: + TPA = 00AEH + + *** Directory buffer required *** + *** and allocated for drive A: *** + + Available space in 256 byte pages: + TPA = 00ABH + + *** Data buffer required and *** + *** allocated for drive A: *** + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive B: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive B: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive C: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive C: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive D: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive D: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive E: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive E: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive F: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive F: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive G: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive G: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive H: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive H: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive I: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive I: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive J: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive J: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive K: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive K: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive L: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive L: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive M: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive M: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive N: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive N: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive O: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive O: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Directory buffer for drive P: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + Overlay Data buffer for drive P: (Y) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00A9H + + +Accept new buffer definitions (Y) ? + + BIOS3 SPR C900H 1100H + BDOS3 SPR AA00H 1F00H + +*** CP/M 3.0 SYSTEM GENERATION DONE *** + 1 file(s) copied. + + +*** Banked CPM3 BIOS *** + + 1 file(s) copied. + 1 file(s) copied. +CP/M RMAC ASSEM 1.1 +0243 +00AH USE FACTOR +END OF ASSEMBLY + +CP/M RMAC ASSEM 1.1 +0000 +002H USE FACTOR +END OF ASSEMBLY + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + BOOT/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 723 Program Bytes. 347 Data Bytes. + 128 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + CHARIO/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 128 Program Bytes. + 28 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + MOVE/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 84 Program Bytes. + 14 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + DRVTBL/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 32 Program Bytes. + 22 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + DISKIO/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 188 Program Bytes. 1838 Data Bytes. + 114 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + UTIL/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 136 Program Bytes. + 12 Symbols Detected. + + +LINK 1.31 + +@ADRV 08F2 @RDRV 08F3 @TRK 08F4 @SECT 08F6 +@DMA 08F8 @DBNK 08FB @CNT 08FA @CBNK 0242 +@COVEC FE24 @CIVEC FE22 @AOVEC FE28 @AIVEC FE26 +@LOVEC FE2A @MXTPA FE62 @BNKBF FE35 @CTBL 0535 +@DTBL 05EA @CRDMA FE3C @CRDSK FE3E @VINFO FE3F +@RESEL FE41 @FX FE43 @USRCD FE44 @MLTIO FE4A +@ERMDE FE4B @ERDSK FE51 @MEDIA FE54 @BFLGS FE57 +@DATE FE58 @HOUR FE5A @MIN FE5B @SEC FE5C +@CCPDR FE13 @SRCH1 FE4C @SRCH2 FE4D @SRCH3 FE4E +@SRCH4 FE4F @BOOTDU 04EC @BOOTSL 04ED @HBBIO 05E2 +ADDHLA 06C6 BCD2BIN 0728 BIN2BCD 073B DPH0 0A61 +@HBUSR 05E5 DPH1 0A88 DPH10 0BE7 DPH11 0C0E +DPH12 0C35 DPH13 0C5C DPH14 0C83 DPH15 0CAA +DPH2 0AAF DPH3 0AD6 DPH4 0AFD DPH5 0B24 +DPH6 0B4B DPH7 0B72 DPH8 0B99 DPH9 0BC0 +@SYSDR 06C5 CIN 06FE COUT 070A CRLF 071B +CRLF2 0718 PHEX16 06CB PHEX8 06D6 + +ABSOLUTE 0000 +CODE SIZE 074E (0000-074D) +DATA SIZE 0985 (0800-1184) +COMMON SIZE 0000 +USE FACTOR 22 + + + +CP/M 3.0 System Generation +Copyright (C) 1982, Digital Research + +Default entries are shown in (parens). +Default base is Hex, precede entry with # for decimal + +Use GENCPM.DAT for defaults (Y) ? + +Create a new GENCPM.DAT file (N) ? + +Display Load Map at Cold Boot (Y) ? + +Number of console columns (#80) ? +Number of lines in console page (#24) ? +Backspace echoes erased character (N) ? +Rubout echoes erased character (N) ? + +Initial default drive (A:) ? + +Top page of memory (FD) ? +Bank switched memory (Y) ? +Common memory base page (80) ? + +Long error messages (Y) ? + +Accept new system definition (Y) ? + +Setting up Allocation vector for drive A: +Setting up Checksum vector for drive A: +Setting up Allocation vector for drive B: +Setting up Checksum vector for drive B: +Setting up Allocation vector for drive C: +Setting up Checksum vector for drive C: +Setting up Allocation vector for drive D: +Setting up Checksum vector for drive D: +Setting up Allocation vector for drive E: +Setting up Checksum vector for drive E: +Setting up Allocation vector for drive F: +Setting up Checksum vector for drive F: +Setting up Allocation vector for drive G: +Setting up Checksum vector for drive G: +Setting up Allocation vector for drive H: +Setting up Checksum vector for drive H: +Setting up Allocation vector for drive I: +Setting up Checksum vector for drive I: +Setting up Allocation vector for drive J: +Setting up Checksum vector for drive J: +Setting up Allocation vector for drive K: +Setting up Checksum vector for drive K: +Setting up Allocation vector for drive L: +Setting up Checksum vector for drive L: +Setting up Allocation vector for drive M: +Setting up Checksum vector for drive M: +Setting up Allocation vector for drive N: +Setting up Checksum vector for drive N: +Setting up Allocation vector for drive O: +Setting up Checksum vector for drive O: +Setting up Allocation vector for drive P: +Setting up Checksum vector for drive P: + +*** Bank 1 and Common are not included *** +*** in the memory segment table. *** + +Number of memory segments (#4) ? + +CP/M 3 Base,size,bank (18,68,00) + +Enter memory segment table: + Base,size,bank (01,43,00) ? + +ERROR: Memory conflict - segment trimmed. + Base,size,bank (01,17,00) ? + Base,size,bank (0E,72,02) ? + Base,size,bank (01,7F,03) ? + Base,size,bank (01,7F,04) ? + + CP/M 3 Sys 1800H 6800H Bank 00 + Memseg No. 00 0100H 1700H Bank 00 + Memseg No. 01 0E00H 7200H Bank 02 + Memseg No. 02 0100H 7F00H Bank 03 + Memseg No. 03 0100H 7F00H Bank 04 + +Accept new memory segment table entries (Y) ? + +Setting up directory hash tables: + Enable hashing for drive A: (Y) ? + Enable hashing for drive B: (Y) ? + Enable hashing for drive C: (Y) ? + Enable hashing for drive D: (Y) ? + Enable hashing for drive E: (Y) ? + Enable hashing for drive F: (Y) ? + Enable hashing for drive G: (Y) ? + Enable hashing for drive H: (Y) ? + Enable hashing for drive I: (Y) ? + Enable hashing for drive J: (Y) ? + Enable hashing for drive K: (Y) ? + Enable hashing for drive L: (Y) ? + Enable hashing for drive M: (Y) ? + Enable hashing for drive N: (Y) ? + Enable hashing for drive O: (Y) ? + Enable hashing for drive P: (Y) ? + +Setting up Blocking/Deblocking buffers: + +The physical record size is 0200H: + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0017H, Other banks = 0070H + + Number of directory buffers for drive A: (#8) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0006H, Other banks = 0070H + + Number of data buffers for drive A: (#16) ? + Allocate buffers outside of Common (Y) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive B: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive B: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive C: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive C: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive D: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive D: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive E: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive E: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive F: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive F: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive G: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive G: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive H: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive H: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive I: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive I: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive J: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive J: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive K: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive K: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive L: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive L: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive M: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive M: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive N: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive N: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive O: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive O: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive P: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive P: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + +Accept new buffer definitions (Y) ? + + BNKBIOS3 SPR F600H 0800H + BNKBIOS3 SPR 4500H 3B00H + RESBDOS3 SPR F000H 0600H + BNKBDOS3 SPR 1700H 2E00H + +*** CP/M 3.0 SYSTEM GENERATION DONE *** + 1 file(s) copied. + + +*** Banked ZPM3 BIOS *** + + 1 file(s) copied. + 1 file(s) copied. +CP/M RMAC ASSEM 1.1 +0243 +00AH USE FACTOR +END OF ASSEMBLY + +CP/M RMAC ASSEM 1.1 +0000 +002H USE FACTOR +END OF ASSEMBLY + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + BOOT/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 719 Program Bytes. 347 Data Bytes. + 128 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + CHARIO/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 128 Program Bytes. + 28 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + MOVE/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 84 Program Bytes. + 14 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + DRVTBL/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 32 Program Bytes. + 22 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + DISKIO/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 188 Program Bytes. 1838 Data Bytes. + 114 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + UTIL/MF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. 136 Program Bytes. + 12 Symbols Detected. + + +LINK 1.31 + +@ADRV 08F2 @RDRV 08F3 @TRK 08F4 @SECT 08F6 +@DMA 08F8 @DBNK 08FB @CNT 08FA @CBNK 0242 +@COVEC FE24 @CIVEC FE22 @AOVEC FE28 @AIVEC FE26 +@LOVEC FE2A @MXTPA FE62 @BNKBF FE35 @CTBL 0531 +@DTBL 05E6 @CRDMA FE3C @CRDSK FE3E @VINFO FE3F +@RESEL FE41 @FX FE43 @USRCD FE44 @MLTIO FE4A +@ERMDE FE4B @ERDSK FE51 @MEDIA FE54 @BFLGS FE57 +@DATE FE58 @HOUR FE5A @MIN FE5B @SEC FE5C +@CCPDR FE13 @SRCH1 FE4C @SRCH2 FE4D @SRCH3 FE4E +@SRCH4 FE4F @BOOTDU 04E8 @BOOTSL 04E9 @HBBIO 05DE +ADDHLA 06C2 BCD2BIN 0724 BIN2BCD 0737 DPH0 0A61 +@HBUSR 05E1 DPH1 0A88 DPH10 0BE7 DPH11 0C0E +DPH12 0C35 DPH13 0C5C DPH14 0C83 DPH15 0CAA +DPH2 0AAF DPH3 0AD6 DPH4 0AFD DPH5 0B24 +DPH6 0B4B DPH7 0B72 DPH8 0B99 DPH9 0BC0 +@SYSDR 06C1 CIN 06FA COUT 0706 CRLF 0717 +CRLF2 0714 PHEX16 06C7 PHEX8 06D2 + +ABSOLUTE 0000 +CODE SIZE 074A (0000-0749) +DATA SIZE 0985 (0800-1184) +COMMON SIZE 0000 +USE FACTOR 22 + + 1 file(s) copied. + 1 file(s) copied. +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 +loader.bin +cpmldr.bin + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + + +*** ZPM Loader *** + +LINK 1.31 + +COUT 0FAB ADDHLA 0F67 BCD2BIN 0FC9 BIN2BCD 0FDC +CIN 0F9F CRLF 0FBC CRLF2 0FB9 PHEX16 0F6C +PHEX8 0F77 + +ABSOLUTE 0000 +CODE SIZE 0EEF (0100-0FEE) +DATA SIZE 0000 +COMMON SIZE 0000 +USE FACTOR 1B + + 1 file(s) moved. +LINK 1.31 + +CIN 0FEB COUT 0FF7 ADDHLA 0FB3 BCD2BIN 1015 +BIN2BCD 1028 CRLF 1008 CRLF2 1005 PHEX16 0FB8 +PHEX8 0FC3 + +ABSOLUTE 0000 +CODE SIZE 0F3B (0100-103A) +DATA SIZE 0000 +COMMON SIZE 0000 +USE FACTOR 1C + + 1 file(s) moved. + + +*** Banked ZPM3 *** + + 1 file(s) copied. + + +CP/M 3.0 System Generation +Copyright (C) 1982, Digital Research + +Default entries are shown in (parens). +Default base is Hex, precede entry with # for decimal + +Use GENCPM.DAT for defaults (Y) ? + +Create a new GENCPM.DAT file (N) ? + +Display Load Map at Cold Boot (Y) ? + +Number of console columns (#80) ? +Number of lines in console page (#24) ? +Backspace echoes erased character (N) ? +Rubout echoes erased character (N) ? + +Initial default drive (A:) ? + +Top page of memory (FD) ? +Bank switched memory (Y) ? +Common memory base page (80) ? + +Long error messages (Y) ? + +Accept new system definition (Y) ? + +Setting up Allocation vector for drive A: +Setting up Checksum vector for drive A: +Setting up Allocation vector for drive B: +Setting up Checksum vector for drive B: +Setting up Allocation vector for drive C: +Setting up Checksum vector for drive C: +Setting up Allocation vector for drive D: +Setting up Checksum vector for drive D: +Setting up Allocation vector for drive E: +Setting up Checksum vector for drive E: +Setting up Allocation vector for drive F: +Setting up Checksum vector for drive F: +Setting up Allocation vector for drive G: +Setting up Checksum vector for drive G: +Setting up Allocation vector for drive H: +Setting up Checksum vector for drive H: +Setting up Allocation vector for drive I: +Setting up Checksum vector for drive I: +Setting up Allocation vector for drive J: +Setting up Checksum vector for drive J: +Setting up Allocation vector for drive K: +Setting up Checksum vector for drive K: +Setting up Allocation vector for drive L: +Setting up Checksum vector for drive L: +Setting up Allocation vector for drive M: +Setting up Checksum vector for drive M: +Setting up Allocation vector for drive N: +Setting up Checksum vector for drive N: +Setting up Allocation vector for drive O: +Setting up Checksum vector for drive O: +Setting up Allocation vector for drive P: +Setting up Checksum vector for drive P: + +*** Bank 1 and Common are not included *** +*** in the memory segment table. *** + +Number of memory segments (#4) ? + +CP/M 3 Base,size,bank (18,68,00) + +Enter memory segment table: + Base,size,bank (01,43,00) ? + +ERROR: Memory conflict - segment trimmed. + Base,size,bank (01,17,00) ? + Base,size,bank (0E,72,02) ? + Base,size,bank (01,7F,03) ? + Base,size,bank (01,7F,04) ? + + CP/M 3 Sys 1800H 6800H Bank 00 + Memseg No. 00 0100H 1700H Bank 00 + Memseg No. 01 0E00H 7200H Bank 02 + Memseg No. 02 0100H 7F00H Bank 03 + Memseg No. 03 0100H 7F00H Bank 04 + +Accept new memory segment table entries (Y) ? + +Setting up directory hash tables: + Enable hashing for drive A: (Y) ? + Enable hashing for drive B: (Y) ? + Enable hashing for drive C: (Y) ? + Enable hashing for drive D: (Y) ? + Enable hashing for drive E: (Y) ? + Enable hashing for drive F: (Y) ? + Enable hashing for drive G: (Y) ? + Enable hashing for drive H: (Y) ? + Enable hashing for drive I: (Y) ? + Enable hashing for drive J: (Y) ? + Enable hashing for drive K: (Y) ? + Enable hashing for drive L: (Y) ? + Enable hashing for drive M: (Y) ? + Enable hashing for drive N: (Y) ? + Enable hashing for drive O: (Y) ? + Enable hashing for drive P: (Y) ? + +Setting up Blocking/Deblocking buffers: + +The physical record size is 0200H: + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0017H, Other banks = 0070H + + Number of directory buffers for drive A: (#8) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0006H, Other banks = 0070H + + Number of data buffers for drive A: (#16) ? + Allocate buffers outside of Common (Y) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive B: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive B: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive C: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive C: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive D: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive D: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive E: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive E: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive F: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive F: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive G: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive G: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive H: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive H: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive I: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive I: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive J: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive J: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive K: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive K: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive L: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive L: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive M: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive M: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive N: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive N: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive O: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive O: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of directory buffers for drive P: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + Number of data buffers for drive P: (#0) ? + Share buffer(s) with which drive (A:) ? + + Available space in 256 byte pages: + TPA = 00F0H, Bank 0 = 0005H, Other banks = 0050H + + +Accept new buffer definitions (Y) ? + + BNKBIOS3 SPR F600H 0800H + BNKBIOS3 SPR 4500H 3B00H + RESBDOS3 SPR F000H 0600H + BNKBDOS3 SPR 1700H 2E00H + +*** CP/M 3.0 SYSTEM GENERATION DONE *** + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + clrhist/F +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 19 Absolute Bytes. 7 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + setz3/F +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 235 Absolute Bytes. 12 Symbols Detected. + + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + autotog/F +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 437 Absolute Bytes. 20 Symbols Detected. + + +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 +loader.bin +zpmldr.bin + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + +Building p-System BIOS Tester Loader for RomWBW... + +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 p-System BIOS for RomWBW... + +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +pSystem BIOS space remaining: 71 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + +Building p-System Loader for RomWBW... + +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 + +Generating p-System BIOS Tester filler... + +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 + +Generating p-System Boot Track filler... + +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 + +Creating p-System BIOS Tester boot image + +..\Images\hd1k_prefix.dat +testldr.bin +bios.bin +biostest.dat +testfill.bin + 1 file(s) copied. + +Generating p-System Boot Track... + +loader.bin +bios.bin +boot.dat +fill.bin + 1 file(s) copied. + +Generating p-System Disk Image... + +..\Images\hd1k_prefix.dat +trk0.bin +psys.vol +trk0.bin +blank.vol + 1 file(s) copied. + 1 file(s) copied. + +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 mode... +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 rtc... +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 timer... +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 rtchb... +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +rtchb +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. + 1164 Absolute Bytes. 80 Symbols Detected. + + +CP/M MACRO ASSEM 2.0 +0577 +009H USE FACTOR +END OF ASSEMBLY + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 1115 bytes (045BH) to file P0:SURVEY.COM +Start address: 0100H Ending address: 055AH Bias: 0000H +Saved image size: 1152 bytes (0480H, - 9 records) + +CP/M MACRO ASSEM 2.0 +1B80 +018H USE FACTOR +END OF ASSEMBLY + + +SLR180 Copyright (C) 1985-86 by SLR Systems Rel. 1.32 #NL0029 + + xmhb/HF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 996 Absolute Bytes. 111 Symbols Detected. + + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 6422 bytes (1916H) to file P0:XM.COM +Start address: 0100H Ending address: 1B07H Bias: 0000H +Saved image size: 6784 bytes (1A80H, - 53 records) + + +SLR180 Copyright (C) 1985-86 by SLR Systems Rel. 1.32 #NL0029 + + xmhb_old/HF +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 871 Absolute Bytes. 129 Symbols Detected. + + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 6297 bytes (1899H) to file P0:XMOLD.COM +Start address: 0100H Ending address: 1B07H Bias: 0000H +Saved image size: 6784 bytes (1A80H, - 53 records) + + 1 file(s) copied. + 1 file(s) copied. +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 + 1 file(s) copied. + 1 file(s) copied. +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 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 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 +tune.com +tunemsx.com +tunezx.com + 3 file(s) copied. +Tunes\Attack.pt3 +Tunes\Backup.pt3 +Tunes\BadMice.pt3 +Tunes\Demo.mym +Tunes\Demo1.mym +Tunes\Demo3.mym +Tunes\Demo3mix.mym +Tunes\Demo4.mym +Tunes\HowRU.pt3 +Tunes\Iteratn.pt3 +Tunes\LookBack.pt3 +Tunes\Louboutn.pt3 +Tunes\Namida.pt3 +Tunes\Recoll.pt3 +Tunes\Sanxion.pt3 +Tunes\Synch.pt3 +Tunes\ToStar.pt3 +Tunes\Victory.pt3 +Tunes\Wicked.pt3 +Tunes\YeOlde.pt3 +Tunes\Yeovil.pt3 + 21 file(s) copied. + 1 file(s) copied. +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 + 1 file(s) copied. +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 + 1 file(s) copied. +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 + 1 file(s) copied. +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 + 1 file(s) copied. +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 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 +loader.bin +dbgmon.bin + 1 file(s) copied. + 1 file(s) copied. +TASM Z180 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +i2cscan +tasm: pass 2 complete. +tasm: Number of errors = 0 +TASM Z180 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +rtcds7 +tasm: pass 2 complete. +tasm: Number of errors = 0 +TASM Z180 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +i2clcd +tasm: pass 2 complete. +tasm: Number of errors = 0 +i2clcd.com +i2cscan.com + 2 file(s) copied. +rtcds7.com + 1 file(s) copied. +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 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 +Comparing files rz.com and RZ.COM.ORIG +FC: no differences encountered + +Comparing files sz.com and SZ.COM.ORIG +FC: no differences encountered + + 1 file(s) copied. + 1 file(s) copied. +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 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 + 1 file(s) copied. + 1 file(s) copied. +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 + 1 file(s) copied. +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 + 1 file(s) copied. +'Pass 1 complete' +'Pass 2 complete' +'Assembly complete' + +No Fatal error(s) + + +Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft + +Data 0100 056F < 1135> + +52683 Bytes Free +[0000 056F 5] + + 1 file(s) copied. +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 + 1 file(s) copied. +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 + 1 file(s) copied. + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + ZMO-RW01/H +End of file Pass 1 + 0 Error(s) Detected. + 937 Absolute Bytes. 91 Symbols Detected. + + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 927 bytes (039FH) to file P0:ZMP.COM +Over a 16000 byte binary file +Start address: 0100H Ending address: 3F80H Bias: 0000H +Saved image size: 16000 bytes (3E80H, - 125 records) + + 1 file(s) copied. +zmconfig.ovr +zminit.ovr +zmterm.ovr +zmxfer.ovr + 4 file(s) copied. +zmp.hlp + 1 file(s) copied. + 1 file(s) copied. + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + zmd/fm +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 14893 Absolute Bytes. 687 Symbols Detected. + + + +Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft + +Data 0100 5253 <20819> + +30660 Bytes Free +[0000 5253 82] + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + zmap/fm +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 4447 Absolute Bytes. 201 Symbols Detected. + + + +Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft + +Data 0100 18B0 < 6064> + +46412 Bytes Free +[0000 18B0 24] + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + znews/fm +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 4312 Absolute Bytes. 201 Symbols Detected. + + + +Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft + +Data 0100 1B9C < 6812> + +45440 Bytes Free +[0000 1B9C 27] + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + znewp/fm +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 4706 Absolute Bytes. 223 Symbols Detected. + + + +Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft + +Data 0100 1C8A < 7050> + +45274 Bytes Free +[0000 1C8A 28] + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + zfors/fm +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 4156 Absolute Bytes. 196 Symbols Detected. + + + +Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft + +Data 0100 221F < 8479> + +43629 Bytes Free +[0000 221F 34] + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + zforp/fm +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 4910 Absolute Bytes. 219 Symbols Detected. + + + +Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft + +Data 0100 1D58 < 7256> + +45073 Bytes Free +[0000 1D58 29] + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + zmdel/fm +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 4256 Absolute Bytes. 200 Symbols Detected. + + + +Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft + +Data 0100 1AE0 < 6624> + +45716 Bytes Free +[0000 1AE0 26] + + +Z80ASM Copyright (C) 1983-86 by SLR Systems Rel. 1.32 #AB1234 + + zmdhb/fh +End of file Pass 1 +End of file Pass 2 + 0 Error(s) Detected. + 1109 Absolute Bytes. 116 Symbols Detected. + + +MLOAD v25 Copyright (c) 1983, 1984, 1985, 1988 +by NightOwl Software, Inc. +Loaded 1017 bytes (03F9H) to file P0:ZMD.COM +Over a 20864 byte binary file +Start address: 0100H Ending address: 5280H Bias: 0000H +Saved image size: 20864 bytes (5180H, - 163 records) + + 1 file(s) copied. +Building Dev... +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 + 1 file(s) copied. +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 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 + 1 file(s) copied. +Tunes\bgm.vgm +Tunes\ending.vgm +Tunes\inchina.vgm +Tunes\shirakaw.vgm +Tunes\startdem.vgm +Tunes\wonder01.vgm + 6 file(s) copied. +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 + 1 file(s) copied. +assign.com +format.com +mode.com +rtc.com +rtchb.com +survey.com +syscopy.com +sysgen.com +talk.com +timer.com + 10 file(s) copied. +Z80/Z180/Z280 Macro-Assembler V4.4 + +Errors: 0 +Finished. + +LINK 1.31 + +ABSOLUTE 0000 +CODE SIZE 1700 (0200-18FF) +DATA SIZE 0000 +COMMON SIZE 0000 +USE FACTOR 00 + +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +TASTYBASIC ROM padding: 66 bytes. +TASTYBASIC space remaining: 68 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +TASTYBASIC ROM padding: 107 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + 1 file(s) copied. + 1 file(s) copied. + +Preparing compressed font files... + 1 file(s) copied. + 1 file(s) copied. +Making ROM Disk rom256_wbw +Making ROM Disk rom256_una +Making ROM Disk rom512_wbw +Making ROM Disk rom512_una +Making ROM Disk rom1024_wbw +Making ROM Disk rom1024_una + +Building Floppy Disk Images... + +Generating cpm22 1.44MB Floppy Disk... +cpmcp -f wbw_fd144 fd144_cpm22.img d_cpm22/u0/*.* 0: +cpmcp -f wbw_fd144 fd144_cpm22.img d_cpm22/ReadMe.txt 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/sysgen.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_fd144 fd144_cpm22.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_fd144 fd144_cpm22.img ../CPM22/cpm_wbw.sys 0:cpm.sys +cpmcp -f wbw_fd144 fd144_cpm22.img Common/All/*.* 0: +cpmcp -f wbw_fd144 fd144_cpm22.img Common/CPM22/*.* 0: +Moving image fd144_cpm22.img into output directory... +Generating zsdos 1.44MB Floppy Disk... +cpmcp -f wbw_fd144 fd144_zsdos.img d_zsdos/u0/*.* 0: +cpmcp -f wbw_fd144 fd144_zsdos.img d_zsdos/ReadMe.txt 0: +cpmcp -f wbw_fd144 fd144_zsdos.img d_cpm22/u0/ASM.COM 0: +cpmcp -f wbw_fd144 fd144_zsdos.img d_cpm22/u0/LIB.COM 0: +cpmcp -f wbw_fd144 fd144_zsdos.img d_cpm22/u0/LINK.COM 0: +cpmcp -f wbw_fd144 fd144_zsdos.img d_cpm22/u0/LOAD.COM 0: +cpmcp -f wbw_fd144 fd144_zsdos.img d_cpm22/u0/MAC.COM 0: +cpmcp -f wbw_fd144 fd144_zsdos.img d_cpm22/u0/RMAC.COM 0: +cpmcp -f wbw_fd144 fd144_zsdos.img d_cpm22/u0/STAT.COM 0: +cpmcp -f wbw_fd144 fd144_zsdos.img d_cpm22/u0/SUBMIT.COM 0: +cpmcp -f wbw_fd144 fd144_zsdos.img d_cpm22/u0/XSUB.COM 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/sysgen.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_fd144 fd144_zsdos.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_fd144 fd144_zsdos.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys +cpmcp -f wbw_fd144 fd144_zsdos.img Common/All/*.* 0: +cpmcp -f wbw_fd144 fd144_zsdos.img Common/CPM22/*.* 0: +cpmcp -f wbw_fd144 fd144_zsdos.img Common/Z/u14/*.* 0: +cpmcp -f wbw_fd144 fd144_zsdos.img Common/Z/u15/*.* 0: +Moving image fd144_zsdos.img into output directory... +Generating nzcom 1.44MB Floppy Disk... +cpmcp -f wbw_fd144 fd144_nzcom.img d_nzcom/u0/*.* 0: +cpmcp -f wbw_fd144 fd144_nzcom.img d_nzcom/ReadMe.txt 0: +cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_fd144 fd144_nzcom.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_fd144 fd144_nzcom.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys +cpmcp -f wbw_fd144 fd144_nzcom.img Common/All/*.* 0: +cpmcp -f wbw_fd144 fd144_nzcom.img Common/CPM22/*.* 0: +cpmcp -f wbw_fd144 fd144_nzcom.img Common/Z/u14/*.* 0: +cpmcp -f wbw_fd144 fd144_nzcom.img Common/Z/u15/*.* 0: +cpmcp -f wbw_fd144 fd144_nzcom.img Common/Z3/u10/*.* 0: +cpmcp -f wbw_fd144 fd144_nzcom.img Common/Z3/u14/*.* 0: +cpmcp -f wbw_fd144 fd144_nzcom.img Common/Z3/u15/*.* 0: +Moving image fd144_nzcom.img into output directory... +Generating cpm3 1.44MB Floppy Disk... +cpmcp -f wbw_fd144 fd144_cpm3.img d_cpm3/u0/*.* 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpmldr.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpmldr.sys 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/ccp.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/gencpm.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/genres.dat 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/genbnk.dat 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/bios3.spr 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/bnkbios3.spr 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/bdos3.spr 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/bnkbdos3.spr 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/resbdos3.spr 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpm3res.sys 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpm3bnk.sys 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/gencpm.dat 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpm3.sys 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/readme.1st 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../CPM3/cpm3fix.pat 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_fd144 fd144_cpm3.img Common/All/*.* 0: +cpmcp -f wbw_fd144 fd144_cpm3.img Common/CPM3/*.* 0: +Moving image fd144_cpm3.img into output directory... +Generating zpm3 1.44MB Floppy Disk... +cpmcp -f wbw_fd144 fd144_zpm3.img d_zpm3/u0/*.* 0: +cpmcp -f wbw_fd144 fd144_zpm3.img d_zpm3/u10/*.* 10: +cpmcp -f wbw_fd144 fd144_zpm3.img d_zpm3/u14/*.* 14: +cpmcp -f wbw_fd144 fd144_zpm3.img d_zpm3/u15/*.* 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/zpmldr.com 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/zpmldr.sys 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../CPM3/cpmldr.com 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../CPM3/cpmldr.sys 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/autotog.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/clrhist.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/setz3.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/cpm3.sys 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/zccp.com 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/zinstal.zpm 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/startzpm.com 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/makedos.com 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/gencpm.dat 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/bnkbios3.spr 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/bnkbdos3.spr 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../ZPM3/resbdos3.spr 0: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/assign.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/cpuspd.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/fat.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/fdu.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/fdu.doc 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/mode.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/rtc.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/survey.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/syscopy.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/sysgen.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/talk.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/tbasic.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/timer.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/tune.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img ../../Binary/Apps/xm.com 15: +cpmcp -f wbw_fd144 fd144_zpm3.img Common/All/*.* 15: +cpmcp -f wbw_fd144 fd144_zpm3.img Common/CPM3/*.* 15: +cpmcp -f wbw_fd144 fd144_zpm3.img Common/Z/u14/*.* 14: +cpmcp -f wbw_fd144 fd144_zpm3.img Common/Z/u15/*.* 15: +cpmcp -f wbw_fd144 fd144_zpm3.img Common/Z3/u10/*.* 10: +cpmcp -f wbw_fd144 fd144_zpm3.img Common/Z3/u14/*.* 14: +cpmcp -f wbw_fd144 fd144_zpm3.img Common/Z3/u15/*.* 15: +Moving image fd144_zpm3.img into output directory... +Generating ws4 1.44MB Floppy Disk... +cpmcp -f wbw_fd144 fd144_ws4.img d_ws4/u0/*.* 0: +cpmcp -f wbw_fd144 fd144_ws4.img d_ws4/u1/*.* 1: +Moving image fd144_ws4.img into output directory... +Generating qpm 1.44MB Floppy Disk... +cpmcp -f wbw_fd144 fd144_qpm.img d_qpm/u0/*.* 0: +cpmcp -f wbw_fd144 fd144_qpm.img d_qpm/ReadMe.txt 0: +cpmcp -f wbw_fd144 fd144_qpm.img d_cpm22/u0/*.* 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/sysgen.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_fd144 fd144_qpm.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_fd144 fd144_qpm.img ../CPM22/cpm_wbw.sys 0:cpm.sys +cpmcp -f wbw_fd144 fd144_qpm.img Common/All/*.* 0: +cpmcp -f wbw_fd144 fd144_qpm.img Common/CPM22/*.* 0: +Moving image fd144_qpm.img into output directory... + +Building Hard Disk Images (512 directory entry format)... + +Generating cpm22 Hard Disk (512 directory entry format)... +cpmcp -f wbw_hd512 hd512_cpm22.img d_cpm22/u0/*.* 0: +cpmcp -f wbw_hd512 hd512_cpm22.img d_cpm22/ReadMe.txt 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/sysgen.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd512 hd512_cpm22.img Test/*.* 2: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd512 hd512_cpm22.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd512 hd512_cpm22.img cpnet12/*.* 4: +cpmcp -f wbw_hd512 hd512_cpm22.img ../CPM22/cpm_wbw.sys 0:cpm.sys +cpmcp -f wbw_hd512 hd512_cpm22.img Common/All/*.* 0: +cpmcp -f wbw_hd512 hd512_cpm22.img Common/CPM22/*.* 0: +cpmcp -f wbw_hd512 hd512_cpm22.img Common/SIMH/*.* 13: +Moving image hd512_cpm22.img into output directory... +Generating zsdos Hard Disk (512 directory entry format)... +cpmcp -f wbw_hd512 hd512_zsdos.img d_zsdos/u0/*.* 0: +cpmcp -f wbw_hd512 hd512_zsdos.img d_zsdos/ReadMe.txt 0: +cpmcp -f wbw_hd512 hd512_zsdos.img d_cpm22/u0/ASM.COM 0: +cpmcp -f wbw_hd512 hd512_zsdos.img d_cpm22/u0/LIB.COM 0: +cpmcp -f wbw_hd512 hd512_zsdos.img d_cpm22/u0/LINK.COM 0: +cpmcp -f wbw_hd512 hd512_zsdos.img d_cpm22/u0/LOAD.COM 0: +cpmcp -f wbw_hd512 hd512_zsdos.img d_cpm22/u0/MAC.COM 0: +cpmcp -f wbw_hd512 hd512_zsdos.img d_cpm22/u0/RMAC.COM 0: +cpmcp -f wbw_hd512 hd512_zsdos.img d_cpm22/u0/STAT.COM 0: +cpmcp -f wbw_hd512 hd512_zsdos.img d_cpm22/u0/SUBMIT.COM 0: +cpmcp -f wbw_hd512 hd512_zsdos.img d_cpm22/u0/XSUB.COM 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/sysgen.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd512 hd512_zsdos.img Test/*.* 2: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd512 hd512_zsdos.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd512 hd512_zsdos.img cpnet12/*.* 4: +cpmcp -f wbw_hd512 hd512_zsdos.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys +cpmcp -f wbw_hd512 hd512_zsdos.img Common/All/*.* 0: +cpmcp -f wbw_hd512 hd512_zsdos.img Common/CPM22/*.* 0: +cpmcp -f wbw_hd512 hd512_zsdos.img Common/Z/u14/*.* 0: +cpmcp -f wbw_hd512 hd512_zsdos.img Common/Z/u15/*.* 0: +cpmcp -f wbw_hd512 hd512_zsdos.img Common/SIMH/*.* 13: +Moving image hd512_zsdos.img into output directory... +Generating nzcom Hard Disk (512 directory entry format)... +cpmcp -f wbw_hd512 hd512_nzcom.img d_nzcom/u0/*.* 0: +cpmcp -f wbw_hd512 hd512_nzcom.img d_nzcom/ReadMe.txt 0: +cpmcp -f wbw_hd512 hd512_nzcom.img d_cpm22/u0/ASM.COM 0: +cpmcp -f wbw_hd512 hd512_nzcom.img d_cpm22/u0/LIB.COM 0: +cpmcp -f wbw_hd512 hd512_nzcom.img d_cpm22/u0/LINK.COM 0: +cpmcp -f wbw_hd512 hd512_nzcom.img d_cpm22/u0/LOAD.COM 0: +cpmcp -f wbw_hd512 hd512_nzcom.img d_cpm22/u0/MAC.COM 0: +cpmcp -f wbw_hd512 hd512_nzcom.img d_cpm22/u0/RMAC.COM 0: +cpmcp -f wbw_hd512 hd512_nzcom.img d_cpm22/u0/STAT.COM 0: +cpmcp -f wbw_hd512 hd512_nzcom.img d_cpm22/u0/SUBMIT.COM 0: +cpmcp -f wbw_hd512 hd512_nzcom.img d_cpm22/u0/XSUB.COM 0: +cpmcp -f wbw_hd512 hd512_nzcom.img d_zsdos/u0/*.* 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/sysgen.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd512 hd512_nzcom.img Test/*.* 2: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd512 hd512_nzcom.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd512 hd512_nzcom.img cpnet12/*.* 4: +cpmcp -f wbw_hd512 hd512_nzcom.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys +cpmcp -f wbw_hd512 hd512_nzcom.img Common/All/*.* 0: +cpmcp -f wbw_hd512 hd512_nzcom.img Common/CPM22/*.* 0: +cpmcp -f wbw_hd512 hd512_nzcom.img Common/Z/u14/*.* 0: +cpmcp -f wbw_hd512 hd512_nzcom.img Common/Z/u15/*.* 0: +cpmcp -f wbw_hd512 hd512_nzcom.img Common/Z3/u10/*.* 0: +cpmcp -f wbw_hd512 hd512_nzcom.img Common/Z3/u14/*.* 0: +cpmcp -f wbw_hd512 hd512_nzcom.img Common/Z3/u15/*.* 0: +cpmcp -f wbw_hd512 hd512_nzcom.img Common/SIMH/*.* 13: +Moving image hd512_nzcom.img into output directory... +Generating cpm3 Hard Disk (512 directory entry format)... +cpmcp -f wbw_hd512 hd512_cpm3.img d_cpm3/u0/*.* 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpmldr.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpmldr.sys 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/ccp.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/gencpm.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/genres.dat 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/genbnk.dat 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/bios3.spr 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/bnkbios3.spr 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/bdos3.spr 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/bnkbdos3.spr 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/resbdos3.spr 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpm3res.sys 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpm3bnk.sys 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/gencpm.dat 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpm3.sys 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/readme.1st 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../CPM3/cpm3fix.pat 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd512 hd512_cpm3.img Test/*.* 2: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd512 hd512_cpm3.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd512 hd512_cpm3.img cpnet3/*.* 4: +cpmcp -f wbw_hd512 hd512_cpm3.img Common/All/*.* 0: +cpmcp -f wbw_hd512 hd512_cpm3.img Common/CPM3/*.* 0: +cpmcp -f wbw_hd512 hd512_cpm3.img Common/SIMH/*.* 13: +Moving image hd512_cpm3.img into output directory... +Generating zpm3 Hard Disk (512 directory entry format)... +cpmcp -f wbw_hd512 hd512_zpm3.img d_zpm3/u0/*.* 0: +cpmcp -f wbw_hd512 hd512_zpm3.img d_zpm3/u10/*.* 10: +cpmcp -f wbw_hd512 hd512_zpm3.img d_zpm3/u14/*.* 14: +cpmcp -f wbw_hd512 hd512_zpm3.img d_zpm3/u15/*.* 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/zpmldr.com 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/zpmldr.sys 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../CPM3/cpmldr.com 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../CPM3/cpmldr.sys 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/autotog.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/clrhist.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/setz3.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/cpm3.sys 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/zccp.com 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/zinstal.zpm 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/startzpm.com 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/makedos.com 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/gencpm.dat 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/bnkbios3.spr 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/bnkbdos3.spr 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../ZPM3/resbdos3.spr 0: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/assign.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/cpuspd.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/fat.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/fdu.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/fdu.doc 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/format.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/mode.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/rtc.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/survey.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/syscopy.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/sysgen.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/talk.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/tbasic.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/timer.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/tune.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/xm.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/zmp.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/zmp.hlp 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/zmp.doc 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/zmxfer.ovr 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/zmterm.ovr 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/zminit.ovr 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/zmconfig.ovr 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/zmd.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/vgmplay.com 15: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd512 hd512_zpm3.img Test/*.* 2: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd512 hd512_zpm3.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd512 hd512_zpm3.img cpnet3/*.* 4: +cpmcp -f wbw_hd512 hd512_zpm3.img Common/All/*.* 15: +cpmcp -f wbw_hd512 hd512_zpm3.img Common/CPM3/*.* 15: +cpmcp -f wbw_hd512 hd512_zpm3.img Common/Z/u14/*.* 14: +cpmcp -f wbw_hd512 hd512_zpm3.img Common/Z/u15/*.* 15: +cpmcp -f wbw_hd512 hd512_zpm3.img Common/Z3/u10/*.* 10: +cpmcp -f wbw_hd512 hd512_zpm3.img Common/Z3/u14/*.* 14: +cpmcp -f wbw_hd512 hd512_zpm3.img Common/Z3/u15/*.* 15: +cpmcp -f wbw_hd512 hd512_zpm3.img Common/SIMH/*.* 13: +Moving image hd512_zpm3.img into output directory... +Generating ws4 Hard Disk (512 directory entry format)... +cpmcp -f wbw_hd512 hd512_ws4.img d_ws4/u0/*.* 0: +cpmcp -f wbw_hd512 hd512_ws4.img d_ws4/u1/*.* 1: +Moving image hd512_ws4.img into output directory... +Generating dos65 Hard Disk (512 directory entry format)... +cpmcp -f wbw_hd512 hd512_dos65.img d_dos65/u0/*.* 0: +Moving image hd512_dos65.img into output directory... +Generating qpm Hard Disk (512 directory entry format)... +cpmcp -f wbw_hd512 hd512_qpm.img d_qpm/u0/*.* 0: +cpmcp -f wbw_hd512 hd512_qpm.img d_qpm/ReadMe.txt 0: +cpmcp -f wbw_hd512 hd512_qpm.img d_cpm22/u0/*.* 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/sysgen.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd512 hd512_qpm.img Test/*.* 2: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd512 hd512_qpm.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd512 hd512_qpm.img cpnet12/*.* 4: +cpmcp -f wbw_hd512 hd512_qpm.img ../CPM22/cpm_wbw.sys 0:cpm.sys +cpmcp -f wbw_hd512 hd512_qpm.img Common/All/*.* 0: +cpmcp -f wbw_hd512 hd512_qpm.img Common/CPM22/*.* 0: +cpmcp -f wbw_hd512 hd512_qpm.img Common/SIMH/*.* 13: +Moving image hd512_qpm.img into output directory... + +Building Combo Disk (512 directory entry format) Image... +..\..\Binary\hd512_cpm22.img +..\..\Binary\hd512_zsdos.img +..\..\Binary\hd512_nzcom.img +..\..\Binary\hd512_cpm3.img +..\..\Binary\hd512_zpm3.img +..\..\Binary\hd512_ws4.img + 1 file(s) copied. + +Building Hard Disk Images (1024 directory entry format)... + +Generating cpm22 Hard Disk (1024 directory entry format)... +cpmcp -f wbw_hd1k hd1k_cpm22.img d_cpm22/u0/*.* 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img d_cpm22/ReadMe.txt 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/sysgen.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd1k hd1k_cpm22.img Test/*.* 2: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd1k hd1k_cpm22.img cpnet12/*.* 4: +cpmcp -f wbw_hd1k hd1k_cpm22.img ../CPM22/cpm_wbw.sys 0:cpm.sys +cpmcp -f wbw_hd1k hd1k_cpm22.img Common/All/*.* 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img Common/CPM22/*.* 0: +cpmcp -f wbw_hd1k hd1k_cpm22.img Common/SIMH/*.* 13: +Moving image hd1k_cpm22.img into output directory... +Generating zsdos Hard Disk (1024 directory entry format)... +cpmcp -f wbw_hd1k hd1k_zsdos.img d_zsdos/u0/*.* 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img d_zsdos/ReadMe.txt 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img d_cpm22/u0/ASM.COM 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img d_cpm22/u0/LIB.COM 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img d_cpm22/u0/LINK.COM 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img d_cpm22/u0/LOAD.COM 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img d_cpm22/u0/MAC.COM 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img d_cpm22/u0/RMAC.COM 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img d_cpm22/u0/STAT.COM 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img d_cpm22/u0/SUBMIT.COM 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img d_cpm22/u0/XSUB.COM 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/sysgen.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd1k hd1k_zsdos.img Test/*.* 2: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd1k hd1k_zsdos.img cpnet12/*.* 4: +cpmcp -f wbw_hd1k hd1k_zsdos.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys +cpmcp -f wbw_hd1k hd1k_zsdos.img Common/All/*.* 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img Common/CPM22/*.* 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img Common/Z/u14/*.* 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img Common/Z/u15/*.* 0: +cpmcp -f wbw_hd1k hd1k_zsdos.img Common/SIMH/*.* 13: +Moving image hd1k_zsdos.img into output directory... +Generating nzcom Hard Disk (1024 directory entry format)... +cpmcp -f wbw_hd1k hd1k_nzcom.img d_nzcom/u0/*.* 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img d_nzcom/ReadMe.txt 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img d_cpm22/u0/ASM.COM 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img d_cpm22/u0/LIB.COM 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img d_cpm22/u0/LINK.COM 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img d_cpm22/u0/LOAD.COM 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img d_cpm22/u0/MAC.COM 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img d_cpm22/u0/RMAC.COM 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img d_cpm22/u0/STAT.COM 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img d_cpm22/u0/SUBMIT.COM 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img d_cpm22/u0/XSUB.COM 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img d_zsdos/u0/*.* 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/sysgen.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd1k hd1k_nzcom.img Test/*.* 2: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd1k hd1k_nzcom.img cpnet12/*.* 4: +cpmcp -f wbw_hd1k hd1k_nzcom.img ../ZSDOS/zsys_wbw.sys 0:zsys.sys +cpmcp -f wbw_hd1k hd1k_nzcom.img Common/All/*.* 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img Common/CPM22/*.* 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img Common/Z/u14/*.* 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img Common/Z/u15/*.* 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img Common/Z3/u10/*.* 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img Common/Z3/u14/*.* 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img Common/Z3/u15/*.* 0: +cpmcp -f wbw_hd1k hd1k_nzcom.img Common/SIMH/*.* 13: +Moving image hd1k_nzcom.img into output directory... +Generating cpm3 Hard Disk (1024 directory entry format)... +cpmcp -f wbw_hd1k hd1k_cpm3.img d_cpm3/u0/*.* 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpmldr.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpmldr.sys 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/ccp.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/gencpm.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/genres.dat 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/genbnk.dat 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/bios3.spr 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/bnkbios3.spr 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/bdos3.spr 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/bnkbdos3.spr 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/resbdos3.spr 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpm3res.sys 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpm3bnk.sys 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/gencpm.dat 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpm3.sys 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/readme.1st 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../CPM3/cpm3fix.pat 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd1k hd1k_cpm3.img Test/*.* 2: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd1k hd1k_cpm3.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd1k hd1k_cpm3.img cpnet3/*.* 4: +cpmcp -f wbw_hd1k hd1k_cpm3.img Common/All/*.* 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img Common/CPM3/*.* 0: +cpmcp -f wbw_hd1k hd1k_cpm3.img Common/SIMH/*.* 13: +Moving image hd1k_cpm3.img into output directory... +Generating zpm3 Hard Disk (1024 directory entry format)... +cpmcp -f wbw_hd1k hd1k_zpm3.img d_zpm3/u0/*.* 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img d_zpm3/u10/*.* 10: +cpmcp -f wbw_hd1k hd1k_zpm3.img d_zpm3/u14/*.* 14: +cpmcp -f wbw_hd1k hd1k_zpm3.img d_zpm3/u15/*.* 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/zpmldr.com 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/zpmldr.sys 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../CPM3/cpmldr.com 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../CPM3/cpmldr.sys 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/autotog.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/clrhist.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/setz3.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/cpm3.sys 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/zccp.com 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/zinstal.zpm 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/startzpm.com 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/makedos.com 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/gencpm.dat 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/bnkbios3.spr 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/bnkbdos3.spr 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../ZPM3/resbdos3.spr 0: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/assign.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/cpuspd.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/fat.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/fdu.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/fdu.doc 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/format.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/mode.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/rtc.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/survey.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/syscopy.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/sysgen.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/talk.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/tbasic.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/timer.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/tune.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/xm.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/zmp.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/zmp.hlp 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/zmp.doc 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/zmxfer.ovr 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/zmterm.ovr 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/zminit.ovr 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/zmconfig.ovr 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/zmd.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/vgmplay.com 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd1k hd1k_zpm3.img Test/*.* 2: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd1k hd1k_zpm3.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd1k hd1k_zpm3.img cpnet3/*.* 4: +cpmcp -f wbw_hd1k hd1k_zpm3.img Common/All/*.* 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img Common/CPM3/*.* 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img Common/Z/u14/*.* 14: +cpmcp -f wbw_hd1k hd1k_zpm3.img Common/Z/u15/*.* 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img Common/Z3/u10/*.* 10: +cpmcp -f wbw_hd1k hd1k_zpm3.img Common/Z3/u14/*.* 14: +cpmcp -f wbw_hd1k hd1k_zpm3.img Common/Z3/u15/*.* 15: +cpmcp -f wbw_hd1k hd1k_zpm3.img Common/SIMH/*.* 13: +Moving image hd1k_zpm3.img into output directory... +Generating ws4 Hard Disk (1024 directory entry format)... +cpmcp -f wbw_hd1k hd1k_ws4.img d_ws4/u0/*.* 0: +cpmcp -f wbw_hd1k hd1k_ws4.img d_ws4/u1/*.* 1: +Moving image hd1k_ws4.img into output directory... +Generating qpm Hard Disk (1024 directory entry format)... +cpmcp -f wbw_hd1k hd1k_qpm.img d_qpm/u0/*.* 0: +cpmcp -f wbw_hd1k hd1k_qpm.img d_qpm/ReadMe.txt 0: +cpmcp -f wbw_hd1k hd1k_qpm.img d_cpm22/u0/*.* 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/assign.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/cpuspd.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/fat.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/fdu.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/fdu.doc 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/format.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/mode.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/rtc.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/survey.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/syscopy.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/sysgen.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/talk.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/tbasic.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/timer.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/tune.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/xm.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/zmp.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/zmp.hlp 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/zmp.doc 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/zmxfer.ovr 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/zmterm.ovr 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/zminit.ovr 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/zmconfig.ovr 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/zmd.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/vgmplay.com 0: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/Test/*.com 2: +cpmcp -f wbw_hd1k hd1k_qpm.img Test/*.* 2: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/Tunes/*.pt? 3: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/Tunes/*.mym 3: +cpmcp -f wbw_hd1k hd1k_qpm.img ../../Binary/Apps/Tunes/*.vgm 3: +cpmcp -f wbw_hd1k hd1k_qpm.img cpnet12/*.* 4: +cpmcp -f wbw_hd1k hd1k_qpm.img ../CPM22/cpm_wbw.sys 0:cpm.sys +cpmcp -f wbw_hd1k hd1k_qpm.img Common/All/*.* 0: +cpmcp -f wbw_hd1k hd1k_qpm.img Common/CPM22/*.* 0: +cpmcp -f wbw_hd1k hd1k_qpm.img Common/SIMH/*.* 13: +Moving image hd1k_qpm.img into output directory... + 1 file(s) copied. + +Building Combo Disk (1024 directory entry format) Image... +hd1k_prefix.dat +..\..\Binary\hd1k_cpm22.img +..\..\Binary\hd1k_zsdos.img +..\..\Binary\hd1k_nzcom.img +..\..\Binary\hd1k_cpm3.img +..\..\Binary\hd1k_zpm3.img +..\..\Binary\hd1k_ws4.img + 1 file(s) copied. +Platform [SBC|MBC|ZETA|ZETA2|RCZ80|EZZ80|UNA|N8|MK4|RCZ180|SCZ180|DYNO|RPH|RCZ280]: MK4 +Configurations available: + > dbg + > std + > wbw +Configuration: std +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +SYSTEM TIMER: Z180 +tasm: pass 2 complete. +tasm: Number of errors = 0 +Building 512K ROM MK4_std for Z180 CPU... +..\Fonts\font8x11c.asm +..\Fonts\font8x11u.asm +..\Fonts\font8x16c.asm +..\Fonts\font8x16u.asm +..\Fonts\font8x8c.asm +..\Fonts\font8x8u.asm +..\Fonts\fontcgac.asm +..\Fonts\fontcgau.asm + 8 file(s) copied. +TASM Z180 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +SYSTEM TIMER: Z180 +HBIOS INT STACK space: 46 bytes. +HBIOS TEMP STACK space: 20 bytes. +DSRTC occupies 697 bytes. +ASCI occupies 839 bytes. +UART occupies 802 bytes. +VGA occupies 1051 bytes. +CVDU occupies 904 bytes. +FONTS 8X16 occupy 1466 bytes. +KBD occupies 1064 bytes. +PRP occupies 1397 bytes. +MD occupies 449 bytes. +FD occupies 2397 bytes. +IDE occupies 1606 bytes. +SD occupies 2254 bytes. +TERM occupies 2091 bytes. +RTCDEF=32 +UNLZSA2 for Z80. +HBIOS space remaining: 7689 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 +TASM Z180 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +SYSTEM TIMER: Z180 +HBIOS INT STACK space: 46 bytes. +HBIOS TEMP STACK space: 20 bytes. +DSRTC occupies 697 bytes. +ASCI occupies 839 bytes. +UART occupies 802 bytes. +VGA occupies 1051 bytes. +CVDU occupies 904 bytes. +FONTS 8X16 occupy 1466 bytes. +KBD occupies 1064 bytes. +PRP occupies 1397 bytes. +MD occupies 449 bytes. +FD occupies 2397 bytes. +IDE occupies 1606 bytes. +SD occupies 2254 bytes. +TERM occupies 2091 bytes. +RTCDEF=32 +UNLZSA2 for Z80. +HBIOS space remaining: 7744 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 +TASM Z180 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +SYSTEM TIMER: Z180 +HBIOS INT STACK space: 46 bytes. +HBIOS TEMP STACK space: 20 bytes. +DSRTC occupies 697 bytes. +ASCI occupies 839 bytes. +UART occupies 802 bytes. +VGA occupies 1051 bytes. +CVDU occupies 904 bytes. +FONTS 8X16 occupy 1466 bytes. +KBD occupies 1064 bytes. +PRP occupies 1397 bytes. +MD occupies 449 bytes. +FD occupies 2397 bytes. +IDE occupies 1606 bytes. +SD occupies 2254 bytes. +TERM occupies 2091 bytes. +RTCDEF=32 +UNLZSA2 for Z80. +HBIOS space remaining: 7770 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + +Building dbgmon... +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +SYSTEM TIMER: Z180 +DBGMON space remaining: 793 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + +Building romldr... +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +SYSTEM TIMER: Z180 +LOADER space remaining: 703 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + +Building eastaegg... +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +SYSTEM TIMER: Z180 +EASTEREGG space remaining: 78 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + +Building nascom... +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +SYSTEM TIMER: Z180 +BASIC space remaining: 247 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + +Building game... +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +SYSTEM TIMER: Z180 +GAME space remaining: 189 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + +Building usrrom... +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +SYSTEM TIMER: Z180 +User ROM space remaining: 5763 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + +Building updater... +TASM Z80 Assembler. Version 3.2 September, 2001. + Copyright (C) 2001 Squak Valley Software +tasm: pass 1 complete. +SYSTEM TIMER: Z180 +ROM Updater space remaining: 257 bytes. +tasm: pass 2 complete. +tasm: Number of errors = 0 + +Building imgpad2... +TASM Z80 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. +SYSTEM TIMER: Z180 +Padspace space created: 32768 bytes. tasm: pass 2 complete. tasm: Number of errors = 0 -Building MK4_cust output files... -Building 512KB MK4_cust ROM disk data file... +romldr.bin +dbgmon.bin +..\zsdos\zsys_wbw.bin +..\cpm22\cpm_wbw.bin + 1 file(s) copied. +..\Forth\camel80.bin +nascom.bin +..\tastybasic\src\tastybasic.bin +game.bin +eastaegg.bin +netboot.mod +updater.bin +usrrom.bin + 1 file(s) copied. + 1 file(s) copied. +romldr.bin +dbgmon.bin +..\zsdos\zsys_wbw.bin + 1 file(s) copied. +hbios_rom.bin +osimg.bin +osimg1.bin +osimg2.bin +..\RomDsk\rom512_wbw.dat + 1 file(s) copied. +hbios_rom.bin +osimg.bin +osimg1.bin +osimg2.bin + 1 file(s) copied. +hbios_app.bin +osimg_small.bin + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + +C:\Users\Wayne\Projects\RomWBW> \ No newline at end of file diff --git a/Source/RomDsk/Build.cmd b/Source/RomDsk/Build.cmd new file mode 100644 index 00000000..a13f1a2f --- /dev/null +++ b/Source/RomDsk/Build.cmd @@ -0,0 +1,67 @@ +@echo off +setlocal + +set TOOLS=../../Tools + +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%TOOLS%\srecord;%TOOLS%\cpmtools;%PATH% + +set TASMTABS=%TOOLS%\tasm32 + +set CPMDIR80=%TOOLS%/cpm/ + +set RomApps1=assign mode rtc syscopy xm +set RomApps2=fdu format survey sysgen talk timer cpuspd + +:: +:: Make all variants of the ROM Disk contents image. Three sizes are +:: created for each of the different ROM sizes possible (256K, 512K, 1024K). +:: Also, the UNA ROM Disks contain different versions of the OS files. +:: +:: Note that the sizes specified below are not the size of the final +:: ROM. The ROM reserves 128K for code space. So, the size created is +:: the final ROM size less 128K. +:: + +set RomApps= + +copy NUL rom128_wbw.dat +copy NUL rom128_una.dat + +:: MakeDisk + +set RomApps=%RomApps1% + +call :MakeDisk rom256_wbw 256 0x20000 wbw +call :MakeDisk rom256_una 256 0x20000 una + +set RomApps=%RomApps1% %RomApps2% + +call :MakeDisk rom512_wbw 512 0x60000 wbw +call :MakeDisk rom512_una 512 0x60000 una + +call :MakeDisk rom1024_wbw 1024 0xE0000 wbw +call :MakeDisk rom1024_una 1024 0xE0000 una + +goto :eof + +:MakeDisk +set Output=%1 +set RomSize=%2 +set ImgSize=%3 +set Bios=%4 + +echo Making ROM Disk %Output% + +:: Create the empty disk image file +srec_cat -Generate 0 %ImgSize% --Constant 0xE5 -Output %Output%.dat -Binary || exit /b + +:: Populate the disk image via cpmtools +cpmcp -f wbw_rom%RomSize% %Output%.dat ROM_%RomSize%KB/*.* 0: || exit /b +for %%f in (%RomApps%) do cpmcp -f wbw_rom%RomSize% %Output%.dat ../../Binary/Apps/%%f.com 0: || exit /b +cpmcp -f wbw_rom%RomSize% %Output%.dat ..\cpm22\cpm_%Bios%.sys 0:cpm.sys || exit /b +cpmcp -f wbw_rom%RomSize% %Output%.dat ..\zsdos\zsys_%Bios%.sys 0:zsys.sys || exit /b + +:: Mark all disk files R/O for safety +cpmchattr -f wbw_rom%RomSize% %Output%.dat r 0:*.* || exit /b + +goto :eof diff --git a/Source/RomDsk/Clean.cmd b/Source/RomDsk/Clean.cmd new file mode 100644 index 00000000..0b90e072 --- /dev/null +++ b/Source/RomDsk/Clean.cmd @@ -0,0 +1,4 @@ +@echo off +setlocal + +if exist *.dat del *.dat diff --git a/Source/RomDsk/Makefile b/Source/RomDsk/Makefile new file mode 100644 index 00000000..8d32a429 --- /dev/null +++ b/Source/RomDsk/Makefile @@ -0,0 +1,36 @@ +OBJECTS = rom128_wbw.dat rom128_una.dat rom256_wbw.dat rom256_una.dat rom512_wbw.dat rom512_una.dat rom1024_wbw.dat rom1024_una.dat +OTHERS=*.dat + +TOOLS = ../../Tools +include $(TOOLS)/Makefile.inc + +.SHELLFLAGS = -ce + +ROMAPPS1 := assign mode rtc syscopy xm +ROMAPPS2 := fdu format survey sysgen talk timer cpuspd + +rom256_%.dat: ROMSIZ=256 +rom512_%.dat: ROMSIZ=512 +rom1024_%.dat: ROMSIZ=1024 + +rom256_%.dat: IMGSIZ=0x20000 +rom512_%.dat: IMGSIZ=0x60000 +rom1024_%.dat: IMGSIZ=0xE0000 + +rom256_%.dat: ROMAPPS=$(ROMAPPS1) +rom512_%.dat rom1024_%.dat: ROMAPPS=$(ROMAPPS1) $(ROMAPPS2) + +rom%_wbw.dat: BIOS=wbw +rom%_una.dat: BIOS=una + +rom128_%.dat: + touch $@ + +%.dat: + ### Making ROM Disk $@ + srec_cat -Generate 0 $(IMGSIZ) --Constant 0xE5 -Output $@ -Binary + $(CPMCP) -f wbw_rom$(ROMSIZ) $@ ROM_$(ROMSIZ)KB/*.* 0: + for i in $(ROMAPPS) ; do $(CPMCP) -f wbw_rom$(ROMSIZ) $@ ../../Binary/Apps/$$i.com 0: ; done + $(CPMCP) -f wbw_rom$(ROMSIZ) $@ ../CPM22/cpm_$(BIOS).sys 0:cpm.sys + $(CPMCP) -f wbw_rom$(ROMSIZ) $@ ../ZSDOS/zsys_$(BIOS).sys 0:zsys.sys + $(CPMCHATTR) -f wbw_rom$(ROMSIZ) $@ r 0:*.* diff --git a/Source/RomDsk/ROM_1024KB/CLRDIR.COM b/Source/RomDsk/ROM_1024KB/CLRDIR.COM index c6b05cc9..ca65cbed 100644 Binary files a/Source/RomDsk/ROM_1024KB/CLRDIR.COM and b/Source/RomDsk/ROM_1024KB/CLRDIR.COM differ diff --git a/Source/RomDsk/ROM_1024KB/COPY.COM b/Source/RomDsk/ROM_1024KB/COPY.COM index 87c0c2fb..606c81a5 100644 Binary files a/Source/RomDsk/ROM_1024KB/COPY.COM and b/Source/RomDsk/ROM_1024KB/COPY.COM differ diff --git a/Source/RomDsk/ROM_1024KB/EX.COM b/Source/RomDsk/ROM_1024KB/EX.COM new file mode 100644 index 00000000..49cb0b81 Binary files /dev/null and b/Source/RomDsk/ROM_1024KB/EX.COM differ diff --git a/Source/RomDsk/ROM_1024KB/FAT.COM b/Source/RomDsk/ROM_1024KB/FAT.COM index 1dd7dcca..688faa99 100644 Binary files a/Source/RomDsk/ROM_1024KB/FAT.COM and b/Source/RomDsk/ROM_1024KB/FAT.COM differ diff --git a/Source/RomDsk/ROM_1024KB/FDISK80.COM b/Source/RomDsk/ROM_1024KB/FDISK80.COM index 00ac10f7..7e862d67 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/FLASH.COM b/Source/RomDsk/ROM_1024KB/FLASH.COM index 1b7fa64c..d1833a1b 100644 Binary files a/Source/RomDsk/ROM_1024KB/FLASH.COM and b/Source/RomDsk/ROM_1024KB/FLASH.COM differ diff --git a/Source/RomDsk/ROM_1024KB/RMXSUB1.COM b/Source/RomDsk/ROM_1024KB/RMXSUB1.COM new file mode 100644 index 00000000..34078336 Binary files /dev/null and b/Source/RomDsk/ROM_1024KB/RMXSUB1.COM differ diff --git a/Source/RomDsk/ROM_1024KB/UNZIP.COM b/Source/RomDsk/ROM_1024KB/UNZIP.COM index afde7204..9da369ff 100644 Binary files a/Source/RomDsk/ROM_1024KB/UNZIP.COM and b/Source/RomDsk/ROM_1024KB/UNZIP.COM differ diff --git a/Source/RomDsk/ROM_1024KB/XSUB1.COM b/Source/RomDsk/ROM_1024KB/XSUB1.COM new file mode 100644 index 00000000..c30996a4 Binary files /dev/null and b/Source/RomDsk/ROM_1024KB/XSUB1.COM differ diff --git a/Source/RomDsk/ROM_1024KB/ZDE.COM b/Source/RomDsk/ROM_1024KB/ZDE.COM index f58310ba..b80559be 100644 Binary files a/Source/RomDsk/ROM_1024KB/ZDE.COM and b/Source/RomDsk/ROM_1024KB/ZDE.COM differ diff --git a/Source/RomDsk/ROM_1024KB/ZDE.DOC b/Source/RomDsk/ROM_1024KB/ZDE.DOC new file mode 100644 index 00000000..6bf63117 --- /dev/null +++ b/Source/RomDsk/ROM_1024KB/ZDE.DOC @@ -0,0 +1,1043 @@ +ZDE 1.0 Manual + ZDE + + Z-System Display Editor + + Version 1.0 10 Mar 89 + + ZDE and its documentation are copyright 1989 by Carson Wilson, + all rights reserved. They may not be circulated in any + incomplete or modified form without written permission of the + author. Any commercial use of ZDE, defined as any situation + where the duplicator receives revenue by duplicating or + distributing ZDE by itself or in conjunction with any hardware + or software product, is expressly prohibited unless authorized + in writing by Carson Wilson. + + +1. Introduction. + + ZDE, the Z-System Display Editor, is a small, fast, powerful +text editor based Eric Meyer's famous Video Display Editor (VDE). +ZDE retains all features of VDE, but removes defects and supports +special ZCPR and ZSDOS features such as named directories, +register variables, automatic disk relog, and file datestamp +support. The install program has also been improved (see +ZDE10.NEW for a complete rundown of improvements). At the same +time, I have tried to be conscientious about the balance between +features and memory usage. If I added every new feature or +convenience that came to mind, we would soon have a luxurious +in-memory editor for 2 kilobyte files! Much of the following is +adapted with permission from Eric Meyer's VDE.DOC. + + ZDE's native ASCII mode and definable macros make it an ideal +programmer's editor; its full formatting and printing features +also make it an efficient word processor. Written entirely in Z80 +assembler, ZDE is F-A-S-T. There are no disk overlays, and all +editing is done in memory. As a result, finding a string near the +end of a 50K file takes WordStar 3.3 about 14 seconds (8MHz Z80); +ZDE does it in under a second. This is like moving through air +instead of molasses: you will find that you can do more of your +work on screen, and less on paper. + +Among ZDE's features are: + +Full-screen editing User area and named directory support +Block operations Wordwrap and reformat +File datestamp support Macro programs +Disk file operations Margins, tabs, spacing +Find and replace WordStar compatibility +Many print features Undeletion +Configurable options Support for all CP/M terminals + + +2. Installing ZDE. + + ZDE works with Z80 CP/M 2.2 and 3.0 and compatible systems. +It is ideal for portable computers with limited disk space. There +are many user configurable options, and ZDE can be installed for +all CP/M terminals. If you are running ZCPR, ZSDOS or Z3PLUS, ZDE +offers features not available with less advanced system software, +but these system enhancements are not required. + + To install ZDE, use the ZDENSTAL configuration program; see +the accompanying file ZDENSTAL.DOC. You should install ZDE for +your computer's terminal at the earliest convenience, since this +greatly enhances performance. There are many other installable +options; you will discover how you want everything set in the +course of using ZDE, so don't worry about going through all of it +at first. For ease of reference, portions of this manual +referring to installable options and settings are enclosed in +square brackets ("[" and "]"). + + +3. Invoking ZDE. + + ZDE is invoked from your system's command prompt using the +following syntax ("ufn" means "unambiguous file name"): + + ZDE Begin working on a new file. + + ZDE ufn Edit a new or already existing file. + + ZDE dir:ufn Edit a new or existing file from another + directory. + + ZDE ufn m Edit a file using mode "m." + ZDE ufn[m + +"m" above can be either W, A, or N (see File Modes, below), and +"dir" can be either a drive, a user area, a drive followed by a +user area, or a ZCPR named directory. For example: + + ZDE A4:MYFILE.TXT N Begin working on MYFILE.TXT at user + area 4, drive A, in non-document + mode. + + The size of the file to be edited is limited by available +memory. This will vary for different systems, but normally the +maximum size will be between 45 and 55k. If a file is too large +to edit, you must break it up and edit the pieces separately. +Numerous CP/M utilities are available which will break up and +rejoin ASCII files. + + +4. ZDE's Command Set. + + ZDE's commands consist of simple one- or two-key +combinations, easily found by the touch typist without +distraction. Most commands are the same as WordStar's. If you +have questions that this file can't answer, a WordStar manual may +be a useful reference. But ZDE is not a WordStar "clone"; there +are significant differences, including an extended set of +ESC-commands for functions such as macros (see below). + Virtually complete compatibility with the WordStar command +(sub)set can be achieved UNLESS the keys ^J, ^K, and ^L are used +as arrow keys (as on many CP/M computers). In this event ZDE +synonyms must be used: ESC- for the ^K- prefix; ESC-H for ^J; and +^\ for ^L (see ZDENSTAL.DOC for terminal installation). + +4.1. Command Summary. + + Below, the "^" character indicates use of the Ctrl key: ^K = +Ctrl+K. The ESC (^K), ^O, and ^Q prefixes require pressing two +keys in sequence: ^O C, for instance means press ^O, then C (or +^C). Any prefix may be canceled by typing ESC or Space. + +4.1.1. Control Keys: Single Keystroke Commands. + + ^J (ESC H) = display Help menus. + + CR = Carriage return (^M). Marks a paragraph end. + BS = Backspace (^H). + TAB = Hard Tab mode: insert tab (^I). Variable Tab mode: move + to next stop. + + Arrow keys: WordStar: ^E up, ^X down, ^S left, ^D right. + Alternate: configurable, default ^K, ^J, ^H, ^L. + + ^F = move to start of next word right. + ^A = move to start of next word left. + ^R = scroll back one screen. + ^C = scroll forward one screen. + ^W = scroll back one line. + ^Z = scroll forward one line. + + ^G = delete character to the right of the cursor. + DEL = delete character to the left (configurable). + ^U = undelete a character. + ^T = delete word to right of cursor. + ^Y = delete current line. + + ^N = insert a carriage return (break line) at present + position. + ^V = toggle INSERT mode on and off. + ^^ = toggle case (upper/lower) of character at cursor. + ^P = insert following control code in text. + ^B = reformat current paragraph. + ^L (^\) = repeat find/replace (repeats last ^QF or ^QA + command). + +4.1.2. File and Block Commands: first hit ^K (or ESC), then the + key shown. + + ^K I = display file/memory Information message. + + ^K F = List files in disk directory. + ^K E = Erase a disk file. + + ^K L = Load a brand new file to begin editing. + ^K N = change the current file Name (affects Save, eXit). + ^K S = Save the current file to disk, and continue editing. + ^K D = Done. Save the file, then load a new one. + ^K X = eXit: Save the file, then Quit to CP/M. + ^K Q = Quit to CP/M, abandoning current file. + + ^K R = Read a disk file into text at cursor position. + ^K P = Print the text (whole file or block). + + ^K B = mark the start of a Block. + ^K K = mark the end of a block. + ^K U = Unmark the block. + ^K Y = Delete the marked block. + ^K C = Copy the block text at present cursor position. + ^K V = moVe the block text to the present cursor position. + ^K W = Write the marked block to a disk file. + +4.1.3. Escape and Macro Commands: first hit ESC, then the key + shown. + + ESC arrows: Left/Right (including ^S/D) = shift screen + horizontally + by 32 columns. + Up/Down (including ^E/X) = shift screen + vertically + by 1/4 screen. + ESC TAB = move back to last tab stop. + + ESC M = execute a Macro string of commands. + ESC # = store macro on numeric key for later recall. + ESC 0..9 = use stored key. (In macro mode: jump label.) + ESC !,=,~,+ = used in Macro programming (see below). + ESC ; = brief pause, during Macro execution only. + +4.1.4. Quick Commands: first hit ^Q, then the key shown. + + ^Q Arrows: Left/Right (including ^S/D) = go to start or end + of line. + Up/Down (including ^E/X) = go to top or bottom + of screen. + ^Q R = move to top of file. + ^Q C = move to end of file. + ^Q I = move to specified page or line number. + ^Q B = move to marked block. + ^Q Q = move to next line in queue (ZCPR only). + ^Q Z = move to next place marker. + + ^Q F = find next occurrence of a string. + ^Q A = find and replace a string. + + ^Q Y = delete from cursor to end of current line. + ^Q DEL = delete from cursor to beginning of current line. + ^Q T = delete until specified character (caution--powerful!). + ^Q U = undelete a line. + +4.1.5. Onscreen Commands: first hit ^O, then the key shown. + + ^O Arrow: Up (including ^E) = make current line top of + screen. + + ^O R = set right margin (column 1 turns off + wordwrap/formatting). + ^O L = set left margin. + ^O X = toggle Margin Release on/off. + ^O C = center current line. + ^O F = align current line flush with the right margin. + + ^O Q = toggle header on/off. + ^O T = toggle ruler line on/off. + ^O D = toggle display of hard CRs on/off. + + ^O A = toggle Auto Indent on/off. + ^O S = toggle Double Spacing on/off. + ^O H = toggle hyphenation on/off. + ^O V = toggle tab mode Hard/Variable. + ^O I = set variable tab stop. + ^O N = clear variable tab stop. + + ^O P = set page length (0 turns off pagination). + ^O W = toggle windowing on/off (see below). + ^O Z = temporarily blank the entire screen. + + +5. Command Descriptions. + +5.1. Auto-Indent Mode (^O-A). + + Auto-Indent is useful for typing outlines, structured program +source code, and other text where the "left margin" varies. +Auto-Indent causes the RETURN key to act differently: If you are +entering new text, it will be indented to match the previous line. +If you are just moving through the file, the cursor advances past +any existing indentation. + +5.2. Block Commands (^K-B, -K, -U, -R, -Y, -W, -C, -V, -P-B, + ^Q-B). + + A "block" of text is normally delimited by two markers +[default: ^@] which remain in memory until reset or deleted. + ^K-B marks the beginning of the block; ^K-K marks its end. +Markers are inserted in the text. The two markers are identical; +the first one present is the start. + ^K-U unmarks the block, removing any marker(s) set (block +markers can also be deleted individually as ordinary characters). +Markers are automatically removed as appropriate when ^K-B/-K are +used again. + ^K-R reads in the contents of a disk file, inserting it as a +block after the current cursor position. You will be asked for +the name (and, optionally, mode) of the file. Other block +operation commands all require a Block to be marked: + ^K-Y deletes the block (including markers). + ^K-W writes the block text to a disk file; you will be asked +for the filename (and optional mode). + ^K-V moves the Block text to the present cursor location, +deleting the original; ^K-C copies it and leaves the original. +Sometimes ZDE will run out of memory when moving blocks within a +large file. If this occurs, just write the block to a file, +delete it, and read it back in as: "^K-W, ^K-Y, ^K-R". + ^K-P-B (^K-P with B option) prints the block text only. + The ^Q-B command, from wherever you are in the file, moves +the cursor to the Block start. + +5.3. Cursor Movement (Arrow keys; ^F; ^A; ^Q-R, -C, -I). + + ZDE supports three sets of Arrow keys, which function +interchangeably. The two built-in sets support the WordStar +"arrow key diamond" ^E, ^X, ^D, ^S, and the ANSI standard 3-byte +sequences (ESC-[-A, etc.). The third set is user-configurable, +and must be installed with ZDENSTAL. These keys move the cursor +up, down, right, and left respectively. Note: if you install ^J, +^K, and ^L as arrow keys, you must use ESC- commands for help, +file operations, and repeat find/replace, respectively. + Preceded by ^Q-, any arrow key (except ANSI) moves more +quickly: to the top or bottom of the screen, to the left or right +end of the line. + There are also two word movement commands: ^F moves right, to +the start of the next word; ^A moves left, to the start of the +previous (or current) word. Both have maximum ranges of 255 +characters. + For quickly covering large distances, the commands ^Q-R and +^Q-C go all the way to the beginning and end of the file, +respectively, and ^Q-I goes to any specified page (or line, in +non-documents). + +5.4. Deleting (^G, DEL, ^T, ^Y, ^Q-Y, -DEL, -T). + + You can delete text one CHARACTER at a time: ^G deletes to +the right of the cursor, and DEL to the left. [If you have no DEL +key, you can install another equivalent.] Note that the ordinary +BS (^H) does not normally delete. + ^T deletes an entire WORD to the right (up to 255 characters) + ^Y deletes the entire current LINE. ^Q-Y deletes only the +part of the line to the right of the cursor; ^Q-DEL deletes the +part to the left. + ^Q-T deletes UP TO a specified character. Example: "^Q-T." +deletes to the end of the sentence. Special case: "^Q-T-CR" +deletes to the next HARD CR, the end of the paragraph. This is a +powerful command, so use it with caution. + Accidentally deleted text can usually be recovered (see +Undelete, below). + +5.5. Disk Operations (^K-F, -E). + + ^K-F gives an unsorted list of disk FILES: hit CR to list the +directory specified by the current file, or specify a drive, user, +or named directory (colon optional). If there is not enough room +to fit all the files on the screen, you will see "..." at the end +to indicate that there were still more. Press ESC or Space to +continue. + ^K-E will ERASE a single disk file to provide more room on +the disk (no wildcards allowed). + +5.6. File Commands (^K-N, -S, -X, -Q, -D, -L). + + ^K-N NAMES your work or changes the current file mode. You +can change the filename in the header before saving, and/or change +its mode to WordStar, ASCII, or Nondocument. To set the file +mode, introduce the mode character with the left square bracket, +e.g., "Name: MYFILE.WS [W". + ^K-S SAVES your work: what's in memory is written to disk +under the file name in the header (you must have a file name; one +will be requested if necessary). If that file already existed, a +backup (.BAK) file may be preserved [configurable; see +installation guide]. If you haven't changed the file, ZDE prompts +you to confirm that you want to resave it anyway. + There are several different commands for finishing up: + ^K-X saves your work and then EXITS to CP/M. + ^K-Q just QUITS. If the file has been modified, ZDE asks if +you want to abandon the changes. + ^K-D (DONE) saves your work, then loads a new file to edit. + ^K-L quits the current file and LOADS a new one to begin +editing. + +5.7. Find, Replace (^Q-F, -A, ^L, ^\). + + ^Q-F is the command to FIND a string. The search normally +proceeds from the cursor position forward, and is case +(upper/lower) insensitive. There are two options: "B" = search +backwards; "C" = case sensitive search. If used, the options +must be enclosed in slashes (eg, "/bc/") before the search string. +(If you want to search for a string beginning with a slash, use an +empty (//) option first.) In addition, a ^P-Z [this can be +reconfigured] functions as a wildcard matching any single +character. Other control codes, like ^M for newline, can be +included (with the ^P prefix where needed). Examples: + + Find: /c/^MLABEL matches "LABEL" at start of line only; + Find: 4^Z^Z01 matches "42201", "47401", etc; + Find: wordstar matches "WORDSTAR", "WordStar" etc; + Find: ///88 matches "/88"; + Find: /b/esc looks backwards for "Esc", "esc", etc. + + ^Q-A is the FIND/REPLACE command. It asks for a string to +find, and what to change it to (all options above apply to the +search string only). The cursor will be placed on each occurrence +of the string successively, starting at the cursor location. You +will see the prompt "Chg?" in the header. To replace the old +string with the new one, press "Y"; anything else skips to the +next. To change all further occurrences without being asked, +press "*". ESC cancels at any time. (Note: if ^Q-A is used in a +Macro, it will automatically assume "*" with no further input +required.) + ^L (or ^\, if ^L is an arrow key) repeats the last ^Q-F or +^Q-A command. For ^Q-A, you will be asked whether you want to +replace the found string. For both, direction and case options +remain unchanged. + +5.8. Header (^O-Q). + + ZDE normally gives you a header, or status line, at the top +of the screen. However, if you like you can toggle the header +display on and off with the ^O-Q (QUIET) command. [The header may +also be suppressed by default.] This lets you see more file text. +It can also speed up operation on some slower terminals, as the +position doesn't have to be continually updated. + + A typical header line looks something like: +------------------------------------------------------------------ +B0/WORK:ZDE.DOC [A Pg 8 Ln 31 Cl 53 INS vt hy AI DS MR ^Q_ +------------------------------------------------------------------ + "B0/WORK:ZDE.DOC [A" = Current directory, filename, and mode. + "Pg 8, etc" = Current position in file by page, line, column. +For "N"ondocuments, there is no page number display. If +pagination (^O-P) is off, you will see "Pg 0" (document) or "OP" +(nondocument) here. + "INS" = Insert mode on (^V). + "vt" = Variable tabs on (^O-V). + "hy" = Hyphenation enabled. (^O-H) Doesn't display in "N" + mode. + "AI" = Auto indent mode on (^O-A). + "DS" = Double spacing (^O-S). + "MR" = Margins released (^O-X). Doesn't display in "N" mode. + "^Q_": Prefix keys (and some prompts) display here. + +5.9. Information (^K-I). + + ^KI displays an Information message with: + + - the ZDE version and date; + - whether (Y/N) the file has been changed since last saved; + - the current size of the file in bytes; + - the number of bytes of text memory used and free (1024 + bytes = 1K). + + You will note that the file uses about 20-25% less memory +than its actual length; this is due to ZDE's compression of text. +(Note: ZDE is limited to 16-bit arithmetic. In the unlikely event +that file size should exceed 64K it will be shown mod 64K; just +add 65536.) + Block moves and copying are limited by the amount of free +memory. Further, when there is less than 1K free, response time +can get very slow. + +5.10. Insert Mode (^V). + + ^V toggles insertion on and off. If insert is OFF, any text +to the right of the cursor is overwritten as you type. If insert +is ON, what you type is inserted, and existing text moves to the +right. + +5.11. Line Spacing (^O-S). + + The ^O-S command toggles between single and double line +spacing. In double space mode, the following functions generate +double carriage returns: CR (^M), Insert CR (^N), Reform (^B), +Wordwrap. You can easily mix single and double spacing; the ^B +command can convert between the two. Note: if you prefer to keep +your actual file single spaced, you can still get a double-spaced +printout by using the "D" option of the ^K-P command (see +Printing). + +5.12. Margins (^O-R, -L, -X, -C, -F). + + ^O-R sets the RIGHT margin, enabling wordwrap, reformatting, +and centering. A right margin of 1 disables all formatting +functions (same as in "N"ondocument mode). At the prompt +"Column:" enter the column number (1-255), or just hit CR for the +current cursor column. If the value entered conflicts with the +current left margin, ZDE sets the left margin to 1. + ^O-L sets the LEFT margin in an identical fashion; of course, +the value must always be less than the current right margin, +meaning it's best to set the right margin first. + ^O-X temporarily RELEASES the margins (resets them to 1), +allowing you to type outside them. Use ^O-X again to restore the +margins. + ^O-C CENTERS the current line with respect to the margins, if +set. ^O-F sets the current line FLUSH right, if the right margin +is set. + +5.13. Pagination (^O-P). + + The ^O-P command sets the page length. Enter a value from 0 +to 255, or just hit CR to restore the default value [normally 54]. + When the value is nonzero, it determines the page and line +shown in the document header ("Pg xx Ln xx"), and page-oriented +Print functions (formfeeds, headers, start/stop print) are enabled. + When the value is zero, pagination is off. The header will +say "Pg 0 Ln xxxx", showing you the absolute line number in the +file. Also, printing occurs with no page breaks or formfeeds. +This can be useful for printing small things right after each +other on the same sheet; or, in conjunction with the "*" print +option, can be used to print out multiple copies of index cards, +labels, etc. + ZDE never sends a formfeed before printing; begin your file +with a ^P-L character if you need one. Otherwise, use of ^P-L is +not recommended in document files as it renders ZDE's page count +inaccurate. + +5.14. Place Markers and Line Queue (^P-Z, ^Q-Z, ^Q-Q). + + You can set any number of temporary PLACE MARKERS in the text +with ^P-Z (they will appear as ^Z). The ^Q-Z command moves the +cursor to the next place marker in the file, cycling back to the +top of the file if needed. Place markers are NOT saved to disk. + ZCPR users may also store a QUEUE of up to eight line numbers +in their user-defined messages (a set of sixteen bytes of +protected memory "available for user definition"). The ^Q-Q +command will then cycle through the queue of line numbers, +returning to the first location when it reaches a value of zero. +A value greater than the number of lines in the file takes the +cursor to the end of the file. The numbers are stored as two-byte +inverted hexadecimal words. This facility is intended as an +interface between other programs and ZDE for such purposes as +storing the locations of compiler errors, however ZCPR users may +also find it useful to POKE these locations directly before +invoking ZDE. + +5.15. Printer Codes (^P). + + Control codes for special effects in printing can be entered +in the text with the ^P prefix. Thus pressing ^P-^H (or ^P-H) +embeds a ^H, etc. Several standard codes are: + + ^H - backspace - overstrike previous character + ^I - hard (ASCII) tab - printers respond variously to this + ^L - formfeed (Not recommended unless pagination (^O-P) + disabled) + + The Block marker, normally ^@, cannot be embedded, and ^Z is +reserved for use as a place marker. Control codes display on +screen as capital letters, highlighted if possible. ZDE assumes +they are not characters, so they are not counted when reformatting +text. + For greater convenience, you can also arrange to have a +single ^P-code produce an entire string of bytes for commonly used +printing effects. ZDE supports a subset of WordStar's printer +installation, seven definable codes: four toggles, four switches. +The Printer Installation in ZDENSTAL allows you to choose what +codes you want to use, and install the actual control sequences +your printer needs. The defaults are: + + toggles: ^B, ^D, ^S, ^Y + switches: ^Q, ^W, ^E, ^R + + In WordStar these toggles are Boldface, Doublestrike, +Underline, and Ribbon/Italic respectively, but you can make them +anything you like. "Toggles" are good for features like underline +and bold that are turned on and off. "Switches" are better for +multivalued parameters like character pitch. + Example: your printer uses ESC-U-01 (and 00) to turn +underlining on (and off). If you install these codes with +ZDENSTAL: + ^S toggle on: (03)1B5501 + ...and off: (03)1B5500 + +then all you have to type in ZDE to get underlined text is: +^PSunderlined text^PS. + +5.16. Printing (^K-P). + + The ^K-P command PRINTS all or part of the file in memory. +You will be asked for a set of "Options:", at which point you may +enter zero or more of the following, in any order: + + B prints only the currently marked BLOCK. + P PAUSES for your keystroke before each page (sheet + feed). + D DOUBLE SPACES all text to be printed. + Lnn sets the printer LEFT MARGIN to nn columns [the + default value can be set with ZDENSTAL]. + ^ FILTERS control characters ^X to text "^X". + *nn prints the job out nn TIMES (nn=1..255). + @nn begins printing AT the nn'th page. + =nn renumbers the pages beginning with nn. + #nn prints only (up to) a TOTAL of nn pages. + "..." uses the quoted string as a HEADER. The string, + followed immediately by the page number, will print + at the top right of each page near the margin (maxi- + mum length is 50 characters; an empty string, "", + gives numbered pages with no header text.) + +The last four options (@,=,#,"") are NOT allowed if pagination is +disabled (^O-P), or if "B"lock print was chosen. Examples: + +Options: L12P + - Print the file with a left margin of 12 columns, pausing + before each page for you to press a key (other than Esc). + +Options: @6#2=14"Instructions, page " + - Print the sixth and seventh pages of the file, but numbered + 14 and 15, with the header shown. + +Options: BD^*2 + - Print out the current marked Block twice, double spaced, + with control filtering. + + In "W" mode, lines beginning with a "." will be regarded as +WordStar dot commands, and will neither print out nor affect the +page count (they have no other effect either). + You can abort printing at any time with ESC (this may take a +moment, or a few keystrokes, depending on your BIOS). + +5.17. Ruler Line (^O-T). + + To help you align text properly, ^O-T toggles display of a +"ruler line" above the text on and off. + In each column you will see one of several symbols: "[]" +designate the current margins (if set); "-" indicates areas within +the current margins, "." outside them. Also, tab stops are marked +by either "T" (Variable) or "I" (Hard). Examples: + +("A" mode) [-----T-----T-----------T--------------]........ +("N" mode) I.......I.......I.......I.......I.......I....... + +5.18. Tabs (^I, ESC-TAB, ^O-V, ^O-I, ^O-N). + + There are two Tab modes: Variable and Hard, and the ^O-V +command toggles between them. In Hard Tab mode the Tab key +produces an actual ^I (ASCII 09); whether this overwrites any +existing text depends on the Insert toggle. Hard Tabs display by +default at fixed intervals of 8 screen columns [this is +configurable to any multiple of 2]. + In Variable Tab mode, the Tab key moves the cursor to the +next variable tab stop (you can always get a Hard Tab by typing +^P-I). If Insert is on, spaces are inserted up to the next tab +stop. Otherwise, existing text is skipped over, but spaces are +still added at the end of a line as needed. Up to eight tab stops +may be set with ^O-I and cleared with ^O-N; the defaults are in +columns 6, 11, 16, and 21 [these are configurable]. At the +prompt, enter the column number desired, or hit RETURN for the +cursor column. + The ^O-I command also accepts two multiple-set inputs: "@nn" +sets tab stops every "nn" columns, while "#n1,n2,..." sets tabs at +columns "n1,n2, ...". Both remove any pre-existing tabs, and +typing "@" or "#" alone simply clears all tabs. + The ESC-TAB command moves backward (left) to the previous +variable or hard tab stop. + +5.19. Undelete (^U, ^Q-U). + + The undelete functions may be used (repeatedly if necessary) +to recover a reasonable amount of text deleted either by +overtyping, or with any of ZDE's delete commands, IF the cursor +has not yet been moved away. ^U undeletes one character; ^Q-U +does a whole line. + Restrictions: undelete may not recover all of a Block delete +unless the cursor was in or near the block deleted, and it may +work imperfectly if DEL has been used several times in sequence. + Further use after all deleted text is recovered will produce +junk (usually duplicates of text above the cursor, which is +sometimes useful). + +5.20. Upper/Lower Case (^^). + + The ^^ (ctl-caret) command changes the case of the character +at the cursor, if it was a letter, and moves the cursor one +character to the right. Useful for capitalizing a string of +lowercase text, or vice versa. + +5.21. Window and Screen (^W, ^Z, ESC-Arrows, ^O-Up, -W, -Z). + + ZDE supports several functions to move and alter the display +screen. + The ^W and ^Z commands scroll the screen up and down a line +at a time, without moving the cursor (unless necessary). + Preceded by ESC, any arrow (except ANSI) moves the screen +rather than the cursor: the text as a whole shifts up/down 1/4 +screen, or right/left 32 columns, while the cursor stays put (the +cursor must be past column 32 for horizontal shifts to work). + Preceded by ^O-, any UP arrow key (except ANSI) makes the +current text line the top of the screen. + The ^O-W command creates a WINDOW in the bottom half of the +screen, which retains a copy of the file text starting at the +current line, plus the current status and/or ruler line(s), if +any. Editing continues normally in the top half of the screen. +This is useful for comparing different sections of text within a +file, or even between different files. Typing ^O-W again removes +the Window. Note: Windowing is only supported for screens of 15 +or more lines. + The ^O-Z command temporarily zaps (blanks) the entire screen; +good for avoiding CRT burn-in, or just protecting work from prying +eyes or fingers. Restore the screen by pressing ESC or SPACE. +Note: if Windowing was in effect, any text in the window will be +lost. + +5.22. Wordwrap, Reformat (^B, ^O-D). + + WORDWRAP is automatic in Document ("W" or "A") modes whenever +the right margin is set. Any text entered will be formatted to +the current margin settings as you type. The end of a paragraph +is marked by a "HARD CR", which occurs when you press the RETURN +key (this is a CR immediately following a character of text). In +contrast, when wordwrap occurs you get a "SOFT CR" (which is +actually a CR with a space before it). You can change a hard CR +into a soft one, or vice versa, by deleting or adding a space at +the end of the line. Hitting RETURN also hardens a soft CR. The +distinction between hard and soft CRs is only important when +reformatting. + ^B REFORMATS from the line the cursor is on, to the end of +the paragraph, according to the current margin settings and line +spacing. ^B may be used not only to reshape a paragraph after +editing, but also to change its margins and line spacing. +Indentation can be tricky if you have a left margin set. If the +current line is indented relative to the next one, ZDE assumes +that amount as your paragraph indentation. + ^O-D toggles DISPLAY OF HARD CRs. Hard CRs, otherwise +invisible, can be caused to display as a "<" character. This can +be useful; some may find it distracting, so it turns off. + + +6. Macros. + +6.1. Macro (ESC-M). + + A MACRO is a string of ZDE commands and text that, once +defined, can be repeated automatically. When you type ESC-M you +will be asked for the string, then a "Repeat count". Usually you +will simply type a number for the repeat count (0-9, or "*" for +"indefinitely"). You will see the results as the macro executes, +and you can abort it at any time by pressing ESC. If you are sure +you know what you're doing, you can speed up Macro execution by +specifying "Quiet" mode: press "Q" before the repeat count. Only +the header, if present, will be updated as the Macro runs. + Macros also stop any time an error occurs; the error message +will be visible, and can be cleared by pressing ESC. Many +commands (like Find or Reformat) are designed to generate errors +at the end of the file so that indefinite ("*") Macros containing +them halt there. You may need to abort other indefinite Macros +manually. + ZDE turns INSERT OFF before running a macro, so that the same +key sequence will always have the same effect. INSERT status is +restored when the macro terminates. + In order to include any input line editing characters (BS, +CR, etc.) in a macro, you must prefix them with ^P. (NOTE: To +make them easier to read and understand, Macro listings are given +here as they function, not as they are typed in. ^P prefixes as +needed are NOT shown. Keystrokes are separated by dashes or +commas for clarity, and "_" means a space or blank.) Here are some +sample Macros: + + 1. View a file by scrolling slowly through it: + + ESC-;, ^C + + This will pause, then scroll down. (Use a repeat count + of "*".) + + 2. Can you figure out what this one does? + + ^QR, ^QF, (, CR, ^G, ^KB, ^QF, ), CR, ^G, ^KK, ^QC, CR, ^KV + + (Answer: .elif eht fo dne eht ta meht fo tsil a gnikam + elif a fo tuo sesehtnerap ni stnemmoc ekat lliw tI) + + ZDE Macros are very powerful tools, particularly given their +programmability and storage on function keys. + +6.2. Macro Key (ESC-#, ESC-0..9). + + Up to 10 MACRO KEYS can be stored (0..9), by entering them +with the ESC-M command, then using ESC-# to save them. They can +then be recalled and used simply by typing ESC-number. Example: +typing ESC-#-0 will store the last Macro used in the ESC-0 command +so that it can be recalled and reused at any future time simply by +typing ESC-0. + Ordinarily, Macro Keys operate just like the original Macro, +asking for a "Repeat count" when executed. If you want to +suppress this prompt (resulting in a "function key" that executes +just once) you can type "N" (for No repeat) before storing the key +number. Example: ESC-#-N-0 makes ESC-0 a no-repeat macro key. +If you also don't need to see the Macro work, and want to make it +faster, you can make it QUIET as well by typing "Q" instead (for +Quiet) before the key number. Example: ESC-#-Q-0 stores ESC-0 as +a quiet no-repeat key sequence. + If the Macro (ESC-M) string is empty, using ESC-# will delete +a Macro Key. Using a defined Key makes it the last macro used, so +it can be stored again in another key if desired. Trying to use +an undefined Macro Key results in an error. + There are 500 bytes total available for all 10 keys, and a +128 byte limit for any one Key (ZDE's own input line will only +accept 65 bytes, but ZDENSTAL can handle up to the full 128.) + USAGE HINT: If you want to re-use a macro without having to +type it in again, use ESC-# to assign it to a key, then call it up +by number. + Besides simply storing Macros, here are some useful Macro +Keys: + + 1. Storing different sets of margins (e.g., for quotes). + For example, + ^OL, 12, CR, ^OR, 66, CR + + 2. Typing any frequently repeated phrase; "ESC-6" is much + more convenient than "^PSWorld Wide Widgets Ltd. (N.A.)^PS". + + 3. Swap the two characters preceding the cursor: + ^S, ^S, ^G, ^D, ^U, ^U, ^D, ^G + +[ZDENSTAL allows you to install defaults for all ten Macro Keys. +Thus a copy of ZDE can be customized for any task, such as the +formatting requirements of specialized writing or programming +languages.] + +6.3. Macro Programming (ESC-0..9, ESC-!,=,~,+,;). + + ZDE has several commands which function only in a Macro +string, and give you control over the execution of a macro, +allowing true programming. + ESC-0..9 function as LABELS 0..9 when entered as part of a +Macro. They have no effect, but can be "jumped" to by other +commands. + ESC-! followed by 0..9 is a JUMP instruction, and causes +macro execution to resume with the command following the label +ESC-0..9. Example: ESC!2 jumps to label 2. As two special cases, +ESC-![ jumps to the beginning of the Macro, and ESC-!] jumps to +the end (aborts). + ESC-= and ESC-~, followed by a character and then a label +0..9 (or "[","]"), are CONDITIONAL JUMPS: they jump to the label +or the start or end of the macro IF the character at the cursor +position matches (ESC-=) or doesn't match (ESC-~) the character +specified. Example: ESC~^M2 jumps to ESC-2 if the current +character is NOT a CR. + ESC-= and ESC-~, followed by a character and then ">" or "<", +are SEARCH LOOPS. They will continue to move the cursor right +(">") or left ("<") AS LONG AS the character at the cursor matches +(ESC-=) or doesn't match (ESC-~) the specified character. Both +search loops terminate automatically at the beginning or end of +the file. Example: ESC=_> moves right as long as the current +character is a space. + ESC-+, followed by 0..9, CHAINS to another macro key, +allowing you to build macros strings longer than the storage limit +of any one key. It does not "call" the key; there is no +returning. Example: ESC+9 chains to Key 9. + ESC-; (semicolon) gives a brief pause, presumably so the user +can see what's happening on screen. + Macro programs are stored just like any other macro string +(usually with "N"o repeat count). If you program in an endless +loop, you will at some point have to abort with ESC. Don't make +macro programs "Q"uiet until you're sure they work. + Example: here is a good macro program (best stored as a Quiet +Key) to move the cursor to the start of the current sentence: + + ESC~.1, ^S, ESC1, ESC~.<, ESC2, ^D, ESC=_2, ESC=^M2 + +You could write this out in programmer's pseudo-code as: + + If not "." goto label1 + Move left ;move left if already on period +label1: While not "." move Left ;move left to previous period +label2: Move right ;now move back right + If " " goto label2 ; as long as you see a space + If "^M" goto label2 ; or a Return + (all done) + + +7. General Information. + +7.1. Disk Space. + + ZDE isn't disk-bound; if you run out of disk space, just +insert another disk (always keep a blank FORMATTED disk around). +Alternatively, you can use the ESC-F and ESC-E commands to purge +unneeded files. [If you have small disks, you can also install +ZDE not to preserve BAK files.] + Let ZDE's filesize limits encourage you to break work up into +files of 50K or less; larger files make inefficient use of floppy +disks. + +7.2. Error Messages. + + Press ESC or Space to continue. "Error" alone means the +command used just won't work in this situation. (Example: a block +command was used with no block marked.) More specific errors are: + + "Out of Memory" - the file, block, or key string won't fit in + RAM. + "Invalid Key" - an illegal command key sequence was pressed. + "I/O Error" - file not found, disk full, empty/invalid + drive, etc. +"Cannot Reformat" - word too long, or margins invalid. + "Not Found" - the object of a search was not found. + "Syntax Error" - a macro programming command was misused. + +7.3. File Modes. + + ZDE has three FILE MODES: "W"ordStar document, "A"SCII +document, and "N"on-document. The basic difference concerns the +format of disk files. + In "W" mode, ZDE reads and writes WordStar-compatible files. +ZDE can edit a WordStar document, except that any right +justification will be lost. WordStar can edit any ZDE "W" file in +Document mode. + In "A" or "N" mode, ZDE reads and writes text as standard +ASCII 7-bit characters, a universal format accepted by virtually +all software. The only difference between "A" and "N" modes lies +in the default settings on loading a new file. Typically "A" mode +is used for word processing, and "N" mode for programming and +other technical applications. + +DEFAULTS FOR: Margins Tabs Hard CR disp. +------------ ------- ---- ------------ +"A"SCII or "W"ordStar mode ACTIVE VARIABLE [ON] +"N"on-document DISABLED HARD OFF + + The file mode option can be specified along with the filename +at any ZDE file function prompt, allowing you to mix WordStar and +ASCII disk files as needed (see Invoking ZDE, above). You can +also change the current mode with the ^K-N function by entering a +new mode (e.g., "[W") with or without a filename. + [ZDENSTAL allows you to select a default file mode, to be +used when no mode is specified (originally this is "A"). Further, +you can specify two filetype masks for automatic mode selection +(e.g., all "ASM" files as "N" mode) to override that default.] + NOTE ON ASCII FILES - The "A"SCII-document file format used +since VDE 2.50, to allow accurate formatting and WordStar +compatibility, distinguishes between HARD and SOFT CRs (see +Wordwrap, above). Consequently, if you edit an ASCII file created +by other software (including earlier versions of VDE), it may +appear to be full of hard CRs, making text impossible to reformat. +There are two easy ways to solve this problem: first, you can use +^Q-A to find "^M"s and selectively replace them with " ^M". +Alternatively, the following Macro (best stored as a Quiet macro +Key) does a good job of "softening up" paragraphs for reformatting: + + ^QS,^X,ESC=_],ESC=CR],^S,^V_^V,^D,ESC![ + +7.4. Hyphenation (^O-H). + + ZDE can't introduce hyphens, but it does recognize them in +the text, treating them as a legitimate place to break a line, so +if you have a long word close to the margin, you can insert a +hyphen where you'd like the word to be broken. + Similarly, ZDE can't unhyphenate. If it is trying to +reformat and finds a hyphen at the end of a line, it will pause to +ask you what to do with it. You will see the prompt "Chg?" in the +header, and can: + Press "Y" to remove the hyphen and space, joining the word; + "N" to leave the hyphen, but still join the word; + "ESC" to leave both the hyphen and the space alone. +Typically you would choose "Y" for "soft" hyphens that you +introduced to break up a word ("intro-duction"); "N" for hard +hyphens that are part of a word ("vis-a-vis"); and "ESC" for +punctuation (dashes "--", etc.). After your choice, reformatting +will proceed automatically. + You can toggle hyphenation on and off with ^O-H. If off, +hyphens are not treated differently from any other text character. +[The ^O-H default can be changed with ZDENSTAL.] + +7.5. Interruption. + + If ZDE is interrupted by messages from other software (BIOS +error, resident utilities, etc.), it may lose control of the +screen. The best way to return it to normal is by blanking and +restoring the screen (^O-Z, ESC). + +7.6. Prompts. + + First, ZDE has several simple prompts requiring you to +confirm an action by typing "Y" or "N": + + "Abandon changes?" - warns the file you want to Quit has + been changed. +"Unchanged; save anyway?" - reminds the file you want saved isn't + changed. + "Delete original?" - do you want to delete block copied + from 2nd file? + "Chg?" - do you want to change this instance of + a string? + +Then, there are a few special purpose prompts: + + "Repeat count:" - enter (optional "Q" and) repeat count + for Macro. + "Key number:" - enter (optional "N/Q" and) key number + for Key. + "Rdy" - press any key to print next page (ESC + quits). + +Finally, there are a variety of prompts for either numeric or +string input, like "Column:" or "Find string:". You are expected +to type in a string (up to 65 characters). The following control +keys operate: + + Correct mistake: BS (^H), ^S, or Del + Erase entire entry: ^X + Abort operation: ^U + +Note that to get any of these codes, or a CR, into the string +itself, you must precede it with ^P (this includes ^P). Examples: +to find a line beginning with a "*" (find "^M,*") type + + ^Q-F, ^P-CR, *, CR. + +Now to get this into a Macro with ESC-M, you would have to type + + ESC-M, ^Q-F, ^P-P, ^P-CR, *, ^P-CR, CR. + +7.7. WordStar Compatibility. + + In most respects ZDE operates much like WordStar; one big +difference is the absence of a "No-File" menu. You are always in +edit mode; use ^K-L to select a new file to edit. + If the keys ^J, ^K, ^L are in use as CP/M arrow keys, you +must use ZDE's original command set to substitute for them as +follows: + + Block prefix (^K-)... ESC- + Help menu (^J)....... ESC-H + Repeat find (^L)..... ^\ + + If these keys are NOT installed as arrow keys, they retain +their WordStar functions. Then, of course, ZDE lacks some +WordStar commands, and has some of its own. Aside from these, +there are the following differences in common commands: + +COMMON USE WORDSTAR 4 ZDE ZDE NOTES +Hide block ^K-H ^K-U Actually unmarks block. +Erase disk file ^K-J ^K-E +Set Place Mark ^K-0..9 ^P-Z Not individually numbered. +Go to Place Mark ^Q-0..9 ^Q-P Cyclic. + +COMMON COMMAND WORDSTAR 4 USE ZDE USE + ^^ Soften hard CR Transpose upper/lowercase + ^K-N Column block mode Rename current work + ^O-D Display ^P codes Display hard CRs + ^O-F Ruler from text Flush right + ^O-P Preview mode Page length + ^Q-U Repeat align Repeat undelete + +Note that ZDE does not implement WordStar "dot commands" in text, +though in "W" mode it avoids printing them. + + +8. Disclaimer. + + You use ZDE at your own risk. The author accepts no +liability for any damages resulting from its use or misuse. +Direct problem reports and suggestions to the author; include a +stamped return envelope for a reply if desired. Thanks to the +many users of ZDE whose feedback has led to improvements and bug +fixes in the past. + + Carson Wilson Sysop: Antelope Freeway RAS + 1359 W. Greenleaf 312-764-5162, Chicago + Chicago, IL 60626 24 hours, 3-12-2400 baud diff --git a/Source/Images/d_bp/u0/ASM.COM b/Source/RomDsk/ROM_256KB/ASM.COM similarity index 100% rename from Source/Images/d_bp/u0/ASM.COM rename to Source/RomDsk/ROM_256KB/ASM.COM diff --git a/Source/RomDsk/ROM_256KB/CLRDIR.COM b/Source/RomDsk/ROM_256KB/CLRDIR.COM new file mode 100644 index 00000000..ca65cbed Binary files /dev/null and b/Source/RomDsk/ROM_256KB/CLRDIR.COM differ diff --git a/Source/Images/d_bp/u0/DDT.COM b/Source/RomDsk/ROM_256KB/DDT.COM similarity index 100% rename from Source/Images/d_bp/u0/DDT.COM rename to Source/RomDsk/ROM_256KB/DDT.COM diff --git a/Source/RomDsk/ROM_256KB/DDTZ.COM b/Source/RomDsk/ROM_256KB/DDTZ.COM new file mode 100644 index 00000000..4f6eca6b Binary files /dev/null and b/Source/RomDsk/ROM_256KB/DDTZ.COM differ diff --git a/Source/Images/d_bp/u0/DUMP.COM b/Source/RomDsk/ROM_256KB/DUMP.COM similarity index 100% rename from Source/Images/d_bp/u0/DUMP.COM rename to Source/RomDsk/ROM_256KB/DUMP.COM diff --git a/Source/Images/d_bp/u0/ED.COM b/Source/RomDsk/ROM_256KB/ED.COM similarity index 100% rename from Source/Images/d_bp/u0/ED.COM rename to Source/RomDsk/ROM_256KB/ED.COM diff --git a/Source/Images/d_bp/u0/LOAD.COM b/Source/RomDsk/ROM_256KB/LOAD.COM similarity index 100% rename from Source/Images/d_bp/u0/LOAD.COM rename to Source/RomDsk/ROM_256KB/LOAD.COM diff --git a/Source/Images/d_bp/u0/PIP.COM b/Source/RomDsk/ROM_256KB/PIP.COM similarity index 100% rename from Source/Images/d_bp/u0/PIP.COM rename to Source/RomDsk/ROM_256KB/PIP.COM diff --git a/Source/RomDsk/ROM_256KB/RELOG.COM b/Source/RomDsk/ROM_256KB/RELOG.COM new file mode 100644 index 00000000..13ffc62e Binary files /dev/null and b/Source/RomDsk/ROM_256KB/RELOG.COM differ diff --git a/Source/Images/d_bp/u0/STAT.COM b/Source/RomDsk/ROM_256KB/STAT.COM similarity index 100% rename from Source/Images/d_bp/u0/STAT.COM rename to Source/RomDsk/ROM_256KB/STAT.COM diff --git a/Source/Images/d_bp/u0/SUBMIT.COM b/Source/RomDsk/ROM_256KB/SUBMIT.COM similarity index 100% rename from Source/Images/d_bp/u0/SUBMIT.COM rename to Source/RomDsk/ROM_256KB/SUBMIT.COM diff --git a/Source/Images/d_bp/u0/XSUB.COM b/Source/RomDsk/ROM_256KB/XSUB.COM similarity index 100% rename from Source/Images/d_bp/u0/XSUB.COM rename to Source/RomDsk/ROM_256KB/XSUB.COM diff --git a/Source/RomDsk/ROM_512KB/CLRDIR.COM b/Source/RomDsk/ROM_512KB/CLRDIR.COM index c6b05cc9..ca65cbed 100644 Binary files a/Source/RomDsk/ROM_512KB/CLRDIR.COM and b/Source/RomDsk/ROM_512KB/CLRDIR.COM differ diff --git a/Source/RomDsk/ROM_512KB/COPY.CFG b/Source/RomDsk/ROM_512KB/COPY.CFG deleted file mode 100644 index 3d5310ac..00000000 Binary files a/Source/RomDsk/ROM_512KB/COPY.CFG and /dev/null differ diff --git a/Source/RomDsk/ROM_512KB/COPY.COM b/Source/RomDsk/ROM_512KB/COPY.COM index 87c0c2fb..606c81a5 100644 Binary files a/Source/RomDsk/ROM_512KB/COPY.COM and b/Source/RomDsk/ROM_512KB/COPY.COM differ diff --git a/Source/RomDsk/ROM_512KB/FA16.CFG b/Source/RomDsk/ROM_512KB/FA16.CFG deleted file mode 100644 index b7974d36..00000000 Binary files a/Source/RomDsk/ROM_512KB/FA16.CFG and /dev/null differ diff --git a/Source/RomDsk/ROM_512KB/FDISK80.COM b/Source/RomDsk/ROM_512KB/FDISK80.COM index 00ac10f7..7e862d67 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/FILEDATE.CFG b/Source/RomDsk/ROM_512KB/FILEDATE.CFG deleted file mode 100644 index da1ca45f..00000000 Binary files a/Source/RomDsk/ROM_512KB/FILEDATE.CFG and /dev/null differ diff --git a/Source/RomDsk/ROM_512KB/FLASH.COM b/Source/RomDsk/ROM_512KB/FLASH.COM index 1b7fa64c..d1833a1b 100644 Binary files a/Source/RomDsk/ROM_512KB/FLASH.COM and b/Source/RomDsk/ROM_512KB/FLASH.COM differ diff --git a/Source/RomDsk/ROM_512KB/INITDIR.CFG b/Source/RomDsk/ROM_512KB/INITDIR.CFG deleted file mode 100644 index 96baa986..00000000 Binary files a/Source/RomDsk/ROM_512KB/INITDIR.CFG and /dev/null differ diff --git a/Source/RomDsk/ROM_512KB/TD.CFG b/Source/RomDsk/ROM_512KB/TD.CFG deleted file mode 100644 index ab44bab9..00000000 Binary files a/Source/RomDsk/ROM_512KB/TD.CFG and /dev/null differ diff --git a/Source/RomDsk/ROM_512KB/ZCNFG.COM b/Source/RomDsk/ROM_512KB/ZCNFG.COM deleted file mode 100644 index ae423dc5..00000000 Binary files a/Source/RomDsk/ROM_512KB/ZCNFG.COM and /dev/null differ diff --git a/Source/RomDsk/ROM_512KB/ZCNFG24.CFG b/Source/RomDsk/ROM_512KB/ZCNFG24.CFG deleted file mode 100644 index 1bfe49bf..00000000 Binary files a/Source/RomDsk/ROM_512KB/ZCNFG24.CFG and /dev/null differ diff --git a/Source/RomDsk/ROM_512KB/ZDE.COM b/Source/RomDsk/ROM_512KB/ZDE.COM index f58310ba..b80559be 100644 Binary files a/Source/RomDsk/ROM_512KB/ZDE.COM and b/Source/RomDsk/ROM_512KB/ZDE.COM differ diff --git a/Source/RomDsk/ROM_512KB/ZXD.CFG b/Source/RomDsk/ROM_512KB/ZXD.CFG deleted file mode 100644 index f202ae59..00000000 Binary files a/Source/RomDsk/ROM_512KB/ZXD.CFG and /dev/null differ diff --git a/Source/RomDsk/SIMH/URL.COM b/Source/RomDsk/SIMH/URL.COM deleted file mode 100644 index 45446079..00000000 Binary files a/Source/RomDsk/SIMH/URL.COM and /dev/null differ diff --git a/Source/RomDsk/diskdefs b/Source/RomDsk/diskdefs new file mode 100644 index 00000000..81d962cc --- /dev/null +++ b/Source/RomDsk/diskdefs @@ -0,0 +1,739 @@ +diskdef ibm-3740 + seclen 128 + tracks 77 + sectrk 26 + blocksize 1024 + maxdir 64 + skew 6 + boottrk 2 + os p2dos +end + +diskdef 4mb-hd + seclen 128 + tracks 1024 + sectrk 32 + blocksize 2048 + maxdir 256 + skew 1 + boottrk 0 + os p2dos +end + +diskdef pcw + seclen 512 + tracks 40 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 1 + os 3 +end + +diskdef pc1.2m + seclen 512 + tracks 80 + # this format uses 15 sectors per track, but 30 per cylinder + sectrk 30 + blocksize 4096 + maxdir 256 + skew 1 + boottrk 0 + os 3 +end + +# CP/M 86 on 1.44MB floppies +diskdef cpm86-144feat + seclen 512 + tracks 160 + sectrk 18 + blocksize 4096 + maxdir 256 + skew 1 + boottrk 2 + os 3 +end + +diskdef cf2dd + seclen 512 + tracks 160 + sectrk 9 + blocksize 2048 + maxdir 256 + skew 1 + boottrk 1 + os 3 +end + +#amstrad: values are read from super block (special name hardcoded) + +# Royal alphatronic +# setfdprm /dev/fd1 dd ssize=256 cyl=40 sect=16 head=2 +diskdef alpha + seclen 256 + tracks 40 + sectrk 32 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Apple II CP/M skew o Apple II DOS 3.3 skew +diskdef apple-do + seclen 256 + tracks 35 + sectrk 16 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 3 + os 2.2 +end + +# Apple II CP/M skew o Apple II PRODOS skew +diskdef apple-po + seclen 256 + tracks 35 + sectrk 16 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 3 + os 2.2 +end + +# MYZ80 hard drive (only works with libdsk, because it has a 256-byte header) +diskdef myz80 + seclen 1024 + tracks 64 + sectrk 128 + blocksize 4096 + maxdir 1024 + skew 1 + boottrk 0 + os 3 +end + +# Despite being Amstrad formats, CPC System and CPC Data don't have an Amstrad +# superblock. You'll need to use libdsk to access them because the Linux +# and Windows kernel drivers won't touch them. +diskdef cpcsys + seclen 512 + tracks 40 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 2 + os 3 +end +diskdef cpcdata + seclen 512 + tracks 40 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 0 + os 3 +end + +# after being read in with no sector skew. +diskdef nigdos + seclen 512 + # NigDos double sided disk format, 42 tracks * 2 sides + tracks 84 + sectrk 10 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 0 + # this format wastes half of the directory entry + logicalextents 1 + os 3 +end + +diskdef epsqx10 + seclen 512 + tracks 40 + sectrk 20 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +diskdef ibm-8ss + seclen 512 + tracks 40 + sectrk 8 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 1 + os 2.2 +end + +diskdef ibm-8ds + seclen 512 + tracks 40 + sectrk 8 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 1 + os 2.2 +end + +diskdef electroglas + seclen 512 + tracks 80 + sectrk 10 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 1 + os 3 +end + +# IBM CP/M-86 +# setfdprm /dev/fd1 sect=8 dtr=1 hd ssize=512 tpi=48 head=1 +diskdef ibmpc-514ss + seclen 512 + tracks 40 + sectrk 8 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 1 + os 2.2 +end + +# IBM CP/M-86 +# setfdprm /dev/fd1 sect=8 dtr=1 hd ssize=512 tpi=48 +diskdef ibmpc-514ds + seclen 512 + tracks 80 + sectrk 8 + blocksize 2048 + maxdir 64 + skew 0 + boottrk 2 + os 2.2 +end + +diskdef p112 + seclen 512 + tracks 160 + sectrk 18 + blocksize 2048 + maxdir 256 + skew 1 + boottrk 2 + os 3 +end + +diskdef p112-old + seclen 512 + tracks 160 + sectrk 18 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 1 + os 3 +end + +diskdef kpii + seclen 512 + tracks 40 + sectrk 10 + blocksize 1024 + maxdir 32 + skew 0 + boottrk 1 + os 2.2 +end + +# setfdprm /dev/fd0 dd sect=10 +diskdef interak + seclen 512 + tracks 80 + sectrk 20 + blocksize 4096 + maxdir 256 + skew 0 + boottrk 2 + os 2.2 +end + +# RomWBW 256KB ROM (128KB reserved, 128KB ROM Disk) + +diskdef wbw_rom256 + seclen 512 + tracks 4 + sectrk 64 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 0 + os 2.2 +end + +# RomWBW 512KB ROM (128KB reserved, 384KB ROM Disk) + +diskdef wbw_rom512 + seclen 512 + tracks 12 + sectrk 64 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 0 + os 2.2 +end + +# RomWBW 1024KB ROM (128KB reserved, 896KB ROM Disk) + +diskdef wbw_rom1024 + seclen 512 + tracks 28 + sectrk 64 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 0 + os 2.2 +end + +# RomWBW 720K floppy media + +diskdef wbw_fd720 + seclen 512 + tracks 160 + sectrk 9 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 4 + os 2.2 +end + +# RomWBW 1.44M floppy media + +diskdef wbw_fd144 + seclen 512 + tracks 160 + sectrk 18 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 2 + os 2.2 +end + +# RomWBW 360K floppy media + +diskdef wbw_fd360 + seclen 512 + tracks 80 + sectrk 9 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 4 + os 2.2 +end + +# RomWBW 1.20M floppy media + +diskdef wbw_fd120 + seclen 512 + tracks 160 + sectrk 15 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 2 + os 2.2 +end + +# RomWBW 8320KB Hard Disk Slice (512 directory entry format) +# Legacy format: 512 dir entries, 16,630 sectors / slice + +diskdef wbw_hd512 + seclen 512 + tracks 1040 + sectrk 16 + blocksize 4096 + maxdir 512 + skew 0 + boottrk 16 + os 2.2 +end + +# First 4 slices of wbw_hd512 +# Assumes first slice (slice 0) starts at sector 0 +# Offset of any slice (in tracks) = (1040 * ) + +diskdef wbw_hd512_0 + seclen 512 + tracks 1040 + sectrk 16 + blocksize 4096 + maxdir 512 + skew 0 + boottrk 16 + offset 0T + os 2.2 +end + +diskdef wbw_hd512_1 + seclen 512 + tracks 1040 + sectrk 16 + blocksize 4096 + maxdir 512 + skew 0 + boottrk 16 + offset 1040T + os 2.2 +end + +diskdef wbw_hd512_2 + seclen 512 + tracks 1040 + sectrk 16 + blocksize 4096 + maxdir 512 + skew 0 + boottrk 16 + offset 2080T + os 2.2 +end + +diskdef wbw_hd512_3 + seclen 512 + tracks 1040 + sectrk 16 + blocksize 4096 + maxdir 512 + skew 0 + boottrk 16 + offset 3120T + os 2.2 +end + +# RomWBW 8MB Hard Disk (1024 directory entry format) +# New format: 1024 dir entries, 16,384 sectors / slice +# Pure filesystem image, no MBR prefix + +diskdef wbw_hd1k + seclen 512 + tracks 1024 + sectrk 16 + blocksize 4096 + maxdir 1024 + skew 0 + boottrk 2 + os 2.2 +end + +# First 4 slices of wbw_hd1k +# Assumes standard 1MB prefix +# Offset of any slice (in tracks) = 128 + (1024 * ) + +diskdef rc2014a + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 1 + offset 0T + os 2.2 +end + +diskdef rc2014b + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 512T + os 2.2 +end + +diskdef rc2014c + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 1024T + os 2.2 +end + +diskdef rc2014d + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 1536T + os 2.2 +end + +diskdef rc2014e + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 2048T + os 2.2 +end + +diskdef rc2014f + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 2560T + os 2.2 +end + +diskdef rc2014g + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 3072T + os 2.2 +end + +diskdef rc2014h + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 3584T + os 2.2 +end + +diskdef rc2014i + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 4096T + os 2.2 +end + +diskdef rc2014j + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 4608T + os 2.2 +end + +diskdef rc2014k + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 5120T + os 2.2 +end + +diskdef rc2014l + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 5632T + os 2.2 +end + +diskdef rc2014m + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 6144T + os 2.2 +end + +diskdef rc2014n + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 6656T + os 2.2 +end + +diskdef rc2014o + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 7168T + os 2.2 +end + +diskdef rc2014p + seclen 512 + tracks 128 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 7680T + os 2.2 +end diff --git a/Source/TastyBasic/Build.cmd b/Source/TastyBasic/Build.cmd new file mode 100644 index 00000000..d8138be3 --- /dev/null +++ b/Source/TastyBasic/Build.cmd @@ -0,0 +1,4 @@ +@echo off +setlocal + +pushd src && call Build || exit /b & popd diff --git a/Source/TastyBasic/Clean.cmd b/Source/TastyBasic/Clean.cmd new file mode 100644 index 00000000..ffdfa66c --- /dev/null +++ b/Source/TastyBasic/Clean.cmd @@ -0,0 +1,4 @@ +@echo off +setlocal + +pushd src && call Clean & popd diff --git a/Source/TastyBasic/LICENSE b/Source/TastyBasic/LICENSE new file mode 100644 index 00000000..3877ae0a --- /dev/null +++ b/Source/TastyBasic/LICENSE @@ -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/Source/TastyBasic/Makefile b/Source/TastyBasic/Makefile new file mode 100644 index 00000000..fced87a1 --- /dev/null +++ b/Source/TastyBasic/Makefile @@ -0,0 +1,3 @@ +SUBDIRS = src +TOOLS = ../../Tools +include $(TOOLS)/Makefile.inc diff --git a/Source/TastyBasic/README.md b/Source/TastyBasic/README.md new file mode 100644 index 00000000..07e4a38b --- /dev/null +++ b/Source/TastyBasic/README.md @@ -0,0 +1,163 @@ +# Tasty Basic + +## Introduction +Tasty Basic is a basic interpreter for CP/M and RomWBW ([Warthen, 2021](##References)), based on +the Z80 port of Palo Alto Tiny Basic ([Gabbard, 2017; Rauskolb, 1976; Wang, 1976](##References)). + +## Tasty Basic Language +The Tasty Basic language is based on Palo Alto Tiny Basic, as described in the December 1976 +issue of Interface Age ([Rauskolb, 1976](##References)). As such, Tasty Basic shares many of the +same limitations as Palo Alto Basic. All numbers are integers and must be less than or +equal to 32767, and Tasty Basic supports only 26 variables denoted by letters A through Z. + +In addition to Tiny Basic's `ABS(n)`, `RND(n)` and `SIZE` functions, Tasty Basic also provides +statements and functions to read and write memory locations, and allows interaction with I/O ports. + +### Statements +Tasty Basic provides two statements to write to memory and I/O ports: + +`POKE m,n` Writes the value _n_ to address location _m_ + +`OUT m,n` Sends the value n to I/O port _m_ + +Additionally there are statements to define and read constant values: + +`DATA m[,n[,...]]` Used to store constant values in the program code. Each DATA statement can define one or more numeric constants separated by commas. `DATA` statements may appear anywhere in the program. + +`READ m` Reads the next available data value and assigns it to variable _m_, starting with the first item in the first `DATA` statement. + +`RESTORE` Resets the `READ` pointer to the first item of the data list, allowing `DATA` values to be re-read. + +#### CP/M Specific Statements +The CP/M version includes two additional statements that allow Tasty Basic programs to be saved +to, and loaded from, disk: + +`LOAD "filename"` Loads the Tasty Basic (`.TBA`) file with the given _filename_ from the current disk drive into memory. Any existing programs and variables are cleared before the program is loaded. + +`SAVE "filename"` Persists the program currently in memory in a file with the given _filename_ on the current disk drive. + +Refer to [Tasty Basic files](examples/README.md) for details of the `.TBA` file format. + +### Functions +Tasty Basic provides the following functions to read from and write to memory locations and I/O ports: + +`IN(m)` Returns the byte value read from I/O port _m_ + +`PEEK(m)` Returns the byte value of address location _m_ + +`USR(i)` Accepts a numeric expression _i_ , calls a user-defined machine language routine, and returns the resulting value. + +### User defined machine language routines +The `USR(i)` function enables interaction with user defined machine routines. +The entry point for these routines is specified using a platform specific vector +pointing to a default location as shown below. User defined code may be +placed elsewhere in memory by updating the vector values. +The value _i_ is passed to the routine in the `DE` register, which must also +contain the result on return. + +| Platform | Vector location | Default value | +| --- | --- | --- | +| CP/M | $0BFE/$0BFF | $0C00 | +| RomWBW | $13FE/$13FF | $1400 | + +### Example +The following example shows the bit summation for a given value: + +``` + 0000 #IFDEF CPM + 0C00 .ORG $0C00 ; ie. 3072 dec + 0C00~ #ELSE + 0C00~ .ORG $1400 ; ie. 5120 dec + 0C00 #ENDIF + 0C00 + 0C00 06 00 LD B,0 + 0C02 7A LD A,D + 0C03 CD 0E 0C CALL COUNT + 0C06 7B LD A,E + 0C07 CD 0E 0C CALL COUNT + 0C0A 58 LD E,B + 0C0B 16 00 LD D,0 + 0C0D C9 RET + 0C0E COUNT: + 0C0E B7 OR A + 0C0F C8 RET Z + 0C10 CB 47 BIT 0,A + 0C12 28 01 JR Z,NEXT + 0C14 04 INC B + 0C15 NEXT: + 0C15 CB 3F SRL A + 0C17 18 F5 JR COUNT + 0C19 + 0C19 .END +``` + +``` +10 REM -- CP/M VERSION +20 REM -- SEE EXAMPLES DIRECTORY FOR OTHER PLATFORMS +30 FOR I=0 TO 24 +40 READ A +50 POKE 3072+I,A +60 NEXT I +70 INPUT P +80 LET Q=USR(P) +90 PRINT "THE BIT SUMMATION OF ",#5,P," IS ",#2,Q +100 GOTO 70 +110 DATA 6,0,122,205,14,12,123,205,14,12,88,22,0,201 +120 DATA 183,200,203,71,40,1,4,203,63,24,245 +``` + +Note that the Tasty Basic program above is CP/M specific. Examples for other platforms can be found +in the `examples` directory. + +## Building Tasty Basic +Building Tasty Basic requires the `uz80as` Z80 assembler v1.12 or later ([Giner, 2021](##References)). +Alternatively, Windows users can use TASM (Telemark Assembler) ([Anderson, 1998](##References)). + +### RomWBW version +Tasty Basic is part of the SBCv2 RomWBW distribution. Please refer to the +[RomWBW github repository](https://github.com/wwarthen/RomWBW) for details. + +### CP/M version +The CP/M version of Tasty Basic can be built using the `-dCPM` flag: + +```uz80as -dCPM tastybasic.asm tbasic.com``` + +The resulting `tbasic.com` command file can be run in CP/M. For example: + +``` +B>TBASIC ↵ + +CP/M TASTY BASIC +28902 BYTES FREE + +OK +>10 PRINT "HELLO WORLD ", ↵ +>RUN ↵ +HELLO WORLD + +OK +>BYE ↵ + +B> +``` + +## Example BASIC programs + +A small number of example Tasty Basic programs are included in the `examples` directory. +Most of these programs are from _BASIC COMPUTER GAMES_ ([Ahl, 1978](##References)), and +have been modified as required to make them work with Tasty Basic. + +## License +In line with Wang's (1976) original Tiny Basic source listing and later derived works +by Rauskolb (1976) and Gabbard (2017), Tasty Basic is licensed under GPL v3. +For license details refer to the enclosed [LICENSE](../master/LICENSE) file. + +## References +Ahl, D. H. (Ed.).(1978). _BASIC COMPUTER GAMES_. New York, NY: Workman Publishing +Anderson, T. N. (1998). _The Telemark Assembler (TASM) User's Manual, Version 3.1._ Issaquah, WA: Squak Valley Software +b1ackmai1er (2018). _SBC V2_. Retrieved October 6, 2018, from [https://www.retrobrewcomputers.org/doku.php?id=boards:sbc:sbc_v2:start](https://www.retrobrewcomputers.org/doku.php?id=boards:sbc:sbc_v2:start) +Gabbard, D. (2017, October 10). _TinyBASIC for the z80 – TinyBASIC 2.0g._ Retrieved September 29, 2108, from [http://retrodepot.net/?p=274](http://retrodepot.net/?p=274) +Giner, J. (2021, August 1). _Micro Z80 assembler - uz80as._ Retrieved September 19, 2021, from [https://jorgicor.niobe.org/uz80as/](https://jorgicor.niobe.org/uz80as/) +Rauskolb, P. (1976, December). _DR. WANG'S PALO ALTO TINY BASIC._ Interface Age, (2)1, 92-108. Retrieved from [https://archive.org/stream/InterfaceAge197612/Interface%20Age%201976-12#page/n93/mode/1up](https://archive.org/stream/InterfaceAge197612/Interface%20Age%201976-12#page/n93/mode/1up) +Wang, L-C. (1976). _Palo Alto Tiny BASIC._ In J. C. Warren Jr. (Ed.), _Dr. Dobb's Journal of COMPUTER Calisthenics & Orthodontia_ (pp. 129-142). Menlo Park, CA: People's Computer Company +Warthen, W. (2021). _RomWBW, Z80/Z180 System Software._ Retrieved Octover 5, 2021, from [https://github.com/wwarthen/RomWBW](https://github.com/wwarthen/RomWBW) \ No newline at end of file diff --git a/Source/TastyBasic/examples/BATNUM.BAS b/Source/TastyBasic/examples/BATNUM.BAS new file mode 100644 index 00000000..13a3fdb8 --- /dev/null +++ b/Source/TastyBasic/examples/BATNUM.BAS @@ -0,0 +1,86 @@ +10 PRINT "BATNUM" +20 PRINT "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY" +30 PRINT +110 PRINT "THIS PROGRAM IS A 'BATTLE OF NUMBERS' GAME, WHERE THE" +120 PRINT "COMPUTER IS YOUR OPPONENT." +130 PRINT +140 PRINT "THE GAME STARTS WITH AN ASSUMED PILE OF OBJECTS. YOU" +150 PRINT "AND YOUR OPPONENT ALTERNATELY REMOVE OBJECTS FROM THE PILE." +160 PRINT "WINNING IS DEFINED IN ADVANCE AS TAKING THE LAST OBJECT OR" +170 PRINT "NOT. YOU CAN ALSO SPECIFY SOME OTHER BEGINNING CONDITIONS." +180 PRINT "DON'T USE ZERO, HOWEVER, IN PLAYING THE GAME." +190 PRINT "ENTER A NEGATIVE NUMBER FOR NEW PILE SIZE TO STOP PLAYING." +200 PRINT +210 GOTO 330 +220 FOR I=1 TO 10 +230 PRINT +240 NEXT I +330 INPUT "ENTER PILE SIZE"N +340 IF N<0 GOTO 1080 +350 IF N>=1 GOTO 390 +360 GOTO 330 +390 INPUT "ENTER WIN OPTION - 1 TO TAKE LAST, 2 TO AVOID LAST"M +410 IF M=1 GOTO 430 +420 IF M#2 GOTO 390 +430 INPUT "ENTER MIN PER TURN"A,"AND MAX"B +450 IF A>B GOTO 430 +460 IF A<1 GOTO 430 +490 INPUT "ENTER START OPTION - 1 COMPUTER FIRST, 2 YOU FIRST"S +500 PRINT +510 IF S=1 GOTO 530 +520 IF S#2 GOTO 490 +530 C=A+B +540 IF S=2 GOTO 570 +550 GOSUB 600 +560 IF W=1 GOTO 220 +570 GOSUB 810 +580 IF W=1 GOTO 220 +590 GOTO 550 +600 Q=N +610 IF M=1 GOTO 630 +620 Q=Q-1 +630 IF M=1 GOTO 680 +640 IF N>A GOTO 720 +650 W=1 +660 PRINT "COMPUTER TAKES",N," AND LOSES." +670 RETURN +680 IF N>B GOTO 720 +690 W=1 +700 PRINT "COMPUTER TAKES",N," AND WINS." +710 RETURN +720 P=Q-C*(Q/C) +730 IF P>=A GOTO 750 +740 P=A +750 IF P<=B GOTO 770 +760 P=B +770 N=N-P +780 PRINT "COMPUTER TAKES",P," AND LEAVES",N +790 W=0 +800 RETURN +810 PRINT +820 INPUT "YOUR MOVE"P +830 IF P#0 GOTO 880 +840 PRINT "I TOLD YOU NOT TO USE ZERO! COMPUTER WINS BY FORFEIT." +850 W=1 +860 RETURN +880 IF P>=A GOTO 910 +890 IF P=N GOTO 960 +900 GOTO 920 +910 IF P<=B GOTO 940 +920 PRINT "ILLEGAL MOVE, REENTER IT!" +930 GOTO 820 +940 N=N-P +950 IF N#0 GOTO 1030 +960 IF M=1 GOTO 1000 +970 PRINT "TOUGH LUCK, YOU LOSE." +980 W=1 +990 RETURN +1000 PRINT "CONGRATULATIONS, YOU WIN." +1010 W=1 +1020 RETURN +1030 IF N>=0 GOTO 1060 +1040 N=N+P +1050 GOTO 920 +1060 W=0 +1070 RETURN +1080 END diff --git a/Source/TastyBasic/examples/DUMP.BAS b/Source/TastyBasic/examples/DUMP.BAS new file mode 100644 index 00000000..db91aca3 --- /dev/null +++ b/Source/TastyBasic/examples/DUMP.BAS @@ -0,0 +1,16 @@ +10 INPUT "ADDRESS"A +20 FOR I=0 TO 15 +30 P=A+I*16 +40 PRINT $16,P, +50 FOR J=0 TO 15 +60 PRINT " ",$8,PEEK(P+J), +70 NEXT J +80 PRINT +90 NEXT I +100 INPUT ""Q +110 IF Q<0 GOTO 160 +120 A=A+256 +130 IF Q=0 GOTO 20 +140 A=Q +150 GOTO 20 +160 END diff --git a/Source/TastyBasic/examples/README.md b/Source/TastyBasic/examples/README.md new file mode 100644 index 00000000..270e33a0 --- /dev/null +++ b/Source/TastyBasic/examples/README.md @@ -0,0 +1,25 @@ +# Tasty Basic Files + +## Introduction +The CP/M version of Tasty Basic allows programs to be saved to and loaded from disk. This +document describes the Tasty Basic `.TBA` file format. + +## .TBA File format +Tasty Basic `.TBA` files are direct reflections of Tasty Basic programs as held in memory. Thus, +each line of code starts with a 16 bit, LSB first, line number and ends with a carriage return +character (0xD). An EOF marker (0x1A) indicates the end of the file. Any trailing NUL characters +(0x0) are ignored. + +### Example +Following is an example Tasty Basic program: +``` +10 PRINT "HELLO WORLD" +20 GOTO 10 +``` +And its `.TBA` file representation: +``` +0A 00 50 52 49 4E 54 20 22 48 45 4C 4C 4F 20 57 +4F 52 4C 44 22 0D 14 00 47 4F 54 4F 20 31 30 0D +1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +``` + diff --git a/Source/TastyBasic/examples/REVERSE.BAS b/Source/TastyBasic/examples/REVERSE.BAS new file mode 100644 index 00000000..e8c235c7 --- /dev/null +++ b/Source/TastyBasic/examples/REVERSE.BAS @@ -0,0 +1,74 @@ +10 PRINT "REVERSE" +30 PRINT "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY" +100 PRINT "REVERSE -- A GAME OF SKILL" +140 REM *** N=NUMBER OF NUMBERS +150 N=9 +160 INPUT "DO YOU WANT THE RULES (0=NO,1=YES)"A +180 IF A=0 GOTO 210 +190 GOSUB 710 +200 REM *** MAKE A RANDOM LIST @(1) TO @(N) +210 @(1)=RND(N-1)+1 +220 FOR K=2 TO N +230 @(K)=RND(N) +240 FOR J=1 TO K-1 +250 IF @(K)=@(J) GOTO 230 +260 NEXT J +270 NEXT K +280 REM *** PRINT ORIGINAL LIST AND START GAME +290 PRINT +300 PRINT "HERE WE GO ... THE LIST IS:" +310 T=0 +320 GOSUB 610 +330 INPUT "HOW MANY SHALL I REVERSE"R +350 IF R=0 GOTO 520 +360 IF R<=N GOTO 390 +370 PRINT "OOPS! TOO MANY! I CAN REVERSE AT MOST ",#2,N +380 GOTO 330 +390 T=T+1 +400 REM *** REVERSE R NUMBERS AND PRINT NEW LIST +410 FOR K=1 TO R/2 +420 Z=@(K) +430 @(K)=@(R-K+1) +440 @(R-K+1)=Z +450 NEXT K +460 GOSUB 610 +470 REM *** CHECK FOR A WIN +480 FOR K=1 TO N +490 IF @(K)#K GOTO 330 +500 NEXT K +510 PRINT "YOU WON IT IN",T," MOVES!!!" +520 PRINT +530 INPUT "TRY AGAIN (1=YES, 0=NO)"A +550 IF A=1 GOTO 210 +560 PRINT +565 PRINT "O.K. HOPE YOU HAD FUN!!" +570 GOTO 999 +600 REM *** SUBROUTINE TO PRINT LIST +610 PRINT +620 FOR K=1 TO N +630 PRINT #2,@(K), +640 NEXT K +650 PRINT +660 RETURN +700 REM *** SUBROUTINE TO PRINT THE RULES +710 PRINT "THIS IS THE GAME OF 'REVERSE'. TO WIN, ALL YOU HAVE" +720 PRINT "TO DO IS ARRANGE A LIST OF NUMBERS (1 THROUGH ",#2,N,")" +730 PRINT "IN NUMERICAL ORDER FROM LEFT TO RIGHT. TO MOVE, YOU" +740 PRINT "TELL ME HOW MANY NUMBERS (COUNTING FROM THE LEFT) TO" +750 PRINT "REVERSE. FOR EXAMPLE, IF THE CURRENT LIST IS:" +755 PRINT +760 PRINT " 2 3 4 5 1 6 7 8 9" +765 PRINT +770 PRINT "AND YOU REVERSE 4, THE RESULT WILL BE:" +775 PRINT +780 PRINT " 5 4 3 2 1 6 7 8 9" +785 PRINT +790 PRINT "NOW IF YOU REVERSE 5, YOU WIN!" +795 PRINT +800 PRINT " 1 2 3 4 5 6 7 8 9" +805 PRINT +810 PRINT "NO DOUBT YOU WILL LIKE THIS GAME, BUT" +820 PRINT "IF YOU WANT TO QUIT, REVERSE 0 (ZERO)." +830 PRINT +840 RETURN +999 END diff --git a/Source/TastyBasic/examples/SBCRTC.BAS b/Source/TastyBasic/examples/SBCRTC.BAS new file mode 100644 index 00000000..ba8bc2c4 --- /dev/null +++ b/Source/TastyBasic/examples/SBCRTC.BAS @@ -0,0 +1,30 @@ +100 REM -- ADJUST USR FUNCTION POINTER +110 POKE 5118,6 +120 POKE 5119,20 +200 REM -- RTC BUFFER AT 5120-5125 +210 FOR I=0 TO 14 +220 READ A +230 POKE 5126+I,A +240 NEXT I +250 DATA 6,32,123,178,40,1,4,33,0,20,207,17,0,0,201 +300 INPUT "GET OR SET TIME (GET=0,SET=1)"P +310 IF P=0 GOTO 400 +320 A=5120:INPUT "YEAR"Q:GOSUB 500 +330 A=5121:INPUT "MONTH"Q:GOSUB 500 +340 A=5122:INPUT "DAY"Q:GOSUB 500 +350 A=5123:INPUT "HOURS"Q:GOSUB 500 +360 A=5124:INPUT "MINS"Q:GOSUB 500 +370 A=5125:INPUT "SECS"Q:GOSUB 500 +400 Q=USR(P) +410 PRINT $8,PEEK(5120),"-", +420 PRINT $8,PEEK(5121),"-", +430 PRINT $8,PEEK(5122)," ", +440 PRINT $8,PEEK(5123),":", +450 PRINT $8,PEEK(5124),":", +460 PRINT $8,PEEK(5125) +470 GOTO 300 +500 T=Q/10 +510 U=Q-10*T +520 B=T*16+U +530 POKE A,B +540 RETURN diff --git a/Source/TastyBasic/examples/TICTAC.BAS b/Source/TastyBasic/examples/TICTAC.BAS new file mode 100644 index 00000000..e6c9258a --- /dev/null +++ b/Source/TastyBasic/examples/TICTAC.BAS @@ -0,0 +1,117 @@ +2 PRINT "TIC-TAC-TOE" +4 PRINT "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY" +6 PRINT +8 PRINT "THE BOARD IS NUMBERED:" +10 PRINT " 1 2 3" +12 PRINT " 4 5 6" +14 PRINT " 7 8 9" +16 PRINT +20 FOR I=1 TO 9:@(I)=0:NEXT I +50 INPUT"DO YOU WANT 'X' OR 'O' (X=1,O=0)"C +55 IF C=1 GOTO 475 +60 P=0,Q=1 +100 G=-1,H=1:IF @(5)#0 GOTO 103 +102 @(5)=-1:GOTO 195 +103 IF @(5)#1 GOTO 106 +104 IF @(1)#0 GOTO 110 +105 @(1)=-1:GOTO 195 +106 IF (@(2)=1)*(@(1)=0) GOTO 181 +107 IF (@(4)=1)*(@(1)=0) GOTO 181 +108 IF (@(6)=1)*(@(9)=0) GOTO 189 +109 IF (@(8)=1)*(@(9)=0) GOTO 189 +110 IF G=1 GOTO 112 +111 GOTO 118 +112 J=3*(M-1)/3+1 +113 IF J=M LET K=1 +114 IF J+1=M LET K=2 +115 IF J+2=M LET K=3 +116 GOTO 120 +118 FOR J=1 TO 7 STEP 3:FOR K=1 TO 3 +120 IF @(J)#G GOTO 130 +122 IF @(J+2)#G GOTO 135 +126 IF @(J+1)#0 GOTO 150 +128 @(J+1)=-1:GOTO 195 +130 IF @(J)=H GOTO 150 +131 IF @(J+2)#G GOTO 150 +132 IF @(J+1)#G GOTO 150 +133 @(J)=-1:GOTO 195 +135 IF @(J+2)#0 GOTO 150 +136 IF @(J+1)#G GOTO 150 +138 @(J+2)=-1:GOTO 195 +150 IF @(K)#G GOTO 160 +152 IF @(K+6)#G GOTO 165 +156 IF @(K+3)#0 GOTO 170 +158 @(K+3)=-1:GOTO 195 +160 IF @(K)=H GOTO 170 +161 IF @(K+6)#G GOTO 170 +162 IF @(K+3)#G GOTO 170 +163 @(K)=-1:GOTO 195 +165 IF @(K+6)#0 GOTO 170 +166 IF @(K+3)#G GOTO 170 +168 @(K+6)=-1:GOTO 195 +170 GOTO 450 +171 IF (@(3)=G)*(@(7)=0) GOTO 187 +172 IF (@(9)=G)*(@(1)=0) GOTO 181 +173 IF (@(7)=G)*(@(3)=0) GOTO 183 +174 IF (@(9)=0)*(@(1)=G) GOTO 189 +175 IF G=-1 LET G=1,H=-1:GOTO 110 +176 IF (@(9)=1)*(@(3)=0) GOTO 182 +177 FOR I=2 TO 9:IF @(I)#0 GOTO 179 +178 @(I)=-1:GOTO 195 +179 NEXT I +181 @(1)=-1:GOTO 195 +182 IF @(1)=1 GOTO 177 +183 @(3)=-1:GOTO 195 +187 @(7)=-1:GOTO 195 +189 @(9)=-1 +195 PRINT"THE COMPUTER MOVES TO..." +202 GOSUB 1000 +205 GOTO 500 +450 IF G=1 GOTO 465 +455 IF (J=7)*(K=3) GOTO 465 +460 NEXT K:NEXT J +465 IF @(5)=G GOTO 171 +467 GOTO 175 +475 P=1,Q=0 +500 INPUT"WHERE DO YOU MOVE"M +502 IF M=0 PRINT"THANKS FOR THE GAME.":GOTO 2000 +503 IF M>9 GOTO 506 +505 IF @(M)=0 GOTO 510 +506 PRINT"THAT SQUARE IS OCCUPIED.":GOTO 500 +510 G=1,@(M)=1 +520 GOSUB 1000 +530 GOTO 100 +1000 FOR I=1 TO 9:PRINT" ",:IF @(I)#-1 GOTO 1014 +1011 IF Q=1 PRINT "X ", +1012 IF Q=0 PRINT "O ", +1013 GOTO 1020 +1014 IF @(I)#0 GOTO 1016 +1015 PRINT" ",:GOTO 1020 +1016 IF P=1 PRINT "X ", +1017 IF P=0 PRINT "O ", +1020 IF (I#3)*(I#6) GOTO 1050 +1030 PRINT"":PRINT"---+---+---" +1040 GOTO 1080 +1050 IF I=9 GOTO 1080 +1060 PRINT"!", +1080 NEXT I:PRINT +1095 FOR I=1 TO 7 STEP 3 +1100 IF @(I)#@(I+1) GOTO 1115 +1105 IF @(I)#@(I+2) GOTO 1115 +1110 IF @(I)=-1 GOTO 1350 +1112 IF @(I)=1 GOTO 1200 +1115 NEXT I:FOR I=1 TO 3:IF @(I)#@(I+3) GOTO 1150 +1130 IF @(I)#@(I+6) GOTO 1150 +1135 IF @(I)=-1 GOTO 1350 +1137 IF @(I)=1 GOTO 1200 +1150 NEXT I:FOR I=1 TO 9:IF @(I)=0 GOTO 1155 +1152 NEXT I:GOTO 1400 +1155 IF @(5)#G GOTO 1170 +1160 IF (@(1)=G)*(@(9)=G) GOTO 1180 +1165 IF (@(3)=G)*(@(7)=G) GOTO 1180 +1170 RETURN +1180 IF G=-1 GOTO 1350 +1200 PRINT"YOU BEAT ME!! GOOD GAME.":GOTO 2000 +1350 PRINT"I WIN, TURKEY!!!":GOTO 2000 +1400 PRINT"IT'S A DRAW. THANK YOU." +2000 END diff --git a/Source/TastyBasic/examples/bitsum.asm b/Source/TastyBasic/examples/bitsum.asm new file mode 100644 index 00000000..bcb8cfa4 --- /dev/null +++ b/Source/TastyBasic/examples/bitsum.asm @@ -0,0 +1,48 @@ +; ----------------------------------------------------------------------------- +; Copyright 2021 Dimitri Theulings +; +; This file is part of Tasty Basic. +; +; Tasty Basic 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. +; +; Tasty Basic 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 Tasty Basic. If not, see . +; ----------------------------------------------------------------------------- +; Tasty Basic is derived from earlier works by Li-Chen Wang, Peter Rauskolb, +; and Doug Gabbard. Refer to the source code repository for details +; . +; ----------------------------------------------------------------------------- + +#IFDEF CPM + .ORG $0C00 ; ie. 3072 dec +#ELSE + .ORG $1400 ; ie. 5120 dec +#ENDIF + + LD B,0 + LD A,D + CALL COUNT + LD A,E + CALL COUNT + LD E,B + LD D,0 + RET +COUNT: + OR A + RET Z + BIT 0,A + JR Z,NEXT + INC B +NEXT: + SRL A + JR COUNT + + .END \ No newline at end of file diff --git a/Source/TastyBasic/examples/bitsum.tba b/Source/TastyBasic/examples/bitsum.tba new file mode 100644 index 00000000..83b3046e Binary files /dev/null and b/Source/TastyBasic/examples/bitsum.tba differ diff --git a/Source/TastyBasic/examples/tictac.tba b/Source/TastyBasic/examples/tictac.tba new file mode 100644 index 00000000..a88534d2 Binary files /dev/null and b/Source/TastyBasic/examples/tictac.tba differ diff --git a/Source/TastyBasic/src/Build.cmd b/Source/TastyBasic/src/Build.cmd new file mode 100644 index 00000000..3045a99a --- /dev/null +++ b/Source/TastyBasic/src/Build.cmd @@ -0,0 +1,17 @@ +@echo off +setlocal + +set TOOLS=..\..\..\Tools + +set PATH=%TOOLS%\tasm32;%PATH% + +set TASMTABS=%TOOLS%\tasm32 + +:: git@github.com:dimitrit/tastybasic.git; commit a86d7e7; (HEAD -> master, tag: v0.3.0) +set VER=v0.3.0 + +tasm -80 -g3 -fFF -dROMWBW -d"VERSION \"%VER%\"" tastybasic.asm tastybasic.bin tastybasic.bin.lst +tasm -80 -g3 -fFF -dCPM -d"VERSION \"%VER%\"" tastybasic.asm tastybasic.com tastybasic.com.lst + +copy /b /v tastybasic.com tbasic.com +copy /b /v tbasic.com ..\..\..\Binary\Apps\tbasic.com diff --git a/Source/TastyBasic/src/Clean.cmd b/Source/TastyBasic/src/Clean.cmd new file mode 100644 index 00000000..420369b5 --- /dev/null +++ b/Source/TastyBasic/src/Clean.cmd @@ -0,0 +1,10 @@ +@echo off +setlocal + +if exist *.bin del *.bin +if exist *.lst del *.lst +if exist *.prn del *.prn +if exist *.hex del *.hex +if exist *.rel del *.rel +if exist *.sym del *.sym +if exist *.com del *.com diff --git a/Source/TastyBasic/src/Makefile b/Source/TastyBasic/src/Makefile new file mode 100644 index 00000000..00ad8ca2 --- /dev/null +++ b/Source/TastyBasic/src/Makefile @@ -0,0 +1,18 @@ +OBJECTS = tastybasic.bin tbasic.com +TOOLS = ../../../Tools +OTHERS = *.com +APPDIR=../../../Binary/Apps + +include $(TOOLS)/Makefile.inc + +# git@github.com:dimitrit/tastybasic.git; commit a86d7e7; (HEAD -> master, tag: v0.3.0) +VER=\"v0.3.0\" +USETASM=1 + +tastybasic.bin: TASMFLAGS=-dROMWBW -d"VERSION $(VER)" + +tastybasic.com: TASMFLAGS=-dCPM -d"VERSION $(VER)" + +tbasic.com : tastybasic.com + cp $< $@ + cp $$($(CASEFN) $@) $(APPDIR) diff --git a/Source/TastyBasic/src/cpmio.asm b/Source/TastyBasic/src/cpmio.asm new file mode 100644 index 00000000..fdef0bef --- /dev/null +++ b/Source/TastyBasic/src/cpmio.asm @@ -0,0 +1,207 @@ +; ----------------------------------------------------------------------------- +; Copyright 2021 Dimitri Theulings +; +; This file is part of Tasty Basic. +; +; Tasty Basic 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. +; +; Tasty Basic 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 Tasty Basic. If not, see . +; ----------------------------------------------------------------------------- +; Tasty Basic is derived from earlier works by Li-Chen Wang, Peter Rauskolb, +; and Doug Gabbard. Refer to the source code repository for details +; . +; ----------------------------------------------------------------------------- + +USRPTR_OFFSET .equ 0afeh +INTERNAL_OFFSET .equ 0c00h +TEXTEND_OFFSET .equ 07cffh +STACK_OFFSET .equ 07effh + +BDOS .equ 05h ; standard cp/m entry +DCONIO .equ 06h ; direct console I/O +INPREQ .equ 0ffh ; console input request +TERMCPM .equ 0 +OPENF .equ 0fh ; file open +CLOSEF .equ 10h ; file close +DELETEF .equ 13h ; file delete +READF .equ 14h ; read file record +WRITEF .equ 15h ; write file record +MAKEF .equ 16h ; make new file +SETDMA .equ 1ah ; set DMA address +EOF .equ 1ah ; EOF marker +DMAOFF .equ 1ah ; set DMA address pointer +FCB .equ 5ch ; file control block address +DMA .equ 80h ; disk buffer address +BUFSIZE .equ 80h ; disk buffer size + +; FILE CONTROL BLOCK DEFINITIONS +FCBDN .equ FCB+0 ; disk name +FCBFN .equ FCB+1 ; file name +FCBFT .equ FCB+9 ; disk file type (3 chars) +FCBRL .equ FCB+12 ; file's current reel number +FCBRC .equ FCB+15 ; file's record count (0 to 128) +FCBCR .equ FCB+32 ; current (next) record +FCBLN .equ FCB+33 ; FCB length +FTYPE .db "TBA" ; tasty basic file type + +haschar: + push bc + push de + ld c,DCONIO ; direct console i/o + ld e,INPREQ ; input request + call BDOS ; any chr typed? + pop de ; if yes, (a)<--char + pop bc ; else (a)<--00h (ignore chr) + or a + ret +; +putchar: + push bc + push de + push af + push hl + ld c,DCONIO ; direct console i/o + ld e,a ; output char (a) + call BDOS + pop hl + pop af + pop de + pop bc + ret +load: + ld hl,textbegin ; ** load ** + ld (textunfilled),hl ; clear program text area + call clrvars ; and variables + call fname ; get filename + call fopen ; and open file for reading + ld de,DMA + ld c,SETDMA ; point dma to default + call BDOS + +lo1: + ld de,FCB ; and read record + ld c,READF + call BDOS + or a ; are we at EOF? + jr nz,lo3 ; yes, all done + ld b,BUFSIZE ; no, copy from io buffer + ld de,DMA ; to text buffer + ld hl,(textunfilled) +lo2: + ld a,(de) ; get char from buffer + cp 1ah ; is it EOF? + jr z,lo3 ; yes, all done + ld (hl),a ; copy char to text area + inc hl ; and update pointers + inc de + ld (textunfilled),hl + dec b ; end of record? + jr z,lo1 ; yes, so try next record + jr lo2 ; no, copy next char +lo3: + jp rstart +save: + call fname ; ** save ** + ld de,textbegin ; check there is a program + ld hl,(textunfilled) ; in memory + sbc hl,de + jr nz,sa1 ; yes, try to save it + jp qhow ; no, nothing to be done +sa1: + call fdel ; remove any existing file + call fmake ; open new file for writing + ld de,textbegin ; initialise text ptr +sa2: + push de ; save current text ptr + ld hl,(textunfilled) + ld (hl),EOF ; set EOF marker + sbc hl,de ; are we done? + jr c,sa4 + ld c,SETDMA ; point dma to text + call BDOS + ld de,FCB ; write record + ld c,WRITEF + call BDOS + or a ; all good? + jr z,sa3 ; yes, try next + jp qsorry ; no, something bad happened +sa3: + pop hl ; update text ptr + ld de,BUFSIZE + add hl,de + ex de,hl + jr sa2 +sa4: + call fclose ; and close file jp rstart + jp rstart +fname: + call testc ; check filename + .db 22h ; is first char a double quote + .db fn4-$-1 ; no, so fail + ld hl,FCBFN ; start configuring fcb + ld b,22h + ld c,8 ; max filename length +fn1: + ld a,(de) + inc de ; bump pointer + cp b ; double quote? + jr z,fn2 + ld (hl),a ; copy into fcb + inc hl + dec c ; check filename length + jp z,qhow ; too long + jr fn1 +fn2: + call endchk + ld a,20h ; clear any remaining chars + ld (hl),a ; in filename + inc hl + dec c + jr nz,fn2 + ld b,3 ; set file type + ld hl,FTYPE + ld de,FCBFT +fn3: + ld a,(hl) + ld (de),a + inc hl + inc de + dec b + jr nz,fn3 + xor a + ld (FCBCR),a ; clear current record + ret +fn4: + jp qwhat +fopen: + ld de,FCB ; open file + ld c,OPENF + jr fexec +fclose: + ld de,FCB ; close file + ld c,CLOSEF + jr fexec +fmake: + ld de,FCB ; create new file + ld c,MAKEF +fexec: + call BDOS + inc a ; did operation fail? + ret nz ; no, all good + jp qhow ; something bad happened +fdel: + ld de,FCB ; delete file + ld c,DELETEF + jp BDOS ; ignore any errors +bye: + ld c,TERMCPM ; does not return! + jp BDOS \ No newline at end of file diff --git a/Source/TastyBasic/src/romwbwio.asm b/Source/TastyBasic/src/romwbwio.asm new file mode 100644 index 00000000..0f4a5cbd --- /dev/null +++ b/Source/TastyBasic/src/romwbwio.asm @@ -0,0 +1,100 @@ + +; ----------------------------------------------------------------------------- +; Copyright 2021 Dimitri Theulings +; +; This file is part of Tasty Basic. +; +; Tasty Basic 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. +; +; Tasty Basic 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 Tasty Basic. If not, see . +; ----------------------------------------------------------------------------- +; Tasty Basic is derived from earlier works by Li-Chen Wang, Peter Rauskolb, +; and Doug Gabbard. Refer to the source code repository for details +; . +; ----------------------------------------------------------------------------- + +CIODEV_CONSOLE .equ 0d0h +BF_CIOIN .equ 00h ; character input +BF_CIOOUT .equ 01h ; character output +BF_CIOIST .equ 02h ; character input status +BF_SYSRESET .equ 0f0h ; restart system +BF_SYSRES_WARM .equ 01h ; warm start + +;************************************************************* +; +; THE FOLLOWING NEED MUST BE SYNCED WITH STD.ASM SO ROMLDR +; KNOWS WHERE THIS EXECUTES AT +; +;************************************************************* +; +#ifndef PLATFORM +TBC_LOC .equ $0a00 +#endif +TBC_SIZ .equ $0a00 +TBC_END .equ TBC_LOC + TBC_SIZ +; +;************************************************************* + +USRPTR_OFFSET .equ 09feh +INTERNAL_OFFSET .equ 0c00h +TEXTEND_OFFSET .equ 07dffh +STACK_OFFSET .equ 07fffh + +bye: + call endchk ; ** Reboot ** + ld b,BF_SYSRESET ; system restart + ld c,BF_SYSRES_WARM ; warm start + jp 0fff0h ; does not return! +putchar: + push af + push bc + push de + push hl + ; output character to console via hbios + ld e,a ; output char to e + ld c,CIODEV_CONSOLE ; console unit to c + ld b,BF_CIOOUT ; hbios func: output char + rst 08h ; hbios outputs character + + pop hl + pop de + pop bc + pop af + ret +haschar: + push bc + push de + push hl + ; get console input status via hbios + ld c,CIODEV_CONSOLE ; console unit to c + ld b,BF_CIOIST ; hbios func: input status + rst 08h ; hbios returns status in a + + pop hl + pop de + pop bc + ret + +getchar: + push bc + push de + push hl + ; input character from console via hbios + ld c,CIODEV_CONSOLE ; console unit to c + ld b,BF_CIOIN ; hbios func: input char + rst 08h ; hbios reads charactdr + ld a,e ; move character to a for return + ; restore registers (af is output) + pop hl + pop de + pop bc + ret diff --git a/Source/TastyBasic/src/tastybasic.asm b/Source/TastyBasic/src/tastybasic.asm new file mode 100644 index 00000000..e564c3c8 --- /dev/null +++ b/Source/TastyBasic/src/tastybasic.asm @@ -0,0 +1,2017 @@ + +; ----------------------------------------------------------------------------- +; Copyright 2018 Dimitri Theulings +; +; This file is part of Tasty Basic. +; +; Tasty Basic 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. +; +; Tasty Basic 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 Tasty Basic. If not, see . +; ----------------------------------------------------------------------------- +; Tasty Basic is derived from earlier works by Li-Chen Wang, Peter Rauskolb, +; and Doug Gabbard. Refer to the source code repository for details +; . +; ----------------------------------------------------------------------------- + +#define dwa(addr) .db (addr >> 8) + 080h\ .db addr & 0ffh + +ctrlc .equ 03h +bs .equ 08h +lf .equ 0ah +cr .equ 0dh +ctrlo .equ 0fh +ctrlu .equ 15h + +#ifdef CPM +#define PLATFORM "CP/M" +TBC_LOC .equ 0100h +#endif + +#ifdef ROMWBW +#define PLATFORM "ROMWBW" +TBC_LOC .equ 0a00h +#endif + +#ifndef PLATFORM +TBC_LOC .equ 0 +#endif + + .org TBC_LOC +start: + ld sp,stack ; ** Cold Start ** + ld a,0ffh + jp init +testc: + ex (sp),hl ; ** TestC ** + call skipspace ; ignore spaces + cp (hl) ; test character + inc hl ; compare the byte that follows the + jr z,tc1 ; call instruction with the text pointer + push bc + ld c,(hl) ; if not equal, ad the seond byte + ld b, 0h ; that follows the call to the old pc + add hl,bc + pop bc + dec de +tc1: + inc de ; if equal, skip those bytes + inc hl ; and continue + ex (sp),hl + ret + +skipspace: + ld a,(de) ; ** SkipSpace ** + cp ' ' ; ignore spaces + ret nz ; in text (where de points) + inc de ; and return the first non-blank + jp skipspace ; character in A + +expr: + call expr2 ; ** Expr ** + push hl ; evaluate expression + jp expr1 + +comp: + ld a,h ; ** Compare ** + cp d ; compare hl with de + ret nz ; return c and z flags + ld a,l ; old a is lost + cp e + ret + +finish: + pop af ; ** Finish ** + call fin ; check end of command + jp qwhat + +;************************************************************* +; +; ** REM ** IF ** INPUT ** & LET (& DEFLT) ** DATA ** READ ** +; +; 'REM' CAN BE FOLLOWED BY ANYTHING AND IS IGNORED BY TBI. +; TBI TREATS IT LIKE AN 'IF' WITH A FALSE CONDITION. +; +; 'IF' IS FOLLOWED BY AN EXPR. AS A CONDITION AND ONE OR MORE +; COMMANDS (INCLUDING OTHER 'IF'S) SEPERATED BY SEMI-COLONS. +; NOTE THAT THE WORD 'THEN' IS NOT USED. TBI EVALUATES THE +; EXPR. IF IT IS NON-ZERO, EXECUTION CONTINUES. IF THE +; EXPR. IS ZERO, THE COMMANDS THAT FOLLOWS ARE IGNORED AND +; EXECUTION CONTINUES AT THE NEXT LINE. +; +; 'INPUT' COMMAND IS LIKE THE 'PRINT' COMMAND, AND IS FOLLOWED +; BY A LIST OF ITEMS. IF THE ITEM IS A STRING IN SINGLE OR +; DOUBLE QUOTES, OR IS A BACK-ARROW, IT HAS THE SAME EFFECT AS +; IN 'PRINT'. IF AN ITEM IS A VARIABLE, THIS VARIABLE NAME IS +; PRINTED OUT FOLLOWED BY A COLON. THEN TBI WAITS FOR AN +; EXPR. TO BE TYPED IN. THE VARIABLE IS THEN SET TO THE +; VALUE OF THIS EXPR. IF THE VARIABLE IS PROCEDED BY A STRING +; (AGAIN IN SINGLE OR DOUBLE QUOTES), THE STRING WILL BE +; PRINTED FOLLOWED BY A COLON. TBI THEN WAITS FOR INPUT EXPR. +; AND SET THE VARIABLE TO THE VALUE OF THE EXPR. +; +; IF THE INPUT EXPR. IS INVALID, TBI WILL PRINT "WHAT?", +; "HOW?" OR "SORRY" AND REPRINT THE PROMPT AND REDO THE INPUT. +; THE EXECUTION WILL NOT TERMINATE UNLESS YOU TYPE CONTROL-C. +; THIS IS HANDLED IN 'INPERR'. +; +; 'LET' IS FOLLOWED BY A LIST OF ITEMS SEPERATED BY COMMAS. +; EACH ITEM CONSISTS OF A VARIABLE, AN EQUAL SIGN, AND AN EXPR. +; TBI EVALUATES THE EXPR. AND SET THE VARIABLE TO THAT VALUE. +; TBI WILL ALSO HANDLE 'LET' COMMAND WITHOUT THE WORD 'LET'. +; THIS IS DONE BY 'DEFLT'. +; +; 'DATA' ALLOWS CONSTANT VALUES TO BE STORED IN CODE. TREATED +; AS A REMARK ('REM') WHEN PROGRAM IS EXECUTED. +; +; 'READ' ASSIGNS THE NEXT AVAILABLE DATA VALUE TO A VARIABLE. +;************************************************************* +rem: +data: + ld hl,0 ; ** Rem ** Data ** + jr if1 ; this is like 'IF 0' +iff: + call expr ; ** If ** +if1: + ld a,h ; is the expr = 0? + or l + jp nz,runsml ; no, continue + call findskip ; yes, skip rest of line + jp nc,runtsl ; and run the next line + jp rstart ; if no, restart +inputerror: + ld hl,(stkinp) ; ** InputError ** + ld sp,hl ; restore old sp and old current + pop hl + ld (current),hl + pop de ; and old text pointer + pop de ; redo current +input: + push de ; ** Input ** + call qtstg ; is next item a string? + jp ip2 ; no + call testvar ; yes and followed by a variable? + jp c,ip4 ; no + jp ip3 ; yes, input variable +ip2: + push de ; save for printstr + call testvar ; must be variable + jp c,qwhat ; no, what? + ld a,(de) ; prepare for printstr + ld c,a + sub a + ld (de),a + pop de + call printstr ; print string as prompt + ld a,c ; restore text + dec de + ld (de),a +ip3: + push de ; save text pointer + ex de,hl + ld hl,(current) ; also save current + push hl + ld hl,input + ld (current),hl + ld hl,0 + add hl,sp + ld (stkinp),hl + push de + ld a,':' + call getline + ld de,buffer + call expr + nop + nop + nop + pop de + ex de,hl + ld (hl),e + inc hl + ld (hl),d + pop hl + ld (current),hl + pop de +ip4: + pop af ; purge stack + call testc ; is next character ','? + .db ',' + .db ip5-$-1 + jr input ; yes, more items +ip5: + call finish +deflt: + ld a,(de) ; ** DEFLT ** + cp cr ; empty line is fine + jr z,lt1 ; else it's 'LET' +let: + call setval ; ** Let ** + call testc ; set value to var + .db ',' + .db lt1-$-1 + jr let ; item by item +lt1: + call finish +restore: call rstreadptr + call finish +rstreadptr: + ld hl,0 + ld (readptr),hl + ret +read: + push de ; ** Read ** + ld hl,(readptr) ; has read pointer been initialised? + ld a,h + or a + jr nz,rd2 ; yes, find next data value + call findline ; no, find first line + jr nc,rd1 ; found first line + pop de ; nothing found, so how? + jp qhow +rd1: + call finddata + jr rd4 +rd2: + ex de,hl + call skipspace ; skip over spaces + call testc ; have we hit a comma? + .db ',' + .db rd3-$-1 + jr rd5 +rd3: + call nextdata +rd4: + jr z,rd5 ; found a data statement + pop de + jp qhow ; nothing found, so how to read? + +rd5: + ld (readptr),de ; update read pointer + pop de + call testvar + jp c,qwhat ; no variable + push hl ; save address of variable + push de ; and text pointer + ld de,(readptr) ; point to next data value + call parsenum ; parse the constant + jr nc, rd6 + pop de ; spmething bad happened when + jp qhow ; parsing the number +rd6: + ld (readptr),de ; update read pointer + pop de ; and restore text pointer + ld b,h ; move value to bc + ld c,l + pop hl ; get address of variable + ld (hl),c ; assign value + inc hl + ld (hl),b + + call testc ; do we have more variables? + .db ',' + .db rd7-$-1 + jr read ; yes, read next +rd7: + call finish ; all done +finddata: + inc de ; skip over line no. + inc de + call skipspace + ld hl,datastmt + ld b,4 +fd1: + ld a,(de) + cp (hl) + jp nz,nextdata ; not what we're looking for + dec b ; are we done comparing + jr z,fd2 ; yes + inc de + inc hl + jr fd1 +fd2: + inc de ; first char past statement + ret ; nc,z:found; nc,nz:no + +nextdata: + ld hl,0 + call findskip ; find the next line + jr nc,finddata ; and try there + or 1 ; no more lines + ret ; nc,nz: not found! + +;************************************************************* +; +; *** PEEK *** POKE *** IN *** & OUT *** +; +; 'PEEK()' RETURNS THE VALUE OF THE BYTE AT THE GIVEN +; ADDRESS. +; 'POKE ,' SETS BYTE AT ADDRESS TO +; VALUE +; 'IN(,' WRITES VALUE TO PORT . +; +;************************************************************* +peek: + call parn ; ** Peek(expr) ** + ld a,h ; expression must be positive + or a + jp m,qhow + ld a,(hl) ; peek address + ld h,0 + ld l,a + ret +inp: + call parn ; ** In(expr) ** + ld a,0 ; is port > 255? + cp h + jp nz,qhow ; yes, so not a valid port + ld c,l + in l,(c) ; read port + ld h,0 + ret +poke: + call expr ; ** Poke ** + ld a,h ; address must be positive + or a + jp m,qhow + push hl + call testc ; is next char a comma? + .db ',' + .db ot1-$-1 ; what, no? + call expr ; get value to store + ld a,0 ; is it > 255? + cp h + jp z,pk1 ; no, all good + pop hl + jp qhow +pk1: + ld a,l ; save value + pop hl + ld (hl),a + call finish +outp: + call expr ; ** Out ** + ld a,0 ; is port > 255? + cp h + jp nz,qhow ; yes, so not a valid port + push hl + call testc ; is next char a comma? + .db ',' + .db ot1-$-1 ; what, no? + call expr ; get value to write + ld a,0 ; is it > 255? + cp h + jp z,ot2 ; no, all good + pop hl + jp qhow +ot2: + ld a,l ; output value + pop hl + ld c,l + out (c),a + call finish +ot1: + pop hl + jp qwhat +usrexec: + call parn ; ** Usr(expr) ** + push de + ex de,hl + ld hl,ue1 + push hl + ld ix,(usrptr) + jp (ix) +ue1: + ex de,hl + pop de + ret +;************************************************************* +; +; *** EXPR *** +; +; 'EXPR' EVALUATES ARITHMETICAL OR LOGICAL EXPRESSIONS. +; :: +; +; WHERE IS ONE OF THE OPERATORS IN TAB8 AND THE +; RESULT OF THESE OPERATIONS IS 1 IF TRUE AND 0 IF FALSE. +; ::=(+ OR -)(+ OR -)(....) +; WHERE () ARE OPTIONAL AND (....) ARE OPTIONAL REPEATS. +; ::=(* OR />)(....) +; ::= +; +; () +; IS RECURSIVE SO THAT VARIABLE '@' CAN HAVE AN +; AS INDEX, FUNCTIONS CAN HAVE AN AS ARGUMENTS, AND +; CAN BE AN IN PARANTHESE. +;************************************************************* + +expr1: + ld hl,tab8-1 ; look up rel.op + jp exec ; go do it +xp11: + call xp18 ; rel.op.'>=' + ret c ; no, return hl=0 + ld l,a ; yes, return hl=1 + ret +xp12: + call xp18 ; rel.op.'#' + ret z ; no, return hl=0 + ld l,a ; yes, return hl=1 + ret +xp13: + call xp18 ; rel.op.'>' + ret z ; no + ret c ; also, no + ld l,a ; yes, return hl=1 + ret +xp14: + call xp18 ; rel.op.'<=' + ld l,a ; set hl=1 + ret z ; yes, return hl=1 + ret c + ld l,h ; else set hl=0 + ret +xp15: + call xp18 ; rel.op.'=' + ret nz ; no, return hl=0 + ld l,a ; else hl=1 + ret +xp16: + call xp18 ; rel.op.'<' + ret nc ; no, return hl=0 + ld l,a ; else hl=1 + ret +xp17: + pop hl ; not rel.op + ret ; return hl= +xp18: + ld a,c ; routine for all rel.ops + pop hl + pop bc + push hl + push bc ; reverse top of stack + ld c,a + call expr2 ; get second + ex de,hl ; value now in de + ex (sp),hl ; first in hl + call ckhlde ; compare them + pop de ; restore text pointer + ld hl,0 ; set hl=0, a=1 + ld a,1 + ret +expr2: + call testc ; is it minus sign? + .db '-' + .db xp21-$-1 + ld hl,0 ; yes, fake 0 - + jr xp26 ; treat like subtract +xp21: + call testc ; is it plus sign? + .db '+' + .db xp22-$-1 +xp22: + call expr3 ; first +xp23: + call testc ; addition? + .db '+' + .db xp25-$-1 + push hl ; yes, save value + call expr3 ; get second +xp24: + ex de,hl ; 2nd in de + ex (sp),hl ; 1st in hl + ld a,h ; compare sign + xor d + ld a,d + add hl,de + pop de ; restore text pointer + jp m,xp23 ; first and second sign differ + xor h ; first and second sign are equal + jp p,xp23 ; so is the result + jp qhow ; else we have overflow +xp25: + call testc ; subtract? + .db '-' + .db xp42-$-1 +xp26: + push hl ; yes, save first + call expr3 ; get second + call changesign ; negate + jr xp24 ; and add them +expr3: + call expr4 ; get first expr4 +xp31: + call testc ; multiply? + .db '*' + .db xp34-$-1 + push hl ; yes, save first and get second + call expr4 ; + ld b,0 ; clear b for sign + call checksign + ex (sp),hl ; first in hl + call checksign ; check sign of first + ex de,hl + ex (sp),hl + ld a,h ; is hl > 255? + or a + jr z,xp32 ; no + ld a,d ; yes, what about de + or d + ex de,hl + jp nz,ahow +xp32: + ld a,l + ld hl,0 + or a + jr z,xp35 +xp33: + add hl,de + jp c,ahow + dec a + jr nz,xp33 + jr xp35 +xp34: + call testc ; divide + .db '/' + .db xp42-$-1 + push hl ; yes, save first + call expr4 ; and get the second one + ld b,0h ; clear b for sign + call checksign ; check sign of the second + ex (sp),hl ; get the first in hl + call checksign ; check sign of first + ex de,hl + ex (sp),hl + ex de,hl + ld a,d ; divide by 0? + or e + jp z,ahow ; err...how? + push bc ; else save sign + call divide + ld h,b + ld l,c + pop bc ; retrieve sign +xp35: + pop de ; and text pointer + ld a,h ; hl must be positive + or a + jp m,qhow ; else it's overflow + ld a,b + or a + call m,changesign ; change sign if needed + jp xp31 ; look for more terms +expr4: + ld hl,tab4-1 ; find function in tab4 + jp exec ; and execute it +xp40: + call testvar + jr c,xp41 ; nor a variable + ld a,(hl) + inc hl + ld h,(hl) ; value in hl + ld l,a + ret +xp41: + call testnum ; or is it a number + ld a,b ; number of digits + or a + ret nz ; ok + +parn: + call testc + .db '(' + .db xp43-$-1 + call expr ; "(expr)" + call testc + .db ')' + .db xp43-$-1 +xp42: + ret +xp43: + jp qwhat ; what? +rnd: + call parn ; ** Rnd(expr) ** + ld a,h ; expression must be positive + or a + jp m,qhow + or l ; and non-zero + jp z,qhow + push de ; save de and hl + push hl + ld hl,(rndptr) ; get memory as random number + ld de,LST_ROM + call comp + jr c,ra1 ; wrap around if last + ld hl,start +ra1: + ld e,(hl) + inc hl + ld d,(hl) + ld (rndptr),hl + pop hl + ex de,hl + push bc + call divide ; rnd(n)=mod(m,n)+1 + pop bc + pop de + inc hl + ret +abs: + call parn ; ** Abs (expr) ** + dec de + call checksign + inc de + ret +size: + ld hl,(textunfilled) ; ** Size ** + push de ; get the number of free bytes between + ex de,hl ; and varbegin + ld hl,varbegin + call subde + pop de + ret +clrvars: + ld hl,(textunfilled) ; ** ClearVars** + push de ; get the number of bytes available + ex de,hl ; for variable storge + ld hl,varend + call subde + ld b,h ; and save in bc + ld c,l + ld hl,(textunfilled) ; clear the first byte + ld d,h + ld e,l + inc de + ld (hl),0h + ldir ; and repeat for all the others + pop de + ret + +;************************************************************* +; +; *** DIVIDE *** SUBDE *** CHKSGN *** CHGSGN *** & CKHLDE *** +; +; 'DIVIDE' DIVIDES HL BY DE, RESULT IN BC, REMAINDER IN HL +; +; 'SUBDE' SUBSTRACTS DE FROM HL +; +; 'CHKSGN' CHECKS SIGN OF HL. IF +, NO CHANGE. IF -, CHANGE +; SIGN AND FLIP SIGN OF B. +; +; 'CHGSGN' CHECKS SIGN N OF HL AND B UNCONDITIONALLY. +; +; 'CKHLDE' CHECKS SIGN OF HL AND DE. IF DIFFERENT, HL AND DE +; ARE INTERCHANGED. IF SAME SIGN, NOT INTERCHANGED. EITHER +; CASE, HL DE ARE THEN COMPARED TO SET THE FLAGS. +;************************************************************* +divide: + push hl ; ** Divide ** + ld l,h ; divide h by de + ld h,0h + call dv1 + ld b,c ; save result in b + ld a,l ; (remainder + l) / de + pop hl + ld h,a +dv1: + ld c,0ffh ; result in c +dv2: + inc c ; dumb routine + call subde ; divide using subtract and count + jr nc,dv2 + add hl,de + ret +subde: + ld a,l ; ** subde ** + sub e ; subtract de from hl + ld l,a + ld a,h + sbc a,d + ld h,a + ret + +checksign: + ld a,h ; ** CheckSign ** + or a ; check sign of hl + ret p +changesign: + ld a,h ; ** ChangeSign ** + or l ; check if hl is zero + jp nz,cs1 ; no, try to change sign + ret ; yes, return +cs1: + ld a,h ; change sign of hl + push af + cpl + ld h,a + ld a,l + cpl + ld l,a + inc hl + pop af + xor h + jp p,qhow + ld a,b ; and also flip b + xor 80h + ld b,a + ret +ckhlde: + ld a,h ; same sign? + xor d ; yes, compare + jp p,ck1 ; no, exchange and compare + ex de,hl +ck1: + call comp + ret + +;************************************************************* +; +; *** SETVAL *** FIN *** ENDCHK *** & ERROR (& FRIENDS) *** +; +; "SETVAL" EXPECTS A VARIABLE, FOLLOWED BY AN EQUAL SIGN AND +; THEN AN EXPR. IT EVALUATES THE EXPR. AND SET THE VARIABLE +; TO THAT VALUE. +; +; "FIN" CHECKS THE END OF A COMMAND. IF IT ENDED WITH ":", +; EXECUTION CONTINUES. IF IT ENDED WITH A CR, IT FINDS THE +; NEXT LINE AND CONTINUE FROM THERE. +; +; "ENDCHK" CHECKS IF A COMMAND IS ENDED WITH CR. THIS IS +; REQUIRED IN CERTAIN COMMANDS. (GOTO, RETURN, AND STOP ETC.) +; +; "ERROR" PRINTS THE STRING POINTED BY DE (AND ENDS WITH CR). +; IT THEN PRINTS THE LINE POINTED BY 'CURRNT' WITH A "?" +; INSERTED AT WHERE THE OLD TEXT POINTER (SHOULD BE ON TOP +; OF THE STACK) POINTS TO. EXECUTION OF TB IS STOPPED +; AND TBI IS RESTARTED. HOWEVER, IF 'CURRNT' -> ZERO +; (INDICATING A DIRECT COMMAND), THE DIRECT COMMAND IS NOT +; PRINTED. AND IF 'CURRNT' -> NEGATIVE # (INDICATING 'INPUT' +; COMMAND), THE INPUT LINE IS NOT PRINTED AND EXECUTION IS +; NOT TERMINATED BUT CONTINUED AT 'INPERR'. +; +; RELATED TO 'ERROR' ARE THE FOLLOWING: +; 'QWHAT' SAVES TEXT POINTER IN STACK AND GET MESSAGE "WHAT?" +; 'AWHAT' JUST GET MESSAGE "WHAT?" AND JUMP TO 'ERROR'. +; 'QSORRY' AND 'ASORRY' DO SAME KIND OF THING. +; 'AHOW' AND 'AHOW' IN THE ZERO PAGE SECTION ALSO DO THIS. +;************************************************************* +setval: + call testvar ; ** SetVal ** + jp c,qwhat ; no variable + push hl ; save address of var + call testc ; do we have =? + .db '=' + .db sv1-$-1 + call expr ; evaluate expression + ld b,h ; value is in bc now + ld c,l + pop hl ; get address + ld (hl),c ; save value + inc hl + ld (hl),b + ret +sv1: + jp qwhat +fin: + call testc ; test for ':' + .db ':' + .db fi1 - $ - 1 + pop af ; yes, purge return address + jp runsml ; continue on same line +fi1: + call testc ; not ':', is it cr + .db cr + .db fi2 - $ - 1 + pop af ; yes, purge return address + jp runnxl ; run next line +fi2: + ret ; else return to caller +endchk: + call skipspace ; ** EndChk ** + cp cr ; ends with cr? + ret z ; ok, otherwise say 'what?' +qwhat: + push de ; ** QWhat ** +awhat: + ld de,what ; ** AWhat ** +handleerror: + sub a ; ** Error ** + call printstr ; print error message + pop de + ld a,(de) ; save the character + push af ; at where old de points + sub a ; and put a 0 (zero) there + ld (de),a + ld hl,(current) ; get the current line number + push hl + ld a,(hl) ; check the value + inc hl + or (hl) + pop de + jp z,rstart ; if zero, just rerstart + ld a,(hl) ; if negative + or a + jp m,inputerror ; then redo input + call printline ; else print the line + dec de ; up to where the 0 is + pop af ; restore the character + ld (de),a + ld a,'?' ; print a ? + call outc + sub a ; and the rest of the line + call printstr + jp rstart +qsorry: + push de ; ** Sorry ** +asorry: + ld de,sorry + jr handleerror + +;************************************************************* +; +; *** GETLN *** FNDLN (& FRIENDS) *** +; +; 'GETLN' READS A INPUT LINE INTO 'BUFFER'. IT FIRST PROMPT +; THE CHARACTER IN A (GIVEN BY THE CALLER), THEN IT FILLS +; THE BUFFER AND ECHOS. IT IGNORES LF'S AND NULLS, BUT STILL +; ECHOS THEM BACK. RUB-OUT IS USED TO CAUSE IT TO DELETE +; THE LAST CHARACTER (IF THERE IS ONE), AND ALT-MOD IS USED TO +; CAUSE IT TO DELETE THE WHOLE LINE AND START IT ALL OVER. +; CR SIGNALS THE END OF A LINE, AND CAUSE 'GETLN' TO RETURN. +; +; 'FNDLN' FINDS A LINE WITH A GIVEN LINE # (IN HL) IN THE +; TEXT SAVE AREA. DE IS USED AS THE TEXT POINTER. IF THE +; LINE IS FOUND, DE WILL POINT TO THE BEGINNING OF THAT LINE +; (I.E., THE LOW BYTE OF THE LINE #), AND FLAGS ARE NC & Z. +; IF THAT LINE IS NOT THERE AND A LINE WITH A HIGHER LINE # +; IS FOUND, DE POINTS TO THERE AND FLAGS ARE NC & NZ. IF +; WE REACHED THE END OF TEXT SAVE AREA AND CANNOT FIND THE +; LINE, FLAGS ARE C & NZ. +; 'FNDLN' WILL INITIALIZE DE TO THE BEGINNING OF THE TEXT SAVE +; AREA TO START THE SEARCH. SOME OTHER ENTRIES OF THIS +; ROUTINE WILL NOT INITIALIZE DE AND DO THE SEARCH. +; 'FNDLNP' WILL START WITH DE AND SEARCH FOR THE LINE #. +; 'FNDNXT' WILL BUMP DE BY 2, FIND A CR AND THEN START SEARCH. +; 'FNDSKP' USE DE TO FIND A CR, AND THEN START SEARCH. +;************************************************************* +getline: + call outc ; ** GetLine ** + ld de,buffer ; prompt and initalise pointer +gl1: + call chkio ; check keyboard + jr z,gl1 ; no input, so wait + cp bs ; erase last character? + jr z,gl3 ; yes + call outc ; echo character + cp lf ; ignore lf + jr z,gl1 + or a ; ignore null + jr z,gl1 + cp ctrlu ; erase the whole line? + jr z,gl4 ; yes + ld (de),a ; save the input + inc de ; and increment pointer + cp cr ; was it cr? + ret z ; yes, end of line + ld a,e ; any free space left? + cp bufend & 0ffh + jr nz,gl1 ; yes, get next char +gl3: + ld a,e ; delete last character + cp buffer & 0ffh ; if there are any? + jr z,gl4 ; no, redo whole line + dec de ; yes, back pointer + ld a,08h ; and echo a backspace + call outc + jr gl1 ; and get next character +gl4: + call crlf ; redo entire line + ld a,'>' + jr getline +findline: + ld a,h ; ** FindLine ** + or a ; check the sign of hl + jp m,qhow ; it cannot be negative + ld de,textbegin ; initialise the text pointer +findlineptr: +fl1: + push hl ; save line number + ld hl,(textunfilled) ; check if we passed end + dec hl + call comp + pop hl ; retrieve line number + ret c ; c,nz passed end + ld a,(de) ; we didn't; get first byte + sub l ; is this the line? + ld b,a ; compare low order + inc de + ld a,(de) ; get second byte + sbc a,h ; compare high order + jr c,fl2 ; no, not there yet + dec de ; else we either found it + or b ; or it's not there + ret ; nc,z:found; nc,nz:no +findnext: + inc de ; find next line +fl2: + inc de ; just passed first and second byte +findskip: + ld a,(de) ; ** FindSkip ** + cp cr ; try to find cr + jr nz,fl2 ; keep looking + inc de ; found cr, skip over + jr fl1 ; check if end of text + +;************************************************************* +; +; *** PRTSTG *** QTSTG *** PRTNUM *** & PRTLN *** +; +; 'PRTSTG' PRINTS A STRING POINTED BY DE. IT STOPS PRINTING +; AND RETURNS TO CALLER WHEN EITHER A CR IS PRINTED OR WHEN +; THE NEXT BYTE IS THE SAME AS WHAT WAS IN A (GIVEN BY THE +; CALLER). OLD A IS STORED IN B, OLD B IS LOST. +; +; 'QTSTG' LOOKS FOR A BACK-ARROW, SINGLE QUOTE, OR DOUBLE +; QUOTE. IF NONE OF THESE, RETURN TO CALLER. IF BACK-ARROW, +; OUTPUT A CR WITHOUT A LF. IF SINGLE OR DOUBLE QUOTE, PRINT +; THE STRING IN THE QUOTE AND DEMANDS A MATCHING UNQUOTE. +; AFTER THE PRINTING THE NEXT 3 BYTES OF THE CALLER IS SKIPPED +; OVER (USUALLY A JUMP INSTRUCTION. +; +; 'PRTNUM' PRINTS THE NUMBER IN HL. LEADING BLANKS ARE ADDED +; IF NEEDED TO PAD THE NUMBER OF SPACES TO THE NUMBER IN C. +; HOWEVER, IF THE NUMBER OF DIGITS IS LARGER THAN THE # IN +; C, ALL DIGITS ARE PRINTED ANYWAY. NEGATIVE SIGN IS ALSO +; PRINTED AND COUNTED IN, POSITIVE SIGN IS NOT. +; +; 'PRTLN' PRINTS A SAVED TEXT LINE WITH LINE # AND ALL. +;************************************************************* +printstr: + ld b,a +ps1: + ld a,(de) ; get a character + inc de ; bump pointer + cp b ; same as old A? + ret z ; yes, return + call outc ; no, show character + cp cr ; was it a cr? + jr nz,ps1 ; no, next character + ret ; yes, returns +qtstg: + call testc ; ** Qtstg ** + .db 22h ; is it a double quote + .db qt3-$-1 + ld a,22h +qt1: + call printstr ; print until another + cp cr + pop hl + jp z,runnxl +qt2: + inc hl ; skip 3 bytes on return + inc hl + inc hl + jp (hl) ; return +qt3: + call testc ; is it a single quote + .db 27h + .db qt4-$-1 + ld a,27h + jr qt1 +qt4: + call testc ; is it back-arrow + .db '_' + .db qt5-$-1 + ld a,8dh ; yes, cr without lf + call outc + call outc + pop hl ; return address + jr qt2 +qt5: + ret ; none of the above + +printnum: + ld b,0h ; ** PrintNum ** + call checksign ; check sign + jp p,pn1 ; no sign + ld b,'-' + dec c +pn1: + push de ; save + ld de, 000ah ; decimal + push de ; save as flag + dec c ; c=spaces + push bc ; save sign & space +pn2: + call divide ; divide hl by 10 + ld a,b ; result 0? + or c + jr z,pn3 ; yes, we got all + ex (sp),hl ; no, save remainder + dec l ; and count space + push hl ; hl is old bc + ld h,b ; moved result to bc + ld l,c + jr pn2 ; and divide by 10 +pn3: + pop bc ; we got all digits +pn4: + dec c + ld a,c ; look at space count + or a + jp m,pn5 ; no leading spaces + ld a,' ' ; print a leading space + call outc + jr pn4 ; any more? +pn5: + ld a,b ; print sign + or a + call nz,outc + ld e,l ; last remainder in e +pn6: + ld a,e ; check digit in e + cp lf ; lf is flag for no more + pop de + ret z ; if yes, return + add a,30h ; else convert to ascii + call outc ; and print the digit + jr pn6 ; next digit +printhex: + ld c,h ; ** PrintHex ** + call ph1 ; first hex byte +printhex8: + ld c,l ; then second +ph1: + ld a,c ; get left nibble into position + rra + rra + rra + rra + call ph2 ; and turn into hex digit + ld a,c ; then convert right nibble +ph2: + and 0fh ; mask right nibble + add a,90h ; and convert to ascii character + daa + adc a,40h + daa + call outc ; print character + ret +printline: + ld a,(de) ; ** PrintLine ** + ld l,a ; low order line number + inc de + ld a,(de) ; high order + ld h,a + inc de + ld c,04h ; print 4 digit line number + call printnum + ld a,' ' ; followed by a space + call outc + sub a ; and the the rest + call printstr + ret + +;************************************************************* +; +; *** MVUP *** MVDOWN *** POPA *** & PUSHA *** +; +; 'MVUP' MOVES A BLOCK UP FROM WHERE DE-> TO WHERE BC-> UNTIL +; DE = HL +; +; 'MVDOWN' MOVES A BLOCK DOWN FROM WHERE DE-> TO WHERE HL-> +; UNTIL DE = BC +; +; 'POPA' RESTORES THE 'FOR' LOOP VARIABLE SAVE AREA FROM THE +; STACK +; +; 'PUSHA' STACKS THE 'FOR' LOOP VARIABLE SAVE AREA INTO THE +; STACK +;************************************************************* +mvup: + call comp ; ** mvup ** + ret z ; de = hl, return + ld a,(de) ; get one byte + ld (bc),a ; then copy it + inc de ; increase both pointers + inc bc + jr mvup ; until done +mvdown: + ld a,b ; ** mvdown ** + sub d ; check if de = bc + jp nz,md1 ; no, go move + ld a,c ; maybe, other byte + sub e + ret z ; yes, return +md1: + dec de ; else move a byte + dec hl ; but first decrease both pointers + ld a,(de) ; and then do it + ld (hl),a + jr mvdown ; loop back +popa: + pop bc ; bc = return address + pop hl ; restore loopvar + ld (loopvar),hl + ld a,h + or l + jr z,pp1 ; all done, so return + pop hl + ld (loopinc),hl + pop hl + ld (looplmt),hl + pop hl + ld (loopln),hl + pop hl + ld (loopptr),hl +pp1: + push bc ; bc = return address + ret +pusha: + ld hl,stacklimit ; ** PushA ** + call changesign + pop bc ; bc = return address + add hl,sp ; is stack near the top? + jp nc,qsorry ; yes, sorry + ld hl,(loopvar) ; else save loop variables + ld a,h + or l + jr z,pu1 ; only when loopvar not 0 + ld hl,(loopptr) + push hl + ld hl,(loopln) + push hl + ld hl,(looplmt) + push hl + ld hl,(loopinc) + push hl + ld hl,(loopvar) +pu1: + push hl + push bc ; bc = return address + ret + +testvar: + call skipspace ; ** testvar ** + sub '@' ; test variables + ret c ; not a variable + jr nz,tv1 ; not @ array + inc de ; is is the @ array + call parn ; @ should be followed by (expr) + add hl,hl ; as its index + jr c,qhow ; is index too big? + push de ; will it override text? + ex de,hl + call size ; find the size of free + call comp + jp c,asorry ; yes, sorry + ld hl,varbegin ; no, get address of @(expr) and + call subde ; put it in hl + pop de + ret +tv1: + cp 1bh ; not @, is it A to Z + ccf + ret c + inc de ; if A through Z + ld hl,varbegin ; calculate address of that variable + rlca ; and return it in hl + add a,l ; with the c flag cleared + ld l,a + ld a,0 + adc a,h + ld h,a + ret + +testnum: + call parsenum ; ** TestNum ** + ret nc ; if not a number, return nc and 0 in b and hl + jr qhow ; carry set, so overflowed +parsenum: + ld hl,0 ; try to parse text as a number + ld b,h ; if not a number, return 0 in b and hl + call skipspace +tn1: + cp '0' + jr nc,tn2 + ccf ; reset carry + ret +tn2: + cp ':' ; if a digit, convert to binary in + ret nc ; b and hl + ld a,0f0h ; set b to number of digits + and h ; if h>255, there is no room for + jr z,tn3 ; next digit, so set carry + scf + ret +tn3: + inc b ; b counts number of digits + push bc + ld b,h ; hl=10*hl+(new digit) + ld c,l + add hl,hl ; where 10* is done by shift and add + add hl,hl + add hl,bc + add hl,hl + ld a,(de) ; and (digit) is by stripping the + inc de ; ascii code + and 0fh + add a,l + ld l,a + ld a,0 + adc a,h + ld h,a + pop bc + ld a,(de) + jp p,tn1 + scf + ret +qhow: + push de ; ** Error How? ** +ahow: + ld de,how + jp handleerror + +welcome +#ifdef PLATFORM + .db PLATFORM," " +#endif + .db "TASTY BASIC" +#ifdef VERSION + .db " (",VERSION,")" +#endif + .db cr +free .db " BYTES FREE",cr +how .db "HOW?",cr +ok .db "OK",cr +what .db "WHAT?",cr +sorry .db "SORRY",cr + +;************************************************************* +; +; *** MAIN *** +; +; THIS IS THE MAIN LOOP THAT COLLECTS THE TINY BASIC PROGRAM +; AND STORES IT IN THE MEMORY. +; +; AT START, IT PRINTS OUT "(CR)OK(CR)", AND INITIALIZES THE +; STACK AND SOME OTHER INTERNAL VARIABLES. THEN IT PROMPTS +; ">" AND READS A LINE. IF THE LINE STARTS WITH A NON-ZERO +; NUMBER, THIS NUMBER IS THE LINE NUMBER. THE LINE NUMBER +; (IN 16 BIT BINARY) AND THE REST OF THE LINE (INCLUDING CR) +; IS STORED IN THE MEMORY. IF A LINE WITH THE SAME LINE +; NUMBER IS ALREADY THERE, IT IS REPLACED BY THE NEW ONE. IF +; THE REST OF THE LINE CONSISTS OF A CR ONLY, IT IS NOT STORED +; AND ANY EXISTING LINE WITH THE SAME LINE NUMBER IS DELETED. +; +; AFTER A LINE IS INSERTED, REPLACED, OR DELETED, THE PROGRAM +; LOOPS BACK AND ASKS FOR ANOTHER LINE. THIS LOOP WILL BE +; TERMINATED WHEN IT READS A LINE WITH ZERO OR NO LINE +; NUMBER; AND CONTROL IS TRANSFERED TO "DIRECT". +; +; TINY BASIC PROGRAM SAVE AREA STARTS AT THE MEMORY LOCATION +; LABELED "TXTBGN" AND ENDS AT "TXTEND". WE ALWAYS FILL THIS +; AREA STARTING AT "TXTBGN", THE UNFILLED PORTION IS POINTED +; BY THE CONTENT OF A MEMORY LOCATION LABELED "TXTUNF". +; +; THE MEMORY LOCATION "CURRNT" POINTS TO THE LINE NUMBER +; THAT IS CURRENTLY BEING INTERPRETED. WHILE WE ARE IN +; THIS LOOP OR WHILE WE ARE INTERPRETING A DIRECT COMMAND +; (SEE NEXT SECTION). "CURRNT" SHOULD POINT TO A 0. +;************************************************************* +rstart: + ld sp,stack +st1: + call crlf + sub a ; a=0 + ld de,ok ; print ok + call printstr + ld hl,st2 + 1 ; literal zero + ld (current),hl ; reset current line pointer +st2: + ld hl,0 + ld (loopvar),hl + ld (stkgos),hl +st3: + ld a,'>' ; initialise prompt + call getline + push de ; de points to end of line + ld de,buffer ; point de to beginning of line + call testnum ; check if it is a number + call skipspace + ld a,h ; hl = value of the number, or + or l ; 0 if no number was found + pop bc ; bc points to end of line + jp z,direct + dec de ; back up de and save the value of + ld a,h ; the value of the line number there + ld (de),a + dec de + ld a,l + ld (de),a + push bc ; bc,de point to begin,end + push de + ld a,c + sub e + + push af ; a = number of bytes in line + call findline ; find this line in save area + push de ; de points to save area + jr nz,st4 ; nz: line not found + push de ; z: found, delete it + call findnext ; find next line + ; de -> next line + pop bc ; bc -> line to be deleted + ld hl,(textunfilled) ; hl -> unfilled text area + call mvup ; move up to delete + ld h,b ; txtunf -> unfilled area + ld l,c + ld (textunfilled),hl +st4: + pop bc ; get ready to insert + ld hl,(textunfilled) ; but first check if the length + pop af ; of new line is 3 (line# and cr) + push hl + cp 3h ; if so, do not insert + jr z,rstart ; must clear the stack + add a,l ; calculate new txtunf + ld l,a + ld a,0 + adc a,h + ld h,a ; hl -> new unfilled area + ld de,textend ; check to see if there is space + call comp + jp nc,qsorry ; no, sorry + ld (textunfilled),hl ; ok, update textunfilled + pop de ; de -> old unfilled area + call mvdown + pop de ; de,hl -> begin,end + pop hl + call mvup ; copy new line to save area + jr st3 + +;************************************************************* +; +; WHAT FOLLOWS IS THE CODE TO EXECUTE DIRECT AND STATEMENT +; COMMANDS. CONTROL IS TRANSFERED TO THESE POINTS VIA THE +; COMMAND TABLE LOOKUP CODE OF 'DIRECT' AND 'EXEC' IN LAST +; SECTION. AFTER THE COMMAND IS EXECUTED, CONTROL IS +; TRANSFERED TO OTHERS SECTIONS AS FOLLOWS: +; +; FOR 'LIST', 'NEW', AND 'STOP': GO BACK TO 'RSTART' +; FOR 'RUN': GO EXECUTE THE FIRST STORED LINE IF ANY, ELSE +; GO BACK TO 'RSTART'. +; FOR 'GOTO' AND 'GOSUB': GO EXECUTE THE TARGET LINE. +; FOR 'RETURN' AND 'NEXT': GO BACK TO SAVED RETURN LINE. +; FOR ALL OTHERS: IF 'CURRENT' -> 0, GO TO 'RSTART', ELSE +; GO EXECUTE NEXT COMMAND. (THIS IS DONE IN 'FINISH'.) +;************************************************************* +; +; *** NEW *** CLEAR *** STOP *** RUN (& FRIENDS) *** GOTO *** +; +; 'NEW(CR)' SETS 'TXTUNF' TO POINT TO 'TXTBGN' +; +; 'CLEAR(CR)' CLEARS ALL VARIABLES +; +; 'END(CR)' GOES BACK TO 'RSTART' +; +; 'RUN(CR)' FINDS THE FIRST STORED LINE, STORE ITS ADDRESS (IN +; 'CURRENT'), AND START EXECUTE IT. NOTE THAT ONLY THOSE +; COMMANDS IN TAB2 ARE LEGAL FOR STORED PROGRAM. +; +; THERE ARE 3 MORE ENTRIES IN 'RUN': +; 'RUNNXL' FINDS NEXT LINE, STORES ITS ADDR. AND EXECUTES IT. +; 'RUNTSL' STORES THE ADDRESS OF THIS LINE AND EXECUTES IT. +; 'RUNSML' CONTINUES THE EXECUTION ON SAME LINE. +; +; 'GOTO EXPR(CR)' EVALUATES THE EXPRESSION, FIND THE TARGET +; LINE, AND JUMP TO 'RUNTSL' TO DO IT. +;************************************************************* +new: + call endchk ; ** New ** + ld hl,textbegin + ld (textunfilled),hl +clear: + call clrvars ; ** Clear ** + jp rstart +endd: + call endchk ; ** End ** + jp rstart +run: + call endchk ; ** Run ** + call rstreadptr + ld de,textbegin +runnxl: + ld hl,0h ; ** Run Next Line ** + call findlineptr + jp c,rstart +runtsl: + ex de,hl ; ** Run Tsl + ld (current),hl ; set current -> line # + ex de,hl + inc de + inc de +runsml: + call chkio ; ** Run Same Line ** + ld hl, tab2-1 ; find the command in table 2 + jp exec ; and execute it +goto: + call expr + push de ; save for error routine + call endchk ; must find a cr + call findline ; find the target line + jp nz, ahow ; no such line # + pop af ; clear the pushed de + jr runtsl ; go do it + +;************************************************************* +; +; *** LIST *** & PRINT *** +; +; LIST HAS TWO FORMS: +; 'LIST(CR)' LISTS ALL SAVED LINES +; 'LIST #(CR)' START LIST AT THIS LINE # +; YOU CAN STOP THE LISTING BY CONTROL C KEY +; +; PRINT COMMAND IS 'PRINT ....;' OR 'PRINT ....(CR)' +; WHERE '....' IS A LIST OF EXPRESIONS, FORMATS, BACK- +; ARROWS, AND STRINGS. THESE ITEMS ARE SEPERATED BY COMMAS. +; +; A FORMAT IS A POUND SIGN FOLLOWED BY A NUMBER. IT CONTROLS +; THE NUMBER OF SPACES THE VALUE OF A EXPRESION IS GOING TO +; BE PRINTED. IT STAYS EFFECTIVE FOR THE REST OF THE PRINT +; COMMAND UNLESS CHANGED BY ANOTHER FORMAT. IF NO FORMAT IS +; SPECIFIED, 6 POSITIONS WILL BE USED. +; +; A STRING IS QUOTED IN A PAIR OF SINGLE QUOTES OR A PAIR OF +; DOUBLE QUOTES. +; +; A BACK-ARROW MEANS GENERATE A (CR) WITHOUT (LF) +; +; A (CRLF) IS GENERATED AFTER THE ENTIRE LIST HAS BEEN +; PRINTED OR IF THE LIST IS A NULL LIST. HOWEVER IF THE LIST +; ENDED WITH A COMMA, NO (CRLF) IS GENERATED. +;************************************************************* +list: + call testnum ; check if there is a number + call endchk ; if no number we get a 0 + call findline ; find this or next line +ls1: + jp c,rstart + call printline ; print the line + call chkio ; stop on ctrl-c + call findlineptr ; find the next line + jr ls1 ; and loop back + +print: + ld c,6 ; c = number of spaces + call testc ; is it a semicolon? + .db ';' + .db pr2-$-1 + call crlf + jr runsml +pr2: + call testc ; is it a cr? + .db cr + .db pr0-$-1 + call crlf + jr runnxl +pr0: + call testc ; is it format? + .db '#' + .db pr1-$-1 + call expr + ld c,l + jr pr3 +pr1: + call testc ; is it a dollar? + .db '$' + .db pr4-$-1 + call expr + ld c,l + call testc ; do we have a comma? + .db ',' + .db pr6-$-1 + push bc + call expr + pop bc + ld a,8 ; 8 bits? + cp c + jp nz,pr9 ; no, try 16 + call printhex8 ; yes, print a single hex byte + jp pr3 +pr9: + ld a,10h ; 16 bits? + cp c + jp nz,qhow ; no, show error message + call printhex ; yes, print two hex bytes + jp pr3 +pr4: + call qtstg ; is it a string? + jp pr8 +pr3: + call testc ; is it a comma? + .db ',' + .db pr6-$-1 + call fin + jr pr0 +pr6: + call crlf ; list ends + call finish +pr8: + call expr ; evaluate the expression + push bc + call printnum + pop bc + jr pr3 + +;************************************************************* +; +; *** GOSUB *** & RETURN *** +; +; 'GOSUB EXPR;' OR 'GOSUB EXPR (CR)' IS LIKE THE 'GOTO' +; COMMAND, EXCEPT THAT THE CURRENT TEXT POINTER, STACK POINTER +; ETC. ARE SAVE SO THAT EXECUTION CAN BE CONTINUED AFTER THE +; SUBROUTINE 'RETURN'. IN ORDER THAT 'GOSUB' CAN BE NESTED +; (AND EVEN RECURSIVE), THE SAVE AREA MUST BE STACKED. +; THE STACK POINTER IS SAVED IN 'STKGOS', THE OLD 'STKGOS' IS +; SAVED IN THE STACK. IF WE ARE IN THE MAIN ROUTINE, 'STKGOS' +; IS ZERO (THIS WAS DONE BY THE "MAIN" SECTION OF THE CODE), +; BUT WE STILL SAVE IT AS A FLAG FOR NO FURTHER 'RETURN'S. +; +; 'RETURN(CR)' UNDOS EVERYTHING THAT 'GOSUB' DID, AND THUS +; RETURN THE EXECUTION TO THE COMMAND AFTER THE MOST RECENT +; 'GOSUB'. IF 'STKGOS' IS ZERO, IT INDICATES THAT WE +; NEVER HAD A 'GOSUB' AND IS THUS AN ERROR. +;************************************************************* +gosub: + call pusha ; ** Gosub ** + call expr ; save the current "FOR" params + push de ; and text pointer + call findline ; find the target line + jp nz,ahow ; how? because it doesn't exist + ld hl,(current) ; found it, save old 'current' + push hl + ld hl,(stkgos) ; and 'stkgos' + push hl + ld hl,0 ; and load new ones + ld (loopvar),hl + add hl,sp + ld (stkgos),hl + jp runtsl ; and run the line +return: + call endchk ; there must be a cr + ld hl,(stkgos) ; check old stack pointer + ld a,h ; + or l + jp z,what ; what? not found + ld sp,hl ; otherwise restore it + pop hl + ld (stkgos),hl + pop hl + ld (current),hl ; and old 'current' + pop de ; and old text pointer + call popa ; and old 'FOR' params + call finish ; and we're back + +;************************************************************* +; +; *** FOR *** & NEXT *** +; +; 'FOR' HAS TWO FORMS: +; 'FOR VAR=EXP1 TO EXP2 STEP EXP3' AND 'FOR VAR=EXP1 TO EXP2' +; THE SECOND FORM MEANS THE SAME THING AS THE FIRST FORM WITH +; EXP3=1. (I.E., WITH A STEP OF +1.) +; TBI WILL FIND THE VARIABLE VAR, AND SET ITS VALUE TO THE +; CURRENT VALUE OF EXP1. IT ALSO EVALUATES EXP2 AND EXP3 +; AND SAVE ALL THESE TOGETHER WITH THE TEXT POINTER ETC. IN +; THE 'FOR' SAVE AREA, WHICH CONSISTS OF 'LOPVAR', 'LOPINC', +; 'LOPLMT', 'LOPLN', AND 'LOPPT'. IF THERE IS ALREADY SOME- +; THING IN THE SAVE AREA (THIS IS INDICATED BY A NON-ZERO +; 'LOPVAR'), THEN THE OLD SAVE AREA IS SAVED IN THE STACK +; BEFORE THE NEW ONE OVERWRITES IT. +; TBI WILL THEN DIG IN THE STACK AND FIND OUT IF THIS SAME +; VARIABLE WAS USED IN ANOTHER CURRENTLY ACTIVE 'FOR' LOOP. +; IF THAT IS THE CASE, THEN THE OLD 'FOR' LOOP IS DEACTIVATED. +; (PURGED FROM THE STACK..) +; +; 'NEXT VAR' SERVES AS THE LOGICAL (NOT NECESSARILLY PHYSICAL) +; END OF THE 'FOR' LOOP. THE CONTROL VARIABLE VAR. IS CHECKED +; WITH THE 'LOPVAR'. IF THEY ARE NOT THE SAME, TBI DIGS IN +; THE STACK TO FIND THE RIGHT ONE AND PURGES ALL THOSE THAT +; DID NOT MATCH. EITHER WAY, TBI THEN ADDS THE 'STEP' TO +; THAT VARIABLE AND CHECK THE RESULT WITH THE LIMIT. IF IT +; IS WITHIN THE LIMIT, CONTROL LOOPS BACK TO THE COMMAND +; FOLLOWING THE 'FOR'. IF OUTSIDE THE LIMIT, THE SAVE AREA +; IS PURGED AND EXECUTION CONTINUES. +;************************************************************* + +for: + call pusha ; save old save area + call setval ; set the control variable + dec hl ; its address is hl + ld (loopvar),hl ; save that + ld hl,tab5-1 ; use 'exec' to find 'TO' + jp exec +fr1: + call expr ; evaluate the limit + ld (looplmt),hl ; and save it + ld hl,tab6-1 ; use 'exec' to find 'STEP' + jp exec +fr2: + call expr ; found 'STEP' + jr fr4 +fr3: + ld hl,0001h ; no 'STEP' so set to 1 +fr4: + ld (loopinc),hl ; and save that too +fr5: + ld hl,(current) ; save current line number + ld (loopln),hl + ex de,hl ; and text pointer + ld (loopptr),hl + ld bc,0ah ; dig into stack to find loopvar + ld hl,(loopvar) + ex de,hl + ld h,b + ld l,b + add hl,sp + .db 3eh +fr7: + add hl,bc + ld a,(hl) + inc hl + or (hl) + jr z,fr8 + ld a,(hl) + dec hl + cp d + jr nz,fr7 + ld a,(hl) + cp e + jr nz,fr7 + ex de,hl + ld hl,0 + add hl,sp + ld b,h + ld c,l + ld hl,0ah + add hl,de + call mvdown + ld sp,hl +fr8: + ld hl,(loopptr) ; all done + ex de,hl + call finish +next: + call testvar ; get address of variable + jp c,qwhat ; what, no variable + ld (varnext),hl ; yes, save it +nx0: + push de ; save the text pointer + ex de,hl + ld hl,(loopvar) ; get the variable in 'FOR' + ld a,h + or l ; if 0, there never was one + jp z,awhat + call comp ; else check them + jr z,nx3 ; yes, they agree + pop de ; no, complete current loop + call popa + ld hl,(varnext) ; and pop one level + jr nx0 ; go check again +nx3: + ld e,(hl) + inc hl + ld d,(hl) ; de = value of variable + ld hl,(loopinc) + push hl + ld a,h + xor d + ld a,d + add hl,de + jp m,nx4 + xor h + jp m,nx5 +nx4: + ex de,hl + ld hl,(loopvar) + ld (hl),e + inc hl + ld (hl),d + ld hl,(looplmt) + pop af + or a + jp p,nx1 ; step > 0 + ex de,hl ; step < 0 +nx1: + call ckhlde ; compare with limit + pop de ; restore the text pointer + jr c,nx2 ; over the limit + ld hl,(loopln) ; within the limit + ld (current),hl + ld hl,(loopptr) + ex de,hl + call finish +nx5: + pop hl + pop de +nx2: + call popa ; purge this loop + call finish ; + +init: + ld hl,start ; initialise random pointer + ld (rndptr),hl + ld hl,usrfunc ; initialise usr func pointer + ld (usrptr),hl + ld a,0c9h ; initialise usr func (RET) + ld (usrfunc),a + ld hl,textbegin ; initialise text area pointers + ld (textunfilled),hl + ld (ocsw),a ; enable output control switch + call clrvars ; clear variables + call crlf + ld de,welcome ; output welcome message + call printstr + call crlf + call size ; output free size message + call printnum + ld de,free + call printstr + jp rstart + + +;************************************************************* + +#ifdef ROMWBW +#include "romwbwio.asm" +#endif + +#ifdef CPM +#include "cpmio.asm" +#endif + +#ifndef PLATFORM +#include "zemuio.asm" +#endif + +;************************************************************* +chkio: + call haschar ; check if character available + ret z ; no, return +#ifndef CPM + call getchar ; get the character +#endif + push bc ; is it a lf? + ld b,a + sub lf + jr z,io1 ; yes, ignore a return + ld a,b ; no, restore a and bc + pop bc + cp ctrlo ; is it ctrl-o? + jr nz,io2 ; no, done + ld a,(ocsw) ; toggle output control switch + cpl + ld (ocsw),a + jr chkio ; get next character +io1: + ld a,0h ; clear + or a ; set the z-flag + pop bc ; restore bc + ret ; return with z set +io2: + cp 60h ; is it lower case? + jp c,io3 ; no + and 0dfh ; yes, make upper case +io3: + cp ctrlc ; is it ctrl-c? + ret nz ; no + jp rstart ; yes, restart tasty basic +crlf: + ld a,cr +outc: + push af + ld a,(ocsw) ; check output control switch + or a + jr nz,oc1 ; output is enabled + pop af ; output is disabled + ret ; so return +oc1: + pop af + call putchar + cp cr ; was it a cr? + ret nz ; no, return + ld a,lf ; send a lf + call outc + ld a,cr ; restore register + ret ; and return + +;************************************************************* +; +; *** TABLES *** DIRECT *** & EXEC *** +; +; THIS SECTION OF THE CODE TESTS A STRING AGAINST A TABLE. +; WHEN A MATCH IS FOUND, CONTROL IS TRANSFERED TO THE SECTION +; OF CODE ACCORDING TO THE TABLE. +; +; AT 'EXEC', DE SHOULD POINT TO THE STRING AND HL SHOULD POINT +; TO THE TABLE-1. AT 'DIRECT', DE SHOULD POINT TO THE STRING. +; HL WILL BE SET UP TO POINT TO TAB1-1, WHICH IS THE TABLE OF +; ALL DIRECT AND STATEMENT COMMANDS. +; +; A '.' IN THE STRING WILL TERMINATE THE TEST AND THE PARTIAL +; MATCH WILL BE CONSIDERED AS A MATCH. E.G., 'P.', 'PR.', +; 'PRI.', 'PRIN.', OR 'PRINT' WILL ALL MATCH 'PRINT'. +; +; THE TABLE CONSISTS OF ANY NUMBER OF ITEMS. EACH ITEM +; IS A STRING OF CHARACTERS WITH BIT 7 SET TO 0 AND +; A JUMP ADDRESS STORED HI-LOW WITH BIT 7 OF THE HIGH +; BYTE SET TO 1. +; +; END OF TABLE IS AN ITEM WITH A JUMP ADDRESS ONLY. IF THE +; STRING DOES NOT MATCH ANY OF THE OTHER ITEMS, IT WILL +; MATCH THIS NULL ITEM AS DEFAULT. +;************************************************************* +tab1: ; direct commands + .db "LIST" + dwa(list) + .db "RUN" + dwa(run) + .db "NEW" + dwa(new) + .db "CLEAR" + dwa(clear) +#ifdef PLATFORM + .db "BYE" + dwa(bye) +#endif +tab2: ; direct/statements + .db "NEXT" + dwa(next) + .db "LET" + dwa(let) + .db "IF" + dwa(iff) + .db "GOTO" + dwa(goto) + .db "GOSUB" + dwa(gosub) + .db "RETURN" + dwa(return) + .db "REM" + dwa(rem) + .db "FOR" + dwa(for) + .db "INPUT" + dwa(input) + .db "PRINT" + dwa(print) + .db "POKE" + dwa(poke) + .db "OUT" + dwa(outp) +#ifdef CPM + .db "LOAD" + dwa(load) + .db "SAVE" + dwa(save) +#endif +datastmt: + .db "DATA" + dwa(data) + .db "READ" + dwa(read) + .db "RESTORE" + dwa(restore) + .db "END" + dwa(endd) + dwa(deflt) +tab4: ; functions + .db "PEEK" + dwa(peek) + .db "IN" + dwa(inp) + .db "RND" + dwa(rnd) + .db "ABS" + dwa(abs) + .db "USR" + dwa(usrexec) + .db "SIZE" + dwa(size) + dwa(xp40) +tab5: ; 'TO' in 'FOR' + .db "TO" + dwa(fr1) +tab6: ; 'STEP' in 'FOR' + .db "STEP" + dwa(fr2) + dwa(fr3) +tab8: ; relational operators + .db ">=" + dwa(xp11) + .db "#" + dwa(xp12) + .db ">" + dwa(xp13) + .db "=" + dwa(xp15) + .db "<=" + dwa(xp14) + .db "<" + dwa(xp16) + dwa(xp17) + +direct: + ld hl,tab1-1 ; ** Direct ** +exec: + call skipspace ; ** Exec ** + push de +ex1: + ld a,(de) + inc de + cp '.' + jr z,ex3 + inc hl + cp (hl) + jr z,ex1 + ld a,7fh + dec de + cp (hl) + jr c,ex5 +ex2: + inc hl + cp (hl) + jr nc,ex2 + inc hl + pop de + jr exec +ex3: + ld a,7fh +ex4: + inc hl + cp (hl) + jr nc,ex4 +ex5: + ld a,(hl) + inc hl + ld l,(hl) + and 7fh + ld h,a + pop af + jp (hl) + +;------------------------------------------------------------------------------- + +LST_ROM: ; all the above _can_ be in rom + ; all following *must* be in ram +padding .equ (TBC_LOC + USRPTR_OFFSET - $) + .echo "TASTYBASIC ROM padding: " + .echo padding + .echo " bytes.\n" + .org TBC_LOC + USRPTR_OFFSET +usrptr .ds 2 ; -> user defined function area +usrfunc .equ $ ; start of user defined function area + .org TBC_LOC + INTERNAL_OFFSET ; start of state +ocsw .ds 1 ; output control switch +current .ds 2 ; points to current line +stkgos .ds 2 ; saves sp in 'GOSUB' +varnext .ds 2 ; temp storage +stkinp .ds 2 ; save sp in 'INPUT' +loopvar .ds 2 ; 'FOR' loop save area +loopinc .ds 2 ; loop increment +looplmt .ds 2 ; loop limit +loopln .ds 2 ; loop line number +loopptr .ds 2 ; loop text pointer +rndptr .ds 2 ; random number pointer +readptr .ds 2 ; read pointer +textunfilled .ds 2 ; -> unfilled text area +textbegin .ds 2 ; start of text save area + .org TBC_LOC + TEXTEND_OFFSET +textend .ds 0 ; end of text area +varbegin .ds 55 ; variable @(0) +varend .equ $ ; end of variable area +buffer .ds 72 ; input buffer +bufend .ds 1 +stacklimit .equ $ + .org TBC_LOC + STACK_OFFSET +stack .equ $ + +#ifdef ROMWBW +slack .equ (TBC_END - LST_ROM) + .fill slack,'t' + + .echo "TASTYBASIC space remaining: " + .echo slack + .echo " bytes.\n" +#endif + .end diff --git a/Source/TastyBasic/src/zemuio.asm b/Source/TastyBasic/src/zemuio.asm new file mode 100644 index 00000000..d4acb063 --- /dev/null +++ b/Source/TastyBasic/src/zemuio.asm @@ -0,0 +1,54 @@ + +; ----------------------------------------------------------------------------- +; Copyright 2021 Dimitri Theulings +; +; This file is part of Tasty Basic. +; +; Tasty Basic 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. +; +; Tasty Basic 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 Tasty Basic. If not, see . +; ----------------------------------------------------------------------------- +; Tasty Basic is derived from earlier works by Li-Chen Wang, Peter Rauskolb, +; and Doug Gabbard. Refer to the source code repository for details +; . +; ----------------------------------------------------------------------------- + +USRPTR_OFFSET .equ 09feh +INTERNAL_OFFSET .equ 0c00h +TEXTEND_OFFSET .equ 07dffh +STACK_OFFSET .equ 07fffh + +tty_data .equ 7ch +tty_status .equ 7dh +rx_full .equ 1 +tx_empty .equ 0 + +putchar: + call uart_tx_ready ; see if transmit is available + out (tty_data),a ; and send it + ret +uart_tx_ready: + push af +uart_tx_ready_loop: + in a,(tty_status) + bit tx_empty,a + jp z,uart_tx_ready_loop + pop af + ret +haschar: + in a,(tty_status) ; check if character available + bit rx_full,a + ret + +getchar: + in a,(tty_data) ; get the character + ret diff --git a/Source/UBIOS/ubios.inc b/Source/UBIOS/ubios.inc index 546c671d..58684c02 100644 --- a/Source/UBIOS/ubios.inc +++ b/Source/UBIOS/ubios.inc @@ -11,27 +11,17 @@ BF_CIOOST .EQU BF_CIO + 4 ; CHARACTER OUTPUT STATUS BF_DIO .EQU $40 BF_DIOREAD .EQU BF_DIO + 2 ; DISK READ BF_DIOWRITE .EQU BF_DIO + 3 ; DISK WRITE -;; -;; MEMORY BANK CONFIGURATION -;; -;ROMSIZE .EQU 512 -;RAMSIZE .EQU 512 ; -;BID_ROM0 .EQU $0000 -;BID_ROMN .EQU (BID_ROM0 + ((ROMSIZE / 32) - 1)) -;BID_RAM0 .EQU $8000 -;BID_RAMN .EQU (BID_RAM0 + ((RAMSIZE / 32) - 1)) +; MEDIA ID VALUES ; -;BID_BOOT .EQU BID_ROM0 ; BOOT BANK -;BID_BIOSIMG .EQU BID_ROM0 + 1 ; BIOS IMAGE BANK -;BID_OSIMG .EQU BID_ROM0 + 2 ; ROM LOADER AND IMAGES BANK -;BID_FSFAT .EQU BID_ROM0 + 3 ; FAT FILESYSTEM DRIVER BANK -;BID_ROMD0 .EQU BID_ROM0 + 4 ; FIRST ROM DRIVE BANK -;BID_ROMDN .EQU BID_ROMN ; LAST ROM DRIVE BANK -; -;BID_RAMD0 .EQU BID_RAM0 ; FIRST RAM DRIVE BANK -;BID_RAMDN .EQU BID_RAMN - 4 ; LAST RAM DRIVE BANK -;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 +MID_NONE .EQU 0 +MID_MDROM .EQU 1 +MID_MDRAM .EQU 2 +MID_RF .EQU 3 +MID_HD .EQU 4 +MID_FD720 .EQU 5 +MID_FD144 .EQU 6 +MID_FD360 .EQU 7 +MID_FD120 .EQU 8 +MID_FD111 .EQU 9 +MID_HDNEW .EQU 10 diff --git a/Source/ZCPR-DJ/Build.cmd b/Source/ZCPR-DJ/Build.cmd index b9842ca4..ae7fdaa5 100644 --- a/Source/ZCPR-DJ/Build.cmd +++ b/Source/ZCPR-DJ/Build.cmd @@ -3,13 +3,14 @@ setlocal set TOOLS=../../Tools -set PATH=%TOOLS%\tasm32;%TOOLS%\zx;%PATH% +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%PATH% set TASMTABS=%TOOLS%\tasm32 -set ZXBINDIR=%TOOLS%/cpm/bin/ -set ZXLIBDIR=%TOOLS%/cpm/lib/ -set ZXINCDIR=%TOOLS%/cpm/include/ +set CPMDIR80=%TOOLS%/cpm/ -zx M80 -=zcpr -zx L80 -zcpr,zcpr.bin/n/e \ No newline at end of file +zxcc M80 -=zcpr/l || exit /b +zxcc L80 -zcpr,zcpr.bin/n/e || exit /b + +zxcc M80 -=zcprdemo/l || exit /b +zxcc L80 -zcprdemo,zcprdemo/n/e || exit /b \ No newline at end of file diff --git a/Source/ZCPR-DJ/Clean.cmd b/Source/ZCPR-DJ/Clean.cmd index 53fa501a..cf21950d 100644 --- a/Source/ZCPR-DJ/Clean.cmd +++ b/Source/ZCPR-DJ/Clean.cmd @@ -4,3 +4,5 @@ setlocal if exist *.bin del *.bin if exist *.lst del *.lst if exist *.rel del *.rel +if exist *.prn del *.prn +if exist *.com del *.com diff --git a/Source/ZCPR-DJ/Makefile b/Source/ZCPR-DJ/Makefile index 47584a38..c9b94041 100644 --- a/Source/ZCPR-DJ/Makefile +++ b/Source/ZCPR-DJ/Makefile @@ -1,10 +1,13 @@ -OBJECTS= zcpr.bin +OBJECTS= zcpr.bin zcprdemo.com -OTHERS = zcpr.rel +OTHERS = *.rel TOOLS = ../../Tools include $(TOOLS)/Makefile.inc zcpr.bin: zcpr.rel - $(ZXCC) $(TOOLS)/cpm/bin/L80 -zcpr,zcpr.bin/n/e + $(ZXCC) L80 -zcpr,zcpr.bin/n/e + +zcprdemo.com: zcprdemo.rel + $(ZXCC) L80 -zcprdemo,zcprdemo/n/e diff --git a/Source/ZCPR-DJ/zcpr.mac b/Source/ZCPR-DJ/zcpr.mac index 11709ab6..19f66588 100644 --- a/Source/ZCPR-DJ/zcpr.mac +++ b/Source/ZCPR-DJ/zcpr.mac @@ -1,6 +1,8 @@ - TITLE ZCPR Console Command Processor - Version D&J - SUBTTL Last Modified: 5 March 1994 +; DATE 06/02/21 08:08:00 ; +; TITLE ZCPR Console Command Processor - Version D&J +; SUBTTL Last Modified: 10 August 1997 + ; CP/M Z80 Command Processor Replacement (CPR) Version 1.0 ; CCPZ CREATED AND CUSTOMIZED FOR ARIES-II BY RLC ; FURTHER MODIFIED BY RGF AS V2.0 @@ -66,6 +68,13 @@ ; ; Added PEEK 30 August 1993. ; +; Added CLS 10 August 1997 and fixed two bugs. One caused the system to +; hang if the command to log into another drive was given while logged +; into a drive from which the disk had been removed. The other caused +; a warm boot to return to the prior user area if the new user number +; had been selected using the USER command (although not if the user area +; had been changed using the du: command). +; ;******** Structure Notes ******** ; ; This CPR is divided into a number of major sections. The following @@ -86,39 +95,40 @@ ; ; 3 Utilities ; CRLF PRINTC PRINT PRINTS BELL -; CONOUT BREAK CHKETX ABORT READF -; READ WRITE DEFDMA DMASET SEARF -; SEARDE SEARN OPENF OPEN CLOSE -; CREATE BDOSFN SUBKIL DELETE TLOGIN -; DLOGIN LOGIN NEWUSR RSTUSR SETUSR -; BDOSEA BDOSJP BDOSBC BDOSDE +; CLS CONOUT BREAK CHKETX ABORT +; READF READ WRITE DEFDMA DMASET +; SEARF SEARDE SEARN OPENF OPEN +; CLOSE CREATE BDOSFN SUBKIL DELETE +; TLOGIN DLOGIN LOGIN NEWUSR RSTUSR +; SETUSR BDOSEA BDOSJP BDOSBC BDOSDE ; ; 4 CPR Utilities ; PROMPT REDBUF CNVBUF UCASE SDELM ; ADVAN SBLANK ADDAH NUMBER A2NUM ; HEXNUM USRNUM ERROR DIRPTR ULOGIN -; SCANER SCANT SCANF CMDSER SETUDB +; SCANER SCANT SCANF CMDSER ; ; 5 CPR-Resident Commands and Functions ; 5A DIR DIRPR PRFN ; 5B ERA ; 5C ERAQ PRNNF ; 5D SAK REPLY -; 5E BELL -; 5F LIST -; 5G TYPE PAGER -; 5H EJECT -; 5I SAVE -; 5J REN -; 5K USER SUSER -; 5L DFU -; 5M SCL -; 5N PEEK -; 5O POKE -; 5P JUMP -; 5Q COM -; 5R GO CLLPRG ERRLOG ERRJMP -; 5S GET MEMLD PRNLE +; 5E CLS +; 5F BELL +; 5G LIST +; 5H TYPE PAGER +; 5I EJECT +; 5J SAVE +; 5K REN +; 5L USER SUSER +; 5M DFU +; 5N SCL +; 5O PEEK +; 5P POKE +; 5Q JUMP +; 5R COM UPDATE +; 5S GO CLLPRG ERRLOG ERRJMP +; 5T GET MEMLD PRNLE ; BIOS BOOT ; ; @@ -148,8 +158,8 @@ REL EQU FALSE ;SET TO TRUE FOR MOVCPM INTEGRATION ;LEAVE ALL FALSE FOR SYSGEN IMAGE ; BASE EQU 0 ;BASE OF CP/M SYSTEM -;P2DOS EQU 0E400H ;BASE OF BDOS/P2DOS -P2DOS EQU 0D800H ;BASE OF BDOS/P2DOS +;P2DOS EQU 0E400H ;BASE OF BDOS/P2DOS (original) +P2DOS EQU 0D800H ;BASE OF BDOS/P2DOS (Retro-Brew) ZCPRSZ EQU 00800H ;SIZE OF ZCPR P2DOSSZ EQU 00E00H ;SIZE OF P2DOS BIOS EQU P2DOS+P2DOSSZ ;BASE OF BIOS @@ -244,7 +254,7 @@ SOFLG EQU 'S' ;LIST $SYS ONLY ; ; List and Type command customization equates ; -NLINES EQU 20 ;NUMBER OF LINES ON CRT PAGE +NLINES EQU 22 ;NUMBER OF LINES ON CRT PAGE NLINEP EQU 60 ;NUMBER OF LINES ON LIST DEVICE FFKILL EQU TRUE ;TRUE SUPPRESSES FF UNTIL FIRST CHARACTER PGDFLG EQU 'P' ;TYPE AND LIST COMMAND DEFAULT TOGGLE @@ -255,14 +265,17 @@ NOSTAT EQU FALSE ;SET TO TRUE IF BIOS LISTST NOT IMPLEMENTED BUFLEN EQU 80 ;SIZE OF COMMAND INPUT BUFFER MAXUSR EQU 15 ;MAXIMUM USER NUMBER ACCESSIBLE DEFUSR EQU 0 ;DEFAULT USER NUMBER FOR COM FILES +DEFDRV EQU 'A' ;DEFAULT DRIVE FOR COM FILES SPRMPT EQU '$' ;CPR PROMPT INDICATING SUBMIT COMMAND -COMCHR EQU ';' ;BEGIN COMMENT CHARACTER +COMCHR EQU '%' ;BEGIN COMMENT CHARACTER CMDCHR EQU ';' ;BEGIN NEXT COMMAND CHARACTER NUMBASE EQU 'H' ;CHARACTER USED TO SPECIFY HEXIDECIMAL BASE RECFLG EQU 'R' ;CHARACTER FOR SAVE COMMAND TO SAVE RECORDS SUPRES EQU TRUE ;TRUE TO SUPPRESS USER NUMBER FOR USER 0 MULTPL EQU TRUE ;TRUE TO ALLOW MULTIPLE COMMANDS ON ONE LINE REBOOT EQU TRUE ;TRUE TO INCLUDE BOOT COMMAND +CLSCHR EQU 1AH ;CHARACTER TO CLEAR TERMINAL SCREEN +ESC EQU 1BH ;VT100 LEAD-IN CHAR. (FOR 'CLS') ; IF TEST CPRMPT EQU '<' ;CPR PROMPT INDICATING TEST MODE @@ -300,7 +313,7 @@ TPA EQU BASE+0100H ;BASE OF TPA IF COMLD OR TEST LD HL,BGNXFR LD DE,CPRLOC - LD BC,ENDLD-CPRLOC + LD BC,ENDLD-BGNXFR LDIR LD BC,(UDFLAG) JP CPRLOC @@ -369,15 +382,29 @@ ENTRY: ; warm boot reloads ZCPR and destroys the contents of the command buffer. ; The multiple command feature may be turned off with the SCL command. ; -MBUFF: DEFB BUFLEN ;MAXIMUM BUFFER LENGTH +;MBUFF: DEFB BUFLEN ;MAXIMUM BUFFER LENGTH +MBUFF: DEFB BUFEND-CIBUFF ;MAXIMUM BUFFER LENGTH CBUFF: DEFB 0 ;NUMBER OF CHARACTERS IN COMMAND LINE -CIBUFF: DEFB ' ' ;DEFAULT (COLD BOOT) COMMAND - DEFB 0 ;COMMAND STRING TERMINATOR - DEFB ' ZCPR-D&J of 5 March 1994 ' - DEFB 0 ;TERMINATOR FOR DUMP IDENTIFICATION - DEFS BUFLEN-($-CIBUFF)+1 - DEFW 0 ;SENTINEL FOR STACK END - DEFS 24 ;STACK AREA +CIBUFF: DB ' ' ;DEFAULT (COLD BOOT) COMMAND 13 + DEFB 0 ;COMMAND STRING TERMINATOR 14 + DEFB ' ZCPR-D&J of 17 May 2021 ' ;44 + DEFB 0 ;TERMINATOR FOR DUMP IDENTIFICATION 45 +; DEFS BUFLEN-($-CIBUFF)+1 + db 0,0,0,0,0,0,0,0 ;53 + db 0,0,0,0,0,0,0,0 ;61 + db 0,0,0,0,0,0,0,0 ;69 + db 0,0,0,0,0,0,0,0 ;77 + db 0,0,0,0,0,0,0,0 ;85 + db 0,0,0,0,0,0,0,0 ;93 + db 0,0,0 ;96 +; DEFB 0,0,0,0,0,0,0,0 ;101 +; DEFB 0,0,0 ;104 +; DEFB 0,0,0,0,0,0,0,0 ;109 +; DEFB 0,0,0,0,0,0,0,0 ;118 +BUFEND EQU $ +; DEFW 0 ;SENTINEL FOR STACK END + db 0,0 + DEFS 24,0 ;STACK AREA STACK EQU $ ;TOP OF STACK ; ; SUBMIT FILE CONTROL BLOCK @@ -394,22 +421,23 @@ SUBCR EQU SUBDN+32 ;CURRENT RECORD NUMBER ; ; COMMAND FILE CONTROL BLOCK ; -FCBDN: DEFS 1 ;DISK DRIVE -FCBFN: DEFS 8 ;FILE NAME -FCBFT: DEFS 3 ;FILE TYPE -FCBEX: DEFS 1 ;EXTENT NUMBER -FCBS1: DEFS 1 ;S1 -FCBS2: DEFS 1 ;S2 -FCBRC: DEFS 1 ;RECORD COUNT -FCBDM: DEFS 16 ;DISK GROUP MAP -FCBCR: DEFS 1 ;CURRENT RECORD NUMBER +FCBDN: db 0 ;DISK DRIVE +FCBFN: db 0,0,0,0,0,0,0,0 ;FILE NAME +FCBFT: db 0,0,0 ;FILE TYPE +FCBEX: db 0 ;EXTENT NUMBER +FCBS1: db 0 ;S1 +FCBS2: db 0 ;S2 +FCBRC: db 0 ;RECORD COUNT +FCBDM: db 0,0,0,0,0,0,0,0 ;DISK GROUP MAP + db 0,0,0,0,0,0,0,0 +FCBCR: db 0 ;CURRENT RECORD NUMBER ; ; Type and List Variables ; -CHRCNT: DEFS 1 ;CHARACTER COUNT FOR TYPE AND LIST -LNCNT: DEFS 1 ;LINE COUNT FOR TYPE AND LIST -TYPLST: DEFS 1 ;FLAG FOR TYPE OR LIST -TABCNT: DEFS 1 ;TAB COUNT FOR TYPE AND LIST +CHRCNT: db 0 ;CHARACTER COUNT FOR TYPE AND LIST +LNCNT: db 0 ;LINE COUNT FOR TYPE AND LIST +TYPLST: db 0 ;FLAG FOR TYPE OR LIST +TABCNT: db 0 ;TAB COUNT FOR TYPE AND LIST SYSTST: DEFB 0 ;LIST SYSTEM FILES IN DIRECTORY FLAG ; ; General Variables @@ -417,7 +445,7 @@ SYSTST: DEFB 0 ;LIST SYSTEM FILES IN DIRECTORY FLAG CIBPTR: DEFW CIBUFF ;POINTER TO COMMAND INPUT BUFFER CIPTR: DEFW CIBUFF ;POINTER TO CURRENT CMD FOR ERROR REPORTING TMPUSR: DEFB 0 ;TEMPORARY USER NUMBER -TDRIVE: DEFB 0 ;DEFAULT DRIVE +TDRIVE: DEFB 0 ;TEMPORARY DRIVE DFUSR: DEFB DEFUSR ;DEFAULT USER LDADR: DEFW TPA ;MEMORY LOAD ADDRESS ; @@ -435,11 +463,13 @@ CMDTBL: DEFW USER DC 'DFU' DEFW DFU - DC 'PAGE' + DC 'FF' ; was 'PAGE' DEFW EJECT DC 'BELL' DEFW RING - DC 'SAK' + DC 'CLS' + DEFW CLS + DC 'SAK' ; "Strike Any Key" DEFW SAK DC 'GO' DEFW GO @@ -459,7 +489,7 @@ CMDTBL: DEFW PEEK DC 'POKE' DEFW POKE -NCMNDS DEFL 17 ;NUMBER OF COMMANDS +NCMNDS DEFL 18 ;NUMBER OF COMMANDS ; IF MULTPL DC 'SCL' @@ -516,14 +546,11 @@ RS3: JR Z,RESTRT ;YES, SKIP REST OF LINE CALL SCANER ;PARSE COMMAND NAME FROM COMMAND LINE JR NZ,RS4 ;ERROR IF NAME CONTAINS A "?" - CALL DEFDMA ;SET TBUFF TO DMA ADDRESS - CALL DLOGIN ;ASSURE PROPER DRIVE - CALL RSTUSR ;ASSURE PROPER USER NUMBER - CALL SETUDB ;SET UD BYTE TO MATCH USER/DRIVE - CALL CMDSER ;SCAN FOR CPR-RESIDENT COMMAND + CALL CMDSER ;SCAN FOR COMMAND ; ; ENTRY POINT FOR CONTINUED SCAN OF COMMAND LINE ; + CALL UPDATE ;UPDATE BDOS/SYSTEM PARAMETERS CALL ADVAN ;GET ANY CHARACTER JR Z,RESTRT ;NONE, END OF LINE LD (CIPTR),DE ;UPDATE START OF LINE IN CASE ERROR @@ -1024,7 +1051,7 @@ SCAN4: LD (HL),B ;SAVE DRIVE LD B,8 ;MAX OF 8 CHARACTERS XOR A ;CLEAR '?' COUNT - EX AF,AF ;AND SAVE + EX AF,AF' ;AND SAVE CALL SCANF ;GET POSSIBLE NAME CALL SCANT ;AND POSSIBLE TYPE ; @@ -1044,7 +1071,7 @@ SCAN4: ; SCAN COMPLETE -- DE POINTS TO DELIMITER BYTE AFTER TOKEN ; LD (CIBPTR),DE - EX AF,AF ;GET NUMBER OF '?' IN FILENAME.TYP + EX AF,AF' ;GET NUMBER OF '?' IN FILENAME.TYP RET ; ; EXTRACT FILE TYPE FROM POSSIBLE FILENAME.TYP @@ -1069,9 +1096,9 @@ SCAN12: SCAN13: CP '?' ;QUESTION MARK? JR NZ,SCAN14 ;NO, JUST STORE CHARACTER - EX AF,AF ;GET QUESTION MARK COUNT + EX AF,AF' ;GET QUESTION MARK COUNT INC A ;COUNT IT - EX AF,AF ;AND SAVE COUNT + EX AF,AF' ;AND SAVE COUNT SCAN14: INC DE ;POINT TO NEXT CHARACTER IN COMMAND LINE LD (HL),A ;STORE CHARACTER IN FCBDN @@ -1097,15 +1124,6 @@ CMDSER: LD A,(HL) ;LOOK FOR DRIVE SPEC DEC A ;ADJUST FOR LOG IN CALL P,TLOGIN ;LOG IN DRIVE -SETUDB: - LD A,(TMPUSR) ;GET CURRENT USER NUMBER - ADD A,A ;PLACE IT IN HIGH NIBBLE - ADD A,A - ADD A,A - ADD A,A - LD HL,TDRIVE ;ADD DEFAULT DRIVE NUMBER (LOW NIBBLE) - OR (HL) - LD (UDFLAG),A ;UPDATE USER/DRIVE BYTE RET CMS0: OR (HL) ;DRIVE OR USER NUMBER @@ -1125,11 +1143,10 @@ CMS2: LD A,(DE) ;NEXT CHARACTER IN INPUT COMMAND MUST BE CP ' ' JR NZ,CMS4 - LD A,(HL) ;FOUND COMMAND, + LD E,(HL) ;FOUND COMMAND, INC HL ;LOAD ADDRESS, - LD H,(HL) ;AND - LD L,A ;JUMP TO IT - JP (HL) ;COMMAND IS CPR-RESIDENT + LD D,(HL) ;AND + JR CMS6 ;UPDATE SYSTEM DATA AND EXECUTE CMS3: BIT 7,(HL) ;END OF TABLE ENTRY? INC HL @@ -1139,7 +1156,10 @@ CMS4: INC HL DJNZ CMS1 ;NOT TO END OF TABLE YET CMS5: - JP COM ;COMMAND MAY BE DISK-RESIDENT + LD DE,COM ;LOAD DESTINATION AND UPDATE +CMS6: + PUSH DE ;PLACE ROUTINE ADDRESS ON STACK + JP UPDATE ;UPDATE SYSTEM DATA AND EXECUTE ; ;**** Section 5 **** ; CPR-Resident Commands @@ -1411,6 +1431,21 @@ REPL2: RET ; ;Section 5E +;Command: CLS +;Function: To clear screen. +;Forms: +; CLS +; +CLS: +; LD A,CLSCHR ; Load clear screen character +; DEFB 21H ; and skip next instruction + ; If a multi-character string is + ; required to clear screen use: + CALL PRINT + DB ESC,'[2','J'+128 + RET +; +;Section 5F ;Command: BELL ;Function: To ring terminal bell. ;Forms: @@ -1420,7 +1455,7 @@ RING: LD A,BELL ; load bell into A JP CONOUT ; and output it ; -;Section 5F +;Section 5G ;Command: LIST ;Function: To print specified file on list device. ;Forms: @@ -1437,7 +1472,7 @@ LIST: ; JR TYPE1 ; -;Section 5G +;Section 5H ;Command: TYPE ;Function: To display specified file on console. ;Forms: @@ -1560,8 +1595,8 @@ PAGER: PAGE2: JP BDOSJP ; return via bdos ; -;Section 5H -;Command: PAGE +;Section 5I +;Command: FF (was PAGE) ;Function: To eject a page on list device via a form feed. ;Forms: ; PAGE @@ -1579,7 +1614,7 @@ EJECT: LD C,05H ; list output JP BDOS ; output character and return via bdos ; -;Section 5I +;Section 5J ;Command: SAVE ;Function: To save the contents of TPA onto disk as a file. Number of ; pages or records is in decimal. Saved area begins at 100H. @@ -1628,7 +1663,7 @@ SAVE3: SAVE4: JP PRNLE ;PRINT 'NO SPACE' ERROR ; -;Section 5J +;Section 5K ;Command: REN ;Function: To change the name of an existing file. ;Forms: @@ -1670,7 +1705,7 @@ NAMERR: REN2: JP ABORT ; -;Section 5K +;Section 5L ;Command: USER ;Function: To change current user number; new user number is in decimal. ;Forms: @@ -1680,7 +1715,7 @@ USER: CALL USRNUM ;EXTRACT USER NUMBER FROM COMMAND LINE JP NEWUSR ;SET NEW USER NUMBER ; -;Section 5L +;Section 5M ;Command: DFU ;Function: To set the Default User Number for the command/file scanner; new ; default user number is in decimal. @@ -1692,7 +1727,7 @@ DFU: LD (DFUSR),A ;PUT IT AWAY RET ; -;Section 5M +;Section 5N ;Command: SCL ;Function: To force ZCPR to parse only a single command per line; reset ; to multiple command format at the next ^C. @@ -1709,7 +1744,7 @@ SINGLE: ENDIF ; ; -;Section 5N +;Section 5O ;Command: PEEK ;Function: To display hex values beginning at a specified address. ;Forms: @@ -1756,7 +1791,7 @@ PRHEX: JP CONOUT ; go display value ; ; -;Section 5O +;Section 5P ;Command: POKE ;Function: To poke a string of hex values into a set of consecutive addresses. ;Forms: @@ -1777,7 +1812,7 @@ POKE1: JR POKE1 ; go for more ; ; -;Section 5P +;Section 5Q ;Command: JUMP ;Function: To call the program (subroutine) at the specified address ; without loading from disk. @@ -1788,7 +1823,7 @@ JUMP: CALL HEXNUM ;GET LOAD ADDRESS IN HL JR CLLPRG ;PERFORM CALL ; -;Section 5Q +;Section 5R ;Command: COM file processing ;Function: To load the specified COM file from disk and execute it. ;Forms: @@ -1808,7 +1843,7 @@ COM: CALL MEMLD ;LOAD MEMORY WITH FILE SPECIFIED ;(NO RETURN IF ERROR OR TOO BIG) ; -;Section 5R +;Section 5S ;Command: GO ;Function: To call the program in the TPA without loading from disk. ; Same as JUMP 100H, but more convenient, especially when @@ -1869,14 +1904,24 @@ COM3: ; RUN LOADED TRANSIENT PROGRAM ; CALL CRLF ;NEW LINE - CALL DEFDMA ;SET DMA TO 0080 - CALL RSTUSR ;RESET TO PROPER USER NUMBER +UPDATE: + CALL DEFDMA ;SET DMA TO DEFAULT VALUE + CALL DLOGIN ;ASSURE PROPER DRIVE + CALL RSTUSR ;ASSURE PROPER USER NUMBER + LD A,E ;GET CURRENT USER NUMBER + ADD A,A ;PLACE IT IN HIGH NIBBLE + ADD A,A + ADD A,A + ADD A,A + LD HL,TDRIVE ;ADD DEFAULT DRIVE NUMBER (LOW NIBBLE) + OR (HL) + LD (UDFLAG),A ;UPDATE USER/DRIVE BYTE ; -; EXECUTION (CALL) OF PROGRAM (SUBROUTINE) OCCURS HERE +; EXECUTION (CALL) OF PROGRAM/SUBROUTINE/COMMAND OCCURS HERE ; RET ;CALL TRANSIENT ; -;Section 5S +;Section 5T ;Command: GET ;Function: To load the specified file from disk to the specified address ;Forms: @@ -1897,9 +1942,9 @@ MEMLD: LD (LDADR),HL ;SET LOAD ADDRESS ; ; MLA is a reentry point for a non-standard CP/M Modification -; This is the return point when the .COM (or GET) file is not found the -; first time, the Default User is selected for the second attempt -; and Drive A is selected for the final attempt. +; This is the return point when the .COM (or GET) file was not found +; so the Default Drive & User are selected for the final attempt +; to find the file. ; MLA: CALL ULOGIN ;LOG ANY USER @@ -1907,29 +1952,22 @@ MLA: CALL OPENF ;OPEN COMMAND.COM FILE JR NZ,MLA1 ;FILE FOUND - LOAD IT ; -; FILE NOT FOUND - SELECT DEFAULT USER +; FILE NOT FOUND - SELECT DEFAULT COM USER ; - LD A,L ;GET FCB USER - AND A ;DEFAULT USER? - JR NZ,MLA0 ;NO - LD HL,TMPUSR ;CURRENT USER SAME AS DEFAULT? LD A,(DFUSR) ;GET DEFAULT USER - CP (HL) SET 7,A ;MAKE INTO VALID USER NUMBER LD (FCBS1),A ;PUT USER INTO FCB - JR NZ,MLA ;AND TRY AGAIN ; -; FILE NOT FOUND - SELECT DRIVE A IF DEFAULT WAS SOME OTHER DRIVE +; AND SELECT DEFAULT COM DRIVE. IF DEFAULT COM DRIVE ALREADY +; SELECTED, GIVE UP AND PRINT ERROR MESSAGE ; MLA0: - LD A,(TDRIVE) ;DRIVE A DEFAULT? - AND A + LD A,DEFDRV-'@' ;A<= DEFAULT COM DRIVE + LD HL,FCBDN ;POINT TO DRIVE IN FCB + CP (HL) ;THE SAME? JR Z,MLA3 ;YES, ERROR - XOR A - LD HL,FCBDN ;POINT AT DRIVE IN FCB - OR (HL) ;DRIVE ALREADY SPECIFIED? - LD (HL),1 ;SELECT DRIVE A - JR Z,MLA ;NO, GO GIVE IT A TRY + LD (HL),A ;PUT DEFAULT COM DRIVE IN FCB + JR MLA ;GO GIVE IT A TRY MLA3: CALL PRNNF ;CAN'T FIND FILE JR PRNLE1 @@ -1962,6 +2000,7 @@ PRNLE1: IF (($-ENTRY) GT ZCPRSZ) *ZCPR too large!!* ENDIF + .DEPHASE ; IF TEST LISTST: @@ -1978,4 +2017,4 @@ ENDLD EQU $ END - PUSH HL ;SAVE POI \ No newline at end of file + \ No newline at end of file diff --git a/Source/ZCPR-DJ/zcpr.mac.bak b/Source/ZCPR-DJ/zcpr.mac.bak deleted file mode 100644 index 253f3e57..00000000 --- a/Source/ZCPR-DJ/zcpr.mac.bak +++ /dev/null @@ -1,1980 +0,0 @@ - TITLE ZCPR Console Command Processor - Version D&J - SUBTTL Last Modified: 5 March 1994 -; -; CP/M Z80 Command Processor Replacement (CPR) Version 1.0 -; CCPZ CREATED AND CUSTOMIZED FOR ARIES-II BY RLC -; FURTHER MODIFIED BY RGF AS V2.0 -; FURTHER MODIFIED BY RLC AS V2.1 -; FURTHER MODIFIED BY KBP AS V2.2 -; FURTHER MODIFIED BY RLC AS V2.4 (V2.3 skipped) -; FURTHER MODIFIED BY RLC AS V2.5 -; FURTHER MODIFIED BY RLC AS V2.6 -; FURTHER MODIFIED BY SBB AS V2.7 -; FURTHER MODIFIED BY RLC AS V2.8 -; FURTHER MODIFIED BY RLC AS V2.9 -; FURTHER MODIFIED BY RLC AS V3.0 -; FURTHER MODIFIED BY RLC AS V3.1 -; FURTHER MODIFIED BY RLC AS V4.0 -; ZCPR VERSION 1.0 CREATED FROM CCPZ VERSION 4.0 BY RLC IN -; A COORDINATED EFFORT WITH CCP-GROUP -; FURTHER MODIFIED BY SBB (AS CCPZ-V4.1 11/27/81) -; & MORE MODS BY ROBERT FISHER (CA. 12/1/81) -; [RETROFITTED TO ZCPR BY BEN BRONSON (12/22/81) AS ZCPR-BB] -; -; FURTHER MODIFIED BY DCK AS Version D&J -; -; ZCPR is a group effort by CCP-GROUP, whose active membership involved -; in this project consists of the following: -; RLC - Richard Conn -; RGF - Ron Fowler -; KBP - Keith Peterson -; FJW - Frank Wancho -; The following individual also provided a contribution: -; SBB - Steve Bogolub -; -; (Note by BB: SBB's and R Fisher's changes came too late in the -; history of CCPZ to be included in the first release of ZCPR) -; -; Extensive modifications to add ERAQ, DIR for all usrnum, -; LIST x.x P, and fix TYPE when FF encountered was done by Don -; Kirkpatrick, 20 September 1986. -; -; DCK - Don Kirkpatrick -; -; Further modified for better polling during LIST/TYPE, 16 July 1987. -; -; Further modified to include boot command and to permit multiple -; commands per line. Fixed bug in jump. Modified type so character -; is not echoed, 4 July 1988. -; -; Modified to add PAGE command 31 December 1989. -; -; Added BELL and SAK (Strike Any Key) command. -; -; Added ZCPR3 style drive/user number to all FCB parsing. For Example: -; A>c4: Changes to drive C/user 4 -; A>c4: Runs found on drive C/user 4 -; A>dir c4: Gives directory of drive C/user 4 -; A>ren =c4: -; Renames file found on drive C/user 4 -; Both the drive and user number are optional; 15: is a valid designation. -; S1 in the FCB is used to store the user number. If S1 contains a valid -; user number, bit 7 will be set. If no user number is specified, S1 will -; contain 0. -; -; Added POKE and changed SCL to a toggle, 12 August 1992. -; -; Added PEEK 30 August 1993. -; -;******** Structure Notes ******** -; -; This CPR is divided into a number of major sections. The following -; is an outline of these sections and the names of the major routines -; located therein. -; -; Section Function/Routines -; ------- ----------------- -; -; -- Opening Comments, Equates, and Macro Definitions -; -; 0 JUMP Table into CPR -; -; 1 Buffers -; -; 2 CPR Starting Modules -; CPR1 CPR RESTRT -; -; 3 Utilities -; CRLF PRINTC PRINT PRINTS BELL -; CONOUT BREAK CHKETX ABORT READF -; READ WRITE DEFDMA DMASET SEARF -; SEARDE SEARN OPENF OPEN CLOSE -; CREATE BDOSFN SUBKIL DELETE TLOGIN -; DLOGIN LOGIN NEWUSR RSTUSR SETUSR -; BDOSEA BDOSJP BDOSBC BDOSDE -; -; 4 CPR Utilities -; PROMPT REDBUF CNVBUF UCASE SDELM -; ADVAN SBLANK ADDAH NUMBER A2NUM -; HEXNUM USRNUM ERROR DIRPTR ULOGIN -; SCANER SCANT SCANF CMDSER SETUDB -; -; 5 CPR-Resident Commands and Functions -; 5A DIR DIRPR PRFN -; 5B ERA -; 5C ERAQ PRNNF -; 5D SAK REPLY -; 5E BELL -; 5F LIST -; 5G TYPE PAGER -; 5H EJECT -; 5I SAVE -; 5J REN -; 5K USER SUSER -; 5L DFU -; 5M SCL -; 5N PEEK -; 5O POKE -; 5P JUMP -; 5Q COM -; 5R GO CLLPRG ERRLOG ERRJMP -; 5S GET MEMLD PRNLE -; BIOS BOOT -; -; -FALSE EQU 0 -TRUE EQU NOT FALSE -; -; -; CUSTOMIZATION EQUATES -; -; The following equates may be used to customize this CPR for the user's -; system and integration technique. The following constants are provided: -; -; TEST - TRUE to build at intermediate address to debug via debugger. -; -; COMLD - TRUE to test and execute as a .com file. -; -; REL - TRUE if integration is to be done via MOVCPM. -; -; BASE - Base Address of user's CP/M system (normally 0 for DR version). -; This equate eases modification by non-standard CP/M (eg. H89). -; -; P2DOS - Address of BDOS/P2DOS. -; -TEST EQU FALSE ;SET TO LOAD/RUN AT 8000H FOR DEBUG -COMLD EQU FALSE ;SET TO LOAD AND EXECUTE AS A .COM FILE -REL EQU FALSE ;SET TO TRUE FOR MOVCPM INTEGRATION - ;LEAVE ALL FALSE FOR SYSGEN IMAGE -; -BASE EQU 0 ;BASE OF CP/M SYSTEM -P2DOS EQU 0E400H ;BASE OF BDOS/P2DOS -ZCPRSZ EQU 00800H ;SIZE OF ZCPR -P2DOSSZ EQU 00E00H ;SIZE OF P2DOS -BIOS EQU P2DOS+P2DOSSZ ;BASE OF BIOS -CPRLOC DEFL P2DOS-ZCPRSZ ;STANDARD EXECUTION ADDRESS -; - IF REL -CPRLOC DEFL 0 ;MOVCPM IMAGE - ENDIF -; - IF TEST -CPRLOC DEFL 8000H - ELSE -BOOT EQU BIOS ;BIOS COLD BOOT ENTRY -LISTST EQU BIOS+002DH ;ENTRY POINT FOR LIST STATUS - ENDIF -; -; The following is presented as an option, but is not normally user-customize- -; able. A basic design choice had to be made in the design of ZCPR concerning -; the execution of SUBMIT files. The original CCP had a problem in this sense -; in that it ALWAYS looked for the SUBMIT file from drive A: and the SUBMIT -; program itself (SUBMIT.COM) would place the $$$.SUB file on the currently -; default drive. When the user was logged into B: and he issued a SUBMIT -; command, the $$$.SUB was placed on B: and did not execute. The CPR looked -; for $$$.SUB on A: and never found it. -; -; After much debate it was decided to have ZCPR perform the same type of -; function as CCP (look for the $$$.SUB file on A:), but the problem with -; SUBMIT.COM still exists. Hence, RGF designed SuperSUB and RLC took his -; SuperSUB and designed SUB from it; both programs are set up to allow the -; selection at assembly time of creating the $$$.SUB on the default drive -; or on drive A:. -; -; A final definition of the Indirect Command File ($$$.SUB or SUBMIT -; File) is presented as follows: -; -; "An Indirect Command File is one which contains -; a series of commands exactly as they would be -; entered from a CP/M Console. The SUBMIT Command -; (or SUB Command) reads this file and transforms -; it for processing by the ZCPR (the $$$.SUB File). -; ZCPR will then execute the commands indicated -; EXACTLY as if they were typed at the Console." -; -; Hence, to permit this to happen, the $$$.SUB file must always -; be present on a specific drive, and A: is the choice for said drive. -; With this facility engaged as such, Indirect Command Files like: -; -; DIR -; B: -; DIR -; -; can be executed, even though the currently default drive is changed -; during execution. If the $$$.SUB file was present on the currently -; default drive, the above series of commands would not work since the -; ZCPR would be looking for $$$.SUB on the default drive, and switching -; default drives without moving the $$$.SUB file as well would cause -; processing to abort. -; -; Note that the same problem can occur if the user number of the -; $$$.SUB file is not predefined. It is assumed that the $$$.SUB file -; is located on user 0 of the specified drive. -; -; The trick of using the $ flag returned by DISK RESET is used to -; to speed the search for a $*.* file on drive A. This trick will not -; work if the $$$.SUB file is located on another drive. -; -; -; Under the ZCPR, three command levels exist: -; -; (1) that command issued by the user from his console at the '>' prompt -; (2) that command issued by a $$$.SUB file at the '$' prompt -; (3) that command issued by a user program by placing the command into -; CIBUFF and setting the character count in CBUFF -; -; To use CIBUFF, the user program stores the command line and character -; count; ZCPR will initialize the pointers properly, store the ending zero, -; and capitalize the command line for processing. Once the command line is -; properly stored, the user executes the command line by reentering ZCPR -; through CPRLOC [NOTE: The C register MUST contain a valid User/Disk Flag -; (see location 4) at this time.] -; -; -; Directory customization equates -; -TWOCOL EQU FALSE ;TRUE FOR TWO-COLUMN DIRECTORY DISPLAY -WIDE EQU TRUE ;TRUE IF WIDE DIRECTORY DISPLAY -FENCE EQU '|' ;CHARACTER BETWEEN FILES -USRDLM EQU ':' ;CHARACTER BETWEEN USER NUMBER AND FILE -USRFLG EQU 'A' ;LIST $SYS AND $DIR FOR ALL USER NUMBERS -SYSFLG EQU 'B' ;LIST $SYS AND $DIR -SOFLG EQU 'S' ;LIST $SYS ONLY -; -; List and Type command customization equates -; -NLINES EQU 20 ;NUMBER OF LINES ON CRT PAGE -NLINEP EQU 60 ;NUMBER OF LINES ON LIST DEVICE -FFKILL EQU TRUE ;TRUE SUPPRESSES FF UNTIL FIRST CHARACTER -PGDFLG EQU 'P' ;TYPE AND LIST COMMAND DEFAULT TOGGLE -NOSTAT EQU FALSE ;SET TO TRUE IF BIOS LISTST NOT IMPLEMENTED -; -; Other customization equates -; -BUFLEN EQU 80 ;SIZE OF COMMAND INPUT BUFFER -MAXUSR EQU 15 ;MAXIMUM USER NUMBER ACCESSIBLE -DEFUSR EQU 0 ;DEFAULT USER NUMBER FOR COM FILES -SPRMPT EQU '$' ;CPR PROMPT INDICATING SUBMIT COMMAND -COMCHR EQU ';' ;BEGIN COMMENT CHARACTER -CMDCHR EQU ';' ;BEGIN NEXT COMMAND CHARACTER -NUMBASE EQU 'H' ;CHARACTER USED TO SPECIFY HEXIDECIMAL BASE -RECFLG EQU 'R' ;CHARACTER FOR SAVE COMMAND TO SAVE RECORDS -SUPRES EQU TRUE ;TRUE TO SUPPRESS USER NUMBER FOR USER 0 -MULTPL EQU TRUE ;TRUE TO ALLOW MULTIPLE COMMANDS ON ONE LINE -REBOOT EQU TRUE ;TRUE TO INCLUDE BOOT COMMAND -; - IF TEST -CPRMPT EQU '<' ;CPR PROMPT INDICATING TEST MODE - ELSE -CPRMPT EQU '>' ;CPR PROMPT INDICATING USER COMMAND - ENDIF -; -; END OF CUSTOMIZATION SECTION -; -ETX EQU 03H -BELL EQU 07H -BS EQU 08H -TAB EQU 09H -LF EQU 0AH -FF EQU 0CH -CR EQU 0DH -; -WBOOT EQU BASE+0000H ;CP/M WARM BOOT ADDRESS -UDFLAG EQU BASE+0004H ;USER NUMBER IN HIGH NIBBLE, DISK IN LOW -BDOS EQU BASE+0005H ;BDOS FUNCTION CALL ENTRY POINT -TFCB EQU BASE+005CH ;DEFAULT FCB BUFFER -TBUFF EQU BASE+0080H ;DEFAULT DISK I/O BUFFER -TPA EQU BASE+0100H ;BASE OF TPA -; -; -;**** Section 0 **** -; - .Z80 - ASEG - ORG 100H -; -; LOADER FOR TEST PURPOSES -; ALLOWS ONE TO EXECUTE ZCPR AS A .COM FILE -; - IF COMLD OR TEST - LD HL,BGNXFR - LD DE,CPRLOC - LD BC,ENDLD-CPRLOC - LDIR - LD BC,(UDFLAG) - JP CPRLOC -BGNXFR EQU $ - ENDIF -; - .PHASE CPRLOC -; -; ENTRY POINTS INTO ZCPR -; -; If the ZCPR is entered at location CPRLOC (at the JUMP to CPR), then -; the default command in CIBUFF will be processed. If the ZCPR is entered -; at location CPRLOC+3 (at the JUMP to CPR1), then the default command in -; CIBUFF will NOT be processed. -; -; NOTE: Entry into ZCPR in this way is permitted under ZCPR Version 4.0, -; but in order for this to work, CIBUFF and CBUFF MUST be initialized properly -; AND the C register MUST contain a valid User/Disk Flag (see Location 4: the -; most significant nibble contains the User Number and the least significant -; nibble contains the Disk Number.) -; -; Some user programs (such as SYNONYM3) attempt to use the default -; command facility. Under the original CPR, it was necessary to initialize -; a pointer located at the end of the command buffer to point to the first -; byte in the command buffer. Under Version 4.x of ZCPR, this is no longer -; the case. This pointer, CIBPTR (Command Input Buffer PoinTeR), has been -; moved and the former location is now reserved for the stack. ZCPR -; Version 4.x automatically initializes CIBPTR in all cases. -; -ENTRY: - JP CPR ; Process potential default command - JP CPR1 ; Do NOT process potential default command -; -;**** Section 1 **** -; -; BUFFERS ET AL -; -; INPUT COMMAND LINE AND DEFAULT COMMAND -; -; The command line to be executed is stored here. This command line -; is generated in one of three ways: -; -; (1) by the user entering it through the BDOS READLN function at -; the du> prompt [user input from keyboard]. -; (2) by the SUBMIT File Facility placing it there from a $$$.SUB -; file. -; (3) by an external program or user placing the required command -; into this buffer. -; -; In all cases, the command line is placed into the buffer starting at -; CIBUFF. This line contains the last character but NOT the Carriage -; Return, and the count is of all characters in the command line up to and -; including the last character. This count is placed into location CBUFF -; (immediately before the command line at CIBUFF.) If ZCPR is entered via -; CPRLOC, the command line is then parsed, interpreted, and the indicated -; command is executed. ZCPR places the terminating zero after the command -; and CIBPTR is properly initialized. -; -; WARNING: The command line must NOT exceed BUFLEN characters in length. -; For user programs which load this command, the value of BUFLEN can be -; obtained by examining the byte at CPRLOC+6. -; -; It is now possible to place multiple commands on one line. Each command -; is separated from its neighbor by a ";". This feature only works for ZCPR -; commands and programs that return to ZCPR via a RET instruction. Any -; warm boot reloads ZCPR and destroys the contents of the command buffer. -; The multiple command feature may be turned off with the SCL command. -; -MBUFF: DEFB BUFLEN ;MAXIMUM BUFFER LENGTH -CBUFF: DEFB 0 ;NUMBER OF CHARACTERS IN COMMAND LINE -CIBUFF: DEFB ' ' ;DEFAULT (COLD BOOT) COMMAND - DEFB 0 ;COMMAND STRING TERMINATOR - DEFB ' ZCPR-D&J of 5 March 1994 ' - DEFB 0 ;TERMINATOR FOR DUMP IDENTIFICATION - DEFS BUFLEN-($-CIBUFF)+1 - DEFW 0 ;SENTINEL FOR STACK END - DEFS 24 ;STACK AREA -STACK EQU $ ;TOP OF STACK -; -; SUBMIT FILE CONTROL BLOCK -; -SUBDN: DEFB 1 ;DISK DRIVE (A: CONTAINS $$$.SUB) -SUBFN: DEFB '$$$ ' ;FILE NAME -SUBFT: DEFB 'SUB' ;FILE TYPE -SUBEX: DEFB 0 ;EXTENT NUMBER -SUBS1 EQU SUBDN+13 ;S1 -SUBS2 EQU SUBDN+14 ;S2 -SUBRC EQU SUBDN+15 ;RECORD COUNT -SUBDM EQU SUBDN+16 ;DISK GROUP MAP -SUBCR EQU SUBDN+32 ;CURRENT RECORD NUMBER -; -; COMMAND FILE CONTROL BLOCK -; -FCBDN: DEFS 1 ;DISK DRIVE -FCBFN: DEFS 8 ;FILE NAME -FCBFT: DEFS 3 ;FILE TYPE -FCBEX: DEFS 1 ;EXTENT NUMBER -FCBS1: DEFS 1 ;S1 -FCBS2: DEFS 1 ;S2 -FCBRC: DEFS 1 ;RECORD COUNT -FCBDM: DEFS 16 ;DISK GROUP MAP -FCBCR: DEFS 1 ;CURRENT RECORD NUMBER -; -; Type and List Variables -; -CHRCNT: DEFS 1 ;CHARACTER COUNT FOR TYPE AND LIST -LNCNT: DEFS 1 ;LINE COUNT FOR TYPE AND LIST -TYPLST: DEFS 1 ;FLAG FOR TYPE OR LIST -TABCNT: DEFS 1 ;TAB COUNT FOR TYPE AND LIST -SYSTST: DEFB 0 ;LIST SYSTEM FILES IN DIRECTORY FLAG -; -; General Variables -; -CIBPTR: DEFW CIBUFF ;POINTER TO COMMAND INPUT BUFFER -CIPTR: DEFW CIBUFF ;POINTER TO CURRENT CMD FOR ERROR REPORTING -TMPUSR: DEFB 0 ;TEMPORARY USER NUMBER -TDRIVE: DEFB 0 ;DEFAULT DRIVE -DFUSR: DEFB DEFUSR ;DEFAULT USER -LDADR: DEFW TPA ;MEMORY LOAD ADDRESS -; -; CPR BUILT-IN COMMAND TABLE -; EACH ENTRY IS COMPOSED OF THE BIT 7 TERMINATED COMMAND AND 2-BYTE ADDRESS -; -CMDTBL: - DC 'DIR' - DEFW DIR - DC 'LIST' - DEFW LIST - DC 'TYPE' - DEFW TYPE - DC 'USER' - DEFW USER - DC 'DFU' - DEFW DFU - DC 'PAGE' - DEFW EJECT - DC 'BELL' - DEFW RING - DC 'SAK' - DEFW SAK - DC 'GO' - DEFW GO - DC 'ERA' - DEFW ERA - DC 'ERAQ' - DEFW ERAQ - DC 'SAVE' - DEFW SAVE - DC 'REN' - DEFW REN - DC 'GET' - DEFW GET - DC 'JUMP' - DEFW JUMP - DC 'PEEK' - DEFW PEEK - DC 'POKE' - DEFW POKE -NCMNDS DEFL 17 ;NUMBER OF COMMANDS -; - IF MULTPL - DC 'SCL' - DEFW SINGLE -NCMNDS DEFL NCMNDS+1 - ENDIF -; - IF REBOOT - DC 'BOOT' - DEFW BOOT -NCMNDS DEFL NCMNDS+1 - ENDIF -; -; -;**** Section 2 **** -; CPR STARTING POINTS -; -; START CPR AND DON'T PROCESS DEFAULT COMMAND STORED -; -CPR1: - XOR A ;SET NO DEFAULT COMMAND - LD (CBUFF),A -; -; START CPR AND POSSIBLY PROCESS DEFAULT COMMAND -; -CPR: - LD SP,STACK ;MAKE SURE WE HAVE A VALID STACK - LD A,C ;C=USER/DISK NUMBER (SEE LOC 4) - RRA ;EXTRACT USER NUMBER - RRA - RRA - RRA - AND 0FH - LD (TMPUSR),A ;SET USER NUMBER - LD A,C ;GET DISK NUMBER (SEE LOC 4) - AND 0FH ;EXTRACT DEFAULT DISK DRIVE - LD (TDRIVE),A ;SAVE DEFAULT DRIVE - LD C,0DH ;RESET DISK SYSTEM - CALL BDOS - LD (SUBFLG),A ;SAVE SUBMIT FLAG CLUE - DEFB 0F6H ;SET NZ FLAG (OR A,n) -; -; PROMPT USER AND PROCESS INPUT COMMAND -; -RESTRT: - XOR A ;SET ZERO FLAG - LD SP,STACK ;RESET STACK -; -; PROCESS INPUT LINE -; - CALL REDBUF ;CAPITALIZE, NULL TERMINATE, SKIP SPACES -RS3: - CP COMCHR ;COMMENT? - JR Z,RESTRT ;YES, SKIP REST OF LINE - CALL SCANER ;PARSE COMMAND NAME FROM COMMAND LINE - JR NZ,RS4 ;ERROR IF NAME CONTAINS A "?" - CALL DEFDMA ;SET TBUFF TO DMA ADDRESS - CALL DLOGIN ;ASSURE PROPER DRIVE - CALL RSTUSR ;ASSURE PROPER USER NUMBER - CALL SETUDB ;SET UD BYTE TO MATCH USER/DRIVE - CALL CMDSER ;SCAN FOR CPR-RESIDENT COMMAND -; -; ENTRY POINT FOR CONTINUED SCAN OF COMMAND LINE -; - CALL ADVAN ;GET ANY CHARACTER - JR Z,RESTRT ;NONE, END OF LINE - LD (CIPTR),DE ;UPDATE START OF LINE IN CASE ERROR - INC DE ;NOT END OF LINE, MUST BE DELIMITER - LD (CIBPTR),DE ;SAVE POINTER -; - IF MULTPL - LD HL,NEWCMD ;COMMAND? - CP (HL) -RS4: - JP NZ,ERROR ;NO - CALL ADVAN ;STEP OVER DELIMITER - JR RS3 - ELSE -RS4: - JP ERROR - ENDIF -; -; -;**** Section 3 **** -; I/O UTILITIES -; -; OUTPUT -; -CRLF: - CALL PRINT ;PRINT STRING - DEFB CR,LF+80H - RET -; -; PRINT STRING POINTED TO BY RET ADR; START WITH -; -PRINTC: - CALL CRLF ;NEW LINE -; -; PRINT STRING POINTED TO BY RET ADR -; -PRINT: - EX (SP),HL ;GET POINTER TO STRING - CALL PRINTS - EX (SP),HL ;RESTORE HL AND RETURN ADDRESS - RET -; -; PRINT STRING POINTED TO BY HL -; -PRINT1: - CALL CONOUT ;PRINT CHARACTER -PRINTS: - LD A,(HL) ;GET NEXT BYTE - INC HL ;POINT TO NEXT BYTE - AND A ;TEST FOR 0 OR BIT 7 SET - RET Z ;DONE - JP P,PRINT1 ;NOT LAST CHARACTER -; -; OUTPUT CHARACTER IN A REG -; -CONOUT: - PUSH BC - PUSH DE - LD C,02H - RES 7,A ;STRIP MSB IN CASE SET FOR EOS - LD E,A - JR BDOSDE -; -; GET CHARACTER FROM CONSOLE AND CHECK FOR ^C -; -BREAK: - PUSH BC - LD C,0BH ;CONSOLE STATUS CHECK - CALL BDOSJP - LD C,01H ;GET CHARACTER FROM CON: WITH ECHO - CALL NZ,BDOSJP ;GET CHARACTER - POP BC - RET Z ;NO CHARACTER -CHKETX: - CP ETX ;^C? - RET NZ ;NO -ABORT: - CALL SUBKIL ;KILL ANY SUBMIT - JR RESTRT ;AND RESTART -; -; BDOS FUNCTIONS -; -READF: - LD DE,FCBDN ;FALL THRU TO READ -READ: - LD C,14H - DEFB 3AH ;SKIP NEXT TWO BYTES -WRITE: - LD C,15H ;FALL THRU TO BDOS CALL - JR BDOSJP -DEFDMA: - LD DE,TBUFF ;TBUFF = DEFAULT ADDRESS -DMASET: - LD C,1AH ;SET DMA ADDRESS - JR BDOSJP -SEARF: - LD DE,FCBDN ;SPECIFY FCB -SEARDE: - LD C,11H ;SEARCH FOR FILE - DEFB 3AH ;SKIP NEXT TWO BYTES -SEARN: - LD C,12H ;SEARN IGNORES DE AND USES THE PREVIOUS - JR BDOSFN ;VALUE FROM THE LAST BDOS CALL -OPENF: - XOR A - LD (FCBCR),A - LD DE,FCBDN ;FALL THRU TO OPEN -OPEN: - LD C,0FH ;OPEN FILE - DEFB 3AH ;SKIP NEXT TWO BYTES -CLOSE: - LD C,10H ;CLOSE FILE - DEFB 3AH ;SKIP NEXT TWO BYTES -CREATE: - LD C,16H ;CREATE FILE -BDOSFN: - CALL BDOSJP - INC A ;SET ERROR RETURN FLAG - RET -SUBKIL: - LD HL,SUBFLG ;ABORT SUBMIT FILE - LD A,(HL) ;SUB FILE IN EXECUTION? - AND A - RET Z ;NO - LD (HL),0 ;KILL SUB FILE EXECUTION FLAG - LD DE,SUBDN ;DELETE $$$.SUB -DELETE: - LD C,13H ;DELETE FILE - JR BDOSJP ;SAVE MORE SPACE -TLOGIN: - LD (TDRIVE),A ;SAVE NEW DEFAULT DRIVE -DLOGIN: - LD A,(TDRIVE) ;LOG IN DEFAULT DRIVE - LD C,0EH ;SELECT DISK - JR BDOSEA ;SAVE SOME CODE SPACE -NEWUSR: - LD (TMPUSR),A ;SET NEW USER NUMBER -RSTUSR: - LD A,(TMPUSR) ;RESET TEMPORARY USER -SETUSR: - LD C,20H ;GET/SET USER NUMBER (GET IF E=FFH) -BDOSEA: - LD E,A ;STUFF PARAMETER INTO REG E -BDOSJP: - PUSH BC -BDOSBC: - PUSH DE ; zcpr does not use any BDOS calls that -BDOSDE: - PUSH HL ; return a value in HL. Those HL calls - CALL BDOS ; are: - POP HL ; get active drive - #24 - POP DE ; get allocation vector - #27 - POP BC ; get read-only map - #29 - AND A ; get disk parameters - #31 - RET -; -; -;**** Section 4 **** -; CPR UTILITIES -; -; PRINT PROMPT (DU>) -; -PROMPT: - CALL CRLF ;PRINT PROMPT - LD A,(TDRIVE) ;CURRENT DRIVE IS PART OF PROMPT - ADD A,'A' ;CONVERT TO ASCII A-P - CALL CONOUT - LD A,(TMPUSR) ;GET USER NUMBER -; - IF SUPRES ;IF SUPPRESSING USER # REPORT FOR USER 0 - AND A - JR Z,PRPT1 ;ZERO, SUPRESS - ENDIF -; -PRUSRN: - ADD A,0 ;CONVERT HEX TO BCD - DAA - PUSH AF ;SAVE UNITS DIGIT - AND 0F0H - LD A,'1' - CALL NZ,CONOUT ;PRINT IF OVER 10 - POP AF - OR '0' ;OUTPUT 1'S DIGIT (CONVERT TO ASCII) - CALL CONOUT -PRPT1: - JP PRINT ;GO PRINT PROMPT CHARACTER -; -; INPUT NEXT COMMAND TO CPR -; -; This routine determines if a SUBMIT file is being processed -; and extracts the command line from it if so or from the user's console. -; This routine also invokes the DU> prompt. -; -REDBUF: - JR NZ,CNVBUF ;PROCESS DEFAULT COMMAND IF ANY -RD0: - CALL DEFDMA ;SELECT TBUFF FOR READ - XOR A ;SELECT USER 0 FOR SUBMIT SEARCH - CALL SETUSR - LD DE,SUBDN ;OPEN $$$.SUB -SUBFLG EQU $+1 ;IN LINE SUBMIT FLAG - LD A,0 ;SUBMIT IN PROGRESS? - AND A - CALL NZ,OPEN ;CALL OPEN IF SUBMIT IN PROGRESS - JR Z,RB2 ;NONE FOUND SO GET COMMAND LINE - LD A,(SUBRC) ;GET VALUE OF LAST RECORD IN FILE - DEC A ;POINT TO NEXT TO LAST RECORD - LD (SUBCR),A ;SAVE NEW VALUE OF LAST RECORD IN $$$.SUB - CALL READ ;DE=SUBDN - JR NZ,RB1 ;ABORT $$$.SUB IF ERROR IN READING LAST REC - LD HL,SUBS2 ;POINT TO S2 OF $$$.SUB FCB - LD (HL),A ;SET S2 TO ZERO - INC HL ;POINT TO RECORD COUNT - DEC (HL) ;DECREMENT RECORD COUNT OF $$$.SUB - PUSH AF ;SAVE ZERO FLAG - CALL Z,SUBKIL ;KILL SUBMIT IF ZERO RECORDS LEFT - POP AF ;ELSE - CALL NZ,CLOSE ;JUST CLOSE FILE - CALL PROMPT ;PRINT SUBMIT PROMPT - DEFB SPRMPT+80H - LD HL,TBUFF+1 ;PRINT COMMAND LINE FROM $$$.SUB - CALL PRINTS - LD HL,TBUFF ;MOVE COMMAND LINE TO COMMAND BUFFER - LD DE,CBUFF - LD BC,BUFLEN - LDIR - CALL BREAK ;CHECK FOR ABORT (ANY CHARACTER) - JR Z,CNVBUF ;NONE -; -; INPUT COMMAND LINE FROM USER CONSOLE -; -RB1: - CALL SUBKIL ;ERASE $$$.SUB -RB2: - CALL PROMPT ;PRINT PROMPT - DEFB CPRMPT+80H - LD C,0AH ;READ COMMAND LINE FROM USER - LD DE,MBUFF - CALL BDOS -; -; CAPITALIZE STRING (ENDING IN 0) IN CBUFF AND SET POINTER FOR PARSING -; -CNVBUF: - LD HL,CBUFF ;POINT TO USER'S COMMAND BUFFER - LD A,(HL) ;ANY CHARACTERS IN BUFFER? - AND A - JR Z,RD0 ;NO, FILL BUFFER - INC HL - LD (CIBPTR),HL ;INITIALIZE COMMAND LINE POINTER - LD B,A ;INITIALIZE CHARACTER COUNTER -CB1: - LD A,(HL) ;CAPITALIZE COMMAND CHARACTER - CALL UCASE - LD (HL),A - INC HL ;POINT TO NEXT CHARACTER - DJNZ CB1 ;CONTINUE TO END OF COMMAND LINE - LD (HL),B ;STORE ENDING -; -; ADVANCE INPUT POINTER TO FIRST NON-BLANK AND FALL THROUGH TO SBLANK -; -ADVAN: - LD DE,(CIBPTR) -; -; SKIP STRING POINTED TO BY DE (STRING ENDS IN 0) UNTIL END OF STRING -; OR NON-BLANK ENCOUNTERED (BEGINNING OF TOKEN) -; -SBLANK: - LD A,(DE) - OR A - RET Z - CP ' ' - RET NZ - INC DE - JR SBLANK -; -; CONVERT CHARACTER IN A TO UPPER CASE -; -UCASE: - CP 61H ;LOWER-CASE A - RET C - CP 7BH ;GREATER THAN LOWER-CASE Z? - RET NC - AND 5FH ;CAPITALIZE - RET -; -; CHECK TO SEE IF DE POINTS TO DELIMITER; IF SO, RET W/ZERO FLAG SET -; -SDELM: - LD A,(DE) - OR A ;0=DELIMITER - RET Z - CP ' ' ;ERROR IF < - JP C,ERROR - RET Z ; =DELIMITER - CP '.' ;"." =DELIMITER - RET Z - CP '[' ;"[" =DELIMITER - RET Z - CP ']' ;"]" =DELIMITER - RET Z - CP '>' ;">" =DELIMITER BUT GREATER NOT - RET NC - CP ':' ;":" ";" "<" "=" =DELIMITERS - RET C ;NO DELIMITER FOUND - CP A ;SET ZERO FLAG - RET - -; -; ADD A TO HL (HL=HL+A) -; -ADDAH: - ADD A,L - LD L,A - RET NC - INC H - RET -; -; EXTRACT DECIMAL NUMBER FROM COMMAND LINE -; RETURN WITH 8-BIT VALUE IN REG A AND 16-BIT VALUE IN HL -; ALL REGISTERS MAY BE AFFECTED -; -NUMBER: - CALL SCANER ;PARSE NUMBER AND PLACE IN FCBFN - LD HL,FCBFN+10 ;POINT TO END OF TOKEN FOR CONVERSION - LD B,11 ;11 CHARACTERS MAX -; -; CHECK FOR SUFFIX FOR HEXADECIMAL NUMBER -; -NUMS: - LD A,(HL) ;GET CHARACTERS FROM END, SEARCHING FOR SUFFIX - DEC HL ;BACK UP - CP NUMBASE ;CHECK AGAINST BASE SWITCH FLAG - JR Z,HNUM1 - CP ' ' ;SPACE? - JR NZ,NUM1 ;CHECK FOR LAST DIGIT - DJNZ NUMS ;COUNT DOWN -; -; PROCESS DECIMAL NUMBER -; -NUM1: - LD HL,0 ;CLEAR GRAND TOTAL - LD DE,FCBFN ;POINT TO BEGINNING OF TOKEN -NUM2: - LD A,(DE) ;GET CHARACTER - CP ' ' ;DONE IF -NUM3: - LD A,L ;TOTAL TO A IN CASE DONE - RET Z ;ALL DONE - CALL A2NUM ;CONVERT DIGIT - JR NC,NUM2 ;NO ERROR - JR ERROR -; -; ASCII TO NUMERICAL CONVERSION -; RETURNS WITH CARRY SET IF INVALID OR OVERFLOW -; BASE 10 ASSUMED - MAXIMUM VALUE IS 255 -; -A2NUM: - LD A,(DE) ;GET DIGIT - SUB '0' ;CONVERT TO BINARY (ASCII 0-9 TO BINARY) - CP 10 ;ERROR IF >= 10 - CCF ;FLIP CARRY - RET C - LD C,A ;DIGIT IN C - LD A,L ;NEW VALUE = OLD VALUE * 10 - RLCA ;*2 - RET C ;ERROR - RLCA ;*4 - RET C ;ERROR - ADD A,L ;*5 - RET C ;ERROR - RLCA ;*10 - RET C ;ERROR - ADD A,C ;NEW VALUE = OLD VALUE * 10 + DIGIT - RET C ;DON'T INC DE IF ERROR - LD L,A ;SET NEW VALUE - INC DE ;GOOD DIGIT - RET -; -; EXTRACT HEXADECIMAL NUMBER FROM COMMAND LINE -; RETURN WITH 8-BIT VALUE IN REG A AND 16-BIT VALUE IN HL -; ALL REGISTERS MAY BE AFFECTED -; -HEXNUM: - CALL SCANER ;PARSE NUMBER AND PLACE IN FCBFN -HNUM1: - LD HL,0 ;HL=ACCUMULATED VALUE - LD DE,FCBFN ;POINT TO TOKEN FOR CONVERSION -HNUM2: - LD A,(DE) ;GET CHARACTER - CP ' ' ;DONE? - JR Z,NUM3 ;RETURN IF SO - CP 'H' ;DONE IF H SUFFIX - JR Z,NUM3 - SUB '0' ;CONVERT TO BINARY - CP 10 ;0-9? - JR C,HNUM3 - SUB 17 ;A-F? - CP 6 ;ERROR? - JR NC,ERROR - ADD A,10 -HNUM3: - INC DE ;POINT TO NEXT CHARACTER - ADD HL,HL ;LEFT SHIFT 4 - ADD HL,HL - ADD HL,HL - ADD HL,HL - OR L ;MASK IN NEW LOW - LD L,A ;NEW LOW BYTE IN L - JR HNUM2 -; -; GET THE REQUESTED USER NUMBER FROM THE COMMAND LINE AND VALIDATE IT. -; -USRNUM: - CALL NUMBER - LD E,A - CP MAXUSR+1 - RET C -; -; INVALID COMMAND -- PRINT IT -; -ERROR: - CALL CRLF ;NEW LINE - LD HL,(CIPTR) ;POINT TO BEGINNING OF COMMAND LINE -ERR1: - LD A,(HL) ;GET CHARACTER - CP ' '+1 ;SIMPLE '?' IF OR LESS - CALL NC,CONOUT ;PRINT COMMAND CHARACTER OR FALL THRU - INC HL ;POINT TO NEXT - JR NC,ERR1 ;CONTINUE - CALL PRINT ;PRINT '?' - DC '?' - JP ABORT ;RESTART CPR -; -; POINT TO DIRECTORY ENTRY IN TBUFF WHOSE OFFSET IS SPECIFIED BY A AND C -; -DIRPTR: - LD HL,TBUFF ;POINT TO TEMP BUFFER - ADD A,C ;POINT TO 1ST BYTE OF DIR ENTRY - CALL ADDAH ;POINT TO DESIRED BYTE IN DIR ENTRY - LD A,(HL) ;GET DESIRED BYTE - RET -; -; CHECK FOR VALID USER AND LOG IN IF VALID -; -ULOGIN: - LD A,(FCBS1) ;GET USER NUMBER -ALOGIN: - ADD A,80H ;VALID? - CALL P,SETUSR ;SET IF VALID - RET -; -; EXTRACT TOKEN FROM COMMAND LINE AND PLACE IT INTO FCBDN; -; FORMAT FCBDN FCB IF TOKEN RESEMBLES FILE NAME AND TYPE (FILENAME.TYP); -; ON INPUT, CIBPTR PTS TO CHARACTER AT WHICH TO START SCAN; -; ON OUTPUT, CIBPTR PTS TO CHARACTER AT WHICH TO CONTINUE AND ZERO FLAG IS -; RESET IF '?' IS IN TOKEN -; -SCANER: - LD HL,FCBDN ;POINT TO FCBDN -SCAN1: - PUSH HL ;SAVE POINTER TO FCB - CALL ADVAN ;SKIP TO NON-BLANK OR END OF LINE - LD (CIPTR),DE ;SET POINTER TO NON-BLANK OR END OF LINE - JR Z,SCAN3 ;END OF COMMAND LINE - SBC A,'A' ;CONVERT POSSIBLE DRIVE SPEC TO NUMBER - CP 16 ;VALID DRIVE? - INC A ;CONVERT TO DRIVE (A=1, AND SO ON) - JR C,SCAN2 ;YES - XOR A ;SELECT DEFAULT DRIVE - DEC DE ;DON'T MOVE TO NEXT CHARACTER -SCAN2: - LD H,A ;STORE NUMBER (A:=0, B:=1, ETC) IN H - INC DE ;POINT TO NEXT CHARACTER - LD L,0 ;ZERO TOTAL - CALL A2NUM ;CONVERT FIRST DIGIT - JR C,SCAN3 ;NOT VALID - CALL A2NUM ;CONVERT SECOND DIGIT - LD A,L - SET 7,L ;MAKE VALID JUST IN CASE - CP MAXUSR+1 ;TOO BIG? - JR C,SCAN3 ;NO - LD A,(DE) ;ANY ':'? - CP ':' - JP Z,NAMERR ;YES, NAME ERROR -SCAN3: - LD A,(DE) ;SEE IF LAST CHARACTER IS A COLON (:) - INC DE ;POINT TO BYTE AFTER ':' - CP ':' - JR Z,SCAN4 ;YES, WE HAVE A DRIVE SPEC - LD HL,0 ;NOT VALID DRIVE SPEC, SWITCH TO DEFAULT - LD DE,(CIPTR) ;RESTART SCAN -; -; EXTRACT FILENAME FROM POSSIBLE FILENAME.TYP -; -SCAN4: - LD B,H ;MOVE DRIVE TO B - EX (SP),HL ;GET BACK FCB POINTER AND SAVE USER NUMBER - LD (HL),B ;SAVE DRIVE - LD B,8 ;MAX OF 8 CHARACTERS - XOR A ;CLEAR '?' COUNT - EX AF,AF ;AND SAVE - CALL SCANF ;GET POSSIBLE NAME - CALL SCANT ;AND POSSIBLE TYPE -; -; FILL IN EX, S1, S2, AND RC -; - XOR A - INC HL ;POINT TO NEXT BYTE IN FCBDN - LD (HL),A ;ZERO EX - INC HL - POP BC ;GET BACK USER NUMBER - LD (HL),C ;STUFF AWAY USER NUMBER IN S1 - INC HL - LD (HL),A ;ZERO S2 - INC HL - LD (HL),A ;ZERO RC -; -; SCAN COMPLETE -- DE POINTS TO DELIMITER BYTE AFTER TOKEN -; - LD (CIBPTR),DE - EX AF,AF ;GET NUMBER OF '?' IN FILENAME.TYP - RET -; -; EXTRACT FILE TYPE FROM POSSIBLE FILENAME.TYP -; -SCANT: - LD B,3 ;PREPARE TO EXTRACT TYPE - CP '.' ;IF (DE) DELIMITER IS A '.', WE HAVE A TYPE - JR NZ,SCAN11 ;FILL FILE TYPE WITH - INC DE ;POINT TO CHARACTER IN COMMAND LINE AFTER '.' -SCANF: - LD C,' ' ;FILL CHARACTER -SCAN11: - INC HL ;STEP TO NEXT BYTE IN FCBN - CALL SDELM ;CHECK FOR DELIMITER - JR Z,SCAN12 ;FILL REST WITH FILL BYTE IF A DELIMITER - CP '*' ;WILD? - JR NZ,SCAN13 ;NO - LD C,'?' ;CHANGE FILL BYTE TO '?' -SCAN12: - DEC DE ;DON'T STEP OFF CURRENT SYMBOL - LD A,C ;GET FILL BYTE -SCAN13: - CP '?' ;QUESTION MARK? - JR NZ,SCAN14 ;NO, JUST STORE CHARACTER - EX AF,AF ;GET QUESTION MARK COUNT - INC A ;COUNT IT - EX AF,AF ;AND SAVE COUNT -SCAN14: - INC DE ;POINT TO NEXT CHARACTER IN COMMAND LINE - LD (HL),A ;STORE CHARACTER IN FCBDN - DJNZ SCAN11 ;COUNT DOWN CHARACTERS IN FILE TYPE (3 MAX) -SCAN15: - CALL SDELM ;SKIP REST OF CHARACTERS TO - RET Z ;DELIMITER - INC DE - JR SCAN15 -; -; CMDTBL (COMMAND TABLE) SCANNER -; JUMPS TO ADDRESS OF COMMAND IF CPR-RESIDENT -; JUMPS TO COM IF NOT CPR-RESIDENT COMMAND -; -CMDSER: - LD A,(FCBFN) ;ANY COMMAND? - CP ' ' ;' ' MEANS COMMAND WAS 'D:' TO SWITCH - LD A,(FCBS1) ;GET USER NUMBER IF ANY - LD HL,FCBDN ;POINT TO DRIVE - JR NZ,CMS0 ;NOT , SO MUST BE COMMAND - ADD A,80H ;CONVERT TO USER NUMBER - CALL P,NEWUSR ;SET IF VALID USER IN FCB - LD A,(HL) ;LOOK FOR DRIVE SPEC - DEC A ;ADJUST FOR LOG IN - CALL P,TLOGIN ;LOG IN DRIVE -SETUDB: - LD A,(TMPUSR) ;GET CURRENT USER NUMBER - ADD A,A ;PLACE IT IN HIGH NIBBLE - ADD A,A - ADD A,A - ADD A,A - LD HL,TDRIVE ;ADD DEFAULT DRIVE NUMBER (LOW NIBBLE) - OR (HL) - LD (UDFLAG),A ;UPDATE USER/DRIVE BYTE - RET -CMS0: - OR (HL) ;DRIVE OR USER NUMBER - JR NZ,CMS5 ;YES, CAN'T BE BUILT IN COMMAND - LD HL,CMDTBL ;POINT TO COMMAND TABLE - LD B,NCMNDS ;SET COMMAND COUNTER -CMS1: - LD DE,FCBFN ;POINT TO STORED COMMAND NAME -CMS2: - LD A,(DE) ;COMPARE AGAINST TABLE ENTRY - XOR (HL) - ADD A,A - JR NZ,CMS3 ;NO MATCH - INC DE ;POINT TO NEXT CHARACTER - INC HL - JR NC,CMS2 ;NOT END OF TABLE ENTRY - LD A,(DE) ;NEXT CHARACTER IN INPUT COMMAND MUST BE - CP ' ' - JR NZ,CMS4 - LD A,(HL) ;FOUND COMMAND, - INC HL ;LOAD ADDRESS, - LD H,(HL) ;AND - LD L,A ;JUMP TO IT - JP (HL) ;COMMAND IS CPR-RESIDENT -CMS3: - BIT 7,(HL) ;END OF TABLE ENTRY? - INC HL - JR Z,CMS3 ;NO -CMS4: - INC HL ;SKIP ADDRESS - INC HL - DJNZ CMS1 ;NOT TO END OF TABLE YET -CMS5: - JP COM ;COMMAND MAY BE DISK-RESIDENT -; -;**** Section 5 **** -; CPR-Resident Commands -; -; -;Section 5A -;Command: DIR -;Function: To display a directory of the files on disk. -;Forms: -; DIR Display the DIR files -; DIR S Display the SYS files -; DIR B Display both DIR and SYS files -; DIR A Display both DIR and SYS files for all user numbers -; -DIR: - CALL SCANER ;EXTRACT POSSIBLE D:FILENAME.TYP TOKEN - CALL ULOGIN ;LOG ANY USER - LD HL,FCBFN ;MAKE FCB WILD (ALL '?') IF NO FILENAME.TYP - LD A,(HL) ;GET FIRST CHARACTER OF FILENAME.TYP - CP ' ' ;IF , ALL WILD - JR NZ,DIR2 - LD B,11 ;NUMBER OF CHARACTERS IN FN & FT -DIR1: - LD (HL),'?' ;STORE '?' - INC HL - DJNZ DIR1 -DIR2: - CALL ADVAN ;LOOK AT NEXT INPUT CHARACTER - LD B,0FFH ;LOAD ALL FILES FLAG - CP USRFLG ;ALL FILES ON DISK? - JR Z,DIR4 ;YES - LD B,80H ;IN CASE SYS ONLY - CP SOFLG ;SYS ONLY? - JR Z,DIR4 ;YES - CP SYSFLG ;HAVE SYSTEM SPECIFIER? - LD A,B ;SET SYSTEM BIT EXAMINATION - LD B,0 ;SYSTEM TOKEN DEFAULT - JR NZ,DIRPR -DIR4: - INC DE - LD (CIBPTR),DE - LD A,B - ;DROP INTO DIRPR TO PRINT DIRECTORY - ;THEN RESTART CPR -; -; DIRECTORY PRINT ROUTINE; ON ENTRY, A IS 80H IF SYSTEM FILES EXCLUSIVELY -; -DIRPR: - LD D,A ;STORE SYSTEM FLAG IN D - LD A,B ;SAVE SYSTST - LD (SYSTST),A - XOR A ;SET COLUMN COUNTER TO 0 - LD B,A ;AND USER NUMBER JUST IN CASE -DIRPR1: - ADD A,03H ;FORCE CRLF - AND 0FCH - LD E,A - PUSH DE - INC D ;ALL USER NUMBERS? - PUSH BC ;SAVE USER NUMBER - LD A,B ;AND - CALL Z,SETUSR ;SET IF ALL USER NUMBERS - CALL SEARF ;SEARCH FOR SPECIFIED FILE (FIRST OCCURRENCE) -DIRPR2: - POP BC ;GET BACK USER NUMBER - POP DE ;AND SYSTEM FLAG - JR NZ,DIRPR4 ;FILE FOUND - LD A,B ;AT LAST USER NUMBER? - INC B ;STEP TO NEXT USER NUMBER - CP MAXUSR - LD A,E ;IN CASE DONE - JR NC,DIRPR3 ;DONE - LD E,D ;EITHER WAY, E IS GOING TO BE CHANGED - INC E - JR Z,DIRPR1 ;PRINT ALL USER NUMBERS -DIRPR3: - AND A ;ANY PRINTED? - JP CHKFND ;GO CHECK -; -; ENTRY SELECTION LOOP; ON ENTRY, A=OFFSET FROM SEARF OR SEARN -; -DIRPR4: - DEC A ;ADJUST TO RETURNED VALUE - RRCA ;CONVERT NUMBER TO OFFSET INTO TBUFF - RRCA - RRCA - LD C,A ;OFFSET INTO TBUFF IN C (C=OFFSET TO ENTRY) - LD A,10 ;ADD 10 TO POINT TO SYSTEM FILE ATTRIBUTE BIT - CALL DIRPTR - PUSH DE - AND D ;MASK FOR SYSTEM BIT - INC D ;ALL FILES? - JR Z,DIRPR5 ;YES - LD HL,SYSTST ;SYSTEM FILE? - CP (HL) - JR NZ,DIRPR9 ;NO -DIRPR5: - LD A,E ;WHAT TO PRINT -; - IF TWOCOL - AND 01H ;OUTPUT IF 2 ENTRIES PRINTED IN LINE - ELSE -; - AND 03H ;OUTPUT IF 4 ENTRIES PRINTED IN LINE - ENDIF -; - CALL Z,CRLF ;NEWLINE ALWAYS RETURNS ZERO TRUE - JR Z,DIRPR6 - CALL PRINT -; - IF WIDE - DEFB ' ' ;2 SPACES - DEFB FENCE ;THEN FENCE CHARACTER - DC ' ' ;THEN 2 MORE SPACES - ELSE -; - DEFB ' ' ;SPACE - DEFB FENCE ;THEN FENCE CHARACTER - DC ' ' ;THEN SPACE - ENDIF -; -DIRPR6: - POP DE - INC E ;BUMP NUMBER OF FILES LISTED - PUSH DE - INC D ;PRINT WITH USER NUMBER? - JR NZ,DIRPR8 ;NO - LD A,B ;GET USER NUMBER AND - CALL PRUSRN ;AND PRINT - DEFB USRDLM+80H ;USER NUMBER DELIMITER -DIRPR8: - XOR A ;DON'T EAT SPACES - CALL PRFN -DIRPR9: - PUSH BC - CALL SEARN ;GET NEXT FILENAME - JR DIRPR2 -PRFN: - PUSH BC - LD B,A ;SAVE EAT SPACES FLAG - LD A,1 - CALL DIRPTR ;HL NOW POINTS TO 1ST BYTE OF FILE NAME - LD C,B ;SAVE EAT SPACES FLAG - LD B,12 ;12 CHARACTER TOTAL -PRFN1: - LD A,B ;CHECK FOR FILE TYPE - CP 04H - LD A,(HL) - RES 7,A - JR NZ,PRFN2 ;NOT YET AT TYPE - DEC HL ;ADJUST HL FOR TYPE DELIMITER - CP ' ' ;NO FILE TYPE? - JR Z,PRFN2 ;CONTINUE IF SO - LD A,'.' ;FILE TYPE EXISTS, PRINT DOT -PRFN2: - INC HL ;STEP TO NEXT CHARACTER - CP C ;EAT SPACES? - CALL NZ,CONOUT - DJNZ PRFN1 - POP BC - RET -; -;Section 5B -;Command: ERA -;Function: To erase files; names of the erased files are displayed. -;Forms: -; ERA -; -ERA: - CALL SCANER ;PARSE FILE SPECIFICATION - CP 11 ;ALL WILD (ALL FILES = 11 '?')? - JR NZ,ERA1 ;IF NOT, THEN DO ERASES - CALL REPLY - JP NZ,RESTRT ;RESTART CPR IF NOT -ERA1: - CALL ULOGIN ;LOG ANY USER - XOR A ;PRINT ALL FILES (EXAMINE SYSTEM BIT) - LD B,A ;NO SYS-ONLY OPT TO DIRPR - CALL DIRPR ;PRINT DIRECTORY OF ERASED FILES -ERA2: - LD DE,FCBDN ;DELETE FILE SPECIFIED - JP DELETE ;REENTER CPR VIA DELETE -; -;Section 5C -;Command: ERAQ -;Function: To erase files with individual query. -;Forms: -; ERAQ -; ? Y -; : -; : -; -ERAQ: - CALL SCANER ; parse file specification - CALL ULOGIN ; log any user - LD HL,01FFH ; load first flag -ERAQ1: - CALL SEARF ; find first entry - JR NZ,ERAQ2 ; found one - INC L ; ever found any? -; -; Check for File Found -; -CHKFND: - RET NZ ; yes -; -; No File Error Message -; -PRNNF: - CALL PRINTC ;NO FILE MESSAGE - DC 'No File' - RET -ERAQ2: - LD L,H ; restart found count -ERAQ3: - DEC H ; at file to erase? - JR NZ,ERAQ5 ; no - INC H ; reset H to 1 - INC L ; step count in case don't delete - PUSH HL ; save flag first - DEC A ; compute offset - RRCA - RRCA - RRCA - LD C,A - CALL CRLF - LD A,' ' ; eat spaces - CALL PRFN ; print file name - CALL REPLY1 ; prompt - JR NZ,ERAQ4 ; reply not 'Y' - XOR A - CALL DIRPTR ; get FCB to delete - LD A,(FCBDN) ; get drive specification - LD (HL),A ; select drive - EX DE,HL - CALL DELETE ; go delete - POP HL ; get flags - DEC L ; reduce count since file deleted - LD H,L ; update next file to process - JR ERAQ1 ; and restart process -ERAQ4: - POP HL ; get count -ERAQ5: - CALL SEARN ; find next file - JR NZ,ERAQ3 ; more files, go ask - RET ; done -; -;Section 5D -;Command: SAK -;Function: To pause until a key is struck; ^C warm boots. -;Forms: -; SAK -; ? -; -SAK: - CALL CRLF ; strike any key - JR REPLY1 -REPLY: - CALL PRINTC - DC 'All' -REPLY1: - CALL PRINT - DC '? ' -REPL2: - CALL BREAK ; get response - JR Z,REPL2 ; none - CALL UCASE - CP 'Y' - RET -; -;Section 5E -;Command: BELL -;Function: To ring terminal bell. -;Forms: -; BELL -; -RING: - LD A,BELL ; load bell into A - JP CONOUT ; and output it -; -;Section 5F -;Command: LIST -;Function: To print specified file on list device. -;Forms: -; LIST Print file -; LIST P Print file without default paging -; -LIST: -; - IF FFKILL - LD HL,NLINEP+0580H ; lines/page, first ff and list flags - ELSE - LD HL,NLINEP+0500H ; lines/page and list flag - ENDIF -; - JR TYPE1 -; -;Section 5G -;Command: TYPE -;Function: To display specified file on console. -;Forms: -; TYPE Display file -; TYPE P Display file without default paging -; -TYPE: -; - IF FFKILL - LD HL,NLINES+0280H ; lines/page, first ff and type flags - ELSE - LD HL,NLINES+0200H ; lines/page and type flag - ENDIF -; -TYPE1: - LD (LNCNT),HL ; save list/type flag and line cnt - XOR A ; initialize tab count - LD (TABCNT),A ; initialize line and tab count - CALL SCANER ; extract filename.typ token - JP NZ,NAMERR ; error if any question mark - CALL ADVAN ; get pgdflg if it's there - JR Z,PGDON ; jump if no more on cmd line - XOR PGDFLG ; change page flag? - JR NZ,PGDON ; no - INC DE ; step over pgdflg - LD (CIBPTR),DE ; and save cmd buffer pointer - DEC A ; no page flag is 0ffh - LD (LNCNT),A ; save flag -PGDON: - CALL ULOGIN ; log any user - CALL OPENF ; open selected file - JR Z,TYPE3 ; abort if error - CALL CRLF ; new line -TYPE2: - CALL READF ; read next block - JR Z,TYPE4 ; read ok (A register is zero) - DEC A ; error or eof? - RET Z ; eof -TYPE3: - JP PRNNF ; error -CHK4LF: - LD A,(LNCNT) ; get line count (just in case) - DJNZ CHK4VT ; not lf, try vertical tab - RES 7,A ; reset first ff flag (if any) - CP 07FH ; paging off? - JR Z,CHK4VT ; yes - DEC A ; time to page? - JR Z,CHKFF ; yes! -CHK4VT: - DEC B ; step over vt -CHK4FF: - DJNZ CHK4CR ; not ff, try vt - BIT 7,A ; first ff? - JR NZ,NXTCHR ; yes, ignore -CHKFF: - LD A,(TYPLST) - BIT 0,A ; type or list? - LD E,FF ; load ff into character reg - LD A,NLINEP ; reset list count - JR NZ,CHK4CR ; list -CHKFF1: - LD C,06H ; direct console i/o - LD E,0FFH ; conditional console input - CALL BDOSJP - JR Z,CHKFF1 ; no character yet - CALL CHKETX ; check for ^C - LD A,NLINES ; type line count - LD E,LF -CHK4CR: - LD (LNCNT),A ; save line count - CALL PAGER ; output character - DJNZ NXTCHR ; not cr - LD (HL),B ; reset tab count -NXTCHR: - LD A,(CHRCNT) ; get buffer pointer - INC A ; step to next character - CP 128 ; end-of-buffer? - JR NC,TYPE2 ; yes, read next buffer -TYPE4: - LD (CHRCNT),A ; save buffer count - LD HL,TBUFF ; point to buffer - CALL ADDAH ; compute address of next character - LD A,(HL) ; get character to accumulator - AND 7FH ; mask out msb - CP 1AH ; end-of-file (^Z)? - RET Z ; yes, restart zcpr - LD HL,TABCNT ; pointer to tab counter - LD E,A ; save character in e reg - SUB BS ; backspace? - LD B,A ; in case not bs - JR NZ,CHK4HT ; not bs - DEC (HL) ; step tab count and fall thru -CHK4HT: - DJNZ CHK4LF ; no, check for line feed -CHKHT: - LD E,' ' ; load space into bdos character reg - CALL PAGER ; print space - LD A,(HL) ; now in col 0 mod 8? - AND 07H - JR NZ,CHKHT ; go for more - JR NXTCHR -PAGER: - CALL BREAK ; check for abort - LD A,(TYPLST) ; get list/type flag - LD C,A -; - IF TEST OR NOT NOSTAT - AND 00000010B ; list? - EXX ; save registers - CALL Z,LISTST ; check busy - EXX ; restore registers - AND A - JR Z,PAGER ; printer not ready - ENDIF -; - LD A,E ; check for printing character - CP ' ' - JR C,PAGE2 ; control character, don't count - INC (HL) ; step position -PAGE2: - JP BDOSJP ; return via bdos -; -;Section 5H -;Command: PAGE -;Function: To eject a page on list device via a form feed. -;Forms: -; PAGE -; -EJECT: - CALL BREAK ; check for ^C -; - IF TEST OR NOT NOSTAT - CALL LISTST ; check printer ready - AND A - JR Z,EJECT ; not ready yet - ENDIF -; - LD E,FF ; now for form feed - LD C,05H ; list output - JP BDOS ; output character and return via bdos -; -;Section 5I -;Command: SAVE -;Function: To save the contents of TPA onto disk as a file. Number of -; pages or records is in decimal. Saved area begins at 100H. -;Forms: -; SAVE -; SAVE R -; -SAVE: - CALL NUMBER ;EXTRACT NUMBER FROM COMMAND LINE - PUSH HL ;SAVE IT - CALL SCANER ;EXTRACT FILENAME.TYP - JP NZ,NAMERR ;MUST BE NO '?' IN IT - CALL ULOGIN ;LOG ANY USER - CALL ERA2 ;DELETE FILE IF POSSIBLE - CALL CREATE ;CREATE NEW FILE - JR Z,SAVE4 ;UNSUCCESSFUL - XOR A ;SET RECORD COUNT FIELD OF NEW FILE'S FCB - LD (FCBCR),A - CALL ADVAN ;LOOK FOR RECORD OPTION - INC DE ;POINT TO TOKEN - POP HL ;GET BACK PAGE COUNT - CP RECFLG - JR Z,SAVE1 - DEC DE ;NO TOKEN, SO BACK UP - ADD HL,HL ;DOUBLE IT FOR HL=RECORD (128 BYTES) COUNT -SAVE1: - LD (CIBPTR),DE ;SET POINTER TO BAD TOKEN OR AFTER GOOD TOKEN - LD DE,TPA ;POINT TO START OF SAVE AREA (TPA) -SAVE2: - LD A,H ;DONE WITH SAVE? - OR L ;HL=0 IF SO - JR NZ,SAVE3 - LD DE,FCBDN ;CLOSE SAVED FILE - JP CLOSE ;AND RESTART CPR -SAVE3: - DEC HL ;COUNT DOWN ON RECORDS - PUSH HL ;SAVE POINTER TO BLOCK TO SAVE - CALL DMASET ;SET DMA ADDRESS FOR WRITE (ADDRESS IN DE) - LD HL,128 ;128 BYTES PER RECORD - ADD HL,DE ;POINT TO NEXT RECORD - LD DE,FCBDN ;WRITE RECORD - CALL WRITE - EX DE,HL ;GET POINTER TO NEXT RECORD IN DE - POP HL ;GET RECORD COUNT - JR Z,SAVE2 ;NO WRITE ERROR -SAVE4: - JP PRNLE ;PRINT 'NO SPACE' ERROR -; -;Section 5J -;Command: REN -;Function: To change the name of an existing file. -;Forms: -; REN = -; -REN: - LD HL,FCBDN+16 ;PLACE FILENAME IN SECOND HALF OF FCB - PUSH HL ;SAVE POINTER FOR SEARCH FIRST - CALL SCAN1 ;EXTRACT FILE NAME - JR NZ,NAMERR ;ERROR IF ANY '?' IN IT - CALL ADVAN ;ADVANCE CIBPTR - CP '=' ;'=' OK - JP NZ,ERROR - EX DE,HL ;POINT TO CHARACTER AFTER '=' IN HL - INC HL - LD (CIBPTR),HL ;SAVE POINTER TO OLD FILE NAME - CALL SCANER ;EXTRACT FILENAME.TYP TOKEN - JR NZ,NAMERR ;ERROR IF ANY '?' - LD A,(FCBDN+16+13) ;GET POSSIBLE USER NUMBER - CALL ALOGIN ;LOG ANY USER - POP DE ;GET POINTER FOR SEARCH FIRST - CALL SEARDE ;CHECK FOR NONE OF THAT NAME - JR Z,REN1 ;NO FILE EXISTS - CALL PRINTC ;DUPLICATE NAME - DC 'Delete' - CALL REPLY1 ;GET REPLY - JR NZ,REN2 ;NOT A 'Y' - CALL DELETE ;DELETE DUPLICATE -REN1: - LD A,(DE) ;GET POSSIBLE DRIVE - LD DE,FCBDN ;POINT TO FCB - LD (DE),A ;SAVE POSSIBLE DRIVE - LD C,17H ;BDOS RENAME FCT - CALL BDOSFN - JP CHKFND ;CHECK FOR FILE FOUND -NAMERR: - CALL PRINTC - DC 'Name Error' -REN2: - JP ABORT -; -;Section 5K -;Command: USER -;Function: To change current user number; new user number is in decimal. -;Forms: -; USER -; -USER: - CALL USRNUM ;EXTRACT USER NUMBER FROM COMMAND LINE - JP NEWUSR ;SET NEW USER NUMBER -; -;Section 5L -;Command: DFU -;Function: To set the Default User Number for the command/file scanner; new -; default user number is in decimal. -;Forms: -; DFU -; -DFU: - CALL USRNUM ;GET USER NUMBER - LD (DFUSR),A ;PUT IT AWAY - RET -; -;Section 5M -;Command: SCL -;Function: To force ZCPR to parse only a single command per line; reset -; to multiple command format at the next ^C. -;Forms: -; SCL -; - IF MULTPL -SINGLE: - LD HL,NEWCMD ; point at current command separator - LD A,CMDCHR ; get default command separator - XOR (HL) ; flip current separator - LD (HL),A ; save new command separator - RET - ENDIF -; -; -;Section 5N -;Command: PEEK -;Function: To display hex values beginning at a specified address. -;Forms: -; PEEK [] -; -PEEK: - CALL HEXNUM ; get display address - PUSH HL ; save it - CALL HEXNUM ; get optional count - LD C,L ; save count - POP HL ; get back address -PEEK1: - CALL CRLF ; start new line - CALL PRHEXW ; print address - LD B,16 ; 16 values per line -PEEK2: - CALL PRINT ; space over - DC ' ' - LD A,(HL) ; get hex value - INC HL ; step to next value - CALL PRHEXA ; display value - DEC C ; done? - RET Z ; yes - DJNZ PEEK2 ; not end of line - JR PEEK1 ; end of line -PRHEXW: - LD A,H ; print hex word in hl - CALL PRHEXA - LD A,L -PRHEXA: - PUSH AF ; save right nibble - RRCA ; move left nibble to right - RRCA - RRCA - RRCA - CALL PRHEX ; display left nibble - POP AF ; get back right nibble -PRHEX: - AND 0FH ; convert to ascii - ADD A,90H - DAA - ADC A,40H - DAA - JP CONOUT ; go display value -; -; -;Section 5O -;Command: POKE -;Function: To poke a string of hex values into a set of consecutive addresses. -;Forms: -; POKE [] -; -POKE: - CALL HEXNUM ; get address -POKE1: - PUSH HL ; save address - CALL HEXNUM ; get next byte - LD A,(FCBFN) ; done? - CP ' ' - LD A,L ; save byte - POP HL ; get back address - RET Z ; done - LD (HL),A ; save byte - INC HL ; step to next address - JR POKE1 ; go for more -; -; -;Section 5P -;Command: JUMP -;Function: To call the program (subroutine) at the specified address -; without loading from disk. -;Forms: -; JUMP -; -JUMP: - CALL HEXNUM ;GET LOAD ADDRESS IN HL - JR CLLPRG ;PERFORM CALL -; -;Section 5Q -;Command: COM file processing -;Function: To load the specified COM file from disk and execute it. -;Forms: -; -; -COM: - LD HL,FCBFT ;FILE TYPE MUST BE BLANK - LD A,(HL) - CP ' ' - JP NZ,ERROR - LD (HL),'C' ;PLACE DEFAULT FILE TYPE (COM) INTO FCB - INC HL ;COPY INTO FILE TYPE - LD (HL),'O' ;3 BYTES - INC HL - LD (HL),'M' - LD HL,TPA ;SET EXECUTION/LOAD ADDRESS - CALL MEMLD ;LOAD MEMORY WITH FILE SPECIFIED - ;(NO RETURN IF ERROR OR TOO BIG) -; -;Section 5R -;Command: GO -;Function: To call the program in the TPA without loading from disk. -; Same as JUMP 100H, but more convenient, especially when -; used with parameters for programs like STAT. -;Form: -; GO -; -GO: - LD HL,TPA ;ALWAYS TO TPA -; -; -; CLLPRG IS THE ENTRY POINT FOR THE EXECUTION OF THE LOADED PROGRAM -; ON ENTRY TO THIS ROUTINE, HL MUST CONTAIN THE EXECUTION -; ADDRESS OF THE PROGRAM (SUBROUTINE) TO EXECUTE -; -CLLPRG: - PUSH HL ;SAVE EXECUTION ADDRESS - LD HL,(CIBPTR) ;SAVE THE COMMAND TAIL START ADDRESS - PUSH HL - LD HL,TFCB ;MAKE FCB FOR PROGRAM - CALL SCAN1 ;SEARCH COMMAND LINE FOR NEXT TOKEN - LD HL,TFCB+16 ;OFFSET FOR 2ND FILE SPEC - CALL SCAN1 ;SCAN FOR IT AND LOAD IT INTO FCBDN+16 - XOR A - LD (TFCB+32),A ;ZERO RECORD COUNT -; -; LOAD COMMAND LINE INTO TBUFF -; - POP HL ;GET LOCATION OF COMMAND TAIL -NEWCMD EQU $+1 ;IN-LINE COMMAND SEPARATOR - LD BC,CMDCHR+0FF00H;INITIALIZE COUNT AND GET COMMAND FLAG - LD DE,TBUFF ;DESTINATION FOR COMMAND TAIL -COM2: - INC DE ;POINT TO DESTINATION - INC B ;INCREMENT CHARACTER COUNT - LD A,(HL) ;COPY CHARACTER TO TBUFF - LD (DE),A - INC HL ;STEP TO NEXT SOURCE CHARACTER - OR A ;END OF LINE? -; - IF MULTPL - JR Z,COM3 ;YES, END OF LINE - XOR C ;START OF NEXT COMMAND? - JR NZ,COM2 ;NO - LD (DE),A ;0 TERMINATE STRING -COM3: -; - ELSE -; - JR NZ,COM2 ;NOT END OF LINE - ENDIF -; - LD A,B ;SAVE CHARACTER COUNT - LD (TBUFF),A - DEC HL ;BACK UP ONE CHARACTER - LD (CIBPTR),HL ;SAVE FOR START OF NEXT COMMAND SCAN -; -; RUN LOADED TRANSIENT PROGRAM -; - CALL CRLF ;NEW LINE - CALL DEFDMA ;SET DMA TO 0080 - CALL RSTUSR ;RESET TO PROPER USER NUMBER -; -; EXECUTION (CALL) OF PROGRAM (SUBROUTINE) OCCURS HERE -; - RET ;CALL TRANSIENT -; -;Section 5S -;Command: GET -;Function: To load the specified file from disk to the specified address -;Forms: -; GET Load the specified file at the specified page; -; -GET: - CALL HEXNUM ;GET LOAD ADDRESS IN HL - PUSH HL ;SAVE ADDRESS - CALL SCANER ;GET FILE NAME - POP HL ;RESTORE ADDRESS - JP NZ,NAMERR ;MUST BE UNAMBIGUOUS -; -; LOAD MEMORY WITH COMMAND LINE FILE -; ON INPUT, HL CONTAINS STARTING ADDRESS TO LOAD -; IF COM FILE TOO BIG, EXIT TO ERROR. -; -MEMLD: - LD (LDADR),HL ;SET LOAD ADDRESS -; -; MLA is a reentry point for a non-standard CP/M Modification -; This is the return point when the .COM (or GET) file is not found the -; first time, the Default User is selected for the second attempt -; and Drive A is selected for the final attempt. -; -MLA: - CALL ULOGIN ;LOG ANY USER - LD HL,(FCBS1) ;SAVE ANY USER NUMBER - CALL OPENF ;OPEN COMMAND.COM FILE - JR NZ,MLA1 ;FILE FOUND - LOAD IT -; -; FILE NOT FOUND - SELECT DEFAULT USER -; - LD A,L ;GET FCB USER - AND A ;DEFAULT USER? - JR NZ,MLA0 ;NO - LD HL,TMPUSR ;CURRENT USER SAME AS DEFAULT? - LD A,(DFUSR) ;GET DEFAULT USER - CP (HL) - SET 7,A ;MAKE INTO VALID USER NUMBER - LD (FCBS1),A ;PUT USER INTO FCB - JR NZ,MLA ;AND TRY AGAIN -; -; FILE NOT FOUND - SELECT DRIVE A IF DEFAULT WAS SOME OTHER DRIVE -; -MLA0: - LD A,(TDRIVE) ;DRIVE A DEFAULT? - AND A - JR Z,MLA3 ;YES, ERROR - XOR A - LD HL,FCBDN ;POINT AT DRIVE IN FCB - OR (HL) ;DRIVE ALREADY SPECIFIED? - LD (HL),1 ;SELECT DRIVE A - JR Z,MLA ;NO, GO GIVE IT A TRY -MLA3: - CALL PRNNF ;CAN'T FIND FILE - JR PRNLE1 -; -; FILE FOUND -- PROCEED WITH LOAD -; -MLA1: - LD HL,(LDADR) ;GET START ADDRESS OF MEMORY LOAD -MLA2: - LD A,ENTRY/256-1 ;GET HIGH-ORDER ADR OF JUST BELOW CPR - CP H ;ARE WE GOING TO OVERWRITE THE CPR? - JR C,PRNLE ;ERROR IF SO - EX DE,HL ;MOVE LOAD ADDRES FOR DMASET - CALL DMASET ;SET DMA ADDRESS - LD HL,128 ;COMPUTE NEXT LOAD ADDRESS - ADD HL,DE ;AND SAVE ANSWER IN HL - CALL READF ;READ NEXT RECORD - JR Z,MLA2 ;READ ERROR OR EOF? - DEC A ;LOAD COMPLETE - JP Z,RSTUSR ;GO RESET CORRECT USER -; -; LOAD ERROR -; -PRNLE: - CALL PRINTC - DC 'Full' -PRNLE1: - JP ABORT -; - IF (($-ENTRY) GT ZCPRSZ) - *ZCPR too large!!* - ENDIF -; - IF TEST -LISTST: - LD A,2DH ;COMPUTE LIST STATUS ENTRY - DEFB 0FEH ;SKIP NEXT BYTE -BOOT: - XOR A ;COMPUTE BOOT ENTRY - LD HL,(BASE+1) ;GET PAGE ADDRESS OF BIOS - LD L,A ;ADD ENTRY - JP (HL) ;GO TO BIOS ROUTINE - ENDIF - -ENDLD EQU $ - - END - - PUSH HL ;SAVE POI \ No newline at end of file diff --git a/Source/ZCPR-DJ/zcprdemo.com b/Source/ZCPR-DJ/zcprdemo.com deleted file mode 100644 index 83cc9798..00000000 Binary files a/Source/ZCPR-DJ/zcprdemo.com and /dev/null differ diff --git a/Source/ZCPR-DJ/zcprdemo.mac b/Source/ZCPR-DJ/zcprdemo.mac new file mode 100644 index 00000000..d00820d0 --- /dev/null +++ b/Source/ZCPR-DJ/zcprdemo.mac @@ -0,0 +1,2020 @@ +; DATE 06/02/21 08:08:00 +; +; TITLE ZCPR Console Command Processor - Version D&J +; SUBTTL Last Modified: 10 August 1997 + +; CP/M Z80 Command Processor Replacement (CPR) Version 1.0 +; CCPZ CREATED AND CUSTOMIZED FOR ARIES-II BY RLC +; FURTHER MODIFIED BY RGF AS V2.0 +; FURTHER MODIFIED BY RLC AS V2.1 +; FURTHER MODIFIED BY KBP AS V2.2 +; FURTHER MODIFIED BY RLC AS V2.4 (V2.3 skipped) +; FURTHER MODIFIED BY RLC AS V2.5 +; FURTHER MODIFIED BY RLC AS V2.6 +; FURTHER MODIFIED BY SBB AS V2.7 +; FURTHER MODIFIED BY RLC AS V2.8 +; FURTHER MODIFIED BY RLC AS V2.9 +; FURTHER MODIFIED BY RLC AS V3.0 +; FURTHER MODIFIED BY RLC AS V3.1 +; FURTHER MODIFIED BY RLC AS V4.0 +; ZCPR VERSION 1.0 CREATED FROM CCPZ VERSION 4.0 BY RLC IN +; A COORDINATED EFFORT WITH CCP-GROUP +; FURTHER MODIFIED BY SBB (AS CCPZ-V4.1 11/27/81) +; & MORE MODS BY ROBERT FISHER (CA. 12/1/81) +; [RETROFITTED TO ZCPR BY BEN BRONSON (12/22/81) AS ZCPR-BB] +; +; FURTHER MODIFIED BY DCK AS Version D&J +; +; ZCPR is a group effort by CCP-GROUP, whose active membership involved +; in this project consists of the following: +; RLC - Richard Conn +; RGF - Ron Fowler +; KBP - Keith Peterson +; FJW - Frank Wancho +; The following individual also provided a contribution: +; SBB - Steve Bogolub +; +; (Note by BB: SBB's and R Fisher's changes came too late in the +; history of CCPZ to be included in the first release of ZCPR) +; +; Extensive modifications to add ERAQ, DIR for all usrnum, +; LIST x.x P, and fix TYPE when FF encountered was done by Don +; Kirkpatrick, 20 September 1986. +; +; DCK - Don Kirkpatrick +; +; Further modified for better polling during LIST/TYPE, 16 July 1987. +; +; Further modified to include boot command and to permit multiple +; commands per line. Fixed bug in jump. Modified type so character +; is not echoed, 4 July 1988. +; +; Modified to add PAGE command 31 December 1989. +; +; Added BELL and SAK (Strike Any Key) command. +; +; Added ZCPR3 style drive/user number to all FCB parsing. For Example: +; A>c4: Changes to drive C/user 4 +; A>c4: Runs found on drive C/user 4 +; A>dir c4: Gives directory of drive C/user 4 +; A>ren =c4: +; Renames file found on drive C/user 4 +; Both the drive and user number are optional; 15: is a valid designation. +; S1 in the FCB is used to store the user number. If S1 contains a valid +; user number, bit 7 will be set. If no user number is specified, S1 will +; contain 0. +; +; Added POKE and changed SCL to a toggle, 12 August 1992. +; +; Added PEEK 30 August 1993. +; +; Added CLS 10 August 1997 and fixed two bugs. One caused the system to +; hang if the command to log into another drive was given while logged +; into a drive from which the disk had been removed. The other caused +; a warm boot to return to the prior user area if the new user number +; had been selected using the USER command (although not if the user area +; had been changed using the du: command). +; +;******** Structure Notes ******** +; +; This CPR is divided into a number of major sections. The following +; is an outline of these sections and the names of the major routines +; located therein. +; +; Section Function/Routines +; ------- ----------------- +; +; -- Opening Comments, Equates, and Macro Definitions +; +; 0 JUMP Table into CPR +; +; 1 Buffers +; +; 2 CPR Starting Modules +; CPR1 CPR RESTRT +; +; 3 Utilities +; CRLF PRINTC PRINT PRINTS BELL +; CLS CONOUT BREAK CHKETX ABORT +; READF READ WRITE DEFDMA DMASET +; SEARF SEARDE SEARN OPENF OPEN +; CLOSE CREATE BDOSFN SUBKIL DELETE +; TLOGIN DLOGIN LOGIN NEWUSR RSTUSR +; SETUSR BDOSEA BDOSJP BDOSBC BDOSDE +; +; 4 CPR Utilities +; PROMPT REDBUF CNVBUF UCASE SDELM +; ADVAN SBLANK ADDAH NUMBER A2NUM +; HEXNUM USRNUM ERROR DIRPTR ULOGIN +; SCANER SCANT SCANF CMDSER +; +; 5 CPR-Resident Commands and Functions +; 5A DIR DIRPR PRFN +; 5B ERA +; 5C ERAQ PRNNF +; 5D SAK REPLY +; 5E CLS +; 5F BELL +; 5G LIST +; 5H TYPE PAGER +; 5I EJECT +; 5J SAVE +; 5K REN +; 5L USER SUSER +; 5M DFU +; 5N SCL +; 5O PEEK +; 5P POKE +; 5Q JUMP +; 5R COM UPDATE +; 5S GO CLLPRG ERRLOG ERRJMP +; 5T GET MEMLD PRNLE +; BIOS BOOT +; +; +FALSE EQU 0 +TRUE EQU NOT FALSE +; +; +; CUSTOMIZATION EQUATES +; +; The following equates may be used to customize this CPR for the user's +; system and integration technique. The following constants are provided: +; +; TEST - TRUE to build at intermediate address to debug via debugger. +; +; COMLD - TRUE to test and execute as a .com file. +; +; REL - TRUE if integration is to be done via MOVCPM. +; +; BASE - Base Address of user's CP/M system (normally 0 for DR version). +; This equate eases modification by non-standard CP/M (eg. H89). +; +; P2DOS - Address of BDOS/P2DOS. +; +TEST EQU TRUE ;SET TO LOAD/RUN AT 8000H FOR DEBUG +COMLD EQU FALSE ;SET TO LOAD AND EXECUTE AS A .COM FILE +REL EQU FALSE ;SET TO TRUE FOR MOVCPM INTEGRATION + ;LEAVE ALL FALSE FOR SYSGEN IMAGE +; +BASE EQU 0 ;BASE OF CP/M SYSTEM +;P2DOS EQU 0E400H ;BASE OF BDOS/P2DOS (original) +P2DOS EQU 0D800H ;BASE OF BDOS/P2DOS (Retro-Brew) +ZCPRSZ EQU 00800H ;SIZE OF ZCPR +P2DOSSZ EQU 00E00H ;SIZE OF P2DOS +BIOS EQU P2DOS+P2DOSSZ ;BASE OF BIOS +CPRLOC DEFL P2DOS-ZCPRSZ ;STANDARD EXECUTION ADDRESS +; + IF REL +CPRLOC DEFL 0 ;MOVCPM IMAGE + ENDIF +; + IF TEST +CPRLOC DEFL 8000H + ELSE +BOOT EQU BIOS ;BIOS COLD BOOT ENTRY +LISTST EQU BIOS+002DH ;ENTRY POINT FOR LIST STATUS + ENDIF +; +; The following is presented as an option, but is not normally user-customize- +; able. A basic design choice had to be made in the design of ZCPR concerning +; the execution of SUBMIT files. The original CCP had a problem in this sense +; in that it ALWAYS looked for the SUBMIT file from drive A: and the SUBMIT +; program itself (SUBMIT.COM) would place the $$$.SUB file on the currently +; default drive. When the user was logged into B: and he issued a SUBMIT +; command, the $$$.SUB was placed on B: and did not execute. The CPR looked +; for $$$.SUB on A: and never found it. +; +; After much debate it was decided to have ZCPR perform the same type of +; function as CCP (look for the $$$.SUB file on A:), but the problem with +; SUBMIT.COM still exists. Hence, RGF designed SuperSUB and RLC took his +; SuperSUB and designed SUB from it; both programs are set up to allow the +; selection at assembly time of creating the $$$.SUB on the default drive +; or on drive A:. +; +; A final definition of the Indirect Command File ($$$.SUB or SUBMIT +; File) is presented as follows: +; +; "An Indirect Command File is one which contains +; a series of commands exactly as they would be +; entered from a CP/M Console. The SUBMIT Command +; (or SUB Command) reads this file and transforms +; it for processing by the ZCPR (the $$$.SUB File). +; ZCPR will then execute the commands indicated +; EXACTLY as if they were typed at the Console." +; +; Hence, to permit this to happen, the $$$.SUB file must always +; be present on a specific drive, and A: is the choice for said drive. +; With this facility engaged as such, Indirect Command Files like: +; +; DIR +; B: +; DIR +; +; can be executed, even though the currently default drive is changed +; during execution. If the $$$.SUB file was present on the currently +; default drive, the above series of commands would not work since the +; ZCPR would be looking for $$$.SUB on the default drive, and switching +; default drives without moving the $$$.SUB file as well would cause +; processing to abort. +; +; Note that the same problem can occur if the user number of the +; $$$.SUB file is not predefined. It is assumed that the $$$.SUB file +; is located on user 0 of the specified drive. +; +; The trick of using the $ flag returned by DISK RESET is used to +; to speed the search for a $*.* file on drive A. This trick will not +; work if the $$$.SUB file is located on another drive. +; +; +; Under the ZCPR, three command levels exist: +; +; (1) that command issued by the user from his console at the '>' prompt +; (2) that command issued by a $$$.SUB file at the '$' prompt +; (3) that command issued by a user program by placing the command into +; CIBUFF and setting the character count in CBUFF +; +; To use CIBUFF, the user program stores the command line and character +; count; ZCPR will initialize the pointers properly, store the ending zero, +; and capitalize the command line for processing. Once the command line is +; properly stored, the user executes the command line by reentering ZCPR +; through CPRLOC [NOTE: The C register MUST contain a valid User/Disk Flag +; (see location 4) at this time.] +; +; +; Directory customization equates +; +TWOCOL EQU FALSE ;TRUE FOR TWO-COLUMN DIRECTORY DISPLAY +WIDE EQU TRUE ;TRUE IF WIDE DIRECTORY DISPLAY +FENCE EQU '|' ;CHARACTER BETWEEN FILES +USRDLM EQU ':' ;CHARACTER BETWEEN USER NUMBER AND FILE +USRFLG EQU 'A' ;LIST $SYS AND $DIR FOR ALL USER NUMBERS +SYSFLG EQU 'B' ;LIST $SYS AND $DIR +SOFLG EQU 'S' ;LIST $SYS ONLY +; +; List and Type command customization equates +; +NLINES EQU 22 ;NUMBER OF LINES ON CRT PAGE +NLINEP EQU 60 ;NUMBER OF LINES ON LIST DEVICE +FFKILL EQU TRUE ;TRUE SUPPRESSES FF UNTIL FIRST CHARACTER +PGDFLG EQU 'P' ;TYPE AND LIST COMMAND DEFAULT TOGGLE +NOSTAT EQU FALSE ;SET TO TRUE IF BIOS LISTST NOT IMPLEMENTED +; +; Other customization equates +; +BUFLEN EQU 80 ;SIZE OF COMMAND INPUT BUFFER +MAXUSR EQU 15 ;MAXIMUM USER NUMBER ACCESSIBLE +DEFUSR EQU 0 ;DEFAULT USER NUMBER FOR COM FILES +DEFDRV EQU 'A' ;DEFAULT DRIVE FOR COM FILES +SPRMPT EQU '$' ;CPR PROMPT INDICATING SUBMIT COMMAND +COMCHR EQU '%' ;BEGIN COMMENT CHARACTER +CMDCHR EQU ';' ;BEGIN NEXT COMMAND CHARACTER +NUMBASE EQU 'H' ;CHARACTER USED TO SPECIFY HEXIDECIMAL BASE +RECFLG EQU 'R' ;CHARACTER FOR SAVE COMMAND TO SAVE RECORDS +SUPRES EQU TRUE ;TRUE TO SUPPRESS USER NUMBER FOR USER 0 +MULTPL EQU TRUE ;TRUE TO ALLOW MULTIPLE COMMANDS ON ONE LINE +REBOOT EQU TRUE ;TRUE TO INCLUDE BOOT COMMAND +CLSCHR EQU 1AH ;CHARACTER TO CLEAR TERMINAL SCREEN +ESC EQU 1BH ;VT100 LEAD-IN CHAR. (FOR 'CLS') +; + IF TEST +CPRMPT EQU '<' ;CPR PROMPT INDICATING TEST MODE + ELSE +CPRMPT EQU '>' ;CPR PROMPT INDICATING USER COMMAND + ENDIF +; +; END OF CUSTOMIZATION SECTION +; +ETX EQU 03H +BELL EQU 07H +BS EQU 08H +TAB EQU 09H +LF EQU 0AH +FF EQU 0CH +CR EQU 0DH +; +WBOOT EQU BASE+0000H ;CP/M WARM BOOT ADDRESS +UDFLAG EQU BASE+0004H ;USER NUMBER IN HIGH NIBBLE, DISK IN LOW +BDOS EQU BASE+0005H ;BDOS FUNCTION CALL ENTRY POINT +TFCB EQU BASE+005CH ;DEFAULT FCB BUFFER +TBUFF EQU BASE+0080H ;DEFAULT DISK I/O BUFFER +TPA EQU BASE+0100H ;BASE OF TPA +; +; +;**** Section 0 **** +; + .Z80 + ASEG + ORG 100H +; +; LOADER FOR TEST PURPOSES +; ALLOWS ONE TO EXECUTE ZCPR AS A .COM FILE +; + IF COMLD OR TEST + LD HL,BGNXFR + LD DE,CPRLOC + LD BC,ENDLD-BGNXFR + LDIR + LD BC,(UDFLAG) + JP CPRLOC +BGNXFR EQU $ + ENDIF +; + .PHASE CPRLOC +; +; ENTRY POINTS INTO ZCPR +; +; If the ZCPR is entered at location CPRLOC (at the JUMP to CPR), then +; the default command in CIBUFF will be processed. If the ZCPR is entered +; at location CPRLOC+3 (at the JUMP to CPR1), then the default command in +; CIBUFF will NOT be processed. +; +; NOTE: Entry into ZCPR in this way is permitted under ZCPR Version 4.0, +; but in order for this to work, CIBUFF and CBUFF MUST be initialized properly +; AND the C register MUST contain a valid User/Disk Flag (see Location 4: the +; most significant nibble contains the User Number and the least significant +; nibble contains the Disk Number.) +; +; Some user programs (such as SYNONYM3) attempt to use the default +; command facility. Under the original CPR, it was necessary to initialize +; a pointer located at the end of the command buffer to point to the first +; byte in the command buffer. Under Version 4.x of ZCPR, this is no longer +; the case. This pointer, CIBPTR (Command Input Buffer PoinTeR), has been +; moved and the former location is now reserved for the stack. ZCPR +; Version 4.x automatically initializes CIBPTR in all cases. +; +ENTRY: + JP CPR ; Process potential default command + JP CPR1 ; Do NOT process potential default command +; +;**** Section 1 **** +; +; BUFFERS ET AL +; +; INPUT COMMAND LINE AND DEFAULT COMMAND +; +; The command line to be executed is stored here. This command line +; is generated in one of three ways: +; +; (1) by the user entering it through the BDOS READLN function at +; the du> prompt [user input from keyboard]. +; (2) by the SUBMIT File Facility placing it there from a $$$.SUB +; file. +; (3) by an external program or user placing the required command +; into this buffer. +; +; In all cases, the command line is placed into the buffer starting at +; CIBUFF. This line contains the last character but NOT the Carriage +; Return, and the count is of all characters in the command line up to and +; including the last character. This count is placed into location CBUFF +; (immediately before the command line at CIBUFF.) If ZCPR is entered via +; CPRLOC, the command line is then parsed, interpreted, and the indicated +; command is executed. ZCPR places the terminating zero after the command +; and CIBPTR is properly initialized. +; +; WARNING: The command line must NOT exceed BUFLEN characters in length. +; For user programs which load this command, the value of BUFLEN can be +; obtained by examining the byte at CPRLOC+6. +; +; It is now possible to place multiple commands on one line. Each command +; is separated from its neighbor by a ";". This feature only works for ZCPR +; commands and programs that return to ZCPR via a RET instruction. Any +; warm boot reloads ZCPR and destroys the contents of the command buffer. +; The multiple command feature may be turned off with the SCL command. +; +;MBUFF: DEFB BUFLEN ;MAXIMUM BUFFER LENGTH +MBUFF: DEFB BUFEND-CIBUFF ;MAXIMUM BUFFER LENGTH +CBUFF: DEFB 0 ;NUMBER OF CHARACTERS IN COMMAND LINE +CIBUFF: DB ' ' ;DEFAULT (COLD BOOT) COMMAND 13 + DEFB 0 ;COMMAND STRING TERMINATOR 14 + DEFB ' ZCPR-D&J of 17 May 2021 ' ;44 + DEFB 0 ;TERMINATOR FOR DUMP IDENTIFICATION 45 +; DEFS BUFLEN-($-CIBUFF)+1 + db 0,0,0,0,0,0,0,0 ;53 + db 0,0,0,0,0,0,0,0 ;61 + db 0,0,0,0,0,0,0,0 ;69 + db 0,0,0,0,0,0,0,0 ;77 + db 0,0,0,0,0,0,0,0 ;85 + db 0,0,0,0,0,0,0,0 ;93 + db 0,0,0 ;96 +; DEFB 0,0,0,0,0,0,0,0 ;101 +; DEFB 0,0,0 ;104 +; DEFB 0,0,0,0,0,0,0,0 ;109 +; DEFB 0,0,0,0,0,0,0,0 ;118 +BUFEND EQU $ +; DEFW 0 ;SENTINEL FOR STACK END + db 0,0 + DEFS 24,0 ;STACK AREA +STACK EQU $ ;TOP OF STACK +; +; SUBMIT FILE CONTROL BLOCK +; +SUBDN: DEFB 1 ;DISK DRIVE (A: CONTAINS $$$.SUB) +SUBFN: DEFB '$$$ ' ;FILE NAME +SUBFT: DEFB 'SUB' ;FILE TYPE +SUBEX: DEFB 0 ;EXTENT NUMBER +SUBS1 EQU SUBDN+13 ;S1 +SUBS2 EQU SUBDN+14 ;S2 +SUBRC EQU SUBDN+15 ;RECORD COUNT +SUBDM EQU SUBDN+16 ;DISK GROUP MAP +SUBCR EQU SUBDN+32 ;CURRENT RECORD NUMBER +; +; COMMAND FILE CONTROL BLOCK +; +FCBDN: db 0 ;DISK DRIVE +FCBFN: db 0,0,0,0,0,0,0,0 ;FILE NAME +FCBFT: db 0,0,0 ;FILE TYPE +FCBEX: db 0 ;EXTENT NUMBER +FCBS1: db 0 ;S1 +FCBS2: db 0 ;S2 +FCBRC: db 0 ;RECORD COUNT +FCBDM: db 0,0,0,0,0,0,0,0 ;DISK GROUP MAP + db 0,0,0,0,0,0,0,0 +FCBCR: db 0 ;CURRENT RECORD NUMBER +; +; Type and List Variables +; +CHRCNT: db 0 ;CHARACTER COUNT FOR TYPE AND LIST +LNCNT: db 0 ;LINE COUNT FOR TYPE AND LIST +TYPLST: db 0 ;FLAG FOR TYPE OR LIST +TABCNT: db 0 ;TAB COUNT FOR TYPE AND LIST +SYSTST: DEFB 0 ;LIST SYSTEM FILES IN DIRECTORY FLAG +; +; General Variables +; +CIBPTR: DEFW CIBUFF ;POINTER TO COMMAND INPUT BUFFER +CIPTR: DEFW CIBUFF ;POINTER TO CURRENT CMD FOR ERROR REPORTING +TMPUSR: DEFB 0 ;TEMPORARY USER NUMBER +TDRIVE: DEFB 0 ;TEMPORARY DRIVE +DFUSR: DEFB DEFUSR ;DEFAULT USER +LDADR: DEFW TPA ;MEMORY LOAD ADDRESS +; +; CPR BUILT-IN COMMAND TABLE +; EACH ENTRY IS COMPOSED OF THE BIT 7 TERMINATED COMMAND AND 2-BYTE ADDRESS +; +CMDTBL: + DC 'DIR' + DEFW DIR + DC 'LIST' + DEFW LIST + DC 'TYPE' + DEFW TYPE + DC 'USER' + DEFW USER + DC 'DFU' + DEFW DFU + DC 'FF' ; was 'PAGE' + DEFW EJECT + DC 'BELL' + DEFW RING + DC 'CLS' + DEFW CLS + DC 'SAK' ; "Strike Any Key" + DEFW SAK + DC 'GO' + DEFW GO + DC 'ERA' + DEFW ERA + DC 'ERAQ' + DEFW ERAQ + DC 'SAVE' + DEFW SAVE + DC 'REN' + DEFW REN + DC 'GET' + DEFW GET + DC 'JUMP' + DEFW JUMP + DC 'PEEK' + DEFW PEEK + DC 'POKE' + DEFW POKE +NCMNDS DEFL 18 ;NUMBER OF COMMANDS +; + IF MULTPL + DC 'SCL' + DEFW SINGLE +NCMNDS DEFL NCMNDS+1 + ENDIF +; + IF REBOOT + DC 'BOOT' + DEFW BOOT +NCMNDS DEFL NCMNDS+1 + ENDIF +; +; +;**** Section 2 **** +; CPR STARTING POINTS +; +; START CPR AND DON'T PROCESS DEFAULT COMMAND STORED +; +CPR1: + XOR A ;SET NO DEFAULT COMMAND + LD (CBUFF),A +; +; START CPR AND POSSIBLY PROCESS DEFAULT COMMAND +; +CPR: + LD SP,STACK ;MAKE SURE WE HAVE A VALID STACK + LD A,C ;C=USER/DISK NUMBER (SEE LOC 4) + RRA ;EXTRACT USER NUMBER + RRA + RRA + RRA + AND 0FH + LD (TMPUSR),A ;SET USER NUMBER + LD A,C ;GET DISK NUMBER (SEE LOC 4) + AND 0FH ;EXTRACT DEFAULT DISK DRIVE + LD (TDRIVE),A ;SAVE DEFAULT DRIVE + LD C,0DH ;RESET DISK SYSTEM + CALL BDOS + LD (SUBFLG),A ;SAVE SUBMIT FLAG CLUE + DEFB 0F6H ;SET NZ FLAG (OR A,n) +; +; PROMPT USER AND PROCESS INPUT COMMAND +; +RESTRT: + XOR A ;SET ZERO FLAG + LD SP,STACK ;RESET STACK +; +; PROCESS INPUT LINE +; + CALL REDBUF ;CAPITALIZE, NULL TERMINATE, SKIP SPACES +RS3: + CP COMCHR ;COMMENT? + JR Z,RESTRT ;YES, SKIP REST OF LINE + CALL SCANER ;PARSE COMMAND NAME FROM COMMAND LINE + JR NZ,RS4 ;ERROR IF NAME CONTAINS A "?" + CALL CMDSER ;SCAN FOR COMMAND +; +; ENTRY POINT FOR CONTINUED SCAN OF COMMAND LINE +; + CALL UPDATE ;UPDATE BDOS/SYSTEM PARAMETERS + CALL ADVAN ;GET ANY CHARACTER + JR Z,RESTRT ;NONE, END OF LINE + LD (CIPTR),DE ;UPDATE START OF LINE IN CASE ERROR + INC DE ;NOT END OF LINE, MUST BE DELIMITER + LD (CIBPTR),DE ;SAVE POINTER +; + IF MULTPL + LD HL,NEWCMD ;COMMAND? + CP (HL) +RS4: + JP NZ,ERROR ;NO + CALL ADVAN ;STEP OVER DELIMITER + JR RS3 + ELSE +RS4: + JP ERROR + ENDIF +; +; +;**** Section 3 **** +; I/O UTILITIES +; +; OUTPUT +; +CRLF: + CALL PRINT ;PRINT STRING + DEFB CR,LF+80H + RET +; +; PRINT STRING POINTED TO BY RET ADR; START WITH +; +PRINTC: + CALL CRLF ;NEW LINE +; +; PRINT STRING POINTED TO BY RET ADR +; +PRINT: + EX (SP),HL ;GET POINTER TO STRING + CALL PRINTS + EX (SP),HL ;RESTORE HL AND RETURN ADDRESS + RET +; +; PRINT STRING POINTED TO BY HL +; +PRINT1: + CALL CONOUT ;PRINT CHARACTER +PRINTS: + LD A,(HL) ;GET NEXT BYTE + INC HL ;POINT TO NEXT BYTE + AND A ;TEST FOR 0 OR BIT 7 SET + RET Z ;DONE + JP P,PRINT1 ;NOT LAST CHARACTER +; +; OUTPUT CHARACTER IN A REG +; +CONOUT: + PUSH BC + PUSH DE + LD C,02H + RES 7,A ;STRIP MSB IN CASE SET FOR EOS + LD E,A + JR BDOSDE +; +; GET CHARACTER FROM CONSOLE AND CHECK FOR ^C +; +BREAK: + PUSH BC + LD C,0BH ;CONSOLE STATUS CHECK + CALL BDOSJP + LD C,01H ;GET CHARACTER FROM CON: WITH ECHO + CALL NZ,BDOSJP ;GET CHARACTER + POP BC + RET Z ;NO CHARACTER +CHKETX: + CP ETX ;^C? + RET NZ ;NO +ABORT: + CALL SUBKIL ;KILL ANY SUBMIT + JR RESTRT ;AND RESTART +; +; BDOS FUNCTIONS +; +READF: + LD DE,FCBDN ;FALL THRU TO READ +READ: + LD C,14H + DEFB 3AH ;SKIP NEXT TWO BYTES +WRITE: + LD C,15H ;FALL THRU TO BDOS CALL + JR BDOSJP +DEFDMA: + LD DE,TBUFF ;TBUFF = DEFAULT ADDRESS +DMASET: + LD C,1AH ;SET DMA ADDRESS + JR BDOSJP +SEARF: + LD DE,FCBDN ;SPECIFY FCB +SEARDE: + LD C,11H ;SEARCH FOR FILE + DEFB 3AH ;SKIP NEXT TWO BYTES +SEARN: + LD C,12H ;SEARN IGNORES DE AND USES THE PREVIOUS + JR BDOSFN ;VALUE FROM THE LAST BDOS CALL +OPENF: + XOR A + LD (FCBCR),A + LD DE,FCBDN ;FALL THRU TO OPEN +OPEN: + LD C,0FH ;OPEN FILE + DEFB 3AH ;SKIP NEXT TWO BYTES +CLOSE: + LD C,10H ;CLOSE FILE + DEFB 3AH ;SKIP NEXT TWO BYTES +CREATE: + LD C,16H ;CREATE FILE +BDOSFN: + CALL BDOSJP + INC A ;SET ERROR RETURN FLAG + RET +SUBKIL: + LD HL,SUBFLG ;ABORT SUBMIT FILE + LD A,(HL) ;SUB FILE IN EXECUTION? + AND A + RET Z ;NO + LD (HL),0 ;KILL SUB FILE EXECUTION FLAG + LD DE,SUBDN ;DELETE $$$.SUB +DELETE: + LD C,13H ;DELETE FILE + JR BDOSJP ;SAVE MORE SPACE +TLOGIN: + LD (TDRIVE),A ;SAVE NEW DEFAULT DRIVE +DLOGIN: + LD A,(TDRIVE) ;LOG IN DEFAULT DRIVE + LD C,0EH ;SELECT DISK + JR BDOSEA ;SAVE SOME CODE SPACE +NEWUSR: + LD (TMPUSR),A ;SET NEW USER NUMBER +RSTUSR: + LD A,(TMPUSR) ;RESET TEMPORARY USER +SETUSR: + LD C,20H ;GET/SET USER NUMBER (GET IF E=FFH) +BDOSEA: + LD E,A ;STUFF PARAMETER INTO REG E +BDOSJP: + PUSH BC +BDOSBC: + PUSH DE ; zcpr does not use any BDOS calls that +BDOSDE: + PUSH HL ; return a value in HL. Those HL calls + CALL BDOS ; are: + POP HL ; get active drive - #24 + POP DE ; get allocation vector - #27 + POP BC ; get read-only map - #29 + AND A ; get disk parameters - #31 + RET +; +; +;**** Section 4 **** +; CPR UTILITIES +; +; PRINT PROMPT (DU>) +; +PROMPT: + CALL CRLF ;PRINT PROMPT + LD A,(TDRIVE) ;CURRENT DRIVE IS PART OF PROMPT + ADD A,'A' ;CONVERT TO ASCII A-P + CALL CONOUT + LD A,(TMPUSR) ;GET USER NUMBER +; + IF SUPRES ;IF SUPPRESSING USER # REPORT FOR USER 0 + AND A + JR Z,PRPT1 ;ZERO, SUPRESS + ENDIF +; +PRUSRN: + ADD A,0 ;CONVERT HEX TO BCD + DAA + PUSH AF ;SAVE UNITS DIGIT + AND 0F0H + LD A,'1' + CALL NZ,CONOUT ;PRINT IF OVER 10 + POP AF + OR '0' ;OUTPUT 1'S DIGIT (CONVERT TO ASCII) + CALL CONOUT +PRPT1: + JP PRINT ;GO PRINT PROMPT CHARACTER +; +; INPUT NEXT COMMAND TO CPR +; +; This routine determines if a SUBMIT file is being processed +; and extracts the command line from it if so or from the user's console. +; This routine also invokes the DU> prompt. +; +REDBUF: + JR NZ,CNVBUF ;PROCESS DEFAULT COMMAND IF ANY +RD0: + CALL DEFDMA ;SELECT TBUFF FOR READ + XOR A ;SELECT USER 0 FOR SUBMIT SEARCH + CALL SETUSR + LD DE,SUBDN ;OPEN $$$.SUB +SUBFLG EQU $+1 ;IN LINE SUBMIT FLAG + LD A,0 ;SUBMIT IN PROGRESS? + AND A + CALL NZ,OPEN ;CALL OPEN IF SUBMIT IN PROGRESS + JR Z,RB2 ;NONE FOUND SO GET COMMAND LINE + LD A,(SUBRC) ;GET VALUE OF LAST RECORD IN FILE + DEC A ;POINT TO NEXT TO LAST RECORD + LD (SUBCR),A ;SAVE NEW VALUE OF LAST RECORD IN $$$.SUB + CALL READ ;DE=SUBDN + JR NZ,RB1 ;ABORT $$$.SUB IF ERROR IN READING LAST REC + LD HL,SUBS2 ;POINT TO S2 OF $$$.SUB FCB + LD (HL),A ;SET S2 TO ZERO + INC HL ;POINT TO RECORD COUNT + DEC (HL) ;DECREMENT RECORD COUNT OF $$$.SUB + PUSH AF ;SAVE ZERO FLAG + CALL Z,SUBKIL ;KILL SUBMIT IF ZERO RECORDS LEFT + POP AF ;ELSE + CALL NZ,CLOSE ;JUST CLOSE FILE + CALL PROMPT ;PRINT SUBMIT PROMPT + DEFB SPRMPT+80H + LD HL,TBUFF+1 ;PRINT COMMAND LINE FROM $$$.SUB + CALL PRINTS + LD HL,TBUFF ;MOVE COMMAND LINE TO COMMAND BUFFER + LD DE,CBUFF + LD BC,BUFLEN + LDIR + CALL BREAK ;CHECK FOR ABORT (ANY CHARACTER) + JR Z,CNVBUF ;NONE +; +; INPUT COMMAND LINE FROM USER CONSOLE +; +RB1: + CALL SUBKIL ;ERASE $$$.SUB +RB2: + CALL PROMPT ;PRINT PROMPT + DEFB CPRMPT+80H + LD C,0AH ;READ COMMAND LINE FROM USER + LD DE,MBUFF + CALL BDOS +; +; CAPITALIZE STRING (ENDING IN 0) IN CBUFF AND SET POINTER FOR PARSING +; +CNVBUF: + LD HL,CBUFF ;POINT TO USER'S COMMAND BUFFER + LD A,(HL) ;ANY CHARACTERS IN BUFFER? + AND A + JR Z,RD0 ;NO, FILL BUFFER + INC HL + LD (CIBPTR),HL ;INITIALIZE COMMAND LINE POINTER + LD B,A ;INITIALIZE CHARACTER COUNTER +CB1: + LD A,(HL) ;CAPITALIZE COMMAND CHARACTER + CALL UCASE + LD (HL),A + INC HL ;POINT TO NEXT CHARACTER + DJNZ CB1 ;CONTINUE TO END OF COMMAND LINE + LD (HL),B ;STORE ENDING +; +; ADVANCE INPUT POINTER TO FIRST NON-BLANK AND FALL THROUGH TO SBLANK +; +ADVAN: + LD DE,(CIBPTR) +; +; SKIP STRING POINTED TO BY DE (STRING ENDS IN 0) UNTIL END OF STRING +; OR NON-BLANK ENCOUNTERED (BEGINNING OF TOKEN) +; +SBLANK: + LD A,(DE) + OR A + RET Z + CP ' ' + RET NZ + INC DE + JR SBLANK +; +; CONVERT CHARACTER IN A TO UPPER CASE +; +UCASE: + CP 61H ;LOWER-CASE A + RET C + CP 7BH ;GREATER THAN LOWER-CASE Z? + RET NC + AND 5FH ;CAPITALIZE + RET +; +; CHECK TO SEE IF DE POINTS TO DELIMITER; IF SO, RET W/ZERO FLAG SET +; +SDELM: + LD A,(DE) + OR A ;0=DELIMITER + RET Z + CP ' ' ;ERROR IF < + JP C,ERROR + RET Z ; =DELIMITER + CP '.' ;"." =DELIMITER + RET Z + CP '[' ;"[" =DELIMITER + RET Z + CP ']' ;"]" =DELIMITER + RET Z + CP '>' ;">" =DELIMITER BUT GREATER NOT + RET NC + CP ':' ;":" ";" "<" "=" =DELIMITERS + RET C ;NO DELIMITER FOUND + CP A ;SET ZERO FLAG + RET + +; +; ADD A TO HL (HL=HL+A) +; +ADDAH: + ADD A,L + LD L,A + RET NC + INC H + RET +; +; EXTRACT DECIMAL NUMBER FROM COMMAND LINE +; RETURN WITH 8-BIT VALUE IN REG A AND 16-BIT VALUE IN HL +; ALL REGISTERS MAY BE AFFECTED +; +NUMBER: + CALL SCANER ;PARSE NUMBER AND PLACE IN FCBFN + LD HL,FCBFN+10 ;POINT TO END OF TOKEN FOR CONVERSION + LD B,11 ;11 CHARACTERS MAX +; +; CHECK FOR SUFFIX FOR HEXADECIMAL NUMBER +; +NUMS: + LD A,(HL) ;GET CHARACTERS FROM END, SEARCHING FOR SUFFIX + DEC HL ;BACK UP + CP NUMBASE ;CHECK AGAINST BASE SWITCH FLAG + JR Z,HNUM1 + CP ' ' ;SPACE? + JR NZ,NUM1 ;CHECK FOR LAST DIGIT + DJNZ NUMS ;COUNT DOWN +; +; PROCESS DECIMAL NUMBER +; +NUM1: + LD HL,0 ;CLEAR GRAND TOTAL + LD DE,FCBFN ;POINT TO BEGINNING OF TOKEN +NUM2: + LD A,(DE) ;GET CHARACTER + CP ' ' ;DONE IF +NUM3: + LD A,L ;TOTAL TO A IN CASE DONE + RET Z ;ALL DONE + CALL A2NUM ;CONVERT DIGIT + JR NC,NUM2 ;NO ERROR + JR ERROR +; +; ASCII TO NUMERICAL CONVERSION +; RETURNS WITH CARRY SET IF INVALID OR OVERFLOW +; BASE 10 ASSUMED - MAXIMUM VALUE IS 255 +; +A2NUM: + LD A,(DE) ;GET DIGIT + SUB '0' ;CONVERT TO BINARY (ASCII 0-9 TO BINARY) + CP 10 ;ERROR IF >= 10 + CCF ;FLIP CARRY + RET C + LD C,A ;DIGIT IN C + LD A,L ;NEW VALUE = OLD VALUE * 10 + RLCA ;*2 + RET C ;ERROR + RLCA ;*4 + RET C ;ERROR + ADD A,L ;*5 + RET C ;ERROR + RLCA ;*10 + RET C ;ERROR + ADD A,C ;NEW VALUE = OLD VALUE * 10 + DIGIT + RET C ;DON'T INC DE IF ERROR + LD L,A ;SET NEW VALUE + INC DE ;GOOD DIGIT + RET +; +; EXTRACT HEXADECIMAL NUMBER FROM COMMAND LINE +; RETURN WITH 8-BIT VALUE IN REG A AND 16-BIT VALUE IN HL +; ALL REGISTERS MAY BE AFFECTED +; +HEXNUM: + CALL SCANER ;PARSE NUMBER AND PLACE IN FCBFN +HNUM1: + LD HL,0 ;HL=ACCUMULATED VALUE + LD DE,FCBFN ;POINT TO TOKEN FOR CONVERSION +HNUM2: + LD A,(DE) ;GET CHARACTER + CP ' ' ;DONE? + JR Z,NUM3 ;RETURN IF SO + CP 'H' ;DONE IF H SUFFIX + JR Z,NUM3 + SUB '0' ;CONVERT TO BINARY + CP 10 ;0-9? + JR C,HNUM3 + SUB 17 ;A-F? + CP 6 ;ERROR? + JR NC,ERROR + ADD A,10 +HNUM3: + INC DE ;POINT TO NEXT CHARACTER + ADD HL,HL ;LEFT SHIFT 4 + ADD HL,HL + ADD HL,HL + ADD HL,HL + OR L ;MASK IN NEW LOW + LD L,A ;NEW LOW BYTE IN L + JR HNUM2 +; +; GET THE REQUESTED USER NUMBER FROM THE COMMAND LINE AND VALIDATE IT. +; +USRNUM: + CALL NUMBER + LD E,A + CP MAXUSR+1 + RET C +; +; INVALID COMMAND -- PRINT IT +; +ERROR: + CALL CRLF ;NEW LINE + LD HL,(CIPTR) ;POINT TO BEGINNING OF COMMAND LINE +ERR1: + LD A,(HL) ;GET CHARACTER + CP ' '+1 ;SIMPLE '?' IF OR LESS + CALL NC,CONOUT ;PRINT COMMAND CHARACTER OR FALL THRU + INC HL ;POINT TO NEXT + JR NC,ERR1 ;CONTINUE + CALL PRINT ;PRINT '?' + DC '?' + JP ABORT ;RESTART CPR +; +; POINT TO DIRECTORY ENTRY IN TBUFF WHOSE OFFSET IS SPECIFIED BY A AND C +; +DIRPTR: + LD HL,TBUFF ;POINT TO TEMP BUFFER + ADD A,C ;POINT TO 1ST BYTE OF DIR ENTRY + CALL ADDAH ;POINT TO DESIRED BYTE IN DIR ENTRY + LD A,(HL) ;GET DESIRED BYTE + RET +; +; CHECK FOR VALID USER AND LOG IN IF VALID +; +ULOGIN: + LD A,(FCBS1) ;GET USER NUMBER +ALOGIN: + ADD A,80H ;VALID? + CALL P,SETUSR ;SET IF VALID + RET +; +; EXTRACT TOKEN FROM COMMAND LINE AND PLACE IT INTO FCBDN; +; FORMAT FCBDN FCB IF TOKEN RESEMBLES FILE NAME AND TYPE (FILENAME.TYP); +; ON INPUT, CIBPTR PTS TO CHARACTER AT WHICH TO START SCAN; +; ON OUTPUT, CIBPTR PTS TO CHARACTER AT WHICH TO CONTINUE AND ZERO FLAG IS +; RESET IF '?' IS IN TOKEN +; +SCANER: + LD HL,FCBDN ;POINT TO FCBDN +SCAN1: + PUSH HL ;SAVE POINTER TO FCB + CALL ADVAN ;SKIP TO NON-BLANK OR END OF LINE + LD (CIPTR),DE ;SET POINTER TO NON-BLANK OR END OF LINE + JR Z,SCAN3 ;END OF COMMAND LINE + SBC A,'A' ;CONVERT POSSIBLE DRIVE SPEC TO NUMBER + CP 16 ;VALID DRIVE? + INC A ;CONVERT TO DRIVE (A=1, AND SO ON) + JR C,SCAN2 ;YES + XOR A ;SELECT DEFAULT DRIVE + DEC DE ;DON'T MOVE TO NEXT CHARACTER +SCAN2: + LD H,A ;STORE NUMBER (A:=0, B:=1, ETC) IN H + INC DE ;POINT TO NEXT CHARACTER + LD L,0 ;ZERO TOTAL + CALL A2NUM ;CONVERT FIRST DIGIT + JR C,SCAN3 ;NOT VALID + CALL A2NUM ;CONVERT SECOND DIGIT + LD A,L + SET 7,L ;MAKE VALID JUST IN CASE + CP MAXUSR+1 ;TOO BIG? + JR C,SCAN3 ;NO + LD A,(DE) ;ANY ':'? + CP ':' + JP Z,NAMERR ;YES, NAME ERROR +SCAN3: + LD A,(DE) ;SEE IF LAST CHARACTER IS A COLON (:) + INC DE ;POINT TO BYTE AFTER ':' + CP ':' + JR Z,SCAN4 ;YES, WE HAVE A DRIVE SPEC + LD HL,0 ;NOT VALID DRIVE SPEC, SWITCH TO DEFAULT + LD DE,(CIPTR) ;RESTART SCAN +; +; EXTRACT FILENAME FROM POSSIBLE FILENAME.TYP +; +SCAN4: + LD B,H ;MOVE DRIVE TO B + EX (SP),HL ;GET BACK FCB POINTER AND SAVE USER NUMBER + LD (HL),B ;SAVE DRIVE + LD B,8 ;MAX OF 8 CHARACTERS + XOR A ;CLEAR '?' COUNT + EX AF,AF' ;AND SAVE + CALL SCANF ;GET POSSIBLE NAME + CALL SCANT ;AND POSSIBLE TYPE +; +; FILL IN EX, S1, S2, AND RC +; + XOR A + INC HL ;POINT TO NEXT BYTE IN FCBDN + LD (HL),A ;ZERO EX + INC HL + POP BC ;GET BACK USER NUMBER + LD (HL),C ;STUFF AWAY USER NUMBER IN S1 + INC HL + LD (HL),A ;ZERO S2 + INC HL + LD (HL),A ;ZERO RC +; +; SCAN COMPLETE -- DE POINTS TO DELIMITER BYTE AFTER TOKEN +; + LD (CIBPTR),DE + EX AF,AF' ;GET NUMBER OF '?' IN FILENAME.TYP + RET +; +; EXTRACT FILE TYPE FROM POSSIBLE FILENAME.TYP +; +SCANT: + LD B,3 ;PREPARE TO EXTRACT TYPE + CP '.' ;IF (DE) DELIMITER IS A '.', WE HAVE A TYPE + JR NZ,SCAN11 ;FILL FILE TYPE WITH + INC DE ;POINT TO CHARACTER IN COMMAND LINE AFTER '.' +SCANF: + LD C,' ' ;FILL CHARACTER +SCAN11: + INC HL ;STEP TO NEXT BYTE IN FCBN + CALL SDELM ;CHECK FOR DELIMITER + JR Z,SCAN12 ;FILL REST WITH FILL BYTE IF A DELIMITER + CP '*' ;WILD? + JR NZ,SCAN13 ;NO + LD C,'?' ;CHANGE FILL BYTE TO '?' +SCAN12: + DEC DE ;DON'T STEP OFF CURRENT SYMBOL + LD A,C ;GET FILL BYTE +SCAN13: + CP '?' ;QUESTION MARK? + JR NZ,SCAN14 ;NO, JUST STORE CHARACTER + EX AF,AF' ;GET QUESTION MARK COUNT + INC A ;COUNT IT + EX AF,AF' ;AND SAVE COUNT +SCAN14: + INC DE ;POINT TO NEXT CHARACTER IN COMMAND LINE + LD (HL),A ;STORE CHARACTER IN FCBDN + DJNZ SCAN11 ;COUNT DOWN CHARACTERS IN FILE TYPE (3 MAX) +SCAN15: + CALL SDELM ;SKIP REST OF CHARACTERS TO + RET Z ;DELIMITER + INC DE + JR SCAN15 +; +; CMDTBL (COMMAND TABLE) SCANNER +; JUMPS TO ADDRESS OF COMMAND IF CPR-RESIDENT +; JUMPS TO COM IF NOT CPR-RESIDENT COMMAND +; +CMDSER: + LD A,(FCBFN) ;ANY COMMAND? + CP ' ' ;' ' MEANS COMMAND WAS 'D:' TO SWITCH + LD A,(FCBS1) ;GET USER NUMBER IF ANY + LD HL,FCBDN ;POINT TO DRIVE + JR NZ,CMS0 ;NOT , SO MUST BE COMMAND + ADD A,80H ;CONVERT TO USER NUMBER + CALL P,NEWUSR ;SET IF VALID USER IN FCB + LD A,(HL) ;LOOK FOR DRIVE SPEC + DEC A ;ADJUST FOR LOG IN + CALL P,TLOGIN ;LOG IN DRIVE + RET +CMS0: + OR (HL) ;DRIVE OR USER NUMBER + JR NZ,CMS5 ;YES, CAN'T BE BUILT IN COMMAND + LD HL,CMDTBL ;POINT TO COMMAND TABLE + LD B,NCMNDS ;SET COMMAND COUNTER +CMS1: + LD DE,FCBFN ;POINT TO STORED COMMAND NAME +CMS2: + LD A,(DE) ;COMPARE AGAINST TABLE ENTRY + XOR (HL) + ADD A,A + JR NZ,CMS3 ;NO MATCH + INC DE ;POINT TO NEXT CHARACTER + INC HL + JR NC,CMS2 ;NOT END OF TABLE ENTRY + LD A,(DE) ;NEXT CHARACTER IN INPUT COMMAND MUST BE + CP ' ' + JR NZ,CMS4 + LD E,(HL) ;FOUND COMMAND, + INC HL ;LOAD ADDRESS, + LD D,(HL) ;AND + JR CMS6 ;UPDATE SYSTEM DATA AND EXECUTE +CMS3: + BIT 7,(HL) ;END OF TABLE ENTRY? + INC HL + JR Z,CMS3 ;NO +CMS4: + INC HL ;SKIP ADDRESS + INC HL + DJNZ CMS1 ;NOT TO END OF TABLE YET +CMS5: + LD DE,COM ;LOAD DESTINATION AND UPDATE +CMS6: + PUSH DE ;PLACE ROUTINE ADDRESS ON STACK + JP UPDATE ;UPDATE SYSTEM DATA AND EXECUTE +; +;**** Section 5 **** +; CPR-Resident Commands +; +; +;Section 5A +;Command: DIR +;Function: To display a directory of the files on disk. +;Forms: +; DIR Display the DIR files +; DIR S Display the SYS files +; DIR B Display both DIR and SYS files +; DIR A Display both DIR and SYS files for all user numbers +; +DIR: + CALL SCANER ;EXTRACT POSSIBLE D:FILENAME.TYP TOKEN + CALL ULOGIN ;LOG ANY USER + LD HL,FCBFN ;MAKE FCB WILD (ALL '?') IF NO FILENAME.TYP + LD A,(HL) ;GET FIRST CHARACTER OF FILENAME.TYP + CP ' ' ;IF , ALL WILD + JR NZ,DIR2 + LD B,11 ;NUMBER OF CHARACTERS IN FN & FT +DIR1: + LD (HL),'?' ;STORE '?' + INC HL + DJNZ DIR1 +DIR2: + CALL ADVAN ;LOOK AT NEXT INPUT CHARACTER + LD B,0FFH ;LOAD ALL FILES FLAG + CP USRFLG ;ALL FILES ON DISK? + JR Z,DIR4 ;YES + LD B,80H ;IN CASE SYS ONLY + CP SOFLG ;SYS ONLY? + JR Z,DIR4 ;YES + CP SYSFLG ;HAVE SYSTEM SPECIFIER? + LD A,B ;SET SYSTEM BIT EXAMINATION + LD B,0 ;SYSTEM TOKEN DEFAULT + JR NZ,DIRPR +DIR4: + INC DE + LD (CIBPTR),DE + LD A,B + ;DROP INTO DIRPR TO PRINT DIRECTORY + ;THEN RESTART CPR +; +; DIRECTORY PRINT ROUTINE; ON ENTRY, A IS 80H IF SYSTEM FILES EXCLUSIVELY +; +DIRPR: + LD D,A ;STORE SYSTEM FLAG IN D + LD A,B ;SAVE SYSTST + LD (SYSTST),A + XOR A ;SET COLUMN COUNTER TO 0 + LD B,A ;AND USER NUMBER JUST IN CASE +DIRPR1: + ADD A,03H ;FORCE CRLF + AND 0FCH + LD E,A + PUSH DE + INC D ;ALL USER NUMBERS? + PUSH BC ;SAVE USER NUMBER + LD A,B ;AND + CALL Z,SETUSR ;SET IF ALL USER NUMBERS + CALL SEARF ;SEARCH FOR SPECIFIED FILE (FIRST OCCURRENCE) +DIRPR2: + POP BC ;GET BACK USER NUMBER + POP DE ;AND SYSTEM FLAG + JR NZ,DIRPR4 ;FILE FOUND + LD A,B ;AT LAST USER NUMBER? + INC B ;STEP TO NEXT USER NUMBER + CP MAXUSR + LD A,E ;IN CASE DONE + JR NC,DIRPR3 ;DONE + LD E,D ;EITHER WAY, E IS GOING TO BE CHANGED + INC E + JR Z,DIRPR1 ;PRINT ALL USER NUMBERS +DIRPR3: + AND A ;ANY PRINTED? + JP CHKFND ;GO CHECK +; +; ENTRY SELECTION LOOP; ON ENTRY, A=OFFSET FROM SEARF OR SEARN +; +DIRPR4: + DEC A ;ADJUST TO RETURNED VALUE + RRCA ;CONVERT NUMBER TO OFFSET INTO TBUFF + RRCA + RRCA + LD C,A ;OFFSET INTO TBUFF IN C (C=OFFSET TO ENTRY) + LD A,10 ;ADD 10 TO POINT TO SYSTEM FILE ATTRIBUTE BIT + CALL DIRPTR + PUSH DE + AND D ;MASK FOR SYSTEM BIT + INC D ;ALL FILES? + JR Z,DIRPR5 ;YES + LD HL,SYSTST ;SYSTEM FILE? + CP (HL) + JR NZ,DIRPR9 ;NO +DIRPR5: + LD A,E ;WHAT TO PRINT +; + IF TWOCOL + AND 01H ;OUTPUT IF 2 ENTRIES PRINTED IN LINE + ELSE +; + AND 03H ;OUTPUT IF 4 ENTRIES PRINTED IN LINE + ENDIF +; + CALL Z,CRLF ;NEWLINE ALWAYS RETURNS ZERO TRUE + JR Z,DIRPR6 + CALL PRINT +; + IF WIDE + DEFB ' ' ;2 SPACES + DEFB FENCE ;THEN FENCE CHARACTER + DC ' ' ;THEN 2 MORE SPACES + ELSE +; + DEFB ' ' ;SPACE + DEFB FENCE ;THEN FENCE CHARACTER + DC ' ' ;THEN SPACE + ENDIF +; +DIRPR6: + POP DE + INC E ;BUMP NUMBER OF FILES LISTED + PUSH DE + INC D ;PRINT WITH USER NUMBER? + JR NZ,DIRPR8 ;NO + LD A,B ;GET USER NUMBER AND + CALL PRUSRN ;AND PRINT + DEFB USRDLM+80H ;USER NUMBER DELIMITER +DIRPR8: + XOR A ;DON'T EAT SPACES + CALL PRFN +DIRPR9: + PUSH BC + CALL SEARN ;GET NEXT FILENAME + JR DIRPR2 +PRFN: + PUSH BC + LD B,A ;SAVE EAT SPACES FLAG + LD A,1 + CALL DIRPTR ;HL NOW POINTS TO 1ST BYTE OF FILE NAME + LD C,B ;SAVE EAT SPACES FLAG + LD B,12 ;12 CHARACTER TOTAL +PRFN1: + LD A,B ;CHECK FOR FILE TYPE + CP 04H + LD A,(HL) + RES 7,A + JR NZ,PRFN2 ;NOT YET AT TYPE + DEC HL ;ADJUST HL FOR TYPE DELIMITER + CP ' ' ;NO FILE TYPE? + JR Z,PRFN2 ;CONTINUE IF SO + LD A,'.' ;FILE TYPE EXISTS, PRINT DOT +PRFN2: + INC HL ;STEP TO NEXT CHARACTER + CP C ;EAT SPACES? + CALL NZ,CONOUT + DJNZ PRFN1 + POP BC + RET +; +;Section 5B +;Command: ERA +;Function: To erase files; names of the erased files are displayed. +;Forms: +; ERA +; +ERA: + CALL SCANER ;PARSE FILE SPECIFICATION + CP 11 ;ALL WILD (ALL FILES = 11 '?')? + JR NZ,ERA1 ;IF NOT, THEN DO ERASES + CALL REPLY + JP NZ,RESTRT ;RESTART CPR IF NOT +ERA1: + CALL ULOGIN ;LOG ANY USER + XOR A ;PRINT ALL FILES (EXAMINE SYSTEM BIT) + LD B,A ;NO SYS-ONLY OPT TO DIRPR + CALL DIRPR ;PRINT DIRECTORY OF ERASED FILES +ERA2: + LD DE,FCBDN ;DELETE FILE SPECIFIED + JP DELETE ;REENTER CPR VIA DELETE +; +;Section 5C +;Command: ERAQ +;Function: To erase files with individual query. +;Forms: +; ERAQ +; ? Y +; : +; : +; +ERAQ: + CALL SCANER ; parse file specification + CALL ULOGIN ; log any user + LD HL,01FFH ; load first flag +ERAQ1: + CALL SEARF ; find first entry + JR NZ,ERAQ2 ; found one + INC L ; ever found any? +; +; Check for File Found +; +CHKFND: + RET NZ ; yes +; +; No File Error Message +; +PRNNF: + CALL PRINTC ;NO FILE MESSAGE + DC 'No File' + RET +ERAQ2: + LD L,H ; restart found count +ERAQ3: + DEC H ; at file to erase? + JR NZ,ERAQ5 ; no + INC H ; reset H to 1 + INC L ; step count in case don't delete + PUSH HL ; save flag first + DEC A ; compute offset + RRCA + RRCA + RRCA + LD C,A + CALL CRLF + LD A,' ' ; eat spaces + CALL PRFN ; print file name + CALL REPLY1 ; prompt + JR NZ,ERAQ4 ; reply not 'Y' + XOR A + CALL DIRPTR ; get FCB to delete + LD A,(FCBDN) ; get drive specification + LD (HL),A ; select drive + EX DE,HL + CALL DELETE ; go delete + POP HL ; get flags + DEC L ; reduce count since file deleted + LD H,L ; update next file to process + JR ERAQ1 ; and restart process +ERAQ4: + POP HL ; get count +ERAQ5: + CALL SEARN ; find next file + JR NZ,ERAQ3 ; more files, go ask + RET ; done +; +;Section 5D +;Command: SAK +;Function: To pause until a key is struck; ^C warm boots. +;Forms: +; SAK +; ? +; +SAK: + CALL CRLF ; strike any key + JR REPLY1 +REPLY: + CALL PRINTC + DC 'All' +REPLY1: + CALL PRINT + DC '? ' +REPL2: + CALL BREAK ; get response + JR Z,REPL2 ; none + CALL UCASE + CP 'Y' + RET +; +;Section 5E +;Command: CLS +;Function: To clear screen. +;Forms: +; CLS +; +CLS: +; LD A,CLSCHR ; Load clear screen character +; DEFB 21H ; and skip next instruction + ; If a multi-character string is + ; required to clear screen use: + CALL PRINT + DB ESC,'[2','J'+128 + RET +; +;Section 5F +;Command: BELL +;Function: To ring terminal bell. +;Forms: +; BELL +; +RING: + LD A,BELL ; load bell into A + JP CONOUT ; and output it +; +;Section 5G +;Command: LIST +;Function: To print specified file on list device. +;Forms: +; LIST Print file +; LIST P Print file without default paging +; +LIST: +; + IF FFKILL + LD HL,NLINEP+0580H ; lines/page, first ff and list flags + ELSE + LD HL,NLINEP+0500H ; lines/page and list flag + ENDIF +; + JR TYPE1 +; +;Section 5H +;Command: TYPE +;Function: To display specified file on console. +;Forms: +; TYPE Display file +; TYPE P Display file without default paging +; +TYPE: +; + IF FFKILL + LD HL,NLINES+0280H ; lines/page, first ff and type flags + ELSE + LD HL,NLINES+0200H ; lines/page and type flag + ENDIF +; +TYPE1: + LD (LNCNT),HL ; save list/type flag and line cnt + XOR A ; initialize tab count + LD (TABCNT),A ; initialize line and tab count + CALL SCANER ; extract filename.typ token + JP NZ,NAMERR ; error if any question mark + CALL ADVAN ; get pgdflg if it's there + JR Z,PGDON ; jump if no more on cmd line + XOR PGDFLG ; change page flag? + JR NZ,PGDON ; no + INC DE ; step over pgdflg + LD (CIBPTR),DE ; and save cmd buffer pointer + DEC A ; no page flag is 0ffh + LD (LNCNT),A ; save flag +PGDON: + CALL ULOGIN ; log any user + CALL OPENF ; open selected file + JR Z,TYPE3 ; abort if error + CALL CRLF ; new line +TYPE2: + CALL READF ; read next block + JR Z,TYPE4 ; read ok (A register is zero) + DEC A ; error or eof? + RET Z ; eof +TYPE3: + JP PRNNF ; error +CHK4LF: + LD A,(LNCNT) ; get line count (just in case) + DJNZ CHK4VT ; not lf, try vertical tab + RES 7,A ; reset first ff flag (if any) + CP 07FH ; paging off? + JR Z,CHK4VT ; yes + DEC A ; time to page? + JR Z,CHKFF ; yes! +CHK4VT: + DEC B ; step over vt +CHK4FF: + DJNZ CHK4CR ; not ff, try vt + BIT 7,A ; first ff? + JR NZ,NXTCHR ; yes, ignore +CHKFF: + LD A,(TYPLST) + BIT 0,A ; type or list? + LD E,FF ; load ff into character reg + LD A,NLINEP ; reset list count + JR NZ,CHK4CR ; list +CHKFF1: + LD C,06H ; direct console i/o + LD E,0FFH ; conditional console input + CALL BDOSJP + JR Z,CHKFF1 ; no character yet + CALL CHKETX ; check for ^C + LD A,NLINES ; type line count + LD E,LF +CHK4CR: + LD (LNCNT),A ; save line count + CALL PAGER ; output character + DJNZ NXTCHR ; not cr + LD (HL),B ; reset tab count +NXTCHR: + LD A,(CHRCNT) ; get buffer pointer + INC A ; step to next character + CP 128 ; end-of-buffer? + JR NC,TYPE2 ; yes, read next buffer +TYPE4: + LD (CHRCNT),A ; save buffer count + LD HL,TBUFF ; point to buffer + CALL ADDAH ; compute address of next character + LD A,(HL) ; get character to accumulator + AND 7FH ; mask out msb + CP 1AH ; end-of-file (^Z)? + RET Z ; yes, restart zcpr + LD HL,TABCNT ; pointer to tab counter + LD E,A ; save character in e reg + SUB BS ; backspace? + LD B,A ; in case not bs + JR NZ,CHK4HT ; not bs + DEC (HL) ; step tab count and fall thru +CHK4HT: + DJNZ CHK4LF ; no, check for line feed +CHKHT: + LD E,' ' ; load space into bdos character reg + CALL PAGER ; print space + LD A,(HL) ; now in col 0 mod 8? + AND 07H + JR NZ,CHKHT ; go for more + JR NXTCHR +PAGER: + CALL BREAK ; check for abort + LD A,(TYPLST) ; get list/type flag + LD C,A +; + IF TEST OR NOT NOSTAT + AND 00000010B ; list? + EXX ; save registers + CALL Z,LISTST ; check busy + EXX ; restore registers + AND A + JR Z,PAGER ; printer not ready + ENDIF +; + LD A,E ; check for printing character + CP ' ' + JR C,PAGE2 ; control character, don't count + INC (HL) ; step position +PAGE2: + JP BDOSJP ; return via bdos +; +;Section 5I +;Command: FF (was PAGE) +;Function: To eject a page on list device via a form feed. +;Forms: +; PAGE +; +EJECT: + CALL BREAK ; check for ^C +; + IF TEST OR NOT NOSTAT + CALL LISTST ; check printer ready + AND A + JR Z,EJECT ; not ready yet + ENDIF +; + LD E,FF ; now for form feed + LD C,05H ; list output + JP BDOS ; output character and return via bdos +; +;Section 5J +;Command: SAVE +;Function: To save the contents of TPA onto disk as a file. Number of +; pages or records is in decimal. Saved area begins at 100H. +;Forms: +; SAVE +; SAVE R +; +SAVE: + CALL NUMBER ;EXTRACT NUMBER FROM COMMAND LINE + PUSH HL ;SAVE IT + CALL SCANER ;EXTRACT FILENAME.TYP + JP NZ,NAMERR ;MUST BE NO '?' IN IT + CALL ULOGIN ;LOG ANY USER + CALL ERA2 ;DELETE FILE IF POSSIBLE + CALL CREATE ;CREATE NEW FILE + JR Z,SAVE4 ;UNSUCCESSFUL + XOR A ;SET RECORD COUNT FIELD OF NEW FILE'S FCB + LD (FCBCR),A + CALL ADVAN ;LOOK FOR RECORD OPTION + INC DE ;POINT TO TOKEN + POP HL ;GET BACK PAGE COUNT + CP RECFLG + JR Z,SAVE1 + DEC DE ;NO TOKEN, SO BACK UP + ADD HL,HL ;DOUBLE IT FOR HL=RECORD (128 BYTES) COUNT +SAVE1: + LD (CIBPTR),DE ;SET POINTER TO BAD TOKEN OR AFTER GOOD TOKEN + LD DE,TPA ;POINT TO START OF SAVE AREA (TPA) +SAVE2: + LD A,H ;DONE WITH SAVE? + OR L ;HL=0 IF SO + JR NZ,SAVE3 + LD DE,FCBDN ;CLOSE SAVED FILE + JP CLOSE ;AND RESTART CPR +SAVE3: + DEC HL ;COUNT DOWN ON RECORDS + PUSH HL ;SAVE POINTER TO BLOCK TO SAVE + CALL DMASET ;SET DMA ADDRESS FOR WRITE (ADDRESS IN DE) + LD HL,128 ;128 BYTES PER RECORD + ADD HL,DE ;POINT TO NEXT RECORD + LD DE,FCBDN ;WRITE RECORD + CALL WRITE + EX DE,HL ;GET POINTER TO NEXT RECORD IN DE + POP HL ;GET RECORD COUNT + JR Z,SAVE2 ;NO WRITE ERROR +SAVE4: + JP PRNLE ;PRINT 'NO SPACE' ERROR +; +;Section 5K +;Command: REN +;Function: To change the name of an existing file. +;Forms: +; REN = +; +REN: + LD HL,FCBDN+16 ;PLACE FILENAME IN SECOND HALF OF FCB + PUSH HL ;SAVE POINTER FOR SEARCH FIRST + CALL SCAN1 ;EXTRACT FILE NAME + JR NZ,NAMERR ;ERROR IF ANY '?' IN IT + CALL ADVAN ;ADVANCE CIBPTR + CP '=' ;'=' OK + JP NZ,ERROR + EX DE,HL ;POINT TO CHARACTER AFTER '=' IN HL + INC HL + LD (CIBPTR),HL ;SAVE POINTER TO OLD FILE NAME + CALL SCANER ;EXTRACT FILENAME.TYP TOKEN + JR NZ,NAMERR ;ERROR IF ANY '?' + LD A,(FCBDN+16+13) ;GET POSSIBLE USER NUMBER + CALL ALOGIN ;LOG ANY USER + POP DE ;GET POINTER FOR SEARCH FIRST + CALL SEARDE ;CHECK FOR NONE OF THAT NAME + JR Z,REN1 ;NO FILE EXISTS + CALL PRINTC ;DUPLICATE NAME + DC 'Delete' + CALL REPLY1 ;GET REPLY + JR NZ,REN2 ;NOT A 'Y' + CALL DELETE ;DELETE DUPLICATE +REN1: + LD A,(DE) ;GET POSSIBLE DRIVE + LD DE,FCBDN ;POINT TO FCB + LD (DE),A ;SAVE POSSIBLE DRIVE + LD C,17H ;BDOS RENAME FCT + CALL BDOSFN + JP CHKFND ;CHECK FOR FILE FOUND +NAMERR: + CALL PRINTC + DC 'Name Error' +REN2: + JP ABORT +; +;Section 5L +;Command: USER +;Function: To change current user number; new user number is in decimal. +;Forms: +; USER +; +USER: + CALL USRNUM ;EXTRACT USER NUMBER FROM COMMAND LINE + JP NEWUSR ;SET NEW USER NUMBER +; +;Section 5M +;Command: DFU +;Function: To set the Default User Number for the command/file scanner; new +; default user number is in decimal. +;Forms: +; DFU +; +DFU: + CALL USRNUM ;GET USER NUMBER + LD (DFUSR),A ;PUT IT AWAY + RET +; +;Section 5N +;Command: SCL +;Function: To force ZCPR to parse only a single command per line; reset +; to multiple command format at the next ^C. +;Forms: +; SCL +; + IF MULTPL +SINGLE: + LD HL,NEWCMD ; point at current command separator + LD A,CMDCHR ; get default command separator + XOR (HL) ; flip current separator + LD (HL),A ; save new command separator + RET + ENDIF +; +; +;Section 5O +;Command: PEEK +;Function: To display hex values beginning at a specified address. +;Forms: +; PEEK [] +; +PEEK: + CALL HEXNUM ; get display address + PUSH HL ; save it + CALL HEXNUM ; get optional count + LD C,L ; save count + POP HL ; get back address +PEEK1: + CALL CRLF ; start new line + CALL PRHEXW ; print address + LD B,16 ; 16 values per line +PEEK2: + CALL PRINT ; space over + DC ' ' + LD A,(HL) ; get hex value + INC HL ; step to next value + CALL PRHEXA ; display value + DEC C ; done? + RET Z ; yes + DJNZ PEEK2 ; not end of line + JR PEEK1 ; end of line +PRHEXW: + LD A,H ; print hex word in hl + CALL PRHEXA + LD A,L +PRHEXA: + PUSH AF ; save right nibble + RRCA ; move left nibble to right + RRCA + RRCA + RRCA + CALL PRHEX ; display left nibble + POP AF ; get back right nibble +PRHEX: + AND 0FH ; convert to ascii + ADD A,90H + DAA + ADC A,40H + DAA + JP CONOUT ; go display value +; +; +;Section 5P +;Command: POKE +;Function: To poke a string of hex values into a set of consecutive addresses. +;Forms: +; POKE [] +; +POKE: + CALL HEXNUM ; get address +POKE1: + PUSH HL ; save address + CALL HEXNUM ; get next byte + LD A,(FCBFN) ; done? + CP ' ' + LD A,L ; save byte + POP HL ; get back address + RET Z ; done + LD (HL),A ; save byte + INC HL ; step to next address + JR POKE1 ; go for more +; +; +;Section 5Q +;Command: JUMP +;Function: To call the program (subroutine) at the specified address +; without loading from disk. +;Forms: +; JUMP +; +JUMP: + CALL HEXNUM ;GET LOAD ADDRESS IN HL + JR CLLPRG ;PERFORM CALL +; +;Section 5R +;Command: COM file processing +;Function: To load the specified COM file from disk and execute it. +;Forms: +; +; +COM: + LD HL,FCBFT ;FILE TYPE MUST BE BLANK + LD A,(HL) + CP ' ' + JP NZ,ERROR + LD (HL),'C' ;PLACE DEFAULT FILE TYPE (COM) INTO FCB + INC HL ;COPY INTO FILE TYPE + LD (HL),'O' ;3 BYTES + INC HL + LD (HL),'M' + LD HL,TPA ;SET EXECUTION/LOAD ADDRESS + CALL MEMLD ;LOAD MEMORY WITH FILE SPECIFIED + ;(NO RETURN IF ERROR OR TOO BIG) +; +;Section 5S +;Command: GO +;Function: To call the program in the TPA without loading from disk. +; Same as JUMP 100H, but more convenient, especially when +; used with parameters for programs like STAT. +;Form: +; GO +; +GO: + LD HL,TPA ;ALWAYS TO TPA +; +; +; CLLPRG IS THE ENTRY POINT FOR THE EXECUTION OF THE LOADED PROGRAM +; ON ENTRY TO THIS ROUTINE, HL MUST CONTAIN THE EXECUTION +; ADDRESS OF THE PROGRAM (SUBROUTINE) TO EXECUTE +; +CLLPRG: + PUSH HL ;SAVE EXECUTION ADDRESS + LD HL,(CIBPTR) ;SAVE THE COMMAND TAIL START ADDRESS + PUSH HL + LD HL,TFCB ;MAKE FCB FOR PROGRAM + CALL SCAN1 ;SEARCH COMMAND LINE FOR NEXT TOKEN + LD HL,TFCB+16 ;OFFSET FOR 2ND FILE SPEC + CALL SCAN1 ;SCAN FOR IT AND LOAD IT INTO FCBDN+16 + XOR A + LD (TFCB+32),A ;ZERO RECORD COUNT +; +; LOAD COMMAND LINE INTO TBUFF +; + POP HL ;GET LOCATION OF COMMAND TAIL +NEWCMD EQU $+1 ;IN-LINE COMMAND SEPARATOR + LD BC,CMDCHR+0FF00H;INITIALIZE COUNT AND GET COMMAND FLAG + LD DE,TBUFF ;DESTINATION FOR COMMAND TAIL +COM2: + INC DE ;POINT TO DESTINATION + INC B ;INCREMENT CHARACTER COUNT + LD A,(HL) ;COPY CHARACTER TO TBUFF + LD (DE),A + INC HL ;STEP TO NEXT SOURCE CHARACTER + OR A ;END OF LINE? +; + IF MULTPL + JR Z,COM3 ;YES, END OF LINE + XOR C ;START OF NEXT COMMAND? + JR NZ,COM2 ;NO + LD (DE),A ;0 TERMINATE STRING +COM3: +; + ELSE +; + JR NZ,COM2 ;NOT END OF LINE + ENDIF +; + LD A,B ;SAVE CHARACTER COUNT + LD (TBUFF),A + DEC HL ;BACK UP ONE CHARACTER + LD (CIBPTR),HL ;SAVE FOR START OF NEXT COMMAND SCAN +; +; RUN LOADED TRANSIENT PROGRAM +; + CALL CRLF ;NEW LINE +UPDATE: + CALL DEFDMA ;SET DMA TO DEFAULT VALUE + CALL DLOGIN ;ASSURE PROPER DRIVE + CALL RSTUSR ;ASSURE PROPER USER NUMBER + LD A,E ;GET CURRENT USER NUMBER + ADD A,A ;PLACE IT IN HIGH NIBBLE + ADD A,A + ADD A,A + ADD A,A + LD HL,TDRIVE ;ADD DEFAULT DRIVE NUMBER (LOW NIBBLE) + OR (HL) + LD (UDFLAG),A ;UPDATE USER/DRIVE BYTE +; +; EXECUTION (CALL) OF PROGRAM/SUBROUTINE/COMMAND OCCURS HERE +; + RET ;CALL TRANSIENT +; +;Section 5T +;Command: GET +;Function: To load the specified file from disk to the specified address +;Forms: +; GET Load the specified file at the specified page; +; +GET: + CALL HEXNUM ;GET LOAD ADDRESS IN HL + PUSH HL ;SAVE ADDRESS + CALL SCANER ;GET FILE NAME + POP HL ;RESTORE ADDRESS + JP NZ,NAMERR ;MUST BE UNAMBIGUOUS +; +; LOAD MEMORY WITH COMMAND LINE FILE +; ON INPUT, HL CONTAINS STARTING ADDRESS TO LOAD +; IF COM FILE TOO BIG, EXIT TO ERROR. +; +MEMLD: + LD (LDADR),HL ;SET LOAD ADDRESS +; +; MLA is a reentry point for a non-standard CP/M Modification +; This is the return point when the .COM (or GET) file was not found +; so the Default Drive & User are selected for the final attempt +; to find the file. +; +MLA: + CALL ULOGIN ;LOG ANY USER + LD HL,(FCBS1) ;SAVE ANY USER NUMBER + CALL OPENF ;OPEN COMMAND.COM FILE + JR NZ,MLA1 ;FILE FOUND - LOAD IT +; +; FILE NOT FOUND - SELECT DEFAULT COM USER +; + LD A,(DFUSR) ;GET DEFAULT USER + SET 7,A ;MAKE INTO VALID USER NUMBER + LD (FCBS1),A ;PUT USER INTO FCB +; +; AND SELECT DEFAULT COM DRIVE. IF DEFAULT COM DRIVE ALREADY +; SELECTED, GIVE UP AND PRINT ERROR MESSAGE +; +MLA0: + LD A,DEFDRV-'@' ;A<= DEFAULT COM DRIVE + LD HL,FCBDN ;POINT TO DRIVE IN FCB + CP (HL) ;THE SAME? + JR Z,MLA3 ;YES, ERROR + LD (HL),A ;PUT DEFAULT COM DRIVE IN FCB + JR MLA ;GO GIVE IT A TRY +MLA3: + CALL PRNNF ;CAN'T FIND FILE + JR PRNLE1 +; +; FILE FOUND -- PROCEED WITH LOAD +; +MLA1: + LD HL,(LDADR) ;GET START ADDRESS OF MEMORY LOAD +MLA2: + LD A,ENTRY/256-1 ;GET HIGH-ORDER ADR OF JUST BELOW CPR + CP H ;ARE WE GOING TO OVERWRITE THE CPR? + JR C,PRNLE ;ERROR IF SO + EX DE,HL ;MOVE LOAD ADDRES FOR DMASET + CALL DMASET ;SET DMA ADDRESS + LD HL,128 ;COMPUTE NEXT LOAD ADDRESS + ADD HL,DE ;AND SAVE ANSWER IN HL + CALL READF ;READ NEXT RECORD + JR Z,MLA2 ;READ ERROR OR EOF? + DEC A ;LOAD COMPLETE + JP Z,RSTUSR ;GO RESET CORRECT USER +; +; LOAD ERROR +; +PRNLE: + CALL PRINTC + DC 'Full' +PRNLE1: + JP ABORT +; + IF (($-ENTRY) GT ZCPRSZ) + *ZCPR too large!!* + ENDIF + .DEPHASE +; + IF TEST +LISTST: + LD A,2DH ;COMPUTE LIST STATUS ENTRY + DEFB 0FEH ;SKIP NEXT BYTE +BOOT: + XOR A ;COMPUTE BOOT ENTRY + LD HL,(BASE+1) ;GET PAGE ADDRESS OF BIOS + LD L,A ;ADD ENTRY + JP (HL) ;GO TO BIOS ROUTINE + ENDIF + +ENDLD EQU $ + + END + + \ No newline at end of file diff --git a/Source/ZCPR/Build.cmd b/Source/ZCPR/Build.cmd index 55b3113c..35655a20 100644 --- a/Source/ZCPR/Build.cmd +++ b/Source/ZCPR/Build.cmd @@ -3,16 +3,14 @@ setlocal set TOOLS=../../Tools -set PATH=%TOOLS%\tasm32;%TOOLS%\zx;%PATH% +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%PATH% set TASMTABS=%TOOLS%\tasm32 -set ZXBINDIR=%TOOLS%/cpm/bin/ -set ZXLIBDIR=%TOOLS%/cpm/lib/ -set ZXINCDIR=%TOOLS%/cpm/include/ +set CPMDIR80=%TOOLS%/cpm/ -zx MAC -ZCPR.ASM -$PO -zx MLOAD25 -ZCPR.BIN=ZCPR.HEX +zxcc MAC -ZCPR.ASM -$PO || exit /b +zxcc MLOAD25 -ZCPR.BIN=ZCPR.HEX || exit /b -zx MAC -BDLOC.ASM -$PO -zx MLOAD25 -BDLOC.COM=BDLOC.HEX +zxcc MAC -BDLOC.ASM -$PO || exit /b +zxcc MLOAD25 -BDLOC.COM=BDLOC.HEX || exit /b diff --git a/Source/ZCPR/Makefile b/Source/ZCPR/Makefile index 4e35f6d1..b3abd231 100644 --- a/Source/ZCPR/Makefile +++ b/Source/ZCPR/Makefile @@ -7,6 +7,6 @@ TOOLS = ../../Tools include $(TOOLS)/Makefile.inc zcpr.bin: zcpr.asm - $(ZXCC) $(CPM)/MAC -$< -$$PO - $(ZXCC) $(CPM)/MLOAD25 -$@=zcpr.hex + $(ZXCC) MAC -$< -$$PO + $(ZXCC) MLOAD25 -$@=zcpr.hex diff --git a/Source/ZPM3/Build.cmd b/Source/ZPM3/Build.cmd index 47018c83..05707ed9 100644 --- a/Source/ZPM3/Build.cmd +++ b/Source/ZPM3/Build.cmd @@ -3,33 +3,35 @@ setlocal set TOOLS=../../Tools -set PATH=%TOOLS%\tasm32;%TOOLS%\zx;%TOOLS%\cpmtools;%PATH% +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%TOOLS%\cpmtools;%PATH% set TASMTABS=%TOOLS%\tasm32 -set ZXBINDIR=%TOOLS%/cpm/bin/ -set ZXLIBDIR=%TOOLS%/cpm/lib/ -set ZXINCDIR=%TOOLS%/cpm/include/ +set CPMDIR80=%TOOLS%/cpm/ -copy ..\ZCCP\ccp.com zccp.com -copy ..\ZCCP\zinstal.zpm . -copy ..\ZCCP\startzpm.com . -copy ..\CPM3\genbnk.dat . -copy ..\CPM3\zpmbios3.spr bnkbios3.spr -copy ..\CPM3\gencpm.com . -copy ..\CPM3\biosldrd.rel . -copy ..\CPM3\biosldrc.rel . -rem copy ..\CPM3\cpmldr.com . +copy ..\ZCCP\ccp.com zccp.com || exit /b +copy ..\ZCCP\zinstal.zpm . || exit /b +copy ..\ZCCP\startzpm.com . || exit /b +copy ..\CPM3\genbnk.dat . || exit /b +copy ..\CPM3\zpmbios3.spr bnkbios3.spr || exit /b +copy ..\CPM3\gencpm.com . || exit /b +copy ..\CPM3\util.rel . || exit /b +copy ..\CPM3\biosldrd.rel . || exit /b +copy ..\CPM3\biosldrc.rel . || exit /b +copy ..\CPM3\cpmldr.com . || exit /b +copy ..\CPM3\cpmldr.sys . || exit /b rem ZPM Loader echo. echo. echo *** ZPM Loader *** echo. -zx LINK -ZPMLDRD[L100]=ZPM3LDR,BIOSLDRD -move /Y zpmldrd.com zpmldr.bin -zx LINK -ZPMLDRC[L100]=ZPM3LDR,BIOSLDRC -move /Y zpmldrc.com zpmldr.com +zxcc LINK -ZPMLDRD[L100]=ZPM3LDR,BIOSLDRD,UTIL || exit /b +:: zxcc SLRNK -ZPM3LDR,BIOSLDRD,UTIL,ZPMLDRD/N/E +move /Y zpmldrd.com zpmldr.bin || exit /b +zxcc LINK -ZPMLDRC[L100]=ZPM3LDR,BIOSLDRC,UTIL || exit /b +:: zxcc SLRNK -ZPM3LDR,BIOSLDRC,UTIL,ZPMLDRC/N/E +move /Y zpmldrc.com zpmldr.com || exit /b rem pause rem Banked ZPM3 @@ -37,12 +39,36 @@ echo. echo. echo *** Banked ZPM3 *** echo. -copy genbnk.dat gencpm.dat -zx gencpm -auto -display +copy genbnk.dat gencpm.dat || exit /b +zxcc gencpm -auto -display || exit /b rem pause +rem ZPM3 Tools +zxcc Z80ASM -clrhist/F || exit /b +zxcc Z80ASM -setz3/F || exit /b +zxcc Z80ASM -autotog/F || exit /b + rem Loader -tasm -t80 -g3 -fFF loader.asm loader.bin loader.lst +tasm -t80 -g3 -fFF loader.asm loader.bin loader.lst || exit /b + +copy /b loader.bin + zpmldr.bin zpmldr.sys || exit /b + +rem Copy OS files to Binary directory -copy /b loader.bin + zpmldr.bin zpmldr.sys +copy zpmldr.com ..\..\Binary\ZPM3 || exit /b +copy zpmldr.sys ..\..\Binary\ZPM3 || exit /b +copy cpmldr.com ..\..\Binary\ZPM3 || exit /b +copy cpmldr.sys ..\..\Binary\ZPM3 || exit /b +copy autotog.com ..\..\Binary\ZPM3 || exit /b +copy clrhist.com ..\..\Binary\ZPM3 || exit /b +copy setz3.com ..\..\Binary\ZPM3 || exit /b +copy cpm3.sys ..\..\Binary\ZPM3 || exit /b +copy zccp.com ..\..\Binary\ZPM3 || exit /b +copy zinstal.zpm ..\..\Binary\ZPM3 || exit /b +copy startzpm.com ..\..\Binary\ZPM3 || exit /b +copy makedos.com ..\..\Binary\ZPM3 || exit /b +copy gencpm.dat ..\..\Binary\ZPM3 || exit /b +copy bnkbios3.spr ..\..\Binary\ZPM3 || exit /b +copy bnkbdos3.spr ..\..\Binary\ZPM3 || exit /b +copy resbdos3.spr ..\..\Binary\ZPM3 || exit /b diff --git a/Source/ZPM3/Clean.cmd b/Source/ZPM3/Clean.cmd index 57295d69..3c953899 100644 --- a/Source/ZPM3/Clean.cmd +++ b/Source/ZPM3/Clean.cmd @@ -10,11 +10,15 @@ if exist system.epr del system.epr if exist system.evn del system.evn if exist system.odd del system.odd if exist biosldr.rel del biosldr.rel +if exist util.rel del util.rel if exist *.sym del *.sym if exist zpmldr.com del zpmldr.com if exist cpmldr.com del cpmldr.com if exist startzpm.com del startzpm.com if exist gencpm.com del gencpm.com +if exist clrhist.com del clrhist.com +if exist setz3.com del setz3.com +if exist autotog.com del autotog.com if exist *.dat del *.dat if exist biosldr?.rel del biosldr?.rel if exist *.bin del *.bin diff --git a/Source/ZPM3/Makefile b/Source/ZPM3/Makefile index d72e77bd..47158132 100644 --- a/Source/ZPM3/Makefile +++ b/Source/ZPM3/Makefile @@ -1,20 +1,19 @@ OBJECTS = zpmldr.com zpmldr.sys cpm3.sys startzpm.com zccp.com -ifdef REBUILD_ZPM_TOOLS +NODELETE = makedos.com zinstal.zpm bnkbdos3.spr resbdos3.spr OBJECTS += setz3.com clrhist.com autotog.com -else -NODELETE = setz3.com clrhist.com autotog.com -endif -OTHERS = zpmldr.bin loader.bin biosldrd.rel biosldrc.rel gencpm.com gencpm.dat bnkbios3.spr +OBJECTS += cpmldr.com cpmldr.sys zinstal.zpm makedos.com gencpm.dat bnkbios3.spr bnkbdos3.spr resbdos3.spr +OTHERS = zpmldr.bin loader.bin biosldrd.rel biosldrc.rel util.rel gencpm.com +DEST = ../../Binary/ZPM3/ TOOLS =../../Tools include $(TOOLS)/Makefile.inc -zpmldr.bin: zpm3ldr.rel biosldrd.rel - $(ZXCC) $(CPM)/LINK -ZPMLDRD[L100]=ZPM3LDR,BIOSLDRD +zpmldr.bin: zpm3ldr.rel biosldrd.rel util.rel + $(ZXCC) LINK -ZPMLDRD[L100]=ZPM3LDR,BIOSLDRD,UTIL mv zpmldrd.com zpmldr.bin -zpmldr.com: zpm3ldr.rel biosldrc.rel - $(ZXCC) $(CPM)/LINK -ZPMLDRC[L100]=ZPM3LDR,BIOSLDRC +zpmldr.com: zpm3ldr.rel biosldrc.rel util.rel + $(ZXCC) LINK -ZPMLDRC[L100]=ZPM3LDR,BIOSLDRC,UTIL mv zpmldrc.com zpmldr.com zpmldr.sys: zpmldr.bin loader.bin @@ -38,6 +37,9 @@ biosldrc.rel: ../CPM3/biosldrc.rel biosldrd.rel: ../CPM3/biosldrd.rel cp $< $@ +util.rel: ../CPM3/util.rel + cp $< $@ + zccp.com: ../ZCCP/ccp.com cp $< $@ @@ -47,8 +49,8 @@ zinstal.zpm: ../ZCCP/zinstal.zpm startzpm.com: ../ZCCP/startzpm.com cp $< $@ -setz3.com: setz3.z80 - -clrhist.com: clrhist.z80 +cpmldr.com: ../CPM3/cpmldr.com + cp $< $@ -autotog.com: autotog.z80 +cpmldr.sys: ../CPM3/cpmldr.sys + cp $< $@ diff --git a/Source/ZPM3/Notes.txt b/Source/ZPM3/Notes.txt new file mode 100644 index 00000000..47b11ab2 --- /dev/null +++ b/Source/ZPM3/Notes.txt @@ -0,0 +1,40 @@ +RESBDOS3.SPR and BNKBDOS3.SPR have been replaced +with versions from the Jon Saxton disassembly with +fixes distribution. The file called zpm3fix.txt +have been included and details the fixes. + +ZPMLDR has also been updated with the version from +the Jon Saxton disassembly. However, it has additionally +been updated to correct an issue that was preventing +RomWBW from booting under ZPMLDR. + +ZPMLDR has a slightly modified version of the rdSeq +procedure (compared to CPMLDR). It appears that this +causes deblocking to be bypassed on the initial disk +read of CPM3.SYS. As a result, the entire disk sector +(512 bytes) is read starting at 0x0080. This winds up +overlaying 0x180 bytes of the start of ZPMLDR.COM causing +it to fail catastrophically. + +According to the documentation at the top of zpm3ldr.z80, +zpmldr is normally loaded from system tracks to address +0x0400. In that scenario, the read of the entire sector +would not overlay the start of the application. So, I +suspect this is why this (bug?) is not relevant to many +implementations. + +The ZPM3LDR.REL file used here has been modified to +sync the rdSeq procedure back to the DIR CPMLDR version. +This seems to allow ZPMLDR to work with RomWBW now. + +--WBW 4:22 PM 12/8/2021 + +Jose Luis reported that attempting to change to a different +DU by using a named directory was not working correctly. +It was working with the original ZPM3 distribution, but not +with the Jon Saxton patches. Refer to the RomWBW Issue +https://github.com/wwarthen/RomWBW/issues/324. I was able +to track down the issue and have applied an additional +patch to correct the Jon Saxton variant. + +--WBW 8:46 PM 3/12/2023 \ No newline at end of file diff --git a/Source/ZPM3/autotog.com b/Source/ZPM3/autotog.com deleted file mode 100644 index 3c7a5980..00000000 Binary files a/Source/ZPM3/autotog.com and /dev/null differ diff --git a/Source/ZPM3/autotog.z80 b/Source/ZPM3/autotog.z80 index b59a6663..9862af58 100644 --- a/Source/ZPM3/autotog.z80 +++ b/Source/ZPM3/autotog.z80 @@ -45,13 +45,13 @@ ACPoff equ 85h ; Offset in SCB base page of Auto Command Prompting bit HELPmsg: db ' SYNTAX:' db 10,13 - db ' AUTOTOG Toggles the state of the Auto Command Prompting' + db ' AUTOTOG Toggles the state of the Auto Command Prompting' db 10,13 - db ' AUTOTOG ON Enables Auto Command Prompting' + db ' AUTOTOG ON Enables Auto Command Prompting' db 10,13 - db ' AUTOTOG OFF Disables Auto Command Prompting' + db ' AUTOTOG OFF Disables Auto Command Prompting' db 10,13 - db ' AUTOTOG // Displays a brief help message' + db ' AUTOTOG // Displays a brief help message' db '$' ONmsg: db 'ZPM3 Auto Command Prompting is now enabled. Toggle with ^Q.' diff --git a/Source/ZPM3/bnkbdos3.spr b/Source/ZPM3/bnkbdos3.spr index cd31a6a4..54dbdc41 100644 Binary files a/Source/ZPM3/bnkbdos3.spr and b/Source/ZPM3/bnkbdos3.spr differ diff --git a/Source/ZPM3/bnkbdos3.spr.bak b/Source/ZPM3/bnkbdos3.spr.bak new file mode 100644 index 00000000..cd31a6a4 Binary files /dev/null and b/Source/ZPM3/bnkbdos3.spr.bak differ diff --git a/Source/ZPM3/clrhist.com b/Source/ZPM3/clrhist.com deleted file mode 100644 index 02a39c83..00000000 Binary files a/Source/ZPM3/clrhist.com and /dev/null differ diff --git a/Source/ZPM3/loader.asm b/Source/ZPM3/loader.asm index ef80711d..256a8a23 100644 --- a/Source/ZPM3/loader.asm +++ b/Source/ZPM3/loader.asm @@ -27,9 +27,13 @@ ; #INCLUDE "../ver.inc" ; +; BELOW, SYS_END MUST BE SET TO THE SIZE OF CPMLDR.BIN + SYS_LOC. IF +; THE SIZE OF ZPMLDR.BIN CHANGES, SYS_SIZ MUST BE UPDATED!!! +; +SYS_SIZ .EQU $0F00 ; SIZE OF CPMLDR.BIN SYS_ENT .EQU $0100 ; SYSTEM (OS) ENTRY POINT ADDRESS SYS_LOC .EQU $0100 ; STARTING ADDRESS TO LOAD SYSTEM IMAGE -SYS_END .EQU $1480 ; ENDING ADDRESS OF SYSTEM IMAGE +SYS_END .EQU SYS_SIZ + SYS_LOC ; ENDING ADDRESS OF SYSTEM IMAGE ; SEC_SIZE .EQU 512 ; DISK SECTOR SIZE BLK_SIZE .EQU 128 ; OS BLOCK/RECORD SIZE @@ -167,11 +171,56 @@ STR_ERR .DB " Read Error!",0 ; .FILL PT_LOC - $,0 ; FILL TO START OF PARTITION TABLE ; -; RESERVE SPACE FOR STANDARD IBM-PC PARTITION TABLE. ALTHOUGH A +; STANDARD IBM-PC PARTITION TABLE. ALTHOUGH A ; PARTITION TABLE IS NOT RELEVANT FOR A FLOPPY DISK, IT DOES NO HARM. -; THE CONTENTS OF THE PARTITION TABLE MUST BE MANAGED BY FDISK80. -; -PARTTBL .FILL PT_SIZ,0 ; PARTITION TABLE, FILL WITH ZEROES +; THE CONTENTS OF THE PARTITION TABLE CAN BE MANAGED BY FDISK80. +; +; BELOW WE ALLOW FOR 32 SLICES OF ROMWBW CP/M FILESYSTEMS +; FOLLOWED BY A FAT16 PARTITION. THE SLICES FOLLOW THE ORIGINAL +; HD512 ROMWBW FORMAT. IF THE DISK IS USING HD1K, A SEPARATE +; PARTITION TABLE WILL BE IN PLACE AND RENDER THIS PARTITION TABLE +; IRRELEVANT. +; +; THE CYL/SEC FIELDS ENCODE CYLINDER AND SECTOR AS: +; CCCCCCCC:CCSSSSSS +; 76543210:98543210 +; +PART0: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) +PART1: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW %1111111111000001 ; CHS START ADDRESS (CYL/SEC) + .DB 6 ; PART TYPE ID + .DB 15 ; CHS LAST ADDRESS (HEAD) + .DW %1111111111010000 ; CHS LAST ADDRESS (CYL/SEC) + .DW $4000,$0010 ; LBA FIRST (DWORD) + .DW $0000,$000C ; LBA COUNT (DWORD) +PART2: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) +PART3: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) ; ; THE END OF THE FIRST SECTOR MUST CONTAIN THE TWO BYTE BOOT SIGNATURE. ; diff --git a/Source/ZPM3/resbdos3.spr b/Source/ZPM3/resbdos3.spr index 2908ed3e..c62b0340 100644 Binary files a/Source/ZPM3/resbdos3.spr and b/Source/ZPM3/resbdos3.spr differ diff --git a/Source/ZPM3/resbdos3.spr.bak b/Source/ZPM3/resbdos3.spr.bak new file mode 100644 index 00000000..2908ed3e Binary files /dev/null and b/Source/ZPM3/resbdos3.spr.bak differ diff --git a/Source/ZPM3/setz3.com b/Source/ZPM3/setz3.com deleted file mode 100644 index 4ddb374f..00000000 Binary files a/Source/ZPM3/setz3.com and /dev/null differ diff --git a/Source/ZPM3/zpm3fix.txt b/Source/ZPM3/zpm3fix.txt new file mode 100644 index 00000000..4c6bae87 --- /dev/null +++ b/Source/ZPM3/zpm3fix.txt @@ -0,0 +1,187 @@ +PATCHES TO SIMEON CRAN'S ZPM3 +============================= + +ZPM3 is a CP/M 3 workalike written by Simeon Cran. It is readily available in +binary form; just look for archives like zpm3n10.arc and similar. + +This patch contains updated BNKBDOS3.SPR and RESBDOS3.SPR files although it +is only the banked portion which has been modified. + +Three changes have been implemented. + +1. BDOS function 152 (Parse file name) password bug +=================================================== + +The first change was to fix a bug identified by Tilmann Reh in the file name +parser invoked by BDOS function 152. Unlike the parser in standard CP/M 3, +Simeon's version can deal with a user number. The FCB which is filled in by +the parser has the following structure where the field names are those shown +in the CP/M 3 Programmer's Reference Manual: + + + Offset Field Length + ------ ----- ------ + 0 DR 1 Drive code (0 = current, 1 = A, ... 16 = P + 1 NAME 8 File name + 9 TYPE 3 File type (extension) + 12 PM 1 Password mode + 13 S1 1 Reserved + 14 S2 1 Reserved + 15 RC 1 Reserved (Result code) + 16 PASSWORD 8 Password (encrypted) + 24 RESERVED 8 Used by CP/M 3 + +Now the RC field gets set to FFh if an error occurs during the parse but S1 +and S2 are not used at all by CP/M 3. Simeon's parser uses those fields to +store the user number (S1) and a copy of the DR field (S2) thus rendering the +parser far more useful in that it can now handle names like + + K12:TESSER.CAT + +and deliver a sensible result to a user program. + +None of this is useful to other CP/M 3 implementations and so most programs do +their own parsing but the basic idea is commendable. However Tilmann noticed +that if a password is attached to a file then Simeon's parser puts it in the +wrong place, overwriting the four fields PM through RC. + +It is probably not a critical issue; after all, how many CP/M 3 users bother +to password-protect files? Nevertheless it is clearly wrong and is fixed in +this version of BNKBDOS3.SPR. + +2. BDOS function 152 (Parse file name) user/drive prefix +======================================================== + +A limitation of Simeon's parser is that it cannot handle the UD: (user, drive) +prefix, only the DU: form. That was annoying to me since I am just as likely +to type 7g:tesser.cat as g7:tesser.cat. My second patch was to fix ZPM3 to +handle both the UD: and DU: prefix forms. + +I also put the drive number in the S2 field even when no drive was specified +in the input string. Assuming that the current drive is E and the current +user number is 8 then the following results are obtained with the inputs +shown: + + Input string DR S1 S2 + ------------ -- -- -- + FILE.EXT 0 8 5 + E:FILE.EXT 5 8 5 + 12:FILE.EXT 0 12 5 + G:FILE.EXT 7 8 7 + G12:FILE.EXT 7 12 7 + 12G:FILE.EXT 7 12 7 + +The interesting cases shown above are the first and third. Setting DR to zero +is consistent with the way standard CP/M works and the setting of S2 is just +extra information which may be of use to the calling program but which can +be ignored. Unfortunately it is not possible to do the same thing with the +user number because standard CP/M does not have a field for that. + +3. BDOS function 152 (Parse file name) Clear target FCB +======================================================= + +On 2013-09-05 a contributor to comp.os.cpm known only as "Ed" pointed out that +there is yet another bug in BDOS 152 in that it does not clear the record +number fields in the last four bytes of the FCB populated by the function. +A program which uses the FCB for a read or write operation without first +explicitly setting the fields will have the I/O operation start at some +unexpected position in the file. + +This problem has also been fixed. + +4. Command line editing keys +============================ + +A couple of years ago I added code to yaze-ag (a Z80 emulator) to make it +possible to use the cursor and function keys on a modern PC keyboard to do +sensible things in CP/M. The keyboard translations are specified in external +text files and can be loaded dynamically from within CP/M. + +By far the most useful translate table maps the arrow keys to WordStar +controls. For example, pressing the up arrow key generates a ^E, pressing +PgUp generates ^R and so on. This works really well in most cases but there +is one piece of software which gives problems, namely CP/M itself. + +Yaze-ag uses Simeon Cran's ZPM3 as a replacement for the CP/M 3 BDOS. It was +a good choice because ZPM3 offers more features than standard CP/M 3 and in +particular, it provides a rich command history facility with decent recall and +edit capabilities. + +As originally implemented, ZPM3 viewed the history as an upward-growing +stack, i.e. with new lines being added at the top. For example assume +that lines comprising the single words "one", "two", "three", "four" and +"five" are entered in sequence. The history looks like this: + + -> (current line, blank) + five (newest) + four + three + two + one (oldest) + +According to this view, the NEXT line in the history is the last one +entered. After ^W ^W ^W ^W (NEXT, NEXT, NEXT, NEXT) the view is like this: + + two (line ready for editing) + five (newest) + four + three + -> two + one (oldest) + +After ^E ^E (PREVIOUS, PREVIOUS) the view is: + + four (line ready for editing) + five (newest) + -> four + three + two + one (oldest) + +This is all very consistent. The problem is that it is utterly counter- +intuitive and the complete reverse of any recall and edit scheme in any +other operating system. For example, linux and Windows both view shell +command history as a stack, but one which grows downwards. The most +recently entered command is the one conceptually ABOVE the current line. +This view of the command history also corresponds to the way that we +compose text, where new lines are added below the most recently added +lines. + +Using the same five-line example as above, the initial view would be: + + one (oldest) + two + three + four + five (newest) + -> (current line, blank) + +After UP, UP, UP, UP the view is: + + one (oldest) + -> two + three + four + five (newest) + two (line ready for editing) + +then DOWN, DOWN yields: + + one (oldest) + two + three + -> four + five (newest) + four (line ready for editing) + +Tilman Reh recognised this as a bug when he disassembled this ZPM3. +It was fixed by cross-renaming the two routines NextLine and PreviousLine +and for WordStar compatability the NextLine routine was moved to ^W. +That meant the previous occupant of the ^W position, DeleteToLeft had to +be moved also. For no particularly good reason I chose to use the just- +vacated ^X slot. + +Although I cannot imagine why one would want to do so, the original ZPM3 +behaviour can be recovered by setting the assembly-time switch "HistoryBug" +to some odd number, e.g. 0FFFFh. + \ No newline at end of file diff --git a/Source/ZPM3/zpm3ldr.rel b/Source/ZPM3/zpm3ldr.rel index bca9c4be..af6568df 100644 Binary files a/Source/ZPM3/zpm3ldr.rel and b/Source/ZPM3/zpm3ldr.rel differ diff --git a/Source/ZPM3/zpm3ldr.rel.bak b/Source/ZPM3/zpm3ldr.rel.bak new file mode 100644 index 00000000..bca9c4be Binary files /dev/null and b/Source/ZPM3/zpm3ldr.rel.bak differ diff --git a/Source/ZRC/Build.cmd b/Source/ZRC/Build.cmd new file mode 100644 index 00000000..3cef14a5 --- /dev/null +++ b/Source/ZRC/Build.cmd @@ -0,0 +1,38 @@ +@echo off +setlocal + +set TOOLS=../../Tools + +set PATH=%TOOLS%\srecord;%PATH% + +if exist ..\..\Binary\RCZ80_zrc.rom call :build_zrc + +if exist ..\..\Binary\RCZ80_zrc_ram.rom call :build_zrc_ram + +goto :eof + +:build_zrc + +srec_cat -generate 0x0 0x100000 --constant 0x00 -o temp.dat -binary +srec_cat temp.dat -binary -exclude 0x0 0x100 zrc_cfldr.bin -binary -o temp.dat -binary +srec_cat temp.dat -binary -exclude 0x100 0x200 zrc_ptbl.bin -binary -offset 0x100 -o temp.dat -binary +srec_cat temp.dat -binary -exclude 0x1F000 0x20000 zrc_mon.bin -binary -offset 0x1F000 -o temp.dat -binary +srec_cat temp.dat -binary -exclude 0x24000 0xA4000 ..\..\Binary\RCZ80_zrc.rom -binary -offset 0x24000 -o temp.dat -binary +move temp.dat ..\..\Binary\hd1k_zrc_prefix.dat + +copy /b ..\..\Binary\hd1k_zrc_prefix.dat + ..\..\Binary\hd1k_cpm22.img + ..\..\Binary\hd1k_zsdos.img + ..\..\Binary\hd1k_nzcom.img + ..\..\Binary\hd1k_cpm3.img + ..\..\Binary\hd1k_zpm3.img + ..\..\Binary\hd1k_ws4.img ..\..\Binary\hd1k_zrc_combo.img || exit /b + +goto :eof + +:build_zrc_ram + +srec_cat -generate 0x0 0x100000 --constant 0x00 -o temp.dat -binary +srec_cat temp.dat -binary -exclude 0x0 0x100 zrc_cfldr.bin -binary -o temp.dat -binary +srec_cat temp.dat -binary -exclude 0x100 0x200 zrc_ptbl.bin -binary -offset 0x100 -o temp.dat -binary +srec_cat temp.dat -binary -exclude 0x1F000 0x20000 zrc_mon.bin -binary -offset 0x1F000 -o temp.dat -binary +srec_cat temp.dat -binary -exclude 0x24000 0xA4000 ..\..\Binary\RCZ80_zrc_ram.rom -binary -offset 0x24000 -o temp.dat -binary +move temp.dat ..\..\Binary\hd1k_zrc_ram_prefix.dat + +copy /b ..\..\Binary\hd1k_zrc_ram_prefix.dat + ..\..\Binary\hd1k_cpm22.img + ..\..\Binary\hd1k_zsdos.img + ..\..\Binary\hd1k_nzcom.img + ..\..\Binary\hd1k_cpm3.img + ..\..\Binary\hd1k_zpm3.img + ..\..\Binary\hd1k_ws4.img ..\..\Binary\hd1k_zrc_ram_combo.img || exit /b + +goto :eof diff --git a/Source/ZRC/Clean.cmd b/Source/ZRC/Clean.cmd new file mode 100644 index 00000000..fa12c5c7 --- /dev/null +++ b/Source/ZRC/Clean.cmd @@ -0,0 +1,3 @@ +@echo off +setlocal + diff --git a/Source/ZRC/Makefile b/Source/ZRC/Makefile new file mode 100644 index 00000000..092d011c --- /dev/null +++ b/Source/ZRC/Makefile @@ -0,0 +1,48 @@ +HD1KZRCPREFIX = hd1k_zrc_prefix.dat +HD1KZRCCOMBOIMG = hd1k_zrc_combo.img +HD1KZRCRAMPREFIX = hd1k_zrc_ram_prefix.dat +HD1KZRCRAMCOMBOIMG = hd1k_zrc_ram_combo.img +ZRCROM = ../../Binary/RCZ80_zrc.rom +ZRCRAMROM = ../../Binary/RCZ80_zrc_ram.rom +HD1KIMGS = ../../Binary/hd1k_cpm22.img ../../Binary/hd1k_zsdos.img ../../Binary/hd1k_nzcom.img \ + ../../Binary/hd1k_cpm3.img ../../Binary/hd1k_zpm3.img ../../Binary/hd1k_ws4.img + +OBJECTS := + +ifneq ($(wildcard $(ZRCROM)),) + OBJECTS += $(HD1KZRCPREFIX) $(HD1KZRCCOMBOIMG) +endif + +ifneq ($(wildcard $(ZRCRAMROM)),) + OBJECTS += $(HD1KZRCRAMPREFIX) $(HD1KZRCRAMCOMBOIMG) +endif + +DEST=../../Binary + +TOOLS = ../../Tools + +include $(TOOLS)/Makefile.inc + +DIFFPATH = $(DIFFTO)/Binary + +$(HD1KZRCPREFIX): + srec_cat -generate 0x0 0x100000 --constant 0x00 -o temp.dat -binary + srec_cat temp.dat -binary -exclude 0x0 0x100 zrc_cfldr.bin -binary -o temp.dat -binary + srec_cat temp.dat -binary -exclude 0x100 0x200 zrc_ptbl.bin -binary -offset 0x100 -o temp.dat -binary + srec_cat temp.dat -binary -exclude 0x1F000 0x20000 zrc_mon.bin -binary -offset 0x1F000 -o temp.dat -binary + srec_cat temp.dat -binary -exclude 0x24000 0xA4000 $(ZRCROM) -binary -offset 0x24000 -o temp.dat -binary + mv temp.dat $@ + +$(HD1KZRCRAMPREFIX): + srec_cat -generate 0x0 0x100000 --constant 0x00 -o temp.dat -binary + srec_cat temp.dat -binary -exclude 0x0 0x100 zrc_cfldr.bin -binary -o temp.dat -binary + srec_cat temp.dat -binary -exclude 0x100 0x200 zrc_ptbl.bin -binary -offset 0x100 -o temp.dat -binary + srec_cat temp.dat -binary -exclude 0x1F000 0x20000 zrc_mon.bin -binary -offset 0x1F000 -o temp.dat -binary + srec_cat temp.dat -binary -exclude 0x24000 0xA4000 $(ZRCRAMROM) -binary -offset 0x24000 -o temp.dat -binary + mv temp.dat $@ + +$(HD1KZRCCOMBOIMG): $(HD1KZRCPREFIX) $(HD1KIMGS) + cat $^ > $@ + +$(HD1KZRCRAMCOMBOIMG): $(HD1KZRCRAMPREFIX) $(HD1KIMGS) + cat $^ > $@ diff --git a/Source/ZRC/ZRC Disk Layout.txt b/Source/ZRC/ZRC Disk Layout.txt new file mode 100644 index 00000000..d8a6e027 --- /dev/null +++ b/Source/ZRC/ZRC Disk Layout.txt @@ -0,0 +1,24 @@ +CF Boot Loader: Sector 0 (bytes 0-255) +RomWBW Partition Table: Sector 0 (bytes 256-511) +ZRC Monitor: Sectors 0xF8-0xFF (bytes 0x1F000-0x1FFFF) +RomWBW: Sectors 0x120-0x51F (bytes 0x24000-0xA3FFF) +Start of Slices (0x1E partition): Sector 0x800 (byte 0x100000) + +Start Length Description +------- ------- --------------------------- +0x00000 0x00100 CF Boot Loader +0x00100 0x00100 RomWBW Partition Table +0x00200 0x1EE00 Filler +0x1F000 0x01000 ZRC Monitor +0x20000 0x04000 Filler +0x24000 0x80000 RomWBW +0xA4000 0x5C000 Filler +0x100000: Start of slices (partition 0x1E) + +Notes +----- + +- At startup CPLD ROM is mapped to Z80 CPU address space 0x0000-0x003F, CPU begins execution at 0x0000 +- CPLD ROM (CF bootstrap mode) reads CF Boot Loader (256B) from start of CF (MBR) to 0xB000 and runs it +- CF Boot Loader reads ZRC Monitor (4KB) from sectors 0xF8-0xFF of CF to 0xB400 and runs it +- ZRC Monitor reads 512KB (RomWBW) from sectors 0x120-0x51F of CF into first 512KB of RAM diff --git a/Source/ZRC/zrc_cfldr.bin b/Source/ZRC/zrc_cfldr.bin new file mode 100644 index 00000000..9a28f43b Binary files /dev/null and b/Source/ZRC/zrc_cfldr.bin differ diff --git a/Source/ZRC/zrc_mon.bin b/Source/ZRC/zrc_mon.bin new file mode 100644 index 00000000..ae6c886c Binary files /dev/null and b/Source/ZRC/zrc_mon.bin differ diff --git a/Source/ZRC/zrc_ptbl.bin b/Source/ZRC/zrc_ptbl.bin new file mode 100644 index 00000000..5e3a2a4d Binary files /dev/null and b/Source/ZRC/zrc_ptbl.bin differ diff --git a/Source/ZSDOS/Build.cmd b/Source/ZSDOS/Build.cmd index 984b376a..554a8dbb 100644 --- a/Source/ZSDOS/Build.cmd +++ b/Source/ZSDOS/Build.cmd @@ -3,21 +3,19 @@ setlocal set TOOLS=../../Tools -set PATH=%TOOLS%\tasm32;%TOOLS%\zx;%PATH% +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%PATH% set TASMTABS=%TOOLS%\tasm32 -set ZXBINDIR=%TOOLS%/cpm/bin/ -set ZXLIBDIR=%TOOLS%/cpm/lib/ -set ZXINCDIR=%TOOLS%/cpm/include/ +set CPMDIR80=%TOOLS%/cpm/ -zx ZMAC -ZSDOS -/P -zx LINK -ZSDOS.BIN=ZSDOS[LD800] +zxcc ZMAC -ZSDOS -/P || exit /b +zxcc LINK -ZSDOS.BIN=ZSDOS[LD800] || exit /b -tasm -t80 -g3 -fFF loader.asm loader.bin loader.lst +tasm -t80 -g3 -fFF loader.asm loader.bin loader.lst || exit /b -copy /b ..\zcpr-dj\zcpr.bin + zsdos.bin + ..\cbios\cbios_wbw.bin zsys_wbw.bin -copy /b ..\zcpr-dj\zcpr.bin + zsdos.bin + ..\cbios\cbios_una.bin zsys_una.bin +copy /b ..\zcpr-dj\zcpr.bin + zsdos.bin + ..\cbios\cbios_wbw.bin zsys_wbw.bin || exit /b +copy /b ..\zcpr-dj\zcpr.bin + zsdos.bin + ..\cbios\cbios_una.bin zsys_una.bin || exit /b -copy /b loader.bin + zsys_wbw.bin zsys_wbw.sys -copy /b loader.bin + zsys_una.bin zsys_una.sys +copy /b loader.bin + zsys_wbw.bin zsys_wbw.sys || exit /b +copy /b loader.bin + zsys_una.bin zsys_una.sys || exit /b diff --git a/Source/ZSDOS/Clock/Build.cmd b/Source/ZSDOS/Clock/Build.cmd index 8b14f5c5..2a02d1e1 100644 --- a/Source/ZSDOS/Clock/Build.cmd +++ b/Source/ZSDOS/Clock/Build.cmd @@ -3,12 +3,10 @@ setlocal set TOOLS=../../../Tools -set PATH=%TOOLS%\tasm32;%TOOLS%\zx;%PATH% +set PATH=%TOOLS%\tasm32;%TOOLS%\zxcc;%PATH% set TASMTABS=%TOOLS%\tasm32 -set ZXBINDIR=%TOOLS%/cpm/bin/ -set ZXLIBDIR=%TOOLS%/cpm/lib/ -set ZXINCDIR=%TOOLS%/cpm/include/ +set CPMDIR80=%TOOLS%/cpm/ -zx ZMAC -WBWCLK -/P +zxcc ZMAC -WBWCLK -/P || exit /b diff --git a/Source/ZSDOS/Distribution/COPY.COM b/Source/ZSDOS/Distribution/COPY.COM index 87c0c2fb..606c81a5 100644 Binary files a/Source/ZSDOS/Distribution/COPY.COM and b/Source/ZSDOS/Distribution/COPY.COM differ diff --git a/Source/ZSDOS/Makefile b/Source/ZSDOS/Makefile index 90963e9d..55731ea4 100644 --- a/Source/ZSDOS/Makefile +++ b/Source/ZSDOS/Makefile @@ -8,10 +8,10 @@ CCP = ../ZCPR-DJ/zcpr.bin include $(TOOLS)/Makefile.inc zsdos.rel: zsdos.z80 - $(ZXCC) $(CPM)/ZMAC -$< -/P + $(ZXCC) ZMAC -$< -/P zsdos.bin: zsdos.rel - $(ZXCC) $(CPM)/LINK -$@=$<[LD800] + $(ZXCC) LINK -$@=$<[LD800] %.sys: %.bin loader.bin cat loader.bin $*.bin > $@ diff --git a/Source/ZSDOS/loader.asm b/Source/ZSDOS/loader.asm index bdebc314..6703e9aa 100644 --- a/Source/ZSDOS/loader.asm +++ b/Source/ZSDOS/loader.asm @@ -167,11 +167,56 @@ STR_ERR .DB " Read Error!",0 ; .FILL PT_LOC - $,0 ; FILL TO START OF PARTITION TABLE ; -; RESERVE SPACE FOR STANDARD IBM-PC PARTITION TABLE. ALTHOUGH A +; STANDARD IBM-PC PARTITION TABLE. ALTHOUGH A ; PARTITION TABLE IS NOT RELEVANT FOR A FLOPPY DISK, IT DOES NO HARM. -; THE CONTENTS OF THE PARTITION TABLE MUST BE MANAGED BY FDISK80. -; -PARTTBL .FILL PT_SIZ,0 ; PARTITION TABLE, FILL WITH ZEROES +; THE CONTENTS OF THE PARTITION TABLE CAN BE MANAGED BY FDISK80. +; +; BELOW WE ALLOW FOR 32 SLICES OF ROMWBW CP/M FILESYSTEMS +; FOLLOWED BY A FAT16 PARTITION. THE SLICES FOLLOW THE ORIGINAL +; HD512 ROMWBW FORMAT. IF THE DISK IS USING HD1K, A SEPARATE +; PARTITION TABLE WILL BE IN PLACE AND RENDER THIS PARTITION TABLE +; IRRELEVANT. +; +; THE CYL/SEC FIELDS ENCODE CYLINDER AND SECTOR AS: +; CCCCCCCC:CCSSSSSS +; 76543210:98543210 +; +PART0: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) +PART1: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW %1111111111000001 ; CHS START ADDRESS (CYL/SEC) + .DB 6 ; PART TYPE ID + .DB 15 ; CHS LAST ADDRESS (HEAD) + .DW %1111111111010000 ; CHS LAST ADDRESS (CYL/SEC) + .DW $4000,$0010 ; LBA FIRST (DWORD) + .DW $0000,$000C ; LBA COUNT (DWORD) +PART2: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) +PART3: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) ; ; THE END OF THE FIRST SECTOR MUST CONTAIN THE TWO BYTE BOOT SIGNATURE. ; diff --git a/Source/ZZRC/Bank Layout.txt b/Source/ZZRC/Bank Layout.txt new file mode 100644 index 00000000..9e2d951e --- /dev/null +++ b/Source/ZZRC/Bank Layout.txt @@ -0,0 +1,32 @@ +ZZRCC has no real ROM. It has a single 512K RAM chip. The first +256K of the RAM chip is loaded from the CF card. This 256K is +treated like ROM by RomWBW. The remainder of the RAM (256K) is +treated like RAM by RomWBW. + +Because of the memory constraints, notice that there is no RAM Disk, +only a ROM disk. If you perform a ROM boot to an OS, the A: drive +will be the ROM disk and will not be writable. Booting a ROM OS +on this system is not typical since the system has a CF card by +definition. + +Bank ROM RAM RAM +---- --- --- --- +0 HBIOS (IMG) +1 ROMLDR+MON+CP/M2+ZSYS +2 FTH+BAS+TBAS+PLAY+USR +3 RESERVED +4 ROMDISK +5 ROMDISK +6 ROMDISK +7 ROMDISK + +8 BUF (CPM3) BUF (CPM3) +9 BUF (CPM3) BUF (CPM3) +A BUF (CPM3) BUF (CPM3) +B BUF (CPM3) BUF (CPM3) +C AUX (CPM3) TPA (CPM3) +D HBIOS (EXEC) HBIOS (EXEC) +E TPA-LO OS (CPM3) +F COMMON (TPA-HI) COMMON (TPA-HI) + +--WBW 6:40 PM 2/16/2022 \ No newline at end of file diff --git a/Source/ZZRC/Build.cmd b/Source/ZZRC/Build.cmd new file mode 100644 index 00000000..700e21b7 --- /dev/null +++ b/Source/ZZRC/Build.cmd @@ -0,0 +1,42 @@ +:: @echo off +setlocal + +set ROMFILE=..\..\Binary\RCZ280_zzrc.rom +set ROMSIZE=262144 + +if not exist %ROMFILE% goto :eof + +:: +:: The ROM image *must* be exactly 256K or the resulting disk +:: image produced below will be invalid. Check for the proper size. +:: + +call :filesize %ROMFILE% + +if "%FILESIZE%" neq "%ROMSIZE%" ( + echo. + echo. + echo ERROR: "%ROMFILE%" is not exactly %ROMSIZE% bytes as required!!! + echo You must specify a ROMSIZE of "256" when building the ZZRCC ROM image. + echo. + echo. + exit /b 1 +) + +rem ..\..\Tools\srecord\srec_cat.exe ..\..\Binary\RCZ280_zzrc.rom -Binary -Exclude 0x5000 0x7000 zzrc_romldr.hex -Intel -Output ..\..\Binary\RCZ280_zzrc.hex -Intel || exit /b + +..\..\Tools\srecord\srec_cat.exe ..\..\Binary\RCZ280_zzrc.rom -Binary -Output ..\..\Binary\RCZ280_zzrc.hex -Intel || exit /b + +rem ..\..\Tools\srecord\srec_cat.exe ..\..\Binary\RCZ280_zzrc.hex -Intel -Output ..\..\Binary\RCZ280_zzrc_ldr.rom -Binary || exit /b + +rem copy /b zzrc_cfldr.bin + zzrc_ptbl.bin + zzrc_fill_1.bin + zzrc_mon.bin + zzrc_fill_2.bin + ..\..\Binary\RCZ280_zzrc_ldr.rom + zzrc_fill_3.bin ..\..\Binary\hd1k_zzrc_prefix.dat || exit /b + +copy /b zzrc_cfldr.bin + zzrc_ptbl.bin + zzrc_fill_1.bin + zzrc_mon.bin + zzrc_fill_2.bin + ..\..\Binary\RCZ280_zzrc.rom + zzrc_fill_3.bin ..\..\Binary\hd1k_zzrc_prefix.dat || exit /b + +copy /b ..\..\Binary\hd1k_zzrc_prefix.dat + ..\..\Binary\hd1k_cpm22.img + ..\..\Binary\hd1k_zsdos.img + ..\..\Binary\hd1k_nzcom.img + ..\..\Binary\hd1k_cpm3.img + ..\..\Binary\hd1k_zpm3.img + ..\..\Binary\hd1k_ws4.img ..\..\Binary\hd1k_zzrc_combo.img || exit /b + +goto :eof + +:filesize +set FILESIZE=%~z1 +goto :eof \ No newline at end of file diff --git a/Source/ZZRC/Clean.cmd b/Source/ZZRC/Clean.cmd new file mode 100644 index 00000000..fa12c5c7 --- /dev/null +++ b/Source/ZZRC/Clean.cmd @@ -0,0 +1,3 @@ +@echo off +setlocal + diff --git a/Source/ZZRC/Makefile b/Source/ZZRC/Makefile new file mode 100644 index 00000000..935a7bf2 --- /dev/null +++ b/Source/ZZRC/Makefile @@ -0,0 +1,33 @@ +HD1KZZRCPREFIX = hd1k_zzrc_prefix.dat +HD1KZZRCCOMBOIMG = hd1k_zzrc_combo.img +ZZRCROM = ../../Binary/RCZ280_zzrc.rom +ZZRCROMHEX = RCZ280_zzrc.hex +HD1KIMGS = ../../Binary/hd1k_cpm22.img ../../Binary/hd1k_zsdos.img ../../Binary/hd1k_nzcom.img \ + ../../Binary/hd1k_cpm3.img ../../Binary/hd1k_zpm3.img ../../Binary/hd1k_ws4.img +ZZRCROMSIZE = 262144 + +OBJECTS := + +ifneq ($(wildcard $(ZZRCROM)),) + OBJECTS += $(ZZRCROMHEX) $(HD1KZZRCPREFIX) $(HD1KZZRCCOMBOIMG) +endif + +DEST=../../Binary + +TOOLS = ../../Tools + +include $(TOOLS)/Makefile.inc + +DIFFPATH = $(DIFFTO)/Binary + +zzrcromchk: + [ `wc -c $(ZZRCROM) | awk '{print $$1}'` = $(ZZRCROMSIZE) ] + +$(HD1KZZRCPREFIX): zzrcromchk + cat zzrc_cfldr.bin zzrc_ptbl.bin zzrc_fill_1.bin zzrc_mon.bin zzrc_fill_2.bin $(ZZRCROM) zzrc_fill_3.bin >$@ + +$(HD1KZZRCCOMBOIMG): zzrcromchk $(HD1KZZRCPREFIX) $(HD1KIMGS) + cat $(HD1KZZRCPREFIX) $(HD1KIMGS) > $@ + +$(ZZRCROMHEX): zzrcromchk $(ZZRCROM) + srec_cat $(ZZRCROM) -Binary -Output $(ZZRCROMHEX) -Intel -CRLF diff --git a/Source/ZZRC/ZZRC Disk Layout.txt b/Source/ZZRC/ZZRC Disk Layout.txt new file mode 100644 index 00000000..6042edde --- /dev/null +++ b/Source/ZZRC/ZZRC Disk Layout.txt @@ -0,0 +1,31 @@ +Start Length Sector Count Description +------- ------- ------- ------- ----------------------------------------- +0x00000 0x00100 0x000 0x001 CF Boot Loader (first 256 bytes) +0x00100 0x00100 0x000 0x001 RomWBW Partition Table (last 256 bytes) +0x00200 0x1EE00 0x001 0x0F7 Filler +0x1F000 0x01000 0x0F8 0x008 ZZRCC Monitor / RomWBW Loader +0x20000 0x04000 0x100 0x020 Filler +0x24000 0x40000 0x120 0x200 RomWBW (256KB ROM image) +0x64000 0x9C000 0x320 0x4E0 Filler +0x100000 0x800 Slices + +Notes +----- + +- At startup CPLD ROM is mapped to Z80 CPU address space 0x0000-0x003F, CPU begins execution at 0x0000 +- CPLD ROM (CF bootstrap mode) loads CF Boot Loader (256B) to 0xB000 and runs it +- CF Boot Loader loads ZZRCC Monitor to 0xB000 and runs it starting at address 0xB400 +- Monitor (Boot RomWBW) loads RomWBW ROM image to first 8 banks of RAM, then runs it starting at address 0x000 + +Possible alternative layout: + +Start Length Sector Count Description +------- ------- ------- ------- ----------------------------------------- +0x00000 0x00100 0 1 CF Boot Loader (first 256 bytes) +0x00100 0x00100 0 1 RomWBW Partition Table (last 256 bytes) +0x00200 0x01000 0x001 0x008 ZZRCC Monitor / RomWBW Loader +0x01200 0x7EE00 0x009 0x3F7 Filler +0x80000 0x40000 0x400 0x200 RomWBW (256KB ROM image) +0xC0000 0x40000 0x600 0x200 Filler +0x100000 0x800 Slices (0x1E partition start) + diff --git a/Source/ZZRC/zzrc_cfldr.bin b/Source/ZZRC/zzrc_cfldr.bin new file mode 100644 index 00000000..04b6c228 Binary files /dev/null and b/Source/ZZRC/zzrc_cfldr.bin differ diff --git a/Source/ZZRC/zzrc_fill_1.bin b/Source/ZZRC/zzrc_fill_1.bin new file mode 100644 index 00000000..705bedcd Binary files /dev/null and b/Source/ZZRC/zzrc_fill_1.bin differ diff --git a/Source/ZZRC/zzrc_fill_2.bin b/Source/ZZRC/zzrc_fill_2.bin new file mode 100644 index 00000000..294f4016 Binary files /dev/null and b/Source/ZZRC/zzrc_fill_2.bin differ diff --git a/Source/ZZRC/zzrc_fill_3.bin b/Source/ZZRC/zzrc_fill_3.bin new file mode 100644 index 00000000..38b2e993 Binary files /dev/null and b/Source/ZZRC/zzrc_fill_3.bin differ diff --git a/Source/ZZRC/zzrc_mon.bin b/Source/ZZRC/zzrc_mon.bin new file mode 100644 index 00000000..e9a04d74 Binary files /dev/null and b/Source/ZZRC/zzrc_mon.bin differ diff --git a/Source/ZZRC/zzrc_ptbl.bin b/Source/ZZRC/zzrc_ptbl.bin new file mode 100644 index 00000000..5e3a2a4d Binary files /dev/null and b/Source/ZZRC/zzrc_ptbl.bin differ diff --git a/Source/pSys/Build.cmd b/Source/pSys/Build.cmd new file mode 100644 index 00000000..8b545335 --- /dev/null +++ b/Source/pSys/Build.cmd @@ -0,0 +1,55 @@ +@echo off +setlocal + +set TOOLS=../../Tools + +set PATH=%TOOLS%\tasm32;%PATH% + +set TASMTABS=%TOOLS%\tasm32 + +echo. +echo Building p-System BIOS Tester Loader for RomWBW... +echo. +tasm -t80 -g3 -dTESTBIOS loader.asm testldr.bin testldr.lst || exit /b +if errorlevel 1 goto :eof + +echo. +echo Building p-System BIOS for RomWBW... +echo. +tasm -t80 -g3 bios.asm bios.bin bios.lst || exit /b +if errorlevel 1 goto :eof + +echo. +echo Building p-System Loader for RomWBW... +echo. +tasm -t80 -g3 loader.asm loader.bin loader.lst || exit /b +if errorlevel 1 goto :eof + +echo. +echo Generating p-System BIOS Tester filler... +echo. +tasm -t80 -g3 fill.asm fill.bin fill.lst || exit /b +if errorlevel 1 goto :eof + +echo. +echo Generating p-System Boot Track filler... +echo. +tasm -t80 -g3 -dTESTBIOS fill.asm testfill.bin testfill.lst || exit /b +if errorlevel 1 goto :eof + +echo. +echo Creating p-System BIOS Tester boot image +echo. +copy /b ..\Images\hd1k_prefix.dat + testldr.bin + bios.bin + biostest.dat + testfill.bin psystest.img || exit /b + +echo. +echo Generating p-System Boot Track... +echo. +copy /b loader.bin + bios.bin + boot.dat + fill.bin trk0.bin || exit /b + +echo. +echo Generating p-System Disk Image... +echo. +copy /b ..\Images\hd1k_prefix.dat + trk0.bin + psys.vol + trk0.bin + blank.vol psys.img || exit /b + +copy psys.img ..\..\Binary || exit /b \ No newline at end of file diff --git a/Source/pSys/Clean.cmd b/Source/pSys/Clean.cmd new file mode 100644 index 00000000..f9ed83d2 --- /dev/null +++ b/Source/pSys/Clean.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +if exist *.bin del *.bin +if exist *.lst del *.lst +if exist *.img del *.img diff --git a/Source/pSys/Makefile b/Source/pSys/Makefile new file mode 100644 index 00000000..393beea4 --- /dev/null +++ b/Source/pSys/Makefile @@ -0,0 +1,22 @@ +OBJECTS = psys.img psystest.img +TOOLS = ../../Tools +DEST = ../../Binary +OTHERS = *.bin *.lst *.img +NOCOPY = psystest.img +include $(TOOLS)/Makefile.inc + +trk0.bin: loader.bin bios.bin boot.dat fill.bin + cat $+ >$@ + +psys.img: ../Images/hd1k_prefix.dat trk0.bin psys.vol trk0.bin blank.vol + cat $+ >$@ + +testldr.bin: loader.asm + $(TASM) -dTESTBIOS $< $@ testldr.lst + +testfill.bin: fill.asm + $(TASM) -dTESTBIOS $< $@ testfill.lst + + +psystest.img: ../Images/hd1k_prefix.dat testldr.bin bios.bin biostest.dat testfill.bin + cat $+ >$@ diff --git a/Source/pSys/ReadMe.txt b/Source/pSys/ReadMe.txt new file mode 100644 index 00000000..9c1c5507 --- /dev/null +++ b/Source/pSys/ReadMe.txt @@ -0,0 +1,141 @@ +This directory contains a port of p-System IV.0 for RomWBW. + +It was derived from the p-System Adaptable Z80 System. Unlike some +other distributions, this implements a native p-System Z80 Extended +BIOS, it does not use a CP/M BIOS layer. + +Files: + +loader.asm p-System primary loader for RomWBW +bios.asm p-System BIOS for RomWBW HBIOS source (TASM) +biostest.dat binary image of SBIOSTESTER +boot.dat binary image of p-System bootstrap +psys.vol first (boot) slice, all p-System dist files +blank.vol a generic blank p-System volume +fill.asm used to complete the track 0 build (see below) + +Notes: + +This adaptation runs on a single RomWBW HBIOS hard disk type device (CF +Card, SD Card, IDE drive, etc.). The image built (psys.img) should be +copied to your disk media starting at the first sector. You can then +boot by selecting the corresponding disk device unit number from the +RomWBW boot loader prompt. The p-System disk image (psys.img) is +entirely different from the RomWBW CP/M-style disk images. + +The boot device hard disk is broken up into 6 logical p-System +volumes. These are referred to as p-System slices. A single RomWBW +disk device can contain either CP/M-style slices or p-System slices, +but not both. Each p-System slices is exactly 8 MB and support for +exactly 6 slices is provided. + +The first track of each volume contains all of the code required to +boot the p-System. However, the assignment of the volumes is always in +the order that the slices appear physically on the hard disk device. +Normally, you would just boot to slice 0 from the RomWBW Boot Loader. + +The first track contains the following: + - 4 sector p-System primary loader for RomWBW HBIOS + - 1.5 sector p-System BIOS for RomWBW HBIOS + - 4 sector p-System bootstrap + - 6.5 sector filler to complete a full track + +The p-System bootstrap is a binary image provided in the p-System +distribution. The loader and the BIOS are custom for RomWBW and the +source is provided here. + +The layout of the first track does not conform exactly to the +recommended p-System layout. The recommended layout is not possible +because it conflicts with the RomWBW definition for a boot track. +However, the changes are only slightly different sector assignments for +the different boot componets -- the general boot sequence and mechanism +for the p-System is completely standard. + +The logical disk geometry used by this p-System +adaptation is: + - 512 byte sector length + - 16 sectors per track + - 192 tracks per disk + +This layout does not occupy the full 8MB slice size allocated. This is +to allow for future expansion of the filesystems. + +The p-System distribution includes a BIOS tester that is provided as a +binary image. This tester was used to test the BIOS code in this +adaptation. It turns out that this code has a blatant error that +causes it to fail for 512 byte sector sizes (which are allowed). +To resolve this, biostest.dat was disassembled and patched to correct +the error. The original version is retained as biostest.old. + +The boot disk provided here was constructed by simply copying all of +the content from the p-System distribution disks onto the boot disk. +SYSTEM.MISCINFO was updated for an ANSI terminal. The GOTOXY routine +in SYSTEM.PASCAL was also updated for an ANSI terminal. Note that the +BIOS conwrit routine is hacked to add a '[' to any output escape +character. This is needed because p-System has a very limited terminal +escape sequence handling configuration. The debugger code as added to +SYSTEM.PASCAL to enable the debug function. SYSTEM.INTERP was modified +to enable the extended BIOS functions. + +The build/makefile creates the psys disk image (psys.img) by adding +concatentating psys.vol and blank.vol (after adding track 0 contents to +each). psys.vol and blank.vol are recognized by CiderPress and +CiderPress can be used to add/remove files from these volumes. +However, there is currently no straightforward way to extract the +volumes from the disk image. If you are good with a binary disk +editor, you can do it that way. Please contact me if you are +interested in pursuing that. + +There is currently no support for floppy drives. + +Wayne Warthen +wwarthen@gmail.com + +5:42 PM Sunday, January 15, 2023 + +So, it turns out that the serial line support in p-System is seriously +deficient. It insists on polling all of the serial input devices +(console, remote, and printer) when the sytem is idle with the idea +that it will queue up any characters received. I guess the idea is +that this will help in scenarios where characters are coming in too +fast to be processed. However, the basic/default interpreter does not +support the queues! Strangely, it still polls the devices and +literally discards anything received. This completely undermines the +ability of the underlying hardware which is doing it's own robust +interrupt or hardware based buffering and flow control. + +I have relinked the interpreter (SYSTEM.INTERP) so that it now uses +the BIOS version that supports the queues (BIOS.CRP). This mostly +resolves the situation, but needlessly increases the size of the +interpreter. Additionally, I believe that if the p-System queue gets +full, it will still poll and discard any new characters received. I +have not seen any documentation indicating the size of the queues. + +Seriously, what were they thinking. + +One last thing in case anyone actually reads this. As indicated +above, this is an adaptation of p-System IV.0. It is well documented +that SofTech produced a IV.1 with some nice enhancements (like +subsidiary volumes and decent support for ANSI/VT-100 terminals). I +have been unable to track down the IV.1 distribution media despite +trying very hard. If anyone knows of a source for the media of the +Adapable p-System for Z80, I would love to get hold of it. + +3:58 PM Tuesday, January 17, 2023 + +I forgot to discuss the terminal handling. + +The p-System has a setup program (SETUP.CODE) that is used to define +terminal handling escape sequences. However, it is limited to a +single character to introduce the escape sequences. Since ANSI +and VT-100 escape sequences start with 2 characters, this is +problematic. The BIOS for RomWBW borrows a hack used by Udo Monk. +Specifically, whenever an outbound is seen, a '[' is added +in flight. + +Likewise, it is problematic to define a way to interpret the +arrow keys transmitted by an ANSI/VT-100 terminal. In this case, +the setup program was used to define up/down/left/right like +WordStar does: ^E,^X,^S,^D. + +5:48 PM Tuesday, January 17, 2023 \ No newline at end of file diff --git a/Source/pSys/bios.asm b/Source/pSys/bios.asm new file mode 100644 index 00000000..9f1a3ae0 --- /dev/null +++ b/Source/pSys/bios.asm @@ -0,0 +1,577 @@ +; +;======================================================================= +; p-System BIOS for RomWBW HBIOS +;======================================================================= +; +; 3:46 PM 1/13/2023 - WBW - Initial release +; 5:29 PM 1/15/2023 - WBW - Implemeted extended BIOS functions +; 10:34 AM 1/16/2023 - WBW - Moved slices into partition +; +; TODO: +; +; NOTES: +; - The partition type ID used is the same as the CP/M partition +; type ID. Might make sense to create a new partition ID which +; could allow p-System to co-exist with CP/M on a disk image. This +; would require changes to the RomWBW boot loader as well. +; +; - MBR is borrowed from RomWBW CP/M layout, so the partition size +; is 64 8MB slices. p-System only uses 6 slices. Might be better +; to create a custom MBR with an appropriate size for p-System +; partition. +; +; - The sysinit routine does a lot of work that just sets up a few +; variables for later use. This work could be moved into the +; p-System loader to reduce the size of this BIOS. Since the BIOS +; is only 768 bytes at this point, I have not bothered with it. +; + +#include "../ver.inc" + +#include "psys.inc" + +#include "psys_ior.inc" + +#include "../HBIOS/hbios.inc" + +;----------------------------------------------------------------------- +; Local constants +;----------------------------------------------------------------------- + +; We need to read and buffer a single sector (MBR) at initialization. +; It looks like the area just above the loader is the safest place. + +dskbuf .equ loader_loc + loader_size + + + +;----------------------------------------------------------------------- +; BIOS Jump Table +;----------------------------------------------------------------------- + + .org bios_loc + + ; Simple BIOS vectors + jp sysinit ; 0: Initialize machine + jp syshalt ; 1: Exit UCSD Pascal + jp coninit ; 2: Console initialize + jp constat ; 3: Console status + jp conread ; 4: Console input + jp conwrit ; 5: Console output + jp setdisk ; 6: Set disk number + jp settrak ; 7: Set track number + jp setsect ; 8: Set sector number + jp setbufr ; 9: Set buffer address + jp dskread ; 10: Read sector from disk + jp dskwrit ; 11: Write sector to disk + jp dskinit ; 12: Reset disk + jp dskstrt ; 13: Activate disk + jp dskstop ; 14: De-activate disk + + ; Extended BIOS vectors + jp prninit ; 15: Printer initialize + jp prnstat ; 16: Printer status + jp prnread ; 17: Printer read + jp prnwrit ; 18: Printer write + jp reminit ; 19: Remote initialize + jp remstat ; 20: Remote status + jp remread ; 21: Remote read + jp remwrit ; 22: Remote write + jp usrinit ; 23: User devices initialize + jp usrstat ; 24: User devices status + jp usrread ; 25: User devices read + jp usrwrit ; 26: User devices write + jp clkread ; 27: System clock read + +;----------------------------------------------------------------------- +; Simple BIOS routines +;----------------------------------------------------------------------- + + +sysinit: ; 0: Initialize machine + ; Get critical HBIOS bank ids for use later + ld b,BF_SYSGET ; HBIOS SysGet function + ld c,BF_SYSGET_BNKINFO ; BankInfo sub-function + rst 08 ; do it, D=BIOS, E=USER + ld (hb_bnks),de ; save bank info + + ; Get boot disk to use for all subsequent disk I/O + ld b,BF_SYSGET ; HBIOS SysGet function + ld c,BF_SYSGET_BOOTINFO ; BootInfo sub-function + rst 08 ; do it, boot disk device unit in + ld a,d ; boot unit id returned in D + ld (hb_dev),a ; save for disk I/O + + ; Get the count of serial (CIO) HBIOS devices in system + ld b,BF_SYSGET ; HBIOS SysGet function + ld c,BF_SYSGET_CIOCNT ; CIO Count sub-function + rst 08 ; do it, count in E + push de ; save it + + ; Get current HBIOS console unit and assign to pSys console + ld b,BF_SYSPEEK ; HBIOS Peek Function + ld a,(hb_bios) ; HBIOS bank id + ld d,a ; ... goes in D + ld hl,$112 ; offset $112 is current console device + rst 08 ; call HBIOS, value returned in E + ld a,e ; move to A + ld hl,hb_con ; use HL to point to hb_con + ld (hl),a ; save as console device + + ; Assign additional HBIOS serial devices as pSys remote and printer + pop bc ; recover CIO count, now in C + ld a,0 ; assume remote on HB unit 0 + cp (hl) ; conflict? + jr nz,sysinit1 ; if no conflict, continue + inc a ; else increment to next unit +sysinit1: + cp c ; check for over max serial count + jr nc,sysinit3 ; if exceeded, we are done + ld (hb_rem),a ; assign remote device + inc a ; bump to next dev for printer + cp (hl) ; conflict? + jr nz,sysinit2 ; if no conflict, continue + inc a ; else increment to next unit +sysinit2: + cp c ; check for over max serial count + jr nc,sysinit3 ; if exceeded, we are done + ld (hb_prn),a ; assign printer device +sysinit3: + + ; Announce BIOS + ld hl,str_banner ; load version banner + call prtstr ; and display it + ;call conread ; wait for user + + ; The p-System slices live within a disk partition. So, now we + ; read the MBR, look for our partition ID, extract the + ; corresponding LBA offset and save it for subsequent disk I/O. + + ; Read MBR. The MBR lives in the first sector of the hard + ; disk. At this point paroff, curdisk, curtrak, and cursect + ; are all zero. So, we just set the disk buffer and make a + ; disk I/O call which results in reading the first (MBR) + ; sector. + ld bc,dskbuf ; load disk buf adr + ld (curbufr),bc ; save it + call dskread ; read first sector of phy disk + jp nz,parterr ; abort on error + + ; Check signature + ld hl,(dskbuf+$1FE) ; get signature + ld a,l ; first byte + cp $55 ; should be $55 + jp nz,parterr ; if not, no part table + ld a,h ; second byte + cp $AA ; should be $AA + jp nz,parterr ; if not, no part table + + ; Search part table for entry (type 0x2E) + ld b,4 ; four entries in part table + ld hl,dskbuf+$1BE+4 ; offset of first part type +sysinit4: + ld a,(hl) ; get part type + cp $2E ; CP/M partition? + jr z,sysinit5 ; cool, grab the LBA offset + ld de,16 ; part table entry size + add hl,de ; bump to next part type + djnz sysinit4 ; loop thru table + jp parterr ; too bad, no CP/M partition +sysinit5: + ; Capture the starting LBA of the partition we found + ld de,4 ; LBA is 4 bytes after part type + add hl,de ; point to it + ld de,paroff ; loc to store lba offset + ld bc,4 ; 4 bytes (32 bits) + ldir ; copy it + +sysinit6: + + ; Vector sysinit is being called twice during startup. Once + ; from the bootstrap and then from the interpreter. So, we + ; remap the vector here to avoid doing the above stuff + ; multiple times. + ld hl,sysinitz ; re-vector to sysinitz + ld (bios_loc+1),hl ; update the jump table + +sysinitz: + ret ; done + xor a ; signal success + +syshalt: ; 1: Exit UCSD Pascal + ; The syshalt vector does not seem be to invoked when + ; selecting the Halt option from the p-System menu. + ; I have no idea why. + ld b,BF_SYSRESET ; HBIOS reset function + ld c,BF_SYSRES_WARM ; warm reset is fine + rst 08 ; do it + + ; We should never get here. + di ; interrupts off + halt ; ... and die + + +coninit: ; 2: Console initialize + ld a,(hb_con) ; initialize console unit + jp serinit ; do it + +constat: ; 3: Console status + ld a,(hb_con) ; status of console unit + jp serstat ; do it + +conread: ; 4: Console input + ld a,(hb_con) ; read from console unit + jp serread ; do it + +conwrit: ; 5: Console output + ld a,c + cp 27 ; escape? + ld a,(hb_con) ; write to console unit + jp nz,serwrit ; if not, handle normally + call serwrit ; else, send escape + ld c,'[' ; ... followed by '[' for ANSI + ld a,(hb_con) ; write to console unit + jp serwrit ; do it + +setdisk: ; 6: Set disk number + ld a,c ; disk number to A + ld (curdisk),a ; save for later + + ; Each p-System disk lives in a slice. Additionally, + ; the start of the slices is determined by the hard + ; disk partition table. To avoid computing the p-System + ; disk offset on every I/O call, below we pre-compute + ; the physical HBIOS disk LBA offset for the slice of the + ; p-System disk being selected here. + ld hl,(paroff) ; initialize DE:HL + ld de,(paroff+2) ; ... to start of partition + or a ; use A as loop ctr, check for zero + jr z,setdisk2 ; if 0, no slice offset needed +setdisk1: + ld bc,(sps) ; get low word of sps + add hl,bc ; add low words + ex de,hl ; swap high word into HL + ld bc,(sps+2) ; get high word of sps + adc hl,bc ; add high words (w/ carry) + ex de,hl ; swap back to get DE:HL + dec a ; dec loop ctr + jr nz,setdisk1 ; rinse and repeat +setdisk2: + ld (curoff),hl ; save low word + ld (curoff+2),de ; save high word + + xor a ; signal success + ret ; done + +settrak: ; 7: Set track number + ld a,c ; track number to A + ld (curtrak),a ; save for later + xor a ; signal success + ret ; done + +setsect: ; 8: Set sector number + ld a,c ; sector number to A + dec a ; from 1 indexed to 0 indexed + ld (cursect),a ; save for later + xor a ; signal success + ret + +setbufr: ; 9: Set buffer address + ld (curbufr),bc ; save buf adr for later + xor a ; signal success + ret ; done + +dskread: ; 10: Read sector from disk + call chkdisk + ret nz + + call seek + ret nz + + ld b,BF_DIOREAD ; HBIOS disk read function + ld a,(hb_dev) ; HBIOS disk unit + ld c,a ; ... goes in C + ld a,(HB_CURBNK) ; get current memory bank + ld d,a ; use as target bank for transfer + ld e,1 ; read 1 sector + ld hl,(curbufr) ; disk read buffer adr + rst 08 ; do it + ret z ; return if good read + ld a,ior_badblk ; else i/o error + ret ; done + +dskwrit: ; 11: Write sector to disk + call chkdisk + ret nz + + call seek + ret nz + + ld b,BF_DIOWRITE ; HBIOS disk read function + ld a,(hb_dev) ; HBIOS disk unit + ld c,a ; ... goes in C + ld a,(HB_CURBNK) ; get current memory bank + ld d,a ; use as target bank for transfer + ld e,1 ; read 1 sector + ld hl,(curbufr) ; disk read buffer adr + rst 08 ; do it + ret z ; return if good read + ld a,ior_badblk ; else i/o error + ret ; done + +dskinit: ; 12: Reset disk + call chkdisk + ret nz + + xor a ; signal success + ret ; done + +dskstrt: ; 13: Activate disk + xor a ; signal success + ret ; done + +dskstop: ; 14: De-activate disk + xor a ; signal success + ret ; done + +;----------------------------------------------------------------------- +; Extended BIOS routines +;----------------------------------------------------------------------- + +prninit: ; 15: Printer initialize + ld a,(hb_prn) ; initialize printer unit + jp serinit ; do it + +prnstat: ; 16: Printer status + ld a,(hb_prn) ; status of printer unit + jp serstat ; do it + +prnread: ; 17: Printer read + ld a,(hb_prn) ; read from printer unit + jp serread ; do it + +prnwrit: ; 18: Printer write + ld a,(hb_prn) ; write to printer unit + jp serwrit ; do it + +reminit: ; 19: Remote initialize + ld a,(hb_rem) ; initialize remote unit + jp serinit ; do it + +remstat: ; 20: Remote status + ld a,(hb_rem) ; status of remote unit + jp serstat ; do it + +remread: ; 21: Remote read + ld a,(hb_rem) ; read from remote unit + jp serread ; do it + +remwrit: ; 22: Remote write + ld a,(hb_rem) ; write to remote unit + jp serwrit ; do it + +usrinit: ; 23: User devices initialize + ld a,9 ; offline status + ret + +usrstat: ; 24: User devices status + pop hl ; return address + pop de ; discard input/output toggle + pop de ; discard ptr to status rec + pop de ; discard device number + ld a,9 ; offline status + jp (hl) ; return + +usrread: ; 25: User devices read +usrwrit: ; 26: User devices write + pop hl ; return address + pop de ; extra parameter 2 + pop de ; extra parameter 1 + pop de ; pointer to buffer + pop de ; device number + pop de ; extra parameter 5 + ld a,9 ; offline status + jp (hl) ; return + +clkread: ; 27: System clock read + ld b,BF_SYSGET ; HBIOS SysGet function + ld c,BF_SYSGET_TIMER ; Timer sub-function + rst 08 ; do it, ticks ret in DE:HL + ex de,hl ; swap for pSys + xor a ; signal success + ret ; done + + + +;----------------------------------------------------------------------- +; Support routines +;----------------------------------------------------------------------- + +serinit: + ; Initialize HBIOS serial port identified in reg A + cp $FF ; do we have desired port? + jr z,nodev ; handle it if so + xor a ; signal success + ret ; done + +serstat: + ; Check status of HBIOS serial port identified in reg A + cp $FF ; do we have desired port? + jr z,nodev ; handle it if so + ld b,BF_CIOIST ; serial port status function + ld c,a ; HBIOS serial port + rst 08 ; call HBIOS + ld c,0 ; assume no chars pendin + jr z,serstat1 ; if zero, no chars waiting + ld c,$FF ; signal char(s) pending +serstat1: + xor a ; signal success + ret ; done + +serread: + ; Read one byte from HBIOS serial port identified in reg A + cp $FF ; do we have desired port? + jr z,nodev ; handle it if so + ld b,BF_CIOIN ; serial port read function + ld c,a ; HBIOS serial port + rst 08 ; call HBIOS + ld c,e ; char to C + xor a ; signal success + ret ; done + +serwrit: + ; Write one byte to HBIOS serial port identified in reg A + cp $FF ; do we have desired port? + jr z,nodev ; handle it if so + ld e,c ; char to write to E + ld b,BF_CIOOUT ; serial port write function + ld c,a ; HBIOS serial port + rst 08 ; call HBIOS + xor a ; signal success + ret ; done + +nodev: + ld a,9 ; signal volume offline + ret ; and done + +chkdisk: + ; Validate that curdisk is <= max supported + ld a,(curdisk) ; get current disk + cp disks ; compare to disk count + jr nc,chkdisk1 ; if too high, go to err + xor a ; signal success + ret ; done +chkdisk1: + ld a,ior_novol ; signal not online + or a ; set flags + ret ; done + +seek: + ; We use LBA addressing for disk access. So, we need to + ; translate the track/sector value from p-System into an + ; lba offset. Since we are using 16 sectors per track, we + ; can cheat (avoid multiplication) by using the low 4 bits + ; for sector and the high bits for track which allows us to + ; just "or" the values together. We are only using word values + ; here since that will handle up to a 32MB p-System file system + ; (slice) which is more than enough. + + ld a,(curtrak) ; cur track in accum + ld l,a ; move to low byte of HL + ld h,0 ; zero out high byte of HL + add hl,hl ; * 2 + add hl,hl ; * 4 + add hl,hl ; * 8 + add hl,hl ; * 16 (sectors per track) + ld a,(cursect) ; cur sec to accum + or l ; combine with low byte of HL + ld l,a ; back to low byte of HL + + ; HL now has LBA offset of desired sector. Next + ; we need to add in the offset of the current disk. + ; At this point, we need to start using dword values + ; using DE:HL to accommodate large disk drives. + ld de,0 ; extend LBA to DE:HL + ld bc,(curoff) ; get low word of offset + add hl,bc ; add low words together + ex de,hl ; swap high word of LBA into HL + ld bc,(curoff+2) ; get high word of offset + adc hl,bc ; add high words together (w/ carry) + ex de,hl ; swap back to get DE:HL + + ; Now we have final LBA in DE:HL. We just set the + ; LBA flag bit and do the disk seek. + set 7,d ; high order bit designates LBA I/O + ld b,BF_DIOSEEK ; HBIOS seek function + ld a,(hb_dev) ; HBIOS disk unit + ld c,a ; ... goes in C + rst 08 ; do it + ret z ; if no error, done + ld a,ior_badblk ; signal I/O error + ret ; done + +prtstr: + ; Print a null terminated string on the p-System console + ld a,(hl) ; get next char + or a ; set flags + ret z ; done if null + push hl ; save buffer pointer + ld c,a ; char to C + call conwrit ; write it out to pSys console + pop hl ; recover buffer pointer + inc hl ; increment to next char + jr prtstr ; loop as needed + +parterr: + ld hl,str_parterr ; partition error string + call prtstr ; display it + jp syshalt ; back to boot loader + +panic: + ; Hard stop + di ; no interrupts + halt ; ... and halt + + + +;----------------------------------------------------------------------- +; Local storage +;----------------------------------------------------------------------- + +hb_bnks: +hb_usr .db 0 ; HBIOS User bank id +hb_bios .db 0 ; HBIOS BIOS bank id + +hb_dev .db 0 ; HBIOS device for pSys disk +hb_con .db $FF ; HBIOS device for pSys console unit +hb_rem .db $FF ; HBIOS device for pSys remote unit +hb_prn .db $FF ; HBIOS device for pSys printer unit + +curdisk .db 0 ; Current pSys disk number +curtrak .db 0 ; Current pSys track number +cursect .db 0 ; Current pSys sector number +curbufr .dw 0 ; Current pSys disk buffer address +curoff .dw 0,0 ; Current sector offset (dword LBA) + +paroff .dw 0,0 ; Partition offset (dword LBA) +sps .dw 16384,0 ; Sectors per slice (8MB / 512) = 16384 + +str_banner .db 13,10,13,10,"RomWBW p-System Extended BIOS v" + .db BIOSVER,0 +str_parterr .db 13,10,"*** Disk partition table error!",0 + + + +#if ($ >= bios_end) + .echo "*** ERROR: Out of space in pSystem BIOS!!!\n" + !!! ; force an assembly error +#endif + +slack .equ bios_end - $ + .echo "pSystem BIOS space remaining: " + .echo slack + .echo " bytes.\n" + + .fill bios_end - $ + + .end diff --git a/Source/pSys/biostest.dat b/Source/pSys/biostest.dat new file mode 100644 index 00000000..4eb18f4b Binary files /dev/null and b/Source/pSys/biostest.dat differ diff --git a/Source/pSys/biostest.old b/Source/pSys/biostest.old new file mode 100644 index 00000000..17007bea Binary files /dev/null and b/Source/pSys/biostest.old differ diff --git a/Source/pSys/blank.vol b/Source/pSys/blank.vol new file mode 100644 index 00000000..67df0994 Binary files /dev/null and b/Source/pSys/blank.vol differ diff --git a/Source/pSys/boot.dat b/Source/pSys/boot.dat new file mode 100644 index 00000000..a23b59a5 Binary files /dev/null and b/Source/pSys/boot.dat differ diff --git a/Source/pSys/fill.asm b/Source/pSys/fill.asm new file mode 100644 index 00000000..7aa7184b --- /dev/null +++ b/Source/pSys/fill.asm @@ -0,0 +1,4 @@ +#include "psys.inc" + + .fill (8 * 1024) - loader_size - bios_size - boot_size - (512 * 3) + .end diff --git a/Source/pSys/loader.asm b/Source/pSys/loader.asm new file mode 100644 index 00000000..ad3f188d --- /dev/null +++ b/Source/pSys/loader.asm @@ -0,0 +1,419 @@ +;=============================================================================== +; LOADER.ASM +; +; BOOTLOADER FOR ROMWBW PSYSTEM +; +; CP/M DISK FORMATS ALLOW FOR RESERVED TRACKS THAT CONTAIN AN IMAGE OF THE +; OPERATING SYSTEM TO BE LOADED WHEN THE DISK IS BOOTED. THE OPERATING SYSTEM +; IMAGE ITSELF IS NORMALLY PREFIXED BY A 1-N SECTORS CONTAINING OS BOOTSTRAP +; CODE AND DISK METADATA. +; +; THE RETROBREW COMPUTING GROUP HAS BEEN USING A CONVENTION OF PREFIXING THE +; OS IMAGE WITH 3 SECTORS (512 BYTES X 3 FOR A TOTAL OF 1536 BYTES): +; +; SECTOR 1: IBM-PC STYLE BOOT BLOCK CONTAINING BOOTSTRAP, +; PARTITION TABLE, AND BOOT SIGNATURE +; SECTOR 2: RESERVED +; SECTOR 3: METADATA +; +; THE HARDWARE BIOS IS EXPECTED TO READ AND LOAD THE FIRST TWO SECTORS FROM THE +; DISK TO MEMORY ADDRESS $8000 AND JUMP TO THAT LOCATION TO BEGIN THE BOOT +; PROCESS. THE BIOS IS EXPECTED TO VERIFY THAT A STANDARD BOOT SIGNATURE +; OF $55, $AA IS PRESENT AT OFFSET $1FE-$1FF. IF THE SIGNATURE IS NOT FOUND, +; THE BIOS SHOULD ASSUME THE DISK HAS NOT BEEN PROPERLY INITIALIZED AND SHOULD +; NOT JUMP TO THE LOAD ADDRESS. +; +;=============================================================================== +; +#INCLUDE "../ver.inc" +; +#INCLUDE "psys.inc" +; +SYS_ENT .EQU $0100 ; SYSTEM (OS) ENTRY POINT ADDRESS +SYS_LOC .EQU $0100 ; STARTING ADDRESS TO LOAD SYSTEM IMAGE +SYS_END .EQU $0100 + loader_size + bios_size + boot_size ; ENDING ADDRESS OF SYSTEM IMAGE +; +SEC_SIZE .EQU 512 ; DISK SECTOR SIZE +BLK_SIZE .EQU 128 ; OS BLOCK/RECORD SIZE +; +PREFIX_SIZE .EQU (SEC_SIZE * 3) ; 3 SECTORS +; +META_SIZE .EQU 32 ; SEE BELOW +META_LOC .EQU (PREFIX_SIZE - META_SIZE) +; +PT_LOC .EQU $1BE +PT_SIZ .EQU $40 +; + .ORG 0 +; +;------------------------------------------------------------------------------- +; SECTOR 1 +; +; THIS SECTOR FOLLOWS THE CONVENTIONS OF AN IBM-PC MBR CONTAINING THE OS +; BOOTSTRAP CODE, PARTITION TABLE, AND BOOT SIGNATURE +; +;---------------------------------------------------------------------------- +; + .FILL PT_LOC - $,0 ; FILL TO START OF PARTITION TABLE +; +; STANDARD IBM-PC PARTITION TABLE. ALTHOUGH A +; PARTITION TABLE IS NOT RELEVANT FOR A FLOPPY DISK, IT DOES NO HARM. +; THE CONTENTS OF THE PARTITION TABLE CAN BE MANAGED BY FDISK80. +; +; BELOW WE ALLOW FOR 32 SLICES OF ROMWBW CP/M FILESYSTEMS +; FOLLOWED BY A FAT16 PARTITION. THE SLICES FOLLOW THE ORIGINAL +; HD512 ROMWBW FORMAT. IF THE DISK IS USING HD1K, A SEPARATE +; PARTITION TABLE WILL BE IN PLACE AND RENDER THIS PARTITION TABLE +; IRRELEVANT. +; +; THE CYL/SEC FIELDS ENCODE CYLINDER AND SECTOR AS: +; CCCCCCCC:CCSSSSSS +; 76543210:98543210 +; +PART0: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) +PART1: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW %1111111111000001 ; CHS START ADDRESS (CYL/SEC) + .DB 6 ; PART TYPE ID + .DB 15 ; CHS LAST ADDRESS (HEAD) + .DW %1111111111010000 ; CHS LAST ADDRESS (CYL/SEC) + .DW $4000,$0010 ; LBA FIRST (DWORD) + .DW $0000,$000C ; LBA COUNT (DWORD) +PART2: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) +PART3: + .DB 0 ; ACTIVE IF $80 + .DB 0 ; CHS START ADDRESS (HEAD) + .DW 0 ; CHS START ADDRESS (CYL/SEC) + .DB 0 ; PART TYPE ID + .DB 0 ; CHS LAST ADDRESS (HEAD) + .DW 0 ; CHS LAST ADDRESS (CYL/SEC) + .DW 0,0 ; LBA FIRST (DWORD) + .DW 0,0 ; LBA COUNT (DWORD) +; +; THE END OF THE FIRST SECTOR MUST CONTAIN THE TWO BYTE BOOT SIGNATURE. +; +BOOTSIG .DB $55,$AA ; STANDARD BOOT SIGNATURE +; +;------------------------------------------------------------------------------- +; SECTOR 2 +; +; THIS SECTOR HAS NOT BEEN DEFINED AND IS RESERVED. +; +;---------------------------------------------------------------------------- +; + .FILL SEC_SIZE,0 ; JUST FILL SECTOR WITH ZEROES +; +;------------------------------------------------------------------------------- +; SECTOR 3 +; +; OS AND DISK METADATA +; +;---------------------------------------------------------------------------- +; + .FILL (BLK_SIZE * 3),0 ; FIRST 384 BYTES ARE NOT YET DEFINED +; +; THE FOLLOWING TWO BYTES ARE AN ADDITIONAL SIGNATURE THAT IS VERIFIED BY +; SOME HARDWARE BIOSES. +; +PR_SIG .DB $5A,$A5 ; SIGNATURE GOES HERE +; + .FILL (META_LOC - $),0 +; +; METADATA +; +PR_WP .DB 0 ; (1) WRITE PROTECT BOOLEAN +PR_UPDSEQ .DW 0 ; (2) PREFIX UPDATE SEQUENCE NUMBER (DEPRECATED?) +PR_VER .DB RMJ,RMN,RUP,RTP ; (4) OS BUILD VERSION +PR_LABEL .DB "Unlabeled$$$$$$$","$" ; (17) DISK LABEL (EXACTLY 16 BYTES!!!) + .DW 0 ; (2) DEPRECATED +PR_LDLOC .DW SYS_LOC ; (2) ADDRESS TO START LOADING SYSTEM +PR_LDEND .DW SYS_END ; (2) ADDRESS TO STOP LOADING SYSTEM +PR_ENTRY .DW SYS_ENT ; (2) ADDRESS TO ENTER SYSTEM (OS) +; +#IF (META_SIZE != ($ - META_LOC)) + .ECHO "META_SIZE VALUE IS WRONG!!!\r\n" + !!! +#ENDIF +; +#IF ($ != PREFIX_SIZE) + .ECHO "LOADER PREFIX IS WRONG SIZE!!!\r\n" + !!! +#ENDIF +; +;------------------------------------------------------------------------------- +; SECTOR 4+ +; +; PSYSTEM LOADER +; - LOAD SBIOS TO HIGH MEMORY (JUST BELOW HBIOS PROXY) +; - LOAD PSYSTEM BOOTSTRAP & JUMP TO IT +; +;---------------------------------------------------------------------------- +; +#include "../HBIOS/hbios.inc" +; +; +bel .equ 7 ; ASCII bell +bs .equ 8 ; ASCII backspace +lf .equ 10 ; ASCII linefeed +cr .equ 13 ; ASCII carriage return +; +interp_base .equ $0100 ; first loc used by the interpreter +low_memory .equ $0100 ; lowest available ram location +interleave .equ 1 ; interleaving factor (n:1) +first_track .equ 1 ; first interleaved track +skew .equ 0 ; track-to-track skew +; +; +; + .org loader_loc +; + ld sp,stack ; setup private stack +; + call nl2 ; formatting + ld hl,str_banner ; display boot banner + call pstr ; do it +; +; Copy BIOS to running location +; + ld hl,loader_end ; BIOS image is at end of loader + ld de,bios_loc ; BIOS execution location + ld bc,bios_size ; Size of BIOS + ldir ; do it +; +; Copy p-System bootstrap to running location +; + ld hl,loader_end + bios_size ; bootstrap appended after BIOS + ld de,boot_loc ; bootstrap runs here + ld bc,boot_size ; size of bootstrap code + ldir ; do it +; +; Print some interesting info +; + call nl2 ; spacing + ld hl,str_info ; info string + call pstr ; print it + ld bc,bios_loc ; bios location adr + call prthexword ; print it + ld hl,str_info2 ; additional info string + call pstr ; print it + ld bc,boot_loc ; bootstrap location adr + call prthexword ; print it +; +; Push key values onto the stack +; + ld hl,seclen ; maximum number of bytes per sector + push hl + ld hl,sectors ; maximum number of sectors in table + push hl + ld hl,skew ; track-to-track skew + push hl + ld hl,first_track ; first interleaved track + push hl + ld hl,interleave ; interleaving factor + push hl + ld hl,seclen ; bytes per sector + push hl + ld hl,sectors ; sectors per track + push hl + ld hl,tracks ; tracks per disk + push hl + ld hl,bios_loc-2 ; top word of available ram - sbios address-2 + push hl + ld hl,low_memory ; bottom word of available ram + push hl + ld hl,bios_loc ; address of BIOS (start of jump table) + push hl + ld hl,interp_base ; starting address of the interpreter + push hl +#ifdef TESTBIOS + ld hl,disks-1 ; maximum (highest) disk drive number + push hl +#endif +; + jp boot_loc ; jump to bootloader +; + ret +; +; +; Print string at HL on console, null terminated +; +pstr: + ld a,(hl) ; get next character + or a ; set flags + inc hl ; bump pointer regardless + ret z ; done if null + call cout ; display character + jr pstr ; loop till done +; +; Print volume label string at HL, '$' terminated, 16 chars max +; +pvol: + ld b,16 ; init max char downcounter +pvol1: + ld a,(hl) ; get next character + cp '$' ; set flags + inc hl ; bump pointer regardless + ret z ; done if null + call cout ; display character + djnz pvol1 ; loop till done + ret ; hit max of 16 chars +; +; Start a newline on console (cr/lf) +; +nl2: + call nl ; double newline +nl: + ld a,cr ; cr + call cout ; send it + ld a,lf ; lf + jp cout ; send it and return +; +; Print a dot on console +; +pdot: + push af + ld a,'.' + call cout + pop af + ret +; +; Print the hex byte value in A +; +prthexbyte: + push af + push de + call hexascii + ld a,d + call cout + ld a,e + call cout + pop de + pop af + ret +; +; Print the hex word value in BC +; +prthexword: + push af + ld a,b + call prthexbyte + ld a,c + call prthexbyte + pop af + ret +; +; Convert binary value in A to ASCII hex characters in DE +; +hexascii: + ld d,a + call hexconv + ld e,a + ld a,d + rlca + rlca + rlca + rlca + call hexconv + ld d,a + ret +; +; Convert low nibble of A to ASCII hex +; +hexconv: + and 0Fh ; low nibble only + add a,90h + daa + adc a,40h + daa + ret +; +; Output character from A +; +cout: + ; Save all incoming registers + push af + push bc + push de + push hl +; + ; Output character to console via HBIOS + ld e,a ; output char to E + ld c,CIO_CONSOLE ; console unit to C + ld b,BF_CIOOUT ; HBIOS func: output char + rst 08 ; HBIOS outputs character +; + ; Restore all registers + pop hl + pop de + pop bc + pop af + ret +; +; Input character to A +; +cin: + ; Save incoming registers (AF is output) + push bc + push de + push hl +; + ; Input character from console via hbios + ld c,CIO_CONSOLE ; console unit to c + ld b,BF_CIOIN ; HBIOS func: input char + rst 08 ; HBIOS reads character + ld a,e ; move character to A for return +; + ; Restore registers (AF is output) + pop hl + pop de + pop bc + ret +; +; Return input status in A (0 = no char, != 0 char waiting) +; +cst: + ; Save incoming registers (AF is output) + push bc + push de + push hl +; + ; Get console input status via HBIOS + ld c,CIO_CONSOLE ; console unit to C + ld b,BF_CIOIST ; HBIOS func: input status + rst 08 ; HBIOS returns status in A +; + ; Restore registers (AF is output) + pop hl + pop de + pop bc + ret +; +str_banner .db "RomWBW HBIOS p-System Loader v" + .db BIOSVER + .db 0 +str_info .db "Loading pSystem BIOS @ 0x",0 +str_info2 .db ", Bootstrap @ 0x",0 +; + .fill 32,0 +stack .equ $ +; + .fill loader_end - $ +; + .end diff --git a/Source/pSys/psys.inc b/Source/pSys/psys.inc new file mode 100644 index 00000000..63612b29 --- /dev/null +++ b/Source/pSys/psys.inc @@ -0,0 +1,31 @@ +; +; p-System Loader +; +loader_size .equ $200 +loader_loc .equ $100 +loader_end .equ loader_loc + loader_size +; +; p-System BIOS +; +bios_size .equ $300 +bios_loc .equ $FE00 - bios_size +bios_end .equ bios_loc + bios_size +; +; p-System Bootstrap +; +#ifdef TESTBIOS +boot_size .equ $400 +boot_loc .equ $8000 +boot_end .equ boot_loc + boot_size +#else +boot_size .equ $800 +boot_loc .equ $8200 +boot_end .equ boot_loc + boot_size +#endif +; +; Disk geometry +; +seclen .equ 512 ; bytes per sector +sectors .equ 16 ; sectors per track +tracks .equ 192 ; tracks per disk +disks .equ 6 ; number of pSystem disk devices diff --git a/Source/pSys/psys.vol b/Source/pSys/psys.vol new file mode 100644 index 00000000..358175d3 Binary files /dev/null and b/Source/pSys/psys.vol differ diff --git a/Source/pSys/psys_ior.inc b/Source/pSys/psys_ior.inc new file mode 100644 index 00000000..d7a3dee9 --- /dev/null +++ b/Source/pSys/psys_ior.inc @@ -0,0 +1,25 @@ +; +;----------------------------------------------------------------------- +; p-System IORESULT values +;----------------------------------------------------------------------- +; +ior_ok .equ 0 ; No error +ior_badblk .equ 1 ; Bad block, CRC error (parity) +ior_baddev .equ 2 ; Bad device number +ior_badio .equ 3 ; Illegal I/O request +ior_timout .equ 4 ; Data-com timeout +ior_offlin .equ 5 ; Volume is no longer on-line +ior_nofile .equ 6 ; File is no longer in directory +ior_filnamerr .equ 7 ; Illegal file name +ior_full .equ 8 ; No room; insufficient space on disk +ior_novol .equ 9 ; No such volume on-line +ior_notfnd .equ 10 ; No such file name in directory +ior_dupfil .equ 11 ; Duplicate file +ior_notclos .equ 12 ; Not closed: attempt to open an open file +ior_notopen .equ 13 ; Not open: attempt to access a closed file +ior_badfmt .equ 14 ; Bad format: error reading real or integer +ior_bufovr .equ 15 ; Ring buffer overflow +ior_diskwp .equ 16 ; Write attempt to protected disk +ior_blknumerr .equ 17 ; Illegal block number +ior_bufadrerr .equ 18 ; Illegal buffer address +ior_badsiz .equ 19 ; Bad text file size diff --git a/Source/ver.inc b/Source/ver.inc index 4dc55e56..d09a3632 100644 --- a/Source/ver.inc +++ b/Source/ver.inc @@ -1,5 +1,9 @@ #DEFINE RMJ 3 -#DEFINE RMN 0 -#DEFINE RUP 1 +#DEFINE RMN 2 +#DEFINE RUP 0 #DEFINE RTP 0 -#DEFINE BIOSVER "3.0.1" +#DEFINE BIOSVER "3.2.0" +#define rmj RMJ +#define rmn RMN +#define rup RUP +#define rtp RTP diff --git a/Source/ver.lib b/Source/ver.lib index 9c5594c5..512020b6 100644 --- a/Source/ver.lib +++ b/Source/ver.lib @@ -1,7 +1,7 @@ rmj equ 3 -rmn equ 0 -rup equ 1 +rmn equ 2 +rup equ 0 rtp equ 0 biosver macro - db "3.0.1" + db "3.2.0" endm diff --git a/Tools/Makefile b/Tools/Makefile new file mode 100644 index 00000000..b6093e4c --- /dev/null +++ b/Tools/Makefile @@ -0,0 +1,11 @@ +# +# build the tools for linux and Darwin +# +UNAME := $(shell uname) + +all: + $(MAKE) --directory unix + +clean: + $(MAKE) --directory unix clean + @rm -rf $(UNAME) diff --git a/Tools/Makefile.inc b/Tools/Makefile.inc index 4d0c5583..35258860 100644 --- a/Tools/Makefile.inc +++ b/Tools/Makefile.inc @@ -24,7 +24,7 @@ RELPATH := $(subst $(TREEROOT),,$(HERE)) # # where's a copy of this tree for windows so we can diff binaries # -WINROOT = $(TREEROOT)/../RomWBW.windows +WINROOT = $(TREEROOT)/../RomWBW.windows DIFFTO := $(shell if [ -d $(WINROOT) ] ; then cd $(WINROOT); pwd; fi) DIFFPATH := $(DIFFTO)/$(RELPATH) @@ -34,42 +34,62 @@ DIFFPATH := $(DIFFTO)/$(RELPATH) # CASEFN = $(TOOLS)/unix/casefn.sh -ZXCC=$(BINDIR)/zx -TASM=$(BINDIR)/uz80as -t hd64180 +# +# compiler/assembler locations and flags +# +ZXCC=$(BINDIR)/zxcc +export CPMDIR80=$(TOOLS)/cpm/ +TASM=$(BINDIR)/uz80as -t z80 +TASMFLAGS= OPENSPIN=$(BINDIR)/openspin BSTC=$(BINDIR)//bstc CPMCP=$(BINDIR)/cpmcp +CPMCHATTR=$(BINDIR)/cpmchattr # # directory containing cpm binaries # -CPM=$(TOOLS)/cpm/bin +CPM=$(TOOLS)/cpm/bin80/ + +# +# .ONESHELL uses a single shell instance for all shell scripts. +# .SHELLFLAGS is used to cause all shell scripts to echo ("e") and to +# exit if any command returns a non-zero result ("x"). +# +.ONESHELL: +.SHELLFLAGS = -cex %.com: %.asm - if [ "$(USETASM)" = 1 ] ; then \ - $(TASM) $< $@ ; \ + @if [ "$(USETASM)" = 1 ] ; then \ + $(TASM) $(TASMFLAGS) $< $@ $*.lst ; \ else \ $(ZXCC) $(CPM)/MAC -$< -$$PO ; \ $(ZXCC) $(CPM)/MLOAD25 -tmp.bin=$*.hex ; \ mv tmp.bin $@ ; \ + rm -f /tmp/casefn.cache ; \ rm -f $$($(CASEFN) $*.hex) ; \ fi +%.rom: %.asm + $(TASM) $(TASMFLAGS) $< $@ $*.lst + %.hex: %.asm - $(ZXCC) $(CPM)/MAC -$< -$$PO ; \ - + $(ZXCC) $(CPM)/MAC -$< -$$PO + %.bin: %.ASM $(ZXCC) $(CPM)/MAC -$< -$$PO $(ZXCC) $(CPM)/MLOAD25 -tmp.bin=$*.hex mv tmp.bin $@ + rm -f /tmp/casefn.cache rm -f $$($(CASEFN) $*.hex) %.com: %.z80 - $(ZXCC) $(CPM)/Z80ASM -$(basename $<)/F ; \ + $(ZXCC) $(CPM)/Z80ASM -$(basename $<)/F + rm -f /tmp/casefn.cache mv $$($(CASEFN) $@) tmp.com ; mv tmp.com $@ - + %.bin: %.asm - $(TASM) $< $@ + $(TASM) $(TASMFLAGS) $< $@ $(basename $<).lst %.rel: %.asm $(ZXCC) $(CPM)/RMAC -$< @@ -77,11 +97,14 @@ CPM=$(TOOLS)/cpm/bin %.rel: %.z80 $(ZXCC) $(CPM)/Z80ASM -$(basename $<)/MF -%.hex: %.180 +#%.hex: %.z80 +# $(ZXCC) $(CPM)/Z80ASM -$(basename $<)/HF + +%.hex: %.z80 $(ZXCC) $(CPM)/SLR180 -$(basename $<)/HF -%.rel: %.azm - $(ZXCC) $(CPM)/ZSM =$< +%.rel: %.azm + $(ZXCC) $(CPM)/ZSM =$< -/L %.bin: %.rel $(ZXCC) $(CPM)/LINK -$@=$< @@ -89,6 +112,9 @@ CPM=$(TOOLS)/cpm/bin %.rel: %.mac $(ZXCC) $(CPM)/M80 -=$(basename $<) +%.com: %.rel + $(ZXCC) $(CPM)/L80 -$(basename $<),$(basename $<).com/n/e + ifeq ($(UNAME), Linux) %.eeprom: %.spin $(BSTC) -e -l $< @@ -108,44 +134,39 @@ endif # all:: $(OBJECTS) @for dir in $(SUBDIRS) ; do \ - ( echo "building in `pwd`/$$dir" ; cd "$$dir" ; make all ) ; \ + $(MAKE) --directory $$dir ; \ done - @if [ "$(DEST)" ] ; then for file in $(OBJECTS) ; do \ + @if [ "$(DEST)" ] && [ "$(OBJECTS)" ] ; then for file in $(filter-out $(NOCOPY),$(OBJECTS)) ; do \ mkdir -p $(DEST) ; \ - echo copy $$file to $(DEST) ; \ + echo Copying $$file to $(DEST) ; \ + rm -f /tmp/casefn.cache ; \ cp $$($(CASEFN) $$file) $(DEST) ; \ done ; fi - @if [ "$(DOCDEST)" ] ; then for file in $(DOCS) ; do \ + @if [ "$(DOCDEST)" ] && [ "$(DOCS)" ] ; then for file in $(DOCS) ; do \ mkdir -p $(DOCDEST) ; \ - echo copy $$file to $(DOCDEST) ; \ + echo Copying $$file to $(DOCDEST) ; \ + rm -f /tmp/casefn.cache ; \ cp $$($(CASEFN) $$file) $(DOCDEST) ; \ done ; fi clean:: @-rm -f $$($(CASEFN) make.out *.sym *.lst *.prn *.diff *.dump $(OTHERS) $(filter-out $(NODELETE),$(OBJECTS))) @for dir in $(SUBDIRS) ; do \ - ( echo "cleaning in `pwd`/$$dir" ; cd "$$dir" ; make clean ) ; \ + $(MAKE) --directory $$dir clean ; \ done clobber:: clean - @if [ "$(DEST)" ] ; then for file in $(OBJECTS) ; do \ - rm -f $$($(CASEFN) $(DEST)/$$file) ; \ - done ; fi - @-rm -f $$($(CASEFN) $(filter-out $(NODELETE),$(OBJECTS))) - @for dir in $(SUBDIRS) ; do \ - ( echo "clobbering in `pwd`/$$dir" ; cd "$$dir" ; make clobber ) ; \ - done # # this is used to verify that the unix and windows tool chains are generating # the same objects # diff:: -ifneq ($(DIFFTO),) +ifneq ($(DIFFTO),) @for dir in $(SUBDIRS) ; do \ ( echo "diff in $(HERE)/$$dir" ; cd "$$dir" ; make diff ) ; \ done - @for i in $(OBJECTS) $(MOREDIFF) ; do \ + @for i in $(filter-out $(NODIFF),$(OBJECTS) $(MOREDIFF)) ; do \ sf=$$($(CASEFN) $$i) ; \ df=$$($(CASEFN) $(DIFFPATH)/$$i) ; \ if [ -f "$$df" -a -f "$$sf" ] ; then \ @@ -164,8 +185,8 @@ ifneq ($(DIFFTO),) if [ ! -f "$$df" ] ; then echo $(DIFFPATH)/$$i missing ; fi ; \ fi ; \ done -endif - -vdiff: - make VERBOSEDIFF=2 diff +endif + +vdiff: + make VERBOSEDIFF=2 diff diff --git a/Tools/Win32DiskImager/Win32DiskImager.exe b/Tools/Win32DiskImager/Win32DiskImager.exe index 2c838b36..72e53377 100644 Binary files a/Tools/Win32DiskImager/Win32DiskImager.exe and b/Tools/Win32DiskImager/Win32DiskImager.exe differ diff --git a/Tools/cpm/bin/DIRX.COM b/Tools/cpm/bin/DIRX.COM deleted file mode 100644 index 413bceca..00000000 Binary files a/Tools/cpm/bin/DIRX.COM and /dev/null differ diff --git a/Tools/cpm/bin/LBREXT.COM b/Tools/cpm/bin/LBREXT.COM deleted file mode 100644 index c0c950e3..00000000 Binary files a/Tools/cpm/bin/LBREXT.COM and /dev/null differ diff --git a/Tools/cpm/bin/LIB.COM b/Tools/cpm/bin/LIB.COM deleted file mode 100644 index 45d7fb21..00000000 Binary files a/Tools/cpm/bin/LIB.COM and /dev/null differ diff --git a/Tools/cpm/bin/LINK.COM b/Tools/cpm/bin/LINK.COM deleted file mode 100644 index e188fb92..00000000 Binary files a/Tools/cpm/bin/LINK.COM and /dev/null differ diff --git a/Tools/cpm/bin/MAC.COM b/Tools/cpm/bin/MAC.COM deleted file mode 100644 index f49e835a..00000000 Binary files a/Tools/cpm/bin/MAC.COM and /dev/null differ diff --git a/Tools/cpm/bin/RMAC.COM b/Tools/cpm/bin/RMAC.COM deleted file mode 100644 index 9ab7206b..00000000 Binary files a/Tools/cpm/bin/RMAC.COM and /dev/null differ diff --git a/Tools/cpm/bin/SLR180.COM b/Tools/cpm/bin/SLR180.COM deleted file mode 100644 index 0360a7d5..00000000 Binary files a/Tools/cpm/bin/SLR180.COM and /dev/null differ diff --git a/Tools/cpm/bin/TEX21B.COM b/Tools/cpm/bin/TEX21B.COM deleted file mode 100644 index aa72b287..00000000 Binary files a/Tools/cpm/bin/TEX21B.COM and /dev/null differ diff --git a/Tools/cpm/bin/UNZIP.COM b/Tools/cpm/bin/UNZIP.COM deleted file mode 100644 index b231bf47..00000000 Binary files a/Tools/cpm/bin/UNZIP.COM and /dev/null differ diff --git a/Tools/cpm/bin/ZMLIB.COM b/Tools/cpm/bin/ZMLIB.COM deleted file mode 100644 index efaf59dd..00000000 Binary files a/Tools/cpm/bin/ZMLIB.COM and /dev/null differ diff --git a/Tools/cpm/bin/ZSM.COM b/Tools/cpm/bin/ZSM.COM deleted file mode 100644 index 3704c8d9..00000000 Binary files a/Tools/cpm/bin/ZSM.COM and /dev/null differ diff --git a/Tools/cpm/bin/ARCV.COM b/Tools/cpm/bin80/ARCV.COM similarity index 100% rename from Tools/cpm/bin/ARCV.COM rename to Tools/cpm/bin80/ARCV.COM diff --git a/Tools/cpm/bin/AS.COM b/Tools/cpm/bin80/AS.COM similarity index 100% rename from Tools/cpm/bin/AS.COM rename to Tools/cpm/bin80/AS.COM diff --git a/Source/Images/d_zsdos/u0/ASM.COM b/Tools/cpm/bin80/ASM.COM similarity index 100% rename from Source/Images/d_zsdos/u0/ASM.COM rename to Tools/cpm/bin80/ASM.COM diff --git a/Tools/cpm/bin/BASCOM.COM b/Tools/cpm/bin80/BASCOM.COM similarity index 100% rename from Tools/cpm/bin/BASCOM.COM rename to Tools/cpm/bin80/BASCOM.COM diff --git a/Tools/cpm/bin/CC.COM b/Tools/cpm/bin80/CC.COM similarity index 100% rename from Tools/cpm/bin/CC.COM rename to Tools/cpm/bin80/CC.COM diff --git a/Tools/cpm/bin/CNM.COM b/Tools/cpm/bin80/CNM.COM similarity index 100% rename from Tools/cpm/bin/CNM.COM rename to Tools/cpm/bin80/CNM.COM diff --git a/Tools/cpm/bin/CRC.COM b/Tools/cpm/bin80/CRC.COM similarity index 100% rename from Tools/cpm/bin/CRC.COM rename to Tools/cpm/bin80/CRC.COM diff --git a/Tools/cpm/bin/CREF80.COM b/Tools/cpm/bin80/CREF80.COM similarity index 100% rename from Tools/cpm/bin/CREF80.COM rename to Tools/cpm/bin80/CREF80.COM diff --git a/Tools/cpm/bin/CZ.COM b/Tools/cpm/bin80/CZ.COM similarity index 100% rename from Tools/cpm/bin/CZ.COM rename to Tools/cpm/bin80/CZ.COM diff --git a/Source/Images/d_bp/u0/DIRX.COM b/Tools/cpm/bin80/DIRX.COM similarity index 100% rename from Source/Images/d_bp/u0/DIRX.COM rename to Tools/cpm/bin80/DIRX.COM diff --git a/Tools/cpm/bin/DISKINFO.COM b/Tools/cpm/bin80/DISKINFO.COM similarity index 100% rename from Tools/cpm/bin/DISKINFO.COM rename to Tools/cpm/bin80/DISKINFO.COM diff --git a/Tools/cpm/bin/GENCPM.COM b/Tools/cpm/bin80/GENCPM.COM similarity index 100% rename from Tools/cpm/bin/GENCPM.COM rename to Tools/cpm/bin80/GENCPM.COM diff --git a/Tools/cpm/bin/HEX80.COM b/Tools/cpm/bin80/HEX80.COM similarity index 100% rename from Tools/cpm/bin/HEX80.COM rename to Tools/cpm/bin80/HEX80.COM diff --git a/Tools/cpm/bin/HEXCOM.COM b/Tools/cpm/bin80/HEXCOM.COM similarity index 100% rename from Tools/cpm/bin/HEXCOM.COM rename to Tools/cpm/bin80/HEXCOM.COM diff --git a/Tools/cpm/bin/L80.COM b/Tools/cpm/bin80/L80.COM similarity index 100% rename from Tools/cpm/bin/L80.COM rename to Tools/cpm/bin80/L80.COM diff --git a/Source/Images/d_cpm22/u0/LBREXT.COM b/Tools/cpm/bin80/LBREXT.COM similarity index 100% rename from Source/Images/d_cpm22/u0/LBREXT.COM rename to Tools/cpm/bin80/LBREXT.COM diff --git a/Source/Images/d_bp/u0/LIB.COM b/Tools/cpm/bin80/LIB.COM similarity index 100% rename from Source/Images/d_bp/u0/LIB.COM rename to Tools/cpm/bin80/LIB.COM diff --git a/Tools/cpm/bin/LIB80.COM b/Tools/cpm/bin80/LIB80.COM similarity index 100% rename from Tools/cpm/bin/LIB80.COM rename to Tools/cpm/bin80/LIB80.COM diff --git a/Tools/cpm/bin/LIBUTIL.COM b/Tools/cpm/bin80/LIBUTIL.COM similarity index 100% rename from Tools/cpm/bin/LIBUTIL.COM rename to Tools/cpm/bin80/LIBUTIL.COM diff --git a/Source/Images/d_bp/u0/LINK.COM b/Tools/cpm/bin80/LINK.COM similarity index 100% rename from Source/Images/d_bp/u0/LINK.COM rename to Tools/cpm/bin80/LINK.COM diff --git a/Tools/cpm/bin/LN.COM b/Tools/cpm/bin80/LN.COM similarity index 100% rename from Tools/cpm/bin/LN.COM rename to Tools/cpm/bin80/LN.COM diff --git a/Tools/cpm/bin/M80.COM b/Tools/cpm/bin80/M80.COM similarity index 100% rename from Tools/cpm/bin/M80.COM rename to Tools/cpm/bin80/M80.COM diff --git a/Source/Images/d_bp/u0/MAC.COM b/Tools/cpm/bin80/MAC.COM similarity index 100% rename from Source/Images/d_bp/u0/MAC.COM rename to Tools/cpm/bin80/MAC.COM diff --git a/Tools/cpm/bin/MLOAD25.COM b/Tools/cpm/bin80/MLOAD25.COM similarity index 100% rename from Tools/cpm/bin/MLOAD25.COM rename to Tools/cpm/bin80/MLOAD25.COM diff --git a/Tools/cpm/bin/NULU.COM b/Tools/cpm/bin80/NULU.COM similarity index 100% rename from Tools/cpm/bin/NULU.COM rename to Tools/cpm/bin80/NULU.COM diff --git a/Source/Images/d_bp/u0/RMAC.COM b/Tools/cpm/bin80/RMAC.COM similarity index 100% rename from Source/Images/d_bp/u0/RMAC.COM rename to Tools/cpm/bin80/RMAC.COM diff --git a/Tools/cpm/bin/SIDSYM.COM b/Tools/cpm/bin80/SIDSYM.COM similarity index 100% rename from Tools/cpm/bin/SIDSYM.COM rename to Tools/cpm/bin80/SIDSYM.COM diff --git a/Tools/cpm/bin80/SLR180.COM b/Tools/cpm/bin80/SLR180.COM new file mode 100644 index 00000000..91255eed Binary files /dev/null and b/Tools/cpm/bin80/SLR180.COM differ diff --git a/Tools/cpm/bin/SLRMAC.COM b/Tools/cpm/bin80/SLRMAC.COM similarity index 100% rename from Tools/cpm/bin/SLRMAC.COM rename to Tools/cpm/bin80/SLRMAC.COM diff --git a/Tools/cpm/bin/SLRNK.COM b/Tools/cpm/bin80/SLRNK.COM similarity index 100% rename from Tools/cpm/bin/SLRNK.COM rename to Tools/cpm/bin80/SLRNK.COM diff --git a/Tools/cpm/bin/SQZ.COM b/Tools/cpm/bin80/SQZ.COM similarity index 100% rename from Tools/cpm/bin/SQZ.COM rename to Tools/cpm/bin80/SQZ.COM diff --git a/Tools/cpm/bin/TEX21.COM b/Tools/cpm/bin80/TEX21.COM similarity index 100% rename from Tools/cpm/bin/TEX21.COM rename to Tools/cpm/bin80/TEX21.COM diff --git a/Tools/cpm/bin/TEX21A.COM b/Tools/cpm/bin80/TEX21A.COM similarity index 100% rename from Tools/cpm/bin/TEX21A.COM rename to Tools/cpm/bin80/TEX21A.COM diff --git a/Tools/cpm/bin80/TEX21B.COM b/Tools/cpm/bin80/TEX21B.COM new file mode 100644 index 00000000..68326c1f Binary files /dev/null and b/Tools/cpm/bin80/TEX21B.COM differ diff --git a/Tools/cpm/bin/UCRLZH.COM b/Tools/cpm/bin80/UCRLZH.COM similarity index 100% rename from Tools/cpm/bin/UCRLZH.COM rename to Tools/cpm/bin80/UCRLZH.COM diff --git a/Tools/cpm/bin/UNARC.COM b/Tools/cpm/bin80/UNARC.COM similarity index 100% rename from Tools/cpm/bin/UNARC.COM rename to Tools/cpm/bin80/UNARC.COM diff --git a/Tools/cpm/bin/UNCR.COM b/Tools/cpm/bin80/UNCR.COM similarity index 100% rename from Tools/cpm/bin/UNCR.COM rename to Tools/cpm/bin80/UNCR.COM diff --git a/Tools/cpm/bin80/UNZIP.COM b/Tools/cpm/bin80/UNZIP.COM new file mode 100644 index 00000000..9da369ff Binary files /dev/null and b/Tools/cpm/bin80/UNZIP.COM differ diff --git a/Tools/cpm/bin/USQ.COM b/Tools/cpm/bin80/USQ.COM similarity index 100% rename from Tools/cpm/bin/USQ.COM rename to Tools/cpm/bin80/USQ.COM diff --git a/Tools/cpm/bin/Z80ASM.COM b/Tools/cpm/bin80/Z80ASM.COM similarity index 100% rename from Tools/cpm/bin/Z80ASM.COM rename to Tools/cpm/bin80/Z80ASM.COM diff --git a/Tools/cpm/bin/ZMAC.COM b/Tools/cpm/bin80/ZMAC.COM similarity index 100% rename from Tools/cpm/bin/ZMAC.COM rename to Tools/cpm/bin80/ZMAC.COM diff --git a/Tools/cpm/bin/ZML.COM b/Tools/cpm/bin80/ZML.COM similarity index 100% rename from Tools/cpm/bin/ZML.COM rename to Tools/cpm/bin80/ZML.COM diff --git a/Source/Images/d_bp/u15/ZMLIB.COM b/Tools/cpm/bin80/ZMLIB.COM similarity index 100% rename from Source/Images/d_bp/u15/ZMLIB.COM rename to Tools/cpm/bin80/ZMLIB.COM diff --git a/Tools/cpm/bin80/ZSM.COM b/Tools/cpm/bin80/ZSM.COM new file mode 100644 index 00000000..72d3e62c Binary files /dev/null and b/Tools/cpm/bin80/ZSM.COM differ diff --git a/Tools/cpm/include/CTYPE.H b/Tools/cpm/include80/CTYPE.H similarity index 100% rename from Tools/cpm/include/CTYPE.H rename to Tools/cpm/include80/CTYPE.H diff --git a/Tools/cpm/include/ERRNO.H b/Tools/cpm/include80/ERRNO.H similarity index 100% rename from Tools/cpm/include/ERRNO.H rename to Tools/cpm/include80/ERRNO.H diff --git a/Tools/cpm/include/FCNTL.H b/Tools/cpm/include80/FCNTL.H similarity index 100% rename from Tools/cpm/include/FCNTL.H rename to Tools/cpm/include80/FCNTL.H diff --git a/Tools/cpm/include/IO.H b/Tools/cpm/include80/IO.H similarity index 100% rename from Tools/cpm/include/IO.H rename to Tools/cpm/include80/IO.H diff --git a/Tools/cpm/include/LIBC.H b/Tools/cpm/include80/LIBC.H similarity index 100% rename from Tools/cpm/include/LIBC.H rename to Tools/cpm/include80/LIBC.H diff --git a/Tools/cpm/include/MATH.H b/Tools/cpm/include80/MATH.H similarity index 100% rename from Tools/cpm/include/MATH.H rename to Tools/cpm/include80/MATH.H diff --git a/Tools/cpm/include/SETJMP.H b/Tools/cpm/include80/SETJMP.H similarity index 100% rename from Tools/cpm/include/SETJMP.H rename to Tools/cpm/include80/SETJMP.H diff --git a/Tools/cpm/include/SGTTY.H b/Tools/cpm/include80/SGTTY.H similarity index 100% rename from Tools/cpm/include/SGTTY.H rename to Tools/cpm/include80/SGTTY.H diff --git a/Tools/cpm/include/STDIO.H b/Tools/cpm/include80/STDIO.H similarity index 100% rename from Tools/cpm/include/STDIO.H rename to Tools/cpm/include80/STDIO.H diff --git a/Tools/cpm/lib/C.LIB b/Tools/cpm/lib80/C.LIB similarity index 100% rename from Tools/cpm/lib/C.LIB rename to Tools/cpm/lib80/C.LIB diff --git a/Tools/cpm/lib/M.LIB b/Tools/cpm/lib80/M.LIB similarity index 100% rename from Tools/cpm/lib/M.LIB rename to Tools/cpm/lib80/M.LIB diff --git a/Tools/cpm/lib/ROM.LIB b/Tools/cpm/lib80/ROM.LIB similarity index 100% rename from Tools/cpm/lib/ROM.LIB rename to Tools/cpm/lib80/ROM.LIB diff --git a/Tools/cpm/lib/T.LIB b/Tools/cpm/lib80/T.LIB similarity index 100% rename from Tools/cpm/lib/T.LIB rename to Tools/cpm/lib80/T.LIB diff --git a/Tools/cpmtools/diskdefs b/Tools/cpmtools/diskdefs index 937bfcf2..81d962cc 100644 --- a/Tools/cpmtools/diskdefs +++ b/Tools/cpmtools/diskdefs @@ -271,6 +271,19 @@ diskdef interak os 2.2 end +# RomWBW 256KB ROM (128KB reserved, 128KB ROM Disk) + +diskdef wbw_rom256 + seclen 512 + tracks 4 + sectrk 64 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 0 + os 2.2 +end + # RomWBW 512KB ROM (128KB reserved, 384KB ROM Disk) diskdef wbw_rom512 @@ -297,121 +310,430 @@ diskdef wbw_rom1024 os 2.2 end -# UNA 512KB ROM (128KB reserved, 384KB ROM Disk) +# RomWBW 720K floppy media -diskdef una_rom512 +diskdef wbw_fd720 seclen 512 - tracks 12 - sectrk 64 + tracks 160 + sectrk 9 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 4 + os 2.2 +end + +# RomWBW 1.44M floppy media + +diskdef wbw_fd144 + seclen 512 + tracks 160 + sectrk 18 blocksize 2048 maxdir 256 skew 0 - boottrk 0 + boottrk 2 os 2.2 end -# UNA 512KB ROM (128KB reserved, 896KB ROM Disk) +# RomWBW 360K floppy media -diskdef una_rom1024 +diskdef wbw_fd360 seclen 512 - tracks 28 - sectrk 64 + tracks 80 + sectrk 9 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 4 + os 2.2 +end + +# RomWBW 1.20M floppy media + +diskdef wbw_fd120 + seclen 512 + tracks 160 + sectrk 15 blocksize 2048 maxdir 256 skew 0 - boottrk 0 + boottrk 2 os 2.2 end -# RomWBW 8MB Hard Disk, LU 0-3 -diskdef wbw_hd0 +# RomWBW 8320KB Hard Disk Slice (512 directory entry format) +# Legacy format: 512 dir entries, 16,630 sectors / slice + +diskdef wbw_hd512 seclen 512 - tracks 65 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 1 + boottrk 16 os 2.2 end -diskdef wbw_hd1 +# First 4 slices of wbw_hd512 +# Assumes first slice (slice 0) starts at sector 0 +# Offset of any slice (in tracks) = (1040 * ) + +diskdef wbw_hd512_0 seclen 512 - tracks 130 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 66 + boottrk 16 + offset 0T os 2.2 end -diskdef wbw_hd2 +diskdef wbw_hd512_1 seclen 512 - tracks 195 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 131 + boottrk 16 + offset 1040T os 2.2 end -diskdef wbw_hd3 +diskdef wbw_hd512_2 seclen 512 - tracks 260 - sectrk 256 + tracks 1040 + sectrk 16 blocksize 4096 maxdir 512 skew 0 - boottrk 196 + boottrk 16 + offset 2080T os 2.2 end -# RomWBW 720K floppy media -diskdef wbw_fd720 +diskdef wbw_hd512_3 seclen 512 - tracks 160 - sectrk 9 - blocksize 2048 - maxdir 128 + tracks 1040 + sectrk 16 + blocksize 4096 + maxdir 512 skew 0 - boottrk 4 + boottrk 16 + offset 3120T os 2.2 end -# RomWBW 1.44M floppy media -diskdef wbw_fd144 +# RomWBW 8MB Hard Disk (1024 directory entry format) +# New format: 1024 dir entries, 16,384 sectors / slice +# Pure filesystem image, no MBR prefix + +diskdef wbw_hd1k seclen 512 - tracks 160 - sectrk 18 - blocksize 2048 - maxdir 256 + tracks 1024 + sectrk 16 + blocksize 4096 + maxdir 1024 skew 0 boottrk 2 os 2.2 end -# RomWBW 360K floppy media -diskdef wbw_fd360 +# First 4 slices of wbw_hd1k +# Assumes standard 1MB prefix +# Offset of any slice (in tracks) = 128 + (1024 * ) + +diskdef rc2014a + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 1 + offset 0T + os 2.2 +end + +diskdef rc2014b + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 512T + os 2.2 +end + +diskdef rc2014c + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 1024T + os 2.2 +end + +diskdef rc2014d + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 1536T + os 2.2 +end + +diskdef rc2014e + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 2048T + os 2.2 +end + +diskdef rc2014f + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 2560T + os 2.2 +end + +diskdef rc2014g + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 3072T + os 2.2 +end + +diskdef rc2014h + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 3584T + os 2.2 +end + +diskdef rc2014i + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 4096T + os 2.2 +end + +diskdef rc2014j + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 4608T + os 2.2 +end + +diskdef rc2014k + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 5120T + os 2.2 +end + +diskdef rc2014l + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 5632T + os 2.2 +end + +diskdef rc2014m + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 6144T + os 2.2 +end + +diskdef rc2014n + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 6656T + os 2.2 +end + +diskdef rc2014o + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 7168T + os 2.2 +end + +diskdef rc2014p + seclen 512 + tracks 128 + sectrk 32 + blocksize 4096 + maxdir 512 + boottrk 0 + offset 7680T os 2.2 end diff --git a/Tools/gpp/gpp.exe b/Tools/gpp/gpp.exe new file mode 100644 index 00000000..f32ff575 Binary files /dev/null and b/Tools/gpp/gpp.exe differ diff --git a/Tools/gpp/gpp.pdf b/Tools/gpp/gpp.pdf new file mode 100644 index 00000000..54804336 Binary files /dev/null and b/Tools/gpp/gpp.pdf differ diff --git a/Tools/hex2bin/BIN2HEX.EXE b/Tools/hex2bin/BIN2HEX.EXE deleted file mode 100644 index add40684..00000000 Binary files a/Tools/hex2bin/BIN2HEX.EXE and /dev/null differ diff --git a/Tools/hex2bin/COPYING b/Tools/hex2bin/COPYING deleted file mode 100644 index 5b244d55..00000000 --- a/Tools/hex2bin/COPYING +++ /dev/null @@ -1,676 +0,0 @@ - - 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/Tools/hex2bin/HEX2BIN.C b/Tools/hex2bin/HEX2BIN.C deleted file mode 100644 index f971bb9d..00000000 --- a/Tools/hex2bin/HEX2BIN.C +++ /dev/null @@ -1,633 +0,0 @@ -/* hex2bin.c -- yet another reader and writer of Intel hex files - Copyright (C) 2011 John R Coffman . -*********************************************************************** - When invoked as 'hex2bin' read a sequence of Intel hex files - and create an overlaid binary file. - - When invoked as 'bin2hex' read a binary file and create an - Intel hex file. - - All command line numeric constants may be specified in any - radix. -*********************************************************************** - - 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 - in the file COPYING in the distribution directory along with this - program. If not, see . - -**********************************************************************/ -#include -#include -#include -#include "mytypes.h" - -#define true 1 -#define false 0 -#define SEG_MASK 0x00FFFFu -#define LBA_MASK 0x00FF0000ul -#define MAX_MASK (LBA_MASK|SEG_MASK) -#define ONE_MEG 0x100000ul - -dword upper_lba = 0; /* upper address */ -dword address_mask = SEG_MASK; /* address mask */ -byte pad = 0xFF; -byte *buffer; -dword rom_size = 0; -dword overwrite; /* count of possible overwrites */ -byte h2b, verbose, segmented; -char *outfilename = NULL; -char *binfilename = NULL; -dword source_address, source_limit; -dword dest_address, dest_limit; -FILE *infile; -FILE *outfile; -byte checksum; -char line[1024]; -char *lp; -long int lineno; - - - -dword convert_constant(char *str) -{ - char *final; - dword value = strtoul(str, &final, 0); - - if (*final == 'k' || *final == 'K') value *= 1024ul; - else if (*final == 'M' || *final == 'm') value *= ONE_MEG; - - return value; -} - -void error(byte level, char *msg) -{ - printf("%s(%d): %s\n", - level>1 ? "Error" : "Warning", (int)level, msg); - if (level>1) exit(level); - else if (level==0) printf("line %ld %s", lineno, line); -} - - -int getnibble(void) -{ - char ch; - - ch = -1; - if (lp) { - ch = *lp++; - if (ch>='0' && ch<='9') ch -= '0'; - else if (ch>='A' && ch<='F') ch -= 'A'-10; - else if (ch>='a' && ch<='f') ch -= 'a'-10; - else { - error(0,"Illegal hex digit"); - ch = -1; - } - } - else error(0,"Line is too short"); - return (int)ch; -} - -int getbyte(void) -{ - int b = getnibble(); - b <<= 4; - b += getnibble(); - checksum += b; - return b; -} - -int getword(void) -{ - int w = getbyte(); - w <<= 8; - w += getbyte(); - return w; -} - -dword getdword(void) -{ - dword d = getword(); - d <<= 16; - d += getword(); - return d; -} - -/* added for SREC files */ -dword get6word(void) -{ - dword d = getword(); - d <<= 8; - d += getbyte(); - return d; -} - - -void putbyte(dword address, byte data) -{ - if (address < source_address || address > source_limit) return; - address -= source_address; - address += dest_address; - if (address > dest_limit) return; - if (address >= rom_size) { - printf("Line %ld ", lineno); error(2,"Data beyond end of ROM"); - } - if (buffer[address] != pad) { - overwrite++; - if (verbose || overwrite<=100) printf("Warning(1): Overwrite at ROM address 0x%lX\n", address); - } - buffer[address] = data; -} - - -void usage(void) -{ - printf("hex2bin.c (bin2hex) -- " __TIMESTAMP__ ".\n" - "Copyright (c) 2011 John R Coffman. All rights reserved.\n" - "Distributed under the GNU General Public License, a copy of which\n" - "is contained in the file COPYING in the distribution directory.\n\n"); - if (h2b) printf( - "Usage:\n" - " hex2bin [ [/M]]+\n\n" - " Options:\n" - " -o \n" - " -p \n" - " -R default 64K\n" - " -v []\n" - " Flags:\n" - " -d \n" - " -D \n" - " -s \n" - " -S \n" - " Suffix:\n" - " /M marks a Motorola S-record input file\n" - ); - else printf( - "Usage:\n" - " bin2hex [ ]+\n\n" - " Options:\n" - " -g use Intel seGmented addressing\n" - " -o \n" - " -p \n" - " -R default 1024K\n" - " -v []\n" - " Flags:\n" - " -d \n" - " -D \n" - " -s \n" - " -S \n" - ); -} - - -void hout_byte(byte data) -{ - checksum -= data; - fprintf(outfile, "%02X", (int)data); -} -void hout_word(word data) -{ - hout_byte(data>>8); - hout_byte(data); -} -void begin_record(byte length) -{ - checksum = 0; - fputc(':', outfile); - hout_byte(length); -} -void end_record(void) -{ - hout_byte(checksum); - fputc('\n', outfile); -} - -void write_lba(dword address) -{ - if (verbose==5) printf("Address: %06lX\n", address); - - if ((address & LBA_MASK) != upper_lba) { - upper_lba = address & LBA_MASK; - begin_record(2); - hout_word(0); - if (rom_size > ONE_MEG || !segmented) { - hout_byte(4); /* linear address */ - hout_word(upper_lba>>16); - } - else { /* handle ROMs 1meg and smaller */ - hout_byte(2); /* segment address */ - hout_word(upper_lba>>4); - } - end_record(); - } -} - -void write_data(word nbytes, byte *buf, dword address) -{ - /* compress from the high end */ - while (nbytes && buf[nbytes-1]==pad) --nbytes; - /* compress from the low end */ - while (nbytes && *buf==pad) { - ++buf; - ++address; - --nbytes; - } - if (nbytes) { - write_lba(address); - begin_record(nbytes); - hout_word(address & 0xFFFFu); - hout_byte(0); /* data record */ - while(nbytes--) hout_byte(*buf++); - end_record(); - } -} - -#define min(a,b) ((a)<(b)?(a):(b)) -#define NREC 16 - -void write_hex_file(FILE *outfile) -{ - dword nbytes; - dword vaddr; - dword n; - byte *buf; - - buf = buffer; - vaddr = 0; - nbytes = rom_size; - n = min(nbytes, NREC); - do { - write_data(n, buf, vaddr); - buf += n; - vaddr += n; - nbytes -= n; - n = min(nbytes, NREC); - } while (n); -/* write the end-of-file record */ - fprintf(outfile,":00000001FF\n"); -} - - -void scan_bin_file(char *filename) -{ - dword length; - dword nbytes; - int data; - dword inaddr; - - infile = fopen(filename, "rb"); - if (!infile) { - strcpy(line,"Cannot find file: "); - error(5, strcat(line, filename)); - } -/*** length = filelength(fileno(infile)); ***/ - fseek(infile, 0L, SEEK_END); - length = ftell(infile); -/***/ - nbytes = 0; - inaddr = dest_address; - if (source_address < length) { - fseek(infile, source_address, SEEK_SET); - while (inaddr=3) printf("%s", lp-1); - checksum = 0; - rectype = getnibble(); - ldata = getbyte(); - switch(rectype) { /* get variable address field */ - case 0: - case 1: - case 5: - case 9: - laddr = getword(); - ldata -= 2; - break; - case 2: - case 8: - laddr = get6word(); - ldata -= 3; - break; - case 3: - case 7: - laddr = getdword(); - ldata -= 4; - break; - default: - error(0,"Unknown record type:"); - } - if (rectype>=1 && rectype<=3) { - index = 0; - while (--ldata) { - data = getbyte(); - /* no address mask used */ - putbyte(laddr + index, data); - index++; - } - } - else if (rectype==0) { - printf("Comment: "); - while (--ldata) { - printf("%c", (char)getbyte()); - } - printf("\n"); - } - /* else records 5,7,8,9 are ignored */ - - data = getbyte(); /* get final checksum */ - if (checksum != 0xFF) { - error(0,"Checksum failure"); - } - } while (lp && !EndOfFile); - fclose(infile); -} - -void scan_Intel_file(char *filename) -{ - byte ldata; - dword laddr; - byte rectype; - dword value; - dword index; - byte data; - byte EndOfFile = 0; - - infile = fopen(filename, "rt"); - if (!infile) { - strcpy(line,"Cannot find file: "); - error(5, strcat(line, filename)); - } - upper_lba = 0; - lineno = 0; - do { - lineno++; - lp = fgets(line, nelem(line)-1, infile); - if (lp == NULL) break; - if (*lp++ != ':') { - printf("Comment: %s",--lp); - continue; - } - if (verbose>=3) printf("%s", lp-1); - checksum = 0; - ldata = getbyte(); - laddr = getword(); - rectype = getbyte(); - switch (rectype) { - case 0: /* data record */ - index = 0; - while (ldata--) { - data = getbyte(); - putbyte(upper_lba + ((laddr + index)&address_mask), data); - index++; - } - break; - case 1: /* end of file record */ - EndOfFile = 1; - break; - case 2: /* segment address */ - address_mask = SEG_MASK; - value = getword(); - upper_lba = value<<4; /* start of segment */ - ldata -= 2; - break; - case 4: /* linear upper address */ - address_mask = MAX_MASK; - value = getword(); - upper_lba = value<<16; /* full 32-bit address range */ - ldata -= 2; - break; - case 3: /* start CS:IP */ - case 5: /* linear start address */ - value = getdword(); - ldata -= 4; - break; - default: - error(0,"Unknown record type:"); - } - getbyte(); /* get final checksum */ - if ( (checksum & 0xFF) ) { - error(0,"Checksum failure"); - } - } while (lp && !EndOfFile); - fclose(infile); -} - - -void scan_hex_file(char *filename) -{ - int i = strlen(filename); - - if (i>3 && filename[i-2]=='/' - && (filename[i-1]=='M') ) { - filename[i-2] = 0; /* remove suffix */ - scan_srec_file(filename); - } - else scan_Intel_file(filename); -} - - -void global_options(int argc, char *argv[]) -{ - int iarg; - char *cp; - char *tp; - char ch; - - h2b = false; - rom_size = ONE_MEG; /* bin2hex default value */ -/* decide which conversion to do */ - if (strstr(argv[0],"hex2bin") -#ifdef MSDOS - || strstr(argv[0],"HEX2BIN") -#endif - ) { - h2b = true; - rom_size = 64 * 1024ul; /* default value */ - } /* assume 'bin2hex' otherwise */ - - if (argc<2) { usage(); exit(0); } - -/* scan the global command line options */ - for (iarg = 0; iarg MAX_MASK+1) error(5, "ROM size too big"); - if (rom_size < 256) error(5, "ROM size too small"); - *cp = *tp = 0; - break; - case 'v': /* print verbose statistics */ - verbose++; - if (!*tp) tp = argv[++iarg]; - if (*tp>='1' && *tp<='5' && tp[1]==0) verbose += (*tp - '1'); - else tp = cp; - *cp = *tp = 0; - break; - case 'Y': { - int i; - for (i=0; i [ | ]+ - bin2hex - - Options: - -g -- Use Intel seGmented addressing in hex files for - ROMs between 64k and 1M in size. Normally, linear - addressing is used for ROMs bigger than 64k. For - ROMs larger than 1M, this switch has no effect, - since only linear addressing is possible. - - -o -- default is 'out.bin' or 'out.hex' - No suffix is added to the filename, so the full - file name must be specified. - - -p -- default is 0xFF, which is the erased - value for most ROM's. Pad bytes are not explicitly - written out when 'bin2hex' is used. This reduces - the size of sparse ROM images. - - -R -- may be any value. Normally this will be - specified as '128k' or 0x10000. The suffixes 'k' - and 'M' are recognized. The default value is 64k - for 'hex2bin' and 1M for 'bin2hex'. - - -v [] -- used primarily for debugging. A - verbosity level of 3 will print each line as it is - processed. - - Options are global, and may be specified anywhere on the command - line. Only 'flags', below, are position sensitive. Flags must - be specified immediately before the file name they are to affect. - They do not affect more that a single file. They reset to their - default values before the next input file, scanning left to - right, is processed. - - Flags: - Flag values apply only to the following file, and are reset - to the default values before the next file is processed. The - source and destination flags allow code to be relocated - within the ROM so that code may be loaded at a different - location than where it will ultimately be run. - - -d -- default is 0. - data will only be loaded between the limits of - the -d address and the -D address - minus 1. - - -D -- default is 16M. No data - will be loaded at or above this address. - - -s -- default is 0. Hex input - is only processed if it falls at addresses in the - .hex input file between the -s address and the - -S address minus 1. Likewise, Bin input - is only processed if it falls between similar limits - in the input ROM image. - - -S -- default is 16M. No input - data at or above this address will be processed. - - Suffix: - For HEX to BIN conversions, a suffix may be appended to an - input filename to indicate that it is in Motorola S-record - format instead of Intel hex format. - - /M -- there may be no space between the file- - name and the /M suffix. The foregoing file is a - Motorola S-record (S19) file, not an Intel hex file. - - Numeric values on the command line may be specified in any C-like - syntax: 0x0000 is hexadecimal, 1234 is decimal, and 0177 is - octal. In addition the suffixes 'k' for kilo- and 'M' for mega- - cause the preceding values to be multiplied by 1024 or 1048576, - respectively. - - Examples: - hex2bin -p 0xFF -R32k cpm22.hex -o cpmtest.bin - hex2bin -o cpmtest.bin cpm22.hex -R 0x8000 -p255 - - The preceding two lines have identical effects in all - respects. - - hex2bin -R 1M -s 0xd000 -d 0x0800 -D0x2800 image.hex \ - pagezero.hex -oROMIMAGE.bin - - The above line loads the 'pagezero.hex' file at the exact - addresses specified in the file; however, the 'image.hex' file - is assembled at 0xD000, must run at 0xD000, but is loaded - between 0x800 <= addr < 0x2800. It is presumed that the - code will be relocated to the correct address before it is - executed. - - hex2bin -R16K tutor.S68/M -o tutor.bin - - The above line converts the Mororola SREC file 'tutor.S68' - to a flat 16K binary file named 'tutor.bin'. - - bin2hex -R128k romimage.bin -o image.hex - - Simple conversion from a BIN file to a HEX file. The ROM - data is limited to 128k. - - bin2hex -s 0x1000 -S 0x2000 -d 0x21000 romimage.bin \ - -o Relocated.hex - - Extract from a ROM image file all of the data between 0x1000 - and 0x1FFF, inclusive, and write to an Intel hex file for - re-loading two 64k segments higher in a future ROM. - - -(end) - \ No newline at end of file diff --git a/Tools/hex2bin/HEX2BIN.EXE b/Tools/hex2bin/HEX2BIN.EXE deleted file mode 100644 index add40684..00000000 Binary files a/Tools/hex2bin/HEX2BIN.EXE and /dev/null differ diff --git a/Tools/hex2bin/MAKEFILE b/Tools/hex2bin/MAKEFILE deleted file mode 100644 index 6e74b322..00000000 --- a/Tools/hex2bin/MAKEFILE +++ /dev/null @@ -1,37 +0,0 @@ -# makefile for tools -# -# Uses DJGCC for Windows -- GCC v. 4.4.4 compiles it -# -CC = gcc -COPT = -O2 -Wall -RM = del >nul -CP = copy - -E = .exe -O = .o - -.c$E: - $(CC) $(COPT) -o $*$E $*.c - -TOOLS = hex2bin$E bin2hex$E -HFILES = mytypes.h - - -all: $(TOOLS) - -bin2hex$E: hex2bin$E - $(CP) hex2bin$E bin2hex$E - -clean: - $(RM) *$O - $(RM) hex2bin$E - $(RM) bin2hex$E - $(RM) foo*.* - -spotless: clean - $(RM) *.bin - $(RM) *.hex - -##Dependencies -hex2bin$E: hex2bin.c $(HFILES) - \ No newline at end of file diff --git a/Tools/hex2bin/MYTYPES.H b/Tools/hex2bin/MYTYPES.H deleted file mode 100644 index c97ed7eb..00000000 --- a/Tools/hex2bin/MYTYPES.H +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __MYTYPES_H -#define __MYTYPES_H 1 - -typedef unsigned char byte; -typedef unsigned short word; -typedef unsigned long dword; - - -#ifdef __SDCC__ -#define outp(port,byte) port = (byte) -#define inp(port) (port) -#endif - -#define nelem(x) (sizeof(x)/sizeof(x[0])) - -#endif /* __MYTYPES_H */ diff --git a/Tools/lzsa/lzsa.exe b/Tools/lzsa/lzsa.exe index 1c1927d7..f7ad5895 100644 Binary files a/Tools/lzsa/lzsa.exe and b/Tools/lzsa/lzsa.exe differ diff --git a/Tools/simh/Sim.cfg b/Tools/simh/Sim.cfg index 8c8af2bf..290357b4 100644 --- a/Tools/simh/Sim.cfg +++ b/Tools/simh/Sim.cfg @@ -23,12 +23,13 @@ attach n8vem0 %1 ; hard disks ;set hdsk debug=read;write;verbose -attach hdsk0 ..\..\Binary\hd_combo.img -attach hdsk1 ..\..\Binary\hd_combo.img +attach hdsk0 ..\..\Binary\hd512_combo.img +;attach hdsk0 ..\..\Binary\psys.img +attach hdsk1 ..\..\Binary\hd1k_combo.img set hdsk0 format=HDSK set hdsk1 format=HDSK -set hdsk0 geom=T:2048/N:256/S:512 -set hdsk1 geom=T:2048/N:256/S:512 +set hdsk0 geom=T:8192/N:256/S:512 +set hdsk1 geom=T:8192/N:256/S:512 set hdsk0 wrtenb set hdsk1 wrtenb diff --git a/Tools/simh/altairz80.exe b/Tools/simh/altairz80.exe index 5fbaaf41..5e34f627 100644 Binary files a/Tools/simh/altairz80.exe and b/Tools/simh/altairz80.exe differ diff --git a/Tools/srecord/README.pdf b/Tools/srecord/README.pdf new file mode 100644 index 00000000..2425feb6 Binary files /dev/null and b/Tools/srecord/README.pdf differ diff --git a/Tools/srecord/Readme-Windows.txt b/Tools/srecord/Readme-Windows.txt new file mode 100644 index 00000000..f206ce06 --- /dev/null +++ b/Tools/srecord/Readme-Windows.txt @@ -0,0 +1,73 @@ +If you just want to use the srecord tools, you can stop reading here. + +Following are instructions how I (Jens Heilig) built the srecord tools on Windows: + +How to build srecord 1.64 tools on Windows: + +PREREQUISITES: +============== +1) MinGW +Download and install mingw-get-inst (I used version 20110530) from http://mingw.sourceforge.net/ Select C++ and MinGW Developer Toolkit during installation. + +Start MinGW Shell from the Windows Start Menu. +Install additional packages by entering following commands at the prompt: +(the "$"-sign indicates the shell-prompt. Do not type it) +$ mingw-get.exe install msys-groff-ext +$ mingw-get.exe install gettext + +2) Boost Library +Download and install the Boost library from here: http://ascend4.org/Binary_installer_for_Boost_on_MinGW +Copy the newly installed files to you MinGW directory: +$ cp /lib/* /lib/ +$ cp -r /include/boost-1_41/boost /include/ + + +3) libgcrpyt library +Download libgcrypt-1.5.0.tar.bz2 and libgpg-error-1.10.tar.bz2 (newer versions should also work) from http://www.gnupg.org/download/index.en.html +cd to the directory where the two downloaded files are (make sure the path to this directory does not contain spaces) +$ tar jxfv libgpg-error-1.10.tar.bz2 +$ cd libgpg-error-1.10 +$ ./configure --disable-shared --enable-static && make && make install +(the previous step might hang when converting from ISO-8859-2 to UTF-8 late in the build process. Press ctrl-c and proceed) +$ cd .. +$ tar libgcrypt-1.5.0.tar.bz2 +$ cd libgcrypt +$ ./configure --disable-shared --enable-static && make && make install + +You now have all the prerequisites required to build the srecord tools. Let's proceed. + + +BUILDING SRECORD TOOLS +====================== +cd to the directory where you unpacked the srecord source code. + +Starting with srecord version 1.63 (and including version 1.64), it is necessary to modify Makefile.in: +In line 4096 remove the text "bin/test_gecos", so the line becomes: + bin/test_crc16 bin/test_fletcher16 \ + +Reason: This test program cannot be built because it requires the pwd.h header and Linux functions which are not available in MinGW + + +Finally, start the actual build process: + +Start configure for srecord: +$ CPPFLAGS="-static -I/include -I/usr/local/include" LDFLAGS="-L/lib -L/usr/local/lib" CC='gcc -static-libgcc' CXX='g++ -static-libgcc -static-libstdc++' LIBS=-lgpg-error ./configure + +After configure has run successfully, start the build process: +$ make + +After successful build process, run the tests: +$ make -i sure + +All tests should succeed. + +Next, reduce the size of the built programs by removing debugging information: +$ cd bin +$ strip *.exe + +Finally, move srec_cat.exe, srec_info.exe and srec_cmp.exe from the bin directory to where you want them, you can then delete everything else in the bin-directory. + +You should now have working srecord tools! + +Good Luck! +Jens Heilig, 2014-06-22 diff --git a/Tools/srecord/srec_cat.exe b/Tools/srecord/srec_cat.exe new file mode 100644 index 00000000..31d4d0cd Binary files /dev/null and b/Tools/srecord/srec_cat.exe differ diff --git a/Tools/srecord/srec_cmp.exe b/Tools/srecord/srec_cmp.exe new file mode 100644 index 00000000..66827808 Binary files /dev/null and b/Tools/srecord/srec_cmp.exe differ diff --git a/Tools/srecord/srec_info.exe b/Tools/srecord/srec_info.exe new file mode 100644 index 00000000..b71f774a Binary files /dev/null and b/Tools/srecord/srec_info.exe differ diff --git a/Tools/srecord/srecord-1.64.pdf b/Tools/srecord/srecord-1.64.pdf new file mode 100644 index 00000000..97b49159 Binary files /dev/null and b/Tools/srecord/srecord-1.64.pdf differ diff --git a/Tools/tasm32/TASM280.TAB b/Tools/tasm32/TASM280.TAB new file mode 100644 index 00000000..b57fad84 --- /dev/null +++ b/Tools/tasm32/TASM280.TAB @@ -0,0 +1,617 @@ +"TASM Z80 Assembler. " +/**************************************************************************** +/* $Id: tasm80.tab 1.2 1998/02/28 14:31:22 toma Exp $ +/**************************************************************************** +/* This is the instruction set definition table +/* for the Z280 version of TASM. +/* +/* Only a few Z280 specific instructions have been added! +/* +/* Class bits assigned as follows: +/* Bit-0 = Z280 (base instruction set) +/* See TASM manual for info on table structure. +/* +/*INSTR ARGS OP BYTES RULE CLASS SHIFT OR */ +/*-------------------------------------------*/ + +ADC A,(HL) 8E 1 NOP 1 +ADC A,(IX*) 8EDD 3 ZIX 1 +ADC A,(IY*) 8EFD 3 ZIX 1 +ADC A,A 8F 1 NOP 1 +ADC A,B 88 1 NOP 1 +ADC A,C 89 1 NOP 1 +ADC A,D 8A 1 NOP 1 +ADC A,E 8B 1 NOP 1 +ADC A,H 8C 1 NOP 1 +ADC A,L 8D 1 NOP 1 +ADC A,* CE 2 NOP 1 +ADC HL,BC 4AED 2 NOP 1 +ADC HL,DE 5AED 2 NOP 1 +ADC HL,HL 6AED 2 NOP 1 +ADC HL,SP 7AED 2 NOP 1 + +ADD A,(HL) 86 1 NOP 1 +ADD A,(IX*) 86DD 3 ZIX 1 +ADD A,(IY*) 86FD 3 ZIX 1 +ADD A,A 87 1 NOP 1 +ADD A,B 80 1 NOP 1 +ADD A,C 81 1 NOP 1 +ADD A,D 82 1 NOP 1 +ADD A,E 83 1 NOP 1 +ADD A,H 84 1 NOP 1 +ADD A,L 85 1 NOP 1 +ADD A,* C6 2 NOP 1 +ADD HL,A 6DED 2 NOP 1 /* Z280 */ +ADD HL,BC 09 1 NOP 1 +ADD HL,DE 19 1 NOP 1 +ADD HL,HL 29 1 NOP 1 +ADD HL,SP 39 1 NOP 1 +ADD IX,BC 09DD 2 NOP 1 +ADD IX,DE 19DD 2 NOP 1 +ADD IX,IX 29DD 2 NOP 1 +ADD IX,SP 39DD 2 NOP 1 +ADD IY,BC 09FD 2 NOP 1 +ADD IY,DE 19FD 2 NOP 1 +ADD IY,IY 29FD 2 NOP 1 +ADD IY,SP 39FD 2 NOP 1 + +AND (HL) A6 1 NOP 1 +AND (IX*) A6DD 3 ZIX 1 +AND (IY*) A6FD 3 ZIX 1 +AND A A7 1 NOP 1 +AND B A0 1 NOP 1 +AND C A1 1 NOP 1 +AND D A2 1 NOP 1 +AND E A3 1 NOP 1 +AND H A4 1 NOP 1 +AND L A5 1 NOP 1 +AND * E6 2 NOP 1 + +BIT *,(HL) 46CB 2 ZBIT 1 +BIT *,(IX*) CBDD 4 ZBIT 1 0 4600 +BIT *,(IY*) CBFD 4 ZBIT 1 0 4600 +BIT *,A 47CB 2 ZBIT 1 +BIT *,B 40CB 2 ZBIT 1 +BIT *,C 41CB 2 ZBIT 1 +BIT *,D 42CB 2 ZBIT 1 +BIT *,E 43CB 2 ZBIT 1 +BIT *,H 44CB 2 ZBIT 1 +BIT *,L 45CB 2 ZBIT 1 + +CALL C,* DC 3 NOP 1 +CALL M,* FC 3 NOP 1 +CALL NC,* D4 3 NOP 1 +CALL NZ,* C4 3 NOP 1 +CALL P,* F4 3 NOP 1 +CALL PE,* EC 3 NOP 1 +CALL PO,* E4 3 NOP 1 +CALL Z,* CC 3 NOP 1 +CALL * CD 3 NOP 1 + +CCF "" 3F 1 NOP 1 + +CP (HL) BE 1 NOP 1 +CP (IX*) BEDD 3 ZIX 1 +CP (IY*) BEFD 3 ZIX 1 +CP A BF 1 NOP 1 +CP B B8 1 NOP 1 +CP C B9 1 NOP 1 +CP D BA 1 NOP 1 +CP E BB 1 NOP 1 +CP H BC 1 NOP 1 +CP L BD 1 NOP 1 +CP * FE 2 NOP 1 +CPD "" A9ED 2 NOP 1 +CPDR "" B9ED 2 NOP 1 +CPIR "" B1ED 2 NOP 1 +CPI "" A1ED 2 NOP 1 +CPL "" 2F 1 NOP 1 + +DAA "" 27 1 NOP 1 + +DEC (HL) 35 1 NOP 1 +DEC (IX*) 35DD 3 ZIX 1 +DEC (IY*) 35FD 3 ZIX 1 +DEC A 3D 1 NOP 1 +DEC B 05 1 NOP 1 +DEC BC 0B 1 NOP 1 +DEC C 0D 1 NOP 1 +DEC D 15 1 NOP 1 +DEC DE 1B 1 NOP 1 +DEC E 1D 1 NOP 1 +DEC H 25 1 NOP 1 +DEC HL 2B 1 NOP 1 +DEC IX 2BDD 2 NOP 1 +DEC IY 2BFD 2 NOP 1 +DEC L 2D 1 NOP 1 +DEC SP 3B 1 NOP 1 +DI "" F3 1 NOP 1 +DJNZ * 10 2 R1 1 +EI "" FB 1 NOP 1 +EI * 7FED 3 NOP 1 /* Z280 */ +EX (SP),HL E3 1 NOP 1 +EX (SP),IX E3DD 2 NOP 1 +EX (SP),IY E3FD 2 NOP 1 +EX AF,AF' 08 1 NOP 1 +EX DE,HL EB 1 NOP 1 +EXX "" D9 1 NOP 1 +HALT "" 76 1 NOP 1 + +IM 0 46ED 2 NOP 1 +IM 1 56ED 2 NOP 1 +IM 2 5EED 2 NOP 1 +IM 3 4EED 2 NOP 1 /* Z280 */ + +/* Alternate form of above +IM0 46ED 2 NOP 1 +IM1 56ED 2 NOP 1 +IM2 5EED 2 NOP 1 +IM3 4EED 2 NOP 1 /* Z280 */ + +IN A,(C) 78ED 2 NOP 1 +IN B,(C) 40ED 2 NOP 1 +IN C,(C) 48ED 2 NOP 1 +IN D,(C) 50ED 2 NOP 1 +IN E,(C) 58ED 2 NOP 1 +IN H,(C) 60ED 2 NOP 1 +IN L,(C) 68ED 2 NOP 1 + +IN A,(*) DB 2 NOP 1 + +INW HL,(C) B7ED 2 NOP 1 /* Z280 */ + +IN0 A,(*) 38ED 3 NOP 2 +IN0 B,(*) 00ED 3 NOP 2 +IN0 C,(*) 08ED 3 NOP 2 +IN0 D,(*) 10ED 3 NOP 2 +IN0 E,(*) 18ED 3 NOP 2 +IN0 H,(*) 20ED 3 NOP 2 +IN0 L,(*) 28ED 3 NOP 2 + +INC (HL) 34 1 NOP 1 +INC (IX*) 34DD 3 ZIX 1 +INC (IY*) 34FD 3 ZIX 1 +INC A 3C 1 NOP 1 +INC B 04 1 NOP 1 +INC BC 03 1 NOP 1 +INC C 0C 1 NOP 1 +INC D 14 1 NOP 1 +INC DE 13 1 NOP 1 +INC E 1C 1 NOP 1 +INC H 24 1 NOP 1 +INC HL 23 1 NOP 1 +INC IX 23DD 2 NOP 1 +INC IY 23FD 2 NOP 1 +INC L 2C 1 NOP 1 +INC SP 33 1 NOP 1 + + +IND "" AAED 2 NOP 1 +INDR "" BAED 2 NOP 1 +INI "" A2ED 2 NOP 1 +INIR "" B2ED 2 NOP 1 + +JP (HL) E9 1 NOP 1 +JP (IX) E9DD 2 NOP 1 +JP (IY) E9FD 2 NOP 1 +JP C,* DA 3 NOP 1 +JP M,* FA 3 NOP 1 +JP NC,* D2 3 NOP 1 +JP NZ,* C2 3 NOP 1 +JP P,* F2 3 NOP 1 +JP PE,* EA 3 NOP 1 +JP PO,* E2 3 NOP 1 +JP Z,* CA 3 NOP 1 +JP * C3 3 NOP 1 + +JR C,* 38 2 R1 1 +JR NC,* 30 2 R1 1 +JR NZ,* 20 2 R1 1 +JR Z,* 28 2 R1 1 +JR * 18 2 R1 1 + +LD (BC),A 02 1 NOP 1 +LD (DE),A 12 1 NOP 1 +LD (HL),A 77 1 NOP 1 +LD (HL),B 70 1 NOP 1 +LD (HL),C 71 1 NOP 1 +LD (HL),D 72 1 NOP 1 +LD (HL),E 73 1 NOP 1 +LD (HL),H 74 1 NOP 1 +LD (HL),L 75 1 NOP 1 +LD (HL),DE 1EED 2 NOP 1 /* Z280 */ +LD (HL),* 36 2 NOP 1 +LD (IX*),A 77DD 3 ZIX 1 +LD (IX*),B 70DD 3 ZIX 1 +LD (IX*),C 71DD 3 ZIX 1 +LD (IX*),D 72DD 3 ZIX 1 +LD (IX*),E 73DD 3 ZIX 1 +LD (IX*),H 74DD 3 ZIX 1 +LD (IX*),L 75DD 3 ZIX 1 +LD (IX*),* 36DD 4 ZIX 1 +LD (IY*),A 77FD 3 ZIX 1 +LD (IY*),B 70FD 3 ZIX 1 +LD (IY*),C 71FD 3 ZIX 1 +LD (IY*),D 72FD 3 ZIX 1 +LD (IY*),E 73FD 3 ZIX 1 +LD (IY*),H 74FD 3 ZIX 1 +LD (IY*),L 75FD 3 ZIX 1 +LD (IY*),* 36FD 4 ZIX 1 +LD (*),A 32 3 NOP 1 +LD (*),BC 43ED 4 NOP 1 +LD (*),DE 53ED 4 NOP 1 +LD (*),HL 22 3 NOP 1 +LD (*),IX 22DD 4 NOP 1 +LD (*),IY 22FD 4 NOP 1 +LD (*),SP 73ED 4 NOP 1 +LD A,(BC) 0A 1 NOP 1 +LD A,(DE) 1A 1 NOP 1 +LD A,(HL) 7E 1 NOP 1 +LD A,(IX*) 7EDD 3 ZIX 1 +LD A,(IY*) 7EFD 3 ZIX 1 +LD A,A 7F 1 NOP 1 +LD A,B 78 1 NOP 1 +LD A,C 79 1 NOP 1 +LD A,D 7A 1 NOP 1 +LD A,E 7B 1 NOP 1 +LD A,H 7C 1 NOP 1 +LD A,I 57ED 2 NOP 1 +LD A,L 7D 1 NOP 1 +LD A,R 5FED 2 NOP 1 +LD A,(*) 3A 3 NOP 1 +LD A,* 3E 2 NOP 1 +LD B,(HL) 46 1 NOP 1 +LD B,(IX*) 46DD 3 ZIX 1 +LD B,(IY*) 46FD 3 ZIX 1 +LD B,A 47 1 NOP 1 +LD B,B 40 1 NOP 1 +LD B,C 41 1 NOP 1 +LD B,D 42 1 NOP 1 +LD B,E 43 1 NOP 1 +LD B,H 44 1 NOP 1 +LD B,L 45 1 NOP 1 +LD B,* 06 2 NOP 1 +LD BC,(*) 4BED 4 NOP 1 +LD BC,* 01 3 NOP 1 +LD C,(HL) 4E 1 NOP 1 +LD C,(IX*) 4EDD 3 ZIX 1 +LD C,(IY*) 4EFD 3 ZIX 1 +LD C,A 4F 1 NOP 1 +LD C,B 48 1 NOP 1 +LD C,C 49 1 NOP 1 +LD C,D 4A 1 NOP 1 +LD C,E 4B 1 NOP 1 +LD C,H 4C 1 NOP 1 +LD C,L 4D 1 NOP 1 +LD C,* 0E 2 NOP 1 +LD D,(HL) 56 1 NOP 1 +LD D,(IX*) 56DD 3 ZIX 1 +LD D,(IY*) 56FD 3 ZIX 1 +LD D,A 57 1 NOP 1 +LD D,B 50 1 NOP 1 +LD D,C 51 1 NOP 1 +LD D,D 52 1 NOP 1 +LD D,E 53 1 NOP 1 +LD D,H 54 1 NOP 1 +LD D,L 55 1 NOP 1 +LD D,* 16 2 NOP 1 +LD DE,(*) 5BED 4 NOP 1 +LD DE,* 11 3 NOP 1 +LD E,(HL) 5E 1 NOP 1 +LD E,(IX*) 5EDD 3 ZIX 1 +LD E,(IY*) 5EFD 3 ZIX 1 +LD E,A 5F 1 NOP 1 +LD E,B 58 1 NOP 1 +LD E,C 59 1 NOP 1 +LD E,D 5A 1 NOP 1 +LD E,E 5B 1 NOP 1 +LD E,H 5C 1 NOP 1 +LD E,L 5D 1 NOP 1 +LD E,* 1E 2 NOP 1 +LD H,(HL) 66 1 NOP 1 +LD H,(IX*) 66DD 3 ZIX 1 +LD H,(IY*) 66FD 3 ZIX 1 +LD H,A 67 1 NOP 1 +LD H,B 60 1 NOP 1 +LD H,C 61 1 NOP 1 +LD H,D 62 1 NOP 1 +LD H,E 63 1 NOP 1 +LD H,H 64 1 NOP 1 +LD H,L 65 1 NOP 1 +LD H,* 26 2 NOP 1 +LD HL,(HL) 26ED 2 NOP 1 /* Z280 */ +LD HL,(*) 2A 3 NOP 1 +LD HL,* 21 3 NOP 1 +LD I,A 47ED 2 NOP 1 +LD IX,(*) 2ADD 4 NOP 1 +LD IX,* 21DD 4 NOP 1 +LD IY,(*) 2AFD 4 NOP 1 +LD IY,* 21FD 4 NOP 1 +LD L,(HL) 6E 1 NOP 1 +LD L,(IX*) 6EDD 3 ZIX 1 +LD L,(IY*) 6EFD 3 ZIX 1 +LD L,A 6F 1 NOP 1 +LD L,B 68 1 NOP 1 +LD L,C 69 1 NOP 1 +LD L,D 6A 1 NOP 1 +LD L,E 6B 1 NOP 1 +LD L,H 6C 1 NOP 1 +LD L,L 6D 1 NOP 1 +LD L,* 2E 2 NOP 1 +LD R,A 4FED 2 NOP 1 +LD SP,(*) 7BED 4 NOP 1 +LD SP,HL F9 1 NOP 1 +LD SP,IX F9DD 2 NOP 1 +LD SP,IY F9FD 2 NOP 1 +LD SP,* 31 3 NOP 1 +LDUD A,(HL) 86ED 2 NOP 1 /* Z280 */ +LDUP A,(HL) 96ED 2 NOP 1 /* Z280 */ +LDCTL (C),HL 6EED 2 NOP 1 /* Z280 */ +LDCTL HL,(C) 66ED 2 NOP 1 /* Z280 */ +LDCTL USP,HL 8FED 2 NOP 1 /* Z280 */ +LDCTL IY,(C) 66EDFD 3 NOP 1 /* Z280 */ +LDCTL (C),IY 6EEDFD 3 NOP 1 /* Z280 */ +LDD "" A8ED 2 NOP 1 +LDDR "" B8ED 2 NOP 1 +LDI "" A0ED 2 NOP 1 +LDIR "" B0ED 2 NOP 1 +MULTU A,* F9EDFD 4 NOP 1 /* Z280 */ +NEG "" 44ED 2 NOP 1 +NOP "" 00 1 NOP 1 + +MLT BC 4CED 2 NOP 2 +MLT DE 5CED 2 NOP 2 +MLT HL 6CED 2 NOP 2 +MLT SP 7CED 2 NOP 2 + +OR (HL) B6 1 NOP 1 +OR (IX*) B6DD 3 ZIX 1 +OR (IY*) B6FD 3 ZIX 1 +OR A B7 1 NOP 1 +OR B B0 1 NOP 1 +OR C B1 1 NOP 1 +OR D B2 1 NOP 1 +OR E B3 1 NOP 1 +OR H B4 1 NOP 1 +OR L B5 1 NOP 1 +OR * F6 2 NOP 1 + +OTDM "" 8BED 2 NOP 2 +OTDMR "" 9BED 2 NOP 2 +OTDR "" BBED 2 NOP 1 +OTIM "" 83ED 2 NOP 2 +OTIMR "" 93ED 2 NOP 2 +OTIR "" B3ED 2 NOP 1 +OTIRW "" 93ED 2 NOP 1 /* Z280 */ + +OUT (C),A 79ED 2 NOP 1 +OUT (C),B 41ED 2 NOP 1 +OUT (C),C 49ED 2 NOP 1 +OUT (C),D 51ED 2 NOP 1 +OUT (C),E 59ED 2 NOP 1 +OUT (C),H 61ED 2 NOP 1 +OUT (C),L 69ED 2 NOP 1 +OUT (*),A D3 2 NOP 1 + +OUT0 (*),A 39ED 3 NOP 2 +OUT0 (*),B 01ED 3 NOP 2 +OUT0 (*),C 09ED 3 NOP 2 +OUT0 (*),D 11ED 3 NOP 2 +OUT0 (*),E 19ED 3 NOP 2 +OUT0 (*),H 21ED 3 NOP 2 +OUT0 (*),L 29ED 3 NOP 2 + +OUTD "" ABED 2 NOP 1 +OUTI "" A3ED 2 NOP 1 + +OUTW (C),HL BFED 2 NOP 1 /* Z280 */ + +PCACHE "" 65ED 2 NOP 1 /* Z280 */ + +POP AF F1 1 NOP 1 +POP BC C1 1 NOP 1 +POP DE D1 1 NOP 1 +POP HL E1 1 NOP 1 +POP IX E1DD 2 NOP 1 +POP IY E1FD 2 NOP 1 + +PUSH AF F5 1 NOP 1 +PUSH BC C5 1 NOP 1 +PUSH DE D5 1 NOP 1 +PUSH HL E5 1 NOP 1 +PUSH IX E5DD 2 NOP 1 +PUSH IY E5FD 2 NOP 1 + +RES *,(HL) 86CB 2 ZBIT 1 +RES *,(IX*) CBDD 4 ZBIT 1 0 8600 +RES *,(IY*) CBFD 4 ZBIT 1 0 8600 +RES *,A 87CB 2 ZBIT 1 +RES *,B 80CB 2 ZBIT 1 +RES *,C 81CB 2 ZBIT 1 +RES *,D 82CB 2 ZBIT 1 +RES *,E 83CB 2 ZBIT 1 +RES *,H 84CB 2 ZBIT 1 +RES *,L 85CB 2 ZBIT 1 + +RET "" C9 1 NOP 1 +RET C D8 1 NOP 1 +RET M F8 1 NOP 1 +RET NC D0 1 NOP 1 +RET NZ C0 1 NOP 1 +RET P F0 1 NOP 1 +RET PE E8 1 NOP 1 +RET PO E0 1 NOP 1 +RET Z C8 1 NOP 1 +RETI "" 4DED 2 NOP 1 +RETIL "" 55ED 2 NOP 1 /* Z280 */ +RETN "" 45ED 2 NOP 1 + +RL (HL) 16CB 2 NOP 1 +RL (IX*) CBDD 4 ZIX 1 0 1600 +RL (IY*) CBFD 4 ZIX 1 0 1600 +RL A 17CB 2 NOP 1 +RL B 10CB 2 NOP 1 +RL C 11CB 2 NOP 1 +RL D 12CB 2 NOP 1 +RL E 13CB 2 NOP 1 +RL H 14CB 2 NOP 1 +RL L 15CB 2 NOP 1 +RLA "" 17 1 NOP 1 + +RLC (HL) 06CB 2 NOP 1 +RLC (IX*) CBDD 4 ZIX 1 0 0600 +RLC (IY*) CBFD 4 ZIX 1 0 0600 +RLC A 07CB 2 NOP 1 +RLC B 00CB 2 NOP 1 +RLC C 01CB 2 NOP 1 +RLC D 02CB 2 NOP 1 +RLC E 03CB 2 NOP 1 +RLC H 04CB 2 NOP 1 +RLC L 05CB 2 NOP 1 +RLCA "" 07 1 NOP 1 +RLD "" 6FED 2 NOP 1 + +RR (HL) 1ECB 2 NOP 1 +RR (IX*) CBDD 4 ZIX 1 0 1E00 +RR (IY*) CBFD 4 ZIX 1 0 1E00 +RR A 1FCB 2 NOP 1 +RR B 18CB 2 NOP 1 +RR C 19CB 2 NOP 1 +RR D 1ACB 2 NOP 1 +RR E 1BCB 2 NOP 1 +RR H 1CCB 2 NOP 1 +RR L 1DCB 2 NOP 1 +RRA "" 1F 1 NOP 1 +RRC (HL) 0ECB 2 NOP 1 +RRC (IX*) CBDD 4 ZIX 1 0 0E00 +RRC (IY*) CBFD 4 ZIX 1 0 0E00 +RRC A 0FCB 2 NOP 1 +RRC B 08CB 2 NOP 1 +RRC C 09CB 2 NOP 1 +RRC D 0ACB 2 NOP 1 +RRC E 0BCB 2 NOP 1 +RRC H 0CCB 2 NOP 1 +RRC L 0DCB 2 NOP 1 +RRCA "" 0F 1 NOP 1 +RRD "" 67ED 2 NOP 1 + +RST 00H C7 1 NOP 1 +RST 08H CF 1 NOP 1 +RST 10H D7 1 NOP 1 +RST 18H DF 1 NOP 1 +RST 20H E7 1 NOP 1 +RST 28H EF 1 NOP 1 +RST 30H F7 1 NOP 1 +RST 38H FF 1 NOP 1 + +/* Alternate form of above +RST 00 C7 1 NOP 1 +RST 08 CF 1 NOP 1 +RST 10 D7 1 NOP 1 +RST 18 DF 1 NOP 1 +RST 20 E7 1 NOP 1 +RST 28 EF 1 NOP 1 +RST 30 F7 1 NOP 1 +RST 38 FF 1 NOP 1 + +SBC A,(HL) 9E 1 NOP 1 +SBC A,(IX*) 9EDD 3 ZIX 1 +SBC A,(IY*) 9EFD 3 ZIX 1 +SBC A,A 9F 1 NOP 1 +SBC A,B 98 1 NOP 1 +SBC A,C 99 1 NOP 1 +SBC A,D 9A 1 NOP 1 +SBC A,E 9B 1 NOP 1 +SBC A,H 9C 1 NOP 1 +SBC A,L 9D 1 NOP 1 +SBC HL,BC 42ED 2 NOP 1 +SBC HL,DE 52ED 2 NOP 1 +SBC HL,HL 62ED 2 NOP 1 +SBC HL,SP 72ED 2 NOP 1 +SBC A,* DE 2 NOP 1 + +SC * 71ED 4 NOP 1 /* Z280 */ + +SCF "" 37 1 NOP 1 + +SET *,(HL) C6CB 2 ZBIT 1 +SET *,(IX*) CBDD 4 ZBIT 1 0 C600 +SET *,(IY*) CBFD 4 ZBIT 1 0 C600 +SET *,A C7CB 2 ZBIT 1 +SET *,B C0CB 2 ZBIT 1 +SET *,C C1CB 2 ZBIT 1 +SET *,D C2CB 2 ZBIT 1 +SET *,E C3CB 2 ZBIT 1 +SET *,H C4CB 2 ZBIT 1 +SET *,L C5CB 2 ZBIT 1 + +SLA (HL) 26CB 2 NOP 1 +SLA (IX*) CBDD 4 ZIX 1 0 2600 +SLA (IY*) CBFD 4 ZIX 1 0 2600 +SLA A 27CB 2 NOP 1 +SLA B 20CB 2 NOP 1 +SLA C 21CB 2 NOP 1 +SLA D 22CB 2 NOP 1 +SLA E 23CB 2 NOP 1 +SLA H 24CB 2 NOP 1 +SLA L 25CB 2 NOP 1 + +SLP "" 76ED 2 NOP 2 + +SRA (HL) 2ECB 2 NOP 1 +SRA (IX*) CBDD 4 ZIX 1 0 2E00 +SRA (IY*) CBFD 4 ZIX 1 0 2E00 +SRA A 2FCB 2 NOP 1 +SRA B 28CB 2 NOP 1 +SRA C 29CB 2 NOP 1 +SRA D 2ACB 2 NOP 1 +SRA E 2BCB 2 NOP 1 +SRA H 2CCB 2 NOP 1 +SRA L 2DCB 2 NOP 1 + +SRL (HL) 3ECB 2 NOP 1 +SRL (IX*) CBDD 4 ZIX 1 0 3E00 +SRL (IY*) CBFD 4 ZIX 1 0 3E00 +SRL A 3FCB 2 NOP 1 +SRL B 38CB 2 NOP 1 +SRL C 39CB 2 NOP 1 +SRL D 3ACB 2 NOP 1 +SRL E 3BCB 2 NOP 1 +SRL H 3CCB 2 NOP 1 +SRL L 3DCB 2 NOP 1 + +SUB (HL) 96 1 NOP 1 +SUB (IX*) 96DD 3 ZIX 1 +SUB (IY*) 96FD 3 ZIX 1 +SUB A 97 1 NOP 1 +SUB B 90 1 NOP 1 +SUB C 91 1 NOP 1 +SUB D 92 1 NOP 1 +SUB E 93 1 NOP 1 +SUB H 94 1 NOP 1 +SUB L 95 1 NOP 1 +SUB * D6 2 NOP 1 + +TST A 3CED 2 NOP 2 +TST B 04ED 2 NOP 2 +TST C 0CED 2 NOP 2 +TST D 14ED 2 NOP 2 +TST E 1CED 2 NOP 2 +TST H 24ED 2 NOP 2 +TST L 2CED 2 NOP 2 +TST (HL) 34ED 2 NOP 2 +TST * 64ED 3 NOP 2 + +TSTIO * 74ED 3 NOP 2 + +XOR (HL) AE 1 NOP 1 +XOR (IX*) AEDD 3 ZIX 1 +XOR (IY*) AEFD 3 ZIX 1 +XOR A AF 1 NOP 1 +XOR B A8 1 NOP 1 +XOR C A9 1 NOP 1 +XOR D AA 1 NOP 1 +XOR E AB 1 NOP 1 +XOR H AC 1 NOP 1 +XOR L AD 1 NOP 1 +XOR * EE 2 NOP 1 diff --git a/Tools/unix/Makefile b/Tools/unix/Makefile index bbe6724b..bdd56c36 100644 --- a/Tools/unix/Makefile +++ b/Tools/unix/Makefile @@ -9,19 +9,11 @@ ifeq ($(UNAME), Darwin) SUFFIX=osx endif -SUBDIRS= bst uz80as zx cpmtools bin2asm lzsa +SUBDIRS = bst uz80as zxcc cpmtools bin2asm lzsa all: - @for i in $(SUBDIRS) ; do \ - (cd $$i ; make all ) \ - done - -clobber: - @for i in $(SUBDIRS) ; do \ - (cd $$i ; make clobber ) \ - done + @chmod +x casefn.sh + @$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) all;) clean: - @for i in $(SUBDIRS) ; do \ - (cd $$i ; make clean ) \ - done + @$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) clean;) \ No newline at end of file diff --git a/Tools/unix/Readme.txt b/Tools/unix/Readme.txt new file mode 100644 index 00000000..8115beb5 --- /dev/null +++ b/Tools/unix/Readme.txt @@ -0,0 +1,110 @@ +This tree now contains makefiles and tools to build on Linux and +macOS. Linux is rather more thoroughly tested compared to macOS. + +To get here, TASM and the propeller generation tools needed to be +replaced, and since the unix filesystem is usually case-sensitive, +and CP/M and windows are not, the cpm tools were made case-insensitive. + +TASM was replaced with uz80as, which implements a subset of TASM and +fixes some bugs. However, I needed to add some functionality to make +it build the sources as they exist in this tree. In particular, one +thing to be very careful of is that TASM is not entirely consistent +with respect to the .DS directive. it's usually a bad idea to mix +.DS, .FILL, .DB with .ORG. + + .DS n is best thought of as .ORG $ + n + .ORG changes the memory pointer, but does not change the file + output point. It works a lot more like M80, SLR* .PHASE + +It assumes that you have some standard system tools and libraries +installed, specifically: gcc, gnu make, libncurses, and srecord. +Typically, something like this will take care of adding all +required packages in Linux: + + sudo apt install build-essential libncurses-dev srecord + +For MacOS, you will need: + + brew install srecord + +To build: + cd to the top directory and type "make". + +By default, this will generate all of the standard configurations of +RomWBW for all platforms. If you just want to build the ROM for a +specific platform and configuration you can use + + make ROM_PLATFORM= ROM_CONFIG= + +where is one of the supported platforms such as SBC, RCZ80, +etc. and is a configuration of that platform. For example, +to build the "126" configuration of the "SCZ180" platform: + + make ROM_PLATFORM=SCZ180 ROM_CONFIG=126 + +Please be aware that the make-based build does have a few deficiencies. + +First and most important, the Makefiles do not handle reruns very well. +To ensure a full buld, use "make clean" from the top level directory +before running the actual build. + +Second, there are some build failures that will not stop the make +process. Most of this is because real CP/M 2.2 tools are used in +places and CP/M 2.2 does not allow programs to return a result code. + +Third, not all dependencies are properly handled. So, changes to some +files will not cause things to rebuild as appropriate. In general, I +recommend doing a "make clean" before running "make" to ensure that +everything is fully rebuilt. + +For macOS users, you may encounter a failure reading or writing files. +This is caused by protection features in macOS (at least, in Catalina) +that prevent programs built on your local system (unsigned) from +running. To disable this feature: + +1) Make sure you exit System Preferences. +2) Open a terminal session and type the following. You will need to + authenticate with an admin account. sudo spctl --master-disable +3) Exit terminal +4) Go into System Preferences and choose Security and Privacy +5) Select the General tab if it isn't already selected +6) You should now see a third selection under + "Allow apps downloaded from:" of Anywhere - select this. +7) Now you can run the build successfully. + +DISCLAIMER: You do this at your own risk. I highly recommend that you +return the settings back to normal immediately after doing a build. + +Heavy use is made of make's include facility and pattern rules. The +master rule set is in Tools/Makefile.inc. Changes here will affect +almost every Makefile, and where exceptions are needed, the overrides +are applied in the lower Makefiles. + +These tools can run a windows-linux regression test, where all the +binaries are compared to a baseline windows build. + +Credit: + + uz80as was written by Jorge Giner Cordero, + jorge.giner@hotmail.com, and the original source can be found + at https://github.com/jorgicor/uz80as. + + The propeller tools use bstc and openspin, parallax tools from + http://www.fnarfbargle.com/bst.html + https://github.com/parallaxinc/OpenSpin Note that bst is not + open source or even currently maintained, so I could not + generate a version for 64 bit macOS. + + cpmtools were the most current I could find, and it has been + hacked to do case-insensitivity. These are not marked, and are + not extensive. + + zxcc is from the distributed version, and also has local hacks + for case insensitivity. + + Both zxcc and cpmtools ship with an overly complicated makefile + generation system and this is ignored. + + This whole Linux build framework is the work of Curt Mayer, + curt@zen-room.org. Use it for whatever you like; this is not + my day job. diff --git a/Tools/unix/bin2asm/Makefile b/Tools/unix/bin2asm/Makefile index 27af4088..85c956d0 100644 --- a/Tools/unix/bin2asm/Makefile +++ b/Tools/unix/bin2asm/Makefile @@ -8,7 +8,7 @@ SRC_FILES = $(wildcard *.c) OBJ_FILES = $(SRC_FILES:.c=.o) all: $(BINARY) $(DEST) - cp $(BINARY) $(DEST) + cp -p $(BINARY) $(DEST) $(DEST): mkdir -p $(DEST) @@ -16,10 +16,7 @@ $(DEST): .PHONY: clean clean: - rm -f $(OBJ_FILES) - -clobber: - rm -f $(DEST)/$(BINARY) $(BINARY) + rm -f $(OBJ_FILES) $(BINARY) $(BINARY): $(OBJ_FILES) $(CC) -o $@ $^ $(LIBS) diff --git a/Tools/unix/bst/Makefile b/Tools/unix/bst/Makefile index 0d269dea..f051f892 100644 --- a/Tools/unix/bst/Makefile +++ b/Tools/unix/bst/Makefile @@ -14,15 +14,10 @@ DEST = ../../$(UNAME) all: $(DEST) -for i in *.$(SUFFIX) ; do \ chmod +x $$i ; \ - cp $$i $(DEST)/$$(basename $$i .$(SUFFIX)) ; \ + cp -p $$i $(DEST)/$$(basename $$i .$(SUFFIX)) ; \ done $(DEST): mkdir $(DEST) -clobber: - -for i in *.$(SUFFIX) ; do \ - rm $(DEST)/$$(basename $$i .$(SUFFIX)) ; \ - done - clean: diff --git a/Tools/unix/cpmtools/Makefile b/Tools/unix/cpmtools/Makefile index d630b6f2..7cc055f8 100644 --- a/Tools/unix/cpmtools/Makefile +++ b/Tools/unix/cpmtools/Makefile @@ -23,7 +23,7 @@ DEVICEOBJ = device_posix.o OBJECTS = cpmls cpmrm cpmcp cpmchmod cpmchattr mkfs.cpm fsck.cpm fsed.cpm all: $(OBJECTS) $(DEST) - cp $(OBJECTS) $(DEST) + cp -p $(OBJECTS) $(DEST) cpmls: cpmls.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ) $(CC) $(LDFLAGS) -o $@ cpmls.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ) @@ -54,8 +54,3 @@ $(DEST): clean: -rm -f *.o $(OBJECTS) - -clobber: clean - -for i in $(OBJECTS) ; do \ - rm -f $(DEST)/$$i ; \ - done diff --git a/Tools/unix/cpmtools/mkfs.cpm.c b/Tools/unix/cpmtools/mkfs.cpm.c index 2c37bdfd..18530e3a 100644 --- a/Tools/unix/cpmtools/mkfs.cpm.c +++ b/Tools/unix/cpmtools/mkfs.cpm.c @@ -220,6 +220,7 @@ int main(int argc, char *argv[]) /*{{{*/ #if 0 fprintf(stderr,"%d %04x %s\n",c,used+0x800,boot[c]); #endif + memset(bootTracks+used+size, 0xe5, bootTrackSize-used-size); if (size%drive.secLength) size=(size|(drive.secLength-1))+1; used+=size; close(fd); diff --git a/Tools/unix/lzsa/BlockFormat_LZSA2.md b/Tools/unix/lzsa/BlockFormat_LZSA2.md index 15ec3781..2a9b6c3f 100644 --- a/Tools/unix/lzsa/BlockFormat_LZSA2.md +++ b/Tools/unix/lzsa/BlockFormat_LZSA2.md @@ -44,7 +44,7 @@ The match offset is decoded according to the XYZ bits in the token XYZ 00Z 5-bit offset: read a nibble for offset bits 1-4 and use the inverted bit Z of the token as bit 0 of the offset. set bits 5-15 of the offset to 1. 01Z 9-bit offset: read a byte for offset bits 0-7 and use the inverted bit Z for bit 8 of the offset. set bits 9-15 of the offset to 1. - 10Z 13-bit offset: read a nibble for offset bits 9-12 and use the inverted bit Z for bit 8 of the offset, then read a byte for offset bits 0-7. set bits 13-15 of the offset to 1. + 10Z 13-bit offset: read a nibble for offset bits 9-12 and use the inverted bit Z for bit 8 of the offset, then read a byte for offset bits 0-7. set bits 13-15 of the offset to 1. substract 512 from the offset to get the final value. 110 16-bit offset: read a byte for offset bits 8-15, then another byte for offset bits 0-7. 111 repeat offset: reuse the offset value of the previous match command. diff --git a/Tools/unix/lzsa/Makefile b/Tools/unix/lzsa/Makefile index 0e0e7b28..80884198 100644 --- a/Tools/unix/lzsa/Makefile +++ b/Tools/unix/lzsa/Makefile @@ -33,14 +33,11 @@ OBJS += $(OBJDIR)/src/libdivsufsort/lib/trsort.o UNAME := $(shell uname) all: $(APP) - cp $(APP) ../../$(UNAME) + cp -p $(APP) ../../$(UNAME) $(APP): $(OBJS) - @mkdir -p ../../bin/posix + #@mkdir -p ../../bin/posix $(CC) $^ $(LDFLAGS) -o $(APP) clean: @rm -rf $(APP) $(OBJDIR) - -clobber: - rm -f ../../$(UNAME)/$(APP) diff --git a/Tools/unix/lzsa/README.md b/Tools/unix/lzsa/README.md index 6430ee5c..4646c8fb 100644 --- a/Tools/unix/lzsa/README.md +++ b/Tools/unix/lzsa/README.md @@ -7,6 +7,16 @@ Check out [The Hollow](https://www.pouet.net/prod.php?which=81909) by Darklite a [Gabba](https://www.pouet.net/prod.php?which=83539) by Stardust ranked 2nd in the ZX Spectrum demo compo at CAFe demoparty 2019 and also used LZSA on Z80. +[Myst Demake](http://www.deater.net/weave/vmwprod/mist/) for the Apple II by Vince Weaver, uses LZSA on 6502. + +The 8 bit guy's [Commander X16 ROM](https://github.com/commanderx16/x16-rom) uses LZSA on 6502 as well. + +[RomWBW](https://github.com/wwarthen/RomWBW) uses LZSA on Z80 for a variety of hobbyist computers. + +The popular [rasm](https://github.com/EdouardBERGE/rasm) assembler for Z80 features LZSA-compressed data sections. + +The [desolate](https://github.com/nzeemin/spectrum-desolate) game port to the ZX Spectrum uses LZSA compression on Z80. + The LZSA compression tool uses an aggressive optimal packing strategy to try to find the sequence of commands that gives the smallest packed file that decompresses to the original while maintaining the maximum possible decompression speed. The compression formats give the user choices that range from decompressing faster than LZ4 on 8-bit systems with better compression, to compressing as well as ZX7 with much better decompression speed. LZSA1 is designed to replace LZ4 and LZSA2 to replace ZX7, in 8-bit scenarios. @@ -55,7 +65,7 @@ Inspirations: * [LZ5/Lizard](https://github.com/inikep/lizard) by Przemyslaw Skibinski and Yann Collet. * The suffix array intervals in [Wimlib](https://wimlib.net/git/?p=wimlib;a=tree) by Eric Biggers. * ZX7 by Einar Saukas -* [apc](https://github.com/svendahl/cap) by Sven-Åke Dahl +* [apc](https://github.com/svendahl/cap) by Sven-Ã…ke Dahl * [Charles Bloom](http://cbloomrants.blogspot.com/)'s compression blog License: @@ -65,14 +75,19 @@ License: 8-bit assembly code: -* Z80 decompressors (size- and speed-optimized) written by [introspec](https://github.com/specke) +* Z80 decompressors (size- and speed-optimized) written by [introspec](https://github.com/specke) with optimizations by [uniabis](https://github.com/uniabis) * 6502 and 8088 size-optimized improvements by [Peter Ferrie](https://github.com/peterferrie) +* 6502 speed-optimized decompressor by [John Brandwood](https://github.com/jbrandwood) * 8088 speed-optimized decompressor by [Jim Leonard](https://github.com/mobygamer) +* 6809 decompressors (Tandy CoCo, Thomson MO/TO, Dragon 32/64..) optimized by [Doug Masten](https://github.com/dougmasten) +* Hitachi 6309 decompressors (Tandy CoCo 3) also contributed by [Doug Masten](https://github.com/dougmasten) External links: * [i8080 decompressors](https://gitlab.com/ivagor/lzsa8080/tree/master) by Ivan Gorodetsky * [PDP-11 decompressors](https://gitlab.com/ivagor/lzsa8080/tree/master/PDP11) also by Ivan Gorodetsky +* [MC68000 decompressors](https://github.com/tattlemuss/lz4-m68k/blob/master/src/lzsa.s) by Steven Tattersall +* [Gameboy decompressors](https://github.com/meltycode) by Meltycode, based on the Z80 code by introspec * LZSA's page on [Pouet](https://www.pouet.net/prod.php?which=81573) # Compressed format diff --git a/Tools/unix/lzsa/StreamFormat.md b/Tools/unix/lzsa/StreamFormat.md index 3f37f868..8eebb7e3 100644 --- a/Tools/unix/lzsa/StreamFormat.md +++ b/Tools/unix/lzsa/StreamFormat.md @@ -17,7 +17,7 @@ The 3-bytes LZSA header contains a signature and a traits byte: Trait bits: -* V: 3 bit code that indicates which block data encoding is used. 0 is LZSA1 and 2 is LZSA2. +* V: 3 bit code that indicates which block data encoding is used. 0 is LZSA1 and 1 is LZSA2. * Z: these bits in the traits are set to 0 for LZSA1 and LZSA2. # Frame format diff --git a/Tools/unix/lzsa/asm/6502/decompress_fast_v1.asm b/Tools/unix/lzsa/asm/6502/decompress_fast_v1.asm index b36cc176..7aa651d4 100644 --- a/Tools/unix/lzsa/asm/6502/decompress_fast_v1.asm +++ b/Tools/unix/lzsa/asm/6502/decompress_fast_v1.asm @@ -68,7 +68,7 @@ LARGE_VARLEN_LITERALS ; handle 16 bits literals count JSR GETLARGESRC ; grab low 8 bits in X, high 8 bits in A TAY ; put high 8 bits in Y TXA - JMP PREPARE_COPY_LARGE_LITERALS + BCS PREPARE_COPY_LARGE_LITERALS ; (*like JMP PREPARE_COPY_LITERALS_DIRECT but shorter) PREPARE_COPY_LITERALS TAX diff --git a/Tools/unix/lzsa/asm/6502/decompress_fast_v2.asm b/Tools/unix/lzsa/asm/6502/decompress_fast_v2.asm index 681d42d9..1e49a75d 100644 --- a/Tools/unix/lzsa/asm/6502/decompress_fast_v2.asm +++ b/Tools/unix/lzsa/asm/6502/decompress_fast_v2.asm @@ -114,11 +114,9 @@ NO_LITERALS BNE GOT_OFFSET_LO ; go store low byte of match offset and prepare match OFFSET_9_BIT ; 01Z: 9 bit offset - ;;ASL ; shift Z (offset bit 8) in place - ROL - ROL - AND #$01 - EOR #$FF ; set offset bits 15-9 to 1 + ROL ; carry: Z bit; A: xxxxxxx1 (carry known set from BCS OFFSET_9_BIT) + ADC #$00 ; if Z bit is set, add 1 to A (bit 0 of A is now 0), otherwise bit 0 is 1 + ORA #$FE ; set offset bits 15-9 to 1. reversed Z is already in bit 0 BNE GOT_OFFSET_HI ; go store high byte, read low byte of match offset and prepare match ; (*same as JMP GOT_OFFSET_HI but shorter) @@ -134,7 +132,6 @@ REPMATCH_OR_LARGE_OFFSET ; (*same as JMP GOT_OFFSET_HI but shorter) REPMATCH_OR_16_BIT ; rep-match or 16 bit offset - ;;ASL ; XYZ=111? BMI REP_MATCH ; reuse previous offset if so (rep-match) ; 110: handle 16 bit offset @@ -259,7 +256,6 @@ GETCOMBINEDBITS JSR GETNIBBLE ; get nibble into bits 0-3 (for offset bits 1-4) PLP ; merge Z bit as the carry bit (for offset bit 0) -COMBINEDBITZ ROL ; nibble -> bits 1-4; carry(!Z bit) -> bit 0 ; carry cleared DECOMPRESSION_DONE RTS diff --git a/Tools/unix/lzsa/asm/6502/decompress_faster_v1.asm b/Tools/unix/lzsa/asm/6502/decompress_faster_v1.asm index 93619070..1f65a40c 100644 --- a/Tools/unix/lzsa/asm/6502/decompress_faster_v1.asm +++ b/Tools/unix/lzsa/asm/6502/decompress_faster_v1.asm @@ -29,15 +29,6 @@ ; Decompression Options & Macros ; - ; - ; Save 6 bytes of code and 21 cycles by swapping the order - ; of bytes in the 16-bit length encoding? - ; - ; N.B. Setting this breaks compatibility with LZSA v1.2 - ; - -LZSA_SWAP_LEN16 = 0 - ; ; Choose size over space (within sane limits)? ; @@ -80,14 +71,6 @@ LZSA_SHORT_LZ = 1 LZSA_SHORT_LZ = 0 } - ; - ; Assume that we're decompessing from a large multi-bank - ; compressed data file, and that the next bank may need to - ; paged in when a page-boundary is crossed. - ; - -LZSA_FROM_BANK = 0 - ; ; Macro to increment the source pointer to the next page. ; @@ -95,14 +78,8 @@ LZSA_FROM_BANK = 0 ; has been crossed, and a new bank should be paged in. ; - !if LZSA_FROM_BANK { - !macro LZSA_INC_PAGE { - jsr lzsa1_next_page - } - } else { - !macro LZSA_INC_PAGE { + !macro LZSA_INC_PAGE { inc bits 1-4; carry(!Z bit) -> bit 0 ; carry cleared DECOMPRESSION_DONE RTS diff --git a/Tools/unix/lzsa/asm/65816/decompress_v1.asm b/Tools/unix/lzsa/asm/65816/decompress_v1.asm new file mode 100644 index 00000000..4754e553 --- /dev/null +++ b/Tools/unix/lzsa/asm/65816/decompress_v1.asm @@ -0,0 +1,281 @@ +; ----------------------------------------------------------------------------- +; Decompress raw LZSA1 block. Create one with lzsa -r +; +; in: +; * LZSA_SRC_LO/LZSA_SRC_HI/LZSA_SRC_BANK contain the compressed raw block address +; * LZSA_DST_LO/LZSA_DST_HI/LZSA_DST_BANK contain the destination buffer address +; +; out: +; * LZSA_DST_LO/LZSA_DST_HI/LZSA_DST_BANK contain the last decompressed byte address, +1 +; +; ----------------------------------------------------------------------------- +; Backward decompression is also supported, use lzsa -r -b +; To use it, also define BACKWARD_DECOMPRESS=1 before including this code! +; +; in: +; * LZSA_SRC_LO/LZSA_SRC_HI/LZSA_SRC_BANK must contain the address of the last byte of compressed data +; * LZSA_DST_LO/LZSA_DST_HI/LZSA_DST_BANK must contain the address of the last byte of the destination buffer +; +; out: +; * LZSA_DST_LO/LZSA_DST_HI/BANK contain the last decompressed byte address, -1 +; +; ----------------------------------------------------------------------------- +; +; Copyright (C) 2019-2020 Emmanuel Marty, Peter Ferrie +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. +; ----------------------------------------------------------------------------- + +!cpu 65816 +DECOMPRESS_LZSA1 + SEP #$30 +!as +!rs + LDY #$00 + +DECODE_TOKEN + JSR GETSRC ; read token byte: O|LLL|MMMM + PHA ; preserve token on stack + + AND #$70 ; isolate literals count + BEQ NO_LITERALS ; skip if no literals to copy + CMP #$70 ; LITERALS_RUN_LEN? + BNE PREPARE_COPY_LITERALS ; if not, count is directly embedded in token + + JSR GETSRC ; get extra byte of variable literals count + ; the carry is always set by the CMP above + ; GETSRC doesn't change it + SBC #$F9 ; (LITERALS_RUN_LEN) + BCC PREPARE_COPY_LITERALS_DIRECT + BEQ LARGE_VARLEN_LITERALS ; if adding up to zero, go grab 16-bit count + + JSR GETSRC ; get single extended byte of variable literals count + INY ; add 256 to literals count + BCS PREPARE_COPY_LITERALS_DIRECT ; (*like JMP PREPARE_COPY_LITERALS_DIRECT but shorter) + +LARGE_VARLEN_LITERALS ; handle 16 bits literals count + ; literals count = directly these 16 bits + JSR GETLARGESRC ; grab low 8 bits in X, high 8 bits in A + TAY ; put high 8 bits in Y + TXA + BCS PREPARE_COPY_LARGE_LITERALS ; (*like JMP PREPARE_COPY_LITERALS_DIRECT but shorter) + +PREPARE_COPY_LITERALS + TAX + LDA SHIFT_TABLE-1,X ; shift literals length into place + ; -1 because position 00 is reserved +PREPARE_COPY_LITERALS_DIRECT + TAX + +PREPARE_COPY_LARGE_LITERALS + BEQ COPY_LITERALS + INY + +COPY_LITERALS + JSR GETPUT ; copy one byte of literals + DEX + BNE COPY_LITERALS + DEY + BNE COPY_LITERALS + +NO_LITERALS + PLA ; retrieve token from stack + PHA ; preserve token again + BMI GET_LONG_OFFSET ; $80: 16 bit offset + + JSR GETSRC ; get 8 bit offset from stream in A + TAX ; save for later + LDA #$FF ; high 8 bits + BNE GOT_OFFSET ; go prepare match + ; (*like JMP GOT_OFFSET but shorter) + +SHORT_VARLEN_MATCHLEN + JSR GETSRC ; get single extended byte of variable match len + INY ; add 256 to match length + +PREPARE_COPY_MATCH + TAX +PREPARE_COPY_MATCH_Y + TXA + BEQ COPY_MATCH_LOOP + INY + +COPY_MATCH_LOOP + LDA $AAAAAA ; get one byte of backreference + JSR PUTDST ; copy to destination + + REP #$20 +!ifdef BACKWARD_DECOMPRESS { + + ; Backward decompression -- put backreference bytes backward + + DEC COPY_MATCH_LOOP+1 + +} else { + + ; Forward decompression -- put backreference bytes forward + + INC COPY_MATCH_LOOP+1 + +} + SEP #$20 + + DEX + BNE COPY_MATCH_LOOP + DEY + BNE COPY_MATCH_LOOP + BEQ DECODE_TOKEN ; (*like JMP DECODE_TOKEN but shorter) + +GET_LONG_OFFSET ; handle 16 bit offset: + JSR GETLARGESRC ; grab low 8 bits in X, high 8 bits in A + +GOT_OFFSET + +!ifdef BACKWARD_DECOMPRESS { + + ; Backward decompression - substract match offset + + STA OFFSHI ; store high 8 bits of offset + STX OFFSLO + + SEC ; substract dest - match offset + REP #$20 +!al + LDA PUTDST+1 +OFFSLO = *+1 +OFFSHI = *+2 + SBC #$AAAA ; 16 bits + STA COPY_MATCH_LOOP+1 ; store back reference address + SEP #$20 +!as + SEC + +} else { + + ; Forward decompression - add match offset + + STA OFFSHI ; store high 8 bits of offset + TXA + + CLC ; add dest + match offset + ADC PUTDST+1 ; low 8 bits + STA COPY_MATCH_LOOP+1 ; store back reference address +OFFSHI = *+1 + LDA #$AA ; high 8 bits + + ADC PUTDST+2 + STA COPY_MATCH_LOOP+2 ; store high 8 bits of address + +} + + LDA PUTDST+3 ; bank + STA COPY_MATCH_LOOP+3 ; store back reference address + + PLA ; retrieve token from stack again + AND #$0F ; isolate match len (MMMM) + ADC #$02 ; plus carry which is always set by the high ADC + CMP #$12 ; MATCH_RUN_LEN? + BCC PREPARE_COPY_MATCH ; if not, count is directly embedded in token + + JSR GETSRC ; get extra byte of variable match length + ; the carry is always set by the CMP above + ; GETSRC doesn't change it + SBC #$EE ; add MATCH_RUN_LEN and MIN_MATCH_SIZE to match length + BCC PREPARE_COPY_MATCH + BNE SHORT_VARLEN_MATCHLEN + + ; Handle 16 bits match length + JSR GETLARGESRC ; grab low 8 bits in X, high 8 bits in A + TAY ; put high 8 bits in Y + ; large match length with zero high byte? + BNE PREPARE_COPY_MATCH_Y ; if not, continue + +DECOMPRESSION_DONE + RTS + +SHIFT_TABLE + !BYTE $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + !BYTE $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01 + !BYTE $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02 + !BYTE $03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03 + !BYTE $04,$04,$04,$04,$04,$04,$04,$04,$04,$04,$04,$04,$04,$04,$04,$04 + !BYTE $05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05,$05 + !BYTE $06,$06,$06,$06,$06,$06,$06,$06,$06,$06,$06,$06,$06,$06,$06,$06 + !BYTE $07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07 + +!ifdef BACKWARD_DECOMPRESS { + + ; Backward decompression -- get and put bytes backward + +GETPUT + JSR GETSRC +PUTDST +LZSA_DST_LO = *+1 +LZSA_DST_HI = *+2 +LZSA_DST_BANK = *+3 + STA $AAAAAA + REP #$20 + DEC PUTDST+1 + SEP #$20 + RTS + +GETLARGESRC + JSR GETSRC ; grab low 8 bits + TAX ; move to X + ; fall through grab high 8 bits + +GETSRC +LZSA_SRC_LO = *+1 +LZSA_SRC_HI = *+2 +LZSA_SRC_BANK = *+3 + LDA $AAAAAA + REP #$20 + DEC GETSRC+1 + SEP #$20 + RTS + +} else { + + ; Forward decompression -- get and put bytes forward + +GETPUT + JSR GETSRC +PUTDST +LZSA_DST_LO = *+1 +LZSA_DST_HI = *+2 +LZSA_DST_BANK = *+3 + STA $AAAAAA + REP #$20 + INC PUTDST+1 + SEP #$20 + RTS + +GETLARGESRC + JSR GETSRC ; grab low 8 bits + TAX ; move to X + ; fall through grab high 8 bits + +GETSRC +LZSA_SRC_LO = *+1 +LZSA_SRC_HI = *+2 +LZSA_SRC_BANK = *+3 + LDA $AAAAAA + REP #$20 + INC GETSRC+1 + SEP #$20 + RTS +} diff --git a/Tools/unix/lzsa/asm/65816/decompress_v2.asm b/Tools/unix/lzsa/asm/65816/decompress_v2.asm new file mode 100644 index 00000000..08c2ac8f --- /dev/null +++ b/Tools/unix/lzsa/asm/65816/decompress_v2.asm @@ -0,0 +1,338 @@ +; ----------------------------------------------------------------------------- +; Decompress raw LZSA2 block. +; Create one with lzsa -r -f2 +; +; in: +; * LZSA_SRC_LO/LZSA_SRC_HI/LZSA_SRC_BANK contain the compressed raw block address +; * LZSA_DST_LO/LZSA_DST_HI/LZSA_DST_BANK contain the destination buffer address +; +; out: +; * LZSA_DST_LO/LZSA_DST_HI/LZSA_DST_BANK contain the last decompressed byte address, +1 +; +; ----------------------------------------------------------------------------- +; Backward decompression is also supported, use lzsa -r -b -f2 +; To use it, also define BACKWARD_DECOMPRESS=1 before including this code! +; +; in: +; * LZSA_SRC_LO/LZSA_SRC_HI/LZSA_SRC_BANK must contain the address of the last byte of compressed data +; * LZSA_DST_LO/LZSA_DST_HI/LZSA_DST_BANK must contain the address of the last byte of the destination buffer +; +; out: +; * LZSA_DST_LO/LZSA_DST_HI/BANK contain the last decompressed byte address, -1 +; +; ----------------------------------------------------------------------------- +; +; Copyright (C) 2019-2020 Emmanuel Marty, Peter Ferrie +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. +; ----------------------------------------------------------------------------- + +!cpu 65816 +NIBCOUNT = $FC ; zero-page location for temp offset + +DECOMPRESS_LZSA2 + SEP #$30 +!as +!rs + LDY #$00 + STY NIBCOUNT + +DECODE_TOKEN + JSR GETSRC ; read token byte: XYZ|LL|MMM + PHA ; preserve token on stack + + AND #$18 ; isolate literals count (LL) + BEQ NO_LITERALS ; skip if no literals to copy + CMP #$18 ; LITERALS_RUN_LEN_V2? + BCC PREPARE_COPY_LITERALS ; if less, count is directly embedded in token + + JSR GETNIBBLE ; get extra literals length nibble + ; add nibble to len from token + ADC #$02 ; (LITERALS_RUN_LEN_V2) minus carry + CMP #$12 ; LITERALS_RUN_LEN_V2 + 15 ? + BCC PREPARE_COPY_LITERALS_DIRECT ; if less, literals count is complete + + JSR GETSRC ; get extra byte of variable literals count + ; the carry is always set by the CMP above + ; GETSRC doesn't change it + SBC #$EE ; overflow? + BRA PREPARE_COPY_LITERALS_DIRECT + +PREPARE_COPY_LITERALS_LARGE + ; handle 16 bits literals count + ; literals count = directly these 16 bits + JSR GETLARGESRC ; grab low 8 bits in X, high 8 bits in A + TAY ; put high 8 bits in Y + BCS PREPARE_COPY_LITERALS_HIGH ; (*same as JMP PREPARE_COPY_LITERALS_HIGH but shorter) + +PREPARE_COPY_LITERALS + LSR ; shift literals count into place + LSR + LSR + +PREPARE_COPY_LITERALS_DIRECT + TAX + BCS PREPARE_COPY_LITERALS_LARGE ; if so, literals count is large + +PREPARE_COPY_LITERALS_HIGH + TXA + BEQ COPY_LITERALS + INY + +COPY_LITERALS + JSR GETPUT ; copy one byte of literals + DEX + BNE COPY_LITERALS + DEY + BNE COPY_LITERALS + +NO_LITERALS + PLA ; retrieve token from stack + PHA ; preserve token again + ASL + BCS REPMATCH_OR_LARGE_OFFSET ; 1YZ: rep-match or 13/16 bit offset + + ASL ; 0YZ: 5 or 9 bit offset + BCS OFFSET_9_BIT + + ; 00Z: 5 bit offset + + LDX #$FF ; set offset bits 15-8 to 1 + + JSR GETCOMBINEDBITS ; rotate Z bit into bit 0, read nibble for bits 4-1 + ORA #$E0 ; set bits 7-5 to 1 + BNE GOT_OFFSET_LO ; go store low byte of match offset and prepare match + +OFFSET_9_BIT ; 01Z: 9 bit offset + ;;ASL ; shift Z (offset bit 8) in place + ROL + ROL + AND #$01 + EOR #$FF ; set offset bits 15-9 to 1 + BNE GOT_OFFSET_HI ; go store high byte, read low byte of match offset and prepare match + ; (*same as JMP GOT_OFFSET_HI but shorter) + +REPMATCH_OR_LARGE_OFFSET + ASL ; 13 bit offset? + BCS REPMATCH_OR_16_BIT ; handle rep-match or 16-bit offset if not + + ; 10Z: 13 bit offset + + JSR GETCOMBINEDBITS ; rotate Z bit into bit 8, read nibble for bits 12-9 + ADC #$DE ; set bits 15-13 to 1 and substract 2 (to substract 512) + BNE GOT_OFFSET_HI ; go store high byte, read low byte of match offset and prepare match + ; (*same as JMP GOT_OFFSET_HI but shorter) + +REPMATCH_OR_16_BIT ; rep-match or 16 bit offset + ;;ASL ; XYZ=111? + BMI REP_MATCH ; reuse previous offset if so (rep-match) + + ; 110: handle 16 bit offset + JSR GETSRC ; grab high 8 bits +GOT_OFFSET_HI + TAX + JSR GETSRC ; grab low 8 bits +GOT_OFFSET_LO + STA OFFSLO ; store low byte of match offset + STX OFFSHI ; store high byte of match offset + +REP_MATCH +!ifdef BACKWARD_DECOMPRESS { + + ; Backward decompression - substract match offset + + SEC ; add dest + match offset + REP #$20 +!al + LDA PUTDST+1 ; 16 bits +OFFSLO = *+1 +OFFSHI = *+2 + SBC #$AAAA + STA COPY_MATCH_LOOP+1 ; store back reference address + SEP #$20 +!as + SEC + +} else { + + ; Forward decompression - add match offset + + CLC ; add dest + match offset + REP #$20 +!al + LDA PUTDST+1 ; 16 bits +OFFSLO = *+1 +OFFSHI = *+2 + ADC #$AAAA + STA COPY_MATCH_LOOP+1 ; store back reference address + SEP #$20 +!as +} + + LDA PUTDST+3 ; bank + STA COPY_MATCH_LOOP+3 ; store back reference address + + PLA ; retrieve token from stack again + AND #$07 ; isolate match len (MMM) + ADC #$01 ; add MIN_MATCH_SIZE_V2 and carry + CMP #$09 ; MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2? + BCC PREPARE_COPY_MATCH ; if less, length is directly embedded in token + + JSR GETNIBBLE ; get extra match length nibble + ; add nibble to len from token + ADC #$08 ; (MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2) minus carry + CMP #$18 ; MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2 + 15? + BCC PREPARE_COPY_MATCH ; if less, match length is complete + + JSR GETSRC ; get extra byte of variable match length + ; the carry is always set by the CMP above + ; GETSRC doesn't change it + SBC #$E8 ; overflow? + +PREPARE_COPY_MATCH + TAX + BCC PREPARE_COPY_MATCH_Y ; if not, the match length is complete + BEQ DECOMPRESSION_DONE ; if EOD code, bail + + ; Handle 16 bits match length + JSR GETLARGESRC ; grab low 8 bits in X, high 8 bits in A + TAY ; put high 8 bits in Y + +PREPARE_COPY_MATCH_Y + TXA + BEQ COPY_MATCH_LOOP + INY + +COPY_MATCH_LOOP + LDA $AAAAAA ; get one byte of backreference + JSR PUTDST ; copy to destination + + REP #$20 +!ifdef BACKWARD_DECOMPRESS { + + ; Backward decompression -- put backreference bytes backward + + DEC COPY_MATCH_LOOP+1 + +} else { + + ; Forward decompression -- put backreference bytes forward + + INC COPY_MATCH_LOOP+1 + +} + SEP #$20 + + DEX + BNE COPY_MATCH_LOOP + DEY + BNE COPY_MATCH_LOOP + JMP DECODE_TOKEN + +GETCOMBINEDBITS + EOR #$80 + ASL + PHP + + JSR GETNIBBLE ; get nibble into bits 0-3 (for offset bits 1-4) + PLP ; merge Z bit as the carry bit (for offset bit 0) +COMBINEDBITZ + ROL ; nibble -> bits 1-4; carry(!Z bit) -> bit 0 ; carry cleared +DECOMPRESSION_DONE + RTS + +GETNIBBLE +NIBBLES = *+1 + LDA #$AA + LSR NIBCOUNT + BCC NEED_NIBBLES + AND #$0F ; isolate low 4 bits of nibble + RTS + +NEED_NIBBLES + INC NIBCOUNT + JSR GETSRC ; get 2 nibbles + STA NIBBLES + LSR + LSR + LSR + LSR + SEC + RTS + +!ifdef BACKWARD_DECOMPRESS { + + ; Backward decompression -- get and put bytes backward + +GETPUT + JSR GETSRC +PUTDST +LZSA_DST_LO = *+1 +LZSA_DST_HI = *+2 +LZSA_DST_BANK = *+3 + STA $AAAAAA + REP #$20 + DEC PUTDST+1 + SEP #$20 + RTS + +GETLARGESRC + JSR GETSRC ; grab low 8 bits + TAX ; move to X + ; fall through grab high 8 bits + +GETSRC +LZSA_SRC_LO = *+1 +LZSA_SRC_HI = *+2 +LZSA_SRC_BANK = *+3 + LDA $AAAAAA + REP #$20 + DEC GETSRC+1 + SEP #$20 + RTS + +} else { + + ; Forward decompression -- get and put bytes forward + +GETPUT + JSR GETSRC +PUTDST +LZSA_DST_LO = *+1 +LZSA_DST_HI = *+2 +LZSA_DST_BANK = *+3 + STA $AAAAAA + REP #$20 + INC PUTDST+1 + SEP #$20 + RTS + +GETLARGESRC + JSR GETSRC ; grab low 8 bits + TAX ; move to X + ; fall through grab high 8 bits + +GETSRC +LZSA_SRC_LO = *+1 +LZSA_SRC_HI = *+2 +LZSA_SRC_BANK = *+3 + LDA $AAAAAA + REP #$20 + INC GETSRC+1 + SEP #$20 + RTS +} diff --git a/Tools/unix/lzsa/asm/6809/unlzsa1-6309.s b/Tools/unix/lzsa/asm/6809/unlzsa1-6309.s new file mode 100644 index 00000000..5866e8db --- /dev/null +++ b/Tools/unix/lzsa/asm/6809/unlzsa1-6309.s @@ -0,0 +1,90 @@ +; unlzsa1-6309.s - Hitachi 6309 decompression routine for raw LZSA1 - 92 bytes +; compress with lzsa -f1 -r +; +; in: x = start of compressed data +; y = start of decompression buffer +; out: y = end of decompression buffer + 1 +; +; Copyright (C) 2020 Emmanuel Marty, Doug Masten +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. + +decompress_lzsa1 equ lz1token + +lz1bigof lda ,x+ ; O set: load MSB 16-bit (negative, signed) offest +lz1gotof leau d,y ; put backreference start address in U (dst+offset) + + ldd #$000f ; clear MSB match length and set mask for MMMM + andb ,s+ ; isolate MMMM (embedded match length) in token + addb #$03 ; add MIN_MATCH_SIZE + cmpb #$12 ; MATCH_RUN_LEN? + bne lz1gotln ; no, we have the full match length, go copy + + addb ,x+ ; add extra match length byte + MIN_MATCH_SIZE + MATCH_RUN_LEN + bcc lz1gotln ; if no overflow, we have the full length + bne lz1midln + + ldb ,x+ ; load 16-bit len in D (low part in B, high in A) + lda ,x+ ; (little endian) + bne lz1gotln ; check if we hit EOD (16-bit length = 0) + tstb + bne lz1gotln ; go copy matched bytes if not + + rts ; done, bail + +lz1midln tfr b,a ; copy high part of len into A + ldb ,x+ ; grab low 8 bits of len in B + +lz1gotln tfr d,w ; set W with match length for TFM instruction + tfm u+,y+ ; copy match bytes + +lz1token ldb ,x+ ; load next token into B: O|LLL|MMMM + pshs b ; save it + + andb #$70 ; isolate LLL (embedded literals count) in B + beq lz1nolt ; skip if no literals + cmpb #$70 ; LITERALS_RUN_LEN? + bne lz1declt ; if not, we have the complete count, go unshift + + ldb ,x+ ; load extra literals count byte + addb #$07 ; add LITERALS_RUN_LEN + bcc lz1gotla ; if no overflow, we got the complete count, copy + bne lz1midlt + + ldb ,x+ ; load low 8 bits of little-endian literals count + lda ,x+ ; load high 8 bits of literal count + bra lz1gotlt ; we now have the complete count, go copy + +lz1midlt tfr b,a ; copy high part of literals count into A + ldb ,x+ ; load low 8 bits of literals count + bra lz1gotlt ; we now have the complete count, go copy + +lz1declt lsrb ; shift literals count into place + lsrb + lsrb + lsrb + +lz1gotla clra ; clear A (high part of literals count) +lz1gotlt tfr d,w ; set W with literals count for TFM instruction + tfm x+,y+ ; copy literal bytes + +lz1nolt ldb ,x+ ; load either 8-bit or LSB 16-bit offset (negative, signed) + lda ,s ; get token again, don't pop it from the stack + bmi lz1bigof ; test O bit (small or large offset) + + lda #$ff ; set high 8 bits + bra lz1gotof diff --git a/Tools/unix/lzsa/asm/6809/unlzsa1.s b/Tools/unix/lzsa/asm/6809/unlzsa1.s new file mode 100644 index 00000000..559a3032 --- /dev/null +++ b/Tools/unix/lzsa/asm/6809/unlzsa1.s @@ -0,0 +1,102 @@ +; unlzsa1.s - 6809 decompression routine for raw LZSA1 - 110 bytes +; compress with lzsa -r +; +; in: x = start of compressed data +; y = start of decompression buffer +; out: y = end of decompression buffer + 1 +; +; Copyright (C) 2020 Emmanuel Marty +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. + +decompress_lzsa1 equ lz1token + +lz1bigof lda ,x+ ; O set: load MSB 16-bit (negative, signed) offest +lz1gotof leau d,y ; put backreference start address in U (dst+offset) + + ldd #$000f ; clear MSB match length and set mask for MMMM + andb ,s+ ; isolate MMMM (embedded match length) in token + addb #$03 ; add MIN_MATCH_SIZE + cmpb #$12 ; MATCH_RUN_LEN? + bne lz1gotln ; no, we have the full match length, go copy + + addb ,x+ ; add extra match length byte + MIN_MATCH_SIZE + MATCH_RUN_LEN + bcc lz1gotln ; if no overflow, we have the full length + bne lz1midln + + ldb ,x+ ; load 16-bit len in D (low part in B, high in A) + lda ,x+ ; (little endian) + bne lz1gotln ; check if we hit EOD (16-bit length = 0) + tstb + bne lz1gotln ; go copy matched bytes if not + + rts ; done, bail + +lz1midln tfr b,a ; copy high part of len into A + ldb ,x+ ; grab low 8 bits of len in B + +lz1gotln pshs x ; save source compressed data pointer + tfr d,x ; copy match length to X + +lz1cpymt lda ,u+ ; copy matched byte + sta ,y+ + leax -1,x ; decrement X + bne lz1cpymt ; loop until all matched bytes are copied + + puls x ; restore source compressed data pointer + +lz1token ldb ,x+ ; load next token into B: O|LLL|MMMM + pshs b ; save it + + andb #$70 ; isolate LLL (embedded literals count) in B + beq lz1nolt ; skip if no literals + cmpb #$70 ; LITERALS_RUN_LEN? + bne lz1declt ; if not, we have the complete count, go unshift + + ldb ,x+ ; load extra literals count byte + addb #$07 ; add LITERALS_RUN_LEN + bcc lz1gotla ; if no overflow, we got the complete count, copy + bne lz1midlt + + ldb ,x+ ; load low 8 bits of little-endian literals count + lda ,x+ ; load high 8 bits of literal count + bra lz1gotlt ; we now have the complete count, go copy + +lz1midlt tfr b,a ; copy high part of literals count into A + ldb ,x+ ; load low 8 bits of literals count + bra lz1gotlt ; we now have the complete count, go copy + +lz1declt lsrb ; shift literals count into place + lsrb + lsrb + lsrb +lz1gotla clra ; clear A (high part of literals count) + +lz1gotlt leau ,x + tfr d,x ; transfer 16-bit count into X +lz1cpylt lda ,u+ ; copy literal byte + sta ,y+ + leax -1,x ; decrement X and update Z flag + bne lz1cpylt ; loop until all literal bytes are copied + leax ,u + +lz1nolt ldb ,x+ ; load either 8-bit or LSB 16-bit offset (negative, signed) + lda ,s ; get token again, don't pop it from the stack + bmi lz1bigof ; test O bit (small or large offset) + + lda #$ff ; set high 8 bits + bra lz1gotof diff --git a/Tools/unix/lzsa/asm/6809/unlzsa1b-6309.s b/Tools/unix/lzsa/asm/6809/unlzsa1b-6309.s new file mode 100644 index 00000000..60780856 --- /dev/null +++ b/Tools/unix/lzsa/asm/6809/unlzsa1b-6309.s @@ -0,0 +1,92 @@ +; unlzsa1-6309.s - H6309 backward decompressor for raw LZSA1 - 97 bytes +; compress with lzsa -f1 -r -b +; +; in: x = last byte of compressed data +; y = last byte of decompression buffer +; out: y = first byte of decompressed data +; +; Copyright (C) 2020 Emmanuel Marty, Doug Masten +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. + +decompress_lzsa1 + leax 1,x + bra lz1token + +lz1bigof ldd ,--x ; O set: load long 16-bit (negative, signed) offest +lz1gotof negd ; reverse sign of offset in D + leau d,y ; put backreference start address in U (dst+offset) + + ldd #$000f ; clear MSB match length and set mask for MMMM + andb ,s+ ; isolate MMMM (embedded match length) in token + addb #$03 ; add MIN_MATCH_SIZE + cmpb #$12 ; MATCH_RUN_LEN? + bne lz1gotln ; no, we have the full match length, go copy + + addb ,-x ; add extra match length byte + MIN_MATCH_SIZE + MATCH_RUN_LEN + bcc lz1gotln ; if no overflow, we have the full length + bne lz1midln + + ldd ,--x ; load 16-bit len in D (low part in B, high in A) + bne lz1gotln ; check if we hit EOD (16-bit length = 0) + + leay 1,y ; adjust pointer to first byte of decompressed data + rts ; done, bail + +lz1midln tfr b,a ; copy high part of len into A + ldb ,-x ; grab low 8 bits of len in B + +lz1gotln tfr d,w ; set W with match length for TFM instruction + tfm u-,y- ; copy match bytes + +lz1token ldb ,-x ; load next token into B: O|LLL|MMMM + pshs b ; save it + + andb #$70 ; isolate LLL (embedded literals count) in B + beq lz1nolt ; skip if no literals + cmpb #$70 ; LITERALS_RUN_LEN? + bne lz1declt ; if not, we have the complete count, go unshift + + ldb ,-x ; load extra literals count byte + addb #$07 ; add LITERALS_RUN_LEN + bcc lz1gotla ; if no overflow, we got the complete count, copy + bne lz1midlt + + ldd ,--x ; load 16 bit count in D (low part in B, high in A) + bra lz1gotlt ; we now have the complete count, go copy + +lz1midlt tfr b,a ; copy high part of literals count into A + ldb ,-x ; load low 8 bits of literals count + bra lz1gotlt ; we now have the complete count, go copy + +lz1declt lsrb ; shift literals count into place + lsrb + lsrb + lsrb + +lz1gotla clra ; clear A (high part of literals count) +lz1gotlt tfr d,w ; set W with literals count for TFM instruction + leax -1,x ; tfm is post-decrement + tfm x-,y- ; copy literal bytes + leax 1,x + +lz1nolt ldb ,s ; get token again, don't pop it from the stack + bmi lz1bigof ; test O bit (small or large offset) + + ldb ,-x ; load either 8-bit or LSB 16-bit offset (negative, signed) + lda #$ff ; set high 8 bits + bra lz1gotof diff --git a/Tools/unix/lzsa/asm/6809/unlzsa1b.s b/Tools/unix/lzsa/asm/6809/unlzsa1b.s new file mode 100644 index 00000000..ada6dcc9 --- /dev/null +++ b/Tools/unix/lzsa/asm/6809/unlzsa1b.s @@ -0,0 +1,105 @@ +; unlzsa1b.s - 6809 backward decompression routine for raw LZSA1 - 113 bytes +; compress with lzsa -r -b +; +; in: x = last byte of compressed data +; y = last byte of decompression buffer +; out: y = first byte of decompressed data +; +; Copyright (C) 2020 Emmanuel Marty +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. + +decompress_lzsa1 + leax 1,x + leay 1,y + bra lz1token + +lz1bigof ldd ,--x ; O set: load long 16 bit (negative, signed) offset +lz1gotof nega ; reverse sign of offset in D + negb + sbca #0 + leau d,y ; put backreference start address in U (dst+offset) + + ldd #$000f ; clear MSB match length and set mask for MMMM + andb ,s+ ; isolate MMMM (embedded match length) in token + + addb #$03 ; add MIN_MATCH_SIZE + cmpb #$12 ; MATCH_RUN_LEN? + bne lz1gotln ; no, we have the full match length, go copy + + addb ,-x ; add extra match length byte + MIN_MATCH_SIZE + MATCH_RUN_LEN + bcc lz1gotln ; if no overflow, we have the full length + bne lz1midln + + ldd ,--x ; load 16-bit len in D (low part in B, high in A) + bne lz1gotln ; check if we hit EOD (16-bit length = 0) + + rts ; done, bail + +lz1midln tfr b,a ; copy high part of len into A + ldb ,-x ; grab low 8 bits of len in B + +lz1gotln pshs x ; save source compressed data pointer + tfr d,x ; copy match length to X + +lz1cpymt lda ,-u ; copy matched byte + sta ,-y + leax -1,x ; decrement X + bne lz1cpymt ; loop until all matched bytes are copied + + puls x ; restore source compressed data pointer + +lz1token ldb ,-x ; load next token into B: O|LLL|MMMM + pshs b ; save it + + andb #$70 ; isolate LLL (embedded literals count) in B + beq lz1nolt ; skip if no literals + cmpb #$70 ; LITERALS_RUN_LEN? + bne lz1declt ; if not, we have the complete count, go unshift + + ldb ,-x ; load extra literals count byte + addb #$07 ; add LITERALS_RUN_LEN + bcc lz1gotla ; if no overflow, we got the complete count, copy + bne lz1midlt + + ldd ,--x ; load 16 bit count in D (low part in B, high in A) + bra lz1gotlt ; we now have the complete count, go copy + +lz1midlt tfr b,a ; copy high part of literals count into A + ldb ,-x ; load low 8 bits of literals count + bra lz1gotlt ; we now have the complete count, go copy + +lz1declt lsrb ; shift literals count into place + lsrb + lsrb + lsrb + +lz1gotla clra ; clear A (high part of literals count) +lz1gotlt leau ,x + tfr d,x ; transfer 16-bit count into X +lz1cpylt lda ,-u ; copy literal byte + sta ,-y + leax -1,x ; decrement X and update Z flag + bne lz1cpylt ; loop until all literal bytes are copied + leax ,u + +lz1nolt ldb ,s ; get token again, don't pop it from the stack + bmi lz1bigof ; test O bit (small or large offset) + + ldb ,-x ; O clear: load 8 bit (negative, signed) offset + lda #$ff ; set high 8 bits + bra lz1gotof diff --git a/Tools/unix/lzsa/asm/6809/unlzsa2-6309.s b/Tools/unix/lzsa/asm/6809/unlzsa2-6309.s new file mode 100644 index 00000000..17970d8b --- /dev/null +++ b/Tools/unix/lzsa/asm/6809/unlzsa2-6309.s @@ -0,0 +1,129 @@ +; unlzsa2-6309.s - Hitachi 6309 decompression routine for raw LZSA2 - 150 bytes +; compress with lzsa -f2 -r +; +; in: x = start of compressed data +; y = start of decompression buffer +; out: y = end of decompression buffer + 1 +; +; Copyright (C) 2020 Emmanuel Marty, Doug Masten +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. + +decompress_lzsa2 + clr lz2nibct ; reset nibble available flag + bra lz2token + +lz2nibct fcb 0 ; nibble ready flag + +lz2replg lslb ; push token's Y flag bit into carry + bcs lz2rep16 ; if token's Y bit is set, rep or 16 bit offset + + sex ; push token's Z flag bit into reg A + bsr lz2nibl ; get offset nibble in B + lsla ; push token's Z flag bit into carry + rolb ; shift Z flag from carry into bit 0 of B + eorb #$e1 ; set bits 13-15 of offset, reverse bit 8 + tfr b,a ; copy bits 8-15 of offset into A + suba #$02 ; substract 512 from offset + ldb ,x+ ; load low 8 bits of (negative, signed) offset + bra lz2gotof + +lz2rep16 bmi lz2repof ; if token's Z flag bit is set, rep match + ldd ,x++ ; load high then low 8 bits of offset + +lz2gotof std lz2moff+2 ; store match offset + +lz2repof ldd #$0007 ; clear MSB match length and set mask for MMM + andb ,u ; isolate MMM (embedded match length) in token +lz2moff leau $aaaa,y ; put backreference start address in U (dst+offset) + addb #$02 ; add MIN_MATCH_SIZE_V2 + cmpb #$09 ; MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2? + bne lz2gotln ; no, we have the full match length, go copy + + bsr lz2nibl ; get offset nibble in B + addb #$09 ; add MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2 + cmpb #$18 ; MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2 + 15? + bne lz2gotln ; if not, we have the full match length, go copy + + addb ,x+ ; add extra length byte + MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2 + 15 + bcc lz2gotln ; if no overflow, we have the full length + beq lz2done ; detect EOD code + + ldb ,x+ ; load 16-bit len in D (low part in B, high in A) + lda ,x+ ; (little endian) + +lz2gotln tfr d,w ; set W with match count for TFM instruction + tfm u+,y+ ; copy match bytes + +lz2token tfr x,u ; save token address + ldb ,x+ ; load next token into B: XYZ|LL|MMM + andb #$18 ; isolate LL (embedded literals count) in B + beq lz2nolt ; skip if no literals + cmpb #$18 ; LITERALS_RUN_LEN_V2? + bne lz2declt ; if not, we have the complete count, go unshift + + bsr lz2nibl ; get extra literals length nibble in B + addb #$03 ; add LITERALS_RUN_LEN_V2 + cmpb #$12 ; LITERALS_RUN_LEN_V2 + 15 ? + bne lz2gotla ; if not, we have the full literals count, go copy + + addb ,x+ ; add extra literals count byte + LITERALS_RUN_LEN + 15 + bcc lz2gotla ; if no overflow, we got the complete count, copy + + ldb ,x+ ; load low 8 bits of little-endian literals count + lda ,x+ ; load high 8 bits of literal count + bra lz2gotlt ; we now have the complete count, go copy + +lz2declt lsrb ; shift literals count into place + lsrb + lsrb +lz2gotla clra ; clear A (high part of literals count) + +lz2gotlt tfr d,w ; set W with literals count for TFM instruction + tfm x+,y+ ; copy literal bytes + +lz2nolt ldb ,u ; get token again + lslb ; push token's X flag bit into carry + bcs lz2replg ; if token's X bit is set, rep or large offset + + lslb ; push token's Y flag bit into carry + sex ; push token's Z flag bit into reg A (carry flag is not effected) + bcs lz2offs9 ; if token's Y bit is set, 9 bits offset + + bsr lz2nibl ; get offset nibble in B + lsla ; retrieve token's Z flag bit and push into carry + rolb ; shift Z flag from carry into bit 0 of B + eorb #$e1 ; set bits 5-7 of offset, reverse bit 0 + sex ; set bits 8-15 of offset to $FF + bra lz2gotof + +lz2offs9 deca ; set bits 9-15 of offset, reverse bit 8 + ldb ,x+ ; load low 8 bits of (negative, signed) offset + bra lz2gotof + +lz2nibl ldb #$aa + com lz2nibct ; nibble ready? + bpl lz2gotnb + + ldb ,x+ ; load two nibbles + stb lz2nibl+1 ; store nibble for next time (low 4 bits) + lsrb ; shift 4 high bits of nibble down + lsrb + lsrb + lsrb +lz2gotnb andb #$0f ; only keep low 4 bits +lz2done rts diff --git a/Tools/unix/lzsa/asm/6809/unlzsa2.s b/Tools/unix/lzsa/asm/6809/unlzsa2.s new file mode 100644 index 00000000..a620cadb --- /dev/null +++ b/Tools/unix/lzsa/asm/6809/unlzsa2.s @@ -0,0 +1,146 @@ +; unlzsa2.s - 6809 decompression routine for raw LZSA2 - 169 bytes +; compress with lzsa -f2 -r +; +; in: x = start of compressed data +; y = start of decompression buffer +; out: y = end of decompression buffer + 1 +; +; Copyright (C) 2020 Emmanuel Marty +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. + +decompress_lzsa2 + clr +; +; in: x = last byte of compressed data +; y = last byte of decompression buffer +; out: y = first byte of decompressed data +; +; Copyright (C) 2020 Emmanuel Marty, Doug Masten +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. + +decompress_lzsa2 + clr lz2nibct ; reset nibble available flag + leax 1,x ; adjust compressed data pointer + bra lz2token + +lz2nibct fcb 0 ; nibble ready flag + +lz2replg lslb ; push token's Y flag bit into carry + bcs lz2rep16 ; if token's Y bit is set, rep or 16 bit offset + + sex ; push token's Z flag bit into reg A + bsr lz2nibl ; get offset nibble in B + lsla ; push token's Z flag bit into carry + rolb ; shift Z flag from carry into bit 0 of B + eorb #$e1 ; set bits 13-15 of offset, reverse bit 8 + tfr b,a ; copy bits 8-15 of offset into A + suba #$02 ; substract 512 from offset + bra lz2lowof + +lz2rep16 bmi lz2repof ; if token's Z flag bit is set, rep match + lda ,-x ; load high 8 bits of (negative, signed) offset +lz2lowof ldb ,-x ; load low 8 bits of offset + +lz2gotof negd ; reverse sign of offset in D + std lz2moff+2 ; store match offset + +lz2repof ldd #$0007 ; clear MSB match length and set mask for MMM + andb ,u ; isolate MMM (embedded match length) in token +lz2moff leau $aaaa,y ; put backreference start address in U (dst+offset) + addb #$02 ; add MIN_MATCH_SIZE_V2 + cmpb #$09 ; MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2? + bne lz2gotln ; no, we have the full match length, go copy + + bsr lz2nibl ; get offset nibble in B + addb #$09 ; add MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2 + cmpb #$18 ; MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2 + 15? + bne lz2gotln ; if not, we have the full match length, go copy + + addb ,-x ; add extra length byte + MIN_MATCH_SIZE_V2 + MATCH_RUN_LEN_V2 + 15 + bcc lz2gotln ; if no overflow, we have the full length + beq lz2done ; detect EOD code + + ldd ,--x ; load 16-bit len in D (low part in B, high in A) + +lz2gotln tfr d,w ; set W with match count for TFM instruction + tfm u-,y- ; copy match bytes + +lz2token ldb ,-x ; load next token into B: XYZ|LL|MMM + tfr x,u ; save token address + andb #$18 ; isolate LL (embedded literals count) in B + beq lz2nolt ; skip if no literals + cmpb #$18 ; LITERALS_RUN_LEN_V2? + bne lz2declt ; if not, we have the complete count, go unshift + + bsr lz2nibl ; get extra literals length nibble in B + addb #$03 ; add LITERALS_RUN_LEN_V2 + cmpb #$12 ; LITERALS_RUN_LEN_V2 + 15 ? + bne lz2gotla ; if not, we have the full literals count, go copy + + addb ,-x ; add extra literals count byte + LITERALS_RUN_LEN + 15 + bcc lz2gotla ; if no overflow, we got the complete count, copy + + ldd ,--x ; load 16 bit count in D (low part in B, high in A) + bra lz2gotlt ; we now have the complete count, go copy + +lz2nibl com lz2nibct ; nibble ready? + bpl lz2gotnb + + ldb ,-x ; load two nibbles + stb lz2gotnb+1 ; store nibble for next time (low 4 bits) + lsrb ; shift 4 high bits of nibble down + lsrb + lsrb + lsrb + rts + +lz2declt lsrb ; shift literals count into place + lsrb + lsrb +lz2gotla clra ; clear A (high part of literals count) + +lz2gotlt tfr d,w ; set W with literals count for TFM instruction + leax -1,x ; tfm is post-decrement + tfm x-,y- ; copy literal bytes + leax 1,x + +lz2nolt ldb ,u ; get token again + lslb ; push token's X flag bit into carry + bcs lz2replg ; if token's X bit is set, rep or large offset + + lslb ; push token's Y flag bit into carry + sex ; push token's Z flag bit into reg A (carry flag is not effected) + bcs lz2offs9 ; if token's Y bit is set, 9 bits offset + + bsr lz2nibl ; get offset nibble in B + lsla ; retrieve token's Z flag bit and push into carry + rolb ; shift Z flag from carry into bit 0 of B + eorb #$e1 ; set bits 5-7 of offset, reverse bit 0 + sex ; set bits 8-15 of offset to $FF + bra lz2gotof + +lz2offs9 deca ; set bits 9-15 of offset, reverse bit 8 + bra lz2lowof + +lz2done leay 1,y ; adjust pointer to first byte of decompressed data and then exit +lz2gotnb ldb #$aa ; load nibble + andb #$0f ; only keep low 4 bits + rts diff --git a/Tools/unix/lzsa/asm/6809/unlzsa2b.s b/Tools/unix/lzsa/asm/6809/unlzsa2b.s new file mode 100644 index 00000000..b538cacb --- /dev/null +++ b/Tools/unix/lzsa/asm/6809/unlzsa2b.s @@ -0,0 +1,152 @@ +; unlzsa2b.s - 6809 backward decompression routine for raw LZSA2 - 171 bytes +; compress with lzsa -f2 -r -b +; +; in: x = last byte of compressed data +; y = last byte of decompression buffer +; out: y = first byte of decompressed data +; +; Copyright (C) 2020 Emmanuel Marty +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Permission is granted to anyone to use this software for any purpose, +; including commercial applications, and to alter it and redistribute it +; freely, subject to the following restrictions: +; +; 1. The origin of this software must not be misrepresented; you must not +; claim that you wrote the original software. If you use this software +; in a product, an acknowledgment in the product documentation would be +; appreciated but is not required. +; 2. Altered source versions must be plainly marked as such, and must not be +; misrepresented as being the original software. +; 3. This notice may not be removed or altered from any source distribution. + +decompress_lzsa2 + clr ed shuttle 86765 alice 46864 robotron 303895 +++! +; baseline new test harness shuttle 83925 alice 37948 robotron 269002 *** +; Pavel optimizations shuttle 82225 alice 36798 robotron 261226 +++ +; OPTIMIZE_LONG_RLE 1 shuttle 82242 alice 36787 robotron 261392 **- +; +;------ +; +;Pavel's optimization history: +; shuttle alice robotron time in 1.193 MHz timer clocks +;baseline 19109 D9A6 570F6 +;adc cl,0->adc cl,cl 19035 D9A6 56FAB +;rep movsb->shr cx,1;jnc 18FD4 D998 56F14 +;cmp bp,-2->inc bp;inc bp 18F07 D999 56EA3 +;jz;jc->jc 18D81 D973 56B2F +;add al,3->movsb x3 18B1E D777 56197 +;more lit_len_mat tables 18A83 D341 54ACC diff --git a/Tools/unix/lzsa/src/lib.h b/Tools/unix/lzsa/src/lib.h index 5556d2a9..2520b13b 100644 --- a/Tools/unix/lzsa/src/lib.h +++ b/Tools/unix/lzsa/src/lib.h @@ -63,7 +63,7 @@ typedef enum _lzsa_status_t { /* Decompression-specific status codes */ LZSA_ERROR_FORMAT, /**< Invalid input format or magic number when decompressing */ - LZSA_ERROR_DECOMPRESSION, /**< Internal decompression error */ + LZSA_ERROR_DECOMPRESSION /**< Internal decompression error */ } lzsa_status_t; /* Compression flags */ diff --git a/Tools/unix/lzsa/src/lzsa.c b/Tools/unix/lzsa/src/lzsa.c index 4cce4041..3f6e3572 100644 --- a/Tools/unix/lzsa/src/lzsa.c +++ b/Tools/unix/lzsa/src/lzsa.c @@ -31,7 +31,6 @@ */ #include -#include #include #include #ifdef _WIN32 @@ -48,7 +47,7 @@ #define OPT_RAW_BACKWARD 8 #define OPT_STATS 16 -#define TOOL_VERSION "1.2.0" +#define TOOL_VERSION "1.3.6" /*---------------------------------------------------------------------------*/ @@ -295,7 +294,7 @@ int comparestream_open(lzsa_stream_t *stream, const char *pszCompareFilename, co pCompareStream->pCompareDataBuf = NULL; pCompareStream->nCompareDataSize = 0; - pCompareStream->f = (void*)fopen(pszCompareFilename, pszMode); + pCompareStream->f = (FILE*)fopen(pszCompareFilename, pszMode); if (pCompareStream->f) { stream->obj = pCompareStream; @@ -866,11 +865,11 @@ int main(int argc, char **argv) { const char *pszInFilename = NULL; const char *pszOutFilename = NULL; const char *pszDictionaryFilename = NULL; - bool bArgsError = false; - bool bCommandDefined = false; - bool bVerifyCompression = false; - bool bMinMatchDefined = false; - bool bFormatVersionDefined = false; + int nArgsError = 0; + int nCommandDefined = 0; + int nVerifyCompression = 0; + int nMinMatchDefined = 0; + int nFormatVersionDefined = 0; char cCommand = 'z'; int nMinMatchSize = 0; unsigned int nOptions = OPT_FAVOR_RATIO; @@ -878,51 +877,51 @@ int main(int argc, char **argv) { for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-d")) { - if (!bCommandDefined) { - bCommandDefined = true; + if (!nCommandDefined) { + nCommandDefined = 1; cCommand = 'd'; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-z")) { - if (!bCommandDefined) { - bCommandDefined = true; + if (!nCommandDefined) { + nCommandDefined = 1; cCommand = 'z'; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-c")) { - if (!bVerifyCompression) { - bVerifyCompression = true; + if (!nVerifyCompression) { + nVerifyCompression = 1; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-cbench")) { - if (!bCommandDefined) { - bCommandDefined = true; + if (!nCommandDefined) { + nCommandDefined = 1; cCommand = 'B'; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-dbench")) { - if (!bCommandDefined) { - bCommandDefined = true; + if (!nCommandDefined) { + nCommandDefined = 1; cCommand = 'b'; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-test")) { - if (!bCommandDefined) { - bCommandDefined = true; + if (!nCommandDefined) { + nCommandDefined = 1; cCommand = 't'; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-D")) { if (!pszDictionaryFilename && (i + 1) < argc) { @@ -930,119 +929,119 @@ int main(int argc, char **argv) { i++; } else - bArgsError = true; + nArgsError = 1; } else if (!strncmp(argv[i], "-D", 2)) { if (!pszDictionaryFilename) { pszDictionaryFilename = argv[i] + 2; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-m")) { - if (!bMinMatchDefined && (i + 1) < argc) { + if (!nMinMatchDefined && (i + 1) < argc) { char *pEnd = NULL; nMinMatchSize = (int)strtol(argv[i + 1], &pEnd, 10); if (pEnd && pEnd != argv[i + 1] && (nMinMatchSize >= 2 && nMinMatchSize <= 5)) { i++; - bMinMatchDefined = true; + nMinMatchDefined = 1; nOptions &= (~OPT_FAVOR_RATIO); } else { - bArgsError = true; + nArgsError = 1; } } else - bArgsError = true; + nArgsError = 1; } else if (!strncmp(argv[i], "-m", 2)) { - if (!bMinMatchDefined) { + if (!nMinMatchDefined) { char *pEnd = NULL; nMinMatchSize = (int)strtol(argv[i] + 2, &pEnd, 10); if (pEnd && pEnd != (argv[i]+2) && (nMinMatchSize >= 2 && nMinMatchSize <= 5)) { - bMinMatchDefined = true; + nMinMatchDefined = 1; nOptions &= (~OPT_FAVOR_RATIO); } else { - bArgsError = true; + nArgsError = 1; } } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "--prefer-ratio")) { - if (!bMinMatchDefined) { + if (!nMinMatchDefined) { nMinMatchSize = 0; - bMinMatchDefined = true; + nMinMatchDefined = 1; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "--prefer-speed")) { - if (!bMinMatchDefined) { + if (!nMinMatchDefined) { nMinMatchSize = 3; nOptions &= (~OPT_FAVOR_RATIO); - bMinMatchDefined = true; + nMinMatchDefined = 1; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-f")) { - if (!bFormatVersionDefined && (i + 1) < argc) { + if (!nFormatVersionDefined && (i + 1) < argc) { char *pEnd = NULL; nFormatVersion = (int)strtol(argv[i + 1], &pEnd, 10); if (pEnd && pEnd != argv[i + 1] && (nFormatVersion >= 1 && nFormatVersion <= 2)) { i++; - bFormatVersionDefined = true; + nFormatVersionDefined = 1; } else { - bArgsError = true; + nArgsError = 1; } } else - bArgsError = true; + nArgsError = 1; } else if (!strncmp(argv[i], "-f", 2)) { - if (!bFormatVersionDefined) { + if (!nFormatVersionDefined) { char *pEnd = NULL; nFormatVersion = (int)strtol(argv[i] + 2, &pEnd, 10); if (pEnd && pEnd != (argv[i] + 2) && (nFormatVersion >= 1 && nFormatVersion <= 2)) { - bFormatVersionDefined = true; + nFormatVersionDefined = 1; } else { - bArgsError = true; + nArgsError = 1; } } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-v")) { if ((nOptions & OPT_VERBOSE) == 0) { nOptions |= OPT_VERBOSE; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-r")) { if ((nOptions & OPT_RAW) == 0) { nOptions |= OPT_RAW; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-b")) { if ((nOptions & OPT_RAW_BACKWARD) == 0) { nOptions |= OPT_RAW_BACKWARD; } else - bArgsError = true; + nArgsError = 1; } else if (!strcmp(argv[i], "-stats")) { if ((nOptions & OPT_STATS) == 0) { nOptions |= OPT_STATS; } else - bArgsError = true; + nArgsError = 1; } else { if (!pszInFilename) @@ -1051,21 +1050,21 @@ int main(int argc, char **argv) { if (!pszOutFilename) pszOutFilename = argv[i]; else - bArgsError = true; + nArgsError = 1; } } } - if (!bArgsError && (nOptions & OPT_RAW_BACKWARD) && !(nOptions & OPT_RAW)) { + if (!nArgsError && (nOptions & OPT_RAW_BACKWARD) && !(nOptions & OPT_RAW)) { fprintf(stderr, "error: -b (compress backwards) requires -r (raw block format)\n"); return 100; } - if (!bArgsError && cCommand == 't') { + if (!nArgsError && cCommand == 't') { return do_self_test(nOptions, nMinMatchSize, nFormatVersion); } - if (bArgsError || !pszInFilename || !pszOutFilename) { + if (nArgsError || !pszInFilename || !pszOutFilename) { fprintf(stderr, "lzsa command-line tool v" TOOL_VERSION " by Emmanuel Marty and spke\n"); fprintf(stderr, "usage: %s [-c] [-d] [-v] [-r] \n", argv[0]); fprintf(stderr, " -c: check resulting stream after compressing\n"); @@ -1089,7 +1088,7 @@ int main(int argc, char **argv) { if (cCommand == 'z') { int nResult = do_compress(pszInFilename, pszOutFilename, pszDictionaryFilename, nOptions, nMinMatchSize, nFormatVersion); - if (nResult == 0 && bVerifyCompression) { + if (nResult == 0 && nVerifyCompression) { return do_compare(pszOutFilename, pszInFilename, pszDictionaryFilename, nOptions, nFormatVersion); } else { return nResult; diff --git a/Tools/unix/lzsa/src/matchfinder.c b/Tools/unix/lzsa/src/matchfinder.c index fbdc5ca3..3de2cfa6 100644 --- a/Tools/unix/lzsa/src/matchfinder.c +++ b/Tools/unix/lzsa/src/matchfinder.c @@ -66,7 +66,7 @@ int lzsa_build_suffix_array(lzsa_compressor *pCompressor, const unsigned char *p int *PLCP = (int*)pCompressor->pos_data; /* Use temporarily */ int *Phi = PLCP; int nCurLen = 0; - int i; + int i, r; /* Compute the permuted LCP first (Kärkkäinen method) */ Phi[intervals[0]] = -1; @@ -132,7 +132,7 @@ int lzsa_build_suffix_array(lzsa_compressor *pCompressor, const unsigned char *p intervals[0] = 0; next_interval_idx = 1; - for (int r = 1; r < nInWindowSize; r++) { + for (r = 1; r < nInWindowSize; r++) { const unsigned int next_pos = SA_and_LCP[r] & POS_MASK; const unsigned int next_lcp = SA_and_LCP[r] & LCP_MASK; const unsigned int top_lcp = *top & LCP_MASK; diff --git a/Tools/unix/lzsa/src/shrink_block_v1.c b/Tools/unix/lzsa/src/shrink_block_v1.c index c30e4a9f..32c5c385 100644 --- a/Tools/unix/lzsa/src/shrink_block_v1.c +++ b/Tools/unix/lzsa/src/shrink_block_v1.c @@ -157,66 +157,69 @@ static inline int lzsa_get_offset_cost_v1(const unsigned int nMatchOffset) { * @param nEndOffset offset to end finding matches at (typically the size of the total input window in bytes */ static void lzsa_optimize_forward_v1(lzsa_compressor *pCompressor, lzsa_match *pBestMatch, const int nStartOffset, const int nEndOffset, const int nReduce) { - lzsa_arrival *arrival = pCompressor->arrival - (nStartOffset << MATCHES_PER_ARRIVAL_SHIFT); + lzsa_arrival *arrival = pCompressor->arrival - (nStartOffset << ARRIVALS_PER_POSITION_SHIFT); const int nMinMatchSize = pCompressor->min_match_size; const int nFavorRatio = (pCompressor->flags & LZSA_FLAG_FAVOR_RATIO) ? 1 : 0; + const int nModeSwitchPenalty = nFavorRatio ? 0 : MODESWITCH_PENALTY; const int nDisableScore = nReduce ? 0 : (2 * BLOCK_SIZE); int i, j, n; if ((nEndOffset - nStartOffset) > BLOCK_SIZE) return; - memset(arrival + (nStartOffset << MATCHES_PER_ARRIVAL_SHIFT), 0, sizeof(lzsa_arrival) * ((nEndOffset - nStartOffset + 1) << MATCHES_PER_ARRIVAL_SHIFT)); + memset(arrival + (nStartOffset << ARRIVALS_PER_POSITION_SHIFT), 0, sizeof(lzsa_arrival) * ((nEndOffset - nStartOffset + 1) << ARRIVALS_PER_POSITION_SHIFT)); - arrival[nStartOffset << MATCHES_PER_ARRIVAL_SHIFT].from_slot = -1; + arrival[nStartOffset << ARRIVALS_PER_POSITION_SHIFT].from_slot = -1; for (i = nStartOffset; i != nEndOffset; i++) { + lzsa_arrival* cur_arrival = &arrival[i << ARRIVALS_PER_POSITION_SHIFT]; int m; - for (j = 0; j < NMATCHES_PER_ARRIVAL_V1 && arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].from_slot; j++) { - int nPrevCost = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].cost; + for (j = 0; j < NARRIVALS_PER_POSITION_V1 && cur_arrival[j].from_slot; j++) { + int nPrevCost = cur_arrival[j].cost; int nCodingChoiceCost = nPrevCost + 8 /* literal */; - int nScore = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].score + 1; - int nNumLiterals = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].num_literals + 1; + int nScore = cur_arrival[j].score + 1; + int nNumLiterals = cur_arrival[j].num_literals + 1; if (nNumLiterals == LITERALS_RUN_LEN_V1 || nNumLiterals == 256 || nNumLiterals == 512) { nCodingChoiceCost += 8; } - if (!nFavorRatio && nNumLiterals == 1) - nCodingChoiceCost += MODESWITCH_PENALTY; + if (nNumLiterals == 1) + nCodingChoiceCost += nModeSwitchPenalty; - for (n = 0; n < NMATCHES_PER_ARRIVAL_V1 /* we only need the literals + short match cost + long match cost cases */; n++) { - lzsa_arrival *pDestArrival = &arrival[((i + 1) << MATCHES_PER_ARRIVAL_SHIFT) + n]; + lzsa_arrival *pDestSlots = &arrival[(i + 1) << ARRIVALS_PER_POSITION_SHIFT]; + for (n = 0; n < NARRIVALS_PER_POSITION_V1 /* we only need the literals + short match cost + long match cost cases */; n++) { + lzsa_arrival *pDestArrival = &pDestSlots[n]; if (pDestArrival->from_slot == 0 || nCodingChoiceCost < pDestArrival->cost || (nCodingChoiceCost == pDestArrival->cost && nScore < (pDestArrival->score + nDisableScore))) { - memmove(&arrival[((i + 1) << MATCHES_PER_ARRIVAL_SHIFT) + n + 1], - &arrival[((i + 1) << MATCHES_PER_ARRIVAL_SHIFT) + n], - sizeof(lzsa_arrival) * (NMATCHES_PER_ARRIVAL_V1 - n - 1)); + memmove(&arrival[((i + 1) << ARRIVALS_PER_POSITION_SHIFT) + n + 1], + &arrival[((i + 1) << ARRIVALS_PER_POSITION_SHIFT) + n], + sizeof(lzsa_arrival) * (NARRIVALS_PER_POSITION_V1 - n - 1)); pDestArrival->cost = nCodingChoiceCost; pDestArrival->from_pos = i; pDestArrival->from_slot = j + 1; - pDestArrival->match_offset = 0; pDestArrival->match_len = 0; pDestArrival->num_literals = nNumLiterals; pDestArrival->score = nScore; - pDestArrival->rep_offset = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_offset; + pDestArrival->rep_offset = cur_arrival[j].rep_offset; break; } } } const lzsa_match *match = pCompressor->match + ((i - nStartOffset) << MATCHES_PER_INDEX_SHIFT_V1); + int nNumArrivalsForThisPos = j; for (m = 0; m < NMATCHES_PER_INDEX_V1 && match[m].length; m++) { int nMatchLen = match[m].length; int nMatchOffsetCost = lzsa_get_offset_cost_v1(match[m].offset); int nStartingMatchLen, k; - if ((i + nMatchLen) > (nEndOffset - LAST_LITERALS)) - nMatchLen = nEndOffset - LAST_LITERALS - i; + if ((i + nMatchLen) > nEndOffset) + nMatchLen = nEndOffset - i; if (nMatchLen >= LEAVE_ALONE_MATCH_SIZE) nStartingMatchLen = nMatchLen; @@ -225,43 +228,48 @@ static void lzsa_optimize_forward_v1(lzsa_compressor *pCompressor, lzsa_match *p for (k = nStartingMatchLen; k <= nMatchLen; k++) { int nMatchLenCost = lzsa_get_match_varlen_size_v1(k - MIN_MATCH_SIZE_V1); - for (j = 0; j < NMATCHES_PER_ARRIVAL_V1 && arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].from_slot; j++) { - int nPrevCost = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].cost; + lzsa_arrival *pDestSlots = &arrival[(i + k) << ARRIVALS_PER_POSITION_SHIFT]; + + for (j = 0; j < nNumArrivalsForThisPos; j++) { + int nPrevCost = cur_arrival[j].cost; int nCodingChoiceCost = nPrevCost + 8 /* token */ /* the actual cost of the literals themselves accumulates up the chain */ + nMatchOffsetCost + nMatchLenCost; - int nScore = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].score + 5; int exists = 0; - if (!nFavorRatio && !arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].num_literals) - nCodingChoiceCost += MODESWITCH_PENALTY; + if (!cur_arrival[j].num_literals) + nCodingChoiceCost += nModeSwitchPenalty; for (n = 0; - n < NMATCHES_PER_ARRIVAL_V1 && arrival[((i + k) << MATCHES_PER_ARRIVAL_SHIFT) + n].from_slot && arrival[((i + k) << MATCHES_PER_ARRIVAL_SHIFT) + n].cost <= nCodingChoiceCost; + n < NARRIVALS_PER_POSITION_V1 && pDestSlots[n].from_slot && pDestSlots[n].cost <= nCodingChoiceCost; n++) { - if (lzsa_get_offset_cost_v1(arrival[((i + k) << MATCHES_PER_ARRIVAL_SHIFT) + n].rep_offset) == lzsa_get_offset_cost_v1(match[m].offset)) { + if (lzsa_get_offset_cost_v1(pDestSlots[n].rep_offset) == nMatchOffsetCost) { exists = 1; break; } } - for (n = 0; !exists && n < NMATCHES_PER_ARRIVAL_V1 /* we only need the literals + short match cost + long match cost cases */; n++) { - lzsa_arrival *pDestArrival = &arrival[((i + k) << MATCHES_PER_ARRIVAL_SHIFT) + n]; - - if (pDestArrival->from_slot == 0 || - nCodingChoiceCost < pDestArrival->cost || - (nCodingChoiceCost == pDestArrival->cost && nScore < (pDestArrival->score + nDisableScore))) { - memmove(&arrival[((i + k) << MATCHES_PER_ARRIVAL_SHIFT) + n + 1], - &arrival[((i + k) << MATCHES_PER_ARRIVAL_SHIFT) + n], - sizeof(lzsa_arrival) * (NMATCHES_PER_ARRIVAL_V1 - n - 1)); - - pDestArrival->cost = nCodingChoiceCost; - pDestArrival->from_pos = i; - pDestArrival->from_slot = j + 1; - pDestArrival->match_offset = match[m].offset; - pDestArrival->match_len = k; - pDestArrival->num_literals = 0; - pDestArrival->score = nScore; - pDestArrival->rep_offset = match[m].offset; - break; + if (!exists) { + int nScore = cur_arrival[j].score + 5; + + for (n = 0; n < NARRIVALS_PER_POSITION_V1 /* we only need the literals + short match cost + long match cost cases */; n++) { + lzsa_arrival *pDestArrival = &pDestSlots[n]; + + if (pDestArrival->from_slot == 0 || + nCodingChoiceCost < pDestArrival->cost || + (nCodingChoiceCost == pDestArrival->cost && nScore < (pDestArrival->score + nDisableScore))) { + memmove(&pDestSlots[n + 1], + &pDestSlots[n], + sizeof(lzsa_arrival) * (NARRIVALS_PER_POSITION_V1 - n - 1)); + + pDestArrival->cost = nCodingChoiceCost; + pDestArrival->from_pos = i; + pDestArrival->from_slot = j + 1; + pDestArrival->match_len = k; + pDestArrival->num_literals = 0; + pDestArrival->score = nScore; + pDestArrival->rep_offset = match[m].offset; + j = NARRIVALS_PER_POSITION_V1; + break; + } } } } @@ -269,14 +277,17 @@ static void lzsa_optimize_forward_v1(lzsa_compressor *pCompressor, lzsa_match *p } } - lzsa_arrival *end_arrival = &arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + 0]; + lzsa_arrival *end_arrival = &arrival[(i << ARRIVALS_PER_POSITION_SHIFT) + 0]; while (end_arrival->from_slot > 0 && end_arrival->from_pos >= 0) { if (end_arrival->from_pos >= nEndOffset) return; pBestMatch[end_arrival->from_pos].length = end_arrival->match_len; - pBestMatch[end_arrival->from_pos].offset = end_arrival->match_offset; + if (end_arrival->match_len) + pBestMatch[end_arrival->from_pos].offset = end_arrival->rep_offset; + else + pBestMatch[end_arrival->from_pos].offset = 0; - end_arrival = &arrival[(end_arrival->from_pos << MATCHES_PER_ARRIVAL_SHIFT) + (end_arrival->from_slot - 1)]; + end_arrival = &arrival[(end_arrival->from_pos << ARRIVALS_PER_POSITION_SHIFT) + (end_arrival->from_slot - 1)]; } } @@ -301,12 +312,12 @@ static int lzsa_optimize_command_count_v1(lzsa_compressor *pCompressor, const un lzsa_match *pMatch = pBestMatch + i; if (pMatch->length == 0 && - (i + 1) < (nEndOffset - LAST_LITERALS) && + (i + 1) < nEndOffset && pBestMatch[i + 1].length >= MIN_MATCH_SIZE_V1 && pBestMatch[i + 1].length < MAX_VARLEN && pBestMatch[i + 1].offset && i >= pBestMatch[i + 1].offset && - (i + pBestMatch[i + 1].length + 1) <= (nEndOffset - LAST_LITERALS) && + (i + pBestMatch[i + 1].length + 1) <= nEndOffset && !memcmp(pInWindow + i - (pBestMatch[i + 1].offset), pInWindow + i, pBestMatch[i + 1].length + 1)) { int nCurLenSize = lzsa_get_match_varlen_size_v1(pBestMatch[i + 1].length - MIN_MATCH_SIZE_V1); int nReducedLenSize = lzsa_get_match_varlen_size_v1(pBestMatch[i + 1].length + 1 - MIN_MATCH_SIZE_V1); @@ -413,8 +424,6 @@ static int lzsa_get_compressed_size_v1(lzsa_compressor *pCompressor, lzsa_match int nMatchOffset = pMatch->offset; int nMatchLen = pMatch->length; int nEncodedMatchLen = nMatchLen - MIN_MATCH_SIZE_V1; - int nTokenLiteralsLen = (nNumLiterals >= LITERALS_RUN_LEN_V1) ? LITERALS_RUN_LEN_V1 : nNumLiterals; - int nTokenMatchLen = (nEncodedMatchLen >= MATCH_RUN_LEN_V1) ? MATCH_RUN_LEN_V1 : nEncodedMatchLen; int nTokenLongOffset = (nMatchOffset <= 256) ? 0x00 : 0x80; int nCommandSize = 8 /* token */ + lzsa_get_literals_varlen_size_v1(nNumLiterals) + (nNumLiterals << 3) + (nTokenLongOffset ? 16 : 8) /* match offset */ + lzsa_get_match_varlen_size_v1(nEncodedMatchLen); @@ -429,7 +438,6 @@ static int lzsa_get_compressed_size_v1(lzsa_compressor *pCompressor, lzsa_match } { - int nTokenLiteralsLen = (nNumLiterals >= LITERALS_RUN_LEN_V1) ? LITERALS_RUN_LEN_V1 : nNumLiterals; int nCommandSize = 8 /* token */ + lzsa_get_literals_varlen_size_v1(nNumLiterals) + (nNumLiterals << 3); nCompressedSize += nCommandSize; diff --git a/Tools/unix/lzsa/src/shrink_block_v2.c b/Tools/unix/lzsa/src/shrink_block_v2.c index eb4a16ed..fc6d2324 100644 --- a/Tools/unix/lzsa/src/shrink_block_v2.c +++ b/Tools/unix/lzsa/src/shrink_block_v2.c @@ -43,22 +43,18 @@ * @param nOutOffset current write index into output buffer * @param nMaxOutDataSize maximum size of output buffer, in bytes * @param nCurNibbleOffset write index into output buffer, of current byte being filled with nibbles - * @param nCurFreeNibbles current number of free nibbles in byte * @param nNibbleValue value to write (0..15) */ -static int lzsa_write_nibble_v2(unsigned char *pOutData, int nOutOffset, const int nMaxOutDataSize, int *nCurNibbleOffset, int *nCurFreeNibbles, int nNibbleValue) { +static int lzsa_write_nibble_v2(unsigned char *pOutData, int nOutOffset, const int nMaxOutDataSize, int *nCurNibbleOffset, int nNibbleValue) { if (nOutOffset < 0) return -1; if ((*nCurNibbleOffset) == -1) { if (nOutOffset >= nMaxOutDataSize) return -1; (*nCurNibbleOffset) = nOutOffset; - (*nCurFreeNibbles) = 2; - pOutData[nOutOffset++] = 0; + pOutData[nOutOffset++] = nNibbleValue << 4; } - - pOutData[*nCurNibbleOffset] = (pOutData[*nCurNibbleOffset] << 4) | (nNibbleValue & 0x0f); - (*nCurFreeNibbles)--; - if ((*nCurFreeNibbles) == 0) { + else { + pOutData[*nCurNibbleOffset] = (pOutData[*nCurNibbleOffset]) | (nNibbleValue & 0x0f); (*nCurNibbleOffset) = -1; } @@ -96,15 +92,17 @@ static inline int lzsa_get_literals_varlen_size_v2(const int nLength) { * * @param pOutData pointer to output buffer * @param nOutOffset current write index into output buffer + * @param nMaxOutDataSize maximum size of output buffer, in bytes + * @param nCurNibbleOffset write index into output buffer, of current byte being filled with nibbles * @param nLength literals length */ -static inline int lzsa_write_literals_varlen_v2(unsigned char *pOutData, int nOutOffset, const int nMaxOutDataSize, int *nCurNibbleOffset, int *nCurFreeNibbles, int nLength) { +static inline int lzsa_write_literals_varlen_v2(unsigned char *pOutData, int nOutOffset, const int nMaxOutDataSize, int *nCurNibbleOffset, int nLength) { if (nLength >= LITERALS_RUN_LEN_V2) { if (nLength < (LITERALS_RUN_LEN_V2 + 15)) { - nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, nCurNibbleOffset, nCurFreeNibbles, nLength - LITERALS_RUN_LEN_V2); + nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, nCurNibbleOffset, nLength - LITERALS_RUN_LEN_V2); } else { - nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, nCurNibbleOffset, nCurFreeNibbles, 15); + nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, nCurNibbleOffset, 15); if (nOutOffset < 0) return -1; if (nLength < 256) @@ -150,15 +148,17 @@ static inline int lzsa_get_match_varlen_size_v2(const int nLength) { * * @param pOutData pointer to output buffer * @param nOutOffset current write index into output buffer + * @param nMaxOutDataSize maximum size of output buffer, in bytes + * @param nCurNibbleOffset write index into output buffer, of current byte being filled with nibbles * @param nLength encoded match length (actual match length - MIN_MATCH_SIZE_V2) */ -static inline int lzsa_write_match_varlen_v2(unsigned char *pOutData, int nOutOffset, const int nMaxOutDataSize, int *nCurNibbleOffset, int *nCurFreeNibbles, int nLength) { +static inline int lzsa_write_match_varlen_v2(unsigned char *pOutData, int nOutOffset, const int nMaxOutDataSize, int *nCurNibbleOffset, int nLength) { if (nLength >= MATCH_RUN_LEN_V2) { if (nLength < (MATCH_RUN_LEN_V2 + 15)) { - nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, nCurNibbleOffset, nCurFreeNibbles, nLength - MATCH_RUN_LEN_V2); + nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, nCurNibbleOffset, nLength - MATCH_RUN_LEN_V2); } else { - nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, nCurNibbleOffset, nCurFreeNibbles, 15); + nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, nCurNibbleOffset, 15); if (nOutOffset < 0) return -1; if ((nLength + MIN_MATCH_SIZE_V2) < 256) @@ -183,58 +183,72 @@ static inline int lzsa_write_match_varlen_v2(unsigned char *pOutData, int nOutOf * @param nMatchOffset match offset to use as rep candidate * @param nStartOffset current offset in input window (typically the number of previously compressed bytes) * @param nEndOffset offset to end finding matches at (typically the size of the total input window in bytes - * @param nMatchesPerArrival number of arrivals to record per input buffer position * @param nDepth current insertion depth */ -static void lzsa_insert_forward_match_v2(lzsa_compressor *pCompressor, const unsigned char *pInWindow, const int i, const int nMatchOffset, const int nStartOffset, const int nEndOffset, const int nMatchesPerArrival, int nDepth) { - lzsa_arrival *arrival = pCompressor->arrival - (nStartOffset << MATCHES_PER_ARRIVAL_SHIFT); +static void lzsa_insert_forward_match_v2(lzsa_compressor *pCompressor, const unsigned char *pInWindow, const int i, const int nMatchOffset, const int nStartOffset, const int nEndOffset, int nDepth) { + lzsa_arrival *arrival = pCompressor->arrival + ((i - nStartOffset) << ARRIVALS_PER_POSITION_SHIFT); + const int *rle_len = (int*)pCompressor->intervals /* reuse */; + lzsa_match* visited = ((lzsa_match*)pCompressor->pos_data) - nStartOffset /* reuse */; int j; - if (nDepth >= 10) return; + for (j = 0; j < NARRIVALS_PER_POSITION_V2_BIG && arrival[j].from_slot; j++) { + int nRepOffset = arrival[j].rep_offset; - for (j = 0; j < nMatchesPerArrival && arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].from_slot; j++) { - int nRepOffset = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_offset; - - if (nMatchOffset != nRepOffset && nRepOffset && arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_len >= MIN_MATCH_SIZE_V2) { - int nRepPos = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_pos; - int nRepLen = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_len; + if (nMatchOffset != nRepOffset && nRepOffset && arrival[j].rep_len >= MIN_MATCH_SIZE_V2) { + int nRepPos = arrival[j].rep_pos; + int nRepLen = arrival[j].rep_len; if (nRepPos > nMatchOffset && - (nRepPos - nMatchOffset + nRepLen) <= (nEndOffset - LAST_LITERALS) && - !memcmp(pInWindow + nRepPos - nRepOffset, pInWindow + nRepPos - nMatchOffset, nRepLen)) { - int nCurRepLen = nRepLen; - - int nMaxRepLen = nEndOffset - nRepPos; - if (nMaxRepLen > LCP_MAX) - nMaxRepLen = LCP_MAX; - while ((nCurRepLen + 8) < nMaxRepLen && !memcmp(pInWindow + nRepPos + nCurRepLen, pInWindow + nRepPos - nMatchOffset + nCurRepLen, 8)) - nCurRepLen += 8; - while ((nCurRepLen + 4) < nMaxRepLen && !memcmp(pInWindow + nRepPos + nCurRepLen, pInWindow + nRepPos - nMatchOffset + nCurRepLen, 4)) - nCurRepLen += 4; - while (nCurRepLen < nMaxRepLen && pInWindow[nRepPos + nCurRepLen] == pInWindow[nRepPos - nMatchOffset + nCurRepLen]) - nCurRepLen++; - - lzsa_match *fwd_match = pCompressor->match + ((nRepPos - nStartOffset) << MATCHES_PER_INDEX_SHIFT_V2); - int exists = 0; - int r; + (nRepPos + nRepLen) <= nEndOffset && + pCompressor->match[((nRepPos - nStartOffset) << MATCHES_PER_INDEX_SHIFT_V2) + NMATCHES_PER_INDEX_V2 - 1].length == 0) { - for (r = 0; r < NMATCHES_PER_INDEX_V2 && fwd_match[r].length >= MIN_MATCH_SIZE_V2; r++) { - if (fwd_match[r].offset == nMatchOffset) { - exists = 1; + if (visited[nRepPos].offset != nMatchOffset || visited[nRepPos].length > nRepLen) { + visited[nRepPos].offset = nMatchOffset; + visited[nRepPos].length = nRepLen; - if (fwd_match[r].length < nCurRepLen) { - fwd_match[r].length = nCurRepLen; - lzsa_insert_forward_match_v2(pCompressor, pInWindow, nRepPos, nMatchOffset, nStartOffset, nEndOffset, nMatchesPerArrival, nDepth + 1); - } - break; - } - } + if (pInWindow[nRepPos] == pInWindow[nRepPos - nMatchOffset]) { + int nLen0 = rle_len[nRepPos - nMatchOffset]; + int nLen1 = rle_len[nRepPos]; + int nMinLen = (nLen0 < nLen1) ? nLen0 : nLen1; + + if (nMinLen >= nRepLen || !memcmp(pInWindow + nRepPos + nMinLen, pInWindow + nRepPos + nMinLen - nMatchOffset, nRepLen - nMinLen)) { + visited[nRepPos].length = 0; - if (!exists && r < NMATCHES_PER_INDEX_V2) { - fwd_match[r].offset = nMatchOffset; - fwd_match[r].length = nCurRepLen; + lzsa_match* fwd_match = pCompressor->match + ((nRepPos - nStartOffset) << MATCHES_PER_INDEX_SHIFT_V2); + int r; + + for (r = 0; r < NMATCHES_PER_INDEX_V2 && fwd_match[r].length >= MIN_MATCH_SIZE_V2; r++) { + if (fwd_match[r].offset == nMatchOffset) { + r = NMATCHES_PER_INDEX_V2; + break; + } + } - lzsa_insert_forward_match_v2(pCompressor, pInWindow, nRepPos, nMatchOffset, nStartOffset, nEndOffset, nMatchesPerArrival, nDepth + 1); + if (r < NMATCHES_PER_INDEX_V2) { + int nMaxRepLen = nEndOffset - nRepPos; + if (nMaxRepLen > LCP_MAX) + nMaxRepLen = LCP_MAX; + int nCurRepLen = (nMinLen > nRepLen) ? nMinLen : nRepLen; + if (nCurRepLen > nMaxRepLen) + nCurRepLen = nMaxRepLen; + const unsigned char* pInWindowMax = pInWindow + nRepPos + nMaxRepLen; + const unsigned char* pInWindowAtRepPos = pInWindow + nRepPos + nCurRepLen; + while ((pInWindowAtRepPos + 8) < pInWindowMax && !memcmp(pInWindowAtRepPos, pInWindowAtRepPos - nMatchOffset, 8)) + pInWindowAtRepPos += 8; + while ((pInWindowAtRepPos + 4) < pInWindowMax && !memcmp(pInWindowAtRepPos, pInWindowAtRepPos - nMatchOffset, 4)) + pInWindowAtRepPos += 4; + while (pInWindowAtRepPos < pInWindowMax && pInWindowAtRepPos[0] == pInWindowAtRepPos[-nMatchOffset]) + pInWindowAtRepPos++; + + nCurRepLen = (int)(pInWindowAtRepPos - (pInWindow + nRepPos)); + fwd_match[r].offset = nMatchOffset; + fwd_match[r].length = nCurRepLen; + + if (nDepth < 9) + lzsa_insert_forward_match_v2(pCompressor, pInWindow, nRepPos, nMatchOffset, nStartOffset, nEndOffset, nDepth + 1); + } + } + } } } } @@ -251,33 +265,44 @@ static void lzsa_insert_forward_match_v2(lzsa_compressor *pCompressor, const uns * @param nEndOffset offset to end finding matches at (typically the size of the total input window in bytes * @param nReduce non-zero to reduce the number of tokens when the path costs are equal, zero not to * @param nInsertForwardReps non-zero to insert forward repmatch candidates, zero to use the previously inserted candidates - * @param nMatchesPerArrival number of arrivals to record per input buffer position + * @param nArrivalsPerPosition number of arrivals to record per input buffer position */ -static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigned char *pInWindow, lzsa_match *pBestMatch, const int nStartOffset, const int nEndOffset, const int nReduce, const int nInsertForwardReps, const int nMatchesPerArrival) { - lzsa_arrival *arrival = pCompressor->arrival - (nStartOffset << MATCHES_PER_ARRIVAL_SHIFT); - const int nFavorRatio = (pCompressor->flags & LZSA_FLAG_FAVOR_RATIO) ? 1 : 0; +static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigned char *pInWindow, lzsa_match *pBestMatch, const int nStartOffset, const int nEndOffset, const int nReduce, const int nInsertForwardReps, const int nArrivalsPerPosition) { + lzsa_arrival *arrival = pCompressor->arrival - (nStartOffset << ARRIVALS_PER_POSITION_SHIFT); + const int *rle_len = (int*)pCompressor->intervals /* reuse */; + lzsa_match *visited = ((lzsa_match*)pCompressor->pos_data) - nStartOffset /* reuse */; + char *nRepSlotHandledMask = pCompressor->rep_slot_handled_mask; + char *nRepLenHandledMask = pCompressor->rep_len_handled_mask; + const int nModeSwitchPenalty = (pCompressor->flags & LZSA_FLAG_FAVOR_RATIO) ? 0 : MODESWITCH_PENALTY; const int nMinMatchSize = pCompressor->min_match_size; const int nDisableScore = nReduce ? 0 : (2 * BLOCK_SIZE); - const int nLeaveAloneMatchSize = (nMatchesPerArrival == NMATCHES_PER_ARRIVAL_V2_SMALL) ? LEAVE_ALONE_MATCH_SIZE_SMALL : LEAVE_ALONE_MATCH_SIZE; + const int nMaxRepInsertedLen = nReduce ? LEAVE_ALONE_MATCH_SIZE : 0; + const int nLeaveAloneMatchSize = (nArrivalsPerPosition == NARRIVALS_PER_POSITION_V2_SMALL) ? LEAVE_ALONE_MATCH_SIZE_SMALL : LEAVE_ALONE_MATCH_SIZE; int i, j, n; if ((nEndOffset - nStartOffset) > BLOCK_SIZE) return; - memset(arrival + (nStartOffset << MATCHES_PER_ARRIVAL_SHIFT), 0, sizeof(lzsa_arrival) * ((nEndOffset - nStartOffset + 1) << MATCHES_PER_ARRIVAL_SHIFT)); + memset(arrival + (nStartOffset << ARRIVALS_PER_POSITION_SHIFT), 0, sizeof(lzsa_arrival) * ((nEndOffset - nStartOffset + 1) << ARRIVALS_PER_POSITION_SHIFT)); - for (i = (nStartOffset << MATCHES_PER_ARRIVAL_SHIFT); i != ((nEndOffset + 1) << MATCHES_PER_ARRIVAL_SHIFT); i++) { + for (i = (nStartOffset << ARRIVALS_PER_POSITION_SHIFT); i != ((nEndOffset + 1) << ARRIVALS_PER_POSITION_SHIFT); i++) { arrival[i].cost = 0x40000000; } - arrival[nStartOffset << MATCHES_PER_ARRIVAL_SHIFT].from_slot = -1; + arrival[nStartOffset << ARRIVALS_PER_POSITION_SHIFT].from_slot = -1; + + if (nInsertForwardReps) { + memset(visited + nStartOffset, 0, (nEndOffset - nStartOffset) * sizeof(lzsa_match)); + } for (i = nStartOffset; i != nEndOffset; i++) { + lzsa_arrival *cur_arrival = &arrival[i << ARRIVALS_PER_POSITION_SHIFT]; int m; - for (j = 0; j < nMatchesPerArrival && arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].from_slot; j++) { - const int nPrevCost = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].cost & 0x3fffffff; + for (j = 0; j < nArrivalsPerPosition && cur_arrival[j].from_slot; j++) { + const int nPrevCost = cur_arrival[j].cost & 0x3fffffff; int nCodingChoiceCost = nPrevCost + 8 /* literal */; - int nNumLiterals = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].num_literals + 1; + int nScore = cur_arrival[j].score + 1; + int nNumLiterals = cur_arrival[j].num_literals + 1; if (nNumLiterals == LITERALS_RUN_LEN_V2) { nCodingChoiceCost += 4; @@ -289,52 +314,70 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne nCodingChoiceCost += 16; } - if (!nFavorRatio && nNumLiterals == 1) - nCodingChoiceCost += MODESWITCH_PENALTY; + if (nNumLiterals == 1) + nCodingChoiceCost += nModeSwitchPenalty; - lzsa_arrival *pDestSlots = &arrival[(i + 1) << MATCHES_PER_ARRIVAL_SHIFT]; - if (nCodingChoiceCost <= pDestSlots[nMatchesPerArrival - 1].cost) { + lzsa_arrival *pDestSlots = &cur_arrival[1 << ARRIVALS_PER_POSITION_SHIFT]; + if (nCodingChoiceCost < pDestSlots[nArrivalsPerPosition - 1].cost || + (nCodingChoiceCost == pDestSlots[nArrivalsPerPosition - 1].cost && nScore < (pDestSlots[nArrivalsPerPosition - 1].score + nDisableScore))) { + int nRepOffset = cur_arrival[j].rep_offset; int exists = 0; + for (n = 0; - n < nMatchesPerArrival && pDestSlots[n].cost <= nCodingChoiceCost; + n < nArrivalsPerPosition && pDestSlots[n].cost < nCodingChoiceCost; n++) { - if (pDestSlots[n].rep_offset == arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_offset) { + if (pDestSlots[n].rep_offset == nRepOffset) { exists = 1; break; } } if (!exists) { - int nScore = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].score + 1; - for (n = 0; n < nMatchesPerArrival; n++) { - lzsa_arrival *pDestArrival = &pDestSlots[n]; - if (nCodingChoiceCost < pDestArrival->cost || - (nCodingChoiceCost == pDestArrival->cost && nScore < (pDestArrival->score + nDisableScore))) { + for (; + n < nArrivalsPerPosition && pDestSlots[n].cost == nCodingChoiceCost && nScore >= (pDestSlots[n].score + nDisableScore); + n++) { + if (pDestSlots[n].rep_offset == nRepOffset) { + exists = 1; + break; + } + } + + if (!exists) { + if (n < nArrivalsPerPosition) { + int nn; + + for (nn = n; + nn < nArrivalsPerPosition && pDestSlots[nn].cost == nCodingChoiceCost; + nn++) { + if (pDestSlots[nn].rep_offset == nRepOffset) { + exists = 1; + break; + } + } - if (pDestArrival->from_slot) { + if (!exists) { int z; - for (z = n; z < nMatchesPerArrival - 1; z++) { - if (pDestSlots[z].rep_offset == arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_offset) + for (z = n; z < nArrivalsPerPosition - 1 && pDestSlots[z].from_slot; z++) { + if (pDestSlots[z].rep_offset == nRepOffset) break; } memmove(&pDestSlots[n + 1], &pDestSlots[n], sizeof(lzsa_arrival) * (z - n)); - } - pDestArrival->cost = nCodingChoiceCost; - pDestArrival->from_pos = i; - pDestArrival->from_slot = j + 1; - pDestArrival->match_offset = 0; - pDestArrival->match_len = 0; - pDestArrival->num_literals = nNumLiterals; - pDestArrival->score = nScore; - pDestArrival->rep_offset = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_offset; - pDestArrival->rep_pos = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_pos; - pDestArrival->rep_len = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_len; - break; + lzsa_arrival* pDestArrival = &pDestSlots[n]; + pDestArrival->cost = nCodingChoiceCost; + pDestArrival->from_pos = i; + pDestArrival->from_slot = j + 1; + pDestArrival->match_len = 0; + pDestArrival->num_literals = nNumLiterals; + pDestArrival->score = nScore; + pDestArrival->rep_offset = nRepOffset; + pDestArrival->rep_pos = cur_arrival[j].rep_pos; + pDestArrival->rep_len = cur_arrival[j].rep_len; + } } } } @@ -342,203 +385,276 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne } lzsa_match *match = pCompressor->match + ((i - nStartOffset) << MATCHES_PER_INDEX_SHIFT_V2); + int nNumArrivalsForThisPos = j, nMinOverallRepLen = 0, nMaxOverallRepLen = 0; + + int nRepMatchArrivalIdxAndLen[(NARRIVALS_PER_POSITION_V2_BIG * 2) + 1]; + int nNumRepMatchArrivals = 0; + + int nMaxRepLenForPos = nEndOffset - i; + if (nMaxRepLenForPos > LCP_MAX) + nMaxRepLenForPos = LCP_MAX; + const unsigned char* pInWindowStart = pInWindow + i; + const unsigned char* pInWindowMax = pInWindowStart + nMaxRepLenForPos; + + for (j = 0; j < nNumArrivalsForThisPos && (i + MIN_MATCH_SIZE_V2) <= nEndOffset; j++) { + int nRepOffset = cur_arrival[j].rep_offset; + + if (nRepOffset) { + if (i > nRepOffset) { + if (pInWindow[i] == pInWindow[i - nRepOffset]) { + const unsigned char* pInWindowAtPos; + + int nLen0 = rle_len[i - nRepOffset]; + int nLen1 = rle_len[i]; + int nMinLen = (nLen0 < nLen1) ? nLen0 : nLen1; + + if (nMinLen > nMaxRepLenForPos) + nMinLen = nMaxRepLenForPos; + pInWindowAtPos = pInWindowStart + nMinLen; + + while ((pInWindowAtPos + 8) < pInWindowMax && !memcmp(pInWindowAtPos - nRepOffset, pInWindowAtPos, 8)) + pInWindowAtPos += 8; + while ((pInWindowAtPos + 4) < pInWindowMax && !memcmp(pInWindowAtPos - nRepOffset, pInWindowAtPos, 4)) + pInWindowAtPos += 4; + while (pInWindowAtPos < pInWindowMax && pInWindowAtPos[-nRepOffset] == pInWindowAtPos[0]) + pInWindowAtPos++; + int nCurRepLen = (int)(pInWindowAtPos - pInWindowStart); + + if (nCurRepLen >= MIN_MATCH_SIZE_V2) { + if (nMaxOverallRepLen < nCurRepLen) + nMaxOverallRepLen = nCurRepLen; + nRepMatchArrivalIdxAndLen[nNumRepMatchArrivals++] = j; + nRepMatchArrivalIdxAndLen[nNumRepMatchArrivals++] = nCurRepLen; + } + } + } + } + } + nRepMatchArrivalIdxAndLen[nNumRepMatchArrivals] = -1; - int nMinRepLen[NMATCHES_PER_ARRIVAL_V2_BIG]; - memset(nMinRepLen, 0, nMatchesPerArrival * sizeof(int)); + if (!nReduce) { + memset(nRepSlotHandledMask, 0, nArrivalsPerPosition * ((LCP_MAX + 1) / 8) * sizeof(char)); + } + memset(nRepLenHandledMask, 0, ((LCP_MAX + 1) / 8) * sizeof(char)); for (m = 0; m < NMATCHES_PER_INDEX_V2 && match[m].length; m++) { int nMatchLen = match[m].length & 0x7fff; int nMatchOffset = match[m].offset; - int nScorePenalty = ((match[m].length & 0x8000) >> 15); + int nScorePenalty = 3 + ((match[m].length & 0x8000) >> 15); int nNoRepmatchOffsetCost = (nMatchOffset <= 32) ? 4 : ((nMatchOffset <= 512) ? 8 : ((nMatchOffset <= (8192 + 512)) ? 12 : 16)); int nStartingMatchLen, k; - int nMaxRepLen[NMATCHES_PER_ARRIVAL_V2_BIG]; - if ((i + nMatchLen) > (nEndOffset - LAST_LITERALS)) - nMatchLen = nEndOffset - LAST_LITERALS - i; + if ((i + nMatchLen) > nEndOffset) + nMatchLen = nEndOffset - i; - for (j = 0; j < nMatchesPerArrival && arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].from_slot; j++) { - int nRepOffset = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_offset; - int nCurMaxRepLen = 0; + if (nInsertForwardReps) + lzsa_insert_forward_match_v2(pCompressor, pInWindow, i, nMatchOffset, nStartOffset, nEndOffset, 0); - if (nRepOffset) { - if (nMatchOffset == nRepOffset) - nCurMaxRepLen = nMatchLen; - else { - if (i > nRepOffset && - (i - nRepOffset + nMatchLen) <= (nEndOffset - LAST_LITERALS)) { - nCurMaxRepLen = nMinRepLen[j]; - while ((nCurMaxRepLen + 8) < nMatchLen && !memcmp(pInWindow + i - nRepOffset + nCurMaxRepLen, pInWindow + i + nCurMaxRepLen, 8)) - nCurMaxRepLen += 8; - while ((nCurMaxRepLen + 4) < nMatchLen && !memcmp(pInWindow + i - nRepOffset + nCurMaxRepLen, pInWindow + i + nCurMaxRepLen, 4)) - nCurMaxRepLen += 4; - while (nCurMaxRepLen < nMatchLen && pInWindow[i - nRepOffset + nCurMaxRepLen] == pInWindow[i + nCurMaxRepLen]) - nCurMaxRepLen++; - nMinRepLen[j] = nCurMaxRepLen; - } - } - } + int nNonRepMatchArrivalIdx = -1; + for (j = 0; j < nNumArrivalsForThisPos; j++) { + int nRepOffset = cur_arrival[j].rep_offset; - nMaxRepLen[j] = nCurMaxRepLen; + if (nMatchOffset != nRepOffset) { + nNonRepMatchArrivalIdx = j; + break; + } } - while (j < nMatchesPerArrival) - nMaxRepLen[j++] = 0; - if (nInsertForwardReps) - lzsa_insert_forward_match_v2(pCompressor, pInWindow, i, nMatchOffset, nStartOffset, nEndOffset, nMatchesPerArrival, 0); - - int nMatchLenCost = 0; + int nMatchLenCost; if (nMatchLen >= nLeaveAloneMatchSize) { nStartingMatchLen = nMatchLen; - nMatchLenCost = 4 + 24; + nMatchLenCost = 4 + 24 + 8 /* token */; } else { nStartingMatchLen = nMinMatchSize; - nMatchLenCost = 0; + nMatchLenCost = 0 + 8 /* token */; } for (k = nStartingMatchLen; k <= nMatchLen; k++) { if (k == (MATCH_RUN_LEN_V2 + MIN_MATCH_SIZE_V2)) { - nMatchLenCost = 4; + nMatchLenCost = 4 + 8 /* token */; } else { if (k == (MATCH_RUN_LEN_V2 + 15 + MIN_MATCH_SIZE_V2)) - nMatchLenCost = 4 + 8; + nMatchLenCost = 4 + 8 + 8 /* token */; else { if (k == 256) - nMatchLenCost = 4 + 24; + nMatchLenCost = 4 + 24 + 8 /* token */; } } - lzsa_arrival *pDestSlots = &arrival[(i + k) << MATCHES_PER_ARRIVAL_SHIFT]; - int nInsertedNoRepMatchCandidate = 0; + lzsa_arrival *pDestSlots = &cur_arrival[k << ARRIVALS_PER_POSITION_SHIFT]; - for (j = 0; j < nMatchesPerArrival && arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].from_slot; j++) { - const int nPrevCost = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].cost & 0x3fffffff; - int nRepCodingChoiceCost = nPrevCost + 8 /* token */ /* the actual cost of the literals themselves accumulates up the chain */ + nMatchLenCost; + /* Insert non-repmatch candidate */ - if (nRepCodingChoiceCost <= pDestSlots[nMatchesPerArrival - 1].cost) { - int nRepOffset = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_offset; + if (nNonRepMatchArrivalIdx >= 0) { + const int nPrevCost = cur_arrival[nNonRepMatchArrivalIdx].cost & 0x3fffffff; + int nCodingChoiceCost = nPrevCost /* the actual cost of the literals themselves accumulates up the chain */ + nMatchLenCost + nNoRepmatchOffsetCost; - if (nMatchOffset != nRepOffset && !nInsertedNoRepMatchCandidate) { - int nCodingChoiceCost = nRepCodingChoiceCost + nNoRepmatchOffsetCost; + if (!cur_arrival[nNonRepMatchArrivalIdx].num_literals) + nCodingChoiceCost += nModeSwitchPenalty; - if (!nFavorRatio && !arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].num_literals) - nCodingChoiceCost += MODESWITCH_PENALTY; + int nScore = cur_arrival[nNonRepMatchArrivalIdx].score + nScorePenalty; + if (nCodingChoiceCost < pDestSlots[nArrivalsPerPosition - 2].cost || + (nCodingChoiceCost == pDestSlots[nArrivalsPerPosition - 2].cost && nScore < (pDestSlots[nArrivalsPerPosition - 2].score + nDisableScore))) { + int exists = 0; - if (nCodingChoiceCost <= pDestSlots[nMatchesPerArrival - 1].cost) { - int exists = 0; - int nScore = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].score + 3 + nScorePenalty; + for (n = 0; + n < nArrivalsPerPosition && pDestSlots[n].cost < nCodingChoiceCost; + n++) { + if (pDestSlots[n].rep_offset == nMatchOffset) { + exists = 1; + break; + } + } - for (n = 0; - n < nMatchesPerArrival && pDestSlots[n].cost <= nCodingChoiceCost; - n++) { - if (pDestSlots[n].rep_offset == nMatchOffset && - (!nInsertForwardReps || pDestSlots[n].cost != nCodingChoiceCost || pDestSlots[n].rep_pos >= i || nScore >= (pDestSlots[n].score + nDisableScore) || - pDestSlots[nMatchesPerArrival - 1].from_slot)) { - exists = 1; - break; - } + if (!exists) { + for (; + n < nArrivalsPerPosition && pDestSlots[n].cost == nCodingChoiceCost && nScore >= (pDestSlots[n].score + nDisableScore); + n++) { + if (pDestSlots[n].rep_offset == nMatchOffset) { + exists = 1; + break; } + } - if (!exists) { - for (n = 0; n < nMatchesPerArrival - 1; n++) { - lzsa_arrival *pDestArrival = &pDestSlots[n]; + if (!exists) { + if (n < nArrivalsPerPosition - 1) { + int nn; + + for (nn = n; + nn < nArrivalsPerPosition && pDestSlots[nn].cost == nCodingChoiceCost; + nn++) { + if (pDestSlots[nn].rep_offset == nMatchOffset && + (!nInsertForwardReps || pDestSlots[nn].rep_pos >= i || + pDestSlots[nArrivalsPerPosition - 1].from_slot)) { + exists = 1; + break; + } + } - if (nCodingChoiceCost < pDestArrival->cost || - (nCodingChoiceCost == pDestArrival->cost && nScore < (pDestArrival->score + nDisableScore))) { - if (pDestArrival->from_slot) { - int z; + if (!exists) { + int z; - for (z = n; z < nMatchesPerArrival - 1; z++) { - if (pDestSlots[z].rep_offset == nMatchOffset) - break; - } + for (z = n; z < nArrivalsPerPosition - 1 && pDestSlots[z].from_slot; z++) { + if (pDestSlots[z].rep_offset == nMatchOffset) + break; + } - if (z == (nMatchesPerArrival - 1) && pDestSlots[z].from_slot && pDestSlots[z].match_len < MIN_MATCH_SIZE_V2) - z--; + if (z == (nArrivalsPerPosition - 1) && pDestSlots[z].from_slot && pDestSlots[z].match_len < MIN_MATCH_SIZE_V2) + z--; - memmove(&pDestSlots[n + 1], - &pDestSlots[n], - sizeof(lzsa_arrival) * (z - n)); - } + memmove(&pDestSlots[n + 1], + &pDestSlots[n], + sizeof(lzsa_arrival) * (z - n)); - pDestArrival->cost = nCodingChoiceCost; - pDestArrival->from_pos = i; - pDestArrival->from_slot = j + 1; - pDestArrival->match_offset = nMatchOffset; - pDestArrival->match_len = k; - pDestArrival->num_literals = 0; - pDestArrival->score = nScore; - pDestArrival->rep_offset = nMatchOffset; - pDestArrival->rep_pos = i; - pDestArrival->rep_len = k; - nInsertedNoRepMatchCandidate = 1; - break; - } + lzsa_arrival* pDestArrival = &pDestSlots[n]; + pDestArrival->cost = nCodingChoiceCost; + pDestArrival->from_pos = i; + pDestArrival->from_slot = nNonRepMatchArrivalIdx + 1; + pDestArrival->match_len = k; + pDestArrival->num_literals = 0; + pDestArrival->score = nScore; + pDestArrival->rep_offset = nMatchOffset; + pDestArrival->rep_pos = i; + pDestArrival->rep_len = k; + nRepLenHandledMask[k >> 3] &= ~(1 << (k & 7)); } } } } + } + } - /* If this coding choice doesn't rep-match, see if we still get a match by using the current repmatch offset for this arrival. This can occur (and not have the - * matchfinder offer the offset in the first place, or have too many choices with the same cost to retain the repmatchable offset) when compressing regions - * of identical bytes, for instance. Checking for this provides a big compression win on some files. */ + /* Insert repmatch candidates */ - if (nMaxRepLen[j] >= k) { - int exists = 0; + if (k > nMinOverallRepLen && k <= nMaxOverallRepLen && (nRepLenHandledMask[k >> 3] & (1 << (k & 7))) == 0) { + int nCurRepMatchArrival; - /* A match is possible at the rep offset; insert the extra coding choice. */ + nRepLenHandledMask[k >> 3] |= 1 << (k & 7); - for (n = 0; - n < nMatchesPerArrival && pDestSlots[n].cost <= nRepCodingChoiceCost; - n++) { - if (pDestSlots[n].rep_offset == nRepOffset) { - exists = 1; - break; - } - } + for (nCurRepMatchArrival = 0; (j = nRepMatchArrivalIdxAndLen[nCurRepMatchArrival]) >= 0; nCurRepMatchArrival += 2) { + int nMaskOffset = (j << 7) + (k >> 3); + if (nRepMatchArrivalIdxAndLen[nCurRepMatchArrival + 1] >= k && (nReduce || !(nRepSlotHandledMask[nMaskOffset] & (1 << (k & 7))))) { + const int nPrevCost = cur_arrival[j].cost & 0x3fffffff; + int nRepCodingChoiceCost = nPrevCost /* the actual cost of the literals themselves accumulates up the chain */ + nMatchLenCost; + int nScore = cur_arrival[j].score + 2; - if (!exists) { - int nScore = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].score + 2; + if (nRepCodingChoiceCost < pDestSlots[nArrivalsPerPosition - 1].cost || + (nRepCodingChoiceCost == pDestSlots[nArrivalsPerPosition - 1].cost && nScore < (pDestSlots[nArrivalsPerPosition - 1].score + nDisableScore))) { + int nRepOffset = cur_arrival[j].rep_offset; + int exists = 0; - for (n = 0; n < nMatchesPerArrival; n++) { - lzsa_arrival *pDestArrival = &pDestSlots[n]; + for (n = 0; + n < nArrivalsPerPosition && pDestSlots[n].cost < nRepCodingChoiceCost; + n++) { + if (pDestSlots[n].rep_offset == nRepOffset) { + exists = 1; + if (!nReduce) + nRepSlotHandledMask[nMaskOffset] |= 1 << (k & 7); + break; + } + } - if (nRepCodingChoiceCost < pDestArrival->cost || - (nRepCodingChoiceCost == pDestArrival->cost && nScore < (pDestArrival->score + nDisableScore))) { - if (pDestArrival->from_slot) { - int z; + if (!exists) { + for (; + n < nArrivalsPerPosition && pDestSlots[n].cost == nRepCodingChoiceCost && nScore >= (pDestSlots[n].score + nDisableScore); + n++) { + if (pDestSlots[n].rep_offset == nRepOffset) { + exists = 1; + break; + } + } - for (z = n; z < nMatchesPerArrival - 1; z++) { - if (pDestSlots[z].rep_offset == nRepOffset) + if (!exists) { + if (n < nArrivalsPerPosition) { + int nn; + + for (nn = n; + nn < nArrivalsPerPosition && pDestSlots[nn].cost == nRepCodingChoiceCost; + nn++) { + if (pDestSlots[nn].rep_offset == nRepOffset) { + exists = 1; break; + } } - memmove(&pDestSlots[n + 1], - &pDestSlots[n], - sizeof(lzsa_arrival) * (z - n)); - } + if (!exists) { + int z; - pDestArrival->cost = nRepCodingChoiceCost; - pDestArrival->from_pos = i; - pDestArrival->from_slot = j + 1; - pDestArrival->match_offset = nRepOffset; - pDestArrival->match_len = k; - pDestArrival->num_literals = 0; - pDestArrival->score = nScore; - pDestArrival->rep_offset = nRepOffset; - pDestArrival->rep_pos = i; - pDestArrival->rep_len = k; - break; + for (z = n; z < nArrivalsPerPosition - 1 && pDestSlots[z].from_slot; z++) { + if (pDestSlots[z].rep_offset == nRepOffset) + break; + } + + memmove(&pDestSlots[n + 1], + &pDestSlots[n], + sizeof(lzsa_arrival) * (z - n)); + + lzsa_arrival* pDestArrival = &pDestSlots[n]; + pDestArrival->cost = nRepCodingChoiceCost; + pDestArrival->from_pos = i; + pDestArrival->from_slot = j + 1; + pDestArrival->match_len = k; + pDestArrival->num_literals = 0; + pDestArrival->score = nScore; + pDestArrival->rep_offset = nRepOffset; + pDestArrival->rep_pos = i; + pDestArrival->rep_len = k; + nRepLenHandledMask[k >> 3] &= ~(1 << (k & 7)); + } + } } } } + else { + break; + } } } - else { - break; - } + + if (k < nMaxRepInsertedLen) + nMinOverallRepLen = k; } } @@ -547,13 +663,16 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne } } - lzsa_arrival *end_arrival = &arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + 0]; + lzsa_arrival *end_arrival = &arrival[(i << ARRIVALS_PER_POSITION_SHIFT) + 0]; while (end_arrival->from_slot > 0 && end_arrival->from_pos >= 0) { if (end_arrival->from_pos >= nEndOffset) return; pBestMatch[end_arrival->from_pos].length = end_arrival->match_len; - pBestMatch[end_arrival->from_pos].offset = end_arrival->match_offset; - end_arrival = &arrival[(end_arrival->from_pos << MATCHES_PER_ARRIVAL_SHIFT) + (end_arrival->from_slot - 1)]; + if (end_arrival->match_len) + pBestMatch[end_arrival->from_pos].offset = end_arrival->rep_offset; + else + pBestMatch[end_arrival->from_pos].offset = 0; + end_arrival = &arrival[(end_arrival->from_pos << ARRIVALS_PER_POSITION_SHIFT) + (end_arrival->from_slot - 1)]; } } @@ -582,12 +701,12 @@ static int lzsa_optimize_command_count_v2(lzsa_compressor *pCompressor, const un lzsa_match *pMatch = pBestMatch + i; if (pMatch->length == 0 && - (i + 1) < (nEndOffset - LAST_LITERALS) && + (i + 1) < nEndOffset && pBestMatch[i + 1].length >= MIN_MATCH_SIZE_V2 && pBestMatch[i + 1].length < MAX_VARLEN && pBestMatch[i + 1].offset && i >= pBestMatch[i + 1].offset && - (i + pBestMatch[i + 1].length + 1) <= (nEndOffset - LAST_LITERALS) && + (i + pBestMatch[i + 1].length + 1) <= nEndOffset && !memcmp(pInWindow + i - (pBestMatch[i + 1].offset), pInWindow + i, pBestMatch[i + 1].length + 1)) { int nCurLenSize = lzsa_get_match_varlen_size_v2(pBestMatch[i + 1].length - MIN_MATCH_SIZE_V2); int nReducedLenSize = lzsa_get_match_varlen_size_v2(pBestMatch[i + 1].length + 1 - MIN_MATCH_SIZE_V2); @@ -623,7 +742,7 @@ static int lzsa_optimize_command_count_v2(lzsa_compressor *pCompressor, const un * matching large regions of identical bytes for instance, where there are too many offsets to be considered by the parser, and when not compressing to favor the * ratio (the forward arrivals parser already has this covered). */ if (i > nRepMatchOffset && - (i - nRepMatchOffset + pMatch->length) <= (nEndOffset - LAST_LITERALS) && + (i - nRepMatchOffset + pMatch->length) <= nEndOffset && !memcmp(pInWindow + i - nRepMatchOffset, pInWindow + i - pMatch->offset, pMatch->length)) { pMatch->offset = nRepMatchOffset; nDidReduce = 1; @@ -632,7 +751,7 @@ static int lzsa_optimize_command_count_v2(lzsa_compressor *pCompressor, const un if (pBestMatch[nNextIndex].offset && pMatch->offset != pBestMatch[nNextIndex].offset && nRepMatchOffset != pBestMatch[nNextIndex].offset) { /* Otherwise, try to gain a match forward as well */ - if (i > pBestMatch[nNextIndex].offset && (i - pBestMatch[nNextIndex].offset + pMatch->length) <= (nEndOffset - LAST_LITERALS)) { + if (i > pBestMatch[nNextIndex].offset && (i - pBestMatch[nNextIndex].offset + pMatch->length) <= nEndOffset) { int nMaxLen = 0; while (nMaxLen < pMatch->length && pInWindow[i - pBestMatch[nNextIndex].offset + nMaxLen] == pInWindow[i - pMatch->offset + nMaxLen]) nMaxLen++; @@ -675,20 +794,20 @@ static int lzsa_optimize_command_count_v2(lzsa_compressor *pCompressor, const un nCurCommandSize += (pMatch->offset <= 32) ? 4 : ((pMatch->offset <= 512) ? 8 : ((pMatch->offset <= (8192 + 512)) ? 12 : 16)); /* Calculate the next command's current cost */ - int nNextCommandSize = 8 /* token */ + lzsa_get_literals_varlen_size_v2(nNextLiterals) + (nNextLiterals << 3) + lzsa_get_match_varlen_size_v2(pBestMatch[nNextIndex].length - MIN_MATCH_SIZE_V2); + int nNextCommandSize = 8 /* token */ + lzsa_get_literals_varlen_size_v2(nNextLiterals) + /* (nNextLiterals << 3) + */ lzsa_get_match_varlen_size_v2(pBestMatch[nNextIndex].length - MIN_MATCH_SIZE_V2); if (pBestMatch[nNextIndex].offset != pMatch->offset) nNextCommandSize += (pBestMatch[nNextIndex].offset <= 32) ? 4 : ((pBestMatch[nNextIndex].offset <= 512) ? 8 : ((pBestMatch[nNextIndex].offset <= (8192 + 512)) ? 12 : 16)); int nOriginalCombinedCommandSize = nCurCommandSize + nNextCommandSize; /* Calculate the cost of replacing this match command by literals + the next command with the cost of encoding these literals (excluding 'nNumLiterals' bytes) */ - int nReducedCommandSize = (pMatch->length << 3) + 8 /* token */ + lzsa_get_literals_varlen_size_v2(nNumLiterals + pMatch->length + nNextLiterals) + (nNextLiterals << 3) + lzsa_get_match_varlen_size_v2(pBestMatch[nNextIndex].length - MIN_MATCH_SIZE_V2); + int nReducedCommandSize = (pMatch->length << 3) + 8 /* token */ + lzsa_get_literals_varlen_size_v2(nNumLiterals + pMatch->length + nNextLiterals) + /* (nNextLiterals << 3) + */ lzsa_get_match_varlen_size_v2(pBestMatch[nNextIndex].length - MIN_MATCH_SIZE_V2); if (pBestMatch[nNextIndex].offset != nRepMatchOffset) nReducedCommandSize += (pBestMatch[nNextIndex].offset <= 32) ? 4 : ((pBestMatch[nNextIndex].offset <= 512) ? 8 : ((pBestMatch[nNextIndex].offset <= (8192 + 512)) ? 12 : 16)); int nReplaceRepOffset = 0; if (nRepMatchOffset && nRepMatchOffset != nPrevRepMatchOffset && nRepMatchLen >= MIN_MATCH_SIZE_V2 && nRepMatchOffset != pBestMatch[nNextIndex].offset && nRepIndex > pBestMatch[nNextIndex].offset && - (nRepIndex - pBestMatch[nNextIndex].offset + nRepMatchLen) <= (nEndOffset - LAST_LITERALS) && + (nRepIndex - pBestMatch[nNextIndex].offset + nRepMatchLen) <= nEndOffset && !memcmp(pInWindow + nRepIndex - nRepMatchOffset, pInWindow + nRepIndex - pBestMatch[nNextIndex].offset, nRepMatchLen)) { /* Replacing this match command by literals would let us create a repmatch */ nReplaceRepOffset = 1; @@ -729,26 +848,30 @@ static int lzsa_optimize_command_count_v2(lzsa_compressor *pCompressor, const un pBestMatch[i + pMatch->length].length)) { int nNextIndex = i + pMatch->length; - int nNextLiterals = 0; while (nNextIndex < nEndOffset && pBestMatch[nNextIndex].length < MIN_MATCH_SIZE_V2) { - nNextLiterals++; nNextIndex++; } + int nNextOffset; + if (nNextIndex < nEndOffset) + nNextOffset = pBestMatch[nNextIndex].offset; + else + nNextOffset = 0; + int nCurPartialSize = lzsa_get_match_varlen_size_v2(pMatch->length - MIN_MATCH_SIZE_V2); - nCurPartialSize += 8 /* token */ + lzsa_get_literals_varlen_size_v2(0) + lzsa_get_match_varlen_size_v2(pBestMatch[i + pMatch->length].length - MIN_MATCH_SIZE_V2); + nCurPartialSize += 8 /* token */ + /* lzsa_get_literals_varlen_size_v2(0) + */ lzsa_get_match_varlen_size_v2(pBestMatch[i + pMatch->length].length - MIN_MATCH_SIZE_V2); if (pBestMatch[i + pMatch->length].offset != pMatch->offset) nCurPartialSize += (pBestMatch[i + pMatch->length].offset <= 32) ? 4 : ((pBestMatch[i + pMatch->length].offset <= 512) ? 8 : ((pBestMatch[i + pMatch->length].offset <= (8192 + 512)) ? 12 : 16)); - if (pBestMatch[nNextIndex].offset != pBestMatch[i + pMatch->length].offset) - nCurPartialSize += (pBestMatch[nNextIndex].offset <= 32) ? 4 : ((pBestMatch[nNextIndex].offset <= 512) ? 8 : ((pBestMatch[nNextIndex].offset <= (8192 + 512)) ? 12 : 16)); + if (nNextOffset != pBestMatch[i + pMatch->length].offset) + nCurPartialSize += (nNextOffset <= 32) ? 4 : ((nNextOffset <= 512) ? 8 : ((nNextOffset <= (8192 + 512)) ? 12 : 16)); int nReducedPartialSize = lzsa_get_match_varlen_size_v2(pMatch->length + pBestMatch[i + pMatch->length].length - MIN_MATCH_SIZE_V2); - if (pBestMatch[nNextIndex].offset != pMatch->offset) - nReducedPartialSize += (pBestMatch[nNextIndex].offset <= 32) ? 4 : ((pBestMatch[nNextIndex].offset <= 512) ? 8 : ((pBestMatch[nNextIndex].offset <= (8192 + 512)) ? 12 : 16)); + if (nNextOffset != pMatch->offset) + nReducedPartialSize += (nNextOffset <= 32) ? 4 : ((nNextOffset <= 512) ? 8 : ((nNextOffset <= (8192 + 512)) ? 12 : 16)); if (nCurPartialSize >= nReducedPartialSize) { int nMatchLen = pMatch->length; @@ -793,7 +916,6 @@ static int lzsa_optimize_command_count_v2(lzsa_compressor *pCompressor, const un static int lzsa_get_compressed_size_v2(lzsa_compressor *pCompressor, lzsa_match *pBestMatch, const int nStartOffset, const int nEndOffset) { int i; int nNumLiterals = 0; - int nOutOffset = 0; int nRepMatchOffset = 0; int nCompressedSize = 0; @@ -838,7 +960,6 @@ static int lzsa_get_compressed_size_v2(lzsa_compressor *pCompressor, lzsa_match } { - int nTokenLiteralsLen = (nNumLiterals >= LITERALS_RUN_LEN_V2) ? LITERALS_RUN_LEN_V2 : nNumLiterals; int nCommandSize = 8 /* token */ + lzsa_get_literals_varlen_size_v2(nNumLiterals) + (nNumLiterals << 3); nCompressedSize += nCommandSize; @@ -846,7 +967,7 @@ static int lzsa_get_compressed_size_v2(lzsa_compressor *pCompressor, lzsa_match } if (pCompressor->flags & LZSA_FLAG_RAW_BLOCK) { - nCompressedSize += (8 + 4 + 8); + nCompressedSize += (8 + 4); } return nCompressedSize; @@ -870,7 +991,7 @@ static int lzsa_write_block_v2(lzsa_compressor *pCompressor, lzsa_match *pBestMa int nNumLiterals = 0; int nInFirstLiteralOffset = 0; int nOutOffset = 0; - int nCurNibbleOffset = -1, nCurFreeNibbles = 0; + int nCurNibbleOffset = -1; int nRepMatchOffset = 0; for (i = nStartOffset; i < nEndOffset; ) { @@ -916,7 +1037,7 @@ static int lzsa_write_block_v2(lzsa_compressor *pCompressor, lzsa_match *pBestMa return -1; pOutData[nOutOffset++] = nTokenOffsetMode | (nTokenLiteralsLen << 3) | nTokenMatchLen; - nOutOffset = lzsa_write_literals_varlen_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, &nCurFreeNibbles, nNumLiterals); + nOutOffset = lzsa_write_literals_varlen_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, nNumLiterals); if (nOutOffset < 0) return -1; if (nNumLiterals < pCompressor->stats.min_literals || pCompressor->stats.min_literals == -1) @@ -933,14 +1054,14 @@ static int lzsa_write_block_v2(lzsa_compressor *pCompressor, lzsa_match *pBestMa } if (nTokenOffsetMode == 0x00 || nTokenOffsetMode == 0x20) { - nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, &nCurFreeNibbles, ((-nMatchOffset) & 0x1e) >> 1); + nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, ((-nMatchOffset) & 0x1e) >> 1); if (nOutOffset < 0) return -1; } else if (nTokenOffsetMode == 0x40 || nTokenOffsetMode == 0x60) { pOutData[nOutOffset++] = (-nMatchOffset) & 0xff; } else if (nTokenOffsetMode == 0x80 || nTokenOffsetMode == 0xa0) { - nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, &nCurFreeNibbles, ((-(nMatchOffset - 512)) >> 9) & 0x0f); + nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, ((-(nMatchOffset - 512)) >> 9) & 0x0f); if (nOutOffset < 0) return -1; pOutData[nOutOffset++] = (-(nMatchOffset - 512)) & 0xff; } @@ -954,7 +1075,7 @@ static int lzsa_write_block_v2(lzsa_compressor *pCompressor, lzsa_match *pBestMa nRepMatchOffset = nMatchOffset; - nOutOffset = lzsa_write_match_varlen_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, &nCurFreeNibbles, nEncodedMatchLen); + nOutOffset = lzsa_write_match_varlen_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, nEncodedMatchLen); if (nOutOffset < 0) return -1; if (nMatchOffset < pCompressor->stats.min_offset || pCompressor->stats.min_offset == -1) @@ -1013,10 +1134,10 @@ static int lzsa_write_block_v2(lzsa_compressor *pCompressor, lzsa_match *pBestMa return -1; if (pCompressor->flags & LZSA_FLAG_RAW_BLOCK) - pOutData[nOutOffset++] = (nTokenLiteralsLen << 3) | 0x47; + pOutData[nOutOffset++] = (nTokenLiteralsLen << 3) | 0xe7; else pOutData[nOutOffset++] = (nTokenLiteralsLen << 3) | 0x00; - nOutOffset = lzsa_write_literals_varlen_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, &nCurFreeNibbles, nNumLiterals); + nOutOffset = lzsa_write_literals_varlen_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, nNumLiterals); if (nOutOffset < 0) return -1; if (nNumLiterals < pCompressor->stats.min_literals || pCompressor->stats.min_literals == -1) @@ -1046,9 +1167,8 @@ static int lzsa_write_block_v2(lzsa_compressor *pCompressor, lzsa_match *pBestMa if (nOutOffset >= nMaxOutDataSize) return -1; - pOutData[nOutOffset++] = 0; /* Match offset */ - nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, &nCurFreeNibbles, 15); /* Extended match length nibble */ + nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, 15); /* Extended match length nibble */ if (nOutOffset < 0) return -1; if ((nOutOffset + 1) > nMaxOutDataSize) @@ -1058,7 +1178,7 @@ static int lzsa_write_block_v2(lzsa_compressor *pCompressor, lzsa_match *pBestMa } if (nCurNibbleOffset != -1) { - nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, &nCurFreeNibbles, 0); + nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, 0); if (nOutOffset < 0 || nCurNibbleOffset != -1) return -1; } @@ -1079,19 +1199,19 @@ static int lzsa_write_block_v2(lzsa_compressor *pCompressor, lzsa_match *pBestMa * @return size of compressed data in output buffer, or -1 if the data is uncompressible */ static int lzsa_write_raw_uncompressed_block_v2(lzsa_compressor *pCompressor, const unsigned char *pInWindow, const int nStartOffset, const int nEndOffset, unsigned char *pOutData, const int nMaxOutDataSize) { - int nCurNibbleOffset = -1, nCurFreeNibbles = 0; + int nCurNibbleOffset = -1; int nNumLiterals = nEndOffset - nStartOffset; int nTokenLiteralsLen = (nNumLiterals >= LITERALS_RUN_LEN_V2) ? LITERALS_RUN_LEN_V2 : nNumLiterals; int nOutOffset = 0; - int nCommandSize = 8 /* token */ + lzsa_get_literals_varlen_size_v2(nNumLiterals) + (nNumLiterals << 3) + 8 + 4 + 8; + int nCommandSize = 8 /* token */ + lzsa_get_literals_varlen_size_v2(nNumLiterals) + (nNumLiterals << 3) + 4 + 8; if ((nOutOffset + ((nCommandSize + 7) >> 3)) > nMaxOutDataSize) return -1; pCompressor->num_commands = 0; - pOutData[nOutOffset++] = (nTokenLiteralsLen << 3) | 0x47; + pOutData[nOutOffset++] = (nTokenLiteralsLen << 3) | 0xe7; - nOutOffset = lzsa_write_literals_varlen_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, &nCurFreeNibbles, nNumLiterals); + nOutOffset = lzsa_write_literals_varlen_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, nNumLiterals); if (nOutOffset < 0) return -1; if (nNumLiterals != 0) { @@ -1102,9 +1222,7 @@ static int lzsa_write_raw_uncompressed_block_v2(lzsa_compressor *pCompressor, co /* Emit EOD marker for raw block */ - pOutData[nOutOffset++] = 0; /* Match offset */ - - nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, &nCurFreeNibbles, 15); /* Extended match length nibble */ + nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, 15); /* Extended match length nibble */ if (nOutOffset < 0) return -1; if ((nOutOffset + 1) > nMaxOutDataSize) @@ -1115,7 +1233,7 @@ static int lzsa_write_raw_uncompressed_block_v2(lzsa_compressor *pCompressor, co pCompressor->num_commands++; if (nCurNibbleOffset != -1) { - nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, &nCurFreeNibbles, 0); + nOutOffset = lzsa_write_nibble_v2(pOutData, nOutOffset, nMaxOutDataSize, &nCurNibbleOffset, 0); if (nOutOffset < 0 || nCurNibbleOffset != -1) return -1; } @@ -1137,12 +1255,27 @@ static int lzsa_write_raw_uncompressed_block_v2(lzsa_compressor *pCompressor, co */ int lzsa_optimize_and_write_block_v2(lzsa_compressor *pCompressor, const unsigned char *pInWindow, const int nPreviousBlockSize, const int nInDataSize, unsigned char *pOutData, const int nMaxOutDataSize) { int nResult, nBaseCompressedSize; - int nMatchesPerArrival = (nInDataSize < 65536) ? NMATCHES_PER_ARRIVAL_V2_BIG : NMATCHES_PER_ARRIVAL_V2_SMALL; + int nArrivalsPerPosition = (nInDataSize < 65536) ? NARRIVALS_PER_POSITION_V2_BIG : NARRIVALS_PER_POSITION_V2_SMALL; + int *rle_len = (int*)pCompressor->intervals /* reuse */; + int i; + + i = 0; + while (i < (nPreviousBlockSize + nInDataSize)) { + int nRangeStartIdx = i; + unsigned char c = pInWindow[nRangeStartIdx]; + do { + i++; + } while (i < (nPreviousBlockSize + nInDataSize) && pInWindow[i] == c); + while (nRangeStartIdx < i) { + rle_len[nRangeStartIdx] = i - nRangeStartIdx; + nRangeStartIdx++; + } + } /* Compress optimally without breaking ties in favor of less tokens */ memset(pCompressor->best_match, 0, BLOCK_SIZE * sizeof(lzsa_match)); - lzsa_optimize_forward_v2(pCompressor, pInWindow, pCompressor->best_match - nPreviousBlockSize, nPreviousBlockSize, nPreviousBlockSize + nInDataSize, 0 /* reduce */, (nInDataSize < 65536) ? 1 : 0 /* insert forward reps */, nMatchesPerArrival); + lzsa_optimize_forward_v2(pCompressor, pInWindow, pCompressor->best_match - nPreviousBlockSize, nPreviousBlockSize, nPreviousBlockSize + nInDataSize, 0 /* reduce */, (nInDataSize < 65536) ? 1 : 0 /* insert forward reps */, nArrivalsPerPosition); int nDidReduce; int nPasses = 0; @@ -1159,7 +1292,7 @@ int lzsa_optimize_and_write_block_v2(lzsa_compressor *pCompressor, const unsigne /* Compress optimally and do break ties in favor of less tokens */ memset(pCompressor->improved_match, 0, BLOCK_SIZE * sizeof(lzsa_match)); - lzsa_optimize_forward_v2(pCompressor, pInWindow, pCompressor->improved_match - nPreviousBlockSize, nPreviousBlockSize, nPreviousBlockSize + nInDataSize, 1 /* reduce */, 0 /* use forward reps */, nMatchesPerArrival); + lzsa_optimize_forward_v2(pCompressor, pInWindow, pCompressor->improved_match - nPreviousBlockSize, nPreviousBlockSize, nPreviousBlockSize + nInDataSize, 1 /* reduce */, 0 /* use forward reps */, nArrivalsPerPosition); nPasses = 0; do { @@ -1169,8 +1302,77 @@ int lzsa_optimize_and_write_block_v2(lzsa_compressor *pCompressor, const unsigne nReducedCompressedSize = lzsa_get_compressed_size_v2(pCompressor, pCompressor->improved_match - nPreviousBlockSize, nPreviousBlockSize, nPreviousBlockSize + nInDataSize); if (nReducedCompressedSize > 0 && nReducedCompressedSize <= nBaseCompressedSize) { + const int nEndOffset = nPreviousBlockSize + nInDataSize; + int nSupplementedCompressedSize; + /* Pick the parse with the reduced number of tokens as it didn't negatively affect the size */ pBestMatch = pCompressor->improved_match - nPreviousBlockSize; + + int* first_offset_for_byte = pCompressor->first_offset_for_byte; + int* next_offset_for_pos = pCompressor->next_offset_for_pos; + int nPosition; + + /* Supplement small matches */ + + memset(first_offset_for_byte, 0xff, sizeof(int) * 65536); + memset(next_offset_for_pos, 0xff, sizeof(int) * nInDataSize); + + for (nPosition = nPreviousBlockSize; nPosition < nEndOffset - 1; nPosition++) { + next_offset_for_pos[nPosition - nPreviousBlockSize] = first_offset_for_byte[((unsigned int)pInWindow[nPosition]) | (((unsigned int)pInWindow[nPosition + 1]) << 8)]; + first_offset_for_byte[((unsigned int)pInWindow[nPosition]) | (((unsigned int)pInWindow[nPosition + 1]) << 8)] = nPosition; + } + + for (nPosition = nPreviousBlockSize + 1; nPosition < (nEndOffset - 1); nPosition++) { + lzsa_match* match = pCompressor->match + ((nPosition - nPreviousBlockSize) << MATCHES_PER_INDEX_SHIFT_V2); + int m = 0, nInserted = 0; + int nMatchPos; + + while (m < 15 && match[m].length) + m++; + + for (nMatchPos = next_offset_for_pos[nPosition - nPreviousBlockSize]; m < 15 && nMatchPos >= 0; nMatchPos = next_offset_for_pos[nMatchPos - nPreviousBlockSize]) { + int nMatchOffset = nPosition - nMatchPos; + int nExistingMatchIdx; + int nAlreadyExists = 0; + + for (nExistingMatchIdx = 0; nExistingMatchIdx < m; nExistingMatchIdx++) { + if (match[nExistingMatchIdx].offset == nMatchOffset) { + nAlreadyExists = 1; + break; + } + } + + if (!nAlreadyExists) { + int nMatchLen = 2; + while (nMatchLen < 16 && (nPosition + nMatchLen + 4) < nEndOffset && !memcmp(pInWindow + nMatchPos + nMatchLen, pInWindow + nPosition + nMatchLen, 4)) + nMatchLen += 4; + while (nMatchLen < 16 && (nPosition + nMatchLen) < nEndOffset && pInWindow[nMatchPos + nMatchLen] == pInWindow[nPosition + nMatchLen]) + nMatchLen++; + match[m].length = nMatchLen; + match[m].offset = nMatchOffset; + m++; + nInserted++; + if (nInserted >= 15) + break; + } + } + } + + /* Compress optimally with the extra matches */ + memset(pCompressor->best_match, 0, BLOCK_SIZE * sizeof(lzsa_match)); + lzsa_optimize_forward_v2(pCompressor, pInWindow, pCompressor->best_match - nPreviousBlockSize, nPreviousBlockSize, nPreviousBlockSize + nInDataSize, 1 /* reduce */, 0 /* use forward reps */, nArrivalsPerPosition); + + nPasses = 0; + do { + nDidReduce = lzsa_optimize_command_count_v2(pCompressor, pInWindow, pCompressor->best_match - nPreviousBlockSize, nPreviousBlockSize, nPreviousBlockSize + nInDataSize); + nPasses++; + } while (nDidReduce && nPasses < 20); + + nSupplementedCompressedSize = lzsa_get_compressed_size_v2(pCompressor, pCompressor->best_match - nPreviousBlockSize, nPreviousBlockSize, nPreviousBlockSize + nInDataSize); + if (nSupplementedCompressedSize > 0 && nSupplementedCompressedSize < nReducedCompressedSize) { + /* Pick the parse with the extra matches as it didn't negatively affect the size */ + pBestMatch = pCompressor->best_match - nPreviousBlockSize; + } } } diff --git a/Tools/unix/lzsa/src/shrink_context.c b/Tools/unix/lzsa/src/shrink_context.c index c1e7ab3d..9e6900f7 100644 --- a/Tools/unix/lzsa/src/shrink_context.c +++ b/Tools/unix/lzsa/src/shrink_context.c @@ -62,6 +62,10 @@ int lzsa_compressor_init(lzsa_compressor *pCompressor, const int nMaxWindowSize, pCompressor->best_match = NULL; pCompressor->improved_match = NULL; pCompressor->arrival = NULL; + pCompressor->rep_slot_handled_mask = NULL; + pCompressor->rep_len_handled_mask = NULL; + pCompressor->first_offset_for_byte = NULL; + pCompressor->next_offset_for_pos = NULL; pCompressor->min_match_size = nMinMatchSize; if (pCompressor->min_match_size < nMinMatchSizeForFormat) pCompressor->min_match_size = nMinMatchSizeForFormat; @@ -89,7 +93,7 @@ int lzsa_compressor_init(lzsa_compressor *pCompressor, const int nMaxWindowSize, pCompressor->open_intervals = (unsigned int *)malloc((LCP_AND_TAG_MAX + 1) * sizeof(unsigned int)); if (pCompressor->open_intervals) { - pCompressor->arrival = (lzsa_arrival *)malloc(((BLOCK_SIZE + 1) << MATCHES_PER_ARRIVAL_SHIFT) * sizeof(lzsa_arrival)); + pCompressor->arrival = (lzsa_arrival *)malloc(((BLOCK_SIZE + 1) << ARRIVALS_PER_POSITION_SHIFT) * sizeof(lzsa_arrival)); if (pCompressor->arrival) { pCompressor->best_match = (lzsa_match *)malloc(BLOCK_SIZE * sizeof(lzsa_match)); @@ -102,8 +106,26 @@ int lzsa_compressor_init(lzsa_compressor *pCompressor, const int nMaxWindowSize, pCompressor->match = (lzsa_match *)malloc(BLOCK_SIZE * NMATCHES_PER_INDEX_V2 * sizeof(lzsa_match)); else pCompressor->match = (lzsa_match *)malloc(BLOCK_SIZE * NMATCHES_PER_INDEX_V1 * sizeof(lzsa_match)); - if (pCompressor->match) - return 0; + if (pCompressor->match) { + if (pCompressor->format_version == 2) { + pCompressor->rep_slot_handled_mask = (char*)malloc(NARRIVALS_PER_POSITION_V2_BIG * ((LCP_MAX + 1) / 8) * sizeof(char)); + if (pCompressor->rep_slot_handled_mask) { + pCompressor->rep_len_handled_mask = (char*)malloc(((LCP_MAX + 1) / 8) * sizeof(char)); + if (pCompressor->rep_len_handled_mask) { + pCompressor->first_offset_for_byte = (int*)malloc(65536 * sizeof(int)); + if (pCompressor->first_offset_for_byte) { + pCompressor->next_offset_for_pos = (int*)malloc(BLOCK_SIZE * sizeof(int)); + if (pCompressor->next_offset_for_pos) { + return 0; + } + } + } + } + } + else { + return 0; + } + } } } } @@ -124,6 +146,26 @@ int lzsa_compressor_init(lzsa_compressor *pCompressor, const int nMaxWindowSize, void lzsa_compressor_destroy(lzsa_compressor *pCompressor) { divsufsort_destroy(&pCompressor->divsufsort_context); + if (pCompressor->next_offset_for_pos) { + free(pCompressor->next_offset_for_pos); + pCompressor->next_offset_for_pos = NULL; + } + + if (pCompressor->first_offset_for_byte) { + free(pCompressor->first_offset_for_byte); + pCompressor->first_offset_for_byte = NULL; + } + + if (pCompressor->rep_len_handled_mask) { + free(pCompressor->rep_len_handled_mask); + pCompressor->rep_len_handled_mask = NULL; + } + + if (pCompressor->rep_slot_handled_mask) { + free(pCompressor->rep_slot_handled_mask); + pCompressor->rep_slot_handled_mask = NULL; + } + if (pCompressor->match) { free(pCompressor->match); pCompressor->match = NULL; diff --git a/Tools/unix/lzsa/src/shrink_context.h b/Tools/unix/lzsa/src/shrink_context.h index 70245cf6..ce80fbd2 100644 --- a/Tools/unix/lzsa/src/shrink_context.h +++ b/Tools/unix/lzsa/src/shrink_context.h @@ -49,10 +49,10 @@ extern "C" { #define VISITED_FLAG 0x80000000 #define EXCL_VISITED_MASK 0x7fffffff -#define NMATCHES_PER_ARRIVAL_V1 8 -#define NMATCHES_PER_ARRIVAL_V2_SMALL 9 -#define NMATCHES_PER_ARRIVAL_V2_BIG 32 -#define MATCHES_PER_ARRIVAL_SHIFT 5 +#define NARRIVALS_PER_POSITION_V1 8 +#define NARRIVALS_PER_POSITION_V2_SMALL 9 +#define NARRIVALS_PER_POSITION_V2_BIG 32 +#define ARRIVALS_PER_POSITION_SHIFT 5 #define NMATCHES_PER_INDEX_V1 8 #define MATCHES_PER_INDEX_SHIFT_V1 3 @@ -63,8 +63,6 @@ extern "C" { #define LEAVE_ALONE_MATCH_SIZE 300 #define LEAVE_ALONE_MATCH_SIZE_SMALL 1000 -#define LAST_LITERALS 0 - #define MODESWITCH_PENALTY 3 /** One match */ @@ -81,12 +79,10 @@ typedef struct { int from_pos; unsigned short rep_len; + unsigned short match_len; int rep_pos; int num_literals; int score; - - unsigned short match_offset; - unsigned short match_len; } lzsa_arrival; /** Compression statistics */ @@ -128,6 +124,10 @@ typedef struct _lzsa_compressor { lzsa_match *best_match; lzsa_match *improved_match; lzsa_arrival *arrival; + char *rep_slot_handled_mask; + char *rep_len_handled_mask; + int *first_offset_for_byte; + int *next_offset_for_pos; int min_match_size; int format_version; int flags; diff --git a/Tools/unix/uz80as/Makefile b/Tools/unix/uz80as/Makefile index 712c47b0..2f5b0ec6 100644 --- a/Tools/unix/uz80as/Makefile +++ b/Tools/unix/uz80as/Makefile @@ -4,7 +4,7 @@ DEST = ../../`uname` CC = gcc -CFLAGS = -g +CFLAGS = -g -fcommon OBJECTS = ngetopt.o main.o options.o \ utils.o err.o incl.o sym.o \ @@ -44,16 +44,13 @@ SOURCES = \ mc6800.c all: uz80as $(DEST) - cp uz80as $(DEST) + cp -p uz80as $(DEST) $(DEST): mkdir -p $(DEST) -clobber: clean - -rm -f uz80as $(DEST)/uz80as - clean: - -rm -f $(OBJECTS) + -rm -f $(OBJECTS) uz80as uz80as: $(OBJECTS) $(CC) $(CFLAGS) -o uz80as $(OBJECTS) diff --git a/Tools/unix/uz80as/targets.c b/Tools/unix/uz80as/targets.c index 742ef674..1b8bbc9d 100644 --- a/Tools/unix/uz80as/targets.c +++ b/Tools/unix/uz80as/targets.c @@ -14,6 +14,7 @@ extern const struct target s_target_z80; extern const struct target s_target_hd64180; +extern const struct target s_target_z280; extern const struct target s_target_gbcpu; extern const struct target s_target_dp2200; extern const struct target s_target_dp2200ii; @@ -40,6 +41,7 @@ extern const struct target s_target_m68hc11; static const struct target *s_targets[] = { &s_target_z80, &s_target_hd64180, + &s_target_z280, &s_target_gbcpu, &s_target_dp2200, &s_target_dp2200ii, diff --git a/Tools/unix/uz80as/z80.c b/Tools/unix/uz80as/z80.c index 4e2db514..214f6964 100644 --- a/Tools/unix/uz80as/z80.c +++ b/Tools/unix/uz80as/z80.c @@ -47,143 +47,146 @@ */ static const struct matchtab s_matchtab_z80[] = { - { "LD b,b", "40b0c1.", 3, 0 }, + { "LD b,b", "40b0c1.", 7, 0 }, { "LD p,p", "DD.40b0c1.", 1, 1 }, { "LD q,q", "FD.40b0c1.", 1, 1 }, - { "LD b,(HL)", "46b0.", 3, 0 }, - { "LD b,(e)", "d1.46b0.00.", 3, 0, "ii" }, - { "LD b,(ca)", "d1.46b0.d2.", 3, 0, "ii" }, - { "LD A,I", "ED.57.", 3, 0 }, - { "LD A,R", "ED.5F.", 3, 0 }, - { "LD A,(BC)", "0A.", 3, 0 }, - { "LD A,(DE)", "1A.", 3, 0 }, - { "LD A,(a)", "3A.e0", 3, 0 }, - { "LD b,a", "06b0.d1.", 3, 0, "e8" }, + { "LD b,(HL)", "46b0.", 7, 0 }, + { "LD b,(e)", "d1.46b0.00.", 7, 0, "ii" }, + { "LD b,(ca)", "d1.46b0.d2.", 7, 0, "ii" }, + { "LD A,I", "ED.57.", 7, 0 }, + { "LD A,R", "ED.5F.", 7, 0 }, + { "LD A,(BC)", "0A.", 7, 0 }, + { "LD A,(DE)", "1A.", 7, 0 }, + { "LD A,(a)", "3A.e0", 7, 0 }, + { "LD b,a", "06b0.d1.", 7, 0, "e8" }, { "LD p,a", "DD.06b0.d1.", 1, 1, "e8" }, { "LD q,a", "FD.06b0.d1.", 1, 1, "e8" }, - { "LD I,A", "ED.47.", 3, 0 }, - { "LD R,A", "ED.4F.", 3, 0 }, - { "LD SP,HL", "F9.", 3, 0 }, - { "LD SP,e", "d0.F9.", 3, 0 }, - { "LD HL,(a)", "2A.e0", 3, 0 }, - { "LD d,(a)", "ED.4Bf0.e1", 3, 0 }, - { "LD d,a", "01f0.e1", 3, 0 }, - { "LD e,(a)", "d0.2A.e1", 3, 0 }, - { "LD e,a", "d0.21.e1", 3, 0 }, - { "LD (HL),b", "70c0.", 3, 0 }, - { "LD (HL),a", "36.d0.", 3, 0, "e8" }, - { "LD (BC),A", "02.", 3, 0 }, - { "LD (DE),A", "12.", 3, 0 }, - { "LD (e),b", "d0.70c1.00.", 3, 0, "ii" }, - { "LD (ca),b", "d0.70c2.d1.", 3, 0, "ii" }, - { "LD (e),a", "d0.36.00.d1.", 3, 0, "iie8" }, - { "LD (ca),a", "d0.36.d1.d2.", 3, 0, "iie8" }, - { "LD (a),A", "32.e0", 3, 0 }, - { "LD (a),HL", "22.e0", 3, 0 }, - { "LD (a),d", "ED.43f1.e0", 3, 0 }, - { "LD (a),e", "d1.22.e0", 3, 0 }, - { "PUSH f", "C5f0.", 3, 0 }, - { "PUSH e", "d0.E5.", 3, 0 }, - { "POP f", "C1f0.", 3, 0 }, - { "POP e", "d0.E1.", 3, 0 }, - { "EX DE,HL", "EB.", 3, 0 }, - { "EX AF,AF'", "08.", 3, 0 }, - { "EX (SP),HL", "E3.", 3, 0 }, - { "EX (SP),e", "d0.E3.", 3, 0 }, - { "EXX", "D9.", 3, 0 }, - { "LDI", "ED.A0.", 3, 0 }, - { "LDIR", "ED.B0.", 3, 0 }, - { "LDD", "ED.A8.", 3, 0 }, - { "LDDR", "ED.B8.", 3, 0 }, - { "CPI", "ED.A1.", 3, 0 }, - { "CPIR", "ED.B1.", 3, 0 }, - { "CPD", "ED.A9.", 3, 0 }, - { "CPDR", "ED.B9.", 3, 0 }, - { "ADD HL,d", "09f0.", 3, 0 }, - { "ADD IX,i", "DD.09f0.", 3, 0 }, - { "ADD IY,j", "FD.09f0.", 3, 0 }, - { "ADC HL,d", "ED.4Af0.", 3, 0 }, - { "SBC HL,d", "ED.42f0.", 3, 0 }, - { "g A,b", "m080b0c1.", 3, 0 }, + { "LD I,A", "ED.47.", 7, 0 }, + { "LD R,A", "ED.4F.", 7, 0 }, + { "LD SP,HL", "F9.", 7, 0 }, + { "LD SP,e", "d0.F9.", 7, 0 }, + { "LD HL,(HL)", "ED.26.", 4, 0 }, // Z280 + { "LD HL,(a)", "2A.e0", 7, 0 }, + { "LD d,(a)", "ED.4Bf0.e1", 7, 0 }, + { "LD d,a", "01f0.e1", 7, 0 }, + { "LD e,(a)", "d0.2A.e1", 7, 0 }, + { "LD e,a", "d0.21.e1", 7, 0 }, + { "LD (HL),DE", "ED.1E.", 4, 0 }, // Z280 + { "LD (HL),b", "70c0.", 7, 0 }, + { "LD (HL),a", "36.d0.", 7, 0, "e8" }, + { "LD (BC),A", "02.", 7, 0 }, + { "LD (DE),A", "12.", 7, 0 }, + { "LD (e),b", "d0.70c1.00.", 7, 0, "ii" }, + { "LD (ca),b", "d0.70c2.d1.", 7, 0, "ii" }, + { "LD (e),a", "d0.36.00.d1.", 7, 0, "iie8" }, + { "LD (ca),a", "d0.36.d1.d2.", 7, 0, "iie8" }, + { "LD (a),A", "32.e0", 7, 0 }, + { "LD (a),HL", "22.e0", 7, 0 }, + { "LD (a),d", "ED.43f1.e0", 7, 0 }, + { "LD (a),e", "d1.22.e0", 7, 0 }, + { "PUSH f", "C5f0.", 7, 0 }, + { "PUSH e", "d0.E5.", 7, 0 }, + { "POP f", "C1f0.", 7, 0 }, + { "POP e", "d0.E1.", 7, 0 }, + { "EX DE,HL", "EB.", 7, 0 }, + { "EX AF,AF'", "08.", 7, 0 }, + { "EX (SP),HL", "E3.", 7, 0 }, + { "EX (SP),e", "d0.E3.", 7, 0 }, + { "EXX", "D9.", 7, 0 }, + { "LDI", "ED.A0.", 7, 0 }, + { "LDIR", "ED.B0.", 7, 0 }, + { "LDD", "ED.A8.", 7, 0 }, + { "LDDR", "ED.B8.", 7, 0 }, + { "CPI", "ED.A1.", 7, 0 }, + { "CPIR", "ED.B1.", 7, 0 }, + { "CPD", "ED.A9.", 7, 0 }, + { "CPDR", "ED.B9.", 7, 0 }, + { "ADD HL,A", "ED.6D.", 4, 0 }, // Z280 + { "ADD HL,d", "09f0.", 7, 0 }, + { "ADD IX,i", "DD.09f0.", 7, 0 }, + { "ADD IY,j", "FD.09f0.", 7, 0 }, + { "ADC HL,d", "ED.4Af0.", 7, 0 }, + { "SBC HL,d", "ED.42f0.", 7, 0 }, + { "g A,b", "m080b0c1.", 7, 0 }, { "g A,p", "DD.m080b0c1.", 1, 1 }, { "g A,q", "FD.m080b0c1.", 1, 1 }, - { "g A,(HL)", "m086b0.", 3, 0 }, - { "g A,(ca)", "m0d1.86b0.d2.", 3, 0, "ii" }, - { "g A,a", "m0C6b0.d1.", 3, 0, "e8" }, - { "g b", "n080b0c1.", 3, 0 }, + { "g A,(HL)", "m086b0.", 7, 0 }, + { "g A,(ca)", "m0d1.86b0.d2.", 7, 0, "ii" }, + { "g A,a", "m0C6b0.d1.", 7, 0, "e8" }, + { "g b", "n080b0c1.", 7, 0 }, { "g p", "DD.n080b0c1.", 1, 1 }, { "g q", "FD.n080b0c1.", 1, 1 }, - { "g (HL)", "n086b0.", 3, 0 }, - { "g (ca)", "n0d1.86b0.d2.", 3, 0, "ii" }, - { "g a", "n0C6b0.d1.", 3, 0, "e8" }, - { "h b", "04b1c0.", 3, 0 }, + { "g (HL)", "n086b0.", 7, 0 }, + { "g (ca)", "n0d1.86b0.d2.", 7, 0, "ii" }, + { "g a", "n0C6b0.d1.", 7, 0, "e8" }, + { "h b", "04b1c0.", 7, 0 }, { "h p", "DD.04b1c0.", 1, 1 }, { "h q", "FD.04b1c0.", 1, 1 }, - { "h (HL)", "34c0.", 3, 0 }, - { "h (ca)", "d1.34c0.d2.", 3, 0, "ii" }, - { "h (e)", "d1.34c0.00.", 3, 0, "ii" }, - { "INC d", "03f0.", 3, 0 }, - { "INC e", "d0.23.", 3, 0 }, - { "DEC d", "0Bf0.", 3, 0 }, - { "DEC e", "d0.2B.", 3, 0 }, - { "DAA", "27.", 3, 0 }, - { "CPL", "2F.", 3, 0 }, - { "NEG", "ED.44.", 3, 0 }, - { "CCF", "3F.", 3, 0 }, - { "SCF", "37.", 3, 0 }, - { "NOP", "00.", 3, 0 }, - { "HALT", "76.", 3, 0 }, - { "DI", "F3.", 3, 0 }, - { "EI", "FB.", 3, 0 }, - { "IM a", "ED.k0.", 3, 0, "tt" }, - { "RLCA", "07.", 3, 0 }, - { "RLA", "17.", 3, 0 }, - { "RRCA", "0F.", 3, 0 }, - { "RRA", "1F.", 3, 0 }, + { "h (HL)", "34c0.", 7, 0 }, + { "h (ca)", "d1.34c0.d2.", 7, 0, "ii" }, + { "h (e)", "d1.34c0.00.", 7, 0, "ii" }, + { "INC d", "03f0.", 7, 0 }, + { "INC e", "d0.23.", 7, 0 }, + { "DEC d", "0Bf0.", 7, 0 }, + { "DEC e", "d0.2B.", 7, 0 }, + { "DAA", "27.", 7, 0 }, + { "CPL", "2F.", 7, 0 }, + { "NEG", "ED.44.", 7, 0 }, + { "CCF", "3F.", 7, 0 }, + { "SCF", "37.", 7, 0 }, + { "NOP", "00.", 7, 0 }, + { "HALT", "76.", 7, 0 }, + { "DI", "F3.", 7, 0 }, + { "EI", "FB.", 7, 0 }, + { "IM a", "ED.k0.", 7, 0, "tt" }, + { "RLCA", "07.", 7, 0 }, + { "RLA", "17.", 7, 0 }, + { "RRCA", "0F.", 7, 0 }, + { "RRA", "1F.", 7, 0 }, { "SLL b", "CB.30c0.", 1, 1 }, { "SLL (HL)", "CB.36.", 1, 1 }, { "SLL (ca)", "d0.CB.d1.36.", 1, 1, "ii" }, { "SLL (ca),b", "d0.CB.d1.30c2.", 1, 1, "ii" }, - { "k b", "CB.00b0c1.", 3, 0 }, - { "k (HL)", "CB.06b0.", 3, 0 }, - { "k (ca)", "d1.CB.d2.06b0.", 3, 0, "ii" }, + { "k b", "CB.00b0c1.", 7, 0 }, + { "k (HL)", "CB.06b0.", 7, 0 }, + { "k (ca)", "d1.CB.d2.06b0.", 7, 0, "ii" }, { "k (ca),b", "d1.CB.d2.00b0c3.", 1, 1, "ii" }, - { "RLD", "ED.6F.", 3, 0 }, - { "RRD", "ED.67.", 3, 0 }, - { "l a,b", "CB.00g0b1c2.", 3, 0, "b3" }, - { "l a,(HL)", "CB.06g0b1.", 3, 0, "b3" }, - { "l a,(ca)", "d2.CB.d3.06g0b1.", 3, 0, "b3ii" }, + { "RLD", "ED.6F.", 7, 0 }, + { "RRD", "ED.67.", 7, 0 }, + { "l a,b", "CB.00g0b1c2.", 7, 0, "b3" }, + { "l a,(HL)", "CB.06g0b1.", 7, 0, "b3" }, + { "l a,(ca)", "d2.CB.d3.06g0b1.", 7, 0, "b3ii" }, { "RES a,(ca),b", "d1.CB.d2.80b0c3.", 1, 1, "b3ii" }, { "SET a,(ca),b", "d1.CB.d2.C0b0c3.", 1, 1, "b3ii" }, - { "JP (HL)", "E9.", 3, 0 }, - { "JP (e)", "d0.E9.", 3, 0 }, - { "JP m,a", "C2b0.e1", 3, 0 }, - { "JP a", "C3.e0", 3, 0 }, - { "JR n,a", "20b0.i1.", 3, 0, "r8" }, - { "JR a", "18.i0.", 3, 0, "r8" }, - { "DJNZ a", "10.i0.", 3, 0, "r8" }, - { "CALL m,a", "C4b0.e1", 3, 0 }, - { "CALL a", "CD.e0", 3, 0 }, - { "RETI", "ED.4D.", 3, 0 }, - { "RETN", "ED.45.", 3, 0 }, - { "RET m", "C0b0.", 3, 0 }, - { "RET", "C9.", 3, 0 }, - { "RST a", "C7j0.", 3, 0, "ss" }, - { "IN b,(C)", "ED.40b0.", 3, 0 }, - { "IN A,(a)", "DB.d0.", 3, 0, "e8" }, - { "IN F,(a)", "ED.70.", 3, 0 }, + { "JP (HL)", "E9.", 7, 0 }, + { "JP (e)", "d0.E9.", 7, 0 }, + { "JP m,a", "C2b0.e1", 7, 0 }, + { "JP a", "C3.e0", 7, 0 }, + { "JR n,a", "20b0.i1.", 7, 0, "r8" }, + { "JR a", "18.i0.", 7, 0, "r8" }, + { "DJNZ a", "10.i0.", 7, 0, "r8" }, + { "CALL m,a", "C4b0.e1", 7, 0 }, + { "CALL a", "CD.e0", 7, 0 }, + { "RETI", "ED.4D.", 7, 0 }, + { "RETN", "ED.45.", 7, 0 }, + { "RET m", "C0b0.", 7, 0 }, + { "RET", "C9.", 7, 0 }, + { "RST a", "C7j0.", 7, 0, "ss" }, + { "IN b,(C)", "ED.40b0.", 7, 0 }, + { "IN A,(a)", "DB.d0.", 7, 0, "e8" }, + { "IN F,(a)", "ED.70.", 7, 0 }, { "IN (C)", "ED.70.", 1, 1 }, - { "INI", "ED.A2.", 3, 0 }, - { "INIR", "ED.B2.", 3, 0 }, - { "IND", "ED.AA.", 3, 0 }, - { "INDR", "ED.BA.", 3, 0 }, + { "INI", "ED.A2.", 7, 0 }, + { "INIR", "ED.B2.", 7, 0 }, + { "IND", "ED.AA.", 7, 0 }, + { "INDR", "ED.BA.", 7, 0 }, { "OUT (C),0", "ED.71.", 1, 1 }, - { "OUT (C),b", "ED.41b0.", 3, 0 }, - { "OUT (a),A", "D3.d0.", 3, 0, "e8" }, - { "OUTI", "ED.A3.", 3, 0 }, - { "OTIR", "ED.B3.", 3, 0 }, - { "OUTD", "ED.AB.", 3, 0 }, - { "OTDR", "ED.BB.", 3, 0 }, + { "OUT (C),b", "ED.41b0.", 7, 0 }, + { "OUT (a),A", "D3.d0.", 7, 0, "e8" }, + { "OUTI", "ED.A3.", 7, 0 }, + { "OTIR", "ED.B3.", 7, 0 }, + { "OUTD", "ED.AB.", 7, 0 }, + { "OTDR", "ED.BB.", 7, 0 }, /* hd64180 added instructions */ { "IN0 b,(a)", "ED.00b0.d1.", 2, 0, "e8" }, { "OUT0 (a),b", "ED.01b1.d0.", 2, 0, "e8" }, @@ -197,6 +200,23 @@ static const struct matchtab s_matchtab_z80[] = { { "TST (HL)", "ED.34.", 2, 0 }, { "TST a", "ED.64.d0.", 2, 0, "e8" }, { "TSTIO a", "ED.74.d0.", 2, 0, "e8" }, + /* Z280 added instructions */ + { "PCACHE", "ED.65.", 4, 0 }, + { "LDCTL (C),HL", "ED.6E.", 4, 0 }, + { "LDCTL HL,(C)", "ED.66.", 4, 0 }, + { "LDCTL USP,HL", "ED.8F.", 4, 0 }, + { "LDCTL IY,(C)", "FD.ED.66.", 4, 0 }, + { "LDCTL (C),IY", "FD.ED.6E.", 4, 0 }, + { "MULTU A,a", "FD.ED.F9.d0.", 4, 0 }, + { "OUTW (C),HL", "ED.BF.", 4, 0 }, + { "RETIL", "ED.55.", 4, 0 }, + { "EI a", "ED.7F.d0.", 4, 0 }, + { "SC a", "ED.71.e0", 4, 0 }, + { "OTIRW", "ED.93.", 4, 0 }, + { "LDUD A,(HL)", "ED.86.", 4, 0 }, + { "LDUP A,(HL)", "ED.96.", 4, 0 }, + { "ADD HL,A", "ED.6D.", 4, 0 }, + { "INW HL,(C)", "ED.B7.", 4, 0 }, { NULL, NULL }, }; @@ -278,7 +298,7 @@ static int gen_z80(int *eb, char p, const int *vs, int i, int savepc) } b |= vs[i]; break; - case 'k': if (s_pass > 0 && (vs[i] < 0 || vs[i] > 2)) { + case 'k': if (s_pass > 0 && (vs[i] < 0 || vs[i] > 3)) { eprint(_("invalid IM argument (%d)\n"), vs[i]); eprcol(s_pline, s_pline_ep); @@ -289,6 +309,8 @@ static int gen_z80(int *eb, char p, const int *vs, int i, int savepc) b = 0x56; else if (vs[i] == 2) b = 0x5E; + else if (vs[i] == 3) + b = 0x4E; break; case 'm': if (s_pass == 0 && !s_extended_op) { if (vs[i] != 0 && vs[i] != 1 && vs[i] != 3) { @@ -360,3 +382,14 @@ const struct target s_target_hd64180 = { .pat_next_str = pat_next_str_z80, .mask = 2 }; + +const struct target s_target_z280 = { + .id = "z280", + .descr = "Zilog Z280", + .matcht = s_matchtab_z80, + .matchf = match_z80, + .genf = gen_z80, + .pat_char_rewind = pat_char_rewind_z80, + .pat_next_str = pat_next_str_z80, + .mask = 4 +}; diff --git a/Tools/unix/zx/Makefile b/Tools/unix/zx/Makefile deleted file mode 100644 index 995d1243..00000000 --- a/Tools/unix/zx/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# hacked up brute force makefile for linux and osx -# -UNAME := $(shell uname) -ifeq ($(UNAME), Linux) - SUFFIX=linux -endif -ifeq ($(UNAME), Darwin) - SUFFIX=darwin -endif - -DEST = ../../$(UNAME) -CFLAGS = -g # -DDEBUG - -OBJECTS = zx.o cpmdrv.o cpmglob.o cpmparse.o cpmredir.o \ - drdos.o util.o xlt.o zxbdos.o zxcbdos.o zxdbdos.o z80.o -UNUSED = dirent.o - -all: zx $(DEST) - cp bios.bin zx $(DEST) - -$(DEST): - mkdir -p $(DEST) - -clean: - -rm -f $(OBJECTS) config.h - -clobber: clean - -rm -f $(DEST)/zx $(DEST)/bios.bin zx - -$(OBJECTS): config.h - -zx: $(OBJECTS) - $(CC) -o zx $(OBJECTS) - -config.h: config.h.$(SUFFIX) - cp config.h.$(SUFFIX) config.h diff --git a/Tools/unix/zx/cbops.h b/Tools/unix/zx/cbops.h deleted file mode 100644 index 47b69da0..00000000 --- a/Tools/unix/zx/cbops.h +++ /dev/null @@ -1,172 +0,0 @@ -/* Emulations of the CB operations of the Z80 instruction set. - * Copyright (C) 1994 Ian Collier. - * - * 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. - */ - -#define var_t unsigned char t -#define rlc(x) (x=(x<<1)|(x>>7),rflags(x,x&1)) -#define rrc(x) do{var_t=x&1;x=(x>>1)|(t<<7);rflags(x,t);}while(0) -#define rl(x) do{var_t=x>>7;x=(x<<1)|(f&1);rflags(x,t);}while(0) -#define rr(x) do{var_t=x&1;x=(x>>1)|(f<<7);rflags(x,t);}while(0) -#define sla(x) do{var_t=x>>7;x<<=1;rflags(x,t);}while(0) -#define sra(x) do{var_t=x&1;x=((signed char)x)>>1;rflags(x,t);}while(0) -#define sll(x) do{var_t=x>>7;x=(x<<1)|1;rflags(x,t);}while(0) -#define srl(x) do{var_t=x&1;x>>=1;rflags(x,t);}while(0) - -#define rflags(x,c) (f=(c)|(x&0xa8)|((!x)<<6)|parity(x)) - -#define bit(n,x) (f=(f&1)|((x&(1<>3)&7; - switch(op&0xc7){ - case 0x40: bit(n,b); break; - case 0x41: bit(n,c); break; - case 0x42: bit(n,d); break; - case 0x43: bit(n,e); break; - case 0x44: bit(n,h); break; - case 0x45: bit(n,l); break; - case 0x46: tstates+=4;val=fetch(addr);bit(n,val);store(addr,val);break; - case 0x47: bit(n,a); break; - case 0x80: res(n,b); break; - case 0x81: res(n,c); break; - case 0x82: res(n,d); break; - case 0x83: res(n,e); break; - case 0x84: res(n,h); break; - case 0x85: res(n,l); break; - case 0x86: tstates+=4;val=fetch(addr);res(n,val);store(addr,val);break; - case 0x87: res(n,a); break; - case 0xc0: set(n,b); break; - case 0xc1: set(n,c); break; - case 0xc2: set(n,d); break; - case 0xc3: set(n,e); break; - case 0xc4: set(n,h); break; - case 0xc5: set(n,l); break; - case 0xc6: tstates+=4;val=fetch(addr);set(n,val);store(addr,val);break; - case 0xc7: set(n,a); break; - } - } - if(ixoriy)switch(reg){ - case 0:b=val; break; - case 1:c=val; break; - case 2:d=val; break; - case 3:e=val; break; - case 4:h=val; break; - case 5:l=val; break; - case 7:a=val; break; - } -} - -#undef var_t -#undef rlc -#undef rrc -#undef rl -#undef rr -#undef sla -#undef sra -#undef sll -#undef srl -#undef rflags -#undef bit -#undef set -#undef res diff --git a/Tools/unix/zx/config.h.darwin b/Tools/unix/zx/config.h.darwin deleted file mode 100644 index cc4b425c..00000000 --- a/Tools/unix/zx/config.h.darwin +++ /dev/null @@ -1,16 +0,0 @@ -//#define HAVE_WINDOWS_H -#define HAVE_DIRENT_H -#define HAVE_UTIME_H -#define HAVE_FCNTL_H -#define HAVE_UNISTD_H -#define BINDIR80 getenv("ZXBINDIR") -#define LIBDIR80 getenv("ZXLIBDIR") -#define INCDIR80 getenv("ZXINCDIR") -#define DARWIN -#include -#include -#define _S_IFDIR S_IFDIR -#define strcmpi(a,b) strcasecmp(a,b) -//#define WIN32 -//#define WINVER 0x0501 // target Windows XP -//#define _WIN32_WINNNT 0x0501 // target Windows XP diff --git a/Tools/unix/zx/config.h.linux b/Tools/unix/zx/config.h.linux deleted file mode 100644 index a015591c..00000000 --- a/Tools/unix/zx/config.h.linux +++ /dev/null @@ -1,17 +0,0 @@ -//#define HAVE_WINDOWS_H -#define HAVE_DIRENT_H -#define HAVE_UTIME_H -#define HAVE_FCNTL_H -#define HAVE_SYS_VFS_H -#define HAVE_UNISTD_H -#define BINDIR80 getenv("ZXBINDIR") -#define LIBDIR80 getenv("ZXLIBDIR") -#define INCDIR80 getenv("ZXINCDIR") -#define LINUX -#include -#include -#define _S_IFDIR S_IFDIR -#define strcmpi(a,b) strcasecmp(a,b) -//#define WIN32 -//#define WINVER 0x0501 // target Windows XP -//#define _WIN32_WINNNT 0x0501 // target Windows XP diff --git a/Tools/unix/zx/config.h.windows b/Tools/unix/zx/config.h.windows deleted file mode 100644 index 8186c485..00000000 --- a/Tools/unix/zx/config.h.windows +++ /dev/null @@ -1,9 +0,0 @@ -#define HAVE_WINDOWS_H -//#define HAVE_DIRENT_H -#define HAVE_FCNTL_H -#define BINDIR80 getenv("ZXBINDIR") -#define LIBDIR80 getenv("ZXLIBDIR") -#define INCDIR80 getenv("ZXINCDIR") -#define WIN32 -#define WINVER 0x0501 // target Windows XP -#define _WIN32_WINNNT 0x0501 // target Windows XP diff --git a/Tools/unix/zx/cpmdrv.c b/Tools/unix/zx/cpmdrv.c deleted file mode 100644 index 1faff21b..00000000 --- a/Tools/unix/zx/cpmdrv.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - - CPMREDIR: CP/M filesystem redirector - Copyright (C) 1998,2003 John Elliott - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - This file deals with drive-based functions. -*/ - -#include "cpmint.h" - -#ifdef WIN32 - -static char *drive_to_hostdrive(int cpm_drive) -{ - static char prefix[CPM_MAXPATH]; - char *lpfp; - DWORD dw; - - if (!redir_drive_prefix[cpm_drive]) return NULL; - dw = GetFullPathName(redir_drive_prefix[cpm_drive], sizeof(prefix), - prefix, &lpfp); - - if (!dw) return NULL; - if (prefix[1] == ':') /* If path starts with a drive, limit it */ - { /* to just that drive */ - prefix[2] = '/'; - prefix[3] = 0; - } - return prefix; -} -#endif - - -cpm_byte fcb_reset(void) -{ -#ifdef __MSDOS__ - bdos(0x0D, 0, 0); -#endif - - redir_l_drives = 0; - redir_cpmdrive = 0; /* A reset forces current drive to A: */ -/* redir_ro_drives = 0; Software write protect not revoked by func 0Dh. - * - * This does not follow true CP/M, but does match many 3rd-party replacements. - */ - return 0; -} - - -cpm_word fcb_drive (cpm_byte drv) -{ - if (redir_drive_prefix[drv][0]) - { - redir_cpmdrive = drv; - redir_log_drv(drv); - return 0; - } - else return 0x04FF; /* Drive doesn't exist */ -} - -cpm_byte fcb_getdrv(void) -{ - return redir_cpmdrive; -} - - -cpm_byte fcb_user (cpm_byte usr) -{ - if (usr != 0xFF) redir_cpmuser = usr % 16; - - redir_Msg("User: parameter %d returns %d\r\n", usr, redir_cpmuser); - - return redir_cpmuser; -} - - - -cpm_word fcb_logvec(void) -{ - return redir_l_drives; -} - - -cpm_word fcb_rovec(void) -{ - return redir_ro_drives; -} - - -cpm_word fcb_rodisk(void) -{ - cpm_word mask = 1; - - if (redir_cpmdrive) mask = mask << redir_cpmdrive; - - redir_ro_drives |= mask; - return 0; -} - - -cpm_word fcb_resro(cpm_word bitmap) -{ - redir_ro_drives &= ~bitmap; - - return 0; -} - - -cpm_word fcb_sync(cpm_byte flag) -{ -#ifdef WIN32 - return 0; -#else - sync(); return 0; /* Apparently some sync()s are void not int */ -#endif -} - - -cpm_word fcb_purge() -{ -#ifdef WIN32 - return 0; -#else - sync(); return 0; /* Apparently some sync()s are void not int */ -#endif -} - - -static cpm_byte exdpb[0x11] = { - 0x80, 0, /* 128 records/track */ - 0x04, 0x0F, /* 2k blocks */ - 0x00, /* 16k / extent */ - 0xFF, 0x0F, /* 4095 blocks */ - 0xFF, 0x03, /* 1024 dir entries */ - 0xFF, 0xFF, /* 16 directory blocks */ - 0x00, 0x80, /* Non-removable media */ - 0x00, 0x00, /* No system tracks */ - 0x02, 0x03 /* 512-byte sectors */ -}; - -cpm_word fcb_getdpb(cpm_byte *dpb) -{ -#ifdef WIN32 - DWORD spc, bps, fc, tc; - unsigned bsh, blm, psh, phm; - char *hostd = drive_to_hostdrive(redir_cpmdrive); - - if (!hostd) return 0x01FF; /* Can't select */ - - if (!GetDiskFreeSpace(hostd, &spc, &bps, &fc, &tc)) - return 0x01FF; /* Can't select */ - - /* Store total clusters */ - //if (tc > 0x10000L) tc = 0x10000L; - if (tc > 0xFFFFL) tc = 0xFFFFL; - - psh = 0; phm = 0; - - while (bps > 128) /* Get sector size */ - { - bps /= 2; - psh++; - phm = (phm << 1) | 1; - } - bsh = psh; blm = phm; - while (spc > 1) /* Get cluster size */ - { - spc /= 2; - bsh++; - blm = (blm << 1) | 1; - } - - - exdpb[2] = bsh; - exdpb[3] = blm; - exdpb[5] = tc & 0xFF; - exdpb[6] = tc >> 8; - - exdpb[15] = psh; - exdpb[16] = phm; -#else - struct statfs buf; - cpm_word nfiles; - - /* Get DPB for redir_cpmdrive. Currently just returns a dummy. */ - if (!statfs(redir_drive_prefix[redir_cpmdrive], &buf)) - { - /* Store correct directory entry count */ - - if (buf.f_files >= 0x10000L) nfiles = 0xFFFF; - else nfiles = buf.f_files; - - exdpb[7] = nfiles & 0xFF; - exdpb[8] = nfiles >> 8; - } -#endif - - memcpy(dpb, &exdpb, 0x11); - return 0x11; -} - - -/* Create an entirely bogus ALV - * TODO: Make it a bit better */ - -cpm_word fcb_getalv(cpm_byte *alv, cpm_word max) -{ - if (max > 1024) max = 1024; - - memset(alv, 0xFF, max / 2); - memset(alv + (max / 2), 0, max / 2); - - return max; -} - -/* Get disk free space */ - -cpm_word fcb_dfree (cpm_byte drive, cpm_byte *dma) -{ -#ifdef WIN32 - DWORD spc, bps, fc, tc; - DWORD freerec; - char *hostd = drive_to_hostdrive(drive); - - if (!hostd) return 0x01FF; - if (!hostd) return 0x01FF; /* Can't select */ - - if (!GetDiskFreeSpace(hostd, &spc, &bps, &fc, &tc)) - return 0x01FF; /* Can't select */ - - freerec = fc; /* Free clusters */ - freerec *= spc; /* Free sectors */ - freerec *= (bps / 128); /* Free CP/M records */ - - /* Limit to maximum CP/M drive size */ - if (freerec > 4194303L) freerec = 4194303L; - redir_wr24(dma, freerec); - -#else - struct statfs buf; - long dfree; - - if (!redir_drive_prefix[drive]) return 0x01FF; /* Can't select */ - - if (statfs(redir_drive_prefix[drive], &buf)) return 0x01FF; - - dfree = (buf.f_bavail * (buf.f_bsize / 128)); - - if (dfree < buf.f_bavail || /* Calculation has wrapped round */ - dfree > 4194303L) /* Bigger than max CP/M drive size */ - { - dfree = 4194303L; - } - - redir_wr24(dma, dfree); -#endif - return 0; -} - - - diff --git a/Tools/unix/zx/cpmglob.c b/Tools/unix/zx/cpmglob.c deleted file mode 100644 index 20306e09..00000000 --- a/Tools/unix/zx/cpmglob.c +++ /dev/null @@ -1,579 +0,0 @@ -/* - - CPMREDIR: CP/M filesystem redirector - Copyright (C) 1998, John Elliott - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - This file implements those BDOS functions that use wildcard expansion. -*/ - -#include "cpmint.h" - -static cpm_byte *find_fcb; -static int find_n; -static int find_ext = 0; -static int find_xfcb = 0; -static int entryno; -static cpm_byte lastdma[0x80]; -static long lastsize; -static char target_name[CPM_MAXPATH]; - -static char upper(char c) -{ - if (islower(c)) return toupper(c); - return c; -} - -/* - * we need to handle case sensitive filesystems correctly. - * underlying files need to just work, irrespective if the files - * in the native filesystem are mixed, upper or lower. - * the naive code in the distributed zx will not work everywhere. - */ - -/* Does the string "s" match the CP/M FCB? */ -/* pattern[0-10] will become a CP/M name parsed from "s" if it matches. */ -/* If 1st byte of FCB is '?' then anything matches. */ - -static int cpm_match(char *s, cpm_byte *fcb, cpm_byte *pattern) -{ - int n, m; - char *dotpos; - - m = strlen(s); - - /* - * let's cook the filename into something that we can match against - * the fcb. we reject any that can't be valid cp/m filenames, - * normalizing case as we go. all this goes into 'pattern' - */ - for (n = 0; n < 11; n++) pattern[n] = ' '; - - /* The name must have 1 or 0 dots */ - dotpos = strchr(s, '.'); - if (!dotpos) { /* No dot. The name must be at most 8 characters */ - if (m > 8) return 0; - for (n = 0; n < m; n++) { - pattern[n] = upper(s[n]) & 0x7F; - } - } else { /* at least one dot */ - if (strchr(dotpos + 1, '.')) { /* More than 1 dot */ - return 0; - } - if (dotpos == s) { /* Dot right at the beginning */ - return 0; - } - if ((dotpos - s) > 8) { /* "name" > 8 characters */ - return 0; - } - if (strlen(dotpos + 1) > 3) { /* "type" > 3 characters */ - return 0; - } - for (n = 0; n < (dotpos - s); n++) { /* copy filename portion */ - pattern[n] = upper(s[n]) & 0x7F; - } - m = strlen(dotpos + 1); - for (n = 0; n < m; n++) { /* copy extention portion */ - pattern[n + 8] = upper(dotpos[n + 1]) & 0x7F; - } - } - - /* - * handle special case where fcb[0] == '?' or fcb[0] & 0x80 - * this is used to return a full directory list on bdos's - */ - if (((fcb[0] & 0x7F) == '?') || (fcb[0] & 0x80)) { - return 1; - } - - for (n = 0; n < 11; n++) { - if (fcb[n+1] == '?') continue; - if ((pattern[n] & 0x7F) != (fcb[n+1] & 0x7F)) { - return 0; - } - } - return 1; /* Success! */ -} - - -/* Get the next entry from the host's directory matching "fcb" */ - -static struct dirent * next_entry(DIR *dir, cpm_byte *fcb, cpm_byte *pattern, - struct stat *st) -{ - struct dirent *en; - int unsatisfied; - int drv = fcb[0] & 0x7F; - - if (drv == '?') drv = 0; - if (!drv) drv = redir_cpmdrive; - else drv--; - - for (unsatisfied = 1; unsatisfied; ) - { - /* 1. Get the next entry */ - - en = readdir(dir); - if (!en) return NULL; /* No next entry */ - ++entryno; /* 0 for 1st, 1 for 2nd, etc. */ - - /* 2. See if it matches. We do this first (in preference to - seeing if it's a subdirectory first) because it doesn't - require disc access */ - if (!cpm_match(en->d_name, fcb, pattern)) - { - continue; - } - /* 3. Stat it, & reject it if it's a directory */ - - strcpy(target_name, redir_drive_prefix[drv]); - strcat(target_name, en->d_name); - - if (stat(target_name, st)) - { - redir_Msg("Can't stat %s so omitting it.\n", target_name); - continue; /* Can't stat */ - } - //if (S_ISDIR(st->st_mode)) - if ((st->st_mode) & _S_IFDIR) - { - /* Searching for files only */ - if (fcb[0] != '?' && fcb[0] < 0x80) - { - continue; - } - } - unsatisfied = 0; - } - return en; -} - - - -void volume_label(int drv, cpm_byte *dma) -{ - struct stat st; - - memset(dma, 0x20, 12); /* Volume label */ - - /* Get label name */ - redir_get_label(drv, (char *)(dma + 1)); - /* [0x0c] = label byte - * [0x0d] = password byte (=0) - * [0x10-0x17] = password - * [0x18] = label create date - * [0x1c] = label update date - */ -#ifdef __MSDOS__ - dma[0x0c] = 0x21; /* Under DOS, only "update" */ - if (redir_drdos) dma[0x0c] |= 0x80; /* Under DRDOS, passwords allowed */ -#else - dma[0x0c] = 0x61; /* Label exists and time stamps allowed */ -#endif /* (update & access) */ - dma[0x0d] = 0; /* Label not passworded */ - dma[0x0f] = 0x80; /* Non-CP/M media */ - - if (stat(redir_drive_prefix[drv], &st)) - { - redir_Msg("stat() fails on '%s'\n", redir_drive_prefix[drv]); - return; - } - - redir_wr32(dma + 0x18, redir_cpmtime(st.st_atime)); - redir_wr32(dma + 0x1C, redir_cpmtime(st.st_mtime)); -} - - - -cpm_word redir_find(int n, cpm_byte *fcb, cpm_byte *dma) -{ - DIR *hostdir; - int drv, attrib; - long recs; - struct stat st; - struct dirent *de; - cpm_word rights; - - drv = (fcb[0] & 0x7F); - if (!drv || drv == '?') drv = redir_cpmdrive; - else drv--; - - if (find_xfcb) /* Return another extent */ - { - memcpy(dma, lastdma, 0x80); - dma[0] |= 0x10; /* XFCB */ - dma[0x0c] = dma[0x69]; /* Password mode */ - dma[0x0d] = 0x0A; /* Password decode byte */ - memset(dma + 0x10, '*', 7); - dma[0x17] = ' '; /* Encoded password */ - memcpy(lastdma, dma, 0x80); - - find_xfcb = 0; - return 0; - } - - if (find_ext) /* Return another extent */ - { - memcpy(dma, lastdma, 0x80); - dma[0x0c]++; - if (dma[0x0c] == 0x20) - { - dma[0x0c] = 0; - dma[0x0e]++; - } - lastsize -= 0x4000; - recs = (lastsize + 127) / 128; - dma[0x0f] = (recs > 127) ? 0x80 : (recs & 0x7F); - - if (lastsize <= 0x4000) find_ext = 0; - memcpy(lastdma, dma, 0x80); - - return 0; - } - - - memset(dma, 0, 128); /* Zap the buffer */ - - /* - If returning all entries, return a volume label. - */ - if ((fcb[0] & 0x7F) == '?') - { - if (!n) - { - volume_label(drv, dma); - return 0; - } - else --n; - } - - /* Note: This implies that opendir() works on a filename with a - trailing slash. It does under Linux, but that's the only assurance - I can give. - */ - - entryno = -1; - hostdir = opendir(redir_drive_prefix[drv]); - - if (!hostdir) - { - redir_Msg("opendir() fails on '%s'\n", redir_drive_prefix[drv]); - return 0xFF; - } - /* We have a handle to the directory. */ - while (n >= 0) - { - de = next_entry(hostdir, fcb, dma + 1, &st); - if (!de) return 0xFF; - --n; - } - /* Valid entry found & statted. dma+1 holds filename. */ - - dma[0] = redir_cpmuser; /* Uid always matches */ - dma[0x0c] = 0; /* Extent counter, low */ - dma[0x0d] = st.st_size & 0x7F; /* Last record byte count */ - dma[0x0e] = 0; /* Extent counter, high */ - -#ifdef __MSDOS__ - _dos_getfileattr(target_name, (unsigned int *)&attrib); - rights = redir_drdos_get_rights(target_name); - if (rights && ((fcb[0] & 0x7F) == '?')) find_xfcb = 1; -#else - attrib = 0; - rights = 0; -#endif - if (attrib & 1) dma[9] |= 0x80; - if (attrib & 4) dma[10] |= 0x80; - if (!(attrib & 0x20)) dma[11] |= 0x80; - - - -/* TODO: Under Unix, work out correct RO setting */ - - recs = (st.st_size + 127) / 128; - dma[0x0f] = (recs > 127) ? 0x80 : (recs & 0x7F); - dma[0x10] = 0x80; - //if (S_ISDIR(st.st_mode)) dma[0x10] |= 0x40; - if ((st.st_mode) & _S_IFDIR) {dma[0x10] |= 0x40;} - if (attrib & 2) dma[0x10] |= 0x20; - dma[0x10] |= ((entryno & 0x1FFF) >> 8); - dma[0x11] = dma[0x10]; - dma[0x12] = entryno & 0xFF; - - redir_wr32(dma + 0x16, st.st_mtime); /* Modification time. */ - /* TODO: It should be in DOS */ - /* format */ - /* TODO: At 0x1A, 1st cluster */ - redir_wr32(dma + 0x1C, st.st_size); /* True size */ - - if (rights) /* Store password mode. Don't return an XFCB. */ - { - dma[0x69] = redir_cpm_pwmode(rights); - memcpy(lastdma, dma, 0x80); - } - - dma[0x60] = 0x21; /* XFCB */ - redir_wr32(dma + 0x61, redir_cpmtime(st.st_atime)); - redir_wr32(dma + 0x65, redir_cpmtime(st.st_mtime)); - - closedir(hostdir); - - if (st.st_size > 0x4000 && (fcb[0x0C] == '?')) /* All extents? */ - { - lastsize = st.st_size; - find_ext = 1; - memcpy(lastdma, dma, 0x80); - } - return 0; -} - - -#ifdef DEBUG -#define SHOWNAME(func) \ - { \ - char fname[CPM_MAXPATH]; \ - redir_fcb2unix(fcb, fname); \ - redir_Msg(func "(\"%s\")\n", fname); \ - } - -#else - #define SHOWNAME(func) -#endif - -cpm_word fcb_find1 (cpm_byte *fcb, cpm_byte *dma) /* 0x11 */ -{ -#ifdef DEBUG - int rv; -#endif - SHOWNAME("fcb_find1") - - redir_log_fcb(fcb); - - find_n = 0; - find_fcb = fcb; - find_ext = 0; - find_xfcb = 0; -#ifdef DEBUG - rv = redir_find(find_n, fcb, dma); - - if (rv < 4) - { - redir_Msg("Ret: %-11.11s\n", dma + 1); - } - else redir_Msg("Ret: Fail\n"); - return rv; -#else - return redir_find(find_n, find_fcb, dma); -#endif -} - -/* We don't bother with the FCB parameter - it's undocmented, and - * programs that do know about it will just pass in the same parameter - * that they did to function 0x11 */ - -cpm_word fcb_find2 (cpm_byte *fcb, cpm_byte *dma) /* 0x12 */ -{ -#ifdef DEBUG - int rv; - - char fname[CPM_MAXPATH]; - redir_fcb2unix(find_fcb, fname); - redir_Msg("fcb_find2(\"%s\") no. %d\n", fname, find_n); -#endif - ++find_n; -#ifdef DEBUG - rv = redir_find(find_n, find_fcb, dma); - - if (rv < 4) - { - redir_Msg("Ret: %-11.11s\n", dma + 1); - } - else redir_Msg("Ret: Fail\n"); - return rv; -#else - return redir_find(find_n, find_fcb, dma); -#endif -} - -/* Under CP/M, unlinking works with wildcards */ - -cpm_word fcb_unlink(cpm_byte *fcb, cpm_byte *dma) -{ - DIR *hostdir; - int drv; - struct dirent *de; - struct stat st; - int handle = 0; - int unpasswd = 0; - char fname[CPM_MAXPATH]; - - SHOWNAME("fcb_unlink") - - if (fcb[5] & 0x80) unpasswd = 1; /* Remove password rather than file */ - - redir_log_fcb(fcb); - - drv = (fcb[0] & 0x7F); - if (!drv || drv == '?') drv = redir_cpmdrive; - else drv--; - - if (redir_ro_drv(drv)) return 0x02FF; /* Error: R/O drive */ - -#ifdef DEBUG - redir_fcb2unix(fcb, fname); - redir_Msg("fcb_unlink(\"%s\")\n", fname); -#endif - - /* Note: This implies that opendir() works on a filename with a - trailing slash. It does under Linux, but that's the only assurance - I can give. - */ - - hostdir = opendir(redir_drive_prefix[drv]); - - if (!hostdir) - { - redir_Msg("opendir() fails on '%s'\n", redir_drive_prefix[drv]); - return 0xFF; - } - /* We have a handle to the directory. */ - do - { - de = next_entry(hostdir, fcb, (cpm_byte *)fname, &st); - if (de) - { - strcpy(target_name, redir_drive_prefix[drv]); - strcat(target_name, de->d_name); - redir_Msg("Deleting %s\n", de->d_name); - if (unpasswd) - { -#ifdef __MSDOS__ - if (redir_drdos) - { - handle = redir_drdos_put_rights (target_name, dma, 0); - } - else handle = 0; -#endif - } - else if (fcb[0] & 0x80) - { - handle = rmdir(target_name); - if (handle && redir_password_error()) - { - redir_password_append(target_name, dma); - handle = rmdir(target_name); - } - } - else - { - handle = unlink(target_name); - if (handle && redir_password_error()) - { - redir_password_append(target_name, dma); - handle = unlink(target_name); - } - } - - if (handle) de = NULL; /* Delete failed */ - } - } - while (de != NULL); - if (handle) - { - redir_Msg("Ret: -1\n"); - closedir(hostdir); - return 0xFF; - } - redir_Msg("Ret: 0\n"); - closedir(hostdir); - return 0; -} - - - - - -#ifdef __MSDOS__ -cpm_word redir_get_label(cpm_byte drv, char *pattern) -{ - char strs[10]; - struct ffblk fblk; - int done; - char *s; - int n; - - /* We need the drive prefix to be of the form "C:\etc..." */ - - memset(pattern, ' ', 11); - if (!redir_drive_prefix[drv][0] || redir_drive_prefix[drv][1] != ':') - return 0; - - sprintf(strs,"%c:/*.*", redir_drive_prefix[drv][0]); - - done = findfirst(strs, &fblk, FA_LABEL); - while (!done) - { - if ((fblk.ff_attrib & FA_LABEL) && - !(fblk.ff_attrib & (FA_SYSTEM | FA_HIDDEN))) - { - s = strchr(fblk.ff_name, '/'); - if (!s) s = strchr(fblk.ff_name, '\\'); - if (!s) s = strchr(fblk.ff_name, ':'); - if (!s) s = fblk.ff_name; - for (n = 0; n < 11; n++) - { - if (!(*s)) break; - if (*s == '.') - { - n = 7; - ++s; - continue; - } - pattern[n] = upper(*s); - ++s; - } - return 1; - } - done = findnext(&fblk); - } - return 0; -} -#else -cpm_word redir_get_label(cpm_byte drv, char *pattern) -{ - char *dname; - int l, n; - - memset(pattern, ' ', 11); - - dname = strrchr(redir_drive_prefix[drv], '/'); - if (dname) - { - ++dname; - l = strlen(dname); - if (l > 11) l = 11; - for (n = 0; n < l; n++) pattern[n] = upper(dname[l]); - } - else - { - pattern[0] = '.'; - } - return 0; -} - - - -#endif diff --git a/Tools/unix/zx/cpmint.h b/Tools/unix/zx/cpmint.h deleted file mode 100644 index f0ec4237..00000000 --- a/Tools/unix/zx/cpmint.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - - CPMREDIR: CP/M filesystem redirector - Copyright (C) 1998, John Elliott - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - This file holds internal declarations for the library. -*/ - -#include "config.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_DIRENT_H -# include -#else -#ifdef __WATCOMC__ -# include -# include -#else -# include "dirent.h" -#endif -#endif -#ifdef HAVE_NDIR_H -# include -#endif -#ifdef HAVE_SYS_DIR_H -# include -#endif -#ifdef HAVE_SYS_NDIR_H -# include -#endif -#ifdef HAVE_WINDOWS_H -# include -#endif -#ifdef HAVE_WINNT_H -# include -#endif -#ifdef HAVE_SYS_VFS_H -# include -#endif -#ifdef HAVE_UTIME_H -# include -#endif -#ifdef HAVE_FCNTL_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif - - -#ifdef __MSDOS__ - #include - #include - #include - #ifdef __GO32__ - #include - #include - #include - #endif -#endif - -#define CASE_SENSITIVE_FILESYSTEM 0 - - -#include "cpmredir.h" - -typedef unsigned long dword; /* Must be at least 32 bits, and - >= sizeof(int) */ -#ifdef CPMDEF - #define EXT - #define INIT(x) =x -#else - #define EXT extern - #define INIT(x) -#endif - -/* The 16 directories to which the 16 CP/M drives are mapped */ - -EXT char redir_drive_prefix[16][CPM_MAXPATH]; - -/* Current drive and user */ - -EXT int redir_cpmdrive; -EXT int redir_cpmuser; - -/* Length of 1 read/write operation, bytes */ - -EXT int redir_rec_len INIT(128); - -/* Same, but in 128-byte records */ -EXT int redir_rec_multi INIT(1); - -/* Using a DRDOS system? */ -EXT int redir_drdos INIT(0); - -/* Default password */ -#ifdef __MSDOS__ -EXT char redir_passwd[8] INIT(""); -#endif - -EXT cpm_word redir_l_drives INIT(0); -EXT cpm_word redir_ro_drives INIT(0); - -#undef EXT -#undef INIT - - - -/* Convert FCB to a Unix filename, returning 1 if it's ambiguous */ -int redir_fcb2unix(cpm_byte *fcb, char *fname); - -/* Open FCB, set file attributes */ -int redir_ofile(cpm_byte * fcb, char *s); - -/* Check that the FCB we have is valid */ -int redir_verify_fcb(cpm_byte *fcb); - -#ifndef O_BINARY /* Necessary in DOS, not present in Linux */ -#define O_BINARY 0 -#endif - -/* Facilities for debug tracing */ - - -long zxlseek(int fd, long offset, int wh); - -#ifdef DEBUG - void redir_Msg(char *s, ...); - void redir_showfcb(cpm_byte *fcb); -#else - /* Warning: This is a GCC extension */ - #define redir_Msg(x, ...) - #define redir_showfcb(x) -#endif - - - -/* Get the "sequential access" file pointer out of an FCB */ - -long redir_get_fcb_pos(cpm_byte *fcb); - -/* Write "sequential access" pointer to FCB */ - -void redir_put_fcb_pos(cpm_byte *fcb, long npos); - -/* Convert time_t to CP/M day count/hours/minutes */ -dword redir_cpmtime(time_t t); -/* And back */ -time_t redir_unixtime(cpm_byte *c); - - -/* Functions to access 24-bit & 32-bit words in memory. These are always - little-endian. */ - -void redir_wr24(cpm_byte *addr, dword v); -void redir_wr32(cpm_byte *addr, dword v); -dword redir_rd24(cpm_byte *addr); -dword redir_rd32(cpm_byte *addr); - -/* If you have 64-bit file handles, you'll need to write separate wrhandle() - and rdhandle() routines */ -#define redir_wrhandle redir_wr32 -#define redir_rdhandle redir_rd32 - -/* Mark a drive as logged in */ - -void redir_log_drv(cpm_byte drv); -void redir_log_fcb(cpm_byte *fcb); - -/* Check if a drive is software read-only */ - -int redir_ro_drv(cpm_byte drv); -int redir_ro_fcb(cpm_byte *fcb); - -/* Translate errno to a CP/M error */ - -cpm_word redir_xlt_err(void); - -/* Get disc label */ -cpm_word redir_get_label(cpm_byte drv, char *pattern); - - -/* DRDOS set/get access rights - no-ops under MSDOS and Unix: - * - * CP/M password mode -> DRDOS password mode */ -cpm_word redir_drdos_pwmode(cpm_byte b); - -/* DRDOS password mode to CP/M password mode */ -cpm_byte redir_cpm_pwmode(cpm_word w); - -/* Get DRDOS access rights for a file */ -cpm_word redir_drdos_get_rights(char *path); - -/* Set DRDOS access rights and/or password */ -cpm_word redir_drdos_put_rights(char *path, cpm_byte *dma, cpm_word rights); - -/* Was the last error caused by invalid password? */ -cpm_word redir_password_error(void); - -/* Append password to filename (FILE.TYP -> FILE.TYP;PASSWORD) */ -void redir_password_append(char *s, cpm_byte *dma); - diff --git a/Tools/unix/zx/cpmparse.c b/Tools/unix/zx/cpmparse.c deleted file mode 100644 index 4c709ec1..00000000 --- a/Tools/unix/zx/cpmparse.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - - CPMREDIR: CP/M filesystem redirector - Copyright (C) 1998, John Elliott - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - This file parses filenames to FCBs. -*/ - -#include "cpmint.h" - -#define is_num(c) ((c >= '0') && (c <= '9')) - -static int parse_drive_user(char *txt, cpm_byte *fcb) -{ - char uid[4], drvid[4]; - int up, dp; - - for (up = dp = 0; *txt != ':'; ++txt) - { - if (is_num (*txt)) uid [up++] = *txt; - if (isalpha(*txt)) drvid[dp++] = *txt; - if (!is_num(*txt) && !isalpha(*txt)) return -1; - } - uid[up] = 0; drvid[dp] = 0; - - if (dp > 1) return -1; /* Invalid driveletter */ - if (up > 2) return -1; /* Invalid uid */ - - fcb[0x0d] = atoi(uid) + 1; if (fcb[0x0d] > 16) return -1; - - if (islower(drvid[0])) drvid[0] = toupper(drvid[0]); - - if (drvid[0] < 'A' || drvid[0] > 'P') return -1; - - fcb[0] = drvid[0] - '@'; - return 0; -} - - - -cpm_word fcb_parse(char *txt, cpm_byte *fcb) -{ - int nl = 0, tl = 0, pl = 0, phase = 0; - char *ntxt, ch; - - memset(fcb, 0, 0x24); - - if (txt[1] == ':' || txt[2] == ':' || txt[3] == ':') - { - if (parse_drive_user(txt, fcb)) return 0xFFFF; - /* Move past the colon */ - ntxt = strchr(txt, ':') + 1; - } - else ntxt = txt; - while (phase < 3) - { - ch = *ntxt; - if (islower(ch)) ch = toupper(ch); - - switch(ch) - { - case 0: - case '\r': /* EOL */ - phase = 4; - break; - - case '.': /* file.typ */ - if (!phase) ++phase; - else phase = 3; - break; - - case ';': /* Password */ - if (phase < 2) phase = 2; - else phase = 3; - break; - - case '[': case ']': case '=': case 9: case ' ': - case '>': case '<': case ':': case ',': case '/': - case '|': /* Terminator */ - phase = 3; - - default: - switch(phase) - { - case 0: - if (nl >= 8) return 0xFFFF; - fcb[++nl] = ch; - break; - - case 1: - if (tl >= 3) return 0xFFFF; - fcb[tl + 9] = ch; - ++tl; - break; - - case 2: - if (pl >= 8) return 0xFFFF; - fcb[pl + 0x10] = ch; - ++pl; - break; - } - break; - } - } - if (!nl) return 0xFFFF; - - fcb[0x1A] = pl; - - if (phase == 4) return 0; - - return ntxt - txt; -} diff --git a/Tools/unix/zx/cpmredir.c b/Tools/unix/zx/cpmredir.c deleted file mode 100644 index 4fd5f9ca..00000000 --- a/Tools/unix/zx/cpmredir.c +++ /dev/null @@ -1,931 +0,0 @@ -/* - - CPMREDIR: CP/M filesystem redirector - Copyright (C) 1998, John Elliott - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* This file handles actual reading and writing */ - -#define CPMDEF -#include "cpmint.h" - -#ifdef DEBUG -#define SHOWNAME(func) \ - { \ - char fname[CPM_MAXPATH]; \ - redir_fcb2unix(fcb, fname); \ - redir_Msg(func "(\"%s\")\n", fname); \ - } - -#else - #define SHOWNAME(func) -#endif - - -/* DISK BDOS FUNCTIONS */ - -/* General treatment: - * - * We use the "disk block number" fields in the FCB to store our file handle; - * this is a similar trick to that used by DOSPLUS, which stores its cluster - * number in there. It works if: - * - * a) sizeof(int) <= 8 bytes (64 bits). If it's more, this needs rewriting - * to use a hash table; - * b) the program never touches these bytes. Practically no CP/M program does. - * - * We store a "magic number" (0x00FD) in the first two bytes of this field, and - * if the number has been changed then we abort. - * - * nb: Since I wrote ZXCC, I have found that DOSPLUS uses 0x8080 as a magic - * number [well, actually this is an oversimplification, but a hypothetical - * program written against DOSPLUS would work with 0x8080]. Perhaps 0x8080 - * should be used instead. - * - * Format of the field: - * - * [--2 bytes--] magic number - * [--8 bytes--] file handle. 8 bytes reserved but only 4 currently used. - * [--2 bytes--] reserved. - * [--4 bytes--] file length. - */ -#define MAGIC_OFFSET 0x10 -#define HANDLE_OFFSET 0x12 -#define LENGTH_OFFSET 0x1C - -cpm_word fcb_open(cpm_byte *fcb, cpm_byte *dma) -{ - char fname[CPM_MAXPATH]; - int handle; - int drv, l; - char *s; - DIR *dir; - - /* Don't support ambiguous filenames */ - if (redir_fcb2unix(fcb, fname)) return 0x09FF; - - redir_log_fcb(fcb); - - drv = fcb[0] & 0x7F; - if (!drv) drv = redir_cpmdrive; else --drv; - - if (fcb[0] & 0x80) /* Open directory */ - { - if (fcb[0x0C]) return 0x0BFF; /* Can't assign "floating" dir */ - - if (!memcmp(fcb + 1, ". ", 11)) - { - return 0; /* Opening "." */ - } - if (!memcmp(fcb + 1, ".. ", 11)) - { - l = strlen(redir_drive_prefix[drv]) - 1; - s = redir_drive_prefix[drv]; - --l; - while (l > 0) - { - if (s[l] == '/') break; -#ifdef __MSDOS__ - if (s[l] == '\\') break; - if (s[l] == ':') break; -#endif - --l; - } -#ifdef __MSDOS__ - if (l < 2) return 0; /* "C:" */ -#else - if (l <= 0) return 0; /* "/" */ -#endif - ++l; - s[l] = 0; - return 0; - } -/* Opening some other directory */ - - dir = opendir(fname); - if (!dir) return 0xFF; /* Not a directory */ - closedir(dir); - strcpy(redir_drive_prefix[drv], fname); - strcat(redir_drive_prefix[drv], "/"); - return 0; - } - - /* Note: Some programs (MAC is an example) don't close a file - * if they opened it just to do reading. MAC then reopens the - * file (which rewinds it); this causes FCB leaks under some - * DOS-based emulators */ - - handle = redir_ofile(fcb, fname); - redir_Msg("fcb_open(\"%s\")\r\n", fname); - if (handle < 0 && redir_password_error()) - { - redir_Msg("1st chance open failed on %s\r\n", fname); - redir_password_append(fname, dma); - redir_Msg("Trying with %s\r\n", fname); - handle = redir_ofile(fcb, fname); - } - - - if (handle == -1) - { - redir_Msg("Ret: -1\n"); - if (redir_password_error()) return 0x7FF; - return 0xFF; - } - fcb[MAGIC_OFFSET ] = 0xFD; /* "Magic number" */ - fcb[MAGIC_OFFSET + 1] = 0x00; - -/* TODO: Should the magic number perhaps be 0x8080, as in DOSPLUS? */ - - redir_wrhandle(fcb + HANDLE_OFFSET, handle); - - redir_put_fcb_pos(fcb, fcb[0x0C] * 16384); - /* (v1.01) "seek" to beginning of extent, not file. - * This is necessary for the awful I/O code - * in LINK-80 to work - */ - - /* Get the file length */ - redir_wr32(fcb + 0x1C, zxlseek(handle, 0, SEEK_END)); - zxlseek(handle, 0, SEEK_SET); - - /* Set the last record byte count */ - if (fcb[0x20] == 0xFF) fcb[0x20] = fcb[0x1C] & 0x7F; - - redir_Msg("Ret: 0\n"); - - return 0; -} - - -cpm_word fcb_close(cpm_byte *fcb) -{ - int handle, drv; - - SHOWNAME("fcb_close") - - if ((handle = redir_verify_fcb(fcb)) < 0) return -1; - redir_Msg(" (at %lx)\n", zxlseek(handle, 0, SEEK_CUR)); - - if (fcb[0] & 0x80) /* Close directory */ - { - drv = fcb[0] & 0x7F; - if (!drv) drv = redir_cpmdrive; else drv--; -#ifdef __MSDOS__ - strcpy(redir_drive_prefix[drv] + 1, ":/"); -#else - strcpy(redir_drive_prefix[drv], "/"); -#endif - return 0; - } - - if (fcb[5] & 0x80) /* CP/M 3: Flush rather than close */ - { -#ifndef WIN32 - sync(); -#endif - return 0; - } - -#ifdef WIN32 - { - BOOL b; - redir_Msg(">CloseHandle() Handle=%lu\n", handle); - b = CloseHandle((HANDLE)handle); - redir_Msg("80h, let it be 80h - -*/ - - -cpm_word fcb_read(cpm_byte *fcb, cpm_byte *dma) -{ - int handle; - int rv, n, rd_len; - long npos; - - SHOWNAME("fcb_read") - - if ((handle = redir_verify_fcb(fcb)) < 0) return 9; /* Invalid FCB */ - - /* The program may have mucked about with the counters, so - * do an lseek() to where it should be. */ - - npos = redir_get_fcb_pos(fcb); - zxlseek(handle, npos, SEEK_SET); - redir_Msg(" (from %lx)\n", zxlseek(handle, 0, SEEK_CUR)); - - /* Read in the required amount */ - -#ifdef WIN32 - { - BOOL b; - redir_Msg(">ReadFile() Handle=%lu, DMA=%lu, Len=%lu\n", handle, dma, redir_rec_len); - b = ReadFile((HANDLE)handle, dma, redir_rec_len, (unsigned long *)(&rv), NULL); - redir_Msg("WriteFile() Handle=%lu, DMA=%lu, Len=%lu\n", handle, dma, redir_rec_len); - b = WriteFile((HANDLE)handle, dma, redir_rec_len, (unsigned long *)(&rv), NULL); - redir_Msg("CreateFile([CREATE_ALWAYS]) Name='%s'\n", fname); - handle = (int)CreateFile(fname, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - redir_Msg("ReadFile() Handle=%lu, DMA=%lu, Len=%lu\n", handle, dma, redir_rec_len); - b = ReadFile((HANDLE)handle, dma, redir_rec_len, (unsigned long *)(&rv), NULL); - redir_Msg("WriteFile() Handle=%lu, DMA=%lu, Len=%lu\n", handle, dma, redir_rec_len); - b = WriteFile((HANDLE)handle, dma, redir_rec_len, (unsigned long *)(&rv), NULL); - redir_Msg("WriteFile() Handle=%lu, DMA=%lu, Len=%lu\n", handle, zerorec, rl); - b = WriteFile((HANDLE)handle, zerorec, rl, (unsigned long *)(&rv), NULL); - redir_Msg("= 0) len += rv; - - if (rv < rl) - { - redir_wr32(fcb + LENGTH_OFFSET, len); - return redir_xlt_err(); - } - } - redir_wr32(fcb + LENGTH_OFFSET, offs); - - return fcb_randwr(fcb, dma); -} - -cpm_word fcb_tell(cpm_byte *fcb) -{ - int handle; - off_t rv; - - SHOWNAME("fcb_tell") - - if ((handle = redir_verify_fcb(fcb)) < 0) return 9; /* Invalid FCB */ - - rv = zxlseek(handle, 0, SEEK_CUR); - - if (rv < 0) return 0xFF; - - rv = rv >> 7; - fcb[0x21] = rv & 0xFF; - fcb[0x22] = (rv >> 8) & 0xFF; - fcb[0x23] = (rv >> 16) & 0xFF; - return 0; -} - - -cpm_word fcb_stat(cpm_byte *fcb) -{ - char fname[CPM_MAXPATH]; - struct stat st; - int rv; - - /* Don't support ambiguous filenames */ - if (redir_fcb2unix(fcb, fname)) return 0x09FF; - - rv = stat(fname, &st); - - redir_Msg("fcb_stat(\"%s\") fcb=%x\n", fname, (int)fcb); - if (rv < 0) - { - redir_Msg("ret: -1\n"); - return 0xFF; - } - - redir_wr24(fcb + 0x21, (st.st_size + 127) / 128); - - redir_Msg("ret: 0"); - return 0; -} - - -cpm_word fcb_multirec(cpm_byte rc) -{ - if (rc < 1 || rc > 128) return 0xFF; - - redir_rec_multi = rc; - redir_rec_len = 128 * rc; - redir_Msg("Set read/write to %d bytes\n", redir_rec_len); - return 0; -} - - -cpm_word fcb_date(cpm_byte *fcb) -{ - char fname[CPM_MAXPATH]; - struct stat st; - int rv; - - /* Don't support ambiguous filenames */ - if (redir_fcb2unix(fcb, fname)) return 0x09FF; - - rv = stat(fname, &st); - - redir_Msg("fcb_stat(\"%s\")\n", fname); - if (rv < 0) return 0xFF; - - redir_wr32(fcb + 0x18, redir_cpmtime(st.st_atime)); - redir_wr32(fcb + 0x1C, redir_cpmtime(st.st_ctime)); - - fcb[0x0C] = redir_cpm_pwmode(redir_drdos_get_rights(fname)); - return 0; -} - - - -cpm_word fcb_trunc(cpm_byte *fcb, cpm_byte *dma) -{ - char fname[CPM_MAXPATH]; - dword offs = redir_rd24(fcb + 0x21) * 128; - - /* Don't support ambiguous filenames */ - if (redir_fcb2unix(fcb, fname)) return 0x09FF; - - /* Software write-protection */ - if (redir_ro_fcb(fcb)) return 0x02FF; - - redir_log_fcb(fcb); -#ifdef WIN32 - (void)offs; - return 0x06FF; /* Simply not implemented */ -#else - if (truncate(fname, offs)) - { - if (redir_password_error()) - { - redir_password_append(fname, dma); - if (!truncate(fname, offs)) return 0; - } - return redir_xlt_err(); - } - return 0; -#endif -} - - -cpm_word fcb_sdate(cpm_byte *fcb, cpm_byte *dma) -{ - char fname[CPM_MAXPATH]; -#ifdef WIN32 - /* TODO: Use SetFileTime() here */ - - /* Don't support ambiguous filenames */ - if (redir_fcb2unix(fcb, fname)) return 0x09FF; - - /* Software write-protection */ - if (redir_ro_fcb(fcb)) return 0x02FF; - - redir_log_fcb(fcb); -#else - struct utimbuf buf; - - buf.actime = redir_unixtime(dma); - buf.modtime = redir_unixtime(dma + 4); - - /* Don't support ambiguous filenames */ - if (redir_fcb2unix(fcb, fname)) return 0x09FF; - - /* Software write-protection */ - if (redir_ro_fcb(fcb)) return 0x02FF; - - redir_log_fcb(fcb); - - if (utime(fname, &buf)) - { - if (redir_password_error()) - { - redir_password_append(fname, dma); - if (!utime(fname, &buf)) return 0; - } - return redir_xlt_err(); - } -#endif - return 0; -} - - - -cpm_word fcb_chmod(cpm_byte *fcb, cpm_byte *dma) -{ - char fname[CPM_MAXPATH]; - struct stat st; - int handle, wlen, omode; - long offs, newoffs; - cpm_byte zero[128]; - - /* Don't support ambiguous filenames */ - if (redir_fcb2unix(fcb, fname)) return 0x09FF; - - /* Software write-protection */ - if (redir_ro_fcb(fcb)) return 0x02FF; - - redir_log_fcb(fcb); - - if (stat(fname, &st)) return redir_xlt_err(); - -#ifdef __MSDOS__ - omode = 0; - if (fcb[9] & 0x80) omode |= 1; - if (fcb[10] & 0x80) omode |= 4; - if (!(fcb[11] & 0x80)) omode |= 0x20; - - if (_chmod(fname, 1, omode) < 0) - { - if (redir_password_error()) - { - redir_password_append(fname, dma); - if (_chmod(fname, 1, omode) >= 0) return 0; - } - return redir_xlt_err(); - } -#elif defined (WIN32) - omode = 0; - - if (fcb[9] & 0x80) omode |= FILE_ATTRIBUTE_READONLY; - if (fcb[10] & 0x80) omode |= FILE_ATTRIBUTE_SYSTEM; - if (!(fcb[11] & 0x80)) omode |= FILE_ATTRIBUTE_ARCHIVE; - - if (!omode) omode = FILE_ATTRIBUTE_NORMAL; - - SetFileAttributes(fname, omode); -#else - omode = st.st_mode; - if (fcb[9] & 0x80) /* Read-only */ - { - st.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH); - } - else st.st_mode |= S_IWUSR; - - if (omode != st.st_mode) - { - if (chmod(fname, st.st_mode)) return redir_xlt_err(); - } - -#endif - - if (fcb[6] & 0x80) /* Set exact size */ - { - if (stat(fname, &st)) return redir_xlt_err(); - - handle = open(fname, O_RDWR | O_BINARY); - if (handle < 0) return redir_xlt_err(); - - newoffs = offs = ((st.st_size + 127) / 128) * 128; - if (fcb[0x20] & 0x7F) - { - newoffs -= (0x80 - (fcb[0x20] & 0x7F)); - } - if (newoffs == st.st_size) - { - ; /* Nothing to do! */ - } - else if (newoffs < st.st_size) - { -#ifndef WIN32 /* XXX Do this somehow in Win32 */ - if (ftruncate(handle, newoffs)) - { - close(handle); - return redir_xlt_err(); - } -#endif - } - else while (newoffs > st.st_size) - { - wlen = newoffs - st.st_size; - if (wlen > 0x80) wlen = 0x80; - memset(zero, 0x1A, sizeof(zero)); - if (write(handle, zero, wlen) < wlen) - { - close(handle); - return redir_xlt_err(); - } - st.st_size += wlen; - } - close(handle); - } - return 0; -} - - - - -cpm_word fcb_setpwd(cpm_byte *fcb, cpm_byte *dma) -{ -#ifdef __MSDOS__ - char fname[CPM_MAXPATH]; - cpm_word rv; - - /* Don't support ambiguous filenames */ - if (redir_fcb2unix(fcb, fname)) return 0x09FF; - - /* Software write-protection */ - if (redir_ro_fcb(fcb)) return 0x02FF; - - redir_log_fcb(fcb); - - rv = redir_drdos_put_rights(fname, dma, redir_drdos_pwmode(fcb[0x0c])); - if (rv || !(fcb[0x0c] & 1)) return rv; - return redir_drdos_put_rights(fname, dma, redir_drdos_pwmode(fcb[0x0c]) | 0x8000); -#else - return 0xFF; /* Unix doesn't do this */ -#endif -} - - -cpm_word fcb_getlbl(cpm_byte drv) -{ - redir_Msg("fcb_getlbl()\r\n"); -#ifdef __MSDOS__ - if (redir_drdos) return 0xA1; /* Supports passwords & Update stamps */ - return 0x21; /* Update stamps only */ -#else - return 0x61; /* Update & Access stamps */ -#endif -} - -cpm_word fcb_setlbl(cpm_byte *fcb, cpm_byte *dma) -{ -/* I am not letting CP/M fiddle with the host's FS settings - even if they - * could be altered, which they mostly can't. */ - - return 0x03FF; -} - - - -cpm_word fcb_defpwd(cpm_byte *pwd) -{ -#ifdef __MSDOS__ - union REGS r; - struct SREGS s; - - if (pwd[0] == 0 || pwd[0] == ' ') - { - redir_passwd[0] = 0; - } - else memcpy(redir_passwd, pwd, 8); - if (redir_drdos) - { - dosmemput(pwd, 8, __tb); - r.w.ax = 0x4454; - r.w.dx = __tb & 0x0F; - s.ds = __tb >> 4; - intdosx(&r, &r, &s); - } - -#endif - return 0; -} - - diff --git a/Tools/unix/zx/cpmredir.h b/Tools/unix/zx/cpmredir.h deleted file mode 100644 index 2584e239..00000000 --- a/Tools/unix/zx/cpmredir.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - CPMREDIR: CP/M filesystem redirector - Copyright (C) 1998, John Elliott - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - This file holds the public interface to CPMREDIR. -*/ - -#ifndef CPMREDIR_H_INCLUDED - -#define CPMREDIR_H_INCLUDED 16-11-1998 - -/* The "cpm_byte" must be exactly 8 bits. - The "cpm_word" must be exactly 16 bits. */ - -typedef unsigned char cpm_byte; -typedef unsigned short cpm_word; - -/* Maximum length of a directory path */ -#ifdef _POSIX_PATH_MAX - #define CPM_MAXPATH _POSIX_PATH_MAX -#else - #ifdef _MAX_PATH - #define CPM_MAXPATH _MAX_PATH - #else - #define CPM_MAXPATH 260 - #endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Initialise this library. Call this function first. - * - * Returns 0 if failed to initialise. - */ -int fcb_init(void); - -/* Deinitialise the library. */ - -void fcb_deinit(void); - -/* Translate a name from the host FS to a CP/M name. This will (if necessary) - * create a mapping between a CP/M drive and a host directory path. - * - * CP/M drives A: to O: can be mapped in this way. P: is always the current - * drive. - * - */ - -void xlt_name(char *localname, char *cpmname); - -/* It is sometimes convenient to set some fixed mappings. This will create - * a mapping for a given directory. - * Pass drive = -1 for "first available", or 0-15 for A: to P: - * Returns 1 if OK, 0 if requested drive not available. - * - * NB: It is important that the localname should have a trailing - * directory separator! - */ - -int xlt_map(int drive, char *localdir); - -/* - * This revokes a mapping. No check is made whether CP/M has files open - * on the drive or not. - */ - -int xlt_umap(int drive); - -/* Find out if a drive is mapped, and if so to what directory */ - -char *xlt_getcwd(int drive); - - -/* BDOS functions. Eventually this should handle all disc-related BDOS - * functions. - * - * I am assuming that your emulator has the CP/M RAM in its normal address - * space, accessible as a range 0-64k. If this is not the case - * (eg: you are emulating banked memory, or using a segmented architecture) - * you will have to use "copy in and copy out" techniques. The "fcb" area - * must be 36 bytes long; the "dma" area should be 128 * the value set - * in fcb_multirec() [default is 1, so 128 bytes]. - * - */ - -cpm_byte fcb_reset (void); /* 0x0D */ -cpm_word fcb_drive (cpm_byte drv); /* 0x0E */ -cpm_word fcb_open (cpm_byte *fcb, cpm_byte *dma); /* 0x0F */ -cpm_word fcb_close (cpm_byte *fcb); /* 0x10 */ -cpm_word fcb_find1 (cpm_byte *fcb, cpm_byte *dma); /* 0x11 */ -cpm_word fcb_find2 (cpm_byte *fcb, cpm_byte *dma); /* 0x12 */ -cpm_word fcb_unlink(cpm_byte *fcb, cpm_byte *dma); /* 0x13 */ -cpm_word fcb_read (cpm_byte *fcb, cpm_byte *dma); /* 0x14 */ -cpm_word fcb_write (cpm_byte *fcb, cpm_byte *dma); /* 0x15 */ -cpm_word fcb_creat (cpm_byte *fcb, cpm_byte *dma); /* 0x16 */ -cpm_word fcb_rename(cpm_byte *fcb, cpm_byte *dma); /* 0x17 */ -cpm_word fcb_logvec(void); /* 0x18 */ -cpm_byte fcb_getdrv(void); /* 0x19 */ -/* DMA is a parameter to routines, not a separate call */ -cpm_word fcb_getalv(cpm_byte *alv, cpm_word max); /* 0x1B */ -/* Get alloc vector: caller must provide space and say how big it is. */ -cpm_word fcb_rodisk(void); /* 0x1C */ -cpm_word fcb_rovec (void); /* 0x1D */ -cpm_word fcb_chmod (cpm_byte *fcb, cpm_byte *dma); /* 0x1E */ -cpm_word fcb_getdpb(cpm_byte *dpb); /* 0x1F */ -cpm_byte fcb_user (cpm_byte usr); /* 0x20 */ -cpm_word fcb_randrd(cpm_byte *fcb, cpm_byte *dma); /* 0x21 */ -cpm_word fcb_randwr(cpm_byte *fcb, cpm_byte *dma); /* 0x22 */ -cpm_word fcb_stat (cpm_byte *fcb); /* 0x23 */ -cpm_word fcb_tell (cpm_byte *fcb); /* 0x24 */ -cpm_word fcb_resro (cpm_word bitmap); /* 0x25 */ -/* Access Drives and Free Drives are not supported. */ -cpm_word fcb_randwz(cpm_byte *fcb, cpm_byte *dma); /* 0x28 */ -/* Record locking calls not supported (though they could be) */ -cpm_word fcb_multirec(cpm_byte rc); /* 0x2C */ -/* Set hardware error action must be done by caller */ -cpm_word fcb_dfree (cpm_byte drive, cpm_byte *dma);/* 0x2E */ -cpm_word fcb_sync (cpm_byte flag); /* 0x30 */ -cpm_word fcb_purge (void); /* 0x62 */ -cpm_word fcb_trunc (cpm_byte *fcb, cpm_byte *dma); /* 0x63 */ -cpm_word fcb_setlbl(cpm_byte *fcb, cpm_byte *dma); /* 0x64 */ -cpm_word fcb_getlbl(cpm_byte drive); /* 0x65 */ -cpm_word fcb_date (cpm_byte *fcb); /* 0x66 */ -cpm_word fcb_setpwd(cpm_byte *fcb, cpm_byte *dma); /* 0x67 */ -cpm_word fcb_defpwd(cpm_byte *pwd); /* 0x6A */ -cpm_word fcb_sdate (cpm_byte *fcb, cpm_byte *dma); /* 0x74 */ -cpm_word fcb_parse (char *txt, cpm_byte *fcb); /* 0x98 */ - -/* fcb_parse returns length of filename parsed, 0 if EOL, 0xFFFF if error */ -#ifdef __cplusplus -} -#endif - - -#endif /* def CPMREDIR_H_INCLUDED */ diff --git a/Tools/unix/zx/dirent.c b/Tools/unix/zx/dirent.c deleted file mode 100644 index 87cf85a9..00000000 --- a/Tools/unix/zx/dirent.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - - Implementation of POSIX directory browsing functions and types for Win32. - - Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com) - History: Created March 1997. Updated June 2003 and July 2012. - Rights: See end of file. - -*/ - -#include "dirent.h" -#include -#include /* _findfirst and _findnext set errno iff they return -1 */ -#include -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - -//typedef ptrdiff_t handle_type; /* C99's intptr_t not sufficiently portable */ -typedef long handle_type; /* C99's intptr_t not sufficiently portable */ - -struct DIR -{ - handle_type handle; /* -1 for failed rewind */ - struct _finddata_t info; - struct dirent result; /* d_name null iff first time */ - char *name; /* null-terminated char string */ -}; - -DIR *opendir(const char *name) -{ - DIR *dir = 0; - - if(name && name[0]) - { - size_t base_length = strlen(name); - const char *all = /* search pattern must end with suitable wildcard */ - strchr("/\\", name[base_length - 1]) ? "*" : "/*"; - - if((dir = (DIR *) malloc(sizeof *dir)) != 0 && - (dir->name = (char *) malloc(base_length + strlen(all) + 1)) != 0) - { - strcat(strcpy(dir->name, name), all); - - if((dir->handle = - (handle_type) _findfirst(dir->name, &dir->info)) != -1) - { - dir->result.d_name = 0; - } - else /* rollback */ - { - free(dir->name); - free(dir); - dir = 0; - } - } - else /* rollback */ - { - free(dir); - dir = 0; - errno = ENOMEM; - } - } - else - { - errno = EINVAL; - } - - return dir; -} - -int closedir(DIR *dir) -{ - int result = -1; - - if(dir) - { - if(dir->handle != -1) - { - result = _findclose(dir->handle); - } - - free(dir->name); - free(dir); - } - - if(result == -1) /* map all errors to EBADF */ - { - errno = EBADF; - } - - return result; -} - -struct dirent *readdir(DIR *dir) -{ - struct dirent *result = 0; - - if(dir && dir->handle != -1) - { - if(!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1) - { - result = &dir->result; - result->d_name = dir->info.name; - } - } - else - { - errno = EBADF; - } - - return result; -} - -void rewinddir(DIR *dir) -{ - if(dir && dir->handle != -1) - { - _findclose(dir->handle); - dir->handle = (handle_type) _findfirst(dir->name, &dir->info); - dir->result.d_name = 0; - } - else - { - errno = EBADF; - } -} - -#ifdef __cplusplus -} -#endif - -/* - - Copyright Kevlin Henney, 1997, 2003, 2012. All rights reserved. - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose is hereby granted without fee, provided - that this copyright and permissions notice appear in all copies and - derivatives. - - This software is supplied "as is" without express or implied warranty. - - But that said, if there are any problems please get in touch. - -*/ diff --git a/Tools/unix/zx/dirent.h b/Tools/unix/zx/dirent.h deleted file mode 100644 index bbbfce52..00000000 --- a/Tools/unix/zx/dirent.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef DIRENT_INCLUDED -#define DIRENT_INCLUDED - -/* - - Declaration of POSIX directory browsing functions and types for Win32. - - Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com) - History: Created March 1997. Updated June 2003. - Rights: See end of file. - -*/ - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct DIR DIR; - -struct dirent -{ - char *d_name; -}; - -DIR *opendir(const char *); -int closedir(DIR *); -struct dirent *readdir(DIR *); -void rewinddir(DIR *); - -/* - - Copyright Kevlin Henney, 1997, 2003. All rights reserved. - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose is hereby granted without fee, provided - that this copyright and permissions notice appear in all copies and - derivatives. - - This software is supplied "as is" without express or implied warranty. - - But that said, if there are any problems please get in touch. - -*/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Tools/unix/zx/drdos.c b/Tools/unix/zx/drdos.c deleted file mode 100644 index 97bd583c..00000000 --- a/Tools/unix/zx/drdos.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - - CPMREDIR: CP/M filesystem redirector - Copyright (C) 1998, John Elliott - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - This file holds DRDOS-specific password code. -*/ - -#include "cpmint.h" - -cpm_word redir_drdos_pwmode(cpm_byte b) -{ - cpm_word mode = 0; - - if (b & 0x80) mode |= 0xddd; - if (b & 0x40) mode |= 0x555; - if (b & 0x20) mode |= 0x111; - - return mode; -} - -cpm_byte redir_cpm_pwmode(cpm_word w) -{ - cpm_byte mode = 0; - - if (w & 0x8) mode |= 0x80; - if (w & 0x4) mode |= 0x40; - if (w & 0x1) mode |= 0x20; - - return mode; -} - -#ifdef __MSDOS__ -#ifdef __GO32__ /* The GO32 extender doesn't understand DRDOS password - * functions, so these are done with __dpmi_int() rather - * than intdos() */ - -cpm_word redir_drdos_get_rights(char *path) -{ - __dpmi_regs r; - - if (!redir_drdos) return 0; - - redir_Msg("Rights for file %s: \n\r", path); - - dosmemput(path, strlen(path) + 1, __tb); - r.x.ax = 0x4302; - r.x.dx = __tb & 0x0F; - r.x.ds = (__tb) >> 4; - - __dpmi_int(0x21, &r); - - redir_Msg(" %04x \n\r", r.x.cx); - - if (r.x.flags & 1) return 0; - return r.x.cx; -} - - -cpm_word redir_drdos_put_rights(char *path, cpm_byte *dma, cpm_word rights) -{ - __dpmi_regs r; - - if (!redir_drdos) return 0; - - redir_Msg("Put rights for file %s: %04x %-8.8s %-8.8s\n\r", path, rights, dma, dma + 8); - - dosmemput(dma+8, 8, __tb); /* Point DTA at password */ - r.x.ax = 0x1A00; - r.x.dx = (__tb & 0x0F); - r.x.ds = (__tb) >> 4; - __dpmi_int(0x21, &r); - - dosmemput(path, strlen(path) + 1, __tb + 0x10); - r.x.ax = 0x4303; /* Set rights */ - r.x.cx = rights; - r.x.dx = (__tb & 0x0F) + 0x10; - r.x.ds = (__tb) >> 4; - - __dpmi_int(0x21, &r); - - if (r.x.flags & 1) - { - redir_Msg(" Try 1 failed. Error %04x\n\r", r.x.ax); - if (redir_password_error()) - { - redir_password_append(path, dma); - - dosmemput(path, strlen(path) + 1, __tb + 0x10); - r.x.ax = 0x4303; /* Set rights */ - r.x.cx = rights; - r.x.dx = (__tb & 0x0F) + 0x10; - r.x.ds = (__tb) >> 4; - - __dpmi_int(0x21, &r); - if (!r.x.flags & 1) return 0; - if (redir_password_error()) return 0x7FF; - } - return 0xFF; - } - return 0; -} - -#else /* __GO32__ */ - -cpm_word redir_drdos_get_rights(char *path) -{ - union REGS r; - struct SREGS s; - - if (!redir_drdos) return 0; - - redir_Msg("Rights for file %s: \n\r", path); - - dosmemput(path, strlen(path) + 1, __tb); - r.w.ax = 0x4302; - r.w.dx = __tb & 0x0F; - s.ds = (__tb) >> 4; - - intdosx(&r, &r, &s); - - redir_Msg(" %04x \n\r", r.w.cx); - - if (r.w.cflag) return 0; - return r.w.cx; -} - - -cpm_word redir_drdos_put_rights(char *path, cpm_byte *dma, cpm_word rights) -{ - union REGS r; - struct SREGS s; - - if (!redir_drdos) return 0; - - redir_Msg("Put rights for file %s: %04x\n\r", path, rights); - - dosmemput(dma, 8, __tb); /* Point DTA at password */ - r.w.ax = 0x1A00; - r.w.dx = (__tb & 0x0F); - s.ds = (__tb) >> 4; - intdosx(&r, &r, &s); - - dosmemput(path, strlen(path) + 1, __tb + 0x10); - r.w.ax = 0x4303; /* Set rights */ - r.w.cx = rights; - r.w.dx = (__tb & 0x0F) + 0x10; - s.ds = (__tb) >> 4; - - intdosx(&r, &r, &s); - - if (r.w.cflag) - { - redir_Msg(" Try 1 failed. Error %04x \n\r", r.w.ax); - if (redir_password_error()) - { - redir_password_append(path, dma); - - dosmemput(path, strlen(path) + 1, __tb + 0x10); - r.w.ax = 0x4303; /* Set rights */ - r.w.cx = rights; - r.w.dx = (__tb & 0x0F) + 0x10; - s.ds = (__tb) >> 4; - - intdosx(&r, &r, &s); - if (!r.w.cflag) return 0; - } - return 0xFF; - } - return 0; -} - -#endif /* __GO32__ */ - - -cpm_word redir_password_error(void) -{ - union REGS r; - - if (!redir_drdos) return 0; - - r.w.ax = 0x5900; - r.w.bx = 0x0000; - - intdos(&r, &r); - - redir_Msg("Last error was: %04x\r\n", r.w.ax); - - if (r.w.ax == 0x56) return 1; /* Bad password */ - return 0; -} - - -void redir_password_append(char *s, cpm_byte *dma) -{ - int n, m; - - if (!redir_drdos) return; - - if (dma[0] == 0 || dma[0] == 0x20) return; - - strcat(s, ";"); - m = strlen(s); - - for (n = 0; n < 8; n++) - { - if (dma[n] == ' ') s[m] = 0; - else s[m] = dma[n]; - ++m; - } - s[m] = 0; - -} -#else /* __MSDOS__ */ -void redir_password_append(char *s, cpm_byte *dma) {} -cpm_word redir_password_error(void) { return 0; } -cpm_word redir_drdos_put_rights(char *path, cpm_byte *dma, cpm_word rights) -{ return 0; } -cpm_word redir_drdos_get_rights(char *path) { return 0; } -#endif /* __MSDOS__ */ - - diff --git a/Tools/unix/zx/edops.h b/Tools/unix/zx/edops.h deleted file mode 100644 index 6b04c96a..00000000 --- a/Tools/unix/zx/edops.h +++ /dev/null @@ -1,567 +0,0 @@ -/* Emulations of the ED operations of the Z80 instruction set. - * Copyright (C) 1994 Ian Collier. - * - * 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. - */ - -#define input(var) { unsigned short u;\ - var=u=in(tstates,b,c);\ - tstates+=u>>8;\ - f=(f&1)|(var&0xa8)|((!var)<<6)|parity(var);\ - } -#define sbchl(x) { unsigned short z=(x);\ - unsigned long t=(hl-z-cy)&0x1ffff;\ - f=((t>>8)&0xa8)|(t>>16)|2|\ - (((hl&0xfff)<(z&0xfff)+cy)<<4)|\ - (((hl^z)&(hl^t)&0x8000)>>13)|\ - ((!(t&0xffff))<<6)|2;\ - l=t;\ - h=t>>8;\ - } - -#define adchl(x) { unsigned short z=(x);\ - unsigned long t=hl+z+cy;\ - f=((t>>8)&0xa8)|(t>>16)|\ - (((hl&0xfff)+(z&0xfff)+cy>0xfff)<<4)|\ - (((~hl^z)&(hl^t)&0x8000)>>13)|\ - ((!(t&0xffff))<<6)/*|2*/;\ - l=t;\ - h=t>>8;\ - } -/* [JCE] The "|2" should not be there, at least according to my tests on - * a PCW16. The PCW16's ADC always resets that bit. */ - - -#define neg (a=-a,\ - f=(a&0xa8)|((!a)<<6)|(((a&15)>0)<<4)|((a==128)<<2)|2|(a>0)) - -{ - unsigned char op=fetch(pc); - pc++; - radjust++; - switch(op){ -instr(0x40,8); - input(b); -endinstr; - -instr(0x41,8); - tstates+=out(tstates,b,c,b); -endinstr; - -instr(0x42,11); - sbchl(bc); -endinstr; - -instr(0x43,16); - {unsigned short addr=fetch2(pc); - pc+=2; - store2b(addr,b,c); - } -endinstr; - -instr(0x44,4); - neg; -endinstr; - -instr(0x45,4); - iff1=iff2; - ret; -endinstr; - -instr(0x46,4); - im=0; -endinstr; - -instr(0x47,5); - i=a; -endinstr; - -instr(0x48,8); - input(c); -endinstr; - -instr(0x49,8); - tstates+=out(tstates,b,c,c); -endinstr; - -instr(0x4a,11); - adchl(bc); -endinstr; - -instr(0x4b,16); - {unsigned short addr=fetch2(pc); - pc+=2; - c=fetch(addr); - b=fetch(addr+1); - } -endinstr; - -instr(0x4c,4); - neg; -endinstr; - -instr(0x4d,4); - ret; -endinstr; - -instr(0x4e,4); - im=1; -endinstr; - -instr(0x4f,5); - r=a; - radjust=r; -endinstr; - -instr(0x50,8); - input(d); -endinstr; - -instr(0x51,8); - tstates+=out(tstates,b,c,d); -endinstr; - -instr(0x52,11); - sbchl(de); -endinstr; - -instr(0x53,16); - {unsigned short addr=fetch2(pc); - pc+=2; - store2b(addr,d,e); - } -endinstr; - -instr(0x54,4); - neg; -endinstr; - -instr(0x55,4); - ret; -endinstr; - -instr(0x56,4); - im=2; -endinstr; - -instr(0x57,5); - a=i; - f=(f&1)|(a&0xa8)|((!a)<<6)|(iff2<<2); -endinstr; - -instr(0x58,8); - input(e); -endinstr; - -instr(0x59,8); - tstates+=out(tstates,b,c,e); -endinstr; - -instr(0x5a,11); - adchl(de); -endinstr; - -instr(0x5b,16); - {unsigned short addr=fetch2(pc); - pc+=2; - e=fetch(addr); - d=fetch(addr+1); - } -endinstr; - -instr(0x5c,4); - neg; -endinstr; - -instr(0x5d,4); - ret; -endinstr; - -instr(0x5e,4); - im=3; -endinstr; - -instr(0x5f,5); - r=(r&0x80)|(radjust&0x7f); - a=r; - f=(f&1)|(a&0xa8)|((!a)<<6)|(iff2<<2); -endinstr; - -instr(0x60,8); - input(h); -endinstr; - -instr(0x61,8); - tstates+=out(tstates,b,c,h); -endinstr; - -instr(0x62,11); - sbchl(hl); -endinstr; - -instr(0x63,16); - {unsigned short addr=fetch2(pc); - pc+=2; - store2b(addr,h,l); - } -endinstr; - -instr(0x64,4); - neg; -endinstr; - -instr(0x65,4); - ret; -endinstr; - -instr(0x66,4); - im=0; -endinstr; - -instr(0x67,14); - {unsigned char t=fetch(hl); - unsigned char u=(a<<4)|(t>>4); - a=(a&0xf0)|(t&0x0f); - store(hl,u); - f=(f&1)|(a&0xa8)|((!a)<<6)|parity(a); - } -endinstr; - -instr(0x68,8); - input(l); -endinstr; - -instr(0x69,8); - tstates+=out(tstates,b,c,l); -endinstr; - -instr(0x6a,11); - adchl(hl); -endinstr; - -instr(0x6b,16); - {unsigned short addr=fetch2(pc); - pc+=2; - l=fetch(addr); - h=fetch(addr+1); - } -endinstr; - -instr(0x6c,4); - neg; -endinstr; - -instr(0x6d,4); - ret; -endinstr; - -instr(0x6e,4); - im=1; -endinstr; - -instr(0x6f,5); - {unsigned char t=fetch(hl); - unsigned char u=(a&0x0f)|(t<<4); - a=(a&0xf0)|(t>>4); - store(hl,u); - f=(f&1)|(a&0xa8)|((!a)<<6)|parity(a); - } -endinstr; - -instr(0x70,8); - {unsigned char x;input(x);} -endinstr; - -instr(0x71,8); - tstates+=out(tstates,b,c,0); -endinstr; - -instr(0x72,11); - sbchl(sp); -endinstr; - -instr(0x73,16); - {unsigned short addr=fetch2(pc); - pc+=2; - store2(addr,sp); - } -endinstr; - -instr(0x74,4); - neg; -endinstr; - -instr(0x75,4); - ret; -endinstr; - -instr(0x76,4); - im=2; -endinstr; - -instr(0x78,8); - input(a); -endinstr; - -instr(0x79,8); - tstates+=out(tstates,b,c,a); -endinstr; - -instr(0x7a,11); - adchl(sp); -endinstr; - -instr(0x7b,16); - {unsigned short addr=fetch2(pc); - pc+=2; - sp=fetch2(addr); - } -endinstr; - -instr(0x7c,4); - neg; -endinstr; - -instr(0x7d,4); - ret; -endinstr; - -instr(0x7e,4); - im=3; -endinstr; - -instr(0xa0,12); - {unsigned char x=fetch(hl); - store(de,x); - if(!++l)h++; - if(!++e)d++; - if(!c--)b--; - f=(f&0xc1)|(x&0x28)|(((b|c)>0)<<2); - } -endinstr; - -instr(0xa1,12); - {unsigned char carry=cy; - cpa(fetch(hl)); - if(!++l)h++; - if(!c--)b--; - f=(f&0xfa)|carry|(((b|c)>0)<<2); - } -endinstr; - -instr(0xa2,12); - {unsigned short t=in(tstates,b,c); - store(hl,t); - tstates+=t>>8; - if(!++l)h++; - b--; - f=(b&0xa8)|((b==0)<<6)|2|((parity(b)^c)&4); - } -endinstr; - -instr(0xa3,12); /* I can't determine the correct flags outcome for the - block OUT instructions. Spec says that the carry - flag is left unchanged and N is set to 1, but that - doesn't seem to be the case... */ - {unsigned char x=fetch(hl); - tstates+=out(tstates,b,c,x); - if(!++l)h++; - b--; - f=(f&1)|0x12|(b&0xa8)|((b==0)<<6); - } -endinstr; - -instr(0xa8,12); - {unsigned char x=fetch(hl); - store(de,x); - if(!l--)h--; - if(!e--)d--; - if(!c--)b--; - f=(f&0xc1)|(x&0x28)|(((b|c)>0)<<2); - } -endinstr; - -instr(0xa9,12); - {unsigned char carry=cy; - cpa(fetch(hl)); - if(!l--)h--; - if(!c--)b--; - f=(f&0xfa)|carry|(((b|c)>0)<<2); - } -endinstr; - -instr(0xaa,12); - {unsigned short t=in(tstates,b,c); - store(hl,t); - tstates+=t>>8; - if(!l--)h--; - b--; - f=(b&0xa8)|((b==0)<<6)|2|((parity(b)^c^4)&4); - } -endinstr; - -instr(0xab,12); - {unsigned char x=fetch(hl); - tstates+=out(tstates,b,c,x); - if(!l--)h--; - b--; - f=(f&1)|0x12|(b&0xa8)|((b==0)<<6); - } -endinstr; - -/* Note: the Z80 implements "*R" as "*" followed by JR -2. No reason - to change this... */ - -instr(0xb0,12); - {unsigned char x=fetch(hl); - store(de,x); - if(!++l)h++; - if(!++e)d++; - if(!c--)b--; - f=(f&0xc1)|(x&0x28)|(((b|c)>0)<<2); - if(b|c)pc-=2,tstates+=5; - } -endinstr; - -instr(0xb1,12); - {unsigned char carry=cy; - cpa(fetch(hl)); - if(!++l)h++; - if(!c--)b--; - f=(f&0xfa)|carry|(((b|c)>0)<<2); - if((f&0x44)==4)pc-=2,tstates+=5; - } -endinstr; - -instr(0xb2,12); - {unsigned short t=in(tstates,b,c); - store(hl,t); - tstates+=t>>8; - if(!++l)h++; - b--; - f=(b&0xa8)|((b==0)<<6)|2|((parity(b)^c)&4); - if(b)pc-=2,tstates+=5; - } -endinstr; - -instr(0xb3,12); - {unsigned char x=fetch(hl); - tstates+=out(tstates,b,c,x); - if(!++l)h++; - b--; - f=(f&1)|0x12|(b&0xa8)|((b==0)<<6); - if(b)pc-=2,tstates+=5; - } -endinstr; - -instr(0xb8,12); - {unsigned char x=fetch(hl); - store(de,x); - if(!l--)h--; - if(!e--)d--; - if(!c--)b--; - f=(f&0xc1)|(x&0x28)|(((b|c)>0)<<2); - if(b|c)pc-=2,tstates+=5; - } -endinstr; - -instr(0xb9,12); - {unsigned char carry=cy; - cpa(fetch(hl)); - if(!l--)h--; - if(!c--)b--; - f=(f&0xfa)|carry|(((b|c)>0)<<2); - if((f&0x44)==4)pc-=2,tstates+=5; - } -endinstr; - -instr(0xba,12); - {unsigned short t=in(tstates,b,c); - store(hl,t); - tstates+=t>>8; - if(!l--)h--; - b--; - f=(b&0xa8)|((b==0)<<6)|2|((parity(b)^c^4)&4); - if(b)pc-=2,tstates+=5; - } -endinstr; - -instr(0xbb,12); - {unsigned char x=fetch(hl); - tstates+=out(tstates,b,c,x); - if(!l--)h--; - b--; - f=(f&1)|0x12|(b&0xa8)|((b==0)<<6); - if(b)pc-=2,tstates+=5; - } -endinstr; - -/* XZ80 Pseudo-ops -instr(0xfb,4); - multiloader(hl,a); -endinstr; - -instr(0xfc,4); - { int ans; - stopwatch(); - ans=loader(pc,ix,de,a,cy); - if(ans>=0){ - if(ans==1)pc=0x0806; - else if(ans==2)f&=254; - else f|=1; - ix+=de; - d=e=0; - if(ans!=1)ret; - } - startwatch(1); - } -endinstr; - -instr(0xfd,4); - { int ans; - stopwatch(); - ans=saver(pc,ix,de,a); - if(ans>0)pc=0x0806; - else if(ans==0){ - ix+=de; - d=e=0; - ret; - } - startwatch(1); - } -endinstr; -*/ - -/* ZXCC pseudo-op */ -instr(0xfe, 4); -{ - /* Create copies of the registers here so we can take their addresses - * and not lose register optimisation in the rest of the CPU code */ - byte xa,xb,xc,xd,xe,xf,xxh,xxl; - word xp,xx,xy; - - xa = a; xb = b; xc = c; xd = d; xe = e; xf = f; xxh = h; xxl = l; - xp = pc; xx = ix; xy = iy; - - ed_fe(&xa,&xb,&xc,&xd,&xe,&xf,&xxh,&xxl,&xp,&xx,&xy); - - a = xa; b = xb; c = xc; d = xd; e = xe; f = xf; h = xxh; l = xxl; - pc = xp; ix = xx; iy = xy; -} -endinstr; - -default: tstates+=4; - -}} diff --git a/Tools/unix/zx/readme.txt b/Tools/unix/zx/readme.txt deleted file mode 100644 index 31c3e320..00000000 --- a/Tools/unix/zx/readme.txt +++ /dev/null @@ -1,47 +0,0 @@ -ZX Command - -An adaptation of zxcc-0.5.6 by Wayne Warthen - -This directory contains the source files used to build the "zx" tool. This tool -is essentially just John Elliott's zxcc package version zxcc-0.5.6 modified to -build for Windows and simplified down to just a single command (zx) -which is essentially just the zxcc command. - -Please see http://www.seasip.info/Unix/Zxcc/ for more information on zxcc. - -To build under Open Watcom or Microsoft Visual C++, use the following command: - - cl /Fe"zx.exe" zx.c cpmdrv.c cpmglob.c cpmparse.c cpmredir.c drdos.c util.c xlt.c zxbdos.c zxcbdos.c zxdbdos.c z80.c dirent.c - -To build a debug version, use the following command: - - cl /DDEBUG /Fe"zxdbg.exe" zx.c cpmdrv.c cpmglob.c cpmparse.c cpmredir.c drdos.c util.c xlt.c zxbdos.c zxcbdos.c zxdbdos.c z80.c dirent.c - -WARNING: There seems to be a rare scenario that breaks zx under the Open Watcom build. CP/M allows a file to be accessed -under multiple FCB's without an error. Open Watcom will see this as an error. At present, the only tool I know of that does -this is M80. - -December 5, 2014 - -After struggling to get the entire zxcc package to build nicely using autoconf, -I finally gave up and took a much more direct approach. I have extracted just -the source files needed and created a simple batch file to build the tool. I -realize this could be done much better, but I cheated in the interest of time. - -The one "real" change I made in the source code was that I modified the tool -to look for bios.bin in the same directory as the executable is in. This -just makes it much easier to set up (for me, anyway). - -The GPL status of everything remains in place and carries forward. - -Wayne Warthen -wwarthen@gmail.com - -March 15, 2017 - -- Updated to compile under Open Watcom. -- Implemented BDOS console status function. -- Set stdin and stdout to binary mode at startup. - -Wayne Warthen -wwarthen@gmail.com \ No newline at end of file diff --git a/Tools/unix/zx/util.c b/Tools/unix/zx/util.c deleted file mode 100644 index 21d29728..00000000 --- a/Tools/unix/zx/util.c +++ /dev/null @@ -1,378 +0,0 @@ -/* - - CPMREDIR: CP/M filesystem redirector - Copyright (C) 1998, John Elliott - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - This file holds miscellaneous utility functions. -*/ - -#include "cpmint.h" -#include - -/* In debug mode, lseek()s can be traced. */ - -#ifdef DEBUG - -long zxlseek(int fd, long offset, int wh) -{ -#ifdef WIN32 - long v; - redir_Msg(">SetFilePointer() Handle=%lu, Offset=%lu, Method=%lu\n", fd, offset, wh); - v = SetFilePointer((HANDLE)fd, offset, NULL, wh); - redir_Msg("= 0) return v; - - redir_Msg("lseek fails with errno = %d\n", errno); - if (errno == EBADF) redir_Msg(" (bad file descriptor %d)\n", fd); - if (errno == ESPIPE) redir_Msg(" (file %d is a pipe)\n", fd); - if (errno == EINVAL) redir_Msg(" (bad parameter %d)\n", wh); - - return -1; -#endif -} - -void redir_showfcb(cpm_byte *fd) -{ - int n; - - for (n = 0; n < 32; n++) - { - if (!n || n>= 12) printf("%02x ", fd[n]); - else printf("%c", fd[n] & 0x7F); - } - printf("\r\n"); -} - -#else - -long zxlseek(int fd, long offset, int wh) -{ -#ifdef WIN32 - return SetFilePointer((HANDLE)fd, offset, NULL, wh); -#else - return lseek(fd, offset, wh); -#endif -} - - -#endif - -/* Get the "sequential access" file pointer out of an FCB */ - -long redir_get_fcb_pos(cpm_byte *fcb) -{ - long npos; - - npos = 524288L * fcb[0x0E]; /* S2 */ - npos += 16384L * fcb[0x0C]; /* Extent */ - npos += 128L * fcb[0x20]; /* Record */ - - return npos; -} - -void redir_put_fcb_pos(cpm_byte *fcb, long npos) -{ - fcb[0x20] = (npos / 128) % 128; - fcb[0x0C] = (npos / 16384) % 32; - fcb[0x0E] = (npos / 524288L) % 64; -} - - -/* - * find a filename that works. - * note that this is where we handle the case sensitivity/non-case sensitivity - * horror. - * the name that is passed in should be in lower case. - * we'll modify it to the first one that matches - */ -void -swizzle(char *fullpath) -{ - struct stat ss; - char *slash; - DIR *dirp; - struct dirent *dentry; - - /* short circuit if ok */ - if (stat(fullpath, &ss) == 0) { - return; - } - - slash = rindex(fullpath, '/'); - if (!slash) { - return; - } - *slash = '\0'; - dirp = opendir(fullpath); - *slash = '/'; - while ((dentry = readdir(dirp)) != NULL) { - if (strcasecmp(dentry->d_name, slash + 1) == 0) { - strcpy(slash + 1, dentry->d_name); - break; - } - } - closedir(dirp); -} - -/* - * Passed a CP/M FCB, convert it to a unix filename. Turn its drive back into - * a path. - */ - -int redir_fcb2unix(cpm_byte *fcb, char *fname) -{ - int n, q, drv, ddrv; - char s[2]; - - s[1] = 0; - q = 0; - drv = fcb[0] & 0x7F; - if (drv == '?') drv = 0; - - ddrv = fcb[0] & 0x7F; - if (ddrv < 0x1F) ddrv += '@'; - - redir_Msg("%c:%-8.8s.%-3.3s\n", - ddrv, - fcb + 1, - fcb + 9); - - if (!drv) strcpy(fname, redir_drive_prefix[redir_cpmdrive]); - else strcpy(fname, redir_drive_prefix[drv - 1]); - - for (n = 1; n < 12; n++) - { - s[0] = (fcb[n] & 0x7F); - if (s[0] == '?') q = 1; - if (isupper(s[0])) s[0] = tolower(s[0]); - if (s[0] != ' ') - { - if (n == 9) strcat(fname, "."); - strcat(fname, s); - } - } - return q; -} - -#ifndef EROFS /* Open fails because of read-only FS */ -#define EROFS EACCES -#endif - -int redir_ofile(cpm_byte *fcb, char *s) -{ - int h, rv; - - /* Software write-protection */ -#ifdef WIN32 - redir_Msg(">CreateFile([OPEN_EXISTING]) Name='%s'\n", s); - h = (int)CreateFile(s, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - redir_Msg("= 0 || (errno != EACCES && errno != EROFS)) return h; - } - redir_Msg("**2**"); - h = open(s, O_RDONLY | O_BINARY); - if (h < 0) return -1; - fcb[9] |= 0x80; - #endif -#endif - - return h; -} - - -/* Extract a file handle from where it was stored in an FCB by fcb_open() - or fcb_creat(). Aborts if the FCB has been tampered with. - - Note: Some programs (like GENCOM) close FCBs they never opened. This causes - the Corrupt FCB message, but no harm seems to ensue. */ - -int redir_verify_fcb(cpm_byte *fcb) -{ - if (fcb[16] != 0xFD || fcb[17] != 0x00) - { - fprintf(stderr,"cpmredir: Corrupt FCB\n"); - return -1; - } - return (int)(redir_rd32(fcb + 18)); - -} - -/* Print a trace message */ - -#ifdef DEBUG - -void redir_Msg(char *s, ...) -{ - va_list ap; - - va_start(ap, s); - printf("cpmredir trace: "); - vprintf(s, ap); - va_end(ap); - fflush(stdout); -} - -#endif - -#define BCD(x) (((x % 10)+16*(x/10)) & 0xFF) - -/* Convert time_t to CP/M day count/hours/minutes */ -dword redir_cpmtime(time_t t) -{ - long d = (t / 86400) - 2921; /* CP/M day 0 is unix day 2921 */ - long h = (t % 86400) / 3600; /* Hour, 0-23 */ - long m = (t % 3600) / 60; /* Minute, 0-59 */ - - return (d | (BCD(h) << 16) | (BCD(m) << 24)); -} - -#undef BCD - -#define UNBCD(x) (((x % 16) + 10 * (x / 16)) & 0xFF) - -time_t redir_unixtime(cpm_byte *c) -{ - time_t t; - cpm_word days; - - days = (c[0] + 256 * c[1]) + 2921; - - t = 60L * UNBCD(c[3]); - t += 3600L * UNBCD(c[2]); - t += 86400L * days; - - return t; -} - -#undef UNBCD - - -/* Functions to access 24-bit & 32-bit words in memory. These are always - little-endian. */ - -void redir_wr24(cpm_byte *addr, dword v) -{ - addr[0] = v & 0xFF; - addr[1] = (v >> 8) & 0xFF; - addr[2] = (v >> 16) & 0xFF; -} - -void redir_wr32(cpm_byte *addr, dword v) -{ - addr[0] = v & 0xFF; - addr[1] = (v >> 8) & 0xFF; - addr[2] = (v >> 16) & 0xFF; - addr[3] = (v >> 24) & 0xFF; -} - -dword redir_rd24(cpm_byte *addr) -{ - register dword rv = addr[2]; - - rv = (rv << 8) | addr[1]; - rv = (rv << 8) | addr[0]; - return rv; -} - - -dword redir_rd32(cpm_byte *addr) -{ - register dword rv = addr[3]; - - rv = (rv << 8) | addr[2]; - rv = (rv << 8) | addr[1]; - rv = (rv << 8) | addr[0]; - return rv; -} - - -void redir_log_drv(cpm_byte drv) -{ - if (!drv) redir_l_drives |= 1; - else redir_l_drives |= (1L << drv); -} - -void redir_log_fcb(cpm_byte *fcb) -{ - int drv = fcb[0] & 0x7F; - - if (drv && drv != '?') redir_log_drv(drv - 1); - else redir_log_drv(redir_cpmdrive); -} - - -int redir_ro_drv(cpm_byte drv) -{ - if (!drv) return redir_ro_drives & 1; - else return redir_ro_drives & (1L << drv); -} - -int redir_ro_fcb(cpm_byte *fcb) -{ - int drv = fcb[0] & 0x7F; - - if (drv && drv != '?') return redir_ro_drv(drv - 1); - else return redir_ro_drv(redir_cpmdrive); -} - - - -cpm_word redir_xlt_err(void) -{ - if (redir_password_error()) return 0x7FF; /* DRDOS pwd error */ - switch(errno) - { - case EISDIR: - case EBADF: return 9; /* Bad FCB */ - case EINVAL: return 0x03FF; /* Readonly file */ - case EPIPE: return 0x01FF; /* Broken pipe */ - case ENOSPC: return 1; /* No space */ - default: return 0xFF; /* Software error */ - } -} - diff --git a/Tools/unix/zx/xlt.c b/Tools/unix/zx/xlt.c deleted file mode 100644 index f0ba1da5..00000000 --- a/Tools/unix/zx/xlt.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - - CPMREDIR: CP/M filesystem redirector - Copyright (C) 1998, John Elliott - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - This file holds functions dealing with name translation; also the - initialisation code. -*/ - -#include "cpmint.h" - -/* Detect DRDOS */ - -#ifdef __MSDOS__ -static void drdos_init(void) -{ - -/* The DJGPP DOS extender won't detect DRDOS using intdos(), so we have - to use __dpmi_int() instead. */ - -#ifdef __GO32__ - __dpmi_regs ir; - - ir.x.ax = 0x4452; /* "DR" */ - - __dpmi_int(0x21, &ir); - if (ir.x.flags & 1) return; /* Not DRDOS */ - - redir_Msg("DRDOS detected.\r\n"); - - redir_drdos = 1; - -#else /* __GO32__ */ - - union REGS ir, or; - - ir.w.ax = 0x4452; /* "DR" */ - - intdos(&ir, &or); - if (or.w.cflag) return; /* Not DRDOS */ - - redir_Msg("DRDOS detected.\r\n"); - - redir_drdos = 1; -#endif /* __GO32__ */ -} -#endif /* __MSDOS__ */ - - - -int fcb_init(void) -{ - int n; - - /* A: to O: free */ - for (n = 0; n < 15; n++) redir_drive_prefix[n][0] = 0; - - strcpy(redir_drive_prefix[15], "./"); /* P: is current directory */ - - /* Log on to P:. It is the only drive at this point which we - * know works. */ - redir_cpmdrive = 15; -#ifdef __MSDOS__ - drdos_init(); -#endif - - return 1; -} - -/* Deinitialise the library. */ - -void fcb_deinit(void) -{ - /* Nothing */ -} - -/* Translate a name from the host FS to a CP/M name. This will (if necessary) - * create a mapping between a CP/M drive and a host directory path. - * - * CP/M drives A: to O: can be mapped in this way. P: is always the current - * drive. - * - */ - -void xlt_name(char *localname, char *cpmname) -{ - char ibuf[CPM_MAXPATH + 1]; - char nbuf[CPM_MAXPATH + 1]; - char *pname; - int n; - - sprintf(ibuf, "%-.*s", CPM_MAXPATH, localname); - pname = strrchr(ibuf, '/'); -#ifdef __MSDOS__ - if (!pname) pname = strrchr(ibuf,'\\'); - if (!pname) pname = strrchr(ibuf,':'); -#endif - if (!pname) /* No path separators in the name. It is therefore a - local filename, so map it to drive P: */ - { - strcpy(cpmname, "p:"); - strcat(cpmname, ibuf); - return; - } - ++pname; - strcpy(nbuf, pname); /* nbuf holds filename component */ - *pname = 0; /* ibuf holds path component */ - - /* See if the path is one of those already mapped to drives */ - - for (n = 0; n < 15; n++) - { - if (redir_drive_prefix[n][0] && !strcmp(ibuf, redir_drive_prefix[n])) - { - sprintf(cpmname,"%c:%s", n + 'a', nbuf); - return; - } - } - - /* It is not, see if another drive can be allocated */ - - for (n = 0; n < 15; n++) if (!redir_drive_prefix[n][0]) - { - strcpy(redir_drive_prefix[n], ibuf); - sprintf(cpmname,"%c:%s", n + 'a', nbuf); - return; - } - - /* No other drive can be allocated */ - - strcpy(cpmname,"p:"); - strcat(cpmname, nbuf); -} - -/* It is sometimes convenient to set some fixed mappings. This will create - * a mapping for a given directory. - * Pass drive = -1 for "first available", or 0-15 for A: to P: - */ - -int xlt_map(int drive, char *localdir) -{ - int n; - - if (drive == -1) - { - for (n = 0; n < 15; n++) if (!redir_drive_prefix[n][0]) - { - drive = n; - break; - } - if (drive == -1) return 0; /* No space for mappings */ - } - if (redir_drive_prefix[drive][0]) return 0; /* Drive taken */ - - sprintf(redir_drive_prefix[drive], "%-.*s", CPM_MAXPATH, localdir); - return 1; -} - - -/* Unmap a drive - */ - -int xlt_umap(int drive) -{ - if (!redir_drive_prefix[drive][0]) return 0; /* Drive not taken */ - redir_drive_prefix[drive][0] = 0; - return 1; -} - - -char *xlt_getcwd(int drive) -{ - if (drive < 0 || drive > 16) return ""; - - return redir_drive_prefix[drive]; -} - diff --git a/Tools/unix/zx/z80.c b/Tools/unix/zx/z80.c deleted file mode 100644 index d1d99cd5..00000000 --- a/Tools/unix/zx/z80.c +++ /dev/null @@ -1,270 +0,0 @@ -/* Emulation of the Z80 CPU with hooks into the other parts of xz80. - * Copyright (C) 1994 Ian Collier. - * - * 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. - */ - -#include -#include "zx.h" - -#define parity(a) (partable[a]) - -unsigned char partable[256]={ - 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, - 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, - 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, - 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, - 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, - 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, - 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, - 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, - 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, - 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, - 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, - 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, - 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, - 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, - 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, - 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4 - }; - -#ifdef DEBUG -static unsigned short breakpoint=0; -static unsigned int breaks=0; - -//static void inline log(fp,name,val) -static void log(fp,name,val) -FILE *fp; -char *name; -unsigned short val; -{ - int i; - fprintf(fp,"%s=%04X ",name,val); - for(i=0;i<8;i++,val++)fprintf(fp," %02X",fetch(val)); - putc('\n',fp); -} -#endif - -void mainloop(word spc, word ssp){ - register unsigned char a, f, b, c, d, e, h, l; - unsigned char r, a1, f1, b1, c1, d1, e1, h1, l1, i, iff1, iff2, im; - register unsigned short pc; - unsigned short ix, iy, sp; - register unsigned long tstates; - register unsigned int radjust; - register unsigned char ixoriy, new_ixoriy; - unsigned char intsample; - register unsigned char op; -#ifdef DEBUG - char flags[9]; - int bit; - FILE *fp=0; - register unsigned short af2=0,bc2=0,de2=0,hl2=0,ix2=0,iy2=0,sp2=0; - register unsigned char i2=0; - //unsigned char *memory=memptr[0]; - struct _next {unsigned char bytes[8];} *next; - unsigned short BC, DE, HL, AF; - - fputs("Press F11 to log\n",stderr); -#endif - a=f=b=c=d=e=h=l=a1=f1=b1=c1=d1=e1=h1=l1=i=r=iff1=iff2=im=0; - ixoriy=new_ixoriy=0; - ix=iy=0; - pc=spc; - sp=ssp; - tstates=radjust=0; - while(1){ - ixoriy=new_ixoriy; - new_ixoriy=0; -#ifdef DEBUG - next=(struct _next *)&fetch(pc); - BC=bc;DE=de;HL=hl;AF=(a<<8)|f; - if(fp && !ixoriy){ - log(fp,"pc",pc); - if(sp!=sp2)log(fp,"sp",sp2=sp); - if(iy!=iy2)log(fp,"iy",iy2=iy); - if(ix!=ix2)log(fp,"ix",ix2=ix); - if(hl!=hl2)log(fp,"hl",hl2=hl); - if(de!=de2)log(fp,"de",de2=de); - if(bc!=bc2)log(fp,"bc",bc2=bc); - if(((a<<8)|f)!=af2){ - af2=(a<<8)|f; - strcpy(flags,"SZ H VNC"); - for(bit=0;bit<8;bit++)if(!(f&(1<<(7-bit))))flags[bit]=' '; - fprintf(fp,"af=%04X %s\n",af2,flags); - } - if(i!=i2)fprintf(fp,"ir=%02X%02X\n",i2=i,r); - putc('\n',fp); - } - if(pc==breakpoint && pc) - breaks++; /* some code at which to set a breakpoint */ - a=AF>>8; f=AF; h=HL>>8; l=HL; d=DE>>8; e=DE; b=BC>>8; c=BC; -#endif -/* -{ - static int tr = 0; - static int id = 0; -// static byte b = 0; -// - if (pc == 0x1177) tr = 1; - if (pc == 0x1185) tr = 0; - if (tr >= 1) ++id; - if (tr >= 1) printf("%d: PC=%04x %02x AF=%02x:%02x BC=%04x DE=%04x HL=%04x IX=%04x IY=%04x\r\n", - id, pc, fetch(pc), a,f, bc, de, hl, ix, iy); -} -*/ - intsample=1; - op=fetch(pc); - pc++; - radjust++; - switch(op){ -#include "z80ops.h" - } -/*** - * ZXCC doesn't do interrupts at all, so all this is commented out - if(tstates>=int_cycles && intsample){ - tstates-=int_cycles; - frames++; - // Carry out X-related tasks (including waiting for timer - // signal if necessary) - switch(interrupt()){ - case Z80_quit: -#ifdef DEBUG - if(fp)fclose(fp); -#endif - return; - case Z80_NMI: - if(fetch(pc)==0x76)pc++; - iff2=iff1; - iff1=0; - // The Z80 performs a machine fetch cycle for 5 Tstates - // but ignores the result. It takes a further 10 Tstates - // to jump to the NMI routine at 0x66. - tstates+=15; - push2(pc); - pc=0x66; - break; - case Z80_reset: - a=f=b=c=d=e=h=l=a1=f1=b1=c1=d1=e1= - h1=l1=i=r=iff1=iff2=im=0; - ix=iy=sp=pc=0; - radjust=0; - break; -#ifdef DEBUG - case Z80_log: - if(fp){ - fclose(fp); - fp=0; - fputs("Logging turned off\n",stderr); - } else { - fp=fopen(config.log,"a"); - if(fp)fprintf(stderr,"Logging to file %s\n",config.log); - else perror(config.log); - } - break; -#endif - - case Z80_load: - stopwatch(); - if(snapload()){ - a=snapa; - f=snapf; - b=snapb; - c=snapc; - d=snapd; - e=snape; - h=snaph; - l=snapl; - a1=snapa1; - f1=snapf1; - b1=snapb1; - c1=snapc1; - d1=snapd1; - e1=snape1; - h1=snaph1; - l1=snapl1; - iff1=snapiff1; - iff2=snapiff2; - i=snapi; - r=snapr; - radjust=r; - im=snapim; - ix=snapix; - iy=snapiy; - sp=snapsp; - pc=snappc; - } - startwatch(1); - break; - case Z80_save: - r=(r&0x80)|(radjust&0x7f); - snapa=a; - snapf=f; - snapb=b; - snapc=c; - snapd=d; - snape=e; - snaph=h; - snapl=l; - snapa1=a1; - snapf1=f1; - snapb1=b1; - snapc1=c1; - snapd1=d1; - snape1=e1; - snaph1=h1; - snapl1=l1; - snapiff1=iff1; - snapiff2=iff2; - snapi=i; - snapr=r; - snapim=im; - snapix=ix; - snapiy=iy; - snapsp=sp; - snappc=pc; - snapsave(); - startwatch(1); - break; - - } - if(iff1){ -#ifdef DEBUG - if(fp)fprintf(fp,"Interrupt (im=%d)\n\n",im); -#endif - if(fetch(pc)==0x76)pc++; - iff1=iff2=0; - tstates+=5; // accompanied by an input from the data bus // - switch(im){ - case 0: // IM 0 // - case 1: // undocumented // - case 2: // IM 1 // - // there is little to distinguish between these cases // - tstates+=8; - push2(pc); - pc=0x38; - break; - case 3: // IM 2 // - tstates+=14; - { - int addr=fetch2((i<<8)|0xff); - push2(pc); - pc=addr; - } - } - } - }*/ - } -} diff --git a/Tools/unix/zx/z80.h b/Tools/unix/zx/z80.h deleted file mode 100644 index 89e12a84..00000000 --- a/Tools/unix/zx/z80.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Miscellaneous definitions for xz80, copyright (C) 1994 Ian Collier. - * - * 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. - */ - -/* [John Elliott, 15 July 2001] - * Copied this file into ZXCC, a CP/M emulator. - * Since ZXCC's memory is a flat 64k space and will never be bank-switched, - * the bank-switching code is removed. - * Since ZXCC has no memory-mapped screen, all the screen management code - * goes as well. - * Since ZXCC doesn't need its speed regulated, all the speed regulation - * code goes as well. - * Since ZXCC doesn't save or load snapshots... OK, you get the idea. - */ - -#ifdef HAVE_SYS_PARAM_H -#include -#endif - -#define Z80_quit 1 -#define Z80_NMI 2 -#define Z80_reset 3 -#define Z80_load 4 -#define Z80_save 5 -#define Z80_log 6 - -unsigned int in(); -unsigned int out(); -//int interrupt(); -int snapload(); -void snapsave(); -void mainloop(word xpc, word xsp); -void eachframe(); -void itimeron(); -void itimeroff(); -void startwatch(); -unsigned long stopwatch(); -void requester(); -int loader(); -int saver(); -void multiloader(); -void usage(); -void version(); -void drawborder(); - -#define fetch(x) (RAM[x]) -#define fetch2(x) ((fetch((x)+1)<<8)|fetch(x)) - -#define store(x,y) do { RAM[(x)] = (y); } while(0) - -#define store2b(x,hi,lo) do {\ - RAM[(x)]=(lo); \ - RAM[((x+1) & 0xFFFF)]=(hi); } while(0) - -#define store2(x,y) store2b(x,(y)>>8,y) - -#ifdef __GNUC__ -static void inline storefunc(unsigned short ad,unsigned char b){ - store(ad,b); -} -#undef store -#define store(x,y) storefunc(x,y) - -static void inline store2func(unsigned short ad,unsigned char b1,unsigned char b2){ - store2b(ad,b1,b2); -} -#undef store2b -#define store2b(x,hi,lo) store2func(x,hi,lo) -#endif - -#define bc ((b<<8)|c) -#define de ((d<<8)|e) -#define hl ((h<<8)|l) diff --git a/Tools/unix/zx/z80ops.h b/Tools/unix/zx/z80ops.h deleted file mode 100644 index a9687741..00000000 --- a/Tools/unix/zx/z80ops.h +++ /dev/null @@ -1,1304 +0,0 @@ -/* Emulations of the Z80 CPU instruction set - part of xz80. - * Copyright (C) 1994 Ian Collier. - * - * 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. - */ - -#define instr(opcode,cycles) case opcode: {tstates+=cycles -#define HLinstr(opcode,cycles,morecycles) \ - case opcode: {unsigned short addr; \ - tstates+=cycles; \ - if(ixoriy==0)addr=hl; \ - else tstates+=morecycles, \ - addr=(ixoriy==1?ix:iy)+ \ - (signed char)fetch(pc),\ - pc++ -#define endinstr }; break - -#define cy (f&1) - -#define xh (ixoriy==0?h:ixoriy==1?(ix>>8):(iy>>8)) -#define xl (ixoriy==0?l:ixoriy==1?(ix&0xff):(iy&0xff)) - -#define setxh(x) (ixoriy==0?(h=(x)):ixoriy==1?(ix=(ix&0xff)|((x)<<8)):\ - (iy=(iy&0xff)|((x)<<8))) -#define setxl(x) (ixoriy==0?(l=(x)):ixoriy==1?(ix=(ix&0xff00)|(x)):\ - (iy=(iy&0xff00)|(x))) - -#define inc(var) /* 8-bit increment */ ( var++,\ - f=(f&1)|(var&0xa8)|\ - ((!(var&15))<<4)|((!var)<<6)|\ - ((var==128)<<2)\ - ) -#define dec(var) /* 8-bit decrement */ ( f=(f&1)|((!(var&15))<<4)|2,\ - --var,\ - f|=(var&0xa8)|((var==127)<<2)|\ - ((!var)<<6)\ - ) -#define swap(x,y) {unsigned char t=x; x=y; y=t;} -#define addhl(hi,lo) /* 16-bit add */ if(!ixoriy){\ - unsigned short t;\ - l=t=l+(lo);\ - f=(f&0xc4)|(((t>>=8)+(h&0x0f)+((hi)&0x0f)>15)<<4);\ - h=t+=h+(hi);\ - f|=(h&0x28)|(t>>8);\ - }\ - else do{unsigned long t=(ixoriy==1?ix:iy);\ - f=(f&0xc4)|(((t&0xfff)+((hi<<8)|lo)>0xfff)<<4);\ - t+=(hi<<8)|lo;\ - if(ixoriy==1)ix=t; else iy=t;\ - f|=((t>>8)&0x28)|(t>>16);\ - } while(0) -#define adda(x,c) /* 8-bit add */ do{unsigned short y;\ - unsigned char z=(x);\ - y=a+z+(c);\ - f=(y&0xa8)|(y>>8)|(((a&0x0f)+(z&0x0f)+(c)>15)<<4)|\ - (((~a^z)&0x80&(y^a))>>5);\ - f|=(!(a=y))<<6;\ - } while(0) -#define suba(x,c) /* 8-bit subtract */ do{unsigned short y;\ - unsigned char z=(x);\ - y=(a-z-(c))&0x1ff;\ - f=(y&0xa8)|(y>>8)|(((a&0x0f)<(z&0x0f)+(c))<<4)|\ - (((a^z)&0x80&(y^a))>>5)|2;\ - f|=(!(a=y))<<6;\ - } while(0) -#define cpa(x) /* 8-bit compare */ do{unsigned short y;\ - unsigned char z=(x);\ - y=(a-z)&0x1ff;\ - f=(y&0xa8)|(y>>8)|(((a&0x0f)<(z&0x0f))<<4)|\ - (((a^z)&0x80&(y^a))>>5)|2|((!y)<<6);\ - } while(0) -#define anda(x) /* logical and */ do{\ - a&=(x);\ - f=(a&0xa8)|((!a)<<6)|0x10|parity(a);\ - } while(0) -#define xora(x) /* logical xor */ do{\ - a^=(x);\ - f=(a&0xa8)|((!a)<<6)|parity(a);\ - } while(0) -#define ora(x) /* logical or */ do{\ - a|=(x);\ - f=(a&0xa8)|((!a)<<6)|parity(a);\ - } while(0) - -#define jr /* execute relative jump */ do{int j=(signed char)fetch(pc);\ - pc+=j+1;\ - tstates+=5;\ - } while(0) -#define jp /* execute jump */ (pc=fetch2(pc)) -#define call /* execute call */ do{\ - tstates+=7;\ - push2(pc+2);\ - jp;\ - } while(0) -#define ret /* execute return */ do{\ - tstates+=6;\ - pop2(pc);\ - } while(0) -#define pop2(var) /* pop 16-bit register */ (var=fetch2(sp),sp+=2) -#define pop1(v1,v2) /* pop register pair */ (v2=fetch(sp),\ - v1=fetch(sp+1),sp+=2) -#define push2(val) /* push 16-bit register */ do{sp-=2;store2(sp,(val));}\ - while(0) -#define push1(v1,v2) /* push register pair */ do{sp-=2;\ - store2b(sp,v1,v2);\ - }while(0) - -instr(0,4); - /* nop */ -endinstr; - -instr(1,10); - c=fetch(pc),pc++; - b=fetch(pc),pc++; -endinstr; - -instr(2,7); - store(bc,a); -endinstr; - -instr(3,6); - if(!++c)b++; -endinstr; - -instr(4,4); - inc(b); -endinstr; - -instr(5,4); - dec(b); -endinstr; - -instr(6,7); - b=fetch(pc),pc++; -endinstr; - -instr(7,4); - a=(a<<1)|(a>>7); - f=(f&0xc4)|(a&0x29); -endinstr; - -instr(8,4); - swap(a,a1); - swap(f,f1); -endinstr; - -instr(9,11); - addhl(b,c); -endinstr; - -instr(10,7); - a=fetch(bc); -endinstr; - -instr(11,6); - if(!c--)b--; -endinstr; - -instr(12,4); - inc(c); -endinstr; - -instr(13,4); - dec(c); -endinstr; - -instr(14,7); - c=fetch(pc),pc++; -endinstr; - -instr(15,4); - f=(f&0xc4)|(a&1); - a=(a>>1)|(a<<7); - f|=a&0x28; -endinstr; - -instr(16,8); - if(!--b)pc++; - else jr; -endinstr; - -instr(17,10); - e=fetch(pc),pc++; - d=fetch(pc),pc++; -endinstr; - -instr(18,7); - store(de,a); -endinstr; - -instr(19,6); - if(!++e)d++; -endinstr; - -instr(20,4); - inc(d); -endinstr; - -instr(21,4); - dec(d); -endinstr; - -instr(22,7); - d=fetch(pc),pc++; -endinstr; - -instr(23,4); - {int t=a>>7; - a=(a<<1)|(f&1); - f=(f&0xc4)|(a&0x28)|t; - } -endinstr; - -instr(24,7); - jr; -endinstr; - -instr(25,11); - addhl(d,e); -endinstr; - -instr(26,7); - a=fetch(de); -endinstr; - -instr(27,6); - if(!e--)d--; -endinstr; - -instr(28,4); - inc(e); -endinstr; - -instr(29,4); - dec(e); -endinstr; - -instr(30,7); - e=fetch(pc),pc++; -endinstr; - -instr(31,4); - {int t=a&1; - a=(a>>1)|(f<<7); - f=(f&0xc4)|(a&0x28)|t; - } -endinstr; - -instr(32,7); - if(f&0x40)pc++; - else jr; -endinstr; - -instr(33,10); - if(!ixoriy){ - l=fetch(pc),pc++; - h=fetch(pc),pc++; - } - else { - if(ixoriy==1)ix=fetch2(pc); - else iy=fetch2(pc); - pc+=2; - } -endinstr; - -instr(34,16); - {unsigned short addr=fetch2(pc); - pc+=2; - if(!ixoriy)store2b(addr,h,l); - else if(ixoriy==1)store2(addr,ix); - else store2(addr,iy); - } -endinstr; - -instr(35,6); - if(!ixoriy){if(!++l)h++;} - else if(ixoriy==1)ix++; - else iy++; -endinstr; - -instr(36,4); - if(ixoriy==0)inc(h); - else{unsigned char t; - t=(ixoriy==1?ix:iy)>>8; - inc(t); - if(ixoriy==1)ix=(ix&0xff)|(t<<8); - else iy=(iy&0xff)|(t<<8); - } -endinstr; - -instr(37,4); - if(ixoriy==0)dec(h); - else{unsigned char t; - t=(ixoriy==1?ix:iy)>>8; - dec(t); - if(ixoriy==1)ix=(ix&0xff)|(t<<8); - else iy=(iy&0xff)|(t<<8); - } -endinstr; - -instr(38,7); - setxh(fetch(pc)); - pc++; -endinstr; - -instr(39,4); - { - unsigned char incr=0, carry=cy; - if((f&0x10) || (a&0x0f)>9) incr=6; - if((f&1) || (a>>4)>9) incr|=0x60; - if(f&2)suba(incr,0); - else { - if(a>0x90 && (a&15)>9)incr|=0x60; - adda(incr,0); - } - f=((f|carry)&0xfb)|parity(a); - } -endinstr; - -instr(40,7); - if(f&0x40)jr; - else pc++; -endinstr; - -instr(41,11); - if(!ixoriy)addhl(h,l); - else if(ixoriy==1)addhl((ix>>8),(ix&0xff)); - else addhl((iy>>8),(iy&0xff)); -endinstr; - -instr(42,16); - {unsigned short addr=fetch2(pc); - pc+=2; - if(!ixoriy){ - l=fetch(addr); - h=fetch(addr+1); - } - else if(ixoriy==1)ix=fetch2(addr); - else iy=fetch2(addr); - } -endinstr; - -instr(43,6); - if(!ixoriy){if(!l--)h--;} - else if(ixoriy==1)ix--; - else iy--; -endinstr; - -instr(44,4); - if(!ixoriy)inc(l); - else {unsigned char t; - t=(ixoriy==1?ix:iy); - inc(t); - if(ixoriy==1)ix=(ix&0xff00)|t; - else iy=(iy&0xff00)|t; - } -endinstr; - -instr(45,4); - if(!ixoriy)dec(l); - else {unsigned char t; - t=(ixoriy==1?ix:iy); - dec(t); - if(ixoriy==1)ix=(ix&0xff00)|t; - else iy=(iy&0xff00)|t; - } -endinstr; - -instr(46,7); - setxl(fetch(pc)); - pc++; -endinstr; - -instr(47,4); - a=~a; - f=(f&0xc5)|(a&0x28)|0x12; -endinstr; - -instr(48,7); - if(f&1)pc++; - else jr; -endinstr; - -instr(49,10); - sp=fetch2(pc); - pc+=2; -endinstr; - -instr(50,13); - {unsigned short addr=fetch2(pc); - pc+=2; - store(addr,a); - } -endinstr; - -instr(51,6); - sp++; -endinstr; - -HLinstr(52,11,8); - {unsigned char t=fetch(addr); - inc(t); - store(addr,t); - } -endinstr; - -HLinstr(53,11,8); - {unsigned char t=fetch(addr); - dec(t); - store(addr,t); - } -endinstr; - -HLinstr(54,10,5); - store(addr,fetch(pc)); - pc++; -endinstr; - -instr(55,4); - f=(f&0xc4)|1|(a&0x28); -endinstr; - -instr(56,7); - if(f&1)jr; - else pc++; -endinstr; - -instr(57,11); - addhl((sp>>8),(sp&0xff)); -endinstr; - -instr(58,13); - {unsigned short addr=fetch2(pc); - pc+=2; - a=fetch(addr); - } -endinstr; - -instr(59,6); - sp--; -endinstr; - -instr(60,4); - inc(a); -endinstr; - -instr(61,4); - dec(a); -endinstr; - -instr(62,7); - a=fetch(pc),pc++; -endinstr; - -instr(63,4); - f=(f&0xc4)|(cy^1)|(cy<<4)|(a&0x28); -endinstr; - -instr(0x40,4); - /* ld b,b */ -endinstr; - -instr(0x41,4); - b=c; -endinstr; - -instr(0x42,4); - b=d; -endinstr; - -instr(0x43,4); - b=e; -endinstr; - -instr(0x44,4); - b=xh; -endinstr; - -instr(0x45,4); - b=xl; -endinstr; - -HLinstr(0x46,7,8); - b=fetch(addr); -endinstr; - -instr(0x47,4); - b=a; -endinstr; - -instr(0x48,4); - c=b; -endinstr; - -instr(0x49,4); - /* ld c,c */ -endinstr; - -instr(0x4a,4); - c=d; -endinstr; - -instr(0x4b,4); - c=e; -endinstr; - -instr(0x4c,4); - c=xh; -endinstr; - -instr(0x4d,4); - c=xl; -endinstr; - -HLinstr(0x4e,7,8); - c=fetch(addr); -endinstr; - -instr(0x4f,4); - c=a; -endinstr; - -instr(0x50,4); - d=b; -endinstr; - -instr(0x51,4); - d=c; -endinstr; - -instr(0x52,4); - /* ld d,d */ -endinstr; - -instr(0x53,4); - d=e; -endinstr; - -instr(0x54,4); - d=xh; -endinstr; - -instr(0x55,4); - d=xl; -endinstr; - -HLinstr(0x56,7,8); - d=fetch(addr); -endinstr; - -instr(0x57,4); - d=a; -endinstr; - -instr(0x58,4); - e=b; -endinstr; - -instr(0x59,4); - e=c; -endinstr; - -instr(0x5a,4); - e=d; -endinstr; - -instr(0x5b,4); - /* ld e,e */ -endinstr; - -instr(0x5c,4); - e=xh; -endinstr; - -instr(0x5d,4); - e=xl; -endinstr; - -HLinstr(0x5e,7,8); - e=fetch(addr); -endinstr; - -instr(0x5f,4); - e=a; -endinstr; - -instr(0x60,4); - setxh(b); -endinstr; - -instr(0x61,4); - setxh(c); -endinstr; - -instr(0x62,4); - setxh(d); -endinstr; - -instr(0x63,4); - setxh(e); -endinstr; - -instr(0x64,4); - /* ld h,h */ -endinstr; - -instr(0x65,4); - setxh(xl); -endinstr; - -HLinstr(0x66,7,8); - h=fetch(addr); -endinstr; - -instr(0x67,4); - setxh(a); -endinstr; - -instr(0x68,4); - setxl(b); -endinstr; - -instr(0x69,4); - setxl(c); -endinstr; - -instr(0x6a,4); - setxl(d); -endinstr; - -instr(0x6b,4); - setxl(e); -endinstr; - -instr(0x6c,4); - setxl(xh); -endinstr; - -instr(0x6d,4); - /* ld l,l */ -endinstr; - -HLinstr(0x6e,7,8); - l=fetch(addr); -endinstr; - -instr(0x6f,4); - setxl(a); -endinstr; - -HLinstr(0x70,7,8); - store(addr,b); -endinstr; - -HLinstr(0x71,7,8); - store(addr,c); -endinstr; - -HLinstr(0x72,7,8); - store(addr,d); -endinstr; - -HLinstr(0x73,7,8); - store(addr,e); -endinstr; - -HLinstr(0x74,7,8); - store(addr,h); -endinstr; - -HLinstr(0x75,7,8); - store(addr,l); -endinstr; - -instr(0x76,4); - /* Was HALT - ZXCC ignores HALT */ -endinstr; - -HLinstr(0x77,7,8); - store(addr,a); -endinstr; - -instr(0x78,4); - a=b; -endinstr; - -instr(0x79,4); - a=c; -endinstr; - -instr(0x7a,4); - a=d; -endinstr; - -instr(0x7b,4); - a=e; -endinstr; - -instr(0x7c,4); - a=xh; -endinstr; - -instr(0x7d,4); - a=xl; -endinstr; - -HLinstr(0x7e,7,8); - a=fetch(addr); -endinstr; - -instr(0x7f,4); - /* ld a,a */ -endinstr; - -instr(0x80,4); - adda(b,0); -endinstr; - -instr(0x81,4); - adda(c,0); -endinstr; - -instr(0x82,4); - adda(d,0); -endinstr; - -instr(0x83,4); - adda(e,0); -endinstr; - -instr(0x84,4); - adda(xh,0); -endinstr; - -instr(0x85,4); - adda(xl,0); -endinstr; - -HLinstr(0x86,7,8); - adda(fetch(addr),0); -endinstr; - -instr(0x87,4); - adda(a,0); -endinstr; - -instr(0x88,4); - adda(b,cy); -endinstr; - -instr(0x89,4); - adda(c,cy); -endinstr; - -instr(0x8a,4); - adda(d,cy); -endinstr; - -instr(0x8b,4); - adda(e,cy); -endinstr; - -instr(0x8c,4); - adda(xh,cy); -endinstr; - -instr(0x8d,4); - adda(xl,cy); -endinstr; - -HLinstr(0x8e,7,8); - adda(fetch(addr),cy); -endinstr; - -instr(0x8f,4); - adda(a,cy); -endinstr; - -instr(0x90,4); - suba(b,0); -endinstr; - -instr(0x91,4); - suba(c,0); -endinstr; - -instr(0x92,4); - suba(d,0); -endinstr; - -instr(0x93,4); - suba(e,0); -endinstr; - -instr(0x94,4); - suba(xh,0); -endinstr; - -instr(0x95,4); - suba(xl,0); -endinstr; - -HLinstr(0x96,7,8); - suba(fetch(addr),0); -endinstr; - -instr(0x97,4); - suba(a,0); -endinstr; - -instr(0x98,4); - suba(b,cy); -endinstr; - -instr(0x99,4); - suba(c,cy); -endinstr; - -instr(0x9a,4); - suba(d,cy); -endinstr; - -instr(0x9b,4); - suba(e,cy); -endinstr; - -instr(0x9c,4); - suba(xh,cy); -endinstr; - -instr(0x9d,4); - suba(xl,cy); -endinstr; - -HLinstr(0x9e,7,8); - suba(fetch(addr),cy); -endinstr; - -instr(0x9f,4); - suba(a,cy); -endinstr; - -instr(0xa0,4); - anda(b); -endinstr; - -instr(0xa1,4); - anda(c); -endinstr; - -instr(0xa2,4); - anda(d); -endinstr; - -instr(0xa3,4); - anda(e); -endinstr; - -instr(0xa4,4); - anda(xh); -endinstr; - -instr(0xa5,4); - anda(xl); -endinstr; - -HLinstr(0xa6,7,8); - anda(fetch(addr)); -endinstr; - -instr(0xa7,4); - anda(a); -endinstr; - -instr(0xa8,4); - xora(b); -endinstr; - -instr(0xa9,4); - xora(c); -endinstr; - -instr(0xaa,4); - xora(d); -endinstr; - -instr(0xab,4); - xora(e); -endinstr; - -instr(0xac,4); - xora(xh); -endinstr; - -instr(0xad,4); - xora(xl); -endinstr; - -HLinstr(0xae,7,8); - xora(fetch(addr)); -endinstr; - -instr(0xaf,4); - xora(a); -endinstr; - -instr(0xb0,4); - ora(b); -endinstr; - -instr(0xb1,4); - ora(c); -endinstr; - -instr(0xb2,4); - ora(d); -endinstr; - -instr(0xb3,4); - ora(e); -endinstr; - -instr(0xb4,4); - ora(xh); -endinstr; - -instr(0xb5,4); - ora(xl); -endinstr; - -HLinstr(0xb6,7,8); - ora(fetch(addr)); -endinstr; - -instr(0xb7,4); - ora(a); -endinstr; - -instr(0xb8,4); - cpa(b); -endinstr; - -instr(0xb9,4); - cpa(c); -endinstr; - -instr(0xba,4); - cpa(d); -endinstr; - -instr(0xbb,4); - cpa(e); -endinstr; - -instr(0xbc,4); - cpa(xh); -endinstr; - -instr(0xbd,4); - cpa(xl); -endinstr; - -HLinstr(0xbe,7,8); - cpa(fetch(addr)); -endinstr; - -instr(0xbf,4); - cpa(a); -endinstr; - -instr(0xc0,5); - if(!(f&0x40))ret; -endinstr; - -instr(0xc1,10); - pop1(b,c); -endinstr; - -instr(0xc2,10); - if(!(f&0x40))jp; - else pc+=2; -endinstr; - -instr(0xc3,10); - jp; -endinstr; - -instr(0xc4,10); - if(!(f&0x40))call; - else pc+=2; -endinstr; - -instr(0xc5,11); - push1(b,c); -endinstr; - -instr(0xc6,7); - adda(fetch(pc),0); - pc++; -endinstr; - -instr(0xc7,11); - push2(pc); - pc=0; -endinstr; - -instr(0xc8,5); - if(f&0x40)ret; -endinstr; - -instr(0xc9,4); - ret; -endinstr; - -instr(0xca,10); - if(f&0x40)jp; - else pc+=2; -endinstr; - -instr(0xcb,4); -#include "cbops.h" -endinstr; - -instr(0xcc,10); - if(f&0x40)call; - else pc+=2; -endinstr; - -instr(0xcd,10); - call; -endinstr; - -instr(0xce,7); - adda(fetch(pc),cy); - pc++; -endinstr; - -instr(0xcf,11); - push2(pc); - pc=8; -endinstr; - -instr(0xd0,5); - if(!cy)ret; -endinstr; - -instr(0xd1,10); - pop1(d,e); -endinstr; - -instr(0xd2,10); - if(!cy)jp; - else pc+=2; -endinstr; - -instr(0xd3,11); - tstates+=out(tstates,a,fetch(pc),a); - pc++; -endinstr; - -instr(0xd4,10); - if(!cy)call; - else pc+=2; -endinstr; - -instr(0xd5,11); - push1(d,e); -endinstr; - -instr(0xd6,7); - suba(fetch(pc),0); - pc++; -endinstr; - -instr(0xd7,11); - push2(pc); - pc=16; -endinstr; - -instr(0xd8,5); - if(cy)ret; -endinstr; - -instr(0xd9,4); - swap(b,b1); - swap(c,c1); - swap(d,d1); - swap(e,e1); - swap(h,h1); - swap(l,l1); -endinstr; - -instr(0xda,10); - if(cy)jp; - else pc+=2; -endinstr; - -instr(0xdb,11); - {unsigned short t; - a=t=in(tstates,a,fetch(pc)); - tstates+=t>>8; - pc++; - } -endinstr; - -instr(0xdc,10); - if(cy)call; - else pc+=2; -endinstr; - -instr(0xdd,4); - new_ixoriy=1; - intsample=0; -endinstr; - -instr(0xde,7); - suba(fetch(pc),cy); - pc++; -endinstr; - -instr(0xdf,11); - push2(pc); - pc=24; -endinstr; - -instr(0xe0,5); - if(!(f&4))ret; -endinstr; - -instr(0xe1,10); - if(!ixoriy)pop1(h,l); - else if(ixoriy==1)pop2(ix); - else pop2(iy); -endinstr; - -instr(0xe2,10); - if(!(f&4))jp; - else pc+=2; -endinstr; - -instr(0xe3,19); - if(!ixoriy){ - unsigned short t=fetch2(sp); - store2b(sp,h,l); - l=t; - h=t>>8; - } - else if(ixoriy==1){ - unsigned short t=fetch2(sp); - store2(sp,ix); - ix=t; - } - else{ - unsigned short t=fetch2(sp); - store2(sp,iy); - iy=t; - } -endinstr; - -instr(0xe4,10); - if(!(f&4))call; - else pc+=2; -endinstr; - -instr(0xe5,11); - if(!ixoriy)push1(h,l); - else if(ixoriy==1)push2(ix); - else push2(iy); -endinstr; - -instr(0xe6,7); - anda(fetch(pc)); - pc++; -endinstr; - -instr(0xe7,11); - push2(pc); - pc=32; -endinstr; - -instr(0xe8,5); - if(f&4)ret; -endinstr; - -instr(0xe9,4); - pc=!ixoriy?hl:ixoriy==1?ix:iy; -endinstr; - -instr(0xea,10); - if(f&4)jp; - else pc+=2; -endinstr; - -instr(0xeb,4); - swap(h,d); - swap(e,l); -endinstr; - -instr(0xec,10); - if(f&4)call; - else pc+=2; -endinstr; - -instr(0xed,4); -#include"edops.h" -endinstr; - -instr(0xee,7); - xora(fetch(pc)); - pc++; -endinstr; - -instr(0xef,11); - push2(pc); - pc=40; -endinstr; - -instr(0xf0,5); - if(!(f&0x80))ret; -endinstr; - -instr(0xf1,10); - pop1(a,f); -endinstr; - -instr(0xf2,10); - if(!(f&0x80))jp; - else pc+=2; -endinstr; - -instr(0xf3,4); - iff1=iff2=0; - intsample=0; -endinstr; - -instr(0xf4,10); - if(!(f&0x80))call; - else pc+=2; -endinstr; - -instr(0xf5,11); - push1(a,f); -endinstr; - -instr(0xf6,7); - ora(fetch(pc)); - pc++; -endinstr; - -instr(0xf7,11); - push2(pc); - pc=48; -endinstr; - -instr(0xf8,5); - if(f&0x80)ret; -endinstr; - -instr(0xf9,6); - sp=!ixoriy?hl:ixoriy==1?ix:iy; -endinstr; - -instr(0xfa,10); - if(f&0x80)jp; - else pc+=2; -endinstr; - -instr(0xfb,4); - iff1=iff2=1; - intsample=0; -endinstr; - -instr(0xfc,10); - if(f&0x80)call; - else pc+=2; -endinstr; - -instr(0xfd,4); - new_ixoriy=2; - intsample=0; -endinstr; - -instr(0xfe,7); - cpa(fetch(pc)); - pc++; -endinstr; - -instr(0xff,11); - push2(pc); - pc=56; -endinstr; - diff --git a/Tools/unix/zx/zx.c b/Tools/unix/zx/zx.c deleted file mode 100644 index 0ea315d0..00000000 --- a/Tools/unix/zx/zx.c +++ /dev/null @@ -1,437 +0,0 @@ -#include "zx.h" - -#ifdef WIN32 -#include "windows.h" -#endif - -/* Global variables */ - -char *progname; -char **argv; -int argc; - -byte cpm_drive; -char *mypath; - -byte cpm_user; -extern byte cpm_error; - -byte RAM[65536]; /* The Z80's address space */ - -void load_comfile(void); /* Forward declaration */ - -static int deinit_term, deinit_gsx; - -void dump_regs(FILE *fp, byte a, byte b, byte c, byte d, byte e, byte f, - byte h, byte l, word pc, word ix, word iy) -{ - fprintf(fp, "\tAF=%02x%02x BC=%02x%02x DE=%02x%02x HL=%02x%02x\n" - "\tIX=%04x IY=%04x PC=%04x\n", - a,f,b,c,d,e,h,l,pc,ix,iy); -} - - - -char *parse_to_fcb(char *s, int afcb) -{ - byte *fcb = &RAM[afcb+1]; - - RAM[afcb] = 0; - memset(fcb, ' ', 11); - - while (1) - { - if (s[0] == 0) break; - if (s[0] == ' ') {++s; continue; } - if (s[1] == ':') - { - RAM[afcb] = s[0] - '@'; - if (RAM[afcb] > 16) RAM[afcb] -= 0x20; - s+=2; - continue; - } - if (s[0] == '.') - { - ++s; - fcb = &RAM[afcb+9]; - continue; - } - *fcb = *s; if (islower(*fcb)) *fcb = toupper(*fcb); - ++s; - ++fcb; - if (fcb >= &RAM[afcb+12]) break; - } - return s; -} - - -void Msg(char *s, ...) -{ -#ifdef DEBUG - va_list ap; - - va_start(ap, s); - printf("%s trace: ", progname); - vprintf(s, ap); - fflush(stdout); - if (s[strlen(s) - 1] == '\n') putchar('\r'); - va_end(ap); -#endif -} - - -void ed_fe(byte *a, byte *b, byte *c, byte *d, byte *e, byte *f, - byte *h, byte *l, word *pc, word *ix, word *iy) -{ - switch(*a) - { - case 0xC0: - cpmbdos(a,b,c,d,e,f,h,l,pc,ix,iy); - break; - - case 0xC1: - load_comfile(); - break; - - case 0xC2: - fprintf(stderr,"%s: Incompatible BIOS.BIN\n", progname); - zx_term(); - zx_exit(1); - - case 0xC3: - cpmbios(a,b,c,d,e,f,h,l,pc,ix,iy); - break; - - default: - fprintf(stderr, "%s: Z80 encountered invalid trap\n", progname); - dump_regs(stderr,*a,*b,*c,*d,*e,*f,*h,*l,*pc,*ix,*iy); - zx_term(); - zx_exit(1); - - } -} - - -/* - * load_bios() loads the minimal CP/M BIOS and BDOS. - * - */ - -void load_bios(void) -{ - int bios_len; - - FILE * fp = NULL; - char biospath[CPM_MAXPATH + 1] = ""; - -#ifdef WIN32 - if (!fp) - { - GetModuleFileName(NULL, biospath, sizeof(biospath)); - strcpy(strrchr(biospath, '\\'), "\\bios.bin"); - fp = fopen(biospath, "rb"); - } -#else - if (!fp) { - strcpy(biospath, mypath); - strcpy(strrchr(biospath, '/'), "/bios.bin"); - fp = fopen(biospath, "rb"); - } -#endif - - if (!fp && BINDIR80) - { - strcpy(biospath, BINDIR80); - strcat(biospath, "bios.bin"); - fp = fopen(biospath, "rb"); - } - - if (!fp) fp = fopen("bios.bin", "rb"); - - if (!fp) - { - fprintf(stderr,"%s: Cannot locate bios.bin\n", progname); - zx_term(); - zx_exit(1); - } - bios_len = fread(RAM + 0xFE00, 1, 512, fp); - if (bios_len < 1 || ferror(fp)) - { - fclose(fp); - fprintf(stderr,"%s: Cannot load bios.bin\n", progname); - zx_term(); - zx_exit(1); - } - fclose(fp); - - Msg("Loaded %d bytes of BIOS\n", bios_len); -} - -/* - * try_com() attempts to open file, file.com, file.COM, file.cpm and file.CPM - * - */ - -FILE *try_com(char *s) -{ - char fname[CPM_MAXPATH + 1]; - FILE *fp; - - strcpy(fname, s); - fp = fopen(s, "rb"); if (fp) return fp; - sprintf(s,"%s.com", fname); fp = fopen(s, "rb"); if (fp) return fp; - sprintf(s,"%s.COM", fname); fp = fopen(s, "rb"); if (fp) return fp; - sprintf(s,"%s.cpm", fname); fp = fopen(s, "rb"); if (fp) return fp; - sprintf(s,"%s.CPM", fname); fp = fopen(s, "rb"); if (fp) return fp; - - strcpy(s, fname); - return NULL; -} - -/* - * load_comfile() loads the COM file whose name was passed as a parameter. - * - */ - - -void load_comfile(void) -{ - int com_len; - char fname[CPM_MAXPATH + 1] = ""; - FILE *fp; - - if (BINDIR80) strcpy(fname, BINDIR80); - strcat(fname, argv[1]); - fp = try_com(fname); - if (!fp) - { - strcpy(fname, argv[1]); - fp = try_com(fname); - } - if (!fp) - { - fprintf(stderr,"%s: Cannot locate %s, %s.com, %s.COM, %s.cpm _or_ %s.CPM\r\n", - progname, argv[1], argv[1], argv[1], argv[1], argv[1]); - zx_term(); - zx_exit(1); - } - com_len = fread(RAM + 0x0100, 1, 0xFD00, fp); - if (com_len < 1 || ferror(fp)) - { - fclose(fp); - fprintf(stderr,"%s: Cannot load %s\n", progname, fname); - zx_term(); - zx_exit(1); - } - fclose(fp); - - Msg("Loaded %d bytes from %s\n", com_len, fname); -} - -unsigned int in() { return 0; } -unsigned int out() { return 0; } - - - -/* - * xltname: Convert a unix filepath into a CP/M compatible drive:name form. - * The unix filename must be 8.3 or the CP/M code will reject it. - * - * This uses the library xlt_name to do the work, and then just strcat()s - * the result to the command line. - */ - -void zx_xltname(char *name, char *pcmd) -{ - char nbuf[CPM_MAXPATH + 1]; - - xlt_name(pcmd, nbuf); - - strcat(name, nbuf); -} - -/* main() parses the arguments to CP/M form. argv[1] is the name of the CP/M - program to load; the remaining arguments are arguments for the CP/M program. - - main() also loads the vestigial CP/M BIOS and does some sanity checks - on the endianness of the host CPU and the sizes of data types. - */ - -int main(int ac, char **av) -{ - int n; - char *pCmd, *str; - - argc = ac; - argv = av; -#ifdef __PACIFIC__ /* Pacific C doesn't support argv[0] */ - progname="ZX"; -#endif - progname = argv[0]; - mypath = strdup(argv[0]); - - /* DJGPP includes the whole path in the program name, which looks - * untidy... - */ - str = strrchr(progname, '/'); - if (!str) str = strrchr(progname, '\\'); - if (str) progname = str + 1; - - if (_isatty(_fileno(stdin))) - Msg("Using interactive console mode\n"); - else - Msg("Using standard input/ouput mode\n"); - - if (sizeof(int) > 8 || sizeof(byte) != 1 || sizeof(word) != 2) - { - fprintf(stderr,"%s: type lengths incorrect; edit typedefs " - "and recompile.\n", progname); - zx_exit(1); - } - - if (argc < 2) - { - fprintf(stderr,"%s: No CP/M program name provided.\n",progname); - zx_exit(1); - } - - - setmode(_fileno(stdin), O_BINARY ); - setmode(_fileno(stdout), O_BINARY ); - - /* Parse arguments. An argument can be either: - - * preceded by a '-', in which case it is copied in as-is, less the - dash; - * preceded by a '+', in which case it is parsed as a filename and - then concatenated to the previous argument; - * preceded by a '+-', in which case it is concatenated without - parsing; - * not preceded by either, in which case it is parsed as a filename. - - So, the argument string "--a -b c +-=q --x +/dev/null" would be rendered - into CP/M form as "-a b p:c=q -xd:null" */ - - if (!fcb_init()) - { - fprintf(stderr, "Could not initialise CPMREDIR library\n"); - zx_exit(1); - } - - xlt_map(0, BINDIR80); /* Establish the 3 fixed mappings */ - xlt_map(1, LIBDIR80); - xlt_map(2, INCDIR80); - pCmd = (char *)RAM + 0x81; - - for (n = 2; n < argc; n++) - { - if (argv[n][0] == '+' && argv[n][1] == '-') - { - /* Append, no parsing */ - strcat(pCmd, argv[n] + 2); - } - else if (!argv[n][0] || argv[n][0] == '-') - { - /* Append with space; no parsing. */ - strcat(pCmd, " "); - strcat(pCmd, argv[n] + 1); - } - else if (argv[n][0] == '+') - { - zx_xltname(pCmd, argv[n]+1); - } - else /* Translate a filename */ - { - strcat(pCmd, " "); - zx_xltname(pCmd, argv[n]); - } - - } - pCmd[0x7F] = 0; /* Truncate to fit the buffer */ - RAM[0x80] = strlen(pCmd); - - str = parse_to_fcb(pCmd, 0x5C); - parse_to_fcb(str, 0x6C); - -/* This statement is very useful when creating a client like zxc or zxas - - printf("Command tail is %s\n", pCmd); -*/ - load_bios(); - - memset(RAM + 0xFE9C, 0, 0x64); /* Zap the SCB */ - RAM[0xFE98] = 0x06; - RAM[0xFE99] = 0xFE; /* FE06, BDOS entry */ - RAM[0xFEA1] = 0x31; /* BDOS 3.1 */ - RAM[0xFEA8] = 0x01; /* UK date format */ - RAM[0xFEAF] = 0x0F; /* CCP drive */ - -#ifdef USE_CPMIO - RAM[0xFEB6] = cpm_term_direct(CPM_TERM_WIDTH, -1); - RAM[0xFEB8] = cpm_term_direct(CPM_TERM_HEIGHT, -1); -#else - RAM[0xFEB6] = 79; - RAM[0xFEB8] = 23; -#endif - RAM[0xFED1] = 0x80; /* Buffer area */ - RAM[0xFED2] = 0xFF; - RAM[0xFED3] = '$'; - RAM[0xFED6] = 0x9C; - RAM[0xFED7] = 0xFE; /* SCB address */ - RAM[0xFED8] = 0x80; /* DMA address */ - RAM[0xFED9] = 0x00; - RAM[0xFEDA] = 0x0F; /* P: */ - RAM[0xFEE6] = 0x01; /* Multi sector count */ - RAM[0xFEFE] = 0x06; - RAM[0xFEFF] = 0xFE; /* BDOS */ - - cpm_drive = 0x0F; /* Start logged into P: */ - cpm_user = 0; /* and user 0 */ - -#ifdef USE_CPMIO - cpm_scr_init(); deinit_term = 1; -#endif -#ifdef USE_CPMGSX - gsx_init(); deinit_gsx = 1; -#endif - - /* Start the Z80 at 0xFF00, with stack at 0xFE00 */ - mainloop(0xFF00, 0xFE00); - - return zx_term(); -} - -void zx_exit(int code) -{ -#ifdef USE_CPMIO - if (deinit_term) cpm_scr_unit(); -#endif -#ifdef USE_CPMGSX - if (deinit_gsx) gsx_deinit(); -#endif - exit(code); -} - -int zx_term(void) -{ - word n; - - - n = RAM[0x81]; /* Get the return code. This is Hi-Tech C */ - n = (n << 8) | RAM[0x80]; /* specific and fails with other COM files */ - - putchar('\n'); - - if (cpm_error != 0) /* The CP/M "set return code" call was used */ - { /* (my modified Hi-Tech C library uses this */ - n = cpm_error; /* call) */ - } - if (n < 256 || n == 0xFFFF) - { - Msg("Return code %d\n", n); - return n; - } - else return 0; -} - - diff --git a/Tools/unix/zx/zx.h b/Tools/unix/zx/zx.h deleted file mode 100644 index dac69ce0..00000000 --- a/Tools/unix/zx/zx.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Change the directories in these #defines if necessary. Note trailing slash. - */ - -#include "config.h" - -#ifdef __MSDOS__ - #define BINDIR80 "d:/tools/cpm/bin80/" - #define LIBDIR80 "d:/tools/cpm/lib80/" - #define INCDIR80 "d:/tools/cpm/include/" -#else -/* Unless overridden, these are defined by autoconf. Note trailing slash. - #undef BINDIR80 - #undef LIBDIR80 - #undef INCDIR80 - #define BINDIR80 "/usr/local/lib/cpm/bin80/" - #define LIBDIR80 "/usr/local/lib/cpm/lib80/" - #define INCDIR80 "/usr/local/lib/cpm/include80/" -*/ -#endif - -#define SERIAL "ZXCC05" - -/* System include files */ - -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(LINUX) || defined(DARWIN) -#include -#define _isatty(a) isatty(a) -#define _fileno(a) fileno(a) -#define setmode(a,b) -#define O_BINARY 0 -#endif -#ifdef WIN32 -#include -#endif -#include -#include -#ifdef __MSDOS -#include -#endif - -/* Library includes */ - -#ifdef USE_CPMIO -#include "cpmio.h" -#endif - -#ifdef USE_CPMGSX -#include "cpmgsx.h" -#endif - -#include "cpmredir.h" /* BDOS disc simulation */ - -typedef unsigned char byte; /* Must be exactly 8 bits */ -typedef unsigned short word; /* Must be exactly 16 bits */ - -/* Prototypes */ - -void ed_fe (byte *a, byte *b, byte *c, byte *d, byte *e, byte *f, - byte *h, byte *l, word *pc, word *ix, word *iy); -void cpmbdos(byte *a, byte *b, byte *c, byte *d, byte *e, byte *f, - byte *h, byte *l, word *pc, word *ix, word *iy); -void cpmbios(byte *a, byte *b, byte *c, byte *d, byte *e, byte *f, - byte *h, byte *l, word *pc, word *ix, word *iy); -void dump_regs(FILE *fp, byte a, byte b, byte c, byte d, byte e, byte f, - byte h, byte l, word pc, word ix, word iy); -void Msg(char *s, ...); -int zx_term(void); -void zx_exit(int code); - -byte cin(void); -void cout(byte); -int cstat(void); - -/* Global variables */ - -extern char *progname; -extern char **argv; -extern int argc; -extern byte RAM[65536]; /* The Z80's address space */ - -extern int usestdio; - -/* Z80 CPU emulation */ - -#include "z80.h" - diff --git a/Tools/unix/zx/zx.html b/Tools/unix/zx/zx.html deleted file mode 100644 index b425ee1e..00000000 --- a/Tools/unix/zx/zx.html +++ /dev/null @@ -1,131 +0,0 @@ -zx CP/M Command Line Emulator - -

zx CP/M Command Line Emulator

- -

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).

- -
- -

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:

- -
    -
  • 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)
  • -
- -

Usage

- -

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:

- -
zx rmac hello
- -

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.

- -

Filenames

- -

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.

- -

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/
- -

Technical

- -

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.

- -

Syntax for zx is:

- -
-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 -
- -

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.
-
- -

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/unix/zx/zxbdos.c b/Tools/unix/zx/zxbdos.c deleted file mode 100644 index 06b951ad..00000000 --- a/Tools/unix/zx/zxbdos.c +++ /dev/null @@ -1,561 +0,0 @@ -#include "zx.h" - -#define BDOS_DEF -#include "zxbdos.h" -#include "zxcbdos.h" -#include "zxdbdos.h" - -#ifdef __MSDOS__ -#include -#endif - -#define BCD(x) (((x % 10)+16*(x/10)) & 0xFF) - -/* Convert time_t to CP/M day count/hours/minutes */ -dword cpmtime(time_t t) -{ - long d = (t / 86400) - 2921; /* CP/M day 0 is unix day 2921 */ - long h = (t % 86400) / 3600; /* Hour, 0-23 */ - long m = (t % 3600) / 60; /* Minute, 0-59 */ - - return (d | (BCD(h) << 16) | (BCD(m) << 24)); -} - - -byte get_time(cpm_word b) -{ - time_t t; - - time(&t); - wr32(b, cpmtime(t)); - - return (BCD(t % 60)); -} - - -/* Functions to access 24-bit & 32-bit words in memory. These are always - little-endian. */ - -void wr24(word addr, dword v) -{ - RAM[addr ] = v & 0xFF; - RAM[addr + 1] = (v >> 8) & 0xFF; - RAM[addr + 2] = (v >> 16) & 0xFF; -} - -void wr32(word addr, dword v) -{ - RAM[addr ] = v & 0xFF; - RAM[addr + 1] = (v >> 8) & 0xFF; - RAM[addr + 2] = (v >> 16) & 0xFF; - RAM[addr + 3] = (v >> 24) & 0xFF; -} - -dword rd24(word addr) -{ - register dword rv = RAM[addr + 2]; - - rv = (rv << 8) | RAM[addr + 1]; - rv = (rv << 8) | RAM[addr]; - return rv; -} - - -dword rd32(word addr) -{ - register dword rv = RAM[addr + 3]; - - rv = (rv << 8) | RAM[addr + 2]; - rv = (rv << 8) | RAM[addr + 1]; - rv = (rv << 8) | RAM[addr]; - return rv; -} - -#define peekw(addr) ( (((word)(RAM[addr + 1])) << 8) | RAM[addr]) - - -/* Get / set the program return code. We store this in 'C' form: 0 for - success, 1-255 for failure. Translate to/from the CP/M form of: - - 0x0000-0xFEFF for success - 0xFF00-0xFFFE for failure - - We also store the actual value so it can be returned - - */ - -word cpm_errcde(word DE) -{ - static word real_err = 0; - - if (DE == 0xFFFF) return real_err; - real_err = DE; - - if (DE == 0xFF00) cpm_error = 1; - else if (DE > 0xFF00) cpm_error = (DE & 0xFF); - else cpm_error = 0; - return 0; -} - - -#ifdef USE_CPMGSX -gsx_byte gsxrd(gsx_word addr) -{ - return RdZ80(addr); -} - -void gsxwr(gsx_word addr, gsx_byte value) -{ - WrZ80(addr, value); -} - -#endif - -#undef bc -#undef de -#undef hl - -void setw(byte *l, byte *h, word w) -{ - *l = (w & 0xFF); - *h = (w >> 8) & 0xFF; -} - -void cpmbdos(byte *a, byte *b, byte *c, byte *d, byte *e, byte *f, - byte *h, byte *l, word *pc, word *ix, word *iy) -{ - word de = ((*d) << 8) | *e; - word hl = ((*h) << 8) | *l; - byte *pde = &RAM[de]; - byte *pdma = &RAM[cpm_dma]; - word temp; - int retv; - - Msg("BDOS service invoked: C=%02x DE=%04x\n", *c, de); - - switch(*c) - { - case 0: - *pc = 0; - break; - - case 1: /* Get a character */ -#ifdef USE_CPMIO - retv = cpm_bdos_1(); -#else - retv = cin(); -#endif - if (retv < 0) *pc = 0; - setw(l, h, retv); - break; - - case 2: /* Print a character */ -#ifdef USE_CPMIO - if (cpm_bdos_2(*e)) *pc = 0; -#else - cout(*e); -#endif - break; - - case 3: /* No auxin */ - setw(l, h, 0x1A); - break; - - case 4: /* No auxout */ - break; - - case 5: /* No printer */ - break; - - case 6: /* Direct console I/O */ - retv = cpm_bdos_6(*e); - if (retv < 0) *pc = 0; - setw(l, h, retv); - break; - - case 7: /* No auxist */ - case 8: /* No auxost */ - break; - - case 9: /* Print a $-terminated string */ -#ifdef USE_CPMIO - if (cpm_bdos_9((char *)pde)) *pc = 0; -# else - for (temp = 0; RAM[de + temp] != '$'; ++temp) - { - cout(RAM[de + temp]); - } -#endif - break; - - case 0x0A: - bdos_rdline(de, &(*pc)); - break; - - case 0x0B: /* Console status */ - //*l = *h = 0; /* No keys pressed */ - *l = cstat(); - *h = 0; - break; - - case 0x0C: /* Get CP/M version */ - -/* For GENCOM's benefit, claim to be v3.1 */ - - *l = 0x31; /* v3.1 */ - //*l = 0x22; /* v2.2 */ - *h = 0; /* CP/M, no network */ - break; - - case 0x0D: /* Re-log discs */ - fcb_reset(); - break; - - case 0x0E: /* Set default drive */ - setw(l, h, fcb_drive(*e)); - break; - - case 0x0F: /* Open using FCB */ - setw(l, h, x_fcb_open(pde, pdma)); - break; - - case 0x10: /* Close using FCB */ - setw(l, h, fcb_close(pde)); - break; - - case 0x11: /* Find first */ - setw(l, h, fcb_find1(pde, pdma)); - break; - - case 0x12: - setw(l, h, fcb_find2(pde, pdma)); - break; - - case 0x13: /* Delete using FCB */ - setw(l, h, fcb_unlink(pde, pdma)); - break; - - case 0x14: /* Sequential read using FCB */ - setw(l, h, fcb_read(pde, pdma)); - - //Msg("fcb_read L=%02x H=%02x\n", *l, *h); - - break; - - case 0x15: /* Sequential write using FCB */ - setw(l, h, fcb_write(pde, pdma)); - break; - - case 0x16: /* Create using FCB */ - setw(l, h, fcb_creat(pde, pdma)); - break; - - case 0x17: /* Rename using FCB */ - setw(l, h, fcb_rename(pde, pdma)); - break; - - case 0x18: /* Get login vector */ - setw(l, h, fcb_logvec()); - break; - - case 0x19: /* Get default drive */ - setw(l, h, cpm_drive); - break; - - case 0x1A: /* Set DMA */ - Msg("Set DMA to %04x\n", de); - cpm_dma = de; - break; - - case 0x1B: /* Get alloc vector */ - fcb_getalv(RAM + 0xFF80, 0x40); - setw(l, h, 0xFF80); - break; - - case 0x1C: /* Make disc R/O */ - setw(l, h, fcb_rodisk()); - break; - - case 0x1D: /* Get R/O vector */ - setw(l, h, fcb_rovec()); - break; - - case 0x1E: /* Set attributes */ - setw(l, h, fcb_chmod(pde, pdma)); - break; - - case 0x1F: /* Get DPB */ - fcb_getdpb(RAM + 0xFFC0); - setw(l, h, 0xFFC0); - break; /* Whoops. Missed that 'break'. */ - - case 0x20: /* Get/set uid */ - setw(l, h, fcb_user(*e)); - break; - - case 0x21: /* Read a record */ - setw(l, h, fcb_randrd(pde, pdma)); - break; - - case 0x22: /* Write a record */ - setw(l, h, fcb_randwr(pde, pdma)); - break; - - case 0x23: /* Get file size */ - setw(l, h, x_fcb_stat(pde)); - break; - - case 0x24: /* Get file pointer */ - setw(l, h, fcb_tell(pde)); - break; - - case 0x25: - setw(l, h, fcb_resro(de)); - break; - - /* MP/M drive access functions, not implemented */ - - case 0x28: /* Write with 0 fill */ - setw(l, h, fcb_randwz(pde, pdma)); - break; - - /* MP/M record locking functions, not implemented */ - - case 0x2C: /* Set no. of records to read/write */ - setw(l, h, fcb_multirec(*e)); - break; - - case 0x2D: /* Set error mode */ - err_mode = *e; - break; - - case 0x2E: - setw(l, h, fcb_dfree(*e, pdma)); - break; /* Whoops. Missed that 'break'. */ - - /* 0x2F: Chain */ - - case 0x30: - setw(l, h, fcb_sync(*e)); - break; - - case 0x31: - if (pde[1] == 0xFE) - { - RAM[0xFE9C + *pde] = pde[2]; - RAM[0xFE9D + *pde] = pde[3]; - } - else if (RAM[hl + 1] == 0xFF) - { - RAM[0xFE9C + *pde] = pde[2]; - } - else - { - *l = RAM[0xFE9C + *pde]; - *h = RAM[0xFE9D + *pde]; - } - break; - - case 0x32: - temp = *ix; - *ix = 3 * (pde[0] + 1); - *a = pde[1]; - *c = pde[2]; - *b = pde[3]; - *e = pde[4]; - *d = pde[5]; - *l = pde[6]; - *h = pde[7]; - cpmbios(a,b,c,d,e,f,h,l,pc,ix,iy); - *ix = temp; - break; - - case 0x3C: /* Communicate with RSX */ - *h = *l = 0; - break; - - case 0x62: /* Purge */ - setw(l, h, fcb_purge()); - break; - - case 0x63: /* Truncate file */ - setw(l, h, fcb_trunc(pde, pdma)); - break; - - case 0x64: /* Set label */ - setw(l, h, fcb_setlbl(pde, pdma)); - break; - - case 0x65: /* Get label byte */ - setw(l, h, fcb_getlbl(*e)); - break; - - case 0x66: /* Get file date */ - setw(l, h, fcb_date(pde)); - break; - - case 0x67: /* Set password */ - setw(l, h, fcb_setpwd(pde, pdma)); - break; - - case 0x68: /* Set time of day */ - /* Not advisable to let an emulator play with the clock */ - break; - - case 0x69: /* Get time of day */ - setw(l, h, get_time(de)); - break; - - case 0x6A: /* Set default password */ - setw(l, h, fcb_defpwd(pde)); - break; - - case 0x6B: /* Get serial number */ - memcpy(pde, SERIAL, 6); - break; - - case 0x6C: /* 0.03 set error code */ - setw(l, h, cpm_errcde(de)); - break; - -#ifdef USE_CPMIO - case 0x6D: /* Set/get console mode */ - setw(l, h, cpm_bdos_109(de)); - break; - - case 0x6E: /* Set/get string delimiter */ - setw(l, h, cpm_bdos_110(*e)); - break; - - case 0x6F: /* Send fixed length string to screen */ - if (cpm_bdos_111((char *)RAM + peekw(de), - peekw(de + 2))) - *pc = 0; - break; - - case 0x70: /* Send fixed length string to printer */ - break; - - /* 0x71: Strange PCP/M function */ -#else - case 0x6D: /* Set/get console mode */ - setw(l, h, 0); - break; - -#endif - -#ifdef USE_CPMGSX - case 0x73: /* GSX */ - setw(l, h, gsx80(gsxrd, gsxwr, de)); - break; -#endif - - case 0x74: /* Set date stamp */ - setw(l, h, fcb_sdate(pde, pdma)); - break; - - case 0x98: /* Parse filename */ - setw(l, h, fcb_parse((char *)RAM + peekw(de), - (byte *)RAM + peekw(de + 2))); - break; - - default: -#ifdef USE_CPMIO - cpm_scr_unit(); -#endif -#ifdef USE_CPMGSX - gsx_deinit(); -#endif - - fprintf(stderr,"%s: Unsupported BDOS call %d\n", progname, - (int)(*c)); - dump_regs(stderr,*a,*b,*c,*d,*e,*f,*h,*l,*pc,*ix,*iy); - zx_exit(1); - break; - } - - *a = *l; - *b = *h; - - Msg("BDOS service completion.\n"); -} - - - -void cpmbios(byte *a, byte *b, byte *c, byte *d, byte *e, byte *f, - byte *h, byte *l, word *pc, word *ix, word *iy) -{ - int func = (((*ix) & 0xFF) / 3) - 1; - - Msg("BIOS service invoked: func=%02x\n", func); - - switch(func) /* BIOS function */ - { - case 1: - zx_exit(zx_term()); /* Program termination */ - break; - - case 2: /* CONST */ -#ifdef USE_CPMIO - *a = cpm_const(); -#else - *a = cpm_bdos_6(0xFE); -#endif - break; - - case 3: /* CONIN */ -#ifdef USE_CPMIO - *a = cpm_conin(); -#else - *a = cpm_bdos_6(0xFD); -#endif - break; - - case 4: /* CONOUT */ -#ifdef USE_CPMIO - cpm_conout(*c); -#else - cpm_bdos_6(*c); -#endif - break; - - case 20: /* DEVTBL */ - setw(l, h, 0xFFFF); - break; - - case 22: /* DRVTBL */ - setw(l, h, 0xFFFF); - break; - - case 26: /* TIME */ - RAM[0xFEF8] = get_time(0xFEF4); - break; - - case 30: /* USERF!!! */ -#ifdef USE_CPMIO - cpm_bdos_110('$'); - cpm_bdos_9("This program has attempted to call USERF, " - "which is not implemented\r\n$"); -#else - printf("This program has attempted to call USERF, which " - "is not implemented.\n"); -#endif - zx_term(); - zx_exit(1); - break; - - default: -#ifdef USE_CPMIO - cpm_scr_unit(); -#endif -#ifdef USE_CPMGSX - gsx_deinit(); -#endif - - fprintf(stderr,"%s: Unsupported BIOS call %d\n", progname, func); - dump_regs(stderr,*a,*b,*c,*d,*e,*f,*h,*l,*pc,*ix,*iy); - zx_exit(1); - } - - Msg("BIOS service completion.\n"); -} diff --git a/Tools/unix/zx/zxbdos.h b/Tools/unix/zx/zxbdos.h deleted file mode 100644 index 4111c78e..00000000 --- a/Tools/unix/zx/zxbdos.h +++ /dev/null @@ -1,50 +0,0 @@ -extern char *progname; -extern char **argv; -extern int argc; - -extern byte cpm_drive; -extern byte cpm_user; - -extern byte RAM[65536]; /* The Z80's address space */ - -extern void Msg(char *s, ...); - -#ifdef BDOS_DEF - -word cpm_dma = 0x80; /* DMA address */ -byte err_mode = 0xFF; -byte rec_multi = 1; -word rec_len = 128; -word ffirst_fcb = 0xFFFF; -byte cpm_error = 0; /* Error code returned by CP/M */ - -#else /* BDOS_DEF */ - -extern word cpm_dma, rec_len, ffirst_fcb; -extern byte err_mode, rec_multi, cpm_error; - -#endif /* BDOS_DEF */ - -#ifndef O_BINARY /* Necessary in DOS, not present in Linux */ -#define O_BINARY 0 -#endif - -typedef unsigned long dword; - -/* Functions in zxbdos.c */ - -void wr24(word addr, dword v); -void wr32(word addr, dword v); -dword rd24(word addr); -dword rd32(word addr); -dword cpmtime(time_t t); -word cpm_errcde(word DE); - -#ifdef USE_CPMGSX -gsx_byte gsxrd(gsx_word addr); -void gsxwr(gsx_word addr, gsx_byte value); -#endif - -void cpmbdos(); -void cpmbios(); - diff --git a/Tools/unix/zx/zxcbdos.c b/Tools/unix/zx/zxcbdos.c deleted file mode 100644 index b441fa7f..00000000 --- a/Tools/unix/zx/zxcbdos.c +++ /dev/null @@ -1,114 +0,0 @@ -#include "zx.h" -#include "zxbdos.h" -#include "zxcbdos.h" -#include -#ifdef WIN32 -#include -#endif - -/* Line input */ -#ifdef USE_CPMIO - - -void bdos_rdline(word line, word *PC) -{ - char *buf; - - if (!line) line = cpm_dma; - else RAM[line + 1] = 0; - - buf = (char *)&RAM[line]; - - if (cpm_bdos_10(buf)) *PC = 0; -} - -#else /* def USE_CPMIO */ - -void bdos_rdline(word line, word *PC) -{ - int maxlen; - - if (!line) line = cpm_dma; - maxlen = RAM[line]; - - fgets((char *)(RAM + line + 2), maxlen, stdin); - RAM[line + 1] = strlen((char *)(RAM + line + 2)) - 1; - - Msg("Input: [%d] %-*.*s\n", RAM[line + 1], RAM[line + 1], RAM[line +1], (char *)(RAM+line+2)); -} -#endif /* ndef USE_CPMIO */ - -#ifndef USE_CPMIO - - -int cpm_bdos_6(byte e) -{ - int c; - - switch(e) { - case 0xFF: - if (cstat()) return cin(); - return 0; - - case 0xFE: - return cstat(); - - case 0xFD: - return cin(); - - default: - cout(e); - break; - } - return 0; -} -#endif - -#if defined(__MINGW32__) || defined(_MSC_BUILD) || defined(__WATCOMC__) - -byte cin() -{ - if (_isatty(_fileno(stdin))) - return getch(); - else - return getchar(); -} - -void cout(byte c) -{ - if (_isatty(_fileno(stdout))) - putch(c); - else - putchar(c); -} - -int cstat() -{ - if (_isatty(_fileno(stdin))) - return _kbhit() ? 0xFF : 0; - else - return 0xFF; -} - -#else /* defined(__MINGW32__) || defined(_MSC_BUILD) */ - -byte cin() -{ - return getchar(); -} - -void cout(byte c) -{ - putchar(c); -} - -int cstat() -{ - int i; - - ioctl(_fileno(stdin), FIONREAD, &i); - if (i > 0) return 0xff; - return 0; -} - -#endif diff --git a/Tools/unix/zx/zxcbdos.h b/Tools/unix/zx/zxcbdos.h deleted file mode 100644 index 7f724441..00000000 --- a/Tools/unix/zx/zxcbdos.h +++ /dev/null @@ -1,4 +0,0 @@ -void bdos_rdline(word line, word *PC); -int cpm_bdos_6(byte e); - - diff --git a/Tools/unix/zx/zxdbdos.c b/Tools/unix/zx/zxdbdos.c deleted file mode 100644 index f5f21f3b..00000000 --- a/Tools/unix/zx/zxdbdos.c +++ /dev/null @@ -1,88 +0,0 @@ -#include "zx.h" -#include "zxbdos.h" -#include "zxdbdos.h" - -/* This file used to deal with all disc-based BDOS calls. - Now the calls have been moved into libcpmredir, it's a bit empty round - here. - - ZXCC does a few odd things when searching, to make Hi-Tech C behave - properly. -*/ - - -/* If a file could not be found on the default drive, try again on a "search" - drive (A: for .COM files, B: for .LIB and .OBJ files) */ - -int fcbforce(byte *fcb, byte *odrv) -{ - byte drive; - char typ[4]; - int n; - - for (n = 0; n < 3; n++) typ[n] = fcb[n+9] & 0x7F; - typ[3] = 0; - - Msg("fcbforce: typ=%s, fcb=%hhx\r\n", typ, *fcb); - - drive = 0; - if (*fcb) return 0; /* not using default drive */ - //if ((*fcb) != 16) return 0; /* not using default drive */ - if (!strcmpi(typ, "COM")) drive = 1; - if (!strcmpi(typ, "LIB")) drive = 2; - if (!strcmpi(typ, "OBJ")) drive = 2; - if (!strcmpi(typ, "H ")) drive = 3; - - Msg("fcbforce: drive=%i\r\n", drive); - - if (!drive) return 0; - - *odrv = *fcb; - *fcb = drive; - return 1; -} - -/* zxcc has a trick with some filenames: If it can't find them where they - should be, and a drive wasn't specified, it searches BINDIR80, - LIBDIR80 or INCDIR80 (depending on the type of the file). - */ - -word x_fcb_open(byte *fcb, byte *dma) -{ - word rv = fcb_open(fcb, dma); - byte odrv; - - Msg("x_fcb_open: rv=%X\r\n", rv); - - if (rv == 0xFF) - { - if (fcbforce(fcb, &odrv)) - { - rv = fcb_open(fcb, dma); - Msg("x_fcb_open: rv=%X\r\n", rv); - *fcb = odrv; - } - } - return rv; -} - - - -word x_fcb_stat(byte *fcb) -{ - word rv = fcb_stat(fcb); - byte odrv; - - if (rv == 0xFF) - { - if (fcbforce(fcb, &odrv)) - { - rv = fcb_stat(fcb); - *fcb = odrv; - } - } - return rv; -} - - - diff --git a/Tools/unix/zx/zxdbdos.h b/Tools/unix/zx/zxdbdos.h deleted file mode 100644 index 7a47b801..00000000 --- a/Tools/unix/zx/zxdbdos.h +++ /dev/null @@ -1,8 +0,0 @@ - - - -int fcbforce(byte *fcb, byte *odrv); - -word x_fcb_open(byte *fcb, byte *dma); -word x_fcb_stat(byte *fcb); - diff --git a/Tools/unix/zxcc/COPYING b/Tools/unix/zxcc/COPYING new file mode 100644 index 00000000..92851102 --- /dev/null +++ b/Tools/unix/zxcc/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/unix/zxcc/Makefile b/Tools/unix/zxcc/Makefile new file mode 100644 index 00000000..3a5ad1e8 --- /dev/null +++ b/Tools/unix/zxcc/Makefile @@ -0,0 +1,37 @@ +# +# hacked up brute force makefile for linux and osx +# +UNAME := $(shell uname) +ifeq ($(UNAME), Linux) + SUFFIX=linux +endif +ifeq ($(UNAME), Darwin) + SUFFIX=darwin +endif + +DEST = ../../$(UNAME) +CFLAGS = -g # -DDEBUG + +OBJECTS = zxcc.o cpmdrv.o cpmglob.o cpmparse.o cpmredir.o \ + drdos.o util.o xlt.o zxbdos.o zxcbdos.o zxdbdos.o z80.o track.o +UNUSED = dirent.o + +all: zxcc $(DEST) + cp -p bios.bin zxcc $(DEST) + +$(DEST): + mkdir -p $(DEST) + +clean: + -rm -f $(OBJECTS) config.h zxcc bios.bin + +$(OBJECTS): config.h bios.bin + +zxcc: $(OBJECTS) + $(CC) -o zxcc $(OBJECTS) + +config.h: config.h.$(SUFFIX) + cp config.h.$(SUFFIX) config.h + +bios.bin: cpm/bios.bin + cp cpm/bios.bin . diff --git a/Tools/unix/zxcc/ReadMe.txt b/Tools/unix/zxcc/ReadMe.txt new file mode 100644 index 00000000..a0b0a63e --- /dev/null +++ b/Tools/unix/zxcc/ReadMe.txt @@ -0,0 +1,93 @@ +This is an adaptation of zxcc-0.5.7 for RomWBW by Wayne Warthen. + +In general, this is a stripped down variant of John Elliott's zxcc package that +runs under a Windows command line (32 or 64 bit Windows), Linux, or MacOS. +This adaptation implements only the main "zxcc" command. The other programs +(zxc, zxas, zxlink, and zslibr) are not inluded here because they are fairly +specific to Hi-Tech C. + +Please see http://www.seasip.info/Unix/Zxcc/ for more information on the original +version of zxcc. Also, refer to https://github.com/agn453/ZXCC which has an +updated version of the code. + +The included zxcc.html documentation is from the original version, so it does not +reflect the changes made here. + +To build under Open Watcom, use Build-OW.cmd. To build under Microsoft Visual C, +use Build-VC.cmd. To build under Linux or MacOS, use the Makefile. + +The GPL status of everything remains in place and carries forward. + +December 5, 2014 + +After struggling to get the entire zxcc package to build nicely using autoconf, +I finally gave up and took a much more direct approach. I have extracted just +the source files needed and created a simple batch file to build the tool. I +realize this could be done much better, but I cheated in the interest of time. + +The one "real" change I made in the source code was that I modified the tool +to look for bios.bin in the same directory as the executable is in. This +just makes it much easier to set up (for me, anyway). + +Wayne Warthen +wwarthen@gmail.com + +March 15, 2017 + +- Updated to compile under Open Watcom. +- Implemented BDOS console status function. +- Set stdin and stdout to binary mode at startup. + +August 21, 2021 + +- Incorporated filename case insensitivity changes from Curt Mayer +- Incorporated fixes from Tony Nicholson at https://github.com/agn453/ZXCC + - Emulation of CP/M BDOS function 60 (call resident system extension) + should be disabled and return 0xFF in both the A and L registers. + - Change cpm_bdos_10() to return an unsigned result to avoid buffer + size being interpreted as negative. + - Fix the emulation of Z80 opcodes for IN (HL),(C) and + OUT (C),(HL) - opcodes 0xED,0x70 and 0xED,0x71 respectively. + This is noted in Fred Weigel's AM9511 arithmetic processing unit + emulation from https://github.com/ratboy666/am9511 in the howto.txt + description. NB: I have not included Fred's am9511 support at this + time into ZXCC. +- Fixed parse_to_fcb function in zxcc.c to handle parsing second automatic + FCB from command line + +Wayne Warthen +wwarthen@gmail.com + +--WBW 4:09 PM 8/21/2021 + +January 9, 2022 + +- Running zxcc under WSL (Windows Subsystem for Linux) was gererating output + that was correct but did not match standard Windows or Linux runs. This + turned out to be an assumption in a few places in the code that reading + into a buffer would not modify the area of the buffer that was beyond + the space required by the data being read. Under WSL, this "slack" space + was mangled. I made changes in these locations to clean up the slack + space after such reads. This fixed WSL runs to produce binary identical + output. Although only required by WSL, the changes cause no problems for + other environments and are actually correct per POSIX. + +--WBW 11:56 AM 1/9/2022 + +- I have attempted to sync my code up with the latest code found in Tony + Nicholson's GitHub repo at https://github.com/agn453/ZXCC. The most + significant difference in my code is that I am using the WIN32 API + for all disk I/O. Although the file tracking code is retained, I have + found this mechanism to fail insome scenarios. By using the WIN32 API + I can achieve the same file sharing attributes as Unix which makes the + file tracking mechanism optional. + +--WBW 9:34 AM 2/10/2022 + +- Added a call to trackFile in fcb_close. I think it was always + supposed to be there. Was not causing any real problems other + than superfluous attempts by releaseFile to close files that + were already closed. + +--WBW 3:58 PM 3/2/2022 + diff --git a/Tools/unix/zxcc/cbops.h b/Tools/unix/zxcc/cbops.h new file mode 100644 index 00000000..6772b004 --- /dev/null +++ b/Tools/unix/zxcc/cbops.h @@ -0,0 +1,172 @@ +/* Emulations of the CB operations of the Z80 instruction set. + * Copyright (C) 1994 Ian Collier. + * + * 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. + */ + +#define var_t unsigned char t +#define rlc(x) (x=(x<<1)|(x>>7),rflags(x,x&1)) +#define rrc(x) do{var_t=x&1;x=(x>>1)|(t<<7);rflags(x,t);}while(0) +#define rl(x) do{var_t=x>>7;x=(x<<1)|(f&1);rflags(x,t);}while(0) +#define rr(x) do{var_t=x&1;x=(x>>1)|(f<<7);rflags(x,t);}while(0) +#define sla(x) do{var_t=x>>7;x<<=1;rflags(x,t);}while(0) +#define sra(x) do{var_t=x&1;x=((signed char)x)>>1;rflags(x,t);}while(0) +#define sll(x) do{var_t=x>>7;x=(x<<1)|1;rflags(x,t);}while(0) +#define srl(x) do{var_t=x&1;x>>=1;rflags(x,t);}while(0) + +#define rflags(x,c) (f=(c)|(x&0xa8)|((!x)<<6)|parity(x)) + +#define bit(n,x) (f=(f&1)|((x&(1<> 3) & 7; + switch (op & 0xc7) { + case 0x40: bit(n, b); break; + case 0x41: bit(n, c); break; + case 0x42: bit(n, d); break; + case 0x43: bit(n, e); break; + case 0x44: bit(n, h); break; + case 0x45: bit(n, l); break; + case 0x46: tstates += 4; val = fetch(addr); bit(n, val); store(addr, val); break; + case 0x47: bit(n, a); break; + case 0x80: res(n, b); break; + case 0x81: res(n, c); break; + case 0x82: res(n, d); break; + case 0x83: res(n, e); break; + case 0x84: res(n, h); break; + case 0x85: res(n, l); break; + case 0x86: tstates += 4; val = fetch(addr); res(n, val); store(addr, val); break; + case 0x87: res(n, a); break; + case 0xc0: set(n, b); break; + case 0xc1: set(n, c); break; + case 0xc2: set(n, d); break; + case 0xc3: set(n, e); break; + case 0xc4: set(n, h); break; + case 0xc5: set(n, l); break; + case 0xc6: tstates += 4; val = fetch(addr); set(n, val); store(addr, val); break; + case 0xc7: set(n, a); break; + } +} +if (ixoriy)switch (reg) { +case 0:b = val; break; +case 1:c = val; break; +case 2:d = val; break; +case 3:e = val; break; +case 4:h = val; break; +case 5:l = val; break; +case 7:a = val; break; +} +} + +#undef var_t +#undef rlc +#undef rrc +#undef rl +#undef rr +#undef sla +#undef sra +#undef sll +#undef srl +#undef rflags +#undef bit +#undef set +#undef res diff --git a/Tools/unix/zxcc/config.h.darwin b/Tools/unix/zxcc/config.h.darwin new file mode 100644 index 00000000..3a1ec05c --- /dev/null +++ b/Tools/unix/zxcc/config.h.darwin @@ -0,0 +1,8 @@ +#define HAVE_STDLIB_H +#define HAVE_STRING_H +#define HAVE_DIRENT_H +#define HAVE_UTIME_H +#define HAVE_FCNTL_H +#define HAVE_UNISTD_H +#define DARWIN +//#define FILETRACKER 1 diff --git a/Tools/unix/zxcc/config.h.linux b/Tools/unix/zxcc/config.h.linux new file mode 100644 index 00000000..86925d43 --- /dev/null +++ b/Tools/unix/zxcc/config.h.linux @@ -0,0 +1,9 @@ +#define HAVE_DIRENT_H +#define HAVE_UTIME_H +#define HAVE_FCNTL_H +#define HAVE_SYS_VFS_H +#define HAVE_UNISTD_H +#define HAVE_STRING_H +#define HAVE_STDLIB_H +#define LINUX +//#define FILETRACKER 1 diff --git a/Tools/unix/zxcc/config.h.windows b/Tools/unix/zxcc/config.h.windows new file mode 100644 index 00000000..0f256eac --- /dev/null +++ b/Tools/unix/zxcc/config.h.windows @@ -0,0 +1,10 @@ +#define HAVE_WINDOWS_H +#define HAVE_FCNTL_H +#ifdef _MSC_VER + #define HAVE_DIRENT_H +#endif +#define HAVE_DIRECT_H +#define HAVE_IO_H +#define WINVER _WIN32_WINNT_WINXP // target Windows XP +#define _WIN32_WINNT _WIN32_WINNT_WINXP // target Windows XP +//#define FILETRACKER 1 diff --git a/Tools/unix/zx/bios.bin b/Tools/unix/zxcc/cpm/bios.bin similarity index 100% rename from Tools/unix/zx/bios.bin rename to Tools/unix/zxcc/cpm/bios.bin diff --git a/Tools/unix/zx/cpm/bios.com b/Tools/unix/zxcc/cpm/bios.com similarity index 100% rename from Tools/unix/zx/cpm/bios.com rename to Tools/unix/zxcc/cpm/bios.com diff --git a/Tools/unix/zx/cpm/bios.lst b/Tools/unix/zxcc/cpm/bios.lst similarity index 100% rename from Tools/unix/zx/cpm/bios.lst rename to Tools/unix/zxcc/cpm/bios.lst diff --git a/Tools/unix/zx/cpm/bios.z80 b/Tools/unix/zxcc/cpm/bios.z80 similarity index 100% rename from Tools/unix/zx/cpm/bios.z80 rename to Tools/unix/zxcc/cpm/bios.z80 diff --git a/Tools/unix/zxcc/cpmdrv.c b/Tools/unix/zxcc/cpmdrv.c new file mode 100644 index 00000000..691e774f --- /dev/null +++ b/Tools/unix/zxcc/cpmdrv.c @@ -0,0 +1,182 @@ +/* + + CPMREDIR: CP/M filesystem redirector + Copyright (C) 1998,2003 John Elliott + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + This file deals with drive-based functions. +*/ + +#include "cpmint.h" + +#ifdef _WIN32 +static char* drive_to_hostdrive(int cpm_drive) +{ + static char prefix[CPM_MAXPATH]; + char* lpfp; + dword dw; + + if (!redir_drive_prefix[cpm_drive]) return NULL; + dw = GetFullPathName(redir_drive_prefix[cpm_drive], sizeof(prefix), + prefix, &lpfp); + + if (!dw) return NULL; + if (prefix[1] == ':') /* If path starts with a drive, limit it */ + { /* to just that drive */ + prefix[2] = '\\'; /* GetDiskFreeSpace should have trailing backslash */ + prefix[3] = 0; + } + return prefix; +} +#endif + + +cpm_byte fcb_reset(void) +{ +#ifdef __MSDOS__ + bdos(0x0D, 0, 0); +#endif + + redir_l_drives = 0; + redir_cpmdrive = 0; /* A reset forces current drive to A: */ +/* redir_ro_drives = 0; Software write protect not revoked by func 0Dh. + * + * This does not follow true CP/M, but does match many 3rd-party replacements. + */ + return 0; +} + + +cpm_word fcb_drive(cpm_byte drv) +{ + if (redir_drive_prefix[drv][0]) + { + redir_cpmdrive = drv; + redir_log_drv(drv); + return 0; + } + else return 0x04FF; /* Drive doesn't exist */ +} + +cpm_byte fcb_getdrv(void) +{ + return redir_cpmdrive; +} + + +cpm_byte fcb_user(cpm_byte usr) +{ + if (usr != 0xFF) redir_cpmuser = usr % 16; + + DBGMSGV("User: parameter %d returns %d\n", usr, redir_cpmuser); + + return redir_cpmuser; +} + + + +cpm_word fcb_logvec(void) +{ + return redir_l_drives; +} + + +cpm_word fcb_rovec(void) +{ + return redir_ro_drives; +} + + +cpm_word fcb_rodisk(void) +{ + cpm_word mask = 1; + + if (redir_cpmdrive) mask = mask << redir_cpmdrive; + + redir_ro_drives |= mask; + return 0; +} + + +cpm_word fcb_resro(cpm_word bitmap) +{ + redir_ro_drives &= ~bitmap; + + return 0; +} + + +cpm_word fcb_sync(cpm_byte flag) +{ +#ifdef _WIN32 + return 0; +#else + sync(); return 0; /* Apparently some sync()s are void not int */ +#endif +} + + +cpm_word fcb_purge() +{ +#ifdef _WIN32 + return 0; +#else + sync(); return 0; /* Apparently some sync()s are void not int */ +#endif +} + +/* Generic 8MB disk definition */ + +static cpm_byte exdpb[0x11] = { + 0x80, 0, /* 128 records/track */ + 0x04, 0x0F, /* 2k blocks */ + 0x00, /* 16k / extent */ + 0xFF, 0x0F, /* 4095 blocks */ + 0xFF, 0x03, /* 1024 dir entries */ + 0xFF, 0xFF, /* 16 directory blocks */ + 0x00, 0x80, /* Non-removable media */ + 0x00, 0x00, /* No system tracks */ + 0x02, 0x03 /* 512-byte sectors */ +}; + +cpm_word fcb_getdpb(cpm_byte* dpb) +{ + /* Return the example dpb */ + memcpy(dpb, &exdpb, 0x11); + return 0x11; +} + +/* Create an entirely bogus ALV + * TODO: Make it a bit better */ + +cpm_word fcb_getalv(cpm_byte* alv, cpm_word max) +{ + if (max > 1024) max = 1024; + + memset(alv, 0xFF, max / 2); + memset(alv + (max / 2), 0, max / 2); + + return max; +} + +/* Get disk free space */ + +cpm_word fcb_dfree(cpm_byte drive, cpm_byte* dma) +{ + /* Return half of disk capacity */ + redir_wr24(dma, 0x8000L); /* 8MB / 128 / 2 */ + return 0; +} diff --git a/Tools/unix/zxcc/cpmglob.c b/Tools/unix/zxcc/cpmglob.c new file mode 100644 index 00000000..3705b05e --- /dev/null +++ b/Tools/unix/zxcc/cpmglob.c @@ -0,0 +1,598 @@ +/* + + CPMREDIR: CP/M filesystem redirector + Copyright (C) 1998, John Elliott + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + This file implements those BDOS functions that use wildcard expansion. +*/ + +#include "cpmint.h" +#ifdef _MSC_VER + #define S_ISDIR(mode) (((mode) & _S_IFDIR) != 0) +#endif + +static cpm_byte* find_fcb; +static int find_n; +static int find_ext = 0; +static int find_xfcb = 0; +static int entryno; +static cpm_byte lastdma[0x80]; +static long lastsize; +static char target_name[CPM_MAXPATH]; + +static char upper(char c) +{ + if (islower(c)) return toupper(c); + return c; +} + +/* + * we need to handle case sensitive filesystems correctly. + * underlying files need to just work, irrespective if the files + * in the native filesystem are mixed, upper or lower. + * the naive code in the distributed zx will not work everywhere. + */ + + /* + * Does the string "s" match the CP/M FCB? + * pattern[0-10] will become a CP/M name parsed from "s" if it matches. + * If 1st byte of FCB is '?' then anything matches. + */ + +static int cpm_match(char* s, cpm_byte* fcb, cpm_byte* pattern) +{ + int n; + size_t m; + char* dotpos; + + m = strlen(s); + + /* + * let's cook the filename into something that we can match against + * the fcb. we reject any that can't be valid cp/m filenames, + * normalizing case as we go. all this goes into 'pattern' + */ + + for (n = 0; n < 11; n++) pattern[n] = ' '; + + /* The name must have 1 or 0 dots */ + dotpos = strchr(s, '.'); + if (!dotpos) { /* No dot. The name must be at most 8 characters */ + if (m > 8) return 0; + for (n = 0; n < m; n++) { + pattern[n] = upper(s[n]) & 0x7F; + } + } + else { /* at least one dot */ + if (strchr(dotpos + 1, '.')) { /* More than 1 dot */ + return 0; + } + if (dotpos == s) { /* Dot right at the beginning */ + return 0; + } + if ((dotpos - s) > 8) { /* "name" > 8 characters */ + return 0; + } + if (strlen(dotpos + 1) > 3) { /* "type" > 3 characters */ + return 0; + } + for (n = 0; n < (dotpos - s); n++) { /* copy filename portion */ + pattern[n] = upper(s[n]) & 0x7F; + } + m = strlen(dotpos + 1); + for (n = 0; n < m; n++) { /* copy extention portion */ + pattern[n + 8] = upper(dotpos[n + 1]) & 0x7F; + } + } + + /* + * handle special case where fcb[0] == '?' or fcb[0] & 0x80 + * this is used to return a full directory list on bdos's + */ + + if (((fcb[0] & 0x7F) == '?') || (fcb[0] & 0x80)) { + return 1; + } + for (n = 0; n < 11; n++) + { + if (fcb[n + 1] == '?') continue; + if ((pattern[n] & 0x7F) != (fcb[n + 1] & 0x7F)) + { + return 0; + } + } + return 1; /* Success! */ +} + +/* Get the next entry from the host's directory matching "fcb" */ + +static struct dirent* next_entry(DIR* dir, cpm_byte* fcb, cpm_byte* pattern, + struct stat* st) +{ + struct dirent* en; + int unsatisfied; + int drv = fcb[0] & 0x7F; + + if (drv == '?') drv = 0; + if (!drv) drv = redir_cpmdrive; + else drv--; + + for (unsatisfied = 1; unsatisfied; ) + { + /* 1. Get the next entry */ + en = readdir(dir); + if (!en) return NULL; /* No next entry */ + ++entryno; /* 0 for 1st, 1 for 2nd, etc. */ + + /* 2. See if it matches. We do this first (in preference to + * seeing if it's a subdirectory first) because it doesn't + * require disc access */ + if (!cpm_match(en->d_name, fcb, pattern)) + { + continue; + } + + /* 3. Stat it, & reject it if it's a directory */ + strcpy(target_name, redir_drive_prefix[drv]); + strcat(target_name, en->d_name); + + if (stat(target_name, st)) + { + DBGMSGV("Can't stat %s so omitting it.\n", target_name); + continue; /* Can't stat */ + } + if (S_ISDIR(st->st_mode)) + { + /* Searching for files only */ + if (fcb[0] != '?' && fcb[0] < 0x80) + { + continue; + } + } + unsatisfied = 0; + } + return en; +} + +void volume_label(int drv, cpm_byte* dma) +{ + struct stat st; + + memset(dma, 0x20, 12); /* Volume label */ + + /* Get label name */ + redir_get_label(drv, (char*)(dma + 1)); + + /* [0x0c] = label byte + * [0x0d] = password byte (=0) + * [0x10-0x17] = password + * [0x18] = label create date + * [0x1c] = label update date + */ +#ifdef __MSDOS__ + dma[0x0c] = 0x21; /* Under DOS, only "update" */ + if (redir_drdos) dma[0x0c] |= 0x80; /* Under DRDOS, passwords allowed */ +#else + dma[0x0c] = 0x61; /* Label exists and time stamps allowed */ +#endif /* (update & access) */ + dma[0x0d] = 0; /* Label not passworded */ + dma[0x0f] = 0x80; /* Non-CP/M media */ + + if (stat(redir_drive_prefix[drv], &st)) + { + DBGMSGV("stat() fails on '%s'\n", redir_drive_prefix[drv]); + return; + } + + redir_wr32(dma + 0x18, redir_cpmtime(st.st_atime)); + redir_wr32(dma + 0x1C, redir_cpmtime(st.st_mtime)); +} + +cpm_word redir_find(int n, cpm_byte* fcb, cpm_byte* dma) +{ + DIR* hostdir; + int drv, attrib; + long recs; + struct stat st; + struct dirent* de; + cpm_word rights; + + drv = (fcb[0] & 0x7F); + if (!drv || drv == '?') drv = redir_cpmdrive; + else drv--; + + if (find_xfcb) /* Return another extent */ + { + memcpy(dma, lastdma, 0x80); + dma[0] |= 0x10; /* XFCB */ + dma[0x0c] = dma[0x69]; /* Password mode */ + dma[0x0d] = 0x0A; /* Password decode byte */ + memset(dma + 0x10, '*', 7); + dma[0x17] = ' '; /* Encoded password */ + memcpy(lastdma, dma, 0x80); + + find_xfcb = 0; + return 0; + } + + if (find_ext) /* Return another extent */ + { + memcpy(dma, lastdma, 0x80); + dma[0x0c]++; + if (dma[0x0c] == 0x20) + { + dma[0x0c] = 0; + dma[0x0e]++; + } + lastsize -= 0x4000; + recs = (lastsize + 127) / 128; + dma[0x0f] = (recs > 127) ? 0x80 : (recs & 0x7F); + + if (lastsize <= 0x4000) find_ext = 0; + memcpy(lastdma, dma, 0x80); + + return 0; + } + + memset(dma, 0, 128); /* Zap the buffer */ + + /* If returning all entries, return a volume label. */ + + if ((fcb[0] & 0x7F) == '?') + { + if (!n) + { + volume_label(drv, dma); + return 0; + } + else --n; + } + + /* Note: This implies that opendir() works on a filename with a + * trailing slash. It does under Linux, but that's the only assurance + * I can give. */ + + entryno = -1; + hostdir = opendir(redir_drive_prefix[drv]); + + if (!hostdir) + { + DBGMSGV("opendir() fails on '%s'\n", redir_drive_prefix[drv]); + return 0xFF; + } + + /* We have a handle to the directory. */ + while (n >= 0) + { + de = next_entry(hostdir, fcb, dma + 1, &st); + if (!de) + { + closedir(hostdir); + return 0xFF; + } + --n; + } + /* Valid entry found & statted. dma+1 holds filename. */ + + dma[0] = redir_cpmuser; /* Uid always matches */ + dma[0x0c] = 0; /* Extent counter, low */ + dma[0x0d] = st.st_size & 0x7F; /* Last record byte count */ + dma[0x0e] = 0; /* Extent counter, high */ + +#ifdef _WIN32 + attrib = GetFileAttributesA(target_name); + rights = redir_drdos_get_rights(target_name); + if (rights && ((fcb[0] & 0x7F) == '?')) find_xfcb = 1; +#else + attrib = 0; + rights = 0; +#endif + if (attrib & 1) dma[9] |= 0x80; /* read only */ + if (attrib & 4) dma[10] |= 0x80; /* system */ + if (!(attrib & 0x20)) dma[11] |= 0x80; /* archive */ + +/* TODO: Under Unix, work out correct RO setting */ + + recs = (st.st_size + 127) / 128; + dma[0x0f] = (recs > 127) ? 0x80 : (recs & 0x7F); + dma[0x10] = 0x80; + if (S_ISDIR(st.st_mode)) dma[0x10] |= 0x40; + if (attrib & 2) dma[0x10] |= 0x20; + dma[0x10] |= ((entryno & 0x1FFF) >> 8); + dma[0x11] = dma[0x10]; + dma[0x12] = entryno & 0xFF; + + redir_wr32(dma + 0x16, (dword)st.st_mtime); /* Modification time. */ + /* TODO: It should be in DOS format */ + /* TODO: At 0x1A, 1st cluster */ + redir_wr32(dma + 0x1C, st.st_size); /* True size */ + + if (rights) /* Store password mode. Don't return an XFCB. */ + { + dma[0x69] = redir_cpm_pwmode(rights); + memcpy(lastdma, dma, 0x80); + } + + dma[0x60] = 0x21; /* XFCB */ + redir_wr32(dma + 0x61, redir_cpmtime(st.st_atime)); + redir_wr32(dma + 0x65, redir_cpmtime(st.st_mtime)); + + closedir(hostdir); + + if (st.st_size > 0x4000 && (fcb[0x0C] == '?')) /* All extents? */ + { + lastsize = st.st_size; + find_ext = 1; + memcpy(lastdma, dma, 0x80); + } + return 0; +} + +cpm_word fcb_find1(cpm_byte* fcb, cpm_byte* dma) /* 0x11 */ +{ +#ifdef DEBUG + int rv; +#endif + + FCBENT(fcb); + + redir_log_fcb(fcb); + + find_n = 0; + find_fcb = fcb; + find_ext = 0; + find_xfcb = 0; + +#ifdef DEBUG + rv = redir_find(find_n, fcb, dma); + + if (rv < 4) + { + DBGMSGV("Ret: %-11.11s\n", dma + 1); + } + else DBGMSG("Ret: Fail\n"); + FCBRET(rv); +#else + FCBRET(redir_find(find_n, find_fcb, dma)); +#endif +} + +/* We don't bother with the FCB parameter - it's undocmented, and + * programs that do know about it will just pass in the same parameter + * that they did to function 0x11 */ + +cpm_word fcb_find2(cpm_byte* fcb, cpm_byte* dma) /* 0x12 */ +{ +#ifdef DEBUG + int rv; + char fname[CPM_MAXPATH]; +#endif + + FCBENT(find_fcb); + +#ifdef DEBUG + redir_fcb2unix(find_fcb, fname); + DBGMSGV("file number %d, '%s'\n", find_n, fname); +#endif + + ++find_n; + +#ifdef DEBUG + rv = redir_find(find_n, find_fcb, dma); + + if (rv < 4) + { + DBGMSGV("Ret: %-11.11s\n", dma + 1); + } + else DBGMSG("Ret: Fail\n"); + FCBRET(rv); +#else + FCBRET(redir_find(find_n, find_fcb, dma)); +#endif +} + +/* Under CP/M, unlinking works with wildcards */ + +cpm_word fcb_unlink(cpm_byte* fcb, cpm_byte* dma) +{ + DIR* hostdir; + int drv; + struct dirent* de; + struct stat st; + int handle = 0; + int unpasswd = 0; + char fname[CPM_MAXPATH]; + int del_cnt = 0; + + FCBENT(fcb); + + if (fcb[5] & 0x80) unpasswd = 1; /* Remove password rather than file */ + + redir_log_fcb(fcb); + + drv = (fcb[0] & 0x7F); + if (!drv || drv == '?') drv = redir_cpmdrive; + else drv--; + + if (redir_ro_drv(drv)) + { + /* Error: R/O drive */ + DBGMSG("delete failed - R/O drive\n"); + FCBRET(0x02FF); + } + +#ifdef DEBUG + redir_fcb2unix(fcb, fname); + DBGMSGV("fcb_unlink('%s')\n", fname); +#endif + + /* Note: This implies that opendir() works on a filename with a + * trailing slash. It does under Linux, but that's the only assurance + * I can give.*/ + + hostdir = opendir(redir_drive_prefix[drv]); + + if (!hostdir) + { + DBGMSGV("opendir failed on '%s'\n", redir_drive_prefix[drv]); + FCBRET(0xFF); + } + + /* We have a handle to the directory. */ + do + { + de = next_entry(hostdir, fcb, (cpm_byte*)fname, &st); + if (de) + { + strcpy(target_name, redir_drive_prefix[drv]); + strcat(target_name, de->d_name); + DBGMSGV("deleting '%s'\n", de->d_name); + if (unpasswd) + { +#ifdef __MSDOS__ + if (redir_drdos) + { + handle = redir_drdos_put_rights(target_name, dma, 0); + } + else handle = 0; +#endif + } + else if (fcb[0] & 0x80) + { + DBGMSGV("rmdir '%s'\n", target_name); + handle = rmdir(target_name); + if (handle && redir_password_error()) + { + DBGMSGV("rmdir failed (errno=%lu): %s\n", errno, strerror(errno)); + redir_password_append(target_name, dma); + DBGMSGV("rmdir '%s'\n", target_name); + handle = rmdir(target_name); + } + if (handle) + DBGMSGV("rmdir failed (errno=%lu): %s\n", errno, strerror(errno)); + } + else + { + releaseFile(target_name); + DBGMSGV("unlink '%s'\n", target_name); + handle = unlink(target_name); + if (handle && redir_password_error()) + { + DBGMSGV("unlink failed (errno=%lu): %s\n", errno, strerror(errno)); + redir_password_append(target_name, dma); + releaseFile(target_name); + DBGMSGV("unlink '%s'\n", target_name); + handle = unlink(target_name); + } + if (handle) + DBGMSGV("unlink failed (errno=%lu): %s\n", errno, strerror(errno)); + } + + if (handle) + de = NULL; /* Delete failed */ + else + del_cnt++; + } + } while (de != NULL); + + if (!handle && !del_cnt) + DBGMSG("no matching directory entries\n"); + else + DBGMSGV("deleted %i file(s)\n", del_cnt); + + if (handle || !del_cnt) + { + DBGMSG("delete processing failed\n"); + closedir(hostdir); + FCBRET(0xFF); + } + + DBGMSG("delete processing succeeded\n"); + closedir(hostdir); + FCBRET(0); +} + +#ifdef __MSDOS__ +cpm_word redir_get_label(cpm_byte drv, char* pattern) +{ + char strs[10]; + struct ffblk fblk; + int done; + char* s; + int n; + + /* We need the drive prefix to be of the form "C:\etc..." */ + + memset(pattern, ' ', 11); + if (!redir_drive_prefix[drv][0] || redir_drive_prefix[drv][1] != ':') + return 0; + + sprintf(strs, "%c:/*.*", redir_drive_prefix[drv][0]); + + done = findfirst(strs, &fblk, FA_LABEL); + while (!done) + { + if ((fblk.ff_attrib & FA_LABEL) && + !(fblk.ff_attrib & (FA_SYSTEM | FA_HIDDEN))) + { + s = strchr(fblk.ff_name, '/'); + if (!s) s = strchr(fblk.ff_name, '\\'); + if (!s) s = strchr(fblk.ff_name, ':'); + if (!s) s = fblk.ff_name; + for (n = 0; n < 11; n++) + { + if (!(*s)) break; + if (*s == '.') + { + n = 7; + ++s; + continue; + } + pattern[n] = upper(*s); + ++s; + } + return 1; + } + done = findnext(&fblk); + } + return 0; +} +#else +cpm_word redir_get_label(cpm_byte drv, char* pattern) +{ + char* dname; + size_t l; + int n; + + memset(pattern, ' ', 11); + + dname = strrchr(redir_drive_prefix[drv], '/'); + if (dname) + { + ++dname; + l = strlen(dname); + if (l > 11) l = 11; + for (n = 0; n < l; n++) pattern[n] = upper(dname[l]); + } + else + { + pattern[0] = '.'; + } + return 0; +} + +#endif diff --git a/Tools/unix/zxcc/cpmint.h b/Tools/unix/zxcc/cpmint.h new file mode 100644 index 00000000..9520e05e --- /dev/null +++ b/Tools/unix/zxcc/cpmint.h @@ -0,0 +1,274 @@ +/* + + CPMREDIR: CP/M filesystem redirector + Copyright (C) 1998, John Elliott + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + This file holds internal declarations for the library. +*/ + +#include "config.h" +#include +#ifdef HAVE_STDLIB_H + #include +#endif +#include +#ifdef HAVE_STRING_H + #include +#endif +#include +#include +#ifdef _WIN32 + #include +#endif +#ifdef HAVE_SYS_TYPES_H + #include +#endif +#include +#include +#ifdef HAVE_DIRENT_H + #include +#endif +#ifdef HAVE_DIRECT_H + #include +#endif +#ifdef HAVE_IO_H + #include +#endif +#ifdef HAVE_NDIR_H + #include +#endif +#ifdef HAVE_SYS_DIR_H + #include +#endif +#ifdef HAVE_SYS_NDIR_H + #include +#endif +#ifdef HAVE_WINDOWS_H + #include +#endif +#ifdef HAVE_WINNT_H + #include +#endif +#ifdef HAVE_SYS_VFS_H + #include +#endif +#ifdef HAVE_UTIME_H + #include +#endif +#ifdef HAVE_FCNTL_H + #include +#endif +#ifdef HAVE_UNISTD_H + #include +#endif +#ifndef _WIN32 + #include + #include + #define _S_IFDIR S_IFDIR +#endif + +/* MSDOS includes removed */ + +#ifdef _WIN32 + #define DIRSEP "/" + #define mkdir(dir, mode) _mkdir(dir) + #define strcasecmp _stricmp + #define ftruncate _chsize +/* note Windows build assumes Windows is configured as a non case sensitive filesystem */ + #ifndef STDIN_FILENO + #define STDIN_FILENO _fileno(stdin) + #define STDOUT_FILENO _fileno(stdout) + #define STDERR_FILENO _fileno(stderr) + #endif +#else + #define DIRSEP "/\\:" + #define CASE_SENSITIVE_FILESYSTEM 1 +#endif + +#ifdef _WIN32 +int truncate(const char* path, off_t length); /* see util.c */ +#endif + +typedef unsigned char byte; /* Must be exactly 8 bits */ +typedef unsigned short word; /* Must be exactly 16 bits */ +typedef unsigned long dword; /* Must be at least 32 bits, and + >= sizeof(int) */ + +#include "cpmredir.h" + +#ifdef CPMDEF + #define EXT + #define INIT(x) =x +#else + #define EXT extern + #define INIT(x) +#endif + +/* The 16 directories to which the 16 CP/M drives are mapped */ + +EXT char redir_drive_prefix[16][CPM_MAXPATH]; + +/* Current drive and user */ + +EXT int redir_cpmdrive; +EXT int redir_cpmuser; + +/* Length of 1 read/write operation, bytes */ + +EXT int redir_rec_len INIT(128); + +/* Same, but in 128-byte records */ +EXT int redir_rec_multi INIT(1); + +/* Using a DRDOS system? */ +EXT int redir_drdos INIT(0); + +/* Default password */ +#ifdef __MSDOS__ +EXT char redir_passwd[8] INIT(""); +#endif + +EXT cpm_word redir_l_drives INIT(0); +EXT cpm_word redir_ro_drives INIT(0); + +#undef EXT +#undef INIT + +/* Convert FCB to a Unix filename, returning 1 if it's ambiguous */ +int redir_fcb2unix(cpm_byte* fcb, char* fname); + +/* Open FCB, set file attributes */ +int redir_ofile(cpm_byte* fcb, char* s); + +/* Check that the FCB we have is valid */ +int redir_verify_fcb(cpm_byte* fcb); + +#ifndef O_BINARY /* Necessary in DOS, not present in Linux */ +#define O_BINARY 0 +#endif + +/* Facilities for debug tracing */ + +long zxlseek(int fd, long offset, int wh); + +#ifdef _WIN32 +char* GetErrorStr(DWORD); +#endif + +#ifdef DEBUG +// long zxlseek(int fd, long offset, int wh); +// void redir_Msg(char *s, ...); +void DbgMsg(const char* file, int line, const char* func, char* s, ...); +void redir_showfcb(cpm_byte* fcb); +#else +// #define zxlseek lseek +/* Warning: This is a GCC extension */ +// #define redir_Msg(x, ...) +#define redir_showfcb(x) +#endif + +#ifdef DEBUG +#define FCBENT(fcb) \ + { \ + char fname[CPM_MAXPATH] = ""; \ + redir_fcb2unix(fcb, fname); \ + DBGMSGV("entry w/ FCB @ 0x%04X, filename:'%s'\n", fcb-RAM, fname); \ + } + +#define FCBRET(rc) \ + { \ + DBGMSGV("returning 0x%04X\n", rc); \ + return rc; \ + } + +#define DBGMSGV(s, ...) DbgMsg(__FILE__, __LINE__, __func__, s, __VA_ARGS__) +#define DBGMSG(s) DbgMsg(__FILE__, __LINE__, __func__, s) +#else +#define FCBENT(fcb) +#define FCBRET(rc) return rc; +#define DBGMSGV(s, ...) +#define DBGMSG(s) +#endif + +/* Get the "sequential access" file pointer out of an FCB */ + +long redir_get_fcb_pos(cpm_byte* fcb); + +/* Write "sequential access" pointer to FCB */ + +void redir_put_fcb_pos(cpm_byte* fcb, long npos); + +/* Convert time_t to CP/M day count/hours/minutes */ +dword redir_cpmtime(time_t t); +/* And back */ +time_t redir_unixtime(cpm_byte* c); + +/* Functions to access 24-bit & 32-bit words in memory. These are always + little-endian. */ + +void redir_wr24(cpm_byte* addr, dword v); +void redir_wr32(cpm_byte* addr, dword v); +dword redir_rd24(cpm_byte* addr); +dword redir_rd32(cpm_byte* addr); + +/* If you have 64-bit file handles, you'll need to write separate wrhandle() + and rdhandle() routines */ +#define redir_wrhandle redir_wr32 +#define redir_rdhandle redir_rd32 + +/* Mark a drive as logged in */ + +void redir_log_drv(cpm_byte drv); +void redir_log_fcb(cpm_byte* fcb); + +/* Check if a drive is software read-only */ + +int redir_ro_drv(cpm_byte drv); +int redir_ro_fcb(cpm_byte* fcb); + +/* Translate errno to a CP/M error */ + +cpm_word redir_xlt_err(void); + +/* Get disc label */ +cpm_word redir_get_label(cpm_byte drv, char* pattern); + +/* DRDOS set/get access rights - no-ops under MSDOS and Unix: + * + * CP/M password mode -> DRDOS password mode */ +cpm_word redir_drdos_pwmode(cpm_byte b); + +/* DRDOS password mode to CP/M password mode */ +cpm_byte redir_cpm_pwmode(cpm_word w); + +/* Get DRDOS access rights for a file */ +cpm_word redir_drdos_get_rights(char* path); + +/* Set DRDOS access rights and/or password */ +cpm_word redir_drdos_put_rights(char* path, cpm_byte* dma, cpm_word rights); + +/* Was the last error caused by invalid password? */ +cpm_word redir_password_error(void); + +/* Append password to filename (FILE.TYP -> FILE.TYP;PASSWORD) */ +void redir_password_append(char* s, cpm_byte* dma); + +void releaseFile(char* fname); +int trackFile(char* fname, void* fcb, int fd); +#define releaseFCB(fcb) trackFile(NULL, fcb, -1) + +extern byte RAM[65536]; /* The Z80's address space */ diff --git a/Tools/unix/zxcc/cpmparse.c b/Tools/unix/zxcc/cpmparse.c new file mode 100644 index 00000000..73919c68 --- /dev/null +++ b/Tools/unix/zxcc/cpmparse.c @@ -0,0 +1,124 @@ +/* + + CPMREDIR: CP/M filesystem redirector + Copyright (C) 1998, John Elliott + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + This file parses filenames to FCBs. +*/ + +#include "cpmint.h" + +#define is_num(c) ((c >= '0') && (c <= '9')) + +static int parse_drive_user(char* txt, cpm_byte* fcb) +{ + char uid[4], drvid[4]; + int up, dp; + + for (up = dp = 0; *txt != ':'; ++txt) + { + if (is_num(*txt)) uid[up++] = *txt; + if (isalpha(*txt)) drvid[dp++] = *txt; + if (!is_num(*txt) && !isalpha(*txt)) return -1; + } + uid[up] = 0; drvid[dp] = 0; + + if (dp > 1) return -1; /* Invalid driveletter */ + if (up > 2) return -1; /* Invalid uid */ + + fcb[0x0d] = atoi(uid) + 1; if (fcb[0x0d] > 16) return -1; + + if (islower(drvid[0])) drvid[0] = toupper(drvid[0]); + + if (drvid[0] < 'A' || drvid[0] > 'P') return -1; + + fcb[0] = drvid[0] - '@'; + return 0; +} + +cpm_word fcb_parse(char* txt, cpm_byte* fcb) +{ + int nl = 0, tl = 0, pl = 0, phase = 0; + char* ntxt, ch; + + memset(fcb, 0, 0x24); + + if (txt[1] == ':' || txt[2] == ':' || txt[3] == ':') + { + if (parse_drive_user(txt, fcb)) return 0xFFFF; + /* Move past the colon */ + ntxt = strchr(txt, ':') + 1; + } + else ntxt = txt; + while (phase < 3) + { + ch = *ntxt; + if (islower(ch)) ch = toupper(ch); + + switch (ch) + { + case 0: + case '\r': /* EOL */ + phase = 4; + break; + + case '.': /* file.typ */ + if (!phase) ++phase; + else phase = 3; + break; + + case ';': /* Password */ + if (phase < 2) phase = 2; + else phase = 3; + break; + + case '[': case ']': case '=': case 9: case ' ': + case '>': case '<': case ':': case ',': case '/': + case '|': /* Terminator */ + phase = 3; + + default: + switch (phase) + { + case 0: + if (nl >= 8) return 0xFFFF; + fcb[++nl] = ch; + break; + + case 1: + if (tl >= 3) return 0xFFFF; + fcb[tl + 9] = ch; + ++tl; + break; + + case 2: + if (pl >= 8) return 0xFFFF; + fcb[pl + 0x10] = ch; + ++pl; + break; + } + break; + } + } + if (!nl) return 0xFFFF; + + fcb[0x1A] = pl; + + if (phase == 4) return 0; + + return (cpm_word)(ntxt - txt); +} diff --git a/Tools/unix/zxcc/cpmredir.c b/Tools/unix/zxcc/cpmredir.c new file mode 100644 index 00000000..ff32a3c0 --- /dev/null +++ b/Tools/unix/zxcc/cpmredir.c @@ -0,0 +1,1006 @@ +/* + + CPMREDIR: CP/M filesystem redirector + Copyright (C) 1998, John Elliott + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/* This file handles actual reading and writing */ + +#define CPMDEF +#include "cpmint.h" + +/* DISK BDOS FUNCTIONS */ + +/* General treatment: + * + * We use the "disk block number" fields in the FCB to store our file handle; + * this is a similar trick to that used by DOSPLUS, which stores its cluster + * number in there. It works if: + * + * a) sizeof(int) <= 8 bytes (64 bits). If it's more, this needs rewriting + * to use a hash table; + * b) the program never touches these bytes. Practically no CP/M program does. + * + * We store a "magic number" (0x00FD) in the first two bytes of this field, and + * if the number has been changed then we abort. + * + * nb: Since I wrote ZXCC, I have found that DOSPLUS uses 0x8080 as a magic + * number [well, actually this is an oversimplification, but a hypothetical + * program written against DOSPLUS would work with 0x8080]. Perhaps 0x8080 + * should be used instead. + * + * Format of the field: + * + * [--2 bytes--] magic number + * [--8 bytes--] file handle. 8 bytes reserved but only 4 currently used. + * [--2 bytes--] reserved. + * [--4 bytes--] file length. + */ + +#define MAGIC_OFFSET 0x10 +#define HANDLE_OFFSET 0x12 +#define LENGTH_OFFSET 0x1C + +cpm_word fcb_open(cpm_byte* fcb, cpm_byte* dma) +{ + char fname[CPM_MAXPATH]; + int handle; + int drv; + size_t l; + char* s; + DIR* dir; + + FCBENT(fcb); + + /* Don't support ambiguous filenames */ + if (redir_fcb2unix(fcb, fname)) FCBRET(0x09FF); + + redir_log_fcb(fcb); + + drv = fcb[0] & 0x7F; + if (!drv) drv = redir_cpmdrive; else --drv; + + if (fcb[0] & 0x80) /* Open directory */ + { + if (fcb[0x0C]) FCBRET(0x0BFF); /* Can't assign "floating" dir */ + + if (!memcmp(fcb + 1, ". ", 11)) + { + FCBRET(0); /* Opening "." */ + } + if (!memcmp(fcb + 1, ".. ", 11)) + { + l = strlen(redir_drive_prefix[drv]) - 1; + s = redir_drive_prefix[drv]; + while (--l > 0 && !strchr(DIRSEP, s[l])) + --l; + if (l == 0) FCBRET(0); /* "/" or "\" */ +#ifdef _WIN32 + if (s[l] == ':' && l < 2) FCBRET(0); /* "C:" */ +#endif + s[l + 1] = 0; + FCBRET(0); + } + /* Opening some other directory */ + + dir = opendir(fname); + if (!dir) FCBRET(0xFF); /* Not a directory */ + closedir(dir); + strcpy(redir_drive_prefix[drv], fname); + strcat(redir_drive_prefix[drv], "/"); + FCBRET(0); + } + + /* Note: Some programs (MAC is an example) don't close a file + * if they opened it just to do reading. MAC then reopens the + * file (which rewinds it); this causes FCB leaks under some + * DOS-based emulators */ + + handle = redir_ofile(fcb, fname); + //DBGMSGV("fcb_open('%s')\n", fname); + if (handle < 0 && redir_password_error()) + { + DBGMSGV("1st chance open failed on %s\n", fname); + redir_password_append(fname, dma); + DBGMSGV("Trying with %s\n", fname); + handle = redir_ofile(fcb, fname); + } + + if (handle == -1) + { + if (redir_password_error()) FCBRET(0x7FF); + FCBRET(0xFF); + } + fcb[MAGIC_OFFSET] = 0xFD; /* "Magic number" */ + fcb[MAGIC_OFFSET + 1] = 0x00; + + /* TODO: Should the magic number perhaps be 0x8080, as in DOSPLUS? */ + + redir_wrhandle(fcb + HANDLE_OFFSET, handle); + + redir_put_fcb_pos(fcb, fcb[0x0C] * 16384); + /* (v1.01) "seek" to beginning of extent, not file. + * This is necessary for the awful I/O code + * in LINK-80 to work + */ + + /* Get the file length */ + redir_wr32(fcb + LENGTH_OFFSET, zxlseek(handle, 0, SEEK_END)); + zxlseek(handle, 0, SEEK_SET); + + /* Set the last record byte count */ + if (fcb[0x20] == 0xFF) fcb[0x20] = fcb[LENGTH_OFFSET] & 0x7F; + + FCBRET(0); +} + +cpm_word fcb_close(cpm_byte* fcb) +{ + int handle, drv; + + FCBENT(fcb); + + if ((handle = redir_verify_fcb(fcb)) < 0) FCBRET(-1); + DBGMSGV(" (at 0x%lX)\n", zxlseek(handle, 0, SEEK_CUR)); + + if (fcb[0] & 0x80) /* Close directory */ + { + drv = fcb[0] & 0x7F; + if (!drv) drv = redir_cpmdrive; else drv--; +#ifdef __MSDOS__ + strcpy(redir_drive_prefix[drv] + 1, ":/"); +#else + strcpy(redir_drive_prefix[drv], "/"); +#endif + FCBRET(0); + } + + if (fcb[5] & 0x80) /* CP/M 3: Flush rather than close */ + { +#ifdef _WIN32 + BOOL b; + DBGMSGV("flush file #%i\n", handle); + b = FlushFileBuffers((HANDLE)handle); + if (!b) + DBGMSGV("failed to flush file #%i (Error=%lu): %s\n", handle, GetLastError(), GetErrorStr(GetLastError())); +#else + DBGMSGV("flush file #%i\n", handle); + sync(); +#endif + FCBRET(0); + } + +#ifdef _WIN32 + { + BOOL b; + DBGMSGV("close file #%i\n", handle); + b = CloseHandle((HANDLE)handle); + if (!b) + { + DBGMSGV("failed to close file #%i (Error=%lu): %s\n", handle, GetLastError(), GetErrorStr(GetLastError())); + FCBRET(0xFF); + } + } +#else + DBGMSGV("close file #%i\n", handle); + if (close(handle)) + { + DBGMSGV("failed to close file #%i (Error=%lu): %s\n", handle, errno, strerror(errno)); + FCBRET(0xFF); + } +#endif + + trackFile(NULL, fcb, handle); + + FCBRET(0); +} + +/* In theory, fcb_read() is supposed to be sequential access - the program + just reads one record after another and lets the OS worry about file + pointers. + + In practice, it isn't so easy. For example, DR's LINK-80 does seeks when + the file size gets above 8k, and SAVE rewinds the file by setting the + counter fields to 0. + + Seeking is done by relying on the following fields: + + ex (FCB+12) = (position / 16k) % 32 + s2 (FCB+14) = position / 512k + cr (FCB+32) = (position % 16k) / 128 + + TODO: Set rc to number of 80h-byte records in last extent: ie: + + length of file - (file ptr - (file ptr % 16384)) / 128 + + if >80h, let it be 80h + +*/ + +cpm_word fcb_read(cpm_byte* fcb, cpm_byte* dma) +{ + int handle; + int rv, n, rd_len; + long npos; + + FCBENT(fcb); + + if ((handle = redir_verify_fcb(fcb)) < 0) FCBRET(9); /* Invalid FCB */ + + /* The program may have mucked about with the counters, so + * do an lseek() to where it should be. */ + + npos = redir_get_fcb_pos(fcb); + zxlseek(handle, npos, SEEK_SET); + DBGMSGV(" (from 0x%lX)\n", zxlseek(handle, 0, SEEK_CUR)); + + /* Read in the required amount */ + +#ifdef _WIN32 + { + BOOL b; + DBGMSGV("read file #%i @ 0x%X, %i bytes\n", handle, dma - RAM, redir_rec_len); + b = ReadFile((HANDLE)handle, dma, redir_rec_len, (unsigned long*)(&rv), NULL); + if (!b) + { + DBGMSGV("failed to read file #%i (Error=%lu): %s\n", handle, GetLastError(), GetErrorStr(GetLastError())); + rv = -1; + } + } +#else + DBGMSGV("read file #%i @ 0x%X, %i bytes\n", handle, dma - RAM, redir_rec_len); + rv = read(handle, dma, redir_rec_len); + if (rv == -1) + DBGMSGV("failed to read file #%i (errno=%lu): %s\n", handle, errno, strerror(errno)); +#endif + + /* read() can corrupt buffer area following data read if length + * of data read is less than buffer. Clean it up. */ + if (rv == -1) + memset(dma, 0x00, redir_rec_len); + else + memset(dma + rv, 0x00, redir_rec_len - rv); + + /* rd_len = length supposedly read, bytes. Round to nearest 128 + * bytes. */ + rd_len = ((rv + 127) / 128) * 128; + + npos += rd_len; + + /* Write new file pointer into FCB */ + + redir_put_fcb_pos(fcb, npos); + + if (rv < 0) + { + DBGMSG("Ret: -1\n"); + FCBRET(redir_xlt_err()); /* unwritten extent */ + } + + /* if not multiple of 128 bytes, pad sector with 0x1A */ + for (n = rv; n < rd_len; n++) dma[n] = 0x1A; + + /* Less was read in than asked for. Report the number of 128-byte + * records that _were_ read in. + */ + + if (rd_len < redir_rec_len) /* eof */ + { + /* Pack from the size actually read up to the size we claim + * to have read */ + rd_len = rd_len * 2; /* rd_len already sector * 128, so * 2 to move to High byte */ + FCBRET(rd_len | 1); /* eof */ + } + + DBGMSGV("Ret: 0 (bytes read=%d)\n", rv); + FCBRET(0); +} + +cpm_word fcb_write(cpm_byte* fcb, cpm_byte* dma) +{ + int handle; + int rv; + long npos, len; + + FCBENT(fcb); + + if ((handle = redir_verify_fcb(fcb)) < 0) FCBRET(9); /* Invalid FCB */ + + /* Software write-protection */ + if (redir_ro_fcb(fcb)) FCBRET(0x02FF); + + /* Check for a seek */ + npos = redir_get_fcb_pos(fcb); + zxlseek(handle, npos, SEEK_SET); + + DBGMSGV(" (to %lX)\n", zxlseek(handle, 0, SEEK_CUR)); + +#ifdef _WIN32 + { + BOOL b; + DBGMSGV("write file #%i @ 0x%X, %i bytes\n", handle, dma - RAM, redir_rec_len); + b = WriteFile((HANDLE)handle, dma, redir_rec_len, (unsigned long*)(&rv), NULL); + if (!b) + { + DBGMSGV("failed to write file #%i (Error=%lu): %s\n", handle, GetLastError(), GetErrorStr(GetLastError())); + rv = -1; + } + } +#else + DBGMSGV("write file #%i @ 0x%X, %i bytes\n", handle, dma - RAM, redir_rec_len); + rv = write(handle, dma, redir_rec_len); + if (rv == -1) + DBGMSGV("failed to write file #%i (errno=%lu): %s\n", handle, errno, strerror(errno)); +#endif + npos += redir_rec_len; + + redir_put_fcb_pos(fcb, npos); + + /* Update the file length */ + len = redir_rd32(fcb + LENGTH_OFFSET); + if (len < npos) redir_wr32(fcb + LENGTH_OFFSET, npos); + + if (rv < 0) FCBRET(redir_xlt_err()); /* error */ + if (rv < redir_rec_len) FCBRET(1); /* disk full */ + FCBRET(0); +} + +cpm_word fcb_creat(cpm_byte* fcb, cpm_byte* dma) +{ + char fname[CPM_MAXPATH]; + int handle; + + FCBENT(fcb); + + releaseFCB(fcb); /* release existing fcb usage */ + + /* Don't support ambiguous filenames */ + if (redir_fcb2unix(fcb, fname)) FCBRET(0x09FF); + DBGMSGV("fcb_creat('%s')\n", fname); + + /* Software write-protection */ + if (redir_ro_fcb(fcb)) FCBRET(0x02FF); + + redir_log_fcb(fcb); + + if (fcb[0] & 0x80) + { + handle = mkdir(fname, 0x777); + if (handle) FCBRET(redir_xlt_err()); + FCBRET(0); + } + releaseFile(fname); /* purge any open handles for this file */ + +#ifdef _WIN32 + DBGMSGV("create file '%s'\n", fname); + handle = (int)CreateFile(fname, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (handle == HFILE_ERROR) + { + DBGMSGV("failed to create file '%s' (Error=%lu): %s\n", fname, GetLastError(), GetErrorStr(GetLastError())); + FCBRET(0xFF); + } +#else + DBGMSGV("create file '%s'\n", fname); + handle = open(fname, O_RDWR | O_CREAT | O_EXCL | O_BINARY, + S_IREAD | S_IWRITE); + if (handle < 0) + { + DBGMSGV("failed to create file '%s' (Error=%lu): %s\n", fname, errno, strerror(errno)); + FCBRET(0xFF); + } +#endif + + trackFile(fname, fcb, handle); /* track new file */ + + fcb[MAGIC_OFFSET] = 0xFD; /* "Magic number" */ + fcb[MAGIC_OFFSET + 1] = 0; + redir_wrhandle(fcb + HANDLE_OFFSET, handle); + redir_wr32(fcb + LENGTH_OFFSET, 0); + redir_put_fcb_pos(fcb, 0); /* Seek to 0 */ + +#ifdef __MSDOS__ + if (redir_drdos && (fcb[6] & 0x80)) + { + cpm_word rights = redir_drdos_pwmode(dma[9]); + redir_drdos_put_rights(fname, dma, rights | 0x8000); + } +#endif + + FCBRET(0); +} + +cpm_word fcb_rename(cpm_byte* fcb, cpm_byte* dma) +{ + char ofname[CPM_MAXPATH], nfname[CPM_MAXPATH]; + cpm_byte sdrv, ddrv; + + FCBENT(fcb); + + releaseFCB(fcb); /* release any file associated with the fcb */ + redir_log_fcb(fcb); + + /* Don't support ambiguous filenames */ + if (redir_fcb2unix(fcb, ofname)) FCBRET(0x09FF); + if (redir_fcb2unix(fcb + 0x10, nfname)) FCBRET(0x09FF); + + /* Software write-protection */ + if (redir_ro_fcb(fcb)) FCBRET(0x02FF); + + if (fcb[0] & 0x80) FCBRET(0xFF); /* Can't rename directories */ + + /* Check we're not trying to rename across drives. Otherwise, it + * might let you do it if the two "drives" are on the same disk. */ + + sdrv = fcb[0] & 0x7F; if (!sdrv) sdrv = redir_cpmdrive + 1; + ddrv = fcb[0x10] & 0x7F; if (!ddrv) ddrv = redir_cpmdrive + 1; + + if (sdrv != ddrv) FCBRET(0xFF); + + DBGMSGV("rename '%s' to '%s'\n", ofname, nfname); + + releaseFile(ofname); /* need ofname and nfname to be closed */ + releaseFile(nfname); + if (rename(ofname, nfname)) + { + if (redir_password_error()) + { + redir_password_append(ofname, dma); + if (!rename(ofname, nfname)) FCBRET(0); + if (redir_password_error()) FCBRET(0x7FF); + } + FCBRET(0xFF); + } + + FCBRET(0); +} + +cpm_word fcb_randrd(cpm_byte* fcb, cpm_byte* dma) +{ + int handle; + int rv, n, rd_len; + dword offs = redir_rd24(fcb + 0x21) * 128; + + FCBENT(fcb); + + if ((handle = redir_verify_fcb(fcb)) < 0) FCBRET(9); /* Invalid FCB */ + + if (zxlseek(handle, offs, SEEK_SET) < 0) FCBRET(6); /* bad record no. */ + +#ifdef _WIN32 + { + BOOL b; + DBGMSGV("read file #%i @ 0x%X, %i bytes\n", handle, dma - RAM, redir_rec_len); + b = ReadFile((HANDLE)handle, dma, redir_rec_len, (unsigned long*)(&rv), NULL); + if (!b) + { + DBGMSGV("failed to read file #%i (Error=%lu): %s\n", handle, GetLastError(), GetErrorStr(GetLastError())); + rv = -1; + } + } +#else + DBGMSGV("read file #%i @ 0x%X, %i bytes\n", handle, dma - RAM, redir_rec_len); + rv = read(handle, dma, redir_rec_len); + if (rv == -1) + DBGMSGV("failed to read file #%i (errno=%lu): %s\n", handle, errno, strerror(errno)); +#endif + + // read() can corrupt buffer area following data read if length + // of data read is less than buffer. Clean it up. + if (rv == -1) + memset(dma, 0x00, redir_rec_len); + else + memset(dma + rv, 0x00, redir_rec_len - rv); + + zxlseek(handle, offs, SEEK_SET); + + redir_put_fcb_pos(fcb, offs); + + if (rv < 0) FCBRET(redir_xlt_err()); /* Error */ + + rd_len = ((rv + 127) / 128) * 128; + + /* PMO: pad partial sector to 128 bytes, even if EOF reached in multi sector read */ + for (n = rv; n < rd_len; n++) dma[n] = 0x1A; /* pad last read to 128 boundary with 0x1A*/ + + if (rd_len < redir_rec_len) /* eof */ + { + rd_len = rd_len * 2; /* rd_len already sector * 128, so * 2 to move to High byte */ + DBGMSGV("Ret: 0x%x\n", rd_len | 1); + FCBRET(rd_len | 1); /* eof */ + } + + FCBRET(0); +} + +cpm_word fcb_randwr(cpm_byte* fcb, cpm_byte* dma) +{ + int handle; + int rv; + dword offs = redir_rd24(fcb + 0x21) * 128; + dword len; + + FCBENT(fcb); + + if ((handle = redir_verify_fcb(fcb)) < 0) FCBRET(9); /* Invalid FCB */ + /* Software write-protection */ + if (redir_ro_fcb(fcb)) FCBRET(0x02FF); + + if (zxlseek(handle, offs, SEEK_SET) < 0) FCBRET(6); /* bad record no. */ + +#ifdef _WIN32 + { + BOOL b; + DBGMSGV("write file #%i @ 0x%X, %i bytes\n", handle, dma - RAM, redir_rec_len); + b = WriteFile((HANDLE)handle, dma, redir_rec_len, (unsigned long*)(&rv), NULL); + if (!b) + { + DBGMSGV("failed to write file #%i (Error=%lu): %s\n", handle, GetLastError(), GetErrorStr(GetLastError())); + rv = -1; + } + } +#else + DBGMSGV("write file #%i @ 0x%X, %i bytes\n", handle, dma - RAM, redir_rec_len); + rv = write(handle, dma, redir_rec_len); + if (rv == -1) + DBGMSGV("failed to write file #%i (errno=%lu): %s\n", handle, errno, strerror(errno)); +#endif + zxlseek(handle, offs, SEEK_SET); + redir_put_fcb_pos(fcb, offs); + + if (rv < 0) FCBRET(redir_xlt_err()); /* Error */ + /* Update the file length */ + len = redir_rd32(fcb + LENGTH_OFFSET); + /* PMO: Bug fix, account for the data just written */ + if (len < offs + rv) { + redir_wr32(fcb + LENGTH_OFFSET, offs + rv); + /* WBW: Not actually a bug. Causes problems w/ GENCPM */ + // fcb[0x20] = (offs + rv) % 256; + } + + if (rv < redir_rec_len) FCBRET(1); /* disk full */ + FCBRET(0); +} + +#ifndef OLD_RANDWZ +/* PMO: + * Under CP/M for random write with zero fill, the zero fill is only done for a newly allocated + * block and not fill from previous end of file + * to implement this fully would require tracking sparse files and filling to block + * boundaries. + * As the default for POSIX/Windows lseek is to effectively zero fill and for modern hard disks + * the additional space used is small compared to capacity, fcb_randwz is the same as fcb_randwr + * Note zero padding to the end of the block will be done automatically as required when data is + * written to later offsets + */ + /* Write random with 0 fill */ +cpm_word fcb_randwz(cpm_byte* fcb, cpm_byte* dma) +{ + FCBENT(fcb); + FCBRET(fcb_randwr(fcb, dma)); +} +#else +/* Write random with 0 fill */ +cpm_word fcb_randwz(cpm_byte* fcb, cpm_byte* dma) +{ + dword offs, len; + int handle, rl, rv; + cpm_byte zerorec[128]; + + FCBENT(fcb); + + if ((handle = redir_verify_fcb(fcb)) < 0) FCBRET(9); /* Invalid FCB */ + /* Software write-protection */ + if (redir_ro_fcb(fcb)) FCBRET(0x02FF); + + offs = redir_rd24(fcb + 0x21) * 128; + len = redir_rd32(fcb + LENGTH_OFFSET); + + redir_wr32(fcb + LENGTH_OFFSET, offs); + + memset(zerorec, 0, sizeof(zerorec)); + + while (len < offs) + { + memset(zerorec, 0, sizeof(zerorec)); + + rl = sizeof(zerorec); + if ((offs - len) < sizeof(zerorec)) rl = offs - len; +#ifdef _WIN32 + { + BOOL b; + DBGMSGV("write file #%i (zeroes), %i bytes\n", handle, redir_rec_len); + b = WriteFile((HANDLE)handle, zerorec, rl, (unsigned long*)(&rv), NULL); + if (!b) + { + DBGMSGV("failed to write file #%i (Error=%lu): %s\n", handle, GetLastError(), GetErrorStr(GetLastError())); + rv = -1; + } + } +#else + DBGMSGV("write file #%i (zeroes), %i bytes\n", handle, redir_rec_len); + rv = write(handle, zerorec, rl); + if (rv == -1) + DBGMSGV("failed to write file #%i (errno=%lu): %s\n", handle, errno, strerror(errno)); +#endif + if (rv >= 0) len += rv; + + if (rv < rl) + { + redir_wr32(fcb + LENGTH_OFFSET, len); + FCBRET(redir_xlt_err()); + } + } + redir_wr32(fcb + LENGTH_OFFSET, offs); + + FCBRET(fcb_randwr(fcb, dma)); +} +#endif + +cpm_word fcb_tell(cpm_byte* fcb) +{ + int handle; + off_t rv; + + FCBENT(fcb); + + if ((handle = redir_verify_fcb(fcb)) < 0) FCBRET(9); /* Invalid FCB */ + + rv = zxlseek(handle, 0, SEEK_CUR); + + if (rv < 0) FCBRET(0xFF); + + rv = rv >> 7; + fcb[0x21] = rv & 0xFF; + fcb[0x22] = (rv >> 8) & 0xFF; + fcb[0x23] = (rv >> 16) & 0xFF; + FCBRET(0); +} + +cpm_word fcb_stat(cpm_byte* fcb) +{ + char fname[CPM_MAXPATH]; + struct stat st; + int rv; + + FCBENT(fcb); + + /* Don't support ambiguous filenames */ + if (redir_fcb2unix(fcb, fname)) FCBRET(0x09FF); + + DBGMSGV("stat '%s', FCB=%0.4X\n", fname, fcb - RAM); + rv = stat(fname, &st); + if (rv < 0) + { + DBGMSGV("failed to stat file '%s' (errno=%lu): %s\n", fname, errno, strerror(errno)); + FCBRET(0xFF); + } + + redir_wr24(fcb + 0x21, (st.st_size + 127) / 128); + + FCBRET(0); +} + +cpm_word fcb_multirec(cpm_byte rc) +{ + if (rc < 1 || rc > 128) return 0xFF; + + redir_rec_multi = rc; + redir_rec_len = 128 * rc; + DBGMSGV("Set read/write to %d bytes\n", redir_rec_len); + return 0; +} + +cpm_word fcb_date(cpm_byte* fcb) +{ + char fname[CPM_MAXPATH]; + struct stat st; + int rv; + + FCBENT(fcb); + + /* as this function will overwrite the fcb info used by ZXCC + * release any file associated with it + */ + releaseFCB(fcb); + /* Don't support ambiguous filenames */ + if (redir_fcb2unix(fcb, fname)) FCBRET(0x09FF); + + DBGMSGV("stat '%s', FCB=%0.4X\n", fname, fcb - RAM); + rv = stat(fname, &st); + if (rv < 0) + { + DBGMSGV("failed to stat file '%s' (errno=%lu): %s\n", fname, errno, strerror(errno)); + FCBRET(0xFF); + } + + redir_wr32(fcb + 0x18, redir_cpmtime(st.st_atime)); + redir_wr32(fcb + 0x1C, redir_cpmtime(st.st_ctime)); + + fcb[0x0C] = redir_cpm_pwmode(redir_drdos_get_rights(fname)); + FCBRET(0); +} + +cpm_word fcb_trunc(cpm_byte* fcb, cpm_byte* dma) +{ + char fname[CPM_MAXPATH]; + dword offs = redir_rd24(fcb + 0x21) * 128; + + FCBENT(fcb); + + releaseFCB(fcb); /* CP/M requires truncated files be closed */ + /* Don't support ambiguous filenames */ + if (redir_fcb2unix(fcb, fname)) FCBRET(0x09FF); + + /* Software write-protection */ + if (redir_ro_fcb(fcb)) FCBRET(0x02FF); + + releaseFile(fname); /* after truncate open files are invalid */ + redir_log_fcb(fcb); + + DBGMSGV("truncate file '%s' at %lu\n", fname, offs); + if (truncate(fname, offs)) + { + DBGMSGV("failed to truncate file '%s' (errno=%lu): %s\n", fname, errno, strerror(errno)); + if (redir_password_error()) + { + redir_password_append(fname, dma); + DBGMSGV("truncate file '%s' w/ password at %lu\n", fname, offs); + if (!truncate(fname, offs)) FCBRET(0); + DBGMSGV("failed to truncate file '%s' (errno=%lu): %s\n", fname, errno, strerror(errno)); + } + FCBRET(redir_xlt_err()); + } + FCBRET(0); +} + +cpm_word fcb_sdate(cpm_byte* fcb, cpm_byte* dma) +{ + char fname[CPM_MAXPATH]; + struct utimbuf buf; + + FCBENT(fcb); + + buf.actime = redir_unixtime(dma); + buf.modtime = redir_unixtime(dma + 4); + + /* Don't support ambiguous filenames */ + if (redir_fcb2unix(fcb, fname)) FCBRET(0x09FF); + + /* Software write-protection */ + if (redir_ro_fcb(fcb)) FCBRET(0x02FF); + + redir_log_fcb(fcb); + + DBGMSGV("utime file '%s'\n", fname); + if (utime(fname, &buf)) + { + DBGMSGV("failed to utime file '%s' (Error=%lu): %s\n", fname, errno, strerror(errno)); + if (redir_password_error()) + { + redir_password_append(fname, dma); + DBGMSGV("utime file '%s' w/ password\n", fname); + if (!utime(fname, &buf)) FCBRET(0); + DBGMSGV("failed to utime file '%s' (Error=%lu): %s\n", fname, errno, strerror(errno)); + } + FCBRET(redir_xlt_err()); + } + FCBRET(0); +} + +cpm_word fcb_chmod(cpm_byte* fcb, cpm_byte* dma) +{ + char fname[CPM_MAXPATH]; + struct stat st; + int handle, wlen, omode; + long offs, newoffs; + cpm_byte zero[128]; + + FCBENT(fcb); + + /* Don't support ambiguous filenames */ + if (redir_fcb2unix(fcb, fname)) FCBRET(0x09FF); + + /* Software write-protection */ + if (redir_ro_fcb(fcb)) FCBRET(0x02FF); + + redir_log_fcb(fcb); + + DBGMSGV("stat '%s', FCB=%0.4X\n", fname, fcb - RAM); + if (stat(fname, &st)) + { + DBGMSGV("failed to stat file '%s' (errno=%lu): %s\n", fname, errno, strerror(errno)); + FCBRET(redir_xlt_err()); + } + +#ifdef __MSDOS__ + omode = 0; + if (fcb[9] & 0x80) omode |= 1; + if (fcb[10] & 0x80) omode |= 4; + if (!(fcb[11] & 0x80)) omode |= 0x20; + + if (_chmod(fname, 1, omode) < 0) + { + if (redir_password_error()) + { + redir_password_append(fname, dma); + if (_chmod(fname, 1, omode) >= 0) FCBRET(0); + } + FCBRET(redir_xlt_err()); + } +#elif defined (_WIN32) + omode = 0; + + if (fcb[9] & 0x80) omode |= FILE_ATTRIBUTE_READONLY; + if (fcb[10] & 0x80) omode |= FILE_ATTRIBUTE_SYSTEM; + if (!(fcb[11] & 0x80)) omode |= FILE_ATTRIBUTE_ARCHIVE; + + if (!omode) omode = FILE_ATTRIBUTE_NORMAL; + + { + BOOL b; + DBGMSGV("set attributes file '%s', FCB=%0.4X\n", fname, fcb - RAM); + b = SetFileAttributes(fname, omode); + if (!b) + { + DBGMSGV("failed to set attributes file '%s' (Error=%lu): %s\n", fname, GetLastError(), GetErrorStr(GetLastError())); + FCBRET(redir_xlt_err()); + } + } +#else + omode = st.st_mode; + if (fcb[9] & 0x80) /* Read-only */ + { + st.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH); + } + else st.st_mode |= S_IWUSR; + + if (omode != st.st_mode) + { + DBGMSGV("chmod '%s', FCB=%0.4X\n", fname, fcb - RAM); + if (chmod(fname, st.st_mode)) + { + DBGMSGV("failed to chmod file '%s' (errno=%lu): %s\n", fname, errno, strerror(errno)); + FCBRET(redir_xlt_err()); + } + } +#endif + + if (fcb[6] & 0x80) /* Set exact size */ + { + DBGMSGV("stat '%s', FCB=%0.4X\n", fname, fcb - RAM); + if (stat(fname, &st)) + { + DBGMSGV("failed to stat file '%s' (errno=%lu): %s\n", fname, errno, strerror(errno)); + FCBRET(redir_xlt_err()); + } + + releaseFCB(fcb); /* cpm required file to be closed so release FCB */ + releaseFile(fname); /* also make sure no other handles open to file */ + DBGMSGV("open '%s', FCB=%0.4X\n", fname, fcb - RAM); + handle = open(fname, O_RDWR | O_BINARY); + if (handle < 0) + { + DBGMSGV("failed to open file '%s' (errno=%lu): %s\n", fname, errno, strerror(errno)); + FCBRET(redir_xlt_err()); + } + DBGMSGV("file '%s' opened at #%i\n", fname, handle); + + newoffs = offs = ((st.st_size + 127) / 128) * 128; + if (fcb[0x20] & 0x7F) + { + newoffs -= fcb[0x20] & 0x7f; + //newoffs -= (0x80 - (fcb[0x20] & 0x7F)); + } + if (newoffs == st.st_size) + { + ; /* Nothing to do! */ + } + else if (newoffs < st.st_size) + { + DBGMSGV("ftruncate file #%i at %lu\n", handle, newoffs); + if (ftruncate(handle, newoffs)) + { + DBGMSGV("failed to ftruncate file #%i (errno=%lu): %s\n", handle, errno, strerror(errno)); + close(handle); + FCBRET(redir_xlt_err()); + } + } + else while (newoffs > st.st_size) + { + wlen = newoffs - st.st_size; + if (wlen > 0x80) wlen = 0x80; + memset(zero, 0x1A, sizeof(zero)); + DBGMSGV("write file #%i (zeroes), %lu bytes\n", handle, wlen); + if (write(handle, zero, wlen) < wlen) + { + DBGMSGV("failed to write file #%i (errno=%lu): %s\n", handle, errno, strerror(errno)); + close(handle); + FCBRET(redir_xlt_err()); + } + st.st_size += wlen; + } + close(handle); + } + FCBRET(0); +} + +cpm_word fcb_setpwd(cpm_byte* fcb, cpm_byte* dma) +{ +#ifdef __MSDOS__ + char fname[CPM_MAXPATH]; + cpm_word rv; + + FCBENT(fcb); + + /* Don't support ambiguous filenames */ + if (redir_fcb2unix(fcb, fname)) FCBRET(0x09FF); + + /* Software write-protection */ + if (redir_ro_fcb(fcb)) FCBRET(0x02FF); + + redir_log_fcb(fcb); + + rv = redir_drdos_put_rights(fname, dma, redir_drdos_pwmode(fcb[0x0c])); + if (rv || !(fcb[0x0c] & 1)) FCBRET(rv); + FCBRET(redir_drdos_put_rights(fname, dma, redir_drdos_pwmode(fcb[0x0c]) | 0x8000)); +#else + FCBRET(0xFF); /* Unix doesn't do this */ +#endif +} + +cpm_word fcb_getlbl(cpm_byte drv) +{ + DBGMSG("fcb_getlbl()\n"); +#ifdef __MSDOS__ + if (redir_drdos) return 0xA1; /* Supports passwords & Update stamps */ + return 0x21; /* Update stamps only */ +#else + return 0x61; /* Update & Access stamps */ +#endif +} + +cpm_word fcb_setlbl(cpm_byte* fcb, cpm_byte* dma) +{ + /* I am not letting CP/M fiddle with the host's FS settings - even if they + * could be altered, which they mostly can't. */ + + return 0x03FF; +} + +cpm_word fcb_defpwd(cpm_byte* pwd) +{ +#ifdef __MSDOS__ + union REGS r; + struct SREGS s; + + if (pwd[0] == 0 || pwd[0] == ' ') + { + redir_passwd[0] = 0; + } + else memcpy(redir_passwd, pwd, 8); + if (redir_drdos) + { + dosmemput(pwd, 8, __tb); + r.w.ax = 0x4454; + r.w.dx = __tb & 0x0F; + s.ds = __tb >> 4; + intdosx(&r, &r, &s); + } + +#endif + return 0; +} diff --git a/Tools/unix/zxcc/cpmredir.h b/Tools/unix/zxcc/cpmredir.h new file mode 100644 index 00000000..40810159 --- /dev/null +++ b/Tools/unix/zxcc/cpmredir.h @@ -0,0 +1,150 @@ +/* + CPMREDIR: CP/M filesystem redirector + Copyright (C) 1998, John Elliott + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + This file holds the public interface to CPMREDIR. +*/ + +#ifndef CPMREDIR_H_INCLUDED + +#define CPMREDIR_H_INCLUDED 16-11-1998 + +/* The "cpm_byte" must be exactly 8 bits. + The "cpm_word" must be exactly 16 bits. */ + +typedef unsigned char cpm_byte; +typedef unsigned short cpm_word; + +/* Maximum length of a directory path */ +#ifdef _POSIX_PATH_MAX + #define CPM_MAXPATH _POSIX_PATH_MAX +#else + #ifdef _MAX_PATH + #define CPM_MAXPATH _MAX_PATH + #else + #define CPM_MAXPATH 260 + #endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + /* Initialise this library. Call this function first. + * + * Returns 0 if failed to initialise. + */ + int fcb_init(void); + + /* Deinitialise the library. */ + + void fcb_deinit(void); + + /* Translate a name from the host FS to a CP/M name. This will (if necessary) + * create a mapping between a CP/M drive and a host directory path. + * + * CP/M drives A: to O: can be mapped in this way. P: is always the current + * drive. + * + */ + + void xlt_name(char* localname, char* cpmname); + + /* It is sometimes convenient to set some fixed mappings. This will create + * a mapping for a given directory. + * Pass drive = -1 for "first available", or 0-15 for A: to P: + * Returns 1 if OK, 0 if requested drive not available. + * + * NB: It is important that the localname should have a trailing + * directory separator! + */ + + int xlt_map(int drive, char* localdir); + + /* + * This revokes a mapping. No check is made whether CP/M has files open + * on the drive or not. + */ + + int xlt_umap(int drive); + + /* Find out if a drive is mapped, and if so to what directory */ + + char* xlt_getcwd(int drive); + + /* BDOS functions. Eventually this should handle all disc-related BDOS + * functions. + * + * I am assuming that your emulator has the CP/M RAM in its normal address + * space, accessible as a range 0-64k. If this is not the case + * (eg: you are emulating banked memory, or using a segmented architecture) + * you will have to use "copy in and copy out" techniques. The "fcb" area + * must be 36 bytes long; the "dma" area should be 128 * the value set + * in fcb_multirec() [default is 1, so 128 bytes]. + * + */ + + cpm_byte fcb_reset(void); /* 0x0D */ + cpm_word fcb_drive(cpm_byte drv); /* 0x0E */ + cpm_word fcb_open(cpm_byte* fcb, cpm_byte* dma); /* 0x0F */ + cpm_word fcb_close(cpm_byte* fcb); /* 0x10 */ + cpm_word fcb_find1(cpm_byte* fcb, cpm_byte* dma); /* 0x11 */ + cpm_word fcb_find2(cpm_byte* fcb, cpm_byte* dma); /* 0x12 */ + cpm_word fcb_unlink(cpm_byte* fcb, cpm_byte* dma); /* 0x13 */ + cpm_word fcb_read(cpm_byte* fcb, cpm_byte* dma); /* 0x14 */ + cpm_word fcb_write(cpm_byte* fcb, cpm_byte* dma); /* 0x15 */ + cpm_word fcb_creat(cpm_byte* fcb, cpm_byte* dma); /* 0x16 */ + cpm_word fcb_rename(cpm_byte* fcb, cpm_byte* dma); /* 0x17 */ + cpm_word fcb_logvec(void); /* 0x18 */ + cpm_byte fcb_getdrv(void); /* 0x19 */ + /* DMA is a parameter to routines, not a separate call */ + cpm_word fcb_getalv(cpm_byte* alv, cpm_word max); /* 0x1B */ + /* Get alloc vector: caller must provide space and say how big it is. */ + cpm_word fcb_rodisk(void); /* 0x1C */ + cpm_word fcb_rovec(void); /* 0x1D */ + cpm_word fcb_chmod(cpm_byte* fcb, cpm_byte* dma); /* 0x1E */ + cpm_word fcb_getdpb(cpm_byte* dpb); /* 0x1F */ + cpm_byte fcb_user(cpm_byte usr); /* 0x20 */ + cpm_word fcb_randrd(cpm_byte* fcb, cpm_byte* dma); /* 0x21 */ + cpm_word fcb_randwr(cpm_byte* fcb, cpm_byte* dma); /* 0x22 */ + cpm_word fcb_stat(cpm_byte* fcb); /* 0x23 */ + cpm_word fcb_tell(cpm_byte* fcb); /* 0x24 */ + cpm_word fcb_resro(cpm_word bitmap); /* 0x25 */ + /* Access Drives and Free Drives are not supported. */ + cpm_word fcb_randwz(cpm_byte* fcb, cpm_byte* dma); /* 0x28 */ + /* Record locking calls not supported (though they could be) */ + cpm_word fcb_multirec(cpm_byte rc); /* 0x2C */ + /* Set hardware error action must be done by caller */ + cpm_word fcb_dfree(cpm_byte drive, cpm_byte* dma); /* 0x2E */ + cpm_word fcb_sync(cpm_byte flag); /* 0x30 */ + cpm_word fcb_purge(void); /* 0x62 */ + cpm_word fcb_trunc(cpm_byte* fcb, cpm_byte* dma); /* 0x63 */ + cpm_word fcb_setlbl(cpm_byte* fcb, cpm_byte* dma); /* 0x64 */ + cpm_word fcb_getlbl(cpm_byte drive); /* 0x65 */ + cpm_word fcb_date(cpm_byte* fcb); /* 0x66 */ + cpm_word fcb_setpwd(cpm_byte* fcb, cpm_byte* dma); /* 0x67 */ + cpm_word fcb_defpwd(cpm_byte* pwd); /* 0x6A */ + cpm_word fcb_sdate(cpm_byte* fcb, cpm_byte* dma); /* 0x74 */ + cpm_word fcb_parse(char* txt, cpm_byte* fcb); /* 0x98 */ + + /* fcb_parse returns length of filename parsed, 0 if EOL, 0xFFFF if error */ + +#ifdef __cplusplus +} +#endif + +#endif /* def CPMREDIR_H_INCLUDED */ diff --git a/Tools/unix/zxcc/dirent.c b/Tools/unix/zxcc/dirent.c new file mode 100644 index 00000000..1cdce1cb --- /dev/null +++ b/Tools/unix/zxcc/dirent.c @@ -0,0 +1,122 @@ +/* + + Implementation of POSIX directory browsing functions and types for Win32. + + Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com) + History: Created March 1997. Updated June 2003 and July 2012. + Rights: See end of file. + +*/ +#pragma warning(disable : 4996) +#include "dirent.h" +#include +#include +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + + DIR* opendir(const char* name) { + DIR* dir = 0; + + if (name && name[0]) { + size_t base_length = strlen(name); + const char* all = /* search pattern must end with suitable wildcard */ + strchr("/\\", name[base_length - 1]) ? "*" : "/*"; + + if ((dir = (DIR*)malloc(sizeof * dir)) != 0 && + (dir->name = (char*)malloc(base_length + strlen(all) + 1)) != 0) { + strcat(strcpy(dir->name, name), all); + + if ((dir->handle = + (handle_type)_findfirst(dir->name, &dir->info)) != -1) { + dir->result.d_name = 0; + } + else /* rollback */ + { + free(dir->name); + free(dir); + dir = 0; + } + } + else /* rollback */ + { + free(dir); + dir = 0; + errno = ENOMEM; + } + } + else { + errno = EINVAL; + } + + return dir; + } + + int closedir(DIR* dir) { + int result = -1; + + if (dir) { + if (dir->handle != -1) { + result = _findclose(dir->handle); + } + + free(dir->name); + free(dir); + } + + if (result == -1) /* map all errors to EBADF */ + { + errno = EBADF; + } + + return result; + } + + struct dirent* readdir(DIR* dir) { + struct dirent* result = 0; + + if (dir && dir->handle != -1) { + if (!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1) { + result = &dir->result; + result->d_name = dir->info.name; + } + } + else { + errno = EBADF; + } + + return result; + } + + void rewinddir(DIR* dir) { + if (dir && dir->handle != -1) { + _findclose(dir->handle); + dir->handle = (handle_type)_findfirst(dir->name, &dir->info); + dir->result.d_name = 0; + } + else { + errno = EBADF; + } + } + +#ifdef __cplusplus +} +#endif + +/* + + Copyright Kevlin Henney, 1997, 2003, 2012. All rights reserved. + + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose is hereby granted without fee, provided + that this copyright and permissions notice appear in all copies and + derivatives. + + This software is supplied "as is" without express or implied warranty. + + But that said, if there are any problems please get in touch. + +*/ \ No newline at end of file diff --git a/Tools/unix/zxcc/dirent.h b/Tools/unix/zxcc/dirent.h new file mode 100644 index 00000000..7db1a3ee --- /dev/null +++ b/Tools/unix/zxcc/dirent.h @@ -0,0 +1,58 @@ +#ifndef DIRENT_INCLUDED +#define DIRENT_INCLUDED + +/* + + Declaration of POSIX directory browsing functions and types for Win32. + + Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com) + History: Created March 1997. Updated June 2003. + Rights: See end of file. + +*/ + +#include /* _findfirst and _findnext set errno iff they return -1 */ + +#ifdef __cplusplus +extern "C" +{ +#endif + + struct dirent { + char *d_name; + }; + + typedef ptrdiff_t handle_type; /* C99's intptr_t not sufficiently portable */ + + typedef struct { + handle_type handle; /* -1 for failed rewind */ + struct _finddata_t info; + struct dirent result; /* d_name null iff first time */ + char *name; /* null-terminated char string */ + } DIR; + + DIR *opendir(const char *); + int closedir(DIR *); + struct dirent *readdir(DIR *); + void rewinddir(DIR *); + + /* + + Copyright Kevlin Henney, 1997, 2003. All rights reserved. + + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose is hereby granted without fee, provided + that this copyright and permissions notice appear in all copies and + derivatives. + + This software is supplied "as is" without express or implied warranty. + + But that said, if there are any problems please get in touch. + + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Tools/unix/zxcc/drdos.c b/Tools/unix/zxcc/drdos.c new file mode 100644 index 00000000..f62a3a5c --- /dev/null +++ b/Tools/unix/zxcc/drdos.c @@ -0,0 +1,236 @@ +/* + + CPMREDIR: CP/M filesystem redirector + Copyright (C) 1998, John Elliott + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + This file holds DRDOS-specific password code. +*/ + +#include "cpmint.h" + +cpm_word redir_drdos_pwmode(cpm_byte b) +{ + cpm_word mode = 0; + + if (b & 0x80) mode |= 0xddd; + if (b & 0x40) mode |= 0x555; + if (b & 0x20) mode |= 0x111; + + return mode; +} + +cpm_byte redir_cpm_pwmode(cpm_word w) +{ + cpm_byte mode = 0; + + if (w & 0x8) mode |= 0x80; + if (w & 0x4) mode |= 0x40; + if (w & 0x1) mode |= 0x20; + + return mode; +} + +#ifdef __MSDOS__ +#ifdef __GO32__ /* The GO32 extender doesn't understand DRDOS password + * functions, so these are done with __dpmi_int() rather + * than intdos() */ + +cpm_word redir_drdos_get_rights(char* path) +{ + __dpmi_regs r; + + if (!redir_drdos) return 0; + + redir_Msg("Rights for file %s: \n\r", path); + + dosmemput(path, strlen(path) + 1, __tb); + r.x.ax = 0x4302; + r.x.dx = __tb & 0x0F; + r.x.ds = (__tb) >> 4; + + __dpmi_int(0x21, &r); + + redir_Msg(" %04x \n\r", r.x.cx); + + if (r.x.flags & 1) return 0; + return r.x.cx; +} + + +cpm_word redir_drdos_put_rights(char* path, cpm_byte* dma, cpm_word rights) +{ + __dpmi_regs r; + + if (!redir_drdos) return 0; + + redir_Msg("Put rights for file %s: %04x %-8.8s %-8.8s\n\r", path, rights, dma, dma + 8); + + dosmemput(dma + 8, 8, __tb); /* Point DTA at password */ + r.x.ax = 0x1A00; + r.x.dx = (__tb & 0x0F); + r.x.ds = (__tb) >> 4; + __dpmi_int(0x21, &r); + + dosmemput(path, strlen(path) + 1, __tb + 0x10); + r.x.ax = 0x4303; /* Set rights */ + r.x.cx = rights; + r.x.dx = (__tb & 0x0F) + 0x10; + r.x.ds = (__tb) >> 4; + + __dpmi_int(0x21, &r); + + if (r.x.flags & 1) + { + redir_Msg(" Try 1 failed. Error %04x\n\r", r.x.ax); + if (redir_password_error()) + { + redir_password_append(path, dma); + + dosmemput(path, strlen(path) + 1, __tb + 0x10); + r.x.ax = 0x4303; /* Set rights */ + r.x.cx = rights; + r.x.dx = (__tb & 0x0F) + 0x10; + r.x.ds = (__tb) >> 4; + + __dpmi_int(0x21, &r); + if (!r.x.flags & 1) return 0; + if (redir_password_error()) return 0x7FF; + } + return 0xFF; + } + return 0; +} + +#else /* __GO32__ */ + +cpm_word redir_drdos_get_rights(char* path) +{ + union REGS r; + struct SREGS s; + + if (!redir_drdos) return 0; + + redir_Msg("Rights for file %s: \n\r", path); + + dosmemput(path, strlen(path) + 1, __tb); + r.w.ax = 0x4302; + r.w.dx = __tb & 0x0F; + s.ds = (__tb) >> 4; + + intdosx(&r, &r, &s); + + redir_Msg(" %04x \n\r", r.w.cx); + + if (r.w.cflag) return 0; + return r.w.cx; +} + + +cpm_word redir_drdos_put_rights(char* path, cpm_byte* dma, cpm_word rights) +{ + union REGS r; + struct SREGS s; + + if (!redir_drdos) return 0; + + redir_Msg("Put rights for file %s: %04x\n\r", path, rights); + + dosmemput(dma, 8, __tb); /* Point DTA at password */ + r.w.ax = 0x1A00; + r.w.dx = (__tb & 0x0F); + s.ds = (__tb) >> 4; + intdosx(&r, &r, &s); + + dosmemput(path, strlen(path) + 1, __tb + 0x10); + r.w.ax = 0x4303; /* Set rights */ + r.w.cx = rights; + r.w.dx = (__tb & 0x0F) + 0x10; + s.ds = (__tb) >> 4; + + intdosx(&r, &r, &s); + + if (r.w.cflag) + { + redir_Msg(" Try 1 failed. Error %04x \n\r", r.w.ax); + if (redir_password_error()) + { + redir_password_append(path, dma); + + dosmemput(path, strlen(path) + 1, __tb + 0x10); + r.w.ax = 0x4303; /* Set rights */ + r.w.cx = rights; + r.w.dx = (__tb & 0x0F) + 0x10; + s.ds = (__tb) >> 4; + + intdosx(&r, &r, &s); + if (!r.w.cflag) return 0; + } + return 0xFF; + } + return 0; +} + +#endif /* __GO32__ */ + + +cpm_word redir_password_error(void) +{ + union REGS r; + + if (!redir_drdos) return 0; + + r.w.ax = 0x5900; + r.w.bx = 0x0000; + + intdos(&r, &r); + + redir_Msg("Last error was: %04x\n", r.w.ax); + + if (r.w.ax == 0x56) return 1; /* Bad password */ + return 0; +} + + +void redir_password_append(char* s, cpm_byte* dma) +{ + int n, m; + + if (!redir_drdos) return; + + if (dma[0] == 0 || dma[0] == 0x20) return; + + strcat(s, ";"); + m = strlen(s); + + for (n = 0; n < 8; n++) + { + if (dma[n] == ' ') s[m] = 0; + else s[m] = dma[n]; + ++m; + } + s[m] = 0; + +} +#else /* __MSDOS__ */ +void redir_password_append(char* s, cpm_byte* dma) {} +cpm_word redir_password_error(void) { return 0; } +cpm_word redir_drdos_put_rights(char* path, cpm_byte* dma, cpm_word rights) +{ + return 0; +} +cpm_word redir_drdos_get_rights(char* path) { return 0; } +#endif /* __MSDOS__ */ diff --git a/Tools/unix/zxcc/edops.h b/Tools/unix/zxcc/edops.h new file mode 100644 index 00000000..433f0cb2 --- /dev/null +++ b/Tools/unix/zxcc/edops.h @@ -0,0 +1,572 @@ +/* Emulations of the ED operations of the Z80 instruction set. + * Copyright (C) 1994 Ian Collier. + * + * 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. + */ + +#define input(var) { unsigned short u;\ + var=u=in(tstates,b,c);\ + tstates+=u>>8;\ + f=(f&1)|(var&0xa8)|((!var)<<6)|parity(var);\ + } +#define sbchl(x) { unsigned short z=(x);\ + unsigned long t=(hl-z-cy)&0x1ffff;\ + f=((t>>8)&0xa8)|(t>>16)|2|\ + (((hl&0xfff)<(z&0xfff)+cy)<<4)|\ + (((hl^z)&(hl^t)&0x8000)>>13)|\ + ((!(t&0xffff))<<6)|2;\ + l=t;\ + h=t>>8;\ + } + +#define adchl(x) { unsigned short z=(x);\ + unsigned long t=hl+z+cy;\ + f=((t>>8)&0xa8)|(t>>16)|\ + (((hl&0xfff)+(z&0xfff)+cy>0xfff)<<4)|\ + (((~hl^z)&(hl^t)&0x8000)>>13)|\ + ((!(t&0xffff))<<6)/*|2*/;\ + l=t;\ + h=t>>8;\ + } +/* [JCE] The "|2" should not be there, at least according to my tests on + * a PCW16. The PCW16's ADC always resets that bit. */ + + +#define neg (a=-a,\ + f=(a&0xa8)|((!a)<<6)|(((a&15)>0)<<4)|((a==128)<<2)|2|(a>0)) + +{ + unsigned char op=fetch(pc); + pc++; + radjust++; + switch(op){ +instr(0x40,8); + input(b); +endinstr; + +instr(0x41,8); + tstates+=out(tstates,b,c,b); +endinstr; + +instr(0x42,11); + sbchl(bc); +endinstr; + +instr(0x43,16); + {unsigned short addr=fetch2(pc); + pc+=2; + store2b(addr,b,c); + } +endinstr; + +instr(0x44,4); + neg; +endinstr; + +instr(0x45,4); + iff1=iff2; + ret; +endinstr; + +instr(0x46,4); + im=0; +endinstr; + +instr(0x47,5); + i=a; +endinstr; + +instr(0x48,8); + input(c); +endinstr; + +instr(0x49,8); + tstates+=out(tstates,b,c,c); +endinstr; + +instr(0x4a,11); + adchl(bc); +endinstr; + +instr(0x4b,16); + {unsigned short addr=fetch2(pc); + pc+=2; + c=fetch(addr); + b=fetch(addr+1); + } +endinstr; + +instr(0x4c,4); + neg; +endinstr; + +instr(0x4d,4); + ret; +endinstr; + +instr(0x4e,4); + im=1; +endinstr; + +instr(0x4f,5); + r=a; + radjust=r; +endinstr; + +instr(0x50,8); + input(d); +endinstr; + +instr(0x51,8); + tstates+=out(tstates,b,c,d); +endinstr; + +instr(0x52,11); + sbchl(de); +endinstr; + +instr(0x53,16); + {unsigned short addr=fetch2(pc); + pc+=2; + store2b(addr,d,e); + } +endinstr; + +instr(0x54,4); + neg; +endinstr; + +instr(0x55,4); + ret; +endinstr; + +instr(0x56,4); + im=2; +endinstr; + +instr(0x57,5); + a=i; + f=(f&1)|(a&0xa8)|((!a)<<6)|(iff2<<2); +endinstr; + +instr(0x58,8); + input(e); +endinstr; + +instr(0x59,8); + tstates+=out(tstates,b,c,e); +endinstr; + +instr(0x5a,11); + adchl(de); +endinstr; + +instr(0x5b,16); + {unsigned short addr=fetch2(pc); + pc+=2; + e=fetch(addr); + d=fetch(addr+1); + } +endinstr; + +instr(0x5c,4); + neg; +endinstr; + +instr(0x5d,4); + ret; +endinstr; + +instr(0x5e,4); + im=3; +endinstr; + +instr(0x5f,5); + r=(r&0x80)|(radjust&0x7f); + a=r; + f=(f&1)|(a&0xa8)|((!a)<<6)|(iff2<<2); +endinstr; + +instr(0x60,8); + input(h); +endinstr; + +instr(0x61,8); + tstates+=out(tstates,b,c,h); +endinstr; + +instr(0x62,11); + sbchl(hl); +endinstr; + +instr(0x63,16); + {unsigned short addr=fetch2(pc); + pc+=2; + store2b(addr,h,l); + } +endinstr; + +instr(0x64,4); + neg; +endinstr; + +instr(0x65,4); + ret; +endinstr; + +instr(0x66,4); + im=0; +endinstr; + +instr(0x67,14); + {unsigned char t=fetch(hl); + unsigned char u=(a<<4)|(t>>4); + a=(a&0xf0)|(t&0x0f); + store(hl,u); + f=(f&1)|(a&0xa8)|((!a)<<6)|parity(a); + } +endinstr; + +instr(0x68,8); + input(l); +endinstr; + +instr(0x69,8); + tstates+=out(tstates,b,c,l); +endinstr; + +instr(0x6a,11); + adchl(hl); +endinstr; + +instr(0x6b,16); + {unsigned short addr=fetch2(pc); + pc+=2; + l=fetch(addr); + h=fetch(addr+1); + } +endinstr; + +instr(0x6c,4); + neg; +endinstr; + +instr(0x6d,4); + ret; +endinstr; + +instr(0x6e,4); + im=1; +endinstr; + +instr(0x6f,5); + {unsigned char t=fetch(hl); + unsigned char u=(a&0x0f)|(t<<4); + a=(a&0xf0)|(t>>4); + store(hl,u); + f=(f&1)|(a&0xa8)|((!a)<<6)|parity(a); + } +endinstr; + +instr(0x70,8); + {unsigned char x; + input(x); + store(hl,x); + } +endinstr; + +instr(0x71,8); + {unsigned char x=fetch(hl); + tstates+=out(tstates,b,c,x); + } +endinstr; + +instr(0x72,11); + sbchl(sp); +endinstr; + +instr(0x73,16); + {unsigned short addr=fetch2(pc); + pc+=2; + store2(addr,sp); + } +endinstr; + +instr(0x74,4); + neg; +endinstr; + +instr(0x75,4); + ret; +endinstr; + +instr(0x76,4); + im=2; +endinstr; + +instr(0x78,8); + input(a); +endinstr; + +instr(0x79,8); + tstates+=out(tstates,b,c,a); +endinstr; + +instr(0x7a,11); + adchl(sp); +endinstr; + +instr(0x7b,16); + {unsigned short addr=fetch2(pc); + pc+=2; + sp=fetch2(addr); + } +endinstr; + +instr(0x7c,4); + neg; +endinstr; + +instr(0x7d,4); + ret; +endinstr; + +instr(0x7e,4); + im=3; +endinstr; + +instr(0xa0,12); + {unsigned char x=fetch(hl); + store(de,x); + if(!++l)h++; + if(!++e)d++; + if(!c--)b--; + f=(f&0xc1)|(x&0x28)|(((b|c)>0)<<2); + } +endinstr; + +instr(0xa1,12); + {unsigned char carry=cy; + cpa(fetch(hl)); + if(!++l)h++; + if(!c--)b--; + f=(f&0xfa)|carry|(((b|c)>0)<<2); + } +endinstr; + +instr(0xa2,12); + {unsigned short t=in(tstates,b,c); + store(hl,t); + tstates+=t>>8; + if(!++l)h++; + b--; + f=(b&0xa8)|((b==0)<<6)|2|((parity(b)^c)&4); + } +endinstr; + +instr(0xa3,12); /* I can't determine the correct flags outcome for the + block OUT instructions. Spec says that the carry + flag is left unchanged and N is set to 1, but that + doesn't seem to be the case... */ + {unsigned char x=fetch(hl); + tstates+=out(tstates,b,c,x); + if(!++l)h++; + b--; + f=(f&1)|0x12|(b&0xa8)|((b==0)<<6); + } +endinstr; + +instr(0xa8,12); + {unsigned char x=fetch(hl); + store(de,x); + if(!l--)h--; + if(!e--)d--; + if(!c--)b--; + f=(f&0xc1)|(x&0x28)|(((b|c)>0)<<2); + } +endinstr; + +instr(0xa9,12); + {unsigned char carry=cy; + cpa(fetch(hl)); + if(!l--)h--; + if(!c--)b--; + f=(f&0xfa)|carry|(((b|c)>0)<<2); + } +endinstr; + +instr(0xaa,12); + {unsigned short t=in(tstates,b,c); + store(hl,t); + tstates+=t>>8; + if(!l--)h--; + b--; + f=(b&0xa8)|((b==0)<<6)|2|((parity(b)^c^4)&4); + } +endinstr; + +instr(0xab,12); + {unsigned char x=fetch(hl); + tstates+=out(tstates,b,c,x); + if(!l--)h--; + b--; + f=(f&1)|0x12|(b&0xa8)|((b==0)<<6); + } +endinstr; + +/* Note: the Z80 implements "*R" as "*" followed by JR -2. No reason + to change this... */ + +instr(0xb0,12); + {unsigned char x=fetch(hl); + store(de,x); + if(!++l)h++; + if(!++e)d++; + if(!c--)b--; + f=(f&0xc1)|(x&0x28)|(((b|c)>0)<<2); + if(b|c)pc-=2,tstates+=5; + } +endinstr; + +instr(0xb1,12); + {unsigned char carry=cy; + cpa(fetch(hl)); + if(!++l)h++; + if(!c--)b--; + f=(f&0xfa)|carry|(((b|c)>0)<<2); + if((f&0x44)==4)pc-=2,tstates+=5; + } +endinstr; + +instr(0xb2,12); + {unsigned short t=in(tstates,b,c); + store(hl,t); + tstates+=t>>8; + if(!++l)h++; + b--; + f=(b&0xa8)|((b==0)<<6)|2|((parity(b)^c)&4); + if(b)pc-=2,tstates+=5; + } +endinstr; + +instr(0xb3,12); + {unsigned char x=fetch(hl); + tstates+=out(tstates,b,c,x); + if(!++l)h++; + b--; + f=(f&1)|0x12|(b&0xa8)|((b==0)<<6); + if(b)pc-=2,tstates+=5; + } +endinstr; + +instr(0xb8,12); + {unsigned char x=fetch(hl); + store(de,x); + if(!l--)h--; + if(!e--)d--; + if(!c--)b--; + f=(f&0xc1)|(x&0x28)|(((b|c)>0)<<2); + if(b|c)pc-=2,tstates+=5; + } +endinstr; + +instr(0xb9,12); + {unsigned char carry=cy; + cpa(fetch(hl)); + if(!l--)h--; + if(!c--)b--; + f=(f&0xfa)|carry|(((b|c)>0)<<2); + if((f&0x44)==4)pc-=2,tstates+=5; + } +endinstr; + +instr(0xba,12); + {unsigned short t=in(tstates,b,c); + store(hl,t); + tstates+=t>>8; + if(!l--)h--; + b--; + f=(b&0xa8)|((b==0)<<6)|2|((parity(b)^c^4)&4); + if(b)pc-=2,tstates+=5; + } +endinstr; + +instr(0xbb,12); + {unsigned char x=fetch(hl); + tstates+=out(tstates,b,c,x); + if(!l--)h--; + b--; + f=(f&1)|0x12|(b&0xa8)|((b==0)<<6); + if(b)pc-=2,tstates+=5; + } +endinstr; + +/* XZ80 Pseudo-ops +instr(0xfb,4); + multiloader(hl,a); +endinstr; + +instr(0xfc,4); + { int ans; + stopwatch(); + ans=loader(pc,ix,de,a,cy); + if(ans>=0){ + if(ans==1)pc=0x0806; + else if(ans==2)f&=254; + else f|=1; + ix+=de; + d=e=0; + if(ans!=1)ret; + } + startwatch(1); + } +endinstr; + +instr(0xfd,4); + { int ans; + stopwatch(); + ans=saver(pc,ix,de,a); + if(ans>0)pc=0x0806; + else if(ans==0){ + ix+=de; + d=e=0; + ret; + } + startwatch(1); + } +endinstr; +*/ + +/* ZXCC pseudo-op */ +instr(0xfe, 4); +{ + /* Create copies of the registers here so we can take their addresses + * and not lose register optimisation in the rest of the CPU code */ + byte xa,xb,xc,xd,xe,xf,xxh,xxl; + word xp,xx,xy; + + xa = a; xb = b; xc = c; xd = d; xe = e; xf = f; xxh = h; xxl = l; + xp = pc; xx = ix; xy = iy; + + ed_fe(&xa,&xb,&xc,&xd,&xe,&xf,&xxh,&xxl,&xp,&xx,&xy); + + a = xa; b = xb; c = xc; d = xd; e = xe; f = xf; h = xxh; l = xxl; + pc = xp; ix = xx; iy = xy; +} +endinstr; + +default: tstates+=4; + +}} diff --git a/Tools/unix/zxcc/track.c b/Tools/unix/zxcc/track.c new file mode 100644 index 00000000..6b961e31 --- /dev/null +++ b/Tools/unix/zxcc/track.c @@ -0,0 +1,185 @@ +/* + + CPMREDIR: CP/M filesystem redirector + Optional Open file tracker + Copyright (C) 2021, Mark Ogden + + This is an addition to the CPMREDIR + Copyright (C) 1998, John Elliott + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "cpmint.h" + +/* CP/M does not require that files opened for reading need to be closed, + * this has two impacts + * 1) a lot of file handles can remain opened even when the file is no + * longer used. For modern OS builds this isn't a major problem as + * the system limits are quite high. It is however wasteful + * 2) for windows it can lead to issues when trying to delete / rename a file + * as normally windows will not allow files to be deleted/renamed if the + * file is currently open. Unix variants don't have this restriction. + * + * As an example the build of cgen.com using my decompiled sources + * the linq phase without tracking left 42 open files + * with tracking this was reduced to 2 + * + * This code keeps track of files that are opened until they are explicitly + * closed or the FCB used to open the file is reused, or the file needs to be + * renamed or deleted. + * To do this it keeps track of the expanded filename, fcb location and allocated + * file handle + * + * Two public functions are used to manage the file list, and are called from + * within the bdos emulation + * + * trackFile(char *fname, void *fcb, int fd) + * removes existing tracking with matchin fcb or fd and + * if (fname != NULL) - add the info to the head of the open files list + * it returns fd + * + * the function is called in the following circumstances + * 1) before closing a file (fname is NULL) + * 2) just after the file has been opened/created. + * 3) to remove association with a given fcb trackFile(NULL, fcb, -1) + * + * note a helper macro releaseFCB(fcb) can be used for (3) above + * + * releaseFile(char *fname) + * this scans through the list of open files and for each open file + * with a matching fname, the file is closed + * + * the function is called before deleting a file or renaming a file + * + * + * there is a helper function that removes the info from the list + * + * Notes: + * For most applications the tracker could in principle automatically + * close existing open files at the start of a new executable invocation. + * Unfortunately this does not support the case where there is a scripting + * engine intercepting the warm reboots, as it may need to keep the script + * source file open. + * + * Note in theory it would be possible for a CP/M program to open a file + * with a given fcb, move the fcb internally and then open another file + * with the original fcb. If this happens the FCB tracking could cause + * a problem. I am not aware of any real programs that do this. + * Please let me know if the situation arises. +*/ + +/* + * The FILETRACKER functionality was implemented primarily because + * MSDOS file interface does not allow opening files in shared mode. + * This port of zxcc deprecates MSDOS and uses WIN32 API calls to handle + * all file I/O. So, this means that FILETRACKER is now optional for + * for Windows as well as Unix. I have found some edge cases where + * FILETRACKER caused a CP/M program to misbehave. Specifically, ZSM4 + * reuses FCBs if files are included and does it such a way that the + * FILETRACKER is unable to solve the problem. For maximum + * compatibility, FILETRACKER may now be left off with the implication + * that a lot of file handles will be left open. + */ + +#ifdef FILETRACKER + +#include "cpmint.h" + +typedef struct _track { + struct _track* next; + int handle; + void* fcb; + char* fname; +} track_t; + +track_t* openFiles; + +static track_t* rmHandle(track_t* s) { + track_t* next = s->next; + free(s->fname); + free(s); + return next; +} + +void releaseFile(char* fname) { + track_t* s = (track_t*)&openFiles; + DBGMSGV("releaseFile: \"%s\"\n", fname); + while (s->next) + if (strcmp(s->next->fname, fname) == 0) { + DBGMSGV(" closing file #%i: \"%s\"\n", s->next->handle, s->next->fname); +#ifdef _WIN32 + { + BOOL b; + b = CloseHandle((HANDLE)s->next->handle); + if (!b) + DBGMSGV(" failed to close file #%i (Error=%lu): %s\n", s->next->handle, GetLastError(), GetErrorStr(GetLastError())); + } +#else + if (close(s->next->handle)) + DBGMSGV(" failed to close file #%i (errno=%lu): %s\n", s->next->handle, errno, strerror(errno)); +#endif + s->next = rmHandle(s->next); + } + else + s = s->next; +} + +int trackFile(char* fname, void* fcb, int fd) { + track_t* s = (track_t*)&openFiles; + DBGMSGV("trackFile: \"%s\", FCB=0x%X, Handle=%i\n", fname, (byte*)fcb - RAM, fd); + while (s->next) { /* find any existing fcb or fd */ + if (s->next->fcb == fcb || s->next->handle == fd) { + if (s->next->handle != fd) { + DBGMSGV(" closing file #%i: \"%s\"\n", s->next->handle, s->next->fname); +#ifdef _WIN32 + { + BOOL b; + b = CloseHandle((HANDLE)s->next->handle); + if (!b) + DBGMSGV(" failed to close file #%i (Error=%lu): %s\n", s->next->handle, GetLastError(), GetErrorStr(GetLastError())); + } +#else + if (close(s->next->handle)) + DBGMSGV(" failed to close file #%i (errno=%lu): %s\n", s->next->handle, errno, strerror(errno)); +#endif + } + DBGMSGV(" released file \"%s\", Handle=%i\n", s->next->fname, s->next->handle); + s->next = rmHandle(s->next); /* release the tracker */ + } + else + s = s->next; + } + if (fname && fd >= 0) { + if ((s = malloc(sizeof(track_t))) == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } + s->next = openFiles; + s->fname = strdup(fname); + s->fcb = fcb; + s->handle = fd; + openFiles = s; + } + return fd; +} + +#else + +void releaseFile(char* fname) {} +int trackFile(char* fname, void* fcb, int fd) { return fd; } + +#endif diff --git a/Tools/unix/zxcc/util.c b/Tools/unix/zxcc/util.c new file mode 100644 index 00000000..e26fa0db --- /dev/null +++ b/Tools/unix/zxcc/util.c @@ -0,0 +1,484 @@ +/* + + CPMREDIR: CP/M filesystem redirector + Copyright (C) 1998, John Elliott + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + This file holds miscellaneous utility functions. +*/ + +#include "cpmint.h" + +#ifdef _WIN32 + +char* GetErrorStr(dword dwErr) +{ + LPVOID lpMsgBuf; + static char ErrStr[256] = ""; + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS | + FORMAT_MESSAGE_MAX_WIDTH_MASK, + NULL, + dwErr, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR)&lpMsgBuf, + sizeof(ErrStr), NULL); + + strncpy(ErrStr, lpMsgBuf, sizeof(ErrStr)); + + LocalFree(lpMsgBuf); + + return ErrStr; +} + +#endif + +char* whence(int wh) +{ + switch (wh) + { + case SEEK_SET: return("SEEK_SET"); + case SEEK_CUR: return("SEEK_CUR"); + case SEEK_END: return("SEEK_END"); + default: return("SEEK_???"); + } +} + +/* In debug mode, lseek()s can be traced. */ + +long zxlseek(int fd, long offset, int wh) +{ +#ifdef _WIN32 + + long v; + DBGMSGV("seek on file #%i to 0x%lX using %s\n", fd, offset, whence(wh)); + v = SetFilePointer((HANDLE)fd, offset, NULL, wh); + if (v != INVALID_SET_FILE_POINTER) return v; + DBGMSGV("seek failed (Error=%lu): %s\n", GetLastError(), GetErrorStr(GetLastError())); + return -1; + +#else + + DBGMSGV("seek on #%i to 0x%lX using %s\n", fd, offset, whence(wh)); + long v = lseek(fd, offset, wh); + if (v >= 0) return v; + DBGMSGV("seek failed (errno=%lu): %s\n", errno, strerror(errno)); + return -1; + +#endif +} + +#ifdef DEBUG + +void redir_showfcb(cpm_byte* fd) +{ + int n; + + for (n = 0; n < 32; n++) + { + if (!n || n >= 12) printf("%02x ", fd[n]); + else printf("%c", fd[n] & 0x7F); + } + printf("\n"); +} + +#endif + +/* Get the "sequential access" file pointer out of an FCB */ + +long redir_get_fcb_pos(cpm_byte* fcb) +{ + long npos; + + npos = 524288L * fcb[0x0E]; /* S2 */ + npos += 16384L * fcb[0x0C]; /* Extent */ + npos += 128L * fcb[0x20]; /* Record */ + + return npos; +} + +void redir_put_fcb_pos(cpm_byte* fcb, long npos) +{ + fcb[0x20] = (npos / 128) % 128; /* Record */ + fcb[0x0C] = (npos / 16384) % 32; /* Extent */ + fcb[0x0E] = (npos / 524288L) % 64; /* S2 */ +} + +/* + * find a filename that works. + * note that this is where we handle the case sensitivity/non-case sensitivity + * horror. + * the name that is passed in should be in lower case. + * we'll modify it to the first one that matches + */ +void swizzle(char* fullpath) +{ + struct stat ss; + char* slash; + DIR* dirp; + struct dirent* dentry; + + /* short circuit if ok */ + if (stat(fullpath, &ss) == 0) { + return; + } + + slash = strrchr(fullpath, '/'); + if (!slash) { + return; + } + *slash = '\0'; + dirp = opendir(fullpath); + *slash = '/'; + while ((dentry = readdir(dirp)) != NULL) { + if (strcasecmp(dentry->d_name, slash + 1) == 0) { + strcpy(slash + 1, dentry->d_name); + break; + } + } + closedir(dirp); +} + +/* Passed a CP/M FCB, convert it to a unix filename. Turn its drive back into + * a path. */ + +int redir_fcb2unix(cpm_byte* fcb, char* fname) +{ + int n, q, drv, ddrv; + char s[2]; + char buf[256]; + + s[1] = 0; + q = 0; + drv = fcb[0] & 0x7F; + if (drv == '?') drv = 0; + + ddrv = fcb[0] & 0x7F; + if (ddrv < 0x1F) ddrv += '@'; + + if (!drv) strcpy(fname, redir_drive_prefix[redir_cpmdrive]); + else strcpy(fname, redir_drive_prefix[drv - 1]); + + for (n = 1; n < 12; n++) + { + s[0] = (fcb[n] & 0x7F); + if (s[0] == '?') q = 1; + if (isupper(s[0])) s[0] = tolower(s[0]); + if (s[0] != ' ') + { + if (n == 9) strcat(fname, "."); + strcat(fname, s); + } + } + + sprintf(buf, "'%c:%-8.8s.%-3.3s' --> '%s'", ddrv, fcb + 1, fcb + 9, fname); + for (n = 0; buf[n] != '\0'; n++) + { + buf[n] &= 0x7F; + if (buf[n] < ' ') buf[n] = 'x'; + } + + DBGMSGV("%s\n", buf); + + return q; +} + +#ifndef EROFS /* Open fails because of read-only FS */ +#define EROFS EACCES +#endif + +int redir_ofile(cpm_byte* fcb, char* s) +{ + int h; + + /* Software write-protection */ + +#ifdef _WIN32 + + releaseFCB(fcb); + + if (!redir_ro_fcb(fcb)) + { + // Attempt to open existing file with read/write access + DBGMSGV("open existing file '%s' with read/write access\n", s); + h = (int)CreateFile(s, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (h != HFILE_ERROR) + { + DBGMSGV("file '%s' opened R/W as #%i\n", s, h); + return trackFile(s, fcb, h); + } + DBGMSGV("open R/W failed (errno=%lu): %s\n", GetLastError(), GetErrorStr(GetLastError())); + } + + // Attempt to open existing file with read-only access + DBGMSGV("open existing file '%s' with read-only access\n", s); + h = (int)CreateFile(s, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (h == HFILE_ERROR) + { + DBGMSGV("open R/O failed (errno=%lu): %s\n", GetLastError(), GetErrorStr(GetLastError())); + return -1; + } + DBGMSGV("file '%s' opened R/O as #%i\n", s, h); + fcb[9] |= 0x80; + +#elif defined(__MSDOS__) + + int rv; + if (!redir_ro_fcb(fcb)) + { + rv = _dos_open(s, O_RDWR, &h); + if (!rv) return h; + DBGMSGV("Open of %s fails: error %x\n", s, rv); + } + rv = _dos_open(s, O_RDONLY, &h); + if (rv) return -1; + fcb[9] |= 0x80; + +#else + + releaseFCB(fcb); + + swizzle(s); + + if (!redir_ro_fcb(fcb)) + { + // Attempt to open existing file with read/write access + DBGMSGV("open existing file '%s' with read/write access\n", s); + h = open(s, O_RDWR | O_BINARY); + if (h >= 0 || (errno != EACCES && errno != EROFS)) + { + DBGMSGV("file '%s' opened R/W as #%i\n", s, h); + return trackFile(s, fcb, h); + } + DBGMSGV("failed to open R/W (errno=%lu): %s\n", errno, strerror(errno)); + } + + // Attempt to open existing file with read-only access + DBGMSGV("open existing file '%s' with read-only access\n", s); + h = open(s, O_RDONLY | O_BINARY); + if (h < 0) + { + DBGMSGV("failed to open R/O (errno=%lu): %s\n", errno, strerror(errno)); + return -1; + } + DBGMSGV("file '%s' opened R/O as #%i\n", s, h); + fcb[9] |= 0x80; + +#endif + + return trackFile(s, fcb, h); +} + +/* Extract a file handle from where it was stored in an FCB by fcb_open() + or fcb_creat(). Aborts if the FCB has been tampered with. + + Note: Some programs (like GENCOM) close FCBs they never opened. This causes + the Corrupt FCB message, but no harm seems to ensue. */ + +int redir_verify_fcb(cpm_byte* fcb) +{ + if (fcb[16] != 0xFD || fcb[17] != 0x00) + { + fprintf(stderr, "cpmredir: Corrupt FCB\n"); + return -1; + } + return (int)(redir_rd32(fcb + 18)); +} + +/* Print a trace message */ + +#ifdef DEBUG + +void DbgMsg(const char* file, int line, const char* func, char* s, ...) +{ + va_list ap; + + va_start(ap, s); + fprintf(stderr, "%s(%s@%i): ", func, file, line); + vfprintf(stderr, s, ap); + va_end(ap); + fflush(stderr); +} + +#endif + +#define BCD(x) (((x % 10)+16*(x/10)) & 0xFF) + +/* Convert time_t to CP/M day count/hours/minutes */ +dword redir_cpmtime(time_t t) +{ + /* Microsoft compiler warned around the conversion from time_t to long + * as to support dates beyond 2038 time_t is set as a long long + * and for the Microsoft compiler sizeof(long) == 4 and sizeof(long long) == 8 + * for other compilers both have size 8 + * As the result is a dword (unsigned long), the code below is modified to reflect this + */ + + dword d = (dword)((t / 86400) - 2921); /* CP/M day 0 is unix day 2921 */ + dword h = (t % 86400) / 3600; /* Hour, 0-23 */ + dword m = (t % 3600) / 60; /* Minute, 0-59 */ + + return (d | (BCD(h) << 16) | (BCD(m) << 24)); +} + +#undef BCD + +#define UNBCD(x) (((x % 16) + 10 * (x / 16)) & 0xFF) + +time_t redir_unixtime(cpm_byte* c) +{ + time_t t; + cpm_word days; + + days = (c[0] + 256 * c[1]) + 2921; + + t = 60L * UNBCD(c[3]); + t += 3600L * UNBCD(c[2]); + t += 86400L * days; + + return t; +} + +#undef UNBCD + +/* Functions to access 24-bit & 32-bit words in memory. These are always + little-endian. */ + +void redir_wr24(cpm_byte* addr, dword v) +{ + addr[0] = v & 0xFF; + addr[1] = (v >> 8) & 0xFF; + addr[2] = (v >> 16) & 0xFF; +} + +void redir_wr32(cpm_byte* addr, dword v) +{ + addr[0] = v & 0xFF; + addr[1] = (v >> 8) & 0xFF; + addr[2] = (v >> 16) & 0xFF; + addr[3] = (v >> 24) & 0xFF; +} + +dword redir_rd24(cpm_byte* addr) +{ + register dword rv = addr[2]; + + rv = (rv << 8) | addr[1]; + rv = (rv << 8) | addr[0]; + return rv; +} + +dword redir_rd32(cpm_byte* addr) +{ + register dword rv = addr[3]; + + rv = (rv << 8) | addr[2]; + rv = (rv << 8) | addr[1]; + rv = (rv << 8) | addr[0]; + return rv; +} + +void redir_log_drv(cpm_byte drv) +{ + if (!drv) redir_l_drives |= 1; + else redir_l_drives |= (1L << drv); +} + +void redir_log_fcb(cpm_byte* fcb) +{ + int drv = fcb[0] & 0x7F; + + if (drv && drv != '?') redir_log_drv(drv - 1); + else redir_log_drv(redir_cpmdrive); +} + +int redir_ro_drv(cpm_byte drv) +{ + if (!drv) return redir_ro_drives & 1; + else return redir_ro_drives & (1L << drv); +} + +int redir_ro_fcb(cpm_byte* fcb) +{ + int drv = fcb[0] & 0x7F; + + if (drv && drv != '?') return redir_ro_drv(drv - 1); + else return redir_ro_drv(redir_cpmdrive); +} + +cpm_word redir_xlt_err(void) +{ + if (redir_password_error()) return 0x7FF; /* DRDOS pwd error */ + + switch (errno) + { + case EISDIR: + case EBADF: return 9; /* Bad FCB */ + case EINVAL: return 0x03FF; /* Readonly file */ + case EPIPE: return 0x01FF; /* Broken pipe */ + case ENOSPC: return 1; /* No space */ + default: return 0xFF; /* Software error */ + } +} + +#ifdef _WIN32 + +int truncate(const char* path, off_t length) +{ + BOOL bResult; + HANDLE hFile; + DWORD dwOffset; + + DBGMSGV("truncate file %s to %lu\n", path, length); + + hFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == INVALID_HANDLE_VALUE) + { + DBGMSGV("truncate failed to open file (Error=%lu): %s\n", GetLastError(), GetErrorStr(GetLastError())); + return -1; + } + + dwOffset = SetFilePointer(hFile, length, NULL, FILE_BEGIN); + if (dwOffset == INVALID_SET_FILE_POINTER) + { + DBGMSGV("truncate failed to open file (Error=%lu): %s\n", GetLastError(), GetErrorStr(GetLastError())); + CloseHandle(hFile); + return -1; + } + + bResult = SetEndOfFile(hFile); + if (!bResult) + { + DBGMSGV("truncate failed to set end of file (Error=%lu): %s\n", GetLastError(), GetErrorStr(GetLastError())); + CloseHandle(hFile); + return -1; + } + + bResult = CloseHandle(hFile); + if (!bResult) + { + DBGMSGV("truncate failed to close file (Error=%lu): %s\n", GetLastError(), GetErrorStr(GetLastError())); + return -1; + } + + DBGMSGV("truncate set file length to %lu\n", dwOffset); + return 0; +} + +#endif diff --git a/Tools/unix/zxcc/xlt.c b/Tools/unix/zxcc/xlt.c new file mode 100644 index 00000000..a36f7f50 --- /dev/null +++ b/Tools/unix/zxcc/xlt.c @@ -0,0 +1,237 @@ +/* + + CPMREDIR: CP/M filesystem redirector + Copyright (C) 1998, John Elliott + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + This file holds functions dealing with name translation; also the + initialisation code. +*/ + +#include "cpmint.h" +static char* skipUser(char* localname); +/* Detect DRDOS */ + +#ifdef __MSDOS__ +static void drdos_init(void) +{ + + /* The DJGPP DOS extender won't detect DRDOS using intdos(), so we have + to use __dpmi_int() instead. */ + + #ifdef __GO32__ + __dpmi_regs ir; + + ir.x.ax = 0x4452; /* "DR" */ + + __dpmi_int(0x21, &ir); + if (ir.x.flags & 1) return; /* Not DRDOS */ + + redir_Msg("DRDOS detected.\n"); + + redir_drdos = 1; + + #else /* __GO32__ */ + + union REGS ir, or ; + + ir.w.ax = 0x4452; /* "DR" */ + + intdos(&ir, &or ); + if (or .w.cflag) return; /* Not DRDOS */ + + redir_Msg("DRDOS detected.\n"); + + redir_drdos = 1; + #endif /* __GO32__ */ +} +#endif /* __MSDOS__ */ + +int fcb_init(void) +{ + int n; + + /* A: to O: free */ + for (n = 0; n < 15; n++) redir_drive_prefix[n][0] = 0; + + strcpy(redir_drive_prefix[15], "./"); /* P: is current directory */ + + /* Log on to P:. It is the only drive at this point which we + * know works. */ + redir_cpmdrive = 15; +#ifdef __MSDOS__ + drdos_init(); +#endif + + return 1; +} + +/* Deinitialise the library. */ + +void fcb_deinit(void) +{ + /* Nothing */ +} + +/* Translate a name from the host FS to a CP/M name. This will (if necessary) + * create a mapping between a CP/M drive and a host directory path. + * + * CP/M drives A: to O: can be mapped in this way. P: is always the current + * drive. + * + */ + +void xlt_name(char* localname, char* cpmname) +{ + char ibuf[CPM_MAXPATH + 1]; + char nbuf[CPM_MAXPATH + 1]; + char* pname = ibuf; + char* s; + int n; + + sprintf(ibuf, "%-.*s", CPM_MAXPATH, skipUser(localname)); + + while ((s = strpbrk(pname, DIRSEP))) { /* find the last directory separator allows mixed \ and / in windows */ +#ifdef _WIN32 + if (*s == '\\') /* convert separators to common format so directory tracking works more efficiently */ + *s = '/'; +#endif + pname = s + 1; + } + + if (pname == ibuf) { /* No path separators in the name. It is therefore a + local filename, so map it to drive P: */ + strcpy(cpmname, "p:"); + strcat(cpmname, ibuf); + return; + } + + /* catch user specified current drive a,b,c,p or A,B,C,P only, which map to predefined directories */ + if (pname == ibuf + 2 && ibuf[1] == ':' && (s = strchr("aAbBcCpP", ibuf[0]))) { + cpmname[0] = tolower(*s); /* make sure it's lower case */ + strcpy(cpmname + 1, ibuf + 1); + return; + } + + strcpy(nbuf, pname); /* nbuf holds filename component */ + *pname = 0; /* ibuf holds path component */ + + /* See if the path is one of those already mapped to drives */ + + for (n = 0; n < 15; n++) + { + if (redir_drive_prefix[n][0] && !strcmp(ibuf, redir_drive_prefix[n])) + { + sprintf(cpmname, "%c:%s", n + 'a', nbuf); + return; + } + } + + /* It is not, see if another drive can be allocated */ + + for (n = 0; n < 15; n++) if (!redir_drive_prefix[n][0]) + { + strcpy(redir_drive_prefix[n], ibuf); + sprintf(cpmname, "%c:%s", n + 'a', nbuf); + return; + } + + /* No other drive can be allocated */ + + strcpy(cpmname, "p:"); + strcat(cpmname, nbuf); +} + +/* It is sometimes convenient to set some fixed mappings. This will create + * a mapping for a given directory. + * Pass drive = -1 for "first available", or 0-15 for A: to P: + */ + +int xlt_map(int drive, char* localdir) +{ + int n; + + if (drive == -1) + { + for (n = 0; n < 15; n++) if (!redir_drive_prefix[n][0]) + { + drive = n; + break; + } + if (drive == -1) return 0; /* No space for mappings */ + } + if (redir_drive_prefix[drive][0]) return 0; /* Drive taken */ + + sprintf(redir_drive_prefix[drive], "%-.*s", CPM_MAXPATH, localdir); + return 1; +} + +/* Unmap a drive + */ + +int xlt_umap(int drive) +{ + if (!redir_drive_prefix[drive][0]) return 0; /* Drive not taken */ + redir_drive_prefix[drive][0] = 0; + return 1; +} + +char* xlt_getcwd(int drive) +{ + if (drive < 0 || drive > 16) return ""; + + return redir_drive_prefix[drive]; +} + +/* as zxcc doesn't really support user spaces, remove any user specification + * hitech c supports + * [[0-9]+[:]][[a-pA-P]:]name[.ext] | [[a-pA-p][[0-9]+]:]name[.ext] + * this function also checks that user is no more than 2 digits and user # <= 31 + * the hitech fcb checks for : as char 2, 3, or 4 which aligns to this + */ +static char* skipUser(char* localname) { + char* s; + int user; + int drive; + + if (!localname || !(s = strchr(localname, ':')) || s > localname + 3) + return localname; + s = localname; + if (isdigit(*s)) { + user = *s++ - '0'; + if (isdigit(*s)) { + user = user * 10 + *s++ - '0'; + if (user > 31) /* check sensible user id */ + return localname; + } + if (*s == ':') /* just strip the user id assume rest is a filename */ + return s + 1; + if ('a' <= (drive = tolower(*s)) && drive <= 'p' && s[1] == ':') + return s; /* was form [0-9]+[a-pA-P] so strip user id */ + else + return localname; /* not vaild so don't change */ + } + if ((drive = tolower(*s++)) < 'a' || 'p' < drive || !isdigit(*s)) + return localname; /* not a valid drive prefix or simple drive spec */ + + user = *s++ - '0'; + if (isdigit(*s)) + user = user * 10 + *s++ - '0'; + if (*s != ':' || user > 31) + return localname; + *--s = drive; /* reinsert the drive just before the : */ + return s; +} diff --git a/Tools/unix/zxcc/z80.c b/Tools/unix/zxcc/z80.c new file mode 100644 index 00000000..59af1ed3 --- /dev/null +++ b/Tools/unix/zxcc/z80.c @@ -0,0 +1,272 @@ +/* Emulation of the Z80 CPU with hooks into the other parts of xz80. + * Copyright (C) 1994 Ian Collier. + * + * 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. + */ + +#include +#include "zxcc.h" + +#define parity(a) (partable[a]) + +unsigned char partable[256]={ + 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4, + 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + 0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0, + 4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4 + }; + +#ifdef DEBUG +// Avoid name conflict with built-in log math function +#define log z80_log + +static unsigned short breakpoint=0; +static unsigned int breaks=0; + +static void inline log(fp,name,val) +FILE *fp; +char *name; +unsigned short val; +{ + int i; + fprintf(fp,"%s=%04X ",name,val); + for(i=0;i<8;i++,val++)fprintf(fp," %02X",fetch(val)); + putc('\n',fp); +} +#endif + +void mainloop(word spc, word ssp){ + register unsigned char a, f, b, c, d, e, h, l; + unsigned char r, a1, f1, b1, c1, d1, e1, h1, l1, i, iff1, iff2, im; + register unsigned short pc; + unsigned short ix, iy, sp; + register unsigned long tstates; + register unsigned int radjust; + register unsigned char ixoriy, new_ixoriy; + unsigned char intsample; + register unsigned char op; +#ifdef DEBUG + char flags[9]; + int bit; + FILE *fp=0; + register unsigned short af2=0,bc2=0,de2=0,hl2=0,ix2=0,iy2=0,sp2=0; + register unsigned char i2=0; + /*unsigned char *memory=memptr[0];*/ + struct _next {unsigned char bytes[8];} *next; + unsigned short BC, DE, HL, AF; + + fputs("Press F11 to log\n",stderr); +#endif + a=f=b=c=d=e=h=l=a1=f1=b1=c1=d1=e1=h1=l1=i=r=iff1=iff2=im=0; + ixoriy=new_ixoriy=0; + ix=iy=0; + pc=spc; + sp=ssp; + tstates=radjust=0; + while(1){ + ixoriy=new_ixoriy; + new_ixoriy=0; +#ifdef DEBUG + next=(struct _next *)&fetch(pc); + BC=bc;DE=de;HL=hl;AF=(a<<8)|f; + if(fp && !ixoriy){ + log(fp,"pc",pc); + if(sp!=sp2)log(fp,"sp",sp2=sp); + if(iy!=iy2)log(fp,"iy",iy2=iy); + if(ix!=ix2)log(fp,"ix",ix2=ix); + if(hl!=hl2)log(fp,"hl",hl2=hl); + if(de!=de2)log(fp,"de",de2=de); + if(bc!=bc2)log(fp,"bc",bc2=bc); + if(((a<<8)|f)!=af2){ + af2=(a<<8)|f; + strcpy(flags,"SZ H VNC"); + for(bit=0;bit<8;bit++)if(!(f&(1<<(7-bit))))flags[bit]=' '; + fprintf(fp,"af=%04X %s\n",af2,flags); + } + if(i!=i2)fprintf(fp,"ir=%02X%02X\n",i2=i,r); + putc('\n',fp); + } + if(pc==breakpoint && pc) + breaks++; /* some code at which to set a breakpoint */ + a=AF>>8; f=AF; h=HL>>8; l=HL; d=DE>>8; e=DE; b=BC>>8; c=BC; +#endif +/* +{ + static int tr = 1; + static int id = 0; +// static byte b = 0; +// +// if (pc == 0x1177) tr = 1; + // if (pc == 0x1185) tr = 0; + if (tr >= 1) ++id; + if (tr >= 1) printf("%d: PC=%04x %02x AF=%02x:%02x BC=%04x DE=%04x HL=%04x IX=%04x IY=%04x\n", + id, pc, fetch(pc), a,f, bc, de, hl, ix, iy); +} +*/ + intsample=1; + op=fetch(pc); + pc++; + radjust++; + switch(op){ +#include "z80ops.h" + } +/*** + * ZXCC doesn't do interrupts at all, so all this is commented out + if(tstates>=int_cycles && intsample){ + tstates-=int_cycles; + frames++; + // Carry out X-related tasks (including waiting for timer + // signal if necessary) + switch(interrupt()){ + case Z80_quit: +#ifdef DEBUG + if(fp)fclose(fp); +#endif + return; + case Z80_NMI: + if(fetch(pc)==0x76)pc++; + iff2=iff1; + iff1=0; + // The Z80 performs a machine fetch cycle for 5 Tstates + // but ignores the result. It takes a further 10 Tstates + // to jump to the NMI routine at 0x66. + tstates+=15; + push2(pc); + pc=0x66; + break; + case Z80_reset: + a=f=b=c=d=e=h=l=a1=f1=b1=c1=d1=e1= + h1=l1=i=r=iff1=iff2=im=0; + ix=iy=sp=pc=0; + radjust=0; + break; +#ifdef DEBUG + case Z80_log: + if(fp){ + fclose(fp); + fp=0; + fputs("Logging turned off\n",stderr); + } else { + fp=fopen(config.log,"a"); + if(fp)fprintf(stderr,"Logging to file %s\n",config.log); + else perror(config.log); + } + break; +#endif + + case Z80_load: + stopwatch(); + if(snapload()){ + a=snapa; + f=snapf; + b=snapb; + c=snapc; + d=snapd; + e=snape; + h=snaph; + l=snapl; + a1=snapa1; + f1=snapf1; + b1=snapb1; + c1=snapc1; + d1=snapd1; + e1=snape1; + h1=snaph1; + l1=snapl1; + iff1=snapiff1; + iff2=snapiff2; + i=snapi; + r=snapr; + radjust=r; + im=snapim; + ix=snapix; + iy=snapiy; + sp=snapsp; + pc=snappc; + } + startwatch(1); + break; + case Z80_save: + r=(r&0x80)|(radjust&0x7f); + snapa=a; + snapf=f; + snapb=b; + snapc=c; + snapd=d; + snape=e; + snaph=h; + snapl=l; + snapa1=a1; + snapf1=f1; + snapb1=b1; + snapc1=c1; + snapd1=d1; + snape1=e1; + snaph1=h1; + snapl1=l1; + snapiff1=iff1; + snapiff2=iff2; + snapi=i; + snapr=r; + snapim=im; + snapix=ix; + snapiy=iy; + snapsp=sp; + snappc=pc; + snapsave(); + startwatch(1); + break; + + } + if(iff1){ +#ifdef DEBUG + if(fp)fprintf(fp,"Interrupt (im=%d)\n\n",im); +#endif + if(fetch(pc)==0x76)pc++; + iff1=iff2=0; + tstates+=5; // accompanied by an input from the data bus // + switch(im){ + case 0: // IM 0 // + case 1: // undocumented // + case 2: // IM 1 // + // there is little to distinguish between these cases // + tstates+=8; + push2(pc); + pc=0x38; + break; + case 3: // IM 2 // + tstates+=14; + { + int addr=fetch2((i<<8)|0xff); + push2(pc); + pc=addr; + } + } + } + }*/ + } +} diff --git a/Tools/unix/zxcc/z80.h b/Tools/unix/zxcc/z80.h new file mode 100644 index 00000000..7634389f --- /dev/null +++ b/Tools/unix/zxcc/z80.h @@ -0,0 +1,86 @@ +/* Miscellaneous definitions for xz80, copyright (C) 1994 Ian Collier. + * + * 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. + */ + + /* [John Elliott, 15 July 2001] + * Copied this file into ZXCC, a CP/M emulator. + * Since ZXCC's memory is a flat 64k space and will never be bank-switched, + * the bank-switching code is removed. + * Since ZXCC has no memory-mapped screen, all the screen management code + * goes as well. + * Since ZXCC doesn't need its speed regulated, all the speed regulation + * code goes as well. + * Since ZXCC doesn't save or load snapshots... OK, you get the idea. + */ + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#define Z80_quit 1 +#define Z80_NMI 2 +#define Z80_reset 3 +#define Z80_load 4 +#define Z80_save 5 +#define Z80_log 6 + +unsigned int in(); +unsigned int out(); +//int interrupt(); +int snapload(); +void snapsave(); +void mainloop(word xpc, word xsp); +void eachframe(); +void itimeron(); +void itimeroff(); +void startwatch(); +unsigned long stopwatch(); +void requester(); +int loader(); +int saver(); +void multiloader(); +void usage(); +void version(); +void drawborder(); + +#define fetch(x) (RAM[x]) +#define fetch2(x) ((fetch((x)+1)<<8)|fetch(x)) + +#define store(x,y) do { RAM[(x)] = (y); } while(0) + +#define store2b(x,hi,lo) do { \ + RAM[(x)]=(lo); \ + RAM[((x+1) & 0xFFFF)]=(hi); } while(0) + +#define store2(x,y) store2b(x,(y)>>8,y) + +#ifdef __GNUC__ +static void inline storefunc(unsigned short ad, unsigned char b) { + store(ad, b); +} +#undef store +#define store(x,y) storefunc(x,y) + +static void inline store2func(unsigned short ad, unsigned char b1, unsigned char b2) { + store2b(ad, b1, b2); +} +#undef store2b +#define store2b(x,hi,lo) store2func(x,hi,lo) +#endif + +#define bc ((b<<8)|c) +#define de ((d<<8)|e) +#define hl ((h<<8)|l) diff --git a/Tools/unix/zxcc/z80ops.h b/Tools/unix/zxcc/z80ops.h new file mode 100644 index 00000000..a07cfe5e --- /dev/null +++ b/Tools/unix/zxcc/z80ops.h @@ -0,0 +1,1332 @@ +/* Emulations of the Z80 CPU instruction set - part of xz80. + * Copyright (C) 1994 Ian Collier. + * + * 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. + */ + +#define instr(opcode,cycles) case opcode: {tstates+=cycles +#define HLinstr(opcode,cycles,morecycles) \ + case opcode: {unsigned short addr; \ + tstates+=cycles; \ + if(ixoriy==0)addr=hl; \ + else tstates+=morecycles, \ + addr=(ixoriy==1?ix:iy)+ \ + (signed char)fetch(pc),\ + pc++ +#define endinstr }; break + +#define cy (f&1) + +#define xh (ixoriy==0?h:ixoriy==1?(ix>>8):(iy>>8)) +#define xl (ixoriy==0?l:ixoriy==1?(ix&0xff):(iy&0xff)) + +#define setxh(x) (ixoriy==0?(h=(x)):ixoriy==1?(ix=(ix&0xff)|((x)<<8)):\ + (iy=(iy&0xff)|((x)<<8))) +#define setxl(x) (ixoriy==0?(l=(x)):ixoriy==1?(ix=(ix&0xff00)|(x)):\ + (iy=(iy&0xff00)|(x))) + +#define inc(var) /* 8-bit increment */ ( var++,\ + f=(f&1)|(var&0xa8)|\ + ((!(var&15))<<4)|((!var)<<6)|\ + ((var==128)<<2)\ + ) +#define dec(var) /* 8-bit decrement */ ( f=(f&1)|((!(var&15))<<4)|2,\ + --var,\ + f|=(var&0xa8)|((var==127)<<2)|\ + ((!var)<<6)\ + ) +#define swap(x,y) {unsigned char t=x; x=y; y=t;} +#define addhl(hi,lo) /* 16-bit add */ if(!ixoriy){\ + unsigned short t;\ + l=t=l+(lo);\ + f=(f&0xc4)|(((t>>=8)+(h&0x0f)+((hi)&0x0f)>15)<<4);\ + h=t+=h+(hi);\ + f|=(h&0x28)|(t>>8);\ + }\ + else do{unsigned long t=(ixoriy==1?ix:iy);\ + f=(f&0xc4)|(((t&0xfff)+((hi<<8)|lo)>0xfff)<<4);\ + t+=(hi<<8)|lo;\ + if(ixoriy==1)ix=t; else iy=t;\ + f|=((t>>8)&0x28)|(t>>16);\ + } while(0) +#define adda(x,c) /* 8-bit add */ do{unsigned short y;\ + unsigned char z=(x);\ + y=a+z+(c);\ + f=(y&0xa8)|(y>>8)|(((a&0x0f)+(z&0x0f)+(c)>15)<<4)|\ + (((~a^z)&0x80&(y^a))>>5);\ + f|=(!(a=y))<<6;\ + } while(0) +#define suba(x,c) /* 8-bit subtract */ do{unsigned short y;\ + unsigned char z=(x);\ + y=(a-z-(c))&0x1ff;\ + f=(y&0xa8)|(y>>8)|(((a&0x0f)<(z&0x0f)+(c))<<4)|\ + (((a^z)&0x80&(y^a))>>5)|2;\ + f|=(!(a=y))<<6;\ + } while(0) +#define cpa(x) /* 8-bit compare */ do{unsigned short y;\ + unsigned char z=(x);\ + y=(a-z)&0x1ff;\ + f=(y&0xa8)|(y>>8)|(((a&0x0f)<(z&0x0f))<<4)|\ + (((a^z)&0x80&(y^a))>>5)|2|((!y)<<6);\ + } while(0) +#define anda(x) /* logical and */ do{\ + a&=(x);\ + f=(a&0xa8)|((!a)<<6)|0x10|parity(a);\ + } while(0) +#define xora(x) /* logical xor */ do{\ + a^=(x);\ + f=(a&0xa8)|((!a)<<6)|parity(a);\ + } while(0) +#define ora(x) /* logical or */ do{\ + a|=(x);\ + f=(a&0xa8)|((!a)<<6)|parity(a);\ + } while(0) + +#define jr /* execute relative jump */ do{int j=(signed char)fetch(pc);\ + pc+=j+1;\ + tstates+=5;\ + } while(0) +#define jp /* execute jump */ (pc=fetch2(pc)) +#define call /* execute call */ do{\ + tstates+=7;\ + push2(pc+2);\ + jp;\ + } while(0) +#define ret /* execute return */ do{\ + tstates+=6;\ + pop2(pc);\ + } while(0) +#define pop2(var) /* pop 16-bit register */ (var=fetch2(sp),sp+=2) +#define pop1(v1,v2) /* pop register pair */ (v2=fetch(sp),\ + v1=fetch(sp+1),sp+=2) +#define push2(val) /* push 16-bit register */ do{sp-=2;store2(sp,(val));}\ + while(0) +#define push1(v1,v2) /* push register pair */ do{sp-=2;\ + store2b(sp,v1,v2);\ + }while(0) + +instr(0,4); + /* nop */ +endinstr; + +instr(1,10); + c=fetch(pc),pc++; + b=fetch(pc),pc++; +endinstr; + +instr(2,7); + store(bc,a); +endinstr; + +instr(3,6); + if(!++c)b++; +endinstr; + +instr(4,4); + inc(b); +endinstr; + +instr(5,4); + dec(b); +endinstr; + +instr(6,7); + b=fetch(pc),pc++; +endinstr; + +instr(7,4); + a=(a<<1)|(a>>7); + f=(f&0xc4)|(a&0x29); +endinstr; + +instr(8,4); + swap(a,a1); + swap(f,f1); +endinstr; + +instr(9,11); + addhl(b,c); +endinstr; + +instr(10,7); + a=fetch(bc); +endinstr; + +instr(11,6); + if(!c--)b--; +endinstr; + +instr(12,4); + inc(c); +endinstr; + +instr(13,4); + dec(c); +endinstr; + +instr(14,7); + c=fetch(pc),pc++; +endinstr; + +instr(15,4); + f=(f&0xc4)|(a&1); + a=(a>>1)|(a<<7); + f|=a&0x28; +endinstr; + +instr(16,8); + if(!--b)pc++; + else jr; +endinstr; + +instr(17,10); + e=fetch(pc),pc++; + d=fetch(pc),pc++; +endinstr; + +instr(18,7); + store(de,a); +endinstr; + +instr(19,6); + if(!++e)d++; +endinstr; + +instr(20,4); + inc(d); +endinstr; + +instr(21,4); + dec(d); +endinstr; + +instr(22,7); + d=fetch(pc),pc++; +endinstr; + +instr(23,4); + {int t=a>>7; + a=(a<<1)|(f&1); + f=(f&0xc4)|(a&0x28)|t; + } +endinstr; + +instr(24,7); + jr; +endinstr; + +instr(25,11); + addhl(d,e); +endinstr; + +instr(26,7); + a=fetch(de); +endinstr; + +instr(27,6); + if(!e--)d--; +endinstr; + +instr(28,4); + inc(e); +endinstr; + +instr(29,4); + dec(e); +endinstr; + +instr(30,7); + e=fetch(pc),pc++; +endinstr; + +instr(31,4); + {int t=a&1; + a=(a>>1)|(f<<7); + f=(f&0xc4)|(a&0x28)|t; + } +endinstr; + +instr(32,7); + if(f&0x40)pc++; + else jr; +endinstr; + +instr(33,10); + if(!ixoriy){ + l=fetch(pc),pc++; + h=fetch(pc),pc++; + } + else { + if(ixoriy==1)ix=fetch2(pc); + else iy=fetch2(pc); + pc+=2; + } +endinstr; + +instr(34,16); + {unsigned short addr=fetch2(pc); + pc+=2; + if(!ixoriy)store2b(addr,h,l); + else if(ixoriy==1)store2(addr,ix); + else store2(addr,iy); + } +endinstr; + +instr(35,6); + if(!ixoriy){if(!++l)h++;} + else if(ixoriy==1)ix++; + else iy++; +endinstr; + +instr(36,4); + if(ixoriy==0)inc(h); + else{unsigned char t; + t=(ixoriy==1?ix:iy)>>8; + inc(t); + if(ixoriy==1)ix=(ix&0xff)|(t<<8); + else iy=(iy&0xff)|(t<<8); + } +endinstr; + +instr(37,4); + if(ixoriy==0)dec(h); + else{unsigned char t; + t=(ixoriy==1?ix:iy)>>8; + dec(t); + if(ixoriy==1)ix=(ix&0xff)|(t<<8); + else iy=(iy&0xff)|(t<<8); + } +endinstr; + +instr(38,7); + setxh(fetch(pc)); + pc++; +endinstr; + +instr(39,4); + { + /* Frank D. Cringle's DAA implementation, converted from yaze 1.10 */ + unsigned int acu,temp,cbits; + + acu=a; + temp=(acu&15); + cbits=(f&1); + if(f&2) /* if N */ + { + /* last operation was a subtract */ + int hd=(cbits || (acu>0x99)); + if((f&16) || (temp>9)) + { /* adjust low digit */ + if(temp>5) f&=~16; + acu-=6; + acu&=0xff; + } + /* adjust high digit */ + if(hd) + acu-=0x160; + } + else + { + /* last operation was an add */ + if((f&16) || (temp>9)) + { + /* adjust low digit */ + if(temp>9) f|=16; else f&=~16; + acu+=6; + } + /* adjust high digit */ + if(cbits || ((acu&0x1f0)>0x90)) + acu+=0x60; + } + cbits|=((acu>>8)&1); + acu&=0xff; + a=acu; + f=((acu&0xa8)|((acu==0)<<6)|(f&0x12)|parity(a)|cbits); + } +endinstr; + +instr(40,7); + if(f&0x40)jr; + else pc++; +endinstr; + +instr(41,11); + if(!ixoriy)addhl(h,l); + else if(ixoriy==1)addhl((ix>>8),(ix&0xff)); + else addhl((iy>>8),(iy&0xff)); +endinstr; + +instr(42,16); + {unsigned short addr=fetch2(pc); + pc+=2; + if(!ixoriy){ + l=fetch(addr); + h=fetch(addr+1); + } + else if(ixoriy==1)ix=fetch2(addr); + else iy=fetch2(addr); + } +endinstr; + +instr(43,6); + if(!ixoriy){if(!l--)h--;} + else if(ixoriy==1)ix--; + else iy--; +endinstr; + +instr(44,4); + if(!ixoriy)inc(l); + else {unsigned char t; + t=(ixoriy==1?ix:iy); + inc(t); + if(ixoriy==1)ix=(ix&0xff00)|t; + else iy=(iy&0xff00)|t; + } +endinstr; + +instr(45,4); + if(!ixoriy)dec(l); + else {unsigned char t; + t=(ixoriy==1?ix:iy); + dec(t); + if(ixoriy==1)ix=(ix&0xff00)|t; + else iy=(iy&0xff00)|t; + } +endinstr; + +instr(46,7); + setxl(fetch(pc)); + pc++; +endinstr; + +instr(47,4); + a=~a; + f=(f&0xc5)|(a&0x28)|0x12; +endinstr; + +instr(48,7); + if(f&1)pc++; + else jr; +endinstr; + +instr(49,10); + sp=fetch2(pc); + pc+=2; +endinstr; + +instr(50,13); + {unsigned short addr=fetch2(pc); + pc+=2; + store(addr,a); + } +endinstr; + +instr(51,6); + sp++; +endinstr; + +HLinstr(52,11,8); + {unsigned char t=fetch(addr); + inc(t); + store(addr,t); + } +endinstr; + +HLinstr(53,11,8); + {unsigned char t=fetch(addr); + dec(t); + store(addr,t); + } +endinstr; + +HLinstr(54,10,5); + store(addr,fetch(pc)); + pc++; +endinstr; + +instr(55,4); + f=(f&0xc4)|1|(a&0x28); +endinstr; + +instr(56,7); + if(f&1)jr; + else pc++; +endinstr; + +instr(57,11); + addhl((sp>>8),(sp&0xff)); +endinstr; + +instr(58,13); + {unsigned short addr=fetch2(pc); + pc+=2; + a=fetch(addr); + } +endinstr; + +instr(59,6); + sp--; +endinstr; + +instr(60,4); + inc(a); +endinstr; + +instr(61,4); + dec(a); +endinstr; + +instr(62,7); + a=fetch(pc),pc++; +endinstr; + +instr(63,4); + f=(f&0xc4)|(cy^1)|(cy<<4)|(a&0x28); +endinstr; + +instr(0x40,4); + /* ld b,b */ +endinstr; + +instr(0x41,4); + b=c; +endinstr; + +instr(0x42,4); + b=d; +endinstr; + +instr(0x43,4); + b=e; +endinstr; + +instr(0x44,4); + b=xh; +endinstr; + +instr(0x45,4); + b=xl; +endinstr; + +HLinstr(0x46,7,8); + b=fetch(addr); +endinstr; + +instr(0x47,4); + b=a; +endinstr; + +instr(0x48,4); + c=b; +endinstr; + +instr(0x49,4); + /* ld c,c */ +endinstr; + +instr(0x4a,4); + c=d; +endinstr; + +instr(0x4b,4); + c=e; +endinstr; + +instr(0x4c,4); + c=xh; +endinstr; + +instr(0x4d,4); + c=xl; +endinstr; + +HLinstr(0x4e,7,8); + c=fetch(addr); +endinstr; + +instr(0x4f,4); + c=a; +endinstr; + +instr(0x50,4); + d=b; +endinstr; + +instr(0x51,4); + d=c; +endinstr; + +instr(0x52,4); + /* ld d,d */ +endinstr; + +instr(0x53,4); + d=e; +endinstr; + +instr(0x54,4); + d=xh; +endinstr; + +instr(0x55,4); + d=xl; +endinstr; + +HLinstr(0x56,7,8); + d=fetch(addr); +endinstr; + +instr(0x57,4); + d=a; +endinstr; + +instr(0x58,4); + e=b; +endinstr; + +instr(0x59,4); + e=c; +endinstr; + +instr(0x5a,4); + e=d; +endinstr; + +instr(0x5b,4); + /* ld e,e */ +endinstr; + +instr(0x5c,4); + e=xh; +endinstr; + +instr(0x5d,4); + e=xl; +endinstr; + +HLinstr(0x5e,7,8); + e=fetch(addr); +endinstr; + +instr(0x5f,4); + e=a; +endinstr; + +instr(0x60,4); + setxh(b); +endinstr; + +instr(0x61,4); + setxh(c); +endinstr; + +instr(0x62,4); + setxh(d); +endinstr; + +instr(0x63,4); + setxh(e); +endinstr; + +instr(0x64,4); + /* ld h,h */ +endinstr; + +instr(0x65,4); + setxh(xl); +endinstr; + +HLinstr(0x66,7,8); + h=fetch(addr); +endinstr; + +instr(0x67,4); + setxh(a); +endinstr; + +instr(0x68,4); + setxl(b); +endinstr; + +instr(0x69,4); + setxl(c); +endinstr; + +instr(0x6a,4); + setxl(d); +endinstr; + +instr(0x6b,4); + setxl(e); +endinstr; + +instr(0x6c,4); + setxl(xh); +endinstr; + +instr(0x6d,4); + /* ld l,l */ +endinstr; + +HLinstr(0x6e,7,8); + l=fetch(addr); +endinstr; + +instr(0x6f,4); + setxl(a); +endinstr; + +HLinstr(0x70,7,8); + store(addr,b); +endinstr; + +HLinstr(0x71,7,8); + store(addr,c); +endinstr; + +HLinstr(0x72,7,8); + store(addr,d); +endinstr; + +HLinstr(0x73,7,8); + store(addr,e); +endinstr; + +HLinstr(0x74,7,8); + store(addr,h); +endinstr; + +HLinstr(0x75,7,8); + store(addr,l); +endinstr; + +instr(0x76,4); + /* Was HALT - ZXCC ignores HALT */ +endinstr; + +HLinstr(0x77,7,8); + store(addr,a); +endinstr; + +instr(0x78,4); + a=b; +endinstr; + +instr(0x79,4); + a=c; +endinstr; + +instr(0x7a,4); + a=d; +endinstr; + +instr(0x7b,4); + a=e; +endinstr; + +instr(0x7c,4); + a=xh; +endinstr; + +instr(0x7d,4); + a=xl; +endinstr; + +HLinstr(0x7e,7,8); + a=fetch(addr); +endinstr; + +instr(0x7f,4); + /* ld a,a */ +endinstr; + +instr(0x80,4); + adda(b,0); +endinstr; + +instr(0x81,4); + adda(c,0); +endinstr; + +instr(0x82,4); + adda(d,0); +endinstr; + +instr(0x83,4); + adda(e,0); +endinstr; + +instr(0x84,4); + adda(xh,0); +endinstr; + +instr(0x85,4); + adda(xl,0); +endinstr; + +HLinstr(0x86,7,8); + adda(fetch(addr),0); +endinstr; + +instr(0x87,4); + adda(a,0); +endinstr; + +instr(0x88,4); + adda(b,cy); +endinstr; + +instr(0x89,4); + adda(c,cy); +endinstr; + +instr(0x8a,4); + adda(d,cy); +endinstr; + +instr(0x8b,4); + adda(e,cy); +endinstr; + +instr(0x8c,4); + adda(xh,cy); +endinstr; + +instr(0x8d,4); + adda(xl,cy); +endinstr; + +HLinstr(0x8e,7,8); + adda(fetch(addr),cy); +endinstr; + +instr(0x8f,4); + adda(a,cy); +endinstr; + +instr(0x90,4); + suba(b,0); +endinstr; + +instr(0x91,4); + suba(c,0); +endinstr; + +instr(0x92,4); + suba(d,0); +endinstr; + +instr(0x93,4); + suba(e,0); +endinstr; + +instr(0x94,4); + suba(xh,0); +endinstr; + +instr(0x95,4); + suba(xl,0); +endinstr; + +HLinstr(0x96,7,8); + suba(fetch(addr),0); +endinstr; + +instr(0x97,4); + suba(a,0); +endinstr; + +instr(0x98,4); + suba(b,cy); +endinstr; + +instr(0x99,4); + suba(c,cy); +endinstr; + +instr(0x9a,4); + suba(d,cy); +endinstr; + +instr(0x9b,4); + suba(e,cy); +endinstr; + +instr(0x9c,4); + suba(xh,cy); +endinstr; + +instr(0x9d,4); + suba(xl,cy); +endinstr; + +HLinstr(0x9e,7,8); + suba(fetch(addr),cy); +endinstr; + +instr(0x9f,4); + suba(a,cy); +endinstr; + +instr(0xa0,4); + anda(b); +endinstr; + +instr(0xa1,4); + anda(c); +endinstr; + +instr(0xa2,4); + anda(d); +endinstr; + +instr(0xa3,4); + anda(e); +endinstr; + +instr(0xa4,4); + anda(xh); +endinstr; + +instr(0xa5,4); + anda(xl); +endinstr; + +HLinstr(0xa6,7,8); + anda(fetch(addr)); +endinstr; + +instr(0xa7,4); + anda(a); +endinstr; + +instr(0xa8,4); + xora(b); +endinstr; + +instr(0xa9,4); + xora(c); +endinstr; + +instr(0xaa,4); + xora(d); +endinstr; + +instr(0xab,4); + xora(e); +endinstr; + +instr(0xac,4); + xora(xh); +endinstr; + +instr(0xad,4); + xora(xl); +endinstr; + +HLinstr(0xae,7,8); + xora(fetch(addr)); +endinstr; + +instr(0xaf,4); + xora(a); +endinstr; + +instr(0xb0,4); + ora(b); +endinstr; + +instr(0xb1,4); + ora(c); +endinstr; + +instr(0xb2,4); + ora(d); +endinstr; + +instr(0xb3,4); + ora(e); +endinstr; + +instr(0xb4,4); + ora(xh); +endinstr; + +instr(0xb5,4); + ora(xl); +endinstr; + +HLinstr(0xb6,7,8); + ora(fetch(addr)); +endinstr; + +instr(0xb7,4); + ora(a); +endinstr; + +instr(0xb8,4); + cpa(b); +endinstr; + +instr(0xb9,4); + cpa(c); +endinstr; + +instr(0xba,4); + cpa(d); +endinstr; + +instr(0xbb,4); + cpa(e); +endinstr; + +instr(0xbc,4); + cpa(xh); +endinstr; + +instr(0xbd,4); + cpa(xl); +endinstr; + +HLinstr(0xbe,7,8); + cpa(fetch(addr)); +endinstr; + +instr(0xbf,4); + cpa(a); +endinstr; + +instr(0xc0,5); + if(!(f&0x40))ret; +endinstr; + +instr(0xc1,10); + pop1(b,c); +endinstr; + +instr(0xc2,10); + if(!(f&0x40))jp; + else pc+=2; +endinstr; + +instr(0xc3,10); + jp; +endinstr; + +instr(0xc4,10); + if(!(f&0x40))call; + else pc+=2; +endinstr; + +instr(0xc5,11); + push1(b,c); +endinstr; + +instr(0xc6,7); + adda(fetch(pc),0); + pc++; +endinstr; + +instr(0xc7,11); + push2(pc); + pc=0; +endinstr; + +instr(0xc8,5); + if(f&0x40)ret; +endinstr; + +instr(0xc9,4); + ret; +endinstr; + +instr(0xca,10); + if(f&0x40)jp; + else pc+=2; +endinstr; + +instr(0xcb,4); +#include "cbops.h" +endinstr; + +instr(0xcc,10); + if(f&0x40)call; + else pc+=2; +endinstr; + +instr(0xcd,10); + call; +endinstr; + +instr(0xce,7); + adda(fetch(pc),cy); + pc++; +endinstr; + +instr(0xcf,11); + push2(pc); + pc=8; +endinstr; + +instr(0xd0,5); + if(!cy)ret; +endinstr; + +instr(0xd1,10); + pop1(d,e); +endinstr; + +instr(0xd2,10); + if(!cy)jp; + else pc+=2; +endinstr; + +instr(0xd3,11); + tstates+=out(tstates,a,fetch(pc),a); + pc++; +endinstr; + +instr(0xd4,10); + if(!cy)call; + else pc+=2; +endinstr; + +instr(0xd5,11); + push1(d,e); +endinstr; + +instr(0xd6,7); + suba(fetch(pc),0); + pc++; +endinstr; + +instr(0xd7,11); + push2(pc); + pc=16; +endinstr; + +instr(0xd8,5); + if(cy)ret; +endinstr; + +instr(0xd9,4); + swap(b,b1); + swap(c,c1); + swap(d,d1); + swap(e,e1); + swap(h,h1); + swap(l,l1); +endinstr; + +instr(0xda,10); + if(cy)jp; + else pc+=2; +endinstr; + +instr(0xdb,11); + {unsigned short t; + a=t=in(tstates,a,fetch(pc)); + tstates+=t>>8; + pc++; + } +endinstr; + +instr(0xdc,10); + if(cy)call; + else pc+=2; +endinstr; + +instr(0xdd,4); + new_ixoriy=1; + intsample=0; +endinstr; + +instr(0xde,7); + suba(fetch(pc),cy); + pc++; +endinstr; + +instr(0xdf,11); + push2(pc); + pc=24; +endinstr; + +instr(0xe0,5); + if(!(f&4))ret; +endinstr; + +instr(0xe1,10); + if(!ixoriy)pop1(h,l); + else if(ixoriy==1)pop2(ix); + else pop2(iy); +endinstr; + +instr(0xe2,10); + if(!(f&4))jp; + else pc+=2; +endinstr; + +instr(0xe3,19); + if(!ixoriy){ + unsigned short t=fetch2(sp); + store2b(sp,h,l); + l=t; + h=t>>8; + } + else if(ixoriy==1){ + unsigned short t=fetch2(sp); + store2(sp,ix); + ix=t; + } + else{ + unsigned short t=fetch2(sp); + store2(sp,iy); + iy=t; + } +endinstr; + +instr(0xe4,10); + if(!(f&4))call; + else pc+=2; +endinstr; + +instr(0xe5,11); + if(!ixoriy)push1(h,l); + else if(ixoriy==1)push2(ix); + else push2(iy); +endinstr; + +instr(0xe6,7); + anda(fetch(pc)); + pc++; +endinstr; + +instr(0xe7,11); + push2(pc); + pc=32; +endinstr; + +instr(0xe8,5); + if(f&4)ret; +endinstr; + +instr(0xe9,4); + pc=!ixoriy?hl:ixoriy==1?ix:iy; +endinstr; + +instr(0xea,10); + if(f&4)jp; + else pc+=2; +endinstr; + +instr(0xeb,4); + swap(h,d); + swap(e,l); +endinstr; + +instr(0xec,10); + if(f&4)call; + else pc+=2; +endinstr; + +instr(0xed,4); +#include"edops.h" +endinstr; + +instr(0xee,7); + xora(fetch(pc)); + pc++; +endinstr; + +instr(0xef,11); + push2(pc); + pc=40; +endinstr; + +instr(0xf0,5); + if(!(f&0x80))ret; +endinstr; + +instr(0xf1,10); + pop1(a,f); +endinstr; + +instr(0xf2,10); + if(!(f&0x80))jp; + else pc+=2; +endinstr; + +instr(0xf3,4); + iff1=iff2=0; + intsample=0; +endinstr; + +instr(0xf4,10); + if(!(f&0x80))call; + else pc+=2; +endinstr; + +instr(0xf5,11); + push1(a,f); +endinstr; + +instr(0xf6,7); + ora(fetch(pc)); + pc++; +endinstr; + +instr(0xf7,11); + push2(pc); + pc=48; +endinstr; + +instr(0xf8,5); + if(f&0x80)ret; +endinstr; + +instr(0xf9,6); + sp=!ixoriy?hl:ixoriy==1?ix:iy; +endinstr; + +instr(0xfa,10); + if(f&0x80)jp; + else pc+=2; +endinstr; + +instr(0xfb,4); + iff1=iff2=1; + intsample=0; +endinstr; + +instr(0xfc,10); + if(f&0x80)call; + else pc+=2; +endinstr; + +instr(0xfd,4); + new_ixoriy=2; + intsample=0; +endinstr; + +instr(0xfe,7); + cpa(fetch(pc)); + pc++; +endinstr; + +instr(0xff,11); + push2(pc); + pc=56; +endinstr; + diff --git a/Tools/unix/zxcc/zxbdos.c b/Tools/unix/zxcc/zxbdos.c new file mode 100644 index 00000000..dab19e58 --- /dev/null +++ b/Tools/unix/zxcc/zxbdos.c @@ -0,0 +1,555 @@ +#include "zxcc.h" + +#define BDOS_DEF +#include "zxbdos.h" +#include "zxcbdos.h" +#include "zxdbdos.h" + +#ifdef __MSDOS__ +#include +#endif + +#define BCD(x) (((x % 10)+16*(x/10)) & 0xFF) + +/* Convert time_t to CP/M day count/hours/minutes */ +/* there is a duplicate of this code in util.c. +* same modification applied here +*/ +dword cpmtime(time_t t) +{ + dword d = (dword)((t / 86400) - 2921); /* CP/M day 0 is unix day 2921 */ + dword h = (t % 86400) / 3600; /* Hour, 0-23 */ + dword m = (t % 3600) / 60; /* Minute, 0-59 */ + + return (d | (BCD(h) << 16) | (BCD(m) << 24)); +} + + +byte get_time(cpm_word b) +{ + time_t t; + + time(&t); + wr32(b, cpmtime(t)); + + return (BCD(t % 60)); +} + + +/* Functions to access 24-bit & 32-bit words in memory. These are always + little-endian. */ + +void wr24(word addr, dword v) +{ + RAM[addr] = v & 0xFF; + RAM[addr + 1] = (v >> 8) & 0xFF; + RAM[addr + 2] = (v >> 16) & 0xFF; +} + +void wr32(word addr, dword v) +{ + RAM[addr] = v & 0xFF; + RAM[addr + 1] = (v >> 8) & 0xFF; + RAM[addr + 2] = (v >> 16) & 0xFF; + RAM[addr + 3] = (v >> 24) & 0xFF; +} + +dword rd24(word addr) +{ + register dword rv = RAM[addr + 2]; + + rv = (rv << 8) | RAM[addr + 1]; + rv = (rv << 8) | RAM[addr]; + return rv; +} + + +dword rd32(word addr) +{ + register dword rv = RAM[addr + 3]; + + rv = (rv << 8) | RAM[addr + 2]; + rv = (rv << 8) | RAM[addr + 1]; + rv = (rv << 8) | RAM[addr]; + return rv; +} + +#define peekw(addr) ( (((word)(RAM[addr + 1])) << 8) | RAM[addr]) + + +/* Get / set the program return code. We store this in 'C' form: 0 for + success, 1-255 for failure. Translate to/from the CP/M form of: + + 0x0000-0xFEFF for success + 0xFF00-0xFFFE for failure + + We also store the actual value so it can be returned + + */ + +word cpm_errcde(word DE) +{ + static word real_err = 0; + + if (DE == 0xFFFF) return real_err; + real_err = DE; + + if (DE == 0xFF00) cpm_error = 1; + else if (DE > 0xFF00) cpm_error = (DE & 0xFF); + else cpm_error = 0; + return 0; +} + + +#ifdef USE_CPMGSX +gsx_byte gsxrd(gsx_word addr) +{ + return RdZ80(addr); +} + +void gsxwr(gsx_word addr, gsx_byte value) +{ + WrZ80(addr, value); +} + +#endif + +#undef bc +#undef de +#undef hl + +void setw(byte* l, byte* h, word w) +{ + *l = (w & 0xFF); + *h = (w >> 8) & 0xFF; +} + +void cpmbdos(byte* a, byte* b, byte* c, byte* d, byte* e, byte* f, + byte* h, byte* l, word* pc, word* ix, word* iy) +{ + word de = ((*d) << 8) | *e; + word hl = ((*h) << 8) | *l; + byte* pde = &RAM[de]; + byte* pdma = &RAM[cpm_dma]; + word temp; + int retv; + + DBGMSGV("BDOS service invoked: C=0x%02X DE=0x%04X\n", *c, de); + + switch (*c) + { + case 0: + *pc = 0; + break; + + case 1: /* Get a character */ +#ifdef USE_CPMIO + retv = cpm_bdos_1(); +#else + retv = cin(); +#endif + if (retv < 0) *pc = 0; + setw(l, h, retv); + break; + + case 2: /* Print a character */ +#ifdef USE_CPMIO + if (cpm_bdos_2(*e)) *pc = 0; +#else + cout(*e); +#endif + break; + + case 3: /* No auxin */ + setw(l, h, 0x1A); + break; + + case 4: /* No auxout */ + break; + + case 5: /* No printer */ + break; + + case 6: /* Direct console I/O */ + retv = cpm_bdos_6(*e); + if (retv < 0) *pc = 0; + setw(l, h, retv); + break; + + case 7: /* No auxist */ + case 8: /* No auxost */ + break; + + case 9: /* Print a $-terminated string */ +#ifdef USE_CPMIO + if (cpm_bdos_9((char*)pde)) *pc = 0; +# else + for (temp = 0; RAM[de + temp] != '$'; ++temp) + { + cout(RAM[de + temp]); + } +#endif + break; + + case 0x0A: + bdos_rdline(de, &(*pc)); + break; + + case 0x0B: /* Console status */ + // *l = *h = 0; /* No keys pressed */ + *l = cstat(); + *h = 0; + break; + + case 0x0C: /* Get CP/M version */ + + /* For GENCOM's benefit, claim to be v3.1 */ + + *l = 0x31; /* v3.1 */ + /* *l = 0x22; * v2.2 */ + *h = 0; /* CP/M, no network */ + break; + + case 0x0D: /* Re-log discs */ + fcb_reset(); + break; + + case 0x0E: /* Set default drive */ + setw(l, h, fcb_drive(*e)); + break; + + case 0x0F: /* Open using FCB */ + setw(l, h, x_fcb_open(pde, pdma)); + break; + + case 0x10: /* Close using FCB */ + setw(l, h, fcb_close(pde)); + break; + + case 0x11: /* Find first */ + setw(l, h, fcb_find1(pde, pdma)); + break; + + case 0x12: + setw(l, h, fcb_find2(pde, pdma)); + break; + + case 0x13: /* Delete using FCB */ + setw(l, h, fcb_unlink(pde, pdma)); + break; + + case 0x14: /* Sequential read using FCB */ + setw(l, h, fcb_read(pde, pdma)); + break; + + case 0x15: /* Sequential write using FCB */ + setw(l, h, fcb_write(pde, pdma)); + break; + + case 0x16: /* Create using FCB */ + setw(l, h, fcb_creat(pde, pdma)); + break; + + case 0x17: /* Rename using FCB */ + setw(l, h, fcb_rename(pde, pdma)); + break; + + case 0x18: /* Get login vector */ + setw(l, h, fcb_logvec()); + break; + + case 0x19: /* Get default drive */ + setw(l, h, cpm_drive); + break; + + case 0x1A: /* Set DMA */ + DBGMSGV("Set DMA to 0x%04X\n", de); + cpm_dma = de; + break; + + case 0x1B: /* Get alloc vector */ + fcb_getalv(RAM + 0xFF80, 0x40); + setw(l, h, 0xFF80); + break; + + case 0x1C: /* Make disc R/O */ + setw(l, h, fcb_rodisk()); + break; + + case 0x1D: /* Get R/O vector */ + setw(l, h, fcb_rovec()); + break; + + case 0x1E: /* Set attributes */ + setw(l, h, fcb_chmod(pde, pdma)); + break; + + case 0x1F: /* Get DPB */ + fcb_getdpb(RAM + 0xFFC0); + setw(l, h, 0xFFC0); + break; + + case 0x20: /* Get/set uid */ + setw(l, h, fcb_user(*e)); + break; + + case 0x21: /* Read a record */ + setw(l, h, fcb_randrd(pde, pdma)); + break; + + case 0x22: /* Write a record */ + setw(l, h, fcb_randwr(pde, pdma)); + break; + + case 0x23: /* Get file size */ + setw(l, h, x_fcb_stat(pde)); + break; + + case 0x24: /* Get file pointer */ + setw(l, h, fcb_tell(pde)); + break; + + case 0x25: + setw(l, h, fcb_resro(de)); + break; + + /* MP/M drive access functions, not implemented */ + + case 0x28: /* Write with 0 fill */ + setw(l, h, fcb_randwz(pde, pdma)); + break; + + /* MP/M record locking functions, not implemented */ + + case 0x2C: /* Set no. of records to read/write */ + setw(l, h, fcb_multirec(*e)); + break; + + case 0x2D: /* Set error mode */ + err_mode = *e; + break; + + case 0x2E: + setw(l, h, fcb_dfree(*e, pdma)); + break; + + /* 0x2F: Chain */ + + case 0x30: + setw(l, h, fcb_sync(*e)); + break; + + case 0x31: + if (pde[1] == 0xFE) + { + RAM[0xFE9C + *pde] = pde[2]; + RAM[0xFE9D + *pde] = pde[3]; + } + else if (RAM[hl + 1] == 0xFF) + { + RAM[0xFE9C + *pde] = pde[2]; + } + else + { + *l = RAM[0xFE9C + *pde]; + *h = RAM[0xFE9D + *pde]; + } + break; + + case 0x32: + temp = *ix; + *ix = 3 * (pde[0] + 1); + *a = pde[1]; + *c = pde[2]; + *b = pde[3]; + *e = pde[4]; + *d = pde[5]; + *l = pde[6]; + *h = pde[7]; + cpmbios(a, b, c, d, e, f, h, l, pc, ix, iy); + *ix = temp; + break; + + case 0x3C: /* Communicate with RSX */ + *h = 0; *l = 0xFF; /* return error */ + break; + + case 0x62: /* Purge */ + setw(l, h, fcb_purge()); + break; + + case 0x63: /* Truncate file */ + setw(l, h, fcb_trunc(pde, pdma)); + break; + + case 0x64: /* Set label */ + setw(l, h, fcb_setlbl(pde, pdma)); + break; + + case 0x65: /* Get label byte */ + setw(l, h, fcb_getlbl(*e)); + break; + + case 0x66: /* Get file date */ + setw(l, h, fcb_date(pde)); + break; + + case 0x67: /* Set password */ + setw(l, h, fcb_setpwd(pde, pdma)); + break; + + case 0x68: /* Set time of day */ + /* Not advisable to let an emulator play with the clock */ + break; + + case 0x69: /* Get time of day */ + setw(l, h, get_time(de)); + break; + + case 0x6A: /* Set default password */ + setw(l, h, fcb_defpwd(pde)); + break; + + case 0x6B: /* Get serial number */ + memcpy(pde, SERIAL, 6); + break; + + case 0x6C: /* 0.03 set error code */ + setw(l, h, cpm_errcde(de)); + break; + +#ifdef USE_CPMIO + case 0x6D: /* Set/get console mode */ + setw(l, h, cpm_bdos_109(de)); + break; + + case 0x6E: /* Set/get string delimiter */ + setw(l, h, cpm_bdos_110(*e)); + break; + + case 0x6F: /* Send fixed length string to screen */ + if (cpm_bdos_111((char*)RAM + peekw(de), + peekw(de + 2))) + *pc = 0; + break; + + case 0x70: /* Send fixed length string to printer */ + break; + + /* 0x71: Strange PCP/M function */ +#else + case 0x6D: /* Set/get console mode */ + setw(l, h, 0); + break; + +#endif + +#ifdef USE_CPMGSX + case 0x73: /* GSX */ + setw(l, h, gsx80(gsxrd, gsxwr, de)); + break; +#endif + + case 0x74: /* Set date stamp */ + setw(l, h, fcb_sdate(pde, pdma)); + break; + + case 0x98: /* Parse filename */ + setw(l, h, fcb_parse((char*)RAM + peekw(de), + (byte*)RAM + peekw(de + 2))); + break; + + default: +#ifdef USE_CPMIO + cpm_scr_unit(); +#endif +#ifdef USE_CPMGSX + gsx_deinit(); +#endif + + fprintf(stderr, "%s: Unsupported BDOS call %d\n", progname, + (int)(*c)); + dump_regs(stderr, *a, *b, *c, *d, *e, *f, *h, *l, *pc, *ix, *iy); + zxcc_exit(1); + break; + } + + *a = *l; + *b = *h; +} + +void cpmbios(byte* a, byte* b, byte* c, byte* d, byte* e, byte* f, + byte* h, byte* l, word* pc, word* ix, word* iy) +{ + int func = (((*ix) & 0xFF) / 3) - 1; + + DBGMSGV("BIOS service invoked: func=0x%02X\n", func); + + switch (func) /* BIOS function */ + { + case 1: + zxcc_exit(zxcc_term()); /* Program termination */ + break; + + case 2: /* CONST */ +#ifdef USE_CPMIO + * a = cpm_const(); +#else + * a = cpm_bdos_6(0xFE); +#endif + break; + + case 3: /* CONIN */ +#ifdef USE_CPMIO + * a = cpm_conin(); +#else + * a = cpm_bdos_6(0xFD); +#endif + break; + + case 4: /* CONOUT */ +#ifdef USE_CPMIO + cpm_conout(*c); +#else + cpm_bdos_6(*c); +#endif + break; + + case 20: /* DEVTBL */ + setw(l, h, 0xFFFF); + break; + + case 22: /* DRVTBL */ + setw(l, h, 0xFFFF); + break; + + case 26: /* TIME */ + RAM[0xFEF8] = get_time(0xFEF4); + break; + + case 30: /* USERF!!! */ +#ifdef USE_CPMIO + cpm_bdos_110('$'); + cpm_bdos_9("This program has attempted to call USERF, " + "which is not implemented\n$"); +#else + printf("This program has attempted to call USERF, which " + "is not implemented.\n"); +#endif + zxcc_term(); + zxcc_exit(1); + break; + + default: +#ifdef USE_CPMIO + cpm_scr_unit(); +#endif +#ifdef USE_CPMGSX + gsx_deinit(); +#endif + + fprintf(stderr, "%s: Unsupported BIOS call %d\n", progname, func); + dump_regs(stderr, *a, *b, *c, *d, *e, *f, *h, *l, *pc, *ix, *iy); + zxcc_exit(1); + } +} diff --git a/Tools/unix/zxcc/zxbdos.h b/Tools/unix/zxcc/zxbdos.h new file mode 100644 index 00000000..fd7bebc2 --- /dev/null +++ b/Tools/unix/zxcc/zxbdos.h @@ -0,0 +1,49 @@ +extern char* progname; +extern char** argv; +extern int argc; + +extern byte cpm_drive; +extern byte cpm_user; + +extern byte RAM[65536]; /* The Z80's address space */ + +extern void Msg(char* s, ...); + +#ifdef BDOS_DEF + +word cpm_dma = 0x80; /* DMA address */ +byte err_mode = 0xFF; +byte rec_multi = 1; +word rec_len = 128; +word ffirst_fcb = 0xFFFF; +byte cpm_error = 0; /* Error code returned by CP/M */ + +#else /* BDOS_DEF */ + +extern word cpm_dma, rec_len, ffirst_fcb; +extern byte err_mode, rec_multi, cpm_error; + +#endif /* BDOS_DEF */ + +#ifndef O_BINARY /* Necessary in DOS, not present in Linux */ + #define O_BINARY 0 +#endif + +typedef unsigned long dword; + +/* Functions in zxbdos.c */ + +void wr24(word addr, dword v); +void wr32(word addr, dword v); +dword rd24(word addr); +dword rd32(word addr); +dword cpmtime(time_t t); +word cpm_errcde(word DE); + +#ifdef USE_CPMGSX +gsx_byte gsxrd(gsx_word addr); +void gsxwr(gsx_word addr, gsx_byte value); +#endif + +void cpmbdos(); +void cpmbios(); diff --git a/Tools/unix/zxcc/zxcbdos.c b/Tools/unix/zxcc/zxcbdos.c new file mode 100644 index 00000000..2777f85e --- /dev/null +++ b/Tools/unix/zxcc/zxcbdos.c @@ -0,0 +1,149 @@ +#include "zxcc.h" +#include "zxbdos.h" +#include "zxcbdos.h" + +#ifndef _WIN32 +#include +#endif + +/* Line input */ +#ifdef USE_CPMIO + +void bdos_rdline(word line, word* PC) +{ + unsigned char* buf; + + if (!line) line = cpm_dma; + else RAM[line + 1] = 0; + + buf = (unsigned char*)&RAM[line]; + + if (cpm_bdos_10(buf)) *PC = 0; +} + +#else /* def USE_CPMIO */ + +void bdos_rdline(word line, word* PC) +{ + unsigned char c; + unsigned char* p; + int n; + int maxlen; + + if (!line) line = cpm_dma; + maxlen = RAM[line]; + + // fgets causes extra linefeeds, so we invent our own + // fgets((char *)(RAM + line + 2), maxlen, stdin); + + p = (RAM + line + 2); + n = 0; + + while (1) { + c = cin(); + if (c == '\r') + break; + if (c == '\b') { + if (n > 0) { + cout('\b'); + cout(' '); + cout('\b'); + n--; + p--; + } + } + else { + if (n < maxlen) { + cout(c); + *p++ = c; + n++; + } + } + } + + cout('\r'); + *p = '\0'; + + //RAM[line + 1] = strlen((char *)(RAM + line + 2)) - 1; + RAM[line + 1] = (unsigned char)n; + + DBGMSGV("Input: [%d] %-*.*s\n", RAM[line + 1], RAM[line + 1], RAM[line + 1], (char*)(RAM + line + 2)); +} +#endif /* ndef USE_CPMIO */ + +#ifndef USE_CPMIO + +int cpm_bdos_6(byte e) +{ + int c; + + switch (e) { + case 0xFF: + if (cstat()) return cin(); + return 0; + + case 0xFE: + return cstat(); + + case 0xFD: + return cin(); + + default: + cout(e); + break; + } + return 0; +} +#endif + +#ifdef _WIN32 +byte cin() +{ + if (_isatty(STDIN_FILENO)) + return getch(); + else + return getchar(); +} + +void cout(byte c) +{ + if (_isatty(STDOUT_FILENO)) + putch(c); + else + putchar(c); +} + +int cstat() +{ + if (_isatty(STDIN_FILENO)) + return _kbhit() ? 0xFF : 0; + else + return 0xFF; +} + +#else /* def _WIN32 */ + +byte cin() +{ + char c = 0; + + read(STDIN_FILENO, &c, 1); + return c; +} + +void cout(byte c) +{ + write(STDOUT_FILENO, &c, 1); + return; +} + +int cstat() +{ + int i; + + ioctl(STDIN_FILENO, FIONREAD, &i); + if (i > 0) return 0xFF; + return 0; +} + +#endif diff --git a/Tools/unix/zxcc/zxcbdos.h b/Tools/unix/zxcc/zxcbdos.h new file mode 100644 index 00000000..dde4c08d --- /dev/null +++ b/Tools/unix/zxcc/zxcbdos.h @@ -0,0 +1,6 @@ +void bdos_rdline(word line, word* PC); +int cpm_bdos_6(byte e); + +byte cin(void); +void cout(byte); +int cstat(void); diff --git a/Tools/unix/zxcc/zxcc.c b/Tools/unix/zxcc/zxcc.c new file mode 100644 index 00000000..21929704 --- /dev/null +++ b/Tools/unix/zxcc/zxcc.c @@ -0,0 +1,550 @@ +#include "zxcc.h" + +/* Global variables */ + +char* progname; +char** argv; +int argc; + +byte cpm_drive; +byte cpm_user; +extern byte cpm_error; + +char bindir80[CPM_MAXPATH] = ""; +char libdir80[CPM_MAXPATH] = ""; +char incdir80[CPM_MAXPATH] = ""; + +#ifndef _WIN32 +struct termios tc_orig; +#endif + +byte RAM[65536]; /* The Z80's address space */ + +void load_comfile(void); /* Forward declaration */ + +static int deinit_term, deinit_gsx; +static void mkpath(char* fullpath, char* path, char* subdir); + +void dump_regs(FILE* fp, byte a, byte b, byte c, byte d, byte e, byte f, + byte h, byte l, word pc, word ix, word iy) +{ + fprintf(fp, "\tAF=%02x%02x BC=%02x%02x DE=%02x%02x HL=%02x%02x\n" + "\tIX=%04x IY=%04x PC=%04x\n", + a, f, b, c, d, e, h, l, pc, ix, iy); +} + +char* parse_to_fcb(char* s, int afcb) +{ + byte* fcb = &RAM[afcb + 1]; + + RAM[afcb] = 0; + memset(fcb, ' ', 11); + + while (s[0] == ' ') /* skip leading spaces */ + { + s++; + } + while (1) + { + if (s[0] == 0) break; + if (s[0] == ' ') break; + if (s[1] == ':') + { + RAM[afcb] = s[0] - '@'; + if (RAM[afcb] > 16) RAM[afcb] -= 0x20; + s += 2; + continue; + } + if (s[0] == '.') + { + ++s; + fcb = &RAM[afcb + 9]; + continue; + } + *fcb = *s; if (islower(*fcb)) *fcb = toupper(*fcb); + ++s; + ++fcb; + if (fcb >= &RAM[afcb + 12]) break; + } + return s; +} + +void ed_fe(byte* a, byte* b, byte* c, byte* d, byte* e, byte* f, + byte* h, byte* l, word* pc, word* ix, word* iy) +{ + switch (*a) + { + case 0xC0: + cpmbdos(a, b, c, d, e, f, h, l, pc, ix, iy); + break; + + case 0xC1: + load_comfile(); + break; + + case 0xC2: + fprintf(stderr, "%s: Incompatible BIOS.BIN\n", progname); + zxcc_term(); + zxcc_exit(1); + + case 0xC3: + cpmbios(a, b, c, d, e, f, h, l, pc, ix, iy); + break; + + default: + fprintf(stderr, "%s: Z80 encountered invalid trap\n", progname); + dump_regs(stderr, *a, *b, *c, *d, *e, *f, *h, *l, *pc, *ix, *iy); + zxcc_term(); + zxcc_exit(1); + + } +} + +/* + * load_bios() loads the minimal CP/M BIOS and BDOS. + * + */ + +void load_bios(void) +{ + char dir[CPM_MAXPATH + 1], fname[CPM_MAXPATH + 1]; + char* q; + size_t bios_len; + + FILE* fp = fopen("bios.bin", "rb"); + if (!fp) + { + strcpy(fname, bindir80); + strcat(fname, "bios.bin"); + fp = fopen(fname, "rb"); + } + if (!fp) + { +#ifdef _WIN32 + dir[0] = 0; /* use strncat in case the path is very long */ + strncat(dir, _pgmptr, CPM_MAXPATH - 8); /* copy the executable path */ +#elif defined(__APPLE__) + uint32_t size = CPM_MAXPATH - 8; + _NSGetExecutablePath(dir, &size); +#else + readlink("/proc/self/exe", dir, CPM_MAXPATH - 8); /* allow room for bios.bin */ +#endif + q = strrchr(dir, DIRSEPCH); + *++q = 0; + strcpy(fname, dir); + strcat(fname, "bios.bin"); + fp = fopen(fname, "rb"); + } + if (!fp) + { + fprintf(stderr, "%s: Cannot locate bios.bin\n", progname); + zxcc_term(); + zxcc_exit(1); + } + bios_len = fread(RAM + 0xFE00, 1, 512, fp); + if (bios_len < 1 || ferror(fp)) + { + fclose(fp); + fprintf(stderr, "%s: Cannot load bios.bin\n", progname); + zxcc_term(); + zxcc_exit(1); + } + fclose(fp); + + DBGMSGV("Loaded %d bytes of BIOS\n", bios_len); +} +/* + * try_com() attempts to open file, file.com, file.COM, file.cpm and file.CPM + * + */ + +FILE* try_com(char* s) +{ + char fname[CPM_MAXPATH + 1]; + FILE* fp; + + strcpy(fname, s); + fp = fopen(s, "rb"); if (fp) return fp; + sprintf(s, "%s.com", fname); fp = fopen(s, "rb"); if (fp) return fp; + sprintf(s, "%s.COM", fname); fp = fopen(s, "rb"); if (fp) return fp; + sprintf(s, "%s.cpm", fname); fp = fopen(s, "rb"); if (fp) return fp; + sprintf(s, "%s.CPM", fname); fp = fopen(s, "rb"); if (fp) return fp; + + strcpy(s, fname); + return NULL; +} + +/* + * load_comfile() loads the COM file whose name was passed as a parameter. + * + */ + + +void load_comfile(void) +{ + size_t com_len; + char fname[CPM_MAXPATH + 1]; + FILE* fp; + + /* Look in current directory first */ + strcpy(fname, argv[1]); + fp = try_com(fname); + if (!fp) + { + strcpy(fname, bindir80); + strcat(fname, argv[1]); + fp = try_com(fname); + } + if (!fp) + { + fprintf(stderr, "%s: Cannot locate %s, %s.com, %s.COM, %s.cpm _or_ %s.CPM\n", + progname, argv[1], argv[1], argv[1], argv[1], argv[1]); + zxcc_term(); + zxcc_exit(1); + } + com_len = fread(RAM + 0x0100, 1, 0xFD00, fp); + if (com_len < 1 || ferror(fp)) + { + fclose(fp); + fprintf(stderr, "%s: Cannot load %s\n", progname, fname); + zxcc_term(); + zxcc_exit(1); + } + fclose(fp); + + /* read() can corrupt buffer area following data read if length + * of data read is less than buffer. Clean it up. */ + memset(RAM + 0x0100 + com_len, 0, 0xFD00 - com_len); + + DBGMSGV("Loaded %d bytes from %s\n", com_len, fname); +} + +unsigned int in() { return 0; } +unsigned int out() { return 0; } + +/* + * xltname: Convert a unix filepath into a CP/M compatible drive:name form. + * The unix filename must be 8.3 or the CP/M code will reject it. + * + * This uses the library xlt_name to do the work, and then just strcat()s + * the result to the command line. + */ + +void zxcc_xltname(char* name, char* pcmd) +{ + char nbuf[CPM_MAXPATH + 1]; + + xlt_name(pcmd, nbuf); + + strcat(name, nbuf); +} + +/* main() parses the arguments to CP/M form. argv[1] is the name of the CP/M + program to load; the remaining arguments are arguments for the CP/M program. + + main() also loads the vestigial CP/M BIOS and does some sanity checks + on the endianness of the host CPU and the sizes of data types. + */ + +int main(int ac, char** av) +{ + int n; + char* pCmd, * str; + char* tmpenv; + + argc = ac; + argv = av; +#ifdef __PACIFIC__ /* Pacific C doesn't support argv[0] */ + progname = "ZXCC"; +#endif + progname = argv[0]; + + /* DJGPP includes the whole path in the program name, which looks + * untidy... + */ + while ((str = strpbrk(progname, DIRSEP))) + progname = str + 1; + +#ifdef DEBUG + fprintf(stderr, "\n\n"); + DBGMSG("Start of execution: "); + for (n = 0; n < argc; n++) + fprintf(stderr, " %s", argv[n]); + fprintf(stderr, "\n"); +#endif + + term_init(); + + if (sizeof(int) > 8 || sizeof(byte) != 1 || sizeof(word) != 2) + { + fprintf(stderr, "%s: type lengths incorrect; edit typedefs " + "and recompile.\n", progname); + zxcc_exit(1); + } + + if (argc < 2) + { + fprintf(stderr, "%s: No CP/M program name provided.\n", progname); + zxcc_exit(1); + } + + /* Parse arguments. An argument can be either: + + * preceded by a '-', in which case it is copied in as-is, less the + dash; + * preceded by a '+', in which case it is parsed as a filename and + then concatenated to the previous argument; + * preceded by a '+-', in which case it is concatenated without + parsing; + * not preceded by either, in which case it is parsed as a filename. + + So, the argument string "--a -b c +-=q --x +/dev/null" would be rendered + into CP/M form as "-a b p:c=q -xd:null" */ + + if (!fcb_init()) + { + fprintf(stderr, "Could not initialise CPMREDIR library\n"); + zxcc_exit(1); + } + +#ifdef FILETRACKER + DBGMSG("File tracking is ENABLED\n"); +#else + DBGMSG("File tracking is DISABLED\n"); +#endif + + /* allow environment variables to override default locations */ + /* two options are supported, explicit overrides for each directory + * (BINDIR80, LIBDIR80, INCDIR80) + * or a common directory prefix override (CPMDIR80) + * the explict override takes precedence + */ + if ((tmpenv = getenv("CPMDIR80"))) { + mkpath(bindir80, tmpenv, BIN80); /* use CPMDIR80 & std subdirs */ + mkpath(libdir80, tmpenv, LIB80); + mkpath(incdir80, tmpenv, INC80); + } + if ((tmpenv = getenv("BINDIR80"))) + mkpath(bindir80, tmpenv, ""); + + if ((tmpenv = getenv("LIBDIR80"))) + mkpath(libdir80, tmpenv, ""); + + if ((tmpenv = getenv("INCDIR80"))) + mkpath(incdir80, tmpenv, ""); + + DBGMSGV("BINDIR80=\"%s\"\n", bindir80); + DBGMSGV("LIBDIR80=\"%s\"\n", libdir80); + DBGMSGV("INCDIR80=\"%s\"\n", incdir80); + + xlt_map(0, bindir80); /* Establish the 3 fixed mappings */ + xlt_map(1, libdir80); + xlt_map(2, incdir80); + + pCmd = (char*)RAM + 0x81; + + for (n = 2; n < argc; n++) + { + if (argv[n][0] == '+' && argv[n][1] == '-') + { + /* Append, no parsing */ + strcat(pCmd, argv[n] + 2); + } + else if (!argv[n][0] || argv[n][0] == '-') + { + /* Append with space; no parsing. */ + strcat(pCmd, " "); + strcat(pCmd, argv[n] + 1); + } + else if (argv[n][0] == '+') + { + zxcc_xltname(pCmd, argv[n] + 1); + } + else /* Translate a filename */ + { + strcat(pCmd, " "); + zxcc_xltname(pCmd, argv[n]); + } + + } + pCmd[0x7F] = 0; /* Truncate to fit the buffer */ + RAM[0x80] = (byte)strlen(pCmd); + + str = parse_to_fcb(pCmd, 0x5C); + parse_to_fcb(str, 0x6C); + + // This statement is very useful when creating a client like zxc or zxas + DBGMSGV("Command tail is \"%s\"\n", pCmd); + + load_bios(); + + memset(RAM + 0xFE9C, 0, 0x64); /* Zap the SCB */ + RAM[0xFE98] = 0x06; + RAM[0xFE99] = 0xFE; /* FE06, BDOS entry */ + RAM[0xFEA1] = 0x31; /* BDOS 3.1 */ + RAM[0xFEA8] = 0x01; /* UK date format */ + RAM[0xFEAF] = 0x0F; /* CCP drive */ + +#ifdef USE_CPMIO + RAM[0xFEB6] = cpm_term_direct(CPM_TERM_WIDTH, -1); + RAM[0xFEB8] = cpm_term_direct(CPM_TERM_HEIGHT, -1); +#else + RAM[0xFEB6] = 79; + RAM[0xFEB8] = 23; +#endif + RAM[0xFED1] = 0x80; /* Buffer area */ + RAM[0xFED2] = 0xFF; + RAM[0xFED3] = '$'; + RAM[0xFED6] = 0x9C; + RAM[0xFED7] = 0xFE; /* SCB address */ + RAM[0xFED8] = 0x80; /* DMA address */ + RAM[0xFED9] = 0x00; + RAM[0xFEDA] = 0x0F; /* P: */ + RAM[0xFEE6] = 0x01; /* Multi sector count */ + RAM[0xFEFE] = 0x06; + RAM[0xFEFF] = 0xFE; /* BDOS */ + + cpm_drive = 0x0F; /* Start logged into P: */ + cpm_user = 0; /* and user 0 */ + +#ifdef USE_CPMIO + cpm_scr_init(); deinit_term = 1; +#endif +#ifdef USE_CPMGSX + gsx_init(); deinit_gsx = 1; +#endif + + /* Start the Z80 at 0xFF00, with stack at 0xFE00 */ + mainloop(0xFF00, 0xFE00); + + return zxcc_term(); +} + +void zxcc_exit(int code) +{ +#ifdef USE_CPMIO + if (deinit_term) cpm_scr_unit(); +#endif +#ifdef USE_CPMGSX + if (deinit_gsx) gsx_deinit(); +#endif + exit(code); +} + +int zxcc_term(void) +{ + word n; + + //n = RAM[0x81]; /* Get the return code. This is Hi-Tech C */ + //n = (n << 8) | RAM[0x80]; /* specific and fails with other COM files */ + n = 0; + + putchar('\n'); + + if (cpm_error != 0) /* The CP/M "set return code" call was used */ + { /* (my modified Hi-Tech C library uses this */ + n = cpm_error; /* call) */ + } + + if (n < 256 || n == 0xFFFF) + DBGMSGV("Return code %d\n", n); + else + n = 0; + + term_reset(); + + return n; +} + +/* helper function to build full path */ +/* make sure that a / or \ is present at the end of path + * before appending the subdir + */ +static void mkpath(char* fullpath, char* path, char* subdir) { + char* s; + strcpy(fullpath, path); + s = strchr(fullpath, '\0'); + if (*fullpath && !ISDIRSEP(s[-1])) /* make sure we have dir sep */ + *s++ = '/'; + strcpy(s, subdir); +} + +#ifndef _WIN32 + +void raw_init(void) +{ + struct termios tc_raw; + + DBGMSG("Enabling RAW Terminal IO\n"); + + if (tcgetattr(STDIN_FILENO, &tc_orig) == -1) + { + DBGMSG("Failed to enable RAW Terminal IO - tcgetattr() failed\n"); + zxcc_exit(1);; + } + + //tc_raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); + //tc_raw.c_oflag &= ~(OPOST); + //tc_raw.c_cflag |= (CS8); + //tc_raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); + //tc_raw.c_cc[VMIN] = 1; + //tc_raw.c_cc[VTIME] = 0; + + tc_raw.c_iflag &= ~(ICRNL | INPCK | ISTRIP | IXON); + tc_raw.c_oflag &= ~(OPOST); + tc_raw.c_cflag |= (CS8); + tc_raw.c_lflag &= ~(ECHO | ICANON | IEXTEN); + tc_raw.c_cc[VMIN] = 1; + tc_raw.c_cc[VTIME] = 0; + + if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &tc_raw) == -1) + { + DBGMSG("Failed to enable RAW Terminal IO - tcsetattr() failed\n"); + zxcc_exit(1); + } + + DBGMSG("Enabled RAW Terminal IO\n"); + + return; +} + +void deinit_raw(void) +{ + if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &tc_orig) == -1) + { + DBGMSG("Failed to disable RAW Terminal IO - tcsetattr() failed\n"); + return; + } + + DBGMSG("Disabled RAW Terminal IO\n"); + + return; +} + +#endif + +void term_init(void) +{ +#ifdef _WIN32 + setmode(STDIN_FILENO, O_BINARY); + setmode(STDOUT_FILENO, O_BINARY); +#else + if (_isatty(STDIN_FILENO)) + raw_init(); +#endif + + if (_isatty(STDIN_FILENO)) + DBGMSG("Using interactive console mode\n"); + else + DBGMSG("Using standard input/output mode\n"); + + return; +} + +void term_reset(void) +{ +#ifndef _WIN32 + if (_isatty(STDIN_FILENO)) + deinit_raw(); +#endif +} diff --git a/Tools/unix/zxcc/zxcc.doc b/Tools/unix/zxcc/zxcc.doc new file mode 100644 index 00000000..2f30a1ac --- /dev/null +++ b/Tools/unix/zxcc/zxcc.doc @@ -0,0 +1,207 @@ + zxcc v0.5.7 + + zxcc 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). + + 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) + +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 [1]ZMAC assembler (downloadable from + ). + + Previous versions of ZXCC 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 zxcc 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 <[2]http://www.hitech.com.au> or Digital Research's tools at + <[3]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. zxcc 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 zxcc.h and uncommenting the + lines that redefine them. + + Once you have installed zxcc and the build tools, try building Hello + World: + + #include + 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 + + zxcc hello.com + + . + + To assemble the second example, type + + zxcc rmac.com hello + zxcc 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. + +Using zxcc + + For detailed instructions, see the documentation for Hi-Tech C or the + CP/M tools. zxcc behaves in the same way, but note the following + points: + + Program names + + 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: + + zxc + The equivalent of C.COM. + + zxas + The equivalent of ZAS.COM. + + zxlink + The equivalent of LINK.COM. + + zxlibr + The equivalent of LIBR.COM. + + All these programs work by converting their arguments to a form + suitable for zxcc, and then invoking zxcc. + + There are no front-end programs for the CP/M build tools; you will have + to enter arguments to these in the zxcc format given below. + + Filenames + + 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/ + +Technical + + zxcc 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. + + zxcc 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 zxcc is: + + zxcc comfile.com arg1 arg2 ... + + The comfile is the program to run; zxcc 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: + + zxcc 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 zxcc. + +Errors + + Any errors raised by the zxcc runtime system will be prefixed with + zxcc:. 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 zxcc 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 + +References + + 1. http://www.nenie.org/cpcip/index.html#zmac + 2. http://www.hitech.com.au/ + 3. http://www.cpm.z80.de/ diff --git a/Tools/unix/zxcc/zxcc.h b/Tools/unix/zxcc/zxcc.h new file mode 100644 index 00000000..d60cd1ba --- /dev/null +++ b/Tools/unix/zxcc/zxcc.h @@ -0,0 +1,141 @@ +/* + * Change the directories in these #defines if necessary. Note trailing slash. + */ +#ifndef _WIN32 + #include "config.h" + #define ISDIRSEP(c) ((c) == '/') + #define DIRSEPCH '/' + #define DIRSEP "/" +#else + #include "config.h" + #define ISDIRSEP(c) ((c) == '/' || (c) == '\\') + #define DIRSEPCH '\\' + #define DIRSEP "/\\:" +#endif + +#ifndef CPMDIR80 + #ifdef _WIN32 + #define CPMDIR80 "d:/local/lib/cpm/" + #else + #define CPMDIR80 "/usr/local/lib/cpm/" + #endif +#endif + +/* the default sub directories trailing / is required */ +#ifdef _WIN32 + #define BIN80 "bin80\\" + #define LIB80 "lib80\\" + #define INC80 "include80\\" +#else + #define BIN80 "bin80/" + #define LIB80 "lib80/" + #define INC80 "include80/" +#endif + +#ifndef BINDIR80 + #define BINDIR80 CPMDIR80 BIN80 +#endif +#ifndef LIBDIR80 + #define LIBDIR80 CPMDIR80 LIB80 +#endif +#ifndef INCDIR80 + #define INCDIR80 CPMDIR80 INC80 +#endif + +extern char bindir80[]; +extern char libdir80[]; +extern char incdir80[]; + +#define SERIAL "ZXCC05" + +/* System include files */ + +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H + #include +#endif +#ifdef _WIN32 + #include + #include + #include + #define strcasecmp _stricmp + #ifndef STDIN_FILENO + #define STDIN_FILENO _fileno(stdin) + #define STDOUT_FILENO _fileno(stdout) + #define STDERR_FILENO _fileno(stderr) + #endif +#else + #include + #define _isatty(a) isatty(a) + #define _fileno(a) fileno(a) +#endif +#include +#include +#ifdef __MSDOS + #include +#endif +#ifndef _WIN32 + #include + #include + #define _S_IFDIR S_IFDIR +#endif + +/* Library includes */ + +#ifdef USE_CPMIO + #include "cpmio.h" +#endif + +#ifdef USE_CPMGSX + #include "cpmgsx.h" +#endif + +typedef unsigned char byte; /* Must be exactly 8 bits */ +typedef unsigned short word; /* Must be exactly 16 bits */ + +#include "cpmredir.h" /* BDOS disc simulation */ + +/* Prototypes */ + +void ed_fe (byte *a, byte *b, byte *c, byte *d, byte *e, byte *f, + byte *h, byte *l, word *pc, word *ix, word *iy); +void cpmbdos(byte *a, byte *b, byte *c, byte *d, byte *e, byte *f, + byte *h, byte *l, word *pc, word *ix, word *iy); +void cpmbios(byte *a, byte *b, byte *c, byte *d, byte *e, byte *f, + byte *h, byte *l, word *pc, word *ix, word *iy); +void dump_regs(FILE *fp, byte a, byte b, byte c, byte d, byte e, byte f, + byte h, byte l, word pc, word ix, word iy); +void Msg(char *s, ...); +void DbgMsg(const char *file, int line, const char *func, char *s, ...); +int zxcc_term(void); +void zxcc_exit(int code); + +void term_init(void); +void term_reset(void); + +#ifdef DEBUG + #define DBGMSGV(s, ...) DbgMsg(__FILE__, __LINE__, __func__, s, __VA_ARGS__) + #define DBGMSG(s) DbgMsg(__FILE__, __LINE__, __func__, s) + +#else + #define DBGMSGV(s, ...) + #define DBGMSG(s) +#endif + +/* Global variables */ + +extern char *progname; +extern char **argv; +extern int argc; +extern byte RAM[65536]; /* The Z80's address space */ + +/* Z80 CPU emulation */ + +#include "z80.h" diff --git a/Tools/unix/zxcc/zxcc.html b/Tools/unix/zxcc/zxcc.html new file mode 100644 index 00000000..502d8777 --- /dev/null +++ b/Tools/unix/zxcc/zxcc.html @@ -0,0 +1,200 @@ +zxcc v0.5.7 + +

zxcc v0.5.7

+ +

zxcc 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). + +

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) +
+ +

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 ZXCC 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 zxcc 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. zxcc 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 zxcc.h and uncommenting the lines +that redefine them. + +

Once you have installed zxcc 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
zxcc hello.com
. + +

To assemble the second example, type +

+ zxcc rmac.com hello
+ zxcc 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. + +

Using zxcc

+ +

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

Program names

+ +

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: + +
+
zxc
The equivalent of C.COM. +
zxas
The equivalent of ZAS.COM. +
zxlink
The equivalent of LINK.COM. +
zxlibr
The equivalent of LIBR.COM. +
+ +

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

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

Filenames

+ +

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/
+ +

Technical

+ +

zxcc 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. +

zxcc 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 zxcc is: + +

+ zxcc comfile.com arg1 arg2 ... +
+ +

The comfile is the program to run; zxcc 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: +

+ zxcc 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 zxcc. + +

Errors

+ +

Any errors raised by the zxcc runtime system will be prefixed +with zxcc:. 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 zxcc 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
+ + diff --git a/Tools/unix/zxcc/zxdbdos.c b/Tools/unix/zxcc/zxdbdos.c new file mode 100644 index 00000000..9a839e5e --- /dev/null +++ b/Tools/unix/zxcc/zxdbdos.c @@ -0,0 +1,91 @@ +#include "zxcc.h" +#include "zxbdos.h" +#include "zxdbdos.h" + +/* This file used to deal with all disc-based BDOS calls. + Now the calls have been moved into libcpmredir, it's a bit empty round + here. + + ZXCC does a few odd things when searching, to make Hi-Tech C behave + properly. +*/ + +/* If a file could not be found on the default drive, try again on a "search" + drive (A: for .COM files, B: for .LIB and .OBJ files) */ + +int fcbforce(byte* fcb, byte* odrv) +{ + byte drive; + char nam[9]; + char typ[4]; + int n; + + for (n = 0; n < 8; n++) nam[n] = fcb[n + 1] & 0x7F; + nam[8] = 0; + for (n = 0; n < 3; n++) typ[n] = fcb[n + 9] & 0x7F; + typ[3] = 0; + + drive = 0; + if (*fcb) return 0; /* not using default drive */ + + /* Microsoft BASIC compiler run-time */ + if (!strcmp(nam, "BCLOAD ") && !strcmp(typ, " ")) drive = 2; + + /* HI-TECH C options help file */ + if (!strcmp(nam, "OPTIONS ") && !strcmp(typ, " ")) drive = 1; + + /* binaries, libraries and object files */ + if (!strcmp(typ, "COM")) drive = 1; + if (!strcmp(typ, "LIB")) drive = 2; + if (!strcmp(typ, "OBJ")) drive = 2; + + /* some extras for messages, overlays, includes */ + if (!strcmp(typ, "HLP")) drive = 1; + if (!strcmp(typ, "MSG")) drive = 1; + if (!strcmp(typ, "OVR")) drive = 1; + if (!strcmp(typ, "REL")) drive = 2; + if (!strcmp(typ, "H ")) drive = 3; + + if (!drive) return 0; + + *odrv = *fcb; + *fcb = drive; + return 1; +} + +/* zxcc has a trick with some filenames: If it can't find them where they + should be, and a drive wasn't specified, it searches BINDIR80, + LIBDIR80 or INCDIR80 (depending on the type of the file). + */ + +word x_fcb_open(byte* fcb, byte* dma) +{ + word rv = fcb_open(fcb, dma); + byte odrv; + + if (rv == 0xFF) + { + if (fcbforce(fcb, &odrv)) + { + rv = fcb_open(fcb, dma); + *fcb = odrv; + } + } + return rv; +} + +word x_fcb_stat(byte* fcb) +{ + word rv = fcb_stat(fcb); + byte odrv; + + if (rv == 0xFF) + { + if (fcbforce(fcb, &odrv)) + { + rv = fcb_stat(fcb); + *fcb = odrv; + } + } + return rv; +} diff --git a/Tools/unix/zxcc/zxdbdos.h b/Tools/unix/zxcc/zxdbdos.h new file mode 100644 index 00000000..16bcde18 --- /dev/null +++ b/Tools/unix/zxcc/zxdbdos.h @@ -0,0 +1,4 @@ +int fcbforce(byte* fcb, byte* odrv); + +word x_fcb_open(byte* fcb, byte* dma); +word x_fcb_stat(byte* fcb); diff --git a/Tools/zx/COPYING b/Tools/zx/COPYING deleted file mode 100644 index a43ea212..00000000 --- a/Tools/zx/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - 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 deleted file mode 100644 index 90a7b1c3..00000000 --- a/Tools/zx/ReadMe.txt +++ /dev/null @@ -1,12 +0,0 @@ -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/bios.bin b/Tools/zx/bios.bin deleted file mode 100644 index b20e62d9..00000000 Binary files a/Tools/zx/bios.bin and /dev/null differ diff --git a/Tools/zx/zx-src.zip b/Tools/zx/zx-src.zip deleted file mode 100644 index cb9e929a..00000000 Binary files a/Tools/zx/zx-src.zip and /dev/null differ diff --git a/Tools/zx/zx.exe b/Tools/zx/zx.exe deleted file mode 100644 index bde1d36f..00000000 Binary files a/Tools/zx/zx.exe and /dev/null differ diff --git a/Tools/zx/zx.html b/Tools/zx/zx.html deleted file mode 100644 index b425ee1e..00000000 --- a/Tools/zx/zx.html +++ /dev/null @@ -1,131 +0,0 @@ -zx CP/M Command Line Emulator - -

zx CP/M Command Line Emulator

- -

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:

- -
    -
  • 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)
  • -
- -

Usage

- -

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:

- -
zx rmac hello
- -

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.

- -

Filenames

- -

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.

- -

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/
- -

Technical

- -

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.

- -

Syntax for zx is:

- -
-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 -
- -

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.
-
- -

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 deleted file mode 100644 index 11a5864d..00000000 Binary files a/Tools/zx/zxdbg.exe and /dev/null differ diff --git a/Tools/zxcc/COPYING b/Tools/zxcc/COPYING new file mode 100644 index 00000000..92851102 --- /dev/null +++ b/Tools/zxcc/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/zxcc/ReadMe.txt b/Tools/zxcc/ReadMe.txt new file mode 100644 index 00000000..ba94bf5d --- /dev/null +++ b/Tools/zxcc/ReadMe.txt @@ -0,0 +1,86 @@ +This is an adaptation of zxcc-0.5.7 for RomWBW by Wayne Warthen. + +In general, this is a stripped down variant of John Elliott's zxcc package that +runs under a Windows command line (32 or 64 bit Windows), Linux, or MacOS. +This adaptation implements only the main "zxcc" command. The other programs +(zxc, zxas, zxlink, and zslibr) are not inluded here because they are fairly +specific to Hi-Tech C. + +Please see http://www.seasip.info/Unix/Zxcc/ for more information on the original +version of zxcc. Also, refer to https://github.com/agn453/ZXCC which has an +updated version of the code. + +The included zxcc.html documentation is from the original version, so it does not +reflect the changes made here. + +To build under Open Watcom, use Build-OW.cmd. To build under Microsoft Visual C, +use Build-VC.cmd. To build under Linux or MacOS, use the Makefile. + +The GPL status of everything remains in place and carries forward. + +December 5, 2014 + +After struggling to get the entire zxcc package to build nicely using autoconf, +I finally gave up and took a much more direct approach. I have extracted just +the source files needed and created a simple batch file to build the tool. I +realize this could be done much better, but I cheated in the interest of time. + +The one "real" change I made in the source code was that I modified the tool +to look for bios.bin in the same directory as the executable is in. This +just makes it much easier to set up (for me, anyway). + +Wayne Warthen +wwarthen@gmail.com + +March 15, 2017 + +- Updated to compile under Open Watcom. +- Implemented BDOS console status function. +- Set stdin and stdout to binary mode at startup. + +August 21, 2021 + +- Incorporated filename case insensitivity changes from Curt Mayer +- Incorporated fixes from Tony Nicholson at https://github.com/agn453/ZXCC + - Emulation of CP/M BDOS function 60 (call resident system extension) + should be disabled and return 0xFF in both the A and L registers. + - Change cpm_bdos_10() to return an unsigned result to avoid buffer + size being interpreted as negative. + - Fix the emulation of Z80 opcodes for IN (HL),(C) and + OUT (C),(HL) - opcodes 0xED,0x70 and 0xED,0x71 respectively. + This is noted in Fred Weigel's AM9511 arithmetic processing unit + emulation from https://github.com/ratboy666/am9511 in the howto.txt + description. NB: I have not included Fred's am9511 support at this + time into ZXCC. +- Fixed parse_to_fcb function in zxcc.c to handle parsing second automatic + FCB from command line + +Wayne Warthen +wwarthen@gmail.com + +--WBW 4:09 PM 8/21/2021 + +January 9, 2022 + +- Running zxcc under WSL (Windows Subsystem for Linux) was gererating output + that was correct but did not match standard Windows or Linux runs. This + turned out to be an assumption in a few places in the code that reading + into a buffer would not modify the area of the buffer that was beyond + the space required by the data being read. Under WSL, this "slack" space + was mangled. I made changes in these locations to clean up the slack + space after such reads. This fixed WSL runs to produce binary identical + output. Although only required by WSL, the changes cause no problems for + other environments and are actually correct per POSIX. + +--WBW 11:56 AM 1/9/2022 + +- I have attempted to sync my code up with the latest code found in Tony + Nicholson's GitHub repo at https://github.com/agn453/ZXCC. The most + significant difference in my code is that I am using the WIN32 API + for all disk I/O. Although the file tracking code is retained, I have + found this mechanism to fail insome scenarios. By using the WIN32 API + I can achieve the same file sharing attributes as Unix which makes the + file tracking mechanism optional. + +--WBW 9:34 AM 2/10/2022 + diff --git a/Tools/unix/zx/cpm/bios.bin b/Tools/zxcc/bios.bin similarity index 100% rename from Tools/unix/zx/cpm/bios.bin rename to Tools/zxcc/bios.bin diff --git a/Tools/zxcc/zxcc-src.zip b/Tools/zxcc/zxcc-src.zip new file mode 100644 index 00000000..9f6a04cf Binary files /dev/null and b/Tools/zxcc/zxcc-src.zip differ diff --git a/Tools/zxcc/zxcc.exe b/Tools/zxcc/zxcc.exe new file mode 100644 index 00000000..fa4df35f Binary files /dev/null and b/Tools/zxcc/zxcc.exe differ diff --git a/Tools/zxcc/zxcc.html b/Tools/zxcc/zxcc.html new file mode 100644 index 00000000..502d8777 --- /dev/null +++ b/Tools/zxcc/zxcc.html @@ -0,0 +1,200 @@ +zxcc v0.5.7 + +

zxcc v0.5.7

+ +

zxcc 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). + +

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) +
+ +

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 ZXCC 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 zxcc 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. zxcc 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 zxcc.h and uncommenting the lines +that redefine them. + +

Once you have installed zxcc 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
zxcc hello.com
. + +

To assemble the second example, type +

+ zxcc rmac.com hello
+ zxcc 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. + +

Using zxcc

+ +

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

Program names

+ +

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: + +
+
zxc
The equivalent of C.COM. +
zxas
The equivalent of ZAS.COM. +
zxlink
The equivalent of LINK.COM. +
zxlibr
The equivalent of LIBR.COM. +
+ +

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

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

Filenames

+ +

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/
+ +

Technical

+ +

zxcc 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. +

zxcc 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 zxcc is: + +

+ zxcc comfile.com arg1 arg2 ... +
+ +

The comfile is the program to run; zxcc 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: +

+ zxcc 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 zxcc. + +

Errors

+ +

Any errors raised by the zxcc runtime system will be prefixed +with zxcc:. 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 zxcc 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
+ + diff --git a/Tools/zxcc/zxcc_ft.exe b/Tools/zxcc/zxcc_ft.exe new file mode 100644 index 00000000..9f8c9838 Binary files /dev/null and b/Tools/zxcc/zxcc_ft.exe differ diff --git a/Tools/zxcc/zxccdbg.exe b/Tools/zxcc/zxccdbg.exe new file mode 100644 index 00000000..7a8a7388 Binary files /dev/null and b/Tools/zxcc/zxccdbg.exe differ diff --git a/Tools/zxcc/zxccdbg_ft.exe b/Tools/zxcc/zxccdbg_ft.exe new file mode 100644 index 00000000..aa6a6c0f Binary files /dev/null and b/Tools/zxcc/zxccdbg_ft.exe differ

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.