Jump to content
IGNORED

Page Alignment question?


Sknarp

Recommended Posts

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 by Sknarp
Link to comment
Share on other sites

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.  

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

 

  • Like 3
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...