Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What trick is there in programming interrupts?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi there,

For the past one week or so, I have been stumped, really stumped! I am working on a very simple comport file transfer program using assembly. The program uses a circular buffer. Part of the program loads the data from the harddisk using DOS INT 21H, while the serial port ISR transfers the data from the circular buffer to the UART FIFO. The receiver side does similar things, except in reverse order.

So, my program loops this way (simplified form):

L1:

MOV AH, 3FH ;function to read file.
MOV BX, FILEHANDLE
MOV CX, Number_of_bytes_to_read
INT 21H

; Does other things here.

JMP L1

I find that the serial port interrupts usually stop after sometime, although file still not transmitted fully and I didn't disable interrupts. The program is not hanged as I still can exit. So what is the problem?

I figure that the DOS software interrupt use to load data from harddisk may somehow cause problem (but exactly what I dunno). So I disable the INT 21H, (nevermind if the program is just sending nonsense) and the serial port interrupts proceeded forth successfully enough.

I really hope to hear from anybody.

Thanks.
 
Hi,

If ( THE NUMBER OF LOST BYTES < Number_of_bytes_to_read )
{
Lets say Number_of_bytes_to_read = 10;
&quot; &quot; Filesize = 55;
Number of successful DOS ints = 5.
Number of bytes read from file = 5 * 10 =50
Bytes yet to read =5;
Since, u exit the program, as soon as u c that
&quot;carry flag&quot; is set, the remaining 5 bytes remain
untransferred.
Try with Number_of_bytes_to_read = 1.
Hope this helps
return 0;
}
else
{
printf (&quot;\n Sorry. I dunno the reason\n&quot;);
return -1;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top