Delay question

Programming, for all ages and all languages.
Post Reply
renovatio
Member
Member
Posts: 57
Joined: Fri May 23, 2008 5:13 am

Delay question

Post by renovatio »

Hello, I want to delay a second, so i am using int 15h 86h to do it...

CX = Number of microseconds to wait (high byte)
DX = Number of microseconds to wait (low byte)

What is the value of CX and DX to delay a second?

Thanks in advance
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Delay question

Post by Combuster »

This reeks of spoonfeeding answers.

What makes that you can not possibly answer this question yourself?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Delay question

Post by Troy Martin »

My god, can you not freaking count?

Google SI prefixes.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
renovatio
Member
Member
Posts: 57
Joined: Fri May 23, 2008 5:13 am

Re: Delay question

Post by renovatio »

I tried working it out:

1 second = 1000000 microseconds

1000000 = F4240h

So CX = Fh And DX = 4240h

CX:DX = 000F4240h

But this is less than a second when i try it
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Delay question

Post by Troy Martin »

Probably cause you're testing in bochs and the clock is running too fast, amirite?
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
renovatio
Member
Member
Posts: 57
Joined: Fri May 23, 2008 5:13 am

Re: Delay question

Post by renovatio »

I'm using Microsoft Virtual PC 2007
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Delay question

Post by Troy Martin »

Works fine for me in VPC.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
purage
On Probation
Posts: 119
Joined: Wed Feb 11, 2009 1:04 am

Re: Delay question

Post by purage »

I just did this last night. See here: http://artofhacking.com/IET/PRGM/live/aoh_pit.htm

It's in pascal, but shouldn't be hard to translate to something else. The trick is to adjust the tick count each hit, for a second just count out ten hits and then pull the trigger.

But, that is PIT, for a delay you might try CMOS. Hope this helps.
renovatio
Member
Member
Posts: 57
Joined: Fri May 23, 2008 5:13 am

Re: Delay question

Post by renovatio »

thanks for your help, the code was ok, it doesn't work properly on virtual pc, but yes on real hardware
purage
On Probation
Posts: 119
Joined: Wed Feb 11, 2009 1:04 am

Re: Delay question

Post by purage »

Are you talking to me? It works fine in VPC. That's what I use. You might be using the wrong values. Check the link and compare.
Post Reply