Skip to main content
Visitor II
April 16, 2007
Question

Send text (addresing problem assembler)

  • April 16, 2007
  • 3 replies
  • 675 views
Posted on April 16, 2007 at 11:09

Send text (addresing problem assembler)

    This topic has been closed for replies.

    3 replies

    brian4Author
    Visitor II
    April 16, 2007
    Posted on April 16, 2007 at 09:14

    Hi all

    Having a bad day, simple problem but I just cant figure out the syntax

    I have some text messages I am sending out on a pin, I now have the TX pin routine working.

    In Assembler I want to write a routine to send each string. The strings are stored as Mess01, 02 etc.

    I assume I use A,([ptr.w],X) to read the string in where X = Character position

    In ROM segment I have

    .Mess01

    STRING ''Power On Reset''

    DC.B $0D

    .Mess02

    STRING ''Test In Progress''

    DC.B $0D

    My simple question is how do I read the location (16 bit) of Mess01 or 02 etc and save that in ptr.w location

    Not done much with index addressing before.

    Re Brian

    Visitor II
    April 16, 2007
    Posted on April 16, 2007 at 10:56

    Hi Brian,

    it seems not to exist a fixed rule. The code to use depends on your compiler.

    The original ST asm7 works with the code (not tested!)

    ---------------------

    LD A,#Mess01.l

    LD {ptr+1},A ; curly brackets!!

    LD A,#Mess01.h

    LD ptr,A

    ---------------------

    while my compiler needs the syntax

    ---------------------

    LD A,#LOW(Mess01)

    LD ptr:1,A

    LD A,#HIGH(Mess01)

    LD ptr,A

    ---------------------

    Regards

    WoRo

    brian4Author
    Visitor II
    April 16, 2007
    Posted on April 16, 2007 at 11:09

    Thanks for that

    Just found the .h & .l in a Link USER manual PDF and I have just typed the same as you suggested, all works ok.

    One other slight funny

    In my data.asm file I have defineed

    ptr.w 1

    However if in my data.inc file I state EXTERN ptr.w I get and error?

    Error 54: Can't match Addressing mode ' ld A,([ptr.w],X)

    but if I state EXTERN ptr.b I get no errors and all works.

    Re Brian