What differences in programming Spectrum and CPC
What differences in programming Spectrum and CPC
I know they have the same Z80 and later the same sound chips but how different are they when programming and can programs be ported from one to the other easily? do the differences stop between the basic programming languages? what advantages for one over the other?
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: What differences in programming Spectrum and CPC
Disclaimer: I’m no expert on the CPC.
Define “easily.” Obviously, any game logic will remain virtually, if not completely, identical. Any graphics/display, sound, and keyboard polling routines will have to be rewritten. Of them, the display routines will be the ones that would be using drastically different approaches. Not only is the display handling implemented differently on the two machines, but sprites and other graphical data may also have to be stored and retrieved differently for optimal performance. (And if a game relies on any ROM routines, obviously, they’d have to be rewritten.)
Having said that, porting simpler, less demanding games, could be a fairly straightforward task. However, most, if not all, software written for eight-bit micros benefits from extensive optimizations tailored specifically to account for the peculiarities and quirks of individual hardware. Universality usually leads to mediocre results.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Re: What differences in programming Spectrum and CPC
Not necessarily. According to this page, games that were converted from the Spectrum to the CPC often left all the display routines unchanged, including the 8x8 attribute system. They seemingly used some technique to emulate the Spectrum screen in software, slowing the game down.Ast A. Moore wrote: ↑Sun Apr 14, 2019 11:39 pm Any graphics/display, sound, and keyboard polling routines will have to be rewritten. Of them, the display routines will be the ones that would be using drastically different approaches.
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: What differences in programming Spectrum and CPC
Fair enough, but that’s a really lazy approach.djnzx48 wrote: ↑Sun Apr 14, 2019 11:47 pmgames that were converted from the Spectrum to the CPC often left all the display routines unchanged, including the 8x8 attribute system. They seemingly used some technique to emulate the Spectrum screen in software, slowing the game down.Ast A. Moore wrote: ↑Sun Apr 14, 2019 11:39 pm Any graphics/display, sound, and keyboard polling routines will have to be rewritten. Of them, the display routines will be the ones that would be using drastically different approaches.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Re: What differences in programming Spectrum and CPC
But it was cheap, quick, pretty easy to do and meant that the CPC got some games that it wouldn't ordinarily have had.
CPC owners may not have like the quality of what they were getting but it was better then getting nothing at all.
"He made eloquent speeches to an audience consisting of a few depressed daffodil roots, and sometimes the cat from next door."
Re: What differences in programming Spectrum and CPC
Some brilliant points and very clearly stated. I am starting to grasp that it is not necessarily the machine but the community that surrounds it, a community that has not shown any aggression or disrespect. This is exactly the reason I have shied away from the C64, which like the spectrum is a great machine but sadly I have noticed there seems to be a lot of infighting discrediting others and their machines extending to pointless aggression this is also true of certain Amiga communities and lets their chosen architecture down.
I cant wait until my spectrum arrives and is up and running.
Thanks again for your insightful thoughts. and sorry for going off topic.
I cant wait until my spectrum arrives and is up and running.
Thanks again for your insightful thoughts. and sorry for going off topic.
Re: What differences in programming Spectrum and CPC
I've made few CPC games (and speccy too), as someone has said already there are differences you would expect; but for me the most relevant ones are: 4 bits per pixel (16 colours) and 2 bits per pixel (4 colours) graphical modes (colours to choose from a palette of 27) with no attibutes, there's an int at 300Hz instead of 50Hz, there are 64K of RAM and the ROM's can be disabled to access to all it, and the video memory can be configured to use any memory address (including in 64K models).
The biggest problems with a port is that the graphics need to be converted, otherwise the CPC fans won't like it. If you don't do it and go with the 2 bits per pixel model, you'll end with mostly monochrome graphics, or the 8x8 attribute limitation of the speccy that doesn't exist in the CPC. Ideally people prefer 4 bits per pixel and 16 colours, because that's one of the great features of the system, but the pixels are 2:1, so you can't reuse the speccy graphics.
The biggest problems with a port is that the graphics need to be converted, otherwise the CPC fans won't like it. If you don't do it and go with the 2 bits per pixel model, you'll end with mostly monochrome graphics, or the 8x8 attribute limitation of the speccy that doesn't exist in the CPC. Ideally people prefer 4 bits per pixel and 16 colours, because that's one of the great features of the system, but the pixels are 2:1, so you can't reuse the speccy graphics.
- 1024MAK
- Bugaboo
- Posts: 3123
- Joined: Wed Nov 15, 2017 2:52 pm
- Location: Sunny Somerset in the U.K. in Europe
Re: What differences in programming Spectrum and CPC
The only thing that is exactly the same is the Z80 CPU.zack4mac wrote: ↑Sun Apr 14, 2019 10:12 pm I know they have the same Z80 and later the same sound chips but how different are they when programming and can programs be ported from one to the other easily? do the differences stop between the basic programming languages? what advantages for one over the other?
The later 128K ZX Spectrum machine’s do use the same sound chip, but the interface arrangements are different.
The bank memory switching is different.
The ROM code, OS and BASIC are all completely different.
The video display hardware is completely different.
The keyboard is different.
Mark
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
Re: What differences in programming Spectrum and CPC
Well yes, there are some that mimic the Spectrum display - either by using the same backbuffer technique as the Speccy code, but changing the actual render pass to write a CPC format screen from the backbuffer, or by altering the drawing routines to read speccy format data but write it out differently. The Dizzy games, for example, have all the background items coloured from 2 to 7 - numbered for the Speecy colour they're drawn in, but that three bit value gets mapped onto the CPC 4 colours using the two most significant bits (this is why there aren't any blue objects in the Speccy version, it would map onto black!)djnzx48 wrote: ↑Sun Apr 14, 2019 11:47 pmNot necessarily. According to this page, games that were converted from the Spectrum to the CPC often left all the display routines unchanged, including the 8x8 attribute system. They seemingly used some technique to emulate the Spectrum screen in software, slowing the game down.Ast A. Moore wrote: ↑Sun Apr 14, 2019 11:39 pm Any graphics/display, sound, and keyboard polling routines will have to be rewritten. Of them, the display routines will be the ones that would be using drastically different approaches.
Depending on the type of game, this can work ok (see Dizzy, though the egg himself is a special case re-coloured sprite) or cause significant performance hits a graphical quirks (see R-Type). It looks really bad if your game seems to have colour clash on a machine with no such limits.
A slightly less lazy approach is to keep the background mono using inks 0 & 1, but then XORing mono sprites onto the screen in ink 2 and ink 3 the same colour as 2. This "colour plane" approach means you get no graphical distortion from the XOR effect (except when sprites overlap) and your mono sprites can stand out more from the scenery (Uridium is doing something similar to this, but not quite) because they are a totally different colour.
Using modified, coloured in graphics, whether in the four colour Mode 1 or 16 colour Mode 0 is a much nicer approach. Head over Heels shows how much nicer even re-coloured 4 graphics can be. It's still possible to retain most of the core game logic, so porting between machines is still fairly easy. Going full out and taking advantage of hardware tricks with the CRTC and such will give you the best results, as will re-optimizing core routines around the CPC's different contention model, but obviously anything like that makes porting more complicated.
Re: What differences in programming Spectrum and CPC
If I remember correctly, Dynamite Dan II cpc port, was converted from Spectrum original for just week or two.
It wasnt an easy task, but it showed how much the two machines are actually related.
@zack4mac
Well, in the last couple of years, c64 scene has become much better in many ways.
Amiga community is quite another story and situation is even worse, than what you have just described.
It wasnt an easy task, but it showed how much the two machines are actually related.
@zack4mac
Well, in the last couple of years, c64 scene has become much better in many ways.
Amiga community is quite another story and situation is even worse, than what you have just described.
Re: What differences in programming Spectrum and CPC
You might want to read these tutorials:
https://www.chibiakumas.com/z80/
They were written by a developer who had a great idea of writing a modern shoot up for multiple platforms. He used to be here, but sadly took offence to what was in all sense and purpose constructive feedback regarding his game, and therefore left.
https://www.chibiakumas.com/z80/
They were written by a developer who had a great idea of writing a modern shoot up for multiple platforms. He used to be here, but sadly took offence to what was in all sense and purpose constructive feedback regarding his game, and therefore left.
Re: What differences in programming Spectrum and CPC
I only did one conversion from Speccy to Amstrad (Gunboat by Accolade).
That was fairly easy because it was solid(ish) 3D so most of the drawing was just horizontal lines.
That was fairly easy because it was solid(ish) 3D so most of the drawing was just horizontal lines.