Изучение принципов обработки аппаратных прерываний, страница 10

      mov bl,10              

      div bl

      add ax,3030h           

      mov word ptr es:msg+7,ax

      mov ax,min             

      div bl                      

      add ax,3030h           

      mov word ptr es:msg+4,ax

      mov ax,hour            

      div bl                      

      add ax,3030h           

      mov word ptr es:msg+1,ax

      mov ax,0b800h          

      mov es,ax

      lea bx,msg             

      mov di,0               

mn1:

      mov al,[bx]

      cmp al,'$'

      je exit

      mov es:[di],al

      inc di

      inc bx

      mov es:[di],word ptr 0F0h

      inc di

      jmp mn1

exit:

      jmp time

kl_exit:

      push ds

      mov dx, ipsave_8

      mov ax, cssave_8

      mov ds, ax

      mov ah, 25h

      mov al, 8h

      int 21h

      pop ds

      push ds

      mov dx, ipsave_9

      mov ax, cssave_9

      mov ds, ax

      mov ah, 25h

      mov al, 9h

      int 21h

      pop ds

      push ds

      mov dx, ipsave_60

      mov ax, cssave_60

      mov ds, ax

      mov ah, 25h

      mov al, 60h

      int 21h

      pop ds

      mov ah,4ch             

      int 21h

main  ENDP

int_8 proc FAR              

      push ax                

      push es                     

      mov ax, dseg

      mov es,ax

      mov ax,word ptr es:cnt 

      inc ax

      cmp ax,18        

      jne m0                 

      int 60h

      mov ax,0

m0:

      mov word ptr es:cnt,ax

      pop es

      pop ax

      mov ax,dseg

      mov es,ax

      jmp dword ptr es:adr_int8   

int_8 ENDP

int_9 proc FAR              

      push ax                

      push es                     

      mov ax, dseg

      mov es,ax

      in al, 60h

      cmp al,1

      je m_kl

      pop es

      pop ax

      mov ax,dseg

      mov es,ax

      jmp dword ptr es:adr_int9   

m_kl:

      mov word ptr es:klav,1      

      mov al,20h       

      out 20h,al

      pop es                      

      pop ax

      iret

int_9 ENDP

int_60 proc FAR        

      push ax                

      push es

      mov ax, dseg

      mov es,ax

      mov es:flag,1          

      mov ax,word ptr es:sec

      inc ax

      cmp ax,60

      jne ms                      

      mov ax,0               

      mov word ptr es:sec,ax      

      jmp mm

ms:

      mov word ptr es:sec,ax

      jmp m_ex

mm:

      mov ax,word ptr es:min

      inc ax

      cmp ax,60              

      jne mm_m               

      mov ax,0               

      mov word ptr es:min,ax      

      jmp mh

mm_m:

      mov word ptr es:min,ax

      jmp m_ex

mh:

      mov ax,word ptr es:hour

      inc ax

      cmp ax,24              

      jne mh_h               

      mov ax,0               

      mov word ptr es:hour,ax

      jmp m_ex

mh_h:

      mov word ptr es:hour,ax

m_ex:

      pop es

      pop ax

      mov al,20h             

      out 20h,al

      iret