Shop OBEX P1 Docs P2 Docs Learn Events
SX Code Space and Pages — Parallax Forums

SX Code Space and Pages

MM Posts: 3
edited 2009-05-08 19:32 in General Discussion
Hello,

I have not been programming the the SX for very long. I have hit a small
snag in my current project and I thought maybe someone here had encountered
this sort of thing before. I understand that the SX Microcontroller has a page size
so that code must be split up in 512 word sections. Further more the PBASIC language
seems to handle this automatically and that when programming in assembly the
responsibility lies on the programmer. My issue is that my code is primarily in PBASIC,
but I am using Assembly at the bottom of the file in several subfunctions. I have a senario
now that when I add more lines to my code in the top part of the file it starts screwing
with the assembly in the subfunctions. I read in the documentation that the jmp instructions
are effected and can lead to erratic behavior. If anyone has encountered this before please
let me know how you solved the problem.

Thanks,

Miles

Comments

  • ZootZoot Posts: 2,227
    edited 2009-05-08 06:01
    You can:

    - use @ with all jumps in assembly. This forces the page and the jump to be set. E.g.:

    JMP @label
    JNZ @label
    JC @label
    'etc
    
    



    - use an ORG (address) statement to ensure that all ASM in a routine is in one page w/o crossing page boundaries:

    \ORG $600
    ' all statements after above will be at address $600 and higher
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • MM Posts: 3
    edited 2009-05-08 16:34
    For future reference. Is there a way to see when your code is reaching the edge of a page?
  • ZootZoot Posts: 2,227
    edited 2009-05-08 19:11
    Yes, when ready to compile, instead of "compile" choose "view list" -- this compiles the program and generates a list which has hex address numbers for the whole program, actual compiled and assembled code, and Bean's utterly cool RAM map at the end.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • MM Posts: 3
    edited 2009-05-08 19:32
    Thanks Zoot.

    You have really helped me get a grasp on this thing.
Sign In or Register to comment.