UK Vintage Radio Repair and Restoration Powered By Google Custom Search Vintage Radio Service Data

Go Back   UK Vintage Radio Repair and Restoration Discussion Forum > Specific Vintage Equipment > Vintage Computers

Notices

Vintage Computers Any vintage computer systems, calculators, video games etc., but with an emphasis on 1980s and earlier equipment.

Reply
 
Thread Tools
Old 28th Nov 2018, 9:46 pm   #1
SiriusHardware
Nonode
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 2,333
Default MK14 programming interface - MK2

Over the past few weeks I have been putting together a new MK14 programming system. I made one which worked perfectly well back in 2012, but it was quite physically complex and not really a suitable project to put into the public domain for other people to build.

Here is the 2018 version.

-Like the original interface, fully isolated so that the interface can be connected to / disconnected from a running MK14.

-Uses only 12 optocouplers in a less complicated layout compared to the original project's 20, greatly simplifying construction.

-Directly controlled via a Python program running on a late model (40 pin) Raspberry Pi, such as the Pi Zero used on this one.

-An (optional) thirteenth opto allows the interface to reset the MK14, so that if it is already running a user program the interface can force it back to the monitor in order to programme it.

-The python control software looks out for two bytes in the file at address FFFE/FFFF, not a real address on the MK14. If it finds them it will take those two bytes as the Hi/Lo bytes of the execution address and will run the program automatically after the code has been typed in. (For those not familiar with the MK14, the first byte of an MK14 program is not necessarily the address from which the program has to be run).

The above two features combined form a hands-off development system for the MK14, since you can can then continually modify, download and run programs on the machine without having to touch it, unless of course your program requires keypad input.

Here's the hardware. It's built on stripboard, because it is simple enough to build on stripboard. I chose to use SM components because I have easy access to them and soldered them on the track side, but it is just as easily built using conventional components.

I'll add the python control software (which is working) and a couple of example .hex files of programs from the MK14 manual to upload with it in due course.
Attached Thumbnails
Click image for larger version

Name:	PiZero_MK14_PRG_1.jpg
Views:	54
Size:	57.7 KB
ID:	173605   Click image for larger version

Name:	PiZero_MK14_PRG_2.jpg
Views:	63
Size:	146.9 KB
ID:	173606   Click image for larger version

Name:	MK14_Pizero_Interface.jpg
Views:	74
Size:	72.1 KB
ID:	173607  
SiriusHardware is online now   Reply With Quote
Old 4th Dec 2018, 9:46 pm   #2
SiriusHardware
Nonode
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 2,333
Default Re: MK14 programming interface - MK2

Attached is a little Python utility called 'key14'. This will only run on a Raspberry Pi due to the fact that it makes use of Python's specific interface to the GPIO pins on that machine. It is made to work with the interface in post #1 and is the easiest way to test it. The file inside the .zip is a Linux/Unix format text file, which means it doesn't have carriage returns at the ends of the lines and it may look rather messy if loaded into a DOS / Windows text editor. Therefore, best viewed on the Pi itself, in 'nano' or your preferred editor / viewer. It is assumed that Python 3 is already installed, as it is in the Pi's standard Raspbian distro.

As configured, 'key14' is made for Pis with 40-pin GPIO headers and the SPI interfaces must be configured OFF in raspi-config otherwise they will clash with some of the pins used by this project. It would not be difficult to edit the script to use only pins from the 26-pin subset of GPIO pins on earlier Pi models, but then the GPIO connections on the right hand side of the diagram, third image in post #1, would have to be redrawn accordingly and more GPIO pin secondary functions would have to be turned off to free up some pins.

What this utility does is send keys pressed on the Raspberry Pi's keyboard to the MK14. There is a near one-to-one correlation, so the keys 0-9, A-F on the Pi's keyboard press those keys on the MK14.

Keyboard keys G, M, and T press the MK14's Go, Mem, and Term keys.

For 'Abort' I've had to use 'Q', since 'A' is already taken. If you have included the thirteenth (Reset) opto in the interface, 'R' resets the MK14. 'Esc' gets you out of the program and back to the command line, as does CTRL-C.

All other keyboard keys are also echoed to the screen, but nothing is sent to the MK14.

The hex file uploader program (to be added eventually) works at very high speed, which would make it very difficult to debug any problem on the interface hardware. This utility was primarily made to enable single key testing of the interface but it is also perfectly possible to use it to hand-enter a hex listing into the MK14 using the Raspberry Pi's 'proper' keyboard: An unusually luxurious experience.

Limitations:

