Skip to content

Commit

Permalink
Revert "More buildfixes - use retro_inline.h from libretro-common"
Browse files Browse the repository at this point in the history
This reverts commit 3a67e07.
  • Loading branch information
inactive123 committed Nov 6, 2021
1 parent efa764c commit b4adc0e
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ else ifeq ($(platform), libnx)
CFLAGS += -O3 -fomit-frame-pointer -ffast-math -I$(DEVKITPRO)/libnx/include/ -fPIE -Wl,--allow-multiple-definition
CFLAGS += -specs=$(DEVKITPRO)/libnx/switch.specs
CFLAGS += -D__SWITCH__ -DHAVE_LIBNX
CFLAGS += -DARM -D__aarch64__=1 -march=armv8-a -mtune=cortex-a57 -mtp=soft -ffast-math -mcpu=cortex-a57+crc+fp+simd -ffunction-sections
CFLAGS += -DARM -D__aarch64__=1 -march=armv8-a -mtune=cortex-a57 -mtp=soft -DINLINE=inline -ffast-math -mcpu=cortex-a57+crc+fp+simd -ffunction-sections
CFLAGS += -Ifrontend/switch -ftree-vectorize
STATIC_LINKING=1

Expand Down
6 changes: 6 additions & 0 deletions Z80/Codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,4 +376,10 @@ case DAA:
break;

default:
if(R->TrapBadOps)
printf
(
"[Z80 %lX] Unrecognized instruction: %02X at PC=%04X\n",
(long)R->User,OpZ80(R->PC.W-1),R->PC.W-1
);
break;
67 changes: 53 additions & 14 deletions Z80/Z80.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@

#include "Z80.h"
#include "Tables.h"
#include <retro_inline.h>
#include <stdio.h>

/** INLINE ***************************************************/
/** C99 standard has "inline", but older compilers used **/
/** __inline for the same purpose. **/
/*************************************************************/
#ifdef __C99__
#define INLINE static inline
#else
#define INLINE static __inline
#endif

/** System-Dependent Stuff ***********************************/
/** This is system-dependent code put here to speed things **/
Expand All @@ -24,37 +34,37 @@
#ifdef COLEM
#define FAST_RDOP
extern byte *ROMPage[];
static INLINE byte OpZ80(word A) { return(ROMPage[A>>13][A&0x1FFF]); }
INLINE byte OpZ80(word A) { return(ROMPage[A>>13][A&0x1FFF]); }
#endif

#ifdef SPECCY
#define RdZ80 RDZ80
// @@@ WrZ80() can't be inlined as it contains debugging stuff
//#define WrZ80 WRZ80
extern byte *Page[],*ROM;
static INLINE byte RdZ80(word A) { return(Page[A>>13][A&0x1FFF]); }
//static INLINE void WrZ80(word A,byte V) { if(Page[A>>13]<ROM) Page[A>>13][A&0x1FFF]=V; }
INLINE byte RdZ80(word A) { return(Page[A>>13][A&0x1FFF]); }
//INLINE void WrZ80(word A,byte V) { if(Page[A>>13]<ROM) Page[A>>13][A&0x1FFF]=V; }
#endif

#ifdef MG
#define RdZ80 RDZ80
extern byte *Page[];
static INLINE byte RdZ80(word A) { return(Page[A>>13][A&0x1FFF]); }
INLINE byte RdZ80(word A) { return(Page[A>>13][A&0x1FFF]); }
#endif

#ifdef FMSX
#define FAST_RDOP
extern byte *RAM[];
static INLINE byte OpZ80(word A) { return(RAM[A>>13][A&0x1FFF]); }
INLINE byte OpZ80(word A) { return(RAM[A>>13][A&0x1FFF]); }
#endif

#ifdef ATI85
#define RdZ80 RDZ80
#define WrZ80 WRZ80
extern byte *Page[],*ROM;
extern void (*DoMEM)(word Addr,byte V);
static INLINE byte RdZ80(word A) { return(Page[A>>14][A&0x3FFF]); }
static INLINE void WrZ80(word A,byte V) { if(Page[A>>14]<ROM) Page[A>>14][A&0x3FFF]=V; else DoMEM(A,V); }
INLINE byte RdZ80(word A) { return(Page[A>>14][A&0x3FFF]); }
INLINE void WrZ80(word A,byte V) { if(Page[A>>14]<ROM) Page[A>>14][A&0x3FFF]=V; else DoMEM(A,V); }
#endif

/** FAST_RDOP ************************************************/
Expand Down Expand Up @@ -343,7 +353,12 @@ static void CodesCB(Z80 *R)
{
#include "CodesCB.h"
default:
break;
if(R->TrapBadOps)
printf
(
"[Z80 %lX] Unrecognized instruction: CB %02X at PC=%04X\n",
(long)(R->User),OpZ80(R->PC.W-1),R->PC.W-2
);
}
}

Expand All @@ -362,7 +377,12 @@ static void CodesDDCB(Z80 *R)
{
#include "CodesXCB.h"
default:
break;
if(R->TrapBadOps)
printf
(
"[Z80 %lX] Unrecognized instruction: DD CB %02X %02X at PC=%04X\n",
(long)(R->User),OpZ80(R->PC.W-2),OpZ80(R->PC.W-1),R->PC.W-4
);
}
#undef XX
}
Expand All @@ -382,7 +402,12 @@ static void CodesFDCB(Z80 *R)
{
#include "CodesXCB.h"
default:
break;
if(R->TrapBadOps)
printf
(
"[Z80 %lX] Unrecognized instruction: FD CB %02X %02X at PC=%04X\n",
(long)R->User,OpZ80(R->PC.W-2),OpZ80(R->PC.W-1),R->PC.W-4
);
}
#undef XX
}
Expand All @@ -405,7 +430,12 @@ static void CodesED(Z80 *R)
case PFX_ED:
R->PC.W--;break;
default:
break;
if(R->TrapBadOps)
printf
(
"[Z80 %lX] Unrecognized instruction: ED %02X at PC=%04X\n",
(long)R->User,OpZ80(R->PC.W-1),R->PC.W-2
);
}
}

Expand All @@ -431,7 +461,12 @@ static void CodesDD(Z80 *R)
case PFX_CB:
CodesDDCB(R);break;
default:
break;
if(R->TrapBadOps)
printf
(
"[Z80 %lX] Unrecognized instruction: DD %02X at PC=%04X\n",
(long)R->User,OpZ80(R->PC.W-1),R->PC.W-2
);
}
#undef XX
}
Expand All @@ -458,7 +493,11 @@ static void CodesFD(Z80 *R)
case PFX_CB:
CodesFDCB(R);break;
default:
break;
printf
(
"Unrecognized instruction: FD %02X at PC=%04X\n",
OpZ80(R->PC.W-1),R->PC.W-2
);
}
#undef XX
}
Expand Down
4 changes: 1 addition & 3 deletions fMSX/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
/** changes to this file. **/
/*************************************************************/

#include <retro_inline.h>

static int FirstLine = 18; /* First scanline in the XBuf */

