![]() |
Writing to a file from a TSR (MASM16)
Hi,
I am having a hard time writing to a file from a TSR routine. The routine is supposed to write a line of text to a file when the F9 key is pressed. Instead it just prints the line to the screen. I am only posting the parts of the routine I having problems with. I thikn I setup the IVT table correctly. Thanks, Kevin ; -------------------------------------------------- ; Example layout for interrupt handler. .model tiny .486 text segment public 'CODE' ; Note, must put start of program at 100 hex, org 100h start: jmp init ; note, required to "start" just past the "org", ; so jump, not call, since we will not return. myint proc far pushf call CS:oldn push ax push bx push cx push dx push ds push es mov ax,cs mov ds,ax ; Check for F9 down cmp ax, 43h je no_err ; Check for F9 up, file write cmp ax, 0c3h je filewrite ; If we see any other key, just beep jmp err ; write the stars line to the file filewrite: mov ah, 40h mov bx, es:fhand mov cx, 82 lea dx, es:stars int 21h jc err ; Commit the line mov ah, 68h mov bx, es:fhand int 21h jmp no_err |
As a new member, it would seem prudent to read the forum's rules/FAQ and a "How to Post...." thread, just to get in tune with this (and many similar) community(s), right? Attention to the part regarding code tags would certainly be in order.
|
Your problem might be that DOS is non-reentrant, and you're trying to call it from what appears to be an interrupt context. Without seeing exactly how you get those scancodes into AX, or under what conditions your TSR is invoked, I can't say for sure (since, according to the code, AX has your program's CS value).
|
| All times are GMT -5. The time now is 11:26 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC