
.386

closed_pos	EQU (16*80+80-16)*2

main_seg		SEGMENT	USE16
	ASSUME	CS:main_seg
	ASSUME	DS:main_seg
	ORG	100h

com_entry:	jmp	start_up
	ORG	103h
		DB	'UILM'
		DW	offset low_mem_end-100h
		DD	offset high_mem_end-offset high_mem_start
		DD	offset high_mem_start-100h
		DW	111101111111b		;load, unload, external hk
;			  ^8  ^4  ^0
		DB	0
		DD	0
		DB	'Interrupt help v1',0
		DB	'ITH1'

start_up		PROC	NEAR
		push		edi
		push		si
		push		ds
		mov		ah,0
		int		32h
		pop		es
		pop		si
		pop		edi
		push		cs
		pop		ds
		cmp		ax,'IS'
		jne	dos_call
		test		cl,100b		;uilm execution
		jz	dos_call
		shr		cl,3
		and		cl,111b
		cmp		cl,101b		;termin call before unloading
		je	uninstall
		cmp		cl,100b		;start up call after loaded
		je	install

		mov		ah,02h		;hotkey call
		int		32h
		mov		ax,cs
		mov		ds,ax
		mov		es,ax
		xor		ax,ax
		mov		di,offset _int
		mov		cx,6
		rep stosw
		stosb

		mov		win_lines,38
		mov		window_pos,10*160
		push		word ptr status
		mov		status,2
		call	far ptr handler_entry
		pop		word ptr status
		mov		al,21h
		retf
start_up		ENDP
;****************************************************************************
handler			PROC	FAR
		push		cs
		pop		ds
		cmp		al,1
		jne	@@no_remove
		cmp		[old_handler],ebx
		jne	@@jump
		mov		[old_handler],ecx
		retf
@@jump:		jmp	dword ptr [old_handler]
@@no_remove:						;check int
		mov		bx,0ff00h
		mov		ax,01502h
		int		32h
	;>esi	address at current line
	;>bl	current line number
		mov		ah,07h
		int		32h
		mov		ax,es:[si]
		cmp		byte ptr es:[si+32h],81h
		push		cs
		pop		es
		je	@@usual_look
		cmp		[old_handler],0
		jne	@@old_handler
		mov		ax,-1
		call	disassemble

		mov		si,offset $closed_look
		mov		di,closed_pos
		call	write_string
@@key_ret:	mov		ah,0
		int		16h
		jmp	@@write_closed
@@old_handler:	call	dword ptr [old_handler]
@@write_closed:	cmp		status,0
		jne	@@check_hotkey
		mov		si,offset $closed_look
		mov		di,closed_pos
		call	write_string
@@check_hotkey:	cmp		al,'2'
		jne	@@not_hotkey
		mov		status,2
		jmp	@@enabled_win
@@not_hotkey:	retf

@@usual_look:	mov		di,offset int_data
		mov		first_line,0
		mov		link_cur,0
		cmp		al,0cdh
		jne	@@dont_read_next
		mov		al,ah
		jmp	@@set_int
@@dont_read_next:
		cmp		al,0cch
		jne	@@no_int3
		mov		al,03h
		jmp	@@set_int
@@no_int3:	mov		al,04h
@@set_int:	stosb
		lds		si,cs:[register_pos]
		mov		cx,6			;six regs
@@transfer:	lodsd
		xchg		al,ah
		stosw
		loop	@@transfer
		push		cs
		pop		ds

		mov		cx,12*160
		mov		ax,2313h
		cmp		bl,11h
		ja	@@upper_position
		mov		ax,1100h
		mov		cx,30*160
@@upper_position:
		mov		window_pos,cx
		mov		win_lines,15
		call	disassemble
		cmp		status,2
		je	@@enabled_win
;inactive
		mov		help_ofs,offset $help_line_
		mov		win_style,'Ä'
		call	setup_data
		jc	@@key_ret
		call	find_start
		jc	@@close_end
		jz	@@found_i
@@find_loop_i:	mov		ah,1
		int		16h
		jnz	@@close_end
		call	find_help
		jc	@@close_end
		jnz	@@find_loop_i
@@found_i:	call	write_data
@@close_end:	mov		ah,3eh
		int		21h
		mov		bx,list_handle
		mov		ah,3eh
		int		21h
		jmp	@@key_ret


@@enabled_win:	
handler_entry:	mov		help_ofs,offset $help_line
		mov		win_style,'Í'
		call	setup_data
		jc	@@key_ret
@@search:	call	show_win
		call	find_start
		jc	@@close_end
		jz	@@found_a
@@find_loop_a:	call	find_help
		jc	@@close_end
		jnz	@@find_loop_a
@@found_a:
@@draw_loop:	call	write_data
@@input_loop:	mov		ah,0
		int		16h
		cmp		al,'-'
		jne	@@no_minus
		mov		ax,current
		or		ax,ax
		jz	@@input_loop
		dec		ax
@@set_new_:	mov		left,ax
		mov		right,ax
		mov		current,ax
		call	show_win
		jmp	@@find_loop_a
@@no_minus:	cmp		al,'+'
		jne	@@no_plus
		mov		ax,current
		cmp		topics,ax
		je	@@input_loop
		inc		ax
		jmp	@@set_new_
@@no_plus:	
		cmp		al,'i'
		jne	@@no_go_int
		call	show_win

		mov		si,offset $go_int
		mov		di,window_pos
		add		di,(3*80+5)*2
		call	write_string
		push		bx
		mov		ah,20h
		mov		bl,30h
		int		32h
		mov		ah,21h
		mov		bx,di
		int		32h
		mov		ah,25h
		xor		ebx,ebx
		dec		bl
		int		32h
		pop		bx
		jc	@@draw_loop
		push		eax
		call	store_pos
		pop		eax
		mov		di,offset _int
		stosb
		mov		cx,6
		xor		ax,ax
		rep stosw
		jmp	@@search

@@no_go_int:


		
@@no_search:	cmp		al,8
		jne	@@no_back_link
		call	show_win
		movzx		ax,link_pointer
		imul		si,ax,size link_buf_struc
		dec		al
		and		al,7
		mov		link_pointer,al
		add		si,offset link_buf
		lodsd
		mov		file_pos,eax
		lodsw
		mov		current,ax
		mov		left,ax
		mov		right,ax
		lodsw
		mov		first_line,ax
		lodsw
		mov		lines,ax
		lodsw
		mov		link_cur,ax
		lodsb
		mov		_int,al
		jmp	@@found_a
@@no_back_link:	cmp		al,'t'
		jne	@@no_table_number
		call	show_win
		mov		si,offset $table
		mov		di,window_pos
		add		di,(3*80+5)*2
		call	write_string
		push		bx
		mov		ah,20h
		mov		bl,30h
		int		32h
		mov		ah,21h
		mov		bx,di
		int		32h
		mov		ah,25h
		movzx		ebx,tables
		int		32h
		mov		eax,ebx
		pop		bx
		jc	@@draw_loop
		push		eax
		call	store_pos
		pop		eax
		jmp	@@set_ax_table
		
@@no_table_number:
		cmp		al,'h'		;help
		jne	@@no_help
		mov		esi,-1
		cmp		file_pos,esi
		je	@@input_loop
		call	store_pos
		mov		lines,17
		mov		file_pos,esi
		call	show_win
		jmp	@@draw_loop
		
@@no_help:	cmp		ah,73		;pgu
		jne	@@no_pgu
		cmp		link_cur,0
		je	@@input_loop
		dec		link_cur
		jmp	@@draw_loop
@@no_pgu:	cmp		ah,81		;pgd
		jne	@@no_pgd
		mov		ax,link_count
		dec		ax
		cmp		ax,link_cur
		je	@@input_loop
		inc		link_cur
		jmp	@@draw_loop
