help with HC05 asm conversion to HCS08 asm

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

help with HC05 asm conversion to HCS08 asm

4,205 次查看
baddad
Contributor I
Folks,
I am converting some old HC05 asm code to run on a HCS08AW32 (using CW 5.1).  I've been successful with everything but this subroutine:
 
XMT_EMSG0:
 ADD #MSG_LNK&0FF  ; Add LSB of Message Link Offset
 STA VSRL_LSB  ; Message in the EEPROM Pointer
 LDA VSWI
 ADC #MSG_LNK/100  ; Add MSB of Message Link Offset
 STA VSRL_MSB  ; Message in the EEPROM
...
 
This code is creating a 16-bit offset pointer to some messages.
The 2 add statements (ADD and ADC) create errors due to the complex statement.
 
Any suggestions on how to reduce these two lines to simple HC08 instructions that will assemble?
 
Thanks in advance.
Brian
 
标签 (1)
0 项奖励
回复
5 回复数

1,580 次查看
bigmac
Specialist III
Hello,
 
There may be another potential problem with your code conversion - from your code snippet it would appear that your HC05 assembler may assume hexadecimal numbers by default, when there is no prefix or suffix to indicate otherwise.  For CW assembler, decimal numbers are the default, unless this is specifically changed.
 
Regards,
Mac
 
0 项奖励
回复

1,580 次查看
baddad
Contributor I
Thanks MAC.
 
I did fix that early on, but I cut and pasted from the original file.
 
BTW, I also found that passing parameters to a macro function uses different symbols also.  (old way - %, new way - /)
 
Thanks again for all the help.
 
BadDad
0 项奖励
回复

1,580 次查看
CompilerGuru
NXP Employee
NXP Employee
use the LOW and HIGH operators.
 ADD #LOW(MSG_LNK)
 ...
 ADC #HIGH(MSG_LNK)


Daniel
0 项奖励
回复

1,580 次查看
baddad
Contributor I
Daniel,
 
Thanks.
 
That was exactly what I was looking for.
 
BadDad
0 项奖励
回复

1,580 次查看
Geezer
Contributor I
I believe you've run out of 'tiny' memory and the linker is putting all subsequent DS.B and DS.W things into the larger block of RAM (aka INDIRECT) which cannot be manipulated by instructions designed for DIRECT stuff. LDA and ADD, for instance. You''l hve to convert to code using 16-bit stuff, the old LDHX and the like.

Look at your MAP file, I think you'll find that the variable you use are no longer below address 0xff.

Whose ASSEMBLER are you using?
0 项奖励
回复