How to express hi/lo byte of a label in crasm

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I am trying to move my project from xa (which I found rather buggy) to crasm, which is the other 6502 assembler that comes with debian.



My project contains a lot of lines like



ldx #<pname
ldy #>pname


where pname is a label where a string may be found. How is that done in crasm? I couldn't find any such thing as < and > in the man page.










share|improve this question

























    up vote
    1
    down vote

    favorite












    I am trying to move my project from xa (which I found rather buggy) to crasm, which is the other 6502 assembler that comes with debian.



    My project contains a lot of lines like



    ldx #<pname
    ldy #>pname


    where pname is a label where a string may be found. How is that done in crasm? I couldn't find any such thing as < and > in the man page.










    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am trying to move my project from xa (which I found rather buggy) to crasm, which is the other 6502 assembler that comes with debian.



      My project contains a lot of lines like



      ldx #<pname
      ldy #>pname


      where pname is a label where a string may be found. How is that done in crasm? I couldn't find any such thing as < and > in the man page.










      share|improve this question













      I am trying to move my project from xa (which I found rather buggy) to crasm, which is the other 6502 assembler that comes with debian.



      My project contains a lot of lines like



      ldx #<pname
      ldy #>pname


      where pname is a label where a string may be found. How is that done in crasm? I couldn't find any such thing as < and > in the man page.







      assembly 6502






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      Wilson

      9,703544118




      9,703544118




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          CRASM is .. well ... lets say frugal - and works more or less along a C like expression syntax. And as with C, there are no seperate operators for low/high byte of an address. So



          >label needs to become (label >> 8)



          while



          <label is to be changed to (label & $FF)



          (the last can, AFAIK, be obmitted - but keeping it makes it way more readable)






          share|improve this answer



























            up vote
            2
            down vote













            It doesn't appear that crasm has shorthand for getting the high and low byte of a value. You'll have to do it explicitly with the & and >> operators:



            High byte:



            ldx #pname>>8


            Low byte:



            ldx #pname&255





            share|improve this answer




















              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "648"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              noCode: true, onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f8197%2fhow-to-express-hi-lo-byte-of-a-label-in-crasm%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              2
              down vote













              CRASM is .. well ... lets say frugal - and works more or less along a C like expression syntax. And as with C, there are no seperate operators for low/high byte of an address. So



              >label needs to become (label >> 8)



              while



              <label is to be changed to (label & $FF)



              (the last can, AFAIK, be obmitted - but keeping it makes it way more readable)






              share|improve this answer
























                up vote
                2
                down vote













                CRASM is .. well ... lets say frugal - and works more or less along a C like expression syntax. And as with C, there are no seperate operators for low/high byte of an address. So



                >label needs to become (label >> 8)



                while



                <label is to be changed to (label & $FF)



                (the last can, AFAIK, be obmitted - but keeping it makes it way more readable)






                share|improve this answer






















                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  CRASM is .. well ... lets say frugal - and works more or less along a C like expression syntax. And as with C, there are no seperate operators for low/high byte of an address. So



                  >label needs to become (label >> 8)



                  while



                  <label is to be changed to (label & $FF)



                  (the last can, AFAIK, be obmitted - but keeping it makes it way more readable)






                  share|improve this answer












                  CRASM is .. well ... lets say frugal - and works more or less along a C like expression syntax. And as with C, there are no seperate operators for low/high byte of an address. So



                  >label needs to become (label >> 8)



                  while



                  <label is to be changed to (label & $FF)



                  (the last can, AFAIK, be obmitted - but keeping it makes it way more readable)







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  Raffzahn

                  40.8k594168




                  40.8k594168




















                      up vote
                      2
                      down vote













                      It doesn't appear that crasm has shorthand for getting the high and low byte of a value. You'll have to do it explicitly with the & and >> operators:



                      High byte:



                      ldx #pname>>8


                      Low byte:



                      ldx #pname&255





                      share|improve this answer
























                        up vote
                        2
                        down vote













                        It doesn't appear that crasm has shorthand for getting the high and low byte of a value. You'll have to do it explicitly with the & and >> operators:



                        High byte:



                        ldx #pname>>8


                        Low byte:



                        ldx #pname&255





                        share|improve this answer






















                          up vote
                          2
                          down vote










                          up vote
                          2
                          down vote









                          It doesn't appear that crasm has shorthand for getting the high and low byte of a value. You'll have to do it explicitly with the & and >> operators:



                          High byte:



                          ldx #pname>>8


                          Low byte:



                          ldx #pname&255





                          share|improve this answer












                          It doesn't appear that crasm has shorthand for getting the high and low byte of a value. You'll have to do it explicitly with the & and >> operators:



                          High byte:



                          ldx #pname>>8


                          Low byte:



                          ldx #pname&255






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 1 hour ago









                          George Phillips

                          3,4631421




                          3,4631421



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f8197%2fhow-to-express-hi-lo-byte-of-a-label-in-crasm%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              Long meetings (6-7 hours a day): Being “babysat” by supervisor

                              Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                              Confectionery