Skip to content

Commit

Permalink
Rename X6502 X to cpu
Browse files Browse the repository at this point in the history
  • Loading branch information
LibretroAdmin committed Jan 24, 2024
1 parent 539af6b commit b918d42
Show file tree
Hide file tree
Showing 36 changed files with 95 additions and 98 deletions.
2 changes: 1 addition & 1 deletion src/cart.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void CartBW(uint32 A, uint8 V) {

uint8 CartBROB(uint32 A) {
if (!Page[A >> 11])
return(X.DB);
return(cpu.DB);
return Page[A >> 11][A];
}

Expand Down
2 changes: 1 addition & 1 deletion src/fceu.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static writefunc *BWriteG = NULL;
static int RWWrap = 0;

static void BNull(uint32 A, uint8 V) { }
static uint8 ANull(uint32 A) { return(X.DB); }
static uint8 ANull(uint32 A) { return(cpu.DB); }

int AllocGenieRW(void)
{
Expand Down
8 changes: 3 additions & 5 deletions src/fds.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ static uint8 FDSRead4030(uint32 A) {
uint8 ret = 0;

/* Cheap hack. */
if (X.IRQlow & FCEU_IQEXT) ret |= 1;
if (X.IRQlow & FCEU_IQEXT2) ret |= 2;
if (cpu.IRQlow & FCEU_IQEXT) ret |= 1;
if (cpu.IRQlow & FCEU_IQEXT2) ret |= 2;

X6502_IRQEnd(FCEU_IQEXT);
X6502_IRQEnd(FCEU_IQEXT2);
Expand Down Expand Up @@ -370,9 +370,7 @@ static uint8 FDSRead4031(uint32 A) {
}

static uint8 FDSRead4032(uint32 A) {
uint8 ret;

ret = X.DB & ~7;
uint8 ret = cpu.DB & ~7;
if (InDisk == 255)
ret |= 5;

Expand Down
2 changes: 1 addition & 1 deletion src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static uint8 JPRead(uint32 A)
if (FCExp->Read)
ret = FCExp->Read(A & 1, ret);

ret |= X.DB & 0xC0;
ret |= cpu.DB & 0xC0;

return(ret);
}
Expand Down
6 changes: 3 additions & 3 deletions src/mappers/hw/bandai.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ static void BandaiWrite(uint32 A, uint8 V) {

static uint8 BandaiRead(uint32 A) {
if (x24c02)
return (X.DB & 0xEF) | (x24c02_out << 4);
return (X.DB & 0xEF) | (x24c01_out << 4);
return (cpu.DB & 0xEF) | (x24c02_out << 4);
return (cpu.DB & 0xEF) | (x24c01_out << 4);
}

static void BandaiIRQHook(int a) {
Expand Down Expand Up @@ -607,7 +607,7 @@ static void BarcodeIRQHook(int a) {
}

static uint8 BarcodeRead(uint32 A) {
return (X.DB & 0xE7) | ((x24c02_out | x24c01_out) << 4) | BarcodeOut;
return (cpu.DB & 0xE7) | ((x24c02_out | x24c01_out) << 4) | BarcodeOut;
}

static void M157Power(void) {
Expand Down
4 changes: 2 additions & 2 deletions src/mappers/hw/jyasic.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ static void cpuCycle(int a)
uint8 readALU_DIP(uint32 A)
{
if ((A &0x3FF) ==0 && A !=0x5800) /* 5000, 5400, 5C00: read solder pad setting */
return dipSwitch | X.DB &0x3F;
return dipSwitch | cpu.DB &0x3F;

if (A &0x800)
switch (A &3)
Expand All @@ -266,7 +266,7 @@ uint8 readALU_DIP(uint32 A)
return test;
}
/* all others */
return X.DB;
return cpu.DB;
}

void writeALU(uint32 A, uint8 V)
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/hw/mmc1.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void MBWRAM(uint32 A, uint8 V) {

static uint8 MAWRAM(uint32 A) {
if (!MMC1WRAMEnabled() && !is155)
return X.DB; /* WRAM is disabled */
return cpu.DB; /* WRAM is disabled */
return(Page[A >> 11][A]);
}

Expand Down
6 changes: 3 additions & 3 deletions src/mappers/hw/mmc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ static void M45CW(uint32 A, uint8 V) {
}

static uint8 M45ReadOB(uint32 A) {
return X.DB;
return cpu.DB;
}

static void M45PW(uint32 A, uint8 V) {
Expand Down Expand Up @@ -515,8 +515,8 @@ static void M45Write(uint32 A, uint8 V) {
static uint8 M45Read(uint32 A) {
uint32 addr = 1 << (EXPREGS[5] + 4);
if (A & (addr | (addr - 1)))
return X.DB | 1;
return X.DB;
return cpu.DB | 1;
return cpu.DB;
}

static void M45Reset(void) {
Expand Down
18 changes: 9 additions & 9 deletions src/mappers/hw/txc.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ static void M36Write(uint32 A, uint8 V) {
}

static uint8 M36Read(uint32 A) {
uint8 ret = X.DB;
uint8 ret = cpu.DB;
if ((A & 0x103) == 0x100)
ret = (X.DB & 0xCF) | ((TXC_CMDRead() << 4) & 0x30);
ret = (cpu.DB & 0xCF) | ((TXC_CMDRead() << 4) & 0x30);
return ret;
}

Expand Down Expand Up @@ -209,9 +209,9 @@ static void M132Write(uint32 A, uint8 V) {
}

static uint8 M132Read(uint32 A) {
uint8 ret = X.DB;
uint8 ret = cpu.DB;
if ((A & 0x103) == 0x100)
ret = ((X.DB & 0xF0) | (TXC_CMDRead() & 0x0F));
ret = ((cpu.DB & 0xF0) | (TXC_CMDRead() & 0x0F));
return ret;
}

Expand Down Expand Up @@ -257,9 +257,9 @@ static void M136Write(uint32 A, uint8 V) {
}

static uint8 M136Read(uint32 A) {
uint8 ret = X.DB;
uint8 ret = cpu.DB;
if ((A & 0x103) == 0x100)
ret = ((X.DB & 0xC0) | (TXC_CMDRead() & 0x3F));
ret = ((cpu.DB & 0xC0) | (TXC_CMDRead() & 0x3F));
return ret;
}

Expand Down Expand Up @@ -287,7 +287,7 @@ static void M147Write(uint32 A, uint8 V) {
}

static uint8 M147Read(uint32 A) {
uint8 ret = X.DB;
uint8 ret = cpu.DB;
if ((A & 0x103) == 0x100) {
uint8 value = TXC_CMDRead();
ret = ((value << 2) & 0xFC) | ((value >> 6) & 0x03);
Expand Down Expand Up @@ -323,9 +323,9 @@ static uint8 GetValue(uint8 value) {
static void M172Write(uint32 A, uint8 V) { TXC_CMDWrite(A, GetValue(V)); }

static uint8 M172Read(uint32 A) {
uint8 ret = X.DB;
uint8 ret = cpu.DB;
if ((A & 0x103) == 0x100)
ret = (X.DB & 0xC0) | GetValue(TXC_CMDRead());
ret = (cpu.DB & 0xC0) | GetValue(TXC_CMDRead());
return ret;
}

Expand Down
4 changes: 2 additions & 2 deletions src/mappers/mapper005.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ static void Mapper5_write(uint32 A, uint8 V) {
static uint8 MMC5_ReadROMRAM(uint32 A) {
if (MMC5MemIn[(A - 0x6000) >> 13])
return Page[A >> 11][A];
return X.DB;
return cpu.DB;
}

static void MMC5_WriteROMRAM(uint32 A, uint8 V) {
Expand Down Expand Up @@ -377,7 +377,7 @@ static uint8 MMC5_read(uint32 A) {
case 0x5206:
return((mul[0] * mul[1]) >> 8);
}
return(X.DB);
return(cpu.DB);
}

void MMC5Synco(void) {
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper063.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static uint16 openBus;

static uint8 M63Read(uint32 A) {
if (openBus)
return X.DB;
return cpu.DB;
return CartBR(A);
}

Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper069.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static void M69WRAMWrite(uint32 A, uint8 V) {

static uint8 M69WRAMRead(uint32 A) {
if ((preg[3] & 0xC0) == 0x40)
return X.DB;
return cpu.DB;
return CartBR(A);
}

Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper083.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static void M83Write(uint32 A, uint8 V) {
}
}

static uint8 UNLYOKOReadDip(uint32 A) { return (X.DB & 0xFC) | dip; }
static uint8 UNLYOKOReadDip(uint32 A) { return (cpu.DB & 0xFC) | dip; }
static uint8 UNLYOKOReadLow(uint32 A) { return low[A & 3]; }
static void UNLYOKOWriteLow(uint32 A, uint8 V) { low[A & 3] = V; }

Expand Down
10 changes: 5 additions & 5 deletions src/mappers/mapper150.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ void SA0037_Init(CartInfo *info) {

static uint8 TCA01Read(uint32 A) {
if ((A & 0x4100) == 0x4100)
return (X.DB & 0xC0) | ((~A) & 0x3F);
return X.DB;
return (cpu.DB & 0xC0) | ((~A) & 0x3F);
return cpu.DB;
}

static void TCA01Power(void) {
Expand Down Expand Up @@ -270,10 +270,10 @@ static void S74LS374NSynco(void) {
static uint8 S74LS374NRead(uint32 A) {
if ((A & 0xC101) == 0x4101) {
if (dip & 1)
return (latch[cmd] & 3) | (X.DB & 0xFC);
return (latch[cmd] & 7) | (X.DB & 0xF8);
return (latch[cmd] & 3) | (cpu.DB & 0xFC);
return (latch[cmd] & 7) | (cpu.DB & 0xF8);
}
return X.DB;
return cpu.DB;
}

static void S74LS374NWrite(uint32 A, uint8 V) {
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper170.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static void Sync(void) {
}

static void M170ProtW(uint32 A, uint8 V) { reg = V << 1 & 0x80; }
static uint8 M170ProtR(uint32 A) { return reg | (X.DB & 0x7F); }
static uint8 M170ProtR(uint32 A) { return reg | (cpu.DB & 0x7F); }

static void M170Power(void) {
Sync();
Expand Down
4 changes: 2 additions & 2 deletions src/mappers/mapper178.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ static void M178WriteSnd(uint32 A, uint8 V) {

static uint8 M178ReadSnd(uint32 A) {
if (A == 0x5800)
return (X.DB & 0xBF) | ((pcm_enable ^ 1) << 6);
return X.DB;
return (cpu.DB & 0xBF) | ((pcm_enable ^ 1) << 6);
return cpu.DB;
}

static void M178Power(void) {
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper225.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static void M225LoWrite(uint32 A, uint8 V) {

static uint8 M225LoRead(uint32 A) {
if (A & 0x800) return extraRAM[A & 3];
return X.DB;
return cpu.DB;
}

static void M225Power(void) {
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper235.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void Sync(void) {
static uint8 M235Read(uint32 A) {
if (openbus) {
openbus = 0;
return X.DB;
return cpu.DB;
}
return CartBR(A);
}
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper257.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static void UNLPEC586Write(uint32 A, uint8 V) {
}

static uint8 UNLPEC586Read(uint32 A) {
return (X.DB & 0xD8) | br_tbl[reg[4] >> 4];
return (cpu.DB & 0xD8) | br_tbl[reg[4] >> 4];
}

static uint8 UNLPEC586ReadHi(uint32 A) {
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper268.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static void Mapper268_CHRWrap(uint32 A, uint8 V) {
}

static uint8 Mapper268_ReadWRAM(uint32 A) {
return A001B &0xA0? CartBR(A): X.DB;
return A001B &0xA0? CartBR(A): cpu.DB;
}

static void Mapper268_WriteWRAM(uint32 A, uint8 V) {
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper303.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void UNLKS7017Write(uint32 A, uint8 V) {

static uint8 FDSRead4030(uint32 A) {
X6502_IRQEnd(FCEU_IQEXT);
return X.IRQlow & FCEU_IQEXT ? 1 : 0;
return cpu.IRQlow & FCEU_IQEXT ? 1 : 0;
}

static void UNL7017IRQ(int a) {
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper332.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void Sync(void) {

static uint8 BMCWSRead(uint32 A) {
if ((creg >> 6) & (dipSwitch &3))
return X.DB;
return cpu.DB;
return CartBR(A);
}

Expand Down
4 changes: 2 additions & 2 deletions src/mappers/mapper334.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ static void M334Write(uint32 A, uint8 V) {

static uint8 M334Read(uint32 A) {
if (A & 2)
return ((X.DB & 0xFE) | (dipswitch & 1));
return X.DB;
return ((cpu.DB & 0xFE) | (dipswitch & 1));
return cpu.DB;
}

static void M334Reset(void) {
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper342.c
Original file line number Diff line number Diff line change
Expand Up @@ -1922,7 +1922,7 @@ static uint8 MAFRAM(uint32 A) {
if (map_rom_on_6000 && (A >= 0x6000) && (A < 0x8000))
return CartBR(A); /* PRG */

return X.DB; /* Open bus */
return cpu.DB; /* Open bus */
}

static void COOLGIRL_ScanlineCounter(void) {
Expand Down
4 changes: 2 additions & 2 deletions src/mappers/mapper372.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ static void M372Write(uint32 A, uint8 V) {
static uint8 M372Read(uint32 A) {
uint32 addr = 1 << (EXPREGS[5] + 4);
if (A & (addr | (addr - 1)))
return X.DB | 1;
return X.DB;
return cpu.DB | 1;
return cpu.DB;
}

static void M372Reset(void) {
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper401.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static void M401PW(uint32 A, uint8 V) {

static uint8 M401Read(uint32 A) {
if ((dipswitch & 1) && (EXPREGS[1] & 0x80))
return X.DB;
return cpu.DB;
return CartBR(A);
}

Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper460.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

static uint8 *CHRRAM =NULL;

static uint8 Mapper460_ReadOB(uint32 A) { return X.DB; }
static uint8 Mapper460_ReadOB(uint32 A) { return cpu.DB; }

static void Mapper460_PRGWrap(uint32 A, uint8 V) {
int prgAND =0x0F;
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/mapper466.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static SFORMAT StateRegs[] =
{ 0 }
};

static uint8 Mapper466_ReadOB(uint32 A) { return X.DB; }
static uint8 Mapper466_ReadOB(uint32 A) { return cpu.DB; }

static void Mapper466_Sync(void)
{
Expand Down
5 changes: 2 additions & 3 deletions src/mappers/mapper518.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ static void UNLD2000Write(uint32 A, uint8 V) {

static uint8 UNLD2000Read(uint32 A) {
if (prg & 0x40)
return X.DB;
else
return CartBR(A);
return cpu.DB;
return CartBR(A);
}

static void UNLD2000Power(void) {
Expand Down
Loading

0 comments on commit b918d42

Please sign in to comment.