Difference between revisions of "CPCRSlib"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(added category)
(Fix broken links.)
 
(21 intermediate revisions by 8 users not shown)
Line 1: Line 1:
'''CPCRSlib''' is a C library containing routines and functions that allow to the handling of sprites and tile-mapping in Amstrad CPC.
+
'''CPCRSlib''' is a [[:Category:C|C library]] containing routines and functions that allow to the handling of sprites and tile-mapping in Amstrad CPC.  
  
The library is written to be used with [[Z88DK]] compiler. CPCRSlib also incorporates keyboard routines to redefine and to detect keys, as well as general routines to change to the screen mode or the colours.  
+
The library is written to be used with [[Z88DK|Z88DK]] compiler or with [[SDCC|SDCC]] complier. CPCRSlib also incorporates keyboard routines to redefine and to detect keys, as well as general routines to change to the screen mode or the colours.  
  
It can be found an explanation of each function/routine included in the library in [http://www.amstrad.es/programacion/cpcrslib_eng.htm www.amstrad.es/programacion/cpcrslib_eng.htm]  
+
It can be found an explanation of each function/routine included in the library in [http://www.amstrad.es/programacion/cpcrslib.html http://www.amstrad.es/programacion/cpcrslib.html]  
  
Last release of the library can be downloaded at: [http://code.google.com/p/cpcrslib/downloads/list code.google.com/p/cpcrslib/downloads/list]  
+
Last release of the library can be downloaded at:
 +
[http://sourceforge.net/projects/cpcrslib/ sourceforge/cpcrslib]  
  
[[CPCWYZlib]] is included in the downloadable package of CPCRSlib. CPCWYZlib includes a music player and SFX player coded by WYZ.
+
[[CPCWYZlib|CPCWYZlib]] is included in the downloadable package of CPCRSlib. CPCWYZlib includes a music player and SFX player coded by WYZ, which can play music created with [[WYZTracker|WYZTracker]].  
  
[[Category:Programming]]
+
== Easy installation ==
 +
 
 +
If starting from scratch:
 +
 
 +
# Get [https://github.com/cpcitor/cpc-dev-tool-chain cpc-dev-tool-chain] which sets up automatically a C or ASM compiling environment on Linux, Windows, Mac.
 +
# Create your project. In one of your C source file, just #include "cpcrslib.h".
 +
# Compile the project. cpc-dev-tool-chain will notice the dependency and fetch and compile cpcrslib for you.
 +
 
 +
Need '''sample projects''' to see how how to start? cpc-dev-tool-chain has a cpcrslib-all target that [https://github.com/cpcitor/cpc-dev-tool-chain/blob/master/documentation/how_to_install.md#user-content-build-a-project compiles cpcrslib sample projects].
 +
 
 +
== installation ==
 +
 
 +
On Ubuntu Lucid Lynx :
 +
 
 +
<pre>
 +
cd cpcrslib/
 +
z80asm -v -xcpcrslib.lib @cpcrslib.lst
 +
sudo cp cpcrslib.lib /usr/share/z88dk/lib/clibs/
 +
sudo cp cpcrslib.h /usr/share/z88dk/include
 +
</pre>
 +
 
 +
now it should work.
 +
 
 +
== Usage ==
 +
 
 +
A classic "Hello world" from cpcrslib :
 +
<pre>
 +
#include "cpcrslib.h" // CPC Library
 +
 
 +
int main(void) {
 +
cpc_PrintStr("Hello World!");
 +
while (!cpc_AnyKeyPressed()) { }
 +
return 0;
 +
}
 +
</pre>
 +
 
 +
You should provide a zcc_opt.def in the source directory :
 +
 
 +
<pre>
 +
DEFINE DEFINED_myzorg
 +
defc myzorg = 16384
 +
 
 +
IF !NEED_appstartup
 +
DEFINE NEED_appstartup
 +
defc reqpag = 32
 +
defc NEED_expanded = 1
 +
ENDIF
 +
</pre>
 +
 
 +
Compile the contents by running the compiler, pre-processor and linker in one go by typing:
 +
 
 +
<pre>
 +
zcc +cpc -create-app -make-app -O3 -unsigned -o hello.bin hello.c -lcpcrslib -lndos -zorg=16384
 +
</pre>
 +
 
 +
you'll have a hello.cpc file ready to be run on your CPC.
 +
 
 +
== Sources of projects using z88dk/SDCC and cpcrslib ==
 +
 
 +
*[http://espsoft.blogspot.com.es/2015/08/small-games-for-smart-minds.html Small Games for Smart Minds] by ESP Soft.
 +
*[http://espsoft.blogspot.com.es/2015/08/mariano-dragon-capers-in-cityland.html Mariano The Dragon] by ESP Soft.
 +
*[[Sort'em]] by LuBlu Entertainment.
 +
*[http://cpcfreak.cpc-live.com/ Blue Angel 69] by Kevin Thacker.
 +
*[https://cpcrulez.fr/GamesTest/nanako_descends_to_hell.htm Nanako Descends to Hell] by The Mojon Twins
 +
*[https://cpcrulez.fr/GamesTest/nanako_in_classic_japanese_monster_castle.htm Nanako in Classic Japanese Monster Castle] by The Mojon Twins
 +
*[https://cpcrulez.fr/GamesTest/platformer_medley_block_1.htm Mari Stormbringer Plateform Medley #1] by The Mojon Twins
 +
*[http://www.mojontwins.com/?page_id=171 Phantomas Thales #1: Marsport] by The Mojon Twins.
 +
*[http://www.mojontwins.com/juegos_mojonos/cheril-of-the-bosque-cpc/ Cheril of the Bosque] by The Mojon Twins.
 +
*[http://www.mojontwins.com/juegos_mojonos/lala-prologue-cpc/ Lala Prologue] by The Mojon Twins.
 +
*[http://www.mojontwins.com/juegos_mojonos/sir-ababol-cpc/ Sir Ababol] by The Mojon Twins.
 +
*[http://www.mojontwins.com/juegos_mojonos/uwol-2-cpc/ Uwol 2]  by The Mojon Twins.
 +
*[http://espsoft.blogspot.com.es/2015/08/totems-columns-cpc-two.html TOTEMS: Columns CPC Two] by ESP Soft.
 +
 
 +
== See also ==
 +
 
 +
[[CPCtelera]]
 +
 
 +
[[Category:Programming]] [[Category:C]][[Category:CrossDev]]

Latest revision as of 13:40, 23 January 2018

CPCRSlib is a C library containing routines and functions that allow to the handling of sprites and tile-mapping in Amstrad CPC.

The library is written to be used with Z88DK compiler or with SDCC complier. CPCRSlib also incorporates keyboard routines to redefine and to detect keys, as well as general routines to change to the screen mode or the colours.

It can be found an explanation of each function/routine included in the library in http://www.amstrad.es/programacion/cpcrslib.html

Last release of the library can be downloaded at: sourceforge/cpcrslib

CPCWYZlib is included in the downloadable package of CPCRSlib. CPCWYZlib includes a music player and SFX player coded by WYZ, which can play music created with WYZTracker.

Easy installation

If starting from scratch:

  1. Get cpc-dev-tool-chain which sets up automatically a C or ASM compiling environment on Linux, Windows, Mac.
  2. Create your project. In one of your C source file, just #include "cpcrslib.h".
  3. Compile the project. cpc-dev-tool-chain will notice the dependency and fetch and compile cpcrslib for you.

Need sample projects to see how how to start? cpc-dev-tool-chain has a cpcrslib-all target that compiles cpcrslib sample projects.

installation

On Ubuntu Lucid Lynx :

cd cpcrslib/
z80asm -v -xcpcrslib.lib @cpcrslib.lst
sudo cp cpcrslib.lib /usr/share/z88dk/lib/clibs/
sudo cp cpcrslib.h /usr/share/z88dk/include

now it should work.

Usage

A classic "Hello world" from cpcrslib :

#include "cpcrslib.h"	// CPC Library

int main(void) {
	cpc_PrintStr("Hello World!");
	while (!cpc_AnyKeyPressed()) {	}
	return 0;
}

You should provide a zcc_opt.def in the source directory :

	DEFINE DEFINED_myzorg
	defc myzorg = 16384

IF !NEED_appstartup
	DEFINE	NEED_appstartup
	defc reqpag = 32
	defc NEED_expanded = 1
ENDIF

Compile the contents by running the compiler, pre-processor and linker in one go by typing:

zcc +cpc -create-app -make-app -O3 -unsigned -o hello.bin hello.c -lcpcrslib -lndos -zorg=16384

you'll have a hello.cpc file ready to be run on your CPC.

Sources of projects using z88dk/SDCC and cpcrslib

See also

CPCtelera