Kylearan Posted February 12, 2017 Share Posted February 12, 2017 How can you specify "align" with an offset in dasm? Take a skipDraw routine for example, where you have to make sure the graphics data starts at least n bytes after a page boundary. How can you do this in dasm without resorting to a hard-coded "org" address? Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted February 12, 2017 Share Posted February 12, 2017 I suspect your starting point will have a min and max number of bytes it could be from from the start of a page (max because you want to avoid a page boundary crossing). If so I'd use a couple IF statements, something like this (untested): MIN_OFFSET = 20 MAX_OFFSET = 256 - SIZE_OF_DATA ... ; make sure sprite data starts at correct location within page IF ( (* & $FF) > MAX_OFFSET) align 256 ENDIF IF ( (* & $FF) < MIN_OFFSET) ds (MIN_OFFSET - (* & $FF)) ENDIF ; sprite data FirstImage: .byte %11111111 ... LastImage: .byte %11111111 ... SIZE_OF_DATA = * - FirstImage The * is the current address, so (* & $FF) returns the current offset from the start of the current page. The order of the IF statements is important. 1 Quote Link to comment Share on other sites More sharing options...
Kylearan Posted February 13, 2017 Author Share Posted February 13, 2017 That looks like a very nice solution, thanks a lot! I think I'll put in a safeguard for SIZE_OF_DATA so that it throws an error if it gets too big and then make a macro out of it, and will be reconciled with dasm once again. 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.