Addressing arrays __asm lda array[1];

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Addressing arrays __asm lda array[1];

Jump to solution
3,386 Views
CarlFST60L_2nd
Contributor I
Should be a simple one ( i think)



static char Array[10];

void main(void){
__asm lda  Array[1];      //Cannot get this one line to work? error C18123
}



Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,471 Views
bigmac
Specialist III
Hello,
 
I am not sure of the device you are targeting - I assume it might be the HC(S)08.
 
Within your CW installation, there should be a manual for the compiler, e.g Compiler_HC08.pdf.  Within this manual there likely to be a section headed "High Level Inline Assembler".  Also may be of interest, within the section "ANSI-C Frontend", a sub-section headed "Defining C Macros containing HLI assembler code".
 
Regards,
Mac
 

View solution in original post

0 Kudos
Reply
4 Replies
1,471 Views
bigmac
Specialist III
Hello and welcome to the forum.
 
For inline assembly use the instruction should take the following form:
 
__asm lda  Array:1;
 
However, within a "normal" assembly program, the equivalent instruction would be -
 
  lda  Array+1
 
Regards,
Mac
 
0 Kudos
Reply
1,471 Views
CarlFST60L_2nd
Contributor I
Thanks, will try that. (I think i did try that, i tried many things, most obviously Array+1 with diffrent brackets).

Can I ask where specifically in the help files that was, or how it was interprated from the help files?




Message Edited by CarlFST60L_2nd on 2007-07-09 03:03 AM
0 Kudos
Reply
1,472 Views
bigmac
Specialist III
Hello,
 
I am not sure of the device you are targeting - I assume it might be the HC(S)08.
 
Within your CW installation, there should be a manual for the compiler, e.g Compiler_HC08.pdf.  Within this manual there likely to be a section headed "High Level Inline Assembler".  Also may be of interest, within the section "ANSI-C Frontend", a sub-section headed "Defining C Macros containing HLI assembler code".
 
Regards,
Mac
 
0 Kudos
Reply
1,471 Views
CarlFST60L_2nd
Contributor I
Thanks, that worked!

I guess the answer is in this?

(Copied directly from the Codewarrior help files on inline assembly)

http://rafb.net/p/0bPzPO30.html

Factor        = ( Expression ) | Factor {: Factor|MSB)}

?


0 Kudos
Reply