Niche Knowledge: Z80 parallel port SD card on Zeta2

green circuit board with secure digital card slot on left and 40-pin parallel interface connectors on the right
Mini PPISD board: a slow SD card mass-storage system for 8-bit computers

Almost no-one will need this knowledge, but I might need to remember it. In order to add Mini PPISD support to a RomWBW 3.01-supported system, you need to create a file called something like Source/HBIOS/Config/ZETA2_ppisd.asm (for yes, I’m using a Zeta SBC V2) containing:

#include "cfg_zeta2.asm"
UARTCFG		.SET	UARTCFG | SER_RTS
CRTACT		.SET	TRUE		
PPIDEENABLE	.SET	FALSE		
SDENABLE	.SET	TRUE		
PPPENABLE	.SET	FALSE		
PPISD		.EQU	TRUE

Running make from the top-level directory should create a ROM image called Binary/ZETA2_ppisd.rom for you to write to flash. Since my floppy drive isn’t feeling too happy, I had to resort to buying a TL866II Plus programmer to write the chip.

And it worked!

 RomWBW HBIOS v3.0.1, 2021-03-12

 ZETA V2 Z80 @ 8.000MHz
 0 MEM W/S, 1 I/O W/S, INT MODE 2
 512KB ROM, 512KB RAM

 CTC: MODE=Z2 IO=0x20
 UART0: IO=0x68 16550A MODE=38400,8,N,1
 DSRTC: MODE=STD IO=0x70 Sun 2021-03-14 17:47:13 CHARGE=OFF
 MD: UNITS=2 ROMDISK=384KB RAMDISK=384KB
 FD: IO=0x30 UNITS=2
 SD: MODE=PPI IO=0x60 DEVICES=1
 SD0: SDSC NAME=SD    BLOCKS=0x003C7800 SIZE=1935MB

 Unit        Device      Type              Capacity/Mode
 ----------  ----------  ----------------  --------------------
 Char 0      UART0:      RS-232            38400,8,N,1
 Disk 0      MD1:        RAM Disk          384KB,LBA
 Disk 1      MD0:        ROM Disk          384KB,LBA
 Disk 2      FD0:        Floppy Disk       3.5",DS/HD,CHS
 Disk 3      FD1:        Floppy Disk       3.5",DS/HD,CHS
 Disk 4      SD0:        SD Card           1935MB,LBA

 ZETA V2 Boot Loader

 ROM: (M)onitor (C)P/M (Z)-System (F)orth (B)ASIC (T)-BASIC (P)LAY (U)SER ROM  
 Disk: (0)MD1 (1)MD0 (2)FD0 (3)FD1 (4)SD0 

 Boot Selection? 

I was pleasantly surprised how easy it is to use a TL866 programmer under Linux. minipro does all the work, though. To write and verify the whole 512K Flash ROM, it’s:

minipro -p SST39SF040 -w ZETA2_ppisd.rom

The programmer supports over 16000 devices, of which around 10000 are variants (form factor, programming voltage, speed, OTP, etc). It’ll also verify over 100 different 74-series logic chips. It’s not a super cheap device (mine was a little over $80, from Simcoe Diy) but it does a lot for that price.

Next stop: try rebuilding BBC BASIC with RomWBW’s timer support included ..

ZX81 40th Anniversary

So the Z80-powered doorstop that got so many people started with computers was launched 40 years ago.

My story is that we never had one: we had three, but only for a week each. It’s not that they failed, either. My dad, who ran the computer bureau at King George V Docks for the Clyde Port Authority, was Glasgow’s representative on the European Association for Data Processing in Ports (EVHA). The group was looking at ways for automating ship identification, efficient berthing and documentation handling.

All the ports had data centres, but most of the mainframe time was for predefined tasks such as dock-worker payroll. There wasn’t the budget for computer time to try some of the experimental projects that may have helped with port automation.

Several EVHA members were trying home computers unofficially, but many of them were too expensive to come in under expense account rules. These “big” micros required a business case and purchase order to buy. The ZX81, limited as it was, did fit in the expense budget and – equally importantly – fitted into my dad’s suitcase as he made his monthly trips to Europe.

The week before my dad was scheduled to leave, he’d buy a ZX81. Of course, it needed “testing”, something me and my brother were only too happy to do. At the end of the week, it would get packed up and on its way to Europe.

I’m not sure if the clandestine micros were ever actually used for controlling ship traffic (you get considerably fewer than three lives manoeuvring an LNG tanker), but more likely in simulation. I understand that the ZX81 was able to simulate the traffic management for the entire Port of Rotterdam for a while, at least until its RAM pack wobbled.


reposted from ZX81 40th Anniversary – Histories – Retro Computing

Zeta: it lives!

