lantus' BigEndian patch for Toaplan V25 sound

This commit is contained in:
Barry Harris 2012-02-01 09:17:19 +00:00
parent 670f448f32
commit 3200c8c555
4 changed files with 22 additions and 4 deletions

View File

@ -96,5 +96,21 @@
((((n) >> (bit01)) & 1) << 1) | \
((((n) >> (bit00)) & 1) << 0))
#define BYTE_XOR_LE(a) ((a))
#define BIT(x,n) (((x)>>(n))&1)
/* ----- macros for accessing bytes and words within larger chunks ----- */
#ifdef LSB_FIRST
#define BYTE_XOR_BE(a) ((a) ^ 1) /* read/write a byte to a 16-bit space */
#define BYTE_XOR_LE(a) (a)
#define BYTE4_XOR_BE(a) ((a) ^ 3) /* read/write a byte to a 32-bit space */
#define BYTE4_XOR_LE(a) (a)
#define WORD_XOR_BE(a) ((a) ^ 2) /* read/write a word to a 32-bit space */
#define WORD_XOR_LE(a) (a)
#else
#define BYTE_XOR_BE(a) (a)
#define BYTE_XOR_LE(a) ((a) ^ 1) /* read/write a byte to a 16-bit space */
#define BYTE4_XOR_BE(a) (a)
#define BYTE4_XOR_LE(a) ((a) ^ 3) /* read/write a byte to a 32-bit space */
#define WORD_XOR_BE(a) (a)
#define WORD_XOR_LE(a) ((a) ^ 2) /* read/write a word to a 32-bit space */
#endif

View File

@ -108,6 +108,7 @@
#include "driver.h"
#include "state.h"
#include "vez.h"
#include "bitswap.h"
//#include "emu.h"
//#include "debugger.h"
@ -471,7 +472,7 @@ void necInit(int cpu, int type)
case V30_TYPE:
{
nec_state->fetch_xor = 0;//BYTE_XOR_LE(0);
nec_state->fetch_xor = BYTE_XOR_LE(0);
nec_state->chip_type=V30_TYPE;
nec_state->prefetch_size = 6; /* 3 words */
nec_state->prefetch_cycles = 2; /* two cycles per byte / four per word */

View File

@ -39,6 +39,7 @@
#include "driver.h"
#include "state.h"
#include "vez.h"
#include "bitswap.h"
unsigned char cpu_readmem20_op(unsigned int);
unsigned char cpu_readmem20_arg(unsigned int);

View File

@ -319,7 +319,7 @@ UINT8 v25_read_byte(v25_state_t *nec_state, unsigned a)
unsigned o = a & 0x1FF;
if(nec_state->RAMEN && o < 0x100)
return nec_state->ram.b[o]; //BYTE_XOR_LE(o)];
return nec_state->ram.b[BYTE_XOR_LE(o)];
if(o >= 0x100)
return read_sfr(nec_state, o-0x100);
@ -359,7 +359,7 @@ void v25_write_byte(v25_state_t *nec_state, unsigned a, UINT8 d)
if(nec_state->RAMEN && o < 0x100)
{
nec_state->ram.b[o] = d; //BYTE_XOR_LE(o)] = d;
nec_state->ram.b[BYTE_XOR_LE(o)] = d;
return;
}