mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
add big endian platform support
This commit is contained in:
parent
b053cb2044
commit
57c5a5e505
21 changed files with 224 additions and 178 deletions
|
@ -21,36 +21,38 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <pico/pico_port.h>
|
||||
|
||||
/******************************/
|
||||
/* Compiler dependant defines */
|
||||
/******************************/
|
||||
|
||||
#ifndef UINT8
|
||||
#define UINT8 unsigned char
|
||||
#define UINT8 u8
|
||||
#endif
|
||||
|
||||
#ifndef INT8
|
||||
#define INT8 signed char
|
||||
#define INT8 s8
|
||||
#endif
|
||||
|
||||
#ifndef UINT16
|
||||
#define UINT16 unsigned short
|
||||
#define UINT16 u16
|
||||
#endif
|
||||
|
||||
#ifndef INT16
|
||||
#define INT16 signed short
|
||||
#define INT16 s16
|
||||
#endif
|
||||
|
||||
#ifndef UINT32
|
||||
#define UINT32 unsigned int
|
||||
#define UINT32 u32
|
||||
#endif
|
||||
|
||||
#ifndef INT32
|
||||
#define INT32 signed int
|
||||
#define INT32 s32
|
||||
#endif
|
||||
|
||||
#ifndef FPTR
|
||||
#define FPTR uintptr_t
|
||||
#define FPTR uptr
|
||||
#endif
|
||||
|
||||
/*************************************/
|
||||
|
@ -62,16 +64,16 @@ extern "C" {
|
|||
#define CZ80_FETCH_SFT (16 - CZ80_FETCH_BITS)
|
||||
#define CZ80_FETCH_BANK (1 << CZ80_FETCH_BITS)
|
||||
|
||||
#define PICODRIVE_HACKS 1
|
||||
#define CZ80_LITTLE_ENDIAN 1
|
||||
#define PICODRIVE_HACKS 1
|
||||
#define CZ80_LITTLE_ENDIAN CPU_IS_LE
|
||||
#define CZ80_USE_JUMPTABLE 1
|
||||
#define CZ80_BIG_FLAGS_ARRAY 1
|
||||
#define CZ80_BIG_FLAGS_ARRAY 1
|
||||
//#ifdef BUILD_CPS1PSP
|
||||
//#define CZ80_ENCRYPTED_ROM 1
|
||||
//#else
|
||||
#define CZ80_ENCRYPTED_ROM 0
|
||||
//#endif
|
||||
#define CZ80_EMULATE_R_EXACTLY 1
|
||||
#define CZ80_EMULATE_R_EXACTLY 1
|
||||
|
||||
#define zR8(A) (*CPU->pzR8[A])
|
||||
#define zR16(A) (CPU->pzR16[A]->W)
|
||||
|
|
|
@ -48,11 +48,7 @@
|
|||
#define READ_OP() GET_OP(); PC++
|
||||
|
||||
#define READ_ARG() (*(UINT8 *)PC++)
|
||||
#if CZ80_LITTLE_ENDIAN
|
||||
#define READ_ARG16() (*(UINT8 *)PC | (*(UINT8 *)(PC + 1) << 8)); PC += 2
|
||||
#else
|
||||
#define READ_ARG16() (*(UINT8 *)(PC + 1) | (*(UINT8 *)PC << 8)); PC += 2
|
||||
#endif
|
||||
|
||||
//#ifndef BUILD_CPS1PSP
|
||||
//#define READ_MEM8(A) memory_region_cpu2[(A)]
|
||||
|
@ -63,11 +59,7 @@
|
|||
#define READ_MEM8(A) CPU->Read_Byte(A)
|
||||
#endif
|
||||
//#endif
|
||||
#if CZ80_LITTLE_ENDIAN
|
||||
#define READ_MEM16(A) (READ_MEM8(A) | (READ_MEM8((A) + 1) << 8))
|
||||
#else
|
||||
#define READ_MEM16(A) ((READ_MEM8(A) << 8) | READ_MEM8((A) + 1))
|
||||
#endif
|
||||
|
||||
#if PICODRIVE_HACKS
|
||||
#define WRITE_MEM8(A, D) { \
|
||||
|
@ -82,11 +74,7 @@
|
|||
#else
|
||||
#define WRITE_MEM8(A, D) CPU->Write_Byte(A, D);
|
||||
#endif
|
||||
#if CZ80_LITTLE_ENDIAN
|
||||
#define WRITE_MEM16(A, D) { WRITE_MEM8(A, D); WRITE_MEM8((A) + 1, (D) >> 8); }
|
||||
#else
|
||||
#define WRITE_MEM16(A, D) { WRITE_MEM8((A) + 1, D); WRITE_MEM8(A, (D) >> 8); }
|
||||
#endif
|
||||
|
||||
#define PUSH_16(A) { UINT32 sp; zSP -= 2; sp = zSP; WRITE_MEM16(sp, A); }
|
||||
#define POP_16(A) { UINT32 sp; sp = zSP; A = READ_MEM16(sp); zSP = sp + 2; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue