ZXSpin assembler not working

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

Re: ZXSpin assembler not working

Post by Ast A. Moore »

R-Tape wrote: Wed Mar 28, 2018 5:59 am I still make my TAP files in the emulator using 'insert tape' and SAVE""CODE from speccy BASIC.
Wow, dude . . . That’s, like, not cool, man. :lol:

Glad I spent some time creating a syntax highlighter and a few scripts and templates for the TextMate+zasm combo.
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
Sokurah
Manic Miner
Posts: 286
Joined: Tue Nov 14, 2017 10:38 am
Contact:

Re: ZXSpin assembler not working

Post by Sokurah »

Ast A. Moore wrote: Wed Mar 28, 2018 10:26 am
R-Tape wrote: Wed Mar 28, 2018 5:59 am I still make my TAP files in the emulator using 'insert tape' and SAVE""CODE from speccy BASIC.
Wow, dude . . . That’s, like, not cool, man. :lol:

Glad I spent some time creating a syntax highlighter and a few scripts and templates for the TextMate+zasm combo.
Haha, R-Tape, so do I :lol:
Website: Tardis Remakes / Mostly remakes of Arcade and ZX Spectrum games.
My games for the Spectrum: Dingo, The Speccies, The Speccies 2, Vallation & Sqij.
Twitter: Sokurah
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

Re: ZXSpin assembler not working

Post by Ast A. Moore »

Sokurah wrote: Wed Mar 28, 2018 10:33 am
Ast A. Moore wrote: Wed Mar 28, 2018 10:26 am Wow, dude . . . That’s, like, not cool, man. :lol:

Glad I spent some time creating a syntax highlighter and a few scripts and templates for the TextMate+zasm combo.
Haha, R-Tape, so do I :lol:
*backs away slowly* :shock:
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
R-Tape
Site Admin
Posts: 6402
Joined: Thu Nov 09, 2017 11:46 am

Re: ZXSpin assembler not working

Post by R-Tape »

Ast A. Moore wrote: Wed Mar 28, 2018 11:04 am *backs away slowly* :shock:
As the SPIN assembler dumps the code directly I use that for all the development and testing, so I only need to make the TAP (or TZX) at the every end.

It's a very satisfying process, all the way from the startup loader block (don't forget to POKE 23739), dumping the loading screen in upper memory to the main code blocks. I generally draw the line at using real hardwear for this step!

I can detail all this at some point but it looks like MrPixel is sorted for now.
Ralf
Rick Dangerous
Posts: 2283
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: ZXSpin assembler not working

Post by Ralf »

I still make my TAP files in the emulator using 'insert tape' and SAVE""CODE from speccy BASIC.
Haha, R-Tape, so do I
And me too :lol:

I write a loader in basic, save it to tape with SAVE "prog" LINE 10
Then import loading screen to emulator, save it to tape with SAVE "screen" SCREEN
Then import asm program as .bin file to emulator and save it to tape with SAVE "code" CODE 30000,20000

Actually I do it all only when my program is complete. During development I work only with .sna files. Creating a tape is the final touch, 10 minutes of work after 50 hours of coding or so.
User avatar
Morkin
Bugaboo
Posts: 3266
Joined: Mon Nov 13, 2017 8:50 am
Location: Bristol, UK

Re: ZXSpin assembler not working

Post by Morkin »

(Morkin holds his hand up with everyone else) "Me too..!" :lol:

I used Spin, but only because I don't know how to do command line stuff, like some of you GUIphobes round here, I'm not in the Matrix like the rest of you.. ;) :D

I was going to try out some other packages, but despite its 'features', Spin was the first one that let me just pick it up and create stuff straight away without any configuration issues. The only problems I had were:
  • the editor, could be a bit flaky at times; fixes = (a) use notepad when copying and pasting very large chunks of code, (b) save multiple versions of code just in case!
  • I would have liked a better way of seeing character strings in the debugger (the window re-sizing seemed a bit weird), there might be an easy way that I'm missing, though it ultimately did what I needed it to do
  • the 'stable version' (0.666) doesn't seem to want to play BEEPer sound FX if you select the Speccy 48k model
