I have been working on a small (real mode) boot code recently and I have been running into some problems with int 0x13. At first I was trying to use 'int 0x13, ah= 0x02' to simply load more code into RAM just after the boot sector. That output error code ah=0x01 (invalid command), so I tried 'int 0x13, ah= 0x41' to try to find out whether int 0x13 was even working. I tried this on qemu, my dell latitude E7240, my ancient desktop with an Intel DQ965GF motherboard and a Q6600 CPU, and an assortment of other more modern x86 computers. Of course qemu worked, but the only real computer that worked was the DQ965GF desktop, all the other computers output error code ah=0x01 (invalid command). Any help would be greatly appreciated! Thanks! Here is the code that errors:
Yes I did remember to define a partition table and the magic boot number, and yes I'm positive that 'printHex' works. I used that for debugging.
[org 0x7c00]
[bits 16]
jmp start
bootDrive db 0
start:
mov [bootDrive], dl ; Stores the drive # in bootDrive
; Inits all relevant registers------------------------------------------
xor si, si
xor di, di
mov ax, 0x7c00
mov bp, ax ; Set bp (base pointer) for our stack
mov sp, ax ; Set sp (stack pointer) equal to the bp
mov ax, 0x0000
mov ss, ax ; Set ss (stack segment) to zero
mov ds, ax ; Set ds (data segment) to zero
mov es, ax
; Inits all relevant registers------------------------------------------
; Boot code goes here---------------------------------------------------
mov ax, 0x0000 ; int 10/ah= 0x00 -> set video mode (clear screen)
int 0x10
mov ah, 0x41
mov dl, [bootDrive]
mov bx, 0x55AA
int 0x13 ; Check extentions present
jc .errMain ; If theres an error
mov dx, cx ; Print Extensions
call printHex
jmp .done
.errMain:
mov dx, ax ; Print Error Code
call printHex
.done:
jmp $