![]() |
![]() |
#1 |
Registered User
Join Date: May 2017
Location: AmigaLand
Posts: 459
|
Mem Alloc Bootblock
Hi there,
I would like to alloc mem in order to copy data there. It's a bootblock code as the rest of the program is trackloaded after that from disk to fast mem. Need approx 100Kbytes in Fast (or Fake Fast) memory. Can someone explain me how it works ? May be a code sample in asm ? A method that should work in all Amigas (OCS,ECS,AGA) would be great. Also, a simple method, please ![]() Thanks, |
![]() |
![]() |
#2 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,017
|
move.l #size_of_data,d0
move.l #$10004,d1 move.l 4.w,a6 jsr -$c6(a6) If successful, pointer to the allocated memory space will be passed as a longword in D0, if not succesful, D0 = 0 However, I wouldn't only allocate just fast memory, because if you want your program to work on 1meg chip ram machines, they are less likely to have the fast ram located at $c00000 I typically do this, I try and allocate absolute memory, because from bootup, we can be pretty sure that the middle of the second half of chip ram from booting up the disk is free hence checking for the $c0000 memory range. And likewise, checking in the middle of fake fast ram $c40000 is a pretty safe bet. You obviously don't have to use those memory addresses afterwards, you're simply checking that memory type is available, obviously once you know it is, then $80000 would be the start of the second half of 512K chip ram in a 1 meg chip ram machine, and $c00000 is the base address of slow fast ram expansion. move.l 4.w,a6 move.l #$c0000,a1 jsr -$216(a6) tst.l d0 beq.s not_1meg_chip move.l #$c40000,a1 jsr -$216(a6) tst.l d0 beq.s not_fake_fast Last edited by Galahad/FLT; 20 July 2017 at 23:45. |
![]() |
![]() |
#3 |
Registered User
Join Date: May 2017
Location: AmigaLand
Posts: 459
|
Thanks for your fast and detailled reply.
Indeed, going for absolut memory allocs seems to be the best choice. |
![]() |
![]() |
#4 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
|
As long as you will not exit the bootblock to CLI/WB, this is OK for checking what kind of machine you're running on. But even if you don't exit, if you later try to allocate memory, it will now be fragmented (if you use AbsAllocs and don't free it).
Obviously don't use the slowmem (fake fast) check to assume that there's no fastmem in the machine, because lots of Amigas have fastmem without slowmem, and they could still have just the 512K chipmem. Last edited by Photon; 21 July 2017 at 23:02. |
![]() |
![]() |
#5 |
BiO-sanitation Battalion
Join Date: Jun 2017
Location: Scotland
Posts: 152
|
Is there no handy system variable tucked away somewhere that has the amount of Chip & Fast RAM that we can read to get an easy answer?
B |
![]() |
![]() |
#6 |
Registered User
Join Date: May 2017
Location: AmigaLand
Posts: 459
|
@Photon: I won't exit bootblock as the rest of the trackloaded program will turn system off. I have an Amiga 500 KS1.3 + FakeFast (1,8Mb) but I'd like to make the program ECS,AGA compatible.
About the NoFakeFastMem & YesTrueFastMem case, adding to Galahad's code this paragraph will be ok ? : move.l #$240000,a1 jsr -$216(a6) tst.l d0 beq.s not_realfastmem |
![]() |
![]() |
#7 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
|
![]() |
![]() |
#8 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,017
|
Quote:
![]() Obviously if you were not binning the system right from the start, using allocabs isn't a good idea, but from the bootblock, we can be certain that most of memory is clear and the check will work. |
|
![]() |
![]() |
#9 | ||
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
|
Quote:
Lots of setups have fastmem at $1000000, $40000000, and even $c80000 (with no RAM at $c00000-$c80000). So you shouldn't rely on fixed addresses. Quote:
If you find you need an actual start address for chipmem/fastmem, you can allocate the largest chunk and take the addresses. If you need the system on for library calls, you're done. Just pass the pointers to the rest of the code. If not, it's safe to round them off to the nearest lower or equal 512K boundary. Chipmem always starts at address $0. But some bytes are required for the different CPUs. I use $100.w as the start address for the loader. Last edited by Photon; 22 July 2017 at 01:09. |
||
![]() |
![]() |
#10 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,017
|
Quote:
I use $c0.... but, The Bitmap Brothers are more dope than me, they use $80 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
|
![]() |
![]() |
#11 |
Registered User
Join Date: Sep 2008
Location: Germany
Age: 49
Posts: 138
|
trap #0 ?
|
![]() |
![]() |
#12 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
|
![]() |
![]() |
#13 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,491
|
And stepping through ExecBase->MemList?
You can have a real view of memory mapping and select the best. Bye ![]() ross |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
bootblock | mai | support.Apps | 7 | 25 September 2012 11:28 |
Coding a bootblock | Yesideez | Coders. General | 15 | 23 May 2010 00:13 |
Interferon Bootblock Protector | Bloodwych | Nostalgia & memories | 4 | 12 September 2007 08:50 |
Anyone like to help understanding this bootblock ??? | Joe Maroni | Coders. Tutorials | 2 | 15 February 2007 17:33 |
Bootblock checksum | -Rob- | Coders. General | 5 | 17 April 2006 15:49 |
|
|