Page 1 of 1
IMG file
Posted: Mon Mar 02, 2009 10:52 pm
by david
bochs can make hd img file,
in the img file
the first sector is from 0 to 0x1FF, the second sector is from 0x200 to 0x3FF, the third sector is from 0x400 to 0x5FF,
...... etc.
am i right?
Re: IMG file
Posted: Mon Mar 02, 2009 10:53 pm
by Troy Martin
Yep.
post++;
Re: IMG file
Posted: Mon Mar 02, 2009 11:05 pm
by david
Code: Select all
# hard disk
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="c.img", mode=flat, cylinders=20, heads=16, spt=63
the cylinders. heads and spt decide the size of hd img file.
I can creat a file, size is 10,321,920 bytes, named 'c.img', then i can make this file as the hd img file to use.
am i right?
Re: IMG file
Posted: Mon Mar 02, 2009 11:24 pm
by david
another question: bochs can not read/write hd via LBA ?
Code: Select all
; LBA
mov ax, 4200h
mov dl, 80h
mov si, offset cs:dap
push cs
pop ds
int 13h
jmp $
dap: db 10h
db 0
dw 5
dw 0
dw 3000h
dd 0
dd 0
when i debug the code, bochs told me that:
Code: Select all
>>PANIC<< int13_harddisk: function 42. Can't use 64bits lba
Re: IMG file
Posted: Tue Mar 03, 2009 4:43 am
by jal
david wrote:when i debug the code, bochs told me that:
Code: Select all
>>PANIC<< int13_harddisk: function 42. Can't use 64bits lba
Thanks for letting us know. Is there a question?
JAL
Re: IMG file
Posted: Tue Mar 03, 2009 7:53 am
by captainwiggles
bochs works with 28 bit LBA, but not 48 bit, and I didn't even know 64 bit LBA existed :\
Re: IMG file
Posted: Tue Mar 03, 2009 9:46 am
by Troy Martin
captainwiggles wrote:and I didn't even know 64 bit LBA existed :\
Me neither, and I've been at this for almost a year
You learn new things every day.
Ooohhhhh, so that's why we have school....
Re: IMG file
Posted: Tue Mar 03, 2009 10:40 am
by quok
captainwiggles wrote:bochs works with 28 bit LBA, but not 48 bit, and I didn't even know 64 bit LBA existed :\
Bochs 2.3.7 (perhaps 2.3.5, I'm not sure) works fine with 48-bit LBA. It's in the Changelog for one of the two versions.
Re: IMG file
Posted: Tue Mar 03, 2009 4:12 pm
by JohnnyTheDon
The 64-bit LBA eror is because the upper bits of the LBA address you're sending has something other than 0s in it. Somewhere the LBA address is getting corrupted, either in your DAP or when you generate the address.
Re: IMG file
Posted: Tue Mar 03, 2009 9:58 pm
by david
I use Bochs 2.3.5
Re: IMG file
Posted: Tue Mar 03, 2009 10:32 pm
by david
my error, i forgot the cs's value is 0 when bochs jmps to 0x7c00.
it's ok now.
Code: Select all
; set CS=07C0, IP=@F
push 07C0h
push @F
retf
@@:
; LBA
mov ax, 4200h
mov dl, 80h
mov si, offset cs:dap
push cs
pop ds
int 13h
dap: db 10h
db 0
dw 5
dw 0
dw 3000h
dd 0
dd 0
Re: IMG file
Posted: Wed Mar 04, 2009 9:39 am
by Troy Martin
Instead of this:
Code: Select all
; set CS=07C0, IP=@F
push 07C0h
push @F
retf
@@:
You should probably do this:
Code: Select all
; set CS = 07C0h, IP = after this jump
jmp 0x07C0:sync
sync:
Saves a byte IIRC. And in a bootloader, a byte saved is both a byte earned AND a seriously important thing.