Function SUBSTR: set pointer (@) to defined position and read following n bytes
Herdy
Posts: 6
I am trying to find an intelligent solution of reading out a defined string list stored in BYTEs, separated by the zero-bit. I tried to do this with the following code. I may be confusing pointers or reading single bytes. However this did not work. Maybe you have a hint to this.
[b]DAT[/b] mnu byte "Menu 1",0,"Menu 2",0,"Menu 3",0,"Menu 4" [b]PUB[/b] main lcd.cls lcd.output([b]substr(@mnu,1)[/b],0,3,16) ' output substring onto LCD [b]PRI[/b] [b]substr[/b](strAddr,ndx) repeat ndx ' loops ndx times repeat strAddr.byte <> $00 ' loops as long byte is not <> $00 strAddr++ ' increments pointer by 1 result := strAddr.byte ' return result
Comments