Not all bank thingies, but at least most of 'em.
Rem
'
' CreateBank
'
Local MyBank:TBank=CreateBank(16)
For Local t:Int=0 To BankSize(MyBank)-1
Print PeekByte(MyBank,t)
Next
End
'
' PokeByte
'
' Pokebyte puts an unsigned byte value into a bank, at a given address
'
Local MyBank:TBank=CreateBank(16)
PokeByte MyBank,0,123
PokeByte MyBank,15,234
For Local t:Int=0 To BankSize(MyBank)-1
Print PeekByte(MyBank,t)
Next
End
'
' PokeShort
'
' PokeShort puts an unsigned short value (2 bytes) into a bank, at a given address. Take notice not to exceed the
' boundaries of the bank. A short value should not be poked at the last possible byte address of the bank.
'
Local MyBank:TBank=CreateBank(16)
PokeShort MyBank,0,256
PokeShort MyBank,14,32768+1
For Local t:Int=0 To BankSize(MyBank)-1
Print PeekByte(MyBank,t)
Next
End
'
' PokeInt
'
' PokeInt puts a signed int value (4 bytes) into a bank, at a given address. Take notice not to exceed the boundaries of
' the bank. An int value should not be poked at the last possible byte or short address of the bank.
'
Local MyBank:TBank=CreateBank(16)
PokeInt MyBank,0,-10000001
PokeInt MyBank,12,31415926
For Local t:Int=0 To BankSize(MyBank)-1
Print PeekByte(MyBank,t)
Next
End
'
' PokeLong
'
' PokeLong puts a signed long value (8 bytes) into a bank, at a given address. Take notice not to exceed the boundaries of
' the bank. A long value should not be poked at the last possible byte, short or int address of the bank.
'
Local MyBank:TBank=CreateBank(16)
PokeLong MyBank,0,-10000001234567
PokeLong MyBank,8,31415926000000
For Local t:Int=0 To BankSize(MyBank)-1
Print PeekByte(MyBank,t)
Next
End
'
' PokeFloat
'
' PokeFloat puts a signed float value (4 bytes) into a bank, at a given address. Take notice not to exceed the boundaries of
' the bank. A float value should not be poked at the last possible byte or short address of the bank.
'
Local MyBank:TBank=CreateBank(16)
PokeFloat MyBank,0,0.123456
PokeFloat MyBank,12,1234.5678
For Local t:Int=0 To BankSize(MyBank)-1
Print PeekByte(MyBank,t)
Next
End
'
' PokeDouble
'
' PokeDouble puts a signed double value (8 bytes) into a bank, at a given address. Take notice not to exceed the boundaries
' of the bank. A double value should not be poked at the last possible byte, short, int or float address of the bank.
'
Local MyBank:TBank=CreateBank(16)
PokeDouble MyBank,0,123495543.12342345123
PokeDouble MyBank,8,121235567.89015678123
For Local t:Int=0 To BankSize(MyBank)-1
Print PeekByte(MyBank,t)
Next
End
'
' PeekByte
'
' PeekByte reads an unsigned byte value from a bank, at a given address.
'
Local MyBank:TBank=CreateBank(16)
For Local t:Int=0 To BankSize(MyBank)-1
PokeByte Mybank,t,Rnd(255)
Next
Print PeekByte(MyBank,0)
Print PeekByte(MyBank,1)
End
'
' PeekShort
'
' PeekShort reads an unsigned short value (2 bytes) from a bank, at a given address. Take notice not to exceed the
' boundaries of the bank. A short value should not be read from the last possible byte address of the bank.
'
Local MyBank:TBank=CreateBank(16)
For Local t:Int=0 To BankSize(MyBank)-1
PokeByte Mybank,t,Rnd(255)
Print PeekByte(MyBank,t)
Next
Print
Print PeekShort(MyBank,0)
Print PeekShort(MyBank,1)
Print PeekShort(MyBank,14)
End
'
' PeekInt
'
' PeekInt reads a signed int value (4 bytes) from a bank, at a given address. Take notice not to exceed the
' boundaries of the bank. An int value should not be read from the last possible byte or short address of the bank.
'
Local MyBank:TBank=CreateBank(16)
For Local t:Int=0 To BankSize(MyBank)-1
PokeByte Mybank,t,Rnd(255)
Print PeekByte(MyBank,t)
Next
Print
Print PeekInt(MyBank,0)
Print PeekInt(MyBank,1)
Print PeekInt(MyBank,12)
End
'
' PeekLong
'
' PeekLong reads a signed long value (8 bytes) from a bank, at a given address. Take notice not to exceed the
' boundaries of the bank. A long value should not be read from the last possible byte, short or int address of the bank.
'
Local MyBank:TBank=CreateBank(16)
For Local t:Int=0 To BankSize(MyBank)-1
PokeByte Mybank,t,Rnd(255)
Print PeekByte(MyBank,t)
Next
Print
Print PeekLong(MyBank,0)
Print PeekLong(MyBank,1)
Print PeekLong(MyBank,8)
End
'
' PeekFloat
'
' PeekFloat reads a signed float value (4 bytes) from a bank, at a given address. Take notice not to exceed the
' boundaries of the bank. A float value should not be read from the last possible byte or short address of the bank.
'
Local MyBank:TBank=CreateBank(16)
For Local t:Int=0 To BankSize(MyBank)-1
PokeByte Mybank,t,Rnd(255)
Print PeekByte(MyBank,t)
Next
Print
Print PeekFloat(MyBank,0)
Print PeekFloat(MyBank,1)
Print PeekFloat(MyBank,12)
End
'
' PeekDouble
'
' PeekDouble reads a signed double value (8 bytes) from a bank, at a given address. Take notice not to exceed the
' boundaries of the bank. A double value should not be read from the last possible byte, short, int or long address of
' the bank.
'
Local MyBank:TBank=CreateBank(16)
For Local t:Int=0 To BankSize(MyBank)-1
PokeByte Mybank,t,Rnd(255)
Print PeekByte(MyBank,t)
Next
Print
Print PeekDouble(MyBank,0)
Print PeekDouble(MyBank,1)
Print PeekDouble(MyBank,8)
End
'
' SaveBank
'
' SaveBank saves the content of a bank to a file.
'
Local MyBank:TBank=CreateBank(16)
For Local t:Int=0 To BankSize(MyBank)-1
PokeByte Mybank,t,Rnd(255)
Print PeekByte(MyBank,t)
Next
SaveBank MyBank,"c:\mybank.dat"
End
'
' LoadBank
'
' Loads a file into a new bank, created by the LoadBank function
'
Local MyBank:TBank=CreateBank(16)
For Local t:Int=0 To BankSize(MyBank)-1
PokeByte Mybank,t,Rnd(255)
Print PeekByte(MyBank,t)
Next
SaveBank MyBank,"c:\mybank.dat"
Local MyNextBank:TBank=LoadBank("c:\mybank.dat")
For t=0 To BankSize(MyNextBank)-1
Print PeekByte(MyNextBank,t)
Next
End
' How to properly write several int values into a bank:
Local MyBank:TBank=CreateBank(16)
For Local t:Int=0 To 3
PokeInt MyBank,t*4,Rnd($12345678)
Next
End
' How *NOT* to properly write several int values into a bank:
Local MyBank:TBank=CreateBank(16)
For Local t:Int=0 To 3
PokeInt MyBank,t,Rnd($12345678)
Next
End
' How to properly write several different variables into a bank:
Local MyBank:TBank=CreateBank(16)
PokeByte MyBank,0,$11
PokeShort MyBank,1,$1122 ' new address = 0+1=[1]
PokeInt MyBank,3,$11223344 ' new address = [1]+2=(3)
PokeLong MyBank,7,$1122334455667788 ' new address = (3)+4=7
End
EndRem