2007-04-16 02:09 AM
Send text (addresing problem assembler)
2007-04-16 12:14 AM
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 Brian2007-04-16 01:56 AM
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 WoRo2007-04-16 02:09 AM
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