All I want from you is one example of which you speak about the start function and getting the length using this registry 0x80.0000 to 0x9f.ffff range. Say I want to store Dim level (512, 512) and wish to store this memory consuming RAM between this range 0x80.0000 to 0x9f.ffff using the start function you speak and poking an peeking.
You give me one example and I am set, I promise I will not ask about this topic anymore. I take it we are incrementing by hexadecimal right?
It might be best to go back to Amiga basics. The Amiga has an operating system. So whether you boot up into Workbench or a simple CLI window, that operating system is already using up some of the RAM in your machine. It will use a bit of Chip RAM for what's being displayed on screen (Workbench or CLI) and a bit of Fast RAM (if available) for managing the system and the RAM: disk. The Amiga operating system allocates whatever memory it needs for this and keeps track of it for you. So when you run something like AMOS, it is also taking up some of the system's memory. Again, Chip RAM for any graphics or sound and Fast RAM for the program itself and its memory requirements.
The point being that only the Amiga's operating system "knows" where all that allocated memory is. And it could be anywhere! That's why you can't just Peek and Poke around in the Amiga's memory without first politely asking the operating system for a chunk to play with. If you ignore that, you will inevitably end up either Poke-ing into a memory address that's already being used, or you will have whatever you've Poke-ed into memory stomped on when the operating system allocates some memory it requires. Either way it's a disaster!
So the Amiga high-level programming languages, like AMOS, all have instructions to politely request memory. In AMOS, these chunks of memory are known as "banks". They are identified by a Bank Number. All you need to do is specify:
- A free Bank Number
- How many bytes you want
- Whether you want Chip or Fast RAM
AMOS then has instructions to tell you the memory address where your bank starts and how long it is. Having got that information, you can then Peek and Poke to your heart's content within that chunk of memory. It also has Deek and Doke (two bytes) and Leek and Loke (four bytes) instructions plus an instruction to copy blocks of memory. I won't go into the details here as the manual explains it very well (download links below).
It is very important to realise that some memory is already being used by both the operating system and AMOS. And both will prefer to use your Fast RAM for anything that doesn't require Chip RAM. So just because you've got a 2Mb Fast RAM does not mean that you can allocate a 2Mb Bank! AMOS also has instructions to find out how much is available in Chip and Fast RAM. Check before you go allocating any very large Banks.
What version of AMOS are you using? AMOS The Creator or AMOS Pro? If it's AMOS The Creator, I would strongly recommend upgrading to AMOS Pro using
this and
this from the Downloads section. The PDF version of the AMOS Pro manual is really useful too as its bookmarks and index make it very easy to chase up what you need to find. It's also in the Downloads section
here. Read the section from page 157 onwards for info on Banks and page 557 onwards for info on manipulating memory. The online version is also very good (the link Hungry Horace provided above).
AMOS The Creator is limited to only 16 banks. AMOS Pro allows over 65,000. We'll assume you're using AMOS Pro.
A last couple of things to beware of:
Sprite, Bob and Icon objects can also be stored in Banks. BUT, they're not just Banks that contain a nice chunk of linear memory to play with! Each object is loaded into its own chunk of memory and AMOS keeps track of what's where in a list. In other words, they're scattered all over the place. Any other banks are okay - nice linear chunks of memory.
Bank numbers 1 through 16 are a bit special in that each one is "usually" allocated to a specific purpose. For example, most of the AMOS accessory programs use Bank 16 for their Interface data, Bank 1 for Sprites, etc. (I can never remember the exact list, look it up in the manual). So it's always best to check whether a Bank Number is in use before using it. Simply ask for its Length. If it's zero, the Bank Number's free.
Final words: Have a read of those sections in the manual. And use the built-in help system, there's some example programs there that can help show you how to use the instructions. Best of all, play with it - the best way to learn.