home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / hellsrc.zip / VRTIME.M < prev   
Text File  |  1993-08-29  |  4KB  |  177 lines

  1. ormirq0vect     dd      ?
  2. opmirq0vect     dd      ?
  3.  
  4. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  5. ; Set up system timer for vertical retrace IRQ
  6. ; Out:
  7. ;   EAX,EDX,BL - ?
  8. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  9. _initvrt:
  10.         cli
  11.  
  12.         mov eax,offset vrtirqrm
  13.         add eax,_code32a
  14.         shl eax,12
  15.         shr ax,12
  16.         mov edx,offset vrtv-offset vrtirqrm
  17.         add dx,ax
  18.         mov vrtirqrmm0,dx
  19.         xchg eax,gs:[8*4]
  20.         mov ormirq0vect,eax
  21.  
  22.         xor bl,bl
  23.     call _getirqvect
  24.     mov opmirq0vect,edx
  25.         mov edx,offset vrtirqpm
  26.         call _setirqvect
  27.  
  28.         mov al,30h
  29.         out 43h,al
  30.         mov al,00h
  31.         out 40h,al
  32.         mov al,41h
  33.         out 40h,al
  34.  
  35.         sti
  36.         ret
  37.  
  38. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  39. ; Reset system timer to normal
  40. ; Out:
  41. ;   AL,BL,EDX - ?
  42. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  43. _resetvrt:
  44.         cli
  45.  
  46.         mov edx,ormirq0vect
  47.         mov gs:[8*4],edx
  48.         mov edx,opmirq0vect
  49.         xor bl,bl
  50.         call _setirqvect
  51.  
  52.         mov al,36h
  53.         out 43h,al
  54.         xor al,al
  55.         out 40h,al
  56.         out 40h,al
  57.  
  58.         sti
  59.         ret
  60.  
  61. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  62. ; Set timer to current vertical retrace period exactly
  63. ; Out:
  64. ;   AX,BX,DX - ?
  65. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  66. _vrtset:
  67.         cli
  68.  
  69.         mov al,30h
  70.         out 43h,al
  71.         mov dx,3dah
  72.         in al,dx
  73.         test al,8
  74.         jnz $-3
  75.         in al,dx
  76.         test al,8
  77.         jz $-3
  78.         xor al,al
  79.         out 40h,al
  80.         out 40h,al
  81.  
  82.         in al,dx
  83.         test al,8
  84.     jnz $-3
  85.         in al,dx
  86.         test al,8
  87.         jz $-3
  88.         in al,40h
  89.     mov ah,al
  90.     in al,40h
  91.     xchg al,ah
  92.     neg ax
  93.         sub ax,0c0h
  94.         mov vrtv,ax
  95.     mov bx,ax
  96.  
  97.         in al,dx
  98.         test al,8
  99.         jz $-3
  100.         in al,dx
  101.         test al,8
  102.         jnz $-3
  103.     mov al,bl
  104.         out 40h,al
  105.     mov al,bh
  106.         out 40h,al
  107.  
  108.         sti
  109.         ret
  110.  
  111. ;═════════════════════════════════════════════════════════════════════════════
  112. align 4
  113. vrtirqpm:
  114.         push eax edx ds
  115.         mov ds,cs:_seldata
  116.         mov dx,3dah
  117.         in al,dx
  118.  
  119. ;       test al,8
  120. ;       setnz ah
  121. ;       setz al
  122. ;       sub al,ah
  123. ;       movsx eax,al
  124.         and eax,8
  125.         dec eax
  126.         neg eax
  127.  
  128.         add vrtv,ax
  129.         in al,dx
  130.         test al,8
  131.         jz $-3
  132.         mov ax,vrtv
  133.         out 40h,al
  134.         mov al,ah
  135.         out 40h,al
  136.         call _vrtrout           ; CALL _vrtrout
  137.         pop ds edx
  138.         mov al,20h
  139.         out 20h,al
  140.         pop eax
  141.         sti
  142.         iretd
  143.  
  144. ;═════════════════════════════════════════════════════════════════════════════
  145. align 4
  146. vrtirqrm:                       ; This is 16bit code in a 32bit segment
  147.         db 50h,52h              ; PUSH AX DX
  148.         db 0bah,0dah,3          ; MOD DX,3dah
  149.         db 0ech                 ; IN AL,DX
  150.  
  151. ;       db 0a8h,8               ; TEST AL,8
  152. ;       db 0fh,95h,0c4h         ; SETNZ AH
  153. ;       db 0fh,94h,0c0h         ; SETZ AL
  154. ;       db 28h,0e0h             ; SUB AL,AH
  155. ;       db 0fh,0beh,0c0h        ; MOVSX AX,AL
  156.         db 25h,8,0              ; AND AX,8
  157.         db 48h                  ; DEC AX
  158.         db 0f7h,0d8h            ; NEG AX
  159.  
  160.         db 2eh,1,6              ; ADD CS:VRTV,AX
  161. vrtirqrmm0      dw      ?       ;
  162.         db 0ech                 ; IN AL,DX
  163.         db 0a8h,8               ; TEST AL,8
  164.         db 74h,0fbh             ; JZ SHORT $-3
  165.         db 0ebh,0               ; JMP SHORT $+2
  166.         db 0b8h                 ; MOV AX,vrtv
  167. vrtv    dw      4100h           ;
  168.         db 0e6h,40h             ; OUT 40h,AL
  169.         db 88h,0e0h             ; MOV AL,AH
  170.         db 0e6h,40h             ; OUT 40h,AL
  171.         db 05ah                 ; POP DX
  172.         db 0b0h,20h             ; MOV AL,20h
  173.         db 0e6h,20h             ; OUT 20h,AL
  174.         db 58h                  ; POP AX
  175.         db 0cfh                 ; IRET
  176.  
  177.