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.

Battery

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.

Keyboard

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.

https://github.com/dmsc/emu2

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.

https://github.com/andmarti1424/sc-im/wiki/Ubuntu-with-XLSX-import-&-export

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.

Thursday, 31 August 2023

Z88 serial before and after OZ upgrade

Detailing my further adventures with the Z88, both before and after getting the Rakewell Flash Card/OZ 4.7.1 upgrade.

Just a little note first. I changed the batteries first time. To my joy, the capacitor held the charge long enough and no memory was erased.

But it did behave weirdly at first. The screen refused to light, and when I got it running the system began to complain about BAT LOW fairly soon. But this was a false alarm, the computer began behaving normally and the battery alarm was removed.

Serial port

As with pretty much everything about Z88, this is already rather well documented in a number of places and I'll just relate my own experience.

Here I'm first discussing the Z88 without the OS upgrades, then with the OS upgrade that improves the serial performance and has Xmodem and Ymodem protocols.

This is how I soldered the cables, and it seemed to work.

Nominally the standard Z88 can handle 9600 and faster, but for receiving data the Z88 cannot handle the speed and presumable the buffer becomes overrun very quickly. I had to add delay of at least 5 milliseconds after each character to get the transfer to work.

Furthermore, without any protocols, binary bytes have to be sent as [ESC]B [High][Low] so [ESC]B1F means sending 0x1F over. This means sending 4 times the data you mean to send! 

The ultimate test was sending the binary of the Jet Set Willy conversion over, called jsw.c. This is 19388 bytes long. Using the binary method, the overall data sent is 77552 bytes! Using the reliable 5 millisecond delay gives 387.76 seconds of "loading" time, nearly 7 minutes.

The speed can be improved slightly by sending ASCII 32-127 as direct characters, and 0-31 and 128-255 in this binary mode. However you'd expect less than 50% of data in a binary file to fall within the 32-127 range. For example the jsw.c file has 12941 bytes to send in binary mode and only 6447 direct characters. So the data-to-send is reduced from 77552 to 58211 which is still quite ridiculous for a 20K file.

JSW has to scroll or squish on the Z88

Later, with my upgraded Z88 I was accidentally using only 1 millisecond delay for transferring files in 9600 baud rate to the Z88, and it worked well enough.

All this became rather academic as the OZ 4.7 has built-in X/Y modem protocols, which are both faster and more reliable.

With Xmodem you have to type in the filename to be received, and the file lengths may be mis-adjusted to multiples of block length. With Ymodem both these problems go away, and also I don't have to bother about the "4 bytes to send 1 byte" dilemma as all is transferred in binary.

Receiving the 19388 bytes of jsw.c took a little under 30 seconds in 9600 baud. I got closer to 15+ seconds using 19200. I did experience some hiccups in getting the Z88 to catch the file in the first place, though.


Getty

I used getty to give login access to the Linux computer through the USB-COM adapter.

Initially this looked fine as the login and password prompts appeared and I was in.

Again, using 9600 on the basic Z88, any commands that produced more text, for example, listing the folder using ls, or using "more" to display a plain text file, would overrun the buffer.

Upgrading a Linux remotely

So, switching to 2400.

sudo /sbin/agetty 2400 ttyUSB0 vt52

...yielded better results. Keys like TAB don't seem to work and, what would you use for Control? Apparently nothing, although these should be alterable from the receiving end.

Trying getty with the Upgraded OZ 4.7 did not behave better, 9600 was still unusable and I had to revert to 2400. This was a little surprising, not sure why this should be.


The upgrade itself

The Rakewell Flash/512K RAM card fits into the Z88 card slot. The Flash portion can be semi-permanently written and the content won't be destroyed even if the batteries run out. There's a bunch of RAM so it's unlikely I need to keep the other cards in.

Importantly, this card also holds the operating system version 4.7, without having to do any changes to the insides of the Z88.

The physical cartridge is a 3D print which is fine, although not as smooth as the original Cambridge cards. When it is mounted I'm not going to see it anyway.

There are now multiple keyboard settings, which makes sense as there's no point in compiling the ROM for different Z88 keyboard. So I can choose Finnish keyboard. The funny thing is the keyboard layout choice also affects language in date displays etc., it's a nice bonus but really ought to be separate.

