Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsh!rkl From: rkl@cbnewsh.att.com (kevin.laux) Newsgroups: comp.os.msdos.programmer Subject: Re: Using DOS INT21 to read from a file Message-ID: <1991Feb4.142141.8839@cbnewsh.att.com> Date: 4 Feb 91 14:21:41 GMT References: <26647@uflorida.cis.ufl.EDU> Organization: AT&T Bell Laboratories Lines: 33 In article <26647@uflorida.cis.ufl.EDU>, jdb@reef.cis.ufl.edu (Brian K. W. Hook) writes: > char c[2]; > > asm { > mov ah, 3FH > mov bx, fhandle > mov cx, 0001H > mov dx, c ^^^ *** mov dx, OFFSET c *** push ds *** mov ds, SEG c > int 21 *** pop ds > } > > 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? You haven't properly specified the buffer address. You don't want to move the contents of c to the DX register. See above. The Carry Flag must be checked after the call. If it is set then AX will contain the error code. Otherwise AX will contain the number of bytes read. You really should RTFM more carefully. -- ________________________________________________________________________________ R. Kevin Laux Email: rkl1@hound.att.com AT&T Bell Labs Voice: (908) 949-1160 Holmdel, NJ 07733 Fax: (908) 949-0959