mirror of
https://github.com/libretro/RACE.git
synced 2024-11-23 00:49:43 +00:00
Cleanups
This commit is contained in:
parent
da1d88521e
commit
cb002043c6
@ -49,7 +49,7 @@ ifneq ($(STATIC_LINKING), 1)
|
||||
$(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c
|
||||
endif
|
||||
|
||||
FLAGS += -D__LIBRETRO__ -D_MAX_PATH=2048 -DHOST_FPS=60
|
||||
FLAGS += -D__LIBRETRO__ -D_MAX_PATH=2048
|
||||
ifeq (,$(findstring msvc,$(platform)))
|
||||
CXXFLAGS += -fpermissive
|
||||
endif
|
||||
|
39
flash.c
39
flash.c
@ -40,9 +40,6 @@ unsigned char deviceID = 0x2F;
|
||||
unsigned char cartSize = 32;
|
||||
unsigned int bootBlockStartAddr = 0x1F0000;
|
||||
unsigned char bootBlockStartNum = 31;
|
||||
#if 0
|
||||
unsigned int cartAddrMask = 0x3FFFFF;
|
||||
#endif
|
||||
|
||||
/* with selector, I get
|
||||
* writeSaveGameFile: Couldn't open Battery//mnt/sd/Games/race/ChryMast.ngf file
|
||||
@ -85,42 +82,27 @@ void setupFlashParams(void)
|
||||
deviceID = 0x2F; /* the upper chip will always be 16bit */
|
||||
bootBlockStartAddr = 0x1F0000;
|
||||
bootBlockStartNum = 31;
|
||||
#if 0
|
||||
cartAddrMask=0x3FFFFF;
|
||||
#endif
|
||||
break;
|
||||
case 16:
|
||||
deviceID = 0x2F;
|
||||
bootBlockStartAddr = 0x1F0000;
|
||||
bootBlockStartNum = 31;
|
||||
#if 0
|
||||
cartAddrMask=0x1FFFFF;
|
||||
#endif
|
||||
break;
|
||||
case 8:
|
||||
deviceID = 0x2C;
|
||||
bootBlockStartAddr = 0xF0000;
|
||||
bootBlockStartNum = 15;
|
||||
#if 0
|
||||
cartAddrMask=0x0FFFFF;
|
||||
#endif
|
||||
break;
|
||||
case 4:
|
||||
deviceID = 0xAB;
|
||||
bootBlockStartAddr = 0x70000;
|
||||
bootBlockStartNum = 7;
|
||||
#if 0
|
||||
cartAddrMask=0x07FFFF;
|
||||
#endif
|
||||
break;
|
||||
case 0:
|
||||
manufID = 0x00;
|
||||
deviceID = 0x00;
|
||||
bootBlockStartAddr = 0x00000;
|
||||
bootBlockStartNum = 0;
|
||||
#if 0
|
||||
cartAddrMask=0;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -332,9 +314,6 @@ void writeSaveGameFile(void)
|
||||
needToWriteFile = 0;
|
||||
#ifdef TARGET_GP2X
|
||||
sync();
|
||||
#if 0
|
||||
system("sync");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -436,10 +415,6 @@ void loadSaveGameFile(void)
|
||||
|
||||
void flashWriteByte(unsigned int addr, unsigned char data, unsigned char operation)
|
||||
{
|
||||
#if 0
|
||||
addr &= cartAddrMask; /* the stuff gets mirrored to the higher slots. */
|
||||
#endif
|
||||
|
||||
if(blockNumFromAddr(addr) == 0) /* hack because DWARP writes to bank 0 */
|
||||
return;
|
||||
|
||||
@ -638,9 +613,6 @@ void vectFlashWrite(unsigned char chip, unsigned int to, unsigned char *fromAddr
|
||||
if(chip)
|
||||
to+=0x200000;
|
||||
|
||||
#if 0
|
||||
memcpy(dest,fromAddr,numBytes);
|
||||
#endif
|
||||
while(numBytes--)
|
||||
{
|
||||
flashWriteByte(to, *fromAddr, FLASH_WRITE);
|
||||
@ -651,21 +623,10 @@ void vectFlashWrite(unsigned char chip, unsigned int to, unsigned char *fromAddr
|
||||
|
||||
void vectFlashErase(unsigned char chip, unsigned char blockNum)
|
||||
{
|
||||
#if 0
|
||||
unsigned char totalBlocks = bootBlockStartNum+4;
|
||||
|
||||
if(blockNum >= totalBlocks)
|
||||
blockNum = totalBlocks-1;
|
||||
#endif
|
||||
|
||||
/* this needs to be modified to take into account boot block areas (less than 64k) */
|
||||
unsigned int blockAddr = blockNumToAddr(chip, blockNum);
|
||||
unsigned int numBytes = blockSize(blockNum);
|
||||
|
||||
#if 0
|
||||
/* memset block to 0xFF */
|
||||
memset(&mainrom[blockAddr], 0xFF, numBytes);
|
||||
#endif
|
||||
while(numBytes--)
|
||||
{
|
||||
flashWriteByte(blockAddr, 0xFF, FLASH_ERASE);
|
||||
|
131
graphics.c
131
graphics.c
@ -105,12 +105,6 @@ unsigned short p2[16] = {
|
||||
/* extra fudge factor for PSP? */
|
||||
#define SCREEN_OFFET (SCREEN_X_OFFSET + (SCREEN_Y_OFFSET*(screen->w+PSP_FUDGE)))
|
||||
|
||||
/* Flavor - For speed testing, you can turn off screen updates */
|
||||
|
||||
#if 0
|
||||
#define NO_SCREEN_OUTPUT /* seems to give about 4-6FPS on GP2X */
|
||||
#endif
|
||||
|
||||
/*
|
||||
*
|
||||
* Palette Initialization
|
||||
@ -234,10 +228,6 @@ static void darken_rgb(float *r, float *g, float *b)
|
||||
|
||||
void palette_init16(DWORD dwRBitMask, DWORD dwGBitMask, DWORD dwBBitMask)
|
||||
{
|
||||
#if 0
|
||||
dbg_print("in palette_init16(0x%X, 0x%X, 0x%X)\n", dwRBitMask, dwGBitMask, dwBBitMask);
|
||||
#endif
|
||||
|
||||
char RShiftCount = 0, GShiftCount = 0, BShiftCount = 0;
|
||||
char RBitCount = 0, GBitCount = 0, BBitCount = 0;
|
||||
int r,g,b;
|
||||
@ -395,10 +385,6 @@ void pngpalette_init(void)
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static const bwTable[8] = { 0x0000, 0x0333, 0x0555, 0x0777, 0x0999, 0x0BBB, 0x0DDD, 0x0FFF };
|
||||
#endif
|
||||
|
||||
/* NOTA Color para juegos b/n */
|
||||
static const unsigned short bwTable[8] =
|
||||
{
|
||||
@ -426,10 +412,6 @@ typedef struct
|
||||
}
|
||||
SPRITEDEFS;
|
||||
|
||||
#if 0
|
||||
unsigned int spritesDirty = true;
|
||||
#endif
|
||||
|
||||
SPRITEDEFS spriteDefs[3]; /* 4 priority levels */
|
||||
|
||||
/* definitions of types and variables that are used internally during
|
||||
@ -456,12 +438,6 @@ unsigned short palettes[16*4+16*4+16*4]; /* placeholder for the converted palett
|
||||
TILECACHE tCBack; /* tile pointer cache for the back buffer */
|
||||
TILECACHE tCFront; /* tile pointer cache for the front buffer */
|
||||
|
||||
#if 0
|
||||
int BGCol; /* placeholder for the background color this VSYNC */
|
||||
int OOWCol; /* placeholder for the outside window color this VSYNC */
|
||||
unsigned char SprPriLo, SprPriHi, SprPri = 0;
|
||||
#endif
|
||||
|
||||
static INLINE void set_paletteCol(
|
||||
unsigned short *palette_table,
|
||||
unsigned short *sprite,
|
||||
@ -475,30 +451,15 @@ static INLINE void set_paletteCol(
|
||||
*/
|
||||
|
||||
for(i=0;i<16*4;i++)
|
||||
{
|
||||
#if 0
|
||||
sprite[i] = *palette_table & 0x0FFF;
|
||||
#endif
|
||||
sprite[i] = NGPC_TO_SDL16(palette_table[i]);
|
||||
}
|
||||
|
||||
/* initialize front plane palette table */
|
||||
for(i=0;i<16*4;i++)
|
||||
{
|
||||
#if 0
|
||||
front[i] = *palette_table & 0x0FFF;
|
||||
#endif
|
||||
front[i] = NGPC_TO_SDL16(palette_table[i+16*4]);
|
||||
}
|
||||
|
||||
/* initialize sprite palette table (?) */
|
||||
for(i=0;i<16*4;i++)
|
||||
{
|
||||
#if 0
|
||||
back[i] = *palette_table & 0x0FFF;
|
||||
#endif
|
||||
back[i] = NGPC_TO_SDL16(palette_table[i+16*4*2]);
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void set_paletteBW(
|
||||
@ -677,75 +638,6 @@ static INLINE void lineSprite(SPRITEDEFS *sprDefs)
|
||||
}
|
||||
|
||||
/* sort all the sprites according to their priorities */
|
||||
#if 0
|
||||
static void spriteSort(unsigned int bw)
|
||||
{
|
||||
unsigned short spriteCode;
|
||||
unsigned short *pt;
|
||||
unsigned char x, y, prevx=0, prevy=0;
|
||||
int i, j;
|
||||
|
||||
SPRITEDEFS *SprPri00 = &spriteDefs[0];
|
||||
SPRITEDEFS *SprPri40 = &spriteDefs[1];
|
||||
SPRITEDEFS *SprPri80 = &spriteDefs[2];
|
||||
SPRITEDEFS *SprPriC0 = &spriteDefs[3];
|
||||
|
||||
/* initialize the number of sprites in each structure */
|
||||
SprPri00->count = 0;
|
||||
SprPri40->count = 0;
|
||||
SprPri80->count = 0;
|
||||
SprPriC0->count = 0;
|
||||
for (i=0;i<64;i++)
|
||||
{
|
||||
spriteCode = *((unsigned short *)(sprite_table+4*i));
|
||||
if (spriteCode & 0x0400)
|
||||
prevx+= *(sprite_table+4*i+2);
|
||||
else
|
||||
prevx = *(sprite_table+4*i+2) + 8;
|
||||
x = prevx + *scrollSpriteX;
|
||||
if (spriteCode & 0x0200)
|
||||
prevy+= *(sprite_table+4*i+3);
|
||||
else
|
||||
prevy = *(sprite_table+4*i+3) + 8;
|
||||
y = prevy + *scrollSpriteY;
|
||||
j = *scanlineY+8 - y;
|
||||
if ((spriteCode>0xff) && (j >= 0) && (j < 8) && (x<168)) /* is this sprite visable on the current scanline? */
|
||||
{
|
||||
// if ((j >= 0) && (j < 8) && (x<168)) {
|
||||
SPRITE *spr = NULL;
|
||||
// *(sprite_palette_numbers+i)
|
||||
pt = (unsigned short *)(pattern_table + 16*(spriteCode & 0x01ff)
|
||||
+ ((spriteCode&0x4000) ? (7-j)*2 : j*2));
|
||||
switch (spriteCode & 0x1800)
|
||||
{
|
||||
// case order reversed because priority 3 (and 2) sprites occur most of the time
|
||||
case 0x1800:
|
||||
spr = &SprPriC0->sprite[SprPriC0->count];
|
||||
SprPriC0->count++;
|
||||
break;
|
||||
case 0x1000:
|
||||
spr = &SprPri80->sprite[SprPri80->count];
|
||||
SprPri80->count++;
|
||||
break;
|
||||
case 0x0800:
|
||||
spr = &SprPri40->sprite[SprPri40->count];
|
||||
SprPri40->count++;
|
||||
break;
|
||||
case 0x0000:
|
||||
spr = &SprPri00->sprite[SprPri00->count];
|
||||
SprPri00->count++;
|
||||
break;
|
||||
}
|
||||
spr->pattern = spriteCode;
|
||||
spr->offset = x;
|
||||
spr->tilept = pt;
|
||||
spr->palette = ((bw) ? &palettes[(spriteCode>>11)&0x04]
|
||||
: &palettes[(*(sprite_palette_numbers+i)&0x0F)*4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static INLINE void spriteSortAll(unsigned int bw)
|
||||
{
|
||||
unsigned int spriteCode;
|
||||
@ -789,10 +681,6 @@ static INLINE void spriteSortAll(unsigned int bw)
|
||||
if(scanline < 0 || scanline >= 152)
|
||||
continue;
|
||||
|
||||
#if 0
|
||||
if ((x<168) && (spriteCode>0xff) && (spriteCode & 0x1800))
|
||||
{
|
||||
#endif
|
||||
switch (spriteCode & 0x1800)
|
||||
{
|
||||
/* case order reversed because priority 3 (and 2) sprites occur most of the time */
|
||||
@ -813,9 +701,6 @@ static INLINE void spriteSortAll(unsigned int bw)
|
||||
+ ((spriteCode&0x4000) ? (7-j)*2 : j*2));
|
||||
spr->palette = ((bw) ? &palettes[(spriteCode>>11)&0x04]
|
||||
: &palettes[(*(sprite_palette_numbers+i)&0x0F)*4]);
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -838,25 +723,15 @@ static void graphicsBlitInit(void)
|
||||
tCFront.tileBase = tile_table_front;
|
||||
tCFront.palette = &palettes[16*4];
|
||||
/* definitions for sprite priorities */
|
||||
#if 0
|
||||
SprPriLo = *frame1Pri>>6;
|
||||
SprPriHi = *frame0Pri>>6; /* ? */
|
||||
#endif
|
||||
spriteDefs[0].gbp = &drawBuffer[8*SIZEX];
|
||||
spriteDefs[1].gbp = &drawBuffer[8*SIZEX];
|
||||
spriteDefs[2].gbp = &drawBuffer[8*SIZEX];
|
||||
#if 0
|
||||
spriteDefs[3].gbp = &drawBuffer[8*SIZEX];
|
||||
#endif
|
||||
/* force recalculations for first line */
|
||||
tCBack.oldScrollX = *tCBack.newScrollX;
|
||||
tCBack.oldScrollY = *tCBack.newScrollY+1; /* force calculation of structure data */
|
||||
tCFront.oldScrollX = *tCFront.newScrollX;
|
||||
tCFront.oldScrollY = *tCFront.newScrollY+1; /* force calculation of structure data */
|
||||
/* start drawing at line 0 */
|
||||
#if 0
|
||||
*scanlineY = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static INLINE void RenderTileCache(TILECACHE *tC, unsigned int bw)
|
||||
@ -1371,18 +1246,12 @@ BOOL graphics_init(void)
|
||||
case NGP:
|
||||
bgTable = (unsigned short *)bwTable;
|
||||
oowTable = (unsigned short *)bwTable;
|
||||
#if 0
|
||||
set_palette = set_paletteBW;
|
||||
#endif
|
||||
graphicsBlitInit();
|
||||
*scanlineY = 0;
|
||||
break;
|
||||
case NGPC:
|
||||
bgTable = (unsigned short *)get_address(0x000083E0);
|
||||
oowTable = (unsigned short *)get_address(0x000083F0);
|
||||
#if 0
|
||||
set_palette = set_paletteCol;
|
||||
#endif
|
||||
graphicsBlitInit();
|
||||
*scanlineY = 0;
|
||||
break;
|
||||
|
@ -9,7 +9,7 @@ CORE_DIR := $(LOCAL_PATH)/..
|
||||
include $(CORE_DIR)/Makefile.common
|
||||
|
||||
COREFLAGS := $(INCFLAGS) $(FLAGS) -DWANT_CRC32
|
||||
COREFLAGS += -D__LIBRETRO__ -D_MAX_PATH=2048 -DHOST_FPS=60
|
||||
COREFLAGS += -D__LIBRETRO__ -D_MAX_PATH=2048
|
||||
|
||||
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
|
||||
ifneq ($(GIT_VERSION)," unknown")
|
||||
|
@ -418,10 +418,10 @@ void retro_run(void)
|
||||
update_audio_latency = false;
|
||||
}
|
||||
|
||||
tlcs_execute(CPU_FREQ / HOST_FPS, skipFrame);
|
||||
tlcs_execute(CPU_FREQ / 60, skipFrame);
|
||||
|
||||
/* Get the number of samples in a frame */
|
||||
samplesPerFrame = RETRO_SAMPLE_RATE / HOST_FPS;
|
||||
samplesPerFrame = RETRO_SAMPLE_RATE / 60;
|
||||
|
||||
memset(sampleBuffer, 0, samplesPerFrame * sizeof(int16_t));
|
||||
|
||||
|
3
main.h
3
main.h
@ -27,9 +27,6 @@
|
||||
|
||||
#define NR_OF_SYSTEMS 2
|
||||
|
||||
/* to call these FPS is a bit of a misnomer */
|
||||
#define HOST_FPS 60 /* the number of frames we want to draw to the host's screen every second */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -32,14 +32,10 @@
|
||||
|
||||
/* define work memory for neogeo pocket color
|
||||
*
|
||||
* internal cpu ram and internal I/O register (2KB + 160 bytes)
|
||||
* internal cpu RAM and internal I/O register (2KB + 160 bytes)
|
||||
*/
|
||||
|
||||
#if 0
|
||||
unsigned char cpuram[0x08a0];
|
||||
#endif
|
||||
|
||||
/* regular work ram (32 kbytes?)
|
||||
/* regular work RAM (32 kbytes?)
|
||||
* on the gameboy maximum of 128kbyte of RAM is possible, plus some internal ram (64KB) */
|
||||
unsigned char __attribute__ ((__aligned__(4))) mainram[(64+32+128)*1024];
|
||||
// rom area for roms (4 Megabyte)
|
||||
|
@ -237,10 +237,6 @@ static INLINE void tlcsMemWriteB(unsigned int addr, unsigned char data)
|
||||
{
|
||||
switch(addr)
|
||||
{
|
||||
#if 0
|
||||
case 0x80: /* CPU speed */
|
||||
break;
|
||||
#endif
|
||||
case 0xA0: /* L CH Sound Source Control Register */
|
||||
if (cpuram[0xB8] == 0x55 && cpuram[0xB9] == 0xAA)
|
||||
Write_SoundChipNoise(data);/*Flavor SN76496Write(0, data); */
|
||||
@ -254,17 +250,7 @@ static INLINE void tlcsMemWriteB(unsigned int addr, unsigned char data)
|
||||
if (cpuram[0xB8] == 0xAA)
|
||||
dac_writeL(data); /*Flavor DAC_data_w(0,data); */
|
||||
break;
|
||||
#if 0
|
||||
case 0xA3: /* R CH DAC Control Register */ /* Flavor hack for mono only sound */
|
||||
ngpSoundExecute();
|
||||
if (cpuram[0xB8] == 0xAA)
|
||||
dac_writeR(data); /* Flavor DAC_data_w(1,data); */
|
||||
break;
|
||||
#endif
|
||||
case 0xB8: /* Z80 Reset */
|
||||
#if 0
|
||||
if (data == 0x55) DAC_data_w(0,0);
|
||||
#endif
|
||||
case 0xB9: /* Sourd Source Reset Control Register */
|
||||
switch(data)
|
||||
{
|
||||
@ -294,15 +280,6 @@ static INLINE void tlcsMemWriteB(unsigned int addr, unsigned char data)
|
||||
if (addr == 0x87E2 && mainram[0x47F0] != 0xAA)
|
||||
return; /* disallow writes to GEMODE */
|
||||
|
||||
#if 0
|
||||
if((addr >= 0x8800 && addr <= 0x88FF)
|
||||
|| (addr >= 0x8C00 && addr <= 0x8FFF)
|
||||
|| (addr >= 0xA000 && addr <= 0xBFFF)
|
||||
|| addr == 0x00008020
|
||||
|| addr == 0x00008021)
|
||||
spritesDirty = true;
|
||||
#endif
|
||||
|
||||
mainram[addr-0x00004000] = data;
|
||||
return;
|
||||
}
|
||||
|
8
sound.c
8
sound.c
@ -57,12 +57,7 @@ void ngpSoundExecute(void)
|
||||
#if defined(DRZ80) || defined(CZ80)
|
||||
int toRun = sndCycles/2;
|
||||
if(ngpRunning)
|
||||
{
|
||||
Z80_Execute(toRun);
|
||||
}
|
||||
#if 0
|
||||
timer_add_cycles(toRun);
|
||||
#endif
|
||||
sndCycles -= toRun;
|
||||
#else
|
||||
int elapsed;
|
||||
@ -70,9 +65,6 @@ void ngpSoundExecute(void)
|
||||
{
|
||||
elapsed = z80Step();
|
||||
sndCycles-= (2*elapsed);
|
||||
#if 0
|
||||
timer_add_cycles(elapsed);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
146
tlcs900h.c
146
tlcs900h.c
@ -362,13 +362,6 @@ static INLINE void tlcsMemWriteWaddrB(unsigned int addr, unsigned short data)
|
||||
|
||||
|
||||
#define mem_writeW tlcsMemWriteW
|
||||
#if 0
|
||||
static INLINE void mem_writeW(unsigned int addr, unsigned short data)
|
||||
{
|
||||
// if (addr > 0x200000) memoryCycles+= 2;
|
||||
tlcsMemWriteW(addr, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
// write a long word (data) to a memory address (addr)
|
||||
static INLINE void tlcsMemWriteL(unsigned int addr, unsigned int data)
|
||||
@ -399,13 +392,6 @@ static INLINE void tlcsMemWriteL(unsigned int addr, unsigned int data)
|
||||
}
|
||||
|
||||
#define mem_writeL tlcsMemWriteL
|
||||
#if 0
|
||||
static INLINE void mem_writeL(unsigned int addr, unsigned int data)
|
||||
{
|
||||
// if (addr > 0x200000) memoryCycles+= 4;
|
||||
tlcsMemWriteL(addr, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static INLINE unsigned char readbyte(void)
|
||||
@ -979,14 +965,6 @@ static INLINE unsigned char srGE(void)
|
||||
|| ((gen_regsSR & (SF|VF)) == VF)) ? 0 : 1);
|
||||
}
|
||||
|
||||
#if 0
|
||||
unsigned char srGE(void)
|
||||
{
|
||||
return ((((gen_regsSR & (SF|VF)) == (VF|SF))
|
||||
|| ((gen_regsSR & (SF|VF)) == 0)) ? 1 : 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static INLINE unsigned char srGT(void)
|
||||
{
|
||||
return (((((gen_regsSR & (SF|VF)) == SF)
|
||||
@ -994,15 +972,6 @@ static INLINE unsigned char srGT(void)
|
||||
|| (gen_regsSR & ZF)) ? 0 : 1);
|
||||
}
|
||||
|
||||
#if 0
|
||||
unsigned char srGT(void)
|
||||
{
|
||||
return (((((gen_regsSR & (SF|VF)) == (VF|SF))
|
||||
|| ((gen_regsSR & (SF|VF)) == 0))
|
||||
&& (gen_regsSR & ZF)) ? 1 : 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static INLINE unsigned char srUGT(void)
|
||||
{
|
||||
return ((gen_regsSR & (ZF|CF)) ? 0 : 1);
|
||||
@ -1538,52 +1507,6 @@ int ldiw(void) // LDIW (XDE+),(XHL+) 10010011 00010000
|
||||
int ldir(void) // LDIR (XDE+),(XHL+) 10000011 00010001
|
||||
// LDIR (XIX+),(XIY+) 10000101 00010001
|
||||
{
|
||||
#if 0 //causes problems when starting new game in CFC1
|
||||
unsigned char *dst,*src;
|
||||
int cnt=*cregsW[1];
|
||||
|
||||
if(cnt==0)
|
||||
cnt=0x10000;
|
||||
|
||||
if (opcode&2)
|
||||
{
|
||||
dst=get_address(*cregsL[2]);
|
||||
src=get_address(*cregsL[3]);
|
||||
*cregsL[2]+=cnt;
|
||||
*cregsL[3]+=cnt;
|
||||
//dbg_print("ldir: 1-called with cnt=0x%04X dst=0x%06X src=0x%06X\n", cnt, *cregsL[2], *cregsL[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
dst=get_address(gen_regsXIX);
|
||||
src=get_address(gen_regsXIY);
|
||||
gen_regsXIX+=cnt;
|
||||
gen_regsXIY+=cnt;
|
||||
//dbg_print("ldir: 2-called with cnt=0x%04X dst=0x%06X src=0x%06X\n", cnt, gen_regsXIX, gen_regsXIY);
|
||||
}
|
||||
|
||||
if(dst && src)
|
||||
{
|
||||
//delta warp tries to read from 0x0FA000 (get_address returns NULL)
|
||||
/*MOTM produces
|
||||
ldir: 1-called with cnt=0x2BFF dst=0x006C00 src=0x006BFF
|
||||
ldir: 1-called with cnt=0x0008 dst=0x0067DC src=0x0067E4
|
||||
so, memcpy won't work
|
||||
*/
|
||||
do
|
||||
{
|
||||
*dst++=*src++;
|
||||
}while(--*cregsW[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(dst)
|
||||
memset(dst, 0xFF, cnt);
|
||||
}
|
||||
|
||||
gen_regsSR = gen_regsSR & ~(HF|VF|NF);
|
||||
return 14*cnt+10;
|
||||
#else
|
||||
if (opcode&2)
|
||||
{
|
||||
// XDE/XHL
|
||||
@ -1607,56 +1530,11 @@ int ldir(void) // LDIR (XDE+),(XHL+) 10000011 00010001
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int ldirw(void) // LDIRW (XDE+),(XHL+) 10010011 00010001
|
||||
// LDIRW (XIX+),(XIY+) 10010101 00010001
|
||||
{
|
||||
#if 0 //causes problems when starting new game in CFC1
|
||||
unsigned char *dst,*src;
|
||||
int cnt=*cregsW[1];
|
||||
|
||||
if(cnt==0)
|
||||
cnt=0x10000;
|
||||
|
||||
if (opcode&2)
|
||||
{
|
||||
dst=(unsigned char *)get_address(*cregsL[2]);
|
||||
src=(unsigned char *)get_address(*cregsL[3]);
|
||||
*cregsL[2]+= 2*cnt;
|
||||
*cregsL[3]+= 2*cnt;
|
||||
//dbg_print("ldirw: 1-called with cnt=0x%04X dst=0x%06X src=0x%06X\n", cnt, *cregsL[2], *cregsL[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*if(gen_regsXIY == 0xFA000) //Delta Warp stupidly does this
|
||||
src=get_address(gen_regsXIY+0x200000);*/
|
||||
src=(unsigned char *)get_address(gen_regsXIY);
|
||||
dst=(unsigned char *)get_address(gen_regsXIX);
|
||||
gen_regsXIX+=2*cnt;
|
||||
gen_regsXIY+=2*cnt;
|
||||
//dbg_print("ldirw: 2-called with cnt=0x%04X dst=0x%06X src=0x%06X\n", cnt, gen_regsXIX, gen_regsXIY);
|
||||
}
|
||||
|
||||
if(dst && src)
|
||||
{
|
||||
//memmove(dst, src, cnt*2); //delta warp tries to read from 0x0FA000 (get_address returns NULL)
|
||||
do
|
||||
{
|
||||
*dst++=*src++;
|
||||
*dst++=*src++;
|
||||
}while(--*cregsW[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(dst)
|
||||
memset(dst, 0xFF, cnt*2);
|
||||
}
|
||||
|
||||
gen_regsSR = gen_regsSR & ~(HF|VF|NF);
|
||||
return 14*cnt+10;
|
||||
#else
|
||||
if (opcode&2)
|
||||
{ // XDE/XHL
|
||||
mem_writeW(*cregsL[2],mem_readW(*cregsL[3]));
|
||||
@ -1687,7 +1565,6 @@ int ldirw(void) // LDIRW (XDE+),(XHL+) 10010011 00010001
|
||||
return 10;
|
||||
// return 10+4;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int ldd(void) // LDD (XDE-),(XHL-) 10000011 00010010
|
||||
@ -8384,9 +8261,6 @@ static int tlcs_step(void)
|
||||
|
||||
opcode = readbyte();
|
||||
|
||||
//printf("tlcs_step: PC=0x%X opcode=0x%X\n", gen_regsPC-1, opcode);
|
||||
|
||||
|
||||
clocks+= instr_table[opcode]();
|
||||
|
||||
clocks+= memoryCycles;
|
||||
@ -8398,7 +8272,6 @@ static int tlcs_step(void)
|
||||
}
|
||||
|
||||
|
||||
//extern unsigned char *ngpScX;
|
||||
extern unsigned char *ngpScY;
|
||||
int ngOverflow = 0;
|
||||
|
||||
@ -8418,12 +8291,8 @@ void tlcs_execute(int cycles)
|
||||
while(cycles > 0)
|
||||
{
|
||||
/* AKTODO */
|
||||
#if 0
|
||||
if(options[TURBO_OPTION])
|
||||
#else
|
||||
/* TODO/FIXME - perhaps this is too fast as a default? */
|
||||
if (1)
|
||||
#endif
|
||||
{
|
||||
//call a bunch of steps
|
||||
for (elapsed = tlcs_step();elapsed<(515>>(tlcsClockMulti-1)); elapsed += tlcs_step());
|
||||
@ -8438,9 +8307,6 @@ void tlcs_execute(int cycles)
|
||||
soundStep(elapsed);
|
||||
|
||||
hCounter-= elapsed;
|
||||
#if 0
|
||||
*ngpScX = hCounter>>2;
|
||||
#endif
|
||||
|
||||
if (hCounter < 0)
|
||||
{
|
||||
@ -8471,11 +8337,7 @@ void tlcs_execute(int cycles)
|
||||
tlcs_interrupt(2);
|
||||
#ifdef FRAMESKIP
|
||||
if(frame == 0)
|
||||
{
|
||||
frame = skipFrames;
|
||||
//SDL_Rect numRect = drawNumber(skipFrames, 10, 24);
|
||||
//SDL_UpdateRect(screen, numRect.x, numRect.y, numRect.w, numRect.h);
|
||||
}
|
||||
else
|
||||
frame--;
|
||||
#endif
|
||||
@ -8486,11 +8348,7 @@ void tlcs_execute(int cycles)
|
||||
}
|
||||
ngOverflow = hCounter + cycles;
|
||||
|
||||
//graphics_paint(); //paint the screen, if it's dirty
|
||||
|
||||
//MHE used to sound update here!?!?
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -8504,9 +8362,9 @@ void ngpc_run(void)
|
||||
while(m_bIsActive) //should be some way to exit
|
||||
{
|
||||
#ifdef FRAMESKIP
|
||||
tlcs_execute((6*1024*1024) / HOST_FPS, skipFrames);
|
||||
tlcs_execute((6*1024*1024) / 60, skipFrames);
|
||||
#else
|
||||
tlcs_execute((6*1024*1024) / HOST_FPS);
|
||||
tlcs_execute((6*1024*1024) / 60);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user