static void Sprites(byte Y,pixel *Line);
Expand Down Expand Up @@ -44,7 +42,7 @@ static void ClearLine(pixel *P,pixel C)
/** Given a color in YJK format, return the corresponding **/
/** palette entry. **/
/*************************************************************/
static INLINE pixel YJKColor(int Y,int J,int K)
INLINE pixel YJKColor(int Y,int J,int K)
{
int R,G,B;

Expand Down
11 changes: 10 additions & 1 deletion fMSX/MSX.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@
#include "WD1793.h" /* WD1793 FDC emulation */

#include <stdint.h>
#include <retro_inline.h>

/** INLINE ***************************************************/
/** C99 standard has "inline", but older compilers've used **/
/** __inline for the same purpose. **/
/*************************************************************/
#ifdef __C99__
#define INLINE static inline
#else
#define INLINE static __inline
#endif

#ifdef __cplusplus
extern "C" {
Expand Down
24 changes: 12 additions & 12 deletions fMSX/V9938.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static int lmmm_timing[8]={ 1160, 1599, 1160, 1172,
/** VDPVRMP() **********************************************/
/** Calculate addr of a pixel in vram **/
/*************************************************************/
static INLINE byte *VDPVRMP(byte M,int X,int Y)
INLINE byte *VDPVRMP(byte M,int X,int Y)
{
switch(M)
{
Expand All @@ -204,7 +204,7 @@ static INLINE byte *VDPVRMP(byte M,int X,int Y)
/** VDPpoint5() ***********************************************/
/** Get a pixel on screen 5 **/
/*************************************************************/
static INLINE byte VDPpoint5(int SX, int SY)
INLINE byte VDPpoint5(int SX, int SY)
{
return (*VDP_VRMP5(SX, SY) >>
(((~SX)&1)<<2)
Expand All @@ -214,7 +214,7 @@ static INLINE byte VDPpoint5(int SX, int SY)
/** VDPpoint6() ***********************************************/
/** Get a pixel on screen 6 **/
/*************************************************************/
static INLINE byte VDPpoint6(int SX, int SY)
INLINE byte VDPpoint6(int SX, int SY)
{
return (*VDP_VRMP6(SX, SY) >>
(((~SX)&3)<<1)
Expand All @@ -224,7 +224,7 @@ static INLINE byte VDPpoint6(int SX, int SY)
/** VDPpoint7() ***********************************************/
/** Get a pixel on screen 7 **/
/*************************************************************/
static INLINE byte VDPpoint7(int SX, int SY)
INLINE byte VDPpoint7(int SX, int SY)
{
return (*VDP_VRMP7(SX, SY) >>
(((~SX)&1)<<2)
Expand All @@ -234,15 +234,15 @@ static INLINE byte VDPpoint7(int SX, int SY)
/** VDPpoint8() ***********************************************/
/** Get a pixel on screen 8 **/
/*************************************************************/
static INLINE byte VDPpoint8(int SX, int SY)
INLINE byte VDPpoint8(int SX, int SY)
{
return *VDP_VRMP8(SX, SY);
}

/** VDPpoint() ************************************************/
/** Get a pixel on a screen **/
/*************************************************************/
static INLINE byte VDPpoint(byte SM, int SX, int SY)
INLINE byte VDPpoint(byte SM, int SX, int SY)
{
switch(SM)
{
Expand All @@ -259,7 +259,7 @@ static INLINE byte VDPpoint(byte SM, int SX, int SY)
/** Low level function to set a pixel on a screen **/
/** Make it inline to make it fast **/
/*************************************************************/
static INLINE void VDPpsetlowlevel(byte *P, byte CL, byte M, byte OP)
INLINE void VDPpsetlowlevel(byte *P, byte CL, byte M, byte OP)
{
switch (OP)
{
Expand All @@ -279,7 +279,7 @@ static INLINE void VDPpsetlowlevel(byte *P, byte CL, byte M, byte OP)
/** VDPpset5() ***********************************************/
/** Set a pixel on screen 5 **/
/*************************************************************/
static INLINE void VDPpset5(int DX, int DY, byte CL, byte OP)
INLINE void VDPpset5(int DX, int DY, byte CL, byte OP)
{
byte SH = ((~DX)&1)<<2;

Expand All @@ -290,7 +290,7 @@ static INLINE void VDPpset5(int DX, int DY, byte CL, byte OP)
/** VDPpset6() ***********************************************/
/** Set a pixel on screen 6 **/
/*************************************************************/
static INLINE void VDPpset6(int DX, int DY, byte CL, byte OP)
INLINE void VDPpset6(int DX, int DY, byte CL, byte OP)
{
byte SH = ((~DX)&3)<<1;

Expand All @@ -301,7 +301,7 @@ static INLINE void VDPpset6(int DX, int DY, byte CL, byte OP)
/** VDPpset7() ***********************************************/
/** Set a pixel on screen 7 **/
/*************************************************************/
static INLINE void VDPpset7(int DX, int DY, byte CL, byte OP)
INLINE void VDPpset7(int DX, int DY, byte CL, byte OP)
{
byte SH = ((~DX)&1)<<2;

Expand All @@ -312,7 +312,7 @@ static INLINE void VDPpset7(int DX, int DY, byte CL, byte OP)
/** VDPpset8() ***********************************************/
/** Set a pixel on screen 8 **/
/*************************************************************/
static INLINE void VDPpset8(int DX, int DY, byte CL, byte OP)
INLINE void VDPpset8(int DX, int DY, byte CL, byte OP)
{
VDPpsetlowlevel(VDP_VRMP8(DX, DY),
CL, 0, OP);
Expand All @@ -321,7 +321,7 @@ static INLINE void VDPpset8(int DX, int DY, byte CL, byte OP)
/** VDPpset() ************************************************/
/** Set a pixel on a screen **/
/*************************************************************/
static INLINE void VDPpset(byte SM, int DX, int DY, byte CL, byte OP)
INLINE void VDPpset(byte SM, int DX, int DY, byte CL, byte OP)
{
switch (SM) {
case 0: VDPpset5(DX, DY, CL, OP); break;
Expand Down
1 change: 0 additions & 1 deletion libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <string.h>
#include <stdint.h>

#include <compat/posix_string.h>
#include <streams/file_stream.h>

#include "MSX.h"
Expand Down

0 comments on commit b4adc0e

Please sign in to comment.