New functions relate to the flash card, as it's now possible to haul files from the flash card over to the RAM, but also "burn" files to the flash, just as the EPROM cards supposedly worked. Again, deleting the files will not actually remove them but mark them away from the flash card list. So, eventually the space will run out and it may need reformatting. Luckily this can be done from the system itself, but I'll discuss it more if that day arrives.

I can also appreciate that files can be peeked with a hex/ASCII viewer.

BBC BASIC has been given that graphics patch built-in. Use MODE 1 to activate, the screen is split into text portion and a 256 x 64 "graphic window". 

It's not very fast

There's a bundle of applications and files already on the Flash card, including unzip/zip applications, ROM/EPROM digging and utilities for memory monitoring and disassembly. Some of the material is zipped, and it gives a kind of early 1990s feeling, delving into the text and materials an waiting for zips to unfold.

But if a plain Atari ST was slow at unzipping, then obviously a slightly compromised Z80 chip is going to be even slower! Luckily the files are not very large.

Sidenote: Chezz

One thing I wanted to try is the Chess program, converted from ZX Spectrum Cyrus chess. Previously there was no way to run it, because it was not possible to "install" software from RAM. 

It's chess alright

This was a huge process, as on the Linux side I compiled mpm-master, z88card-master, mthtoken-master, and then z88chess-master to get the chezz.app, chezz.ap0  and chezz.ap1 files. Then I transferred them via the serial to the Z88, selected the .app in Filer and used the <>INS command to install the application. After this it will be listed in the Index.

When listed alongside other applications it can be run. The screen is small and I'm forced to use the arrow keys to enter my moves. Fortunately the sound can be turned off! Playing a couple of fast games, I both won and lost to level 2.

Crashing?

After using the card, I experienced PipeDream crashing, even without doing much else with the computer after the hard reset. It happens rather often, and this is a little sad as I encountered nothing like that before, and I mostly used PipeDream before the upgrade.

The Z88 just becomes unresponsive, no keys work and I have to do a soft reset. The cursor keeps flashing, and if the beep is on the key presses cease to beep. The flashing cursor might not be indicative of anything really, it might be even a part of the LCD features.

I have no way to make really sure if the card is faulty or the computer has a problem which only becomes apparent with the card.

I resorted to using Diary app for random typing, which did eventually crash too, but far less often than with PD.

In Summary

I had good fun exploring the new capabilities of the system and the card contents. Much of it is interest only to developers and tinkerers, but the basic premise of Z88 is already greatly improved with the better comms section. I'm also hearing the OZ 5.0 might be arriving, overhauling many a thing in the process.

Sunday, 30 July 2023

Lancess Priya C64

I made a 3D-ish shoot'em up game for the Commodore 64. At the moment, the file can be downloaded from CSDb. Grab a joystick and play.

The following is mostly about the background inspiration for the game.


Star Wars Arcade 1983

The Star Wars arcade game by Atari is maybe the greatest arcade experience I ever had.

I'd like to reminisce how I poured coins endlessly into the machine, but in truth I likely played the real coin-op only a handful of times.

And maybe for the better, as the home version on C64 and Amiga showed the game in itself doesn't have that much longevity. It's perfect for arcade, an audio-visual-physical experience leaving you hungry for more.

I can pinpoint my likely first encounter with the game to July/August in 1984, when a cabinet was present at the Space 2000 (Avaruus 2000) exhibition in Dipoli building, Espoo, Finland.

At that time I didn't quite get the 3D perspective and probably the colorful Zaxxon next to it made a bigger impression on me. I'm even unsure if I personally played Star Wars at that occasion. Later I experienced it both as upright and cockpit versions in amusement parks.

Commodore 64 versions

Domark/Vektor Graphics: Star Wars, Space battle and navigating the surface

There's a brave conversion made for the Commodore 64 by Vektor Graphics and published by Domark in 1988. 

Although this version is nearly complete, it is also quite slow on the C64. Using a smoothly moving sprite for the crosshair does mitigate it somewhat. Some 8-bit computers lacked this advantage, but the BBC Micro version looks quite fast, although it has other problems.

