; This is program pgm15_3c.asm (p.327 of text)
;
title prm15_3c 
	PUBLIC get_time, setup_int
c_seg segment	PUBLIC
	assume cs:c_seg
;
get_time PROC
; get time of day and store ascii dig in time buffer
; input: bx=addr of time buffer
	mov ah,2ch	; get time
	int 21h		; ch=hr, cl=min, dh=sec
; convert hrs into ascii and store
	mov al,ch
	call convert	; convert to ascii
	mov [bx],ax
; convert minutes
	mov al,cl
	call convert
	mov [bx+3],ax
; convert seconds
	mov al,dh
	call convert
	mov [bx+6],ax
	ret
get_time endp

;
convert PROC
;converts byte (0-59) to ascii digits
; input: al=number 
; output: ax = ascii digits (AL=hi, AH=lo)
	mov ah,0	; clear ah
	mov dl,10	; div ax by 10
	div dl		; ah=remainder, al=quotient
	or ax, 3030h
	ret
convert endp

;
setup_int PROC
; input: al=int type,
;	 di=addr of buffer for old_vec, si=addr of buffer for new_vec
; save old vec
	mov ah,35h
	int 21h
	mov [di],bx
	mov [di+2],es
; setup new vec
	mov dx,[si]
	push ds		; save ds
	mov ds,[si+2]
	mov ah,25h
	int 31h
	pop ds		; restore ds
	ret
setup_int endp
;
c_seg ends
	end

