Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Can Someone here Than can Covert this C language code to ASsembly language code ??

C
#include<stdio.h>
#include<ioports.h>

/* NOTE:
Don't forget to add the -l ioports option under Tools->Compiler options
This will add the ioport interface library

OR 

from the command line:
        
        gcc binary.c -l ioports -o binary.exe
*/


/* Define which port to write to */
#define IO_PORT 0x378

main(void)
{
   int num;
   char instr[25];
   
   printf("press ctrl-C to stop\n\n");
   
   /* Place port into standard output mode */
   outb(IO_PORT+2, inb(IO_PORT+2) & ~32);
   
   while (1) {

      printf("Enter a number (prefix with 0x for hex) :");
      fgets(instr, sizeof(instr), stdin);
      
      /* Jump out of loop if q entered */
      if (toupper(instr[0]) == 'Q')
         break;
         
      sscanf(instr, "%i", &num);
      
      /* now output it to the port */
      outb(IO_PORT, num);  /* write value to port */
      
   }      
    
   return(0);     
}


please help me out ..
i really need to make this work..

I Really appreciate your help ..

Thank you..

[Edit]Code block added[/Edit]
[edit]SHOUTING removed - OriginalGriff[/edit]
Posted
Updated 16-Mar-13 22:45pm
v3
Comments
OriginalGriff 16-Mar-13 12:00pm    
And what have you tried so far?
Where are you stuck?
Michael Haephrati 16-Mar-13 18:10pm    
If you compile it, most c / c++ compilers can create Assembly code.
Sergey Alexandrovich Kryukov 16-Mar-13 21:14pm    
Why doing so?
—SA
OriginalGriff 17-Mar-13 4:45am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
arjel29 17-Mar-13 5:00am    
sorry for that .

i didnt mean it . .
can you help me with my problem ??

1 solution

If you want a "cheat sheet", use the -S option on GCC, e.g. gcc -S binary.c. This results in a binary.s file. Learn to read the content of that binary.s file and you will get into assembly language.

Once you understand reading this and isolate the function you need to write yourself, you are ready to learn writing it.
No one can take that burden from you.

Cheers
Andi
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900