Page 1 of 1

How to get started coding for ZX?

Posted: Mon Dec 03, 2018 5:31 pm
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. =)

Re: How to get started coding for ZX?

Posted: Mon Dec 03, 2018 5:38 pm
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

Re: How to get started coding for ZX?

Posted: Mon Dec 03, 2018 6:01 pm
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.

Re: How to get started coding for ZX?

Posted: Mon Dec 03, 2018 8:52 pm
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!

Re: How to get started coding for ZX?

Posted: Mon Dec 03, 2018 9:08 pm
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.

Re: How to get started coding for ZX?

Posted: Mon Dec 03, 2018 10:33 pm
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. =)

Re: How to get started coding for ZX?

Posted: Sun Dec 09, 2018 4:51 pm
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.

Re: How to get started coding for ZX?

Posted: Sun Dec 09, 2018 5:07 pm
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

Re: How to get started coding for ZX?

Posted: Sun Dec 09, 2018 5:09 pm
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

Re: How to get started coding for ZX?

Posted: Mon Dec 10, 2018 10:35 pm
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.