Today, I wrote a small tool to make your eZ80 programs prettier entirely in the broswer!
It...

  • adjusts your indentation so it stays with the stack which I take is good practice?, assuming you are using push/pop. (I'm not sure if I can check other methods, like directly manipulating the stack pointer, without a bunch of extra code)
  • formats your comments to increase readability.
  • is entirely customizable, so if you don't like something you can fork the project and change it.
  • probably won't mess with the functional aspects of your code. (if it does, file a bug report/post in the thread)
  • tells you approximately how many changes were made (I like stats)
  • probably will have more things going for it in the future

It's probably useless with good programming practices.
I wrote it as a tool so I could make my code nicer-looking without too much effort. Naturally, it took more effort to write than I would ever spend prettifying my programs I'm not at the point where I'm writing "smart-person" assembly yet, but I figure I'll get there soon enough. If you put any code in and it comes out functionally different/breaks, please create a bug, giving me the relevant code before/after prettification. I understand that different compilers have different directives/formatting requirements and stuff, so I might have to provide different options for different compilers. I also understand that this is probably useless with good programming practices.

The default settings used are simply my personal preferences (i.e. use 2 spaces instead of a tab, 2 more spaces before a comment, etc), but (as I said above) this is all changeable, you can find documentation on the individual options here. It was designed and written for myself, but if there's something you don't like, you can change it. If there's something that I'm missing that you think should be added as a default option, please tell me about it!

Check it out here!

To-Do:

  • Allow comments in the inputted code to disable formatting for sections/lines/blocks of code.
  • More customization features.
  • Even more customization features.
  • Document the features I added.
  • Improve the website (allow customizing features in the browser, so you don't have to fork or open the JS console)
Can't test it, but seems like something i will find useful when I start writing asm again Wink
My suggestion would be to identify and auto-indent loops and branches. It may be difficult to identify all cases, but for example, any instruction that sets a flag followed by a 'jr' or 'jp' instruction that tests for a flag and jumps backwards is generally the end of a loop block. Similarly if it jumps forward, its likely an "if" block. However I feel like even your current, "simple", auto-indenter may cause problems for "weirdly" structured code.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement