artrag Posted August 4, 2020 Share Posted August 4, 2020 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.... 5 Quote Link to comment Share on other sites More sharing options...
Tursi Posted August 4, 2020 Share Posted August 4, 2020 It seems to have a lot of trouble understanding the output of SDCC, sadly. I wasn't able to get very far. ? Quote Link to comment Share on other sites More sharing options...
artrag Posted August 4, 2020 Author Share Posted August 4, 2020 Probably you can provide the sdcc ASM samples to the author who is actively developing it Quote Link to comment Share on other sites More sharing options...
Tursi Posted August 4, 2020 Share Posted August 4, 2020 (edited) I suppose it can't hurt to ask. (edit: issue filed here: https://github.com/santiontanon/mdlz80optimizer/issues/10) Edited August 4, 2020 by Tursi 1 Quote Link to comment Share on other sites More sharing options...
artrag Posted August 8, 2020 Author Share Posted August 8, 2020 The optimiser is growing fine with lots of new features and SDCC support is on the way 2 Quote Link to comment Share on other sites More sharing options...
artrag Posted August 10, 2020 Author Share Posted August 10, 2020 Tniasm support added 1 Quote Link to comment Share on other sites More sharing options...
cdoty Posted August 17, 2020 Share Posted August 17, 2020 (edited) 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 August 17, 2020 by cdoty Quote Link to comment Share on other sites More sharing options...
santiontanon Posted March 9, 2021 Share Posted March 9, 2021 (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 March 9, 2021 by santiontanon 4 Quote Link to comment Share on other sites More sharing options...
jltursan Posted March 12, 2021 Share Posted March 12, 2021 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 ? Quote Link to comment Share on other sites More sharing options...
santiontanon Posted March 12, 2021 Share Posted March 12, 2021 Thanks jltursan!!! Very happy to know MDL is useful Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.