The UCSD p-System for z80pack

The p-code interpreter:

The system disks for all versions include the Z80 p-code system with support for real numbers and transcendental functions. All versions support four 8" floppy disks at least, details below.
Please note that the disks for versions I.5 and II.0 have a sector interleave, while version IV.0 is uninterleaved. So disks from the other version are not readable. The version IV.0 system disks come with a tool diskchange, that allows to re-interleave disks. The correct parameters to convert a I.5 or II.0 disk to one readable by IV.0 are:

  Type "!" to exit

  What is the source unit number? (4,5,9..12) 9
  What is the destination unit number? (4,5,9..12) 10
  What is the interleaving ratio of the drives used for the transfer? 1

  What is the interleaving ratio? 2
  What is the sector skew per track? 6
  What is the first interleaved track? 1

  What is the interleaving ratio? 1
  What is the sector skew per track? 0
  What is the first interleaved track? 1

Terminal support:

A gotoxy procedure for VT-100/ANSI terminals is included as source and linked into the operating system. Other support functions for terminals are configured for VT-100/ANSI terminals with setup. Only one lead-in character is allowed for terminal functions, which is configured to ESC and the BIOS inserts a [ after each ESC character send to the terminal.

In the 80's I was a heavy CP/M user, so I never liked the UCSD key configuration a lot. My own setup differs from the UCSD documentation and the following table shows my preferred setup. Of course you can modify it to your own preference with the setup program included with all versions.

Configuration of editor keys:

Key function I.5 II.0 IV.0
Key for Stop CTRL-S CTRL-S CTRL-A1)
Key for Flush CTRL-F CTRL-F CTRL-F
Key for Break CTRL-C CTRL-C CTRL-C
Key to End File CTRL-Z CTRL-Z CTRL-Z
Key to Delete Line CTRL-? (DEL) CTRL-? (DEL) CTRL-? (DEL)
Key to Move Cursor Up CTRL-E CTRL-E CTRL-E
Key to Move Cursor Down CTRL-X CTRL-X CTRL-X
Key to Move Cursor Left CTRL-S CTRL-S CTRL-S
Key to Move Cursor Right CTRL-D CTRL-D CTRL-D
Editor Escape Key CTRL-[ (ESC) CTRL-[ (ESC) CTRL-[ (ESC)
Editor Accept Key CTRL-Z CTRL-Z CTRL-Z
Editor Exchange-Delete Key - - CTRL-G
Editor Exchange-Insert Key - - CTRL-O

1)The cursor left key won't work if stop key is configured CTRL-S also.

The cursor keys in L2 editor won't work in all versions, this could be caused by above configuration.

Supported unit numbers:

Unit # I.5 II.0 IV.0
4floppy 0, 494 blocksfloppy 0, 494 blocksfloppy 0, 494 blocks
5floppy 1, 494 blocksfloppy 1, 494 blocksfloppy 1, 494 blocks
9floppy 2, 494 blocksfloppy 2, 494 blocksfloppy 2, 494 blocks
10floppy 3, 494 blocksfloppy 3, 494 blocksfloppy 3, 494 blocks
11)3harddisk 8, 1600 blocksharddisk 8, 1600 blocks-
12)3harddisk 9, 1600 blocksharddisk 9, 1600 blocks-

1)Reserved for graphic device, unimplemented.
3)Full size of the disks can't be used, because 26 sectors/track is hardcoded, but this disks have 128 sectors/track.
)aSeems to be broken.

Building the p-code interpreter:

Version I.5:

Download the disk image with the interpreter sources and mount it on an empty drive. The file micro.text defines what kind of interpreter will be build, 8080 or Z80 CPU, inclusion of floating point support and so on. The equate CPM should be ON, because we use the CP/M BIOS for all I/O. The file cpmio.text defines the device table and has drivers for the devices, doing calls to the CP/M BIOS. This is the file I modified to make better usage of the z80sim hardware, cpmio.old.text is the original one distributed by UCSD.
A)ssemble and L)ink file micro.text to a program micro.code.

Now this file can't be used as is, because the linker builds programs with a header block, including segement tables and all kind of informations for the operating system, to be able to run a program. The tertiary boot just wants to load the native code and execute it, so we need to get rid of the header block at least. Release IV.0 includes a tool compress to strip the unwanted blocks from linked assembly, but for I.5 I can't find such a tool. For now I used ``brute force'' to get an executable interpreter, by analysing a hexdump of an original UCSD build and compare it with a hexdump of the linked assembly. Then I copied the file to a UNIX system and used dd to strip the unwanted blocks from the file:

	dd if=micro.code of=system.micro bs=512 skip=1 count=19
This is not the fine art of computing, but for now it works. An appropriate Pascal program should be written, that gets the size of the native code from the header block, and write it to a new data file.

Version II.0:

Download the disk image with the interpreter sources and mount it on an empty drive. It's everything the same as with I.5, only another dd command is needed, because the header block under II.0 has a size of 1.5 blocks:
	dd if=micro.code of=system.micro bs=256 skip=3 count=38

Version IV.0:

Download the disk image with the linkable interpreter objects and mount it on an empty drive. The p-code interpreter for z80pack was linked from the following modules:
  2. RSP
  3. BIOS.C
Read Adaptable p-System Installation Guide for the details about how to link a new interpreter.