exe:

bouton A, B et option1
/*
promotion rgc 2010 - LYNX - kit BLL (newcc65)
beauregard - philippe H.
13/11/2010
LYNX-image */
#include <stdlib.h>
#include <lynx.h>
#include <lynxlib.h>
char palj[]={
0x00,0x00,0x00,0x04,0x00,0x06,0x02,0x08,0x00,0x05,0x00,0x07,0x09,0x0C,0x0E,0x0F,
0x00,0x02,0x15,0x36,0x2A,0x5A,0x4A,0x7D,0x3D,0x6D,0x4E,0x8E,0x9F,0xBF,0xDF,0xFF};
char pal[]={
0x00,0x01,0x02,0x03,0x03,0x05,0x04,0x08,0x06,0x0A,0x08,0x0A,0x0B,0x0D,0x0E,0x0F,
0x00,0x11,0x13,0x23,0x14,0x56,0x26,0x78,0x29,0x9A,0x3B,0x2D,0x5D,0x2E,0x4F,0xEF};
/* LYNX-specific #defines: */
#define JOY_RIGHT 0x10
#define JOY_LEFT 0x20
#define JOY_DOWN 0x40
#define JOY_UP 0x80
#define BUTTON_OPTION1 0x08
#define BUTTON_OPTION2 0x04
#define BUTTON_LEFT 0x02
#define BUTTON_RIGHT 0x01
#define BUTTON_PAUSE 0x01
char SCREEN[8160] at (MEMTOP-16320);
char RENDER[8160] at (MEMTOP-8160);
// ------------------------------------
extern char rgc[];
extern char lj[];
char SCB[];
#asm
_SCB dc.b $c0,$10,$20
dc.w 0,0
dc.w 0,0,$100,$100
dc.b $01,$23,$45,$67,$89,$ab,$cd,$ef
#endasm
// ------------------------------------
// ------------------------------------
//char acteurs[]; //
extern char ac000000[];
extern char ac000001[];
extern char ac000002[];
extern char ac000003[];
extern char ac000004[];
extern char ac000005[];
char *acteurtab[6] = {ac000000, ac000001, ac000002, ac000003, ac000004, ac000005};
char SCBacteur[]; // déclaration d'un nouveau controleur de sprite
//char SCBacteur1[]; // déclaration d'un nouveau controleur de sprite
#asm
_SCBacteur dc.b $c7,$10,$20
dc.w 0,0
dc.w 0,0,$100,$100
dc.b $01,$23,$45,$67,$89,$ab,$cd,$ef
#endasm
// ------------------------------------
int etape,posx,posy,goacteurs,nacteur,yacteur;
int i;
int tempa,tempr,aromeo,drap1;
int actscx,actscy;
int rgcscx,rgcscy;
// assembler vertical retrace syncronisation routine
void Vsync()
{
#asm
vretrace:
lda $fd0a
bne vretrace
#endasm
}
/**************************************************************************
** **
** **
**************************************************************************/
char main()
{
InitIRQ();
CLI;
SetBuffers(SCREEN, RENDER ,0);
/* set the palette */
SetRGB(palj); // Ceci sert à changer la palette de la Lynx.
DrawFBox(0,0,160,102,0);
posx=0;
posy=0;
nacteur=5;
etape=-1;
SCBX(SCB) = 0;
SCBY(SCB) = 0;
SCBDATA(SCB) = lj; //jaguar et rgc;
SCBNEXT(SCB) = SCBacteur; // chainage de sprite
SCBX(SCBacteur) = 200;
SCBY(SCBacteur) = 0;
SCBDATA(SCBacteur) = acteurtab[5%6];
/**************************************************************************
** BOUCLE PRINCIPALE **
**************************************************************************/
for( ; ; )
{
// DrawFBox(0,0,160,102,0); // affichage d'une boite couleur 0 (noire)
SCBX(SCB) = posx;
SCBY(SCB) = posy;
if (etape>-1)
{
if (joystick & JOY_RIGHT) // direction Droite
posx++;
if (joystick & JOY_LEFT) // direction Gauche
posx--;
if (joystick & JOY_UP) // direction Haut
posy--;
if (joystick & JOY_DOWN) // direction Bas
posy++;
if (posx<-160) posx=-160; // limit va à gauche
if (posx>0) posx=0; // limit va à gauche
if (posy>0) posy=0; // limit haut
if (posy<-102) posy=-102; // limit bas
}
// *********************************************************************************************
if (etape==-1) // écran titre jaguar
{
SetRGB(palj);
SCBDATA(SCB) = lj;
rgcscx=0;rgcscy=0;
if (joystick & (BUTTON_RIGHT))
{
etape=0;SCBDATA(SCB) = rgc;SetRGB(pal);
}
}
// *********************************************************************************************
if (etape==0) // écran titre rgc
{
//SCBDATA(SCB) = rgc
rgcscx=0;rgcscy=0;
if (joystick & (BUTTON_LEFT)) etape=1;
if (joystick & (BUTTON_OPTION1))
{
etape=-1;
posx=0;posy=0;nacteur=5;
actscx=0;actscy=0;
rgcscx=0;rgcscy=0;
}
}
// *********************************************************************************************
if (etape==1) // écran titre
{
DrawFBox(0,0,160,102,0); // affichage d'une boite couleur 0 (noire)
if (rgcscx<256)
{
++rgcscx;
}
if (rgcscy<256)
{
++rgcscy;
}
SCBHS(SCB) = rgcscx;
SCBVS(SCB) = rgcscy;
if (rgcscy==256 & rgcscy==256) etape=0;
}
/**************************************************************************
** présentation acteurs RGC 2010 **
**************************************************************************/
if (goacteurs==0 & (joystick & (BUTTON_RIGHT))) {goacteurs=1;yacteur = 50;}
if (goacteurs==1)
{
SCBX(SCBacteur) = 66;
if (tempa<150 ) ++tempa;actscx=actscx+4;actscy=actscy+4;
if (tempa>149 )
{
--nacteur;tempa=1;actscx=0;actscy=0;
if (nacteur>-1)
{
SCBDATA(SCBacteur) = acteurtab[nacteur%6];
}
else
{
nacteur=5;tempa=0;goacteurs=0;SCBX(SCBacteur) = 200;
SCBDATA(SCBacteur) = acteurtab[nacteur%6];
}
}
SCBY(SCBacteur) = yacteur-(actscy/4);
SCBY(SCBacteur) = SCBY(SCBacteur) + 16;
SCBHS(SCBacteur) = actscx;
SCBVS(SCBacteur) = actscy;
}
DrawSprite(SCB);
Vsync();
SwapBuffers();
}
/**************************************************************************
** FIN de la BOUCLE PRINCIPALE **
**************************************************************************/
}


