help with HC05 asm conversion to HCS08 asm

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

help with HC05 asm conversion to HCS08 asm

4,196 Views
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
 
Labels (1)
0 Kudos
Reply
5 Replies

1,571 Views
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 Kudos
Reply

1,571 Views
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 Kudos
Reply

1,571 Views
CompilerGuru
NXP Employee
NXP Employee
use the LOW and HIGH operators.
 ADD #LOW(MSG_LNK)
 ...
 ADC #HIGH(MSG_LNK)


Daniel
0 Kudos
Reply

1,571 Views
baddad
Contributor I
Daniel,
 
Thanks.
 
That was exactly what I was looking for.
 
BadDad
0 Kudos
Reply

1,571 Views
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 Kudos
Reply