ryders@watdcsu.waterloo.edu (Steve Ryder Independent Studies) (11/12/87)
Anyone experienced with TSR programs and interrupts?
What I am trying to do is create a program to disable the PrtSc. This is
governed by int 21h function 05. So, the program assembles, and loads without
a hitch. A memory map shows it to be resident and the correct vector is hooked.
But when the actual PrtSc key is depressed, instead of getting the expected
'Print-Screen disabled.' message, unusual characters print to the screen and
then the machine hangs. Any help would be greatly appreciated. Please e-mail
replies.
;Print screen disabler (memory resident)
cr equ 0dh
lf equ 0ah
cseg segment para public 'CODE'
org 100h
assume cs:cseg,ds:cseg,es:cseg,ss:cseg
init proc near
mov dx,offset pscreen ;set interrupt vector
mov ax,2505h
int 21h
mov dx,offset message ;display installation message
mov ah,9
int 21h
mov dx,((offset pgmlen+15)/16)+10h ;TSR
mov ax,3100h
int 21h
init endp
pscreen proc near
sti
mov dx,offset warning ;interupt request for PrtSc
mov ah,9 ;and print 'disabled' message
int 21h
iret
pscreen endp
message db cr,lf,'Print-Screen disabler installed.'
db cr,lf,'$'
warning db cr,lf,'Print-Screen is disabled.'
db cr,lf,'$'
pgmlen equ $-init
cseg ends
end init
--
___ ___ __ __ Steve Ryder ryders@watdcsu.UUCP | | | | \ \ / / {allegra,decvax,ihnp4,utzoo}!watmath!watdcsu!ryders
| |_| |of\ \/\/ / I.S., University of Waterloo, Waterloo, Ont., N2L 3G1 |_____| \_/\_/ (519)885-1211 x2352 x2345
<insert disclaimer or your choice here> "As much as thou hast, so much art thou worth." -CERVANTES, Don Quixote
jru@etn-rad.UUCP (11/13/87)
In article <4106@watdcsu.waterloo.edu> ryders@watdcsu.waterloo.edu (Steve Ryder Independent Studies) writes: >Anyone experienced with TSR programs and interrupts? > >What I am trying to do is create a program to disable the PrtSc. This is ... >'Print-Screen disabled.' message, unusual characters print to the screen and >then the machine hangs. Any help would be greatly appreciated. ... ... >pscreen proc near > > sti *problem #1 - you are not saving the register you are using on the stack. This will corrupt the values in dx and ax, which may be in the process of being used by someone when the interrupt occurs. > mov dx,offset warning ;interupt request for PrtSc *problem #2 - the data segemnt register ds probably does not contain the value which you are expecting it to contain. It will have the value that was being used by whoever was running when the interrupt occurred,maybe DOS, maybe applications code? For code like this you should either refer to everything as offsets from cs which is set up correctly by the interrupt hardware, or use the large model and load the segment of warning into ds explicitly (after saving ds on the stack of course). > mov ah,9 ;and print 'disabled' message > int 21h > iret > >pscreen endp > Dont you just love segmented architectures? Wouldnt you like to have the head of the Intel engineer responsible for them on a plate? Life would have been so nice if ibm had used motorola. The people who bring you the famous phoenix bios for clone PCs have now written a program that emulates the 8086 instruction set as a task on the motorola 68030, and its faster than the real thing. Wouldnt you like to see a 68030 based PS/2 running REAL UNIX with DOS available as an optional sub-process? How about it IBM, its not to late to change the PS/2 from a desktop toy into a real departmental multi-user computer. Or maybe IBM is afraid that a multi-user PS/2 would smother the infant model 9370 ? (What a joke, a departmental minicomputer running MVS... 4 users and 4 systems programmers to keep MVS from eating itself) but I digress.