So, I am trying to utilize the kernel print routines, and was reading through mapping the c128 and came across $EB and $EC and they seem like a very good place to just put your x and y and print... so I wrote this little test program:
10 poke 235,4:poke236,10:print"hello"
and ran it... and got a very unexpected result... the value I placed in 236 was used immediately upon print, but the value in 235 did not take effect until the second character printed... So I would up with something like below:
So, obviously the print routines don't read $eb value before output, but do read $ec.. so I guess my question is where is the right place to put the y value so that it is picked up immediately? I see there is a kernel plot routine at $cc6a but figured if I could just poke the x and y properly save myself the overhead of the call, since I assume the output routines probably do that themselves anyway.
These are internal variables intended to be updated "behind the scenes" by the OS (Editor ROM). If you try to update them directly, expect strange results (like you reported).
The most compatible way to change cursor position before printing is to first call "Plot" ($FFF0).
Another alternative is to set (POKE) the column into $EC and, *the important part*, set the line into $EB and call $C15C. The routine at $c15c sets up screen pointers and line links based on the line# stored in $EB. After, you can call 'print' ($ffd2) like normal.
*FYI* today FREE-FORUMSs gave a totally different rendering of a 'code block' compare to the past... check out my other posts... they look good, but this one looks crappy! Don't blame me... some idiot has been forking the rendering code!! Did I mention !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (Stupid x60)
Last Edit: Jan 31, 2015 9:52:50 GMT by hydrophilic: stupid forum
Nope, no dice, the routines do NOT perform as advertised... according to the Mapping the Commodore 128, the call to c01b should move the cursor to the position pointed to by Eb/Ec (row/column)
But they just dont work as advertised, the column seems to take effect correctly, but the row does not take effect until after 1 character is printed... here is the code, does not perform as advertised in 40 or 80 columns
this should, if it behaves as described move the cursor down two rows and then print out 2 @, instead it prints 1 @ on the current line, even though the PLOT call shoudl have moved it, and the next one 2 rows down.
Not sure why there seems to be so much confusion... so here below is a simple BASIC program to demonstrate....
10 input"x (column)";x 20 input"y (row)";y 30 input"string";s$ 40 print chr$(147); :rem clear screen 50 sys 65520,,y,x :rem plot 60 print s$; The only weird thing about "PLOT" (decimal 65520 = hexadecimal $fff0) is that the row (Y) comes first and the column (X) is second [if you are an ML programmer, this means X register has row(Y) and Y register has column(X)]
If you doubt my published code above, then download PRG file [ anywhere (123 B) ] and try for yourself...