🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #4513

Using DOS INT21 to read from a file

#4513
From: Brian K. W. Hook
Date: Sun, 03 Feb 1991 19:12
23 lines
1021 bytes
I am using TASM and TC++ to try and read from a file in section of code
of mine.  I am using inline assembly....

char c[2];

asm {
	mov ah, 3FH
	mov bx, fhandle
	mov cx, 0001H
	mov dx, c
	int 21
}

Now fhandle is 0 for stdin, I am just trying to read a single character.
I want to use the DOS INT instead of read or fread since I want my code
as small as possible.

AX returns 86C0, which is REALLY wrong.  AX should be the number of bytes
read or at least an error code....what am I doing wrong?

Thanks,

Brian
Technical Details
Message-ID: <26647@uflorida.cis.ufl.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!emory!gatech!uflorida!reef.cis.ufl.edu!jdb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!emory!gatech!uflorida!reef.cis.ufl.edu!jdb
From: jdb@reef.cis.ufl.edu (Brian K. W. Hook)
Newsgroups: comp.os.msdos.programmer
Subject: Using DOS INT21 to read from a file
Message-ID: <26647@uflorida.cis.ufl.EDU>
Date: 3 Feb 91 19:12:05 GMT
Sender: news@uflorida.cis.ufl.EDU
Organization: UF CIS Dept.
Lines: 23