Jump to content

Recommended Posts

To everyone who codes with z80 assembly I would like to point to this incredible project 

 

https://github.com/santiontanon/mdlz80optimizer

The java program above analyze your z80 sources suggesting improvements able to save bytes and/or cycles 

It supports many assemblers natively and it is able to recognize hundreds of patterns to optimize....

 

  • Like 5

Share this post


Link to post
Share on other sites

It seems to have a lot of trouble understanding the output of SDCC, sadly. I wasn't able to get very far. 😕

 

Share this post


Link to post
Share on other sites

This seems to be the 0.45 version of tniasm. It chokes on the v1.0 directives.

 

I did find several situations where it's generating an optimization suggestion that is technically correct, but risky.

 

It will suggest replacing a call followed by a ret with a jp/jr.

Edited by cdoty

Share this post


Link to post
Share on other sites
Posted (edited)

Thanks artrag for mentioning my optimizer here!! And apologies for jumping (very) late to the discussion :)

 

I have been working on lots of improvements to the optimizer for the past few months (latest version here: https://github.com/santiontanon/mdlz80optimizer/releases/tag/v1.7 ), and it should be much more robust now. As for support for tniasm (and other assemblers), I'd love to improve support for tniasm! What I have done is to look for open source projects using the different assemblers, and use them as test cases. So, for tniasm, I have these two: Zombie Near and z80rogue. Given that implementing all the directives of a given assembler is a mountain to climb (it's basically recreating the original assembler, but inside of MDL haha), what I do is to support only those directives that seem to be used in practice. So, pointers to source code using tniasm would be awesome, so I can add them to my test suite, and improve tniasm support :)

 

As for SDCC, I've been improving support for the sdasz80 assembler (used by SDCC), so, it should be much better now. In order to make sure mdl plays nice with SDCC, this is the way I recommend calling it: 

 

java -jar mdl.jar my-source-file.asm -dialect sdcc -ro-no-inliner -ro -po -asm-dialect my-optimized-source-file.asm

 

That will trigger the "reorganizer optimizer" (but deactivating the "inliner", which SDCC does not like), then the "pattern-based optimizer", and finally it will save the resulting optimized file mimicking the syntax of the selected dialect (in this case sdcc).

 

MDL is still evolving, so, there's probably lots of rough edges still. But any feedback/bug-report is welcome! :)

 

For anyone curious I recorded a video explaining how to use MDL (this was using version 1.4, but most things still apply to version 1.7): 

 

Edited by santiontanon
  • Like 4

Share this post


Link to post
Share on other sites

Glad to see your here!

 

mdlz80optimizer is evolving fast and right now I really think that it's an invaluable tool for Z80 programmers. Santi is giving a constant support and adding features as fast as he can, he just need the right feedback and help.

I've found that it's not only optimizing the code; but also giving me nice ideas and teaching me about how to get the most of the processor, it's indeed a funny experience 🙂

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...