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.
I forgot to mention that the program uses the ascii character set for drawing.
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.
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.
If you *really* want to do dos, you should find Ralph Brown's interrupt
list, it is invaluable.
list, it is invaluable.
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)...
Isn't FCB the old-style way of dealing with files in DOS?
yes... isn't freedumb87 looking for file handling stuff?
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.
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.
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.
Thanks
Thanks
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...
:)
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...
:)
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?
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 :).
in the PlatformSDK. CreateFile,CloseHandle,SetFilePointer,ReadFile,WriteFile.
That should get you started :).