TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: FERDINAND GRASSMANN
from: BARRY BLOCK
date: 1997-05-29 15:17:00
subject: timer

Hello Ferdinand,
BB>> One problem is, a single timer tick is too long. What else can I use
BB>> as a timer so that the speed is the same on all machines?
 FG> Why not try the vertical retrace? It should have the same speed on
 FG> most machines...
     Thanx Ferdinand, I was able to steal some code from Denis Boyles :-)
;----------------------------------------
;WaitRetrace - waits for vertical retrace
;----------------------------------------
CGAPort     EQU 03DAh                  ;port address for CGA status register
WaitRetrace PROC
    mov     DX,CGAPort                 ;DX = CGAPort to read status from
WR0:                                   ;flush out current retrace if any
    in      AL,DX                      ;read status into AL from port
    test    AL,1000b                   ;test bit 3 (8) for retrace?
    jnz     WR0                        ;loop while its on to flush retrace
WR1:                                   ;wait for start of new retrace
    in      AL,DX
    test    AL,1000b
    jz      WR1                        ;keep looping until retrace occurs
    ret
WaitRetrace ENDP
;----------------------------------------
Kind regards, Barry
--- Terminate 4.00/Pro
---------------
* Origin: EBO-BBS A'dam +31-20-6002828 (2:280/901.42)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.