lbenson
Senior Member
<OFFTOPIC>My 2,000th post</OFFTOPIC>
This may have been noted before, or may have been obvious to some, but you can use peek and poke with bptr to easily move blocks of data in ram.
The following code first puts "A"-"Z" in upper ram at byte 56 (incidentally, why can't "poke" take a string?). Then the "poke 128,@bptrinc ..." command moves 26 bytes from ram 56 to ram 128. The "sertxd" then prints the values starting at ram byte 128.
Instead of "poke", "bptr = 128 : peek 56,@bptrinc ... " accomplishes the same thing--moves bytes from 56 to 128.
This may have been noted before, or may have been obvious to some, but you can use peek and poke with bptr to easily move blocks of data in ram.
The following code first puts "A"-"Z" in upper ram at byte 56 (incidentally, why can't "poke" take a string?). Then the "poke 128,@bptrinc ..." command moves 26 bytes from ram 56 to ram 128. The "sertxd" then prints the values starting at ram byte 128.
Code:
symbol scratch=b3
bptr = 56
' poke bptr, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
scratch="A"
do while scratch <= "Z" : @bptrinc = scratch : inc scratch : loop ' put A=Z in upper ram
bptr = 56
' move ram bytes 56-81 to 128-153
poke 128,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc, _
@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc, _
@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc
bptr = 128
sertxd(@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc, _
@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc, _
@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc)