iooperating-systembiosfloppy

How to read the second floppy with BIOS interrupt


I need to make a mini OS(boot from floppy A) that can write/read floppy B.

The environment is vmware workstation. The floppies are A.img and B.img.

In A.img, I set a MBR program and a func.bin. I need to archieve above function in func.bin. Following is a code snippet in it.

...             ; set es:bx
mov ah, 0x03    ; read sectors
mov al, 0x01    ; 1 sector
mov ch, 0x00    ; cylinder
mov cl, 0x03    ; sector
mov dh, 0x00    ; head
mov dl, 0x01    ; B.img
int 0x13

Then I got the return code: ah = 0x01. It means "illegal command" but I don't know what caused it.

I tried to change mov dl, 0x01 to mov dl, 0x00(A.img) or mov dl, 0x80(hard disk), they all succeed. So I want to know how I can solve it.


update my question:
The B.img has been set to "be auto-connected when vm runs".

size of A: 31.5KB size of B: 1.44MB


Solution

  • The problem has been sovled by myself.

    It caused by I don't know the config of VM.

    By default, only one floppy drive is enabled in the virtual machine's BIOS. If you are adding a second floppy drive to the virtual machine, click inside the virtual machine window and press F2 as the virtual machine boots to enter the BIOS setup utility. On the main screen, choose Legacy Diskette B: and use the plus (+) and minus (-) keys on the numerical keypad to select the type of floppy drive you want to use. Then press F10 to save your changes and close the BIOS setup utility.

    https://www.vmware.com/support/ws5/doc/ws_disk_add_floppy.html