@ or \ addressing - which to use?

2»

Comments

  • Peter JakackiPeter Jakacki Posts: 7,868
    edited May 17 Vote Up0Vote Down
    @cgracey - the problem we have is that TAQOZ relocates to first 64k but while in TAQOZ a ^D only ends up using a relative jump to Cluso's debugger (can we refer to it simply as LSD ) but we were modifying the version of LSD in ROM so nothing happened. Looking at the machine code showed that the jump was relative but we had mistakenly thought that the @ would give us an absolute address but now we know it always refers to the hub address and we need to use \ to force absolute address or \@ for both. But we don't have an operator symbol to force relative although by default it looks like it does this.

    In some other assembly languages the # forces absolute mode and @ relative but the Prop has register addressing by default so the # is used to force a jump to immediate address which means we can't use this symbol for absolute vs relative.

    Maybe we could use:
    @ Force absolute hub address
    \ Use absolute address (cog or hub)
    ~ Try to use relative address but issue warning if out of range.


    @Dave Hein - Is p2asm something I can run on my system as I like having a real listing? Is there source available that we can enhance?


    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    P2 SHORTFORM DATASHEET +++++ TAQOZ documentation
    Brisbane, Australia
  • p2asm is part of the p2gcc toolset. It is available from GitHub at https://github.com/davehein/p2gcc . p2asm is located in the p2asm_src subdirectory. You can also get the latest release from the Can't Wait for PropGCC on the P2? thread.
  • Peter JakackiPeter Jakacki Posts: 7,868
    edited May 18 Vote Up0Vote Down
    Dave Hein wrote: »
    p2asm is part of the p2gcc toolset. It is available from GitHub at https://github.com/davehein/p2gcc . p2asm is located in the p2asm_src subdirectory. You can also get the latest release from the Can't Wait for PropGCC on the P2? thread.

    Thanks David, that was as easy as pie. I assembled a simple spin2 file but my ROM code doesn't. Guess I need to RTM ;)
    peter:BOOT$ ./p2asm ROM_137PBJ.spin2
    ERROR: Expected ",", but found "["
    Segmentation fault
    

    It might be because I am addressing 1MB of memory with the ROM at $FC000......

    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    P2 SHORTFORM DATASHEET +++++ TAQOZ documentation
    Brisbane, Australia
  • I just want to point out that we've had roughly the same conversation several times over the last year or two. I think it's an indication that the current syntax is confusing and hard to remember. Is there an alternative syntax we could use that's more understandable, even if it isn't as terse?
  • Seairth wrote: »
    I just want to point out that we've had roughly the same conversation several times over the last year or two. I think it's an indication that the current syntax is confusing and hard to remember. Is there an alternative syntax we could use that's more understandable, even if it isn't as terse?

    I don't know. I think the set of cases that Cluso put up and the revamping I made to it spells it out pretty well. There are just a few concepts to grasp. The complexity stems from the difference between cog and hub ram and their address spaces.
  • cgraceycgracey Posts: 10,549
    edited May 18 Vote Up0Vote Down
    @cgracey - the problem we have is that TAQOZ relocates to first 64k but while in TAQOZ a ^D only ends up using a relative jump to Cluso's debugger (can we refer to it simply as LSD ) but we were modifying the version of LSD in ROM so nothing happened. Looking at the machine code showed that the jump was relative but we had mistakenly thought that the @ would give us an absolute address but now we know it always refers to the hub address and we need to use \ to force absolute address or \@ for both. But we don't have an operator symbol to force relative although by default it looks like it does this.

    In some other assembly languages the # forces absolute mode and @ relative but the Prop has register addressing by default so the # is used to force a jump to immediate address which means we can't use this symbol for absolute vs relative.

    Maybe we could use:
    @ Force absolute hub address
    \ Use absolute address (cog or hub)
    ~ Try to use relative address but issue warning if out of range.


    @Dave Hein - Is p2asm something I can run on my system as I like having a real listing? Is there source available that we can enhance?

    Maybe there is a better way.

    Relative is what you'd want in most cases, but sometimes you need absolute addressing, in both intra-cog and intra-hub code.

    We've though about stripping the '#' from immediate addresses, but it causes other subtle confusion. I'd like '@' for relative, in place of '#', but '@' is our address-of operator in Spin.
  • how about just doing it with keywords in PASM

    keep it simple and readable.

    JMPA jumps absolute
    JMPR jumps relative

    and if JMPR is not possible because of crossing boundaries the compiler uses absolute and gives a warning/error?

    DJNZA /DJNZR does not look bad either.

    but DJNZ #\@.loop

    looks more like if someone is swearing in a comic book

    Mike
    I am just another Code Monkey.
    A determined coder can write COBOL programs in any language. -- Author unknown.
    Press any key to continue, any other key to quit

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this post are to be interpreted as described in RFC 2119.
  • Peter JakackiPeter Jakacki Posts: 7,868
    edited May 18 Vote Up0Vote Down
    <moved to a new thread>

    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    P2 SHORTFORM DATASHEET +++++ TAQOZ documentation
    Brisbane, Australia
  • evanhevanh Posts: 5,913
    edited December 6 Vote Up0Vote Down
    Just found this old topic. I thought it worth highlighting the latest findings: There is a bug in Pnut's LOC instruction encoding of relative hub addresses below absolute $400 for a LOC in cogRAM. See https://forums.parallax.com/discussion/comment/1457026/#Comment_1457026

    EDIT: Removed a totally wrong understanding.

    Money is a placeholder for cooperation
Sign In or Register to comment.