English Amiga Board


Go Back   English Amiga Board > Main > Retrogaming General Discussion

 
 
Thread Tools
Old 26 April 2021, 08:19   #1
LongLifeA1200
Registered User
 
LongLifeA1200's Avatar
 
Join Date: Nov 2017
Location: Amiga Kingdom
Posts: 366
Good talks about Amstrad CPC Coding Tricks?

Where are they?

Even the most spectacular recent port of Pinball Dreams from Batman Group that ran on a standard 6128 provided little to no details on how exactly they got the humble machine to achieve it.

All I got so far is that the game runs in Mode 1 to take advantage of hardware scrolling and a wider screen resolution, but if that is true, how did it override the 4 colour limit?
LongLifeA1200 is offline  
Old 26 April 2021, 12:10   #2
britelite
Registered User
 
Join Date: Feb 2010
Location: Espoo / Finland
Posts: 818
Quote:
Originally Posted by LongLifeA1200 View Post
All I got so far is that the game runs in Mode 1 to take advantage of hardware scrolling and a wider screen resolution, but if that is true, how did it override the 4 colour limit?
Only the scoreboard seems to be in Mode 1, the rest of the screen is obviously Mode 0 so there's no 4 colour limit to overcome
britelite is offline  
Old 26 April 2021, 14:26   #3
lmimmfn
Registered User
 
Join Date: May 2018
Location: Ireland
Posts: 672
Not to take away from the awesome work done by the batman group but some of the effects are relatively simple to achieve on the CPC

e.g. the scoreboard is mode 1 and the main playing area is mode 0. This mode change is quite simple to achieve along with colour changes.

The CPC has interrupts which are triggered every 300th of a second and obviously the screen refresh is 50Hz so updated every 50th of a second. This provides 6 interruptable positions on the screen for which the mode can change or the colours can change. Scroll down here to the section "Secrets of the CPC screen" https://www.chibiakumas.com/z80/platform5.php#LessonP41 which shows these 6 positions.
To do mode/colour changes outside of these 6 positions requires use of CPU NOP's( can have code but tricky ) as the CPU needs to execute the operation at the exact time that the line is drawn.

Overscan is very easy to setup on the CPC, you just change the CRTC registers for the screen size, it does consume a lot of memory though. The same page linked above shows how to create an overscan screen by reconfiguring the CRTC registers.

Most CPC games used awful software scroll, this consumes a lot of CPU copying the data and running the game logic also, that is why many CPC games seem slow/clunky.

However the CPC's CRT does actually provide a hardware scroll mechanism, the firmware even has 8 pixel horizontal/vertical scrolling in it, but looks awful, you see that in Roland on the Ropes and some other earlier software.

The screen can be scrolled vertically per pixel(this is what is used in Pinball Dreams). Horizontal scrolling isn't per pixel though, its 2 mode 0 pixels, 4 mode 1 pixels and I think 8 mode 2 pixels(never tried it in mode 2 but would expect that).
The Batman Group demo of Mario shows per pixel scrolling, however its achieved as far as i remember reading by offsetting the tile pixels and redrawing the screen and hardware scrolling after 4 pixels in mode 1. This type of storing offset gfx data is what the ST also used for scrolling.

However hardware scrolling the screen with the CRTC means all the screen co-ordinates also change, e.g. if vertical scrolling the initial top left location lets call it coordinates 0,0 will scroll down the screen to sprite updates need to recalculate all the new positions based on the scroll.

What is a little trickier to achieve is hardware scrolling a portion of the screen while another part remains static as in Pinball Dreams where the score is static and the play area scrolls. This is achieved with a CPC technique called "rupture" and its effectively reprogramming the screen layout of the CRTC as the beam moves down the screen.

The rupture effect is also shown on the same page i linked above, i still haven't got my head fully around it especially when combined with scrolling. I have several docs on it but still a bit puzzled, its trickier mainly because there's 1000's of ways to get it wrong, timing is critical and you cant see visually if its just something that needs to be tuned slightly as the screen will be all over the shop

The threads on the CPC wiki provide a lot of the assembly code for smooth vertical and horizontal coding.

There's some other funky effects like a mode 3 effect which effectively provides 2 bitplanes. This means the sprites can be wiped without affecting the background, however this limits colours to 4 colours for sprites and 4 for the scrolling playfield. This effect is used in Mission Genocide.

Basically using the hardware for most of the effects free's up the CPU for actual gameplay and is why newer titles are a lot smoother than most of the shovelware the CPC got back in the day.

I think its wonderful today that all these techniques and information on them is available to anyone. Back in the day even getting a Z80 book was difficult and affording an assembler was another issue. I loved programming in basic on the CPC back in the day but love messing about with Z80 on it nowadays.
lmimmfn is offline  
Old 26 April 2021, 15:40   #4
manossg
Registered User
 
Join Date: Nov 2019
Location: Greece
Posts: 992
@lmimmfn

Very interesting post, mate!
manossg is offline  
Old 26 April 2021, 16:58   #5
Tigerskunk
Inviyya Dude!
 
Tigerskunk's Avatar
 
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,770
Quote:
Originally Posted by manossg View Post
@lmimmfn

