Addressing arrays __asm lda array[1];

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Addressing arrays __asm lda array[1];

跳至解决方案
3,392 次查看
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
}



标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,477 次查看
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 项奖励
回复
4 回复数
1,477 次查看
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 项奖励
回复
1,477 次查看
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 项奖励
回复
1,478 次查看
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 项奖励
回复
1,477 次查看
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 项奖励
回复