Jump to content
IGNORED

align with offset in dasm


Kylearan

Recommended Posts

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.

  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...