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.

No comments:

Post a Comment