All key presses sent to the MK14 are momentary, and the Pi's keyboard auto-repeat buffer is not disabled. If you hold down a key on the Pi's keyboard it will send a single character shortly followed by a flurry of repeated characters.

This can only be run from a command line prompt due to the fact that it uses 'curses' for keyboard character input. It will fail if you try to run it from, e.g, the Idle IDE because Idle and Thonny do not play well with 'curses'.

To 'install' this, if you already have a 'bin' directory in your home directory put the file in there. If you don't already have a 'bin' directory in your home directory create one and then reboot the machine: The new 'bin' directory will then automatically be added to the command search path.

In either case, go into the 'bin' directory and if necessary make the 'key14' file executable with

Code:
chmod +x key14
Return to your home directory and it should now be possible to run the program with

Code:
key14<enter>.
Attached Files
File Type: zip key14.zip (1.0 KB, 4 views)

Last edited by SiriusHardware; 4th Dec 2018 at 9:51 pm.
SiriusHardware is online now   Reply With Quote
Old 10th Dec 2018, 12:10 am   #3
Slothie
Tetrode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 79
Default Re: MK14 programming interface - MK2

Sterling work Sirius. I REALLY must find that box of edge connectors I have somewhere...
Slothie is offline   Reply With Quote
Old 10th Dec 2018, 1:03 am   #4
SiriusHardware
Nonode
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 2,333
Default Re: MK14 programming interface - MK2

The uploader program / script which does the real work will be uploaded here soon. I did all the preliminary testing with the program written to work only with MK14s which have the new OS, then relented and decided that I would include a settable flag in the program so that it could be set to work with the old OS just by changing one line of the script. Code entry on an MK14 with the old OS requires a different (and more numerous) sequence of keypresses to achieve the same thing.

I made those changes and started to test it, only to discover that the file copy of the 'old' OS that I've had lying around for years was corrupt - it came up with the correct '---- --' reset prompt but would not allow me to enter data. I still have my original old-version PROMs somewhere but could not manage to find them anywhere, no idea where I have put them.

Martin Lukasek's site came to the rescue once more, as I found binary file coples of both OSes buried in an obscure corner there. The file for the old OS there is good, and so far the uploader seems to be working with the old OS as well as the new. I've only tested on a Pi Zero W so far - just need to find a 40 pin to 40 pin IDC header cable so I can test with a Pi 3 as well.

If you can't find your original collection of edge connectors there are various retro suppliers who sell 'ZX Spectrum' edge connectors - they are longer than needed for the MK14 edge connector but are easily sawn down to size.
SiriusHardware is online now   Reply With Quote
Old 11th Dec 2018, 3:09 pm   #5
Slothie
Tetrode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 79
Default Re: MK14 programming interface - MK2

Quote:
Originally Posted by SiriusHardware View Post
just need to find a 40 pin to 40 pin IDC header cable so I can test with a Pi 3 as well.

If you can't find your original collection of edge connectors there are various retro suppliers who sell 'ZX Spectrum' edge connectors - they are longer than needed for the MK14 edge connector but are easily sawn down to size.
Don't forget an old IDE hard drive connector is a 40 way ribbon cable with IDC connectors... If you can't find one of those I can send you one of mine, in these days of SATA they're not much use (aside from use on Raspberry Pi's I suppose!)

I know as soon as I put hacksaw to expensive Spectrum connector I will trip over the box with my edge connectors! They are lovely MIL spec McMurdo connectors too, so maybe it would be worth the sacrifice
Slothie is offline   Reply With Quote
Old 11th Dec 2018, 11:45 pm   #6
SiriusHardware
Nonode
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 2,333
Default Re: MK14 programming interface - MK2

Ahem, I still have more PCs with IDE drives than I do with SATA (...Grump..!)

I had considered an IDE cable but they are usually over long for this purpose... if I can find one with two connectors near one end (did that ever happen?) I may just cut that section off. They are available quite cheaply as short ready made assemblies from the likes of CPC anyway, specifically intended as GPIO breakout / extender cables for the Pi.

I think I do need to test on a Pi 3 etc because I have the relevant delays pared down to the shortest which will reliably work (therefore the fastest upload speed) on a Pi Zero W. On the new OS it uploads the 'Message' program from the manual in just over three seconds. The Old OS unfortunately requires five keypresses per data byte entry, so it takes a second or so longer to upload.

While things like the length of a keypress and the post-release debounce period are specifically timed and will not vary from one Pi to the next, the extra speed at which a 'big' Pi could whizz through the other, un-timed parts of the script may cause unforseen problems, so I just want to check that.
SiriusHardware is online now   Reply With Quote
Old 12th Dec 2018, 12:37 am   #7
Slothie
Tetrode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 79
Default Re: MK14 programming interface - MK2

