PokeBankString
PokeBankString BankNumber, AddressOffset, String$, Flag
 
Parameters:

    BankNumber = The Index Identifier of the bank that you wish to poke
    AddressOffset = The Address where you want to write this data to within the bank
    String$ = The string you wish to store in this memory bank at the above address offset
    Flag = Null terminated
Returns: NONE
 

     PokeBankString allows you to poke (store) a string of characters into a memory bank.


Flag States:

      False (0) = No null character is poked after the string.
      True (1) = The String is stored with an extra null termination character of ZERO.




FACTS:


     * Each character is stored in ASCII format and is a BYTE in size. So you can read/write the characters manually by using the PeekBankByte and PokeBankByte commands.

     * When a string is null terminated an extra zero byte is written into memory at the end.




Mini Tutorial:


      This simple example creates a bank, stores the string "Hello World" in it, then reads this back again.

  
; Create Memory Bank #1 and make it 1000 bytes in size
  CreateBank 1,1000
  
; ================================================
; Store some Strings in a memory bank.
; ================================================
  
; Poke a NUll terminated string into this memory bank, starting at
; address 500
  PokeBankString 1500"Hello World",true
  
; Read And Display the previously poke null terminted string again.
  Print "Your String:"+PeekBankString(1,500,0)
  
; You can also read a user determinated number of characters
  Print "Reading 5 Character String:"+PeekBankString(1,500,5)
  
  
; Since strings are stored in memory as a series of byte
; You can also use PeekBankByte to Read the characters manually
  
; Set a Variable Called Address to the 500
  Address=500
  
; Start a while loop, the loop will continue it until reeach an ZERO byte
; in the memory bank.
  While PeekBankByte(1,Address)
   ; Display the Character at this address
     Print Chr$(PeekBankByte(1,address))
   ; Bump the address value to the next character
     Inc address
   ; continue the loop
  EndWhile
  
  
; Display the Screen And Wait For the user To press a key
  Sync
  WaitKey
  
  
  



This example would output.

  
  Your String:Hello World
  Reading 5 Character String:Hello
  H
  e
  l
  l
  o
  
  W
  o
  r
  l
  d
  

 
Related Info: CreateBank | Dim | NewBank | PeekBankByte | PeekBankFloat | PeekBankInt | PeekBankString | PeekBankWord | Pointer | PokeBankByte | PokeBankFloat | PokeBankInt | PokeBankWord :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com