flat assembler
Message board for the users of flat assembler.

Index > OS Construction > File I/O without DOS

Author
Thread Post new topic Reply to topic
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 18 Apr 2004, 16:33
If I'm writing an OS, I can't use DOS interrupt (21h) to work with files, so what interrupt should I do?

Thanks!
Post 18 Apr 2004, 16:33
View user's profile Send private message Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 18 Apr 2004, 16:47
int 13h?
Post 18 Apr 2004, 16:47
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 18 Apr 2004, 16:49
Yes, but How can use it? Give me an example please.
Thanks
Post 18 Apr 2004, 16:49
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 18 Apr 2004, 18:02
int13h access disk just as array of bytes (just little more complicated). you have to create som structures on disk, which will create wiles (like FAT or NTFS) Nothing against you, but i think it is little too much for you now, sorry.
Post 18 Apr 2004, 18:02
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 19 Apr 2004, 14:59
oh, OzzY, I'm coding a filesystem for my OS at the moment, too... Is there in the net somewhere a code from 0x21? If, then we could take it... That would be esier, why should you devolope the wheel again?
Post 19 Apr 2004, 14:59
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 19 Apr 2004, 18:45
maybe because 21h code is from mico$uck?

ok, i think that coding OS is mainly for learning purpose, and coding filesystem is nice experience.
Post 19 Apr 2004, 18:45
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 19 Apr 2004, 20:45
I didn't said that I was codind an OS, but I'd like to learn how to use file I/O without DOS......
I'm just 17 years old, and I've been learning asm for 4 years and general programming for 6 years.... by now I'll stay with asm....

So can anyone help me with some examples on file I/O without DOS??

Thanks
Post 19 Apr 2004, 20:45
View user's profile Send private message Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 21 Apr 2004, 14:43
on wich base do you programm? on win you mustn't use int 0x13, because it runs in PM and doesn't support to use BIOS-Ints...
Post 21 Apr 2004, 14:43
View user's profile Send private message Visit poster's website Reply with quote
valy



Joined: 01 Aug 2003
Posts: 14
Location: France
valy 06 May 2004, 10:51
How do you do

google at pizziOS homepage, for instance.
He uses ATA commands instead of slower (and real mode) int 13h.
Talking directly to the hard disk.

But beware : adding some code u do not master is - my experience - dangerous (to debug)
And before coding this, make sure u coded the interrupt handling first !
Redirect the external interrupts through the PIC, etc
I put it in my (kind of) DOS extender and it's nice : now it often comes back to DOS instead of rebooting/hanging, when buggy.
I did not yet implement HDD support. Debugging support is really important IMO. And I plan to *never* use BIOS calls when into PM.

Regards

_________________
Easier, faster
Post 06 May 2004, 10:51
View user's profile Send private message Visit poster's website Reply with quote
ShortCoder



Joined: 07 May 2004
Posts: 105
ShortCoder 15 May 2004, 10:27
Probably the best (easiest) route for you to take is to use a FAT format on a floppy drive (MS-DOS formatting a floppy will do this for you), find specs on FAT filesystem (you can find this information VERY readily/easily), then read/write raw sectors on disk using BIOS int 13h as they've said. You want to work with floppy drive because, otherwise, one wrong messup and your data on your drive (OS, files, etc) could be bornked;) which could require a reformat of hard drive and reinstall of OS and files. If you mess up on a floppy, all you have to do is reformat the floppy disk--nothing important lost there.

If you're using FAT filesystem you will be using something pretty "standard" and so could write files to the floppy using normal means and then read them using your raw sector-reading program or else write them that way and read them with "standard" programs.

Of course, you could make your own filesystem but then nothing else will be able to read anything you write to it. (Okay, technically there is a way around this but it involves making your own device driver)

Okay, once you have gotten this to work satisfactorily, you probably want to read up on the boot sector of the hard drive and master boot record and boot loaders and partitions. Then, if you're really brave, try it on your hard disk but make sure to back up anything important first of all because one wrong move could render it unreadable;).
Post 15 May 2004, 10:27
View user's profile Send private message Reply with quote
Gomer73



Joined: 29 Nov 2003
Posts: 151
Gomer73 02 Jun 2004, 05:43
Here is a sample boot sector code.
I did some major documentation because I wanted it to be a reference for the boot sector.

It automatically creates the the FATs and Directory structure. Unfortunately because the program size is variable the fat is just set to a big size and is not variable. It'll show you how to do some floppy reads.

For Bogdan, I updated your code so that it will read a track at a time instead of a sector at a time.

I'm not using this code, so I left a lot of junk in there, a lot of it using some sol OS stuff. Didn't feel like modifying it to get it working for the post. If it is of value to anybody, great.

...Gomer73


Description:
Download
Filename: bootcode.ZIP
Filesize: 5.98 KB
Downloaded: 838 Time(s)

Post 02 Jun 2004, 05:43
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.