I have a dos program that needs to be edited so I can add some functions for saving an image to a path that the user enters and for loading a path that the user enters. My asembly program is sort of like a very simple dos drawing program. So the object is to be able to save the drawing to a file so that it can be loaded back in the future without having to start over. So, can someone direct me on where I could find some sort of tutorial or instructions on saving and loading files that a beginner can understand?

I forgot to mention that the program uses the ascii character set for drawing.
Posted on 2002-04-20 18:18:43 by freedumb87
you need some kind of BIOS or MS-DOS file functions, which are used via interrupt.
Since this question is not very win32asm related, I wonder if you would like to make a Win32 version of your DOS program? Its much more fun and also somewhat easier to work in 32bit mode than in 8/16bit DOS.
Posted on 2002-04-22 08:15:25 by beaster
If you *really* want to do dos, you should find Ralph Brown's interrupt
list, it is invaluable.
Posted on 2002-04-22 08:17:23 by f0dder
file i/o in DOS is accomplished in a similar (not really, though) method to the Win32 paradigm... it uses handles to files. when you have d/led RBIL as recommended above, do a search for FCB (File Control Buffer)...
Posted on 2002-04-22 17:18:15 by jademtech
Isn't FCB the old-style way of dealing with files in DOS?
Posted on 2002-04-22 17:25:55 by f0dder
yes... isn't freedumb87 looking for file handling stuff?
Posted on 2002-04-22 17:56:50 by jademtech
Well, as far as I remember there's two sets of file handling APIs
in DOS... the handle-based ones and the FCB based ones. I could
be wrong, though...

Anyway (off top of my head), for handle-based IO, you use
function 3Dh (ah=3D, al=mode, int 21) to open the file. 3Eh to
close the file. 42h to set file pointer. 3Fh to read. 40h to write.
I'm not totally sure about the numbers, but they should at least
serve as lookup points in ralph browns interrupt list.
Posted on 2002-04-22 18:08:32 by f0dder
Thanks guys, I am going to check out the list. That will get me started. I think I can do it once I can find the proper functions.

Posted on 2002-04-22 18:46:58 by freedumb87
According to my old MS-DOS Functions book, from MS press, f0dder's memory is pretty good. :)

You could also look around for a program called HELPPC. It has a ton of detailed info on DOS interrupts, structs, etc.

And yes, there are 2 ways of doing things with DOS interrupts. The really, really old FCB way (which you should avoid), and the newer handle method.

But you really should give this stuff up, and learn the Win API. It does make life much easier, even if it doesn't look that way at first...

Posted on 2002-04-22 23:22:37 by S/390
How IS file access done in Win32? I don't remember seeing anything about file access in Iczelion's tutorials... maybe someone should write one and send it to him?
Posted on 2002-04-23 06:07:17 by AmkG
File access in win32 is easy. Look up "base services -> file storage -> file I/O"
in the PlatformSDK. CreateFile,CloseHandle,SetFilePointer,ReadFile,WriteFile.
That should get you started :).
Posted on 2002-04-23 09:28:52 by f0dder