Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Larrson

macrumors newbie
Original poster
Feb 24, 2009
2
0
Australia
Hi,

Could anyone tell me, please, what wrong is with this frag of code:
Code:
...
dec     edx
jnz     short loc_10014FC3
xor     edx, edx
...

There is always "error: expected primary-expression before 'short'"

And, where i can find more informations about inline assembly on Mac OSX.

Cheers,
L.
 

LtRammstein

macrumors 6502a
Jun 20, 2006
570
0
Denver, CO
All of my assembly programming have been done on Freescale HC12s, so the information I give could and probably is wrong.

Fro my understanding, and I can be wrong, that a short is just a way to define a length of bits, problem is you need to define what kind of data it is, an int or what not.

So from my assembly programming, we don't worry about casting or anything like that. We know that the registers and data are in 2's complement, and are 16 bits (2 words) big.

This might be a place to start:

http://developer.apple.com/DOCUMENT...ler/000-Introduction/chapter_1_section_1.html
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
From googling that error it looks like you might have a curly-brace syntax error, possibly surrounding the asm block, but that's just a wild guess ;)
 

Larrson

macrumors newbie
Original poster
Feb 24, 2009
2
0
Australia
Hi,

Sorry guys for delay from my end.
Problem solved by removing word "short"; you right LtRammstein, no casting or anything like that.

Cheers,
L.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
And, where i can find more informations about inline assembly on Mac OSX.

Google for "gcc documentation". As a simple example for inline assembler, create a program, enter "htonl", Jump to definition and follow where it takes you. Inline assembler is tough.

What you are trying to do is assembler, not inline assembler. Go to any source file, best in "Release" mode, and "Show assembler" in the Build menu. Look at what's there. Then add a .s file to your project containing your own assembler code.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.