delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/11/29/21:30:32

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <dont_have AT bitbucket DOT cmm>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: code from BC31(16bits) to DJGPP(32 bits)
Date: Tue, 29 Nov 2005 21:23:24 -0500
Organization: Aioe.org NNTP Server
Lines: 85
Message-ID: <dmj2e3$9jo$1@domitilla.aioe.org>
References: <1133146328 DOT 335307 DOT 54810 AT g44g2000cwa DOT googlegroups DOT com> <dmf6p4$kke$1 AT domitilla DOT aioe DOT org> <1133226276 DOT 234728 DOT 136880 AT f14g2000cwb DOT googlegroups DOT com> <dmgcpm$u34$1 AT domitilla DOT aioe DOT org> <1133234864 DOT 835782 DOT 126770 AT g49g2000cwa DOT googlegroups DOT com> <dmi003$ntf$1 AT domitilla DOT aioe DOT org> <1133314507 DOT 884056 DOT 150990 AT f14g2000cwb DOT googlegroups DOT com>
NNTP-Posting-Host: pCFjXAYAthfOLF6YhIh1ZA.user.domitilla.aioe.org
X-Complaints-To: abuse AT aioe DOT org
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MSMail-Priority: Normal
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

<blk5743 AT yahoo DOT com DOT tw> wrote in message
news:1133314507 DOT 884056 DOT 150990 AT f14g2000cwb DOT googlegroups DOT com...

> Thanks, i will try it.
> I have another question now.
>
> the address of r_buffer as below, right
> r_buffer: PM address = (ULONG)r_buffer
> r_buffer: RM address = (ULONG)r_buffer+__djgpp_conventional_base;

If r_buffer is declared in your program (not DOS, not XMS, not RM memory)
then,

r_buffer: PM address = &r_buffer;
r_buffer: RM address: doesn't exist, there are *NO* RM addresses above
1Mb+64k, your code is above 1Mb+64k
r_buffer: linear/physical address
=(ULONG)r_buffer+__djgpp_conventional_base;

Otherwise, if r_buffer is MS-DOS memory, XMS memory, or below 1Mb, then

r_buffer: PM address = (RM segment <<4)+(RM offset) -
__djgpp_conventional_base;
r_buffer: RM address is  RM segment:RM offset
r_buffer: linear/physical address = (RM segment <<4) +(RM offset);


> // only if r_buffer points to data within this program...
> does this mean that i just declare ****BYTE *r_buffer**** or **** BYTE
> r_buffer[0x10000]**** in my program

Maybe.  I don't know.  What is r_buffer?  Your code sample doesn't show me
how or where r_buffer is allocated.  If it is declared by the C program, the
addressing is different than if it is allocated through MS-DOS, XMS, etc.

> and if i lock a region in XMS, i should use
>     PRD_EDDS.Offset = r.x.dx;    // RM offset e.g., Lock XMS r.x.dx
> segment
>     PRD_EDDS.Segment = r.x.bx;   // RM segment e.g., Lock XMS r.x.bx
> offset

No.  If r_buffer is RM memory, then use different addressing.

> if i need data, i use dosmemget/put to the XMS region, right.

Yes.  I think.  Is this what you are doing?

1) allocate XMS
2) set DMA to XMS
3) read CD
4) move DMA data to program

Here's a rough memory map of your computer.  Where is  r_buffer?  Above or
below 1Mb?  In the program or outside the program?

--------4Gb---------   physical 4Gb, no RM address, PM address 0xFFFFFFFF
|              |               |
|              |               |
|              |               |
|              |               |
|              |               |
-----r_buffer?-------   physical __djgpp_conventional_base+&r_buffer, no RM
address, PM address &r_buffer
|              |               |
|              |               |
--------EXE--------   physical __djgpp_conventional_base, no RM address, PM
address 0, start of .EXE
|              |               |
|              |               |
--------1Mb--------  physical 1Mb+64k, RM FFFF:F, PM
0xFFFFF-__djgpp_conventional_base
|              |               |
-----r_buffer?-------  physical segment<<4+offset, RM segment:offset, PM
segment<<4+offset -__djgpp_conventional_base
|              |               |
--------0Mb--------  physical 0Mb, RM 0000:0, PM
0x00000-__djgpp_conventional_base




Rod Pemberton


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019