Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6136459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:36:20+00:00 2026-05-23T17:36:20+00:00

I have a C program that runs on bare x86 (without an OS) in

  • 0

I have a C program that runs on bare x86 (without an OS) in protected mode. I need to delay the program’s execution for a certain amount of time. Currently, I’m doing this:

for(p=0; p<1000000; ++p) asm("pause");

But this looks very very wrong (I do get a delay, but apparently, I have no real control over its duration: the length of the “pause” is undefined).

Now, I’m not really experienced with stuff at such low level, and I’ve been searching the net for solutions, but so far the only one that I found involved BIOS interrupts, which don’t work in pmode (or so I was told).

So, how do I delay execution when in protected mode?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:36:20+00:00Added an answer on May 23, 2026 at 5:36 pm

    The typical way to implement delays is using the system timer, also called PIT on x86 (Programmable Interval Timer) to generate an interrupt. You would set up the system timer (hardware IRQ0) to raise an interrupt after a certain time, write the interrupt handler to set some register or flag on interrupt, and, when you need to delay the execution, loop on the register or flag until the interrupt handler sets it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a program that runs in a given amount of time (say,
I have a Visual Studio 2005 C++ program that runs differently in Release mode
I have a program that runs only in the toolbar (w/ time/date, spotlight, etc.)
I have a Java program that runs in the background without any UI. Can
I have a g++ program that runs without user input. Somewhere the program is
I have a program that runs and asks users certain questions. I want to
I have an interactive program that runs stdin and stdout. I need to create
I have program that runs for long periods of time and I'd like to
I have a program that runs fine in DEBUG mode but in RELEASE mode
I have program that runs fast enough. I want to see the number of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.