Difference between revisions of "The Gemini 80-Bus Saga"

From GlassTTY
Jump to: navigation, search
m
m (A Note about RP/M Versions)
(3 intermediate revisions by the same user not shown)
Line 10: Line 10:
  
  
'''''HELP NEEDED!..... I am desperately seeking to archive Gemini 80-Bus software before it is lost forever. I am particularly interested in CP/M bios versions and any disk images that may be around. Please get in touch if you can help.'''''
+
'''''HELP NEEDED!..... I am desperately seeking to archive Gemini 80-Bus software before it is lost forever. I am particularly interested in CP/M bios versions and any disk images that may be around. I am also keen to preserve as much hardware as I can (finances allowing). Please get in touch if you can help or have a similar interest.'''''
 
<br/><hr/><br/>
 
<br/><hr/><br/>
 
==Introduction==
 
==Introduction==
Line 210: Line 210:
 
RP/M is one of the monitor programs, supplied in EPROM, that was available for the G811 processor board. Version 0.1 was the initial release, the second enhanced version was 2.0. When the MAP256 memory board was released there was, under certain hardware combinations, a conflict with RP/M when it was trying to detect if a disk was present. This was entirely due to the MAP256 board, however, a small patch was made available for RP/M to deal with the anomaly, this was deemed to be version 2.1. Version 2.2 was never released in order not to be confused with CP/M 2.2 and the final version was 2.3 which had some enhanced disk boot routines.
 
RP/M is one of the monitor programs, supplied in EPROM, that was available for the G811 processor board. Version 0.1 was the initial release, the second enhanced version was 2.0. When the MAP256 memory board was released there was, under certain hardware combinations, a conflict with RP/M when it was trying to detect if a disk was present. This was entirely due to the MAP256 board, however, a small patch was made available for RP/M to deal with the anomaly, this was deemed to be version 2.1. Version 2.2 was never released in order not to be confused with CP/M 2.2 and the final version was 2.3 which had some enhanced disk boot routines.
  
My system was supplied with version 2.2 which, according to Richard Beal, the authors of RP/M, never existed. It appears that 2.2 I is a patched version of 2.1 to work with a different disk arrangement. Thanks go to John B Hanson for determining this. As a result I have now been able to create version 2.3 for use with Xbeaver and, until I sort out an EPROM programmer, I will use version 2.1 on the real hardware.
+
My system was supplied with version 2.2 which, according to Richard Beal, the authors of RP/M, never existed. It appears that 2.2 I is a patched version of 2.1 to work with a different disk arrangement. Thanks go to John B Hanson for determining this. As a result I have now been able to create version 2.3 for use with both Xbeaver and the real hardware.
  
 
[[File:RPM_2.1.zip]]
 
[[File:RPM_2.1.zip]]
Line 217: Line 217:
  
 
[[File:RPM_2.3.zip]]
 
[[File:RPM_2.3.zip]]
 
  
 
==Upgrading RP/M to 9600 Baud==
 
==Upgrading RP/M to 9600 Baud==
Line 431: Line 430:
  
 
==IVC Hit by Lightning==
 
==IVC Hit by Lightning==
 +
[[File:G812-IVC.jpg|thumb|The troublesome Gemini IVC Video Card.]]
  
 
During my Gemini journey I was originally thwarted by a faulty GM812 IVC video card which failed a couple of weeks after I purchased the machine in May 2019. This tied in nicely with obtaining a working CP/M disk, except it didn't, as the CP/M version required the IVC Doh! Thankfully, as described earlier, CP/M could be patched to use the serial port for TTY by changing a couple of bytes so I was off and running. However, in parallel with using a serial terminal to talk to the Gemini CP/M, I set about fixing the IVC card.
 
During my Gemini journey I was originally thwarted by a faulty GM812 IVC video card which failed a couple of weeks after I purchased the machine in May 2019. This tied in nicely with obtaining a working CP/M disk, except it didn't, as the CP/M version required the IVC Doh! Thankfully, as described earlier, CP/M could be patched to use the serial port for TTY by changing a couple of bytes so I was off and running. However, in parallel with using a serial terminal to talk to the Gemini CP/M, I set about fixing the IVC card.

Revision as of 20:43, 12 July 2019

Gotek attached to Gemin GM829 Floppy/SASI Controller.
PS/2 to Parallel ASCII keyboard adapter.
Close up of the PS/2 to Parallel ASCII keyboard adapter.
Loading MBasic using the RS232 port.
Loading and running MBasic using the Cassette .
Loading and running ZSID using the Cassette .
Loading MBasic using the RS232 port.
Booting to CP/M using the Serial Port.


HELP NEEDED!..... I am desperately seeking to archive Gemini 80-Bus software before it is lost forever. I am particularly interested in CP/M bios versions and any disk images that may be around. I am also keen to preserve as much hardware as I can (finances allowing). Please get in touch if you can help or have a similar interest.




