X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Thu, 17 Jul 2014 23:31:20 -0400 Message-Id: <201407180331.s6I3VKGq031144@envy.delorie.com> From: DJ Delorie To: djgpp AT delorie DOT com In-reply-to: <82286315-4f2d-4699-8c58-97fb7bdf08cc@googlegroups.com> (message from Jim Michaels on Thu, 17 Jul 2014 19:53:42 -0700 (PDT)) Subject: Re: question about implementation,usage of _dosmemput* References: <82286315-4f2d-4699-8c58-97fb7bdf08cc AT googlegroups 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 > 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)).