Z80 assembly development environment recommendations

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
Hedge1970
Manic Miner
Posts: 388
Joined: Mon Feb 18, 2019 2:41 pm

Z80 assembly development environment recommendations

Post by Hedge1970 »

I wonder if there are any recommendations for z80 assembly dev environments. I would like to break out of a running program at a given point and see the state of the registers and flags.

I am currently using Pasmo for compiling then launching zxspin to see the result. Zx spin does seem to have a menu option for debug but I can’t get it to work as I need.

Any recommendations would be very much appreciated.

Paul
User avatar
Mpk
Dynamite Dan
Posts: 1008
Joined: Tue Feb 09, 2021 8:10 am

Re: Z80 assembly development environment recommendations

Post by Mpk »

Working on a New Year's Resolution are we?

Anyway - Zeus is a proper IDE with breakpoints and so on

https://www.desdes.com/products/oldfiles/zeus.htm

See also this thread viewtopic.php?p=126036&hilit=Zeus#p126036
User avatar
ParadigmShifter
Manic Miner
Posts: 670
Joined: Sat Sep 09, 2023 4:55 am

Re: Z80 assembly development environment recommendations

Post by ParadigmShifter »

I don't have any problems with the spin debugger as long as I produce a symbol (.sym) file when assembling. I can't import the symbol file though which is a shame, but it's easy enough to find data and code addresses on the sym file to look at memory and put breakpoints on things.

If I want a breakpoint on a specific line I just add a label

brkhere:

and look at the address (since I only add a label I don't need to reload the binary I can just get the address of the instruction I want to break on).

Register window needs resizing a bit though and the place you have to grab with the mouse isn't very wide when doing that.

Another slight annoyance is you can't set the width of the memory window very easily (I have an 11 wide collision map so I would like to see 11 bytes per line but it's a pain).

I've not tried Zeus but I'm used to Visual Studio editor so I use that. I haven't set up any macros or anything to launch spin and upload the binary but I think you can do that with Spin, not sure.
animaal
Microbot
Posts: 101
Joined: Sat Mar 09, 2019 5:14 pm

Re: Z80 assembly development environment recommendations

Post by animaal »

Another vote for Zeus. It works really well, and is light on resources.
It can also generate tape images in tzx/tap format etc.

(And it has a heritage going back to an actual Spectrum assembler that was released on the Speccy back in the day)
User avatar
ParadigmShifter
Manic Miner
Posts: 670
Joined: Sat Sep 09, 2023 4:55 am

Re: Z80 assembly development environment recommendations

Post by ParadigmShifter »

I use sjasmplus assembler which also generates TAP files if you want them. I think pasmo can do that as well (not sure really). I think sjasmplus has better macro support than pasmo.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: Z80 assembly development environment recommendations

Post by Dr beep »

ZX Spin, just TOOLS DEBUGGER and set BREAKPOINT.
User avatar
g0blinish
Manic Miner
Posts: 287
Joined: Sun Jun 17, 2018 2:54 pm

Re: Z80 assembly development environment recommendations

Post by g0blinish »

sjasmplus(LUA allow calculate checksums) and pasmo(for create .tap files)
User avatar
Hedge1970
Manic Miner
Posts: 388
Joined: Mon Feb 18, 2019 2:41 pm

Re: Z80 assembly development environment recommendations

Post by Hedge1970 »

Thank you everyone that looks like a good start… I’ll try and get spin working as that’s all set up with macros running from my Notepad++ that both assembles the code in Pasmo then launches spin with the tap file produced by Pasmo.

I am sure I will be back with more questions but for now I have to go out for the rest of the day.

Thanks again and I will be back with a more thorough look…

@Mpk yes this for my game, it feels like a mountain to climb at the moment, but I feel confident I’ll do it this time around.
User avatar
spider
Dynamite Dan
Posts: 1099
Joined: Wed May 01, 2019 10:59 am
Location: Derby, UK
Contact:

Re: Z80 assembly development environment recommendations

Post by spider »

Pasmo and Zeus were both highly recommended to me by a professional, although I've only really tinkered with them a little bit they do seem quite good.
sn3j
Manic Miner
Posts: 500
Joined: Mon Oct 31, 2022 12:29 am
Location: Germany

Re: Z80 assembly development environment recommendations

Post by sn3j »

