Hello people,
Have a question on how to format a disk,
say about 1.44 Mbytes into something like this:
----------------------------------------
| Sector# | Content |
----------------------------------------
| 0 ~ 100 | reserved |
| 101 ~ | in a structure like A1 |
----------------------------------------
Structure [A1]:
-------------------------------------------------
+0x00 => File ID
+0x04 => Date
+0x06 => char const "/"
+0x07 => Month
+0x09 => char const "/"
+0x0b => Year
+0x0e => User ID
+0x10 => Permission ID
+0x12 => File Extention (8 bytes)
+0x1a => char LinearAddress[4] /* linear address */
+0x1e => char *lpsName /* file name */
--------------------------------------------------
So, my point is that is there a way of formating
rest of the disks besides the first 100 sectors
into this kind of format, say if the FileExtension
is going to be "NOTSETED" or something like that
and also with the date seted as xx/xx/xxxx (x=>?)
and a whole lot of initializations ...
Thank you.
Format a disk
RE:Format a disk
Do the stuctures need to be initialized with the same
set of data or different before being written?
If it's different, you're probably going to have to create
a custom format program or just add a step to the following stuff.
If every structure is the same you could do this with
a %rep statment under NASM and use dd or partcopy to
write the file to specific sectors.
set of data or different before being written?
If it's different, you're probably going to have to create
a custom format program or just add a step to the following stuff.
If every structure is the same you could do this with
a %rep statment under NASM and use dd or partcopy to
write the file to specific sectors.
RE:Format a disk
>On 2001-03-03 10:27:22, Chase wrote:
>Do the stuctures need to be initialized with the same
>set of data or different before being written?
Yes, they are the same.
>If it's different, you're probably going to have to create
>a custom format program or just add a step to the following stuff.
>If every structure is the same you could do this with
>a %rep statment under NASM and use dd or partcopy to
>write the file to specific sectors.
But what happens if I want to do it on a freestanding
situation like format a disk (hard drive) during
boot time like the Linux's setup program to format
a disk and copy the required software on to the disk
and then ...
Thanks.
>Do the stuctures need to be initialized with the same
>set of data or different before being written?
Yes, they are the same.
>If it's different, you're probably going to have to create
>a custom format program or just add a step to the following stuff.
>If every structure is the same you could do this with
>a %rep statment under NASM and use dd or partcopy to
>write the file to specific sectors.
But what happens if I want to do it on a freestanding
situation like format a disk (hard drive) during
boot time like the Linux's setup program to format
a disk and copy the required software on to the disk
and then ...
Thanks.
- mathematician
- Member
- Posts: 437
- Joined: Fri Dec 15, 2006 5:26 pm
- Location: Church Stretton Uk
Re: RE:Format?a?disk
The format program would need to create the relevant data structures, and then write them out to disk with something like bios int 13h, if you are running in real mode. In protected mode you will need to have your own hard disk drivers implemented first. The format program which actually runs on your OS, rather than the make do and mend methods you use in the meantime, is probably something which lies several years down the road.Ben Hsu wrote:>On 2001-03-03 10:27:22, Chase wrote:
>Do the stuctures need to be initialized with the same
>set of data or different before being written?
Yes, they are the same.
>If it's different, you're probably going to have to create
>a custom format program or just add a step to the following stuff.
>If every structure is the same you could do this with
>a %rep statment under NASM and use dd or partcopy to
>write the file to specific sectors.
But what happens if I want to do it on a freestanding
situation like format a disk (hard drive) during
boot time like the Linux's setup program to format
a disk and copy the required software on to the disk
and then ...
Thanks.
- mathematician
- Member
- Posts: 437
- Joined: Fri Dec 15, 2006 5:26 pm
- Location: Church Stretton Uk
Just in case any body is interested in info on formating a disk, Roboman (a member of "Team DexOS" ), has written A floppy format tool for DexOS, it also runs from dos, it comes with full fasm source, So may help.
See here
http://jas2o.forthworks.com/dexforum/in ... opic=305.0
Note: you will have to join to see and down load the zip file.
See here
http://jas2o.forthworks.com/dexforum/in ... opic=305.0
Note: you will have to join to see and down load the zip file.
I already wrote my own, formats fat12, fat16 and fat32, as well as code write code to disk (since my kernel is just a file on disk, I wanted an easy way to write it using to an image file, so I wrote a simple fat12/16/32 driver, which I can re-use part of in my OS anyways). It currently is only for image's, but had a version compiled for Dos that would work on my actual disks as well (since I ran my OS from my HD and multi-booted using my custom MBR). It is written in C, and supports formating different partitions. I intend to work on an installation program for my OS that will use it, as well as once my OS is booted. I also plan on running it from windows, so I will compile a version for it as well. It will format a disk and copy the boot sector + 2nd stage, format the file allocation table, and write the kernel + drivers to disk. After that, I can just drag/drop in windows to copy more files . I will release the code if I ever get it to a point where i'm happy with it, or if you need some help, i could send it to someone, possibly strip the code to write files if you don't need that part. I require it due to the way my boot loader finds my kernel, my formating program is responsible for telling my bootloader where it is so there is no searching for it.Dex wrote:Just in case any body is interested in info on formating a disk, Roboman (a member of "Team DexOS" ), has written A floppy format tool for DexOS, it also runs from dos, it comes with full fasm source, So may help.
See here
http://jas2o.forthworks.com/dexforum/in ... opic=305.0
Note: you will have to join to see and down load the zip file.