I'm new into the OS Development (something about 6 months or less) and I now have some questions about reading a floppy sector using inline assembly in C. I don't have enough knowledge to work in PMode yet, so I'm "practicing" in Real Mode first.
I have my bootloaded coded in asm, of course, where I use INT13 to read sectors from floppy to memory. In that case, ES:BX points to the address where the data from floppy will be stored. The problem is that I'm writing my "mini OS" in C (using Turbo C++ 3) and I thought that was useful to code a function that receives the CHS and a destination pointer (possibly a 512 byte vector). I'm at the university now so I don't have the exact code here, but I don't know how to control the SEG:OFF of the destination (or how to know where I'm loading data to). I did something like this:
Code: Select all
unsigned char flBuff[512]
void readCHS(unsigned char Cylinder, unsigned char Head, unsigned char Sector, unsigned char Buffer[]) {
asm mov ah, 0x02
asm mov al, 6
asm mov ch, Cylinder
asm mov cl, Sector
asm mov dh, Head
asm mov bx, 0x09C0
asm mov es, bx
asm mov bx, Buffer
asm int 0x13
}
Bootsector: 07C0:0000
Stack: 09C0:0000 (512 bytes "above" the BS) to 09C0:0FFF
Kernel: 09C0:1000
Regards,
Fergo.