I'm using BasinC cause I want to work in a native environment but don't have the hardware. It has a CPU window to set breakpoints, trace execution and watch registers.
POKE 23614,10: STOP      1..0 hold, SS/m/n colors, b/spc toggle
C.Born
Manic Miner
Posts: 229
Joined: Sat Dec 09, 2017 4:09 pm

Re: Z80 assembly development environment recommendations

Post by C.Born »

ParadigmShifter wrote: Sat Jan 27, 2024 11:42 am I use sjasmplus assembler which also generates TAP files if you want them. I think pasmo can do that as well (not sure really). I think sjasmplus has better macro support than pasmo.
pasmo can do if you SET the start value at the END of the file, see docu but
only 1 single standard start-basic. its embedded in the source so a bit difficult to change into a #include file
which would be nice.
XoRRoX
Manic Miner
Posts: 233
Joined: Wed Jul 11, 2018 6:34 am

Re: Z80 assembly development environment recommendations

Post by XoRRoX »

LnxSpectrum is also becoming a nice development environment with its assembler and debugger.
https://www.ilnx.cz/lnxsp/
User avatar
Hedge1970
Manic Miner
Posts: 388
Joined: Mon Feb 18, 2019 2:41 pm

Re: Z80 assembly development environment recommendations

Post by Hedge1970 »

Dr beep wrote: Sat Jan 27, 2024 11:54 am ZX Spin, just TOOLS DEBUGGER and set BREAKPOINT.
Thank you for this I have it partially working. I can’t get it to work at all when I launch Spin using Notepad++ macros to both assemble the opcodes into an .asm file using Pasmo assembler and then launch spin and automatically load the asm file.

I can use it if I load that same file produced by Pasmo into spin via the spin Z80 Assembler (found under tools menu). I run my code using basic RANDOMIZE USER xxxxx once it’s running I can then launch the debugger and set breakpoints to look at the registers. What I seem unable to do is debug the initial launch I.e after hitting return after the randomise statement. I am sure its user error but I’ve not been able to debug the initial screen draw - not that I need to as that is working just fine :-)

But this is a good step forward :-)
User avatar
ParadigmShifter
Manic Miner
Posts: 670
Joined: Sat Sep 09, 2023 4:55 am

Re: Z80 assembly development environment recommendations

Post by ParadigmShifter »

Just put a breakpoint on the address xxxxx you use for RANDOMIZE USR xxxxx

Sometimes it disassembles the code wrong (starts disassembling earlier than it should) which can be worked around by putting some NOP instructions at the start of the executable... I usually use 4 and put it on an IF so

Code: Select all

NOPSATSTART EQU 1 ; 0 to remove the NOPs

main:
IF NOPSATSTART
    REPT 4
    NOP
    ENDR
ENDIF
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: Z80 assembly development environment recommendations

Post by Dr beep »

Hedge1970 wrote: Sun Jan 28, 2024 4:35 pm Thank you for this I have it partially working. I can’t get it to work at all when I launch Spin using Notepad++ macros to both assemble the opcodes into an .asm file using Pasmo assembler and then launch spin and automatically load the asm file.

I can use it if I load that same file produced by Pasmo into spin via the spin Z80 Assembler (found under tools menu). I run my code using basic RANDOMIZE USER xxxxx once it’s running I can then launch the debugger and set breakpoints to look at the registers. What I seem unable to do is debug the initial launch I.e after hitting return after the randomise statement. I am sure its user error but I’ve not been able to debug the initial screen draw - not that I need to as that is working just fine :-)

But this is a good step forward :-)
Place before RANDOMIZE USR a breakpoint at the start (or where you want to break)
When emulator says PAUSE go to the debugger and use the step function to do step by step.
User avatar
Hedge1970
Manic Miner
Posts: 388
Joined: Mon Feb 18, 2019 2:41 pm

Re: Z80 assembly development environment recommendations

Post by Hedge1970 »

Thank you both, I’ll be working on this tomorrow and will give both solutions a go. Many thanks.
User avatar
Hedge1970
Manic Miner
Posts: 388
Joined: Mon Feb 18, 2019 2:41 pm

Re: Z80 assembly development environment recommendations

Post by Hedge1970 »

So it’s all working well now I am able to add breakpoints and also walk through my code monitoring the registers at each step. Obviously this is a great help when debugging and has helped to identify some rather ambiguous coding decisions made by me - lol.

