100% Machine Code

Back in the times when cassette inlay texts and cover artwork were doing a lot of the heavy lifting for what turned out to be a game written in BASIC, the above statement was used as an additional mark of quality – this game must be good as it’s written entirely in machine code. And as we all know, it’s impossible to write a bad game in machine code.

On Christmas Eve, I released version 1.00 of my esxDOS file browser. As the previous version was 0.24 there’s been a bit of a jump in the numbering but there is a reason for this.

Originally the browser was written using the z88dk C compiler. I write C/C++ code for a living so it was a good place to start, especially as my Z80 assembly was a bit lacking back in 2020. Over time, I swapped out bits of the C code for Z80 assembly equivalents where possible but the main part of the browser – the code that accesses the FAT16 / 32 file system – was still written in C.

This wasn’t terrible but there was an overhead in switching between the compiled C code and my hand written assembly. Assembly code can use the Z80 registers as it pleases, so the C compiler has to add some code around assembly functions to ensure everything is saved and restored correctly. After v0.24 was released, I decided to bite the bullet and rewrite this core code in assembly.

This took several months – breaking the code a number of times – but ended with an assembly code version of the FAT code. With this done, it wasn’t too much additional work to remove the final bits of C that were keeping things together and driving the main input loop of the browser. The browser was now fully written in assembly. As a kind of throwback to the 100% machine code boasts of the past, I decided to bump the version to 1.00.

Looking back, peak browse was reached in v0.15 at 12,908 bytes for the main BROWSE.BIN file. v0.24, the last of the C based browsers had gotten this down to 9194 bytes (over 3kb smaller) through a combination of partial assembly refactoring and moving functionality out into separate browser plugins. v1.00 got this down to 8039 – another 1kb shaved off.

As ever, v1.00 can be downloaded from here. The official support thread over at the Spectrum Computing forum can be used to report any issues, bugs or feature requests. Thanks to all those patient people who participated in testing and reporting bugs with the interim builds.

2 thoughts on “100% Machine Code”

  1. Hi Bob,

    I just recently purchased an Omni 128 HQ Laptop device, and I am using version 1.00 of your Long Name File Browser, which is absolutely amazing by the way.

    I am using it with esxDOS, and I think I may have stumbled across an issue with the speed dial/favorites.

    So, here goes…

    If I add a favorite from within the application, and the I try to overwrite it, it says that it has, but it hasn’t.

    I have examined the file, and can see that it still contains the old value.

    If I manually delete the original entry ad save the file, I can go back in and add the new entry with symbol shift zero, and then the number that I deleted.

    Have you any thoughts on this?

    Thanks again for an amazing program!

    Regards,

    Alan

    1. Hi Alan. Thanks for the kind words. I just tried this and it worked for me. I had speed dial 3 set to load Manic Miner, so I selected another game, Jet Set Willy, did Symbol Shift + 0 and assigned it to speed dial 3. I then got the confirmation message to overwrite it and I did with Shift + Y. Pressing Symbol Shift + 3 now loads Jet Set Willy. You do need to capital ‘Y’ to confirm as an extra security step rather than ‘y’ on it’s own.

      Just as an FYI for anyone else, I’m more likely to see bug reports on the LFN browser thread at the Spectrum Computing forum than I am here as I get very little real comment traffic. Most of it is Russian spam links so all comments have to be vetted by me before they appear on here.

Leave a Reply

Your email address will not be published. Required fields are marked *