Shop OBEX P1 Docs P2 Docs Learn Events
Single character constants — Parallax Forums

Single character constants

David BetzDavid Betz Posts: 14,516
edited 2013-03-18 15:07 in Propeller 1
Is there a way to use single character constants in GAS? I think they are normally indicated by single quotes but we've repurposed those to introduce comments. Is there an alternate way to do character constants? I want to do something like this:
hello  byte	'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!', 15, 12, 0

Comments

  • ersmithersmith Posts: 6,092
    edited 2013-03-18 05:32
    David Betz wrote: »
    Is there a way to use single character constants in GAS? I think they are normally indicated by single quotes but we've repurposed those to introduce comments. Is there an alternate way to do character constants? I want to do something like this:
    hello  byte    'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!', 15, 12, 0
    

    No, unfortunately there's no way to do single character constants in GAS. What you wanted though could be accomplished by something like:
    hello ascii "Hello, World!"
            byte 15, 12, 0
    
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-18 06:33
    ersmith wrote: »
    No, unfortunately there's no way to do single character constants in GAS. What you wanted though could be accomplished by something like:
    hello ascii "Hello, World!"
            byte 15, 12, 0
    
    Okay, thanks! That is what I was after.
  • jac_goudsmitjac_goudsmit Posts: 418
    edited 2013-03-18 07:09
    ersmith wrote: »
    No, unfortunately there's no way to do single character constants in GAS. What you wanted though could be accomplished by something like:
    hello ascii "Hello, World!"
            byte 15, 12, 0
    

    Would something like
    hello byte "H","e","l","l","o"
      ' etc...
      byte 0
    

    also work?

    ===Jac
  • ersmithersmith Posts: 6,092
    edited 2013-03-18 15:07
    Would something like
    hello byte "H","e","l","l","o"
      ' etc...
      byte 0
    

    also work?

    No.

    The single character version David originally posted would be the normal way to do this, but as he mentioned the single quote is co-opted for comments.

    Perhaps we should revert GAS to using semicolon for comments, but that opens up a whole other can of worms regarding PASM compatibility, so perhaps not.

    Eric
Sign In or Register to comment.