Setup Z80 language

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
chronbeng
Posts: 2
Joined: Thu Apr 21, 2022 9:05 pm

Setup Z80 language

Post by chronbeng »

Hi!

I followed the path described here (viewtopic.php?t=7626) to setup a Document Type for Z80 assembler.
That was helpful, however I could not figure out how to get the lookup to work, to make the editor jump to a label which might be defined in the current file, or in a different file which is sourced (included) by the current file.

I have provided a simple example: suppose we have two files, in FineA.asm there is the definition of a label called "ClearBlock", that file may or may not be opened right now. FileB.asm is opened in the Zeus editor, I'm at the statement "call ClearBlock" with the cursor and want the editor to open FileA.asm and to jump to the ClearBlock label.

What do I have to do to make Zeus do that navigation?
Example:

FileA.asm ...

ClearBlock: ; That's the label I want to navigate to
ld d,h
ld e,l
inc de
ldir
ret


FileB.asm ...

include "FileA.asm" ;this tells the assembler to read FileA.asm at this point, all label in this file can be accessed from code.

MainCode:
call ClearBlock ; This is where the cursor is currently sitting in the editor, I want to navigate to ClearBlock from here in FileA.asm
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Setup Z80 language

Post by jussij »

The following new post describes how to do this Z80 setup: viewtopic.php?f=5&t=8216

With those changes in place you will be able to navigate your source code using the options found on the Tags menu.

Cheers Jussi
chronbeng
Posts: 2
Joined: Thu Apr 21, 2022 9:05 pm

Re: Setup Z80 language

Post by chronbeng »

Thank you Jussi, that worked!

However, a few issues I don't understand how to fix: the macro lookup does not work, and "inc" and "pop" are showing up as macros:
I did everything as described, the label's "ClearScreen, ProgramOrg, repeat" appear in the Packages section, which is as expected I think, however in the Macros section we have "inc, pop" and all the constants, but not the Copy1 macro.

I have attached a screenshot that shows how it looks like and the example asm file.

Would be cool if you have a solution for that.
Thank you

PS: please don't wonder that I'm using the ampersand to prefix hex numbers
Attachments
Test01.zip
(346 Bytes) Downloaded 551 times
Zeus.png
Zeus.png (49.13 KiB) Viewed 13537 times
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Setup Z80 language

Post by jussij »

Looking into this there are at least two issues at play:

1. The default ctags automatically parse ASM files and this is why many of these additional tags are being created.
2. The .ctags details used were copied from the web and they don't appear to be well defined. The new .ctags details shown below work much better and this definition also fixes the first issue as it disable the built in ASM parsing.

Here are the new .ctags settings:

Code: Select all

--langdef=z80
--langmap=z80:.asm
--languages=-Asm
--regex-z80=/^([a-zA-Z]+[a-zA-Z0-9_]*):/\1/r,label/
--regex-z80=/^macro[ ]+([a-zA-Z]+[a-zA-Z0-9_]*)/\1/m,macro/
--regex-z80=/^([a-zA-Z]+[a-zA-Z0-9_]*)[ ]+equ[ ]+/\1/v,variable/
With these setting in place these are the results produced:
zeus-asm.png
zeus-asm.png (251.2 KiB) Viewed 13505 times
NOTE: To have those labels show up as functions use this .ctags configuration instead:

Code: Select all

--langdef=z80
--langmap=z80:.asm
--languages=-Asm
--regex-z80=/^([a-zA-Z]+[a-zA-Z0-9_]*):/\1/f,function/
--regex-z80=/^macro[ ]+([a-zA-Z]+[a-zA-Z0-9_]*)/\1/m,macro/
--regex-z80=/^([a-zA-Z]+[a-zA-Z0-9_]*)[ ]+equ[ ]+/\1/v,variable/
That will then create the following tag information:
zeus-asm1.png
zeus-asm1.png (220.53 KiB) Viewed 13504 times
Cheers Jussi
Post Reply