ralf@B.GP.CS.CMU.EDU (Ralf Brown) (02/14/88)
Steve Conklin sent me this because he can't post. Please direct any
correspondence to him at {backbone}!ingr!tesla!steve, not to me.
#! /bin/sh
#
# this is a shell archive, meaning:
# 1. remove everything above the #! /bin/sh line
# 2. save the resulting text in a file
# 3. execute the file with /bin/sh (not csh) to create the files:
# INTS.DOC
# INTS.ASM
# INTS.EXE.UU
# created: 14:44:53 (02/09/88)
# on node: tesla
# by: steve (Steve Conklin @ Intergraph)
export PATH; PATH=/bin:/usr/bin:
if test -f 'INTS.DOC'
then
echo "shar: will not over-write existing file:'INTS.DOC'"
else
echo "x - INTS.DOC"
cat <<\!SHAR_EOF! >'INTS.DOC'
INTS will show you the contents of the zero-page interrupt vectors on a
PC or clone. It will print a list of the interrupt numbers, with the
associated segment:offset addresses. If the vector contains a zero, that
interrupt will not be displayed. If it is non-zero, the first location
of the interrupt service routine is examined, and if it is an IRET (interrupt
return) instruction, then "--> IRET" is printed next to the address.
All values are printed in hexadecimal.
The most common use of this routine is to determine which interrupts a TSR
is stealing. To do this, run ints with and without the TSR loaded, directing
output into files, then compare the two files.
Glancing thru the code now, I see some things that might be redundant, but
it works, so I'm not going to fix it.
Constructive comments are welcome.
Steve Conklin {uunet,ihnp4}!ingr!tesla!steve
Intergraph Corp.
Huntsville, AL 35807
(205) 772-6888
Relax, Don't worry, Have a homebrew.
!SHAR_EOF!
if [ ` wc -c < 'INTS.DOC'` -ne 971 ]
then
echo "'INTS.DOC' damaged in transit"
echo " received: `wc -c < INTS.DOC` characters"
echo " original: 971 characters"
fi
fi
if test -f 'INTS.ASM'
then
echo "shar: will not over-write existing file:'INTS.ASM'"
else
echo "x - INTS.ASM"
cat <<\!SHAR_EOF! >'INTS.ASM'
PAGE 60,132
TITLE INTS.ASM - A program to list interrupt vectors
;INTS.ASM
; This program should list the interrupt vectors found in page zero.
; It runs under DOS 3.2, and should work with all 3.x versions -
; I think that the only thing that makes it version dependent is the
; terminate with return code function.
;
; Steve Conklin - 12/6/86
; uunet!ingr!tesla!steve
; Intergraph Corp. (205) 772-6888
;
;
CRLF EQU 0D0AH
DATA_SEG SEGMENT
XLAT_TABLE DB '0123456789ABCDEF'
HEADER DB 'Listing of interrupt vectors for MS-DOS'
DW CRLF
DW CRLF
DB 'Vectors containing 0000:0000 will not be listed.'
DW CRLF
DW CRLF
DB 'INT VECTOR'
DW CRLF
DB '--- ------'
DW CRLF
DB '$'
INT_MSG DB ' '
INT_VAL DB 'XX'
DB ' - '
VEC_SEG DB 'XXXX:'
VEC_OFF DB 'XXXX'
DB '$'
IRET_MSG DB ' --> IRET'
DB '$'
DATA_SEG ENDS
CODE_SEG SEGMENT
ASSUME CS:CODE_SEG,DS:DATA_SEG
START:
MOV AX,DATA_SEG ;set up data segment register
MOV DS,AX
MOV DX,OFFSET HEADER ;offset of sign-on
MOV AH,09H ;request 09 - send string to std out
INT 21H ;print it
MOV AL,00 ;start with int vector 00
DO_IT:
MOV AH,35h ;int 21h request 35h - return vector
MOV DI,OFFSET INT_VAL ;Put INT value in string
CALL BYTEHEX ;
INT 21H
PUSH AX ;see if vector is 0000:0000
PUSH ES ;and don't print it if it is
POP AX ;
CMP AX,0000H ;
JNE O_K ;
MOV AX,BX ;
CMP AX,0000H ;
JNE O_K ;
POP AX ;
JMP SKIP_IT ;
O_K: POP AX ;
PUSH AX
MOV AX,ES ;get vector CS in AX
MOV DI,OFFSET VEC_SEG ;convert and put in string
CALL BINHEX ;
MOV AX,BX ;get vector IP in AX
MOV DI,OFFSET VEC_OFF ;convert and put in string
CALL BINHEX ;
MOV AH,09H ;print string to std out
MOV DX,OFFSET INT_MSG
INT 21H ;print it
;see if vector points to an IRET, and print something if it does.
MOV AX,ES:[BX] ;get the word at ES:BX
CMP AL,0CFH ;IRET is CF hex
JNE FINI
MOV AH,09H ;print string to std out
MOV DX,OFFSET IRET_MSG
INT 21H ;print it
;finish up
FINI:
CALL SEND_CRLF ;print a newline
POP AX
SKIP_IT:
CMP AL,255
JE DONE
INC AL
JMP DO_IT
DONE:
MOV AH,4CH ;terminate process
MOV AL,00H ;normal return code
INT 21H
; SEND_CRLF will send a carriage return and line feed to std out
SEND_CRLF PROC NEAR
PUSH AX
PUSH DX
MOV AH,02H ;send char to active display
MOV DL,0DH ;carriage return
INT 21H ;do it
MOV DL,0AH ;line feed
INT 21H ;do it
POP DX
POP AX
RET
SEND_CRLF ENDP
; BINHEX will take the value in AX and convert it into four hex ASCII
; bytes and put them at the location given in DS:DI, MSB first.
BINHEX PROC NEAR
PUSH BX
PUSH CX
PUSH DX
PUSH ES
PUSH AX
PUSH AX
MOV AX,DS ;ES is segment for string store instruction
MOV ES,AX ;so copy DS there
POP AX
MOV BX,OFFSET XLAT_TABLE ;set up for translation
CLD ;make sure direction is set to inc DI
MOV DX,AX ;save a copy
MOV AL,DH ;then get the high byte into AL
MOV CL,4 ;and shift the most sig. nybble into
SHR AL,CL ;the low nybble of AL (SHR shifts in zeros)
XLAT XLAT_TABLE ;do the translation
STOSB ;move AL to ES:DI
MOV AL,DH ;get a copy of the next nybble into AL
AND AL,0FH ;and isolate it
XLAT XLAT_TABLE
STOSB
MOV AL,DL ;third nybble
MOV CL,4 ;shift it
SHR AL,CL
XLAT XLAT_TABLE
STOSB
MOV AL,DL ;least significant nybble
AND AL,0FH ;isolate
XLAT XLAT_TABLE
STOSB
POP AX
POP ES
POP DX
POP CX
POP BX
RET
BINHEX ENDP
; Bytehex will take the value in AL and convert it into two hex ASCII
; bytes and put them at the location given in DI, MSB first.
BYTEHEX PROC NEAR
PUSH BX
PUSH CX
PUSH DX
PUSH ES
PUSH AX
PUSH AX
MOV AX,DS ;ES is segment for string store instruction
MOV ES,AX ;
POP AX
MOV BX,OFFSET XLAT_TABLE ;set up for translation
CLD ;make sure direction is set to inc DI
MOV DX,AX ;save a copy
MOV AL,DL ;first nybble
MOV CL,4 ;shift it
SHR AL,CL
XLAT XLAT_TABLE
STOSB
MOV AL,DL ;last nybble
AND AL,0FH ;isolate
XLAT XLAT_TABLE
STOSB
POP AX
POP ES
POP DX
POP CX
POP BX
RET
BYTEHEX ENDP
CODE_SEG ENDS
END START ;Make sure we start at "START" first time.
!SHAR_EOF!
if [ ` wc -c < 'INTS.ASM'` -ne 4143 ]
then
echo "'INTS.ASM' damaged in transit"
echo " received: `wc -c < INTS.ASM` characters"
echo " original: 4143 characters"
fi
fi
if test -f 'INTS.EXE.UU'
then
echo "shar: will not over-write existing file:'INTS.EXE.UU'"
else
echo "x - INTS.EXE.UU"
cat <<\!SHAR_EOF! >'INTS.EXE.UU'
begin 664 INTS.EXE
M35IV 0( 0 @ __\ 66, '@ $ 0
M
M
M
M
M
M
M
M
M
M
M "X#0".V+H0 +0)S2&P +0UOXT Z) S2%0!E@]
M !U"XO#/0 =018ZRR06%",P+^2 .@^ (O#OY< Z#8 M FZC #-(2:+!SS/
M=0>T";J< ,TAZ \ 6#S_= 3^P.NPM$RP ,TA4%*T K(-S2&R"LTA6EC#4U%2
M!E!0C-B.P%B[ #\B]"*QK$$TNC7JHK&) _7JHK"L032Z->JBL(D#]>J6 =:
M65O#4U%2!E!0C-B.P%B[ #\B]"*PK$$TNC7JHK") _7JE@'6EE;PP
M,#$R,S0U-C<X.4%"0T1%1DQI<W1I;F<@;V8@:6YT97)R=7!T('9E8W1O<G,@
M9F]R($U3+41/4PH-"@U696-T;W)S(&-O;G1A:6YI;F<@,# P,#HP,# P('=I
M;&P@;F]T(&)E(&QI<W1E9"X*#0H-24Y4(" @5D5#5$]2"@TM+2T@(" M+2TM
?+2T*#20@6%@@+2!86%A8.EA86%@D("TM/B!)4D54)$]2
end
!SHAR_EOF!
if [ ` wc -c < 'INTS.EXE.UU'` -ne 1249 ]
then
echo "'INTS.EXE.UU' damaged in transit"
echo " received: `wc -c < INTS.EXE.UU` characters"
echo " original: 1249 characters"
fi
fi
exit 0
# end of shell archive
--
{harvard,uunet,ucbvax}!b.gp.cs.cmu.edu!ralf -=-=- AT&T: (412)268-3053 (school)
ARPA: RALF@B.GP.CS.CMU.EDU |"Tolerance means excusing the mistakes others make.
FIDO: Ralf Brown at 129/31 | Tact means not noticing them." --Arthur Schnitzler
BITnet: RALF%B.GP.CS.CMU.EDU@CMUCCVMA -=-=- DISCLAIMER? I claimed something?