Introduction

This article describes the journey undertaken in order to bring a Gemini 80-Bus CP/M system back to life. The system was purchased from eBay in April 2019 and included quite a lot of documentation and circuit diagrams. Should be easy right?

A Potted History

The original Gemini 80-Bus system was a two board system designed to be a replacement for the popular UK computer, the Nascom-2. Nascom had been taken into receivership and there was concern from outside the company that if buyer could not be found, the whole Nascom community would die. The new company Gemini, was headed by John Marshall who had previously headed Nascom and was based in Amersham, Buckinghamshire, England.

The 80-bus system used in Gemini machines was a tidied up version of the bus used on the Nascom and was thought by many to be the UK's answer to the S100 bus. The bus was backward compatible with the Nascom bus and provided a means for Nascom owners to expand and improve their systems. The Gemini boards were 8 inches square and were typically fitted into a 19 inch rack and as the company grew many types of expansion boards were produced. A Gemini system could consist of a singe board or have its functionality spread across multiple boards making the the system very flexible. In addition many other companies supplied 80-bus compatible cards.

The Gemini system was primarily designed to be a CP/M system and, with the right expansion cards, could support 8 and 5.25 inch floppy drives as well as Winchester (hard) disk drives.

My Gemini System

In April 2019 I took delivery of what appears to be a fairly typical Gemini system. The computer consisted of a G811 Z80 CPU card, a MAP80 memory card populated with 64K of Memory, an G812 intelligent video card and a GM829 floppy/hard disk controller card. These were all fitted to a 19 inch rack with a home made Veroboard based backplane. All that was needed was a power supply, a suitable keyboard, disk drives and software. Hmmm!

There were a couple of interesting details regarding the machine, the first is that it includes RP/M version 2.2. This is odd as version 2.2 of RP/M was (supposedly) never released, the version numbers leapt from V2.1 to V2.3 to avoid confusion with version 2.2 of CP/M, this was confirmed in an article written for 80-bus news by RP/Ms creator Richard Beal (80-BUS vol. 3 iss. 6 p. 9).