Domark/Vektor Graphics: Star Wars trench run

The space battle is quite fast, but I also notice the enemy ships rarely come very close, and the action is often obfuscated by the ever-growing mass of fireballs.

The tower scene is very impressive, the ship rolls and there are many towers and bunkers approaching. It's also quite slow at times. The tunnel works very well, it has quite a lot going on and yet it isn't that slow.

The earlier Parker Brothers' version of the arcade game made around 1984 is also well known among Commodore 64 users.

Parker Brothers' Star Wars: Tower scene and Trench Run

The Parker game is not very impressive, but it is fast and the tunnel section is quite nice, it has lot of catwalks and a three dimensional projection of sorts. That portion isn't especially fast, though.

The tower scene does not have ship roll and the towers chug along in steps, not well synced to the dot effects on the ground. The on-screen player ship elements don't move at all, further adding to the stiff feel of the game.

The space battle is especially lazy, there is no attempt at all to have the TIE fighters in different depths. It is still nice to play. The Atari 2600 version is in some ways a bigger achievement, considering the limitations of that platform.

Parker Brothers' Star Wars: Space Battle


Lancess Priya

I began asking myself if there was a third path, something that was faster than proper vectors yet would not look so silly as the sprite-based enemies.

The result, Lancess Priya, is more of an "inspired" mini-game and not any kind of attempt at full conversion. All my games tend to be quite short, partly because of necessity and secondly because I usually prefer short games when I go vintage (Blue Max, Rambo, Saboteur, Bruce Lee...)

The game lacks many elements you'd find in the Star Wars game, and adds some that weren't really there. For example, here you have a direct control the ship even in the space battle, and you can dodge the fireballs more easily as they are not "stuck" to the screen position.

Lancess Priya: Space battle and the Trench Scene

I could say I'm using the the Parker Brothers' version as a springboard, building up from the compromises present in that game. Here the lasers aren't full beams, but small bolts, and pre-calculated character graphics instead of full vectors are used to draw the enemy fighters.

The number of objects and lines has been reduced to the minimum where I could still get it work at 1/2 frame rate, also using the full frame rate reticle trick from the Domark game.

It's tricky to get a screenshot that would make the game look very interesting, but it does look a little better in motion, I think!

Lancess Priya: The tower scene


Some technical notes

One day I might make a more thorough technical breakdown of the development process, here I only give a brief explanation to why the game looks like it does.

I toyed with the idea of making a PETSCII character-based game, but after a couple of doodles of TIE fighter frames I felt it would not be the route. The idea of using pre-stored animation frames did stay, though.

The PETSCII experiments gravitated towards using the 2x2 blocks for more motion accuracy, which made me ask whether it would make more sense to use self-defined characters.

So, this new game would use a pseudo-bitmap display built from characters, but not the ones included in the PETSCII set. Splitting one character into 8 cells gives me an 80x100 resolution.

This is quarter the amount of pixels compared to 160x200 resolution, and the benefit with a character mode is that it uses less memory and can be faster. Animation frames can use less memory than sprites for a comparable screen area. Line graphics aren't enormously faster than I guess bitmap drawing would be, probably because I can't write fast routines.

One byte defines a physical screen area that would need 8 bytes in a bitmap mode, this also means I can use 1000 bytes to define the full screen instead of 8000 bytes of bitmap. Or 2K versus 16K in double-buffering.

There are 256 characters ranging from empty to full, based on the above bit pattern.

More technically, there are some occasions where left/right can be adjusted by ROL/ROR instructions, and vertical shifting isn't that expensive either.

I decided the routine should work on 25fps if possible, or it would not be worth it. I worked with 1/3 framerate in Digiloi (2018) , but that was full color 2D character graphics.

So, the end result works on a double buffered character display with 80x100 effective resolution.

Thursday, 20 July 2023

Cambridge Computer Z88

Cambridge Z88

The mid-1980s: After the QL computer and the C5 electric vehicle debacle, the world waited with bated breath. What would Sir Clive Sinclair do next? Would a portable Super-Spectrum emerge? As it turned out, Sinclair and the brand was sold to Amstrad and any interesting developments got the axe. Or did they...

Cambridge Z88 from 1987 was Sir Clive's last hurrah in the computer markets. Well, obviously Clive had little to do with the functionalities of the computer, here credited to Protechnic Ltd., Colton Software Ltd., and Operating Systems Ltd. BBC Basic is courtesy of R.T. Russell (Originally by Sophie Wilson). 

Still, the computer continues Clive's focus towards smaller and portable computers and is supposed to have its roots in the Sinclair Pandora laptop concept.

For a short while, Z88 might have been a success in its own niche, but far from the kind of hit Clive would have needed at that point. What might have been game changing in 1984, was less so in 1988. At least Amstrad came up with their Z80-based NC100 as late as 1992!

Perhaps not the strongest slogan...

I saw pictures of the Z88 in the computer magazines around 1987–1988 and would have been excited to have a go at it.

Cambridge Computer's friendly approach to the Speccy press invited a curious kind of brand loyalty. This might have backfired a little, as the magazines were showing healthy scepticism towards the usual Sinclair hype and promises. Still, the most loyal Z88 fans were likely to be Spectrum aficionados.

By the way, magazines had apparently received a note from Amstrad dictating that this new machine from Clive should not be referred as a "Sinclair", a matter cheekily addressed in Sinclair User #61.

The Finnish press was positive. At least MikroBITTI 11/1988 described it as a "dream micro" and felt a Z80 chip was sufficient for typing on the go. It's interesting that the importer was PCI-Data (Commodore), not Hedengren (Sinclair).

Now, the definitely Sinclair-style appearance and the self-contained nature of Z88 makes it attractive to me. BASIC, spreadsheets and word processing, what else do you need in 2023?

Swedish version.

First impressions

Physically the computer fits into an A4 footprint. It is reminiscent of some of the sketches from Alan Kay's Dynabook concept, except the screen is not nearly as tall. I know a plastic protective cover exists, it would have been nice to have.

Overall, there's a little nod to the QL styling, it's a Rick Dickinson design again and as a physical object it is very attractive. All the flaps, buttons and openings are precise, meticulously placed. Because of the lightness it does give a somewhat flimsy impression, I wouldn't bend the plastic case too much.

The transparent, numbered door over the card slots is an especially juicy little design detail, hidden at a corner where it's barely visible.

The keyboard was at first a cause for alarm, as it harks back to Sinclair's rubbery explorations. Worry not, typing is much better than on the Spectrum, perhaps even better than the QL. The keys are extremely silent and responsive enough, a tad too sensitive though.

The RS-232 port, fortunately not telephone-style

The space key feels a little weird, as it does not depress entirely but just squishes down at the spot you touch. Instead of Control and Alt keys, there are the original Diamond and Square keys.

The power is turned on and off by pressing both the SHIFT keys. And it's not a hard power on/off, the computer goes into standby and you can continue working from the same spot after turning it on.

A few times I was able to accidentally press both SHIFTs when trying to get my fingers around typing those silly :RAM.1/ device identifiers. Remember to set the default device from Control Panel.

The four AA batteries supposedly give 20 hours active use, or about a year in standby. This was one of the most doubted specs in the contemporary press, and Rakewell's site lists more accurate numbers. The real standby battery life is more like few months, depending on the battery type and RAM configuration. 

It's sensible to use the PSU and when the batteries need changing it better be connected. There's a small window of time in which the batteries can be changed without a PSU, but who knows the state of the capacitor after 35 years.

PSU connector, tiny reset switch and the contrast adjuster

The display is a surprisingly okay LCD-type screen, but without a backlight it's rather sensitive to lighting conditions. The resolution is 640*64, which is good enough for editing 8 lines of text.

But thinking about it, the display has less pixels than a ZX Spectrum! (256*192=49152 versus 640*64=40960) The pixels come in three intensities, though.

The CPU is a low-power Z80 variant, which at 3.2768 MHz should be a tiny bit slower than the Speccy.

There are three slots for RAM/ROM/EPROM cards. My Z88 fortunately came with three 128K RAM expansions. This gives a decent 384K extra memory on top of the measly 32K built-in, although one extra 128K might have been enough for me. Apparently the computer is really crippled if there's no extra memory present.

