DEV Community

loading...

Devlog 01 - Spectrum Next Programming Languages

ncot_tech profile image James Originally published at ncot.uk on ・2 min read

I’m starting an ongoing series where I learn how to write code for the Spectrum Next.

Watch the video

Video is here

How to program a ZX Spectrum Next

In this episode I look at three options for writing code on a Spectrum Next

  • BASIC
  • C
  • Z80 Assembly

And then I explain my setup.

NextBASIC

Like all Spectrums before it, the Next comes with BASIC as standard. This comes in several dialects from the original 48k BASIC to its own NextBASIC. NextBASIC includes a few new features relevant to the extra hardware in the Next.

The really great thing about the Next is that it’s a self-contained system. Plug it in, get the manual and away you go. Nothing else is needed, just like a computer used to be in the 80s. The manual teaches NextBASIC and has plenty of examples to work through.

C

If BASIC is too … err … basic … then C is the next step up. It does require setting up and won’t run off the Next itself - a PC/mac is required. This comes in the form of Z88dk which needs installing onto a computer of your choice to cross-compile a file the Next can load.

Z80 Assembly

There’s a few options if Assembly is your thing. Some rely on a separate machine to cross-assemble the code, but there is also an assembler called Odin that runs on the Next which looks quite promising. I think it’s in development at the moment.

Cross-assembly can be done with SJAsmPlus or Z88dk

My Setup

What I’ve set up is the following

  • Visual Studio Code with the DeZog extension
  • CSpect for emulating the Next
  • Windows Subsystem for Linux with Debian
  • A custom folder containing a Makefile, VS Code task and other files
  • Z88dk installed inside WSL

With all that set up I can edit code in VS Code, press F6 to build it and then Ctrl-F5 to make it run in the emulator. All without needing to touch a shell, batch file or manually copy files anywhere.

If I want to test on a real machine I have Nextsync and the Next WiFi module to copy the files into my Next directly. Not having to swap SD cards and unplug things is important to me when doing this.

You do realise <!-- raw HTML omitted --> is far simpler, right?

Yes, yes I am quite aware I could just use Windows and its version of Z88dk and everything. I don’t want to though. I like developing in Linux with its sensible shell, tools that work the way the documentation says, and zero reliance on Cygwin.

Grab my code

If you want it, here is a link to my github repo with the build directory inside it. It even includes instructions! Spectrum Next C Starter Project

Discussion (0)

Forem Open with the Forem app