;*****************************
;Fonction speciale pour le GBF
;*****************************

 INIT_NEW_TIMER MACRO
     MOV AX,3508H
     INT 21H
     MOV AX,ES
     MOV WORD PTR [hold_int8],BX
     MOV WORD PTR [hold_int8+2],AX

     PUSH DS
     CLI
      MOV AX,SEG NEW_TIMER
      MOV DS,AX
      MOV DX,OFFSET NEW_TIMER
      MOV AX,2508H
      INT 21H
     STI
     POP DS
 ENDM

 HOLD_TIMER MACRO
    CLI
     MOV AL,00110110b
     OUT 43H,AL
     JMP $+2
     MOV AX,0FFFFH
     OUT 40H,AL
     JMP $+2
     SHR AX,8
     OUT 40H,AL
     JMP $+2

     PUSH DS
      MOV AX,WORD PTR [hold_int8+2]
      MOV DS,AX
      MOV DX,WORD PTR [hold_int8]
      MOV AX,2508H
      INT 21H
     POP DS
    STI
 ENDM

 FIXE_ECHANTILLONAGE MACRO ECHANT
  PUSH ECHANT
  CALL SR_FIXE_ECHANTILLONAGE
 ENDM


    .DATA
     hold_int8 DD 0

    .CODE

;***************************
;Nouvelle interruption timer
;***************************

    NEW_TIMER PROC 
     CLI
     PUSH AX
     PUSH DS

     MOV AX,@DATA
     MOV DS,AX
     INC WORD PTR DS:[TIME]

     MOV AL,20H
     OUT 20H,AL

     POP DS
     POP AX
     STI
    IRET
    ENDP


   SR_FIXE_ECHANTILLONAGE PROC FAR
    PUSH AX
    PUSH DX
    PUSH BX
    CLI
     MOV AL,00110110b
     OUT 43H,AL
     JMP $+2
     MOV AX,LOW 1193180
     MOV DX,HIGH 1193180
     MOV BX,[BP+10]
     DIV BX
     OUT 40H,AL
     JMP $+2
     SHR AX,8
     OUT 40H,AL
     JMP $+2
    STI
    POP BX
    POP DX
    POP AX
    RETF
  ENDP