Two ROM/RAM slots and the EPROM/ROM/RAM slot, behind a transparent door.

Obviously the Z80 chip can't handle more than 64K directly, so there's a memory manager that seamlessly banks in memory.

The RAM has to be powered, which is a potential problem. If you remove one of the cards, the Z88 will become unresponsive and needs to be soft reset. Doing this will obviously empty the current memory and any suspended applications.

However, when removing card 3 the files "saved" in card 1 were still preserved. Using the reset key with the card door open will hard reset the computer and all the RAM card contents.

One of the ports takes in an EPROM cartridge, which can be used for storing data more permanently. Technically, only ROM cards can be used to add new applications, but later developments have made it possible to run apps from RAM. From around 2000–2010 there have been Flash memory cartridges for permanent storage instead of the EPROM solution.

A 128K RAM Cartridge

The cards are cute and remind me of Microdrive cassettes, although bigger and with no tape at sight. From the other end you can see an edge connector.

There's a fold-out stand in the bottom of the Z88, something I didn't discover until few hours of use.

OZ, PipeDream, BBC BASIC, apps

There's a plethora of tiny functions and apps built inside the 128K ROM. The computer has BASIC and PipeDream, a hybrid word processing/spreadsheet/database package. There's a calculator, diary, VT-52 terminal and a serial importer/exporter app. The Filer can be used for managing stored files and provides an interesting way of executing text files as key-command scripts.

Using INDEX key you can enter the app menu at any time and choose an app. If there are already instances of apps launched, they will be listed at the right side of the menu as "suspended activities". So I can continue a BASIC project or text editing exactly from where I left it the last time.

Some of the built-in apps

The system is not as graphical as the menus would make it appear at first. Some of the option and control panel screens are messy, but fortunately don't have many items in them anyway. When selecting files within apps, you may be prompted to type in the filename, with no assists provided. 

There's a HELP key, but apart from PipeDream it doesn't provide much information. Removing programs from the suspended activities list is fun: You have to type KILL after pressing the diamond key.

The Z80 chip chugs along slowly, so the menus aren't especially fast and neither is PipeDream the main software package. In QL style, the font is 6x8 rather than 8x8 to make more text fit.

I was tempted to write this blog post using PipeDream, but after sketching some paragraphs I gave up. I found I could type in fast enough, but making any changes to the existing text is a little too cumbersome. Maybe another time.

The peculiarities and compromises of the editor often arise from the needs of the integrated spreadsheet functionality, line splitting and moving between lines doesn't work exactly like in a modern text editor. Still, for a 1987 tiny portable computer it is quite an impressive package.

The software suite and the OS become better the more keyboard shortcuts you learn. Just as I've saved a text file, I can jump over to the RS-232, transmit it, and then press ESC to get back. Most of the important shortcuts for text editing are listed below the screen and this really is helpful. 

The lack of rows on screen is slightly alleviated by the overview map at the right side of the screen with one character represented by one pixel. This is the earliest editor where I've seen this, it's quite common in modern code editors like Sublime Text.

PipeDream's handy map

Moving around using TAB and shift-TAB, you can insert "expressions" into the positions and have the software calculate sums etc. Elsewhere you can just continue typing text without being limited to the cells.

The calculator is the most visual function in the device. It's clumsy and simple, but does have the virtue of being available even if you are in another program, by using [SQUARE]R. The clock and calendar can be invoked in a similar manner. Together with the suspended task switching, it gives a tiny sliver of sophistication without multi-tasking.

Instead of Sinclair BASIC, there's the BBC Basic, which seems a little funny considering how Sinclair and Acorn used to be in competition. The BBC dialect is pretty famous for its structuring and it even has an inline assembler. 

The manual also provides an interesting hack to use the Filer "CLI execute" function to tokenize ASCII files by first opening the BASIC and then virtually typing rest of the plain text file contents in as keypresses. Put AUTO as part of the macro and it doesn't even need line numbers. Ingenious or kludgy? At least this means PipeDream can be used for writing program listings, as BBC Basic can use named procedures.

The "CLI execute" can also be invoked through Basic, so a command can launch another app and type in commands there. The freedom given to the user is really mind-boggling, and even if you don't want BASIC or assembler, PipeDream is quite versatile in itself.

