92f prog_timer PROTO SYSCALL,hzfreq:WORD rest_timer PROTO SYSCALL .DOSSEG .MODEL SMALL .386 .DATA Org_Int08Isr dd ? PUBLIC timerticks timerticks dd 0 tick_cntr dw ? div_l db ? div_h db ? x_clk dd 1193180 hz18 db 18 interv dw ? .CODE TIMER_ISR PROC FAR ASSUME CS:_TEXT,DS:@data push ds push ax mov ax,@data mov ds,ax inc dword ptr[timerticks] ;Update tick value ; inc word ptr[tick_cntr] ;Call original timer ISR ; mov dx,interv ; cmp word ptr[tick_cntr],dx ;at proper time interval ; jnz end_of_ISR ; mov word ptr[tick_cntr],0 ; pushf ; call Org_Int08Isr ; jmp skip_EOI end_of_ISR: mov al,20h ;Signal End of Interrupt out 20h,al pop ax pop ds iret TIMER_ISR ENDP ;======================================================================== prog_timer PROC SYSCALL, hzfreq:WORD mov ax,word ptr[x_clk] ;divide 1193180 by frequency... mov dx,word ptr[x_clk+2] div hzfreq mov div_l,al ;to get divisor in AX mov div_h,ah mov ax,hzfreq ;calculate interval to call original rte div hz18 mov interv,ax mov al,08h ;H„mta vektorn till INT 08h mov ah,35h int 21h mov word ptr[Org_Int08Isr],bx ;Org_Rutinens OFFSET h„mtas mov word ptr[Org_Int08Isr+2],es ;Segment sparas push ds mov ah,25h ;Install TIMER ISR mov al,08h push cs pop ds mov dx,offset TIMER_ISR int 21h pop ds cli mov dx,43h ;Re-program system timer mov al,36h out dx,al mov dx,40h ; Ny divisor mov al,div_l ; LSB divisor out dx,al mov al,div_h ; MSB divisor out dx,al sti ret prog_timer ENDP ;------------------------------------------------------------------------ rest_timer PROC SYSCALL cli mov dx,43h mov al,36h out dx,al mov dx,40h ;¸terst„ll divisor f”r Timer 0 mov al,0h out dx,al mov al,0h out dx,al push ds ;Restore old INT 8 mov ah,25h mov al,08h mov dx,word ptr[Org_Int08Isr] mov ds,word ptr[Org_Int08Isr+2] int 21h pop ds sti ret rest_timer ENDP END . 0