Saturday, 30 December 2023

ZX Spectrum Next

Sinclair ZX Spectrum Next

The first ZX Spectrum Next Kickstarter was launched in 2017. Back then I felt the ZX Evolution was enough for me. When I learned of the second Kickstarter, promising improvements over the first one, I had to jump in.

The board is a continuation of the TBBlue, where an FPGA drives the entire thing. So it's not a software emulator but there's no factory-made bona fide Z80 chip inside. In fact they call it the Z80N because it has a few extra instructions. If the magical aura of a genuine 8-bit CPU is absolutely necessary, then steer elsewhere...  

But let's not forget the original Spectrum ULA video chip was a kind of proto-FPGA chip too. It's just nowadays more realistic to have everything in the "ULA".

256 colour graphics with support for scrolling and sprites, multi-channel sound, SD card storage media, 2MB memory. For programming this means a memory paging system, because the Z80 cannot address more then 64 kilobytes of memory directly.

The computer can also work as ZX80, ZX81, 48K, 128K, through either emulating or switching the ROM and capabilities.

Instead of listing everything the computer does (and it does a lot) I'll just relate my initial observations and things I have found interesting after week and a half.

First Impressions

The Next comes packaged with the appropriate PSU and a printed booklet in the tradition of the original Sinclair manuals. It's crammed with information and tables. In addition there's also a quick start sheet.

The great thing here is that I don't need to buy anything extra to get it up and running. Ok, a video cable is necessary but who doesn't have a HDMI or a VGA lying around?

The case is physically very impressive, a proper industrially molded case and keyboard. In size and appearance it is quite close to the Spectrum Plus, although not nearly as tall. Rick Dickinson, the original designer of many Sinclair products, was still involved with the design before his passing.

In the correct order

I'm not a big fan of rounded corners in tech, but I have to admit the rounding and the rainbow plastics gives the box a lot of character. It's also a tribute to the original rubber-keyed Spectrum.

The keyboard appearance and feel exceeded my expectations. It mostly follows the Spectrum Plus layout, the main difference being the cursor keys have been positioned more reasonably. 

The layout difference makes it hard to compare the Next with modern keyboards. It feels right but I tend to mistype because my fingers are one key off, typing LIAR instead of LIST and so on.

Occasionally I lapse into Speccy-thinking, using shift+P to create " and even searching the cursor keys from both sides of the space bar! My brain hasn't really decided yet what to do with the keyboard.

The lack of explicit CTRL and ALT keys also affects the way software deals with keyboard shortcuts.

Instead we have True Video and Inverse Video

Connectors

There's a bunch of modern and less modern connectors at the backside. In the great Sinclair tradition, there is no power switch on the computer itself and you can just "pull the plug". 

Fortunately, the package includes a separate power switch cable extension. Together with the modular adapter there's quite many parts to fiddle with, which makes me worry a little.