A BOOT.CLI can be used but on the non-upgraded Z88, this sadly only works from an EPROM. This could, for example, make the computer boot into BASIC after reset. However, seeing as the computer is either on or in standby, the most sensible use for the boot file is to manage preferences after reset.

I experienced a considerable slowdown at one time, especially after playing with these CLI execute functions. Typing with PipeDream was no longer comfortable, even if I had cleared all internal RAM of files and KILLed all unnecessary apps. I reset the computer and all was fine again. Perhaps there was some garbage management problem.

The BASIC has no graphics commands, I guess because it would be wasteful to hold a pixel buffer. I see the author of BBC Basic has created a patch that adds the graphics commands, though.

There are more recent versions of the operating system, done by enthusiasts after Cambridge Computer shut down. Some of the tiny problems I encountered might be fixed by upgrading the Z88.

Colton Software still makes PipeDream, not for the Z88 mind you!


A few thoughts at this point

Much like with the Sinclair QL, the Z88 felt a little iffy at first but I became more and more intrigued with the platform. The computer invites learning to use it better, finding shortcuts and tricks as you go along.

The Sinclair QL already provided a word processing and spreadsheet suite, but the execution was marred by hardware decisions. In a way Z88 continues this fixation but doesn't have similar problems.

This focus on business productivity means that many cool things are left out, such as graphics or sound. There's no mouse, but a computer like this does not really need one.

There's an estimate of some 60000+ units made.

One can't really blame Cambridge Computer for not succeeding, as far as I know no-one really scored it big with these small form factor computers in the 1980s. Typing on the go was a niche thing and buyers more likely put their money into more powerful computers, rather than tinier computers. Although 6 million TRS-80 Model 100 units sold, if true, is impressive. 

I could compare my tiny 8-bit computers Canon X-07, Atari Portfolio and the Z88. It's possible that because of the huge keyboard and the comprehensive feature list, the Z88 beats the others in terms of usefulness and features for the 2020s. Obviously Atari is the smallest of the trio, but without any programming language built-in, the fun factor is lower. I guess without extra memory Z88 would be limping too, so the comparison is not so straightforward.

Traveling silently

I might eventually look inside, if only to peep at the capacitors and any signs of dust or grime. I postponed this as it looks like a couple of screws are under the rubber feet and one is under the serial number label. The LCD and its ribbon are also notoriously fickle.


Serial transfer

I quickly built an RS-232 adapter cable for my USB-COM device, and it worked well enough. One brainfart had to happen though, using the wrong gender at the Z88 end of the cable. Well, gender-changer to the rescue. 

I can already say that sending data from Z88 at 9600 rate is ok, but it is hopeless at receiving at this speed.

Beam me up

Minicom was sufficient to test the connection.

If the device is called ttyUSB0 on Linux, then:

minicom -D /dev/ttyUSB0

I then set minicom to 9600, 8N1 (Parity none).

At the Z88 end, I launch the Control Panel (Square+S), set Parity None and Xon/Xoff to No.

Then I can use the VT-52 terminal in Z88 to send and receive characters and the Import/Export app to transmit and receive files.

With some more work I was able to store some of my first PipeDream jottings for historical purposes. I already feel more safe about resetting the Z88.


Some links:

Crash! magazine and Simon Goodwin on Z88: https://www.crashonline.org.uk/39/z88.htm

Rakewell has kept the name alive over the years: http://www.rakewell.com/z88/z88.shtml

More resources: https://cambridgez88.jira.com/wiki/spaces/welcome/overview?mode=global

Pictures of the insides at Old Crap: https://oldcrap.org/2019/10/28/cambridge-z88/

Saturday, 15 July 2023

Shortening the kickbike

One of the reasons for buying this particular model was it looked like it could be modified easily.

Previously, I have already removed the wooden deck addition and shortened the handlebars. Now I had something bolder in mind.

I have been thinking of two ideas. One was to remove the "wings" at the side of the deck, possibly reducing some weight.

The other idea was to make the deck shorter, both to reduce a little weight and improve the maneuverability (hopefully). This seemed more interesting, and I was a little worried removing the wings might compromise the strength of the box and make it a little too narrow.

