summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Keil <jkeil@users.sourceforge.net>2003-01-09 19:50:03 +0000
committerJuergen Keil <jkeil@users.sourceforge.net>2003-01-09 19:50:03 +0000
commit54c717651cff3ee62d2480138787421867daf29f (patch)
tree3316905bd5f3f23bf67d4c1928b88398297c8a17
parent2f629cd14dfee9c000b100c41530e8831907677b (diff)
downloadxine-lib-54c717651cff3ee62d2480138787421867daf29f.tar.gz
xine-lib-54c717651cff3ee62d2480138787421867daf29f.tar.bz2
NSF audio files were crashing on SPARC.
- Define the correct HOST_ENDIAN for SPARC - remove unaligned memory accesses CVS patchset: 3849 CVS date: 2003/01/09 19:50:03
-rw-r--r--src/libxineadec/nosefart/nes6502.c38
-rw-r--r--src/libxineadec/nosefart/nes_apu.h10
-rw-r--r--src/libxineadec/nosefart/types.h14
3 files changed, 32 insertions, 30 deletions
diff --git a/src/libxineadec/nosefart/nes6502.c b/src/libxineadec/nosefart/nes6502.c
index c790865ab..f1ca80af4 100644
--- a/src/libxineadec/nosefart/nes6502.c
+++ b/src/libxineadec/nosefart/nes6502.c
@@ -20,7 +20,7 @@
** nes6502.c
**
** NES custom 6502 (2A03) CPU implementation
-** $Id: nes6502.c,v 1.1 2003/01/08 07:04:35 tmmm Exp $
+** $Id: nes6502.c,v 1.2 2003/01/09 19:50:03 jkeil Exp $
*/
@@ -1189,34 +1189,14 @@ INLINE void bank_writebyte(register uint32 address, register uint8 value)
INLINE uint32 zp_address(register uint8 address)
{
-#ifdef HOST_LITTLE_ENDIAN
- /* TODO: this fails if src address is $xFFF */
- /* TODO: this fails if host architecture doesn't support byte alignment */
- return (uint32) (*(uint16 *)(ram + address));
-#else
-#ifdef TARGET_CPU_PPC
- return __lhbrx(ram, address);
-#else
- uint32 x = (uint32) *(uint16 *)(ram + address);
- return (x << 8) | (x >> 8);
-#endif /* TARGET_CPU_PPC */
-#endif /* HOST_LITTLE_ENDIAN */
+ uint8 *x = ram + address;
+ return (x[1] << 8) | x[0];
}
INLINE uint32 bank_readaddress(register uint32 address)
{
-#ifdef HOST_LITTLE_ENDIAN
- /* TODO: this fails if src address is $xFFF */
- /* TODO: this fails if host architecture doesn't support byte alignment */
- return (uint32) (*(uint16 *)(nes6502_banks[address >> NES6502_BANKSHIFT] + (address & NES6502_BANKMASK)));
-#else
-#ifdef TARGET_CPU_PPC
- return __lhbrx(nes6502_banks[address >> NES6502_BANKSHIFT], address & NES6502_BANKMASK);
-#else
- uint32 x = (uint32) *(uint16 *)(nes6502_banks[address >> NES6502_BANKSHIFT] + (address & NES6502_BANKMASK));
- return (x << 8) | (x >> 8);
-#endif /* TARGET_CPU_PPC */
-#endif /* HOST_LITTLE_ENDIAN */
+ uint8 *x = nes6502_banks[address >> NES6502_BANKSHIFT] + (address & NES6502_BANKMASK);
+ return (x[1] << 8) | x[0];
}
/* read a byte of 6502 memory */
@@ -2385,6 +2365,12 @@ void nes6502_setdma(int cycles)
/*
** $Log: nes6502.c,v $
+** Revision 1.2 2003/01/09 19:50:03 jkeil
+** NSF audio files were crashing on SPARC.
+**
+** - Define the correct HOST_ENDIAN for SPARC
+** - remove unaligned memory accesses
+**
** Revision 1.1 2003/01/08 07:04:35 tmmm
** initial import of Nosefart sources
**
@@ -2397,4 +2383,4 @@ void nes6502_setdma(int cycles)
** Revision 1.4 2000/06/09 15:12:25 matt
** initial revision
**
-*/ \ No newline at end of file
+*/
diff --git a/src/libxineadec/nosefart/nes_apu.h b/src/libxineadec/nosefart/nes_apu.h
index ee7efec88..09b5842d9 100644
--- a/src/libxineadec/nosefart/nes_apu.h
+++ b/src/libxineadec/nosefart/nes_apu.h
@@ -20,7 +20,7 @@
** nes_apu.h
**
** NES APU emulation header file
-** $Id: nes_apu.h,v 1.1 2003/01/08 07:04:35 tmmm Exp $
+** $Id: nes_apu.h,v 1.2 2003/01/09 19:50:03 jkeil Exp $
*/
#ifndef _NES_APU_H_
@@ -295,6 +295,12 @@ extern void apu_getpcmdata(void **data, int *num_samples, int *sample_bits);
/*
** $Log: nes_apu.h,v $
+** Revision 1.2 2003/01/09 19:50:03 jkeil
+** NSF audio files were crashing on SPARC.
+**
+** - Define the correct HOST_ENDIAN for SPARC
+** - remove unaligned memory accesses
+**
** Revision 1.1 2003/01/08 07:04:35 tmmm
** initial import of Nosefart sources
**
@@ -322,4 +328,4 @@ extern void apu_getpcmdata(void **data, int *num_samples, int *sample_bits);
** Revision 1.5 2000/06/09 15:12:28 matt
** initial revision
**
-*/ \ No newline at end of file
+*/
diff --git a/src/libxineadec/nosefart/types.h b/src/libxineadec/nosefart/types.h
index 4991f2387..4d78dbabc 100644
--- a/src/libxineadec/nosefart/types.h
+++ b/src/libxineadec/nosefart/types.h
@@ -20,14 +20,18 @@
** types.h
**
** Data type definitions
-** $Id: types.h,v 1.1 2003/01/08 07:04:36 tmmm Exp $
+** $Id: types.h,v 1.2 2003/01/09 19:50:04 jkeil Exp $
*/
#ifndef _TYPES_H_
#define _TYPES_H_
/* Define this if running on little-endian (x86) systems */
+#if defined(sparc)
+#undef HOST_LITTLE_ENDIAN
+#else
#define HOST_LITTLE_ENDIAN
+#endif
#ifdef __GNUC__
#define INLINE static inline
@@ -84,6 +88,12 @@ typedef uint8 boolean;
/*
** $Log: types.h,v $
+** Revision 1.2 2003/01/09 19:50:04 jkeil
+** NSF audio files were crashing on SPARC.
+**
+** - Define the correct HOST_ENDIAN for SPARC
+** - remove unaligned memory accesses
+**
** Revision 1.1 2003/01/08 07:04:36 tmmm
** initial import of Nosefart sources
**
@@ -93,4 +103,4 @@ typedef uint8 boolean;
** Revision 1.6 2000/06/09 15:12:25 matt
** initial revision
**
-*/ \ No newline at end of file
+*/