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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear All,

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.

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?

Any links or Howtos are welcome.
Thanks in advance.

Regards,
Srinivas G

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux