Saturday 23 September 2023

Lancess Priya plus/4

I found some time to convert the Lancess Priya game to Commodore plus/4, the underappreciated little brother of Commodore 64. I formally demo'd the plus/4 version at the Skrolli magazine demoparty at 23th September 2023, and the game is now available at plus4world.

Lancess C64 made extensive use of sprites to generate the dashboard and fireball graphics, so all this had to be made to work in the pseudo-pixel character graphics.

But this was not a great problem, some of the font elements could even look nicer when they are more chunky. I already experimented with it on the C64 version before deciding on the sprite approach. This also simplified the interrupt a little, as there's no need to multiplex sprites.

The fireballs (enemy shots) were the toughest, as these needed to be drawn differently. I believe the added speed of the plus/4 made it possible to draw them without noticeable slowdown. The graphics also use less space than the sprites, which although not necessary, made handling memory issues easier.

The fireballs, taken together with the sights also means the gameplay area is quite monochromatic. The sights cannot be moved in every frame like in the C64 version, but I felt this wasn't a problem. I added some color to the texts, to take at least some advantage of the platform qualities.

TED sound is much simpler than SID, so it didn't take long to have some sound fx and some abysmal ditties playing here and there. I didn't set the bar very high though! I ignored the SIDCart route this time as the C64 version soundscape was quite simple to begin with.

I took the opportunity to fix a few glitches and bugs found from the C64 version, these may be eventually released as a C64 v. 1.1.

-You could ambiguously "fly over" the towers, which wasn't very apparent if you fly closer to the ground. It made it look you could just pass through everything, but this was not the intention. The towers are clamped a little awkwardly to the bottom of the screen to prevent them from disappearing.

-The "deathstar" graphic in the space battle would wrap around in a rather silly way. I just couldn't be bothered for the initial release. I now made the wrap-around at least a little less conspicuous for this non-moon.

Lancess Priya at plus4world

Friday 8 September 2023

The Raspberry-based Z88-wannabe

After playing with the portable Cambridge Z88 computer and reading little more about devices such as Amstrad NC-100, Epson HC-20, Husky Hunter/Hawk and the Tandy TRS-80 Model 100 (Kyotronic KC-85), I began to wonder if anything exists currently in the same form factor.

There are a few keyboard-display hybrids. There's the Ficihp K2 keyboard with an integrated display.  Another is a BQAA RGB keyboard, which looks larger with keypad included, and something called Kwumsy, a very similar concept.

These hybrids do not contain a computer. Expensive, and apparently geared more as an add-on for gamers and such, I passed these opportunities as something that wouldn't work for me and not easy to hack into a full portable computer.

But it became clear that mass-produced screens must exist for such devices, and I started planning my own version.

*** Some of the details are left vague on purpose – for inspiration only! I'm not responsible for destroyed Raspberries, lost data and house fires other than my own. ***

Model 100 or Z88?

Exactly ten years after building a wooden prototype to house a Raspberry Pi, I felt I could hodge-podge something together without going too deep into electronics or software development.

And yes, many have hacked Tandy Model 100-inspired cases for Raspberry, or even used an original case. Model 100 was far more widespread and better known than the Z88, especially in the US.

Hobbyists and crowdfunders have built some Model-100 successors, such as the Clockwork DevTerm, and the Ready! Model 100. Just looking a these makes me feel I don't want all that clutter.

My concept:

A no-nonsense slab computer inspired by Cambridge Z88, mostly for writing.

-Large-font terminal for focused text editing etc.
-No GUI/Desktop/Browser
-No mouse, no trackpad, no nothing
-No connectors
-Flat rubber keyboard if possible!
-Wifi is still needed there to install software and easy transfer of files

I would not break my Z88, and my project is not about building a computer inside that case. I probably couldn't get the parts to fit there anyway.

Well, off to hacking.

The screen

I started by hunting for a suitable display. The Z88 original design depended greatly on the availability of a particular LCD display, and I have a very similar design constraint here.

I would have liked to use an e-Ink display just for the added weirdness, because I've seen videos of people connecting them to Rpi. But I couldn't find anything close in the aspect ratio and size range I'd need. It's either book page territory or tiny electronic price badges.

Some of the first tests with the display, running Raspberry OS

Eventually I decided on a Waveshare 10.9 inch HDMI display with 320x1480 resolution. Another option might have been an 8.8 inch screen with 480x1920 resolution, but the proportions didn't look that inviting. And yes, the 320 is the default horizontal resolution!

It's a touchscreen, but I'm not going to use that feature.

I ordered the Waveshare from berrybase on ebay and received it soon enough. The package included the screen, HDMI cable, USB power cable, and an assortment of screws, stands and USB adapters for different Raspberry models. There's also a cloth for wiping the display clean.

Just connecting the HDMI to any old output of a computer doesn't work, the computer needs to have drivers. And fortunately the Raspberry Pi OS has that, and the product is clearly intended to work together with a Pi. 

It is a good idea to do the initial tests with the basic OS without jumping into the Lite OS or some other build.

The configuration is clean, but a little tall for my purposes.

A fresh desktop is a little annoying as the initial dialogues do not fit the narrow screen. Remember, the screen is horizontal in the 320-dimension. But after getting through this, it's possible to use the OS screen/display functions to rotate the screen.

A better way to do this is to adjust the config.txt and the display parameters prior to booting up.

With some more fooling about, I had a correctly rotated terminal screen using a 16x32 font (sudo dpkg-reconfigure console-setup). This gave me a chunky-looking 93x10 character display, inspired by the 8-line Cambridge Z88 display. After that I began to think of installing the OS lite version without desktop on a separate card. More about that below.

I feel the shape of the screen is quite close to what I want, and the product connects and displays the Pi screen with no big hassle. All in all this stage was a lot easier than I thought.


I did the initial tests with PSUs, but I was eager to start planning and building the case itself.

A thin battery would be desirable. There are really small products that cater mostly for no-display, low power operations. The JuicePi hats look a little daunting, eating all that space would be a little counterproductive.

A battery should run the Raspberry for many hours and the screen is likely to eat up power. So I tried to look for something sturdy, such as a power bank.

I bought an Insmat Exclusive PD3.0 Super Mini 10000mAh power bank, because it happened to be on the shop shelf and had promising enough parameters. It's about 18mm thick with 2 USB-A output sockets. This made it possible to power both the screen and the Raspberry instantly without any modifications.

10000mAh sounded like a minimum, a ballpark estimate says I might be able to run the Pi and the screen for a couple of hours.

I wish there were more flexible backlight options on the Waveshare, I could live with a relatively dim screen in this context. A similar display with ISP technology seems to have more options in this regard. Here, even the lowest setting is quite bright. Only in a very bright office environment it begins to look dimmer in comparison to other displays.

The power switch

There are a lot of tutorials on how to build a safe power on/standby switch, but nothing very reassuring about cutting the power physically. I think it should be safe to cut the power after I've issued the shutdown command, just as I have to do anyway when I pull off the cable.

I tried powering the screen from the Raspberry 5V out, using only one USB out from the power bank. This should be the same as sharing the input of the MicroUSB. But although initially promising, this seemed to cause problems and undervoltage, so I reverted back to using the both USB power outs separately, as it appeared to work better. Fortunately I have a switch that controls two separate power lines.

I'll discuss the undervoltage problems further below, it's not certain that powering the screen from Pi was to blame.


The first keyboard connected was a quality Apple Mac mini keyboard. This was all well until I noticed I had trouble getting <|> keys from where I'd expect. Changing the settings from raspi-config seemed to do nothing. Oh well.

I'm not going to mutilate the Apple keyboard for this project anyway, so I went for my old Deltaco TB-5V. Which, incidentally, mapped correctly.

This mediocre mini keyboard was cannibalized already before and it'll live again for this prototype. It's not quite as wide as the screen, which is fine. The keyboard model is rather good for repurposing, as the controller is still a simple separate through-hole board and the connections are easy to understand. I de-soldered the LED lights as I have no room for them.

I did look into the idea of using a laptop-specific keyboards, but getting them to work on a Raspberry is not as simple as plugging in.

First attempt, will everything fit?

For a more Z88-like experience, I wanted to use rubber keyboards.

Aliexpress does sell the aptly named 85Keys Foldable Soft Silicone Mute USB Wired Mini Keyboard Computer folding keyboard Accessory, but this has an annoying lump at the left side so it's a no-no.

Having that lump appears to be a common feature in rubber keyboards. Wetkeys sells soft-comfort rubber keyboards without a lump, but they also have a numeric keypad which makes them far too wide.

I'll forget about this angle at least for now.

Raspberry Pi : Putting it all together

From my loose assortment of Raspberries, I have a choice of 1/2/3. As I'm going to run a Linux terminal there with no graphics, I could even use some of my older Pis.

