Menu

Define bytes

Help
2009-01-26
2013-05-30
  • Nobody/Anonymous

    I'm using a pic18f2620 with 64k flash and need to define a large space (32k or so) of characters containing literals. Couldn't find how to do it. It will be the asm equivalent of .DB
    or .DC
    Also, is there an equivalent of asm ORG directive ?

    TIA, Andrew.

     
    • Nobody/Anonymous

      I have found the solution for ORG by using:
         asm ORG  0x00

      Howewer, when i code:
         asm DATA  "foobar"

      the resulting asm file says:
         ; asm DATA  "foobar"
         ; string1;     
      and no code (data) is generated....
      any clue ?. thanks.

       
    • kent_twt4

      kent_twt4 - 2009-01-29

      Not very good with MPASM, that's why I like GCBasic!  GCBasic seems to hang on the DA and DATA commands.  In GCBasic you can set a constant to a string like:

      #define myString "hello world"
      dim myString as string

      GCBasic then creates a stringtable in program memory.

      Tried out your data blocks and this seemed to work:
      asm db 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x08, 0x09
      asm db 10, 11, 12, 13, 14, 15, 16, 17

      GCBasic chokes on hex with characters:
      asm db 0x0A ;Works
      asm db 0x0A,  0x0B ;Does not work & throws an illegal char code

      In GCBasic I would think that an array would work for fairly large data blocks, I forget the limit offhand.  In this case GCBasic will keep track of your data location for you.  Try messing with Org at your own peril.

      Dim myPattern(8)
      myPattern() = (0x01, 0x10, 0x20, 0x40, 0x60, 0x80, 0x08, 0x09)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.