CPCWiki forum

General Category => Programming => Topic started by: Microprofessor on 22:36, 03 June 12

Title: Simple(?) horizontal pixel scrolling with CRTC
Post by: Microprofessor on 22:36, 03 June 12
Hi,

I would like to ask for some help/assistance with a little programming question: I want to use the CRTC hardware scrolling in mode 2 for scrolling horizontally a complete (or maybe 50 lines of a) screen with some (BASIC drawn) graphics on it 255 pixels to the left.

The problem is: I am only a starter in programming Z80 assembly and don't know the technical specs of the CPC and its CRTC good enough to solve this problem within the next days. (I have got a little presentation in which I want to show the visible difference between "pure" Z80 assembly shifting Bits on the screen and the much softer scrolling with the CRTC).

So, can anybody give me a working assembly script?

Thaks!
µP
P.S. I promise I will learn to write this kind of hardware orientated programs by myself as soon as possilbe! :D
Title: Re: Simple(?) horizontal pixel scrolling with CRTC
Post by: arnoldemu on 22:54, 03 June 12
Quote from: Microprofessor on 22:36, 03 June 12
Hi,

I would like to ask for some help/assistance with a little programming question: I want to use the CRTC hardware scrolling in mode 2 for scrolling horizontally a complete (or maybe 50 lines of a) screen with some (BASIC drawn) graphics on it 255 pixels to the left.

The problem is: I am only a starter in programming Z80 assembly and don't know the technical specs of the CPC and its CRTC good enough to solve this problem within the next days. (I have got a little presentation in which I want to show the visible difference between "pure" Z80 assembly shifting Bits on the screen and the much softer scrolling with the CRTC).

So, can anybody give me a working assembly script?

Thaks!
µP
P.S. I promise I will learn to write this kind of hardware orientated programs by myself as soon as possilbe! :D
You ask for something which is not easy ;)

Pixel by Pixel scrolling in horizontal is a task I will try to solve so others can learn from it. I will publish all my code soon.

On Amstrad Plus it is easy (we have extra hardware for this) (all directions shown here):
http://www.cpctech.org.uk/source/vscroll1p.asm (http://www.cpctech.org.uk/source/vscroll1p.asm)

On CPC it is much harder.
Normal CPC scroll is 16 pixels (in mode 2) horizontal rate. Vertical it is 8 lines.

This code shows this:
http://www.cpctech.org.uk/source/vscroll1.asm (http://www.cpctech.org.uk/source/vscroll1.asm)

Now it becomes more complex.

For only horizontal (use R3 trick to scroll 8 pixels horizontal rate in mode 2):
http://www.cpctech.org.uk/source/scrlhrz.asm (http://www.cpctech.org.uk/source/scrlhrz.asm)

To move at 8 pixels (in mode 2) horizontal rate and  1 pixel at a time vertical rate:
More complex now to include vertical:
http://www.cpctech.org.uk/source/mess2.asm (http://www.cpctech.org.uk/source/mess2.asm)
This example needs a cpc monitor to work 100%.

The other way needs 8 screens, each is moved by 1 pixel and you cycle through these and use vscroll1.asm example too.
Title: Re: Simple(?) horizontal pixel scrolling with CRTC
Post by: Microprofessor on 06:07, 04 June 12
Hi,

thanks! The theory about 1 pixel scrolling I learned a few days ago and also found these codes. But how do I do this thing with the 8 screens? Is there a code for this anywhere, too?

µP
Title: Re: Simple(?) horizontal pixel scrolling with CRTC
Post by: arnoldemu on 11:35, 05 June 12
Quote from: Microprofessor on 06:07, 04 June 12
Hi,

thanks! The theory about 1 pixel scrolling I learned a few days ago and also found these codes. But how do I do this thing with the 8 screens? Is there a code for this anywhere, too?

µP
no code yet, I did not write it.
I will write it, but not in time for you. sorry.
Powered by SMFPacks Menu Editor Mod