X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=fzlOE8aWvMvp2/AKf8+4OyQfeYxiGwY+1zdCNsLBjeU=; b=gZalaHCp6LiYc2J3l8FFT4soH7NAWMZH4YEMFLseXaLvUYtiarpQagkxMLHlVaDSj9 SJsdMQdajnCTd2Q1Yo/TBv5+rRzKwESiSXJze63WD9cLl3AFAuIOOCE1hvuqkZc2LVmr BHbstGoiNZr8hKCSuRH5aS5TrZP5PSex7VbGLl5NjKC2kyrHWuWAeRB55J8iNrsmEmTq yovXbT8rz8MIN0URprhSZEjh91aXbind4hFlNtj0r4f+cemEEyOyq9Biixkye8QcT5v5 mOp/AxRhDMC8Qh2E0yTnBxI6/m+7Z2OrmkJLTW/5EZTGIJjHI4v4q0iE6Fq+ZjytRFwH gioQ== MIME-Version: 1.0 X-Received: by 10.52.246.101 with SMTP id xv5mr1560850vdc.73.1405661779417; Thu, 17 Jul 2014 22:36:19 -0700 (PDT) In-Reply-To: <201407180331.s6I3VKGq031144@envy.delorie.com> References: <82286315-4f2d-4699-8c58-97fb7bdf08cc AT googlegroups DOT com> <201407180331 DOT s6I3VKGq031144 AT envy DOT delorie DOT com> Date: Thu, 17 Jul 2014 22:36:19 -0700 Message-ID: Subject: Re: question about implementation,usage of _dosmemput* From: Louis Santillan To: "djgpp AT delorie DOT com" Content-Type: multipart/alternative; boundary=001a1136028c096f7404fe7123c2 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 --001a1136028c096f7404fe7123c2 Content-Type: text/plain; charset=UTF-8 DJ: FYI, the examples on dosmemputl & dosmemputb ( http://www.delorie.com/djgpp/doc/libc-2.02/libc_172.html and http://www.delorie.com/djgpp/doc/libc-2.02/libc_170.html) don't match the signature (the examples appear to be wrong) nor does it match the order/signature of dosmemputw. I wonder how thousands of eyeballs missed that. Jim: If you're looking to do EDD/LBA, see this older thread ( http://www.delorie.com/djgpp//mail-archives/thread.cgi?msg=djgpp/2003/04/12/08:15:18&mode=frames ) On Thu, Jul 17, 2014 at 8:31 PM, DJ Delorie wrote: > > > an example that includes an actual variable that'w wider than 1 byte > > to put into memory would be very very helpful. > > The dosmemputw example puts a "variable" (the array) which is 4,000 > bytes long. The _go32_dpmi_allocate_dos_memory() example moves > want_size bytes at a time. > > > if buffer is the target as it's described, where do I put the > > source? no argument for this I can find. > > The dosmemputw et al function have three different arguments. Only > one is a pointer. One is documented as a physical address. The > documentation says "from the program's virtual address space" so the > pointer argument is the source, and "to MS-DOS's conventional memory > space" with the math for computing that using offset, which is the > destination. It then says "and buffer is a pointer to somwhere > ... where the data will come from." > > I'm not sure how this is confusing. > > > const uint16_t key=0xb055; > > _dosmemputw(__tb+0,1,info.rm_segment*16); > > > > where do I put the address for key? > > In this case, __tb is the physical address, and &key is the virtual > address of your data. > > _dosmemputw(&key, 1, __tb+0); > > If you allocate *more* dos memory, you now have two physical addresses > for two buffers (the transfer buffer, __tb; and the new buffer, > address in info (seg*16+ofs)). > --001a1136028c096f7404fe7123c2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
DJ: FYI, the=C2=A0examples=C2=A0on dosmemputl & dosmemputb (http://www.delorie.com/djgpp/doc/libc-2.02/libc_172.html = and=C2=A0http://www.delorie.c= om/djgpp/doc/libc-2.02/libc_170.html) don't match the=C2=A0signature=C2=A0(the examples appear to b= e wrong) nor does it match the order/signature of=C2=A0dosmemputw. =C2=A0I wonder how tho= usands of eyeballs missed that.



On Thu,= Jul 17, 2014 at 8:31 PM, DJ Delorie <dj AT delorie DOT com> wrote:

> an example that includes an actual variable that'w wider than 1 by= te
> to put into memory would be very very helpful.

The dosmemputw example puts a "variable" (the array) which is 4,0= 00
bytes long. =C2=A0The _go32_dpmi_allocate_dos_memory() example moves
want_size bytes at a time.

> if buffer is the target as it's described, where do I put the
> source? no argument for this I can find.

The dosmemputw et al function have three different arguments. =C2=A0Only one is a pointer. =C2=A0One is documented as a physical address. =C2=A0The<= br> documentation says "from the program's virtual address space"= so the
pointer argument is the source, and "to MS-DOS's conventional memo= ry
space" with the math for computing that using offset, which is the
destination. =C2=A0It then says "and buffer is a pointer to somwhere ... where the data will come from."

I'm not sure how this is confusing.

> =C2=A0 =C2=A0 const uint16_t key=3D0xb055;
> _dosmemputw(__tb+0,1,info.rm_segment*16);
>
> where do I put the address for key?

In this case, __tb is the physical address, and &key is the virtual
address of your data.

_dosmemputw(&key, 1, __tb+0);

If you allocate *more* dos memory, you now have two physical addresses
for two buffers (the transfer buffer, __tb; and the new buffer,
address in info (seg*16+ofs)).

--001a1136028c096f7404fe7123c2--