Skip navigation.
Home
The QNX Community Portal

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

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

For the old QNX2 and QNX4 RTOS

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

Postby cqjwl » Mon Jun 28, 2004 1:38 pm

Hi, everybody!

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

Can someone help me? Thanks a lot!
Last edited by cqjwl on Tue Jun 29, 2004 12:37 am, edited 1 time in total.
cqjwl
New Member
 
Posts: 6
Joined: Tue Jul 22, 2003 5:30 am

Postby rick » Mon Jun 28, 2004 3:20 pm

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..
rick
QNX Master
 
Posts: 500
Joined: Wed Nov 13, 2002 3:59 am

Postby mario » Mon Jun 28, 2004 7:50 pm

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.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Postby cqjwl » Tue Jun 29, 2004 12:31 am

So sorry, I spell mistake.What I mean is asm.

Yes, I want to inline x86 assembly language.

So thanks to all of you!
cqjwl
New Member
 
Posts: 6
Joined: Tue Jul 22, 2003 5:30 am

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

Postby sieudot » Thu Apr 23, 2015 9:10 am

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;
}
sieudot
Active Member
 
Posts: 45
Joined: Thu Mar 17, 2005 8:14 am
Location: VietNam


Return to QNX2 and QNX4

Who is online

Users browsing this forum: No registered users and 0 guests