Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Z80Editor v1.0.7

Reply to topic
Author Message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Z80Editor v1.0.7
Post Posted: Mon Oct 12, 2015 12:18 pm
Hi Guys,

I've released a new version of my Z80 eclipse IDE. v1.0.7

Some of the highlights


  • Macros. Including hover view, named and numeric arguments.
  • Structure cross references. From enums or directly as offsets
  • A new Z80 Info view that shows with cycle/size counts or Z80 instruction documentation as you type. :)
  • Hovering over a define will show it's value.
  • Lots of improvements to the grammar.


Installation notes.


  1. Download Eclipse Mars (The Eclipse IDE for Java developers version is fine) http://www.eclipse.org/downloads/
  2. In eclipse select menu item Help->Install New Software...
  3. Click the Add... button
  4. Add the z80editor site
    location: https://dl.bintray.com/yuv422/EclipseZ80Editor
  5. Select z80 editor
  6. Follow the prompts until eclipse restarts.

  7. You can now create a new general project.
  8. Add a new file with the extension ".asm"
  9. Eclipse will ask you "Do you want to add the Xtext nature to the project?" Click Yes
  10. You should now be able to add z80 commands into your new file.


The new Z80 instruction view can be opened from
Window->Show View->Other...->Other->Z80 Instruction View

Any feedback is greatly appreciated. :)

Eric
Z80Editor_1.0.7.png (489.53 KB)
Z80 Instruction info as you type
Z80Editor_1.0.7.png
Z80Editor_cycle_count.png (441.98 KB)
Z80 View showing cycle info.
Z80Editor_cycle_count.png
Z80Editor_define_hover.png (28 KB)
Hovering over a define label
Z80Editor_define_hover.png
Z80Editor_macro_hover.png (26.43 KB)
Hovering over a macro call
Z80Editor_macro_hover.png

  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14689
  • Location: London
Reply with quote
Post Posted: Mon Oct 12, 2015 7:20 pm
Always with the problems :) I'm using my Picross project, here's what fails:

- _sizeof_[struct name] isn't supported
- the "undocumented" registers ihx/ixl/iyh/iyl
- the ".incdir" directive
- jump targets _b and _f
- af' does't syntax highlight properly
- It doesn't like this:
Label: .incbin "filename"
...because it seems to assume that directives can't come on the same line as a label.

Some stuff fails because unused code (in discarded sections) has invalid references. I guess that will be hard to filter out, and in a real project you'd end up cleaning that away anyway.

I guess one interesting alternative (!) would be to continuously run the assembler and highlight the lines it errors on, although that would frequently produce a lot of noise.
  View user's profile Send private message Visit poster's website
  • Joined: 01 Jan 2014
  • Posts: 331
Reply with quote
Post Posted: Tue Oct 13, 2015 12:40 am
Thanks for updating, checking it out now.
  View user's profile Send private message
  • Joined: 01 Jan 2014
  • Posts: 331
Reply with quote
Post Posted: Tue Oct 13, 2015 1:32 am
It might be an idea to have an option letting the code fall through to the assembler even if there are syntax errors. I mean you can do this already just not within the IDE.

The update has already proven valuable to me. Picked up a bug of a bad label (+ instead of +:) and I got some cycle counting wrong which i now need to fix up.

Is compiling the project supported. Do we need to supply our own wlaz80? For me using the compile function does not compile?

Again thanks for the work. These types of tools are tedious to bring together.
  View user's profile Send private message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Tue Oct 13, 2015 11:23 am
Maxim wrote
Always with the problems :) I'm using my Picross project, here's what fails:

- _sizeof_[struct name] isn't supported
- the "undocumented" registers ihx/ixl/iyh/iyl
- the ".incdir" directive
- jump targets _b and _f
- af' does't syntax highlight properly
- It doesn't like this:
Label: .incbin "filename"
...because it seems to assume that directives can't come on the same line as a label.


