 The IBM Personal Computer MACRO Assembler 01-13-85    	PAGE	1-1



1	 	 	 	 	comment *  parint.com (c) 1984 by david
	 	 	 	 g hunter.
2	 	 	 	 	 	this program may be freely copi
	 	 	 	ed but not be sold for profit.
3	 	 	 	 	 	parint.com detects parity error
	 	 	 	s, logs them on the printer if
4	 	 	 	 	 	possible, beeps, and returns to
	 	 	 	 program execution.  the system
5	 	 	 	 	 	does not halt when this program
	 	 	 	 is resident.  parity error 
6	 	 	 	 	 	checking is terminated after th
	 	 	 	e first error is detected.  The 
7	 	 	 	 	 	error message includes the time
	 	 	 	 of the event.  If the printer 
8	 	 	 	 	 	is not available, the errors ar
	 	 	 	e logged to the screen.
9	 	 	 	 	*
10	 	 	 	 	;****************addresses of interrupt
	 	 	 	 handlers *******************
11	 0000	 	 	 	book	segment at 0h	;this is where 
	 	 	 	the interrupt address book is
12	 0008	 	 	 	 	org	2h*4
13	 0008	 	 	 	int_2	label	dword	;address of nmi
	 	 	 	 handler
14	 0008	 	 	 	book	ends
15	 	 	 	 	
16	 	 	 	 	;***************beginning of parint ins
	 	 	 	tructions *******************
17	 0000	 	 	 	cseg 	segment
18	 	 	 	 	 	assume cs:cseg
19	 0100	 	 	 	 	org 100h
20	 0100  E9 024A R	 	start:	jmp	newvec	;install new nm
	 	 	 	i handler in ram
21	 	 	 	 	;***************nmi handler************
	 	 	 	*****************************
22	 0103	 	 	 	newint	proc	near	;new interrupt 
	 	 	 	handler
23	 	 	 	 	 	assume ds:cseg, es:cseg
24	 0103  FB	 	 	 	sti	;this flag was cleared 
	 	 	 	when interrupt was issued
25	 0104  E9 0199 R	 	 	jmp 	go	;jump over more
	 	 	 	 data
26	 	 	 	 	;**********************data************
	 	 	 	****************
27	 0107  90	 	 	getout:	nop
28	 0108  EA	 	 	instruc	db	0EAh	;this is the ju
	 	 	 	mp-immediate instruction!
29	 	 	 	 	 	 	 	;it jumps to th
	 	 	 	e address stored in oldint.
30	 0109  00 00 00 00	 	oldint	dd	 	;address of old
	 	 	 	 interrupt 2 routine
31	 010D  0004	 	 	device1	dw	0004	;printer
32	 010F  0001	 	 	device2	dw	0001	;standard outpu
 The IBM Personal Computer MACRO Assembler 01-13-85    	PAGE	1-2



	 	 	 	t device
33	 0111  0D 0A 50 61 72 69	par1	db	0Dh,0Ah,"Parity Error: 
	 	 	 	Main Board     ",07h,0Dh,0Ah
34	       74 79 20 45 72 72	
35	       6F 72 3A 20 4D 61	
36	       69 6E 20 42 6F 61	
37	       72 64 20 20 20 20	
38	       20 07 0D 0A	 	
39	 0133  0D 0A 50 61 72 69	par2	db	0Dh,0Ah,"Parity Error: 
	 	 	 	Expansion Board",07h,0Dh,0Ah
40	       74 79 20 45 72 72	
41	       6F 72 3A 20 45 78	
42	       70 61 6E 73 69 6F	
43	       6E 20 42 6F 61 72	
44	       64 07 0D 0A	 	
45	 0155  20 20 20 20 54 49	time	db	"    TIME:  "
46	       4D 45 3A 20 20	 	
47	 0160  3030	 	 	hour	dw	"00"
48	 0162  3A	 	 	 	db	":"
49	 0163  3030	 	 	min	dw	"00"
50	 0165  20 20 20 20 20 20	 	db	"                ",0Dh,
	 	 	 	0Ah
51	       20 20 20 20 20 20	
52	       20 20 20 20 0D 0A	
53	 0177  50 41 52 49 54 59	paroff	db	"PARITY CHECKING NOW DI
	 	 	 	SABLED   ",0Dh,0Ah,0Ah