@@no_pgd:	cmp		al,13		;cr
		jne	@@no_cr
		mov		si,offset link_data
		cmp		link_offset,si
		je	@@input_loop
		call	store_pos

		cmp		byte ptr ds:[si],'#'
		jne	@@real_search
		lodsb
		mov		cx,4
		xor		eax,eax
		mov		edi,eax
@@calc_table_num:
		imul		edi,10
		lodsb
		and		al,0fh
		add		edi,eax
		loop	@@calc_table_num
		mov		eax,edi
@@set_ax_table:
;set to table number eax
		dec		eax
		imul		eax,6
		add		eax,table_offset
		push		eax
		pop		dx
		pop		cx
		mov		ax,4200h		;seek
		int		21h
		mov		cx,2+4
		mov		dx,offset buffer
		mov		ah,3fh
		int		21h
		mov		ax,word ptr buffer
		mov		lines,ax
		mov		eax,dword ptr buffer+2
		mov		file_pos,eax
@@show_new_fpos:call	show_win
		jmp	@@found_a
		
@@real_search:
		mov		si,offset link_data
@@set_search_data:
		mov		di,offset _ah		;clear_buffer
		mov		cx,6
		xor		ax,ax
		push		di
		push		cx
		push		ax
		rep stosw
@@read_loop:	cmp		si,link_offset
		je	@@all_data
		
		mov		di,offset _int
		cmp		dword ptr ds:[si],' TNI'
		jne	@@no_int
		lodsd
		call	get_number
		jmp	@@read_loop
@@no_int:	inc		di
		mov		ax,ds:[si]
		cmp		ax,'XA'	;ax
		jne	@@no_ax
@@16bit_reg:	call	get_register
		call	get_number
		jmp	@@read_loop
@@no_ax:	cmp		ax,'HA'	;ah
		jne	@@no_ah
@@8bit_reg:	call	get_register
		jmp	@@read_loop
@@no_ah:	inc		di
		cmp		ax,'LA'	;al
		je	@@8bit_reg
		inc		di
		cmp		ax,'XB'	;bx
		je	@@16bit_reg
		cmp		ax,'HB'	;bh
		je	@@8bit_reg
		inc		di
		cmp		ax,'LB'	;bl
		je	@@8bit_reg
		inc		di
		cmp		ax,'XC'	;cx
		je	@@16bit_reg
		cmp		ax,'HC'	;ch
		je	@@8bit_reg
		inc		di
		cmp		ax,'LC'	;cl
		je	@@8bit_reg
		inc		di
		cmp		ax,'XD'	;dx
		je	@@16bit_reg
		cmp		ax,'HD'	;dh
		je	@@8bit_reg
		inc		di
		cmp		ax,'LD'	;dl
		je	@@8bit_reg
		cmp		ax,'IS'	;si
		je	@@16bit_reg
		inc		di
		inc		di
		cmp		ax,'ID'	;di
		je	@@16bit_reg
		inc		si
		jmp	@@read_loop
		
@@all_data:	pop		ax
		pop		cx
		pop		di
		jmp	@@search
		
@@no_cr:
		cmp		ah,72		;up
		jne	@@no_up
		dec		first_line
		jns	@@draw_loop
		inc		first_line
@@no_up:	cmp		ah,80		;down
		jne	@@no_down
		mov		ax,line_count
		movzx		cx,win_lines
		dec		cl
		cmp		ax,cx
		jbe	@@input_loop
		inc		first_line
		jmp	@@draw_loop
@@no_down:	cmp		al,'z'
		jne	@@no_zoom
		cmp		win_lines,30
		ja	@@input_loop
		mov		skip_line,1234h
		mov		first_line,0
		mov		win_lines,35
		mov		window_pos,10*160
		call	show_win
		jmp	@@draw_loop