very interesting post, mate!
+1
Tigerskunk is offline  
Old 27 April 2021, 16:42   #6
LongLifeA1200
Registered User
 
LongLifeA1200's Avatar
 
Join Date: Nov 2017
Location: Amiga Kingdom
Posts: 366
Quote:
Originally Posted by lmimmfn View Post
that is why many CPC games seem slow/clunky.
How many games on the Amstrad CPC could potentially be improved and what is that potential. You've helped answered some of those questions.

Quote:
Originally Posted by lmimmfn View Post
However the CPC's CRT does actually provide a hardware scroll mechanism, the firmware even has 8 pixel horizontal/vertical scrolling in it, but looks awful
I read a quote recently from a game developer, Nick, for 8 bit computers (which included the ZX Spectrum) mention "A lot of the games Dave and I made were fast paced so we could get away with scrolling the screen or moving sprites at 8 pixels at a time".

Quote:
Originally Posted by lmimmfn View Post
The screen can be scrolled vertically per pixel (this is what is used in Pinball Dreams). Horizontal scrolling isn't per pixel though, its 2
Hmm. The Amstrad CPC scrolls vertically a little easier than horizontally. I had wondered if the choice of porting Pinball Dreams was because so it could fit nicely into the machine's limitations. Their next project doesn't seem to involve horizontal scrolling either.

Interesting stuff.

So if a horizontal moving game were designed to move 2 pixels at a time, it could get smooth scrolling in 16 color.
LongLifeA1200 is offline  
Old 16 June 2021, 00:24   #7
lmimmfn
Registered User
 
Join Date: May 2018
Location: Ireland
Posts: 672
Just seeing this now.
Quote:
Originally Posted by LongLifeA1200 View Post
How many games on the Amstrad CPC could potentially be improved and what is that potential. You've helped answered some of those questions.
Quite a lot of games could be improved, i dont think there is any comprehensive list of CPC games using hardware scroll, but basically any game which scrolls but the scroll is happening in the centre of the screen with static gfx(maybe with non static score/lives) surrounding the scroll area e.g. Super Stunt Car - [ Show youtube player ]
Note: having a panel on the top of the screen or the bottom of the screen can support hardware scroll by splitting the screen into the vertical positions of the interrupt, like Mission Genocide - [ Show youtube player ]

Quote:
Originally Posted by LongLifeA1200 View Post
I read a quote recently from a game developer, Nick, for 8 bit computers (which included the ZX Spectrum) mention "A lot of the games Dave and I made were fast paced so we could get away with scrolling the screen or moving sprites at 8 pixels at a time".
If a game is fast, it can use 8 pixel scrolls no problem, but that would mean it scrolls 25 or 50 characters per second horizontally or vertically which is a lot but it would be smooth as tied to the 50Hz display, i.e. full/half frame rate.

Quote:
Originally Posted by LongLifeA1200 View Post
Hmm. The Amstrad CPC scrolls vertically a little easier than horizontally. I had wondered if the choice of porting Pinball Dreams was because so it could fit nicely into the machine's limitations. Their next project doesn't seem to involve horizontal scrolling either.
Possibly, im not sure, maybe they just liked the game , theyre doing some amazing stuff with Vespertino - [ Show youtube player ]

Quote:
Originally Posted by LongLifeA1200 View Post
So if a horizontal moving game were designed to move 2 pixels at a time, it could get smooth scrolling in 16 color.
They did implement a per pixel scroll mode 0 16 colour demo of mario
[ Show youtube player ]
But im 99.99% sure it was using preshifted assets, i.e. as CPC horizontal scroll is 2 pixels having double buffer with back buffer having the offset applied and switching buffers and scrolling with hardware every 2 frames.
lmimmfn is offline  
Old 07 August 2021, 16:41   #8
LongLifeA1200
Registered User
 
LongLifeA1200's Avatar
 
Join Date: Nov 2017
Location: Amiga Kingdom
Posts: 366
Quote:
Originally Posted by lmimmfn View Post
Very interesting website. He discussed the EGX trick. It has limited uses. One example is the game "Imperial Mahjong".

Quote:
Originally Posted by lmimmfn View Post
They did implement a per pixel scroll mode 0 16 colour demo of Mario.
It looks so fast I thought it was scrolling 2 pixels at time. Then later I realised the resolution is lower than the NES.

Quote:
Originally Posted by Bruce Abbott View Post
BTW it's not only mediocre ports that might be improved. In 1986 when I transferred the Graphic Adventure Creator from tape to disk, I glanced at its code for filling areas in drawings and saw right away that it could be speeded up. 27 years later I finally published a patch that makes the fill function more than 5 times faster!
That is interesting and exactly the kind of thing I like to hear about. There are a dozen text adventures on the CPC I'm keen to try, though I don't know if they use GAC or not.
LongLifeA1200 is offline  
Old 07 August 2021, 16:49   #9
rothers
Registered User
 
Join Date: Apr 2018
Location: UK
Posts: 487
The CPC really missed out on hardware pushing games, it was very much similar to the early Amiga games just using ST ports
rothers is offline  
Old 07 August 2021, 20:33   #10
NorthWay
Registered User
 
