Skip to content

Commit

Permalink
core, structural cleanup, fixes and improvements for type issues #2
Browse files Browse the repository at this point in the history
  • Loading branch information
irixxxx committed Jan 1, 2021
1 parent 5ab80df commit f821bb7
Show file tree
Hide file tree
Showing 64 changed files with 140 additions and 150 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$(LD) ?= $(CC)
TARGET ?= PicoDrive
DEBUG ?= 0
CFLAGS += -I.
CFLAGS += -I$(PWD)
CYCLONE_CC ?= gcc
CYCLONE_CXX ?= g++

Expand Down
2 changes: 1 addition & 1 deletion Makefile.libretro
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ else ifeq ($(platform), ps2)

ARCH = mipsel
asm_render = 1
OBJS += platform/ps2/asm.o
OBJS += platform/libretro/ps2/asm.o

# CTR (3DS)
else ifeq ($(platform), ctr)
Expand Down
2 changes: 1 addition & 1 deletion cpu/DrZ80/drz80.S
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

;@ For commercial use, separate licencing terms must be obtained.

#include "../../pico/arm_features.h"
#include <pico/arm_features.h>

.data
.align 4
Expand Down
2 changes: 1 addition & 1 deletion cpu/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define _GNU_SOURCE
#include <stdio.h>

#include "../pico/pico_int.h"
#include <pico/pico_int.h>
#include "debug.h"

static char pdb_pending_cmds[128];
Expand Down
3 changes: 3 additions & 0 deletions cpu/fame/famec.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#define FAMEC_EXTRA_INLINE INLINE
#endif

#include <pico/pico_types.h>
/*
#ifdef u8
#undef u8
#endif
Expand Down Expand Up @@ -95,6 +97,7 @@
#define u32 unsigned int
#define s32 signed int
#define uptr uintptr_t
*/

/*
typedef unsigned char u8;
Expand Down
4 changes: 2 additions & 2 deletions cpu/sh2/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#include <stdlib.h>
#include <assert.h>

#include "../../pico/pico_int.h"
#include "../../pico/arm_features.h"
#include <pico/pico_int.h>
#include <pico/arm_features.h>
#include "sh2.h"
#include "compiler.h"
#include "../drc/cmn.h"
Expand Down
12 changes: 6 additions & 6 deletions cpu/sh2/mame/sh2pico.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

// MAME types
#ifndef INT8
typedef signed char INT8;
typedef signed short INT16;
typedef signed int INT32;
typedef unsigned int UINT32;
typedef unsigned short UINT16;
typedef unsigned char UINT8;
typedef s8 INT8;
typedef s16 INT16;
typedef s32 INT32;
typedef u32 UINT32;
typedef u16 UINT16;
typedef u8 UINT8;
#endif

#ifdef DRC_SH2
Expand Down
4 changes: 2 additions & 2 deletions cpu/sh2/sh2.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef __SH2_H__
#define __SH2_H__

#include "../../pico/pico_types.h"
#include "../../pico/pico_port.h"
#include <pico/pico_types.h>
#include <pico/pico_port.h>

// registers - matches structure order
typedef enum {
Expand Down
2 changes: 1 addition & 1 deletion pico/32x/32x.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
#include "../pico_int.h"
#include "../sound/ym2612.h"
#include "../../cpu/sh2/compiler.h"
#include <cpu/sh2/compiler.h>

struct Pico32x Pico32x;
SH2 sh2s[2];
Expand Down
20 changes: 10 additions & 10 deletions pico/32x/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ int DrawLineDestIncrement32x;

static void convert_pal555(int invert_prio)
{
unsigned int *ps = (void *)Pico32xMem->pal;
unsigned int *pd = (void *)Pico32xMem->pal_native;
unsigned int m1 = 0x001f001f;
unsigned int m2 = 0x03e003e0;
unsigned int m3 = 0xfc00fc00; // includes prio bit
unsigned int inv = 0;
u32 *ps = (void *)Pico32xMem->pal;
u32 *pd = (void *)Pico32xMem->pal_native;
u32 m1 = 0x001f001f;
u32 m2 = 0x03e003e0;
u32 m3 = 0xfc00fc00; // includes prio bit
u32 inv = 0;
int i;

if (invert_prio)
inv = 0x80008000;

for (i = 0x100/2; i > 0; i--, ps++, pd++) {
unsigned int t = *ps ^ inv;
u32 t = *ps ^ inv;
*pd = PXCONV(t);
}

Expand All @@ -48,9 +48,9 @@ static void convert_pal555(int invert_prio)
// direct color mode
#define do_line_dc(pd, p32x, pmd, inv, pmd_draw_code) \
{ \
const unsigned int m1 = 0x001f; \
const unsigned int m2 = 0x03e0; \
const unsigned int m3 = 0x7c00; \
const u16 m1 = 0x001f; \
const u16 m2 = 0x03e0; \
const u16 m3 = 0x7c00; \
unsigned short t; \
int i = 320; \
\
Expand Down
4 changes: 2 additions & 2 deletions pico/32x/draw_arm.S
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
@* See COPYING file in the top-level directory.
@*

#include "pico/arm_features.h"
#include "pico/pico_int_offs.h"
#include <pico/arm_features.h>
#include <pico/pico_int_offs.h>

.extern Pico32x
.extern Pico
Expand Down
2 changes: 1 addition & 1 deletion pico/32x/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "../pico_int.h"
#include "../memory.h"

#include "../../cpu/sh2/compiler.h"
#include <cpu/sh2/compiler.h>
DRC_DECLARE_SR;

static const char str_mars[] = "MARS";
Expand Down
2 changes: 1 addition & 1 deletion pico/32x/memory_arm.S
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* See COPYING file in the top-level directory.
*/

