Progress Report 8Date: 19-Jun-2020
Current Goal: Moving from Easy68K to VASM.
Complete: 100%.
It's been a long time since my last update. As usual I got distracted with other projects, then something caught my interest that made me think about my own disassembly and now I'm back to make as much progress as I can before I get distracted again.
As you may recall, the last big change I'd made development wise was to start coding exclusively in Visual Studio Code and use Easy68K only for assembling the code and building the final binary. This has worked well, I've made huge progress on the disassembly as a result and even managed to get the build process down to just a handful of keystrokes. However, it still wasn't quite slick enough. Building shouldn't take 3 applications to do it. It
shouldn't take a handful of keystrokes. It should be a
single keystroke and it should happen from within a
single application.
And so that is why I decided it was time to bite the bullet and change assembler, something that I knew was inevitable ever since the day I realised Easy68K doesn't have command line support. Thank you very much
Professor Kelly, for the great tool and all the support, but it is time we went our separate ways.
I think the thing that piqued my interest and got me back on the T&E track was the discovery of a new person (new to me at least!) supplying the world with high quality assembly knowledge:
ChibiAkumas on his YouTube Channel. And so it seemed only fitting to go with the assembler he uses for his 68K work (well, that and it is modern, well documented, well maintained and widely used): VASM.
VASM is a portable and retargetable assembler to create linkable objects in various formats or absolute code. I have no idea what that means, but what I do know is that
ChibiAkumas has a video explaining its setup in the first 5 minutes and also supplies a ready to rock download pack containing everything you need to get assembling
fast. I haven't exactly copied his set up but I've certainly lifted liberally from it!
And with VASM setup and working from the Windows command line it was time to set up Visual Studio Code to use it. This was done via a custom build task, allowing the press of CTRL+SHIFT+B to completely assemble and build the source from code to binary, at least it would if the damn thing would build!
Which is where the real fun began!
Turns out Easy68K and VASM aren't perfectly compatible (not huge surprise really). Here are the things I can remember I had to do to get the code reassembling and building once again:
- Make sure all PEA instructions have their opcode length set.
- Make sure all BRA (and related) instructions have their length set.
- Make sure no ORG statements overlap or are duplicated.
- Replace * as the comment marker with ;.
- Move the code that starts at $00000000 to be first in the Master file
And to be honest I think that's about it! It felt a lot more at the time but all in all it wasn't too bad, 4 days in total for the move. Getting the VSCode problemMatcher set up, which jumps you straight to the lines that are causing build problems, made a world of difference. The ORG statement overlaps were harder, as no indication is given as to which areas are overlapping and I have a lot of them spread out over many files. This wasn't an issue in Easy68K since it just overwrites sections that overlap, but VASM is stricter and refuses to generate a build until you sort them. A sure sign that we're working with grown up tools now! With a little Excel and Notepad++ wizardry I was able to set up a macro and spreadsheet that helped narrow it down and root out all the overlap and a lot of duplicate code in the process.
And that was it done! The disassembly once again builds into a bit perfect copy of the original ROM. And best of all, although the Easy68K code wouldn't build in VASM the VASM code will build in Easy68K, so although I don't plan to maintain compatibility going forward it is still nice to know that the first commit will still work with either set up.
Little bit more spit and polish and I'll be ready to commit that very first commit of the future!