ZXSpin assembler not working

The place for codemasters or beginners to talk about programming any language for the Spectrum.
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

ZXSpin assembler not working

Post by MrPixel »

it refuses to recognize legit code and keeps spitting out an error about operands, even when i check and double check. worse this is the code i used:
checker_speccy: ld hl,$5700
ld a,$55
l0: dec l
ld (hl),a
jr nz,l0
rlca
dec h
bit 6,h
jr nz,l0
ret
i went to assemble and it bricked the damn emulator.

any idea why?
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 »

The parser is pretty fragile in that assembler, and it hasn’t been actively developed or supported for years.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

any alternatives?

to the assembler, not the emulator
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: ZXSpin assembler not working

Post by Nomad »

Learn to think like the computer hates you, because it does.
1. write the source asm file in a text editor (vim/emacs/ed pick your poison)

2. assemble with your cross platform assembler.
Spoiler
Image
3. debug

4. generate a tap

5. run the tap in your emulator, does it work? Rejoice.. if not go back to step 1.

Use a dedicated assembler. Generate a tap. Run the tap in the assembler.
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 »

You could look at SjasmPlus, Zeus, z80asm (part of z88dk project), perhaps pasmo.

The syntax breaking Spin is likely to be something in the naming convention of your labels. Or you could try # instead of $ as the hex prefix.
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]

I just ran this in pasmo and it runs fine:

Image

http://pasmo.speccy.org/

save the code in a text file in the same folder as pasmo as mrpixel.asm (You need a 'org $6000' at the top of your code, and an 'END 24576' and the end of the code)

Code: Select all

pasmo --tapbas mrpixel.asm mrpixel.tap
The program with auto-run thanks to the END command.

Whilst ZXSpin is a great emulator (and having a built in assembler is great), as others have said it has not been updated for years. Some people have no problems with it in Windows 10, others (me included) have issues with it.
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

that helped, thanks. going to use zeus (how do i shrink the display?)
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]Seven.FFF[/mention] is our resident ZEUS expert.
User avatar
Joefish
Rick Dangerous
Posts: 2058
Joined: Tue Nov 14, 2017 10:26 am

Re: ZXSpin assembler not working

Post by Joefish »

That might be OK to start with, but one of the better ways of setting up development on a PC is to use a programming-friendly text editor with programmable functions. You can then pick and choose the compiler and emulator to use with it.

I use Crimson editor. You can program a function key to call a command-line compiler like PASMO with the assembly file you're currently editing. You then program another function key to launch the result in your chosen emulator. It's fiddly to set up but once it's done it's really simple to operate. And as I say, you can then choose whichever compiler and emulator you prefer.
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 »

MrPixel wrote: Mon Mar 26, 2018 6:38 pm that helped, thanks. going to use zeus (how do i shrink the display?)
You can set the Zeus editor font and size on the Config tab, near the top.

Excuse my scribbles! The pane that shows the bytes and addresses being assembled ("A") is toggled on/off with right click >> Toggle Code. The register and options pane ("B") is toggled with right click >> Toggle Emulator Panel. You can make the output window ("C") bigger or smaller by dragging the horizontal line up/down.

The emulator size (on the "Emulator" tab) is fixed.

Image
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 »

Good point [mention]Joefish[/mention] I use a mix of Notepad++ and Atom. I'm pretty sure that Notepad++ has these capabilities. In the long term I should spend time setting it up.
namco
Manic Miner
Posts: 247
Joined: Mon Dec 04, 2017 8:55 pm

Re: ZXSpin assembler not working

Post by namco »

Looks fine to me:

Image
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 »

Same here, now I come to try it. I'm using 0.7, which made me specify ORG and MAIN, but:

Image
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
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 »

Actually, no!! After assembling it completely wedges for me too. I mean completely, only the Processes tab of task manager will kill it.

If you're using 0.7 like me, try using whatever version [mention]namco[/mention] is using. Or give up!

Bit worrying that ret and rlca are symbols in my version. I would personally run a mile from any assembler that told me that.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
namco
Manic Miner
Posts: 247
Joined: Mon Dec 04, 2017 8:55 pm

Re: ZXSpin assembler not working

Post by namco »

If you're using 0.7 like me, try using whatever version @namco is using. Or give up!
It's version 0.666
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

namco wrote: Mon Mar 26, 2018 11:05 pm
If you're using 0.7 like me, try using whatever version @namco is using. Or give up!
It's version 0.666
it also spits out an access violation

