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 - z80 eclipse IDE initial release

Reply to topic
Author Message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
z80 eclipse IDE initial release
Post Posted: Thu May 07, 2015 1:39 pm
Hi Guys,

I've finally gotten this project to a state where I'd like to share it.

Some features of the editor

  • code complete for labels/defines
  • z80 instruction reference info shown when hovering mouse over commands.
  • as you type syntax validation
  • syntax highlighting
  • code folding
  • jump to label/define definition
  • label quick reference outline view
  • plus lots of other standard eclipse IDE functions. :)


You can find the source on github here

https://github.com/yuv422/z80editor

I've also got pre-build binaries.

For those of you that haven't used the Eclipse IDE before I've put together a little step by step guide to installing my Z80 editor plugin.

Here goes.

  1. Download eclipse Luna (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 xtext site.
    name: xtext
    Location: http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/

  5. Wait for it to load the file versions
  6. Click the Add... button again.
  7. Add the z80editor site
    name: z80editor
    location: https://dl.bintray.com/yuv422/EclipseZ80Editor

  8. wait for the version info to show up.
  9. select the Z80 WLA-DX IDE version (1.0.4)
  10. click next->
  11. Follow the prompts until eclipse restarts.

  12. You can now create a new general project.
  13. Add a new file with the extension ".z80asm"
  14. Eclipse will ask you "Do you want to add the Xtext nature to the project?" Click Yes
  15. You should now be able to add z80 commands into your new file.



Any feedback you can give would be greatly appreciated.
install_1.png (133.65 KB)
install_1.png
install_2.png (74.16 KB)
install_2.png
install_3.png (110.79 KB)
install_3.png
install_4.png (78.73 KB)
install_4.png

  View user's profile Send private message
  • Joined: 14 Apr 2013
  • Posts: 624
Reply with quote
Post Posted: Thu May 07, 2015 2:07 pm
You can leave the name fields of the Add Site dialog (steps 4 and 7) blank. It will fill them in automatically then. :)
  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: Thu May 07, 2015 10:57 pm
Calindro wrote
You can leave the name fields of the Add Site dialog (steps 4 and 7) blank. It will fill them in automatically then. :)


Hi Calindro,
Good point. I forgot that you could do that. :)
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3827
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri May 08, 2015 9:03 am
I still have to try this, but I was wondering if you really had to use ".z80asm" extension. Is it compulsory?
I'm using '.asm' and '.inc' atm...
  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: Fri May 08, 2015 12:01 pm
sverx wrote
I still have to try this, but I was wondering if you really had to use ".z80asm" extension. Is it compulsory?
I'm using '.asm' and '.inc' atm...


Hi sverx,

At the moment yes it's best if all your files use the .z80asm extension. I am working on adding proper support for ".asm" and ".inc" extensions.

You can manually assign inc and asm files types to the Z80 Editor and they work now but the cross references of labels and defines doesn't work correctly between the different extensions at the moment.

Hopefully I'll have these issues ironed out soon and you'll be able to intermix all three file types in your project.
  View user's profile Send private message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Fri May 08, 2015 12:04 pm
I also need to add support for local label scoping in sections with the use of an underscore as the first character of a label name.
  View user's profile Send private message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Sat May 09, 2015 4:18 am
sverx wrote
I still have to try this, but I was wondering if you really had to use ".z80asm" extension. Is it compulsory?
I'm using '.asm' and '.inc' atm...


Ok, I've fixed the issues with multiple file extensions. So you should be able to use ".z80asm", ".asm" or ".inc" files in your projects.

I've updated the release to 1.0.5
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14744
  • Location: London
Reply with quote
Post Posted: Mon Jun 01, 2015 3:09 pm
I'm experimenting with this... I pointed it at some existing code (my Picross clone) and it falls down here:

.struct Tiles
...
.endst

...saying "no viable alternative at character 't'". It highlights ".endst" correctly but doesn't pick up ".struct". The outline stops there too. It also stops on .macro, .if, and a bunch more directives.

I can't seem to fold any code either.
  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 Jun 02, 2015 1:37 pm
Maxim wrote
I'm experimenting with this... I pointed it at some existing code (my Picross clone) and it falls down here:

.struct Tiles
...
.endst

...saying "no viable alternative at character 't'". It highlights ".endst" correctly but doesn't pick up ".struct". The outline stops there too. It also stops on .macro, .if, and a bunch more directives.

I can't seem to fold any code either.


Hi maxim,

I've only really tested it with my own code which doesn't use many of the wla-dx directives. :( I hadn't included support for struct

I've just added support for a bunch more directives including struct

.struct, .enum, .repeat, .def, .redefine, .redef and .if

wla-dx sure does support a lot of directives. :) I'm not too sure how I'll handle the substitution commands (\1 \2 \@ \! etc) in the macro directive. Do you use them in your code?


I've committed it into github but I haven't made a new release build yet.

Code folding should work for sections.

You can see the wla-dx language grammar that I've created in this file here.

https://github.com/yuv422/z80editor/blob/master/org.efry.z80editor/src/org/efry/...
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14744
  • Location: London
