How to change cursor position?
Moderator: Moderators
How to change cursor position?
I'm having a heck of a time finding this with google. On the C64 there are two locations I can POKE for X,Y coordinates and then execute a SYS command and it will plant the cursor in a particular place for the next print statement. I can't seem to locate the equivalent on the VIC-20. Can somebody help?
-
- Omega Star Commander
- Posts: 1371
- Joined: Thu Jan 31, 2008 2:12 pm
- Website: https://robert.hurst-ri.us
- Location: Providence, RI
- Occupation: Tech & Innovation
Not recalling if I used this myself, but in Programmer's Reference Guide of user callable kernal routines:
PLOT Read/set X,Y cursor position @ $FFF0 (65520)
I believe X = rows, Y = cols in this case, and zero based.
PLOT Read/set X,Y cursor position @ $FFF0 (65520)
I believe X = rows, Y = cols in this case, and zero based.
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
https://robert.hurst-ri.us/rob/retrocomputing
Aren't those kernal calls just the same as on the c64?
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Maybe the "poke" locations of the A X Y registers before a SYS isn't?
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
I bet it is a typo because the last time I used that on the C64, I noticed the X and Y were backwards from what was documented.Kweepa wrote:I just checked the PRG for each machine, and the memory locations are the same for each.
POKE781,X:POKE782,Y:SYS65520
The only difference is that (X,Y) is (column,row) on the VIC (sensible) and (row,column) on the C64 (stupid). Of course that could be a typo.
- Pedro Lambrini
- Vic 20 Scientist
- Posts: 1132
- Joined: Mon Dec 01, 2008 11:36 am
So, can I ask something?
If you put the above line between two print statements the program would print the first statement in the top left as normal and then the second line would print wherever X and Y are?
If you put the above line between two print statements the program would print the first statement in the top left as normal and then the second line would print wherever X and Y are?
"...That of the Eastern tribe being like a multitude of colours as if a rainbow had settled upon its brow..." Daniels 1:3
Correct. usually this is much faster than trying to have some kind of loop using cursor movements if you need a dynamic way to move things around on the screen.If you put the above line between two print statements the program would print the first statement in the top left as normal and then the second line would print wherever X and Y are?
- Pedro Lambrini
- Vic 20 Scientist
- Posts: 1132
- Joined: Mon Dec 01, 2008 11:36 am
^
Cool. Thank you.
I am incredibly bad at programming and have always put cursor key presses in my print statements as I knew of no other way. POKEing just has to run faster than that!
Cool. Thank you.
I am incredibly bad at programming and have always put cursor key presses in my print statements as I knew of no other way. POKEing just has to run faster than that!
"...That of the Eastern tribe being like a multitude of colours as if a rainbow had settled upon its brow..." Daniels 1:3
Alternatively you could use the TAB() function combined with a home made function for the y pos:
Code: Select all
10 L$="{home}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{down}"
20 PRINT LEFT$(L$,12)TAB(11)"HELLO"
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Or maybe this is smaller:
Code: Select all
10 L$="{home}":FORT=1TO22:L$=L$+"{down}":NEXT
20 PRINT LEFT$(L$,12)TAB(11)"HELLO"
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Splitted the following discussion to a new thread:
"Garbage Collect (splitted)"
http://sleepingelephant.com/ipw-web/bul ... hp?p=67886
"Garbage Collect (splitted)"
http://sleepingelephant.com/ipw-web/bul ... hp?p=67886
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Maybe I am misunderstanding the question, but here's my simple solution:
Works for me.
Code: Select all
1 PRINT SPC(22*Y) SPC(X);
Oh, so it does! I thought SPC printed a real space. So it seems TAB and SPC is the same function then.Jeff-20 wrote:Maybe I am misunderstanding the question, but here's my simple solution:Works for me.Code: Select all
1 PRINT SPC(22*Y) SPC(X);
Last edited by Boray on Thu Nov 15, 2012 12:44 pm, edited 1 time in total.
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)