commanderx16 / x16-rom

Other
153 stars 43 forks source link

(x16emu r41) Printing on 20 column screen sends 3rd and 4th lines to limbo #346

Open Digital-Monk opened 1 year ago

Digital-Monk commented 1 year ago

At least, in x16emu r41...

I was playing around with printing on the various screen modes, and noticed that if you print to the right edge with a ; expecting the next text to appear at the beginning of the next line, that only works once. After the 2nd line, the 3rd and 4th don't appear anywhere.

If you're writing a screenful of text, you get lines 1 and 2, a blank line, then lines 5 and 6, a blank line, etc, etc.

I know that the Commodore screen editor maintains a line link table so that it knows which physical screen lines are tied together into one logical line. The VIC was the only machine I know of that allowed up to 4 lines, so I suspect some kind of issue related to that. BUT that doesn't exactly make sense either, because this same looping logic works fine in 80 and 40 columns. If it was the line link table, I would expect skips there as well...

Here's the text of my silly little toy program (starting from ancient rusty C64 habits):

5 w=80:h=60 6 f$=" " 7 e$=f$+f$ 10 for s=0 to 6 20 screen s 30 print w" x"h 40 for l=2 to h-1 41 l$ = "this is line" + str$(l) 42 printleft$(e$,w-len(l$))l$; 44 next 46 l$ = "centering line" + str$(l) 48 printleft$(e$,(w-len(l$))/2)l$; 50 get k$: if k$="" then 50 60 h=h/2 70 if h<w/4 then w=w/2:h=60 80 if h>w2 then h=h/2 90 if h>w2 then h=h/2 100 next 110 screen $80 115 m=320:n=240:s=40:sx=m/s:sy=n/s 120 for i=0 to s-1 130 line isx, 0, 0,n-1-isy,rnd(1)16 140 line isx,n-1, 0, isy,rnd(1)16 150 line m-1-isx, 0,m-1,n-1-isy,rnd(1)16 160 line m-1-isx,n-1,m-1, isy,rnd(1)16 165 if i>=1 and i<=30 then locate i,i:print "everything"; 170 next 190 get k$: if k$="" then 190 200 screen 0 210 list

(I tried that inside a code tag, and it discarded all of the line breaks...)

mooinglemur commented 1 year ago

I believe I've reconstructed the original program restoring the characters that the markup had eaten.

5 W=80:H=60
6 F$=" "
7 E$=F$+F$
10 FOR S=0 TO 6
20 SCREEN S
30 PRINT W" X"H
40 FOR L=2 TO H-1
41 L$ = "THIS IS LINE" + STR$(L)
42 PRINTLEFT$(E$,W-LEN(L$))L$;
44 NEXT
46 L$ = "CENTERING LINE" + STR$(L)
48 PRINTLEFT$(E$,(W-LEN(L$))/2)L$;
50 GET K$: IF K$="" THEN 50
60 H=H/2
70 IF H<W/4 THEN W=W/2:H=60
80 IF H>W*2 THEN H=H/2
90 IF H>W*2 THEN H=H/2
100 NEXT
110 SCREEN $80
115 M=320:N=240:S=40:SX=M/S:SY=N/S
120 FOR I=0 TO S-1
130 LINE I*SX, 0, 0,N-1-I*SY,RND(1)*16
140 LINE I*SX,N-1, 0, I*SY,RND(1)*16
150 LINE M-1-I*SX, 0,M-1,N-1-I*SY,RND(1)*16
160 LINE M-1-I*SX,N-1,M-1, I*SY,RND(1)*16
165 IF I>=1 AND I<=30 THEN LOCATE I,I:PRINT "EVERYTHING";
170 NEXT
190 GET K$: IF K$="" THEN 190
200 SCREEN 0
210 LIST
mooinglemur commented 1 year ago

image image image image image image image image

mooinglemur commented 1 year ago

Confirmed this is still broken in current master