Author Topic: A Pixel Scroll with Register 3  (Read 9136 times)

0 Members and 1 Guest are viewing this topic.

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 601
  • Country: au
    • Awards
A Pixel Scroll with Register 3
« on: 14: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?
like
0
No reactions

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 17.190
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #1 on: 14:45, 14 June 09 »
Hello mate,

How about a screenie? :)
like
0
No reactions

Offline Ygdrazil

  • Global Moderator
  • 6128 Plus
  • *****
  • Posts: 503
  • Country: dk
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #2 on: 16:02, 14 June 09 »
Any source code?

/Ygdrazil

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?
like
0
No reactions

Offline ukmarkh

  • 6128 Plus
  • ******
  • Posts: 1.470
  • Country: england
    • Classic Replay
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #3 on: 22:05, 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.
like
0
No reactions

Offline Ygdrazil

  • Global Moderator
  • 6128 Plus
  • *****
  • Posts: 503
  • Country: dk
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #4 on: 01:12, 15 June 09 »
Have i missed a download link somewhere??????? :o

/Ygdrazil

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.
like
0
No reactions

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #5 on: 01:38, 15 June 09 »
Have i missed a download link somewhere? ??? ??? :o

/Ygdrazil
* Cataclysm.zip                                (8.9 KB - downloaded 5 times.)  8)
like
0
No reactions
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

Offline Ygdrazil

  • Global Moderator
  • 6128 Plus
  • *****
  • Posts: 503
  • Country: dk
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #6 on: 02:42, 15 June 09 »
Link somehow does not work??!??

/Ygdrazil

* Cataclysm.zip                                (8.9 KB - downloaded 5 times.)  8)
like
0
No reactions

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 785
  • Country: au
  • WinAPE Developer
    • WinAPE
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #7 on: 09: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?
 
like
0
No reactions

Offline Ygdrazil

  • Global Moderator
  • 6128 Plus
  • *****
  • Posts: 503
  • Country: dk
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #8 on: 09:30, 15 June 09 »
Ups got it  ;D

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

Shame it ends here!

/Ygdrazil

Link somehow does not work??!??

/Ygdrazil
like
0
No reactions

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #9 on: 13: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.
like
0
No reactions
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 601
  • Country: au
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #10 on: 21:07, 15 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!

Hello mate,

How about a screenie? :)

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

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.

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.

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.
like
0
No reactions

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 785
  • Country: au
  • WinAPE Developer
    • WinAPE
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #11 on: 08:12, 16 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.
like
0
No reactions

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 785
  • Country: au
  • WinAPE Developer
    • WinAPE
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #12 on: 08:13, 16 June 09 »
I assume you're also aware that this doesn't work properly with an MP modulator, apparently.
like
0
No reactions

Offline ukmarkh

  • 6128 Plus
  • ******
  • Posts: 1.470
  • Country: england
    • Classic Replay
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #13 on: 12:03, 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.
like
0
No reactions

Offline Ygdrazil

  • Global Moderator
  • 6128 Plus
  • *****
  • Posts: 503
  • Country: dk
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #14 on: 12: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


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.

like
0
No reactions

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 601
  • Country: au
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #15 on: 13:58, 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!

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.

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!
like
0
No reactions

Offline Grim

  • CPC6128
  • ****
  • Posts: 202
  • Country: gp
  • La pak ba, bèf ka pasé
    • THERE IS NO GAME
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #16 on: 15:53, 16 June 09 »
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 :)
like
0
No reactions

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 601
  • Country: au
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #17 on: 20:01, 17 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.

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

It is looking that way!
like
0
No reactions

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 601
  • Country: au
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #18 on: 13:25, 19 June 09 »
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.

like
0
No reactions

Offline Leonie

  • CPC6128
  • ****
  • Posts: 232
  • Country: de
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #19 on: 15:11, 16 June 10 »
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?
like
0
No reactions

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 785
  • Country: au
  • WinAPE Developer
    • WinAPE
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #20 on: 06:24, 18 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.
like
0
No reactions

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 601
  • Country: au
    • Awards
Re: A Pixel Scroll with Register 3
« Reply #21 on: 15:12, 18 June 10 »
That's odd, I dont see any wobble when I run it in Winape myself.  Are there any settings that could be masking it?

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!
like
0
No reactions