Sunday, July 12, 2009

Can someone help me translate this C code to 32 bit assembly program?

The program simply allows two computer connected together using a "cross" serial cable.Tthe program should accept a key-press from a user and automatically sends the character to the other computer screen. The other computer should be able to do the same.


Can you please help me convert it? I am not familiar with assembly programming. Thanks!





#include %26lt;dos.h%26gt;


#include %26lt;stdio.h%26gt;


#include %26lt;conio.h%26gt;





#define PORT1 0x3F8





void main(void)


{


int c;


int ch;


outportb(PORT1 + 1 , 0);


outportb(PORT1 + 3 , 0x80);


outportb(PORT1 + 0 , 0x03):


outportb(PORT1 + 1 , 0x00);


outportb(PORT1 + 3 , 0x03);


outportb(PORT1 + 2 , 0xC7);


outportb(PORT1 + 4 , 0x0B);





printf("\nSample Comm's Program. Press ESC to quit \n");





do { c = inportb(PORT1 + 5);


if (c %26amp; 1) {ch = inportb(PORT1);


printf("%c",ch);}


if (kbhit()){ch = getch();


outportb(PORT1, ch);}


} while (ch !=27);


}

Can someone help me translate this C code to 32 bit assembly program?
Use a C compiler with the -S (it may be -s or /s depending on the compiler) to compile it into assembler. I do have an old version of MSC (an 1980s based C-Compiler for MS-DOS) that I can use if you don't have it. It is on another computer though.

plum

No comments:

Post a Comment