CPCWiki forum

General Category => Programming => Topic started by: arnoldemu on 11:55, 08 March 10

Title: software pixel scroll mode 2
Post by: arnoldemu on 11:55, 08 March 10
When forwarding is working to new server:
http://www.cpctech.org.uk/source/pixscrl.asm

Working source for pixel-by-pixel mode 2 scroll (software). Written a few years ago:
http://cpctech.cpc-live.com/source/pixscrl.asm

Title: Re: software pixel scroll mode 2
Post by: arnoldemu on 14:56, 16 March 10
When forwarding is working to new server:
http://www.cpctech.org.uk/source/pixscrl.asm

Working source for pixel-by-pixel mode 2 scroll (software). Written a few years ago:
http://cpctech.cpc-live.com/source/pixscrl.asm
bump. this works now.
More code to follow soon as I convert it and check it. next up will be a software message scroller using LDI written in 1992 ;)
Title: Re: software pixel scroll mode 2
Post by: redbox on 15:45, 16 March 10
bump. this works now.

Nice scroll and assembled fine for me.

Will have to do some border colour changing to see how fast it is  :D
Title: Re: software pixel scroll mode 2
Post by: TFM on 00:10, 17 March 10
Expected to see pixel scrolling, hmm it's byte scrolling :-(
Title: Re: software pixel scroll mode 2
Post by: arnoldemu on 11:33, 17 March 10
Expected to see pixel scrolling, hmm it's byte scrolling :-(
?
It uses RL to shift the bits.
So it is pixel scrolling...
Title: Re: software pixel scroll mode 2
Post by: TFM on 21:10, 17 March 10
?
It uses RL to shift the bits.
So it is pixel scrolling...

Err, got it, took a look at the wrong code before... Sorry!
Title: Re: software pixel scroll mode 2
Post by: nocash on 15:09, 20 March 10
> rl (hl)
> dec hl
> rl (hl)
> dec hl
> rl (hl)
> dec hl

Why are you using DEC HL instead of DEC L? The scanlines are all aligned to 16-byte boundaries, so you'd need to do the slow DEC HL only on each 16th byte.
Title: Re: software pixel scroll mode 2
Post by: arnoldemu on 12:08, 22 March 10
> rl (hl)
> dec hl
> rl (hl)
> dec hl
> rl (hl)
> dec hl

Why are you using DEC HL instead of DEC L? The scanlines are all aligned to 16-byte boundaries, so you'd need to do the slow DEC HL only on each 16th byte.

The code did originally use DEC L ;) , but then I thought somebody may want to change the position or size of the scroll (e.g. they were learning to code on the cpc) so I changed it so it would still work.

So the scroll will work, but of course it's not optimal.

I have more code I plan to publish, some old stuff and some of it is not really optimal but is an example of how to do various effects and things.. I hope it will help others, or encourage others to program for cpc.

Lined up:
- software scroll using LDI
- transparent scroll
- hardware scrolling in all directions (message scroller)
- hardware scrolling a game map in 4 directions
- hardware scrolling using reg 3 and reg 5

Bits and pieces that are interesting.

Please feel free to hack it and improve it :)