#include "../pico_int_offs.h"
#include <pico/pico_int_offs.h>

@ 32X bank sizes... TODO this should somehow come from an include file
.equ SH2_ROM_SHIFT, 10 @ 0x003fffff
Expand Down
18 changes: 9 additions & 9 deletions pico/32x/sh2soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
#include "../pico_int.h"
#include "../memory.h"

#include "../../cpu/sh2/compiler.h"
#include <cpu/sh2/compiler.h>
DRC_DECLARE_SR;

// DMAC handling
struct dma_chan {
unsigned int sar, dar; // src, dst addr
unsigned int tcr; // transfer count
unsigned int chcr; // chan ctl
u32 sar, dar; // src, dst addr
u32 tcr; // transfer count
u32 chcr; // chan ctl
// -- dm dm sm sm ts ts ar am al ds dl tb ta ie te de
// ts - transfer size: 1, 2, 4, 16 bytes
// ar - auto request if 1, else dreq signal
Expand All @@ -47,11 +47,11 @@ struct dma_chan {

struct dmac {
struct dma_chan chan[2];
unsigned int vcrdma0;
unsigned int unknown0;
unsigned int vcrdma1;
unsigned int unknown1;
unsigned int dmaor;
u32 vcrdma0;
u32 unknown0;
u32 vcrdma1;
u32 unknown1;
u32 dmaor;
// -- pr ae nmif dme
// pr - priority: chan0 > chan1 or round-robin
// ae - address error
Expand Down
4 changes: 2 additions & 2 deletions pico/cart.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*/

#include "pico_int.h"
#include "../cpu/debug.h"
#include "../unzip/unzip.h"
#include <cpu/debug.h>
#include <unzip/unzip.h>
#include <zlib.h>

#ifdef USE_LIBRETRO_VFS
Expand Down
6 changes: 3 additions & 3 deletions pico/carthw/svp/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* See COPYING file in the top-level directory.
*/

#include "../../pico_int.h"
#include "../../../cpu/drc/cmn.h"
#include <pico/pico_int.h>
#include <cpu/drc/cmn.h>
#include "compiler.h"

// FIXME: asm has these hardcoded
Expand Down Expand Up @@ -39,7 +39,7 @@ void ssp_drc_end(void){}
#endif

#define COUNT_OP
#include "../../../cpu/drc/emit_arm.c"
#include <cpu/drc/emit_arm.c>

// -----------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions pico/carthw/svp/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../../pico_int.h"
#include "../../memory.h"
#include <pico/pico_int.h>
#include <pico/memory.h>

// for wait loop det
static void PicoWrite16_dram(u32 a, u32 d)
Expand Down
2 changes: 1 addition & 1 deletion pico/carthw/svp/ssp16.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
* ops not used by VR are not implemented
*/

#include "../../pico_int.h"
#include <pico/pico_int.h>

#define u32 unsigned int

Expand Down
2 changes: 1 addition & 1 deletion pico/carthw/svp/stub_arm.S
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@* See COPYING file in the top-level directory.
@*

#include "../../arm_features.h"
#include <pico/arm_features.h>

@.syntax unified
.text
Expand Down
12 changes: 6 additions & 6 deletions pico/cd/genplus_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
#undef int16
#undef int32

#define uint8 unsigned char
#define uint16 unsigned short
#define uint32 unsigned int
#define int8 signed char
#define int16 signed short
#define int32 signed int
#define uint8 u8
#define uint16 u16
#define uint32 u32
#define int8 s8
#define int16 s16
#define int32 s32

#define READ_BYTE(BASE, ADDR) (BASE)[(ADDR)^1]
#define WRITE_BYTE(BASE, ADDR, VAL) (BASE)[(ADDR)^1] = (VAL)
Expand Down
2 changes: 1 addition & 1 deletion pico/cd/gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static void gfx_render(uint32 bufferIndex, uint32 width)
}
}

void gfx_start(unsigned int base)
void gfx_start(uint32 base)
{
/* make sure 2M mode is enabled */
if (!(Pico_mcd->s68k_regs[3] & 0x04))
Expand Down
2 changes: 1 addition & 1 deletion pico/cd/gfx_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
PICO_INTERNAL void DmaSlowCell(u32 source, u32 a, int len, unsigned char inc)
{
unsigned char *base;
unsigned int asrc, a2;
u32 asrc, a2;
u16 *r;

base = Pico_mcd->word_ram1M[Pico_mcd->s68k_regs[3]&1];
Expand Down
4 changes: 2 additions & 2 deletions pico/cd/memory_arm.S
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
@* See COPYING file in the top-level directory.
@*

#include "../arm_features.h"
#include "../pico_int_offs.h"
#include <pico/arm_features.h>
#include <pico/pico_int_offs.h>

.equiv PCM_STEP_SHIFT, 11

Expand Down
1 change: 0 additions & 1 deletion pico/debugCPU.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "pico_int.h"

typedef unsigned char u8;

static unsigned int pppc, ops=0;
extern unsigned int lastread_a, lastread_d[16], lastwrite_cyc_d[16], lastwrite_mus_d[16];
Expand Down
6 changes: 3 additions & 3 deletions pico/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static unsigned char DefHighCol[8+320+8];
unsigned char *HighColBase = DefHighCol;
int HighColIncrement;

static u16 DefOutBuff[320*2];
static u16 DefOutBuff[320*2] ALIGNED(4);
void *DrawLineDestBase = DefOutBuff;
int DrawLineDestIncrement;

Expand Down Expand Up @@ -200,15 +200,15 @@ TileFlipMaker(TileFlipNonSH, pix_nonsh)
// draw sprite pixels, process operator colors
#define pix_sh(x) \
if (likely(t)) \
pd[x]=(likely(t<0xe) ? pal|t : pd[x]|((t-1)<<6));
pd[x]=(likely(t<0xe) ? pal|t : pd[x]|((t-1)<<6))

TileNormMaker(TileNormSH, pix_sh)
TileFlipMaker(TileFlipSH, pix_sh)

// draw sprite pixels, mark but don't process operator colors
#define pix_sh_markop(x) \
if (likely(t)) \
pd[x]=(likely(t<0xe) ? pal|t : pd[x]|0x40);
pd[x]=(likely(t<0xe) ? pal|t : pd[x]|0x40)

TileNormMaker(TileNormSH_markop, pix_sh_markop)
TileFlipMaker(TileFlipSH_markop, pix_sh_markop)
Expand Down
1 change: 0 additions & 1 deletion pico/pico/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
#include "../pico_int.h"
#include "../memory.h"
#include "../sound/sn76496.h"

/*
void dump(u16 w)
Expand Down
Loading

0 comments on commit f821bb7

Please sign in to comment.