Otherwise I really liked using it.
My Speccy site: thirdharmoniser.com
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

though i parted ways with Atari Forum, i'm glad. a few posts in the chat room and everyone turns hostile. so i left
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

Re: ZXSpin assembler not working

Post by Ast A. Moore »

Morkin wrote: Wed Mar 28, 2018 1:33 pm (Morkin holds his hand up with everyone else) "Me too..!" :lol:
Keep ’em comin’. The exorcists says he charges by the hour. Whether it’s one person or ten—makes no difference.
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
Guesser
Manic Miner
Posts: 641
Joined: Wed Nov 15, 2017 2:35 pm
Contact:

Re: ZXSpin assembler not working

Post by Guesser »

I don't. My tap files get generated automatically by the makefile when I build each project.
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

i found an assembly listing in an old scan of zx computing. it was really weird. here's my modified code:

org 32768
ld hl,22527
ld bc,192
push bc
ld bc,-31
add hl,bc
ld a,(hl)
ld d,h
ld e,l
inc hl
ld bc,31
ldir
dec hl
ld (hl) ,a
ld bc,-32
add hl,bc
pop bc

dec bc
ld a,b
or c
to
loop
pop hl
ld bc,24
ld de,22528
ld hl,22529
ld a,(de)
push bc
ld bc,31
ldir
inc de
inc hl
inc bc
inc hl
ret

and here's the original:
https://archive.org/stream/ZX-computing ... 3/mode/2up

what's weird is that the original code refused to assemble without modifications. i think i screwed it up it's supposed to be a scroll right routine
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ZXSpin assembler not working

Post by PeterJ »

What errors were you getting with the original code [mention]MrPixel[/mention] .

Have you started with that Shaun Bebbington tutorials I linked for you. They are a perfect beginners starting text.

http://shaunbebbington.blogspot.co.uk/2 ... i.html?m=1
Ralf
Rick Dangerous
Posts: 2283
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: ZXSpin assembler not working

Post by Ralf »

What errors were you getting with the original code @MrPixel .
I believe things like JR NZ to Loop2 is some rare syntax not supported by modern crosscompilers

By the way, it's not weird that code written in one assembler doesn't compile in other. I would say it's pretty normal. Machine code under it is always the same but then there are macros, shortcuts, labels, start addresses, blocks of data, hex numbers and other stuff which may have a different notations between tools.
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ZXSpin assembler not working

Post by PeterJ »

[mention]MrPixel[/mention] you will find the whole tutorial series from ZX Computing typed out here:

http://www.users.globalnet.co.uk/~jg27p ... 1st_mc.zip

[mention]Ralf[/mention] is right that some assemblers had slightly different syntax, but you will learn to get around this as you learn. The error messages given by Pasmo or any other assembler will always help you along.
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ZXSpin assembler not working

Post by PeterJ »

[mention]MrPixel[/mention] here is the code tested in Pasmo (This is the scroll left version). Taken directly from the Jim Grimwood document sent earlier.

Code: Select all

org $6000
	LD HL,22527
        LD BC,192
loop    PUSH BC
        LD BC,-31
        ADD HL,BC
        LD A,(HL)
        LD D,H
        LD E,L
        INC HL
        LD BC,31
        LDIR
        DEC HL
        LD (HL),A
        LD BC,-32
        ADD HL,BC
        POP BC
        DEC BC
        LD A,B
        OR C          
        JR NZ,loop
        LD BC,24
        LD DE,22528
        LD HL,22529
loop2   LD A,(DE)
        PUSH BC
        LD BC,31
        LDIR
        DEC HL
        LD (HL),A
        INC DE       
        INC HL     
        INC HL
        POP BC 
        DEC BC 
        LD A,B
        OR C 
        JR NZ,loop2 
        RET  


END $6000
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: ZXSpin assembler not working

Post by Nomad »

The need to carefully check the syntax of the assembly listing from the books & magazines is actually a good thing. *ducks*

Just hear me out..

