Sknarp Posted July 24, 2019 Share Posted July 24, 2019 (edited) Hello, so at the bottom of the kernel (HERE if you want to see what I'm talking about ) I've found only two ways of making sure it's aligned so that the positioning of objects doesn't get messed up, either Quote SLEEP 96 STA WSYNC which looks really inefficient, or this Quote align 256 which looks like a better implementation, but seems to waste 22 bytes compared to the other. I don't know which I'm "supposed" to use, but would like to save the bytes if possible. Is there another way of doing it that I'm missing? EDIT: I believe this achieves the same thing... could these bytes could be used for something? It still feels like a waste if the data isn't being used for something, but at least this doesn't sacrifice that extra 22 bytes of ROM space. Quote byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 Edited July 24, 2019 by Sknarp Quote Link to comment Share on other sites More sharing options...
Just Jeff Posted July 24, 2019 Share Posted July 24, 2019 Yes.. it wastes space, but don't worry about it at this point. Go ahead and use the align 256 while you are still writing since it automatically re-arranges code for you as you make changes. If you eventually run out of space, its fairly simple to remove the align 256 and re-arrange your code to put something on the page break that won't be affected by it- probably some graphics that aren't timed so tightly, or maybe a subroutine that gets called outside the kernel. 1 Quote Link to comment Share on other sites More sharing options...
Sknarp Posted July 24, 2019 Author Share Posted July 24, 2019 Thanks for the information, after some consideration I went with 14 hours ago, BNE Jeff said: .... remove the align 256 and re-arrange your code.... maybe a subroutine that gets called outside the kernel. And not only did I avoid sacrificing 22 bytes, I actually saved another 22 bytes! Very happy with the results. Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted July 25, 2019 Share Posted July 25, 2019 When you have code that *cannot* cross a page, use DASM macros to warn you when this happens. This way, you don't have to put in aligns in, but you always get a warning when you need to fiddle things so that the page crossing doesn't happen. Here's a sample... MAC CHECKPAGE IF >. != >{1} ECHO "" ECHO "ERROR: different pages! (", {1}, ",", ., ")" ECHO "" ERR ENDIF ENDM and usage... BLANKR .byte %00000000 .byte %00000000 .byte %11110000 .byte %00000000 .byte %11110000 .byte %00000000 .byte %11110000 CHECKPAGE BLANKR What that's doing is making sure that the code/data between the label and the CHECKPAGE label are on the same page. If they're not, you get an error/warning message in the DASM output, pretty much letting you know there's a problem there. It's very handy. 3 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.