Reply with quote
Post Posted: Tue Jun 02, 2015 2:13 pm
I'd found that, I'm not super comfortable with the grammar (I'm not a real computer scientist, I fear) but it seems like something I could hack on. Could you give some pointers on how I might work on it inside Eclipse?

I suspect WLA DX suffers from an ill-defined grammar, thanks to its somewhat simplistic parser. It might be challenging to support all of its oddities...

I do use \1 etc because named macro arguments are quite buggy...
  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: Wed Jun 03, 2015 11:24 am
Maxim wrote
I'd found that, I'm not super comfortable with the grammar (I'm not a real computer scientist, I fear) but it seems like something I could hack on. Could you give some pointers on how I might work on it inside Eclipse?

I suspect WLA DX suffers from an ill-defined grammar, thanks to its somewhat simplistic parser. It might be challenging to support all of its oddities...

I do use \1 etc because named macro arguments are quite buggy...


Yeah I was looking at some of the syntax and wondering how that would work in a formal grammar. :(

If you'd like to play around with the grammar, I'd suggest following the instructions laid out in the 5 minute tutorial on the XText webite.

https://www.eclipse.org/Xtext/documentation/101_five_minutes.html

Just skip the initial project creation step and instead import the 4 z80editor projects.

Just be aware that you may have to increase the memory arguments given to the eclipse application when you run it. Otherwise it might start acting strangely.

I increased my maxPermSize setting to 256m

-XX:MaxPermSize=256m
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14744
  • Location: London
Reply with quote
Post Posted: Thu Jun 04, 2015 7:04 pm
I'm finding it locking up at 100% CPU for long periods. I'm looking at large disassemblies that are failing the grammar, if that's relevant. Sometimes it just locks up when I switch to its window, not even typing anything...
  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: Sat Jun 06, 2015 12:10 pm
Maxim wrote
I'm finding it locking up at 100% CPU for long periods. I'm looking at large disassemblies that are failing the grammar, if that's relevant. Sometimes it just locks up when I switch to its window, not even typing anything...


I think that might be caused by a lack of memory on the eclipse application when you're running it.

You can increase the available memory to the Eclipse Application by changing the VM arguments from the run configurations menu.

Right-click the project and select the "Run As" menu and the "Run Configurations..." submenu
Then select Eclipse Application and the "Arguments" tab.

There will be a section for VM arguments.

-Xmx is the max memory available
and -XX:MaxPermSize is the memory set aside for permanent objects.

Maybe try this?
-XX:MaxPermSize=512m -Xmx1024m
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14744
  • Location: London
Reply with quote
Post Posted: Mon Jun 08, 2015 6:55 pm
I bumped Eclipse to 512MB perm and 2GB max, and it's still locking up, using about 1GB RAM and one core. I'm not a big fan of Eclipse or Java and this is not helping :) I'd love to have modern tools with code completion, validation as I type, hints, even a little refactoring support, but the resource usage and performance have to be a bit better :( I'm hoping it will be better when it has fewer unsupported syntax errors...
  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: Mon Jun 29, 2015 11:10 am
Maxim wrote
I bumped Eclipse to 512MB perm and 2GB max, and it's still locking up, using about 1GB RAM and one core. I'm not a big fan of Eclipse or Java and this is not helping :) I'd love to have modern tools with code completion, validation as I type, hints, even a little refactoring support, but the resource usage and performance have to be a bit better :( I'm hoping it will be better when it has fewer unsupported syntax errors...


Yeah it really is chalk and cheese, java and sms z80. :)

Are you able to share your sample file? Maybe I can help with implementing the unsupported syntax and improving editor performance.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14744
  • Location: London
Reply with quote
Post Posted: Mon Jun 29, 2015 7:27 pm
My large file was an Emulicious disassembly, you can make many yourself.
  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 Jul 07, 2015 11:50 am
I've just tried loading up a disassembly created with Emulicious. You're right it really slow and is quite unusable. :( I have been able to remove all the syntax errors though. It is still slow even on a clean file.

I don't think XText likes parsing the 21,400+ lines of asm. :(

I'll have a look to see if there is anything I can do to speed things up.

I wonder how many homebrew projects would ever have that much in one file?
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14744
  • Location: London
Reply with quote
Post Posted: Tue Jul 07, 2015 4:07 pm
Last edited by Maxim on Wed Jul 08, 2015 6:16 pm; edited 1 time in total
Well, disassembly projects are not unheard of. Maybe we need disassemblers to split to more files.

I'll try it on some handwritten code and get back to you...
  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: Wed Jul 08, 2015 12:16 pm
I think the slowness might actually be due to the number of cross references in the file.

It seems to be spending most of the time in the following method.

EcoreUtil2.resolveLazyCrossReferences(resource, cancelIndicator);
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14744
  • Location: London
Reply with quote
Post Posted: Wed Jul 08, 2015 6:17 pm
One thing I tried was renaming a label, which was hugely slow, while a textual search and replace was fast. That sounds like the same issue, I guess.
  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!