Browse Source

Introducing p-System IV.0 for RomWBW

A full implementation of UCSD p-System IV.0 for RomWBW.  Derived from the official Z80 Adaptable p-System.

My first real programming was on this system.  So many memories...
pull/331/head v3.1.1-pre.192
Wayne Warthen 3 years ago
parent
commit
979e763739
  1. 30
      Binary/ReadMe.txt
  2. 1
      Doc/ChangeLog.txt
  3. BIN
      Doc/ROM Applications.pdf
  4. BIN
      Doc/RomWBW Applications.pdf
  5. BIN
      Doc/RomWBW Architecture.pdf
  6. BIN
      Doc/RomWBW Disk Catalog.pdf
  7. BIN
      Doc/RomWBW Getting Started.pdf
  8. BIN
      Doc/UCSD p-System Users Manual.pdf
  9. BIN
      Doc/qcp27.pdf
  10. BIN
      Doc/qdos27.pdf
  11. BIN
      Doc/qpm27.pdf
  12. 70
      ReadMe.md
  13. 73
      ReadMe.txt
  14. 1
      Source/BuildShared.cmd
  15. 1
      Source/Clean.cmd
  16. 72
      Source/Doc/GettingStarted.md
  17. 1
      Source/Makefile
  18. 37
      Source/pSys/Build.cmd
  19. 6
      Source/pSys/Clean.cmd
  20. 11
      Source/pSys/Makefile
  21. 100
      Source/pSys/ReadMe.txt
  22. 371
      Source/pSys/bios.asm
  23. BIN
      Source/pSys/biostest.dat
  24. BIN
      Source/pSys/blank.vol
  25. BIN
      Source/pSys/boot.dat
  26. BIN
      Source/pSys/fill.dat
  27. 375
      Source/pSys/loader.asm
  28. 32
      Source/pSys/psys.inc
  29. BIN
      Source/pSys/psys.vol
  30. 2
      Source/ver.inc
  31. 2
      Source/ver.lib
  32. 1
      Tools/simh/Sim.cfg

30
Binary/ReadMe.txt

@ -75,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,
@ -96,16 +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 hd1024_*.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.
WARNING: The hdnew_*.img disk images are part of a new disk
format that is a work in progress. Do not use these disk
images without knowing exactly what you are doing! The
hd_*.img disk images continue to be the images you should
be using under normal circumstances.
NOTE: The hd512_*.img files are equivalent to the hd_*.img
files in previous distributions. The hd1024_*.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.
@ -115,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)
-------------------------------

1
Doc/ChangeLog.txt

@ -67,6 +67,7 @@ Version 3.1.1
- 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
Version 3.1
-----------

BIN
Doc/ROM Applications.pdf

Binary file not shown.

BIN
Doc/RomWBW Applications.pdf

Binary file not shown.

BIN
Doc/RomWBW Architecture.pdf

Binary file not shown.

BIN
Doc/RomWBW Disk Catalog.pdf

Binary file not shown.

BIN
Doc/RomWBW Getting Started.pdf

Binary file not shown.

BIN
Doc/UCSD p-System Users Manual.pdf

Binary file not shown.

BIN
Doc/qcp27.pdf

Binary file not shown.

BIN
Doc/qdos27.pdf

Binary file not shown.

BIN
Doc/qpm27.pdf

Binary file not shown.

70
ReadMe.md

@ -3,7 +3,7 @@
## Z80/Z180 System Software
Version 3.1 Pre-release
01 Jan 2023
13 Jan 2023
Wayne Warthen <wwarthen@gmail.com>
@ -664,6 +664,11 @@ 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.
A full implementation of the UCSD p-System for Z80 under RomWBW is also
provided. This is a completely separate and standalone disk image called
psys.img. It contains 6 p-System filesystem slices, but these are not
interoperable with the CP/M slices described above.
## Booting Disks
When starting your system, following the hardware initialization, you
@ -845,6 +850,69 @@ tracks of the disk.
I believe it was done this way to make it easier for users to
transition from CP/M 3 to ZPM3.
## QPM
QPM is another OS providing compatibility with and enhancements to CP/M
2.2. It is provided as bootable disk images for RomWBW.
The following documentation files from the original QPM distribution are
included in the RomWBW Doc directory:
- QP/M 2.7 Features and Facilities (qcp27.pdf)
- QP/M 2.7 Interface Guide (qdos27.pdf)
- QP/M 2.7 Installation Guide and Supplements (qpm27.pdf)
Refer to the ReadMe.txt file in Source/Images/d_qpm for more details
regarding the RomWBW adaptation and customizations.
### 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/Image/d_qpm before making changes.
## 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 it’s 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 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 it’s own dedicated hard disk media (CF Card, SD Card,
etc.). It is booted by selecting slices 0 of the corresponding hard disk
unit at the RomWBW Boot Loader prompt.
The p-System Users Manual is included in the Doc directory of the
distribution as “UCSD p-System Users Manual.pdf”.
Refer to the ReadMe.txt file in Source/pSys for more details.
### 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 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.
- 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

