Author Topic: DOS INT 21h Service 3Ch in AH  (Read 73 times)

jejump

  • Regular Member
  • *
  • Posts: 13
    • JEJmp Machine Automation
DOS INT 21h Service 3Ch in AH
« on: June 24, 2020, 07:50:36 AM »
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
« Last Edit: June 30, 2020, 01:59:43 AM by jejump »

brianvs

  • Regular Member
  • *
  • Posts: 11
  • Longtime PharLap programmer, 32-bit since 1988
Re: DOS INT 21h Service 3Ch in AX
« Reply #1 on: June 24, 2020, 08:56:26 AM »
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.
« Last Edit: June 24, 2020, 11:15:39 AM by brianvs »

jejump

  • Regular Member
  • *
  • Posts: 13
    • JEJmp Machine Automation
Re: DOS INT 21h Service 3Ch in AH
« Reply #2 on: June 24, 2020, 11:12:01 AM »
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
« Last Edit: June 30, 2020, 02:00:08 AM by jejump »

brianvs

  • Regular Member
  • *
  • Posts: 11
  • Longtime PharLap programmer, 32-bit since 1988
Re: DOS INT 21h Service 3Ch in AX
« Reply #3 on: June 24, 2020, 11:27:40 AM »
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.