Re: how to insert an asm instruction in C code and how to compile it

From: Mads Martin Joergensen
Date: Mon Jun 20 2005 - 09:59:28 EST


* Srinivas G. <srinivasg@xxxxxxxxxxxxxxxxxxxxx> [Jun 20. 2005 16:52]:
> I am very sorry for asking such a silly question here.
>
> I have small doubt about ASM code in a C program. Actually I want to
> insert some asm instructions in a C program and after that I want to
> compile the C program.
>
> I want to include the following code in a simple C program and compile
> it.
>
> #define printf DbgPrint
>
> int main()
> {
> printf("Hello world program!\n");
> return 0;
> }
> void DbgPrint(char* str,...)
> {
> volatile USHORT i = 0;
> volatile UCHAR sch;
> while(str[i])
> {
> sch = str[i];
> i ++;
> asm mov ah,0x0E;
> asm mov al,sch;
>
> asm cmp al,0ah
> asm jne test
> asm mov al,0dh //; new line
> asm mov bx,07h
> asm int 10h
> asm mov al,0ah
> test:
> asm mov bx,0x07
> asm int 0x10
> }
> }
>
> Please let me know how to do it?

http://www.int80h.org/

--
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?"
-- A. P. J.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/