Wednesday, March 26, 2014

Running Z80 Programs under Cromix 172 XXU



The last, fastest processor cards that Cromemco made (before selling their company to Dynatech Computer Systems)  was based on the Motorola 68020.

Unfortunately, except for a few bespoke applications, such as the ones written by the American Military, ColorGraphics or other Vertical markets, barely any consumer grade applications existed.

Now if only there was a way to run any of the hundreds of Z80 based CPM and CDOS operating systems applications .... And yes there is:

Pre Requisites
This is a procedure that will enable you to run Z80 programs on a Cromemco system with a 68020 processor.  You will need

a) some patience
b) a way to edit files
c) An Octart Communications Processor Card
d) A spare slot in your S100 card chassis
e) An interrupt cable to link in the Octart

Editing Programs

Initially there was no working screen editor so I had to transfer all files to a PC and back.  A non trivial process although cscopy did rather save the day.

Eventually I was able to transfer a working termcap (terminal capabilities file) to match the behaviour of putty.  putty is famous in the UNIX community as an xterm character emulator.  But it can also talk over a serial cable.  

I had to relearn the fact that putty is basically operating as a DEC VT52 terminal,  well, for serial communications anyway

in /etc/termcaps

v5|xter|Dec vt52 and putty and xterm:\
:co#80:li#24:\
:up=\EA:do=\EJ:\
:nd=\EC:nb=^H:\
:cm=\EY%+ %+ :\
:cl=\EH\EJ:cd=\EJ:\
:ce=\EK:\
:ho=\EH:\
:dc=\EP:\

:kl=\ED:kr=\EC:ku=\EA:kd=\EB:

After the fact this is the magical entry that you can type into /etc/termcaps and then use the term keyboard command to immediately change your running terminal type

term xter

And now the ce screen editor will work again.  Phew!   I think this step (including debugging the output sent from CE and analysing the key sequences) took longer than the rest of the procedure ...


01 Build a new Operating System /cromix.sys and Test it
So Cromemco enabled a way to run older Z80 based Cromix or Z80 CPM programs.

Edit the /gen/sysdef file and include the zio device driver thus

d /gen
ce sysdef    # make the edit shown in the next line
zio 1

crogen 20140325cromix sysdef
boot  /gen/20140325cromix.sys

% Block devices:

BDEV    01      cflop                   % Cromemco floppy driver
BDEV    02      uflop                   % Suggested uflop
BDEV    03      allmem                  % Amem driver (required)
BDEV    04                              % Suggested tflop 0
BDEV    05      ramdsk                  % Suggested ramdsk
BDEV    06      stdc 1                  % STDC driver
BDEV    07                              % Removable part of SMD 0
BDEV    08                              % Not used
BDEV    09      zio 1                   % Suggested zio
BDEV    10                              % Not used
BDEV    11                              % ESDI driver

BDEV    12                              % Not used


zio     Supports Z80 programs running in BIART, OCTART, or IOPX, one per
board. Ensure that the boards will have the code downloaded
(See iostartup.cmd). Arguments are IO processor numbers
(1 through 8) which have the zio.iop code downloaded.

IO processor  Base address
     1         0xce
     2         0xbe
     3         0xae
     4         0x9e
     5         0xd6
     6         0xd8
     7         0xda
     8         0xdc


02 Setup Octart Card 


The Octart is actually an 8 port serial interface card.   Each of the 2 headers at the top of the card goes to a special fanout cable with 4 DB25 serial connections.

The Octart contains its own Z80A Processor and 64KB memory as well as the Zilog dedicated Serial Input Output interface chips.

Therefore  if you don't need the extra serial terminals then Cromemco provides a way to instead the Octarts as a satellite processor.

The main processor talks thru the /dev/zio<n> interface
03 Dip Switches


For my Octart card I set it to a base address of 0xCE checked via  the manual


04 Put Card in and Make sure Interrupt cable set









05 Check IO startup files

system[94] ls -l *startup.cmd
      2,083    1   rewa r--- r--- bin         Mar-22 20:40  iostartup.cmd

        189    1   rewa r--- r--- bin         Dec-02  1997  startup.cmd

/etc/ioload -r /etc/zio.iop io1
This is the line that you would need to include in the iostartup.cmd file which is run automatically on boot.

i01 correlates with the first Octart matching the previously shown dip switch settings.

If you made any change here I would reboot again.

----
utility:      IOLOAD
purpose:      This program loads a program into an I/O board

user access:  privileged user

summary:      ioload [-r] filename device

arguments:    filename of program to be loaded

              I/O device name (io1 .. io4 oc1 .. oc8)

options:      -r   Reset the board before loading

Description

The Ioload utility loads a file into an I/O board (IOP, Octart, or Biart).
This utility is normally used to load the IOP driver /etc/quadart.iop,
/etc/tape8.iop, or /etc/tape16.iop into an IOP, the Octart driver
/etc/octart.iop into an Octart, or the driver for Z80 programs /etc/zio.iop
into a Biart or Octart. Ioload.bin is located in the /etc directory.

----

Device Definitions

system[97] ls -l /dev/z*
      9:0   B  2   rewa -e-- -e-- bin         Jan-19  1990  /dev/zio1

Directory: /dev/z80
      9:0   B  2   rewa -e-- -e-- bin         Jan-19  1990  zio1
      9:1   B  1   rewa -e-- -e-- bin         Jan-19  1990  zio2
      9:2   B  1   rewa -e-- -e-- bin         Jan-19  1990  zio3
      9:3   B  1   rewa -e-- -e-- bin         Jan-19  1990  zio4


06 Place some Z80 programs


Directory: /usr/bin
     26,112    1   rewa rewa rewa system      Oct-26  1985  sbasic.com
     56,330    1   rewa rewa rewa system      Oct-26  1985  sbasic68.bin
      9,984    1   rewa rewa rewa system      Oct-26  1985  scitoh.com

Don't forget to change permissions. (Say for example you used cscopy to read in the files).  Without it you will get this kind of error

system[101] /usr/bin/sbasic.com
Error during loading of the program
File not accessible: "/usr/bin/sbasic.com"

# correct with 

access rwa.rwa.rwa /usr/bin/sbasic.com




07 Running Structured Basic
As a small example I chose to run a trivial Basic program using the 32K Structured BASIC interpreter.

system[104] sbasic


Cromemco Structured Basic version 03.66
Copyright 1977, 1982 by Cromemco, Inc.


>list

   20   Integer Counter
   30   Counter=10
   40     While Counter>0
   50     Print"hello cruel world ";Counter
   60     Counter=Counter-1
   70     Endwhile

>>run
hello cruel world 10
hello cruel world 9
hello cruel world 8
hello cruel world 7
hello cruel world 6
hello cruel world 5
hello cruel world 4
hello cruel world 3
hello cruel world 2
hello cruel world 1

>>bye


Links
Configuring Putty
Termcap Format

Github Termcap Xterm information