View Single Post
Old 18 May 2021, 13:19   #31
Daytona675x
Registered User
 
Daytona675x's Avatar
 
Join Date: Apr 2021
Location: Germany
Posts: 97
New wip video #15
https://www.youtube.com/playlist?lis...yr1OhOssiA0axW

That video is somewhat different as it shows how I just made optimizing the game much more comfortable.

GCC's inline assembly is quite some pita.
Every line has to be enclosed into "", every line has to be terminated with \n, register names like d1 become %/d1, parameters coming from C have to be listed in a fixed order and cannot be referenced by name but only by their position in that list.

Also, you have to track all your scratch registers by yourself and add those to the so called clobber list at the very end.
When using branches you have to add a b or a f to the target label to tell gcc that it has to branch Back or Forward

As you may imagine this quickly becomes a mess, especially if your parameter list changes because you add or remove something.
Because of that I spent the weekend to get into VSCode extensions because for this game project I'm using VSCode and the great
Amiga C/C++ plugin by Bartman^Abyss.

For stuff like the menus, most precalculations etc. you can easily get away with C++ most of the time.
But sometimes the not-so-brilliant GCC 68k code generator produces such sub-optimal code that asm is your only option if your targets are unaccelerated Amigas.

To work around the gcc inline asm hell I wrote a little extension which can convert GCC-style asm into something more readable, allows me to edit that and then converts it all back, while also adjusting all branches, parameter-references and the clobber list accordingly.
It integrates nicely into VSCode. I simply have to mark the asm code, hit ctrl+F1 to un-gcc it, do my changes, mark everything again and hit shift+ctrl+F1.

Cheers!
Daytona675x is offline  
 
Page generated in 0.04222 seconds with 11 queries