I am trying to put some data on my floppy disk to use it inside my OS. My OS boots perfectly from my floppy and I can read the data,
Actually the data I am loading is getting larger than 1.4 MB so I have decided to switch to a hard disk.
But when I boot with Qemu and try to load the disk parameters using interrupt 13H using the following code:
Code: Select all
mov ah,0x8 ; Get Drive Parameters
mov dl,0x80 ; First Internal Hard Drive
int 0x13
add dh,0x1 ; DH has the number of heads-1
mov [heads],dh ; Store number of heads into memory
mov ax,cx ; The 10 left most bits of CX has the
shr ax,0x6 ; number of Cylenders-1
add ax,0x1
mov [cyl],al ; Store number of cylenders into memory
mov ax,cx ; The 6 right most bits of CX has the
and ax,0000000000111111b ; number of sectors per cylender - 1
add ax,0x1
mov [sectors],al ; Store number of sector to memory
The number of cylinders returns 0. here is a snapshot from qemu info registers at this point:
Code: Select all
QEMU 2.0.0 monitor - type 'help' for more information
(qemu) info registers
EAX=00000040 EBX=00000008 ECX=0000003f EDX=00001001
ESI=000082e6 EDI=00000000 EBP=00000000 ESP=00007bfc
EIP=0000803d EFL=00000212 [----A--] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0000 00000000 0000ffff 00009300
CS =0000 00000000 0000ffff 00009b00
SS =0000 00000000 0000ffff 00009300
DS =0000 00000000 ffffffff 00c09300
FS =0000 00000000 0000ffff 00009300
GS =0000 00000000 0000ffff 00009300
LDT=0000 00000000 0000ffff 00008200
TR =0000 00000000 0000ffff 00008b00
GDT= 0000832d 0000000f
IDT= 00000000 000003ff
CR0=00000010 CR2=00000000 CR3=00000000 CR4=00000000
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000000
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
I created my disk as follows:
$(CAT) $(BIN)/bootstage1.bin $(BIN)/bootstage2.bin $(BIN)/stage1.bin $(BIN)/trampoline.bin /dev/zero | $(DD) bs=512 count=2880 of=$(IMAGE)/boot.flp
$(DD) if=$(BIN)/bosml.bin bs=512 seek=25 of=$(IMAGE)/boot.flp conv=notrunc,noerror
$(DD) if=$(IMAGE)/ramdisk.img bs=512 seek=825 of=$(IMAGE)/boot.flp conv=notrunc,noerror
$(DD) if=$(BIN)/KernelMain.bin bs=512 seek=1625 of=$(IMAGE)/boot.flp conv=notrunc,noerror
Any ideas on how to convert the resulting image to another format that when I start qemu with "-hda" instead of "-fda" it fetches its cylinders configuration correctly?
Thanks
Karim.

