How to get started coding for ZX?

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
tomxp411
Drutt
Posts: 19
Joined: Sun Dec 02, 2018 8:08 am

How to get started coding for ZX?

Post by tomxp411 »

Hi, all. I recently picked up a Recreated, as well as a Spectrum 128 (which is still in the mail), and I wanted to explore progamming options above & beyond BASIC.

I like the Z80 for assembly programming, much more than the 6502, but I'm finding that Spectrum BASIC is slooow.

I was hoping to find a "getting started" sticky here, but there isn't one. So can you guys give me some suggestions on getting started coding for the Spectrum?

I know programming (I've been coding professionally since the 90s), but I come from a CP/M, Commodore & PC background, and I've never used a Spectrum before picking up the Recreated a couple of weeks ago. I've written both a 65x virtual machine and an 8080 assembler (Z80 is a superset of 8080, so I'll probably extend my assembler and integrate it with my BASIC tokenizer to build an IDE.)

So I really need a "getting started" manual, a programmer's reference that explains the architecture of the computer, and maybe a guide to assembly programming for the Spectrum. Also, of course, I'd love to see what people are using to code these days.

Thanks. =)
Last edited by tomxp411 on Mon Dec 03, 2018 6:26 pm, edited 1 time in total.
User avatar
PeterJ
Site Admin
Posts: 6855
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: How to get started coding for ZX?

Post by PeterJ »

This is how I got started:

http://shaunbebbington.blogspot.com/201 ... art-i.html

Once you are familiar with the basics, this guide is fantastic:

https://spectrumcomputing.co.uk/zxdb/si ... (v1.0).pdf
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: How to get started coding for ZX?

Post by Ast A. Moore »

If you’re a professional programmer, than learning the Z80 assembly should be the least of your worries. It’s a very clear and simple assembly language, and shouldn’t present any problems.

What you absolutely must study—especially, since you’re new to the Spectrum—is the Spectrums architecture. It’s full of little (and not so little) quirks and peculiarities, without mastering which you won’t get very far.

A place to start.
A note on the Spectrum’s display file layout.

Hope this helps.

And, of course, feel free to browse this or other forums for practical coding examples and discussions.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
Ivanzx
Manic Miner
Posts: 736
Joined: Tue Nov 14, 2017 9:51 am

Re: How to get started coding for ZX?

Post by Ivanzx »

Welcome to the Speccy development! I am curious to see what games you did professionally :)

And by the way, there is a Spectrum compo ongoing, with very good prizes, maybe you get some more motivation! ;)

http://zx-dev-mia-remakes.proboards.com/


Let us know about your progress!
Ralf
Rick Dangerous
Posts: 2279
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: How to get started coding for ZX?

Post by Ralf »

Hi !

Seems that you already have a lot of experience. Most of beginner's book which explain concepts like loop, jump or hex notation will be too basic for you.

So speaking for the architecture:

- get used to Z80 instruction set, today you will find many interactive websites with it, for example here:
http://clrhome.org/table/

- try to understand Spectrum graphics mode, its limitations (attributes) and organisation of Spectrum screen memory. I'd recommend reading this as first step:
https://chuntey.wordpress.com/2010/03/2 ... -tutorial/

And that's for the general advice. The following advice would depend on your goal, what you are actually trying to achieve. Write a game, demo, some utility...

Don't be afraid to ask any specific questions.
tomxp411
Drutt
Posts: 19
Joined: Sun Dec 02, 2018 8:08 am

Re: How to get started coding for ZX?

Post by tomxp411 »

Thanks for your input, so far. That really helps. Right now, I'm playing with BASIC, and I'm writing a small space trading program. I'm hoping to release it for Commodore, Spectrum, and CP/M all at the same time, using a single code base and a custom tokenizer/IDE I'm working on.

In the long run, I'm hoping to actually build an IDE for cross-platform development, with the various BASIC dialects as my build targets. I know it sounds like a weird thing to do, but I am definitely weird like that. =)
andydansby
Microbot
Posts: 147
Joined: Fri Nov 24, 2017 5:09 pm
Location: Syracuse, NY, USA
Contact:

Re: How to get started coding for ZX?

Post by andydansby »

You can also try Z88dk, a C compiler that supports many Z80 targets including the ZX Spectrum.

https://www.z88dk.org

You can use assembly within a function, so as you need to hand optimize a function, you can do that as well.

CP/M, CPC and Speccy could all be in the same code base with changes to Specific targets.
User avatar
PeterJ
Site Admin
Posts: 6855
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: How to get started coding for ZX?

Post by PeterJ »

There is a great tutorial here for z88dk which was written by one of our regulars.

https://github.com/z88dk/z88dk/blob/mas ... edGuide.md
User avatar
1024MAK
Bugaboo
Posts: 3104
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: How to get started coding for ZX?

Post by 1024MAK »

One document you should read through if you are using BASIC, is the 16k/48k manual. Here is an easy to read version.
As well as explaining BASIC, it also does cover the basics of the machines architecture, such as the reading of the keyboard, the screen, the memory map etc...

Mark
:!: Standby alert :!:
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :dance
Looking forward to summer later in the year.
User avatar
oblo
Drutt
Posts: 31
Joined: Mon Dec 10, 2018 9:24 pm

Re: How to get started coding for ZX?

Post by oblo »

If you want some performance without knowing assembler, boriel's ZX Basic compiler can be an option (in fact, that's what I use) Programming is in BASIC but with a few more features and less limitations than the original BASIC; the result is compiled code and also you can use assembler routines, so you can combine the best of the two worlds.
Cheers.
Post Reply