It is possible to carefully dismantle and remove the IDC connectors on a ribbon cable and re-connect them closer together if you use a small vice to re-pierce the insulation. I've done it to repair a cable when I've needed to "in extremis" (i.e. at 2am when you need it working in the morning and you can't find any spares). I think I broke one of the plastic clips by being clumsy, but it was nothing a bit of hot glue couldn't fix!
Slothie is offline   Reply With Quote
Old 13th Dec 2018, 1:39 am   #8
SiriusHardware
Nonode
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 2,333
Default Re: MK14 programming interface - MK2

Found an IDE cable with two closely spaced drive connectors on it at one end, but then noticed that the drive connectors had a blanked off pin, to ensure connection of the headers the right way around. Found two more like that, and then finally a fourth one where the connectors were 'ordinary' 2 * 20 (40 way) IDC connectors. I'll try the interface with a Pi 3B tomorrow, time allowing.
SiriusHardware is online now   Reply With Quote
Old 14th Dec 2018, 3:35 am   #9
SiriusHardware
Nonode
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 2,333
Default Re: MK14 programming interface - MK2

Here it is, attached, the companion Python hex uploader script for the interface described in post #1, called 'send14'. I have also included a couple of the programs from the MK14 manual as hex files, namely 'Message' and the 'Moon Landing' game. As before, the script is a Linux / Unix format test file and is best viewed / edited on the Pi or a Linux PC. I don't claim this is beautiful code - but it does work.

It was originally written on a Pi Zero W but has also been tested on a Pi 3B. In theory it will work on any Pi with a 40-way GPIO connector. The 'alternative' SPI mode of some of the GPIO pins needs to be turned off in raspi-config otherwise they will clash with some of the pins used by this project.

Unpack the zip file into your home directory and move the 'send14' file into your home/bin directory. There, make it executable with

Code:
chmod +x send14 <enter>
On returning to your home directory you should be able to run it.

Example Usage:

Code:
send14 message.hex <enter>
If all is well you should see the MK14 display zooming rapidly through the address range as the code is typed in at superfast speed, and then, if you have uploaded either the message.hex or moonland.hex file included in the .zip file, the program will also auto-run. On an MK14 with the 'New' OS, 'Message' will upload and run in roughly three seconds. 'Moon Landing', probably the longest and most complex program in the MK14 manual, takes a little longer.

Limitations:

- Can only upload Intel Hex format files.

- No checks on whether the addresses in the hex file are legal addresses on an MK14 - it's up to you to make sure they are, by including .ORG statements in your source code.

- Can only upload code to the MK14 if it is at the 'ready' prompt, ---- -- for the old monitor and 0000 00 for the new - unless you have included the thirteenth 'Reset' opto in the interface, in which case the interface will reset the MK14 to force it back to the monitor before it starts uploading. The reset circuit is not directly available at the PCB edge connector, so connections from the reset opto to the reset circuit have to be made with spring test clips clipped onto the +ve and -ve leads of the reset capacitor close to the reset switch.

The Autorun feature is invoked by including something like the following
at the end of your source code - or in fact anywhere in the source code:-

Code:
    .ORG 0xFFFE
    .DB   0x0F
    .DB   0x12
(The exact syntax depends on which assembler you use). FFFE is a 'special' address for the uploader, not a real address on the MK14. It will use the two bytes at FFFE and FFFF in the file as the execution address from which the program should autorun after being uploaded.

The uploader expects the execution address bytes in the order high byte, low byte. If you use something like a .DW 0x0F12 statement to place a 16-bit word in memory, your assembler might actually place the bytes in reverse order - so I suggest always defining the execution address as two separate bytes, as in the example above, to make sure they are placed in the code in the right order.

The script was originally written to upload to an MK14 with the 'new' OS, but I modified it so that it could easily be made to work with an MK14 with the 'old' OS - to do that, load the script in a Linux text editor, locate the 'MK14_OS = 1' Line just a few lines into the program, edit it to say 'MK14_OS = 0' and save the modified file.

If you get it working or experience any problems, let me know.
Attached Files
File Type: zip send14.zip (4.4 KB, 2 views)
SiriusHardware is online now   Reply With Quote
Reply

Thread Tools



All times are GMT +1. The time now is 12:59 pm.


All information and advice on this forum is subject to the WARNING AND DISCLAIMER located at https://www.vintage-radio.net/rules.html.
Failure to heed this warning may result in death or serious injury to yourself and/or others.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright ©2002 - 2018, Paul Stenning.