Game Select kısmı çok basit. 138in1 kartuşun 8 bitlik adresleme hatlarına binary olarak olarak seçilen oyunun numrasını set edip slot'u reset ediyorum sadece.
PIC Kodu aşağıda. Ancak OLED kütüphanesi ticari bir başka proje için yazıldığından burada doğrudan paylaşamıyorum. Ama zaten o kısımda özel birşey yok. Ana kodda ekrana yazı yazan fonksiyonlar belli. O kısımları kendi LCD rutinlerinizle replace ederek aynısını yapabilirsiniz.
// MAIN CODE
void intHandlerH();
void intHandlerL();
// VECTORS ...
#pragma code intvectors = 0x0008
void InterruptVectorHigh(void)
{
_asm
GOTO intHandlerH
NOP
NOP
NOP
NOP
NOP
NOP
GOTO intHandlerL
_endasm
}
#pragma code
unsigned char penc,enc,enc_flag=0;
unsigned char game=0;
unsigned int enc_pos=0;
unsigned char pA, pB;
#pragma interrupt intHandlerH
void intHandlerH()
{
unsigned char t;
if (PIR2bits.TMR3IF)
{
PIR2bits.TMR3IF=0;
TMR3H=241; // Period 1ms ...
// Check Encoder ...
if ((BTN_B!=0) && (pA==0))
{
if (BTN_A==0) game++; else game--;
if (game==255) game=137;
if (game==138) game=0;
enc_flag=1;
}
else
if ((BTN_B==0) && (pA!=0))
{
if (BTN_A==0) game--; else game++;
if (game==255) game=137;
if (game==138) game=0;
enc_flag=1;
}
if (BTN_B) pA=1; else pA=0;
}
}
const rom char * rom Games[]=
{
"3 Count Bout",
"Aero Fighters 2",
"Aero Fighters 3",
"Alpha Mission 2",
"Andro Dunos",
"Art of Fight. 2",
"Art of Fight. 3",
"Bang Bead",
"Baseball Start 2",
"Blazing Star",
"Blue's Journey",
"Panic Bomber",
"Breakers",
"Breakers Revenge",
"Burning Fight",
"Captain Tomaday",
"Hidden Dragon 20",
"Hidden Dragon 20",
"Cyber-Lip",
"Double Dragon",
"Double Dragon Pl",
"Eightman",
"Fighter's Histor",
"Ganryu",
"Garou: Mark of T",
"Garou: Mark of T",
"Ghost Pilots",
"Ghostlop",
"Goal! Goal! Goal",
"Kabuki Klash",
"Kabuki Klash Far",
"King of Gladiato",
"Lansquenet",
"Last Resort",
"League Bowling",
"Magical Drop II",
"Magical Drop III",
"Metal Slug",
"Metal Slug 2",
"Metal Slug 2 +",
"Metal Slug 3",
"Metal Slug 3 +",
"Metal Slug 4",
"Metal Slug 4 +",
"Metal Slug 5",
"Metal Slug 5 +",
"Metal Slug 6",
"Metal Slug 6 +",
"Metal Slug +",
"Money Puzzle Exc",
"Mutation Nation",
"Nan-1975",
"Neo Bomberman",
"Neo DriftOut",
"Neo Mr. Do!",
"Neo Turf Masters",
"NeoGeo Cup 98",
"Nightmare In The",
"Ninja Combat",
"Ninja Commando",
"Ninja Master's",
"Over Top",
"Pop n'Bounce",
"Power Spikes II",
"Pre Historic Isl",
"Puzzle Bobble",
"Puzzle Bobble 2",
"Puzzle de Pon!",
"Puzzle de Pon!",
"Puzzled",
"Q Double Dragon",
"Rage of Dragons",
"Rage of Dragons ",
"Robo Army",
"Sam. Shodown II",
"Sam. Shodown II ",
"Samurai Shodown ",
"Samurai Shodown ",
"Samurai Shodown ",
"Sam. Shodown IV+",
"Sam. Shodown V S",
"Sengoku",
"Sengoku 2",
"Sengoku 3",
"Sengoku 3 Plus",
"ShockTroopers",
"ShockTroopers 2n",
"Snk vs Capcom Re",
"Spin Master",
"Spin Master Plus",
"Street Fighter v",
"Street Hoop",
"Strikers 1945 Pl",
"Strikers 1945 Pl",
"Super Dodge Ball",
"Super Sidekicks",
"Super Sidekicks ",
"Super Sidekicks ",
"Super Sidekicks ",
"Takon Matrimelee",
"KOF 10th Anniver",
"KOF 10th Anniver",
"KOF 2001",
"KOF 2001 Plus",
"KOF 2002",
"KOF 2002 Magic I",
"KOF 2002 Magic P",
"KOF 2002 Super",
"KOF 2004 SE Plus",
"KOF 2004 SP",
"KOF 2005 Unique",
"KOF 2005 Unq. II",
"KOF 94",
"KOF 95",
"KOF 95 Plus",
"KOF 96",
"KOF 96 Plus",
"KOF 97",
"KOF 97 Plus",
"KOF 97 Plus",
"KOF 98",
"KOF 98 The Slugg",
"KOF 99",
"KOF 99 Remix Pro",
"The Last Blade",
"The Last Blade 2",
"The Last Blade 2",
"Top Hunter",
"Trash Rally",
"Twinkle Star Spr",
"Viewpoint",
"Waku Waku 7",
"World Heroes 2",
"World Heroes 2 J",
"World Heroes Per",
"World Soccer 96",
"Zed Blade",
"Zupapa!"
};
const rom GameID[]=
{
45, 99, 100, 135, 97, 49, 50, 121, 120, 95, 130, 108, 46, 35, 128, 98,
6, 28, 133, 47, 19, 71, 38, 70, 13, 31, 134, 110, 117, 37, 48, 9,
68, 96, 137, 105, 106, 59, 60, 78, 62, 80, 63, 81, 64, 82, 65, 83,
77, 109, 131, 129, 84, 126, 127, 119, 115, 86, 132, 90, 39, 125, 107, 123,
94, 102, 103, 79, 104, 136, 34, 18, 32, 73, 40, 51, 41, 52, 42, 53,
16, 87, 88, 89, 75, 66, 67, 58, 69, 74, 12, 118, 61, 93, 122, 111,
112, 113, 114, 17, 30, 57, 4, 26, 5, 0, 27, 10, 29, 7, 11, 8,
20, 21, 54, 22, 55, 1, 23, 56, 2, 24, 3, 25, 14, 15, 33, 76,
124, 91, 92, 36, 43, 72, 44, 116, 101, 85,
};
#pragma interrupt intHandlerL
void intHandlerL()
{
}
// ------------------------------------------------------------------------------------------
// CODE START -------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
char str[64];
extern const rom unsigned char logo0, logo1;
void formGameSelect(void)
{
REFRESH:
ClrWdt();
sprintf(str,"Game No:%d",game+1);
c5x8_Clear();
c5x8_GotoXY(0,0);
c5x8_PutStringRam(str);
c5x8_GotoXY(0,1);
c5x8_PutString(Games[game]);
oledUpdateDisplay();
Delay10KTCYx(100);
LOOP:
if (enc_flag)
{
enc_flag=0;
goto REFRESH;
}
if (BTN_OK==0)
{
NEO_RESET=1;
PORTB=GameID[game];
Delay10KTCYx(250);
NEO_RESET=0;
goto REFRESH;
}
ClrWdt();
Delay10KTCYx(100);
goto LOOP;
}
void main(void)
{
unsigned char i,a;
TRISA=DEF_TRISA;
TRISB=DEF_TRISB;
TRISC=DEF_TRISC;
ANSELA=0;
ANSELB=0;
ANSELC=0;
// OSC/PLL
OSCCONbits.IRCF2=1;
OSCCONbits.IRCF1=1;
OSCCONbits.IRCF0=1;
OSCTUNEbits.PLLEN=1;
// TMR3 SETUP
T3CONbits.TMR3CS0=0; // Internal clock ...
T3CONbits.TMR3CS1=0; // Internal clock ...
T3CONbits.T3CKPS1=1; // 1:4 Prescale ... 64MHz = 16MIPS = 4.096 * 4 = 16.384 ms
T3CONbits.T3CKPS0=0;
T3CONbits.TMR3ON=1; // Enable Timer ...
PIE2bits.TMR3IE=1; // Enable Interrupt ...
INTCONbits.GIE=1;
INTCONbits.PEIE=1;
NEO_RESET=1;
PORTB=GameID[0];
Delay10KTCYx(50);
oledInit();
c5x8_Clear();
glcdLogo(&logo0);
glcdLogo(&logo1);
sprintf(str,"v1.1");
c5x8_GotoXY(12,1);
c5x8_PutStringRam(str);
oledUpdateDisplay();
for (i=0;i<8;i++)
{
ClrWdt();
Delay10KTCYx(250);
}
c5x8_Clear();
sprintf(str," SERI # ");
c5x8_GotoXY(0,0);
c5x8_PutStringRam(str);
oledUpdateDisplay();
NEO_RESET=0;
formGameSelect();
}