54	       20 43 48 45 43 4B	
55	       49 4E 47 20 4E 4F	
56	       57 20 44 49 53 41	
57	       42 4C 45 44 20 20	
58	       20 0D 0A 0A	 	
59	 0199  51	 	 	go:	push 	cx
60	 019A  1E	 	 	 	push 	ds
61	 019B  9C	 	 	 	pushf
62	 019C  52	 	 	 	push	dx
63	 019D  53	 	 	 	push	bx
64	 019E  50	 	 	 	push	ax
65	 019F  9C	 	 	 	pushf
66	 01A0  B0 00	 	 	 	mov	al,00h
67	 01A2  E6 A0	 	 	 	out	0A0h, al
68	 01A4  33 C9	 	 	 	xor	cx,cx
69	 01A6  E4 62	 	 	 	in	al, 62h
70	 	 	 	 	 	;	find origin of nmi
71	 01A8  A8 40	 	 	 	test	al, 40h
72	 01AA  74 06	 	 	 	jz 	mother
73	 01AC  BA 0133 R	 	 	mov 	dx, offset par2	;if bit
	 	 	 	 6 set, error is on expansion bd
74	 01AF  EB 16 90	 	 	 	jmp	out
75	 01B2  A8 80	 	 	mother:	test 	al,80h
76	 01B4  74 06	 	 	 	jz 	other
77	 01B6  BA 0111 R	 	 	mov	dx, offset par1	;if bit
	 	 	 	 7 set, error is on main board
78	 01B9  EB 0C 90	 	 	 	jmp	out
 The IBM Personal Computer MACRO Assembler 01-13-85    	PAGE	1-3



79	 01BC  81 C9 0001	 	other:	or	cx, 1h
80	 01C0  B0 80	 	 	 	mov	al, 80h
81	 01C2  E6 A0	 	 	 	out 	0A0h, al
82	 01C4  EB 23 90	 	 	 	jmp	noprt	;don't print me
	 	 	 	ssage if no parity error
83	 	 	 	 	;	print error message and exit
84	 01C7  8C C8	 	 	out:	mov	ax,cs
85	 01C9  8E D8	 	 	 	mov	ds,ax
86	 01CB  E8 021A R	 	 	call	whatime	;get time of er
	 	 	 	ror
87	 01CE  8B 1E 010D R	 	 	mov	bx, device1
88	 01D2  83 FB 04	 	 	 	cmp	bx,0004
89	 01D5  75 03	 	 	 	jne	f1
90	 01D7  E8 01FC R	 	 	call	testprt
91	 01DA  E8 0210 R	 	f1:	call	print
92	 01DD  BA 0155 R	 	 	mov	dx, offset time ;"time 
	 	 	 	of error" message
93	 01E0  E8 0210 R	 	 	call	print
94	 01E3  BA 0177 R	 	 	mov	dx, offset paroff
95	 01E6  E8 0210 R	 	 	call	print
96	 01E9  9D	 	 	noprt:	popf
97	 01EA  58	 	 	 	pop	ax
98	 01EB  5B	 	 	 	pop	bx
99	 01EC  5A	 	 	 	pop	dx
100	 01ED  9D	 	 	 	popf
101	 01EE  1F	 	 	 	pop	ds
102	 01EF  F7 C1 0001	 	 	test	cx, 1h
103	 01F3  75 02	 	 	 	jnz	oth
104	 01F5  59	 	 	 	pop	cx
105	 01F6  CF	 	 	 	iret
106	 	 	 	 	;	if no parity error, give contro
	 	 	 	l to pre-existing nmi handler
107	 	 	 	 	; this is done by restoring ds and jump
	 	 	 	ing to the instruction that
108	 	 	 	 	; specifies the address of the old inte
	 	 	 	rrupt routine.  This unusual 
109	 	 	 	 	; exit is necessary because otherwise, 
	 	 	 	once ds was restored, the
110	 	 	 	 	; address of the old interrupt routine 
	 	 	 	would not be accessible.
111	 01F7  FA	 	 	oth:	cli
112	 01F8  59	 	 	 	pop	cx
113	 01F9  E9 0107 R	 	 	jmp	getout
114	 01FC	 	 	 	newint	endp
115	 	 	 	 	;********************subroutines*******
	 	 	 	*****************8
116	 01FC	 	 	 	testprt	proc	near
117	 01FC  52	 	 	 	push	dx
118	 01FD  50	 	 	 	push	ax
119	 01FE  33 D2	 	 	 	xor	dx,dx
120	 0200  B4 02	 	 	 	mov	ah,2
121	 0202  CD 17	 	 	 	int	17h
122	 0204  F6 C4 29	 	 	 	test	ah,00101001b
 The IBM Personal Computer MACRO Assembler 01-13-85    	PAGE	1-4



123	 0207  74 04	 	 	 	jz	aok
124	 0209  8B 1E 010F R	 	 	mov	bx, device2
125	 020D  58	 	 	aok:	pop	ax
126	 020E  5A	 	 	 	pop	dx
127	 020F  C3	 	 	 	ret
128	 0210	 	 	 	testprt endp
129	 0210	 	 	 	print	proc	near
130	 0210  51	 	 	 	push	cx
131	 0211  B9 0022	 	 	 	mov	cx,34	;34 characters 
	 	 	 	to print
132	 0214  B4 40	 	 	 	mov	ah,40h	;dos function c
	 	 	 	all
133	 0216  CD 21	 	 	 	int	21h
134	 0218  59	 	 	 	pop	cx
135	 0219  C3	 	 	 	ret
136	 021A	 	 	 	print	endp
137	 021A	 	 	 	whatime	proc	near
138	 021A  51	 	 	 	push	cx
139	 021B  52	 	 	 	push	dx
140	 021C  B4 2C	 	 	 	mov	ah,2Ch
141	 021E  CD 21	 	 	 	int	21h
142	 0220  8A C5	 	 	 	mov	al,ch
143	 0222  E8 0241 R	 	 	call	convt
144	 0225  C7 06 0160 R 3030	 	mov	hour,"00"
145	 022B  01 06 0160 R	 	 	add	hour,ax
146	 022F  8A C1	 	 	 	mov	al,cl
147	 0231  E8 0241 R	 	 	call	convt	;do same for mi
	 	 	 	nutes (0-59)
148	 0234  C7 06 0163 R 3030	 	mov	min,"00"
149	 023A  01 06 0163 R	 	 	add	min,ax
150	 023E  5A	 	 	 	pop	dx
151	 023F  59	 	 	 	pop	cx
152	 0240  C3	 	 	 	ret
153	 0241	 	 	 	whatime	endp
154	 0241	 	 	 	convt	proc	near	;convert number
	 	 	 	 (100) to ascii. number is in al
155	 0241  32 E4	 	 	 	xor	ah,ah
156	 0243  51	 	 	 	push	cx
157	 0244  B1 0A	 	 	 	mov	cl,10
158	 0246  F6 F1	 	 	 	div	cl
159	 0248  59	 	 	 	pop	cx
160	 0249  C3	 	 	little:	ret
161	 024A	 	 	 	convt	endp
162	 	 	 	 	;*******************install nmi handler
	 	 	 	*********************8
163	 024A	 	 	 	newvec	proc	near
164	 024A  EB 45 90	 	 	 	jmp	past
165	 024D  0D 0A 50 41 52 49	loaded	db	0Dh,0Ah,"PARITY ERROR I
	 	 	 	NTERCEPTOR V2.00 BY DAVID HUNTER IS NOW"
166	       54 59 20 45 52 52	
167	       4F 52 20 49 4E 54	
168	       45 52 43 45 50 54	
169	       4F 52 20 56 32 2E	
 The IBM Personal Computer MACRO Assembler 01-13-85    	PAGE	1-5



170	       30 30 20 42 59 20	
171	       44 41 56 49 44 20	
172	       48 55 4E 54 45 52	
173	       20 49 53 20 4E 4F	
174	       57	 	 	
175	 0284  20 49 4E 53 54 41	 	DB	" INSTALLED",0DH,0AH,"$
	 	 	 	"
