qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

int 13 ah=42 in boot sector returns error 0Ch


From: bilsch01
Subject: int 13 ah=42 in boot sector returns error 0Ch
Date: Fri, 1 Nov 2019 22:29:19 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

int 0x13 ah=0x42 error code 0Ch means UNSUPPORTED TRACK OR INVALID MEDIA.

I have never seen this before when I was using real hardware (flash drives).

my command line is: qemu-system-i386 -hda js1.bin

js1.bin is 17 sectors as follows:
sector 1: boot sector with error reporting capability. See listing below.
sectors 2 thru 17: my operating system, jsec2.bin

Please note: I include the format=raw in command line: qemu-system-i386 -hda js1.bin format=raw but it won't run unless I remove format=raw. Then it runs and reports the 0Ch error. Qemu says: WRITE OPERATIONS ON BLOCK 0 WILL BE RESTRICTED - because format=raw was not specified.
I wonder if that is what is causing the 0Ch error.

Here is the boot sector:

bits 16
org 0x7c00

mov ax,0
mov ss,ax
mov sp,0x7aff
mov ds,ax

mov si,0x7b00     ;packet location
mov word[si],0x10     ;packet size
mov word[si+2],16    ;# of secs to transfer
mov word[si+4],0x0000     ;offset where to load
mov word[si+6],0x07e0     ;segment where to load
mov word[si+8],2               ;start sector# - mbr=0, bs=1
mov word[si+10],0
mov word[si+12],0
mov word [si+14],0
mov ah,0x42     ;extended read
mov dl,0x80
int 0x13
jc berr     ;CF=1=failure

mov ax,0x0e31      ;CF=0=success, print 1
int 0x10


jmp 0:0x7e00      ;long jump

berr:
push ax      ;save error code from int 13
mov ax,0x0e45      ;CF=1=failed, print E
int 0x10
pop ax

mov cx,2      ;print the 2 digits in ah
hexout:
rol ax,4        ;put hi hex digit on right
push ax       ;save rol'd ax
and al,0x0f
add al,'0'      ;0 thru 9
cmp al,'9'
jbe .prnhx
add al,0x7    ;A thru F
.prnhx:
mov ah,0xe
int 0x10      ;write
pop ax        ;rol'd version of ax
dec cx
jnz hexout     ;1 digit per loop

jmp $

times 510-($-$$) db 'k'
dw 0xAA55





reply via email to

[Prev in Thread] Current Thread [Next in Thread]