Screen1 corrupted?

بواسطة Mork

Resident (49)

صورة Mork

12-02-2023, 15:24

Using this program :
10 screen1: width(30)
20 locate 0,22: print"A"
30 locate 29,22: print"B"
40 locate 0,23: print"C";
50 goto 50
a blank line is inserted before "C" is printed.
If I use:
30 locate 29,22: print"B";
it's ok. But that's not necessary if I locate and print at lines 21 and 22.
So what's wrong?

Login أوregister لوضع تعليقاتك

بواسطة thegeps

Paragon (1194)

صورة thegeps

13-02-2023, 23:28

Yep, it's necessary.
The ";" keep the cursor on the current line when printing.
You have set 30 characters long rows, so (29,22) is the last printable position: range are 0-29 and 0-22. You can use 23 rows on basic: 24th one is used to show function keys. Even after a keyoff you need to set the related system variable to be able to print at x,23 row. But you can vpoke on those vram locations.
So, without ";" the screen is scrolled up and printing on 0,23 (so out of screen) you'll write again on last row and scroll up the screen (so it seems to print "C" at intended position, wich is anyway wrong)

بواسطة Mork

Resident (49)

صورة Mork

14-02-2023, 11:17

Ah thank you, I forgot about the function keys and thought vpoke were only be needed for position 29,23.

بواسطة Vampier

Prophet (2413)

صورة Vampier

14-02-2023, 17:24

use keyoff and vdp(10)=148 then do a screen 0 before
and be amazed! Wink

بواسطة Wlcracks

Hero (566)

صورة Wlcracks

15-02-2023, 15:53

...on msx2 and up that is

بواسطة DamnedAngel

Champion (266)

صورة DamnedAngel

16-02-2023, 01:01

If you need to set the last position on the screen without scroll, use vpoke instead of print.

بواسطة Pencioner

Scribe (1566)

صورة Pencioner

16-02-2023, 02:13

DamnedAngel wrote:

If you need to set the last position on the screen without scroll, use vpoke instead of print.

... or use poke on F3B1

10 SCREEN 1: L=PEEK(&HF3B1): POKE &HF3B1, L+1:REM pretend having extra line
20 LOCATE 29,22: print"B";:POKE &HF3B1, L:REM restore lines count
100 GOTO 100