How can I scroll up or down from Basic?

One direction is easy, of course: locate 1,25:print. But how can I scroll up or even sideways (is the latter even possible?) — without using Poke and ideally without a Call?

My demo is already pretty far along, currently featuring 8 effects in “pure BASIC” :slight_smile:

You can use control code 11 to move the cursor up. if that happens at a window boundary, the window content will (soft)scroll. If you have not specified any window, it will scroll the whole screen if your cursor is located in the first line of the screen.

sideways soft-scrolling (afaik) won’t work in BASIC but you could use hardware-scrolling using the CRTC registers with OUT commands.

1 Like

Out commands to the CRTC registers are generally the way it’s done. I don’t see why that wouldn’t count as “pure basic”.

1 Like

It’s just a “quirk” of mine :wink:
Or how about Peek and Poke?
That’s actually still BASIC too — and that’s how Sprites etc. are explained on the C64 as well.
But that’s precisely my point — showing what’s possible without “purely internal” routines — i.e., the things that developers make directly accessible via commands.

OUT is really a middle ground there — since it’s a means of communication.
CALL is a direct invocation of an internal routine. Unfortunately, so far, I can’t quite get around it…

On the C64 you can poke into registers. On the CPC a poke will only change data in RAM but will not change any registers. You will use OUT for that.

Sure, it’s still a BASIC command but using OUT you are messing with the hardware directly and have to understand what’s going on as BASIC won’t compensate for your actions. E.g. the screen position will change and a LOCATE 1,1 will have a different position on screen after you scroll via OUT. That’s what I meant.

The thing with chr 11 works great! You can really do a lot with that. :slight_smile:

and a last quick hint: you can press CONTROL+K on the keyboard to enter the control code 11 into a String. Instead of print chr$(11) you then have print “↑” in your code, which is a bit faster than chr$.

1 Like

That will probably make it into the final version. I’m coding on the PC in a text editor - so that makes it a bit harder.
But what I’ve got so far looks interesting :slight_smile: