I ve been trying to learn assembly. I m using visual studio 2005.Currently i ve been trying to develop a transfer system betwenn 2 computers using a null modem cable.<br />I ve managed to script my transmitter but i can't get around how to start the receiver.<br />Can someone help me with it?<br />here is the code for the transmitter.<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><br />#include <stdio.h><br /><br />int main (void) {<br /><br /> //Define Variables<br />  char Textfile[] = "C:\\text.txt";  //File that holds the data to transmit<br />  char Comport[] ="COM2";                  //Define Serial Port<br /> <br /><br />  FILE * readfile;<br />  FILE * writecom;<br /> <br /><br />  char error[] = "Unable to open File/Comport\n\n"; //TERMINATION with an error message<br />  char chartosend;<br />  char readaccess[] ="r";<br />  char writeaccess[] ="wt";<br /><br />  _asm {<br /><br />//check if the port can be accessed<br />          lea eax,writeaccess  //check acess a<br />          push eax<br />          lea eax,Comport      //check port           push eax<br /><br />      call fopen<br />      add esp,8  //Clean the stack <br /><br />      cmp eax, 0 <br />      mov writecom, eax<br />      je TERMINATION //If it doesn't writecom then run TERMINATION for handling errors<br /><br />//check if textfile is accessible<br />      lea eax,readaccess  //check for readaccess for the textfile and move it to the stack<br />      push eax<br />      lea eax, Textfile    //check for textfile and move it to the stack<br />      push eax<br /><br /><br />      call fopen<br />      add esp, 8 //Clean the stack<br /><br />      cmp eax, 0<br />      mov readfile, eax<br />      je TERMINATION    //If it doesn't open readfile then run TERMINATION for handling errors<br /><br /><br /><br />WHILENOTEOF:<br />//IF no more data can be read from a data source get each character from the file<br />    mov eax, readfile<br />    push eax<br /><br />    call fgetc<br />    add esp, 4<br />    <br />//check if EOF has been reached<br />    cmp al, EOF<br />    je FILECLOSE<br /><br />    mov chartosend, al<br /><br />    push eax<br />    add esp, 4<br />//write characters to comport<br />    mov eax, writecom<br />    push eax<br />    mov al, chartosend<br />    push eax<br />    call fputc<br />    add esp, 8<br /><br />jmp WHILENOTEOF<br /><br />FILECLOSE:<br />//Add closing value to the end of the string<br />    mov eax, writecom<br />    push eax<br /><br />    mov al, 80h  //The receiver needs to know the EOF so closing value is 80h <br />    push eax<br /><br />    call fputc<br />    add esp,8 <br /><br />//Start closing<br />    mov eax, readfile  //readfile<br />    push eax<br /><br />    call fclose<br />    add esp, 4<br /><br />//writecom<br />    mov eax, writecom<br />    push eax<br /><br />    call fclose<br />    add esp, 4<br /><br />    jmp END<br /><br />TERMINATION:<br />    lea eax, error<br />    push eax<br /><br />    call printf<br />    add esp, 4<br /><br />END:<br />    } //_asm<br /><br />    return 0;<br />    } //void<!--c2--></div><!--ec2--><br /><br /><span class='edit'>This post has been edited by <b>menios</b>: 14 Dec, 2007 - 10:43 AM</span>
</div>
</div>