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
Berk
Posts: 19
Joined: Sun Dec 02, 2018 8:08 am

How to get started coding for ZX?

Post by tomxp411 » Mon Dec 03, 2018 5:31 pm

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.
0 x

User avatar
PeterJ
Site Admin
Posts: 1347
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: How to get started coding for ZX?

Post by PeterJ » Mon Dec 03, 2018 5:38 pm

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
1 x

User avatar
Ast A. Moore
Dynamite Dan
Posts: 1219
Joined: Mon Nov 13, 2017 3:16 pm

Re: How to get started coding for ZX?

Post by Ast A. Moore » Mon Dec 03, 2018 6:01 pm

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.
1 x
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
Site Admin
Posts: 210
Joined: Tue Nov 14, 2017 9:51 am

Re: How to get started coding for ZX?

Post by Ivanzx » Mon Dec 03, 2018 8:52 pm

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!
1 x

Ralf
Dynamite Dan
Posts: 1311
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: How to get started coding for ZX?

Post by Ralf » Mon Dec 03, 2018 9:08 pm

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.
1 x

tomxp411
Berk
Posts: 19
Joined: Sun Dec 02, 2018 8:08 am

Re: How to get started coding for ZX?

Post by tomxp411 » Mon Dec 03, 2018 10:33 pm

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. =)
0 x

andydansby
Berk
Posts: 16
Joined: Fri Nov 24, 2017 5:09 pm

Re: How to get started coding for ZX?

Post by andydansby » Sun Dec 09, 2018 4:51 pm

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.
0 x

User avatar
PeterJ
Site Admin
Posts: 1347
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: How to get started coding for ZX?

Post by PeterJ » Sun Dec 09, 2018 5:07 pm

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
0 x

User avatar
1024MAK
Manic Miner
Posts: 531
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 » Sun Dec 09, 2018 5:09 pm

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
0 x

oblo
Berk
Posts: 25
Joined: Mon Dec 10, 2018 9:24 pm

Re: How to get started coding for ZX?

Post by oblo » Mon Dec 10, 2018 10:35 pm

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.
0 x

Post Reply