Building a development environment in Ubuntu / Mint

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
PeterJ
Site Admin
Posts: 6942
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Building a development environment in Ubuntu / Mint

Post by PeterJ »

Whilst I my desktop runs W11, I use the free VMWare Workstation Player to visualise various Linux distributions, Windows XP & W7. I like Ubuntu Linux for development as most of the build tools are already included.

The aim of this guide is to install the following software:

Fuse
CSpect
z88dk
zmakebas
hdfmonkey
zxbasic

The majority of these notes are adapted from the installation notes on the applications websites, but I found some of the instructions lacking.

I'm assuming that you are familiar with the linux command line, and are happy with applications being in your home folder. My preference is to install from packages (or source) rather than using Snap or Flatpak.

This guide has been tested on Ubuntu 20.04 & 22.04 (Daily Build), and Mint 20.3

Lets get started by updating the system:

Code: Select all

sudo apt-get update && sudo apt-get upgrade
Reboot, and then lets install Fuse:

Code: Select all

sudo apt-get install fuse-emulator-gtk spectrum-roms
Next, lets install the prerequisites for z88dk

Code: Select all

sudo apt-get install build-essential dos2unix libboost-all-dev texinfo texi2html libxml2-dev subversion bison flex zlib1g-dev m4 libtemplate-perl libtemplate-plugin-yaml-perl libfile-slurp-perl ragel re2c curl
Download the nightly build of z88dk and extract it:

Code: Select all

wget http://nightly.z88dk.org/z88dk-latest.tgz
tar -xzf z88dk-latest.tgz
Now, lets install it:

Code: Select all

cd z88dk
export BUILD_SDCC=1
chmod 777 build.sh
export BUILD_SDCC_HTTP=1
./build.sh
This can take a long time to complete. You will see loads of warnings flash up, but as long as the build completes with out errors that you are all fine.

Next we need to add z88dk to our path:

edit the bash.rc file with:

Code: Select all

nano ~/.bashrc
Add the following to the end of the file, save and reboot:

Code: Select all

export PATH=${PATH}:${HOME}/z88dk/bin
export ZCCCFG=${HOME}/z88dk/lib/config
You should now be able to run:

Code: Select all

ubuntu@ubuntu:~$ zcc
zcc - Frontend for the z88dk Cross-C Compiler - v19454-66e312607-20220324

Usage: zcc +[target] {options} {files}

Code: Select all

ubuntu@ubuntu:~$ z88dk-zsdcc -v

ZSDCC IS A MODIFICATION OF SDCC FOR Z88DK
Build: 4.2.0 #13081 (Linux) Mar 24 2022

Code: Select all

ubuntu@ubuntu:~$ z80asm
Z80 Macro Assembler 19454-66e312607-20220324
(c) InterLogic 1993-2009, Paulo Custodio 2011-2022

Code: Select all

ubuntu@ubuntu:~$ z88dk-appmake
appmake [+target] [options]

The z88dk application generator
Note - Under Linux some application names start with 'z88dk-' to avoid confusion with apps of the same name in linux

Using the excellent C Development Tutorial from @dfzx. Fire up your favourite editor and save this as border.c

Code: Select all

/* C source start */
  
#include <arch/zx.h>
  
int main()
{
  zx_border(INK_BLACK);
  return 0;
}
  
/* C source end */
Then enter:

Code: Select all

zcc +zx -vn -clib=sdcc_iy -startup=31 border.c -o border -create-app
Finally, run:

Code: Select all

fuse border.tap
to see your masterpiece.

Next zxmakebas from @dbolli

Download the archive from https://www.dropbox.com/s/n7k40ezuj0j3m ... 2.zip?dl=1

Once you have extracted the zip file you will have a folder called 'zmakebas 1.5.2'. Inside this folder, will be another folder with the same name. Rename that folder to zmakebas and move to your home folder.

From your home folder, run the following:

Code: Select all

cd zmakebas
make
sudo make install
You can now test with:

Code: Select all

zmakebas -o demo2.tap -n demoname demo.bas
Then run the tap file with:

Code: Select all

fuse demo2.tap
Full details are here.

Next time we look at zxbasic.
Post Reply