Read Accumulator Register from C

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

Read Accumulator Register from C

跳至解决方案
4,222 次查看
jimw
Contributor II
Is there a simple efficient way to move the contents of Reg A to a variable in C?
 
 
 
标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,470 次查看
jimw
Contributor II
I think I found it.
 
char t;
 __asm {
 sta t
 }
 
compiles as:
 
  TSX
  STA ,X
 
 
 

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,470 次查看
bigmac
Specialist III
Hello JimW,
 
Whenever a function returns a char value, the returned value will be in the accumulator.  So the following seems to work OK.
 
char funcA(void) {
  asm lda TCNTL;   /* Low byte of timer reg */
}
 
 
char value;
 
value = funcA();
 
Regards,
Mac
 
1,471 次查看
jimw
Contributor II
I think I found it.
 
char t;
 __asm {
 sta t
 }
 
compiles as:
 
  TSX
  STA ,X
 
 
 
0 项奖励
回复