News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Axelay

A Pixel Scroll with Register 3

Started by Axelay, 12:14, 14 June 09

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Axelay

Some weeks ago I was able to transfer some CPC disks with stuff from 20 years ago to PC, and amongst other things there were some graphics my brother had drawn for a scrolling shooter we had decided we were going to make using the register 3 scrolling technique.  Of course, at the time, my coding for it got as far as the R3 byte scroll with a star field and status line!

Anyway, having got hold of the graphics again, I thought it would be fun to use them to experiment with a R3 pixel scroll, so I've hacked something together from code I already had.  I should stress it isn't necessarily the beginning of a new project though.

The only problem is that 'varied result' you get with R3 on different systems, on my 6128 there is a noticeable left/right 'shudder'.  Though perhaps tolerable, I wonder how it might look on other systems, so I've attached a disk image with the 'prototype' here, and would ask if anyone who happens to try it on a real CPC could let me know how it looks?

I gather there's nothing you can do through the timing of the R3 change or anything to improve it?

Gryzor

Hello mate,

How about a screenie? :)

Ygdrazil

Any source code?

/Ygdrazil

Quote from: Axelay on 12:14, 14 June 09
Some weeks ago I was able to transfer some CPC disks with stuff from 20 years ago to PC, and amongst other things there were some graphics my brother had drawn for a scrolling shooter we had decided we were going to make using the register 3 scrolling technique.  Of course, at the time, my coding for it got as far as the R3 byte scroll with a star field and status line!

Anyway, having got hold of the graphics again, I thought it would be fun to use them to experiment with a R3 pixel scroll, so I've hacked something together from code I already had.  I should stress it isn't necessarily the beginning of a new project though.

The only problem is that 'varied result' you get with R3 on different systems, on my 6128 there is a noticeable left/right 'shudder'.  Though perhaps tolerable, I wonder how it might look on other systems, so I've attached a disk image with the 'prototype' here, and would ask if anyone who happens to try it on a real CPC could let me know how it looks?

I gather there's nothing you can do through the timing of the R3 change or anything to improve it?

ukmarkh

Quote from: Axelay on 12:14, 14 June 09
Some weeks ago I was able to transfer some CPC disks with stuff from 20 years ago to PC, and amongst other things there were some graphics my brother had drawn for a scrolling shooter we had decided we were going to make using the register 3 scrolling technique.  Of course, at the time, my coding for it got as far as the R3 byte scroll with a star field and status line!

Anyway, having got hold of the graphics again, I thought it would be fun to use them to experiment with a R3 pixel scroll, so I've hacked something together from code I already had.  I should stress it isn't necessarily the beginning of a new project though.

The only problem is that 'varied result' you get with R3 on different systems, on my 6128 there is a noticeable left/right 'shudder'.  Though perhaps tolerable, I wonder how it might look on other systems, so I've attached a disk image with the 'prototype' here, and would ask if anyone who happens to try it on a real CPC could let me know how it looks?

I gather there's nothing you can do through the timing of the R3 change or anything to improve it?

Runs smooth on my CPC 6128 mate... in fact, I love it! Shame you won't be going any further with this one, especially considering the time and effort put in thus far. Thank's for sharing this with us.

Ygdrazil

Have i missed a download link somewhere??????? :o

/Ygdrazil

Quote from: ukmarkh on 20:05, 14 June 09
Runs smooth on my CPC 6128 mate... in fact, I love it! Shame you won't be going any further with this one, especially considering the time and effort put in thus far. Thank's for sharing this with us.

Devilmarkus

Quote from: Ygdrazil on 23:12, 14 June 09
Have i missed a download link somewhere? ??? ??? :o

/Ygdrazil
* Cataclysm.zip                                (8.9 KB - downloaded 5 times.)  8)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Ygdrazil

Link somehow does not work??!??

/Ygdrazil

Quote from: CPC-Live on 23:38, 14 June 09
* Cataclysm.zip                                (8.9 KB - downloaded 5 times.)  8)

Executioner

Impressive scroll Axelay. I noticed you restricted it to about 4 screens with background then a blank one to get around the display wrap problem  :)

Do you re-draw the whole score/status display every time?

Ygdrazil

Ups got it  ;D

Works now, and its pretty amazing... Very cool..

Shame it ends here!

/Ygdrazil

Quote from: Ygdrazil on 00:42, 15 June 09
Link somehow does not work??!??

/Ygdrazil

arnoldemu

shudder: I think you may need different reg 3 values depending on the type of crtc in the cpc.
One day I will check to find the best values.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Axelay

