are there any parallax machine code scrolling routines out there?

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

Re: are there any parallax machine code scrolling routines out there?

Post by PeterJ »

Thanks @777

Useful.

Can I suggest you may want to get the basics under your belt before attempting something as advanced as this?

The free book by Jonathan Caldwell on getting started with creating Spectrum games is excellent, and it only assumes that the reader knows the basics of assembly language (at least in the earlier chapters)

https://spectrumcomputing.co.uk/entry/2 ... trum_Games

Darryl Sloan has also produced an excellent PDF along with a YouTube series:

viewtopic.php?p=48652#p48652

I'm never going to be a master machine code author, but both these resources got me to a level I'm content with.
User avatar
777
Manic Miner
Posts: 512
Joined: Fri Jun 26, 2020 11:23 am
Location: sw uk

Re: are there any parallax machine code scrolling routines out there?

Post by 777 »

PeterJ wrote: Wed Apr 27, 2022 1:53 pm The free book by Jonathan Caldwell on getting started with creating Spectrum games is excellent, and it only assumes that the reader knows the basics of assembly language (at least in the earlier chapters)
yeah, ive looked at and used this book

i think i saw some of those videos too...
i started programming the spectrum when i was 8 :-

1 plot rnd*255,rnd*175
2 goto 1
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: are there any parallax machine code scrolling routines out there?

Post by PeterJ »

Great @777,

You should be able to write a simple game after reading those two titles.
User avatar
777
Manic Miner
Posts: 512
Joined: Fri Jun 26, 2020 11:23 am
Location: sw uk

Re: are there any parallax machine code scrolling routines out there?

Post by 777 »

something weird did happen when i tried to put a too high a number into the width poke, which looks like parallax, spooky...

type goto 9900

https://easyupload.io/dplksm

Image

no idea why thats happening...
i started programming the spectrum when i was 8 :-

1 plot rnd*255,rnd*175
2 goto 1
User avatar
Sokurah
Manic Miner
Posts: 286
Joined: Tue Nov 14, 2017 10:38 am
Contact:

Re: are there any parallax machine code scrolling routines out there?

Post by Sokurah »

PeterJ wrote: Wed Apr 27, 2022 1:53 pm Can I suggest you may want to get the basics under your belt before attempting something as advanced as this?
I have to agree.

If he can't figure out the problem here ...
777 wrote: Sun Apr 24, 2022 2:12 pm

Code: Select all

org 40000
call 3503
ld a,0
start
inc a
rst 16
jp start
... then it's too early to try and get a grasp on parallax scrolling :?
Website: Tardis Remakes / Mostly remakes of Arcade and ZX Spectrum games.
My games for the Spectrum: Dingo, The Speccies, The Speccies 2, Vallation & Sqij.
Twitter: Sokurah
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: are there any parallax machine code scrolling routines out there?

Post by PeterJ »

Sokurah wrote: Wed Apr 27, 2022 3:57 pm ... then it's too early to try and get a grasp on parallax scrolling :?
Absolutely @Sokurah.

Please take these as constructive and supportive comments @777. This is certainly how they are intended.

I get excited when I manage to get a single character UDG moving around the screen!

Maybe look at Boriel BASIC. You get the simplicity of BASIC with the speed of machine code. This runs on a PC but creates Spectrum files.

Also, look at the Softek FP Compiler. That's good fun and accepts most BASIC commands, and also has good documentation:

https://spectrumcomputing.co.uk/entry/8 ... l_Compiler
User avatar
Morkin
Bugaboo
Posts: 3266
Joined: Mon Nov 13, 2017 8:50 am
Location: Bristol, UK

Re: are there any parallax machine code scrolling routines out there?

Post by Morkin »

777 wrote: Wed Apr 27, 2022 2:26 pm something weird did happen when i tried to put a too high a number into the width poke, which looks like parallax, spooky...

type goto 9900

https://easyupload.io/dplksm

Image

no idea why thats happening...
Out of interest, where's that from?

I had a quick look. The BASIC program seems to have 4 POKEs that affects what the code does.

Code: Select all

9921 POKE 58679,0
9922 POKE 58680,64
9923 POKE 58681,50
9924 POKE 58682,100
The first two POKEs are the screen position to start the scroll at (picked up by HL in the assembly code).
So it's 0 + (64 * 256) = 16384 (start of screen display).

I think you might want to change this to the position at the end of the row because it's it's scrolling left (though I may have missed something). So try setting them to 31 and 64 (respectively) to put the screen address at the rightmost character of the row.

The third POKE at 9923 seems to be the number of pixel rows to scroll. So you could POKE it to 16 to scroll two full character rows.

The fourth POKE at 9924 is the column row to start at I think [Edit: Sorry, number of columns (counting from the right, as it's scrolling left)]. So if you're scrolling the whole row left, try poking it at 32.

I think that should scroll the top two character rows of the screen. If you POKE too high for the third & fourth parameters, you're possibly to get odd effects.

I reckon you'd have to refine/adapt the routine a bit for a game though (unless it was a Frogger-type game which just scrolls one line at a time). Maybe trying to get the top two character rows scrolling twice as fast as the next two would be a good practice exercise.
My Speccy site: thirdharmoniser.com
User avatar
777
Manic Miner
Posts: 512
Joined: Fri Jun 26, 2020 11:23 am
Location: sw uk

Re: are there any parallax machine code scrolling routines out there?

Post by 777 »

here

https://spectrumcomputing.co.uk/entry/8 ... upercode_3

i put a too high poke in on purpose btw... i understand what the pokes do.
Last edited by 777 on Wed Apr 27, 2022 4:43 pm, edited 1 time in total.
i started programming the spectrum when i was 8 :-

1 plot rnd*255,rnd*175
2 goto 1
User avatar
Morkin
Bugaboo
Posts: 3266
Joined: Mon Nov 13, 2017 8:50 am
Location: Bristol, UK

Re: are there any parallax machine code scrolling routines out there?

Post by Morkin »

Ah - I see...! There's actually instructions for that in the entry. I guess it's either the "Right to left scroll" or the "Box scroll" option.

The instructions tells you what to POKE - only thing is with routines like this, it doesn't really explain how the routine works, and the code within it.

One thing you could try doing is fire up ZX Spin, launch the debugger and put a breakpoint on the start address (58571). Then then when you GOTO 9900 it'll stop. You can step through the code in the debugger to try to figure out what it's doing.
My Speccy site: thirdharmoniser.com
User avatar
PeterJ
Site Admin
Posts: 6873
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: are there any parallax machine code scrolling routines out there?

Post by PeterJ »

@777,

If you are more interested in pre-built routines, take a look here:

https://spectrumcomputing.co.uk/entry/2 ... X_Spectrum

And here:

https://spectrumcomputing.co.uk/entry/2 ... r_Spectrum

Both include scrolling routines.
User avatar
Joefish
Rick Dangerous
Posts: 2058
Joined: Tue Nov 14, 2017 10:26 am

Re: are there any parallax machine code scrolling routines out there?

Post by Joefish »

Please consider having a go at this:

viewtopic.php?t=7113
User avatar
777
Manic Miner
Posts: 512
Joined: Fri Jun 26, 2020 11:23 am
Location: sw uk

Re: are there any parallax machine code scrolling routines out there?

Post by 777 »

PeterJ wrote: Wed Apr 27, 2022 4:43 pm

https://spectrumcomputing.co.uk/entry/2 ... r_Spectrum

Both include scrolling routines.
yep, that one works!!!!
i started programming the spectrum when i was 8 :-

1 plot rnd*255,rnd*175
2 goto 1
Post Reply