I need a system call to write a file to a FAT12 disk, but I don't know how to do that. I was thinking it could take a filename in SI, data starting memory address in AX, and data size in BX. I don't know what BX should be in multiples of, maybe 512-byte sectors.
Thanks!
Troy
os_write_file
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Re: os_write_file
My method is using file handles, thus allowing the kernel itself to deal with the nitty-gritty details. My write_file call is (FILE *f, char *buffer, size_t length).
-JL
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: os_write_file
I think I may have written my post unclearly. I need some code to write a file to a FAT12 disk or a tutorial on how to do that.
Re: os_write_file
I think you mean that you want to implement FAT12 file system in your os,
if this's right take a look at this...
if this's right take a look at this...
The man who follows the crowd will usually get no further than the crowd.
The man who walks alone is likely to find himself in places
no one has ever been before.
The man who walks alone is likely to find himself in places
no one has ever been before.
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: os_write_file
I have reading files and loading programs from FAT12-formatted disks, but not writing. I've got a nice .pdf I found and WordPad open (my OS is in 16-bit assembly) so I'm going to wing it and hope it turns out okay. I'll post it if it works
Re: os_write_file
The added difficulty when writing a file is that if you are writing beyond its current size (in terms of blocks), you need to find some new space on the disk, by locating it in the FAT and updating the FAT-chain for that file. Good luck.Troy Martin wrote:I have reading files and loading programs from FAT12-formatted disks, but not writing.
JAL