Quote from: ukmarkh on 20:05, 14 June 09
Runs smooth on my CPC 6128 mate... in fact, I love it! Shame you won't be going any further with this one, especially considering the time and effort put in thus far. Thank's for sharing this with us.
Thanks for checking it.  The time I put into it was only a few weekends though, with most of the code modified from elsewhere.  I suspect my brother spent more on the graphics 20 years ago!

Quote from: Gryzor on 12:45, 14 June 09
Hello mate,

How about a screenie? :)

I could post one if you like, but with the disk image there I'm not sure why?

Quote from: Ygdrazil on 14:02, 14 June 09
Any source code?

/Ygdrazil


I could do a cut down version with just the scroll code if you like, as it's a fair bit of source as it is, and that leaves me less to (re)comment.  I cant promise brilliant commenting though.

Quote from: Executioner on 07:09, 15 June 09
Impressive scroll Axelay. I noticed you restricted it to about 4 screens with background then a blank one to get around the display wrap problem  :) 

Do you re-draw the whole score/status display every time?
 

Thanks.  I think if you can get away with a design that lets you work around the limitations/problems, why not?  :)

The display line is very quick & dirty, slow code, about 70-ish scan lines as I'm just printing a character list out.  Ideally if it were to be developed into a game, I'd go with a buffer that I have the current display line in, update a couple of characters in that each frame, and then copy that buffer with a few ldi lists and that should be more like 20-25 scan lines.  IIRC that example you posted a while back got around doing that at all with a split, but lately I've been experimenting with having interrupts disabled so I can use the stack pointer for as much list processing as possible, and I suspect trying to maintain a split in a game engine without interrupts would be most difficult.

Quote from: arnoldemu on 11:43, 15 June 09
shudder: I think you may need different reg 3 values depending on the type of crtc in the cpc.
One day I will check to find the best values.

I've tried a fair few different combinations on my 6128 (well, 4).  One pair I made up, one from your example, and I still had the values from executioners example from a while back, but none seem better than another.  I'm currently using the pair I got from winape while playing Super Cauldron, because on my 6128 that does have a perfectly static display area.  It didnt stop shifting left and right when I used those either, so it must be avoiding the issue some other way.  Or perhaps detecting what values to use in a way that isnt working the same in winape.

Executioner

Quote from: Axelay on 19:07, 15 June 09
I'm currently using the pair I got from winape while playing Super Cauldron, because on my 6128 that does have a perfectly static display area.  It didnt stop shifting left and right when I used those either, so it must be avoiding the issue some other way.  Or perhaps detecting what values to use in a way that isnt working the same in winape.

Register 3 also controls the VSYNC width. I'd would think the safest values to use would be #86 and #85 since they don't depend on the VGA sync width trimming and leave the vertical value as it is standard. These values should cause only 1 character difference in the horizontal sync width, which in turn should shift the screen 1/2 a character (one byte). The values you're using (#05 and #0C) modify the vertical sync, and also may not be exactly 1/2 a character shift on some CRTCs.

Executioner

I assume you're also aware that this doesn't work properly with an MP modulator, apparently.

ukmarkh

Quote from: Executioner on 06:13, 16 June 09
I assume you're also aware that this doesn't work properly with an MP modulator, apparently.

I think there were two versions of the MP3 modulator? MP1 and MP2.

Ygdrazil

Hi Axelay

A commented source listing of the scroll!  :o That would be excellent, this might come in handy. Full credit will be given of course!

Tell me if you need any help ...

/Ygdrazil

Quote from: Axelay on 19:07, 15 June 09

I could do a cut down version with just the scroll code if you like, as it's a fair bit of source as it is, and that leaves me less to (re)comment.  I cant promise brilliant commenting though.


Axelay

Quote from: Executioner on 06:12, 16 June 09
Register 3 also controls the VSYNC width. I'd would think the safest values to use would be #86 and #85 since they don't depend on the VGA sync width trimming and leave the vertical value as it is standard. These values should cause only 1 character difference in the horizontal sync width, which in turn should shift the screen 1/2 a character (one byte). The values you're using (#05 and #0C) modify the vertical sync, and also may not be exactly 1/2 a character shift on some CRTCs.
I'll change it back to those values, but like I alluded to before, I didn't get any better results from &85/&86 on my CPC than anything else so I just started looking for what other values were being used in whatever games game to mind, and what the values *should* be kinda slipped my mind at that point!

Quote from: Executioner on 06:13, 16 June 09
I assume you're also aware that this doesn't work properly with an MP modulator, apparently.

