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

  • Home
  • SEARCH
  • 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 7716481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:38:56+00:00 2026-06-01T02:38:56+00:00

I am trying to build my own boot loader that loads then switches from

  • 0

I am trying to build my own boot loader that loads then switches from real mode to protected mode, loads the GDT descriptor and then calls some stage 2 code. Since I cannot figure out a good way of debugging my programs, it has been an uphill battle to get things to work. For some odd reason, my code fails at reading the second sector of my bootloader into memory at 0x1000 address. I have tried using the int 0x13 with al = 0x01 which is a Get Status of Last Drive Operation interupt. It returns 0x01 which means Invalid Command which confuses me further.

    mov ah, 0      ;reset drive
    int 0x13
    or ah, ah      ;check for error
    jnz err        ;error handling function (prints ASCII A)

    mov ax, 0
    mov es, ax
    mov bx, 0x1000 ;read sector into 0000:0x1000

    mov ah, 0x02   ;read sector
    mov al, 1      ;# of sectors to read = 1
    mov ch, 0      ;Cylinder = 0
    mov cl, 0x02   ;Sector to read = 2 (second as first sector is this code)
    mov dh, 0      ;head = 0

                   ;dl should equal the drive number as BIOS automatically detects it
    int 0x13
    or ah, ah
    jnz err        ;check for error again (this is where the error occurs)

When the computer is booted, I am told that BIOS places the drive letter into the dl register so all my interrupts should be performed on the correct drive. I even tried setting dl to 0x00 which would be equal to floppy drive A: and in BOCHS (CPU emulator) I set the floppy drive A: to my boot image and still it would not boot. Is there some reason why QEMU and BOCHS won’t emulate the code correctly? I have yet to try burning this to a USB and booting it from a live BIOS. I will post my complete code here so you can review it if necessary. I apologize if I am not clear enough, I am beginner at OS development. Many thanks!

Edit:
OS: Windows 7 x64 (developing x32 OS)
Emulation: BOCHS running boot.img created by NASM compiler.

  • 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-06-01T02:38:57+00:00Added an answer on June 1, 2026 at 2:38 am

    You’re checking for errors incorrectly. int 0x13 ah=0 for example indicates an error by setting the carry flag, not by reporting something in ah. Instead of or ah, ah jnz err, you should be jumping if carry is set using jc err.

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

Sidebar

Related Questions

I'm trying to understand the IntentService class so that I can build my own
I'm trying to build my own prediction market, and I'm thinking about algorithms. That
I'm trying to build my own custom dropdown menu that should remember it's vertical
I'm trying to build my own Hash Table in C from scratch as an
I 'm trying to build my own simple breadcrumb component that pushes a PageRefence
I am trying to build an application that must manage its own run loop.
I am trying to build my own little toolbox for Vista. One of the
I'm trying to build my own template tags. I have no idea why I
I was trying Build For Archiving application (from Titanium Mobile) with xCode 4.4, but
I'm trying build a method which returns the shortest path from one node to

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.