Hi,
I am trying to understand this construct ( ms2_extra_ign_in.c, tooth logger ):
"std 1,Y\n"
:
: "y" (log_offset+ram_data),
"m" (*((unsigned char *)&tooth_diff_this+1)), // byte 3:**2**:1:0
"m" (*((unsigned int *)&tooth_diff_this+1)), // bytes 3:2:**1**:**0**
"m" (synch),
"m" (flagbyte1)
Also, where do I find more info about the MC9S12C opcodes
Thanks
Oskar
inline asm help
Moderators: jsmcortina, muythaibxr
I cannot explain the tooth logger, but I must show you something interesting I saw the other day. A friend has DTA-engine management and the tuningsoftware has a built in Oscilloscope. It shows the tooth times and the cranking. It also calculates approximately where the missing tooth(s) are and the angle on the second trigger. This would be a nice feature to have with megasquirt as well. I hope Megatunix will support MS2E soon. I guess the tooth logger easily could be developed to something like the DTA Oscilloscope.
http://www.dtafast.co.uk/screenshots/Su ... anking.JPG
Thanks
Vegard
http://www.dtafast.co.uk/screenshots/Su ... anking.JPG
Thanks
Vegard
Audi 80Q 2,0 20V Turbo 630cc AEB/ABA/ABF
MS-II V3 MT2.25 MS2 Extra 2.0.1 VAG/Bosch VR 60-2 Waste spark PWM-idle
MS-II V3 MT2.25 MS2 Extra 2.0.1 VAG/Bosch VR 60-2 Waste spark PWM-idle
-
- Site Admin
- Posts: 8230
- Joined: Thu Oct 14, 2004 12:48 pm
Re: inline asm help
What specifically do you not understand about that construct?oskar wrote:Hi,
I am trying to understand this construct ( ms2_extra_ign_in.c, tooth logger ):
"std 1,Y\n"
:
: "y" (log_offset+ram_data),
"m" (*((unsigned char *)&tooth_diff_this+1)), // byte 3:**2**:1:0
"m" (*((unsigned int *)&tooth_diff_this+1)), // bytes 3:2:**1**:**0**
"m" (synch),
"m" (flagbyte1)
Also, where do I find more info about the MC9S12C opcodes
Thanks
Oskar
You can download the pdf for the hcs12 opcodes from freescale, I don't have the link though as I found and downloaded the pdf more than a year ago.
Ken
Re: inline asm help
[quote="muythaibxr"][quote="oskar"]Hi,
I am trying to understand this construct ( ms2_extra_ign_in.c, tooth logger ):
"std 1,Y\n"
:
: "y" (log_offset+ram_data),
"m" (*((unsigned char *)&tooth_diff_this+1)), // byte 3:**2**:1:0
"m" (*((unsigned int *)&tooth_diff_this+1)), // bytes 3:2:**1**:**0**
"m" (synch),
"m" (flagbyte1)
Also, where do I find more info about the MC9S12C opcodes
Thanks
Oskar[/quote]
What specifically do you not understand about that construct?
You can download the pdf for the hcs12 opcodes from freescale, I don't have the link though as I found and downloaded the pdf more than a year ago.
Ken[/quote]
well, here is the whole story:
I am (trying) to compile the source in ICC7. The C code I got compiling just a few modifications with the ISR handlers and memory (tables) at nonstandard location.
In the moment this asm inline stmt does not compile. Too GNU specific, I guess. And I am used to C (win32) but not at all to assembler
the trouble starts with
"std 1,Y\n"
I was thinking std takes one operand, Y is a register, then the statement is closed by a newline ( \n)
Then I cannot figure ( in the GNU compiler docu) what the two : as well as
"y" (log_offset+ram_data). Of course log_offset is an address, ram_data the starting address ..
Anyways, to cut it short: In the moment, I would not even need to understand this codesnippet, it just just would need to compile ( in ICC7)
with the docs, I found something
THX
Oskar
I am trying to understand this construct ( ms2_extra_ign_in.c, tooth logger ):
"std 1,Y\n"
:
: "y" (log_offset+ram_data),
"m" (*((unsigned char *)&tooth_diff_this+1)), // byte 3:**2**:1:0
"m" (*((unsigned int *)&tooth_diff_this+1)), // bytes 3:2:**1**:**0**
"m" (synch),
"m" (flagbyte1)
Also, where do I find more info about the MC9S12C opcodes
Thanks
Oskar[/quote]
What specifically do you not understand about that construct?
You can download the pdf for the hcs12 opcodes from freescale, I don't have the link though as I found and downloaded the pdf more than a year ago.
Ken[/quote]
well, here is the whole story:
I am (trying) to compile the source in ICC7. The C code I got compiling just a few modifications with the ISR handlers and memory (tables) at nonstandard location.
In the moment this asm inline stmt does not compile. Too GNU specific, I guess. And I am used to C (win32) but not at all to assembler
the trouble starts with
"std 1,Y\n"
I was thinking std takes one operand, Y is a register, then the statement is closed by a newline ( \n)
Then I cannot figure ( in the GNU compiler docu) what the two : as well as
"y" (log_offset+ram_data). Of course log_offset is an address, ram_data the starting address ..
Anyways, to cut it short: In the moment, I would not even need to understand this codesnippet, it just just would need to compile ( in ICC7)
with the docs, I found something
THX
Oskar
-
- Site Admin
- Posts: 8230
- Joined: Thu Oct 14, 2004 12:48 pm
Re: inline asm help
This particular instruction uses indexed addressing.oskar wrote:
"std 1,Y\n"
In the Y register there's already a memory address...
std 1,Y stores whatever's in the "d" register to 1+ the adress in Y.
Ken
Re: inline asm help
I guess, finally I am getting my fool head to get it
asm ( .....
"std 1,Y\n"
: // no output
: "y" (log_offset+ram_data), // operand nr1, %1 'formatted for register Y
"m" (*((unsigned char *)&tooth_diff_this+1)), // operand nr2, %2
"m" (*((unsigned int *)&tooth_diff_this+1)), // %3
"m" (synch), // %4
"m" (flagbyte1) // %5 , not used
learning is fun, even for a 52 year old
Oskar
asm ( .....
"std 1,Y\n"
: // no output
: "y" (log_offset+ram_data), // operand nr1, %1 'formatted for register Y
"m" (*((unsigned char *)&tooth_diff_this+1)), // operand nr2, %2
"m" (*((unsigned int *)&tooth_diff_this+1)), // %3
"m" (synch), // %4
"m" (flagbyte1) // %5 , not used
learning is fun, even for a 52 year old
Oskar
-
- Site Admin
- Posts: 39619
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".