176	       4C 4C 45 44 0D 0A	
177	       24	 	 	
178	 0291  BA 024D R	 	past:	mov	dx, offset loaded
179	 0294  B4 00	 	 	 	mov	ah,0
180	 0296  CD 21	 	 	 	int	21h
181	 	 	 	 	 	assume	ds:book
182	 0298  1E	 	 	 	push	ds
183	 0299  B8  ---- R	 	 	mov	ax,book
184	 029C  8E D8	 	 	 	mov	ds,ax
185	 029E  B0 00	 	 	 	mov	al, 00h
186	 02A0  E6 A0	 	 	 	out	0A0h, al
187	 02A2  A1 0008 R	 	 	mov	ax,int_2
188	 02A5  2E: A3 0109 R	 	 	mov	oldint,ax
189	 02A9  A1 000A R	 	 	mov	ax,int_2[2]
190	 02AC  2E: A3 010B R	 	 	mov	oldint[2],ax
191	 02B0  C7 06 0008 R 0103 R	 	mov	int_2, offset newint
192	 02B6  8C 0E 000A R	 	 	mov	int_2[2],cs
193	 02BA  B0 80	 	 	 	mov	al, 80h
194	 02BC  E6 A0	 	 	 	out	0A0h, al
195	 02BE  BA 024A R	 	 	mov	dx, offset newvec
196	 02C1  CD 27	 	 	 	int 	27h
197	 02C3	 	 	 	newvec	endp
198	 02C3	 	 	 	cseg	ends
199	 	 	 	 	 	end	start

 The IBM Personal Computer MACRO Assembler 01-13-85    	PAGE	Symbols
	 	 	 	-1



Segments and groups:

	 	N a m e	 	 	Size	align	combine	class

BOOK . . . . . . . . . . . . . .	0008	AT    	0000	
CSEG . . . . . . . . . . . . . .	02C3	PARA  	NONE	

Symbols:            

	 	N a m e	 	 	Type	Value	Attr         

AOK. . . . . . . . . . . . . . .	L NEAR 	020D	CSEG
CONVT. . . . . . . . . . . . . .	N PROC	0241	CSEG	Length =0009
DEVICE1. . . . . . . . . . . . .	L WORD 	010D	CSEG
DEVICE2. . . . . . . . . . . . .	L WORD 	010F	CSEG
F1 . . . . . . . . . . . . . . .	L NEAR 	01DA	CSEG
GETOUT . . . . . . . . . . . . .	L NEAR 	0107	CSEG
GO . . . . . . . . . . . . . . .	L NEAR 	0199	CSEG
HOUR . . . . . . . . . . . . . .	L WORD 	0160	CSEG
INSTRUC. . . . . . . . . . . . .	L BYTE 	0108	CSEG
INT_2. . . . . . . . . . . . . .	L DWORD	0008	BOOK
LITTLE . . . . . . . . . . . . .	L NEAR 	0249	CSEG
LOADED . . . . . . . . . . . . .	L BYTE 	024D	CSEG
MIN. . . . . . . . . . . . . . .	L WORD 	0163	CSEG
MOTHER . . . . . . . . . . . . .	L NEAR 	01B2	CSEG
NEWINT . . . . . . . . . . . . .	N PROC	0103	CSEG	Length =00F9
NEWVEC . . . . . . . . . . . . .	N PROC	024A	CSEG	Length =0079
NOPRT. . . . . . . . . . . . . .	L NEAR 	01E9	CSEG
OLDINT . . . . . . . . . . . . .	L DWORD	0109	CSEG
OTH. . . . . . . . . . . . . . .	L NEAR 	01F7	CSEG
OTHER. . . . . . . . . . . . . .	L NEAR 	01BC	CSEG
OUT. . . . . . . . . . . . . . .	L NEAR 	01C7	CSEG
PAR1 . . . . . . . . . . . . . .	L BYTE 	0111	CSEG
PAR2 . . . . . . . . . . . . . .	L BYTE 	0133	CSEG
PAROFF . . . . . . . . . . . . .	L BYTE 	0177	CSEG
PAST . . . . . . . . . . . . . .	L NEAR 	0291	CSEG
PRINT. . . . . . . . . . . . . .	N PROC	0210	CSEG	Length =000A
START. . . . . . . . . . . . . .	L NEAR 	0100	CSEG
TESTPRT. . . . . . . . . . . . .	N PROC	01FC	CSEG	Length =0014
TIME . . . . . . . . . . . . . .	L BYTE 	0155	CSEG
WHATIME. . . . . . . . . . . . .	N PROC	021A	CSEG	Length =0027

Warning Severe
Errors	Errors 
0	0