Yeah, I've read that.  I guess I am a bit concerned about spending the kind of time a game requires on a project, only to find it runs on just a few systems.  The only real alternative I can think of for a pixel scroll though would be using 128k and 4 screens, but that would be a lot less desirable as an option because you lose so much of the advantage all that memory would be expected to bring.

Quote from: Ygdrazil on 10:59, 16 June 09
Hi Axelay

A commented source listing of the scroll!  :o That would be excellent, this might come in handy. Full credit will be given of course!

Tell me if you need any help ...

/Ygdrazil


OK, I'll be changing a couple things first though, but hopefully in a few days I'll have something I can put up.  Or a bit longer if I go overboard!

Grim

The HSync duration defined with the CRTC Register 3 (R3) is trimmed by the VGA to produce the composite sync signal used by the monitor (ie. the HSync and VSync signals produced by the CRTC are merged into one sync signal, the one on pin 4 of the DIN6 connector).

The VGA trim the HSync to 6us max (ie. when the lower 4bits of R3 >= 6). In order to shift the screen using R3, the HSync must be set alternatively to 5 and 6us (or 4 and 5us but some Amstrad monitors might not cope very well with such a small HSync, not even talking about TV set or esoteric monitors).

As Executionner pointed out, the shift produced by banging the monitor sync may not be exactly 1/2 chr, might not even be the same from one monitor to another or, eventually, not work at all. I tested cataclysm on my CPC, the scroller looks fine but the score panel at the bottom is quaky (it's moving left/right by something like 1 pixel mode 2).

Moreover, modifying the HSync duration with R3 also modify the interrupt timing (the VGA trigger the interrupt right after an HSync). It might be a problem if there's some timing critical routines synchronized with the interrupts (eg. rasters or splitscreen).

A vertical shooter with an hardware pixel scroll would be much more easy to do :)

Axelay

Quote from: Grim on 13:53, 16 June 09
As Executionner pointed out, the shift produced by banging the monitor sync may not be exactly 1/2 chr, might not even be the same from one monitor to another or, eventually, not work at all. I tested cataclysm on my CPC, the scroller looks fine but the score panel at the bottom is quaky (it's moving left/right by something like 1 pixel mode 2).
Thanks for checking it out.  That sounds much like what I'm getting on my own CPC.

Quote from: Grim on 13:53, 16 June 09
A vertical shooter with an hardware pixel scroll would be much more easy to do :)

It is looking that way!

Axelay

Here is a cut down version of the code that demonstrates just the scrolling and background printing with some example blocks (just shapes).

It's still fairly long so I've attached it as a zipped up .asm file that can be opened and run from the Winape assembler.


Leonie

Quote from: Axelay on 12:14, 14 June 09
Some weeks ago I was able to transfer some CPC disks with stuff from 20 years ago to PC, and amongst other things there were some graphics my brother had drawn for a scrolling shooter we had decided we were going to make using the register 3 scrolling technique.  Of course, at the time, my coding for it got as far as the R3 byte scroll with a star field and status line!

Anyway, having got hold of the graphics again, I thought it would be fun to use them to experiment with a R3 pixel scroll, so I've hacked something together from code I already had.  I should stress it isn't necessarily the beginning of a new project though.

The only problem is that 'varied result' you get with R3 on different systems, on my 6128 there is a noticeable left/right 'shudder'.  Though perhaps tolerable, I wonder how it might look on other systems, so I've attached a disk image with the 'prototype' here, and would ask if anyone who happens to try it on a real CPC could let me know how it looks?

I gather there's nothing you can do through the timing of the R3 change or anything to improve it?

Oh my god, this shooter-demo looks wonderful!  :o :P
It could become a great game! Why don´t you complete it?
By the way: Played via CPC95 the scrolling is as liquid as it can be. Played via WinApe I can see a unregular "shiver" or "wobble". Why is that?

Executioner

Quote from: Leonie on 13:11, 16 June 10
By the way: Played via CPC95 the scrolling is as liquid as it can be. Played via WinApe I can see a unregular "shiver" or "wobble". Why is that?

That's because CPC95 doesn't emulate the monitor sync. The only way to not get the shudder on a real CPC and WinAPE is to give the Register 3 changes more time to complete. Performing the change after all the displayed image is the best way. The problem is that the split screen used for scores etc will be shifted as well, so you need to have two copies of it.

Axelay

That's odd, I dont see any wobble when I run it in Winape myself.  Are there any settings that could be masking it?

Quote from: Leonie on 13:11, 16 June 10
Why don´t you complete it?


It's just a demo from mostly pre-existing code and graphics I had to try out a method for a hardware pixel scroll.  It doesnt represent much of a start to a new game, there would still be 99.9% more game to add!

Powered by SMFPacks Menu Editor Mod