First never forget that...
Spoiler
Learn to think like the computer hates you, because it does. - Zed Shaw
Also its supposed to be hard - especially at first. Its going to be a struggle. But the journey is very rewarding because of this. You learn so many skills that help every other language you go on to learn after this. That kind of self reliance, attention to detail, research skills its all wonderful stuff. Nothing in high level languages comes close to the feeling you get when you see a non-trivial program actually working in zx80 assembly because almost everything with the spectrum is stacked against you.

Its natural to get disheartened but just stick with it. It makes the point where you start to bend the assembler to your will, to master the spectrum memory map, figure out the ROM. each step is a major achievement on the road to speccy enlightenment.

You learn not to trust the listings, not just uncritically copy and pasting stuff. You actually learn what each line is doing. It might take longer but you gain a whole lot more from the process. As the guys have said once you learn how your assembler works you just do a lot of these steps automatically.

Pick your assembler, then read its manual. This will hopefully give you most of the information you need. (Ok pasmo documentation could be a lot better, and Zeus is kind of a learn through examples deal but documentation is something that tools for spectrum fail hard on.) But its good enough to do all but the most complex of tasks. If you get to a point where you are stuck just ask here. People are very friendly.

The basics are usually the same, but beyond that its very much a matter of design choice. What systems they had worked on before and what the needs of the user of that assembler were.

I think with the modern tutorials that is something that gets lost is the analysis phase is often overlooked.
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

i need help with 2 errors

