A bank object encapsulates a block of memory you can use to store arbitrary data.
Banks are useful for storing data that is of no fixed type - for example, the contents
of a binary file.
To create a bank, use the CreateBank command.
To write data to a bank, use one of 'Poke' style commands, such as PokeByte.
To read data from a bank, use one of the 'Peek' style commands, such as PeekByte.
In addition, banks can be loaded or saved using LoadBank or SaveBank.
Types
Functions
Function reference
Function CreateBank:TBank( size=0 ) |
Returns | A bank object with an initial size of size bytes
|
Description | Create a bank |
Information |
CreateBank creates a Bank allocating a specified amount of memory that
can be used for storage of binary data using the various Poke and
Peek commands.
|
Function CreateStaticBank:TBank( buf:Byte Ptr,size ) |
Returns | A bank object that references an existing block of memory
|
Description | Create a bank with existing data |
Information |
The memory referenced by a static bank is not released when the bank is deleted.
A static bank cannot be resized.
|
Function LoadBank:TBank( url:Object ) |
Returns | A bank containing the binary contents of url, or null if url could not be opened
|
Description | Load a bank |
Information |
LoadBank reads the entire contents of a binary file from a specified url into a newly
created bank with a size matching that of the file.
|
Function SaveBank( bank:TBank,url:Object ) |
Returns | True if successful.
|
Description | Save a bank |
Information |
SaveBank writes it's entire contents to a url. If the url is a file path a new
file is created.
|
Function BankBuf:Byte Ptr( bank:TBank ) |
Returns | A byte pointer to the bank's internal memory buffer
|
Description | Get bank's memory buffer |
Information |
Please use LockBank and UnlockBank instead of this method.
|
Function LockBank:Byte Ptr( bank:TBank ) |
Returns | A byte pointer to the memory block controlled by the bank.
|
Description | Lock a bank's memory block |
Information |
While locked, a bank cannot be resized.
After you have finished with a bank's memory block, you must use UnlockBank
to return it to the bank.
|
Function UnlockBank( bank:TBank ) |
Description | Unlock a bank's memory block |
Information |
After you have finished with a bank's memory block, you must use UnlockBank
to return it to the bank.
|
Function BankSize( bank:TBank ) |
Returns | The size, in bytes, of the bank's internal memory buffer
|
Description | Get size of bank |
Function BankCapacity( bank:TBank ) |
Returns | The capacity, in bytes, of the bank's internal memory buffer
|
Description | Get capacity of bank |
Information |
The capacity of a bank is the size limit before a bank must allocate
more memory due to a resize. Bank capacity may be increased due to a call
to ResizeBank by either 50% or the requested amount, whichever is greater.
Capacity never decreases.
|
Function ResizeBank( bank:TBank,size ) |
Description | Resize a bank |
Information |
ResizeBank modifies the size limit of a bank. This may cause memory to be
allocated if the requested size is greater than the bank's current capacity,
see BankCapacity for more information.
|
Function CopyBank( src_bank:TBank,src_offset,dst_bank:TBank,dst_offset,count ) |
Description | Copy bank contents |
Information |
CopyBank copies count bytes from src_offset in src_bank to dst_offset
in dst_bank.
|
Function PeekByte( bank:TBank,offset ) |
Returns | The byte value at the specified byte offset within the bank
|
Description | Peek a byte from a bank |
Information |
A byte is an unsigned 8 bit value with a range of 0..255.
|
Function PokeByte( bank:TBank,offset,value ) |
Description | Poke a byte into a bank |
Function PeekShort( bank:TBank,offset ) |
Returns | The short value at the specified byte offset within the bank
|
Description | Peek a short from a bank |
Information |
A short is an unsigned 16 bit (2 bytes) value with a range of 0..65535.
|
Function PokeShort( bank:TBank,offset,value ) |
Description | Poke a short into a bank |
Information |
An short is an unsigned 16 bit value that requires 2 bytes of storage.
|
Function PeekInt( bank:TBank,offset ) |
Returns | The int value at the specified byte offset within the bank
|
Description | Peek an int from a bank |
Information |
An int is a signed 32 bit value (4 bytes).
|
Function PokeInt( bank:TBank,offset,value ) |
Description | Poke an int into a bank |
Information |
An int is a signed 32 bit value that requires 4 bytes of storage.
|
Function PeekLong:Long( bank:TBank,offset ) |
Returns | The long integer value at the specified byte offset within the bank
|
Description | Peek a long integer from a bank |
Information |
A long is a 64 bit integer that requires 8 bytes of memory.
|
Function PokeLong( bank:TBank,offset,value:Long ) |
Description | Poke a long integer int into a bank |
Information |
A long is a 64 bit integer that requires 8 bytes of storage.
|
Function PeekFloat#( bank:TBank,offset ) |
Returns | The float value at the specified byte offset within the bank
|
Description | Peek a float from a bank |
Information |
A float requires 4 bytes of storage
|
Function PokeFloat( bank:TBank,offset,value# ) |
Description | Poke a float into a bank |
Information |
A float requires 4 bytes of storage
|
Function PeekDouble!( bank:TBank,offset ) |
Returns | The double value at the specified byte offset within the bank
|
Description | Peek a double from a bank |
Information |
A double requires 8 bytes of storage
|
Function PokeDouble( bank:TBank,offset,value! ) |
Description | Poke a double into a bank |
Information |
A double requires 8 bytes of storage
|
Function ReadBank( bank:TBank,stream:TStream,offset,count ) |
Returns | The number of bytes successfully read from the Stream
|
Description | Read bytes from a Stream to a Bank |
Function WriteBank( bank:TBank,stream:TStream,offset,count ) |
Returns | The number of bytes successfully written to the Stream
|
Description | Write bytes from a Bank to a Stream |