Write sectors to usb drive from assembly
Posted: Mon Dec 28, 2015 4:58 am
I'm developing a bare metal software (there is no operating system, my code is started by the grub), and i would like to save some measurements data to an usb drive. I switched to real mode after my tests in order to use BIOS interrupts, but before I saved my data to the memory address 0xEE00 (it is an awailable address in real mode).
I used the following code to write a sector to my usb drive:
After the tests, the "pendrive is reading or writing" led was blinking, i.e. my pendrive showed that this code writes something to the pendrive. CF is zero, i've checked it. However, after I read the first ~5 Mbytes from this pendrive by linux dd, I can't find the modified sector. I tried to write a sector filled by 'A' characters, but there is no such a sector on my pendrive. What is the problem? One more thing: I've removed my hard discs from the test computer.
I used the following code to write a sector to my usb drive:
Code: Select all
mov ax, 0
mov es, ax
mov ah, 0x03
mov al, 0x01
mov cx, 1
mov dl, 0x80 ; drive
mov dh, 0 ; head
mov bx, 0xEE00
clc
int 0x13