![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2006
Posts: 1
Rep Power: 0
![]() |
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 Last edited by Roku; Apr 10th, 2006 at 2:43 PM. Reason: Cleaing this up to conform with the forum rules (I am a newbie) |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Caffeinated Neural Net
![]() Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,120
Rep Power: 5
![]() |
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).
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot. - Vaarsuvius, Order of the Stick |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|