symbol redefined (for new functions and

invalid combination of opcodes and errors for this:


DI ; 4 clocks F3
LD HL, $8002 ; 10 21 02 80
a: DEC HL ; 6 2B
b: DEC HL ; 6 2B
c: INC (HL) ; 11 34
JR NZ, c ; 7/12 20 FD (they appear on this line)
INC HL ; 6 23
INC (HL) ; 11 34
JR NZ, b ; 7/12 20 F8
INC HL ; 6 23
INC (HL) ; 11 34
JR NZ, a ; 7/12 20 F3
EI ; 4 FB
RET
this forces me to find workarounds, ruining the code. it's pissing me off
User avatar
Seven.FFF
Manic Miner
Posts: 744
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: ZXSpin assembler not working

Post by Seven.FFF »

a, b, and c are registers. You can’t use them as label names. You wouldn’t be able to use other reserved words like ld, add, org, equ or numbers either.

Not sure what you mean by symbol redefined without an example. Generally you can’t reuse label names (unless your assembler has a local label facility), because that would be assigning two different addresses, and therefore different values, during the same assembly run.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ZXSpin assembler not working

Post by PeterJ »

[mention]MrPixel[/mention] where did you find this piece of code?
User avatar
R-Tape
Site Admin
Posts: 6402
Joined: Thu Nov 09, 2017 11:46 am

Re: ZXSpin assembler not working

Post by R-Tape »

What SevenFFF said, just to expand on it:
MrPixel wrote: Sat Mar 31, 2018 2:53 am i need help with 2 errors

symbol redefined (for new functions and
You have used the same label name more than once.
invalid combination of opcodes and errors for this:
You can't use assembler terms that you use to manipulate code (e.g. a,b,c,and,or,rlca etc) as labels. With ZX-Spin for example these things are colour coded, cyan for opcode, and magenta for labels. So if your label is not magenta, you can't use it.

It needs to be something like this, and now you've used "namea" you cannot use it to label another routine.

Code: Select all

	DI ; 4 clocks F3
	LD HL, $8002 ; 10 21 02 80
namea:	DEC HL ; 6 2B
nameb:	DEC HL ; 6 2B
namec:	INC (HL) ; 11 34
	JR NZ,namec ; 7/12 20 FD (they appear on this line)
	INC HL ; 6 23
	INC (HL) ; 11 34
	JR NZ, nameb ; 7/12 20 F8
	INC HL ; 6 23
	INC (HL) ; 11 34
	JR NZ, namea ; 7/12 20 F3
	EI ; 4 FB
	RET 
this forces me to find workarounds, ruining the code. it's pissing me off
Chin up chef, you'll get there :D
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: ZXSpin assembler not working

Post by Nomad »

MrPixel wrote: Sat Mar 31, 2018 2:53 am this forces me to find workarounds, ruining the code. it's pissing me off
What kinda hero journey would it be without struggle, personal growth/development? This ain't no Disney star wars! :lol:

Especially at the beginning it will be hard going but you got to take your beatings like a man and come back for more. :lol: Think about a training montage. This is the beginning phase where the protagonist is getting his ass handed to him and it all seems hopeless. You got to go through the training to get the skills to overcome the challenge. :lol:

The main thing is to have patients to stick with it, even though its frustrating. To know it won't all come easy or at once. Respect the journey, follow the path and realize the goal.
Respect the burden. - Napoleon
Last edited by Nomad on Sat Mar 31, 2018 2:05 pm, edited 1 time in total.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

Re: ZXSpin assembler not working

Post by Ast A. Moore »

MrPixel wrote: Sat Mar 31, 2018 2:53 am this forces me to find workarounds, ruining the code. it's pissing me off
“I don’t like cats.”
“You just don’t know how to cook them.”

:D
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.
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

R-Tape wrote: Sat Mar 31, 2018 12:51 pm
You can't use assembler terms that you use to manipulate code (e.g. a,b,c,and,or,rlca etc) as labels. With ZX-Spin for example these things are colour coded, cyan for opcode, and magenta for labels. So if your label is not magenta, you can't use it.

It needs to be something like this, and now you've used "namea" you cannot use it to label another routine.

Code: Select all

	DI ; 4 clocks F3
	LD HL, $8002 ; 10 21 02 80
namea:	DEC HL ; 6 2B
nameb:	DEC HL ; 6 2B
namec:	INC (HL) ; 11 34
	JR NZ,namec ; 7/12 20 FD (they appear on this line)
	INC HL ; 6 23
	INC (HL) ; 11 34
	JR NZ, nameb ; 7/12 20 F8
	INC HL ; 6 23
	INC (HL) ; 11 34
	JR NZ, namea ; 7/12 20 F3
	EI ; 4 FB
	RET 
everything works fine with your code save for the ORG bit. nothing i do is working. a little help? i try 6000, 2000, hell i even did 100

this assembler is broken!

**Post edited by Admin (PJ). One potty mouth word removed.
User avatar
Guesser
Manic Miner
Posts: 641
Joined: Wed Nov 15, 2017 2:35 pm
Contact:

Re: ZXSpin assembler not working

Post by Guesser »

MrPixel wrote: Sat Mar 31, 2018 11:12 pm this assembler is broken!
If you're doing ORG 6000 (decimal) rather than ORG $6000 (hexadecimal) then you're asking it to assemble to ROM not RAM.

**Post edited by Admin (PJ). Potty mouth word removed from [mention]MrPixel[/mention] section.
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

Guesser wrote: Sat Mar 31, 2018 11:36 pm
MrPixel wrote: Sat Mar 31, 2018 11:12 pm this assembler is broken!
If you're doing ORG 6000 (decimal) rather than ORG $6000 (hexadecimal) then you're asking it to assemble to ROM not RAM.
how do i run the code in zxspin window (not the assembler) :?:
User avatar
R-Tape
Site Admin
Posts: 6402
Joined: Thu Nov 09, 2017 11:46 am

Re: ZXSpin assembler not working

Post by R-Tape »

MrPixel wrote: Sat Mar 31, 2018 11:12 pm everything works fine with your code save for the ORG bit. nothing i do is working. a little help? i try 6000, 2000, hell i even did 100
It's not broken!

If you're using SPIN and starting out here are some tips:

These numbers are in DECIMAL.

1 - In the emulated Spectrum put the stack in a safe place. Do this by typing CLEAR 32767 in BASIC. You can go lower than this but don't worry about that yet. The stack will now safely build below your code.
2 - assemble your code at ORG 32768. This is the start of fast (uncontended) memory. The highest byte you can go to is 65535.
Post Reply