26 April 2021, 08:19 | #1 |
Registered User
Join Date: Nov 2017
Location: Amiga Kingdom
Posts: 368
|
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? |
26 April 2021, 12:10 | #2 |
Registered User
Join Date: Feb 2010
Location: Espoo / Finland
Posts: 818
|
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
|
26 April 2021, 14:26 | #3 |
Registered User
Join Date: May 2018
Location: Ireland
Posts: 678
|
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. |
26 April 2021, 15:40 | #4 |
Registered User
Join Date: Nov 2019
Location: Greece
Posts: 992
|
@lmimmfn
Very interesting post, mate! |
26 April 2021, 16:58 | #5 |
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,775
|
|
27 April 2021, 16:42 | #6 | ||
Registered User
Join Date: Nov 2017
Location: Amiga Kingdom
Posts: 368
|
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:
Quote:
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. |
||
16 June 2021, 00:24 | #7 | ||||
Registered User
Join Date: May 2018
Location: Ireland
Posts: 678
|
Just seeing this now.
Quote:
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:
Quote:
Quote:
[ 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. |
||||
07 August 2021, 16:41 | #8 | |||
Registered User
Join Date: Nov 2017
Location: Amiga Kingdom
Posts: 368
|
Quote:
Quote:
Quote:
|
|||
07 August 2021, 16:49 | #9 |
Registered User
Join Date: Apr 2018
Location: UK
Posts: 488
|
The CPC really missed out on hardware pushing games, it was very much similar to the early Amiga games just using ST ports
|
07 August 2021, 20:33 | #10 |
Registered User
Join Date: May 2013
Location: Grimstad / Norway
Posts: 841
|
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).
|
08 August 2021, 17:53 | #11 | ||||
Registered User
Join Date: May 2018
Location: Ireland
Posts: 678
|
Quote:
Quote:
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] , thanks guys(yes very late ) Quote:
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:
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 |
||||
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 |
|
|