PeekBankString
String$ = PeekBankString(BankNumber, AddressOffset, Size)
 
Parameters:

    BankNumber = The Index Identifier of the bank that you wish to peek
    AddressOffset = The Address where you want to write this data to within the bank
    Size = Number of characters to read make this strnig from
Returns:

    String$ = The string your peeked from this bank
 

     PeekBankString allows you to peek (read) a string of characters from a memory bank.



FACTS:


     * Setting the SIZE to zero makes the PeekBankString read a null terminated string.

      * 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 | NewBank | PeekBankByte | PeekBankFloat | PeekBankInt | PeekBankWord | PokeBankByte | PokeBankFloat | PokeBankInt | PokeBankString | PokeBankWord :
 


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