While I do use the stack to push and pop I also have set asside some memory locations that I poke. I’ve looked through the various memory options but can’t see a way to monitor specific memory locations easily? Currently I am using a hexloader program that has a couple of functions to peek values but it would be great if it was a feature of the Zxspin debugger that I have yet to discover?

Thanks again
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: Z80 assembly development environment recommendations

Post by Dr beep »

You can use the memory tab and in the address input you can simply input the address and see what is there.
User avatar
Hedge1970
Manic Miner
Posts: 388
Joined: Mon Feb 18, 2019 2:41 pm

Re: Z80 assembly development environment recommendations

Post by Hedge1970 »

Dr beep wrote: Mon Jan 29, 2024 8:37 pm You can use the memory tab and in the address input you can simply input the address and see what is there.
Ok I see, thanks again. I’ll work on it tomorrow but I can see the data changing. Is there any benefit to using a label MAIN and if so ideally where should it go?

I don’t currently have one but I see the prefix main: on the drop downs, and the assembler complains that MAIN is missing but the code seems to get assembled ok?
User avatar
ParadigmShifter
Manic Miner
Posts: 670
Joined: Sat Sep 09, 2023 4:55 am

Re: Z80 assembly development environment recommendations

Post by ParadigmShifter »

I think main is for the inbuilt assembler (which isn't very good - so use Pasmo or Sjasmplus). EDIT: It probably knows about its on labels though which would be handy if the assembler wasn't as crap as it is. So I just use the symbol file to lookup addresses.

I always call my entry point main for C reasons ;)

I expect spin has something where if you have a label main it starts executing from there or something rather than having to randomize usr or something.
User avatar
Hedge1970
Manic Miner
Posts: 388
Joined: Mon Feb 18, 2019 2:41 pm

Re: Z80 assembly development environment recommendations

Post by Hedge1970 »

ParadigmShifter wrote: Mon Jan 29, 2024 9:13 pm I think main is for the inbuilt assembler (which isn't very good - so use Pasmo or Sjasmplus). EDIT: It probably knows about its on labels though which would be handy if the assembler wasn't as crap as it is. So I just use the symbol file to lookup addresses.

I always call my entry point main for C reasons ;)

I expect spin has something where if you have a label main it starts executing from there or something rather than having to randomize usr or something.
Maybe I am not using the program properly, but I seem to need the built in assembler to enable the debugging features of zxspin. As of yet I’ve not noticed any issues regarding the code produced but I will be wary of the possibility now so thanks again.
User avatar
ParadigmShifter
Manic Miner
Posts: 670
Joined: Sat Sep 09, 2023 4:55 am

Re: Z80 assembly development environment recommendations

Post by ParadigmShifter »

If you can produce a symbol file you don't really need any of the spin assembler/label features.

Just lookup data addresses and go there in the memory window and if you want a breakpoint somewhere just create a label (I always use brkhere) and lookup where to set a breakpoint on a specific instruction.

e.g. symbol file produce by sjasmplus

