13 June 2013, 00:50 | #1 |
... aka Amix73
Join Date: Jan 2009
Location: Austria
Posts: 87
|
"special" chip-mem allocation 68K-ASM
Hi there everybody!
I want to allocate memory to us it as bit plane memory. That usually not a problem but I have certain requirements which must be satisfied. I wonder if there is an elegant solution ... * I want to keep it as legal as possible - so I need to allocate the memory with AllocAbs or AllocMem. * I need a mem-block much less than 64K - lets say 24K. * I do not want to cross 64K boundaries - therefore the the memory should be positioned in the chip area - just to be safe on most Amigas - below $80000. So typically I would like to have my memblock either before or after a 64K boundary. Do I need to try to iteratively AllocAbs from e.g. ($20000+-MyBlocksize) up to ($80000-MyBlocksize) until I get a valid block? or is there a better way? Thanks for your help! |
13 June 2013, 07:17 | #2 |
Registered User
Join Date: Feb 2010
Location: Espoo / Finland
Posts: 818
|
I'm guessing allocating a larger block than the 24k needed is not an option?
|
13 June 2013, 07:43 | #3 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Alloc a bit more memory than you need and align it then. For example, if you want to have your memory aligned to a 64k boundary you would alloc YOURMEMSIZE+65536 bytes and after allocating you'd do this:
; d0.l: allocated memory add.l #65536,d0 and.l #$3ff0000,d0 ; align to 64k boundary Another option (if you're going to use AllocAbs() anyway), save the memory block you're going to destroy in a temporary buffer and then just use it. At the end you need to restore it of course. Last edited by StingRay; 13 June 2013 at 08:19. Reason: forgot a line of code |
13 June 2013, 08:20 | #4 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Ugly but working method which does not waste memory (Enforcer uses this method to get MMU page aligned memory which means it can't be too bad):
AllocMem(65536 + memory size you need) normally. Forbid() Free whole allocated block AllocAbs(allocated block aligned to next 65536 byte boundary, size you need) Permit() |
13 June 2013, 11:42 | #5 |
... aka Amix73
Join Date: Jan 2009
Location: Austria
Posts: 87
|
Gyus - thank you very much - these are very nice ideas - and for me still "legal enough" - I don't know which I like most
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
New One Of "Homebrew" 68k Amiga Magazine Idea | fishyfish | Retrogaming General Discussion | 6 | 16 April 2013 08:57 |
James Pond "Special Edition"? | Stefan Lindberg | Retrogaming General Discussion | 15 | 03 March 2013 23:00 |
Amiga Forever 2009.1 Released - "Black Friday" Special | Paul_s | News | 0 | 26 November 2009 22:32 |
REQ: Power Play Special issues "Die Hundert Besten Spiele" (hundred best games) | rsn8887 | AMR suggestions and feedback | 0 | 01 June 2007 19:02 |
Special Preview release of "SDK Browser" for AmigaOS4 RELEASED | Paul | News | 0 | 21 December 2004 11:34 |
|
|