home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-ASM_VI.ARJ / PROGASM.ZIP / PROG010.ASM < prev    next >
Assembly Source File  |  1988-04-10  |  1KB  |  35 lines

  1.  
  2. ;*****************************************************************
  3. ; Wait for start of next vertical retrace                        *
  4. ;*****************************************************************
  5.  
  6.         PUBLIC  _Vertical_Retrace
  7.  
  8. _Vertical_Retrace       PROC    NEAR
  9.         PUSH    ES
  10.         XOR     AX,AX                   ;Get address of STATUS register
  11.         MOV     ES,AX                   ;From segment 0
  12.         MOV     DX,3BAH                 ;Assume monochrome addressing
  13.         TEST    BYTE PTR ES:[BIOS_Equipment],2  ;Is mono display attached?
  14.         JNZ     VR_Address_Ok           ;...Yes, address is ok
  15.         MOV     DX,3DAH                 ;...No, must set color addressing
  16. VR_Address_Ok:
  17.  
  18.         IN      AL,DX                   ;Read in status
  19.         JMP     $+2
  20.         TEST    AL,08H                  ;Is retrace ON? (if ON bit = 1)
  21.         JZ      Wait_For_On             ;...no, go wait for start
  22. Wait_For_Off:                           ;...yes, wait for it to go OFF
  23.         IN      AL,DX
  24.         JMP     $+2
  25.         TEST    AL,08H                  ;Is retrace OFF?
  26.         JNZ     Wait_For_Off            ;...No, keep waiting
  27. Wait_For_On:
  28.         IN      AL,DX
  29.         JMP     $+2
  30.         TEST    AL,08H                  ;Is retrace ON?
  31.         JZ      Wait_For_On             ;...No, keep on waiting
  32.         POP     ES
  33.         RET
  34. _Vertical_Retrace       ENDP
  35.