X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: blk5743 AT yahoo DOT com DOT tw Newsgroups: comp.os.msdos.djgpp Subject: Re: code from BC31(16bits) to DJGPP(32 bits) Date: 28 Nov 2005 19:27:44 -0800 Organization: http://groups.google.com Lines: 109 Message-ID: <1133234864.835782.126770@g49g2000cwa.googlegroups.com> References: <1133146328 DOT 335307 DOT 54810 AT g44g2000cwa DOT googlegroups DOT com> <1133226276 DOT 234728 DOT 136880 AT f14g2000cwb DOT googlegroups DOT com> NNTP-Posting-Host: 61.66.169.71 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1133234869 9434 127.0.0.1 (29 Nov 2005 03:27:49 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Tue, 29 Nov 2005 03:27:49 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 SVRPROXY Complaints-To: groups-abuse AT google DOT com Injection-Info: g49g2000cwa.googlegroups.com; posting-host=61.66.169.71; posting-account=fl8v7w0AAAAQV4ThVU509YNPI8o0JeB3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp 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 hello, this is my code of BC++ 31 i need to convert these code to DJGPP i must know physical address of structrues and buffer which i must assign to BIOS/INT call. i do not know how can i get really address for these call that i can use FP_SEG,FP_OFF in BC++ 31 #define TOTAL_REGIONS 12 // // VDS DMA Descriptor Data Structure typedef struct { ULONG RegionSize; // DDS region size ULONG Offset; // DDS region offset WORD Segment; // DDS region segement WORD BufferID; // to be filled by VDS ULONG PhysicalAddr; // to be filled by VDS } DDS; // // VDS EDDS Region Data Structure typedef struct { ULONG PhysicalAddr; ULONG Size; } REGION; // // VDS Extended DMA Descriptor Data Structure typedef struct { ULONG RegionSize; // Size of the region ULONG Offset; // Offset ULONG Segment; // Segment, the upper 16 bits must be 0. WORD NumberAvail; // number of region available WORD NumberUsed; // number of region used, to be filled by VDS REGION Region[TOTAL_REGIONS]; // physical regions, to be filled by VDS } EDDS; // // PRD Table Structure typedef struct // Physical Region Descriptor { ULONG BaseAddr; // Region base address WORD ByteCount; // Region size WORD EOT; // End of Table } PRD_T; // typedef union { ULONG addr; WORD addr_word[2]; } PRD_T_A; BYTE far *r_buffer; int LockDMARegion(ULONG size) { // Construct the EDDS table. PRD_EDDS.RegionSize = size; PRD_EDDS.Offset = FP_OFF(r_buffer); PRD_EDDS.Segment = FP_SEG(r_buffer); PRD_EDDS.NumberAvail = TOTAL_REGIONS; _DI = (WORD)(&PRD_EDDS); asm{ push es mov ax, ds mov es, ax // ES:DI points to PRD_EDDS mov dx, 0 // DX = 0 as we does not use page-table EDDS mov ax, 8105h // Scatter/Gather Lock Region request int 4bh pop es jnc LockRegionOK } return 1; // Scatter/Gather Lock Region request failed. LockRegionOK: return 0; // Scatter/Gather Lock Region request OK. } int Lock_PRD() { if((*VDS_Exist) & 0x20) { if(PRD_DDS.BufferID == 0) { PRD_DDS.RegionSize = sizeof(PRD_Pool); PRD_DDS.Offset = (WORD)(PRD_Table); PRD_DDS.Segment = _DS; _DI = (WORD)(&PRD_DDS); asm{ push es mov ax, ds mov es, ax // ES:DI points to PRD_DDS mov dx, 3ch mov ax, 8103h int 4bh // VDS: Lock DMA Buffer Region pop es jnc Lock_DDS_OK } return 1; } Lock_DDS_OK: PRD_Addr.addr = PRD_DDS.PhysicalAddr; } else // VDS not exist PRD_Addr.addr = ((ULONG)(_DS)<<4) + (WORD)(PRD_Table); return 0; }