what does (*-SpSub) mean?

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

what does (*-SpSub) mean?

2,444 Views
HarrySun
Contributor I
Hello,
 
on Page 88 in one freescale file :"HCS08RMV1", I see one line like this:
SpSubSize:    equ (*-SpSub)
 
I don't understand this:
what do * and - and () mean here?
I didn't find any words explaining these.
 
 
thanks
 
Labels (1)
0 Kudos
7 Replies

692 Views
rocco
Senior Contributor II
Hi, Harry:

I will assume that this line of code is at the end of a subroutine called "SpSub".

The "*" is a symbol that denotes the current program counter.
The rest (the minus and the parentheses) perform your usual math operations.

The line is simply taking the value of the current program counter, subtracting the value of the program counter at the start of the subroutine, and setting "SpSubSize" to the result.

In other words, it is setting "SpSubSize" to the size of the subroutine "SpSub" (probably to be used in a counter when moving the routine to ram).
0 Kudos

692 Views
HarrySun
Contributor I
Rocco,
 
you are really a "trusted contributor" :smileyhappy:,this helps a lot and I could go ahead now.
 
however, where did you find this explanation?why couldn't I find this in freescale datasheets or application notes?
I am puzzled as I am not a newbie and I have been through Motorola HC05,HC08 and QG8 now,while I didn't know this at all before...I use both C and assembly ....I have never seen something like this....maybe freescale intentionally hides this somewhere?or i missed very important info.??
 
well, you gave me fish for sure, but how about teaching me how to fish?
 
thanks

Message Edited by HarrySun on 2007-03-0901:23 PM

0 Kudos

692 Views
bigmac
Specialist III

Hello Harry,

You will find this use of the asterisk character mentioned in the CW assembler manual.  Look in the "Assembler syntax" section, near the start of the "Expression" sub-section.
 
"The special symbol ‘*’ represents the value of the location counter at the beginning of the instruction or directive, even when several arguments are specified. ... "
Some other assemblers also allow the symbol '$' in a similar context, but apparently not CW.
 
Regards,
Mac
 
0 Kudos

692 Views
HarrySun
Contributor I
Thanks very much,BigMac,
 
where did you find the CW ASSEMBLER manual?I searched the website and didn't find it.
could you give me a link?
 
thanks
 
Harry
 
0 Kudos

692 Views
CrasyCat
Specialist III
Hello
 
In your {Install}\Help directory you have a Assembler_HC08.chm help file.
In your {Install}\Help\PDF directory you have the Assembler_HC08.pdf manual
 
CrasyCat
0 Kudos

692 Views
HarrySun
Contributor I
thanks CrasyCat.
I didn't find Assembler_HC08.chm help file, though i found the other one under documentary folder.
maybe my install files are too old?
0 Kudos

692 Views
CrasyCat
Specialist III
I was assuming you are using CodeWarrior HC08 V5.x
 
CrasyCat
 
0 Kudos