[bb] PokeString, PeekString to banks by AngelEyes [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:39

Previous topic - Next topic

BlitzBot

Title : PokeString, PeekString to banks
Author : AngelEyes
Posted : 1+ years ago

Description : The string is poked in as an Integer containing the length of the string, followed by the string itself - this means it takes 4+len(string$) bytes to store.

Code :
Code (blitzbasic) Select
Function PokeString(bank,offset,s$)
PokeInt bank,offset,Len(s$)
For i = 1 To Len(s$)
PokeByte(bank,offset+i+3, Asc(Mid$(s$,i,1)))
Next
End Function

Function PeekString$(bank,offset,s$)
l = PeekInt(bank,offset)
s$ = ""
For i = 1 To l
s$ = s$ + Chr$(PeekByte(bank,offset+i+3))
Next
Return s$
End Function


Comments : none...