playerprevx: EQU 0x00008C83
playerxpos: EQU 0x00008C81
gfx_solid: EQU 0x00008C68
gfx_blank: EQU 0x00008C60
gfx_checker: EQU 0x00008C58
gfx_dude: EQU 0x00008C50
gfx_smallsquare: EQU 0x00008C48
row: EQU 0x00000017
read_keyboard.notpressingD: EQU 0x00008BC0
read_keyboard.notpressingA: EQU 0x00008BBB
read_keyboard.notpressingS: EQU 0x00008BB6
read_keyboard.notpressingW: EQU 0x00008BAD
erase16x8ra: EQU 0x00008B41
erase16x8.loop2: EQU 0x00008B33
erase16x8.ok: EQU 0x00008B32
erase16x8.loop: EQU 0x00008B1B
erase16x8raKnowAddr: EQU 0x00008B4B
erase16x8: EQU 0x00008B00
erase8x8shift: EQU 0x00008B00
erase8x8end: EQU 0x00008A50
erase8x8a: EQU 0x00008A35
erase8x8caKnowAddrAndBothOffsets.loop2: EQU 0x00008A30
erase8x8caKnowAddrAndBothOffsets.ok: EQU 0x00008A2B
erase8x8caKnowAddrAndBothOffsets.loop: EQU 0x00008A1D
erase8x8caKnowAddrAndBothOffsets: EQU 0x00008A1C
erase8x8caKnowAddrAndOffset: EQU 0x00008A17
erase8x8aKnowAddr: EQU 0x00008A3F
erase8x8caKnowAddr: EQU 0x00008A12
erase8x8ca: EQU 0x00008A00
draw8x8shift7end: EQU 0x00008967
draw8x8shift7: EQU 0x00008900
draw8x8shift6end: EQU 0x0000886F
draw8x8shift6: EQU 0x00008800
draw8x8shift5end: EQU 0x00008777
draw8x8shift5: EQU 0x00008700
draw8x8shift4end: EQU 0x0000867F
draw8x8shift4: EQU 0x00008600
draw8x8shift3end: EQU 0x00008597
draw8x8shift3: EQU 0x00008500
draw8x8shift2end: EQU 0x0000847F
draw8x8shift2: EQU 0x00008400
draw8x8shiftend: EQU 0x00008367
draw8x8shift1: EQU 0x00008300
sprite8x8end: EQU 0x00008270
sprite8x8a: EQU 0x0000823F
draw8x8end: EQU 0x0000823E
sprite8x8caKnowAddrAndBothOffsets.loop2: EQU 0x00008236
sprite8x8caKnowAddrAndBothOffsets.ok: EQU 0x00008230
sprite8x8caKnowAddrAndBothOffsets.loop: EQU 0x0000821F
sprite8x8caKnowAddrAndBothOffsets: EQU 0x0000821F
sprite8x8caKnowAddrAndOffset: EQU 0x0000821A
sprite8x8aKnowAddr: EQU 0x00008249
sprite8x8caKnowAddr: EQU 0x00008215
sprite8x8ca: EQU 0x00008203
sprite16x8end: EQU 0x0000813B
sprite16x8.loop2: EQU 0x0000812D
sprite16x8.ok: EQU 0x0000812C
sprite16x8.loop: EQU 0x00008115
sprite16x8: EQU 0x000080F7
gfx_scrollbuff: EQU 0x00008C30
sprite16x8raKnowAddr: EQU 0x0000809E
tbl_rows: EQU 0x00008C00
sprite16x8ra: EQU 0x00008094
main.dontupdatex: EQU 0x00008091
main.dontupdatey: EQU 0x00008085
read_keyboard: EQU 0x00008BA1
gfx_square: EQU 0x00008C40
draw8x8: EQU 0x00008200
playerypos: EQU 0x00008C80
jphl: EQU 0x0000823E
erase_8x8_shifts: EQU 0x00008C70
main.docall: EQU 0x00000000
erase8x8: EQU 0x00008A00
playerprevy: EQU 0x00008C82
main: EQU 0x00008000
DELAYAFTERHALT: EQU 0x00000000
TIMING: EQU 0x00000001
UNROLL_Sprite8x8a: EQU 0x00000001
SCRBASE: EQU 0x00004000
User avatar
Hedge1970
Manic Miner
Posts: 388
Joined: Mon Feb 18, 2019 2:41 pm

Re: Z80 assembly development environment recommendations

Post by Hedge1970 »

lol I think I’ll file the above under “you don’t know what you don’t know “

I am new to all this and have not seen anything like your post yet. In time I am sure it will be clear one day but for now I’ve got enough going on just coding the outline of my game mechanics. Thanks though as when the time comes I am sure it will be good reference material.
User avatar
ParadigmShifter
Manic Miner
Posts: 670
Joined: Sat Sep 09, 2023 4:55 am

Re: Z80 assembly development environment recommendations

Post by ParadigmShifter »

So if I want to look at playerxpos I would produce the symbol file, look up the address (playerxpos: EQU 0x00008C81) and go to the memory window and look at $8c81.

If I wanted to put a breakpoint on erase16x8 I would set a breakpoint here: erase16x8: EQU 0x00008B00 = $8b00
User avatar
Hedge1970
Manic Miner
Posts: 388
Joined: Mon Feb 18, 2019 2:41 pm

Re: Z80 assembly development environment recommendations

Post by Hedge1970 »

Ah ok, I get that info from the output window when I assemble with Pasmo. I then keep a copy of that and assemble again in spin and then use the previous file to input addresses I want to add break points to. My output is not as neat as yours but is easily searchable and very useable especially when marked up with colours.
Post Reply