ZX81 Assembly Programming - Getting Started

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Crayon21
Posts: 346
Joined: Sun Nov 04, 2018 2:33 am

Re: ZX81 Assembly Programming - Getting Started

Post by Crayon21 »

swensont wrote: Wed Mar 09, 2011 4:19 am A few months ago, I returned to doing a little ZX81 assembly programming after almost 25 years gone. In learning about the new tools and new emulators, I found no single "Getting Started" document, so I decided to create one.

The paper is called "Assembly Language on the ZX81: An Updated Getting Started Guide". There are number of books that instruct the new user on assembly language on the ZX81. This document adds additional information about doing the assembly language with emulators and cross compilers. The paper provides some examples of short assembly programs (fully tested) using the TASM cross assembler and an appendix lists a number of ZX81 rom routines and how they are used.

I'm no expert on the subject, but I find that when I document something that I am learning, I learn it much better. I know that quite a number of folks on the Board are experts at assembly and I don't know if there are any people interested in learning, but at least the document is done and maybe someone will find it useful.

The document was too large for the Board, so Rich hosted it for me:

http://www.rwapsoftware.co.uk/zx81/ZX81 ... tarted.zip

Tim Swenson
I think it's a bug or something but i typed the code in the manual (using the flat assembler) and it stops with an error at the loop
this code:

LD A,1
loop
rst $10
inc A
cp 36
JP NZ,loop
ret
In Heck, there are two options for perpetual torment:

Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
:twisted:
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Re: ZX81 Assembly Programming - Getting Started

Post by David G »

assembler requires the label to have a colon:

Code: Select all

loop:
...
JP NZ,loop
instead of

Code: Select all

loop
...
JP NZ,loop
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: ZX81 Assembly Programming - Getting Started

Post by XavSnap »

using the flat assembler)
:shock:
Tasm, Z80 ass or the Artic ASM2 ?

In ASM2, you had to type > Shift+ A ( for Label. )
Or/and add tab before mnemonics.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Re: ZX81 Assembly Programming - Getting Started

Post by David G »

ZX-IDE is based on 'flat assembler', the open source assembly language compiler
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Re: ZX81 Assembly Programming - Getting Started

Post by David G »

Crayon21 wrote: Thu Jan 28, 2021 12:44 ami typed the code in the manual (using the flat assembler) and it stops with an error at the loop
this code:

LD A,1
loop
rst $10
inc A
cp 36
JP NZ,loop
ret
was just testing this in the Flat Assembler (ZX-IDE), and it reports "Error: illegal instruction: loop"

Code: Select all

LD A,1
loop
rst $10
inc A
cp 36
JP NZ,loop
ret
Adding a colon after the first 'loop' (the label) mitigates the error

Code: Select all

LD A,1
loop:
rst $10
inc A
cp 36
JP NZ,loop
ret
However, labels are not required to have colons in Flat Assembler, at least I thought that's what the documentation says. In any case less trouble by using the colon

SJASM does not require a colon (can use a colon or not), but the label must start at the beginning of the line. Such as this

Code: Select all

        LD A,1
loop
        rst $10
        inc A
        cp 36
        JP NZ,loop
        ret
unlike flat assembler, SJ Assembler requires the other lines to be indented at least one space
Post Reply