If you have the additional Raspberry board (I don't) the USB and digital video debug ports are available. You cannot use them as conventional USBs for keyboards and controllers.

I tried to load Horace Goes Skiing from tape using my Sanyo Data Recorder, but got no reaction. Possibly the cable was bad, I wasn't that motivated to find out the problem.

Edit: I was too lazy to check the connector, it's a split EAR/MIC, so it makes sense that a mono cable doesn't work.

I've yet to test the RGB connector, not sure if I should try to make the cable myself or just order one.  Big plus for the Next people for including the RGB.

You can attach a PS/2 mouse or a keyboard to the PS/2 connector. It's worth noting any external keyboard will still follow the Spectrum layout rather than its own.

The mouse needs to be supported by the software. The Next menus, file browsers and editors do not directly make use of it.

Power connector excluded

The left side of the computer hosts the Reset, Drive and NMI buttons, with the SD card "drive".

The NMI button accesses the "freezer" menu, there I can change the CPU speed (3.5/7/14/28MHz), enter POKEs, save Spectrum snapshots and screenshots. These save features won't work as well with the Next software, if at all.

For the sake Sinclair QL nostalgia, the SD card slot really ought to be at the front, near the right side of the computer, but it's fine as it is and certainly not in the way.

Without a spring ejector, it's a little tricky to remove cards from the slot. But with some preparation and use of the wi-fi, I don't need to swap the card that much.

It's recommended to backup the card on a PC before doing anything further.

Standardizing two joystick ports is a good thing. If you intend to use the Next mostly as a game console, the front positioning might be good. Again, hot-swapping joysticks is not recommended. 

For other activities the joysticks might be in the way. Although the ports are supposed to double as serial ports, I don't feel too good about connecting peripherals from the front side. 

I tried a Megadrive pad and it accepts a second fire button too. Nice. Turn off any autofires or other exotic features before plugging in...

Extra buttons

Modern video cables such as HDMI are not physically very flexible, something I noted with the similarly tiny Raspberry Pi 400. The Next at least has some size and weight to it, so it's not like a flap of plastic dangling at the end of its cables.

A cable mess was a fact of life with the integrated keyboard computers, and it can't be helped much. It is fortunate you can get away with only two cables, the PSU and display.


Booting up

At first I was a smidge doubtful about the Next booting from a SD card, but it looks to be fast enough. Resetting isn't exactly as instant as it used to be in the 8-bit era, but the few seconds are not too bothersome.

But as reset is often the default "exit" from a program, these seconds can begin to matter...

The main choices

(The screenshots are from the Zesarux emulator and can look different to the software in the Kickstarter 2 Next.)

There's a wealth of options in already in this menu, and the SD card has a plethora of apps, demos and games to keep one exploring for days. 

For the occasional games player, the main environment is likely to be the Browser. Here you can navigate the SD card folder structure and select any of the files there. These can be ZX Spectrum TAP tape files, or SNA/Z80 snapshot files.

Basic programs also launch happily from the browser, and autorun if they have been saved with SAVE "filename" LINE 10 or something similar.

The Browser

Apart from the Browser there are many ways to operate and do things with the Next.

A number of Basic environments are available, 48K, 128K and Next Basic.

The Command Line supports alternate browsing through commands such as CD, LS and also the running of "dot" commands.

The Command Line also doubles as a Basic environment, and the dot commands can be used from within NextBASIC listings.

One interesting dot command is the .HTTP, which allows fetching of files over the internet. There's also a software for searching and downloading Spectrum snapshots from a database. After installing Getit and NextSync, there's little need for juggling SD cards.

I never really liked the Sinclair 128 Basic editor, it's a weird compromise between a line and full screen editor. At first the Command Line looked like a better starting point for Basic, but I grudgingly accepted the 128-style editor.

Command Line

TXT2BAS and BAS2TXT are also worth checking out, as they can translate between tokenized basic and ASCII text files.

The neat thing is that using #autoline 10 in the text file, the TXT2BAS can fill in the line numbers. The NextBASIC has REPEAT...UNTIL and procedures, so you don't need to explicitly refer to line numbers with GO TO and GO SUB.

It's possible to use a text editor on Next (or PC) to write Basic and then turn it into a runnable program using TXT2BAS.

As the computer is capable of a high resolution text display, a full screen text editor or notepad would have been nice. At least you can view text files through the browser in a higher resolution.

A command-line assembler would have been nice too, there's something called Odin in development but I'm unsure if it's exactly what I would have hoped.

(Edit: The Sol assembler looks quite nice)

Of older scene demos, Aeon was supplied on the card and it looked fine. There are also technical demos of Next capabilities, like the Rusty Pixels' Scrollnutter, a throwback to the Amiga era of multiple-speed big-font scrollers. There's not that much Next activity on the demoscene, though.

Lords of Midnight

There's plenty of games or at least game demos already on the card. Next War is a surprisingly addictive tower defense type game and Night Knight is a fun-looking conversion of an MSX effort. Warhawk is quite impressive scrolling shooter with lots and lots of sprites. There's also a 256-color version of Mike Singleton's classic Lords of Midnight.


HDMI Update

It's worth applying the FPGA core update as soon as possible. I found some timing problems, flickering and music tempo fluctuation in a program where it wouldn't really happen on a 48/128 machine.

I guess it could also affect game experience even in cases where nothing is visibly or audibly wrong.

By now you should have your SD card contents backed up.

Make sure Next is turned off, take the SD card out of and use your PC to access it.

Download the file TBBLUE.TBU from Phoebus Dokos' Gitlab site.

Direct download link:

https://www.gitlab.com/thesmog358/tbblue/-/raw/master/TBBLUE.TBU

Copy this one over the one on the SD card root.

Insert the SDcard back into the Next, and press U while powering up the computer.

Go through the flashing process (it takes a while), then switch off and on again as instructed. The new version number should be indicated in the boot screen.


50/60 display refresh rates

Talking of display, the 50Hz legacy of 8-bit computers can be a potential source of woes.

The ZX Spectrum was 50Hz, and so was Commodore 64 and everything else in Europe. But many computer displays today can't work with 50Hz, you'll likely have better luck with a TV than a dedicated computer display.

My HP Elite display seems to be happy with the 50/60 changes and any experiments with scrolling resulted in no glitches.

Just be aware that from an European point of view 50hz was really the more "authentic" display refresh rate, and all games and demos might not function correctly in the 60hz refresh rate.

For completeness, Next can adopt different timings and the Russian Pentagon timings are also included.

By the way, PAUSE 1 is a simple way of invoking "Wait Vertical Blank" in Sinclair Basic. I believe it just invokes the HALT Z80 command which stops the CPU until the ULA is ready to redraw a new display frame.

It works in NextBASIC too, so, adding these lines to the basicTiles/smoothTileScroll.bas source...

5 RUN AT 3

165 PAUSE 1

205 PAUSE 1

...makes that demo genuinely smooth scrolling.

smoothTileScroll.bas

The PAUSE/HALT method is not very sophisticated. The Spectrum Next has a proper line interrupt, I should check how to make better use of that, or if it can be easily used from Basic at all.

New graphics

Somewhat controversially, the Next heavily expands the graphics capabilities of the Spectrum. This reminds me a little of the TS-Conf setup which brought Amiga-esque capabilities to the ZX Evolution board.

The Next's additions are more closely integrated with the Spectrum-like ROM, NextBASIC and other features.

The hardware supports a 256 color mode, tile maps and a large number of sprites. There are so many modes I can't really examine all of them here. For example, there's a 128x96 16/256 color mode, Timex hires and Timex 8x1 color modes are also possible.

All in the best possible taste

Note that 256x192 with 256 colors takes 8 times more memory than the original 1-bit 256x192 Spectrum display file (excluding the attributes), resulting in 48K image files. That 2MB doesn't sound so huge after all.

Conveniently, 28MHz is also 8 times faster than the original Spectrum processor speed, and the graphics are also banked. What I'm saying a filled vector flight simulator or a Doom-style routine is unlikely to turn out super-fast on the 256 color bitmap. Although there's a Wolfenstein raycaster demo that seems to prove me wrong. Well.

What really helps here are the scrolling tiled modes and sprites, making the hardware closer to 1990s consoles such as Super Nintendo or Sega Megadrive.

The new modes work cleverly as layers on top of (or under) the classic graphic mode. So you could in principle have 1-bit bitmap elements on the Spectrum attribute layer, and then sprites on top of that.

256 colors through NextBASIC. One line is transparency, letting the background through.

Here's a little NextBASIC program to show 256 colors:

10 RUN AT 3
20 LAYER 2,1
30 BORDER 0 : CLS
40 FOR N=0 TO 255
50 INK N
60 PLOT N,0
70 DRAW 0,191
80 NEXT N
90 INK 0 : PAUSE 0


Line 10 activates the 28MHz processor speed.

Line 20 switches on the layer 2 (256x192 x 256 colors) and selects it.

The further INK, PLOT and DRAW commands play out on the selected layer.

Note that the LAYER 2 considers the top left corner as the 0,0 point, and the bottom right corner is 255,191. The old Spectrum graphics has bottom left corner as 0,0. This was more correct for plotting mathematics, but extremely confusing nonetheless.

You can have either 8-bit or a 9-bit color palette.

The 8-bit palette has only 2 bits for Blue, but simulates the third bit by performing an OR 1 with the most significant of the two bits.

So,

RRRGGGBB b
00000000 0

BB b
00 0 =   0
01 0 =  73
10 1 = 182
11 1 = 255

The outcome values are how to represent the blue value on PC, these seem to agree with Zesarux emulator and other sources I could find. Red and Green ramps would have values 0,36,73,109,146,182,219,255.

To be honest, the 9-bit RGB seems to be used all over. 256 colors can be freely chosen from a total of 512, much like in the original Atari ST.

As 320x256 is also possible, it shouldn't be difficult to display ST images on the Next. It takes a whopping 80K of bank memory, though.

The 256 color default palette is already well thought-out, and it can be a good idea to explore its possibilities before even trying to change it.

Next Ninja, courtesy of Bing create, conversion and some adjustments by hand.

Manual etc.

The book has a lot of information in it, replicating in parts the nostalgic experience of wading through the original ZX Spectrum manuals.

It is, however, not a book that explains in a simple way how to start using the Next features in your Basic or Assembler programs. There's no alphabetically ordered explanation of what each Basic command does. It might no make sense anyway, as some of the keywords are used in very different roles. For example, the old keyword ERASE on its own simply wipes out the current program, used to terminate an autoexec.bas.

The book is not very visual at explaining the computer capabilities, and some of the few diagrams are printed in small size. I kept scratching my head about the layer, sprite, palette and color specifications, trying to find out concise information from the internet.

Still, having the book is far, far better than no book at all, and especially at times when I can't be bothered to open a browser on another computer while working on the Next, it's a valuable reference.

It's worth looking at the Basic listings included in the SDCard, if only to see how sprites are loaded and displayed on screen, how the mouse driver is invoked etc.

Utilizing the extra power requires some study of the memory banking and examining what the various commands and registers do. Remember that even at 28MHz, the Spectrum Basic isn't really all that fast.

End notes

It's a ZX Spectrum to end all ZX Spectrums, all right, but how do I feel about the "extra" dimension? Perhaps the computer could be seen as a Spectrum with a somewhat more modern retro games console tacked on as a compromise?

Or perhaps not, as the new features are also part of the NextBASIC and the generally Spectrum-like environment.

Almost needless to say the Spectrum Next is far above simple products such as TheC64 maxi/mini and especially the ZX Spectrum Vega. Those mostly worked as game platforms and rather poorly as computers. The MEGA65 is probably a comparable project.

It's early days for me, so I don't have a final verdict. But I feel the Next, with all its additions, is still somehow respectful to the original ZX Spectrum experience. The extra features could make it interesting for those looking for "new" 8-bit computers.

The primary use after all?

What makes this kind of computer fresh and attractive is the anarchy made possible by not having to care about security, localization, multi-user log in, accessibility and whatever else is taken granted in mainstream computing. Just some core functionality and a bunch of software written in very different, individualistic ways.

It looks like the Spectrum Next has generated enthusiasm. Hopefully there will be enough momentum to keep new software appearing for years to come. The hardware and the system is of course interesting in its own right. 

I left out the productivity software side. Although any serious developers are likely to use cross-development tools, there are still the obligatory character, sprite, tile and map editors, suggesting you could use Next directly for creative purposes. Maybe they are enough for small Basic programs, but better tools could inspire more software and content.

I had some minor success in compiling assembler, turning on layer 2 and displaying some extra colors. It looks like understanding the .nex package format would be very useful. I'll come back to this if I learn the ropes.

Sunday, 10 December 2023

Proton/Linux: Just Cause 4

Army of Chaos, sure

Proton did well enough and I could finish the game after about 27 hours. I did change the proton version to 7.0-6 (instead of 8.0-6 or experimental) after first experiencing more crashes than I expected.

The game would still occasionally crash (once in couple of hours) but because of the game's structure it doesn't mean that much. This is what happened with Just Cause 3 too, and a possible feature of the native version.

The graphics are overall rather fine, the world has a good amount of detail and variety of zones. Some have waterways between vertical jungles, then there's the obligatory desert and snowy mountains.

That's a tornado near the horizon...

The cutscenes had some problems, related to Proton or not. Things like beard stubble and eyelids or eyelid shadows where somewhat weirdly rendered, but I did not bother to find out if I could do something for these.

I've usually enjoyed the Just Cause games, offering somewhat GTA-esque thrills without the investment and without being very story-heavy. I've come accustomed to the grapple-parachute-wingsuit acrobatics well enough.

But it's not a massive improvement over Just Cause 3, if it is an improvement at all.

Perhaps I liked Just Cause 3 more, because of the simple town liberation system. This has been replaced with "chaos army" that advances from one region to another, player making the choice of directing the troops.

Checking the world map and the enemy lines

Technically it's more of a way to structure the main story missions into a chronology, as most areas can't be captured without doing some pre-requisite tasks or conquering of other areas.

This shift in focus also means there's not that much to do in the towns and cities. Some optional tasks and fights take place there. The speed and stunt mini-missions are also often in the cities, but these I chose to avoid.

And as usual there's a lot of random encounters, side-quests, equipment, vehicles, weapons you can find, summon or steal from the environment.

Visiting the front lines

At the front line between two areas, you can actually witness the lines holding and a battle going on. This looks impressive at first, but it's just a paper-thin illusion really.

Try to intervene in the frontline battles and your troops can't perform any better. More likely the enemy will just summon more jets and tanks and you'll be dead eventually. Funnily enough these new enemy units can just as well spawn from behind the friendly line...

Another novelty are the weaponized mega-weather effects, sandstorms, lightning and the iconic tornado. The tornado is a game element that can arrive and mess with your unrelated task, and at times this can be quite fun.

Ok, you'd expect more to happen at this distance

I would have hoped some of the randomness of the enemy attacks could have been modified a little. There's just more and more of the enemies, approaching from unlikely places. 

As usual, the battles have all the subtlety of two pre-school kids bashing toys together. Mostly it is all for good fun, but it would be nice if at least the player sighting was more realistic. Now a line of sight is enough and the chaos starts ensuing. How do they know it's Rico from a distance of 200 meters?

As the fight escalates, helicopters, tanks and jets arrive at the scene from around the corner or behind the hill, with little consideration as to where they might have come from.

There's also some glitchiness and weird behavior resulting from the open world and physics engine. I thought such things could be improved by now. Helicopters and jets might spontaneously crash and the enemy units continue to have silly attack patterns, often resulting in their death.

1998 called and wanted its textures back

At one time, a rebel-occupied train whizzed past the enemy train, shot it with its mega-cannon, derailing both trains hilariously.

By the way, the trains and the train tracks are modeled so sparsely they'd not look out of place in Half Life 1. These are conveniently further off in the island so it's not the first thing you see.

Friday, 1 December 2023

Proton/Linux: Lake

Providence Oaks, main street

One more "walking simulator" type game, comparable to The Long Dark, Firewatch, Virginia... oops, it seems I've tried more than a few of these over the years.

Of the above, Lake from 2021 might be most comparable to Firewatch. There's just a story that kind of unravels through reaching different map positions, which also serve as trigger points for cut scenes and discussions. With more characters and more locations, there's slightly more to "play" and explore here. But only slightly.

The story is told from the perspective of Meredith Weiss, who after 22 years returns to her home town of Providence Oaks, to take over her dad's mail route for a couple of weeks. It's 1986.

Is Addit'87 going to be a big hit?

A MIT graduate with career in computers, she is part of a soft-co about to launch a new DOS-based home organizer/diary software called Addit. Meredith hasn't quit this job, on occasions choices need to be made regarding Addit. These are handled via telephone calls and mail from "Steve".

Despite a potential story-telling device, the software isn't really seen often at all.

Although the laptop/luggable concept appears credible for 1986 (think IBM model 5140 or Toshiba T1100), the high-contrast color screen is far too good. A glowing orange display or a non-backlit LCD with a few greyscales would have been more likely. Artistic licence, and all.

Let's not forget the focus of the blog...

The mail route is repeated each day. For this Meredith drives a van, but for delivering the mail to the boxes she has to leave the car. Parcels are hoisted out from the trunk and taken to the door. Pressing the doorbell may result in further interactions, but most often not.

But make no mistake, it's not Eurotruck or any kind of car simulator. The game stays firmly in the walking genre. If anything, the car just helps make the larger environment of the Lake a little more functional. Looking at it cynically, it's just there to add to the game time.

The mail delivery premise allows for Meredith to meet various people around the town and the lake surroundings, leading to discussion-tree type interactions. It's unclear from the first play how much these affect further events, but perhaps the social routes might not be radically different. 

Am I being dragged into a romance part

Firewatch had some ingenuity in overlapping the walking with the (radio) dialogue choices, but here the driving and the social interactions are two quite separate elements of the game. 

The year 1986 is wisely approached from the perspective of different communications technologies. No internet, no mobile phones. People rely on letters and passing on information. Obviously land line telephones are much in use. In the evening, there is often a phone call or at least a phone message. Meredith has to choose whether to watch TV or read books... 

The decade is fortunately not exaggerated, no synthwave with neon grid Lamborghinis here. There's an understanding that much of mid-eighties was still based on decade-old cars, surroundings and mixtures of older fashions.

The game still has a fair share of film/game/tech references, making things relatable to today's video game player. On one hand it can be interesting for younger players to see that hobbies of today were already around in the 1980s, but on the other hand less-obvious topics could have been more interesting to explore.

I'm not sure if the point of reference for 40-somethings living in the era would be "the 80s". This is addressed in few occasions, though, and you can sometimes choose to make Meredith appear either hip or ignorant of the times.

Delivering a package. Watch out for those birds. Just kidding.

The radio plays pastiches of generic 1980s feelgood country-style pop, props for achieving this in such a small game, but the few songs do get a little repetitive rather soon.

Delivering the mail in itself doesn't have much variety after a few days. You'll get to see more locations, and you can get involved in more unconventional deliveries too, but these do not play differently. The evolving interactions is what keeps the player wanting to turn the pages further in the story.

I am not sure if it is a Proton problem or something with the original game, but I kept experiencing drops in audio channels. Dialogue would cease and from small fragments it was still clear the speech should be there. The tone of voice is often quite important for picking choices, so it can be a little annoying. ProtonDB only had a mention of potential audio delays, which I didn't encounter.

Aside from audio, the 3D world has some glitches too, and I doubt Proton has anything to do with this. With the focus on mail delivery, I'd have expected the letters would at least fit the mail box models!

"Oregon Trail", heh.

Almost anything outside the immediate roads and buildings is not modeled very richly, which is of course a pity but understandable. There's not much sense in exploring areas on foot. Sure, it's no GTA but the developers have managed to create a reasonable illusion of a small town.

I did find the cars could sometimes get stuck, even without any apparent player intervention. After one car chooses to stop, this creates a growing queue of cars which doesn't move until the traffic is reset for the next day. Usually they are able to recover and overtake cleverly enough.

Lake could be considered a feel-good game and the six hours were just about the appropriate length for the experience. As with Firewatch, I sometimes surprise myself with the meekness of my dialogue choices. It's just a game, what the hell?