Amos Professional Manual  Contents  Index

Memory Banks


BSTART
function: return the address of a memory bank from a previous program
address=BSTART(bank number)

Similarly, the BSTART function will give the address of the specified memory bank from a previous program, if possible. An error will be returned if no such bank has been reserved.

BGRAB
instruction: grab a memory bank used by the previous program
Bgrab bank number

This command is used to grab a memory bank from the previous program. The selected bank is erased from its former program and appropriated to the current program's list of memory banks. If a selected bank number already exists in the current program, then it will be erased before being replaced by the grabbed bank. However, a grabbed bank is not automatically replaced at its original location. This must be achieved using a BSEND instruction, which is explained next.

If the bank which is specified to be grabbed does not exist a "Bank not reserved" message will be generated.

BSEND
instruction: transfer a memory bank from the current program to the previous program
Bsend bank number

This command is the exact opposite of the BGRAB instruction. The specified bank is erased from the current program list of banks, and appears in the list of banks belonging to the previous program. If a bank already occupies this position in the previous program, it will be erased. Both the BGRAB and BSEND commands are very fast, and blocks of data are not reserved first.

Here is an example of how to grab memory banks safely. The example lists all of the banks of the previous program before they are grabbed, and it should be noted that the name of the bank is located eight bytes before the BSTART address:

X> If Prg Under : Rem Check availability of a previous program
    For B=1 To 1000: Rem Check the first 1000 banks!
     If Blength(B)
      Print "Bank number:";B;" found. Name: ";Peek$(Bstart(B)-8,8)
      Bgrab B: Rem Grab the bank
     End If
    Next
   End If

Automatic bank grabbing
This feature is a unique bonus! It allows memory banks to be passed between programs completely automatically. You could be in the middle of writing an arcade game, call up the

Back    Next
05.09.10