73
ReadMe.txt

@ -1,6 +1,6 @@
RomWBW Getting Started
Wayne Warthen (mailto:wwarthen@gmail.com)
01 Jan 2023
13 Jan 2023
@ -17,7 +17,7 @@ RomWBW
Z80/Z180 System Software
Version 3.1 Pre-release
01 Jan 2023
13 Jan 2023
Wayne Warthen wwarthen@gmail.com
@ -736,6 +736,11 @@ 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.
A full implementation of the UCSD p-System for Z80 under RomWBW is also
provided. This is a completely separate and standalone disk image called
psys.img. It contains 6 p-System filesystem slices, but these are not
interoperable with the CP/M slices described above.
Booting Disks
When starting your system, following the hardware initialization, you
@ -916,6 +921,70 @@ Notes
distribution. I believe it was done this way to make it easier for
users to transition from CP/M 3 to ZPM3.
QPM
QPM is another OS providing compatibility with and enhancements to CP/M
2.2. It is provided as bootable disk images for RomWBW.
The following documentation files from the original QPM distribution are
included in the RomWBW Doc directory:
- QP/M 2.7 Features and Facilities (qcp27.pdf)
- QP/M 2.7 Interface Guide (qdos27.pdf)
- QP/M 2.7 Installation Guide and Supplements (qpm27.pdf)
Refer to the ReadMe.txt file in Source/Images/d_qpm for more details
regarding the RomWBW adaptation and customizations.
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/Image/d_qpm before making changes.
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 it’s 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 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 it’s own dedicated hard disk media (CF Card, SD Card,
etc.). It is booted by selecting slices 0 of the corresponding hard disk
unit at the RomWBW Boot Loader prompt.
The p-System Users Manual is included in the Doc directory of the
distribution as “UCSD p-System Users Manual.pdf”.
Refer to the ReadMe.txt file in Source/pSys for more details.
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 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.
- 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

1
Source/BuildShared.cmd

@ -9,6 +9,7 @@ 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

1
Source/Clean.cmd

@ -10,6 +10,7 @@ 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

72
Source/Doc/GettingStarted.md

@ -684,6 +684,11 @@ 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.
A full implementation of the UCSD p-System for Z80 under RomWBW is also
provided. This is a completely separate and standalone disk image
called psys.img. It contains 6 p-System filesystem slices, but these
are not interoperable with the CP/M slices described above.
## Booting Disks
When starting your system, following the hardware initialization, you
@ -869,6 +874,73 @@ 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.
## QPM
QPM is another OS providing compatibility with and enhancements
to CP/M 2.2. It is provided as bootable disk images for RomWBW.
The following documentation files from the original QPM distribution
are included in the RomWBW Doc directory:
- QP/M 2.7 Features and Facilities (qcp27.pdf)
- QP/M 2.7 Interface Guide (qdos27.pdf)
- QP/M 2.7 Installation Guide and Supplements (qpm27.pdf)
Refer to the ReadMe.txt file in Source/Images/d_qpm for more details
regarding the RomWBW adaptation and customizations.
### 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/Image/d_qpm before making changes.
## 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 it's
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 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 it's own dedicated hard
disk media (CF Card, SD Card, etc.). It is booted by
selecting slices 0 of the corresponding hard disk unit at
the RomWBW Boot Loader prompt.
The p-System Users Manual is included in the Doc directory
of the distribution as "UCSD p-System Users Manual.pdf".
Refer to the ReadMe.txt file in Source/pSys for more details.
### 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 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.
- 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

1
Source/Makefile

@ -10,6 +10,7 @@ SUBDIRS += TastyBasic
SUBDIRS += Fonts
SUBDIRS += CPM22 ZCPR ZCPR-DJ ZSDOS CPM3 ZPM3
#SUBDIRS += BPBIOS
SUBDIRS += pSys
SUBDIRS += RomDsk
SUBDIRS += HBIOS
SUBDIRS += Images

37
Source/pSys/Build.cmd

@ -0,0 +1,37 @@
@echo off
setlocal
set TOOLS=../../Tools
set PATH=%TOOLS%\tasm32;%PATH%
set TASMTABS=%TOOLS%\tasm32
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 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 Creating p-System BIOS Tester boot image
::echo.
::copy /b loader.bin + bios.bin + biostest.dat psys.bin
echo.
echo Generating p-System Boot Track...
echo.
copy /b loader.bin + bios.bin + boot.dat + fill.dat trk0.bin || exit /b
echo.
echo Generating p-System Disk Image...
echo.
copy /b trk0.bin + psys.vol + trk0.bin + blank.vol psys.img || exit /b
copy psys.img ..\..\Binary || exit /b

