A little help understanding .
A little help understanding .
I have a USB flash drive and I formatted it using the HP USB Disk Storage Format Tool and it created a Dos Startup Disk. (works great)
After reading about mbr's, boot sectors and boot loaders I have a few things I don't fully understand.
Using hex workshop I opened up the physical disk (not logical) and the first sector has the following first few byte,
33 C0 8E D0 BC 00
It also has the error messages i read about.
Error loading operating system.
Followed by the MBR signature.
55AA
Is this the Master Boot Record?
Anyway using hex workshop again i opened the same disk this time using the logical option and the first sector has the following first few bytes,
EB 3C 90 4D 53 44
I know from reading that these bytes are the jmp to offset.
Is this the boot sector ?
Thanks alot .
After reading about mbr's, boot sectors and boot loaders I have a few things I don't fully understand.
Using hex workshop I opened up the physical disk (not logical) and the first sector has the following first few byte,
33 C0 8E D0 BC 00
It also has the error messages i read about.
Error loading operating system.
Followed by the MBR signature.
55AA
Is this the Master Boot Record?
Anyway using hex workshop again i opened the same disk this time using the logical option and the first sector has the following first few bytes,
EB 3C 90 4D 53 44
I know from reading that these bytes are the jmp to offset.
Is this the boot sector ?
Thanks alot .
The first set of hex ending with the 0xAA55 is the bootsector, the first sector on the drive that allows it to be recognized by the bios as a bootable device. I don't know about the jump as I don't read machine hex that well lol, but Its a safe assumption that it is probably a jump to the fully loaded kernel/program.
Website: https://joscor.com
Re: A little help understanding .
I do the same for my OS as the kernel is a mz exe which can run from dos, i stick my kernel32.exe on the usb along with its programs, then i can put the name of my kernel in the autoexe.bat to run it on boot up, works great, can even return to dos if i want to.Gavin wrote:I have a USB flash drive and I formatted it using the HP USB Disk Storage Format Tool and it created a Dos Startup Disk. (works great)
But to your ?, you need to know if you pc boots with floppy emulation or hdd emultion. if its fat12 it will be floppy, if its fat16 or fat it will be hdd.
If its fat16 you will find a MBR. At offset 450 you will find ether
0x04
0x06
0x0E
for fat16 or
0x0B
0x0C
for fat32
Also at offset 446 you should find 0x80
Now if it is the MBR you use the next bit of info to load the boot sector, eg:
Code: Select all
mov esi,MBRstart
add esi,446
mov al,byte[ds:esi]
cmp al,80h
jne LoadMbrError
mov dx,word[ds:esi] ; use these with int 13h to load the boot sector
mov cx,word[ds:esi+2] ; and this
;----------------------------------------------------;
; Store partition start cluster. ;
;----------------------------------------------------;
push eax
mov esi,MBRFat16n32
add esi,454
mov eax,dword[ds:esi]
mov [partition_start_cluster],eax ; we will need this later
pop eax
mov [countHdd],0
int13hloop1:
call FddRead
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Brynet-Inc
Ok I understand that part now but
when i open the disk with hex workshop using the physical disk option the first few bytes are
on sector 0
33C08ED0BC007CFB5007
on sector 32
EB3C902B77637A30494843
on sector 63
EB3C904D53444F53352E30
when i open it with hex workshop using the logical disk option the first few bytes are
on sector 0
EB3C904D53444F53352E3000
on sector 32
nothing
on sector 63
nothing
Am i safe in assuming that when i open the disk using the physical option on hexworkshop that it's using the CHS (Cylinder Head Sector) terms.?
And when i open it using the logical option its in LBA (Logical Block Address) terms?
I'm very confussing i know .....
Thanks alot.
Ok I understand that part now but
when i open the disk with hex workshop using the physical disk option the first few bytes are
on sector 0
33C08ED0BC007CFB5007
on sector 32
EB3C902B77637A30494843
on sector 63
EB3C904D53444F53352E30
when i open it with hex workshop using the logical disk option the first few bytes are
on sector 0
EB3C904D53444F53352E3000
on sector 32
nothing
on sector 63
nothing
Am i safe in assuming that when i open the disk using the physical option on hexworkshop that it's using the CHS (Cylinder Head Sector) terms.?
And when i open it using the logical option its in LBA (Logical Block Address) terms?
I'm very confussing i know .....
Thanks alot.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
When you open up the physical device, you're viewing the "entire" device.
The "Logical Device" on the other hand, starts within the first partition, at an offset of 32k(0x8000) bytes.
How did I calculate that? The partition starts at LBA 63, counting starts at 0, and the LBA size is 512 bytes.
So: 64 * 512 is 32768 bytes.
Hope that helps..
The "Logical Device" on the other hand, starts within the first partition, at an offset of 32k(0x8000) bytes.
How did I calculate that? The partition starts at LBA 63, counting starts at 0, and the LBA size is 512 bytes.
So: 64 * 512 is 32768 bytes.
Hope that helps..
This link may help you:
http://menuet.2.forumer.com/index.php?showtopic=1112
http://menuet.2.forumer.com/index.php?showtopic=1112