Author Topic: Bomb Jack 2 players help.  (Read 4302 times)

Offline KingHanco

  • Sr. Member
  • ****
  • Posts: 401
  • Karma: +0/-4
  • "Special " Member
Bomb Jack 2 players help.
« on: December 27, 2004, 12:57:18 PM »
I trying to setup the player 2 buttons settings. So far I can't get the 2 player 2 buttons to work. Let me know on what I'm doing wrong here. :)

Code: [Select]

#include "burnint.h"
#include "driver.h"
extern "C" {
 #include "ay8910.h"
}
unsigned char DrvJoy1[8] = {0, 0, 0, 0, 0, 0, 0, 0};
unsigned char DrvJoy2[8] = {0, 0, 0, 0, 0, 0, 0, 0};
static unsigned char DrvReset = 0;
static int latch;

static int nCyclesDone[2], nCyclesTotal[2];
static int nCyclesSegment;

static unsigned char *Mem    = NULL;
static unsigned char *MemEnd = NULL;
static unsigned char *RamStart= NULL;
static unsigned char *RamEnd = NULL;
static unsigned char *BjGfx =NULL;
static unsigned char *BjMap =NULL;
static unsigned char *BjRom =NULL;
static unsigned char *BjRam =NULL;
static unsigned char *BjColRam =NULL;
static unsigned char *BjVidRam =NULL;
static unsigned char *BjSprRam =NULL;
// sound cpu
static unsigned char *SndRom =NULL;
static unsigned char *SndRam =NULL;

//graphics tiles
static unsigned char *text=NULL;
static unsigned char *sprites=NULL;
static unsigned char *tiles=NULL;
//pallete
static unsigned char *BjPalSrc=NULL;
static unsigned int *BjPalReal=NULL;

static unsigned char* pTileData;


static short* pFMBuffer;
static short* pAY8910Buffer[9];
// Dip Switch and Input Definitions
static struct BurnInputInfo DrvInputList[] = {
{"P1 Coin", 0, DrvJoy1 + 0, "p1 coin"},
{"P1 Start", 0, DrvJoy1 + 1, "p1 start"},

{"P2 Coin", 0, DrvJoy2 + 0, "p2 coin"},
{"P2 Start", 0, DrvJoy2 + 1, "p2 start"},


{"P1 Up", 0, DrvJoy1 + 2, "p1 up"},
{"P1 Down", 0, DrvJoy1 + 3, "p1 down"},
{"P1 Left", 0, DrvJoy1 + 4, "p1 left"},
{"P1 Right", 0, DrvJoy1 + 5, "p1 right"},
{"P1 Button 1", 0, DrvJoy1 + 6, "p1 fire 1"},

{"P2 Up", 0, DrvJoy2 + 2, "p2 up"},
{"P2 Down", 0, DrvJoy2 + 3, "p2 down"},
{"P2 Left", 0, DrvJoy2 + 4, "p2 left"},
{"P2 Right", 0, DrvJoy1 + 5, "p2 right"},
{"P2 Button 1", 0, DrvJoy1 + 6, "p2 fire 1"},


{"Reset", 0, &DrvReset, "reset"},
/* {"Diagnostic", 0, DrvButton + 2, "diag"},
{"Dip A", 2, DrvInput + 3, "dip"},
{"Dip B", 2, DrvInput + 4, "dip"},
{"Dip C", 2, DrvInput + 5, "dip"},
*/};

unsigned char __fastcall BjMemRead(unsigned short addr)
{
unsigned char inputs=0;

if (addr==0xb000) {
  if (DrvJoy1[5])
  inputs|=0x01;
  if (DrvJoy1[4])
  inputs|=0x02;
  if (DrvJoy1[2])
  inputs|=0x04;
  if (DrvJoy1[3])
  inputs|=0x08;
  if (DrvJoy1[6])
  inputs|=0x10;
  return inputs;
  }
  if (addr==0xb002) {
         if (DrvJoy1[0])
  inputs|=0x01;
         if (DrvJoy1[1])
  inputs|=0x04;
  return inputs;
  }
return 0;

if (addr==0xb000) {
  if (DrvJoy2[5])
  inputs|=0x01;
  if (DrvJoy2[4])
  inputs|=0x02;
  if (DrvJoy2[2])
  inputs|=0x04;
  if (DrvJoy2[3])
  inputs|=0x08;
  if (DrvJoy2[6])
  inputs|=0x10;
  return inputs;
  }
  if (addr==0xb002) {
         if (DrvJoy2[0])
  inputs|=0x01;
         if (DrvJoy2[1])
  inputs|=0x04;
  return inputs;
  }
return 0;
}

static void __fastcall BjMemWrite(unsigned short addr,unsigned char val)
{
if(addr==0xb800)
{
latch=val;
return;
}
BjRam[addr]=val;
}

unsigned char __fastcall SndMemRead(unsigned short a)
{
if(a==0x6000)
{
int res;
res = latch;
latch = 0;
return res;
}
return 0;
}



static void __fastcall SndPortWrite(unsigned short a, unsigned char d)
{
a &= 0xff;
switch (a) {
case 0x00: {
AY8910Write(0, 0, d);
return;
}
case 0x01: {
AY8910Write(0, 1, d);
return;
}
case 0x10: {
AY8910Write(1, 0, d);
return;
}
case 0x11: {
AY8910Write(1, 1, d);
return;
}
case 0x80: {
AY8910Write(2, 0, d);
return;
}
case 0x81: {
AY8910Write(2, 1, d);
return;
}
}
}


=========================================================

Hmmm...

I made it even bad. I have the player 1 as the player 2 now. :(