@@no_zoom:
		cmp		al,27		;esc
		jne	@@input_loop
		mov		status,1
		mov		ah,3eh
		int		21h
		mov		bx,list_handle
		mov		ah,3eh
		int		21h
		xor		ax,ax
		retf		
handler			ENDP

store_pos		PROC	NEAR
		movzx		ax,link_pointer
		inc		al
		and		al,7h
		mov		link_pointer,al
		imul		di,ax,size link_buf_struc
		add		di,offset link_buf
		mov		eax,file_pos
		stosd
		mov		ax,current
		stosw
		mov		ax,first_line
		stosw
		mov		ax,lines
		stosw
		mov		ax,link_cur
		stosw
		mov		al,_int
		stosb
		ret
store_pos		ENDP

find_start		PROC	NEAR
		mov		find_prec,0
		mov		ax,topics		;setup start pos
		mov		right,ax
		mov		left,0
		shr		ax,1
		mov		current,ax
find_start		ENDP
find_help		PROC	NEAR
	LOCALS

;interrupt help
		movzx		eax,current		;calc file pos
		imul		eax,2+2+4+1+2+2+2+2+2+2
		
;             regs   :word;
;             lines  :word;
;             pos    :longint;
;             _int   :byte;
;             _ah    :byte;
;             _al    :byte;
;             _bh    :byte;
;             _bl    :byte;
;             _ch    :byte;
;             _cl    :byte;
;             _dh    :byte;
;             _dl    :byte;
;             _si    :word;
;             _di    :word;

		add		eax,4
		push		eax
		pop		dx
		pop		cx
		mov		ax,4200h		;seek
		int		21h
		mov		cx,2+2+4+1+2+2+2+2+2+2	;and load
		mov		dx,offset buffer
		mov		ah,3fh
		int		21h
		jc	@@error
		mov		ax,word ptr buffer
		mov		reg_mask,ax
		mov		si,offset int_data
		mov		di,offset buffer+2+2+4
		mov		cx,1+2+2+2+2+2+2
@@compare_loop:	cmpsb
		jb	@@go_left
		ja	@@go_right
@@test_loop:	ror		word ptr buffer,1
		jnc	@@dont_test
		loop	@@compare_loop
		jmp	@@found
@@dont_test:	inc		si
		inc		di
		loop	@@test_loop
		jmp	@@found
@@go_right:	mov		dx,current
		mov		left,dx
		mov		ax,right
		sub		ax,dx
		je	@@found
		shr		ax,1
		jnz	@@right_delta
		inc		ax
		cmp		cl,find_prec
		jbe	@@found
		mov		find_prec,cl
@@right_delta:	add		current,ax
@@not_found:	inc		ax
		clc
		ret
@@go_left:	mov		ax,current
		mov		right,ax
		mov		dx,left
		sub		ax,dx
		je	@@found
		shr		ax,1
		jnz	@@left_delta
		inc		ax
		cmp		cl,find_prec
		jbe	@@found
		mov		find_prec,cl
@@left_delta:	sub		current,ax
		jmp	@@not_found
@@found:	mov		eax,dword ptr buffer+2+2
		mov		file_pos,eax
		mov		ax,word ptr buffer+2
		mov		lines,ax
		xor		al,al
		clc
		ret
@@error:	stc
		ret
find_help		ENDP
setup_data		PROC	NEAR
	LOCALS
		call	show_win
		mov		list_handle,0
		mov		dx,offset list_name
		mov		ax,3d00h
		int		21h
		jc	@@return_now
		mov		list_handle,ax
		mov		dx,offset file_name
		mov		ax,3d00h
		int		21h
		mov		bx,ax
		jc	@@return_now
		mov		dx,offset topics
		mov		cx,4
		mov		ah,3fh
		int		21h
		jc	@@return_now
		movzx		eax,topics
		imul		eax,2+2+4+1+2+2+2+2+2+2
		add		eax,4
		mov		table_offset,eax
@@return_now:	ret
setup_data		ENDP


write_data		PROC	NEAR
	LOCALS
		push		bx
		mov		bx,list_handle
		mov		ax,4200h			;seek to text
		mov		dx,word ptr [file_pos]
		mov		cx,word ptr [file_pos+2]
		cmp		cx,-1
		je	@@use_xms
		int		21h
@@use_xms:	mov		ax,lines
		mov		text_lines,ax
		mov		ax,first_line
		mov		show_line,ax
		mov		line_count,0			;set defaults
		mov		link_count,0
		mov		link_count,0
		mov		link_offset,offset link_data
		xor		si,si
		mov		di,window_pos
		add		di,160
		push		di
		mov		al,' '				;clear line
		call	write_line
		pop		di
		cmp		first_line,0
		je	@@read_start
		push		di				;scroll up
		add		di,160-2
		mov		al,30
		call	write_char
		pop		di

@@read_start:	mov		color,31h

@@read_loop:	push		ds
		push		si
		lds		dx,buffer_pos
		xor		ah,ah
		and		si,1ffh
		jnz	@@dont_load
		mov		cx,200h
		cmp		cs:file_pos,-1
		jne	@@file_load
		push		es
		push		esi
		mov		ah,28h
		mov		esi,cs:xms_data
		int		32h
		pop		esi
		pop		es
		jmp	@@dont_load
@@file_load:	mov		ah,3fh
		int		21h
		lahf
@@dont_load:	add		si,dx
		lodsd
		pop		si
		pop		ds
		inc		si
		
		cmp		eax,'AeeS'	;SeeAlso:
		jne	@@not_link_line
		mov		help,10		;links after x chars
@@not_link_line:
		
		cmp		help,1
		jne	@@not_in_help
		test		color,08h
		jz	@@set_link
		jmp	@@no_link_start
@@not_in_help:	dec		help
		cmp		al,'#'
		jne	@@no_link_start
		cmp		ah,'0'
		jb	@@no_link_start
		cmp		ah,'9'
		ja	@@no_link_start
@@set_link:	mov		color,3eh
		mov		cx,link_count
		inc		link_count
		cmp		cx,link_cur
		jne	@@no_link_start
		mov		color,1eh
@@no_link_start:
		
		cmp		al,10
		je	@@next_char
		cmp		al,13
		jne	@@old_line
		mov		help,0
		mov		color,30h
		dec		text_lines
		jz	@@read_error
		dec		show_line
		jns	@@next_char
		mov		cx,160
		mov		ax,di
		xor		dx,dx
		div		cx
		inc		ax
		mul		cx
		mov		di,ax
		inc		line_count
		movzx		cx,win_lines
		dec		cl
		cmp		line_count,cx
		ja	@@old_line
		push		di
		mov		al,' '
		call	write_line
		pop		di
		jmp	@@next_char
@@old_line:
		mov		dx,line_count
		movzx		cx,win_lines
		dec		cl
		cmp		dx,cx
		jbe	@@line_ok
		sub		di,2
		mov		al,31
		pop		bx
		jmp	write_char
@@line_ok:
		cmp		color,1eh
		je	@@is_link_
		cmp		color,3eh
		jne	@@no_link_
@@is_link_:	cmp		al,','
		je	@@end_link_
		cmp		al,')'
		je	@@end_link_
		cmp		help,1
		je	@@no_link_
		cmp		al,' '
		jne	@@no_link_
@@end_link_:	mov		color,30h
@@no_link_:
		cmp		color,1eh
		jne	@@no_link_dat
		push		di
		mov		di,link_offset
		stosb
		mov		byte ptr [di],0
		mov		link_offset,di
		pop		di
@@no_link_dat:

		cmp		show_line,0
		jg	@@next_char

		
		cmp		al,9
		jne	@@no_tab
		mov		cx,10h
		mov		ax,di
		xor		dx,dx
		div		cx
		inc		ax
		mul		cx
		mov		di,ax
		jmp	@@next_char
