## Getting started!

Discuss game and other programming topics not specifically covered in another forum

Moderator: Programming Moderators

emook
Posts: 70
Joined: Mon May 29, 2017 6:55 pm

### Getting started!

"Hey kid, So you wanna be a Next games programmer?"

This post will hopefully give you some guidance on where to find the tools and examples needed to get off the ground and start writing software for the ZX Spectrum Next.

Z80 Assembly

This is what the Next's Z80 processor speaks, it’s the fastest language you can use but has a steep learning curve (and can take years to master!). Writing in Z80 Assembly is much easier these days due to cross-dev tools (meaning you can write the code on your Windows or Mac PC) to send to an emulator or direct to your Next. So let’s take a look at some assemblers.

Zeus by Simon Brattel

Setting up here : viewtopic.php?f=13&t=694&p=4206#p4206

Setting up with SublimeText by ckirby : viewtopic.php?f=13&t=600#p3109

Zeus is an assembler, IDE (integrated dev environment) and emulator suite. It has been in development for over 25 years and its built-in emulator, supports Next sprites. You can also produce TZX files (Spectrum Tape Images) to load into a more featured emulator. Zeus supports lots of nice modern additions that make assembly a touch easier (such as FOR…NEXT loops). Lots of people swear by Zeus because of its user friendly features.

SJAsmplus / Pasmo

SJAsmplus - https://sourceforge.net/projects/sjasmplus/files/
Pasmo - http://pasmo.speccy.org/

These two programs are general Z80 assemblers, so they can be used to produce code that will run on the Next including using sprites and layer2 as those features are controlled via regular OUT commands (more on that later). The two programs work in a similar way but have slight differences. Assemblers include extra features much like Zeus to add additional functionality for making code generation easier. Be sure to check out their accompanying documentation, for their specific "compiler directives".

SNASM 1.7.2 by Mike Dailly

SNASM is a 6502 / Z80 assembler written by Next dev Mike Dailly and comes part of his Next emulator "CSpect", which at the time of writing this is version 0.4. SNASM is the only assembler which supports some of the new Next Z80 opcodes

Compilers

These are similar to assemblers, as they can also accept Z80 ASM, but they use a higher language (as in easier to understand by humans) which is in turn converted (compiled) into Z80 machine code.

Z88DK

z88dk has been around for quite some time and is a Small C cross compiler with built-in assembler and linker. It has a bunch of well written libraries and forum member Alcoholics Anonymous is looking at building in Next specific support. There is no dedicated editor for z88dk and compiling code requires some command line work but the results are very impressive. You can also use inline Z80 assembler for extra speed.

Boriels ZX Basic Compiler

Boriel’s ZXB is a compiler written in Python for Windows / Linux / Mac. It uses a hybrid ZX basic language that compiles into Z80 machine code. This can be a great stepping stone for people who used to write in ZX Basic, the real benefit being the code it produces is quite fast, fast enough to make playable games. ZXB also supports using inline Z80 assembler. ZXB, like z88dk requires to be run from the command line but there are a few editors that can be configured to support syntax highlighting and one click emulation and an IDE that makes the writing > checking > compilation workflow a lot easier to manage

more to come...
---------
ZXorDIE
http://zxbasic.uk/NextBuild NextBuild
http://zxbasic.uk/db/0 ZXBasic Online Database

emook
Posts: 70
Joined: Mon May 29, 2017 6:55 pm

### Re: Getting started!

Setting up Zeus

Follow these steps to get Simon's sprite example running :
• Now click Assemble and Emulate, you should see the emulated output. You can click the WAIT button to stop emulation and click back in to the Zeus (assember) tab.
Zeus emulating sprites
zeus_setup.PNG (84.07 KiB) Viewed 9530 times
I would highly recommend you read the documentation on Simon's site for more working examples.

---------
ZXorDIE
http://zxbasic.uk/NextBuild NextBuild
http://zxbasic.uk/db/0 ZXBasic Online Database

emook
Posts: 70
Joined: Mon May 29, 2017 6:55 pm

### Re: Getting started!

Setting up Pasmo

You will need a text editor to edit your asm files, or you can configure Visual Studio Code to assemble with Pasmo :

Without VSC :
• Open a command prompt from the start menu
• Navigate to your folder eg, D: {return} cd pasmo {return}
• Type pasmo -v --tapbas --err NextSprites.asm NextSprites.tap
The above will generate a NextSprites.tap to launch in ZesaruX.

See the video below to configure Visual Studio Code for use with Pasmo

Code: Select all

{
"version": "2.0.0",
{
"type": "shell",
"command": "c:\\path\\to\\build.bat ${file}${fileBasenameNoExtension}.tap",
"problemMatcher": [
"\$tsc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
and example build.bat

Code: Select all

set ASM="c:\path\to\pasmo.exe"

%ASM% -v --tapbas --err %1 %~n1.tap

Visual Studio Code : https://code.visualstudio.com/