Date: Tue, 13 Feb 2001 09:19:54 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Jeremiah cc: djgpp AT delorie DOT com Subject: Re: inline asm In-Reply-To: <000601c09577$53707660$168baad0@0021682320> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Mon, 12 Feb 2001, Jeremiah wrote: > regs.x.ax = 0x3800; /* AH = 38h, AL = 00h */ > regs.x.ds = __tb >> 4; /* transfer buffer address in DS:DX */ > regs.x.dx = __tb & 0x0f; > __dpmi_int (0x21, ®s); /* call DOS */ > if (regs.x.flags & 1) /* is carry flag set? */ > /* The call failed; use the default symbol. */ > return strdup ("$"); > else > { > /* The call succeeded. The local currency symbol is stored > as an ASCIIZ string at offset 2 in the transfer buffer. */ > char *p = (char *)malloc (2); > if (p != 0) > dosmemget (__tb + 2, 2, p); > return p; > } > > It says it puts the string at offset 2 int the transfer buffer. Does it > always start the data at offset 2? No, it's just that this particular function of Int 21h returns a buffer where the currency symbol is at offset 2 from the buffer's beginning. The documentation of this Int 21h function (e.g., in the Interrupt List) tells these details. These lines in the above snippet: regs.x.ds = __tb >> 4; /* transfer buffer address in DS:DX */ regs.x.dx = __tb & 0x0f; set things up so that the data returned by DOS is put into the transfer buffer starting with its beginning, i.e. from offset zero. If I wanted to start from offset 2, I'd change the second line above to this: regs.x.dx = __tb & 0x0f + 2; > On: dosmemget (__tb +2,2,p); is the second 2 the number of bytes to > put into p? Yes. See the documentation of dosmemget ("info libc alpha dosmemget") for more details.