6
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

11
Source/pSys/Makefile

@ -0,0 +1,11 @@
OBJECTS = psys.img
TOOLS = ../../Tools
DEST = ../../Binary
OTHERS = *.bin *.lst *.img
include $(TOOLS)/Makefile.inc
trk0.bin: loader.bin bios.bin boot.dat fill.dat
cat loader.bin bios.bin boot.dat fill.dat > trk0.bin
psys.img: trk0.bin psys.vol blank.vol
cat trk0.bin psys.vol trk0.bin blank.vol > psys.img

100
Source/pSys/ReadMe.txt

@ -0,0 +1,100 @@
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 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.dat used to complete the track 0 build (see below)
Notes:
This adatation runs on a single RomWBWW HBIOS hard disk
type device (CF Cart, SD Card, IDE drive, etc.). The
image built (psys.img) should be copied to your disk media
start 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 sector p-System BIOS for RomWBW HBIOS
- 4 sector p-System bootstrap
- 7 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
simply slilghtly 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. Note that
the tester fails for the BIOS as is. After a lot of
code tracing, a definite bug was identified in the
tester that exists for 512 byte sectors (which are
supported). When the BIOS is modified to use 128 or
256 byte sectors, the tester completes perfectly.
Significant use of the BIOS shows there are no issues
for a normal running system with 512 byte sectors.
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 limited terminal escape sequence
handling configuration.
At this time, there is no straightforward way to move
files in and out of the p-System volumes. There are
ways to do this, but they are complicated. Please
contact me if you are interested.
There is currently no support for floppy drives.
Wayne Warthen
wwarthen@gmail.com
3:13 PM Thursday, January 12, 2023

371
Source/pSys/bios.asm

