Archives of Genesis8 Amstrad Page from 1999 to 2020 about programmation, page 7 / 8
To program in C on Amstrad CPC there are several compilers :
- PhrozenC (on AND for Amstrad CPC as it also exists for windows)
But you can also program in C for Amstrad CPC on another platform. First,the multi-platform C compiler SDCC v3.1.0 targetting Z80 is out.
To use this compiler you can use an IDE : either Code::Blocks with its SDCC template by Octoate, or Phactory v2.1 by NoRecess with the help of SDCC2Pasmo v1.5(wich comes with sources). SDCC2Pasmo takes an .ASM file created by SDCC and converts it to used with PASMO (a Z80 cross assembler) which is compatiblewith Maxam (Amstrad CPC Z80 compiler, WinApe too).
If you are interested in using SDCC, you should read this CPCWiki forum thread about SDCC possible problems and anotherabout sMIDP2lib : a SDCC framework library by Mr Lou (which has now its own page on CPCWiki.
SDCC isnt the only compiler you can use, there is also :
- Z88dk v1.9 with cpcrslib (Amstrad CPC library for Z88dk), check this CPCWiki forum thread about Z88dk. There is a modified cpcrslib and starkos library byKevin Thacker in his Blue Angel 69 game.By the way, the developers of Z88dk are currently in the progress to allow SDCC to be used as a backend for Z88dk.
- CCZ80 v3.1.2 by Emilio Guerrero. There are 2 Amstrad CPC librairies usable for CCZ80 : cpcrslib (adapted from cpcrslibfor Z88dk) and sprutilcpc (included with CCZ80)
Just copy this one line of basic code by Demoniak and paste it in WinApe in the File Menu (or Ctrl + F11, or with any other Amstrad CPC emulator. Just for fun, like the Nyan Cat.
10 MODE 0:e=-1.3:FOR y%=0 TO 199:d=-2.4:FOR x%=0 TO 159:z=0:i=0:a%=0:WHILE a%<15 AND (z*z+i*i)<4:s=(z*z)-(i*i)+d:r=(2*i*z)+e:z=s:i=r:a%=a%+1:WEND:PLOT x%*4,y%*2,a%:d=d+0.0215:NEXT:e=e+0.013:NEXT
P.S. : in the general settings of WinApe, click on display every 1 frame and Turbo Mode, or you may have to wait a bit...
P.P.S : the second image is another basic source (more than 1 line) by Tronic-GPA.
Guess what, Axelay is working on a port of Edge Grinder (see below), so says one of my numerous spies, who assured me that it isnt a secretand safe to be announced.
Edge grinder is in fact a work in progress C64 game at the start, the first Format War "Collabortition" (a combination of collaboration andcompetition) with the plan being for programmers on other 8-bits to consider ways to convert it from the C64 to their platform of choice. So on the Format War web site you can download all you needto port the game, source code, map, background and sprite data.
A new algorythm able to transform bitmap graphics such as on an Amstrad CPC to vector graphics, has been created. It can create smooth, curved contour lines from only-connected-on-the-diagonal single pixels. That would mean playing games on a big screen without big ugly pixels. See below for the link.
CPC Power is holding 4 contests : coding, GFX, music and logo GFX.
This is one news I should have written months ago, so much to say, though it will still be short. The Mojon Twins are spanish developers who simply piss code like cows do, I really dont know where they find time to write so many games.
Their latest creation is Cheril of the Bosque.
Dont hesitate to get their other games, many are coming with the sources like Kevin Thacker did with Blue Angel 69.
Kevin Thacker's conversion of a Magic Bytes reflexion game released in 1989 : Blue Angel 69 (written by Winfried Stappert) is now available. The original game is turn based (vs computer or another player). The screen draws a 8x8 chessboard filled with positive or negative numbers. Each turn, the player must choose a number whichs on the same linge (or column for the other player) that the last chosen number. Once chosen the number est removed from the chessboard and added or substracted from the player score. The goal of the game is of course to have more points than your adversary at the end of the game (where you will see the sexy robot fully).
Blue Angel 69 has been programmed by Kevin Thacker, graphics by Markus Hohmann, CAT art, inlay, disc label by Kukulcan, Blue Angel 69 website hosted by Markus, created by Kukulcan.
You can download the FULL game and source from Kevin Thacker's website.
In the sources you will find a library to use StarKos from z88dk, and within morelib some extras for loading/saving files using amsdos, displaying double height chars and more. The code also includes a modified version of cpcrslib which Kevin modified to try and make the code smaller. Kevin hope others using z88dk to make games will find these sources useful.
All build files and tools (excluding z88dk) are in the download. Kevin Thacker provides all so that you can learn from it, and that's a very good idea.
You will also be able to download it from cpc-power, and here you will also find cassette inlay and a disc label, both created by Kukulcan.
Cpcdsdk is a project aiming to collect the various bit of existing sourcecode in one common place for the linux OS relative to the Amstrad CPC, add the missing features, and make life easier for all developpers :
- The Caprice Reloaded emulator, with integrated assembler and debugger, for windows and linux,
- gfx2crtc, a tool to convert pictures to the amstrad sceen format,
- An imporved version of Ramlaid's cpctools, now running under linux, with (limited) support for usb floppy drives
- A special version of STSound from Leonard, modified to emulate an AY3 more accurately (the original emulates the slightly different YM chip used in the Atari ST)
- Hideur Maikeur by Downwater for handling AMSDOS headers
- iDSK from sid for manipulating dsk images and files inside.
PhrozenC has been updated to v1.1 :
- CC (Win32) Fixed crash when included file does not exist
- Fixed crash when calling CC with a C file entirely created on a CPC
- Fixed CS RSX-command usage. Now only ROM-based, but 100% safe
- Updated documentation with compiler internal section
PhrozenC is a C compiler for Amstrad CPC and PC by NoRecess. On PC it compiles a .C file in .ASM ready to compilewith WinAPE. On CPC the .ASM file can be compiled with Maxam.
For Amstrad CPC it exists a ROM version, a 64 Kb version (stand-alone application), 128 Ko (RSX).
PhrozenC is released with a manual (PDF-format, 33 pages), covering all the things you have to know about to start programming using PhrozenC.
There is even a small tutorial about learning C for the newcomers. Example sources are available, as also a small set of library files handling file management, graphics, memory management, string concatenation, etc..
It's version 1.0, NoRecess plans to get your feedback and provide better versions with time...
Tile Map Areal. A virtual and a visible area are defined. Horizontal and Vertical invisible margins can be defined. With that trick it's possible to make the sprite clipping when disappearing from the screen. It's very usefull when scrolling too.
TileMapConf.asm: Two new constants defined: T_WH y T_HH. With them, the invisble margins are defined.
cpc_ShowTileMap2: Shows visible area instead of full virtual area. Usefull when scrolling.
cpc_PutSpTileMapO: New routine to make a sprite disappear from the screen when it leave the visible area.
cpc_ScrollLeft0,cpc_ScrollRight0: Tile Map Scrolling routines modified. cpc_ScrollLeft, cpc_ScrollRight: Decrapted.
For more news, Go to home page