RE: Memory Question
- Posted by "Daniel Kluss" <xerox_irs at hotmail.com> Feb 15, 2004
- 565 views
How do I allocate the physical memory? >From: CoJaBo <cojabo at suscom.net> >Subject: RE: Memory Question > > >I think this will work(I don't think it was tested on exw yet): > > >en, > >I just happen to have some machine code that I wrote (for Neil gfx lib >long ago) that will convert a physical address to an poke-able >Causeway-friendly virtual address. In the code below, replace >PhysBasePtr with your physical address, and the result video_mem will be > >the address that you can poke to. > >The machine code uses Causeway interrupt #31, function #19, >"Linear2Near" - CONVERT LINEAR TO APP-RELATIVE ADDRESS >(http://www.delorie.com/djgpp/doc/rbinter/ix/31/FF.html) > >Regards, >Pete > >include machine.e > >-- code to convert the physical base address to the linear frame buffer >address >constant getlfb = allocate(86) >poke(getlfb, { > #60, -- 0: pusha > #8B,#1D,#52,#2B,#14,#02,-- 1: mov ebx, [@linear] > #85,#DB, -- 7: test ebx, ebx > #74,#0C, -- 9: jz batman > #89,#D9, -- B: mov ecx, ebx > #C1,#EB,#10, -- D: shr ebx, 16 > #B8,#01,#08,#00,#00, -- 10: mov eax, #801 > #CD,#31, -- 15: int #31 > -- 17: batman: > #BB,#00,#00,#00,#00, -- 17: mov ebx, PhysBasePtr (24) > #89,#D9, -- 1C: mov ecx, ebx > #C1,#EB,#10, -- 1E: shr ebx, 16 > #BE,#00,#00,#40,#00, -- 21: mov esi, 4194304 > #89,#F7, -- 26: mov edi, esi > #C1,#EE,#10, -- 28: shr esi, 16 > #B8,#00,#08,#00,#00, -- 2B: mov eax, #800 > #CD,#31, -- 30: int #31 > -- 32: jc robin > #C1,#E3,#10, -- 32: shl ebx, 16 > #66,#89,#CB, -- 35: mov bx, cx > #89,#DE, -- 38: mov esi, ebx > #B8,#19,#FF,#00,#00, -- 3A: mov eax, #FF19 > #CD,#31, -- 3F: int #31 > #89,#35,#52,#2B,#14,#02,-- 41: mov [@linear], esi > #61, -- 47: popa > #C3, -- 48: ret > -- 49: robin: > #31,#C0, -- 49: xor eax, eax > #A3,#52,#2B,#14,#02, -- 4B: mov [@linear], eax > #61, -- 50: popa > #C3, -- 51: ret > #00,#00,#00,#00}) -- 52: linear: dd 0 (82) >poke4(getlfb + 3, getlfb + 82) -- @linear >poke4(getlfb + 67, getlfb + 82) -- @linear >poke4(getlfb + 76, getlfb + 82) -- @linear > > >poke4(getlfb + 24, PhysBasePtr) -- convert physical base address >call(getlfb) -- to linear frame buffer >video_mem = peek4u(getlfb + 82) > > >Daniel Kluss wrote: > > > > > > (in dos or win dos box) Does anyone know a good to allocate memory, and > > get > > the PHYSICAL address as well as the LOGICAL address, so system hardware > > can > > read/write and EUPHORIA can read/write. The only memory space I can find > > > > that does that so far is the allocate_low() which the PHY=LOG, but I > > want to > > allocate more than 1MB. > > > > > > >TOPICA - Start your own email discussion group. FREE! > >