From: "Johan Venter" Newsgroups: comp.os.msdos.djgpp References: <7ua3p5$nlt$1 AT news8 DOT svr DOT pol DOT co DOT uk> Subject: Re: Memory in DJGPP Lines: 60 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Message-ID: Date: Sun, 17 Oct 1999 11:47:32 +1000 NNTP-Posting-Host: 203.40.82.127 X-Trace: newsfeeds.bigpond.com 940154776 203.40.82.127 (Sun, 17 Oct 1999 20:06:16 EST) NNTP-Posting-Date: Sun, 17 Oct 1999 20:06:16 EST Organization: Telstra BigPond Internet Services (http://www.bigpond.com) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hammy wrote in message news:7ua3p5$nlt$1 AT news8 DOT svr DOT pol DOT co DOT uk... > okay, i was looking in the hlp on RHIDE for the memset, and other mem > functions. Apparently some only allow int size moves and stuff? I thought > you could move anything int he range of 32bits? An int is DJGPP IS 32 bits. > Also, what does the __tb mean? i think it stands for a transfer buffer? but > im nto sure what that actually means, or when to use such a thing. I > noticed it being used in retreiving the VESA mode info. You are supposed to > called a interupt and the data is sent to es:di and u should set a stuct to > this. > heres the code: __tb stands for transfer buffer. It is a small amount of allocate memory in DOS conventional memory. It is used by DJGPP for various things, but the main use a programmer can use it for is for interrupts that require a buffer in DOS conventional memory, thus its use in VESA code. > ModeInfoBlock *get_mode_info(int mode) > { > static ModeInfoBlock info; > __dpmi_regs r; > > r.x.ax = 0x4F01; > r.x.cx = mode; > r.x.es = __tb / 16; > r.x.di = 0; Note, the safest way to do the above is: regs.x.di = __tb & 0x0F; regs.x.es = (__tb >> 4) & 0xFFFF; It will mask out the unused bits. > why do they divide by 16? Because __tb is a pointer to a DOS buffer in conventional memory, and the VESA functions require a seperate segment and offset in the CPU registers es and di. __tb / 16 (ANDing with 0xFFFF is recommended), extracts the DOS segment of the transfer buffer. > I know I have sent another mesaage about this but i didnt ask this int he > same way: whne you have the physical address of the videobuffer, what can > you do with it? You can use DJGPP's far pointer functions to set pixels on screen, or alternatively turn on near ptrs (by extending the limit of ds) and accessing it that way. The latter is not recommended as it effectively disables memory protection, which could result in problems if your code is buggy. -- Johan Venter ICQ 3643877 - jventer AT writeme DOT com The TPU DJGPP Interest Group - http://surf.to/djgppig The RSXNTDJ 1.5 HOWTO - http://surf.to/rsxntdj