Explosion. The screen is still "upside down" compared to the final arrangement.

I settled with 3B+ for the moment as the Waveshare promises to work with it. I need to mod the Pi so I'd prefer not to alter the earlier models which might become museum items.

Admittedly, the 3B+ uses more power than many other models, and in the future it might be wise to consider Pi Zero W model for such a modest purpose.

The logic of getting the screen to work and rotate correctly may be a little different depending on the Pi model.

The Waveshare product included the screws and stands to fit the Raspberry below the screen, and at first I did just that. The HDMI-HDMI connector dongle is a neat addition which removes the need for a bulky, inflexible cable. The power cables however stick out from an unfortunate angle, which can't be helped now.

The HDMI-to-HDMI is neat, but the power cables are still in the way. Keyboard controller at right.

The Waveshare concept pointed to overall device thickness in the 40mm territory, which was a little too tall for me. I looked into how to either reposition the Raspberry or remove the tall USB connectors and the ethernet connector, and using lower stands.

Trying out various loose configurations, I kept coming back to the way Waveshare intended: Raspberry screwed together under the display. To get at 30mm thick device, I changed the 25mm stands to 15mm and removed the bulkier elements from the Raspberry board.

It might have been better to get a Raspberry 3A+, which is thinner, but I was a little impatient and some Raspberrys can still be a little hard to find.

Smashing away the USB connectors.

Removing the Ethernet connector with heated pump and soldering iron was almost possible to do cleanly. But for the USB it was far easier to just peel it open with pliers, cut and crush the parts inside. Then cut the wires and solder wires on the remaining "pins".

Sadly this means breaking and throwing away perfectly good parts. But now at least I could fit the display on 15mm stands, bringing the overall thickness to 32mm (The MDF board is 3mm thick).

Ultimately the battery height of 18mm under the keyboard decides the height of the computer, so there's no benefit in getting the screen any lower.

So, it's rather bulky compared to the Cambridge Z88. As a minor consolation, at 292x190x32mm the depth of the computer is at least less than the Z88. The chunky chipboard appearance is rather nice.

Figuring out dimensions in a LibreCAD section.

As mentioned, I eventually got electrical problems, at least the Raspberry was eager to show the "undervoltage" warning occasionally.

I really started to get these only after packaging the whole thing and connecting the power switch. So, this might be due to bad cables, connectors, soldering, or whatever.

But it might also be that this particular power bank doesn't give power evenly, and the display is such a power hog the intake will easily drop below the minimum. I don't have very clear specifications about how many amperes the display would like, Waveshare site suggests 3A and that's also the power bank nominal output.

The power bank specs are unclear about whether the separate outputs supply 3A at the same time, so I assume it the value is for the total.

The 3B+ Pi model is apparently a little finicky about the power input, whereas an earlier model might complain less. However the 2B doesn't have wifi, which would be a little too limiting. And besides, it might be a good idea to actually have these warnings so I know it is an area to be improved.

After I fiddled with the connectors and the wires, and gave the power bank a good recharge, I stopped seeing the undervoltage warnings. But the wiring inside is still a problem area and I'm not going to show that mess now.

The below image sketches out the basic case shape and especially the keyboard holder, but it's not a precise indication of how it was built and what kind of parts were used. I used clamps and wood glue to pile together 3mm cardboard and MDF pieces.

This Blender model was made after building.

OS and Software

Although the Cambridge Z88 served as a point of departure for this computer collage, I'm not looking for actual Z88 simulation here.

But just for fun I looked at software that could create a somewhat comparable experience, using the 93x10 character terminal as a tribute to the 8-line display of the Z88.

So, goodbye mouse and x, I use terminal-based Linux to boot into the command line, and launch Nano the text editor for productivity.

I installed the Raspi OS Lite on a new card, and adjusted the config.txt to accommodate the display format before even booting it the first time.

sc-im on

There's less hand-holding than with the full OS, but it's not difficult because almost everything can be handled using the raspi-config. (sudo raspi-config) I am glad I am somewhat more experienced with Linux and Raspberries than ten years ago.

First it's necessary to set the wifi country, the wifi SSID and passphrase itself. Again, using raspi-config. Only after that the network is accessible. Or use ethernet, unless someone has pried it off(!)

It's also useful to set the timezone.

There are some tricks to whittle away boot time, such as removing boot delay and the splash screen. Some services, such as the network, could be shut down – if the intention is to lose the internet. 

