title: "MoveTo" description: TRSE built-in method (from IDE help)
MoveTo
Systems: C64, MEGA65, PLUS4, C128, VIC20, NES,PET
Parameters: b,b,b
MoveTo( [byte1], [byte2], [byte3] );
- [byte1] - x position
- [byte2] - y position
- [byte3] - address high byte
Moves the screenmemory pointer to the specified x/y (parameter 1,2 ) position with
address high bit specified in parameter 3.
Formula:
screenmemory = [ param3 *$100] + x +y*40
While still fast, MoveTo can take some time to complete. If speed is needed consider using AddressTable instead.
Example
// Move to x=4, y=5 in color memory
moveto(4,5,$d8);
// zp is another pointer
zp:=screenmemory;
// Move to x=4, y=5 in bank 0 screen matrix
moveto(4,5,$04);
for i:=0 to 20 do begin
screenmemory[i] := i; // Fill screen with some random text here
zp[i] := i&3+2; // Fill color ram with some random colors
end;
See also PrepareScreen(), screenmemory and AddressTable().