News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

DOS INT 21h Service 3Ch in AH

Started by jejump, June 24, 2020, 07:50:36 AM

Previous topic - Next topic

jejump

Does anyone know if using service 3Ch in DOS INT 21h (which creates a new file on disk), leaves the file open and assigns a handle to it?

I used this reference I found in a google search:

http://devdocs.inightmare.org/tutorials/x86-assembly-dos-file-inputoutput.html

That reference doesn't suggest that is the case.  The way I read that, it only creates the file on disk, but I do get a returned value of 0005 in AX after my file is created at the return of the INT call.  If I then use service 3Dh to open the file by the same name, AX returns 0006, which seems like the next consecutive handle number.  This is making me think the file was already opened and had a handle assigned.

Thanks in advance!

John

brianvs

#1
Function 03CH creates the file and it is open on exit of the int 21.
The "5" that you see is the file handle for accessing it. Use the regular write/read operations to use it.
This function works under real-mode DOS and a DOS window.
If you are running under a DOS window, you can also use function 071H and 06CH  for extended file functions and long file names.

If you are using these functions - it is best to try a File Open before using File Create. If the File Open fails, meaning the file does not exist- then use File Create. File Create will always create a new file, if a file by the same name already exists, it is gone.

I looked at some of your prior posts- and see that you used an Arduino with a Vortex 86EX

I've used the VortexDX since 2011, and am currently running a VortexDX3. I've just started using the Watcom compilers and assemblers, which can generate code for DOS and DOS extenders.

jejump

#2
Thanks for the swift reply and, yes, I am using the 86Duino for my latest project too.  It took some time to figure out the product since it seems the 86Duino team doesn't document it as well as Id like to see.  Also, those in the know about it don't respond to forum questions as promptly as I'd like either.  That being said, once you've gotten a handle on a few concepts, it's really a cool product!  I own four of them now.  It's not as cheap as something like the Raspberry Pi but it's not too pricey either--under $100 gets you an 86Duino model ONE with a PCIe video card and cable package.  I'll gladly pay a little more than the Pi to program on my favorite platform in my favorite languages.

Thanks again for answering my question!

John

brianvs

http://www.86duino.com/wp-content/uploads/2013/11/Vortex86EX_A9123_V14_86duino.pdf

I downloaded the Vortex86ex for my collection.

I typically learn the system calls to use implement a library for use with Fortran and C. I have most of the DOS functions for the IBM Professional/RM Fortran compiler. Mostly use PharLap extenders on the VortexDX, which would also run on the Vortex86EX with the Watcom compilers. The latter can emulate the FPU.

Depending on what language you use- these routines might port.