I've committed a fix for the _sizeof_ define. It doesn't xref though. :(
I've also added the .incdir tag and support for the anonymous label jumps _b and _f

I'm not sure why the highlighter doesn't trigger on the af' It might not like the quote character. :(

I'll look at adding support for the undocumented registers soon.
I also need to restructure the grammar a bit to better handle labels on the same line as commands.

Maxim wrote

I guess one interesting alternative (!) would be to continuously run the assembler and highlight the lines it errors on, although that would frequently produce a lot of noise.


Yeah that sounds good but also a fair bit of work ;-)
  View user's profile Send private message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Tue Oct 13, 2015 11:30 am
psidum wrote

Is compiling the project supported. Do we need to supply our own wlaz80? For me using the compile function does not compile?


There isn't any native toolchain support for WLAZ80 at the moment. I just added an external build configuration which calls a script to build the project with WLA.

You can set that up by right clicking on your project and selecting preferences->Builders->New->Program.

I also setup a "Run external tool" to invoke the emulator and load the resulting .sms file.

I hope that helps. :)
  View user's profile Send private message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Thu Oct 15, 2015 12:18 pm
I've just added support for the "undocumented" registers ihx/ixl/iyh/iyl :)
It can now load the Picross source without parse errors :-) (After I stubbed in the missing labels/defines)

I'll fix the labels on the same line as commands issues then I'll cut another release.

Is there anything else people would like to see in the next release?
  View user's profile Send private message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Mon Oct 19, 2015 1:24 pm
Ok I've made another release. 1.0.8

This includes

  • Undocumented register support.
  • Better handling of labels. (unfortunately you still can't have a label on the same line as a macro call)
  • Array size is now shown in outline view
  • New memory chip icon for ramsections.
  • Enum address in outline view.
  • _sizeof_struct define
  • .incdir directive
  • anonymous labels _b, _f


Enjoy. :)
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14689
  • Location: London
Reply with quote
Post Posted: Mon Oct 19, 2015 5:27 pm
Just a few things from testing more old code...

1. It looks like WLA DX tolerates some invalid mnemonics, I had this:
in a,$dc
instead of
in a,($dc)
It might be good to support it, even if it is a bit dodgy. I fixed my code :) Also, the error message is a bit unhelpful ("no viable alternative at input 'a'").
2. Defined symbols in DB statements, specifically:
.define B $00
.define W $3f
.db B B B B W W W W W W B B W W B B
It seems to be interpreting B as a register here, which seems odd.
3. Directive .orga is missing
4. Extra arguments to .incbin are missing (skip, read)
5. I'm using StructName,StructField to obtain struct offsets, then using them with index registers, like this:
    inc (ix+TitleScreen.BlindsOffset)
and it doesn't work...
6. I'm abusing WLA DX's float support to write code like
ld a, 2.14*60
(becomes ld a, 128) to express certain things (here, 2.14 seconds). Your parser seems not to support floats in expressions.

It's still possible to trigger Eclipse to do things that kill it, I guess because it just starts maxing out the CPU on the UI thread. That's probably Eclipse's fault...
  View user's profile Send private message Visit poster's website
  • Joined: 01 Jan 2014
  • Posts: 331
Reply with quote
Post Posted: Mon Oct 19, 2015 10:04 pm
Maxim wrote

1. It looks like WLA DX tolerates some invalid mnemonics, I had this:
in a,$dc
instead of
in a,($dc)
It might be good to support it, even if it is a bit dodgy. I fixed my code :) Also, the error message is a bit unhelpful ("no viable alternative at input 'a'").


Wouldn't it better that it doesn't? Work towards z80 rather than WLA DX at least on op code validity.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14689
  • Location: London
Reply with quote
Post Posted: Mon Oct 19, 2015 10:34 pm
It depends whether the goal is to target WLA DX or just a certain subset of its functionality. I think a grammar can't support everything, as it's too complicated (have a look at what mod2psg2 does with labels and despair), but in terms of Z80 opcodes, why not support the dialect variations?
  View user's profile Send private message Visit poster's website
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Tue Oct 20, 2015 12:04 pm
Ok I've published another version. 1.0.9 :)


Maxim wrote
Just a few things from testing more old code...

