Code archives/Miscellaneous/PokeString, PeekString to banks

This code has been declared by its author to be Public Domain code.

Download source code

PokeString, PeekString to banks by AngelEyes2002
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.
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.

Code Archives Forum