Screen1 corrupted?

By Mork

Resident (49)

Mork's picture

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 or register to post comments

By thegeps

Paragon (1252)

thegeps's picture

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)

By Mork

Resident (49)

Mork's picture

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.

By Vampier

Prophet (2415)

Vampier's picture

14-02-2023, 17:24

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

By Wlcracks

Hero (572)

Wlcracks's picture

15-02-2023, 15:53

...on msx2 and up that is

By DamnedAngel

Champion (286)

DamnedAngel's picture

16-02-2023, 01:01

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

By Pencioner

Scribe (1610)

Pencioner's picture

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