@@no_tab:	call	write_char
@@next_char:	jmp	@@read_loop
@@read_error:	pop		bx
		ret
write_data		ENDP

show_win		PROC	NEAR
	LOCALS
		mov		first_line,0
		mov		link_cur,0
		mov		find_prec,0

		mov		di,window_pos
		mov		color,3fh
		mov		al,win_style
		call	write_line
		movzx		cx,win_lines
@@win_loop:	mov		al,' '
		call	write_line
		loop	@@win_loop
		mov		al,win_style
		call	write_line
		mov		si,help_ofs
		sub		di,(80-2)*2
		call	write_string
		mov		color,30h
		mov		di,window_pos
		add		di,162
		ret
show_win		ENDP
write_char		PROC	NEAR
		push		ax
		push		es
		mov		ah,color
		push		0b800h
		pop		es
		stosw
		pop		es
		pop		ax
		ret
write_char		ENDP
write_line		PROC	NEAR
	LOCALS
		push		cx
		mov		cx,80
@@line_loop:	call	write_char
		loop	@@line_loop
		pop		cx
		ret
write_line		ENDP
write_string		PROC	NEAR
	LOCALS
		push		ax
@@loop_string:	lodsb
		or		al,al
		jz	@@end_string
		call	write_char
		jmp	@@loop_string
@@end_string:	pop		ax
		ret
write_string		ENDP
setup_winpos		PROC	NEAR
		mov		ax,12
		mov		skip_line,2313h
		cmp		bl,16
		ja	@@upper_position
		mov		skip_line,1100h
		mov		ax,30
@@upper_position:		
		imul		ax,160
		mov		window_pos,ax
		ret
setup_winpos		ENDP

get_register:	lodsw
		cmp		byte ptr ds:[si],'='
		jne	get_number
		inc		si
get_number		PROC	NEAR
	LOCALS
		lodsw
		cmp		ax,'??'
		je	@@return
		cmp		al,'9'
		jbe	@@high_nibble_ok
		sub		al,7
@@high_nibble_ok:
		sub		al,'0'

		cmp		ah,'9'
		jbe	@@low_nibble_ok
		sub		ah,7
@@low_nibble_ok:sub		ah,'0'
		shl		al,4
		add		al,ah
		stosb
@@return:	ret
get_number		ENDP

disassemble		PROC	NEAR
	LOCALS
		mov		cl,0
		cmp		ax,[skip_line]
		je	@@dont_clear
		mov		cl,1		;clear if different lines
		mov		[skip_line],ax
@@dont_clear:	mov		bx,ax
		mov		ax,1502h		;disassemble
		int		32h
		ret
disassemble		ENDP

uninstall		PROC	NEAR
		mov		ebx,[this_handler]	;remove handler
		mov		ecx,[old_handler]
		mov		ax,1501h
		int		32h
		xor		al,al
		retf
uninstall		ENDP

file_name	DB	80 DUP(?)
list_name	DB	80 DUP(?)
list_handle	DW	?

topics		DW	?
tables		DW	?

left		DW	?
right		DW	?
current		DW	?

win_lines	DB	15
opcode_data	DB	8 DUP(0)
lines		DW	?
file_pos	DD	?
line_count	DW	?

find_prec	DB	0
text_lines	DW	0
first_line	DW	?

reg_mask	DW	?

skip_line	DW	1234h
window_pos	DW	?
win_style	DB	'Ä'
color		DB	30h
link_count	DW	0
link_offset	DW	0
link_cur	DW	0

int_data	LABEL	BYTE
_int		DB	?
_ah		DB	?
_al		DB	?
_bh		DB	?
_bl		DB	?
_ch		DB	?
_cl		DB	?
_dh		DB	?
_dl		DB	?
_si		DW	?
_di		DW	?

link_buf_struc		STRUC
lbs_fpos	DD	0
lbs_cur		DW	0
lbs_fline	DW	0
lbs_lines	DW	2
lbs_clink	DW	0
lbs_int		DB	0
link_buf_struc		ENDS


