Page 3 of 3

Re:ideas for delaying os

Posted: Thu Apr 15, 2004 11:16 am
by ASHLEY4
I may be wrong (did i really say that :o),But the vertical retrace timing is more standard at boot time (no driver),
We are not talking about under XP,LINUX,for which we have set the Hz etc.

ASHLEY4.

Re:ideas for delaying os

Posted: Fri Apr 16, 2004 7:03 am
by DennisCGc
ASHLEY4 wrote: I may be wrong (did i really say that :o),But the vertical retrace timing is more standard at boot time (no driver),
We are not talking about under XP,LINUX,for which we have set the Hz etc.

ASHLEY4.
Anyway, it would be more inaccurate than using the timer interrupt or than calibrating the processor.
The method you suggest is only handy for games.
(hmm, maybe you could post it, looking if they are accurate ;) )

Re:ideas for delaying os

Posted: Fri Apr 16, 2004 11:54 am
by ASHLEY4
This nasm code is just a quick bit of code to try ,To try it for a real comparison it needs to be run before windows,linux etc
eg: in your own code,If so take out the dos bits first.
Put your print code where "Do some thing in here" is,
On starting up press any key and time it till it prints,Try it on differant pc's.

To me this is better code for people who are making a small os and need a simple delay for printing to screen etc,(eg. noncritecal).

Code: Select all

BITS 16
ORG 100h

SECTION .text

START:
        xor ah,ah
        int 16h
        mov  word[count],0
ddf:
        call FullVertWait
        cmp word [count],70
        jne  ddf

   ;Do some thing in here

        xor ah, ah
        int 16h

        mov ax, 04c00h
        int 21h
;**************************

FullVertWait:

        MOV     DX,3DAh
Vr:
        IN      AL,DX
        TEST    AL,8
        JNZ     Vr           ;wait until Verticle Retrace starts
Nvr:
        IN      AL,DX
        TEST    AL,8
        JZ      Nvr        ;wait until Verticle Retrace Ends
        ADD    word[count],1
        RET

;**************************

SECTION .data

count    dw 0


As this code stands,it should give a 1 second delay.

ASHLEY4.

Re:ideas for delaying os

Posted: Fri Apr 16, 2004 12:01 pm
by DennisCGc
To me this is better code for people who are making a small os and need a simple delay for printing to screen etc,(eg. noncritecal).
Yes, indeed ;)
But your code seems to be short but powerful (damn, it's a Dutch sentence, but literally translated to English.
My opinion about your code is not negative.