I've been working on a few BASIC things, and have worked out a neat way to PRINT into the bottom last two lines of the screen (using stream #1)
Given I wanted to PRINT AT X,Y - where X = 0-23 and Y = 0-31 - I've been using ...
PRINT #(1+(x<22));AT (x-(22*(x>21))),y;"*"
.. meaning I don't need any conditionals, and I can just pretend the screen is a seamless 24x32 (rather than a 22x32 main screen and a 2x32 input window).
Explanation:
If x<22 it prints in #2 (the main screen) at co-ordinates as normal, but if X is 22 or 23 is prints AT rows 0 or 1 (respectively) of channel 1, the input stream (a.k.a. last two lines).
(Apologies if I'm teaching people to suck eggs.)
[BASIC] PRINT AT (including the last two lines)
[BASIC] PRINT AT (including the last two lines)
CLEAR 23855
Re: [BASIC] PRINT AT (including the last two lines)
Not me. It looks useful.
It would be even more useful if it didn't 'time out' at x=45, then it could be a very compact scroller.
- flatduckrecords
- Manic Miner
- Posts: 785
- Joined: Thu May 07, 2020 11:47 am
- Location: Oban, Scotland
- Contact:
Re: [BASIC] PRINT AT (including the last two lines)
Thanks [mention]uglifruit[/mention], I agree that looks useful. Works nicely as a pair of functions as well:
(I find it less confusing to use PRINT y, x though, especially if I'm using PLOT and DRAW as well!)
[edit] s() for stream instead of c() for channel!
Code: Select all
10 FOR y=0 TO 23
20 FOR x=0 TO 31
30 PRINT #FN s(); AT FN y(),x; "*"
40 NEXT x
50 NEXT y
100 DEF FN s()=(1+(y<22))
110 DEF FN y()=(y-(22*(y>21)))
[edit] s() for stream instead of c() for channel!