; ResizeBank Example ; ------------------ ; One player save record needs 11 bytes: ; flags (byte=1) + hp (short=2) + score (int=4) + x_pos (float=4) save=CreateBank(11) ; Pack the record PokeByte save,0,5 PokeShort save,1,250 PokeInt save,3,1234567 PokeFloat save,7,17.25 Print "Before: BankSize = "+BankSize(save)+" bytes" Print " hp = "+PeekShort(save,1)+" score = "+PeekInt(save,3) ; ResizeBank grows (or shrinks) the bank - existing data is kept ResizeBank save,22 Print "" Print "After ResizeBank save,22:" Print " BankSize = "+BankSize(save)+" bytes" Print " hp = "+PeekShort(save,1)+" score = "+PeekInt(save,3)+" (data survived)" ; The new space is ready for a second record at offset 11 PokeShort save,12,180 Print "" Print "Second record's hp stored at offset 12 = "+PeekShort(save,12) FreeBank save Print "" Print "Press any key to close the example" WaitKey End