The second interesting thing is that there is also an EPROM containing the Gemini Boot ROM for 8 inch Disks. This appears to be written by Roger Brooks, and, based on the included source code listings and manuscript amendments, this would appear be the machine he created it on. So, if Roger is reading this or anyone knows anything about Roger please get in touch via twitter @johnnewcombeuk (https://twitter.com/johnnewcombeuk).

Power Supply Unit

For the PSU I opted to use an ATX PSU with a 24 pin connector. I used a 24 pin extension lead to attach to the Gemini backplane which meant that the PSU could simply be plugged into the Gemini and swapped as required. The Gemini documentation suggests that the usual +12v, +5v, -12v and -5v supplies are required. However the later ATX PSU units do not tend to supply -5v. Checking the circuit diagrams for the cards I am using showed that a -5v supply was not actually required making things simple.

A Two Card System

The CPU board includes, ports for an RS232 serial device, a keyboard and a cassette tape recorder. The card also includes an EPROM based system monitor called RP/M (see below). The card is configured using a series of wire straps placed on DIL headers and was, as you would expect, configured to use the external G812 video card I had.

My initial aim was to see the system running with the minimum of hardware, namely the CPU board and the memory board. By making the connection between pins 6 and 7 on link LKB1 on the CPU board I configured the system to use the serial port for input/output. In the end I added a small jumper that could be used as required to switch between using the serial port and the video controller. By using the serial port for control, all that was required was to create a short lead and connect to a machine running a terminal emulator set to 300 baud (7E1).

Inspection of the CPU board showed a couple of issues, the first was rusty pins on a couple of ICs. In this case they were the two Proms used for addressing. Unfortunately the affected pins broke off flush with the plastic body of the IC as soon as they were disturbed. However, by grinding away a slither of the plastic IC casing with a Dremel, fresh metal was exposed allowing me to attach some pins from a donor IC. The second issue was that the EPROM that contained the system monitor had been inserted incorrectly and seemed to have been splashed with a large blob of paint. This was easily remedied before powering up the two card system.

   57344 bytes - RP/M for Gemini V2.2
   
   ** RP/M ready **
   *_

At this point I was able to use the monitor to inspect and set memory, so I dumped the contents of the RP/M EPROM to the screen of my terminal emulator and pasted this into a text file for safe keeping.

For the knowledgable amongst you, you will notice that the Version of RP/M is 2.2. This is odd as version 2.2 of RP/M was (supposedly) never released, the version numbers leapt from V2.1 to V2.3 to avoid confusion with version 2.2 of CP/M, this was confirmed in an article written for 80-bus news by RP/Ms creator Richard Beal (80-BUS vol. 3 iss. 6 p. 9).

A Three Card System

By removing the connection between pins 6 and 7 on link LKB1 on the CPU card and inserting the video card, the system proudly displayed the ready message on the connected composite monitor.

     IVC Monitor V2 - 1982
   
   57344 bytes - RP/M for Gemini V2.2
   
   ** RP/M ready **
   *_

However, without a keyboard, not much more could be achieved.

Parallel ASCII Keyboard Converter

The Gemini was designed to use a parallel ASCII keyboard and, whilst I had an old Apple II clone keyboard that probably could have been coaxed into life, I wanted a keyboard with function keys and a full set of cursor keys. I decided that until I could obtain an original Gemini keyboard, the best solution would be to use a PS/2 keyboard and make a simple Arduino based PS/2 to parallel ASCII adapter. I used the small Arduino Micro and created a sketch to do the trick.

The sketch is described here https://bitbucket.org/johnnewcombe/geminikeyboard/src/master/ and the wiring diagram to connect the Arduino to the IVC card and the PS/2 connector is shown in #Appendix A - PS/2 to Parallel ASCII Converter Wiring Diagram.

Once I had the keyboard connected and working, I needed to try and run some software.

MBasic (Basic-80)

RP/M is a system monitor written by Richard Beal specifically for the Gemini system and is uses a subset of the CP/M api in that something written 'against' RP/M will also run on CP/M the reverse is not necessarily true as RP/M supports only one sequential file being opened at a time and random access is not supported. RP/M was designed support cassette based storage rather than disks, although it will allow booting to disk. Having said that, it is reported that the CP/M version of MBasic and Digital Research's ZSID Dynamic Debugging Program will run under RP/M, so, given the absence of any form of disk storage this seemed to me to be the logical next step, so I downloaded the binary from one of the many CP/M repositories with the aim of somehow getting it into the machine.

Despite the absence of MBasic on cassette tape, I had a few options to explore. The first was to try and create a .wav file containing MBasic in cassette format (KCS/CUTS). The difficulty here is that whilst is is reasonably easy to create a .wav audio file from an array of bytes, there is more to a Gemini tape archive than just a stream of audio. The Gemini RP/M tape system adds a header to the stream including a filename and, on the basis that an error results in a prompt to rewind the tape before continuing, it is safe to assume that each block of data (128 bytes) includes a frame number and checksum.

The second option is to enter the byte values directly into the monitor, or rather, paste the data into a terminal emulator window. It is an approach that has worked for me before. By ensuring that each CR/NL is followed by a short delay, the system can easily cope with the pasting of a large amount of data. So for this to work is was necessary to switch back to using the RS232 port with a terminal emulator (see #A Two Card System).

The first task was up the speed of the serial port from 300 baud to 9600 baud. This can be done at the RP/M prompt e.g.

   ** RP/M ready **
   * UD 9600

After entering this command, change the speed setting of the terminal emulator to match. Next set the CR delay to 200ms, this value was determined from trial and error. The higher the value, the more reliable and the slower the transfer is, 200ms seems to be optimal. I tend to use Minicom as a terminal emulator which can be configured by selecting the Meta Z (typically Esc+Z) to bring up the main menu, from here the Terminal Settings option can be selected in order to set the delay.

Next, the MBASIC.COM binary file needs to be converted to a HEX file in the following format (see #Appendix B - Creating an RP/M Hex File) and pasted into the terminal window.

   S 100
   c3 8c 5d 7a 29 dc 29 06 44 bf 11 9e 45 ec 14 63 18 86 39 40 19 18 15 95 14 67 14 51 16 e6 43 7d 14 d1 14 ee 14 01 44 9c 
   16 0e 45 89 20 20 43 85 15 73 44 03 20 2b 1e c0 22 5d 44 c9 0c c9 0c fd 1f 94 16 84 20 00 00 24 20 ee 14 7c 44 7d 44 82
   44 c4 44 e3 3c 10 16 d3 15 7c 22 ...
   
   ... 38 31 0d 0a 00 00 00 00 00 00 00 00
   .

The S 100 RP/M command allows data to be set in memory starting at address 0100h. In this example each row has 40 hex bytes although anything from 1 to 42 is possible the more hex digits in the row, the quicker the transfer will be. The final full stop should return you to the RPM prompt.

After 2-3 minutes, all 24340 bytes should have been entered and time to see the results. Press I to run the code fro 0100h e.g.

   ** RP/M ready **
   * I
   BASIC-80 Rev. 5.21
   [CP/M Version]
   Copyright 1977-1981 (C) by Microsoft
   Created: 28-Jul-81
   31538 Bytes free
   OK

The files below contain the RPM txt files for MBasic and ZSID.

File:MBasic.zip

File:ZSID.zip

Creating a Cassette Tape of MBasic

This turned out to be far easier than expected. I knew that if the method described above was used to enter data using the RS232 port, it would not be possible to switch to the cassette interface to save the program to tape. This is due to the serial hardware being used for both RS232 and cassette. However, it turns out that the G811 CPU board can support both the IVC and RS232 as input with IVC providing the display. Therefore with the configuration set to use the IVC (see #A Three Card System data can still be entered using the RS232 port.

By using the PS/2 keyboard to set the serial baud rate to 9600 e.g.

   ** RP/M ready **
   * UD 9600

The process described in the above section (#Running Some Software) can then be used to load MBasic into memory although I did find it necessary to set the character delay to 50ms and the CR delay to 250ms. Once the data has been loaded all that is required is to tell RP/M the size of the program using the L command before switching to cassette using UC and writing the program to tape e.g.

   * L BE
   * UC
   * W MBASIC

Once the recording is complete it can be tested by using the R command e.g.

   * R MBASIC
      
   Insert file: MBASIC
   Start Playing Press return
   ****************************...
   
   Remove file: MBASIC
   Press return

The program can then be run with the I command e.g.

   * I
   BASIC-80 Rev. 5.21
   [CP/M Version]
   Copyright 1977-1981 (C) by Microsoft
   Created: 28-Jul-81
   31538 Bytes free
   OK

For details of the tape connector see #Appendix C - Tape Connector.

The XBeaver Gemini Emulator

In order to take things further I needed to get up and running with a floppy disk solution to boot CP/M but before that I needed to obtain some disks.

John B Hanson (http://81.105.120.101/xbeaver/) has created an emulator that can emulate, amongst others, the Gemini system and after contacting him via the UK Vintage Radio Repair and Restoration forum (https://www.vintage-radio.net/forum/showthread.php?t=156106) he very kindly sent me some Gemini CP/M images in .DMP format. As his emulator supports DMP format, I thought it would be useful to get it up and running.

The code can be downloaded from http://81.105.120.101/download/xbeaver.tgz and can be compiled for many systems.

Compiling

To compile this on a recent version (May 2019) of Arch Linux (my distribution of choice), a few changes to the Makefile were made as follows.

A change was made to CC label to include the tirpc include folder, e.g.

   CC =gcc -I/usr/include/tirpc

The linux section of the Makefile was modified to be as follows

   linux: $(VIRTUALBEAVER_OBJS)
          $(CC) $(CFLAGS) $(VIRTUALBEAVER_OBJS) -o xbeaver \
            -ltirpc -lX11 -lXpm -lXt -lncurses -lm -lutil

On my system all of the linked libraries in the above command line were present on the system making things very simple. If these are missing simply install the package as required. The libraries are as follows.

In addition to making sure that the libraries above were installed, the festival speech package was added with an english voice e.g.

   # pacman -S festival
   # pacman -S festival-english

Keyboard Input Issues

I use KDE/SDDM as my windowing environment, however with this combination there was an issue with Xbeaver in that I could not switch focus to the Xbeaver window. The README file that came with the download describes the issue. The work-around for me was to ust TWM as a window manager for times when I was using Xbeaver. If I get time in the future I will try and see what the issue is with KDE/SDDM as it would be great to use it without switching environments. I understand that Gnome does not have the issue although Openbox and LXDE do.

Configuration

The default configuration gave me an all singing all dancing Gemini system, however, as I was looking to emulate my own physical system I decided to start with a minimalist configuration.

The basic xbeaver.cfg file I used was as follows.

   verbose
   cpuclock 4
   board 0xfe gm813_mmu
   board 0xb0 gm832 BeaverBoot planes green
   board 0xb8 serial_8250 bvrnet ~/beaver/network
   board 0xe0 gm829_floppy -debug DSZ -geometry DP35.2.10.512 ~/beaver/images/GM512_ORIGINAL.DMP
   binload 0xf000 ~/beaver/roms/RPM_2.3.ROM
   byte 0f0a8 21 00 f0 #Patch top of ram for RPM

Note that I am using version 2.3 of RP/M (see below).

A Note about RP/M Versions

RP/M is one of the monitor programs, supplied in EPROM, that was available for the G811 processor board. Version 0.1 was the initial release, the second enhanced version was 2.0. When the MAP256 memory board was released there was, under certain hardware combinations, a conflict with RP/M when it was trying to detect if a disk was present. This was entirely due to the MAP256 board, however, a small patch was made available for RP/M to deal with the anomaly, this was deemed to be version 2.1. Version 2.2 was never released in order not to be confused with CP/M 2.2 and the final version was 2.3 which had some enhanced disk boot routines.

My system was supplied with version 2.2 which, according to Richard Beal, the authors of RP/M, never existed. It appears that 2.2 I is a patched version of 2.1 to work with a different disk arrangement. Thanks go to John B Hanson for determining this. As a result I have now been able to create version 2.3 for use with both Xbeaver and the real hardware.

File:RPM 2.1.zip

File:RPM 2.2.zip

File:RPM 2.3.zip

Upgrading RP/M to 9600 Baud

When using the serial port for keyboard/screen IO using a terminal emulator I was manually switching from the default 300 baud to 9600 baud. In order for RP/M to default to 9600 baud a small patch to RP/M can be made. The GM811 (Z80 CPU) docomentation shows a whole list of divisor values that can be used to set the default serial port speed.

F009 is the location of the two byte divisor. To set the default speed to 9600, set the values as follows.

   F009 = 00
   F00A - 0D

Connecting a Gotek Floppy Disk Emulator

Preparing Disk Images

I was keen to get a floppy drive working with the Gemini and, as I had access to some CP/M boot disks in .DMP format I thought that using a Gotek device (http://www.gotekemulator.com/) with the FlashFloppy firmware written by Keir Fraser (https://github.com/keirf/FlashFloppy) would be a sensible first step. Whilst this took me some considerable time to understand what was required, it turned out to be quite easy to acomplish.

By using a simple python script, the .DMP disk images were converted to a simple .IMG format. With the .DMP image, each sector had an eight byte sector header which showed the layout to be very simple, it is shown below. The .IMG format I needed was to be the same layout but without the eight byte sector. #Appendix D - Converting from .DMP to .IMG Format shows a small script that was used.

   Side 0, Track 0, Sectors 0 - 9
   Side 1, Track 0, Sectors 0 - 9
   Side 0, Track 1, Sectors 0 - 9
   Side 1, Track 1, Sectors 0 - 9
   ...

This format is often referred to as track interleaved, not to be confused with sector interleaving. The image file is available below, please note that this is a CP/M 32K disk image.

File:GM512 MASTER.IMG.zip

Connecting the Gotek

Adding a Gotek (or floppy drive) to the GM829 requires either a SA400 Shugart interface drive with a straight cable or an IBM PC drive with a standard 7 wire twisted cable, see #Appendix E - Floppy Interface Connections. The firmware chosen for the Gotek (see below) allows this to be configured in software so either cable type should be suitable as long as the necessary configuration option is set in FlashFloppy. This article assumes a straight cable has been used with the Gotek drive select link set to S0. This article also assumes that the GM829 is configured to use Pertec Drives, by ensuring that the setting of Link 1 connects B to C.


There are several Gotek devices to choose from e.g. 24 pin, 34 pin and USB. A 34 pin device should be used, ideally with a 3 digit LED. These are very cheap, the Gotek used in this article was purchased in May 2019 for $15 from a Chinese supplier. It arrived postage free in around 2 weeks.

Configuring the Firmware

The FlashFloppy firmware written by Keir Fraser was installed on the Gotek using the instructions on Keir's website (https://github.com/keirf/FlashFloppy). This is a simple process, however, version 2.x of the firmware is required as this allows for custom disk formats. Once FlashFloppy is installed, all that is required is to create two text configuration files and place them in the root of the USB stick that is to be used with the Gotek. The files are as follows.

IMG.CFG. This file defines that all *.IMG files should be treated as Gemini CP/M images.

   [default]
   cyls = 35
   heads = 2
   secs = 10
   bps = 512
   id = 0
   iam = no
   file-layout = interleaved

FF.CFG. Many of these are default settings, and some relate to optional display and other uogrades, however, the whole file is reproduced here for completeness.

   interface = shugart
   host = unspecified
   pin02 = nc
   pin34 = nc
   write-protect = no
   side-select-glitch-filter = 0
   track-change = instant
   index-suppression = no
   head-settle-ms = 12
   ejected-on-startup = no
   image-on-startup = last
   display-probe-ms = 3000
   autoselect-file-secs = 2
   autoselect-folder-secs = 2
   nav-mode = default
   nav-loop = yes
   twobutton-action = zero
   rotary = full
   display-type = auto
   oled-font = 6x13
   oled-contrast = 143
   display-off-secs = 60
   display-on-activity = yes
   display-scroll-rate = 200
   display-scroll-pause = 2000
   nav-scroll-rate = 80
   nav-scroll-pause = 300
   step-volume = 10
   da-report-version = ""
   extend-image = yes

Booting the System

Once the Gotek is connected and configured all that is required is a reset of the CPU and CP/M should be up and running.

   57344 bytes -  RP/M for Gemini V2.1
   Executing boot
   
   Gemini Multiboard Auto Density System (1.4)
   
       32k CP/M vers 2.2
   A:>

CP/M Via the Serial Port

During the writing of this article my GM811 IVC display card developed a fault. This made booting to CP/M a little tricky as the Gemini CP/M is designed to send its output to the IVC or SVC display card. John B. Hanson provided a patch to direct CP/M output to the serial port, therefore, by switching back to using the serial port (see #A Two Card System) I could at least use the machine until such time as the IVC is sorted. The patch sacrifices the printer routines, however, for the purpose of testing CP/M, it works well.

The patch was implemented during the .DMP to .IMG conversion and the disk image is provided below. This image was designed to operate the serial port at 300 baud.

File:GM512 MASTER.S.IMG.zip

Creating an 80 Track Disk Image From Scratch

Now that I have a Gotek bootable Gemini system, I thought that it may be an interesting exercise to see if I could create an 80 track image to give me more storage space. In addition I wanted to be able to use cpmtools (http://www.moria.de/~michael/cpmtools/) manipulate these images as the product works on MacOS and Linux, the two operating systems I use the most.

Before I could even start with the cpmtools utilities I needed to create some definitions for them to make use of. cpmtools can manipulate all manner of CP/M disk formats as long as the format has been defined beforehand.

The disk definitions for CpmTools are located in a text file, the path below shows the Arch Linux and MacOS path, other systems may vary some Ubuntu systems may use /etc/cpmtools/diskdefs.

   /usr/local/share/diskdefs

There are several disk formats that can be used with the Gemini e.g.

   GEMDDSS: 164K, 35 Track, Single Density, Single Sided
   GEMDDDS: 340K, 35 Track, Single Density, Double Sided
   GEMQDSS: 388K, 80 Track, Double Density, Single Sided
   GEMQDDS: 788K, 80 Track, Double Density, Double Sided


The existing images I have are of the GEMDDDS type, the 80 Track, 788K format I will be creating are of the GEMQDDS type. In order to support these two types within cpmtools, The following disk definitionas should be added to the diskdefs file.


   diskdef gemddds
     seclen 512
     # double sided disk format, 35 tracks * 2 sides
     tracks 70
     sectrk 10
     blocksize 2048
     maxdir 128
     skew 1
     boottrk 2
     os 2.2
   end
   
   diskdef gemqdds
     seclen 512
     # double sided disk format, 35 tracks * 2 sides
     tracks 160
     sectrk 10
     blocksize 4096
     maxdir 128
     skew 1
     boottrk 2
     os 2.2
   end
   

To create a blank disk image I was expecting to be able to use the mkfs.cpm command (see http://www.moria.de/~michael/cpmtools/), however, this failed to give me a disk that was of the correct size. In the end I used a few snippets of python code to create a file that was 819200 bytes in size, made up of the following. The first 6144 Bytes (12 sectors) were taken directly from the existing bootable 35 track disk image. This simply required some Python to read the 340K disk image into byte array, slicing the array to take the first 12 sectors before writing that to a new binary image. The next 4096 Bytes (8 sectors) are used for the BIOS, this couldn't be taken from the 360K disk image as the BIOS I had did not support the larger capacity 788K drives/disk images.

The source for the Gemini Bios used on my 360K images, was made available by John B. Hanson through the vintage computer section of the UK Vintage Radio Repair and Restoration forum (https://www.vintage-radio.net/forum/showthread.php?t=156106), along with a host of invaluable advice of how to add additional drive support. The BIOS includes a single Disk Parameter Block to support four 340K floppy disks. In the end I decided to keep things simple I would change a few EQU statements and compile the bios to support four 788K floppy disks instead. This was very simple and after assembling and linking on the XBeaver emulator I had the bios in a CP/M binary file (.COM) file. The chages required buffer areas to be changed, however, changing the EQU statements at the begining of the source, changed the values of the calculated EQU values further down the source making things easy. This binary file was padded out to 4096 Bytes with bytes of 76h (the value 76h was selected as that was the padding value used on the 340K disk images), loaded and appended to the new image with some more Python. The remainng sectors were filled with the value E5h for no other reason than to comply with tradition for freshly formatted disks.

With this complete, the image can be checked with the cpmtools utility fsck.cmp e.g.

   fsck.cpm -f gemddds mydisk.img

Note how the -f gemqdds format parameter is used to tell cpmtools how to treat the disk image. From this point forward cpmtools can be used to copy things from one disk to the other e.g.

Get MBASIC from the 340K disk (note that the -f parameter specifies the respective format)

   cpmcp -f gemddds mydisk.img 0:MBASIC.COM mbasic.com

Copy the file to the 788K format.

   cpmcp -f gemqdds mydisk.img mbasic.com 0:MBASIC.COM

Once complete the image was transferred to the Gotek and the system was booted.

To check the bios disk definitions STAT and DISKINFO can be used (these are both available on the 340K disks posted above). This is the 340K disk image.

   A:> STAT A: DSK:
   
      A: Drive Characteristics
   2720: 128 Byte Record Capacity
    340: Kilobyte Drive  Capacity
    128: 32  Byte Directory Entries
    128: Checked  Directory Entries
    256: Records/ Extent
     16: Records/ Block
     80: Sectors/ Track
      1: Reserved Tracks

DISKINFO shows the disk parameter block (DPB) from within the BIOS.

   A:> DISKINFO A:
   SPT=80 BSH=4 BLM=15 EXM=1 DSM=169 DRM=127 ALO=192 AL1=0 CKS=32 OFF=1

When issuing the same commands to the 80 track image the following is returned.

   A:> STAT A: DSK:
   
     A: Drive Characteristics
  6304: 128 Byte Record Capacity
   788: Kilobyte Drive  Capacity
   128: 32  Byte Directory Entries
   128: Checked  Directory Entries
   512: Records/ Extent
    32: Records/ Block
    80: Sectors/ Track
     1: Reserved Tracks
   
   A:> DISKINFO A: 
   SPT=80 BSH=5 BLM=31 EXM=3 DSM=196 DRM=127 ALO=128 AL1=0 CKS=32 OFF=1

The final disks are here including a disk for serial access to CP/M and a .DMP image for use within the XBeaver emulator.

File:788KDisks.zip

There is still work to do as I would like to add a SASI hard disk and have a SCSI2SD (http://www.codesrc.com/mediawiki/index.php/SCSI2SD) card for the very purpose, however, I have not yet been able to obtain a Gemini Bios that supports a hard disk. Having said that, there's no rush as 788k disks are relatively large in terms of CP/M and make a very useful system.

IVC Hit by Lightning

The troublesome Gemini IVC Video Card.

During my Gemini journey I was originally thwarted by a faulty GM812 IVC video card which failed a couple of weeks after I purchased the machine in May 2019. This tied in nicely with obtaining a working CP/M disk, except it didn't, as the CP/M version required the IVC Doh! Thankfully, as described earlier, CP/M could be patched to use the serial port for TTY by changing a couple of bytes so I was off and running. However, in parallel with using a serial terminal to talk to the Gemini CP/M, I set about fixing the IVC card.

The effort to resolve the IVC issues took on a whole journey of its own and as a result ended up with its own article. The article can be found here Gemini IVC Problems

A Note From the Author

Considering how many of these machines must have been sold, there seems to be very little left out in the wild, as a result, I am very keen to try and preserve the Gemini system.

Now that the machine can boot to CP/M, I would love the machine to operate with a hard disk and a few more peripherals. I am desperately looking for a later Gemini CP/M bios that supports a hard disk. If you can help, please ket in touch.

I still have a lot of work to do and a lot to learn about the Gemini so if anyone owns or has a connection with the Gemini, please get in touch, I would love to talk things through with others and find out more about the company and its history. I can be contacted via twitter @johnnewcombeuk or via the Vintage Computer section of the vintage-radio.net forum (https://www.vintage-radio.net/forum/showthread.php?t=156106)

I would also like to take this opportunity to thank to John B. Hanson for helping me in so many ways, and others that have added their support via forums and social media.

John Newcombe

Appendix A - PS/2 to Parallel ASCII Converter Wiring Diagram

This is the wiring diagram for the PS/2 to parallel ASCII keyboard converter described in the text. The associated sketch is described here https://bitbucket.org/johnnewcombe/geminikeyboard/src/master/.

   IVC Keyboard Connector              Arduino   Usage
   
            1 ------------------------- VIN
            2 ------------------------- Pin 12    STRB
            3 N/C
            4 N/C
            5 ------------------------- Pin 10    D5
            6 ------------------------- Pin 9     D4
            7 ------------------------- Pin 11    D6
            8 ------------------------- GND
            9 N/C
           10 ------------------------- Pin 7     D2
           11 ------------------------- Pin 8     D3
           12 ------------------------- Pin 5     D0
           13 ------------------------- Pin 6     D1
           14 N/C
           15 N/C
           16 N/C
   
   PS/2 Keyboard Connector         Arduino Pin   Usage
   
           5V ------------------------- 5V
          GND ------------------------- GND
          CLK ------------------------- Pin 2     CLK
         DATA ------------------------- Pin 3     DATA

Appendix B - Creating an RP/M Hex File

The following Python script will take the binary file MBASIC.COM and create a HEX file suitable for pasting into a terminal emulator. See #Running Some Software.

   #!/usr/bin/env python3
   LINE_LENGTH = 22 # Number of entries passed to the RP/M monitor per line, should be less than 42
                    # although 22 can be better as it reduces the number of carriage returns issued.
   
   def write_rpm(filename, rawdata):
   
       rpm_file = open(filename, "w")
       rpm_file.write("S 0100\r\n")
   
       count = 0;
       for byt in rawdata:
           rpm_file.write("{0:02x} ".format(byt))
           count +=1
           if count % LINE_LENGTH ==0:
               rpm_file.write('\r\n')
   
       rpm_file.write("\r\n.\r\n")
       rpm_file.write("L {0:02x}\r\n".format(int(count / 128)))
       rpm_file.close()
   
   if __name__ == '__main__':
   
       # Read the binary file
       data = open("MBASIC.COM", "br").read()
   
       # create abyte array
       rawdata = bytearray(data)
   
       # create rpm package file
       write_rpm("mbasic_rpm.txt", rawdata)

Appendix C - Tape Connector

Tape DIN Connector as viewed from the front of the G811 CPU card.

          Input
           \ |
   Gnd    -
           / |
          Output

Appendix D - Converting from .DMP to .IMG Format

Python script used to convert from .DMP to .IMG image format.

   #!/usr/bin/env python3
   
   def write_raw_interleaved(filename, rawdata):
     
     # create output file
     raw_file = open(filename, "wb")
   
     # get sectors from raw data
     sectors = list(get_chunks(rawdata, DATA_LENGTH + HEADER_LENGTH))
   
     # write the sectors without the .DMP 8 byte header
     for sector in sectors:
       raw_file.write(sector[HEADER_LENGTH:])
   
     # all done
     raw_file.close()
   
   
   if __name__ == '__main__':
   
     # Read the binary file
     data = open("GM512.DMP", "br").read()
   
     # create a byte array
     rawdata = bytearray(data)
     
     # write the .IMG file
     write_raw_interleaved("GM512.IMG", rawdata)

Appendix E - Floppy Interface Connections

Shugart Pin Assignments

   Pin Name    Dir  Description
   --- ----    ---  -----------
   2   /DCD    -->  Disk Change Detect
   4   /INUSE       A common open-collector LED driver signal? I have never seen this signal used anywhere.
   6   /DS3         Device Select 3.
   8   /INDEX  <--  Index
   10  /DS0    -->  Device Select 0
   12  /DS1    -->  Drive Sel B
   14  /DS2    -->  Device Select 2
   16  /MTRON  -->  Motor On
   18  /DIR    -->  Direction
   20  /STEP   -->  Step
   22  /WDATE  -->  Write Data
   24  /WGATE  -->  Floppy Write Enable
   26  /TRK00  <--  Track 0
   28  /WPT    <--  Write Protect
   30  /RDATA  <--  Read Data
   32  /SIDE1  -->  Head Select
   34  /RDY    -->  Drive Ready/Disk Changed

IBM PC Pin Assignments

   Pin Name    Dir  Description
   2   /REDWC  -->  Density Select
   4   n/c          Reserved
   6   n/c          Reserved
   8   /INDEX  <--  Index
   10  /MOTEA  -->  Motor Enable A
   12  /DRVSB  -->  Drive Sel B
   14  /DRVSA  -->  Drive Sel A
   16  /MOTEB  -->  Motor Enable B
   18  /DIR    -->  Direction
   20  /STEP   -->  Step
   22  /WDATE  -->  Write Data
   24  /WGATE  -->  Floppy Write Enable
   26  /TRK00  <--  Track 0
   28  /WPT    <--  Write Protect
   30  /RDATA  <--  Read Data
   32  /SIDE1  -->  Head Select
   34  /DSKCHG <--  Disk Change/Ready
   

Gemini GM829 Pin Assignments

   Pin Name    Dir Description
   --- ----    --- -----------
   6   /RDY         *Drive Select D/Ready line
   8   /SECP   <--  Index
   10  /DS1    -->  )
   12  /DS2    -->  )Drive Select Lines A-C
   14  /DS3    -->  )
   16  /MTRN   -->  Drive Motor Enable
   18  /DIRN   -->  Direction
   20  /STEP   -->  Step
   22  /WDA    -->  Write Data
   24  /WRT    -->  Write Gate
   26  /TRK0   <--  Track 0
   28  /WPT    <--  Write Protect
   30  /RDA    <--  Read Data
   32  /HSLT   -->  Side Select
   34  /DS4    -->  *Unused/Disk Select D
  • The function of lines 6 and 34 are selected by Link 1. e.g. With B linked to C pin 6 is the fourth drive select line. With A linked to B and C linked to D, pin 34 will be the fourth drive select line and pin 6 will be the drive ready line.

Standard 7 Wire Twist

     10   DS0 --------.     .-- Motor1 -- MotorOn  10
                       \   /
     12   DS1 ----. .---\-/---- DS0 --------- DS2  12
                   X     X
     14   DS2 ----' `---/-\---- DS1 --------- DS1  14
                       /   \
     16   MotorOn ----'     `-- Motor0 ------ DS0  16
         
     Pins 11, 13 and 15 are also twisted, however, all odd-numbered pins are all connected to ground and are not shown here.