are there any assemblers i can use with the zx spectrum instead of an entirely seperate program (30 GB is not a whole lot on a laptop
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: ZXSpin assembler not working

Post by Nomad »

You can still develop speccy stuff on a potato laptop. That is what I do. :lol: get a external hard drive for backup and to store the gigabytes of magazines and books your going to acquire. That is where the space really gets eaten up.

You could be a masochist and use 1980s tools on the actually emulator. But honestly that is so ghetto. :lol:

That works with Atari because well the emulation is on another level. Plus you have professional tools to use. That just does not exist with the spectrum. I tried actually to find something similar.

[media]https://www.youtube.com/watch?v=GCOsrefp4rA[/media]

This is what I use for the atari stuff, and its all kinds of awesome. But there is no way you are going to see this on the spectrum.
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: Tue Mar 27, 2018 2:20 am it also spits out an access violation

are there any assemblers i can use with the zx spectrum instead of an entirely seperate program (30 GB is not a whole lot on a laptop
Your code works fine for me in SPIN but, like namco only use the last stable version - 0.666. It's a very limited assembler but it's so convenient, I've been using it for years without issue. You just have to habituate to its limitations.

It's the only one that is built in to an emulator, so if you want something more advanced it will have to be the other examples mentioned I think.

org 32768 checker_speccy: ld hl,$570 ... z,l0 ret
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

just out of curiosity, how do i save to tape or disk if i make a game? :?:
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

R-Tape wrote: Tue Mar 27, 2018 4:56 pm
MrPixel wrote: Tue Mar 27, 2018 2:20 am it also spits out an access violation

are there any assemblers i can use with the zx spectrum instead of an entirely seperate program (30 GB is not a whole lot on a laptop
Your code works fine for me in SPIN but, like namco only use the last stable version - 0.666. It's a very limited assembler but it's so convenient, I've been using it for years without issue. You just have to habituate to its limitations.

It's the only one that is built in to an emulator, so if you want something more advanced it will have to be the other examples mentioned I think.

org 32768 checker_speccy: ld hl,$570 ... z,l0 ret
0.666 looks like something out of Bttf.
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

0.666 still gives out a violation. when assembling to memory, what do i put? :?:
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: Tue Mar 27, 2018 5:55 pm 0.666 looks like something out of Bttf.
“Please excuse the crudity of this model. I didn’t have time to build it to scale or to paint it.”
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 »

MrPixel wrote: Tue Mar 27, 2018 6:07 pm 0.666 still gives out a violation. when assembling to memory, what do i put? :?:
What do you mean by violation? Errors in assembly or SPIN locks up?

If the former can you list the exact errors the assembler gives, if the latter it might be an disagreement with your OS.
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

R-Tape wrote: Tue Mar 27, 2018 6:29 pm
MrPixel wrote: Tue Mar 27, 2018 6:07 pm 0.666 still gives out a violation. when assembling to memory, what do i put? :?:
What do you mean by violation? Errors in assembly or SPIN locks up?

If the former can you list the exact errors the assembler gives, if the latter it might be an disagreement with your OS.
i managed to fix it. it was a problem with assembling to memory
namco
Manic Miner
Posts: 247
Joined: Mon Dec 04, 2017 8:55 pm

Re: ZXSpin assembler not working

Post by namco »

MrPixel wrote: Tue Mar 27, 2018 5:50 pm just out of curiosity, how do i save to tape or disk if i make a game? :?:
Dev-wise I use ZX Spin to check if the code I've done is ok, the only thing that doesn't work properly is the beeper. When I'm happy I use Pasmo to compile and turn it into a tape format.

If you want to add a loading screen (much like how Bob the Space Janitor works) then here is a good tutorial for this - the stage 3 part. How you make the screen is up to you:
http://little-shop-of-pixels.blogspot.c ... part2.html

Edit:
Just remembered, this part:
COPY /B /Y LOADER.TAP+LOADING_SCREEN.TAP FINAL.TAP

You'll need to add your game code so it'll actually look like this:
COPY /B /Y LOADER.TAP+LOADING_SCREEN.TAP+[YOURGAME].TAP FINAL.TAP

And this part here needs extending:
10 PAPER 7 : INK 0 : PRINT AT 0,0
20 LOAD "" SCREEN$

I think you add:
30 LOAD "yourgame"
40 RANDOMISE USR [ORG ADDRESS]

Without 40 it'll load and do nothing.

Edit 2 - clarification:
I was almost correct but 30 is actually:
30 LOAD ""CODE

As for disk, I don't know.

Image
Post Reply