home *** CD-ROM | disk | FTP | other *** search
- page 66,132
- title TKRTGL.ASM <Ticker Toggle>
- ;-----------------------------------------------------------------------------
- ; Program: Ticker Toggle (TKRTGL.ASM)
- ; Version: 1.0
- ; Author : Mike Kenny
- ; Date : 01/26/89
- ;
- ; Remarks: This is a resident program to toggle on demand the INT 1Ch
- ; vector, between a pointer to an IRET and it's actual code.
- ; This will allow the user to temporarily disable cycle hogging
- ; programs that adversely effect high speed data communications.
- ;
- ;-----------------------------------------------------------------------------
-
- code segment para public 'code'
- assume cs:code
-
- org 100h
- begin: jmp initialize
-
-
- ON equ 0
- OFF equ 1
- toggle_keyscan equ 054h ;keyboard scan code for F11
- target_int equ 01ch ;timer interrupt
- kb_int equ 09h
- int_segment equ 0
-
- dummy_vector: IRET ;only 28 clocks to get back
-
- int_status db 0 ;0 = normal, 1 = IRET
-
- orig_kb_int label dword ;segment and offset of the
- orig_keyboard_int dw 2 dup (?) ;keyboard interrupt
-
- vector_address dw 2 dup (?) ;storage for active vector
-
- main proc near
- sti ;enable software interrupts
- push ax ;save all registers
- push bx
- push cx
- push dx
- push si
- push di
- push ds
- push es
-
- pushf ;push flags for call to the
- call orig_kb_int ;original kbd interrupt
- mov ah,1 ;check keyboard buffer to see
- int 16h ;if something is in it
- jz exit ;zr set if no key
- cmp ah,toggle_keyscan ;check scan code
- jne exit
- mov ah,0 ;we got it
- int 16h ;lets clear it
- push cs ;set ds to cs segment
- pop ds
- cmp int_status,ON ;see if dummy is active
- jne int_restore ;put it back the way it was
-
- mov ax,int_segment
- push ax
- pop es ;set es to int segment
- mov si,4 * target_int ;source our target
- mov ax,es:[si] ;get offset
- mov bx,es:[si+2] ;get segment
- mov vector_address,ax ;save for later
- mov vector_address[2],bx
- mov ax,offset dummy_vector ;get dummys address
- cli ;do not disturb
- mov es:[si],ax ;set vector to dummy
- mov es:[si+2],cs
- sti ;keep the clock right
-
- mov int_status,OFF ;set the status
- jmp exit
-
- int_restore:
- mov ax,int_segment
- push ax
- pop es ;set es to int segment
- mov si,4 * target_int ;source our target
- mov ax,vector_address ;get offset
- mov bx,vector_address[2] ;get segment
- cli ;do not disturb
- mov es:[si],ax ;set vector the way it was
- mov es:[si+2],bx ;mean't to be
- sti ;keep the clock right
-
- mov int_status,ON ;set the status
-
- exit: pop es ;restore callers registers
- pop ds
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- pop ax
- iret ;interrupt return
- main endp
-
- page
- ;-----------------------------------------------------------------------------
- ; Initialization code will change the interrupt vector table and load resident
- ;-----------------------------------------------------------------------------
- initialize proc near
- assume ds:code, es:code
-
- mov ah,9 ;send loaded message
- lea dx,tsr_message
- int 21h
-
- mov int_status,0 ;intialize interrupt status
-
- mov ah,035h ;lets get the current kbd
- mov al,kb_int ;interrupt vector
- int 021h
- mov orig_keyboard_int[2],es ;save the segment
- mov orig_keyboard_int,bx ;save the offset
- mov ah,025h ;here we go!
- mov al,kb_int
- push cs ;set ds to cs segment
- pop ds
- mov dx,offset main
- int 021h ;dos do your magic
-
- mov dx,offset initialize ;dx = end of tsr code
- int 27h ;terminate and stay resident
-
- tsr_message db 13,10 ;tell them its loaded
- db 213,40 dup(205),184,13,10
- db 179,' Ticker Toggle Rev. 1.0 01/26/89 ',179,13,10
- db 179,' ',179,13,10
- db 179,' <F11> To Toggle M. Kenny ',179,13,10
- db 212,40 dup(205),190,13,10,'$'
-
- initialize endp
- code ends ;end of code segment
- end begin ;end of program
-