@ -0,0 +1,371 @@
;
;-----------------------------------------------------------------------
; p-System BIOS for RomWBW HBIOS
;
;-----------------------------------------------------------------------
;
; 3:46 PM 1/13/2023 - WBW - Initial release
;
; TODO:
;
; - Assign the HBIOS console device to the p-System console instead
; of just using a hard-coded reference to Serial Unit 0.
;
; - Implement Extended BIOS.
;
#include "../ver.inc"
;
#include "psys.inc"
;
#include "../HBIOS/hbios.inc"
;
; 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
;
;
;
.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 panic ; 15: Extended BIOS vector
jp panic ; 16: Extended BIOS vector
jp panic ; 17: Extended BIOS vector
jp panic ; 18: Extended BIOS vector
jp panic ; 19: Extended BIOS vector
jp panic ; 20: Extended BIOS vector
jp panic ; 21: Extended BIOS vector
jp panic ; 22: Extended BIOS vector
jp panic ; 23: Extended BIOS vector
jp panic ; 24: Extended BIOS vector
jp panic ; 25: Extended BIOS vector
jp panic ; 26: Extended BIOS vector
jp panic ; 27: Extended BIOS vector
;
;
;
sysinit:
;ld a,0
;jp panic
ld hl,str_banner
call prtstr
call conread
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
; 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,sysinit1 ; re-vector to sysinit1
ld (bios_loc+1),hl ; update the jump table
sysinit1:
xor a ; signal success
ret ; done
syshalt:
;ld a,1
;jp panic
; 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:
;ld a,2
;jp panic
xor a ; signal success
ret ; done
constat:
;ld a,3
;jp panic
ld b,BF_CIOIST ; serial port status function
ld c,0 ; port 0
rst 08 ; call HBIOS
ld c,0 ; assume no chars pendin
jr z,constat1 ; if zero, no chars waiting
ld c,$FF ; signal char(s) pending
constat1:
xor a ; signal success
ret ; done
conread:
;ld a,4
;jp panic
ld b,BF_CIOIN ; serial port read function
ld c,0 ; port 0
rst 08 ; call HBIOS
ld c,e ; char to C
xor a ; signal success
ret ; done
conwrit:
;ld a,5
;jp panic
ld a,c
cp 27 ; escape?
jr nz,conwrit1 ; if not, handle normally
call conwrit1 ; else, send escape
ld c,'[' ; ... followed by '[' for ANSI
conwrit1:
ld e,c ; char to write to E
ld b,BF_CIOOUT ; serial port write function
ld c,0 ; port 0
rst 08 ; call HBIOS
xor a ; signal success
ret ; done
setdisk:
;ld a,6
;jp panic
ld a,c ; disk number to A
ld (curdisk),a ; save for later
xor a ; signal success
ret ; done
settrak:
;ld a,7
;jp panic
ld a,c ; track number to A
ld (curtrak),a ; save for later
xor a ; signal success
ret ; done
setsect:
;ld a,8
;jp panic
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:
;ld a,9
;jp panic
ld (curbufr),bc ; save buf adr for later
xor a ; signal success
ret ; done
dskread:
;ld a,10
;jp panic
;ld a,(curdisk)
;cp 0
;jr nz,dskinit1
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:
;ld a,11
;jp panic
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:
;ld a,12
;jp panic
call chkdisk
ret nz
xor a ; signal success
ret ; done
dskstrt:
;ld a,13
;jp panic
xor a ; signal success
ret ; done
dskstop:
;ld a,14
;jp panic
xor a ; signal success
ret ; 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
ret
seek:
; A single physical HBIOS disk device will contain p-System
; volume slices. Each slice will be 8MB. Start by computing
; a track offset using the p-System disk number as an
; index. <Track Offset> = 8MB * <Disk Number>
; A track contains 0x20000 bytes:
; 512 (bytes per sec) * 16 (sec per trk) * 16 (hds per cyl)
; So, 8MB / 0x20000 = 0x40 tracks
ld hl,0 ; starting unit track offset
ld de,$0040 ; per disk track offset
ld a,(curdisk) ; get current disk
or a ; set flags
jr z,seek2 ; disk 0 needs no offset
ld b,a ; into B for loop counter
seek1:
add hl,de ; add another offset
djnz seek1 ; and loop as needed
seek2:
push hl ; save total track offset
ld a,(curtrak) ; get current track value
push af ; save track value
and $0F ; head is low 4 bits of track
ld d,a ; save in D for head
pop af ; recover original track value
rra ; rotate to remove head bits
rra
rra
rra
and $0F ; mask off other bits
ld l,a ; save in low byte of HL
ld h,0 ; zero out high byte of HL
ld a,(cursect) ; get sector
ld e,a ; put in E
pop bc
add hl,bc ; add track offset
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:
ld a,(hl)
or a
ret z
push hl
ld c,a
call conwrit
pop hl
inc hl
jr prtstr
panic:
di
halt
hb_dev .db 3 ; HBIOS disk device unit
;
curdisk .db 0 ; Current disk number
curtrak .db 0 ; Current track number
cursect .db 0 ; Current sector number
curbufr .dw 0 ; Current disk buffer address
;
str_banner .db 13,10,"RomWBW p-System BIOS v"
.db BIOSVER
.db 13,10,13,10
.db "Press any key...",0
;
;
;
.fill bios_end - $
;
.end

BIN
Source/pSys/biostest.dat

Binary file not shown.

BIN
Source/pSys/blank.vol

Binary file not shown.

BIN
Source/pSys/boot.dat

Binary file not shown.

BIN
Source/pSys/fill.dat

Binary file not shown.

375
Source/pSys/loader.asm

@ -0,0 +1,375 @@
;===============================================================================
; 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
;
; RESERVE SPACE FOR 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 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
call nl2 ; spacing
;
; 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
#if 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

32
Source/pSys/psys.inc

@ -0,0 +1,32 @@
testbios .equ 0
;
; p-System Loader
;
loader_size .equ $200
loader_loc .equ $100
loader_end .equ loader_loc + loader_size
;
; p-System BIOS
;
bios_size .equ $200
bios_loc .equ $FE00 - bios_size
bios_end .equ bios_loc + bios_size
;
; p-System Bootstrap
;
#if testbios
boot_size .equ $300
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

BIN
Source/pSys/psys.vol

Binary file not shown.

2
Source/ver.inc

@ -2,4 +2,4 @@
#DEFINE RMN 1
#DEFINE RUP 1
#DEFINE RTP 0
#DEFINE BIOSVER "3.1.1-pre.191"
#DEFINE BIOSVER "3.1.1-pre.192"

2
Source/ver.lib

@ -3,5 +3,5 @@ rmn equ 1
rup equ 1
rtp equ 0
biosver macro
db "3.1.1-pre.191"
db "3.1.1-pre.192"
endm

1
Tools/simh/Sim.cfg

@ -24,6 +24,7 @@ attach n8vem0 %1
; hard disks
;set hdsk debug=read;write;verbose
attach hdsk0 ..\..\Binary\hd512_combo.img
;attach hdsk0 ..\..\Binary\psys.img
attach hdsk1 ..\..\Binary\hd1024_combo.img
set hdsk0 format=HDSK
set hdsk1 format=HDSK

Loading…
Cancel
Save