Skip navigation.
Home
The QNX Community Portal

View topic - How can I inline asm codes into C or C++ codes under QNX4.25

Page 1 of 1

How can I inline asm codes into C or C++ codes under QNX4.25

PostPosted: Mon Jun 28, 2004 1:38 pm
by cqjwl
Hi, everybody!

How can I inline asm codes into C or C++ codes under QNX4.25 ?

Can someone help me? Thanks a lot!

PostPosted: Mon Jun 28, 2004 3:20 pm
by rick
I presume you are not talking about arm assembly language since there is no support for anything but x86 in QNX4. Can you explain what you mean by "inline arm codes"?

Thanks,
Rick..

PostPosted: Mon Jun 28, 2004 7:50 pm
by mario
Maybe it`s a typo and cqjwl meant "asm`instead of arm.

For some tibits of asm; look into /usr/include/sys/inline.h for some example. Watcom documentation includes all the info you need. Inline assembly under Watcom 10.6 is primitive compare to today's compiler.

If the asm code is rather large, you'd better write a .asm module and let the watcom assembler deal with it.

PostPosted: Tue Jun 29, 2004 12:31 am
by cqjwl
So sorry, I spell mistake.What I mean is asm.

Yes, I want to inline x86 assembly language.

So thanks to all of you!

Re: How can I inline asm codes into C or C++ codes under QNX

PostPosted: Thu Apr 23, 2015 9:10 am
by sieudot
Ha ha, after 10 years, I dig this thread :D

I have a problem with my code, need inline assembly on a C program, build with Watcom 10.6 on QNX4.
After a long time have been searching on WWW, I found this work fine. I post them here for someone else (or for me later :D)

/*
OS: QNX4.25 with Watcom C Compiler 10.6
Filename: test.c
Make: cc test.c -o test
Code: Cong Ca Chon
*/

#include <stdio.h>
void int10(void);
int Cong(int a, int b);

#pragma aux int10 = \
" mov ax, 13h " \
" int 10h " \
modify [ax];

#pragma aux Cong parm [eax] [ebx] = \
" add eax, ebx " \
value [eax] \
modify [eax ebx];

int main()
{
printf("Inline assembly demo\n");
printf("%d+%d=%d", 5,10,Cong(5,10));
return 0;
}