I had suspected the outer case could hold inside a relatively large "inner case", but it turned out the part that goes in is much smaller than I thought.

Sketch, not to scale

There are 4 bolts on top, 4 at the bottom, and then 2 at the sides.

Obviously one of the side bolts had to be gloriously stuck, so I had to waste time in removing it. After ruining the hex, I realized I could file the bolt into a more rectangular shape and use a spanner to turn it.

After some nudging, the block connecting the stem to the chassis falls out. The portion that goes inside is only 27 millimeters deep, and the shape is irregular. It is quite hefty.

The connecting part

I could have taken better photographs, but maybe the opportunity will yet arise.

Then began the process of measuring and deciding how much to cut away. Peeking inside, I could see there's virtually nothing at the front 14cm part of the compartment.

I eventually chose 6cm as a suitable amount. There is a hatch at the bottom of the chassis, and if I cut for example 10cm, the hatch edge would be rather close to the front. The other thing to worry is the 28mm radius cable hole in the side.

The 6cm should be significant, but this also leaves some empty space inside the box.

Not all the space is used up.

I was a little lazy and traced the lines around the box using a vernier caliper adjusted to 6cm.

After that, I started sawing with the hacksaw. This is a boring job and I split it into two sessions for two different days. Together it took more than an hour with some pauses.

I'm not very skilled with the hacksaw, but I managed to do it accurate enough. Patience is key, otherwise it's easy to start doing things too hastily, resulting in a mess.

Removing 6cm from the front...

The case is some sort of aluminum alloy, which is quite soft to cut and drill. 

Only afterwards it occurred to me the process could be generating some fine grain aluminum dust, apart from the stuff I could obviously see.

One thing to look when cutting a profile like this is to have an eye at where the other part of the saw is moving. While focusing on the actual cut, the saw might be stealthily ruining another part of the cut.

The part, cut loose

Compared to sawing, the drilling was quite easy and fast. I took the measures from the original piece, and just transferred these over to the desired positions. 

I used 2mm drill for making pilot holes, then an 8mm for the actual sizes. I used ridiculously low speeds here, probably only a few revolutions per second.

Drilling new holes

The original holes were not perfectly round, especially the side holes are more like very short routing lines. I just hope there isn't a really precise logic behind that, possibly just a result of using an automatic router.


The results

I believe shortening the deck improved the drive-ability of the kickbike. It shouldn't be a huge difference, but I think turning tighter corners is a little less precarious.

The distance between the wheels is now shorter than the Voi, which is something of an accident as I had previously measured the distances incorrectly. It might have been nice if the wheels have the same distance. Well, the subjective experience should be more important than the measures.

But did I get rid of any weight?

Carrying the bulk might be slightly handier because of the smaller dimensions, but it's such a small difference it cannot be really felt as weight difference.

I'm going quantitative

The cut part really was one of the lightest things I could remove, so the effect on that front wasn't that great. The cut aluminum part weighed only ~245 grams. Taken together with the plastics it's a little closer to 370 grams.


To put things into perspective, what things weigh:

The 6cm aluminum alloy part: 244g
The 6cm aluminum alloy part and the plastic parts together: 372g
The plastic parts: 134g
Wallet: 160g
Smartphone: 300g (!)
All the keys in my pockets: 145g
Bike helmet: 323g

The kitchen scale measures fluctuate a few grams so the values are not very accurate.

At least the removed material compensates for wearing the helmet!

It's obvious I could lose more by leaving my phone, wallet and keys home.

Measuring the cut out block against the 244g weight pointed to a material density of 2500kg/m3.

Apparently aluminum alloy density isn't likely to be lower than 2660kg/m3, I might be persuaded to believe my measurements are off. The piece has holes, the scale isn't accurate, and so on.

As a ballpark estimate, the central chassis metal part does not weigh more than 3kg. (The battery and other stuff inside are probably heavier.)

I've yet to measure the weight of the entire kickbike (Probably around 28kg originally) so I'm not sure what kind of percentages the removals represent. Also, taken together with the driver's body weight it means very little in the entire system. 

The next step is to cover the openings. I could even cut some more material and try to fit the indicator lights back the way they were.