1. It looks like WLA DX tolerates some invalid mnemonics, I had this:
in a,$dc
instead of
in a,($dc)
It might be good to support it, even if it is a bit dodgy. I fixed my code :) Also, the error message is a bit unhelpful ("no viable alternative at input 'a'").


Is that a popular convention? If so I guess we could support it. That error message comes straight out of xtext. I can change the message but I'd have to write a custom validator.

Maxim wrote

2. Defined symbols in DB statements, specifically:
.define B $00
.define W $3f
.db B B B B W W W W W W B B W W B B
It seems to be interpreting B as a register here, which seems odd.


This is the main problem with this parser. The lexer consumes all keyword tokens ahead of ID strings. This means that it is hard to implement labels that share their name with a keyword. Even if that keyword isn't allowed in the particular context. I'm yet to find a good way to handle this. And as the list of keywords grows clashes become more likely. :(

Getting the dot expression syntax to work was a real pain because the lexer would match against the keywords before the cross reference ID. eg
struct.obj
would fail because the lexer would consume '.o' trying to match .org for example. It would then bomb out because it doesn't backtrack. To get around that I broke all the dot tags up '.org' becomes
'.' 'org'
:(

Maxim wrote

3. Directive .orga is missing

4. Extra arguments to .incbin are missing (skip, read)


Fixed. :)


Maxim wrote

5. I'm using StructName,StructField to obtain struct offsets, then using them with index registers, like this:
    inc (ix+TitleScreen.BlindsOffset)
and it doesn't work...


This is actually failing because 'TitleScreen' is both a label and a struct name :( The parser finds the label first and errors because it isn't a struct ref.

Maxim wrote

6. I'm abusing WLA DX's float support to write code like
ld a, 2.14*60
(becomes ld a, 128) to express certain things (here, 2.14 seconds). Your parser seems not to support floats in expressions.


Fixed. :)


Maxim wrote

It's still possible to trigger Eclipse to do things that kill it, I guess because it just starts maxing out the CPU on the UI thread. That's probably Eclipse's fault...


Hmm, Do you have a repeatable example? I haven't observed it maxing out recently myself.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14689
  • Location: London
Reply with quote
Post Posted: Tue Oct 20, 2015 5:15 pm
I don't have it to hand but I think I was trying to do a column selection by keyboard (shift+alt+down in many editors) and that is mapped to something terrible in Eclipse :)

The in opcode without parentheses is not very common, I hadn't used it on purpose (if it compiles, it ships). The port number is kind of logically an indirection, but there's no meaning to the direct value so the parentheses don't add anything either. I can't think of a case where there's a Z80 opcode which can be valid, with different meanings, with and without them, but I don't think it would be a good idea to make them optional everywhere...
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Wed Oct 21, 2015 8:18 am
the quirk is that if you can write
IN A,(N)

as
IN A,N

then you should also be able to write
IN A,(C)

as
IN A,C

which is confusing, IMHO.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Jan 14, 2019 2:30 pm
mmm... does that still work with current Eclipse?

I just tried downloading Eclipse (3.8) on a Linux box, got your plug-in from https://dl.bintray.com/yuv422/EclipseZ80Editor and nothing appeared :|

Surely I have missed something...?

edit: that wasn't 'current Eclipse', it was just what's on Ubuntu repositories: Eclipse 3.8, which seems to be too old for xText to instal.
Trying with latest version, now...

edit2: OK, seems to work :) Will run a few tests...
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Wed Jan 16, 2019 12:57 pm
efry wrote
You can set that up by right clicking on your project and selecting preferences->Builders->New->Program.


I'm stuck here now. I created a new builder, and I can start that.
But sometimes ${resource_loc} value is the path to my project folder and sometimes it's the path to the .asm file I'm editing, and I don't get why.
Also, I'm not sure this ${resource_loc} is the correct variable...
(this Eclipse thing seems too much of a mess to me, but maybe it's just because I never used this IDE before)

edit: in general, a short tutorial on how to set up Eclipse to work with Z80Editor and WLA-DX would be very nice :) (also a note on how to launch the generated ROM on emulator(s) would be handy.)
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!