@DATABASE MemoryBank V1.00
$VER: Pure Basic - Memory Bank library V1.00 (27.08.2000) © Fantaisie Software
@NODE MAIN "Memory Bank V1.00"

  @{b}Pure Basic MemoryBank library V1.00@{ub}

    With this library you can allocate any number of memory banks.
    You can put them either into Chip-RAM or into Fast-RAM. It also
    includes functions to copy and fill memory. When your program ends
    the allocated memory banks will automatically be freed.

  @{b}Commands summary:@{ub}

    @{" AllocateMemoryBank " LINK AllocateMemoryBank}
    @{" AvailableMemory    " LINK AvailableMemory}
    @{" CopyMemory         " LINK CopyMemory}
    @{" FillMemory         " LINK FillMemory}
    @{" FreeMemoryBank     " LINK FreeMemoryBank}
    @{" InitMemoryBank     " LINK InitMemoryBank}
    @{" MemoryBankAddress  " LINK MemoryBankAddress}
    @{" MemoryBankSize     " LINK MemoryBankSize}
    
  @{b}Example:@{ub}

    @{" MemoryBank example " LINK "PureBasic:Examples/Sources/MemoryBank.pb/Main"}

@ENDNODE

@NODE AllocateMemoryBank

    @{b}SYNTAX@{ub}
  *Adresse = AllocateMemoryBank(Bank#, Size.l, MemType.l)

    @{b}COMMAND@{ub}
  Allocates a memory bank and returns its adress or 0, if the memory bank 
  couldn't be allocated. If you have already allocated a memory bank
  with the same bank number, that one will be automatically freed.

  Bank#: a number to identify the memory bank

  Size: the size of the memory bank in bytes

  MemType: with this parameter you can define additional properties
           of the memory bank:

   #MEMF_FAST  => Fast-RAM
   #MEMF_CHIP  => Chip-RAM
   #MEMF_CLEAR => Clear memory

           Just add these values or use the logical OR.

           Example: MemType = #MEMF_CHIP | #MEMF_CLEAR
           
           If you neither use #MEMF_FAST or #MEMF_CHIP, the
           bank will be in Fast-RAM, or in Chip-RAM, if there's
           not enough Fast-RAM available.

@ENDNODE


@NODE AvailableMemory

    @{b}SYNTAX@{ub}
  FreeMemory.l = AvailableMemory(MemType.l)

    @{b}FUNCTION@{ub}
  Returns how much memory is still available.

  MemType: With this parameter you can define the properties of the
           available memory.
           
   #MEMF_FAST => Fast-RAM
   #MEMF_CHIP => Chip-RAM
   
           Just add these values or use the logical OR.
           
           To get the amount of both Fast- and Chip-RAM, set
           MemType to 0.
   
@ENDNODE


@NODE CopyMemory

    @{b}SYNTAX@{ub}
  CopyMemory(*Source, *Dest, Size.l)

    @{b}COMMAND@{ub}
  Copies a memory chunk.

  *Source: The source address

  *Dest: The destination address

  Size: The size of the memory chunk in bytes

@ENDNODE


@NODE FillMemory

    @{b}SYNTAX@{ub}
  FillMemory(*Dest, Size.l, Value.b)

    @{b}COMMAND@{ub}
  Fills a memory chunk with an optional Byte.

  *Dest: The destination address

  Size: The size of the memory chunk in bytes

  Value: The value you want to fill the memory chunk with

@ENDNODE


@NODE FreeMemoryBank

    @{b}SYNTAX@{ub}
  FreeMemoryBank(Bank.l)

    @{b}COMMAND@{ub}
  Frees a memory bank.

@ENDNODE


@NODE InitMemoryBank

    @{b}SYNTAX@{ub}
  InitMemoryBank(MaxBanks.l)

    @{b}COMMAND@{ub}
  Allocates a memory chunk for informations about the memory banks.
  This command must always be called before all other functions of
  this library.

@ENDNODE


@NODE MemoryBankAddress

    @{b}SYNTAX@{ub}
  *MemoryBank = MemoryBankAddress(Bank#)

    @{b}FUNCTION@{ub}
  Returns the address of the specified memory bank.

@ENDNODE


@NODE MemoryBankSize

    @{b}SYNTAX@{ub}
  Size.l = MemoryBankSize(Bank#)

    @{b}FUNCTION@{ub}
  Returns the size of the specified memory bank in bytes.

@ENDNODE