Join Date: May 2013
Location: Grimstad / Norway
Posts: 839
All those tricks should work on the Thomson TO8 that has the same display chip AFAIK - and the much cooler 6809 cpu. I have one, but it is more for collecting (still haven't tried powering it up...). Oh and I also have a Dragon 64. Yep, I kinda like the 6809 (I even want the 6809 hack for the 8-bit Ataris).
NorthWay is offline  
Old 08 August 2021, 17:53   #11
lmimmfn
Registered User
 
Join Date: May 2018
Location: Ireland
Posts: 672
Quote:
Originally Posted by LongLifeA1200 View Post
Very interesting website. He discussed the EGX trick. It has limited uses. One example is the game "Imperial Mahjong".
His website is great along with his youtube videos where he codes the effects and shows them for multiple 8/16 bits.

Quote:
Originally Posted by LongLifeA1200 View Post
It looks so fast I thought it was scrolling 2 pixels at time. Then later I realised the resolution is lower than the NES.
Yes, 16 colour mode on the CPC has fat pixels, i.e. resolution in 16 colour mode is only 160x200, C64 multicolour mode is the same resolution and has the same fat pixels. However for the C64, it can use sprite tricks for high resolution sprites, i.e. uses multicolour fat pixel sprites then a 1 colour high res mask sprite on top of that.
Most 8 bit machines had resolution limitations mainly due to lack of memory(very expensive back in the day) and lack of CPU grunt to move high resolution/high colour objects around the screen, although the C64 did of course has great hardware for this but as computers are more general purpose they lack hardware features of consoles. Baring in mind consoles didnt need much RAM as most of the data is on the ROM cartridge, i.e. NES had 2KB of onboard RAM and cartridges could have additional RAM as well as the ROM.
The whole Amiga vs Megadrive debate also touches on the same, i.e. no tileset on Amiga, limited sprites but the Amiga is more flexible as a home computer bitmaps vs tilesets etc.

I looked the Super Mario thread on cpc wiki - https://www.cpcwiki.eu/forum/games/a...angroup!!/100/
Its actually using colour cycling and rasters(screen colour splits) for per pixel scrolling, now thats neat although would be quite limiting.[/QUOTE]

Quote:
Originally Posted by Steril707 View Post
+1
Quote:
Originally Posted by manossg View Post
@lmimmfn

Very interesting post, mate!
, thanks guys(yes very late )

Quote:
Originally Posted by NorthWay View Post
All those tricks should work on the Thomson TO8 that has the same display chip AFAIK - and the much cooler 6809 cpu. I have one, but it is more for collecting (still haven't tried powering it up...). Oh and I also have a Dragon 64. Yep, I kinda like the 6809 (I even want the 6809 hack for the 8-bit Ataris).
The Thomson T08 uses a different chip(Thomson EF9369) for gfx(although im sure it has lots of its own tricks ) according to wikipedia - https://en.wikipedia.org/wiki/Thomson_TO8
The CPC, BBC and some others used the motorola MC6845(and licensed variants) - https://en.wikipedia.org/wiki/List_o...s_using_a_CRTC
Similar tricks can also work with the BBC etc. although there are variations based on different interrupt timings etc.

Quote:
Originally Posted by rothers View Post
The CPC really missed out on hardware pushing games, it was very much similar to the early Amiga games just using ST ports
That pretty much sums it up, most of CPC games we're Speccy ports running slower because they would only emulate the Seccy screen redraw on the CPC ,i.e. those awful jerky 4 colour CPC arcade ports, of course the Speccy Z80 did run a little faster vs the CPC(effective 3.3MHz due to wait states vs 3.5 of the Speccy) making the CPC version slower again.

Back in May after not having used a CPC for 31 years or so i finally picked up an Amstrad CPC 6128 with monitor(for 70euro ) and a few disk games. Although it was a tape 64k Amstrad i had back in the day, its lovely to use one again after so many years. I finally got my Gotek working again(had wrong cable grr.) a few weeks ago so finally trying out these new hardware scrolling games.

Want to try this(Alcon 2020, i.e. new Slapfight port) but i need to get a memory/rom expansion as it needs 512K - [ Show youtube player ]
Compare to the original port(ok admittedly the original port only needed 64k) - [ Show youtube player ]

Although i'm not a fan of the stippling used in the gfx its probably fine on a CRT. and the scrolling is so nice and smooth, and the new version will be 25Hz
lmimmfn is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Amstrad CPC/CPC plus "fanboy" thread kamelito Retrogaming General Discussion 79 29 August 2021 13:29
Sonic GX on Amstrad CPC plus :D !! dlfrsilver Retrogaming General Discussion 5 03 November 2019 14:06
Amstrad CPC, much better than I thought it would be! paul773car Retrogaming General Discussion 434 11 March 2016 00:08
few Amstrad CPC games s2325 request.Old Rare Games 8 07 April 2012 08:30
Bizarre coding tricks Ray Norrish Coders. General 6 01 January 2006 17:43

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:51.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08510 seconds with 15 queries