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: 2640
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: 639
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: 6353
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.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: ZXSpin assembler not working

Post by Nomad »

Senor pixel, its going to hurt worse the longer you put off using a dedicated assembler...

Look up the zx spectrum memory map.. Your figure out what has gone wrong. What the guys tell you is true also. Check your number base. Its nice if you want to start with hexadecimal number values but its important to stick to it, mixing and matching makes its hard to debug later. Doing it decimal is a legit choice its totally a personal thing. Just pick and stick.

What I tend do do is go for C350 (hex)/50000 (dec), most small programs your going to do for a long while yet are going to be wee titdlers. No need to max out available memory. :lol: Your soon figure out when you run out of memory anyhow.
Spoiler
Now fella not to belabor the point... but I see this in your future...
Image
Last, do yourself a favor. Time to empower yourself with some book learning. Read the following chapter. Once you get it your understand what happened and what ya need to do.

http://www.worldofspectrum.org/ZXBasicM ... hap24.html

Write the notes out longhand, draw your own diagrams and your remember the memory map a whole lot faster. That copy and paste stuff does not work half as well. Something about writing the information down with your own hand helps it go in & seeing your notes in your own hand.
Spoiler
But I gotta feeling that ain't going to happen somehow. :lol: Well up to you.
User avatar
PeterJ
Site Admin
Posts: 6854
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ZXSpin assembler not working

Post by PeterJ »

[mention]Nomad[/mention] is right, you need to spend some time reading through some of the beginner books and tutorials to get you started. I know its a pain, but it really is the only way. Its well worth it!
AndyC
Dynamite Dan
Posts: 1388
Joined: Mon Nov 13, 2017 5:12 am

Re: ZXSpin assembler not working

Post by AndyC »

Yeah, I think you're just hitting one of the biggest speed bumps when transitioning from BASIC to machine code, notably that the number of decisions the tools make for you are significantly less. In BASIC you don't have to worry about where your code is, you don't have to worry about where your variables are but machine code is the exact opposite end of the spectrum (so to speak). You have to make every decision, the assembler you use isn't going to do it for you. So you have to understand how the memory map work, which bits you can use and which bits are in some way "special" - for example the screen memory.

One result of giving you all that power and pretty much requiring you to understand it, is that the tools are not ever likely to be quite as "helpful" as BASIC is. The error messages can tend to be a little more vague and often you won't get entirely helpful (if any) error message for certain kinds of mistake. There is an implicit assumption you won't tend to try and name label the same as assembly reserved words and registers, so those kinds of error tend to lead to cryptic messages. Likewise many assemblers will let you do seemingly crazy things just because it's assumed you know what you are doing. So LD A, 257 will often assemble just fine as LD A,1 - because the tools are assuming you implicitly wanted only the lower 8 bits of a number. This kind of thing can be handy and infuriating in equal measures, but ultimately you tend to just have to live with it.
MrPixel
Microbot
Posts: 170
Joined: Sat Mar 24, 2018 7:42 pm

Re: ZXSpin assembler not working

Post by MrPixel »

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.
and after? i use real tape mode and save but all it says is press play on tape, shows a flashing border, than nothing.
User avatar
Seven.FFF
Manic Miner
Posts: 735
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: ZXSpin assembler not working

Post by Seven.FFF »

Post the tap file, and we’ll be able to see if it’s ok or if you have a loading problem.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: ZXSpin assembler not working

Post by Nomad »

Hey Pixel, get yourself a dropbox or github. That way you can post your tap's/dsk/tzx files to. That way when you have a problem, or want to share your work you can link people to it.

What helped me was putting a development log on this website - that way you got one place to ask all your questions, strut your stuff, and it keeps you 'accountable to your goals'.

People were real good to me and helped a whole bunch. Its very different to other communities. You put the effort in and people will teach you what you need. None of that elitist BS you find in other places, with the spectrum people for the most part its the opposite (usually).
User avatar
Alessandro
Dynamite Dan
Posts: 1908
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: ZXSpin assembler not working

Post by Alessandro »

I'll put it bluntly: Do not use the ZX Spin in-built assembler. It's buggy and has not been updated for ages.

With due respect to Dunny's work (I'd really like to see an updated version of his emulator), I strongly recommend everyone wishing to write and assemble their Z80 Assembly code to stick to their favorite text editor and assembler; my personal choices are Notepad++ and Pasmo respectively.
User avatar
PeterJ
Site Admin
Posts: 6854
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ZXSpin assembler not working

Post by PeterJ »

Alessandro wrote: Mon Apr 02, 2018 10:59 am my personal choices are Notepad++ and Pasmo respectively.
Do you use any of the external command tools in Notepad++ [mention]Alessandro[/mention]? I can never work out how they work, so any tips appreciated.
User avatar
Alessandro
Dynamite Dan
Posts: 1908
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: ZXSpin assembler not working

Post by Alessandro »

PeterJ wrote: Mon Apr 02, 2018 3:33 pm Do you use any of the external command tools in Notepad++ @Alessandro? I can never work out how they work, so any tips appreciated.
Do you mean the plugins? Actually not, I even turned autocompletion off because it interfered too much with composition.
User avatar
PeterJ
Site Admin
Posts: 6854
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ZXSpin assembler not working

Post by PeterJ »

Alessandro wrote: Mon Apr 02, 2018 5:19 pm
Do you mean the plugins? Actually not, I even turned autocompletion off because it interfered too much with composition.
Sorry, I mean automating the task of compiling with Pasmo from within Notepad++, or do you just use the command line?
User avatar
Alessandro
Dynamite Dan
Posts: 1908
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: ZXSpin assembler not working

Post by Alessandro »

I use a simple batch file named PAS.BAT and execute it from a command line window. The batch file contains the following:

Code: Select all

@echo off
pasmo --tap %1.asm %1.tap
barry
Drutt
Posts: 3
Joined: Wed Jan 01, 2020 3:36 pm

Re: ZXSpin assembler not working

Post by barry »

Apologies for bumping an old thread but thought it best to keep it all in one place.

My zxspin has sort of stopped working properly, in the assembler window whenever i type in text it comes up as nonsense text like this
Image
i've tried changing the fonts etec and nothing seems to work, it was working fine up until not long ago. not a clue what happened, it's possible i changed something in the settings but no idea what or where. any ideas? i was using the latest copy and tried changing to an older one and that does the same thing too.
i realise it's old and not updated and does have bugs but i kinda liked spin and had gotten used to using it and would like to continue using it if possible.

thanks!
User avatar
R-Tape
Site Admin
Posts: 6353
Joined: Thu Nov 09, 2017 11:46 am

Re: ZXSpin assembler not working

Post by R-Tape »

barry wrote: Sun Feb 28, 2021 2:27 pm My zxspin has sort of stopped working properly, in the assembler window whenever i type in text it comes up as nonsense text like this
Ahh I've had this before. I think pressing (or unpressing) scroll lock, or something like that on the keyboard sorted it. Failing that, a full power cycle might do the trick.
barry
Drutt
Posts: 3
Joined: Wed Jan 01, 2020 3:36 pm

Re: ZXSpin assembler not working

Post by barry »

R-Tape wrote: Sun Feb 28, 2021 4:11 pm
I think pressing (or unpressing) scroll lock, or something like that on the keyboard sorted it.
It did! Thanks so much, I can get back to not having a clue what I'm doing :D
Post Reply