First Steps in Z80 Assembly Language Darryl Sloan

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

First Steps in Z80 Assembly Language Darryl Sloan

Post by PeterJ »

Some of you may have watched the YouTube series from Darryl on getting started with z80 machine code by building a connect4 game. Anyway, he has released a getting started PDF guide which is available here:

http://ped.7gods.org/z80.pdf

The original video series is here:

https://www.youtube.com/watch?v=1gHlMpO8gqw

https://www.youtube.com/watch?v=O2gw36OyX3g

https://www.youtube.com/watch?v=PEQuCtGUe-c

https://www.youtube.com/watch?v=uWqdk-1_NIg
User avatar
TMD2003
Rick Dangerous
Posts: 2041
Joined: Fri Apr 10, 2020 9:23 am
Location: Airstrip One
Contact:

Re: First Steps in Z80 Assembly Language Darryl Sloan

Post by TMD2003 »

This may be worth an entire warehouse full of corned beef sandwiches. I will investigate!
Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: First Steps in Z80 Assembly Language Darryl Sloan

Post by PeterJ »

I've read through the guide from Darryl and for any of our members who need a precursor to the Johnathan Cauldwell book it's thoroughly recommended.
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: First Steps in Z80 Assembly Language Darryl Sloan

Post by PeterJ »

If you are working your way through the above book, I have noticed a couple of typos. I have let Darryl know, so hopefully he will update the PDF.

The first one is in section eight:

Image

Should read 'you can’t add numbers directly, e.g. ADD HL, 1000 is not permissible'

Edited by PJ - 22/05/2023
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: First Steps in Z80 Assembly Language Darryl Sloan

Post by PeterJ »

Whilst on holiday I found the other two little bugs in the text that I forgot to make a note of when I first found them.

In Chapter 4 (Jumps and Loops), the text should read 'B starts off as 16 on the first pass'

Image

Also in the same chapter, the text describing the stack is incorrect. It should read 'as long as you pop the data back in to reverse order you pushed'

Image

Don't let these little bugs put you off, it's still a fantastic read and prepared me for the JC book.
User avatar
Bedazzle
Manic Miner
Posts: 305
Joined: Sun Mar 24, 2019 9:03 am

Re: First Steps in Z80 Assembly Language Darryl Sloan

Post by Bedazzle »

PeterJ wrote: Fri Oct 16, 2020 12:39 pm Some of you may have watched the YouTube series from Darryl on getting started with z80 machine code by building a connect4 game. Anyway, he has released a getting started PDF guide
Wow, quite long!

And... This is two-byte! Of course. one byte is command while second is data...
User avatar
stupidget
Dynamite Dan
Posts: 1635
Joined: Wed Jan 24, 2018 2:09 pm
Location: Sunny Wolverhampton

Re: First Steps in Z80 Assembly Language Darryl Sloan

Post by stupidget »

Do you need to know anything about coding before reading or is it ok for absolute novices?
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: First Steps in Z80 Assembly Language Darryl Sloan

Post by PeterJ »

@Bedazzle, it's explained quite well in the paragraph following the example:.
Note that we don’t have separate machine code numbers for “LD”, “A”, and the comma. The
entire instruction LD A, n is a single machine code number (62), known as an opcode. Whatever
we decide to put in n is known as the operand. Z80 instructions are powerful but simple in structure,
designed to take up as little memory as possible. They either consist of a single opcode, or a single
opcode followed by a single operand.
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: First Steps in Z80 Assembly Language Darryl Sloan

Post by PeterJ »

stupidget wrote: Fri Oct 07, 2022 7:58 pm Do you need to know anything about coding before reading or is it ok for absolute novices?
Complete beginners.
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

Re: First Steps in Z80 Assembly Language Darryl Sloan

Post by Stefan »

To add some flavour to an opcode is one byte, see https://8bitnotes.com/2017/05/ld-instructions/ which shows how the ld opcode is built up from logical bit patterns.
Post Reply