Help with BIOS Disk Read Interrupt

Mr. Mysterio

Super Genius
OP
Member
Joined
Sep 16, 2014
Messages
661
Trophies
0
Age
23
Location
Rosalina's Comet Observatory
XP
1,113
Country
United States
I've been trying to write a MBR that bootstraps code from the disk. I've been trying to use the BIOS interrupt 0x13 with ah=2, but it always fills the memory with zeros. The return is ah = 0 = success, and al = the correct number of read sectors. I'm using NASM. Here is my code:

Code:
[org 0x7c00]
[BITS 16]
 
; Init stack.
mov bp, 0x7B00
mov sp, bp
 
mov ah , 0x02 ; BIOS read sector function.
mov al , 0x01 ; Read 1 sector.
mov ch , 0x00 ; Cylinder 0.
mov dh , 0x00 ; Head 0.
mov cl , 0x02 ; Start from sector 2.
mov bx, 0
mov es, bx
mov bx, 0x8000 ; Read data to 0x0000:0x8000. dl already contains the boot drive index.
int 0x13
jc disk_error ; Jump if error.
 
mov bx, 0x8000 ; Start from 0x8000.
mov ax, 0x200 ; Read 512 bytes.
clc ; Do not prepend "0x".
call printx ; Print bytes as hex.
 
jmp $

I've tried starting from sectors 0 through 5 and reading different amounts with no luck. I haven't been using an emulator, I've been directly testing it on a PC. I had this function working once in the past so I know it can work with my SD card, but my HDD died and killed that data. I haven't been able to get it working again. Please help!
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • JuanMena @ JuanMena:
    Will you give me mouth to mouth oxygen if my throat closes?
  • K3N1 @ K3N1:
    Nah the air can do that
  • K3N1 @ K3N1:
    Ask @x65943 he's trained for that stuff
  • JuanMena @ JuanMena:
    Kissing random dudes choking in celery? Really? Need to study for that?
  • K3N1 @ K3N1:
    Yes it requires a degree
  • K3N1 @ K3N1:
    I could also yank out the rest of my teeth but theirs professionals for that
  • x65943 @ x65943:
    If your throat closes, putting oxygen in your mouth will not solve anything - as you will be introducing oxygen prior to the area of obstruction
  • JuanMena @ JuanMena:
    Just kiss me Kyle.
  • x65943 @ x65943:
    You either need to be intubated to bypass obstruction or create a stoma inferior to the the area of obstruction to survive
  • x65943 @ x65943:
    "Just kiss me Kyle." And I thought all the godreborn gay stuff was a smear campaign
  • JuanMena @ JuanMena:
    If I die, tell my momma I won't be carrying Baby Jesus this christmas :sad::cry:
  • K3N1 @ K3N1:
    Smear campaigns are in The political section now?
  • JuanMena @ JuanMena:
    Chary! Chary! Chary, Chary, Chary!
  • Sonic Angel Knight @ Sonic Angel Knight:
    Pork Provolone :P
  • Psionic Roshambo @ Psionic Roshambo:
    Sounds yummy
  • K3N1 @ K3N1:
    Sweet found my Wii u PSU right after I ordered a new one :tpi:
  • JuanMena @ JuanMena:
    It was waiting for you to order another one.
    Seems like, your PSU was waiting for a partner.
  • JuanMena @ JuanMena:
    Keep them both
    separated or you'll have more PSUs each year.
  • K3N1 @ K3N1:
    Well one you insert one PSU into the other one you get power
  • JuanMena @ JuanMena:
    It literally turns it on.
  • K3N1 @ K3N1:
    Yeah power supplies are filthy perverts
  • K3N1 @ K3N1:
    @Psionic Roshambo has a new friend
    +1
  • JuanMena @ JuanMena:
    It's Kyle, the guy that went to school to be a Certified man Kisser.
  • Psionic Roshambo @ Psionic Roshambo:
    Cartmans hand has taco flavored kisses
  • A @ abraarukuk:
    hi guys
    A @ abraarukuk: hi guys