Compiled BASIC games with smooth scrolling

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
PeterJ
Site Admin
Posts: 6879
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Compiled BASIC games with smooth scrolling

Post by PeterJ »

I noticed a number of posts recently about compiled BASIC games, and some of the titles feature smooth scrolling. How was this done?

I'm aware one of the HiSoft compilers included software sprites, but I think that was a one off.

Thanks
User avatar
Turtle_Quality
Manic Miner
Posts: 506
Joined: Fri Dec 07, 2018 10:19 pm

Re: Compiled BASIC games with smooth scrolling

Post by Turtle_Quality »

Compiled games can often call a machine code routine for sprites or scrolling. If your reference to "recent posts about compiled games" means the ones I was trawling through with source code, we could probably find a USR keyword in the BASIC.
Definition of loop : see loop
User avatar
Pegaz
Dynamite Dan
Posts: 1210
Joined: Mon Nov 13, 2017 1:44 pm

Re: Compiled BASIC games with smooth scrolling

Post by Pegaz »

Well, there is no better example than Loxley.
There are ROM calls, but no machine code executed in RAM.
More about development:

User avatar
Joefish
Rick Dangerous
Posts: 2059
Joined: Tue Nov 14, 2017 10:26 am

Re: Compiled BASIC games with smooth scrolling

Post by Joefish »

I don't see any scrolling in it though! (Oh, OK, a fairly jerky bit early on. Probably the worst looking bit of the whole game!).

You can scroll by whole characters fairly easily in BASIC, by re-printing everything you need in a new position. Though you need to (a) try and keep the re-draw to a single PRINTed string for speed and (b) update as little of the screen as possible, i.e. just a few rows.

For finer scrolling, you can define pre-shifted UDGs either in one or multiple banks. Then when you re-print them, things can move by a few pixels in a limited animation, then you move them a whole character and repeat.

But to do a full-screen scroll you'll want a BASIC language extension like my own CharAde, which to my great surprise can be compiled by HiSoft BASIC.
User avatar
Turtle_Quality
Manic Miner
Posts: 506
Joined: Fri Dec 07, 2018 10:19 pm

Re: Compiled BASIC games with smooth scrolling

Post by Turtle_Quality »

There was also a character scroll upwards in that video used to clear the screen, but that's quite easy to achieve in basic by printing at the bottom of screen to force a scroll, you just need to do a POKE to suppress the "scroll ?" prompt.
Definition of loop : see loop
User avatar
p13z
Manic Miner
Posts: 611
Joined: Sun Feb 17, 2019 10:41 pm
Location: UK
Contact:

Re: Compiled BASIC games with smooth scrolling

Post by p13z »

You can smooth scroll in uncompiled BASIC if you use the strengths of the PRINT command and spare character sets / UDGs.
Post Reply