help		DB	0

table_offset	DD	?

link_pointer	DB	0
link_buf	link_buf_struc	<>
		link_buf_struc	<>
		link_buf_struc	<>
		link_buf_struc	<>

		link_buf_struc	<>
		link_buf_struc	<>
		link_buf_struc	<>
		link_buf_struc	<>

xms_data	DD	?
help_ofs	DW	?
search_buffer	DB	30h DUP(?)
link_start	DB	0
show_line	DW	?
$closed_look	DB	' [2] int help   ',0
$help_line	DB	' ESC-Return H-Help T-Table I-Interrupt Z-Zoom ñ-Leafe through ',0
$help_line_	DB	' [2]-Activate Window ',0
$table		DB	' Go to table number ',0
$go_int		DB	' Go to interrupt ',0
buffer_pos	DD	?
register_pos	DD	?

this_handler	DD	?
old_handler	DD	?
status		DB	1
buffer		DB	2+2+4+2+2+2+2+2+2 DUP(?)
link_data	DB	8 DUP(0)

;****************************************************************************
install			PROC	NEAR
	LOCALS
		mov		cs:[xms_data],edi
		mov		ax,es:[si+0ch]		;buffer
		mov		bx,es:[si]		;register
		add		bx,8			;eax
		mov		word ptr [buffer_pos],ax
		mov		word ptr [buffer_pos+2],es
		mov		word ptr [register_pos],bx
		mov		word ptr [register_pos+2],es
		push		cs
		pop		es

		mov		ebx,'1HTI'
		mov		edx,'FXDI'
		mov		ah,18h
		int		32h
		jnc	@@continue
@@undef_uilm:	mov		ax,2df2h		;undef uilm data
		int		32h
		mov		al,80h			;ret and unload
		retf
@@continue:	mov		di,offset file_name
		call	copy_string
@@no_idx:	mov		ebx,'1HTI'
		mov		edx,'FTNI'
		mov		ah,18h
		int		32h
		jc	@@undef_uilm
		mov		di,offset list_name
		call	copy_string

		push		cs			;calc handler address
		push		offset handler
		pop		ebx
		mov		[this_handler],ebx
		mov		ax,1500h		;add to chain
		int		32h
		mov		[old_handler],ebx	;save prev handler

		xor		al,al
		retf
install			ENDP
copy_string		PROC	NEAR
	LOCALS
		push		es
		pop		ds
		push		cs
		pop		es
		
@@copy_fname:	lodsb
		stosb
		or		al,al
		jnz	@@copy_fname
		push		cs
		pop		ds
		ret
copy_string		ENDP

low_mem_end		LABEL	WORD


dos_call		PROC	NEAR
		mov		dx,offset $no_dos
		mov		ah,9h
		int		21h
		mov		ax,4c00h
		int		21h
dos_call		ENDP
$no_dos		DB	'Interrupt help v1 by FUTURE VISION - UILM id: ITH1',13,10
		DB	'...this is an user interface loadable module and can '
		DB	'not be executed by dos',13,10,'$'

high_mem_start		LABEL	WORD
	DB	'HELP - Help on help',13,13
	DB	'This is an online viewer for Ralf Brown''s interrupt list by FUTURE VISION',13,13
	DB	'Available Keys :',13,13
	DB	' ESC		- return to debugger',13
	DB	' CursorKeys	- scroll up/down',13
	DB	' PgUp/PgDown	- select link',13
	DB	' ENTER		- follow currently highlighted link',13
	DB	' BACKSPACE	- previous topic',13
	DB	' +/-		- leafe through the interrupt list',13
	DB	' H		- this help screen',13
	DB	' I		- search for an interrupt',13
	DB	' T		- select table',13,13
	DB	'created in 1997 by FUTURE VISION',13
high_mem_end		LABEL	WORD
main_seg		ENDS
			END	com_entry
