jetsetdanny Posted July 16, 2023 Author Report Share Posted July 16, 2023 Thanks for all your comments 🙂 . Yes, the initial one-byte optimisation I came up with is at #904C, as described by Ian above. I have since rewritten this code completely, gaining a few bytes. The way Matthew set the attributes for Willy and the swordfish (starting at 9052) is unnecessarily complicated and takes more bytes than a simpler solution. He does this (as per SkoolKid's disassembly) like this: Yet it is easier and takes fewer bytes to just set the attributes by doing a series of instructions 21 LD HL,0000 and then 22 LD (0000),HL. Until now I would never have thought I would one day judge and criticise the code Matthew Smith wrote! It sounds like blasphemy and I'm all trembling as I write these words! 😉 But the truth is that by modifying this code I gained a few bytes, which allowed me to achieve what I was looking for 🙂 . Incidentally, this is for a project which is NOT my game, I'm merely adding some finishing touches to it. It's a fantastic game, and it should be released really soon, before the (European) summer is over... Before the release happens, though - or, to be precise, until the end of July - I will be extremely occupied with real-world matters and may not be able to post much here or react to posts I would otherwise like to react to. Please bear with me, I will be back in August 🙂 . IRF and Spider 2 Quote Link to comment Share on other sites More sharing options...
IRF Posted July 16, 2023 Report Share Posted July 16, 2023 (edited) There is another aspect of the code in that vicinity which is worthy of comment. The way that Matthew hid Willy's legs underneath the Swordfish (at #9071-#9076) is not ideal. He just changed the attributes to black-on-black, but that means that they reappear during the colour-cycling when the remaining air in The Final Barrier is counting down. It's better to wipe the pixels of his feet from the screen instead, which would take about 8 or 9 bytes to replace those at #9071-76 (so two or three more bytes are needed to achieve it): LD HL, #40F3 - point HL at the appropriate place in the pixel screen file [with Matthew's original code, HL will be pointing at #58F3 when flow of execution reaches #9071 so L already holds the correct value and therefore this command could be a LD H, #40 to save one byte. But Danny's more efficient method that he described in the post before this might mean that particular efficiency isn't available, and you might have to define both H and L] LD DE, #???? - point DE at somewhere in the code with 32 contiguous zero bytes CALL #8FF4 That also wipes the pixels from the character row below the one with Willy's 'ghost legs' (that part of the screen should be empty anyway so it's pointless-but-harmless). **** For two more bytes, you can only wipe one character row of pixels (the one with Willy's legs in it), meaning that you would only have to find 16 contiguous zero bytes to point DE at. To do that, replace the CALL #8FF4 with: LD B, #08 CALL #8FF6 - note the late entry point into the 'Draw a Sprite' routine, to ensure that only 1x2 character spaces are wiped, instead of 2x2 as usual Edited July 16, 2023 by IRF Spider 1 Quote Link to comment Share on other sites More sharing options...
jetsetdanny Posted August 5, 2023 Author Report Share Posted August 5, 2023 On 7/16/2023 at 9:51 AM, IRF said: There is another aspect of the code in that vicinity which is worthy of comment. The way that Matthew hid Willy's legs underneath the Swordfish (at #9071-#9076) is not ideal. He just changed the attributes to black-on-black, but that means that they reappear during the colour-cycling when the remaining air in The Final Barrier is counting down. Thanks for mentioning this, Ian! Due to the nature of the project I've mentioned, this is not a problem there... (and I won't say any more about it right now 😉).   On 7/16/2023 at 7:59 AM, jetsetdanny said: Incidentally, this is for a project which is NOT my game, I'm merely adding some finishing touches to it. It's a fantastic game, and it should be released really soon, before the (European) summer is over... Before the release happens, though - or, to be precise, until the end of July - I will be extremely occupied with real-world matters and may not be able to post much here or react to posts I would otherwise like to react to. Please bear with me, I will be back in August 🙂data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== . Well, I'm back 🙂 . I've just moved back to Warsaw, Poland from the United States (where I worked for the last five years) and I'm catching up with things that have been happening on the scene. I do hope I will have more time for JSW in the foreseeable future, and I definitely want to dedicate a significant portion of my spare time to it (various aspects of it: developing JSW Central, developing the JSW Central YouTube channel, assisting with other people's projects and ultimately resuming creation of my own games). Spider and IRF 2 Quote Link to comment Share on other sites More sharing options...
IRF Posted October 13, 2023 Report Share Posted October 13, 2023 (edited) Danny, I presume the project which gave rise to your request for coding advice here was Sendy's 'Manic Person'? Edited October 13, 2023 by IRF Quote Link to comment Share on other sites More sharing options...
jetsetdanny Posted October 13, 2023 Author Report Share Posted October 13, 2023 Yes 🙂 . Have you reached the last cavern yet and seen what I meant by "Due to the nature of the project I've mentioned, this is not a problem there..."  ? IRF and Spider 2 Quote Link to comment Share on other sites More sharing options...
IRF Posted October 13, 2023 Report Share Posted October 13, 2023 (edited) 9 minutes ago, jetsetdanny said: Yes 🙂 . Have you reached the last cavern yet and seen what I meant by "Due to the nature of the project I've mentioned, this is not a problem there..."  ? Yes. I did slightly resent the implication in the final message that I might have cheated in order to see it. (Even though I did! 🤣) Edited October 13, 2023 by IRF jetsetdanny and Spider 1 1 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.