zeta_firstboot-20150725wYou have no idea how good it was to see that message come through over the serial link. The Zeta worked first time!

Here’s the board, fully populated:

zeta-complete-20150725I still have to put it in a proper case. A visit to Above All Electronics did result in getting a floppy drive (and most importantly, 3½” 1.44 MB floppies …) and all the cables, so I’ll add that later. But for now, I’ll try to remember how CP/M works …

 

Zeta: all soldering done!

Please excuse horrible blurry photo, but I think all the soldering is done —

zeta-20150724This adds the crystal sockets, the 32.768 kHz RTC crystal, the status LED(s) and the reset button.

A whole new board I soldered up is the Mini-PPISD. It adds (slow) SD card storage to an SBC board:

ppisd-20150724Man, but those surface mount SD card pads are a pain. I had to get flux on the PCB pad and the bottom of the SD connector, load a little blob of solder on the iron, then warm up the pad and roll the solder into place. It made a satisfying little Zsht! noise as the flux burnt off, and the molten solder got drawn under the pad by capillary action.

Next up is checking the power and ground continuity, adding the chips, building a null modem (grr; I hate RS232, really) and finding a case. I may already have one, but I may forage at Above All to get a 3½” floppy drive and enclosure. I definitely have an old Turbo/reset button from an XT that would make a great reset breakout.

Zeta: looks more finished than it really is

zeta-20150712Just waiting for the full-can oscillator sockets (and most of the chips) to arrive from Mouser. I could have used 14-pin DIP machine pin sockets, as Sergey was thoughtful and had all of the holes drilled.

