Hi!

I know this is a Win32 board, but can someone help me with some dos-codes?
:stupid:

I've written a small program (which I'm going to continue on), but I'm afraid there are some serious bugs in my code... This is first time I write such a program... and first time I've ever tried allocating memory and file-handling in DOS, so anybody who wants to help me would be appreciated. (I've programmed in assembly (FASM) for about one year.)

I attach a zip-file with the codes and everything (it's going to be an easy programming language (if I can call it that)).

Thanks! Cheers!
Tommy
Posted on 2003-05-25 03:26:10 by Tommy
All I can you code like Privalov :grin: No comments found.
Here's a nice link:
http://www-2.cs.cmu.edu/afs/cs/user/ralf/pub/WWW/files.html
A must have for anyone coding in dos.
Posted on 2003-05-25 07:43:18 by roticv
Hi Tommy,

looking at your code I feel 15 years younger (at least), back in the 80s.

Probably you should give us some hints what is going wrong.

You are using dos function 48h to allocate memory. this will return a SEGMENT if successful, it's not a pointer, so you are using it in a wrong way currently. You will have to deal with all this old segmentation stuff if you dont switch to 32bit, which I would strongly suggest.

Japheth
Posted on 2003-05-25 11:09:53 by japheth
Oh, I see... Thanks!

So long!
Tommy
Posted on 2003-05-25 12:07:23 by Tommy
Hi Tommy,

DOS alloc 64kb segment for your *.com file. If your file smallest than 64k you can use a buffer.




bufstart equ codeend - codestart

codestart label word

... your code
... you data

codeend label word
here is your buffer start area
...buffer....
...stack....



But don't remember stack pointer. As for me you must alloc minimum 512 byte for stack pointer.

65535 - 512 = 65023 - bufstart = max alloc mem

Regards,
Posted on 2003-05-26 02:17:02 by CYDONIA
Thanks alot! :alright: Exactly what I needed!

So long! Take care!
Posted on 2003-05-30 02:05:26 by Tommy