| Posted By
 Fuzzweed on 2025-06-22 14:21:54
| How to set print position for $FF4F print immediate
Where do I set the screen location for print immediate (effectively make it PRINT AT)? I though it would be as simple as set cursor position in $FF0C/D, but it seems to ignore these values.
It seems this is the same with jsr $FFD2 print character. The cursor position is not the same thing as next print position, but I guess the next print location must be stored somewhere.
I think I found it in the ZP: For future reference to make print immediate work 'at' somewhere you need to set start position in $C8/9 and set matching line and column position
Line number is $CD Column number is $CA
|
|
Posted By
 SVS on 2025-06-22 12:56:02
 | Re: How to set print position for $FF4F print immediate
$FFF0 is the Kernal jump for Plot subroutine.
|
|
Posted By
 Harry Potter on 2025-06-22 14:24:53
| Re: How to set print position for $FF4F print immediate
In my experience, setting X directly usually does what it's supposed to do but not Y. I believe the CBM kernal needs to do extra work to define the pointers to the row. Therefore, you can't set the pos.'s directly. Also, the hardware location is ignored by the kernal, as the kernal uses its own variables to determine the current coordinates. Is this helpful?
|
|
Posted By
 bszggg on 2025-06-22 14:47:59
| Re: How to set print position for $FF4F print immediate
Nem vagyok benne biztos, hogy ez a kérdés, de ha kurzort szeretnél poziciónálni, akkor valami ilyesmi a tudásbázis:
-arról van szó, hogy van egyszer az, hogy hol jelenítse meg a ted a kurzort -aztán van az, hogy melyik sor, és melyik oszlop -aztán van az, hogy melyik olyan sor, ami teljes sor.. tehát ha folytatósor, akkor más lesz az érték attól függően hogy folytatósor-e az adott sor -és van a folytatósor táblázat, ami meg tárolja, hogy az adott sor az folytatósor-e
Egészen pontosan nem emlékszem a címekre, de anno heteket töltöttem el azzal, hogy odébb tegyem a kurzort, mikor az egér drivert írtam.
valami olyasm, hogy a ted-ben jelezni volt a legegyszerűbb, aztán minden x és minden y-ba beírod azt amit kiszámoltál, mint sor, és oszlop. és utána kell kikeresni, hogy az adott sor az folytatósor-e, és ha igen, akkor az egyik x-hez hozzáadni 40-et.
hogy ezek közül melyik cím a print position, nem tudom.
1 | Re: How to set print position for $FF4F print immediate
I'm not sure if this is the question, but if you're trying to position the cursor, then the knowledge base is something like this:
it's about where the ted should display the cursor
then there's the matter of which row and which column
then there's whether the row is a full row or not... so if it's a continuation line, the value will differ depending on whether the line is a continuation
and there's a continuation-line table, which stores whether a given row is a continuation line
I don't remember the exact addresses anymore, but back when I was writing the mouse driver, I spent weeks just figuring out how to move the cursor.
It was something like—it was easiest to signal in ted, then you write the calculated row and column into every x and y. And then you have to check whether the given line is a continuation line, and if it is, you add 40 to one of the x-values.
As for which of these addresses is the print position, I don’t know.
|
|
Posted By
 Fuzzweed on 2025-06-22 14:50:31
| Re: How to set print position for $FF4F print immediate
It's interesting to confirm that the hardware cursor does indeed seem to be a separate thing to the print routine. Through trial and error I have got line printing working (for this example I am always starting in column 0 so no maths needed). It seems the print routine takes a start address from C8/9, but prints subsequent letters using row and column pointers. So long as they all match at the start it seems to work.
lda #>$0C00+line_no*40 sta scr_add_h ;$C9 lda #<$0C00+line_no*40 sta scr_add_l ;$C8 lda #0 sta column ;$CA lda #line_no sta line ;$CD jsr $FF4F ;print immediate !pet "this is line x", $00
|
|
Posted By
 Harry Potter on 2025-06-22 15:52:09
| Re: How to set print position for $FF4F print immediate
Fuzzweed: Why not just jsr $FFF0 with the X coordinate in the .Y register and the Y coordinate in the .X register? I don't remember whether the carry flag is set for returning the coordinates or changing the coordinates, though.
|
|
Posted By
 Fuzzweed on 2025-06-22 16:02:42
| Re: How to set print position for $FF4F print immediate
Aha! Because I didn't understand what SVS meant by plot routine. Yes $FFF0 is the correct solution - I guess it is just doing the same maths as I was attempting and setting the pointers and screen addresses. thank you for pointing that out, works as expected.
|
|
Posted By
 Harry Potter on 2025-06-22 16:06:58
| Re: How to set print position for $FF4F print immediate
I'm glad I was able to help. One last thing about $FFF0: the routine has to take into account the logical lengths of lines, as, on CBM computers, a line's contents may spill over to the next line.
|
|
Posted By
 Crown on 2025-06-22 16:25:58
| Re: How to set print position for $FF4F print immediate
You know you can always use the control codes in your strings, to position text, that will take guesswork out of the equation.
|
|
Posted By
 Fuzzweed on 2025-06-22 16:47:15
| Re: How to set print position for $FF4F print immediate
@harry OK, there is one problem so far with $FFF0, while it works as expected with $FF4F print immediate, it seems it doesn't mix well with $FFD2 chr print. This seems to introduce an offset, so the next $FFF0 Y=0 value starts at the character position used by $FFD2, not left hand column. I guess this is something again to do with the kernal using screen address and column / line pointers together in it's routines.
But anyway I think I have all the correct information now, just a matter of bashing it into shape.
@crown, yes I'm trying to avoid control codes. I need to convert variables to text positions, and I feel it would just be more elegant to do this directly rather then various loops up,up,up,right,right etc
Turns out combination effort is best. Issuing a $13 [home] after $FFD2 char print 'resets' the pointers and then $FFF0 operates correctly again for the next loop.
1 |
|
Posted By
 SVS on 2025-06-23 07:51:33
 | Re: How to set print position for $FF4F print immediate
@Fuzzweed: more about $FFF0 routine calling: if CY=1 the routine just reads the current coordinates. CY=0 sets cursor at .X, .Y values.
|
|
Posted By
 Fuzzweed on 2025-06-23 09:45:55
| Re: How to set print position for $FF4F print immediate
When you say read coordinates, is this the screen address held in $C8 and $C9?
|
|
Posted By
 Harry Potter on 2025-06-23 10:29:45
| Re: How to set print position for $FF4F print immediate
No. It's the X and Y coordinates of the current location on the screen. BTW, I once looked at the code for the PLOT routine--I think it was for the C64 version--and found that, when setting the coordinates, it will also read the coordinates.
|
|
| |
Copyright © Plus/4 World Team, 2001-2025. Support Plus/4 World on Patreon |