Most of the big sockets need to be fully soldered, as at the moment they’re just tack-soldered at the corners. Maybe I’ll put on some dronecore and have a meditative time with the Sn-Ag tonight. I’ll be glad to get the flux off the board, though: it’s not my usual stuff (which is Kester #951; no clean ftw), and what I’m using is smoky and a bit gummy. It does make nice bright joints, though, which is never 951’s strong point.

Zeta: A small matter of soldering …

zeta-20150710That’s all but one of the capacitors in. The big chip sockets are soothing to solder.

Apart from the bits I got in a frantic dash between Supremetronics and Creatron on College, the rest is coming from Mouser. Taking the advice of someone who should know better, I’ve ordered a made-in-DDR UA857D MME chip, since Z80 CTCs are back ordered. Sometimes, it’s good to have chips older than your colleagues …

Minimalist Computer Build: Zeta SBC

zeta sbc v2 boardI’m building a Zeta SBC V2, a basic Z80 computer in the spirit of the N8VEM. I’m trying to kit it out mostly locally, which means extensive trips to Creatron, Supremetronics/Honson Computer (aka the basement of College Home Hardware), Above All Electronic Surplus, and Active Surplus.

Fun discovery #1: not all CR-2032 battery holders are the same size. This board call for the one just a tiny bit larger than the coin cell itself. Most of the ones with the retainer clip that goes over the battery are too big, and will prevent other components being installed.

Sometimes, things do not go exactly as planned … C development for Amstrad CPC on Raspberry Pi

Hey! This is ancient! But since we’re talking about even more ancient computers, those bits still work. I’d recommend looking at the current installation instructions for z88dk rather than what I’ve got here.

a very very crashed Amstrad CPC screen

If you crash an Amstrad CPC, you often got some pretty patterns. Like the one above, which was supposed to print the alphabet, but got about as far as R, then started making coloured spots on the screen. My alphabet doesn’t (usually) contain coloured spots, so something went wrong.

This post is only about the Raspberry Pi in that it’s the nearest always-on Linux system that I have. This would likely work fine on any Linux machine. While the Z80 cross compiler I use (z88dk) is available in the repos, I can’t get it to build anything, so I just pulled down the latest version. To build the compiler:

wget http://nightly.z88dk.org/z88dk-latest.tgz
tar xvzf z88dk-latest.tgz
cd z88dk
export Z80_OZFILES=$(pwd)/lib/
export ZCCCFG=${Z80_OZFILES}config/
export PATH=${PATH}:$(pwd)/bin
./build.sh

This should result in a working environment. We can test it with a simple C program:

/* alfa.c - print the alphabet */
#include <stdio.h>

int main(void) {
  char a='A';
  char b=26;
  while (b>0) {
    putchar(a);
    a++;
    b--;
  }
}

You can build it with:

zcc +cpc -create-app -make-app -O3 -unsigned -o alfa.bin alfa.c -lcpcfs -zorg=16384

You should end up with a file alpha.bin of approximately 4749 (!) bytes. You can copy it to a disc image using iDSK:

iDSK blank.dsk -i alfa.bin -c 4000 -e 4000 -t 1

It runs like this:

You can do the same with Z80 assembly language (shown here in the most gratuitously pretty Amstrad assembler, Maxam):
Although this results in only 11 bytes of code, it’s not portable; the C code above compiled and ran on both my Raspberry Pi and my Mac. It wouldn’t even run properly on a different Z80 system, as only the Amstrad CPC knows that call #bb5a prints the character in the A register. On the ZX Spectrum, for example, it was the completely different instruction rst 16 to print a character.

(There’s a lot more on z88dk on the CPCWiki.)

2D Star Dodge flies again!

There’s rather more nostalgia in this post than I’d want to deal with. If you want to just play the game, go here here and skip this blurb.

Update: the Java emulator doesn’t work in the browser any more, so here’s Arnold playing the BASIC version: http://scruss.com/cpc/6128s.html?stardoj.dsk/run%22stardoj2

About 25 years ago, I was a smallish computer nerd obsessed with programming his Amstrad CPC464. I had got a BCPL rom-based compiler for cheap and was looking for things to do with it. “Why not write a game?” I asked myself.

There were two minor hurdles. I had no imagination, and I certainly wasn’t focused enough to write anything big. Fortunately, it was still the 80s, so we knew how to rip stuff off without being called out for it. I merrily copied a game my friend Alan Cook had written for the Dragon 32, and called it 2D Star Dodge.

2D Star Dodge was the perfect rip off. Not merely had I ripped off the idea from Alan, but he had ripped off the idea in turn from a BBC Basic one-liner game called (as verified by Graeme Smith) “One Line” Asterisk Tracker. The name 2D Star Dodge was an, um, homage to Realtime Games’ 3D Starstrike, which itself was “strongly influenced” by the Star Wars arcade game. Originality? Pfft.

So I wrote the game. Well, okay, I wrote a mockup in Locomotive BASIC, which ran a bit slowly, but gave me something to work from. Here it is, if you want to play it in you (Java-enabled) browser: 2D Star Dodge – BASIC. I then meticulously translated it into BCPL, and ended up with something that looked liked this:

(if you click on that image, you can play the BCPL version in your browser.)

this is actuall screen three, hope no-one notices ...

 

The gameplay — press a key to go up, stop pressing a key to go down — is a bit like SFCave (obligatory Java version: Lab6 SFCave) or even my current favourite Tiny Wings.

Once I’d finished the BCPL version, I had bought the MAXAM assembler ROM, and got learning the Z80 opcodes. Soon, a third port was complete, now needing hardcoded delays to be playable as it would kill you off in about one screen refresh without them.

So, now I had three versions of the same game. There was only a limited number of local folks I could give it to, so I decided to send all three versions to Amstrad Computer User magazine to print as a type-in. Thankfully, it arrived on the desk of the freshly minted (yet still beardy) assistant editor Jeff Walker, who had founded the jam econo CPC magazine/club WACCI. Jeff had the idea for me to turn the simple game into a comparison of programming in three languages.

Thanks to the CPCWiki forum, you can now read the articles I wrote in Amstrad Computer User in 1988 that went with the code. Writing style best described as “typing”:

To play the game in an astonishing JavaScript emulator:

  1. Download this disc image file: stardoj
  2. Unzip it
  3. Go to CPCBox
  4. “Choose configuration …” of Boot CPC464 (or 664, or 6128)
  5. Select your downloaded stardoj.dsk as Drive A:
  6. Annoyingly, it seems to be stuck with an AZERTY keymap, so to catalogue the disc (cat) you have to type cqt
  7. To run the BASIC version, type run"stardoj2 (on my American keyboard, that becomes run@stqrdoj2; quotes are Shift+2). Hitting Escape twice will quit back to the prompt.
  8. To run the BCPL version, type run"2dstardo. The only way to quit is to reset the emulator.

The BASIC version is based on the published type-in. The BCPL version I found as a disk image (2dstardo.dsk) on a download site — it’s exactly as I submitted it to the magazine, dubious copyright message and all. I’m not sure how it got out there; I suspect either my network of, ahem, software protection experts I knew through Colin Harris of Nemesis, or it went via my CPC-owning French penpal (Hi Benoit Hébert, formerly of Le Havre).

I had to modify the BCPL binary to run on modern emulators, as the real Amstrad CPC did a thing with its keymapping that is really hard to get right on modern systems. Originally, the game used the Shift key, but I modified it to use Space, which is easier to emulate as it’s a printing character. Can I just say that I remembered how to read and modify Z80 binaries after a quarter century? Old school, literally. I used iDsk‘s disassembler/hex dumper and emacs’s hexl mode to do the deed.

I recently discovered that someone created a Flash game based on my type-in: Star Dodger. Mind = Blown.

Update, 2018: Lawks! Someone wrote a PureScript version! It doesn’t exactly work for me on Firefox, but it does on Chromium.