; INTMON.ASM (Interrupt Moniter) by Jim Webster ; Date: 03-31-1996 ; Compile: MASM INTMON; ; LINK INTMON; ; < LINK : warning L4021: no stack segment > ; EXE2BIN INTMON ; REN INTMON.BIN INTMON.COM pushr macro a,b,c,d,e,f,g,h,i,j,k irp xx, ifnb push xx else exitm endif endm endm popr macro a,b,c,d,e,f,g,h,i,j,k irp xx, ifnb pop xx else exitm endif endm endm _TEXT segment byte public 'CODE' assume cs:_TEXT, ds:_TEXT org 100h start: jmp install ;Go to start of initilization code. count_table dw 256*2 dup (0) ;Double word count for each INT. old_ints dd 256 dup (0) ;Old Interrupts. int_jump dd 0 ;Old Interrupt to far jump to. ;------------------------------------------------------------------------------ int_00: push bx ;Save BX register. mov bx,0 ;BX = INT 00h. jmp inc_count ;And inc count of times called. ;------------------------------------------------------------------------------ int_01: push bx mov bx,1 jmp inc_count ;------------------------------ int_02: push bx mov bx,2 jmp inc_count ;------------------------------ int_03: push bx mov bx,3 jmp inc_count ;------------------------------ int_04: push bx mov bx,4 jmp inc_count ;------------------------------ int_05: push bx mov bx,5 jmp inc_count ;------------------------------ int_06: push bx mov bx,6 jmp inc_count ;------------------------------ int_07: push bx mov bx,7 jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_08: push bx mov bx,8 jmp inc_count ;------------------------------ int_09: push bx mov bx,9 jmp inc_count ;------------------------------ int_0a: push bx mov bx,0ah jmp inc_count ;------------------------------ int_0b: push bx mov bx,0bh jmp inc_count ;------------------------------ int_0c: push bx mov bx,0ch jmp inc_count ;------------------------------ int_0d: push bx mov bx,0dh jmp inc_count ;------------------------------ int_0e: push bx mov bx,0eh jmp inc_count ;------------------------------ int_0f: push bx mov bx,0fh jmp inc_count ;------------------------------ int_10: push bx mov bx,10h jmp inc_count ;------------------------------ int_11: push bx mov bx,11h jmp inc_count ;------------------------------ int_12: push bx mov bx,12h jmp inc_count ;------------------------------ int_13: push bx mov bx,13h jmp inc_count ;------------------------------ int_14: push bx mov bx,14h jmp inc_count ;------------------------------ int_15: push bx mov bx,15h jmp inc_count ;------------------------------ int_16: push bx mov bx,16h jmp inc_count ;------------------------------ int_17: push bx mov bx,17h jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_18: push bx mov bx,18h jmp inc_count ;------------------------------ int_19: push bx mov bx,19h jmp inc_count ;------------------------------ int_1a: push bx mov bx,1ah jmp inc_count ;------------------------------ int_1b: push bx mov bx,1bh jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_1c: push bx mov bx,1ch jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_1d: push bx mov bx,1dh jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_1e: push bx mov bx,1eh jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_1f: push bx mov bx,1fh jmp inc_count ;------------------------------ int_20: push bx mov bx,20h jmp inc_count ;------------------------------ int_21: push bx mov bx,21h jmp inc_count ;------------------------------ int_22: push bx mov bx,22h jmp inc_count ;------------------------------ int_23: push bx mov bx,23h jmp inc_count ;------------------------------ int_24: push bx mov bx,24h jmp inc_count ;------------------------------ int_25: push bx mov bx,25h jmp inc_count ;------------------------------ int_26: push bx mov bx,26h jmp inc_count ;------------------------------ int_27: push bx mov bx,27h jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_28: push bx mov bx,28h jmp inc_count ;------------------------------ int_29: push bx mov bx,29h jmp inc_count ;------------------------------ int_2a: push bx mov bx,2ah jmp inc_count ;------------------------------ int_2b: push bx mov bx,2bh jmp inc_count ;------------------------------ int_2c: push bx mov bx,2ch jmp inc_count ;------------------------------ int_2d: push bx mov bx,2dh jmp inc_count ;------------------------------ int_2e: push bx mov bx,2eh jmp inc_count ;------------------------------------------------------------------------------ int_2f: cmp ah,90h ;Is this our Major Function number? ; [Major Functions 80h thru FFh] ; [are program definable. ] je int2f_00 ;If so, process the Minor Function. inc_2f_count: push bx ;Increment counter. mov bx,2fh jmp inc_count ;*** Minor Function 00h = show if INTMON is resident. ***** int2f_00: cmp al,0 ;Minor Function 00h ? jne int2f_01 ;If not, try another. mov ax,0ffffh ;Else, return 0FFFFh to show that jmp short inc_2f_count ; INTMON is resident. ;*** Minor Function 02h = display INTMON data. ***** int2f_01: cmp al,1 ;Minor Function 01h ? jne int2f_02 ;If not, try another. Else: push cs ;ES:SI = Seg:Offs to COUNT_TABLE. pop es mov si,offset cs:count_table mov dx,es ;DX:BX = Seg:Offs to OLD_INTS. mov bx,offset cs:old_ints jmp short inc_2f_count ;*** Minor Function 02h = uninstall INTMON. ***** int2f_02: cmp al,2 ;Minor Function 02h ? jne inc_2f_count ;If not, just increment counter. pushr ;Save the DATA segment, etc. mov ax,2500h ;AH = Set Interrupt Vector. ;AL = the Interrupt Vector Number. lea bx,cs:old_ints ;Use BX as pointer into table. mov cx,256d ;CX = loop count. jmp short start_uninstall ;And begin. loop_uninstall: inc al ;AL = next INT number. add bx,4 ;Advance BX pointer. cmp al,08h ;See if equals INT(s) not hooked. je cont_loop_uninstall ;08h. cmp al,18h ;18h. je cont_loop_uninstall cmp al,1ch ;1Ch - 1Fh. jb start_uninstall cmp al,1fh jbe cont_loop_uninstall cmp al,28h ;28h. je cont_loop_uninstall cmp al,42h ;40h, 41h, 43h - 49h. je start_uninstall cmp al,40h jb start_uninstall cmp al,49h jbe cont_loop_uninstall cmp al,5ah ;5Ah. je cont_loop_uninstall start_uninstall: lds dx,cs:[bx] ;DS:DX = old INT ??h. int 21h ;Call DOS. cont_loop_uninstall: loop loop_uninstall ;Loop until CX = 0. ;----------------------------- mov es,word ptr cs:[2ch] ;ES = segment of this programs ; Enviroment. mov ah,49h ;AH = Release Memory Block. int 21h ;Call DOS. ;----------------------------- push cs pop es ;ES = segment of this programs ; Program Segment Prefix. mov ah,49h ;AH = Release Memory Block. int 21h ;Call DOS. popr ;Restore the DATA segment, etc. iret ;And exit INT for last time. ;------------------------------ int_30: push bx mov bx,30h jmp inc_count ;------------------------------ int_31: push bx mov bx,31h jmp inc_count ;------------------------------ int_32: push bx mov bx,32h jmp inc_count ;------------------------------ int_33: push bx mov bx,33h jmp inc_count ;------------------------------ int_34: push bx mov bx,34h jmp inc_count ;------------------------------ int_35: push bx mov bx,35h jmp inc_count ;------------------------------ int_36: push bx mov bx,36h jmp inc_count ;------------------------------ int_37: push bx mov bx,37h jmp inc_count ;------------------------------ int_38: push bx mov bx,38h jmp inc_count ;------------------------------ int_39: push bx mov bx,39h jmp inc_count ;------------------------------ int_3a: push bx mov bx,3ah jmp inc_count ;------------------------------ int_3b: push bx mov bx,3bh jmp inc_count ;------------------------------ int_3c: push bx mov bx,3ch jmp inc_count ;------------------------------ int_3d: push bx mov bx,3dh jmp inc_count ;------------------------------ int_3e: push bx mov bx,3eh jmp inc_count ;------------------------------ int_3f: push bx mov bx,3fh jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_40: push bx mov bx,40h jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_41: push bx mov bx,41h jmp inc_count ;------------------------------ int_42: push bx mov bx,42h jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_43: push bx mov bx,43h jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_44: push bx mov bx,44h jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_45: push bx mov bx,45h jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_46: push bx mov bx,46h jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_47: push bx mov bx,47h jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_48: push bx mov bx,48h jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_49: push bx mov bx,49h jmp inc_count ;------------------------------ int_4a: push bx mov bx,4ah jmp inc_count ;------------------------------ int_4b: push bx mov bx,4bh jmp inc_count ;------------------------------ int_4c: push bx mov bx,4ch jmp inc_count ;------------------------------ int_4d: push bx mov bx,4dh jmp inc_count ;------------------------------ int_4e: push bx mov bx,4eh jmp inc_count ;------------------------------ int_4f: push bx mov bx,4fh jmp inc_count ;------------------------------ int_50: push bx mov bx,50h jmp inc_count ;------------------------------ int_51: push bx mov bx,51h jmp inc_count ;------------------------------ int_52: push bx mov bx,52h jmp inc_count ;------------------------------ int_53: push bx mov bx,53h jmp inc_count ;------------------------------ int_54: push bx mov bx,54h jmp inc_count ;------------------------------ int_55: push bx mov bx,55h jmp inc_count ;------------------------------ int_56: push bx mov bx,56h jmp inc_count ;------------------------------ int_57: push bx mov bx,57h jmp inc_count ;------------------------------ int_58: push bx mov bx,58h jmp inc_count ;------------------------------ int_59: push bx mov bx,59h jmp inc_count ;------------------------------ ; NOT COUNTED!!! int_5a: push bx mov bx,5ah jmp inc_count ;------------------------------ int_5b: push bx mov bx,5bh jmp inc_count ;------------------------------ int_5c: push bx mov bx,5ch jmp inc_count ;------------------------------ int_5d: push bx mov bx,5dh jmp inc_count ;------------------------------ int_5e: push bx mov bx,5eh jmp inc_count ;------------------------------ int_5f: push bx mov bx,5fh jmp inc_count ;------------------------------ int_60: push bx mov bx,60h jmp inc_count ;------------------------------ int_61: push bx mov bx,61h jmp inc_count ;------------------------------ int_62: push bx mov bx,62h jmp inc_count ;------------------------------ int_63: push bx mov bx,63h jmp inc_count ;------------------------------ int_64: push bx mov bx,64h jmp inc_count ;------------------------------ int_65: push bx mov bx,65h jmp inc_count ;------------------------------ int_66: push bx mov bx,66h jmp inc_count ;------------------------------ int_67: push bx mov bx,67h jmp inc_count ;------------------------------ int_68: push bx mov bx,68h jmp inc_count ;------------------------------ int_69: push bx mov bx,69h jmp inc_count ;------------------------------ int_6a: push bx mov bx,6ah jmp inc_count ;------------------------------ int_6b: push bx mov bx,6bh jmp inc_count ;------------------------------ int_6c: push bx mov bx,6ch jmp inc_count ;------------------------------ int_6d: push bx mov bx,6dh jmp inc_count ;------------------------------ int_6e: push bx mov bx,6eh jmp inc_count ;------------------------------ int_6f: push bx mov bx,6fh jmp inc_count ;------------------------------ int_70: push bx mov bx,70h jmp inc_count ;------------------------------ int_71: push bx mov bx,71h jmp inc_count ;------------------------------ int_72: push bx mov bx,72h jmp inc_count ;------------------------------ int_73: push bx mov bx,73h jmp inc_count ;------------------------------ int_74: push bx mov bx,74h jmp inc_count ;------------------------------ int_75: push bx mov bx,75h jmp inc_count ;------------------------------ int_76: push bx mov bx,76h jmp inc_count ;------------------------------ int_77: push bx mov bx,77h jmp inc_count ;------------------------------ int_78: push bx mov bx,78h jmp inc_count ;------------------------------ int_79: push bx mov bx,79h jmp inc_count ;------------------------------ int_7a: push bx mov bx,7ah jmp inc_count ;------------------------------ int_7b: push bx mov bx,7bh jmp inc_count ;------------------------------ int_7c: push bx mov bx,7ch jmp inc_count ;------------------------------ int_7d: push bx mov bx,7dh jmp inc_count ;------------------------------ int_7e: push bx mov bx,7eh jmp inc_count ;------------------------------ int_7f: push bx mov bx,7fh jmp inc_count ;------------------------------ int_80: push bx mov bx,80h jmp inc_count ;------------------------------ int_81: push bx mov bx,81h jmp inc_count ;------------------------------ int_82: push bx mov bx,82h jmp inc_count ;------------------------------ int_83: push bx mov bx,83h jmp inc_count ;------------------------------ int_84: push bx mov bx,84h jmp inc_count ;------------------------------ int_85: push bx mov bx,85h jmp inc_count ;------------------------------ int_86: push bx mov bx,86h jmp inc_count ;------------------------------ int_87: push bx mov bx,87h jmp inc_count ;------------------------------ int_88: push bx mov bx,88h jmp inc_count ;------------------------------ int_89: push bx mov bx,89h jmp inc_count ;------------------------------ int_8a: push bx mov bx,8ah jmp inc_count ;------------------------------ int_8b: push bx mov bx,8bh jmp inc_count ;------------------------------ int_8c: push bx mov bx,8ch jmp inc_count ;------------------------------ int_8d: push bx mov bx,8dh jmp inc_count ;------------------------------ int_8e: push bx mov bx,8eh jmp inc_count ;------------------------------ int_8f: push bx mov bx,8fh jmp inc_count ;------------------------------ int_90: push bx mov bx,90h jmp inc_count ;------------------------------ int_91: push bx mov bx,91h jmp inc_count ;------------------------------ int_92: push bx mov bx,92h jmp inc_count ;------------------------------ int_93: push bx mov bx,93h jmp inc_count ;------------------------------ int_94: push bx mov bx,94h jmp inc_count ;------------------------------ int_95: push bx mov bx,95h jmp inc_count ;------------------------------ int_96: push bx mov bx,96h jmp inc_count ;------------------------------ int_97: push bx mov bx,97h jmp inc_count ;------------------------------ int_98: push bx mov bx,98h jmp inc_count ;------------------------------ int_99: push bx mov bx,99h jmp inc_count ;------------------------------ int_9a: push bx mov bx,9ah jmp inc_count ;------------------------------ int_9b: push bx mov bx,9bh jmp inc_count ;------------------------------ int_9c: push bx mov bx,9ch jmp inc_count ;------------------------------ int_9d: push bx mov bx,9dh jmp inc_count ;------------------------------ int_9e: push bx mov bx,9eh jmp inc_count ;------------------------------ int_9f: push bx mov bx,9fh jmp inc_count ;------------------------------ int_a0: push bx mov bx,0a0h jmp inc_count ;------------------------------ int_a1: push bx mov bx,0a1h jmp inc_count ;------------------------------ int_a2: push bx mov bx,0a2h jmp inc_count ;------------------------------ int_a3: push bx mov bx,0a3h jmp inc_count ;------------------------------ int_a4: push bx mov bx,0a4h jmp inc_count ;------------------------------ int_a5: push bx mov bx,0a5h jmp inc_count ;------------------------------ int_a6: push bx mov bx,0a6h jmp inc_count ;------------------------------ int_a7: push bx mov bx,0a7h jmp inc_count ;------------------------------ int_a8: push bx mov bx,0a8h jmp inc_count ;------------------------------ int_a9: push bx mov bx,0a9h jmp inc_count ;------------------------------ int_aa: push bx mov bx,0aah jmp inc_count ;------------------------------ int_ab: push bx mov bx,0abh jmp inc_count ;------------------------------ int_ac: push bx mov bx,0ach jmp inc_count ;------------------------------ int_ad: push bx mov bx,0adh jmp inc_count ;------------------------------ int_ae: push bx mov bx,0aeh jmp inc_count ;------------------------------ int_af: push bx mov bx,0afh jmp inc_count ;------------------------------ int_b0: push bx mov bx,0b0h jmp inc_count ;------------------------------ int_b1: push bx mov bx,0b1h jmp inc_count ;------------------------------ int_b2: push bx mov bx,0b2h jmp inc_count ;------------------------------ int_b3: push bx mov bx,0b3h jmp inc_count ;------------------------------ int_b4: push bx mov bx,0b4h jmp inc_count ;------------------------------ int_b5: push bx mov bx,0b5h jmp inc_count ;------------------------------ int_b6: push bx mov bx,0b6h jmp inc_count ;------------------------------ int_b7: push bx mov bx,0b7h jmp inc_count ;------------------------------ int_b8: push bx mov bx,0b8h jmp inc_count ;------------------------------ int_b9: push bx mov bx,0b9h jmp inc_count ;------------------------------ int_ba: push bx mov bx,0bah jmp inc_count ;------------------------------ int_bb: push bx mov bx,0bbh jmp inc_count ;------------------------------ int_bc: push bx mov bx,0bch jmp inc_count ;------------------------------ int_bd: push bx mov bx,0bdh jmp inc_count ;------------------------------ int_be: push bx mov bx,0beh jmp inc_count ;------------------------------ int_bf: push bx mov bx,0bfh jmp inc_count ;------------------------------ int_c0: push bx mov bx,0c0h jmp inc_count ;------------------------------ int_c1: push bx mov bx,0c1h jmp inc_count ;------------------------------ int_c2: push bx mov bx,0c2h jmp inc_count ;------------------------------ int_c3: push bx mov bx,0c3h jmp inc_count ;------------------------------ int_c4: push bx mov bx,0c4h jmp inc_count ;------------------------------ int_c5: push bx mov bx,0c5h jmp inc_count ;------------------------------ int_c6: push bx mov bx,0c6h jmp inc_count ;------------------------------ int_c7: push bx mov bx,0c7h jmp inc_count ;------------------------------ int_c8: push bx mov bx,0c8h jmp inc_count ;------------------------------ int_c9: push bx mov bx,0c9h jmp inc_count ;------------------------------ int_ca: push bx mov bx,0cah jmp inc_count ;------------------------------ int_cb: push bx mov bx,0cbh jmp inc_count ;------------------------------ int_cc: push bx mov bx,0cch jmp inc_count ;------------------------------ int_cd: push bx mov bx,0cdh jmp inc_count ;------------------------------ int_ce: push bx mov bx,0ceh jmp inc_count ;------------------------------ int_cf: push bx mov bx,0cfh jmp inc_count ;------------------------------ int_d0: push bx mov bx,0d0h jmp inc_count ;------------------------------ int_d1: push bx mov bx,0d1h jmp inc_count ;------------------------------ int_d2: push bx mov bx,0d2h jmp inc_count ;------------------------------ int_d3: push bx mov bx,0d3h jmp inc_count ;------------------------------ int_d4: push bx mov bx,0d4h jmp inc_count ;------------------------------ int_d5: push bx mov bx,0d5h jmp inc_count ;------------------------------ int_d6: push bx mov bx,0d6h jmp inc_count ;------------------------------ int_d7: push bx mov bx,0d7h jmp inc_count ;------------------------------ int_d8: push bx mov bx,0d8h jmp inc_count ;------------------------------ int_d9: push bx mov bx,0d9h jmp inc_count ;------------------------------ int_da: push bx mov bx,0dah jmp inc_count ;------------------------------ int_db: push bx mov bx,0dbh jmp inc_count ;------------------------------ int_dc: push bx mov bx,0dch jmp inc_count ;------------------------------ int_dd: push bx mov bx,0ddh jmp inc_count ;------------------------------ int_de: push bx mov bx,0deh jmp inc_count ;------------------------------ int_df: push bx mov bx,0dfh jmp inc_count ;------------------------------ int_e0: push bx mov bx,0e0h jmp inc_count ;------------------------------ int_e1: push bx mov bx,0e1h jmp inc_count ;------------------------------ int_e2: push bx mov bx,0e2h jmp inc_count ;------------------------------ int_e3: push bx mov bx,0e3h jmp inc_count ;------------------------------ int_e4: push bx mov bx,0e4h jmp inc_count ;------------------------------ int_e5: push bx mov bx,0e5h jmp inc_count ;------------------------------ int_e6: push bx mov bx,0e6h jmp inc_count ;------------------------------ int_e7: push bx mov bx,0e7h jmp inc_count ;------------------------------ int_e8: push bx mov bx,0e8h jmp inc_count ;------------------------------ int_e9: push bx mov bx,0e9h jmp inc_count ;------------------------------ int_ea: push bx mov bx,0eah jmp inc_count ;------------------------------ int_eb: push bx mov bx,0ebh jmp inc_count ;------------------------------ int_ec: push bx mov bx,0ech jmp inc_count ;------------------------------ int_ed: push bx mov bx,0edh jmp inc_count ;------------------------------ int_ee: push bx mov bx,0eeh jmp inc_count ;------------------------------ int_ef: push bx mov bx,0efh jmp inc_count ;------------------------------ int_f0: push bx mov bx,0f0h jmp inc_count ;------------------------------ int_f1: push bx mov bx,0f1h jmp inc_count ;------------------------------ int_f2: push bx mov bx,0f2h jmp inc_count ;------------------------------ int_f3: push bx mov bx,0f3h jmp inc_count ;------------------------------ int_f4: push bx mov bx,0f4h jmp inc_count ;------------------------------ int_f5: push bx mov bx,0f5h jmp inc_count ;------------------------------ int_f6: push bx mov bx,0f6h jmp inc_count ;------------------------------ int_f7: push bx mov bx,0f7h jmp inc_count ;------------------------------ int_f8: push bx mov bx,0f8h jmp inc_count ;------------------------------ int_f9: push bx mov bx,0f9h jmp inc_count ;------------------------------ int_fa: push bx mov bx,0fah jmp inc_count ;------------------------------ int_fb: push bx mov bx,0fbh jmp inc_count ;------------------------------ int_fc: push bx mov bx,0fch jmp inc_count ;------------------------------ int_fd: push bx mov bx,0fdh jmp inc_count ;------------------------------ int_fe: push bx mov bx,0feh jmp inc_count ;------------------------------ int_ff: push bx mov bx,0ffh jmp inc_count ;------------------------------------------------------------------------------ inc_count: pushf ;Save current flag state. push ax ;Save AX. shl bx,1 shl bx,1 ;Convert to double word. ;-----------------------------;Increment count table +1. add word ptr cs:count_table[bx],1 adc word ptr cs:count_table[bx+2],0 ;-----------------------------;Initial INT_JUMP. mov ax,word ptr cs:old_ints[bx+2] mov word ptr cs:int_jump[+2],ax mov ax,word ptr cs:old_ints[bx] mov word ptr cs:int_jump,ax ;----------------------------- pop ax ;Restore AX. popf ;Restore old flag state. pop bx ;Restore BX. jmp cs:int_jump ;And FAR JUMP to old routine. ;------------------------------------------------------------------------------ ; Start of initialization code. ;------------------------------------------------------------------------------ install: mov al,byte ptr ds:[80h] ;AL = # characters in the command ; line (from the PSP). cmp al,2 ;Space + 1st argument (U or D) ? jne install_it ;If <> 2, jump. Assume install. ;----------------------------- mov al,byte ptr ds:[82h] ;AL = 1st argument. cmp al,'u' ;Uninstall ? je go_uninstall ;If so, uninstall INTMON. cmp al,'U' ;Uninstall ? je go_uninstall ;If so, uninstall INTMON. cmp al,'d' ;Display collected data ? je disp_dat_req ;If so, display data. cmp al,'D' ;Display collected data ? je disp_dat_req ;If so, display data. ;-----------------------------;If we got this far, invalid input. ; Show the help screen. lea dx,msg01 ;Assume INTMON is installed. call chk_install ;Is INTMON already installed ? jc display_help ;If CY, INTMON is not installed. jmp exit ;If NC, INTMON is installed. display_help: lea dx,msg00 ;DS:DX = address of string. jmp exit ;Display help screen. ;----------------------------- go_uninstall: jmp uninstall ;Short jump is out of range. ;----------------------------- disp_dat_req: call chk_install ;Is INTMON installed ? jc display_help ;If CY, no. Display help screen. mov ax,9001h ;If so, invoke call to INT2F_01. ; AH = INT #, AL = Sub-function. int 2fh ;Call DOS Multiplexer Service. call init_disp_data ;Initial the data display. call display_data ;Display the data. int 20h ;Exit program to DOS. ;----------------------------- install_it: call chk_install ;Is INTMON already installed ? jc install_it2 ;If CY, install INTMON. lea dx,msg03 ;If NC, is already installed. call dos_write_string ;Display message in DS:DX. lea dx,msg01 ;Display help screen. jmp short exit ;----------------------------- install_it2: lea dx,copyright ;Is OK to install. call dos_write_string ;Display message in DS:DX. lea dx,msg01 ;DS:DX = address of string. call dos_write_string ;Display message. ;----------------------------- mov al,0 ;AL = the Interrupt Vector Number. mov cx,256d ;CX = loop count. lea dx,int_00 ;DS:DX = address of new routine. lea si,old_ints ;DS:SI = pointer into OLD_INTS. loop_hook_ints: mov ah,35h ;AH = Get Interrupt Vector. int 21h ;Call DOS. Returns ES:BX pointer. mov word ptr [si],bx ;Store old Seg:Offs for future use. mov word ptr [si+2],es cmp al,8 ;Do not hook these INTs. je cont_hook_ints ;08h. cmp al,18h ;18h. je cont_hook_ints cmp al,1ch ;1Ch - 1Fh. jb do_hook_it cmp al,1fh jbe cont_hook_ints cmp al,28h ;28h. je cont_hook_ints cmp al,42h ;40h - 41h, 43h - 49h. je do_hook_it cmp al,40h jb do_hook_it cmp al,49h jbe cont_hook_ints cmp al,5ah ;5Ah. je cont_hook_ints do_hook_it: mov ah,25h ;AH = Set Interrupt Vector. int 21h ;Call DOS. cont_hook_ints: inc al ;AL = next Interrupt Vector Number. add dx,7 ;DS:DX = next addr of new routine. add si,4 ;DS:SI = pointer into OLD_INTS. cmp al,30h ;INT_2F is pretty long. jne not_int_30 lea dx,int_30 ;DS:DX = address of new routine. not_int_30: loop loop_hook_ints ;Loop until CX = 0. ;----------------------------- lea dx,install ;DS:DX = offset of end of program ; to remain memory resident. ;CS = segment of PSP (automatic). int 27h ;Terminate and Stay Resident. ;----------------------------- exit: call dos_write_string ;Display message in DS:DX. int 20h ;Exit program to DOS. uninstall: call chk_install ;Is INTMON installed ? jnc uninstall_2 ;If NC, yes. Continue. lea dx,msg00 ;DS:DX = address of string. jmp short exit ;And exit program. uninstall_2: mov ax,9002h ;Invoke call to INT2F_02. int 2fh ;Call DOS Multiplexer Service. lea dx,msg02 ;DS:DX = address of string. jmp short exit ;And exit program. ;------------------------------------------------------------------------------ chk_install proc near mov ax,9000h ;Is INTMON already installed ? int 2fh ;Call DOS Multiplexer Service. cmp ax,0ffffh ;AX = FFFF ? je chk_inst2 ;If AX = FFFF, yes. Continue. stc ;Set carry flag. Not installed. ret chk_inst2: clc ;Clear carry flag. Is installed. ret chk_install endp ;------------------------------------------------------------------------------ dos_write_string proc near mov ah,9 ;AH = Display String. int 21h ;Call DOS. ret dos_write_string endp ;------------------------------------------------------------------------------ display_data proc near call clear_screen ;Clear the screen. mov dx,0100h ;DX = where to display the header. call goto_xy ;Position the cursor there. lea dx,header ;DS:DX = address of string. call dos_write_string ;Display the string. mov dx,1500h ;DX = where to display the footer. call goto_xy ;Position the cursor there. lea dx,footer ;DS:DX = address of string. call dos_write_string ;Display the string. mov dx,0500h ;DX = where to display the data. call goto_xy ;Position the cursor there. call disp_next_page ;Display PAGE_1. call read_key ;Read key press. mov dx,1700h ;DX = end of our display. call goto_xy ;Position the cursor there. ret ;And exit. display_data endp ;--------------------------------------------------------------------; ; This procedure reads one key from the keyboard. ; ;--------------------------------------------------------------------; read_key proc near s_read_key: mov ah,0 ;Read Keyboard function. int 16h ;Call BIOS. or al,al ;Is it an extended code ? jz ext_code ;If AL = 0, it is. cmp al,1bh ;ESC key pressed ? jne s_read_key ;If <> 1Bh, try again. ret ;If = 1Bh, exit. ext_code: cmp ah,51h ;PgDn ? jne not_pgdn ;If not, continue check. call disp_next_page ;Else, call DISP_NEXT_PAGE. jmp short s_read_key ;And read another key press. not_pgdn: cmp ah,49h ;PgUp ? jne s_read_key ;If not, try again. call disp_prev_page ;Else, call DISP_PREV_PAGE. jmp short s_read_key ;And read another key press. read_key endp ;------------------------------------------------------------------------------ page_no dw -1 ;Current page number (0 - 3). page_no_offs dw offset page_1 ;Offsets to data pages. dw offset page_2 dw offset page_3 dw offset page_4 disp_next_page proc near inc page_no ;Current page number = + 1. cmp page_no,3 ;Check boundary. jbe gdisp_page ;If < or =, jump. mov page_no,0 ;Else, wrap to first page. gdisp_page: mov bx,page_no ;BX = PAGE_NO. shl bx,1 ;Convert BX to a word. mov dx,[page_no_offs+bx] ;DS:DX = address of string. call dos_write_string ;Display the string. mov dx,0500h ;DX = where to display the data. call goto_xy ;Position the cursor there. ret ;And exit. disp_next_page endp ;----------------------------- disp_prev_page proc near dec page_no ;Current page number = - 1. jns gdisp_page ;If not -1, jump. mov page_no,3 ;Else, wrap to last page. jmp short gdisp_page ;And continue. disp_prev_page endp ;--------------------------------------------------------------------; ; This procedure moves the cursor to the requested screen location. ; ; On entry: DH = row number (0 - 24d). DL = column number (0 - 79d).; ;--------------------------------------------------------------------; goto_xy proc near pushr mov bh,0 ;Display page 0. mov ah,2 ;Call for SET CURSOR POSITION. int 10h ;Call BIOS. popr ret goto_xy endp ;--------------------------------------------------------------------; ; This procedure clears the screen. ; ;--------------------------------------------------------------------; clear_screen proc near pushr mov ah,6 ;Call for SCROLL-UP function. xor al,al ;Blank entire window. mov bh,7 ;Use normal attributes for blanks. xor cx,cx ;Upper left corner is at (0,0). mov dh,24d ;Bottom line of screen is line 24. mov dl,79d ;Right side is at column 79. int 10h ;Call BIOS. popr ret clear_screen endp ;------------------------------------------------------------------------------ init_disp_data proc near pushr ;Push in order of conversion. lea di,ct_addr ;DS:DI = destination. pop ax ;AX = Segment of COUNT_TABLE. call conv_hex_word ;Convert and store it. inc di ;Advance past ":". pop ax ;AX = Offset of COUNT_TABLE. call conv_hex_word ;Convert and store it. ;----------------------------- lea di,ivt_addr ;DS:DI = destination. pop ax ;AX = Segment of OLD_INTS. call conv_hex_word ;Convert and store it. inc di ;Advance past ":". pop ax ;AX = Offset of OLD_INTS. call conv_hex_word ;Convert and store it. ;----------------------------- lea di,page_1 ;DS:DI = where to store conversion. call init_pages ;Convert and store. lea di,page_2 call init_pages lea di,page_3 call init_pages lea di,page_4 call init_pages pop di ret ;And exit. init_disp_data endp ;------------------------------------------------------------------------------ init_pages proc near push cx mov cx,64d ;CX = loop count (4 * 16 lines). add di,6 ;Go to start of storage. linit_pgs: push di ;Save DS:DI. mov ax,es:[si] ;AX = low word. mov dx,es:[si+2] ;DX = high word. add si,4 ;Advance ES:SI pointer. call conv_hex_kbd ;Convert and store it. pop di add di,20d ;Go to next storage point. loop linit_pgs ;Loop until CX = 0. pop cx ret init_pages endp ;--------------------------------------------------------------------; ; Main work horse routine for CONV_HEX_WORD. ; ;--------------------------------------------------------------------; conv_nibble proc near push ax and al,0fh ;#AND# out bits 4-7. cmp al,9 ;Numeral 0 - 9 ? ja al_letter ;If > 9, jump. add al,30h ;Convert to an ASCII numeral. jmp short cnt_cnibble ;And continue. al_letter: add al,37h ;Convert to uppercase ASCII. cnt_cnibble: mov [di],al ;Store the ASCII character. inc di ;Inc ptr to next storage area. pop ax ret conv_nibble endp ;--------------------------------------------------------------------; ; Converts value in AX to ASCII and stores it in DS:DI. ; ;--------------------------------------------------------------------; conv_hex_word proc near pushr mov cl,4 ;CL = shift count. mov dx,4 ;DX = loop count. loop_chex: rol ax,cl ;Rotate value 4 bits. call conv_nibble ;Convert lower 4 bits to ASCII. dec dx ;Decrement loop count. jnz loop_chex ;If DX > 0, do it again. popr ret conv_hex_word endp ;------------------------------------------------------------------------------ hex_kbd_count dw 0 ;Work horse for HK_CONV. hex_kbd_equs dw 0ca00h, 3b9ah, 0e100h, 05f5h, 9680h, 0098h dw 4240h, 000fh, 86a0h, 0001h, 2710h, 0000h dw 03e8h, 0000h, 0064h, 0000h, 000ah, 0000h hex_kbd_loop dw 9 ;Loop count. white_space dw 1 ;Avoid leading zeros. ;--------------------------------------------------------------------; ; Sub-routine and Main Work Horse for CONV_HEX_KBD. ; ;--------------------------------------------------------------------; hk_conv proc near mov hex_kbd_count,0 ;Initialize to 0. jmp short check_hk_conv ;Check for value of 0. cont_hk_conv: mov white_space,0 ;Set flag, no more leading zeros. inc hex_kbd_count ;Inc counter one digit. sub ax,bx ;Subtract the 2 low words. sbb dx,cx ;Sub the 2 high words - the borrow. check_hk_conv: cmp dx,cx ;Check the high words. ja cont_hk_conv ;If DX > CX, subtract again. jb store_hk_conv ;If DX < CX, exit. cmp ax,bx ;Else, DX = CX. Check the low words. jae cont_hk_conv ;Exit only if BX > AX. store_hk_conv: ;Remainder is in DX:AX. mov bx,hex_kbd_count ;BX = hex digit. or bx,bx ;BX = 0 ? jnz no_whitesp cmp white_space,0 ;Leading zeros have been parsed ? jnz ex_hk_conv ;If <> 0, have not been parsed. no_whitesp: add bl,30h ;Convert to ASCII. mov [di],bl ;Store the ASCII numeral. inc di ex_hk_conv: ret hk_conv endp ;--------------------------------------------------------------------; ; This routine converts a 32-bit hex value into ASCII. 4,294,967,295; ; On entry: DX:AX = 32-bit hex value to convert. ; ; DS:DI = address to store ASCII conversion. ; ;--------------------------------------------------------------------; conv_hex_kbd proc near pushr mov white_space,1 ;Avoid leading zeros. mov hex_kbd_loop,9 ;Initial loop count. lea si,hex_kbd_equs ;SI = address of the divisors. or dx,dx ;Now figure out where to begin. jnz dx_not_0 ;If DX <> 0, jump. or ax,ax ;AX = 0 ? jz hconv_1 ;If so, skip the below. dx_not_0: mov bx,[si] ;Initial divisor. BX = low word. mov cx,[si+2] ;CX = high word. add si,4 ;Increment SI pointer. call hk_conv dec hex_kbd_loop ;Decrement loop counter. jnz dx_not_0 ;If <> 0, do it again. hconv_1: add al,30h ;Only one digit left. mov [di],al ;Store it in buffer. popr ret conv_hex_kbd endp ;------------------------------------------------------------------------------ copyright db 'INTMON 1.0 is now installed! Public Domain by James ' db 'R. Webster 03-31-96',0dh,0ah,24h msg00 db 7,'INTMON 1.0 has not been installed!',0dh,0ah msg01 db 'INTerrupt MONiter hooks into all interrupts (except ' db 'for 08h, 18h, 1Ch-1Fh, 28h,',0dh,0ah db '40h, 41h, 43h-49h, and 5Ah) and keeps an internal ' db 'count of how many times',0dh,0ah db 'that each interrupt has been called.',0dh,0ah db 'The memory resident portion takes up 4432 bytes ' db '(A little less than 4.4 k).',0dh,0ah db 'Usage: INTMON [option]',0dh,0ah db ' U Uninstall INTMON.',0dh,0ah db ' D Display how many times each Interrupt ' db 'has been called.',0dh,0ah,24h msg02 db 'INTMON successfully uninstalled.',0dh,0ah,24h msg03 db 7,'INTMON is already uninstalled!',0dh,0ah,24h header db 'INTMON 1.0 by James R. Webster Count Table @ ' ct_addr db '0000:0000 Old IVT @ ' ivt_addr db '0000:0000' db 0dh,0ah db 'Listing of the number of times that each Interrupt ' db 'has been called.' db 0dh,0ah db '(Excluding Interrupts 08h, 18h, 1Ch-1Fh, 28h, 40h, ' db '41h, 43h-49h, and 5Ah.)' db 0dh,0ah db '---------------------------------------' db '---------------------------------------' db 0dh,0ah,'$' footer db '---------------------------------------' db '---------------------------------------' db 0dh,0ah db ' Press: PgDn, PgUp, or ' db 'ESC to quit.' db 0dh,0ah,'$' page_1 db '00h = 01h = ' db '02h = 03h = ' db 0dh,0ah db '04h = 05h = ' db '06h = 07h = ' db 0dh,0ah db '08h = 09h = ' db '0Ah = 0Bh = ' db 0dh,0ah db '0Ch = 0Dh = ' db '0Eh = 0Fh = ' db 0dh,0ah db '10h = 11h = ' db '12h = 13h = ' db 0dh,0ah db '14h = 15h = ' db '16h = 17h = ' db 0dh,0ah db '18h = 19h = ' db '1Ah = 1Bh = ' db 0dh,0ah db '1Ch = 1Dh = ' db '1Eh = 1Fh = ' db 0dh,0ah db '20h = 21h = ' db '22h = 23h = ' db 0dh,0ah db '24h = 25h = ' db '26h = 27h = ' db 0dh,0ah db '28h = 29h = ' db '2Ah = 2Bh = ' db 0dh,0ah db '2Ch = 2Dh = ' db '2Eh = 2Fh = ' db 0dh,0ah db '30h = 31h = ' db '32h = 33h = ' db 0dh,0ah db '34h = 35h = ' db '36h = 37h = ' db 0dh,0ah db '38h = 39h = ' db '3Ah = 3Bh = ' db 0dh,0ah db '3Ch = 3Dh = ' db '3Eh = 3Fh = ' db '$' page_2 db '40h = 41h = ' db '42h = 43h = ' db 0dh,0ah db '44h = 45h = ' db '46h = 47h = ' db 0dh,0ah db '48h = 49h = ' db '4Ah = 4Bh = ' db 0dh,0ah db '4Ch = 4Dh = ' db '4Eh = 4Fh = ' db 0dh,0ah db '50h = 51h = ' db '52h = 53h = ' db 0dh,0ah db '54h = 55h = ' db '56h = 57h = ' db 0dh,0ah db '58h = 59h = ' db '5Ah = 5Bh = ' db 0dh,0ah db '5Ch = 5Dh = ' db '5Eh = 5Fh = ' db 0dh,0ah db '60h = 61h = ' db '62h = 63h = ' db 0dh,0ah db '64h = 65h = ' db '66h = 67h = ' db 0dh,0ah db '68h = 69h = ' db '6Ah = 6Bh = ' db 0dh,0ah db '6Ch = 6Dh = ' db '6Eh = 6Fh = ' db 0dh,0ah db '70h = 71h = ' db '72h = 73h = ' db 0dh,0ah db '74h = 75h = ' db '76h = 77h = ' db 0dh,0ah db '78h = 79h = ' db '7Ah = 7Bh = ' db 0dh,0ah db '7Ch = 7Dh = ' db '7Eh = 7Fh = ' db '$' page_3 db '80h = 81h = ' db '82h = 83h = ' db 0dh,0ah db '84h = 85h = ' db '86h = 87h = ' db 0dh,0ah db '88h = 89h = ' db '8Ah = 8Bh = ' db 0dh,0ah db '8Ch = 8Dh = ' db '8Eh = 8Fh = ' db 0dh,0ah db '90h = 91h = ' db '92h = 93h = ' db 0dh,0ah db '94h = 95h = ' db '96h = 97h = ' db 0dh,0ah db '98h = 99h = ' db '9Ah = 9Bh = ' db 0dh,0ah db '9Ch = 9Dh = ' db '9Eh = 9Fh = ' db 0dh,0ah db 'A0h = A1h = ' db 'A2h = A3h = ' db 0dh,0ah db 'A4h = A5h = ' db 'A6h = A7h = ' db 0dh,0ah db 'A8h = A9h = ' db 'AAh = ABh = ' db 0dh,0ah db 'ACh = ADh = ' db 'AEh = AFh = ' db 0dh,0ah db 'B0h = B1h = ' db 'B2h = B3h = ' db 0dh,0ah db 'B4h = B5h = ' db 'B6h = B7h = ' db 0dh,0ah db 'B8h = B9h = ' db 'BAh = BBh = ' db 0dh,0ah db 'BCh = BDh = ' db 'BEh = BFh = ' db '$' page_4 db 'C0h = C1h = ' db 'C2h = C3h = ' db 0dh,0ah db 'C4h = C5h = ' db 'C6h = C7h = ' db 0dh,0ah db 'C8h = C9h = ' db 'CAh = CBh = ' db 0dh,0ah db 'CCh = CDh = ' db 'CEh = CFh = ' db 0dh,0ah db 'D0h = D1h = ' db 'D2h = D3h = ' db 0dh,0ah db 'D4h = D5h = ' db 'D6h = D7h = ' db 0dh,0ah db 'D8h = D9h = ' db 'DAh = DBh = ' db 0dh,0ah db 'DCh = DDh = ' db 'DEh = DFh = ' db 0dh,0ah db 'E0h = E1h = ' db 'E2h = E3h = ' db 0dh,0ah db 'E4h = E5h = ' db 'E6h = E7h = ' db 0dh,0ah db 'E8h = E9h = ' db 'EAh = EBh = ' db 0dh,0ah db 'ECh = EDh = ' db 'EEh = EFh = ' db 0dh,0ah db 'F0h = F1h = ' db 'F2h = F3h = ' db 0dh,0ah db 'F4h = F5h = ' db 'F6h = F7h = ' db 0dh,0ah db 'F8h = F9h = ' db 'FAh = FBh = ' db 0dh,0ah db 'FCh = FDh = ' db 'FEh = FFh = ' db '$' _TEXT ends end start comment \ 4,294,967,295 .......... INTMON 1.0 by James R. Webster Count Table @ 0000:0000 Old IVT @ 0000:0000 Listing of the number of times that each Interrupt has been called. (Excluding Interrupts 08h, 18h, 1Ch-1Fh, 28h, 40h, 41h, 43h-49h, and 5Ah.) ------------------------------------------------------------------------------ 1 7 21 27 41 47 61 67 00h = .......... 01h = .......... 02h = .......... 03h = .......... +20 ------------------------------------------------------------------------------' Press: PgDn, PgUp, or ESC to quit. \