This commit is contained in:
twinaphex 2021-09-18 16:46:44 +02:00
parent 72d32efc61
commit b631efbf08
3 changed files with 7 additions and 71 deletions

View File

@ -121,7 +121,7 @@ static INLINE void FlipByteOrder(uint8_t *src, uint32_t count)
}
#endif
int32_t smem_read(StateMem *st, void *buffer, uint32_t len)
static int32_t smem_read(StateMem *st, void *buffer, uint32_t len)
{
if ((len + st->loc) > st->len)
return 0;
@ -132,7 +132,7 @@ int32_t smem_read(StateMem *st, void *buffer, uint32_t len)
return(len);
}
int32_t smem_write(StateMem *st, void *buffer, uint32_t len)
static int32_t smem_write(StateMem *st, void *buffer, uint32_t len)
{
if ((len + st->loc) > st->malloced)
{
@ -152,15 +152,7 @@ int32_t smem_write(StateMem *st, void *buffer, uint32_t len)
return(len);
}
int32_t smem_putc(StateMem *st, int value)
{
uint8_t tmpval = value;
if(smem_write(st, &tmpval, 1) != 1)
return(-1);
return(1);
}
int32_t smem_seek(StateMem *st, uint32_t offset, int whence)
static int32_t smem_seek(StateMem *st, uint32_t offset, int whence)
{
switch(whence)
{
@ -181,16 +173,10 @@ int32_t smem_seek(StateMem *st, uint32_t offset, int whence)
return(-1);
}
if(st->loc < 0)
{
st->loc = 0;
return(-1);
}
return(0);
}
int smem_write32le(StateMem *st, uint32_t b)
static int smem_write32le(StateMem *st, uint32_t b)
{
uint8_t s[4];
s[0]=b;
@ -200,7 +186,7 @@ int smem_write32le(StateMem *st, uint32_t b)
return((smem_write(st, s, 4)<4)?0:4);
}
int smem_read32le(StateMem *st, uint32_t *b)
static int smem_read32le(StateMem *st, uint32_t *b)
{
uint8_t s[4];
@ -356,47 +342,6 @@ static SFORMAT *FindSF(const char *name, SFORMAT *sf)
return NULL;
}
// Fast raw chunk reader
static void DOReadChunk(StateMem *st, SFORMAT *sf)
{
/* Size can sometimes be zero, so also check for the text name.
* These two should both be zero only at the end of a struct.
*/
while(sf->size || sf->name)
{
int32_t bytesize;
if(!sf->size || !sf->v)
{
sf++;
continue;
}
if(sf->size == (uint32_t) ~0) // Link to another SFORMAT struct
{
DOReadChunk(st, (SFORMAT *)sf->v);
sf++;
continue;
}
bytesize = sf->size;
/* Loading raw data, bool types are stored as they appear in memory,
* not as single bytes in the full state format.
*
* In the SFORMAT structure, the size member for bool entries is
* the number of bool elements, not the total in-memory size,
* so we adjust it here.
*/
if(sf->flags & MDFNSTATE_BOOL)
bytesize *= sizeof(bool);
smem_read(st, (uint8_t *)sf->v, bytesize);
sf++;
}
}
static int ReadStateChunk(StateMem *st, SFORMAT *sf, int size)
{
int temp = st->loc;

View File

@ -19,15 +19,6 @@ typedef struct
extern "C" {
#endif
/* Eh, we abuse the smem_* in-memory stream code
* in a few other places. :) */
int32_t smem_read(StateMem *st, void *buffer, uint32_t len);
int32_t smem_write(StateMem *st, void *buffer, uint32_t len);
int32_t smem_putc(StateMem *st, int value);
int32_t smem_seek(StateMem *st, uint32_t offset, int whence);
int smem_write32le(StateMem *st, uint32_t b);
int smem_read32le(StateMem *st, uint32_t *b);
int MDFNSS_SaveSM(void *st, int, int, const void*, const void*, const void*);
int MDFNSS_LoadSM(void *st, int, int);

View File

@ -808,8 +808,8 @@ static void DoOP(uint8 opcode)
}
} OP_EPILOGUE;
OP( 0xd4, i_aam ) { uint32 mult=FETCH; mult=0; I.regs.b[AH] = I.regs.b[AL] / 10; I.regs.b[AL] %= 10; SetSZPF_Word(I.regs.w[AW]); CLK(17); } OP_EPILOGUE;
OP( 0xd5, i_aad ) { uint32 mult=FETCH; mult=0; I.regs.b[AL] = I.regs.b[AH] * 10 + I.regs.b[AL]; I.regs.b[AH] = 0; SetSZPF_Byte(I.regs.b[AL]); CLK(6); } OP_EPILOGUE;
OP( 0xd4, i_aam ) { I.regs.b[AH] = I.regs.b[AL] / 10; I.regs.b[AL] %= 10; SetSZPF_Word(I.regs.w[AW]); CLK(17); } OP_EPILOGUE;
OP( 0xd5, i_aad ) { I.regs.b[AL] = I.regs.b[AH] * 10 + I.regs.b[AL]; I.regs.b[AH] = 0; SetSZPF_Byte(I.regs.b[AL]); CLK(6); } OP_EPILOGUE;
OP( 0xd6, i_setalc ) { I.regs.b[AL] = (CF)?0xff:0x00; CLK(3); } OP_EPILOGUE;
OP( 0xd7, i_trans ) { uint32 dest = (I.regs.w[BW]+I.regs.b[AL])&0xffff; I.regs.b[AL] = GetMemB(DS0, dest); CLK(5); } OP_EPILOGUE;