Reducing processor speed could also decrease power need, but perhaps not in total as the tasks will take more time to achieve.

The font and font size are best handled through sudo nano /etc/default/console-setup

Some initial software ideas:

Nano ought to be launched without the space-eating shortcut display. I would also show line numbers, as there's no other simple way to show where I currently am in the document.

nano -x --linenumbers --softwrap testnano.txt

-x disables the list of shortcuts at the bottom of the screen.

The --softwrap in the command line activates soft line wrapping, so the text contents of a line are always seen on screen, which depending on preference might be desirable or not.

Nano reconfigured. (Linux Mint screencapture)

I could try to add some of the Z88-feel by running the PipeDream hybrid spreadsheet/text editor software that was central to the Cambridge computer. After all it was available for multiple platforms, including DOS and Windows.

DosBox could run Pipedream DOS version and Rakewell offers a download for free.

Using emu2 I can run DOS text-based apps via terminal, which sounds interesting. After installing git, I could clone the repository and compile it.

PipeDream on emu2. (Linux Mint screencapture)

PipeDream is far too troublesome to run in the limited terminal screen I prefer, as in the DOS way the screen is assumed to be of a fixed size. Troubles begin when you have to scroll the screen. From the little time I used that software on the Z88, I found it fine for that computer but have no great desire to see it running here. So I'll pass.

For a terminal-friendly spreadsheet, I installed sc-im the terminal-based spreadsheet. This requires some more compiling and fiddling with git repos, but it was do-able. The software isn't very simple, though.

sc-im (Linux Mint screencapture)

From apt I could directly install calc for calculator, or just use bc. These aren't particularly visual, though.

Calc is not to be confused with cal, which simply shows the month calendar. Which is, logically enough, installed through sudo apt install ncal

Again, hexcurse for hex editor, or hexyl for just viewing hex.

I tried Ranger for file listing. It can actually work as a kind of launcher for other apps, but I also found it to be bit slow to init on the Raspberry and maybe not that useful at this point.

Tmux the terminal multiplexer can enable complex task switching, splitting of the terminal screen and generally toying around. Obviously using ALT-F1, F2 ... etc it's possible to switch between logins and it might be enough, but with tmux I could have a text editor running on the left side of the screen and a terminal prompt on the other side.

The OS Lite has Python already installed for programming tasks, and the Raspberry GPIO pins can be controlled from there. Obviously the GPIO pins are not very accessible here.

Browsing could be a possibility, by using lynx or w3m.

For games, I installed Gnuchess. In my preferred 10-line terminal, the program doesn't display the game well. If it wasn't for the pesky "Thinking..." text, the board would fit. Using "show board" after each computer move works, though.

With the smaller font I could play roguelikes and...

But this wasn't supposed to be a web-browsing and gaming platform. I've installed so much junk already, the idea of a very focused computer is beginning to get muddled!

Some notes

What about emulating Z88 itself?

I would have liked to try this, but I couldn't get ozvm to compile easily even on a full desktop Linux Mint, and I have my doubts about getting it to work on a Raspberry OS. I gave up on that angle at least for now. Using the Circle environment, it might be possible to create a comparatively "bare metal" Raspberry Pi emulation of the Z88 computer, as people have done with ZX Spectrum. Someone would need to do that hard work first.

If the aim is to create something that fits inside the original Z88 case, this is not the solution as the screen itself is already too large.

I'm already somewhat through my "Z88 phase", and having a Linux terminal is really just more powerful and flexible. In the future I could look into reducing the boot time, which is still something where the Z88 really excels at. Oh, and also the Z88 battery life is much longer, but at least I can recharge the power bank.

Boot time is more than 20 seconds

If I have ever learned something about building stuff is that a detail not taken seriously during the design process is likely to end up haunting in the build. For this box, things like how to recharge the power bank, or how to change the SD card, were not really thought about that well. Therefore they ended up relatively unresolved. To recharge, I currently remove the keyboard and pull out the bank. For the SD card, fortunately I might not even need to change it.

As far as casing projects go, this was in some ways one of the simpler ones, as the display and keyboard are dropped in and there are no ports to consider. Perhaps I should have made 25mm thickness into a hard constraint in the beginning, but 32mm isn't really that bad.

Like I mentioned, the problems are more in the electronics side of things, and I haven't yet reached a conclusion. I have already seen the power bank last for the 2 hours I hoped for, although it looks that the undervoltage issues increase in proportion as the bank depletes. I may report back once the power bank has seen a few more recharge cycles.