Screen1 corrupted?

Door Mork

Resident (49)

afbeelding van 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?

Aangemeld of registreer om reacties te plaatsen

Van thegeps

Paragon (1260)

afbeelding van 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)

Van Mork

Resident (49)

afbeelding van 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.

Van Vampier

Prophet (2415)

afbeelding van Vampier

14-02-2023, 17:24

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

Van Wlcracks

Hero (572)

afbeelding van Wlcracks

15-02-2023, 15:53

...on msx2 and up that is

Van DamnedAngel

Champion (286)

afbeelding van DamnedAngel

16-02-2023, 01:01

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

Van Pencioner

Scribe (1611)

afbeelding van 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